@p10node/office-engine 0.2.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -19
- package/dist/{DocViewer-PJieqbIR.js → DocViewer-CT8VAa1L.js} +67 -20
- package/dist/DocViewer-CT8VAa1L.js.map +1 -0
- package/dist/assets/worker-BEwT3OhG.js.map +1 -0
- package/dist/{collab-BvjXvfJ9.js → collab-Dx00zqXR.js} +215 -175
- package/dist/collab-Dx00zqXR.js.map +1 -0
- package/dist/collab.js +1 -1
- package/dist/core.js +1 -1
- package/dist/{default-worker-DfpaJUjf.js → default-worker-BDj6MNRA.js} +3 -3
- package/dist/default-worker-BDj6MNRA.js.map +1 -0
- package/dist/embed.js +2 -2
- package/dist/index.js +3 -3
- package/dist/office-engine.embed.js +28 -28
- package/dist/office-engine.worker.js +1 -1
- package/dist/types/core/xlsx/workbook.d.ts +2 -1
- package/dist/types/react/common/hooks.d.ts +1 -1
- package/dist/types/react/docx/DocxEditor.d.ts +6 -1
- package/dist/types/react/edit/input.d.ts +12 -0
- package/package.json +2 -1
- package/dist/DocViewer-PJieqbIR.js.map +0 -1
- package/dist/assets/worker-B1gMpGFN.js.map +0 -1
- package/dist/collab-BvjXvfJ9.js.map +0 -1
- package/dist/default-worker-DfpaJUjf.js.map +0 -1
|
@@ -6,8 +6,8 @@ var OfficeEngine=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:
|
|
|
6
6
|
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
7
|
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ae=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?z(n):``}function V(e,t){switch(e.tag){case 26:case 27:case 5:return z(e.type);case 16:return z(`Lazy`);case 13:return e.child!==t&&t!==null?z(`Suspense Fallback`):z(`Suspense`);case 19:return z(`SuspenseList`);case 0:case 15:return B(e.type,!1);case 11:return B(e.type.render,!1);case 1:return B(e.type,!0);case 31:return z(`Activity`);case 30:return z(`ViewTransition`);default:return``}}function je(e){try{var t=``,n=null;do t+=V(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
8
|
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}}var Me=Object.prototype.hasOwnProperty,Ne=t.unstable_scheduleCallback,Pe=t.unstable_cancelCallback,Fe=t.unstable_shouldYield,Ie=t.unstable_requestPaint,Le=t.unstable_now,Re=t.unstable_getCurrentPriorityLevel,ze=t.unstable_ImmediatePriority,Be=t.unstable_UserBlockingPriority,Ve=t.unstable_NormalPriority,He=t.unstable_LowPriority,Ue=t.unstable_IdlePriority,We=t.log,Ge=t.unstable_setDisableYieldValue,Ke=null,qe=null;function H(e){if(typeof We==`function`&&Ge(e),qe&&typeof qe.setStrictMode==`function`)try{qe.setStrictMode(Ke,e)}catch{}}var Je=Math.clz32?Math.clz32:Ze,Ye=Math.log,Xe=Math.LN2;function Ze(e){return e>>>=0,e===0?32:31-(Ye(e)/Xe|0)|0}var Qe=256,$e=262144,et=4194304;function tt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function nt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=tt(n))):i=tt(o):i=tt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=tt(n))):i=tt(o)):i=tt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function rt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function it(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Je(n),i=1<<r;t|=e[r],n&=~i}return t}function at(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ot(){var e=et;return et<<=1,!(et&62914560)&&(et=4194304),e}function st(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Je(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&ut(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ut(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function dt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ft(e,t){var n=t&-t;return n=n&42?1:pt(n),(n&(e.suspendedLanes|t))===0?n:0}function pt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function mt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ht(){var e=_e.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function gt(e,t){var n=_e.p;try{return _e.p=e,t()}finally{_e.p=n}}var _t=Math.random().toString(36).slice(2),vt=`__reactFiber$`+_t,yt=`__reactProps$`+_t,bt=`__reactContainer$`+_t,xt=`__reactEvents$`+_t,St=`__reactListeners$`+_t,Ct=`__reactHandles$`+_t,wt=`__reactResources$`+_t,Tt=`__reactMarker$`+_t,Et=`__reactLoad$`+_t;function Dt(e){delete e[vt],delete e[yt],delete e[St],delete e[Ct]}function Ot(e){var t;if(t=e[vt])return t;for(var n=e.parentNode;n;){if(t=n[bt]||n[vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[vt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function kt(e){if(e=e[vt]||e[bt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function At(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function jt(e){var t=e[wt];return t||(t=e[wt]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Mt(e){e[Tt]=!0}function Nt(e){e[Et]=void 0}var Pt=new Set,Ft={};function It(e,t){Lt(e,t),Lt(e+`Capture`,t)}function Lt(e,t){for(Ft[e]=t,e=0;e<t.length;e++)Pt.add(t[e])}var Rt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),zt={},Bt={};function Vt(e){return Me.call(Bt,e)?!0:Me.call(zt,e)?!1:Rt.test(e)?Bt[e]=!0:(zt[e]=!0,!1)}var Ht=!1;function Ut(){var e=Ht;return Ht=!1,e}function Wt(e,t,n){if(Vt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Gt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function qt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Yt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xt(e){if(!e._valueTracker){var t=Jt(e)?`checked`:`value`;e._valueTracker=Yt(e,t,``+e[t])}}function Zt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Jt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Qt=/[\n"\\]/g;function $t(e){return e.replace(Qt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function en(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+qt(t)):e.value!==``+qt(t)&&(e.value=``+qt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):nn(e,qt(n)):o===`number`&&e.value==t?nn(e,qt(e.value)):nn(e,qt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+qt(s):e.removeAttribute(`name`)}function tn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Xt(e);return}n=n==null?``:``+qt(n),t=t==null?n:``+qt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Xt(e)}function nn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function rn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+qt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function an(e,t,n){t!=null&&(t=``+qt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+qt(n)}function on(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(ge(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??(n=``),t=n}n=qt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Xt(e)}function sn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var cn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function ln(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||cn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function un(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Ht=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(ln(e,i,r),Ht=!0)}else for(var a in t)t.hasOwnProperty(a)&&ln(e,a,t[a])}function dn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var fn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),pn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function mn(e){return pn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function hn(){}var gn=null;function _n(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vn=null,yn=null;function bn(e){var t=kt(e);if(t&&(e=t.stateNode)){var n=e[yt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(en(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+$t(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[yt]||null;if(!i)throw Error(o(90));en(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Zt(r)}break a;case`textarea`:an(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&rn(e,!!n.multiple,t,!1)}}}var xn=!1;function Sn(e,t,n){if(xn)return e(t,n);xn=!0;try{return e(t)}finally{if(xn=!1,(vn!==null||yn!==null)&&(Ld(),vn&&(t=vn,e=yn,yn=vn=null,bn(t),e)))for(t=0;t<e.length;t++)bn(e[t])}}function Cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[yt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var wn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Tn=!1;if(wn)try{var En={};Object.defineProperty(En,"passive",{get:function(){Tn=!0}}),window.addEventListener(`test`,En,En),window.removeEventListener(`test`,En,En)}catch{Tn=!1}var Dn=null,On=null,kn=null;function An(){if(kn)return kn;var e,t=On,n=t.length,r,i=`value`in Dn?Dn.value:Dn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return kn=i.slice(e,1<r?1-r:void 0)}function jn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Mn(){return!0}function Nn(){return!1}function Pn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Mn:Nn,this.isPropagationStopped=Nn,this}return D(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Mn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Mn)},persist:function(){},isPersistent:Mn}),t}var Fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},In=Pn(Fn),Ln=D({},Fn,{view:0,detail:0}),Rn=Pn(Ln),zn,Bn,Vn,Hn=D({},Ln,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$n,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Vn&&(Vn&&e.type===`mousemove`?(zn=e.screenX-Vn.screenX,Bn=e.screenY-Vn.screenY):Bn=zn=0,Vn=e),zn)},movementY:function(e){return`movementY`in e?e.movementY:Bn}}),Un=Pn(Hn),Wn=Pn(D({},Hn,{dataTransfer:0})),Gn=Pn(D({},Ln,{relatedTarget:0})),Kn=Pn(D({},Fn,{animationName:0,elapsedTime:0,pseudoElement:0})),qn=Pn(D({},Fn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Jn=Pn(D({},Fn,{data:0})),Yn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Xn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Qn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Zn[e])?!!t[e]:!1}function $n(){return Qn}var er=Pn(D({},Ln,{key:function(e){if(e.key){var t=Yn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=jn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Xn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$n,charCode:function(e){return e.type===`keypress`?jn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?jn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),tr=Pn(D({},Hn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),nr=Pn(D({},Fn,{submitter:0})),rr=Pn(D({},Ln,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$n})),ir=Pn(D({},Fn,{propertyName:0,elapsedTime:0,pseudoElement:0})),ar=Pn(D({},Hn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),or=Pn(D({},Fn,{newState:0,oldState:0,source:0})),sr=[9,13,27,32],cr=wn&&`CompositionEvent`in window,lr=null;wn&&`documentMode`in document&&(lr=document.documentMode);var ur=wn&&`TextEvent`in window&&!lr,dr=wn&&(!cr||lr&&8<lr&&11>=lr),fr=` `,pr=!1;function mr(e,t){switch(e){case`keyup`:return sr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function hr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var gr=!1;function _r(e,t){switch(e){case`compositionend`:return hr(t);case`keypress`:return t.which===32?(pr=!0,fr):null;case`textInput`:return e=t.data,e===fr&&pr?null:e;default:return null}}function U(e,t){if(gr)return e===`compositionend`||!cr&&mr(e,t)?(e=An(),kn=On=Dn=null,gr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return dr&&t.locale!==`ko`?null:t.data;default:return null}}var vr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!vr[e.type]:t===`textarea`}function W(e,t,n,r){vn?yn?yn.push(r):yn=[r]:vn=r,t=$(t,`onChange`),0<t.length&&(n=new In(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var br=null,xr=null;function Sr(e){Bf(e,0)}function Cr(e){if(Zt(At(e)))return e}function wr(e,t){if(e===`change`)return t}var Tr=!1;if(wn){var Er;if(wn){var Dr=`oninput`in document;if(!Dr){var Or=document.createElement(`div`);Or.setAttribute(`oninput`,`return;`),Dr=typeof Or.oninput==`function`}Er=Dr}else Er=!1;Tr=Er&&(!document.documentMode||9<document.documentMode)}function kr(){br&&(br.detachEvent(`onpropertychange`,Ar),xr=br=null)}function Ar(e){if(e.propertyName===`value`&&Cr(xr)){var t=[];W(t,xr,e,_n(e)),Sn(Sr,t)}}function jr(e,t,n){e===`focusin`?(kr(),br=t,xr=n,br.attachEvent(`onpropertychange`,Ar)):e===`focusout`&&kr()}function Mr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Cr(xr)}function Nr(e,t){if(e===`click`)return Cr(t)}function Pr(e,t){if(e===`input`||e===`change`)return Cr(t)}function Fr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ir=typeof Object.is==`function`?Object.is:Fr;function Lr(e,t){if(Ir(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Me.call(t,i)||!Ir(e[i],t[i]))return!1}return!0}function Rr(e){if(e=e||(typeof document<`u`?document:void 0),e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function zr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Br(e,t){var n=zr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=zr(n)}}function Vr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rr(e.document)}return t}function Ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Wr=wn&&`documentMode`in document&&11>=document.documentMode,Gr=null,Kr=null,qr=null,Jr=!1;function Yr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jr||Gr==null||Gr!==Rr(r)||(r=Gr,`selectionStart`in r&&Ur(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),qr&&Lr(qr,r)||(qr=r,r=$(Kr,`onSelect`),0<r.length&&(t=new In(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Gr)))}function Xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Zr={animationend:Xr(`Animation`,`AnimationEnd`),animationiteration:Xr(`Animation`,`AnimationIteration`),animationstart:Xr(`Animation`,`AnimationStart`),transitionrun:Xr(`Transition`,`TransitionRun`),transitionstart:Xr(`Transition`,`TransitionStart`),transitioncancel:Xr(`Transition`,`TransitionCancel`),transitionend:Xr(`Transition`,`TransitionEnd`)},Qr={},$r={};wn&&($r=document.createElement(`div`).style,`AnimationEvent`in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),`TransitionEvent`in window||delete Zr.transitionend.transition);function ei(e){if(Qr[e])return Qr[e];if(!Zr[e])return e;var t=Zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $r)return Qr[e]=t[n];return e}var ti=ei(`animationend`),ni=ei(`animationiteration`),ri=ei(`animationstart`),ii=ei(`transitionrun`),ai=ei(`transitionstart`),oi=ei(`transitioncancel`),si=ei(`transitionend`),ci=new Map,li=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);li.push(`scrollEnd`);function ui(e,t){ci.set(e,t),It(t,[e])}var di=0;function fi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=vd.identifierPrefix;var n=di++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function pi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ed;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function mi(e,t){return e=pi(e),t=pi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var hi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},gi=[],_i=0,vi=0;function yi(){for(var e=_i,t=vi=_i=0;t<e;){var n=gi[t];gi[t++]=null;var r=gi[t];gi[t++]=null;var i=gi[t];gi[t++]=null;var a=gi[t];if(gi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Ci(n,i,a)}}function bi(e,t,n,r){gi[_i++]=e,gi[_i++]=t,gi[_i++]=n,gi[_i++]=r,vi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function xi(e,t,n,r){return bi(e,t,n,r),wi(e)}function Si(e,t){return bi(e,null,null,t),wi(e)}function Ci(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function wi(e){if(50<Dd)throw Dd=0,Od=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ti={};function Ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Di(e,t,n,r){return new Ei(e,t,n,r)}function G(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oi(e,t){var n=e.alternate;return n===null?(n=Di(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ki(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ai(e,t,n,r,i,a){var s=0;if(r=e,typeof r==`function`)G(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,Se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ue:return e=Di(31,n,t,i),e.elementType=ue,e.lanes=a,e;case ne:return ji(n.children,i,a,t);case re:s=8,i|=24;break;case ie:return e=Di(12,n,t,i|2),e.elementType=ie,e.lanes=a,e;case se:return e=Di(13,n,t,i),e.elementType=se,e.lanes=a,e;case ce:return e=Di(19,n,t,i),e.elementType=ce,e.lanes=a,e;case de:case M:return e=i|32,e=Di(30,n,t,e),e.elementType=M,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case oe:s=10;break a;case ae:s=9;break a;case k:s=11;break a;case A:s=14;break a;case le:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=Di(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ji(e,t,n,r){return e=Di(7,e,r,t),e.lanes=n,e}function Mi(e,t,n){return e=Di(6,e,null,t),e.lanes=n,e}function Ni(e){var t=Di(18,null,null,0);return t.stateNode=e,t}function Pi(e,t,n){return t=Di(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fi=new WeakMap;function Ii(e,t){if(typeof e==`object`&&e){var n=Fi.get(e);return n===void 0?(t={value:e,source:t,stack:je(t)},Fi.set(e,t),t):n}return{value:e,source:t,stack:je(t)}}var Li=[],Ri=0,zi=null,K=0,Bi=[],Vi=0,q=null,J=1,Hi=``;function Ui(e,t){Li[Ri++]=K,Li[Ri++]=zi,zi=e,K=t}function Wi(e,t,n){Bi[Vi++]=J,Bi[Vi++]=Hi,Bi[Vi++]=q,q=e;var r=J;e=Hi;var i=32-Je(r)-1;r&=~(1<<i),n+=1;var a=32-Je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,J=1<<32-Je(t)+i|n<<i|r,Hi=a+e}else J=1<<a|n<<i|r,Hi=e}function Gi(e){e.return!==null&&(Ui(e,1),Wi(e,1,0))}function Ki(e){for(;e===zi;)zi=Li[--Ri],Li[Ri]=null,K=Li[--Ri],Li[Ri]=null;for(;e===q;)q=Bi[--Vi],Bi[Vi]=null,Hi=Bi[--Vi],Bi[Vi]=null,J=Bi[--Vi],Bi[Vi]=null}function qi(e,t){Bi[Vi++]=J,Bi[Vi++]=Hi,Bi[Vi++]=q,J=t.id,Hi=t.overflow,q=e}var Ji=null,Yi=null,Xi=!1,Zi=null,Qi=!1,$i=Error(o(519));function ea(e){throw oa(Ii(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),$i}function ta(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[vt]=e,t[yt]=r,n){case`dialog`:Vf(`cancel`,t),Vf(`close`,t);break;case`iframe`:case`object`:case`embed`:Vf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Rf.length;n++)Vf(Rf[n],t);break;case`source`:Vf(`error`,t);break;case`img`:case`image`:case`link`:Vf(`error`,t),Vf(`load`,t);break;case`details`:Vf(`toggle`,t);break;case`input`:Vf(`invalid`,t),tn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Vf(`invalid`,t);break;case`textarea`:Vf(`invalid`,t),on(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||$f(t.textContent,n)?(r.popover!=null&&(Vf(`beforetoggle`,t),Vf(`toggle`,t)),r.onScroll!=null&&Vf(`scroll`,t),r.onScrollEnd!=null&&Vf(`scrollend`,t),r.onClick!=null&&(t.onclick=hn),t=!0):t=!1,t||ea(e,!0)}function na(e){for(Ji=e.return;Ji;)switch(Ji.tag){case 5:case 31:case 13:Qi=!1;return;case 27:case 3:Qi=!0;return;default:Ji=Ji.return}}function ra(e){if(e!==Ji)return!1;if(!Xi)return na(e),Xi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&Yi&&ea(e),na(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Yi=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Yi=dm(e)}else t===27?(t=Yi,Sp(e.type)?(e=um,um=null,Yi=e):Yi=t):Yi=Ji?lm(e.stateNode.nextSibling):null;return!0}function ia(){Yi=Ji=null,Xi=!1}function aa(){var e=Zi;return e!==null&&(ud===null?ud=e:ud.push.apply(ud,e),Zi=null),e}function oa(e){Zi===null?Zi=[e]:Zi.push(e)}var sa=xe(null),ca=null,la=null;function ua(e,t,n){I(sa,t._currentValue),t._currentValue=n}function da(e){e._currentValue=sa.current,F(sa)}function fa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function pa(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),fa(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),fa(s,n,e),s=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),fa(i.return,n,e),s=i.child,s=s===null?null:s.sibling):s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function ma(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;Ir(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===Te.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}i=i.return}return e!==null&&pa(t,e,n,r),t.flags|=262144,e!==null}function ha(e){for(e=e.firstContext;e!==null;){if(!Ir(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ga(e){ca=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function _a(e){return ya(ca,e)}function va(e,t){return ca===null&&ga(e),ya(e,t)}function ya(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},la===null){if(e===null)throw Error(o(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return n}var ba=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},xa=t.unstable_scheduleCallback,Sa=t.unstable_NormalPriority,Ca={$$typeof:oe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wa(){return{controller:new ba,data:new Map,refCount:0}}function Ta(e){e.refCount--,e.refCount===0&&xa(Sa,function(){e.controller.abort()})}function Ea(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Da=null;function Oa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var ka=null,Aa=0,ja=0,Ma=null;function Na(e,t){if(ka===null){var n=ka=[];Aa=0,ja=Nf(),Ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Aa++,t.then(Pa,Pa),t}function Pa(){if(--Aa===0&&(Da=null,ka!==null)){Ma!==null&&(Ma.status=`fulfilled`);var e=ka;ka=null,ja=0,Ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ia=P.S;P.S=function(e,t){if(pd=Le(),typeof t==`object`&&t&&typeof t.then==`function`&&Na(e,t),Da!==null)for(var n=yf;n!==null;)Ea(n,Da),n=n.next;if(n=e.types,n!==null){for(var r=yf;r!==null;)Ea(r,n),r=r.next;if(ja!==0){r=Da,r===null&&(r=Da=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ia!==null&&Ia(e,t)};var La=xe(null);function Ra(){var e=La.current;return e===null?Ju.pooledCache:e}function za(e,t){t===null?I(La,La.current):I(La,t.pool)}function Ba(){var e=Ra();return e===null?null:{parent:Ca._currentValue,pool:e}}var Va=Error(o(460)),Ha=Error(o(474)),Ua=Error(o(542)),Wa={then:function(){}};function Ga(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ka(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(hn,hn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Xa(e),e===void 0&&!(`reason`in t)?Error(o(600)):e;default:if(typeof t.status==`string`)t.then(hn,hn);else{if(e=Ju,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Xa(e),e}throw Ja=t,Va}}function qa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ja=e,Va):e}}var Ja=null;function Ya(){if(Ja===null)throw Error(o(459));var e=Ja;return Ja=null,e}function Xa(e){if(e===Va||e===Ua)throw Error(o(483))}var Za=null,Qa=0;function $a(e){var t=Qa;return Qa+=1,Za===null&&(Za=[]),Ka(Za,e,t)}function eo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function to(e,t){throw t.$$typeof===ee?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function no(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Oi(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Mi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===ne?(e=d(e,t,n.props.children,r,n.key),eo(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===le&&qa(a)===t.type)?(t=i(t,n.props),eo(t,n),t.return=e,t):(t=Ai(n.type,n.key,n.props,null,e.mode,r),eo(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Pi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ji(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case O:return n=Ai(t.type,t.key,t.props,null,e.mode,n),eo(n,t),n.return=e,n;case te:return t=Pi(t,e.mode,n),t.return=e,t;case le:return t=qa(t),f(e,t,n)}if(ge(t)||pe(t))return t=ji(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,$a(t),n);if(t.$$typeof===oe)return f(e,va(e,t),n);to(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case O:return n.key===i?l(e,t,n,r):null;case te:return n.key===i?u(e,t,n,r):null;case le:return n=qa(n),p(e,t,n,r)}if(ge(n)||pe(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,$a(n),r);if(n.$$typeof===oe)return p(e,t,va(e,n),r);to(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case O:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case te:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case le:return r=qa(r),m(e,t,n,r,i)}if(ge(r)||pe(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,$a(r),i);if(r.$$typeof===oe)return m(e,t,n,va(t,r),i);to(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Xi&&Ui(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Xi&&Ui(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Xi&&Ui(i,h),l}function g(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Xi&&Ui(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return Xi&&Ui(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Xi&&Ui(i,g),u}function _(e,r,a,c){if(typeof a==`object`&&a&&a.type===ne&&a.key===null&&a.props.ref===void 0&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case O:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===ne){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),eo(c,a),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===le&&qa(l)===r.type){n(e,r.sibling),c=i(r,a.props),eo(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===ne?(c=ji(a.props.children,e.mode,c,a.key),eo(c,a),c.return=e,e=c):(c=Ai(a.type,a.key,a.props,null,e.mode,c),eo(c,a),c.return=e,e=c)}return s(e);case te:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Pi(a,e.mode,c),c.return=e,e=c}return s(e);case le:return a=qa(a),_(e,r,a,c)}if(ge(a))return h(e,r,a,c);if(pe(a)){if(l=pe(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return _(e,r,$a(a),c);if(a.$$typeof===oe)return _(e,r,va(e,a),c);to(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=Mi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Qa=0;var i=_(e,t,n,r);return Za=null,i}catch(t){if(t===Va||t===Ua)throw t;var a=Di(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ro=no(!0),io=no(!1),ao=!1;function oo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function so(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function co(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function lo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=wi(e),Ci(e,null,n),t}return bi(e,r,t,n),wi(e)}function uo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}function fo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var po=!1;function mo(){if(po){var e=Ma;if(e!==null)throw e}}function ho(e,t,n,r){po=!1;var i=e.updateQueue;ao=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Xu&f)===f:(r&f)===f){f!==0&&f===ja&&(po=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:ao=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),id|=o,e.lanes=o,e.memoizedState=d}}function go(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function _o(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)go(n[e],t)}var vo=xe(null),yo=xe(0);function bo(e,t){e=nd,I(yo,e),I(vo,t),nd=e|t.baseLanes}function xo(){I(yo,nd),I(vo,vo.current)}function So(){nd=yo.current,F(vo),F(yo)}var Co=xe(null),wo=null;function To(e){var t=e.alternate;I(Ao,Ao.current&1),I(Co,e),wo===null&&(t===null||vo.current!==null||t.memoizedState!==null)&&(wo=e)}function Eo(e){I(Ao,Ao.current),I(Co,e),wo===null&&(wo=e)}function Do(e){e.tag===22?(I(Ao,Ao.current),I(Co,e),wo===null&&(wo=e)):Oo()}function Oo(){I(Ao,Ao.current),I(Co,Co.current)}function ko(e){F(Co),wo===e&&(wo=null),F(Ao)}var Ao=xe(0);function jo(e,t){I(Co,Co.current),I(Ao,t)}function Mo(e){F(Ao),F(Co),wo===e&&(wo=null)}function No(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Po=0,Y=null,Fo=null,Io=null,Lo=!1,Ro=!1,zo=!1,Bo=0,Vo=0,Ho=null,Uo=0;function Wo(){throw Error(o(321))}function Go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ir(e[n],t[n]))return!1;return!0}function Ko(e,t,n,r,i,a){return Po=a,Y=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?lc:uc,zo=!1,a=n(r,i),zo=!1,Ro&&(a=Jo(t,n,r,i)),qo(e),a}function qo(e){P.H=cc;var t=Fo!==null&&Fo.next!==null;if(Po=0,Io=Fo=Y=null,Lo=!1,Vo=0,Ho=null,t)throw Error(o(300));e===null||Dc||(e=e.dependencies,e!==null&&ha(e)&&(Dc=!0))}function Jo(e,t,n,r){Y=e;var i=0;do{if(Ro&&(Ho=null),Vo=0,Ro=!1,25<=i)throw Error(o(301));if(i+=1,Io=Fo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}P.H=dc,a=t(n,r)}while(Ro);return a}function Yo(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?ns(t):t,e=e.useState()[0],(Fo===null?null:Fo.memoizedState)!==e&&(Y.flags|=1024),t}function Xo(){var e=Bo!==0;return Bo=0,e}function Zo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Qo(e){if(Lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Lo=!1}Po=0,Io=Fo=Y=null,Ro=!1,Vo=Bo=0,Ho=null}function $o(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Io===null?Y.memoizedState=Io=e:Io=Io.next=e,Io}function es(){if(Fo===null){var e=Y.alternate;e=e===null?null:e.memoizedState}else e=Fo.next;var t=Io===null?Y.memoizedState:Io.next;if(t!==null)Io=t,Fo=e;else{if(e===null)throw Y.alternate===null?Error(o(467)):Error(o(310));Fo=e,e={memoizedState:Fo.memoizedState,baseState:Fo.baseState,baseQueue:Fo.baseQueue,queue:Fo.queue,next:null},Io===null?Y.memoizedState=Io=e:Io=Io.next=e}return Io}function ts(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ns(e){var t=Vo;return Vo+=1,Ho===null&&(Ho=[]),e=Ka(Ho,e,t),t=Y,(Io===null?t.memoizedState:Io.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?lc:uc),e}function rs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ns(e);if(e.$$typeof===N)return;if(e.$$typeof===oe)return _a(e)}throw Error(o(438,String(e)))}function is(e){var t=null,n=Y.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Y.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??(t={data:[],index:0}),n===null&&(n=ts(),Y.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=j;return t.index++,n}function as(e,t){return typeof t==`function`?t(e):t}function os(e){return ss(es(),Fo,e)}function ss(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Po&f)===f:(Xu&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ja&&(d=!0);else if((Po&p)===p){u=u.next,p===ja&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,Y.lanes|=p,id|=p;f=u.action,zo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,Y.lanes|=f,id|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!Ir(a,e.memoizedState)&&(Dc=!0,d&&(n=Ma,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function cs(e){var t=es(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);Ir(a,t.memoizedState)||(Dc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function ls(e,t,n){var r=Y,i=es(),a=Xi;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!Ir((Fo||i).memoizedState,n);if(s&&(i.memoizedState=n,Dc=!0),i=i.queue,Ps(fs.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||s||Io!==null&&!!(Io.memoizedState.tag&1),ks(e?9:8,{destroy:void 0},ds.bind(null,r,i,n,t),null),e){if(r.flags|=2048,Ju===null)throw Error(o(349));a||Po&127||us(r,t,n)}return n}function us(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Y.updateQueue,t===null?(t=ts(),Y.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ds(e,t,n,r){t.value=n,t.getSnapshot=r,ps(t)&&ms(e)}function fs(e,t,n){return n(function(){ps(t)&&ms(e)})}function ps(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ir(e,n)}catch{return!0}}function ms(e){var t=Si(e,2);t!==null&&Md(t,e,2)}function hs(e){var t=$o();if(typeof e==`function`){var n=e;if(e=n(),zo){H(!0);try{n()}finally{H(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:e},t}function gs(e,t,n,r){return e.baseState=n,ss(e,Fo,typeof r==`function`?r:as)}function _s(e,t,n,r,i){if(ac(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};P.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,vs(t,a)):(a.next=n.next,t.pending=n.next=a)}}function vs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};o.types=a===null?null:a.types,P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),ys(e,t,s)}catch(n){xs(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),ys(e,t,a)}catch(n){xs(e,t,n)}}function ys(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){bs(e,t,n)},function(n){return xs(e,t,n)}):bs(e,t,n)}function bs(e,t,n){t.status=`fulfilled`,t.value=n,Ss(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,vs(e,n)))}function xs(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ss(t),t=t.next;while(t!==r)}e.action=null}function Ss(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Cs(e,t){return t}function ws(e,t){if(Xi){var n=Ju.formState;if(n!==null){a:{var r=Y;if(Xi){if(Yi){b:{for(var i=Yi,a=Qi;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Yi=lm(i.nextSibling),r=i.data===`F!`;break a}}ea(r)}r=!1}r&&(t=n[0])}}return n=$o(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cs,lastRenderedState:t},n.queue=r,n=nc.bind(null,Y,r),r.dispatch=n,r=hs(!1),a=ic.bind(null,Y,!1,r.queue),r=$o(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=_s.bind(null,Y,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ts(e){return Es(es(),Fo,e)}function Es(e,t,n){if(t=ss(e,t,Cs)[0],e=os(as)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ns(t)}catch(e){throw e===Va?Ua:e}else r=t;t=es();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Y.flags|=2048,ks(9,{destroy:void 0},Ds.bind(null,i,n),null)),[r,a,e]}function Ds(e,t){e.action=t}function Os(e){var t=es(),n=Fo;if(n!==null)return Es(t,n,e);es(),t=t.memoizedState,n=es();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ks(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Y.updateQueue,t===null&&(t=ts(),Y.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function As(){return es().memoizedState}function js(e,t,n,r){var i=$o();Y.flags|=e,i.memoizedState=ks(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ms(e,t,n,r){var i=es();r=r===void 0?null:r;var a=i.memoizedState.inst;Fo!==null&&r!==null&&Go(r,Fo.memoizedState.deps)?i.memoizedState=ks(t,a,n,r):(Y.flags|=e,i.memoizedState=ks(1|t,a,n,r))}function Ns(e,t){js(8390656,8,e,t)}function Ps(e,t){Ms(2048,8,e,t)}function Fs(e){Y.flags|=4;var t=Y.updateQueue;if(t===null)t=ts(),Y.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Is(e){var t=es().memoizedState;return Fs({ref:t,nextImpl:e}),function(){if(qu&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Ls(e,t){return Ms(4,2,e,t)}function Rs(e,t){return Ms(4,4,e,t)}function zs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Bs(e,t,n){n=n==null?null:n.concat([e]),Ms(4,4,zs.bind(null,t,e),n)}function Vs(){}function Hs(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Us(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Go(t,r[1]))return r[0];if(r=e(),zo){H(!0);try{e()}finally{H(!1)}}return n.memoizedState=[r,t],r}function Ws(e,t,n){return n===void 0||Po&1073741824&&!(Xu&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ad(),Y.lanes|=e,id|=e,n)}function Gs(e,t,n,r){return Ir(n,t)?n:vo.current===null?!(Po&106)||Po&1073741824&&!(Xu&261930)?(Dc=!0,e.memoizedState=n):(e=Ad(),Y.lanes|=e,id|=e,t):(e=Ws(e,n,r),Ir(e,t)||(Dc=!0),e)}function Ks(e,t,n,r,i){var a=_e.p;_e.p=a!==0&&8>a?a:8;var o=P.T,s={};s.types=o===null?null:o.types,P.T=s,ic(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?rc(e,t,Fa(c,r),kd(e)):rc(e,t,r,kd(e))}catch(n){rc(e,t,{then:function(){},status:`rejected`,reason:n},kd())}finally{_e.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function qs(){}function Js(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=Ys(e).queue;Ks(e,i,t,ve,n===null?qs:function(){return Xs(e),n(r)})}function Ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ve,baseState:ve,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:ve},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Xs(e){var t=Ys(e);t.next===null&&(t=e.alternate.memoizedState),rc(e,t.next.queue,{},kd())}function Zs(){return _a(sh)}function Qs(){return es().memoizedState}function $s(){return es().memoizedState}function ec(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kd();e=co(n);var r=lo(t,e,n);r!==null&&(Md(r,t,n),uo(r,t,n)),t={cache:wa()},e.payload=t;return}t=t.return}}function tc(e,t,n){var r=kd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ac(e)?oc(t,n):(n=xi(e,t,n,r),n!==null&&(Md(n,e,r),sc(n,t,r)))}function nc(e,t,n){rc(e,t,n,kd())}function rc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ac(e))oc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Ir(s,o))return bi(e,t,i,0),Ju===null&&yi(),!1}catch{}if(n=xi(e,t,i,r),n!==null)return Md(n,e,r),sc(n,t,r),!0}return!1}function ic(e,t,n,r){if(r={lane:2,revertLane:Nf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ac(e)){if(t)throw Error(o(479))}else t=xi(e,n,r,2),t!==null&&Md(t,e,2)}function ac(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function oc(e,t){Ro=Lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}var cc={readContext:_a,use:rs,useCallback:Wo,useContext:Wo,useEffect:Wo,useImperativeHandle:Wo,useLayoutEffect:Wo,useInsertionEffect:Wo,useMemo:Wo,useReducer:Wo,useRef:Wo,useState:Wo,useDebugValue:Wo,useDeferredValue:Wo,useTransition:Wo,useSyncExternalStore:Wo,useId:Wo,useHostTransitionStatus:Wo,useFormState:Wo,useActionState:Wo,useOptimistic:Wo,useMemoCache:Wo,useCacheRefresh:Wo,useEffectEvent:Wo},lc={readContext:_a,use:rs,useCallback:function(e,t){return $o().memoizedState=[e,t===void 0?null:t],e},useContext:_a,useEffect:Ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),js(4194308,4,zs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return js(4194308,4,e,t)},useInsertionEffect:function(e,t){js(4,2,e,t)},useMemo:function(e,t){var n=$o();t=t===void 0?null:t;var r=e();if(zo){H(!0);try{e()}finally{H(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=$o();if(n!==void 0){var i=n(t);if(zo){H(!0);try{n(t)}finally{H(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=tc.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=$o();return e={current:e},t.memoizedState=e},useState:function(e){e=hs(e);var t=e.queue,n=nc.bind(null,Y,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Vs,useDeferredValue:function(e,t){return Ws($o(),e,t)},useTransition:function(){var e=hs(!1);return e=Ks.bind(null,Y,e.queue,!0,!1),$o().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Y,i=$o();if(Xi){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ju===null)throw Error(o(349));Xu&127||us(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Ns(fs.bind(null,r,a,e),[e]),r.flags|=2048,ks(9,{destroy:void 0},ds.bind(null,r,a,n,t),null),n},useId:function(){var e=$o(),t=Ju.identifierPrefix;if(Xi){var n=Hi,r=J;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Bo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Uo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Zs,useFormState:ws,useActionState:ws,useOptimistic:function(e){var t=$o();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ic.bind(null,Y,!0,n),n.dispatch=t,[e,t]},useMemoCache:is,useCacheRefresh:function(){return $o().memoizedState=ec.bind(null,Y)},useEffectEvent:function(e){var t=$o(),n={impl:e};return t.memoizedState=n,function(){if(qu&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},uc={readContext:_a,use:rs,useCallback:Hs,useContext:_a,useEffect:Ps,useImperativeHandle:Bs,useInsertionEffect:Ls,useLayoutEffect:Rs,useMemo:Us,useReducer:os,useRef:As,useState:function(){return os(as)},useDebugValue:Vs,useDeferredValue:function(e,t){return Gs(es(),Fo.memoizedState,e,t)},useTransition:function(){var e=os(as)[0],t=es().memoizedState;return[typeof e==`boolean`?e:ns(e),t]},useSyncExternalStore:ls,useId:Qs,useHostTransitionStatus:Zs,useFormState:Ts,useActionState:Ts,useOptimistic:function(e,t){return gs(es(),Fo,e,t)},useMemoCache:is,useCacheRefresh:$s,useEffectEvent:Is},dc={readContext:_a,use:rs,useCallback:Hs,useContext:_a,useEffect:Ps,useImperativeHandle:Bs,useInsertionEffect:Ls,useLayoutEffect:Rs,useMemo:Us,useReducer:cs,useRef:As,useState:function(){return cs(as)},useDebugValue:Vs,useDeferredValue:function(e,t){var n=es();return Fo===null?Ws(n,e,t):Gs(n,Fo.memoizedState,e,t)},useTransition:function(){var e=cs(as)[0],t=es().memoizedState;return[typeof e==`boolean`?e:ns(e),t]},useSyncExternalStore:ls,useId:Qs,useHostTransitionStatus:Zs,useFormState:Os,useActionState:Os,useOptimistic:function(e,t){var n=es();return Fo===null?(n.baseState=e,[e,n.queue.dispatch]):gs(n,Fo,e,t)},useMemoCache:is,useCacheRefresh:$s,useEffectEvent:Is};function fc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var pc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kd(),i=co(r);i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,r),t!==null&&(Md(t,e,r),uo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kd(),i=co(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,r),t!==null&&(Md(t,e,r),uo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kd(),r=co(n);r.tag=2,t!=null&&(r.callback=t),t=lo(e,r,n),t!==null&&(Md(t,e,n),uo(t,e,n))}};function mc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Lr(n,r)||!Lr(i,a):!0}function hc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&pc.enqueueReplaceState(t,t.state,null)}function gc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=D({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function _c(e){hi(e)}function vc(e){console.error(e)}function yc(e){hi(e)}function bc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function xc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Sc(e,t,n){return n=co(n),n.tag=3,n.payload={element:null},n.callback=function(){bc(e,t)},n}function Cc(e){return e=co(e),e.tag=3,e}function wc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){xc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){xc(t,n,r),typeof i!=`function`&&(gd===null?gd=new Set([this]):gd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Tc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ma(t,n,i,!0),n=Co.current,n!==null){switch(n.tag){case 31:case 13:case 19:return wo===null?Wd():n.alternate===null&&rd===0&&(rd=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),pf(e,r,i)),!1;case 22:return n.flags|=65536,r===Wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),pf(e,r,i)),!1}throw Error(o(435,n.tag))}return pf(e,r,i),Wd(),!1}if(Xi)return t=Co.current,t===null?(r!==$i&&(t=Error(o(423),{cause:r}),oa(Ii(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=Ii(r,n),i=Sc(e.stateNode,r,i),fo(e,i),rd!==4&&(rd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==$i&&(e=Error(o(422),{cause:r}),oa(Ii(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=Ii(a,n),ld===null?ld=[a]:ld.push(a),rd!==4&&(rd=2),t===null)return!0;r=Ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Sc(n.stateNode,r,e),fo(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(gd===null||!gd.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Cc(i),wc(i,e,n,r),fo(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Ec=Error(o(461)),Dc=!1;function Oc(e,t,n,r){t.child=e===null?io(t,null,n,r):ro(t,e.child,n,r)}function kc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ga(t),r=Ko(e,t,n,o,a,i),s=Xo(),e!==null&&!Dc?(Zo(e,t,i),Z(e,t,i)):(Xi&&s&&Gi(t),t.flags|=1,Oc(e,t,r,i),t.child)}function Ac(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!G(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,jc(e,t,a,r,i)):(e=Ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!nl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Lr:n,n(o,r)&&e.ref===t.ref)return Z(e,t,i)}return t.flags|=1,e=Oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function jc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Lr(a,r)&&e.ref===t.ref){if(Dc=!1,t.pendingProps=r=a,nl(e,i))e.flags&131072&&(Dc=!0);else return t.lanes=e.lanes,Z(e,t,i)}}return zc(e,t,n,r,i)}function Mc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Pc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&za(t,a===null?null:a.cachePool),a===null?xo():bo(t,a),Do(t);else return r=t.lanes=536870912,Pc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&za(t,null),xo(),Oo()):(za(t,a.cachePool),bo(t,a),Oo(),t.memoizedState=null);return Oc(e,t,i,n),t.child}function Nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Pc(e,t,n,r,i){var a=Ra();return a=a===null?null:{parent:Ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&za(t,null),xo(),Do(t),e!==null&&ma(e,t,r,!0),t.childLanes=i,null}function Fc(e,t){return t=Jc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ic(e,t,n){return ro(t,e.child,null,n),e=Fc(t,t.pendingProps),e.flags|=2,ko(t),t.memoizedState=null,e}function Lc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(Xi){if(r.mode===`hidden`)return e=Fc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Nc(null,e);if(Eo(t),(e=Yi)?(e=am(e,Qi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:q===null?null:{id:J,overflow:Hi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Ji=t,Yi=null)):e=null,e===null)throw ea(t);return t.lanes=536870912,null}return Fc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(Eo(t),i){if(t.flags&256)t.flags&=-257,t=Ic(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558))}else if(Dc||ma(e,t,n,!1),i=(n&e.childLanes)!==0,Dc||i){if(vo.current===null){if(r=Ju,r!==null&&(s=ft(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,Si(e,s),Md(r,e,s),Ec;Wd()}t=Ic(e,t,n)}else e=a.treeContext,Yi=lm(s.nextSibling),Ji=t,Xi=!0,Zi=null,Qi=!1,e!==null&&qi(t,e),t=Fc(t,r),t.flags|=134221824;return t}return e=Oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Rc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function zc(e,t,n,r,i){return ga(t),n=Ko(e,t,n,r,void 0,i),r=Xo(),e!==null&&!Dc?(Zo(e,t,i),Z(e,t,i)):(Xi&&r&&Gi(t),t.flags|=1,Oc(e,t,n,i),t.child)}function Bc(e,t,n,r,i,a){return ga(t),t.updateQueue=null,n=Jo(t,r,n,i),qo(e),r=Xo(),e!==null&&!Dc?(Zo(e,t,a),Z(e,t,a)):(Xi&&r&&Gi(t),t.flags|=1,Oc(e,t,n,a),t.child)}function Vc(e,t,n,r,i){if(ga(t),t.stateNode===null){var a=Ti,o=n.contextType;typeof o==`object`&&o&&(a=_a(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=pc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},oo(t),o=n.contextType,a.context=typeof o==`object`&&o?_a(o):Ti,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(fc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&pc.enqueueReplaceState(a,a.state,null),ho(t,r,a,i),mo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=gc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ti,typeof u==`object`&&u&&(o=_a(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&hc(t,a,r,o),ao=!1;var f=t.memoizedState;a.state=f,ho(t,r,a,i),mo(),l=t.memoizedState,s||f!==l||ao?(typeof d==`function`&&(fc(t,n,d,r),l=t.memoizedState),(c=ao||mc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,so(e,t),o=t.memoizedProps,u=gc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ti,typeof l==`object`&&l&&(c=_a(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&hc(t,a,r,c),ao=!1,f=t.memoizedState,a.state=f,ho(t,r,a,i),mo();var p=t.memoizedState;o!==d||f!==p||ao||e!==null&&e.dependencies!==null&&ha(e.dependencies)?(typeof s==`function`&&(fc(t,n,s,r),p=t.memoizedState),(u=ao||mc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ha(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Rc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ro(t,e.child,null,i),t.child=ro(t,null,n,i)):Oc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Z(e,t,i),e}function Hc(e,t,n,r){return ia(),t.flags|=256,Oc(e,t,n,r),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(e){return{baseLanes:e,cachePool:Ba()}}function Gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=sd),e}function Kc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ao.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Xi){if(i?To(t):Oo(),(e=Yi)?(e=am(e,Qi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:q===null?null:{id:J,overflow:Hi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Ji=t,Yi=null)):e=null,e===null)throw ea(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Oo(),i=t.mode,a=Jc({mode:`hidden`,children:a},i),r=ji(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Wc(n),r.childLanes=Gc(e,o,n),t.memoizedState=Uc,Nc(null,r)):(To(t),qc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return X(e,t,a,o,r,c,s,n)}return i?(Oo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Oi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=ji(i,a,n,null),i.flags|=2):i=Oi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Nc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Wc(n):(a=i.cachePool,a===null?a=Ba():(s=Ca._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Gc(e,o,n),t.memoizedState=Uc,Nc(e.child,r)):(To(t),n=e.child,e=n.sibling,n=Oi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function qc(e,t){return t=Jc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Jc(e,t){return e=Di(22,e,null,t),e.lanes=0,e}function Yc(e,t,n){return ro(t,e.child,null,n),e=qc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function X(e,t,n,r,i,a,s,c){if(n)return t.flags&256?(To(t),t.flags&=-257,Yc(e,t,c)):t.memoizedState===null?(Oo(),a=i.fallback,s=t.mode,i=Jc({mode:`visible`,children:i.children},s),a=ji(a,s,c,null),a.flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,ro(t,e.child,null,c),i=t.child,i.memoizedState=Wc(c),i.childLanes=Gc(e,r,c),t.memoizedState=Uc,Nc(null,i)):(Oo(),t.child=e.child,t.flags|=128,null);if(To(t),sm(a)){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(o(419)),i.stack=``,i.digest=r,oa({value:i,source:null,stack:null})),Yc(e,t,c)}if(Dc||ma(e,t,c,!1),r=(c&e.childLanes)!==0,Dc||r){if(vo.current!==null)return Yc(e,t,c);if(r=Ju,r!==null&&(i=ft(r,c),i!==0&&i!==s.retryLane))throw s.retryLane=i,Si(e,i),Md(r,e,i),Ec;return om(a)||Wd(),Yc(e,t,c)}return om(a)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Yi=lm(a.nextSibling),Ji=t,Xi=!0,Zi=null,Qi=!1,e!==null&&qi(t,e),t=qc(t,i.children),t.flags|=134221824,t)}function Xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),fa(e.return,t,n)}function Zc(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&No(n)===null&&(t=e),e=e.sibling}return t}function Qc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function $c(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function el(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ao.current;if(t.flags&128)return jo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,jo(t,o),i===`backwards`&&e!==null?($c(e),Oc(e,t,r,n),$c(e)):Oc(e,t,r,n),r=Xi?K:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xc(e,n,t);else if(e.tag===19)Xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=Zc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,$c(t)),Qc(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&No(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qc(t,!0,n,null,a,r);break;case`together`:Qc(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=Zc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qc(t,!1,i,n,a,r)}return t.child}function tl(e,t,n){var r=t.pendingProps;return ua(t,t.type,r.value),Oc(e,t,r.children,n),t.child}function Z(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),id|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ma(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=Oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ha(e)))}function rl(e,t,n){switch(t.tag){case 3:Ee(t,t.stateNode.containerInfo),ua(t,Ca,e.memoizedState.cache),ia();break;case 27:case 5:Oe(t);break;case 4:Ee(t,t.stateNode.containerInfo);break;case 10:ua(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return To(t),t.flags|=128,null;r=ma(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Kc(e,t,n):(To(t),e=Z(e,t,n),e===null?null:e.sibling)}To(t);break;case 19:if(t.flags&128)return el(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||(ma(e,t,n,!1),r=(n&t.childLanes)!==0),i){if(r)return el(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),jo(t,Ao.current),r)break;return null;case 22:return t.lanes=0,Mc(e,t,n,t.pendingProps);case 24:ua(t,Ca,e.memoizedState.cache)}return Z(e,t,n)}function il(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Dc=!0;else{if(!nl(e,n)&&!(t.flags&128))return Dc=!1,rl(e,t,n);Dc=!!(e.flags&131072)}}else Dc=!1,Xi&&t.flags&1048576&&Wi(t,K,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=qa(t.elementType),t.type=e,typeof e==`function`)G(e)?(r=gc(e,r),t.tag=1,t=Vc(null,t,e,r,n)):(t.tag=0,t=zc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===k){t.tag=11,t=kc(null,t,e,r,n);break a}if(i===A){t.tag=14,t=Ac(null,t,e,r,n);break a}if(i===oe){t.tag=10,t.type=e,t=tl(null,t,n);break a}}throw t=he(e)||e,Error(o(306,t,``))}}return t;case 0:return zc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=gc(r,t.pendingProps),Vc(e,t,r,i,n);case 3:a:{if(Ee(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,so(e,t),ho(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ua(t,Ca,r),r!==a.cache&&pa(t,[Ca],n,!0),mo(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=Hc(e,t,r,n);break a}if(r!==i){i=Ii(Error(o(424)),t),oa(i),t=Hc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Yi=lm(e.firstChild),Ji=t,Xi=!0,Zi=null,Qi=!0,n=io(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ia(),r===i){t=Z(e,t,n);break a}Oc(e,t,r,n)}t=t.child}return t;case 26:return Rc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Xi||(t.stateNode=fp(t.type,t.pendingProps,we.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oe(t),e===null&&Xi&&(r=t.stateNode=hm(t.type,t.pendingProps,we.current),Ji=t,Qi=!0,i=Yi,Sp(t.type)?(um=i,Yi=lm(r.firstChild)):Yi=i),Oc(e,t,t.pendingProps.children,n),Rc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Xi&&((i=r=Yi)&&(r=rm(r,t.type,t.pendingProps,Qi),r===null?i=!1:(t.stateNode=r,Ji=t,Yi=lm(r.firstChild),Qi=!1,i=!0)),i||ea(t)),Oe(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,pp(i,a)?r=null:s!==null&&pp(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=Ko(e,t,Yo,null,null,n),sh._currentValue=i),Rc(e,t),Oc(e,t,r,n),t.child;case 6:return e===null&&Xi&&((e=n=Yi)&&(n=im(n,t.pendingProps,Qi),n===null?e=!1:(t.stateNode=n,Ji=t,Yi=null,e=!0)),e||ea(t)),null;case 13:return Kc(e,t,n);case 4:return Ee(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ro(t,null,r,n):Oc(e,t,r,n),t.child;case 11:return kc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Rc(e,t),Oc(e,t,r,n),t.child;case 8:return Oc(e,t,t.pendingProps.children,n),t.child;case 12:return Oc(e,t,t.pendingProps.children,n),t.child;case 10:return tl(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,ga(t),i=_a(i),r=r(i),t.flags|=1,Oc(e,t,r,n),t.child;case 14:return Ac(e,t,t.type,t.pendingProps,n);case 15:return jc(e,t,t.type,t.pendingProps,n);case 19:return el(e,t,n);case 31:return Lc(e,t,n);case 22:return Mc(e,t,n,t.pendingProps);case 24:return ga(t),r=_a(Ca),e===null?(i=Ra(),i===null&&(i=Ju,a=wa(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},oo(t),ua(t,Ca,i)):((e.lanes&n)!==0&&(so(e,t),ho(t,null,null,n),mo()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,ua(t,Ca,r),r!==i.cache&&pa(t,[Ca],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),ua(t,Ca,r))),Oc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:Xi&&Gi(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Rc(e,t),Oc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function al(e){e.flags|=4}function ol(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Vd())e.flags|=8192;else throw Ja=Wa,Ha}}else e.flags&=-16777217}function sl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Vd())e.flags|=8192;else throw Ja=Wa,Ha}}function cl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ot(),e.lanes|=t,cd|=t)}function ll(e,t){if(!Xi)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function ul(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function dl(e,t,n){var r=t.pendingProps;switch(Ki(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ul(t),null;case 1:return ul(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),da(Ca),De(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ra(t)?al(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,aa())),ul(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(al(t),a===null?(ul(t),ol(t,i,null,r,n)):(ul(t),sl(t,a))):a?a===e.memoizedState?(ul(t),t.flags&=-16777217):(al(t),ul(t),sl(t,a)):(e=e.memoizedProps,e!==r&&al(t),ul(t),ol(t,i,e,r,n)),null;case 27:if(ke(t),n=we.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ul(t),t.subtreeFlags&=-33554433,null}e=Se.current,ra(t)?ta(t,e):(e=hm(i,r,n),t.stateNode=e,al(t))}return ul(t),t.subtreeFlags&=-33554433,null;case 5:if(ke(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ul(t),t.subtreeFlags&=-33554433,null}if(a=Se.current,ra(t))ta(t,a);else{var s=lp(we.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[vt]=t,a[yt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(np(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&al(t)}}return ul(t),t.subtreeFlags&=-33554433,ol(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=we.current,ra(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ji,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[vt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||$f(e.nodeValue,n)),e||ea(t,!0)}else e=lp(e).createTextNode(r),e[vt]=t,t.stateNode=e}return ul(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ra(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[vt]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ul(t),e=!1}else n=aa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ko(t),t):(ko(t),null);if(t.flags&128)throw Error(o(558))}return ul(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ra(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[vt]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ul(t),i=!1}else i=aa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ko(t),t):(ko(t),null)}return ko(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),cl(t,t.updateQueue),ul(t),null);case 4:return De(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,ul(t),null;case 10:return da(t.type),ul(t),null;case 19:if(Mo(t),r=t.memoizedState,r===null)return ul(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)ll(r,!1);else{if(rd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=No(e),a!==null){for(t.flags|=128,ll(r,!1),e=a.updateQueue,t.updateQueue=e,cl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ki(n,e),n=n.sibling;return jo(t,Ao.current&1|2),Xi&&Ui(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Le()>md&&(t.flags|=128,i=!0,ll(r,!1),t.lanes=4194304)}}else{if(!i){if(e=No(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,cl(t,e),ll(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!a.alternate&&!Xi)return ul(t),null}else 2*Le()-r.renderingStartTime>md&&n!==536870912&&(t.flags|=128,i=!0,ll(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Le(),e.sibling=null,a=Ao.current,a=i?a&1|2:a&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Xi?jo(t,a):(n=a,I(Co,t),I(Ao,n),wo===null&&(wo=t)),Xi&&Ui(t,r.treeForkCount),e}return ul(t),null;case 22:case 23:return ko(t),So(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(ul(t),t.subtreeFlags&6&&(t.flags|=8192)):ul(t),n=t.updateQueue,n!==null&&cl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&F(La),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),da(Ca),ul(t),null;case 25:return null;case 30:return t.flags|=33554432,ul(t),null}throw Error(o(156,t.tag))}function fl(e,t){switch(Ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return da(Ca),De(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ke(t),null;case 31:if(t.memoizedState!==null){if(ko(t),t.alternate===null)throw Error(o(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ko(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Mo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return De(),null;case 10:return da(t.type),null;case 22:case 23:return ko(t),So(),e!==null&&F(La),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return da(Ca),null;case 25:return null;default:return null}}function pl(e,t){switch(Ki(t),t.tag){case 3:da(Ca),De();break;case 26:case 27:case 5:ke(t);break;case 4:De();break;case 31:t.memoizedState!==null&&ko(t);break;case 13:ko(t);break;case 19:Mo(t);break;case 10:da(t.type);break;case 22:case 23:ko(t),So(),e!==null&&F(La);break;case 24:da(Ca)}}function ml(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ff(t,t.return,e)}}function hl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ff(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ff(t,t.return,e)}}function gl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{_o(t,n)}catch(t){ff(e,e.return,t)}}}function _l(e,t,n){n.props=gc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ff(e,t,n)}}function vl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=fi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);h(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ff(e,t,n)}}function yl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ff(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ff(e,t,n)}else n.current=null}}function bl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function xl(e){for(var t=e.return;t!==null&&(wl(t)&&em(e.stateNode,t.stateNode),!Cl(t));)t=t.return}function Sl(e){for(var t=e.return;t!==null&&(wl(t)&&tm(e.stateNode,t.stateNode),!Cl(t));)t=t.return}function Cl(e){return e.tag===5||e.tag===3||e.tag===27}function wl(e){return e&&e.tag===7&&e.stateNode!==null}function Tl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ff(e,e.return,t)}}function El(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[yt]=t}catch(t){ff(e,e.return,t)}}function Dl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Ol(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=hn)),bl(e,r),Ht=!0;else if(i!==4&&(i===27&&(bl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(kl(e,t,n,r),e=e.sibling;e!==null;)kl(e,t,n,r),e=e.sibling}function Al(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),bl(e,r),Ht=!0;else if(i!==4&&(i===27&&(bl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Al(e,t,n,r),e=e.sibling;e!==null;)Al(e,t,n,r),e=e.sibling}function jl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[vt]=e,t[yt]=n}catch(t){ff(e,e.return,t)}}var Ml=!1,Nl=null;function Pl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Ml=!0)}var Fl=null;function Il(){var e=Fl;return Fl=null,e}var Q=0;function Ll(e,t,n,r,i){return Q=0,Rl(e.child,t,n,r,i)}function Rl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Ml=!0,Tp(o,Q===0?t:t+`_`+Q,n),Q++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Rl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function zl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||zl(e.child,t),e=e.sibling}function Bl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Bl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(o(544));var n=t.name;t=mi(t.default,t.share),t!==`none`&&(Ll(e,n,t,null,!1)||zl(e.child,!1))}e=e.sibling}}function Vl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=fi(r,n),a=mi(r.default,n.paired?r.share:r.enter);a===`none`?Bl(e):Ll(e,i,a,null,!1)?(Bl(e),n.paired||t||jd(e,r.onEnter)):zl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Vl(e,t),e=e.sibling;else Bl(e)}function Hl(e){if(Nl!==null&&Nl.size!==0){var t=Nl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=mi(n.default,n.share);if(a!==`none`&&(Ll(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,jd(e,n.onShare)):zl(e.child,!1)),t.delete(r),t.size===0)break}}}Hl(e)}e=e.sibling}}}function Ul(e){if(e.tag===30){var t=e.memoizedProps,n=fi(t,e.stateNode),r=Nl===null?void 0:Nl.get(n),i=mi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Ll(e,n,i,null,!1)?r===void 0?jd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Nl.delete(n),jd(e,t.onShare)):zl(e.child,!1)),Nl!==null&&Hl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ul(e),e=e.sibling;else Nl!==null&&Hl(e)}function Wl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=fi(t,e.stateNode);t=mi(t.default,t.update),e.flags&=-5,t!==`none`&&Ll(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Wl(e);e=e.sibling}}function Gl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,zl(e.child,!1))}Gl(e)}e=e.sibling}}function Kl(e){if(e.tag===30)e.stateNode.paired=null,zl(e.child,!1),Gl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e),e=e.sibling;else Gl(e)}function ql(e){for(e=e.child;e!==null;)e.tag===30?zl(e.child,!1):e.subtreeFlags&33554432&&ql(e),e=e.sibling}function Jl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Q<a.length){var l=a[Q],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,Q===0?n:n+`_`+Q,i),s&&e.flags&4||(Fl===null&&(Fl=[]),Fl.push(c,Q===0?r:r+`_`+Q,t.memoizedProps)),Q++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Jl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Yl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=fi(n,r),a=mi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Q=0,i=Jl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||jd(e,n.onUpdate))}else e.subtreeFlags&33554432&&Yl(e,t);e=e.sibling}}var Xl=!1,Zl=!1,Ql=!1,$l=!1,eu=typeof WeakSet==`function`?WeakSet:Set,tu=null,nu=!1,ru=!1,iu=!1,au=!1;function ou(e,t,n){if(e=e.containerInfo,sp=gh,e=Hr(e),Ur(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,tu=t,t=n?9270:1024;tu!==null;){if(e=tu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Ul(r[a]);if(e.alternate===null&&e.flags&2)n&&Pl(e),su(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Ul(r),su(n);continue}if(r!==null&&r.memoizedState!==null){n&&Pl(e),su(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,tu=r):(n&&Wl(e),su(n))}}Nl=null}function su(e){for(;tu!==null;){var t=tu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var a=t.stateNode;try{var s=gc(t.type,i);n=a.getSnapshotBeforeUpdate(s,r),a.__reactInternalSnapshotBeforeUpdate=n}catch(e){ff(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=fi(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=mi(i.default,i.update),i!==`none`&&Ll(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(o(163))}if(r=t.sibling,r!==null){r.return=t.return,tu=r;break}tu=t.return}}function cu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ou(e,n),r&4&&ml(5,n);break;case 1:if(Ou(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ff(n,n.return,e)}else{var i=gc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ff(n,n.return,e)}}}r&64&&gl(n),r&512&&vl(n,n.return);break;case 3:if(Ou(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{_o(e,t)}catch(e){ff(n,n.return,e)}}break;case 27:t===null&&r&4&&jl(n);case 26:case 5:Ou(e,n),t===null&&r&4&&Tl(n),r&512&&vl(n,n.return);break;case 12:Ou(e,n);break;case 31:Ou(e,n),r&4&&_u(e,n);break;case 13:Ou(e,n),r&4&&vu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=gf.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||Xl,!r){var a=t!==null&&t.memoizedState!==null||Zl;t=Xl,i=Zl,Xl=r,(Zl=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Au(e,n,r)):Ou(e,n),Xl=t,Zl=i}break;case 30:Ou(e,n),r&512&&vl(n,n.return);break;case 7:r&512&&vl(n,n.return);default:Ou(e,n)}}function lu(e,t){for(e=e.child;e!==null;)uu(e,t),e=e.sibling}function uu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){ff(e,e.return,t)}du(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Ht=!0}catch(t){ff(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){ff(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&lu(e,t);break;default:lu(e,t)}}function du(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:uu(n,r);break a;case 22:n.memoizedState===null&&du(n,r);break a;default:du(n,r)}}e=e.sibling}}function fu(e){var t=e.alternate;t!==null&&(e.alternate=null,fu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Dt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var pu=null,mu=!1;function hu(e,t,n){for(n=n.child;n!==null;)gu(e,t,n),n=n.sibling}function gu(e,t,n){if(qe&&typeof qe.onCommitFiberUnmount==`function`)try{qe.onCommitFiberUnmount(Ke,n)}catch{}switch(n.tag){case 26:Zl||yl(n,t),hu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Zl&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zl||yl(n,t),Sl(n);var r=pu,i=mu;Sp(n.type)&&(pu=n.stateNode,mu=!1),hu(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),pu=r,mu=i;break;case 5:Zl||yl(n,t),Sl(n);case 6:if(n.tag===6&&Sl(n),r=pu,i=mu,pu=null,hu(e,t,n),pu=r,mu=i,pu!==null){if(mu)try{(pu.nodeType===9?pu.body:pu.nodeName===`HTML`?pu.ownerDocument.body:pu).removeChild(n.stateNode),Ht=!0}catch(e){ff(n,t,e)}else try{pu.removeChild(n.stateNode),Ht=!0}catch(e){ff(n,t,e)}}break;case 18:pu!==null&&(mu?(e=pu,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(pu,n.stateNode));break;case 4:r=pu,i=mu,pu=n.stateNode.containerInfo,mu=!0,hu(e,t,n),pu=r,mu=i;break;case 0:case 11:case 14:case 15:hl(2,n,t),Zl||hl(4,n,t),hu(e,t,n);break;case 1:Zl||(yl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&_l(n,t,r)),hu(e,t,n);break;case 21:hu(e,t,n);break;case 22:Zl=(r=Zl)||n.memoizedState!==null,hu(e,t,n),Zl=r;break;case 30:yl(n,t),hu(e,t,n);break;case 7:Zl||yl(n,t),hu(e,t,n);break;default:hu(e,t,n)}}function _u(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){ff(t,t.return,e)}}}function vu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){ff(t,t.return,e)}}function yu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new eu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new eu),t;default:throw Error(o(435,e.tag))}}function bu(e,t){var n=yu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=_f.bind(null,e,t);t.then(r,r)}})}function xu(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var a=r[i],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){pu=l.stateNode,mu=!1;break a}break;case 5:pu=l.stateNode,mu=!1;break a;case 3:case 4:pu=l.stateNode.containerInfo,mu=!0;break a}l=l.return}if(pu===null)throw Error(o(160));gu(s,c,a),pu=null,mu=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Cu(t,e,n),t=t.sibling}var Su=null;function Cu(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var a=0;a<r.length;a++){var s=r[a];s.ref.impl=s.nextImpl}xu(t,e,n),wu(e),i&4&&(hl(3,e,e.return),ml(3,e),hl(5,e,e.return));break;case 1:xu(t,e,n),wu(e),i&512&&(Zl||r===null||yl(r,r.return)),i&64&&Xl&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=Su,xu(t,e,n),wu(e),i&512&&(Zl||r===null||yl(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Xl)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=a.ownerDocument||a;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[Tt]||r[vt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),np(r,t,n),r[vt]=e,Mt(r),t=r;break a;case`link`:if(a=Gm(`link`,`href`,i).get(t+(n.href||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(s,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;case`meta`:if(a=Gm(`meta`,`content`,i).get(t+(n.content||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){a.splice(s,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;default:throw Error(o(468,t))}r[vt]=e,Mt(r),t=r}e.stateNode=t}}else Xl||Km(a,e.type,e.stateNode)}else e.stateNode=Bm(a,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&El(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||Zl||t.parentNode.removeChild(t)):i.count--,n===null?Xl||Km(a,e.type,e.stateNode):Bm(a,n,e.memoizedProps))}break;case 27:xu(t,e,n),wu(e),i&512&&(Zl||r===null||yl(r,r.return)),r!==null&&i&4&&El(e,e.memoizedProps,r.memoizedProps);break;case 5:if(a=Ql,Ql=!1,xu(t,e,n),Ql=a,wu(e),i&512&&(Zl||r===null||yl(r,r.return)),e.flags&32){t=e.stateNode;try{sn(t,``),Ht=!0}catch(t){ff(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,El(e,t,r===null?t:r.memoizedProps)),i&1024&&($l=!0);break;case 6:if(xu(t,e,n),wu(e),i&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Ht=!0}catch(t){ff(e,e.return,t)}}break;case 3:if(Ht=!1,Wm=null,a=Su,Su=bm(t.containerInfo),xu(t,e,n),Su=a,wu(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){ff(e,e.return,t)}$l&&($l=!1,Tu(e)),Ht=!1;break;case 4:i=Ql,Ql=Xl,r=Ut(),a=Su,Su=bm(e.stateNode.containerInfo),xu(t,e,n),wu(e),Su=a,Ht&&ru&&(iu=!0),Ht=r,Ql=i;break;case 12:xu(t,e,n),wu(e);break;case 31:xu(t,e,n),wu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 13:xu(t,e,n),wu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(fd=Le()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 22:a=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=Xl,l=Zl,u=Ql;Xl=c||a,Ql=u||a,Zl=l||s,xu(t,e,n),Zl=l,Ql=u,Xl=c,wu(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||r===null||s||Xl||Zl||(t=s||Zl,n=Xl,r=Zl,Xl=a||Xl,Zl=t,ku(e,2),Xl=n,Zl=r),!a&&Ql||lu(e,a)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,bu(e,n))));break;case 19:xu(t,e,n),wu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 30:i&512&&(Zl||r===null||yl(r,r.return)),i=Ut(),a=ru,s=(n&335544064)===n,c=e.memoizedProps,ru=s&&mi(c.default,c.update)!==`none`,xu(t,e,n),wu(e),s&&r!==null&&Ht&&(e.flags|=4),ru=a,Ht=i;break;case 21:break;case 7:i&512&&(Zl||r===null||yl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:xu(t,e,n),wu(e)}}function wu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Dl(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(wl(i)){var a=i.stateNode;r===null?r=[a]:r.push(a)}if(Cl(i))break;i=i.return}var s=r;if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode;Al(e,Ol(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(sn(l,``),n.flags&=-33),Al(e,Ol(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;kl(e,Ol(e),u,s);break;default:throw Error(o(161))}}catch(t){ff(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Tu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Tu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Eu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Du(t,e),t=t.sibling;else Yl(t,!1)}function Du(e,t){var n=e.alternate;if(n===null)Vl(e,!1);else switch(e.tag){case 3:if(au=nu=!1,Il(),Eu(t,e),!nu&&!iu){if(e=Fl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),au=!0}Fl=null;break;case 5:Eu(t,e);break;case 4:r=nu,nu=!1,Eu(t,e),nu&&(iu=!0),nu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Eu(t,e):Vl(e,!1));break;case 30:r=nu,i=Il(),nu=!1,Eu(t,e),nu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=fi(a,o),o=fi(n.memoizedProps,o);var s=mi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Q=0,t=Jl(e,n,t,o,s,a,!0),Q!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(jd(e,e.memoizedProps.onUpdate),Fl=i):i!==null&&(i.push.apply(i,Fl),Fl=i),nu=e.flags&32?!0:r;break;default:Eu(t,e)}}function Ou(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cu(e,t.alternate,t),t=t.sibling}function ku(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:hl(4,n,n.return),ku(n,r);break;case 1:yl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&_l(n,n.return,i),ku(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:yl(n,n.return),n.tag!==5&&n.tag!==27||Sl(n),ku(n,r);break;case 6:Sl(n);break;case 26:yl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||Zl||i.parentNode.removeChild(i),ku(n,r);break;case 22:n.memoizedState===null&&ku(n,r);break;case 30:yl(n,n.return),ku(n,r);break;case 7:yl(n,n.return);default:ku(n,r)}e=e.sibling}}function Au(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Au(i,a,n),ml(4,a);break;case 1:if(Au(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ff(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)go(l[i],c)}catch(e){ff(r,r.return,e)}}s&&o&64&&gl(a),vl(a,a.return);break;case 27:n&2&&jl(a);case 5:a.tag!==5&&a.tag!==27||xl(a),Au(i,a,n),s&&r===null&&o&4&&Tl(a),vl(a,a.return);break;case 6:xl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Xl||Km(bm(c.ownerDocument),a.type,c),Au(i,a,n),s&&r===null&&o&4&&Tl(a),vl(a,a.return);break;case 12:Au(i,a,n);break;case 31:Au(i,a,n),s&&o&4&&_u(i,a);break;case 13:Au(i,a,n),s&&o&4&&vu(i,a);break;case 22:a.memoizedState===null&&Au(i,a,n),vl(a,a.return);break;case 30:Au(i,a,n),vl(a,a.return);break;case 7:vl(a,a.return);default:Au(i,a,n)}t=t.sibling}}function ju(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ta(n))}function Mu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ta(e))}function Nu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Pu(e,t,n,r),t=t.sibling;else i&&ql(t)}function Pu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Kl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Nu(e,t,n,r),a&2048&&ml(9,t);break;case 1:Nu(e,t,n,r);break;case 3:Nu(e,t,n,r),i&&au&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ta(a)));break;case 12:if(a&2048){Nu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){ff(t,t.return,e)}}else Nu(e,t,n,r);break;case 31:Nu(e,t,n,r);break;case 13:Nu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Kl(t),o._visibility&2?Nu(e,t,n,r):(o._visibility|=2,Fu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Kl(s),o._visibility&2?Nu(e,t,n,r):Iu(e,t)),a&2048&&ju(s,t);break;case 24:Nu(e,t,n,r),a&2048&&Mu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(zl(a.child,!0),zl(t.child,!0))),Nu(e,t,n,r);break;default:Nu(e,t,n,r)}}function Fu(e,t,n,r,i){for(i=i&&(!!(t.subtreeFlags&10256)||!1),t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Fu(a,o,s,c,i),ml(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Fu(a,o,s,c,i)):u._visibility&2?Fu(a,o,s,c,i):Iu(a,o),i&&l&2048&&ju(o.alternate,o);break;case 24:Fu(a,o,s,c,i),i&&l&2048&&Mu(o.alternate,o);break;default:Fu(a,o,s,c,i)}t=t.sibling}}function Iu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Iu(n,r),i&2048&&ju(r.alternate,r);break;case 24:Iu(n,r),i&2048&&Mu(r.alternate,r);break;default:Iu(n,r)}t=t.sibling}}var Lu=8192;function Ru(e,t,n){if(e.subtreeFlags&Lu)for(e=e.child;e!==null;)zu(e,t,n),e=e.sibling}function zu(e,t,n){switch(e.tag){case 26:Ru(e,t,n),e.flags&Lu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,Su,e.memoizedState,e.memoizedProps));break;case 5:Ru(e,t,n),e.flags&Lu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=Su;Su=bm(e.stateNode.containerInfo),Ru(e,t,n),Su=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Lu,Lu=16777216,Ru(e,t,n),Lu=r):Ru(e,t,n));break;case 30:if((e.flags&Lu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Nl===null&&(Nl=new Map),Nl.set(r,i)}Ru(e,t,n);break;default:Ru(e,t,n)}}function Bu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Vu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Wu(r,e)}Bu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hu(e),e=e.sibling}function Hu(e){switch(e.tag){case 0:case 11:case 15:Vu(e),e.flags&2048&&hl(9,e,e.return);break;case 3:Vu(e);break;case 12:Vu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Uu(e)):Vu(e);break;default:Vu(e)}}function Uu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Wu(r,e)}Bu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:hl(8,t,t.return),Uu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Uu(t));break;default:Uu(t)}e=e.sibling}}function Wu(e,t){for(;tu!==null;){var n=tu;switch(n.tag){case 0:case 11:case 15:hl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ta(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tu=r;else a:for(n=e;tu!==null;){r=tu;var i=r.sibling,a=r.return;if(fu(r),r===n){tu=null;break a}if(i!==null){i.return=a,tu=i;break a}tu=a}}}var Gu={getCacheForType:function(e){var t=_a(Ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return _a(Ca).controller.signal}},Ku=typeof WeakMap==`function`?WeakMap:Map,qu=0,Ju=null,Yu=null,Xu=0,Zu=0,Qu=null,$u=!1,ed=!1,td=!1,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=0,ld=null,ud=null,dd=!1,fd=0,pd=0,md=1/0,hd=null,gd=null,_d=0,vd=null,yd=null,bd=0,xd=0,Sd=null,Cd=null,wd=null,Td=null,Ed=null,Dd=0,Od=null;function kd(){return qu&2&&Xu!==0?Xu&-Xu:P.T===null?ht():Nf()}function Ad(){if(sd===0){if(!(Xu&536870912)||Xi){var e=$e;$e<<=1,!($e&3932160)&&($e=262144),sd=e}else sd=536870912}return e=Co.current,e!==null&&(e.flags|=32),sd}function jd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(fi(e.memoizedProps,n))),Td===null&&(Td=[]),Td.push(t.bind(null,r))}}function Md(e,t,n){(e===Ju&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)&&(zd(e,0),Id(e,Xu,sd,!1)),ct(e,n),qu&2&&e===Ju||(e===Ju&&(!(qu&2)&&(ad|=n),rd===4&&Id(e,Xu,sd,!1)),Tf(e))}function Nd(e,t,n){if(qu&6)throw Error(o(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||rt(e,t),i=r?qd(e,t):Gd(e,t,!0),a=r;do{if(i===0){ed&&!r&&Id(e,t,0,!1);break}if(n=e.current.alternate,a&&!Fd(n))i=Gd(e,t,!1),a=!1;else{if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=ld;var l=c.current.memoizedState.isDehydrated;if(l&&(zd(c,s).flags|=256),s=Gd(c,s,!1),s!==2&&s!==6){if(td&&!l){c.errorRecoveryDisabledLanes|=a,ad|=a,i=4;break a}a=ud,ud=i,a!==null&&(ud===null?ud=a:ud.push.apply(ud,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){zd(e,0),Id(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Id(r,t,sd,!$u);break a;case 2:ud=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=fd+300-Le(),10<i)){if(Id(r,t,sd,!$u),nt(r,0,!0)!==0)break a;bd=t,r.timeoutHandle=gp(Pd.bind(null,r,n,ud,hd,dd,t,sd,ad,cd,$u,a,`Throttled`,-0,0),i);break a}Pd(r,n,ud,hd,dd,t,sd,ad,cd,$u,a,null,-0,0)}break}}while(1);Tf(e)}function Pd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hn},Nl=null,zu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?fd-Le():(a&4194048)===a?pd-Le():0,m=eh(d,m),m!==null)?(bd=a,e.cancelPendingCommit=m(ef.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Id(e,a,o,!l)):ef(e,t,a,n,r,i,o,s,c,l,u,d)}function Fd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Ir(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Id(e,t,n,r){t=it(e,t),t&=~od,t&=~ad,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ut(e,n,t)}function Ld(){return qu&6?!0:(Ef(0,!1),!1)}function Rd(){if(Yu!==null){if(Zu===0)var e=Yu.return;else e=Yu,la=ca=null,Qo(e),Za=null,Qa=0,e=Yu;for(;e!==null;)pl(e.alternate,e),e=e.return;Yu=null}}function zd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),bd=0,Rd(),Ju=e,Yu=n=Oi(e.current,null),Xu=t,Zu=0,Qu=null,$u=!1,ed=rt(e,t),td=!1,cd=sd=od=ad=id=rd=0,ud=ld=null,dd=!1,nd=it(e,t),yi(),n}function Bd(e,t){Y=null,P.H=cc,t===Va||t===Ua?(t=Ya(),Zu=3):t===Ha?(t=Ya(),Zu=4):Zu=t===Ec?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Qu=t,Yu===null&&(rd=1,bc(e,Ii(t,e.current)))}function Vd(){var e=Co.current;return e===null?!0:(Xu&4194048)===Xu?wo===null:(Xu&62914560)===Xu||Xu&536870912?e===wo:!1}function Hd(){var e=P.H;return P.H=cc,e===null?cc:e}function Ud(){var e=P.A;return P.A=Gu,e}function Wd(){rd=4,$u||(Xu&4194048)!==Xu&&Co.current!==null||(ed=!0),!(id&134217727)&&!(ad&134217727)||Ju===null||Id(Ju,Xu,sd,!1)}function Gd(e,t,n){var r=qu;qu|=2;var i=Hd(),a=Ud();(Ju!==e||Xu!==t)&&(hd=null,zd(e,t)),t=!1;var o=rd;a:do try{if(Zu!==0&&Yu!==null){var s=Yu,c=Qu;switch(Zu){case 8:Rd(),o=6;break a;case 3:case 2:case 9:case 6:Co.current===null&&(t=!0);var l=Zu;if(Zu=0,Qu=null,Zd(e,s,c,l),n&&ed){o=0;break a}break;default:l=Zu,Zu=0,Qu=null,Zd(e,s,c,l)}}Kd(),o=rd;break}catch(t){Bd(e,t)}while(1);return t&&e.shellSuspendCounter++,la=ca=null,qu=r,P.H=i,P.A=a,Yu===null&&(Ju=null,Xu=0,yi()),o}function Kd(){for(;Yu!==null;)Yd(Yu)}function qd(e,t){var n=qu;qu|=2;var r=Hd(),i=Ud();Ju!==e||Xu!==t?(hd=null,md=Le()+500,zd(e,t)):ed=rt(e,t);a:do try{if(Zu!==0&&Yu!==null){t=Yu;var a=Qu;b:switch(Zu){case 1:Zu=0,Qu=null,Zd(e,t,a,1);break;case 2:case 9:if(Ga(a)){Zu=0,Qu=null,Xd(t);break}t=function(){Zu!==2&&Zu!==9||Ju!==e||(Zu=7),Tf(e)},a.then(t,t);break a;case 3:Zu=7;break a;case 4:Zu=5;break a;case 7:Ga(a)?(Zu=0,Qu=null,Xd(t)):(Zu=0,Qu=null,Zd(e,t,a,7));break;case 5:var s=null;switch(Yu.tag){case 26:s=Yu.memoizedState;case 5:case 27:var c=Yu;if(s?Ym(s):c.stateNode.complete){Zu=0,Qu=null;var l=c.sibling;if(l!==null)Yu=l;else{var u=c.return;u===null?Yu=null:(Yu=u,Qd(u))}break b}}Zu=0,Qu=null,Zd(e,t,a,5);break;case 6:Zu=0,Qu=null,Zd(e,t,a,6);break;case 8:Rd(),rd=6;break a;default:throw Error(o(462))}}Jd();break}catch(t){Bd(e,t)}while(1);return la=ca=null,P.H=r,P.A=i,qu=n,Yu===null?(Ju=null,Xu=0,yi(),rd):0}function Jd(){for(;Yu!==null&&!Fe();)Yd(Yu)}function Yd(e){var t=il(e.alternate,e,nd);e.memoizedProps=e.pendingProps,t===null?Qd(e):Yu=t}function Xd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Bc(n,t,t.pendingProps,t.type,void 0,Xu);break;case 11:t=Bc(n,t,t.pendingProps,t.type.render,t.ref,Xu);break;case 5:Qo(t);var r=t;r===Ji&&(Xi?(na(r),r.tag===5&&r.stateNode!=null&&(Yi=r.stateNode)):(na(r),Xi=!0));default:pl(n,t),t=Yu=ki(t,nd),t=il(n,t,nd)}e.memoizedProps=e.pendingProps,t===null?Qd(e):Yu=t}function Zd(e,t,n,r){la=ca=null,Qo(t),Za=null,Qa=0;var i=t.return;try{if(Tc(e,i,t,n,Xu)){rd=1,bc(e,Ii(n,e.current)),Yu=null;return}}catch(t){if(i!==null)throw Yu=i,t;rd=1,bc(e,Ii(n,e.current)),Yu=null;return}t.flags&32768?(Xi||r===1?e=!0:ed||Xu&536870912?e=!1:($u=e=!0,(r===2||r===9||r===3||r===6)&&(r=Co.current,r!==null&&r.tag===13&&(r.flags|=16384))),$d(t,e)):Qd(t)}function Qd(e){var t=e;do{if(t.flags&32768){$d(t,$u);return}e=t.return;var n=dl(t.alternate,t,nd);if(n!==null){Yu=n;return}if(t=t.sibling,t!==null){Yu=t;return}Yu=t=e}while(t!==null);rd===0&&(rd=5)}function $d(e,t){do{var n=fl(e.alternate,e);if(n!==null){n.flags&=32767,Yu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Yu=e;return}Yu=e=n}while(e!==null);rd=6,Yu=null}function ef(e,t,n,r,i,a,s,c,l,u,d,f){e.cancelPendingCommit=null;do lf();while(_d!==0);if(qu&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===Ju&&(Yu=Ju=null,Xu=0),yd=t,vd=e,bd=n,Sd=i,Cd=r,tf(e,t,n,s,c,l,f)}}function tf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(xd=s,s|=vi,lt(e,n,s,r,i,a),Td=null,(n&335544064)===n?(Ed=Oa(e),r=10262):(Ed=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,vf(Ve,function(){return uf(),null})):(e.callbackNode=null,e.callbackPriority=0),Ml=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=P.T,P.T=null,i=_e.p,_e.p=2,a=qu,qu|=4;try{ou(e,t,n)}finally{qu=a,_e.p=i,P.T=r}}_d=1,Ml?wd=Mp(o,e.containerInfo,Ed,af,of,rf,sf,uf,nf,null,null):(af(),of(),sf())}function nf(e){if(_d!==0){var t=vd.onRecoverableError;t(e,{componentStack:null})}}function rf(){_d===3&&(_d=0,Du(yd,vd),_d=4)}function af(){if(_d===1){_d=0;var e=vd,t=yd,n=bd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=P.T,P.T=null;var i=_e.p;_e.p=2;var a=qu;qu|=4;try{ru=iu=!1,Cu(t,e,n),n=cp;var o=Hr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Vr(s.ownerDocument.documentElement,s)){if(c!==null&&Ur(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Br(s,h),v=Br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{qu=a,_e.p=i,P.T=r}}e.current=t,_d=2}}function of(){if(_d===2){_d=0;var e=vd,t=yd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=_e.p;_e.p=2;var i=qu;qu|=4;try{cu(e,t.alternate,t)}finally{qu=i,_e.p=r,P.T=n}}_d=3}}function sf(){if(_d===4||_d===3){_d=0;var e=wd;wd=null,Ie();var t=vd,n=yd,r=bd,i=Cd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?_d=5:(_d=0,yd=vd=null,cf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(gd=null),mt(r),n=n.stateNode,qe&&typeof qe.onCommitFiberRoot==`function`)try{qe.onCommitFiberRoot(Ke,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=P.T,a=_e.p,_e.p=2,P.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{P.T=n,_e.p=a}}if(i=Td,o=Ed,Ed=null,i!==null&&(Td=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);bd&3&&lf(),Tf(t),a=t.pendingLanes,r&261930&&a&42?t===Od?Dd++:(Dd=0,Od=t):(Dd=0,Od=null),Ef(0,!1)}}function cf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ta(t)))}function lf(){return wd!==null&&(wd.skipTransition(),wd=null),af(),of(),sf(),uf()}function uf(){if(_d!==5)return!1;var e=vd,t=xd;xd=0;var n=mt(bd),r=P.T,i=_e.p;try{_e.p=32>n?32:n,P.T=null,n=Sd,Sd=null;var a=vd,s=bd;if(_d=0,yd=vd=null,bd=0,qu&6)throw Error(o(331));var c=qu;if(qu|=4,Hu(a.current),Pu(a,a.current,s,n),qu=c,Ef(0,!1),qe&&typeof qe.onPostCommitFiberRoot==`function`)try{qe.onPostCommitFiberRoot(Ke,a)}catch{}return!0}finally{_e.p=i,P.T=r,cf(e,t)}}function df(e,t,n){t=Ii(n,t),t=Sc(e.stateNode,t,2),e=lo(e,t,2),e!==null&&(ct(e,2),Tf(e))}function ff(e,t,n){if(e.tag===3)df(e,e,n);else for(;t!==null;){if(t.tag===3){df(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(gd===null||!gd.has(r))){e=Ii(n,e),n=Cc(2),r=lo(t,n,2),r!==null&&(wc(n,r,t,e),ct(r,2),Tf(r));break}}t=t.return}}function pf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ku;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(td=!0,i.add(n),e=mf.bind(null,e,t,n),t.then(e,e))}function mf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ju===e&&(Xu&n)===n&&(rd===4||rd===3&&(Xu&62914560)===Xu&&300>Le()-fd?qu&2?od|=n:zd(e,0):od|=n,cd===Xu&&(cd=0)),Tf(e)}function hf(e,t){t===0&&(t=ot()),e=Si(e,t),e!==null&&(ct(e,t),Tf(e))}function gf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hf(e,n)}function _f(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),hf(e,n)}function vf(e,t){return Ne(e,t)}var yf=null,bf=null,xf=!1,Sf=!1,Cf=!1,wf=0;function Tf(e){e!==bf&&e.next===null&&(bf===null?yf=bf=e:bf=bf.next=e),Sf=!0,xf||(xf=!0,Mf())}function Ef(e,t){if(!Cf&&Sf){Cf=!0;do for(var n=!1,r=yf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,jf(r,a))}else a=Xu,a=nt(r,r===Ju?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||rt(r,a)||(n=!0,jf(r,a))}r=r.next}while(n);Cf=!1}}function Df(){Of()}function Of(){Sf=xf=!1;var e=0;wf!==0&&hp()&&(e=wf);for(var t=Le(),n=null,r=yf;r!==null;){var i=r.next,a=kf(r,t);a===0?(r.next=null,n===null?yf=i:n.next=i,i===null&&(bf=n)):(n=r,(e!==0||a&3)&&(Sf=!0)),r=i}_d!==0&&_d!==5||Ef(e,!1),wf!==0&&(wf=0)}function kf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=at(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ju,n=Xu,n=nt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Pe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||rt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Pe(r),mt(n)){case 2:case 8:n=Be;break;case 32:n=Ve;break;case 268435456:n=Ue;break;default:n=Ve}return r=Af.bind(null,e),n=Ne(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Pe(r),e.callbackPriority=2,e.callbackNode=null,2}function Af(e,t){if(_d!==0&&_d!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(lf()&&e.callbackNode!==n)return null;var r=Xu;return r=nt(e,e===Ju?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Nd(e,r,t),kf(e,Le()),e.callbackNode!=null&&e.callbackNode===n?Af.bind(null,e):null)}function jf(e,t){if(lf())return null;Nd(e,t,!0)}function Mf(){bp(function(){qu&6?Ne(ze,Df):Of()})}function Nf(){if(wf===0){var e=ja;e===0&&(e=Qe,Qe<<=1,!(Qe&261888)&&(Qe=256)),wf=e}return wf}function Pf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:mn(e)}function Ff(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Pf((i[yt]||null).action),o=r.submitter;o&&(t=(t=o[yt]||null)?Pf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new In(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(wf!==0){var e=new FormData(i,o);Js(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Js(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var If=0;If<li.length;If++){var Lf=li[If];ui(Lf.toLowerCase(),`on`+(Lf[0].toUpperCase()+Lf.slice(1)))}ui(ti,`onAnimationEnd`),ui(ni,`onAnimationIteration`),ui(ri,`onAnimationStart`),ui(`dblclick`,`onDoubleClick`),ui(`focusin`,`onFocus`),ui(`focusout`,`onBlur`),ui(ii,`onTransitionRun`),ui(ai,`onTransitionStart`),ui(oi,`onTransitionCancel`),ui(si,`onTransitionEnd`),Lt(`onMouseEnter`,[`mouseout`,`mouseover`]),Lt(`onMouseLeave`,[`mouseout`,`mouseover`]),Lt(`onPointerEnter`,[`pointerout`,`pointerover`]),Lt(`onPointerLeave`,[`pointerout`,`pointerover`]),It(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),It(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),It(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),It(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Rf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),zf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Rf));function Bf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){hi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){hi(e)}i.currentTarget=null,a=c}}}}function Vf(e,t){var n=t[xt];n===void 0&&(n=t[xt]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Pt.forEach(function(t){t!==`selectionchange`&&(zf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!Tn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Kf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=Ot(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}Sn(function(){var r=a,i=_n(n),o=[];a:{var s=ci.get(e);if(s!==void 0){var c=In,u=e;switch(e){case`keypress`:if(jn(n)===0)break a;case`keydown`:case`keyup`:c=er;break;case`focusin`:u=`focus`,c=Gn;break;case`focusout`:u=`blur`,c=Gn;break;case`beforeblur`:case`afterblur`:c=Gn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Un;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Wn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=rr;break;case ti:case ni:case ri:c=Kn;break;case si:c=ir;break;case`scroll`:case`scrollend`:c=Rn;break;case`wheel`:c=ar;break;case`copy`:case`cut`:case`paste`:c=qn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=tr;break;case`submit`:c=nr;break;case`toggle`:case`beforetoggle`:c=or}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Cn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,s=e===`mouseout`||e===`pointerout`,c&&n!==gn&&(u=n.relatedTarget||n.fromElement)&&(Ot(u)||u[bt]))break a;(s||c)&&(u=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,s?(c=n.relatedTarget||n.toElement,s=r,c=c?Ot(c):null,c!==null&&(f=l(c),d=c.tag,c!==f||d!==5&&d!==27&&d!==6)&&(c=null)):(s=null,c=r),s!==c&&(d=Un,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=tr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=s==null?u:At(s),h=c==null?u:At(c),u=new d(g,m+`leave`,s,n,i),u.target=f,u.relatedTarget=h,g=null,Ot(i)===r&&(d=new d(p,m+`enter`,c,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=s&&c?E(s,c,Jf):null,s!==null&&Yf(o,u,s,d,!1),c!==null&&f!==null&&Yf(o,f,c,d,!0)))}a:{if(s=r?At(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var _=wr;else if(yr(s)){if(Tr)_=Pr;else{_=Mr;var v=jr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&dn(r.elementType)&&(_=wr):_=Nr;if(_&&(_=_(e,r))){W(o,_,n,i);break a}v&&v(e,s,r)}switch(v=r?At(r):window,e){case`focusin`:(yr(v)||v.contentEditable===`true`)&&(Gr=v,Kr=r,qr=null);break;case`focusout`:qr=Kr=Gr=null;break;case`mousedown`:Jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Jr=!1,Yr(o,n,i);break;case`selectionchange`:if(Wr)break;case`keydown`:case`keyup`:Yr(o,n,i)}var y;if(cr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else gr?mr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(dr&&n.locale!==`ko`&&(gr||b!==`onCompositionStart`?b===`onCompositionEnd`&&gr&&(y=An()):(Dn=i,On=`value`in Dn?Dn.value:Dn.textContent,gr=!0)),v=$(r,b),0<v.length&&(b=new Jn(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=hr(n),y!==null&&(b.data=y)))),(y=ur?_r(e,n):U(e,n))&&(b=$(r,`onBeforeInput`),0<b.length&&(v=new Jn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),Ff(o,e,r,n,i)}Bf(o,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function $(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Cn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=Cn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Jf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Cn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=Cn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function Qf(e){return(typeof e==`string`?e:``+e).replace(Xf,`
|
|
10
|
-
`).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||sn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&sn(e,``+r);else return;break;case`className`:Gt(e,`class`,r);break;case`tabIndex`:Gt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Gt(e,n,r);break;case`style`:un(e,r,a);return;case`data`:if(t!==`object`){Gt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=mn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,i.name,i,null),ep(e,t,`formEncType`,i.formEncType,i,null),ep(e,t,`formMethod`,i.formMethod,i,null),ep(e,t,`formTarget`,i.formTarget,i,null)):(ep(e,t,`encType`,i.encType,i,null),ep(e,t,`method`,i.method,i,null),ep(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=mn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=hn);return;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=mn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Wt(e,`popover`,r);break;case`xlinkActuate`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Wt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=fn.get(n)||n,Wt(e,n,r);else return}Ht=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:un(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)sn(e,r);else if(typeof r==`number`||typeof r==`bigint`)sn(e,``+r);else return;break;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=hn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Ft.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),a=n.slice(2,i?n.length-7:void 0),t=e[yt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(a,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,i);break a}Ht=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Wt(e,n,r)}return}Ht=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Vf(`error`,e),Vf(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:ep(e,t,a,s,n,null)}}i&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:Vf(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:ep(e,t,r,d,n,null)}}tn(e,a,c,l,u,s,i,!1);return;case`select`:for(i in Vf(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&rn(e,!!r,n,!0):rn(e,!!r,t,!1);return;case`textarea`:for(s in Vf(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:ep(e,t,s,c,n,null)}on(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Vf(`cancel`,e),Vf(`close`,e);break;case`iframe`:case`object`:Vf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)Vf(Rf[r],e);break;case`image`:Vf(`error`,e),Vf(`load`,e);break;case`details`:Vf(`toggle`,e);break;case`embed`:case`source`:case`link`:Vf(`error`,e),Vf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:ep(e,t,u,r,n,null)}return;default:if(dn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Ht=!0),a=m;break;case`name`:m!==f&&(Ht=!0),i=m;break;case`checked`:m!==f&&(Ht=!0),u=m;break;case`defaultChecked`:m!==f&&(Ht=!0),d=m;break;case`value`:m!==f&&(Ht=!0),s=m;break;case`defaultValue`:m!==f&&(Ht=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}en(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||ep(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:a!==l&&(Ht=!0),p=a;break;case`defaultValue`:a!==l&&(Ht=!0),c=a;break;case`multiple`:a!==l&&(Ht=!0),s=a;default:a!==l&&ep(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?rn(e,!!n,n?[]:``,!1):rn(e,!!n,t,!0)):rn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:i!==a&&(Ht=!0),p=i;break;case`defaultValue`:i!==a&&(Ht=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&ep(e,t,s,i,r,a)}an(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Ht=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(dn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[vt]=r,n[yt]=t,np(n,e,t),Mt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Tt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Ot(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(o(566));var t=[];h(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=b(i),Zp(i,n)):b(i).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??(e.reactFragments=new Set),e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),Dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Tt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===hn&&(e.onclick=null),Dt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Dt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=_e.d;_e.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Ld();return e||t}function Cm(e){var t=kt(e);t!==null&&t.tag===5&&t.type===`form`?Xs(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=$t(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Mt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+$t(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+$t(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+$t(n.imageSizes)+`"]`)):i+=`[href="`+$t(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Et]=!0,o.onload=o.onerror=function(){Nt(o)}),Mt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+$t(r)+`"][href="`+$t(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Mt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=jt(r).hoistableStyles,a=Pm(e);t=t||`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Mt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Mt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Mt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=we.current)?bm(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=jt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var a=jt(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(Fm(e)))?a._p||(s.instance=a,s.state.loading=5):(a=vm.get(e),a||(a={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,a)),Lm(i,e,a,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=jt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Pm(e){return`href="`+$t(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Et]){r.loading=1;return}}else t=e.createElement(`link`),t[Et]=!0,t.onload=t.onerror=Nt.bind(null,t),np(t,`link`,n),Mt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+$t(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+$t(n.href)+`"]`);if(r)return t.instance=r,Mt(r),r;var i=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Mt(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var a=e.querySelector(Fm(i));if(a)return t.state.loading|=4,t.instance=a,Mt(a),a;r=Im(n),(i=vm.get(i))&&Hm(r,i),a=(e.ownerDocument||e).createElement(`link`),Mt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(a,`link`,r),t.state.loading|=4,Vm(a,n.precedence,e),t.instance=a;case`script`:return a=Rm(n.src),(i=e.querySelector(zm(a)))?(t.instance=i,Mt(i),i):(r=n,(i=vm.get(a))&&(r=D({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Mt(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??(e.crossOrigin=t.crossOrigin),e.referrerPolicy??(e.referrerPolicy=t.referrerPolicy),e.title??(e.title=t.title)}function Um(e,t){e.crossOrigin??(e.crossOrigin=t.crossOrigin),e.referrerPolicy??(e.referrerPolicy=t.referrerPolicy),e.integrity??(e.integrity=t.integrity)}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Tt]||a[vt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Mt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:oe,Provider:null,Consumer:null,_currentValue:ve,_currentValue2:ve,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=st(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=st(0),this.hiddenUpdates=st(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Di(3,null,null,t),e.current=a,a.stateNode=e,t=wa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},oo(a),e}function uh(e){return e?(e=Ti,e):Ti}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=co(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=lo(e,r,t),n!==null&&(Md(n,e,t),uo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Si(e,67108864);t!==null&&Md(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=kd();t=pt(t);var n=Si(e,t);n!==null&&Md(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=P.T;P.T=null;var a=_e.p;try{_e.p=2,yh(e,t,n,r)}finally{_e.p=a,P.T=i}}function vh(e,t,n,r){var i=P.T;P.T=null;var a=_e.p;try{_e.p=8,yh(e,t,n,r)}finally{_e.p=a,P.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Kf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=kt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=tt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Je(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(qu&6)&&(md=Le()+500,Ef(0,!1))}}break;case 31:case 13:s=Si(a,2),s!==null&&Md(s,a,2),Ld(),ph(a,2)}if(a=bh(r),a===null&&Kf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function bh(e){return e=_n(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Ot(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Re()){case ze:return 2;case Be:return 8;case Ve:case He:return 32;case Ue:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=kt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Ot(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,gt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,gt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);gn=r,n.target.dispatchEvent(r),gn=null}else return t=kt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=kt(n);a!==null&&(e.splice(t,3),t-=3,Js(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[yt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[yt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;dh(n,kd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Ld(),t[bt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.1`)throw Error(o(527,Kh,`19.3.1`));_e.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Ke=Jh.inject(qh),qe=Jh}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(o(299));var n=!1,r=``,i=_c,a=vc,s=yc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,i,a,s,Uh),e[bt]=t.current,Wf(e),new Wh(t)}})),l=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=c()})),u=r(),d=l(),f='\nconst e=e=>typeof e==`object`&&!!e;function t(e){let t=[],n=[],r=e=>(n.length?n[n.length-1].c:t).push(e),i=0,a=e.length;for(;i<a;){let t=e.indexOf(`<`,i);if(t<0){r(e.slice(i));break}t>i&&r(e.slice(i,t));let o=e[t+1];if(o===`!`||o===`?`){let n;n=e.startsWith(`<!--`,t)?e.indexOf(`-->`,t)+3:e.startsWith(`<![CDATA[`,t)?e.indexOf(`]]>`,t)+3:o===`?`?e.indexOf(`?>`,t)+2:e.indexOf(`>`,t)+1,n<=0&&(n=a),r(e.slice(t,n)),i=n;continue}if(o===`/`){let r=e.indexOf(`>`,t);n.pop(),i=r<0?a:r+1;continue}let s=-1,c=``;for(let n=t+1;n<a;n++){let t=e[n];if(c)t===c&&(c=``);else if(t===`"`||t===`\'`)c=t;else if(t===`>`){s=n;break}}s<0&&(s=a-1);let l=e.slice(t+1,s),u=l.endsWith(`/`);u&&(l=l.slice(0,-1));let d=/^[^\\s/>]+/.exec(l),f=d?d[0]:l,p={q:f,a:l.slice(f.length),c:[],self:u};r(p),u||n.push(p),i=s+1}return t}function n(e){if(Array.isArray(e)){let t=``;for(let r of e)t+=n(r);return t}return typeof e==`string`?e:e.self&&!e.c.length?`<${e.q}${e.a}/>`:`<${e.q}${e.a}>${n(e.c)}</${e.q}>`}const r=e=>e.slice(e.indexOf(`:`)+1),i=e=>e.includes(`:`)?e.slice(0,e.indexOf(`:`)+1):``;function a(t){return t.find(e)}function o(t,n){return t?t.c.filter(t=>e(t)&&(!n||r(t.q)===n)):[]}function s(t,n){if(t){for(let i of t.c)if(e(i)&&r(i.q)===n)return i}}const c=/([^\\s=]+)\\s*=\\s*("([^"]*)"|\'([^\']*)\')/g;function l(e,t,n=!1){c.lastIndex=0;let i;for(;i=c.exec(e.a);)if(i[1]===t||n&&r(i[1])===t)return _(i[3]??i[4]??``)}function u(e,t,n){c.lastIndex=0;let r;for(;r=c.exec(e.a);)if(r[1]===t){let i=n===void 0?``:`${t}="${g(n)}"`;e.a=e.a.slice(0,r.index)+i+e.a.slice(r.index+r[0].length),n===void 0&&(e.a=e.a.replace(/\\s+$/,``).replace(/\\s{2,}/g,` `));return}n!==void 0&&(e.a=`${e.a.replace(/\\s+$/,``)} ${t}="${g(n)}"`)}function d(e,t={},n=[]){let r=``;for(let[e,n]of Object.entries(t))n!==void 0&&(r+=` ${e}="${g(n)}"`);return{q:e,a:r,c:n,self:n.length===0}}function f(e){if(typeof e==`string`)return e;let t=e;return{q:t.q,a:t.a,self:t.self,c:t.c.map(f)}}function p(t,n){let i=typeof n==`string`?e=>e===n:n;t.c=t.c.filter(t=>!(e(t)&&i(r(t.q))))}function m(t,n,i,a){let o=t.c.findIndex(t=>e(t)&&r(t.q)===i);if(o>=0){n?t.c[o]=n:t.c.splice(o,1),t.self=t.c.length===0;return}if(!n)return;let s=a.indexOf(i),c=t.c.length;for(let n=0;n<t.c.length;n++){let i=t.c[n];if(e(i)&&a.indexOf(r(i.q))>s){c=n;break}}t.c.splice(c,0,n),t.self=!1}function h(e){return e.replace(/[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\uFFFE\\uFFFF]/g,``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function g(e){return h(e).replace(/"/g,`"`)}function _(e){return e.indexOf(`&`)<0?e:e.replace(/&(lt|gt|amp|quot|apos|#\\d+|#x[0-9a-fA-F]+);/g,(e,t)=>{switch(t){case`lt`:return`<`;case`gt`:return`>`;case`amp`:return`&`;case`quot`:return`"`;case`apos`:return`\'`}let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)?String.fromCodePoint(n):e})}function v(t,n){let i=t=>{let a=!1,o=r(t.q)===`AlternateContent`;for(let s=0;s<t.c.length;s++){let c=t.c[s];if(!e(c))continue;let l=r(c.q);if(l!==`Fallback`){if(o&&l===`Choice`){if(a)continue;a=!0,i(c)}else l===`AlternateContent`?i(c):n(c,t,s)||i(c)}}};i(t)}const y=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`;function b(e,t=`id`,n){let r=RegExp(`xmlns:([\\\\w.-]+)="${y.replace(/[.]/g,`\\\\.`)}"`).exec(e.a);return r?{[`${r[1]}:${t}`]:n}:{"xmlns:r":y,[`r:${t}`]:n}}function x(e){"@babel/helpers - typeof";return x=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},x(e)}function S(e,t){if(x(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(x(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function C(e){var t=S(e,`string`);return x(t)==`symbol`?t:t+``}function w(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const T=(e,t)=>Number(e.getBigUint64(t,!0));var ee=class e{constructor(e){w(this,`src`,void 0),w(this,`entries`,/* @__PURE__ */ new Map),this.src=e}static async open(t){let n=new e(t);return await n.readDirectory(),n}async readDirectory(){let{src:e}=this;if(e.size<22)throw Error(`Not a ZIP/OOXML file (too small)`);let t=Math.min(e.size,65577),n=e.size-t,r=await e.read(n,t),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=-1;for(let e=r.length-22;e>=0;e--)if(i.getUint32(e,!0)===101010256){a=e;break}if(a<0){let t=await e.read(0,8);throw t[0]===208&&t[1]===207?Error(`Legacy binary Office format (.doc/.xls/.ppt) or encrypted file is not supported`):Error(`Not a ZIP/OOXML file (no end of central directory)`)}let o=i.getUint16(a+10,!0),s=i.getUint32(a+12,!0),c=i.getUint32(a+16,!0);if(o===65535||s===4294967295||c===4294967295){let t=a-20;if(t>=0&&i.getUint32(t,!0)===117853008){let n=T(i,t+8),r=await e.read(n,56),a=new DataView(r.buffer,r.byteOffset,r.byteLength);a.getUint32(0,!0)===101075792&&(o=T(a,32),s=T(a,40),c=T(a,48))}}let l=await e.read(c,s),u=new DataView(l.buffer,l.byteOffset,l.byteLength),d=new TextDecoder,f=0;for(let e=0;e<o&&f+46<=l.length&&u.getUint32(f,!0)===33639248;e++){let e=u.getUint16(f+8,!0),t=u.getUint16(f+10,!0),n=u.getUint16(f+12,!0),r=u.getUint16(f+14,!0),i=u.getUint32(f+16,!0),a=u.getUint32(f+20,!0),o=u.getUint32(f+24,!0),s=u.getUint16(f+28,!0),c=u.getUint16(f+30,!0),p=u.getUint16(f+32,!0),m=u.getUint32(f+42,!0),h=d.decode(l.subarray(f+46,f+46+s));if(o===4294967295||a===4294967295||m===4294967295){let e=f+46+s,t=e+c;for(;e+4<=t;){let t=u.getUint16(e,!0),n=u.getUint16(e+2,!0);if(t===1){let t=e+4;o===4294967295&&(o=T(u,t),t+=8),a===4294967295&&(a=T(u,t),t+=8),m===4294967295&&(m=T(u,t));break}e+=4+n}}h.endsWith(`/`)||this.entries.set(E(h),{name:h,method:t,flags:e,crc:i,time:n,date:r,compSize:a,size:o,localOffset:m}),f+=46+s+c+p}}list(){return[...this.entries.values()]}get(e){return this.entries.get(E(e))}has(e){return this.entries.has(E(e))}async dataOffset(e){if(e.dataOffset!==void 0)return e.dataOffset;let t=await this.src.read(e.localOffset,30),n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==67324752)throw Error(`Corrupt ZIP local header for ${e.name}`);return e.dataOffset=e.localOffset+30+n.getUint16(26,!0)+n.getUint16(28,!0),e.dataOffset}async rawData(e){let t=await this.dataOffset(e);return this.src.slice?this.src.slice(t,e.compSize):this.src.read(t,e.compSize)}async stream(e,t){let n=this.get(e);if(!n)throw Error(`Missing part: ${e}`);if(n.flags&1)throw Error(`Encrypted documents are not supported`);let r=await this.dataOffset(n),i=this.src.stream(r,n.compSize);if(t){let e=0,r=n.compSize;i=i.pipeThrough(new TransformStream({transform(n,i){e+=n.length,t(e,r),i.enqueue(n)}}))}if(n.method===0)return i;if(n.method===8)return i.pipeThrough(new DecompressionStream(`deflate-raw`));throw Error(`Unsupported ZIP compression method ${n.method} for ${n.name}`)}async bytes(e){let t=this.get(e);if(!t)throw Error(`Missing part: ${e}`);let n=(await this.stream(e)).getReader(),r=new Uint8Array(t.size),i=0,a=[];for(;;){let{done:e,value:t}=await n.read();if(e)break;i+t.length<=r.length?r.set(t,i):a.push(t),i+=t.length}if(!a.length)return i===r.length?r:r.subarray(0,i);let o=new Uint8Array(i);o.set(r);let s=r.length;for(let e of a)o.set(e,s),s+=e.length;return o}async text(e){return new TextDecoder().decode(await this.bytes(e))}};function E(e){return e.replace(/^\\/+/,``).replace(/\\\\/g,`/`).toLowerCase()}const te=(()=>{let e=/* @__PURE__ */ new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function ne(e,t=0){let n=~t>>>0;for(let t=0;t<e.length;t++)n=te[(n^e[t])&255]^n>>>8;return~n>>>0}const re=globalThis.Bun!==void 0;async function ie(e){let t=0,n=0,r=e.pipeThrough(new TransformStream({transform(e,r){t=ne(e,t),n+=e.length,r.enqueue(e)}})).pipeThrough(new CompressionStream(`deflate-raw`)).getReader(),i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t),a+=t.length}return{chunks:i,crc:t,size:n,csize:a}}function ae(e){if(typeof e==`function`)return e();let t=typeof e==`string`?new TextEncoder().encode(e):e;return new ReadableStream({start(e){e.enqueue(t),e.close()}})}function oe(){let e=/* @__PURE__ */ new Date;return{time:e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1,date:e.getFullYear()-1980<<9|e.getMonth()+1<<5|e.getDate()}}async function se(e,t,n=`application/zip`){let r=new TextEncoder,i=[],a=[],o=0,s=0,c=/* @__PURE__ */ new Map;for(let[e,n]of t)c.set(E(e),{name:e.replace(/^\\/+/,``),data:n});let l=(e,t,n,c,l,u,d,f)=>{let p=r.encode(e),m=/[^\\x20-\\x7e]/.test(e)?2048:0;if(o>4294967280||c>4294967280)throw Error(`Saved file exceeds 4 GB (ZIP64 writing not supported)`);let h=new Uint8Array(30+p.length),g=new DataView(h.buffer);g.setUint32(0,67324752,!0),g.setUint16(4,20,!0),g.setUint16(6,m,!0),g.setUint16(8,t,!0),g.setUint16(10,u,!0),g.setUint16(12,d,!0),g.setUint32(14,n,!0),g.setUint32(18,c,!0),g.setUint32(22,l,!0),g.setUint16(26,p.length,!0),h.set(p,30);let _=new Uint8Array(46+p.length),v=new DataView(_.buffer);v.setUint32(0,33639248,!0),v.setUint16(4,20,!0),v.setUint16(6,20,!0),v.setUint16(8,m,!0),v.setUint16(10,t,!0),v.setUint16(12,u,!0),v.setUint16(14,d,!0),v.setUint32(16,n,!0),v.setUint32(20,c,!0),v.setUint32(24,l,!0),v.setUint16(28,p.length,!0),v.setUint32(42,o,!0),_.set(p,46),i.push(h,...f),a.push(_),o+=h.length+c,s++},u=async(e,t)=>{let n=await ie(ae(t)),{time:r,date:i}=oe();l(e,8,n.crc,n.csize,n.size,r,i,n.chunks)};for(let t of e?.list()??[]){let n=E(t.name),r=c.get(n);if(r){c.delete(n),r.data!==null&&await u(t.name,r.data);continue}let i=await e.rawData(t);re&&i instanceof Blob&&(i=new Uint8Array(await i.arrayBuffer())),l(t.name,t.method,t.crc,t.compSize,t.size,t.time,t.date,[i])}for(let{name:e,data:t}of c.values())t!==null&&await u(e,t);let d=a.reduce((e,t)=>e+t.length,0),f=/* @__PURE__ */ new Uint8Array(22),p=new DataView(f.buffer);return p.setUint32(0,101010256,!0),p.setUint16(8,s,!0),p.setUint16(10,s,!0),p.setUint32(12,d,!0),p.setUint32(16,o,!0),new Blob([...i,...a,f],{type:n})}const ce=/* @__PURE__ */ new Set([`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`http://purl.oclc.org/ooxml/officeDocument/relationships`]),le={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`\'`};function ue(e){return e.indexOf(`&`)<0?e:e.replace(/&(#x[0-9a-fA-F]+|#\\d+|[a-zA-Z]+);/g,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`||t[1]===`X`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)&&n<=1114111?String.fromCodePoint(n):e}return le[t]??e})}const de=e=>e===32||e===9||e===10||e===13;var fe=class{constructor(e,t){w(this,`h`,void 0),w(this,`raw`,void 0),w(this,`buf`,``),w(this,`depth`,0),w(this,`skipDepth`,-1),w(this,`relPrefixes`,/* @__PURE__ */ new Set([`r`])),this.h=e,this.raw=t}write(e){this.buf=this.buf.length?this.buf+e:e,this.run(!1)}end(){this.run(!0),this.buf=``}run(e){let t=this.buf,n=t.length,r=0;for(;r<n;){let i=t.indexOf(`<`,r);if(i<0){if(e){let e=t.substring(r);this.raw?.(e),this.onText(e),r=n}break}if(i>r){let e=t.substring(r,i);this.raw?.(e),this.onText(e)}if(r=i,i+1>=n)break;let a=t.charCodeAt(i+1);if(a===47){let e=t.indexOf(`>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+1)),this.onClose(t.substring(i+2,e)),r=e+1;continue}if(a===63){let e=t.indexOf(`?>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+2)),r=e+2;continue}if(a===33){if(n-i<9&&!e)break;if(t.startsWith(`<!--`,i)){let e=t.indexOf(`-->`,i+4);if(e<0)break;this.raw?.(t.substring(i,e+3)),r=e+3;continue}if(t.startsWith(`<![CDATA[`,i)){let e=t.indexOf(`]]>`,i+9);if(e<0)break;this.raw?.(t.substring(i,e+3)),this.skipDepth<0&&this.h.text(t.substring(i+9,e)),r=e+3;continue}let a=t.indexOf(`>`,i+2);if(a<0)break;this.raw?.(t.substring(i,a+1)),r=a+1;continue}let o=-1,s=0;for(let e=i+1;e<n;e++){let n=t.charCodeAt(e);if(s!==0)n===s&&(s=0);else if(n===34||n===39)s=n;else if(n===62){o=e;break}}if(o<0)break;this.raw?.(t.substring(i,o+1)),this.onOpen(t,i+1,o),r=o+1}this.buf=r>=n?``:t.substring(r)}onText(e){this.skipDepth>=0||this.depth===0||this.h.text(e.indexOf(`&`)>=0?ue(e):e)}onOpen(e,t,n){let r=n,i=!1;if(e.charCodeAt(n-1)===47&&(i=!0,r=n-1),this.skipDepth>=0){i||this.depth++;return}let a=t;for(;a<r&&!de(e.charCodeAt(a));)a++;let o=e.substring(t,a),s=o.indexOf(`:`),c=s<0?o:o.substring(s+1),l={};for(;a<r;){if(de(e.charCodeAt(a))){a++;continue}let t=e.indexOf(`=`,a);if(t<0||t>=r)break;let n=e.substring(a,t).trim(),i=t+1;for(;i<r&&e.charCodeAt(i)!==34&&e.charCodeAt(i)!==39;)i++;if(i>=r)break;let o=e.indexOf(e[i],i+1);if(o<0)break;let s=e.substring(i+1,o);a=o+1;let c=n.indexOf(`:`);if(c>=0){let e=n.substring(0,c),t=n.substring(c+1);if(e===`xmlns`){ce.has(s)&&this.relPrefixes.add(t);continue}n=this.relPrefixes.has(e)?`r:`+t:t}else if(n===`xmlns`)continue;l[n]=s.indexOf(`&`)>=0?ue(s):s}let u=this.h.open(c,l,i);i?u||this.h.close(c):(this.depth++,u&&(this.skipDepth=this.depth))}onClose(e){if(this.skipDepth>=0){this.depth===this.skipDepth&&(this.skipDepth=-1),this.depth--;return}this.depth--;let t=e.trim(),n=t.indexOf(`:`);this.h.close(n<0?t:t.substring(n+1))}},pe=class extends Error{constructor(){super(`aborted`),this.name=`AbortError`}};async function me(e,t,n={}){let r=e.getReader(),i=new TextDecoder,a=new fe(t,n.raw);try{for(;;){if(n.signal?.aborted)throw new pe;let{done:e,value:t}=await r.read();if(e)break;a.write(i.decode(t,{stream:!0})),n.onChunk&&await n.onChunk(t.length)}a.write(i.decode()),a.end()}catch(e){throw r.cancel().catch(()=>{}),e}}var he=class{constructor(e={}){w(this,`o`,void 0),w(this,`root`,null),w(this,`stack`,[]),w(this,`parents`,[]),w(this,`depth`,0),w(this,`alt`,[]),this.o=e}open(e,t){if(e===`Fallback`||this.o.skip?.has(e))return!0;if(e===`AlternateContent`){this.alt.push(!1),this.stack.push(0);return}if(e===`Choice`&&this.alt.length){let e=this.alt.length-1;if(this.alt[e])return!0;this.alt[e]=!0,this.stack.push(0);return}let n=this.depth++;if(this.o.emitDepth!==void 0&&n<this.o.emitDepth){this.o.onShallowOpen?.(e,t,n),this.stack.push(1);return}let r={n:e,a:t,c:[],t:``},i=this.parents[this.parents.length-1];i&&i.c.push(r),this.parents.push(r),this.stack.push(r)}close(e){let t=this.stack.pop();t===0?e===`AlternateContent`&&this.alt.pop():(this.depth--,t!==1&&t!==void 0&&(this.parents.pop(),this.parents.length===0&&(this.o.emitDepth===void 0?this.root=t:this.o.onElement?.(t))))}text(e){let t=this.parents[this.parents.length-1];t&&(t.t+=e)}};function ge(e,t){let n=new he({skip:t}),r=new fe(n);if(r.write(e),r.end(),!n.root)throw Error(`Empty XML document`);return n.root}function D(e,t){if(e){for(let n of e.c)if(n.n===t)return n}}function O(e,t){return e?e.c.filter(e=>e.n===t):[]}function k(e,...t){let n=e;for(let e of t)if(n=D(n,e),!n)return;return n}function _e(e,t){if(e)for(let n of e.c){if(n.n===t)return n;let e=_e(n,t);if(e)return e}}function ve(e,t,n=[]){if(!e)return n;for(let r of e.c)r.n===t?n.push(r):ve(r,t,n);return n}function A(e,t){if(e===void 0||e===``)return t;let n=Number(e);return Number.isFinite(n)?n:t}function j(e,t=`val`){if(!e)return;let n=e.a[t];return n===void 0||n!==`0`&&n!==`false`&&n!==`off`&&n!==`none`}function ye(e){if(!e)return``;if(!e.c.length)return e.t;let t=``;for(let n of e.c)t+=n.n===`t`?n.t:ye(n);return t}const be={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,jpe:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`,tif:`image/tiff`,tiff:`image/tiff`,ico:`image/x-icon`,emf:`image/emf`,wmf:`image/wmf`,mp4:`video/mp4`,m4v:`video/mp4`,mov:`video/quicktime`,mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`};function xe(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return be[t]??`application/octet-stream`}function Se(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function Ce(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e?e.split(`/`):[];for(let e of t.split(`/`))e===`..`?n.pop():e&&e!==`.`&&n.push(e);return n.join(`/`)}function we(e,t){let n=e?e.split(`/`):[],r=t.split(`/`),i=0;for(;i<n.length&&i<r.length-1&&n[i]===r[i];)i++;return[...n.slice(i).map(()=>`..`),...r.slice(i)].join(`/`)}function Te(e){let t=Se(e),n=e.slice(t.length?t.length+1:0);return(t?t+`/`:``)+`_rels/`+n+`.rels`}var Ee=class{constructor(e){w(this,`zip`,void 0),w(this,`relsCache`,/* @__PURE__ */ new Map),w(this,`xmlCache`,/* @__PURE__ */ new Map),w(this,`contentTypes`,void 0),w(this,`changes`,/* @__PURE__ */ new Map),this.zip=e}has(e){let t=this.changes.get(E(e));return t?t.data!==null:this.zip.has(e)}get dirty(){return this.changes.size>0}async text(e){let t=this.changes.get(E(e));if(t){if(t.data===null)throw Error(`Missing part: ${e}`);if(typeof t.data==`string`)return t.data;if(t.data instanceof Uint8Array)return new TextDecoder().decode(t.data);throw Error(`Part ${e} is a stream`)}return this.zip.text(e)}async stream(e,t){let n=this.changes.get(E(e));if(!n)return this.zip.stream(e,t);if(n.data===null)throw Error(`Missing part: ${e}`);if(typeof n.data==`function`)return n.data();let r=typeof n.data==`string`?new TextEncoder().encode(n.data):n.data;return new ReadableStream({start(e){e.enqueue(r),e.close()}})}setPart(e,t){e=e.replace(/^\\/+/,``),this.changes.set(E(e),{path:e,data:t}),this.xmlCache.delete(e),this.relsCache.clear(),/\\[content_types\\]\\.xml$/i.test(e)&&(this.contentTypes=void 0)}async save(e){let t=/* @__PURE__ */ new Map;for(let{path:e,data:n}of this.changes.values())t.set(e,n);return se(this.zip,t,e)}async addRel(e,r,i,s=!1){let c=Te(e),u=this.has(c)?t(await this.text(c)):t(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`),f=a(u),p=new Set(o(f,`Relationship`).map(e=>l(e,`Id`))),m=p.size+1;for(;p.has(`rId${m}`);)m++;let h=`rId${m}`;return f.c.push(d(`Relationship`,s?{Id:h,Type:r,Target:i,TargetMode:`External`}:{Id:h,Type:r,Target:we(Se(e),i)})),f.self=!1,this.setPart(c,n(u)),h}async removeRelsTo(r,i){let o=Te(r);if(!this.has(o))return;let s=t(await this.text(o)),c=a(s),u=Se(r);c.c=c.c.filter(t=>!(e(t)&&Ce(u,l(t,`Target`)??``).toLowerCase()===i.toLowerCase())),this.setPart(o,n(s))}async ensureDefaultType(e,r){let i=`[Content_Types].xml`,s=t(await this.text(i)),c=a(s);o(c,`Default`).some(t=>l(t,`Extension`)?.toLowerCase()===e.toLowerCase())||(c.c.unshift(d(`Default`,{Extension:e,ContentType:r})),this.setPart(i,n(s)))}freeName(e,t,n){for(let r=1;;r++){let i=`${e}/${t}${r}.${n}`;if(!this.has(i))return i}}async setContentType(r,i){let o=`[Content_Types].xml`,s=t(await this.text(o)),c=a(s),u=`/`+r.replace(/^\\/+/,``);c.c=c.c.filter(t=>!(e(t)&&l(t,`PartName`)?.toLowerCase()===u.toLowerCase())),i&&c.c.push(d(`Override`,{PartName:u,ContentType:i})),this.setPart(o,n(s))}xml(e,t=!0){let n=async()=>this.has(e)?ge(await this.text(e),Oe):void 0;if(!t)return n();let r=this.xmlCache.get(e);return r||this.xmlCache.set(e,r=n()),r}rels(e){let t=this.relsCache.get(e);return t||(t=(async()=>{let t=/* @__PURE__ */ new Map,n=Te(e);if(!this.has(n))return t;let r=ge(await this.text(n)),i=Se(e);for(let e of O(r,`Relationship`)){let n=e.a.TargetMode===`External`,r=e.a.Target??``;t.set(e.a.Id,{id:e.a.Id,type:e.a.Type??``,external:n,target:n?r:Ce(i,r)})}return t})(),this.relsCache.set(e,t)),t}async contentType(e){this.contentTypes||(this.contentTypes=(async()=>{let e=/* @__PURE__ */ new Map;if(!this.has(`[Content_Types].xml`))return e;let t=ge(await this.text(`[Content_Types].xml`));for(let n of O(t,`Default`))e.set(`ext:`+(n.a.Extension??``).toLowerCase(),n.a.ContentType);for(let n of O(t,`Override`))e.set((n.a.PartName??``).replace(/^\\//,``).toLowerCase(),n.a.ContentType);return e})());let t=await this.contentTypes,n=e.toLowerCase();return t.get(n)??t.get(`ext:`+(n.split(`.`).pop()??``))}async blob(e){let t=this.changes.get(E(e)),n=t&&t.data!==null&&typeof t.data!=`function`?typeof t.data==`string`?new TextEncoder().encode(t.data):t.data:await this.zip.bytes(e);return new Blob([n],{type:xe(e)})}async mainPart(){let e=await this.rels(``),t;for(let n of e.values())n.type.endsWith(`/officeDocument`)&&(t=n.target);let n=[[`word/document.xml`,`docx`],[`xl/workbook.xml`,`xlsx`],[`ppt/presentation.xml`,`pptx`]];if(t||(t=n.find(([e])=>this.zip.has(e))?.[0]),!t)throw Error(`Not an Office Open XML document (no main part found)`);let r=await this.contentType(t)??``,i;if(i=r.includes(`wordprocessingml`)?`docx`:r.includes(`spreadsheetml`)?`xlsx`:r.includes(`presentationml`)?`pptx`:n.find(([e])=>t.toLowerCase().startsWith(e.split(`/`)[0]+`/`))?.[1],!i)throw Error(`Unsupported document type (${r||t})`);return{path:t,kind:i}}};function M(e,t){for(let n of e.values())if(n.type.endsWith(`/`+t))return n}function De(e,t){return[...e.values()].filter(e=>e.type.endsWith(`/`+t))}const Oe=/* @__PURE__ */ new Set([`extLst`]),ke={colors:{dk1:`#000000`,lt1:`#ffffff`,dk2:`#44546a`,lt2:`#e7e6e6`,accent1:`#4472c4`,accent2:`#ed7d31`,accent3:`#a5a5a5`,accent4:`#ffc000`,accent5:`#5b9bd5`,accent6:`#70ad47`,hlink:`#0563c1`,folHlink:`#954f72`},major:`Calibri Light`,minor:`Calibri`,fillStyles:[],bgFillStyles:[],lineStyles:[]};function Ae(e){if(!e)return ke;let t=D(e,`themeElements`),n={...ke.colors};for(let e of D(t,`clrScheme`)?.c??[]){let t=e.c[0];t&&(t.n===`srgbClr`&&t.a.val?n[e.n]=`#`+t.a.val.toLowerCase():t.n===`sysClr`&&(n[e.n]=`#`+(t.a.lastClr??(t.a.val===`window`?`ffffff`:`000000`)).toLowerCase()))}let r=D(t,`fontScheme`),i=D(t,`fmtScheme`);return{colors:n,major:k(r,`majorFont`,`latin`)?.a.typeface||ke.major,minor:k(r,`minorFont`,`latin`)?.a.typeface||ke.minor,fillStyles:D(i,`fillStyleLst`)?.c??[],bgFillStyles:D(i,`bgFillStyleLst`)?.c??[],lineStyles:O(D(i,`lnStyleLst`),`ln`)}}const je=9525,N=e=>(e??0)/je,Me=e=>(e??0)/12700,Ne={calibri:`Carlito`,cambria:`Caladea`,arial:`"Liberation Sans", Arimo`,helvetica:`"Liberation Sans", Arimo`,"times new roman":`"Liberation Serif", Tinos`,"courier new":`"Liberation Mono", Cousine`,"segoe ui":`system-ui`,"calibri light":`Carlito`,aptos:`"Segoe UI", system-ui`,"aptos display":`"Segoe UI", system-ui`},Pe=/times|cambria|georgia|garamond|book|serif|palatino|minion|baskerville|didot|caslon|mincho|song/i,Fe=/courier|mono|consolas|menlo|code/i,Ie=/* @__PURE__ */ new Map;function Le(e){if(!e)return;let t=Ie.get(e);if(t)return t;let n=e.toLowerCase(),r=Fe.test(e)?`monospace`:Pe.test(e)&&!/sans/i.test(e)?`serif`:`sans-serif`,i=Ne[n];return t=`"${e.replace(/"/g,``)}"${i?`, `+i:``}, ${r}`,Ie.set(e,t),t}const Re={yellow:`#ffff00`,green:`#00ff00`,cyan:`#00ffff`,magenta:`#ff00ff`,blue:`#0000ff`,red:`#ff0000`,darkBlue:`#000080`,darkCyan:`#008080`,darkGreen:`#008000`,darkMagenta:`#800080`,darkRed:`#800000`,darkYellow:`#808000`,darkGray:`#808080`,lightGray:`#c0c0c0`,black:`#000000`,white:`#ffffff`},ze=e=>e&&e!==`auto`&&/^[0-9a-fA-F]{6}$/.test(e)?`#`+e.toLowerCase():void 0;function Be(e){if(e)return ze(e.a.fill)??(e.a.val===`solid`?ze(e.a.color):void 0)}const Ve={single:`solid`,thick:`solid`,double:`double`,dotted:`dotted`,dashed:`dashed`,dotDash:`dashed`,dotDotDash:`dotted`,triple:`double`,thinThickSmallGap:`double`,thickThinSmallGap:`double`,wave:`solid`,dashSmallGap:`dashed`,outset:`outset`,inset:`inset`};function He(e){if(!e)return;let t=e.a.val;if(!t||t===`nil`||t===`none`)return null;let n=Math.max(.5,(A(e.a.sz)??4)/8);return{w:t===`double`?Math.max(n,2.25):n,style:Ve[t]??`solid`,color:ze(e.a.color)??`#000000`}}const Ue=e=>e===null?`none`:e?`${e.w}pt ${e.style} ${e.color}`:void 0;function We(e,t){let n=e.a.asciiTheme??e.a.hAnsiTheme;return Le(n?n.startsWith(`major`)?t.major:t.minor:e.a.ascii??e.a.hAnsi??e.a.cs??e.a.eastAsia)}function Ge(e,t){let n={};if(!e)return n;for(let r of e.c)switch(r.n){case`b`:n.b=j(r);break;case`i`:n.i=j(r);break;case`strike`:n.strike=j(r);break;case`dstrike`:n.dstrike=j(r);break;case`caps`:n.caps=j(r);break;case`smallCaps`:n.smallCaps=j(r);break;case`vanish`:n.vanish=j(r);break;case`u`:n.u=r.a.val??`single`;break;case`color`:{let e=ze(r.a.val);e&&(n.color=e);break}case`sz`:{let e=A(r.a.val);e&&(n.sz=e/2);break}case`rFonts`:{let e=We(r,t);e&&(n.font=e);break}case`highlight`:{let e=Re[r.a.val];e&&(n.hl=e);break}case`shd`:{let e=Be(r);e&&(n.shd=e);break}case`vertAlign`:n.va=r.a.val===`superscript`?`sup`:r.a.val===`subscript`?`sub`:void 0;break;case`spacing`:{let e=A(r.a.val);e&&(n.spacing=e/20);break}}return n}function Ke(e){let t={},n={ps:t};if(!e)return n;for(let r of e.c)switch(r.n){case`pStyle`:n.styleId=r.a.val;break;case`numPr`:{let e=D(r,`numId`)?.a.val;e!==void 0&&(n.numPr={numId:e,ilvl:A(D(r,`ilvl`)?.a.val,0)});break}case`jc`:{let e=r.a.val;t.align=e===`center`?`center`:e===`right`||e===`end`?`right`:e===`both`||e===`distribute`?`justify`:`left`;break}case`ind`:{let e=A(r.a.left??r.a.start),n=A(r.a.right??r.a.end);e!==void 0&&(t.indL=e/20),n!==void 0&&(t.indR=n/20);let i=A(r.a.hanging),a=A(r.a.firstLine);i===void 0?a!==void 0&&(t.indFirst=a/20):t.indFirst=-i/20;break}case`spacing`:{let e=A(r.a.before),n=A(r.a.after);r.a.beforeAutospacing===`1`||r.a.beforeAutospacing===`true`?t.before=14:e!==void 0&&(t.before=e/20),r.a.afterAutospacing===`1`||r.a.afterAutospacing===`true`?t.after=14:n!==void 0&&(t.after=n/20);let i=A(r.a.line);if(i!==void 0){let e=r.a.lineRule??`auto`;t.lineRule=e,t.line=e===`auto`?i/240:i/20}break}case`shd`:{let e=Be(r);e&&(t.shd=e);break}case`pBdr`:{let e=He(D(r,`top`)),n=He(D(r,`bottom`)),i=He(D(r,`left`)??D(r,`start`)),a=He(D(r,`right`)??D(r,`end`));e&&(t.bTop=e),n&&(t.bBottom=n),i&&(t.bLeft=i),a&&(t.bRight=a);break}case`keepNext`:t.keepNext=j(r);break;case`contextualSpacing`:t.contextual=j(r);break;case`pageBreakBefore`:t.pageBreakBefore=j(r);break;case`outlineLvl`:t.outline=A(r.a.val);break;case`sectPr`:n.sectPr=r}return n}const P=(...e)=>Object.assign({},...e.filter(Boolean)),qe={normal:`normal`,title:`title`,subtitle:`subtitle`,"heading 1":`h1`,"heading 2":`h2`,"heading 3":`h3`,"heading 4":`h4`,"heading 5":`h5`,"heading 6":`h6`,heading1:`h1`,heading2:`h2`,heading3:`h3`,heading4:`h4`,heading5:`h5`,heading6:`h6`};var Je=class{constructor(e,t){if(w(this,`theme`,void 0),w(this,`defs`,/* @__PURE__ */ new Map),w(this,`paraCache`,/* @__PURE__ */ new Map),w(this,`charCache`,/* @__PURE__ */ new Map),w(this,`tblCache`,/* @__PURE__ */ new Map),w(this,`defaultPara`,void 0),w(this,`defaultTable`,void 0),w(this,`docRs`,{}),w(this,`docPs`,{}),this.theme=t,!e)return;let n=D(e,`docDefaults`);this.docRs=Ge(k(n,`rPrDefault`,`rPr`),t),this.docPs=Ke(k(n,`pPrDefault`,`pPr`)).ps;for(let t of O(e,`style`)){let e=t.a.styleId;if(!e)continue;let n={id:e,type:t.a.type??`paragraph`,basedOn:D(t,`basedOn`)?.a.val,el:t,isDefault:t.a.default===`1`||t.a.default===`true`,name:D(t,`name`)?.a.val??e,next:D(t,`next`)?.a.val,quick:!!D(t,`qFormat`),hidden:!!D(t,`semiHidden`)||!!D(t,`hidden`)};this.defs.set(e,n),n.isDefault&&n.type===`paragraph`&&(this.defaultPara=e),n.isDefault&&n.type===`table`&&(this.defaultTable=e)}}add(e){let t=e.a.styleId;t&&(this.defs.set(t,{id:t,type:e.a.type??`paragraph`,basedOn:D(e,`basedOn`)?.a.val,el:e,isDefault:!1,name:D(e,`name`)?.a.val??t,next:D(e,`next`)?.a.val,quick:!!D(e,`qFormat`),hidden:!1}),this.paraCache.clear())}canonical(){let e={};this.defaultPara&&(e.normal=this.defaultPara);for(let t of this.defs.values()){if(t.type!==`paragraph`)continue;let n=qe[t.name.toLowerCase()]??qe[t.id.toLowerCase()];n&&!e[n]&&(e[n]=t.id)}return e}has(e){return this.defs.has(e)}quickStyles(){let e=e=>e.replace(/^heading (\\d)$/i,`Heading $1`).replace(/^\\w/,e=>e.toUpperCase()),t=this.canonical(),n=new Map(Object.entries(t).map(([e,t])=>[t,e]));return[...this.defs.values()].filter(e=>e.type===`paragraph`&&(e.isDefault||n.has(e.id)||e.quick&&!e.hidden)).map(t=>{let r=this.para(t.id),{b:i,i:a,color:o,sz:s,font:c}=r.rs;return{id:t.id,name:e(t.name),next:t.next,canon:n.get(t.id),outline:r.ps.outline,preview:{b:i,i:a,color:o,sz:s,font:c}}})}chain(e){let t=[],n=/* @__PURE__ */ new Set,r=e?this.defs.get(e):void 0;for(;r&&!n.has(r.id);)n.add(r.id),t.unshift(r),r=r.basedOn?this.defs.get(r.basedOn):void 0;return t}para(e){let t=e??this.defaultPara??``,n=this.paraCache.get(t);if(n)return n;n={ps:{},rs:{}};for(let e of this.chain(t)){let t=Ke(D(e.el,`pPr`));n.ps=P(n.ps,t.ps),t.numPr&&(n.numPr=t.numPr),n.rs=P(n.rs,Ge(D(e.el,`rPr`),this.theme))}return this.paraCache.set(t,n),n}char(e){if(!e)return{};let t=this.charCache.get(e);if(t)return t;t={};for(let n of this.chain(e))t=P(t,Ge(D(n.el,`rPr`),this.theme));return this.charCache.set(e,t),t}table(e){let t=e??this.defaultTable??``,n=this.tblCache.get(t);if(n)return n;n={ps:{},rs:{},borders:{},cellMar:{},cond:{}};for(let e of this.chain(t)){n.ps=P(n.ps,Ke(D(e.el,`pPr`)).ps),n.rs=P(n.rs,Ge(D(e.el,`rPr`),this.theme));let t=D(e.el,`tblPr`);Object.assign(n.borders,Ye(D(t,`tblBorders`))),Object.assign(n.cellMar,Xe(D(t,`tblCellMar`)));let r=Be(k(e.el,`tcPr`,`shd`));r&&(n.shd=r);for(let t of O(e.el,`tblStylePr`)){let e=t.a.type;if(!e)continue;let r=n.cond[e]??{rs:{}};n.cond[e]={rs:P(r.rs,Ge(D(t,`rPr`),this.theme)),shd:Be(k(t,`tcPr`,`shd`))??r.shd}}}return this.tblCache.set(t,n),n}};function Ye(e){let t={};if(!e)return t;for(let n of e.c){let e=n.n===`start`?`left`:n.n===`end`?`right`:n.n,r=He(n);r!==void 0&&(t[e]=r)}return t}function Xe(e){let t={};if(!e)return t;for(let n of e.c){let e=n.n===`start`?`left`:n.n===`end`?`right`:n.n,r=A(n.a.w);r!==void 0&&(n.a.type===void 0||n.a.type===`dxa`)&&(t[e]=r/20)}return t}const Ze={"":`•`,"":`▪`,"":`□`,"":`✓`,"":`➢`,"":`❖`,"":`➔`,"":`■`,"":`□`,"":`❑`,"":`◆`,"":`➔`,"":`⇨`,"":`→`,"":`–`,"·":`•`,"":`—`,"":`○`,"":`•`,"":`☑`,o:`◦`};function Qe(e){let t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function $e(e){return e<=0?``:String.fromCharCode(97+(e-1)%26).repeat(Math.floor((e-1)/26)+1)}function et(e,t){switch(t){case`decimalZero`:return e<10?`0`+e:String(e);case`upperRoman`:return Qe(e).toUpperCase();case`lowerRoman`:return Qe(e);case`upperLetter`:return $e(e).toUpperCase();case`lowerLetter`:return $e(e);case`ordinal`:{let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}case`none`:return``;case`bullet`:return``;default:return String(e)}}var tt=class{constructor(e,t){if(w(this,`abstracts`,/* @__PURE__ */ new Map),w(this,`nums`,/* @__PURE__ */ new Map),w(this,`counters`,/* @__PURE__ */ new Map),!e)return;let n=e=>{let n={};for(let r of O(e,`lvl`)){let e=A(r.a.ilvl,0);n[e]={start:A(D(r,`start`)?.a.val,1),fmt:D(r,`numFmt`)?.a.val??`decimal`,text:D(r,`lvlText`)?.a.val??``,ps:Ke(D(r,`pPr`)).ps,rs:Ge(D(r,`rPr`),t),isLgl:!!D(r,`isLgl`),suff:D(r,`suff`)?.a.val??`tab`,restart:A(D(r,`lvlRestart`)?.a.val)}}return n};for(let t of O(e,`abstractNum`))this.abstracts.set(t.a.abstractNumId,n(t));for(let t of O(e,`num`)){let e={abstractId:D(t,`abstractNumId`)?.a.val??``,starts:{},levels:{}};for(let r of O(t,`lvlOverride`)){let t=A(r.a.ilvl,0),i=A(D(r,`startOverride`)?.a.val);i!==void 0&&(e.starts[t]=i);let a=D(r,`lvl`);a&&Object.assign(e.levels,n({n:`x`,a:{},c:[{...a,a:{...a.a,ilvl:String(t)}}],t:``}))}this.nums.set(t.a.numId,e)}}reset(){this.counters.clear()}findList(e){for(let[t,n]of this.nums){if(Object.keys(n.starts).length)continue;let r=this.abstracts.get(n.abstractId)?.[0];if(r&&(e===`bullet`?r.fmt===`bullet`:r.fmt===`decimal`))return t}}ids(){let e=[...this.abstracts.keys()].map(Number).filter(Number.isFinite),t=[...this.nums.keys()].map(Number).filter(Number.isFinite);return{abstract:e.length?Math.max(...e)+1:0,num:t.length?Math.max(...t)+1:1}}level(e,t){let n=this.nums.get(e);if(n)return n.levels[t]??this.abstracts.get(n.abstractId)?.[t]}next(e,t){let n=this.nums.get(e),r=this.level(e,t);if(!n||!r)return;let i=Object.keys(n.starts).length>0?`n`+e:`a`+n.abstractId,a=this.counters.get(i);a||(a=[],this.counters.set(i,a));let o=t=>n.starts[t]??this.level(e,t)?.start??1;a[t]=a[t]===void 0?o(t):a[t]+1;for(let e=t+1;e<9;e++)a[e]=void 0;for(let e=0;e<t;e++)a[e]===void 0&&(a[e]=o(e));if(r.fmt===`bullet`){let e=r.text;return{text:Ze[e]??(e||`•`),level:r}}return{text:r.text.replace(/%(\\d)/g,(n,i)=>{let s=Number(i)-1,c=this.level(e,s);return et(a[s]??o(s),r.isLgl&&s<t?`decimal`:c?.fmt??`decimal`)}),level:r}}};const nt={w:612,h:792,mt:72,mr:72,mb:72,ml:72,header:36,footer:36};function rt(e){let t=/^\\s*(PAGE|NUMPAGES|SECTIONPAGES)\\b/i.exec(e);if(t)return t[1].toUpperCase()===`PAGE`?`PAGE`:`NUMPAGES`}function it(e,t){if(e===t)return!0;if(!e||!t)return!e&&!t;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function at(e,t){if(!e)return;let n=RegExp(`(?:^|;)\\\\s*${t}\\\\s*:\\\\s*([\\\\d.]+)\\\\s*(pt|in|px|cm|mm)?`,`i`).exec(e);if(!n)return;let r=Number(n[1]);switch((n[2]??`px`).toLowerCase()){case`pt`:return r;case`in`:return r*72;case`cm`:return r*72/2.54;case`mm`:return r*72/25.4;default:return r*.75}}function ot(e){if(!e)return{...nt};let t=D(e,`pgSz`),n=D(e,`pgMar`),r=(e,t)=>e===void 0?t:Math.abs(Number(e))/20,i=r(t?.a.w,nt.w),a=r(t?.a.h,nt.h);return t?.a.orient===`landscape`&&a>i&&([i,a]=[a,i]),{w:i,h:a,mt:r(n?.a.top,72),mr:r(n?.a.right??n?.a.end,72),mb:r(n?.a.bottom,72),ml:r(n?.a.left??n?.a.start,72),header:r(n?.a.header,36),footer:r(n?.a.footer,36)}}const st=/* @__PURE__ */ new Set([`p`,`del`,`moveFrom`,`oMath`,`oMathPara`,`pPr`,`rPr`,`r`]);function ct(e){let t=/* @__PURE__ */ new Map,n=e=>{for(let r of e.c)r.n===`r`&&t.set(r,t.size),st.has(r.n)||n(r)};return n(e),t}function lt(e,t=/* @__PURE__ */ new Map){let n=e=>{e.n===`p`&&t.set(e,t.size);for(let t of e.c)n(t)};for(let t of e)n(t);return t}function ut(e,t,n){let r=e.next(t.numId,t.ilvl);if(!r)return;let i=P(n,r.level.rs);return delete i.u,delete i.hl,{marker:{text:r.level.suff===`space`?r.text+` `:r.text,s:i,tab:r.level.suff===`tab`},lst:r.level.fmt===`bullet`?`bullet`:`number`}}var dt=class{constructor(e,t,n,r,i={}){w(this,`styles`,void 0),w(this,`numbering`,void 0),w(this,`theme`,void 0),w(this,`rels`,void 0),w(this,`hooks`,void 0),w(this,`fields`,[]),w(this,`tableLayer`,void 0),w(this,`boxDepth`,0),w(this,`tableDepth`,0),w(this,`cur`,void 0),this.styles=e,this.numbering=t,this.theme=n,this.rels=r,this.hooks=i}blocks(e,t){switch(e.n){case`p`:this.paragraph(e,t);break;case`tbl`:t.push(this.table(e));break;case`sdt`:for(let n of D(e,`sdtContent`)?.c??[])this.blocks(n,t);break;case`customXml`:case`ins`:case`smartTag`:case`sdtContent`:for(let n of e.c)this.blocks(n,t)}}paragraph(e,t){let n=D(e,`pPr`),r=Ke(n),i=this.styles.para(r.styleId),a=this.hooks.forced?.root===e?this.hooks.forced:void 0,o=a?a.layer:this.tableLayer,s=r.numPr??i.numPr,c=s&&s.numId!==`0`?this.numbering.level(s.numId,s.ilvl):void 0,l=P(this.styles.docPs,o?.ps,i.ps,c?.ps,r.ps),u=P(this.styles.docRs,o?.rs,i.rs),d=P(u,Ge(D(n,`rPr`),this.theme)),f=r.styleId??this.styles.defaultPara??``,p={t:`p`,ps:l,runs:[],markSz:d.sz,markFont:d.font,sid:f};l.pageBreakBefore&&(p.pb=!0);let m;if(c&&s){if(a)m=c.fmt===`bullet`?`bullet`:`number`,a.marker?p.marker=a.marker:p.marker={text:c.fmt===`bullet`?`•`:``,s:P(d,c.rs),tab:c.suff===`tab`};else{let e=ut(this.numbering,s,d);e&&(p.marker=e.marker,m=e.lst)}m&&(p.lst=m,p.ilvl=s.ilvl)}let h={layer:o,num:s&&s.numId!==`0`?s:void 0,ro:this.fields.length>0||this.boxDepth>0||this.tableDepth>1,sid:f,lst:m,marker:p.marker};a&&(a.rec=h);let g=a?a.pid:this.hooks.para?.(e,h);g!==void 0&&(p.pid=g);let _=this.cur;this.cur={pid:g,runs:ct(e),forced:a};let v=[p];this.inlines(e.c,u,void 0,void 0,{push:e=>{let t=p.runs,n=t[t.length-1];e.t===`text`&&n?.t===`text`&&n.href===e.href&&n.lk===e.lk&&it(n.s,e.s)&&it(n.d,e.d)?n.text+=e.text:t.push(e)},pageBreak:()=>{p={t:`p`,ps:l,runs:[],markSz:d.sz,markFont:d.font,pb:!0,sid:f},g!==void 0&&(p.pid=g),v.push(p)}}),this.cur=_,this.fields.length>0&&(h.ro=!0);for(let e of v)h.ro&&(e.ro=!0),t.push(e);r.sectPr&&t.push({t:`sect`,page:ot(r.sectPr),kind:D(r.sectPr,`type`)?.a.val??`nextPage`})}srcOf(e){let t=this.cur;if(!t)return{};let n=t.runs.get(e);if(n===void 0)return{};if(t.forced){let e=t.forced.map[n];return e?{src:e.src,d:e.d}:{}}return t.pid===void 0?{}:{src:[t.pid,n]}}inlines(e,t,n,r,i){for(let a of e)switch(a.n){case`r`:this.run(a,t,n,r,i);break;case`hyperlink`:{let e=a.a[`r:id`],o=e?this.rels.get(e)?.target:a.a.anchor?`#`+a.a.anchor:void 0,s=e?`r:`+e:a.a.anchor?`a:`+a.a.anchor:void 0;this.inlines(a.c,t,o??n,s??r,i);break}case`fldSimple`:{let e=rt(a.a.instr??``);if(e){let n=D(a,`r`);i.push({t:`field`,kind:e,s:P(t,Ge(D(n,`rPr`),this.theme)),...n?this.srcOf(n):{}})}else this.inlines(a.c,t,n,r,i);break}case`ins`:case`smartTag`:case`customXml`:case`bdo`:case`dir`:case`moveTo`:this.inlines(a.c,t,n,r,i);break;case`sdt`:this.inlines(D(a,`sdtContent`)?.c??[],t,n,r,i);break;case`oMath`:case`oMathPara`:{let e=ve(a,`t`).map(e=>e.t).join(``);e&&i.push({t:`text`,text:e,s:{...t,i:!0,font:`"Cambria Math", "STIX Two Math", serif`}});break}}}run(e,t,n,r,i){let a=D(e,`rPr`),o=P(t,this.styles.char(D(a,`rStyle`)?.a.val),Ge(a,this.theme));if(o.vanish)return;let{src:s,d:c}=this.srcOf(e),l=(e,t=o,a=n)=>i.push({t:`text`,text:e,s:t,href:a,lk:a===n?r:void 0,src:s,d:c});for(let t of e.c){let e=this.fields[this.fields.length-1];switch(t.n){case`fldChar`:{let n=t.a.fldCharType;if(n===`begin`)this.fields.push({instr:``,phase:`instr`});else if(n===`separate`&&e){e.phase=`result`,e.kind=rt(e.instr);let t=/HYPERLINK\\s+(?:\\\\l\\s+)?"([^"]+)"/.exec(e.instr);t&&(e.href=/\\\\l/.test(e.instr)?`#`+t[1]:t[1]),e.kind&&i.push({t:`field`,kind:e.kind,s:o,src:s})}else if(n===`end`){if(e&&e.phase===`instr`){let t=rt(e.instr);t&&i.push({t:`field`,kind:t,s:o,src:s})}this.fields.pop()}break}case`instrText`:e&&(e.instr+=t.t);break;case`t`:if(e&&(e.phase===`instr`||e.kind))break;t.t&&l(t.t,o,e?.href??n);break;case`tab`:case`ptab`:(!e||e.phase===`result`&&!e.kind)&&l(` `);break;case`br`:t.a.type===`page`?i.pageBreak():l(`\n`);break;case`cr`:l(`\n`);break;case`noBreakHyphen`:l(`‑`);break;case`softHyphen`:l(``);break;case`sym`:{let e=parseInt(t.a.char??``,16);e&&l(String.fromCharCode(e>=61440?e-61440:e),{...o,font:t.a.font?`"${t.a.font}", ${o.font??`serif`}`:o.font});break}case`drawing`:this.drawing(t,n,i,s);break;case`pict`:case`object`:this.vml(t,n,i,s);break;case`footnoteReference`:case`endnoteReference`:i.push({t:`ref`,text:t.a.id??`*`,s:{...o,va:`sup`},src:s})}}}target(e){if(!e)return;let t=this.rels.get(e);return t&&!t.external?t.target:void 0}boxBlocks(e){let t=[],n=this.cur;this.boxDepth++;for(let n of e)for(let e of n.c)this.blocks(e,t);return this.boxDepth--,this.cur=n,t}drawing(e,t,n,r){let i=D(e,`inline`)??D(e,`anchor`);if(!i)return;let a=D(i,`extent`),o=Me(A(a?.a.cx,0)),s=Me(A(a?.a.cy,0)),c=D(i,`docPr`),l=k(i,`graphic`,`graphicData`),u=ve(l,`txbxContent`);if(u.length){let e=this.boxBlocks(u),t=_e(l,`spPr`),i=k(t,`solidFill`,`srgbClr`)?.a.val,a=k(t,`ln`,`solidFill`,`srgbClr`)?.a.val;n.push({t:`box`,w:o,h:s,blocks:e,fill:i?`#`+i:void 0,border:a?`1px solid #${a}`:void 0,src:r});return}let d=_e(l,`blip`),f=this.target(d?.a[`r:embed`]);if(f){let e=this.rels.get(D(c,`hlinkClick`)?.a[`r:id`]??``)?.target;n.push({t:`img`,target:f,w:o,h:s,alt:c?.a.descr||c?.a.title||void 0,href:e??t,src:r,rid:d?.a[`r:embed`]})}else _e(l,`chart`)?n.push({t:`shape`,w:o,h:s,label:`Chart`,src:r}):_e(l,`relIds`)?n.push({t:`shape`,w:o,h:s,label:`Diagram`,src:r}):n.push({t:`shape`,w:0,h:0,src:r})}vml(e,t,n,r){let i=_e(e,`txbxContent`),a=(_e(e,`shape`)??_e(e,`rect`))?.a.style,o=at(a,`width`)??0,s=at(a,`height`)??0;if(i){n.push({t:`box`,w:o,h:s,blocks:this.boxBlocks([i]),src:r});return}let c=this.target(_e(e,`imagedata`)?.a[`r:id`]);c&&o&&s?n.push({t:`img`,target:c,w:o,h:s,href:t,src:r}):n.push({t:`shape`,w:0,h:0,src:r})}table(e){this.tableDepth++;try{let t=this.tableInner(e);return this.tableDepth===1&&this.hooks.item&&(t.item=this.hooks.item()),t}finally{this.tableDepth--}}tableInner(e){let t=D(e,`tblPr`),n=this.styles.table(D(t,`tblStyle`)?.a.val),r=pt(D(t,`tblLook`)),i={...n.borders,...Ye(D(t,`tblBorders`))},a={top:0,bottom:0,left:5.4,right:5.4,...n.cellMar,...Xe(D(t,`tblCellMar`))},o=O(D(e,`tblGrid`),`gridCol`).map(e=>(A(e.a.w)??0)/20),s=D(t,`jc`)?.a.val,c=D(t,`tblInd`),l=ft(e,`tr`),u=[],d=o.length;l.forEach((e,t)=>{let i=D(e,`trPr`),o=D(i,`trHeight`),s={cells:[],src:t};o?.a.val&&(s.h=Number(o.a.val)/20,s.exact=o.a.hRule===`exact`),D(i,`tblHeader`)&&(s.header=!0);let c=A(D(i,`gridBefore`)?.a.val,0),f=[];for(let[i,o]of ft(e,`tc`).entries()){let e=D(o,`tcPr`),s=Math.max(1,A(D(e,`gridSpan`)?.a.val,1)),u=D(e,`vMerge`),p=[];if(r.noVBand||p.push((c-+!!r.firstCol)%2==0?`band1Vert`:`band2Vert`),!r.noHBand){let e=t-+!!r.firstRow;e>=0&&p.push(e%2==0?`band1Horz`:`band2Horz`)}r.firstCol&&c===0&&p.push(`firstCol`),r.lastCol&&d&&c+s>=d&&p.push(`lastCol`),r.firstRow&&t===0&&p.push(`firstRow`),r.lastRow&&t===l.length-1&&p.push(`lastRow`);let m=n.shd,h={};for(let e of p){let t=n.cond[e];t&&(t.shd&&(m=t.shd),h=P(h,t.rs))}m=Be(D(e,`shd`))??m;let g=this.tableLayer;this.tableLayer={ps:n.ps,rs:P(n.rs,h)};let _=[];for(let e of o.c)e.n!==`tcPr`&&this.blocks(e,_);this.tableLayer=g;let v=Xe(D(e,`tcMar`)),y=D(e,`vAlign`)?.a.val,b=D(e,`tcW`);f.push({blocks:_,src:[t,i],colSpan:s,rowSpan:1,w:b&&(b.a.type??`dxa`)===`dxa`?Number(b.a.w)/20:void 0,shd:m,vAlign:y===`center`?`middle`:y===`bottom`?`bottom`:void 0,borders:{},pad:[v.top??a.top,v.right??a.right,v.bottom??a.bottom,v.left??a.left],gs:c,vm:u?u.a.val===`restart`?`restart`:`continue`:void 0,tcB:Ye(D(e,`tcBorders`)),ri:t}),c+=s}d=Math.max(d,c),u.push({row:s,cells:f})});for(let e=0;e<u.length;e++)for(let t of u[e].cells)if(!t.gone&&t.vm)for(let n=e+1;n<u.length;n++){let e=u[n].cells.find(e=>e.gs===t.gs);if(!e||e.vm!==`continue`)break;e.gone=!0,t.rowSpan++}let f=u.length;return{t:`tbl`,cols:o,rows:u.map(({row:e,cells:t})=>{for(let n of t){if(n.gone)continue;let t=n.ri+n.rowSpan-1==f-1,r={t:Ue(n.tcB.top===void 0?n.ri===0?i.top:i.insideH:n.tcB.top),b:Ue(n.tcB.bottom===void 0?t?i.bottom:i.insideH:n.tcB.bottom),l:Ue(n.tcB.left===void 0?n.gs===0?i.left:i.insideV:n.tcB.left),r:Ue(n.tcB.right===void 0?n.gs+n.colSpan>=d?i.right:i.insideV:n.tcB.right)},{gs:a,vm:o,tcB:s,gone:c,ri:l,...u}=n;e.cells.push({...u,borders:r})}return e}),align:s===`center`?`center`:s===`right`||s===`end`?`right`:void 0,indL:c&&(c.a.type??`dxa`)===`dxa`?Number(c.a.w)/20:void 0}}};function ft(e,t){let n=[];for(let r of e.c)r.n===t?n.push(r):r.n===`sdt`?n.push(...ft(D(r,`sdtContent`)??r,t)):(r.n===`customXml`||r.n===`sdtContent`)&&n.push(...ft(r,t));return n}function pt(e){let t={firstRow:!0,lastRow:!1,firstCol:!0,lastCol:!1,noHBand:!1,noVBand:!0};if(!e)return t;let n=e.a.val;if(n&&/^[0-9a-fA-F]+$/.test(n)&&e.a.firstRow===void 0){let e=parseInt(n,16);return{firstRow:!!(e&32),lastRow:!!(e&64),firstCol:!!(e&128),lastCol:!!(e&256),noHBand:!!(e&512),noVBand:!!(e&1024)}}let r=(t,n)=>e.a[t]===void 0?n:e.a[t]===`1`||e.a[t]===`true`;return{firstRow:r(`firstRow`,!0),lastRow:r(`lastRow`,!1),firstCol:r(`firstColumn`,!0),lastCol:r(`lastColumn`,!1),noHBand:r(`noHBand`,!1),noVBand:r(`noVBand`,!0)}}var mt=class{constructor(e,t){w(this,`tb`,void 0),w(this,`onItem`,void 0),w(this,`prefix`,``),w(this,`items`,[]),w(this,`suffix`,``),w(this,`buf`,``),w(this,`tail`,``),w(this,`pending`,``),w(this,`inItem`,!1),w(this,`depth`,0),w(this,`els`,[]),w(this,`raw`,e=>{this.flush(),this.pending=e}),w(this,`element`,e=>{this.els.push(e)}),this.tb=e,this.onItem=t}flush(){this.pending&&(this.inItem?this.buf+=this.pending:this.tail+=this.pending,this.pending=``)}open(e,t){this.depth===2&&(this.items.length?this.items[this.items.length-1]+=this.tail:this.prefix+=this.tail,this.tail=``,this.inItem=!0,this.buf=``,this.els=[]),this.flush();let n=this.tb.open(e,t);return n||this.depth++,n}close(e){this.flush(),this.tb.close(e),this.depth--,this.depth===2&&this.inItem&&(this.inItem=!1,this.items.push(this.buf),this.buf=``,this.onItem(this.items.length-1,this.els),this.els=[])}text(e){this.flush(),this.tb.text(e)}finish(){this.flush(),this.items.length?this.suffix=this.tail:this.prefix+=this.tail,this.tail=``}},ht=class e{constructor(e,t,n,r,i,a){w(this,`pkg`,void 0),w(this,`mainPath`,void 0),w(this,`rels`,void 0),w(this,`styles`,void 0),w(this,`numbering`,void 0),w(this,`theme`,void 0),w(this,`items`,[]),w(this,`prefix`,``),w(this,`suffix`,``),w(this,`info`,/* @__PURE__ */ new Map),w(this,`origLoc`,/* @__PURE__ */ new Map),w(this,`ordPid`,/* @__PURE__ */ new Map),w(this,`itemParas`,/* @__PURE__ */ new Map),w(this,`groups`,/* @__PURE__ */ new Map),w(this,`genXml`,/* @__PURE__ */ new Map),w(this,`itemXml`,/* @__PURE__ */ new Map),w(this,`nextPid`,1),w(this,`captured`,!1),w(this,`edited`,!1),this.pkg=e,this.mainPath=t,this.rels=n,this.styles=r,this.numbering=i,this.theme=a}static async open(t,n){let r=await t.rels(n),i=M(r,`theme`),a=Ae(i?await t.xml(i.target):void 0),o=M(r,`styles`),s=M(r,`numbering`),c=new Je(o?await t.xml(o.target):void 0,a),l=new tt(s?await t.xml(s.target):void 0,a);return new e(t,n,r,c,l,a)}get dirty(){return this.edited||this.pkg.dirty}markEdited(){this.edited=!0}async headerFooter(e){let t=e?this.rels.get(e):void 0;if(!t)return;let n=await this.pkg.xml(t.target);if(!n)return;let r=new dt(this.styles,this.numbering,this.theme,await this.pkg.rels(t.target)),i=[];for(let e of n.c)r.blocks(e,i);return i}async stream(e){let t=0,n=/* @__PURE__ */ new Map,r=new dt(this.styles,this.numbering,this.theme,this.rels,{item:()=>t,para:(e,r)=>{let i=n.get(e);if(i===void 0)return;let a=this.nextPid++,o=r;o.item=t,o.ord=i,this.info.set(a,o),this.origLoc.set(a,{item:t,ord:i}),this.ordPid.set(`${t}:${i}`,a);let s=this.itemParas.get(t);return s||this.itemParas.set(t,s=[]),s[i]=a,a}}),i={font:this.styles.docRs.font??`"Times New Roman", serif`,sz:this.styles.docRs.sz??10,styles:this.styles.quickStyles()},a=[],o,s,c=Date.now(),l=e.initialHoldMs??350,u=0,d=!0,f=(e,i)=>{t=e,n=lt(i);for(let e of i){if(e.n===`sectPr`){o=e;continue}let t=a.length;if(r.blocks(e,a),!s)for(let e=t;e<a.length;e++){let t=a[e];t.t===`sect`&&(s=t.page)}}},p;p=new mt(new he({emitDepth:2,onElement:e=>p.element(e)}),f);let m=()=>{a.length&&(e.onBlocks(a),a=[],u=Date.now())};await me(await this.pkg.zip.stream(this.mainPath,e.onProgress),p,{signal:e.signal,raw:p.raw,onChunk:async()=>{let t=Date.now();if(d){if(t-c<l)return;d=!1,e.onMeta({page:s??{...nt},...i}),m()}else(a.length>=400||a.length&&t-u>120)&&(m(),await new Promise(e=>setTimeout(e,0)))}}),p.finish(),this.items=p.items,this.prefix=p.prefix,this.suffix=p.suffix,this.captured=!0;let h=o,g={page:ot(h),...i,final:!0};if(h){let e=(e,t)=>O(h,e).find(e=>(e.a.type??`default`)===t)?.a[`r:id`];g.header=await this.headerFooter(e(`headerReference`,`default`)),g.footer=await this.headerFooter(e(`footerReference`,`default`)),g.titlePg=!!D(h,`titlePg`)&&D(h,`titlePg`)?.a.val!==`0`,g.titlePg&&(g.firstHeader=await this.headerFooter(e(`headerReference`,`first`)),g.firstFooter=await this.headerFooter(e(`footerReference`,`first`)))}e.onMeta(g),m()}get ready(){return this.captured}reconvert(e,t,n,r,i){let a=ge(t),o={pid:e,root:a,map:n,layer:r,marker:i},s=new dt(this.styles,this.numbering,this.theme,this.rels,{forced:o}),c=[];return s.paragraph(a,c),{blocks:c,rec:o.rec}}recomputeMarkers(){let e=/* @__PURE__ */ new Map;this.numbering.reset();let t=[...this.itemParas.keys()].sort((e,t)=>e-t);for(let n of t){let t=this.itemParas.get(n);for(let r=0;r<t.length;r++){let i=t[r];if(i===void 0)continue;let a=this.groups.get(`${n}:${r}`)??[i];for(let t of a){let n=this.info.get(t);if(!n)continue;let r,i;if(n.num){let e=n.marker?.s??{},t=ut(this.numbering,n.num,e);t&&(r={...t.marker,s:n.marker?.s??t.marker.s},i=t.lst)}((r?.text??null)!==(n.marker?.text??null)||i!==n.lst)&&(n.marker=r,n.lst=i,e.set(t,n))}}}return e}};const gt=/* @__PURE__ */ `pStyle.keepNext.keepLines.pageBreakBefore.framePr.widowControl.numPr.suppressLineNumbers.pBdr.shd.tabs.suppressAutoHyphens.kinsoku.wordWrap.overflowPunct.topLinePunct.autoSpaceDE.autoSpaceDN.bidi.adjustRightInd.snapToGrid.spacing.ind.contextualSpacing.mirrorIndents.suppressOverlap.jc.textDirection.textAlignment.textboxTightWrap.outlineLvl.divId.cnfStyle.rPr.sectPr.pPrChange`.split(`.`),_t=/* @__PURE__ */ `rStyle.rFonts.b.bCs.i.iCs.caps.smallCaps.strike.dstrike.outline.shadow.emboss.imprint.noProof.snapToGrid.vanish.webHidden.color.spacing.w.kern.position.sz.szCs.highlight.u.effect.bdr.shd.fitText.vertAlign.rtl.cs.em.lang.eastAsianLayout.specVanish.oMath`.split(`.`),vt=/* @__PURE__ */ new Set([`bookmarkStart`,`commentRangeStart`,`permStart`,`moveFromRangeStart`,`moveToRangeStart`]),yt=/* @__PURE__ */ new Set([`bookmarkEnd`,`commentRangeEnd`,`permEnd`,`moveFromRangeEnd`,`moveToRangeEnd`]),bt=/* @__PURE__ */ new Set([`p`,`del`,`moveFrom`,`oMath`,`oMathPara`,`pPr`,`rPr`,`r`]),xt=Object.fromEntries(Object.entries(Re).map(([e,t])=>[t,e]));function St(t){let n=[];return t.forEach((i,a)=>{e(i)&&(r(i.q)===`p`&&n.push({node:i,list:t,index:a}),v(i,(e,t,i)=>{r(e.q)===`p`&&n.push({node:e,list:t.c,index:i})}))}),n}function Ct(e){let t=[];return v(e,e=>{let n=r(e.q);return n===`r`&&t.push(e),bt.has(n)}),t}const wt=/* @__PURE__ */ new WeakMap;function Tt(e,n){let r=wt.get(e);r||wt.set(e,r=/* @__PURE__ */ new Map);let i=r.get(n);return i||(i=St(t(e.items[n]??``)),r.size>64&&r.delete(r.keys().next().value),r.set(n,i)),i}function Et(e,t){let n=e.origLoc.get(t);if(n)return Tt(e,n.item)[n.ord]?.node}const Dt=/* @__PURE__ */ new WeakMap;function Ot(e,t){if(!t)return;let n=Et(e,t[0]);if(!n)return;let r=Dt.get(n);return r||Dt.set(n,r=Ct(n)),r[t[1]]}function kt(e,t,n){let r=n+`val`,i=(t,n)=>m(e,n,t,_t),a=(e,t)=>i(e,t?d(n+e):d(n+e,{[r]:`0`}));if(t.b!==void 0&&(a(`b`,t.b),a(`bCs`,t.b)),t.i!==void 0&&(a(`i`,t.i),a(`iCs`,t.i)),t.strike!==void 0&&(a(`strike`,t.strike),t.strike&&i(`dstrike`,void 0)),t.u!==void 0&&i(`u`,d(n+`u`,{[r]:t.u&&t.u!==`none`?t.u:`none`})),`color`in t&&i(`color`,t.color?d(n+`color`,{[r]:t.color.replace(`#`,``).toUpperCase()}):void 0),t.sz!==void 0){let e=String(Math.round(t.sz*2));i(`sz`,d(n+`sz`,{[r]:e})),i(`szCs`,d(n+`szCs`,{[r]:e}))}if(t.font!==void 0){let e=t.font;i(`rFonts`,d(n+`rFonts`,{[n+`ascii`]:e,[n+`hAnsi`]:e,[n+`eastAsia`]:e,[n+`cs`]:e}))}if(`hl`in t){let e=t.hl?xt[t.hl.toLowerCase()]:void 0;t.hl?e?i(`highlight`,d(n+`highlight`,{[r]:e})):i(`shd`,d(n+`shd`,{[r]:`clear`,[n+`color`]:`auto`,[n+`fill`]:t.hl.replace(`#`,``).toUpperCase()})):(i(`highlight`,void 0),i(`shd`,void 0))}`va`in t&&i(`vertAlign`,t.va?d(n+`vertAlign`,{[r]:t.va===`sup`?`superscript`:`subscript`}):void 0)}function At(e,t){let n=``;for(let r of e.split(/(\\t|\\n)/))r&&(n+=r===` `?`<${t}tab/>`:r===`\n`?`<${t}br/>`:`<${t}t xml:space="preserve">${h(r)}</${t}t>`);return n}function jt(e,t,n){let r=[`•`,`◦`,`▪`],i=[`decimal`,`lowerLetter`,`lowerRoman`],a=``;for(let t=0;t<9;t++){let o=n===`bullet`?`bullet`:i[t%3],s=n===`bullet`?r[t%3]:`%${t+1}.`;a+=`<${e}lvl ${e}ilvl="${t}"><${e}start ${e}val="1"/><${e}numFmt ${e}val="${o}"/><${e}lvlText ${e}val="${s}"/><${e}lvlJc ${e}val="left"/><${e}pPr><${e}ind ${e}left="${720*(t+1)}" ${e}hanging="360"/></${e}pPr></${e}lvl>`}return`<${e}abstractNum ${e}abstractNumId="${t}"><${e}multiLevelType ${e}val="hybridMultilevel"/>${a}</${e}abstractNum>`}function Mt(e,t){let n=e=>`<${t}sz ${t}val="${e}"/><${t}szCs ${t}val="${e}"/>`,r=e=>`<${t}color ${t}val="${e}"/>`;if(e===`title`)return{id:`Title`,name:`Title`,ppr:`<${t}spacing ${t}after="80" ${t}line="240" ${t}lineRule="auto"/><${t}contextualSpacing/>`,rpr:`<${t}spacing ${t}val="-10"/><${t}kern ${t}val="28"/>${n(56)}`};if(e===`subtitle`)return{id:`Subtitle`,name:`Subtitle`,ppr:`<${t}spacing ${t}after="160"/>`,rpr:`${r(`5A5A5A`)}<${t}spacing ${t}val="15"/>${n(28)}`};let i=Number(e.slice(1)),[a,o,s,c]={1:[240,32,`2F5496`,!1],2:[40,26,`2F5496`,!1],3:[40,24,`1F3763`,!1],4:[40,22,`2F5496`,!0],5:[40,22,`2F5496`,!1],6:[40,22,`1F3763`,!0]}[i];return{id:`Heading${i}`,name:`heading ${i}`,ppr:`<${t}keepNext/><${t}keepLines/><${t}spacing ${t}before="${a}" ${t}after="0"/><${t}outlineLvl ${t}val="${i-1}"/>`,rpr:`${c?`<${t}i/><${t}iCs/>`:``}${r(s)}${n(o)}`}}async function Nt(e,r){let o=e.styles.canonical()[r];if(o||r===`normal`)return{id:o??``,styles:e.styles.quickStyles()};let s=M(e.rels,`styles`),c=s?.target??`word/styles.xml`,l=t(e.pkg.has(c)?await e.pkg.text(c):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:styles>`),u=a(l),d=i(u.q),f=Mt(r,d),p=f.id;for(let t=2;e.styles.has(p);t++)p=f.id+t;let m=e.styles.defaultPara,h=m?`<${d}basedOn ${d}val="${m}"/><${d}next ${d}val="${m}"/>`:``,g=`<${d}style ${d}type="paragraph" ${d}styleId="${p}"><${d}name ${d}val="${f.name}"/>${h}<${d}uiPriority ${d}val="9"/><${d}qFormat/><${d}pPr>${f.ppr}</${d}pPr><${d}rPr>${f.rpr}</${d}rPr></${d}style>`;u.c.push(t(g)[0]),u.self=!1,e.pkg.setPart(c,n(l)),s||(await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,c),await e.pkg.setContentType(c,`application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml`),e.rels=await e.pkg.rels(e.mainPath));let _=ge(d?g.replace(`<${d}style `,`<${d}style xmlns:${d.slice(0,-1)}="http://schemas.openxmlformats.org/wordprocessingml/2006/main" `):g);return _&&e.styles.add(_),e.markEdited(),{id:p,styles:e.styles.quickStyles()}}async function Pt(o,s){let c=o.numbering.findList(s);if(c)return c;let l=M(o.rels,`numbering`),u=l?.target??`word/numbering.xml`,d=t(o.pkg.has(u)?await o.pkg.text(u):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:numbering>`),f=a(d),p=i(f.q),{abstract:m,num:h}=o.numbering.ids(),g=t(jt(p,m,s))[0],_=t(`<${p}num ${p}numId="${h}"><${p}abstractNumId ${p}val="${m}"/></${p}num>`)[0],v=(t,n)=>{let i=-1;return f.c.forEach((a,o)=>{e(a)&&r(a.q)===t&&(n||i<0)&&(i=o)}),i},y=v(`abstractNum`,!0),b=v(`num`,!1);f.c.splice(y>=0?y+1:b>=0?b:f.c.length,0,g);let x=v(`num`,!0),S=v(`numIdMacAtCleanup`,!1);f.c.splice(x>=0?x+1:S>=0?S:f.c.length,0,_),f.self=!1;let C=n(d);return o.pkg.setPart(u,C),l||(await o.pkg.addRel(o.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering`,u),await o.pkg.setContentType(u,`application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml`),o.rels=await o.pkg.rels(o.mainPath)),o.numbering=new tt(ge(C),o.theme),String(h)}async function Ft(e,t,n,r){let i=r+`val`,a=(e,n)=>m(t,n,e,gt);if(n.style!==void 0&&a(`pStyle`,n.style&&n.style!==e.styles.defaultPara?d(r+`pStyle`,{[i]:n.style}):void 0),n.align&&a(`jc`,d(r+`jc`,{[i]:n.align===`justify`?`both`:n.align})),n.line!==void 0||n.before!==void 0||n.after!==void 0){let e=f(s(t,`spacing`)??d(r+`spacing`));n.before!==void 0&&(u(e,r+`before`,String(Math.round(n.before*20))),u(e,r+`beforeAutospacing`,void 0)),n.after!==void 0&&(u(e,r+`after`,String(Math.round(n.after*20))),u(e,r+`afterAutospacing`,void 0)),n.line!==void 0&&(u(e,r+`line`,String(Math.round(n.line*240))),u(e,r+`lineRule`,`auto`)),a(`spacing`,e)}if(n.pageBreak!==void 0&&a(`pageBreakBefore`,n.pageBreak?d(r+`pageBreakBefore`):void 0),n.indL!==void 0){let e=f(s(t,`ind`)??d(r+`ind`));u(e,r+`start`,void 0),u(e,r+`left`,String(Math.max(0,Math.round(n.indL*20)))),a(`ind`,e)}let o=e.styles.para(Lt(t)).numPr,c=(e,t)=>d(r+`numPr`,{},[d(r+`ilvl`,{[i]:String(t)}),d(r+`numId`,{[i]:e})]);if(n.list===`none`)a(`numPr`,o?c(`0`,0):void 0);else if(n.list)a(`numPr`,c(await Pt(e,n.list),n.ilvl??0));else if(n.ilvl!==void 0){let e=s(t,`numPr`),r=(e&&It(s(e,`numId`),i))??o?.numId;r&&r!==`0`&&a(`numPr`,c(r,n.ilvl))}}function It(e,t){if(e)return RegExp(`(?:^|\\\\s)${t.replace(`:`,`\\\\:`)}="([^"]*)"`).exec(e.a)?.[1]}function Lt(e){let t=s(e,`pStyle`);return t?/="([^"]*)"/.exec(t.a)?.[1]:void 0}async function Rt(e,t){let a=Et(e,t.from),c=a?.q??`w:p`,l=i(c)||`w:`,m=f(s(a,`pPr`)??d(l+`pPr`));t.pd&&await Ft(e,m,t.pd,l),(t.keepSect??t.pid===t.from)||p(m,`sectPr`);let g=s(m,`rPr`),_=[],y=``,b,x=()=>{b!==void 0&&(y+=`</${l}hyperlink>`),b=void 0},S=(e,t)=>`<${l}r>${e&&e.c.length?n(e):``}${t}</${l}r>`,C=t=>{let n=s(Ot(e,t),`rPr`)??g;if(!n)return;let r=f(n);return r.q=l+`rPr`,p(r,e=>e===`rPrChange`||e===`ins`||e===`del`||e===`moveFrom`||e===`moveTo`),r};t.parts.forEach((t,i)=>{i>0&&(x(),y+=`<${l}r><${l}br ${l}type="page"/></${l}r>`,_.push({}));for(let i of t){if(`obj`in i){if(x(),i.obj===`field`){let e=C(void 0);i.set&&kt(e??(e=d(l+`rPr`)),i.set,l),y+=`<${l}fldSimple ${l}instr=" ${i.kind} ">${S(e,`<${l}t>1</${l}t>`)}</${l}fldSimple>`,_.push({d:i.set})}else if(i.obj===`image`)y+=Ut(l,i.rid,i.w,i.h,i.name,i.alt),_.push({});else{let t=Ot(e,i.src);if(t){if(i.size||i.alt!==void 0||i.rid){let e=f(t),a=i.size&&String(Math.round(i.size[0]*12700)),o=i.size&&String(Math.round(i.size[1]*12700));v(e,e=>{let t=r(e.q);if(a&&o&&(t===`extent`||t===`ext`&&/\\scx=/.test(e.a))&&(u(e,`cx`,a),u(e,`cy`,o)),i.alt!==void 0&&(t===`docPr`||t===`cNvPr`&&/\\sid=/.test(e.a))&&u(e,`descr`,i.alt||void 0),i.rid&&t===`blip`){let t=/([\\w.-]+):embed="/.exec(e.a);u(e,t?`${t[1]}:embed`:`r:embed`,i.rid)}}),y+=n(e)}else y+=n(t);_.push({src:i.src})}}continue}if(i.lk!==b&&(x(),i.lk)){let e=i.lk.startsWith(`r:`)?`r:id="${i.lk.slice(2)}"`:`${l}anchor="${h(i.lk.slice(2))}"`;y+=`<${l}hyperlink ${e}>`,b=i.lk}let t=C(i.src);i.set&&Object.keys(i.set).length&&kt(t??(t=d(l+`rPr`)),i.set,l),i.text&&(y+=S(t,At(i.text,l)),_.push({src:i.src,d:i.set}))}}),x();let w=``,T=``,ee=t.orig??(t.pid===t.from?[t.from]:[]);for(let t of ee){let i=Et(e,t);if(i){for(let e of o(i)){let t=r(e.q);vt.has(t)?w+=n(e):yt.has(t)&&(T+=n(e))}for(let e of Ct(i))s(e,`commentReference`)&&(T+=n(e),_.push({}))}}let E=a?.a??``;t.pid!==t.from&&(E=E.replace(/\\s+w14:(paraId|textId)="[^"]*"/g,``));let te=m.c.length?n(m):``;return{xml:`<${c}${E}>${te}${w}${y}${T}</${c}>`,map:_}}function zt(e,t){let n=e.groups.get(t);if(!n){let r=e.ordPid.get(t);n=r===void 0?[]:[r],e.groups.set(t,n)}return n}function Bt(e,t){let n=e.info.get(t);if(!n)return;let r=zt(e,`${n.item}:${n.ord}`),i=r.indexOf(t);i>=0&&r.splice(i,1)}async function Vt(e,t){if(!e.ready)throw Error(`Document is still loading`);let r=e.info.get(t.anchor);if(!r)throw Error(`Unknown paragraph ${t.anchor}`);e.markEdited();let i=[t.anchor,...t.list.map(e=>e.pid),...t.remove??[]],a=t.list.some(e=>e.pd)||i.some(t=>e.info.get(t)?.num),o=r.item,s=r.ord,c=t.list.map(e=>e.pid);for(let n of[...c,...t.remove??[]])n!==t.anchor&&Bt(e,n);let l=zt(e,`${o}:${s}`),u=l.indexOf(t.anchor);if(u<0)throw Error(`Paragraph ${t.anchor} is not in the document`);l.splice(u,1,...c);for(let n of[t.anchor,...t.remove??[]])c.includes(n)||e.genXml.delete(n);let d={};for(let i of t.list){let a=e.info.get(i.from)??r,c=e.info.get(i.pid),l,u,f=i.pristine&&i.pid===i.from?Et(e,i.pid):void 0;f?(l=n(f),u=Ct(f).map((e,t)=>({src:[i.pid,t]}))):{xml:l,map:u}=await Rt(e,i),e.genXml.set(i.pid,l);let{blocks:p,rec:m}=e.reconvert(i.pid,l,u,a.layer,c?.marker);e.info.set(i.pid,{...m,item:o,ord:s,marker:c?.marker,lst:c?.lst}),t.want&&(d[i.pid]=p)}let f=a||t.list.some(t=>e.info.get(t.pid)?.num)?e.recomputeMarkers():/* @__PURE__ */ new Map,p={};for(let[e,t]of f)p[e]=t.marker?{...t.marker,lst:t.lst}:null;for(let[t,n]of Object.entries(d)){let r=e.info.get(Number(t));n.filter(e=>e.t===`p`).forEach((e,t)=>{delete e.marker,delete e.lst,t===0&&r?.marker&&(e.marker=r.marker,e.lst=r.lst)})}return{blocks:d,markers:p}}let Ht=7e3;function Ut(e,t,n,r,i=`Picture`,a){let o=Math.round(n*12700),s=Math.round(r*12700),c=++Ht,l=`http://schemas.openxmlformats.org/drawingml/2006/main`,u=`http://schemas.openxmlformats.org/drawingml/2006/picture`,d=h(i),f=a?` descr="${h(a).replace(/"/g,`"`)}"`:``;return`<${e}r><${e}drawing><wp:inline xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${o}" cy="${s}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:docPr id="${c}" name="${d} ${c}"${f}/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="${l}" noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic xmlns:a="${l}"><a:graphicData uri="${u}"><pic:pic xmlns:pic="${u}"><pic:nvPicPr><pic:cNvPr id="${c}" name="${d}"${f}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${t}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${o}" cy="${s}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></${e}drawing></${e}r>`}const Wt={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`};async function Gt(e,t,n){if(n=n.toLowerCase().replace(`jpeg`,`jpg`),!Wt[n])throw Error(`Unsupported image type .${n}`);let r=e.pkg.freeName(`word/media`,`image`,n);e.pkg.setPart(r,t),await e.pkg.ensureDefaultType(n,Wt[n]);let i=await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,r);return e.rels=await e.pkg.rels(e.mainPath),e.markEdited(),{rid:i,path:r}}async function Kt(e,t){let n=await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,t,!0);return e.rels=await e.pkg.rels(e.mainPath),`r:`+n}const qt=[`cnfStyle`,`tcW`,`gridSpan`,`hMerge`,`vMerge`,`tcBorders`,`shd`,`noWrap`,`tcMar`,`textDirection`,`tcFitText`,`vAlign`,`hideMark`];function Jt(e){let t=[],n=e=>{for(let i of o(e)){let e=r(i.q);e===`tr`?t.push(i):(e===`sdt`||e===`sdtContent`||e===`customXml`)&&n(i)}};return n(e),t}function Yt(e){let t=[],n=e=>{for(let i of o(e)){let e=r(i.q);e===`tc`?t.push(i):(e===`sdt`||e===`sdtContent`||e===`customXml`)&&n(i)}};return n(e),t}async function Xt(e,o){let c;if(o.item!==void 0){let n=a(t(e.items[o.item]??``));n&&(r(n.q)===`tbl`?c=n:v(n,e=>(!c&&r(e.q)===`tbl`&&(c=e),!!c)))}let l=c&&i(c.q)||`w:`,u=l+`val`,h=c?Jt(c):[],g=c?s(c,`tblPr`):void 0;if(!g){let n=e.styles.has(`TableGrid`)?`<${l}tblStyle ${u}="TableGrid"/>`:``;g=t(`<${l}tblPr>${n}<${l}tblW ${l}w="0" ${l}type="auto"/>${n?``:`<${l}tblBorders>${[`top`,`left`,`bottom`,`right`,`insideH`,`insideV`].map(e=>`<${l}${e} ${u}="single" ${l}sz="4" ${l}space="0" ${l}color="auto"/>`).join(``)}</${l}tblBorders>`}<${l}tblLook ${u}="04A0" ${l}firstRow="1" ${l}lastRow="0" ${l}firstColumn="1" ${l}lastColumn="0" ${l}noHBand="0" ${l}noVBand="1"/></${l}tblPr>`)[0]}let _=`<${l}tblGrid>${o.cols.map(e=>`<${l}gridCol ${l}w="${Math.round(e*20)}"/>`).join(``)}</${l}tblGrid>`,y=h.length?s(Yt(h[0])[0],`tcPr`):void 0,b=o.cols.length,x=[],S=`<${l}tbl${c?.a??``}>${n(g)}${_}`,C=(e,t,r,i,a)=>{let c=f((e?s(Yt(h[e[0]]??{c:[]})[e[1]],`tcPr`):void 0)??y??d(l+`tcPr`));c.q=l+`tcPr`,p(c,e=>e===`gridSpan`||e===`vMerge`||e===`hMerge`);let g=o.cols.slice(t,t+r).reduce((e,t)=>e+t,0);return m(c,d(l+`tcW`,{[l+`w`]:String(Math.round(g*20)),[l+`type`]:`dxa`}),`tcW`,qt),r>1&&m(c,d(l+`gridSpan`,{[u]:String(r)}),`gridSpan`,qt),i&&m(c,d(l+`vMerge`,i===`restart`?{[u]:`restart`}:{}),`vMerge`,qt),a!==void 0&&m(c,a?d(l+`shd`,{[u]:`clear`,[l+`color`]:`auto`,[l+`fill`]:a.replace(`#`,``).toUpperCase()}):void 0,`shd`,qt),n(c)};for(let t of o.rows){let r=t.src===void 0?void 0:h[t.src],i=s(r,`trPr`);S+=`<${l}tr${r?.a??``}>${i?n(i):``}`;let a=0,o=0,c=t.cells;for(;a<b&&(o<c.length||x[a]);){let t=x[a];if(t&&t.left>0){S+=`<${l}tc>${t.tcPr,``}${C(void 0,a,t.span,`continue`)}<${l}p/></${l}tc>`,t.left--,t.left||(x[a]=void 0),a+=t.span;continue}let r=c[o++];if(!r)break;let i=Math.max(1,Math.min(r.colSpan,b-a)),s=``;for(let t of r.paras){let r=t.pristine&&t.pid===t.from?Et(e,t.pid):void 0;s+=r?n(r):(await Rt(e,t)).xml}S+=`<${l}tc>${C(r.src,a,i,r.rowSpan>1?`restart`:void 0,r.shd)}${s||`<${l}p/>`}</${l}tc>`,r.rowSpan>1&&(x[a]={left:r.rowSpan-1,span:i}),a+=i}S+=`</${l}tr>`}return S+`</${l}tbl>`}async function Zt(e,t){if(!e.ready)throw Error(`Document is still loading`);e.markEdited();let n=t.spec?await Xt(e,t.spec):``;if(t.item!==void 0){e.itemXml.set(t.item,n);return}let r;for(let[n,i]of e.groups)i.includes(t.tid)&&(r=n);if(!t.spec)r&&e.groups.get(r).splice(e.groups.get(r).indexOf(t.tid),1),e.genXml.delete(t.tid);else{if(!r){let n=t.anchor===void 0?void 0:e.info.get(t.anchor);if(!n||t.anchor===void 0)throw Error(`Table anchor paragraph not found`);let r=zt(e,`${n.item}:${n.ord}`);r.splice(r.indexOf(t.anchor)+1,0,t.tid)}e.genXml.set(t.tid,n)}}async function Qt(e){if(!e.ready)throw Error(`Document is still loading`);if(e.groups.size||e.itemXml.size){let r=/* @__PURE__ */ new Set;for(let t of e.groups.keys())r.add(Number(t.split(`:`)[0]));let i=[e.prefix];for(let a=0;a<e.items.length;a++){let o=e.itemXml.get(a);if(o!==void 0){i.push(o+(/\\s*$/.exec(e.items[a])?.[0]??``));continue}if(!r.has(a)){i.push(e.items[a]);continue}let s=t(e.items[a]),c=St(s);for(let t=0;t<c.length;t++){let r=e.groups.get(`${a}:${t}`);if(!r)continue;let i=c[t];i.list[i.index]=r.map(t=>e.genXml.get(t)??(Et(e,t)?n(Et(e,t)):``)).join(``)}i.push(n(s))}i.push(e.suffix),e.pkg.setPart(e.mainPath,i.join(``))}return e.pkg.save(`application/vnd.openxmlformats-officedocument.wordprocessingml.document`)}function $t(e){let t=e.replace(`#`,``),n=t.length===8?t.slice(2):t.padStart(6,`0`).slice(0,6);return[parseInt(n.slice(0,2),16)||0,parseInt(n.slice(2,4),16)||0,parseInt(n.slice(4,6),16)||0]}function en([e,t,n]){let r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`);return`#`+r(e)+r(t)+r(n)}function tn([e,t,n]){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2;if(r===i)return[0,0,a];let o=r-i,s=a>.5?o/(2-r-i):o/(r+i),c=0;return c=r===e?(t-n)/o+(t<n?6:0):r===t?(n-e)/o+2:(e-t)/o+4,[c/6,s,a]}function nn([e,t,n]){if(t===0)return[n*255,n*255,n*255];let r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,a=e=>(e<0&&(e+=1),e>1&&--e,e<1/6?i+(r-i)*6*e:e<1/2?r:e<2/3?i+(r-i)*(2/3-e)*6:i);return[a(e+1/3)*255,a(e)*255,a(e-1/3)*255]}const rn=e=>Math.max(0,Math.min(1,e));function an(e,t){if(!t)return e;let n=tn($t(e));return n[2]=t<0?n[2]*(1+t):n[2]*(1-t)+t,en(nn(n))}const on={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,ltGray:`#d3d3d3`,dkGray:`#a9a9a9`,orange:`#ffa500`,purple:`#800080`,navy:`#000080`,maroon:`#800000`,olive:`#808000`,teal:`#008080`,silver:`#c0c0c0`,lime:`#00ff00`,pink:`#ffc0cb`,brown:`#a52a2a`,gold:`#ffd700`},sn={bg1:`lt1`,tx1:`dk1`,bg2:`lt2`,tx2:`dk2`},cn=/* @__PURE__ */ new Set([`srgbClr`,`schemeClr`,`sysClr`,`prstClr`,`scrgbClr`,`hslClr`]);function ln(e,t){let n;switch(e.n){case`srgbClr`:n=`#`+(e.a.val??`000000`).toLowerCase();break;case`sysClr`:n=`#`+(e.a.lastClr??(e.a.val===`window`?`ffffff`:`000000`));break;case`prstClr`:n=on[e.a.val]??`#000000`;break;case`scrgbClr`:n=en([(A(e.a.r)??0)/1e5*255,(A(e.a.g)??0)/1e5*255,(A(e.a.b)??0)/1e5*255]);break;case`hslClr`:n=en(nn([(A(e.a.hue)??0)/216e5,(A(e.a.sat)??0)/1e5,(A(e.a.lum)??0)/1e5]));break;case`schemeClr`:{let r=e.a.val;if(r===`phClr`)n=t.phClr;else{let e=t.clrMap?.[r]??sn[r]??r;n=t.theme?.colors[e]??t.theme?.colors[r]}break}}if(n)return un(n,e)}function un(e,t){if(!t.c.length)return e;let n=$t(e),r=1;for(let e of t.c){let t=(A(e.a.val)??0)/1e5;switch(e.n){case`alpha`:r=t;break;case`lumMod`:{let e=tn(n);e[2]=rn(e[2]*t),n=nn(e);break}case`lumOff`:{let e=tn(n);e[2]=rn(e[2]+t),n=nn(e);break}case`satMod`:{let e=tn(n);e[1]=rn(e[1]*t),n=nn(e);break}case`tint`:n=n.map(e=>e+(255-e)*(1-t));break;case`shade`:n=n.map(e=>e*t);break;case`inv`:n=n.map(e=>255-e);break;case`gray`:{let e=n[0]*.3+n[1]*.59+n[2]*.11;n=[e,e,e];break}}}let i=en(n);if(r>=1)return i;let[a,o,s]=$t(i);return`rgba(${a},${o},${s},${+r.toFixed(3)})`}function F(e,t){if(e){for(let n of e.c)if(cn.has(n.n))return ln(n,t)}}const dn=`000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 800000 008000 000080 808000 800080 008080 C0C0C0 808080 9999FF 993366 FFFFCC CCFFFF 660066 FF8080 0066CC CCCCFF 000080 FF00FF FFFF00 00FFFF 800080 800000 008080 0000FF 00CCFF CCFFFF CCFFCC FFFF99 99CCFF FF99CC CC99FF FFCC99 3366FF 33CCCC 99CC00 FFCC00 FF9900 FF6600 666699 969696 003366 339966 003300 333300 993300 993366 333399 333333`.split(` `).map(e=>`#`+e),fn=[`lt1`,`dk1`,`lt2`,`dk2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`];function pn(e,t,n=dn){if(!e||e.a.auto===`1`||e.a.auto===`true`)return;let r;if(e.a.rgb){let t=e.a.rgb;r=`#`+(t.length===8?t.slice(2):t)}else if(e.a.theme!==void 0)r=t?.colors[fn[Number(e.a.theme)]??``]??void 0;else if(e.a.indexed!==void 0){let t=Number(e.a.indexed);if(t===64||t===65)return;r=n[t]}if(!r)return;let i=A(e.a.tint)??0;return i?an(r,i):r.toLowerCase()}function mn(e){let t=O(D(D(e,`colors`),`indexedColors`),`rgbColor`);return t.length?t.map(e=>`#`+(e.a.rgb??`FF000000`).slice(-6)):dn}const hn=[`ln`,`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`,`effectLst`,`effectDag`,`highlight`,`uLnTx`,`uLn`,`uFillTx`,`uFill`,`latin`,`ea`,`cs`,`sym`,`hlinkClick`,`hlinkMouseOver`,`rtl`,`extLst`],gn=/* @__PURE__ */ new Set([`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`]),_n={left:`l`,center:`ctr`,right:`r`,justify:`just`};function vn(t,n){let i;for(let a of t)e(a)&&v(a,e=>{if(i)return!0;if(r(e.q)!==`sp`)return;let t=l(s(s(e,`nvSpPr`),`cNvPr`)??e,`id`);return t!==void 0&&Number(t)===n&&(i=e),!0});return i}function yn(e,t,n){t.sz!==void 0&&u(e,`sz`,String(Math.round(t.sz*100))),t.b!==void 0&&u(e,`b`,t.b?`1`:`0`),t.i!==void 0&&u(e,`i`,t.i?`1`:`0`),t.u!==void 0&&u(e,`u`,t.u?`sng`:`none`),t.strike!==void 0&&u(e,`strike`,t.strike?`sngStrike`:`noStrike`),`color`in t&&(p(e,e=>gn.has(e)),t.color&&m(e,d(n+`solidFill`,{},[d(n+`srgbClr`,{val:t.color.replace(`#`,``).toUpperCase()})]),`solidFill`,hn)),t.font&&m(e,d(n+`latin`,{typeface:t.font}),`latin`,hn),`hl`in t&&m(e,t.hl?d(n+`highlight`,{},[d(n+`srgbClr`,{val:t.hl.replace(`#`,``).toUpperCase()})]):void 0,`highlight`,hn),`baseline`in t&&u(e,`baseline`,t.baseline?String(Math.round(t.baseline*1e3)):void 0)}const bn=[`lnSpc`,`spcBef`,`spcAft`,`buClrTx`,`buClr`,`buSzTx`,`buSzPct`,`buSzPts`,`buFontTx`,`buFont`,`buNone`,`buAutoNum`,`buChar`,`buBlip`,`tabLst`,`defRPr`,`extLst`],xn=/* @__PURE__ */ new Set([`buNone`,`buAutoNum`,`buChar`,`buBlip`]);function Sn(e,t,n){if(t.algn&&u(e,`algn`,_n[t.algn]),t.lvl!==void 0&&String(t.lvl)!==(l(e,`lvl`)??`0`)&&(u(e,`lvl`,t.lvl?String(t.lvl):void 0),u(e,`marL`,void 0),u(e,`indent`,void 0)),t.bullet){if(p(e,e=>xn.has(e)),t.bullet===`none`)m(e,d(n+`buNone`),`buNone`,bn),l(e,`indent`)?.startsWith(`-`)&&u(e,`indent`,`0`);else{let r=t.bullet===`bullet`?d(n+`buChar`,{char:`•`}):d(n+`buAutoNum`,{type:`arabicPeriod`});if(t.bullet===`bullet`&&m(e,d(n+`buFont`,{typeface:`Arial`}),`buFont`,bn),m(e,r,t.bullet===`bullet`?`buChar`:`buAutoNum`,bn),!l(e,`marL`)){let t=Number(l(e,`lvl`)??0);u(e,`marL`,String(342900+t*457200)),u(e,`indent`,`-342900`)}}}t.lnPct&&m(e,d(n+`lnSpc`,{},[d(n+`spcPct`,{val:String(Math.round(t.lnPct*1e5))})]),`lnSpc`,bn),e.self=e.c.length===0}const Cn={l:`left`,ctr:`center`,r:`right`,just:`justify`,dist:`justify`,thaiDist:`justify`,justLow:`justify`},wn={dash:`4 3`,sysDash:`3 1`,dot:`1 1`,sysDot:`1 1`,lgDash:`8 3`,dashDot:`4 3 1 3`,lgDashDot:`8 3 1 3`,lgDashDotDot:`8 3 1 3 1 3`,sysDashDot:`3 1 1 1`,sysDashDotDot:`3 1 1 1 1 1`};function Tn(e){let t=e.c[0];return t?D(t,`nvPr`):void 0}function En(e){let t=D(Tn(e),`ph`);if(t)return{type:t.a.type??`body`,idx:t.a.idx}}const Dn=e=>e===`ctrTitle`?`title`:e===`subTitle`||e===`obj`?`body`:e;function On(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=e=>{for(let i of e?.c??[]){i.n===`grpSp`&&r(i);let e=En(i);e&&(e.idx!==void 0&&!t.has(e.idx)&&t.set(e.idx,i),n.has(e.type)||n.set(e.type,i))}};return r(e),{byIdx:t,byType:n}}function kn(e){let t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function An(e,t){let n=e=>String.fromCharCode(97+(e-1)%26).repeat(Math.floor((e-1)/26)+1),r=String(t);return e.startsWith(`alphaLc`)?r=n(t):e.startsWith(`alphaUc`)?r=n(t).toUpperCase():e.startsWith(`romanLc`)?r=kn(t):e.startsWith(`romanUc`)&&(r=kn(t).toUpperCase()),e.endsWith(`ParenBoth`)?`(${r})`:e.endsWith(`ParenR`)?`${r})`:e.endsWith(`Period`)?`${r}.`:e.endsWith(`Minus`)?`- ${r} -`:r}var jn=class a{constructor(e,t,n,r){w(this,`pkg`,void 0),w(this,`mainPath`,void 0),w(this,`defaultTextStyle`,void 0),w(this,`masters`,/* @__PURE__ */ new Map),w(this,`layouts`,/* @__PURE__ */ new Map),w(this,`tableStyles`,void 0),w(this,`meta`,void 0),w(this,`genMaps`,/* @__PURE__ */ new Map),w(this,`touched`,!1),w(this,`undoStack`,[]),w(this,`redoStack`,[]),w(this,`originals`,/* @__PURE__ */ new Map),w(this,`lateShapes`,/* @__PURE__ */ new Map),this.pkg=e,this.mainPath=t,this.defaultTextStyle=n,this.meta=r}static async open(e,t){let n=await e.xml(t);if(!n)throw Error(`Missing presentation part`);let r=await e.rels(t),i=D(n,`sldSz`),o=[];for(let t of O(D(n,`sldIdLst`),`sldId`)){let n=r.get(t.a[`r:id`]);n&&e.has(n.target)&&o.push({index:o.length,path:n.target,hidden:!1})}let s={w:N(A(i?.a.cx,9144e3)),h:N(A(i?.a.cy,6858e3)),count:o.length,slides:o};return new a(e,t,D(n,`defaultTextStyle`),s)}async part(e){let t=await this.pkg.xml(e,!1);if(!t)throw Error(`Missing part ${e}`);let n=k(t,`cSld`,`spTree`);return{path:e,root:t,rels:await this.pkg.rels(e),spTree:n,...On(n)}}master(e){let t=this.masters.get(e);return t||(t=(async()=>{let t=await this.part(e),n=M(t.rels,`theme`),r=Ae(n?await this.pkg.xml(n.target):void 0),i={...D(t.root,`clrMap`)?.a??{}},a=D(t.root,`txStyles`);return{...t,theme:r,clrMap:i,title:D(a,`titleStyle`),body:D(a,`bodyStyle`),other:D(a,`otherStyle`)}})(),this.masters.set(e,t)),t}layout(e){let t=this.layouts.get(e);return t||(t=(async()=>{let t=await this.part(e),n=M(t.rels,`slideMaster`);if(!n)throw Error(`Layout ${e} has no master`);let r=await this.master(n.target);return{...t,master:r,clrMap:Mn(t.root,r.clrMap)}})(),this.layouts.set(e,t)),t}getTableStyles(){return this.tableStyles||(this.tableStyles=(async()=>{let e=/* @__PURE__ */ new Map,t=M(await this.pkg.rels(this.mainPath),`tableStyles`),n=t?await this.pkg.xml(t.target):void 0;for(let t of O(n,`tblStyle`))e.set(t.a.styleId,t);return e})()),this.tableStyles}async slide(e){let t=this.meta.slides[e];if(!t)throw Error(`No slide #${e}`);let n=await this.part(t.path),r=M(n.rels,`slideLayout`),i=r?await this.layout(r.target):void 0,a=i?.master,o=a?.theme??Ae(void 0),s=Mn(n.root,i?.clrMap??a?.clrMap??{}),c=new Fn(this,n,i,a,o,s,e,await this.getTableStyles()),l=[],u=n.root.a.showMasterSp!==`0`;return a&&u&&i?.root.a.showMasterSp!==`0`&&c.walk(a,a.spTree,Nn,l,!0),i&&u&&c.walk(i,i.spTree,Nn,l,!0),c.walk(n,n.spTree,Nn,l,!1),{index:e,w:this.meta.w,h:this.meta.h,bg:c.background(),els:l,hidden:n.root.a.show===`0`}}get defaults(){return this.defaultTextStyle}async keepOriginal(e){this.originals.has(e)||this.originals.set(e,await this.pkg.text(e))}genMap(e,t){return this.genMaps.get(`${e}#${t}`)}get dirty(){return this.genMaps.size>0||this.touched}async setText(a,c,l){let u=this.meta.slides[a];if(!u)throw Error(`No slide #${a}`);let p=u.path;await this.keepOriginal(p);let m=t(await this.pkg.text(p)),g=vn(m,c),_=`${p}#${c}`;g&&!this.lateShapes.has(_)&&!vn(t(this.originals.get(p)),c)&&this.lateShapes.set(_,n([g]));let v=this.lateShapes.get(_),y=v?t(v)[0]:vn(t(this.originals.get(p)),c);if(!g||!y)throw Error(`Shape ${c} not found`);let b=s(g,`txBody`),x=s(y,`txBody`),S=o(x,`p`),C=i(g.q),w=i((s(x,`bodyPr`)??S[0])?.q??`a:x`)||`a:`;b||(b=d(C+`txBody`,{},[d(w+`bodyPr`),d(w+`lstStyle`)]),g.c.push(b),g.self=!1);let T=S.map(e=>o(e).filter(e=>[`r`,`br`,`fld`].includes(r(e.q)))),ee=[],E=l.map(e=>{let t=e.k===void 0?S[S.length-1]:S[e.k],n=d(w+`p`),r=s(t,`pPr`),i=e.algn||e.lvl!==void 0||e.bullet||e.lnPct,a=r?f(r):i?d(w+`pPr`):void 0;a&&i&&Sn(a,e,w),a&&n.c.push(a);let o=s(t,`endParaRPr`),c={k:e.k,runs:[]},l=e=>{let t=s(e?T[e[0]]?.[e[1]]:void 0,`rPr`)??(o?{...f(o),q:w+`rPr`}:void 0);return t?f(t):d(w+`rPr`,{lang:`en-US`,dirty:`0`})};for(let t of e.runs)if(t.fld&&t.src){let e=T[t.src[0]]?.[t.src[1]];e&&(n.c.push(f(e)),c.runs.push(t.src))}else t.text.split(`\n`).forEach((e,r)=>{let i=l(t.src);t.set&&yn(i,t.set,w),r>0&&(n.c.push(d(w+`br`,{},[{...f(i)}])),c.runs.push(t.src)),e&&(n.c.push(d(w+`r`,{},[i,d(w+`t`,{},[h(e)])])),c.runs.push(t.src))});return n.c.push(o?f(o):d(w+`endParaRPr`,{lang:`en-US`,dirty:`0`})),n.self=!1,ee.push(c),n}),te=b.c.filter(t=>!(e(t)&&r(t.q)===`p`));return b.c=[...te,...E],b.self=!1,this.pkg.setPart(p,n(m)),this.genMaps.set(`${p}#${c}`,ee),this.undoStack=this.undoStack.filter(e=>e.path!==p),this.redoStack=this.redoStack.filter(e=>e.path!==p),this.slide(a)}save(){return this.pkg.save(`application/vnd.openxmlformats-officedocument.presentationml.presentation`)}};function Mn(e,t){let n=k(e,`clrMapOvr`,`overrideClrMapping`);return n?{...n.a}:t}const Nn=e=>e;function Pn(e){if(!e)return;let t=D(e,`off`),n=D(e,`ext`);if(!t&&!n)return;let r={x:N(A(t?.a.x,0)),y:N(A(t?.a.y,0)),w:N(A(n?.a.cx,0)),h:N(A(n?.a.cy,0))},i=A(e.a.rot);return i&&(r.rot=i/6e4),e.a.flipH===`1`&&(r.flipH=!0),e.a.flipV===`1`&&(r.flipV=!0),r}var Fn=class{constructor(e,t,n,r,i,a,o,s){w(this,`pres`,void 0),w(this,`slide`,void 0),w(this,`layout`,void 0),w(this,`master`,void 0),w(this,`theme`,void 0),w(this,`clrMap`,void 0),w(this,`index`,void 0),w(this,`tableStyles`,void 0),this.pres=e,this.slide=t,this.layout=n,this.master=r,this.theme=i,this.clrMap=a,this.index=o,this.tableStyles=s}cc(e){return{theme:this.theme,clrMap:this.clrMap,phClr:e}}font(e){if(e)return e.startsWith(`+mj`)?Le(this.theme.major):e.startsWith(`+mn`)?Le(this.theme.minor):Le(e)}fill(e,t,n){if(e)for(let r of e.c)switch(r.n){case`noFill`:return{t:`none`};case`solidFill`:{let e=F(r,this.cc(n));return e?{t:`solid`,c:e}:void 0}case`gradFill`:{let e=O(D(r,`gsLst`),`gs`).map(e=>({pos:A(e.a.pos,0)/1e3|0,col:F(e,this.cc(n))})).filter(e=>e.col).sort((e,t)=>e.pos-t.pos);if(!e.length)return;if(e.length===1)return{t:`solid`,c:e[0].col};let t=e.map(e=>`${e.col} ${e.pos}%`).join(`, `);return D(r,`path`)?{t:`grad`,css:`radial-gradient(circle, ${t})`}:{t:`grad`,css:`linear-gradient(${(A(D(r,`lin`)?.a.ang,0)/6e4+90)%360}deg, ${t})`}}case`blipFill`:{let e=D(r,`blip`)?.a[`r:embed`],n=e?t.get(e):void 0;return n&&!n.external?{t:`img`,target:n.target,tile:!!D(r,`tile`)}:void 0}case`pattFill`:{let e=F(D(r,`fgClr`),this.cc(n));return e?{t:`solid`,c:e}:void 0}}}themeFill(e,t){if(!e)return;let n=A(e.a.idx,0);if(!n)return;let r=F(e,this.cc()),i=(n>=1001?this.theme.bgFillStyles:this.theme.fillStyles)[n>=1001?n-1001:n-1];return i?this.fill({n:`x`,a:{},c:[i],t:``},t,r)??(r?{t:`solid`,c:r}:void 0):r?{t:`solid`,c:r}:void 0}stroke(e,t){let n=A(t?.a.idx,0),r=n?this.theme.lineStyles[n-1]:void 0,i=t?F(t,this.cc()):void 0;if(e&&D(e,`noFill`))return;let a=e?F(D(e,`solidFill`),this.cc(i)):void 0;if(!a&&e){let t=k(e,`gradFill`,`gsLst`,`gs`);t&&(a=F(t,this.cc(i)))}if(!a&&n&&(a=i??(r?F(D(r,`solidFill`),this.cc(i)):void 0)),!a)return;let o=A(e?.a.w)??A(r?.a.w)??9525,s=D(e,`prstDash`)?.a.val??D(r,`prstDash`)?.a.val,c={c:a,w:Math.max(.5,N(o))};s&&wn[s]&&(c.dash=wn[s].split(` `).map(e=>+(Number(e)*c.w).toFixed(2)).join(` `));let l=D(e,`headEnd`)?.a.type,u=D(e,`tailEnd`)?.a.type;return l&&l!==`none`&&(c.head=l),u&&u!==`none`&&(c.tail=u),c}background(){for(let e of[this.slide,this.layout,this.master]){if(!e)continue;let t=k(e.root,`cSld`,`bg`);if(!t)continue;let n=D(t,`bgPr`);if(n){let t=this.fill(n,e.rels);if(t)return t}let r=D(t,`bgRef`);if(r)return this.themeFill(r,e.rels)}return{t:`solid`,c:this.theme.colors[this.clrMap.bg1??`lt1`]??`#ffffff`}}readRun(e,t={}){if(!e)return t;let n=e.a;n.sz&&(t.sz=Number(n.sz)/100),n.b!==void 0&&(t.b=n.b===`1`||n.b===`true`),n.i!==void 0&&(t.i=n.i===`1`||n.i===`true`),n.u!==void 0&&(t.u=n.u!==`none`),n.strike!==void 0&&(t.strike=n.strike!==`noStrike`),n.baseline!==void 0&&(t.baseline=Number(n.baseline)/1e3),n.cap!==void 0&&(t.caps=n.cap===`all`);let r=D(e,`solidFill`);if(r){let e=F(r,this.cc());e&&(t.color=e)}else{let n=k(e,`gradFill`,`gsLst`,`gs`),r=n&&F(n,this.cc());r&&(t.color=r)}let i=F(D(e,`highlight`),this.cc());i&&(t.hl=i);let a=D(e,`latin`)?.a.typeface??D(e,`ea`)?.a.typeface,o=this.font(a);return o&&(t.font=o),t}readLvl(e,t){let n={...t,r:{...t.r}};if(!e)return n;let r=e.a;r.algn&&(n.algn=Cn[r.algn]??`left`),r.marL!==void 0&&(n.marL=N(Number(r.marL))),r.indent!==void 0&&(n.indent=N(Number(r.indent)));for(let t of e.c)switch(t.n){case`lnSpc`:{let e=A(D(t,`spcPct`)?.a.val),r=A(D(t,`spcPts`)?.a.val);e===void 0?r!==void 0&&(n.lnPts=r/100,n.lnPct=void 0):(n.lnPct=e/1e5,n.lnPts=void 0);break}case`spcBef`:case`spcAft`:{let e=A(D(t,`spcPct`)?.a.val),r=A(D(t,`spcPts`)?.a.val),i=e===void 0?{pts:(r??0)/100}:{pct:e/1e5};t.n===`spcBef`?n.bef=i:n.aft=i;break}case`buNone`:n.bu={kind:`none`};break;case`buChar`:n.bu={kind:`char`,char:t.a.char??`•`};break;case`buAutoNum`:n.bu={kind:`auto`,autoType:t.a.type??`arabicPeriod`,startAt:A(t.a.startAt,1)};break;case`buClr`:n.buClr=F(t,this.cc());break;case`buFont`:n.buFont=t.a.typeface;break;case`buSzPct`:n.buSzPct=A(t.a.val,1e5)/1e5;break;case`defRPr`:this.readRun(t,n.r)}return n}levels(e){let t=[];for(let n=1;n<=9;n++){let r={r:{}};for(let t of e)t&&(r=this.readLvl(D(t,`defPPr`),r),r=this.readLvl(D(t,`lvl${n}pPr`),r));t.push(r)}return t}textBody(e,t,n,r,i,a){if(!e)return;let o=O(e,`p`),s=!o.some(e=>e.c.some(e=>e.n===`r`||e.n===`fld`));if(s&&a===void 0)return;let c=a===void 0?void 0:this.pres.genMap(this.slide.path,a),l=this.master,u;if(n){let e=Dn(n.type);u=e===`title`?l?.title:e===`body`?l?.body:l?.other}let d=n?[u]:[l?.other,this.pres.defaults];if(r){let e=F(r,this.cc()),t=r.a.idx===`major`?this.theme.major:r.a.idx===`minor`?this.theme.minor:void 0,n={n:`lstStyle`,a:{},c:[],t:``},i={n:`defRPr`,a:{},c:[],t:``};e&&i.c.push({n:`solidFill`,a:{},c:[{n:`srgbClr`,a:{val:e.replace(`#`,``).slice(0,6)},c:[],t:``}],t:``}),t&&i.c.push({n:`latin`,a:{typeface:t},c:[],t:``}),n.c.push({n:`defPPr`,a:{},c:[i],t:``}),d.push(n)}for(let e of t)d.push(k(e,`txBody`,`lstStyle`));let f=this.levels(d),p={},m;for(let e of t){let t=k(e,`txBody`,`bodyPr`);if(!t)continue;Object.assign(p,t.a);let n=D(t,`normAutofit`);n&&(m=n)}let h=m?A(m.a.fontScale,1e5)/1e5:1,g=m?A(m.a.lnSpcReduction,0)/1e5:0,_=[N(A(p.lIns,91440)),N(A(p.tIns,45720)),N(A(p.rIns,91440)),N(A(p.bIns,45720))],v=[],y=i?.rels??this.slide.rels,b=o.map((e,t)=>{let n=D(e,`pPr`),r=Math.min(8,A(n?.a.lvl,0)),i=this.readLvl(n,f[r]),a=[],o=0;for(let n of e.c){let e=n.n===`r`||n.n===`fld`||n.n===`br`?c?c[t]?.runs[o++]:[t,o++]:void 0;if(n.n===`r`||n.n===`fld`){let t=this.readRun(D(n,`rPr`),{...i.r}),r=ye(D(n,`t`));n.n===`fld`&&n.a.type===`slidenum`&&(r=String(this.index+1));let o=k(n,`rPr`,`hlinkClick`)?.a[`r:id`],s=o?y.get(o)?.target:void 0;a.push({text:r,sz:(t.sz??18)*h,b:t.b,i:t.i,u:t.u||!!s,strike:t.strike,color:t.color??(s?this.theme.colors.hlink:void 0),font:t.font,baseline:t.baseline,caps:t.caps,href:s,hl:t.hl,src:e,...n.n===`fld`?{fld:!0}:{}})}else if(n.n===`br`){let t=this.readRun(D(n,`rPr`),{...i.r});a.push({text:``,br:!0,sz:(t.sz??18)*h,src:e})}}let s=this.readRun(D(e,`endParaRPr`),{...i.r}),l=a[0]?.sz??(s.sz??18)*h,u=a.some(e=>e.text),d;if(i.bu&&i.bu.kind!==`none`&&u){let e=l*(i.buSzPct??1),t=i.buClr??a[0]?.color??i.r.color;if(i.bu.kind===`char`)d={text:i.bu.char??`•`,sz:e,color:t,font:i.buFont?this.font(i.buFont):void 0};else{v[r]=(v[r]??(i.bu.startAt??1)-1)+1;for(let e=r+1;e<9;e++)v[e]=void 0;d={text:An(i.bu.autoType??`arabicPeriod`,v[r]),sz:e,color:t}}}else if(!i.bu||i.bu.kind===`none`)for(let e=r;e<9;e++)v[e]=void 0;let p=e=>e?e.pts===void 0?(e.pct??0)*l*1.2*(4/3):e.pts*4/3:0;return{algn:i.algn??`left`,marL:i.marL??0,indent:i.indent??0,lnPct:i.lnPct===void 0?g?1-g:void 0:i.lnPct*(1-g),lnPx:i.lnPts===void 0?void 0:i.lnPts*4/3,spcBef:p(i.bef),spcAft:p(i.aft),bullet:d,lvl:r||void 0,buKind:i.bu?.kind===`char`?`bullet`:i.bu?.kind===`auto`?`number`:void 0,runs:a,endSz:(s.sz??18)*h,k:c?c[t]?.k:t}});return{anchor:p.anchor===`ctr`?`ctr`:p.anchor===`b`?`b`:`t`,ins:_,wrap:p.wrap!==`none`,vert:p.vert&&p.vert!==`horz`?p.vert:void 0,paras:b,empty:s||void 0}}inheritChain(e,t){let n=En(e);if(!n)return{chain:[e]};let r=[],i=Dn(n.type);if(t===this.slide){let e=this.layout?(n.idx===void 0?void 0:this.layout.byIdx.get(n.idx))??this.layout.byType.get(n.type):void 0,t=e?En(e)?.type??i:i,a=this.master?.byType.get(Dn(t))??this.master?.byType.get(i);a&&r.push(a),e&&r.push(e)}else if(t===this.layout){let e=this.master?.byType.get(i);e&&r.push(e)}return r.push(e),{chain:r,ph:n}}walk(e,t,n,r,i,a){if(t)for(let o of t.c){if(i&&(o.n===`sp`||o.n===`pic`)&&En(o))continue;let t=D(o.c[0],`cNvPr`)?.a.id,s=a??(e===this.slide&&t?Number(t):void 0),c=r.length;try{switch(o.n){case`sp`:case`cxnSp`:this.shape(o,e,n,r);break;case`pic`:this.pic(o,e,n,r);break;case`grpSp`:this.group(o,e,n,r,i,s);break;case`graphicFrame`:this.frame(o,e,n,r)}}catch{}if(s!==void 0)for(let e=c;e<r.length;e++)r[e].top=s}}boxOf(e,t,n){for(let r=e.length-1;r>=0;r--){let i=Pn(k(e[r],...t));if(i)return n(i)}}shape(e,t,n,r){let{chain:i,ph:a}=this.inheritChain(e,t),o=this.boxOf(i,[`spPr`,`xfrm`],n);if(!o)return;let s=D(e,`style`),c;for(let e=i.length-1;e>=0&&!c;e--)c=this.fill(D(i[e],`spPr`),t.rels);!c&&s&&(c=this.themeFill(D(s,`fillRef`),t.rels));let l;for(let e=i.length-1;e>=0&&!l;e--)l=k(i[e],`spPr`,`ln`);let u=this.stroke(l,D(s,`lnRef`)),d=`rect`,f,p;for(let e=i.length-1;e>=0;e--){let t=k(i[e],`spPr`,`prstGeom`);if(t){d=t.a.prst??`rect`;let e=O(D(t,`avLst`),`gd`);if(e.length){f={};for(let t of e){let e=/val\\s+(-?\\d+)/.exec(t.a.fmla??``);e&&(f[t.a.name]=Number(e[1]))}}break}let n=k(i[e],`spPr`,`custGeom`);if(n){d=`custom`,p=Rn(n,o);break}}e.n===`cxnSp`&&d===`rect`&&(d=`line`);let m=k(e,`nvSpPr`,`cNvPr`)?.a.id,h=t===this.slide&&e.n===`sp`&&m?Number(m):void 0,g=e.n===`sp`?this.textBody(D(e,`txBody`),i,a,D(s,`fontRef`),t,h):void 0;(c&&c.t!==`none`||u||g)&&r.push({t:`shape`,box:o,geom:d,adj:f,fill:c,stroke:u,text:g,path:p,sid:h})}pic(e,t,n,r){let{chain:i}=this.inheritChain(e,t),a=this.boxOf(i,[`spPr`,`xfrm`],n);if(!a)return;let o=D(e,`blipFill`),s=D(o,`blip`)?.a[`r:embed`],c=s?t.rels.get(s):void 0,l=D(o,`srcRect`),u=l?[A(l.a.l,0)/1e5,A(l.a.t,0)/1e5,A(l.a.r,0)/1e5,A(l.a.b,0)/1e5]:void 0,d=!!D(Tn(e),`videoFile`)||!!D(Tn(e),`audioFile`);r.push({t:`pic`,box:a,target:c&&!c.external?c.target:void 0,crop:u&&u.some(e=>e!==0)?u:void 0,stroke:this.stroke(k(e,`spPr`,`ln`),k(e,`style`,`lnRef`)),geom:k(e,`spPr`,`prstGeom`)?.a.prst,video:d})}group(e,t,n,r,i,a){let o=k(e,`grpSpPr`,`xfrm`),s=D(o,`off`),c=D(o,`ext`),l=D(o,`chOff`),u=D(o,`chExt`);if(!s||!c)return this.walk(t,e,n,r,i,a);let d=N(A(s.a.x,0)),f=N(A(s.a.y,0)),p=N(A(l?.a.x,0)),m=N(A(l?.a.y,0)),h=u&&A(u.a.cx)?A(c.a.cx,0)/A(u.a.cx,1):1,g=u&&A(u.a.cy)?A(c.a.cy,0)/A(u.a.cy,1):1;this.walk(t,e,e=>n({...e,x:d+(e.x-p)*h,y:f+(e.y-m)*g,w:e.w*h,h:e.h*g}),r,i,a)}frame(e,t,n,r){let i=Pn(D(e,`xfrm`));if(!i)return;let a=n(i),o=k(e,`graphic`,`graphicData`);if(!o)return;let s=D(o,`tbl`);if(s)return void r.push(this.table(s,a,t));let c=D(D(o,`oleObj`),`pic`);if(c){let e=k(c,`blipFill`,`blip`)?.a[`r:embed`],n=e?t.rels.get(e):void 0;r.push({t:`pic`,box:a,target:n?.target});return}let l=o.a.uri??``,u=l.includes(`chart`)?`Chart`:l.includes(`diagram`)?`SmartArt`:l.includes(`ole`)?`Embedded object`:`Object`;r.push({t:`placeholder`,box:a,label:u})}table(e,t,n){let r=O(D(e,`tblGrid`),`gridCol`).map(e=>N(A(e.a.w,0))),i=D(e,`tblPr`),a=e=>i?.a[e]===`1`||i?.a[e]===`true`,o=D(i,`tableStyleId`)?.t.trim(),s=o?this.tableStyles.get(o):void 0,c=O(e,`tr`),l=c.length,u=r.length,d=this.fill(i,n.rels),f=(e,t)=>{let n=[],r=e=>{let t=D(s,e);t&&n.push(t)};r(`wholeTbl`);let i=e-+!!a(`firstRow`);a(`bandRow`)&&i>=0&&r(i%2==0?`band1H`:`band2H`);let o=t-+!!a(`firstCol`);return a(`bandCol`)&&o>=0&&r(o%2==0?`band1V`:`band2V`),a(`firstCol`)&&t===0&&r(`firstCol`),a(`lastCol`)&&t===u-1&&r(`lastCol`),a(`lastRow`)&&e===l-1&&r(`lastRow`),a(`firstRow`)&&e===0&&r(`firstRow`),n},p=!s&&o?In(this.theme,a(`firstRow`),a(`bandRow`)):void 0;return{t:`table`,box:t,cols:r,rows:c.map((e,t)=>{let r=O(e,`tc`).map((e,r)=>{let i=D(e,`tcPr`),a,o,s,c={};for(let e of f(t,r)){let t=D(e,`tcStyle`),r=this.fill(D(t,`fill`),n.rels)??this.themeFill(D(t,`fillRef`),n.rels);r&&(a=r);let i=D(t,`tcBdr`);for(let e of i?.c??[]){let t=this.stroke(D(e,`ln`),D(e,`lnRef`));c[e.n]=t}let l=D(e,`tcTxStyle`);if(l){l.a.b&&(o=l.a.b===`on`);let e=F(l,this.cc())??F(D(l,`fontRef`),this.cc());e&&(s=e)}}if(p){let e=p(t);a=e.fill,e.color&&(s=e.color),e.bold&&(o=!0),c.insideH=c.insideV={c:`#ffffff`,w:1}}let m=this.fill(i,n.rels);m&&(a=m);let h=(e,t,n,r)=>{let a=D(i,e);return a?this.stroke(a,void 0):r?c[t]:c[n]??c[t]},g=D(e,`txBody`),_=this.textBody(g,g?[e]:[],void 0,void 0,n);if(_){if(_.ins=[N(A(i?.a.marL,91440)),N(A(i?.a.marT,45720)),N(A(i?.a.marR,91440)),N(A(i?.a.marB,45720))],_.anchor=i?.a.anchor===`ctr`?`ctr`:i?.a.anchor===`b`?`b`:`t`,o!==void 0||s)for(let e of _.paras)for(let t of e.runs)o&&t.b===void 0&&(t.b=!0),s&&!t.color&&(t.color=s)}else _=void 0;return{text:_,fill:a??d,bl:h(`lnL`,`left`,`insideV`,r===0),br:h(`lnR`,`right`,`insideV`,r===u-1),bt:h(`lnT`,`top`,`insideH`,t===0),bb:h(`lnB`,`bottom`,`insideH`,t===l-1),colSpan:A(e.a.gridSpan,1),rowSpan:A(e.a.rowSpan,1),hidden:e.a.hMerge===`1`||e.a.vMerge===`1`||e.a.hMerge===`true`||e.a.vMerge===`true`}});return{h:N(A(e.a.h,0)),cells:r}})}}};function In(e,t,n){let r=e.colors.accent1??`#4472c4`;return e=>{if(t&&e===0)return{fill:{t:`solid`,c:r},color:`#ffffff`,bold:!0};let i=e-+!!t,a=n&&i%2==0?.6:.8;return{fill:{t:`solid`,c:Ln(r,`#ffffff`,a)}}}}function Ln(e,t,n){let r=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),i=[1,3,5].map(e=>parseInt(t.slice(e,e+2),16));return`#`+r.map((e,t)=>Math.round(e+(i[t]-e)*n).toString(16).padStart(2,`0`)).join(``)}function Rn(e,t){let n=O(D(e,`pathLst`),`path`),r=``;for(let e of n){let n=A(e.a.w)||1,i=A(e.a.h)||1,a=t.w/n,o=t.h/i,s=e=>`${(A(e?.a.x,0)*a).toFixed(2)} ${(A(e?.a.y,0)*o).toFixed(2)}`,c=0,l=0;for(let t of e.c){let e=O(t,`pt`);switch(t.n){case`moveTo`:r+=`M${s(e[0])} `,c=A(e[0]?.a.x,0)*a,l=A(e[0]?.a.y,0)*o;break;case`lnTo`:r+=`L${s(e[0])} `,c=A(e[0]?.a.x,0)*a,l=A(e[0]?.a.y,0)*o;break;case`cubicBezTo`:r+=`C${e.map(s).join(` `)} `,c=A(e[2]?.a.x,0)*a,l=A(e[2]?.a.y,0)*o;break;case`quadBezTo`:r+=`Q${e.map(s).join(` `)} `,c=A(e[1]?.a.x,0)*a,l=A(e[1]?.a.y,0)*o;break;case`arcTo`:{let e=A(t.a.wR,0)*a,n=A(t.a.hR,0)*o,i=A(t.a.stAng,0)/6e4*(Math.PI/180),s=A(t.a.swAng,0)/6e4*(Math.PI/180),u=c-e*Math.cos(i),d=l-n*Math.sin(i),f=u+e*Math.cos(i+s),p=d+n*Math.sin(i+s);r+=`A${e.toFixed(2)} ${n.toFixed(2)} 0 ${+(Math.abs(s)>Math.PI)} ${+(s>0)} ${f.toFixed(2)} ${p.toFixed(2)} `,c=f,l=p;break}case`close`:r+=`Z `}}}return r.trim()||void 0}var zn=class{constructor(e,t){w(this,`blob`,void 0),w(this,`name`,void 0),w(this,`size`,void 0),this.blob=e,this.name=t,this.size=e.size}async read(e,t){return new Uint8Array(await this.blob.slice(e,e+t).arrayBuffer())}stream(e,t){return this.blob.slice(e,e+t).stream()}slice(e,t){return this.blob.slice(e,e+t)}},Bn=class{constructor(e,t){w(this,`name`,void 0),w(this,`size`,void 0),w(this,`bytes`,void 0),this.name=t,this.bytes=e instanceof Uint8Array?e:new Uint8Array(e),this.size=this.bytes.byteLength}async read(e,t){return this.bytes.subarray(e,e+t)}stream(e,t){let n=this.bytes,r=Math.min(e+t,n.byteLength),i=e;return new ReadableStream({pull(e){if(i>=r)return e.close();let t=Math.min(i+1048576,r);e.enqueue(n.slice(i,t)),i=t}})}},Vn=class e{constructor(e,t,n,r){w(this,`url`,void 0),w(this,`size`,void 0),w(this,`opts`,void 0),w(this,`name`,void 0),w(this,`cache`,/* @__PURE__ */ new Map),w(this,`inflight`,/* @__PURE__ */ new Map),w(this,`blockSize`,void 0),w(this,`maxBlocks`,void 0),this.url=e,this.size=t,this.opts=n,this.name=r,this.blockSize=n.blockSize??262144,this.maxBlocks=n.maxBlocks??128}static async open(t,n={}){let r=decodeURIComponent(t.split(/[?#]/)[0].split(`/`).pop()||``)||void 0,i={headers:{...n.headers},credentials:n.credentials,signal:n.signal},a=-1;try{let o=await fetch(t,{...i,headers:{...n.headers,Range:`bytes=0-0`}});if(o.status===206){let s=o.headers.get(`Content-Range`),c=s&&/\\/(\\d+)\\s*$/.exec(s);if(c&&(a=Number(c[1])),await o.body?.cancel(),a<0){let e=await fetch(t,{...i,method:`HEAD`}),n=e.headers.get(`Content-Length`);e.ok&&n&&(a=Number(n))}if(a>0)return new e(t,a,n,r)}else if(o.ok)return new zn(await Hn(o,n.onProgress),r)}catch(e){if(e?.name===`AbortError`)throw e}let o=await fetch(t,i);if(!o.ok)throw Error(`HTTP ${o.status} while fetching ${t}`);return new zn(await Hn(o,n.onProgress),r)}async fetchRange(e,t){let n=await fetch(this.url,{headers:{...this.opts.headers,Range:`bytes=${e}-${t-1}`},credentials:this.opts.credentials,signal:this.opts.signal});if(n.status!==206&&!n.ok)throw Error(`HTTP ${n.status} (range ${e}-${t-1})`);let r=new Uint8Array(await n.arrayBuffer());return n.status===206?r:r.subarray(e,t)}async ensureBlocks(e,t){let n=[],r=-1,i=e=>{if(r<0)return;let t=r,i=e,a=this.fetchRange(t*this.blockSize,Math.min((i+1)*this.blockSize,this.size)).then(e=>{for(let n=t;n<=i;n++){let r=(n-t)*this.blockSize;this.cache.set(n,e.subarray(r,Math.min(r+this.blockSize,e.length))),this.inflight.delete(n)}this.evict()});for(let e=t;e<=i;e++)this.inflight.set(e,a);n.push(a),r=-1};for(let a=e;a<=t;a++)if(this.cache.has(a)){i(a-1);let e=this.cache.get(a);this.cache.delete(a),this.cache.set(a,e)}else this.inflight.has(a)?(i(a-1),n.push(this.inflight.get(a))):r<0&&(r=a);i(t),await Promise.all(n)}evict(){for(;this.cache.size>this.maxBlocks;){let e=this.cache.keys().next().value;this.cache.delete(e)}}async read(e,t){let n=Math.min(e+t,this.size);if(n<=e)return/* @__PURE__ */ new Uint8Array;if(n-e>this.maxBlocks*this.blockSize/2)return this.fetchRange(e,n);let r=this.blockSize,i=Math.floor(e/r),a=Math.floor((n-1)/r);await this.ensureBlocks(i,a);let o=new Uint8Array(n-e);for(let t=i;t<=a;t++){let i=this.cache.get(t);if(!i)throw Error(`range block evicted before use`);let a=t*r,s=Math.max(e,a),c=Math.min(n,a+i.length);o.set(i.subarray(s-a,c-a),s-e)}return o}stream(e,t){if(t>2*this.blockSize){let{url:n,opts:r}=this,i;return new ReadableStream({async start(){let a=await fetch(n,{headers:{...r.headers,Range:`bytes=${e}-${e+t-1}`},credentials:r.credentials,signal:r.signal});if(a.status!==206)throw Error(`Range request not honoured (HTTP ${a.status})`);i=a.body.getReader()},async pull(e){let{done:t,value:n}=await i.read();t?e.close():e.enqueue(n)},cancel(){return i?.cancel()}})}let n=e,r=e+t;return new ReadableStream({pull:async e=>{if(n>=r)return e.close();let t=Math.min(this.blockSize,r-n);e.enqueue(await this.read(n,t)),n+=t}})}};async function Hn(e,t){let n=Number(e.headers.get(`Content-Length`)||0);if(!e.body||!t)return e.blob();let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a,n)}return new Blob(i)}async function Un(e,t={}){if(typeof e==`string`||e instanceof URL)return Vn.open(String(e),t);if(e instanceof Uint8Array||e instanceof ArrayBuffer)return new Bn(e,t.name);if(typeof Blob<`u`&&e instanceof Blob)return new zn(e,t.name??e.name);throw Error(`Unsupported document source`)}const Wn=[`#NULL!`,`#DIV/0!`,`#VALUE!`,`#REF!`,`#NAME?`,`#NUM!`,`#N/A`];var I=class{constructor(e){w(this,`code`,void 0),this.code=e}toString(){return this.code}};const Gn=1048575,Kn=16383,L={DIV0:new I(`#DIV/0!`),VALUE:new I(`#VALUE!`),REF:new I(`#REF!`),NAME:new I(`#NAME?`),NA:new I(`#N/A`),NUM:new I(`#NUM!`),NULL:new I(`#NULL!`)};function qn(e){let t=``,n=e+1;for(;n>0;){let e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-1)/26)}return t}function Jn(e){let t=0,n=e.toUpperCase();for(let e=0;e<n.length;e++)t=t*26+(n.charCodeAt(e)-64);return t-1}function Yn(e,t){return e===void 0||t===void 0?e===t:e.toLowerCase()===t.toLowerCase()}function Xn(e){return/^[A-Za-z_\\u00A1-\\uFFFF][\\w.\\u00A1-\\uFFFF]*$/.test(e)&&!/^[A-Za-z]{1,3}\\d+$/.test(e)&&!/^(R\\d*C?\\d*|C\\d*)$/i.test(e)&&!/^(TRUE|FALSE)$/i.test(e)?e:`\'${e.replace(/\'/g,`\'\'`)}\'`}const Zn=(e,t,n,r)=>`${r?`$`:``}${qn(t)}${n?`$`:``}${e+1}`;function Qn(e,t){let n=e.sheet===void 0?``:`${t??Xn(e.sheet)}!`;switch(e.kind){case`cell`:return n+Zn(e.r0,e.c0,e.ar0,e.ac0);case`area`:return`${n}${Zn(e.r0,e.c0,e.ar0,e.ac0)}:${Zn(e.r1,e.c1,e.ar1,e.ac1)}`;case`cols`:return`${n}${e.ac0?`$`:``}${qn(e.c0)}:${e.ac1?`$`:``}${qn(e.c1)}`;case`rows`:return`${n}${e.ar0?`$`:``}${e.r0+1}:${e.ar1?`$`:``}${e.r1+1}`}}function $n(e){return e.r0>e.r1&&([e.r0,e.r1]=[e.r1,e.r0],[e.ar0,e.ar1]=[e.ar1,e.ar0]),e.c0>e.c1&&([e.c0,e.c1]=[e.c1,e.c0],[e.ac0,e.ac1]=[e.ac1,e.ac0]),e}function er(e){return e.r0>=0&&e.c0>=0&&e.r1<=1048575&&e.c1<=16383&&e.r1>=0&&e.c1>=0}var R=class extends Error{constructor(e,t){super(e),w(this,`pos`,void 0),this.pos=t,this.name=`FormulaSyntaxError`}};const tr=[[`#DIV/0!`,`#DIV/0!`],[`#VALUE!`,`#VALUE!`],[`#REF!`,`#REF!`],[`#NAME?`,`#NAME?`],[`#N/A`,`#N/A`],[`#NUM!`,`#NUM!`],[`#NULL!`,`#NULL!`]],nr=/[\\w.$\\\\\\u00A1-\\uFFFF]/,rr=/(\\$?)([A-Za-z]{1,3})(\\$?)(\\d+):(\\$?)([A-Za-z]{1,3})(\\$?)(\\d+)/y,ir=/(\\$?)([A-Za-z]{1,3})(\\$?)(\\d+)/y,ar=/(\\$?)([A-Za-z]{1,3}):(\\$?)([A-Za-z]{1,3})/y,or=/(\\$?)(\\d+):(\\$?)(\\d+)/y,sr=/(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?/y,cr=[`_XLFN.`,`_XLWS.`,`_XLUDF.`];function lr(e,t,n){return e.lastIndex=n,e.exec(t)}const ur=e=>e!==void 0&&nr.test(e);function dr(e){let t=Number(e)-1;return t>=0&&t<=1048575?t:-1}function fr(e){let t=Jn(e);return t<=16383?t:-1}function pr(e,t){let n,r=null;if(n=lr(rr,e,t)){let[e,t,i,a]=[dr(n[4]),fr(n[2]),dr(n[8]),fr(n[6])];e>=0&&t>=0&&i>=0&&a>=0&&(r={kind:`area`,r0:e,c0:t,r1:i,c1:a,ac0:!!n[1],ar0:!!n[3],ac1:!!n[5],ar1:!!n[7]})}if(!r&&(n=lr(ir,e,t))){let[e,t]=[dr(n[4]),fr(n[2])];e>=0&&t>=0&&(r={kind:`cell`,r0:e,c0:t,r1:e,c1:t,ac0:!!n[1],ar0:!!n[3],ac1:!!n[1],ar1:!!n[3]})}if(!r&&(n=lr(ar,e,t))){let[e,t]=[fr(n[2]),fr(n[4])];e>=0&&t>=0&&(r={kind:`cols`,r0:0,c0:e,r1:Gn,c1:t,ac0:!!n[1],ar0:!1,ac1:!!n[3],ar1:!1})}if(!r&&(n=lr(or,e,t))){let[e,t]=[dr(n[2]),dr(n[4])];e>=0&&t>=0&&(r={kind:`rows`,r0:e,c0:0,r1:t,c1:Kn,ac0:!1,ar0:!!n[1],ac1:!1,ar1:!!n[3]})}if(!r||!n)return null;let i=t+n[0].length,a=e[i];return ur(a)||a===`(`||a===`!`?null:{ref:$n(r),end:i}}function mr(e,t){let n=e.slice(t,t+7).toUpperCase();for(let[e,r]of tr)if(n.startsWith(e))return[r,t+e.length];return null}function hr(e){let t=e.toUpperCase();for(let e=!0;e;){e=!1;for(let n of cr)t.startsWith(n)&&(t=t.slice(n.length),e=!0)}return t}function gr(e){let t=[],n=e.length,r=0,i=(r,i,a,o)=>{if(e[i]===`#`){let n=mr(e,i);if(!n)throw new R(`bad error literal`,i);return t.push({t:`err`,v:n[0],sheet:a,s:r,e:n[1]}),n[1]}let s=pr(e,i);if(s)return s.ref.sheet=a,t.push({t:`ref`,ref:s.ref,sheetText:o,s:r,e:s.end}),s.end;let c=i;for(;c<n&&ur(e[c]);)c++;if(c===i)throw new R(`expected reference after !`,i);return t.push({t:`name`,v:e.slice(i,c),sheet:a,s:r,e:c}),c};for(;r<n;){let a=e[r],o=r;if(a===` `||a===`\n`||a===`\\r`||a===` `||a===`\\xA0`){for(;r<n&&/[\\s\\u00A0]/.test(e[r]);)r++;t.push({t:`ws`,s:o,e:r});continue}if(a===`"`){let i=``;for(r++;;){if(r>=n)throw new R(`unterminated string`,o);if(e[r]===`"`){if(e[r+1]===`"`){i+=`"`,r+=2;continue}r++;break}i+=e[r++]}t.push({t:`str`,v:i,s:o,e:r});continue}if(a===`#`){let n=mr(e,r);if(!n)throw new R(`bad error literal`,r);t.push({t:`err`,v:n[0],s:o,e:n[1]}),r=n[1];continue}if(a===`\'`){let t=``,a=r+1;for(;;){if(a>=n)throw new R(`unterminated sheet name`,o);if(e[a]===`\'`){if(e[a+1]===`\'`){t+=`\'`,a+=2;continue}break}t+=e[a++]}if(e[a+1]!==`!`)throw new R(`expected \'!\' after sheet name`,a+1);r=i(o,a+2,t,e.slice(r,a+1));continue}if(a===`[`){let t=/\\[\\d+\\][\\w.\\u00A1-\\uFFFF]+!/y;if(t.lastIndex=r,!t.exec(e))throw new R(`unexpected \'[\'`,r);let n=t.lastIndex-1,a=e.slice(r,n);r=i(o,n+1,a,a);continue}if(`(){},;`.includes(a)){t.push({t:`punc`,v:a,s:o,e:++r});continue}let s=e.slice(r,r+2);if(s===`<=`||s===`>=`||s===`<>`)t.push({t:`op`,v:s,s:o,e:r+=2});else if(`+-*/^&=<>%:`.includes(a))t.push({t:`op`,v:a,s:o,e:++r});else if(a>=`0`&&a<=`9`||a===`.`&&/\\d/.test(e[r+1]??``)||a===`$`&&/\\d/.test(e[r+1]??``)){let n=pr(e,r);if(n&&n.ref.kind===`rows`){t.push({t:`ref`,ref:n.ref,s:o,e:n.end}),r=n.end;continue}let i=lr(sr,e,r);if(!i||a===`$`)throw new R(`bad number`,r);r+=i[0].length,t.push({t:`num`,v:Number(i[0]),s:o,e:r})}else if(ur(a)){let a=r;for(;a<n&&ur(e[a]);)a++;let s=e.slice(r,a);if(e[a]===`!`){r=i(o,a+1,s,s);continue}if(e[a]===`(`){t.push({t:`func`,v:hr(s),s:o,e:a}),r=a;continue}let c=pr(e,r);if(c){t.push({t:`ref`,ref:c.ref,s:o,e:c.end}),r=c.end;continue}let l=s.toUpperCase();if(l===`TRUE`||l===`FALSE`){t.push({t:`bool`,v:l===`TRUE`,s:o,e:a}),r=a;continue}if(e[a]===`[`){let t=0;do e[a]===`[`?t++:e[a]===`]`&&t--,a++;while(a<n&&t>0);if(t>0)throw new R(`unterminated [`,r)}t.push({t:`name`,v:e.slice(r,a),s:o,e:a}),r=a}else throw new R(`unexpected character \'${a}\'`,r)}return t}function _r(e){let t;try{t=gr(e.trim()).filter(e=>e.t!==`ws`)}catch{return null}let n=t[0];if(!n||n.t!==`ref`)return null;if(t.length===1)return n.ref;let r=t[1],i=t[2];return t.length!==3||r.t!==`op`||r.v!==`:`||i.t!==`ref`||i.ref.sheet!==void 0&&(n.ref.sheet??``).toLowerCase()!==i.ref.sheet.toLowerCase()?null:$n({...n.ref,kind:`area`,r0:Math.min(n.ref.r0,i.ref.r0),c0:Math.min(n.ref.c0,i.ref.c0),r1:Math.max(n.ref.r1,i.ref.r1),c1:Math.max(n.ref.c1,i.ref.c1)})}const vr=/* @__PURE__ */ new Set([`=`,`<>`,`<`,`>`,`<=`,`>=`]);var yr=class{constructor(e){w(this,`toks`,void 0),w(this,`i`,0),this.toks=e}peek(){return this.toks[this.i]}isOp(...e){let t=this.toks[this.i];return t&&t.t===`op`&&e.includes(t.v)?t.v:void 0}isPunc(e){let t=this.toks[this.i];return!!t&&t.t===`punc`&&t.v===e}fail(e){let t=this.toks[this.i];throw new R(e,t?t.s:-1)}expectPunc(e){this.isPunc(e)||this.fail(`expected \'${e}\'`),this.i++}expr(){let e=this.concat();for(let t=this.cmpOp();t;t=this.cmpOp())this.i++,e={type:`binary`,op:t,left:e,right:this.concat()};return e}cmpOp(){let e=this.peek();return e&&e.t===`op`&&vr.has(e.v)?e.v:void 0}concat(){let e=this.add();for(;this.isOp(`&`);)this.i++,e={type:`binary`,op:`&`,left:e,right:this.add()};return e}add(){let e=this.mul();for(let t=this.isOp(`+`,`-`);t;t=this.isOp(`+`,`-`))this.i++,e={type:`binary`,op:t,left:e,right:this.mul()};return e}mul(){let e=this.pow();for(let t=this.isOp(`*`,`/`);t;t=this.isOp(`*`,`/`))this.i++,e={type:`binary`,op:t,left:e,right:this.pow()};return e}pow(){let e=this.postfix();for(;this.isOp(`^`);)this.i++,e={type:`binary`,op:`^`,left:e,right:this.postfix()};return e}postfix(){let e=this.unary();for(;this.isOp(`%`);)this.i++,e={type:`percent`,arg:e};return e}unary(){let e=this.isOp(`-`,`+`);return e?(this.i++,{type:`unary`,op:e,arg:this.unary()}):this.range()}range(){let e=this.primary();for(;this.isOp(`:`);)this.i++,e={type:`range`,left:e,right:this.primary()};return e}primary(){let e=this.peek();switch(e||this.fail(`unexpected end of formula`),this.i++,e.t){case`num`:return{type:`num`,value:e.v};case`str`:return{type:`str`,value:e.v};case`bool`:return{type:`bool`,value:e.v};case`err`:return{type:`err`,code:e.v};case`ref`:return{type:`ref`,ref:e.ref};case`name`:return e.sheet===void 0?{type:`name`,name:e.v}:{type:`name`,name:e.v,sheet:e.sheet};case`func`:return this.expectPunc(`(`),{type:`call`,name:e.v,args:this.args()};case`punc`:if(e.v===`(`){let e=this.expr();if(!this.isPunc(`,`))return this.expectPunc(`)`),e;let t=[e];for(;this.isPunc(`,`);)this.i++,t.push(this.expr());return this.expectPunc(`)`),{type:`union`,items:t}}if(e.v===`{`)return this.array()}return this.i--,this.fail(`unexpected token`)}args(){let e=[];if(this.isPunc(`)`))return this.i++,e;for(;;){if(e.push(this.isPunc(`,`)||this.isPunc(`)`)?{type:`missing`}:this.expr()),this.isPunc(`)`))return this.i++,e;this.expectPunc(`,`)}}array(){let e=[[]];for(;;){e[e.length-1].push(this.arrayItem());let t=this.peek();if(t&&t.t===`punc`||this.fail(`bad array constant`),this.i++,t.v===`}`)break;t.v===`;`?e.push([]):t.v!==`,`&&this.fail(`bad array constant`)}return e.some(t=>t.length!==e[0].length)&&this.fail(`array rows differ in length`),{type:`array`,rows:e}}arrayItem(){let e=this.isOp(`-`,`+`);e&&this.i++;let t=this.peek();return t||this.fail(`bad array constant`),this.i++,t.t===`num`?e===`-`?-t.v:t.v:(e&&this.fail(`bad array constant`),t.t===`str`||t.t===`bool`?t.v:t.t===`err`?new I(t.v):(this.i--,this.fail(`bad array constant`)))}};function br(e){let t=gr(e.startsWith(`=`)?e.slice(1):e).filter(e=>e.t!==`ws`);if(!t.length)throw new R(`empty formula`,0);let n=new yr(t),r=n.expr();if(n.i<t.length)throw new R(`unexpected token`,t[n.i].s);return r}const xr=864e5,Sr=Date.UTC(1899,11,30),Cr=Date.UTC(1904,0,1);let wr=!1;function Tr(){return wr}function Er(e){wr=e}function Dr(e,t,n){let r=/* @__PURE__ */ new Date(0);return r.setUTCFullYear(e,t-1,n),r.getTime()}function Or(e,t,n){let r=Dr(e,t,n);if(wr)return Math.round((r-Cr)/xr);let i=Math.round((r-Sr)/xr);return i<61?i-1:i}function kr(e){let t=Math.floor(e);if(wr){let e=new Date(Cr+t*xr);return{y:e.getUTCFullYear(),m:e.getUTCMonth()+1,d:e.getUTCDate(),dow:((t+5)%7+7)%7}}let n=((t-1)%7+7)%7;if(t===60)return{y:1900,m:2,d:29,dow:n};if(t===0)return{y:1900,m:1,d:0,dow:n};let r=new Date(Sr+(t<60?t+1:t)*xr);return{y:r.getUTCFullYear(),m:r.getUTCMonth()+1,d:r.getUTCDate(),dow:n}}function Ar(e){return Math.round((e-Math.floor(e))*86400)%86400}function jr(e,t){return new Date(Dr(e,t+1,0)).getUTCDate()}function Mr(e){return Or(e.getFullYear(),e.getMonth()+1,e.getDate())+(e.getHours()*3600+e.getMinutes()*60+e.getSeconds()+e.getMilliseconds()/1e3)/86400}const Nr=/^(\\d{1,4}):(\\d{1,2})(?::(\\d{1,2}(?:\\.\\d+)?))?\\s*([ap]m?)?$/i,Pr=/^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T\\s]+(.+))?$/i,Fr=/^(\\d{1,2})[-/](\\d{1,2})[-/](\\d{4}|\\d{2})(?:\\s+(.+))?$/;function Ir(e){let t=Nr.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=t[3]?Number(t[3]):0;if(r>59||i>=60)return null;if(t[4]){if(n<1||n>12)return null;let e=t[4][0].toLowerCase()===`p`;n=n%12+(e?12:0)}return(n*3600+r*60+i)/86400}function Lr(e,t,n){if(t<1||t>12||n<1||n>jr(e,t))return null;let r=Or(e,t,n);return r<0?null:r}function Rr(e){let t=Pr.exec(e),n=null,r;if(t)n=Lr(Number(t[1]),Number(t[2]),Number(t[3])),r=t[4];else if(t=Fr.exec(e)){let e=Number(t[3]);t[3].length===2&&(e+=e<30?2e3:1900),n=Lr(e,Number(t[1]),Number(t[2])),r=t[4]}else return Ir(e);if(n===null)return null;if(r===void 0)return n;let i=Ir(r);return i===null?null:n+i}const zr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Br=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Vr(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];a===`\\\\`&&!r?(n+=a+(e[i+1]??``),i++):(a===`"`&&(r=!r),a===`;`&&!r?(t.push(n),n=``):n+=a)}return t.push(n),t}function Hr(e){return e.replace(/"[^"]*"/g,``).replace(/\\\\./g,``).replace(/\\[[^\\]]*\\]/g,``).replace(/[_*]./g,``)}function Ur(e){return/[ymdhs]/i.test(Hr(e))||/\\[(h+|m+|s+)\\]/i.test(e)}function Wr(e,t){let n=[];for(let e=0;e<t.length;){let r=t[e],i=r.toLowerCase();if(r===`"`){let r=t.indexOf(`"`,e+1),i=r<0?t.length:r;n.push({k:`lit`,v:t.slice(e+1,i)}),e=i+1}else if(r===`\\\\`)n.push({k:`lit`,v:t[e+1]??``}),e+=2;else if(r===`_`)n.push({k:`lit`,v:` `}),e+=2;else if(r===`*`)e+=2;else if(r===`[`){let r=t.indexOf(`]`,e),i=t.slice(e+1,r<0?t.length:r).toLowerCase();/^h+$/.test(i)?n.push({k:`H`,n:i.length}):/^m+$/.test(i)?n.push({k:`N`,n:i.length}):/^s+$/.test(i)&&n.push({k:`S`,n:i.length}),e=r<0?t.length:r+1}else if(t.slice(e,e+5).toUpperCase()===`AM/PM`)n.push({k:`ap`,v:t.slice(e,e+5)}),e+=5;else if(t.slice(e,e+3).toUpperCase()===`A/P`)n.push({k:`ap`,v:t.slice(e,e+3)}),e+=3;else if(`ymdhs`.includes(i)){let r=e;for(;r<t.length&&t[r].toLowerCase()===i;)r++;n.push({k:i===`m`?`M`:i,n:r-e}),e=r}else n.push({k:`lit`,v:r}),e++}let r=n.filter(e=>e.k!==`lit`);r.forEach((e,t)=>{if(e.k!==`M`||e.n>2)return;let n=r[t-1],i=r[t+1];(n&&(n.k===`h`||n.k===`H`)||i&&(i.k===`s`||i.k===`S`))&&(e.k=`m`)});let i=n.some(e=>e.k===`ap`),a=Math.floor(e),o=Math.round((e-a)*86400);o>=86400&&(a++,o-=86400);let s=kr(a),c=Math.floor(o/3600),l=Math.floor(o%3600/60),u=o%60,d=(e,t)=>String(e).padStart(t,`0`),f=``;for(let e of n)switch(e.k){case`lit`:f+=e.v;break;case`y`:f+=e.n<=2?d(s.y%100,2):d(s.y,4);break;case`M`:f+=e.n===1?s.m:e.n===2?d(s.m,2):e.n===3?zr[s.m-1].slice(0,3):e.n===4?zr[s.m-1]:zr[s.m-1][0];break;case`d`:f+=e.n===1?s.d:e.n===2?d(s.d,2):e.n===3?Br[s.dow].slice(0,3):Br[s.dow];break;case`h`:{let t=i?c%12||12:c;f+=e.n>=2?d(t,2):t;break}case`m`:f+=e.n>=2?d(l,2):l;break;case`s`:f+=e.n>=2?d(u,2):u;break;case`H`:f+=d(a*24+c,e.n);break;case`N`:f+=d((a*24+c)*60+l,e.n);break;case`S`:f+=d(((a*24+c)*60+l)*60+u,e.n);break;case`ap`:{let t=c<12,n=e.v.length===5?t?e.v.slice(0,2):e.v.slice(3,5):t?e.v[0]:e.v[2];f+=n;break}}return f}var z=class{constructor(e,t,n,r,i){w(this,`sheet`,void 0),w(this,`r0`,void 0),w(this,`c0`,void 0),w(this,`r1`,void 0),w(this,`c1`,void 0),this.sheet=e,this.r0=t,this.c0=n,this.r1=r,this.c1=i}get h(){return this.r1-this.r0+1}get w(){return this.c1-this.c0+1}},B=class{constructor(e){w(this,`data`,void 0),this.data=e}get h(){return this.data.length}get w(){return this.data[0]?.length??0}},V=class{constructor(e){w(this,`areas`,void 0),this.areas=e}};const Gr=/^([+-])?\\s*\\$?\\s*((?:\\d{1,3}(?:,\\d{3})+|\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*(%?)$/;function Kr(e){let t=e.trim();if(!t)return null;let n=Gr.exec(t);if(n&&/\\d/.test(n[2])){let e=Number(n[2].replace(/,/g,``));if(!Number.isNaN(e))return(n[1]===`-`?-e:e)/(n[3]?100:1)}return Rr(t)}function qr(e){if(!Number.isFinite(e))return`#NUM!`;if(e===0)return`0`;let[t,n]=Math.abs(e).toExponential(14).split(`e`),r=Number(n),i=t.replace(`.`,``).replace(/0+$/,``),a=e<0?`-`:``;if(r>=15||r<-9)return`${a}${i[0]+(i.length>1?`.${i.slice(1)}`:``)}E${r<0?`-`:`+`}${String(Math.abs(r)).padStart(2,`0`)}`;if(r<0)return`${a}0.${`0`.repeat(-r-1)}${i}`;let o=i.slice(0,r+1).padEnd(r+1,`0`),s=i.slice(r+1);return a+o+(s?`.${s}`:``)}function Jr(e){if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e==`boolean`)return+!!e;if(typeof e==`string`){let t=Kr(e);return t===null?L.VALUE:t}return e}function Yr(e){return typeof e==`string`?e:typeof e==`number`?qr(e):e===null?``:typeof e==`boolean`?e?`TRUE`:`FALSE`:e}function Xr(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e!==0;if(e===null)return!1;if(typeof e==`string`){let t=e.toUpperCase();return t===`TRUE`||t!==`FALSE`&&L.VALUE}return e}function H(e){let t=Jr(e);if(t instanceof I)throw t;return t}function U(e){return Math.trunc(H(e))}function W(e){let t=Yr(e);if(t instanceof I)throw t;return t}function Zr(e){let t=Xr(e);if(t instanceof I)throw t;return t}function Qr(e,t){return e===t||Math.abs(e-t)<=Math.max(Math.abs(e),Math.abs(t))*1e-15}const $r=e=>typeof e==`number`?0:typeof e==`string`?1:2;function G(e,t){if(e===null&&(e=typeof t==`string`?``:typeof t!=`boolean`&&0),t===null&&(t=typeof e==`string`?``:typeof e!=`boolean`&&0),e instanceof I||t instanceof I)return 0;let n=$r(e),r=$r(t);if(n!==r)return n<r?-1:1;if(typeof e==`number`){let n=t;return Qr(e,n)?0:e<n?-1:1}if(typeof e==`string`){let n=e.toLowerCase(),r=t.toLowerCase();return n<r?-1:+(n>r)}return!!e-+!!t}function ei(e,t){return e===null||t===null?e===t:e instanceof I||t instanceof I?!1:typeof e==typeof t&&G(e,t)===0}const ti=e=>/[*?~]/.test(e);function ni(e,t=!0){let n=``;for(let t=0;t<e.length;t++){let r=e[t];r===`~`&&t+1<e.length&&`*?~`.includes(e[t+1])?n+=`\\\\${e[++t]}`:n+=r===`*`?`[\\\\s\\\\S]*`:r===`?`?`[\\\\s\\\\S]`:r.replace(/[.*+?^${}()|[\\]\\\\/]/g,`\\\\$&`)}return new RegExp(t?`^${n}$`:n,`i`)}function ri(e,t){switch(e){case`<`:return t<0;case`<=`:return t<=0;case`>`:return t>0;case`>=`:return t>=0;case`<>`:return t!==0;default:return t===0}}const ii=e=>Wn.find(t=>t===e.toUpperCase());function ai(e){if(e instanceof I){let t=e.code;return e=>e instanceof I&&e.code===t}if(e===null&&(e=0),typeof e==`number`){let t=e;return e=>typeof e==`number`&&Qr(e,t)||typeof e==`string`&&Kr(e)===t}if(typeof e==`boolean`){let t=e;return e=>e===t}let t=/^(<=|>=|<>|<|>|=)?([\\s\\S]*)$/.exec(e),n=t[1]??``,r=t[2],i=n===``||n===`=`;if(r===``)return n===``?e=>e===null||e===``:n===`=`?e=>e===null:n===`<>`?e=>e!==null&&e!==``:()=>!1;let a=Kr(r);if(a!==null)return i?e=>typeof e==`number`&&Qr(e,a)||typeof e==`string`&&Kr(e)===a:n===`<>`?e=>!(typeof e==`number`&&Qr(e,a)):e=>typeof e==`number`&&ri(n,G(e,a));let o=r.toUpperCase();if(o===`TRUE`||o===`FALSE`){let e=o===`TRUE`;return i?t=>t===e:n===`<>`?t=>t!==e:t=>typeof t==`boolean`&&ri(n,G(t,e))}let s=ii(r);if(s){let e=e=>e instanceof I&&e.code===s;return n===`<>`?t=>!e(t):t=>e(t)}if(i||n===`<>`){let e=ni(r),t=t=>typeof t==`string`&&e.test(t);return n===`<>`?e=>!t(e):t}return e=>typeof e==`string`&&ri(n,G(e,r))}const K=1/0;function oi(e){try{return e()}catch(e){if(e instanceof I)return e;throw e}}function si(e,t,n){let r=e.length===1?0:t,i=e[0].length===1?0:n;return r<e.length&&i<e[0].length?e[r][i]:L.NA}function q(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!0,fn:(e,t,r)=>{let i=1,a=1,o=!1,s=e.map(e=>{if(e instanceof z){if(e.h===1&&e.w===1)return t.cell(e.sheet,e.r0,e.c0);if(r)return t.scalar(e)}else if(e instanceof B){if(e.h===1&&e.w===1)return e.data[0][0]}else if(e instanceof V)return L.VALUE;else return e;let n=t.toArray(e);return o=!0,i=Math.max(i,n.length),a=Math.max(a,n[0].length),n});if(!o)return oi(()=>n(s,t));let c=[];for(let e=0;e<i;e++){let r=[];for(let i=0;i<a;i++){let a=s.map(t=>Array.isArray(t)?si(t,e,i):t);r.push(oi(()=>n(a,t)))}c.push(r)}return new B(c)}}}function J(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!1,fn:n}}function ci(e,t,n){return{kind:`lazy`,min:e,max:t,fn:n}}function li(e,t,n,r){if(e instanceof z)t.forEach(e,n);else if(e instanceof V)for(let r of e.areas)t.forEach(r,n);else if(e instanceof B)for(let t of e.data)for(let e of t)n(e);else r(e)}function ui(e,t,n){for(let r of e)li(r,t,e=>{if(typeof e==`number`)n(e);else if(e instanceof I)throw e},e=>{let t=Jr(e);if(t instanceof I)throw t;n(t)})}function Y(e,t){let n=[];return ui(e,t,e=>n.push(e)),n}function di(e){return e.length===1?e[0]:e.flat()}function X(e,t,n){if(e.length<=t)return n;let r=Jr(e[t]);if(r instanceof I)throw r;return r}function fi(e){let t=H(e);if(t<0)throw L.NUM;return t}const pi=e=>Math.floor(fi(e));function mi(e,t,n){let r=kr(e),i=r.y*12+(r.m-1)+Math.trunc(t),a=Math.floor(i/12),o=i%12+1,s=Or(a,o,n?jr(a,o):Math.min(r.d,jr(a,o)));if(s<0)throw L.NUM;return s}const hi={1:[0,1],2:[1,1],3:[1,0],11:[1,1],12:[2,1],13:[3,1],14:[4,1],15:[5,1],16:[6,1],17:[0,1]};function gi(e,t,n){if(e>t)throw L.NUM;let r=kr(e),i=kr(t),a=(i.y-r.y)*12+(i.m-r.m)-+(i.d<r.d);switch(n.toUpperCase()){case`D`:return t-e;case`M`:return a;case`Y`:return Math.floor(a/12);case`YM`:return a%12;case`MD`:{if(i.d>=r.d)return i.d-r.d;let e=i.m===1?12:i.m-1;return jr(i.m===1?i.y-1:i.y,e)-r.d+i.d}case`YD`:{let e=Or(i.y,r.m,Math.min(r.d,jr(i.y,r.m)));return e>t&&(e=Or(i.y-1,r.m,Math.min(r.d,jr(i.y-1,r.m)))),t-e}}throw L.NUM}function _i(e,t,n){let r=e<=t?1:-1,[i,a]=e<=t?[e,t]:[t,e],o=0;for(let e=i;e<=a;e++){let t=kr(e).dow;t!==0&&t!==6&&!n.has(e)&&o++}return r*o}const vi={TODAY:J(0,0,(e,t)=>Math.floor(Mr(t.now()))),NOW:J(0,0,(e,t)=>Mr(t.now())),DATE:q(3,3,([e,t,n])=>{let r=Math.trunc(H(e));if(r>=0&&r<1900&&(r+=1900),r<0||r>9999)throw L.NUM;let i=Or(r,Math.trunc(H(t)),Math.trunc(H(n)));if(i<0)throw L.NUM;return i}),TIME:q(3,3,([e,t,n])=>{let r=Math.trunc(H(e))*3600+Math.trunc(H(t))*60+Math.trunc(H(n));if(r<0)throw L.NUM;return r%86400/86400}),YEAR:q(1,1,([e])=>kr(pi(e)).y),MONTH:q(1,1,([e])=>kr(pi(e)).m),DAY:q(1,1,([e])=>kr(pi(e)).d),HOUR:q(1,1,([e])=>Math.floor(Ar(fi(e))/3600)),MINUTE:q(1,1,([e])=>Math.floor(Ar(fi(e))%3600/60)),SECOND:q(1,1,([e])=>Ar(fi(e))%60),WEEKDAY:q(1,2,e=>{let t=kr(pi(e[0])).dow,n=hi[Math.trunc(X(e,1,1))];if(!n)throw L.NUM;return(t-n[0]+7)%7+n[1]}),EDATE:q(2,2,([e,t])=>mi(pi(e),H(t),!1)),EOMONTH:q(2,2,([e,t])=>mi(pi(e),H(t),!0)),DATEDIF:q(3,3,([e,t,n])=>gi(pi(e),pi(t),W(n))),DAYS:q(2,2,([e,t])=>Math.floor(H(e))-Math.floor(H(t))),NETWORKDAYS:J(2,3,(e,t)=>{let n=new Set(e.length>2?Y([e[2]],t).map(Math.floor):[]);return _i(pi(t.scalar(e[0])),pi(t.scalar(e[1])),n)})},Z=(e,t,n)=>e.type===`missing`?0:t.eval(e,n);function yi(e,t){let n=[];for(let r of e)li(r,t,e=>{if(typeof e==`boolean`)n.push(e);else if(typeof e==`number`)n.push(e!==0);else if(e instanceof I)throw e},e=>n.push(Zr(e)));if(!n.length)throw L.VALUE;return n}const bi=ci(2,3,(e,t,n)=>{let r=t.operand(t.eval(e[0],n),n),i=e[1],a=e[2];if(!Array.isArray(r)){let e=Xr(r);return e instanceof I?e:e?Z(i,t,n):a?Z(a,t,n):!1}let o=t.operand(Z(i,t,!1),!1),s=a?t.operand(Z(a,t,!1),!1):!1;return new B(r.map((e,t)=>e.map((e,n)=>{let r=Xr(e);if(r instanceof I)return r;let i=r?o:s;return Array.isArray(i)?si(i,t,n):i})))});function xi(e){return ci(2,2,(t,n,r)=>{let i=n.eval(t[0],r),a=n.operand(i,r),o=t=>t instanceof I&&(!e||t.code===`#N/A`);if(Array.isArray(a)){if(!a.some(e=>e.some(o)))return i;let e=n.scalar(Z(t[1],n,!1));return new B(a.map(t=>t.map(t=>o(t)?e:t)))}return o(a)?Z(t[1],n,r):a})}const Si={IF:bi,IFS:ci(2,K,(e,t,n)=>{if(e.length%2)return L.VALUE;for(let r=0;r<e.length;r+=2){let i=t.scalar(t.eval(e[r],n));if(i instanceof I)return i;if(Zr(i))return Z(e[r+1],t,n)}return L.NA}),IFERROR:xi(!1),IFNA:xi(!0),AND:J(1,K,(e,t)=>yi(e,t).every(Boolean)),OR:J(1,K,(e,t)=>yi(e,t).some(Boolean)),XOR:J(1,K,(e,t)=>yi(e,t).filter(Boolean).length%2==1),NOT:q(1,1,([e])=>!Zr(e)),TRUE:J(0,0,()=>!0),FALSE:J(0,0,()=>!1),SWITCH:ci(3,K,(e,t,n)=>{let r=t.scalar(t.eval(e[0],n));if(r instanceof I)return r;let i=1;for(;i+1<e.length;i+=2){let a=t.scalar(Z(e[i],t,n));if(a instanceof I)return a;if(ei(r,a)||r===null&&G(r,a)===0)return Z(e[i+1],t,n)}return i<e.length?Z(e[i],t,n):L.NA}),CHOOSE:ci(2,K,(e,t,n)=>{let r=U(t.scalar(t.eval(e[0],n)));return r<1||r>=e.length?L.VALUE:Z(e[r],t,n)}),ISBLANK:q(1,1,([e])=>e===null),ISNUMBER:q(1,1,([e])=>typeof e==`number`),ISTEXT:q(1,1,([e])=>typeof e==`string`),ISNONTEXT:q(1,1,([e])=>typeof e!=`string`),ISLOGICAL:q(1,1,([e])=>typeof e==`boolean`),ISERROR:q(1,1,([e])=>e instanceof I),ISERR:q(1,1,([e])=>e instanceof I&&e.code!==`#N/A`),ISNA:q(1,1,([e])=>e instanceof I&&e.code===`#N/A`),ISEVEN:q(1,1,([e])=>Math.trunc(H(e))%2==0),ISODD:q(1,1,([e])=>Math.abs(Math.trunc(H(e)))%2==1),NA:J(0,0,()=>L.NA),"ERROR.TYPE":q(1,1,([e])=>e instanceof I?Wn.indexOf(e.code)+1:L.NA),N:q(1,1,([e])=>e instanceof I||typeof e==`number`?e:typeof e==`boolean`?+!!e:0),T:q(1,1,([e])=>e instanceof I||typeof e==`string`?e:``)};function Ci(e,t,n){if(n&&typeof t==`string`&&ti(t)){let n=ni(t);return e.findIndex(e=>typeof e==`string`&&n.test(e))}return e.findIndex(e=>ei(e,t))}function wi(e,t,n){let r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===null||a instanceof I||typeof a!=typeof t)continue;let o=G(a,t);if(n===1?o<=0:o>=0)r=i;else break}return r}function Ti(e,t){let n=t.scalar(e);if(n instanceof I)throw n;return n}function Ei(e,t){if(e instanceof V)throw L.VALUE;return t.toArray(e)}function Di(e,t,n){let r=Ti(e[0],t),i=Ei(e[1],t),a=U(t.scalar(e[2])),o=e.length>3?Zr(t.scalar(e[3])):!0,s=n?i[0].length:i.length;if(a<1)throw L.VALUE;if(a>s)throw L.REF;let c=n?i.map(e=>e[0]):i[0],l=o?wi(c,r,1):Ci(c,r,!0);if(l<0)throw L.NA;return n?i[l][a-1]:i[a-1][l]}function Oi(e,t){let n=Ti(e[0],t),r=Ei(e[1],t);if(r.length>1&&r[0].length>1)throw L.NA;let i=di(r),a=e.length>2?Math.sign(H(t.scalar(e[2]))):1,o=a===0?Ci(i,n,!0):wi(i,n,a);if(o<0)throw L.NA;return o+1}function ki(e,t,n,r){if(e instanceof z)return r?new z(e.sheet,e.r0+n,e.c0,e.r0+n,e.c1):new z(e.sheet,e.r0,e.c0+n,e.r1,e.c0+n);let i=r?[t[n]]:t.map(e=>[e[n]]);return i[0].length===1&&i.length===1?i[0][0]:new B(i)}function Ai(e,t){let n=Ti(e[0],t),r=Ei(e[1],t),i=Ei(e[2],t),a=r[0].length===1;if(!a&&r.length!==1||(a?i.length!==r.length:i[0].length!==r[0].length))throw L.VALUE;let o=e.length>3&&e[3]!==null?e[3]:void 0,s=e.length>4?U(t.scalar(e[4])):0,c=e.length>5?U(t.scalar(e[5])):1,l=di(r),u=c<0;u&&(l=[...l].reverse());let d=-1;if(s===0||s===2)d=Ci(l,n,s===2);else if(s===1||s===-1){if(d=Ci(l,n,!1),d<0){let e=null;for(let t=0;t<l.length;t++){let r=l[t];if(r===null||r instanceof I||typeof r!=typeof n)continue;let i=G(r,n);(s===1?i>0&&(e===null||G(r,e)<0):i<0&&(e===null||G(r,e)>0))&&(e=r,d=t)}}}else throw L.VALUE;if(d<0){if(o!==void 0)return o;throw L.NA}return u&&(d=l.length-1-d),ki(e[2],i,d,a)}function ji(e,t){let n=Ti(e[0],t),r=Ei(e[1],t),i,a;e.length>2?(i=di(r),a=di(Ei(e[2],t))):r[0].length>r.length?(i=r[0],a=r[r.length-1]):(i=r.map(e=>e[0]),a=r.map(e=>e[e.length-1]));let o=wi(i,n,1);if(o<0||o>=a.length)throw L.NA;return a[o]}function Mi(e,t){let n=e[0];if(n instanceof V){let r=e.length>3?U(t.scalar(e[3])):1;if(r<1||r>n.areas.length)throw L.REF;n=n.areas[r-1]}let r=n instanceof z||n instanceof B?n.h:1,i=n instanceof z||n instanceof B?n.w:1,a=U(t.scalar(e[1])),o;if(e.length>2?o=U(t.scalar(e[2])):r===1?[a,o]=[1,a]:o=+(i===1),a<0||o<0||a>r||o>i)throw L.REF;if(n instanceof z){let[e,t]=a?[n.r0+a-1,n.r0+a-1]:[n.r0,n.r1],[r,i]=o?[n.c0+o-1,n.c0+o-1]:[n.c0,n.c1];return new z(n.sheet,e,r,t,i)}if(n instanceof B){let e=(a?[n.data[a-1]]:n.data).map(e=>o?[e[o-1]]:e);return e.length===1&&e[0].length===1?e[0][0]:new B(e)}return n}function Ni(e,t){let n=e[0];if(!(n instanceof z))throw L.VALUE;let r=U(t.scalar(e[1])),i=U(t.scalar(e[2])),a=e.length>3&&e[3]!==null?U(t.scalar(e[3])):n.h,o=e.length>4&&e[4]!==null?U(t.scalar(e[4])):n.w;if(a===0||o===0)throw L.REF;let s=n.r0+r,c=n.c0+i,l=s+a-1,u=c+o-1;if(a<0&&([s,l]=[s+a+1,s]),o<0&&([c,u]=[c+o+1,c]),s<0||c<0||l>1048575||u>16383)throw L.REF;return new z(n.sheet,s,c,l,u)}function Pi(e,t){let n=/^(?:(?:\'((?:[^\']|\'\')+)\'|([^\'!]+))!)?(R(\\[-?\\d+\\]|\\d*)C(\\[-?\\d+\\]|\\d*))(?::(R(\\[-?\\d+\\]|\\d*)C(\\[-?\\d+\\]|\\d*)))?$/i.exec(e.trim());if(!n)return null;let r=(e,t)=>e===``?t:e[0]===`[`?t+Number(e.slice(1,-1)):Number(e)-1,i=r(n[4],t.r),a=r(n[5],t.c),o=n[6]?r(n[7],t.r):i,s=n[6]?r(n[8],t.c):a;return{sheet:n[1]===void 0?n[2]:n[1].replace(/\'\'/g,`\'`),kind:`area`,r0:Math.min(i,o),c0:Math.min(a,s),r1:Math.max(i,o),c1:Math.max(a,s),ar0:!0,ac0:!0,ar1:!0,ac1:!0}}function Fi(e,t){let n=W(t.scalar(e[0])),r=!(e.length>1)||Zr(t.scalar(e[1]))?_r(n):Pi(n,t);if(!r||r.r0<0||r.c0<0||r.r1>1048575||r.c1>16383||r.sheet!==void 0&&!t.hasSheet(r.sheet))throw L.REF;return new z(r.sheet??t.sheet,r.r0,r.c0,r.r1,r.c1)}function Ii(e,t,n,r){if(!e.length||e[0]===null)return(r?t.r:t.c)+1;let i=e[0];if(!(i instanceof z))throw L.VALUE;let a=r?i.r0:i.c0,o=r?i.h:i.w;if(o===1||n)return a+1;let s=Array.from({length:o},(e,t)=>a+t+1);return new B(r?s.map(e=>[e]):[s])}function Li(e,t){if(e instanceof z||e instanceof B)return t?e.h:e.w;if(e instanceof V)throw L.REF;if(e instanceof I)throw e;return 1}const Ri={VLOOKUP:J(3,4,(e,t)=>Di(e,t,!0)),HLOOKUP:J(3,4,(e,t)=>Di(e,t,!1)),XLOOKUP:J(3,6,Ai),MATCH:J(2,3,Oi),LOOKUP:J(2,3,ji),INDEX:J(2,4,Mi),OFFSET:J(3,5,Ni),INDIRECT:J(1,2,Fi),ROW:J(0,1,(e,t,n)=>Ii(e,t,n,!0)),COLUMN:J(0,1,(e,t,n)=>Ii(e,t,n,!1)),ROWS:J(1,1,([e])=>Li(e,!0)),COLUMNS:J(1,1,([e])=>Li(e,!1))};function zi(e,t){if(t>15)return e;let n=10**Math.abs(t),r=Math.abs(e),i=t>=0?r*n:r/n;i=Math.floor(Number(i.toPrecision(15))+.5);let a=t>=0?i/n:i*n;return e<0?-a:a}function Bi(e,t,n){let r=``,i=``,a=``,o=0,s=e=>{a?i+=e:r+=e};for(let e=0;e<t.length;e++){let n=t[e];if(n===`"`){let n=t.indexOf(`"`,e+1),r=n<0?t.length:n;s(t.slice(e+1,r)),e=r}else if(n===`\\\\`)s(t[++e]??``);else if(n===`_`)s(` `),e++;else if(n===`*`)e++;else if(n===`[`){let n=t.indexOf(`]`,e);e=n<0?t.length:n}else`0#?`.includes(n)||(n===`.`||n===`,`)&&!i?a+=n:(n===`%`&&o++,s(n))}let c=a,l=e*100**o;for(;c.endsWith(`,`);)c=c.slice(0,-1),l/=1e3;let u=c.indexOf(`.`),d=u<0?c:c.slice(0,u),f=u<0?``:c.slice(u+1),p=(f.match(/[0#?]/g)??[]).length,m=(f.match(/[0?]/g)??[]).length,h=(d.match(/[0?]/g)??[]).length,g=zi(Math.abs(l),p),[_,v=``]=g.toFixed(p).split(`.`);for(_===`0`&&h===0&&(_=``),_=_.padStart(h,`0`),d.includes(`,`)&&(_=_.replace(/\\B(?=(\\d{3})+(?!\\d))/g,`,`));v.length>m&&v.endsWith(`0`);)v=v.slice(0,-1);let y=c===``?``:_+(u>=0?`.${v}`:``);return(n&&l<0&&g!==0?`-`:``)+r+y+i}function Vi(e,t){if(e instanceof I)throw e;if(typeof e==`boolean`)return e?`TRUE`:`FALSE`;let n,r=Vr(t);if(typeof e==`string`){let t=Kr(e);if(t===null){let t=r.length>3?r[3]:r.find(e=>e.includes(`@`));return t===void 0?e:t.replace(/"([^"]*)"/g,`$1`).replace(/@/g,e)}n=t}else n=e??0;let i=r[0],a=!0;if(n<0&&r.length>1&&r[1]!==``?(i=r[1],a=!1):n===0&&r.length>2&&r[2]!==``&&(i=r[2]),/^\\s*general\\s*$/i.test(i)||i===``)return qr(a?n:Math.abs(n));if(Ur(i)){if(n<0)throw L.VALUE;return Wr(n,i)}return Bi(a?n:Math.abs(n),i,a)}const Hi=e=>Number(e.toPrecision(15));function Ui(e,t,n){if(t>15)return e;let r=10**Math.abs(t),i=Math.abs(e),a=Hi(t>=0?i*r:i/r);a=n?Math.ceil(a):Math.floor(a);let o=t>=0?a/r:a*r;return e<0?-o:o}function Wi(e){if(!Number.isFinite(e))throw L.NUM;return e}const Gi=(e,t,n)=>Hi((n?Math.ceil:Math.floor)(Hi(e/t))*t);function Ki(e,t){for(;t;)[e,t]=[t,e%t];return e}function qi(e,t){return Y(e,t).map(e=>{if(e<0)throw L.NUM;return Math.trunc(e)})}const Ji={ABS:q(1,1,([e])=>Math.abs(H(e))),ROUND:q(2,2,([e,t])=>zi(H(e),U(t))),ROUNDUP:q(2,2,([e,t])=>Ui(H(e),U(t),!0)),ROUNDDOWN:q(2,2,([e,t])=>Ui(H(e),U(t),!1)),TRUNC:q(1,2,e=>Ui(H(e[0]),Math.trunc(X(e,1,0)),!1)),INT:q(1,1,([e])=>Math.floor(H(e))),MOD:q(2,2,([e,t])=>{let n=H(e),r=H(t);if(r===0)throw L.DIV0;return Hi(n-r*Math.floor(n/r))}),POWER:q(2,2,([e,t])=>{let n=H(e),r=H(t);if(n===0&&r===0)throw L.NUM;if(n===0&&r<0)throw L.DIV0;let i=n**+r;if(Number.isNaN(i))throw L.NUM;return Wi(i)}),SQRT:q(1,1,([e])=>{let t=H(e);if(t<0)throw L.NUM;return Math.sqrt(t)}),EXP:q(1,1,([e])=>Wi(Math.exp(H(e)))),LN:q(1,1,([e])=>{let t=H(e);if(t<=0)throw L.NUM;return Math.log(t)}),LOG:q(1,2,e=>{let t=H(e[0]),n=X(e,1,10);if(t<=0||n<=0)throw L.NUM;if(n===1)throw L.DIV0;return Hi(Math.log(t)/Math.log(n))}),LOG10:q(1,1,([e])=>{let t=H(e);if(t<=0)throw L.NUM;return Math.log10(t)}),PI:J(0,0,()=>Math.PI),SIGN:q(1,1,([e])=>Math.sign(H(e))),CEILING:q(1,2,e=>{let t=H(e[0]),n=X(e,1,1);if(n===0||t===0)return 0;if(t>0&&n<0)throw L.NUM;return Gi(t,n,!0)}),FLOOR:q(1,2,e=>{let t=H(e[0]),n=X(e,1,1);if(n===0)throw L.DIV0;if(t>0&&n<0)throw L.NUM;return Gi(t,n,!1)}),"CEILING.MATH":q(1,3,e=>{let t=H(e[0]),n=Math.abs(X(e,1,1));return n===0||t===0?0:t<0&&X(e,2,0)!==0?-Gi(-t,n,!0):Gi(t,n,!0)}),"FLOOR.MATH":q(1,3,e=>{let t=H(e[0]),n=Math.abs(X(e,1,1));return n===0||t===0?0:t<0&&X(e,2,0)!==0?-Gi(-t,n,!1):Gi(t,n,!1)}),RAND:J(0,0,()=>Math.random()),RANDBETWEEN:q(2,2,([e,t])=>{let n=Math.ceil(H(e)),r=Math.floor(H(t));if(n>r)throw L.NUM;return n+Math.floor(Math.random()*(r-n+1))}),FACT:q(1,1,([e])=>{let t=Math.trunc(H(e));if(t<0)throw L.NUM;let n=1;for(let e=2;e<=t;e++)n*=e;return Wi(n)}),EVEN:q(1,1,([e])=>{let t=H(e),n=Math.ceil(Hi(Math.abs(t)/2))*2;return t<0?-n:n}),ODD:q(1,1,([e])=>{let t=H(e),n=Math.ceil(Hi(Math.abs(t)));return n%2==0&&n++,t<0?-n:n}),GCD:J(1,K,(e,t)=>qi(e,t).reduce((e,t)=>Ki(e,t),0)),LCM:J(1,K,(e,t)=>Wi(qi(e,t).reduce((e,t)=>e===0||t===0?0:e/Ki(e,t)*t,1)))};function Yi(e){let t=0;for(let n of e)t+=n;return t}function Xi(e){if(!e.length)throw L.DIV0;return Yi(e)/e.length}function Zi(e,t){let n=e.length;if(n<(t?2:1))throw L.DIV0;let r=Yi(e)/n,i=0;for(let t of e)i+=(t-r)*(t-r);return i/(t?n-1:n)}function Qi(e){if(!e.length)throw L.NUM;let t=[...e].sort((e,t)=>e-t),n=t.length>>1;return t.length%2?t[n]:(t[n-1]+t[n])/2}function $i(e){let t=/* @__PURE__ */ new Map,n=0,r=1;for(let i of e){let e=(t.get(i)??0)+1;t.set(i,e),e>r&&(n=i,r=e)}if(r<2)throw L.NA;for(let n of e)if(t.get(n)===r)return n;return n}function ea(e,t){return Y([e],t)}function ta(e,t,n){let r=ea(e[0],t),i=Math.ceil(H(t.scalar(e[1])));if(i<1||i>r.length)throw L.NUM;return r.sort((e,t)=>n?t-e:e-t),r[i-1]}function na(e,t){let n=H(t.scalar(e[0])),r=ea(e[1],t),i=e.length>2&&H(t.scalar(e[2]))!==0;if(!r.includes(n))throw L.NA;let a=1;for(let e of r)(i?e<n:e>n)&&a++;return a}function ra(e,t){if(e instanceof V)throw L.VALUE;return t.toArray(e)}function ia(e,t,n,r){return e instanceof z?r.toArray(new z(e.sheet,e.r0,e.c0,e.r0+t-1,e.c0+n-1)):ra(e,r)}function aa(e,t,n,r){let i=[],a=[];for(let e=0;e<t.length;e+=2)i.push(e===0&&r?r:ra(t[e],n)),a.push(ai(n.scalar(t[e+1])));let o=i[0].length,s=i[0][0].length;for(let e of i)if(e.length!==o||e[0].length!==s)throw L.VALUE;if(e&&(e.length!==o||e[0].length!==s))throw L.VALUE;let c=[];for(let t=0;t<o;t++)for(let n=0;n<s;n++){let r=!0;for(let e=0;r&&e<i.length;e++)r=a[e](i[e][t][n]);r&&c.push(!e||e[t][n])}return c}function oa(e){let t=[];for(let n of e)if(typeof n==`number`)t.push(n);else if(n instanceof I)throw n;return t}function sa(e,t){let n=ra(e[0],t);return oa(aa(e.length>2&&e[2]!==null?ia(e[2],n.length,n[0].length,t):n,[e[0],e[1]],t,n))}function ca(e,t){if(e.length%2==0)throw L.VALUE;return oa(aa(ra(e[0],t),e.slice(1),t))}function la(e,t){let n=e.map(e=>ra(e,t)),r=n[0].length,i=n[0][0].length;for(let e of n)if(e.length!==r||e[0].length!==i)throw L.VALUE;let a=0;for(let e=0;e<r;e++)for(let t=0;t<i;t++){let r=1;for(let i of n){let n=i[e][t];if(n instanceof I)throw n;r*=typeof n==`number`?n:0}a+=r}return a}function ua(e,t){if(!e.length)return 0;let n=e[0];for(let r of e)(t?r>n:r<n)&&(n=r);return n}const da={SUM:J(0,K,(e,t)=>{let n=0;return ui(e,t,e=>n+=e),n}),PRODUCT:J(0,K,(e,t)=>{let n=Y(e,t);return n.length?n.reduce((e,t)=>e*t,1):0}),AVERAGE:J(1,K,(e,t)=>Xi(Y(e,t))),MIN:J(1,K,(e,t)=>{let n=K;return ui(e,t,e=>n=Math.min(n,e)),n===K?0:n}),MAX:J(1,K,(e,t)=>{let n=-1/0;return ui(e,t,e=>n=Math.max(n,e)),n===-1/0?0:n}),COUNT:J(0,K,(e,t)=>{let n=0;for(let r of e)li(r,t,e=>typeof e==`number`&&n++,e=>(typeof e==`number`||typeof e==`boolean`||typeof e==`string`&&Kr(e)!==null)&&n++);return n}),COUNTA:J(1,K,(e,t)=>{let n=0;for(let r of e)li(r,t,e=>e!==null&&n++,()=>n++);return n}),COUNTBLANK:J(1,1,([e],t)=>{if(e instanceof z){let n=0,r=0;return t.forEach(e,e=>{n++,(e===null||e===``)&&r++}),r+(e.h*e.w-n)}if(e instanceof B)return di(e.data).filter(e=>e===null||e===``).length;throw L.VALUE}),MEDIAN:J(1,K,(e,t)=>Qi(Y(e,t))),MODE:J(1,K,(e,t)=>$i(Y(e,t))),"MODE.SNGL":J(1,K,(e,t)=>$i(Y(e,t))),STDEV:J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!0))),"STDEV.S":J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!0))),"STDEV.P":J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!1))),STDEVP:J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!1))),VAR:J(1,K,(e,t)=>Zi(Y(e,t),!0)),"VAR.S":J(1,K,(e,t)=>Zi(Y(e,t),!0)),"VAR.P":J(1,K,(e,t)=>Zi(Y(e,t),!1)),VARP:J(1,K,(e,t)=>Zi(Y(e,t),!1)),LARGE:J(2,2,(e,t)=>ta(e,t,!0)),SMALL:J(2,2,(e,t)=>ta(e,t,!1)),RANK:J(2,3,na),"RANK.EQ":J(2,3,na),SUMPRODUCT:J(1,K,la),SUMIF:J(2,3,(e,t)=>Yi(sa(e,t))),SUMIFS:J(3,K,(e,t)=>Yi(ca(e,t))),AVERAGEIF:J(2,3,(e,t)=>Xi(sa(e,t))),AVERAGEIFS:J(3,K,(e,t)=>Xi(ca(e,t))),COUNTIF:J(2,2,(e,t)=>aa(null,e,t).length),COUNTIFS:J(2,K,(e,t)=>{if(e.length%2)throw L.VALUE;return aa(null,e,t).length}),MINIFS:J(3,K,(e,t)=>ua(ca(e,t),!1)),MAXIFS:J(3,K,(e,t)=>ua(ca(e,t),!0))},fa=32767;function pa(e){let t=Math.trunc(e);if(t<0)throw L.VALUE;return t}function ma(e){let t=``,n=!1;for(let r of e){let e=r.toLowerCase()!==r.toUpperCase();t+=e?n?r.toLowerCase():r.toUpperCase():r,n=e}return t}function ha(e,t,n,r){if(n<1||n>t.length+1)throw L.VALUE;if(e===``)return n;if(!r){let r=t.indexOf(e,n-1);if(r<0)throw L.VALUE;return r+1}let i=ni(e,!1).exec(t.slice(n-1));if(!i)throw L.VALUE;return i.index+n}const ga={CONCATENATE:q(1,K,e=>e.map(W).join(``)),CONCAT:J(1,K,(e,t)=>{let n=``,r=e=>n+=W(e);for(let n of e)li(n,t,r,r);if(n.length>fa)throw L.VALUE;return n}),TEXTJOIN:J(3,K,(e,t)=>{let n=W(t.scalar(e[0])),r=Zr(t.scalar(e[1])),i=[],a=e=>{let t=W(e);r&&t===``||i.push(t)};for(let n of e.slice(2))li(n,t,a,a);let o=i.join(n);if(o.length>fa)throw L.VALUE;return o}),LEFT:q(1,2,e=>W(e[0]).slice(0,pa(X(e,1,1)))),RIGHT:q(1,2,e=>{let t=W(e[0]);return t.slice(Math.max(0,t.length-pa(X(e,1,1))))}),MID:q(3,3,([e,t,n])=>{let r=Math.trunc(H(t));if(r<1)throw L.VALUE;return W(e).substr(r-1,pa(H(n)))}),LEN:q(1,1,([e])=>W(e).length),UPPER:q(1,1,([e])=>W(e).toUpperCase()),LOWER:q(1,1,([e])=>W(e).toLowerCase()),PROPER:q(1,1,([e])=>ma(W(e))),TRIM:q(1,1,([e])=>W(e).replace(/ {2,}/g,` `).replace(/^ | $/g,``)),SUBSTITUTE:q(3,4,e=>{let t=W(e[0]),n=W(e[1]),r=W(e[2]);if(n===``)return t;if(e.length<4)return t.split(n).join(r);let i=Math.trunc(H(e[3]));if(i<1)throw L.VALUE;let a=-1;for(let e=0;e<i;e++)if(a=t.indexOf(n,a+(e?n.length:1)),a<0)return t;return t.slice(0,a)+r+t.slice(a+n.length)}),REPLACE:q(4,4,([e,t,n,r])=>{let i=W(e),a=Math.trunc(H(t));if(a<1)throw L.VALUE;let o=pa(H(n));return i.slice(0,a-1)+W(r)+i.slice(a-1+o)}),REPT:q(2,2,([e,t])=>{let n=W(e),r=pa(H(t));if(n.length*r>fa)throw L.VALUE;return n.repeat(r)}),FIND:q(2,3,e=>ha(W(e[0]),W(e[1]),Math.trunc(X(e,2,1)),!1)),SEARCH:q(2,3,e=>ha(W(e[0]),W(e[1]),Math.trunc(X(e,2,1)),!0)),EXACT:q(2,2,([e,t])=>W(e)===W(t)),VALUE:q(1,1,([e])=>{if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e!=`string`)throw e instanceof I?e:L.VALUE;let t=Kr(e);if(t===null)throw L.VALUE;return t}),TEXT:q(2,2,([e,t])=>Vi(e,W(t))),CHAR:q(1,1,([e])=>{let t=Math.trunc(H(e));if(t<1||t>255)throw L.VALUE;return String.fromCharCode(t)}),CODE:q(1,1,([e])=>{let t=W(e);if(!t)throw L.VALUE;return t.charCodeAt(0)})},_a={...Ji,...da,...Si,...ga,...vi,...Ri,SINGLE:{kind:`eager`,min:1,max:1,scalarArgs:!1,fn:([e],t)=>t.scalar(e)}};function va(e,t,n){let r;switch(e){case`+`:r=t+n;break;case`-`:r=t-n;break;case`*`:r=t*n;break;case`/`:if(n===0)return L.DIV0;r=t/n;break;default:if(t===0&&n===0)return L.NUM;if(t===0&&n<0)return L.DIV0;r=t**+n}return Number.isFinite(r)?r:L.NUM}function ya(e,t,n){if(t instanceof I)return t;if(n instanceof I)return n;switch(e){case`&`:return Yr(t)+Yr(n);case`=`:return G(t,n)===0;case`<>`:return G(t,n)!==0;case`<`:return G(t,n)<0;case`>`:return G(t,n)>0;case`<=`:return G(t,n)<=0;case`>=`:return G(t,n)>=0}let r=Jr(t);if(r instanceof I)return r;let i=Jr(n);return i instanceof I?i:va(e,r,i)}function ba(e,t){return Array.isArray(e)?new B(e.map(e=>e.map(t))):t(e)}function xa(e,t,n){if(!Array.isArray(e)&&!Array.isArray(t))return n(e,t);let r=Array.isArray(e)?e:[[e]],i=Array.isArray(t)?t:[[t]],a=Math.max(r.length,i.length),o=Math.max(r[0].length,i[0].length),s=[];for(let e=0;e<a;e++){let t=[];for(let a=0;a<o;a++)t.push(n(si(r,e,a),si(i,e,a)));s.push(t)}return new B(s)}var Sa=class{constructor(e){w(this,`provider`,void 0),w(this,`sheet`,void 0),w(this,`r`,void 0),w(this,`c`,void 0),this.provider=e.provider,this.sheet=e.sheet,this.r=e.r,this.c=e.c}eval(e,t){switch(e.type){case`num`:case`str`:case`bool`:return e.value;case`err`:return new I(e.code);case`missing`:return null;case`name`:return L.NAME;case`array`:return new B(e.rows);case`ref`:return this.ref(e.ref);case`range`:return this.rangeOp(e.left,e.right);case`union`:{let t=[];for(let n of e.items){let e=this.eval(n,!1);if(e instanceof z)t.push(e);else if(e instanceof V)t.push(...e.areas);else return e instanceof I?e:L.VALUE}return new V(t)}case`unary`:{let n=this.operand(this.eval(e.arg,t),t);return e.op===`+`?Array.isArray(n)?new B(n):n:ba(n,e=>{let t=Jr(e);return t instanceof I?t:t===0?0:-t})}case`percent`:return ba(this.operand(this.eval(e.arg,t),t),e=>{let t=Jr(e);return t instanceof I?t:t/100});case`binary`:{let n=this.operand(this.eval(e.left,t),t),r=this.operand(this.eval(e.right,t),t),i=e.op;return xa(n,r,(e,t)=>ya(i,e,t))}case`call`:return this.call(e.name,e.args,t)}}ref(e){return e.sheet!==void 0&&!this.hasSheet(e.sheet)?L.REF:new z(e.sheet??this.sheet,e.r0,e.c0,e.r1,e.c1)}rangeOp(e,t){let n=this.eval(e,!1);if(n instanceof I)return n;let r=this.eval(t,!1);return r instanceof I?r:!(n instanceof z)||!(r instanceof z)||!Yn(n.sheet,r.sheet)?L.VALUE:new z(n.sheet,Math.min(n.r0,r.r0),Math.min(n.c0,r.c0),Math.max(n.r1,r.r1),Math.max(n.c1,r.c1))}call(e,t,n){if(!Object.hasOwn(_a,e))return L.NAME;let r=_a[e];if(t.length<r.min||t.length>r.max)return L.VALUE;if(r.kind===`lazy`)return oi(()=>r.fn(t,this,n));let i=t.map(e=>this.eval(e,r.scalarArgs&&n));return oi(()=>r.fn(i,this,n))}hasSheet(e){return!this.provider.hasSheet||this.provider.hasSheet(e)}now(){return this.provider.now?.()??/* @__PURE__ */ new Date}cell(e,t,n){let r=this.provider.value(e,t,n);return r===void 0?null:r}clip(e){let{r1:t,c1:n}=e;if((t===1048575||n===16383)&&this.provider.bounds){let r=this.provider.bounds(e.sheet);t===1048575&&(t=Math.max(e.r0,Math.min(t,r.rows-1))),n===16383&&(n=Math.max(e.c0,Math.min(n,r.cols-1)))}return{r1:t,c1:n}}forEach(e,t){let{r1:n,c1:r}=this.clip(e);for(let i=e.r0;i<=n;i++)for(let n=e.c0;n<=r;n++)t(this.cell(e.sheet,i,n),i-e.r0,n-e.c0)}toArray(e){if(e instanceof z){let{r1:t,c1:n}=this.clip(e),r=[];for(let i=e.r0;i<=t;i++){let t=[];for(let r=e.c0;r<=n;r++)t.push(this.cell(e.sheet,i,r));r.push(t)}return r}if(e instanceof B)return e.data;if(e instanceof V)throw L.VALUE;return[[e]]}intersect(e){return e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):e.w===1&&this.r>=e.r0&&this.r<=e.r1?this.cell(e.sheet,this.r,e.c0):e.h===1&&this.c>=e.c0&&this.c<=e.c1?this.cell(e.sheet,e.r0,this.c):L.VALUE}scalar(e){return e instanceof z?this.intersect(e):e instanceof B?e.data[0][0]:e instanceof V?L.VALUE:e}operand(e,t){return e instanceof z?e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):t?this.intersect(e):this.toArray(e):e instanceof B?e.h===1&&e.w===1?e.data[0][0]:e.data:e instanceof V?L.VALUE:e}};function Ca(e,t){let n=Tr();Er(!!t.provider.date1904);try{let n=new Sa(t),r=n.eval(e,!0),i=r instanceof z?n.intersect(r):r instanceof B?r.data[0][0]:r instanceof V?L.VALUE:r;return i===null?0:typeof i==`number`?Number.isFinite(i)?i+0:L.NUM:i}catch(e){return e instanceof I?e:L.VALUE}finally{Er(n)}}function wa(e,t){let n=e.startsWith(`=`)?`=`:``,r=e.slice(n.length),i;try{i=gr(r)}catch{return e}let a=n,o=0;for(let e of i){let n=t(e);n!==void 0&&(a+=r.slice(o,e.s)+n,o=e.e)}return a+r.slice(o)}const Ta=e=>(e.ref.sheet===void 0?``:`${e.sheetText??Xn(e.ref.sheet)}!`)+`#REF!`;function Ea(e,t,n){return!t&&!n?e:wa(e,e=>{if(e.t!==`ref`)return;let r={...e.ref};return r.kind!==`cols`&&(r.ar0||(r.r0+=t),r.ar1||(r.r1+=t)),r.kind!==`rows`&&(r.ac0||(r.c0+=n),r.ac1||(r.c1+=n)),er(r)?Qn($n(r),e.sheetText):Ta(e)})}function Da(e,t,n,r,i){if(r>0)return e>=n&&(e+=r),t>=n&&(t+=r),e>i?null:[e,Math.min(t,i)];let a=-r,o=n+a;return t<n?[e,t]:e>=o?[e-a,t-a]:e>=n&&t<o?null:[e<n?e:n,t>=o?t-a:n-1]}function Oa(e,t){if(!t.delta)return e;let n=e=>{if(t.sheet===void 0)return e===void 0||t.formulaSheet!==void 0&&Yn(e,t.formulaSheet);let n=e??t.formulaSheet;return n===void 0||Yn(n,t.sheet)};return wa(e,e=>{if(e.t!==`ref`||!n(e.ref.sheet))return;let r={...e.ref};if(t.axis===`row`){if(r.kind===`cols`)return;let n=Da(r.r0,r.r1,t.at,t.delta,Gn);if(!n)return Ta(e);[r.r0,r.r1]=n}else{if(r.kind===`rows`)return;let n=Da(r.c0,r.c1,t.at,t.delta,Kn);if(!n)return Ta(e);[r.c0,r.c1]=n}if(r.r0!==e.ref.r0||r.r1!==e.ref.r1||r.c0!==e.ref.c0||r.c1!==e.ref.c1)return Qn(r,e.sheetText)})}function ka(e,t,n){let r=`${Xn(n)}!`;return wa(e,e=>{if(e.t===`ref`&&e.ref.sheet!==void 0&&Yn(e.ref.sheet,t))return Qn({...e.ref,sheet:n});if((e.t===`err`||e.t===`name`)&&e.sheet!==void 0&&Yn(e.sheet,t))return r+e.v})}function Aa(e){let t=e.sheet===void 0?{}:{sheet:e.sheet};return e.kind===`cell`?{...t,r:e.r0,c:e.c0,absR:e.ar0,absC:e.ac0}:{...t,r0:e.r0,c0:e.c0,r1:e.r1,c1:e.c1}}function ja(e){let t=[],n=e=>{switch(e.type){case`ref`:t.push(Aa(e.ref));break;case`range`:if(e.left.type===`ref`&&e.right.type===`ref`&&Yn(e.left.ref.sheet,e.right.ref.sheet)){let n=e.left.ref,r=e.right.ref;t.push(Aa({...n,kind:`area`,r0:Math.min(n.r0,r.r0),c0:Math.min(n.c0,r.c0),r1:Math.max(n.r1,r.r1),c1:Math.max(n.c1,r.c1)}))}else n(e.left),n(e.right);break;case`unary`:case`percent`:n(e.arg);break;case`binary`:n(e.left),n(e.right);break;case`union`:e.items.forEach(n);break;case`call`:e.args.forEach(n)}};return n(e),t}const Ma=(e,t)=>`${e}:${t}`;var Na=class{constructor(e){w(this,`wb`,void 0),w(this,`asts`,/* @__PURE__ */ new Map),w(this,`cellDeps`,/* @__PURE__ */ new Map),w(this,`rangeDeps`,[]),w(this,`indexed`,!1),w(this,`cur`,0),this.wb=e}invalidate(){this.indexed=!1,this.asts.clear(),this.cellDeps.clear(),this.rangeDeps=[]}sheetIndex(e,t){return e?this.wb.sheets.findIndex(t=>t.name.toLowerCase()===e.toLowerCase()):t}ast(e,t){let n=Ma(e,t),r=this.asts.get(n);if(r===void 0){let i=this.wb.sheetsData.get(e)?.formulas.get(t);try{r=i?br(i):null}catch{r=null}this.asts.set(n,r)}return r}index(){if(!this.indexed){this.indexed=!0;for(let[e,t]of this.wb.sheetsData)for(let n of t.formulas.keys())this.addDeps(e,n)}}addDeps(e,t){let n=this.ast(e,t);if(!n)return;let r=Ma(e,t);for(let t of ja(n)){let n=this.sheetIndex(t.sheet,e);if(!(n<0)){if(`r`in t){let e=Ma(n,t.r*Q+t.c),i=this.cellDeps.get(e);i||this.cellDeps.set(e,i=/* @__PURE__ */ new Set),i.add(r)}else this.rangeDeps.push({sheet:n,r0:t.r0,c0:t.c0,r1:t.r1,c1:t.c1,dep:r})}}}formulaChanged(e,t){if(!this.indexed)return;let n=Ma(e,t);this.asts.delete(n);for(let e of this.cellDeps.values())e.delete(n);this.rangeDeps=this.rangeDeps.filter(e=>e.dep!==n),this.addDeps(e,t)}value(e,t,n){let r=this.wb.sheetsData.get(e)?.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4){if(r[e]!==n)continue;let t=r[e+1],i=r[e+2];switch(t){case 0:return i;case 1:return this.wb.sst[i]??``;case 2:return String(i);case 3:return!!i;case 4:return new I(String(i));case 6:return null;default:return String(i)}}return null}provider(e,t){return{value:(n,r,i)=>{let a=this.sheetIndex(n,this.cur);if(a<0)return new I(`#REF!`);let o=Ma(a,r*Q+i);return t.has(o)?new I(`#REF!`):(e.has(o)&&this.compute(o,e,t),this.value(a,r,i))},bounds:e=>{let t=this.wb.sheetsData.get(this.sheetIndex(e,this.cur));return{rows:(t?.maxRow??-1)+1,cols:(t?.maxCol??-1)+1}},hasSheet:e=>this.sheetIndex(e,-1)>=0,date1904:this.wb.date1904}}compute(e,t,n){t.delete(e);let[r,i]=e.split(`:`).map(Number),a=this.wb.sheetsData.get(r);if(!a||!a.formulas.has(i))return;if(n.has(e)){Pa(a,i,new I(`#REF!`));return}n.add(e);let o=this.ast(r,i),s=this.cur;this.cur=r;let c;try{c=o?Ca(o,{provider:this.provider(t,n),sheet:this.wb.sheets[r]?.name,r:Math.floor(i/Q),c:i%Q}):new I(`#NAME?`)}catch{c=new I(`#VALUE!`)}this.cur=s,n.delete(e),Pa(a,i,c)}recalc(e,t=[]){this.index();let n=/* @__PURE__ */ new Set,r=[],i=e=>{n.has(e)||(n.add(e),r.push(e))};for(let e of t)i(Ma(e.sheet,e.key));let a=/* @__PURE__ */ new Set,o=e=>{if(a.has(e))return;a.add(e);let[t,n]=e.split(`:`).map(Number),r=Math.floor(n/Q),s=n%Q;for(let t of this.cellDeps.get(e)??[])i(t),o(t);for(let e of this.rangeDeps)e.sheet===t&&r>=e.r0&&r<=e.r1&&s>=e.c0&&s<=e.c1&&(i(e.dep),o(e.dep))};for(let t of e)o(Ma(t.sheet,t.key));for(let e of t)o(Ma(e.sheet,e.key));let s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set;for(let e of r)n.has(e)&&(this.compute(e,n,c),s.add(Number(e.split(`:`)[0])));return s}computeMissing(e,t){t.length&&this.recalc([],t.map(t=>({sheet:e,key:t})))}};function Pa(e,t,n){let r=Math.floor(t/Q),i=t%Q,a=e.rows[r];a||(e.rows[r]=a=[]);let o,s;n instanceof I?(o=4,s=n.code):typeof n==`number`?(o=0,s=Number.isFinite(n)?n:0):typeof n==`boolean`?(o=3,s=+!!n):n===null?(o=0,s=0):(o=2,s=n);for(let e=0;e<a.length;e+=4)if(a[e]===i){a[e+1]=o,a[e+2]=s;return}let c=0;for(;c<a.length&&a[c]<i;)c+=4;a.splice(c,0,i,o,s,0)}const Fa={0:`General`,1:`0`,2:`0.00`,3:`#,##0`,4:`#,##0.00`,9:`0%`,10:`0.00%`,11:`0.00E+00`,12:`# ?/?`,13:`# ??/??`,14:`m/d/yyyy`,15:`d-mmm-yy`,16:`d-mmm`,17:`mmm-yy`,18:`h:mm AM/PM`,19:`h:mm:ss AM/PM`,20:`h:mm`,21:`h:mm:ss`,22:`m/d/yyyy h:mm`,37:`#,##0 ;(#,##0)`,38:`#,##0 ;[Red](#,##0)`,39:`#,##0.00;(#,##0.00)`,40:`#,##0.00;[Red](#,##0.00)`,45:`mm:ss`,46:`[h]:mm:ss`,47:`mmss.0`,48:`##0.0E+0`,49:`@`,27:`yyyy"年"m"月"`,30:`m/d/yy`,31:`yyyy"年"m"月"d"日"`,50:`yyyy"年"m"月"`,57:`yyyy"年"m"月"`,58:`m"月"d"日"`},Ia={black:`#000000`,red:`#ff0000`,green:`#00a000`,blue:`#0000ff`,yellow:`#c0c000`,magenta:`#ff00ff`,cyan:`#00c0c0`,white:`#ffffff`},La=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Ra=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function za(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`\\\\`&&!r?(n+=o+(e[a+1]??``),a++):(o===`"`?r=!r:!r&&o===`[`?i=!0:!r&&o===`]`&&(i=!1),o===`;`&&!r&&!i?(t.push(n),n=``):n+=o)}return t.push(n),t}function Ba(e){let t=[],n,r,i=!1,a=0,o=e=>{let n=t[t.length-1];n?.k===`lit`?n.v+=e:t.push({k:`lit`,v:e})},s=e.toLowerCase();for(;a<e.length;){let c=e[a],l=s[a];if(c===`"`){let t=e.indexOf(`"`,a+1);o(e.slice(a+1,t<0?void 0:t)),a=t<0?e.length:t+1}else if(c===`\\\\`)o(e[a+1]??``),a+=2;else if(c===`_`)o(` `),a+=2;else if(c===`*`)a+=2;else if(c===`[`){let s=e.indexOf(`]`,a),c=e.slice(a+1,s<0?void 0:s),l=c.toLowerCase();if(Ia[l])n=Ia[l];else if(/^color\\s*\\d+$/.test(l))n=void 0;else if(/^(h+|m+|s+)$/.test(l))t.push({k:`elapsed`,v:l[0]}),i=!0;else if(c.startsWith(`$`)){let e=c.slice(1).split(`-`)[0];e&&o(e)}else{let e=/^(<=|>=|<>|<|>|=)\\s*(-?[\\d.]+)$/.exec(c);e&&(r={op:e[1],v:Number(e[2])})}a=s<0?e.length:s+1}else if(c===`0`||c===`#`||c===`?`)t.push({k:`digit`,v:c}),a++;else if(c===`.`){if(i&&e[a+1]===`0`){let n=a+1;for(;e[n]===`0`;)n++;t.push({k:`date`,v:e.slice(a,n)}),a=n}else t.push({k:`dot`}),a++}else if(c===`,`)t.push({k:`comma`}),a++;else if(c===`%`)t.push({k:`pct`}),a++;else if(l===`e`&&(e[a+1]===`+`||e[a+1]===`-`))t.push({k:`exp`,sign:e[a+1]===`+`}),a+=2;else if(c===`/`&&t.some(e=>e.k===`digit`))t.push({k:`slash`}),a++;else if(c===`@`)t.push({k:`text`}),a++;else if(s.startsWith(`am/pm`,a))t.push({k:`date`,v:`AM/PM`}),i=!0,a+=5;else if(s.startsWith(`a/p`,a))t.push({k:`date`,v:`A/P`}),i=!0,a+=3;else if(`ymdhs`.includes(l)||l===`g`&&s.startsWith(`ge`,a)||l===`b`){let e=a;for(;s[e]===l;)e++;l===`b`||l===`g`?o(``):(t.push({k:`date`,v:s.slice(a,e)}),i=!0),a=e}else o(c),a++}return{toks:t,color:n,isDate:i,cond:r,hasDigits:t.some(e=>e.k===`digit`)}}const Va=/* @__PURE__ */ new Map;function Ha(e){let t=Va.get(e);return t||(t=za(e).map(Ba),Va.size>2e3&&Va.clear(),Va.set(e,t)),t}function Ua(e){return!e||e===`General`?!1:Ha(e)[0].isDate}function Wa(e){if(!Number.isFinite(e)||Number.isInteger(e)&&Math.abs(e)<1e11)return String(e);let t=Math.abs(e);if(t>=1e11||t<1e-9&&t!==0){let[t,n]=e.toExponential(5).split(`e`);return(t.includes(`.`)?t.replace(/0+$/,``).replace(/\\.$/,``):t)+`E`+(n[0]===`-`?`-`:`+`)+n.replace(/^[+-]/,``).padStart(2,`0`)}let n=Math.max(0,10-Math.floor(Math.log10(t||1))),r=e.toFixed(Math.min(n,15));return r.includes(`.`)&&(r=r.replace(/0+$/,``).replace(/\\.$/,``)),r}function Ga(e){return e.replace(/\\B(?=(\\d{3})+(?!\\d))/g,`,`)}function Ka(e,t){let n=t.toks,r=Math.abs(e),i=n.filter(e=>e.k===`pct`).length;r*=100**i;let a=n.findIndex(e=>e.k===`dot`),o=n.findIndex(e=>e.k===`exp`),s=n.findIndex(e=>e.k===`slash`),c=n.findIndex(e=>e.k===`digit`),l=-1;n.forEach((e,t)=>e.k===`digit`&&(l=t));let u=0;for(let e=l+1;e<n.length&&n[e].k===`comma`;e++)u++;r/=1e3**u;let d=n.some((e,t)=>e.k===`comma`&&t>c&&t<l);if(s>=0)return qa(r,t,e<0);let f=a>=0?a:o>=0?o:l+1,p=a>=0?n.slice(a+1,o>=0?o:void 0).filter(e=>e.k===`digit`):[],m=p.length,h=r,g=0;if(o>=0){let e=n.slice(0,f).filter(e=>e.k===`digit`).length||1;h!==0&&(g=Math.floor(Math.log10(h)),e>1&&(g=Math.floor(g/e)*e),h/=10**g)}let _=h.toFixed(m);o>=0&&Number(_)>=10&&n.slice(0,f).filter(e=>e.k===`digit`).length<=1&&(g+=1,_=(h/10).toFixed(m));let[v,y=``]=_.split(`.`);if(m){let e=y.split(``);for(let t=m-1;t>=0&&e[t]===`0`;t--){let n=p[t].v;if(n===`#`)e[t]=``;else if(n===`?`)e[t]=` `;else break}y=e.join(``)}let b=n.slice(0,f),x=b.filter(e=>e.k===`digit`).filter(e=>e.v===`0`).length;for(v===`0`&&x===0&&(v=``);v.length<x;)v=`0`+v;let S=b.some((e,t)=>e.k===`lit`&&t>c&&t<f),C=``;if(S){let e=v,t=``;for(let r=f-1;r>=0;r--){let i=n[r];i.k===`digit`?(e.length?(t=e[e.length-1]+t,e=e.slice(0,-1)):i.v===`0`?t=`0`+t:i.v===`?`&&(t=` `+t),r===c&&e.length&&(t=e+t,e=``)):i.k===`lit`?t=i.v+t:i.k===`pct`&&(t=`%`+t)}C=t}else{let e=!1,t=d?Ga(v):v;for(let r=0;r<f;r++){let i=n[r];i.k===`digit`?e||(C+=t,e=!0):i.k===`lit`?C+=i.v:i.k===`pct`&&(C+=`%`)}e||(C+=t)}a>=0&&(C+=y.length||p.some(e=>e.v===`0`)?`.`+y:m?`.`:``);let w=o>=0?o:a>=0?a+1:f;for(let e=w;e<n.length;e++){let t=n[e];if(t.k===`exp`){let r=n.slice(e+1).filter(e=>e.k===`digit`).length||1;for(C+=`E`+(g<0?`-`:t.sign?`+`:``)+String(Math.abs(g)).padStart(r,`0`);e+1<n.length&&n[e+1].k===`digit`;)e++}else t.k===`lit`?C+=t.v:t.k===`pct`&&(C+=`%`)}return C}function qa(e,t,n){let r=t.toks,i=r.findIndex(e=>e.k===`slash`),a=r.slice(i+1).filter(e=>e.k===`digit`),o=r.slice(i+1).find(e=>e.k===`lit`&&/^\\d+$/.test(e.v.trim())),s=o?Number(o.v):10**(a.length||1)-1,c=r.slice(0,i).some(e=>e.k===`lit`&&e.v.includes(` `)),l=c?Math.floor(e):0,u=e-l,d=0,f=1;if(o)f=s,d=Math.round(u*s);else{let e=1/0;for(let t=1;t<=s;t++){let n=Math.round(u*t),r=Math.abs(u-n/t);r<e-1e-12&&(e=r,d=n,f=t)}}let p=n?`-`:``;return d===0?p+(c?String(l):`0`):d===f?p+String(l+1):p+(c&&l?l+` `:``)+d+`/`+f}function Ja(e,t=!1){let n=Math.floor(e),r=Math.round((e-n)*864e5),i;return t?i=Date.UTC(1904,0,1):n<60?i=Date.UTC(1899,11,31):(i=Date.UTC(1899,11,30),n===60&&(n=61)),new Date(i+n*864e5+r)}function Ya(e,t,n){let r=Ja(e,n),i=t.toks,a=i.some(e=>e.k===`date`&&(e.v===`AM/PM`||e.v===`A/P`)),o=r.getUTCFullYear(),s=r.getUTCMonth(),c=r.getUTCDate(),l=r.getUTCHours(),u=r.getUTCMinutes(),d=r.getUTCSeconds(),f=r.getUTCMilliseconds(),p=(e,t=2)=>String(e).padStart(t,`0`),m=``,h=e=>{for(let t=e-1;t>=0;t--){let e=i[t];if(e.k===`date`)return e.v[0]===`h`;if(e.k===`elapsed`)return e.v===`h`}for(let t=e+1;t<i.length;t++){let e=i[t];if(e.k===`date`)return e.v[0]===`s`;if(e.k===`elapsed`)return e.v===`s`}return!1};return i.forEach((t,n)=>{if(t.k===`lit`)return m+=t.v;if(t.k===`elapsed`){let n=e*86400;t.v===`h`?m+=Math.floor(n/3600):t.v===`m`?m+=Math.floor(n/60):m+=Math.round(n);return}if(t.k!==`date`){t.k===`digit`?m+=t.v===`0`?`0`:``:t.k===`dot`?m+=`.`:t.k===`comma`?m+=`,`:t.k===`pct`?m+=`%`:t.k===`slash`&&(m+=`/`);return}let i=t.v;switch(i[0]){case`y`:m+=i.length<=2?p(o%100):String(o);break;case`m`:i.length<=2&&h(n)?m+=i.length===2?p(u):String(u):i.length===1?m+=s+1:i.length===2?m+=p(s+1):i.length===3?m+=La[s].slice(0,3):i.length===5?m+=La[s][0]:m+=La[s];break;case`d`:i.length===1?m+=c:i.length===2?m+=p(c):i.length===3?m+=Ra[r.getUTCDay()].slice(0,3):m+=Ra[r.getUTCDay()];break;case`h`:{let e=l;a&&(e=e%12||12),m+=i.length>=2?p(e):String(e);break}case`s`:m+=i.length>=2?p(d):String(d);break;case`.`:m+=`.`+p(Math.floor(f/10**(3-(i.length-1))),i.length-1);break;case`A`:m+=i===`AM/PM`?l<12?`AM`:`PM`:l<12?`A`:`P`}}),m}function Xa(e,t,n=!1){if(!t||t===`General`||t===`general`)return{text:Wa(e)};let r=Ha(t),i=r[0],a=e;if(r.some(e=>e.cond)?i=r.find(t=>{if(!t.cond)return!1;let{op:n,v:r}=t.cond;return n===`<`?e<r:n===`<=`?e<=r:n===`>`?e>r:n===`>=`?e>=r:n===`=`?e===r:e!==r})??r.find(e=>!e.cond)??r[0]:r.length>=3&&e===0&&r[2].toks.length?i=r[2]:r.length>=2&&e<0&&r[1].toks.length&&(i=r[1],a=-e),i.isDate)return e<0||e>2958465?{text:`#`.repeat(8)}:{text:Ya(e,i,n),color:i.color};if(!i.hasDigits){let t=i.toks.map(e=>e.k===`lit`?e.v:e.k===`pct`?`%`:e.k===`text`?Wa(a):``).join(``);return i.toks.some(e=>e.k===`text`)||t?{text:t,color:i.color}:{text:Wa(e),color:i.color}}let o=a<0,s=Ka(a,i);return o&&(s=`-`+s),{text:s,color:i.color}}function Za(e,t){if(!t||!t.includes(`@`))return e;let n=Ha(t),r=n.length>=4?n[3]:n.find(e=>e.toks.some(e=>e.k===`text`));return r?r.toks.map(t=>t.k===`lit`?t.v:t.k===`text`?e:``).join(``):e}const Qa={thin:[1,`solid`],medium:[2,`solid`],thick:[3,`solid`],dashed:[1,`dashed`],dotted:[1,`dotted`],double:[3,`double`],hair:[1,`dotted`],mediumDashed:[2,`dashed`],dashDot:[1,`dashed`],mediumDashDot:[2,`dashed`],dashDotDot:[1,`dotted`],mediumDashDotDot:[2,`dotted`],slantDashDot:[2,`dashed`]};function $a(e,t){let n=mn(e),r=e=>pn(e,t,n),i=/* @__PURE__ */ new Map;for(let t of O(D(e,`numFmts`),`numFmt`))i.set(Number(t.a.numFmtId),t.a.formatCode??`General`);let a=O(D(e,`fonts`),`font`).map(e=>({b:j(D(e,`b`)),i:j(D(e,`i`)),u:D(e,`u`)?D(e,`u`).a.val??`single`:void 0,strike:j(D(e,`strike`)),sz:A(D(e,`sz`)?.a.val),color:r(D(e,`color`)),name:D(e,`name`)?.a.val})),o=O(D(e,`fills`),`fill`).map(e=>{let t=D(e,`patternFill`);if(t){let e=t.a.patternType;return!e||e===`none`?void 0:e===`solid`?r(D(t,`fgColor`))??r(D(t,`bgColor`)):r(D(t,`fgColor`))??`#d9d9d9`}let n=D(e,`gradientFill`);if(n){let e=O(n,`stop`).map(e=>r(D(e,`color`))).filter(Boolean);return e.length>=2?`linear-gradient(${A(n.a.degree,90)+90}deg, ${e.join(`, `)})`:e[0]}}),s=O(D(e,`borders`),`border`).map(e=>{let t={},n=(e,n)=>{let i=e?.a.style;if(!i||i===`none`)return;let[a,o]=Qa[i]??[1,`solid`];t[n]=`${a}px ${o} ${r(D(e,`color`))??`#000`}`};return n(D(e,`left`)??D(e,`start`),`borderLeft`),n(D(e,`right`)??D(e,`end`),`borderRight`),n(D(e,`top`),`borderTop`),n(D(e,`bottom`),`borderBottom`),t}),c=a[0]??{},l={fontFamily:Le(c.name??`Calibri`),fontSize:`${c.sz??11}pt`,color:c.color??`#000000`},u=O(D(e,`cellXfs`),`xf`).map(e=>{let t={},n=A(e.a.numFmtId,0),r=a[A(e.a.fontId,0)];if(r){r.b&&(t.fontWeight=700),r.i&&(t.fontStyle=`italic`);let e=[r.u&&r.u!==`none`?`underline`:``,r.strike?`line-through`:``].filter(Boolean).join(` `);e&&(t.textDecoration=e),(r.u===`double`||r.u===`doubleAccounting`)&&(t.textDecorationStyle=`double`),r.sz&&r.sz!==c.sz&&(t.fontSize=`${r.sz}pt`),r.color&&r.color!==c.color&&(t.color=r.color),r.name&&r.name!==c.name&&(t.fontFamily=Le(r.name))}let l=o[A(e.a.fillId,0)];l&&(t.background=l),Object.assign(t,s[A(e.a.borderId,0)]);let u=D(e,`alignment`),d,f=!1;if(u){let e=u.a.horizontal;e&&e!==`general`&&(d=e,t.textAlign=e===`center`||e===`centerContinuous`?`center`:e===`right`?`right`:e===`justify`||e===`distributed`?`justify`:`left`);let n=u.a.vertical;t.alignItems=n===`top`?`flex-start`:n===`center`?`center`:`flex-end`,f=u.a.wrapText===`1`||u.a.wrapText===`true`,f&&(t.whiteSpace=`pre-wrap`);let r=A(u.a.indent);r&&(t[d===`right`?`paddingRight`:`paddingLeft`]=`${r*9+2}px`);let i=A(u.a.textRotation);i&&(t.textRotate=i===255?255:i>90?90-i:i)}return{numFmt:i.get(n)??Fa[n]??`General`,fontPt:r?.sz??c.sz??11,css:t,hAlign:d,wrap:f}});return u.length||u.push({numFmt:`General`,fontPt:c.sz??11,css:{},wrap:!1}),{xfs:u,baseFont:l}}const Q=16384,eo=e=>e.indexOf(`_x`)>=0?e.replace(/_x([0-9A-Fa-f]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16))):e;function to(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65)break;t=t*26+((r&-33)-64)}return t-1}function no(e){let t=``;for(e++;e>0;){let n=(e-1)%26;t=String.fromCharCode(65+n)+t,e=Math.floor((e-1)/26)}return t}function ro(e){let t=0;for(;t<e.length&&e.charCodeAt(t)>=65;)t++;return[Number(e.slice(t))-1,to(e.slice(0,t))]}function io(e){let[t,n]=e.replace(/\\$/g,``).split(`:`);if(!t)return;let[r,i]=ro(t),[a,o]=n?ro(n):[r,i];return{r0:r,c0:i,r1:a,c1:o}}var ao=class{constructor(){w(this,`shared`,/* @__PURE__ */ new Map),w(this,`depOf`,/* @__PURE__ */ new Map),w(this,`edited`,/* @__PURE__ */ new Set),w(this,`rowAttrs`,/* @__PURE__ */ new Map),w(this,`autoRowH`,/* @__PURE__ */ new Map),w(this,`structural`,!1),w(this,`dirtyCols`,!1),w(this,`dirtyMerges`,!1),w(this,`dirtyView`,!1),w(this,`dirtyRows`,/* @__PURE__ */ new Set),w(this,`formulaChanged`,!1),w(this,`uncached`,[]),w(this,`rows`,[]),w(this,`maxRow`,-1),w(this,`maxCol`,-1),w(this,`formulas`,/* @__PURE__ */ new Map),w(this,`merges`,[]),w(this,`colInfo`,[]),w(this,`defaultColW`,64),w(this,`defaultRowH`,20),w(this,`frozen`,{rows:0,cols:0}),w(this,`gridLines`,!0),w(this,`done`,!1),w(this,`error`,void 0),w(this,`loading`,void 0)}},oo=class{constructor(e,t=[],n=11){w(this,`d`,void 0),w(this,`fontPt`,void 0),w(this,`basePt`,void 0),w(this,`row`,-1),w(this,`rowCells`,null),w(this,`col`,-1),w(this,`cType`,``),w(this,`cStyle`,0),w(this,`val`,``),w(this,`formula`,``),w(this,`hasVal`,!1),w(this,`capture`,0),w(this,`fShared`,-1),w(this,`inIs`,!1),w(this,`newSizes`,[]),w(this,`headerReady`,!1),w(this,`rowHasHt`,!1),w(this,`rowMaxPt`,0),this.d=e,this.fontPt=t,this.basePt=n}open(e,t){switch(e){case`c`:{let e=t.r;this.col=e?ro(e)[1]:this.col+1,this.cType=t.t??``,this.cStyle=t.s?Number(t.s):0,this.val=``,this.formula=``,this.hasVal=!1;return}case`v`:this.capture=1,this.hasVal=!0;return;case`f`:this.capture=2,this.fShared=t.t===`shared`&&t.si!==void 0?Number(t.si):-1;return;case`is`:this.inIs=!0,this.hasVal=!0;return;case`t`:this.inIs&&(this.capture=3);return;case`rPh`:return!0;case`row`:{this.headerReady=!0,this.row=t.r?Number(t.r)-1:this.row+1,this.col=-1,this.rowCells=[];let e=t.hidden===`1`||t.hidden===`true`;if((e||t.ht)&&this.d.rowAttrs.set(this.row,{ht:t.ht?Number(t.ht):void 0,hidden:e||void 0}),this.rowHasHt=e||!!t.ht,this.rowMaxPt=0,e)this.newSizes.push([this.row,0]);else if(t.ht){let e=Math.round(Number(t.ht)*4/3);e!==this.d.defaultRowH&&this.newSizes.push([this.row,e])}return}case`sheetFormatPr`:{let e=A(t.defaultRowHeight);e&&(this.d.defaultRowH=Math.round(e*4/3));let n=A(t.defaultColWidth),r=A(t.baseColWidth);n?this.d.defaultColW=Math.round(n*7):r!==void 0&&(this.d.defaultColW=Math.round(r*7+8));return}case`col`:{let e=Number(t.min)-1,n=Math.min(Number(t.max)-1,16383),r=t.hidden===`1`||t.hidden===`true`?0:t.width?Math.round(Number(t.width)*7):this.d.defaultColW;this.d.colInfo.push({min:e,max:n,w:r});return}case`pane`:(t.state===`frozen`||t.state===`frozenSplit`)&&(this.d.frozen={rows:Math.round(A(t.ySplit,0)),cols:Math.round(A(t.xSplit,0))});return;case`sheetView`:(t.showGridLines===`0`||t.showGridLines===`false`)&&(this.d.gridLines=!1);return;case`sheetData`:this.headerReady=!0;return;case`mergeCell`:{let e=t.ref?io(t.ref):void 0;e&&this.d.merges.push(e);return}case`extLst`:case`conditionalFormatting`:case`dataValidations`:case`headerFooter`:return!0}}close(e){switch(e){case`v`:case`f`:case`t`:this.capture=0;return;case`is`:this.inIs=!1;return;case`c`:{let e=this.rowCells;if(!e)return;let t=this.col;t>this.d.maxCol&&(this.d.maxCol=t);let n=this.row*Q+t;if(this.formula&&this.d.formulas.set(n,this.formula),this.fShared>=0&&(this.formula?this.d.shared.set(this.fShared,{master:n,text:this.formula}):this.d.depOf.set(n,this.fShared),this.fShared=-1),!this.hasVal||this.formula&&this.val===``&&this.cType!==`str`){this.formula?(this.d.uncached.push(this.row*Q+t),e.push(t,6,``,this.cStyle)):this.cStyle&&e.push(t,6,``,this.cStyle);return}let r=0,i;switch(this.cType){case`s`:r=1,i=Number(this.val);break;case`str`:case`inlineStr`:r=2,i=eo(this.val);break;case`b`:r=3,i=+(this.val===`1`||this.val===`true`);break;case`e`:r=4,i=this.val;break;case`d`:r=5,i=this.val;break;default:{let e=Number(this.val);this.val===``||Number.isNaN(e)?(r=this.val===``?6:2,i=this.val):i=e}}if(e.push(t,r,i,this.cStyle),!this.rowHasHt){let e=this.fontPt[this.cStyle]??this.basePt;e>this.rowMaxPt&&(this.rowMaxPt=e)}return}case`row`:if(!this.rowHasHt&&this.rowMaxPt>this.basePt*1.15){let e=Math.round(this.rowMaxPt*(4/3)*1.3+3);e>this.d.defaultRowH&&(this.newSizes.push([this.row,e]),this.d.autoRowH.set(this.row,e))}this.rowCells&&this.rowCells.length&&(this.d.rows[this.row]=this.rowCells),this.row>this.d.maxRow&&(this.d.maxRow=this.row),this.rowCells=null;return}}text(e){this.capture===1?this.val+=e:this.capture===2?this.formula+=e:this.capture===3&&(this.val+=e)}},so=class{constructor(){w(this,`strings`,[]),w(this,`cur`,``),w(this,`capture`,!1)}open(e){if(e===`si`)this.cur=``;else if(e===`t`)this.capture=!0;else if(e===`rPh`||e===`phoneticPr`)return!0}close(e){e===`t`?this.capture=!1:e===`si`&&this.strings.push(eo(this.cur))}text(e){this.capture&&(this.cur+=e)}},co=class e{constructor(e,t,n,r,i,a,o){w(this,`pkg`,void 0),w(this,`mainPath`,void 0),w(this,`rels`,void 0),w(this,`sheets`,void 0),w(this,`styles`,void 0),w(this,`date1904`,void 0),w(this,`theme`,void 0),w(this,`sheetsData`,/* @__PURE__ */ new Map),w(this,`calc`,new Na(this)),w(this,`sst`,[]),w(this,`sstLoading`,void 0),this.pkg=e,this.mainPath=t,this.rels=n,this.sheets=r,this.styles=i,this.date1904=a,this.theme=o}static async open(t,n){let r=await t.xml(n),i=await t.rels(n),a=[];for(let e of O(D(r,`sheets`),`sheet`)){let t=i.get(e.a[`r:id`]);t&&t.type.endsWith(`/worksheet`)&&a.push({name:e.a.name??`Sheet${a.length+1}`,index:a.length,path:t.target,hidden:!!e.a.state&&e.a.state!==`visible`})}let o=M(i,`theme`),s=Ae(o?await t.xml(o.target):void 0),c=M(i,`styles`),l=$a(c?await t.xml(c.target):void 0,s),u=D(r,`workbookPr`),d=u?.a.date1904===`1`||u?.a.date1904===`true`;return new e(t,n,i,a,l,d,s)}meta(){return{sheets:this.sheets,styles:this.styles.xfs.map(e=>e.css),formats:this.styles.xfs.map(e=>e.numFmt),baseFont:this.styles.baseFont,date1904:this.date1904}}loadSst(e){return this.sstLoading||(this.sstLoading=(async()=>{let t=M(this.rels,`sharedStrings`);if(!t||!this.pkg.has(t.target))return;let n=new so;this.sst=n.strings,await me(await this.pkg.stream(t.target,e),n)})()),this.sstLoading}loadSheet(e,t,n){let r=this.sheetsData.get(e);if(r)return t(this.snapshot(e,r,lo(r),!0)),r.loading??Promise.resolve();let i=new ao;return this.sheetsData.set(e,i),i.loading=(async()=>{let r=this.sheets[e];if(!r)throw Error(`No sheet #${e}`);try{await this.loadSst((e,t)=>n?.(`strings`,e,t));let a=new oo(i,this.styles.xfs.map(e=>e.fontPt),this.styles.xfs[0]?.fontPt??11),o=!1,s=0;if(await me(await this.pkg.stream(r.path,(e,t)=>n?.(`sheet`,e,t)),a,{onChunk:async()=>{let n=Date.now();!o&&a.headerReady?(o=!0,t(this.snapshot(e,i,a.newSizes.splice(0),!0)),s=n,await new Promise(e=>setTimeout(e,0))):n-s>150&&(s=n,t(this.snapshot(e,i,a.newSizes.splice(0),!1)),await new Promise(e=>setTimeout(e,0)))}}),i.done=!0,t({...this.snapshot(e,i,a.newSizes.splice(0),!o),merges:i.merges}),i.uncached.length){let n=i.uncached.splice(0);(async()=>{await Promise.all(this.sheets.map(t=>t.index===e?null:this.loadSheet(t.index,()=>{}))),this.calc.invalidate(),this.calc.computeMissing(e,n),t({...this.snapshot(e,i,[],!1),recalc:!0})})()}}catch(n){i.done=!0,i.error=n.message,t({...this.snapshot(e,i,[],!0),error:i.error})}})(),i.loading}snapshot(e,t,n,r){let i={sheet:e,rows:t.maxRow+1,cols:t.maxCol+1,rowSizes:n,done:t.done};return r&&(i.colInfo=t.colInfo,i.defaultColW=t.defaultColW,i.defaultRowH=t.defaultRowH,i.frozen=t.frozen,i.gridLines=t.gridLines),t.done&&(i.merges=t.merges),t.error&&(i.error=t.error),i}block(e,t,n){let r=this.sheetsData.get(e),i=[];if(!r)return{sheet:e,r0:t,r1:n,rows:i,complete:!1};let a=this.styles.xfs,o=Math.min(n,r.rows.length);for(let e=t;e<o;e++){let t=r.rows[e];if(!t)continue;let n=[];for(let e=0;e<t.length;e+=4){let r=t[e],i=t[e+1],o=t[e+2],s=t[e+3],c=a[s]??a[0];switch(i){case 0:{let e=Xa(o,c.numFmt,this.date1904);n.push(e.color?[r,e.text,s,1,e.color]:[r,e.text,s,1]);break}case 1:n.push([r,Za(this.sst[o]??``,c.numFmt),s,0]);break;case 2:n.push([r,Za(o,c.numFmt),s,0]);break;case 3:n.push([r,o?`TRUE`:`FALSE`,s,2]);break;case 4:n.push([r,o,s,2]);break;case 5:n.push([r,o.replace(`T00:00:00`,``).replace(`T`,` `).replace(/Z$/,``),s,1]);break;default:n.push([r,``,s,0])}}i.push({r:e,cells:n})}return{sheet:e,r0:t,r1:n,rows:i,complete:r.done||n<=r.maxRow}}find(e,t,n={},r=2e4){let i=this.sheetsData.get(e),a=[];if(!i||!t)return a;let o=e=>n.matchCase?e:e.toLowerCase(),s=o(t),c=this.styles.xfs;for(let e=0;e<i.rows.length&&a.length<r;e++){let t=i.rows[e];if(t)for(let l=0;l<t.length&&a.length<r;l+=4){let r=t[l],u=t[l+1],d=t[l+2],f=n.formulas?i.formulas.get(e*Q+r):void 0,p;if(p=f?`=`+f:u===0?Xa(d,(c[t[l+3]]??c[0])?.numFmt,this.date1904).text:u===1?this.sst[d]??``:u===3?d?`TRUE`:`FALSE`:u===6?``:String(d),!p)continue;let m=o(p);(n.whole?m===s:m.includes(s))&&a.push({r:e,c:r,text:p})}}return a}cell(e,t,n){let r=this.sheetsData.get(e),i=r?.rows[t],a=r?.formulas.get(t*Q+n);if(!i)return a?{value:``,formula:`=`+a,type:`formula`}:void 0;for(let e=0;e<i.length;e+=4){if(i[e]!==n)continue;let t=i[e+1],r=i[e+2],o=t===1?this.sst[r]??``:t===3?r?`TRUE`:`FALSE`:String(r),s=[`number`,`string`,`string`,`boolean`,`error`,`date`,`empty`][t];return{value:o,formula:a?`=`+a:void 0,type:s}}return a?{value:``,formula:`=`+a,type:`formula`}:void 0}unload(e){this.sheetsData.get(e)?.done&&this.sheetsData.delete(e)}};function lo(e){let t=[];for(let[n,r]of e.autoRowH)e.rowAttrs.has(n)||t.push([n,r]);for(let[n,r]of e.rowAttrs)t.push([n,r.hidden?0:r.ht===void 0?e.autoRowH.get(n)??e.defaultRowH:Math.round(r.ht*4/3)]);return t}function uo(e){return{rows:e.rows.map(e=>e&&e.slice()),formulas:new Map(e.formulas),merges:e.merges.map(e=>({...e})),colInfo:e.colInfo.map(e=>({...e})),rowAttrs:new Map([...e.rowAttrs].map(([e,t])=>[e,{...t}])),autoRowH:new Map(e.autoRowH),maxRow:e.maxRow,maxCol:e.maxCol,frozen:{...e.frozen}}}function fo(e,t){e.rows=t.rows.map(e=>e&&e.slice()),e.formulas=new Map(t.formulas),e.merges=t.merges.map(e=>({...e})),e.colInfo=t.colInfo.map(e=>({...e})),e.rowAttrs=new Map([...t.rowAttrs].map(([e,t])=>[e,{...t}])),e.autoRowH=new Map(t.autoRowH),e.maxRow=t.maxRow,e.maxCol=t.maxCol,e.frozen={...t.frozen},e.structural=!0,e.dirtyCols=e.dirtyMerges=e.dirtyView=!0}function po(e){for(let[t,n]of e.depOf){let r=e.shared.get(n);if(!r||e.formulas.has(t))continue;let i=Math.floor(t/Q)-Math.floor(r.master/Q),a=t%Q-r.master%Q;e.formulas.set(t,Ea(r.text,i,a))}e.depOf.clear(),e.shared.clear()}function mo(e,t,n,r){let i=[];for(let a of e){let[e,o]=t===`row`?[a.r0,a.r1]:[a.c0,a.c1];if(r>0)e>=n&&(e+=r),o>=n&&(o+=r);else{let t=n-r;if(e>=n&&o<t||(e=(e=>e<n?e:e>=t?e+r:n)(e),o=o>=t?o+r:o>=n?n-1:o,o<e))continue}let s=t===`row`?{...a,r0:e,r1:o}:{...a,c0:e,c1:o};(s.r0!==s.r1||s.c0!==s.c1)&&i.push(s)}return i}function ho(e,t,n,r,i,a){po(e);let o=r-i;if(n===`row`){i>0?e.rows.splice(r,0,...Array(i).fill(void 0)):e.rows.splice(r,-i),e.maxRow=Math.max(-1,e.maxRow+(e.maxRow>=r?i:0));let t=/* @__PURE__ */ new Map;for(let[n,a]of e.rowAttrs)i<0&&n>=r&&n<o||t.set(n>=r?n+i:n,a);e.rowAttrs=t;let n=/* @__PURE__ */ new Map;for(let[t,a]of e.autoRowH)i<0&&t>=r&&t<o||n.set(t>=r?t+i:t,a);e.autoRowH=n}else{for(let t=0;t<e.rows.length;t++){let n=e.rows[t];if(!n)continue;let a=[];for(let e=0;e<n.length;e+=4){let t=n[e];i<0&&t>=r&&t<o||a.push(t>=r?t+i:t,n[e+1],n[e+2],n[e+3])}e.rows[t]=a.length?a:void 0}e.maxCol=Math.max(-1,e.maxCol+(e.maxCol>=r?i:0));let t=[];for(let n of e.colInfo){let{min:e,max:a}=n;if(i>0)e>=r&&(e+=i),a>=r&&(a+=i);else if(e>=r&&a<o||(e=e<r?e:e>=o?e+i:r,a=a>=o?a+i:a>=r?r-1:a,a<e))continue;t.push({...n,min:e,max:a})}e.colInfo=t,e.dirtyCols=!0}let s={sheet:t,formulaSheet:t,axis:n,at:r,delta:i},c=/* @__PURE__ */ new Map;for(let[t,a]of e.formulas){let e=Math.floor(t/Q),l=t%Q,u=n===`row`?e:l;i<0&&u>=r&&u<o||(u>=r&&(n===`row`?e+=i:l+=i),c.set(e*Q+l,Oa(a,s)))}e.formulas=c;for(let t of a){if(t.d===e)continue;let n=!1;for(let[e,r]of t.d.formulas){let i=Oa(r,{...s,formulaSheet:t.name});i!==r&&(t.d.formulas.set(e,i),t.d.edited.add(e),n=!0)}n&&(t.d.formulaChanged=!0)}e.merges=mo(e.merges,n,r,i),n===`row`&&e.frozen.rows>r&&(e.frozen={...e.frozen,rows:Math.max(0,e.frozen.rows+(i>0?i:Math.max(i,r-e.frozen.rows)))}),n===`col`&&e.frozen.cols>r&&(e.frozen={...e.frozen,cols:Math.max(0,e.frozen.cols+(i>0?i:Math.max(i,r-e.frozen.cols)))}),e.structural=!0,e.dirtyMerges=!0,e.dirtyView=!0}function go(e,t,n){let r=e=>e.r1>=t.r0&&e.r0<=t.r1&&e.c1>=t.c0&&e.c0<=t.c1;e.merges=e.merges.filter(e=>!r(e)),n&&(t.r0!==t.r1||t.c0!==t.c1)&&e.merges.push({...t}),e.dirtyMerges=!0}function _o(e,t,n,r){let i=[];for(let r of e.colInfo)r.max<t||r.min>n?i.push(r):(r.min<t&&i.push({...r,max:t-1}),r.max>n&&i.push({...r,min:n+1}));i.push({min:t,max:n,w:Math.max(0,Math.round(r))}),e.colInfo=i.sort((e,t)=>e.min-t.min),e.dirtyCols=!0}function vo(e,t,n,r){for(let i=t;i<=n;i++)e.rowAttrs.set(i,r>0?{ht:+(r*.75).toFixed(2)}:{...e.rowAttrs.get(i)??{},hidden:!0}),e.dirtyRows.add(i)}const yo=[`b`,`i`,`strike`,`condense`,`extend`,`outline`,`shadow`,`u`,`vertAlign`,`sz`,`color`,`name`,`family`,`charset`,`scheme`],bo=[`fileVersion`,`fileSharing`,`workbookPr`,`workbookProtection`,`bookViews`,`sheets`,`functionGroups`,`externalReferences`,`definedNames`,`calcPr`,`oleSize`,`customWorkbookViews`,`pivotCaches`,`smartTagPr`,`smartTagTypes`,`webPublishing`,`fileRecoveryPr`,`webPublishObjects`,`extLst`],xo=[`numFmts`,`fonts`,`fills`,`borders`,`cellStyleXfs`,`cellXfs`,`cellStyles`,`dxfs`,`tableStyles`,`colors`,`extLst`];function So(e,t,n){let r=e.rows[t];return!r&&n&&(e.rows[t]=r=[]),r}function $(e,t,n){let r=e.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4)if(r[e]===n)return[r[e+1],r[e+2],r[e+3]];return null}function Co(e,t,n,r){let i=So(e,t,!!r);if(!i)return;let a=0;for(;a<i.length&&!(i[a]>=n);a+=4);let o=a<i.length&&i[a]===n;r?(o?(i[a+1]=r[0],i[a+2]=r[1],i[a+3]=r[2]):i.splice(a,0,n,r[0],r[1],r[2]),t>e.maxRow&&(e.maxRow=t),n>e.maxCol&&(e.maxCol=n)):(o&&i.splice(a,4),i.length||(e.rows[t]=void 0))}function wo(e){let t=/^(\\d{4})-(\\d{1,2})-(\\d{1,2})(?:[ T](\\d{1,2}):(\\d{2})(?::(\\d{2}))?)?$/.exec(e),n,r,i;if(t)[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];else{if(t=/^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})(?: (\\d{1,2}):(\\d{2})(?::(\\d{2}))?)?$/.exec(e),!t)return;[i,r,n]=[Number(t[1]),Number(t[2]),Number(t[3])]}let a=Date.UTC(n,r-1,i,Number(t[4]??0),Number(t[5]??0),Number(t[6]??0));if(Number.isFinite(a))return a/864e5+25569}function To(e,t,n=!1){if(e===``)return{e:t?[6,``,t]:null};if(e.startsWith(`=`)&&e.length>1)return{e:[2,e,t],f:e.slice(1)};let r=e.trim();if(/^[-+]?(\\d+\\.?\\d*|\\.\\d+)(e[-+]?\\d+)?$/i.test(r))return{e:[0,Number(r),t]};if(/^[-+]?(\\d+\\.?\\d*|\\.\\d+)%$/.test(r))return{e:[0,Number(r.slice(0,-1))/100,t]};if(/^(true|false)$/i.test(r))return{e:[3,+!!/^true$/i.test(r),t]};if(n){let e=wo(r);if(e!==void 0)return{e:[0,e,t]}}return{e:[2,e,t]}}var Eo=class{constructor(e){w(this,`nodes`,void 0),w(this,`root`,void 0),w(this,`P`,void 0),w(this,`cache`,/* @__PURE__ */ new Map),w(this,`found`,/* @__PURE__ */ new Map),w(this,`changed`,!1),this.nodes=t(e),this.root=a(this.nodes),this.P=i(this.root.q)}section(e){let t=s(this.root,e);return t||(t=d(this.P+e,{count:`0`}),m(this.root,t,e,xo)),t}append(e,t){let n=this.section(e);n.c.push(t),n.self=!1;let r=o(n).length;return u(n,`count`,String(r)),this.changed=!0,r-1}lookup(e){let t=this.found.get(e);if(!t){let r=/* @__PURE__ */ new Map;o(s(this.root,e)).forEach((e,t)=>{let i=n([e]);r.has(i)||r.set(i,t)}),this.found.set(e,t=r)}return t}intern(e,t){let r=n([t]),i=this.lookup(e),a=i.get(r);if(a!==void 0)return a;let o=this.append(e,t);return i.set(r,o),o}numFmtId(e){for(let[t,n]of Object.entries(Fa))if(n===e)return Number(t);let t=s(this.root,`numFmts`),n=163;for(let r of o(t,`numFmt`)){let t=Number(l(r,`numFmtId`));if(l(r,`formatCode`)===e)return t;n=Math.max(n,t)}return this.append(`numFmts`,d(this.P+`numFmt`,{numFmtId:String(n+1),formatCode:e})),n+1}derive(e,n){let r=e+JSON.stringify(n),i=this.cache.get(r);if(i!==void 0)return i;let a=this.P,c=o(this.section(`cellXfs`),`xf`),p=f(c[e]??c[0]??d(a+`xf`,{numFmtId:`0`,fontId:`0`,fillId:`0`,borderId:`0`}));if([`b`,`i`,`u`,`strike`,`color`,`sz`,`font`].some(e=>e in n)){let e=o(this.section(`fonts`),`font`),t=f(e[Number(l(p,`fontId`)??0)]??e[0]??d(a+`font`)),r=(e,n)=>m(t,n,e,yo);n.b!==void 0&&r(`b`,n.b?d(a+`b`):void 0),n.i!==void 0&&r(`i`,n.i?d(a+`i`):void 0),n.strike!==void 0&&r(`strike`,n.strike?d(a+`strike`):void 0),n.u!==void 0&&r(`u`,n.u?d(a+`u`):void 0),n.sz!==void 0&&r(`sz`,d(a+`sz`,{val:String(n.sz)})),`color`in n&&r(`color`,n.color?d(a+`color`,{rgb:`FF`+n.color.replace(`#`,``).toUpperCase()}):void 0),n.font&&(r(`name`,d(a+`name`,{val:n.font})),r(`scheme`,void 0)),u(p,`fontId`,String(this.intern(`fonts`,t))),u(p,`applyFont`,`1`)}if(`fill`in n){if(!n.fill)u(p,`fillId`,`0`);else{let e=t(`<${a}fill><${a}patternFill patternType="solid"><${a}fgColor rgb="FF${n.fill.replace(`#`,``).toUpperCase()}"/><${a}bgColor indexed="64"/></${a}patternFill></${a}fill>`)[0];u(p,`fillId`,String(this.intern(`fills`,e)))}u(p,`applyFill`,`1`)}if(n.border){let e=n.sides??{},t=o(this.section(`borders`),`border`),r=f(t[Number(l(p,`borderId`)??0)]??t[0]??d(a+`border`)),i=(n.borderColor??`#000000`).replace(`#`,``).toUpperCase(),c=[`left`,`start`,`right`,`end`,`top`,`bottom`,`diagonal`,`vertical`,`horizontal`];for(let t of[`left`,`right`,`top`,`bottom`])t in e&&m(r,e[t]?d(a+t,{style:n.borderStyle??`thin`},[d(a+`color`,{rgb:`FF`+i})]):d(a+t),t,c);s(r,`diagonal`)||m(r,d(a+`diagonal`),`diagonal`,c),u(p,`borderId`,String(this.intern(`borders`,r))),u(p,`applyBorder`,`1`)}if(`align`in n||`wrap`in n||`valign`in n||`rotate`in n){let e=f(s(p,`alignment`)??d(a+`alignment`));if(`align`in n&&u(e,`horizontal`,n.align??void 0),`valign`in n&&u(e,`vertical`,n.valign&&n.valign!==`bottom`?n.valign:void 0),`wrap`in n&&u(e,`wrapText`,n.wrap?`1`:void 0),`rotate`in n){let t=n.rotate;u(e,`textRotation`,t?t===255?`255`:String(t>0?Math.min(90,t):90+Math.min(90,-t)):void 0)}m(p,e.a.trim()?e:void 0,`alignment`,[`alignment`,`protection`,`extLst`]),u(p,`applyAlignment`,`1`)}n.numFmt!==void 0&&(u(p,`numFmtId`,String(this.numFmtId(n.numFmt))),u(p,`applyNumberFormat`,`1`));let h=this.intern(`cellXfs`,p);return this.cache.set(r,h),h}xml(){return n(this.nodes)}mark(){let e={};for(let t of[`numFmts`,`fonts`,`fills`,`borders`,`cellXfs`])e[t]=o(s(this.root,t)).length;return e}truncate(e){for(let[t,n]of Object.entries(e)){let e=s(this.root,t),r=o(e);if(!e||r.length<=n)continue;let i=new Set(r.slice(n));e.c=e.c.filter(e=>!i.has(e)),u(e,`count`,String(n));let a=this.found.get(t);if(a)for(let[e,t]of a)t>=n&&a.delete(e)}for(let[t,n]of this.cache)n>=e.cellXfs&&this.cache.delete(t)}},Do=class{constructor(e){w(this,`wb`,void 0),w(this,`undoStack`,[]),w(this,`redoStack`,[]),w(this,`styleEd`,void 0),w(this,`stylesPath`,void 0),w(this,`formulaTouched`,!1),w(this,`lastRecalc`,[]),w(this,`bookChanged`,!1),w(this,`newSheets`,/* @__PURE__ */ new Map),this.wb=e}get dirty(){return[...this.wb.sheetsData.values()].some(ko)||!!this.styleEd?.changed||this.bookChanged}sheet(e){let t=this.wb.sheetsData.get(e);if(!t||!t.done)throw Error(`Sheet is still loading`);return t}apply(e,t,n){let r=[...this.wb.sheetsData].find(([,t])=>t===e)?.[0]??0,i=[];this.applyRaw(e,t,n);for(let e of t){let t=n===`prev`?e.nextF:e.prevF,a=n===`prev`?e.prevF:e.nextF;t!==a&&this.wb.calc.formulaChanged(r,e.key),a&&i.push({sheet:r,key:e.key})}let a=t.filter(e=>{if(n===`prev`?e.prevF:e.nextF)return!1;let t=e.prev,r=e.next;return!t||!r||t[0]!==r[0]||t[1]!==r[1]||e.prevF!==e.nextF});this.lastRecalc=a.length||i.length?[...this.wb.calc.recalc(a.map(e=>({sheet:r,key:e.key})),i)]:[]}applyRaw(e,t,n){for(let r of t){Co(e,Math.floor(r.key/Q),r.key%Q,n===`prev`?r.prev:r.next);let t=n===`prev`?r.prevF:r.nextF;t?e.formulas.set(r.key,t):e.formulas.delete(r.key),e.edited.add(r.key),(r.prevF||r.nextF)&&(this.formulaTouched=!0)}}record(e,t,n){return this.undoStack.push({sheet:e,cells:t,range:n}),this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],{sheet:e,range:n,recalc:this.lastRecalc}}recalcAll(){this.wb.calc.invalidate();let e=[];for(let[t,n]of this.wb.sheetsData)for(let r of n.formulas.keys())e.push({sheet:t,key:r});return[...this.wb.calc.recalc([],e)]}setCells(e,t){let n=this.sheet(e),r=[],i={r0:1/0,c0:1/0,r1:-1,c1:-1};for(let{r:e,c:a,input:o}of t){let t=e*Q+a,s=$(n,e,a),c=s?.[2]??0,{e:l,f:u}=To(o,c,Ua(this.wb.styles.xfs[c]?.numFmt??``));r.push({key:t,prev:s,prevF:n.formulas.get(t),next:l,nextF:u}),i.r0=Math.min(i.r0,e),i.c0=Math.min(i.c0,a),i.r1=Math.max(i.r1,e),i.c1=Math.max(i.c1,a)}return this.apply(n,r,`next`),this.record(e,r,i)}async styles(){if(!this.styleEd){let e=M(this.wb.rels,`styles`);this.stylesPath=e?.target??`xl/styles.xml`;let t=this.wb.pkg.has(this.stylesPath)?await this.wb.pkg.text(this.stylesPath):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="1"><font><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs></styleSheet>`;this.styleEd=new Eo(t)}return this.styleEd}async format(e,t,n){let r=this.sheet(e),i=await this.styles(),a=this.wb.styles.xfs.length,o=[],s=Math.min(t.r1,t.r0+2e5),c=3e5;for(let e=t.r0;e<=s&&c>0;e++)for(let a=t.c0;a<=t.c1&&c>0;a++,c--){let s=e*Q+a,c=$(r,e,a),l=n.border?{...n,sides:No(n.border,t,e,a)}:n;if(n.border&&!Object.keys(l.sides).length)continue;let u=n.clear?0:n.xf===void 0?i.derive(c?.[2]??0,l):n.xf,d=c?[c[0],c[1],u]:[6,``,u],f=r.formulas.get(s);o.push({key:s,prev:c,prevF:f,next:d,nextF:f})}this.apply(r,o,`next`);let l=i.xml();this.wb.pkg.setPart(this.stylesPath,l),this.wb.styles=$a(ge(l),this.wb.theme);let u=this.record(e,o,t);return u.styles=this.wb.styles.xfs.slice(a).map((e,t)=>({index:a+t,css:e.css,format:e.numFmt})),u}step(e,t){let n=this.sheet(e.sheet);this.lastRecalc=[],e.full&&fo(n,t===`prev`?e.full.before:e.full.after),this.apply(n,e.cells,t),e.lay&&jo(n,t===`prev`?e.lay.before:e.lay.after);let r=e.full?this.recalcAll():this.lastRecalc;return{sheet:e.sheet,range:e.range,layout:e.full||e.lay?this.layout(e.sheet):void 0,recalc:r}}undo(){let e=this.undoStack.pop();return e?(this.redoStack.push(e),this.step(e,`prev`)):null}redo(){let e=this.redoStack.pop();return e?(this.undoStack.push(e),this.step(e,`next`)):null}takeRecord(){let e=this.undoStack.pop();return this.undoStack=[],this.redoStack=[],e}revertRecord(e){return this.step(e,`prev`)}restoreRecord(e,t){let n=this.sheet(e.sheet),r=e.cells.map(e=>({key:e.key,prev:$(n,Math.floor(e.key/Q),e.key%Q),prevF:n.formulas.get(e.key),next:t===`prev`?e.prev:e.next,nextF:t===`prev`?e.prevF:e.nextF})),i={sheet:e.sheet,cells:r,range:e.range,lay:e.lay?{before:Ao(n),after:t===`prev`?e.lay.before:e.lay.after}:void 0,full:e.full?{before:uo(n),after:t===`prev`?e.full.before:e.full.after}:void 0},a=this.step(i,`next`);return this.undoStack.push(i),a}async styleMark(){return(await this.styles()).mark()}async styleTruncate(e){let t=await this.styles(),n=t.xml();t.truncate(e);let r=t.xml();r!==n&&(this.wb.pkg.setPart(this.stylesPath,r),this.wb.styles=$a(ge(r),this.wb.theme))}styleAt(e,t,n){return $(this.sheet(e),t,n)?.[2]??0}layout(e){let t=this.sheet(e),n=lo(t);return{sheet:e,rows:t.maxRow+1,cols:t.maxCol+1,rowSizes:n,done:!0,colInfo:t.colInfo,defaultColW:t.defaultColW,defaultRowH:t.defaultRowH,frozen:t.frozen,gridLines:t.gridLines,merges:t.merges}}async allSheets(){return await Promise.all(this.wb.sheets.map(e=>this.wb.loadSheet(e.index,()=>{}))),this.wb.sheets.map(e=>({name:e.name,d:this.wb.sheetsData.get(e.index)}))}async sheetOp(e,t){let n=this.sheet(e),r=this.wb.sheets[e].name,i={r0:0,c0:0,r1:Math.max(0,n.maxRow+50),c1:Math.max(0,n.maxCol+10)},a=(t,r=i)=>{let a=Ao(n);t();let o={sheet:e,cells:[],range:r,lay:{before:a,after:Ao(n)}};return this.undoStack.push(o),this.redoStack=[],{sheet:e,range:r,layout:this.layout(e)}};switch(t.op){case`insertRows`:case`deleteRows`:case`insertCols`:case`deleteCols`:{let a=await this.allSheets(),o=uo(n);ho(n,r,t.op.endsWith(`Rows`)?`row`:`col`,t.at,t.op.startsWith(`insert`)?t.n:-t.n,a),this.formulaTouched=!0;let s=this.recalcAll(),c={sheet:e,cells:[],range:i,full:{before:o,after:uo(n)}};return this.undoStack.push(c),this.redoStack=[],{sheet:e,range:i,layout:this.layout(e),recalc:s}}case`merge`:case`unmerge`:{let r=t.range,i=t.op===`unmerge`||!t.mode||t.mode===`all`?[r]:t.mode===`across`?Array.from({length:r.r1-r.r0+1},(e,t)=>({r0:r.r0+t,r1:r.r0+t,c0:r.c0,c1:r.c1})):Array.from({length:r.c1-r.c0+1},(e,t)=>({r0:r.r0,r1:r.r1,c0:r.c0+t,c1:r.c0+t})),o=a(()=>{if(go(n,r,!1),t.op===`merge`)for(let e of i)go(n,e,!0)},r);if(t.op===`merge`){let t=[];for(let e of i)for(let r=e.r0;r<=e.r1;r++)for(let i=e.c0;i<=e.c1;i++)(r!==e.r0||i!==e.c0)&&$(n,r,i)&&$(n,r,i)?.[1]!==``&&t.push({r,c:i,input:``});if(t.length){this.setCells(e,t);let n=this.undoStack.pop();this.undoStack[this.undoStack.length-1].cells=n.cells}}return o}case`hideRows`:return a(()=>{for(let e=t.a;e<=t.b;e++){let r=n.rowAttrs.get(e);if(t.hidden)n.rowAttrs.set(e,{...r??{},hidden:!0});else if(r){let{hidden:t,...i}=r;i.ht===void 0?n.rowAttrs.delete(e):n.rowAttrs.set(e,i)}n.dirtyRows.add(e)}});case`hideCols`:return a(()=>Mo(n,t.a,t.b,t.hidden));case`gridlines`:return a(()=>{n.gridLines=t.show,n.dirtyView=!0});case`colWidth`:return a(()=>_o(n,t.c0,t.c1,t.px));case`rowHeight`:return a(()=>vo(n,t.r0,t.r1,t.px));case`freeze`:return a(()=>{n.frozen={rows:t.rows,cols:t.cols},n.dirtyView=!0});case`fill`:return this.fill(e,n,t.range,t.dir);case`sort`:return this.sort(e,n,t.range,t.col,!!t.desc)}}replace(e,t,n,r={},i){let a=this.sheet(e),o=new RegExp(r.whole?`^${Fo(t)}$`:Fo(t),r.matchCase?`g`:`gi`),s=[],c=i?[i]:this.wb.find(e,t,r,1e9);for(let{r:t,c:i}of c){let c=a.formulas.get(t*Q+i),l=r.formulas&&c?`=`+c:this.wb.cell(e,t,i)?.value;if(l===void 0||c&&!r.formulas)continue;let u=l.replace(o,n);u!==l&&s.push({r:t,c:i,input:u})}return s.length?this.setCells(e,s):null}fill(e,t,n,r){po(t);let i=[];for(let e=n.r0;e<=n.r1;e++)for(let a=n.c0;a<=n.c1;a++){let o=r===`down`?n.r0:e,s=r===`right`?n.c0:a;if(o===e&&s===a)continue;let c=e*Q+a,l=$(t,o,s),u=t.formulas.get(o*Q+s),d=u?Ea(u,e-o,a-s):void 0;i.push({key:c,prev:$(t,e,a),prevF:t.formulas.get(c),next:l?[l[0],d?`=`+d:l[1],l[2]]:null,nextF:d})}return this.apply(t,i,`next`),this.record(e,i,n)}sort(e,t,n,r,i){po(t);let a=[];for(let e=n.r0;e<=n.r1;e++){let i=[],o=[];for(let r=n.c0;r<=n.c1;r++)i.push($(t,e,r)),o.push(t.formulas.get(e*Q+r));let s=$(t,e,r),c=s?s[0]===1?this.wb.sst[s[1]]:s[1]:null;a.push({r:e,cells:i,f:o,key:c===``?null:c})}let o=(e,t)=>e==null?1:t==null?-1:typeof e==`number`&&typeof t==`number`?e-t:typeof e==`number`?-1:typeof t==`number`?1:String(e).localeCompare(String(t),void 0,{sensitivity:`base`,numeric:!0}),s=[...a].sort((e,t)=>{let n=o(e.key,t.key);return i&&e.key!==null&&t.key!==null?-n:n}),c=[];return s.forEach((e,r)=>{let i=n.r0+r;for(let r=n.c0;r<=n.c1;r++){let a=r-n.c0,o=i*Q+r,s=e.f[a]?Ea(e.f[a],i-e.r,0):void 0,l=e.cells[a];c.push({key:o,prev:$(t,i,r),prevF:t.formulas.get(o),next:l?[l[0],s?`=`+s:l[1],l[2]]:null,nextF:s})}}),this.apply(t,c,`next`),this.record(e,c,n)}async bookOp(r){let c=this.wb.pkg,f=t(await c.text(this.wb.mainPath)),p=a(f),m=i(p.q),h=s(p,`sheets`),g=o(h,`sheet`),_=this.wb.sheets,v=e=>{let t=new Map(this.wb.sheetsData);this.wb.sheetsData.clear(),e.forEach((e,n)=>{let r=t.get(e);r&&this.wb.sheetsData.set(n,r)});let n=e.map((e,t)=>({..._[e],index:t}));_.splice(0,_.length,...n)};switch(r.op){case`add`:{let e=c.freeName(`xl/worksheets`,`sheet`,`xml`);this.newSheets.set(e,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/></worksheet>`),c.setPart(e,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/></worksheet>`),await c.setContentType(e,`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`);let t=await c.addRel(this.wb.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,e),n=g.map(e=>Number(l(e,`sheetId`)??0)),i=r.name??`Sheet${_.length+1}`;for(;_.some(e=>e.name.toLowerCase()===i.toLowerCase());)i+=`_`;let a=d(m+`sheet`,{name:i,sheetId:String(Math.max(0,...n)+1),...b(p,`id`,t)}),o=r.after??_.length-1,s=o+1>=g.length?h.c.length:h.c.indexOf(g[o+1]);h.c.splice(s,0,a),h.self=!1;let u={name:i,index:o+1,path:e,hidden:!1},f=_.map((e,t)=>t);_.push({...u,index:_.length}),f.splice(o+1,0,_.length-1),v(f);break}case`rename`:{let e=_[r.index],t=r.name.trim().slice(0,31).replace(/[\\\\/?*[\\]:]/g,`_`);if(!e||!t||_.some((e,n)=>n!==r.index&&e.name.toLowerCase()===t.toLowerCase()))throw Error(`Invalid sheet name`);u(g[r.index],`name`,t);for(let n of await this.allSheets())for(let[r,i]of n.d.formulas){let a=ka(i,e.name,t);a!==i&&(n.d.formulas.set(r,a),n.d.edited.add(r))}e.name=t;break}case`delete`:{if(_.length<=1)throw Error(`A workbook needs at least one sheet`);let t=_[r.index];h.c.splice(h.c.indexOf(g[r.index]),1),c.setPart(t.path,null),c.has(Te(t.path))&&c.setPart(Te(t.path),null),await c.removeRelsTo(this.wb.mainPath,t.path),await c.setContentType(t.path,null),v(_.map((e,t)=>t).filter(e=>e!==r.index));let n=s(p,`definedNames`);n&&(n.c=n.c.filter(t=>!(e(t)&&l(t,`localSheetId`)===String(r.index))));break}case`move`:{let e=g[r.from];h.c.splice(h.c.indexOf(e),1);let t=o(h,`sheet`);h.c.splice(r.to>=t.length?h.c.length:h.c.indexOf(t[r.to]),0,e);let n=_.map((e,t)=>t);n.splice(r.from,1),n.splice(r.to,0,r.from),v(n);break}}return c.setPart(this.wb.mainPath,n(f)),this.bookChanged=!0,this.undoStack=[],this.redoStack=[],{sheet:0,range:{r0:0,c0:0,r1:0,c1:0},sheets:_.map(e=>({...e}))}}async save(){let e=this.wb.pkg,r=!1;for(let[t,n]of this.wb.sheetsData){if(!ko(n))continue;r=!0;let i=this.wb.sheets[t];e.setPart(i.path,()=>this.rewrite(i.path,n))}if(r){let r=t(await e.text(this.wb.mainPath)),o=a(r),c=i(o.q),l=f(s(o,`calcPr`)??d(c+`calcPr`));u(l,`fullCalcOnLoad`,`1`),m(o,l,`calcPr`,bo),e.setPart(this.wb.mainPath,n(r));let p=M(this.wb.rels,`calcChain`);p&&this.formulaTouched&&e.has(p.target)&&(e.setPart(p.target,null),await e.removeRelsTo(this.wb.mainPath,p.target),await e.setContentType(p.target,null))}return e.save(`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`)}rewrite(e,t){let n=this.wb.pkg,r=this.wb,i=this,a=/* @__PURE__ */ new Map,o=/* @__PURE__ */ new Set;for(let[e,n]of t.shared)t.edited.has(n.master)&&o.add(e);if(o.size)for(let[e,n]of t.depOf){if(!o.has(n)||t.edited.has(e))continue;let r=t.shared.get(n),i=Math.floor(e/Q)-Math.floor(r.master/Q),s=e%Q-r.master%Q;a.set(e,Ea(r.text,i,s))}let s=/* @__PURE__ */ new Map;for(let e of t.dirtyRows)s.has(e)||s.set(e,/* @__PURE__ */ new Set);for(let e of[...t.edited,...a.keys()]){let t=Math.floor(e/Q),n=s.get(t);n||s.set(t,n=/* @__PURE__ */ new Set),n.add(e%Q)}let c=[...s.keys()].sort((e,t)=>e-t),l=new TextEncoder;return new ReadableStream({async start(o){let u=new Po(c,s,t,a,r),d=i.newSheets.get(e),f=(d===void 0?await n.zip.stream(e):new Blob([d]).stream()).getReader(),p=new TextDecoder;for(;;){let{done:e,value:t}=await f.read(),n=e?p.decode():p.decode(t,{stream:!0});for(let t of u.push(n,e))t&&o.enqueue(l.encode(t));if(e)break}o.close()}})}};function Oo(e,t,n,r,i){let a=t*Q+n,o=$(e,t,n),s=e.formulas.get(a);if(!o&&!s)return``;let c=no(n)+(t+1),l=o?.[2]?` s="${o[2]}"`:``;if(s){let[e,t]=o??[6,``],n=`<${r}f>${h(s)}</${r}f>`;return e===0?`<${r}c r="${c}"${l}>${n}<${r}v>${String(t)}</${r}v></${r}c>`:e===3?`<${r}c r="${c}"${l} t="b">${n}<${r}v>${+!!t}</${r}v></${r}c>`:e===4?`<${r}c r="${c}"${l} t="e">${n}<${r}v>${h(String(t))}</${r}v></${r}c>`:e===2&&!String(t).startsWith(`=`)?`<${r}c r="${c}"${l} t="str">${n}<${r}v>${h(String(t))}</${r}v></${r}c>`:`<${r}c r="${c}"${l}>${n}</${r}c>`}let[u,d]=o;switch(u){case 0:return`<${r}c r="${c}"${l}><${r}v>${String(d)}</${r}v></${r}c>`;case 1:case 2:return`<${r}c r="${c}"${l} t="inlineStr"><${r}is><${r}t xml:space="preserve">${h(u===1?i.sst[d]??``:String(d))}</${r}t></${r}is></${r}c>`;case 3:return`<${r}c r="${c}"${l} t="b"><${r}v>${+!!d}</${r}v></${r}c>`;case 4:return`<${r}c r="${c}"${l} t="e"><${r}v>${h(String(d))}</${r}v></${r}c>`;case 5:return`<${r}c r="${c}"${l} t="d"><${r}v>${h(String(d))}</${r}v></${r}c>`;default:return`<${r}c r="${c}"${l}/>`}}function ko(e){return e.edited.size>0||e.structural||e.dirtyCols||e.dirtyMerges||e.dirtyView||e.dirtyRows.size>0||e.formulaChanged}function Ao(e){return{merges:e.merges.map(e=>({...e})),colInfo:e.colInfo.map(e=>({...e})),rowAttrs:[...e.rowAttrs].map(([e,t])=>[e,{...t}]),frozen:{...e.frozen},gridLines:e.gridLines}}function jo(e,t){if(t.merges&&(e.merges=t.merges.map(e=>({...e}))),t.colInfo&&(e.colInfo=t.colInfo.map(e=>({...e}))),t.rowAttrs){for(let t of e.rowAttrs.keys())e.dirtyRows.add(t);e.rowAttrs=new Map(t.rowAttrs.map(([e,t])=>[e,{...t}]));for(let t of e.rowAttrs.keys())e.dirtyRows.add(t)}t.frozen&&(e.frozen={...t.frozen}),t.gridLines!==void 0&&(e.gridLines=t.gridLines),e.dirtyCols=e.dirtyMerges=e.dirtyView=!0}function Mo(e,t,n,r){let i=[],a=[];for(let o of e.colInfo){if(o.max<t||o.min>n){i.push(o);continue}o.min<t&&i.push({...o,max:t-1}),o.max>n&&i.push({...o,min:n+1});let s=Math.max(o.min,t),c=Math.min(o.max,n);a.push([s,c]),r?i.push(o.w?{...o,min:s,max:c,w:0,prevW:o.w}:{...o,min:s,max:c}):i.push(o.w?{...o,min:s,max:c}:{min:s,max:c,w:o.prevW||e.defaultColW})}if(r){a.sort((e,t)=>e[0]-t[0]);let r=t;for(let[t,o]of[...a,[n+1,n+1]])t>r&&i.push({min:r,max:Math.min(t-1,n),w:0,prevW:e.defaultColW}),r=Math.max(r,o+1)}e.colInfo=i.sort((e,t)=>e.min-t.min),e.dirtyCols=!0}function No(e,t,n,r){let i={},a={top:n===t.r0,bottom:n===t.r1,left:r===t.c0,right:r===t.c1};for(let t of[`top`,`bottom`,`left`,`right`])e===`all`?i[t]=!0:e===`none`?i[t]=!1:e===`outer`?a[t]&&(i[t]=!0):e===`inner`?a[t]||(i[t]=!0):e===t&&a[t]&&(i[t]=!0);return i}var Po=class{constructor(e,t,n,r,i){w(this,`rows`,void 0),w(this,`rowCols`,void 0),w(this,`d`,void 0),w(this,`fix`,void 0),w(this,`wb`,void 0),w(this,`buf`,``),w(this,`P`,``),w(this,`next`,0),w(this,`lastRow`,-1),w(this,`phase`,`head`),w(this,`tail`,``),this.rows=e,this.rowCols=t,this.d=n,this.fix=r,this.wb=i}newRow(e){let t=[...this.rowCols.get(e)??[]].sort((e,t)=>e-t).map(t=>Oo(this.d,e,t,this.P,this.wb)).join(``),n=this.rowAttrXml(e);return t||n?`<${this.P}row r="${e+1}"${n}>${t}</${this.P}row>`:``}rowAttrXml(e){let t=this.d.rowAttrs.get(e);return t?(t.ht===void 0?``:` ht="${t.ht}" customHeight="1"`)+(t.hidden?` hidden="1"`:``):``}before(e){let t=``;for(;this.next<this.rows.length&&this.rows[this.next]<e;)t+=this.newRow(this.rows[this.next++]);return t}*allRows(){let e=this.d,t=Math.max(e.rows.length-1,...e.rowAttrs.keys(),-1),n=``;for(let r=0;r<=t;r++){let t=e.rows[r],i=this.rowAttrXml(r);if(!t?.length&&!i)continue;let a=``;if(t){let n=[];for(let e=0;e<t.length;e+=4)n.push(t[e]);for(let t of n.sort((e,t)=>e-t))a+=Oo(e,r,t,this.P,this.wb)}n+=`<${this.P}row r="${r+1}"${i}>${a}</${this.P}row>`,n.length>65536&&(yield n,n=``)}n&&(yield n)}colsXml(){let e=this.P,t=[...this.d.colInfo].sort((e,t)=>e.min-t.min);return t.length?`<${e}cols>${t.map(t=>`<${e}col min="${t.min+1}" max="${t.max+1}" width="${+((t.w||t.prevW||0)/7).toFixed(4)}" customWidth="1"${t.w?``:` hidden="1"`}/>`).join(``)}</${e}cols>`:``}headFix(i){let o=this.d,c=this.P,l=i;if(o.dirtyCols||o.structural){let e=RegExp(`<${c}cols\\\\b[\\\\s\\\\S]*?<\\\\/${c}cols>|<${c}cols\\\\s*\\\\/>`);l=e.test(l)?l.replace(e,this.colsXml()):l+this.colsXml()}if(o.dirtyView||o.structural){let{rows:i,cols:d}=o.frozen,f=i||d?`<${c}pane${d?` xSplit="${d}"`:``}${i?` ySplit="${i}"`:``} topLeftCell="${no(d)}${i+1}" activePane="${i&&d?`bottomRight`:i?`bottomLeft`:`topRight`}" state="frozen"/>`:``,p=RegExp(`<${c}sheetViews>[\\\\s\\\\S]*?<\\\\/${c}sheetViews>`).exec(l);if(p){let i=t(p[0]),c=s(a(i),`sheetView`);c&&(c.c=c.c.filter(t=>!e(t)||r(t.q)!==`pane`&&r(t.q)!==`selection`),f&&c.c.unshift(f),u(c,`showGridLines`,o.gridLines?void 0:`0`),c.self=c.c.length===0,l=l.replace(p[0],n(i)))}else if(f||!o.gridLines){let e=`<${c}sheetViews><${c}sheetView${o.gridLines?``:` showGridLines="0"`} workbookViewId="0">${f}</${c}sheetView></${c}sheetViews>`,t=l.search(RegExp(`<${c}(sheetFormatPr|cols)\\\\b`));l=t>=0?l.slice(0,t)+e+l.slice(t):l+e}}return o.structural&&(l=l.replace(RegExp(`<${c}dimension\\\\b[^>]*\\\\/>`),`<${c}dimension ref="A1:${no(Math.max(0,o.maxCol))}${Math.max(1,o.maxRow+1)}"/>`)),l}tailFix(e){let t=this.d;if(!t.dirtyMerges&&!t.structural)return e;let n=this.P,r=t.merges,i=r.length?`<${n}mergeCells count="${r.length}">${r.map(e=>`<${n}mergeCell ref="${no(e.c0)}${e.r0+1}:${no(e.c1)}${e.r1+1}"/>`).join(``)}</${n}mergeCells>`:``,a=RegExp(`<${n}mergeCells\\\\b[\\\\s\\\\S]*?<\\\\/${n}mergeCells>|<${n}mergeCells\\\\b[^>]*\\\\/>`);if(a.test(e))return e.replace(a,i);let o=0,s=/<(\\w+:)?(sheetCalcPr|sheetProtection|protectedRanges|scenarios|autoFilter|sortState|dataConsolidate|customSheetViews)\\b[\\s\\S]*?(\\/>|<\\/(\\w+:)?\\2>)/g;for(let t=s.exec(e);t;t=s.exec(e))o=t.index+t[0].length;return e.slice(0,o)+i+e.slice(o)}push(e,t){let n=this.buf+e;this.buf=``;let r=[];if(this.phase===`tail`)return this.tail+=n,t&&r.push(this.tailFix(this.tail)),r;let i=0;if(this.phase===`head`){let e=/<([\\w.-]+:)?sheetData(\\s[^>]*)?(\\/?)>/.exec(n);if(!e)return t?r.push(this.headFix(n)):this.buf=n,r;this.P=e[1]??``,r.push(this.headFix(n.slice(0,e.index)));let a=e.index+e[0].length;if(e[3]===`/`){if(r.push(`<${this.P}sheetData>`),this.d.structural)r.push(...this.allRows());else{let e=``;for(;this.next<this.rows.length;)e+=this.newRow(this.rows[this.next++]);r.push(e)}return r.push(`</${this.P}sheetData>`),this.phase=`tail`,[...r,...this.push(n.slice(a),t)]}r.push(e[0]),i=a,this.phase=this.d.structural?`skip`:`data`}let a=`</${this.P}sheetData>`;if(this.phase===`skip`){let e=n.indexOf(a,i);return e<0?(this.buf=n.slice(Math.max(i,n.length-a.length)),r):(r.push(...this.allRows(),a),this.phase=`tail`,[...r,...this.push(n.slice(e+a.length),t)])}let o=`<${this.P}row`,s=``,c=n.indexOf(a,i);for(;i<n.length;){let e=n.indexOf(o,i);if(c>=0&&c<i&&(c=n.indexOf(a,i)),c>=0&&(e<0||c<e))return s+=n.slice(i,c)+this.before(1/0)+a,r.push(s),this.phase=`tail`,[...r,...this.push(n.slice(c+a.length),t)];if(e<0)break;let l=n.indexOf(`>`,e);if(l<0){s+=n.slice(i,e),i=e;break}let u=n.slice(e,l+1),d=u.charCodeAt(o.length);if(d!==32&&d!==62&&d!==47&&d!==9&&d!==10&&d!==13){s+=n.slice(i,l+1),i=l+1;continue}let f=/\\sr="(\\d+)"/.exec(u),p=f?Number(f[1])-1:this.lastRow+1;this.lastRow=p;let m=u.endsWith(`/>`),h;if(m)h=l+1;else{let t=n.indexOf(`</${this.P}row>`,l);if(t<0){s+=n.slice(i,e),i=e,this.lastRow=p-1;break}h=t+this.P.length+6}s+=n.slice(i,e)+this.before(p),this.next<this.rows.length&&this.rows[this.next]===p?(this.next++,s+=this.patchRow(n.slice(e,h),p)):s+=n.slice(e,h),i=h}return r.push(s),this.buf=n.slice(i),t&&r.push(this.buf),r}patchRow(o,c){let d=t(o),f=a(d);if(!f)return o;let p=i(f.q);if(u(f,`spans`,void 0),this.d.dirtyRows.has(c)){let e=this.d.rowAttrs.get(c);u(f,`ht`,e?.ht===void 0?void 0:String(e.ht)),u(f,`customHeight`,e?.ht===void 0?void 0:`1`),u(f,`hidden`,e?.hidden?`1`:void 0)}let m=[...this.rowCols.get(c)??[]].sort((e,t)=>e-t),g=/* @__PURE__ */ new Map,_=-1;f.c.forEach((t,n)=>{if(!e(t)||r(t.q)!==`c`)return;let i=l(t,`r`),a=i?ro(i)[1]:_+1;_=a,g.set(a,n)});let v=/* @__PURE__ */ new Map,y=[];for(let e of m){let t=c*Q+e,n=g.get(e);if(this.d.edited.has(t)){let t=Oo(this.d,c,e,p,this.wb);n===void 0?t&&y.push({c:e,node:t}):v.set(n,t)}else if(n!==void 0&&this.fix.has(t)){let e=f.c[n],r=s(e,`f`);r&&(r.a=``,r.c=[h(this.fix.get(t))],r.self=!1)}}for(let[e,t]of v)f.c[e]=t;if(y.length){let e=[...g.entries()].sort((e,t)=>e[0]-t[0]);for(let t of y.reverse()){let n=e.find(([e])=>e>t.c),r=n?n[1]:f.c.length;f.c.splice(r,0,t.node);for(let t of e)t[1]>=r&&t[1]++}f.self=!1}return n(d)}};const Fo=e=>e.replace(/[.*+?^${}()|[\\]\\\\]/g,`\\\\$&`),Io={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`},Lo=[`xfrm`,`custGeom`,`prstGeom`,`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`,`ln`,`effectLst`,`effectDag`,`scene3d`,`sp3d`,`extLst`],Ro=/* @__PURE__ */ new Set([`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`]),zo=e=>String(Math.round(e*je));function Bo(e){let t=s(s(a(e),`cSld`),`spTree`);if(!t)throw Error(`Slide has no shape tree`);return t}function Vo(e){let t=o(e).find(e=>/^nv.*Pr$/.test(r(e.q))),n=t?l(s(t,`cNvPr`)??t,`id`):void 0;return n===void 0?void 0:Number(n)}function Ho(t){let n=1;for(let i of t)e(i)&&v(i,e=>{r(e.q)===`cNvPr`&&(n=Math.max(n,Number(l(e,`id`)??0)))});return n}function Uo(t){let n=``;for(let r of t)e(r)&&v(r,e=>(!n&&/:(off|ext|t|p|bodyPr)$/.test(e.q)&&(n=i(e.q)),!!n));return n||`a:`}function Wo(e,t,n,i){let a=r(e.q),o;if(a===`graphicFrame`)o=e;else{let t=a===`grpSp`?`grpSpPr`:`spPr`,n=s(e,t);n||(n=d(i+t),e.c.splice(1,0,n)),o=n}let c=s(o,`xfrm`);c||(c=d((a===`graphicFrame`?i:n)+`xfrm`),a===`graphicFrame`?o.c.splice(1,0,c):m(o,c,`xfrm`,Lo));let l=(e,t)=>{let r=s(c,e);r||(r=d(n+e),c.c.splice(e===`off`?0:e===`ext`?1:c.c.length,0,r));for(let[e,n]of Object.entries(t))u(r,e,n)};l(`off`,{x:zo(t.x),y:zo(t.y)}),l(`ext`,{cx:zo(Math.max(1,t.w)),cy:zo(Math.max(1,t.h))}),u(c,`rot`,t.rot?String(Math.round((t.rot%360+360)%360*6e4)):void 0),t.flipH!==void 0&&u(c,`flipH`,t.flipH?`1`:void 0),t.flipV!==void 0&&u(c,`flipV`,t.flipV?`1`:void 0),c.self=!1,o.self=!1}function Go(e,t){return t?d(e+`solidFill`,{},[d(e+`srgbClr`,{val:t.replace(`#`,``).toUpperCase()})]):d(e+`noFill`)}function Ko(e,t,n,r,i,a,o){let s=`<${r}off x="${zo(n.x)}" y="${zo(n.y)}"/><${r}ext cx="${zo(n.w)}" cy="${zo(n.h)}"/>`;return e===`image`?`<${i}pic><${i}nvPicPr><${i}cNvPr id="${t}" name="Picture ${t}"/><${i}cNvPicPr><${r}picLocks noChangeAspect="1"/></${i}cNvPicPr><${i}nvPr/></${i}nvPicPr><${i}blipFill><${r}blip r:embed="${o}"/><${r}stretch><${r}fillRect/></${r}stretch></${i}blipFill><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="rect"><${r}avLst/></${r}prstGeom></${i}spPr></${i}pic>`:e===`text`?`<${i}sp><${i}nvSpPr><${i}cNvPr id="${t}" name="TextBox ${t}"/><${i}cNvSpPr txBox="1"/><${i}nvPr/></${i}nvSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="rect"><${r}avLst/></${r}prstGeom><${r}noFill/></${i}spPr><${i}txBody><${r}bodyPr wrap="square" rtlCol="0"><${r}spAutoFit/></${r}bodyPr><${r}lstStyle/>${(e=>`<${r}p><${r}r><${r}rPr lang="en-US" dirty="0"/><${r}t>${h(e)}</${r}t></${r}r></${r}p>`)(a??`Text`)}</${i}txBody></${i}sp>`:e===`line`?`<${i}cxnSp><${i}nvCxnSpPr><${i}cNvPr id="${t}" name="Connector ${t}"/><${i}cNvCxnSpPr/><${i}nvPr/></${i}nvCxnSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="line"><${r}avLst/></${r}prstGeom><${r}ln w="19050"><${r}solidFill><${r}schemeClr val="tx1"/></${r}solidFill></${r}ln></${i}spPr></${i}cxnSp>`:`<${i}sp><${i}nvSpPr><${i}cNvPr id="${t}" name="Shape ${t}"/><${i}cNvSpPr/><${i}nvPr/></${i}nvSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="${e}"><${r}avLst/></${r}prstGeom></${i}spPr><${i}style><${r}lnRef idx="2"><${r}schemeClr val="accent1"><${r}shade val="50000"/></${r}schemeClr></${r}lnRef><${r}fillRef idx="1"><${r}schemeClr val="accent1"/></${r}fillRef><${r}effectRef idx="0"><${r}schemeClr val="accent1"/></${r}effectRef><${r}fontRef idx="minor"><${r}schemeClr val="lt1"/></${r}fontRef></${i}style><${i}txBody><${r}bodyPr rtlCol="0" anchor="ctr"/><${r}lstStyle/><${r}p><${r}pPr algn="ctr"/>${a?`<${r}r><${r}rPr lang="en-US" dirty="0"/><${r}t>${h(a)}</${r}t></${r}r>`:``}<${r}endParaRPr lang="en-US" dirty="0"/></${r}p></${i}txBody></${i}sp>`}function qo(n,i,o,c){let l=s(a(n),`cSld`);if(!l||(l.c=l.c.filter(t=>!(e(t)&&r(t.q)===`bg`)),!c))return;let u=t(`<${o}bg><${o}bgPr><${i}solidFill><${i}srgbClr val="${c.replace(`#`,``).toUpperCase()}"/></${i}solidFill><${i}effectLst/></${o}bgPr></${o}bg>`)[0];l.c.unshift(u),l.self=!1}async function Jo(e,r,a){let o=e.meta.slides[r];if(!o)throw Error(`No slide #${r}`);let s=await e.pkg.text(o.path),c=t(s),l=Bo(c);await a(c,l,Uo(c),i(l.q));let u=n(c);return e.pkg.setPart(o.path,u),e.touched=!0,u!==s&&(e.undoStack.push({path:o.path,before:s,after:u}),e.undoStack.length>200&&e.undoStack.shift(),e.redoStack=[]),e.slide(r)}async function Yo(e,t=!1){let n=(t?e.redoStack:e.undoStack).pop();if(!n)return null;(t?e.undoStack:e.redoStack).push(n),e.pkg.setPart(n.path,t?n.after:n.before);let r=e.meta.slides.findIndex(e=>e.path===n.path);return r<0?null:{index:r,model:await e.slide(r)}}async function Xo(e,t,n,r){if(r=r.toLowerCase().replace(`jpeg`,`jpg`),!Io[r])throw Error(`Unsupported image type .${r}`);let i=e.meta.slides[t],a=e.pkg.freeName(`ppt/media`,`image`,r);return e.pkg.setPart(a,n),await e.pkg.ensureDefaultType(r,Io[r]),e.pkg.addRel(i.path,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,a)}function Zo(n,i,a){return Jo(n,i,(n,i,o,c)=>{let h=t=>{let n=i.c.findIndex(n=>e(n)&&Vo(n)===t);return n>=0?{node:i.c[n],i:n}:void 0};for(let g of a){if(g.op===`insert`){let e=Ho(n)+1,r=Ko(g.kind,e,g.box,o,c,g.text,g.rid);i.c.push(t(r)[0]);continue}if(g.op===`bg`){qo(n,o,c,g.color);continue}if(g.op===`anchor`){let e;v(i,t=>{if(e)return!0;r(t.q)===`sp`&&Number(l(s(s(t,`nvSpPr`),`cNvPr`)??t,`id`))===g.sid&&(e=s(s(t,`txBody`),`bodyPr`))}),e&&u(e,`anchor`,g.anchor);continue}let a=h(g.top);if(!a)continue;let{node:_,i:y}=a;switch(g.op){case`xfrm`:Wo(_,g.box,o,c);break;case`delete`:i.c.splice(y,1);break;case`order`:{let t=()=>i.c.map((t,n)=>e(t)&&!/^(nvGrpSpPr|grpSpPr|extLst)$/.test(r(t.q))?n:-1).filter(e=>e>=0),n=t().indexOf(y);i.c.splice(y,1);let a=t();if(g.to===`front`)i.c.splice(a.length?a[a.length-1]+1:i.c.length,0,_);else if(g.to===`back`)i.c.splice(a.length?a[0]:i.c.length,0,_);else{let e=g.to===`forward`?Math.min(a.length,n+1):Math.max(0,n-1);i.c.splice(e<a.length?a[e]:a.length?a[a.length-1]+1:i.c.length,0,_)}break}case`duplicate`:{let e=f(_),t=Ho(n);v(e,e=>{r(e.q)===`cNvPr`&&u(e,`id`,String(++t))});let a=(()=>{let t;return v(e,e=>(!t&&r(e.q)===`off`&&(t=e),!!t)),t})();a&&(u(a,`x`,String(Number(l(a,`x`)??0)+Math.round((g.dx??16)*je))),u(a,`y`,String(Number(l(a,`y`)??0)+Math.round((g.dy??16)*je)))),i.c.splice(y+1,0,e);break}case`fill`:case`line`:{let t=r(_.q);if(t!==`sp`&&t!==`cxnSp`&&t!==`pic`)break;let n=s(_,`spPr`);if(n||(n=d(c+`spPr`),_.c.splice(1,0,n)),g.op===`fill`)p(n,e=>Ro.has(e)),m(n,Go(o,g.color),g.color?`solidFill`:`noFill`,Lo);else{let t=f(s(n,`ln`)??d(o+`ln`));if(`color`in g?(p(t,e=>Ro.has(e)),t.c.unshift(Go(o,g.color??null))):t.c.some(t=>e(t)&&Ro.has(r(t.q)))||t.c.unshift(d(o+`solidFill`,{},[d(o+`schemeClr`,{val:`tx1`})])),g.dash!==void 0){p(t,e=>e===`prstDash`||e===`custDash`);let n=t.c.findIndex(t=>e(t)&&!Ro.has(r(t.q)));t.c.splice(n<0?t.c.length:n,0,d(o+`prstDash`,{val:g.dash}))}t.self=!1,g.w!==void 0&&u(t,`w`,String(Math.round(g.w*12700))),m(n,t,`ln`,Lo)}n.self=!1;break}}}})}async function Qo(n){let o=t(await n.pkg.text(n.mainPath)),c=a(o),l=i(c.q),u=s(c,`sldIdLst`);if(!u){u=d(l+`sldIdLst`);let t=c.c.findIndex(t=>e(t)&&r(t.q)===`sldMasterIdLst`);c.c.splice(t+1,0,u)}return{nodes:o,root:c,P:l,lst:u}}async function $o(e){let t=await e.pkg.rels(e.mainPath),{lst:n}=await Qo(e),r=[];for(let i of o(n,`sldId`)){let n=t.get(l(i,`r:id`)??l(i,`id`,!0)??``);n&&e.pkg.has(n.target)&&r.push({index:r.length,path:n.target,hidden:!1})}for(let t of r){let n=(await e.pkg.text(t.path)).slice(0,600);t.hidden=/<[\\w:]*sld\\b[^>]*\\sshow="0"/.test(n)}return e.meta.slides=r,e.meta.count=r.length,e.meta}async function es(e,t,n){let r=t?M(await e.pkg.rels(t),`slideLayout`)?.target:void 0,i=r?M(await e.pkg.rels(r),`slideMaster`)?.target:void 0;if(i||(i=M(await e.pkg.rels(e.mainPath),`slideMaster`)?.target),!i)return r;let a=De(await e.pkg.rels(i),`slideLayout`).map(e=>e.target),o=await Promise.all(a.map(async t=>/<[\\w:]*sldLayout\\b[^>]*\\stype="([^"]+)"/.exec((await e.pkg.text(t)).slice(0,800))?.[1])),s=n===`title`?[`title`]:n===`blank`?[`blank`]:[`obj`,`txAndObj`,`tx`],c=o.findIndex(e=>e&&s.includes(e));return c>=0?a[c]:r??a[0]}async function ts(e,n){let r=``;if(n){let i=s(s(a(t(await e.pkg.text(n))),`cSld`),`spTree`),c=2;for(let e of o(i,`sp`)){let t=s(s(s(e,`nvSpPr`),`nvPr`),`ph`);if(!t)continue;let n=l(t,`type`);if(n&&[`dt`,`ftr`,`sldNum`].includes(n))continue;let i=l(s(s(e,`nvSpPr`),`cNvPr`)??e,`name`)??`Placeholder ${c}`,a=`<p:ph${n?` type="${n}"`:``}${l(t,`idx`)?` idx="${l(t,`idx`)}"`:``}/>`;r+=`<p:sp><p:nvSpPr><p:cNvPr id="${c++}" name="${h(i)}"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr>${a}</p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US" dirty="0"/></a:p></p:txBody></p:sp>`}}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\\n<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>${r}</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`}async function ns(e,t,r,i){let a=e.pkg.freeName(`ppt/slides`,`slide`,`xml`);e.pkg.setPart(a,r),e.pkg.setPart(Te(a),i),await e.pkg.setContentType(a,`application/vnd.openxmlformats-officedocument.presentationml.slide+xml`);let s=await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide`,a),{nodes:c,root:u,P:f,lst:p}=await Qo(e),m=o(p,`sldId`).map(e=>Number(l(e,`id`)??0)),h=Math.max(255,...m)+1,g=d(f+`sldId`,{id:String(h),...b(u,`id`,s)}),_=o(p,`sldId`),v=t<0?0:p.c.indexOf(_[Math.min(t,_.length-1)])+1;p.c.splice(v,0,g),p.self=!1,e.pkg.setPart(e.mainPath,n(c))}async function rs(r,i){let s=r.meta.slides;switch(r.touched=!0,i.op){case`add`:{let e=s[Math.max(0,Math.min(i.after,s.length-1))]?.path,t=await es(r,e,i.layout??`content`),n=await ts(r,t),a=t?`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/${t.split(`/`).pop()}"/></Relationships>`:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;await ns(r,i.after,n,a);break}case`duplicate`:{let o=s[i.index];if(!o)break;let c=await r.pkg.text(o.path),u=Te(o.path),d=r.pkg.has(u)?await r.pkg.text(u):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`,f=t(d),p=a(f);p.c=p.c.filter(t=>!(e(t)&&/notesSlide$/.test(l(t,`Type`)??``))),d=n(f),await ns(r,i.index,c,d);break}case`delete`:{let e=s[i.index];if(!e||s.length<=1)break;let{nodes:t,lst:a}=await Qo(r),c=await r.pkg.rels(r.mainPath),u=o(a,`sldId`).find(t=>c.get(l(t,`r:id`)??``)?.target===e.path);u&&a.c.splice(a.c.indexOf(u),1),r.pkg.setPart(r.mainPath,n(t));let d=M(await r.pkg.rels(e.path),`notesSlide`)?.target;await r.pkg.removeRelsTo(r.mainPath,e.path);for(let t of[e.path,d].filter(Boolean))r.pkg.setPart(t,null),r.pkg.has(Te(t))&&r.pkg.setPart(Te(t),null),await r.pkg.setContentType(t,null);break}case`move`:{let{nodes:e,lst:t}=await Qo(r),a=o(t,`sldId`),s=a[i.from];if(!s||i.to<0||i.to>=a.length)break;t.c.splice(t.c.indexOf(s),1);let c=o(t,`sldId`),l=i.to>=c.length?t.c.length:t.c.indexOf(c[i.to]);t.c.splice(l,0,s),r.pkg.setPart(r.mainPath,n(e));break}case`hide`:{let e=s[i.index];if(!e)break;let o=t(await r.pkg.text(e.path));u(a(o),`show`,i.hidden?`0`:void 0),r.pkg.setPart(e.path,n(o));break}}return $o(r)}const is=/* @__PURE__ */ new Set([`insertRows`,`deleteRows`,`insertCols`,`deleteCols`]);var as=class{constructor(e,t,n){w(this,`ed`,void 0),w(this,`wb`,void 0),w(this,`emit`,void 0),w(this,`recs`,/* @__PURE__ */ new Map),w(this,`byOp`,/* @__PURE__ */ new Map),w(this,`seq`,0),this.ed=e,this.wb=t,this.emit=n}index(e){let t=this.wb.sheets.findIndex(t=>t.path===e);if(t<0)throw new os;return t}async sheet(e){let t=this.index(e);return await this.wb.loadSheet(t,this.emit),t}dropSheet(e){for(let[t,n]of this.recs)(e===null||n.ch?.sheet===e)&&(this.recs.delete(t),this.byOp.delete(n.op))}async apply(e){let t=await this.ed.styleMark(),n;try{n=await this.run(e)}catch(e){if(e instanceof os)return{res:null,rec:null};throw e}let r=this.ed.takeRecord(),i=await this.ed.styleMark(),a=Object.keys(i).some(e=>i[e]!==t[e]);if(e.t===`book`||e.t===`sheet`&&is.has(e.op.op))return this.dropSheet(null),{res:n,rec:null};let o=++this.seq;if(this.recs.set(o,{ch:r,styles:a?t:void 0,op:e.id}),this.byOp.set(e.id,o),this.recs.size>400){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:n,rec:o}}async run(e){let t=this.ed;switch(e.t){case`set`:return t.setCells(await this.sheet(e.sheet),e.cells);case`fmt`:return t.format(await this.sheet(e.sheet),e.range,e.patch);case`sheet`:return t.sheetOp(await this.sheet(e.sheet),e.op);case`replace`:return t.replace(await this.sheet(e.sheet),e.query,e.by,e.opts,e.at);case`book`:{let n=e.op,r;r=n.op===`add`?{op:`add`,name:n.name,after:n.after?this.index(n.after):void 0}:n.op===`rename`?{op:`rename`,index:this.index(n.path),name:n.name}:n.op===`delete`?{op:`delete`,index:this.index(n.path)}:{op:`move`,from:this.index(n.path),to:Math.max(0,Math.min(n.to,this.wb.sheets.length-1))};try{return await t.bookOp(r)}catch{throw new os}}case`revert`:{let n=this.byOp.get(e.target),r=n===void 0?void 0:this.recs.get(n);if(!r?.ch)throw new os;return t.restoreRecord(r.ch,e.which)}}}async revert(e){let t=this.recs.get(e);if(!t)return null;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op);let n=t.ch?this.ed.revertRecord(t.ch):null;return t.styles&&await this.ed.styleTruncate(t.styles),n}},os=class extends Error{},ss=class{constructor(e){w(this,`pres`,void 0),w(this,`recs`,/* @__PURE__ */ new Map),w(this,`byOp`,/* @__PURE__ */ new Map),w(this,`seq`,0),w(this,`images`,/* @__PURE__ */ new Map),w(this,`ready`,void 0),this.pres=e}async originals(){for(let e of this.pres.meta.slides)await this.pres.keepOriginal(e.path)}index(e){return this.pres.meta.slides.findIndex(t=>t.path===e)}get genMaps(){return this.pres.genMaps}async snap(e){return{xml:await this.pres.pkg.text(e),gen:[...this.genMaps].filter(([t])=>t.startsWith(e+`#`))}}restore(e,t){this.pres.pkg.setPart(e,t.xml);for(let t of[...this.genMaps.keys()])t.startsWith(e+`#`)&&this.genMaps.delete(t);for(let[e,n]of t.gen)this.genMaps.set(e,n);this.pres.touched=!0}async model(e){let t=this.index(e);return t<0?{}:{slide:t,model:await this.pres.slide(t)}}async apply(e){let t=this.pres;if(await(this.ready??(this.ready=this.originals())),e.t===`image`){let n=this.index(e.slide);if(n<0)return{res:{},rec:null};let r=this.images.get(e.key);return r||(r=await Xo(t,n,e.bytes,e.ext),this.images.set(e.key,r)),{res:{rid:r},rec:null}}if(e.t===`slides`){let n=e.op,r=e=>this.index(e),i=null;if(n.op===`add`?i={op:`add`,after:n.after?r(n.after):-1,layout:n.layout}:r(n.path)>=0&&(i=n.op===`duplicate`?{op:`duplicate`,index:r(n.path)}:n.op===`delete`?t.meta.slides.length>1?{op:`delete`,index:r(n.path)}:null:n.op===`move`?{op:`move`,from:r(n.path),to:Math.max(0,Math.min(n.to,t.meta.slides.length-1))}:{op:`hide`,index:r(n.path),hidden:n.hidden}),!i)return{res:{},rec:null};let a=await rs(t,i);return await this.originals(),this.recs.clear(),this.byOp.clear(),{res:{meta:{...a,slides:a.slides.map(e=>({...e}))}},rec:null}}let n,r;if(e.t===`revert`){let t=this.byOp.get(e.target);if(r=t===void 0?void 0:this.recs.get(t),!r)return{res:{},rec:null};n=r.path}else n=e.slide;let i=this.index(n);if(i<0)return{res:{},rec:null};let a=await this.snap(n);if(e.t===`text`)try{await t.setText(i,e.sid,e.paras)}catch{return{res:{},rec:null}}else e.t===`shapes`?await Zo(t,i,e.ops.map(e=>{if(e.op!==`insert`||!e.key)return e;let{key:t,...n}=e;return{...n,rid:this.images.get(t)}})):r&&this.restore(n,e.which===`prev`?r.before:r.after);t.undoStack=[],t.redoStack=[];let o=++this.seq;if(this.recs.set(o,{path:n,before:a,after:await this.snap(n),op:e.id}),this.byOp.set(e.id,o),this.recs.size>300){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:await this.model(n),rec:o}}async revert(e){let t=this.recs.get(e);return t?(this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op),this.restore(t.path,t.before),this.model(t.path)):{}}};const cs=/* @__PURE__ */ new Set([`docx.edit`,`docx.table`,`docx.image`,`docx.link`,`docx.style`,`save`,`xlsx.set`,`xlsx.format`,`xlsx.sheetOp`,`xlsx.bookOp`,`xlsx.replace`,`xlsx.undo`,`xlsx.redo`,`collab.xlsx.apply`,`collab.xlsx.revert`,`pptx.setText`,`pptx.shapes`,`pptx.slides`,`pptx.image`,`pptx.undo`,`collab.pptx.apply`,`collab.pptx.revert`]);var ls=class{constructor(e){w(this,`emit`,void 0),w(this,`pkg`,void 0),w(this,`kind`,void 0),w(this,`docx`,void 0),w(this,`xlsx`,void 0),w(this,`xlsxEd`,void 0),w(this,`pptx`,void 0),w(this,`abort`,new AbortController),w(this,`writes`,Promise.resolve()),w(this,`xcollab`,void 0),w(this,`pcollab`,void 0),this.emit=e}async open(e,t={}){let n=await Un(e,{...t,signal:this.abort.signal,onProgress:(e,t)=>this.emit(`progress`,{phase:`download`,loaded:e,total:t})}),r=await ee.open(n),i=this.pkg=new Ee(r),a=await i.mainPart();this.kind=a.kind;let o={kind:a.kind,name:t.name??n.name,size:n.size};return a.kind===`docx`?this.docx=await ht.open(i,a.path):a.kind===`xlsx`?o.xlsx=(this.xlsx=await co.open(i,a.path)).meta():o.pptx=(this.pptx=await jn.open(i,a.path)).meta,o}call(e,t){if(!cs.has(e))return this.dispatch(e,t);let n=this.writes.then(()=>this.dispatch(e,t));return this.writes=n.catch(()=>{}),n}async dispatch(e,t){switch(e){case`open`:return this.open(t[0],t[1]);case`part`:return this.need(this.pkg).blob(t[0]);case`docx.start`:{let e=this.need(this.docx);try{await e.stream({signal:this.abort.signal,onBlocks:e=>this.emit(`docx:blocks`,e),onMeta:e=>this.emit(`docx:meta`,e),onProgress:(e,t)=>this.emit(`progress`,{phase:`parse`,loaded:e,total:t})}),this.emit(`docx:done`,{})}catch(e){this.emit(`docx:done`,{error:e.message})}return}case`docx.edit`:return Vt(this.need(this.docx),t[0]);case`docx.table`:return Zt(this.need(this.docx),t[0]);case`docx.image`:return Gt(this.need(this.docx),new Uint8Array(t[0]),t[1]);case`docx.link`:return Kt(this.need(this.docx),t[0]);case`docx.style`:return Nt(this.need(this.docx),t[0]);case`save`:return this.save();case`dirty`:return this.docx?this.docx.dirty:this.xlsxEd?this.xlsxEd.dirty:this.pptx?this.pptx.dirty:this.need(this.pkg).dirty;case`xlsx.load`:this.need(this.xlsx).loadSheet(t[0],e=>this.emit(`xlsx:progress`,e),(e,t,n)=>this.emit(`progress`,{phase:e,loaded:t,total:n}));return;case`xlsx.set`:return this.xed().setCells(t[0],t[1]);case`xlsx.format`:return this.xed().format(t[0],t[1],t[2]);case`xlsx.sheetOp`:return this.xed().sheetOp(t[0],t[1]);case`xlsx.replace`:return this.xed().replace(t[0],t[1],t[2],t[3],t[4]);case`xlsx.bookOp`:return this.xed().bookOp(t[0]);case`xlsx.undo`:return this.xed().undo();case`xlsx.redo`:return this.xed().redo();case`collab.xlsx.apply`:return this.xc().apply(t[0]);case`collab.xlsx.revert`:return this.xc().revert(t[0]);case`collab.pptx.apply`:return(this.pcollab??(this.pcollab=new ss(this.need(this.pptx)))).apply(t[0]);case`collab.pptx.revert`:return(this.pcollab??(this.pcollab=new ss(this.need(this.pptx)))).revert(t[0]);case`xlsx.block`:return this.need(this.xlsx).block(t[0],t[1],t[2]);case`xlsx.cell`:return this.need(this.xlsx).cell(t[0],t[1],t[2]);case`xlsx.find`:return this.need(this.xlsx).find(t[0],t[1],t[2]);case`pptx.setText`:return this.need(this.pptx).setText(t[0],t[1],t[2]);case`pptx.shapes`:return Zo(this.need(this.pptx),t[0],t[1]);case`pptx.slides`:return rs(this.need(this.pptx),t[0]);case`pptx.image`:return Xo(this.need(this.pptx),t[0],new Uint8Array(t[1]),t[2]);case`pptx.slide`:return this.need(this.pptx).slide(t[0]);case`pptx.undo`:return Yo(this.need(this.pptx),!!t[0])}throw Error(`Unknown method ${String(e)}`)}xc(){return this.xcollab??(this.xcollab=new as(this.xed(),this.need(this.xlsx),e=>this.emit(`xlsx:progress`,e)))}xed(){return this.xlsxEd??(this.xlsxEd=new Do(this.need(this.xlsx)))}async save(){if(this.docx)return Qt(this.docx);if(this.xlsx)return this.xed().save();if(this.pptx)return this.pptx.save();throw Error(`Saving is not supported for this document yet`)}dispose(){this.abort.abort()}need(e){if(!e)throw Error(this.kind?`Operation not available for ${this.kind}`:`Document not opened`);return e}};const us=self,ds=new ls((e,t)=>{us.postMessage({event:e,data:t})});us.onmessage=async e=>{let{id:t,method:n,args:r}=e.data;try{let e=await ds.call(n,r);us.postMessage({id:t,ok:!0,result:e})}catch(e){us.postMessage({id:t,ok:!1,error:e?.message??String(e)})}};',p=typeof self<`u`&&self.Blob&&new Blob([`URL.revokeObjectURL(import.meta.url);`,f],{type:`text/javascript;charset=utf-8`});function m(e){let t;try{if(t=p&&(self.URL||self.webkitURL).createObjectURL(p),!t)throw``;let n=new Worker(t,{type:`module`,name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(f),{type:`module`,name:e?.name})}}var h=e=>typeof e==`object`&&!!e;function g(e){let t=[],n=[],r=e=>(n.length?n[n.length-1].c:t).push(e),i=0,a=e.length;for(;i<a;){let t=e.indexOf(`<`,i);if(t<0){r(e.slice(i));break}t>i&&r(e.slice(i,t));let o=e[t+1];if(o===`!`||o===`?`){let n;n=e.startsWith(`<!--`,t)?e.indexOf(`-->`,t)+3:e.startsWith(`<![CDATA[`,t)?e.indexOf(`]]>`,t)+3:o===`?`?e.indexOf(`?>`,t)+2:e.indexOf(`>`,t)+1,n<=0&&(n=a),r(e.slice(t,n)),i=n;continue}if(o===`/`){let r=e.indexOf(`>`,t);n.pop(),i=r<0?a:r+1;continue}let s=-1,c=``;for(let n=t+1;n<a;n++){let t=e[n];if(c)t===c&&(c=``);else if(t===`"`||t===`'`)c=t;else if(t===`>`){s=n;break}}s<0&&(s=a-1);let l=e.slice(t+1,s),u=l.endsWith(`/`);u&&(l=l.slice(0,-1));let d=/^[^\s/>]+/.exec(l),f=d?d[0]:l,p={q:f,a:l.slice(f.length),c:[],self:u};r(p),u||n.push(p),i=s+1}return t}function _(e){if(Array.isArray(e)){let t=``;for(let n of e)t+=_(n);return t}return typeof e==`string`?e:e.self&&!e.c.length?`<${e.q}${e.a}/>`:`<${e.q}${e.a}>${_(e.c)}</${e.q}>`}var v=e=>e.slice(e.indexOf(`:`)+1),y=e=>e.includes(`:`)?e.slice(0,e.indexOf(`:`)+1):``;function b(e){return e.find(h)}function x(e,t){return e?e.c.filter(e=>h(e)&&(!t||v(e.q)===t)):[]}function S(e,t){if(e){for(let n of e.c)if(h(n)&&v(n.q)===t)return n}}var C=/([^\s=]+)\s*=\s*("([^"]*)"|'([^']*)')/g;function w(e,t,n=!1){C.lastIndex=0;let r;for(;r=C.exec(e.a);)if(r[1]===t||n&&v(r[1])===t)return re(r[3]??r[4]??``)}function T(e,t,n){C.lastIndex=0;let r;for(;r=C.exec(e.a);)if(r[1]===t){let i=n===void 0?``:`${t}="${ne(n)}"`;e.a=e.a.slice(0,r.index)+i+e.a.slice(r.index+r[0].length),n===void 0&&(e.a=e.a.replace(/\s+$/,``).replace(/\s{2,}/g,` `));return}n!==void 0&&(e.a=`${e.a.replace(/\s+$/,``)} ${t}="${ne(n)}"`)}function E(e,t={},n=[]){let r=``;for(let[e,n]of Object.entries(t))n!==void 0&&(r+=` ${e}="${ne(n)}"`);return{q:e,a:r,c:n,self:n.length===0}}function D(e){if(typeof e==`string`)return e;let t=e;return{q:t.q,a:t.a,self:t.self,c:t.c.map(D)}}function ee(e,t){let n=typeof t==`string`?e=>e===t:t;e.c=e.c.filter(e=>!(h(e)&&n(v(e.q))))}function O(e,t,n,r){let i=e.c.findIndex(e=>h(e)&&v(e.q)===n);if(i>=0){t?e.c[i]=t:e.c.splice(i,1),e.self=e.c.length===0;return}if(!t)return;let a=r.indexOf(n),o=e.c.length;for(let t=0;t<e.c.length;t++){let n=e.c[t];if(h(n)&&r.indexOf(v(n.q))>a){o=t;break}}e.c.splice(o,0,t),e.self=!1}function te(e){return e.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\uFFFE\uFFFF]/g,``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function ne(e){return te(e).replace(/"/g,`"`)}function re(e){return e.indexOf(`&`)<0?e:e.replace(/&(lt|gt|amp|quot|apos|#\d+|#x[0-9a-fA-F]+);/g,(e,t)=>{switch(t){case`lt`:return`<`;case`gt`:return`>`;case`amp`:return`&`;case`quot`:return`"`;case`apos`:return`'`}let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)?String.fromCodePoint(n):e})}function ie(e,t){let n=e=>{let r=!1,i=v(e.q)===`AlternateContent`;for(let a=0;a<e.c.length;a++){let o=e.c[a];if(!h(o))continue;let s=v(o.q);if(s!==`Fallback`){if(i&&s===`Choice`){if(r)continue;r=!0,n(o)}else s===`AlternateContent`?n(o):t(o,e,a)||n(o)}}};n(e)}var ae=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`;function oe(e,t=`id`,n){let r=RegExp(`xmlns:([\\w.-]+)="${ae.replace(/[.]/g,`\\.`)}"`).exec(e.a);return r?{[`${r[1]}:${t}`]:n}:{"xmlns:r":ae,[`r:${t}`]:n}}function k(e){"@babel/helpers - typeof";return k=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k(e)}function se(e,t){if(k(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(k(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ce(e){var t=se(e,`string`);return k(t)==`symbol`?t:t+``}function A(e,t,n){return(t=ce(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=101010256,ue=117853008,de=101075792,j=33639248,M=67324752,N=(e,t)=>Number(e.getBigUint64(t,!0)),fe=class e{constructor(e){A(this,`src`,void 0),A(this,`entries`,new Map),this.src=e}static async open(t){let n=new e(t);return await n.readDirectory(),n}async readDirectory(){let{src:e}=this;if(e.size<22)throw Error(`Not a ZIP/OOXML file (too small)`);let t=Math.min(e.size,65577),n=e.size-t,r=await e.read(n,t),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=-1;for(let e=r.length-22;e>=0;e--)if(i.getUint32(e,!0)===le){a=e;break}if(a<0){let t=await e.read(0,8);throw t[0]===208&&t[1]===207?Error(`Legacy binary Office format (.doc/.xls/.ppt) or encrypted file is not supported`):Error(`Not a ZIP/OOXML file (no end of central directory)`)}let o=i.getUint16(a+10,!0),s=i.getUint32(a+12,!0),c=i.getUint32(a+16,!0);if(o===65535||s===4294967295||c===4294967295){let t=a-20;if(t>=0&&i.getUint32(t,!0)===ue){let n=N(i,t+8),r=await e.read(n,56),a=new DataView(r.buffer,r.byteOffset,r.byteLength);a.getUint32(0,!0)===de&&(o=N(a,32),s=N(a,40),c=N(a,48))}}let l=await e.read(c,s),u=new DataView(l.buffer,l.byteOffset,l.byteLength),d=new TextDecoder,f=0;for(let e=0;e<o&&f+46<=l.length&&u.getUint32(f,!0)===j;e++){let e=u.getUint16(f+8,!0),t=u.getUint16(f+10,!0),n=u.getUint16(f+12,!0),r=u.getUint16(f+14,!0),i=u.getUint32(f+16,!0),a=u.getUint32(f+20,!0),o=u.getUint32(f+24,!0),s=u.getUint16(f+28,!0),c=u.getUint16(f+30,!0),p=u.getUint16(f+32,!0),m=u.getUint32(f+42,!0),h=d.decode(l.subarray(f+46,f+46+s));if(o===4294967295||a===4294967295||m===4294967295){let e=f+46+s,t=e+c;for(;e+4<=t;){let t=u.getUint16(e,!0),n=u.getUint16(e+2,!0);if(t===1){let t=e+4;o===4294967295&&(o=N(u,t),t+=8),a===4294967295&&(a=N(u,t),t+=8),m===4294967295&&(m=N(u,t));break}e+=4+n}}h.endsWith(`/`)||this.entries.set(pe(h),{name:h,method:t,flags:e,crc:i,time:n,date:r,compSize:a,size:o,localOffset:m}),f+=46+s+c+p}}list(){return[...this.entries.values()]}get(e){return this.entries.get(pe(e))}has(e){return this.entries.has(pe(e))}async dataOffset(e){if(e.dataOffset!==void 0)return e.dataOffset;let t=await this.src.read(e.localOffset,30),n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==M)throw Error(`Corrupt ZIP local header for ${e.name}`);return e.dataOffset=e.localOffset+30+n.getUint16(26,!0)+n.getUint16(28,!0),e.dataOffset}async rawData(e){let t=await this.dataOffset(e);return this.src.slice?this.src.slice(t,e.compSize):this.src.read(t,e.compSize)}async stream(e,t){let n=this.get(e);if(!n)throw Error(`Missing part: ${e}`);if(n.flags&1)throw Error(`Encrypted documents are not supported`);let r=await this.dataOffset(n),i=this.src.stream(r,n.compSize);if(t){let e=0,r=n.compSize;i=i.pipeThrough(new TransformStream({transform(n,i){e+=n.length,t(e,r),i.enqueue(n)}}))}if(n.method===0)return i;if(n.method===8)return i.pipeThrough(new DecompressionStream(`deflate-raw`));throw Error(`Unsupported ZIP compression method ${n.method} for ${n.name}`)}async bytes(e){let t=this.get(e);if(!t)throw Error(`Missing part: ${e}`);let n=(await this.stream(e)).getReader(),r=new Uint8Array(t.size),i=0,a=[];for(;;){let{done:e,value:t}=await n.read();if(e)break;i+t.length<=r.length?r.set(t,i):a.push(t),i+=t.length}if(!a.length)return i===r.length?r:r.subarray(0,i);let o=new Uint8Array(i);o.set(r);let s=r.length;for(let e of a)o.set(e,s),s+=e.length;return o}async text(e){return new TextDecoder().decode(await this.bytes(e))}};function pe(e){return e.replace(/^\/+/,``).replace(/\\/g,`/`).toLowerCase()}var me=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function he(e,t=0){let n=~t>>>0;for(let t=0;t<e.length;t++)n=me[(n^e[t])&255]^n>>>8;return~n>>>0}var ge=globalThis.Bun!==void 0;async function P(e){let t=0,n=0,r=e.pipeThrough(new TransformStream({transform(e,r){t=he(e,t),n+=e.length,r.enqueue(e)}})).pipeThrough(new CompressionStream(`deflate-raw`)).getReader(),i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t),a+=t.length}return{chunks:i,crc:t,size:n,csize:a}}function _e(e){if(typeof e==`function`)return e();let t=typeof e==`string`?new TextEncoder().encode(e):e;return new ReadableStream({start(e){e.enqueue(t),e.close()}})}function ve(){let e=new Date;return{time:e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1,date:e.getFullYear()-1980<<9|e.getMonth()+1<<5|e.getDate()}}async function ye(e,t,n=`application/zip`){let r=new TextEncoder,i=[],a=[],o=0,s=0,c=new Map;for(let[e,n]of t)c.set(pe(e),{name:e.replace(/^\/+/,``),data:n});let l=(e,t,n,c,l,u,d,f)=>{let p=r.encode(e),m=/[^\x20-\x7e]/.test(e)?2048:0;if(o>4294967280||c>4294967280)throw Error(`Saved file exceeds 4 GB (ZIP64 writing not supported)`);let h=new Uint8Array(30+p.length),g=new DataView(h.buffer);g.setUint32(0,67324752,!0),g.setUint16(4,20,!0),g.setUint16(6,m,!0),g.setUint16(8,t,!0),g.setUint16(10,u,!0),g.setUint16(12,d,!0),g.setUint32(14,n,!0),g.setUint32(18,c,!0),g.setUint32(22,l,!0),g.setUint16(26,p.length,!0),h.set(p,30);let _=new Uint8Array(46+p.length),v=new DataView(_.buffer);v.setUint32(0,33639248,!0),v.setUint16(4,20,!0),v.setUint16(6,20,!0),v.setUint16(8,m,!0),v.setUint16(10,t,!0),v.setUint16(12,u,!0),v.setUint16(14,d,!0),v.setUint32(16,n,!0),v.setUint32(20,c,!0),v.setUint32(24,l,!0),v.setUint16(28,p.length,!0),v.setUint32(42,o,!0),_.set(p,46),i.push(h,...f),a.push(_),o+=h.length+c,s++},u=async(e,t)=>{let n=await P(_e(t)),{time:r,date:i}=ve();l(e,8,n.crc,n.csize,n.size,r,i,n.chunks)};for(let t of e?.list()??[]){let n=pe(t.name),r=c.get(n);if(r){c.delete(n),r.data!==null&&await u(t.name,r.data);continue}let i=await e.rawData(t);ge&&i instanceof Blob&&(i=new Uint8Array(await i.arrayBuffer())),l(t.name,t.method,t.crc,t.compSize,t.size,t.time,t.date,[i])}for(let{name:e,data:t}of c.values())t!==null&&await u(e,t);let d=a.reduce((e,t)=>e+t.length,0),f=new Uint8Array(22),p=new DataView(f.buffer);return p.setUint32(0,101010256,!0),p.setUint16(8,s,!0),p.setUint16(10,s,!0),p.setUint32(12,d,!0),p.setUint32(16,o,!0),new Blob([...i,...a,f],{type:n})}function be(e,t=`application/zip`){return ye(null,e,t)}var xe=new Set([`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`http://purl.oclc.org/ooxml/officeDocument/relationships`]),F={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`};function I(e){return e.indexOf(`&`)<0?e:e.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`||t[1]===`X`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)&&n<=1114111?String.fromCodePoint(n):e}return F[t]??e})}var Se=e=>e===32||e===9||e===10||e===13,Ce=class{constructor(e,t){A(this,`h`,void 0),A(this,`raw`,void 0),A(this,`buf`,``),A(this,`depth`,0),A(this,`skipDepth`,-1),A(this,`relPrefixes`,new Set([`r`])),this.h=e,this.raw=t}write(e){this.buf=this.buf.length?this.buf+e:e,this.run(!1)}end(){this.run(!0),this.buf=``}run(e){let t=this.buf,n=t.length,r=0;for(;r<n;){let i=t.indexOf(`<`,r);if(i<0){if(e){let e=t.substring(r);this.raw?.(e),this.onText(e),r=n}break}if(i>r){let e=t.substring(r,i);this.raw?.(e),this.onText(e)}if(r=i,i+1>=n)break;let a=t.charCodeAt(i+1);if(a===47){let e=t.indexOf(`>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+1)),this.onClose(t.substring(i+2,e)),r=e+1;continue}if(a===63){let e=t.indexOf(`?>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+2)),r=e+2;continue}if(a===33){if(n-i<9&&!e)break;if(t.startsWith(`<!--`,i)){let e=t.indexOf(`-->`,i+4);if(e<0)break;this.raw?.(t.substring(i,e+3)),r=e+3;continue}if(t.startsWith(`<![CDATA[`,i)){let e=t.indexOf(`]]>`,i+9);if(e<0)break;this.raw?.(t.substring(i,e+3)),this.skipDepth<0&&this.h.text(t.substring(i+9,e)),r=e+3;continue}let a=t.indexOf(`>`,i+2);if(a<0)break;this.raw?.(t.substring(i,a+1)),r=a+1;continue}let o=-1,s=0;for(let e=i+1;e<n;e++){let n=t.charCodeAt(e);if(s!==0)n===s&&(s=0);else if(n===34||n===39)s=n;else if(n===62){o=e;break}}if(o<0)break;this.raw?.(t.substring(i,o+1)),this.onOpen(t,i+1,o),r=o+1}this.buf=r>=n?``:t.substring(r)}onText(e){this.skipDepth>=0||this.depth===0||this.h.text(e.indexOf(`&`)>=0?I(e):e)}onOpen(e,t,n){let r=n,i=!1;if(e.charCodeAt(n-1)===47&&(i=!0,r=n-1),this.skipDepth>=0){i||this.depth++;return}let a=t;for(;a<r&&!Se(e.charCodeAt(a));)a++;let o=e.substring(t,a),s=o.indexOf(`:`),c=s<0?o:o.substring(s+1),l={};for(;a<r;){if(Se(e.charCodeAt(a))){a++;continue}let t=e.indexOf(`=`,a);if(t<0||t>=r)break;let n=e.substring(a,t).trim(),i=t+1;for(;i<r&&e.charCodeAt(i)!==34&&e.charCodeAt(i)!==39;)i++;if(i>=r)break;let o=e.indexOf(e[i],i+1);if(o<0)break;let s=e.substring(i+1,o);a=o+1;let c=n.indexOf(`:`);if(c>=0){let e=n.substring(0,c),t=n.substring(c+1);if(e===`xmlns`){xe.has(s)&&this.relPrefixes.add(t);continue}n=this.relPrefixes.has(e)?`r:`+t:t}else if(n===`xmlns`)continue;l[n]=s.indexOf(`&`)>=0?I(s):s}let u=this.h.open(c,l,i);i?u||this.h.close(c):(this.depth++,u&&(this.skipDepth=this.depth))}onClose(e){if(this.skipDepth>=0){this.depth===this.skipDepth&&(this.skipDepth=-1),this.depth--;return}this.depth--;let t=e.trim(),n=t.indexOf(`:`);this.h.close(n<0?t:t.substring(n+1))}},we=class extends Error{constructor(){super(`aborted`),this.name=`AbortError`}};async function Te(e,t,n={}){let r=e.getReader(),i=new TextDecoder,a=new Ce(t,n.raw);try{for(;;){if(n.signal?.aborted)throw new we;let{done:e,value:t}=await r.read();if(e)break;a.write(i.decode(t,{stream:!0})),n.onChunk&&await n.onChunk(t.length)}a.write(i.decode()),a.end()}catch(e){throw r.cancel().catch(()=>{}),e}}var Ee=0,De=1,Oe=class{constructor(e={}){A(this,`o`,void 0),A(this,`root`,null),A(this,`stack`,[]),A(this,`parents`,[]),A(this,`depth`,0),A(this,`alt`,[]),this.o=e}open(e,t){if(e===`Fallback`||this.o.skip?.has(e))return!0;if(e===`AlternateContent`){this.alt.push(!1),this.stack.push(Ee);return}if(e===`Choice`&&this.alt.length){let e=this.alt.length-1;if(this.alt[e])return!0;this.alt[e]=!0,this.stack.push(Ee);return}let n=this.depth++;if(this.o.emitDepth!==void 0&&n<this.o.emitDepth){this.o.onShallowOpen?.(e,t,n),this.stack.push(De);return}let r={n:e,a:t,c:[],t:``},i=this.parents[this.parents.length-1];i&&i.c.push(r),this.parents.push(r),this.stack.push(r)}close(e){let t=this.stack.pop();t===Ee?e===`AlternateContent`&&this.alt.pop():(this.depth--,t!==De&&t!==void 0&&(this.parents.pop(),this.parents.length===0&&(this.o.emitDepth===void 0?this.root=t:this.o.onElement?.(t))))}text(e){let t=this.parents[this.parents.length-1];t&&(t.t+=e)}};function ke(e,t){let n=new Oe({skip:t}),r=new Ce(n);if(r.write(e),r.end(),!n.root)throw Error(`Empty XML document`);return n.root}function L(e,t){if(e){for(let n of e.c)if(n.n===t)return n}}function R(e,t){return e?e.c.filter(e=>e.n===t):[]}function z(e,...t){let n=e;for(let e of t)if(n=L(n,e),!n)return;return n}function Ae(e,t){if(e)for(let n of e.c){if(n.n===t)return n;let e=Ae(n,t);if(e)return e}}function B(e,t,n=[]){if(!e)return n;for(let r of e.c)r.n===t?n.push(r):B(r,t,n);return n}function V(e,t){if(e===void 0||e===``)return t;let n=Number(e);return Number.isFinite(n)?n:t}function je(e,t=`val`){if(!e)return;let n=e.a[t];return n===void 0||n!==`0`&&n!==`false`&&n!==`off`&&n!==`none`}function Me(e){if(!e)return``;if(!e.c.length)return e.t;let t=``;for(let n of e.c)t+=n.n===`t`?n.t:Me(n);return t}var Ne={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,jpe:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`,tif:`image/tiff`,tiff:`image/tiff`,ico:`image/x-icon`,emf:`image/emf`,wmf:`image/wmf`,mp4:`video/mp4`,m4v:`video/mp4`,mov:`video/quicktime`,mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`};function Pe(e){return Ne[e.split(`.`).pop()?.toLowerCase()??``]??`application/octet-stream`}function Fe(e){return/\.(png|jpe?g|jpe|gif|bmp|svg|webp|ico)$/i.test(e)}function Ie(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function Le(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e?e.split(`/`):[];for(let e of t.split(`/`))e===`..`?n.pop():e&&e!==`.`&&n.push(e);return n.join(`/`)}function Re(e,t){let n=e?e.split(`/`):[],r=t.split(`/`),i=0;for(;i<n.length&&i<r.length-1&&n[i]===r[i];)i++;return[...n.slice(i).map(()=>`..`),...r.slice(i)].join(`/`)}function ze(e){let t=Ie(e),n=e.slice(t.length?t.length+1:0);return(t?t+`/`:``)+`_rels/`+n+`.rels`}var Be=class{constructor(e){A(this,`zip`,void 0),A(this,`relsCache`,new Map),A(this,`xmlCache`,new Map),A(this,`contentTypes`,void 0),A(this,`changes`,new Map),this.zip=e}has(e){let t=this.changes.get(pe(e));return t?t.data!==null:this.zip.has(e)}get dirty(){return this.changes.size>0}async text(e){let t=this.changes.get(pe(e));if(t){if(t.data===null)throw Error(`Missing part: ${e}`);if(typeof t.data==`string`)return t.data;if(t.data instanceof Uint8Array)return new TextDecoder().decode(t.data);throw Error(`Part ${e} is a stream`)}return this.zip.text(e)}async stream(e,t){let n=this.changes.get(pe(e));if(!n)return this.zip.stream(e,t);if(n.data===null)throw Error(`Missing part: ${e}`);if(typeof n.data==`function`)return n.data();let r=typeof n.data==`string`?new TextEncoder().encode(n.data):n.data;return new ReadableStream({start(e){e.enqueue(r),e.close()}})}setPart(e,t){e=e.replace(/^\/+/,``),this.changes.set(pe(e),{path:e,data:t}),this.xmlCache.delete(e),this.relsCache.clear(),/\[content_types\]\.xml$/i.test(e)&&(this.contentTypes=void 0)}async save(e){let t=new Map;for(let{path:e,data:n}of this.changes.values())t.set(e,n);return ye(this.zip,t,e)}async addRel(e,t,n,r=!1){let i=ze(e),a=this.has(i)?g(await this.text(i)):g(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
9
|
+
`+e.stack}}var Me=Object.prototype.hasOwnProperty,Ne=t.unstable_scheduleCallback,Pe=t.unstable_cancelCallback,Fe=t.unstable_shouldYield,Ie=t.unstable_requestPaint,Le=t.unstable_now,Re=t.unstable_getCurrentPriorityLevel,ze=t.unstable_ImmediatePriority,Be=t.unstable_UserBlockingPriority,Ve=t.unstable_NormalPriority,He=t.unstable_LowPriority,Ue=t.unstable_IdlePriority,We=t.log,Ge=t.unstable_setDisableYieldValue,Ke=null,qe=null;function H(e){if(typeof We==`function`&&Ge(e),qe&&typeof qe.setStrictMode==`function`)try{qe.setStrictMode(Ke,e)}catch{}}var Je=Math.clz32?Math.clz32:Ze,Ye=Math.log,Xe=Math.LN2;function Ze(e){return e>>>=0,e===0?32:31-(Ye(e)/Xe|0)|0}var Qe=256,$e=262144,et=4194304;function tt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function nt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=tt(n))):i=tt(o):i=tt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=tt(n))):i=tt(o)):i=tt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function rt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function it(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Je(n),i=1<<r;t|=e[r],n&=~i}return t}function at(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ot(){var e=et;return et<<=1,!(et&62914560)&&(et=4194304),e}function st(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Je(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&ut(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ut(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function dt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ft(e,t){var n=t&-t;return n=n&42?1:pt(n),(n&(e.suspendedLanes|t))===0?n:0}function pt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function mt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ht(){var e=_e.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function gt(e,t){var n=_e.p;try{return _e.p=e,t()}finally{_e.p=n}}var _t=Math.random().toString(36).slice(2),vt=`__reactFiber$`+_t,yt=`__reactProps$`+_t,bt=`__reactContainer$`+_t,xt=`__reactEvents$`+_t,St=`__reactListeners$`+_t,Ct=`__reactHandles$`+_t,wt=`__reactResources$`+_t,Tt=`__reactMarker$`+_t,Et=`__reactLoad$`+_t;function Dt(e){delete e[vt],delete e[yt],delete e[St],delete e[Ct]}function Ot(e){var t;if(t=e[vt])return t;for(var n=e.parentNode;n;){if(t=n[bt]||n[vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[vt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function kt(e){if(e=e[vt]||e[bt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function At(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function jt(e){var t=e[wt];return t||(t=e[wt]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Mt(e){e[Tt]=!0}function Nt(e){e[Et]=void 0}var Pt=new Set,Ft={};function It(e,t){Lt(e,t),Lt(e+`Capture`,t)}function Lt(e,t){for(Ft[e]=t,e=0;e<t.length;e++)Pt.add(t[e])}var Rt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),zt={},Bt={};function Vt(e){return Me.call(Bt,e)?!0:Me.call(zt,e)?!1:Rt.test(e)?Bt[e]=!0:(zt[e]=!0,!1)}var Ht=!1;function Ut(){var e=Ht;return Ht=!1,e}function Wt(e,t,n){if(Vt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Gt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function qt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Yt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xt(e){if(!e._valueTracker){var t=Jt(e)?`checked`:`value`;e._valueTracker=Yt(e,t,``+e[t])}}function Zt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Jt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Qt=/[\n"\\]/g;function $t(e){return e.replace(Qt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function en(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+qt(t)):e.value!==``+qt(t)&&(e.value=``+qt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):nn(e,qt(n)):o===`number`&&e.value==t?nn(e,qt(e.value)):nn(e,qt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+qt(s):e.removeAttribute(`name`)}function tn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Xt(e);return}n=n==null?``:``+qt(n),t=t==null?n:``+qt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Xt(e)}function nn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function rn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+qt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function an(e,t,n){t!=null&&(t=``+qt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+qt(n)}function on(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(ge(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??(n=``),t=n}n=qt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Xt(e)}function sn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var cn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function ln(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||cn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function un(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Ht=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(ln(e,i,r),Ht=!0)}else for(var a in t)t.hasOwnProperty(a)&&ln(e,a,t[a])}function dn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var fn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),pn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function mn(e){return pn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function hn(){}var gn=null;function _n(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vn=null,yn=null;function bn(e){var t=kt(e);if(t&&(e=t.stateNode)){var n=e[yt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(en(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+$t(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[yt]||null;if(!i)throw Error(o(90));en(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Zt(r)}break a;case`textarea`:an(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&rn(e,!!n.multiple,t,!1)}}}var xn=!1;function Sn(e,t,n){if(xn)return e(t,n);xn=!0;try{return e(t)}finally{if(xn=!1,(vn!==null||yn!==null)&&(Ld(),vn&&(t=vn,e=yn,yn=vn=null,bn(t),e)))for(t=0;t<e.length;t++)bn(e[t])}}function Cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[yt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var wn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Tn=!1;if(wn)try{var En={};Object.defineProperty(En,"passive",{get:function(){Tn=!0}}),window.addEventListener(`test`,En,En),window.removeEventListener(`test`,En,En)}catch{Tn=!1}var Dn=null,On=null,kn=null;function An(){if(kn)return kn;var e,t=On,n=t.length,r,i=`value`in Dn?Dn.value:Dn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return kn=i.slice(e,1<r?1-r:void 0)}function jn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Mn(){return!0}function Nn(){return!1}function Pn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Mn:Nn,this.isPropagationStopped=Nn,this}return D(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Mn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Mn)},persist:function(){},isPersistent:Mn}),t}var Fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},In=Pn(Fn),Ln=D({},Fn,{view:0,detail:0}),Rn=Pn(Ln),zn,Bn,Vn,Hn=D({},Ln,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$n,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Vn&&(Vn&&e.type===`mousemove`?(zn=e.screenX-Vn.screenX,Bn=e.screenY-Vn.screenY):Bn=zn=0,Vn=e),zn)},movementY:function(e){return`movementY`in e?e.movementY:Bn}}),Un=Pn(Hn),Wn=Pn(D({},Hn,{dataTransfer:0})),Gn=Pn(D({},Ln,{relatedTarget:0})),Kn=Pn(D({},Fn,{animationName:0,elapsedTime:0,pseudoElement:0})),qn=Pn(D({},Fn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Jn=Pn(D({},Fn,{data:0})),Yn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Xn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Qn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Zn[e])?!!t[e]:!1}function $n(){return Qn}var er=Pn(D({},Ln,{key:function(e){if(e.key){var t=Yn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=jn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Xn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$n,charCode:function(e){return e.type===`keypress`?jn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?jn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),tr=Pn(D({},Hn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),nr=Pn(D({},Fn,{submitter:0})),rr=Pn(D({},Ln,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$n})),ir=Pn(D({},Fn,{propertyName:0,elapsedTime:0,pseudoElement:0})),ar=Pn(D({},Hn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),or=Pn(D({},Fn,{newState:0,oldState:0,source:0})),sr=[9,13,27,32],cr=wn&&`CompositionEvent`in window,lr=null;wn&&`documentMode`in document&&(lr=document.documentMode);var ur=wn&&`TextEvent`in window&&!lr,dr=wn&&(!cr||lr&&8<lr&&11>=lr),fr=` `,pr=!1;function mr(e,t){switch(e){case`keyup`:return sr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function hr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var gr=!1;function _r(e,t){switch(e){case`compositionend`:return hr(t);case`keypress`:return t.which===32?(pr=!0,fr):null;case`textInput`:return e=t.data,e===fr&&pr?null:e;default:return null}}function U(e,t){if(gr)return e===`compositionend`||!cr&&mr(e,t)?(e=An(),kn=On=Dn=null,gr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return dr&&t.locale!==`ko`?null:t.data;default:return null}}var vr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!vr[e.type]:t===`textarea`}function W(e,t,n,r){vn?yn?yn.push(r):yn=[r]:vn=r,t=Jf(t,`onChange`),0<t.length&&(n=new In(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var br=null,xr=null;function Sr(e){Bf(e,0)}function Cr(e){if(Zt(At(e)))return e}function wr(e,t){if(e===`change`)return t}var Tr=!1;if(wn){var Er;if(wn){var Dr=`oninput`in document;if(!Dr){var Or=document.createElement(`div`);Or.setAttribute(`oninput`,`return;`),Dr=typeof Or.oninput==`function`}Er=Dr}else Er=!1;Tr=Er&&(!document.documentMode||9<document.documentMode)}function kr(){br&&(br.detachEvent(`onpropertychange`,Ar),xr=br=null)}function Ar(e){if(e.propertyName===`value`&&Cr(xr)){var t=[];W(t,xr,e,_n(e)),Sn(Sr,t)}}function jr(e,t,n){e===`focusin`?(kr(),br=t,xr=n,br.attachEvent(`onpropertychange`,Ar)):e===`focusout`&&kr()}function Mr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Cr(xr)}function Nr(e,t){if(e===`click`)return Cr(t)}function Pr(e,t){if(e===`input`||e===`change`)return Cr(t)}function Fr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ir=typeof Object.is==`function`?Object.is:Fr;function Lr(e,t){if(Ir(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Me.call(t,i)||!Ir(e[i],t[i]))return!1}return!0}function Rr(e){if(e=e||(typeof document<`u`?document:void 0),e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function zr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Br(e,t){var n=zr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=zr(n)}}function Vr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rr(e.document)}return t}function Ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Wr=wn&&`documentMode`in document&&11>=document.documentMode,Gr=null,Kr=null,qr=null,Jr=!1;function Yr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jr||Gr==null||Gr!==Rr(r)||(r=Gr,`selectionStart`in r&&Ur(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),qr&&Lr(qr,r)||(qr=r,r=Jf(Kr,`onSelect`),0<r.length&&(t=new In(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Gr)))}function Xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Zr={animationend:Xr(`Animation`,`AnimationEnd`),animationiteration:Xr(`Animation`,`AnimationIteration`),animationstart:Xr(`Animation`,`AnimationStart`),transitionrun:Xr(`Transition`,`TransitionRun`),transitionstart:Xr(`Transition`,`TransitionStart`),transitioncancel:Xr(`Transition`,`TransitionCancel`),transitionend:Xr(`Transition`,`TransitionEnd`)},Qr={},$r={};wn&&($r=document.createElement(`div`).style,`AnimationEvent`in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),`TransitionEvent`in window||delete Zr.transitionend.transition);function ei(e){if(Qr[e])return Qr[e];if(!Zr[e])return e;var t=Zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $r)return Qr[e]=t[n];return e}var ti=ei(`animationend`),ni=ei(`animationiteration`),ri=ei(`animationstart`),ii=ei(`transitionrun`),ai=ei(`transitionstart`),oi=ei(`transitioncancel`),si=ei(`transitionend`),ci=new Map,li=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);li.push(`scrollEnd`);function ui(e,t){ci.set(e,t),It(t,[e])}var di=0;function fi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=vd.identifierPrefix;var n=di++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function pi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ed;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function mi(e,t){return e=pi(e),t=pi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var hi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},gi=[],_i=0,vi=0;function yi(){for(var e=_i,t=vi=_i=0;t<e;){var n=gi[t];gi[t++]=null;var r=gi[t];gi[t++]=null;var i=gi[t];gi[t++]=null;var a=gi[t];if(gi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Ci(n,i,a)}}function bi(e,t,n,r){gi[_i++]=e,gi[_i++]=t,gi[_i++]=n,gi[_i++]=r,vi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function xi(e,t,n,r){return bi(e,t,n,r),wi(e)}function Si(e,t){return bi(e,null,null,t),wi(e)}function Ci(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function wi(e){if(50<Dd)throw Dd=0,Od=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ti={};function Ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Di(e,t,n,r){return new Ei(e,t,n,r)}function G(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oi(e,t){var n=e.alternate;return n===null?(n=Di(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ki(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ai(e,t,n,r,i,a){var s=0;if(r=e,typeof r==`function`)G(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,Se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ue:return e=Di(31,n,t,i),e.elementType=ue,e.lanes=a,e;case ne:return ji(n.children,i,a,t);case re:s=8,i|=24;break;case ie:return e=Di(12,n,t,i|2),e.elementType=ie,e.lanes=a,e;case se:return e=Di(13,n,t,i),e.elementType=se,e.lanes=a,e;case ce:return e=Di(19,n,t,i),e.elementType=ce,e.lanes=a,e;case de:case M:return e=i|32,e=Di(30,n,t,e),e.elementType=M,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case oe:s=10;break a;case ae:s=9;break a;case k:s=11;break a;case A:s=14;break a;case le:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=Di(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ji(e,t,n,r){return e=Di(7,e,r,t),e.lanes=n,e}function Mi(e,t,n){return e=Di(6,e,null,t),e.lanes=n,e}function Ni(e){var t=Di(18,null,null,0);return t.stateNode=e,t}function Pi(e,t,n){return t=Di(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fi=new WeakMap;function Ii(e,t){if(typeof e==`object`&&e){var n=Fi.get(e);return n===void 0?(t={value:e,source:t,stack:je(t)},Fi.set(e,t),t):n}return{value:e,source:t,stack:je(t)}}var Li=[],Ri=0,zi=null,K=0,Bi=[],Vi=0,q=null,J=1,Hi=``;function Ui(e,t){Li[Ri++]=K,Li[Ri++]=zi,zi=e,K=t}function Wi(e,t,n){Bi[Vi++]=J,Bi[Vi++]=Hi,Bi[Vi++]=q,q=e;var r=J;e=Hi;var i=32-Je(r)-1;r&=~(1<<i),n+=1;var a=32-Je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,J=1<<32-Je(t)+i|n<<i|r,Hi=a+e}else J=1<<a|n<<i|r,Hi=e}function Gi(e){e.return!==null&&(Ui(e,1),Wi(e,1,0))}function Ki(e){for(;e===zi;)zi=Li[--Ri],Li[Ri]=null,K=Li[--Ri],Li[Ri]=null;for(;e===q;)q=Bi[--Vi],Bi[Vi]=null,Hi=Bi[--Vi],Bi[Vi]=null,J=Bi[--Vi],Bi[Vi]=null}function qi(e,t){Bi[Vi++]=J,Bi[Vi++]=Hi,Bi[Vi++]=q,J=t.id,Hi=t.overflow,q=e}var Ji=null,Yi=null,Xi=!1,Zi=null,Qi=!1,$i=Error(o(519));function ea(e){throw oa(Ii(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),$i}function ta(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[vt]=e,t[yt]=r,n){case`dialog`:Vf(`cancel`,t),Vf(`close`,t);break;case`iframe`:case`object`:case`embed`:Vf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Rf.length;n++)Vf(Rf[n],t);break;case`source`:Vf(`error`,t);break;case`img`:case`image`:case`link`:Vf(`error`,t),Vf(`load`,t);break;case`details`:Vf(`toggle`,t);break;case`input`:Vf(`invalid`,t),tn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Vf(`invalid`,t);break;case`textarea`:Vf(`invalid`,t),on(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||$f(t.textContent,n)?(r.popover!=null&&(Vf(`beforetoggle`,t),Vf(`toggle`,t)),r.onScroll!=null&&Vf(`scroll`,t),r.onScrollEnd!=null&&Vf(`scrollend`,t),r.onClick!=null&&(t.onclick=hn),t=!0):t=!1,t||ea(e,!0)}function na(e){for(Ji=e.return;Ji;)switch(Ji.tag){case 5:case 31:case 13:Qi=!1;return;case 27:case 3:Qi=!0;return;default:Ji=Ji.return}}function ra(e){if(e!==Ji)return!1;if(!Xi)return na(e),Xi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&Yi&&ea(e),na(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Yi=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Yi=dm(e)}else t===27?(t=Yi,Sp(e.type)?(e=um,um=null,Yi=e):Yi=t):Yi=Ji?lm(e.stateNode.nextSibling):null;return!0}function ia(){Yi=Ji=null,Xi=!1}function aa(){var e=Zi;return e!==null&&(ud===null?ud=e:ud.push.apply(ud,e),Zi=null),e}function oa(e){Zi===null?Zi=[e]:Zi.push(e)}var sa=xe(null),ca=null,la=null;function ua(e,t,n){I(sa,t._currentValue),t._currentValue=n}function da(e){e._currentValue=sa.current,F(sa)}function fa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function pa(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),fa(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),fa(s,n,e),s=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),fa(i.return,n,e),s=i.child,s=s===null?null:s.sibling):s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function ma(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;Ir(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===Te.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}i=i.return}return e!==null&&pa(t,e,n,r),t.flags|=262144,e!==null}function ha(e){for(e=e.firstContext;e!==null;){if(!Ir(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ga(e){ca=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function _a(e){return ya(ca,e)}function va(e,t){return ca===null&&ga(e),ya(e,t)}function ya(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},la===null){if(e===null)throw Error(o(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return n}var ba=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},xa=t.unstable_scheduleCallback,Sa=t.unstable_NormalPriority,Ca={$$typeof:oe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wa(){return{controller:new ba,data:new Map,refCount:0}}function Ta(e){e.refCount--,e.refCount===0&&xa(Sa,function(){e.controller.abort()})}function Ea(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Da=null;function Oa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var ka=null,Aa=0,ja=0,Ma=null;function Na(e,t){if(ka===null){var n=ka=[];Aa=0,ja=Nf(),Ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Aa++,t.then(Pa,Pa),t}function Pa(){if(--Aa===0&&(Da=null,ka!==null)){Ma!==null&&(Ma.status=`fulfilled`);var e=ka;ka=null,ja=0,Ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ia=P.S;P.S=function(e,t){if(pd=Le(),typeof t==`object`&&t&&typeof t.then==`function`&&Na(e,t),Da!==null)for(var n=yf;n!==null;)Ea(n,Da),n=n.next;if(n=e.types,n!==null){for(var r=yf;r!==null;)Ea(r,n),r=r.next;if(ja!==0){r=Da,r===null&&(r=Da=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ia!==null&&Ia(e,t)};var La=xe(null);function Ra(){var e=La.current;return e===null?Ju.pooledCache:e}function za(e,t){t===null?I(La,La.current):I(La,t.pool)}function Ba(){var e=Ra();return e===null?null:{parent:Ca._currentValue,pool:e}}var Va=Error(o(460)),Ha=Error(o(474)),Ua=Error(o(542)),Wa={then:function(){}};function Ga(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ka(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(hn,hn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Xa(e),e===void 0&&!(`reason`in t)?Error(o(600)):e;default:if(typeof t.status==`string`)t.then(hn,hn);else{if(e=Ju,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Xa(e),e}throw Ja=t,Va}}function qa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ja=e,Va):e}}var Ja=null;function Ya(){if(Ja===null)throw Error(o(459));var e=Ja;return Ja=null,e}function Xa(e){if(e===Va||e===Ua)throw Error(o(483))}var Za=null,Qa=0;function $a(e){var t=Qa;return Qa+=1,Za===null&&(Za=[]),Ka(Za,e,t)}function eo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function to(e,t){throw t.$$typeof===ee?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function no(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Oi(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Mi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===ne?(e=d(e,t,n.props.children,r,n.key),eo(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===le&&qa(a)===t.type)?(t=i(t,n.props),eo(t,n),t.return=e,t):(t=Ai(n.type,n.key,n.props,null,e.mode,r),eo(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Pi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ji(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case O:return n=Ai(t.type,t.key,t.props,null,e.mode,n),eo(n,t),n.return=e,n;case te:return t=Pi(t,e.mode,n),t.return=e,t;case le:return t=qa(t),f(e,t,n)}if(ge(t)||pe(t))return t=ji(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,$a(t),n);if(t.$$typeof===oe)return f(e,va(e,t),n);to(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case O:return n.key===i?l(e,t,n,r):null;case te:return n.key===i?u(e,t,n,r):null;case le:return n=qa(n),p(e,t,n,r)}if(ge(n)||pe(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,$a(n),r);if(n.$$typeof===oe)return p(e,t,va(e,n),r);to(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case O:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case te:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case le:return r=qa(r),m(e,t,n,r,i)}if(ge(r)||pe(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,$a(r),i);if(r.$$typeof===oe)return m(e,t,n,va(t,r),i);to(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Xi&&Ui(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Xi&&Ui(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Xi&&Ui(i,h),l}function g(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Xi&&Ui(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return Xi&&Ui(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Xi&&Ui(i,g),u}function _(e,r,a,c){if(typeof a==`object`&&a&&a.type===ne&&a.key===null&&a.props.ref===void 0&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case O:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===ne){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),eo(c,a),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===le&&qa(l)===r.type){n(e,r.sibling),c=i(r,a.props),eo(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===ne?(c=ji(a.props.children,e.mode,c,a.key),eo(c,a),c.return=e,e=c):(c=Ai(a.type,a.key,a.props,null,e.mode,c),eo(c,a),c.return=e,e=c)}return s(e);case te:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Pi(a,e.mode,c),c.return=e,e=c}return s(e);case le:return a=qa(a),_(e,r,a,c)}if(ge(a))return h(e,r,a,c);if(pe(a)){if(l=pe(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return _(e,r,$a(a),c);if(a.$$typeof===oe)return _(e,r,va(e,a),c);to(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=Mi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Qa=0;var i=_(e,t,n,r);return Za=null,i}catch(t){if(t===Va||t===Ua)throw t;var a=Di(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ro=no(!0),io=no(!1),ao=!1;function oo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function so(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function co(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function lo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=wi(e),Ci(e,null,n),t}return bi(e,r,t,n),wi(e)}function uo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}function fo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var po=!1;function mo(){if(po){var e=Ma;if(e!==null)throw e}}function ho(e,t,n,r){po=!1;var i=e.updateQueue;ao=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Xu&f)===f:(r&f)===f){f!==0&&f===ja&&(po=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:ao=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),id|=o,e.lanes=o,e.memoizedState=d}}function go(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function _o(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)go(n[e],t)}var vo=xe(null),yo=xe(0);function bo(e,t){e=nd,I(yo,e),I(vo,t),nd=e|t.baseLanes}function xo(){I(yo,nd),I(vo,vo.current)}function So(){nd=yo.current,F(vo),F(yo)}var Co=xe(null),wo=null;function To(e){var t=e.alternate;I(Ao,Ao.current&1),I(Co,e),wo===null&&(t===null||vo.current!==null||t.memoizedState!==null)&&(wo=e)}function Eo(e){I(Ao,Ao.current),I(Co,e),wo===null&&(wo=e)}function Do(e){e.tag===22?(I(Ao,Ao.current),I(Co,e),wo===null&&(wo=e)):Oo()}function Oo(){I(Ao,Ao.current),I(Co,Co.current)}function ko(e){F(Co),wo===e&&(wo=null),F(Ao)}var Ao=xe(0);function jo(e,t){I(Co,Co.current),I(Ao,t)}function Mo(e){F(Ao),F(Co),wo===e&&(wo=null)}function No(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Po=0,Y=null,Fo=null,Io=null,Lo=!1,Ro=!1,zo=!1,Bo=0,Vo=0,Ho=null,Uo=0;function Wo(){throw Error(o(321))}function Go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ir(e[n],t[n]))return!1;return!0}function Ko(e,t,n,r,i,a){return Po=a,Y=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?lc:uc,zo=!1,a=n(r,i),zo=!1,Ro&&(a=Jo(t,n,r,i)),qo(e),a}function qo(e){P.H=cc;var t=Fo!==null&&Fo.next!==null;if(Po=0,Io=Fo=Y=null,Lo=!1,Vo=0,Ho=null,t)throw Error(o(300));e===null||Dc||(e=e.dependencies,e!==null&&ha(e)&&(Dc=!0))}function Jo(e,t,n,r){Y=e;var i=0;do{if(Ro&&(Ho=null),Vo=0,Ro=!1,25<=i)throw Error(o(301));if(i+=1,Io=Fo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}P.H=dc,a=t(n,r)}while(Ro);return a}function Yo(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?ns(t):t,e=e.useState()[0],(Fo===null?null:Fo.memoizedState)!==e&&(Y.flags|=1024),t}function Xo(){var e=Bo!==0;return Bo=0,e}function Zo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Qo(e){if(Lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Lo=!1}Po=0,Io=Fo=Y=null,Ro=!1,Vo=Bo=0,Ho=null}function $o(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Io===null?Y.memoizedState=Io=e:Io=Io.next=e,Io}function es(){if(Fo===null){var e=Y.alternate;e=e===null?null:e.memoizedState}else e=Fo.next;var t=Io===null?Y.memoizedState:Io.next;if(t!==null)Io=t,Fo=e;else{if(e===null)throw Y.alternate===null?Error(o(467)):Error(o(310));Fo=e,e={memoizedState:Fo.memoizedState,baseState:Fo.baseState,baseQueue:Fo.baseQueue,queue:Fo.queue,next:null},Io===null?Y.memoizedState=Io=e:Io=Io.next=e}return Io}function ts(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ns(e){var t=Vo;return Vo+=1,Ho===null&&(Ho=[]),e=Ka(Ho,e,t),t=Y,(Io===null?t.memoizedState:Io.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?lc:uc),e}function rs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ns(e);if(e.$$typeof===N)return;if(e.$$typeof===oe)return _a(e)}throw Error(o(438,String(e)))}function is(e){var t=null,n=Y.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Y.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??(t={data:[],index:0}),n===null&&(n=ts(),Y.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=j;return t.index++,n}function as(e,t){return typeof t==`function`?t(e):t}function os(e){return ss(es(),Fo,e)}function ss(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Po&f)===f:(Xu&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ja&&(d=!0);else if((Po&p)===p){u=u.next,p===ja&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,Y.lanes|=p,id|=p;f=u.action,zo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,Y.lanes|=f,id|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!Ir(a,e.memoizedState)&&(Dc=!0,d&&(n=Ma,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function cs(e){var t=es(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);Ir(a,t.memoizedState)||(Dc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function ls(e,t,n){var r=Y,i=es(),a=Xi;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!Ir((Fo||i).memoizedState,n);if(s&&(i.memoizedState=n,Dc=!0),i=i.queue,Ps(fs.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||s||Io!==null&&!!(Io.memoizedState.tag&1),ks(e?9:8,{destroy:void 0},ds.bind(null,r,i,n,t),null),e){if(r.flags|=2048,Ju===null)throw Error(o(349));a||Po&127||us(r,t,n)}return n}function us(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Y.updateQueue,t===null?(t=ts(),Y.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ds(e,t,n,r){t.value=n,t.getSnapshot=r,ps(t)&&ms(e)}function fs(e,t,n){return n(function(){ps(t)&&ms(e)})}function ps(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ir(e,n)}catch{return!0}}function ms(e){var t=Si(e,2);t!==null&&Md(t,e,2)}function hs(e){var t=$o();if(typeof e==`function`){var n=e;if(e=n(),zo){H(!0);try{n()}finally{H(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:e},t}function gs(e,t,n,r){return e.baseState=n,ss(e,Fo,typeof r==`function`?r:as)}function _s(e,t,n,r,i){if(ac(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};P.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,vs(t,a)):(a.next=n.next,t.pending=n.next=a)}}function vs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};o.types=a===null?null:a.types,P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),ys(e,t,s)}catch(n){xs(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),ys(e,t,a)}catch(n){xs(e,t,n)}}function ys(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){bs(e,t,n)},function(n){return xs(e,t,n)}):bs(e,t,n)}function bs(e,t,n){t.status=`fulfilled`,t.value=n,Ss(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,vs(e,n)))}function xs(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ss(t),t=t.next;while(t!==r)}e.action=null}function Ss(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Cs(e,t){return t}function ws(e,t){if(Xi){var n=Ju.formState;if(n!==null){a:{var r=Y;if(Xi){if(Yi){b:{for(var i=Yi,a=Qi;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Yi=lm(i.nextSibling),r=i.data===`F!`;break a}}ea(r)}r=!1}r&&(t=n[0])}}return n=$o(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cs,lastRenderedState:t},n.queue=r,n=nc.bind(null,Y,r),r.dispatch=n,r=hs(!1),a=ic.bind(null,Y,!1,r.queue),r=$o(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=_s.bind(null,Y,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ts(e){return Es(es(),Fo,e)}function Es(e,t,n){if(t=ss(e,t,Cs)[0],e=os(as)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ns(t)}catch(e){throw e===Va?Ua:e}else r=t;t=es();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Y.flags|=2048,ks(9,{destroy:void 0},Ds.bind(null,i,n),null)),[r,a,e]}function Ds(e,t){e.action=t}function Os(e){var t=es(),n=Fo;if(n!==null)return Es(t,n,e);es(),t=t.memoizedState,n=es();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ks(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Y.updateQueue,t===null&&(t=ts(),Y.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function As(){return es().memoizedState}function js(e,t,n,r){var i=$o();Y.flags|=e,i.memoizedState=ks(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ms(e,t,n,r){var i=es();r=r===void 0?null:r;var a=i.memoizedState.inst;Fo!==null&&r!==null&&Go(r,Fo.memoizedState.deps)?i.memoizedState=ks(t,a,n,r):(Y.flags|=e,i.memoizedState=ks(1|t,a,n,r))}function Ns(e,t){js(8390656,8,e,t)}function Ps(e,t){Ms(2048,8,e,t)}function Fs(e){Y.flags|=4;var t=Y.updateQueue;if(t===null)t=ts(),Y.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Is(e){var t=es().memoizedState;return Fs({ref:t,nextImpl:e}),function(){if(qu&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Ls(e,t){return Ms(4,2,e,t)}function Rs(e,t){return Ms(4,4,e,t)}function zs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Bs(e,t,n){n=n==null?null:n.concat([e]),Ms(4,4,zs.bind(null,t,e),n)}function Vs(){}function Hs(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Us(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Go(t,r[1]))return r[0];if(r=e(),zo){H(!0);try{e()}finally{H(!1)}}return n.memoizedState=[r,t],r}function Ws(e,t,n){return n===void 0||Po&1073741824&&!(Xu&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ad(),Y.lanes|=e,id|=e,n)}function Gs(e,t,n,r){return Ir(n,t)?n:vo.current===null?!(Po&106)||Po&1073741824&&!(Xu&261930)?(Dc=!0,e.memoizedState=n):(e=Ad(),Y.lanes|=e,id|=e,t):(e=Ws(e,n,r),Ir(e,t)||(Dc=!0),e)}function Ks(e,t,n,r,i){var a=_e.p;_e.p=a!==0&&8>a?a:8;var o=P.T,s={};s.types=o===null?null:o.types,P.T=s,ic(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?rc(e,t,Fa(c,r),kd(e)):rc(e,t,r,kd(e))}catch(n){rc(e,t,{then:function(){},status:`rejected`,reason:n},kd())}finally{_e.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function qs(){}function Js(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=Ys(e).queue;Ks(e,i,t,ve,n===null?qs:function(){return Xs(e),n(r)})}function Ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ve,baseState:ve,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:ve},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Xs(e){var t=Ys(e);t.next===null&&(t=e.alternate.memoizedState),rc(e,t.next.queue,{},kd())}function Zs(){return _a(sh)}function Qs(){return es().memoizedState}function $s(){return es().memoizedState}function ec(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kd();e=co(n);var r=lo(t,e,n);r!==null&&(Md(r,t,n),uo(r,t,n)),t={cache:wa()},e.payload=t;return}t=t.return}}function tc(e,t,n){var r=kd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ac(e)?oc(t,n):(n=xi(e,t,n,r),n!==null&&(Md(n,e,r),sc(n,t,r)))}function nc(e,t,n){rc(e,t,n,kd())}function rc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ac(e))oc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Ir(s,o))return bi(e,t,i,0),Ju===null&&yi(),!1}catch{}if(n=xi(e,t,i,r),n!==null)return Md(n,e,r),sc(n,t,r),!0}return!1}function ic(e,t,n,r){if(r={lane:2,revertLane:Nf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ac(e)){if(t)throw Error(o(479))}else t=xi(e,n,r,2),t!==null&&Md(t,e,2)}function ac(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function oc(e,t){Ro=Lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}var cc={readContext:_a,use:rs,useCallback:Wo,useContext:Wo,useEffect:Wo,useImperativeHandle:Wo,useLayoutEffect:Wo,useInsertionEffect:Wo,useMemo:Wo,useReducer:Wo,useRef:Wo,useState:Wo,useDebugValue:Wo,useDeferredValue:Wo,useTransition:Wo,useSyncExternalStore:Wo,useId:Wo,useHostTransitionStatus:Wo,useFormState:Wo,useActionState:Wo,useOptimistic:Wo,useMemoCache:Wo,useCacheRefresh:Wo,useEffectEvent:Wo},lc={readContext:_a,use:rs,useCallback:function(e,t){return $o().memoizedState=[e,t===void 0?null:t],e},useContext:_a,useEffect:Ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),js(4194308,4,zs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return js(4194308,4,e,t)},useInsertionEffect:function(e,t){js(4,2,e,t)},useMemo:function(e,t){var n=$o();t=t===void 0?null:t;var r=e();if(zo){H(!0);try{e()}finally{H(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=$o();if(n!==void 0){var i=n(t);if(zo){H(!0);try{n(t)}finally{H(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=tc.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=$o();return e={current:e},t.memoizedState=e},useState:function(e){e=hs(e);var t=e.queue,n=nc.bind(null,Y,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Vs,useDeferredValue:function(e,t){return Ws($o(),e,t)},useTransition:function(){var e=hs(!1);return e=Ks.bind(null,Y,e.queue,!0,!1),$o().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Y,i=$o();if(Xi){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ju===null)throw Error(o(349));Xu&127||us(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Ns(fs.bind(null,r,a,e),[e]),r.flags|=2048,ks(9,{destroy:void 0},ds.bind(null,r,a,n,t),null),n},useId:function(){var e=$o(),t=Ju.identifierPrefix;if(Xi){var n=Hi,r=J;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Bo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Uo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Zs,useFormState:ws,useActionState:ws,useOptimistic:function(e){var t=$o();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ic.bind(null,Y,!0,n),n.dispatch=t,[e,t]},useMemoCache:is,useCacheRefresh:function(){return $o().memoizedState=ec.bind(null,Y)},useEffectEvent:function(e){var t=$o(),n={impl:e};return t.memoizedState=n,function(){if(qu&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},uc={readContext:_a,use:rs,useCallback:Hs,useContext:_a,useEffect:Ps,useImperativeHandle:Bs,useInsertionEffect:Ls,useLayoutEffect:Rs,useMemo:Us,useReducer:os,useRef:As,useState:function(){return os(as)},useDebugValue:Vs,useDeferredValue:function(e,t){return Gs(es(),Fo.memoizedState,e,t)},useTransition:function(){var e=os(as)[0],t=es().memoizedState;return[typeof e==`boolean`?e:ns(e),t]},useSyncExternalStore:ls,useId:Qs,useHostTransitionStatus:Zs,useFormState:Ts,useActionState:Ts,useOptimistic:function(e,t){return gs(es(),Fo,e,t)},useMemoCache:is,useCacheRefresh:$s,useEffectEvent:Is},dc={readContext:_a,use:rs,useCallback:Hs,useContext:_a,useEffect:Ps,useImperativeHandle:Bs,useInsertionEffect:Ls,useLayoutEffect:Rs,useMemo:Us,useReducer:cs,useRef:As,useState:function(){return cs(as)},useDebugValue:Vs,useDeferredValue:function(e,t){var n=es();return Fo===null?Ws(n,e,t):Gs(n,Fo.memoizedState,e,t)},useTransition:function(){var e=cs(as)[0],t=es().memoizedState;return[typeof e==`boolean`?e:ns(e),t]},useSyncExternalStore:ls,useId:Qs,useHostTransitionStatus:Zs,useFormState:Os,useActionState:Os,useOptimistic:function(e,t){var n=es();return Fo===null?(n.baseState=e,[e,n.queue.dispatch]):gs(n,Fo,e,t)},useMemoCache:is,useCacheRefresh:$s,useEffectEvent:Is};function fc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var pc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kd(),i=co(r);i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,r),t!==null&&(Md(t,e,r),uo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kd(),i=co(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,r),t!==null&&(Md(t,e,r),uo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kd(),r=co(n);r.tag=2,t!=null&&(r.callback=t),t=lo(e,r,n),t!==null&&(Md(t,e,n),uo(t,e,n))}};function mc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Lr(n,r)||!Lr(i,a):!0}function hc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&pc.enqueueReplaceState(t,t.state,null)}function gc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=D({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function _c(e){hi(e)}function vc(e){console.error(e)}function yc(e){hi(e)}function bc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function xc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Sc(e,t,n){return n=co(n),n.tag=3,n.payload={element:null},n.callback=function(){bc(e,t)},n}function Cc(e){return e=co(e),e.tag=3,e}function wc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){xc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){xc(t,n,r),typeof i!=`function`&&(gd===null?gd=new Set([this]):gd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Tc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ma(t,n,i,!0),n=Co.current,n!==null){switch(n.tag){case 31:case 13:case 19:return wo===null?Wd():n.alternate===null&&rd===0&&(rd=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),pf(e,r,i)),!1;case 22:return n.flags|=65536,r===Wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),pf(e,r,i)),!1}throw Error(o(435,n.tag))}return pf(e,r,i),Wd(),!1}if(Xi)return t=Co.current,t===null?(r!==$i&&(t=Error(o(423),{cause:r}),oa(Ii(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=Ii(r,n),i=Sc(e.stateNode,r,i),fo(e,i),rd!==4&&(rd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==$i&&(e=Error(o(422),{cause:r}),oa(Ii(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=Ii(a,n),ld===null?ld=[a]:ld.push(a),rd!==4&&(rd=2),t===null)return!0;r=Ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Sc(n.stateNode,r,e),fo(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(gd===null||!gd.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Cc(i),wc(i,e,n,r),fo(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Ec=Error(o(461)),Dc=!1;function Oc(e,t,n,r){t.child=e===null?io(t,null,n,r):ro(t,e.child,n,r)}function kc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ga(t),r=Ko(e,t,n,o,a,i),s=Xo(),e!==null&&!Dc?(Zo(e,t,i),Z(e,t,i)):(Xi&&s&&Gi(t),t.flags|=1,Oc(e,t,r,i),t.child)}function Ac(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!G(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,jc(e,t,a,r,i)):(e=Ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!nl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Lr:n,n(o,r)&&e.ref===t.ref)return Z(e,t,i)}return t.flags|=1,e=Oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function jc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Lr(a,r)&&e.ref===t.ref){if(Dc=!1,t.pendingProps=r=a,nl(e,i))e.flags&131072&&(Dc=!0);else return t.lanes=e.lanes,Z(e,t,i)}}return zc(e,t,n,r,i)}function Mc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Pc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&za(t,a===null?null:a.cachePool),a===null?xo():bo(t,a),Do(t);else return r=t.lanes=536870912,Pc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&za(t,null),xo(),Oo()):(za(t,a.cachePool),bo(t,a),Oo(),t.memoizedState=null);return Oc(e,t,i,n),t.child}function Nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Pc(e,t,n,r,i){var a=Ra();return a=a===null?null:{parent:Ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&za(t,null),xo(),Do(t),e!==null&&ma(e,t,r,!0),t.childLanes=i,null}function Fc(e,t){return t=Jc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ic(e,t,n){return ro(t,e.child,null,n),e=Fc(t,t.pendingProps),e.flags|=2,ko(t),t.memoizedState=null,e}function Lc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(Xi){if(r.mode===`hidden`)return e=Fc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Nc(null,e);if(Eo(t),(e=Yi)?(e=am(e,Qi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:q===null?null:{id:J,overflow:Hi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Ji=t,Yi=null)):e=null,e===null)throw ea(t);return t.lanes=536870912,null}return Fc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(Eo(t),i){if(t.flags&256)t.flags&=-257,t=Ic(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558))}else if(Dc||ma(e,t,n,!1),i=(n&e.childLanes)!==0,Dc||i){if(vo.current===null){if(r=Ju,r!==null&&(s=ft(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,Si(e,s),Md(r,e,s),Ec;Wd()}t=Ic(e,t,n)}else e=a.treeContext,Yi=lm(s.nextSibling),Ji=t,Xi=!0,Zi=null,Qi=!1,e!==null&&qi(t,e),t=Fc(t,r),t.flags|=134221824;return t}return e=Oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Rc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function zc(e,t,n,r,i){return ga(t),n=Ko(e,t,n,r,void 0,i),r=Xo(),e!==null&&!Dc?(Zo(e,t,i),Z(e,t,i)):(Xi&&r&&Gi(t),t.flags|=1,Oc(e,t,n,i),t.child)}function Bc(e,t,n,r,i,a){return ga(t),t.updateQueue=null,n=Jo(t,r,n,i),qo(e),r=Xo(),e!==null&&!Dc?(Zo(e,t,a),Z(e,t,a)):(Xi&&r&&Gi(t),t.flags|=1,Oc(e,t,n,a),t.child)}function Vc(e,t,n,r,i){if(ga(t),t.stateNode===null){var a=Ti,o=n.contextType;typeof o==`object`&&o&&(a=_a(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=pc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},oo(t),o=n.contextType,a.context=typeof o==`object`&&o?_a(o):Ti,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(fc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&pc.enqueueReplaceState(a,a.state,null),ho(t,r,a,i),mo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=gc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ti,typeof u==`object`&&u&&(o=_a(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&hc(t,a,r,o),ao=!1;var f=t.memoizedState;a.state=f,ho(t,r,a,i),mo(),l=t.memoizedState,s||f!==l||ao?(typeof d==`function`&&(fc(t,n,d,r),l=t.memoizedState),(c=ao||mc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,so(e,t),o=t.memoizedProps,u=gc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ti,typeof l==`object`&&l&&(c=_a(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&hc(t,a,r,c),ao=!1,f=t.memoizedState,a.state=f,ho(t,r,a,i),mo();var p=t.memoizedState;o!==d||f!==p||ao||e!==null&&e.dependencies!==null&&ha(e.dependencies)?(typeof s==`function`&&(fc(t,n,s,r),p=t.memoizedState),(u=ao||mc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ha(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Rc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ro(t,e.child,null,i),t.child=ro(t,null,n,i)):Oc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Z(e,t,i),e}function Hc(e,t,n,r){return ia(),t.flags|=256,Oc(e,t,n,r),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(e){return{baseLanes:e,cachePool:Ba()}}function Gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=sd),e}function Kc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ao.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Xi){if(i?To(t):Oo(),(e=Yi)?(e=am(e,Qi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:q===null?null:{id:J,overflow:Hi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Ji=t,Yi=null)):e=null,e===null)throw ea(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Oo(),i=t.mode,a=Jc({mode:`hidden`,children:a},i),r=ji(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Wc(n),r.childLanes=Gc(e,o,n),t.memoizedState=Uc,Nc(null,r)):(To(t),qc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return X(e,t,a,o,r,c,s,n)}return i?(Oo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Oi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=ji(i,a,n,null),i.flags|=2):i=Oi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Nc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Wc(n):(a=i.cachePool,a===null?a=Ba():(s=Ca._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Gc(e,o,n),t.memoizedState=Uc,Nc(e.child,r)):(To(t),n=e.child,e=n.sibling,n=Oi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function qc(e,t){return t=Jc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Jc(e,t){return e=Di(22,e,null,t),e.lanes=0,e}function Yc(e,t,n){return ro(t,e.child,null,n),e=qc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function X(e,t,n,r,i,a,s,c){if(n)return t.flags&256?(To(t),t.flags&=-257,Yc(e,t,c)):t.memoizedState===null?(Oo(),a=i.fallback,s=t.mode,i=Jc({mode:`visible`,children:i.children},s),a=ji(a,s,c,null),a.flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,ro(t,e.child,null,c),i=t.child,i.memoizedState=Wc(c),i.childLanes=Gc(e,r,c),t.memoizedState=Uc,Nc(null,i)):(Oo(),t.child=e.child,t.flags|=128,null);if(To(t),sm(a)){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(o(419)),i.stack=``,i.digest=r,oa({value:i,source:null,stack:null})),Yc(e,t,c)}if(Dc||ma(e,t,c,!1),r=(c&e.childLanes)!==0,Dc||r){if(vo.current!==null)return Yc(e,t,c);if(r=Ju,r!==null&&(i=ft(r,c),i!==0&&i!==s.retryLane))throw s.retryLane=i,Si(e,i),Md(r,e,i),Ec;return om(a)||Wd(),Yc(e,t,c)}return om(a)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Yi=lm(a.nextSibling),Ji=t,Xi=!0,Zi=null,Qi=!1,e!==null&&qi(t,e),t=qc(t,i.children),t.flags|=134221824,t)}function Xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),fa(e.return,t,n)}function Zc(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&No(n)===null&&(t=e),e=e.sibling}return t}function Qc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function $c(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function el(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ao.current;if(t.flags&128)return jo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,jo(t,o),i===`backwards`&&e!==null?($c(e),Oc(e,t,r,n),$c(e)):Oc(e,t,r,n),r=Xi?K:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xc(e,n,t);else if(e.tag===19)Xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=Zc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,$c(t)),Qc(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&No(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qc(t,!0,n,null,a,r);break;case`together`:Qc(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=Zc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qc(t,!1,i,n,a,r)}return t.child}function tl(e,t,n){var r=t.pendingProps;return ua(t,t.type,r.value),Oc(e,t,r.children,n),t.child}function Z(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),id|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ma(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=Oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ha(e)))}function rl(e,t,n){switch(t.tag){case 3:Ee(t,t.stateNode.containerInfo),ua(t,Ca,e.memoizedState.cache),ia();break;case 27:case 5:Oe(t);break;case 4:Ee(t,t.stateNode.containerInfo);break;case 10:ua(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return To(t),t.flags|=128,null;r=ma(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Kc(e,t,n):(To(t),e=Z(e,t,n),e===null?null:e.sibling)}To(t);break;case 19:if(t.flags&128)return el(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||(ma(e,t,n,!1),r=(n&t.childLanes)!==0),i){if(r)return el(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),jo(t,Ao.current),r)break;return null;case 22:return t.lanes=0,Mc(e,t,n,t.pendingProps);case 24:ua(t,Ca,e.memoizedState.cache)}return Z(e,t,n)}function il(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Dc=!0;else{if(!nl(e,n)&&!(t.flags&128))return Dc=!1,rl(e,t,n);Dc=!!(e.flags&131072)}}else Dc=!1,Xi&&t.flags&1048576&&Wi(t,K,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=qa(t.elementType),t.type=e,typeof e==`function`)G(e)?(r=gc(e,r),t.tag=1,t=Vc(null,t,e,r,n)):(t.tag=0,t=zc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===k){t.tag=11,t=kc(null,t,e,r,n);break a}if(i===A){t.tag=14,t=Ac(null,t,e,r,n);break a}if(i===oe){t.tag=10,t.type=e,t=tl(null,t,n);break a}}throw t=he(e)||e,Error(o(306,t,``))}}return t;case 0:return zc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=gc(r,t.pendingProps),Vc(e,t,r,i,n);case 3:a:{if(Ee(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,so(e,t),ho(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ua(t,Ca,r),r!==a.cache&&pa(t,[Ca],n,!0),mo(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=Hc(e,t,r,n);break a}if(r!==i){i=Ii(Error(o(424)),t),oa(i),t=Hc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Yi=lm(e.firstChild),Ji=t,Xi=!0,Zi=null,Qi=!0,n=io(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ia(),r===i){t=Z(e,t,n);break a}Oc(e,t,r,n)}t=t.child}return t;case 26:return Rc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Xi||(t.stateNode=fp(t.type,t.pendingProps,we.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oe(t),e===null&&Xi&&(r=t.stateNode=hm(t.type,t.pendingProps,we.current),Ji=t,Qi=!0,i=Yi,Sp(t.type)?(um=i,Yi=lm(r.firstChild)):Yi=i),Oc(e,t,t.pendingProps.children,n),Rc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Xi&&((i=r=Yi)&&(r=rm(r,t.type,t.pendingProps,Qi),r===null?i=!1:(t.stateNode=r,Ji=t,Yi=lm(r.firstChild),Qi=!1,i=!0)),i||ea(t)),Oe(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,pp(i,a)?r=null:s!==null&&pp(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=Ko(e,t,Yo,null,null,n),sh._currentValue=i),Rc(e,t),Oc(e,t,r,n),t.child;case 6:return e===null&&Xi&&((e=n=Yi)&&(n=im(n,t.pendingProps,Qi),n===null?e=!1:(t.stateNode=n,Ji=t,Yi=null,e=!0)),e||ea(t)),null;case 13:return Kc(e,t,n);case 4:return Ee(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ro(t,null,r,n):Oc(e,t,r,n),t.child;case 11:return kc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Rc(e,t),Oc(e,t,r,n),t.child;case 8:return Oc(e,t,t.pendingProps.children,n),t.child;case 12:return Oc(e,t,t.pendingProps.children,n),t.child;case 10:return tl(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,ga(t),i=_a(i),r=r(i),t.flags|=1,Oc(e,t,r,n),t.child;case 14:return Ac(e,t,t.type,t.pendingProps,n);case 15:return jc(e,t,t.type,t.pendingProps,n);case 19:return el(e,t,n);case 31:return Lc(e,t,n);case 22:return Mc(e,t,n,t.pendingProps);case 24:return ga(t),r=_a(Ca),e===null?(i=Ra(),i===null&&(i=Ju,a=wa(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},oo(t),ua(t,Ca,i)):((e.lanes&n)!==0&&(so(e,t),ho(t,null,null,n),mo()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,ua(t,Ca,r),r!==i.cache&&pa(t,[Ca],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),ua(t,Ca,r))),Oc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:Xi&&Gi(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Rc(e,t),Oc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function al(e){e.flags|=4}function ol(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Vd())e.flags|=8192;else throw Ja=Wa,Ha}}else e.flags&=-16777217}function sl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Vd())e.flags|=8192;else throw Ja=Wa,Ha}}function cl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ot(),e.lanes|=t,cd|=t)}function ll(e,t){if(!Xi)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function ul(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function dl(e,t,n){var r=t.pendingProps;switch(Ki(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ul(t),null;case 1:return ul(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),da(Ca),De(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ra(t)?al(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,aa())),ul(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(al(t),a===null?(ul(t),ol(t,i,null,r,n)):(ul(t),sl(t,a))):a?a===e.memoizedState?(ul(t),t.flags&=-16777217):(al(t),ul(t),sl(t,a)):(e=e.memoizedProps,e!==r&&al(t),ul(t),ol(t,i,e,r,n)),null;case 27:if(ke(t),n=we.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ul(t),t.subtreeFlags&=-33554433,null}e=Se.current,ra(t)?ta(t,e):(e=hm(i,r,n),t.stateNode=e,al(t))}return ul(t),t.subtreeFlags&=-33554433,null;case 5:if(ke(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ul(t),t.subtreeFlags&=-33554433,null}if(a=Se.current,ra(t))ta(t,a);else{var s=lp(we.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[vt]=t,a[yt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(np(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&al(t)}}return ul(t),t.subtreeFlags&=-33554433,ol(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&al(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=we.current,ra(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ji,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[vt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||$f(e.nodeValue,n)),e||ea(t,!0)}else e=lp(e).createTextNode(r),e[vt]=t,t.stateNode=e}return ul(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ra(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[vt]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ul(t),e=!1}else n=aa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ko(t),t):(ko(t),null);if(t.flags&128)throw Error(o(558))}return ul(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ra(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[vt]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ul(t),i=!1}else i=aa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ko(t),t):(ko(t),null)}return ko(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),cl(t,t.updateQueue),ul(t),null);case 4:return De(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,ul(t),null;case 10:return da(t.type),ul(t),null;case 19:if(Mo(t),r=t.memoizedState,r===null)return ul(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)ll(r,!1);else{if(rd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=No(e),a!==null){for(t.flags|=128,ll(r,!1),e=a.updateQueue,t.updateQueue=e,cl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ki(n,e),n=n.sibling;return jo(t,Ao.current&1|2),Xi&&Ui(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Le()>md&&(t.flags|=128,i=!0,ll(r,!1),t.lanes=4194304)}}else{if(!i){if(e=No(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,cl(t,e),ll(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!a.alternate&&!Xi)return ul(t),null}else 2*Le()-r.renderingStartTime>md&&n!==536870912&&(t.flags|=128,i=!0,ll(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Le(),e.sibling=null,a=Ao.current,a=i?a&1|2:a&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Xi?jo(t,a):(n=a,I(Co,t),I(Ao,n),wo===null&&(wo=t)),Xi&&Ui(t,r.treeForkCount),e}return ul(t),null;case 22:case 23:return ko(t),So(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(ul(t),t.subtreeFlags&6&&(t.flags|=8192)):ul(t),n=t.updateQueue,n!==null&&cl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&F(La),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),da(Ca),ul(t),null;case 25:return null;case 30:return t.flags|=33554432,ul(t),null}throw Error(o(156,t.tag))}function fl(e,t){switch(Ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return da(Ca),De(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ke(t),null;case 31:if(t.memoizedState!==null){if(ko(t),t.alternate===null)throw Error(o(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ko(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Mo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return De(),null;case 10:return da(t.type),null;case 22:case 23:return ko(t),So(),e!==null&&F(La),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return da(Ca),null;case 25:return null;default:return null}}function pl(e,t){switch(Ki(t),t.tag){case 3:da(Ca),De();break;case 26:case 27:case 5:ke(t);break;case 4:De();break;case 31:t.memoizedState!==null&&ko(t);break;case 13:ko(t);break;case 19:Mo(t);break;case 10:da(t.type);break;case 22:case 23:ko(t),So(),e!==null&&F(La);break;case 24:da(Ca)}}function ml(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ff(t,t.return,e)}}function hl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ff(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ff(t,t.return,e)}}function gl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{_o(t,n)}catch(t){ff(e,e.return,t)}}}function _l(e,t,n){n.props=gc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ff(e,t,n)}}function vl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=fi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);h(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ff(e,t,n)}}function yl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ff(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ff(e,t,n)}else n.current=null}}function bl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function xl(e){for(var t=e.return;t!==null&&(wl(t)&&em(e.stateNode,t.stateNode),!Cl(t));)t=t.return}function Sl(e){for(var t=e.return;t!==null&&(wl(t)&&tm(e.stateNode,t.stateNode),!Cl(t));)t=t.return}function Cl(e){return e.tag===5||e.tag===3||e.tag===27}function wl(e){return e&&e.tag===7&&e.stateNode!==null}function Tl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ff(e,e.return,t)}}function El(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[yt]=t}catch(t){ff(e,e.return,t)}}function Dl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Ol(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=hn)),bl(e,r),Ht=!0;else if(i!==4&&(i===27&&(bl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(kl(e,t,n,r),e=e.sibling;e!==null;)kl(e,t,n,r),e=e.sibling}function Al(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),bl(e,r),Ht=!0;else if(i!==4&&(i===27&&(bl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Al(e,t,n,r),e=e.sibling;e!==null;)Al(e,t,n,r),e=e.sibling}function jl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[vt]=e,t[yt]=n}catch(t){ff(e,e.return,t)}}var Ml=!1,Nl=null;function Pl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Ml=!0)}var Fl=null;function Il(){var e=Fl;return Fl=null,e}var Q=0;function Ll(e,t,n,r,i){return Q=0,Rl(e.child,t,n,r,i)}function Rl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Ml=!0,Tp(o,Q===0?t:t+`_`+Q,n),Q++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Rl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function zl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||zl(e.child,t),e=e.sibling}function Bl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Bl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(o(544));var n=t.name;t=mi(t.default,t.share),t!==`none`&&(Ll(e,n,t,null,!1)||zl(e.child,!1))}e=e.sibling}}function Vl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=fi(r,n),a=mi(r.default,n.paired?r.share:r.enter);a===`none`?Bl(e):Ll(e,i,a,null,!1)?(Bl(e),n.paired||t||jd(e,r.onEnter)):zl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Vl(e,t),e=e.sibling;else Bl(e)}function Hl(e){if(Nl!==null&&Nl.size!==0){var t=Nl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=mi(n.default,n.share);if(a!==`none`&&(Ll(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,jd(e,n.onShare)):zl(e.child,!1)),t.delete(r),t.size===0)break}}}Hl(e)}e=e.sibling}}}function Ul(e){if(e.tag===30){var t=e.memoizedProps,n=fi(t,e.stateNode),r=Nl===null?void 0:Nl.get(n),i=mi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Ll(e,n,i,null,!1)?r===void 0?jd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Nl.delete(n),jd(e,t.onShare)):zl(e.child,!1)),Nl!==null&&Hl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ul(e),e=e.sibling;else Nl!==null&&Hl(e)}function Wl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=fi(t,e.stateNode);t=mi(t.default,t.update),e.flags&=-5,t!==`none`&&Ll(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Wl(e);e=e.sibling}}function Gl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,zl(e.child,!1))}Gl(e)}e=e.sibling}}function Kl(e){if(e.tag===30)e.stateNode.paired=null,zl(e.child,!1),Gl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e),e=e.sibling;else Gl(e)}function ql(e){for(e=e.child;e!==null;)e.tag===30?zl(e.child,!1):e.subtreeFlags&33554432&&ql(e),e=e.sibling}function Jl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Q<a.length){var l=a[Q],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,Q===0?n:n+`_`+Q,i),s&&e.flags&4||(Fl===null&&(Fl=[]),Fl.push(c,Q===0?r:r+`_`+Q,t.memoizedProps)),Q++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Jl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Yl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=fi(n,r),a=mi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Q=0,i=Jl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||jd(e,n.onUpdate))}else e.subtreeFlags&33554432&&Yl(e,t);e=e.sibling}}var Xl=!1,Zl=!1,Ql=!1,$l=!1,eu=typeof WeakSet==`function`?WeakSet:Set,tu=null,nu=!1,ru=!1,iu=!1,au=!1;function ou(e,t,n){if(e=e.containerInfo,sp=gh,e=Hr(e),Ur(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,tu=t,t=n?9270:1024;tu!==null;){if(e=tu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Ul(r[a]);if(e.alternate===null&&e.flags&2)n&&Pl(e),su(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Ul(r),su(n);continue}if(r!==null&&r.memoizedState!==null){n&&Pl(e),su(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,tu=r):(n&&Wl(e),su(n))}}Nl=null}function su(e){for(;tu!==null;){var t=tu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var a=t.stateNode;try{var s=gc(t.type,i);n=a.getSnapshotBeforeUpdate(s,r),a.__reactInternalSnapshotBeforeUpdate=n}catch(e){ff(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=fi(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=mi(i.default,i.update),i!==`none`&&Ll(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(o(163))}if(r=t.sibling,r!==null){r.return=t.return,tu=r;break}tu=t.return}}function cu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ou(e,n),r&4&&ml(5,n);break;case 1:if(Ou(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ff(n,n.return,e)}else{var i=gc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ff(n,n.return,e)}}}r&64&&gl(n),r&512&&vl(n,n.return);break;case 3:if(Ou(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{_o(e,t)}catch(e){ff(n,n.return,e)}}break;case 27:t===null&&r&4&&jl(n);case 26:case 5:Ou(e,n),t===null&&r&4&&Tl(n),r&512&&vl(n,n.return);break;case 12:Ou(e,n);break;case 31:Ou(e,n),r&4&&_u(e,n);break;case 13:Ou(e,n),r&4&&vu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=gf.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||Xl,!r){var a=t!==null&&t.memoizedState!==null||Zl;t=Xl,i=Zl,Xl=r,(Zl=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Au(e,n,r)):Ou(e,n),Xl=t,Zl=i}break;case 30:Ou(e,n),r&512&&vl(n,n.return);break;case 7:r&512&&vl(n,n.return);default:Ou(e,n)}}function lu(e,t){for(e=e.child;e!==null;)uu(e,t),e=e.sibling}function uu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){ff(e,e.return,t)}du(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Ht=!0}catch(t){ff(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){ff(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&lu(e,t);break;default:lu(e,t)}}function du(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:uu(n,r);break a;case 22:n.memoizedState===null&&du(n,r);break a;default:du(n,r)}}e=e.sibling}}function fu(e){var t=e.alternate;t!==null&&(e.alternate=null,fu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Dt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var pu=null,mu=!1;function hu(e,t,n){for(n=n.child;n!==null;)gu(e,t,n),n=n.sibling}function gu(e,t,n){if(qe&&typeof qe.onCommitFiberUnmount==`function`)try{qe.onCommitFiberUnmount(Ke,n)}catch{}switch(n.tag){case 26:Zl||yl(n,t),hu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Zl&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zl||yl(n,t),Sl(n);var r=pu,i=mu;Sp(n.type)&&(pu=n.stateNode,mu=!1),hu(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),pu=r,mu=i;break;case 5:Zl||yl(n,t),Sl(n);case 6:if(n.tag===6&&Sl(n),r=pu,i=mu,pu=null,hu(e,t,n),pu=r,mu=i,pu!==null){if(mu)try{(pu.nodeType===9?pu.body:pu.nodeName===`HTML`?pu.ownerDocument.body:pu).removeChild(n.stateNode),Ht=!0}catch(e){ff(n,t,e)}else try{pu.removeChild(n.stateNode),Ht=!0}catch(e){ff(n,t,e)}}break;case 18:pu!==null&&(mu?(e=pu,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(pu,n.stateNode));break;case 4:r=pu,i=mu,pu=n.stateNode.containerInfo,mu=!0,hu(e,t,n),pu=r,mu=i;break;case 0:case 11:case 14:case 15:hl(2,n,t),Zl||hl(4,n,t),hu(e,t,n);break;case 1:Zl||(yl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&_l(n,t,r)),hu(e,t,n);break;case 21:hu(e,t,n);break;case 22:Zl=(r=Zl)||n.memoizedState!==null,hu(e,t,n),Zl=r;break;case 30:yl(n,t),hu(e,t,n);break;case 7:Zl||yl(n,t),hu(e,t,n);break;default:hu(e,t,n)}}function _u(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){ff(t,t.return,e)}}}function vu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){ff(t,t.return,e)}}function yu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new eu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new eu),t;default:throw Error(o(435,e.tag))}}function bu(e,t){var n=yu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=_f.bind(null,e,t);t.then(r,r)}})}function xu(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var a=r[i],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){pu=l.stateNode,mu=!1;break a}break;case 5:pu=l.stateNode,mu=!1;break a;case 3:case 4:pu=l.stateNode.containerInfo,mu=!0;break a}l=l.return}if(pu===null)throw Error(o(160));gu(s,c,a),pu=null,mu=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Cu(t,e,n),t=t.sibling}var Su=null;function Cu(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var a=0;a<r.length;a++){var s=r[a];s.ref.impl=s.nextImpl}xu(t,e,n),wu(e),i&4&&(hl(3,e,e.return),ml(3,e),hl(5,e,e.return));break;case 1:xu(t,e,n),wu(e),i&512&&(Zl||r===null||yl(r,r.return)),i&64&&Xl&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=Su,xu(t,e,n),wu(e),i&512&&(Zl||r===null||yl(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Xl)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=a.ownerDocument||a;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[Tt]||r[vt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),np(r,t,n),r[vt]=e,Mt(r),t=r;break a;case`link`:if(a=Gm(`link`,`href`,i).get(t+(n.href||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(s,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;case`meta`:if(a=Gm(`meta`,`content`,i).get(t+(n.content||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){a.splice(s,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;default:throw Error(o(468,t))}r[vt]=e,Mt(r),t=r}e.stateNode=t}}else Xl||Km(a,e.type,e.stateNode)}else e.stateNode=Bm(a,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&El(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||Zl||t.parentNode.removeChild(t)):i.count--,n===null?Xl||Km(a,e.type,e.stateNode):Bm(a,n,e.memoizedProps))}break;case 27:xu(t,e,n),wu(e),i&512&&(Zl||r===null||yl(r,r.return)),r!==null&&i&4&&El(e,e.memoizedProps,r.memoizedProps);break;case 5:if(a=Ql,Ql=!1,xu(t,e,n),Ql=a,wu(e),i&512&&(Zl||r===null||yl(r,r.return)),e.flags&32){t=e.stateNode;try{sn(t,``),Ht=!0}catch(t){ff(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,El(e,t,r===null?t:r.memoizedProps)),i&1024&&($l=!0);break;case 6:if(xu(t,e,n),wu(e),i&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Ht=!0}catch(t){ff(e,e.return,t)}}break;case 3:if(Ht=!1,Wm=null,a=Su,Su=bm(t.containerInfo),xu(t,e,n),Su=a,wu(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){ff(e,e.return,t)}$l&&($l=!1,Tu(e)),Ht=!1;break;case 4:i=Ql,Ql=Xl,r=Ut(),a=Su,Su=bm(e.stateNode.containerInfo),xu(t,e,n),wu(e),Su=a,Ht&&ru&&(iu=!0),Ht=r,Ql=i;break;case 12:xu(t,e,n),wu(e);break;case 31:xu(t,e,n),wu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 13:xu(t,e,n),wu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(fd=Le()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 22:a=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=Xl,l=Zl,u=Ql;Xl=c||a,Ql=u||a,Zl=l||s,xu(t,e,n),Zl=l,Ql=u,Xl=c,wu(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||r===null||s||Xl||Zl||(t=s||Zl,n=Xl,r=Zl,Xl=a||Xl,Zl=t,ku(e,2),Xl=n,Zl=r),!a&&Ql||lu(e,a)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,bu(e,n))));break;case 19:xu(t,e,n),wu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 30:i&512&&(Zl||r===null||yl(r,r.return)),i=Ut(),a=ru,s=(n&335544064)===n,c=e.memoizedProps,ru=s&&mi(c.default,c.update)!==`none`,xu(t,e,n),wu(e),s&&r!==null&&Ht&&(e.flags|=4),ru=a,Ht=i;break;case 21:break;case 7:i&512&&(Zl||r===null||yl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:xu(t,e,n),wu(e)}}function wu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Dl(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(wl(i)){var a=i.stateNode;r===null?r=[a]:r.push(a)}if(Cl(i))break;i=i.return}var s=r;if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode;Al(e,Ol(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(sn(l,``),n.flags&=-33),Al(e,Ol(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;kl(e,Ol(e),u,s);break;default:throw Error(o(161))}}catch(t){ff(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Tu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Tu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Eu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Du(t,e),t=t.sibling;else Yl(t,!1)}function Du(e,t){var n=e.alternate;if(n===null)Vl(e,!1);else switch(e.tag){case 3:if(au=nu=!1,Il(),Eu(t,e),!nu&&!iu){if(e=Fl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),au=!0}Fl=null;break;case 5:Eu(t,e);break;case 4:r=nu,nu=!1,Eu(t,e),nu&&(iu=!0),nu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Eu(t,e):Vl(e,!1));break;case 30:r=nu,i=Il(),nu=!1,Eu(t,e),nu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=fi(a,o),o=fi(n.memoizedProps,o);var s=mi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Q=0,t=Jl(e,n,t,o,s,a,!0),Q!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(jd(e,e.memoizedProps.onUpdate),Fl=i):i!==null&&(i.push.apply(i,Fl),Fl=i),nu=e.flags&32?!0:r;break;default:Eu(t,e)}}function Ou(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cu(e,t.alternate,t),t=t.sibling}function ku(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:hl(4,n,n.return),ku(n,r);break;case 1:yl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&_l(n,n.return,i),ku(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:yl(n,n.return),n.tag!==5&&n.tag!==27||Sl(n),ku(n,r);break;case 6:Sl(n);break;case 26:yl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||Zl||i.parentNode.removeChild(i),ku(n,r);break;case 22:n.memoizedState===null&&ku(n,r);break;case 30:yl(n,n.return),ku(n,r);break;case 7:yl(n,n.return);default:ku(n,r)}e=e.sibling}}function Au(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Au(i,a,n),ml(4,a);break;case 1:if(Au(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ff(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)go(l[i],c)}catch(e){ff(r,r.return,e)}}s&&o&64&&gl(a),vl(a,a.return);break;case 27:n&2&&jl(a);case 5:a.tag!==5&&a.tag!==27||xl(a),Au(i,a,n),s&&r===null&&o&4&&Tl(a),vl(a,a.return);break;case 6:xl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Xl||Km(bm(c.ownerDocument),a.type,c),Au(i,a,n),s&&r===null&&o&4&&Tl(a),vl(a,a.return);break;case 12:Au(i,a,n);break;case 31:Au(i,a,n),s&&o&4&&_u(i,a);break;case 13:Au(i,a,n),s&&o&4&&vu(i,a);break;case 22:a.memoizedState===null&&Au(i,a,n),vl(a,a.return);break;case 30:Au(i,a,n),vl(a,a.return);break;case 7:vl(a,a.return);default:Au(i,a,n)}t=t.sibling}}function ju(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ta(n))}function Mu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ta(e))}function Nu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Pu(e,t,n,r),t=t.sibling;else i&&ql(t)}function Pu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Kl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Nu(e,t,n,r),a&2048&&ml(9,t);break;case 1:Nu(e,t,n,r);break;case 3:Nu(e,t,n,r),i&&au&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ta(a)));break;case 12:if(a&2048){Nu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){ff(t,t.return,e)}}else Nu(e,t,n,r);break;case 31:Nu(e,t,n,r);break;case 13:Nu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Kl(t),o._visibility&2?Nu(e,t,n,r):(o._visibility|=2,Fu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Kl(s),o._visibility&2?Nu(e,t,n,r):Iu(e,t)),a&2048&&ju(s,t);break;case 24:Nu(e,t,n,r),a&2048&&Mu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(zl(a.child,!0),zl(t.child,!0))),Nu(e,t,n,r);break;default:Nu(e,t,n,r)}}function Fu(e,t,n,r,i){for(i=i&&(!!(t.subtreeFlags&10256)||!1),t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Fu(a,o,s,c,i),ml(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Fu(a,o,s,c,i)):u._visibility&2?Fu(a,o,s,c,i):Iu(a,o),i&&l&2048&&ju(o.alternate,o);break;case 24:Fu(a,o,s,c,i),i&&l&2048&&Mu(o.alternate,o);break;default:Fu(a,o,s,c,i)}t=t.sibling}}function Iu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Iu(n,r),i&2048&&ju(r.alternate,r);break;case 24:Iu(n,r),i&2048&&Mu(r.alternate,r);break;default:Iu(n,r)}t=t.sibling}}var Lu=8192;function Ru(e,t,n){if(e.subtreeFlags&Lu)for(e=e.child;e!==null;)zu(e,t,n),e=e.sibling}function zu(e,t,n){switch(e.tag){case 26:Ru(e,t,n),e.flags&Lu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,Su,e.memoizedState,e.memoizedProps));break;case 5:Ru(e,t,n),e.flags&Lu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=Su;Su=bm(e.stateNode.containerInfo),Ru(e,t,n),Su=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Lu,Lu=16777216,Ru(e,t,n),Lu=r):Ru(e,t,n));break;case 30:if((e.flags&Lu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Nl===null&&(Nl=new Map),Nl.set(r,i)}Ru(e,t,n);break;default:Ru(e,t,n)}}function Bu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Vu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Wu(r,e)}Bu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hu(e),e=e.sibling}function Hu(e){switch(e.tag){case 0:case 11:case 15:Vu(e),e.flags&2048&&hl(9,e,e.return);break;case 3:Vu(e);break;case 12:Vu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Uu(e)):Vu(e);break;default:Vu(e)}}function Uu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Wu(r,e)}Bu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:hl(8,t,t.return),Uu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Uu(t));break;default:Uu(t)}e=e.sibling}}function Wu(e,t){for(;tu!==null;){var n=tu;switch(n.tag){case 0:case 11:case 15:hl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ta(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tu=r;else a:for(n=e;tu!==null;){r=tu;var i=r.sibling,a=r.return;if(fu(r),r===n){tu=null;break a}if(i!==null){i.return=a,tu=i;break a}tu=a}}}var Gu={getCacheForType:function(e){var t=_a(Ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return _a(Ca).controller.signal}},Ku=typeof WeakMap==`function`?WeakMap:Map,qu=0,Ju=null,Yu=null,Xu=0,Zu=0,Qu=null,$u=!1,ed=!1,td=!1,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=0,ld=null,ud=null,dd=!1,fd=0,pd=0,md=1/0,hd=null,gd=null,_d=0,vd=null,yd=null,bd=0,xd=0,Sd=null,Cd=null,wd=null,Td=null,Ed=null,Dd=0,Od=null;function kd(){return qu&2&&Xu!==0?Xu&-Xu:P.T===null?ht():Nf()}function Ad(){if(sd===0){if(!(Xu&536870912)||Xi){var e=$e;$e<<=1,!($e&3932160)&&($e=262144),sd=e}else sd=536870912}return e=Co.current,e!==null&&(e.flags|=32),sd}function jd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(fi(e.memoizedProps,n))),Td===null&&(Td=[]),Td.push(t.bind(null,r))}}function Md(e,t,n){(e===Ju&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)&&(zd(e,0),Id(e,Xu,sd,!1)),ct(e,n),qu&2&&e===Ju||(e===Ju&&(!(qu&2)&&(ad|=n),rd===4&&Id(e,Xu,sd,!1)),Tf(e))}function Nd(e,t,n){if(qu&6)throw Error(o(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||rt(e,t),i=r?qd(e,t):Gd(e,t,!0),a=r;do{if(i===0){ed&&!r&&Id(e,t,0,!1);break}if(n=e.current.alternate,a&&!Fd(n))i=Gd(e,t,!1),a=!1;else{if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=ld;var l=c.current.memoizedState.isDehydrated;if(l&&(zd(c,s).flags|=256),s=Gd(c,s,!1),s!==2&&s!==6){if(td&&!l){c.errorRecoveryDisabledLanes|=a,ad|=a,i=4;break a}a=ud,ud=i,a!==null&&(ud===null?ud=a:ud.push.apply(ud,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){zd(e,0),Id(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Id(r,t,sd,!$u);break a;case 2:ud=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=fd+300-Le(),10<i)){if(Id(r,t,sd,!$u),nt(r,0,!0)!==0)break a;bd=t,r.timeoutHandle=gp(Pd.bind(null,r,n,ud,hd,dd,t,sd,ad,cd,$u,a,`Throttled`,-0,0),i);break a}Pd(r,n,ud,hd,dd,t,sd,ad,cd,$u,a,null,-0,0)}break}}while(1);Tf(e)}function Pd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hn},Nl=null,zu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?fd-Le():(a&4194048)===a?pd-Le():0,m=eh(d,m),m!==null)?(bd=a,e.cancelPendingCommit=m(ef.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Id(e,a,o,!l)):ef(e,t,a,n,r,i,o,s,c,l,u,d)}function Fd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Ir(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Id(e,t,n,r){t=it(e,t),t&=~od,t&=~ad,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ut(e,n,t)}function Ld(){return qu&6?!0:(Ef(0,!1),!1)}function Rd(){if(Yu!==null){if(Zu===0)var e=Yu.return;else e=Yu,la=ca=null,Qo(e),Za=null,Qa=0,e=Yu;for(;e!==null;)pl(e.alternate,e),e=e.return;Yu=null}}function zd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),bd=0,Rd(),Ju=e,Yu=n=Oi(e.current,null),Xu=t,Zu=0,Qu=null,$u=!1,ed=rt(e,t),td=!1,cd=sd=od=ad=id=rd=0,ud=ld=null,dd=!1,nd=it(e,t),yi(),n}function Bd(e,t){Y=null,P.H=cc,t===Va||t===Ua?(t=Ya(),Zu=3):t===Ha?(t=Ya(),Zu=4):Zu=t===Ec?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Qu=t,Yu===null&&(rd=1,bc(e,Ii(t,e.current)))}function Vd(){var e=Co.current;return e===null?!0:(Xu&4194048)===Xu?wo===null:(Xu&62914560)===Xu||Xu&536870912?e===wo:!1}function Hd(){var e=P.H;return P.H=cc,e===null?cc:e}function Ud(){var e=P.A;return P.A=Gu,e}function Wd(){rd=4,$u||(Xu&4194048)!==Xu&&Co.current!==null||(ed=!0),!(id&134217727)&&!(ad&134217727)||Ju===null||Id(Ju,Xu,sd,!1)}function Gd(e,t,n){var r=qu;qu|=2;var i=Hd(),a=Ud();(Ju!==e||Xu!==t)&&(hd=null,zd(e,t)),t=!1;var o=rd;a:do try{if(Zu!==0&&Yu!==null){var s=Yu,c=Qu;switch(Zu){case 8:Rd(),o=6;break a;case 3:case 2:case 9:case 6:Co.current===null&&(t=!0);var l=Zu;if(Zu=0,Qu=null,Zd(e,s,c,l),n&&ed){o=0;break a}break;default:l=Zu,Zu=0,Qu=null,Zd(e,s,c,l)}}Kd(),o=rd;break}catch(t){Bd(e,t)}while(1);return t&&e.shellSuspendCounter++,la=ca=null,qu=r,P.H=i,P.A=a,Yu===null&&(Ju=null,Xu=0,yi()),o}function Kd(){for(;Yu!==null;)Yd(Yu)}function qd(e,t){var n=qu;qu|=2;var r=Hd(),i=Ud();Ju!==e||Xu!==t?(hd=null,md=Le()+500,zd(e,t)):ed=rt(e,t);a:do try{if(Zu!==0&&Yu!==null){t=Yu;var a=Qu;b:switch(Zu){case 1:Zu=0,Qu=null,Zd(e,t,a,1);break;case 2:case 9:if(Ga(a)){Zu=0,Qu=null,Xd(t);break}t=function(){Zu!==2&&Zu!==9||Ju!==e||(Zu=7),Tf(e)},a.then(t,t);break a;case 3:Zu=7;break a;case 4:Zu=5;break a;case 7:Ga(a)?(Zu=0,Qu=null,Xd(t)):(Zu=0,Qu=null,Zd(e,t,a,7));break;case 5:var s=null;switch(Yu.tag){case 26:s=Yu.memoizedState;case 5:case 27:var c=Yu;if(s?Ym(s):c.stateNode.complete){Zu=0,Qu=null;var l=c.sibling;if(l!==null)Yu=l;else{var u=c.return;u===null?Yu=null:(Yu=u,Qd(u))}break b}}Zu=0,Qu=null,Zd(e,t,a,5);break;case 6:Zu=0,Qu=null,Zd(e,t,a,6);break;case 8:Rd(),rd=6;break a;default:throw Error(o(462))}}Jd();break}catch(t){Bd(e,t)}while(1);return la=ca=null,P.H=r,P.A=i,qu=n,Yu===null?(Ju=null,Xu=0,yi(),rd):0}function Jd(){for(;Yu!==null&&!Fe();)Yd(Yu)}function Yd(e){var t=il(e.alternate,e,nd);e.memoizedProps=e.pendingProps,t===null?Qd(e):Yu=t}function Xd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Bc(n,t,t.pendingProps,t.type,void 0,Xu);break;case 11:t=Bc(n,t,t.pendingProps,t.type.render,t.ref,Xu);break;case 5:Qo(t);var r=t;r===Ji&&(Xi?(na(r),r.tag===5&&r.stateNode!=null&&(Yi=r.stateNode)):(na(r),Xi=!0));default:pl(n,t),t=Yu=ki(t,nd),t=il(n,t,nd)}e.memoizedProps=e.pendingProps,t===null?Qd(e):Yu=t}function Zd(e,t,n,r){la=ca=null,Qo(t),Za=null,Qa=0;var i=t.return;try{if(Tc(e,i,t,n,Xu)){rd=1,bc(e,Ii(n,e.current)),Yu=null;return}}catch(t){if(i!==null)throw Yu=i,t;rd=1,bc(e,Ii(n,e.current)),Yu=null;return}t.flags&32768?(Xi||r===1?e=!0:ed||Xu&536870912?e=!1:($u=e=!0,(r===2||r===9||r===3||r===6)&&(r=Co.current,r!==null&&r.tag===13&&(r.flags|=16384))),$d(t,e)):Qd(t)}function Qd(e){var t=e;do{if(t.flags&32768){$d(t,$u);return}e=t.return;var n=dl(t.alternate,t,nd);if(n!==null){Yu=n;return}if(t=t.sibling,t!==null){Yu=t;return}Yu=t=e}while(t!==null);rd===0&&(rd=5)}function $d(e,t){do{var n=fl(e.alternate,e);if(n!==null){n.flags&=32767,Yu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Yu=e;return}Yu=e=n}while(e!==null);rd=6,Yu=null}function ef(e,t,n,r,i,a,s,c,l,u,d,f){e.cancelPendingCommit=null;do lf();while(_d!==0);if(qu&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===Ju&&(Yu=Ju=null,Xu=0),yd=t,vd=e,bd=n,Sd=i,Cd=r,tf(e,t,n,s,c,l,f)}}function tf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(xd=s,s|=vi,lt(e,n,s,r,i,a),Td=null,(n&335544064)===n?(Ed=Oa(e),r=10262):(Ed=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,vf(Ve,function(){return uf(),null})):(e.callbackNode=null,e.callbackPriority=0),Ml=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=P.T,P.T=null,i=_e.p,_e.p=2,a=qu,qu|=4;try{ou(e,t,n)}finally{qu=a,_e.p=i,P.T=r}}_d=1,Ml?wd=Mp(o,e.containerInfo,Ed,af,of,rf,sf,uf,nf,null,null):(af(),of(),sf())}function nf(e){if(_d!==0){var t=vd.onRecoverableError;t(e,{componentStack:null})}}function rf(){_d===3&&(_d=0,Du(yd,vd),_d=4)}function af(){if(_d===1){_d=0;var e=vd,t=yd,n=bd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=P.T,P.T=null;var i=_e.p;_e.p=2;var a=qu;qu|=4;try{ru=iu=!1,Cu(t,e,n),n=cp;var o=Hr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Vr(s.ownerDocument.documentElement,s)){if(c!==null&&Ur(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Br(s,h),v=Br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{qu=a,_e.p=i,P.T=r}}e.current=t,_d=2}}function of(){if(_d===2){_d=0;var e=vd,t=yd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=_e.p;_e.p=2;var i=qu;qu|=4;try{cu(e,t.alternate,t)}finally{qu=i,_e.p=r,P.T=n}}_d=3}}function sf(){if(_d===4||_d===3){_d=0;var e=wd;wd=null,Ie();var t=vd,n=yd,r=bd,i=Cd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?_d=5:(_d=0,yd=vd=null,cf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(gd=null),mt(r),n=n.stateNode,qe&&typeof qe.onCommitFiberRoot==`function`)try{qe.onCommitFiberRoot(Ke,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=P.T,a=_e.p,_e.p=2,P.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{P.T=n,_e.p=a}}if(i=Td,o=Ed,Ed=null,i!==null&&(Td=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);bd&3&&lf(),Tf(t),a=t.pendingLanes,r&261930&&a&42?t===Od?Dd++:(Dd=0,Od=t):(Dd=0,Od=null),Ef(0,!1)}}function cf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ta(t)))}function lf(){return wd!==null&&(wd.skipTransition(),wd=null),af(),of(),sf(),uf()}function uf(){if(_d!==5)return!1;var e=vd,t=xd;xd=0;var n=mt(bd),r=P.T,i=_e.p;try{_e.p=32>n?32:n,P.T=null,n=Sd,Sd=null;var a=vd,s=bd;if(_d=0,yd=vd=null,bd=0,qu&6)throw Error(o(331));var c=qu;if(qu|=4,Hu(a.current),Pu(a,a.current,s,n),qu=c,Ef(0,!1),qe&&typeof qe.onPostCommitFiberRoot==`function`)try{qe.onPostCommitFiberRoot(Ke,a)}catch{}return!0}finally{_e.p=i,P.T=r,cf(e,t)}}function df(e,t,n){t=Ii(n,t),t=Sc(e.stateNode,t,2),e=lo(e,t,2),e!==null&&(ct(e,2),Tf(e))}function ff(e,t,n){if(e.tag===3)df(e,e,n);else for(;t!==null;){if(t.tag===3){df(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(gd===null||!gd.has(r))){e=Ii(n,e),n=Cc(2),r=lo(t,n,2),r!==null&&(wc(n,r,t,e),ct(r,2),Tf(r));break}}t=t.return}}function pf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ku;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(td=!0,i.add(n),e=mf.bind(null,e,t,n),t.then(e,e))}function mf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ju===e&&(Xu&n)===n&&(rd===4||rd===3&&(Xu&62914560)===Xu&&300>Le()-fd?qu&2?od|=n:zd(e,0):od|=n,cd===Xu&&(cd=0)),Tf(e)}function hf(e,t){t===0&&(t=ot()),e=Si(e,t),e!==null&&(ct(e,t),Tf(e))}function gf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hf(e,n)}function _f(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),hf(e,n)}function vf(e,t){return Ne(e,t)}var yf=null,bf=null,xf=!1,Sf=!1,Cf=!1,wf=0;function Tf(e){e!==bf&&e.next===null&&(bf===null?yf=bf=e:bf=bf.next=e),Sf=!0,xf||(xf=!0,Mf())}function Ef(e,t){if(!Cf&&Sf){Cf=!0;do for(var n=!1,r=yf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,jf(r,a))}else a=Xu,a=nt(r,r===Ju?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||rt(r,a)||(n=!0,jf(r,a))}r=r.next}while(n);Cf=!1}}function Df(){Of()}function Of(){Sf=xf=!1;var e=0;wf!==0&&hp()&&(e=wf);for(var t=Le(),n=null,r=yf;r!==null;){var i=r.next,a=kf(r,t);a===0?(r.next=null,n===null?yf=i:n.next=i,i===null&&(bf=n)):(n=r,(e!==0||a&3)&&(Sf=!0)),r=i}_d!==0&&_d!==5||Ef(e,!1),wf!==0&&(wf=0)}function kf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=at(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ju,n=Xu,n=nt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Pe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||rt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Pe(r),mt(n)){case 2:case 8:n=Be;break;case 32:n=Ve;break;case 268435456:n=Ue;break;default:n=Ve}return r=Af.bind(null,e),n=Ne(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Pe(r),e.callbackPriority=2,e.callbackNode=null,2}function Af(e,t){if(_d!==0&&_d!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(lf()&&e.callbackNode!==n)return null;var r=Xu;return r=nt(e,e===Ju?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Nd(e,r,t),kf(e,Le()),e.callbackNode!=null&&e.callbackNode===n?Af.bind(null,e):null)}function jf(e,t){if(lf())return null;Nd(e,t,!0)}function Mf(){bp(function(){qu&6?Ne(ze,Df):Of()})}function Nf(){if(wf===0){var e=ja;e===0&&(e=Qe,Qe<<=1,!(Qe&261888)&&(Qe=256)),wf=e}return wf}function Pf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:mn(e)}function Ff(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Pf((i[yt]||null).action),o=r.submitter;o&&(t=(t=o[yt]||null)?Pf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new In(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(wf!==0){var e=new FormData(i,o);Js(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Js(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var If=0;If<li.length;If++){var Lf=li[If];ui(Lf.toLowerCase(),`on`+(Lf[0].toUpperCase()+Lf.slice(1)))}ui(ti,`onAnimationEnd`),ui(ni,`onAnimationIteration`),ui(ri,`onAnimationStart`),ui(`dblclick`,`onDoubleClick`),ui(`focusin`,`onFocus`),ui(`focusout`,`onBlur`),ui(ii,`onTransitionRun`),ui(ai,`onTransitionStart`),ui(oi,`onTransitionCancel`),ui(si,`onTransitionEnd`),Lt(`onMouseEnter`,[`mouseout`,`mouseover`]),Lt(`onMouseLeave`,[`mouseout`,`mouseover`]),Lt(`onPointerEnter`,[`pointerout`,`pointerover`]),Lt(`onPointerLeave`,[`pointerout`,`pointerover`]),It(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),It(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),It(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),It(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Rf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),zf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Rf));function Bf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){hi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){hi(e)}i.currentTarget=null,a=c}}}}function Vf(e,t){var n=t[xt];n===void 0&&(n=t[xt]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Pt.forEach(function(t){t!==`selectionchange`&&(zf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!Tn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Kf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=Ot(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}Sn(function(){var r=a,i=_n(n),o=[];a:{var s=ci.get(e);if(s!==void 0){var c=In,u=e;switch(e){case`keypress`:if(jn(n)===0)break a;case`keydown`:case`keyup`:c=er;break;case`focusin`:u=`focus`,c=Gn;break;case`focusout`:u=`blur`,c=Gn;break;case`beforeblur`:case`afterblur`:c=Gn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Un;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Wn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=rr;break;case ti:case ni:case ri:c=Kn;break;case si:c=ir;break;case`scroll`:case`scrollend`:c=Rn;break;case`wheel`:c=ar;break;case`copy`:case`cut`:case`paste`:c=qn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=tr;break;case`submit`:c=nr;break;case`toggle`:case`beforetoggle`:c=or}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Cn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,s=e===`mouseout`||e===`pointerout`,c&&n!==gn&&(u=n.relatedTarget||n.fromElement)&&(Ot(u)||u[bt]))break a;(s||c)&&(u=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,s?(c=n.relatedTarget||n.toElement,s=r,c=c?Ot(c):null,c!==null&&(f=l(c),d=c.tag,c!==f||d!==5&&d!==27&&d!==6)&&(c=null)):(s=null,c=r),s!==c&&(d=Un,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=tr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=s==null?u:At(s),h=c==null?u:At(c),u=new d(g,m+`leave`,s,n,i),u.target=f,u.relatedTarget=h,g=null,Ot(i)===r&&(d=new d(p,m+`enter`,c,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=s&&c?E(s,c,$):null,s!==null&&Yf(o,u,s,d,!1),c!==null&&f!==null&&Yf(o,f,c,d,!0)))}a:{if(s=r?At(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var _=wr;else if(yr(s)){if(Tr)_=Pr;else{_=Mr;var v=jr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&dn(r.elementType)&&(_=wr):_=Nr;if(_&&(_=_(e,r))){W(o,_,n,i);break a}v&&v(e,s,r)}switch(v=r?At(r):window,e){case`focusin`:(yr(v)||v.contentEditable===`true`)&&(Gr=v,Kr=r,qr=null);break;case`focusout`:qr=Kr=Gr=null;break;case`mousedown`:Jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Jr=!1,Yr(o,n,i);break;case`selectionchange`:if(Wr)break;case`keydown`:case`keyup`:Yr(o,n,i)}var y;if(cr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else gr?mr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(dr&&n.locale!==`ko`&&(gr||b!==`onCompositionStart`?b===`onCompositionEnd`&&gr&&(y=An()):(Dn=i,On=`value`in Dn?Dn.value:Dn.textContent,gr=!0)),v=Jf(r,b),0<v.length&&(b=new Jn(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=hr(n),y!==null&&(b.data=y)))),(y=ur?_r(e,n):U(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new Jn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),Ff(o,e,r,n,i)}Bf(o,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Cn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=Cn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function $(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Cn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=Cn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function Qf(e){return(typeof e==`string`?e:``+e).replace(Xf,`
|
|
10
|
+
`).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||sn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&sn(e,``+r);else return;break;case`className`:Gt(e,`class`,r);break;case`tabIndex`:Gt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Gt(e,n,r);break;case`style`:un(e,r,a);return;case`data`:if(t!==`object`){Gt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=mn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,i.name,i,null),ep(e,t,`formEncType`,i.formEncType,i,null),ep(e,t,`formMethod`,i.formMethod,i,null),ep(e,t,`formTarget`,i.formTarget,i,null)):(ep(e,t,`encType`,i.encType,i,null),ep(e,t,`method`,i.method,i,null),ep(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=mn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=hn);return;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=mn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Wt(e,`popover`,r);break;case`xlinkActuate`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Wt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=fn.get(n)||n,Wt(e,n,r);else return}Ht=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:un(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)sn(e,r);else if(typeof r==`number`||typeof r==`bigint`)sn(e,``+r);else return;break;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=hn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Ft.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),a=n.slice(2,i?n.length-7:void 0),t=e[yt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(a,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,i);break a}Ht=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Wt(e,n,r)}return}Ht=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Vf(`error`,e),Vf(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:ep(e,t,a,s,n,null)}}i&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:Vf(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:ep(e,t,r,d,n,null)}}tn(e,a,c,l,u,s,i,!1);return;case`select`:for(i in Vf(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&rn(e,!!r,n,!0):rn(e,!!r,t,!1);return;case`textarea`:for(s in Vf(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:ep(e,t,s,c,n,null)}on(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Vf(`cancel`,e),Vf(`close`,e);break;case`iframe`:case`object`:Vf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)Vf(Rf[r],e);break;case`image`:Vf(`error`,e),Vf(`load`,e);break;case`details`:Vf(`toggle`,e);break;case`embed`:case`source`:case`link`:Vf(`error`,e),Vf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:ep(e,t,u,r,n,null)}return;default:if(dn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Ht=!0),a=m;break;case`name`:m!==f&&(Ht=!0),i=m;break;case`checked`:m!==f&&(Ht=!0),u=m;break;case`defaultChecked`:m!==f&&(Ht=!0),d=m;break;case`value`:m!==f&&(Ht=!0),s=m;break;case`defaultValue`:m!==f&&(Ht=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}en(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||ep(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:a!==l&&(Ht=!0),p=a;break;case`defaultValue`:a!==l&&(Ht=!0),c=a;break;case`multiple`:a!==l&&(Ht=!0),s=a;default:a!==l&&ep(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?rn(e,!!n,n?[]:``,!1):rn(e,!!n,t,!0)):rn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:i!==a&&(Ht=!0),p=i;break;case`defaultValue`:i!==a&&(Ht=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&ep(e,t,s,i,r,a)}an(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Ht=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(dn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[vt]=r,n[yt]=t,np(n,e,t),Mt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Tt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Ot(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(o(566));var t=[];h(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=b(i),Zp(i,n)):b(i).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??(e.reactFragments=new Set),e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),Dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Tt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===hn&&(e.onclick=null),Dt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Dt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=_e.d;_e.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Ld();return e||t}function Cm(e){var t=kt(e);t!==null&&t.tag===5&&t.type===`form`?Xs(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=$t(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Mt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+$t(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+$t(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+$t(n.imageSizes)+`"]`)):i+=`[href="`+$t(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Et]=!0,o.onload=o.onerror=function(){Nt(o)}),Mt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+$t(r)+`"][href="`+$t(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Mt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=jt(r).hoistableStyles,a=Pm(e);t=t||`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Mt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Mt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Mt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=we.current)?bm(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=jt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var a=jt(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(Fm(e)))?a._p||(s.instance=a,s.state.loading=5):(a=vm.get(e),a||(a={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,a)),Lm(i,e,a,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=jt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Pm(e){return`href="`+$t(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Et]){r.loading=1;return}}else t=e.createElement(`link`),t[Et]=!0,t.onload=t.onerror=Nt.bind(null,t),np(t,`link`,n),Mt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+$t(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+$t(n.href)+`"]`);if(r)return t.instance=r,Mt(r),r;var i=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Mt(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var a=e.querySelector(Fm(i));if(a)return t.state.loading|=4,t.instance=a,Mt(a),a;r=Im(n),(i=vm.get(i))&&Hm(r,i),a=(e.ownerDocument||e).createElement(`link`),Mt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(a,`link`,r),t.state.loading|=4,Vm(a,n.precedence,e),t.instance=a;case`script`:return a=Rm(n.src),(i=e.querySelector(zm(a)))?(t.instance=i,Mt(i),i):(r=n,(i=vm.get(a))&&(r=D({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Mt(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??(e.crossOrigin=t.crossOrigin),e.referrerPolicy??(e.referrerPolicy=t.referrerPolicy),e.title??(e.title=t.title)}function Um(e,t){e.crossOrigin??(e.crossOrigin=t.crossOrigin),e.referrerPolicy??(e.referrerPolicy=t.referrerPolicy),e.integrity??(e.integrity=t.integrity)}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Tt]||a[vt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Mt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:oe,Provider:null,Consumer:null,_currentValue:ve,_currentValue2:ve,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=st(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=st(0),this.hiddenUpdates=st(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Di(3,null,null,t),e.current=a,a.stateNode=e,t=wa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},oo(a),e}function uh(e){return e?(e=Ti,e):Ti}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=co(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=lo(e,r,t),n!==null&&(Md(n,e,t),uo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Si(e,67108864);t!==null&&Md(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=kd();t=pt(t);var n=Si(e,t);n!==null&&Md(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=P.T;P.T=null;var a=_e.p;try{_e.p=2,yh(e,t,n,r)}finally{_e.p=a,P.T=i}}function vh(e,t,n,r){var i=P.T;P.T=null;var a=_e.p;try{_e.p=8,yh(e,t,n,r)}finally{_e.p=a,P.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Kf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=kt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=tt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Je(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(qu&6)&&(md=Le()+500,Ef(0,!1))}}break;case 31:case 13:s=Si(a,2),s!==null&&Md(s,a,2),Ld(),ph(a,2)}if(a=bh(r),a===null&&Kf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function bh(e){return e=_n(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Ot(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Re()){case ze:return 2;case Be:return 8;case Ve:case He:return 32;case Ue:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=kt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Ot(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,gt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,gt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);gn=r,n.target.dispatchEvent(r),gn=null}else return t=kt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=kt(n);a!==null&&(e.splice(t,3),t-=3,Js(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[yt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[yt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;dh(n,kd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Ld(),t[bt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.1`)throw Error(o(527,Kh,`19.3.1`));_e.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Ke=Jh.inject(qh),qe=Jh}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(o(299));var n=!1,r=``,i=_c,a=vc,s=yc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,i,a,s,Uh),e[bt]=t.current,Wf(e),new Wh(t)}})),l=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=c()})),u=r(),d=l(),f='\nconst e=e=>typeof e==`object`&&!!e;function t(e){let t=[],n=[],r=e=>(n.length?n[n.length-1].c:t).push(e),i=0,a=e.length;for(;i<a;){let t=e.indexOf(`<`,i);if(t<0){r(e.slice(i));break}t>i&&r(e.slice(i,t));let o=e[t+1];if(o===`!`||o===`?`){let n;n=e.startsWith(`<!--`,t)?e.indexOf(`-->`,t)+3:e.startsWith(`<![CDATA[`,t)?e.indexOf(`]]>`,t)+3:o===`?`?e.indexOf(`?>`,t)+2:e.indexOf(`>`,t)+1,n<=0&&(n=a),r(e.slice(t,n)),i=n;continue}if(o===`/`){let r=e.indexOf(`>`,t);n.pop(),i=r<0?a:r+1;continue}let s=-1,c=``;for(let n=t+1;n<a;n++){let t=e[n];if(c)t===c&&(c=``);else if(t===`"`||t===`\'`)c=t;else if(t===`>`){s=n;break}}s<0&&(s=a-1);let l=e.slice(t+1,s),u=l.endsWith(`/`);u&&(l=l.slice(0,-1));let d=/^[^\\s/>]+/.exec(l),f=d?d[0]:l,p={q:f,a:l.slice(f.length),c:[],self:u};r(p),u||n.push(p),i=s+1}return t}function n(e){if(Array.isArray(e)){let t=``;for(let r of e)t+=n(r);return t}return typeof e==`string`?e:e.self&&!e.c.length?`<${e.q}${e.a}/>`:`<${e.q}${e.a}>${n(e.c)}</${e.q}>`}const r=e=>e.slice(e.indexOf(`:`)+1),i=e=>e.includes(`:`)?e.slice(0,e.indexOf(`:`)+1):``;function a(t){return t.find(e)}function o(t,n){return t?t.c.filter(t=>e(t)&&(!n||r(t.q)===n)):[]}function s(t,n){if(t){for(let i of t.c)if(e(i)&&r(i.q)===n)return i}}const c=/([^\\s=]+)\\s*=\\s*("([^"]*)"|\'([^\']*)\')/g;function l(e,t,n=!1){c.lastIndex=0;let i;for(;i=c.exec(e.a);)if(i[1]===t||n&&r(i[1])===t)return _(i[3]??i[4]??``)}function u(e,t,n){c.lastIndex=0;let r;for(;r=c.exec(e.a);)if(r[1]===t){let i=n===void 0?``:`${t}="${g(n)}"`;e.a=e.a.slice(0,r.index)+i+e.a.slice(r.index+r[0].length),n===void 0&&(e.a=e.a.replace(/\\s+$/,``).replace(/\\s{2,}/g,` `));return}n!==void 0&&(e.a=`${e.a.replace(/\\s+$/,``)} ${t}="${g(n)}"`)}function d(e,t={},n=[]){let r=``;for(let[e,n]of Object.entries(t))n!==void 0&&(r+=` ${e}="${g(n)}"`);return{q:e,a:r,c:n,self:n.length===0}}function f(e){if(typeof e==`string`)return e;let t=e;return{q:t.q,a:t.a,self:t.self,c:t.c.map(f)}}function p(t,n){let i=typeof n==`string`?e=>e===n:n;t.c=t.c.filter(t=>!(e(t)&&i(r(t.q))))}function m(t,n,i,a){let o=t.c.findIndex(t=>e(t)&&r(t.q)===i);if(o>=0){n?t.c[o]=n:t.c.splice(o,1),t.self=t.c.length===0;return}if(!n)return;let s=a.indexOf(i),c=t.c.length;for(let n=0;n<t.c.length;n++){let i=t.c[n];if(e(i)&&a.indexOf(r(i.q))>s){c=n;break}}t.c.splice(c,0,n),t.self=!1}function h(e){return e.replace(/[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\uFFFE\\uFFFF]/g,``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function g(e){return h(e).replace(/"/g,`"`)}function _(e){return e.indexOf(`&`)<0?e:e.replace(/&(lt|gt|amp|quot|apos|#\\d+|#x[0-9a-fA-F]+);/g,(e,t)=>{switch(t){case`lt`:return`<`;case`gt`:return`>`;case`amp`:return`&`;case`quot`:return`"`;case`apos`:return`\'`}let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)?String.fromCodePoint(n):e})}function v(t,n){let i=t=>{let a=!1,o=r(t.q)===`AlternateContent`;for(let s=0;s<t.c.length;s++){let c=t.c[s];if(!e(c))continue;let l=r(c.q);if(l!==`Fallback`){if(o&&l===`Choice`){if(a)continue;a=!0,i(c)}else l===`AlternateContent`?i(c):n(c,t,s)||i(c)}}};i(t)}const y=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`;function b(e,t=`id`,n){let r=RegExp(`xmlns:([\\\\w.-]+)="${y.replace(/[.]/g,`\\\\.`)}"`).exec(e.a);return r?{[`${r[1]}:${t}`]:n}:{"xmlns:r":y,[`r:${t}`]:n}}function x(e){"@babel/helpers - typeof";return x=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},x(e)}function S(e,t){if(x(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(x(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function C(e){var t=S(e,`string`);return x(t)==`symbol`?t:t+``}function w(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const T=(e,t)=>Number(e.getBigUint64(t,!0));var ee=class e{constructor(e){w(this,`src`,void 0),w(this,`entries`,/* @__PURE__ */ new Map),this.src=e}static async open(t){let n=new e(t);return await n.readDirectory(),n}async readDirectory(){let{src:e}=this;if(e.size<22)throw Error(`Not a ZIP/OOXML file (too small)`);let t=Math.min(e.size,65577),n=e.size-t,r=await e.read(n,t),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=-1;for(let e=r.length-22;e>=0;e--)if(i.getUint32(e,!0)===101010256){a=e;break}if(a<0){let t=await e.read(0,8);throw t[0]===208&&t[1]===207?Error(`Legacy binary Office format (.doc/.xls/.ppt) or encrypted file is not supported`):Error(`Not a ZIP/OOXML file (no end of central directory)`)}let o=i.getUint16(a+10,!0),s=i.getUint32(a+12,!0),c=i.getUint32(a+16,!0);if(o===65535||s===4294967295||c===4294967295){let t=a-20;if(t>=0&&i.getUint32(t,!0)===117853008){let n=T(i,t+8),r=await e.read(n,56),a=new DataView(r.buffer,r.byteOffset,r.byteLength);a.getUint32(0,!0)===101075792&&(o=T(a,32),s=T(a,40),c=T(a,48))}}let l=await e.read(c,s),u=new DataView(l.buffer,l.byteOffset,l.byteLength),d=new TextDecoder,f=0;for(let e=0;e<o&&f+46<=l.length&&u.getUint32(f,!0)===33639248;e++){let e=u.getUint16(f+8,!0),t=u.getUint16(f+10,!0),n=u.getUint16(f+12,!0),r=u.getUint16(f+14,!0),i=u.getUint32(f+16,!0),a=u.getUint32(f+20,!0),o=u.getUint32(f+24,!0),s=u.getUint16(f+28,!0),c=u.getUint16(f+30,!0),p=u.getUint16(f+32,!0),m=u.getUint32(f+42,!0),h=d.decode(l.subarray(f+46,f+46+s));if(o===4294967295||a===4294967295||m===4294967295){let e=f+46+s,t=e+c;for(;e+4<=t;){let t=u.getUint16(e,!0),n=u.getUint16(e+2,!0);if(t===1){let t=e+4;o===4294967295&&(o=T(u,t),t+=8),a===4294967295&&(a=T(u,t),t+=8),m===4294967295&&(m=T(u,t));break}e+=4+n}}h.endsWith(`/`)||this.entries.set(E(h),{name:h,method:t,flags:e,crc:i,time:n,date:r,compSize:a,size:o,localOffset:m}),f+=46+s+c+p}}list(){return[...this.entries.values()]}get(e){return this.entries.get(E(e))}has(e){return this.entries.has(E(e))}async dataOffset(e){if(e.dataOffset!==void 0)return e.dataOffset;let t=await this.src.read(e.localOffset,30),n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==67324752)throw Error(`Corrupt ZIP local header for ${e.name}`);return e.dataOffset=e.localOffset+30+n.getUint16(26,!0)+n.getUint16(28,!0),e.dataOffset}async rawData(e){let t=await this.dataOffset(e);return this.src.slice?this.src.slice(t,e.compSize):this.src.read(t,e.compSize)}async stream(e,t){let n=this.get(e);if(!n)throw Error(`Missing part: ${e}`);if(n.flags&1)throw Error(`Encrypted documents are not supported`);let r=await this.dataOffset(n),i=this.src.stream(r,n.compSize);if(t){let e=0,r=n.compSize;i=i.pipeThrough(new TransformStream({transform(n,i){e+=n.length,t(e,r),i.enqueue(n)}}))}if(n.method===0)return i;if(n.method===8)return i.pipeThrough(new DecompressionStream(`deflate-raw`));throw Error(`Unsupported ZIP compression method ${n.method} for ${n.name}`)}async bytes(e){let t=this.get(e);if(!t)throw Error(`Missing part: ${e}`);let n=(await this.stream(e)).getReader(),r=new Uint8Array(t.size),i=0,a=[];for(;;){let{done:e,value:t}=await n.read();if(e)break;i+t.length<=r.length?r.set(t,i):a.push(t),i+=t.length}if(!a.length)return i===r.length?r:r.subarray(0,i);let o=new Uint8Array(i);o.set(r);let s=r.length;for(let e of a)o.set(e,s),s+=e.length;return o}async text(e){return new TextDecoder().decode(await this.bytes(e))}};function E(e){return e.replace(/^\\/+/,``).replace(/\\\\/g,`/`).toLowerCase()}const te=(()=>{let e=/* @__PURE__ */ new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function ne(e,t=0){let n=~t>>>0;for(let t=0;t<e.length;t++)n=te[(n^e[t])&255]^n>>>8;return~n>>>0}const re=globalThis.Bun!==void 0;async function ie(e){let t=0,n=0,r=e.pipeThrough(new TransformStream({transform(e,r){t=ne(e,t),n+=e.length,r.enqueue(e)}})).pipeThrough(new CompressionStream(`deflate-raw`)).getReader(),i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t),a+=t.length}return{chunks:i,crc:t,size:n,csize:a}}function ae(e){if(typeof e==`function`)return e();let t=typeof e==`string`?new TextEncoder().encode(e):e;return new ReadableStream({start(e){e.enqueue(t),e.close()}})}function oe(){let e=/* @__PURE__ */ new Date;return{time:e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1,date:e.getFullYear()-1980<<9|e.getMonth()+1<<5|e.getDate()}}async function se(e,t,n=`application/zip`){let r=new TextEncoder,i=[],a=[],o=0,s=0,c=/* @__PURE__ */ new Map;for(let[e,n]of t)c.set(E(e),{name:e.replace(/^\\/+/,``),data:n});let l=(e,t,n,c,l,u,d,f)=>{let p=r.encode(e),m=/[^\\x20-\\x7e]/.test(e)?2048:0;if(o>4294967280||c>4294967280)throw Error(`Saved file exceeds 4 GB (ZIP64 writing not supported)`);let h=new Uint8Array(30+p.length),g=new DataView(h.buffer);g.setUint32(0,67324752,!0),g.setUint16(4,20,!0),g.setUint16(6,m,!0),g.setUint16(8,t,!0),g.setUint16(10,u,!0),g.setUint16(12,d,!0),g.setUint32(14,n,!0),g.setUint32(18,c,!0),g.setUint32(22,l,!0),g.setUint16(26,p.length,!0),h.set(p,30);let _=new Uint8Array(46+p.length),v=new DataView(_.buffer);v.setUint32(0,33639248,!0),v.setUint16(4,20,!0),v.setUint16(6,20,!0),v.setUint16(8,m,!0),v.setUint16(10,t,!0),v.setUint16(12,u,!0),v.setUint16(14,d,!0),v.setUint32(16,n,!0),v.setUint32(20,c,!0),v.setUint32(24,l,!0),v.setUint16(28,p.length,!0),v.setUint32(42,o,!0),_.set(p,46),i.push(h,...f),a.push(_),o+=h.length+c,s++},u=async(e,t)=>{let n=await ie(ae(t)),{time:r,date:i}=oe();l(e,8,n.crc,n.csize,n.size,r,i,n.chunks)};for(let t of e?.list()??[]){let n=E(t.name),r=c.get(n);if(r){c.delete(n),r.data!==null&&await u(t.name,r.data);continue}let i=await e.rawData(t);re&&i instanceof Blob&&(i=new Uint8Array(await i.arrayBuffer())),l(t.name,t.method,t.crc,t.compSize,t.size,t.time,t.date,[i])}for(let{name:e,data:t}of c.values())t!==null&&await u(e,t);let d=a.reduce((e,t)=>e+t.length,0),f=/* @__PURE__ */ new Uint8Array(22),p=new DataView(f.buffer);return p.setUint32(0,101010256,!0),p.setUint16(8,s,!0),p.setUint16(10,s,!0),p.setUint32(12,d,!0),p.setUint32(16,o,!0),new Blob([...i,...a,f],{type:n})}const ce=/* @__PURE__ */ new Set([`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`http://purl.oclc.org/ooxml/officeDocument/relationships`]),le={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`\'`};function ue(e){return e.indexOf(`&`)<0?e:e.replace(/&(#x[0-9a-fA-F]+|#\\d+|[a-zA-Z]+);/g,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`||t[1]===`X`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)&&n<=1114111?String.fromCodePoint(n):e}return le[t]??e})}const de=e=>e===32||e===9||e===10||e===13;var fe=class{constructor(e,t){w(this,`h`,void 0),w(this,`raw`,void 0),w(this,`buf`,``),w(this,`depth`,0),w(this,`skipDepth`,-1),w(this,`relPrefixes`,/* @__PURE__ */ new Set([`r`])),this.h=e,this.raw=t}write(e){this.buf=this.buf.length?this.buf+e:e,this.run(!1)}end(){this.run(!0),this.buf=``}run(e){let t=this.buf,n=t.length,r=0;for(;r<n;){let i=t.indexOf(`<`,r);if(i<0){if(e){let e=t.substring(r);this.raw?.(e),this.onText(e),r=n}break}if(i>r){let e=t.substring(r,i);this.raw?.(e),this.onText(e)}if(r=i,i+1>=n)break;let a=t.charCodeAt(i+1);if(a===47){let e=t.indexOf(`>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+1)),this.onClose(t.substring(i+2,e)),r=e+1;continue}if(a===63){let e=t.indexOf(`?>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+2)),r=e+2;continue}if(a===33){if(n-i<9&&!e)break;if(t.startsWith(`<!--`,i)){let e=t.indexOf(`-->`,i+4);if(e<0)break;this.raw?.(t.substring(i,e+3)),r=e+3;continue}if(t.startsWith(`<![CDATA[`,i)){let e=t.indexOf(`]]>`,i+9);if(e<0)break;this.raw?.(t.substring(i,e+3)),this.skipDepth<0&&this.h.text(t.substring(i+9,e)),r=e+3;continue}let a=t.indexOf(`>`,i+2);if(a<0)break;this.raw?.(t.substring(i,a+1)),r=a+1;continue}let o=-1,s=0;for(let e=i+1;e<n;e++){let n=t.charCodeAt(e);if(s!==0)n===s&&(s=0);else if(n===34||n===39)s=n;else if(n===62){o=e;break}}if(o<0)break;this.raw?.(t.substring(i,o+1)),this.onOpen(t,i+1,o),r=o+1}this.buf=r>=n?``:t.substring(r)}onText(e){this.skipDepth>=0||this.depth===0||this.h.text(e.indexOf(`&`)>=0?ue(e):e)}onOpen(e,t,n){let r=n,i=!1;if(e.charCodeAt(n-1)===47&&(i=!0,r=n-1),this.skipDepth>=0){i||this.depth++;return}let a=t;for(;a<r&&!de(e.charCodeAt(a));)a++;let o=e.substring(t,a),s=o.indexOf(`:`),c=s<0?o:o.substring(s+1),l={};for(;a<r;){if(de(e.charCodeAt(a))){a++;continue}let t=e.indexOf(`=`,a);if(t<0||t>=r)break;let n=e.substring(a,t).trim(),i=t+1;for(;i<r&&e.charCodeAt(i)!==34&&e.charCodeAt(i)!==39;)i++;if(i>=r)break;let o=e.indexOf(e[i],i+1);if(o<0)break;let s=e.substring(i+1,o);a=o+1;let c=n.indexOf(`:`);if(c>=0){let e=n.substring(0,c),t=n.substring(c+1);if(e===`xmlns`){ce.has(s)&&this.relPrefixes.add(t);continue}n=this.relPrefixes.has(e)?`r:`+t:t}else if(n===`xmlns`)continue;l[n]=s.indexOf(`&`)>=0?ue(s):s}let u=this.h.open(c,l,i);i?u||this.h.close(c):(this.depth++,u&&(this.skipDepth=this.depth))}onClose(e){if(this.skipDepth>=0){this.depth===this.skipDepth&&(this.skipDepth=-1),this.depth--;return}this.depth--;let t=e.trim(),n=t.indexOf(`:`);this.h.close(n<0?t:t.substring(n+1))}},pe=class extends Error{constructor(){super(`aborted`),this.name=`AbortError`}};async function me(e,t,n={}){let r=e.getReader(),i=new TextDecoder,a=new fe(t,n.raw);try{for(;;){if(n.signal?.aborted)throw new pe;let{done:e,value:t}=await r.read();if(e)break;a.write(i.decode(t,{stream:!0})),n.onChunk&&await n.onChunk(t.length)}a.write(i.decode()),a.end()}catch(e){throw r.cancel().catch(()=>{}),e}}var he=class{constructor(e={}){w(this,`o`,void 0),w(this,`root`,null),w(this,`stack`,[]),w(this,`parents`,[]),w(this,`depth`,0),w(this,`alt`,[]),this.o=e}open(e,t){if(e===`Fallback`||this.o.skip?.has(e))return!0;if(e===`AlternateContent`){this.alt.push(!1),this.stack.push(0);return}if(e===`Choice`&&this.alt.length){let e=this.alt.length-1;if(this.alt[e])return!0;this.alt[e]=!0,this.stack.push(0);return}let n=this.depth++;if(this.o.emitDepth!==void 0&&n<this.o.emitDepth){this.o.onShallowOpen?.(e,t,n),this.stack.push(1);return}let r={n:e,a:t,c:[],t:``},i=this.parents[this.parents.length-1];i&&i.c.push(r),this.parents.push(r),this.stack.push(r)}close(e){let t=this.stack.pop();t===0?e===`AlternateContent`&&this.alt.pop():(this.depth--,t!==1&&t!==void 0&&(this.parents.pop(),this.parents.length===0&&(this.o.emitDepth===void 0?this.root=t:this.o.onElement?.(t))))}text(e){let t=this.parents[this.parents.length-1];t&&(t.t+=e)}};function ge(e,t){let n=new he({skip:t}),r=new fe(n);if(r.write(e),r.end(),!n.root)throw Error(`Empty XML document`);return n.root}function D(e,t){if(e){for(let n of e.c)if(n.n===t)return n}}function O(e,t){return e?e.c.filter(e=>e.n===t):[]}function k(e,...t){let n=e;for(let e of t)if(n=D(n,e),!n)return;return n}function _e(e,t){if(e)for(let n of e.c){if(n.n===t)return n;let e=_e(n,t);if(e)return e}}function ve(e,t,n=[]){if(!e)return n;for(let r of e.c)r.n===t?n.push(r):ve(r,t,n);return n}function A(e,t){if(e===void 0||e===``)return t;let n=Number(e);return Number.isFinite(n)?n:t}function j(e,t=`val`){if(!e)return;let n=e.a[t];return n===void 0||n!==`0`&&n!==`false`&&n!==`off`&&n!==`none`}function ye(e){if(!e)return``;if(!e.c.length)return e.t;let t=``;for(let n of e.c)t+=n.n===`t`?n.t:ye(n);return t}const be={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,jpe:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`,tif:`image/tiff`,tiff:`image/tiff`,ico:`image/x-icon`,emf:`image/emf`,wmf:`image/wmf`,mp4:`video/mp4`,m4v:`video/mp4`,mov:`video/quicktime`,mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`};function xe(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return be[t]??`application/octet-stream`}function Se(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function Ce(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e?e.split(`/`):[];for(let e of t.split(`/`))e===`..`?n.pop():e&&e!==`.`&&n.push(e);return n.join(`/`)}function we(e,t){let n=e?e.split(`/`):[],r=t.split(`/`),i=0;for(;i<n.length&&i<r.length-1&&n[i]===r[i];)i++;return[...n.slice(i).map(()=>`..`),...r.slice(i)].join(`/`)}function Te(e){let t=Se(e),n=e.slice(t.length?t.length+1:0);return(t?t+`/`:``)+`_rels/`+n+`.rels`}var Ee=class{constructor(e){w(this,`zip`,void 0),w(this,`relsCache`,/* @__PURE__ */ new Map),w(this,`xmlCache`,/* @__PURE__ */ new Map),w(this,`contentTypes`,void 0),w(this,`changes`,/* @__PURE__ */ new Map),this.zip=e}has(e){let t=this.changes.get(E(e));return t?t.data!==null:this.zip.has(e)}get dirty(){return this.changes.size>0}async text(e){let t=this.changes.get(E(e));if(t){if(t.data===null)throw Error(`Missing part: ${e}`);if(typeof t.data==`string`)return t.data;if(t.data instanceof Uint8Array)return new TextDecoder().decode(t.data);throw Error(`Part ${e} is a stream`)}return this.zip.text(e)}async stream(e,t){let n=this.changes.get(E(e));if(!n)return this.zip.stream(e,t);if(n.data===null)throw Error(`Missing part: ${e}`);if(typeof n.data==`function`)return n.data();let r=typeof n.data==`string`?new TextEncoder().encode(n.data):n.data;return new ReadableStream({start(e){e.enqueue(r),e.close()}})}setPart(e,t){e=e.replace(/^\\/+/,``),this.changes.set(E(e),{path:e,data:t}),this.xmlCache.delete(e),this.relsCache.clear(),/\\[content_types\\]\\.xml$/i.test(e)&&(this.contentTypes=void 0)}async save(e){let t=/* @__PURE__ */ new Map;for(let{path:e,data:n}of this.changes.values())t.set(e,n);return se(this.zip,t,e)}async addRel(e,r,i,s=!1){let c=Te(e),u=this.has(c)?t(await this.text(c)):t(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`),f=a(u),p=new Set(o(f,`Relationship`).map(e=>l(e,`Id`))),m=p.size+1;for(;p.has(`rId${m}`);)m++;let h=`rId${m}`;return f.c.push(d(`Relationship`,s?{Id:h,Type:r,Target:i,TargetMode:`External`}:{Id:h,Type:r,Target:we(Se(e),i)})),f.self=!1,this.setPart(c,n(u)),h}async removeRelsTo(r,i){let o=Te(r);if(!this.has(o))return;let s=t(await this.text(o)),c=a(s),u=Se(r);c.c=c.c.filter(t=>!(e(t)&&Ce(u,l(t,`Target`)??``).toLowerCase()===i.toLowerCase())),this.setPart(o,n(s))}async ensureDefaultType(e,r){let i=`[Content_Types].xml`,s=t(await this.text(i)),c=a(s);o(c,`Default`).some(t=>l(t,`Extension`)?.toLowerCase()===e.toLowerCase())||(c.c.unshift(d(`Default`,{Extension:e,ContentType:r})),this.setPart(i,n(s)))}freeName(e,t,n){for(let r=1;;r++){let i=`${e}/${t}${r}.${n}`;if(!this.has(i))return i}}async setContentType(r,i){let o=`[Content_Types].xml`,s=t(await this.text(o)),c=a(s),u=`/`+r.replace(/^\\/+/,``);c.c=c.c.filter(t=>!(e(t)&&l(t,`PartName`)?.toLowerCase()===u.toLowerCase())),i&&c.c.push(d(`Override`,{PartName:u,ContentType:i})),this.setPart(o,n(s))}xml(e,t=!0){let n=async()=>this.has(e)?ge(await this.text(e),Oe):void 0;if(!t)return n();let r=this.xmlCache.get(e);return r||this.xmlCache.set(e,r=n()),r}rels(e){let t=this.relsCache.get(e);return t||(t=(async()=>{let t=/* @__PURE__ */ new Map,n=Te(e);if(!this.has(n))return t;let r=ge(await this.text(n)),i=Se(e);for(let e of O(r,`Relationship`)){let n=e.a.TargetMode===`External`,r=e.a.Target??``;t.set(e.a.Id,{id:e.a.Id,type:e.a.Type??``,external:n,target:n?r:Ce(i,r)})}return t})(),this.relsCache.set(e,t)),t}async contentType(e){this.contentTypes||(this.contentTypes=(async()=>{let e=/* @__PURE__ */ new Map;if(!this.has(`[Content_Types].xml`))return e;let t=ge(await this.text(`[Content_Types].xml`));for(let n of O(t,`Default`))e.set(`ext:`+(n.a.Extension??``).toLowerCase(),n.a.ContentType);for(let n of O(t,`Override`))e.set((n.a.PartName??``).replace(/^\\//,``).toLowerCase(),n.a.ContentType);return e})());let t=await this.contentTypes,n=e.toLowerCase();return t.get(n)??t.get(`ext:`+(n.split(`.`).pop()??``))}async blob(e){let t=this.changes.get(E(e)),n=t&&t.data!==null&&typeof t.data!=`function`?typeof t.data==`string`?new TextEncoder().encode(t.data):t.data:await this.zip.bytes(e);return new Blob([n],{type:xe(e)})}async mainPart(){let e=await this.rels(``),t;for(let n of e.values())n.type.endsWith(`/officeDocument`)&&(t=n.target);let n=[[`word/document.xml`,`docx`],[`xl/workbook.xml`,`xlsx`],[`ppt/presentation.xml`,`pptx`]];if(t||(t=n.find(([e])=>this.zip.has(e))?.[0]),!t)throw Error(`Not an Office Open XML document (no main part found)`);let r=await this.contentType(t)??``,i;if(i=r.includes(`wordprocessingml`)?`docx`:r.includes(`spreadsheetml`)?`xlsx`:r.includes(`presentationml`)?`pptx`:n.find(([e])=>t.toLowerCase().startsWith(e.split(`/`)[0]+`/`))?.[1],!i)throw Error(`Unsupported document type (${r||t})`);return{path:t,kind:i}}};function M(e,t){for(let n of e.values())if(n.type.endsWith(`/`+t))return n}function De(e,t){return[...e.values()].filter(e=>e.type.endsWith(`/`+t))}const Oe=/* @__PURE__ */ new Set([`extLst`]),ke={colors:{dk1:`#000000`,lt1:`#ffffff`,dk2:`#44546a`,lt2:`#e7e6e6`,accent1:`#4472c4`,accent2:`#ed7d31`,accent3:`#a5a5a5`,accent4:`#ffc000`,accent5:`#5b9bd5`,accent6:`#70ad47`,hlink:`#0563c1`,folHlink:`#954f72`},major:`Calibri Light`,minor:`Calibri`,fillStyles:[],bgFillStyles:[],lineStyles:[]};function Ae(e){if(!e)return ke;let t=D(e,`themeElements`),n={...ke.colors};for(let e of D(t,`clrScheme`)?.c??[]){let t=e.c[0];t&&(t.n===`srgbClr`&&t.a.val?n[e.n]=`#`+t.a.val.toLowerCase():t.n===`sysClr`&&(n[e.n]=`#`+(t.a.lastClr??(t.a.val===`window`?`ffffff`:`000000`)).toLowerCase()))}let r=D(t,`fontScheme`),i=D(t,`fmtScheme`);return{colors:n,major:k(r,`majorFont`,`latin`)?.a.typeface||ke.major,minor:k(r,`minorFont`,`latin`)?.a.typeface||ke.minor,fillStyles:D(i,`fillStyleLst`)?.c??[],bgFillStyles:D(i,`bgFillStyleLst`)?.c??[],lineStyles:O(D(i,`lnStyleLst`),`ln`)}}const je=9525,N=e=>(e??0)/je,Me=e=>(e??0)/12700,Ne={calibri:`Carlito`,cambria:`Caladea`,arial:`"Liberation Sans", Arimo`,helvetica:`"Liberation Sans", Arimo`,"times new roman":`"Liberation Serif", Tinos`,"courier new":`"Liberation Mono", Cousine`,"segoe ui":`system-ui`,"calibri light":`Carlito`,aptos:`"Segoe UI", system-ui`,"aptos display":`"Segoe UI", system-ui`},Pe=/times|cambria|georgia|garamond|book|serif|palatino|minion|baskerville|didot|caslon|mincho|song/i,Fe=/courier|mono|consolas|menlo|code/i,Ie=/* @__PURE__ */ new Map;function Le(e){if(!e)return;let t=Ie.get(e);if(t)return t;let n=e.toLowerCase(),r=Fe.test(e)?`monospace`:Pe.test(e)&&!/sans/i.test(e)?`serif`:`sans-serif`,i=Ne[n];return t=`"${e.replace(/"/g,``)}"${i?`, `+i:``}, ${r}`,Ie.set(e,t),t}const Re={yellow:`#ffff00`,green:`#00ff00`,cyan:`#00ffff`,magenta:`#ff00ff`,blue:`#0000ff`,red:`#ff0000`,darkBlue:`#000080`,darkCyan:`#008080`,darkGreen:`#008000`,darkMagenta:`#800080`,darkRed:`#800000`,darkYellow:`#808000`,darkGray:`#808080`,lightGray:`#c0c0c0`,black:`#000000`,white:`#ffffff`},ze=e=>e&&e!==`auto`&&/^[0-9a-fA-F]{6}$/.test(e)?`#`+e.toLowerCase():void 0;function Be(e){if(e)return ze(e.a.fill)??(e.a.val===`solid`?ze(e.a.color):void 0)}const Ve={single:`solid`,thick:`solid`,double:`double`,dotted:`dotted`,dashed:`dashed`,dotDash:`dashed`,dotDotDash:`dotted`,triple:`double`,thinThickSmallGap:`double`,thickThinSmallGap:`double`,wave:`solid`,dashSmallGap:`dashed`,outset:`outset`,inset:`inset`};function He(e){if(!e)return;let t=e.a.val;if(!t||t===`nil`||t===`none`)return null;let n=Math.max(.5,(A(e.a.sz)??4)/8);return{w:t===`double`?Math.max(n,2.25):n,style:Ve[t]??`solid`,color:ze(e.a.color)??`#000000`}}const Ue=e=>e===null?`none`:e?`${e.w}pt ${e.style} ${e.color}`:void 0;function We(e,t){let n=e.a.asciiTheme??e.a.hAnsiTheme;return Le(n?n.startsWith(`major`)?t.major:t.minor:e.a.ascii??e.a.hAnsi??e.a.cs??e.a.eastAsia)}function Ge(e,t){let n={};if(!e)return n;for(let r of e.c)switch(r.n){case`b`:n.b=j(r);break;case`i`:n.i=j(r);break;case`strike`:n.strike=j(r);break;case`dstrike`:n.dstrike=j(r);break;case`caps`:n.caps=j(r);break;case`smallCaps`:n.smallCaps=j(r);break;case`vanish`:n.vanish=j(r);break;case`u`:n.u=r.a.val??`single`;break;case`color`:{let e=ze(r.a.val);e&&(n.color=e);break}case`sz`:{let e=A(r.a.val);e&&(n.sz=e/2);break}case`rFonts`:{let e=We(r,t);e&&(n.font=e);break}case`highlight`:{let e=Re[r.a.val];e&&(n.hl=e);break}case`shd`:{let e=Be(r);e&&(n.shd=e);break}case`vertAlign`:n.va=r.a.val===`superscript`?`sup`:r.a.val===`subscript`?`sub`:void 0;break;case`spacing`:{let e=A(r.a.val);e&&(n.spacing=e/20);break}}return n}function Ke(e){let t={},n={ps:t};if(!e)return n;for(let r of e.c)switch(r.n){case`pStyle`:n.styleId=r.a.val;break;case`numPr`:{let e=D(r,`numId`)?.a.val;e!==void 0&&(n.numPr={numId:e,ilvl:A(D(r,`ilvl`)?.a.val,0)});break}case`jc`:{let e=r.a.val;t.align=e===`center`?`center`:e===`right`||e===`end`?`right`:e===`both`||e===`distribute`?`justify`:`left`;break}case`ind`:{let e=A(r.a.left??r.a.start),n=A(r.a.right??r.a.end);e!==void 0&&(t.indL=e/20),n!==void 0&&(t.indR=n/20);let i=A(r.a.hanging),a=A(r.a.firstLine);i===void 0?a!==void 0&&(t.indFirst=a/20):t.indFirst=-i/20;break}case`spacing`:{let e=A(r.a.before),n=A(r.a.after);r.a.beforeAutospacing===`1`||r.a.beforeAutospacing===`true`?t.before=14:e!==void 0&&(t.before=e/20),r.a.afterAutospacing===`1`||r.a.afterAutospacing===`true`?t.after=14:n!==void 0&&(t.after=n/20);let i=A(r.a.line);if(i!==void 0){let e=r.a.lineRule??`auto`;t.lineRule=e,t.line=e===`auto`?i/240:i/20}break}case`shd`:{let e=Be(r);e&&(t.shd=e);break}case`pBdr`:{let e=He(D(r,`top`)),n=He(D(r,`bottom`)),i=He(D(r,`left`)??D(r,`start`)),a=He(D(r,`right`)??D(r,`end`));e&&(t.bTop=e),n&&(t.bBottom=n),i&&(t.bLeft=i),a&&(t.bRight=a);break}case`keepNext`:t.keepNext=j(r);break;case`contextualSpacing`:t.contextual=j(r);break;case`pageBreakBefore`:t.pageBreakBefore=j(r);break;case`outlineLvl`:t.outline=A(r.a.val);break;case`sectPr`:n.sectPr=r}return n}const P=(...e)=>Object.assign({},...e.filter(Boolean)),qe={normal:`normal`,title:`title`,subtitle:`subtitle`,"heading 1":`h1`,"heading 2":`h2`,"heading 3":`h3`,"heading 4":`h4`,"heading 5":`h5`,"heading 6":`h6`,heading1:`h1`,heading2:`h2`,heading3:`h3`,heading4:`h4`,heading5:`h5`,heading6:`h6`};var Je=class{constructor(e,t){if(w(this,`theme`,void 0),w(this,`defs`,/* @__PURE__ */ new Map),w(this,`paraCache`,/* @__PURE__ */ new Map),w(this,`charCache`,/* @__PURE__ */ new Map),w(this,`tblCache`,/* @__PURE__ */ new Map),w(this,`defaultPara`,void 0),w(this,`defaultTable`,void 0),w(this,`docRs`,{}),w(this,`docPs`,{}),this.theme=t,!e)return;let n=D(e,`docDefaults`);this.docRs=Ge(k(n,`rPrDefault`,`rPr`),t),this.docPs=Ke(k(n,`pPrDefault`,`pPr`)).ps;for(let t of O(e,`style`)){let e=t.a.styleId;if(!e)continue;let n={id:e,type:t.a.type??`paragraph`,basedOn:D(t,`basedOn`)?.a.val,el:t,isDefault:t.a.default===`1`||t.a.default===`true`,name:D(t,`name`)?.a.val??e,next:D(t,`next`)?.a.val,quick:!!D(t,`qFormat`),hidden:!!D(t,`semiHidden`)||!!D(t,`hidden`)};this.defs.set(e,n),n.isDefault&&n.type===`paragraph`&&(this.defaultPara=e),n.isDefault&&n.type===`table`&&(this.defaultTable=e)}}add(e){let t=e.a.styleId;t&&(this.defs.set(t,{id:t,type:e.a.type??`paragraph`,basedOn:D(e,`basedOn`)?.a.val,el:e,isDefault:!1,name:D(e,`name`)?.a.val??t,next:D(e,`next`)?.a.val,quick:!!D(e,`qFormat`),hidden:!1}),this.paraCache.clear())}canonical(){let e={};this.defaultPara&&(e.normal=this.defaultPara);for(let t of this.defs.values()){if(t.type!==`paragraph`)continue;let n=qe[t.name.toLowerCase()]??qe[t.id.toLowerCase()];n&&!e[n]&&(e[n]=t.id)}return e}has(e){return this.defs.has(e)}quickStyles(){let e=e=>e.replace(/^heading (\\d)$/i,`Heading $1`).replace(/^\\w/,e=>e.toUpperCase()),t=this.canonical(),n=new Map(Object.entries(t).map(([e,t])=>[t,e]));return[...this.defs.values()].filter(e=>e.type===`paragraph`&&(e.isDefault||n.has(e.id)||e.quick&&!e.hidden)).map(t=>{let r=this.para(t.id),{b:i,i:a,color:o,sz:s,font:c}=r.rs;return{id:t.id,name:e(t.name),next:t.next,canon:n.get(t.id),outline:r.ps.outline,preview:{b:i,i:a,color:o,sz:s,font:c}}})}chain(e){let t=[],n=/* @__PURE__ */ new Set,r=e?this.defs.get(e):void 0;for(;r&&!n.has(r.id);)n.add(r.id),t.unshift(r),r=r.basedOn?this.defs.get(r.basedOn):void 0;return t}para(e){let t=e??this.defaultPara??``,n=this.paraCache.get(t);if(n)return n;n={ps:{},rs:{}};for(let e of this.chain(t)){let t=Ke(D(e.el,`pPr`));n.ps=P(n.ps,t.ps),t.numPr&&(n.numPr=t.numPr),n.rs=P(n.rs,Ge(D(e.el,`rPr`),this.theme))}return this.paraCache.set(t,n),n}char(e){if(!e)return{};let t=this.charCache.get(e);if(t)return t;t={};for(let n of this.chain(e))t=P(t,Ge(D(n.el,`rPr`),this.theme));return this.charCache.set(e,t),t}table(e){let t=e??this.defaultTable??``,n=this.tblCache.get(t);if(n)return n;n={ps:{},rs:{},borders:{},cellMar:{},cond:{}};for(let e of this.chain(t)){n.ps=P(n.ps,Ke(D(e.el,`pPr`)).ps),n.rs=P(n.rs,Ge(D(e.el,`rPr`),this.theme));let t=D(e.el,`tblPr`);Object.assign(n.borders,Ye(D(t,`tblBorders`))),Object.assign(n.cellMar,Xe(D(t,`tblCellMar`)));let r=Be(k(e.el,`tcPr`,`shd`));r&&(n.shd=r);for(let t of O(e.el,`tblStylePr`)){let e=t.a.type;if(!e)continue;let r=n.cond[e]??{rs:{}};n.cond[e]={rs:P(r.rs,Ge(D(t,`rPr`),this.theme)),shd:Be(k(t,`tcPr`,`shd`))??r.shd}}}return this.tblCache.set(t,n),n}};function Ye(e){let t={};if(!e)return t;for(let n of e.c){let e=n.n===`start`?`left`:n.n===`end`?`right`:n.n,r=He(n);r!==void 0&&(t[e]=r)}return t}function Xe(e){let t={};if(!e)return t;for(let n of e.c){let e=n.n===`start`?`left`:n.n===`end`?`right`:n.n,r=A(n.a.w);r!==void 0&&(n.a.type===void 0||n.a.type===`dxa`)&&(t[e]=r/20)}return t}const Ze={"":`•`,"":`▪`,"":`□`,"":`✓`,"":`➢`,"":`❖`,"":`➔`,"":`■`,"":`□`,"":`❑`,"":`◆`,"":`➔`,"":`⇨`,"":`→`,"":`–`,"·":`•`,"":`—`,"":`○`,"":`•`,"":`☑`,o:`◦`};function Qe(e){let t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function $e(e){return e<=0?``:String.fromCharCode(97+(e-1)%26).repeat(Math.floor((e-1)/26)+1)}function et(e,t){switch(t){case`decimalZero`:return e<10?`0`+e:String(e);case`upperRoman`:return Qe(e).toUpperCase();case`lowerRoman`:return Qe(e);case`upperLetter`:return $e(e).toUpperCase();case`lowerLetter`:return $e(e);case`ordinal`:{let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}case`none`:return``;case`bullet`:return``;default:return String(e)}}var tt=class{constructor(e,t){if(w(this,`abstracts`,/* @__PURE__ */ new Map),w(this,`nums`,/* @__PURE__ */ new Map),w(this,`counters`,/* @__PURE__ */ new Map),!e)return;let n=e=>{let n={};for(let r of O(e,`lvl`)){let e=A(r.a.ilvl,0);n[e]={start:A(D(r,`start`)?.a.val,1),fmt:D(r,`numFmt`)?.a.val??`decimal`,text:D(r,`lvlText`)?.a.val??``,ps:Ke(D(r,`pPr`)).ps,rs:Ge(D(r,`rPr`),t),isLgl:!!D(r,`isLgl`),suff:D(r,`suff`)?.a.val??`tab`,restart:A(D(r,`lvlRestart`)?.a.val)}}return n};for(let t of O(e,`abstractNum`))this.abstracts.set(t.a.abstractNumId,n(t));for(let t of O(e,`num`)){let e={abstractId:D(t,`abstractNumId`)?.a.val??``,starts:{},levels:{}};for(let r of O(t,`lvlOverride`)){let t=A(r.a.ilvl,0),i=A(D(r,`startOverride`)?.a.val);i!==void 0&&(e.starts[t]=i);let a=D(r,`lvl`);a&&Object.assign(e.levels,n({n:`x`,a:{},c:[{...a,a:{...a.a,ilvl:String(t)}}],t:``}))}this.nums.set(t.a.numId,e)}}reset(){this.counters.clear()}findList(e){for(let[t,n]of this.nums){if(Object.keys(n.starts).length)continue;let r=this.abstracts.get(n.abstractId)?.[0];if(r&&(e===`bullet`?r.fmt===`bullet`:r.fmt===`decimal`))return t}}ids(){let e=[...this.abstracts.keys()].map(Number).filter(Number.isFinite),t=[...this.nums.keys()].map(Number).filter(Number.isFinite);return{abstract:e.length?Math.max(...e)+1:0,num:t.length?Math.max(...t)+1:1}}level(e,t){let n=this.nums.get(e);if(n)return n.levels[t]??this.abstracts.get(n.abstractId)?.[t]}next(e,t){let n=this.nums.get(e),r=this.level(e,t);if(!n||!r)return;let i=Object.keys(n.starts).length>0?`n`+e:`a`+n.abstractId,a=this.counters.get(i);a||(a=[],this.counters.set(i,a));let o=t=>n.starts[t]??this.level(e,t)?.start??1;a[t]=a[t]===void 0?o(t):a[t]+1;for(let e=t+1;e<9;e++)a[e]=void 0;for(let e=0;e<t;e++)a[e]===void 0&&(a[e]=o(e));if(r.fmt===`bullet`){let e=r.text;return{text:Ze[e]??(e||`•`),level:r}}return{text:r.text.replace(/%(\\d)/g,(n,i)=>{let s=Number(i)-1,c=this.level(e,s);return et(a[s]??o(s),r.isLgl&&s<t?`decimal`:c?.fmt??`decimal`)}),level:r}}};const nt={w:612,h:792,mt:72,mr:72,mb:72,ml:72,header:36,footer:36};function rt(e){let t=/^\\s*(PAGE|NUMPAGES|SECTIONPAGES)\\b/i.exec(e);if(t)return t[1].toUpperCase()===`PAGE`?`PAGE`:`NUMPAGES`}function it(e,t){if(e===t)return!0;if(!e||!t)return!e&&!t;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function at(e,t){if(!e)return;let n=RegExp(`(?:^|;)\\\\s*${t}\\\\s*:\\\\s*([\\\\d.]+)\\\\s*(pt|in|px|cm|mm)?`,`i`).exec(e);if(!n)return;let r=Number(n[1]);switch((n[2]??`px`).toLowerCase()){case`pt`:return r;case`in`:return r*72;case`cm`:return r*72/2.54;case`mm`:return r*72/25.4;default:return r*.75}}function ot(e){if(!e)return{...nt};let t=D(e,`pgSz`),n=D(e,`pgMar`),r=(e,t)=>e===void 0?t:Math.abs(Number(e))/20,i=r(t?.a.w,nt.w),a=r(t?.a.h,nt.h);return t?.a.orient===`landscape`&&a>i&&([i,a]=[a,i]),{w:i,h:a,mt:r(n?.a.top,72),mr:r(n?.a.right??n?.a.end,72),mb:r(n?.a.bottom,72),ml:r(n?.a.left??n?.a.start,72),header:r(n?.a.header,36),footer:r(n?.a.footer,36)}}const st=/* @__PURE__ */ new Set([`p`,`del`,`moveFrom`,`oMath`,`oMathPara`,`pPr`,`rPr`,`r`]);function ct(e){let t=/* @__PURE__ */ new Map,n=e=>{for(let r of e.c)r.n===`r`&&t.set(r,t.size),st.has(r.n)||n(r)};return n(e),t}function lt(e,t=/* @__PURE__ */ new Map){let n=e=>{e.n===`p`&&t.set(e,t.size);for(let t of e.c)n(t)};for(let t of e)n(t);return t}function ut(e,t,n){let r=e.next(t.numId,t.ilvl);if(!r)return;let i=P(n,r.level.rs);return delete i.u,delete i.hl,{marker:{text:r.level.suff===`space`?r.text+` `:r.text,s:i,tab:r.level.suff===`tab`},lst:r.level.fmt===`bullet`?`bullet`:`number`}}var dt=class{constructor(e,t,n,r,i={}){w(this,`styles`,void 0),w(this,`numbering`,void 0),w(this,`theme`,void 0),w(this,`rels`,void 0),w(this,`hooks`,void 0),w(this,`fields`,[]),w(this,`tableLayer`,void 0),w(this,`boxDepth`,0),w(this,`tableDepth`,0),w(this,`cur`,void 0),this.styles=e,this.numbering=t,this.theme=n,this.rels=r,this.hooks=i}blocks(e,t){switch(e.n){case`p`:this.paragraph(e,t);break;case`tbl`:t.push(this.table(e));break;case`sdt`:for(let n of D(e,`sdtContent`)?.c??[])this.blocks(n,t);break;case`customXml`:case`ins`:case`smartTag`:case`sdtContent`:for(let n of e.c)this.blocks(n,t)}}paragraph(e,t){let n=D(e,`pPr`),r=Ke(n),i=this.styles.para(r.styleId),a=this.hooks.forced?.root===e?this.hooks.forced:void 0,o=a?a.layer:this.tableLayer,s=r.numPr??i.numPr,c=s&&s.numId!==`0`?this.numbering.level(s.numId,s.ilvl):void 0,l=P(this.styles.docPs,o?.ps,i.ps,c?.ps,r.ps),u=P(this.styles.docRs,o?.rs,i.rs),d=P(u,Ge(D(n,`rPr`),this.theme)),f=r.styleId??this.styles.defaultPara??``,p={t:`p`,ps:l,runs:[],markSz:d.sz,markFont:d.font,sid:f};l.pageBreakBefore&&(p.pb=!0);let m;if(c&&s){if(a)m=c.fmt===`bullet`?`bullet`:`number`,a.marker?p.marker=a.marker:p.marker={text:c.fmt===`bullet`?`•`:``,s:P(d,c.rs),tab:c.suff===`tab`};else{let e=ut(this.numbering,s,d);e&&(p.marker=e.marker,m=e.lst)}m&&(p.lst=m,p.ilvl=s.ilvl)}let h={layer:o,num:s&&s.numId!==`0`?s:void 0,ro:this.fields.length>0||this.boxDepth>0||this.tableDepth>1,sid:f,lst:m,marker:p.marker};a&&(a.rec=h);let g=a?a.pid:this.hooks.para?.(e,h);g!==void 0&&(p.pid=g);let _=this.cur;this.cur={pid:g,runs:ct(e),forced:a};let v=[p];this.inlines(e.c,u,void 0,void 0,{push:e=>{let t=p.runs,n=t[t.length-1];e.t===`text`&&n?.t===`text`&&n.href===e.href&&n.lk===e.lk&&it(n.s,e.s)&&it(n.d,e.d)?n.text+=e.text:t.push(e)},pageBreak:()=>{p={t:`p`,ps:l,runs:[],markSz:d.sz,markFont:d.font,pb:!0,sid:f},g!==void 0&&(p.pid=g),v.push(p)}}),this.cur=_,this.fields.length>0&&(h.ro=!0);for(let e of v)h.ro&&(e.ro=!0),t.push(e);r.sectPr&&t.push({t:`sect`,page:ot(r.sectPr),kind:D(r.sectPr,`type`)?.a.val??`nextPage`})}srcOf(e){let t=this.cur;if(!t)return{};let n=t.runs.get(e);if(n===void 0)return{};if(t.forced){let e=t.forced.map[n];return e?{src:e.src,d:e.d}:{}}return t.pid===void 0?{}:{src:[t.pid,n]}}inlines(e,t,n,r,i){for(let a of e)switch(a.n){case`r`:this.run(a,t,n,r,i);break;case`hyperlink`:{let e=a.a[`r:id`],o=e?this.rels.get(e)?.target:a.a.anchor?`#`+a.a.anchor:void 0,s=e?`r:`+e:a.a.anchor?`a:`+a.a.anchor:void 0;this.inlines(a.c,t,o??n,s??r,i);break}case`fldSimple`:{let e=rt(a.a.instr??``);if(e){let n=D(a,`r`);i.push({t:`field`,kind:e,s:P(t,Ge(D(n,`rPr`),this.theme)),...n?this.srcOf(n):{}})}else this.inlines(a.c,t,n,r,i);break}case`ins`:case`smartTag`:case`customXml`:case`bdo`:case`dir`:case`moveTo`:this.inlines(a.c,t,n,r,i);break;case`sdt`:this.inlines(D(a,`sdtContent`)?.c??[],t,n,r,i);break;case`oMath`:case`oMathPara`:{let e=ve(a,`t`).map(e=>e.t).join(``);e&&i.push({t:`text`,text:e,s:{...t,i:!0,font:`"Cambria Math", "STIX Two Math", serif`}});break}}}run(e,t,n,r,i){let a=D(e,`rPr`),o=P(t,this.styles.char(D(a,`rStyle`)?.a.val),Ge(a,this.theme));if(o.vanish)return;let{src:s,d:c}=this.srcOf(e),l=(e,t=o,a=n)=>i.push({t:`text`,text:e,s:t,href:a,lk:a===n?r:void 0,src:s,d:c});for(let t of e.c){let e=this.fields[this.fields.length-1];switch(t.n){case`fldChar`:{let n=t.a.fldCharType;if(n===`begin`)this.fields.push({instr:``,phase:`instr`});else if(n===`separate`&&e){e.phase=`result`,e.kind=rt(e.instr);let t=/HYPERLINK\\s+(?:\\\\l\\s+)?"([^"]+)"/.exec(e.instr);t&&(e.href=/\\\\l/.test(e.instr)?`#`+t[1]:t[1]),e.kind&&i.push({t:`field`,kind:e.kind,s:o,src:s})}else if(n===`end`){if(e&&e.phase===`instr`){let t=rt(e.instr);t&&i.push({t:`field`,kind:t,s:o,src:s})}this.fields.pop()}break}case`instrText`:e&&(e.instr+=t.t);break;case`t`:if(e&&(e.phase===`instr`||e.kind))break;t.t&&l(t.t,o,e?.href??n);break;case`tab`:case`ptab`:(!e||e.phase===`result`&&!e.kind)&&l(` `);break;case`br`:t.a.type===`page`?i.pageBreak():l(`\n`);break;case`cr`:l(`\n`);break;case`noBreakHyphen`:l(`‑`);break;case`softHyphen`:l(``);break;case`sym`:{let e=parseInt(t.a.char??``,16);e&&l(String.fromCharCode(e>=61440?e-61440:e),{...o,font:t.a.font?`"${t.a.font}", ${o.font??`serif`}`:o.font});break}case`drawing`:this.drawing(t,n,i,s);break;case`pict`:case`object`:this.vml(t,n,i,s);break;case`footnoteReference`:case`endnoteReference`:i.push({t:`ref`,text:t.a.id??`*`,s:{...o,va:`sup`},src:s})}}}target(e){if(!e)return;let t=this.rels.get(e);return t&&!t.external?t.target:void 0}boxBlocks(e){let t=[],n=this.cur;this.boxDepth++;for(let n of e)for(let e of n.c)this.blocks(e,t);return this.boxDepth--,this.cur=n,t}drawing(e,t,n,r){let i=D(e,`inline`)??D(e,`anchor`);if(!i)return;let a=D(i,`extent`),o=Me(A(a?.a.cx,0)),s=Me(A(a?.a.cy,0)),c=D(i,`docPr`),l=k(i,`graphic`,`graphicData`),u=ve(l,`txbxContent`);if(u.length){let e=this.boxBlocks(u),t=_e(l,`spPr`),i=k(t,`solidFill`,`srgbClr`)?.a.val,a=k(t,`ln`,`solidFill`,`srgbClr`)?.a.val;n.push({t:`box`,w:o,h:s,blocks:e,fill:i?`#`+i:void 0,border:a?`1px solid #${a}`:void 0,src:r});return}let d=_e(l,`blip`),f=this.target(d?.a[`r:embed`]);if(f){let e=this.rels.get(D(c,`hlinkClick`)?.a[`r:id`]??``)?.target;n.push({t:`img`,target:f,w:o,h:s,alt:c?.a.descr||c?.a.title||void 0,href:e??t,src:r,rid:d?.a[`r:embed`]})}else _e(l,`chart`)?n.push({t:`shape`,w:o,h:s,label:`Chart`,src:r}):_e(l,`relIds`)?n.push({t:`shape`,w:o,h:s,label:`Diagram`,src:r}):n.push({t:`shape`,w:0,h:0,src:r})}vml(e,t,n,r){let i=_e(e,`txbxContent`),a=(_e(e,`shape`)??_e(e,`rect`))?.a.style,o=at(a,`width`)??0,s=at(a,`height`)??0;if(i){n.push({t:`box`,w:o,h:s,blocks:this.boxBlocks([i]),src:r});return}let c=this.target(_e(e,`imagedata`)?.a[`r:id`]);c&&o&&s?n.push({t:`img`,target:c,w:o,h:s,href:t,src:r}):n.push({t:`shape`,w:0,h:0,src:r})}table(e){this.tableDepth++;try{let t=this.tableInner(e);return this.tableDepth===1&&this.hooks.item&&(t.item=this.hooks.item()),t}finally{this.tableDepth--}}tableInner(e){let t=D(e,`tblPr`),n=this.styles.table(D(t,`tblStyle`)?.a.val),r=pt(D(t,`tblLook`)),i={...n.borders,...Ye(D(t,`tblBorders`))},a={top:0,bottom:0,left:5.4,right:5.4,...n.cellMar,...Xe(D(t,`tblCellMar`))},o=O(D(e,`tblGrid`),`gridCol`).map(e=>(A(e.a.w)??0)/20),s=D(t,`jc`)?.a.val,c=D(t,`tblInd`),l=ft(e,`tr`),u=[],d=o.length;l.forEach((e,t)=>{let i=D(e,`trPr`),o=D(i,`trHeight`),s={cells:[],src:t};o?.a.val&&(s.h=Number(o.a.val)/20,s.exact=o.a.hRule===`exact`),D(i,`tblHeader`)&&(s.header=!0);let c=A(D(i,`gridBefore`)?.a.val,0),f=[];for(let[i,o]of ft(e,`tc`).entries()){let e=D(o,`tcPr`),s=Math.max(1,A(D(e,`gridSpan`)?.a.val,1)),u=D(e,`vMerge`),p=[];if(r.noVBand||p.push((c-+!!r.firstCol)%2==0?`band1Vert`:`band2Vert`),!r.noHBand){let e=t-+!!r.firstRow;e>=0&&p.push(e%2==0?`band1Horz`:`band2Horz`)}r.firstCol&&c===0&&p.push(`firstCol`),r.lastCol&&d&&c+s>=d&&p.push(`lastCol`),r.firstRow&&t===0&&p.push(`firstRow`),r.lastRow&&t===l.length-1&&p.push(`lastRow`);let m=n.shd,h={};for(let e of p){let t=n.cond[e];t&&(t.shd&&(m=t.shd),h=P(h,t.rs))}m=Be(D(e,`shd`))??m;let g=this.tableLayer;this.tableLayer={ps:n.ps,rs:P(n.rs,h)};let _=[];for(let e of o.c)e.n!==`tcPr`&&this.blocks(e,_);this.tableLayer=g;let v=Xe(D(e,`tcMar`)),y=D(e,`vAlign`)?.a.val,b=D(e,`tcW`);f.push({blocks:_,src:[t,i],colSpan:s,rowSpan:1,w:b&&(b.a.type??`dxa`)===`dxa`?Number(b.a.w)/20:void 0,shd:m,vAlign:y===`center`?`middle`:y===`bottom`?`bottom`:void 0,borders:{},pad:[v.top??a.top,v.right??a.right,v.bottom??a.bottom,v.left??a.left],gs:c,vm:u?u.a.val===`restart`?`restart`:`continue`:void 0,tcB:Ye(D(e,`tcBorders`)),ri:t}),c+=s}d=Math.max(d,c),u.push({row:s,cells:f})});for(let e=0;e<u.length;e++)for(let t of u[e].cells)if(!t.gone&&t.vm)for(let n=e+1;n<u.length;n++){let e=u[n].cells.find(e=>e.gs===t.gs);if(!e||e.vm!==`continue`)break;e.gone=!0,t.rowSpan++}let f=u.length;return{t:`tbl`,cols:o,rows:u.map(({row:e,cells:t})=>{for(let n of t){if(n.gone)continue;let t=n.ri+n.rowSpan-1==f-1,r={t:Ue(n.tcB.top===void 0?n.ri===0?i.top:i.insideH:n.tcB.top),b:Ue(n.tcB.bottom===void 0?t?i.bottom:i.insideH:n.tcB.bottom),l:Ue(n.tcB.left===void 0?n.gs===0?i.left:i.insideV:n.tcB.left),r:Ue(n.tcB.right===void 0?n.gs+n.colSpan>=d?i.right:i.insideV:n.tcB.right)},{gs:a,vm:o,tcB:s,gone:c,ri:l,...u}=n;e.cells.push({...u,borders:r})}return e}),align:s===`center`?`center`:s===`right`||s===`end`?`right`:void 0,indL:c&&(c.a.type??`dxa`)===`dxa`?Number(c.a.w)/20:void 0}}};function ft(e,t){let n=[];for(let r of e.c)r.n===t?n.push(r):r.n===`sdt`?n.push(...ft(D(r,`sdtContent`)??r,t)):(r.n===`customXml`||r.n===`sdtContent`)&&n.push(...ft(r,t));return n}function pt(e){let t={firstRow:!0,lastRow:!1,firstCol:!0,lastCol:!1,noHBand:!1,noVBand:!0};if(!e)return t;let n=e.a.val;if(n&&/^[0-9a-fA-F]+$/.test(n)&&e.a.firstRow===void 0){let e=parseInt(n,16);return{firstRow:!!(e&32),lastRow:!!(e&64),firstCol:!!(e&128),lastCol:!!(e&256),noHBand:!!(e&512),noVBand:!!(e&1024)}}let r=(t,n)=>e.a[t]===void 0?n:e.a[t]===`1`||e.a[t]===`true`;return{firstRow:r(`firstRow`,!0),lastRow:r(`lastRow`,!1),firstCol:r(`firstColumn`,!0),lastCol:r(`lastColumn`,!1),noHBand:r(`noHBand`,!1),noVBand:r(`noVBand`,!0)}}var mt=class{constructor(e,t){w(this,`tb`,void 0),w(this,`onItem`,void 0),w(this,`prefix`,``),w(this,`items`,[]),w(this,`suffix`,``),w(this,`buf`,``),w(this,`tail`,``),w(this,`pending`,``),w(this,`inItem`,!1),w(this,`depth`,0),w(this,`els`,[]),w(this,`raw`,e=>{this.flush(),this.pending=e}),w(this,`element`,e=>{this.els.push(e)}),this.tb=e,this.onItem=t}flush(){this.pending&&(this.inItem?this.buf+=this.pending:this.tail+=this.pending,this.pending=``)}open(e,t){this.depth===2&&(this.items.length?this.items[this.items.length-1]+=this.tail:this.prefix+=this.tail,this.tail=``,this.inItem=!0,this.buf=``,this.els=[]),this.flush();let n=this.tb.open(e,t);return n||this.depth++,n}close(e){this.flush(),this.tb.close(e),this.depth--,this.depth===2&&this.inItem&&(this.inItem=!1,this.items.push(this.buf),this.buf=``,this.onItem(this.items.length-1,this.els),this.els=[])}text(e){this.flush(),this.tb.text(e)}finish(){this.flush(),this.items.length?this.suffix=this.tail:this.prefix+=this.tail,this.tail=``}},ht=class e{constructor(e,t,n,r,i,a){w(this,`pkg`,void 0),w(this,`mainPath`,void 0),w(this,`rels`,void 0),w(this,`styles`,void 0),w(this,`numbering`,void 0),w(this,`theme`,void 0),w(this,`items`,[]),w(this,`prefix`,``),w(this,`suffix`,``),w(this,`info`,/* @__PURE__ */ new Map),w(this,`origLoc`,/* @__PURE__ */ new Map),w(this,`ordPid`,/* @__PURE__ */ new Map),w(this,`itemParas`,/* @__PURE__ */ new Map),w(this,`groups`,/* @__PURE__ */ new Map),w(this,`genXml`,/* @__PURE__ */ new Map),w(this,`itemXml`,/* @__PURE__ */ new Map),w(this,`nextPid`,1),w(this,`captured`,!1),w(this,`edited`,!1),this.pkg=e,this.mainPath=t,this.rels=n,this.styles=r,this.numbering=i,this.theme=a}static async open(t,n){let r=await t.rels(n),i=M(r,`theme`),a=Ae(i?await t.xml(i.target):void 0),o=M(r,`styles`),s=M(r,`numbering`),c=new Je(o?await t.xml(o.target):void 0,a),l=new tt(s?await t.xml(s.target):void 0,a);return new e(t,n,r,c,l,a)}get dirty(){return this.edited||this.pkg.dirty}markEdited(){this.edited=!0}async headerFooter(e){let t=e?this.rels.get(e):void 0;if(!t)return;let n=await this.pkg.xml(t.target);if(!n)return;let r=new dt(this.styles,this.numbering,this.theme,await this.pkg.rels(t.target)),i=[];for(let e of n.c)r.blocks(e,i);return i}async stream(e){let t=0,n=/* @__PURE__ */ new Map,r=new dt(this.styles,this.numbering,this.theme,this.rels,{item:()=>t,para:(e,r)=>{let i=n.get(e);if(i===void 0)return;let a=this.nextPid++,o=r;o.item=t,o.ord=i,this.info.set(a,o),this.origLoc.set(a,{item:t,ord:i}),this.ordPid.set(`${t}:${i}`,a);let s=this.itemParas.get(t);return s||this.itemParas.set(t,s=[]),s[i]=a,a}}),i={font:this.styles.docRs.font??`"Times New Roman", serif`,sz:this.styles.docRs.sz??10,styles:this.styles.quickStyles()},a=[],o,s,c=Date.now(),l=e.initialHoldMs??350,u=0,d=!0,f=(e,i)=>{t=e,n=lt(i);for(let e of i){if(e.n===`sectPr`){o=e;continue}let t=a.length;if(r.blocks(e,a),!s)for(let e=t;e<a.length;e++){let t=a[e];t.t===`sect`&&(s=t.page)}}},p;p=new mt(new he({emitDepth:2,onElement:e=>p.element(e)}),f);let m=()=>{a.length&&(e.onBlocks(a),a=[],u=Date.now())};await me(await this.pkg.zip.stream(this.mainPath,e.onProgress),p,{signal:e.signal,raw:p.raw,onChunk:async()=>{let t=Date.now();if(d){if(t-c<l)return;d=!1,e.onMeta({page:s??{...nt},...i}),m()}else(a.length>=400||a.length&&t-u>120)&&(m(),await new Promise(e=>setTimeout(e,0)))}}),p.finish(),this.items=p.items,this.prefix=p.prefix,this.suffix=p.suffix,this.captured=!0;let h=o,g={page:ot(h),...i,final:!0};if(h){let e=(e,t)=>O(h,e).find(e=>(e.a.type??`default`)===t)?.a[`r:id`];g.header=await this.headerFooter(e(`headerReference`,`default`)),g.footer=await this.headerFooter(e(`footerReference`,`default`)),g.titlePg=!!D(h,`titlePg`)&&D(h,`titlePg`)?.a.val!==`0`,g.titlePg&&(g.firstHeader=await this.headerFooter(e(`headerReference`,`first`)),g.firstFooter=await this.headerFooter(e(`footerReference`,`first`)))}e.onMeta(g),m()}get ready(){return this.captured}reconvert(e,t,n,r,i){let a=ge(t),o={pid:e,root:a,map:n,layer:r,marker:i},s=new dt(this.styles,this.numbering,this.theme,this.rels,{forced:o}),c=[];return s.paragraph(a,c),{blocks:c,rec:o.rec}}recomputeMarkers(){let e=/* @__PURE__ */ new Map;this.numbering.reset();let t=[...this.itemParas.keys()].sort((e,t)=>e-t);for(let n of t){let t=this.itemParas.get(n);for(let r=0;r<t.length;r++){let i=t[r];if(i===void 0)continue;let a=this.groups.get(`${n}:${r}`)??[i];for(let t of a){let n=this.info.get(t);if(!n)continue;let r,i;if(n.num){let e=n.marker?.s??{},t=ut(this.numbering,n.num,e);t&&(r={...t.marker,s:n.marker?.s??t.marker.s},i=t.lst)}((r?.text??null)!==(n.marker?.text??null)||i!==n.lst)&&(n.marker=r,n.lst=i,e.set(t,n))}}}return e}};const gt=/* @__PURE__ */ `pStyle.keepNext.keepLines.pageBreakBefore.framePr.widowControl.numPr.suppressLineNumbers.pBdr.shd.tabs.suppressAutoHyphens.kinsoku.wordWrap.overflowPunct.topLinePunct.autoSpaceDE.autoSpaceDN.bidi.adjustRightInd.snapToGrid.spacing.ind.contextualSpacing.mirrorIndents.suppressOverlap.jc.textDirection.textAlignment.textboxTightWrap.outlineLvl.divId.cnfStyle.rPr.sectPr.pPrChange`.split(`.`),_t=/* @__PURE__ */ `rStyle.rFonts.b.bCs.i.iCs.caps.smallCaps.strike.dstrike.outline.shadow.emboss.imprint.noProof.snapToGrid.vanish.webHidden.color.spacing.w.kern.position.sz.szCs.highlight.u.effect.bdr.shd.fitText.vertAlign.rtl.cs.em.lang.eastAsianLayout.specVanish.oMath`.split(`.`),vt=/* @__PURE__ */ new Set([`bookmarkStart`,`commentRangeStart`,`permStart`,`moveFromRangeStart`,`moveToRangeStart`]),yt=/* @__PURE__ */ new Set([`bookmarkEnd`,`commentRangeEnd`,`permEnd`,`moveFromRangeEnd`,`moveToRangeEnd`]),bt=/* @__PURE__ */ new Set([`p`,`del`,`moveFrom`,`oMath`,`oMathPara`,`pPr`,`rPr`,`r`]),xt=Object.fromEntries(Object.entries(Re).map(([e,t])=>[t,e]));function St(t){let n=[];return t.forEach((i,a)=>{e(i)&&(r(i.q)===`p`&&n.push({node:i,list:t,index:a}),v(i,(e,t,i)=>{r(e.q)===`p`&&n.push({node:e,list:t.c,index:i})}))}),n}function Ct(e){let t=[];return v(e,e=>{let n=r(e.q);return n===`r`&&t.push(e),bt.has(n)}),t}const wt=/* @__PURE__ */ new WeakMap;function Tt(e,n){let r=wt.get(e);r||wt.set(e,r=/* @__PURE__ */ new Map);let i=r.get(n);return i||(i=St(t(e.items[n]??``)),r.size>64&&r.delete(r.keys().next().value),r.set(n,i)),i}function Et(e,t){let n=e.origLoc.get(t);if(n)return Tt(e,n.item)[n.ord]?.node}const Dt=/* @__PURE__ */ new WeakMap;function Ot(e,t){if(!t)return;let n=Et(e,t[0]);if(!n)return;let r=Dt.get(n);return r||Dt.set(n,r=Ct(n)),r[t[1]]}function kt(e,t,n){let r=n+`val`,i=(t,n)=>m(e,n,t,_t),a=(e,t)=>i(e,t?d(n+e):d(n+e,{[r]:`0`}));if(t.b!==void 0&&(a(`b`,t.b),a(`bCs`,t.b)),t.i!==void 0&&(a(`i`,t.i),a(`iCs`,t.i)),t.strike!==void 0&&(a(`strike`,t.strike),t.strike&&i(`dstrike`,void 0)),t.u!==void 0&&i(`u`,d(n+`u`,{[r]:t.u&&t.u!==`none`?t.u:`none`})),`color`in t&&i(`color`,t.color?d(n+`color`,{[r]:t.color.replace(`#`,``).toUpperCase()}):void 0),t.sz!==void 0){let e=String(Math.round(t.sz*2));i(`sz`,d(n+`sz`,{[r]:e})),i(`szCs`,d(n+`szCs`,{[r]:e}))}if(t.font!==void 0){let e=t.font;i(`rFonts`,d(n+`rFonts`,{[n+`ascii`]:e,[n+`hAnsi`]:e,[n+`eastAsia`]:e,[n+`cs`]:e}))}if(`hl`in t){let e=t.hl?xt[t.hl.toLowerCase()]:void 0;t.hl?e?i(`highlight`,d(n+`highlight`,{[r]:e})):i(`shd`,d(n+`shd`,{[r]:`clear`,[n+`color`]:`auto`,[n+`fill`]:t.hl.replace(`#`,``).toUpperCase()})):(i(`highlight`,void 0),i(`shd`,void 0))}`va`in t&&i(`vertAlign`,t.va?d(n+`vertAlign`,{[r]:t.va===`sup`?`superscript`:`subscript`}):void 0)}function At(e,t){let n=``;for(let r of e.split(/(\\t|\\n)/))r&&(n+=r===` `?`<${t}tab/>`:r===`\n`?`<${t}br/>`:`<${t}t xml:space="preserve">${h(r)}</${t}t>`);return n}function jt(e,t,n){let r=[`•`,`◦`,`▪`],i=[`decimal`,`lowerLetter`,`lowerRoman`],a=``;for(let t=0;t<9;t++){let o=n===`bullet`?`bullet`:i[t%3],s=n===`bullet`?r[t%3]:`%${t+1}.`;a+=`<${e}lvl ${e}ilvl="${t}"><${e}start ${e}val="1"/><${e}numFmt ${e}val="${o}"/><${e}lvlText ${e}val="${s}"/><${e}lvlJc ${e}val="left"/><${e}pPr><${e}ind ${e}left="${720*(t+1)}" ${e}hanging="360"/></${e}pPr></${e}lvl>`}return`<${e}abstractNum ${e}abstractNumId="${t}"><${e}multiLevelType ${e}val="hybridMultilevel"/>${a}</${e}abstractNum>`}function Mt(e,t){let n=e=>`<${t}sz ${t}val="${e}"/><${t}szCs ${t}val="${e}"/>`,r=e=>`<${t}color ${t}val="${e}"/>`;if(e===`title`)return{id:`Title`,name:`Title`,ppr:`<${t}spacing ${t}after="80" ${t}line="240" ${t}lineRule="auto"/><${t}contextualSpacing/>`,rpr:`<${t}spacing ${t}val="-10"/><${t}kern ${t}val="28"/>${n(56)}`};if(e===`subtitle`)return{id:`Subtitle`,name:`Subtitle`,ppr:`<${t}spacing ${t}after="160"/>`,rpr:`${r(`5A5A5A`)}<${t}spacing ${t}val="15"/>${n(28)}`};let i=Number(e.slice(1)),[a,o,s,c]={1:[240,32,`2F5496`,!1],2:[40,26,`2F5496`,!1],3:[40,24,`1F3763`,!1],4:[40,22,`2F5496`,!0],5:[40,22,`2F5496`,!1],6:[40,22,`1F3763`,!0]}[i];return{id:`Heading${i}`,name:`heading ${i}`,ppr:`<${t}keepNext/><${t}keepLines/><${t}spacing ${t}before="${a}" ${t}after="0"/><${t}outlineLvl ${t}val="${i-1}"/>`,rpr:`${c?`<${t}i/><${t}iCs/>`:``}${r(s)}${n(o)}`}}async function Nt(e,r){let o=e.styles.canonical()[r];if(o||r===`normal`)return{id:o??``,styles:e.styles.quickStyles()};let s=M(e.rels,`styles`),c=s?.target??`word/styles.xml`,l=t(e.pkg.has(c)?await e.pkg.text(c):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:styles>`),u=a(l),d=i(u.q),f=Mt(r,d),p=f.id;for(let t=2;e.styles.has(p);t++)p=f.id+t;let m=e.styles.defaultPara,h=m?`<${d}basedOn ${d}val="${m}"/><${d}next ${d}val="${m}"/>`:``,g=`<${d}style ${d}type="paragraph" ${d}styleId="${p}"><${d}name ${d}val="${f.name}"/>${h}<${d}uiPriority ${d}val="9"/><${d}qFormat/><${d}pPr>${f.ppr}</${d}pPr><${d}rPr>${f.rpr}</${d}rPr></${d}style>`;u.c.push(t(g)[0]),u.self=!1,e.pkg.setPart(c,n(l)),s||(await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,c),await e.pkg.setContentType(c,`application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml`),e.rels=await e.pkg.rels(e.mainPath));let _=ge(d?g.replace(`<${d}style `,`<${d}style xmlns:${d.slice(0,-1)}="http://schemas.openxmlformats.org/wordprocessingml/2006/main" `):g);return _&&e.styles.add(_),e.markEdited(),{id:p,styles:e.styles.quickStyles()}}async function Pt(o,s){let c=o.numbering.findList(s);if(c)return c;let l=M(o.rels,`numbering`),u=l?.target??`word/numbering.xml`,d=t(o.pkg.has(u)?await o.pkg.text(u):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:numbering>`),f=a(d),p=i(f.q),{abstract:m,num:h}=o.numbering.ids(),g=t(jt(p,m,s))[0],_=t(`<${p}num ${p}numId="${h}"><${p}abstractNumId ${p}val="${m}"/></${p}num>`)[0],v=(t,n)=>{let i=-1;return f.c.forEach((a,o)=>{e(a)&&r(a.q)===t&&(n||i<0)&&(i=o)}),i},y=v(`abstractNum`,!0),b=v(`num`,!1);f.c.splice(y>=0?y+1:b>=0?b:f.c.length,0,g);let x=v(`num`,!0),S=v(`numIdMacAtCleanup`,!1);f.c.splice(x>=0?x+1:S>=0?S:f.c.length,0,_),f.self=!1;let C=n(d);return o.pkg.setPart(u,C),l||(await o.pkg.addRel(o.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering`,u),await o.pkg.setContentType(u,`application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml`),o.rels=await o.pkg.rels(o.mainPath)),o.numbering=new tt(ge(C),o.theme),String(h)}async function Ft(e,t,n,r){let i=r+`val`,a=(e,n)=>m(t,n,e,gt);if(n.style!==void 0&&a(`pStyle`,n.style&&n.style!==e.styles.defaultPara?d(r+`pStyle`,{[i]:n.style}):void 0),n.align&&a(`jc`,d(r+`jc`,{[i]:n.align===`justify`?`both`:n.align})),n.line!==void 0||n.before!==void 0||n.after!==void 0){let e=f(s(t,`spacing`)??d(r+`spacing`));n.before!==void 0&&(u(e,r+`before`,String(Math.round(n.before*20))),u(e,r+`beforeAutospacing`,void 0)),n.after!==void 0&&(u(e,r+`after`,String(Math.round(n.after*20))),u(e,r+`afterAutospacing`,void 0)),n.line!==void 0&&(u(e,r+`line`,String(Math.round(n.line*240))),u(e,r+`lineRule`,`auto`)),a(`spacing`,e)}if(n.pageBreak!==void 0&&a(`pageBreakBefore`,n.pageBreak?d(r+`pageBreakBefore`):void 0),n.indL!==void 0){let e=f(s(t,`ind`)??d(r+`ind`));u(e,r+`start`,void 0),u(e,r+`left`,String(Math.max(0,Math.round(n.indL*20)))),a(`ind`,e)}let o=e.styles.para(Lt(t)).numPr,c=(e,t)=>d(r+`numPr`,{},[d(r+`ilvl`,{[i]:String(t)}),d(r+`numId`,{[i]:e})]);if(n.list===`none`)a(`numPr`,o?c(`0`,0):void 0);else if(n.list)a(`numPr`,c(await Pt(e,n.list),n.ilvl??0));else if(n.ilvl!==void 0){let e=s(t,`numPr`),r=(e&&It(s(e,`numId`),i))??o?.numId;r&&r!==`0`&&a(`numPr`,c(r,n.ilvl))}}function It(e,t){if(e)return RegExp(`(?:^|\\\\s)${t.replace(`:`,`\\\\:`)}="([^"]*)"`).exec(e.a)?.[1]}function Lt(e){let t=s(e,`pStyle`);return t?/="([^"]*)"/.exec(t.a)?.[1]:void 0}async function Rt(e,t){let a=Et(e,t.from),c=a?.q??`w:p`,l=i(c)||`w:`,m=f(s(a,`pPr`)??d(l+`pPr`));t.pd&&await Ft(e,m,t.pd,l),(t.keepSect??t.pid===t.from)||p(m,`sectPr`);let g=s(m,`rPr`),_=[],y=``,b,x=()=>{b!==void 0&&(y+=`</${l}hyperlink>`),b=void 0},S=(e,t)=>`<${l}r>${e&&e.c.length?n(e):``}${t}</${l}r>`,C=t=>{let n=s(Ot(e,t),`rPr`)??g;if(!n)return;let r=f(n);return r.q=l+`rPr`,p(r,e=>e===`rPrChange`||e===`ins`||e===`del`||e===`moveFrom`||e===`moveTo`),r};t.parts.forEach((t,i)=>{i>0&&(x(),y+=`<${l}r><${l}br ${l}type="page"/></${l}r>`,_.push({}));for(let i of t){if(`obj`in i){if(x(),i.obj===`field`){let e=C(void 0);i.set&&kt(e??(e=d(l+`rPr`)),i.set,l),y+=`<${l}fldSimple ${l}instr=" ${i.kind} ">${S(e,`<${l}t>1</${l}t>`)}</${l}fldSimple>`,_.push({d:i.set})}else if(i.obj===`image`)y+=Ut(l,i.rid,i.w,i.h,i.name,i.alt),_.push({});else{let t=Ot(e,i.src);if(t){if(i.size||i.alt!==void 0||i.rid){let e=f(t),a=i.size&&String(Math.round(i.size[0]*12700)),o=i.size&&String(Math.round(i.size[1]*12700));v(e,e=>{let t=r(e.q);if(a&&o&&(t===`extent`||t===`ext`&&/\\scx=/.test(e.a))&&(u(e,`cx`,a),u(e,`cy`,o)),i.alt!==void 0&&(t===`docPr`||t===`cNvPr`&&/\\sid=/.test(e.a))&&u(e,`descr`,i.alt||void 0),i.rid&&t===`blip`){let t=/([\\w.-]+):embed="/.exec(e.a);u(e,t?`${t[1]}:embed`:`r:embed`,i.rid)}}),y+=n(e)}else y+=n(t);_.push({src:i.src})}}continue}if(i.lk!==b&&(x(),i.lk)){let e=i.lk.startsWith(`r:`)?`r:id="${i.lk.slice(2)}"`:`${l}anchor="${h(i.lk.slice(2))}"`;y+=`<${l}hyperlink ${e}>`,b=i.lk}let t=C(i.src);i.set&&Object.keys(i.set).length&&kt(t??(t=d(l+`rPr`)),i.set,l),i.text&&(y+=S(t,At(i.text,l)),_.push({src:i.src,d:i.set}))}}),x();let w=``,T=``,ee=t.orig??(t.pid===t.from?[t.from]:[]);for(let t of ee){let i=Et(e,t);if(i){for(let e of o(i)){let t=r(e.q);vt.has(t)?w+=n(e):yt.has(t)&&(T+=n(e))}for(let e of Ct(i))s(e,`commentReference`)&&(T+=n(e),_.push({}))}}let E=a?.a??``;t.pid!==t.from&&(E=E.replace(/\\s+w14:(paraId|textId)="[^"]*"/g,``));let te=m.c.length?n(m):``;return{xml:`<${c}${E}>${te}${w}${y}${T}</${c}>`,map:_}}function zt(e,t){let n=e.groups.get(t);if(!n){let r=e.ordPid.get(t);n=r===void 0?[]:[r],e.groups.set(t,n)}return n}function Bt(e,t){let n=e.info.get(t);if(!n)return;let r=zt(e,`${n.item}:${n.ord}`),i=r.indexOf(t);i>=0&&r.splice(i,1)}async function Vt(e,t){if(!e.ready)throw Error(`Document is still loading`);let r=e.info.get(t.anchor);if(!r)throw Error(`Unknown paragraph ${t.anchor}`);e.markEdited();let i=[t.anchor,...t.list.map(e=>e.pid),...t.remove??[]],a=t.list.some(e=>e.pd)||i.some(t=>e.info.get(t)?.num),o=r.item,s=r.ord,c=t.list.map(e=>e.pid);for(let n of[...c,...t.remove??[]])n!==t.anchor&&Bt(e,n);let l=zt(e,`${o}:${s}`),u=l.indexOf(t.anchor);if(u<0)throw Error(`Paragraph ${t.anchor} is not in the document`);l.splice(u,1,...c);for(let n of[t.anchor,...t.remove??[]])c.includes(n)||e.genXml.delete(n);let d={};for(let i of t.list){let a=e.info.get(i.from)??r,c=e.info.get(i.pid),l,u,f=i.pristine&&i.pid===i.from?Et(e,i.pid):void 0;f?(l=n(f),u=Ct(f).map((e,t)=>({src:[i.pid,t]}))):{xml:l,map:u}=await Rt(e,i),e.genXml.set(i.pid,l);let{blocks:p,rec:m}=e.reconvert(i.pid,l,u,a.layer,c?.marker);e.info.set(i.pid,{...m,item:o,ord:s,marker:c?.marker,lst:c?.lst}),t.want&&(d[i.pid]=p)}let f=a||t.list.some(t=>e.info.get(t.pid)?.num)?e.recomputeMarkers():/* @__PURE__ */ new Map,p={};for(let[e,t]of f)p[e]=t.marker?{...t.marker,lst:t.lst}:null;for(let[t,n]of Object.entries(d)){let r=e.info.get(Number(t));n.filter(e=>e.t===`p`).forEach((e,t)=>{delete e.marker,delete e.lst,t===0&&r?.marker&&(e.marker=r.marker,e.lst=r.lst)})}return{blocks:d,markers:p}}let Ht=7e3;function Ut(e,t,n,r,i=`Picture`,a){let o=Math.round(n*12700),s=Math.round(r*12700),c=++Ht,l=`http://schemas.openxmlformats.org/drawingml/2006/main`,u=`http://schemas.openxmlformats.org/drawingml/2006/picture`,d=h(i),f=a?` descr="${h(a).replace(/"/g,`"`)}"`:``;return`<${e}r><${e}drawing><wp:inline xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${o}" cy="${s}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:docPr id="${c}" name="${d} ${c}"${f}/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="${l}" noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic xmlns:a="${l}"><a:graphicData uri="${u}"><pic:pic xmlns:pic="${u}"><pic:nvPicPr><pic:cNvPr id="${c}" name="${d}"${f}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${t}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${o}" cy="${s}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></${e}drawing></${e}r>`}const Wt={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`};async function Gt(e,t,n){if(n=n.toLowerCase().replace(`jpeg`,`jpg`),!Wt[n])throw Error(`Unsupported image type .${n}`);let r=e.pkg.freeName(`word/media`,`image`,n);e.pkg.setPart(r,t),await e.pkg.ensureDefaultType(n,Wt[n]);let i=await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,r);return e.rels=await e.pkg.rels(e.mainPath),e.markEdited(),{rid:i,path:r}}async function Kt(e,t){let n=await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,t,!0);return e.rels=await e.pkg.rels(e.mainPath),`r:`+n}const qt=[`cnfStyle`,`tcW`,`gridSpan`,`hMerge`,`vMerge`,`tcBorders`,`shd`,`noWrap`,`tcMar`,`textDirection`,`tcFitText`,`vAlign`,`hideMark`];function Jt(e){let t=[],n=e=>{for(let i of o(e)){let e=r(i.q);e===`tr`?t.push(i):(e===`sdt`||e===`sdtContent`||e===`customXml`)&&n(i)}};return n(e),t}function Yt(e){let t=[],n=e=>{for(let i of o(e)){let e=r(i.q);e===`tc`?t.push(i):(e===`sdt`||e===`sdtContent`||e===`customXml`)&&n(i)}};return n(e),t}async function Xt(e,o){let c;if(o.item!==void 0){let n=a(t(e.items[o.item]??``));n&&(r(n.q)===`tbl`?c=n:v(n,e=>(!c&&r(e.q)===`tbl`&&(c=e),!!c)))}let l=c&&i(c.q)||`w:`,u=l+`val`,h=c?Jt(c):[],g=c?s(c,`tblPr`):void 0;if(!g){let n=e.styles.has(`TableGrid`)?`<${l}tblStyle ${u}="TableGrid"/>`:``;g=t(`<${l}tblPr>${n}<${l}tblW ${l}w="0" ${l}type="auto"/>${n?``:`<${l}tblBorders>${[`top`,`left`,`bottom`,`right`,`insideH`,`insideV`].map(e=>`<${l}${e} ${u}="single" ${l}sz="4" ${l}space="0" ${l}color="auto"/>`).join(``)}</${l}tblBorders>`}<${l}tblLook ${u}="04A0" ${l}firstRow="1" ${l}lastRow="0" ${l}firstColumn="1" ${l}lastColumn="0" ${l}noHBand="0" ${l}noVBand="1"/></${l}tblPr>`)[0]}let _=`<${l}tblGrid>${o.cols.map(e=>`<${l}gridCol ${l}w="${Math.round(e*20)}"/>`).join(``)}</${l}tblGrid>`,y=h.length?s(Yt(h[0])[0],`tcPr`):void 0,b=o.cols.length,x=[],S=`<${l}tbl${c?.a??``}>${n(g)}${_}`,C=(e,t,r,i,a)=>{let c=f((e?s(Yt(h[e[0]]??{c:[]})[e[1]],`tcPr`):void 0)??y??d(l+`tcPr`));c.q=l+`tcPr`,p(c,e=>e===`gridSpan`||e===`vMerge`||e===`hMerge`);let g=o.cols.slice(t,t+r).reduce((e,t)=>e+t,0);return m(c,d(l+`tcW`,{[l+`w`]:String(Math.round(g*20)),[l+`type`]:`dxa`}),`tcW`,qt),r>1&&m(c,d(l+`gridSpan`,{[u]:String(r)}),`gridSpan`,qt),i&&m(c,d(l+`vMerge`,i===`restart`?{[u]:`restart`}:{}),`vMerge`,qt),a!==void 0&&m(c,a?d(l+`shd`,{[u]:`clear`,[l+`color`]:`auto`,[l+`fill`]:a.replace(`#`,``).toUpperCase()}):void 0,`shd`,qt),n(c)};for(let t of o.rows){let r=t.src===void 0?void 0:h[t.src],i=s(r,`trPr`);S+=`<${l}tr${r?.a??``}>${i?n(i):``}`;let a=0,o=0,c=t.cells;for(;a<b&&(o<c.length||x[a]);){let t=x[a];if(t&&t.left>0){S+=`<${l}tc>${t.tcPr,``}${C(void 0,a,t.span,`continue`)}<${l}p/></${l}tc>`,t.left--,t.left||(x[a]=void 0),a+=t.span;continue}let r=c[o++];if(!r)break;let i=Math.max(1,Math.min(r.colSpan,b-a)),s=``;for(let t of r.paras){let r=t.pristine&&t.pid===t.from?Et(e,t.pid):void 0;s+=r?n(r):(await Rt(e,t)).xml}S+=`<${l}tc>${C(r.src,a,i,r.rowSpan>1?`restart`:void 0,r.shd)}${s||`<${l}p/>`}</${l}tc>`,r.rowSpan>1&&(x[a]={left:r.rowSpan-1,span:i}),a+=i}S+=`</${l}tr>`}return S+`</${l}tbl>`}async function Zt(e,t){if(!e.ready)throw Error(`Document is still loading`);e.markEdited();let n=t.spec?await Xt(e,t.spec):``;if(t.item!==void 0){e.itemXml.set(t.item,n);return}let r;for(let[n,i]of e.groups)i.includes(t.tid)&&(r=n);if(!t.spec)r&&e.groups.get(r).splice(e.groups.get(r).indexOf(t.tid),1),e.genXml.delete(t.tid);else{if(!r){let n=t.anchor===void 0?void 0:e.info.get(t.anchor);if(!n||t.anchor===void 0)throw Error(`Table anchor paragraph not found`);let r=zt(e,`${n.item}:${n.ord}`);r.splice(r.indexOf(t.anchor)+1,0,t.tid)}e.genXml.set(t.tid,n)}}async function Qt(e){if(!e.ready)throw Error(`Document is still loading`);if(e.groups.size||e.itemXml.size){let r=/* @__PURE__ */ new Set;for(let t of e.groups.keys())r.add(Number(t.split(`:`)[0]));let i=[e.prefix];for(let a=0;a<e.items.length;a++){let o=e.itemXml.get(a);if(o!==void 0){i.push(o+(/\\s*$/.exec(e.items[a])?.[0]??``));continue}if(!r.has(a)){i.push(e.items[a]);continue}let s=t(e.items[a]),c=St(s);for(let t=0;t<c.length;t++){let r=e.groups.get(`${a}:${t}`);if(!r)continue;let i=c[t];i.list[i.index]=r.map(t=>e.genXml.get(t)??(Et(e,t)?n(Et(e,t)):``)).join(``)}i.push(n(s))}i.push(e.suffix),e.pkg.setPart(e.mainPath,i.join(``))}return e.pkg.save(`application/vnd.openxmlformats-officedocument.wordprocessingml.document`)}function $t(e){let t=e.replace(`#`,``),n=t.length===8?t.slice(2):t.padStart(6,`0`).slice(0,6);return[parseInt(n.slice(0,2),16)||0,parseInt(n.slice(2,4),16)||0,parseInt(n.slice(4,6),16)||0]}function en([e,t,n]){let r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`);return`#`+r(e)+r(t)+r(n)}function tn([e,t,n]){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2;if(r===i)return[0,0,a];let o=r-i,s=a>.5?o/(2-r-i):o/(r+i),c=0;return c=r===e?(t-n)/o+(t<n?6:0):r===t?(n-e)/o+2:(e-t)/o+4,[c/6,s,a]}function nn([e,t,n]){if(t===0)return[n*255,n*255,n*255];let r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,a=e=>(e<0&&(e+=1),e>1&&--e,e<1/6?i+(r-i)*6*e:e<1/2?r:e<2/3?i+(r-i)*(2/3-e)*6:i);return[a(e+1/3)*255,a(e)*255,a(e-1/3)*255]}const rn=e=>Math.max(0,Math.min(1,e));function an(e,t){if(!t)return e;let n=tn($t(e));return n[2]=t<0?n[2]*(1+t):n[2]*(1-t)+t,en(nn(n))}const on={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,ltGray:`#d3d3d3`,dkGray:`#a9a9a9`,orange:`#ffa500`,purple:`#800080`,navy:`#000080`,maroon:`#800000`,olive:`#808000`,teal:`#008080`,silver:`#c0c0c0`,lime:`#00ff00`,pink:`#ffc0cb`,brown:`#a52a2a`,gold:`#ffd700`},sn={bg1:`lt1`,tx1:`dk1`,bg2:`lt2`,tx2:`dk2`},cn=/* @__PURE__ */ new Set([`srgbClr`,`schemeClr`,`sysClr`,`prstClr`,`scrgbClr`,`hslClr`]);function ln(e,t){let n;switch(e.n){case`srgbClr`:n=`#`+(e.a.val??`000000`).toLowerCase();break;case`sysClr`:n=`#`+(e.a.lastClr??(e.a.val===`window`?`ffffff`:`000000`));break;case`prstClr`:n=on[e.a.val]??`#000000`;break;case`scrgbClr`:n=en([(A(e.a.r)??0)/1e5*255,(A(e.a.g)??0)/1e5*255,(A(e.a.b)??0)/1e5*255]);break;case`hslClr`:n=en(nn([(A(e.a.hue)??0)/216e5,(A(e.a.sat)??0)/1e5,(A(e.a.lum)??0)/1e5]));break;case`schemeClr`:{let r=e.a.val;if(r===`phClr`)n=t.phClr;else{let e=t.clrMap?.[r]??sn[r]??r;n=t.theme?.colors[e]??t.theme?.colors[r]}break}}if(n)return un(n,e)}function un(e,t){if(!t.c.length)return e;let n=$t(e),r=1;for(let e of t.c){let t=(A(e.a.val)??0)/1e5;switch(e.n){case`alpha`:r=t;break;case`lumMod`:{let e=tn(n);e[2]=rn(e[2]*t),n=nn(e);break}case`lumOff`:{let e=tn(n);e[2]=rn(e[2]+t),n=nn(e);break}case`satMod`:{let e=tn(n);e[1]=rn(e[1]*t),n=nn(e);break}case`tint`:n=n.map(e=>e+(255-e)*(1-t));break;case`shade`:n=n.map(e=>e*t);break;case`inv`:n=n.map(e=>255-e);break;case`gray`:{let e=n[0]*.3+n[1]*.59+n[2]*.11;n=[e,e,e];break}}}let i=en(n);if(r>=1)return i;let[a,o,s]=$t(i);return`rgba(${a},${o},${s},${+r.toFixed(3)})`}function F(e,t){if(e){for(let n of e.c)if(cn.has(n.n))return ln(n,t)}}const dn=`000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 800000 008000 000080 808000 800080 008080 C0C0C0 808080 9999FF 993366 FFFFCC CCFFFF 660066 FF8080 0066CC CCCCFF 000080 FF00FF FFFF00 00FFFF 800080 800000 008080 0000FF 00CCFF CCFFFF CCFFCC FFFF99 99CCFF FF99CC CC99FF FFCC99 3366FF 33CCCC 99CC00 FFCC00 FF9900 FF6600 666699 969696 003366 339966 003300 333300 993300 993366 333399 333333`.split(` `).map(e=>`#`+e),fn=[`lt1`,`dk1`,`lt2`,`dk2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`];function pn(e,t,n=dn){if(!e||e.a.auto===`1`||e.a.auto===`true`)return;let r;if(e.a.rgb){let t=e.a.rgb;r=`#`+(t.length===8?t.slice(2):t)}else if(e.a.theme!==void 0)r=t?.colors[fn[Number(e.a.theme)]??``]??void 0;else if(e.a.indexed!==void 0){let t=Number(e.a.indexed);if(t===64||t===65)return;r=n[t]}if(!r)return;let i=A(e.a.tint)??0;return i?an(r,i):r.toLowerCase()}function mn(e){let t=O(D(D(e,`colors`),`indexedColors`),`rgbColor`);return t.length?t.map(e=>`#`+(e.a.rgb??`FF000000`).slice(-6)):dn}const hn=[`ln`,`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`,`effectLst`,`effectDag`,`highlight`,`uLnTx`,`uLn`,`uFillTx`,`uFill`,`latin`,`ea`,`cs`,`sym`,`hlinkClick`,`hlinkMouseOver`,`rtl`,`extLst`],gn=/* @__PURE__ */ new Set([`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`]),_n={left:`l`,center:`ctr`,right:`r`,justify:`just`};function vn(t,n){let i;for(let a of t)e(a)&&v(a,e=>{if(i)return!0;if(r(e.q)!==`sp`)return;let t=l(s(s(e,`nvSpPr`),`cNvPr`)??e,`id`);return t!==void 0&&Number(t)===n&&(i=e),!0});return i}function yn(e,t,n){t.sz!==void 0&&u(e,`sz`,String(Math.round(t.sz*100))),t.b!==void 0&&u(e,`b`,t.b?`1`:`0`),t.i!==void 0&&u(e,`i`,t.i?`1`:`0`),t.u!==void 0&&u(e,`u`,t.u?`sng`:`none`),t.strike!==void 0&&u(e,`strike`,t.strike?`sngStrike`:`noStrike`),`color`in t&&(p(e,e=>gn.has(e)),t.color&&m(e,d(n+`solidFill`,{},[d(n+`srgbClr`,{val:t.color.replace(`#`,``).toUpperCase()})]),`solidFill`,hn)),t.font&&m(e,d(n+`latin`,{typeface:t.font}),`latin`,hn),`hl`in t&&m(e,t.hl?d(n+`highlight`,{},[d(n+`srgbClr`,{val:t.hl.replace(`#`,``).toUpperCase()})]):void 0,`highlight`,hn),`baseline`in t&&u(e,`baseline`,t.baseline?String(Math.round(t.baseline*1e3)):void 0)}const bn=[`lnSpc`,`spcBef`,`spcAft`,`buClrTx`,`buClr`,`buSzTx`,`buSzPct`,`buSzPts`,`buFontTx`,`buFont`,`buNone`,`buAutoNum`,`buChar`,`buBlip`,`tabLst`,`defRPr`,`extLst`],xn=/* @__PURE__ */ new Set([`buNone`,`buAutoNum`,`buChar`,`buBlip`]);function Sn(e,t,n){if(t.algn&&u(e,`algn`,_n[t.algn]),t.lvl!==void 0&&String(t.lvl)!==(l(e,`lvl`)??`0`)&&(u(e,`lvl`,t.lvl?String(t.lvl):void 0),u(e,`marL`,void 0),u(e,`indent`,void 0)),t.bullet){if(p(e,e=>xn.has(e)),t.bullet===`none`)m(e,d(n+`buNone`),`buNone`,bn),l(e,`indent`)?.startsWith(`-`)&&u(e,`indent`,`0`);else{let r=t.bullet===`bullet`?d(n+`buChar`,{char:`•`}):d(n+`buAutoNum`,{type:`arabicPeriod`});if(t.bullet===`bullet`&&m(e,d(n+`buFont`,{typeface:`Arial`}),`buFont`,bn),m(e,r,t.bullet===`bullet`?`buChar`:`buAutoNum`,bn),!l(e,`marL`)){let t=Number(l(e,`lvl`)??0);u(e,`marL`,String(342900+t*457200)),u(e,`indent`,`-342900`)}}}t.lnPct&&m(e,d(n+`lnSpc`,{},[d(n+`spcPct`,{val:String(Math.round(t.lnPct*1e5))})]),`lnSpc`,bn),e.self=e.c.length===0}const Cn={l:`left`,ctr:`center`,r:`right`,just:`justify`,dist:`justify`,thaiDist:`justify`,justLow:`justify`},wn={dash:`4 3`,sysDash:`3 1`,dot:`1 1`,sysDot:`1 1`,lgDash:`8 3`,dashDot:`4 3 1 3`,lgDashDot:`8 3 1 3`,lgDashDotDot:`8 3 1 3 1 3`,sysDashDot:`3 1 1 1`,sysDashDotDot:`3 1 1 1 1 1`};function Tn(e){let t=e.c[0];return t?D(t,`nvPr`):void 0}function En(e){let t=D(Tn(e),`ph`);if(t)return{type:t.a.type??`body`,idx:t.a.idx}}const Dn=e=>e===`ctrTitle`?`title`:e===`subTitle`||e===`obj`?`body`:e;function On(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=e=>{for(let i of e?.c??[]){i.n===`grpSp`&&r(i);let e=En(i);e&&(e.idx!==void 0&&!t.has(e.idx)&&t.set(e.idx,i),n.has(e.type)||n.set(e.type,i))}};return r(e),{byIdx:t,byType:n}}function kn(e){let t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function An(e,t){let n=e=>String.fromCharCode(97+(e-1)%26).repeat(Math.floor((e-1)/26)+1),r=String(t);return e.startsWith(`alphaLc`)?r=n(t):e.startsWith(`alphaUc`)?r=n(t).toUpperCase():e.startsWith(`romanLc`)?r=kn(t):e.startsWith(`romanUc`)&&(r=kn(t).toUpperCase()),e.endsWith(`ParenBoth`)?`(${r})`:e.endsWith(`ParenR`)?`${r})`:e.endsWith(`Period`)?`${r}.`:e.endsWith(`Minus`)?`- ${r} -`:r}var jn=class a{constructor(e,t,n,r){w(this,`pkg`,void 0),w(this,`mainPath`,void 0),w(this,`defaultTextStyle`,void 0),w(this,`masters`,/* @__PURE__ */ new Map),w(this,`layouts`,/* @__PURE__ */ new Map),w(this,`tableStyles`,void 0),w(this,`meta`,void 0),w(this,`genMaps`,/* @__PURE__ */ new Map),w(this,`touched`,!1),w(this,`undoStack`,[]),w(this,`redoStack`,[]),w(this,`originals`,/* @__PURE__ */ new Map),w(this,`lateShapes`,/* @__PURE__ */ new Map),this.pkg=e,this.mainPath=t,this.defaultTextStyle=n,this.meta=r}static async open(e,t){let n=await e.xml(t);if(!n)throw Error(`Missing presentation part`);let r=await e.rels(t),i=D(n,`sldSz`),o=[];for(let t of O(D(n,`sldIdLst`),`sldId`)){let n=r.get(t.a[`r:id`]);n&&e.has(n.target)&&o.push({index:o.length,path:n.target,hidden:!1})}let s={w:N(A(i?.a.cx,9144e3)),h:N(A(i?.a.cy,6858e3)),count:o.length,slides:o};return new a(e,t,D(n,`defaultTextStyle`),s)}async part(e){let t=await this.pkg.xml(e,!1);if(!t)throw Error(`Missing part ${e}`);let n=k(t,`cSld`,`spTree`);return{path:e,root:t,rels:await this.pkg.rels(e),spTree:n,...On(n)}}master(e){let t=this.masters.get(e);return t||(t=(async()=>{let t=await this.part(e),n=M(t.rels,`theme`),r=Ae(n?await this.pkg.xml(n.target):void 0),i={...D(t.root,`clrMap`)?.a??{}},a=D(t.root,`txStyles`);return{...t,theme:r,clrMap:i,title:D(a,`titleStyle`),body:D(a,`bodyStyle`),other:D(a,`otherStyle`)}})(),this.masters.set(e,t)),t}layout(e){let t=this.layouts.get(e);return t||(t=(async()=>{let t=await this.part(e),n=M(t.rels,`slideMaster`);if(!n)throw Error(`Layout ${e} has no master`);let r=await this.master(n.target);return{...t,master:r,clrMap:Mn(t.root,r.clrMap)}})(),this.layouts.set(e,t)),t}getTableStyles(){return this.tableStyles||(this.tableStyles=(async()=>{let e=/* @__PURE__ */ new Map,t=M(await this.pkg.rels(this.mainPath),`tableStyles`),n=t?await this.pkg.xml(t.target):void 0;for(let t of O(n,`tblStyle`))e.set(t.a.styleId,t);return e})()),this.tableStyles}async slide(e){let t=this.meta.slides[e];if(!t)throw Error(`No slide #${e}`);let n=await this.part(t.path),r=M(n.rels,`slideLayout`),i=r?await this.layout(r.target):void 0,a=i?.master,o=a?.theme??Ae(void 0),s=Mn(n.root,i?.clrMap??a?.clrMap??{}),c=new Fn(this,n,i,a,o,s,e,await this.getTableStyles()),l=[],u=n.root.a.showMasterSp!==`0`;return a&&u&&i?.root.a.showMasterSp!==`0`&&c.walk(a,a.spTree,Nn,l,!0),i&&u&&c.walk(i,i.spTree,Nn,l,!0),c.walk(n,n.spTree,Nn,l,!1),{index:e,w:this.meta.w,h:this.meta.h,bg:c.background(),els:l,hidden:n.root.a.show===`0`}}get defaults(){return this.defaultTextStyle}async keepOriginal(e){this.originals.has(e)||this.originals.set(e,await this.pkg.text(e))}genMap(e,t){return this.genMaps.get(`${e}#${t}`)}get dirty(){return this.genMaps.size>0||this.touched}async setText(a,c,l){let u=this.meta.slides[a];if(!u)throw Error(`No slide #${a}`);let p=u.path;await this.keepOriginal(p);let m=t(await this.pkg.text(p)),g=vn(m,c),_=`${p}#${c}`;g&&!this.lateShapes.has(_)&&!vn(t(this.originals.get(p)),c)&&this.lateShapes.set(_,n([g]));let v=this.lateShapes.get(_),y=v?t(v)[0]:vn(t(this.originals.get(p)),c);if(!g||!y)throw Error(`Shape ${c} not found`);let b=s(g,`txBody`),x=s(y,`txBody`),S=o(x,`p`),C=i(g.q),w=i((s(x,`bodyPr`)??S[0])?.q??`a:x`)||`a:`;b||(b=d(C+`txBody`,{},[d(w+`bodyPr`),d(w+`lstStyle`)]),g.c.push(b),g.self=!1);let T=S.map(e=>o(e).filter(e=>[`r`,`br`,`fld`].includes(r(e.q)))),ee=[],E=l.map(e=>{let t=e.k===void 0?S[S.length-1]:S[e.k],n=d(w+`p`),r=s(t,`pPr`),i=e.algn||e.lvl!==void 0||e.bullet||e.lnPct,a=r?f(r):i?d(w+`pPr`):void 0;a&&i&&Sn(a,e,w),a&&n.c.push(a);let o=s(t,`endParaRPr`),c={k:e.k,runs:[]},l=e=>{let t=s(e?T[e[0]]?.[e[1]]:void 0,`rPr`)??(o?{...f(o),q:w+`rPr`}:void 0);return t?f(t):d(w+`rPr`,{lang:`en-US`,dirty:`0`})};for(let t of e.runs)if(t.fld&&t.src){let e=T[t.src[0]]?.[t.src[1]];e&&(n.c.push(f(e)),c.runs.push(t.src))}else t.text.split(`\n`).forEach((e,r)=>{let i=l(t.src);t.set&&yn(i,t.set,w),r>0&&(n.c.push(d(w+`br`,{},[{...f(i)}])),c.runs.push(t.src)),e&&(n.c.push(d(w+`r`,{},[i,d(w+`t`,{},[h(e)])])),c.runs.push(t.src))});return n.c.push(o?f(o):d(w+`endParaRPr`,{lang:`en-US`,dirty:`0`})),n.self=!1,ee.push(c),n}),te=b.c.filter(t=>!(e(t)&&r(t.q)===`p`));return b.c=[...te,...E],b.self=!1,this.pkg.setPart(p,n(m)),this.genMaps.set(`${p}#${c}`,ee),this.undoStack=this.undoStack.filter(e=>e.path!==p),this.redoStack=this.redoStack.filter(e=>e.path!==p),this.slide(a)}save(){return this.pkg.save(`application/vnd.openxmlformats-officedocument.presentationml.presentation`)}};function Mn(e,t){let n=k(e,`clrMapOvr`,`overrideClrMapping`);return n?{...n.a}:t}const Nn=e=>e;function Pn(e){if(!e)return;let t=D(e,`off`),n=D(e,`ext`);if(!t&&!n)return;let r={x:N(A(t?.a.x,0)),y:N(A(t?.a.y,0)),w:N(A(n?.a.cx,0)),h:N(A(n?.a.cy,0))},i=A(e.a.rot);return i&&(r.rot=i/6e4),e.a.flipH===`1`&&(r.flipH=!0),e.a.flipV===`1`&&(r.flipV=!0),r}var Fn=class{constructor(e,t,n,r,i,a,o,s){w(this,`pres`,void 0),w(this,`slide`,void 0),w(this,`layout`,void 0),w(this,`master`,void 0),w(this,`theme`,void 0),w(this,`clrMap`,void 0),w(this,`index`,void 0),w(this,`tableStyles`,void 0),this.pres=e,this.slide=t,this.layout=n,this.master=r,this.theme=i,this.clrMap=a,this.index=o,this.tableStyles=s}cc(e){return{theme:this.theme,clrMap:this.clrMap,phClr:e}}font(e){if(e)return e.startsWith(`+mj`)?Le(this.theme.major):e.startsWith(`+mn`)?Le(this.theme.minor):Le(e)}fill(e,t,n){if(e)for(let r of e.c)switch(r.n){case`noFill`:return{t:`none`};case`solidFill`:{let e=F(r,this.cc(n));return e?{t:`solid`,c:e}:void 0}case`gradFill`:{let e=O(D(r,`gsLst`),`gs`).map(e=>({pos:A(e.a.pos,0)/1e3|0,col:F(e,this.cc(n))})).filter(e=>e.col).sort((e,t)=>e.pos-t.pos);if(!e.length)return;if(e.length===1)return{t:`solid`,c:e[0].col};let t=e.map(e=>`${e.col} ${e.pos}%`).join(`, `);return D(r,`path`)?{t:`grad`,css:`radial-gradient(circle, ${t})`}:{t:`grad`,css:`linear-gradient(${(A(D(r,`lin`)?.a.ang,0)/6e4+90)%360}deg, ${t})`}}case`blipFill`:{let e=D(r,`blip`)?.a[`r:embed`],n=e?t.get(e):void 0;return n&&!n.external?{t:`img`,target:n.target,tile:!!D(r,`tile`)}:void 0}case`pattFill`:{let e=F(D(r,`fgClr`),this.cc(n));return e?{t:`solid`,c:e}:void 0}}}themeFill(e,t){if(!e)return;let n=A(e.a.idx,0);if(!n)return;let r=F(e,this.cc()),i=(n>=1001?this.theme.bgFillStyles:this.theme.fillStyles)[n>=1001?n-1001:n-1];return i?this.fill({n:`x`,a:{},c:[i],t:``},t,r)??(r?{t:`solid`,c:r}:void 0):r?{t:`solid`,c:r}:void 0}stroke(e,t){let n=A(t?.a.idx,0),r=n?this.theme.lineStyles[n-1]:void 0,i=t?F(t,this.cc()):void 0;if(e&&D(e,`noFill`))return;let a=e?F(D(e,`solidFill`),this.cc(i)):void 0;if(!a&&e){let t=k(e,`gradFill`,`gsLst`,`gs`);t&&(a=F(t,this.cc(i)))}if(!a&&n&&(a=i??(r?F(D(r,`solidFill`),this.cc(i)):void 0)),!a)return;let o=A(e?.a.w)??A(r?.a.w)??9525,s=D(e,`prstDash`)?.a.val??D(r,`prstDash`)?.a.val,c={c:a,w:Math.max(.5,N(o))};s&&wn[s]&&(c.dash=wn[s].split(` `).map(e=>+(Number(e)*c.w).toFixed(2)).join(` `));let l=D(e,`headEnd`)?.a.type,u=D(e,`tailEnd`)?.a.type;return l&&l!==`none`&&(c.head=l),u&&u!==`none`&&(c.tail=u),c}background(){for(let e of[this.slide,this.layout,this.master]){if(!e)continue;let t=k(e.root,`cSld`,`bg`);if(!t)continue;let n=D(t,`bgPr`);if(n){let t=this.fill(n,e.rels);if(t)return t}let r=D(t,`bgRef`);if(r)return this.themeFill(r,e.rels)}return{t:`solid`,c:this.theme.colors[this.clrMap.bg1??`lt1`]??`#ffffff`}}readRun(e,t={}){if(!e)return t;let n=e.a;n.sz&&(t.sz=Number(n.sz)/100),n.b!==void 0&&(t.b=n.b===`1`||n.b===`true`),n.i!==void 0&&(t.i=n.i===`1`||n.i===`true`),n.u!==void 0&&(t.u=n.u!==`none`),n.strike!==void 0&&(t.strike=n.strike!==`noStrike`),n.baseline!==void 0&&(t.baseline=Number(n.baseline)/1e3),n.cap!==void 0&&(t.caps=n.cap===`all`);let r=D(e,`solidFill`);if(r){let e=F(r,this.cc());e&&(t.color=e)}else{let n=k(e,`gradFill`,`gsLst`,`gs`),r=n&&F(n,this.cc());r&&(t.color=r)}let i=F(D(e,`highlight`),this.cc());i&&(t.hl=i);let a=D(e,`latin`)?.a.typeface??D(e,`ea`)?.a.typeface,o=this.font(a);return o&&(t.font=o),t}readLvl(e,t){let n={...t,r:{...t.r}};if(!e)return n;let r=e.a;r.algn&&(n.algn=Cn[r.algn]??`left`),r.marL!==void 0&&(n.marL=N(Number(r.marL))),r.indent!==void 0&&(n.indent=N(Number(r.indent)));for(let t of e.c)switch(t.n){case`lnSpc`:{let e=A(D(t,`spcPct`)?.a.val),r=A(D(t,`spcPts`)?.a.val);e===void 0?r!==void 0&&(n.lnPts=r/100,n.lnPct=void 0):(n.lnPct=e/1e5,n.lnPts=void 0);break}case`spcBef`:case`spcAft`:{let e=A(D(t,`spcPct`)?.a.val),r=A(D(t,`spcPts`)?.a.val),i=e===void 0?{pts:(r??0)/100}:{pct:e/1e5};t.n===`spcBef`?n.bef=i:n.aft=i;break}case`buNone`:n.bu={kind:`none`};break;case`buChar`:n.bu={kind:`char`,char:t.a.char??`•`};break;case`buAutoNum`:n.bu={kind:`auto`,autoType:t.a.type??`arabicPeriod`,startAt:A(t.a.startAt,1)};break;case`buClr`:n.buClr=F(t,this.cc());break;case`buFont`:n.buFont=t.a.typeface;break;case`buSzPct`:n.buSzPct=A(t.a.val,1e5)/1e5;break;case`defRPr`:this.readRun(t,n.r)}return n}levels(e){let t=[];for(let n=1;n<=9;n++){let r={r:{}};for(let t of e)t&&(r=this.readLvl(D(t,`defPPr`),r),r=this.readLvl(D(t,`lvl${n}pPr`),r));t.push(r)}return t}textBody(e,t,n,r,i,a){if(!e)return;let o=O(e,`p`),s=!o.some(e=>e.c.some(e=>e.n===`r`||e.n===`fld`));if(s&&a===void 0)return;let c=a===void 0?void 0:this.pres.genMap(this.slide.path,a),l=this.master,u;if(n){let e=Dn(n.type);u=e===`title`?l?.title:e===`body`?l?.body:l?.other}let d=n?[u]:[l?.other,this.pres.defaults];if(r){let e=F(r,this.cc()),t=r.a.idx===`major`?this.theme.major:r.a.idx===`minor`?this.theme.minor:void 0,n={n:`lstStyle`,a:{},c:[],t:``},i={n:`defRPr`,a:{},c:[],t:``};e&&i.c.push({n:`solidFill`,a:{},c:[{n:`srgbClr`,a:{val:e.replace(`#`,``).slice(0,6)},c:[],t:``}],t:``}),t&&i.c.push({n:`latin`,a:{typeface:t},c:[],t:``}),n.c.push({n:`defPPr`,a:{},c:[i],t:``}),d.push(n)}for(let e of t)d.push(k(e,`txBody`,`lstStyle`));let f=this.levels(d),p={},m;for(let e of t){let t=k(e,`txBody`,`bodyPr`);if(!t)continue;Object.assign(p,t.a);let n=D(t,`normAutofit`);n&&(m=n)}let h=m?A(m.a.fontScale,1e5)/1e5:1,g=m?A(m.a.lnSpcReduction,0)/1e5:0,_=[N(A(p.lIns,91440)),N(A(p.tIns,45720)),N(A(p.rIns,91440)),N(A(p.bIns,45720))],v=[],y=i?.rels??this.slide.rels,b=o.map((e,t)=>{let n=D(e,`pPr`),r=Math.min(8,A(n?.a.lvl,0)),i=this.readLvl(n,f[r]),a=[],o=0;for(let n of e.c){let e=n.n===`r`||n.n===`fld`||n.n===`br`?c?c[t]?.runs[o++]:[t,o++]:void 0;if(n.n===`r`||n.n===`fld`){let t=this.readRun(D(n,`rPr`),{...i.r}),r=ye(D(n,`t`));n.n===`fld`&&n.a.type===`slidenum`&&(r=String(this.index+1));let o=k(n,`rPr`,`hlinkClick`)?.a[`r:id`],s=o?y.get(o)?.target:void 0;a.push({text:r,sz:(t.sz??18)*h,b:t.b,i:t.i,u:t.u||!!s,strike:t.strike,color:t.color??(s?this.theme.colors.hlink:void 0),font:t.font,baseline:t.baseline,caps:t.caps,href:s,hl:t.hl,src:e,...n.n===`fld`?{fld:!0}:{}})}else if(n.n===`br`){let t=this.readRun(D(n,`rPr`),{...i.r});a.push({text:``,br:!0,sz:(t.sz??18)*h,src:e})}}let s=this.readRun(D(e,`endParaRPr`),{...i.r}),l=a[0]?.sz??(s.sz??18)*h,u=a.some(e=>e.text),d;if(i.bu&&i.bu.kind!==`none`&&u){let e=l*(i.buSzPct??1),t=i.buClr??a[0]?.color??i.r.color;if(i.bu.kind===`char`)d={text:i.bu.char??`•`,sz:e,color:t,font:i.buFont?this.font(i.buFont):void 0};else{v[r]=(v[r]??(i.bu.startAt??1)-1)+1;for(let e=r+1;e<9;e++)v[e]=void 0;d={text:An(i.bu.autoType??`arabicPeriod`,v[r]),sz:e,color:t}}}else if(!i.bu||i.bu.kind===`none`)for(let e=r;e<9;e++)v[e]=void 0;let p=e=>e?e.pts===void 0?(e.pct??0)*l*1.2*(4/3):e.pts*4/3:0;return{algn:i.algn??`left`,marL:i.marL??0,indent:i.indent??0,lnPct:i.lnPct===void 0?g?1-g:void 0:i.lnPct*(1-g),lnPx:i.lnPts===void 0?void 0:i.lnPts*4/3,spcBef:p(i.bef),spcAft:p(i.aft),bullet:d,lvl:r||void 0,buKind:i.bu?.kind===`char`?`bullet`:i.bu?.kind===`auto`?`number`:void 0,runs:a,endSz:(s.sz??18)*h,k:c?c[t]?.k:t}});return{anchor:p.anchor===`ctr`?`ctr`:p.anchor===`b`?`b`:`t`,ins:_,wrap:p.wrap!==`none`,vert:p.vert&&p.vert!==`horz`?p.vert:void 0,paras:b,empty:s||void 0}}inheritChain(e,t){let n=En(e);if(!n)return{chain:[e]};let r=[],i=Dn(n.type);if(t===this.slide){let e=this.layout?(n.idx===void 0?void 0:this.layout.byIdx.get(n.idx))??this.layout.byType.get(n.type):void 0,t=e?En(e)?.type??i:i,a=this.master?.byType.get(Dn(t))??this.master?.byType.get(i);a&&r.push(a),e&&r.push(e)}else if(t===this.layout){let e=this.master?.byType.get(i);e&&r.push(e)}return r.push(e),{chain:r,ph:n}}walk(e,t,n,r,i,a){if(t)for(let o of t.c){if(i&&(o.n===`sp`||o.n===`pic`)&&En(o))continue;let t=D(o.c[0],`cNvPr`)?.a.id,s=a??(e===this.slide&&t?Number(t):void 0),c=r.length;try{switch(o.n){case`sp`:case`cxnSp`:this.shape(o,e,n,r);break;case`pic`:this.pic(o,e,n,r);break;case`grpSp`:this.group(o,e,n,r,i,s);break;case`graphicFrame`:this.frame(o,e,n,r)}}catch{}if(s!==void 0)for(let e=c;e<r.length;e++)r[e].top=s}}boxOf(e,t,n){for(let r=e.length-1;r>=0;r--){let i=Pn(k(e[r],...t));if(i)return n(i)}}shape(e,t,n,r){let{chain:i,ph:a}=this.inheritChain(e,t),o=this.boxOf(i,[`spPr`,`xfrm`],n);if(!o)return;let s=D(e,`style`),c;for(let e=i.length-1;e>=0&&!c;e--)c=this.fill(D(i[e],`spPr`),t.rels);!c&&s&&(c=this.themeFill(D(s,`fillRef`),t.rels));let l;for(let e=i.length-1;e>=0&&!l;e--)l=k(i[e],`spPr`,`ln`);let u=this.stroke(l,D(s,`lnRef`)),d=`rect`,f,p;for(let e=i.length-1;e>=0;e--){let t=k(i[e],`spPr`,`prstGeom`);if(t){d=t.a.prst??`rect`;let e=O(D(t,`avLst`),`gd`);if(e.length){f={};for(let t of e){let e=/val\\s+(-?\\d+)/.exec(t.a.fmla??``);e&&(f[t.a.name]=Number(e[1]))}}break}let n=k(i[e],`spPr`,`custGeom`);if(n){d=`custom`,p=Rn(n,o);break}}e.n===`cxnSp`&&d===`rect`&&(d=`line`);let m=k(e,`nvSpPr`,`cNvPr`)?.a.id,h=t===this.slide&&e.n===`sp`&&m?Number(m):void 0,g=e.n===`sp`?this.textBody(D(e,`txBody`),i,a,D(s,`fontRef`),t,h):void 0;(c&&c.t!==`none`||u||g)&&r.push({t:`shape`,box:o,geom:d,adj:f,fill:c,stroke:u,text:g,path:p,sid:h})}pic(e,t,n,r){let{chain:i}=this.inheritChain(e,t),a=this.boxOf(i,[`spPr`,`xfrm`],n);if(!a)return;let o=D(e,`blipFill`),s=D(o,`blip`)?.a[`r:embed`],c=s?t.rels.get(s):void 0,l=D(o,`srcRect`),u=l?[A(l.a.l,0)/1e5,A(l.a.t,0)/1e5,A(l.a.r,0)/1e5,A(l.a.b,0)/1e5]:void 0,d=!!D(Tn(e),`videoFile`)||!!D(Tn(e),`audioFile`);r.push({t:`pic`,box:a,target:c&&!c.external?c.target:void 0,crop:u&&u.some(e=>e!==0)?u:void 0,stroke:this.stroke(k(e,`spPr`,`ln`),k(e,`style`,`lnRef`)),geom:k(e,`spPr`,`prstGeom`)?.a.prst,video:d})}group(e,t,n,r,i,a){let o=k(e,`grpSpPr`,`xfrm`),s=D(o,`off`),c=D(o,`ext`),l=D(o,`chOff`),u=D(o,`chExt`);if(!s||!c)return this.walk(t,e,n,r,i,a);let d=N(A(s.a.x,0)),f=N(A(s.a.y,0)),p=N(A(l?.a.x,0)),m=N(A(l?.a.y,0)),h=u&&A(u.a.cx)?A(c.a.cx,0)/A(u.a.cx,1):1,g=u&&A(u.a.cy)?A(c.a.cy,0)/A(u.a.cy,1):1;this.walk(t,e,e=>n({...e,x:d+(e.x-p)*h,y:f+(e.y-m)*g,w:e.w*h,h:e.h*g}),r,i,a)}frame(e,t,n,r){let i=Pn(D(e,`xfrm`));if(!i)return;let a=n(i),o=k(e,`graphic`,`graphicData`);if(!o)return;let s=D(o,`tbl`);if(s)return void r.push(this.table(s,a,t));let c=D(D(o,`oleObj`),`pic`);if(c){let e=k(c,`blipFill`,`blip`)?.a[`r:embed`],n=e?t.rels.get(e):void 0;r.push({t:`pic`,box:a,target:n?.target});return}let l=o.a.uri??``,u=l.includes(`chart`)?`Chart`:l.includes(`diagram`)?`SmartArt`:l.includes(`ole`)?`Embedded object`:`Object`;r.push({t:`placeholder`,box:a,label:u})}table(e,t,n){let r=O(D(e,`tblGrid`),`gridCol`).map(e=>N(A(e.a.w,0))),i=D(e,`tblPr`),a=e=>i?.a[e]===`1`||i?.a[e]===`true`,o=D(i,`tableStyleId`)?.t.trim(),s=o?this.tableStyles.get(o):void 0,c=O(e,`tr`),l=c.length,u=r.length,d=this.fill(i,n.rels),f=(e,t)=>{let n=[],r=e=>{let t=D(s,e);t&&n.push(t)};r(`wholeTbl`);let i=e-+!!a(`firstRow`);a(`bandRow`)&&i>=0&&r(i%2==0?`band1H`:`band2H`);let o=t-+!!a(`firstCol`);return a(`bandCol`)&&o>=0&&r(o%2==0?`band1V`:`band2V`),a(`firstCol`)&&t===0&&r(`firstCol`),a(`lastCol`)&&t===u-1&&r(`lastCol`),a(`lastRow`)&&e===l-1&&r(`lastRow`),a(`firstRow`)&&e===0&&r(`firstRow`),n},p=!s&&o?In(this.theme,a(`firstRow`),a(`bandRow`)):void 0;return{t:`table`,box:t,cols:r,rows:c.map((e,t)=>{let r=O(e,`tc`).map((e,r)=>{let i=D(e,`tcPr`),a,o,s,c={};for(let e of f(t,r)){let t=D(e,`tcStyle`),r=this.fill(D(t,`fill`),n.rels)??this.themeFill(D(t,`fillRef`),n.rels);r&&(a=r);let i=D(t,`tcBdr`);for(let e of i?.c??[]){let t=this.stroke(D(e,`ln`),D(e,`lnRef`));c[e.n]=t}let l=D(e,`tcTxStyle`);if(l){l.a.b&&(o=l.a.b===`on`);let e=F(l,this.cc())??F(D(l,`fontRef`),this.cc());e&&(s=e)}}if(p){let e=p(t);a=e.fill,e.color&&(s=e.color),e.bold&&(o=!0),c.insideH=c.insideV={c:`#ffffff`,w:1}}let m=this.fill(i,n.rels);m&&(a=m);let h=(e,t,n,r)=>{let a=D(i,e);return a?this.stroke(a,void 0):r?c[t]:c[n]??c[t]},g=D(e,`txBody`),_=this.textBody(g,g?[e]:[],void 0,void 0,n);if(_){if(_.ins=[N(A(i?.a.marL,91440)),N(A(i?.a.marT,45720)),N(A(i?.a.marR,91440)),N(A(i?.a.marB,45720))],_.anchor=i?.a.anchor===`ctr`?`ctr`:i?.a.anchor===`b`?`b`:`t`,o!==void 0||s)for(let e of _.paras)for(let t of e.runs)o&&t.b===void 0&&(t.b=!0),s&&!t.color&&(t.color=s)}else _=void 0;return{text:_,fill:a??d,bl:h(`lnL`,`left`,`insideV`,r===0),br:h(`lnR`,`right`,`insideV`,r===u-1),bt:h(`lnT`,`top`,`insideH`,t===0),bb:h(`lnB`,`bottom`,`insideH`,t===l-1),colSpan:A(e.a.gridSpan,1),rowSpan:A(e.a.rowSpan,1),hidden:e.a.hMerge===`1`||e.a.vMerge===`1`||e.a.hMerge===`true`||e.a.vMerge===`true`}});return{h:N(A(e.a.h,0)),cells:r}})}}};function In(e,t,n){let r=e.colors.accent1??`#4472c4`;return e=>{if(t&&e===0)return{fill:{t:`solid`,c:r},color:`#ffffff`,bold:!0};let i=e-+!!t,a=n&&i%2==0?.6:.8;return{fill:{t:`solid`,c:Ln(r,`#ffffff`,a)}}}}function Ln(e,t,n){let r=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),i=[1,3,5].map(e=>parseInt(t.slice(e,e+2),16));return`#`+r.map((e,t)=>Math.round(e+(i[t]-e)*n).toString(16).padStart(2,`0`)).join(``)}function Rn(e,t){let n=O(D(e,`pathLst`),`path`),r=``;for(let e of n){let n=A(e.a.w)||1,i=A(e.a.h)||1,a=t.w/n,o=t.h/i,s=e=>`${(A(e?.a.x,0)*a).toFixed(2)} ${(A(e?.a.y,0)*o).toFixed(2)}`,c=0,l=0;for(let t of e.c){let e=O(t,`pt`);switch(t.n){case`moveTo`:r+=`M${s(e[0])} `,c=A(e[0]?.a.x,0)*a,l=A(e[0]?.a.y,0)*o;break;case`lnTo`:r+=`L${s(e[0])} `,c=A(e[0]?.a.x,0)*a,l=A(e[0]?.a.y,0)*o;break;case`cubicBezTo`:r+=`C${e.map(s).join(` `)} `,c=A(e[2]?.a.x,0)*a,l=A(e[2]?.a.y,0)*o;break;case`quadBezTo`:r+=`Q${e.map(s).join(` `)} `,c=A(e[1]?.a.x,0)*a,l=A(e[1]?.a.y,0)*o;break;case`arcTo`:{let e=A(t.a.wR,0)*a,n=A(t.a.hR,0)*o,i=A(t.a.stAng,0)/6e4*(Math.PI/180),s=A(t.a.swAng,0)/6e4*(Math.PI/180),u=c-e*Math.cos(i),d=l-n*Math.sin(i),f=u+e*Math.cos(i+s),p=d+n*Math.sin(i+s);r+=`A${e.toFixed(2)} ${n.toFixed(2)} 0 ${+(Math.abs(s)>Math.PI)} ${+(s>0)} ${f.toFixed(2)} ${p.toFixed(2)} `,c=f,l=p;break}case`close`:r+=`Z `}}}return r.trim()||void 0}var zn=class{constructor(e,t){w(this,`blob`,void 0),w(this,`name`,void 0),w(this,`size`,void 0),this.blob=e,this.name=t,this.size=e.size}async read(e,t){return new Uint8Array(await this.blob.slice(e,e+t).arrayBuffer())}stream(e,t){return this.blob.slice(e,e+t).stream()}slice(e,t){return this.blob.slice(e,e+t)}},Bn=class{constructor(e,t){w(this,`name`,void 0),w(this,`size`,void 0),w(this,`bytes`,void 0),this.name=t,this.bytes=e instanceof Uint8Array?e:new Uint8Array(e),this.size=this.bytes.byteLength}async read(e,t){return this.bytes.subarray(e,e+t)}stream(e,t){let n=this.bytes,r=Math.min(e+t,n.byteLength),i=e;return new ReadableStream({pull(e){if(i>=r)return e.close();let t=Math.min(i+1048576,r);e.enqueue(n.slice(i,t)),i=t}})}},Vn=class e{constructor(e,t,n,r){w(this,`url`,void 0),w(this,`size`,void 0),w(this,`opts`,void 0),w(this,`name`,void 0),w(this,`cache`,/* @__PURE__ */ new Map),w(this,`inflight`,/* @__PURE__ */ new Map),w(this,`blockSize`,void 0),w(this,`maxBlocks`,void 0),this.url=e,this.size=t,this.opts=n,this.name=r,this.blockSize=n.blockSize??262144,this.maxBlocks=n.maxBlocks??128}static async open(t,n={}){let r=decodeURIComponent(t.split(/[?#]/)[0].split(`/`).pop()||``)||void 0,i={headers:{...n.headers},credentials:n.credentials,signal:n.signal},a=-1;try{let o=await fetch(t,{...i,headers:{...n.headers,Range:`bytes=0-0`}});if(o.status===206){let s=o.headers.get(`Content-Range`),c=s&&/\\/(\\d+)\\s*$/.exec(s);if(c&&(a=Number(c[1])),await o.body?.cancel(),a<0){let e=await fetch(t,{...i,method:`HEAD`}),n=e.headers.get(`Content-Length`);e.ok&&n&&(a=Number(n))}if(a>0)return new e(t,a,n,r)}else if(o.ok)return new zn(await Hn(o,n.onProgress),r)}catch(e){if(e?.name===`AbortError`)throw e}let o=await fetch(t,i);if(!o.ok)throw Error(`HTTP ${o.status} while fetching ${t}`);return new zn(await Hn(o,n.onProgress),r)}async fetchRange(e,t){let n=await fetch(this.url,{headers:{...this.opts.headers,Range:`bytes=${e}-${t-1}`},credentials:this.opts.credentials,signal:this.opts.signal});if(n.status!==206&&!n.ok)throw Error(`HTTP ${n.status} (range ${e}-${t-1})`);let r=new Uint8Array(await n.arrayBuffer());return n.status===206?r:r.subarray(e,t)}async ensureBlocks(e,t){let n=[],r=-1,i=e=>{if(r<0)return;let t=r,i=e,a=this.fetchRange(t*this.blockSize,Math.min((i+1)*this.blockSize,this.size)).then(e=>{for(let n=t;n<=i;n++){let r=(n-t)*this.blockSize;this.cache.set(n,e.subarray(r,Math.min(r+this.blockSize,e.length))),this.inflight.delete(n)}this.evict()});for(let e=t;e<=i;e++)this.inflight.set(e,a);n.push(a),r=-1};for(let a=e;a<=t;a++)if(this.cache.has(a)){i(a-1);let e=this.cache.get(a);this.cache.delete(a),this.cache.set(a,e)}else this.inflight.has(a)?(i(a-1),n.push(this.inflight.get(a))):r<0&&(r=a);i(t),await Promise.all(n)}evict(){for(;this.cache.size>this.maxBlocks;){let e=this.cache.keys().next().value;this.cache.delete(e)}}async read(e,t){let n=Math.min(e+t,this.size);if(n<=e)return/* @__PURE__ */ new Uint8Array;if(n-e>this.maxBlocks*this.blockSize/2)return this.fetchRange(e,n);let r=this.blockSize,i=Math.floor(e/r),a=Math.floor((n-1)/r);await this.ensureBlocks(i,a);let o=new Uint8Array(n-e);for(let t=i;t<=a;t++){let i=this.cache.get(t);if(!i)throw Error(`range block evicted before use`);let a=t*r,s=Math.max(e,a),c=Math.min(n,a+i.length);o.set(i.subarray(s-a,c-a),s-e)}return o}stream(e,t){if(t>2*this.blockSize){let{url:n,opts:r}=this,i;return new ReadableStream({async start(){let a=await fetch(n,{headers:{...r.headers,Range:`bytes=${e}-${e+t-1}`},credentials:r.credentials,signal:r.signal});if(a.status!==206)throw Error(`Range request not honoured (HTTP ${a.status})`);i=a.body.getReader()},async pull(e){let{done:t,value:n}=await i.read();t?e.close():e.enqueue(n)},cancel(){return i?.cancel()}})}let n=e,r=e+t;return new ReadableStream({pull:async e=>{if(n>=r)return e.close();let t=Math.min(this.blockSize,r-n);e.enqueue(await this.read(n,t)),n+=t}})}};async function Hn(e,t){let n=Number(e.headers.get(`Content-Length`)||0);if(!e.body||!t)return e.blob();let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a,n)}return new Blob(i)}async function Un(e,t={}){if(typeof e==`string`||e instanceof URL)return Vn.open(String(e),t);if(e instanceof Uint8Array||e instanceof ArrayBuffer)return new Bn(e,t.name);if(typeof Blob<`u`&&e instanceof Blob)return new zn(e,t.name??e.name);throw Error(`Unsupported document source`)}const Wn=[`#NULL!`,`#DIV/0!`,`#VALUE!`,`#REF!`,`#NAME?`,`#NUM!`,`#N/A`];var I=class{constructor(e){w(this,`code`,void 0),this.code=e}toString(){return this.code}};const Gn=1048575,Kn=16383,L={DIV0:new I(`#DIV/0!`),VALUE:new I(`#VALUE!`),REF:new I(`#REF!`),NAME:new I(`#NAME?`),NA:new I(`#N/A`),NUM:new I(`#NUM!`),NULL:new I(`#NULL!`)};function qn(e){let t=``,n=e+1;for(;n>0;){let e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-1)/26)}return t}function Jn(e){let t=0,n=e.toUpperCase();for(let e=0;e<n.length;e++)t=t*26+(n.charCodeAt(e)-64);return t-1}function Yn(e,t){return e===void 0||t===void 0?e===t:e.toLowerCase()===t.toLowerCase()}function Xn(e){return/^[A-Za-z_\\u00A1-\\uFFFF][\\w.\\u00A1-\\uFFFF]*$/.test(e)&&!/^[A-Za-z]{1,3}\\d+$/.test(e)&&!/^(R\\d*C?\\d*|C\\d*)$/i.test(e)&&!/^(TRUE|FALSE)$/i.test(e)?e:`\'${e.replace(/\'/g,`\'\'`)}\'`}const Zn=(e,t,n,r)=>`${r?`$`:``}${qn(t)}${n?`$`:``}${e+1}`;function Qn(e,t){let n=e.sheet===void 0?``:`${t??Xn(e.sheet)}!`;switch(e.kind){case`cell`:return n+Zn(e.r0,e.c0,e.ar0,e.ac0);case`area`:return`${n}${Zn(e.r0,e.c0,e.ar0,e.ac0)}:${Zn(e.r1,e.c1,e.ar1,e.ac1)}`;case`cols`:return`${n}${e.ac0?`$`:``}${qn(e.c0)}:${e.ac1?`$`:``}${qn(e.c1)}`;case`rows`:return`${n}${e.ar0?`$`:``}${e.r0+1}:${e.ar1?`$`:``}${e.r1+1}`}}function $n(e){return e.r0>e.r1&&([e.r0,e.r1]=[e.r1,e.r0],[e.ar0,e.ar1]=[e.ar1,e.ar0]),e.c0>e.c1&&([e.c0,e.c1]=[e.c1,e.c0],[e.ac0,e.ac1]=[e.ac1,e.ac0]),e}function er(e){return e.r0>=0&&e.c0>=0&&e.r1<=1048575&&e.c1<=16383&&e.r1>=0&&e.c1>=0}var R=class extends Error{constructor(e,t){super(e),w(this,`pos`,void 0),this.pos=t,this.name=`FormulaSyntaxError`}};const tr=[[`#DIV/0!`,`#DIV/0!`],[`#VALUE!`,`#VALUE!`],[`#REF!`,`#REF!`],[`#NAME?`,`#NAME?`],[`#N/A`,`#N/A`],[`#NUM!`,`#NUM!`],[`#NULL!`,`#NULL!`]],nr=/[\\w.$\\\\\\u00A1-\\uFFFF]/,rr=/(\\$?)([A-Za-z]{1,3})(\\$?)(\\d+):(\\$?)([A-Za-z]{1,3})(\\$?)(\\d+)/y,ir=/(\\$?)([A-Za-z]{1,3})(\\$?)(\\d+)/y,ar=/(\\$?)([A-Za-z]{1,3}):(\\$?)([A-Za-z]{1,3})/y,or=/(\\$?)(\\d+):(\\$?)(\\d+)/y,sr=/(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?/y,cr=[`_XLFN.`,`_XLWS.`,`_XLUDF.`];function lr(e,t,n){return e.lastIndex=n,e.exec(t)}const ur=e=>e!==void 0&&nr.test(e);function dr(e){let t=Number(e)-1;return t>=0&&t<=1048575?t:-1}function fr(e){let t=Jn(e);return t<=16383?t:-1}function pr(e,t){let n,r=null;if(n=lr(rr,e,t)){let[e,t,i,a]=[dr(n[4]),fr(n[2]),dr(n[8]),fr(n[6])];e>=0&&t>=0&&i>=0&&a>=0&&(r={kind:`area`,r0:e,c0:t,r1:i,c1:a,ac0:!!n[1],ar0:!!n[3],ac1:!!n[5],ar1:!!n[7]})}if(!r&&(n=lr(ir,e,t))){let[e,t]=[dr(n[4]),fr(n[2])];e>=0&&t>=0&&(r={kind:`cell`,r0:e,c0:t,r1:e,c1:t,ac0:!!n[1],ar0:!!n[3],ac1:!!n[1],ar1:!!n[3]})}if(!r&&(n=lr(ar,e,t))){let[e,t]=[fr(n[2]),fr(n[4])];e>=0&&t>=0&&(r={kind:`cols`,r0:0,c0:e,r1:Gn,c1:t,ac0:!!n[1],ar0:!1,ac1:!!n[3],ar1:!1})}if(!r&&(n=lr(or,e,t))){let[e,t]=[dr(n[2]),dr(n[4])];e>=0&&t>=0&&(r={kind:`rows`,r0:e,c0:0,r1:t,c1:Kn,ac0:!1,ar0:!!n[1],ac1:!1,ar1:!!n[3]})}if(!r||!n)return null;let i=t+n[0].length,a=e[i];return ur(a)||a===`(`||a===`!`?null:{ref:$n(r),end:i}}function mr(e,t){let n=e.slice(t,t+7).toUpperCase();for(let[e,r]of tr)if(n.startsWith(e))return[r,t+e.length];return null}function hr(e){let t=e.toUpperCase();for(let e=!0;e;){e=!1;for(let n of cr)t.startsWith(n)&&(t=t.slice(n.length),e=!0)}return t}function gr(e){let t=[],n=e.length,r=0,i=(r,i,a,o)=>{if(e[i]===`#`){let n=mr(e,i);if(!n)throw new R(`bad error literal`,i);return t.push({t:`err`,v:n[0],sheet:a,s:r,e:n[1]}),n[1]}let s=pr(e,i);if(s)return s.ref.sheet=a,t.push({t:`ref`,ref:s.ref,sheetText:o,s:r,e:s.end}),s.end;let c=i;for(;c<n&&ur(e[c]);)c++;if(c===i)throw new R(`expected reference after !`,i);return t.push({t:`name`,v:e.slice(i,c),sheet:a,s:r,e:c}),c};for(;r<n;){let a=e[r],o=r;if(a===` `||a===`\n`||a===`\\r`||a===` `||a===`\\xA0`){for(;r<n&&/[\\s\\u00A0]/.test(e[r]);)r++;t.push({t:`ws`,s:o,e:r});continue}if(a===`"`){let i=``;for(r++;;){if(r>=n)throw new R(`unterminated string`,o);if(e[r]===`"`){if(e[r+1]===`"`){i+=`"`,r+=2;continue}r++;break}i+=e[r++]}t.push({t:`str`,v:i,s:o,e:r});continue}if(a===`#`){let n=mr(e,r);if(!n)throw new R(`bad error literal`,r);t.push({t:`err`,v:n[0],s:o,e:n[1]}),r=n[1];continue}if(a===`\'`){let t=``,a=r+1;for(;;){if(a>=n)throw new R(`unterminated sheet name`,o);if(e[a]===`\'`){if(e[a+1]===`\'`){t+=`\'`,a+=2;continue}break}t+=e[a++]}if(e[a+1]!==`!`)throw new R(`expected \'!\' after sheet name`,a+1);r=i(o,a+2,t,e.slice(r,a+1));continue}if(a===`[`){let t=/\\[\\d+\\][\\w.\\u00A1-\\uFFFF]+!/y;if(t.lastIndex=r,!t.exec(e))throw new R(`unexpected \'[\'`,r);let n=t.lastIndex-1,a=e.slice(r,n);r=i(o,n+1,a,a);continue}if(`(){},;`.includes(a)){t.push({t:`punc`,v:a,s:o,e:++r});continue}let s=e.slice(r,r+2);if(s===`<=`||s===`>=`||s===`<>`)t.push({t:`op`,v:s,s:o,e:r+=2});else if(`+-*/^&=<>%:`.includes(a))t.push({t:`op`,v:a,s:o,e:++r});else if(a>=`0`&&a<=`9`||a===`.`&&/\\d/.test(e[r+1]??``)||a===`$`&&/\\d/.test(e[r+1]??``)){let n=pr(e,r);if(n&&n.ref.kind===`rows`){t.push({t:`ref`,ref:n.ref,s:o,e:n.end}),r=n.end;continue}let i=lr(sr,e,r);if(!i||a===`$`)throw new R(`bad number`,r);r+=i[0].length,t.push({t:`num`,v:Number(i[0]),s:o,e:r})}else if(ur(a)){let a=r;for(;a<n&&ur(e[a]);)a++;let s=e.slice(r,a);if(e[a]===`!`){r=i(o,a+1,s,s);continue}if(e[a]===`(`){t.push({t:`func`,v:hr(s),s:o,e:a}),r=a;continue}let c=pr(e,r);if(c){t.push({t:`ref`,ref:c.ref,s:o,e:c.end}),r=c.end;continue}let l=s.toUpperCase();if(l===`TRUE`||l===`FALSE`){t.push({t:`bool`,v:l===`TRUE`,s:o,e:a}),r=a;continue}if(e[a]===`[`){let t=0;do e[a]===`[`?t++:e[a]===`]`&&t--,a++;while(a<n&&t>0);if(t>0)throw new R(`unterminated [`,r)}t.push({t:`name`,v:e.slice(r,a),s:o,e:a}),r=a}else throw new R(`unexpected character \'${a}\'`,r)}return t}function _r(e){let t;try{t=gr(e.trim()).filter(e=>e.t!==`ws`)}catch{return null}let n=t[0];if(!n||n.t!==`ref`)return null;if(t.length===1)return n.ref;let r=t[1],i=t[2];return t.length!==3||r.t!==`op`||r.v!==`:`||i.t!==`ref`||i.ref.sheet!==void 0&&(n.ref.sheet??``).toLowerCase()!==i.ref.sheet.toLowerCase()?null:$n({...n.ref,kind:`area`,r0:Math.min(n.ref.r0,i.ref.r0),c0:Math.min(n.ref.c0,i.ref.c0),r1:Math.max(n.ref.r1,i.ref.r1),c1:Math.max(n.ref.c1,i.ref.c1)})}const vr=/* @__PURE__ */ new Set([`=`,`<>`,`<`,`>`,`<=`,`>=`]);var yr=class{constructor(e){w(this,`toks`,void 0),w(this,`i`,0),this.toks=e}peek(){return this.toks[this.i]}isOp(...e){let t=this.toks[this.i];return t&&t.t===`op`&&e.includes(t.v)?t.v:void 0}isPunc(e){let t=this.toks[this.i];return!!t&&t.t===`punc`&&t.v===e}fail(e){let t=this.toks[this.i];throw new R(e,t?t.s:-1)}expectPunc(e){this.isPunc(e)||this.fail(`expected \'${e}\'`),this.i++}expr(){let e=this.concat();for(let t=this.cmpOp();t;t=this.cmpOp())this.i++,e={type:`binary`,op:t,left:e,right:this.concat()};return e}cmpOp(){let e=this.peek();return e&&e.t===`op`&&vr.has(e.v)?e.v:void 0}concat(){let e=this.add();for(;this.isOp(`&`);)this.i++,e={type:`binary`,op:`&`,left:e,right:this.add()};return e}add(){let e=this.mul();for(let t=this.isOp(`+`,`-`);t;t=this.isOp(`+`,`-`))this.i++,e={type:`binary`,op:t,left:e,right:this.mul()};return e}mul(){let e=this.pow();for(let t=this.isOp(`*`,`/`);t;t=this.isOp(`*`,`/`))this.i++,e={type:`binary`,op:t,left:e,right:this.pow()};return e}pow(){let e=this.postfix();for(;this.isOp(`^`);)this.i++,e={type:`binary`,op:`^`,left:e,right:this.postfix()};return e}postfix(){let e=this.unary();for(;this.isOp(`%`);)this.i++,e={type:`percent`,arg:e};return e}unary(){let e=this.isOp(`-`,`+`);return e?(this.i++,{type:`unary`,op:e,arg:this.unary()}):this.range()}range(){let e=this.primary();for(;this.isOp(`:`);)this.i++,e={type:`range`,left:e,right:this.primary()};return e}primary(){let e=this.peek();switch(e||this.fail(`unexpected end of formula`),this.i++,e.t){case`num`:return{type:`num`,value:e.v};case`str`:return{type:`str`,value:e.v};case`bool`:return{type:`bool`,value:e.v};case`err`:return{type:`err`,code:e.v};case`ref`:return{type:`ref`,ref:e.ref};case`name`:return e.sheet===void 0?{type:`name`,name:e.v}:{type:`name`,name:e.v,sheet:e.sheet};case`func`:return this.expectPunc(`(`),{type:`call`,name:e.v,args:this.args()};case`punc`:if(e.v===`(`){let e=this.expr();if(!this.isPunc(`,`))return this.expectPunc(`)`),e;let t=[e];for(;this.isPunc(`,`);)this.i++,t.push(this.expr());return this.expectPunc(`)`),{type:`union`,items:t}}if(e.v===`{`)return this.array()}return this.i--,this.fail(`unexpected token`)}args(){let e=[];if(this.isPunc(`)`))return this.i++,e;for(;;){if(e.push(this.isPunc(`,`)||this.isPunc(`)`)?{type:`missing`}:this.expr()),this.isPunc(`)`))return this.i++,e;this.expectPunc(`,`)}}array(){let e=[[]];for(;;){e[e.length-1].push(this.arrayItem());let t=this.peek();if(t&&t.t===`punc`||this.fail(`bad array constant`),this.i++,t.v===`}`)break;t.v===`;`?e.push([]):t.v!==`,`&&this.fail(`bad array constant`)}return e.some(t=>t.length!==e[0].length)&&this.fail(`array rows differ in length`),{type:`array`,rows:e}}arrayItem(){let e=this.isOp(`-`,`+`);e&&this.i++;let t=this.peek();return t||this.fail(`bad array constant`),this.i++,t.t===`num`?e===`-`?-t.v:t.v:(e&&this.fail(`bad array constant`),t.t===`str`||t.t===`bool`?t.v:t.t===`err`?new I(t.v):(this.i--,this.fail(`bad array constant`)))}};function br(e){let t=gr(e.startsWith(`=`)?e.slice(1):e).filter(e=>e.t!==`ws`);if(!t.length)throw new R(`empty formula`,0);let n=new yr(t),r=n.expr();if(n.i<t.length)throw new R(`unexpected token`,t[n.i].s);return r}const xr=864e5,Sr=Date.UTC(1899,11,30),Cr=Date.UTC(1904,0,1);let wr=!1;function Tr(){return wr}function Er(e){wr=e}function Dr(e,t,n){let r=/* @__PURE__ */ new Date(0);return r.setUTCFullYear(e,t-1,n),r.getTime()}function Or(e,t,n){let r=Dr(e,t,n);if(wr)return Math.round((r-Cr)/xr);let i=Math.round((r-Sr)/xr);return i<61?i-1:i}function kr(e){let t=Math.floor(e);if(wr){let e=new Date(Cr+t*xr);return{y:e.getUTCFullYear(),m:e.getUTCMonth()+1,d:e.getUTCDate(),dow:((t+5)%7+7)%7}}let n=((t-1)%7+7)%7;if(t===60)return{y:1900,m:2,d:29,dow:n};if(t===0)return{y:1900,m:1,d:0,dow:n};let r=new Date(Sr+(t<60?t+1:t)*xr);return{y:r.getUTCFullYear(),m:r.getUTCMonth()+1,d:r.getUTCDate(),dow:n}}function Ar(e){return Math.round((e-Math.floor(e))*86400)%86400}function jr(e,t){return new Date(Dr(e,t+1,0)).getUTCDate()}function Mr(e){return Or(e.getFullYear(),e.getMonth()+1,e.getDate())+(e.getHours()*3600+e.getMinutes()*60+e.getSeconds()+e.getMilliseconds()/1e3)/86400}const Nr=/^(\\d{1,4}):(\\d{1,2})(?::(\\d{1,2}(?:\\.\\d+)?))?\\s*([ap]m?)?$/i,Pr=/^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T\\s]+(.+))?$/i,Fr=/^(\\d{1,2})[-/](\\d{1,2})[-/](\\d{4}|\\d{2})(?:\\s+(.+))?$/;function Ir(e){let t=Nr.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=t[3]?Number(t[3]):0;if(r>59||i>=60)return null;if(t[4]){if(n<1||n>12)return null;let e=t[4][0].toLowerCase()===`p`;n=n%12+(e?12:0)}return(n*3600+r*60+i)/86400}function Lr(e,t,n){if(t<1||t>12||n<1||n>jr(e,t))return null;let r=Or(e,t,n);return r<0?null:r}function Rr(e){let t=Pr.exec(e),n=null,r;if(t)n=Lr(Number(t[1]),Number(t[2]),Number(t[3])),r=t[4];else if(t=Fr.exec(e)){let e=Number(t[3]);t[3].length===2&&(e+=e<30?2e3:1900),n=Lr(e,Number(t[1]),Number(t[2])),r=t[4]}else return Ir(e);if(n===null)return null;if(r===void 0)return n;let i=Ir(r);return i===null?null:n+i}const zr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Br=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Vr(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];a===`\\\\`&&!r?(n+=a+(e[i+1]??``),i++):(a===`"`&&(r=!r),a===`;`&&!r?(t.push(n),n=``):n+=a)}return t.push(n),t}function Hr(e){return e.replace(/"[^"]*"/g,``).replace(/\\\\./g,``).replace(/\\[[^\\]]*\\]/g,``).replace(/[_*]./g,``)}function Ur(e){return/[ymdhs]/i.test(Hr(e))||/\\[(h+|m+|s+)\\]/i.test(e)}function Wr(e,t){let n=[];for(let e=0;e<t.length;){let r=t[e],i=r.toLowerCase();if(r===`"`){let r=t.indexOf(`"`,e+1),i=r<0?t.length:r;n.push({k:`lit`,v:t.slice(e+1,i)}),e=i+1}else if(r===`\\\\`)n.push({k:`lit`,v:t[e+1]??``}),e+=2;else if(r===`_`)n.push({k:`lit`,v:` `}),e+=2;else if(r===`*`)e+=2;else if(r===`[`){let r=t.indexOf(`]`,e),i=t.slice(e+1,r<0?t.length:r).toLowerCase();/^h+$/.test(i)?n.push({k:`H`,n:i.length}):/^m+$/.test(i)?n.push({k:`N`,n:i.length}):/^s+$/.test(i)&&n.push({k:`S`,n:i.length}),e=r<0?t.length:r+1}else if(t.slice(e,e+5).toUpperCase()===`AM/PM`)n.push({k:`ap`,v:t.slice(e,e+5)}),e+=5;else if(t.slice(e,e+3).toUpperCase()===`A/P`)n.push({k:`ap`,v:t.slice(e,e+3)}),e+=3;else if(`ymdhs`.includes(i)){let r=e;for(;r<t.length&&t[r].toLowerCase()===i;)r++;n.push({k:i===`m`?`M`:i,n:r-e}),e=r}else n.push({k:`lit`,v:r}),e++}let r=n.filter(e=>e.k!==`lit`);r.forEach((e,t)=>{if(e.k!==`M`||e.n>2)return;let n=r[t-1],i=r[t+1];(n&&(n.k===`h`||n.k===`H`)||i&&(i.k===`s`||i.k===`S`))&&(e.k=`m`)});let i=n.some(e=>e.k===`ap`),a=Math.floor(e),o=Math.round((e-a)*86400);o>=86400&&(a++,o-=86400);let s=kr(a),c=Math.floor(o/3600),l=Math.floor(o%3600/60),u=o%60,d=(e,t)=>String(e).padStart(t,`0`),f=``;for(let e of n)switch(e.k){case`lit`:f+=e.v;break;case`y`:f+=e.n<=2?d(s.y%100,2):d(s.y,4);break;case`M`:f+=e.n===1?s.m:e.n===2?d(s.m,2):e.n===3?zr[s.m-1].slice(0,3):e.n===4?zr[s.m-1]:zr[s.m-1][0];break;case`d`:f+=e.n===1?s.d:e.n===2?d(s.d,2):e.n===3?Br[s.dow].slice(0,3):Br[s.dow];break;case`h`:{let t=i?c%12||12:c;f+=e.n>=2?d(t,2):t;break}case`m`:f+=e.n>=2?d(l,2):l;break;case`s`:f+=e.n>=2?d(u,2):u;break;case`H`:f+=d(a*24+c,e.n);break;case`N`:f+=d((a*24+c)*60+l,e.n);break;case`S`:f+=d(((a*24+c)*60+l)*60+u,e.n);break;case`ap`:{let t=c<12,n=e.v.length===5?t?e.v.slice(0,2):e.v.slice(3,5):t?e.v[0]:e.v[2];f+=n;break}}return f}var z=class{constructor(e,t,n,r,i){w(this,`sheet`,void 0),w(this,`r0`,void 0),w(this,`c0`,void 0),w(this,`r1`,void 0),w(this,`c1`,void 0),this.sheet=e,this.r0=t,this.c0=n,this.r1=r,this.c1=i}get h(){return this.r1-this.r0+1}get w(){return this.c1-this.c0+1}},B=class{constructor(e){w(this,`data`,void 0),this.data=e}get h(){return this.data.length}get w(){return this.data[0]?.length??0}},V=class{constructor(e){w(this,`areas`,void 0),this.areas=e}};const Gr=/^([+-])?\\s*\\$?\\s*((?:\\d{1,3}(?:,\\d{3})+|\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*(%?)$/;function Kr(e){let t=e.trim();if(!t)return null;let n=Gr.exec(t);if(n&&/\\d/.test(n[2])){let e=Number(n[2].replace(/,/g,``));if(!Number.isNaN(e))return(n[1]===`-`?-e:e)/(n[3]?100:1)}return Rr(t)}function qr(e){if(!Number.isFinite(e))return`#NUM!`;if(e===0)return`0`;let[t,n]=Math.abs(e).toExponential(14).split(`e`),r=Number(n),i=t.replace(`.`,``).replace(/0+$/,``),a=e<0?`-`:``;if(r>=15||r<-9)return`${a}${i[0]+(i.length>1?`.${i.slice(1)}`:``)}E${r<0?`-`:`+`}${String(Math.abs(r)).padStart(2,`0`)}`;if(r<0)return`${a}0.${`0`.repeat(-r-1)}${i}`;let o=i.slice(0,r+1).padEnd(r+1,`0`),s=i.slice(r+1);return a+o+(s?`.${s}`:``)}function Jr(e){if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e==`boolean`)return+!!e;if(typeof e==`string`){let t=Kr(e);return t===null?L.VALUE:t}return e}function Yr(e){return typeof e==`string`?e:typeof e==`number`?qr(e):e===null?``:typeof e==`boolean`?e?`TRUE`:`FALSE`:e}function Xr(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e!==0;if(e===null)return!1;if(typeof e==`string`){let t=e.toUpperCase();return t===`TRUE`||t!==`FALSE`&&L.VALUE}return e}function H(e){let t=Jr(e);if(t instanceof I)throw t;return t}function U(e){return Math.trunc(H(e))}function W(e){let t=Yr(e);if(t instanceof I)throw t;return t}function Zr(e){let t=Xr(e);if(t instanceof I)throw t;return t}function Qr(e,t){return e===t||Math.abs(e-t)<=Math.max(Math.abs(e),Math.abs(t))*1e-15}const $r=e=>typeof e==`number`?0:typeof e==`string`?1:2;function G(e,t){if(e===null&&(e=typeof t==`string`?``:typeof t!=`boolean`&&0),t===null&&(t=typeof e==`string`?``:typeof e!=`boolean`&&0),e instanceof I||t instanceof I)return 0;let n=$r(e),r=$r(t);if(n!==r)return n<r?-1:1;if(typeof e==`number`){let n=t;return Qr(e,n)?0:e<n?-1:1}if(typeof e==`string`){let n=e.toLowerCase(),r=t.toLowerCase();return n<r?-1:+(n>r)}return!!e-+!!t}function ei(e,t){return e===null||t===null?e===t:e instanceof I||t instanceof I?!1:typeof e==typeof t&&G(e,t)===0}const ti=e=>/[*?~]/.test(e);function ni(e,t=!0){let n=``;for(let t=0;t<e.length;t++){let r=e[t];r===`~`&&t+1<e.length&&`*?~`.includes(e[t+1])?n+=`\\\\${e[++t]}`:n+=r===`*`?`[\\\\s\\\\S]*`:r===`?`?`[\\\\s\\\\S]`:r.replace(/[.*+?^${}()|[\\]\\\\/]/g,`\\\\$&`)}return new RegExp(t?`^${n}$`:n,`i`)}function ri(e,t){switch(e){case`<`:return t<0;case`<=`:return t<=0;case`>`:return t>0;case`>=`:return t>=0;case`<>`:return t!==0;default:return t===0}}const ii=e=>Wn.find(t=>t===e.toUpperCase());function ai(e){if(e instanceof I){let t=e.code;return e=>e instanceof I&&e.code===t}if(e===null&&(e=0),typeof e==`number`){let t=e;return e=>typeof e==`number`&&Qr(e,t)||typeof e==`string`&&Kr(e)===t}if(typeof e==`boolean`){let t=e;return e=>e===t}let t=/^(<=|>=|<>|<|>|=)?([\\s\\S]*)$/.exec(e),n=t[1]??``,r=t[2],i=n===``||n===`=`;if(r===``)return n===``?e=>e===null||e===``:n===`=`?e=>e===null:n===`<>`?e=>e!==null&&e!==``:()=>!1;let a=Kr(r);if(a!==null)return i?e=>typeof e==`number`&&Qr(e,a)||typeof e==`string`&&Kr(e)===a:n===`<>`?e=>!(typeof e==`number`&&Qr(e,a)):e=>typeof e==`number`&&ri(n,G(e,a));let o=r.toUpperCase();if(o===`TRUE`||o===`FALSE`){let e=o===`TRUE`;return i?t=>t===e:n===`<>`?t=>t!==e:t=>typeof t==`boolean`&&ri(n,G(t,e))}let s=ii(r);if(s){let e=e=>e instanceof I&&e.code===s;return n===`<>`?t=>!e(t):t=>e(t)}if(i||n===`<>`){let e=ni(r),t=t=>typeof t==`string`&&e.test(t);return n===`<>`?e=>!t(e):t}return e=>typeof e==`string`&&ri(n,G(e,r))}const K=1/0;function oi(e){try{return e()}catch(e){if(e instanceof I)return e;throw e}}function si(e,t,n){let r=e.length===1?0:t,i=e[0].length===1?0:n;return r<e.length&&i<e[0].length?e[r][i]:L.NA}function q(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!0,fn:(e,t,r)=>{let i=1,a=1,o=!1,s=e.map(e=>{if(e instanceof z){if(e.h===1&&e.w===1)return t.cell(e.sheet,e.r0,e.c0);if(r)return t.scalar(e)}else if(e instanceof B){if(e.h===1&&e.w===1)return e.data[0][0]}else if(e instanceof V)return L.VALUE;else return e;let n=t.toArray(e);return o=!0,i=Math.max(i,n.length),a=Math.max(a,n[0].length),n});if(!o)return oi(()=>n(s,t));let c=[];for(let e=0;e<i;e++){let r=[];for(let i=0;i<a;i++){let a=s.map(t=>Array.isArray(t)?si(t,e,i):t);r.push(oi(()=>n(a,t)))}c.push(r)}return new B(c)}}}function J(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!1,fn:n}}function ci(e,t,n){return{kind:`lazy`,min:e,max:t,fn:n}}function li(e,t,n,r){if(e instanceof z)t.forEach(e,n);else if(e instanceof V)for(let r of e.areas)t.forEach(r,n);else if(e instanceof B)for(let t of e.data)for(let e of t)n(e);else r(e)}function ui(e,t,n){for(let r of e)li(r,t,e=>{if(typeof e==`number`)n(e);else if(e instanceof I)throw e},e=>{let t=Jr(e);if(t instanceof I)throw t;n(t)})}function Y(e,t){let n=[];return ui(e,t,e=>n.push(e)),n}function di(e){return e.length===1?e[0]:e.flat()}function X(e,t,n){if(e.length<=t)return n;let r=Jr(e[t]);if(r instanceof I)throw r;return r}function fi(e){let t=H(e);if(t<0)throw L.NUM;return t}const pi=e=>Math.floor(fi(e));function mi(e,t,n){let r=kr(e),i=r.y*12+(r.m-1)+Math.trunc(t),a=Math.floor(i/12),o=i%12+1,s=Or(a,o,n?jr(a,o):Math.min(r.d,jr(a,o)));if(s<0)throw L.NUM;return s}const hi={1:[0,1],2:[1,1],3:[1,0],11:[1,1],12:[2,1],13:[3,1],14:[4,1],15:[5,1],16:[6,1],17:[0,1]};function gi(e,t,n){if(e>t)throw L.NUM;let r=kr(e),i=kr(t),a=(i.y-r.y)*12+(i.m-r.m)-+(i.d<r.d);switch(n.toUpperCase()){case`D`:return t-e;case`M`:return a;case`Y`:return Math.floor(a/12);case`YM`:return a%12;case`MD`:{if(i.d>=r.d)return i.d-r.d;let e=i.m===1?12:i.m-1;return jr(i.m===1?i.y-1:i.y,e)-r.d+i.d}case`YD`:{let e=Or(i.y,r.m,Math.min(r.d,jr(i.y,r.m)));return e>t&&(e=Or(i.y-1,r.m,Math.min(r.d,jr(i.y-1,r.m)))),t-e}}throw L.NUM}function _i(e,t,n){let r=e<=t?1:-1,[i,a]=e<=t?[e,t]:[t,e],o=0;for(let e=i;e<=a;e++){let t=kr(e).dow;t!==0&&t!==6&&!n.has(e)&&o++}return r*o}const vi={TODAY:J(0,0,(e,t)=>Math.floor(Mr(t.now()))),NOW:J(0,0,(e,t)=>Mr(t.now())),DATE:q(3,3,([e,t,n])=>{let r=Math.trunc(H(e));if(r>=0&&r<1900&&(r+=1900),r<0||r>9999)throw L.NUM;let i=Or(r,Math.trunc(H(t)),Math.trunc(H(n)));if(i<0)throw L.NUM;return i}),TIME:q(3,3,([e,t,n])=>{let r=Math.trunc(H(e))*3600+Math.trunc(H(t))*60+Math.trunc(H(n));if(r<0)throw L.NUM;return r%86400/86400}),YEAR:q(1,1,([e])=>kr(pi(e)).y),MONTH:q(1,1,([e])=>kr(pi(e)).m),DAY:q(1,1,([e])=>kr(pi(e)).d),HOUR:q(1,1,([e])=>Math.floor(Ar(fi(e))/3600)),MINUTE:q(1,1,([e])=>Math.floor(Ar(fi(e))%3600/60)),SECOND:q(1,1,([e])=>Ar(fi(e))%60),WEEKDAY:q(1,2,e=>{let t=kr(pi(e[0])).dow,n=hi[Math.trunc(X(e,1,1))];if(!n)throw L.NUM;return(t-n[0]+7)%7+n[1]}),EDATE:q(2,2,([e,t])=>mi(pi(e),H(t),!1)),EOMONTH:q(2,2,([e,t])=>mi(pi(e),H(t),!0)),DATEDIF:q(3,3,([e,t,n])=>gi(pi(e),pi(t),W(n))),DAYS:q(2,2,([e,t])=>Math.floor(H(e))-Math.floor(H(t))),NETWORKDAYS:J(2,3,(e,t)=>{let n=new Set(e.length>2?Y([e[2]],t).map(Math.floor):[]);return _i(pi(t.scalar(e[0])),pi(t.scalar(e[1])),n)})},Z=(e,t,n)=>e.type===`missing`?0:t.eval(e,n);function yi(e,t){let n=[];for(let r of e)li(r,t,e=>{if(typeof e==`boolean`)n.push(e);else if(typeof e==`number`)n.push(e!==0);else if(e instanceof I)throw e},e=>n.push(Zr(e)));if(!n.length)throw L.VALUE;return n}const bi=ci(2,3,(e,t,n)=>{let r=t.operand(t.eval(e[0],n),n),i=e[1],a=e[2];if(!Array.isArray(r)){let e=Xr(r);return e instanceof I?e:e?Z(i,t,n):a?Z(a,t,n):!1}let o=t.operand(Z(i,t,!1),!1),s=a?t.operand(Z(a,t,!1),!1):!1;return new B(r.map((e,t)=>e.map((e,n)=>{let r=Xr(e);if(r instanceof I)return r;let i=r?o:s;return Array.isArray(i)?si(i,t,n):i})))});function xi(e){return ci(2,2,(t,n,r)=>{let i=n.eval(t[0],r),a=n.operand(i,r),o=t=>t instanceof I&&(!e||t.code===`#N/A`);if(Array.isArray(a)){if(!a.some(e=>e.some(o)))return i;let e=n.scalar(Z(t[1],n,!1));return new B(a.map(t=>t.map(t=>o(t)?e:t)))}return o(a)?Z(t[1],n,r):a})}const Si={IF:bi,IFS:ci(2,K,(e,t,n)=>{if(e.length%2)return L.VALUE;for(let r=0;r<e.length;r+=2){let i=t.scalar(t.eval(e[r],n));if(i instanceof I)return i;if(Zr(i))return Z(e[r+1],t,n)}return L.NA}),IFERROR:xi(!1),IFNA:xi(!0),AND:J(1,K,(e,t)=>yi(e,t).every(Boolean)),OR:J(1,K,(e,t)=>yi(e,t).some(Boolean)),XOR:J(1,K,(e,t)=>yi(e,t).filter(Boolean).length%2==1),NOT:q(1,1,([e])=>!Zr(e)),TRUE:J(0,0,()=>!0),FALSE:J(0,0,()=>!1),SWITCH:ci(3,K,(e,t,n)=>{let r=t.scalar(t.eval(e[0],n));if(r instanceof I)return r;let i=1;for(;i+1<e.length;i+=2){let a=t.scalar(Z(e[i],t,n));if(a instanceof I)return a;if(ei(r,a)||r===null&&G(r,a)===0)return Z(e[i+1],t,n)}return i<e.length?Z(e[i],t,n):L.NA}),CHOOSE:ci(2,K,(e,t,n)=>{let r=U(t.scalar(t.eval(e[0],n)));return r<1||r>=e.length?L.VALUE:Z(e[r],t,n)}),ISBLANK:q(1,1,([e])=>e===null),ISNUMBER:q(1,1,([e])=>typeof e==`number`),ISTEXT:q(1,1,([e])=>typeof e==`string`),ISNONTEXT:q(1,1,([e])=>typeof e!=`string`),ISLOGICAL:q(1,1,([e])=>typeof e==`boolean`),ISERROR:q(1,1,([e])=>e instanceof I),ISERR:q(1,1,([e])=>e instanceof I&&e.code!==`#N/A`),ISNA:q(1,1,([e])=>e instanceof I&&e.code===`#N/A`),ISEVEN:q(1,1,([e])=>Math.trunc(H(e))%2==0),ISODD:q(1,1,([e])=>Math.abs(Math.trunc(H(e)))%2==1),NA:J(0,0,()=>L.NA),"ERROR.TYPE":q(1,1,([e])=>e instanceof I?Wn.indexOf(e.code)+1:L.NA),N:q(1,1,([e])=>e instanceof I||typeof e==`number`?e:typeof e==`boolean`?+!!e:0),T:q(1,1,([e])=>e instanceof I||typeof e==`string`?e:``)};function Ci(e,t,n){if(n&&typeof t==`string`&&ti(t)){let n=ni(t);return e.findIndex(e=>typeof e==`string`&&n.test(e))}return e.findIndex(e=>ei(e,t))}function wi(e,t,n){let r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===null||a instanceof I||typeof a!=typeof t)continue;let o=G(a,t);if(n===1?o<=0:o>=0)r=i;else break}return r}function Ti(e,t){let n=t.scalar(e);if(n instanceof I)throw n;return n}function Ei(e,t){if(e instanceof V)throw L.VALUE;return t.toArray(e)}function Di(e,t,n){let r=Ti(e[0],t),i=Ei(e[1],t),a=U(t.scalar(e[2])),o=e.length>3?Zr(t.scalar(e[3])):!0,s=n?i[0].length:i.length;if(a<1)throw L.VALUE;if(a>s)throw L.REF;let c=n?i.map(e=>e[0]):i[0],l=o?wi(c,r,1):Ci(c,r,!0);if(l<0)throw L.NA;return n?i[l][a-1]:i[a-1][l]}function Oi(e,t){let n=Ti(e[0],t),r=Ei(e[1],t);if(r.length>1&&r[0].length>1)throw L.NA;let i=di(r),a=e.length>2?Math.sign(H(t.scalar(e[2]))):1,o=a===0?Ci(i,n,!0):wi(i,n,a);if(o<0)throw L.NA;return o+1}function ki(e,t,n,r){if(e instanceof z)return r?new z(e.sheet,e.r0+n,e.c0,e.r0+n,e.c1):new z(e.sheet,e.r0,e.c0+n,e.r1,e.c0+n);let i=r?[t[n]]:t.map(e=>[e[n]]);return i[0].length===1&&i.length===1?i[0][0]:new B(i)}function Ai(e,t){let n=Ti(e[0],t),r=Ei(e[1],t),i=Ei(e[2],t),a=r[0].length===1;if(!a&&r.length!==1||(a?i.length!==r.length:i[0].length!==r[0].length))throw L.VALUE;let o=e.length>3&&e[3]!==null?e[3]:void 0,s=e.length>4?U(t.scalar(e[4])):0,c=e.length>5?U(t.scalar(e[5])):1,l=di(r),u=c<0;u&&(l=[...l].reverse());let d=-1;if(s===0||s===2)d=Ci(l,n,s===2);else if(s===1||s===-1){if(d=Ci(l,n,!1),d<0){let e=null;for(let t=0;t<l.length;t++){let r=l[t];if(r===null||r instanceof I||typeof r!=typeof n)continue;let i=G(r,n);(s===1?i>0&&(e===null||G(r,e)<0):i<0&&(e===null||G(r,e)>0))&&(e=r,d=t)}}}else throw L.VALUE;if(d<0){if(o!==void 0)return o;throw L.NA}return u&&(d=l.length-1-d),ki(e[2],i,d,a)}function ji(e,t){let n=Ti(e[0],t),r=Ei(e[1],t),i,a;e.length>2?(i=di(r),a=di(Ei(e[2],t))):r[0].length>r.length?(i=r[0],a=r[r.length-1]):(i=r.map(e=>e[0]),a=r.map(e=>e[e.length-1]));let o=wi(i,n,1);if(o<0||o>=a.length)throw L.NA;return a[o]}function Mi(e,t){let n=e[0];if(n instanceof V){let r=e.length>3?U(t.scalar(e[3])):1;if(r<1||r>n.areas.length)throw L.REF;n=n.areas[r-1]}let r=n instanceof z||n instanceof B?n.h:1,i=n instanceof z||n instanceof B?n.w:1,a=U(t.scalar(e[1])),o;if(e.length>2?o=U(t.scalar(e[2])):r===1?[a,o]=[1,a]:o=+(i===1),a<0||o<0||a>r||o>i)throw L.REF;if(n instanceof z){let[e,t]=a?[n.r0+a-1,n.r0+a-1]:[n.r0,n.r1],[r,i]=o?[n.c0+o-1,n.c0+o-1]:[n.c0,n.c1];return new z(n.sheet,e,r,t,i)}if(n instanceof B){let e=(a?[n.data[a-1]]:n.data).map(e=>o?[e[o-1]]:e);return e.length===1&&e[0].length===1?e[0][0]:new B(e)}return n}function Ni(e,t){let n=e[0];if(!(n instanceof z))throw L.VALUE;let r=U(t.scalar(e[1])),i=U(t.scalar(e[2])),a=e.length>3&&e[3]!==null?U(t.scalar(e[3])):n.h,o=e.length>4&&e[4]!==null?U(t.scalar(e[4])):n.w;if(a===0||o===0)throw L.REF;let s=n.r0+r,c=n.c0+i,l=s+a-1,u=c+o-1;if(a<0&&([s,l]=[s+a+1,s]),o<0&&([c,u]=[c+o+1,c]),s<0||c<0||l>1048575||u>16383)throw L.REF;return new z(n.sheet,s,c,l,u)}function Pi(e,t){let n=/^(?:(?:\'((?:[^\']|\'\')+)\'|([^\'!]+))!)?(R(\\[-?\\d+\\]|\\d*)C(\\[-?\\d+\\]|\\d*))(?::(R(\\[-?\\d+\\]|\\d*)C(\\[-?\\d+\\]|\\d*)))?$/i.exec(e.trim());if(!n)return null;let r=(e,t)=>e===``?t:e[0]===`[`?t+Number(e.slice(1,-1)):Number(e)-1,i=r(n[4],t.r),a=r(n[5],t.c),o=n[6]?r(n[7],t.r):i,s=n[6]?r(n[8],t.c):a;return{sheet:n[1]===void 0?n[2]:n[1].replace(/\'\'/g,`\'`),kind:`area`,r0:Math.min(i,o),c0:Math.min(a,s),r1:Math.max(i,o),c1:Math.max(a,s),ar0:!0,ac0:!0,ar1:!0,ac1:!0}}function Fi(e,t){let n=W(t.scalar(e[0])),r=!(e.length>1)||Zr(t.scalar(e[1]))?_r(n):Pi(n,t);if(!r||r.r0<0||r.c0<0||r.r1>1048575||r.c1>16383||r.sheet!==void 0&&!t.hasSheet(r.sheet))throw L.REF;return new z(r.sheet??t.sheet,r.r0,r.c0,r.r1,r.c1)}function Ii(e,t,n,r){if(!e.length||e[0]===null)return(r?t.r:t.c)+1;let i=e[0];if(!(i instanceof z))throw L.VALUE;let a=r?i.r0:i.c0,o=r?i.h:i.w;if(o===1||n)return a+1;let s=Array.from({length:o},(e,t)=>a+t+1);return new B(r?s.map(e=>[e]):[s])}function Li(e,t){if(e instanceof z||e instanceof B)return t?e.h:e.w;if(e instanceof V)throw L.REF;if(e instanceof I)throw e;return 1}const Ri={VLOOKUP:J(3,4,(e,t)=>Di(e,t,!0)),HLOOKUP:J(3,4,(e,t)=>Di(e,t,!1)),XLOOKUP:J(3,6,Ai),MATCH:J(2,3,Oi),LOOKUP:J(2,3,ji),INDEX:J(2,4,Mi),OFFSET:J(3,5,Ni),INDIRECT:J(1,2,Fi),ROW:J(0,1,(e,t,n)=>Ii(e,t,n,!0)),COLUMN:J(0,1,(e,t,n)=>Ii(e,t,n,!1)),ROWS:J(1,1,([e])=>Li(e,!0)),COLUMNS:J(1,1,([e])=>Li(e,!1))};function zi(e,t){if(t>15)return e;let n=10**Math.abs(t),r=Math.abs(e),i=t>=0?r*n:r/n;i=Math.floor(Number(i.toPrecision(15))+.5);let a=t>=0?i/n:i*n;return e<0?-a:a}function Bi(e,t,n){let r=``,i=``,a=``,o=0,s=e=>{a?i+=e:r+=e};for(let e=0;e<t.length;e++){let n=t[e];if(n===`"`){let n=t.indexOf(`"`,e+1),r=n<0?t.length:n;s(t.slice(e+1,r)),e=r}else if(n===`\\\\`)s(t[++e]??``);else if(n===`_`)s(` `),e++;else if(n===`*`)e++;else if(n===`[`){let n=t.indexOf(`]`,e);e=n<0?t.length:n}else`0#?`.includes(n)||(n===`.`||n===`,`)&&!i?a+=n:(n===`%`&&o++,s(n))}let c=a,l=e*100**o;for(;c.endsWith(`,`);)c=c.slice(0,-1),l/=1e3;let u=c.indexOf(`.`),d=u<0?c:c.slice(0,u),f=u<0?``:c.slice(u+1),p=(f.match(/[0#?]/g)??[]).length,m=(f.match(/[0?]/g)??[]).length,h=(d.match(/[0?]/g)??[]).length,g=zi(Math.abs(l),p),[_,v=``]=g.toFixed(p).split(`.`);for(_===`0`&&h===0&&(_=``),_=_.padStart(h,`0`),d.includes(`,`)&&(_=_.replace(/\\B(?=(\\d{3})+(?!\\d))/g,`,`));v.length>m&&v.endsWith(`0`);)v=v.slice(0,-1);let y=c===``?``:_+(u>=0?`.${v}`:``);return(n&&l<0&&g!==0?`-`:``)+r+y+i}function Vi(e,t){if(e instanceof I)throw e;if(typeof e==`boolean`)return e?`TRUE`:`FALSE`;let n,r=Vr(t);if(typeof e==`string`){let t=Kr(e);if(t===null){let t=r.length>3?r[3]:r.find(e=>e.includes(`@`));return t===void 0?e:t.replace(/"([^"]*)"/g,`$1`).replace(/@/g,e)}n=t}else n=e??0;let i=r[0],a=!0;if(n<0&&r.length>1&&r[1]!==``?(i=r[1],a=!1):n===0&&r.length>2&&r[2]!==``&&(i=r[2]),/^\\s*general\\s*$/i.test(i)||i===``)return qr(a?n:Math.abs(n));if(Ur(i)){if(n<0)throw L.VALUE;return Wr(n,i)}return Bi(a?n:Math.abs(n),i,a)}const Hi=e=>Number(e.toPrecision(15));function Ui(e,t,n){if(t>15)return e;let r=10**Math.abs(t),i=Math.abs(e),a=Hi(t>=0?i*r:i/r);a=n?Math.ceil(a):Math.floor(a);let o=t>=0?a/r:a*r;return e<0?-o:o}function Wi(e){if(!Number.isFinite(e))throw L.NUM;return e}const Gi=(e,t,n)=>Hi((n?Math.ceil:Math.floor)(Hi(e/t))*t);function Ki(e,t){for(;t;)[e,t]=[t,e%t];return e}function qi(e,t){return Y(e,t).map(e=>{if(e<0)throw L.NUM;return Math.trunc(e)})}const Ji={ABS:q(1,1,([e])=>Math.abs(H(e))),ROUND:q(2,2,([e,t])=>zi(H(e),U(t))),ROUNDUP:q(2,2,([e,t])=>Ui(H(e),U(t),!0)),ROUNDDOWN:q(2,2,([e,t])=>Ui(H(e),U(t),!1)),TRUNC:q(1,2,e=>Ui(H(e[0]),Math.trunc(X(e,1,0)),!1)),INT:q(1,1,([e])=>Math.floor(H(e))),MOD:q(2,2,([e,t])=>{let n=H(e),r=H(t);if(r===0)throw L.DIV0;return Hi(n-r*Math.floor(n/r))}),POWER:q(2,2,([e,t])=>{let n=H(e),r=H(t);if(n===0&&r===0)throw L.NUM;if(n===0&&r<0)throw L.DIV0;let i=n**+r;if(Number.isNaN(i))throw L.NUM;return Wi(i)}),SQRT:q(1,1,([e])=>{let t=H(e);if(t<0)throw L.NUM;return Math.sqrt(t)}),EXP:q(1,1,([e])=>Wi(Math.exp(H(e)))),LN:q(1,1,([e])=>{let t=H(e);if(t<=0)throw L.NUM;return Math.log(t)}),LOG:q(1,2,e=>{let t=H(e[0]),n=X(e,1,10);if(t<=0||n<=0)throw L.NUM;if(n===1)throw L.DIV0;return Hi(Math.log(t)/Math.log(n))}),LOG10:q(1,1,([e])=>{let t=H(e);if(t<=0)throw L.NUM;return Math.log10(t)}),PI:J(0,0,()=>Math.PI),SIGN:q(1,1,([e])=>Math.sign(H(e))),CEILING:q(1,2,e=>{let t=H(e[0]),n=X(e,1,1);if(n===0||t===0)return 0;if(t>0&&n<0)throw L.NUM;return Gi(t,n,!0)}),FLOOR:q(1,2,e=>{let t=H(e[0]),n=X(e,1,1);if(n===0)throw L.DIV0;if(t>0&&n<0)throw L.NUM;return Gi(t,n,!1)}),"CEILING.MATH":q(1,3,e=>{let t=H(e[0]),n=Math.abs(X(e,1,1));return n===0||t===0?0:t<0&&X(e,2,0)!==0?-Gi(-t,n,!0):Gi(t,n,!0)}),"FLOOR.MATH":q(1,3,e=>{let t=H(e[0]),n=Math.abs(X(e,1,1));return n===0||t===0?0:t<0&&X(e,2,0)!==0?-Gi(-t,n,!1):Gi(t,n,!1)}),RAND:J(0,0,()=>Math.random()),RANDBETWEEN:q(2,2,([e,t])=>{let n=Math.ceil(H(e)),r=Math.floor(H(t));if(n>r)throw L.NUM;return n+Math.floor(Math.random()*(r-n+1))}),FACT:q(1,1,([e])=>{let t=Math.trunc(H(e));if(t<0)throw L.NUM;let n=1;for(let e=2;e<=t;e++)n*=e;return Wi(n)}),EVEN:q(1,1,([e])=>{let t=H(e),n=Math.ceil(Hi(Math.abs(t)/2))*2;return t<0?-n:n}),ODD:q(1,1,([e])=>{let t=H(e),n=Math.ceil(Hi(Math.abs(t)));return n%2==0&&n++,t<0?-n:n}),GCD:J(1,K,(e,t)=>qi(e,t).reduce((e,t)=>Ki(e,t),0)),LCM:J(1,K,(e,t)=>Wi(qi(e,t).reduce((e,t)=>e===0||t===0?0:e/Ki(e,t)*t,1)))};function Yi(e){let t=0;for(let n of e)t+=n;return t}function Xi(e){if(!e.length)throw L.DIV0;return Yi(e)/e.length}function Zi(e,t){let n=e.length;if(n<(t?2:1))throw L.DIV0;let r=Yi(e)/n,i=0;for(let t of e)i+=(t-r)*(t-r);return i/(t?n-1:n)}function Qi(e){if(!e.length)throw L.NUM;let t=[...e].sort((e,t)=>e-t),n=t.length>>1;return t.length%2?t[n]:(t[n-1]+t[n])/2}function $i(e){let t=/* @__PURE__ */ new Map,n=0,r=1;for(let i of e){let e=(t.get(i)??0)+1;t.set(i,e),e>r&&(n=i,r=e)}if(r<2)throw L.NA;for(let n of e)if(t.get(n)===r)return n;return n}function ea(e,t){return Y([e],t)}function ta(e,t,n){let r=ea(e[0],t),i=Math.ceil(H(t.scalar(e[1])));if(i<1||i>r.length)throw L.NUM;return r.sort((e,t)=>n?t-e:e-t),r[i-1]}function na(e,t){let n=H(t.scalar(e[0])),r=ea(e[1],t),i=e.length>2&&H(t.scalar(e[2]))!==0;if(!r.includes(n))throw L.NA;let a=1;for(let e of r)(i?e<n:e>n)&&a++;return a}function ra(e,t){if(e instanceof V)throw L.VALUE;return t.toArray(e)}function ia(e,t,n,r){return e instanceof z?r.toArray(new z(e.sheet,e.r0,e.c0,e.r0+t-1,e.c0+n-1)):ra(e,r)}function aa(e,t,n,r){let i=[],a=[];for(let e=0;e<t.length;e+=2)i.push(e===0&&r?r:ra(t[e],n)),a.push(ai(n.scalar(t[e+1])));let o=i[0].length,s=i[0][0].length;for(let e of i)if(e.length!==o||e[0].length!==s)throw L.VALUE;if(e&&(e.length!==o||e[0].length!==s))throw L.VALUE;let c=[];for(let t=0;t<o;t++)for(let n=0;n<s;n++){let r=!0;for(let e=0;r&&e<i.length;e++)r=a[e](i[e][t][n]);r&&c.push(!e||e[t][n])}return c}function oa(e){let t=[];for(let n of e)if(typeof n==`number`)t.push(n);else if(n instanceof I)throw n;return t}function sa(e,t){let n=ra(e[0],t);return oa(aa(e.length>2&&e[2]!==null?ia(e[2],n.length,n[0].length,t):n,[e[0],e[1]],t,n))}function ca(e,t){if(e.length%2==0)throw L.VALUE;return oa(aa(ra(e[0],t),e.slice(1),t))}function la(e,t){let n=e.map(e=>ra(e,t)),r=n[0].length,i=n[0][0].length;for(let e of n)if(e.length!==r||e[0].length!==i)throw L.VALUE;let a=0;for(let e=0;e<r;e++)for(let t=0;t<i;t++){let r=1;for(let i of n){let n=i[e][t];if(n instanceof I)throw n;r*=typeof n==`number`?n:0}a+=r}return a}function ua(e,t){if(!e.length)return 0;let n=e[0];for(let r of e)(t?r>n:r<n)&&(n=r);return n}const da={SUM:J(0,K,(e,t)=>{let n=0;return ui(e,t,e=>n+=e),n}),PRODUCT:J(0,K,(e,t)=>{let n=Y(e,t);return n.length?n.reduce((e,t)=>e*t,1):0}),AVERAGE:J(1,K,(e,t)=>Xi(Y(e,t))),MIN:J(1,K,(e,t)=>{let n=K;return ui(e,t,e=>n=Math.min(n,e)),n===K?0:n}),MAX:J(1,K,(e,t)=>{let n=-1/0;return ui(e,t,e=>n=Math.max(n,e)),n===-1/0?0:n}),COUNT:J(0,K,(e,t)=>{let n=0;for(let r of e)li(r,t,e=>typeof e==`number`&&n++,e=>(typeof e==`number`||typeof e==`boolean`||typeof e==`string`&&Kr(e)!==null)&&n++);return n}),COUNTA:J(1,K,(e,t)=>{let n=0;for(let r of e)li(r,t,e=>e!==null&&n++,()=>n++);return n}),COUNTBLANK:J(1,1,([e],t)=>{if(e instanceof z){let n=0,r=0;return t.forEach(e,e=>{n++,(e===null||e===``)&&r++}),r+(e.h*e.w-n)}if(e instanceof B)return di(e.data).filter(e=>e===null||e===``).length;throw L.VALUE}),MEDIAN:J(1,K,(e,t)=>Qi(Y(e,t))),MODE:J(1,K,(e,t)=>$i(Y(e,t))),"MODE.SNGL":J(1,K,(e,t)=>$i(Y(e,t))),STDEV:J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!0))),"STDEV.S":J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!0))),"STDEV.P":J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!1))),STDEVP:J(1,K,(e,t)=>Math.sqrt(Zi(Y(e,t),!1))),VAR:J(1,K,(e,t)=>Zi(Y(e,t),!0)),"VAR.S":J(1,K,(e,t)=>Zi(Y(e,t),!0)),"VAR.P":J(1,K,(e,t)=>Zi(Y(e,t),!1)),VARP:J(1,K,(e,t)=>Zi(Y(e,t),!1)),LARGE:J(2,2,(e,t)=>ta(e,t,!0)),SMALL:J(2,2,(e,t)=>ta(e,t,!1)),RANK:J(2,3,na),"RANK.EQ":J(2,3,na),SUMPRODUCT:J(1,K,la),SUMIF:J(2,3,(e,t)=>Yi(sa(e,t))),SUMIFS:J(3,K,(e,t)=>Yi(ca(e,t))),AVERAGEIF:J(2,3,(e,t)=>Xi(sa(e,t))),AVERAGEIFS:J(3,K,(e,t)=>Xi(ca(e,t))),COUNTIF:J(2,2,(e,t)=>aa(null,e,t).length),COUNTIFS:J(2,K,(e,t)=>{if(e.length%2)throw L.VALUE;return aa(null,e,t).length}),MINIFS:J(3,K,(e,t)=>ua(ca(e,t),!1)),MAXIFS:J(3,K,(e,t)=>ua(ca(e,t),!0))},fa=32767;function pa(e){let t=Math.trunc(e);if(t<0)throw L.VALUE;return t}function ma(e){let t=``,n=!1;for(let r of e){let e=r.toLowerCase()!==r.toUpperCase();t+=e?n?r.toLowerCase():r.toUpperCase():r,n=e}return t}function ha(e,t,n,r){if(n<1||n>t.length+1)throw L.VALUE;if(e===``)return n;if(!r){let r=t.indexOf(e,n-1);if(r<0)throw L.VALUE;return r+1}let i=ni(e,!1).exec(t.slice(n-1));if(!i)throw L.VALUE;return i.index+n}const ga={CONCATENATE:q(1,K,e=>e.map(W).join(``)),CONCAT:J(1,K,(e,t)=>{let n=``,r=e=>n+=W(e);for(let n of e)li(n,t,r,r);if(n.length>fa)throw L.VALUE;return n}),TEXTJOIN:J(3,K,(e,t)=>{let n=W(t.scalar(e[0])),r=Zr(t.scalar(e[1])),i=[],a=e=>{let t=W(e);r&&t===``||i.push(t)};for(let n of e.slice(2))li(n,t,a,a);let o=i.join(n);if(o.length>fa)throw L.VALUE;return o}),LEFT:q(1,2,e=>W(e[0]).slice(0,pa(X(e,1,1)))),RIGHT:q(1,2,e=>{let t=W(e[0]);return t.slice(Math.max(0,t.length-pa(X(e,1,1))))}),MID:q(3,3,([e,t,n])=>{let r=Math.trunc(H(t));if(r<1)throw L.VALUE;return W(e).substr(r-1,pa(H(n)))}),LEN:q(1,1,([e])=>W(e).length),UPPER:q(1,1,([e])=>W(e).toUpperCase()),LOWER:q(1,1,([e])=>W(e).toLowerCase()),PROPER:q(1,1,([e])=>ma(W(e))),TRIM:q(1,1,([e])=>W(e).replace(/ {2,}/g,` `).replace(/^ | $/g,``)),SUBSTITUTE:q(3,4,e=>{let t=W(e[0]),n=W(e[1]),r=W(e[2]);if(n===``)return t;if(e.length<4)return t.split(n).join(r);let i=Math.trunc(H(e[3]));if(i<1)throw L.VALUE;let a=-1;for(let e=0;e<i;e++)if(a=t.indexOf(n,a+(e?n.length:1)),a<0)return t;return t.slice(0,a)+r+t.slice(a+n.length)}),REPLACE:q(4,4,([e,t,n,r])=>{let i=W(e),a=Math.trunc(H(t));if(a<1)throw L.VALUE;let o=pa(H(n));return i.slice(0,a-1)+W(r)+i.slice(a-1+o)}),REPT:q(2,2,([e,t])=>{let n=W(e),r=pa(H(t));if(n.length*r>fa)throw L.VALUE;return n.repeat(r)}),FIND:q(2,3,e=>ha(W(e[0]),W(e[1]),Math.trunc(X(e,2,1)),!1)),SEARCH:q(2,3,e=>ha(W(e[0]),W(e[1]),Math.trunc(X(e,2,1)),!0)),EXACT:q(2,2,([e,t])=>W(e)===W(t)),VALUE:q(1,1,([e])=>{if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e!=`string`)throw e instanceof I?e:L.VALUE;let t=Kr(e);if(t===null)throw L.VALUE;return t}),TEXT:q(2,2,([e,t])=>Vi(e,W(t))),CHAR:q(1,1,([e])=>{let t=Math.trunc(H(e));if(t<1||t>255)throw L.VALUE;return String.fromCharCode(t)}),CODE:q(1,1,([e])=>{let t=W(e);if(!t)throw L.VALUE;return t.charCodeAt(0)})},_a={...Ji,...da,...Si,...ga,...vi,...Ri,SINGLE:{kind:`eager`,min:1,max:1,scalarArgs:!1,fn:([e],t)=>t.scalar(e)}};function va(e,t,n){let r;switch(e){case`+`:r=t+n;break;case`-`:r=t-n;break;case`*`:r=t*n;break;case`/`:if(n===0)return L.DIV0;r=t/n;break;default:if(t===0&&n===0)return L.NUM;if(t===0&&n<0)return L.DIV0;r=t**+n}return Number.isFinite(r)?r:L.NUM}function ya(e,t,n){if(t instanceof I)return t;if(n instanceof I)return n;switch(e){case`&`:return Yr(t)+Yr(n);case`=`:return G(t,n)===0;case`<>`:return G(t,n)!==0;case`<`:return G(t,n)<0;case`>`:return G(t,n)>0;case`<=`:return G(t,n)<=0;case`>=`:return G(t,n)>=0}let r=Jr(t);if(r instanceof I)return r;let i=Jr(n);return i instanceof I?i:va(e,r,i)}function ba(e,t){return Array.isArray(e)?new B(e.map(e=>e.map(t))):t(e)}function xa(e,t,n){if(!Array.isArray(e)&&!Array.isArray(t))return n(e,t);let r=Array.isArray(e)?e:[[e]],i=Array.isArray(t)?t:[[t]],a=Math.max(r.length,i.length),o=Math.max(r[0].length,i[0].length),s=[];for(let e=0;e<a;e++){let t=[];for(let a=0;a<o;a++)t.push(n(si(r,e,a),si(i,e,a)));s.push(t)}return new B(s)}var Sa=class{constructor(e){w(this,`provider`,void 0),w(this,`sheet`,void 0),w(this,`r`,void 0),w(this,`c`,void 0),this.provider=e.provider,this.sheet=e.sheet,this.r=e.r,this.c=e.c}eval(e,t){switch(e.type){case`num`:case`str`:case`bool`:return e.value;case`err`:return new I(e.code);case`missing`:return null;case`name`:return L.NAME;case`array`:return new B(e.rows);case`ref`:return this.ref(e.ref);case`range`:return this.rangeOp(e.left,e.right);case`union`:{let t=[];for(let n of e.items){let e=this.eval(n,!1);if(e instanceof z)t.push(e);else if(e instanceof V)t.push(...e.areas);else return e instanceof I?e:L.VALUE}return new V(t)}case`unary`:{let n=this.operand(this.eval(e.arg,t),t);return e.op===`+`?Array.isArray(n)?new B(n):n:ba(n,e=>{let t=Jr(e);return t instanceof I?t:t===0?0:-t})}case`percent`:return ba(this.operand(this.eval(e.arg,t),t),e=>{let t=Jr(e);return t instanceof I?t:t/100});case`binary`:{let n=this.operand(this.eval(e.left,t),t),r=this.operand(this.eval(e.right,t),t),i=e.op;return xa(n,r,(e,t)=>ya(i,e,t))}case`call`:return this.call(e.name,e.args,t)}}ref(e){return e.sheet!==void 0&&!this.hasSheet(e.sheet)?L.REF:new z(e.sheet??this.sheet,e.r0,e.c0,e.r1,e.c1)}rangeOp(e,t){let n=this.eval(e,!1);if(n instanceof I)return n;let r=this.eval(t,!1);return r instanceof I?r:!(n instanceof z)||!(r instanceof z)||!Yn(n.sheet,r.sheet)?L.VALUE:new z(n.sheet,Math.min(n.r0,r.r0),Math.min(n.c0,r.c0),Math.max(n.r1,r.r1),Math.max(n.c1,r.c1))}call(e,t,n){if(!Object.hasOwn(_a,e))return L.NAME;let r=_a[e];if(t.length<r.min||t.length>r.max)return L.VALUE;if(r.kind===`lazy`)return oi(()=>r.fn(t,this,n));let i=t.map(e=>this.eval(e,r.scalarArgs&&n));return oi(()=>r.fn(i,this,n))}hasSheet(e){return!this.provider.hasSheet||this.provider.hasSheet(e)}now(){return this.provider.now?.()??/* @__PURE__ */ new Date}cell(e,t,n){let r=this.provider.value(e,t,n);return r===void 0?null:r}clip(e){let{r1:t,c1:n}=e;if((t===1048575||n===16383)&&this.provider.bounds){let r=this.provider.bounds(e.sheet);t===1048575&&(t=Math.max(e.r0,Math.min(t,r.rows-1))),n===16383&&(n=Math.max(e.c0,Math.min(n,r.cols-1)))}return{r1:t,c1:n}}forEach(e,t){let{r1:n,c1:r}=this.clip(e);for(let i=e.r0;i<=n;i++)for(let n=e.c0;n<=r;n++)t(this.cell(e.sheet,i,n),i-e.r0,n-e.c0)}toArray(e){if(e instanceof z){let{r1:t,c1:n}=this.clip(e),r=[];for(let i=e.r0;i<=t;i++){let t=[];for(let r=e.c0;r<=n;r++)t.push(this.cell(e.sheet,i,r));r.push(t)}return r}if(e instanceof B)return e.data;if(e instanceof V)throw L.VALUE;return[[e]]}intersect(e){return e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):e.w===1&&this.r>=e.r0&&this.r<=e.r1?this.cell(e.sheet,this.r,e.c0):e.h===1&&this.c>=e.c0&&this.c<=e.c1?this.cell(e.sheet,e.r0,this.c):L.VALUE}scalar(e){return e instanceof z?this.intersect(e):e instanceof B?e.data[0][0]:e instanceof V?L.VALUE:e}operand(e,t){return e instanceof z?e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):t?this.intersect(e):this.toArray(e):e instanceof B?e.h===1&&e.w===1?e.data[0][0]:e.data:e instanceof V?L.VALUE:e}};function Ca(e,t){let n=Tr();Er(!!t.provider.date1904);try{let n=new Sa(t),r=n.eval(e,!0),i=r instanceof z?n.intersect(r):r instanceof B?r.data[0][0]:r instanceof V?L.VALUE:r;return i===null?0:typeof i==`number`?Number.isFinite(i)?i+0:L.NUM:i}catch(e){return e instanceof I?e:L.VALUE}finally{Er(n)}}function wa(e,t){let n=e.startsWith(`=`)?`=`:``,r=e.slice(n.length),i;try{i=gr(r)}catch{return e}let a=n,o=0;for(let e of i){let n=t(e);n!==void 0&&(a+=r.slice(o,e.s)+n,o=e.e)}return a+r.slice(o)}const Ta=e=>(e.ref.sheet===void 0?``:`${e.sheetText??Xn(e.ref.sheet)}!`)+`#REF!`;function Ea(e,t,n){return!t&&!n?e:wa(e,e=>{if(e.t!==`ref`)return;let r={...e.ref};return r.kind!==`cols`&&(r.ar0||(r.r0+=t),r.ar1||(r.r1+=t)),r.kind!==`rows`&&(r.ac0||(r.c0+=n),r.ac1||(r.c1+=n)),er(r)?Qn($n(r),e.sheetText):Ta(e)})}function Da(e,t,n,r,i){if(r>0)return e>=n&&(e+=r),t>=n&&(t+=r),e>i?null:[e,Math.min(t,i)];let a=-r,o=n+a;return t<n?[e,t]:e>=o?[e-a,t-a]:e>=n&&t<o?null:[e<n?e:n,t>=o?t-a:n-1]}function Oa(e,t){if(!t.delta)return e;let n=e=>{if(t.sheet===void 0)return e===void 0||t.formulaSheet!==void 0&&Yn(e,t.formulaSheet);let n=e??t.formulaSheet;return n===void 0||Yn(n,t.sheet)};return wa(e,e=>{if(e.t!==`ref`||!n(e.ref.sheet))return;let r={...e.ref};if(t.axis===`row`){if(r.kind===`cols`)return;let n=Da(r.r0,r.r1,t.at,t.delta,Gn);if(!n)return Ta(e);[r.r0,r.r1]=n}else{if(r.kind===`rows`)return;let n=Da(r.c0,r.c1,t.at,t.delta,Kn);if(!n)return Ta(e);[r.c0,r.c1]=n}if(r.r0!==e.ref.r0||r.r1!==e.ref.r1||r.c0!==e.ref.c0||r.c1!==e.ref.c1)return Qn(r,e.sheetText)})}function ka(e,t,n){let r=`${Xn(n)}!`;return wa(e,e=>{if(e.t===`ref`&&e.ref.sheet!==void 0&&Yn(e.ref.sheet,t))return Qn({...e.ref,sheet:n});if((e.t===`err`||e.t===`name`)&&e.sheet!==void 0&&Yn(e.sheet,t))return r+e.v})}function Aa(e){let t=e.sheet===void 0?{}:{sheet:e.sheet};return e.kind===`cell`?{...t,r:e.r0,c:e.c0,absR:e.ar0,absC:e.ac0}:{...t,r0:e.r0,c0:e.c0,r1:e.r1,c1:e.c1}}function ja(e){let t=[],n=e=>{switch(e.type){case`ref`:t.push(Aa(e.ref));break;case`range`:if(e.left.type===`ref`&&e.right.type===`ref`&&Yn(e.left.ref.sheet,e.right.ref.sheet)){let n=e.left.ref,r=e.right.ref;t.push(Aa({...n,kind:`area`,r0:Math.min(n.r0,r.r0),c0:Math.min(n.c0,r.c0),r1:Math.max(n.r1,r.r1),c1:Math.max(n.c1,r.c1)}))}else n(e.left),n(e.right);break;case`unary`:case`percent`:n(e.arg);break;case`binary`:n(e.left),n(e.right);break;case`union`:e.items.forEach(n);break;case`call`:e.args.forEach(n)}};return n(e),t}const Ma=(e,t)=>`${e}:${t}`;var Na=class{constructor(e){w(this,`wb`,void 0),w(this,`asts`,/* @__PURE__ */ new Map),w(this,`cellDeps`,/* @__PURE__ */ new Map),w(this,`rangeDeps`,[]),w(this,`indexed`,!1),w(this,`cur`,0),this.wb=e}invalidate(){this.indexed=!1,this.asts.clear(),this.cellDeps.clear(),this.rangeDeps=[]}sheetIndex(e,t){return e?this.wb.sheets.findIndex(t=>t.name.toLowerCase()===e.toLowerCase()):t}ast(e,t){let n=Ma(e,t),r=this.asts.get(n);if(r===void 0){let i=this.wb.sheetsData.get(e)?.formulas.get(t);try{r=i?br(i):null}catch{r=null}this.asts.set(n,r)}return r}index(){if(!this.indexed){this.indexed=!0;for(let[e,t]of this.wb.sheetsData)for(let n of t.formulas.keys())this.addDeps(e,n)}}addDeps(e,t){let n=this.ast(e,t);if(!n)return;let r=Ma(e,t);for(let t of ja(n)){let n=this.sheetIndex(t.sheet,e);if(!(n<0)){if(`r`in t){let e=Ma(n,t.r*Q+t.c),i=this.cellDeps.get(e);i||this.cellDeps.set(e,i=/* @__PURE__ */ new Set),i.add(r)}else this.rangeDeps.push({sheet:n,r0:t.r0,c0:t.c0,r1:t.r1,c1:t.c1,dep:r})}}}formulaChanged(e,t){if(!this.indexed)return;let n=Ma(e,t);this.asts.delete(n);for(let e of this.cellDeps.values())e.delete(n);this.rangeDeps=this.rangeDeps.filter(e=>e.dep!==n),this.addDeps(e,t)}value(e,t,n){let r=this.wb.sheetsData.get(e)?.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4){if(r[e]!==n)continue;let t=r[e+1],i=r[e+2];switch(t){case 0:return i;case 1:return this.wb.sst[i]??``;case 2:return String(i);case 3:return!!i;case 4:return new I(String(i));case 6:return null;default:return String(i)}}return null}provider(e,t){return{value:(n,r,i)=>{let a=this.sheetIndex(n,this.cur);if(a<0)return new I(`#REF!`);let o=Ma(a,r*Q+i);return t.has(o)?new I(`#REF!`):(e.has(o)&&this.compute(o,e,t),this.value(a,r,i))},bounds:e=>{let t=this.wb.sheetsData.get(this.sheetIndex(e,this.cur));return{rows:(t?.maxRow??-1)+1,cols:(t?.maxCol??-1)+1}},hasSheet:e=>this.sheetIndex(e,-1)>=0,date1904:this.wb.date1904}}compute(e,t,n){t.delete(e);let[r,i]=e.split(`:`).map(Number),a=this.wb.sheetsData.get(r);if(!a||!a.formulas.has(i))return;if(n.has(e)){Pa(a,i,new I(`#REF!`));return}n.add(e);let o=this.ast(r,i),s=this.cur;this.cur=r;let c;try{c=o?Ca(o,{provider:this.provider(t,n),sheet:this.wb.sheets[r]?.name,r:Math.floor(i/Q),c:i%Q}):new I(`#NAME?`)}catch{c=new I(`#VALUE!`)}this.cur=s,n.delete(e),Pa(a,i,c)}recalc(e,t=[]){this.index();let n=/* @__PURE__ */ new Set,r=[],i=e=>{n.has(e)||(n.add(e),r.push(e))};for(let e of t)i(Ma(e.sheet,e.key));let a=/* @__PURE__ */ new Set,o=e=>{if(a.has(e))return;a.add(e);let[t,n]=e.split(`:`).map(Number),r=Math.floor(n/Q),s=n%Q;for(let t of this.cellDeps.get(e)??[])i(t),o(t);for(let e of this.rangeDeps)e.sheet===t&&r>=e.r0&&r<=e.r1&&s>=e.c0&&s<=e.c1&&(i(e.dep),o(e.dep))};for(let t of e)o(Ma(t.sheet,t.key));for(let e of t)o(Ma(e.sheet,e.key));let s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set;for(let e of r)n.has(e)&&(this.compute(e,n,c),s.add(Number(e.split(`:`)[0])));return s}computeMissing(e,t){t.length&&this.recalc([],t.map(t=>({sheet:e,key:t})))}};function Pa(e,t,n){let r=Math.floor(t/Q),i=t%Q,a=e.rows[r];a||(e.rows[r]=a=[]);let o,s;n instanceof I?(o=4,s=n.code):typeof n==`number`?(o=0,s=Number.isFinite(n)?n:0):typeof n==`boolean`?(o=3,s=+!!n):n===null?(o=0,s=0):(o=2,s=n);for(let e=0;e<a.length;e+=4)if(a[e]===i){a[e+1]=o,a[e+2]=s;return}let c=0;for(;c<a.length&&a[c]<i;)c+=4;a.splice(c,0,i,o,s,0)}const Fa={0:`General`,1:`0`,2:`0.00`,3:`#,##0`,4:`#,##0.00`,9:`0%`,10:`0.00%`,11:`0.00E+00`,12:`# ?/?`,13:`# ??/??`,14:`m/d/yyyy`,15:`d-mmm-yy`,16:`d-mmm`,17:`mmm-yy`,18:`h:mm AM/PM`,19:`h:mm:ss AM/PM`,20:`h:mm`,21:`h:mm:ss`,22:`m/d/yyyy h:mm`,37:`#,##0 ;(#,##0)`,38:`#,##0 ;[Red](#,##0)`,39:`#,##0.00;(#,##0.00)`,40:`#,##0.00;[Red](#,##0.00)`,45:`mm:ss`,46:`[h]:mm:ss`,47:`mmss.0`,48:`##0.0E+0`,49:`@`,27:`yyyy"年"m"月"`,30:`m/d/yy`,31:`yyyy"年"m"月"d"日"`,50:`yyyy"年"m"月"`,57:`yyyy"年"m"月"`,58:`m"月"d"日"`},Ia={black:`#000000`,red:`#ff0000`,green:`#00a000`,blue:`#0000ff`,yellow:`#c0c000`,magenta:`#ff00ff`,cyan:`#00c0c0`,white:`#ffffff`},La=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Ra=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function za(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`\\\\`&&!r?(n+=o+(e[a+1]??``),a++):(o===`"`?r=!r:!r&&o===`[`?i=!0:!r&&o===`]`&&(i=!1),o===`;`&&!r&&!i?(t.push(n),n=``):n+=o)}return t.push(n),t}function Ba(e){let t=[],n,r,i=!1,a=0,o=e=>{let n=t[t.length-1];n?.k===`lit`?n.v+=e:t.push({k:`lit`,v:e})},s=e.toLowerCase();for(;a<e.length;){let c=e[a],l=s[a];if(c===`"`){let t=e.indexOf(`"`,a+1);o(e.slice(a+1,t<0?void 0:t)),a=t<0?e.length:t+1}else if(c===`\\\\`)o(e[a+1]??``),a+=2;else if(c===`_`)o(` `),a+=2;else if(c===`*`)a+=2;else if(c===`[`){let s=e.indexOf(`]`,a),c=e.slice(a+1,s<0?void 0:s),l=c.toLowerCase();if(Ia[l])n=Ia[l];else if(/^color\\s*\\d+$/.test(l))n=void 0;else if(/^(h+|m+|s+)$/.test(l))t.push({k:`elapsed`,v:l[0]}),i=!0;else if(c.startsWith(`$`)){let e=c.slice(1).split(`-`)[0];e&&o(e)}else{let e=/^(<=|>=|<>|<|>|=)\\s*(-?[\\d.]+)$/.exec(c);e&&(r={op:e[1],v:Number(e[2])})}a=s<0?e.length:s+1}else if(c===`0`||c===`#`||c===`?`)t.push({k:`digit`,v:c}),a++;else if(c===`.`){if(i&&e[a+1]===`0`){let n=a+1;for(;e[n]===`0`;)n++;t.push({k:`date`,v:e.slice(a,n)}),a=n}else t.push({k:`dot`}),a++}else if(c===`,`)t.push({k:`comma`}),a++;else if(c===`%`)t.push({k:`pct`}),a++;else if(l===`e`&&(e[a+1]===`+`||e[a+1]===`-`))t.push({k:`exp`,sign:e[a+1]===`+`}),a+=2;else if(c===`/`&&t.some(e=>e.k===`digit`))t.push({k:`slash`}),a++;else if(c===`@`)t.push({k:`text`}),a++;else if(s.startsWith(`am/pm`,a))t.push({k:`date`,v:`AM/PM`}),i=!0,a+=5;else if(s.startsWith(`a/p`,a))t.push({k:`date`,v:`A/P`}),i=!0,a+=3;else if(`ymdhs`.includes(l)||l===`g`&&s.startsWith(`ge`,a)||l===`b`){let e=a;for(;s[e]===l;)e++;l===`b`||l===`g`?o(``):(t.push({k:`date`,v:s.slice(a,e)}),i=!0),a=e}else o(c),a++}return{toks:t,color:n,isDate:i,cond:r,hasDigits:t.some(e=>e.k===`digit`)}}const Va=/* @__PURE__ */ new Map;function Ha(e){let t=Va.get(e);return t||(t=za(e).map(Ba),Va.size>2e3&&Va.clear(),Va.set(e,t)),t}function Ua(e){return!e||e===`General`?!1:Ha(e)[0].isDate}function Wa(e){if(!Number.isFinite(e)||Number.isInteger(e)&&Math.abs(e)<1e11)return String(e);let t=Math.abs(e);if(t>=1e11||t<1e-9&&t!==0){let[t,n]=e.toExponential(5).split(`e`);return(t.includes(`.`)?t.replace(/0+$/,``).replace(/\\.$/,``):t)+`E`+(n[0]===`-`?`-`:`+`)+n.replace(/^[+-]/,``).padStart(2,`0`)}let n=Math.max(0,10-Math.floor(Math.log10(t||1))),r=e.toFixed(Math.min(n,15));return r.includes(`.`)&&(r=r.replace(/0+$/,``).replace(/\\.$/,``)),r}function Ga(e){return e.replace(/\\B(?=(\\d{3})+(?!\\d))/g,`,`)}function Ka(e,t){let n=t.toks,r=Math.abs(e),i=n.filter(e=>e.k===`pct`).length;r*=100**i;let a=n.findIndex(e=>e.k===`dot`),o=n.findIndex(e=>e.k===`exp`),s=n.findIndex(e=>e.k===`slash`),c=n.findIndex(e=>e.k===`digit`),l=-1;n.forEach((e,t)=>e.k===`digit`&&(l=t));let u=0;for(let e=l+1;e<n.length&&n[e].k===`comma`;e++)u++;r/=1e3**u;let d=n.some((e,t)=>e.k===`comma`&&t>c&&t<l);if(s>=0)return qa(r,t,e<0);let f=a>=0?a:o>=0?o:l+1,p=a>=0?n.slice(a+1,o>=0?o:void 0).filter(e=>e.k===`digit`):[],m=p.length,h=r,g=0;if(o>=0){let e=n.slice(0,f).filter(e=>e.k===`digit`).length||1;h!==0&&(g=Math.floor(Math.log10(h)),e>1&&(g=Math.floor(g/e)*e),h/=10**g)}let _=h.toFixed(m);o>=0&&Number(_)>=10&&n.slice(0,f).filter(e=>e.k===`digit`).length<=1&&(g+=1,_=(h/10).toFixed(m));let[v,y=``]=_.split(`.`);if(m){let e=y.split(``);for(let t=m-1;t>=0&&e[t]===`0`;t--){let n=p[t].v;if(n===`#`)e[t]=``;else if(n===`?`)e[t]=` `;else break}y=e.join(``)}let b=n.slice(0,f),x=b.filter(e=>e.k===`digit`).filter(e=>e.v===`0`).length;for(v===`0`&&x===0&&(v=``);v.length<x;)v=`0`+v;let S=b.some((e,t)=>e.k===`lit`&&t>c&&t<f),C=``;if(S){let e=v,t=``;for(let r=f-1;r>=0;r--){let i=n[r];i.k===`digit`?(e.length?(t=e[e.length-1]+t,e=e.slice(0,-1)):i.v===`0`?t=`0`+t:i.v===`?`&&(t=` `+t),r===c&&e.length&&(t=e+t,e=``)):i.k===`lit`?t=i.v+t:i.k===`pct`&&(t=`%`+t)}C=t}else{let e=!1,t=d?Ga(v):v;for(let r=0;r<f;r++){let i=n[r];i.k===`digit`?e||(C+=t,e=!0):i.k===`lit`?C+=i.v:i.k===`pct`&&(C+=`%`)}e||(C+=t)}a>=0&&(C+=y.length||p.some(e=>e.v===`0`)?`.`+y:m?`.`:``);let w=o>=0?o:a>=0?a+1:f;for(let e=w;e<n.length;e++){let t=n[e];if(t.k===`exp`){let r=n.slice(e+1).filter(e=>e.k===`digit`).length||1;for(C+=`E`+(g<0?`-`:t.sign?`+`:``)+String(Math.abs(g)).padStart(r,`0`);e+1<n.length&&n[e+1].k===`digit`;)e++}else t.k===`lit`?C+=t.v:t.k===`pct`&&(C+=`%`)}return C}function qa(e,t,n){let r=t.toks,i=r.findIndex(e=>e.k===`slash`),a=r.slice(i+1).filter(e=>e.k===`digit`),o=r.slice(i+1).find(e=>e.k===`lit`&&/^\\d+$/.test(e.v.trim())),s=o?Number(o.v):10**(a.length||1)-1,c=r.slice(0,i).some(e=>e.k===`lit`&&e.v.includes(` `)),l=c?Math.floor(e):0,u=e-l,d=0,f=1;if(o)f=s,d=Math.round(u*s);else{let e=1/0;for(let t=1;t<=s;t++){let n=Math.round(u*t),r=Math.abs(u-n/t);r<e-1e-12&&(e=r,d=n,f=t)}}let p=n?`-`:``;return d===0?p+(c?String(l):`0`):d===f?p+String(l+1):p+(c&&l?l+` `:``)+d+`/`+f}function Ja(e,t=!1){let n=Math.floor(e),r=Math.round((e-n)*864e5),i;return t?i=Date.UTC(1904,0,1):n<60?i=Date.UTC(1899,11,31):(i=Date.UTC(1899,11,30),n===60&&(n=61)),new Date(i+n*864e5+r)}function Ya(e,t,n){let r=Ja(e,n),i=t.toks,a=i.some(e=>e.k===`date`&&(e.v===`AM/PM`||e.v===`A/P`)),o=r.getUTCFullYear(),s=r.getUTCMonth(),c=r.getUTCDate(),l=r.getUTCHours(),u=r.getUTCMinutes(),d=r.getUTCSeconds(),f=r.getUTCMilliseconds(),p=(e,t=2)=>String(e).padStart(t,`0`),m=``,h=e=>{for(let t=e-1;t>=0;t--){let e=i[t];if(e.k===`date`)return e.v[0]===`h`;if(e.k===`elapsed`)return e.v===`h`}for(let t=e+1;t<i.length;t++){let e=i[t];if(e.k===`date`)return e.v[0]===`s`;if(e.k===`elapsed`)return e.v===`s`}return!1};return i.forEach((t,n)=>{if(t.k===`lit`)return m+=t.v;if(t.k===`elapsed`){let n=e*86400;t.v===`h`?m+=Math.floor(n/3600):t.v===`m`?m+=Math.floor(n/60):m+=Math.round(n);return}if(t.k!==`date`){t.k===`digit`?m+=t.v===`0`?`0`:``:t.k===`dot`?m+=`.`:t.k===`comma`?m+=`,`:t.k===`pct`?m+=`%`:t.k===`slash`&&(m+=`/`);return}let i=t.v;switch(i[0]){case`y`:m+=i.length<=2?p(o%100):String(o);break;case`m`:i.length<=2&&h(n)?m+=i.length===2?p(u):String(u):i.length===1?m+=s+1:i.length===2?m+=p(s+1):i.length===3?m+=La[s].slice(0,3):i.length===5?m+=La[s][0]:m+=La[s];break;case`d`:i.length===1?m+=c:i.length===2?m+=p(c):i.length===3?m+=Ra[r.getUTCDay()].slice(0,3):m+=Ra[r.getUTCDay()];break;case`h`:{let e=l;a&&(e=e%12||12),m+=i.length>=2?p(e):String(e);break}case`s`:m+=i.length>=2?p(d):String(d);break;case`.`:m+=`.`+p(Math.floor(f/10**(3-(i.length-1))),i.length-1);break;case`A`:m+=i===`AM/PM`?l<12?`AM`:`PM`:l<12?`A`:`P`}}),m}function Xa(e,t,n=!1){if(!t||t===`General`||t===`general`)return{text:Wa(e)};let r=Ha(t),i=r[0],a=e;if(r.some(e=>e.cond)?i=r.find(t=>{if(!t.cond)return!1;let{op:n,v:r}=t.cond;return n===`<`?e<r:n===`<=`?e<=r:n===`>`?e>r:n===`>=`?e>=r:n===`=`?e===r:e!==r})??r.find(e=>!e.cond)??r[0]:r.length>=3&&e===0&&r[2].toks.length?i=r[2]:r.length>=2&&e<0&&r[1].toks.length&&(i=r[1],a=-e),i.isDate)return e<0||e>2958465?{text:`#`.repeat(8)}:{text:Ya(e,i,n),color:i.color};if(!i.hasDigits){let t=i.toks.map(e=>e.k===`lit`?e.v:e.k===`pct`?`%`:e.k===`text`?Wa(a):``).join(``);return i.toks.some(e=>e.k===`text`)||t?{text:t,color:i.color}:{text:Wa(e),color:i.color}}let o=a<0,s=Ka(a,i);return o&&(s=`-`+s),{text:s,color:i.color}}function Za(e,t){if(!t||!t.includes(`@`))return e;let n=Ha(t),r=n.length>=4?n[3]:n.find(e=>e.toks.some(e=>e.k===`text`));return r?r.toks.map(t=>t.k===`lit`?t.v:t.k===`text`?e:``).join(``):e}const Qa={thin:[1,`solid`],medium:[2,`solid`],thick:[3,`solid`],dashed:[1,`dashed`],dotted:[1,`dotted`],double:[3,`double`],hair:[1,`dotted`],mediumDashed:[2,`dashed`],dashDot:[1,`dashed`],mediumDashDot:[2,`dashed`],dashDotDot:[1,`dotted`],mediumDashDotDot:[2,`dotted`],slantDashDot:[2,`dashed`]};function $a(e,t){let n=mn(e),r=e=>pn(e,t,n),i=/* @__PURE__ */ new Map;for(let t of O(D(e,`numFmts`),`numFmt`))i.set(Number(t.a.numFmtId),t.a.formatCode??`General`);let a=O(D(e,`fonts`),`font`).map(e=>({b:j(D(e,`b`)),i:j(D(e,`i`)),u:D(e,`u`)?D(e,`u`).a.val??`single`:void 0,strike:j(D(e,`strike`)),sz:A(D(e,`sz`)?.a.val),color:r(D(e,`color`)),name:D(e,`name`)?.a.val})),o=O(D(e,`fills`),`fill`).map(e=>{let t=D(e,`patternFill`);if(t){let e=t.a.patternType;return!e||e===`none`?void 0:e===`solid`?r(D(t,`fgColor`))??r(D(t,`bgColor`)):r(D(t,`fgColor`))??`#d9d9d9`}let n=D(e,`gradientFill`);if(n){let e=O(n,`stop`).map(e=>r(D(e,`color`))).filter(Boolean);return e.length>=2?`linear-gradient(${A(n.a.degree,90)+90}deg, ${e.join(`, `)})`:e[0]}}),s=O(D(e,`borders`),`border`).map(e=>{let t={},n=(e,n)=>{let i=e?.a.style;if(!i||i===`none`)return;let[a,o]=Qa[i]??[1,`solid`];t[n]=`${a}px ${o} ${r(D(e,`color`))??`#000`}`};return n(D(e,`left`)??D(e,`start`),`borderLeft`),n(D(e,`right`)??D(e,`end`),`borderRight`),n(D(e,`top`),`borderTop`),n(D(e,`bottom`),`borderBottom`),t}),c=a[0]??{},l={fontFamily:Le(c.name??`Calibri`),fontSize:`${c.sz??11}pt`,color:c.color??`#000000`},u=O(D(e,`cellXfs`),`xf`).map(e=>{let t={},n=A(e.a.numFmtId,0),r=a[A(e.a.fontId,0)];if(r){r.b&&(t.fontWeight=700),r.i&&(t.fontStyle=`italic`);let e=[r.u&&r.u!==`none`?`underline`:``,r.strike?`line-through`:``].filter(Boolean).join(` `);e&&(t.textDecoration=e),(r.u===`double`||r.u===`doubleAccounting`)&&(t.textDecorationStyle=`double`),r.sz&&r.sz!==c.sz&&(t.fontSize=`${r.sz}pt`),r.color&&r.color!==c.color&&(t.color=r.color),r.name&&r.name!==c.name&&(t.fontFamily=Le(r.name))}let l=o[A(e.a.fillId,0)];l&&(t.background=l),Object.assign(t,s[A(e.a.borderId,0)]);let u=D(e,`alignment`),d,f=!1;if(u){let e=u.a.horizontal;e&&e!==`general`&&(d=e,t.textAlign=e===`center`||e===`centerContinuous`?`center`:e===`right`?`right`:e===`justify`||e===`distributed`?`justify`:`left`);let n=u.a.vertical;t.alignItems=n===`top`?`flex-start`:n===`center`?`center`:`flex-end`,f=u.a.wrapText===`1`||u.a.wrapText===`true`,f&&(t.whiteSpace=`pre-wrap`);let r=A(u.a.indent);r&&(t[d===`right`?`paddingRight`:`paddingLeft`]=`${r*9+2}px`);let i=A(u.a.textRotation);i&&(t.textRotate=i===255?255:i>90?90-i:i)}return{numFmt:i.get(n)??Fa[n]??`General`,fontPt:r?.sz??c.sz??11,css:t,hAlign:d,wrap:f}});return u.length||u.push({numFmt:`General`,fontPt:c.sz??11,css:{},wrap:!1}),{xfs:u,baseFont:l}}const Q=16384,eo=e=>e.indexOf(`_x`)>=0?e.replace(/_x([0-9A-Fa-f]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16))):e;function to(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65)break;t=t*26+((r&-33)-64)}return t-1}function no(e){let t=``;for(e++;e>0;){let n=(e-1)%26;t=String.fromCharCode(65+n)+t,e=Math.floor((e-1)/26)}return t}function ro(e){let t=0;for(;t<e.length&&e.charCodeAt(t)>=65;)t++;return[Number(e.slice(t))-1,to(e.slice(0,t))]}function io(e){let[t,n]=e.replace(/\\$/g,``).split(`:`);if(!t)return;let[r,i]=ro(t),[a,o]=n?ro(n):[r,i];return{r0:r,c0:i,r1:a,c1:o}}var ao=class{constructor(){w(this,`shared`,/* @__PURE__ */ new Map),w(this,`depOf`,/* @__PURE__ */ new Map),w(this,`edited`,/* @__PURE__ */ new Set),w(this,`rowAttrs`,/* @__PURE__ */ new Map),w(this,`autoRowH`,/* @__PURE__ */ new Map),w(this,`structural`,!1),w(this,`dirtyCols`,!1),w(this,`dirtyMerges`,!1),w(this,`dirtyView`,!1),w(this,`dirtyRows`,/* @__PURE__ */ new Set),w(this,`formulaChanged`,!1),w(this,`uncached`,[]),w(this,`rows`,[]),w(this,`maxRow`,-1),w(this,`maxCol`,-1),w(this,`formulas`,/* @__PURE__ */ new Map),w(this,`merges`,[]),w(this,`colInfo`,[]),w(this,`defaultColW`,64),w(this,`defaultRowH`,20),w(this,`frozen`,{rows:0,cols:0}),w(this,`gridLines`,!0),w(this,`done`,!1),w(this,`error`,void 0),w(this,`loading`,void 0)}},oo=class{constructor(e,t=[],n=11){w(this,`d`,void 0),w(this,`fontPt`,void 0),w(this,`basePt`,void 0),w(this,`row`,-1),w(this,`rowCells`,null),w(this,`col`,-1),w(this,`cType`,``),w(this,`cStyle`,0),w(this,`val`,``),w(this,`formula`,``),w(this,`hasVal`,!1),w(this,`capture`,0),w(this,`fShared`,-1),w(this,`inIs`,!1),w(this,`newSizes`,[]),w(this,`headerReady`,!1),w(this,`rowHasHt`,!1),w(this,`rowMaxPt`,0),this.d=e,this.fontPt=t,this.basePt=n}open(e,t){switch(e){case`c`:{let e=t.r;this.col=e?ro(e)[1]:this.col+1,this.cType=t.t??``,this.cStyle=t.s?Number(t.s):0,this.val=``,this.formula=``,this.hasVal=!1;return}case`v`:this.capture=1,this.hasVal=!0;return;case`f`:this.capture=2,this.fShared=t.t===`shared`&&t.si!==void 0?Number(t.si):-1;return;case`is`:this.inIs=!0,this.hasVal=!0;return;case`t`:this.inIs&&(this.capture=3);return;case`rPh`:return!0;case`row`:{this.headerReady=!0,this.row=t.r?Number(t.r)-1:this.row+1,this.col=-1,this.rowCells=[];let e=t.hidden===`1`||t.hidden===`true`;if((e||t.ht)&&this.d.rowAttrs.set(this.row,{ht:t.ht?Number(t.ht):void 0,hidden:e||void 0}),this.rowHasHt=e||!!t.ht,this.rowMaxPt=0,e)this.newSizes.push([this.row,0]);else if(t.ht){let e=Math.round(Number(t.ht)*4/3);e!==this.d.defaultRowH&&this.newSizes.push([this.row,e])}return}case`sheetFormatPr`:{let e=A(t.defaultRowHeight);e&&(this.d.defaultRowH=Math.round(e*4/3));let n=A(t.defaultColWidth),r=A(t.baseColWidth);n?this.d.defaultColW=Math.round(n*7):r!==void 0&&(this.d.defaultColW=Math.round(r*7+8));return}case`col`:{let e=Number(t.min)-1,n=Math.min(Number(t.max)-1,16383),r=t.hidden===`1`||t.hidden===`true`?0:t.width?Math.round(Number(t.width)*7):this.d.defaultColW;this.d.colInfo.push({min:e,max:n,w:r});return}case`pane`:(t.state===`frozen`||t.state===`frozenSplit`)&&(this.d.frozen={rows:Math.round(A(t.ySplit,0)),cols:Math.round(A(t.xSplit,0))});return;case`sheetView`:(t.showGridLines===`0`||t.showGridLines===`false`)&&(this.d.gridLines=!1);return;case`sheetData`:this.headerReady=!0;return;case`mergeCell`:{let e=t.ref?io(t.ref):void 0;e&&this.d.merges.push(e);return}case`extLst`:case`conditionalFormatting`:case`dataValidations`:case`headerFooter`:return!0}}close(e){switch(e){case`v`:case`f`:case`t`:this.capture=0;return;case`is`:this.inIs=!1;return;case`c`:{let e=this.rowCells;if(!e)return;let t=this.col;t>this.d.maxCol&&(this.d.maxCol=t);let n=this.row*Q+t;if(this.formula&&this.d.formulas.set(n,this.formula),this.fShared>=0&&(this.formula?this.d.shared.set(this.fShared,{master:n,text:this.formula}):this.d.depOf.set(n,this.fShared),this.fShared=-1),!this.hasVal||this.formula&&this.val===``&&this.cType!==`str`){this.formula?(this.d.uncached.push(this.row*Q+t),e.push(t,6,``,this.cStyle)):this.cStyle&&e.push(t,6,``,this.cStyle);return}let r=0,i;switch(this.cType){case`s`:r=1,i=Number(this.val);break;case`str`:case`inlineStr`:r=2,i=eo(this.val);break;case`b`:r=3,i=+(this.val===`1`||this.val===`true`);break;case`e`:r=4,i=this.val;break;case`d`:r=5,i=this.val;break;default:{let e=Number(this.val);this.val===``||Number.isNaN(e)?(r=this.val===``?6:2,i=this.val):i=e}}if(e.push(t,r,i,this.cStyle),!this.rowHasHt){let e=this.fontPt[this.cStyle]??this.basePt;e>this.rowMaxPt&&(this.rowMaxPt=e)}return}case`row`:if(!this.rowHasHt&&this.rowMaxPt>this.basePt*1.15){let e=Math.round(this.rowMaxPt*(4/3)*1.3+3);e>this.d.defaultRowH&&(this.newSizes.push([this.row,e]),this.d.autoRowH.set(this.row,e))}this.rowCells&&this.rowCells.length&&(this.d.rows[this.row]=this.rowCells),this.row>this.d.maxRow&&(this.d.maxRow=this.row),this.rowCells=null;return}}text(e){this.capture===1?this.val+=e:this.capture===2?this.formula+=e:this.capture===3&&(this.val+=e)}},so=class{constructor(){w(this,`strings`,[]),w(this,`cur`,``),w(this,`capture`,!1)}open(e){if(e===`si`)this.cur=``;else if(e===`t`)this.capture=!0;else if(e===`rPh`||e===`phoneticPr`)return!0}close(e){e===`t`?this.capture=!1:e===`si`&&this.strings.push(eo(this.cur))}text(e){this.capture&&(this.cur+=e)}},co=class e{constructor(e,t,n,r,i,a,o){w(this,`pkg`,void 0),w(this,`mainPath`,void 0),w(this,`rels`,void 0),w(this,`sheets`,void 0),w(this,`styles`,void 0),w(this,`date1904`,void 0),w(this,`theme`,void 0),w(this,`sheetsData`,/* @__PURE__ */ new Map),w(this,`calc`,new Na(this)),w(this,`sst`,[]),w(this,`sstLoading`,void 0),this.pkg=e,this.mainPath=t,this.rels=n,this.sheets=r,this.styles=i,this.date1904=a,this.theme=o}static async open(t,n){let r=await t.xml(n),i=await t.rels(n),a=[];for(let e of O(D(r,`sheets`),`sheet`)){let t=i.get(e.a[`r:id`]);t&&t.type.endsWith(`/worksheet`)&&a.push({name:e.a.name??`Sheet${a.length+1}`,index:a.length,path:t.target,hidden:!!e.a.state&&e.a.state!==`visible`})}let o=M(i,`theme`),s=Ae(o?await t.xml(o.target):void 0),c=M(i,`styles`),l=$a(c?await t.xml(c.target):void 0,s),u=D(r,`workbookPr`),d=u?.a.date1904===`1`||u?.a.date1904===`true`;return new e(t,n,i,a,l,d,s)}meta(){return{sheets:this.sheets,styles:this.styles.xfs.map(e=>e.css),formats:this.styles.xfs.map(e=>e.numFmt),baseFont:this.styles.baseFont,date1904:this.date1904}}loadSst(e){return this.sstLoading||(this.sstLoading=(async()=>{let t=M(this.rels,`sharedStrings`);if(!t||!this.pkg.has(t.target))return;let n=new so;this.sst=n.strings,await me(await this.pkg.stream(t.target,e),n)})()),this.sstLoading}loadSheet(e,t,n){let r=this.sheetsData.get(e);if(r)return r.loading&&!r.done?r.loading.then(()=>t(this.snapshot(e,r,lo(r),!0))):(t(this.snapshot(e,r,lo(r),!0)),r.loading??Promise.resolve());let i=new ao;return this.sheetsData.set(e,i),i.loading=(async()=>{let r=this.sheets[e];if(!r)throw Error(`No sheet #${e}`);try{await this.loadSst((e,t)=>n?.(`strings`,e,t));let a=new oo(i,this.styles.xfs.map(e=>e.fontPt),this.styles.xfs[0]?.fontPt??11),o=!1,s=0;if(await me(await this.pkg.stream(r.path,(e,t)=>n?.(`sheet`,e,t)),a,{onChunk:async()=>{let n=Date.now();!o&&a.headerReady?(o=!0,t(this.snapshot(e,i,a.newSizes.splice(0),!0)),s=n,await new Promise(e=>setTimeout(e,0))):n-s>150&&(s=n,t(this.snapshot(e,i,a.newSizes.splice(0),!1)),await new Promise(e=>setTimeout(e,0)))}}),i.done=!0,t({...this.snapshot(e,i,a.newSizes.splice(0),!o),merges:i.merges}),i.uncached.length){let n=i.uncached.splice(0);(async()=>{await Promise.all(this.sheets.map(t=>t.index===e?null:this.loadSheet(t.index,()=>{}))),this.calc.invalidate(),this.calc.computeMissing(e,n),t({...this.snapshot(e,i,[],!1),recalc:!0})})()}}catch(n){i.done=!0,i.error=n.message,t({...this.snapshot(e,i,[],!0),error:i.error})}})(),i.loading}snapshot(e,t,n,r){let i={sheet:e,rows:t.maxRow+1,cols:t.maxCol+1,rowSizes:n,done:t.done};return r&&(i.colInfo=t.colInfo,i.defaultColW=t.defaultColW,i.defaultRowH=t.defaultRowH,i.frozen=t.frozen,i.gridLines=t.gridLines),t.done&&(i.merges=t.merges),t.error&&(i.error=t.error),i}block(e,t,n){let r=this.sheetsData.get(e),i=[];if(!r)return{sheet:e,r0:t,r1:n,rows:i,complete:!1};let a=this.styles.xfs,o=Math.min(n,r.rows.length);for(let e=t;e<o;e++){let t=r.rows[e];if(!t)continue;let n=[];for(let e=0;e<t.length;e+=4){let r=t[e],i=t[e+1],o=t[e+2],s=t[e+3],c=a[s]??a[0];switch(i){case 0:{let e=Xa(o,c.numFmt,this.date1904);n.push(e.color?[r,e.text,s,1,e.color]:[r,e.text,s,1]);break}case 1:n.push([r,Za(this.sst[o]??``,c.numFmt),s,0]);break;case 2:n.push([r,Za(o,c.numFmt),s,0]);break;case 3:n.push([r,o?`TRUE`:`FALSE`,s,2]);break;case 4:n.push([r,o,s,2]);break;case 5:n.push([r,o.replace(`T00:00:00`,``).replace(`T`,` `).replace(/Z$/,``),s,1]);break;default:n.push([r,``,s,0])}}i.push({r:e,cells:n})}return{sheet:e,r0:t,r1:n,rows:i,complete:r.done||n<=r.maxRow}}find(e,t,n={},r=2e4){let i=this.sheetsData.get(e),a=[];if(!i||!t)return a;let o=e=>n.matchCase?e:e.toLowerCase(),s=o(t),c=this.styles.xfs;for(let e=0;e<i.rows.length&&a.length<r;e++){let t=i.rows[e];if(t)for(let l=0;l<t.length&&a.length<r;l+=4){let r=t[l],u=t[l+1],d=t[l+2],f=n.formulas?i.formulas.get(e*Q+r):void 0,p;if(p=f?`=`+f:u===0?Xa(d,(c[t[l+3]]??c[0])?.numFmt,this.date1904).text:u===1?this.sst[d]??``:u===3?d?`TRUE`:`FALSE`:u===6?``:String(d),!p)continue;let m=o(p);(n.whole?m===s:m.includes(s))&&a.push({r:e,c:r,text:p})}}return a}cell(e,t,n){let r=this.sheetsData.get(e),i=r?.rows[t],a=r?.formulas.get(t*Q+n);if(!i)return a?{value:``,formula:`=`+a,type:`formula`}:void 0;for(let e=0;e<i.length;e+=4){if(i[e]!==n)continue;let t=i[e+1],r=i[e+2],o=t===1?this.sst[r]??``:t===3?r?`TRUE`:`FALSE`:String(r),s=[`number`,`string`,`string`,`boolean`,`error`,`date`,`empty`][t];return{value:o,formula:a?`=`+a:void 0,type:s}}return a?{value:``,formula:`=`+a,type:`formula`}:void 0}unload(e){this.sheetsData.get(e)?.done&&this.sheetsData.delete(e)}};function lo(e){let t=[];for(let[n,r]of e.autoRowH)e.rowAttrs.has(n)||t.push([n,r]);for(let[n,r]of e.rowAttrs)t.push([n,r.hidden?0:r.ht===void 0?e.autoRowH.get(n)??e.defaultRowH:Math.round(r.ht*4/3)]);return t}function uo(e){return{rows:e.rows.map(e=>e&&e.slice()),formulas:new Map(e.formulas),merges:e.merges.map(e=>({...e})),colInfo:e.colInfo.map(e=>({...e})),rowAttrs:new Map([...e.rowAttrs].map(([e,t])=>[e,{...t}])),autoRowH:new Map(e.autoRowH),maxRow:e.maxRow,maxCol:e.maxCol,frozen:{...e.frozen}}}function fo(e,t){e.rows=t.rows.map(e=>e&&e.slice()),e.formulas=new Map(t.formulas),e.merges=t.merges.map(e=>({...e})),e.colInfo=t.colInfo.map(e=>({...e})),e.rowAttrs=new Map([...t.rowAttrs].map(([e,t])=>[e,{...t}])),e.autoRowH=new Map(t.autoRowH),e.maxRow=t.maxRow,e.maxCol=t.maxCol,e.frozen={...t.frozen},e.structural=!0,e.dirtyCols=e.dirtyMerges=e.dirtyView=!0}function po(e){for(let[t,n]of e.depOf){let r=e.shared.get(n);if(!r||e.formulas.has(t))continue;let i=Math.floor(t/Q)-Math.floor(r.master/Q),a=t%Q-r.master%Q;e.formulas.set(t,Ea(r.text,i,a))}e.depOf.clear(),e.shared.clear()}function mo(e,t,n,r){let i=[];for(let a of e){let[e,o]=t===`row`?[a.r0,a.r1]:[a.c0,a.c1];if(r>0)e>=n&&(e+=r),o>=n&&(o+=r);else{let t=n-r;if(e>=n&&o<t||(e=(e=>e<n?e:e>=t?e+r:n)(e),o=o>=t?o+r:o>=n?n-1:o,o<e))continue}let s=t===`row`?{...a,r0:e,r1:o}:{...a,c0:e,c1:o};(s.r0!==s.r1||s.c0!==s.c1)&&i.push(s)}return i}function ho(e,t,n,r,i,a){po(e);let o=r-i;if(n===`row`){i>0?e.rows.splice(r,0,...Array(i).fill(void 0)):e.rows.splice(r,-i),e.maxRow=Math.max(-1,e.maxRow+(e.maxRow>=r?i:0));let t=/* @__PURE__ */ new Map;for(let[n,a]of e.rowAttrs)i<0&&n>=r&&n<o||t.set(n>=r?n+i:n,a);e.rowAttrs=t;let n=/* @__PURE__ */ new Map;for(let[t,a]of e.autoRowH)i<0&&t>=r&&t<o||n.set(t>=r?t+i:t,a);e.autoRowH=n}else{for(let t=0;t<e.rows.length;t++){let n=e.rows[t];if(!n)continue;let a=[];for(let e=0;e<n.length;e+=4){let t=n[e];i<0&&t>=r&&t<o||a.push(t>=r?t+i:t,n[e+1],n[e+2],n[e+3])}e.rows[t]=a.length?a:void 0}e.maxCol=Math.max(-1,e.maxCol+(e.maxCol>=r?i:0));let t=[];for(let n of e.colInfo){let{min:e,max:a}=n;if(i>0)e>=r&&(e+=i),a>=r&&(a+=i);else if(e>=r&&a<o||(e=e<r?e:e>=o?e+i:r,a=a>=o?a+i:a>=r?r-1:a,a<e))continue;t.push({...n,min:e,max:a})}e.colInfo=t,e.dirtyCols=!0}let s={sheet:t,formulaSheet:t,axis:n,at:r,delta:i},c=/* @__PURE__ */ new Map;for(let[t,a]of e.formulas){let e=Math.floor(t/Q),l=t%Q,u=n===`row`?e:l;i<0&&u>=r&&u<o||(u>=r&&(n===`row`?e+=i:l+=i),c.set(e*Q+l,Oa(a,s)))}e.formulas=c;for(let t of a){if(t.d===e)continue;let n=!1;for(let[e,r]of t.d.formulas){let i=Oa(r,{...s,formulaSheet:t.name});i!==r&&(t.d.formulas.set(e,i),t.d.edited.add(e),n=!0)}n&&(t.d.formulaChanged=!0)}e.merges=mo(e.merges,n,r,i),n===`row`&&e.frozen.rows>r&&(e.frozen={...e.frozen,rows:Math.max(0,e.frozen.rows+(i>0?i:Math.max(i,r-e.frozen.rows)))}),n===`col`&&e.frozen.cols>r&&(e.frozen={...e.frozen,cols:Math.max(0,e.frozen.cols+(i>0?i:Math.max(i,r-e.frozen.cols)))}),e.structural=!0,e.dirtyMerges=!0,e.dirtyView=!0}function go(e,t,n){let r=e=>e.r1>=t.r0&&e.r0<=t.r1&&e.c1>=t.c0&&e.c0<=t.c1;e.merges=e.merges.filter(e=>!r(e)),n&&(t.r0!==t.r1||t.c0!==t.c1)&&e.merges.push({...t}),e.dirtyMerges=!0}function _o(e,t,n,r){let i=[];for(let r of e.colInfo)r.max<t||r.min>n?i.push(r):(r.min<t&&i.push({...r,max:t-1}),r.max>n&&i.push({...r,min:n+1}));i.push({min:t,max:n,w:Math.max(0,Math.round(r))}),e.colInfo=i.sort((e,t)=>e.min-t.min),e.dirtyCols=!0}function vo(e,t,n,r){for(let i=t;i<=n;i++)e.rowAttrs.set(i,r>0?{ht:+(r*.75).toFixed(2)}:{...e.rowAttrs.get(i)??{},hidden:!0}),e.dirtyRows.add(i)}const yo=[`b`,`i`,`strike`,`condense`,`extend`,`outline`,`shadow`,`u`,`vertAlign`,`sz`,`color`,`name`,`family`,`charset`,`scheme`],bo=[`fileVersion`,`fileSharing`,`workbookPr`,`workbookProtection`,`bookViews`,`sheets`,`functionGroups`,`externalReferences`,`definedNames`,`calcPr`,`oleSize`,`customWorkbookViews`,`pivotCaches`,`smartTagPr`,`smartTagTypes`,`webPublishing`,`fileRecoveryPr`,`webPublishObjects`,`extLst`],xo=[`numFmts`,`fonts`,`fills`,`borders`,`cellStyleXfs`,`cellXfs`,`cellStyles`,`dxfs`,`tableStyles`,`colors`,`extLst`];function So(e,t,n){let r=e.rows[t];return!r&&n&&(e.rows[t]=r=[]),r}function $(e,t,n){let r=e.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4)if(r[e]===n)return[r[e+1],r[e+2],r[e+3]];return null}function Co(e,t,n,r){let i=So(e,t,!!r);if(!i)return;let a=0;for(;a<i.length&&!(i[a]>=n);a+=4);let o=a<i.length&&i[a]===n;r?(o?(i[a+1]=r[0],i[a+2]=r[1],i[a+3]=r[2]):i.splice(a,0,n,r[0],r[1],r[2]),t>e.maxRow&&(e.maxRow=t),n>e.maxCol&&(e.maxCol=n)):(o&&i.splice(a,4),i.length||(e.rows[t]=void 0))}function wo(e){let t=/^(\\d{4})-(\\d{1,2})-(\\d{1,2})(?:[ T](\\d{1,2}):(\\d{2})(?::(\\d{2}))?)?$/.exec(e),n,r,i;if(t)[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];else{if(t=/^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})(?: (\\d{1,2}):(\\d{2})(?::(\\d{2}))?)?$/.exec(e),!t)return;[i,r,n]=[Number(t[1]),Number(t[2]),Number(t[3])]}let a=Date.UTC(n,r-1,i,Number(t[4]??0),Number(t[5]??0),Number(t[6]??0));if(Number.isFinite(a))return a/864e5+25569}function To(e,t,n=!1){if(e===``)return{e:t?[6,``,t]:null};if(e.startsWith(`=`)&&e.length>1)return{e:[2,e,t],f:e.slice(1)};let r=e.trim();if(/^[-+]?(\\d+\\.?\\d*|\\.\\d+)(e[-+]?\\d+)?$/i.test(r))return{e:[0,Number(r),t]};if(/^[-+]?(\\d+\\.?\\d*|\\.\\d+)%$/.test(r))return{e:[0,Number(r.slice(0,-1))/100,t]};if(/^(true|false)$/i.test(r))return{e:[3,+!!/^true$/i.test(r),t]};if(n){let e=wo(r);if(e!==void 0)return{e:[0,e,t]}}return{e:[2,e,t]}}var Eo=class{constructor(e){w(this,`nodes`,void 0),w(this,`root`,void 0),w(this,`P`,void 0),w(this,`cache`,/* @__PURE__ */ new Map),w(this,`found`,/* @__PURE__ */ new Map),w(this,`changed`,!1),this.nodes=t(e),this.root=a(this.nodes),this.P=i(this.root.q)}section(e){let t=s(this.root,e);return t||(t=d(this.P+e,{count:`0`}),m(this.root,t,e,xo)),t}append(e,t){let n=this.section(e);n.c.push(t),n.self=!1;let r=o(n).length;return u(n,`count`,String(r)),this.changed=!0,r-1}lookup(e){let t=this.found.get(e);if(!t){let r=/* @__PURE__ */ new Map;o(s(this.root,e)).forEach((e,t)=>{let i=n([e]);r.has(i)||r.set(i,t)}),this.found.set(e,t=r)}return t}intern(e,t){let r=n([t]),i=this.lookup(e),a=i.get(r);if(a!==void 0)return a;let o=this.append(e,t);return i.set(r,o),o}numFmtId(e){for(let[t,n]of Object.entries(Fa))if(n===e)return Number(t);let t=s(this.root,`numFmts`),n=163;for(let r of o(t,`numFmt`)){let t=Number(l(r,`numFmtId`));if(l(r,`formatCode`)===e)return t;n=Math.max(n,t)}return this.append(`numFmts`,d(this.P+`numFmt`,{numFmtId:String(n+1),formatCode:e})),n+1}derive(e,n){let r=e+JSON.stringify(n),i=this.cache.get(r);if(i!==void 0)return i;let a=this.P,c=o(this.section(`cellXfs`),`xf`),p=f(c[e]??c[0]??d(a+`xf`,{numFmtId:`0`,fontId:`0`,fillId:`0`,borderId:`0`}));if([`b`,`i`,`u`,`strike`,`color`,`sz`,`font`].some(e=>e in n)){let e=o(this.section(`fonts`),`font`),t=f(e[Number(l(p,`fontId`)??0)]??e[0]??d(a+`font`)),r=(e,n)=>m(t,n,e,yo);n.b!==void 0&&r(`b`,n.b?d(a+`b`):void 0),n.i!==void 0&&r(`i`,n.i?d(a+`i`):void 0),n.strike!==void 0&&r(`strike`,n.strike?d(a+`strike`):void 0),n.u!==void 0&&r(`u`,n.u?d(a+`u`):void 0),n.sz!==void 0&&r(`sz`,d(a+`sz`,{val:String(n.sz)})),`color`in n&&r(`color`,n.color?d(a+`color`,{rgb:`FF`+n.color.replace(`#`,``).toUpperCase()}):void 0),n.font&&(r(`name`,d(a+`name`,{val:n.font})),r(`scheme`,void 0)),u(p,`fontId`,String(this.intern(`fonts`,t))),u(p,`applyFont`,`1`)}if(`fill`in n){if(!n.fill)u(p,`fillId`,`0`);else{let e=t(`<${a}fill><${a}patternFill patternType="solid"><${a}fgColor rgb="FF${n.fill.replace(`#`,``).toUpperCase()}"/><${a}bgColor indexed="64"/></${a}patternFill></${a}fill>`)[0];u(p,`fillId`,String(this.intern(`fills`,e)))}u(p,`applyFill`,`1`)}if(n.border){let e=n.sides??{},t=o(this.section(`borders`),`border`),r=f(t[Number(l(p,`borderId`)??0)]??t[0]??d(a+`border`)),i=(n.borderColor??`#000000`).replace(`#`,``).toUpperCase(),c=[`left`,`start`,`right`,`end`,`top`,`bottom`,`diagonal`,`vertical`,`horizontal`];for(let t of[`left`,`right`,`top`,`bottom`])t in e&&m(r,e[t]?d(a+t,{style:n.borderStyle??`thin`},[d(a+`color`,{rgb:`FF`+i})]):d(a+t),t,c);s(r,`diagonal`)||m(r,d(a+`diagonal`),`diagonal`,c),u(p,`borderId`,String(this.intern(`borders`,r))),u(p,`applyBorder`,`1`)}if(`align`in n||`wrap`in n||`valign`in n||`rotate`in n){let e=f(s(p,`alignment`)??d(a+`alignment`));if(`align`in n&&u(e,`horizontal`,n.align??void 0),`valign`in n&&u(e,`vertical`,n.valign&&n.valign!==`bottom`?n.valign:void 0),`wrap`in n&&u(e,`wrapText`,n.wrap?`1`:void 0),`rotate`in n){let t=n.rotate;u(e,`textRotation`,t?t===255?`255`:String(t>0?Math.min(90,t):90+Math.min(90,-t)):void 0)}m(p,e.a.trim()?e:void 0,`alignment`,[`alignment`,`protection`,`extLst`]),u(p,`applyAlignment`,`1`)}n.numFmt!==void 0&&(u(p,`numFmtId`,String(this.numFmtId(n.numFmt))),u(p,`applyNumberFormat`,`1`));let h=this.intern(`cellXfs`,p);return this.cache.set(r,h),h}xml(){return n(this.nodes)}mark(){let e={};for(let t of[`numFmts`,`fonts`,`fills`,`borders`,`cellXfs`])e[t]=o(s(this.root,t)).length;return e}truncate(e){for(let[t,n]of Object.entries(e)){let e=s(this.root,t),r=o(e);if(!e||r.length<=n)continue;let i=new Set(r.slice(n));e.c=e.c.filter(e=>!i.has(e)),u(e,`count`,String(n));let a=this.found.get(t);if(a)for(let[e,t]of a)t>=n&&a.delete(e)}for(let[t,n]of this.cache)n>=e.cellXfs&&this.cache.delete(t)}},Do=class{constructor(e){w(this,`wb`,void 0),w(this,`undoStack`,[]),w(this,`redoStack`,[]),w(this,`styleEd`,void 0),w(this,`stylesPath`,void 0),w(this,`formulaTouched`,!1),w(this,`lastRecalc`,[]),w(this,`bookChanged`,!1),w(this,`newSheets`,/* @__PURE__ */ new Map),this.wb=e}get dirty(){return[...this.wb.sheetsData.values()].some(ko)||!!this.styleEd?.changed||this.bookChanged}sheet(e){let t=this.wb.sheetsData.get(e);if(!t||!t.done)throw Error(`Sheet is still loading`);return t}apply(e,t,n){let r=[...this.wb.sheetsData].find(([,t])=>t===e)?.[0]??0,i=[];this.applyRaw(e,t,n);for(let e of t){let t=n===`prev`?e.nextF:e.prevF,a=n===`prev`?e.prevF:e.nextF;t!==a&&this.wb.calc.formulaChanged(r,e.key),a&&i.push({sheet:r,key:e.key})}let a=t.filter(e=>{if(n===`prev`?e.prevF:e.nextF)return!1;let t=e.prev,r=e.next;return!t||!r||t[0]!==r[0]||t[1]!==r[1]||e.prevF!==e.nextF});this.lastRecalc=a.length||i.length?[...this.wb.calc.recalc(a.map(e=>({sheet:r,key:e.key})),i)]:[]}applyRaw(e,t,n){for(let r of t){Co(e,Math.floor(r.key/Q),r.key%Q,n===`prev`?r.prev:r.next);let t=n===`prev`?r.prevF:r.nextF;t?e.formulas.set(r.key,t):e.formulas.delete(r.key),e.edited.add(r.key),(r.prevF||r.nextF)&&(this.formulaTouched=!0)}}record(e,t,n){return this.undoStack.push({sheet:e,cells:t,range:n}),this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],{sheet:e,range:n,recalc:this.lastRecalc}}recalcAll(){this.wb.calc.invalidate();let e=[];for(let[t,n]of this.wb.sheetsData)for(let r of n.formulas.keys())e.push({sheet:t,key:r});return[...this.wb.calc.recalc([],e)]}setCells(e,t){let n=this.sheet(e),r=[],i={r0:1/0,c0:1/0,r1:-1,c1:-1};for(let{r:e,c:a,input:o}of t){let t=e*Q+a,s=$(n,e,a),c=s?.[2]??0,{e:l,f:u}=To(o,c,Ua(this.wb.styles.xfs[c]?.numFmt??``));r.push({key:t,prev:s,prevF:n.formulas.get(t),next:l,nextF:u}),i.r0=Math.min(i.r0,e),i.c0=Math.min(i.c0,a),i.r1=Math.max(i.r1,e),i.c1=Math.max(i.c1,a)}return this.apply(n,r,`next`),this.record(e,r,i)}async styles(){if(!this.styleEd){let e=M(this.wb.rels,`styles`);this.stylesPath=e?.target??`xl/styles.xml`;let t=this.wb.pkg.has(this.stylesPath)?await this.wb.pkg.text(this.stylesPath):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="1"><font><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs></styleSheet>`;this.styleEd=new Eo(t)}return this.styleEd}async format(e,t,n){let r=this.sheet(e),i=await this.styles(),a=this.wb.styles.xfs.length,o=[],s=Math.min(t.r1,t.r0+2e5),c=3e5;for(let e=t.r0;e<=s&&c>0;e++)for(let a=t.c0;a<=t.c1&&c>0;a++,c--){let s=e*Q+a,c=$(r,e,a),l=n.border?{...n,sides:No(n.border,t,e,a)}:n;if(n.border&&!Object.keys(l.sides).length)continue;let u=n.clear?0:n.xf===void 0?i.derive(c?.[2]??0,l):n.xf,d=c?[c[0],c[1],u]:[6,``,u],f=r.formulas.get(s);o.push({key:s,prev:c,prevF:f,next:d,nextF:f})}this.apply(r,o,`next`);let l=i.xml();this.wb.pkg.setPart(this.stylesPath,l),this.wb.styles=$a(ge(l),this.wb.theme);let u=this.record(e,o,t);return u.styles=this.wb.styles.xfs.slice(a).map((e,t)=>({index:a+t,css:e.css,format:e.numFmt})),u}step(e,t){let n=this.sheet(e.sheet);this.lastRecalc=[],e.full&&fo(n,t===`prev`?e.full.before:e.full.after),this.apply(n,e.cells,t),e.lay&&jo(n,t===`prev`?e.lay.before:e.lay.after);let r=e.full?this.recalcAll():this.lastRecalc;return{sheet:e.sheet,range:e.range,layout:e.full||e.lay?this.layout(e.sheet):void 0,recalc:r}}undo(){let e=this.undoStack.pop();return e?(this.redoStack.push(e),this.step(e,`prev`)):null}redo(){let e=this.redoStack.pop();return e?(this.undoStack.push(e),this.step(e,`next`)):null}takeRecord(){let e=this.undoStack.pop();return this.undoStack=[],this.redoStack=[],e}revertRecord(e){return this.step(e,`prev`)}restoreRecord(e,t){let n=this.sheet(e.sheet),r=e.cells.map(e=>({key:e.key,prev:$(n,Math.floor(e.key/Q),e.key%Q),prevF:n.formulas.get(e.key),next:t===`prev`?e.prev:e.next,nextF:t===`prev`?e.prevF:e.nextF})),i={sheet:e.sheet,cells:r,range:e.range,lay:e.lay?{before:Ao(n),after:t===`prev`?e.lay.before:e.lay.after}:void 0,full:e.full?{before:uo(n),after:t===`prev`?e.full.before:e.full.after}:void 0},a=this.step(i,`next`);return this.undoStack.push(i),a}async styleMark(){return(await this.styles()).mark()}async styleTruncate(e){let t=await this.styles(),n=t.xml();t.truncate(e);let r=t.xml();r!==n&&(this.wb.pkg.setPart(this.stylesPath,r),this.wb.styles=$a(ge(r),this.wb.theme))}styleAt(e,t,n){return $(this.sheet(e),t,n)?.[2]??0}layout(e){let t=this.sheet(e),n=lo(t);return{sheet:e,rows:t.maxRow+1,cols:t.maxCol+1,rowSizes:n,done:!0,colInfo:t.colInfo,defaultColW:t.defaultColW,defaultRowH:t.defaultRowH,frozen:t.frozen,gridLines:t.gridLines,merges:t.merges}}async allSheets(){return await Promise.all(this.wb.sheets.map(e=>this.wb.loadSheet(e.index,()=>{}))),this.wb.sheets.map(e=>({name:e.name,d:this.wb.sheetsData.get(e.index)}))}async sheetOp(e,t){let n=this.sheet(e),r=this.wb.sheets[e].name,i={r0:0,c0:0,r1:Math.max(0,n.maxRow+50),c1:Math.max(0,n.maxCol+10)},a=(t,r=i)=>{let a=Ao(n);t();let o={sheet:e,cells:[],range:r,lay:{before:a,after:Ao(n)}};return this.undoStack.push(o),this.redoStack=[],{sheet:e,range:r,layout:this.layout(e)}};switch(t.op){case`insertRows`:case`deleteRows`:case`insertCols`:case`deleteCols`:{let a=await this.allSheets(),o=uo(n);ho(n,r,t.op.endsWith(`Rows`)?`row`:`col`,t.at,t.op.startsWith(`insert`)?t.n:-t.n,a),this.formulaTouched=!0;let s=this.recalcAll(),c={sheet:e,cells:[],range:i,full:{before:o,after:uo(n)}};return this.undoStack.push(c),this.redoStack=[],{sheet:e,range:i,layout:this.layout(e),recalc:s}}case`merge`:case`unmerge`:{let r=t.range,i=t.op===`unmerge`||!t.mode||t.mode===`all`?[r]:t.mode===`across`?Array.from({length:r.r1-r.r0+1},(e,t)=>({r0:r.r0+t,r1:r.r0+t,c0:r.c0,c1:r.c1})):Array.from({length:r.c1-r.c0+1},(e,t)=>({r0:r.r0,r1:r.r1,c0:r.c0+t,c1:r.c0+t})),o=a(()=>{if(go(n,r,!1),t.op===`merge`)for(let e of i)go(n,e,!0)},r);if(t.op===`merge`){let t=[];for(let e of i)for(let r=e.r0;r<=e.r1;r++)for(let i=e.c0;i<=e.c1;i++)(r!==e.r0||i!==e.c0)&&$(n,r,i)&&$(n,r,i)?.[1]!==``&&t.push({r,c:i,input:``});if(t.length){this.setCells(e,t);let n=this.undoStack.pop();this.undoStack[this.undoStack.length-1].cells=n.cells}}return o}case`hideRows`:return a(()=>{for(let e=t.a;e<=t.b;e++){let r=n.rowAttrs.get(e);if(t.hidden)n.rowAttrs.set(e,{...r??{},hidden:!0});else if(r){let{hidden:t,...i}=r;i.ht===void 0?n.rowAttrs.delete(e):n.rowAttrs.set(e,i)}n.dirtyRows.add(e)}});case`hideCols`:return a(()=>Mo(n,t.a,t.b,t.hidden));case`gridlines`:return a(()=>{n.gridLines=t.show,n.dirtyView=!0});case`colWidth`:return a(()=>_o(n,t.c0,t.c1,t.px));case`rowHeight`:return a(()=>vo(n,t.r0,t.r1,t.px));case`freeze`:return a(()=>{n.frozen={rows:t.rows,cols:t.cols},n.dirtyView=!0});case`fill`:return this.fill(e,n,t.range,t.dir);case`sort`:return this.sort(e,n,t.range,t.col,!!t.desc)}}replace(e,t,n,r={},i){let a=this.sheet(e),o=new RegExp(r.whole?`^${Fo(t)}$`:Fo(t),r.matchCase?`g`:`gi`),s=[],c=i?[i]:this.wb.find(e,t,r,1e9);for(let{r:t,c:i}of c){let c=a.formulas.get(t*Q+i),l=r.formulas&&c?`=`+c:this.wb.cell(e,t,i)?.value;if(l===void 0||c&&!r.formulas)continue;let u=l.replace(o,n);u!==l&&s.push({r:t,c:i,input:u})}return s.length?this.setCells(e,s):null}fill(e,t,n,r){po(t);let i=[];for(let e=n.r0;e<=n.r1;e++)for(let a=n.c0;a<=n.c1;a++){let o=r===`down`?n.r0:e,s=r===`right`?n.c0:a;if(o===e&&s===a)continue;let c=e*Q+a,l=$(t,o,s),u=t.formulas.get(o*Q+s),d=u?Ea(u,e-o,a-s):void 0;i.push({key:c,prev:$(t,e,a),prevF:t.formulas.get(c),next:l?[l[0],d?`=`+d:l[1],l[2]]:null,nextF:d})}return this.apply(t,i,`next`),this.record(e,i,n)}sort(e,t,n,r,i){po(t);let a=[];for(let e=n.r0;e<=n.r1;e++){let i=[],o=[];for(let r=n.c0;r<=n.c1;r++)i.push($(t,e,r)),o.push(t.formulas.get(e*Q+r));let s=$(t,e,r),c=s?s[0]===1?this.wb.sst[s[1]]:s[1]:null;a.push({r:e,cells:i,f:o,key:c===``?null:c})}let o=(e,t)=>e==null?1:t==null?-1:typeof e==`number`&&typeof t==`number`?e-t:typeof e==`number`?-1:typeof t==`number`?1:String(e).localeCompare(String(t),void 0,{sensitivity:`base`,numeric:!0}),s=[...a].sort((e,t)=>{let n=o(e.key,t.key);return i&&e.key!==null&&t.key!==null?-n:n}),c=[];return s.forEach((e,r)=>{let i=n.r0+r;for(let r=n.c0;r<=n.c1;r++){let a=r-n.c0,o=i*Q+r,s=e.f[a]?Ea(e.f[a],i-e.r,0):void 0,l=e.cells[a];c.push({key:o,prev:$(t,i,r),prevF:t.formulas.get(o),next:l?[l[0],s?`=`+s:l[1],l[2]]:null,nextF:s})}}),this.apply(t,c,`next`),this.record(e,c,n)}async bookOp(r){let c=this.wb.pkg,f=t(await c.text(this.wb.mainPath)),p=a(f),m=i(p.q),h=s(p,`sheets`),g=o(h,`sheet`),_=this.wb.sheets,v=e=>{let t=new Map(this.wb.sheetsData);this.wb.sheetsData.clear(),e.forEach((e,n)=>{let r=t.get(e);r&&this.wb.sheetsData.set(n,r)});let n=e.map((e,t)=>({..._[e],index:t}));_.splice(0,_.length,...n)};switch(r.op){case`add`:{let e=c.freeName(`xl/worksheets`,`sheet`,`xml`);this.newSheets.set(e,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/></worksheet>`),c.setPart(e,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/></worksheet>`),await c.setContentType(e,`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`);let t=await c.addRel(this.wb.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,e),n=g.map(e=>Number(l(e,`sheetId`)??0)),i=r.name??`Sheet${_.length+1}`;for(;_.some(e=>e.name.toLowerCase()===i.toLowerCase());)i+=`_`;let a=d(m+`sheet`,{name:i,sheetId:String(Math.max(0,...n)+1),...b(p,`id`,t)}),o=r.after??_.length-1,s=o+1>=g.length?h.c.length:h.c.indexOf(g[o+1]);h.c.splice(s,0,a),h.self=!1;let u={name:i,index:o+1,path:e,hidden:!1},f=_.map((e,t)=>t);_.push({...u,index:_.length}),f.splice(o+1,0,_.length-1),v(f);break}case`rename`:{let e=_[r.index],t=r.name.trim().slice(0,31).replace(/[\\\\/?*[\\]:]/g,`_`);if(!e||!t||_.some((e,n)=>n!==r.index&&e.name.toLowerCase()===t.toLowerCase()))throw Error(`Invalid sheet name`);u(g[r.index],`name`,t);for(let n of await this.allSheets())for(let[r,i]of n.d.formulas){let a=ka(i,e.name,t);a!==i&&(n.d.formulas.set(r,a),n.d.edited.add(r))}e.name=t;break}case`delete`:{if(_.length<=1)throw Error(`A workbook needs at least one sheet`);let t=_[r.index];h.c.splice(h.c.indexOf(g[r.index]),1),c.setPart(t.path,null),c.has(Te(t.path))&&c.setPart(Te(t.path),null),await c.removeRelsTo(this.wb.mainPath,t.path),await c.setContentType(t.path,null),v(_.map((e,t)=>t).filter(e=>e!==r.index));let n=s(p,`definedNames`);n&&(n.c=n.c.filter(t=>!(e(t)&&l(t,`localSheetId`)===String(r.index))));break}case`move`:{let e=g[r.from];h.c.splice(h.c.indexOf(e),1);let t=o(h,`sheet`);h.c.splice(r.to>=t.length?h.c.length:h.c.indexOf(t[r.to]),0,e);let n=_.map((e,t)=>t);n.splice(r.from,1),n.splice(r.to,0,r.from),v(n);break}}return c.setPart(this.wb.mainPath,n(f)),this.bookChanged=!0,this.undoStack=[],this.redoStack=[],{sheet:0,range:{r0:0,c0:0,r1:0,c1:0},sheets:_.map(e=>({...e}))}}async save(){let e=this.wb.pkg,r=!1;for(let[t,n]of this.wb.sheetsData){if(!ko(n))continue;r=!0;let i=this.wb.sheets[t];e.setPart(i.path,()=>this.rewrite(i.path,n))}if(r){let r=t(await e.text(this.wb.mainPath)),o=a(r),c=i(o.q),l=f(s(o,`calcPr`)??d(c+`calcPr`));u(l,`fullCalcOnLoad`,`1`),m(o,l,`calcPr`,bo),e.setPart(this.wb.mainPath,n(r));let p=M(this.wb.rels,`calcChain`);p&&this.formulaTouched&&e.has(p.target)&&(e.setPart(p.target,null),await e.removeRelsTo(this.wb.mainPath,p.target),await e.setContentType(p.target,null))}return e.save(`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`)}rewrite(e,t){let n=this.wb.pkg,r=this.wb,i=this,a=/* @__PURE__ */ new Map,o=/* @__PURE__ */ new Set;for(let[e,n]of t.shared)t.edited.has(n.master)&&o.add(e);if(o.size)for(let[e,n]of t.depOf){if(!o.has(n)||t.edited.has(e))continue;let r=t.shared.get(n),i=Math.floor(e/Q)-Math.floor(r.master/Q),s=e%Q-r.master%Q;a.set(e,Ea(r.text,i,s))}let s=/* @__PURE__ */ new Map;for(let e of t.dirtyRows)s.has(e)||s.set(e,/* @__PURE__ */ new Set);for(let e of[...t.edited,...a.keys()]){let t=Math.floor(e/Q),n=s.get(t);n||s.set(t,n=/* @__PURE__ */ new Set),n.add(e%Q)}let c=[...s.keys()].sort((e,t)=>e-t),l=new TextEncoder;return new ReadableStream({async start(o){let u=new Po(c,s,t,a,r),d=i.newSheets.get(e),f=(d===void 0?await n.zip.stream(e):new Blob([d]).stream()).getReader(),p=new TextDecoder;for(;;){let{done:e,value:t}=await f.read(),n=e?p.decode():p.decode(t,{stream:!0});for(let t of u.push(n,e))t&&o.enqueue(l.encode(t));if(e)break}o.close()}})}};function Oo(e,t,n,r,i){let a=t*Q+n,o=$(e,t,n),s=e.formulas.get(a);if(!o&&!s)return``;let c=no(n)+(t+1),l=o?.[2]?` s="${o[2]}"`:``;if(s){let[e,t]=o??[6,``],n=`<${r}f>${h(s)}</${r}f>`;return e===0?`<${r}c r="${c}"${l}>${n}<${r}v>${String(t)}</${r}v></${r}c>`:e===3?`<${r}c r="${c}"${l} t="b">${n}<${r}v>${+!!t}</${r}v></${r}c>`:e===4?`<${r}c r="${c}"${l} t="e">${n}<${r}v>${h(String(t))}</${r}v></${r}c>`:e===2&&!String(t).startsWith(`=`)?`<${r}c r="${c}"${l} t="str">${n}<${r}v>${h(String(t))}</${r}v></${r}c>`:`<${r}c r="${c}"${l}>${n}</${r}c>`}let[u,d]=o;switch(u){case 0:return`<${r}c r="${c}"${l}><${r}v>${String(d)}</${r}v></${r}c>`;case 1:case 2:return`<${r}c r="${c}"${l} t="inlineStr"><${r}is><${r}t xml:space="preserve">${h(u===1?i.sst[d]??``:String(d))}</${r}t></${r}is></${r}c>`;case 3:return`<${r}c r="${c}"${l} t="b"><${r}v>${+!!d}</${r}v></${r}c>`;case 4:return`<${r}c r="${c}"${l} t="e"><${r}v>${h(String(d))}</${r}v></${r}c>`;case 5:return`<${r}c r="${c}"${l} t="d"><${r}v>${h(String(d))}</${r}v></${r}c>`;default:return`<${r}c r="${c}"${l}/>`}}function ko(e){return e.edited.size>0||e.structural||e.dirtyCols||e.dirtyMerges||e.dirtyView||e.dirtyRows.size>0||e.formulaChanged}function Ao(e){return{merges:e.merges.map(e=>({...e})),colInfo:e.colInfo.map(e=>({...e})),rowAttrs:[...e.rowAttrs].map(([e,t])=>[e,{...t}]),frozen:{...e.frozen},gridLines:e.gridLines}}function jo(e,t){if(t.merges&&(e.merges=t.merges.map(e=>({...e}))),t.colInfo&&(e.colInfo=t.colInfo.map(e=>({...e}))),t.rowAttrs){for(let t of e.rowAttrs.keys())e.dirtyRows.add(t);e.rowAttrs=new Map(t.rowAttrs.map(([e,t])=>[e,{...t}]));for(let t of e.rowAttrs.keys())e.dirtyRows.add(t)}t.frozen&&(e.frozen={...t.frozen}),t.gridLines!==void 0&&(e.gridLines=t.gridLines),e.dirtyCols=e.dirtyMerges=e.dirtyView=!0}function Mo(e,t,n,r){let i=[],a=[];for(let o of e.colInfo){if(o.max<t||o.min>n){i.push(o);continue}o.min<t&&i.push({...o,max:t-1}),o.max>n&&i.push({...o,min:n+1});let s=Math.max(o.min,t),c=Math.min(o.max,n);a.push([s,c]),r?i.push(o.w?{...o,min:s,max:c,w:0,prevW:o.w}:{...o,min:s,max:c}):i.push(o.w?{...o,min:s,max:c}:{min:s,max:c,w:o.prevW||e.defaultColW})}if(r){a.sort((e,t)=>e[0]-t[0]);let r=t;for(let[t,o]of[...a,[n+1,n+1]])t>r&&i.push({min:r,max:Math.min(t-1,n),w:0,prevW:e.defaultColW}),r=Math.max(r,o+1)}e.colInfo=i.sort((e,t)=>e.min-t.min),e.dirtyCols=!0}function No(e,t,n,r){let i={},a={top:n===t.r0,bottom:n===t.r1,left:r===t.c0,right:r===t.c1};for(let t of[`top`,`bottom`,`left`,`right`])e===`all`?i[t]=!0:e===`none`?i[t]=!1:e===`outer`?a[t]&&(i[t]=!0):e===`inner`?a[t]||(i[t]=!0):e===t&&a[t]&&(i[t]=!0);return i}var Po=class{constructor(e,t,n,r,i){w(this,`rows`,void 0),w(this,`rowCols`,void 0),w(this,`d`,void 0),w(this,`fix`,void 0),w(this,`wb`,void 0),w(this,`buf`,``),w(this,`P`,``),w(this,`next`,0),w(this,`lastRow`,-1),w(this,`phase`,`head`),w(this,`tail`,``),this.rows=e,this.rowCols=t,this.d=n,this.fix=r,this.wb=i}newRow(e){let t=[...this.rowCols.get(e)??[]].sort((e,t)=>e-t).map(t=>Oo(this.d,e,t,this.P,this.wb)).join(``),n=this.rowAttrXml(e);return t||n?`<${this.P}row r="${e+1}"${n}>${t}</${this.P}row>`:``}rowAttrXml(e){let t=this.d.rowAttrs.get(e);return t?(t.ht===void 0?``:` ht="${t.ht}" customHeight="1"`)+(t.hidden?` hidden="1"`:``):``}before(e){let t=``;for(;this.next<this.rows.length&&this.rows[this.next]<e;)t+=this.newRow(this.rows[this.next++]);return t}*allRows(){let e=this.d,t=Math.max(e.rows.length-1,...e.rowAttrs.keys(),-1),n=``;for(let r=0;r<=t;r++){let t=e.rows[r],i=this.rowAttrXml(r);if(!t?.length&&!i)continue;let a=``;if(t){let n=[];for(let e=0;e<t.length;e+=4)n.push(t[e]);for(let t of n.sort((e,t)=>e-t))a+=Oo(e,r,t,this.P,this.wb)}n+=`<${this.P}row r="${r+1}"${i}>${a}</${this.P}row>`,n.length>65536&&(yield n,n=``)}n&&(yield n)}colsXml(){let e=this.P,t=[...this.d.colInfo].sort((e,t)=>e.min-t.min);return t.length?`<${e}cols>${t.map(t=>`<${e}col min="${t.min+1}" max="${t.max+1}" width="${+((t.w||t.prevW||0)/7).toFixed(4)}" customWidth="1"${t.w?``:` hidden="1"`}/>`).join(``)}</${e}cols>`:``}headFix(i){let o=this.d,c=this.P,l=i;if(o.dirtyCols||o.structural){let e=RegExp(`<${c}cols\\\\b[\\\\s\\\\S]*?<\\\\/${c}cols>|<${c}cols\\\\s*\\\\/>`);l=e.test(l)?l.replace(e,this.colsXml()):l+this.colsXml()}if(o.dirtyView||o.structural){let{rows:i,cols:d}=o.frozen,f=i||d?`<${c}pane${d?` xSplit="${d}"`:``}${i?` ySplit="${i}"`:``} topLeftCell="${no(d)}${i+1}" activePane="${i&&d?`bottomRight`:i?`bottomLeft`:`topRight`}" state="frozen"/>`:``,p=RegExp(`<${c}sheetViews>[\\\\s\\\\S]*?<\\\\/${c}sheetViews>`).exec(l);if(p){let i=t(p[0]),c=s(a(i),`sheetView`);c&&(c.c=c.c.filter(t=>!e(t)||r(t.q)!==`pane`&&r(t.q)!==`selection`),f&&c.c.unshift(f),u(c,`showGridLines`,o.gridLines?void 0:`0`),c.self=c.c.length===0,l=l.replace(p[0],n(i)))}else if(f||!o.gridLines){let e=`<${c}sheetViews><${c}sheetView${o.gridLines?``:` showGridLines="0"`} workbookViewId="0">${f}</${c}sheetView></${c}sheetViews>`,t=l.search(RegExp(`<${c}(sheetFormatPr|cols)\\\\b`));l=t>=0?l.slice(0,t)+e+l.slice(t):l+e}}return o.structural&&(l=l.replace(RegExp(`<${c}dimension\\\\b[^>]*\\\\/>`),`<${c}dimension ref="A1:${no(Math.max(0,o.maxCol))}${Math.max(1,o.maxRow+1)}"/>`)),l}tailFix(e){let t=this.d;if(!t.dirtyMerges&&!t.structural)return e;let n=this.P,r=t.merges,i=r.length?`<${n}mergeCells count="${r.length}">${r.map(e=>`<${n}mergeCell ref="${no(e.c0)}${e.r0+1}:${no(e.c1)}${e.r1+1}"/>`).join(``)}</${n}mergeCells>`:``,a=RegExp(`<${n}mergeCells\\\\b[\\\\s\\\\S]*?<\\\\/${n}mergeCells>|<${n}mergeCells\\\\b[^>]*\\\\/>`);if(a.test(e))return e.replace(a,i);let o=0,s=/<(\\w+:)?(sheetCalcPr|sheetProtection|protectedRanges|scenarios|autoFilter|sortState|dataConsolidate|customSheetViews)\\b[\\s\\S]*?(\\/>|<\\/(\\w+:)?\\2>)/g;for(let t=s.exec(e);t;t=s.exec(e))o=t.index+t[0].length;return e.slice(0,o)+i+e.slice(o)}push(e,t){let n=this.buf+e;this.buf=``;let r=[];if(this.phase===`tail`)return this.tail+=n,t&&r.push(this.tailFix(this.tail)),r;let i=0;if(this.phase===`head`){let e=/<([\\w.-]+:)?sheetData(\\s[^>]*)?(\\/?)>/.exec(n);if(!e)return t?r.push(this.headFix(n)):this.buf=n,r;this.P=e[1]??``,r.push(this.headFix(n.slice(0,e.index)));let a=e.index+e[0].length;if(e[3]===`/`){if(r.push(`<${this.P}sheetData>`),this.d.structural)r.push(...this.allRows());else{let e=``;for(;this.next<this.rows.length;)e+=this.newRow(this.rows[this.next++]);r.push(e)}return r.push(`</${this.P}sheetData>`),this.phase=`tail`,[...r,...this.push(n.slice(a),t)]}r.push(e[0]),i=a,this.phase=this.d.structural?`skip`:`data`}let a=`</${this.P}sheetData>`;if(this.phase===`skip`){let e=n.indexOf(a,i);return e<0?(this.buf=n.slice(Math.max(i,n.length-a.length)),r):(r.push(...this.allRows(),a),this.phase=`tail`,[...r,...this.push(n.slice(e+a.length),t)])}let o=`<${this.P}row`,s=``,c=n.indexOf(a,i);for(;i<n.length;){let e=n.indexOf(o,i);if(c>=0&&c<i&&(c=n.indexOf(a,i)),c>=0&&(e<0||c<e))return s+=n.slice(i,c)+this.before(1/0)+a,r.push(s),this.phase=`tail`,[...r,...this.push(n.slice(c+a.length),t)];if(e<0)break;let l=n.indexOf(`>`,e);if(l<0){s+=n.slice(i,e),i=e;break}let u=n.slice(e,l+1),d=u.charCodeAt(o.length);if(d!==32&&d!==62&&d!==47&&d!==9&&d!==10&&d!==13){s+=n.slice(i,l+1),i=l+1;continue}let f=/\\sr="(\\d+)"/.exec(u),p=f?Number(f[1])-1:this.lastRow+1;this.lastRow=p;let m=u.endsWith(`/>`),h;if(m)h=l+1;else{let t=n.indexOf(`</${this.P}row>`,l);if(t<0){s+=n.slice(i,e),i=e,this.lastRow=p-1;break}h=t+this.P.length+6}s+=n.slice(i,e)+this.before(p),this.next<this.rows.length&&this.rows[this.next]===p?(this.next++,s+=this.patchRow(n.slice(e,h),p)):s+=n.slice(e,h),i=h}return r.push(s),this.buf=n.slice(i),t&&r.push(this.buf),r}patchRow(o,c){let d=t(o),f=a(d);if(!f)return o;let p=i(f.q);if(u(f,`spans`,void 0),this.d.dirtyRows.has(c)){let e=this.d.rowAttrs.get(c);u(f,`ht`,e?.ht===void 0?void 0:String(e.ht)),u(f,`customHeight`,e?.ht===void 0?void 0:`1`),u(f,`hidden`,e?.hidden?`1`:void 0)}let m=[...this.rowCols.get(c)??[]].sort((e,t)=>e-t),g=/* @__PURE__ */ new Map,_=-1;f.c.forEach((t,n)=>{if(!e(t)||r(t.q)!==`c`)return;let i=l(t,`r`),a=i?ro(i)[1]:_+1;_=a,g.set(a,n)});let v=/* @__PURE__ */ new Map,y=[];for(let e of m){let t=c*Q+e,n=g.get(e);if(this.d.edited.has(t)){let t=Oo(this.d,c,e,p,this.wb);n===void 0?t&&y.push({c:e,node:t}):v.set(n,t)}else if(n!==void 0&&this.fix.has(t)){let e=f.c[n],r=s(e,`f`);r&&(r.a=``,r.c=[h(this.fix.get(t))],r.self=!1)}}for(let[e,t]of v)f.c[e]=t;if(y.length){let e=[...g.entries()].sort((e,t)=>e[0]-t[0]);for(let t of y.reverse()){let n=e.find(([e])=>e>t.c),r=n?n[1]:f.c.length;f.c.splice(r,0,t.node);for(let t of e)t[1]>=r&&t[1]++}f.self=!1}return n(d)}};const Fo=e=>e.replace(/[.*+?^${}()|[\\]\\\\]/g,`\\\\$&`),Io={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`},Lo=[`xfrm`,`custGeom`,`prstGeom`,`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`,`ln`,`effectLst`,`effectDag`,`scene3d`,`sp3d`,`extLst`],Ro=/* @__PURE__ */ new Set([`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`]),zo=e=>String(Math.round(e*je));function Bo(e){let t=s(s(a(e),`cSld`),`spTree`);if(!t)throw Error(`Slide has no shape tree`);return t}function Vo(e){let t=o(e).find(e=>/^nv.*Pr$/.test(r(e.q))),n=t?l(s(t,`cNvPr`)??t,`id`):void 0;return n===void 0?void 0:Number(n)}function Ho(t){let n=1;for(let i of t)e(i)&&v(i,e=>{r(e.q)===`cNvPr`&&(n=Math.max(n,Number(l(e,`id`)??0)))});return n}function Uo(t){let n=``;for(let r of t)e(r)&&v(r,e=>(!n&&/:(off|ext|t|p|bodyPr)$/.test(e.q)&&(n=i(e.q)),!!n));return n||`a:`}function Wo(e,t,n,i){let a=r(e.q),o;if(a===`graphicFrame`)o=e;else{let t=a===`grpSp`?`grpSpPr`:`spPr`,n=s(e,t);n||(n=d(i+t),e.c.splice(1,0,n)),o=n}let c=s(o,`xfrm`);c||(c=d((a===`graphicFrame`?i:n)+`xfrm`),a===`graphicFrame`?o.c.splice(1,0,c):m(o,c,`xfrm`,Lo));let l=(e,t)=>{let r=s(c,e);r||(r=d(n+e),c.c.splice(e===`off`?0:e===`ext`?1:c.c.length,0,r));for(let[e,n]of Object.entries(t))u(r,e,n)};l(`off`,{x:zo(t.x),y:zo(t.y)}),l(`ext`,{cx:zo(Math.max(1,t.w)),cy:zo(Math.max(1,t.h))}),u(c,`rot`,t.rot?String(Math.round((t.rot%360+360)%360*6e4)):void 0),t.flipH!==void 0&&u(c,`flipH`,t.flipH?`1`:void 0),t.flipV!==void 0&&u(c,`flipV`,t.flipV?`1`:void 0),c.self=!1,o.self=!1}function Go(e,t){return t?d(e+`solidFill`,{},[d(e+`srgbClr`,{val:t.replace(`#`,``).toUpperCase()})]):d(e+`noFill`)}function Ko(e,t,n,r,i,a,o){let s=`<${r}off x="${zo(n.x)}" y="${zo(n.y)}"/><${r}ext cx="${zo(n.w)}" cy="${zo(n.h)}"/>`;return e===`image`?`<${i}pic><${i}nvPicPr><${i}cNvPr id="${t}" name="Picture ${t}"/><${i}cNvPicPr><${r}picLocks noChangeAspect="1"/></${i}cNvPicPr><${i}nvPr/></${i}nvPicPr><${i}blipFill><${r}blip r:embed="${o}"/><${r}stretch><${r}fillRect/></${r}stretch></${i}blipFill><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="rect"><${r}avLst/></${r}prstGeom></${i}spPr></${i}pic>`:e===`text`?`<${i}sp><${i}nvSpPr><${i}cNvPr id="${t}" name="TextBox ${t}"/><${i}cNvSpPr txBox="1"/><${i}nvPr/></${i}nvSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="rect"><${r}avLst/></${r}prstGeom><${r}noFill/></${i}spPr><${i}txBody><${r}bodyPr wrap="square" rtlCol="0"><${r}spAutoFit/></${r}bodyPr><${r}lstStyle/>${(e=>`<${r}p><${r}r><${r}rPr lang="en-US" dirty="0"/><${r}t>${h(e)}</${r}t></${r}r></${r}p>`)(a??`Text`)}</${i}txBody></${i}sp>`:e===`line`?`<${i}cxnSp><${i}nvCxnSpPr><${i}cNvPr id="${t}" name="Connector ${t}"/><${i}cNvCxnSpPr/><${i}nvPr/></${i}nvCxnSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="line"><${r}avLst/></${r}prstGeom><${r}ln w="19050"><${r}solidFill><${r}schemeClr val="tx1"/></${r}solidFill></${r}ln></${i}spPr></${i}cxnSp>`:`<${i}sp><${i}nvSpPr><${i}cNvPr id="${t}" name="Shape ${t}"/><${i}cNvSpPr/><${i}nvPr/></${i}nvSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="${e}"><${r}avLst/></${r}prstGeom></${i}spPr><${i}style><${r}lnRef idx="2"><${r}schemeClr val="accent1"><${r}shade val="50000"/></${r}schemeClr></${r}lnRef><${r}fillRef idx="1"><${r}schemeClr val="accent1"/></${r}fillRef><${r}effectRef idx="0"><${r}schemeClr val="accent1"/></${r}effectRef><${r}fontRef idx="minor"><${r}schemeClr val="lt1"/></${r}fontRef></${i}style><${i}txBody><${r}bodyPr rtlCol="0" anchor="ctr"/><${r}lstStyle/><${r}p><${r}pPr algn="ctr"/>${a?`<${r}r><${r}rPr lang="en-US" dirty="0"/><${r}t>${h(a)}</${r}t></${r}r>`:``}<${r}endParaRPr lang="en-US" dirty="0"/></${r}p></${i}txBody></${i}sp>`}function qo(n,i,o,c){let l=s(a(n),`cSld`);if(!l||(l.c=l.c.filter(t=>!(e(t)&&r(t.q)===`bg`)),!c))return;let u=t(`<${o}bg><${o}bgPr><${i}solidFill><${i}srgbClr val="${c.replace(`#`,``).toUpperCase()}"/></${i}solidFill><${i}effectLst/></${o}bgPr></${o}bg>`)[0];l.c.unshift(u),l.self=!1}async function Jo(e,r,a){let o=e.meta.slides[r];if(!o)throw Error(`No slide #${r}`);let s=await e.pkg.text(o.path),c=t(s),l=Bo(c);await a(c,l,Uo(c),i(l.q));let u=n(c);return e.pkg.setPart(o.path,u),e.touched=!0,u!==s&&(e.undoStack.push({path:o.path,before:s,after:u}),e.undoStack.length>200&&e.undoStack.shift(),e.redoStack=[]),e.slide(r)}async function Yo(e,t=!1){let n=(t?e.redoStack:e.undoStack).pop();if(!n)return null;(t?e.undoStack:e.redoStack).push(n),e.pkg.setPart(n.path,t?n.after:n.before);let r=e.meta.slides.findIndex(e=>e.path===n.path);return r<0?null:{index:r,model:await e.slide(r)}}async function Xo(e,t,n,r){if(r=r.toLowerCase().replace(`jpeg`,`jpg`),!Io[r])throw Error(`Unsupported image type .${r}`);let i=e.meta.slides[t],a=e.pkg.freeName(`ppt/media`,`image`,r);return e.pkg.setPart(a,n),await e.pkg.ensureDefaultType(r,Io[r]),e.pkg.addRel(i.path,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,a)}function Zo(n,i,a){return Jo(n,i,(n,i,o,c)=>{let h=t=>{let n=i.c.findIndex(n=>e(n)&&Vo(n)===t);return n>=0?{node:i.c[n],i:n}:void 0};for(let g of a){if(g.op===`insert`){let e=Ho(n)+1,r=Ko(g.kind,e,g.box,o,c,g.text,g.rid);i.c.push(t(r)[0]);continue}if(g.op===`bg`){qo(n,o,c,g.color);continue}if(g.op===`anchor`){let e;v(i,t=>{if(e)return!0;r(t.q)===`sp`&&Number(l(s(s(t,`nvSpPr`),`cNvPr`)??t,`id`))===g.sid&&(e=s(s(t,`txBody`),`bodyPr`))}),e&&u(e,`anchor`,g.anchor);continue}let a=h(g.top);if(!a)continue;let{node:_,i:y}=a;switch(g.op){case`xfrm`:Wo(_,g.box,o,c);break;case`delete`:i.c.splice(y,1);break;case`order`:{let t=()=>i.c.map((t,n)=>e(t)&&!/^(nvGrpSpPr|grpSpPr|extLst)$/.test(r(t.q))?n:-1).filter(e=>e>=0),n=t().indexOf(y);i.c.splice(y,1);let a=t();if(g.to===`front`)i.c.splice(a.length?a[a.length-1]+1:i.c.length,0,_);else if(g.to===`back`)i.c.splice(a.length?a[0]:i.c.length,0,_);else{let e=g.to===`forward`?Math.min(a.length,n+1):Math.max(0,n-1);i.c.splice(e<a.length?a[e]:a.length?a[a.length-1]+1:i.c.length,0,_)}break}case`duplicate`:{let e=f(_),t=Ho(n);v(e,e=>{r(e.q)===`cNvPr`&&u(e,`id`,String(++t))});let a=(()=>{let t;return v(e,e=>(!t&&r(e.q)===`off`&&(t=e),!!t)),t})();a&&(u(a,`x`,String(Number(l(a,`x`)??0)+Math.round((g.dx??16)*je))),u(a,`y`,String(Number(l(a,`y`)??0)+Math.round((g.dy??16)*je)))),i.c.splice(y+1,0,e);break}case`fill`:case`line`:{let t=r(_.q);if(t!==`sp`&&t!==`cxnSp`&&t!==`pic`)break;let n=s(_,`spPr`);if(n||(n=d(c+`spPr`),_.c.splice(1,0,n)),g.op===`fill`)p(n,e=>Ro.has(e)),m(n,Go(o,g.color),g.color?`solidFill`:`noFill`,Lo);else{let t=f(s(n,`ln`)??d(o+`ln`));if(`color`in g?(p(t,e=>Ro.has(e)),t.c.unshift(Go(o,g.color??null))):t.c.some(t=>e(t)&&Ro.has(r(t.q)))||t.c.unshift(d(o+`solidFill`,{},[d(o+`schemeClr`,{val:`tx1`})])),g.dash!==void 0){p(t,e=>e===`prstDash`||e===`custDash`);let n=t.c.findIndex(t=>e(t)&&!Ro.has(r(t.q)));t.c.splice(n<0?t.c.length:n,0,d(o+`prstDash`,{val:g.dash}))}t.self=!1,g.w!==void 0&&u(t,`w`,String(Math.round(g.w*12700))),m(n,t,`ln`,Lo)}n.self=!1;break}}}})}async function Qo(n){let o=t(await n.pkg.text(n.mainPath)),c=a(o),l=i(c.q),u=s(c,`sldIdLst`);if(!u){u=d(l+`sldIdLst`);let t=c.c.findIndex(t=>e(t)&&r(t.q)===`sldMasterIdLst`);c.c.splice(t+1,0,u)}return{nodes:o,root:c,P:l,lst:u}}async function $o(e){let t=await e.pkg.rels(e.mainPath),{lst:n}=await Qo(e),r=[];for(let i of o(n,`sldId`)){let n=t.get(l(i,`r:id`)??l(i,`id`,!0)??``);n&&e.pkg.has(n.target)&&r.push({index:r.length,path:n.target,hidden:!1})}for(let t of r){let n=(await e.pkg.text(t.path)).slice(0,600);t.hidden=/<[\\w:]*sld\\b[^>]*\\sshow="0"/.test(n)}return e.meta.slides=r,e.meta.count=r.length,e.meta}async function es(e,t,n){let r=t?M(await e.pkg.rels(t),`slideLayout`)?.target:void 0,i=r?M(await e.pkg.rels(r),`slideMaster`)?.target:void 0;if(i||(i=M(await e.pkg.rels(e.mainPath),`slideMaster`)?.target),!i)return r;let a=De(await e.pkg.rels(i),`slideLayout`).map(e=>e.target),o=await Promise.all(a.map(async t=>/<[\\w:]*sldLayout\\b[^>]*\\stype="([^"]+)"/.exec((await e.pkg.text(t)).slice(0,800))?.[1])),s=n===`title`?[`title`]:n===`blank`?[`blank`]:[`obj`,`txAndObj`,`tx`],c=o.findIndex(e=>e&&s.includes(e));return c>=0?a[c]:r??a[0]}async function ts(e,n){let r=``;if(n){let i=s(s(a(t(await e.pkg.text(n))),`cSld`),`spTree`),c=2;for(let e of o(i,`sp`)){let t=s(s(s(e,`nvSpPr`),`nvPr`),`ph`);if(!t)continue;let n=l(t,`type`);if(n&&[`dt`,`ftr`,`sldNum`].includes(n))continue;let i=l(s(s(e,`nvSpPr`),`cNvPr`)??e,`name`)??`Placeholder ${c}`,a=`<p:ph${n?` type="${n}"`:``}${l(t,`idx`)?` idx="${l(t,`idx`)}"`:``}/>`;r+=`<p:sp><p:nvSpPr><p:cNvPr id="${c++}" name="${h(i)}"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr>${a}</p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US" dirty="0"/></a:p></p:txBody></p:sp>`}}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\\n<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>${r}</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`}async function ns(e,t,r,i){let a=e.pkg.freeName(`ppt/slides`,`slide`,`xml`);e.pkg.setPart(a,r),e.pkg.setPart(Te(a),i),await e.pkg.setContentType(a,`application/vnd.openxmlformats-officedocument.presentationml.slide+xml`);let s=await e.pkg.addRel(e.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide`,a),{nodes:c,root:u,P:f,lst:p}=await Qo(e),m=o(p,`sldId`).map(e=>Number(l(e,`id`)??0)),h=Math.max(255,...m)+1,g=d(f+`sldId`,{id:String(h),...b(u,`id`,s)}),_=o(p,`sldId`),v=t<0?0:p.c.indexOf(_[Math.min(t,_.length-1)])+1;p.c.splice(v,0,g),p.self=!1,e.pkg.setPart(e.mainPath,n(c))}async function rs(r,i){let s=r.meta.slides;switch(r.touched=!0,i.op){case`add`:{let e=s[Math.max(0,Math.min(i.after,s.length-1))]?.path,t=await es(r,e,i.layout??`content`),n=await ts(r,t),a=t?`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/${t.split(`/`).pop()}"/></Relationships>`:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;await ns(r,i.after,n,a);break}case`duplicate`:{let o=s[i.index];if(!o)break;let c=await r.pkg.text(o.path),u=Te(o.path),d=r.pkg.has(u)?await r.pkg.text(u):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`,f=t(d),p=a(f);p.c=p.c.filter(t=>!(e(t)&&/notesSlide$/.test(l(t,`Type`)??``))),d=n(f),await ns(r,i.index,c,d);break}case`delete`:{let e=s[i.index];if(!e||s.length<=1)break;let{nodes:t,lst:a}=await Qo(r),c=await r.pkg.rels(r.mainPath),u=o(a,`sldId`).find(t=>c.get(l(t,`r:id`)??``)?.target===e.path);u&&a.c.splice(a.c.indexOf(u),1),r.pkg.setPart(r.mainPath,n(t));let d=M(await r.pkg.rels(e.path),`notesSlide`)?.target;await r.pkg.removeRelsTo(r.mainPath,e.path);for(let t of[e.path,d].filter(Boolean))r.pkg.setPart(t,null),r.pkg.has(Te(t))&&r.pkg.setPart(Te(t),null),await r.pkg.setContentType(t,null);break}case`move`:{let{nodes:e,lst:t}=await Qo(r),a=o(t,`sldId`),s=a[i.from];if(!s||i.to<0||i.to>=a.length)break;t.c.splice(t.c.indexOf(s),1);let c=o(t,`sldId`),l=i.to>=c.length?t.c.length:t.c.indexOf(c[i.to]);t.c.splice(l,0,s),r.pkg.setPart(r.mainPath,n(e));break}case`hide`:{let e=s[i.index];if(!e)break;let o=t(await r.pkg.text(e.path));u(a(o),`show`,i.hidden?`0`:void 0),r.pkg.setPart(e.path,n(o));break}}return $o(r)}const is=/* @__PURE__ */ new Set([`insertRows`,`deleteRows`,`insertCols`,`deleteCols`]);var as=class{constructor(e,t,n){w(this,`ed`,void 0),w(this,`wb`,void 0),w(this,`emit`,void 0),w(this,`recs`,/* @__PURE__ */ new Map),w(this,`byOp`,/* @__PURE__ */ new Map),w(this,`seq`,0),this.ed=e,this.wb=t,this.emit=n}index(e){let t=this.wb.sheets.findIndex(t=>t.path===e);if(t<0)throw new os;return t}async sheet(e){let t=this.index(e);return await this.wb.loadSheet(t,this.emit),t}dropSheet(e){for(let[t,n]of this.recs)(e===null||n.ch?.sheet===e)&&(this.recs.delete(t),this.byOp.delete(n.op))}async apply(e){let t=await this.ed.styleMark(),n;try{n=await this.run(e)}catch(e){if(e instanceof os)return{res:null,rec:null};throw e}let r=this.ed.takeRecord(),i=await this.ed.styleMark(),a=Object.keys(i).some(e=>i[e]!==t[e]);if(e.t===`book`||e.t===`sheet`&&is.has(e.op.op))return this.dropSheet(null),{res:n,rec:null};let o=++this.seq;if(this.recs.set(o,{ch:r,styles:a?t:void 0,op:e.id}),this.byOp.set(e.id,o),this.recs.size>400){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:n,rec:o}}async run(e){let t=this.ed;switch(e.t){case`set`:return t.setCells(await this.sheet(e.sheet),e.cells);case`fmt`:return t.format(await this.sheet(e.sheet),e.range,e.patch);case`sheet`:return t.sheetOp(await this.sheet(e.sheet),e.op);case`replace`:return t.replace(await this.sheet(e.sheet),e.query,e.by,e.opts,e.at);case`book`:{let n=e.op,r;r=n.op===`add`?{op:`add`,name:n.name,after:n.after?this.index(n.after):void 0}:n.op===`rename`?{op:`rename`,index:this.index(n.path),name:n.name}:n.op===`delete`?{op:`delete`,index:this.index(n.path)}:{op:`move`,from:this.index(n.path),to:Math.max(0,Math.min(n.to,this.wb.sheets.length-1))};try{return await t.bookOp(r)}catch{throw new os}}case`revert`:{let n=this.byOp.get(e.target),r=n===void 0?void 0:this.recs.get(n);if(!r?.ch)throw new os;return t.restoreRecord(r.ch,e.which)}}}async revert(e){let t=this.recs.get(e);if(!t)return null;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op);let n=t.ch?this.ed.revertRecord(t.ch):null;return t.styles&&await this.ed.styleTruncate(t.styles),n}},os=class extends Error{},ss=class{constructor(e){w(this,`pres`,void 0),w(this,`recs`,/* @__PURE__ */ new Map),w(this,`byOp`,/* @__PURE__ */ new Map),w(this,`seq`,0),w(this,`images`,/* @__PURE__ */ new Map),w(this,`ready`,void 0),this.pres=e}async originals(){for(let e of this.pres.meta.slides)await this.pres.keepOriginal(e.path)}index(e){return this.pres.meta.slides.findIndex(t=>t.path===e)}get genMaps(){return this.pres.genMaps}async snap(e){return{xml:await this.pres.pkg.text(e),gen:[...this.genMaps].filter(([t])=>t.startsWith(e+`#`))}}restore(e,t){this.pres.pkg.setPart(e,t.xml);for(let t of[...this.genMaps.keys()])t.startsWith(e+`#`)&&this.genMaps.delete(t);for(let[e,n]of t.gen)this.genMaps.set(e,n);this.pres.touched=!0}async model(e){let t=this.index(e);return t<0?{}:{slide:t,model:await this.pres.slide(t)}}async apply(e){let t=this.pres;if(await(this.ready??(this.ready=this.originals())),e.t===`image`){let n=this.index(e.slide);if(n<0)return{res:{},rec:null};let r=this.images.get(e.key);return r||(r=await Xo(t,n,e.bytes,e.ext),this.images.set(e.key,r)),{res:{rid:r},rec:null}}if(e.t===`slides`){let n=e.op,r=e=>this.index(e),i=null;if(n.op===`add`?i={op:`add`,after:n.after?r(n.after):-1,layout:n.layout}:r(n.path)>=0&&(i=n.op===`duplicate`?{op:`duplicate`,index:r(n.path)}:n.op===`delete`?t.meta.slides.length>1?{op:`delete`,index:r(n.path)}:null:n.op===`move`?{op:`move`,from:r(n.path),to:Math.max(0,Math.min(n.to,t.meta.slides.length-1))}:{op:`hide`,index:r(n.path),hidden:n.hidden}),!i)return{res:{},rec:null};let a=await rs(t,i);return await this.originals(),this.recs.clear(),this.byOp.clear(),{res:{meta:{...a,slides:a.slides.map(e=>({...e}))}},rec:null}}let n,r;if(e.t===`revert`){let t=this.byOp.get(e.target);if(r=t===void 0?void 0:this.recs.get(t),!r)return{res:{},rec:null};n=r.path}else n=e.slide;let i=this.index(n);if(i<0)return{res:{},rec:null};let a=await this.snap(n);if(e.t===`text`)try{await t.setText(i,e.sid,e.paras)}catch{return{res:{},rec:null}}else e.t===`shapes`?await Zo(t,i,e.ops.map(e=>{if(e.op!==`insert`||!e.key)return e;let{key:t,...n}=e;return{...n,rid:this.images.get(t)}})):r&&this.restore(n,e.which===`prev`?r.before:r.after);t.undoStack=[],t.redoStack=[];let o=++this.seq;if(this.recs.set(o,{path:n,before:a,after:await this.snap(n),op:e.id}),this.byOp.set(e.id,o),this.recs.size>300){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:await this.model(n),rec:o}}async revert(e){let t=this.recs.get(e);return t?(this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op),this.restore(t.path,t.before),this.model(t.path)):{}}};const cs=/* @__PURE__ */ new Set([`docx.edit`,`docx.table`,`docx.image`,`docx.link`,`docx.style`,`save`,`xlsx.set`,`xlsx.format`,`xlsx.sheetOp`,`xlsx.bookOp`,`xlsx.replace`,`xlsx.undo`,`xlsx.redo`,`collab.xlsx.apply`,`collab.xlsx.revert`,`pptx.setText`,`pptx.shapes`,`pptx.slides`,`pptx.image`,`pptx.undo`,`collab.pptx.apply`,`collab.pptx.revert`]);var ls=class{constructor(e){w(this,`emit`,void 0),w(this,`pkg`,void 0),w(this,`kind`,void 0),w(this,`docx`,void 0),w(this,`xlsx`,void 0),w(this,`xlsxEd`,void 0),w(this,`pptx`,void 0),w(this,`abort`,new AbortController),w(this,`writes`,Promise.resolve()),w(this,`xcollab`,void 0),w(this,`pcollab`,void 0),this.emit=e}async open(e,t={}){let n=await Un(e,{...t,signal:this.abort.signal,onProgress:(e,t)=>this.emit(`progress`,{phase:`download`,loaded:e,total:t})}),r=await ee.open(n),i=this.pkg=new Ee(r),a=await i.mainPart();this.kind=a.kind;let o={kind:a.kind,name:t.name??n.name,size:n.size};return a.kind===`docx`?this.docx=await ht.open(i,a.path):a.kind===`xlsx`?o.xlsx=(this.xlsx=await co.open(i,a.path)).meta():o.pptx=(this.pptx=await jn.open(i,a.path)).meta,o}call(e,t){if(!cs.has(e))return this.dispatch(e,t);let n=this.writes.then(()=>this.dispatch(e,t));return this.writes=n.catch(()=>{}),n}async dispatch(e,t){switch(e){case`open`:return this.open(t[0],t[1]);case`part`:return this.need(this.pkg).blob(t[0]);case`docx.start`:{let e=this.need(this.docx);try{await e.stream({signal:this.abort.signal,onBlocks:e=>this.emit(`docx:blocks`,e),onMeta:e=>this.emit(`docx:meta`,e),onProgress:(e,t)=>this.emit(`progress`,{phase:`parse`,loaded:e,total:t})}),this.emit(`docx:done`,{})}catch(e){this.emit(`docx:done`,{error:e.message})}return}case`docx.edit`:return Vt(this.need(this.docx),t[0]);case`docx.table`:return Zt(this.need(this.docx),t[0]);case`docx.image`:return Gt(this.need(this.docx),new Uint8Array(t[0]),t[1]);case`docx.link`:return Kt(this.need(this.docx),t[0]);case`docx.style`:return Nt(this.need(this.docx),t[0]);case`save`:return this.save();case`dirty`:return this.docx?this.docx.dirty:this.xlsxEd?this.xlsxEd.dirty:this.pptx?this.pptx.dirty:this.need(this.pkg).dirty;case`xlsx.load`:this.need(this.xlsx).loadSheet(t[0],e=>this.emit(`xlsx:progress`,e),(e,t,n)=>this.emit(`progress`,{phase:e,loaded:t,total:n}));return;case`xlsx.set`:return this.xed().setCells(t[0],t[1]);case`xlsx.format`:return this.xed().format(t[0],t[1],t[2]);case`xlsx.sheetOp`:return this.xed().sheetOp(t[0],t[1]);case`xlsx.replace`:return this.xed().replace(t[0],t[1],t[2],t[3],t[4]);case`xlsx.bookOp`:return this.xed().bookOp(t[0]);case`xlsx.undo`:return this.xed().undo();case`xlsx.redo`:return this.xed().redo();case`collab.xlsx.apply`:return this.xc().apply(t[0]);case`collab.xlsx.revert`:return this.xc().revert(t[0]);case`collab.pptx.apply`:return(this.pcollab??(this.pcollab=new ss(this.need(this.pptx)))).apply(t[0]);case`collab.pptx.revert`:return(this.pcollab??(this.pcollab=new ss(this.need(this.pptx)))).revert(t[0]);case`xlsx.block`:return this.need(this.xlsx).block(t[0],t[1],t[2]);case`xlsx.cell`:return this.need(this.xlsx).cell(t[0],t[1],t[2]);case`xlsx.find`:return this.need(this.xlsx).find(t[0],t[1],t[2]);case`pptx.setText`:return this.need(this.pptx).setText(t[0],t[1],t[2]);case`pptx.shapes`:return Zo(this.need(this.pptx),t[0],t[1]);case`pptx.slides`:return rs(this.need(this.pptx),t[0]);case`pptx.image`:return Xo(this.need(this.pptx),t[0],new Uint8Array(t[1]),t[2]);case`pptx.slide`:return this.need(this.pptx).slide(t[0]);case`pptx.undo`:return Yo(this.need(this.pptx),!!t[0])}throw Error(`Unknown method ${String(e)}`)}xc(){return this.xcollab??(this.xcollab=new as(this.xed(),this.need(this.xlsx),e=>this.emit(`xlsx:progress`,e)))}xed(){return this.xlsxEd??(this.xlsxEd=new Do(this.need(this.xlsx)))}async save(){if(this.docx)return Qt(this.docx);if(this.xlsx)return this.xed().save();if(this.pptx)return this.pptx.save();throw Error(`Saving is not supported for this document yet`)}dispose(){this.abort.abort()}need(e){if(!e)throw Error(this.kind?`Operation not available for ${this.kind}`:`Document not opened`);return e}};const us=self,ds=new ls((e,t)=>{us.postMessage({event:e,data:t})});us.onmessage=async e=>{let{id:t,method:n,args:r}=e.data;try{let e=await ds.call(n,r);us.postMessage({id:t,ok:!0,result:e})}catch(e){us.postMessage({id:t,ok:!1,error:e?.message??String(e)})}};',p=typeof self<`u`&&self.Blob&&new Blob([`URL.revokeObjectURL(import.meta.url);`,f],{type:`text/javascript;charset=utf-8`});function m(e){let t;try{if(t=p&&(self.URL||self.webkitURL).createObjectURL(p),!t)throw``;let n=new Worker(t,{type:`module`,name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(f),{type:`module`,name:e?.name})}}var h=e=>typeof e==`object`&&!!e;function g(e){let t=[],n=[],r=e=>(n.length?n[n.length-1].c:t).push(e),i=0,a=e.length;for(;i<a;){let t=e.indexOf(`<`,i);if(t<0){r(e.slice(i));break}t>i&&r(e.slice(i,t));let o=e[t+1];if(o===`!`||o===`?`){let n;n=e.startsWith(`<!--`,t)?e.indexOf(`-->`,t)+3:e.startsWith(`<![CDATA[`,t)?e.indexOf(`]]>`,t)+3:o===`?`?e.indexOf(`?>`,t)+2:e.indexOf(`>`,t)+1,n<=0&&(n=a),r(e.slice(t,n)),i=n;continue}if(o===`/`){let r=e.indexOf(`>`,t);n.pop(),i=r<0?a:r+1;continue}let s=-1,c=``;for(let n=t+1;n<a;n++){let t=e[n];if(c)t===c&&(c=``);else if(t===`"`||t===`'`)c=t;else if(t===`>`){s=n;break}}s<0&&(s=a-1);let l=e.slice(t+1,s),u=l.endsWith(`/`);u&&(l=l.slice(0,-1));let d=/^[^\s/>]+/.exec(l),f=d?d[0]:l,p={q:f,a:l.slice(f.length),c:[],self:u};r(p),u||n.push(p),i=s+1}return t}function _(e){if(Array.isArray(e)){let t=``;for(let n of e)t+=_(n);return t}return typeof e==`string`?e:e.self&&!e.c.length?`<${e.q}${e.a}/>`:`<${e.q}${e.a}>${_(e.c)}</${e.q}>`}var v=e=>e.slice(e.indexOf(`:`)+1),y=e=>e.includes(`:`)?e.slice(0,e.indexOf(`:`)+1):``;function b(e){return e.find(h)}function x(e,t){return e?e.c.filter(e=>h(e)&&(!t||v(e.q)===t)):[]}function S(e,t){if(e){for(let n of e.c)if(h(n)&&v(n.q)===t)return n}}var C=/([^\s=]+)\s*=\s*("([^"]*)"|'([^']*)')/g;function w(e,t,n=!1){C.lastIndex=0;let r;for(;r=C.exec(e.a);)if(r[1]===t||n&&v(r[1])===t)return re(r[3]??r[4]??``)}function T(e,t,n){C.lastIndex=0;let r;for(;r=C.exec(e.a);)if(r[1]===t){let i=n===void 0?``:`${t}="${ne(n)}"`;e.a=e.a.slice(0,r.index)+i+e.a.slice(r.index+r[0].length),n===void 0&&(e.a=e.a.replace(/\s+$/,``).replace(/\s{2,}/g,` `));return}n!==void 0&&(e.a=`${e.a.replace(/\s+$/,``)} ${t}="${ne(n)}"`)}function E(e,t={},n=[]){let r=``;for(let[e,n]of Object.entries(t))n!==void 0&&(r+=` ${e}="${ne(n)}"`);return{q:e,a:r,c:n,self:n.length===0}}function D(e){if(typeof e==`string`)return e;let t=e;return{q:t.q,a:t.a,self:t.self,c:t.c.map(D)}}function ee(e,t){let n=typeof t==`string`?e=>e===t:t;e.c=e.c.filter(e=>!(h(e)&&n(v(e.q))))}function O(e,t,n,r){let i=e.c.findIndex(e=>h(e)&&v(e.q)===n);if(i>=0){t?e.c[i]=t:e.c.splice(i,1),e.self=e.c.length===0;return}if(!t)return;let a=r.indexOf(n),o=e.c.length;for(let t=0;t<e.c.length;t++){let n=e.c[t];if(h(n)&&r.indexOf(v(n.q))>a){o=t;break}}e.c.splice(o,0,t),e.self=!1}function te(e){return e.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\uFFFE\uFFFF]/g,``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function ne(e){return te(e).replace(/"/g,`"`)}function re(e){return e.indexOf(`&`)<0?e:e.replace(/&(lt|gt|amp|quot|apos|#\d+|#x[0-9a-fA-F]+);/g,(e,t)=>{switch(t){case`lt`:return`<`;case`gt`:return`>`;case`amp`:return`&`;case`quot`:return`"`;case`apos`:return`'`}let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)?String.fromCodePoint(n):e})}function ie(e,t){let n=e=>{let r=!1,i=v(e.q)===`AlternateContent`;for(let a=0;a<e.c.length;a++){let o=e.c[a];if(!h(o))continue;let s=v(o.q);if(s!==`Fallback`){if(i&&s===`Choice`){if(r)continue;r=!0,n(o)}else s===`AlternateContent`?n(o):t(o,e,a)||n(o)}}};n(e)}var ae=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`;function oe(e,t=`id`,n){let r=RegExp(`xmlns:([\\w.-]+)="${ae.replace(/[.]/g,`\\.`)}"`).exec(e.a);return r?{[`${r[1]}:${t}`]:n}:{"xmlns:r":ae,[`r:${t}`]:n}}function k(e){"@babel/helpers - typeof";return k=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k(e)}function se(e,t){if(k(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(k(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ce(e){var t=se(e,`string`);return k(t)==`symbol`?t:t+``}function A(e,t,n){return(t=ce(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=101010256,ue=117853008,de=101075792,j=33639248,M=67324752,N=(e,t)=>Number(e.getBigUint64(t,!0)),fe=class e{constructor(e){A(this,`src`,void 0),A(this,`entries`,new Map),this.src=e}static async open(t){let n=new e(t);return await n.readDirectory(),n}async readDirectory(){let{src:e}=this;if(e.size<22)throw Error(`Not a ZIP/OOXML file (too small)`);let t=Math.min(e.size,65577),n=e.size-t,r=await e.read(n,t),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=-1;for(let e=r.length-22;e>=0;e--)if(i.getUint32(e,!0)===le){a=e;break}if(a<0){let t=await e.read(0,8);throw t[0]===208&&t[1]===207?Error(`Legacy binary Office format (.doc/.xls/.ppt) or encrypted file is not supported`):Error(`Not a ZIP/OOXML file (no end of central directory)`)}let o=i.getUint16(a+10,!0),s=i.getUint32(a+12,!0),c=i.getUint32(a+16,!0);if(o===65535||s===4294967295||c===4294967295){let t=a-20;if(t>=0&&i.getUint32(t,!0)===ue){let n=N(i,t+8),r=await e.read(n,56),a=new DataView(r.buffer,r.byteOffset,r.byteLength);a.getUint32(0,!0)===de&&(o=N(a,32),s=N(a,40),c=N(a,48))}}let l=await e.read(c,s),u=new DataView(l.buffer,l.byteOffset,l.byteLength),d=new TextDecoder,f=0;for(let e=0;e<o&&f+46<=l.length&&u.getUint32(f,!0)===j;e++){let e=u.getUint16(f+8,!0),t=u.getUint16(f+10,!0),n=u.getUint16(f+12,!0),r=u.getUint16(f+14,!0),i=u.getUint32(f+16,!0),a=u.getUint32(f+20,!0),o=u.getUint32(f+24,!0),s=u.getUint16(f+28,!0),c=u.getUint16(f+30,!0),p=u.getUint16(f+32,!0),m=u.getUint32(f+42,!0),h=d.decode(l.subarray(f+46,f+46+s));if(o===4294967295||a===4294967295||m===4294967295){let e=f+46+s,t=e+c;for(;e+4<=t;){let t=u.getUint16(e,!0),n=u.getUint16(e+2,!0);if(t===1){let t=e+4;o===4294967295&&(o=N(u,t),t+=8),a===4294967295&&(a=N(u,t),t+=8),m===4294967295&&(m=N(u,t));break}e+=4+n}}h.endsWith(`/`)||this.entries.set(pe(h),{name:h,method:t,flags:e,crc:i,time:n,date:r,compSize:a,size:o,localOffset:m}),f+=46+s+c+p}}list(){return[...this.entries.values()]}get(e){return this.entries.get(pe(e))}has(e){return this.entries.has(pe(e))}async dataOffset(e){if(e.dataOffset!==void 0)return e.dataOffset;let t=await this.src.read(e.localOffset,30),n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==M)throw Error(`Corrupt ZIP local header for ${e.name}`);return e.dataOffset=e.localOffset+30+n.getUint16(26,!0)+n.getUint16(28,!0),e.dataOffset}async rawData(e){let t=await this.dataOffset(e);return this.src.slice?this.src.slice(t,e.compSize):this.src.read(t,e.compSize)}async stream(e,t){let n=this.get(e);if(!n)throw Error(`Missing part: ${e}`);if(n.flags&1)throw Error(`Encrypted documents are not supported`);let r=await this.dataOffset(n),i=this.src.stream(r,n.compSize);if(t){let e=0,r=n.compSize;i=i.pipeThrough(new TransformStream({transform(n,i){e+=n.length,t(e,r),i.enqueue(n)}}))}if(n.method===0)return i;if(n.method===8)return i.pipeThrough(new DecompressionStream(`deflate-raw`));throw Error(`Unsupported ZIP compression method ${n.method} for ${n.name}`)}async bytes(e){let t=this.get(e);if(!t)throw Error(`Missing part: ${e}`);let n=(await this.stream(e)).getReader(),r=new Uint8Array(t.size),i=0,a=[];for(;;){let{done:e,value:t}=await n.read();if(e)break;i+t.length<=r.length?r.set(t,i):a.push(t),i+=t.length}if(!a.length)return i===r.length?r:r.subarray(0,i);let o=new Uint8Array(i);o.set(r);let s=r.length;for(let e of a)o.set(e,s),s+=e.length;return o}async text(e){return new TextDecoder().decode(await this.bytes(e))}};function pe(e){return e.replace(/^\/+/,``).replace(/\\/g,`/`).toLowerCase()}var me=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function he(e,t=0){let n=~t>>>0;for(let t=0;t<e.length;t++)n=me[(n^e[t])&255]^n>>>8;return~n>>>0}var ge=globalThis.Bun!==void 0;async function P(e){let t=0,n=0,r=e.pipeThrough(new TransformStream({transform(e,r){t=he(e,t),n+=e.length,r.enqueue(e)}})).pipeThrough(new CompressionStream(`deflate-raw`)).getReader(),i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t),a+=t.length}return{chunks:i,crc:t,size:n,csize:a}}function _e(e){if(typeof e==`function`)return e();let t=typeof e==`string`?new TextEncoder().encode(e):e;return new ReadableStream({start(e){e.enqueue(t),e.close()}})}function ve(){let e=new Date;return{time:e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1,date:e.getFullYear()-1980<<9|e.getMonth()+1<<5|e.getDate()}}async function ye(e,t,n=`application/zip`){let r=new TextEncoder,i=[],a=[],o=0,s=0,c=new Map;for(let[e,n]of t)c.set(pe(e),{name:e.replace(/^\/+/,``),data:n});let l=(e,t,n,c,l,u,d,f)=>{let p=r.encode(e),m=/[^\x20-\x7e]/.test(e)?2048:0;if(o>4294967280||c>4294967280)throw Error(`Saved file exceeds 4 GB (ZIP64 writing not supported)`);let h=new Uint8Array(30+p.length),g=new DataView(h.buffer);g.setUint32(0,67324752,!0),g.setUint16(4,20,!0),g.setUint16(6,m,!0),g.setUint16(8,t,!0),g.setUint16(10,u,!0),g.setUint16(12,d,!0),g.setUint32(14,n,!0),g.setUint32(18,c,!0),g.setUint32(22,l,!0),g.setUint16(26,p.length,!0),h.set(p,30);let _=new Uint8Array(46+p.length),v=new DataView(_.buffer);v.setUint32(0,33639248,!0),v.setUint16(4,20,!0),v.setUint16(6,20,!0),v.setUint16(8,m,!0),v.setUint16(10,t,!0),v.setUint16(12,u,!0),v.setUint16(14,d,!0),v.setUint32(16,n,!0),v.setUint32(20,c,!0),v.setUint32(24,l,!0),v.setUint16(28,p.length,!0),v.setUint32(42,o,!0),_.set(p,46),i.push(h,...f),a.push(_),o+=h.length+c,s++},u=async(e,t)=>{let n=await P(_e(t)),{time:r,date:i}=ve();l(e,8,n.crc,n.csize,n.size,r,i,n.chunks)};for(let t of e?.list()??[]){let n=pe(t.name),r=c.get(n);if(r){c.delete(n),r.data!==null&&await u(t.name,r.data);continue}let i=await e.rawData(t);ge&&i instanceof Blob&&(i=new Uint8Array(await i.arrayBuffer())),l(t.name,t.method,t.crc,t.compSize,t.size,t.time,t.date,[i])}for(let{name:e,data:t}of c.values())t!==null&&await u(e,t);let d=a.reduce((e,t)=>e+t.length,0),f=new Uint8Array(22),p=new DataView(f.buffer);return p.setUint32(0,101010256,!0),p.setUint16(8,s,!0),p.setUint16(10,s,!0),p.setUint32(12,d,!0),p.setUint32(16,o,!0),new Blob([...i,...a,f],{type:n})}function be(e,t=`application/zip`){return ye(null,e,t)}var xe=new Set([`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`http://purl.oclc.org/ooxml/officeDocument/relationships`]),F={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`};function I(e){return e.indexOf(`&`)<0?e:e.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`||t[1]===`X`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)&&n<=1114111?String.fromCodePoint(n):e}return F[t]??e})}var Se=e=>e===32||e===9||e===10||e===13,Ce=class{constructor(e,t){A(this,`h`,void 0),A(this,`raw`,void 0),A(this,`buf`,``),A(this,`depth`,0),A(this,`skipDepth`,-1),A(this,`relPrefixes`,new Set([`r`])),this.h=e,this.raw=t}write(e){this.buf=this.buf.length?this.buf+e:e,this.run(!1)}end(){this.run(!0),this.buf=``}run(e){let t=this.buf,n=t.length,r=0;for(;r<n;){let i=t.indexOf(`<`,r);if(i<0){if(e){let e=t.substring(r);this.raw?.(e),this.onText(e),r=n}break}if(i>r){let e=t.substring(r,i);this.raw?.(e),this.onText(e)}if(r=i,i+1>=n)break;let a=t.charCodeAt(i+1);if(a===47){let e=t.indexOf(`>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+1)),this.onClose(t.substring(i+2,e)),r=e+1;continue}if(a===63){let e=t.indexOf(`?>`,i+2);if(e<0)break;this.raw?.(t.substring(i,e+2)),r=e+2;continue}if(a===33){if(n-i<9&&!e)break;if(t.startsWith(`<!--`,i)){let e=t.indexOf(`-->`,i+4);if(e<0)break;this.raw?.(t.substring(i,e+3)),r=e+3;continue}if(t.startsWith(`<![CDATA[`,i)){let e=t.indexOf(`]]>`,i+9);if(e<0)break;this.raw?.(t.substring(i,e+3)),this.skipDepth<0&&this.h.text(t.substring(i+9,e)),r=e+3;continue}let a=t.indexOf(`>`,i+2);if(a<0)break;this.raw?.(t.substring(i,a+1)),r=a+1;continue}let o=-1,s=0;for(let e=i+1;e<n;e++){let n=t.charCodeAt(e);if(s!==0)n===s&&(s=0);else if(n===34||n===39)s=n;else if(n===62){o=e;break}}if(o<0)break;this.raw?.(t.substring(i,o+1)),this.onOpen(t,i+1,o),r=o+1}this.buf=r>=n?``:t.substring(r)}onText(e){this.skipDepth>=0||this.depth===0||this.h.text(e.indexOf(`&`)>=0?I(e):e)}onOpen(e,t,n){let r=n,i=!1;if(e.charCodeAt(n-1)===47&&(i=!0,r=n-1),this.skipDepth>=0){i||this.depth++;return}let a=t;for(;a<r&&!Se(e.charCodeAt(a));)a++;let o=e.substring(t,a),s=o.indexOf(`:`),c=s<0?o:o.substring(s+1),l={};for(;a<r;){if(Se(e.charCodeAt(a))){a++;continue}let t=e.indexOf(`=`,a);if(t<0||t>=r)break;let n=e.substring(a,t).trim(),i=t+1;for(;i<r&&e.charCodeAt(i)!==34&&e.charCodeAt(i)!==39;)i++;if(i>=r)break;let o=e.indexOf(e[i],i+1);if(o<0)break;let s=e.substring(i+1,o);a=o+1;let c=n.indexOf(`:`);if(c>=0){let e=n.substring(0,c),t=n.substring(c+1);if(e===`xmlns`){xe.has(s)&&this.relPrefixes.add(t);continue}n=this.relPrefixes.has(e)?`r:`+t:t}else if(n===`xmlns`)continue;l[n]=s.indexOf(`&`)>=0?I(s):s}let u=this.h.open(c,l,i);i?u||this.h.close(c):(this.depth++,u&&(this.skipDepth=this.depth))}onClose(e){if(this.skipDepth>=0){this.depth===this.skipDepth&&(this.skipDepth=-1),this.depth--;return}this.depth--;let t=e.trim(),n=t.indexOf(`:`);this.h.close(n<0?t:t.substring(n+1))}},we=class extends Error{constructor(){super(`aborted`),this.name=`AbortError`}};async function Te(e,t,n={}){let r=e.getReader(),i=new TextDecoder,a=new Ce(t,n.raw);try{for(;;){if(n.signal?.aborted)throw new we;let{done:e,value:t}=await r.read();if(e)break;a.write(i.decode(t,{stream:!0})),n.onChunk&&await n.onChunk(t.length)}a.write(i.decode()),a.end()}catch(e){throw r.cancel().catch(()=>{}),e}}var Ee=0,De=1,Oe=class{constructor(e={}){A(this,`o`,void 0),A(this,`root`,null),A(this,`stack`,[]),A(this,`parents`,[]),A(this,`depth`,0),A(this,`alt`,[]),this.o=e}open(e,t){if(e===`Fallback`||this.o.skip?.has(e))return!0;if(e===`AlternateContent`){this.alt.push(!1),this.stack.push(Ee);return}if(e===`Choice`&&this.alt.length){let e=this.alt.length-1;if(this.alt[e])return!0;this.alt[e]=!0,this.stack.push(Ee);return}let n=this.depth++;if(this.o.emitDepth!==void 0&&n<this.o.emitDepth){this.o.onShallowOpen?.(e,t,n),this.stack.push(De);return}let r={n:e,a:t,c:[],t:``},i=this.parents[this.parents.length-1];i&&i.c.push(r),this.parents.push(r),this.stack.push(r)}close(e){let t=this.stack.pop();t===Ee?e===`AlternateContent`&&this.alt.pop():(this.depth--,t!==De&&t!==void 0&&(this.parents.pop(),this.parents.length===0&&(this.o.emitDepth===void 0?this.root=t:this.o.onElement?.(t))))}text(e){let t=this.parents[this.parents.length-1];t&&(t.t+=e)}};function ke(e,t){let n=new Oe({skip:t}),r=new Ce(n);if(r.write(e),r.end(),!n.root)throw Error(`Empty XML document`);return n.root}function L(e,t){if(e){for(let n of e.c)if(n.n===t)return n}}function R(e,t){return e?e.c.filter(e=>e.n===t):[]}function z(e,...t){let n=e;for(let e of t)if(n=L(n,e),!n)return;return n}function Ae(e,t){if(e)for(let n of e.c){if(n.n===t)return n;let e=Ae(n,t);if(e)return e}}function B(e,t,n=[]){if(!e)return n;for(let r of e.c)r.n===t?n.push(r):B(r,t,n);return n}function V(e,t){if(e===void 0||e===``)return t;let n=Number(e);return Number.isFinite(n)?n:t}function je(e,t=`val`){if(!e)return;let n=e.a[t];return n===void 0||n!==`0`&&n!==`false`&&n!==`off`&&n!==`none`}function Me(e){if(!e)return``;if(!e.c.length)return e.t;let t=``;for(let n of e.c)t+=n.n===`t`?n.t:Me(n);return t}var Ne={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,jpe:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`,tif:`image/tiff`,tiff:`image/tiff`,ico:`image/x-icon`,emf:`image/emf`,wmf:`image/wmf`,mp4:`video/mp4`,m4v:`video/mp4`,mov:`video/quicktime`,mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`};function Pe(e){return Ne[e.split(`.`).pop()?.toLowerCase()??``]??`application/octet-stream`}function Fe(e){return/\.(png|jpe?g|jpe|gif|bmp|svg|webp|ico)$/i.test(e)}function Ie(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function Le(e,t){if(t.startsWith(`/`))return t.slice(1);let n=e?e.split(`/`):[];for(let e of t.split(`/`))e===`..`?n.pop():e&&e!==`.`&&n.push(e);return n.join(`/`)}function Re(e,t){let n=e?e.split(`/`):[],r=t.split(`/`),i=0;for(;i<n.length&&i<r.length-1&&n[i]===r[i];)i++;return[...n.slice(i).map(()=>`..`),...r.slice(i)].join(`/`)}function ze(e){let t=Ie(e),n=e.slice(t.length?t.length+1:0);return(t?t+`/`:``)+`_rels/`+n+`.rels`}var Be=class{constructor(e){A(this,`zip`,void 0),A(this,`relsCache`,new Map),A(this,`xmlCache`,new Map),A(this,`contentTypes`,void 0),A(this,`changes`,new Map),this.zip=e}has(e){let t=this.changes.get(pe(e));return t?t.data!==null:this.zip.has(e)}get dirty(){return this.changes.size>0}async text(e){let t=this.changes.get(pe(e));if(t){if(t.data===null)throw Error(`Missing part: ${e}`);if(typeof t.data==`string`)return t.data;if(t.data instanceof Uint8Array)return new TextDecoder().decode(t.data);throw Error(`Part ${e} is a stream`)}return this.zip.text(e)}async stream(e,t){let n=this.changes.get(pe(e));if(!n)return this.zip.stream(e,t);if(n.data===null)throw Error(`Missing part: ${e}`);if(typeof n.data==`function`)return n.data();let r=typeof n.data==`string`?new TextEncoder().encode(n.data):n.data;return new ReadableStream({start(e){e.enqueue(r),e.close()}})}setPart(e,t){e=e.replace(/^\/+/,``),this.changes.set(pe(e),{path:e,data:t}),this.xmlCache.delete(e),this.relsCache.clear(),/\[content_types\]\.xml$/i.test(e)&&(this.contentTypes=void 0)}async save(e){let t=new Map;for(let{path:e,data:n}of this.changes.values())t.set(e,n);return ye(this.zip,t,e)}async addRel(e,t,n,r=!1){let i=ze(e),a=this.has(i)?g(await this.text(i)):g(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
11
11
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`),o=b(a),s=new Set(x(o,`Relationship`).map(e=>w(e,`Id`))),c=s.size+1;for(;s.has(`rId${c}`);)c++;let l=`rId${c}`;return o.c.push(E(`Relationship`,r?{Id:l,Type:t,Target:n,TargetMode:`External`}:{Id:l,Type:t,Target:Re(Ie(e),n)})),o.self=!1,this.setPart(i,_(a)),l}async removeRelsTo(e,t){let n=ze(e);if(!this.has(n))return;let r=g(await this.text(n)),i=b(r),a=Ie(e);i.c=i.c.filter(e=>!(h(e)&&Le(a,w(e,`Target`)??``).toLowerCase()===t.toLowerCase())),this.setPart(n,_(r))}async ensureDefaultType(e,t){let n=`[Content_Types].xml`,r=g(await this.text(n)),i=b(r);x(i,`Default`).some(t=>w(t,`Extension`)?.toLowerCase()===e.toLowerCase())||(i.c.unshift(E(`Default`,{Extension:e,ContentType:t})),this.setPart(n,_(r)))}freeName(e,t,n){for(let r=1;;r++){let i=`${e}/${t}${r}.${n}`;if(!this.has(i))return i}}async setContentType(e,t){let n=`[Content_Types].xml`,r=g(await this.text(n)),i=b(r),a=`/`+e.replace(/^\/+/,``);i.c=i.c.filter(e=>!(h(e)&&w(e,`PartName`)?.toLowerCase()===a.toLowerCase())),t&&i.c.push(E(`Override`,{PartName:a,ContentType:t})),this.setPart(n,_(r))}xml(e,t=!0){let n=async()=>this.has(e)?ke(await this.text(e),Ue):void 0;if(!t)return n();let r=this.xmlCache.get(e);return r||this.xmlCache.set(e,r=n()),r}rels(e){let t=this.relsCache.get(e);return t||(t=(async()=>{let t=new Map,n=ze(e);if(!this.has(n))return t;let r=ke(await this.text(n)),i=Ie(e);for(let e of R(r,`Relationship`)){let n=e.a.TargetMode===`External`,r=e.a.Target??``;t.set(e.a.Id,{id:e.a.Id,type:e.a.Type??``,external:n,target:n?r:Le(i,r)})}return t})(),this.relsCache.set(e,t)),t}async contentType(e){this.contentTypes||(this.contentTypes=(async()=>{let e=new Map;if(!this.has(`[Content_Types].xml`))return e;let t=ke(await this.text(`[Content_Types].xml`));for(let n of R(t,`Default`))e.set(`ext:`+(n.a.Extension??``).toLowerCase(),n.a.ContentType);for(let n of R(t,`Override`))e.set((n.a.PartName??``).replace(/^\//,``).toLowerCase(),n.a.ContentType);return e})());let t=await this.contentTypes,n=e.toLowerCase();return t.get(n)??t.get(`ext:`+(n.split(`.`).pop()??``))}async blob(e){let t=this.changes.get(pe(e)),n=t&&t.data!==null&&typeof t.data!=`function`?typeof t.data==`string`?new TextEncoder().encode(t.data):t.data:await this.zip.bytes(e);return new Blob([n],{type:Pe(e)})}async mainPart(){let e=await this.rels(``),t;for(let n of e.values())n.type.endsWith(`/officeDocument`)&&(t=n.target);let n=[[`word/document.xml`,`docx`],[`xl/workbook.xml`,`xlsx`],[`ppt/presentation.xml`,`pptx`]];if(t||(t=n.find(([e])=>this.zip.has(e))?.[0]),!t)throw Error(`Not an Office Open XML document (no main part found)`);let r=await this.contentType(t)??``,i;if(i=r.includes(`wordprocessingml`)?`docx`:r.includes(`spreadsheetml`)?`xlsx`:r.includes(`presentationml`)?`pptx`:n.find(([e])=>t.toLowerCase().startsWith(e.split(`/`)[0]+`/`))?.[1],!i)throw Error(`Unsupported document type (${r||t})`);return{path:t,kind:i}}};function Ve(e,t){for(let n of e.values())if(n.type.endsWith(`/`+t))return n}function He(e,t){return[...e.values()].filter(e=>e.type.endsWith(`/`+t))}var Ue=new Set([`extLst`]),We={colors:{dk1:`#000000`,lt1:`#ffffff`,dk2:`#44546a`,lt2:`#e7e6e6`,accent1:`#4472c4`,accent2:`#ed7d31`,accent3:`#a5a5a5`,accent4:`#ffc000`,accent5:`#5b9bd5`,accent6:`#70ad47`,hlink:`#0563c1`,folHlink:`#954f72`},major:`Calibri Light`,minor:`Calibri`,fillStyles:[],bgFillStyles:[],lineStyles:[]};function Ge(e){if(!e)return We;let t=L(e,`themeElements`),n={...We.colors};for(let e of L(t,`clrScheme`)?.c??[]){let t=e.c[0];t&&(t.n===`srgbClr`&&t.a.val?n[e.n]=`#`+t.a.val.toLowerCase():t.n===`sysClr`&&(n[e.n]=`#`+(t.a.lastClr??(t.a.val===`window`?`ffffff`:`000000`)).toLowerCase()))}let r=L(t,`fontScheme`),i=L(t,`fmtScheme`);return{colors:n,major:z(r,`majorFont`,`latin`)?.a.typeface||We.major,minor:z(r,`minorFont`,`latin`)?.a.typeface||We.minor,fillStyles:L(i,`fillStyleLst`)?.c??[],bgFillStyles:L(i,`bgFillStyleLst`)?.c??[],lineStyles:R(L(i,`lnStyleLst`),`ln`)}}var Ke=9525,qe=12700,H=e=>(e??0)/Ke,Je=e=>(e??0)/qe,Ye={calibri:`Carlito`,cambria:`Caladea`,arial:`"Liberation Sans", Arimo`,helvetica:`"Liberation Sans", Arimo`,"times new roman":`"Liberation Serif", Tinos`,"courier new":`"Liberation Mono", Cousine`,"segoe ui":`system-ui`,"calibri light":`Carlito`,aptos:`"Segoe UI", system-ui`,"aptos display":`"Segoe UI", system-ui`},Xe=/times|cambria|georgia|garamond|book|serif|palatino|minion|baskerville|didot|caslon|mincho|song/i,Ze=/courier|mono|consolas|menlo|code/i,Qe=new Map;function $e(e){if(!e)return;let t=Qe.get(e);if(t)return t;let n=e.toLowerCase(),r=Ze.test(e)?`monospace`:Xe.test(e)&&!/sans/i.test(e)?`serif`:`sans-serif`,i=Ye[n];return t=`"${e.replace(/"/g,``)}"${i?`, `+i:``}, ${r}`,Qe.set(e,t),t}var et={yellow:`#ffff00`,green:`#00ff00`,cyan:`#00ffff`,magenta:`#ff00ff`,blue:`#0000ff`,red:`#ff0000`,darkBlue:`#000080`,darkCyan:`#008080`,darkGreen:`#008000`,darkMagenta:`#800080`,darkRed:`#800000`,darkYellow:`#808000`,darkGray:`#808080`,lightGray:`#c0c0c0`,black:`#000000`,white:`#ffffff`},tt=e=>e&&e!==`auto`&&/^[0-9a-fA-F]{6}$/.test(e)?`#`+e.toLowerCase():void 0;function nt(e){if(e)return tt(e.a.fill)??(e.a.val===`solid`?tt(e.a.color):void 0)}var rt={single:`solid`,thick:`solid`,double:`double`,dotted:`dotted`,dashed:`dashed`,dotDash:`dashed`,dotDotDash:`dotted`,triple:`double`,thinThickSmallGap:`double`,thickThinSmallGap:`double`,wave:`solid`,dashSmallGap:`dashed`,outset:`outset`,inset:`inset`};function it(e){if(!e)return;let t=e.a.val;if(!t||t===`nil`||t===`none`)return null;let n=Math.max(.5,(V(e.a.sz)??4)/8);return{w:t===`double`?Math.max(n,2.25):n,style:rt[t]??`solid`,color:tt(e.a.color)??`#000000`}}var at=e=>e===null?`none`:e?`${e.w}pt ${e.style} ${e.color}`:void 0;function ot(e,t){let n=e.a.asciiTheme??e.a.hAnsiTheme;return $e(n?n.startsWith(`major`)?t.major:t.minor:e.a.ascii??e.a.hAnsi??e.a.cs??e.a.eastAsia)}function st(e,t){let n={};if(!e)return n;for(let r of e.c)switch(r.n){case`b`:n.b=je(r);break;case`i`:n.i=je(r);break;case`strike`:n.strike=je(r);break;case`dstrike`:n.dstrike=je(r);break;case`caps`:n.caps=je(r);break;case`smallCaps`:n.smallCaps=je(r);break;case`vanish`:n.vanish=je(r);break;case`u`:n.u=r.a.val??`single`;break;case`color`:{let e=tt(r.a.val);e&&(n.color=e);break}case`sz`:{let e=V(r.a.val);e&&(n.sz=e/2);break}case`rFonts`:{let e=ot(r,t);e&&(n.font=e);break}case`highlight`:{let e=et[r.a.val];e&&(n.hl=e);break}case`shd`:{let e=nt(r);e&&(n.shd=e);break}case`vertAlign`:n.va=r.a.val===`superscript`?`sup`:r.a.val===`subscript`?`sub`:void 0;break;case`spacing`:{let e=V(r.a.val);e&&(n.spacing=e/20);break}}return n}function ct(e){let t={},n={ps:t};if(!e)return n;for(let r of e.c)switch(r.n){case`pStyle`:n.styleId=r.a.val;break;case`numPr`:{let e=L(r,`numId`)?.a.val;e!==void 0&&(n.numPr={numId:e,ilvl:V(L(r,`ilvl`)?.a.val,0)});break}case`jc`:{let e=r.a.val;t.align=e===`center`?`center`:e===`right`||e===`end`?`right`:e===`both`||e===`distribute`?`justify`:`left`;break}case`ind`:{let e=V(r.a.left??r.a.start),n=V(r.a.right??r.a.end);e!==void 0&&(t.indL=e/20),n!==void 0&&(t.indR=n/20);let i=V(r.a.hanging),a=V(r.a.firstLine);i===void 0?a!==void 0&&(t.indFirst=a/20):t.indFirst=-i/20;break}case`spacing`:{let e=V(r.a.before),n=V(r.a.after);r.a.beforeAutospacing===`1`||r.a.beforeAutospacing===`true`?t.before=14:e!==void 0&&(t.before=e/20),r.a.afterAutospacing===`1`||r.a.afterAutospacing===`true`?t.after=14:n!==void 0&&(t.after=n/20);let i=V(r.a.line);if(i!==void 0){let e=r.a.lineRule??`auto`;t.lineRule=e,t.line=e===`auto`?i/240:i/20}break}case`shd`:{let e=nt(r);e&&(t.shd=e);break}case`pBdr`:{let e=it(L(r,`top`)),n=it(L(r,`bottom`)),i=it(L(r,`left`)??L(r,`start`)),a=it(L(r,`right`)??L(r,`end`));e&&(t.bTop=e),n&&(t.bBottom=n),i&&(t.bLeft=i),a&&(t.bRight=a);break}case`keepNext`:t.keepNext=je(r);break;case`contextualSpacing`:t.contextual=je(r);break;case`pageBreakBefore`:t.pageBreakBefore=je(r);break;case`outlineLvl`:t.outline=V(r.a.val);break;case`sectPr`:n.sectPr=r}return n}var lt=(...e)=>Object.assign({},...e.filter(Boolean)),ut={normal:`normal`,title:`title`,subtitle:`subtitle`,"heading 1":`h1`,"heading 2":`h2`,"heading 3":`h3`,"heading 4":`h4`,"heading 5":`h5`,"heading 6":`h6`,heading1:`h1`,heading2:`h2`,heading3:`h3`,heading4:`h4`,heading5:`h5`,heading6:`h6`},dt=class{constructor(e,t){if(A(this,`theme`,void 0),A(this,`defs`,new Map),A(this,`paraCache`,new Map),A(this,`charCache`,new Map),A(this,`tblCache`,new Map),A(this,`defaultPara`,void 0),A(this,`defaultTable`,void 0),A(this,`docRs`,{}),A(this,`docPs`,{}),this.theme=t,!e)return;let n=L(e,`docDefaults`);this.docRs=st(z(n,`rPrDefault`,`rPr`),t),this.docPs=ct(z(n,`pPrDefault`,`pPr`)).ps;for(let t of R(e,`style`)){let e=t.a.styleId;if(!e)continue;let n={id:e,type:t.a.type??`paragraph`,basedOn:L(t,`basedOn`)?.a.val,el:t,isDefault:t.a.default===`1`||t.a.default===`true`,name:L(t,`name`)?.a.val??e,next:L(t,`next`)?.a.val,quick:!!L(t,`qFormat`),hidden:!!L(t,`semiHidden`)||!!L(t,`hidden`)};this.defs.set(e,n),n.isDefault&&n.type===`paragraph`&&(this.defaultPara=e),n.isDefault&&n.type===`table`&&(this.defaultTable=e)}}add(e){let t=e.a.styleId;t&&(this.defs.set(t,{id:t,type:e.a.type??`paragraph`,basedOn:L(e,`basedOn`)?.a.val,el:e,isDefault:!1,name:L(e,`name`)?.a.val??t,next:L(e,`next`)?.a.val,quick:!!L(e,`qFormat`),hidden:!1}),this.paraCache.clear())}canonical(){let e={};this.defaultPara&&(e.normal=this.defaultPara);for(let t of this.defs.values()){if(t.type!==`paragraph`)continue;let n=ut[t.name.toLowerCase()]??ut[t.id.toLowerCase()];n&&!e[n]&&(e[n]=t.id)}return e}has(e){return this.defs.has(e)}quickStyles(){let e=e=>e.replace(/^heading (\d)$/i,`Heading $1`).replace(/^\w/,e=>e.toUpperCase()),t=this.canonical(),n=new Map(Object.entries(t).map(([e,t])=>[t,e]));return[...this.defs.values()].filter(e=>e.type===`paragraph`&&(e.isDefault||n.has(e.id)||e.quick&&!e.hidden)).map(t=>{let r=this.para(t.id),{b:i,i:a,color:o,sz:s,font:c}=r.rs;return{id:t.id,name:e(t.name),next:t.next,canon:n.get(t.id),outline:r.ps.outline,preview:{b:i,i:a,color:o,sz:s,font:c}}})}chain(e){let t=[],n=new Set,r=e?this.defs.get(e):void 0;for(;r&&!n.has(r.id);)n.add(r.id),t.unshift(r),r=r.basedOn?this.defs.get(r.basedOn):void 0;return t}para(e){let t=e??this.defaultPara??``,n=this.paraCache.get(t);if(n)return n;n={ps:{},rs:{}};for(let e of this.chain(t)){let t=ct(L(e.el,`pPr`));n.ps=lt(n.ps,t.ps),t.numPr&&(n.numPr=t.numPr),n.rs=lt(n.rs,st(L(e.el,`rPr`),this.theme))}return this.paraCache.set(t,n),n}char(e){if(!e)return{};let t=this.charCache.get(e);if(t)return t;t={};for(let n of this.chain(e))t=lt(t,st(L(n.el,`rPr`),this.theme));return this.charCache.set(e,t),t}table(e){let t=e??this.defaultTable??``,n=this.tblCache.get(t);if(n)return n;n={ps:{},rs:{},borders:{},cellMar:{},cond:{}};for(let e of this.chain(t)){n.ps=lt(n.ps,ct(L(e.el,`pPr`)).ps),n.rs=lt(n.rs,st(L(e.el,`rPr`),this.theme));let t=L(e.el,`tblPr`);Object.assign(n.borders,ft(L(t,`tblBorders`))),Object.assign(n.cellMar,pt(L(t,`tblCellMar`)));let r=nt(z(e.el,`tcPr`,`shd`));r&&(n.shd=r);for(let t of R(e.el,`tblStylePr`)){let e=t.a.type;if(!e)continue;let r=n.cond[e]??{rs:{}};n.cond[e]={rs:lt(r.rs,st(L(t,`rPr`),this.theme)),shd:nt(z(t,`tcPr`,`shd`))??r.shd}}}return this.tblCache.set(t,n),n}};function ft(e){let t={};if(!e)return t;for(let n of e.c){let e=n.n===`start`?`left`:n.n===`end`?`right`:n.n,r=it(n);r!==void 0&&(t[e]=r)}return t}function pt(e){let t={};if(!e)return t;for(let n of e.c){let e=n.n===`start`?`left`:n.n===`end`?`right`:n.n,r=V(n.a.w);r!==void 0&&(n.a.type===void 0||n.a.type===`dxa`)&&(t[e]=r/20)}return t}var mt={"":`•`,"":`▪`,"":`□`,"":`✓`,"":`➢`,"":`❖`,"":`➔`,"":`■`,"":`□`,"":`❑`,"":`◆`,"":`➔`,"":`⇨`,"":`→`,"":`–`,"·":`•`,"":`—`,"":`○`,"":`•`,"":`☑`,o:`◦`};function ht(e){let t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function gt(e){return e<=0?``:String.fromCharCode(97+(e-1)%26).repeat(Math.floor((e-1)/26)+1)}function _t(e,t){switch(t){case`decimalZero`:return e<10?`0`+e:String(e);case`upperRoman`:return ht(e).toUpperCase();case`lowerRoman`:return ht(e);case`upperLetter`:return gt(e).toUpperCase();case`lowerLetter`:return gt(e);case`ordinal`:{let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}case`none`:return``;case`bullet`:return``;default:return String(e)}}var vt=class{constructor(e,t){if(A(this,`abstracts`,new Map),A(this,`nums`,new Map),A(this,`counters`,new Map),!e)return;let n=e=>{let n={};for(let r of R(e,`lvl`)){let e=V(r.a.ilvl,0);n[e]={start:V(L(r,`start`)?.a.val,1),fmt:L(r,`numFmt`)?.a.val??`decimal`,text:L(r,`lvlText`)?.a.val??``,ps:ct(L(r,`pPr`)).ps,rs:st(L(r,`rPr`),t),isLgl:!!L(r,`isLgl`),suff:L(r,`suff`)?.a.val??`tab`,restart:V(L(r,`lvlRestart`)?.a.val)}}return n};for(let t of R(e,`abstractNum`))this.abstracts.set(t.a.abstractNumId,n(t));for(let t of R(e,`num`)){let e={abstractId:L(t,`abstractNumId`)?.a.val??``,starts:{},levels:{}};for(let r of R(t,`lvlOverride`)){let t=V(r.a.ilvl,0),i=V(L(r,`startOverride`)?.a.val);i!==void 0&&(e.starts[t]=i);let a=L(r,`lvl`);a&&Object.assign(e.levels,n({n:`x`,a:{},c:[{...a,a:{...a.a,ilvl:String(t)}}],t:``}))}this.nums.set(t.a.numId,e)}}reset(){this.counters.clear()}findList(e){for(let[t,n]of this.nums){if(Object.keys(n.starts).length)continue;let r=this.abstracts.get(n.abstractId)?.[0];if(r&&(e===`bullet`?r.fmt===`bullet`:r.fmt===`decimal`))return t}}ids(){let e=[...this.abstracts.keys()].map(Number).filter(Number.isFinite),t=[...this.nums.keys()].map(Number).filter(Number.isFinite);return{abstract:e.length?Math.max(...e)+1:0,num:t.length?Math.max(...t)+1:1}}level(e,t){let n=this.nums.get(e);if(n)return n.levels[t]??this.abstracts.get(n.abstractId)?.[t]}next(e,t){let n=this.nums.get(e),r=this.level(e,t);if(!n||!r)return;let i=Object.keys(n.starts).length>0?`n`+e:`a`+n.abstractId,a=this.counters.get(i);a||(a=[],this.counters.set(i,a));let o=t=>n.starts[t]??this.level(e,t)?.start??1;a[t]=a[t]===void 0?o(t):a[t]+1;for(let e=t+1;e<9;e++)a[e]=void 0;for(let e=0;e<t;e++)a[e]===void 0&&(a[e]=o(e));if(r.fmt===`bullet`){let e=r.text;return{text:mt[e]??(e||`•`),level:r}}return{text:r.text.replace(/%(\d)/g,(n,i)=>{let s=Number(i)-1,c=this.level(e,s);return _t(a[s]??o(s),r.isLgl&&s<t?`decimal`:c?.fmt??`decimal`)}),level:r}}},yt={w:612,h:792,mt:72,mr:72,mb:72,ml:72,header:36,footer:36};function bt(e){let t=/^\s*(PAGE|NUMPAGES|SECTIONPAGES)\b/i.exec(e);if(t)return t[1].toUpperCase()===`PAGE`?`PAGE`:`NUMPAGES`}function xt(e,t){if(e===t)return!0;if(!e||!t)return!e&&!t;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function St(e,t){if(!e)return;let n=RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([\\d.]+)\\s*(pt|in|px|cm|mm)?`,`i`).exec(e);if(!n)return;let r=Number(n[1]);switch((n[2]??`px`).toLowerCase()){case`pt`:return r;case`in`:return r*72;case`cm`:return r*72/2.54;case`mm`:return r*72/25.4;default:return r*.75}}function Ct(e){if(!e)return{...yt};let t=L(e,`pgSz`),n=L(e,`pgMar`),r=(e,t)=>e===void 0?t:Math.abs(Number(e))/20,i=r(t?.a.w,yt.w),a=r(t?.a.h,yt.h);return t?.a.orient===`landscape`&&a>i&&([i,a]=[a,i]),{w:i,h:a,mt:r(n?.a.top,72),mr:r(n?.a.right??n?.a.end,72),mb:r(n?.a.bottom,72),ml:r(n?.a.left??n?.a.start,72),header:r(n?.a.header,36),footer:r(n?.a.footer,36)}}var wt=new Set([`p`,`del`,`moveFrom`,`oMath`,`oMathPara`,`pPr`,`rPr`,`r`]);function Tt(e){let t=new Map,n=e=>{for(let r of e.c)r.n===`r`&&t.set(r,t.size),wt.has(r.n)||n(r)};return n(e),t}function Et(e,t=new Map){let n=e=>{e.n===`p`&&t.set(e,t.size);for(let t of e.c)n(t)};for(let t of e)n(t);return t}function Dt(e,t,n){let r=e.next(t.numId,t.ilvl);if(!r)return;let i=lt(n,r.level.rs);return delete i.u,delete i.hl,{marker:{text:r.level.suff===`space`?r.text+` `:r.text,s:i,tab:r.level.suff===`tab`},lst:r.level.fmt===`bullet`?`bullet`:`number`}}var Ot=class{constructor(e,t,n,r,i={}){A(this,`styles`,void 0),A(this,`numbering`,void 0),A(this,`theme`,void 0),A(this,`rels`,void 0),A(this,`hooks`,void 0),A(this,`fields`,[]),A(this,`tableLayer`,void 0),A(this,`boxDepth`,0),A(this,`tableDepth`,0),A(this,`cur`,void 0),this.styles=e,this.numbering=t,this.theme=n,this.rels=r,this.hooks=i}blocks(e,t){switch(e.n){case`p`:this.paragraph(e,t);break;case`tbl`:t.push(this.table(e));break;case`sdt`:for(let n of L(e,`sdtContent`)?.c??[])this.blocks(n,t);break;case`customXml`:case`ins`:case`smartTag`:case`sdtContent`:for(let n of e.c)this.blocks(n,t)}}paragraph(e,t){let n=L(e,`pPr`),r=ct(n),i=this.styles.para(r.styleId),a=this.hooks.forced?.root===e?this.hooks.forced:void 0,o=a?a.layer:this.tableLayer,s=r.numPr??i.numPr,c=s&&s.numId!==`0`?this.numbering.level(s.numId,s.ilvl):void 0,l=lt(this.styles.docPs,o?.ps,i.ps,c?.ps,r.ps),u=lt(this.styles.docRs,o?.rs,i.rs),d=lt(u,st(L(n,`rPr`),this.theme)),f=r.styleId??this.styles.defaultPara??``,p={t:`p`,ps:l,runs:[],markSz:d.sz,markFont:d.font,sid:f};l.pageBreakBefore&&(p.pb=!0);let m;if(c&&s){if(a)m=c.fmt===`bullet`?`bullet`:`number`,a.marker?p.marker=a.marker:p.marker={text:c.fmt===`bullet`?`•`:``,s:lt(d,c.rs),tab:c.suff===`tab`};else{let e=Dt(this.numbering,s,d);e&&(p.marker=e.marker,m=e.lst)}m&&(p.lst=m,p.ilvl=s.ilvl)}let h={layer:o,num:s&&s.numId!==`0`?s:void 0,ro:this.fields.length>0||this.boxDepth>0||this.tableDepth>1,sid:f,lst:m,marker:p.marker};a&&(a.rec=h);let g=a?a.pid:this.hooks.para?.(e,h);g!==void 0&&(p.pid=g);let _=this.cur;this.cur={pid:g,runs:Tt(e),forced:a};let v=[p];this.inlines(e.c,u,void 0,void 0,{push:e=>{let t=p.runs,n=t[t.length-1];e.t===`text`&&n?.t===`text`&&n.href===e.href&&n.lk===e.lk&&xt(n.s,e.s)&&xt(n.d,e.d)?n.text+=e.text:t.push(e)},pageBreak:()=>{p={t:`p`,ps:l,runs:[],markSz:d.sz,markFont:d.font,pb:!0,sid:f},g!==void 0&&(p.pid=g),v.push(p)}}),this.cur=_,this.fields.length>0&&(h.ro=!0);for(let e of v)h.ro&&(e.ro=!0),t.push(e);r.sectPr&&t.push({t:`sect`,page:Ct(r.sectPr),kind:L(r.sectPr,`type`)?.a.val??`nextPage`})}srcOf(e){let t=this.cur;if(!t)return{};let n=t.runs.get(e);if(n===void 0)return{};if(t.forced){let e=t.forced.map[n];return e?{src:e.src,d:e.d}:{}}return t.pid===void 0?{}:{src:[t.pid,n]}}inlines(e,t,n,r,i){for(let a of e)switch(a.n){case`r`:this.run(a,t,n,r,i);break;case`hyperlink`:{let e=a.a[`r:id`],o=e?this.rels.get(e)?.target:a.a.anchor?`#`+a.a.anchor:void 0,s=e?`r:`+e:a.a.anchor?`a:`+a.a.anchor:void 0;this.inlines(a.c,t,o??n,s??r,i);break}case`fldSimple`:{let e=bt(a.a.instr??``);if(e){let n=L(a,`r`);i.push({t:`field`,kind:e,s:lt(t,st(L(n,`rPr`),this.theme)),...n?this.srcOf(n):{}})}else this.inlines(a.c,t,n,r,i);break}case`ins`:case`smartTag`:case`customXml`:case`bdo`:case`dir`:case`moveTo`:this.inlines(a.c,t,n,r,i);break;case`sdt`:this.inlines(L(a,`sdtContent`)?.c??[],t,n,r,i);break;case`oMath`:case`oMathPara`:{let e=B(a,`t`).map(e=>e.t).join(``);e&&i.push({t:`text`,text:e,s:{...t,i:!0,font:`"Cambria Math", "STIX Two Math", serif`}});break}}}run(e,t,n,r,i){let a=L(e,`rPr`),o=lt(t,this.styles.char(L(a,`rStyle`)?.a.val),st(a,this.theme));if(o.vanish)return;let{src:s,d:c}=this.srcOf(e),l=(e,t=o,a=n)=>i.push({t:`text`,text:e,s:t,href:a,lk:a===n?r:void 0,src:s,d:c});for(let t of e.c){let e=this.fields[this.fields.length-1];switch(t.n){case`fldChar`:{let n=t.a.fldCharType;if(n===`begin`)this.fields.push({instr:``,phase:`instr`});else if(n===`separate`&&e){e.phase=`result`,e.kind=bt(e.instr);let t=/HYPERLINK\s+(?:\\l\s+)?"([^"]+)"/.exec(e.instr);t&&(e.href=/\\l/.test(e.instr)?`#`+t[1]:t[1]),e.kind&&i.push({t:`field`,kind:e.kind,s:o,src:s})}else if(n===`end`){if(e&&e.phase===`instr`){let t=bt(e.instr);t&&i.push({t:`field`,kind:t,s:o,src:s})}this.fields.pop()}break}case`instrText`:e&&(e.instr+=t.t);break;case`t`:if(e&&(e.phase===`instr`||e.kind))break;t.t&&l(t.t,o,e?.href??n);break;case`tab`:case`ptab`:(!e||e.phase===`result`&&!e.kind)&&l(` `);break;case`br`:t.a.type===`page`?i.pageBreak():l(`
|
|
12
12
|
`);break;case`cr`:l(`
|
|
13
13
|
`);break;case`noBreakHyphen`:l(`‑`);break;case`softHyphen`:l(``);break;case`sym`:{let e=parseInt(t.a.char??``,16);e&&l(String.fromCharCode(e>=61440?e-61440:e),{...o,font:t.a.font?`"${t.a.font}", ${o.font??`serif`}`:o.font});break}case`drawing`:this.drawing(t,n,i,s);break;case`pict`:case`object`:this.vml(t,n,i,s);break;case`footnoteReference`:case`endnoteReference`:i.push({t:`ref`,text:t.a.id??`*`,s:{...o,va:`sup`},src:s})}}}target(e){if(!e)return;let t=this.rels.get(e);return t&&!t.external?t.target:void 0}boxBlocks(e){let t=[],n=this.cur;this.boxDepth++;for(let n of e)for(let e of n.c)this.blocks(e,t);return this.boxDepth--,this.cur=n,t}drawing(e,t,n,r){let i=L(e,`inline`)??L(e,`anchor`);if(!i)return;let a=L(i,`extent`),o=Je(V(a?.a.cx,0)),s=Je(V(a?.a.cy,0)),c=L(i,`docPr`),l=z(i,`graphic`,`graphicData`),u=B(l,`txbxContent`);if(u.length){let e=this.boxBlocks(u),t=Ae(l,`spPr`),i=z(t,`solidFill`,`srgbClr`)?.a.val,a=z(t,`ln`,`solidFill`,`srgbClr`)?.a.val;n.push({t:`box`,w:o,h:s,blocks:e,fill:i?`#`+i:void 0,border:a?`1px solid #${a}`:void 0,src:r});return}let d=Ae(l,`blip`),f=this.target(d?.a[`r:embed`]);if(f){let e=this.rels.get(L(c,`hlinkClick`)?.a[`r:id`]??``)?.target;n.push({t:`img`,target:f,w:o,h:s,alt:c?.a.descr||c?.a.title||void 0,href:e??t,src:r,rid:d?.a[`r:embed`]})}else Ae(l,`chart`)?n.push({t:`shape`,w:o,h:s,label:`Chart`,src:r}):Ae(l,`relIds`)?n.push({t:`shape`,w:o,h:s,label:`Diagram`,src:r}):n.push({t:`shape`,w:0,h:0,src:r})}vml(e,t,n,r){let i=Ae(e,`txbxContent`),a=(Ae(e,`shape`)??Ae(e,`rect`))?.a.style,o=St(a,`width`)??0,s=St(a,`height`)??0;if(i){n.push({t:`box`,w:o,h:s,blocks:this.boxBlocks([i]),src:r});return}let c=this.target(Ae(e,`imagedata`)?.a[`r:id`]);c&&o&&s?n.push({t:`img`,target:c,w:o,h:s,href:t,src:r}):n.push({t:`shape`,w:0,h:0,src:r})}table(e){this.tableDepth++;try{let t=this.tableInner(e);return this.tableDepth===1&&this.hooks.item&&(t.item=this.hooks.item()),t}finally{this.tableDepth--}}tableInner(e){let t=L(e,`tblPr`),n=this.styles.table(L(t,`tblStyle`)?.a.val),r=At(L(t,`tblLook`)),i={...n.borders,...ft(L(t,`tblBorders`))},a={top:0,bottom:0,left:5.4,right:5.4,...n.cellMar,...pt(L(t,`tblCellMar`))},o=R(L(e,`tblGrid`),`gridCol`).map(e=>(V(e.a.w)??0)/20),s=L(t,`jc`)?.a.val,c=L(t,`tblInd`),l=kt(e,`tr`),u=[],d=o.length;l.forEach((e,t)=>{let i=L(e,`trPr`),o=L(i,`trHeight`),s={cells:[],src:t};o?.a.val&&(s.h=Number(o.a.val)/20,s.exact=o.a.hRule===`exact`),L(i,`tblHeader`)&&(s.header=!0);let c=V(L(i,`gridBefore`)?.a.val,0),f=[];for(let[i,o]of kt(e,`tc`).entries()){let e=L(o,`tcPr`),s=Math.max(1,V(L(e,`gridSpan`)?.a.val,1)),u=L(e,`vMerge`),p=[];if(r.noVBand||p.push((c-+!!r.firstCol)%2==0?`band1Vert`:`band2Vert`),!r.noHBand){let e=t-+!!r.firstRow;e>=0&&p.push(e%2==0?`band1Horz`:`band2Horz`)}r.firstCol&&c===0&&p.push(`firstCol`),r.lastCol&&d&&c+s>=d&&p.push(`lastCol`),r.firstRow&&t===0&&p.push(`firstRow`),r.lastRow&&t===l.length-1&&p.push(`lastRow`);let m=n.shd,h={};for(let e of p){let t=n.cond[e];t&&(t.shd&&(m=t.shd),h=lt(h,t.rs))}m=nt(L(e,`shd`))??m;let g=this.tableLayer;this.tableLayer={ps:n.ps,rs:lt(n.rs,h)};let _=[];for(let e of o.c)e.n!==`tcPr`&&this.blocks(e,_);this.tableLayer=g;let v=pt(L(e,`tcMar`)),y=L(e,`vAlign`)?.a.val,b=L(e,`tcW`);f.push({blocks:_,src:[t,i],colSpan:s,rowSpan:1,w:b&&(b.a.type??`dxa`)===`dxa`?Number(b.a.w)/20:void 0,shd:m,vAlign:y===`center`?`middle`:y===`bottom`?`bottom`:void 0,borders:{},pad:[v.top??a.top,v.right??a.right,v.bottom??a.bottom,v.left??a.left],gs:c,vm:u?u.a.val===`restart`?`restart`:`continue`:void 0,tcB:ft(L(e,`tcBorders`)),ri:t}),c+=s}d=Math.max(d,c),u.push({row:s,cells:f})});for(let e=0;e<u.length;e++)for(let t of u[e].cells)if(!t.gone&&t.vm)for(let n=e+1;n<u.length;n++){let e=u[n].cells.find(e=>e.gs===t.gs);if(!e||e.vm!==`continue`)break;e.gone=!0,t.rowSpan++}let f=u.length;return{t:`tbl`,cols:o,rows:u.map(({row:e,cells:t})=>{for(let n of t){if(n.gone)continue;let t=n.ri+n.rowSpan-1==f-1,r={t:at(n.tcB.top===void 0?n.ri===0?i.top:i.insideH:n.tcB.top),b:at(n.tcB.bottom===void 0?t?i.bottom:i.insideH:n.tcB.bottom),l:at(n.tcB.left===void 0?n.gs===0?i.left:i.insideV:n.tcB.left),r:at(n.tcB.right===void 0?n.gs+n.colSpan>=d?i.right:i.insideV:n.tcB.right)},{gs:a,vm:o,tcB:s,gone:c,ri:l,...u}=n;e.cells.push({...u,borders:r})}return e}),align:s===`center`?`center`:s===`right`||s===`end`?`right`:void 0,indL:c&&(c.a.type??`dxa`)===`dxa`?Number(c.a.w)/20:void 0}}};function kt(e,t){let n=[];for(let r of e.c)r.n===t?n.push(r):r.n===`sdt`?n.push(...kt(L(r,`sdtContent`)??r,t)):(r.n===`customXml`||r.n===`sdtContent`)&&n.push(...kt(r,t));return n}function At(e){let t={firstRow:!0,lastRow:!1,firstCol:!0,lastCol:!1,noHBand:!1,noVBand:!0};if(!e)return t;let n=e.a.val;if(n&&/^[0-9a-fA-F]+$/.test(n)&&e.a.firstRow===void 0){let e=parseInt(n,16);return{firstRow:!!(e&32),lastRow:!!(e&64),firstCol:!!(e&128),lastCol:!!(e&256),noHBand:!!(e&512),noVBand:!!(e&1024)}}let r=(t,n)=>e.a[t]===void 0?n:e.a[t]===`1`||e.a[t]===`true`;return{firstRow:r(`firstRow`,!0),lastRow:r(`lastRow`,!1),firstCol:r(`firstColumn`,!0),lastCol:r(`lastColumn`,!1),noHBand:r(`noHBand`,!1),noVBand:r(`noVBand`,!0)}}var jt=class{constructor(e,t){A(this,`tb`,void 0),A(this,`onItem`,void 0),A(this,`prefix`,``),A(this,`items`,[]),A(this,`suffix`,``),A(this,`buf`,``),A(this,`tail`,``),A(this,`pending`,``),A(this,`inItem`,!1),A(this,`depth`,0),A(this,`els`,[]),A(this,`raw`,e=>{this.flush(),this.pending=e}),A(this,`element`,e=>{this.els.push(e)}),this.tb=e,this.onItem=t}flush(){this.pending&&(this.inItem?this.buf+=this.pending:this.tail+=this.pending,this.pending=``)}open(e,t){this.depth===2&&(this.items.length?this.items[this.items.length-1]+=this.tail:this.prefix+=this.tail,this.tail=``,this.inItem=!0,this.buf=``,this.els=[]),this.flush();let n=this.tb.open(e,t);return n||this.depth++,n}close(e){this.flush(),this.tb.close(e),this.depth--,this.depth===2&&this.inItem&&(this.inItem=!1,this.items.push(this.buf),this.buf=``,this.onItem(this.items.length-1,this.els),this.els=[])}text(e){this.flush(),this.tb.text(e)}finish(){this.flush(),this.items.length?this.suffix=this.tail:this.prefix+=this.tail,this.tail=``}},Mt=class e{constructor(e,t,n,r,i,a){A(this,`pkg`,void 0),A(this,`mainPath`,void 0),A(this,`rels`,void 0),A(this,`styles`,void 0),A(this,`numbering`,void 0),A(this,`theme`,void 0),A(this,`items`,[]),A(this,`prefix`,``),A(this,`suffix`,``),A(this,`info`,new Map),A(this,`origLoc`,new Map),A(this,`ordPid`,new Map),A(this,`itemParas`,new Map),A(this,`groups`,new Map),A(this,`genXml`,new Map),A(this,`itemXml`,new Map),A(this,`nextPid`,1),A(this,`captured`,!1),A(this,`edited`,!1),this.pkg=e,this.mainPath=t,this.rels=n,this.styles=r,this.numbering=i,this.theme=a}static async open(t,n){let r=await t.rels(n),i=Ve(r,`theme`),a=Ge(i?await t.xml(i.target):void 0),o=Ve(r,`styles`),s=Ve(r,`numbering`),c=new dt(o?await t.xml(o.target):void 0,a),l=new vt(s?await t.xml(s.target):void 0,a);return new e(t,n,r,c,l,a)}get dirty(){return this.edited||this.pkg.dirty}markEdited(){this.edited=!0}async headerFooter(e){let t=e?this.rels.get(e):void 0;if(!t)return;let n=await this.pkg.xml(t.target);if(!n)return;let r=new Ot(this.styles,this.numbering,this.theme,await this.pkg.rels(t.target)),i=[];for(let e of n.c)r.blocks(e,i);return i}async stream(e){let t=0,n=new Map,r=new Ot(this.styles,this.numbering,this.theme,this.rels,{item:()=>t,para:(e,r)=>{let i=n.get(e);if(i===void 0)return;let a=this.nextPid++,o=r;o.item=t,o.ord=i,this.info.set(a,o),this.origLoc.set(a,{item:t,ord:i}),this.ordPid.set(`${t}:${i}`,a);let s=this.itemParas.get(t);return s||this.itemParas.set(t,s=[]),s[i]=a,a}}),i={font:this.styles.docRs.font??`"Times New Roman", serif`,sz:this.styles.docRs.sz??10,styles:this.styles.quickStyles()},a=[],o,s,c=Date.now(),l=e.initialHoldMs??350,u=0,d=!0,f=(e,i)=>{t=e,n=Et(i);for(let e of i){if(e.n===`sectPr`){o=e;continue}let t=a.length;if(r.blocks(e,a),!s)for(let e=t;e<a.length;e++){let t=a[e];t.t===`sect`&&(s=t.page)}}},p;p=new jt(new Oe({emitDepth:2,onElement:e=>p.element(e)}),f);let m=()=>{a.length&&(e.onBlocks(a),a=[],u=Date.now())};await Te(await this.pkg.zip.stream(this.mainPath,e.onProgress),p,{signal:e.signal,raw:p.raw,onChunk:async()=>{let t=Date.now();if(d){if(t-c<l)return;d=!1,e.onMeta({page:s??{...yt},...i}),m()}else(a.length>=400||a.length&&t-u>120)&&(m(),await new Promise(e=>setTimeout(e,0)))}}),p.finish(),this.items=p.items,this.prefix=p.prefix,this.suffix=p.suffix,this.captured=!0;let h=o,g={page:Ct(h),...i,final:!0};if(h){let e=(e,t)=>R(h,e).find(e=>(e.a.type??`default`)===t)?.a[`r:id`];g.header=await this.headerFooter(e(`headerReference`,`default`)),g.footer=await this.headerFooter(e(`footerReference`,`default`)),g.titlePg=!!L(h,`titlePg`)&&L(h,`titlePg`)?.a.val!==`0`,g.titlePg&&(g.firstHeader=await this.headerFooter(e(`headerReference`,`first`)),g.firstFooter=await this.headerFooter(e(`footerReference`,`first`)))}e.onMeta(g),m()}get ready(){return this.captured}reconvert(e,t,n,r,i){let a=ke(t),o={pid:e,root:a,map:n,layer:r,marker:i},s=new Ot(this.styles,this.numbering,this.theme,this.rels,{forced:o}),c=[];return s.paragraph(a,c),{blocks:c,rec:o.rec}}recomputeMarkers(){let e=new Map;this.numbering.reset();let t=[...this.itemParas.keys()].sort((e,t)=>e-t);for(let n of t){let t=this.itemParas.get(n);for(let r=0;r<t.length;r++){let i=t[r];if(i===void 0)continue;let a=this.groups.get(`${n}:${r}`)??[i];for(let t of a){let n=this.info.get(t);if(!n)continue;let r,i;if(n.num){let e=n.marker?.s??{},t=Dt(this.numbering,n.num,e);t&&(r={...t.marker,s:n.marker?.s??t.marker.s},i=t.lst)}((r?.text??null)!==(n.marker?.text??null)||i!==n.lst)&&(n.marker=r,n.lst=i,e.set(t,n))}}}return e}},Nt=`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,Pt=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering`,Ft=`application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml`,It=`pStyle.keepNext.keepLines.pageBreakBefore.framePr.widowControl.numPr.suppressLineNumbers.pBdr.shd.tabs.suppressAutoHyphens.kinsoku.wordWrap.overflowPunct.topLinePunct.autoSpaceDE.autoSpaceDN.bidi.adjustRightInd.snapToGrid.spacing.ind.contextualSpacing.mirrorIndents.suppressOverlap.jc.textDirection.textAlignment.textboxTightWrap.outlineLvl.divId.cnfStyle.rPr.sectPr.pPrChange`.split(`.`),Lt=`rStyle.rFonts.b.bCs.i.iCs.caps.smallCaps.strike.dstrike.outline.shadow.emboss.imprint.noProof.snapToGrid.vanish.webHidden.color.spacing.w.kern.position.sz.szCs.highlight.u.effect.bdr.shd.fitText.vertAlign.rtl.cs.em.lang.eastAsianLayout.specVanish.oMath`.split(`.`),Rt=new Set([`bookmarkStart`,`commentRangeStart`,`permStart`,`moveFromRangeStart`,`moveToRangeStart`]),zt=new Set([`bookmarkEnd`,`commentRangeEnd`,`permEnd`,`moveFromRangeEnd`,`moveToRangeEnd`]),Bt=new Set([`p`,`del`,`moveFrom`,`oMath`,`oMathPara`,`pPr`,`rPr`,`r`]),Vt=Object.fromEntries(Object.entries(et).map(([e,t])=>[t,e]));function Ht(e){let t=[];return e.forEach((n,r)=>{h(n)&&(v(n.q)===`p`&&t.push({node:n,list:e,index:r}),ie(n,(e,n,r)=>{v(e.q)===`p`&&t.push({node:e,list:n.c,index:r})}))}),t}function Ut(e){let t=[];return ie(e,e=>{let n=v(e.q);return n===`r`&&t.push(e),Bt.has(n)}),t}var Wt=new WeakMap;function Gt(e,t){let n=Wt.get(e);n||Wt.set(e,n=new Map);let r=n.get(t);return r||(r=Ht(g(e.items[t]??``)),n.size>64&&n.delete(n.keys().next().value),n.set(t,r)),r}function Kt(e,t){let n=e.origLoc.get(t);if(n)return Gt(e,n.item)[n.ord]?.node}var qt=new WeakMap;function Jt(e,t){if(!t)return;let n=Kt(e,t[0]);if(!n)return;let r=qt.get(n);return r||qt.set(n,r=Ut(n)),r[t[1]]}function Yt(e,t,n){let r=n+`val`,i=(t,n)=>O(e,n,t,Lt),a=(e,t)=>i(e,t?E(n+e):E(n+e,{[r]:`0`}));if(t.b!==void 0&&(a(`b`,t.b),a(`bCs`,t.b)),t.i!==void 0&&(a(`i`,t.i),a(`iCs`,t.i)),t.strike!==void 0&&(a(`strike`,t.strike),t.strike&&i(`dstrike`,void 0)),t.u!==void 0&&i(`u`,E(n+`u`,{[r]:t.u&&t.u!==`none`?t.u:`none`})),`color`in t&&i(`color`,t.color?E(n+`color`,{[r]:t.color.replace(`#`,``).toUpperCase()}):void 0),t.sz!==void 0){let e=String(Math.round(t.sz*2));i(`sz`,E(n+`sz`,{[r]:e})),i(`szCs`,E(n+`szCs`,{[r]:e}))}if(t.font!==void 0){let e=t.font;i(`rFonts`,E(n+`rFonts`,{[n+`ascii`]:e,[n+`hAnsi`]:e,[n+`eastAsia`]:e,[n+`cs`]:e}))}if(`hl`in t){let e=t.hl?Vt[t.hl.toLowerCase()]:void 0;t.hl?e?i(`highlight`,E(n+`highlight`,{[r]:e})):i(`shd`,E(n+`shd`,{[r]:`clear`,[n+`color`]:`auto`,[n+`fill`]:t.hl.replace(`#`,``).toUpperCase()})):(i(`highlight`,void 0),i(`shd`,void 0))}`va`in t&&i(`vertAlign`,t.va?E(n+`vertAlign`,{[r]:t.va===`sup`?`superscript`:`subscript`}):void 0)}function Xt(e,t){let n=``;for(let r of e.split(/(\t|\n)/))r&&(n+=r===` `?`<${t}tab/>`:r===`
|
|
@@ -15,39 +15,39 @@ Error generating stack: `+e.message+`
|
|
|
15
15
|
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:styles>`),o=b(a),s=y(o.q),c=en(t,s),l=c.id;for(let t=2;e.styles.has(l);t++)l=c.id+t;let u=e.styles.defaultPara,d=u?`<${s}basedOn ${s}val="${u}"/><${s}next ${s}val="${u}"/>`:``,f=`<${s}style ${s}type="paragraph" ${s}styleId="${l}"><${s}name ${s}val="${c.name}"/>${d}<${s}uiPriority ${s}val="9"/><${s}qFormat/><${s}pPr>${c.ppr}</${s}pPr><${s}rPr>${c.rpr}</${s}rPr></${s}style>`;o.c.push(g(f)[0]),o.self=!1,e.pkg.setPart(i,_(a)),r||(await e.pkg.addRel(e.mainPath,Qt,i),await e.pkg.setContentType(i,$t),e.rels=await e.pkg.rels(e.mainPath));let p=ke(s?f.replace(`<${s}style `,`<${s}style xmlns:${s.slice(0,-1)}="http://schemas.openxmlformats.org/wordprocessingml/2006/main" `):f);return p&&e.styles.add(p),e.markEdited(),{id:l,styles:e.styles.quickStyles()}}async function nn(e,t){let n=e.numbering.findList(t);if(n)return n;let r=Ve(e.rels,`numbering`),i=r?.target??`word/numbering.xml`,a=g(e.pkg.has(i)?await e.pkg.text(i):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
16
16
|
<w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:numbering>`),o=b(a),s=y(o.q),{abstract:c,num:l}=e.numbering.ids(),u=g(Zt(s,c,t))[0],d=g(`<${s}num ${s}numId="${l}"><${s}abstractNumId ${s}val="${c}"/></${s}num>`)[0],f=(e,t)=>{let n=-1;return o.c.forEach((r,i)=>{h(r)&&v(r.q)===e&&(t||n<0)&&(n=i)}),n},p=f(`abstractNum`,!0),m=f(`num`,!1);o.c.splice(p>=0?p+1:m>=0?m:o.c.length,0,u);let x=f(`num`,!0),S=f(`numIdMacAtCleanup`,!1);o.c.splice(x>=0?x+1:S>=0?S:o.c.length,0,d),o.self=!1;let C=_(a);return e.pkg.setPart(i,C),r||(await e.pkg.addRel(e.mainPath,Pt,i),await e.pkg.setContentType(i,Ft),e.rels=await e.pkg.rels(e.mainPath)),e.numbering=new vt(ke(C),e.theme),String(l)}async function rn(e,t,n,r){let i=r+`val`,a=(e,n)=>O(t,n,e,It);if(n.style!==void 0&&a(`pStyle`,n.style&&n.style!==e.styles.defaultPara?E(r+`pStyle`,{[i]:n.style}):void 0),n.align&&a(`jc`,E(r+`jc`,{[i]:n.align===`justify`?`both`:n.align})),n.line!==void 0||n.before!==void 0||n.after!==void 0){let e=D(S(t,`spacing`)??E(r+`spacing`));n.before!==void 0&&(T(e,r+`before`,String(Math.round(n.before*20))),T(e,r+`beforeAutospacing`,void 0)),n.after!==void 0&&(T(e,r+`after`,String(Math.round(n.after*20))),T(e,r+`afterAutospacing`,void 0)),n.line!==void 0&&(T(e,r+`line`,String(Math.round(n.line*240))),T(e,r+`lineRule`,`auto`)),a(`spacing`,e)}if(n.pageBreak!==void 0&&a(`pageBreakBefore`,n.pageBreak?E(r+`pageBreakBefore`):void 0),n.indL!==void 0){let e=D(S(t,`ind`)??E(r+`ind`));T(e,r+`start`,void 0),T(e,r+`left`,String(Math.max(0,Math.round(n.indL*20)))),a(`ind`,e)}let o=e.styles.para(on(t)).numPr,s=(e,t)=>E(r+`numPr`,{},[E(r+`ilvl`,{[i]:String(t)}),E(r+`numId`,{[i]:e})]);if(n.list===`none`)a(`numPr`,o?s(`0`,0):void 0);else if(n.list)a(`numPr`,s(await nn(e,n.list),n.ilvl??0));else if(n.ilvl!==void 0){let e=S(t,`numPr`),r=(e&&an(S(e,`numId`),i))??o?.numId;r&&r!==`0`&&a(`numPr`,s(r,n.ilvl))}}function an(e,t){if(e)return RegExp(`(?:^|\\s)${t.replace(`:`,`\\:`)}="([^"]*)"`).exec(e.a)?.[1]}function on(e){let t=S(e,`pStyle`);return t?/="([^"]*)"/.exec(t.a)?.[1]:void 0}async function sn(e,t){let n=Kt(e,t.from),r=n?.q??`w:p`,i=y(r)||`w:`,a=D(S(n,`pPr`)??E(i+`pPr`));t.pd&&await rn(e,a,t.pd,i),(t.keepSect??t.pid===t.from)||ee(a,`sectPr`);let o=S(a,`rPr`),s=[],c=``,l,u=()=>{l!==void 0&&(c+=`</${i}hyperlink>`),l=void 0},d=(e,t)=>`<${i}r>${e&&e.c.length?_(e):``}${t}</${i}r>`,f=t=>{let n=S(Jt(e,t),`rPr`)??o;if(!n)return;let r=D(n);return r.q=i+`rPr`,ee(r,e=>e===`rPrChange`||e===`ins`||e===`del`||e===`moveFrom`||e===`moveTo`),r};t.parts.forEach((t,n)=>{n>0&&(u(),c+=`<${i}r><${i}br ${i}type="page"/></${i}r>`,s.push({}));for(let n of t){if(`obj`in n){if(u(),n.obj===`field`){let e=f(void 0);n.set&&Yt(e??(e=E(i+`rPr`)),n.set,i),c+=`<${i}fldSimple ${i}instr=" ${n.kind} ">${d(e,`<${i}t>1</${i}t>`)}</${i}fldSimple>`,s.push({d:n.set})}else if(n.obj===`image`)c+=fn(i,n.rid,n.w,n.h,n.name,n.alt),s.push({});else{let t=Jt(e,n.src);if(t){if(n.size||n.alt!==void 0||n.rid){let e=D(t),r=n.size&&String(Math.round(n.size[0]*12700)),i=n.size&&String(Math.round(n.size[1]*12700));ie(e,e=>{let t=v(e.q);if(r&&i&&(t===`extent`||t===`ext`&&/\scx=/.test(e.a))&&(T(e,`cx`,r),T(e,`cy`,i)),n.alt!==void 0&&(t===`docPr`||t===`cNvPr`&&/\sid=/.test(e.a))&&T(e,`descr`,n.alt||void 0),n.rid&&t===`blip`){let t=/([\w.-]+):embed="/.exec(e.a);T(e,t?`${t[1]}:embed`:`r:embed`,n.rid)}}),c+=_(e)}else c+=_(t);s.push({src:n.src})}}continue}if(n.lk!==l&&(u(),n.lk)){let e=n.lk.startsWith(`r:`)?`r:id="${n.lk.slice(2)}"`:`${i}anchor="${te(n.lk.slice(2))}"`;c+=`<${i}hyperlink ${e}>`,l=n.lk}let t=f(n.src);n.set&&Object.keys(n.set).length&&Yt(t??(t=E(i+`rPr`)),n.set,i),n.text&&(c+=d(t,Xt(n.text,i)),s.push({src:n.src,d:n.set}))}}),u();let p=``,m=``,h=t.orig??(t.pid===t.from?[t.from]:[]);for(let t of h){let n=Kt(e,t);if(n){for(let e of x(n)){let t=v(e.q);Rt.has(t)?p+=_(e):zt.has(t)&&(m+=_(e))}for(let e of Ut(n))S(e,`commentReference`)&&(m+=_(e),s.push({}))}}let g=n?.a??``;t.pid!==t.from&&(g=g.replace(/\s+w14:(paraId|textId)="[^"]*"/g,``));let b=a.c.length?_(a):``;return{xml:`<${r}${g}>${b}${p}${c}${m}</${r}>`,map:s}}function cn(e,t){let n=e.groups.get(t);if(!n){let r=e.ordPid.get(t);n=r===void 0?[]:[r],e.groups.set(t,n)}return n}function ln(e,t){let n=e.info.get(t);if(!n)return;let r=cn(e,`${n.item}:${n.ord}`),i=r.indexOf(t);i>=0&&r.splice(i,1)}async function un(e,t){if(!e.ready)throw Error(`Document is still loading`);let n=e.info.get(t.anchor);if(!n)throw Error(`Unknown paragraph ${t.anchor}`);e.markEdited();let r=[t.anchor,...t.list.map(e=>e.pid),...t.remove??[]],i=t.list.some(e=>e.pd)||r.some(t=>e.info.get(t)?.num),a=n.item,o=n.ord,s=t.list.map(e=>e.pid);for(let n of[...s,...t.remove??[]])n!==t.anchor&&ln(e,n);let c=cn(e,`${a}:${o}`),l=c.indexOf(t.anchor);if(l<0)throw Error(`Paragraph ${t.anchor} is not in the document`);c.splice(l,1,...s);for(let n of[t.anchor,...t.remove??[]])s.includes(n)||e.genXml.delete(n);let u={};for(let r of t.list){let i=e.info.get(r.from)??n,s=e.info.get(r.pid),c,l,d=r.pristine&&r.pid===r.from?Kt(e,r.pid):void 0;d?(c=_(d),l=Ut(d).map((e,t)=>({src:[r.pid,t]}))):{xml:c,map:l}=await sn(e,r),e.genXml.set(r.pid,c);let{blocks:f,rec:p}=e.reconvert(r.pid,c,l,i.layer,s?.marker);e.info.set(r.pid,{...p,item:a,ord:o,marker:s?.marker,lst:s?.lst}),t.want&&(u[r.pid]=f)}let d=i||t.list.some(t=>e.info.get(t.pid)?.num)?e.recomputeMarkers():new Map,f={};for(let[e,t]of d)f[e]=t.marker?{...t.marker,lst:t.lst}:null;for(let[t,n]of Object.entries(u)){let r=e.info.get(Number(t));n.filter(e=>e.t===`p`).forEach((e,t)=>{delete e.marker,delete e.lst,t===0&&r?.marker&&(e.marker=r.marker,e.lst=r.lst)})}return{blocks:u,markers:f}}var dn=7e3;function fn(e,t,n,r,i=`Picture`,a){let o=Math.round(n*12700),s=Math.round(r*12700),c=++dn,l=`http://schemas.openxmlformats.org/drawingml/2006/main`,u=`http://schemas.openxmlformats.org/drawingml/2006/picture`,d=te(i),f=a?` descr="${te(a).replace(/"/g,`"`)}"`:``;return`<${e}r><${e}drawing><wp:inline xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${o}" cy="${s}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:docPr id="${c}" name="${d} ${c}"${f}/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="${l}" noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic xmlns:a="${l}"><a:graphicData uri="${u}"><pic:pic xmlns:pic="${u}"><pic:nvPicPr><pic:cNvPr id="${c}" name="${d}"${f}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${t}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${o}" cy="${s}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></${e}drawing></${e}r>`}var pn=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,mn=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,hn={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`};async function gn(e,t,n){if(n=n.toLowerCase().replace(`jpeg`,`jpg`),!hn[n])throw Error(`Unsupported image type .${n}`);let r=e.pkg.freeName(`word/media`,`image`,n);e.pkg.setPart(r,t),await e.pkg.ensureDefaultType(n,hn[n]);let i=await e.pkg.addRel(e.mainPath,pn,r);return e.rels=await e.pkg.rels(e.mainPath),e.markEdited(),{rid:i,path:r}}async function _n(e,t){let n=await e.pkg.addRel(e.mainPath,mn,t,!0);return e.rels=await e.pkg.rels(e.mainPath),`r:`+n}var vn=[`cnfStyle`,`tcW`,`gridSpan`,`hMerge`,`vMerge`,`tcBorders`,`shd`,`noWrap`,`tcMar`,`textDirection`,`tcFitText`,`vAlign`,`hideMark`];function yn(e){let t=[],n=e=>{for(let r of x(e)){let e=v(r.q);e===`tr`?t.push(r):(e===`sdt`||e===`sdtContent`||e===`customXml`)&&n(r)}};return n(e),t}function bn(e){let t=[],n=e=>{for(let r of x(e)){let e=v(r.q);e===`tc`?t.push(r):(e===`sdt`||e===`sdtContent`||e===`customXml`)&&n(r)}};return n(e),t}async function xn(e,t){let n;if(t.item!==void 0){let r=b(g(e.items[t.item]??``));r&&(v(r.q)===`tbl`?n=r:ie(r,e=>(!n&&v(e.q)===`tbl`&&(n=e),!!n)))}let r=n&&y(n.q)||`w:`,i=r+`val`,a=n?yn(n):[],o=n?S(n,`tblPr`):void 0;if(!o){let t=e.styles.has(`TableGrid`)?`<${r}tblStyle ${i}="TableGrid"/>`:``;o=g(`<${r}tblPr>${t}<${r}tblW ${r}w="0" ${r}type="auto"/>${t?``:`<${r}tblBorders>${[`top`,`left`,`bottom`,`right`,`insideH`,`insideV`].map(e=>`<${r}${e} ${i}="single" ${r}sz="4" ${r}space="0" ${r}color="auto"/>`).join(``)}</${r}tblBorders>`}<${r}tblLook ${i}="04A0" ${r}firstRow="1" ${r}lastRow="0" ${r}firstColumn="1" ${r}lastColumn="0" ${r}noHBand="0" ${r}noVBand="1"/></${r}tblPr>`)[0]}let s=`<${r}tblGrid>${t.cols.map(e=>`<${r}gridCol ${r}w="${Math.round(e*20)}"/>`).join(``)}</${r}tblGrid>`,c=a.length?S(bn(a[0])[0],`tcPr`):void 0,l=t.cols.length,u=[],d=`<${r}tbl${n?.a??``}>${_(o)}${s}`,f=(e,n,o,s,l)=>{let u=D((e?S(bn(a[e[0]]??{c:[]})[e[1]],`tcPr`):void 0)??c??E(r+`tcPr`));u.q=r+`tcPr`,ee(u,e=>e===`gridSpan`||e===`vMerge`||e===`hMerge`);let d=t.cols.slice(n,n+o).reduce((e,t)=>e+t,0);return O(u,E(r+`tcW`,{[r+`w`]:String(Math.round(d*20)),[r+`type`]:`dxa`}),`tcW`,vn),o>1&&O(u,E(r+`gridSpan`,{[i]:String(o)}),`gridSpan`,vn),s&&O(u,E(r+`vMerge`,s===`restart`?{[i]:`restart`}:{}),`vMerge`,vn),l!==void 0&&O(u,l?E(r+`shd`,{[i]:`clear`,[r+`color`]:`auto`,[r+`fill`]:l.replace(`#`,``).toUpperCase()}):void 0,`shd`,vn),_(u)};for(let n of t.rows){let t=n.src===void 0?void 0:a[n.src],i=S(t,`trPr`);d+=`<${r}tr${t?.a??``}>${i?_(i):``}`;let o=0,s=0,c=n.cells;for(;o<l&&(s<c.length||u[o]);){let t=u[o];if(t&&t.left>0){d+=`<${r}tc>${t.tcPr,``}${f(void 0,o,t.span,`continue`)}<${r}p/></${r}tc>`,t.left--,t.left||(u[o]=void 0),o+=t.span;continue}let n=c[s++];if(!n)break;let i=Math.max(1,Math.min(n.colSpan,l-o)),a=``;for(let t of n.paras){let n=t.pristine&&t.pid===t.from?Kt(e,t.pid):void 0;a+=n?_(n):(await sn(e,t)).xml}d+=`<${r}tc>${f(n.src,o,i,n.rowSpan>1?`restart`:void 0,n.shd)}${a||`<${r}p/>`}</${r}tc>`,n.rowSpan>1&&(u[o]={left:n.rowSpan-1,span:i}),o+=i}d+=`</${r}tr>`}return d+`</${r}tbl>`}async function Sn(e,t){if(!e.ready)throw Error(`Document is still loading`);e.markEdited();let n=t.spec?await xn(e,t.spec):``;if(t.item!==void 0){e.itemXml.set(t.item,n);return}let r;for(let[n,i]of e.groups)i.includes(t.tid)&&(r=n);if(!t.spec)r&&e.groups.get(r).splice(e.groups.get(r).indexOf(t.tid),1),e.genXml.delete(t.tid);else{if(!r){let n=t.anchor===void 0?void 0:e.info.get(t.anchor);if(!n||t.anchor===void 0)throw Error(`Table anchor paragraph not found`);let r=cn(e,`${n.item}:${n.ord}`);r.splice(r.indexOf(t.anchor)+1,0,t.tid)}e.genXml.set(t.tid,n)}}async function Cn(e){if(!e.ready)throw Error(`Document is still loading`);if(e.groups.size||e.itemXml.size){let t=new Set;for(let n of e.groups.keys())t.add(Number(n.split(`:`)[0]));let n=[e.prefix];for(let r=0;r<e.items.length;r++){let i=e.itemXml.get(r);if(i!==void 0){n.push(i+(/\s*$/.exec(e.items[r])?.[0]??``));continue}if(!t.has(r)){n.push(e.items[r]);continue}let a=g(e.items[r]),o=Ht(a);for(let t=0;t<o.length;t++){let n=e.groups.get(`${r}:${t}`);if(!n)continue;let i=o[t];i.list[i.index]=n.map(t=>e.genXml.get(t)??(Kt(e,t)?_(Kt(e,t)):``)).join(``)}n.push(_(a))}n.push(e.suffix),e.pkg.setPart(e.mainPath,n.join(``))}return e.pkg.save(Nt)}function wn(e){let t=e.replace(`#`,``),n=t.length===8?t.slice(2):t.padStart(6,`0`).slice(0,6);return[parseInt(n.slice(0,2),16)||0,parseInt(n.slice(2,4),16)||0,parseInt(n.slice(4,6),16)||0]}function Tn([e,t,n]){let r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`);return`#`+r(e)+r(t)+r(n)}function En([e,t,n]){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2;if(r===i)return[0,0,a];let o=r-i,s=a>.5?o/(2-r-i):o/(r+i),c=0;return c=r===e?(t-n)/o+(t<n?6:0):r===t?(n-e)/o+2:(e-t)/o+4,[c/6,s,a]}function Dn([e,t,n]){if(t===0)return[n*255,n*255,n*255];let r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,a=e=>(e<0&&(e+=1),e>1&&--e,e<1/6?i+(r-i)*6*e:e<1/2?r:e<2/3?i+(r-i)*(2/3-e)*6:i);return[a(e+1/3)*255,a(e)*255,a(e-1/3)*255]}var On=e=>Math.max(0,Math.min(1,e));function kn(e,t){if(!t)return e;let n=En(wn(e));return n[2]=t<0?n[2]*(1+t):n[2]*(1-t)+t,Tn(Dn(n))}var An={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,ltGray:`#d3d3d3`,dkGray:`#a9a9a9`,orange:`#ffa500`,purple:`#800080`,navy:`#000080`,maroon:`#800000`,olive:`#808000`,teal:`#008080`,silver:`#c0c0c0`,lime:`#00ff00`,pink:`#ffc0cb`,brown:`#a52a2a`,gold:`#ffd700`},jn={bg1:`lt1`,tx1:`dk1`,bg2:`lt2`,tx2:`dk2`},Mn=new Set([`srgbClr`,`schemeClr`,`sysClr`,`prstClr`,`scrgbClr`,`hslClr`]);function Nn(e,t){let n;switch(e.n){case`srgbClr`:n=`#`+(e.a.val??`000000`).toLowerCase();break;case`sysClr`:n=`#`+(e.a.lastClr??(e.a.val===`window`?`ffffff`:`000000`));break;case`prstClr`:n=An[e.a.val]??`#000000`;break;case`scrgbClr`:n=Tn([(V(e.a.r)??0)/1e5*255,(V(e.a.g)??0)/1e5*255,(V(e.a.b)??0)/1e5*255]);break;case`hslClr`:n=Tn(Dn([(V(e.a.hue)??0)/216e5,(V(e.a.sat)??0)/1e5,(V(e.a.lum)??0)/1e5]));break;case`schemeClr`:{let r=e.a.val;if(r===`phClr`)n=t.phClr;else{let e=t.clrMap?.[r]??jn[r]??r;n=t.theme?.colors[e]??t.theme?.colors[r]}break}}if(n)return Pn(n,e)}function Pn(e,t){if(!t.c.length)return e;let n=wn(e),r=1;for(let e of t.c){let t=(V(e.a.val)??0)/1e5;switch(e.n){case`alpha`:r=t;break;case`lumMod`:{let e=En(n);e[2]=On(e[2]*t),n=Dn(e);break}case`lumOff`:{let e=En(n);e[2]=On(e[2]+t),n=Dn(e);break}case`satMod`:{let e=En(n);e[1]=On(e[1]*t),n=Dn(e);break}case`tint`:n=n.map(e=>e+(255-e)*(1-t));break;case`shade`:n=n.map(e=>e*t);break;case`inv`:n=n.map(e=>255-e);break;case`gray`:{let e=n[0]*.3+n[1]*.59+n[2]*.11;n=[e,e,e];break}}}let i=Tn(n);if(r>=1)return i;let[a,o,s]=wn(i);return`rgba(${a},${o},${s},${+r.toFixed(3)})`}function Fn(e,t){if(e){for(let n of e.c)if(Mn.has(n.n))return Nn(n,t)}}var In=`000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 800000 008000 000080 808000 800080 008080 C0C0C0 808080 9999FF 993366 FFFFCC CCFFFF 660066 FF8080 0066CC CCCCFF 000080 FF00FF FFFF00 00FFFF 800080 800000 008080 0000FF 00CCFF CCFFFF CCFFCC FFFF99 99CCFF FF99CC CC99FF FFCC99 3366FF 33CCCC 99CC00 FFCC00 FF9900 FF6600 666699 969696 003366 339966 003300 333300 993300 993366 333399 333333`.split(` `).map(e=>`#`+e),Ln=[`lt1`,`dk1`,`lt2`,`dk2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`];function Rn(e,t,n=In){if(!e||e.a.auto===`1`||e.a.auto===`true`)return;let r;if(e.a.rgb){let t=e.a.rgb;r=`#`+(t.length===8?t.slice(2):t)}else if(e.a.theme!==void 0)r=t?.colors[Ln[Number(e.a.theme)]??``]??void 0;else if(e.a.indexed!==void 0){let t=Number(e.a.indexed);if(t===64||t===65)return;r=n[t]}if(!r)return;let i=V(e.a.tint)??0;return i?kn(r,i):r.toLowerCase()}function zn(e){let t=R(L(L(e,`colors`),`indexedColors`),`rgbColor`);return t.length?t.map(e=>`#`+(e.a.rgb??`FF000000`).slice(-6)):In}var Bn=`application/vnd.openxmlformats-officedocument.presentationml.presentation`,Vn=[`ln`,`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`,`effectLst`,`effectDag`,`highlight`,`uLnTx`,`uLn`,`uFillTx`,`uFill`,`latin`,`ea`,`cs`,`sym`,`hlinkClick`,`hlinkMouseOver`,`rtl`,`extLst`],Hn=new Set([`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`]),Un={left:`l`,center:`ctr`,right:`r`,justify:`just`};function Wn(e,t){let n;for(let r of e)h(r)&&ie(r,e=>{if(n)return!0;if(v(e.q)!==`sp`)return;let r=w(S(S(e,`nvSpPr`),`cNvPr`)??e,`id`);return r!==void 0&&Number(r)===t&&(n=e),!0});return n}function Gn(e,t,n){t.sz!==void 0&&T(e,`sz`,String(Math.round(t.sz*100))),t.b!==void 0&&T(e,`b`,t.b?`1`:`0`),t.i!==void 0&&T(e,`i`,t.i?`1`:`0`),t.u!==void 0&&T(e,`u`,t.u?`sng`:`none`),t.strike!==void 0&&T(e,`strike`,t.strike?`sngStrike`:`noStrike`),`color`in t&&(ee(e,e=>Hn.has(e)),t.color&&O(e,E(n+`solidFill`,{},[E(n+`srgbClr`,{val:t.color.replace(`#`,``).toUpperCase()})]),`solidFill`,Vn)),t.font&&O(e,E(n+`latin`,{typeface:t.font}),`latin`,Vn),`hl`in t&&O(e,t.hl?E(n+`highlight`,{},[E(n+`srgbClr`,{val:t.hl.replace(`#`,``).toUpperCase()})]):void 0,`highlight`,Vn),`baseline`in t&&T(e,`baseline`,t.baseline?String(Math.round(t.baseline*1e3)):void 0)}var Kn=[`lnSpc`,`spcBef`,`spcAft`,`buClrTx`,`buClr`,`buSzTx`,`buSzPct`,`buSzPts`,`buFontTx`,`buFont`,`buNone`,`buAutoNum`,`buChar`,`buBlip`,`tabLst`,`defRPr`,`extLst`],qn=new Set([`buNone`,`buAutoNum`,`buChar`,`buBlip`]);function Jn(e,t,n){if(t.algn&&T(e,`algn`,Un[t.algn]),t.lvl!==void 0&&String(t.lvl)!==(w(e,`lvl`)??`0`)&&(T(e,`lvl`,t.lvl?String(t.lvl):void 0),T(e,`marL`,void 0),T(e,`indent`,void 0)),t.bullet){if(ee(e,e=>qn.has(e)),t.bullet===`none`)O(e,E(n+`buNone`),`buNone`,Kn),w(e,`indent`)?.startsWith(`-`)&&T(e,`indent`,`0`);else{let r=t.bullet===`bullet`?E(n+`buChar`,{char:`•`}):E(n+`buAutoNum`,{type:`arabicPeriod`});if(t.bullet===`bullet`&&O(e,E(n+`buFont`,{typeface:`Arial`}),`buFont`,Kn),O(e,r,t.bullet===`bullet`?`buChar`:`buAutoNum`,Kn),!w(e,`marL`)){let t=Number(w(e,`lvl`)??0);T(e,`marL`,String(342900+t*457200)),T(e,`indent`,`-342900`)}}}t.lnPct&&O(e,E(n+`lnSpc`,{},[E(n+`spcPct`,{val:String(Math.round(t.lnPct*1e5))})]),`lnSpc`,Kn),e.self=e.c.length===0}var Yn={l:`left`,ctr:`center`,r:`right`,just:`justify`,dist:`justify`,thaiDist:`justify`,justLow:`justify`},Xn={dash:`4 3`,sysDash:`3 1`,dot:`1 1`,sysDot:`1 1`,lgDash:`8 3`,dashDot:`4 3 1 3`,lgDashDot:`8 3 1 3`,lgDashDotDot:`8 3 1 3 1 3`,sysDashDot:`3 1 1 1`,sysDashDotDot:`3 1 1 1 1 1`};function Zn(e){let t=e.c[0];return t?L(t,`nvPr`):void 0}function Qn(e){let t=L(Zn(e),`ph`);if(t)return{type:t.a.type??`body`,idx:t.a.idx}}var $n=e=>e===`ctrTitle`?`title`:e===`subTitle`||e===`obj`?`body`:e;function er(e){let t=new Map,n=new Map,r=e=>{for(let i of e?.c??[]){i.n===`grpSp`&&r(i);let e=Qn(i);e&&(e.idx!==void 0&&!t.has(e.idx)&&t.set(e.idx,i),n.has(e.type)||n.set(e.type,i))}};return r(e),{byIdx:t,byType:n}}function tr(e){let t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],n=``;for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}function nr(e,t){let n=e=>String.fromCharCode(97+(e-1)%26).repeat(Math.floor((e-1)/26)+1),r=String(t);return e.startsWith(`alphaLc`)?r=n(t):e.startsWith(`alphaUc`)?r=n(t).toUpperCase():e.startsWith(`romanLc`)?r=tr(t):e.startsWith(`romanUc`)&&(r=tr(t).toUpperCase()),e.endsWith(`ParenBoth`)?`(${r})`:e.endsWith(`ParenR`)?`${r})`:e.endsWith(`Period`)?`${r}.`:e.endsWith(`Minus`)?`- ${r} -`:r}var rr=class e{constructor(e,t,n,r){A(this,`pkg`,void 0),A(this,`mainPath`,void 0),A(this,`defaultTextStyle`,void 0),A(this,`masters`,new Map),A(this,`layouts`,new Map),A(this,`tableStyles`,void 0),A(this,`meta`,void 0),A(this,`genMaps`,new Map),A(this,`touched`,!1),A(this,`undoStack`,[]),A(this,`redoStack`,[]),A(this,`originals`,new Map),A(this,`lateShapes`,new Map),this.pkg=e,this.mainPath=t,this.defaultTextStyle=n,this.meta=r}static async open(t,n){let r=await t.xml(n);if(!r)throw Error(`Missing presentation part`);let i=await t.rels(n),a=L(r,`sldSz`),o=[];for(let e of R(L(r,`sldIdLst`),`sldId`)){let n=i.get(e.a[`r:id`]);n&&t.has(n.target)&&o.push({index:o.length,path:n.target,hidden:!1})}let s={w:H(V(a?.a.cx,9144e3)),h:H(V(a?.a.cy,6858e3)),count:o.length,slides:o};return new e(t,n,L(r,`defaultTextStyle`),s)}async part(e){let t=await this.pkg.xml(e,!1);if(!t)throw Error(`Missing part ${e}`);let n=z(t,`cSld`,`spTree`);return{path:e,root:t,rels:await this.pkg.rels(e),spTree:n,...er(n)}}master(e){let t=this.masters.get(e);return t||(t=(async()=>{let t=await this.part(e),n=Ve(t.rels,`theme`),r=Ge(n?await this.pkg.xml(n.target):void 0),i={...L(t.root,`clrMap`)?.a??{}},a=L(t.root,`txStyles`);return{...t,theme:r,clrMap:i,title:L(a,`titleStyle`),body:L(a,`bodyStyle`),other:L(a,`otherStyle`)}})(),this.masters.set(e,t)),t}layout(e){let t=this.layouts.get(e);return t||(t=(async()=>{let t=await this.part(e),n=Ve(t.rels,`slideMaster`);if(!n)throw Error(`Layout ${e} has no master`);let r=await this.master(n.target);return{...t,master:r,clrMap:ir(t.root,r.clrMap)}})(),this.layouts.set(e,t)),t}getTableStyles(){return this.tableStyles||(this.tableStyles=(async()=>{let e=new Map,t=Ve(await this.pkg.rels(this.mainPath),`tableStyles`),n=t?await this.pkg.xml(t.target):void 0;for(let t of R(n,`tblStyle`))e.set(t.a.styleId,t);return e})()),this.tableStyles}async slide(e){let t=this.meta.slides[e];if(!t)throw Error(`No slide #${e}`);let n=await this.part(t.path),r=Ve(n.rels,`slideLayout`),i=r?await this.layout(r.target):void 0,a=i?.master,o=a?.theme??Ge(void 0),s=ir(n.root,i?.clrMap??a?.clrMap??{}),c=new sr(this,n,i,a,o,s,e,await this.getTableStyles()),l=[],u=n.root.a.showMasterSp!==`0`;return a&&u&&i?.root.a.showMasterSp!==`0`&&c.walk(a,a.spTree,ar,l,!0),i&&u&&c.walk(i,i.spTree,ar,l,!0),c.walk(n,n.spTree,ar,l,!1),{index:e,w:this.meta.w,h:this.meta.h,bg:c.background(),els:l,hidden:n.root.a.show===`0`}}get defaults(){return this.defaultTextStyle}async keepOriginal(e){this.originals.has(e)||this.originals.set(e,await this.pkg.text(e))}genMap(e,t){return this.genMaps.get(`${e}#${t}`)}get dirty(){return this.genMaps.size>0||this.touched}async setText(e,t,n){let r=this.meta.slides[e];if(!r)throw Error(`No slide #${e}`);let i=r.path;await this.keepOriginal(i);let a=g(await this.pkg.text(i)),o=Wn(a,t),s=`${i}#${t}`;o&&!this.lateShapes.has(s)&&!Wn(g(this.originals.get(i)),t)&&this.lateShapes.set(s,_([o]));let c=this.lateShapes.get(s),l=c?g(c)[0]:Wn(g(this.originals.get(i)),t);if(!o||!l)throw Error(`Shape ${t} not found`);let u=S(o,`txBody`),d=S(l,`txBody`),f=x(d,`p`),p=y(o.q),m=y((S(d,`bodyPr`)??f[0])?.q??`a:x`)||`a:`;u||(u=E(p+`txBody`,{},[E(m+`bodyPr`),E(m+`lstStyle`)]),o.c.push(u),o.self=!1);let b=f.map(e=>x(e).filter(e=>[`r`,`br`,`fld`].includes(v(e.q)))),C=[],w=n.map(e=>{let t=e.k===void 0?f[f.length-1]:f[e.k],n=E(m+`p`),r=S(t,`pPr`),i=e.algn||e.lvl!==void 0||e.bullet||e.lnPct,a=r?D(r):i?E(m+`pPr`):void 0;a&&i&&Jn(a,e,m),a&&n.c.push(a);let o=S(t,`endParaRPr`),s={k:e.k,runs:[]},c=e=>{let t=S(e?b[e[0]]?.[e[1]]:void 0,`rPr`)??(o?{...D(o),q:m+`rPr`}:void 0);return t?D(t):E(m+`rPr`,{lang:`en-US`,dirty:`0`})};for(let t of e.runs)if(t.fld&&t.src){let e=b[t.src[0]]?.[t.src[1]];e&&(n.c.push(D(e)),s.runs.push(t.src))}else t.text.split(`
|
|
17
17
|
`).forEach((e,r)=>{let i=c(t.src);t.set&&Gn(i,t.set,m),r>0&&(n.c.push(E(m+`br`,{},[{...D(i)}])),s.runs.push(t.src)),e&&(n.c.push(E(m+`r`,{},[i,E(m+`t`,{},[te(e)])])),s.runs.push(t.src))});return n.c.push(o?D(o):E(m+`endParaRPr`,{lang:`en-US`,dirty:`0`})),n.self=!1,C.push(s),n}),T=u.c.filter(e=>!(h(e)&&v(e.q)===`p`));return u.c=[...T,...w],u.self=!1,this.pkg.setPart(i,_(a)),this.genMaps.set(`${i}#${t}`,C),this.undoStack=this.undoStack.filter(e=>e.path!==i),this.redoStack=this.redoStack.filter(e=>e.path!==i),this.slide(e)}save(){return this.pkg.save(Bn)}};function ir(e,t){let n=z(e,`clrMapOvr`,`overrideClrMapping`);return n?{...n.a}:t}var ar=e=>e;function or(e){if(!e)return;let t=L(e,`off`),n=L(e,`ext`);if(!t&&!n)return;let r={x:H(V(t?.a.x,0)),y:H(V(t?.a.y,0)),w:H(V(n?.a.cx,0)),h:H(V(n?.a.cy,0))},i=V(e.a.rot);return i&&(r.rot=i/6e4),e.a.flipH===`1`&&(r.flipH=!0),e.a.flipV===`1`&&(r.flipV=!0),r}var sr=class{constructor(e,t,n,r,i,a,o,s){A(this,`pres`,void 0),A(this,`slide`,void 0),A(this,`layout`,void 0),A(this,`master`,void 0),A(this,`theme`,void 0),A(this,`clrMap`,void 0),A(this,`index`,void 0),A(this,`tableStyles`,void 0),this.pres=e,this.slide=t,this.layout=n,this.master=r,this.theme=i,this.clrMap=a,this.index=o,this.tableStyles=s}cc(e){return{theme:this.theme,clrMap:this.clrMap,phClr:e}}font(e){if(e)return e.startsWith(`+mj`)?$e(this.theme.major):e.startsWith(`+mn`)?$e(this.theme.minor):$e(e)}fill(e,t,n){if(e)for(let r of e.c)switch(r.n){case`noFill`:return{t:`none`};case`solidFill`:{let e=Fn(r,this.cc(n));return e?{t:`solid`,c:e}:void 0}case`gradFill`:{let e=R(L(r,`gsLst`),`gs`).map(e=>({pos:V(e.a.pos,0)/1e3|0,col:Fn(e,this.cc(n))})).filter(e=>e.col).sort((e,t)=>e.pos-t.pos);if(!e.length)return;if(e.length===1)return{t:`solid`,c:e[0].col};let t=e.map(e=>`${e.col} ${e.pos}%`).join(`, `);return L(r,`path`)?{t:`grad`,css:`radial-gradient(circle, ${t})`}:{t:`grad`,css:`linear-gradient(${(V(L(r,`lin`)?.a.ang,0)/6e4+90)%360}deg, ${t})`}}case`blipFill`:{let e=L(r,`blip`)?.a[`r:embed`],n=e?t.get(e):void 0;return n&&!n.external?{t:`img`,target:n.target,tile:!!L(r,`tile`)}:void 0}case`pattFill`:{let e=Fn(L(r,`fgClr`),this.cc(n));return e?{t:`solid`,c:e}:void 0}}}themeFill(e,t){if(!e)return;let n=V(e.a.idx,0);if(!n)return;let r=Fn(e,this.cc()),i=(n>=1001?this.theme.bgFillStyles:this.theme.fillStyles)[n>=1001?n-1001:n-1];return i?this.fill({n:`x`,a:{},c:[i],t:``},t,r)??(r?{t:`solid`,c:r}:void 0):r?{t:`solid`,c:r}:void 0}stroke(e,t){let n=V(t?.a.idx,0),r=n?this.theme.lineStyles[n-1]:void 0,i=t?Fn(t,this.cc()):void 0;if(e&&L(e,`noFill`))return;let a=e?Fn(L(e,`solidFill`),this.cc(i)):void 0;if(!a&&e){let t=z(e,`gradFill`,`gsLst`,`gs`);t&&(a=Fn(t,this.cc(i)))}if(!a&&n&&(a=i??(r?Fn(L(r,`solidFill`),this.cc(i)):void 0)),!a)return;let o=V(e?.a.w)??V(r?.a.w)??9525,s=L(e,`prstDash`)?.a.val??L(r,`prstDash`)?.a.val,c={c:a,w:Math.max(.5,H(o))};s&&Xn[s]&&(c.dash=Xn[s].split(` `).map(e=>+(Number(e)*c.w).toFixed(2)).join(` `));let l=L(e,`headEnd`)?.a.type,u=L(e,`tailEnd`)?.a.type;return l&&l!==`none`&&(c.head=l),u&&u!==`none`&&(c.tail=u),c}background(){for(let e of[this.slide,this.layout,this.master]){if(!e)continue;let t=z(e.root,`cSld`,`bg`);if(!t)continue;let n=L(t,`bgPr`);if(n){let t=this.fill(n,e.rels);if(t)return t}let r=L(t,`bgRef`);if(r)return this.themeFill(r,e.rels)}return{t:`solid`,c:this.theme.colors[this.clrMap.bg1??`lt1`]??`#ffffff`}}readRun(e,t={}){if(!e)return t;let n=e.a;n.sz&&(t.sz=Number(n.sz)/100),n.b!==void 0&&(t.b=n.b===`1`||n.b===`true`),n.i!==void 0&&(t.i=n.i===`1`||n.i===`true`),n.u!==void 0&&(t.u=n.u!==`none`),n.strike!==void 0&&(t.strike=n.strike!==`noStrike`),n.baseline!==void 0&&(t.baseline=Number(n.baseline)/1e3),n.cap!==void 0&&(t.caps=n.cap===`all`);let r=L(e,`solidFill`);if(r){let e=Fn(r,this.cc());e&&(t.color=e)}else{let n=z(e,`gradFill`,`gsLst`,`gs`),r=n&&Fn(n,this.cc());r&&(t.color=r)}let i=Fn(L(e,`highlight`),this.cc());i&&(t.hl=i);let a=L(e,`latin`)?.a.typeface??L(e,`ea`)?.a.typeface,o=this.font(a);return o&&(t.font=o),t}readLvl(e,t){let n={...t,r:{...t.r}};if(!e)return n;let r=e.a;r.algn&&(n.algn=Yn[r.algn]??`left`),r.marL!==void 0&&(n.marL=H(Number(r.marL))),r.indent!==void 0&&(n.indent=H(Number(r.indent)));for(let t of e.c)switch(t.n){case`lnSpc`:{let e=V(L(t,`spcPct`)?.a.val),r=V(L(t,`spcPts`)?.a.val);e===void 0?r!==void 0&&(n.lnPts=r/100,n.lnPct=void 0):(n.lnPct=e/1e5,n.lnPts=void 0);break}case`spcBef`:case`spcAft`:{let e=V(L(t,`spcPct`)?.a.val),r=V(L(t,`spcPts`)?.a.val),i=e===void 0?{pts:(r??0)/100}:{pct:e/1e5};t.n===`spcBef`?n.bef=i:n.aft=i;break}case`buNone`:n.bu={kind:`none`};break;case`buChar`:n.bu={kind:`char`,char:t.a.char??`•`};break;case`buAutoNum`:n.bu={kind:`auto`,autoType:t.a.type??`arabicPeriod`,startAt:V(t.a.startAt,1)};break;case`buClr`:n.buClr=Fn(t,this.cc());break;case`buFont`:n.buFont=t.a.typeface;break;case`buSzPct`:n.buSzPct=V(t.a.val,1e5)/1e5;break;case`defRPr`:this.readRun(t,n.r)}return n}levels(e){let t=[];for(let n=1;n<=9;n++){let r={r:{}};for(let t of e)t&&(r=this.readLvl(L(t,`defPPr`),r),r=this.readLvl(L(t,`lvl${n}pPr`),r));t.push(r)}return t}textBody(e,t,n,r,i,a){if(!e)return;let o=R(e,`p`),s=!o.some(e=>e.c.some(e=>e.n===`r`||e.n===`fld`));if(s&&a===void 0)return;let c=a===void 0?void 0:this.pres.genMap(this.slide.path,a),l=this.master,u;if(n){let e=$n(n.type);u=e===`title`?l?.title:e===`body`?l?.body:l?.other}let d=n?[u]:[l?.other,this.pres.defaults];if(r){let e=Fn(r,this.cc()),t=r.a.idx===`major`?this.theme.major:r.a.idx===`minor`?this.theme.minor:void 0,n={n:`lstStyle`,a:{},c:[],t:``},i={n:`defRPr`,a:{},c:[],t:``};e&&i.c.push({n:`solidFill`,a:{},c:[{n:`srgbClr`,a:{val:e.replace(`#`,``).slice(0,6)},c:[],t:``}],t:``}),t&&i.c.push({n:`latin`,a:{typeface:t},c:[],t:``}),n.c.push({n:`defPPr`,a:{},c:[i],t:``}),d.push(n)}for(let e of t)d.push(z(e,`txBody`,`lstStyle`));let f=this.levels(d),p={},m;for(let e of t){let t=z(e,`txBody`,`bodyPr`);if(!t)continue;Object.assign(p,t.a);let n=L(t,`normAutofit`);n&&(m=n)}let h=m?V(m.a.fontScale,1e5)/1e5:1,g=m?V(m.a.lnSpcReduction,0)/1e5:0,_=[H(V(p.lIns,91440)),H(V(p.tIns,45720)),H(V(p.rIns,91440)),H(V(p.bIns,45720))],v=[],y=i?.rels??this.slide.rels,b=o.map((e,t)=>{let n=L(e,`pPr`),r=Math.min(8,V(n?.a.lvl,0)),i=this.readLvl(n,f[r]),a=[],o=0;for(let n of e.c){let e=n.n===`r`||n.n===`fld`||n.n===`br`?c?c[t]?.runs[o++]:[t,o++]:void 0;if(n.n===`r`||n.n===`fld`){let t=this.readRun(L(n,`rPr`),{...i.r}),r=Me(L(n,`t`));n.n===`fld`&&n.a.type===`slidenum`&&(r=String(this.index+1));let o=z(n,`rPr`,`hlinkClick`)?.a[`r:id`],s=o?y.get(o)?.target:void 0;a.push({text:r,sz:(t.sz??18)*h,b:t.b,i:t.i,u:t.u||!!s,strike:t.strike,color:t.color??(s?this.theme.colors.hlink:void 0),font:t.font,baseline:t.baseline,caps:t.caps,href:s,hl:t.hl,src:e,...n.n===`fld`?{fld:!0}:{}})}else if(n.n===`br`){let t=this.readRun(L(n,`rPr`),{...i.r});a.push({text:``,br:!0,sz:(t.sz??18)*h,src:e})}}let s=this.readRun(L(e,`endParaRPr`),{...i.r}),l=a[0]?.sz??(s.sz??18)*h,u=a.some(e=>e.text),d;if(i.bu&&i.bu.kind!==`none`&&u){let e=l*(i.buSzPct??1),t=i.buClr??a[0]?.color??i.r.color;if(i.bu.kind===`char`)d={text:i.bu.char??`•`,sz:e,color:t,font:i.buFont?this.font(i.buFont):void 0};else{v[r]=(v[r]??(i.bu.startAt??1)-1)+1;for(let e=r+1;e<9;e++)v[e]=void 0;d={text:nr(i.bu.autoType??`arabicPeriod`,v[r]),sz:e,color:t}}}else if(!i.bu||i.bu.kind===`none`)for(let e=r;e<9;e++)v[e]=void 0;let p=e=>e?e.pts===void 0?(e.pct??0)*l*1.2*(4/3):e.pts*4/3:0;return{algn:i.algn??`left`,marL:i.marL??0,indent:i.indent??0,lnPct:i.lnPct===void 0?g?1-g:void 0:i.lnPct*(1-g),lnPx:i.lnPts===void 0?void 0:i.lnPts*4/3,spcBef:p(i.bef),spcAft:p(i.aft),bullet:d,lvl:r||void 0,buKind:i.bu?.kind===`char`?`bullet`:i.bu?.kind===`auto`?`number`:void 0,runs:a,endSz:(s.sz??18)*h,k:c?c[t]?.k:t}});return{anchor:p.anchor===`ctr`?`ctr`:p.anchor===`b`?`b`:`t`,ins:_,wrap:p.wrap!==`none`,vert:p.vert&&p.vert!==`horz`?p.vert:void 0,paras:b,empty:s||void 0}}inheritChain(e,t){let n=Qn(e);if(!n)return{chain:[e]};let r=[],i=$n(n.type);if(t===this.slide){let e=this.layout?(n.idx===void 0?void 0:this.layout.byIdx.get(n.idx))??this.layout.byType.get(n.type):void 0,t=e?Qn(e)?.type??i:i,a=this.master?.byType.get($n(t))??this.master?.byType.get(i);a&&r.push(a),e&&r.push(e)}else if(t===this.layout){let e=this.master?.byType.get(i);e&&r.push(e)}return r.push(e),{chain:r,ph:n}}walk(e,t,n,r,i,a){if(t)for(let o of t.c){if(i&&(o.n===`sp`||o.n===`pic`)&&Qn(o))continue;let t=L(o.c[0],`cNvPr`)?.a.id,s=a??(e===this.slide&&t?Number(t):void 0),c=r.length;try{switch(o.n){case`sp`:case`cxnSp`:this.shape(o,e,n,r);break;case`pic`:this.pic(o,e,n,r);break;case`grpSp`:this.group(o,e,n,r,i,s);break;case`graphicFrame`:this.frame(o,e,n,r)}}catch{}if(s!==void 0)for(let e=c;e<r.length;e++)r[e].top=s}}boxOf(e,t,n){for(let r=e.length-1;r>=0;r--){let i=or(z(e[r],...t));if(i)return n(i)}}shape(e,t,n,r){let{chain:i,ph:a}=this.inheritChain(e,t),o=this.boxOf(i,[`spPr`,`xfrm`],n);if(!o)return;let s=L(e,`style`),c;for(let e=i.length-1;e>=0&&!c;e--)c=this.fill(L(i[e],`spPr`),t.rels);!c&&s&&(c=this.themeFill(L(s,`fillRef`),t.rels));let l;for(let e=i.length-1;e>=0&&!l;e--)l=z(i[e],`spPr`,`ln`);let u=this.stroke(l,L(s,`lnRef`)),d=`rect`,f,p;for(let e=i.length-1;e>=0;e--){let t=z(i[e],`spPr`,`prstGeom`);if(t){d=t.a.prst??`rect`;let e=R(L(t,`avLst`),`gd`);if(e.length){f={};for(let t of e){let e=/val\s+(-?\d+)/.exec(t.a.fmla??``);e&&(f[t.a.name]=Number(e[1]))}}break}let n=z(i[e],`spPr`,`custGeom`);if(n){d=`custom`,p=ur(n,o);break}}e.n===`cxnSp`&&d===`rect`&&(d=`line`);let m=z(e,`nvSpPr`,`cNvPr`)?.a.id,h=t===this.slide&&e.n===`sp`&&m?Number(m):void 0,g=e.n===`sp`?this.textBody(L(e,`txBody`),i,a,L(s,`fontRef`),t,h):void 0;(c&&c.t!==`none`||u||g)&&r.push({t:`shape`,box:o,geom:d,adj:f,fill:c,stroke:u,text:g,path:p,sid:h})}pic(e,t,n,r){let{chain:i}=this.inheritChain(e,t),a=this.boxOf(i,[`spPr`,`xfrm`],n);if(!a)return;let o=L(e,`blipFill`),s=L(o,`blip`)?.a[`r:embed`],c=s?t.rels.get(s):void 0,l=L(o,`srcRect`),u=l?[V(l.a.l,0)/1e5,V(l.a.t,0)/1e5,V(l.a.r,0)/1e5,V(l.a.b,0)/1e5]:void 0,d=!!L(Zn(e),`videoFile`)||!!L(Zn(e),`audioFile`);r.push({t:`pic`,box:a,target:c&&!c.external?c.target:void 0,crop:u&&u.some(e=>e!==0)?u:void 0,stroke:this.stroke(z(e,`spPr`,`ln`),z(e,`style`,`lnRef`)),geom:z(e,`spPr`,`prstGeom`)?.a.prst,video:d})}group(e,t,n,r,i,a){let o=z(e,`grpSpPr`,`xfrm`),s=L(o,`off`),c=L(o,`ext`),l=L(o,`chOff`),u=L(o,`chExt`);if(!s||!c)return this.walk(t,e,n,r,i,a);let d=H(V(s.a.x,0)),f=H(V(s.a.y,0)),p=H(V(l?.a.x,0)),m=H(V(l?.a.y,0)),h=u&&V(u.a.cx)?V(c.a.cx,0)/V(u.a.cx,1):1,g=u&&V(u.a.cy)?V(c.a.cy,0)/V(u.a.cy,1):1;this.walk(t,e,e=>n({...e,x:d+(e.x-p)*h,y:f+(e.y-m)*g,w:e.w*h,h:e.h*g}),r,i,a)}frame(e,t,n,r){let i=or(L(e,`xfrm`));if(!i)return;let a=n(i),o=z(e,`graphic`,`graphicData`);if(!o)return;let s=L(o,`tbl`);if(s)return void r.push(this.table(s,a,t));let c=L(L(o,`oleObj`),`pic`);if(c){let e=z(c,`blipFill`,`blip`)?.a[`r:embed`],n=e?t.rels.get(e):void 0;r.push({t:`pic`,box:a,target:n?.target});return}let l=o.a.uri??``,u=l.includes(`chart`)?`Chart`:l.includes(`diagram`)?`SmartArt`:l.includes(`ole`)?`Embedded object`:`Object`;r.push({t:`placeholder`,box:a,label:u})}table(e,t,n){let r=R(L(e,`tblGrid`),`gridCol`).map(e=>H(V(e.a.w,0))),i=L(e,`tblPr`),a=e=>i?.a[e]===`1`||i?.a[e]===`true`,o=L(i,`tableStyleId`)?.t.trim(),s=o?this.tableStyles.get(o):void 0,c=R(e,`tr`),l=c.length,u=r.length,d=this.fill(i,n.rels),f=(e,t)=>{let n=[],r=e=>{let t=L(s,e);t&&n.push(t)};r(`wholeTbl`);let i=e-+!!a(`firstRow`);a(`bandRow`)&&i>=0&&r(i%2==0?`band1H`:`band2H`);let o=t-+!!a(`firstCol`);return a(`bandCol`)&&o>=0&&r(o%2==0?`band1V`:`band2V`),a(`firstCol`)&&t===0&&r(`firstCol`),a(`lastCol`)&&t===u-1&&r(`lastCol`),a(`lastRow`)&&e===l-1&&r(`lastRow`),a(`firstRow`)&&e===0&&r(`firstRow`),n},p=!s&&o?cr(this.theme,a(`firstRow`),a(`bandRow`)):void 0;return{t:`table`,box:t,cols:r,rows:c.map((e,t)=>{let r=R(e,`tc`).map((e,r)=>{let i=L(e,`tcPr`),a,o,s,c={};for(let e of f(t,r)){let t=L(e,`tcStyle`),r=this.fill(L(t,`fill`),n.rels)??this.themeFill(L(t,`fillRef`),n.rels);r&&(a=r);let i=L(t,`tcBdr`);for(let e of i?.c??[]){let t=this.stroke(L(e,`ln`),L(e,`lnRef`));c[e.n]=t}let l=L(e,`tcTxStyle`);if(l){l.a.b&&(o=l.a.b===`on`);let e=Fn(l,this.cc())??Fn(L(l,`fontRef`),this.cc());e&&(s=e)}}if(p){let e=p(t);a=e.fill,e.color&&(s=e.color),e.bold&&(o=!0),c.insideH=c.insideV={c:`#ffffff`,w:1}}let m=this.fill(i,n.rels);m&&(a=m);let h=(e,t,n,r)=>{let a=L(i,e);return a?this.stroke(a,void 0):r?c[t]:c[n]??c[t]},g=L(e,`txBody`),_=this.textBody(g,g?[e]:[],void 0,void 0,n);if(_){if(_.ins=[H(V(i?.a.marL,91440)),H(V(i?.a.marT,45720)),H(V(i?.a.marR,91440)),H(V(i?.a.marB,45720))],_.anchor=i?.a.anchor===`ctr`?`ctr`:i?.a.anchor===`b`?`b`:`t`,o!==void 0||s)for(let e of _.paras)for(let t of e.runs)o&&t.b===void 0&&(t.b=!0),s&&!t.color&&(t.color=s)}else _=void 0;return{text:_,fill:a??d,bl:h(`lnL`,`left`,`insideV`,r===0),br:h(`lnR`,`right`,`insideV`,r===u-1),bt:h(`lnT`,`top`,`insideH`,t===0),bb:h(`lnB`,`bottom`,`insideH`,t===l-1),colSpan:V(e.a.gridSpan,1),rowSpan:V(e.a.rowSpan,1),hidden:e.a.hMerge===`1`||e.a.vMerge===`1`||e.a.hMerge===`true`||e.a.vMerge===`true`}});return{h:H(V(e.a.h,0)),cells:r}})}}};function cr(e,t,n){let r=e.colors.accent1??`#4472c4`;return e=>{if(t&&e===0)return{fill:{t:`solid`,c:r},color:`#ffffff`,bold:!0};let i=e-+!!t,a=n&&i%2==0?.6:.8;return{fill:{t:`solid`,c:lr(r,`#ffffff`,a)}}}}function lr(e,t,n){let r=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),i=[1,3,5].map(e=>parseInt(t.slice(e,e+2),16));return`#`+r.map((e,t)=>Math.round(e+(i[t]-e)*n).toString(16).padStart(2,`0`)).join(``)}function ur(e,t){let n=R(L(e,`pathLst`),`path`),r=``;for(let e of n){let n=V(e.a.w)||1,i=V(e.a.h)||1,a=t.w/n,o=t.h/i,s=e=>`${(V(e?.a.x,0)*a).toFixed(2)} ${(V(e?.a.y,0)*o).toFixed(2)}`,c=0,l=0;for(let t of e.c){let e=R(t,`pt`);switch(t.n){case`moveTo`:r+=`M${s(e[0])} `,c=V(e[0]?.a.x,0)*a,l=V(e[0]?.a.y,0)*o;break;case`lnTo`:r+=`L${s(e[0])} `,c=V(e[0]?.a.x,0)*a,l=V(e[0]?.a.y,0)*o;break;case`cubicBezTo`:r+=`C${e.map(s).join(` `)} `,c=V(e[2]?.a.x,0)*a,l=V(e[2]?.a.y,0)*o;break;case`quadBezTo`:r+=`Q${e.map(s).join(` `)} `,c=V(e[1]?.a.x,0)*a,l=V(e[1]?.a.y,0)*o;break;case`arcTo`:{let e=V(t.a.wR,0)*a,n=V(t.a.hR,0)*o,i=V(t.a.stAng,0)/6e4*(Math.PI/180),s=V(t.a.swAng,0)/6e4*(Math.PI/180),u=c-e*Math.cos(i),d=l-n*Math.sin(i),f=u+e*Math.cos(i+s),p=d+n*Math.sin(i+s);r+=`A${e.toFixed(2)} ${n.toFixed(2)} 0 ${+(Math.abs(s)>Math.PI)} ${+(s>0)} ${f.toFixed(2)} ${p.toFixed(2)} `,c=f,l=p;break}case`close`:r+=`Z `}}}return r.trim()||void 0}var dr=class{constructor(e,t){A(this,`blob`,void 0),A(this,`name`,void 0),A(this,`size`,void 0),this.blob=e,this.name=t,this.size=e.size}async read(e,t){return new Uint8Array(await this.blob.slice(e,e+t).arrayBuffer())}stream(e,t){return this.blob.slice(e,e+t).stream()}slice(e,t){return this.blob.slice(e,e+t)}},fr=class{constructor(e,t){A(this,`name`,void 0),A(this,`size`,void 0),A(this,`bytes`,void 0),this.name=t,this.bytes=e instanceof Uint8Array?e:new Uint8Array(e),this.size=this.bytes.byteLength}async read(e,t){return this.bytes.subarray(e,e+t)}stream(e,t){let n=this.bytes,r=Math.min(e+t,n.byteLength),i=e;return new ReadableStream({pull(e){if(i>=r)return e.close();let t=Math.min(i+1048576,r);e.enqueue(n.slice(i,t)),i=t}})}},pr=class e{constructor(e,t,n,r){A(this,`url`,void 0),A(this,`size`,void 0),A(this,`opts`,void 0),A(this,`name`,void 0),A(this,`cache`,new Map),A(this,`inflight`,new Map),A(this,`blockSize`,void 0),A(this,`maxBlocks`,void 0),this.url=e,this.size=t,this.opts=n,this.name=r,this.blockSize=n.blockSize??262144,this.maxBlocks=n.maxBlocks??128}static async open(t,n={}){let r=decodeURIComponent(t.split(/[?#]/)[0].split(`/`).pop()||``)||void 0,i={headers:{...n.headers},credentials:n.credentials,signal:n.signal},a=-1;try{let o=await fetch(t,{...i,headers:{...n.headers,Range:`bytes=0-0`}});if(o.status===206){let s=o.headers.get(`Content-Range`),c=s&&/\/(\d+)\s*$/.exec(s);if(c&&(a=Number(c[1])),await o.body?.cancel(),a<0){let e=await fetch(t,{...i,method:`HEAD`}),n=e.headers.get(`Content-Length`);e.ok&&n&&(a=Number(n))}if(a>0)return new e(t,a,n,r)}else if(o.ok)return new dr(await mr(o,n.onProgress),r)}catch(e){if(e?.name===`AbortError`)throw e}let o=await fetch(t,i);if(!o.ok)throw Error(`HTTP ${o.status} while fetching ${t}`);return new dr(await mr(o,n.onProgress),r)}async fetchRange(e,t){let n=await fetch(this.url,{headers:{...this.opts.headers,Range:`bytes=${e}-${t-1}`},credentials:this.opts.credentials,signal:this.opts.signal});if(n.status!==206&&!n.ok)throw Error(`HTTP ${n.status} (range ${e}-${t-1})`);let r=new Uint8Array(await n.arrayBuffer());return n.status===206?r:r.subarray(e,t)}async ensureBlocks(e,t){let n=[],r=-1,i=e=>{if(r<0)return;let t=r,i=e,a=this.fetchRange(t*this.blockSize,Math.min((i+1)*this.blockSize,this.size)).then(e=>{for(let n=t;n<=i;n++){let r=(n-t)*this.blockSize;this.cache.set(n,e.subarray(r,Math.min(r+this.blockSize,e.length))),this.inflight.delete(n)}this.evict()});for(let e=t;e<=i;e++)this.inflight.set(e,a);n.push(a),r=-1};for(let a=e;a<=t;a++)if(this.cache.has(a)){i(a-1);let e=this.cache.get(a);this.cache.delete(a),this.cache.set(a,e)}else this.inflight.has(a)?(i(a-1),n.push(this.inflight.get(a))):r<0&&(r=a);i(t),await Promise.all(n)}evict(){for(;this.cache.size>this.maxBlocks;){let e=this.cache.keys().next().value;this.cache.delete(e)}}async read(e,t){let n=Math.min(e+t,this.size);if(n<=e)return new Uint8Array;if(n-e>this.maxBlocks*this.blockSize/2)return this.fetchRange(e,n);let r=this.blockSize,i=Math.floor(e/r),a=Math.floor((n-1)/r);await this.ensureBlocks(i,a);let o=new Uint8Array(n-e);for(let t=i;t<=a;t++){let i=this.cache.get(t);if(!i)throw Error(`range block evicted before use`);let a=t*r,s=Math.max(e,a),c=Math.min(n,a+i.length);o.set(i.subarray(s-a,c-a),s-e)}return o}stream(e,t){if(t>2*this.blockSize){let{url:n,opts:r}=this,i;return new ReadableStream({async start(){let a=await fetch(n,{headers:{...r.headers,Range:`bytes=${e}-${e+t-1}`},credentials:r.credentials,signal:r.signal});if(a.status!==206)throw Error(`Range request not honoured (HTTP ${a.status})`);i=a.body.getReader()},async pull(e){let{done:t,value:n}=await i.read();t?e.close():e.enqueue(n)},cancel(){return i?.cancel()}})}let n=e,r=e+t;return new ReadableStream({pull:async e=>{if(n>=r)return e.close();let t=Math.min(this.blockSize,r-n);e.enqueue(await this.read(n,t)),n+=t}})}};async function mr(e,t){let n=Number(e.headers.get(`Content-Length`)||0);if(!e.body||!t)return e.blob();let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a,n)}return new Blob(i)}async function hr(e,t={}){if(typeof e==`string`||e instanceof URL)return pr.open(String(e),t);if(e instanceof Uint8Array||e instanceof ArrayBuffer)return new fr(e,t.name);if(typeof Blob<`u`&&e instanceof Blob)return new dr(e,t.name??e.name);throw Error(`Unsupported document source`)}var gr=s(),_r=[`#NULL!`,`#DIV/0!`,`#VALUE!`,`#REF!`,`#NAME?`,`#NUM!`,`#N/A`],U=class{constructor(e){A(this,`code`,void 0),this.code=e}toString(){return this.code}},vr=1048575,yr=16383,W={DIV0:new U(`#DIV/0!`),VALUE:new U(`#VALUE!`),REF:new U(`#REF!`),NAME:new U(`#NAME?`),NA:new U(`#N/A`),NUM:new U(`#NUM!`),NULL:new U(`#NULL!`)};function br(e){let t=``,n=e+1;for(;n>0;){let e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-1)/26)}return t}function xr(e){let t=0,n=e.toUpperCase();for(let e=0;e<n.length;e++)t=t*26+(n.charCodeAt(e)-64);return t-1}function Sr(e,t){return e===void 0||t===void 0?e===t:e.toLowerCase()===t.toLowerCase()}function Cr(e){return/^[A-Za-z_\u00A1-\uFFFF][\w.\u00A1-\uFFFF]*$/.test(e)&&!/^[A-Za-z]{1,3}\d+$/.test(e)&&!/^(R\d*C?\d*|C\d*)$/i.test(e)&&!/^(TRUE|FALSE)$/i.test(e)?e:`'${e.replace(/'/g,`''`)}'`}var wr=(e,t,n,r)=>`${r?`$`:``}${br(t)}${n?`$`:``}${e+1}`;function Tr(e,t){let n=e.sheet===void 0?``:`${t??Cr(e.sheet)}!`;switch(e.kind){case`cell`:return n+wr(e.r0,e.c0,e.ar0,e.ac0);case`area`:return`${n}${wr(e.r0,e.c0,e.ar0,e.ac0)}:${wr(e.r1,e.c1,e.ar1,e.ac1)}`;case`cols`:return`${n}${e.ac0?`$`:``}${br(e.c0)}:${e.ac1?`$`:``}${br(e.c1)}`;case`rows`:return`${n}${e.ar0?`$`:``}${e.r0+1}:${e.ar1?`$`:``}${e.r1+1}`}}function Er(e){return e.r0>e.r1&&([e.r0,e.r1]=[e.r1,e.r0],[e.ar0,e.ar1]=[e.ar1,e.ar0]),e.c0>e.c1&&([e.c0,e.c1]=[e.c1,e.c0],[e.ac0,e.ac1]=[e.ac1,e.ac0]),e}function Dr(e){return e.r0>=0&&e.c0>=0&&e.r1<=1048575&&e.c1<=16383&&e.r1>=0&&e.c1>=0}var Or=class extends Error{constructor(e,t){super(e),A(this,`pos`,void 0),this.pos=t,this.name=`FormulaSyntaxError`}},kr=[[`#DIV/0!`,`#DIV/0!`],[`#VALUE!`,`#VALUE!`],[`#REF!`,`#REF!`],[`#NAME?`,`#NAME?`],[`#N/A`,`#N/A`],[`#NUM!`,`#NUM!`],[`#NULL!`,`#NULL!`]],Ar=/[\w.$\\\u00A1-\uFFFF]/,jr=/(\$?)([A-Za-z]{1,3})(\$?)(\d+):(\$?)([A-Za-z]{1,3})(\$?)(\d+)/y,Mr=/(\$?)([A-Za-z]{1,3})(\$?)(\d+)/y,Nr=/(\$?)([A-Za-z]{1,3}):(\$?)([A-Za-z]{1,3})/y,Pr=/(\$?)(\d+):(\$?)(\d+)/y,Fr=/(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?/y,Ir=[`_XLFN.`,`_XLWS.`,`_XLUDF.`];function Lr(e,t,n){return e.lastIndex=n,e.exec(t)}var Rr=e=>e!==void 0&&Ar.test(e);function zr(e){let t=Number(e)-1;return t>=0&&t<=1048575?t:-1}function Br(e){let t=xr(e);return t<=16383?t:-1}function Vr(e,t){let n,r=null;if(n=Lr(jr,e,t)){let[e,t,i,a]=[zr(n[4]),Br(n[2]),zr(n[8]),Br(n[6])];e>=0&&t>=0&&i>=0&&a>=0&&(r={kind:`area`,r0:e,c0:t,r1:i,c1:a,ac0:!!n[1],ar0:!!n[3],ac1:!!n[5],ar1:!!n[7]})}if(!r&&(n=Lr(Mr,e,t))){let[e,t]=[zr(n[4]),Br(n[2])];e>=0&&t>=0&&(r={kind:`cell`,r0:e,c0:t,r1:e,c1:t,ac0:!!n[1],ar0:!!n[3],ac1:!!n[1],ar1:!!n[3]})}if(!r&&(n=Lr(Nr,e,t))){let[e,t]=[Br(n[2]),Br(n[4])];e>=0&&t>=0&&(r={kind:`cols`,r0:0,c0:e,r1:vr,c1:t,ac0:!!n[1],ar0:!1,ac1:!!n[3],ar1:!1})}if(!r&&(n=Lr(Pr,e,t))){let[e,t]=[zr(n[2]),zr(n[4])];e>=0&&t>=0&&(r={kind:`rows`,r0:e,c0:0,r1:t,c1:yr,ac0:!1,ar0:!!n[1],ac1:!1,ar1:!!n[3]})}if(!r||!n)return null;let i=t+n[0].length,a=e[i];return Rr(a)||a===`(`||a===`!`?null:{ref:Er(r),end:i}}function Hr(e,t){let n=e.slice(t,t+7).toUpperCase();for(let[e,r]of kr)if(n.startsWith(e))return[r,t+e.length];return null}function Ur(e){let t=e.toUpperCase();for(let e=!0;e;){e=!1;for(let n of Ir)t.startsWith(n)&&(t=t.slice(n.length),e=!0)}return t}function Wr(e){let t=[],n=e.length,r=0,i=(r,i,a,o)=>{if(e[i]===`#`){let n=Hr(e,i);if(!n)throw new Or(`bad error literal`,i);return t.push({t:`err`,v:n[0],sheet:a,s:r,e:n[1]}),n[1]}let s=Vr(e,i);if(s)return s.ref.sheet=a,t.push({t:`ref`,ref:s.ref,sheetText:o,s:r,e:s.end}),s.end;let c=i;for(;c<n&&Rr(e[c]);)c++;if(c===i)throw new Or(`expected reference after !`,i);return t.push({t:`name`,v:e.slice(i,c),sheet:a,s:r,e:c}),c};for(;r<n;){let a=e[r],o=r;if(a===` `||a===`
|
|
18
|
-
`||a===`\r`||a===` `||a===`\xA0`){for(;r<n&&/[\s\u00A0]/.test(e[r]);)r++;t.push({t:`ws`,s:o,e:r});continue}if(a===`"`){let i=``;for(r++;;){if(r>=n)throw new Or(`unterminated string`,o);if(e[r]===`"`){if(e[r+1]===`"`){i+=`"`,r+=2;continue}r++;break}i+=e[r++]}t.push({t:`str`,v:i,s:o,e:r});continue}if(a===`#`){let n=Hr(e,r);if(!n)throw new Or(`bad error literal`,r);t.push({t:`err`,v:n[0],s:o,e:n[1]}),r=n[1];continue}if(a===`'`){let t=``,a=r+1;for(;;){if(a>=n)throw new Or(`unterminated sheet name`,o);if(e[a]===`'`){if(e[a+1]===`'`){t+=`'`,a+=2;continue}break}t+=e[a++]}if(e[a+1]!==`!`)throw new Or(`expected '!' after sheet name`,a+1);r=i(o,a+2,t,e.slice(r,a+1));continue}if(a===`[`){let t=/\[\d+\][\w.\u00A1-\uFFFF]+!/y;if(t.lastIndex=r,!t.exec(e))throw new Or(`unexpected '['`,r);let n=t.lastIndex-1,a=e.slice(r,n);r=i(o,n+1,a,a);continue}if(`(){},;`.includes(a)){t.push({t:`punc`,v:a,s:o,e:++r});continue}let s=e.slice(r,r+2);if(s===`<=`||s===`>=`||s===`<>`)t.push({t:`op`,v:s,s:o,e:r+=2});else if(`+-*/^&=<>%:`.includes(a))t.push({t:`op`,v:a,s:o,e:++r});else if(a>=`0`&&a<=`9`||a===`.`&&/\d/.test(e[r+1]??``)||a===`$`&&/\d/.test(e[r+1]??``)){let n=Vr(e,r);if(n&&n.ref.kind===`rows`){t.push({t:`ref`,ref:n.ref,s:o,e:n.end}),r=n.end;continue}let i=Lr(Fr,e,r);if(!i||a===`$`)throw new Or(`bad number`,r);r+=i[0].length,t.push({t:`num`,v:Number(i[0]),s:o,e:r})}else if(Rr(a)){let a=r;for(;a<n&&Rr(e[a]);)a++;let s=e.slice(r,a);if(e[a]===`!`){r=i(o,a+1,s,s);continue}if(e[a]===`(`){t.push({t:`func`,v:Ur(s),s:o,e:a}),r=a;continue}let c=Vr(e,r);if(c){t.push({t:`ref`,ref:c.ref,s:o,e:c.end}),r=c.end;continue}let l=s.toUpperCase();if(l===`TRUE`||l===`FALSE`){t.push({t:`bool`,v:l===`TRUE`,s:o,e:a}),r=a;continue}if(e[a]===`[`){let t=0;do e[a]===`[`?t++:e[a]===`]`&&t--,a++;while(a<n&&t>0);if(t>0)throw new Or(`unterminated [`,r)}t.push({t:`name`,v:e.slice(r,a),s:o,e:a}),r=a}else throw new Or(`unexpected character '${a}'`,r)}return t}function Gr(e){let t;try{t=Wr(e.trim()).filter(e=>e.t!==`ws`)}catch{return null}let n=t[0];if(!n||n.t!==`ref`)return null;if(t.length===1)return n.ref;let r=t[1],i=t[2];return t.length!==3||r.t!==`op`||r.v!==`:`||i.t!==`ref`||i.ref.sheet!==void 0&&(n.ref.sheet??``).toLowerCase()!==i.ref.sheet.toLowerCase()?null:Er({...n.ref,kind:`area`,r0:Math.min(n.ref.r0,i.ref.r0),c0:Math.min(n.ref.c0,i.ref.c0),r1:Math.max(n.ref.r1,i.ref.r1),c1:Math.max(n.ref.c1,i.ref.c1)})}var Kr=new Set([`=`,`<>`,`<`,`>`,`<=`,`>=`]),qr=class{constructor(e){A(this,`toks`,void 0),A(this,`i`,0),this.toks=e}peek(){return this.toks[this.i]}isOp(...e){let t=this.toks[this.i];return t&&t.t===`op`&&e.includes(t.v)?t.v:void 0}isPunc(e){let t=this.toks[this.i];return!!t&&t.t===`punc`&&t.v===e}fail(e){let t=this.toks[this.i];throw new Or(e,t?t.s:-1)}expectPunc(e){this.isPunc(e)||this.fail(`expected '${e}'`),this.i++}expr(){let e=this.concat();for(let t=this.cmpOp();t;t=this.cmpOp())this.i++,e={type:`binary`,op:t,left:e,right:this.concat()};return e}cmpOp(){let e=this.peek();return e&&e.t===`op`&&Kr.has(e.v)?e.v:void 0}concat(){let e=this.add();for(;this.isOp(`&`);)this.i++,e={type:`binary`,op:`&`,left:e,right:this.add()};return e}add(){let e=this.mul();for(let t=this.isOp(`+`,`-`);t;t=this.isOp(`+`,`-`))this.i++,e={type:`binary`,op:t,left:e,right:this.mul()};return e}mul(){let e=this.pow();for(let t=this.isOp(`*`,`/`);t;t=this.isOp(`*`,`/`))this.i++,e={type:`binary`,op:t,left:e,right:this.pow()};return e}pow(){let e=this.postfix();for(;this.isOp(`^`);)this.i++,e={type:`binary`,op:`^`,left:e,right:this.postfix()};return e}postfix(){let e=this.unary();for(;this.isOp(`%`);)this.i++,e={type:`percent`,arg:e};return e}unary(){let e=this.isOp(`-`,`+`);return e?(this.i++,{type:`unary`,op:e,arg:this.unary()}):this.range()}range(){let e=this.primary();for(;this.isOp(`:`);)this.i++,e={type:`range`,left:e,right:this.primary()};return e}primary(){let e=this.peek();switch(e||this.fail(`unexpected end of formula`),this.i++,e.t){case`num`:return{type:`num`,value:e.v};case`str`:return{type:`str`,value:e.v};case`bool`:return{type:`bool`,value:e.v};case`err`:return{type:`err`,code:e.v};case`ref`:return{type:`ref`,ref:e.ref};case`name`:return e.sheet===void 0?{type:`name`,name:e.v}:{type:`name`,name:e.v,sheet:e.sheet};case`func`:return this.expectPunc(`(`),{type:`call`,name:e.v,args:this.args()};case`punc`:if(e.v===`(`){let e=this.expr();if(!this.isPunc(`,`))return this.expectPunc(`)`),e;let t=[e];for(;this.isPunc(`,`);)this.i++,t.push(this.expr());return this.expectPunc(`)`),{type:`union`,items:t}}if(e.v===`{`)return this.array()}return this.i--,this.fail(`unexpected token`)}args(){let e=[];if(this.isPunc(`)`))return this.i++,e;for(;;){if(e.push(this.isPunc(`,`)||this.isPunc(`)`)?{type:`missing`}:this.expr()),this.isPunc(`)`))return this.i++,e;this.expectPunc(`,`)}}array(){let e=[[]];for(;;){e[e.length-1].push(this.arrayItem());let t=this.peek();if(t&&t.t===`punc`||this.fail(`bad array constant`),this.i++,t.v===`}`)break;t.v===`;`?e.push([]):t.v!==`,`&&this.fail(`bad array constant`)}return e.some(t=>t.length!==e[0].length)&&this.fail(`array rows differ in length`),{type:`array`,rows:e}}arrayItem(){let e=this.isOp(`-`,`+`);e&&this.i++;let t=this.peek();return t||this.fail(`bad array constant`),this.i++,t.t===`num`?e===`-`?-t.v:t.v:(e&&this.fail(`bad array constant`),t.t===`str`||t.t===`bool`?t.v:t.t===`err`?new U(t.v):(this.i--,this.fail(`bad array constant`)))}};function Jr(e){let t=Wr(e.startsWith(`=`)?e.slice(1):e).filter(e=>e.t!==`ws`);if(!t.length)throw new Or(`empty formula`,0);let n=new qr(t),r=n.expr();if(n.i<t.length)throw new Or(`unexpected token`,t[n.i].s);return r}var Yr=864e5,Xr=Date.UTC(1899,11,30),Zr=Date.UTC(1904,0,1),Qr=!1;function $r(){return Qr}function ei(e){Qr=e}function ti(e,t,n){let r=new Date(0);return r.setUTCFullYear(e,t-1,n),r.getTime()}function ni(e,t,n){let r=ti(e,t,n);if(Qr)return Math.round((r-Zr)/Yr);let i=Math.round((r-Xr)/Yr);return i<61?i-1:i}function ri(e){let t=Math.floor(e);if(Qr){let e=new Date(Zr+t*Yr);return{y:e.getUTCFullYear(),m:e.getUTCMonth()+1,d:e.getUTCDate(),dow:((t+5)%7+7)%7}}let n=((t-1)%7+7)%7;if(t===60)return{y:1900,m:2,d:29,dow:n};if(t===0)return{y:1900,m:1,d:0,dow:n};let r=new Date(Xr+(t<60?t+1:t)*Yr);return{y:r.getUTCFullYear(),m:r.getUTCMonth()+1,d:r.getUTCDate(),dow:n}}function ii(e){return Math.round((e-Math.floor(e))*86400)%86400}function ai(e,t){return new Date(ti(e,t+1,0)).getUTCDate()}function oi(e){return ni(e.getFullYear(),e.getMonth()+1,e.getDate())+(e.getHours()*3600+e.getMinutes()*60+e.getSeconds()+e.getMilliseconds()/1e3)/86400}var si=/^(\d{1,4}):(\d{1,2})(?::(\d{1,2}(?:\.\d+)?))?\s*([ap]m?)?$/i,ci=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[T\s]+(.+))?$/i,li=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4}|\d{2})(?:\s+(.+))?$/;function ui(e){let t=si.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=t[3]?Number(t[3]):0;if(r>59||i>=60)return null;if(t[4]){if(n<1||n>12)return null;let e=t[4][0].toLowerCase()===`p`;n=n%12+(e?12:0)}return(n*3600+r*60+i)/86400}function di(e,t,n){if(t<1||t>12||n<1||n>ai(e,t))return null;let r=ni(e,t,n);return r<0?null:r}function fi(e){let t=ci.exec(e),n=null,r;if(t)n=di(Number(t[1]),Number(t[2]),Number(t[3])),r=t[4];else if(t=li.exec(e)){let e=Number(t[3]);t[3].length===2&&(e+=e<30?2e3:1900),n=di(e,Number(t[1]),Number(t[2])),r=t[4]}else return ui(e);if(n===null)return null;if(r===void 0)return n;let i=ui(r);return i===null?null:n+i}var pi=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],mi=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function hi(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];a===`\\`&&!r?(n+=a+(e[i+1]??``),i++):(a===`"`&&(r=!r),a===`;`&&!r?(t.push(n),n=``):n+=a)}return t.push(n),t}function gi(e){return e.replace(/"[^"]*"/g,``).replace(/\\./g,``).replace(/\[[^\]]*\]/g,``).replace(/[_*]./g,``)}function _i(e){return/[ymdhs]/i.test(gi(e))||/\[(h+|m+|s+)\]/i.test(e)}function vi(e,t){let n=[];for(let e=0;e<t.length;){let r=t[e],i=r.toLowerCase();if(r===`"`){let r=t.indexOf(`"`,e+1),i=r<0?t.length:r;n.push({k:`lit`,v:t.slice(e+1,i)}),e=i+1}else if(r===`\\`)n.push({k:`lit`,v:t[e+1]??``}),e+=2;else if(r===`_`)n.push({k:`lit`,v:` `}),e+=2;else if(r===`*`)e+=2;else if(r===`[`){let r=t.indexOf(`]`,e),i=t.slice(e+1,r<0?t.length:r).toLowerCase();/^h+$/.test(i)?n.push({k:`H`,n:i.length}):/^m+$/.test(i)?n.push({k:`N`,n:i.length}):/^s+$/.test(i)&&n.push({k:`S`,n:i.length}),e=r<0?t.length:r+1}else if(t.slice(e,e+5).toUpperCase()===`AM/PM`)n.push({k:`ap`,v:t.slice(e,e+5)}),e+=5;else if(t.slice(e,e+3).toUpperCase()===`A/P`)n.push({k:`ap`,v:t.slice(e,e+3)}),e+=3;else if(`ymdhs`.includes(i)){let r=e;for(;r<t.length&&t[r].toLowerCase()===i;)r++;n.push({k:i===`m`?`M`:i,n:r-e}),e=r}else n.push({k:`lit`,v:r}),e++}let r=n.filter(e=>e.k!==`lit`);r.forEach((e,t)=>{if(e.k!==`M`||e.n>2)return;let n=r[t-1],i=r[t+1];(n&&(n.k===`h`||n.k===`H`)||i&&(i.k===`s`||i.k===`S`))&&(e.k=`m`)});let i=n.some(e=>e.k===`ap`),a=Math.floor(e),o=Math.round((e-a)*86400);o>=86400&&(a++,o-=86400);let s=ri(a),c=Math.floor(o/3600),l=Math.floor(o%3600/60),u=o%60,d=(e,t)=>String(e).padStart(t,`0`),f=``;for(let e of n)switch(e.k){case`lit`:f+=e.v;break;case`y`:f+=e.n<=2?d(s.y%100,2):d(s.y,4);break;case`M`:f+=e.n===1?s.m:e.n===2?d(s.m,2):e.n===3?pi[s.m-1].slice(0,3):e.n===4?pi[s.m-1]:pi[s.m-1][0];break;case`d`:f+=e.n===1?s.d:e.n===2?d(s.d,2):e.n===3?mi[s.dow].slice(0,3):mi[s.dow];break;case`h`:{let t=i?c%12||12:c;f+=e.n>=2?d(t,2):t;break}case`m`:f+=e.n>=2?d(l,2):l;break;case`s`:f+=e.n>=2?d(u,2):u;break;case`H`:f+=d(a*24+c,e.n);break;case`N`:f+=d((a*24+c)*60+l,e.n);break;case`S`:f+=d(((a*24+c)*60+l)*60+u,e.n);break;case`ap`:{let t=c<12,n=e.v.length===5?t?e.v.slice(0,2):e.v.slice(3,5):t?e.v[0]:e.v[2];f+=n;break}}return f}var yi=class{constructor(e,t,n,r,i){A(this,`sheet`,void 0),A(this,`r0`,void 0),A(this,`c0`,void 0),A(this,`r1`,void 0),A(this,`c1`,void 0),this.sheet=e,this.r0=t,this.c0=n,this.r1=r,this.c1=i}get h(){return this.r1-this.r0+1}get w(){return this.c1-this.c0+1}},bi=class{constructor(e){A(this,`data`,void 0),this.data=e}get h(){return this.data.length}get w(){return this.data[0]?.length??0}},xi=class{constructor(e){A(this,`areas`,void 0),this.areas=e}},Si=/^([+-])?\s*\$?\s*((?:\d{1,3}(?:,\d{3})+|\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*(%?)$/;function Ci(e){let t=e.trim();if(!t)return null;let n=Si.exec(t);if(n&&/\d/.test(n[2])){let e=Number(n[2].replace(/,/g,``));if(!Number.isNaN(e))return(n[1]===`-`?-e:e)/(n[3]?100:1)}return fi(t)}function wi(e){if(!Number.isFinite(e))return`#NUM!`;if(e===0)return`0`;let[t,n]=Math.abs(e).toExponential(14).split(`e`),r=Number(n),i=t.replace(`.`,``).replace(/0+$/,``),a=e<0?`-`:``;if(r>=15||r<-9)return`${a}${i[0]+(i.length>1?`.${i.slice(1)}`:``)}E${r<0?`-`:`+`}${String(Math.abs(r)).padStart(2,`0`)}`;if(r<0)return`${a}0.${`0`.repeat(-r-1)}${i}`;let o=i.slice(0,r+1).padEnd(r+1,`0`),s=i.slice(r+1);return a+o+(s?`.${s}`:``)}function Ti(e){if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e==`boolean`)return+!!e;if(typeof e==`string`){let t=Ci(e);return t===null?W.VALUE:t}return e}function Ei(e){return typeof e==`string`?e:typeof e==`number`?wi(e):e===null?``:typeof e==`boolean`?e?`TRUE`:`FALSE`:e}function Di(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e!==0;if(e===null)return!1;if(typeof e==`string`){let t=e.toUpperCase();return t===`TRUE`||t!==`FALSE`&&W.VALUE}return e}function G(e){let t=Ti(e);if(t instanceof U)throw t;return t}function Oi(e){return Math.trunc(G(e))}function ki(e){let t=Ei(e);if(t instanceof U)throw t;return t}function Ai(e){let t=Di(e);if(t instanceof U)throw t;return t}function ji(e,t){return e===t||Math.abs(e-t)<=Math.max(Math.abs(e),Math.abs(t))*1e-15}var Mi=e=>typeof e==`number`?0:typeof e==`string`?1:2;function Ni(e,t){if(e===null&&(e=typeof t==`string`?``:typeof t!=`boolean`&&0),t===null&&(t=typeof e==`string`?``:typeof e!=`boolean`&&0),e instanceof U||t instanceof U)return 0;let n=Mi(e),r=Mi(t);if(n!==r)return n<r?-1:1;if(typeof e==`number`){let n=t;return ji(e,n)?0:e<n?-1:1}if(typeof e==`string`){let n=e.toLowerCase(),r=t.toLowerCase();return n<r?-1:+(n>r)}return!!e-+!!t}function Pi(e,t){return e===null||t===null?e===t:e instanceof U||t instanceof U?!1:typeof e==typeof t&&Ni(e,t)===0}var Fi=e=>/[*?~]/.test(e);function Ii(e,t=!0){let n=``;for(let t=0;t<e.length;t++){let r=e[t];r===`~`&&t+1<e.length&&`*?~`.includes(e[t+1])?n+=`\\${e[++t]}`:n+=r===`*`?`[\\s\\S]*`:r===`?`?`[\\s\\S]`:r.replace(/[.*+?^${}()|[\]\\/]/g,`\\$&`)}return new RegExp(t?`^${n}$`:n,`i`)}function Li(e,t){switch(e){case`<`:return t<0;case`<=`:return t<=0;case`>`:return t>0;case`>=`:return t>=0;case`<>`:return t!==0;default:return t===0}}var Ri=e=>_r.find(t=>t===e.toUpperCase());function zi(e){if(e instanceof U){let t=e.code;return e=>e instanceof U&&e.code===t}if(e===null&&(e=0),typeof e==`number`){let t=e;return e=>typeof e==`number`&&ji(e,t)||typeof e==`string`&&Ci(e)===t}if(typeof e==`boolean`){let t=e;return e=>e===t}let t=/^(<=|>=|<>|<|>|=)?([\s\S]*)$/.exec(e),n=t[1]??``,r=t[2],i=n===``||n===`=`;if(r===``)return n===``?e=>e===null||e===``:n===`=`?e=>e===null:n===`<>`?e=>e!==null&&e!==``:()=>!1;let a=Ci(r);if(a!==null)return i?e=>typeof e==`number`&&ji(e,a)||typeof e==`string`&&Ci(e)===a:n===`<>`?e=>!(typeof e==`number`&&ji(e,a)):e=>typeof e==`number`&&Li(n,Ni(e,a));let o=r.toUpperCase();if(o===`TRUE`||o===`FALSE`){let e=o===`TRUE`;return i?t=>t===e:n===`<>`?t=>t!==e:t=>typeof t==`boolean`&&Li(n,Ni(t,e))}let s=Ri(r);if(s){let e=e=>e instanceof U&&e.code===s;return n===`<>`?t=>!e(t):t=>e(t)}if(i||n===`<>`){let e=Ii(r),t=t=>typeof t==`string`&&e.test(t);return n===`<>`?e=>!t(e):t}return e=>typeof e==`string`&&Li(n,Ni(e,r))}var K=1/0;function Bi(e){try{return e()}catch(e){if(e instanceof U)return e;throw e}}function Vi(e,t,n){let r=e.length===1?0:t,i=e[0].length===1?0:n;return r<e.length&&i<e[0].length?e[r][i]:W.NA}function q(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!0,fn:(e,t,r)=>{let i=1,a=1,o=!1,s=e.map(e=>{if(e instanceof yi){if(e.h===1&&e.w===1)return t.cell(e.sheet,e.r0,e.c0);if(r)return t.scalar(e)}else if(e instanceof bi){if(e.h===1&&e.w===1)return e.data[0][0]}else if(e instanceof xi)return W.VALUE;else return e;let n=t.toArray(e);return o=!0,i=Math.max(i,n.length),a=Math.max(a,n[0].length),n});if(!o)return Bi(()=>n(s,t));let c=[];for(let e=0;e<i;e++){let r=[];for(let i=0;i<a;i++){let a=s.map(t=>Array.isArray(t)?Vi(t,e,i):t);r.push(Bi(()=>n(a,t)))}c.push(r)}return new bi(c)}}}function J(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!1,fn:n}}function Hi(e,t,n){return{kind:`lazy`,min:e,max:t,fn:n}}function Ui(e,t,n,r){if(e instanceof yi)t.forEach(e,n);else if(e instanceof xi)for(let r of e.areas)t.forEach(r,n);else if(e instanceof bi)for(let t of e.data)for(let e of t)n(e);else r(e)}function Wi(e,t,n){for(let r of e)Ui(r,t,e=>{if(typeof e==`number`)n(e);else if(e instanceof U)throw e},e=>{let t=Ti(e);if(t instanceof U)throw t;n(t)})}function Gi(e,t){let n=[];return Wi(e,t,e=>n.push(e)),n}function Ki(e){return e.length===1?e[0]:e.flat()}function qi(e,t,n){if(e.length<=t)return n;let r=Ti(e[t]);if(r instanceof U)throw r;return r}function Ji(e){let t=G(e);if(t<0)throw W.NUM;return t}var Yi=e=>Math.floor(Ji(e));function Xi(e,t,n){let r=ri(e),i=r.y*12+(r.m-1)+Math.trunc(t),a=Math.floor(i/12),o=i%12+1,s=ni(a,o,n?ai(a,o):Math.min(r.d,ai(a,o)));if(s<0)throw W.NUM;return s}var Zi={1:[0,1],2:[1,1],3:[1,0],11:[1,1],12:[2,1],13:[3,1],14:[4,1],15:[5,1],16:[6,1],17:[0,1]};function Qi(e,t,n){if(e>t)throw W.NUM;let r=ri(e),i=ri(t),a=(i.y-r.y)*12+(i.m-r.m)-+(i.d<r.d);switch(n.toUpperCase()){case`D`:return t-e;case`M`:return a;case`Y`:return Math.floor(a/12);case`YM`:return a%12;case`MD`:{if(i.d>=r.d)return i.d-r.d;let e=i.m===1?12:i.m-1;return ai(i.m===1?i.y-1:i.y,e)-r.d+i.d}case`YD`:{let e=ni(i.y,r.m,Math.min(r.d,ai(i.y,r.m)));return e>t&&(e=ni(i.y-1,r.m,Math.min(r.d,ai(i.y-1,r.m)))),t-e}}throw W.NUM}function $i(e,t,n){let r=e<=t?1:-1,[i,a]=e<=t?[e,t]:[t,e],o=0;for(let e=i;e<=a;e++){let t=ri(e).dow;t!==0&&t!==6&&!n.has(e)&&o++}return r*o}var ea={TODAY:J(0,0,(e,t)=>Math.floor(oi(t.now()))),NOW:J(0,0,(e,t)=>oi(t.now())),DATE:q(3,3,([e,t,n])=>{let r=Math.trunc(G(e));if(r>=0&&r<1900&&(r+=1900),r<0||r>9999)throw W.NUM;let i=ni(r,Math.trunc(G(t)),Math.trunc(G(n)));if(i<0)throw W.NUM;return i}),TIME:q(3,3,([e,t,n])=>{let r=Math.trunc(G(e))*3600+Math.trunc(G(t))*60+Math.trunc(G(n));if(r<0)throw W.NUM;return r%86400/86400}),YEAR:q(1,1,([e])=>ri(Yi(e)).y),MONTH:q(1,1,([e])=>ri(Yi(e)).m),DAY:q(1,1,([e])=>ri(Yi(e)).d),HOUR:q(1,1,([e])=>Math.floor(ii(Ji(e))/3600)),MINUTE:q(1,1,([e])=>Math.floor(ii(Ji(e))%3600/60)),SECOND:q(1,1,([e])=>ii(Ji(e))%60),WEEKDAY:q(1,2,e=>{let t=ri(Yi(e[0])).dow,n=Zi[Math.trunc(qi(e,1,1))];if(!n)throw W.NUM;return(t-n[0]+7)%7+n[1]}),EDATE:q(2,2,([e,t])=>Xi(Yi(e),G(t),!1)),EOMONTH:q(2,2,([e,t])=>Xi(Yi(e),G(t),!0)),DATEDIF:q(3,3,([e,t,n])=>Qi(Yi(e),Yi(t),ki(n))),DAYS:q(2,2,([e,t])=>Math.floor(G(e))-Math.floor(G(t))),NETWORKDAYS:J(2,3,(e,t)=>{let n=new Set(e.length>2?Gi([e[2]],t).map(Math.floor):[]);return $i(Yi(t.scalar(e[0])),Yi(t.scalar(e[1])),n)})},ta=(e,t,n)=>e.type===`missing`?0:t.eval(e,n);function na(e,t){let n=[];for(let r of e)Ui(r,t,e=>{if(typeof e==`boolean`)n.push(e);else if(typeof e==`number`)n.push(e!==0);else if(e instanceof U)throw e},e=>n.push(Ai(e)));if(!n.length)throw W.VALUE;return n}var ra=Hi(2,3,(e,t,n)=>{let r=t.operand(t.eval(e[0],n),n),i=e[1],a=e[2];if(!Array.isArray(r)){let e=Di(r);return e instanceof U?e:e?ta(i,t,n):a?ta(a,t,n):!1}let o=t.operand(ta(i,t,!1),!1),s=a?t.operand(ta(a,t,!1),!1):!1;return new bi(r.map((e,t)=>e.map((e,n)=>{let r=Di(e);if(r instanceof U)return r;let i=r?o:s;return Array.isArray(i)?Vi(i,t,n):i})))});function ia(e){return Hi(2,2,(t,n,r)=>{let i=n.eval(t[0],r),a=n.operand(i,r),o=t=>t instanceof U&&(!e||t.code===`#N/A`);if(Array.isArray(a)){if(!a.some(e=>e.some(o)))return i;let e=n.scalar(ta(t[1],n,!1));return new bi(a.map(t=>t.map(t=>o(t)?e:t)))}return o(a)?ta(t[1],n,r):a})}var aa={IF:ra,IFS:Hi(2,K,(e,t,n)=>{if(e.length%2)return W.VALUE;for(let r=0;r<e.length;r+=2){let i=t.scalar(t.eval(e[r],n));if(i instanceof U)return i;if(Ai(i))return ta(e[r+1],t,n)}return W.NA}),IFERROR:ia(!1),IFNA:ia(!0),AND:J(1,K,(e,t)=>na(e,t).every(Boolean)),OR:J(1,K,(e,t)=>na(e,t).some(Boolean)),XOR:J(1,K,(e,t)=>na(e,t).filter(Boolean).length%2==1),NOT:q(1,1,([e])=>!Ai(e)),TRUE:J(0,0,()=>!0),FALSE:J(0,0,()=>!1),SWITCH:Hi(3,K,(e,t,n)=>{let r=t.scalar(t.eval(e[0],n));if(r instanceof U)return r;let i=1;for(;i+1<e.length;i+=2){let a=t.scalar(ta(e[i],t,n));if(a instanceof U)return a;if(Pi(r,a)||r===null&&Ni(r,a)===0)return ta(e[i+1],t,n)}return i<e.length?ta(e[i],t,n):W.NA}),CHOOSE:Hi(2,K,(e,t,n)=>{let r=Oi(t.scalar(t.eval(e[0],n)));return r<1||r>=e.length?W.VALUE:ta(e[r],t,n)}),ISBLANK:q(1,1,([e])=>e===null),ISNUMBER:q(1,1,([e])=>typeof e==`number`),ISTEXT:q(1,1,([e])=>typeof e==`string`),ISNONTEXT:q(1,1,([e])=>typeof e!=`string`),ISLOGICAL:q(1,1,([e])=>typeof e==`boolean`),ISERROR:q(1,1,([e])=>e instanceof U),ISERR:q(1,1,([e])=>e instanceof U&&e.code!==`#N/A`),ISNA:q(1,1,([e])=>e instanceof U&&e.code===`#N/A`),ISEVEN:q(1,1,([e])=>Math.trunc(G(e))%2==0),ISODD:q(1,1,([e])=>Math.abs(Math.trunc(G(e)))%2==1),NA:J(0,0,()=>W.NA),"ERROR.TYPE":q(1,1,([e])=>e instanceof U?_r.indexOf(e.code)+1:W.NA),N:q(1,1,([e])=>e instanceof U||typeof e==`number`?e:typeof e==`boolean`?+!!e:0),T:q(1,1,([e])=>e instanceof U||typeof e==`string`?e:``)};function oa(e,t,n){if(n&&typeof t==`string`&&Fi(t)){let n=Ii(t);return e.findIndex(e=>typeof e==`string`&&n.test(e))}return e.findIndex(e=>Pi(e,t))}function sa(e,t,n){let r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===null||a instanceof U||typeof a!=typeof t)continue;let o=Ni(a,t);if(n===1?o<=0:o>=0)r=i;else break}return r}function ca(e,t){let n=t.scalar(e);if(n instanceof U)throw n;return n}function la(e,t){if(e instanceof xi)throw W.VALUE;return t.toArray(e)}function ua(e,t,n){let r=ca(e[0],t),i=la(e[1],t),a=Oi(t.scalar(e[2])),o=e.length>3?Ai(t.scalar(e[3])):!0,s=n?i[0].length:i.length;if(a<1)throw W.VALUE;if(a>s)throw W.REF;let c=n?i.map(e=>e[0]):i[0],l=o?sa(c,r,1):oa(c,r,!0);if(l<0)throw W.NA;return n?i[l][a-1]:i[a-1][l]}function da(e,t){let n=ca(e[0],t),r=la(e[1],t);if(r.length>1&&r[0].length>1)throw W.NA;let i=Ki(r),a=e.length>2?Math.sign(G(t.scalar(e[2]))):1,o=a===0?oa(i,n,!0):sa(i,n,a);if(o<0)throw W.NA;return o+1}function fa(e,t,n,r){if(e instanceof yi)return r?new yi(e.sheet,e.r0+n,e.c0,e.r0+n,e.c1):new yi(e.sheet,e.r0,e.c0+n,e.r1,e.c0+n);let i=r?[t[n]]:t.map(e=>[e[n]]);return i[0].length===1&&i.length===1?i[0][0]:new bi(i)}function pa(e,t){let n=ca(e[0],t),r=la(e[1],t),i=la(e[2],t),a=r[0].length===1;if(!a&&r.length!==1||(a?i.length!==r.length:i[0].length!==r[0].length))throw W.VALUE;let o=e.length>3&&e[3]!==null?e[3]:void 0,s=e.length>4?Oi(t.scalar(e[4])):0,c=e.length>5?Oi(t.scalar(e[5])):1,l=Ki(r),u=c<0;u&&(l=[...l].reverse());let d=-1;if(s===0||s===2)d=oa(l,n,s===2);else if(s===1||s===-1){if(d=oa(l,n,!1),d<0){let e=null;for(let t=0;t<l.length;t++){let r=l[t];if(r===null||r instanceof U||typeof r!=typeof n)continue;let i=Ni(r,n);(s===1?i>0&&(e===null||Ni(r,e)<0):i<0&&(e===null||Ni(r,e)>0))&&(e=r,d=t)}}}else throw W.VALUE;if(d<0){if(o!==void 0)return o;throw W.NA}return u&&(d=l.length-1-d),fa(e[2],i,d,a)}function ma(e,t){let n=ca(e[0],t),r=la(e[1],t),i,a;e.length>2?(i=Ki(r),a=Ki(la(e[2],t))):r[0].length>r.length?(i=r[0],a=r[r.length-1]):(i=r.map(e=>e[0]),a=r.map(e=>e[e.length-1]));let o=sa(i,n,1);if(o<0||o>=a.length)throw W.NA;return a[o]}function ha(e,t){let n=e[0];if(n instanceof xi){let r=e.length>3?Oi(t.scalar(e[3])):1;if(r<1||r>n.areas.length)throw W.REF;n=n.areas[r-1]}let r=n instanceof yi||n instanceof bi?n.h:1,i=n instanceof yi||n instanceof bi?n.w:1,a=Oi(t.scalar(e[1])),o;if(e.length>2?o=Oi(t.scalar(e[2])):r===1?[a,o]=[1,a]:o=+(i===1),a<0||o<0||a>r||o>i)throw W.REF;if(n instanceof yi){let[e,t]=a?[n.r0+a-1,n.r0+a-1]:[n.r0,n.r1],[r,i]=o?[n.c0+o-1,n.c0+o-1]:[n.c0,n.c1];return new yi(n.sheet,e,r,t,i)}if(n instanceof bi){let e=(a?[n.data[a-1]]:n.data).map(e=>o?[e[o-1]]:e);return e.length===1&&e[0].length===1?e[0][0]:new bi(e)}return n}function ga(e,t){let n=e[0];if(!(n instanceof yi))throw W.VALUE;let r=Oi(t.scalar(e[1])),i=Oi(t.scalar(e[2])),a=e.length>3&&e[3]!==null?Oi(t.scalar(e[3])):n.h,o=e.length>4&&e[4]!==null?Oi(t.scalar(e[4])):n.w;if(a===0||o===0)throw W.REF;let s=n.r0+r,c=n.c0+i,l=s+a-1,u=c+o-1;if(a<0&&([s,l]=[s+a+1,s]),o<0&&([c,u]=[c+o+1,c]),s<0||c<0||l>1048575||u>16383)throw W.REF;return new yi(n.sheet,s,c,l,u)}function _a(e,t){let n=/^(?:(?:'((?:[^']|'')+)'|([^'!]+))!)?(R(\[-?\d+\]|\d*)C(\[-?\d+\]|\d*))(?::(R(\[-?\d+\]|\d*)C(\[-?\d+\]|\d*)))?$/i.exec(e.trim());if(!n)return null;let r=(e,t)=>e===``?t:e[0]===`[`?t+Number(e.slice(1,-1)):Number(e)-1,i=r(n[4],t.r),a=r(n[5],t.c),o=n[6]?r(n[7],t.r):i,s=n[6]?r(n[8],t.c):a;return{sheet:n[1]===void 0?n[2]:n[1].replace(/''/g,`'`),kind:`area`,r0:Math.min(i,o),c0:Math.min(a,s),r1:Math.max(i,o),c1:Math.max(a,s),ar0:!0,ac0:!0,ar1:!0,ac1:!0}}function va(e,t){let n=ki(t.scalar(e[0])),r=!(e.length>1)||Ai(t.scalar(e[1]))?Gr(n):_a(n,t);if(!r||r.r0<0||r.c0<0||r.r1>1048575||r.c1>16383||r.sheet!==void 0&&!t.hasSheet(r.sheet))throw W.REF;return new yi(r.sheet??t.sheet,r.r0,r.c0,r.r1,r.c1)}function ya(e,t,n,r){if(!e.length||e[0]===null)return(r?t.r:t.c)+1;let i=e[0];if(!(i instanceof yi))throw W.VALUE;let a=r?i.r0:i.c0,o=r?i.h:i.w;if(o===1||n)return a+1;let s=Array.from({length:o},(e,t)=>a+t+1);return new bi(r?s.map(e=>[e]):[s])}function ba(e,t){if(e instanceof yi||e instanceof bi)return t?e.h:e.w;if(e instanceof xi)throw W.REF;if(e instanceof U)throw e;return 1}var xa={VLOOKUP:J(3,4,(e,t)=>ua(e,t,!0)),HLOOKUP:J(3,4,(e,t)=>ua(e,t,!1)),XLOOKUP:J(3,6,pa),MATCH:J(2,3,da),LOOKUP:J(2,3,ma),INDEX:J(2,4,ha),OFFSET:J(3,5,ga),INDIRECT:J(1,2,va),ROW:J(0,1,(e,t,n)=>ya(e,t,n,!0)),COLUMN:J(0,1,(e,t,n)=>ya(e,t,n,!1)),ROWS:J(1,1,([e])=>ba(e,!0)),COLUMNS:J(1,1,([e])=>ba(e,!1))};function Sa(e,t){if(t>15)return e;let n=10**Math.abs(t),r=Math.abs(e),i=t>=0?r*n:r/n;i=Math.floor(Number(i.toPrecision(15))+.5);let a=t>=0?i/n:i*n;return e<0?-a:a}function Ca(e,t,n){let r=``,i=``,a=``,o=0,s=e=>{a?i+=e:r+=e};for(let e=0;e<t.length;e++){let n=t[e];if(n===`"`){let n=t.indexOf(`"`,e+1),r=n<0?t.length:n;s(t.slice(e+1,r)),e=r}else if(n===`\\`)s(t[++e]??``);else if(n===`_`)s(` `),e++;else if(n===`*`)e++;else if(n===`[`){let n=t.indexOf(`]`,e);e=n<0?t.length:n}else`0#?`.includes(n)||(n===`.`||n===`,`)&&!i?a+=n:(n===`%`&&o++,s(n))}let c=a,l=e*100**o;for(;c.endsWith(`,`);)c=c.slice(0,-1),l/=1e3;let u=c.indexOf(`.`),d=u<0?c:c.slice(0,u),f=u<0?``:c.slice(u+1),p=(f.match(/[0#?]/g)??[]).length,m=(f.match(/[0?]/g)??[]).length,h=(d.match(/[0?]/g)??[]).length,g=Sa(Math.abs(l),p),[_,v=``]=g.toFixed(p).split(`.`);for(_===`0`&&h===0&&(_=``),_=_.padStart(h,`0`),d.includes(`,`)&&(_=_.replace(/\B(?=(\d{3})+(?!\d))/g,`,`));v.length>m&&v.endsWith(`0`);)v=v.slice(0,-1);let y=c===``?``:_+(u>=0?`.${v}`:``);return(n&&l<0&&g!==0?`-`:``)+r+y+i}function wa(e,t){if(e instanceof U)throw e;if(typeof e==`boolean`)return e?`TRUE`:`FALSE`;let n,r=hi(t);if(typeof e==`string`){let t=Ci(e);if(t===null){let t=r.length>3?r[3]:r.find(e=>e.includes(`@`));return t===void 0?e:t.replace(/"([^"]*)"/g,`$1`).replace(/@/g,e)}n=t}else n=e??0;let i=r[0],a=!0;if(n<0&&r.length>1&&r[1]!==``?(i=r[1],a=!1):n===0&&r.length>2&&r[2]!==``&&(i=r[2]),/^\s*general\s*$/i.test(i)||i===``)return wi(a?n:Math.abs(n));if(_i(i)){if(n<0)throw W.VALUE;return vi(n,i)}return Ca(a?n:Math.abs(n),i,a)}var Ta=e=>Number(e.toPrecision(15));function Ea(e,t,n){if(t>15)return e;let r=10**Math.abs(t),i=Math.abs(e),a=Ta(t>=0?i*r:i/r);a=n?Math.ceil(a):Math.floor(a);let o=t>=0?a/r:a*r;return e<0?-o:o}function Da(e){if(!Number.isFinite(e))throw W.NUM;return e}var Oa=(e,t,n)=>Ta((n?Math.ceil:Math.floor)(Ta(e/t))*t);function ka(e,t){for(;t;)[e,t]=[t,e%t];return e}function Aa(e,t){return Gi(e,t).map(e=>{if(e<0)throw W.NUM;return Math.trunc(e)})}var ja={ABS:q(1,1,([e])=>Math.abs(G(e))),ROUND:q(2,2,([e,t])=>Sa(G(e),Oi(t))),ROUNDUP:q(2,2,([e,t])=>Ea(G(e),Oi(t),!0)),ROUNDDOWN:q(2,2,([e,t])=>Ea(G(e),Oi(t),!1)),TRUNC:q(1,2,e=>Ea(G(e[0]),Math.trunc(qi(e,1,0)),!1)),INT:q(1,1,([e])=>Math.floor(G(e))),MOD:q(2,2,([e,t])=>{let n=G(e),r=G(t);if(r===0)throw W.DIV0;return Ta(n-r*Math.floor(n/r))}),POWER:q(2,2,([e,t])=>{let n=G(e),r=G(t);if(n===0&&r===0)throw W.NUM;if(n===0&&r<0)throw W.DIV0;let i=n**+r;if(Number.isNaN(i))throw W.NUM;return Da(i)}),SQRT:q(1,1,([e])=>{let t=G(e);if(t<0)throw W.NUM;return Math.sqrt(t)}),EXP:q(1,1,([e])=>Da(Math.exp(G(e)))),LN:q(1,1,([e])=>{let t=G(e);if(t<=0)throw W.NUM;return Math.log(t)}),LOG:q(1,2,e=>{let t=G(e[0]),n=qi(e,1,10);if(t<=0||n<=0)throw W.NUM;if(n===1)throw W.DIV0;return Ta(Math.log(t)/Math.log(n))}),LOG10:q(1,1,([e])=>{let t=G(e);if(t<=0)throw W.NUM;return Math.log10(t)}),PI:J(0,0,()=>Math.PI),SIGN:q(1,1,([e])=>Math.sign(G(e))),CEILING:q(1,2,e=>{let t=G(e[0]),n=qi(e,1,1);if(n===0||t===0)return 0;if(t>0&&n<0)throw W.NUM;return Oa(t,n,!0)}),FLOOR:q(1,2,e=>{let t=G(e[0]),n=qi(e,1,1);if(n===0)throw W.DIV0;if(t>0&&n<0)throw W.NUM;return Oa(t,n,!1)}),"CEILING.MATH":q(1,3,e=>{let t=G(e[0]),n=Math.abs(qi(e,1,1));return n===0||t===0?0:t<0&&qi(e,2,0)!==0?-Oa(-t,n,!0):Oa(t,n,!0)}),"FLOOR.MATH":q(1,3,e=>{let t=G(e[0]),n=Math.abs(qi(e,1,1));return n===0||t===0?0:t<0&&qi(e,2,0)!==0?-Oa(-t,n,!1):Oa(t,n,!1)}),RAND:J(0,0,()=>Math.random()),RANDBETWEEN:q(2,2,([e,t])=>{let n=Math.ceil(G(e)),r=Math.floor(G(t));if(n>r)throw W.NUM;return n+Math.floor(Math.random()*(r-n+1))}),FACT:q(1,1,([e])=>{let t=Math.trunc(G(e));if(t<0)throw W.NUM;let n=1;for(let e=2;e<=t;e++)n*=e;return Da(n)}),EVEN:q(1,1,([e])=>{let t=G(e),n=Math.ceil(Ta(Math.abs(t)/2))*2;return t<0?-n:n}),ODD:q(1,1,([e])=>{let t=G(e),n=Math.ceil(Ta(Math.abs(t)));return n%2==0&&n++,t<0?-n:n}),GCD:J(1,K,(e,t)=>Aa(e,t).reduce((e,t)=>ka(e,t),0)),LCM:J(1,K,(e,t)=>Da(Aa(e,t).reduce((e,t)=>e===0||t===0?0:e/ka(e,t)*t,1)))};function Ma(e){let t=0;for(let n of e)t+=n;return t}function Na(e){if(!e.length)throw W.DIV0;return Ma(e)/e.length}function Pa(e,t){let n=e.length;if(n<(t?2:1))throw W.DIV0;let r=Ma(e)/n,i=0;for(let t of e)i+=(t-r)*(t-r);return i/(t?n-1:n)}function Fa(e){if(!e.length)throw W.NUM;let t=[...e].sort((e,t)=>e-t),n=t.length>>1;return t.length%2?t[n]:(t[n-1]+t[n])/2}function Ia(e){let t=new Map,n=0,r=1;for(let i of e){let e=(t.get(i)??0)+1;t.set(i,e),e>r&&(n=i,r=e)}if(r<2)throw W.NA;for(let n of e)if(t.get(n)===r)return n;return n}function La(e,t){return Gi([e],t)}function Ra(e,t,n){let r=La(e[0],t),i=Math.ceil(G(t.scalar(e[1])));if(i<1||i>r.length)throw W.NUM;return r.sort((e,t)=>n?t-e:e-t),r[i-1]}function za(e,t){let n=G(t.scalar(e[0])),r=La(e[1],t),i=e.length>2&&G(t.scalar(e[2]))!==0;if(!r.includes(n))throw W.NA;let a=1;for(let e of r)(i?e<n:e>n)&&a++;return a}function Ba(e,t){if(e instanceof xi)throw W.VALUE;return t.toArray(e)}function Va(e,t,n,r){return e instanceof yi?r.toArray(new yi(e.sheet,e.r0,e.c0,e.r0+t-1,e.c0+n-1)):Ba(e,r)}function Ha(e,t,n,r){let i=[],a=[];for(let e=0;e<t.length;e+=2)i.push(e===0&&r?r:Ba(t[e],n)),a.push(zi(n.scalar(t[e+1])));let o=i[0].length,s=i[0][0].length;for(let e of i)if(e.length!==o||e[0].length!==s)throw W.VALUE;if(e&&(e.length!==o||e[0].length!==s))throw W.VALUE;let c=[];for(let t=0;t<o;t++)for(let n=0;n<s;n++){let r=!0;for(let e=0;r&&e<i.length;e++)r=a[e](i[e][t][n]);r&&c.push(!e||e[t][n])}return c}function Ua(e){let t=[];for(let n of e)if(typeof n==`number`)t.push(n);else if(n instanceof U)throw n;return t}function Wa(e,t){let n=Ba(e[0],t);return Ua(Ha(e.length>2&&e[2]!==null?Va(e[2],n.length,n[0].length,t):n,[e[0],e[1]],t,n))}function Ga(e,t){if(e.length%2==0)throw W.VALUE;return Ua(Ha(Ba(e[0],t),e.slice(1),t))}function Ka(e,t){let n=e.map(e=>Ba(e,t)),r=n[0].length,i=n[0][0].length;for(let e of n)if(e.length!==r||e[0].length!==i)throw W.VALUE;let a=0;for(let e=0;e<r;e++)for(let t=0;t<i;t++){let r=1;for(let i of n){let n=i[e][t];if(n instanceof U)throw n;r*=typeof n==`number`?n:0}a+=r}return a}function qa(e,t){if(!e.length)return 0;let n=e[0];for(let r of e)(t?r>n:r<n)&&(n=r);return n}var Ja={SUM:J(0,K,(e,t)=>{let n=0;return Wi(e,t,e=>n+=e),n}),PRODUCT:J(0,K,(e,t)=>{let n=Gi(e,t);return n.length?n.reduce((e,t)=>e*t,1):0}),AVERAGE:J(1,K,(e,t)=>Na(Gi(e,t))),MIN:J(1,K,(e,t)=>{let n=K;return Wi(e,t,e=>n=Math.min(n,e)),n===K?0:n}),MAX:J(1,K,(e,t)=>{let n=-K;return Wi(e,t,e=>n=Math.max(n,e)),n===-K?0:n}),COUNT:J(0,K,(e,t)=>{let n=0;for(let r of e)Ui(r,t,e=>typeof e==`number`&&n++,e=>(typeof e==`number`||typeof e==`boolean`||typeof e==`string`&&Ci(e)!==null)&&n++);return n}),COUNTA:J(1,K,(e,t)=>{let n=0;for(let r of e)Ui(r,t,e=>e!==null&&n++,()=>n++);return n}),COUNTBLANK:J(1,1,([e],t)=>{if(e instanceof yi){let n=0,r=0;return t.forEach(e,e=>{n++,(e===null||e===``)&&r++}),r+(e.h*e.w-n)}if(e instanceof bi)return Ki(e.data).filter(e=>e===null||e===``).length;throw W.VALUE}),MEDIAN:J(1,K,(e,t)=>Fa(Gi(e,t))),MODE:J(1,K,(e,t)=>Ia(Gi(e,t))),"MODE.SNGL":J(1,K,(e,t)=>Ia(Gi(e,t))),STDEV:J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!0))),"STDEV.S":J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!0))),"STDEV.P":J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!1))),STDEVP:J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!1))),VAR:J(1,K,(e,t)=>Pa(Gi(e,t),!0)),"VAR.S":J(1,K,(e,t)=>Pa(Gi(e,t),!0)),"VAR.P":J(1,K,(e,t)=>Pa(Gi(e,t),!1)),VARP:J(1,K,(e,t)=>Pa(Gi(e,t),!1)),LARGE:J(2,2,(e,t)=>Ra(e,t,!0)),SMALL:J(2,2,(e,t)=>Ra(e,t,!1)),RANK:J(2,3,za),"RANK.EQ":J(2,3,za),SUMPRODUCT:J(1,K,Ka),SUMIF:J(2,3,(e,t)=>Ma(Wa(e,t))),SUMIFS:J(3,K,(e,t)=>Ma(Ga(e,t))),AVERAGEIF:J(2,3,(e,t)=>Na(Wa(e,t))),AVERAGEIFS:J(3,K,(e,t)=>Na(Ga(e,t))),COUNTIF:J(2,2,(e,t)=>Ha(null,e,t).length),COUNTIFS:J(2,K,(e,t)=>{if(e.length%2)throw W.VALUE;return Ha(null,e,t).length}),MINIFS:J(3,K,(e,t)=>qa(Ga(e,t),!1)),MAXIFS:J(3,K,(e,t)=>qa(Ga(e,t),!0))},Ya=32767;function Xa(e){let t=Math.trunc(e);if(t<0)throw W.VALUE;return t}function Za(e){let t=``,n=!1;for(let r of e){let e=r.toLowerCase()!==r.toUpperCase();t+=e?n?r.toLowerCase():r.toUpperCase():r,n=e}return t}function Qa(e,t,n,r){if(n<1||n>t.length+1)throw W.VALUE;if(e===``)return n;if(!r){let r=t.indexOf(e,n-1);if(r<0)throw W.VALUE;return r+1}let i=Ii(e,!1).exec(t.slice(n-1));if(!i)throw W.VALUE;return i.index+n}var $a={CONCATENATE:q(1,K,e=>e.map(ki).join(``)),CONCAT:J(1,K,(e,t)=>{let n=``,r=e=>n+=ki(e);for(let n of e)Ui(n,t,r,r);if(n.length>Ya)throw W.VALUE;return n}),TEXTJOIN:J(3,K,(e,t)=>{let n=ki(t.scalar(e[0])),r=Ai(t.scalar(e[1])),i=[],a=e=>{let t=ki(e);r&&t===``||i.push(t)};for(let n of e.slice(2))Ui(n,t,a,a);let o=i.join(n);if(o.length>Ya)throw W.VALUE;return o}),LEFT:q(1,2,e=>ki(e[0]).slice(0,Xa(qi(e,1,1)))),RIGHT:q(1,2,e=>{let t=ki(e[0]);return t.slice(Math.max(0,t.length-Xa(qi(e,1,1))))}),MID:q(3,3,([e,t,n])=>{let r=Math.trunc(G(t));if(r<1)throw W.VALUE;return ki(e).substr(r-1,Xa(G(n)))}),LEN:q(1,1,([e])=>ki(e).length),UPPER:q(1,1,([e])=>ki(e).toUpperCase()),LOWER:q(1,1,([e])=>ki(e).toLowerCase()),PROPER:q(1,1,([e])=>Za(ki(e))),TRIM:q(1,1,([e])=>ki(e).replace(/ {2,}/g,` `).replace(/^ | $/g,``)),SUBSTITUTE:q(3,4,e=>{let t=ki(e[0]),n=ki(e[1]),r=ki(e[2]);if(n===``)return t;if(e.length<4)return t.split(n).join(r);let i=Math.trunc(G(e[3]));if(i<1)throw W.VALUE;let a=-1;for(let e=0;e<i;e++)if(a=t.indexOf(n,a+(e?n.length:1)),a<0)return t;return t.slice(0,a)+r+t.slice(a+n.length)}),REPLACE:q(4,4,([e,t,n,r])=>{let i=ki(e),a=Math.trunc(G(t));if(a<1)throw W.VALUE;let o=Xa(G(n));return i.slice(0,a-1)+ki(r)+i.slice(a-1+o)}),REPT:q(2,2,([e,t])=>{let n=ki(e),r=Xa(G(t));if(n.length*r>Ya)throw W.VALUE;return n.repeat(r)}),FIND:q(2,3,e=>Qa(ki(e[0]),ki(e[1]),Math.trunc(qi(e,2,1)),!1)),SEARCH:q(2,3,e=>Qa(ki(e[0]),ki(e[1]),Math.trunc(qi(e,2,1)),!0)),EXACT:q(2,2,([e,t])=>ki(e)===ki(t)),VALUE:q(1,1,([e])=>{if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e!=`string`)throw e instanceof U?e:W.VALUE;let t=Ci(e);if(t===null)throw W.VALUE;return t}),TEXT:q(2,2,([e,t])=>wa(e,ki(t))),CHAR:q(1,1,([e])=>{let t=Math.trunc(G(e));if(t<1||t>255)throw W.VALUE;return String.fromCharCode(t)}),CODE:q(1,1,([e])=>{let t=ki(e);if(!t)throw W.VALUE;return t.charCodeAt(0)})},eo={...ja,...Ja,...aa,...$a,...ea,...xa,SINGLE:{kind:`eager`,min:1,max:1,scalarArgs:!1,fn:([e],t)=>t.scalar(e)}};function to(e,t,n){let r;switch(e){case`+`:r=t+n;break;case`-`:r=t-n;break;case`*`:r=t*n;break;case`/`:if(n===0)return W.DIV0;r=t/n;break;default:if(t===0&&n===0)return W.NUM;if(t===0&&n<0)return W.DIV0;r=t**+n}return Number.isFinite(r)?r:W.NUM}function no(e,t,n){if(t instanceof U)return t;if(n instanceof U)return n;switch(e){case`&`:return Ei(t)+Ei(n);case`=`:return Ni(t,n)===0;case`<>`:return Ni(t,n)!==0;case`<`:return Ni(t,n)<0;case`>`:return Ni(t,n)>0;case`<=`:return Ni(t,n)<=0;case`>=`:return Ni(t,n)>=0}let r=Ti(t);if(r instanceof U)return r;let i=Ti(n);return i instanceof U?i:to(e,r,i)}function ro(e,t){return Array.isArray(e)?new bi(e.map(e=>e.map(t))):t(e)}function io(e,t,n){if(!Array.isArray(e)&&!Array.isArray(t))return n(e,t);let r=Array.isArray(e)?e:[[e]],i=Array.isArray(t)?t:[[t]],a=Math.max(r.length,i.length),o=Math.max(r[0].length,i[0].length),s=[];for(let e=0;e<a;e++){let t=[];for(let a=0;a<o;a++)t.push(n(Vi(r,e,a),Vi(i,e,a)));s.push(t)}return new bi(s)}var ao=class{constructor(e){A(this,`provider`,void 0),A(this,`sheet`,void 0),A(this,`r`,void 0),A(this,`c`,void 0),this.provider=e.provider,this.sheet=e.sheet,this.r=e.r,this.c=e.c}eval(e,t){switch(e.type){case`num`:case`str`:case`bool`:return e.value;case`err`:return new U(e.code);case`missing`:return null;case`name`:return W.NAME;case`array`:return new bi(e.rows);case`ref`:return this.ref(e.ref);case`range`:return this.rangeOp(e.left,e.right);case`union`:{let t=[];for(let n of e.items){let e=this.eval(n,!1);if(e instanceof yi)t.push(e);else if(e instanceof xi)t.push(...e.areas);else return e instanceof U?e:W.VALUE}return new xi(t)}case`unary`:{let n=this.operand(this.eval(e.arg,t),t);return e.op===`+`?Array.isArray(n)?new bi(n):n:ro(n,e=>{let t=Ti(e);return t instanceof U?t:t===0?0:-t})}case`percent`:return ro(this.operand(this.eval(e.arg,t),t),e=>{let t=Ti(e);return t instanceof U?t:t/100});case`binary`:{let n=this.operand(this.eval(e.left,t),t),r=this.operand(this.eval(e.right,t),t),i=e.op;return io(n,r,(e,t)=>no(i,e,t))}case`call`:return this.call(e.name,e.args,t)}}ref(e){return e.sheet!==void 0&&!this.hasSheet(e.sheet)?W.REF:new yi(e.sheet??this.sheet,e.r0,e.c0,e.r1,e.c1)}rangeOp(e,t){let n=this.eval(e,!1);if(n instanceof U)return n;let r=this.eval(t,!1);return r instanceof U?r:!(n instanceof yi)||!(r instanceof yi)||!Sr(n.sheet,r.sheet)?W.VALUE:new yi(n.sheet,Math.min(n.r0,r.r0),Math.min(n.c0,r.c0),Math.max(n.r1,r.r1),Math.max(n.c1,r.c1))}call(e,t,n){if(!Object.hasOwn(eo,e))return W.NAME;let r=eo[e];if(t.length<r.min||t.length>r.max)return W.VALUE;if(r.kind===`lazy`)return Bi(()=>r.fn(t,this,n));let i=t.map(e=>this.eval(e,r.scalarArgs&&n));return Bi(()=>r.fn(i,this,n))}hasSheet(e){return!this.provider.hasSheet||this.provider.hasSheet(e)}now(){return this.provider.now?.()??new Date}cell(e,t,n){let r=this.provider.value(e,t,n);return r===void 0?null:r}clip(e){let{r1:t,c1:n}=e;if((t===1048575||n===16383)&&this.provider.bounds){let r=this.provider.bounds(e.sheet);t===1048575&&(t=Math.max(e.r0,Math.min(t,r.rows-1))),n===16383&&(n=Math.max(e.c0,Math.min(n,r.cols-1)))}return{r1:t,c1:n}}forEach(e,t){let{r1:n,c1:r}=this.clip(e);for(let i=e.r0;i<=n;i++)for(let n=e.c0;n<=r;n++)t(this.cell(e.sheet,i,n),i-e.r0,n-e.c0)}toArray(e){if(e instanceof yi){let{r1:t,c1:n}=this.clip(e),r=[];for(let i=e.r0;i<=t;i++){let t=[];for(let r=e.c0;r<=n;r++)t.push(this.cell(e.sheet,i,r));r.push(t)}return r}if(e instanceof bi)return e.data;if(e instanceof xi)throw W.VALUE;return[[e]]}intersect(e){return e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):e.w===1&&this.r>=e.r0&&this.r<=e.r1?this.cell(e.sheet,this.r,e.c0):e.h===1&&this.c>=e.c0&&this.c<=e.c1?this.cell(e.sheet,e.r0,this.c):W.VALUE}scalar(e){return e instanceof yi?this.intersect(e):e instanceof bi?e.data[0][0]:e instanceof xi?W.VALUE:e}operand(e,t){return e instanceof yi?e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):t?this.intersect(e):this.toArray(e):e instanceof bi?e.h===1&&e.w===1?e.data[0][0]:e.data:e instanceof xi?W.VALUE:e}};function oo(e,t){let n=$r();ei(!!t.provider.date1904);try{let n=new ao(t),r=n.eval(e,!0),i=r instanceof yi?n.intersect(r):r instanceof bi?r.data[0][0]:r instanceof xi?W.VALUE:r;return i===null?0:typeof i==`number`?Number.isFinite(i)?i+0:W.NUM:i}catch(e){return e instanceof U?e:W.VALUE}finally{ei(n)}}function so(e,t){let n=e.startsWith(`=`)?`=`:``,r=e.slice(n.length),i;try{i=Wr(r)}catch{return e}let a=n,o=0;for(let e of i){let n=t(e);n!==void 0&&(a+=r.slice(o,e.s)+n,o=e.e)}return a+r.slice(o)}var co=e=>(e.ref.sheet===void 0?``:`${e.sheetText??Cr(e.ref.sheet)}!`)+`#REF!`;function lo(e,t,n){return!t&&!n?e:so(e,e=>{if(e.t!==`ref`)return;let r={...e.ref};return r.kind!==`cols`&&(r.ar0||(r.r0+=t),r.ar1||(r.r1+=t)),r.kind!==`rows`&&(r.ac0||(r.c0+=n),r.ac1||(r.c1+=n)),Dr(r)?Tr(Er(r),e.sheetText):co(e)})}function uo(e,t,n,r,i){if(r>0)return e>=n&&(e+=r),t>=n&&(t+=r),e>i?null:[e,Math.min(t,i)];let a=-r,o=n+a;return t<n?[e,t]:e>=o?[e-a,t-a]:e>=n&&t<o?null:[e<n?e:n,t>=o?t-a:n-1]}function fo(e,t){if(!t.delta)return e;let n=e=>{if(t.sheet===void 0)return e===void 0||t.formulaSheet!==void 0&&Sr(e,t.formulaSheet);let n=e??t.formulaSheet;return n===void 0||Sr(n,t.sheet)};return so(e,e=>{if(e.t!==`ref`||!n(e.ref.sheet))return;let r={...e.ref};if(t.axis===`row`){if(r.kind===`cols`)return;let n=uo(r.r0,r.r1,t.at,t.delta,vr);if(!n)return co(e);[r.r0,r.r1]=n}else{if(r.kind===`rows`)return;let n=uo(r.c0,r.c1,t.at,t.delta,yr);if(!n)return co(e);[r.c0,r.c1]=n}if(r.r0!==e.ref.r0||r.r1!==e.ref.r1||r.c0!==e.ref.c0||r.c1!==e.ref.c1)return Tr(r,e.sheetText)})}function po(e,t,n){let r=`${Cr(n)}!`;return so(e,e=>{if(e.t===`ref`&&e.ref.sheet!==void 0&&Sr(e.ref.sheet,t))return Tr({...e.ref,sheet:n});if((e.t===`err`||e.t===`name`)&&e.sheet!==void 0&&Sr(e.sheet,t))return r+e.v})}function mo(e){let t=e.sheet===void 0?{}:{sheet:e.sheet};return e.kind===`cell`?{...t,r:e.r0,c:e.c0,absR:e.ar0,absC:e.ac0}:{...t,r0:e.r0,c0:e.c0,r1:e.r1,c1:e.c1}}function ho(e){let t=[],n=e=>{switch(e.type){case`ref`:t.push(mo(e.ref));break;case`range`:if(e.left.type===`ref`&&e.right.type===`ref`&&Sr(e.left.ref.sheet,e.right.ref.sheet)){let n=e.left.ref,r=e.right.ref;t.push(mo({...n,kind:`area`,r0:Math.min(n.r0,r.r0),c0:Math.min(n.c0,r.c0),r1:Math.max(n.r1,r.r1),c1:Math.max(n.c1,r.c1)}))}else n(e.left),n(e.right);break;case`unary`:case`percent`:n(e.arg);break;case`binary`:n(e.left),n(e.right);break;case`union`:e.items.forEach(n);break;case`call`:e.args.forEach(n)}};return n(e),t}function go(e){try{return{toks:Wr(e),tail:e.length,openString:!1}}catch(t){if(!(t instanceof Or))return{toks:[],tail:0,openString:!1};let n=Math.max(0,Math.min(t.pos,e.length)),r=n>0?go(e.slice(0,n)):{toks:[],tail:0,openString:!1};return r.tail<n?r:{toks:r.toks,tail:n,openString:t.message===`unterminated string`}}}var _o=e=>e.startsWith(`=`)&&e.length>0,vo=new Set([`(`,`,`,`;`,`{`]),yo=new Set([`)`,`,`,`;`,`}`]);function bo(e,t){let n={pointable:!1,refs:[]};if(!_o(e))return n;let r=e.slice(1),i=t-1,{toks:a,tail:o}=go(r);for(let e of a)e.t===`ref`&&n.refs.push({s:e.s+1,e:e.e+1,text:r.slice(e.s,e.e),ref:e.ref});if(i<0)return n;let s=i>o,c=[],l,u,d;for(let e=0;e<a.length;e++){let t=a[e];t.e<=i?(t.t===`punc`&&(t.v===`(`?c.push({name:a[e-1]?.t===`func`&&a[e-1].e===t.s?a[e-1].v:``,arg:0}):t.v===`{`?c.push({name:``,arg:0}):t.v===`)`||t.v===`}`?c.pop():(t.v===`,`||t.v===`;`)&&c.length&&c[c.length-1].arg++),t.t!==`ws`&&(l=t)):t.s<i?u=t:!d&&t.t!==`ws`&&(d=t)}for(let e=c.length-1;e>=0;e--)if(c[e].name){n.call=c[e];break}if(s)return n;let f=u??(l&&l.e===i?l:void 0);if(f&&(f.t===`name`||f.t===`func`||f.t===`ref`||f.t===`bool`)){let e=r.slice(f.s,i);if(!(f.t===`ref`&&f.ref.sheet!==void 0||f.t===`name`&&f.sheet!==void 0)&&/^[A-Za-z_][A-Za-z0-9_.]*$/.test(e)){let t=f.t===`func`||r[f.e]===`(`;n.word={s:f.s+1,e:f.e+1,text:e,call:t}}}if(!u){let e=!l||l.t===`punc`&&vo.has(l.v)||l.t===`op`&&l.v!==`%`,t=!d||d.t===`punc`&&yo.has(d.v)||d.t===`op`&&d.v!==`:`;n.pointable=e&&t}return n}function xo(e,t,n,r,i){let a=i===void 0?``:Cr(i)+`!`;if(e>n&&([e,n]=[n,e]),t>r&&([t,r]=[r,t]),e===0&&n>=1048575)return`${a}${br(t)}:${br(r)}`;if(t===0&&r>=16383)return`${a}${e+1}:${n+1}`;let o=`${br(t)}${e+1}`;return e===n&&t===r?a+o:`${a}${o}:${br(r)}${n+1}`}function So(e){if(!_o(e))return e;let t=e.slice(1),{toks:n,tail:r,openString:i}=go(t);if(r<t.length&&!i)return e;let a=0,o=``,s=0;for(let e of n){if(e.t===`func`||e.t===`bool`||e.t===`ref`&&e.ref.sheet===void 0)o+=t.slice(s,e.s)+t.slice(e.s,e.e).toUpperCase(),s=e.e;else if(e.t===`ref`){let n=t.lastIndexOf(`!`,e.e);o+=t.slice(s,n+1)+t.slice(n+1,e.e).toUpperCase(),s=e.e}e.t===`punc`&&(e.v===`(`?a++:e.v===`)`&&(a=Math.max(0,a-1)))}return o+=t.slice(s),`=`+o+(i?`"`:``)+`)`.repeat(a)}var Co={ABS:`number|Absolute value of a number.`,AND:`logical1, [logical2], ...|TRUE if all arguments are TRUE.`,AVERAGE:`number1, [number2], ...|Arithmetic mean of the arguments.`,AVERAGEIF:`range, criteria, [average_range]|Average of cells that meet a condition.`,AVERAGEIFS:`average_range, criteria_range1, criteria1, ...|Average of cells that meet multiple conditions.`,CEILING:`number, significance|Rounds a number up to the nearest multiple of significance.`,"CEILING.MATH":`number, [significance], [mode]|Rounds a number up to the nearest integer or multiple.`,CHAR:`number|Character for a character code.`,CHOOSE:`index_num, value1, [value2], ...|Picks a value from the list by position.`,CODE:`text|Numeric code of the first character.`,COLUMN:`[reference]|Column number of a reference.`,COLUMNS:`array|Number of columns in a reference.`,CONCAT:`text1, [text2], ...|Joins several text items into one.`,CONCATENATE:`text1, [text2], ...|Joins several text items into one.`,COUNT:`value1, [value2], ...|Counts cells that contain numbers.`,COUNTA:`value1, [value2], ...|Counts cells that are not empty.`,COUNTBLANK:`range|Counts empty cells in a range.`,COUNTIF:`range, criteria|Counts cells that meet a condition.`,COUNTIFS:`criteria_range1, criteria1, ...|Counts cells that meet multiple conditions.`,DATE:`year, month, day|Date serial number from year, month and day.`,DATEDIF:`start_date, end_date, unit|Difference between two dates in days, months or years.`,DAY:`serial_number|Day of the month (1-31).`,DAYS:`end_date, start_date|Number of days between two dates.`,EDATE:`start_date, months|Date that is a number of months before or after a date.`,EOMONTH:`start_date, months|Last day of the month, months before or after a date.`,"ERROR.TYPE":`error_val|Number that corresponds to an error type.`,EVEN:`number|Rounds up to the nearest even integer.`,EXACT:`text1, text2|TRUE if two texts are exactly the same.`,EXP:`number|e raised to the power of a number.`,FACT:`number|Factorial of a number.`,FALSE:`|The logical value FALSE.`,FIND:`find_text, within_text, [start_num]|Position of a text inside another (case-sensitive).`,FLOOR:`number, significance|Rounds a number down to the nearest multiple of significance.`,"FLOOR.MATH":`number, [significance], [mode]|Rounds a number down to the nearest integer or multiple.`,GCD:`number1, [number2], ...|Greatest common divisor.`,HLOOKUP:`lookup_value, table_array, row_index_num, [range_lookup]|Looks up a value in the top row and returns a value from the same column.`,HOUR:`serial_number|Hour of a time value (0-23).`,IF:`logical_test, [value_if_true], [value_if_false]|Returns one value if a condition is TRUE and another if FALSE.`,IFERROR:`value, value_if_error|Returns value_if_error if the expression is an error.`,IFNA:`value, value_if_na|Returns value_if_na if the expression is #N/A.`,IFS:`logical_test1, value_if_true1, ...|Returns the value of the first TRUE condition.`,INDEX:`array, row_num, [column_num]|Value at a given row and column of a range.`,INDIRECT:`ref_text, [a1]|Reference given by a text string.`,INT:`number|Rounds down to the nearest integer.`,ISBLANK:`value|TRUE if the value is empty.`,ISERR:`value|TRUE if the value is an error other than #N/A.`,ISERROR:`value|TRUE if the value is any error.`,ISEVEN:`number|TRUE if the number is even.`,ISLOGICAL:`value|TRUE if the value is a logical value.`,ISNA:`value|TRUE if the value is #N/A.`,ISNONTEXT:`value|TRUE if the value is not text.`,ISNUMBER:`value|TRUE if the value is a number.`,ISODD:`number|TRUE if the number is odd.`,ISTEXT:`value|TRUE if the value is text.`,LARGE:`array, k|k-th largest value in a data set.`,LCM:`number1, [number2], ...|Least common multiple.`,LEFT:`text, [num_chars]|First characters of a text.`,LEN:`text|Number of characters in a text.`,LN:`number|Natural logarithm.`,LOG:`number, [base]|Logarithm to a given base (default 10).`,LOG10:`number|Base-10 logarithm.`,LOOKUP:`lookup_value, lookup_vector, [result_vector]|Looks up a value in a one-row or one-column range.`,LOWER:`text|Converts text to lowercase.`,MATCH:`lookup_value, lookup_array, [match_type]|Relative position of a value in a range.`,MAX:`number1, [number2], ...|Largest value.`,MAXIFS:`max_range, criteria_range1, criteria1, ...|Largest value among cells that meet conditions.`,MEDIAN:`number1, [number2], ...|Median of the numbers.`,MID:`text, start_num, num_chars|Characters from the middle of a text.`,MIN:`number1, [number2], ...|Smallest value.`,MINIFS:`min_range, criteria_range1, criteria1, ...|Smallest value among cells that meet conditions.`,MINUTE:`serial_number|Minute of a time value (0-59).`,MOD:`number, divisor|Remainder after division.`,MODE:`number1, [number2], ...|Most frequent value.`,"MODE.SNGL":`number1, [number2], ...|Most frequent value.`,MONTH:`serial_number|Month of a date (1-12).`,N:`value|Value converted to a number.`,NA:`|The error value #N/A.`,NETWORKDAYS:`start_date, end_date, [holidays]|Number of working days between two dates.`,NOT:`logical|Reverses a logical value.`,NOW:`|Current date and time.`,ODD:`number|Rounds up to the nearest odd integer.`,OFFSET:`reference, rows, cols, [height], [width]|Reference offset from a starting reference.`,OR:`logical1, [logical2], ...|TRUE if any argument is TRUE.`,PI:`|The value of pi.`,POWER:`number, power|A number raised to a power.`,PRODUCT:`number1, [number2], ...|Multiplies all the arguments.`,PROPER:`text|Capitalizes the first letter of each word.`,RAND:`|Random number between 0 and 1.`,RANDBETWEEN:`bottom, top|Random integer between two numbers.`,RANK:`number, ref, [order]|Rank of a number in a list.`,"RANK.EQ":`number, ref, [order]|Rank of a number in a list.`,REPLACE:`old_text, start_num, num_chars, new_text|Replaces part of a text by position.`,REPT:`text, number_times|Repeats a text a number of times.`,RIGHT:`text, [num_chars]|Last characters of a text.`,ROUND:`number, num_digits|Rounds a number to a number of digits.`,ROUNDDOWN:`number, num_digits|Rounds a number down, toward zero.`,ROUNDUP:`number, num_digits|Rounds a number up, away from zero.`,ROW:`[reference]|Row number of a reference.`,ROWS:`array|Number of rows in a reference.`,SEARCH:`find_text, within_text, [start_num]|Position of a text inside another (not case-sensitive).`,SECOND:`serial_number|Second of a time value (0-59).`,SIGN:`number|Sign of a number: 1, 0 or -1.`,SMALL:`array, k|k-th smallest value in a data set.`,SQRT:`number|Square root.`,STDEV:`number1, [number2], ...|Standard deviation of a sample.`,"STDEV.P":`number1, [number2], ...|Standard deviation of a population.`,"STDEV.S":`number1, [number2], ...|Standard deviation of a sample.`,STDEVP:`number1, [number2], ...|Standard deviation of a population.`,SUBSTITUTE:`text, old_text, new_text, [instance_num]|Replaces existing text with new text.`,SUM:`number1, [number2], ...|Adds all the numbers.`,SUMIF:`range, criteria, [sum_range]|Adds the cells that meet a condition.`,SUMIFS:`sum_range, criteria_range1, criteria1, ...|Adds the cells that meet multiple conditions.`,SUMPRODUCT:`array1, [array2], ...|Sum of the products of corresponding items.`,SWITCH:`expression, value1, result1, [default_or_value2], ...|Matches an expression against a list of values.`,T:`value|Text of a value, or empty text.`,TEXT:`value, format_text|Formats a number as text.`,TEXTJOIN:`delimiter, ignore_empty, text1, ...|Joins texts with a delimiter.`,TIME:`hour, minute, second|Time value from hour, minute and second.`,TODAY:`|Current date.`,TRIM:`text|Removes extra spaces from text.`,TRUE:`|The logical value TRUE.`,TRUNC:`number, [num_digits]|Truncates a number to an integer or number of digits.`,UPPER:`text|Converts text to uppercase.`,VALUE:`text|Converts text to a number.`,VAR:`number1, [number2], ...|Variance of a sample.`,"VAR.P":`number1, [number2], ...|Variance of a population.`,"VAR.S":`number1, [number2], ...|Variance of a sample.`,VARP:`number1, [number2], ...|Variance of a population.`,VLOOKUP:`lookup_value, table_array, col_index_num, [range_lookup]|Looks up a value in the first column and returns a value from the same row.`,WEEKDAY:`serial_number, [return_type]|Day of the week of a date.`,XLOOKUP:`lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]|Searches a range and returns the matching item from another range.`,XOR:`logical1, [logical2], ...|TRUE if an odd number of arguments are TRUE.`,YEAR:`serial_number|Year of a date.`},wo=null;function To(){return wo||(wo=Object.keys(Co).sort().map(e=>{let[t,n]=Co[e].split(`|`),r=t?t.split(`, `):[],i=r[r.length-1]===`...`;return{name:e,args:i?r.slice(0,-1):r,variadic:i,desc:n}})),wo}function Eo(e){let t=e.toUpperCase();return To().find(e=>e.name===t)}function Do(e,t=10){let n=e.toUpperCase();return n?To().filter(e=>e.name.startsWith(n)).slice(0,t):[]}function Oo(e,t){if(t<e.args.length)return t;if(!e.variadic)return-1;let n=e.args.length,r=/1$/.test(e.args[n-1]??``)&&/1$/.test(e.args[n-2]??``)?2:1,i=n-r;return i+(t-i)%r}var ko=(e,t)=>`${e}:${t}`,Ao=class{constructor(e){A(this,`wb`,void 0),A(this,`asts`,new Map),A(this,`cellDeps`,new Map),A(this,`rangeDeps`,[]),A(this,`indexed`,!1),A(this,`cur`,0),this.wb=e}invalidate(){this.indexed=!1,this.asts.clear(),this.cellDeps.clear(),this.rangeDeps=[]}sheetIndex(e,t){return e?this.wb.sheets.findIndex(t=>t.name.toLowerCase()===e.toLowerCase()):t}ast(e,t){let n=ko(e,t),r=this.asts.get(n);if(r===void 0){let i=this.wb.sheetsData.get(e)?.formulas.get(t);try{r=i?Jr(i):null}catch{r=null}this.asts.set(n,r)}return r}index(){if(!this.indexed){this.indexed=!0;for(let[e,t]of this.wb.sheetsData)for(let n of t.formulas.keys())this.addDeps(e,n)}}addDeps(e,t){let n=this.ast(e,t);if(!n)return;let r=ko(e,t);for(let t of ho(n)){let n=this.sheetIndex(t.sheet,e);if(!(n<0)){if(`r`in t){let e=ko(n,t.r*Xo+t.c),i=this.cellDeps.get(e);i||this.cellDeps.set(e,i=new Set),i.add(r)}else this.rangeDeps.push({sheet:n,r0:t.r0,c0:t.c0,r1:t.r1,c1:t.c1,dep:r})}}}formulaChanged(e,t){if(!this.indexed)return;let n=ko(e,t);this.asts.delete(n);for(let e of this.cellDeps.values())e.delete(n);this.rangeDeps=this.rangeDeps.filter(e=>e.dep!==n),this.addDeps(e,t)}value(e,t,n){let r=this.wb.sheetsData.get(e)?.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4){if(r[e]!==n)continue;let t=r[e+1],i=r[e+2];switch(t){case 0:return i;case 1:return this.wb.sst[i]??``;case 2:return String(i);case 3:return!!i;case 4:return new U(String(i));case 6:return null;default:return String(i)}}return null}provider(e,t){return{value:(n,r,i)=>{let a=this.sheetIndex(n,this.cur);if(a<0)return new U(`#REF!`);let o=ko(a,r*Xo+i);return t.has(o)?new U(`#REF!`):(e.has(o)&&this.compute(o,e,t),this.value(a,r,i))},bounds:e=>{let t=this.wb.sheetsData.get(this.sheetIndex(e,this.cur));return{rows:(t?.maxRow??-1)+1,cols:(t?.maxCol??-1)+1}},hasSheet:e=>this.sheetIndex(e,-1)>=0,date1904:this.wb.date1904}}compute(e,t,n){t.delete(e);let[r,i]=e.split(`:`).map(Number),a=this.wb.sheetsData.get(r);if(!a||!a.formulas.has(i))return;if(n.has(e)){jo(a,i,new U(`#REF!`));return}n.add(e);let o=this.ast(r,i),s=this.cur;this.cur=r;let c;try{c=o?oo(o,{provider:this.provider(t,n),sheet:this.wb.sheets[r]?.name,r:Math.floor(i/Xo),c:i%Xo}):new U(`#NAME?`)}catch{c=new U(`#VALUE!`)}this.cur=s,n.delete(e),jo(a,i,c)}recalc(e,t=[]){this.index();let n=new Set,r=[],i=e=>{n.has(e)||(n.add(e),r.push(e))};for(let e of t)i(ko(e.sheet,e.key));let a=new Set,o=e=>{if(a.has(e))return;a.add(e);let[t,n]=e.split(`:`).map(Number),r=Math.floor(n/Xo),s=n%Xo;for(let t of this.cellDeps.get(e)??[])i(t),o(t);for(let e of this.rangeDeps)e.sheet===t&&r>=e.r0&&r<=e.r1&&s>=e.c0&&s<=e.c1&&(i(e.dep),o(e.dep))};for(let t of e)o(ko(t.sheet,t.key));for(let e of t)o(ko(e.sheet,e.key));let s=new Set,c=new Set;for(let e of r)n.has(e)&&(this.compute(e,n,c),s.add(Number(e.split(`:`)[0])));return s}computeMissing(e,t){t.length&&this.recalc([],t.map(t=>({sheet:e,key:t})))}};function jo(e,t,n){let r=Math.floor(t/Xo),i=t%Xo,a=e.rows[r];a||(e.rows[r]=a=[]);let o,s;n instanceof U?(o=4,s=n.code):typeof n==`number`?(o=0,s=Number.isFinite(n)?n:0):typeof n==`boolean`?(o=3,s=+!!n):n===null?(o=0,s=0):(o=2,s=n);for(let e=0;e<a.length;e+=4)if(a[e]===i){a[e+1]=o,a[e+2]=s;return}let c=0;for(;c<a.length&&a[c]<i;)c+=4;a.splice(c,0,i,o,s,0)}var Mo={0:`General`,1:`0`,2:`0.00`,3:`#,##0`,4:`#,##0.00`,9:`0%`,10:`0.00%`,11:`0.00E+00`,12:`# ?/?`,13:`# ??/??`,14:`m/d/yyyy`,15:`d-mmm-yy`,16:`d-mmm`,17:`mmm-yy`,18:`h:mm AM/PM`,19:`h:mm:ss AM/PM`,20:`h:mm`,21:`h:mm:ss`,22:`m/d/yyyy h:mm`,37:`#,##0 ;(#,##0)`,38:`#,##0 ;[Red](#,##0)`,39:`#,##0.00;(#,##0.00)`,40:`#,##0.00;[Red](#,##0.00)`,45:`mm:ss`,46:`[h]:mm:ss`,47:`mmss.0`,48:`##0.0E+0`,49:`@`,27:`yyyy"年"m"月"`,30:`m/d/yy`,31:`yyyy"年"m"月"d"日"`,50:`yyyy"年"m"月"`,57:`yyyy"年"m"月"`,58:`m"月"d"日"`},No={black:`#000000`,red:`#ff0000`,green:`#00a000`,blue:`#0000ff`,yellow:`#c0c000`,magenta:`#ff00ff`,cyan:`#00c0c0`,white:`#ffffff`},Po=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Y=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Fo(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`\\`&&!r?(n+=o+(e[a+1]??``),a++):(o===`"`?r=!r:!r&&o===`[`?i=!0:!r&&o===`]`&&(i=!1),o===`;`&&!r&&!i?(t.push(n),n=``):n+=o)}return t.push(n),t}function Io(e){let t=[],n,r,i=!1,a=0,o=e=>{let n=t[t.length-1];n?.k===`lit`?n.v+=e:t.push({k:`lit`,v:e})},s=e.toLowerCase();for(;a<e.length;){let c=e[a],l=s[a];if(c===`"`){let t=e.indexOf(`"`,a+1);o(e.slice(a+1,t<0?void 0:t)),a=t<0?e.length:t+1}else if(c===`\\`)o(e[a+1]??``),a+=2;else if(c===`_`)o(` `),a+=2;else if(c===`*`)a+=2;else if(c===`[`){let s=e.indexOf(`]`,a),c=e.slice(a+1,s<0?void 0:s),l=c.toLowerCase();if(No[l])n=No[l];else if(/^color\s*\d+$/.test(l))n=void 0;else if(/^(h+|m+|s+)$/.test(l))t.push({k:`elapsed`,v:l[0]}),i=!0;else if(c.startsWith(`$`)){let e=c.slice(1).split(`-`)[0];e&&o(e)}else{let e=/^(<=|>=|<>|<|>|=)\s*(-?[\d.]+)$/.exec(c);e&&(r={op:e[1],v:Number(e[2])})}a=s<0?e.length:s+1}else if(c===`0`||c===`#`||c===`?`)t.push({k:`digit`,v:c}),a++;else if(c===`.`){if(i&&e[a+1]===`0`){let n=a+1;for(;e[n]===`0`;)n++;t.push({k:`date`,v:e.slice(a,n)}),a=n}else t.push({k:`dot`}),a++}else if(c===`,`)t.push({k:`comma`}),a++;else if(c===`%`)t.push({k:`pct`}),a++;else if(l===`e`&&(e[a+1]===`+`||e[a+1]===`-`))t.push({k:`exp`,sign:e[a+1]===`+`}),a+=2;else if(c===`/`&&t.some(e=>e.k===`digit`))t.push({k:`slash`}),a++;else if(c===`@`)t.push({k:`text`}),a++;else if(s.startsWith(`am/pm`,a))t.push({k:`date`,v:`AM/PM`}),i=!0,a+=5;else if(s.startsWith(`a/p`,a))t.push({k:`date`,v:`A/P`}),i=!0,a+=3;else if(`ymdhs`.includes(l)||l===`g`&&s.startsWith(`ge`,a)||l===`b`){let e=a;for(;s[e]===l;)e++;l===`b`||l===`g`?o(``):(t.push({k:`date`,v:s.slice(a,e)}),i=!0),a=e}else o(c),a++}return{toks:t,color:n,isDate:i,cond:r,hasDigits:t.some(e=>e.k===`digit`)}}var Lo=new Map;function Ro(e){let t=Lo.get(e);return t||(t=Fo(e).map(Io),Lo.size>2e3&&Lo.clear(),Lo.set(e,t)),t}function zo(e){return!e||e===`General`?!1:Ro(e)[0].isDate}function Bo(e){if(!Number.isFinite(e)||Number.isInteger(e)&&Math.abs(e)<1e11)return String(e);let t=Math.abs(e);if(t>=1e11||t<1e-9&&t!==0){let[t,n]=e.toExponential(5).split(`e`);return(t.includes(`.`)?t.replace(/0+$/,``).replace(/\.$/,``):t)+`E`+(n[0]===`-`?`-`:`+`)+n.replace(/^[+-]/,``).padStart(2,`0`)}let n=Math.max(0,10-Math.floor(Math.log10(t||1))),r=e.toFixed(Math.min(n,15));return r.includes(`.`)&&(r=r.replace(/0+$/,``).replace(/\.$/,``)),r}function Vo(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)}function Ho(e,t){let n=t.toks,r=Math.abs(e),i=n.filter(e=>e.k===`pct`).length;r*=100**i;let a=n.findIndex(e=>e.k===`dot`),o=n.findIndex(e=>e.k===`exp`),s=n.findIndex(e=>e.k===`slash`),c=n.findIndex(e=>e.k===`digit`),l=-1;n.forEach((e,t)=>e.k===`digit`&&(l=t));let u=0;for(let e=l+1;e<n.length&&n[e].k===`comma`;e++)u++;r/=1e3**u;let d=n.some((e,t)=>e.k===`comma`&&t>c&&t<l);if(s>=0)return Uo(r,t,e<0);let f=a>=0?a:o>=0?o:l+1,p=a>=0?n.slice(a+1,o>=0?o:void 0).filter(e=>e.k===`digit`):[],m=p.length,h=r,g=0;if(o>=0){let e=n.slice(0,f).filter(e=>e.k===`digit`).length||1;h!==0&&(g=Math.floor(Math.log10(h)),e>1&&(g=Math.floor(g/e)*e),h/=10**g)}let _=h.toFixed(m);o>=0&&Number(_)>=10&&n.slice(0,f).filter(e=>e.k===`digit`).length<=1&&(g+=1,_=(h/10).toFixed(m));let[v,y=``]=_.split(`.`);if(m){let e=y.split(``);for(let t=m-1;t>=0&&e[t]===`0`;t--){let n=p[t].v;if(n===`#`)e[t]=``;else if(n===`?`)e[t]=` `;else break}y=e.join(``)}let b=n.slice(0,f),x=b.filter(e=>e.k===`digit`).filter(e=>e.v===`0`).length;for(v===`0`&&x===0&&(v=``);v.length<x;)v=`0`+v;let S=b.some((e,t)=>e.k===`lit`&&t>c&&t<f),C=``;if(S){let e=v,t=``;for(let r=f-1;r>=0;r--){let i=n[r];i.k===`digit`?(e.length?(t=e[e.length-1]+t,e=e.slice(0,-1)):i.v===`0`?t=`0`+t:i.v===`?`&&(t=` `+t),r===c&&e.length&&(t=e+t,e=``)):i.k===`lit`?t=i.v+t:i.k===`pct`&&(t=`%`+t)}C=t}else{let e=!1,t=d?Vo(v):v;for(let r=0;r<f;r++){let i=n[r];i.k===`digit`?e||(C+=t,e=!0):i.k===`lit`?C+=i.v:i.k===`pct`&&(C+=`%`)}e||(C+=t)}a>=0&&(C+=y.length||p.some(e=>e.v===`0`)?`.`+y:m?`.`:``);let w=o>=0?o:a>=0?a+1:f;for(let e=w;e<n.length;e++){let t=n[e];if(t.k===`exp`){let r=n.slice(e+1).filter(e=>e.k===`digit`).length||1;for(C+=`E`+(g<0?`-`:t.sign?`+`:``)+String(Math.abs(g)).padStart(r,`0`);e+1<n.length&&n[e+1].k===`digit`;)e++}else t.k===`lit`?C+=t.v:t.k===`pct`&&(C+=`%`)}return C}function Uo(e,t,n){let r=t.toks,i=r.findIndex(e=>e.k===`slash`),a=r.slice(i+1).filter(e=>e.k===`digit`),o=r.slice(i+1).find(e=>e.k===`lit`&&/^\d+$/.test(e.v.trim())),s=o?Number(o.v):10**(a.length||1)-1,c=r.slice(0,i).some(e=>e.k===`lit`&&e.v.includes(` `)),l=c?Math.floor(e):0,u=e-l,d=0,f=1;if(o)f=s,d=Math.round(u*s);else{let e=1/0;for(let t=1;t<=s;t++){let n=Math.round(u*t),r=Math.abs(u-n/t);r<e-1e-12&&(e=r,d=n,f=t)}}let p=n?`-`:``;return d===0?p+(c?String(l):`0`):d===f?p+String(l+1):p+(c&&l?l+` `:``)+d+`/`+f}function Wo(e,t=!1){let n=Math.floor(e),r=Math.round((e-n)*864e5),i;return t?i=Date.UTC(1904,0,1):n<60?i=Date.UTC(1899,11,31):(i=Date.UTC(1899,11,30),n===60&&(n=61)),new Date(i+n*864e5+r)}function Go(e,t,n){let r=Wo(e,n),i=t.toks,a=i.some(e=>e.k===`date`&&(e.v===`AM/PM`||e.v===`A/P`)),o=r.getUTCFullYear(),s=r.getUTCMonth(),c=r.getUTCDate(),l=r.getUTCHours(),u=r.getUTCMinutes(),d=r.getUTCSeconds(),f=r.getUTCMilliseconds(),p=(e,t=2)=>String(e).padStart(t,`0`),m=``,h=e=>{for(let t=e-1;t>=0;t--){let e=i[t];if(e.k===`date`)return e.v[0]===`h`;if(e.k===`elapsed`)return e.v===`h`}for(let t=e+1;t<i.length;t++){let e=i[t];if(e.k===`date`)return e.v[0]===`s`;if(e.k===`elapsed`)return e.v===`s`}return!1};return i.forEach((t,n)=>{if(t.k===`lit`)return m+=t.v;if(t.k===`elapsed`){let n=e*86400;t.v===`h`?m+=Math.floor(n/3600):t.v===`m`?m+=Math.floor(n/60):m+=Math.round(n);return}if(t.k!==`date`){t.k===`digit`?m+=t.v===`0`?`0`:``:t.k===`dot`?m+=`.`:t.k===`comma`?m+=`,`:t.k===`pct`?m+=`%`:t.k===`slash`&&(m+=`/`);return}let i=t.v;switch(i[0]){case`y`:m+=i.length<=2?p(o%100):String(o);break;case`m`:i.length<=2&&h(n)?m+=i.length===2?p(u):String(u):i.length===1?m+=s+1:i.length===2?m+=p(s+1):i.length===3?m+=Po[s].slice(0,3):i.length===5?m+=Po[s][0]:m+=Po[s];break;case`d`:i.length===1?m+=c:i.length===2?m+=p(c):i.length===3?m+=Y[r.getUTCDay()].slice(0,3):m+=Y[r.getUTCDay()];break;case`h`:{let e=l;a&&(e=e%12||12),m+=i.length>=2?p(e):String(e);break}case`s`:m+=i.length>=2?p(d):String(d);break;case`.`:m+=`.`+p(Math.floor(f/10**(3-(i.length-1))),i.length-1);break;case`A`:m+=i===`AM/PM`?l<12?`AM`:`PM`:l<12?`A`:`P`}}),m}function Ko(e,t,n=!1){if(!t||t===`General`||t===`general`)return{text:Bo(e)};let r=Ro(t),i=r[0],a=e;if(r.some(e=>e.cond)?i=r.find(t=>{if(!t.cond)return!1;let{op:n,v:r}=t.cond;return n===`<`?e<r:n===`<=`?e<=r:n===`>`?e>r:n===`>=`?e>=r:n===`=`?e===r:e!==r})??r.find(e=>!e.cond)??r[0]:r.length>=3&&e===0&&r[2].toks.length?i=r[2]:r.length>=2&&e<0&&r[1].toks.length&&(i=r[1],a=-e),i.isDate)return e<0||e>2958465?{text:`#`.repeat(8)}:{text:Go(e,i,n),color:i.color};if(!i.hasDigits){let t=i.toks.map(e=>e.k===`lit`?e.v:e.k===`pct`?`%`:e.k===`text`?Bo(a):``).join(``);return i.toks.some(e=>e.k===`text`)||t?{text:t,color:i.color}:{text:Bo(e),color:i.color}}let o=a<0,s=Ho(a,i);return o&&(s=`-`+s),{text:s,color:i.color}}function qo(e,t){if(!t||!t.includes(`@`))return e;let n=Ro(t),r=n.length>=4?n[3]:n.find(e=>e.toks.some(e=>e.k===`text`));return r?r.toks.map(t=>t.k===`lit`?t.v:t.k===`text`?e:``).join(``):e}var Jo={thin:[1,`solid`],medium:[2,`solid`],thick:[3,`solid`],dashed:[1,`dashed`],dotted:[1,`dotted`],double:[3,`double`],hair:[1,`dotted`],mediumDashed:[2,`dashed`],dashDot:[1,`dashed`],mediumDashDot:[2,`dashed`],dashDotDot:[1,`dotted`],mediumDashDotDot:[2,`dotted`],slantDashDot:[2,`dashed`]};function Yo(e,t){let n=zn(e),r=e=>Rn(e,t,n),i=new Map;for(let t of R(L(e,`numFmts`),`numFmt`))i.set(Number(t.a.numFmtId),t.a.formatCode??`General`);let a=R(L(e,`fonts`),`font`).map(e=>({b:je(L(e,`b`)),i:je(L(e,`i`)),u:L(e,`u`)?L(e,`u`).a.val??`single`:void 0,strike:je(L(e,`strike`)),sz:V(L(e,`sz`)?.a.val),color:r(L(e,`color`)),name:L(e,`name`)?.a.val})),o=R(L(e,`fills`),`fill`).map(e=>{let t=L(e,`patternFill`);if(t){let e=t.a.patternType;return!e||e===`none`?void 0:e===`solid`?r(L(t,`fgColor`))??r(L(t,`bgColor`)):r(L(t,`fgColor`))??`#d9d9d9`}let n=L(e,`gradientFill`);if(n){let e=R(n,`stop`).map(e=>r(L(e,`color`))).filter(Boolean);return e.length>=2?`linear-gradient(${V(n.a.degree,90)+90}deg, ${e.join(`, `)})`:e[0]}}),s=R(L(e,`borders`),`border`).map(e=>{let t={},n=(e,n)=>{let i=e?.a.style;if(!i||i===`none`)return;let[a,o]=Jo[i]??[1,`solid`];t[n]=`${a}px ${o} ${r(L(e,`color`))??`#000`}`};return n(L(e,`left`)??L(e,`start`),`borderLeft`),n(L(e,`right`)??L(e,`end`),`borderRight`),n(L(e,`top`),`borderTop`),n(L(e,`bottom`),`borderBottom`),t}),c=a[0]??{},l={fontFamily:$e(c.name??`Calibri`),fontSize:`${c.sz??11}pt`,color:c.color??`#000000`},u=R(L(e,`cellXfs`),`xf`).map(e=>{let t={},n=V(e.a.numFmtId,0),r=a[V(e.a.fontId,0)];if(r){r.b&&(t.fontWeight=700),r.i&&(t.fontStyle=`italic`);let e=[r.u&&r.u!==`none`?`underline`:``,r.strike?`line-through`:``].filter(Boolean).join(` `);e&&(t.textDecoration=e),(r.u===`double`||r.u===`doubleAccounting`)&&(t.textDecorationStyle=`double`),r.sz&&r.sz!==c.sz&&(t.fontSize=`${r.sz}pt`),r.color&&r.color!==c.color&&(t.color=r.color),r.name&&r.name!==c.name&&(t.fontFamily=$e(r.name))}let l=o[V(e.a.fillId,0)];l&&(t.background=l),Object.assign(t,s[V(e.a.borderId,0)]);let u=L(e,`alignment`),d,f=!1;if(u){let e=u.a.horizontal;e&&e!==`general`&&(d=e,t.textAlign=e===`center`||e===`centerContinuous`?`center`:e===`right`?`right`:e===`justify`||e===`distributed`?`justify`:`left`);let n=u.a.vertical;t.alignItems=n===`top`?`flex-start`:n===`center`?`center`:`flex-end`,f=u.a.wrapText===`1`||u.a.wrapText===`true`,f&&(t.whiteSpace=`pre-wrap`);let r=V(u.a.indent);r&&(t[d===`right`?`paddingRight`:`paddingLeft`]=`${r*9+2}px`);let i=V(u.a.textRotation);i&&(t.textRotate=i===255?255:i>90?90-i:i)}return{numFmt:i.get(n)??Mo[n]??`General`,fontPt:r?.sz??c.sz??11,css:t,hAlign:d,wrap:f}});return u.length||u.push({numFmt:`General`,fontPt:c.sz??11,css:{},wrap:!1}),{xfs:u,baseFont:l}}var Xo=16384,Zo=e=>e.indexOf(`_x`)>=0?e.replace(/_x([0-9A-Fa-f]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16))):e;function Qo(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65)break;t=t*26+((r&-33)-64)}return t-1}function $o(e){let t=``;for(e++;e>0;){let n=(e-1)%26;t=String.fromCharCode(65+n)+t,e=Math.floor((e-1)/26)}return t}function es(e){let t=0;for(;t<e.length&&e.charCodeAt(t)>=65;)t++;return[Number(e.slice(t))-1,Qo(e.slice(0,t))]}function ts(e){let[t,n]=e.replace(/\$/g,``).split(`:`);if(!t)return;let[r,i]=es(t),[a,o]=n?es(n):[r,i];return{r0:r,c0:i,r1:a,c1:o}}var ns=class{constructor(){A(this,`shared`,new Map),A(this,`depOf`,new Map),A(this,`edited`,new Set),A(this,`rowAttrs`,new Map),A(this,`autoRowH`,new Map),A(this,`structural`,!1),A(this,`dirtyCols`,!1),A(this,`dirtyMerges`,!1),A(this,`dirtyView`,!1),A(this,`dirtyRows`,new Set),A(this,`formulaChanged`,!1),A(this,`uncached`,[]),A(this,`rows`,[]),A(this,`maxRow`,-1),A(this,`maxCol`,-1),A(this,`formulas`,new Map),A(this,`merges`,[]),A(this,`colInfo`,[]),A(this,`defaultColW`,64),A(this,`defaultRowH`,20),A(this,`frozen`,{rows:0,cols:0}),A(this,`gridLines`,!0),A(this,`done`,!1),A(this,`error`,void 0),A(this,`loading`,void 0)}},rs=class{constructor(e,t=[],n=11){A(this,`d`,void 0),A(this,`fontPt`,void 0),A(this,`basePt`,void 0),A(this,`row`,-1),A(this,`rowCells`,null),A(this,`col`,-1),A(this,`cType`,``),A(this,`cStyle`,0),A(this,`val`,``),A(this,`formula`,``),A(this,`hasVal`,!1),A(this,`capture`,0),A(this,`fShared`,-1),A(this,`inIs`,!1),A(this,`newSizes`,[]),A(this,`headerReady`,!1),A(this,`rowHasHt`,!1),A(this,`rowMaxPt`,0),this.d=e,this.fontPt=t,this.basePt=n}open(e,t){switch(e){case`c`:{let e=t.r;this.col=e?es(e)[1]:this.col+1,this.cType=t.t??``,this.cStyle=t.s?Number(t.s):0,this.val=``,this.formula=``,this.hasVal=!1;return}case`v`:this.capture=1,this.hasVal=!0;return;case`f`:this.capture=2,this.fShared=t.t===`shared`&&t.si!==void 0?Number(t.si):-1;return;case`is`:this.inIs=!0,this.hasVal=!0;return;case`t`:this.inIs&&(this.capture=3);return;case`rPh`:return!0;case`row`:{this.headerReady=!0,this.row=t.r?Number(t.r)-1:this.row+1,this.col=-1,this.rowCells=[];let e=t.hidden===`1`||t.hidden===`true`;if((e||t.ht)&&this.d.rowAttrs.set(this.row,{ht:t.ht?Number(t.ht):void 0,hidden:e||void 0}),this.rowHasHt=e||!!t.ht,this.rowMaxPt=0,e)this.newSizes.push([this.row,0]);else if(t.ht){let e=Math.round(Number(t.ht)*4/3);e!==this.d.defaultRowH&&this.newSizes.push([this.row,e])}return}case`sheetFormatPr`:{let e=V(t.defaultRowHeight);e&&(this.d.defaultRowH=Math.round(e*4/3));let n=V(t.defaultColWidth),r=V(t.baseColWidth);n?this.d.defaultColW=Math.round(n*7):r!==void 0&&(this.d.defaultColW=Math.round(r*7+8));return}case`col`:{let e=Number(t.min)-1,n=Math.min(Number(t.max)-1,16383),r=t.hidden===`1`||t.hidden===`true`?0:t.width?Math.round(Number(t.width)*7):this.d.defaultColW;this.d.colInfo.push({min:e,max:n,w:r});return}case`pane`:(t.state===`frozen`||t.state===`frozenSplit`)&&(this.d.frozen={rows:Math.round(V(t.ySplit,0)),cols:Math.round(V(t.xSplit,0))});return;case`sheetView`:(t.showGridLines===`0`||t.showGridLines===`false`)&&(this.d.gridLines=!1);return;case`sheetData`:this.headerReady=!0;return;case`mergeCell`:{let e=t.ref?ts(t.ref):void 0;e&&this.d.merges.push(e);return}case`extLst`:case`conditionalFormatting`:case`dataValidations`:case`headerFooter`:return!0}}close(e){switch(e){case`v`:case`f`:case`t`:this.capture=0;return;case`is`:this.inIs=!1;return;case`c`:{let e=this.rowCells;if(!e)return;let t=this.col;t>this.d.maxCol&&(this.d.maxCol=t);let n=this.row*Xo+t;if(this.formula&&this.d.formulas.set(n,this.formula),this.fShared>=0&&(this.formula?this.d.shared.set(this.fShared,{master:n,text:this.formula}):this.d.depOf.set(n,this.fShared),this.fShared=-1),!this.hasVal||this.formula&&this.val===``&&this.cType!==`str`){this.formula?(this.d.uncached.push(this.row*Xo+t),e.push(t,6,``,this.cStyle)):this.cStyle&&e.push(t,6,``,this.cStyle);return}let r=0,i;switch(this.cType){case`s`:r=1,i=Number(this.val);break;case`str`:case`inlineStr`:r=2,i=Zo(this.val);break;case`b`:r=3,i=+(this.val===`1`||this.val===`true`);break;case`e`:r=4,i=this.val;break;case`d`:r=5,i=this.val;break;default:{let e=Number(this.val);this.val===``||Number.isNaN(e)?(r=this.val===``?6:2,i=this.val):i=e}}if(e.push(t,r,i,this.cStyle),!this.rowHasHt){let e=this.fontPt[this.cStyle]??this.basePt;e>this.rowMaxPt&&(this.rowMaxPt=e)}return}case`row`:if(!this.rowHasHt&&this.rowMaxPt>this.basePt*1.15){let e=Math.round(this.rowMaxPt*(4/3)*1.3+3);e>this.d.defaultRowH&&(this.newSizes.push([this.row,e]),this.d.autoRowH.set(this.row,e))}this.rowCells&&this.rowCells.length&&(this.d.rows[this.row]=this.rowCells),this.row>this.d.maxRow&&(this.d.maxRow=this.row),this.rowCells=null;return}}text(e){this.capture===1?this.val+=e:this.capture===2?this.formula+=e:this.capture===3&&(this.val+=e)}},is=class{constructor(){A(this,`strings`,[]),A(this,`cur`,``),A(this,`capture`,!1)}open(e){if(e===`si`)this.cur=``;else if(e===`t`)this.capture=!0;else if(e===`rPh`||e===`phoneticPr`)return!0}close(e){e===`t`?this.capture=!1:e===`si`&&this.strings.push(Zo(this.cur))}text(e){this.capture&&(this.cur+=e)}},as=class e{constructor(e,t,n,r,i,a,o){A(this,`pkg`,void 0),A(this,`mainPath`,void 0),A(this,`rels`,void 0),A(this,`sheets`,void 0),A(this,`styles`,void 0),A(this,`date1904`,void 0),A(this,`theme`,void 0),A(this,`sheetsData`,new Map),A(this,`calc`,new Ao(this)),A(this,`sst`,[]),A(this,`sstLoading`,void 0),this.pkg=e,this.mainPath=t,this.rels=n,this.sheets=r,this.styles=i,this.date1904=a,this.theme=o}static async open(t,n){let r=await t.xml(n),i=await t.rels(n),a=[];for(let e of R(L(r,`sheets`),`sheet`)){let t=i.get(e.a[`r:id`]);t&&t.type.endsWith(`/worksheet`)&&a.push({name:e.a.name??`Sheet${a.length+1}`,index:a.length,path:t.target,hidden:!!e.a.state&&e.a.state!==`visible`})}let o=Ve(i,`theme`),s=Ge(o?await t.xml(o.target):void 0),c=Ve(i,`styles`),l=Yo(c?await t.xml(c.target):void 0,s),u=L(r,`workbookPr`),d=u?.a.date1904===`1`||u?.a.date1904===`true`;return new e(t,n,i,a,l,d,s)}meta(){return{sheets:this.sheets,styles:this.styles.xfs.map(e=>e.css),formats:this.styles.xfs.map(e=>e.numFmt),baseFont:this.styles.baseFont,date1904:this.date1904}}loadSst(e){return this.sstLoading||(this.sstLoading=(async()=>{let t=Ve(this.rels,`sharedStrings`);if(!t||!this.pkg.has(t.target))return;let n=new is;this.sst=n.strings,await Te(await this.pkg.stream(t.target,e),n)})()),this.sstLoading}loadSheet(e,t,n){let r=this.sheetsData.get(e);if(r)return t(this.snapshot(e,r,os(r),!0)),r.loading??Promise.resolve();let i=new ns;return this.sheetsData.set(e,i),i.loading=(async()=>{let r=this.sheets[e];if(!r)throw Error(`No sheet #${e}`);try{await this.loadSst((e,t)=>n?.(`strings`,e,t));let a=new rs(i,this.styles.xfs.map(e=>e.fontPt),this.styles.xfs[0]?.fontPt??11),o=!1,s=0;if(await Te(await this.pkg.stream(r.path,(e,t)=>n?.(`sheet`,e,t)),a,{onChunk:async()=>{let n=Date.now();!o&&a.headerReady?(o=!0,t(this.snapshot(e,i,a.newSizes.splice(0),!0)),s=n,await new Promise(e=>setTimeout(e,0))):n-s>150&&(s=n,t(this.snapshot(e,i,a.newSizes.splice(0),!1)),await new Promise(e=>setTimeout(e,0)))}}),i.done=!0,t({...this.snapshot(e,i,a.newSizes.splice(0),!o),merges:i.merges}),i.uncached.length){let n=i.uncached.splice(0);(async()=>{await Promise.all(this.sheets.map(t=>t.index===e?null:this.loadSheet(t.index,()=>{}))),this.calc.invalidate(),this.calc.computeMissing(e,n),t({...this.snapshot(e,i,[],!1),recalc:!0})})()}}catch(n){i.done=!0,i.error=n.message,t({...this.snapshot(e,i,[],!0),error:i.error})}})(),i.loading}snapshot(e,t,n,r){let i={sheet:e,rows:t.maxRow+1,cols:t.maxCol+1,rowSizes:n,done:t.done};return r&&(i.colInfo=t.colInfo,i.defaultColW=t.defaultColW,i.defaultRowH=t.defaultRowH,i.frozen=t.frozen,i.gridLines=t.gridLines),t.done&&(i.merges=t.merges),t.error&&(i.error=t.error),i}block(e,t,n){let r=this.sheetsData.get(e),i=[];if(!r)return{sheet:e,r0:t,r1:n,rows:i,complete:!1};let a=this.styles.xfs,o=Math.min(n,r.rows.length);for(let e=t;e<o;e++){let t=r.rows[e];if(!t)continue;let n=[];for(let e=0;e<t.length;e+=4){let r=t[e],i=t[e+1],o=t[e+2],s=t[e+3],c=a[s]??a[0];switch(i){case 0:{let e=Ko(o,c.numFmt,this.date1904);n.push(e.color?[r,e.text,s,1,e.color]:[r,e.text,s,1]);break}case 1:n.push([r,qo(this.sst[o]??``,c.numFmt),s,0]);break;case 2:n.push([r,qo(o,c.numFmt),s,0]);break;case 3:n.push([r,o?`TRUE`:`FALSE`,s,2]);break;case 4:n.push([r,o,s,2]);break;case 5:n.push([r,o.replace(`T00:00:00`,``).replace(`T`,` `).replace(/Z$/,``),s,1]);break;default:n.push([r,``,s,0])}}i.push({r:e,cells:n})}return{sheet:e,r0:t,r1:n,rows:i,complete:r.done||n<=r.maxRow}}find(e,t,n={},r=2e4){let i=this.sheetsData.get(e),a=[];if(!i||!t)return a;let o=e=>n.matchCase?e:e.toLowerCase(),s=o(t),c=this.styles.xfs;for(let e=0;e<i.rows.length&&a.length<r;e++){let t=i.rows[e];if(t)for(let l=0;l<t.length&&a.length<r;l+=4){let r=t[l],u=t[l+1],d=t[l+2],f=n.formulas?i.formulas.get(e*Xo+r):void 0,p;if(p=f?`=`+f:u===0?Ko(d,(c[t[l+3]]??c[0])?.numFmt,this.date1904).text:u===1?this.sst[d]??``:u===3?d?`TRUE`:`FALSE`:u===6?``:String(d),!p)continue;let m=o(p);(n.whole?m===s:m.includes(s))&&a.push({r:e,c:r,text:p})}}return a}cell(e,t,n){let r=this.sheetsData.get(e),i=r?.rows[t],a=r?.formulas.get(t*Xo+n);if(!i)return a?{value:``,formula:`=`+a,type:`formula`}:void 0;for(let e=0;e<i.length;e+=4){if(i[e]!==n)continue;let t=i[e+1],r=i[e+2],o=t===1?this.sst[r]??``:t===3?r?`TRUE`:`FALSE`:String(r),s=[`number`,`string`,`string`,`boolean`,`error`,`date`,`empty`][t];return{value:o,formula:a?`=`+a:void 0,type:s}}return a?{value:``,formula:`=`+a,type:`formula`}:void 0}unload(e){this.sheetsData.get(e)?.done&&this.sheetsData.delete(e)}};function os(e){let t=[];for(let[n,r]of e.autoRowH)e.rowAttrs.has(n)||t.push([n,r]);for(let[n,r]of e.rowAttrs)t.push([n,r.hidden?0:r.ht===void 0?e.autoRowH.get(n)??e.defaultRowH:Math.round(r.ht*4/3)]);return t}function ss(e){return{rows:e.rows.map(e=>e&&e.slice()),formulas:new Map(e.formulas),merges:e.merges.map(e=>({...e})),colInfo:e.colInfo.map(e=>({...e})),rowAttrs:new Map([...e.rowAttrs].map(([e,t])=>[e,{...t}])),autoRowH:new Map(e.autoRowH),maxRow:e.maxRow,maxCol:e.maxCol,frozen:{...e.frozen}}}function cs(e,t){e.rows=t.rows.map(e=>e&&e.slice()),e.formulas=new Map(t.formulas),e.merges=t.merges.map(e=>({...e})),e.colInfo=t.colInfo.map(e=>({...e})),e.rowAttrs=new Map([...t.rowAttrs].map(([e,t])=>[e,{...t}])),e.autoRowH=new Map(t.autoRowH),e.maxRow=t.maxRow,e.maxCol=t.maxCol,e.frozen={...t.frozen},e.structural=!0,e.dirtyCols=e.dirtyMerges=e.dirtyView=!0}function ls(e){for(let[t,n]of e.depOf){let r=e.shared.get(n);if(!r||e.formulas.has(t))continue;let i=Math.floor(t/Xo)-Math.floor(r.master/Xo),a=t%Xo-r.master%Xo;e.formulas.set(t,lo(r.text,i,a))}e.depOf.clear(),e.shared.clear()}function us(e,t,n,r){let i=[];for(let a of e){let[e,o]=t===`row`?[a.r0,a.r1]:[a.c0,a.c1];if(r>0)e>=n&&(e+=r),o>=n&&(o+=r);else{let t=n-r;if(e>=n&&o<t||(e=(e=>e<n?e:e>=t?e+r:n)(e),o=o>=t?o+r:o>=n?n-1:o,o<e))continue}let s=t===`row`?{...a,r0:e,r1:o}:{...a,c0:e,c1:o};(s.r0!==s.r1||s.c0!==s.c1)&&i.push(s)}return i}function ds(e,t,n,r,i,a){ls(e);let o=r-i;if(n===`row`){i>0?e.rows.splice(r,0,...Array(i).fill(void 0)):e.rows.splice(r,-i),e.maxRow=Math.max(-1,e.maxRow+(e.maxRow>=r?i:0));let t=new Map;for(let[n,a]of e.rowAttrs)i<0&&n>=r&&n<o||t.set(n>=r?n+i:n,a);e.rowAttrs=t;let n=new Map;for(let[t,a]of e.autoRowH)i<0&&t>=r&&t<o||n.set(t>=r?t+i:t,a);e.autoRowH=n}else{for(let t=0;t<e.rows.length;t++){let n=e.rows[t];if(!n)continue;let a=[];for(let e=0;e<n.length;e+=4){let t=n[e];i<0&&t>=r&&t<o||a.push(t>=r?t+i:t,n[e+1],n[e+2],n[e+3])}e.rows[t]=a.length?a:void 0}e.maxCol=Math.max(-1,e.maxCol+(e.maxCol>=r?i:0));let t=[];for(let n of e.colInfo){let{min:e,max:a}=n;if(i>0)e>=r&&(e+=i),a>=r&&(a+=i);else if(e>=r&&a<o||(e=e<r?e:e>=o?e+i:r,a=a>=o?a+i:a>=r?r-1:a,a<e))continue;t.push({...n,min:e,max:a})}e.colInfo=t,e.dirtyCols=!0}let s={sheet:t,formulaSheet:t,axis:n,at:r,delta:i},c=new Map;for(let[t,a]of e.formulas){let e=Math.floor(t/Xo),l=t%Xo,u=n===`row`?e:l;i<0&&u>=r&&u<o||(u>=r&&(n===`row`?e+=i:l+=i),c.set(e*Xo+l,fo(a,s)))}e.formulas=c;for(let t of a){if(t.d===e)continue;let n=!1;for(let[e,r]of t.d.formulas){let i=fo(r,{...s,formulaSheet:t.name});i!==r&&(t.d.formulas.set(e,i),t.d.edited.add(e),n=!0)}n&&(t.d.formulaChanged=!0)}e.merges=us(e.merges,n,r,i),n===`row`&&e.frozen.rows>r&&(e.frozen={...e.frozen,rows:Math.max(0,e.frozen.rows+(i>0?i:Math.max(i,r-e.frozen.rows)))}),n===`col`&&e.frozen.cols>r&&(e.frozen={...e.frozen,cols:Math.max(0,e.frozen.cols+(i>0?i:Math.max(i,r-e.frozen.cols)))}),e.structural=!0,e.dirtyMerges=!0,e.dirtyView=!0}function fs(e,t,n){let r=e=>e.r1>=t.r0&&e.r0<=t.r1&&e.c1>=t.c0&&e.c0<=t.c1;e.merges=e.merges.filter(e=>!r(e)),n&&(t.r0!==t.r1||t.c0!==t.c1)&&e.merges.push({...t}),e.dirtyMerges=!0}function ps(e,t,n,r){let i=[];for(let r of e.colInfo)r.max<t||r.min>n?i.push(r):(r.min<t&&i.push({...r,max:t-1}),r.max>n&&i.push({...r,min:n+1}));i.push({min:t,max:n,w:Math.max(0,Math.round(r))}),e.colInfo=i.sort((e,t)=>e.min-t.min),e.dirtyCols=!0}function ms(e,t,n,r){for(let i=t;i<=n;i++)e.rowAttrs.set(i,r>0?{ht:+(r*.75).toFixed(2)}:{...e.rowAttrs.get(i)??{},hidden:!0}),e.dirtyRows.add(i)}var hs=`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,gs=[`b`,`i`,`strike`,`condense`,`extend`,`outline`,`shadow`,`u`,`vertAlign`,`sz`,`color`,`name`,`family`,`charset`,`scheme`],_s=[`fileVersion`,`fileSharing`,`workbookPr`,`workbookProtection`,`bookViews`,`sheets`,`functionGroups`,`externalReferences`,`definedNames`,`calcPr`,`oleSize`,`customWorkbookViews`,`pivotCaches`,`smartTagPr`,`smartTagTypes`,`webPublishing`,`fileRecoveryPr`,`webPublishObjects`,`extLst`],vs=[`numFmts`,`fonts`,`fills`,`borders`,`cellStyleXfs`,`cellXfs`,`cellStyles`,`dxfs`,`tableStyles`,`colors`,`extLst`];function ys(e,t,n){let r=e.rows[t];return!r&&n&&(e.rows[t]=r=[]),r}function bs(e,t,n){let r=e.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4)if(r[e]===n)return[r[e+1],r[e+2],r[e+3]];return null}function xs(e,t,n,r){let i=ys(e,t,!!r);if(!i)return;let a=0;for(;a<i.length&&!(i[a]>=n);a+=4);let o=a<i.length&&i[a]===n;r?(o?(i[a+1]=r[0],i[a+2]=r[1],i[a+3]=r[2]):i.splice(a,0,n,r[0],r[1],r[2]),t>e.maxRow&&(e.maxRow=t),n>e.maxCol&&(e.maxCol=n)):(o&&i.splice(a,4),i.length||(e.rows[t]=void 0))}function Ss(e){let t=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(e),n,r,i;if(t)[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];else{if(t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?: (\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(e),!t)return;[i,r,n]=[Number(t[1]),Number(t[2]),Number(t[3])]}let a=Date.UTC(n,r-1,i,Number(t[4]??0),Number(t[5]??0),Number(t[6]??0));if(Number.isFinite(a))return a/864e5+25569}function Cs(e,t,n=!1){if(e===``)return{e:t?[6,``,t]:null};if(e.startsWith(`=`)&&e.length>1)return{e:[2,e,t],f:e.slice(1)};let r=e.trim();if(/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i.test(r))return{e:[0,Number(r),t]};if(/^[-+]?(\d+\.?\d*|\.\d+)%$/.test(r))return{e:[0,Number(r.slice(0,-1))/100,t]};if(/^(true|false)$/i.test(r))return{e:[3,+!!/^true$/i.test(r),t]};if(n){let e=Ss(r);if(e!==void 0)return{e:[0,e,t]}}return{e:[2,e,t]}}var ws=class{constructor(e){A(this,`nodes`,void 0),A(this,`root`,void 0),A(this,`P`,void 0),A(this,`cache`,new Map),A(this,`found`,new Map),A(this,`changed`,!1),this.nodes=g(e),this.root=b(this.nodes),this.P=y(this.root.q)}section(e){let t=S(this.root,e);return t||(t=E(this.P+e,{count:`0`}),O(this.root,t,e,vs)),t}append(e,t){let n=this.section(e);n.c.push(t),n.self=!1;let r=x(n).length;return T(n,`count`,String(r)),this.changed=!0,r-1}lookup(e){let t=this.found.get(e);if(!t){let n=new Map;x(S(this.root,e)).forEach((e,t)=>{let r=_([e]);n.has(r)||n.set(r,t)}),this.found.set(e,t=n)}return t}intern(e,t){let n=_([t]),r=this.lookup(e),i=r.get(n);if(i!==void 0)return i;let a=this.append(e,t);return r.set(n,a),a}numFmtId(e){for(let[t,n]of Object.entries(Mo))if(n===e)return Number(t);let t=S(this.root,`numFmts`),n=163;for(let r of x(t,`numFmt`)){let t=Number(w(r,`numFmtId`));if(w(r,`formatCode`)===e)return t;n=Math.max(n,t)}return this.append(`numFmts`,E(this.P+`numFmt`,{numFmtId:String(n+1),formatCode:e})),n+1}derive(e,t){let n=e+JSON.stringify(t),r=this.cache.get(n);if(r!==void 0)return r;let i=this.P,a=x(this.section(`cellXfs`),`xf`),o=D(a[e]??a[0]??E(i+`xf`,{numFmtId:`0`,fontId:`0`,fillId:`0`,borderId:`0`}));if([`b`,`i`,`u`,`strike`,`color`,`sz`,`font`].some(e=>e in t)){let e=x(this.section(`fonts`),`font`),n=D(e[Number(w(o,`fontId`)??0)]??e[0]??E(i+`font`)),r=(e,t)=>O(n,t,e,gs);t.b!==void 0&&r(`b`,t.b?E(i+`b`):void 0),t.i!==void 0&&r(`i`,t.i?E(i+`i`):void 0),t.strike!==void 0&&r(`strike`,t.strike?E(i+`strike`):void 0),t.u!==void 0&&r(`u`,t.u?E(i+`u`):void 0),t.sz!==void 0&&r(`sz`,E(i+`sz`,{val:String(t.sz)})),`color`in t&&r(`color`,t.color?E(i+`color`,{rgb:`FF`+t.color.replace(`#`,``).toUpperCase()}):void 0),t.font&&(r(`name`,E(i+`name`,{val:t.font})),r(`scheme`,void 0)),T(o,`fontId`,String(this.intern(`fonts`,n))),T(o,`applyFont`,`1`)}if(`fill`in t){if(!t.fill)T(o,`fillId`,`0`);else{let e=g(`<${i}fill><${i}patternFill patternType="solid"><${i}fgColor rgb="FF${t.fill.replace(`#`,``).toUpperCase()}"/><${i}bgColor indexed="64"/></${i}patternFill></${i}fill>`)[0];T(o,`fillId`,String(this.intern(`fills`,e)))}T(o,`applyFill`,`1`)}if(t.border){let e=t.sides??{},n=x(this.section(`borders`),`border`),r=D(n[Number(w(o,`borderId`)??0)]??n[0]??E(i+`border`)),a=(t.borderColor??`#000000`).replace(`#`,``).toUpperCase(),s=[`left`,`start`,`right`,`end`,`top`,`bottom`,`diagonal`,`vertical`,`horizontal`];for(let n of[`left`,`right`,`top`,`bottom`])n in e&&O(r,e[n]?E(i+n,{style:t.borderStyle??`thin`},[E(i+`color`,{rgb:`FF`+a})]):E(i+n),n,s);S(r,`diagonal`)||O(r,E(i+`diagonal`),`diagonal`,s),T(o,`borderId`,String(this.intern(`borders`,r))),T(o,`applyBorder`,`1`)}if(`align`in t||`wrap`in t||`valign`in t||`rotate`in t){let e=D(S(o,`alignment`)??E(i+`alignment`));if(`align`in t&&T(e,`horizontal`,t.align??void 0),`valign`in t&&T(e,`vertical`,t.valign&&t.valign!==`bottom`?t.valign:void 0),`wrap`in t&&T(e,`wrapText`,t.wrap?`1`:void 0),`rotate`in t){let n=t.rotate;T(e,`textRotation`,n?n===255?`255`:String(n>0?Math.min(90,n):90+Math.min(90,-n)):void 0)}O(o,e.a.trim()?e:void 0,`alignment`,[`alignment`,`protection`,`extLst`]),T(o,`applyAlignment`,`1`)}t.numFmt!==void 0&&(T(o,`numFmtId`,String(this.numFmtId(t.numFmt))),T(o,`applyNumberFormat`,`1`));let s=this.intern(`cellXfs`,o);return this.cache.set(n,s),s}xml(){return _(this.nodes)}mark(){let e={};for(let t of[`numFmts`,`fonts`,`fills`,`borders`,`cellXfs`])e[t]=x(S(this.root,t)).length;return e}truncate(e){for(let[t,n]of Object.entries(e)){let e=S(this.root,t),r=x(e);if(!e||r.length<=n)continue;let i=new Set(r.slice(n));e.c=e.c.filter(e=>!i.has(e)),T(e,`count`,String(n));let a=this.found.get(t);if(a)for(let[e,t]of a)t>=n&&a.delete(e)}for(let[t,n]of this.cache)n>=e.cellXfs&&this.cache.delete(t)}},Ts=class{constructor(e){A(this,`wb`,void 0),A(this,`undoStack`,[]),A(this,`redoStack`,[]),A(this,`styleEd`,void 0),A(this,`stylesPath`,void 0),A(this,`formulaTouched`,!1),A(this,`lastRecalc`,[]),A(this,`bookChanged`,!1),A(this,`newSheets`,new Map),this.wb=e}get dirty(){return[...this.wb.sheetsData.values()].some(Ds)||!!this.styleEd?.changed||this.bookChanged}sheet(e){let t=this.wb.sheetsData.get(e);if(!t||!t.done)throw Error(`Sheet is still loading`);return t}apply(e,t,n){let r=[...this.wb.sheetsData].find(([,t])=>t===e)?.[0]??0,i=[];this.applyRaw(e,t,n);for(let e of t){let t=n===`prev`?e.nextF:e.prevF,a=n===`prev`?e.prevF:e.nextF;t!==a&&this.wb.calc.formulaChanged(r,e.key),a&&i.push({sheet:r,key:e.key})}let a=t.filter(e=>{if(n===`prev`?e.prevF:e.nextF)return!1;let t=e.prev,r=e.next;return!t||!r||t[0]!==r[0]||t[1]!==r[1]||e.prevF!==e.nextF});this.lastRecalc=a.length||i.length?[...this.wb.calc.recalc(a.map(e=>({sheet:r,key:e.key})),i)]:[]}applyRaw(e,t,n){for(let r of t){xs(e,Math.floor(r.key/Xo),r.key%Xo,n===`prev`?r.prev:r.next);let t=n===`prev`?r.prevF:r.nextF;t?e.formulas.set(r.key,t):e.formulas.delete(r.key),e.edited.add(r.key),(r.prevF||r.nextF)&&(this.formulaTouched=!0)}}record(e,t,n){return this.undoStack.push({sheet:e,cells:t,range:n}),this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],{sheet:e,range:n,recalc:this.lastRecalc}}recalcAll(){this.wb.calc.invalidate();let e=[];for(let[t,n]of this.wb.sheetsData)for(let r of n.formulas.keys())e.push({sheet:t,key:r});return[...this.wb.calc.recalc([],e)]}setCells(e,t){let n=this.sheet(e),r=[],i={r0:1/0,c0:1/0,r1:-1,c1:-1};for(let{r:e,c:a,input:o}of t){let t=e*Xo+a,s=bs(n,e,a),c=s?.[2]??0,{e:l,f:u}=Cs(o,c,zo(this.wb.styles.xfs[c]?.numFmt??``));r.push({key:t,prev:s,prevF:n.formulas.get(t),next:l,nextF:u}),i.r0=Math.min(i.r0,e),i.c0=Math.min(i.c0,a),i.r1=Math.max(i.r1,e),i.c1=Math.max(i.c1,a)}return this.apply(n,r,`next`),this.record(e,r,i)}async styles(){if(!this.styleEd){let e=Ve(this.wb.rels,`styles`);this.stylesPath=e?.target??`xl/styles.xml`;let t=this.wb.pkg.has(this.stylesPath)?await this.wb.pkg.text(this.stylesPath):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
18
|
+
`||a===`\r`||a===` `||a===`\xA0`){for(;r<n&&/[\s\u00A0]/.test(e[r]);)r++;t.push({t:`ws`,s:o,e:r});continue}if(a===`"`){let i=``;for(r++;;){if(r>=n)throw new Or(`unterminated string`,o);if(e[r]===`"`){if(e[r+1]===`"`){i+=`"`,r+=2;continue}r++;break}i+=e[r++]}t.push({t:`str`,v:i,s:o,e:r});continue}if(a===`#`){let n=Hr(e,r);if(!n)throw new Or(`bad error literal`,r);t.push({t:`err`,v:n[0],s:o,e:n[1]}),r=n[1];continue}if(a===`'`){let t=``,a=r+1;for(;;){if(a>=n)throw new Or(`unterminated sheet name`,o);if(e[a]===`'`){if(e[a+1]===`'`){t+=`'`,a+=2;continue}break}t+=e[a++]}if(e[a+1]!==`!`)throw new Or(`expected '!' after sheet name`,a+1);r=i(o,a+2,t,e.slice(r,a+1));continue}if(a===`[`){let t=/\[\d+\][\w.\u00A1-\uFFFF]+!/y;if(t.lastIndex=r,!t.exec(e))throw new Or(`unexpected '['`,r);let n=t.lastIndex-1,a=e.slice(r,n);r=i(o,n+1,a,a);continue}if(`(){},;`.includes(a)){t.push({t:`punc`,v:a,s:o,e:++r});continue}let s=e.slice(r,r+2);if(s===`<=`||s===`>=`||s===`<>`)t.push({t:`op`,v:s,s:o,e:r+=2});else if(`+-*/^&=<>%:`.includes(a))t.push({t:`op`,v:a,s:o,e:++r});else if(a>=`0`&&a<=`9`||a===`.`&&/\d/.test(e[r+1]??``)||a===`$`&&/\d/.test(e[r+1]??``)){let n=Vr(e,r);if(n&&n.ref.kind===`rows`){t.push({t:`ref`,ref:n.ref,s:o,e:n.end}),r=n.end;continue}let i=Lr(Fr,e,r);if(!i||a===`$`)throw new Or(`bad number`,r);r+=i[0].length,t.push({t:`num`,v:Number(i[0]),s:o,e:r})}else if(Rr(a)){let a=r;for(;a<n&&Rr(e[a]);)a++;let s=e.slice(r,a);if(e[a]===`!`){r=i(o,a+1,s,s);continue}if(e[a]===`(`){t.push({t:`func`,v:Ur(s),s:o,e:a}),r=a;continue}let c=Vr(e,r);if(c){t.push({t:`ref`,ref:c.ref,s:o,e:c.end}),r=c.end;continue}let l=s.toUpperCase();if(l===`TRUE`||l===`FALSE`){t.push({t:`bool`,v:l===`TRUE`,s:o,e:a}),r=a;continue}if(e[a]===`[`){let t=0;do e[a]===`[`?t++:e[a]===`]`&&t--,a++;while(a<n&&t>0);if(t>0)throw new Or(`unterminated [`,r)}t.push({t:`name`,v:e.slice(r,a),s:o,e:a}),r=a}else throw new Or(`unexpected character '${a}'`,r)}return t}function Gr(e){let t;try{t=Wr(e.trim()).filter(e=>e.t!==`ws`)}catch{return null}let n=t[0];if(!n||n.t!==`ref`)return null;if(t.length===1)return n.ref;let r=t[1],i=t[2];return t.length!==3||r.t!==`op`||r.v!==`:`||i.t!==`ref`||i.ref.sheet!==void 0&&(n.ref.sheet??``).toLowerCase()!==i.ref.sheet.toLowerCase()?null:Er({...n.ref,kind:`area`,r0:Math.min(n.ref.r0,i.ref.r0),c0:Math.min(n.ref.c0,i.ref.c0),r1:Math.max(n.ref.r1,i.ref.r1),c1:Math.max(n.ref.c1,i.ref.c1)})}var Kr=new Set([`=`,`<>`,`<`,`>`,`<=`,`>=`]),qr=class{constructor(e){A(this,`toks`,void 0),A(this,`i`,0),this.toks=e}peek(){return this.toks[this.i]}isOp(...e){let t=this.toks[this.i];return t&&t.t===`op`&&e.includes(t.v)?t.v:void 0}isPunc(e){let t=this.toks[this.i];return!!t&&t.t===`punc`&&t.v===e}fail(e){let t=this.toks[this.i];throw new Or(e,t?t.s:-1)}expectPunc(e){this.isPunc(e)||this.fail(`expected '${e}'`),this.i++}expr(){let e=this.concat();for(let t=this.cmpOp();t;t=this.cmpOp())this.i++,e={type:`binary`,op:t,left:e,right:this.concat()};return e}cmpOp(){let e=this.peek();return e&&e.t===`op`&&Kr.has(e.v)?e.v:void 0}concat(){let e=this.add();for(;this.isOp(`&`);)this.i++,e={type:`binary`,op:`&`,left:e,right:this.add()};return e}add(){let e=this.mul();for(let t=this.isOp(`+`,`-`);t;t=this.isOp(`+`,`-`))this.i++,e={type:`binary`,op:t,left:e,right:this.mul()};return e}mul(){let e=this.pow();for(let t=this.isOp(`*`,`/`);t;t=this.isOp(`*`,`/`))this.i++,e={type:`binary`,op:t,left:e,right:this.pow()};return e}pow(){let e=this.postfix();for(;this.isOp(`^`);)this.i++,e={type:`binary`,op:`^`,left:e,right:this.postfix()};return e}postfix(){let e=this.unary();for(;this.isOp(`%`);)this.i++,e={type:`percent`,arg:e};return e}unary(){let e=this.isOp(`-`,`+`);return e?(this.i++,{type:`unary`,op:e,arg:this.unary()}):this.range()}range(){let e=this.primary();for(;this.isOp(`:`);)this.i++,e={type:`range`,left:e,right:this.primary()};return e}primary(){let e=this.peek();switch(e||this.fail(`unexpected end of formula`),this.i++,e.t){case`num`:return{type:`num`,value:e.v};case`str`:return{type:`str`,value:e.v};case`bool`:return{type:`bool`,value:e.v};case`err`:return{type:`err`,code:e.v};case`ref`:return{type:`ref`,ref:e.ref};case`name`:return e.sheet===void 0?{type:`name`,name:e.v}:{type:`name`,name:e.v,sheet:e.sheet};case`func`:return this.expectPunc(`(`),{type:`call`,name:e.v,args:this.args()};case`punc`:if(e.v===`(`){let e=this.expr();if(!this.isPunc(`,`))return this.expectPunc(`)`),e;let t=[e];for(;this.isPunc(`,`);)this.i++,t.push(this.expr());return this.expectPunc(`)`),{type:`union`,items:t}}if(e.v===`{`)return this.array()}return this.i--,this.fail(`unexpected token`)}args(){let e=[];if(this.isPunc(`)`))return this.i++,e;for(;;){if(e.push(this.isPunc(`,`)||this.isPunc(`)`)?{type:`missing`}:this.expr()),this.isPunc(`)`))return this.i++,e;this.expectPunc(`,`)}}array(){let e=[[]];for(;;){e[e.length-1].push(this.arrayItem());let t=this.peek();if(t&&t.t===`punc`||this.fail(`bad array constant`),this.i++,t.v===`}`)break;t.v===`;`?e.push([]):t.v!==`,`&&this.fail(`bad array constant`)}return e.some(t=>t.length!==e[0].length)&&this.fail(`array rows differ in length`),{type:`array`,rows:e}}arrayItem(){let e=this.isOp(`-`,`+`);e&&this.i++;let t=this.peek();return t||this.fail(`bad array constant`),this.i++,t.t===`num`?e===`-`?-t.v:t.v:(e&&this.fail(`bad array constant`),t.t===`str`||t.t===`bool`?t.v:t.t===`err`?new U(t.v):(this.i--,this.fail(`bad array constant`)))}};function Jr(e){let t=Wr(e.startsWith(`=`)?e.slice(1):e).filter(e=>e.t!==`ws`);if(!t.length)throw new Or(`empty formula`,0);let n=new qr(t),r=n.expr();if(n.i<t.length)throw new Or(`unexpected token`,t[n.i].s);return r}var Yr=864e5,Xr=Date.UTC(1899,11,30),Zr=Date.UTC(1904,0,1),Qr=!1;function $r(){return Qr}function ei(e){Qr=e}function ti(e,t,n){let r=new Date(0);return r.setUTCFullYear(e,t-1,n),r.getTime()}function ni(e,t,n){let r=ti(e,t,n);if(Qr)return Math.round((r-Zr)/Yr);let i=Math.round((r-Xr)/Yr);return i<61?i-1:i}function ri(e){let t=Math.floor(e);if(Qr){let e=new Date(Zr+t*Yr);return{y:e.getUTCFullYear(),m:e.getUTCMonth()+1,d:e.getUTCDate(),dow:((t+5)%7+7)%7}}let n=((t-1)%7+7)%7;if(t===60)return{y:1900,m:2,d:29,dow:n};if(t===0)return{y:1900,m:1,d:0,dow:n};let r=new Date(Xr+(t<60?t+1:t)*Yr);return{y:r.getUTCFullYear(),m:r.getUTCMonth()+1,d:r.getUTCDate(),dow:n}}function ii(e){return Math.round((e-Math.floor(e))*86400)%86400}function ai(e,t){return new Date(ti(e,t+1,0)).getUTCDate()}function oi(e){return ni(e.getFullYear(),e.getMonth()+1,e.getDate())+(e.getHours()*3600+e.getMinutes()*60+e.getSeconds()+e.getMilliseconds()/1e3)/86400}var si=/^(\d{1,4}):(\d{1,2})(?::(\d{1,2}(?:\.\d+)?))?\s*([ap]m?)?$/i,ci=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[T\s]+(.+))?$/i,li=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4}|\d{2})(?:\s+(.+))?$/;function ui(e){let t=si.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=t[3]?Number(t[3]):0;if(r>59||i>=60)return null;if(t[4]){if(n<1||n>12)return null;let e=t[4][0].toLowerCase()===`p`;n=n%12+(e?12:0)}return(n*3600+r*60+i)/86400}function di(e,t,n){if(t<1||t>12||n<1||n>ai(e,t))return null;let r=ni(e,t,n);return r<0?null:r}function fi(e){let t=ci.exec(e),n=null,r;if(t)n=di(Number(t[1]),Number(t[2]),Number(t[3])),r=t[4];else if(t=li.exec(e)){let e=Number(t[3]);t[3].length===2&&(e+=e<30?2e3:1900),n=di(e,Number(t[1]),Number(t[2])),r=t[4]}else return ui(e);if(n===null)return null;if(r===void 0)return n;let i=ui(r);return i===null?null:n+i}var pi=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],mi=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function hi(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];a===`\\`&&!r?(n+=a+(e[i+1]??``),i++):(a===`"`&&(r=!r),a===`;`&&!r?(t.push(n),n=``):n+=a)}return t.push(n),t}function gi(e){return e.replace(/"[^"]*"/g,``).replace(/\\./g,``).replace(/\[[^\]]*\]/g,``).replace(/[_*]./g,``)}function _i(e){return/[ymdhs]/i.test(gi(e))||/\[(h+|m+|s+)\]/i.test(e)}function vi(e,t){let n=[];for(let e=0;e<t.length;){let r=t[e],i=r.toLowerCase();if(r===`"`){let r=t.indexOf(`"`,e+1),i=r<0?t.length:r;n.push({k:`lit`,v:t.slice(e+1,i)}),e=i+1}else if(r===`\\`)n.push({k:`lit`,v:t[e+1]??``}),e+=2;else if(r===`_`)n.push({k:`lit`,v:` `}),e+=2;else if(r===`*`)e+=2;else if(r===`[`){let r=t.indexOf(`]`,e),i=t.slice(e+1,r<0?t.length:r).toLowerCase();/^h+$/.test(i)?n.push({k:`H`,n:i.length}):/^m+$/.test(i)?n.push({k:`N`,n:i.length}):/^s+$/.test(i)&&n.push({k:`S`,n:i.length}),e=r<0?t.length:r+1}else if(t.slice(e,e+5).toUpperCase()===`AM/PM`)n.push({k:`ap`,v:t.slice(e,e+5)}),e+=5;else if(t.slice(e,e+3).toUpperCase()===`A/P`)n.push({k:`ap`,v:t.slice(e,e+3)}),e+=3;else if(`ymdhs`.includes(i)){let r=e;for(;r<t.length&&t[r].toLowerCase()===i;)r++;n.push({k:i===`m`?`M`:i,n:r-e}),e=r}else n.push({k:`lit`,v:r}),e++}let r=n.filter(e=>e.k!==`lit`);r.forEach((e,t)=>{if(e.k!==`M`||e.n>2)return;let n=r[t-1],i=r[t+1];(n&&(n.k===`h`||n.k===`H`)||i&&(i.k===`s`||i.k===`S`))&&(e.k=`m`)});let i=n.some(e=>e.k===`ap`),a=Math.floor(e),o=Math.round((e-a)*86400);o>=86400&&(a++,o-=86400);let s=ri(a),c=Math.floor(o/3600),l=Math.floor(o%3600/60),u=o%60,d=(e,t)=>String(e).padStart(t,`0`),f=``;for(let e of n)switch(e.k){case`lit`:f+=e.v;break;case`y`:f+=e.n<=2?d(s.y%100,2):d(s.y,4);break;case`M`:f+=e.n===1?s.m:e.n===2?d(s.m,2):e.n===3?pi[s.m-1].slice(0,3):e.n===4?pi[s.m-1]:pi[s.m-1][0];break;case`d`:f+=e.n===1?s.d:e.n===2?d(s.d,2):e.n===3?mi[s.dow].slice(0,3):mi[s.dow];break;case`h`:{let t=i?c%12||12:c;f+=e.n>=2?d(t,2):t;break}case`m`:f+=e.n>=2?d(l,2):l;break;case`s`:f+=e.n>=2?d(u,2):u;break;case`H`:f+=d(a*24+c,e.n);break;case`N`:f+=d((a*24+c)*60+l,e.n);break;case`S`:f+=d(((a*24+c)*60+l)*60+u,e.n);break;case`ap`:{let t=c<12,n=e.v.length===5?t?e.v.slice(0,2):e.v.slice(3,5):t?e.v[0]:e.v[2];f+=n;break}}return f}var yi=class{constructor(e,t,n,r,i){A(this,`sheet`,void 0),A(this,`r0`,void 0),A(this,`c0`,void 0),A(this,`r1`,void 0),A(this,`c1`,void 0),this.sheet=e,this.r0=t,this.c0=n,this.r1=r,this.c1=i}get h(){return this.r1-this.r0+1}get w(){return this.c1-this.c0+1}},bi=class{constructor(e){A(this,`data`,void 0),this.data=e}get h(){return this.data.length}get w(){return this.data[0]?.length??0}},xi=class{constructor(e){A(this,`areas`,void 0),this.areas=e}},Si=/^([+-])?\s*\$?\s*((?:\d{1,3}(?:,\d{3})+|\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*(%?)$/;function Ci(e){let t=e.trim();if(!t)return null;let n=Si.exec(t);if(n&&/\d/.test(n[2])){let e=Number(n[2].replace(/,/g,``));if(!Number.isNaN(e))return(n[1]===`-`?-e:e)/(n[3]?100:1)}return fi(t)}function wi(e){if(!Number.isFinite(e))return`#NUM!`;if(e===0)return`0`;let[t,n]=Math.abs(e).toExponential(14).split(`e`),r=Number(n),i=t.replace(`.`,``).replace(/0+$/,``),a=e<0?`-`:``;if(r>=15||r<-9)return`${a}${i[0]+(i.length>1?`.${i.slice(1)}`:``)}E${r<0?`-`:`+`}${String(Math.abs(r)).padStart(2,`0`)}`;if(r<0)return`${a}0.${`0`.repeat(-r-1)}${i}`;let o=i.slice(0,r+1).padEnd(r+1,`0`),s=i.slice(r+1);return a+o+(s?`.${s}`:``)}function Ti(e){if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e==`boolean`)return+!!e;if(typeof e==`string`){let t=Ci(e);return t===null?W.VALUE:t}return e}function Ei(e){return typeof e==`string`?e:typeof e==`number`?wi(e):e===null?``:typeof e==`boolean`?e?`TRUE`:`FALSE`:e}function Di(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e!==0;if(e===null)return!1;if(typeof e==`string`){let t=e.toUpperCase();return t===`TRUE`||t!==`FALSE`&&W.VALUE}return e}function G(e){let t=Ti(e);if(t instanceof U)throw t;return t}function Oi(e){return Math.trunc(G(e))}function ki(e){let t=Ei(e);if(t instanceof U)throw t;return t}function Ai(e){let t=Di(e);if(t instanceof U)throw t;return t}function ji(e,t){return e===t||Math.abs(e-t)<=Math.max(Math.abs(e),Math.abs(t))*1e-15}var Mi=e=>typeof e==`number`?0:typeof e==`string`?1:2;function Ni(e,t){if(e===null&&(e=typeof t==`string`?``:typeof t!=`boolean`&&0),t===null&&(t=typeof e==`string`?``:typeof e!=`boolean`&&0),e instanceof U||t instanceof U)return 0;let n=Mi(e),r=Mi(t);if(n!==r)return n<r?-1:1;if(typeof e==`number`){let n=t;return ji(e,n)?0:e<n?-1:1}if(typeof e==`string`){let n=e.toLowerCase(),r=t.toLowerCase();return n<r?-1:+(n>r)}return!!e-+!!t}function Pi(e,t){return e===null||t===null?e===t:e instanceof U||t instanceof U?!1:typeof e==typeof t&&Ni(e,t)===0}var Fi=e=>/[*?~]/.test(e);function Ii(e,t=!0){let n=``;for(let t=0;t<e.length;t++){let r=e[t];r===`~`&&t+1<e.length&&`*?~`.includes(e[t+1])?n+=`\\${e[++t]}`:n+=r===`*`?`[\\s\\S]*`:r===`?`?`[\\s\\S]`:r.replace(/[.*+?^${}()|[\]\\/]/g,`\\$&`)}return new RegExp(t?`^${n}$`:n,`i`)}function Li(e,t){switch(e){case`<`:return t<0;case`<=`:return t<=0;case`>`:return t>0;case`>=`:return t>=0;case`<>`:return t!==0;default:return t===0}}var Ri=e=>_r.find(t=>t===e.toUpperCase());function zi(e){if(e instanceof U){let t=e.code;return e=>e instanceof U&&e.code===t}if(e===null&&(e=0),typeof e==`number`){let t=e;return e=>typeof e==`number`&&ji(e,t)||typeof e==`string`&&Ci(e)===t}if(typeof e==`boolean`){let t=e;return e=>e===t}let t=/^(<=|>=|<>|<|>|=)?([\s\S]*)$/.exec(e),n=t[1]??``,r=t[2],i=n===``||n===`=`;if(r===``)return n===``?e=>e===null||e===``:n===`=`?e=>e===null:n===`<>`?e=>e!==null&&e!==``:()=>!1;let a=Ci(r);if(a!==null)return i?e=>typeof e==`number`&&ji(e,a)||typeof e==`string`&&Ci(e)===a:n===`<>`?e=>!(typeof e==`number`&&ji(e,a)):e=>typeof e==`number`&&Li(n,Ni(e,a));let o=r.toUpperCase();if(o===`TRUE`||o===`FALSE`){let e=o===`TRUE`;return i?t=>t===e:n===`<>`?t=>t!==e:t=>typeof t==`boolean`&&Li(n,Ni(t,e))}let s=Ri(r);if(s){let e=e=>e instanceof U&&e.code===s;return n===`<>`?t=>!e(t):t=>e(t)}if(i||n===`<>`){let e=Ii(r),t=t=>typeof t==`string`&&e.test(t);return n===`<>`?e=>!t(e):t}return e=>typeof e==`string`&&Li(n,Ni(e,r))}var K=1/0;function Bi(e){try{return e()}catch(e){if(e instanceof U)return e;throw e}}function Vi(e,t,n){let r=e.length===1?0:t,i=e[0].length===1?0:n;return r<e.length&&i<e[0].length?e[r][i]:W.NA}function q(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!0,fn:(e,t,r)=>{let i=1,a=1,o=!1,s=e.map(e=>{if(e instanceof yi){if(e.h===1&&e.w===1)return t.cell(e.sheet,e.r0,e.c0);if(r)return t.scalar(e)}else if(e instanceof bi){if(e.h===1&&e.w===1)return e.data[0][0]}else if(e instanceof xi)return W.VALUE;else return e;let n=t.toArray(e);return o=!0,i=Math.max(i,n.length),a=Math.max(a,n[0].length),n});if(!o)return Bi(()=>n(s,t));let c=[];for(let e=0;e<i;e++){let r=[];for(let i=0;i<a;i++){let a=s.map(t=>Array.isArray(t)?Vi(t,e,i):t);r.push(Bi(()=>n(a,t)))}c.push(r)}return new bi(c)}}}function J(e,t,n){return{kind:`eager`,min:e,max:t,scalarArgs:!1,fn:n}}function Hi(e,t,n){return{kind:`lazy`,min:e,max:t,fn:n}}function Ui(e,t,n,r){if(e instanceof yi)t.forEach(e,n);else if(e instanceof xi)for(let r of e.areas)t.forEach(r,n);else if(e instanceof bi)for(let t of e.data)for(let e of t)n(e);else r(e)}function Wi(e,t,n){for(let r of e)Ui(r,t,e=>{if(typeof e==`number`)n(e);else if(e instanceof U)throw e},e=>{let t=Ti(e);if(t instanceof U)throw t;n(t)})}function Gi(e,t){let n=[];return Wi(e,t,e=>n.push(e)),n}function Ki(e){return e.length===1?e[0]:e.flat()}function qi(e,t,n){if(e.length<=t)return n;let r=Ti(e[t]);if(r instanceof U)throw r;return r}function Ji(e){let t=G(e);if(t<0)throw W.NUM;return t}var Yi=e=>Math.floor(Ji(e));function Xi(e,t,n){let r=ri(e),i=r.y*12+(r.m-1)+Math.trunc(t),a=Math.floor(i/12),o=i%12+1,s=ni(a,o,n?ai(a,o):Math.min(r.d,ai(a,o)));if(s<0)throw W.NUM;return s}var Zi={1:[0,1],2:[1,1],3:[1,0],11:[1,1],12:[2,1],13:[3,1],14:[4,1],15:[5,1],16:[6,1],17:[0,1]};function Qi(e,t,n){if(e>t)throw W.NUM;let r=ri(e),i=ri(t),a=(i.y-r.y)*12+(i.m-r.m)-+(i.d<r.d);switch(n.toUpperCase()){case`D`:return t-e;case`M`:return a;case`Y`:return Math.floor(a/12);case`YM`:return a%12;case`MD`:{if(i.d>=r.d)return i.d-r.d;let e=i.m===1?12:i.m-1;return ai(i.m===1?i.y-1:i.y,e)-r.d+i.d}case`YD`:{let e=ni(i.y,r.m,Math.min(r.d,ai(i.y,r.m)));return e>t&&(e=ni(i.y-1,r.m,Math.min(r.d,ai(i.y-1,r.m)))),t-e}}throw W.NUM}function $i(e,t,n){let r=e<=t?1:-1,[i,a]=e<=t?[e,t]:[t,e],o=0;for(let e=i;e<=a;e++){let t=ri(e).dow;t!==0&&t!==6&&!n.has(e)&&o++}return r*o}var ea={TODAY:J(0,0,(e,t)=>Math.floor(oi(t.now()))),NOW:J(0,0,(e,t)=>oi(t.now())),DATE:q(3,3,([e,t,n])=>{let r=Math.trunc(G(e));if(r>=0&&r<1900&&(r+=1900),r<0||r>9999)throw W.NUM;let i=ni(r,Math.trunc(G(t)),Math.trunc(G(n)));if(i<0)throw W.NUM;return i}),TIME:q(3,3,([e,t,n])=>{let r=Math.trunc(G(e))*3600+Math.trunc(G(t))*60+Math.trunc(G(n));if(r<0)throw W.NUM;return r%86400/86400}),YEAR:q(1,1,([e])=>ri(Yi(e)).y),MONTH:q(1,1,([e])=>ri(Yi(e)).m),DAY:q(1,1,([e])=>ri(Yi(e)).d),HOUR:q(1,1,([e])=>Math.floor(ii(Ji(e))/3600)),MINUTE:q(1,1,([e])=>Math.floor(ii(Ji(e))%3600/60)),SECOND:q(1,1,([e])=>ii(Ji(e))%60),WEEKDAY:q(1,2,e=>{let t=ri(Yi(e[0])).dow,n=Zi[Math.trunc(qi(e,1,1))];if(!n)throw W.NUM;return(t-n[0]+7)%7+n[1]}),EDATE:q(2,2,([e,t])=>Xi(Yi(e),G(t),!1)),EOMONTH:q(2,2,([e,t])=>Xi(Yi(e),G(t),!0)),DATEDIF:q(3,3,([e,t,n])=>Qi(Yi(e),Yi(t),ki(n))),DAYS:q(2,2,([e,t])=>Math.floor(G(e))-Math.floor(G(t))),NETWORKDAYS:J(2,3,(e,t)=>{let n=new Set(e.length>2?Gi([e[2]],t).map(Math.floor):[]);return $i(Yi(t.scalar(e[0])),Yi(t.scalar(e[1])),n)})},ta=(e,t,n)=>e.type===`missing`?0:t.eval(e,n);function na(e,t){let n=[];for(let r of e)Ui(r,t,e=>{if(typeof e==`boolean`)n.push(e);else if(typeof e==`number`)n.push(e!==0);else if(e instanceof U)throw e},e=>n.push(Ai(e)));if(!n.length)throw W.VALUE;return n}var ra=Hi(2,3,(e,t,n)=>{let r=t.operand(t.eval(e[0],n),n),i=e[1],a=e[2];if(!Array.isArray(r)){let e=Di(r);return e instanceof U?e:e?ta(i,t,n):a?ta(a,t,n):!1}let o=t.operand(ta(i,t,!1),!1),s=a?t.operand(ta(a,t,!1),!1):!1;return new bi(r.map((e,t)=>e.map((e,n)=>{let r=Di(e);if(r instanceof U)return r;let i=r?o:s;return Array.isArray(i)?Vi(i,t,n):i})))});function ia(e){return Hi(2,2,(t,n,r)=>{let i=n.eval(t[0],r),a=n.operand(i,r),o=t=>t instanceof U&&(!e||t.code===`#N/A`);if(Array.isArray(a)){if(!a.some(e=>e.some(o)))return i;let e=n.scalar(ta(t[1],n,!1));return new bi(a.map(t=>t.map(t=>o(t)?e:t)))}return o(a)?ta(t[1],n,r):a})}var aa={IF:ra,IFS:Hi(2,K,(e,t,n)=>{if(e.length%2)return W.VALUE;for(let r=0;r<e.length;r+=2){let i=t.scalar(t.eval(e[r],n));if(i instanceof U)return i;if(Ai(i))return ta(e[r+1],t,n)}return W.NA}),IFERROR:ia(!1),IFNA:ia(!0),AND:J(1,K,(e,t)=>na(e,t).every(Boolean)),OR:J(1,K,(e,t)=>na(e,t).some(Boolean)),XOR:J(1,K,(e,t)=>na(e,t).filter(Boolean).length%2==1),NOT:q(1,1,([e])=>!Ai(e)),TRUE:J(0,0,()=>!0),FALSE:J(0,0,()=>!1),SWITCH:Hi(3,K,(e,t,n)=>{let r=t.scalar(t.eval(e[0],n));if(r instanceof U)return r;let i=1;for(;i+1<e.length;i+=2){let a=t.scalar(ta(e[i],t,n));if(a instanceof U)return a;if(Pi(r,a)||r===null&&Ni(r,a)===0)return ta(e[i+1],t,n)}return i<e.length?ta(e[i],t,n):W.NA}),CHOOSE:Hi(2,K,(e,t,n)=>{let r=Oi(t.scalar(t.eval(e[0],n)));return r<1||r>=e.length?W.VALUE:ta(e[r],t,n)}),ISBLANK:q(1,1,([e])=>e===null),ISNUMBER:q(1,1,([e])=>typeof e==`number`),ISTEXT:q(1,1,([e])=>typeof e==`string`),ISNONTEXT:q(1,1,([e])=>typeof e!=`string`),ISLOGICAL:q(1,1,([e])=>typeof e==`boolean`),ISERROR:q(1,1,([e])=>e instanceof U),ISERR:q(1,1,([e])=>e instanceof U&&e.code!==`#N/A`),ISNA:q(1,1,([e])=>e instanceof U&&e.code===`#N/A`),ISEVEN:q(1,1,([e])=>Math.trunc(G(e))%2==0),ISODD:q(1,1,([e])=>Math.abs(Math.trunc(G(e)))%2==1),NA:J(0,0,()=>W.NA),"ERROR.TYPE":q(1,1,([e])=>e instanceof U?_r.indexOf(e.code)+1:W.NA),N:q(1,1,([e])=>e instanceof U||typeof e==`number`?e:typeof e==`boolean`?+!!e:0),T:q(1,1,([e])=>e instanceof U||typeof e==`string`?e:``)};function oa(e,t,n){if(n&&typeof t==`string`&&Fi(t)){let n=Ii(t);return e.findIndex(e=>typeof e==`string`&&n.test(e))}return e.findIndex(e=>Pi(e,t))}function sa(e,t,n){let r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===null||a instanceof U||typeof a!=typeof t)continue;let o=Ni(a,t);if(n===1?o<=0:o>=0)r=i;else break}return r}function ca(e,t){let n=t.scalar(e);if(n instanceof U)throw n;return n}function la(e,t){if(e instanceof xi)throw W.VALUE;return t.toArray(e)}function ua(e,t,n){let r=ca(e[0],t),i=la(e[1],t),a=Oi(t.scalar(e[2])),o=e.length>3?Ai(t.scalar(e[3])):!0,s=n?i[0].length:i.length;if(a<1)throw W.VALUE;if(a>s)throw W.REF;let c=n?i.map(e=>e[0]):i[0],l=o?sa(c,r,1):oa(c,r,!0);if(l<0)throw W.NA;return n?i[l][a-1]:i[a-1][l]}function da(e,t){let n=ca(e[0],t),r=la(e[1],t);if(r.length>1&&r[0].length>1)throw W.NA;let i=Ki(r),a=e.length>2?Math.sign(G(t.scalar(e[2]))):1,o=a===0?oa(i,n,!0):sa(i,n,a);if(o<0)throw W.NA;return o+1}function fa(e,t,n,r){if(e instanceof yi)return r?new yi(e.sheet,e.r0+n,e.c0,e.r0+n,e.c1):new yi(e.sheet,e.r0,e.c0+n,e.r1,e.c0+n);let i=r?[t[n]]:t.map(e=>[e[n]]);return i[0].length===1&&i.length===1?i[0][0]:new bi(i)}function pa(e,t){let n=ca(e[0],t),r=la(e[1],t),i=la(e[2],t),a=r[0].length===1;if(!a&&r.length!==1||(a?i.length!==r.length:i[0].length!==r[0].length))throw W.VALUE;let o=e.length>3&&e[3]!==null?e[3]:void 0,s=e.length>4?Oi(t.scalar(e[4])):0,c=e.length>5?Oi(t.scalar(e[5])):1,l=Ki(r),u=c<0;u&&(l=[...l].reverse());let d=-1;if(s===0||s===2)d=oa(l,n,s===2);else if(s===1||s===-1){if(d=oa(l,n,!1),d<0){let e=null;for(let t=0;t<l.length;t++){let r=l[t];if(r===null||r instanceof U||typeof r!=typeof n)continue;let i=Ni(r,n);(s===1?i>0&&(e===null||Ni(r,e)<0):i<0&&(e===null||Ni(r,e)>0))&&(e=r,d=t)}}}else throw W.VALUE;if(d<0){if(o!==void 0)return o;throw W.NA}return u&&(d=l.length-1-d),fa(e[2],i,d,a)}function ma(e,t){let n=ca(e[0],t),r=la(e[1],t),i,a;e.length>2?(i=Ki(r),a=Ki(la(e[2],t))):r[0].length>r.length?(i=r[0],a=r[r.length-1]):(i=r.map(e=>e[0]),a=r.map(e=>e[e.length-1]));let o=sa(i,n,1);if(o<0||o>=a.length)throw W.NA;return a[o]}function ha(e,t){let n=e[0];if(n instanceof xi){let r=e.length>3?Oi(t.scalar(e[3])):1;if(r<1||r>n.areas.length)throw W.REF;n=n.areas[r-1]}let r=n instanceof yi||n instanceof bi?n.h:1,i=n instanceof yi||n instanceof bi?n.w:1,a=Oi(t.scalar(e[1])),o;if(e.length>2?o=Oi(t.scalar(e[2])):r===1?[a,o]=[1,a]:o=+(i===1),a<0||o<0||a>r||o>i)throw W.REF;if(n instanceof yi){let[e,t]=a?[n.r0+a-1,n.r0+a-1]:[n.r0,n.r1],[r,i]=o?[n.c0+o-1,n.c0+o-1]:[n.c0,n.c1];return new yi(n.sheet,e,r,t,i)}if(n instanceof bi){let e=(a?[n.data[a-1]]:n.data).map(e=>o?[e[o-1]]:e);return e.length===1&&e[0].length===1?e[0][0]:new bi(e)}return n}function ga(e,t){let n=e[0];if(!(n instanceof yi))throw W.VALUE;let r=Oi(t.scalar(e[1])),i=Oi(t.scalar(e[2])),a=e.length>3&&e[3]!==null?Oi(t.scalar(e[3])):n.h,o=e.length>4&&e[4]!==null?Oi(t.scalar(e[4])):n.w;if(a===0||o===0)throw W.REF;let s=n.r0+r,c=n.c0+i,l=s+a-1,u=c+o-1;if(a<0&&([s,l]=[s+a+1,s]),o<0&&([c,u]=[c+o+1,c]),s<0||c<0||l>1048575||u>16383)throw W.REF;return new yi(n.sheet,s,c,l,u)}function _a(e,t){let n=/^(?:(?:'((?:[^']|'')+)'|([^'!]+))!)?(R(\[-?\d+\]|\d*)C(\[-?\d+\]|\d*))(?::(R(\[-?\d+\]|\d*)C(\[-?\d+\]|\d*)))?$/i.exec(e.trim());if(!n)return null;let r=(e,t)=>e===``?t:e[0]===`[`?t+Number(e.slice(1,-1)):Number(e)-1,i=r(n[4],t.r),a=r(n[5],t.c),o=n[6]?r(n[7],t.r):i,s=n[6]?r(n[8],t.c):a;return{sheet:n[1]===void 0?n[2]:n[1].replace(/''/g,`'`),kind:`area`,r0:Math.min(i,o),c0:Math.min(a,s),r1:Math.max(i,o),c1:Math.max(a,s),ar0:!0,ac0:!0,ar1:!0,ac1:!0}}function va(e,t){let n=ki(t.scalar(e[0])),r=!(e.length>1)||Ai(t.scalar(e[1]))?Gr(n):_a(n,t);if(!r||r.r0<0||r.c0<0||r.r1>1048575||r.c1>16383||r.sheet!==void 0&&!t.hasSheet(r.sheet))throw W.REF;return new yi(r.sheet??t.sheet,r.r0,r.c0,r.r1,r.c1)}function ya(e,t,n,r){if(!e.length||e[0]===null)return(r?t.r:t.c)+1;let i=e[0];if(!(i instanceof yi))throw W.VALUE;let a=r?i.r0:i.c0,o=r?i.h:i.w;if(o===1||n)return a+1;let s=Array.from({length:o},(e,t)=>a+t+1);return new bi(r?s.map(e=>[e]):[s])}function ba(e,t){if(e instanceof yi||e instanceof bi)return t?e.h:e.w;if(e instanceof xi)throw W.REF;if(e instanceof U)throw e;return 1}var xa={VLOOKUP:J(3,4,(e,t)=>ua(e,t,!0)),HLOOKUP:J(3,4,(e,t)=>ua(e,t,!1)),XLOOKUP:J(3,6,pa),MATCH:J(2,3,da),LOOKUP:J(2,3,ma),INDEX:J(2,4,ha),OFFSET:J(3,5,ga),INDIRECT:J(1,2,va),ROW:J(0,1,(e,t,n)=>ya(e,t,n,!0)),COLUMN:J(0,1,(e,t,n)=>ya(e,t,n,!1)),ROWS:J(1,1,([e])=>ba(e,!0)),COLUMNS:J(1,1,([e])=>ba(e,!1))};function Sa(e,t){if(t>15)return e;let n=10**Math.abs(t),r=Math.abs(e),i=t>=0?r*n:r/n;i=Math.floor(Number(i.toPrecision(15))+.5);let a=t>=0?i/n:i*n;return e<0?-a:a}function Ca(e,t,n){let r=``,i=``,a=``,o=0,s=e=>{a?i+=e:r+=e};for(let e=0;e<t.length;e++){let n=t[e];if(n===`"`){let n=t.indexOf(`"`,e+1),r=n<0?t.length:n;s(t.slice(e+1,r)),e=r}else if(n===`\\`)s(t[++e]??``);else if(n===`_`)s(` `),e++;else if(n===`*`)e++;else if(n===`[`){let n=t.indexOf(`]`,e);e=n<0?t.length:n}else`0#?`.includes(n)||(n===`.`||n===`,`)&&!i?a+=n:(n===`%`&&o++,s(n))}let c=a,l=e*100**o;for(;c.endsWith(`,`);)c=c.slice(0,-1),l/=1e3;let u=c.indexOf(`.`),d=u<0?c:c.slice(0,u),f=u<0?``:c.slice(u+1),p=(f.match(/[0#?]/g)??[]).length,m=(f.match(/[0?]/g)??[]).length,h=(d.match(/[0?]/g)??[]).length,g=Sa(Math.abs(l),p),[_,v=``]=g.toFixed(p).split(`.`);for(_===`0`&&h===0&&(_=``),_=_.padStart(h,`0`),d.includes(`,`)&&(_=_.replace(/\B(?=(\d{3})+(?!\d))/g,`,`));v.length>m&&v.endsWith(`0`);)v=v.slice(0,-1);let y=c===``?``:_+(u>=0?`.${v}`:``);return(n&&l<0&&g!==0?`-`:``)+r+y+i}function wa(e,t){if(e instanceof U)throw e;if(typeof e==`boolean`)return e?`TRUE`:`FALSE`;let n,r=hi(t);if(typeof e==`string`){let t=Ci(e);if(t===null){let t=r.length>3?r[3]:r.find(e=>e.includes(`@`));return t===void 0?e:t.replace(/"([^"]*)"/g,`$1`).replace(/@/g,e)}n=t}else n=e??0;let i=r[0],a=!0;if(n<0&&r.length>1&&r[1]!==``?(i=r[1],a=!1):n===0&&r.length>2&&r[2]!==``&&(i=r[2]),/^\s*general\s*$/i.test(i)||i===``)return wi(a?n:Math.abs(n));if(_i(i)){if(n<0)throw W.VALUE;return vi(n,i)}return Ca(a?n:Math.abs(n),i,a)}var Ta=e=>Number(e.toPrecision(15));function Ea(e,t,n){if(t>15)return e;let r=10**Math.abs(t),i=Math.abs(e),a=Ta(t>=0?i*r:i/r);a=n?Math.ceil(a):Math.floor(a);let o=t>=0?a/r:a*r;return e<0?-o:o}function Da(e){if(!Number.isFinite(e))throw W.NUM;return e}var Oa=(e,t,n)=>Ta((n?Math.ceil:Math.floor)(Ta(e/t))*t);function ka(e,t){for(;t;)[e,t]=[t,e%t];return e}function Aa(e,t){return Gi(e,t).map(e=>{if(e<0)throw W.NUM;return Math.trunc(e)})}var ja={ABS:q(1,1,([e])=>Math.abs(G(e))),ROUND:q(2,2,([e,t])=>Sa(G(e),Oi(t))),ROUNDUP:q(2,2,([e,t])=>Ea(G(e),Oi(t),!0)),ROUNDDOWN:q(2,2,([e,t])=>Ea(G(e),Oi(t),!1)),TRUNC:q(1,2,e=>Ea(G(e[0]),Math.trunc(qi(e,1,0)),!1)),INT:q(1,1,([e])=>Math.floor(G(e))),MOD:q(2,2,([e,t])=>{let n=G(e),r=G(t);if(r===0)throw W.DIV0;return Ta(n-r*Math.floor(n/r))}),POWER:q(2,2,([e,t])=>{let n=G(e),r=G(t);if(n===0&&r===0)throw W.NUM;if(n===0&&r<0)throw W.DIV0;let i=n**+r;if(Number.isNaN(i))throw W.NUM;return Da(i)}),SQRT:q(1,1,([e])=>{let t=G(e);if(t<0)throw W.NUM;return Math.sqrt(t)}),EXP:q(1,1,([e])=>Da(Math.exp(G(e)))),LN:q(1,1,([e])=>{let t=G(e);if(t<=0)throw W.NUM;return Math.log(t)}),LOG:q(1,2,e=>{let t=G(e[0]),n=qi(e,1,10);if(t<=0||n<=0)throw W.NUM;if(n===1)throw W.DIV0;return Ta(Math.log(t)/Math.log(n))}),LOG10:q(1,1,([e])=>{let t=G(e);if(t<=0)throw W.NUM;return Math.log10(t)}),PI:J(0,0,()=>Math.PI),SIGN:q(1,1,([e])=>Math.sign(G(e))),CEILING:q(1,2,e=>{let t=G(e[0]),n=qi(e,1,1);if(n===0||t===0)return 0;if(t>0&&n<0)throw W.NUM;return Oa(t,n,!0)}),FLOOR:q(1,2,e=>{let t=G(e[0]),n=qi(e,1,1);if(n===0)throw W.DIV0;if(t>0&&n<0)throw W.NUM;return Oa(t,n,!1)}),"CEILING.MATH":q(1,3,e=>{let t=G(e[0]),n=Math.abs(qi(e,1,1));return n===0||t===0?0:t<0&&qi(e,2,0)!==0?-Oa(-t,n,!0):Oa(t,n,!0)}),"FLOOR.MATH":q(1,3,e=>{let t=G(e[0]),n=Math.abs(qi(e,1,1));return n===0||t===0?0:t<0&&qi(e,2,0)!==0?-Oa(-t,n,!1):Oa(t,n,!1)}),RAND:J(0,0,()=>Math.random()),RANDBETWEEN:q(2,2,([e,t])=>{let n=Math.ceil(G(e)),r=Math.floor(G(t));if(n>r)throw W.NUM;return n+Math.floor(Math.random()*(r-n+1))}),FACT:q(1,1,([e])=>{let t=Math.trunc(G(e));if(t<0)throw W.NUM;let n=1;for(let e=2;e<=t;e++)n*=e;return Da(n)}),EVEN:q(1,1,([e])=>{let t=G(e),n=Math.ceil(Ta(Math.abs(t)/2))*2;return t<0?-n:n}),ODD:q(1,1,([e])=>{let t=G(e),n=Math.ceil(Ta(Math.abs(t)));return n%2==0&&n++,t<0?-n:n}),GCD:J(1,K,(e,t)=>Aa(e,t).reduce((e,t)=>ka(e,t),0)),LCM:J(1,K,(e,t)=>Da(Aa(e,t).reduce((e,t)=>e===0||t===0?0:e/ka(e,t)*t,1)))};function Ma(e){let t=0;for(let n of e)t+=n;return t}function Na(e){if(!e.length)throw W.DIV0;return Ma(e)/e.length}function Pa(e,t){let n=e.length;if(n<(t?2:1))throw W.DIV0;let r=Ma(e)/n,i=0;for(let t of e)i+=(t-r)*(t-r);return i/(t?n-1:n)}function Fa(e){if(!e.length)throw W.NUM;let t=[...e].sort((e,t)=>e-t),n=t.length>>1;return t.length%2?t[n]:(t[n-1]+t[n])/2}function Ia(e){let t=new Map,n=0,r=1;for(let i of e){let e=(t.get(i)??0)+1;t.set(i,e),e>r&&(n=i,r=e)}if(r<2)throw W.NA;for(let n of e)if(t.get(n)===r)return n;return n}function La(e,t){return Gi([e],t)}function Ra(e,t,n){let r=La(e[0],t),i=Math.ceil(G(t.scalar(e[1])));if(i<1||i>r.length)throw W.NUM;return r.sort((e,t)=>n?t-e:e-t),r[i-1]}function za(e,t){let n=G(t.scalar(e[0])),r=La(e[1],t),i=e.length>2&&G(t.scalar(e[2]))!==0;if(!r.includes(n))throw W.NA;let a=1;for(let e of r)(i?e<n:e>n)&&a++;return a}function Ba(e,t){if(e instanceof xi)throw W.VALUE;return t.toArray(e)}function Va(e,t,n,r){return e instanceof yi?r.toArray(new yi(e.sheet,e.r0,e.c0,e.r0+t-1,e.c0+n-1)):Ba(e,r)}function Ha(e,t,n,r){let i=[],a=[];for(let e=0;e<t.length;e+=2)i.push(e===0&&r?r:Ba(t[e],n)),a.push(zi(n.scalar(t[e+1])));let o=i[0].length,s=i[0][0].length;for(let e of i)if(e.length!==o||e[0].length!==s)throw W.VALUE;if(e&&(e.length!==o||e[0].length!==s))throw W.VALUE;let c=[];for(let t=0;t<o;t++)for(let n=0;n<s;n++){let r=!0;for(let e=0;r&&e<i.length;e++)r=a[e](i[e][t][n]);r&&c.push(!e||e[t][n])}return c}function Ua(e){let t=[];for(let n of e)if(typeof n==`number`)t.push(n);else if(n instanceof U)throw n;return t}function Wa(e,t){let n=Ba(e[0],t);return Ua(Ha(e.length>2&&e[2]!==null?Va(e[2],n.length,n[0].length,t):n,[e[0],e[1]],t,n))}function Ga(e,t){if(e.length%2==0)throw W.VALUE;return Ua(Ha(Ba(e[0],t),e.slice(1),t))}function Ka(e,t){let n=e.map(e=>Ba(e,t)),r=n[0].length,i=n[0][0].length;for(let e of n)if(e.length!==r||e[0].length!==i)throw W.VALUE;let a=0;for(let e=0;e<r;e++)for(let t=0;t<i;t++){let r=1;for(let i of n){let n=i[e][t];if(n instanceof U)throw n;r*=typeof n==`number`?n:0}a+=r}return a}function qa(e,t){if(!e.length)return 0;let n=e[0];for(let r of e)(t?r>n:r<n)&&(n=r);return n}var Ja={SUM:J(0,K,(e,t)=>{let n=0;return Wi(e,t,e=>n+=e),n}),PRODUCT:J(0,K,(e,t)=>{let n=Gi(e,t);return n.length?n.reduce((e,t)=>e*t,1):0}),AVERAGE:J(1,K,(e,t)=>Na(Gi(e,t))),MIN:J(1,K,(e,t)=>{let n=K;return Wi(e,t,e=>n=Math.min(n,e)),n===K?0:n}),MAX:J(1,K,(e,t)=>{let n=-K;return Wi(e,t,e=>n=Math.max(n,e)),n===-K?0:n}),COUNT:J(0,K,(e,t)=>{let n=0;for(let r of e)Ui(r,t,e=>typeof e==`number`&&n++,e=>(typeof e==`number`||typeof e==`boolean`||typeof e==`string`&&Ci(e)!==null)&&n++);return n}),COUNTA:J(1,K,(e,t)=>{let n=0;for(let r of e)Ui(r,t,e=>e!==null&&n++,()=>n++);return n}),COUNTBLANK:J(1,1,([e],t)=>{if(e instanceof yi){let n=0,r=0;return t.forEach(e,e=>{n++,(e===null||e===``)&&r++}),r+(e.h*e.w-n)}if(e instanceof bi)return Ki(e.data).filter(e=>e===null||e===``).length;throw W.VALUE}),MEDIAN:J(1,K,(e,t)=>Fa(Gi(e,t))),MODE:J(1,K,(e,t)=>Ia(Gi(e,t))),"MODE.SNGL":J(1,K,(e,t)=>Ia(Gi(e,t))),STDEV:J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!0))),"STDEV.S":J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!0))),"STDEV.P":J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!1))),STDEVP:J(1,K,(e,t)=>Math.sqrt(Pa(Gi(e,t),!1))),VAR:J(1,K,(e,t)=>Pa(Gi(e,t),!0)),"VAR.S":J(1,K,(e,t)=>Pa(Gi(e,t),!0)),"VAR.P":J(1,K,(e,t)=>Pa(Gi(e,t),!1)),VARP:J(1,K,(e,t)=>Pa(Gi(e,t),!1)),LARGE:J(2,2,(e,t)=>Ra(e,t,!0)),SMALL:J(2,2,(e,t)=>Ra(e,t,!1)),RANK:J(2,3,za),"RANK.EQ":J(2,3,za),SUMPRODUCT:J(1,K,Ka),SUMIF:J(2,3,(e,t)=>Ma(Wa(e,t))),SUMIFS:J(3,K,(e,t)=>Ma(Ga(e,t))),AVERAGEIF:J(2,3,(e,t)=>Na(Wa(e,t))),AVERAGEIFS:J(3,K,(e,t)=>Na(Ga(e,t))),COUNTIF:J(2,2,(e,t)=>Ha(null,e,t).length),COUNTIFS:J(2,K,(e,t)=>{if(e.length%2)throw W.VALUE;return Ha(null,e,t).length}),MINIFS:J(3,K,(e,t)=>qa(Ga(e,t),!1)),MAXIFS:J(3,K,(e,t)=>qa(Ga(e,t),!0))},Ya=32767;function Xa(e){let t=Math.trunc(e);if(t<0)throw W.VALUE;return t}function Za(e){let t=``,n=!1;for(let r of e){let e=r.toLowerCase()!==r.toUpperCase();t+=e?n?r.toLowerCase():r.toUpperCase():r,n=e}return t}function Qa(e,t,n,r){if(n<1||n>t.length+1)throw W.VALUE;if(e===``)return n;if(!r){let r=t.indexOf(e,n-1);if(r<0)throw W.VALUE;return r+1}let i=Ii(e,!1).exec(t.slice(n-1));if(!i)throw W.VALUE;return i.index+n}var $a={CONCATENATE:q(1,K,e=>e.map(ki).join(``)),CONCAT:J(1,K,(e,t)=>{let n=``,r=e=>n+=ki(e);for(let n of e)Ui(n,t,r,r);if(n.length>Ya)throw W.VALUE;return n}),TEXTJOIN:J(3,K,(e,t)=>{let n=ki(t.scalar(e[0])),r=Ai(t.scalar(e[1])),i=[],a=e=>{let t=ki(e);r&&t===``||i.push(t)};for(let n of e.slice(2))Ui(n,t,a,a);let o=i.join(n);if(o.length>Ya)throw W.VALUE;return o}),LEFT:q(1,2,e=>ki(e[0]).slice(0,Xa(qi(e,1,1)))),RIGHT:q(1,2,e=>{let t=ki(e[0]);return t.slice(Math.max(0,t.length-Xa(qi(e,1,1))))}),MID:q(3,3,([e,t,n])=>{let r=Math.trunc(G(t));if(r<1)throw W.VALUE;return ki(e).substr(r-1,Xa(G(n)))}),LEN:q(1,1,([e])=>ki(e).length),UPPER:q(1,1,([e])=>ki(e).toUpperCase()),LOWER:q(1,1,([e])=>ki(e).toLowerCase()),PROPER:q(1,1,([e])=>Za(ki(e))),TRIM:q(1,1,([e])=>ki(e).replace(/ {2,}/g,` `).replace(/^ | $/g,``)),SUBSTITUTE:q(3,4,e=>{let t=ki(e[0]),n=ki(e[1]),r=ki(e[2]);if(n===``)return t;if(e.length<4)return t.split(n).join(r);let i=Math.trunc(G(e[3]));if(i<1)throw W.VALUE;let a=-1;for(let e=0;e<i;e++)if(a=t.indexOf(n,a+(e?n.length:1)),a<0)return t;return t.slice(0,a)+r+t.slice(a+n.length)}),REPLACE:q(4,4,([e,t,n,r])=>{let i=ki(e),a=Math.trunc(G(t));if(a<1)throw W.VALUE;let o=Xa(G(n));return i.slice(0,a-1)+ki(r)+i.slice(a-1+o)}),REPT:q(2,2,([e,t])=>{let n=ki(e),r=Xa(G(t));if(n.length*r>Ya)throw W.VALUE;return n.repeat(r)}),FIND:q(2,3,e=>Qa(ki(e[0]),ki(e[1]),Math.trunc(qi(e,2,1)),!1)),SEARCH:q(2,3,e=>Qa(ki(e[0]),ki(e[1]),Math.trunc(qi(e,2,1)),!0)),EXACT:q(2,2,([e,t])=>ki(e)===ki(t)),VALUE:q(1,1,([e])=>{if(typeof e==`number`)return e;if(e===null)return 0;if(typeof e!=`string`)throw e instanceof U?e:W.VALUE;let t=Ci(e);if(t===null)throw W.VALUE;return t}),TEXT:q(2,2,([e,t])=>wa(e,ki(t))),CHAR:q(1,1,([e])=>{let t=Math.trunc(G(e));if(t<1||t>255)throw W.VALUE;return String.fromCharCode(t)}),CODE:q(1,1,([e])=>{let t=ki(e);if(!t)throw W.VALUE;return t.charCodeAt(0)})},eo={...ja,...Ja,...aa,...$a,...ea,...xa,SINGLE:{kind:`eager`,min:1,max:1,scalarArgs:!1,fn:([e],t)=>t.scalar(e)}};function to(e,t,n){let r;switch(e){case`+`:r=t+n;break;case`-`:r=t-n;break;case`*`:r=t*n;break;case`/`:if(n===0)return W.DIV0;r=t/n;break;default:if(t===0&&n===0)return W.NUM;if(t===0&&n<0)return W.DIV0;r=t**+n}return Number.isFinite(r)?r:W.NUM}function no(e,t,n){if(t instanceof U)return t;if(n instanceof U)return n;switch(e){case`&`:return Ei(t)+Ei(n);case`=`:return Ni(t,n)===0;case`<>`:return Ni(t,n)!==0;case`<`:return Ni(t,n)<0;case`>`:return Ni(t,n)>0;case`<=`:return Ni(t,n)<=0;case`>=`:return Ni(t,n)>=0}let r=Ti(t);if(r instanceof U)return r;let i=Ti(n);return i instanceof U?i:to(e,r,i)}function ro(e,t){return Array.isArray(e)?new bi(e.map(e=>e.map(t))):t(e)}function io(e,t,n){if(!Array.isArray(e)&&!Array.isArray(t))return n(e,t);let r=Array.isArray(e)?e:[[e]],i=Array.isArray(t)?t:[[t]],a=Math.max(r.length,i.length),o=Math.max(r[0].length,i[0].length),s=[];for(let e=0;e<a;e++){let t=[];for(let a=0;a<o;a++)t.push(n(Vi(r,e,a),Vi(i,e,a)));s.push(t)}return new bi(s)}var ao=class{constructor(e){A(this,`provider`,void 0),A(this,`sheet`,void 0),A(this,`r`,void 0),A(this,`c`,void 0),this.provider=e.provider,this.sheet=e.sheet,this.r=e.r,this.c=e.c}eval(e,t){switch(e.type){case`num`:case`str`:case`bool`:return e.value;case`err`:return new U(e.code);case`missing`:return null;case`name`:return W.NAME;case`array`:return new bi(e.rows);case`ref`:return this.ref(e.ref);case`range`:return this.rangeOp(e.left,e.right);case`union`:{let t=[];for(let n of e.items){let e=this.eval(n,!1);if(e instanceof yi)t.push(e);else if(e instanceof xi)t.push(...e.areas);else return e instanceof U?e:W.VALUE}return new xi(t)}case`unary`:{let n=this.operand(this.eval(e.arg,t),t);return e.op===`+`?Array.isArray(n)?new bi(n):n:ro(n,e=>{let t=Ti(e);return t instanceof U?t:t===0?0:-t})}case`percent`:return ro(this.operand(this.eval(e.arg,t),t),e=>{let t=Ti(e);return t instanceof U?t:t/100});case`binary`:{let n=this.operand(this.eval(e.left,t),t),r=this.operand(this.eval(e.right,t),t),i=e.op;return io(n,r,(e,t)=>no(i,e,t))}case`call`:return this.call(e.name,e.args,t)}}ref(e){return e.sheet!==void 0&&!this.hasSheet(e.sheet)?W.REF:new yi(e.sheet??this.sheet,e.r0,e.c0,e.r1,e.c1)}rangeOp(e,t){let n=this.eval(e,!1);if(n instanceof U)return n;let r=this.eval(t,!1);return r instanceof U?r:!(n instanceof yi)||!(r instanceof yi)||!Sr(n.sheet,r.sheet)?W.VALUE:new yi(n.sheet,Math.min(n.r0,r.r0),Math.min(n.c0,r.c0),Math.max(n.r1,r.r1),Math.max(n.c1,r.c1))}call(e,t,n){if(!Object.hasOwn(eo,e))return W.NAME;let r=eo[e];if(t.length<r.min||t.length>r.max)return W.VALUE;if(r.kind===`lazy`)return Bi(()=>r.fn(t,this,n));let i=t.map(e=>this.eval(e,r.scalarArgs&&n));return Bi(()=>r.fn(i,this,n))}hasSheet(e){return!this.provider.hasSheet||this.provider.hasSheet(e)}now(){return this.provider.now?.()??new Date}cell(e,t,n){let r=this.provider.value(e,t,n);return r===void 0?null:r}clip(e){let{r1:t,c1:n}=e;if((t===1048575||n===16383)&&this.provider.bounds){let r=this.provider.bounds(e.sheet);t===1048575&&(t=Math.max(e.r0,Math.min(t,r.rows-1))),n===16383&&(n=Math.max(e.c0,Math.min(n,r.cols-1)))}return{r1:t,c1:n}}forEach(e,t){let{r1:n,c1:r}=this.clip(e);for(let i=e.r0;i<=n;i++)for(let n=e.c0;n<=r;n++)t(this.cell(e.sheet,i,n),i-e.r0,n-e.c0)}toArray(e){if(e instanceof yi){let{r1:t,c1:n}=this.clip(e),r=[];for(let i=e.r0;i<=t;i++){let t=[];for(let r=e.c0;r<=n;r++)t.push(this.cell(e.sheet,i,r));r.push(t)}return r}if(e instanceof bi)return e.data;if(e instanceof xi)throw W.VALUE;return[[e]]}intersect(e){return e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):e.w===1&&this.r>=e.r0&&this.r<=e.r1?this.cell(e.sheet,this.r,e.c0):e.h===1&&this.c>=e.c0&&this.c<=e.c1?this.cell(e.sheet,e.r0,this.c):W.VALUE}scalar(e){return e instanceof yi?this.intersect(e):e instanceof bi?e.data[0][0]:e instanceof xi?W.VALUE:e}operand(e,t){return e instanceof yi?e.h===1&&e.w===1?this.cell(e.sheet,e.r0,e.c0):t?this.intersect(e):this.toArray(e):e instanceof bi?e.h===1&&e.w===1?e.data[0][0]:e.data:e instanceof xi?W.VALUE:e}};function oo(e,t){let n=$r();ei(!!t.provider.date1904);try{let n=new ao(t),r=n.eval(e,!0),i=r instanceof yi?n.intersect(r):r instanceof bi?r.data[0][0]:r instanceof xi?W.VALUE:r;return i===null?0:typeof i==`number`?Number.isFinite(i)?i+0:W.NUM:i}catch(e){return e instanceof U?e:W.VALUE}finally{ei(n)}}function so(e,t){let n=e.startsWith(`=`)?`=`:``,r=e.slice(n.length),i;try{i=Wr(r)}catch{return e}let a=n,o=0;for(let e of i){let n=t(e);n!==void 0&&(a+=r.slice(o,e.s)+n,o=e.e)}return a+r.slice(o)}var co=e=>(e.ref.sheet===void 0?``:`${e.sheetText??Cr(e.ref.sheet)}!`)+`#REF!`;function lo(e,t,n){return!t&&!n?e:so(e,e=>{if(e.t!==`ref`)return;let r={...e.ref};return r.kind!==`cols`&&(r.ar0||(r.r0+=t),r.ar1||(r.r1+=t)),r.kind!==`rows`&&(r.ac0||(r.c0+=n),r.ac1||(r.c1+=n)),Dr(r)?Tr(Er(r),e.sheetText):co(e)})}function uo(e,t,n,r,i){if(r>0)return e>=n&&(e+=r),t>=n&&(t+=r),e>i?null:[e,Math.min(t,i)];let a=-r,o=n+a;return t<n?[e,t]:e>=o?[e-a,t-a]:e>=n&&t<o?null:[e<n?e:n,t>=o?t-a:n-1]}function fo(e,t){if(!t.delta)return e;let n=e=>{if(t.sheet===void 0)return e===void 0||t.formulaSheet!==void 0&&Sr(e,t.formulaSheet);let n=e??t.formulaSheet;return n===void 0||Sr(n,t.sheet)};return so(e,e=>{if(e.t!==`ref`||!n(e.ref.sheet))return;let r={...e.ref};if(t.axis===`row`){if(r.kind===`cols`)return;let n=uo(r.r0,r.r1,t.at,t.delta,vr);if(!n)return co(e);[r.r0,r.r1]=n}else{if(r.kind===`rows`)return;let n=uo(r.c0,r.c1,t.at,t.delta,yr);if(!n)return co(e);[r.c0,r.c1]=n}if(r.r0!==e.ref.r0||r.r1!==e.ref.r1||r.c0!==e.ref.c0||r.c1!==e.ref.c1)return Tr(r,e.sheetText)})}function po(e,t,n){let r=`${Cr(n)}!`;return so(e,e=>{if(e.t===`ref`&&e.ref.sheet!==void 0&&Sr(e.ref.sheet,t))return Tr({...e.ref,sheet:n});if((e.t===`err`||e.t===`name`)&&e.sheet!==void 0&&Sr(e.sheet,t))return r+e.v})}function mo(e){let t=e.sheet===void 0?{}:{sheet:e.sheet};return e.kind===`cell`?{...t,r:e.r0,c:e.c0,absR:e.ar0,absC:e.ac0}:{...t,r0:e.r0,c0:e.c0,r1:e.r1,c1:e.c1}}function ho(e){let t=[],n=e=>{switch(e.type){case`ref`:t.push(mo(e.ref));break;case`range`:if(e.left.type===`ref`&&e.right.type===`ref`&&Sr(e.left.ref.sheet,e.right.ref.sheet)){let n=e.left.ref,r=e.right.ref;t.push(mo({...n,kind:`area`,r0:Math.min(n.r0,r.r0),c0:Math.min(n.c0,r.c0),r1:Math.max(n.r1,r.r1),c1:Math.max(n.c1,r.c1)}))}else n(e.left),n(e.right);break;case`unary`:case`percent`:n(e.arg);break;case`binary`:n(e.left),n(e.right);break;case`union`:e.items.forEach(n);break;case`call`:e.args.forEach(n)}};return n(e),t}function go(e){try{return{toks:Wr(e),tail:e.length,openString:!1}}catch(t){if(!(t instanceof Or))return{toks:[],tail:0,openString:!1};let n=Math.max(0,Math.min(t.pos,e.length)),r=n>0?go(e.slice(0,n)):{toks:[],tail:0,openString:!1};return r.tail<n?r:{toks:r.toks,tail:n,openString:t.message===`unterminated string`}}}var _o=e=>e.startsWith(`=`)&&e.length>0,vo=new Set([`(`,`,`,`;`,`{`]),yo=new Set([`)`,`,`,`;`,`}`]);function bo(e,t){let n={pointable:!1,refs:[]};if(!_o(e))return n;let r=e.slice(1),i=t-1,{toks:a,tail:o}=go(r);for(let e of a)e.t===`ref`&&n.refs.push({s:e.s+1,e:e.e+1,text:r.slice(e.s,e.e),ref:e.ref});if(i<0)return n;let s=i>o,c=[],l,u,d;for(let e=0;e<a.length;e++){let t=a[e];t.e<=i?(t.t===`punc`&&(t.v===`(`?c.push({name:a[e-1]?.t===`func`&&a[e-1].e===t.s?a[e-1].v:``,arg:0}):t.v===`{`?c.push({name:``,arg:0}):t.v===`)`||t.v===`}`?c.pop():(t.v===`,`||t.v===`;`)&&c.length&&c[c.length-1].arg++),t.t!==`ws`&&(l=t)):t.s<i?u=t:!d&&t.t!==`ws`&&(d=t)}for(let e=c.length-1;e>=0;e--)if(c[e].name){n.call=c[e];break}if(s)return n;let f=u??(l&&l.e===i?l:void 0);if(f&&(f.t===`name`||f.t===`func`||f.t===`ref`||f.t===`bool`)){let e=r.slice(f.s,i);if(!(f.t===`ref`&&f.ref.sheet!==void 0||f.t===`name`&&f.sheet!==void 0)&&/^[A-Za-z_][A-Za-z0-9_.]*$/.test(e)){let t=f.t===`func`||r[f.e]===`(`;n.word={s:f.s+1,e:f.e+1,text:e,call:t}}}if(!u){let e=!l||l.t===`punc`&&vo.has(l.v)||l.t===`op`&&l.v!==`%`,t=!d||d.t===`punc`&&yo.has(d.v)||d.t===`op`&&d.v!==`:`;n.pointable=e&&t}return n}function xo(e,t,n,r,i){let a=i===void 0?``:Cr(i)+`!`;if(e>n&&([e,n]=[n,e]),t>r&&([t,r]=[r,t]),e===0&&n>=1048575)return`${a}${br(t)}:${br(r)}`;if(t===0&&r>=16383)return`${a}${e+1}:${n+1}`;let o=`${br(t)}${e+1}`;return e===n&&t===r?a+o:`${a}${o}:${br(r)}${n+1}`}function So(e){if(!_o(e))return e;let t=e.slice(1),{toks:n,tail:r,openString:i}=go(t);if(r<t.length&&!i)return e;let a=0,o=``,s=0;for(let e of n){if(e.t===`func`||e.t===`bool`||e.t===`ref`&&e.ref.sheet===void 0)o+=t.slice(s,e.s)+t.slice(e.s,e.e).toUpperCase(),s=e.e;else if(e.t===`ref`){let n=t.lastIndexOf(`!`,e.e);o+=t.slice(s,n+1)+t.slice(n+1,e.e).toUpperCase(),s=e.e}e.t===`punc`&&(e.v===`(`?a++:e.v===`)`&&(a=Math.max(0,a-1)))}return o+=t.slice(s),`=`+o+(i?`"`:``)+`)`.repeat(a)}var Co={ABS:`number|Absolute value of a number.`,AND:`logical1, [logical2], ...|TRUE if all arguments are TRUE.`,AVERAGE:`number1, [number2], ...|Arithmetic mean of the arguments.`,AVERAGEIF:`range, criteria, [average_range]|Average of cells that meet a condition.`,AVERAGEIFS:`average_range, criteria_range1, criteria1, ...|Average of cells that meet multiple conditions.`,CEILING:`number, significance|Rounds a number up to the nearest multiple of significance.`,"CEILING.MATH":`number, [significance], [mode]|Rounds a number up to the nearest integer or multiple.`,CHAR:`number|Character for a character code.`,CHOOSE:`index_num, value1, [value2], ...|Picks a value from the list by position.`,CODE:`text|Numeric code of the first character.`,COLUMN:`[reference]|Column number of a reference.`,COLUMNS:`array|Number of columns in a reference.`,CONCAT:`text1, [text2], ...|Joins several text items into one.`,CONCATENATE:`text1, [text2], ...|Joins several text items into one.`,COUNT:`value1, [value2], ...|Counts cells that contain numbers.`,COUNTA:`value1, [value2], ...|Counts cells that are not empty.`,COUNTBLANK:`range|Counts empty cells in a range.`,COUNTIF:`range, criteria|Counts cells that meet a condition.`,COUNTIFS:`criteria_range1, criteria1, ...|Counts cells that meet multiple conditions.`,DATE:`year, month, day|Date serial number from year, month and day.`,DATEDIF:`start_date, end_date, unit|Difference between two dates in days, months or years.`,DAY:`serial_number|Day of the month (1-31).`,DAYS:`end_date, start_date|Number of days between two dates.`,EDATE:`start_date, months|Date that is a number of months before or after a date.`,EOMONTH:`start_date, months|Last day of the month, months before or after a date.`,"ERROR.TYPE":`error_val|Number that corresponds to an error type.`,EVEN:`number|Rounds up to the nearest even integer.`,EXACT:`text1, text2|TRUE if two texts are exactly the same.`,EXP:`number|e raised to the power of a number.`,FACT:`number|Factorial of a number.`,FALSE:`|The logical value FALSE.`,FIND:`find_text, within_text, [start_num]|Position of a text inside another (case-sensitive).`,FLOOR:`number, significance|Rounds a number down to the nearest multiple of significance.`,"FLOOR.MATH":`number, [significance], [mode]|Rounds a number down to the nearest integer or multiple.`,GCD:`number1, [number2], ...|Greatest common divisor.`,HLOOKUP:`lookup_value, table_array, row_index_num, [range_lookup]|Looks up a value in the top row and returns a value from the same column.`,HOUR:`serial_number|Hour of a time value (0-23).`,IF:`logical_test, [value_if_true], [value_if_false]|Returns one value if a condition is TRUE and another if FALSE.`,IFERROR:`value, value_if_error|Returns value_if_error if the expression is an error.`,IFNA:`value, value_if_na|Returns value_if_na if the expression is #N/A.`,IFS:`logical_test1, value_if_true1, ...|Returns the value of the first TRUE condition.`,INDEX:`array, row_num, [column_num]|Value at a given row and column of a range.`,INDIRECT:`ref_text, [a1]|Reference given by a text string.`,INT:`number|Rounds down to the nearest integer.`,ISBLANK:`value|TRUE if the value is empty.`,ISERR:`value|TRUE if the value is an error other than #N/A.`,ISERROR:`value|TRUE if the value is any error.`,ISEVEN:`number|TRUE if the number is even.`,ISLOGICAL:`value|TRUE if the value is a logical value.`,ISNA:`value|TRUE if the value is #N/A.`,ISNONTEXT:`value|TRUE if the value is not text.`,ISNUMBER:`value|TRUE if the value is a number.`,ISODD:`number|TRUE if the number is odd.`,ISTEXT:`value|TRUE if the value is text.`,LARGE:`array, k|k-th largest value in a data set.`,LCM:`number1, [number2], ...|Least common multiple.`,LEFT:`text, [num_chars]|First characters of a text.`,LEN:`text|Number of characters in a text.`,LN:`number|Natural logarithm.`,LOG:`number, [base]|Logarithm to a given base (default 10).`,LOG10:`number|Base-10 logarithm.`,LOOKUP:`lookup_value, lookup_vector, [result_vector]|Looks up a value in a one-row or one-column range.`,LOWER:`text|Converts text to lowercase.`,MATCH:`lookup_value, lookup_array, [match_type]|Relative position of a value in a range.`,MAX:`number1, [number2], ...|Largest value.`,MAXIFS:`max_range, criteria_range1, criteria1, ...|Largest value among cells that meet conditions.`,MEDIAN:`number1, [number2], ...|Median of the numbers.`,MID:`text, start_num, num_chars|Characters from the middle of a text.`,MIN:`number1, [number2], ...|Smallest value.`,MINIFS:`min_range, criteria_range1, criteria1, ...|Smallest value among cells that meet conditions.`,MINUTE:`serial_number|Minute of a time value (0-59).`,MOD:`number, divisor|Remainder after division.`,MODE:`number1, [number2], ...|Most frequent value.`,"MODE.SNGL":`number1, [number2], ...|Most frequent value.`,MONTH:`serial_number|Month of a date (1-12).`,N:`value|Value converted to a number.`,NA:`|The error value #N/A.`,NETWORKDAYS:`start_date, end_date, [holidays]|Number of working days between two dates.`,NOT:`logical|Reverses a logical value.`,NOW:`|Current date and time.`,ODD:`number|Rounds up to the nearest odd integer.`,OFFSET:`reference, rows, cols, [height], [width]|Reference offset from a starting reference.`,OR:`logical1, [logical2], ...|TRUE if any argument is TRUE.`,PI:`|The value of pi.`,POWER:`number, power|A number raised to a power.`,PRODUCT:`number1, [number2], ...|Multiplies all the arguments.`,PROPER:`text|Capitalizes the first letter of each word.`,RAND:`|Random number between 0 and 1.`,RANDBETWEEN:`bottom, top|Random integer between two numbers.`,RANK:`number, ref, [order]|Rank of a number in a list.`,"RANK.EQ":`number, ref, [order]|Rank of a number in a list.`,REPLACE:`old_text, start_num, num_chars, new_text|Replaces part of a text by position.`,REPT:`text, number_times|Repeats a text a number of times.`,RIGHT:`text, [num_chars]|Last characters of a text.`,ROUND:`number, num_digits|Rounds a number to a number of digits.`,ROUNDDOWN:`number, num_digits|Rounds a number down, toward zero.`,ROUNDUP:`number, num_digits|Rounds a number up, away from zero.`,ROW:`[reference]|Row number of a reference.`,ROWS:`array|Number of rows in a reference.`,SEARCH:`find_text, within_text, [start_num]|Position of a text inside another (not case-sensitive).`,SECOND:`serial_number|Second of a time value (0-59).`,SIGN:`number|Sign of a number: 1, 0 or -1.`,SMALL:`array, k|k-th smallest value in a data set.`,SQRT:`number|Square root.`,STDEV:`number1, [number2], ...|Standard deviation of a sample.`,"STDEV.P":`number1, [number2], ...|Standard deviation of a population.`,"STDEV.S":`number1, [number2], ...|Standard deviation of a sample.`,STDEVP:`number1, [number2], ...|Standard deviation of a population.`,SUBSTITUTE:`text, old_text, new_text, [instance_num]|Replaces existing text with new text.`,SUM:`number1, [number2], ...|Adds all the numbers.`,SUMIF:`range, criteria, [sum_range]|Adds the cells that meet a condition.`,SUMIFS:`sum_range, criteria_range1, criteria1, ...|Adds the cells that meet multiple conditions.`,SUMPRODUCT:`array1, [array2], ...|Sum of the products of corresponding items.`,SWITCH:`expression, value1, result1, [default_or_value2], ...|Matches an expression against a list of values.`,T:`value|Text of a value, or empty text.`,TEXT:`value, format_text|Formats a number as text.`,TEXTJOIN:`delimiter, ignore_empty, text1, ...|Joins texts with a delimiter.`,TIME:`hour, minute, second|Time value from hour, minute and second.`,TODAY:`|Current date.`,TRIM:`text|Removes extra spaces from text.`,TRUE:`|The logical value TRUE.`,TRUNC:`number, [num_digits]|Truncates a number to an integer or number of digits.`,UPPER:`text|Converts text to uppercase.`,VALUE:`text|Converts text to a number.`,VAR:`number1, [number2], ...|Variance of a sample.`,"VAR.P":`number1, [number2], ...|Variance of a population.`,"VAR.S":`number1, [number2], ...|Variance of a sample.`,VARP:`number1, [number2], ...|Variance of a population.`,VLOOKUP:`lookup_value, table_array, col_index_num, [range_lookup]|Looks up a value in the first column and returns a value from the same row.`,WEEKDAY:`serial_number, [return_type]|Day of the week of a date.`,XLOOKUP:`lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]|Searches a range and returns the matching item from another range.`,XOR:`logical1, [logical2], ...|TRUE if an odd number of arguments are TRUE.`,YEAR:`serial_number|Year of a date.`},wo=null;function To(){return wo||(wo=Object.keys(Co).sort().map(e=>{let[t,n]=Co[e].split(`|`),r=t?t.split(`, `):[],i=r[r.length-1]===`...`;return{name:e,args:i?r.slice(0,-1):r,variadic:i,desc:n}})),wo}function Eo(e){let t=e.toUpperCase();return To().find(e=>e.name===t)}function Do(e,t=10){let n=e.toUpperCase();return n?To().filter(e=>e.name.startsWith(n)).slice(0,t):[]}function Oo(e,t){if(t<e.args.length)return t;if(!e.variadic)return-1;let n=e.args.length,r=/1$/.test(e.args[n-1]??``)&&/1$/.test(e.args[n-2]??``)?2:1,i=n-r;return i+(t-i)%r}var ko=(e,t)=>`${e}:${t}`,Ao=class{constructor(e){A(this,`wb`,void 0),A(this,`asts`,new Map),A(this,`cellDeps`,new Map),A(this,`rangeDeps`,[]),A(this,`indexed`,!1),A(this,`cur`,0),this.wb=e}invalidate(){this.indexed=!1,this.asts.clear(),this.cellDeps.clear(),this.rangeDeps=[]}sheetIndex(e,t){return e?this.wb.sheets.findIndex(t=>t.name.toLowerCase()===e.toLowerCase()):t}ast(e,t){let n=ko(e,t),r=this.asts.get(n);if(r===void 0){let i=this.wb.sheetsData.get(e)?.formulas.get(t);try{r=i?Jr(i):null}catch{r=null}this.asts.set(n,r)}return r}index(){if(!this.indexed){this.indexed=!0;for(let[e,t]of this.wb.sheetsData)for(let n of t.formulas.keys())this.addDeps(e,n)}}addDeps(e,t){let n=this.ast(e,t);if(!n)return;let r=ko(e,t);for(let t of ho(n)){let n=this.sheetIndex(t.sheet,e);if(!(n<0)){if(`r`in t){let e=ko(n,t.r*Xo+t.c),i=this.cellDeps.get(e);i||this.cellDeps.set(e,i=new Set),i.add(r)}else this.rangeDeps.push({sheet:n,r0:t.r0,c0:t.c0,r1:t.r1,c1:t.c1,dep:r})}}}formulaChanged(e,t){if(!this.indexed)return;let n=ko(e,t);this.asts.delete(n);for(let e of this.cellDeps.values())e.delete(n);this.rangeDeps=this.rangeDeps.filter(e=>e.dep!==n),this.addDeps(e,t)}value(e,t,n){let r=this.wb.sheetsData.get(e)?.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4){if(r[e]!==n)continue;let t=r[e+1],i=r[e+2];switch(t){case 0:return i;case 1:return this.wb.sst[i]??``;case 2:return String(i);case 3:return!!i;case 4:return new U(String(i));case 6:return null;default:return String(i)}}return null}provider(e,t){return{value:(n,r,i)=>{let a=this.sheetIndex(n,this.cur);if(a<0)return new U(`#REF!`);let o=ko(a,r*Xo+i);return t.has(o)?new U(`#REF!`):(e.has(o)&&this.compute(o,e,t),this.value(a,r,i))},bounds:e=>{let t=this.wb.sheetsData.get(this.sheetIndex(e,this.cur));return{rows:(t?.maxRow??-1)+1,cols:(t?.maxCol??-1)+1}},hasSheet:e=>this.sheetIndex(e,-1)>=0,date1904:this.wb.date1904}}compute(e,t,n){t.delete(e);let[r,i]=e.split(`:`).map(Number),a=this.wb.sheetsData.get(r);if(!a||!a.formulas.has(i))return;if(n.has(e)){jo(a,i,new U(`#REF!`));return}n.add(e);let o=this.ast(r,i),s=this.cur;this.cur=r;let c;try{c=o?oo(o,{provider:this.provider(t,n),sheet:this.wb.sheets[r]?.name,r:Math.floor(i/Xo),c:i%Xo}):new U(`#NAME?`)}catch{c=new U(`#VALUE!`)}this.cur=s,n.delete(e),jo(a,i,c)}recalc(e,t=[]){this.index();let n=new Set,r=[],i=e=>{n.has(e)||(n.add(e),r.push(e))};for(let e of t)i(ko(e.sheet,e.key));let a=new Set,o=e=>{if(a.has(e))return;a.add(e);let[t,n]=e.split(`:`).map(Number),r=Math.floor(n/Xo),s=n%Xo;for(let t of this.cellDeps.get(e)??[])i(t),o(t);for(let e of this.rangeDeps)e.sheet===t&&r>=e.r0&&r<=e.r1&&s>=e.c0&&s<=e.c1&&(i(e.dep),o(e.dep))};for(let t of e)o(ko(t.sheet,t.key));for(let e of t)o(ko(e.sheet,e.key));let s=new Set,c=new Set;for(let e of r)n.has(e)&&(this.compute(e,n,c),s.add(Number(e.split(`:`)[0])));return s}computeMissing(e,t){t.length&&this.recalc([],t.map(t=>({sheet:e,key:t})))}};function jo(e,t,n){let r=Math.floor(t/Xo),i=t%Xo,a=e.rows[r];a||(e.rows[r]=a=[]);let o,s;n instanceof U?(o=4,s=n.code):typeof n==`number`?(o=0,s=Number.isFinite(n)?n:0):typeof n==`boolean`?(o=3,s=+!!n):n===null?(o=0,s=0):(o=2,s=n);for(let e=0;e<a.length;e+=4)if(a[e]===i){a[e+1]=o,a[e+2]=s;return}let c=0;for(;c<a.length&&a[c]<i;)c+=4;a.splice(c,0,i,o,s,0)}var Mo={0:`General`,1:`0`,2:`0.00`,3:`#,##0`,4:`#,##0.00`,9:`0%`,10:`0.00%`,11:`0.00E+00`,12:`# ?/?`,13:`# ??/??`,14:`m/d/yyyy`,15:`d-mmm-yy`,16:`d-mmm`,17:`mmm-yy`,18:`h:mm AM/PM`,19:`h:mm:ss AM/PM`,20:`h:mm`,21:`h:mm:ss`,22:`m/d/yyyy h:mm`,37:`#,##0 ;(#,##0)`,38:`#,##0 ;[Red](#,##0)`,39:`#,##0.00;(#,##0.00)`,40:`#,##0.00;[Red](#,##0.00)`,45:`mm:ss`,46:`[h]:mm:ss`,47:`mmss.0`,48:`##0.0E+0`,49:`@`,27:`yyyy"年"m"月"`,30:`m/d/yy`,31:`yyyy"年"m"月"d"日"`,50:`yyyy"年"m"月"`,57:`yyyy"年"m"月"`,58:`m"月"d"日"`},No={black:`#000000`,red:`#ff0000`,green:`#00a000`,blue:`#0000ff`,yellow:`#c0c000`,magenta:`#ff00ff`,cyan:`#00c0c0`,white:`#ffffff`},Po=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Y=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Fo(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`\\`&&!r?(n+=o+(e[a+1]??``),a++):(o===`"`?r=!r:!r&&o===`[`?i=!0:!r&&o===`]`&&(i=!1),o===`;`&&!r&&!i?(t.push(n),n=``):n+=o)}return t.push(n),t}function Io(e){let t=[],n,r,i=!1,a=0,o=e=>{let n=t[t.length-1];n?.k===`lit`?n.v+=e:t.push({k:`lit`,v:e})},s=e.toLowerCase();for(;a<e.length;){let c=e[a],l=s[a];if(c===`"`){let t=e.indexOf(`"`,a+1);o(e.slice(a+1,t<0?void 0:t)),a=t<0?e.length:t+1}else if(c===`\\`)o(e[a+1]??``),a+=2;else if(c===`_`)o(` `),a+=2;else if(c===`*`)a+=2;else if(c===`[`){let s=e.indexOf(`]`,a),c=e.slice(a+1,s<0?void 0:s),l=c.toLowerCase();if(No[l])n=No[l];else if(/^color\s*\d+$/.test(l))n=void 0;else if(/^(h+|m+|s+)$/.test(l))t.push({k:`elapsed`,v:l[0]}),i=!0;else if(c.startsWith(`$`)){let e=c.slice(1).split(`-`)[0];e&&o(e)}else{let e=/^(<=|>=|<>|<|>|=)\s*(-?[\d.]+)$/.exec(c);e&&(r={op:e[1],v:Number(e[2])})}a=s<0?e.length:s+1}else if(c===`0`||c===`#`||c===`?`)t.push({k:`digit`,v:c}),a++;else if(c===`.`){if(i&&e[a+1]===`0`){let n=a+1;for(;e[n]===`0`;)n++;t.push({k:`date`,v:e.slice(a,n)}),a=n}else t.push({k:`dot`}),a++}else if(c===`,`)t.push({k:`comma`}),a++;else if(c===`%`)t.push({k:`pct`}),a++;else if(l===`e`&&(e[a+1]===`+`||e[a+1]===`-`))t.push({k:`exp`,sign:e[a+1]===`+`}),a+=2;else if(c===`/`&&t.some(e=>e.k===`digit`))t.push({k:`slash`}),a++;else if(c===`@`)t.push({k:`text`}),a++;else if(s.startsWith(`am/pm`,a))t.push({k:`date`,v:`AM/PM`}),i=!0,a+=5;else if(s.startsWith(`a/p`,a))t.push({k:`date`,v:`A/P`}),i=!0,a+=3;else if(`ymdhs`.includes(l)||l===`g`&&s.startsWith(`ge`,a)||l===`b`){let e=a;for(;s[e]===l;)e++;l===`b`||l===`g`?o(``):(t.push({k:`date`,v:s.slice(a,e)}),i=!0),a=e}else o(c),a++}return{toks:t,color:n,isDate:i,cond:r,hasDigits:t.some(e=>e.k===`digit`)}}var Lo=new Map;function Ro(e){let t=Lo.get(e);return t||(t=Fo(e).map(Io),Lo.size>2e3&&Lo.clear(),Lo.set(e,t)),t}function zo(e){return!e||e===`General`?!1:Ro(e)[0].isDate}function Bo(e){if(!Number.isFinite(e)||Number.isInteger(e)&&Math.abs(e)<1e11)return String(e);let t=Math.abs(e);if(t>=1e11||t<1e-9&&t!==0){let[t,n]=e.toExponential(5).split(`e`);return(t.includes(`.`)?t.replace(/0+$/,``).replace(/\.$/,``):t)+`E`+(n[0]===`-`?`-`:`+`)+n.replace(/^[+-]/,``).padStart(2,`0`)}let n=Math.max(0,10-Math.floor(Math.log10(t||1))),r=e.toFixed(Math.min(n,15));return r.includes(`.`)&&(r=r.replace(/0+$/,``).replace(/\.$/,``)),r}function Vo(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)}function Ho(e,t){let n=t.toks,r=Math.abs(e),i=n.filter(e=>e.k===`pct`).length;r*=100**i;let a=n.findIndex(e=>e.k===`dot`),o=n.findIndex(e=>e.k===`exp`),s=n.findIndex(e=>e.k===`slash`),c=n.findIndex(e=>e.k===`digit`),l=-1;n.forEach((e,t)=>e.k===`digit`&&(l=t));let u=0;for(let e=l+1;e<n.length&&n[e].k===`comma`;e++)u++;r/=1e3**u;let d=n.some((e,t)=>e.k===`comma`&&t>c&&t<l);if(s>=0)return Uo(r,t,e<0);let f=a>=0?a:o>=0?o:l+1,p=a>=0?n.slice(a+1,o>=0?o:void 0).filter(e=>e.k===`digit`):[],m=p.length,h=r,g=0;if(o>=0){let e=n.slice(0,f).filter(e=>e.k===`digit`).length||1;h!==0&&(g=Math.floor(Math.log10(h)),e>1&&(g=Math.floor(g/e)*e),h/=10**g)}let _=h.toFixed(m);o>=0&&Number(_)>=10&&n.slice(0,f).filter(e=>e.k===`digit`).length<=1&&(g+=1,_=(h/10).toFixed(m));let[v,y=``]=_.split(`.`);if(m){let e=y.split(``);for(let t=m-1;t>=0&&e[t]===`0`;t--){let n=p[t].v;if(n===`#`)e[t]=``;else if(n===`?`)e[t]=` `;else break}y=e.join(``)}let b=n.slice(0,f),x=b.filter(e=>e.k===`digit`).filter(e=>e.v===`0`).length;for(v===`0`&&x===0&&(v=``);v.length<x;)v=`0`+v;let S=b.some((e,t)=>e.k===`lit`&&t>c&&t<f),C=``;if(S){let e=v,t=``;for(let r=f-1;r>=0;r--){let i=n[r];i.k===`digit`?(e.length?(t=e[e.length-1]+t,e=e.slice(0,-1)):i.v===`0`?t=`0`+t:i.v===`?`&&(t=` `+t),r===c&&e.length&&(t=e+t,e=``)):i.k===`lit`?t=i.v+t:i.k===`pct`&&(t=`%`+t)}C=t}else{let e=!1,t=d?Vo(v):v;for(let r=0;r<f;r++){let i=n[r];i.k===`digit`?e||(C+=t,e=!0):i.k===`lit`?C+=i.v:i.k===`pct`&&(C+=`%`)}e||(C+=t)}a>=0&&(C+=y.length||p.some(e=>e.v===`0`)?`.`+y:m?`.`:``);let w=o>=0?o:a>=0?a+1:f;for(let e=w;e<n.length;e++){let t=n[e];if(t.k===`exp`){let r=n.slice(e+1).filter(e=>e.k===`digit`).length||1;for(C+=`E`+(g<0?`-`:t.sign?`+`:``)+String(Math.abs(g)).padStart(r,`0`);e+1<n.length&&n[e+1].k===`digit`;)e++}else t.k===`lit`?C+=t.v:t.k===`pct`&&(C+=`%`)}return C}function Uo(e,t,n){let r=t.toks,i=r.findIndex(e=>e.k===`slash`),a=r.slice(i+1).filter(e=>e.k===`digit`),o=r.slice(i+1).find(e=>e.k===`lit`&&/^\d+$/.test(e.v.trim())),s=o?Number(o.v):10**(a.length||1)-1,c=r.slice(0,i).some(e=>e.k===`lit`&&e.v.includes(` `)),l=c?Math.floor(e):0,u=e-l,d=0,f=1;if(o)f=s,d=Math.round(u*s);else{let e=1/0;for(let t=1;t<=s;t++){let n=Math.round(u*t),r=Math.abs(u-n/t);r<e-1e-12&&(e=r,d=n,f=t)}}let p=n?`-`:``;return d===0?p+(c?String(l):`0`):d===f?p+String(l+1):p+(c&&l?l+` `:``)+d+`/`+f}function Wo(e,t=!1){let n=Math.floor(e),r=Math.round((e-n)*864e5),i;return t?i=Date.UTC(1904,0,1):n<60?i=Date.UTC(1899,11,31):(i=Date.UTC(1899,11,30),n===60&&(n=61)),new Date(i+n*864e5+r)}function Go(e,t,n){let r=Wo(e,n),i=t.toks,a=i.some(e=>e.k===`date`&&(e.v===`AM/PM`||e.v===`A/P`)),o=r.getUTCFullYear(),s=r.getUTCMonth(),c=r.getUTCDate(),l=r.getUTCHours(),u=r.getUTCMinutes(),d=r.getUTCSeconds(),f=r.getUTCMilliseconds(),p=(e,t=2)=>String(e).padStart(t,`0`),m=``,h=e=>{for(let t=e-1;t>=0;t--){let e=i[t];if(e.k===`date`)return e.v[0]===`h`;if(e.k===`elapsed`)return e.v===`h`}for(let t=e+1;t<i.length;t++){let e=i[t];if(e.k===`date`)return e.v[0]===`s`;if(e.k===`elapsed`)return e.v===`s`}return!1};return i.forEach((t,n)=>{if(t.k===`lit`)return m+=t.v;if(t.k===`elapsed`){let n=e*86400;t.v===`h`?m+=Math.floor(n/3600):t.v===`m`?m+=Math.floor(n/60):m+=Math.round(n);return}if(t.k!==`date`){t.k===`digit`?m+=t.v===`0`?`0`:``:t.k===`dot`?m+=`.`:t.k===`comma`?m+=`,`:t.k===`pct`?m+=`%`:t.k===`slash`&&(m+=`/`);return}let i=t.v;switch(i[0]){case`y`:m+=i.length<=2?p(o%100):String(o);break;case`m`:i.length<=2&&h(n)?m+=i.length===2?p(u):String(u):i.length===1?m+=s+1:i.length===2?m+=p(s+1):i.length===3?m+=Po[s].slice(0,3):i.length===5?m+=Po[s][0]:m+=Po[s];break;case`d`:i.length===1?m+=c:i.length===2?m+=p(c):i.length===3?m+=Y[r.getUTCDay()].slice(0,3):m+=Y[r.getUTCDay()];break;case`h`:{let e=l;a&&(e=e%12||12),m+=i.length>=2?p(e):String(e);break}case`s`:m+=i.length>=2?p(d):String(d);break;case`.`:m+=`.`+p(Math.floor(f/10**(3-(i.length-1))),i.length-1);break;case`A`:m+=i===`AM/PM`?l<12?`AM`:`PM`:l<12?`A`:`P`}}),m}function Ko(e,t,n=!1){if(!t||t===`General`||t===`general`)return{text:Bo(e)};let r=Ro(t),i=r[0],a=e;if(r.some(e=>e.cond)?i=r.find(t=>{if(!t.cond)return!1;let{op:n,v:r}=t.cond;return n===`<`?e<r:n===`<=`?e<=r:n===`>`?e>r:n===`>=`?e>=r:n===`=`?e===r:e!==r})??r.find(e=>!e.cond)??r[0]:r.length>=3&&e===0&&r[2].toks.length?i=r[2]:r.length>=2&&e<0&&r[1].toks.length&&(i=r[1],a=-e),i.isDate)return e<0||e>2958465?{text:`#`.repeat(8)}:{text:Go(e,i,n),color:i.color};if(!i.hasDigits){let t=i.toks.map(e=>e.k===`lit`?e.v:e.k===`pct`?`%`:e.k===`text`?Bo(a):``).join(``);return i.toks.some(e=>e.k===`text`)||t?{text:t,color:i.color}:{text:Bo(e),color:i.color}}let o=a<0,s=Ho(a,i);return o&&(s=`-`+s),{text:s,color:i.color}}function qo(e,t){if(!t||!t.includes(`@`))return e;let n=Ro(t),r=n.length>=4?n[3]:n.find(e=>e.toks.some(e=>e.k===`text`));return r?r.toks.map(t=>t.k===`lit`?t.v:t.k===`text`?e:``).join(``):e}var Jo={thin:[1,`solid`],medium:[2,`solid`],thick:[3,`solid`],dashed:[1,`dashed`],dotted:[1,`dotted`],double:[3,`double`],hair:[1,`dotted`],mediumDashed:[2,`dashed`],dashDot:[1,`dashed`],mediumDashDot:[2,`dashed`],dashDotDot:[1,`dotted`],mediumDashDotDot:[2,`dotted`],slantDashDot:[2,`dashed`]};function Yo(e,t){let n=zn(e),r=e=>Rn(e,t,n),i=new Map;for(let t of R(L(e,`numFmts`),`numFmt`))i.set(Number(t.a.numFmtId),t.a.formatCode??`General`);let a=R(L(e,`fonts`),`font`).map(e=>({b:je(L(e,`b`)),i:je(L(e,`i`)),u:L(e,`u`)?L(e,`u`).a.val??`single`:void 0,strike:je(L(e,`strike`)),sz:V(L(e,`sz`)?.a.val),color:r(L(e,`color`)),name:L(e,`name`)?.a.val})),o=R(L(e,`fills`),`fill`).map(e=>{let t=L(e,`patternFill`);if(t){let e=t.a.patternType;return!e||e===`none`?void 0:e===`solid`?r(L(t,`fgColor`))??r(L(t,`bgColor`)):r(L(t,`fgColor`))??`#d9d9d9`}let n=L(e,`gradientFill`);if(n){let e=R(n,`stop`).map(e=>r(L(e,`color`))).filter(Boolean);return e.length>=2?`linear-gradient(${V(n.a.degree,90)+90}deg, ${e.join(`, `)})`:e[0]}}),s=R(L(e,`borders`),`border`).map(e=>{let t={},n=(e,n)=>{let i=e?.a.style;if(!i||i===`none`)return;let[a,o]=Jo[i]??[1,`solid`];t[n]=`${a}px ${o} ${r(L(e,`color`))??`#000`}`};return n(L(e,`left`)??L(e,`start`),`borderLeft`),n(L(e,`right`)??L(e,`end`),`borderRight`),n(L(e,`top`),`borderTop`),n(L(e,`bottom`),`borderBottom`),t}),c=a[0]??{},l={fontFamily:$e(c.name??`Calibri`),fontSize:`${c.sz??11}pt`,color:c.color??`#000000`},u=R(L(e,`cellXfs`),`xf`).map(e=>{let t={},n=V(e.a.numFmtId,0),r=a[V(e.a.fontId,0)];if(r){r.b&&(t.fontWeight=700),r.i&&(t.fontStyle=`italic`);let e=[r.u&&r.u!==`none`?`underline`:``,r.strike?`line-through`:``].filter(Boolean).join(` `);e&&(t.textDecoration=e),(r.u===`double`||r.u===`doubleAccounting`)&&(t.textDecorationStyle=`double`),r.sz&&r.sz!==c.sz&&(t.fontSize=`${r.sz}pt`),r.color&&r.color!==c.color&&(t.color=r.color),r.name&&r.name!==c.name&&(t.fontFamily=$e(r.name))}let l=o[V(e.a.fillId,0)];l&&(t.background=l),Object.assign(t,s[V(e.a.borderId,0)]);let u=L(e,`alignment`),d,f=!1;if(u){let e=u.a.horizontal;e&&e!==`general`&&(d=e,t.textAlign=e===`center`||e===`centerContinuous`?`center`:e===`right`?`right`:e===`justify`||e===`distributed`?`justify`:`left`);let n=u.a.vertical;t.alignItems=n===`top`?`flex-start`:n===`center`?`center`:`flex-end`,f=u.a.wrapText===`1`||u.a.wrapText===`true`,f&&(t.whiteSpace=`pre-wrap`);let r=V(u.a.indent);r&&(t[d===`right`?`paddingRight`:`paddingLeft`]=`${r*9+2}px`);let i=V(u.a.textRotation);i&&(t.textRotate=i===255?255:i>90?90-i:i)}return{numFmt:i.get(n)??Mo[n]??`General`,fontPt:r?.sz??c.sz??11,css:t,hAlign:d,wrap:f}});return u.length||u.push({numFmt:`General`,fontPt:c.sz??11,css:{},wrap:!1}),{xfs:u,baseFont:l}}var Xo=16384,Zo=e=>e.indexOf(`_x`)>=0?e.replace(/_x([0-9A-Fa-f]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16))):e;function Qo(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65)break;t=t*26+((r&-33)-64)}return t-1}function $o(e){let t=``;for(e++;e>0;){let n=(e-1)%26;t=String.fromCharCode(65+n)+t,e=Math.floor((e-1)/26)}return t}function es(e){let t=0;for(;t<e.length&&e.charCodeAt(t)>=65;)t++;return[Number(e.slice(t))-1,Qo(e.slice(0,t))]}function ts(e){let[t,n]=e.replace(/\$/g,``).split(`:`);if(!t)return;let[r,i]=es(t),[a,o]=n?es(n):[r,i];return{r0:r,c0:i,r1:a,c1:o}}var ns=class{constructor(){A(this,`shared`,new Map),A(this,`depOf`,new Map),A(this,`edited`,new Set),A(this,`rowAttrs`,new Map),A(this,`autoRowH`,new Map),A(this,`structural`,!1),A(this,`dirtyCols`,!1),A(this,`dirtyMerges`,!1),A(this,`dirtyView`,!1),A(this,`dirtyRows`,new Set),A(this,`formulaChanged`,!1),A(this,`uncached`,[]),A(this,`rows`,[]),A(this,`maxRow`,-1),A(this,`maxCol`,-1),A(this,`formulas`,new Map),A(this,`merges`,[]),A(this,`colInfo`,[]),A(this,`defaultColW`,64),A(this,`defaultRowH`,20),A(this,`frozen`,{rows:0,cols:0}),A(this,`gridLines`,!0),A(this,`done`,!1),A(this,`error`,void 0),A(this,`loading`,void 0)}},rs=class{constructor(e,t=[],n=11){A(this,`d`,void 0),A(this,`fontPt`,void 0),A(this,`basePt`,void 0),A(this,`row`,-1),A(this,`rowCells`,null),A(this,`col`,-1),A(this,`cType`,``),A(this,`cStyle`,0),A(this,`val`,``),A(this,`formula`,``),A(this,`hasVal`,!1),A(this,`capture`,0),A(this,`fShared`,-1),A(this,`inIs`,!1),A(this,`newSizes`,[]),A(this,`headerReady`,!1),A(this,`rowHasHt`,!1),A(this,`rowMaxPt`,0),this.d=e,this.fontPt=t,this.basePt=n}open(e,t){switch(e){case`c`:{let e=t.r;this.col=e?es(e)[1]:this.col+1,this.cType=t.t??``,this.cStyle=t.s?Number(t.s):0,this.val=``,this.formula=``,this.hasVal=!1;return}case`v`:this.capture=1,this.hasVal=!0;return;case`f`:this.capture=2,this.fShared=t.t===`shared`&&t.si!==void 0?Number(t.si):-1;return;case`is`:this.inIs=!0,this.hasVal=!0;return;case`t`:this.inIs&&(this.capture=3);return;case`rPh`:return!0;case`row`:{this.headerReady=!0,this.row=t.r?Number(t.r)-1:this.row+1,this.col=-1,this.rowCells=[];let e=t.hidden===`1`||t.hidden===`true`;if((e||t.ht)&&this.d.rowAttrs.set(this.row,{ht:t.ht?Number(t.ht):void 0,hidden:e||void 0}),this.rowHasHt=e||!!t.ht,this.rowMaxPt=0,e)this.newSizes.push([this.row,0]);else if(t.ht){let e=Math.round(Number(t.ht)*4/3);e!==this.d.defaultRowH&&this.newSizes.push([this.row,e])}return}case`sheetFormatPr`:{let e=V(t.defaultRowHeight);e&&(this.d.defaultRowH=Math.round(e*4/3));let n=V(t.defaultColWidth),r=V(t.baseColWidth);n?this.d.defaultColW=Math.round(n*7):r!==void 0&&(this.d.defaultColW=Math.round(r*7+8));return}case`col`:{let e=Number(t.min)-1,n=Math.min(Number(t.max)-1,16383),r=t.hidden===`1`||t.hidden===`true`?0:t.width?Math.round(Number(t.width)*7):this.d.defaultColW;this.d.colInfo.push({min:e,max:n,w:r});return}case`pane`:(t.state===`frozen`||t.state===`frozenSplit`)&&(this.d.frozen={rows:Math.round(V(t.ySplit,0)),cols:Math.round(V(t.xSplit,0))});return;case`sheetView`:(t.showGridLines===`0`||t.showGridLines===`false`)&&(this.d.gridLines=!1);return;case`sheetData`:this.headerReady=!0;return;case`mergeCell`:{let e=t.ref?ts(t.ref):void 0;e&&this.d.merges.push(e);return}case`extLst`:case`conditionalFormatting`:case`dataValidations`:case`headerFooter`:return!0}}close(e){switch(e){case`v`:case`f`:case`t`:this.capture=0;return;case`is`:this.inIs=!1;return;case`c`:{let e=this.rowCells;if(!e)return;let t=this.col;t>this.d.maxCol&&(this.d.maxCol=t);let n=this.row*Xo+t;if(this.formula&&this.d.formulas.set(n,this.formula),this.fShared>=0&&(this.formula?this.d.shared.set(this.fShared,{master:n,text:this.formula}):this.d.depOf.set(n,this.fShared),this.fShared=-1),!this.hasVal||this.formula&&this.val===``&&this.cType!==`str`){this.formula?(this.d.uncached.push(this.row*Xo+t),e.push(t,6,``,this.cStyle)):this.cStyle&&e.push(t,6,``,this.cStyle);return}let r=0,i;switch(this.cType){case`s`:r=1,i=Number(this.val);break;case`str`:case`inlineStr`:r=2,i=Zo(this.val);break;case`b`:r=3,i=+(this.val===`1`||this.val===`true`);break;case`e`:r=4,i=this.val;break;case`d`:r=5,i=this.val;break;default:{let e=Number(this.val);this.val===``||Number.isNaN(e)?(r=this.val===``?6:2,i=this.val):i=e}}if(e.push(t,r,i,this.cStyle),!this.rowHasHt){let e=this.fontPt[this.cStyle]??this.basePt;e>this.rowMaxPt&&(this.rowMaxPt=e)}return}case`row`:if(!this.rowHasHt&&this.rowMaxPt>this.basePt*1.15){let e=Math.round(this.rowMaxPt*(4/3)*1.3+3);e>this.d.defaultRowH&&(this.newSizes.push([this.row,e]),this.d.autoRowH.set(this.row,e))}this.rowCells&&this.rowCells.length&&(this.d.rows[this.row]=this.rowCells),this.row>this.d.maxRow&&(this.d.maxRow=this.row),this.rowCells=null;return}}text(e){this.capture===1?this.val+=e:this.capture===2?this.formula+=e:this.capture===3&&(this.val+=e)}},is=class{constructor(){A(this,`strings`,[]),A(this,`cur`,``),A(this,`capture`,!1)}open(e){if(e===`si`)this.cur=``;else if(e===`t`)this.capture=!0;else if(e===`rPh`||e===`phoneticPr`)return!0}close(e){e===`t`?this.capture=!1:e===`si`&&this.strings.push(Zo(this.cur))}text(e){this.capture&&(this.cur+=e)}},as=class e{constructor(e,t,n,r,i,a,o){A(this,`pkg`,void 0),A(this,`mainPath`,void 0),A(this,`rels`,void 0),A(this,`sheets`,void 0),A(this,`styles`,void 0),A(this,`date1904`,void 0),A(this,`theme`,void 0),A(this,`sheetsData`,new Map),A(this,`calc`,new Ao(this)),A(this,`sst`,[]),A(this,`sstLoading`,void 0),this.pkg=e,this.mainPath=t,this.rels=n,this.sheets=r,this.styles=i,this.date1904=a,this.theme=o}static async open(t,n){let r=await t.xml(n),i=await t.rels(n),a=[];for(let e of R(L(r,`sheets`),`sheet`)){let t=i.get(e.a[`r:id`]);t&&t.type.endsWith(`/worksheet`)&&a.push({name:e.a.name??`Sheet${a.length+1}`,index:a.length,path:t.target,hidden:!!e.a.state&&e.a.state!==`visible`})}let o=Ve(i,`theme`),s=Ge(o?await t.xml(o.target):void 0),c=Ve(i,`styles`),l=Yo(c?await t.xml(c.target):void 0,s),u=L(r,`workbookPr`),d=u?.a.date1904===`1`||u?.a.date1904===`true`;return new e(t,n,i,a,l,d,s)}meta(){return{sheets:this.sheets,styles:this.styles.xfs.map(e=>e.css),formats:this.styles.xfs.map(e=>e.numFmt),baseFont:this.styles.baseFont,date1904:this.date1904}}loadSst(e){return this.sstLoading||(this.sstLoading=(async()=>{let t=Ve(this.rels,`sharedStrings`);if(!t||!this.pkg.has(t.target))return;let n=new is;this.sst=n.strings,await Te(await this.pkg.stream(t.target,e),n)})()),this.sstLoading}loadSheet(e,t,n){let r=this.sheetsData.get(e);if(r)return r.loading&&!r.done?r.loading.then(()=>t(this.snapshot(e,r,os(r),!0))):(t(this.snapshot(e,r,os(r),!0)),r.loading??Promise.resolve());let i=new ns;return this.sheetsData.set(e,i),i.loading=(async()=>{let r=this.sheets[e];if(!r)throw Error(`No sheet #${e}`);try{await this.loadSst((e,t)=>n?.(`strings`,e,t));let a=new rs(i,this.styles.xfs.map(e=>e.fontPt),this.styles.xfs[0]?.fontPt??11),o=!1,s=0;if(await Te(await this.pkg.stream(r.path,(e,t)=>n?.(`sheet`,e,t)),a,{onChunk:async()=>{let n=Date.now();!o&&a.headerReady?(o=!0,t(this.snapshot(e,i,a.newSizes.splice(0),!0)),s=n,await new Promise(e=>setTimeout(e,0))):n-s>150&&(s=n,t(this.snapshot(e,i,a.newSizes.splice(0),!1)),await new Promise(e=>setTimeout(e,0)))}}),i.done=!0,t({...this.snapshot(e,i,a.newSizes.splice(0),!o),merges:i.merges}),i.uncached.length){let n=i.uncached.splice(0);(async()=>{await Promise.all(this.sheets.map(t=>t.index===e?null:this.loadSheet(t.index,()=>{}))),this.calc.invalidate(),this.calc.computeMissing(e,n),t({...this.snapshot(e,i,[],!1),recalc:!0})})()}}catch(n){i.done=!0,i.error=n.message,t({...this.snapshot(e,i,[],!0),error:i.error})}})(),i.loading}snapshot(e,t,n,r){let i={sheet:e,rows:t.maxRow+1,cols:t.maxCol+1,rowSizes:n,done:t.done};return r&&(i.colInfo=t.colInfo,i.defaultColW=t.defaultColW,i.defaultRowH=t.defaultRowH,i.frozen=t.frozen,i.gridLines=t.gridLines),t.done&&(i.merges=t.merges),t.error&&(i.error=t.error),i}block(e,t,n){let r=this.sheetsData.get(e),i=[];if(!r)return{sheet:e,r0:t,r1:n,rows:i,complete:!1};let a=this.styles.xfs,o=Math.min(n,r.rows.length);for(let e=t;e<o;e++){let t=r.rows[e];if(!t)continue;let n=[];for(let e=0;e<t.length;e+=4){let r=t[e],i=t[e+1],o=t[e+2],s=t[e+3],c=a[s]??a[0];switch(i){case 0:{let e=Ko(o,c.numFmt,this.date1904);n.push(e.color?[r,e.text,s,1,e.color]:[r,e.text,s,1]);break}case 1:n.push([r,qo(this.sst[o]??``,c.numFmt),s,0]);break;case 2:n.push([r,qo(o,c.numFmt),s,0]);break;case 3:n.push([r,o?`TRUE`:`FALSE`,s,2]);break;case 4:n.push([r,o,s,2]);break;case 5:n.push([r,o.replace(`T00:00:00`,``).replace(`T`,` `).replace(/Z$/,``),s,1]);break;default:n.push([r,``,s,0])}}i.push({r:e,cells:n})}return{sheet:e,r0:t,r1:n,rows:i,complete:r.done||n<=r.maxRow}}find(e,t,n={},r=2e4){let i=this.sheetsData.get(e),a=[];if(!i||!t)return a;let o=e=>n.matchCase?e:e.toLowerCase(),s=o(t),c=this.styles.xfs;for(let e=0;e<i.rows.length&&a.length<r;e++){let t=i.rows[e];if(t)for(let l=0;l<t.length&&a.length<r;l+=4){let r=t[l],u=t[l+1],d=t[l+2],f=n.formulas?i.formulas.get(e*Xo+r):void 0,p;if(p=f?`=`+f:u===0?Ko(d,(c[t[l+3]]??c[0])?.numFmt,this.date1904).text:u===1?this.sst[d]??``:u===3?d?`TRUE`:`FALSE`:u===6?``:String(d),!p)continue;let m=o(p);(n.whole?m===s:m.includes(s))&&a.push({r:e,c:r,text:p})}}return a}cell(e,t,n){let r=this.sheetsData.get(e),i=r?.rows[t],a=r?.formulas.get(t*Xo+n);if(!i)return a?{value:``,formula:`=`+a,type:`formula`}:void 0;for(let e=0;e<i.length;e+=4){if(i[e]!==n)continue;let t=i[e+1],r=i[e+2],o=t===1?this.sst[r]??``:t===3?r?`TRUE`:`FALSE`:String(r),s=[`number`,`string`,`string`,`boolean`,`error`,`date`,`empty`][t];return{value:o,formula:a?`=`+a:void 0,type:s}}return a?{value:``,formula:`=`+a,type:`formula`}:void 0}unload(e){this.sheetsData.get(e)?.done&&this.sheetsData.delete(e)}};function os(e){let t=[];for(let[n,r]of e.autoRowH)e.rowAttrs.has(n)||t.push([n,r]);for(let[n,r]of e.rowAttrs)t.push([n,r.hidden?0:r.ht===void 0?e.autoRowH.get(n)??e.defaultRowH:Math.round(r.ht*4/3)]);return t}function ss(e){return{rows:e.rows.map(e=>e&&e.slice()),formulas:new Map(e.formulas),merges:e.merges.map(e=>({...e})),colInfo:e.colInfo.map(e=>({...e})),rowAttrs:new Map([...e.rowAttrs].map(([e,t])=>[e,{...t}])),autoRowH:new Map(e.autoRowH),maxRow:e.maxRow,maxCol:e.maxCol,frozen:{...e.frozen}}}function cs(e,t){e.rows=t.rows.map(e=>e&&e.slice()),e.formulas=new Map(t.formulas),e.merges=t.merges.map(e=>({...e})),e.colInfo=t.colInfo.map(e=>({...e})),e.rowAttrs=new Map([...t.rowAttrs].map(([e,t])=>[e,{...t}])),e.autoRowH=new Map(t.autoRowH),e.maxRow=t.maxRow,e.maxCol=t.maxCol,e.frozen={...t.frozen},e.structural=!0,e.dirtyCols=e.dirtyMerges=e.dirtyView=!0}function ls(e){for(let[t,n]of e.depOf){let r=e.shared.get(n);if(!r||e.formulas.has(t))continue;let i=Math.floor(t/Xo)-Math.floor(r.master/Xo),a=t%Xo-r.master%Xo;e.formulas.set(t,lo(r.text,i,a))}e.depOf.clear(),e.shared.clear()}function us(e,t,n,r){let i=[];for(let a of e){let[e,o]=t===`row`?[a.r0,a.r1]:[a.c0,a.c1];if(r>0)e>=n&&(e+=r),o>=n&&(o+=r);else{let t=n-r;if(e>=n&&o<t||(e=(e=>e<n?e:e>=t?e+r:n)(e),o=o>=t?o+r:o>=n?n-1:o,o<e))continue}let s=t===`row`?{...a,r0:e,r1:o}:{...a,c0:e,c1:o};(s.r0!==s.r1||s.c0!==s.c1)&&i.push(s)}return i}function ds(e,t,n,r,i,a){ls(e);let o=r-i;if(n===`row`){i>0?e.rows.splice(r,0,...Array(i).fill(void 0)):e.rows.splice(r,-i),e.maxRow=Math.max(-1,e.maxRow+(e.maxRow>=r?i:0));let t=new Map;for(let[n,a]of e.rowAttrs)i<0&&n>=r&&n<o||t.set(n>=r?n+i:n,a);e.rowAttrs=t;let n=new Map;for(let[t,a]of e.autoRowH)i<0&&t>=r&&t<o||n.set(t>=r?t+i:t,a);e.autoRowH=n}else{for(let t=0;t<e.rows.length;t++){let n=e.rows[t];if(!n)continue;let a=[];for(let e=0;e<n.length;e+=4){let t=n[e];i<0&&t>=r&&t<o||a.push(t>=r?t+i:t,n[e+1],n[e+2],n[e+3])}e.rows[t]=a.length?a:void 0}e.maxCol=Math.max(-1,e.maxCol+(e.maxCol>=r?i:0));let t=[];for(let n of e.colInfo){let{min:e,max:a}=n;if(i>0)e>=r&&(e+=i),a>=r&&(a+=i);else if(e>=r&&a<o||(e=e<r?e:e>=o?e+i:r,a=a>=o?a+i:a>=r?r-1:a,a<e))continue;t.push({...n,min:e,max:a})}e.colInfo=t,e.dirtyCols=!0}let s={sheet:t,formulaSheet:t,axis:n,at:r,delta:i},c=new Map;for(let[t,a]of e.formulas){let e=Math.floor(t/Xo),l=t%Xo,u=n===`row`?e:l;i<0&&u>=r&&u<o||(u>=r&&(n===`row`?e+=i:l+=i),c.set(e*Xo+l,fo(a,s)))}e.formulas=c;for(let t of a){if(t.d===e)continue;let n=!1;for(let[e,r]of t.d.formulas){let i=fo(r,{...s,formulaSheet:t.name});i!==r&&(t.d.formulas.set(e,i),t.d.edited.add(e),n=!0)}n&&(t.d.formulaChanged=!0)}e.merges=us(e.merges,n,r,i),n===`row`&&e.frozen.rows>r&&(e.frozen={...e.frozen,rows:Math.max(0,e.frozen.rows+(i>0?i:Math.max(i,r-e.frozen.rows)))}),n===`col`&&e.frozen.cols>r&&(e.frozen={...e.frozen,cols:Math.max(0,e.frozen.cols+(i>0?i:Math.max(i,r-e.frozen.cols)))}),e.structural=!0,e.dirtyMerges=!0,e.dirtyView=!0}function fs(e,t,n){let r=e=>e.r1>=t.r0&&e.r0<=t.r1&&e.c1>=t.c0&&e.c0<=t.c1;e.merges=e.merges.filter(e=>!r(e)),n&&(t.r0!==t.r1||t.c0!==t.c1)&&e.merges.push({...t}),e.dirtyMerges=!0}function ps(e,t,n,r){let i=[];for(let r of e.colInfo)r.max<t||r.min>n?i.push(r):(r.min<t&&i.push({...r,max:t-1}),r.max>n&&i.push({...r,min:n+1}));i.push({min:t,max:n,w:Math.max(0,Math.round(r))}),e.colInfo=i.sort((e,t)=>e.min-t.min),e.dirtyCols=!0}function ms(e,t,n,r){for(let i=t;i<=n;i++)e.rowAttrs.set(i,r>0?{ht:+(r*.75).toFixed(2)}:{...e.rowAttrs.get(i)??{},hidden:!0}),e.dirtyRows.add(i)}var hs=`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,gs=[`b`,`i`,`strike`,`condense`,`extend`,`outline`,`shadow`,`u`,`vertAlign`,`sz`,`color`,`name`,`family`,`charset`,`scheme`],_s=[`fileVersion`,`fileSharing`,`workbookPr`,`workbookProtection`,`bookViews`,`sheets`,`functionGroups`,`externalReferences`,`definedNames`,`calcPr`,`oleSize`,`customWorkbookViews`,`pivotCaches`,`smartTagPr`,`smartTagTypes`,`webPublishing`,`fileRecoveryPr`,`webPublishObjects`,`extLst`],vs=[`numFmts`,`fonts`,`fills`,`borders`,`cellStyleXfs`,`cellXfs`,`cellStyles`,`dxfs`,`tableStyles`,`colors`,`extLst`];function ys(e,t,n){let r=e.rows[t];return!r&&n&&(e.rows[t]=r=[]),r}function bs(e,t,n){let r=e.rows[t];if(!r)return null;for(let e=0;e<r.length;e+=4)if(r[e]===n)return[r[e+1],r[e+2],r[e+3]];return null}function xs(e,t,n,r){let i=ys(e,t,!!r);if(!i)return;let a=0;for(;a<i.length&&!(i[a]>=n);a+=4);let o=a<i.length&&i[a]===n;r?(o?(i[a+1]=r[0],i[a+2]=r[1],i[a+3]=r[2]):i.splice(a,0,n,r[0],r[1],r[2]),t>e.maxRow&&(e.maxRow=t),n>e.maxCol&&(e.maxCol=n)):(o&&i.splice(a,4),i.length||(e.rows[t]=void 0))}function Ss(e){let t=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(e),n,r,i;if(t)[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];else{if(t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?: (\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(e),!t)return;[i,r,n]=[Number(t[1]),Number(t[2]),Number(t[3])]}let a=Date.UTC(n,r-1,i,Number(t[4]??0),Number(t[5]??0),Number(t[6]??0));if(Number.isFinite(a))return a/864e5+25569}function Cs(e,t,n=!1){if(e===``)return{e:t?[6,``,t]:null};if(e.startsWith(`=`)&&e.length>1)return{e:[2,e,t],f:e.slice(1)};let r=e.trim();if(/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i.test(r))return{e:[0,Number(r),t]};if(/^[-+]?(\d+\.?\d*|\.\d+)%$/.test(r))return{e:[0,Number(r.slice(0,-1))/100,t]};if(/^(true|false)$/i.test(r))return{e:[3,+!!/^true$/i.test(r),t]};if(n){let e=Ss(r);if(e!==void 0)return{e:[0,e,t]}}return{e:[2,e,t]}}var ws=class{constructor(e){A(this,`nodes`,void 0),A(this,`root`,void 0),A(this,`P`,void 0),A(this,`cache`,new Map),A(this,`found`,new Map),A(this,`changed`,!1),this.nodes=g(e),this.root=b(this.nodes),this.P=y(this.root.q)}section(e){let t=S(this.root,e);return t||(t=E(this.P+e,{count:`0`}),O(this.root,t,e,vs)),t}append(e,t){let n=this.section(e);n.c.push(t),n.self=!1;let r=x(n).length;return T(n,`count`,String(r)),this.changed=!0,r-1}lookup(e){let t=this.found.get(e);if(!t){let n=new Map;x(S(this.root,e)).forEach((e,t)=>{let r=_([e]);n.has(r)||n.set(r,t)}),this.found.set(e,t=n)}return t}intern(e,t){let n=_([t]),r=this.lookup(e),i=r.get(n);if(i!==void 0)return i;let a=this.append(e,t);return r.set(n,a),a}numFmtId(e){for(let[t,n]of Object.entries(Mo))if(n===e)return Number(t);let t=S(this.root,`numFmts`),n=163;for(let r of x(t,`numFmt`)){let t=Number(w(r,`numFmtId`));if(w(r,`formatCode`)===e)return t;n=Math.max(n,t)}return this.append(`numFmts`,E(this.P+`numFmt`,{numFmtId:String(n+1),formatCode:e})),n+1}derive(e,t){let n=e+JSON.stringify(t),r=this.cache.get(n);if(r!==void 0)return r;let i=this.P,a=x(this.section(`cellXfs`),`xf`),o=D(a[e]??a[0]??E(i+`xf`,{numFmtId:`0`,fontId:`0`,fillId:`0`,borderId:`0`}));if([`b`,`i`,`u`,`strike`,`color`,`sz`,`font`].some(e=>e in t)){let e=x(this.section(`fonts`),`font`),n=D(e[Number(w(o,`fontId`)??0)]??e[0]??E(i+`font`)),r=(e,t)=>O(n,t,e,gs);t.b!==void 0&&r(`b`,t.b?E(i+`b`):void 0),t.i!==void 0&&r(`i`,t.i?E(i+`i`):void 0),t.strike!==void 0&&r(`strike`,t.strike?E(i+`strike`):void 0),t.u!==void 0&&r(`u`,t.u?E(i+`u`):void 0),t.sz!==void 0&&r(`sz`,E(i+`sz`,{val:String(t.sz)})),`color`in t&&r(`color`,t.color?E(i+`color`,{rgb:`FF`+t.color.replace(`#`,``).toUpperCase()}):void 0),t.font&&(r(`name`,E(i+`name`,{val:t.font})),r(`scheme`,void 0)),T(o,`fontId`,String(this.intern(`fonts`,n))),T(o,`applyFont`,`1`)}if(`fill`in t){if(!t.fill)T(o,`fillId`,`0`);else{let e=g(`<${i}fill><${i}patternFill patternType="solid"><${i}fgColor rgb="FF${t.fill.replace(`#`,``).toUpperCase()}"/><${i}bgColor indexed="64"/></${i}patternFill></${i}fill>`)[0];T(o,`fillId`,String(this.intern(`fills`,e)))}T(o,`applyFill`,`1`)}if(t.border){let e=t.sides??{},n=x(this.section(`borders`),`border`),r=D(n[Number(w(o,`borderId`)??0)]??n[0]??E(i+`border`)),a=(t.borderColor??`#000000`).replace(`#`,``).toUpperCase(),s=[`left`,`start`,`right`,`end`,`top`,`bottom`,`diagonal`,`vertical`,`horizontal`];for(let n of[`left`,`right`,`top`,`bottom`])n in e&&O(r,e[n]?E(i+n,{style:t.borderStyle??`thin`},[E(i+`color`,{rgb:`FF`+a})]):E(i+n),n,s);S(r,`diagonal`)||O(r,E(i+`diagonal`),`diagonal`,s),T(o,`borderId`,String(this.intern(`borders`,r))),T(o,`applyBorder`,`1`)}if(`align`in t||`wrap`in t||`valign`in t||`rotate`in t){let e=D(S(o,`alignment`)??E(i+`alignment`));if(`align`in t&&T(e,`horizontal`,t.align??void 0),`valign`in t&&T(e,`vertical`,t.valign&&t.valign!==`bottom`?t.valign:void 0),`wrap`in t&&T(e,`wrapText`,t.wrap?`1`:void 0),`rotate`in t){let n=t.rotate;T(e,`textRotation`,n?n===255?`255`:String(n>0?Math.min(90,n):90+Math.min(90,-n)):void 0)}O(o,e.a.trim()?e:void 0,`alignment`,[`alignment`,`protection`,`extLst`]),T(o,`applyAlignment`,`1`)}t.numFmt!==void 0&&(T(o,`numFmtId`,String(this.numFmtId(t.numFmt))),T(o,`applyNumberFormat`,`1`));let s=this.intern(`cellXfs`,o);return this.cache.set(n,s),s}xml(){return _(this.nodes)}mark(){let e={};for(let t of[`numFmts`,`fonts`,`fills`,`borders`,`cellXfs`])e[t]=x(S(this.root,t)).length;return e}truncate(e){for(let[t,n]of Object.entries(e)){let e=S(this.root,t),r=x(e);if(!e||r.length<=n)continue;let i=new Set(r.slice(n));e.c=e.c.filter(e=>!i.has(e)),T(e,`count`,String(n));let a=this.found.get(t);if(a)for(let[e,t]of a)t>=n&&a.delete(e)}for(let[t,n]of this.cache)n>=e.cellXfs&&this.cache.delete(t)}},Ts=class{constructor(e){A(this,`wb`,void 0),A(this,`undoStack`,[]),A(this,`redoStack`,[]),A(this,`styleEd`,void 0),A(this,`stylesPath`,void 0),A(this,`formulaTouched`,!1),A(this,`lastRecalc`,[]),A(this,`bookChanged`,!1),A(this,`newSheets`,new Map),this.wb=e}get dirty(){return[...this.wb.sheetsData.values()].some(Ds)||!!this.styleEd?.changed||this.bookChanged}sheet(e){let t=this.wb.sheetsData.get(e);if(!t||!t.done)throw Error(`Sheet is still loading`);return t}apply(e,t,n){let r=[...this.wb.sheetsData].find(([,t])=>t===e)?.[0]??0,i=[];this.applyRaw(e,t,n);for(let e of t){let t=n===`prev`?e.nextF:e.prevF,a=n===`prev`?e.prevF:e.nextF;t!==a&&this.wb.calc.formulaChanged(r,e.key),a&&i.push({sheet:r,key:e.key})}let a=t.filter(e=>{if(n===`prev`?e.prevF:e.nextF)return!1;let t=e.prev,r=e.next;return!t||!r||t[0]!==r[0]||t[1]!==r[1]||e.prevF!==e.nextF});this.lastRecalc=a.length||i.length?[...this.wb.calc.recalc(a.map(e=>({sheet:r,key:e.key})),i)]:[]}applyRaw(e,t,n){for(let r of t){xs(e,Math.floor(r.key/Xo),r.key%Xo,n===`prev`?r.prev:r.next);let t=n===`prev`?r.prevF:r.nextF;t?e.formulas.set(r.key,t):e.formulas.delete(r.key),e.edited.add(r.key),(r.prevF||r.nextF)&&(this.formulaTouched=!0)}}record(e,t,n){return this.undoStack.push({sheet:e,cells:t,range:n}),this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],{sheet:e,range:n,recalc:this.lastRecalc}}recalcAll(){this.wb.calc.invalidate();let e=[];for(let[t,n]of this.wb.sheetsData)for(let r of n.formulas.keys())e.push({sheet:t,key:r});return[...this.wb.calc.recalc([],e)]}setCells(e,t){let n=this.sheet(e),r=[],i={r0:1/0,c0:1/0,r1:-1,c1:-1};for(let{r:e,c:a,input:o}of t){let t=e*Xo+a,s=bs(n,e,a),c=s?.[2]??0,{e:l,f:u}=Cs(o,c,zo(this.wb.styles.xfs[c]?.numFmt??``));r.push({key:t,prev:s,prevF:n.formulas.get(t),next:l,nextF:u}),i.r0=Math.min(i.r0,e),i.c0=Math.min(i.c0,a),i.r1=Math.max(i.r1,e),i.c1=Math.max(i.c1,a)}return this.apply(n,r,`next`),this.record(e,r,i)}async styles(){if(!this.styleEd){let e=Ve(this.wb.rels,`styles`);this.stylesPath=e?.target??`xl/styles.xml`;let t=this.wb.pkg.has(this.stylesPath)?await this.wb.pkg.text(this.stylesPath):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
19
19
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="1"><font><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs></styleSheet>`;this.styleEd=new ws(t)}return this.styleEd}async format(e,t,n){let r=this.sheet(e),i=await this.styles(),a=this.wb.styles.xfs.length,o=[],s=Math.min(t.r1,t.r0+2e5),c=3e5;for(let e=t.r0;e<=s&&c>0;e++)for(let a=t.c0;a<=t.c1&&c>0;a++,c--){let s=e*Xo+a,c=bs(r,e,a),l=n.border?{...n,sides:js(n.border,t,e,a)}:n;if(n.border&&!Object.keys(l.sides).length)continue;let u=n.clear?0:n.xf===void 0?i.derive(c?.[2]??0,l):n.xf,d=c?[c[0],c[1],u]:[6,``,u],f=r.formulas.get(s);o.push({key:s,prev:c,prevF:f,next:d,nextF:f})}this.apply(r,o,`next`);let l=i.xml();this.wb.pkg.setPart(this.stylesPath,l),this.wb.styles=Yo(ke(l),this.wb.theme);let u=this.record(e,o,t);return u.styles=this.wb.styles.xfs.slice(a).map((e,t)=>({index:a+t,css:e.css,format:e.numFmt})),u}step(e,t){let n=this.sheet(e.sheet);this.lastRecalc=[],e.full&&cs(n,t===`prev`?e.full.before:e.full.after),this.apply(n,e.cells,t),e.lay&&ks(n,t===`prev`?e.lay.before:e.lay.after);let r=e.full?this.recalcAll():this.lastRecalc;return{sheet:e.sheet,range:e.range,layout:e.full||e.lay?this.layout(e.sheet):void 0,recalc:r}}undo(){let e=this.undoStack.pop();return e?(this.redoStack.push(e),this.step(e,`prev`)):null}redo(){let e=this.redoStack.pop();return e?(this.undoStack.push(e),this.step(e,`next`)):null}takeRecord(){let e=this.undoStack.pop();return this.undoStack=[],this.redoStack=[],e}revertRecord(e){return this.step(e,`prev`)}restoreRecord(e,t){let n=this.sheet(e.sheet),r=e.cells.map(e=>({key:e.key,prev:bs(n,Math.floor(e.key/Xo),e.key%Xo),prevF:n.formulas.get(e.key),next:t===`prev`?e.prev:e.next,nextF:t===`prev`?e.prevF:e.nextF})),i={sheet:e.sheet,cells:r,range:e.range,lay:e.lay?{before:Os(n),after:t===`prev`?e.lay.before:e.lay.after}:void 0,full:e.full?{before:ss(n),after:t===`prev`?e.full.before:e.full.after}:void 0},a=this.step(i,`next`);return this.undoStack.push(i),a}async styleMark(){return(await this.styles()).mark()}async styleTruncate(e){let t=await this.styles(),n=t.xml();t.truncate(e);let r=t.xml();r!==n&&(this.wb.pkg.setPart(this.stylesPath,r),this.wb.styles=Yo(ke(r),this.wb.theme))}styleAt(e,t,n){return bs(this.sheet(e),t,n)?.[2]??0}layout(e){let t=this.sheet(e),n=os(t);return{sheet:e,rows:t.maxRow+1,cols:t.maxCol+1,rowSizes:n,done:!0,colInfo:t.colInfo,defaultColW:t.defaultColW,defaultRowH:t.defaultRowH,frozen:t.frozen,gridLines:t.gridLines,merges:t.merges}}async allSheets(){return await Promise.all(this.wb.sheets.map(e=>this.wb.loadSheet(e.index,()=>{}))),this.wb.sheets.map(e=>({name:e.name,d:this.wb.sheetsData.get(e.index)}))}async sheetOp(e,t){let n=this.sheet(e),r=this.wb.sheets[e].name,i={r0:0,c0:0,r1:Math.max(0,n.maxRow+50),c1:Math.max(0,n.maxCol+10)},a=(t,r=i)=>{let a=Os(n);t();let o={sheet:e,cells:[],range:r,lay:{before:a,after:Os(n)}};return this.undoStack.push(o),this.redoStack=[],{sheet:e,range:r,layout:this.layout(e)}};switch(t.op){case`insertRows`:case`deleteRows`:case`insertCols`:case`deleteCols`:{let a=await this.allSheets(),o=ss(n);ds(n,r,t.op.endsWith(`Rows`)?`row`:`col`,t.at,t.op.startsWith(`insert`)?t.n:-t.n,a),this.formulaTouched=!0;let s=this.recalcAll(),c={sheet:e,cells:[],range:i,full:{before:o,after:ss(n)}};return this.undoStack.push(c),this.redoStack=[],{sheet:e,range:i,layout:this.layout(e),recalc:s}}case`merge`:case`unmerge`:{let r=t.range,i=t.op===`unmerge`||!t.mode||t.mode===`all`?[r]:t.mode===`across`?Array.from({length:r.r1-r.r0+1},(e,t)=>({r0:r.r0+t,r1:r.r0+t,c0:r.c0,c1:r.c1})):Array.from({length:r.c1-r.c0+1},(e,t)=>({r0:r.r0,r1:r.r1,c0:r.c0+t,c1:r.c0+t})),o=a(()=>{if(fs(n,r,!1),t.op===`merge`)for(let e of i)fs(n,e,!0)},r);if(t.op===`merge`){let t=[];for(let e of i)for(let r=e.r0;r<=e.r1;r++)for(let i=e.c0;i<=e.c1;i++)(r!==e.r0||i!==e.c0)&&bs(n,r,i)&&bs(n,r,i)?.[1]!==``&&t.push({r,c:i,input:``});if(t.length){this.setCells(e,t);let n=this.undoStack.pop();this.undoStack[this.undoStack.length-1].cells=n.cells}}return o}case`hideRows`:return a(()=>{for(let e=t.a;e<=t.b;e++){let r=n.rowAttrs.get(e);if(t.hidden)n.rowAttrs.set(e,{...r??{},hidden:!0});else if(r){let{hidden:t,...i}=r;i.ht===void 0?n.rowAttrs.delete(e):n.rowAttrs.set(e,i)}n.dirtyRows.add(e)}});case`hideCols`:return a(()=>As(n,t.a,t.b,t.hidden));case`gridlines`:return a(()=>{n.gridLines=t.show,n.dirtyView=!0});case`colWidth`:return a(()=>ps(n,t.c0,t.c1,t.px));case`rowHeight`:return a(()=>ms(n,t.r0,t.r1,t.px));case`freeze`:return a(()=>{n.frozen={rows:t.rows,cols:t.cols},n.dirtyView=!0});case`fill`:return this.fill(e,n,t.range,t.dir);case`sort`:return this.sort(e,n,t.range,t.col,!!t.desc)}}replace(e,t,n,r={},i){let a=this.sheet(e),o=new RegExp(r.whole?`^${Ns(t)}$`:Ns(t),r.matchCase?`g`:`gi`),s=[],c=i?[i]:this.wb.find(e,t,r,1e9);for(let{r:t,c:i}of c){let c=a.formulas.get(t*Xo+i),l=r.formulas&&c?`=`+c:this.wb.cell(e,t,i)?.value;if(l===void 0||c&&!r.formulas)continue;let u=l.replace(o,n);u!==l&&s.push({r:t,c:i,input:u})}return s.length?this.setCells(e,s):null}fill(e,t,n,r){ls(t);let i=[];for(let e=n.r0;e<=n.r1;e++)for(let a=n.c0;a<=n.c1;a++){let o=r===`down`?n.r0:e,s=r===`right`?n.c0:a;if(o===e&&s===a)continue;let c=e*Xo+a,l=bs(t,o,s),u=t.formulas.get(o*Xo+s),d=u?lo(u,e-o,a-s):void 0;i.push({key:c,prev:bs(t,e,a),prevF:t.formulas.get(c),next:l?[l[0],d?`=`+d:l[1],l[2]]:null,nextF:d})}return this.apply(t,i,`next`),this.record(e,i,n)}sort(e,t,n,r,i){ls(t);let a=[];for(let e=n.r0;e<=n.r1;e++){let i=[],o=[];for(let r=n.c0;r<=n.c1;r++)i.push(bs(t,e,r)),o.push(t.formulas.get(e*Xo+r));let s=bs(t,e,r),c=s?s[0]===1?this.wb.sst[s[1]]:s[1]:null;a.push({r:e,cells:i,f:o,key:c===``?null:c})}let o=(e,t)=>e==null?1:t==null?-1:typeof e==`number`&&typeof t==`number`?e-t:typeof e==`number`?-1:typeof t==`number`?1:String(e).localeCompare(String(t),void 0,{sensitivity:`base`,numeric:!0}),s=[...a].sort((e,t)=>{let n=o(e.key,t.key);return i&&e.key!==null&&t.key!==null?-n:n}),c=[];return s.forEach((e,r)=>{let i=n.r0+r;for(let r=n.c0;r<=n.c1;r++){let a=r-n.c0,o=i*Xo+r,s=e.f[a]?lo(e.f[a],i-e.r,0):void 0,l=e.cells[a];c.push({key:o,prev:bs(t,i,r),prevF:t.formulas.get(o),next:l?[l[0],s?`=`+s:l[1],l[2]]:null,nextF:s})}}),this.apply(t,c,`next`),this.record(e,c,n)}async bookOp(e){let t=this.wb.pkg,n=g(await t.text(this.wb.mainPath)),r=b(n),i=y(r.q),a=S(r,`sheets`),o=x(a,`sheet`),s=this.wb.sheets,c=e=>{let t=new Map(this.wb.sheetsData);this.wb.sheetsData.clear(),e.forEach((e,n)=>{let r=t.get(e);r&&this.wb.sheetsData.set(n,r)});let n=e.map((e,t)=>({...s[e],index:t}));s.splice(0,s.length,...n)};switch(e.op){case`add`:{let n=t.freeName(`xl/worksheets`,`sheet`,`xml`);this.newSheets.set(n,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
20
20
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/></worksheet>`),t.setPart(n,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
21
21
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/></worksheet>`),await t.setContentType(n,`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`);let l=await t.addRel(this.wb.mainPath,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,n),u=o.map(e=>Number(w(e,`sheetId`)??0)),d=e.name??`Sheet${s.length+1}`;for(;s.some(e=>e.name.toLowerCase()===d.toLowerCase());)d+=`_`;let f=E(i+`sheet`,{name:d,sheetId:String(Math.max(0,...u)+1),...oe(r,`id`,l)}),p=e.after??s.length-1,m=p+1>=o.length?a.c.length:a.c.indexOf(o[p+1]);a.c.splice(m,0,f),a.self=!1;let h={name:d,index:p+1,path:n,hidden:!1},g=s.map((e,t)=>t);s.push({...h,index:s.length}),g.splice(p+1,0,s.length-1),c(g);break}case`rename`:{let t=s[e.index],n=e.name.trim().slice(0,31).replace(/[\\/?*[\]:]/g,`_`);if(!t||!n||s.some((t,r)=>r!==e.index&&t.name.toLowerCase()===n.toLowerCase()))throw Error(`Invalid sheet name`);T(o[e.index],`name`,n);for(let e of await this.allSheets())for(let[r,i]of e.d.formulas){let a=po(i,t.name,n);a!==i&&(e.d.formulas.set(r,a),e.d.edited.add(r))}t.name=n;break}case`delete`:{if(s.length<=1)throw Error(`A workbook needs at least one sheet`);let n=s[e.index];a.c.splice(a.c.indexOf(o[e.index]),1),t.setPart(n.path,null),t.has(ze(n.path))&&t.setPart(ze(n.path),null),await t.removeRelsTo(this.wb.mainPath,n.path),await t.setContentType(n.path,null),c(s.map((e,t)=>t).filter(t=>t!==e.index));let i=S(r,`definedNames`);i&&(i.c=i.c.filter(t=>!(h(t)&&w(t,`localSheetId`)===String(e.index))));break}case`move`:{let t=o[e.from];a.c.splice(a.c.indexOf(t),1);let n=x(a,`sheet`);a.c.splice(e.to>=n.length?a.c.length:a.c.indexOf(n[e.to]),0,t);let r=s.map((e,t)=>t);r.splice(e.from,1),r.splice(e.to,0,e.from),c(r);break}}return t.setPart(this.wb.mainPath,_(n)),this.bookChanged=!0,this.undoStack=[],this.redoStack=[],{sheet:0,range:{r0:0,c0:0,r1:0,c1:0},sheets:s.map(e=>({...e}))}}async save(){let e=this.wb.pkg,t=!1;for(let[n,r]of this.wb.sheetsData){if(!Ds(r))continue;t=!0;let i=this.wb.sheets[n];e.setPart(i.path,()=>this.rewrite(i.path,r))}if(t){let t=g(await e.text(this.wb.mainPath)),n=b(t),r=y(n.q),i=D(S(n,`calcPr`)??E(r+`calcPr`));T(i,`fullCalcOnLoad`,`1`),O(n,i,`calcPr`,_s),e.setPart(this.wb.mainPath,_(t));let a=Ve(this.wb.rels,`calcChain`);a&&this.formulaTouched&&e.has(a.target)&&(e.setPart(a.target,null),await e.removeRelsTo(this.wb.mainPath,a.target),await e.setContentType(a.target,null))}return e.save(hs)}rewrite(e,t){let n=this.wb.pkg,r=this.wb,i=this,a=new Map,o=new Set;for(let[e,n]of t.shared)t.edited.has(n.master)&&o.add(e);if(o.size)for(let[e,n]of t.depOf){if(!o.has(n)||t.edited.has(e))continue;let r=t.shared.get(n),i=Math.floor(e/Xo)-Math.floor(r.master/Xo),s=e%Xo-r.master%Xo;a.set(e,lo(r.text,i,s))}let s=new Map;for(let e of t.dirtyRows)s.has(e)||s.set(e,new Set);for(let e of[...t.edited,...a.keys()]){let t=Math.floor(e/Xo),n=s.get(t);n||s.set(t,n=new Set),n.add(e%Xo)}let c=[...s.keys()].sort((e,t)=>e-t),l=new TextEncoder;return new ReadableStream({async start(o){let u=new Ms(c,s,t,a,r),d=i.newSheets.get(e),f=(d===void 0?await n.zip.stream(e):new Blob([d]).stream()).getReader(),p=new TextDecoder;for(;;){let{done:e,value:t}=await f.read(),n=e?p.decode():p.decode(t,{stream:!0});for(let t of u.push(n,e))t&&o.enqueue(l.encode(t));if(e)break}o.close()}})}};function Es(e,t,n,r,i){let a=t*Xo+n,o=bs(e,t,n),s=e.formulas.get(a);if(!o&&!s)return``;let c=$o(n)+(t+1),l=o?.[2]?` s="${o[2]}"`:``;if(s){let[e,t]=o??[6,``],n=`<${r}f>${te(s)}</${r}f>`;return e===0?`<${r}c r="${c}"${l}>${n}<${r}v>${String(t)}</${r}v></${r}c>`:e===3?`<${r}c r="${c}"${l} t="b">${n}<${r}v>${+!!t}</${r}v></${r}c>`:e===4?`<${r}c r="${c}"${l} t="e">${n}<${r}v>${te(String(t))}</${r}v></${r}c>`:e===2&&!String(t).startsWith(`=`)?`<${r}c r="${c}"${l} t="str">${n}<${r}v>${te(String(t))}</${r}v></${r}c>`:`<${r}c r="${c}"${l}>${n}</${r}c>`}let[u,d]=o;switch(u){case 0:return`<${r}c r="${c}"${l}><${r}v>${String(d)}</${r}v></${r}c>`;case 1:case 2:return`<${r}c r="${c}"${l} t="inlineStr"><${r}is><${r}t xml:space="preserve">${te(u===1?i.sst[d]??``:String(d))}</${r}t></${r}is></${r}c>`;case 3:return`<${r}c r="${c}"${l} t="b"><${r}v>${+!!d}</${r}v></${r}c>`;case 4:return`<${r}c r="${c}"${l} t="e"><${r}v>${te(String(d))}</${r}v></${r}c>`;case 5:return`<${r}c r="${c}"${l} t="d"><${r}v>${te(String(d))}</${r}v></${r}c>`;default:return`<${r}c r="${c}"${l}/>`}}function Ds(e){return e.edited.size>0||e.structural||e.dirtyCols||e.dirtyMerges||e.dirtyView||e.dirtyRows.size>0||e.formulaChanged}function Os(e){return{merges:e.merges.map(e=>({...e})),colInfo:e.colInfo.map(e=>({...e})),rowAttrs:[...e.rowAttrs].map(([e,t])=>[e,{...t}]),frozen:{...e.frozen},gridLines:e.gridLines}}function ks(e,t){if(t.merges&&(e.merges=t.merges.map(e=>({...e}))),t.colInfo&&(e.colInfo=t.colInfo.map(e=>({...e}))),t.rowAttrs){for(let t of e.rowAttrs.keys())e.dirtyRows.add(t);e.rowAttrs=new Map(t.rowAttrs.map(([e,t])=>[e,{...t}]));for(let t of e.rowAttrs.keys())e.dirtyRows.add(t)}t.frozen&&(e.frozen={...t.frozen}),t.gridLines!==void 0&&(e.gridLines=t.gridLines),e.dirtyCols=e.dirtyMerges=e.dirtyView=!0}function As(e,t,n,r){let i=[],a=[];for(let o of e.colInfo){if(o.max<t||o.min>n){i.push(o);continue}o.min<t&&i.push({...o,max:t-1}),o.max>n&&i.push({...o,min:n+1});let s=Math.max(o.min,t),c=Math.min(o.max,n);a.push([s,c]),r?i.push(o.w?{...o,min:s,max:c,w:0,prevW:o.w}:{...o,min:s,max:c}):i.push(o.w?{...o,min:s,max:c}:{min:s,max:c,w:o.prevW||e.defaultColW})}if(r){a.sort((e,t)=>e[0]-t[0]);let r=t;for(let[t,o]of[...a,[n+1,n+1]])t>r&&i.push({min:r,max:Math.min(t-1,n),w:0,prevW:e.defaultColW}),r=Math.max(r,o+1)}e.colInfo=i.sort((e,t)=>e.min-t.min),e.dirtyCols=!0}function js(e,t,n,r){let i={},a={top:n===t.r0,bottom:n===t.r1,left:r===t.c0,right:r===t.c1};for(let t of[`top`,`bottom`,`left`,`right`])e===`all`?i[t]=!0:e===`none`?i[t]=!1:e===`outer`?a[t]&&(i[t]=!0):e===`inner`?a[t]||(i[t]=!0):e===t&&a[t]&&(i[t]=!0);return i}var Ms=class{constructor(e,t,n,r,i){A(this,`rows`,void 0),A(this,`rowCols`,void 0),A(this,`d`,void 0),A(this,`fix`,void 0),A(this,`wb`,void 0),A(this,`buf`,``),A(this,`P`,``),A(this,`next`,0),A(this,`lastRow`,-1),A(this,`phase`,`head`),A(this,`tail`,``),this.rows=e,this.rowCols=t,this.d=n,this.fix=r,this.wb=i}newRow(e){let t=[...this.rowCols.get(e)??[]].sort((e,t)=>e-t).map(t=>Es(this.d,e,t,this.P,this.wb)).join(``),n=this.rowAttrXml(e);return t||n?`<${this.P}row r="${e+1}"${n}>${t}</${this.P}row>`:``}rowAttrXml(e){let t=this.d.rowAttrs.get(e);return t?(t.ht===void 0?``:` ht="${t.ht}" customHeight="1"`)+(t.hidden?` hidden="1"`:``):``}before(e){let t=``;for(;this.next<this.rows.length&&this.rows[this.next]<e;)t+=this.newRow(this.rows[this.next++]);return t}*allRows(){let e=this.d,t=Math.max(e.rows.length-1,...e.rowAttrs.keys(),-1),n=``;for(let r=0;r<=t;r++){let t=e.rows[r],i=this.rowAttrXml(r);if(!t?.length&&!i)continue;let a=``;if(t){let n=[];for(let e=0;e<t.length;e+=4)n.push(t[e]);for(let t of n.sort((e,t)=>e-t))a+=Es(e,r,t,this.P,this.wb)}n+=`<${this.P}row r="${r+1}"${i}>${a}</${this.P}row>`,n.length>65536&&(yield n,n=``)}n&&(yield n)}colsXml(){let e=this.P,t=[...this.d.colInfo].sort((e,t)=>e.min-t.min);return t.length?`<${e}cols>${t.map(t=>`<${e}col min="${t.min+1}" max="${t.max+1}" width="${+((t.w||t.prevW||0)/7).toFixed(4)}" customWidth="1"${t.w?``:` hidden="1"`}/>`).join(``)}</${e}cols>`:``}headFix(e){let t=this.d,n=this.P,r=e;if(t.dirtyCols||t.structural){let e=RegExp(`<${n}cols\\b[\\s\\S]*?<\\/${n}cols>|<${n}cols\\s*\\/>`);r=e.test(r)?r.replace(e,this.colsXml()):r+this.colsXml()}if(t.dirtyView||t.structural){let{rows:e,cols:i}=t.frozen,a=e||i?`<${n}pane${i?` xSplit="${i}"`:``}${e?` ySplit="${e}"`:``} topLeftCell="${$o(i)}${e+1}" activePane="${e&&i?`bottomRight`:e?`bottomLeft`:`topRight`}" state="frozen"/>`:``,o=RegExp(`<${n}sheetViews>[\\s\\S]*?<\\/${n}sheetViews>`).exec(r);if(o){let e=g(o[0]),n=S(b(e),`sheetView`);n&&(n.c=n.c.filter(e=>!h(e)||v(e.q)!==`pane`&&v(e.q)!==`selection`),a&&n.c.unshift(a),T(n,`showGridLines`,t.gridLines?void 0:`0`),n.self=n.c.length===0,r=r.replace(o[0],_(e)))}else if(a||!t.gridLines){let e=`<${n}sheetViews><${n}sheetView${t.gridLines?``:` showGridLines="0"`} workbookViewId="0">${a}</${n}sheetView></${n}sheetViews>`,i=r.search(RegExp(`<${n}(sheetFormatPr|cols)\\b`));r=i>=0?r.slice(0,i)+e+r.slice(i):r+e}}return t.structural&&(r=r.replace(RegExp(`<${n}dimension\\b[^>]*\\/>`),`<${n}dimension ref="A1:${$o(Math.max(0,t.maxCol))}${Math.max(1,t.maxRow+1)}"/>`)),r}tailFix(e){let t=this.d;if(!t.dirtyMerges&&!t.structural)return e;let n=this.P,r=t.merges,i=r.length?`<${n}mergeCells count="${r.length}">${r.map(e=>`<${n}mergeCell ref="${$o(e.c0)}${e.r0+1}:${$o(e.c1)}${e.r1+1}"/>`).join(``)}</${n}mergeCells>`:``,a=RegExp(`<${n}mergeCells\\b[\\s\\S]*?<\\/${n}mergeCells>|<${n}mergeCells\\b[^>]*\\/>`);if(a.test(e))return e.replace(a,i);let o=0,s=/<(\w+:)?(sheetCalcPr|sheetProtection|protectedRanges|scenarios|autoFilter|sortState|dataConsolidate|customSheetViews)\b[\s\S]*?(\/>|<\/(\w+:)?\2>)/g;for(let t=s.exec(e);t;t=s.exec(e))o=t.index+t[0].length;return e.slice(0,o)+i+e.slice(o)}push(e,t){let n=this.buf+e;this.buf=``;let r=[];if(this.phase===`tail`)return this.tail+=n,t&&r.push(this.tailFix(this.tail)),r;let i=0;if(this.phase===`head`){let e=/<([\w.-]+:)?sheetData(\s[^>]*)?(\/?)>/.exec(n);if(!e)return t?r.push(this.headFix(n)):this.buf=n,r;this.P=e[1]??``,r.push(this.headFix(n.slice(0,e.index)));let a=e.index+e[0].length;if(e[3]===`/`){if(r.push(`<${this.P}sheetData>`),this.d.structural)r.push(...this.allRows());else{let e=``;for(;this.next<this.rows.length;)e+=this.newRow(this.rows[this.next++]);r.push(e)}return r.push(`</${this.P}sheetData>`),this.phase=`tail`,[...r,...this.push(n.slice(a),t)]}r.push(e[0]),i=a,this.phase=this.d.structural?`skip`:`data`}let a=`</${this.P}sheetData>`;if(this.phase===`skip`){let e=n.indexOf(a,i);return e<0?(this.buf=n.slice(Math.max(i,n.length-a.length)),r):(r.push(...this.allRows(),a),this.phase=`tail`,[...r,...this.push(n.slice(e+a.length),t)])}let o=`<${this.P}row`,s=``,c=n.indexOf(a,i);for(;i<n.length;){let e=n.indexOf(o,i);if(c>=0&&c<i&&(c=n.indexOf(a,i)),c>=0&&(e<0||c<e))return s+=n.slice(i,c)+this.before(1/0)+a,r.push(s),this.phase=`tail`,[...r,...this.push(n.slice(c+a.length),t)];if(e<0)break;let l=n.indexOf(`>`,e);if(l<0){s+=n.slice(i,e),i=e;break}let u=n.slice(e,l+1),d=u.charCodeAt(o.length);if(d!==32&&d!==62&&d!==47&&d!==9&&d!==10&&d!==13){s+=n.slice(i,l+1),i=l+1;continue}let f=/\sr="(\d+)"/.exec(u),p=f?Number(f[1])-1:this.lastRow+1;this.lastRow=p;let m=u.endsWith(`/>`),h;if(m)h=l+1;else{let t=n.indexOf(`</${this.P}row>`,l);if(t<0){s+=n.slice(i,e),i=e,this.lastRow=p-1;break}h=t+this.P.length+6}s+=n.slice(i,e)+this.before(p),this.next<this.rows.length&&this.rows[this.next]===p?(this.next++,s+=this.patchRow(n.slice(e,h),p)):s+=n.slice(e,h),i=h}return r.push(s),this.buf=n.slice(i),t&&r.push(this.buf),r}patchRow(e,t){let n=g(e),r=b(n);if(!r)return e;let i=y(r.q);if(T(r,`spans`,void 0),this.d.dirtyRows.has(t)){let e=this.d.rowAttrs.get(t);T(r,`ht`,e?.ht===void 0?void 0:String(e.ht)),T(r,`customHeight`,e?.ht===void 0?void 0:`1`),T(r,`hidden`,e?.hidden?`1`:void 0)}let a=[...this.rowCols.get(t)??[]].sort((e,t)=>e-t),o=new Map,s=-1;r.c.forEach((e,t)=>{if(!h(e)||v(e.q)!==`c`)return;let n=w(e,`r`),r=n?es(n)[1]:s+1;s=r,o.set(r,t)});let c=new Map,l=[];for(let e of a){let n=t*Xo+e,a=o.get(e);if(this.d.edited.has(n)){let n=Es(this.d,t,e,i,this.wb);a===void 0?n&&l.push({c:e,node:n}):c.set(a,n)}else if(a!==void 0&&this.fix.has(n)){let e=r.c[a],t=S(e,`f`);t&&(t.a=``,t.c=[te(this.fix.get(n))],t.self=!1)}}for(let[e,t]of c)r.c[e]=t;if(l.length){let e=[...o.entries()].sort((e,t)=>e[0]-t[0]);for(let t of l.reverse()){let n=e.find(([e])=>e>t.c),i=n?n[1]:r.c.length;r.c.splice(i,0,t.node);for(let t of e)t[1]>=i&&t[1]++}r.self=!1}return _(n)}},Ns=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Ps=`http://schemas.openxmlformats.org/drawingml/2006/main`,Fs=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,Is=`http://schemas.openxmlformats.org/presentationml/2006/main`,Ls=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide`,Rs=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout`,zs=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Bs=`application/vnd.openxmlformats-officedocument.presentationml.slide+xml`,Vs={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`},Hs=[`xfrm`,`custGeom`,`prstGeom`,`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`,`ln`,`effectLst`,`effectDag`,`scene3d`,`sp3d`,`extLst`],Us=new Set([`noFill`,`solidFill`,`gradFill`,`blipFill`,`pattFill`,`grpFill`]),Ws=e=>String(Math.round(e*Ke));function Gs(e){let t=S(S(b(e),`cSld`),`spTree`);if(!t)throw Error(`Slide has no shape tree`);return t}function Ks(e){let t=x(e).find(e=>/^nv.*Pr$/.test(v(e.q))),n=t?w(S(t,`cNvPr`)??t,`id`):void 0;return n===void 0?void 0:Number(n)}function qs(e){let t=1;for(let n of e)h(n)&&ie(n,e=>{v(e.q)===`cNvPr`&&(t=Math.max(t,Number(w(e,`id`)??0)))});return t}function Js(e){let t=``;for(let n of e)h(n)&&ie(n,e=>(!t&&/:(off|ext|t|p|bodyPr)$/.test(e.q)&&(t=y(e.q)),!!t));return t||`a:`}function Ys(e,t,n,r){let i=v(e.q),a;if(i===`graphicFrame`)a=e;else{let t=i===`grpSp`?`grpSpPr`:`spPr`,n=S(e,t);n||(n=E(r+t),e.c.splice(1,0,n)),a=n}let o=S(a,`xfrm`);o||(o=E((i===`graphicFrame`?r:n)+`xfrm`),i===`graphicFrame`?a.c.splice(1,0,o):O(a,o,`xfrm`,Hs));let s=(e,t)=>{let r=S(o,e);r||(r=E(n+e),o.c.splice(e===`off`?0:e===`ext`?1:o.c.length,0,r));for(let[e,n]of Object.entries(t))T(r,e,n)};s(`off`,{x:Ws(t.x),y:Ws(t.y)}),s(`ext`,{cx:Ws(Math.max(1,t.w)),cy:Ws(Math.max(1,t.h))}),T(o,`rot`,t.rot?String(Math.round((t.rot%360+360)%360*6e4)):void 0),t.flipH!==void 0&&T(o,`flipH`,t.flipH?`1`:void 0),t.flipV!==void 0&&T(o,`flipV`,t.flipV?`1`:void 0),o.self=!1,a.self=!1}function Xs(e,t){return t?E(e+`solidFill`,{},[E(e+`srgbClr`,{val:t.replace(`#`,``).toUpperCase()})]):E(e+`noFill`)}function Zs(e,t,n,r,i,a,o){let s=`<${r}off x="${Ws(n.x)}" y="${Ws(n.y)}"/><${r}ext cx="${Ws(n.w)}" cy="${Ws(n.h)}"/>`;return e===`image`?`<${i}pic><${i}nvPicPr><${i}cNvPr id="${t}" name="Picture ${t}"/><${i}cNvPicPr><${r}picLocks noChangeAspect="1"/></${i}cNvPicPr><${i}nvPr/></${i}nvPicPr><${i}blipFill><${r}blip r:embed="${o}"/><${r}stretch><${r}fillRect/></${r}stretch></${i}blipFill><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="rect"><${r}avLst/></${r}prstGeom></${i}spPr></${i}pic>`:e===`text`?`<${i}sp><${i}nvSpPr><${i}cNvPr id="${t}" name="TextBox ${t}"/><${i}cNvSpPr txBox="1"/><${i}nvPr/></${i}nvSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="rect"><${r}avLst/></${r}prstGeom><${r}noFill/></${i}spPr><${i}txBody><${r}bodyPr wrap="square" rtlCol="0"><${r}spAutoFit/></${r}bodyPr><${r}lstStyle/>${(e=>`<${r}p><${r}r><${r}rPr lang="en-US" dirty="0"/><${r}t>${te(e)}</${r}t></${r}r></${r}p>`)(a??`Text`)}</${i}txBody></${i}sp>`:e===`line`?`<${i}cxnSp><${i}nvCxnSpPr><${i}cNvPr id="${t}" name="Connector ${t}"/><${i}cNvCxnSpPr/><${i}nvPr/></${i}nvCxnSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="line"><${r}avLst/></${r}prstGeom><${r}ln w="19050"><${r}solidFill><${r}schemeClr val="tx1"/></${r}solidFill></${r}ln></${i}spPr></${i}cxnSp>`:`<${i}sp><${i}nvSpPr><${i}cNvPr id="${t}" name="Shape ${t}"/><${i}cNvSpPr/><${i}nvPr/></${i}nvSpPr><${i}spPr><${r}xfrm>${s}</${r}xfrm><${r}prstGeom prst="${e}"><${r}avLst/></${r}prstGeom></${i}spPr><${i}style><${r}lnRef idx="2"><${r}schemeClr val="accent1"><${r}shade val="50000"/></${r}schemeClr></${r}lnRef><${r}fillRef idx="1"><${r}schemeClr val="accent1"/></${r}fillRef><${r}effectRef idx="0"><${r}schemeClr val="accent1"/></${r}effectRef><${r}fontRef idx="minor"><${r}schemeClr val="lt1"/></${r}fontRef></${i}style><${i}txBody><${r}bodyPr rtlCol="0" anchor="ctr"/><${r}lstStyle/><${r}p><${r}pPr algn="ctr"/>${a?`<${r}r><${r}rPr lang="en-US" dirty="0"/><${r}t>${te(a)}</${r}t></${r}r>`:``}<${r}endParaRPr lang="en-US" dirty="0"/></${r}p></${i}txBody></${i}sp>`}function Qs(e,t,n,r){let i=S(b(e),`cSld`);if(!i||(i.c=i.c.filter(e=>!(h(e)&&v(e.q)===`bg`)),!r))return;let a=g(`<${n}bg><${n}bgPr><${t}solidFill><${t}srgbClr val="${r.replace(`#`,``).toUpperCase()}"/></${t}solidFill><${t}effectLst/></${n}bgPr></${n}bg>`)[0];i.c.unshift(a),i.self=!1}async function $s(e,t,n){let r=e.meta.slides[t];if(!r)throw Error(`No slide #${t}`);let i=await e.pkg.text(r.path),a=g(i),o=Gs(a);await n(a,o,Js(a),y(o.q));let s=_(a);return e.pkg.setPart(r.path,s),e.touched=!0,s!==i&&(e.undoStack.push({path:r.path,before:i,after:s}),e.undoStack.length>200&&e.undoStack.shift(),e.redoStack=[]),e.slide(t)}async function ec(e,t=!1){let n=(t?e.redoStack:e.undoStack).pop();if(!n)return null;(t?e.undoStack:e.redoStack).push(n),e.pkg.setPart(n.path,t?n.after:n.before);let r=e.meta.slides.findIndex(e=>e.path===n.path);return r<0?null:{index:r,model:await e.slide(r)}}async function tc(e,t,n,r){if(r=r.toLowerCase().replace(`jpeg`,`jpg`),!Vs[r])throw Error(`Unsupported image type .${r}`);let i=e.meta.slides[t],a=e.pkg.freeName(`ppt/media`,`image`,r);return e.pkg.setPart(a,n),await e.pkg.ensureDefaultType(r,Vs[r]),e.pkg.addRel(i.path,zs,a)}function nc(e,t,n){return $s(e,t,(e,t,r,i)=>{let a=e=>{let n=t.c.findIndex(t=>h(t)&&Ks(t)===e);return n>=0?{node:t.c[n],i:n}:void 0};for(let o of n){if(o.op===`insert`){let n=qs(e)+1,a=Zs(o.kind,n,o.box,r,i,o.text,o.rid);t.c.push(g(a)[0]);continue}if(o.op===`bg`){Qs(e,r,i,o.color);continue}if(o.op===`anchor`){let e;ie(t,t=>{if(e)return!0;v(t.q)===`sp`&&Number(w(S(S(t,`nvSpPr`),`cNvPr`)??t,`id`))===o.sid&&(e=S(S(t,`txBody`),`bodyPr`))}),e&&T(e,`anchor`,o.anchor);continue}let n=a(o.top);if(!n)continue;let{node:s,i:c}=n;switch(o.op){case`xfrm`:Ys(s,o.box,r,i);break;case`delete`:t.c.splice(c,1);break;case`order`:{let e=()=>t.c.map((e,t)=>h(e)&&!/^(nvGrpSpPr|grpSpPr|extLst)$/.test(v(e.q))?t:-1).filter(e=>e>=0),n=e().indexOf(c);t.c.splice(c,1);let r=e();if(o.to===`front`)t.c.splice(r.length?r[r.length-1]+1:t.c.length,0,s);else if(o.to===`back`)t.c.splice(r.length?r[0]:t.c.length,0,s);else{let e=o.to===`forward`?Math.min(r.length,n+1):Math.max(0,n-1);t.c.splice(e<r.length?r[e]:r.length?r[r.length-1]+1:t.c.length,0,s)}break}case`duplicate`:{let n=D(s),r=qs(e);ie(n,e=>{v(e.q)===`cNvPr`&&T(e,`id`,String(++r))});let i=(()=>{let e;return ie(n,t=>(!e&&v(t.q)===`off`&&(e=t),!!e)),e})();i&&(T(i,`x`,String(Number(w(i,`x`)??0)+Math.round((o.dx??16)*Ke))),T(i,`y`,String(Number(w(i,`y`)??0)+Math.round((o.dy??16)*Ke)))),t.c.splice(c+1,0,n);break}case`fill`:case`line`:{let e=v(s.q);if(e!==`sp`&&e!==`cxnSp`&&e!==`pic`)break;let t=S(s,`spPr`);if(t||(t=E(i+`spPr`),s.c.splice(1,0,t)),o.op===`fill`)ee(t,e=>Us.has(e)),O(t,Xs(r,o.color),o.color?`solidFill`:`noFill`,Hs);else{let e=D(S(t,`ln`)??E(r+`ln`));if(`color`in o?(ee(e,e=>Us.has(e)),e.c.unshift(Xs(r,o.color??null))):e.c.some(e=>h(e)&&Us.has(v(e.q)))||e.c.unshift(E(r+`solidFill`,{},[E(r+`schemeClr`,{val:`tx1`})])),o.dash!==void 0){ee(e,e=>e===`prstDash`||e===`custDash`);let t=e.c.findIndex(e=>h(e)&&!Us.has(v(e.q)));e.c.splice(t<0?e.c.length:t,0,E(r+`prstDash`,{val:o.dash}))}e.self=!1,o.w!==void 0&&T(e,`w`,String(Math.round(o.w*12700))),O(t,e,`ln`,Hs)}t.self=!1;break}}}})}async function rc(e){let t=g(await e.pkg.text(e.mainPath)),n=b(t),r=y(n.q),i=S(n,`sldIdLst`);if(!i){i=E(r+`sldIdLst`);let e=n.c.findIndex(e=>h(e)&&v(e.q)===`sldMasterIdLst`);n.c.splice(e+1,0,i)}return{nodes:t,root:n,P:r,lst:i}}async function ic(e){let t=await e.pkg.rels(e.mainPath),{lst:n}=await rc(e),r=[];for(let i of x(n,`sldId`)){let n=t.get(w(i,`r:id`)??w(i,`id`,!0)??``);n&&e.pkg.has(n.target)&&r.push({index:r.length,path:n.target,hidden:!1})}for(let t of r){let n=(await e.pkg.text(t.path)).slice(0,600);t.hidden=/<[\w:]*sld\b[^>]*\sshow="0"/.test(n)}return e.meta.slides=r,e.meta.count=r.length,e.meta}async function ac(e,t,n){let r=t?Ve(await e.pkg.rels(t),`slideLayout`)?.target:void 0,i=r?Ve(await e.pkg.rels(r),`slideMaster`)?.target:void 0;if(i||(i=Ve(await e.pkg.rels(e.mainPath),`slideMaster`)?.target),!i)return r;let a=He(await e.pkg.rels(i),`slideLayout`).map(e=>e.target),o=await Promise.all(a.map(async t=>/<[\w:]*sldLayout\b[^>]*\stype="([^"]+)"/.exec((await e.pkg.text(t)).slice(0,800))?.[1])),s=n===`title`?[`title`]:n===`blank`?[`blank`]:[`obj`,`txAndObj`,`tx`],c=o.findIndex(e=>e&&s.includes(e));return c>=0?a[c]:r??a[0]}async function oc(e,t){let n=``;if(t){let r=S(S(b(g(await e.pkg.text(t))),`cSld`),`spTree`),i=2;for(let e of x(r,`sp`)){let t=S(S(S(e,`nvSpPr`),`nvPr`),`ph`);if(!t)continue;let r=w(t,`type`);if(r&&[`dt`,`ftr`,`sldNum`].includes(r))continue;let a=w(S(S(e,`nvSpPr`),`cNvPr`)??e,`name`)??`Placeholder ${i}`,o=`<p:ph${r?` type="${r}"`:``}${w(t,`idx`)?` idx="${w(t,`idx`)}"`:``}/>`;n+=`<p:sp><p:nvSpPr><p:cNvPr id="${i++}" name="${te(a)}"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr>${o}</p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US" dirty="0"/></a:p></p:txBody></p:sp>`}}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<p:sld xmlns:a="${Ps}" xmlns:r="${Fs}" xmlns:p="${Is}"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>${n}</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`}async function sc(e,t,n,r){let i=e.pkg.freeName(`ppt/slides`,`slide`,`xml`);e.pkg.setPart(i,n),e.pkg.setPart(ze(i),r),await e.pkg.setContentType(i,Bs);let a=await e.pkg.addRel(e.mainPath,Ls,i),{nodes:o,root:s,P:c,lst:l}=await rc(e),u=x(l,`sldId`).map(e=>Number(w(e,`id`)??0)),d=Math.max(255,...u)+1,f=E(c+`sldId`,{id:String(d),...oe(s,`id`,a)}),p=x(l,`sldId`),m=t<0?0:l.c.indexOf(p[Math.min(t,p.length-1)])+1;l.c.splice(m,0,f),l.self=!1,e.pkg.setPart(e.mainPath,_(o))}async function cc(e,t){let n=e.meta.slides;switch(e.touched=!0,t.op){case`add`:{let r=n[Math.max(0,Math.min(t.after,n.length-1))]?.path,i=await ac(e,r,t.layout??`content`),a=await oc(e,i),o=i?`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${Rs}" Target="../slideLayouts/${i.split(`/`).pop()}"/></Relationships>`:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
22
22
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;await sc(e,t.after,a,o);break}case`duplicate`:{let r=n[t.index];if(!r)break;let i=await e.pkg.text(r.path),a=ze(r.path),o=e.pkg.has(a)?await e.pkg.text(a):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
23
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`,s=g(o),c=b(s);c.c=c.c.filter(e=>!(h(e)&&/notesSlide$/.test(w(e,`Type`)??``))),o=_(s),await sc(e,t.index,i,o);break}case`delete`:{let r=n[t.index];if(!r||n.length<=1)break;let{nodes:i,lst:a}=await rc(e),o=await e.pkg.rels(e.mainPath),s=x(a,`sldId`).find(e=>o.get(w(e,`r:id`)??``)?.target===r.path);s&&a.c.splice(a.c.indexOf(s),1),e.pkg.setPart(e.mainPath,_(i));let c=Ve(await e.pkg.rels(r.path),`notesSlide`)?.target;await e.pkg.removeRelsTo(e.mainPath,r.path);for(let t of[r.path,c].filter(Boolean))e.pkg.setPart(t,null),e.pkg.has(ze(t))&&e.pkg.setPart(ze(t),null),await e.pkg.setContentType(t,null);break}case`move`:{let{nodes:n,lst:r}=await rc(e),i=x(r,`sldId`),a=i[t.from];if(!a||t.to<0||t.to>=i.length)break;r.c.splice(r.c.indexOf(a),1);let o=x(r,`sldId`),s=t.to>=o.length?r.c.length:r.c.indexOf(o[t.to]);r.c.splice(s,0,a),e.pkg.setPart(e.mainPath,_(n));break}case`hide`:{let r=n[t.index];if(!r)break;let i=g(await e.pkg.text(r.path));T(b(i),`show`,t.hidden?`0`:void 0),e.pkg.setPart(r.path,_(i));break}}return ic(e)}var lc=new Set([`insertRows`,`deleteRows`,`insertCols`,`deleteCols`]),uc=e=>e.t===`book`||e.t===`sheet`&&lc.has(e.op.op);function dc(e,t,n){if(n>=0)return e>=t?e+n:e;let r=-n;return e<t?e:e<t+r?null:e-r}function fc(e,t,n,r){if(r>=0)return[e>=n?e+r:e,t>=n?t+r:t];let i=-r;if(t<n)return[e,t];if(e>=n+i)return[e-i,t-i];let a=e<n?e:n,o=t<n+i?n-1:t-i;return o<a?null:[a,o]}function pc(e,t,n,r){let i=t===`row`?fc(e.r0,e.r1,n,r):fc(e.c0,e.c1,n,r);return i?t===`row`?{...e,r0:i[0],r1:i[1]}:{...e,c0:i[0],c1:i[1]}:null}function mc(e,t,n,r){let i=(e,i,a)=>a===t?fc(e,i,n,r):[e,i];switch(e.op){case`insertRows`:case`insertCols`:{if(e.op===`insertRows`!=(t===`row`))return e;let i=r>=0?e.at>=n?e.at+r:e.at:e.at<n?e.at:e.at<n-r?n:e.at+r;return i===e.at?e:{...e,at:i}}case`deleteRows`:case`deleteCols`:{if(e.op===`deleteRows`!=(t===`row`))return e;let i=fc(e.at,e.at+e.n-1,n,r);return i?{...e,at:i[0],n:i[1]-i[0]+1}:null}case`merge`:case`unmerge`:case`fill`:{let i=pc(e.range,t,n,r);return i?{...e,range:i}:null}case`sort`:{let i=pc(e.range,t,n,r);if(!i)return null;let a=t===`col`?dc(e.col,n,r):e.col;return a===null?null:{...e,range:i,col:a}}case`hideRows`:case`hideCols`:{let t=i(e.a,e.b,e.op===`hideRows`?`row`:`col`);return t?{...e,a:t[0],b:t[1]}:null}case`colWidth`:{let t=i(e.c0,e.c1,`col`);return t?{...e,c0:t[0],c1:t[1]}:null}case`rowHeight`:{let t=i(e.r0,e.r1,`row`);return t?{...e,r0:t[0],r1:t[1]}:null}default:return e}}function hc(e,t){if(t.t===`book`)return t.op.op===`delete`&&`sheet`in e&&e.sheet===t.op.path?null:e;if(t.t!==`sheet`||!lc.has(t.op.op)||!(`sheet`in e)||e.sheet!==t.sheet)return e;let n=t.op,r=n.op.endsWith(`Rows`)?`row`:`col`,i=n.op.startsWith(`insert`)?n.n:-n.n;switch(e.t){case`set`:{let t=[];for(let a of e.cells){let e=dc(r===`row`?a.r:a.c,n.at,i);e!==null&&t.push(r===`row`?{...a,r:e}:{...a,c:e})}return t.length?{...e,cells:t}:null}case`fmt`:{let t=pc(e.range,r,n.at,i);return t?{...e,range:t}:null}case`sheet`:{let t=mc(e.op,r,n.at,i);return t===e.op?e:t?{...e,op:t}:null}case`replace`:{if(!e.at)return e;let t=dc(r===`row`?e.at.r:e.at.c,n.at,i);return t===null?null:{...e,at:r===`row`?{...e.at,r:t}:{...e.at,c:t}}}}return e}var gc={r0:0,c0:0,r1:2**53-1,c1:2**53-1};function _c(e){switch(e.t){case`set`:{let t=1/0,n=1/0,r=-1,i=-1;for(let a of e.cells)t=Math.min(t,a.r),n=Math.min(n,a.c),r=Math.max(r,a.r),i=Math.max(i,a.c);return{sheet:e.sheet,range:{r0:t,c0:n,r1:r,c1:i}}}case`fmt`:return{sheet:e.sheet,range:e.range};case`replace`:return{sheet:e.sheet,range:e.at?{r0:e.at.r,c0:e.at.c,r1:e.at.r,c1:e.at.c}:gc};case`sheet`:{let t=e.op;return`range`in t?{sheet:e.sheet,range:t.range}:t.op===`hideRows`?{sheet:e.sheet,range:{...gc,r0:t.a,r1:t.b}}:t.op===`hideCols`?{sheet:e.sheet,range:{...gc,c0:t.a,c1:t.b}}:t.op===`colWidth`?{sheet:e.sheet,range:{...gc,c0:t.c0,c1:t.c1}}:t.op===`rowHeight`?{sheet:e.sheet,range:{...gc,r0:t.r0,r1:t.r1}}:{sheet:e.sheet,range:gc}}default:return null}}var vc=(e,t)=>e.r0<=t.r1&&t.r0<=e.r1&&e.c0<=t.c1&&t.c0<=e.c1;function yc(e,t){if(t.some(e=>uc(e)||e.t===`revert`)||e.some(e=>e.t===`revert`||uc(e)))return!0;let n=e=>e.t===`fmt`&&e.patch.xf===void 0&&!e.patch.clear;if(e.some(n)&&t.some(n))return!0;let r=t.map(_c);return e.some(e=>{let t=_c(e);return!!t&&r.some(e=>!!e&&e.sheet===t.sheet&&vc(t.range,e.range))})}var bc=400,xc=class{constructor(e,t,n){A(this,`ed`,void 0),A(this,`wb`,void 0),A(this,`emit`,void 0),A(this,`recs`,new Map),A(this,`byOp`,new Map),A(this,`seq`,0),this.ed=e,this.wb=t,this.emit=n}index(e){let t=this.wb.sheets.findIndex(t=>t.path===e);if(t<0)throw new Sc;return t}async sheet(e){let t=this.index(e);return await this.wb.loadSheet(t,this.emit),t}dropSheet(e){for(let[t,n]of this.recs)(e===null||n.ch?.sheet===e)&&(this.recs.delete(t),this.byOp.delete(n.op))}async apply(e){let t=await this.ed.styleMark(),n;try{n=await this.run(e)}catch(e){if(e instanceof Sc)return{res:null,rec:null};throw e}let r=this.ed.takeRecord(),i=await this.ed.styleMark(),a=Object.keys(i).some(e=>i[e]!==t[e]);if(e.t===`book`||e.t===`sheet`&&lc.has(e.op.op))return this.dropSheet(null),{res:n,rec:null};let o=++this.seq;if(this.recs.set(o,{ch:r,styles:a?t:void 0,op:e.id}),this.byOp.set(e.id,o),this.recs.size>bc){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:n,rec:o}}async run(e){let t=this.ed;switch(e.t){case`set`:return t.setCells(await this.sheet(e.sheet),e.cells);case`fmt`:return t.format(await this.sheet(e.sheet),e.range,e.patch);case`sheet`:return t.sheetOp(await this.sheet(e.sheet),e.op);case`replace`:return t.replace(await this.sheet(e.sheet),e.query,e.by,e.opts,e.at);case`book`:{let n=e.op,r;r=n.op===`add`?{op:`add`,name:n.name,after:n.after?this.index(n.after):void 0}:n.op===`rename`?{op:`rename`,index:this.index(n.path),name:n.name}:n.op===`delete`?{op:`delete`,index:this.index(n.path)}:{op:`move`,from:this.index(n.path),to:Math.max(0,Math.min(n.to,this.wb.sheets.length-1))};try{return await t.bookOp(r)}catch{throw new Sc}}case`revert`:{let n=this.byOp.get(e.target),r=n===void 0?void 0:this.recs.get(n);if(!r?.ch)throw new Sc;return t.restoreRecord(r.ch,e.which)}}}async revert(e){let t=this.recs.get(e);if(!t)return null;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op);let n=t.ch?this.ed.revertRecord(t.ch):null;return t.styles&&await this.ed.styleTruncate(t.styles),n}},Sc=class extends Error{},Cc=300,wc=class{constructor(e){A(this,`pres`,void 0),A(this,`recs`,new Map),A(this,`byOp`,new Map),A(this,`seq`,0),A(this,`images`,new Map),A(this,`ready`,void 0),this.pres=e}async originals(){for(let e of this.pres.meta.slides)await this.pres.keepOriginal(e.path)}index(e){return this.pres.meta.slides.findIndex(t=>t.path===e)}get genMaps(){return this.pres.genMaps}async snap(e){return{xml:await this.pres.pkg.text(e),gen:[...this.genMaps].filter(([t])=>t.startsWith(e+`#`))}}restore(e,t){this.pres.pkg.setPart(e,t.xml);for(let t of[...this.genMaps.keys()])t.startsWith(e+`#`)&&this.genMaps.delete(t);for(let[e,n]of t.gen)this.genMaps.set(e,n);this.pres.touched=!0}async model(e){let t=this.index(e);return t<0?{}:{slide:t,model:await this.pres.slide(t)}}async apply(e){let t=this.pres;if(await(this.ready??(this.ready=this.originals())),e.t===`image`){let n=this.index(e.slide);if(n<0)return{res:{},rec:null};let r=this.images.get(e.key);return r||(r=await tc(t,n,e.bytes,e.ext),this.images.set(e.key,r)),{res:{rid:r},rec:null}}if(e.t===`slides`){let n=e.op,r=e=>this.index(e),i=null;if(n.op===`add`?i={op:`add`,after:n.after?r(n.after):-1,layout:n.layout}:r(n.path)>=0&&(i=n.op===`duplicate`?{op:`duplicate`,index:r(n.path)}:n.op===`delete`?t.meta.slides.length>1?{op:`delete`,index:r(n.path)}:null:n.op===`move`?{op:`move`,from:r(n.path),to:Math.max(0,Math.min(n.to,t.meta.slides.length-1))}:{op:`hide`,index:r(n.path),hidden:n.hidden}),!i)return{res:{},rec:null};let a=await cc(t,i);return await this.originals(),this.recs.clear(),this.byOp.clear(),{res:{meta:{...a,slides:a.slides.map(e=>({...e}))}},rec:null}}let n,r;if(e.t===`revert`){let t=this.byOp.get(e.target);if(r=t===void 0?void 0:this.recs.get(t),!r)return{res:{},rec:null};n=r.path}else n=e.slide;let i=this.index(n);if(i<0)return{res:{},rec:null};let a=await this.snap(n);if(e.t===`text`)try{await t.setText(i,e.sid,e.paras)}catch{return{res:{},rec:null}}else e.t===`shapes`?await nc(t,i,e.ops.map(e=>{if(e.op!==`insert`||!e.key)return e;let{key:t,...n}=e;return{...n,rid:this.images.get(t)}})):r&&this.restore(n,e.which===`prev`?r.before:r.after);t.undoStack=[],t.redoStack=[];let o=++this.seq;if(this.recs.set(o,{path:n,before:a,after:await this.snap(n),op:e.id}),this.byOp.set(e.id,o),this.recs.size>Cc){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:await this.model(n),rec:o}}async revert(e){let t=this.recs.get(e);return t?(this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op),this.restore(t.path,t.before),this.model(t.path)):{}}},Tc=new Set([`docx.edit`,`docx.table`,`docx.image`,`docx.link`,`docx.style`,`save`,`xlsx.set`,`xlsx.format`,`xlsx.sheetOp`,`xlsx.bookOp`,`xlsx.replace`,`xlsx.undo`,`xlsx.redo`,`collab.xlsx.apply`,`collab.xlsx.revert`,`pptx.setText`,`pptx.shapes`,`pptx.slides`,`pptx.image`,`pptx.undo`,`collab.pptx.apply`,`collab.pptx.revert`]),Ec=class{constructor(e){A(this,`emit`,void 0),A(this,`pkg`,void 0),A(this,`kind`,void 0),A(this,`docx`,void 0),A(this,`xlsx`,void 0),A(this,`xlsxEd`,void 0),A(this,`pptx`,void 0),A(this,`abort`,new AbortController),A(this,`writes`,Promise.resolve()),A(this,`xcollab`,void 0),A(this,`pcollab`,void 0),this.emit=e}async open(e,t={}){let n=await hr(e,{...t,signal:this.abort.signal,onProgress:(e,t)=>this.emit(`progress`,{phase:`download`,loaded:e,total:t})}),r=await fe.open(n),i=this.pkg=new Be(r),a=await i.mainPart();this.kind=a.kind;let o={kind:a.kind,name:t.name??n.name,size:n.size};return a.kind===`docx`?this.docx=await Mt.open(i,a.path):a.kind===`xlsx`?o.xlsx=(this.xlsx=await as.open(i,a.path)).meta():o.pptx=(this.pptx=await rr.open(i,a.path)).meta,o}call(e,t){if(!Tc.has(e))return this.dispatch(e,t);let n=this.writes.then(()=>this.dispatch(e,t));return this.writes=n.catch(()=>{}),n}async dispatch(e,t){switch(e){case`open`:return this.open(t[0],t[1]);case`part`:return this.need(this.pkg).blob(t[0]);case`docx.start`:{let e=this.need(this.docx);try{await e.stream({signal:this.abort.signal,onBlocks:e=>this.emit(`docx:blocks`,e),onMeta:e=>this.emit(`docx:meta`,e),onProgress:(e,t)=>this.emit(`progress`,{phase:`parse`,loaded:e,total:t})}),this.emit(`docx:done`,{})}catch(e){this.emit(`docx:done`,{error:e.message})}return}case`docx.edit`:return un(this.need(this.docx),t[0]);case`docx.table`:return Sn(this.need(this.docx),t[0]);case`docx.image`:return gn(this.need(this.docx),new Uint8Array(t[0]),t[1]);case`docx.link`:return _n(this.need(this.docx),t[0]);case`docx.style`:return tn(this.need(this.docx),t[0]);case`save`:return this.save();case`dirty`:return this.docx?this.docx.dirty:this.xlsxEd?this.xlsxEd.dirty:this.pptx?this.pptx.dirty:this.need(this.pkg).dirty;case`xlsx.load`:this.need(this.xlsx).loadSheet(t[0],e=>this.emit(`xlsx:progress`,e),(e,t,n)=>this.emit(`progress`,{phase:e,loaded:t,total:n}));return;case`xlsx.set`:return this.xed().setCells(t[0],t[1]);case`xlsx.format`:return this.xed().format(t[0],t[1],t[2]);case`xlsx.sheetOp`:return this.xed().sheetOp(t[0],t[1]);case`xlsx.replace`:return this.xed().replace(t[0],t[1],t[2],t[3],t[4]);case`xlsx.bookOp`:return this.xed().bookOp(t[0]);case`xlsx.undo`:return this.xed().undo();case`xlsx.redo`:return this.xed().redo();case`collab.xlsx.apply`:return this.xc().apply(t[0]);case`collab.xlsx.revert`:return this.xc().revert(t[0]);case`collab.pptx.apply`:return(this.pcollab??(this.pcollab=new wc(this.need(this.pptx)))).apply(t[0]);case`collab.pptx.revert`:return(this.pcollab??(this.pcollab=new wc(this.need(this.pptx)))).revert(t[0]);case`xlsx.block`:return this.need(this.xlsx).block(t[0],t[1],t[2]);case`xlsx.cell`:return this.need(this.xlsx).cell(t[0],t[1],t[2]);case`xlsx.find`:return this.need(this.xlsx).find(t[0],t[1],t[2]);case`pptx.setText`:return this.need(this.pptx).setText(t[0],t[1],t[2]);case`pptx.shapes`:return nc(this.need(this.pptx),t[0],t[1]);case`pptx.slides`:return cc(this.need(this.pptx),t[0]);case`pptx.image`:return tc(this.need(this.pptx),t[0],new Uint8Array(t[1]),t[2]);case`pptx.slide`:return this.need(this.pptx).slide(t[0]);case`pptx.undo`:return ec(this.need(this.pptx),!!t[0])}throw Error(`Unknown method ${String(e)}`)}xc(){return this.xcollab??(this.xcollab=new xc(this.xed(),this.need(this.xlsx),e=>this.emit(`xlsx:progress`,e)))}xed(){return this.xlsxEd??(this.xlsxEd=new Ts(this.need(this.xlsx)))}async save(){if(this.docx)return Cn(this.docx);if(this.xlsx)return this.xed().save();if(this.pptx)return this.pptx.save();throw Error(`Saving is not supported for this document yet`)}dispose(){this.abort.abort()}need(e){if(!e)throw Error(this.kind?`Operation not available for ${this.kind}`:`Document not opened`);return e}},Dc;function Oc(e){Dc=e}var kc=class e{constructor(e){A(this,`kind`,void 0),A(this,`name`,void 0),A(this,`size`,0),A(this,`info`,void 0),A(this,`worker`,void 0),A(this,`engine`,void 0),A(this,`seq`,0),A(this,`pending`,new Map),A(this,`listeners`,new Map),A(this,`urls`,new Map),A(this,`destroyed`,!1),A(this,`interceptor`,void 0);let t=e.worker===!1?void 0:e.worker??Dc;t?(this.worker=t(),this.worker.onmessage=e=>this.onMessage(e.data),this.worker.onerror=e=>{let t=Error(e.message||`Worker failed to start`);for(let e of this.pending.values())e.reject(t);this.pending.clear()}):this.engine=new Ec((e,t)=>this.onMessage({event:e,data:t}))}static async open(t,n={}){let r=new e(n),{worker:i,onProgress:a,...o}=n;a&&r.on(`progress`,a);let s;s=typeof t==`string`||t instanceof URL?new URL(String(t),globalThis.location?.href).href:t instanceof Uint8Array?t.slice().buffer:t;try{r.info=await r.call(`open`,s,o)}catch(e){throw r.destroy(),e}return r.kind=r.info.kind,r.name=r.info.name,r.size=r.info.size,r}onMessage(e){if(`event`in e){let t=this.listeners.get(e.event);if(t)for(let n of t)n(e.data);return}let t=this.pending.get(e.id);t&&(this.pending.delete(e.id),e.ok?t.resolve(e.result):t.reject(Error(e.error)))}call(e,...t){if(this.interceptor&&!this.destroyed){let n=this.interceptor(e,t);if(n)return n}return this.direct(e,...t)}direct(e,...t){if(this.destroyed)return Promise.reject(Error(`Document closed`));if(this.engine)return this.engine.call(e,t);let n=++this.seq;return new Promise((r,i)=>{this.pending.set(n,{resolve:r,reject:i});let a=t[0]instanceof ArrayBuffer?[t[0]]:[];this.worker.postMessage({id:n,method:e,args:t},a)})}notify(e,t){this.onMessage({event:e,data:t})}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>n.delete(t)}mediaUrl(e){let t=this.urls.get(e);return t||(t=this.call(`part`,e).then(e=>URL.createObjectURL(e)),this.urls.set(e,t)),t}static canRender(e){return Fe(e)}destroy(){if(!this.destroyed){this.destroyed=!0,this.worker?.terminate(),this.engine?.dispose();for(let e of this.pending.values())e.reject(Error(`Document closed`));this.pending.clear();for(let e of this.urls.values())e.then(e=>URL.revokeObjectURL(e)).catch(()=>{});this.urls.clear(),this.listeners.clear()}}};Oc(()=>new m({name:`office-engine`}));var Ac=new WeakMap,jc=new WeakMap;function Mc(e,t,n){let r=Ac.get(e);r||Ac.set(e,r=new Map),r.set(t,n);for(let r of jc.get(e)?.get(t)??[])r(n);return()=>{r.get(t)===n&&r.delete(t)}}function Nc(e,t){return Ac.get(e)?.get(t)}function Pc(e,t,n){let r=jc.get(e);r||jc.set(e,r=new Map);let i=r.get(t);i||r.set(t,i=new Set),i.add(n);let a=Nc(e,t);return a&&n(a),()=>i.delete(n)}var Fc=new WeakMap;function Ic(e){let t=Fc.get(e);return t||Fc.set(e,t={peers:Rc,peerFns:new Set,localFns:new Set}),t}function Lc(e,t){let n=Ic(e);n.peers=t;for(let e of n.peerFns)e()}var Rc=[];function zc(e){return Fc.get(e)?.peers??Rc}function Bc(e,t){let n=Ic(e);return n.peerFns.add(t),()=>n.peerFns.delete(t)}function Vc(e,t){for(let n of Fc.get(e)?.localFns??[])n(t)}function Hc(e,t){let n=Ic(e);return n.localFns.add(t),()=>n.localFns.delete(t)}var Uc=typeof window>`u`?u.useEffect:u.useLayoutEffect;function Wc(){let[e,t]=(0,u.useReducer)(e=>e+1,0);return[e,t]}function Gc(){let e=(0,u.useRef)(null),[t,n]=(0,u.useState)({w:0,h:0});return Uc(()=>{let t=e.current;if(!t)return;let r=()=>{let e=t.clientWidth,r=t.clientHeight;n(t=>t.w===e&&t.h===r?t:{w:e,h:r})};r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[]),[e,t]}function Kc(e){let[t,n]=(0,u.useState)({x:0,y:0});return(0,u.useEffect)(()=>{let t=e.current;if(!t)return;let r=0,i=()=>{r||(r=requestAnimationFrame(()=>{r=0,n({x:t.scrollLeft,y:t.scrollTop})}))};return t.addEventListener(`scroll`,i,{passive:!0}),()=>{t.removeEventListener(`scroll`,i),cancelAnimationFrame(r)}},[e]),t}function qc(e,t,n=!0){let[r,i]=(0,u.useState)(null);return(0,u.useEffect)(()=>{if(!t||!n)return;if(!Fe(t)){i(`unsupported`);return}let r=!0;return e.mediaUrl(t).then(e=>r&&i(e),()=>r&&i(`unsupported`)),()=>{r=!1}},[e,t,n]),r}function Jc(e,t){let n=0,r=e.length-1,i=0;for(;n<=r;){let a=n+r>>1;e[a]<=t?(i=a,n=a+1):r=a-1}return i}var Yc=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),X=t(((e,t)=>{t.exports=Yc()}))(),Xc=(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM12 4v16M4 12h16`,strokeDasharray:`1.2 2.6`,opacity:.5,strokeWidth:1.4}),Zc={undo:(0,X.jsx)(`path`,{d:`M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11`}),redo:(0,X.jsx)(`path`,{d:`m15 14 5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13`}),bold:(0,X.jsx)(`path`,{d:`M7 5h6a3.5 3.5 0 0 1 0 7H7zM7 12h7a3.5 3.5 0 0 1 0 7H7z`,strokeWidth:2.4}),italic:(0,X.jsx)(`path`,{d:`M14 5h-4m4 14h-4m3-14-2 14`,strokeWidth:2.2}),underline:(0,X.jsx)(`path`,{d:`M7 4v7a5 5 0 0 0 10 0V4M5 20h14`}),strike:(0,X.jsx)(`path`,{d:`M16 6.5C15.3 5 13.8 4 12 4c-2.5 0-4 1.3-4 3 0 4 8 2.5 8 7 0 2-1.8 3.5-4.2 3.5-2 0-3.6-1-4.3-2.5M4 12h16`}),color:(0,X.jsx)(`path`,{d:`m6 16 6-12 6 12M8.3 11.5h7.4`}),highlight:(0,X.jsx)(`path`,{d:`m9 11-5 5v3h3l5-5M14.5 5.5l4 4L12 16l-4-4zM15 4l5 5`}),fill:(0,X.jsx)(`path`,{d:`m19 11-8-8-8.5 8.5a2 2 0 0 0 0 2.8l5.7 5.7a2 2 0 0 0 2.8 0zM5 2l5 5M21 15s2 2.5 2 4a2 2 0 0 1-4 0c0-1.5 2-4 2-4`}),alignLeft:(0,X.jsx)(`path`,{d:`M4 6h16M4 10h10M4 14h16M4 18h10`}),alignCenter:(0,X.jsx)(`path`,{d:`M4 6h16M7 10h10M4 14h16M7 18h10`}),alignRight:(0,X.jsx)(`path`,{d:`M4 6h16M10 10h10M4 14h16M10 18h10`}),justify:(0,X.jsx)(`path`,{d:`M4 6h16M4 10h16M4 14h16M4 18h16`}),bullets:(0,X.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01`,strokeWidth:2.2}),numbers:(0,X.jsx)(`path`,{d:`M10 6h10M10 12h10M10 18h10M4 4.5h1.5v4M4 8.5h3M4 14.5c0-1 2.5-1.2 2.5.3 0 1.2-2.5 1.8-2.5 3.2h2.8`}),indent:(0,X.jsx)(`path`,{d:`M4 5h16M11 10h9M11 14h9M4 19h16M4 9l3 3-3 3`}),outdent:(0,X.jsx)(`path`,{d:`M4 5h16M11 10h9M11 14h9M4 19h16M7 9l-3 3 3 3`}),clear:(0,X.jsx)(`path`,{d:`M5 5h10M10 5l-3 14M14 14l5 5m0-5-5 5`}),search:(0,X.jsx)(`path`,{d:`m20 20-4.2-4.2M17 11a6 6 0 1 1-12 0 6 6 0 0 1 12 0`}),save:(0,X.jsx)(`path`,{d:`M12 4v11m-4.5-4.5L12 15l4.5-4.5M5 19h14`}),wrap:(0,X.jsx)(`path`,{d:`M4 6h16M4 12h13a3 3 0 0 1 0 6h-4m2-2-2 2 2 2M4 18h5`}),edit:(0,X.jsx)(`path`,{d:`m4 20 1-4L16 5l3 3L8 19zM14 7l3 3`}),view:(0,X.jsx)(`path`,{d:`M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12m10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6`}),close:(0,X.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`}),image:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM4 16l5-5 4 4 3-3 4 4M15.5 9.5h.01`}),table:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM4 10h16M4 15h16M10 5v14M15 5v14`}),link:(0,X.jsx)(`path`,{d:`M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1`}),pagebreak:(0,X.jsx)(`path`,{d:`M5 4v5h14V4M5 20v-5h14v5M3 12h2m3 0h2m3 0h2m3 0h3`}),sup:(0,X.jsx)(`path`,{d:`m4 8 8 10m0-10L4 18M16 4h4l-4 5h4`}),sub:(0,X.jsx)(`path`,{d:`m4 6 8 10m0-10L4 16M16 15h4l-4 5h4`}),lineSpacing:(0,X.jsx)(`path`,{d:`M10 6h10M10 12h10M10 18h10M5 4v16M3 6l2-2 2 2M3 18l2 2 2-2`}),plus:(0,X.jsx)(`path`,{d:`M12 5v14M5 12h14`}),minus:(0,X.jsx)(`path`,{d:`M5 12h14`}),fit:(0,X.jsx)(`path`,{d:`M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5`}),shape:(0,X.jsx)(`path`,{d:`M4 4h9v9H4zM17 11a4 4 0 1 1 0 8 4 4 0 0 1 0-8`}),textbox:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM8 9h8M12 9v7`}),slideAdd:(0,X.jsx)(`path`,{d:`M3 6h14v12H3zM20 8v6M17 11h6`}),copy:(0,X.jsx)(`path`,{d:`M8 8h12v12H8zM4 16V4h12`}),trash:(0,X.jsx)(`path`,{d:`M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13`}),play:(0,X.jsx)(`path`,{d:`M7 4l13 8-13 8z`}),front:(0,X.jsx)(`path`,{d:`M8 8h12v12H8zM4 4h10v3M4 4v10h3`}),back:(0,X.jsx)(`path`,{d:`M4 4h12v12H4zM20 8v12H8v-3`}),merge:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM9 12H4m16 0h-5m-6-3 3 3-3 3m6-6-3 3 3 3`}),borders:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM12 4v16M4 12h16`,strokeDasharray:`2 2`}),freeze:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM4 9h16M9 4v16`}),sum:(0,X.jsx)(`path`,{d:`M17 5H7l6 7-6 7h10`}),rowAdd:(0,X.jsx)(`path`,{d:`M4 4h16v6H4zM12 14v6M9 17h6`}),colAdd:(0,X.jsx)(`path`,{d:`M4 4h6v16H4zM14 12h6M17 9v6`}),sort:(0,X.jsx)(`path`,{d:`M7 4v16M4 17l3 3 3-3M14 6h6M14 12h4M14 18h2`}),up:(0,X.jsx)(`path`,{d:`m6 15 6-6 6 6`}),down:(0,X.jsx)(`path`,{d:`m6 9 6 6 6-6`}),chevron:(0,X.jsx)(`path`,{d:`m7 10 5 5 5-5`}),lineWeight:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{d:`M4 6h16`,strokeWidth:1}),(0,X.jsx)(`path`,{d:`M4 11h16`,strokeWidth:2.2}),(0,X.jsx)(`path`,{d:`M4 17.5h16`,strokeWidth:3.6})]}),rotate:(0,X.jsx)(`path`,{d:`M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7`}),rotateCcw:(0,X.jsx)(`path`,{d:`M4 11a8 8 0 1 1 2.3 5.7M4 4v7h7`}),flipH:(0,X.jsx)(`path`,{d:`M12 3v18M9 7 4 17h5zM15 7l5 10h-5z`}),flipV:(0,X.jsx)(`path`,{d:`M3 12h18M7 9 17 4v5zM7 15l10 5v-5z`}),alignObj:(0,X.jsx)(`path`,{d:`M4 3v18M8 7h12v4H8zM8 14h7v4H8z`}),currency:(0,X.jsx)(`path`,{d:`M12 3v18M16.5 7.5C16 5.9 14.3 5 12 5c-2.6 0-4.5 1.3-4.5 3.3 0 4.7 9 2.6 9 7.4 0 2-1.9 3.3-4.5 3.3-2.4 0-4.2-1-4.7-2.8`}),vTop:(0,X.jsx)(`path`,{d:`M5 4h14M12 20V8M8.5 11.5 12 8l3.5 3.5`}),vMiddle:(0,X.jsx)(`path`,{d:`M5 12h14M12 3v6M9.5 6.5 12 9l2.5-2.5M12 21v-6M9.5 17.5 12 15l2.5 2.5`}),vBottom:(0,X.jsx)(`path`,{d:`M5 20h14M12 4v12M8.5 12.5 12 16l3.5-3.5`}),rotNone:(0,X.jsx)(`path`,{d:`M5 17h14M7 14l3-8 3 8M8 11.5h4`}),rotUp:(0,X.jsx)(`path`,{d:`M5 19h14M6 15l9.5-9.5M9 6.5l4.5 7.5M8 10l4-.5`}),rotDown:(0,X.jsx)(`path`,{d:`M5 5h14M6 9l9.5 9.5M9 17.5l4.5-7.5M8 14l4 .5`}),rotStack:(0,X.jsx)(`path`,{d:`M9 4l2 5 2-5M9.6 6.5h2.8M9 11h4M11 11v4M9 15h4M9 17h3a1.5 1.5 0 0 1 0 3H9z`,strokeWidth:1.5}),rotUp90:(0,X.jsx)(`path`,{d:`M19 5v14M15 18l-8-3 8-3M12.5 13v4M7 7l2-2 2 2M9 5v6`}),rotDown90:(0,X.jsx)(`path`,{d:`M19 5v14M7 6l8 3-8 3M9.5 11V7M13 17l-2 2-2-2M11 19v-6`}),sortAZ:(0,X.jsx)(`path`,{d:`M7 4v16M4 17l3 3 3-3M13 11l2.5-7 2.5 7M13.7 9h3.6M13 14h5l-5 6h5`}),sortZA:(0,X.jsx)(`path`,{d:`M7 4v16M4 17l3 3 3-3M13 4h5l-5 6h5M13 20l2.5-7 2.5 7M13.7 18h3.6`}),gridlines:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM4 9.3h16M4 14.6h16M9.3 4v16M14.6 4v16`}),lineStyle:(0,X.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h3M10 18h4M17 18h3`,strokeWidth:2}),paint:(0,X.jsx)(`path`,{d:`M5 4h11v5H5zM16 6.5h3v5l-7 1.5v3M11 16h2v5h-2z`}),omega:(0,X.jsx)(`path`,{d:`M5 19h4v-2.5A6.5 6.5 0 1 1 15 16.5V19h4`}),outline:(0,X.jsx)(`path`,{d:`M4 6h.01M4 12h.01M4 18h.01M8 6h12M11 12h9M11 18h9`,strokeWidth:2}),imgOrig:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM8 15V9l-1.5 1.5M12 10h.01M12 14h.01M16.5 15V9L15 10.5`}),imgReplace:(0,X.jsx)(`path`,{d:`M4 5h10v8H4zM4 11l3-3 3 3 2-2 2 2M14 19h6v-6M20 19l-5-5M7 16v3h4`}),alt:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM7.5 15l2.5-6 2.5 6M8.3 13h3.4M15 9v6h2.5`}),cut:(0,X.jsx)(`path`,{d:`M6 6a2.5 2.5 0 1 0 0 .01M6 18a2.5 2.5 0 1 0 0 .01M8 7.5 19 18M8 16.5 19 6`}),paste:(0,X.jsx)(`path`,{d:`M9 4h6v3H9zM15 5h3v15H6V5h3`}),pastePlain:(0,X.jsx)(`path`,{d:`M9 4h6v3H9zM15 5h3v15H6V5h3M9 11h6M12 11v6`}),external:(0,X.jsx)(`path`,{d:`M14 4h6v6M20 4l-9 9M18 14v6H4V6h6`}),unlink:(0,X.jsx)(`path`,{d:`M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1M3 3l18 18`}),selectAll:(0,X.jsx)(`path`,{d:`M4 4h3M10 4h4M17 4h3v3M20 10v4M20 17v3h-3M14 20h-4M7 20H4v-3M4 14v-4M4 7V4M8 8h8v8H8z`}),hideShow:(0,X.jsx)(`path`,{d:`M3 3l18 18M10.6 6.1A10 10 0 0 1 12 6c6.5 0 10 6 10 6a17 17 0 0 1-3.1 3.8M6.6 7.6C3.8 9.3 2 12 2 12s3.5 6 10 6c1.6 0 3-.4 4.3-1`}),percent:(0,X.jsx)(`path`,{d:`M19 5 5 19M7.5 9.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4M16.5 18.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4`}),decLess:(0,X.jsx)(`path`,{d:`M3.5 16h.01M8 9.5a2.5 3.5 0 1 1 0 7 2.5 3.5 0 0 1 0-7M21 19h-7m0 0 2-2m-2 2 2 2`,strokeWidth:1.7}),decMore:(0,X.jsx)(`path`,{d:`M3.5 16h.01M8 9.5a2.5 3.5 0 1 1 0 7 2.5 3.5 0 0 1 0-7M14.5 9.5a2 3 0 1 1 0 6 2 3 0 0 1 0-6M13 19h8m0 0-2-2m2 2-2 2`,strokeWidth:1.7}),check:(0,X.jsx)(`path`,{d:`m5 12.5 4.5 4.5L19 7.5`,strokeWidth:2.2}),more:(0,X.jsx)(`path`,{d:`M12 5.5h.01M12 12h.01M12 18.5h.01`,strokeWidth:3.2}),bAll:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM12 4v16M4 12h16`}),bOuter:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 4h16v16H4z`})]}),bInner:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M12 4v16M4 12h16`})]}),bTop:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 4h16`,strokeWidth:2.2})]}),bBottom:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 20h16`,strokeWidth:2.2})]}),bLeft:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 4v16`,strokeWidth:2.2})]}),bRight:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M20 4v16`,strokeWidth:2.2})]}),bNone:Xc,rect:(0,X.jsx)(`path`,{d:`M4 6h16v12H4z`}),roundRect:(0,X.jsx)(`path`,{d:`M8 6h8a4 4 0 0 1 4 4v4a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4v-4a4 4 0 0 1 4-4`}),ellipse:(0,X.jsx)(`path`,{d:`M12 6c4.4 0 8 2.7 8 6s-3.6 6-8 6-8-2.7-8-6 3.6-6 8-6`}),triangle:(0,X.jsx)(`path`,{d:`M12 5l8 14H4z`}),arrow:(0,X.jsx)(`path`,{d:`M4 10h9V6l7 6-7 6v-4H4z`}),star:(0,X.jsx)(`path`,{d:`m12 4 2.4 5 5.6.7-4.1 3.8 1.1 5.5-5-2.8-5 2.8 1.1-5.5L4 9.7 9.6 9z`}),line:(0,X.jsx)(`path`,{d:`M5 19 19 5`}),rowAbove:(0,X.jsx)(`path`,{d:`M4 12h16v8H4zM12 3v6M9 6h6`}),rowBelow:(0,X.jsx)(`path`,{d:`M4 4h16v8H4zM12 15v6M9 18h6`}),colLeft:(0,X.jsx)(`path`,{d:`M12 4h8v16h-8zM3 12h6M6 9v6`}),colRight:(0,X.jsx)(`path`,{d:`M4 4h8v16H4zM15 12h6M18 9v6`}),delRow:(0,X.jsx)(`path`,{d:`M4 8h16v8H4zM9 10.5l6 3m0-3-6 3`}),delCol:(0,X.jsx)(`path`,{d:`M8 4h8v16H8zM10.5 9l3 6m0-6-3 6`}),hide:(0,X.jsx)(`path`,{d:`M3 3l18 18M10.6 6.1A10 10 0 0 1 12 6c6.5 0 10 6 10 6a17 17 0 0 1-3.1 3.8M6.6 7.6C3.8 9.3 2 12 2 12s3.5 6 10 6c1.6 0 3-.4 4.3-1M9.9 9.9a3 3 0 0 0 4.2 4.2`}),file:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5`}),open:(0,X.jsx)(`path`,{d:`M4 19V6a1 1 0 0 1 1-1h4l2 2h7a1 1 0 0 1 1 1v2M4 19l2.6-7.2a1 1 0 0 1 .9-.8H20a1 1 0 0 1 1 1.3L18.6 19z`}),print:(0,X.jsx)(`path`,{d:`M7 9V4h10v5M7 17H5a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-2M7 14h10v6H7z`}),pdf:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5M8.5 16.5v-4h1.2a1.2 1.2 0 0 1 0 2.4H8.5M13 12.5v4h.8a1.6 1.6 0 0 0 1.6-1.6v-.8a1.6 1.6 0 0 0-1.6-1.6z`,strokeWidth:1.5}),html:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5M10 12l-2 2.5 2 2.5M14 12l2 2.5-2 2.5`}),doc:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5M9 13h6M9 17h4`}),slides:(0,X.jsx)(`path`,{d:`M4 5h16v11H4zM12 16v4M8 20h8`}),info:(0,X.jsx)(`path`,{d:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v5M12 8h.01`})};function Qc({name:e,size:t=18}){return(0,X.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:Zc[e]})}var $c=e=>e.preventDefault();function el(e){let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(0);return(0,u.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect(),i=document.documentElement.clientWidth;n.right>i-8?r(-Math.min(n.left-8,n.right-i+8)):n.left<8&&r(8-n.left)},[]),(0,X.jsx)(`div`,{ref:t,className:e.className??`de-tb-pop`,style:n?{transform:`translateX(${n}px)`}:void 0,onMouseDown:e.onMouseDown,children:e.children})}function tl(e,t,n){let r=(0,u.useRef)(n);r.current=n,(0,u.useEffect)(()=>{if(!t)return;let n=t=>{let n=e.current;n&&!t.composedPath().includes(n)&&r.current()};return window.addEventListener(`mousedown`,n,!0),()=>window.removeEventListener(`mousedown`,n,!0)},[t,e])}function Z(e){return(0,X.jsx)(`button`,{type:`button`,className:e.active?`de-tb de-tb-on`:`de-tb`,title:e.title,"aria-label":e.title,"aria-pressed":e.active,disabled:e.disabled,onMouseDown:$c,onClick:e.onClick,style:e.wide?{width:`auto`,padding:`0 8px`}:void 0,children:e.icon?(0,X.jsx)(Qc,{name:e.icon}):e.label})}var nl=()=>(0,X.jsx)(`span`,{className:`de-tb-sep`});function rl(e){let{options:t}=e,[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(-1),[o,s]=(0,u.useState)(0),c=(0,u.useRef)(null),l=(0,u.useRef)(null),d=(0,u.useRef)({text:``,at:0}),f=e.value!==void 0,p=f?t.findIndex(t=>t.value===e.value):-1,m=p>=0?t[p]:void 0;tl(c,n,()=>r(!1));let h=t=>{t&&!t.disabled&&(r(!1),e.onChange(t.value))},g=()=>{a(p>=0?p:t.findIndex(e=>!e.disabled)),s(0),r(!0)};(0,u.useEffect)(()=>{if(!n)return;let e=e=>{let n=t.length,o=(e,r)=>{let i=e;for(let e=0;e<n;e++)if(i=(i+r+n)%n,!t[i].disabled)return i;return e};if(e.key===`ArrowDown`)a(e=>o(e,1));else if(e.key===`ArrowUp`)a(e=>o(e<0?0:e,-1));else if(e.key===`Home`)a(o(-1,1));else if(e.key===`End`)a(o(0,-1));else if(e.key===`Enter`||e.key===` `&&!d.current.text)h(t[i]);else if(e.key===`Escape`)r(!1);else if(e.key===`Tab`)return r(!1);else if(e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let n=d.current;n.text=(Date.now()-n.at<700?n.text:``)+e.key.toLowerCase(),n.at=Date.now();let r=t.findIndex(e=>!e.disabled&&e.label.toLowerCase().startsWith(n.text));r>=0&&a(r)}else return;e.preventDefault(),e.stopPropagation()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n,i,t]),(0,u.useLayoutEffect)(()=>{let e=l.current;if(!n||!e)return;let t=e.getBoundingClientRect(),r=document.documentElement.clientWidth;t.right>r-8?s(e=>e-(t.right-r+8)):t.left<8&&s(e=>e+(8-t.left));let i=e.closest(`.de-root`),a=Math.min(document.documentElement.clientHeight,i?i.getBoundingClientRect().bottom:1/0),o=parseFloat(getComputedStyle(e).maxHeight),c=a-t.top-8;c>0&&(e.style.maxHeight=`${Math.max(120,Math.min(Number.isFinite(o)?o:c,c))}px`)},[n]),(0,u.useLayoutEffect)(()=>{n&&l.current?.querySelector(`[data-i="${i}"]`)?.scrollIntoView({block:`nearest`})},[n,i]);let _=e.label===void 0?m?.label??e.placeholder??``:e.label;return(0,X.jsxs)(`span`,{ref:c,className:`de-dd-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:(n?`de-dd de-dd-open`:`de-dd`)+(e.className?` `+e.className:``),style:{width:e.width},title:e.title,"aria-label":e.title,"aria-haspopup":`listbox`,"aria-expanded":n,disabled:e.disabled,onMouseDown:$c,onClick:()=>n?r(!1):g(),onKeyDown:e=>{n||e.key!==`ArrowDown`&&e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),g())},children:[e.icon&&(0,X.jsx)(Qc,{name:e.icon}),_!==null&&(0,X.jsx)(`span`,{className:m||e.label!==void 0?`de-dd-label`:`de-dd-label de-dd-ph`,children:_}),(0,X.jsx)(Qc,{name:`chevron`,size:14})]}),n&&(0,X.jsx)(`div`,{ref:l,className:`de-dd-pop`,role:`listbox`,"aria-label":e.title,style:{minWidth:e.menuWidth,...e.alignRight?{right:-o}:{left:o}},onMouseDown:$c,children:t.map((e,t)=>(0,X.jsxs)(u.Fragment,{children:[e.sep&&t>0&&(0,X.jsx)(`div`,{className:`de-dd-sep`,role:`separator`}),e.head&&(0,X.jsx)(`div`,{className:`de-dd-head`,role:`presentation`,children:e.head}),(0,X.jsxs)(`div`,{"data-i":t,role:`option`,"aria-selected":t===p,"aria-disabled":e.disabled||void 0,className:`de-dd-opt`+(t===i?` de-dd-hi`:``)+(e.disabled?` de-dd-dis`:``),onMouseMove:()=>t!==i&&!e.disabled&&a(t),onClick:()=>h(e),children:[f&&(0,X.jsx)(`span`,{className:`de-dd-check`,children:t===p&&(0,X.jsx)(Qc,{name:`check`,size:16})}),e.icon&&(0,X.jsx)(Qc,{name:e.icon}),(0,X.jsx)(`span`,{className:`de-dd-text`,style:e.style,children:e.label}),e.hint&&(0,X.jsx)(`span`,{className:`de-dd-hint`,children:e.hint})]})]},String(e.value)))})]})}function il(e){return(0,X.jsx)(rl,{...e})}function al(e){let t=e.sizes??bl,[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(!1),o=(0,u.useRef)(null),s=(0,u.useRef)(null);tl(o,i,()=>a(!1));let c=e.value??e.placeholder??11,l=t=>{r(null),a(!1),Number.isFinite(t)&&t>=1&&t<=400&&e.onChange(Math.round(t*2)/2)},d=()=>{n!==null&&l(parseFloat(n)),s.current?.blur()},f=e.title??`Font size`;return(0,X.jsxs)(`span`,{ref:o,className:`de-size`,children:[(0,X.jsx)(`button`,{type:`button`,className:`de-tb de-size-step`,title:`Decrease font size`,"aria-label":`Decrease font size`,disabled:e.disabled,onMouseDown:$c,onClick:()=>l(Math.max(1,Math.ceil(c)-1)),children:(0,X.jsx)(Qc,{name:`minus`,size:16})}),(0,X.jsx)(`input`,{ref:s,className:`de-size-input`,title:f,"aria-label":f,inputMode:`decimal`,disabled:e.disabled,value:n??(e.value===void 0?``:String(e.value)),placeholder:e.placeholder===void 0?``:String(e.placeholder),onFocus:e=>{e.currentTarget.select(),a(!0)},onChange:e=>r(e.target.value.replace(/[^\d.]/g,``)),onKeyDown:e=>{if(e.key===`Enter`)e.preventDefault(),d();else if(e.key===`Escape`)e.preventDefault(),r(null),a(!1),s.current?.blur();else if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let i=parseFloat(n??String(c)),a=e.key===`ArrowUp`?t.find(e=>e>i):[...t].reverse().find(e=>e<i);a!==void 0&&r(String(a))}},onBlur:()=>{n!==null&&l(parseFloat(n)),a(!1)}}),(0,X.jsx)(`button`,{type:`button`,className:`de-tb de-size-step`,title:`Increase font size`,"aria-label":`Increase font size`,disabled:e.disabled,onMouseDown:$c,onClick:()=>l(Math.floor(c)+1),children:(0,X.jsx)(Qc,{name:`plus`,size:16})}),i&&(0,X.jsx)(`div`,{className:`de-dd-pop de-size-pop`,role:`listbox`,"aria-label":f,onMouseDown:$c,children:t.map(t=>(0,X.jsx)(`div`,{role:`option`,"aria-selected":t===e.value,className:`de-dd-opt`+(String(t)===(n??String(e.value))?` de-dd-hi`:``),onClick:()=>l(t),children:t},t))})]})}function ol(e){let t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&(e.type===u.Fragment?t.push(...ol(e.props.children)):t.push(e))}),t}var sl=e=>{let t=e.props;return`${typeof e.type==`string`?e.type:e.type.name}:${t.title??t.icon??(typeof t.label==`string`?t.label:``)}`};function cl({children:e}){let t=ol(e),n=t.map(sl).join(`|`),r=(0,u.useRef)(null),i=(0,u.useRef)([]),[a,o]=(0,u.useState)({sig:``,cut:t.length,w:0}),[s,c]=(0,u.useState)(!1),l=(0,u.useRef)(null);tl(l,s,()=>c(!1));let d=a.sig===n,f=d?a.cut:t.length,p=e=>{let r=i.current,a=r.reduce((e,t)=>e+t+2,0),s=t.length;if(a>e){let n=e-34,i=0;for(s=0;s<t.length&&i+r[s]+2<=n;)i+=r[s++]+2}o(t=>t.sig===n&&t.cut===s&&t.w===e?t:{sig:n,cut:s,w:e})},m=()=>{let e=r.current;if(!e)return 0;let t=getComputedStyle(e);return e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)};(0,u.useLayoutEffect)(()=>{let e=r.current;e&&!d&&(i.current=[...e.querySelectorAll(`:scope > [data-i]`)].map(e=>e.getBoundingClientRect().width),p(m()))});let h=(0,u.useRef)(()=>{});h.current=()=>{i.current.length===t.length&&p(m())},(0,u.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(()=>h.current());return t.observe(e),()=>t.disconnect()},[]);let g=e=>!!e&&e.type===nl,_=f;for(;_>0&&g(t[_-1])&&_<t.length;)_--;let v=t.slice(f).filter((e,t,n)=>!g(e)||t!==0&&t!==n.length-1);return(0,X.jsxs)(`div`,{ref:r,className:`de-ebar`,role:`toolbar`,children:[t.slice(0,_).map((e,t)=>(0,X.jsx)(`span`,{"data-i":t,className:`de-ebar-it`,children:e},t)),v.length>0&&(0,X.jsxs)(`span`,{ref:l,className:`de-tb-color de-ebar-morewrap`,children:[(0,X.jsx)(`button`,{type:`button`,className:s?`de-tb de-tb-on`:`de-tb`,title:`More`,"aria-label":`More tools`,"aria-expanded":s,onMouseDown:$c,onClick:()=>c(e=>!e),children:(0,X.jsx)(Qc,{name:`more`})}),s&&(0,X.jsx)(el,{className:`de-tb-pop de-ebar-more`,children:v.map((e,t)=>(0,X.jsx)(`span`,{className:`de-ebar-it`,children:e},t))})]})]})}var ll=`#000000.#434343.#666666.#999999.#b7b7b7.#cccccc.#d9d9d9.#ffffff.#980000.#ff0000.#ff9900.#ffff00.#00ff00.#00ffff.#4a86e8.#0000ff.#9900ff.#ff00ff.#e6b8af.#f4cccc.#fce5cd.#fff2cc.#d9ead3.#d0e0e3.#c9daf8.#cfe2f3.#d9d2e9.#ead1dc.#cc4125.#e06666.#f6b26b.#ffd966.#93c47d.#76a5af.#6d9eeb.#6fa8dc.#8e7cc3.#c27ba0.#1155cc.#38761d`.split(`.`),ul=`office-engine:custom-colors`,dl=7,fl=/^#[0-9a-f]{6}$/,pl=null,ml=new Set;function hl(){if(pl)return pl;pl=[];try{let e=JSON.parse(localStorage.getItem(ul)??`[]`);Array.isArray(e)&&(pl=e.filter(e=>typeof e==`string`&&fl.test(e)).slice(0,dl))}catch{}return pl}function gl(e){pl=[e,...hl().filter(t=>t!==e)].slice(0,dl);try{localStorage.setItem(ul,JSON.stringify(pl))}catch{}ml.forEach(e=>e())}var _l=e=>(ml.add(e),()=>{ml.delete(e)});function vl(e){let[t,n]=(0,u.useState)(!1),r=(0,u.useRef)(null),i=(0,u.useRef)(null),a=(0,u.useSyncExternalStore)(_l,hl,hl);tl(r,t,()=>n(!1));let o=(0,u.useRef)(e.onPick);o.current=e.onPick;let s=e.value?.toLowerCase();(0,u.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>{let t=e.value.toLowerCase();fl.test(t)&&(gl(t),o.current(t))};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let c=()=>{let e=i.current;if(e){e.value=s&&fl.test(s)?s:a[0]??`#000000`,n(!1);try{e.showPicker()}catch{e.click()}}},l=t=>(0,X.jsx)(`button`,{type:`button`,title:t,className:s===t?`on`:void 0,style:{background:t},onClick:()=>(e.onPick(t),n(!1))},t);return(0,X.jsxs)(`span`,{ref:r,className:`de-tb-color`,children:[(0,X.jsxs)(`button`,{type:`button`,className:t?`de-tb de-tb-on`:`de-tb`,title:e.title,"aria-label":e.title,"aria-expanded":t,onMouseDown:$c,onClick:()=>n(e=>!e),children:[(0,X.jsx)(Qc,{name:e.icon}),(0,X.jsx)(`span`,{className:`de-tb-swatch`,style:{background:e.value??`transparent`}})]}),(0,X.jsx)(`input`,{ref:i,type:`color`,className:`de-tb-native`,tabIndex:-1,"aria-hidden":!0}),t&&(0,X.jsxs)(el,{onMouseDown:$c,children:[(0,X.jsx)(`button`,{type:`button`,className:`de-tb-none`,onClick:()=>(e.onPick(null),n(!1)),children:e.noneLabel??`None`}),(0,X.jsx)(`div`,{className:`de-tb-grid`,children:(e.palette??ll).map(l)}),(0,X.jsx)(`div`,{className:`de-tb-custom`,children:`Custom`}),(0,X.jsxs)(`div`,{className:`de-tb-grid`,children:[a.map(l),(0,X.jsx)(`button`,{type:`button`,className:`de-tb-add`,title:`Custom color…`,"aria-label":`Custom color`,onClick:c,children:(0,X.jsx)(Qc,{name:`plus`,size:14})})]})]})]})}var yl=[`Arial`,`Calibri`,`Cambria`,`Courier New`,`Georgia`,`Helvetica`,`Segoe UI`,`Tahoma`,`Times New Roman`,`Verdana`],bl=[8,9,10,10.5,11,12,14,16,18,20,24,28,32,36,40,48,60,72];function xl(e){let t=e&&!yl.includes(e)?[e,...yl]:yl;return t.map((e,n)=>({value:e,label:e,style:{fontFamily:`"${e}", system-ui, sans-serif`},sep:n===1&&t!==yl}))}function Sl(e){if(!e)return``;let t=/^\s*"?([^",]+)"?/.exec(e);return t?t[1]:``}function Cl(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}function wl(e){return(0,X.jsx)(rl,{title:e.title,label:e.label.replace(/\s*▾$/,``),icon:e.icon,options:e.items,onChange:e.onPick})}function Tl(e){let[t,n]=(0,u.useState)(!1),r=(0,u.useRef)(null);return tl(r,t,()=>n(!1)),(0,X.jsxs)(`span`,{ref:r,className:`de-tb-color`,children:[(0,X.jsxs)(`button`,{type:`button`,className:(e.active||t?`de-tb de-tb-on`:`de-tb`)+(e.chevron?` de-tb-chev`:``),title:e.title,"aria-label":e.title,"aria-expanded":t,disabled:e.disabled,onMouseDown:$c,onClick:()=>n(e=>!e),children:[(0,X.jsx)(Qc,{name:e.icon}),e.chevron&&(0,X.jsx)(Qc,{name:`chevron`,size:14})]}),t&&(0,X.jsx)(el,{onMouseDown:e=>e.target.closest(`input, textarea`)||e.preventDefault(),children:e.children(()=>n(!1))})]})}function El({onPick:e}){let[t,n]=(0,u.useState)([0,0]);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`de-gridpick`,onMouseLeave:()=>n([0,0]),children:Array.from({length:64},(r,i)=>{let a=Math.floor(i/8)+1,o=i%8+1;return(0,X.jsx)(`button`,{type:`button`,className:a<=t[0]&&o<=t[1]?`on`:``,onMouseEnter:()=>n([a,o]),onMouseDown:$c,onClick:()=>e(a,o)},i)})}),(0,X.jsx)(`div`,{className:`de-gridpick-label`,children:t[0]?`${t[0]} × ${t[1]}`:`Table size`})]})}function Dl(e=`image/*`,t=!0){return new Promise(n=>{let r=document.createElement(`input`);r.type=`file`,r.accept=e,r.multiple=t,r.onchange=()=>n(Array.from(r.files??[])),r.click()})}var Ol=(0,u.createContext)({bar:null,editable:!1,setDirty:()=>{},save:async()=>{},canDownload:!0,client:null,fileOps:{current:null}}),kl=()=>(0,u.useContext)(Ol);function Al(e){let t=kl().fileOps;(0,u.useEffect)(()=>{t.current=e}),(0,u.useEffect)(()=>()=>{t.current=null},[t])}function jl({children:e}){let{bar:t}=kl();return t?(0,gr.createPortal)((0,X.jsx)(cl,{children:e}),t):null}var Ml=(0,u.createContext)(null);function Nl({text:e,onStatus:t}){let n=(0,u.useContext)(Ml);return(0,u.useEffect)(()=>{t?.(e)},[e,t]),n?(0,gr.createPortal)(e,n):null}var Pl=[.25,.33,.5,.67,.75,.9,1,1.1,1.25,1.5,1.75,2,2.5,3];function Fl({zoom:e,effective:t,onChange:n}){let r=e=>{let r=t,i=e>0?Pl.find(e=>e>r+.001):[...Pl].reverse().find(e=>e<r-.001);i&&n(i)};return(0,X.jsxs)(`div`,{className:`de-zoom`,role:`group`,"aria-label":`Zoom`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,onClick:()=>r(-1),children:`−`}),(0,X.jsx)(`span`,{title:e===`fit`?`Fit width (click for 100%)`:`Click to fit width`,onClick:()=>n(e===`fit`?1:`fit`),children:e===`fit`?`Fit`:`${Math.round(t*100)}%`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,onClick:()=>r(1),children:`+`})]})}function Il({x:e,y:t,items:n,onClose:r}){let i=(0,u.useRef)(null),[a,o]=(0,u.useState)({left:e,top:t}),[s,c]=(0,u.useState)(-1),l=(0,u.useRef)(r);return l.current=r,(0,u.useLayoutEffect)(()=>{let n=i.current;if(!n)return;let r=n.getBoundingClientRect(),a=document.documentElement.clientWidth,s=document.documentElement.clientHeight;o({left:e+r.width>a-4?Math.max(4,e-r.width):e,top:t+r.height>s-4?Math.max(4,Math.min(t-r.height,s-r.height-4)):t})},[e,t]),(0,u.useEffect)(()=>{let e=e=>{i.current&&!e.composedPath().includes(i.current)&&l.current()},t=e=>{let t=n.length,r=(e,r)=>{let i=e;for(let e=0;e<t;e++)if(i=(i+r+t)%t,!n[i].disabled)return i;return e};if(e.key===`Escape`)l.current();else if(e.key===`ArrowDown`)c(e=>r(e,1));else if(e.key===`ArrowUp`)c(e=>r(e<0?0:e,-1));else if(e.key===`Enter`&&s>=0&&!n[s].disabled)l.current(),n[s].run();else return;e.preventDefault(),e.stopPropagation()},r=()=>l.current();return window.addEventListener(`mousedown`,e,!0),window.addEventListener(`keydown`,t,!0),window.addEventListener(`blur`,r),window.addEventListener(`resize`,r),()=>{window.removeEventListener(`mousedown`,e,!0),window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`blur`,r),window.removeEventListener(`resize`,r)}},[n,s]),(0,X.jsx)(`div`,{ref:i,className:`de-ctx`,style:a,role:`menu`,onMouseDown:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),children:n.map((e,t)=>(0,X.jsxs)(`div`,{className:`de-ctx-row`,children:[e.sep&&t>0&&(0,X.jsx)(`div`,{className:`de-ctx-sep`,role:`separator`}),e.head&&(0,X.jsx)(`div`,{className:`de-ctx-head`,children:e.head}),(0,X.jsxs)(`button`,{type:`button`,role:`menuitem`,className:t===s?`de-ctx-hi`:void 0,disabled:e.disabled,onMouseEnter:()=>c(t),onClick:()=>{l.current(),e.run()},children:[(0,X.jsx)(`span`,{className:`de-ctx-icon`,children:e.icon&&(0,X.jsx)(Qc,{name:e.icon,size:16})}),(0,X.jsx)(`span`,{className:`de-ctx-label`,children:e.label}),e.hint&&(0,X.jsx)(`span`,{className:`de-ctx-hint`,children:e.hint})]})]},t))})}var Q=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl+`;function Ll({spec:e,onClose:t}){let[n,r]=(0,u.useState)(e.initial??``),i=(0,u.useRef)(null);(0,u.useEffect)(()=>{let e=i.current;e?.focus(),e?.select()},[]);let a=()=>{t(),e.onOk(n)};return(0,X.jsx)(`div`,{className:`de-dialog-back`,onMouseDown:e=>e.target===e.currentTarget&&t(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),t())},children:(0,X.jsxs)(`form`,{className:`de-dialog`,role:`dialog`,"aria-label":e.title,onSubmit:e=>{e.preventDefault(),a()},children:[(0,X.jsx)(`div`,{className:`de-dialog-title`,children:e.title}),e.label&&(0,X.jsx)(`label`,{className:`de-dialog-label`,children:e.label}),e.area?(0,X.jsx)(`textarea`,{ref:i,rows:3,value:n,placeholder:e.placeholder,onChange:e=>r(e.target.value)}):(0,X.jsx)(`input`,{ref:i,value:n,placeholder:e.placeholder,onChange:e=>r(e.target.value)}),e.note&&(0,X.jsx)(`div`,{className:`de-dialog-note`,children:e.note}),(0,X.jsxs)(`div`,{className:`de-dialog-btns`,children:[e.extra&&(0,X.jsx)(`button`,{type:`button`,className:`de-btn de-dialog-extra`,onClick:()=>{t(),e.extra.run()},children:e.extra.label}),(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,onClick:t,children:`Cancel`}),(0,X.jsx)(`button`,{type:`submit`,className:`de-btn de-btn-primary`,children:e.ok??`OK`})]})]})})}function Rl(e){let t=(0,u.useRef)(null);return(0,u.useEffect)(()=>t.current?.focus(),[]),(0,X.jsx)(`div`,{className:`de-dialog-back`,onMouseDown:t=>t.target===t.currentTarget&&e.onClose(),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onClose())},children:(0,X.jsxs)(`div`,{className:`de-dialog`,role:`alertdialog`,"aria-label":e.title,children:[(0,X.jsx)(`div`,{className:`de-dialog-title`,children:e.title}),(0,X.jsx)(`div`,{className:`de-dialog-note`,children:e.message}),(0,X.jsxs)(`div`,{className:`de-dialog-btns`,children:[(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,onClick:e.onClose,children:`Cancel`}),(0,X.jsx)(`button`,{ref:t,type:`button`,className:`de-btn de-btn-primary`,onClick:()=>{e.onClose(),e.onOk()},children:e.ok})]})]})})}function zl({text:e,onDone:t}){return(0,u.useEffect)(()=>{let e=setTimeout(t,3500);return()=>clearTimeout(e)},[e,t]),(0,X.jsx)(`div`,{className:`de-toast`,role:`status`,children:e})}var Bl=e=>e.t===`text`?e.text.length:1,Vl=e=>e.reduce((e,t)=>e+Bl(t),0),Hl=e=>e.a.pa===e.f.pa&&e.a.o===e.f.o,Ul=(e,t)=>e.replace(/(\d+)$/,e=>String(Number(e)+t));function Wl(e){return e.map(e=>e.t===`text`?e.text:``).join(``)}function Gl(e,t){if(e===t)return!0;if(!e||!t)return!e&&!t;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}var Kl=(e,t)=>e.t===`text`&&t.t===`text`&&e.href===t.href&&e.lk===t.lk&&Gl(e.s,t.s)&&Gl(e.d,t.d);function ql(e){let t=[];for(let n of e){if(n.t===`text`&&!n.text)continue;let e=t[t.length-1];e&&Kl(e,n)?t[t.length-1]={...e,text:e.text+n.text}:t.push(n)}return t}function Jl(e,t){let n=[],r=[],i=0;for(let a of e){let e=Bl(a);if(i+e<=t)n.push(a);else if(i>=t)r.push(a);else{let e=t-i;n.push({...a,text:a.text.slice(0,e)}),r.push({...a,text:a.text.slice(e)})}i+=e}return[n,r]}function Yl(e,t){let[n,r]=Jl(e,t);for(let e=n.length-1;e>=0;e--)if(n[e].t===`text`)return n[e];return r.find(e=>e.t===`text`)}function Xl(e,t,n,r,i){if(!n)return e;let[a,o]=Jl(e,t),s=Yl(e,t),c={t:`text`,...s??i??{},...r??{},text:n};return r?.s&&s?.s&&(c.s={...s.s,...r.s}),(r?.d||s?.d)&&(c.d={...s?.d??{},...r?.d??{}}),c.d&&!Object.keys(c.d).length&&delete c.d,ql([...a,c,...o])}function Zl(e,t,n){return n<=t?e:ql([...Jl(e,t)[0],...Jl(e,n)[1]])}function Ql(e,t,n,r,i){let[a,o]=Jl(e,t),[s,c]=Jl(o,n-t),l=s.map(e=>e.t===`text`?{...e,s:{...e.s??{},...r},d:{...e.d??{},...i}}:e);return ql([...a,...l,...c])}function $l(e,t){if(t<=0)return 0;let n=Intl.Segmenter;if(n){let r=0;for(let i of new n(void 0,{granularity:`grapheme`}).segment(e.slice(0,t)))r=i.index;return r}let r=e.charCodeAt(t-1);return r>=56320&&r<=57343&&t>=2?t-2:t-1}function eu(e,t){if(t>=e.length)return e.length;let n=Intl.Segmenter;if(n)for(let r of new n(void 0,{granularity:`grapheme`}).segment(e.slice(t)))return t+r.segment.length;let r=e.charCodeAt(t);return r>=55296&&r<=56319?t+2:t+1}function tu(e,t){let n=e.cmp(t.a.pa,t.f.pa);return n<0||n===0&&t.a.o<=t.f.o?[t.a,t.f]:[t.f,t.a]}var nu=e=>({a:e,f:e});function ru(e,t){let[n,r]=tu(e,t);if(n.pa===r.pa){let t=e.para(n.pa);return t?{pas:[n.pa],paras:[e.withRuns(t,Zl(t.runs,n.o,r.o))],at:n}:null}let i=e.span(n.pa,r.pa);if(!i)return null;let a=e.para(i[0]),o=e.para(i[i.length-1]),s=ql([...Jl(a.runs,n.o)[0],...Jl(o.runs,r.o)[1]]);return{pas:i,paras:[e.join(a,o,s)],at:n}}function iu(e,t,n){let r=ru(e,t);r&&e.replace(r.pas,r.paras,nu(r.at),n)}function au(e,t){if(!Hl(t))return ru(e,t);let n=e.para(t.a.pa);return n?{pas:[t.a.pa],paras:[n],at:t.a}:null}function ou(e,t,n,r={},i){let a=au(e,t);if(!a)return;let o=a.paras[0],s=a.at.o,[c,l]=Jl(o.runs,s),u=Yl(o.runs,s)??e.defaultRun?.(o),d=e=>e.map(e=>e.t===`text`&&!e.s&&u?{...u,...e,s:u.s,src:u.src}:e);if(n.length===1){let t=d(n[0]),i=ql([...c,...t,...l]);e.replace(a.pas,[e.withRuns(o,i)],nu({pa:a.at.pa,o:s+Vl(t)}),{label:`paste`,...r});return}let f=[],p=e.withRuns(o,ql([...c,...d(n[0])]));i?.[0]&&(p=i[0](p));for(let t=1;t<n.length;t++){let r=t===n.length-1,a=d(n[t]),[o,s]=e.split(p,p.runs,ql([...a,...r?l:[]]),!r);f.push(o),p=i?.[t]?i[t](s):s}f.push(p),e.replace(a.pas,f,nu({pa:Ul(a.at.pa,f.length-1),o:Vl(d(n[n.length-1]))}),{label:`paste`,...r})}function su(e,t,n,r){let i=au(e,t);if(!i)return;let a=e.pendingStyle?.();e.clearPending?.();let o=i.paras[0],s=i.at.o,c=n.replace(/\r\n?/g,`
|
|
23
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`,s=g(o),c=b(s);c.c=c.c.filter(e=>!(h(e)&&/notesSlide$/.test(w(e,`Type`)??``))),o=_(s),await sc(e,t.index,i,o);break}case`delete`:{let r=n[t.index];if(!r||n.length<=1)break;let{nodes:i,lst:a}=await rc(e),o=await e.pkg.rels(e.mainPath),s=x(a,`sldId`).find(e=>o.get(w(e,`r:id`)??``)?.target===r.path);s&&a.c.splice(a.c.indexOf(s),1),e.pkg.setPart(e.mainPath,_(i));let c=Ve(await e.pkg.rels(r.path),`notesSlide`)?.target;await e.pkg.removeRelsTo(e.mainPath,r.path);for(let t of[r.path,c].filter(Boolean))e.pkg.setPart(t,null),e.pkg.has(ze(t))&&e.pkg.setPart(ze(t),null),await e.pkg.setContentType(t,null);break}case`move`:{let{nodes:n,lst:r}=await rc(e),i=x(r,`sldId`),a=i[t.from];if(!a||t.to<0||t.to>=i.length)break;r.c.splice(r.c.indexOf(a),1);let o=x(r,`sldId`),s=t.to>=o.length?r.c.length:r.c.indexOf(o[t.to]);r.c.splice(s,0,a),e.pkg.setPart(e.mainPath,_(n));break}case`hide`:{let r=n[t.index];if(!r)break;let i=g(await e.pkg.text(r.path));T(b(i),`show`,t.hidden?`0`:void 0),e.pkg.setPart(r.path,_(i));break}}return ic(e)}var lc=new Set([`insertRows`,`deleteRows`,`insertCols`,`deleteCols`]),uc=e=>e.t===`book`||e.t===`sheet`&&lc.has(e.op.op);function dc(e,t,n){if(n>=0)return e>=t?e+n:e;let r=-n;return e<t?e:e<t+r?null:e-r}function fc(e,t,n,r){if(r>=0)return[e>=n?e+r:e,t>=n?t+r:t];let i=-r;if(t<n)return[e,t];if(e>=n+i)return[e-i,t-i];let a=e<n?e:n,o=t<n+i?n-1:t-i;return o<a?null:[a,o]}function pc(e,t,n,r){let i=t===`row`?fc(e.r0,e.r1,n,r):fc(e.c0,e.c1,n,r);return i?t===`row`?{...e,r0:i[0],r1:i[1]}:{...e,c0:i[0],c1:i[1]}:null}function mc(e,t,n,r){let i=(e,i,a)=>a===t?fc(e,i,n,r):[e,i];switch(e.op){case`insertRows`:case`insertCols`:{if(e.op===`insertRows`!=(t===`row`))return e;let i=r>=0?e.at>=n?e.at+r:e.at:e.at<n?e.at:e.at<n-r?n:e.at+r;return i===e.at?e:{...e,at:i}}case`deleteRows`:case`deleteCols`:{if(e.op===`deleteRows`!=(t===`row`))return e;let i=fc(e.at,e.at+e.n-1,n,r);return i?{...e,at:i[0],n:i[1]-i[0]+1}:null}case`merge`:case`unmerge`:case`fill`:{let i=pc(e.range,t,n,r);return i?{...e,range:i}:null}case`sort`:{let i=pc(e.range,t,n,r);if(!i)return null;let a=t===`col`?dc(e.col,n,r):e.col;return a===null?null:{...e,range:i,col:a}}case`hideRows`:case`hideCols`:{let t=i(e.a,e.b,e.op===`hideRows`?`row`:`col`);return t?{...e,a:t[0],b:t[1]}:null}case`colWidth`:{let t=i(e.c0,e.c1,`col`);return t?{...e,c0:t[0],c1:t[1]}:null}case`rowHeight`:{let t=i(e.r0,e.r1,`row`);return t?{...e,r0:t[0],r1:t[1]}:null}default:return e}}function hc(e,t){if(t.t===`book`)return t.op.op===`delete`&&`sheet`in e&&e.sheet===t.op.path?null:e;if(t.t!==`sheet`||!lc.has(t.op.op)||!(`sheet`in e)||e.sheet!==t.sheet)return e;let n=t.op,r=n.op.endsWith(`Rows`)?`row`:`col`,i=n.op.startsWith(`insert`)?n.n:-n.n;switch(e.t){case`set`:{let t=[];for(let a of e.cells){let e=dc(r===`row`?a.r:a.c,n.at,i);e!==null&&t.push(r===`row`?{...a,r:e}:{...a,c:e})}return t.length?{...e,cells:t}:null}case`fmt`:{let t=pc(e.range,r,n.at,i);return t?{...e,range:t}:null}case`sheet`:{let t=mc(e.op,r,n.at,i);return t===e.op?e:t?{...e,op:t}:null}case`replace`:{if(!e.at)return e;let t=dc(r===`row`?e.at.r:e.at.c,n.at,i);return t===null?null:{...e,at:r===`row`?{...e.at,r:t}:{...e.at,c:t}}}}return e}var gc={r0:0,c0:0,r1:2**53-1,c1:2**53-1};function _c(e){switch(e.t){case`set`:{let t=1/0,n=1/0,r=-1,i=-1;for(let a of e.cells)t=Math.min(t,a.r),n=Math.min(n,a.c),r=Math.max(r,a.r),i=Math.max(i,a.c);return{sheet:e.sheet,range:{r0:t,c0:n,r1:r,c1:i}}}case`fmt`:return{sheet:e.sheet,range:e.range};case`replace`:return{sheet:e.sheet,range:e.at?{r0:e.at.r,c0:e.at.c,r1:e.at.r,c1:e.at.c}:gc};case`sheet`:{let t=e.op;return`range`in t?{sheet:e.sheet,range:t.range}:t.op===`hideRows`?{sheet:e.sheet,range:{...gc,r0:t.a,r1:t.b}}:t.op===`hideCols`?{sheet:e.sheet,range:{...gc,c0:t.a,c1:t.b}}:t.op===`colWidth`?{sheet:e.sheet,range:{...gc,c0:t.c0,c1:t.c1}}:t.op===`rowHeight`?{sheet:e.sheet,range:{...gc,r0:t.r0,r1:t.r1}}:{sheet:e.sheet,range:gc}}default:return null}}var vc=(e,t)=>e.r0<=t.r1&&t.r0<=e.r1&&e.c0<=t.c1&&t.c0<=e.c1;function yc(e,t){if(t.some(e=>uc(e)||e.t===`revert`)||e.some(e=>e.t===`revert`||uc(e)))return!0;let n=e=>e.t===`fmt`&&e.patch.xf===void 0&&!e.patch.clear;if(e.some(n)&&t.some(n))return!0;let r=t.map(_c);return e.some(e=>{let t=_c(e);return!!t&&r.some(e=>!!e&&e.sheet===t.sheet&&vc(t.range,e.range))})}var bc=400,xc=class{constructor(e,t,n){A(this,`ed`,void 0),A(this,`wb`,void 0),A(this,`emit`,void 0),A(this,`recs`,new Map),A(this,`byOp`,new Map),A(this,`seq`,0),this.ed=e,this.wb=t,this.emit=n}index(e){let t=this.wb.sheets.findIndex(t=>t.path===e);if(t<0)throw new Sc;return t}async sheet(e){let t=this.index(e);return await this.wb.loadSheet(t,this.emit),t}dropSheet(e){for(let[t,n]of this.recs)(e===null||n.ch?.sheet===e)&&(this.recs.delete(t),this.byOp.delete(n.op))}async apply(e){let t=await this.ed.styleMark(),n;try{n=await this.run(e)}catch(e){if(e instanceof Sc)return{res:null,rec:null};throw e}let r=this.ed.takeRecord(),i=await this.ed.styleMark(),a=Object.keys(i).some(e=>i[e]!==t[e]);if(e.t===`book`||e.t===`sheet`&&lc.has(e.op.op))return this.dropSheet(null),{res:n,rec:null};let o=++this.seq;if(this.recs.set(o,{ch:r,styles:a?t:void 0,op:e.id}),this.byOp.set(e.id,o),this.recs.size>bc){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:n,rec:o}}async run(e){let t=this.ed;switch(e.t){case`set`:return t.setCells(await this.sheet(e.sheet),e.cells);case`fmt`:return t.format(await this.sheet(e.sheet),e.range,e.patch);case`sheet`:return t.sheetOp(await this.sheet(e.sheet),e.op);case`replace`:return t.replace(await this.sheet(e.sheet),e.query,e.by,e.opts,e.at);case`book`:{let n=e.op,r;r=n.op===`add`?{op:`add`,name:n.name,after:n.after?this.index(n.after):void 0}:n.op===`rename`?{op:`rename`,index:this.index(n.path),name:n.name}:n.op===`delete`?{op:`delete`,index:this.index(n.path)}:{op:`move`,from:this.index(n.path),to:Math.max(0,Math.min(n.to,this.wb.sheets.length-1))};try{return await t.bookOp(r)}catch{throw new Sc}}case`revert`:{let n=this.byOp.get(e.target),r=n===void 0?void 0:this.recs.get(n);if(!r?.ch)throw new Sc;return t.restoreRecord(r.ch,e.which)}}}async revert(e){let t=this.recs.get(e);if(!t)return null;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op);let n=t.ch?this.ed.revertRecord(t.ch):null;return t.styles&&await this.ed.styleTruncate(t.styles),n}},Sc=class extends Error{},Cc=300,wc=class{constructor(e){A(this,`pres`,void 0),A(this,`recs`,new Map),A(this,`byOp`,new Map),A(this,`seq`,0),A(this,`images`,new Map),A(this,`ready`,void 0),this.pres=e}async originals(){for(let e of this.pres.meta.slides)await this.pres.keepOriginal(e.path)}index(e){return this.pres.meta.slides.findIndex(t=>t.path===e)}get genMaps(){return this.pres.genMaps}async snap(e){return{xml:await this.pres.pkg.text(e),gen:[...this.genMaps].filter(([t])=>t.startsWith(e+`#`))}}restore(e,t){this.pres.pkg.setPart(e,t.xml);for(let t of[...this.genMaps.keys()])t.startsWith(e+`#`)&&this.genMaps.delete(t);for(let[e,n]of t.gen)this.genMaps.set(e,n);this.pres.touched=!0}async model(e){let t=this.index(e);return t<0?{}:{slide:t,model:await this.pres.slide(t)}}async apply(e){let t=this.pres;if(await(this.ready??(this.ready=this.originals())),e.t===`image`){let n=this.index(e.slide);if(n<0)return{res:{},rec:null};let r=this.images.get(e.key);return r||(r=await tc(t,n,e.bytes,e.ext),this.images.set(e.key,r)),{res:{rid:r},rec:null}}if(e.t===`slides`){let n=e.op,r=e=>this.index(e),i=null;if(n.op===`add`?i={op:`add`,after:n.after?r(n.after):-1,layout:n.layout}:r(n.path)>=0&&(i=n.op===`duplicate`?{op:`duplicate`,index:r(n.path)}:n.op===`delete`?t.meta.slides.length>1?{op:`delete`,index:r(n.path)}:null:n.op===`move`?{op:`move`,from:r(n.path),to:Math.max(0,Math.min(n.to,t.meta.slides.length-1))}:{op:`hide`,index:r(n.path),hidden:n.hidden}),!i)return{res:{},rec:null};let a=await cc(t,i);return await this.originals(),this.recs.clear(),this.byOp.clear(),{res:{meta:{...a,slides:a.slides.map(e=>({...e}))}},rec:null}}let n,r;if(e.t===`revert`){let t=this.byOp.get(e.target);if(r=t===void 0?void 0:this.recs.get(t),!r)return{res:{},rec:null};n=r.path}else n=e.slide;let i=this.index(n);if(i<0)return{res:{},rec:null};let a=await this.snap(n);if(e.t===`text`)try{await t.setText(i,e.sid,e.paras)}catch{return{res:{},rec:null}}else e.t===`shapes`?await nc(t,i,e.ops.map(e=>{if(e.op!==`insert`||!e.key)return e;let{key:t,...n}=e;return{...n,rid:this.images.get(t)}})):r&&this.restore(n,e.which===`prev`?r.before:r.after);t.undoStack=[],t.redoStack=[];let o=++this.seq;if(this.recs.set(o,{path:n,before:a,after:await this.snap(n),op:e.id}),this.byOp.set(e.id,o),this.recs.size>Cc){let[e,t]=this.recs.entries().next().value;this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op)}return{res:await this.model(n),rec:o}}async revert(e){let t=this.recs.get(e);return t?(this.recs.delete(e),this.byOp.get(t.op)===e&&this.byOp.delete(t.op),this.restore(t.path,t.before),this.model(t.path)):{}}},Tc=new Set([`docx.edit`,`docx.table`,`docx.image`,`docx.link`,`docx.style`,`save`,`xlsx.set`,`xlsx.format`,`xlsx.sheetOp`,`xlsx.bookOp`,`xlsx.replace`,`xlsx.undo`,`xlsx.redo`,`collab.xlsx.apply`,`collab.xlsx.revert`,`pptx.setText`,`pptx.shapes`,`pptx.slides`,`pptx.image`,`pptx.undo`,`collab.pptx.apply`,`collab.pptx.revert`]),Ec=class{constructor(e){A(this,`emit`,void 0),A(this,`pkg`,void 0),A(this,`kind`,void 0),A(this,`docx`,void 0),A(this,`xlsx`,void 0),A(this,`xlsxEd`,void 0),A(this,`pptx`,void 0),A(this,`abort`,new AbortController),A(this,`writes`,Promise.resolve()),A(this,`xcollab`,void 0),A(this,`pcollab`,void 0),this.emit=e}async open(e,t={}){let n=await hr(e,{...t,signal:this.abort.signal,onProgress:(e,t)=>this.emit(`progress`,{phase:`download`,loaded:e,total:t})}),r=await fe.open(n),i=this.pkg=new Be(r),a=await i.mainPart();this.kind=a.kind;let o={kind:a.kind,name:t.name??n.name,size:n.size};return a.kind===`docx`?this.docx=await Mt.open(i,a.path):a.kind===`xlsx`?o.xlsx=(this.xlsx=await as.open(i,a.path)).meta():o.pptx=(this.pptx=await rr.open(i,a.path)).meta,o}call(e,t){if(!Tc.has(e))return this.dispatch(e,t);let n=this.writes.then(()=>this.dispatch(e,t));return this.writes=n.catch(()=>{}),n}async dispatch(e,t){switch(e){case`open`:return this.open(t[0],t[1]);case`part`:return this.need(this.pkg).blob(t[0]);case`docx.start`:{let e=this.need(this.docx);try{await e.stream({signal:this.abort.signal,onBlocks:e=>this.emit(`docx:blocks`,e),onMeta:e=>this.emit(`docx:meta`,e),onProgress:(e,t)=>this.emit(`progress`,{phase:`parse`,loaded:e,total:t})}),this.emit(`docx:done`,{})}catch(e){this.emit(`docx:done`,{error:e.message})}return}case`docx.edit`:return un(this.need(this.docx),t[0]);case`docx.table`:return Sn(this.need(this.docx),t[0]);case`docx.image`:return gn(this.need(this.docx),new Uint8Array(t[0]),t[1]);case`docx.link`:return _n(this.need(this.docx),t[0]);case`docx.style`:return tn(this.need(this.docx),t[0]);case`save`:return this.save();case`dirty`:return this.docx?this.docx.dirty:this.xlsxEd?this.xlsxEd.dirty:this.pptx?this.pptx.dirty:this.need(this.pkg).dirty;case`xlsx.load`:this.need(this.xlsx).loadSheet(t[0],e=>this.emit(`xlsx:progress`,e),(e,t,n)=>this.emit(`progress`,{phase:e,loaded:t,total:n}));return;case`xlsx.set`:return this.xed().setCells(t[0],t[1]);case`xlsx.format`:return this.xed().format(t[0],t[1],t[2]);case`xlsx.sheetOp`:return this.xed().sheetOp(t[0],t[1]);case`xlsx.replace`:return this.xed().replace(t[0],t[1],t[2],t[3],t[4]);case`xlsx.bookOp`:return this.xed().bookOp(t[0]);case`xlsx.undo`:return this.xed().undo();case`xlsx.redo`:return this.xed().redo();case`collab.xlsx.apply`:return this.xc().apply(t[0]);case`collab.xlsx.revert`:return this.xc().revert(t[0]);case`collab.pptx.apply`:return(this.pcollab??(this.pcollab=new wc(this.need(this.pptx)))).apply(t[0]);case`collab.pptx.revert`:return(this.pcollab??(this.pcollab=new wc(this.need(this.pptx)))).revert(t[0]);case`xlsx.block`:return this.need(this.xlsx).block(t[0],t[1],t[2]);case`xlsx.cell`:return this.need(this.xlsx).cell(t[0],t[1],t[2]);case`xlsx.find`:return this.need(this.xlsx).find(t[0],t[1],t[2]);case`pptx.setText`:return this.need(this.pptx).setText(t[0],t[1],t[2]);case`pptx.shapes`:return nc(this.need(this.pptx),t[0],t[1]);case`pptx.slides`:return cc(this.need(this.pptx),t[0]);case`pptx.image`:return tc(this.need(this.pptx),t[0],new Uint8Array(t[1]),t[2]);case`pptx.slide`:return this.need(this.pptx).slide(t[0]);case`pptx.undo`:return ec(this.need(this.pptx),!!t[0])}throw Error(`Unknown method ${String(e)}`)}xc(){return this.xcollab??(this.xcollab=new xc(this.xed(),this.need(this.xlsx),e=>this.emit(`xlsx:progress`,e)))}xed(){return this.xlsxEd??(this.xlsxEd=new Ts(this.need(this.xlsx)))}async save(){if(this.docx)return Cn(this.docx);if(this.xlsx)return this.xed().save();if(this.pptx)return this.pptx.save();throw Error(`Saving is not supported for this document yet`)}dispose(){this.abort.abort()}need(e){if(!e)throw Error(this.kind?`Operation not available for ${this.kind}`:`Document not opened`);return e}},Dc;function Oc(e){Dc=e}var kc=class e{constructor(e){A(this,`kind`,void 0),A(this,`name`,void 0),A(this,`size`,0),A(this,`info`,void 0),A(this,`worker`,void 0),A(this,`engine`,void 0),A(this,`seq`,0),A(this,`pending`,new Map),A(this,`listeners`,new Map),A(this,`urls`,new Map),A(this,`destroyed`,!1),A(this,`interceptor`,void 0);let t=e.worker===!1?void 0:e.worker??Dc;t?(this.worker=t(),this.worker.onmessage=e=>this.onMessage(e.data),this.worker.onerror=e=>{let t=Error(e.message||`Worker failed to start`);for(let e of this.pending.values())e.reject(t);this.pending.clear()}):this.engine=new Ec((e,t)=>this.onMessage({event:e,data:t}))}static async open(t,n={}){let r=new e(n),{worker:i,onProgress:a,...o}=n;a&&r.on(`progress`,a);let s;s=typeof t==`string`||t instanceof URL?new URL(String(t),globalThis.location?.href).href:t instanceof Uint8Array?t.slice().buffer:t;try{r.info=await r.call(`open`,s,o)}catch(e){throw r.destroy(),e}return r.kind=r.info.kind,r.name=r.info.name,r.size=r.info.size,r}onMessage(e){if(`event`in e){let t=this.listeners.get(e.event);if(t)for(let n of t)n(e.data);return}let t=this.pending.get(e.id);t&&(this.pending.delete(e.id),e.ok?t.resolve(e.result):t.reject(Error(e.error)))}call(e,...t){if(this.interceptor&&!this.destroyed){let n=this.interceptor(e,t);if(n)return n}return this.direct(e,...t)}direct(e,...t){if(this.destroyed)return Promise.reject(Error(`Document closed`));if(this.engine)return this.engine.call(e,t);let n=++this.seq;return new Promise((r,i)=>{this.pending.set(n,{resolve:r,reject:i});let a=t[0]instanceof ArrayBuffer?[t[0]]:[];this.worker.postMessage({id:n,method:e,args:t},a)})}notify(e,t){this.onMessage({event:e,data:t})}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>n.delete(t)}mediaUrl(e){let t=this.urls.get(e);return t||(t=this.call(`part`,e).then(e=>URL.createObjectURL(e)),this.urls.set(e,t)),t}static canRender(e){return Fe(e)}destroy(){if(!this.destroyed){this.destroyed=!0,this.worker?.terminate(),this.engine?.dispose();for(let e of this.pending.values())e.reject(Error(`Document closed`));this.pending.clear();for(let e of this.urls.values())e.then(e=>URL.revokeObjectURL(e)).catch(()=>{});this.urls.clear(),this.listeners.clear()}}};Oc(()=>new m({name:`office-engine`}));var Ac=new WeakMap,jc=new WeakMap;function Mc(e,t,n){let r=Ac.get(e);r||Ac.set(e,r=new Map),r.set(t,n);for(let r of jc.get(e)?.get(t)??[])r(n);return()=>{r.get(t)===n&&r.delete(t)}}function Nc(e,t){return Ac.get(e)?.get(t)}function Pc(e,t,n){let r=jc.get(e);r||jc.set(e,r=new Map);let i=r.get(t);i||r.set(t,i=new Set),i.add(n);let a=Nc(e,t);return a&&n(a),()=>i.delete(n)}var Fc=new WeakMap;function Ic(e){let t=Fc.get(e);return t||Fc.set(e,t={peers:Rc,peerFns:new Set,localFns:new Set}),t}function Lc(e,t){let n=Ic(e);n.peers=t;for(let e of n.peerFns)e()}var Rc=[];function zc(e){return Fc.get(e)?.peers??Rc}function Bc(e,t){let n=Ic(e);return n.peerFns.add(t),()=>n.peerFns.delete(t)}function Vc(e,t){for(let n of Fc.get(e)?.localFns??[])n(t)}function Hc(e,t){let n=Ic(e);return n.localFns.add(t),()=>n.localFns.delete(t)}var Uc=typeof window>`u`?u.useEffect:u.useLayoutEffect;function Wc(){let[e,t]=(0,u.useReducer)(e=>e+1,0);return[e,t]}function Gc(){let e=(0,u.useRef)(null),[t,n]=(0,u.useState)({w:0,h:0});return Uc(()=>{let t=e.current;if(!t)return;let r=()=>{let e=t.clientWidth,r=t.clientHeight;n(t=>t.w===e&&t.h===r?t:{w:e,h:r})};r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[]),[e,t]}function Kc(e){let[t,n]=(0,u.useState)({x:0,y:0}),[r,i]=(0,u.useState)(null);return Uc(()=>{e.current!==r&&i(e.current)}),(0,u.useEffect)(()=>{if(!r)return;let e=0,t=()=>n(e=>e.x===r.scrollLeft&&e.y===r.scrollTop?e:{x:r.scrollLeft,y:r.scrollTop}),i=()=>{e||(e=requestAnimationFrame(()=>{e=0,t()}))};return t(),r.addEventListener(`scroll`,i,{passive:!0}),()=>{r.removeEventListener(`scroll`,i),cancelAnimationFrame(e)}},[r]),t}function qc(e,t,n=!0){let[r,i]=(0,u.useState)(null);return(0,u.useEffect)(()=>{if(!t||!n)return;if(!Fe(t)){i(`unsupported`);return}let r=!0;return e.mediaUrl(t).then(e=>r&&i(e),()=>r&&i(`unsupported`)),()=>{r=!1}},[e,t,n]),r}function Jc(e,t){let n=0,r=e.length-1,i=0;for(;n<=r;){let a=n+r>>1;e[a]<=t?(i=a,n=a+1):r=a-1}return i}var Yc=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),X=t(((e,t)=>{t.exports=Yc()}))(),Xc=(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM12 4v16M4 12h16`,strokeDasharray:`1.2 2.6`,opacity:.5,strokeWidth:1.4}),Zc={undo:(0,X.jsx)(`path`,{d:`M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11`}),redo:(0,X.jsx)(`path`,{d:`m15 14 5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13`}),bold:(0,X.jsx)(`path`,{d:`M7 5h6a3.5 3.5 0 0 1 0 7H7zM7 12h7a3.5 3.5 0 0 1 0 7H7z`,strokeWidth:2.4}),italic:(0,X.jsx)(`path`,{d:`M14 5h-4m4 14h-4m3-14-2 14`,strokeWidth:2.2}),underline:(0,X.jsx)(`path`,{d:`M7 4v7a5 5 0 0 0 10 0V4M5 20h14`}),strike:(0,X.jsx)(`path`,{d:`M16 6.5C15.3 5 13.8 4 12 4c-2.5 0-4 1.3-4 3 0 4 8 2.5 8 7 0 2-1.8 3.5-4.2 3.5-2 0-3.6-1-4.3-2.5M4 12h16`}),color:(0,X.jsx)(`path`,{d:`m6 16 6-12 6 12M8.3 11.5h7.4`}),highlight:(0,X.jsx)(`path`,{d:`m9 11-5 5v3h3l5-5M14.5 5.5l4 4L12 16l-4-4zM15 4l5 5`}),fill:(0,X.jsx)(`path`,{d:`m19 11-8-8-8.5 8.5a2 2 0 0 0 0 2.8l5.7 5.7a2 2 0 0 0 2.8 0zM5 2l5 5M21 15s2 2.5 2 4a2 2 0 0 1-4 0c0-1.5 2-4 2-4`}),alignLeft:(0,X.jsx)(`path`,{d:`M4 6h16M4 10h10M4 14h16M4 18h10`}),alignCenter:(0,X.jsx)(`path`,{d:`M4 6h16M7 10h10M4 14h16M7 18h10`}),alignRight:(0,X.jsx)(`path`,{d:`M4 6h16M10 10h10M4 14h16M10 18h10`}),justify:(0,X.jsx)(`path`,{d:`M4 6h16M4 10h16M4 14h16M4 18h16`}),bullets:(0,X.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01`,strokeWidth:2.2}),numbers:(0,X.jsx)(`path`,{d:`M10 6h10M10 12h10M10 18h10M4 4.5h1.5v4M4 8.5h3M4 14.5c0-1 2.5-1.2 2.5.3 0 1.2-2.5 1.8-2.5 3.2h2.8`}),indent:(0,X.jsx)(`path`,{d:`M4 5h16M11 10h9M11 14h9M4 19h16M4 9l3 3-3 3`}),outdent:(0,X.jsx)(`path`,{d:`M4 5h16M11 10h9M11 14h9M4 19h16M7 9l-3 3 3 3`}),clear:(0,X.jsx)(`path`,{d:`M5 5h10M10 5l-3 14M14 14l5 5m0-5-5 5`}),search:(0,X.jsx)(`path`,{d:`m20 20-4.2-4.2M17 11a6 6 0 1 1-12 0 6 6 0 0 1 12 0`}),save:(0,X.jsx)(`path`,{d:`M12 4v11m-4.5-4.5L12 15l4.5-4.5M5 19h14`}),wrap:(0,X.jsx)(`path`,{d:`M4 6h16M4 12h13a3 3 0 0 1 0 6h-4m2-2-2 2 2 2M4 18h5`}),edit:(0,X.jsx)(`path`,{d:`m4 20 1-4L16 5l3 3L8 19zM14 7l3 3`}),view:(0,X.jsx)(`path`,{d:`M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12m10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6`}),close:(0,X.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`}),image:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM4 16l5-5 4 4 3-3 4 4M15.5 9.5h.01`}),table:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM4 10h16M4 15h16M10 5v14M15 5v14`}),link:(0,X.jsx)(`path`,{d:`M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1`}),pagebreak:(0,X.jsx)(`path`,{d:`M5 4v5h14V4M5 20v-5h14v5M3 12h2m3 0h2m3 0h2m3 0h3`}),sup:(0,X.jsx)(`path`,{d:`m4 8 8 10m0-10L4 18M16 4h4l-4 5h4`}),sub:(0,X.jsx)(`path`,{d:`m4 6 8 10m0-10L4 16M16 15h4l-4 5h4`}),lineSpacing:(0,X.jsx)(`path`,{d:`M10 6h10M10 12h10M10 18h10M5 4v16M3 6l2-2 2 2M3 18l2 2 2-2`}),plus:(0,X.jsx)(`path`,{d:`M12 5v14M5 12h14`}),minus:(0,X.jsx)(`path`,{d:`M5 12h14`}),fit:(0,X.jsx)(`path`,{d:`M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5`}),shape:(0,X.jsx)(`path`,{d:`M4 4h9v9H4zM17 11a4 4 0 1 1 0 8 4 4 0 0 1 0-8`}),textbox:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM8 9h8M12 9v7`}),slideAdd:(0,X.jsx)(`path`,{d:`M3 6h14v12H3zM20 8v6M17 11h6`}),copy:(0,X.jsx)(`path`,{d:`M8 8h12v12H8zM4 16V4h12`}),trash:(0,X.jsx)(`path`,{d:`M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13`}),play:(0,X.jsx)(`path`,{d:`M7 4l13 8-13 8z`}),front:(0,X.jsx)(`path`,{d:`M8 8h12v12H8zM4 4h10v3M4 4v10h3`}),back:(0,X.jsx)(`path`,{d:`M4 4h12v12H4zM20 8v12H8v-3`}),merge:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM9 12H4m16 0h-5m-6-3 3 3-3 3m6-6-3 3 3 3`}),borders:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM12 4v16M4 12h16`,strokeDasharray:`2 2`}),freeze:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM4 9h16M9 4v16`}),sum:(0,X.jsx)(`path`,{d:`M17 5H7l6 7-6 7h10`}),rowAdd:(0,X.jsx)(`path`,{d:`M4 4h16v6H4zM12 14v6M9 17h6`}),colAdd:(0,X.jsx)(`path`,{d:`M4 4h6v16H4zM14 12h6M17 9v6`}),sort:(0,X.jsx)(`path`,{d:`M7 4v16M4 17l3 3 3-3M14 6h6M14 12h4M14 18h2`}),up:(0,X.jsx)(`path`,{d:`m6 15 6-6 6 6`}),down:(0,X.jsx)(`path`,{d:`m6 9 6 6 6-6`}),chevron:(0,X.jsx)(`path`,{d:`m7 10 5 5 5-5`}),lineWeight:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{d:`M4 6h16`,strokeWidth:1}),(0,X.jsx)(`path`,{d:`M4 11h16`,strokeWidth:2.2}),(0,X.jsx)(`path`,{d:`M4 17.5h16`,strokeWidth:3.6})]}),rotate:(0,X.jsx)(`path`,{d:`M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7`}),rotateCcw:(0,X.jsx)(`path`,{d:`M4 11a8 8 0 1 1 2.3 5.7M4 4v7h7`}),flipH:(0,X.jsx)(`path`,{d:`M12 3v18M9 7 4 17h5zM15 7l5 10h-5z`}),flipV:(0,X.jsx)(`path`,{d:`M3 12h18M7 9 17 4v5zM7 15l10 5v-5z`}),alignObj:(0,X.jsx)(`path`,{d:`M4 3v18M8 7h12v4H8zM8 14h7v4H8z`}),currency:(0,X.jsx)(`path`,{d:`M12 3v18M16.5 7.5C16 5.9 14.3 5 12 5c-2.6 0-4.5 1.3-4.5 3.3 0 4.7 9 2.6 9 7.4 0 2-1.9 3.3-4.5 3.3-2.4 0-4.2-1-4.7-2.8`}),vTop:(0,X.jsx)(`path`,{d:`M5 4h14M12 20V8M8.5 11.5 12 8l3.5 3.5`}),vMiddle:(0,X.jsx)(`path`,{d:`M5 12h14M12 3v6M9.5 6.5 12 9l2.5-2.5M12 21v-6M9.5 17.5 12 15l2.5 2.5`}),vBottom:(0,X.jsx)(`path`,{d:`M5 20h14M12 4v12M8.5 12.5 12 16l3.5-3.5`}),rotNone:(0,X.jsx)(`path`,{d:`M5 17h14M7 14l3-8 3 8M8 11.5h4`}),rotUp:(0,X.jsx)(`path`,{d:`M5 19h14M6 15l9.5-9.5M9 6.5l4.5 7.5M8 10l4-.5`}),rotDown:(0,X.jsx)(`path`,{d:`M5 5h14M6 9l9.5 9.5M9 17.5l4.5-7.5M8 14l4 .5`}),rotStack:(0,X.jsx)(`path`,{d:`M9 4l2 5 2-5M9.6 6.5h2.8M9 11h4M11 11v4M9 15h4M9 17h3a1.5 1.5 0 0 1 0 3H9z`,strokeWidth:1.5}),rotUp90:(0,X.jsx)(`path`,{d:`M19 5v14M15 18l-8-3 8-3M12.5 13v4M7 7l2-2 2 2M9 5v6`}),rotDown90:(0,X.jsx)(`path`,{d:`M19 5v14M7 6l8 3-8 3M9.5 11V7M13 17l-2 2-2-2M11 19v-6`}),sortAZ:(0,X.jsx)(`path`,{d:`M7 4v16M4 17l3 3 3-3M13 11l2.5-7 2.5 7M13.7 9h3.6M13 14h5l-5 6h5`}),sortZA:(0,X.jsx)(`path`,{d:`M7 4v16M4 17l3 3 3-3M13 4h5l-5 6h5M13 20l2.5-7 2.5 7M13.7 18h3.6`}),gridlines:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM4 9.3h16M4 14.6h16M9.3 4v16M14.6 4v16`}),lineStyle:(0,X.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h3M10 18h4M17 18h3`,strokeWidth:2}),paint:(0,X.jsx)(`path`,{d:`M5 4h11v5H5zM16 6.5h3v5l-7 1.5v3M11 16h2v5h-2z`}),omega:(0,X.jsx)(`path`,{d:`M5 19h4v-2.5A6.5 6.5 0 1 1 15 16.5V19h4`}),outline:(0,X.jsx)(`path`,{d:`M4 6h.01M4 12h.01M4 18h.01M8 6h12M11 12h9M11 18h9`,strokeWidth:2}),imgOrig:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM8 15V9l-1.5 1.5M12 10h.01M12 14h.01M16.5 15V9L15 10.5`}),imgReplace:(0,X.jsx)(`path`,{d:`M4 5h10v8H4zM4 11l3-3 3 3 2-2 2 2M14 19h6v-6M20 19l-5-5M7 16v3h4`}),alt:(0,X.jsx)(`path`,{d:`M4 5h16v14H4zM7.5 15l2.5-6 2.5 6M8.3 13h3.4M15 9v6h2.5`}),cut:(0,X.jsx)(`path`,{d:`M6 6a2.5 2.5 0 1 0 0 .01M6 18a2.5 2.5 0 1 0 0 .01M8 7.5 19 18M8 16.5 19 6`}),paste:(0,X.jsx)(`path`,{d:`M9 4h6v3H9zM15 5h3v15H6V5h3`}),pastePlain:(0,X.jsx)(`path`,{d:`M9 4h6v3H9zM15 5h3v15H6V5h3M9 11h6M12 11v6`}),external:(0,X.jsx)(`path`,{d:`M14 4h6v6M20 4l-9 9M18 14v6H4V6h6`}),unlink:(0,X.jsx)(`path`,{d:`M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1M3 3l18 18`}),selectAll:(0,X.jsx)(`path`,{d:`M4 4h3M10 4h4M17 4h3v3M20 10v4M20 17v3h-3M14 20h-4M7 20H4v-3M4 14v-4M4 7V4M8 8h8v8H8z`}),hideShow:(0,X.jsx)(`path`,{d:`M3 3l18 18M10.6 6.1A10 10 0 0 1 12 6c6.5 0 10 6 10 6a17 17 0 0 1-3.1 3.8M6.6 7.6C3.8 9.3 2 12 2 12s3.5 6 10 6c1.6 0 3-.4 4.3-1`}),percent:(0,X.jsx)(`path`,{d:`M19 5 5 19M7.5 9.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4M16.5 18.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4`}),decLess:(0,X.jsx)(`path`,{d:`M3.5 16h.01M8 9.5a2.5 3.5 0 1 1 0 7 2.5 3.5 0 0 1 0-7M21 19h-7m0 0 2-2m-2 2 2 2`,strokeWidth:1.7}),decMore:(0,X.jsx)(`path`,{d:`M3.5 16h.01M8 9.5a2.5 3.5 0 1 1 0 7 2.5 3.5 0 0 1 0-7M14.5 9.5a2 3 0 1 1 0 6 2 3 0 0 1 0-6M13 19h8m0 0-2-2m2 2-2 2`,strokeWidth:1.7}),check:(0,X.jsx)(`path`,{d:`m5 12.5 4.5 4.5L19 7.5`,strokeWidth:2.2}),more:(0,X.jsx)(`path`,{d:`M12 5.5h.01M12 12h.01M12 18.5h.01`,strokeWidth:3.2}),bAll:(0,X.jsx)(`path`,{d:`M4 4h16v16H4zM12 4v16M4 12h16`}),bOuter:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 4h16v16H4z`})]}),bInner:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M12 4v16M4 12h16`})]}),bTop:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 4h16`,strokeWidth:2.2})]}),bBottom:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 20h16`,strokeWidth:2.2})]}),bLeft:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M4 4v16`,strokeWidth:2.2})]}),bRight:(0,X.jsxs)(X.Fragment,{children:[Xc,(0,X.jsx)(`path`,{d:`M20 4v16`,strokeWidth:2.2})]}),bNone:Xc,rect:(0,X.jsx)(`path`,{d:`M4 6h16v12H4z`}),roundRect:(0,X.jsx)(`path`,{d:`M8 6h8a4 4 0 0 1 4 4v4a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4v-4a4 4 0 0 1 4-4`}),ellipse:(0,X.jsx)(`path`,{d:`M12 6c4.4 0 8 2.7 8 6s-3.6 6-8 6-8-2.7-8-6 3.6-6 8-6`}),triangle:(0,X.jsx)(`path`,{d:`M12 5l8 14H4z`}),arrow:(0,X.jsx)(`path`,{d:`M4 10h9V6l7 6-7 6v-4H4z`}),star:(0,X.jsx)(`path`,{d:`m12 4 2.4 5 5.6.7-4.1 3.8 1.1 5.5-5-2.8-5 2.8 1.1-5.5L4 9.7 9.6 9z`}),line:(0,X.jsx)(`path`,{d:`M5 19 19 5`}),rowAbove:(0,X.jsx)(`path`,{d:`M4 12h16v8H4zM12 3v6M9 6h6`}),rowBelow:(0,X.jsx)(`path`,{d:`M4 4h16v8H4zM12 15v6M9 18h6`}),colLeft:(0,X.jsx)(`path`,{d:`M12 4h8v16h-8zM3 12h6M6 9v6`}),colRight:(0,X.jsx)(`path`,{d:`M4 4h8v16H4zM15 12h6M18 9v6`}),delRow:(0,X.jsx)(`path`,{d:`M4 8h16v8H4zM9 10.5l6 3m0-3-6 3`}),delCol:(0,X.jsx)(`path`,{d:`M8 4h8v16H8zM10.5 9l3 6m0-6-3 6`}),hide:(0,X.jsx)(`path`,{d:`M3 3l18 18M10.6 6.1A10 10 0 0 1 12 6c6.5 0 10 6 10 6a17 17 0 0 1-3.1 3.8M6.6 7.6C3.8 9.3 2 12 2 12s3.5 6 10 6c1.6 0 3-.4 4.3-1M9.9 9.9a3 3 0 0 0 4.2 4.2`}),file:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5`}),open:(0,X.jsx)(`path`,{d:`M4 19V6a1 1 0 0 1 1-1h4l2 2h7a1 1 0 0 1 1 1v2M4 19l2.6-7.2a1 1 0 0 1 .9-.8H20a1 1 0 0 1 1 1.3L18.6 19z`}),print:(0,X.jsx)(`path`,{d:`M7 9V4h10v5M7 17H5a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-2M7 14h10v6H7z`}),pdf:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5M8.5 16.5v-4h1.2a1.2 1.2 0 0 1 0 2.4H8.5M13 12.5v4h.8a1.6 1.6 0 0 0 1.6-1.6v-.8a1.6 1.6 0 0 0-1.6-1.6z`,strokeWidth:1.5}),html:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5M10 12l-2 2.5 2 2.5M14 12l2 2.5-2 2.5`}),doc:(0,X.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8zM14 3v5h5M9 13h6M9 17h4`}),slides:(0,X.jsx)(`path`,{d:`M4 5h16v11H4zM12 16v4M8 20h8`}),info:(0,X.jsx)(`path`,{d:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v5M12 8h.01`})};function Qc({name:e,size:t=18}){return(0,X.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:Zc[e]})}var $c=e=>e.preventDefault();function el(e){let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(0);return(0,u.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect(),i=document.documentElement.clientWidth;n.right>i-8?r(-Math.min(n.left-8,n.right-i+8)):n.left<8&&r(8-n.left)},[]),(0,X.jsx)(`div`,{ref:t,className:e.className??`de-tb-pop`,style:n?{transform:`translateX(${n}px)`}:void 0,onMouseDown:e.onMouseDown,children:e.children})}function tl(e,t,n){let r=(0,u.useRef)(n);r.current=n,(0,u.useEffect)(()=>{if(!t)return;let n=t=>{let n=e.current;n&&!t.composedPath().includes(n)&&r.current()};return window.addEventListener(`mousedown`,n,!0),()=>window.removeEventListener(`mousedown`,n,!0)},[t,e])}function Z(e){return(0,X.jsx)(`button`,{type:`button`,className:e.active?`de-tb de-tb-on`:`de-tb`,title:e.title,"aria-label":e.title,"aria-pressed":e.active,disabled:e.disabled,onMouseDown:$c,onClick:e.onClick,style:e.wide?{width:`auto`,padding:`0 8px`}:void 0,children:e.icon?(0,X.jsx)(Qc,{name:e.icon}):e.label})}var nl=()=>(0,X.jsx)(`span`,{className:`de-tb-sep`});function rl(e){let{options:t}=e,[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(-1),[o,s]=(0,u.useState)(0),c=(0,u.useRef)(null),l=(0,u.useRef)(null),d=(0,u.useRef)({text:``,at:0}),f=e.value!==void 0,p=f?t.findIndex(t=>t.value===e.value):-1,m=p>=0?t[p]:void 0;tl(c,n,()=>r(!1));let h=t=>{t&&!t.disabled&&(r(!1),e.onChange(t.value))},g=()=>{a(p>=0?p:t.findIndex(e=>!e.disabled)),s(0),r(!0)};(0,u.useEffect)(()=>{if(!n)return;let e=e=>{let n=t.length,o=(e,r)=>{let i=e;for(let e=0;e<n;e++)if(i=(i+r+n)%n,!t[i].disabled)return i;return e};if(e.key===`ArrowDown`)a(e=>o(e,1));else if(e.key===`ArrowUp`)a(e=>o(e<0?0:e,-1));else if(e.key===`Home`)a(o(-1,1));else if(e.key===`End`)a(o(0,-1));else if(e.key===`Enter`||e.key===` `&&!d.current.text)h(t[i]);else if(e.key===`Escape`)r(!1);else if(e.key===`Tab`)return r(!1);else if(e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let n=d.current;n.text=(Date.now()-n.at<700?n.text:``)+e.key.toLowerCase(),n.at=Date.now();let r=t.findIndex(e=>!e.disabled&&e.label.toLowerCase().startsWith(n.text));r>=0&&a(r)}else return;e.preventDefault(),e.stopPropagation()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n,i,t]),(0,u.useLayoutEffect)(()=>{let e=l.current;if(!n||!e)return;let t=e.getBoundingClientRect(),r=document.documentElement.clientWidth;t.right>r-8?s(e=>e-(t.right-r+8)):t.left<8&&s(e=>e+(8-t.left));let i=e.closest(`.de-root`),a=Math.min(document.documentElement.clientHeight,i?i.getBoundingClientRect().bottom:1/0),o=parseFloat(getComputedStyle(e).maxHeight),c=a-t.top-8;c>0&&(e.style.maxHeight=`${Math.max(120,Math.min(Number.isFinite(o)?o:c,c))}px`)},[n]),(0,u.useLayoutEffect)(()=>{n&&l.current?.querySelector(`[data-i="${i}"]`)?.scrollIntoView({block:`nearest`})},[n,i]);let _=e.label===void 0?m?.label??e.placeholder??``:e.label;return(0,X.jsxs)(`span`,{ref:c,className:`de-dd-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:(n?`de-dd de-dd-open`:`de-dd`)+(e.className?` `+e.className:``),style:{width:e.width},title:e.title,"aria-label":e.title,"aria-haspopup":`listbox`,"aria-expanded":n,disabled:e.disabled,onMouseDown:$c,onClick:()=>n?r(!1):g(),onKeyDown:e=>{n||e.key!==`ArrowDown`&&e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),g())},children:[e.icon&&(0,X.jsx)(Qc,{name:e.icon}),_!==null&&(0,X.jsx)(`span`,{className:m||e.label!==void 0?`de-dd-label`:`de-dd-label de-dd-ph`,children:_}),(0,X.jsx)(Qc,{name:`chevron`,size:14})]}),n&&(0,X.jsx)(`div`,{ref:l,className:`de-dd-pop`,role:`listbox`,"aria-label":e.title,style:{minWidth:e.menuWidth,...e.alignRight?{right:-o}:{left:o}},onMouseDown:$c,children:t.map((e,t)=>(0,X.jsxs)(u.Fragment,{children:[e.sep&&t>0&&(0,X.jsx)(`div`,{className:`de-dd-sep`,role:`separator`}),e.head&&(0,X.jsx)(`div`,{className:`de-dd-head`,role:`presentation`,children:e.head}),(0,X.jsxs)(`div`,{"data-i":t,role:`option`,"aria-selected":t===p,"aria-disabled":e.disabled||void 0,className:`de-dd-opt`+(t===i?` de-dd-hi`:``)+(e.disabled?` de-dd-dis`:``),onMouseMove:()=>t!==i&&!e.disabled&&a(t),onClick:()=>h(e),children:[f&&(0,X.jsx)(`span`,{className:`de-dd-check`,children:t===p&&(0,X.jsx)(Qc,{name:`check`,size:16})}),e.icon&&(0,X.jsx)(Qc,{name:e.icon}),(0,X.jsx)(`span`,{className:`de-dd-text`,style:e.style,children:e.label}),e.hint&&(0,X.jsx)(`span`,{className:`de-dd-hint`,children:e.hint})]})]},String(e.value)))})]})}function il(e){return(0,X.jsx)(rl,{...e})}function al(e){let t=e.sizes??bl,[n,r]=(0,u.useState)(null),[i,a]=(0,u.useState)(!1),o=(0,u.useRef)(null),s=(0,u.useRef)(null);tl(o,i,()=>a(!1));let c=e.value??e.placeholder??11,l=t=>{r(null),a(!1),Number.isFinite(t)&&t>=1&&t<=400&&e.onChange(Math.round(t*2)/2)},d=()=>{n!==null&&l(parseFloat(n)),s.current?.blur()},f=e.title??`Font size`;return(0,X.jsxs)(`span`,{ref:o,className:`de-size`,children:[(0,X.jsx)(`button`,{type:`button`,className:`de-tb de-size-step`,title:`Decrease font size`,"aria-label":`Decrease font size`,disabled:e.disabled,onMouseDown:$c,onClick:()=>l(Math.max(1,Math.ceil(c)-1)),children:(0,X.jsx)(Qc,{name:`minus`,size:16})}),(0,X.jsx)(`input`,{ref:s,className:`de-size-input`,title:f,"aria-label":f,inputMode:`decimal`,disabled:e.disabled,value:n??(e.value===void 0?``:String(e.value)),placeholder:e.placeholder===void 0?``:String(e.placeholder),onFocus:e=>{e.currentTarget.select(),a(!0)},onChange:e=>r(e.target.value.replace(/[^\d.]/g,``)),onKeyDown:e=>{if(e.key===`Enter`)e.preventDefault(),d();else if(e.key===`Escape`)e.preventDefault(),r(null),a(!1),s.current?.blur();else if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let i=parseFloat(n??String(c)),a=e.key===`ArrowUp`?t.find(e=>e>i):[...t].reverse().find(e=>e<i);a!==void 0&&r(String(a))}},onBlur:()=>{n!==null&&l(parseFloat(n)),a(!1)}}),(0,X.jsx)(`button`,{type:`button`,className:`de-tb de-size-step`,title:`Increase font size`,"aria-label":`Increase font size`,disabled:e.disabled,onMouseDown:$c,onClick:()=>l(Math.floor(c)+1),children:(0,X.jsx)(Qc,{name:`plus`,size:16})}),i&&(0,X.jsx)(`div`,{className:`de-dd-pop de-size-pop`,role:`listbox`,"aria-label":f,onMouseDown:$c,children:t.map(t=>(0,X.jsx)(`div`,{role:`option`,"aria-selected":t===e.value,className:`de-dd-opt`+(String(t)===(n??String(e.value))?` de-dd-hi`:``),onClick:()=>l(t),children:t},t))})]})}function ol(e){let t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&(e.type===u.Fragment?t.push(...ol(e.props.children)):t.push(e))}),t}var sl=e=>{let t=e.props;return`${typeof e.type==`string`?e.type:e.type.name}:${t.title??t.icon??(typeof t.label==`string`?t.label:``)}`};function cl({children:e}){let t=ol(e),n=t.map(sl).join(`|`),r=(0,u.useRef)(null),i=(0,u.useRef)([]),[a,o]=(0,u.useState)({sig:``,cut:t.length,w:0}),[s,c]=(0,u.useState)(!1),l=(0,u.useRef)(null);tl(l,s,()=>c(!1));let d=a.sig===n,f=d?a.cut:t.length,p=e=>{let r=i.current,a=r.reduce((e,t)=>e+t+2,0),s=t.length;if(a>e){let n=e-34,i=0;for(s=0;s<t.length&&i+r[s]+2<=n;)i+=r[s++]+2}o(t=>t.sig===n&&t.cut===s&&t.w===e?t:{sig:n,cut:s,w:e})},m=()=>{let e=r.current;if(!e)return 0;let t=getComputedStyle(e);return e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)};(0,u.useLayoutEffect)(()=>{let e=r.current;e&&!d&&(i.current=[...e.querySelectorAll(`:scope > [data-i]`)].map(e=>e.getBoundingClientRect().width),p(m()))});let h=(0,u.useRef)(()=>{});h.current=()=>{i.current.length===t.length&&p(m())},(0,u.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(()=>h.current());return t.observe(e),()=>t.disconnect()},[]);let g=e=>!!e&&e.type===nl,_=f;for(;_>0&&g(t[_-1])&&_<t.length;)_--;let v=t.slice(f).filter((e,t,n)=>!g(e)||t!==0&&t!==n.length-1);return(0,X.jsxs)(`div`,{ref:r,className:`de-ebar`,role:`toolbar`,children:[t.slice(0,_).map((e,t)=>(0,X.jsx)(`span`,{"data-i":t,className:`de-ebar-it`,children:e},t)),v.length>0&&(0,X.jsxs)(`span`,{ref:l,className:`de-tb-color de-ebar-morewrap`,children:[(0,X.jsx)(`button`,{type:`button`,className:s?`de-tb de-tb-on`:`de-tb`,title:`More`,"aria-label":`More tools`,"aria-expanded":s,onMouseDown:$c,onClick:()=>c(e=>!e),children:(0,X.jsx)(Qc,{name:`more`})}),s&&(0,X.jsx)(el,{className:`de-tb-pop de-ebar-more`,children:v.map((e,t)=>(0,X.jsx)(`span`,{className:`de-ebar-it`,children:e},t))})]})]})}var ll=`#000000.#434343.#666666.#999999.#b7b7b7.#cccccc.#d9d9d9.#ffffff.#980000.#ff0000.#ff9900.#ffff00.#00ff00.#00ffff.#4a86e8.#0000ff.#9900ff.#ff00ff.#e6b8af.#f4cccc.#fce5cd.#fff2cc.#d9ead3.#d0e0e3.#c9daf8.#cfe2f3.#d9d2e9.#ead1dc.#cc4125.#e06666.#f6b26b.#ffd966.#93c47d.#76a5af.#6d9eeb.#6fa8dc.#8e7cc3.#c27ba0.#1155cc.#38761d`.split(`.`),ul=`office-engine:custom-colors`,dl=7,fl=/^#[0-9a-f]{6}$/,pl=null,ml=new Set;function hl(){if(pl)return pl;pl=[];try{let e=JSON.parse(localStorage.getItem(ul)??`[]`);Array.isArray(e)&&(pl=e.filter(e=>typeof e==`string`&&fl.test(e)).slice(0,dl))}catch{}return pl}function gl(e){pl=[e,...hl().filter(t=>t!==e)].slice(0,dl);try{localStorage.setItem(ul,JSON.stringify(pl))}catch{}ml.forEach(e=>e())}var _l=e=>(ml.add(e),()=>{ml.delete(e)});function vl(e){let[t,n]=(0,u.useState)(!1),r=(0,u.useRef)(null),i=(0,u.useRef)(null),a=(0,u.useSyncExternalStore)(_l,hl,hl);tl(r,t,()=>n(!1));let o=(0,u.useRef)(e.onPick);o.current=e.onPick;let s=e.value?.toLowerCase();(0,u.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>{let t=e.value.toLowerCase();fl.test(t)&&(gl(t),o.current(t))};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let c=()=>{let e=i.current;if(e){e.value=s&&fl.test(s)?s:a[0]??`#000000`,n(!1);try{e.showPicker()}catch{e.click()}}},l=t=>(0,X.jsx)(`button`,{type:`button`,title:t,className:s===t?`on`:void 0,style:{background:t},onClick:()=>(e.onPick(t),n(!1))},t);return(0,X.jsxs)(`span`,{ref:r,className:`de-tb-color`,children:[(0,X.jsxs)(`button`,{type:`button`,className:t?`de-tb de-tb-on`:`de-tb`,title:e.title,"aria-label":e.title,"aria-expanded":t,onMouseDown:$c,onClick:()=>n(e=>!e),children:[(0,X.jsx)(Qc,{name:e.icon}),(0,X.jsx)(`span`,{className:`de-tb-swatch`,style:{background:e.value??`transparent`}})]}),(0,X.jsx)(`input`,{ref:i,type:`color`,className:`de-tb-native`,tabIndex:-1,"aria-hidden":!0}),t&&(0,X.jsxs)(el,{onMouseDown:$c,children:[(0,X.jsx)(`button`,{type:`button`,className:`de-tb-none`,onClick:()=>(e.onPick(null),n(!1)),children:e.noneLabel??`None`}),(0,X.jsx)(`div`,{className:`de-tb-grid`,children:(e.palette??ll).map(l)}),(0,X.jsx)(`div`,{className:`de-tb-custom`,children:`Custom`}),(0,X.jsxs)(`div`,{className:`de-tb-grid`,children:[a.map(l),(0,X.jsx)(`button`,{type:`button`,className:`de-tb-add`,title:`Custom color…`,"aria-label":`Custom color`,onClick:c,children:(0,X.jsx)(Qc,{name:`plus`,size:14})})]})]})]})}var yl=[`Arial`,`Calibri`,`Cambria`,`Courier New`,`Georgia`,`Helvetica`,`Segoe UI`,`Tahoma`,`Times New Roman`,`Verdana`],bl=[8,9,10,10.5,11,12,14,16,18,20,24,28,32,36,40,48,60,72];function xl(e){let t=e&&!yl.includes(e)?[e,...yl]:yl;return t.map((e,n)=>({value:e,label:e,style:{fontFamily:`"${e}", system-ui, sans-serif`},sep:n===1&&t!==yl}))}function Sl(e){if(!e)return``;let t=/^\s*"?([^",]+)"?/.exec(e);return t?t[1]:``}function Cl(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}function wl(e){return(0,X.jsx)(rl,{title:e.title,label:e.label.replace(/\s*▾$/,``),icon:e.icon,options:e.items,onChange:e.onPick})}function Tl(e){let[t,n]=(0,u.useState)(!1),r=(0,u.useRef)(null);return tl(r,t,()=>n(!1)),(0,X.jsxs)(`span`,{ref:r,className:`de-tb-color`,children:[(0,X.jsxs)(`button`,{type:`button`,className:(e.active||t?`de-tb de-tb-on`:`de-tb`)+(e.chevron?` de-tb-chev`:``),title:e.title,"aria-label":e.title,"aria-expanded":t,disabled:e.disabled,onMouseDown:$c,onClick:()=>n(e=>!e),children:[(0,X.jsx)(Qc,{name:e.icon}),e.chevron&&(0,X.jsx)(Qc,{name:`chevron`,size:14})]}),t&&(0,X.jsx)(el,{onMouseDown:e=>e.target.closest(`input, textarea`)||e.preventDefault(),children:e.children(()=>n(!1))})]})}function El({onPick:e}){let[t,n]=(0,u.useState)([0,0]);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`de-gridpick`,onMouseLeave:()=>n([0,0]),children:Array.from({length:64},(r,i)=>{let a=Math.floor(i/8)+1,o=i%8+1;return(0,X.jsx)(`button`,{type:`button`,className:a<=t[0]&&o<=t[1]?`on`:``,onMouseEnter:()=>n([a,o]),onMouseDown:$c,onClick:()=>e(a,o)},i)})}),(0,X.jsx)(`div`,{className:`de-gridpick-label`,children:t[0]?`${t[0]} × ${t[1]}`:`Table size`})]})}function Dl(e=`image/*`,t=!0){return new Promise(n=>{let r=document.createElement(`input`);r.type=`file`,r.accept=e,r.multiple=t,r.onchange=()=>n(Array.from(r.files??[])),r.click()})}var Ol=(0,u.createContext)({bar:null,editable:!1,setDirty:()=>{},save:async()=>{},canDownload:!0,client:null,fileOps:{current:null}}),kl=()=>(0,u.useContext)(Ol);function Al(e){let t=kl().fileOps;(0,u.useEffect)(()=>{t.current=e}),(0,u.useEffect)(()=>()=>{t.current=null},[t])}function jl({children:e}){let{bar:t}=kl();return t?(0,gr.createPortal)((0,X.jsx)(cl,{children:e}),t):null}var Ml=(0,u.createContext)(null);function Nl({text:e,onStatus:t}){let n=(0,u.useContext)(Ml);return(0,u.useEffect)(()=>{t?.(e)},[e,t]),n?(0,gr.createPortal)(e,n):null}var Pl=[.25,.33,.5,.67,.75,.9,1,1.1,1.25,1.5,1.75,2,2.5,3];function Fl({zoom:e,effective:t,onChange:n}){let r=e=>{let r=t,i=e>0?Pl.find(e=>e>r+.001):[...Pl].reverse().find(e=>e<r-.001);i&&n(i)};return(0,X.jsxs)(`div`,{className:`de-zoom`,role:`group`,"aria-label":`Zoom`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,onClick:()=>r(-1),children:`−`}),(0,X.jsx)(`span`,{title:e===`fit`?`Fit width (click for 100%)`:`Click to fit width`,onClick:()=>n(e===`fit`?1:`fit`),children:e===`fit`?`Fit`:`${Math.round(t*100)}%`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,onClick:()=>r(1),children:`+`})]})}function Il({x:e,y:t,items:n,onClose:r}){let i=(0,u.useRef)(null),[a,o]=(0,u.useState)({left:e,top:t}),[s,c]=(0,u.useState)(-1),l=(0,u.useRef)(r);return l.current=r,(0,u.useLayoutEffect)(()=>{let n=i.current;if(!n)return;let r=n.getBoundingClientRect(),a=document.documentElement.clientWidth,s=document.documentElement.clientHeight;o({left:e+r.width>a-4?Math.max(4,e-r.width):e,top:t+r.height>s-4?Math.max(4,Math.min(t-r.height,s-r.height-4)):t})},[e,t]),(0,u.useEffect)(()=>{let e=e=>{i.current&&!e.composedPath().includes(i.current)&&l.current()},t=e=>{let t=n.length,r=(e,r)=>{let i=e;for(let e=0;e<t;e++)if(i=(i+r+t)%t,!n[i].disabled)return i;return e};if(e.key===`Escape`)l.current();else if(e.key===`ArrowDown`)c(e=>r(e,1));else if(e.key===`ArrowUp`)c(e=>r(e<0?0:e,-1));else if(e.key===`Enter`&&s>=0&&!n[s].disabled)l.current(),n[s].run();else return;e.preventDefault(),e.stopPropagation()},r=()=>l.current();return window.addEventListener(`mousedown`,e,!0),window.addEventListener(`keydown`,t,!0),window.addEventListener(`blur`,r),window.addEventListener(`resize`,r),()=>{window.removeEventListener(`mousedown`,e,!0),window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`blur`,r),window.removeEventListener(`resize`,r)}},[n,s]),(0,X.jsx)(`div`,{ref:i,className:`de-ctx`,style:a,role:`menu`,onMouseDown:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),children:n.map((e,t)=>(0,X.jsxs)(`div`,{className:`de-ctx-row`,children:[e.sep&&t>0&&(0,X.jsx)(`div`,{className:`de-ctx-sep`,role:`separator`}),e.head&&(0,X.jsx)(`div`,{className:`de-ctx-head`,children:e.head}),(0,X.jsxs)(`button`,{type:`button`,role:`menuitem`,className:t===s?`de-ctx-hi`:void 0,disabled:e.disabled,onMouseEnter:()=>c(t),onClick:()=>{l.current(),e.run()},children:[(0,X.jsx)(`span`,{className:`de-ctx-icon`,children:e.icon&&(0,X.jsx)(Qc,{name:e.icon,size:16})}),(0,X.jsx)(`span`,{className:`de-ctx-label`,children:e.label}),e.hint&&(0,X.jsx)(`span`,{className:`de-ctx-hint`,children:e.hint})]})]},t))})}var Q=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl+`;function Ll({spec:e,onClose:t}){let[n,r]=(0,u.useState)(e.initial??``),i=(0,u.useRef)(null);(0,u.useEffect)(()=>{let e=i.current;e?.focus(),e?.select()},[]);let a=()=>{t(),e.onOk(n)};return(0,X.jsx)(`div`,{className:`de-dialog-back`,onMouseDown:e=>e.target===e.currentTarget&&t(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),t())},children:(0,X.jsxs)(`form`,{className:`de-dialog`,role:`dialog`,"aria-label":e.title,onSubmit:e=>{e.preventDefault(),a()},children:[(0,X.jsx)(`div`,{className:`de-dialog-title`,children:e.title}),e.label&&(0,X.jsx)(`label`,{className:`de-dialog-label`,children:e.label}),e.area?(0,X.jsx)(`textarea`,{ref:i,rows:3,value:n,placeholder:e.placeholder,onChange:e=>r(e.target.value)}):(0,X.jsx)(`input`,{ref:i,value:n,placeholder:e.placeholder,onChange:e=>r(e.target.value)}),e.note&&(0,X.jsx)(`div`,{className:`de-dialog-note`,children:e.note}),(0,X.jsxs)(`div`,{className:`de-dialog-btns`,children:[e.extra&&(0,X.jsx)(`button`,{type:`button`,className:`de-btn de-dialog-extra`,onClick:()=>{t(),e.extra.run()},children:e.extra.label}),(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,onClick:t,children:`Cancel`}),(0,X.jsx)(`button`,{type:`submit`,className:`de-btn de-btn-primary`,children:e.ok??`OK`})]})]})})}function Rl(e){let t=(0,u.useRef)(null);return(0,u.useEffect)(()=>t.current?.focus(),[]),(0,X.jsx)(`div`,{className:`de-dialog-back`,onMouseDown:t=>t.target===t.currentTarget&&e.onClose(),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onClose())},children:(0,X.jsxs)(`div`,{className:`de-dialog`,role:`alertdialog`,"aria-label":e.title,children:[(0,X.jsx)(`div`,{className:`de-dialog-title`,children:e.title}),(0,X.jsx)(`div`,{className:`de-dialog-note`,children:e.message}),(0,X.jsxs)(`div`,{className:`de-dialog-btns`,children:[(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,onClick:e.onClose,children:`Cancel`}),(0,X.jsx)(`button`,{ref:t,type:`button`,className:`de-btn de-btn-primary`,onClick:()=>{e.onClose(),e.onOk()},children:e.ok})]})]})})}function zl({text:e,onDone:t}){return(0,u.useEffect)(()=>{let e=setTimeout(t,3500);return()=>clearTimeout(e)},[e,t]),(0,X.jsx)(`div`,{className:`de-toast`,role:`status`,children:e})}var Bl=e=>e.t===`text`?e.text.length:1,Vl=e=>e.reduce((e,t)=>e+Bl(t),0),Hl=e=>e.a.pa===e.f.pa&&e.a.o===e.f.o,Ul=(e,t)=>e.replace(/(\d+)$/,e=>String(Number(e)+t));function Wl(e){return e.map(e=>e.t===`text`?e.text:``).join(``)}function Gl(e,t){if(e===t)return!0;if(!e||!t)return!e&&!t;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}var Kl=(e,t)=>e.t===`text`&&t.t===`text`&&e.href===t.href&&e.lk===t.lk&&Gl(e.s,t.s)&&Gl(e.d,t.d);function ql(e){let t=[];for(let n of e){if(n.t===`text`&&!n.text)continue;let e=t[t.length-1];e&&Kl(e,n)?t[t.length-1]={...e,text:e.text+n.text}:t.push(n)}return t}function Jl(e,t){let n=[],r=[],i=0;for(let a of e){let e=Bl(a);if(i+e<=t)n.push(a);else if(i>=t)r.push(a);else{let e=t-i;n.push({...a,text:a.text.slice(0,e)}),r.push({...a,text:a.text.slice(e)})}i+=e}return[n,r]}function Yl(e,t){let[n,r]=Jl(e,t);for(let e=n.length-1;e>=0;e--)if(n[e].t===`text`)return n[e];return r.find(e=>e.t===`text`)}function Xl(e,t,n,r,i){if(!n)return e;let[a,o]=Jl(e,t),s=Yl(e,t),c={t:`text`,...s??i??{},...r??{},text:n};return r?.s&&s?.s&&(c.s={...s.s,...r.s}),(r?.d||s?.d)&&(c.d={...s?.d??{},...r?.d??{}}),c.d&&!Object.keys(c.d).length&&delete c.d,ql([...a,c,...o])}function Zl(e,t,n){return n<=t?e:ql([...Jl(e,t)[0],...Jl(e,n)[1]])}function Ql(e,t,n,r,i){let[a,o]=Jl(e,t),[s,c]=Jl(o,n-t),l=s.map(e=>e.t===`text`?{...e,s:{...e.s??{},...r},d:{...e.d??{},...i}}:e);return ql([...a,...l,...c])}function $l(e,t){if(t<=0)return 0;let n=Intl.Segmenter;if(n){let r=0;for(let i of new n(void 0,{granularity:`grapheme`}).segment(e.slice(0,t)))r=i.index;return r}let r=e.charCodeAt(t-1);return r>=56320&&r<=57343&&t>=2?t-2:t-1}function eu(e,t){if(t>=e.length)return e.length;let n=Intl.Segmenter;if(n)for(let r of new n(void 0,{granularity:`grapheme`}).segment(e.slice(t)))return t+r.segment.length;let r=e.charCodeAt(t);return r>=55296&&r<=56319?t+2:t+1}function tu(e,t){let n=e.cmp(t.a.pa,t.f.pa);return n<0||n===0&&t.a.o<=t.f.o?[t.a,t.f]:[t.f,t.a]}var nu=e=>({a:e,f:e}),ru=(e,t)=>e.a.pa===t.a.pa&&e.a.o===t.a.o&&e.f.pa===t.f.pa&&e.f.o===t.f.o;function iu(e,t){let[n,r]=tu(e,t);if(n.pa===r.pa){let t=e.para(n.pa);return t?{pas:[n.pa],paras:[e.withRuns(t,Zl(t.runs,n.o,r.o))],at:n}:null}let i=e.span(n.pa,r.pa);if(!i){let t=e.deleteAcross?.(n,r),i=t&&e.para(t.pa);return t&&i?{pas:[t.pa],paras:[i],at:t,applied:!0}:null}let a=e.para(i[0]),o=e.para(i[i.length-1]),s=ql([...Jl(a.runs,n.o)[0],...Jl(o.runs,r.o)[1]]);return{pas:i,paras:[e.join(a,o,s)],at:n}}function au(e,t,n){let r=iu(e,t);r&&!r.applied&&e.replace(r.pas,r.paras,nu(r.at),n)}function ou(e,t){if(!Hl(t))return iu(e,t);let n=e.para(t.a.pa);return n?{pas:[t.a.pa],paras:[n],at:t.a}:null}function su(e,t,n,r={},i){let a=ou(e,t);if(!a)return;let o=a.paras[0],s=a.at.o,[c,l]=Jl(o.runs,s),u=Yl(o.runs,s)??e.defaultRun?.(o),d=e=>e.map(e=>e.t===`text`&&!e.s&&u?{...u,...e,s:u.s,src:u.src}:e);if(n.length===1){let t=d(n[0]),i=ql([...c,...t,...l]);e.replace(a.pas,[e.withRuns(o,i)],nu({pa:a.at.pa,o:s+Vl(t)}),{label:`paste`,...r});return}let f=[],p=e.withRuns(o,ql([...c,...d(n[0])]));i?.[0]&&(p=i[0](p));for(let t=1;t<n.length;t++){let r=t===n.length-1,a=d(n[t]),[o,s]=e.split(p,p.runs,ql([...a,...r?l:[]]),!r);f.push(o),p=i?.[t]?i[t](s):s}f.push(p),e.replace(a.pas,f,nu({pa:Ul(a.at.pa,f.length-1),o:Vl(d(n[n.length-1]))}),{label:`paste`,...r})}function cu(e,t,n,r){let i=ou(e,t);if(!i)return;let a=e.pendingStyle?.();e.clearPending?.();let o=i.paras[0],s=i.at.o,c=n.replace(/\r\n?/g,`
|
|
24
24
|
`).split(`
|
|
25
|
-
`);if(c.length===1||r?.label===`linebreak`){let t=Xl(o.runs,s,n,a,e.defaultRun?.(o));e.replace(i.pas,[e.withRuns(o,t)],nu({pa:i.at.pa,o:s+n.length}),{label:`type`,...r});return}let l=a?{...Yl(o.runs,s)??e.defaultRun?.(o)??{},...a}:void 0;
|
|
26
|
-
`,{label:`linebreak`});break;case`insertFromPaste`:case`insertFromDrop`:case`insertFromYank`:{if(e.dataTransfer&&i.pasteRich?.(t===`insertFromDrop`&&n?n:r,e.dataTransfer))break;let a=e.dataTransfer?.getData(`text/plain`)??e.data??``;a&&
|
|
27
|
-
`,t));continue}if(e.tagName===`TD`||e.tagName===`TH`){r&&r.runs.length&&r.runs.push(Tu(` `,t)),a(e,wu(e,t),n,o);continue}let c=wu(e,t);if(bu.has(e.tagName)){let t=e.tagName===`UL`?`bullet`:e.tagName===`OL`?`number`:n;if(e.tagName!==`UL`&&e.tagName!==`OL`&&e.tagName!==`TABLE`&&e.tagName!==`TBODY`&&e.tagName!==`THEAD`){let n=/^H([1-6])$/.exec(e.tagName);i({heading:n?Number(n[1]):void 0,list:e.tagName===`LI`?t??`bullet`:void 0})}a(e,c,t,o||e.tagName===`PRE`),r=null}else a(e,c,n,o)}};a(t.body,{},void 0,!1);for(let e of n){let t=e.runs[0];t?.t===`text`&&(t.text=t.text.replace(/^ +/,``));let n=e.runs[e.runs.length-1];n?.t===`text`&&(n.text=n.text.replace(/ +$/,``)),e.runs=e.runs.filter(e=>e.t!==`text`||e.text)}for(;n.length&&!n[0].runs.length;)n.shift();for(;n.length&&!n[n.length-1].runs.length;)n.pop();return n}function Du(e){let t=[],n=[];return e.rows.forEach((e,r)=>{let i=0;e.cells.forEach((e,a)=>{for(var o;t[r]?.[i];)i++;for(let n=r;n<r+Math.max(1,e.rowSpan);n++)for(let r=i;r<i+Math.max(1,e.colSpan);r++)(t[o=n]??(t[o]=[]))[r]=!0;n.push({ri:r,ci:a,g:i,cell:e}),i+=Math.max(1,e.colSpan)})}),{cells:n,nCols:Math.max(e.cols.length,...n.map(e=>e.g+e.cell.colSpan)),at:(e,t)=>n.find(n=>e>=n.ri&&e<n.ri+n.cell.rowSpan&&t>=n.g&&t<n.g+n.cell.colSpan)}}function Ou(e,t,n=1){return{...e,blocks:[t(e)],colSpan:n,rowSpan:1}}function ku(e,t){let n=e.reduce((e,t)=>e+t,0)||1;return e.map(e=>+(e*t/n).toFixed(2))}function Au(e,t,n,r){let{cells:i,nCols:a,at:o}=Du(e),s=n?t+1:t,c=e.rows.map(e=>({...e,cells:[...e.cells]})),l=[];for(let e=0;e<a;){let n=o(t,e);if(!n)e++;else{if(n.ri<s&&n.ri+n.cell.rowSpan>s){let e=c[n.ri];e.cells[n.ci]={...e.cells[n.ci],rowSpan:e.cells[n.ci].rowSpan+1}}else l.push(Ou(n.cell,r,n.cell.colSpan));e+=n.cell.colSpan}}let u={...e.rows[t],cells:l};return c.splice(s,0,u),{...e,rows:c}}function ju(e,t){if(e.rows.length<=1)return null;let{cells:n}=Du(e),r=e.rows.map(e=>({...e,cells:[...e.cells]}));for(let e of n)e.ri<t&&e.ri+e.cell.rowSpan>t&&(r[e.ri].cells[e.ci]={...r[e.ri].cells[e.ci],rowSpan:e.cell.rowSpan-1});return r.splice(t,1),{...e,rows:r}}function Mu(e,t,n,r){let{cells:i,nCols:a}=Du(e),o=n?t+1:t,s=e.rows.map(e=>({...e,cells:[...e.cells]})),c=e.cols.reduce((e,t)=>e+t,0);e.rows.forEach((e,t)=>{let n=i.filter(e=>e.ri===t),a=i.find(e=>e.ri<=t&&t<e.ri+e.cell.rowSpan&&e.g<o&&e.g+e.cell.colSpan>o);if(a){a.ri===t&&(s[t].cells[a.ci]={...s[t].cells[a.ci],colSpan:a.cell.colSpan+1});return}if(i.find(e=>e.ri<t&&t<e.ri+e.cell.rowSpan&&e.g+e.cell.colSpan===o)&&!n.length)return;let c=n.filter(e=>e.g<o).length,l=n[Math.max(0,c-1)]?.cell??n[0]?.cell;l&&s[t].cells.splice(c,0,Ou(l,r))});let l=[...e.cols.length?e.cols:Array(a).fill(c/Math.max(1,a))];return l.splice(o,0,l[Math.min(t,l.length-1)]??72),{...e,rows:s,cols:c?ku(l,c):l}}function Nu(e,t){let{cells:n,nCols:r}=Du(e);if(r<=1)return null;let i=e.rows.map(e=>({...e,cells:[...e.cells]})),a=new Set;for(let e of n)t<e.g||t>=e.g+e.cell.colSpan||(e.cell.colSpan>1?i[e.ri].cells[e.ci]={...i[e.ri].cells[e.ci],colSpan:e.cell.colSpan-1}:a.add(`${e.ri}:${e.ci}`));i.forEach((e,t)=>e.cells=e.cells.filter((e,n)=>!a.has(`${t}:${n}`)));let o=e.cols.reduce((e,t)=>e+t,0),s=[...e.cols];return s.splice(t,1),{...e,rows:i.filter(e=>e.cells.length),cols:o&&s.length?ku(s,o):s}}function Pu(e,t,n,r){let i=`0.5pt solid #000000`,a=+(n/t).toFixed(2);return{t:`tbl`,cols:Array(t).fill(a),rows:Array.from({length:e},()=>({cells:Array.from({length:t},()=>({blocks:[r()],colSpan:1,rowSpan:1,borders:{t:i,r:i,b:i,l:i},pad:[0,5.4,0,5.4]}))}))}}var Fu=e=>e.split(`.`).map(Number);function Iu(e,t,n){if(t===n)return e;let r=e=>e.replace(/\.?\d+$/,``),i=Number(n.split(`.`).pop())-Number(t.split(`.`).pop()),a=e=>r(e.pa)===r(t)?{...e,pa:r(n)?`${r(n)}.${Number(e.pa.split(`.`).pop())+i}`:String(Number(e.pa.split(`.`).pop())+i)}:e;return{a:a(e.a),f:a(e.f)}}var Lu=class{constructor(e,t,n){A(this,`client`,void 0),A(this,`st`,void 0),A(this,`changed`,void 0),A(this,`input`,void 0),A(this,`pendingSel`,null),A(this,`styles`,[]),A(this,`history`,[]),A(this,`future`,[]),A(this,`pend`,null),A(this,`nextPid`,1e9),A(this,`inflight`,0),A(this,`onState`,void 0),A(this,`onImage`,void 0),A(this,`onStyles`,void 0),A(this,`shortcut`,void 0),A(this,`onDirty`,void 0),A(this,`painter`,null),A(this,`onPainter`,void 0),A(this,`onCommit`,void 0),A(this,`contentW`,468),A(this,`defaultFont`,void 0),A(this,`defaultSz`,void 0),this.client=e,this.st=t,this.changed=n,this.input=new _u(this)}container(e){let t=Fu(e);if(t.length===1)return{list:this.st.blocks,at:t[0]};let n=this.st.blocks[t[0]];if(n?.t!==`tbl`)return;let r=n.rows[t[1]]?.cells[t[2]];return r?{list:r.blocks,at:t[3],cell:[t[0],t[1],t[2]]}:void 0}para(e){let t=this.container(e),n=t?.list[t.at];return n&&n.t===`p`&&n.pid!==void 0&&!n.ro?n:void 0}span(e,t){let n=Fu(e),r=Fu(t);if(n.length!==r.length||n.slice(0,-1).join(`.`)!==r.slice(0,-1).join(`.`))return null;let i=[];for(let t=n[n.length-1];t<=r[r.length-1];t++){let r=Ul(e,t-n[n.length-1]);if(!this.para(r))return null;i.push(r)}return i}prev(e){let t=Fu(e).pop(),n=Ul(e,-1);return t>0&&this.para(n)?n:void 0}next(e){let t=Ul(e,1);return this.para(t)?t:void 0}cmp(e,t){let n=Fu(e),r=Fu(t);for(let e=0;e<Math.min(n.length,r.length);e++)if(n[e]!==r[e])return n[e]-r[e];return n.length-r.length}withRuns(e,t){return{...e,runs:t,edited:!0}}origOf(e){return e.orig??(e.pid===(e.from??e.pid)?[e.pid]:[])}defaultRun(e){if(e.caret)return{...e.caret,text:``};let t=[...e.runs].reverse().find(e=>e.t===`text`);return t?{...t,text:``}:{t:`text`,s:{sz:e.markSz,font:e.markFont}}}split(e,t,n,r){let i=e.keepSect??e.pid===(e.from??e.pid),a={...e,runs:t,edited:!0,keepSect:!1},o={...e,runs:n,pid:this.nextPid++,from:e.from??e.pid,orig:[],edited:!0,keepSect:i,pb:!1,ver:0,caret:n.length?void 0:Yl(t,Vl(t))??e.caret};if(r){let t=this.styles.find(t=>t.id===e.sid)?.next;t&&t!==e.sid&&(o.pd={...o.pd??{},style:t},o.sid=t)}return[a,o]}join(e,t,n){return{...e,runs:n,edited:!0,orig:[...this.origOf(e),...this.origOf(t)],keepSect:(e.keepSect??e.pid===(e.from??e.pid))||(t.keepSect??t.pid===(t.from??t.pid))}}splice(e,t,n){let r=this.container(e);if(!r.cell)return this.st.blocks.splice(r.at,t,...n),this.st.blocks;let[i,a,o]=r.cell,s=this.st.blocks[i],c=[...r.list];c.splice(r.at,t,...n);let l={...s,rows:s.rows.map((e,t)=>t===a?{...e,cells:e.cells.map((e,t)=>t===o?{...e,blocks:c}:e)}:e)};return this.st.heights.set(l,this.st.heights.get(s)??0),this.st.dirty.add(l),this.st.blocks[i]=l,c}replace(e,t,n,r={}){let i=e.map(e=>this.para(e));if(i.some(e=>!e))return;r.remount&&(t=t.map(e=>({...e,ver:(e.ver??0)+1})));let a=this.container(e[0]),o=a.at,s=this.splice(e[0],e.length,t),c=i[i.length-1],l=t[t.length-1];if(l&&c.pid!==l.pid)for(let e=o+t.length;e<s.length;e++){let t=s[e];if(t.t!==`p`||t.pid!==c.pid||!t.pb)break;s[e]={...t,pid:l.pid,from:l.from??l.pid,edited:!0}}if(!a.cell){t.forEach((e,t)=>{this.st.heights.set(e,this.st.heights.get(i[t]??i[0])??0),this.st.dirty.add(e)});for(let e of[o-1,o+t.length])s[e]&&this.st.dirty.add(s[e]);o<this.st.frontier&&(this.st.frontier=Math.max(0,this.st.frontier+t.length-e.length))}if(r.history!==!1){let a=Date.now(),o=this.history[this.history.length-1],s=r.label??`edit`,c=this.input.lastSel??n;s===`type`&&o?.label===`type`&&e.length===1&&t.length===1&&o.after.length===1&&o.pas[0]===e[0]&&a-o.t<1500?(o.after=t,o.selAfter=n,o.t=a):(this.history.push({pas:e,before:i,after:t,selBefore:c,selAfter:n,label:s,t:a}),this.history.length>500&&this.history.shift()),this.future=[]}this.commit(e[0],i,t,r.want),this.onCommit?.({kind:`paras`,before:i,next:t}),this.pendingSel=n,this.onDirty?.(),this.changed(),this.emitState(n)}partsOf(e,t,n){let r=n;for(;r>0&&e[r-1].pid===t&&e[r-1].t===`p`;)r--;let i=[];for(;r<e.length&&e[r].t===`p`&&e[r].pid===t;r++)i.push(e[r]);return i}commit(e,t,n,r){let i=this.container(e);if(i.cell&&this.st.blocks[i.cell[0]].tid!==void 0){this.commitTable(i.cell[0]);return}let a=i.list,o=[];n.forEach(e=>e.pid!==void 0&&!o.includes(e.pid)&&o.push(e.pid));let s=o.map(e=>{let t=i.at+n.findIndex(t=>t.pid===e);return yu(this.partsOf(a,e,t))}),c=[];for(let e of t){if(e.pid===void 0||o.includes(e.pid)||c.includes(e.pid))continue;let t=a.findIndex(t=>t.t===`p`&&t.pid===e.pid);t>=0?s.push(yu(this.partsOf(a,e.pid,t))):c.push(e.pid)}let l=t[0].pid,u=r||n.some(e=>e.pd!==t.find(t=>t.pid===e.pid)?.pd),d=new Set(n),f={anchor:l,list:s,remove:c,want:u};this.inflight++,this.client.call(`docx.edit`,f).then(e=>this.applyResult(e,d)).catch(e=>console.error(`[office-engine] edit failed`,e)).finally(()=>this.inflight--)}get busy(){return this.inflight>0}locate(e){let t=[];return this.st.blocks.forEach((n,r)=>{n.t===`p`&&n.pid===e?t.push({list:this.st.blocks,index:r,pa:String(r)}):n.t===`tbl`&&n.rows.forEach((n,i)=>n.cells.forEach((n,a)=>n.blocks.forEach((o,s)=>{o.t===`p`&&o.pid===e&&t.push({list:n.blocks,index:s,pa:`${r}.${i}.${a}.${s}`})})))}),t}put(e,t){let n=this.container(e);if(!n)return;let r=n.list[n.at];this.splice(e,1,[t]),n.cell||(this.st.heights.set(t,this.st.heights.get(r)??0),this.st.dirty.add(t))}applyResult(e,t){if(this.input.isComposing)return;let n=!1;for(let[r,i]of Object.entries(e.blocks)){let e=this.locate(Number(r)),a=i.filter(e=>e.t===`p`);e.length&&a.length===e.length&&e.every(e=>t.has(e.list[e.index]))&&(e.forEach((e,t)=>{let n=e.list[e.index];this.put(e.pa,{...a[t],from:n.from,orig:n.orig,pd:n.pd,edited:n.edited,keepSect:n.keepSect,ver:n.ver,pb:n.pb})}),n=!0)}for(let[t,r]of Object.entries(e.markers))for(let e of this.locate(Number(t))){let t=e.list[e.index];e.list[e.index-1]?.pid!==t.pid&&(this.put(e.pa,{...t,marker:r?{text:r.text,s:r.s,tab:r.tab}:void 0,lst:r?.lst}),n=!0)}n&&this.changed()}whereNow(e,t){let n=e[0];if(!n)return t;if(n.t===`p`)return n.pid===void 0?void 0:this.locate(n.pid)[0]?.pa;if(n.t===`tbl`){let e=this.st.blocks.findIndex(e=>e.t===`tbl`&&(n.tid!==void 0&&e.tid===n.tid||n.item!==void 0&&e.item===n.item));return e>=0?String(e):void 0}return t}keepCurrent(e,t,n){let r=new Map(this.st.blocks.slice(t,t+n).flatMap(e=>e.t===`p`&&e.pid!==void 0?[[e.pid,e]]:[]));return e.map(e=>e.t===`p`&&e.pid!==void 0&&r.has(e.pid)?r.get(e.pid):e)}undo(){let e=this.history.pop();if(!e)return;if(e.blocks){let t=this.whereNow(e.blocks.after,String(e.blocks.bi));if(t===void 0)return;this.replaceBlocks(Number(t),e.blocks.after.length,this.keepCurrent(e.blocks.before,Number(t),e.blocks.after.length),e.selBefore,!1),this.future.push(e);return}let t=this.whereNow(e.after,e.pas[0]);if(t===void 0)return;let n=e.after.map((e,n)=>Ul(t,n));n.some((t,n)=>this.para(t)?.pid!==e.after[n].pid)||(this.replace(n.length?n:[t],e.before,Iu(e.selBefore,e.pas[0],t),{history:!1,label:`undo`,want:!0}),this.future.push(e))}redo(){let e=this.future.pop();if(!e)return;if(e.blocks){let t=this.whereNow(e.blocks.before,String(e.blocks.bi));if(t===void 0)return;this.replaceBlocks(Number(t),e.blocks.before.length,this.keepCurrent(e.blocks.after,Number(t),e.blocks.before.length),e.selAfter,!1),this.history.push(e);return}let t=this.whereNow(e.before,e.pas[0]);if(t===void 0)return;let n=e.before.map((e,n)=>Ul(t,n));n.some((t,n)=>this.para(t)?.pid!==e.before[n].pid)||(this.replace(n,e.after,Iu(e.selAfter,e.pas[0],t),{history:!1,label:`redo`,want:!0}),this.history.push(e))}get canUndo(){return this.history.length>0}get canRedo(){return this.future.length>0}pendingStyle(){return this.pend?{s:this.pend.s,d:this.pend.d}:void 0}clearPending(){this.pend=null}selectedParas(e){let[t,n]=tu(this,e),r=t.pa===n.pa?this.para(t.pa)?[t.pa]:null:this.span(t.pa,n.pa);return r?{pas:r,s:t,e:n}:null}format(e,t,n={}){let r=this.input.sel();if(!r)return;if(Hl(r)){this.pend={s:{...this.pend?.s??{},...e},d:{...this.pend?.d??{},...t},at:r.a},this.input.restore(r),this.emitState(r);return}let i=this.selectedParas(r);if(!i)return;let a=i.pas.map((n,r)=>{let a=this.para(n),o=r===0?i.s.o:0,s=r===i.pas.length-1?i.e.o:Vl(a.runs);return this.withRuns(a,Ql(a.runs,o,s,e,t))});this.replace(i.pas,a,r,{label:`format`,want:n.want})}toggle(e){let t=this.state(),n=!(t&&t[e]);e===`u`?this.format({u:n?`single`:`none`},{u:n?`single`:`none`}):this.format({[e]:n},{[e]:n})}setFont(e){this.format({font:$e(e)},{font:e})}setSize(e){this.format({sz:e},{sz:e})}setColor(e){this.format({color:e??void 0},{color:e})}setHighlight(e){this.format({hl:e??void 0,shd:void 0},{hl:e})}clearFormat(){this.format({b:!1,i:!1,u:`none`,strike:!1,hl:void 0},{b:!1,i:!1,u:`none`,strike:!1,color:null,hl:null,va:null},{want:!0})}setPara(e,t={},n=this.input.sel()){if(!n)return;let r=this.selectedParas(n);if(!r)return;let i=r.pas.map(n=>{let r=this.para(n),i={...r.pd??{},...e};return{...r,pd:i,ps:{...r.ps,...t},edited:!0,sid:e.style??r.sid}});this.replace(r.pas,i,n,{label:`para`,want:!0})}toggleList(e){let t=this.input.sel();if(!t)return;let n=this.selectedParas(t);if(!n)return;let r=n.pas.every(t=>this.para(t)?.lst===e);this.setPara({list:r?`none`:e,ilvl:r?void 0:0},{},t)}indent(e,t=this.input.sel()){if(!t)return;let n=this.selectedParas(t);if(!n)return;let r=n.pas.map(t=>{let n=this.para(t),r={...n.pd??{}};return n.lst?r.ilvl=Math.max(0,Math.min(8,(n.ilvl??0)+e)):r.indL=Math.max(0,(n.ps.indL??0)+e*36),{...n,pd:r,ps:n.lst?n.ps:{...n.ps,indL:r.indL},edited:!0}});this.replace(n.pas,r,t,{label:`para`,want:!0})}tab(e,t){if(e.f.pa.includes(`.`)){let[n,r,i]=e.f.pa.split(`.`).map(Number),a=this.st.blocks[n].rows.flatMap((e,t)=>e.cells.map((e,n)=>[t,n])),o=a.findIndex(([e,t])=>e===r&&t===i)+(t?-1:1);if(o>=a.length&&!t)return this.tableOp(`rowBelow`),!0;let[s,c]=a[Math.max(0,o)],l=`${n}.${s}.${c}.0`,u=this.para(l);return this.input.restore({a:{pa:l,o:0},f:{pa:l,o:u?Vl(u.runs):0}}),!0}return this.para(e.a.pa)?.lst?(this.indent(t?-1:1,e),!0):!1}backspaceAtStart(e,t){return t.lst?(this.setPara({list:`none`},{},{a:{pa:e,o:0},f:{pa:e,o:0}}),!0):!1}prevParaPid(e){for(let t=e-1;t>=0;t--){let e=this.st.blocks[t];if(e.t===`p`&&e.pid!==void 0)return e.pid}}tableSpec(e){return{tid:e.tid,item:e.item,cols:e.cols,rows:e.rows.map(e=>({src:e.src,cells:e.cells.map(e=>({src:e.src,colSpan:e.colSpan,rowSpan:e.rowSpan,paras:e.blocks.filter(e=>e.t===`p`&&e.pid!==void 0).map(e=>yu([e]))}))}))}}commitTable(e){let t=this.st.blocks[e];t?.t===`tbl`&&t.tid!==void 0&&this.send(`docx.table`,{tid:t.tid,item:t.item,anchor:t.item===void 0?this.prevParaPid(e):void 0,spec:this.tableSpec(t)})}send(e,t){this.inflight++,this.client.call(e,t).then(t=>e===`docx.edit`&&this.applyResult(t,new Set)).catch(e=>console.error(`[office-engine] edit failed`,e)).finally(()=>this.inflight--)}replaceBlocks(e,t,n,r,i=!0){let a=this.st.blocks.slice(e,e+t);this.st.blocks.splice(e,t,...n),n.forEach((e,t)=>{this.st.heights.set(e,this.st.heights.get(a[t]??a[0])??0),this.st.dirty.add(e)}),e<this.st.frontier&&(this.st.frontier=Math.max(0,this.st.frontier+n.length-t));let o=e=>e.t===`tbl`?`t${e.tid??`i`+e.item}`:e.t===`p`?`p${e.pid}`:``,s=new Set(n.map(o)),c=new Set(a.map(o)),l=[...a,...n].find(e=>e.t===`p`&&e.pid!==void 0&&c.has(o(e))&&s.has(o(e))),u=n.filter(e=>e.t===`p`&&e.pid!==void 0&&!c.has(o(e))),d=a.filter(e=>e.t===`p`&&e.pid!==void 0&&!s.has(o(e))),f=new Map(a.map(e=>[o(e),e])),p=n.some(e=>e.t===`p`&&e.pid!==void 0&&f.has(o(e))&&f.get(o(e))!==e);if(l&&(u.length||d.length||p)){let e=n.filter(e=>e.t===`p`&&e.pid!==void 0);this.send(`docx.edit`,{anchor:l.pid,list:e.map(e=>yu([e])),remove:d.map(e=>e.pid)})}for(let e of a)e.t!==`tbl`||s.has(o(e))||e.tid===void 0&&e.item===void 0||this.send(`docx.table`,{tid:e.tid??-1,item:e.item,spec:null});if(n.forEach((t,n)=>t.t===`tbl`&&t.tid!==void 0&&this.commitTable(e+n)),this.onCommit?.({kind:`blocks`,bi:e,before:a,next:n}),i){let t=r??this.input.lastSel??{a:{pa:String(e),o:0},f:{pa:String(e),o:0}};this.history.push({pas:[],before:[],after:[],blocks:{bi:e,before:a,after:n},selBefore:this.input.lastSel??t,selAfter:t,label:`table`,t:Date.now()}),this.future=[]}r&&(this.pendingSel=r),this.onDirty?.(),this.changed()}emptyPara(e){return{t:`p`,ps:{...e.ps,indFirst:void 0,indL:void 0},runs:[],markSz:e.markSz,markFont:e.markFont,pid:this.nextPid++,from:e.from??e.pid,orig:[],edited:!0,keepSect:!1,pd:{style:``,list:`none`},sid:void 0}}insertTable(e,t){let n=this.input.sel(),r=n?Number(n.f.pa.split(`.`)[0]):-1,i=this.st.blocks[r];if(!n||n.f.pa.includes(`.`)||i?.t!==`p`||i.pid===void 0)return;let a=[i,{...Pu(e,t,this.contentW,()=>this.emptyPara(i)),tid:this.nextPid++}],o=this.st.blocks[r+1];o&&o.t===`p`||a.push(this.emptyPara(i)),this.replaceBlocks(r,1,a,{a:{pa:`${r+1}.0.0.0`,o:0},f:{pa:`${r+1}.0.0.0`,o:0}})}tableOp(e){let t=this.input.sel();if(!t||!t.f.pa.includes(`.`))return;let[n,r,i]=t.f.pa.split(`.`).map(Number),a=this.st.blocks[n];if(a?.t!==`tbl`)return;let o=Du(a).cells.find(e=>e.ri===r&&e.ci===i)?.g??0,s=e=>{let t=e.blocks.find(e=>e.t===`p`)??this.st.blocks.find(e=>e.t===`p`&&e.pid!==void 0);return{...this.emptyPara(t),pd:{},ps:t.ps,sid:t.sid}},c=a,l=`${n}.${r}.${i}.0`;switch(e){case`rowAbove`:c=Au(a,r,!1,s),l=`${n}.${r}.0.0`;break;case`rowBelow`:c=Au(a,r,!0,s),l=`${n}.${r+1}.0.0`;break;case`colLeft`:c=Mu(a,o,!1,s);break;case`colRight`:c=Mu(a,o,!0,s),l=`${n}.${r}.${i+1}.0`;break;case`delRow`:c=ju(a,r),l=`${n}.${Math.max(0,Math.min(r,(c?.rows.length??1)-1))}.0.0`;break;case`delCol`:c=Nu(a,o),l=`${n}.${r}.${Math.max(0,i-1)}.0`;break;case`delTable`:c=null}if(c)c={...c,tid:a.tid??this.nextPid++},this.replaceBlocks(n,1,[c],{a:{pa:l,o:0},f:{pa:l,o:0}});else{let e=this.st.blocks[n+1];this.replaceBlocks(n,1,[],e?.t===`p`?{a:{pa:String(n),o:0},f:{pa:String(n),o:0}}:null)}}async insertImages(e,t){let n=t??this.input.sel();if(!n)return;let r=[];for(let t of e){let e=(t.type.split(`/`)[1]??`png`).replace(`svg+xml`,`svg`).replace(`jpeg`,`jpg`),{rid:n,path:i}=await this.client.call(`docx.image`,await t.arrayBuffer(),e),a=await Ru(t),o=Math.min(1,this.contentW/Math.max(1,a.w*.75));r.push({t:`img`,target:i,w:+(a.w*.75*o).toFixed(1),h:+(a.h*.75*o).toFixed(1),rid:n})}ou(this,n,[r],{label:`image`})}async setLink(e){let t=this.input.sel();if(!t)return;if(!e){this.patchRuns(t,e=>({...e,href:void 0,lk:void 0}));return}let n=/^[a-z][\w+.-]*:/i.test(e)||e.startsWith(`#`)?e:`https://`+e,r=await this.client.call(`docx.link`,n),i={color:`#0563c1`,u:`single`};Hl(t)?ou(this,t,[[{t:`text`,text:e,href:n,lk:r,s:{...Yl(this.para(t.a.pa)?.runs??[],t.a.o)?.s??{},...i},d:i}]],{label:`link`}):this.patchRuns(t,e=>({...e,href:n,lk:r,s:{...e.s??{},...i},d:{...e.d??{},...i}}))}patchRuns(e,t){let n=this.selectedParas(e);if(!n)return;let r=n.pas.map((e,r)=>{let i=this.para(e),a=r===0?n.s.o:0,o=r===n.pas.length-1?n.e.o:Vl(i.runs),[s,c]=Jl(i.runs,a),[l,u]=Jl(c,o-a);return this.withRuns(i,[...s,...l.map(e=>e.t===`text`?t(e):e),...u])});this.replace(n.pas,r,e,{label:`format`})}insertPageBreak(){let e=this.input.sel();if(!e)return;let t=this.para(e.f.pa);if(!t||e.f.pa.includes(`.`))return;let[n,r]=Jl(t.runs,e.f.o),[i,a]=this.split(t,n,r,!1),o={...a,pb:!0,pd:{...a.pd??{},pageBreak:!0}};this.replace([e.f.pa],[i,o],{a:{pa:Ul(e.f.pa,1),o:0},f:{pa:Ul(e.f.pa,1),o:0}},{label:`pagebreak`,want:!0})}resizeImage(e){let t=this.input.sel();if(!t)return;let[n]=tu(this,t);this.patchObjects(t,t=>{if(t.t!==`img`)return t;let n=e===`fit`?this.contentW/t.w:e;return{...t,w:+(t.w*n).toFixed(1),h:+(t.h*n).toFixed(1),resized:!0}}),this.pendingSel={a:n,f:{...n,o:n.o+1}}}patchObjects(e,t){let[n,r]=tu(this,e),i=this.para(n.pa);if(!i||n.pa!==r.pa)return;let[a,o]=Jl(i.runs,n.o),[s,c]=Jl(o,r.o-n.o);this.replace([n.pa],[this.withRuns(i,[...a,...s.map(t),...c])],e,{label:`image`})}pasteRich(e,t){let n=Array.from(t.files??[]).filter(e=>e.type.startsWith(`image/`));if(n.length)return this.insertImages(n,e),!0;let r=t.getData(`text/html`);if(!r)return!1;let i=Eu(r);return i.length?((async()=>{let t=new Map;for(let e of i)for(let n of e.runs)n.t===`text`&&n.href&&!t.has(n.href)&&t.set(n.href,await this.client.call(`docx.link`,n.href));let n=i.map(e=>e.runs.map(e=>e.t===`text`&&e.href?{...e,lk:t.get(e.href)}:e)),r=e=>this.styles.find(t=>t.name.toLowerCase()===`heading ${e}`)?.id,a=i.map(e=>{if(e.heading||e.list)return t=>{let n={...t.pd??{}},i=e.heading?r(e.heading):void 0;return i&&(n.style=i),e.list&&(n.list=e.list),{...t,pd:n,sid:i??t.sid,edited:!0}}});ou(this,e,n,{label:`paste`},a)})(),!0):!1}async applyCanon(e){let t=this.input.sel();if(!t)return;let n=this.styles.find(t=>t.canon===e)?.id;if(!n){let t=await this.client.call(`docx.style`,e);this.styles=t.styles,this.onStyles?.(t.styles),n=t.id}n&&this.setPara({style:n},{},t)}selectObject(e,t){let n={a:{pa:e,o:t},f:{pa:e,o:t+1}};this.input.restore(n),this.onSelection(n)}imageSel(){let e=this.input.sel(),t=e&&this.state(e)?.img;return t?{a:{pa:t.pa,o:t.o},f:{pa:t.pa,o:t.o+1}}:null}patchImage(e){let t=this.imageSel();t&&(this.patchObjects(t,t=>t.t===`img`?e(t):t),this.pendingSel=t)}setImageSize(e,t){this.patchImage(n=>({...n,w:+Math.max(4,e).toFixed(1),h:+Math.max(4,t).toFixed(1),resized:!0}))}imageOriginal(e,t){let n=Math.min(1,this.contentW/Math.max(1,e*.75));this.setImageSize(e*.75*n,t*.75*n)}setAltText(e){this.patchImage(t=>({...t,alt:e||void 0,altSet:!0}))}async replaceImage(e){let t=this.imageSel();if(!t)return;let n=(e.type.split(`/`)[1]??`png`).replace(`svg+xml`,`svg`).replace(`jpeg`,`jpg`),{rid:r,path:i}=await this.client.call(`docx.image`,await e.arrayBuffer(),n),a=await Ru(e);this.input.restore(t),this.patchImage(e=>{let t=+(e.w*(a.h/Math.max(1,a.w))).toFixed(1);return{...e,target:i,rid:r,repl:!!e.src,h:t,resized:!0}})}deleteSelection(){let e=this.input.sel();e&&!Hl(e)&&su(this,e,``)}insertText(e){let t=this.input.sel();t&&su(this,t,e)}copyFormat(){if(this.painter){this.painter=null,this.onPainter?.(!1);return}let e=this.state();e&&(this.painter={b:e.b,i:e.i,u:e.u?`single`:`none`,strike:e.strike,color:e.color??null,hl:e.hl??null,va:e.va??null,sz:e.sz,font:e.font?/^\s*"?([^",]+)/.exec(e.font)?.[1]??e.font:void 0},this.onPainter?.(!0))}applyPainter(){let e=this.painter,t=this.input.readSel();if(!e||!t||Hl(t))return!1;this.painter=null,this.onPainter?.(!1);let n={};for(let[t,r]of Object.entries(e))t===`font`?n.font=r?$e(r):void 0:t===`u`?n.u=r:n[t]=r===null?void 0:r;return this.format(n,e),!0}state(e=this.input.sel()){if(!e)return null;let[t]=tu(this,e),n=this.para(t.pa);if(!n)return null;let r=Yl(n.runs,Hl(e)?t.o:t.o+ +(Vl(n.runs)>t.o)),i={...r?.s??{},...Hl(e)?this.pend?.s??{}:{}},[,a]=tu(this,e),o;if(t.pa===a.pa&&a.o===t.o+1){let[,e]=Jl(n.runs,t.o),r=e[0];r?.t===`img`&&(o={w:r.w,h:r.h,alt:r.alt,target:r.target,pa:t.pa,o:t.o})}return{line:n.pd?.line??(n.ps.lineRule===`auto`||!n.ps.lineRule?n.ps.line:void 0),va:i.va,link:r?.href,inTable:t.pa.includes(`.`),img:o,b:!!i.b,i:!!i.i,u:!!i.u&&i.u!==`none`,strike:!!i.strike,color:i.color,hl:i.hl,sz:i.sz??n.markSz??this.defaultSz,font:i.font??n.markFont??this.defaultFont,align:n.ps.align??`left`,style:n.sid,lst:n.lst,canUndo:this.canUndo,canRedo:this.canRedo}}emitState(e){let t=e?this.state(e):null;this.onState?.(t),this.onImage?.(t?.img??null)}onSelection(e){e&&this.pend&&(e.a.pa!==this.pend.at.pa||e.a.o!==this.pend.at.o)&&(this.pend=null),this.emitState(e)}};function Ru(e){return new Promise(t=>{let n=URL.createObjectURL(e),r=new Image;r.onload=()=>{t({w:r.naturalWidth||300,h:r.naturalHeight||200}),URL.revokeObjectURL(n)},r.onerror=()=>{t({w:300,h:200}),URL.revokeObjectURL(n)},r.src=n})}var zu=[`#ffff00`,`#00ff00`,`#00ffff`,`#ff00ff`,`#0000ff`,`#ff0000`,`#000080`,`#008080`,`#008000`,`#800080`,`#800000`,`#808000`,`#808080`,`#c0c0c0`,`#000000`],Bu=[{value:1,label:`Single`},{value:1.15,label:`1.15`},{value:1.5,label:`1.5`},{value:2,label:`Double`},{value:2.5,label:`2.5`},{value:3,label:`Triple`}],Vu=[{k:`normal`,label:`Normal text`,look:{}},{k:`title`,label:`Title`,look:{fontSize:22}},{k:`subtitle`,label:`Subtitle`,look:{fontSize:15,color:`#5a5a5a`}},{k:`h1`,label:`Heading 1`,look:{fontSize:18,color:`#2f5496`}},{k:`h2`,label:`Heading 2`,look:{fontSize:16,color:`#2f5496`}},{k:`h3`,label:`Heading 3`,look:{fontSize:14,color:`#1f3763`}},{k:`h4`,label:`Heading 4`,look:{fontSize:13,color:`#2f5496`,fontStyle:`italic`}},{k:`h5`,label:`Heading 5`,look:{fontSize:13,color:`#2f5496`}},{k:`h6`,label:`Heading 6`,look:{fontSize:13,color:`#1f3763`,fontStyle:`italic`}}],Hu=`©.®.™.§.¶.†.‡.•.….–.—.‰.€.£.¥.¢.₫.$.°.±.×.÷.≈.≠.≤.≥.∞.√.∑.∏.∫.π.µ.Ω.α.β.←.→.↑.↓.↔.⇒.✓.✗.★.☆.♥.♦.«.».“.”.‘.’.¼.½.¾.¹.².³`.split(`.`);function Uu(e){let t=e?.preview;if(t)return{fontSize:t.sz?Math.max(12,Math.min(22,t.sz)):void 0,fontWeight:t.b?700:void 0,fontStyle:t.i?`italic`:void 0,color:t.color&&!/^#?f{6}$/i.test(t.color.replace(`#`,``))?t.color:void 0,fontFamily:t.font,lineHeight:1.25}}function Wu(e){let{editor:t,styles:n,image:r}=e,[i,a]=(0,u.useState)(null);(0,u.useEffect)(()=>(t.onState=a,()=>{t.onState=void 0}),[t]);let o=Sl(i?.font),s=!i,c=i?.sz?Math.round(i.sz*2)/2:void 0,l=i?.line?Math.round(i.line*100)/100:``,d=/Mac|iPhone|iPad/.test(typeof navigator<`u`?navigator.platform:``)?`⌥`:`Alt+`,f=Vu.map(({k:e,label:t,look:r},i)=>{let a=n.find(t=>t.canon===e),o=e===`normal`?`${Q}${d}0`:e.startsWith(`h`)?`${Q}${d}${e.slice(1)}`:void 0;return{value:a?.id??`@${e}`,label:t,hint:o,style:{lineHeight:1.25,...e===`normal`?{}:Uu(a)??r},sep:i===1}});n.filter(e=>!e.canon).forEach((e,t)=>f.push({value:e.id,label:e.name,style:Uu(e),sep:t===0}));let p=i?.style&&f.some(e=>e.value===i.style)?i.style:i&&!i.style?n.find(e=>e.canon===`normal`)?.id??``:``;return(0,X.jsxs)(jl,{children:[(0,X.jsx)(Z,{icon:`undo`,title:`Undo (${Q}Z)`,disabled:!t.canUndo,onClick:()=>t.undo()}),(0,X.jsx)(Z,{icon:`redo`,title:`Redo (${Q}Y)`,disabled:!t.canRedo,onClick:()=>t.redo()}),(0,X.jsx)(Z,{icon:`paint`,title:`Paint format (click, then select text)`,active:e.painter,disabled:s,onClick:()=>t.copyFormat()}),i?.inTable&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Table`,label:`Table`,icon:`table`,items:[{value:`rowAbove`,label:`Insert row above`,icon:`rowAbove`},{value:`rowBelow`,label:`Insert row below`,icon:`rowBelow`},{value:`colLeft`,label:`Insert column left`,icon:`colLeft`},{value:`colRight`,label:`Insert column right`,icon:`colRight`},{value:`delRow`,label:`Delete row`,icon:`delRow`,sep:!0},{value:`delCol`,label:`Delete column`,icon:`delCol`},{value:`delTable`,label:`Delete table`,icon:`trash`}],onPick:e=>t.tableOp(e)})]}),i?.img&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`minus`,title:`Smaller`,onClick:()=>t.resizeImage(.8)}),(0,X.jsxs)(`span`,{className:`de-tb-hint`,style:{margin:0},children:[Math.round(i.img.w),`×`,Math.round(i.img.h),`pt`]}),(0,X.jsx)(Z,{icon:`plus`,title:`Larger`,onClick:()=>t.resizeImage(1.25)}),(0,X.jsx)(Z,{icon:`fit`,title:`Fit page width`,onClick:()=>t.resizeImage(`fit`)}),(0,X.jsx)(Z,{icon:`imgOrig`,title:`Original size`,onClick:r.original}),(0,X.jsx)(Z,{icon:`imgReplace`,title:`Replace image`,onClick:r.replace}),(0,X.jsx)(Z,{icon:`alt`,title:`Alt text`,active:!!i.img.alt,onClick:r.alt}),r.download&&(0,X.jsx)(Z,{icon:`save`,title:`Download image`,onClick:r.download}),(0,X.jsx)(Z,{icon:`trash`,title:`Delete image`,onClick:()=>t.deleteSelection()})]}),(0,X.jsx)(nl,{}),(0,X.jsx)(il,{title:`Paragraph style`,width:118,menuWidth:250,disabled:s,value:p,placeholder:`Style`,options:f,onChange:e=>e.startsWith(`@`)?void t.applyCanon(e.slice(1)):t.setPara({style:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(il,{title:`Font`,width:118,menuWidth:200,disabled:s,value:o,placeholder:`Font`,options:xl(o),onChange:e=>t.setFont(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(al,{value:c,disabled:s,onChange:e=>t.setSize(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bold`,title:`Bold (${Q}B)`,active:i?.b,disabled:s,onClick:()=>t.toggle(`b`)}),(0,X.jsx)(Z,{icon:`italic`,title:`Italic (${Q}I)`,active:i?.i,disabled:s,onClick:()=>t.toggle(`i`)}),(0,X.jsx)(Z,{icon:`underline`,title:`Underline (${Q}U)`,active:i?.u,disabled:s,onClick:()=>t.toggle(`u`)}),(0,X.jsx)(Z,{icon:`strike`,title:`Strikethrough`,active:i?.strike,disabled:s,onClick:()=>t.toggle(`strike`)}),(0,X.jsx)(vl,{icon:`color`,title:`Text color`,value:i?.color,onPick:e=>t.setColor(e),noneLabel:`Automatic`}),(0,X.jsx)(vl,{icon:`highlight`,title:`Highlight color`,value:i?.hl,palette:zu,onPick:e=>t.setHighlight(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`link`,title:`Insert link (${Q}K)`,active:!!i?.link,disabled:s,onClick:e.onLink}),(0,X.jsx)(Z,{icon:`image`,title:`Insert image`,disabled:s,onClick:()=>void Dl().then(e=>void(e.length&&t.insertImages(e)))}),(0,X.jsx)(Tl,{icon:`table`,title:`Insert table`,disabled:s||i?.inTable,children:e=>(0,X.jsx)(El,{onPick:(n,r)=>(e(),t.insertTable(n,r))})}),(0,X.jsx)(Tl,{icon:`omega`,title:`Special characters`,disabled:s,children:e=>(0,X.jsx)(`div`,{className:`de-symbols`,children:Hu.map(n=>(0,X.jsx)(`button`,{type:`button`,title:`U+${n.codePointAt(0).toString(16).toUpperCase().padStart(4,`0`)}`,onClick:()=>(e(),t.insertText(n)),children:n},n))})}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`alignLeft`,title:`Align left`,active:i?.align===`left`,disabled:s,onClick:()=>t.setPara({align:`left`},{align:`left`})}),(0,X.jsx)(Z,{icon:`alignCenter`,title:`Center`,active:i?.align===`center`,disabled:s,onClick:()=>t.setPara({align:`center`},{align:`center`})}),(0,X.jsx)(Z,{icon:`alignRight`,title:`Align right`,active:i?.align===`right`,disabled:s,onClick:()=>t.setPara({align:`right`},{align:`right`})}),(0,X.jsx)(Z,{icon:`justify`,title:`Justify`,active:i?.align===`justify`,disabled:s,onClick:()=>t.setPara({align:`justify`},{align:`justify`})}),(0,X.jsx)(rl,{title:`Line & paragraph spacing`,icon:`lineSpacing`,label:null,menuWidth:150,disabled:s,value:l,options:Bu,onChange:e=>t.setPara({line:e},{line:e,lineRule:`auto`})}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bullets`,title:`Bulleted list`,active:i?.lst===`bullet`,disabled:s,onClick:()=>t.toggleList(`bullet`)}),(0,X.jsx)(Z,{icon:`numbers`,title:`Numbered list`,active:i?.lst===`number`,disabled:s,onClick:()=>t.toggleList(`number`)}),(0,X.jsx)(Z,{icon:`outdent`,title:`Decrease indent (Shift+Tab)`,disabled:s,onClick:()=>t.indent(-1)}),(0,X.jsx)(Z,{icon:`indent`,title:`Increase indent (Tab)`,disabled:s,onClick:()=>t.indent(1)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`sup`,title:`Superscript`,active:i?.va===`sup`,disabled:s,onClick:()=>t.format({va:i?.va===`sup`?void 0:`sup`},{va:i?.va===`sup`?null:`sup`})}),(0,X.jsx)(Z,{icon:`sub`,title:`Subscript`,active:i?.va===`sub`,disabled:s,onClick:()=>t.format({va:i?.va===`sub`?void 0:`sub`},{va:i?.va===`sub`?null:`sub`})}),(0,X.jsx)(Z,{icon:`pagebreak`,title:`Page break (${Q}Enter)`,disabled:s||i?.inTable,onClick:()=>t.insertPageBreak()}),(0,X.jsx)(Z,{icon:`clear`,title:`Clear formatting (${Q}\\)`,disabled:s,onClick:()=>t.clearFormat()}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`outline`,title:`Document outline`,active:e.outline,onClick:e.onOutline}),(0,X.jsx)(Z,{icon:`search`,title:`Find & replace (${Q}F)`,onClick:e.onFind})]})}function Gu(e){let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(``),[i,a]=(0,u.useState)(!!e.replace);return(0,u.useEffect)(()=>{t.current?.focus(),t.current?.select()},[]),(0,X.jsxs)(`div`,{className:`de-find`,role:`search`,onKeyDown:t=>t.key===`Escape`&&e.onClose(),children:[(0,X.jsxs)(`div`,{className:`de-find-row`,children:[(0,X.jsx)(`input`,{ref:t,value:e.query,placeholder:e.placeholder??`Find in document`,"aria-label":`Find`,onChange:t=>e.onQuery(t.target.value),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),e.onNav(t.shiftKey?-1:1))}}),(0,X.jsx)(`span`,{className:`de-find-count`,children:e.query?e.count?`${Math.min(e.index+1,e.count)} / ${e.count}`:`0 / 0`:``}),(0,X.jsx)(Z,{icon:`up`,title:`Previous (Shift+Enter)`,onClick:()=>e.onNav(-1),disabled:!e.count}),(0,X.jsx)(Z,{icon:`down`,title:`Next (Enter)`,onClick:()=>e.onNav(1),disabled:!e.count}),e.editable&&(0,X.jsx)(Z,{label:`⇄`,title:`Replace`,active:i,onClick:()=>a(e=>!e)}),(0,X.jsx)(Z,{icon:`close`,title:`Close (Esc)`,onClick:e.onClose})]}),e.options&&(0,X.jsx)(`div`,{className:`de-find-row de-find-opts`,children:e.options}),e.editable&&i&&(0,X.jsxs)(`div`,{className:`de-find-row`,children:[(0,X.jsx)(`input`,{value:n,placeholder:`Replace with`,"aria-label":`Replace with`,onChange:e=>r(e.target.value)}),(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,disabled:!e.count,onClick:()=>e.onReplace(n,!1),children:`Replace`}),(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,disabled:!e.count,onClick:()=>e.onReplace(n,!0),children:`All`})]})]})}var Ku=e=>e.map(e=>e.t===`text`||e.t===`ref`?e.s.vanish?``:e.text:``).join(``),qu=e=>e.filter(e=>e.t===`p`).map(e=>Ku(e.runs)).join(` `).replace(/\s+/g,` `).trim();function Ju(e){let t=[];for(let n of e)if(n.t===`p`)t.push((n.marker?n.marker.text+(n.marker.tab?` `:` `):``)+Ku(n.runs));else if(n.t===`tbl`)for(let e of n.rows)t.push(e.cells.map(e=>qu(e.blocks)).join(` `));return t.join(`
|
|
25
|
+
`);if(c.length===1||r?.label===`linebreak`){let t=Xl(o.runs,s,n,a,e.defaultRun?.(o));e.replace(i.pas,[e.withRuns(o,t)],nu({pa:i.at.pa,o:s+n.length}),{label:`type`,...r});return}let l=a?{...Yl(o.runs,s)??e.defaultRun?.(o)??{},...a}:void 0;su(e,t,c.map(e=>e?[{...l??{},t:`text`,text:e}]:[]),r)}function lu(e,t){let n=Hl(t)?(()=>{let n=e.para(t.a.pa);return n?{pas:[t.a.pa],paras:[n],at:t.a}:null})():iu(e,t);if(!n)return;let r=n.paras[0],[i,a]=Jl(r.runs,n.at.o),[o,s]=e.split(r,i,a,n.at.o>=Vl(r.runs));e.replace(n.pas,[o,s],nu({pa:Ul(n.at.pa,1),o:0}),{label:`enter`})}function uu(e,t,n=!1){if(!Hl(t))return au(e,t);let{pa:r,o:i}=t.a,a=e.para(r);if(!a)return;if(i>0){let t=Wl(a.runs),o=$l(t,i);if(n){let e=/(\S+\s*|\s+)$/.exec(t.slice(0,i));e&&(o=i-e[0].length)}e.replace([r],[e.withRuns(a,Zl(a.runs,o,i))],nu({pa:r,o}),{label:`delete`});return}if(e.backspaceAtStart?.(r,a))return;let o=e.prev(r),s=o?e.para(o):void 0;if(!o||!s)return;let c=e.join(s,a,ql([...s.runs,...a.runs]));e.replace([o,r],[c],nu({pa:o,o:Vl(s.runs)}),{label:`merge`})}function du(e,t,n=!1){if(!Hl(t))return au(e,t);let{pa:r,o:i}=t.a,a=e.para(r);if(!a)return;if(i<Vl(a.runs)){let t=Wl(a.runs),o=eu(t,i);if(n){let e=/^(\s*\S+|\s+)/.exec(t.slice(i));e&&(o=i+e[0].length)}e.replace([r],[e.withRuns(a,Zl(a.runs,i,o))],nu({pa:r,o:i}),{label:`delete`});return}let o=e.next(r),s=o?e.para(o):void 0;if(!o||!s)return;let c=e.join(a,s,ql([...a.runs,...s.runs]));e.replace([r,o],[c],nu({pa:r,o:i}),{label:`merge`})}function fu(e,t){let n=(e&&(e.nodeType===1?e:e.parentElement))?.closest(`[data-o]`);return n&&t.contains(n)?n:null}function pu(e){let t=Number(e.dataset.o);return e.hasAttribute(`data-obj`)?t+1:e.hasAttribute(`data-empty`)?t:t+(e.textContent?.length??0)}function mu(e,t,n){let r=(t.nodeType===1?t:t.parentElement)?.closest(`[data-pa]`);if(!r||!e.contains(r))return null;let i=r.dataset.pa;if(!fu(t,r)){let e=document.createRange();e.setStart(t,n),e.collapse(!0);let a=0;for(let t of Array.from(r.querySelectorAll(`[data-o]`)))if(e.comparePoint(t,t.childNodes.length)<0)a=pu(t);else break;return{pa:i,o:a}}let a=fu(t,r),o=Number(a.dataset.o);if(a.hasAttribute(`data-empty`))return{pa:i,o};if(a.hasAttribute(`data-obj`))return{pa:i,o:n>0||t!==a?o+1:o};if(t.nodeType===3){let e=0,r=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);for(let a=r.nextNode();a;a=r.nextNode()){if(a===t)return{pa:i,o:o+e+Math.min(n,(a.textContent??``).length)};e+=a.textContent?.length??0}return{pa:i,o:o+e}}let s=0;for(let e=0;e<Math.min(n,a.childNodes.length);e++)s+=a.childNodes[e].textContent?.length??0;return{pa:i,o:o+s}}function hu(e,t){let n=e.querySelector(`[data-pa="${t.pa}"]`);if(!n)return null;let r=Array.from(n.querySelectorAll(`[data-o]`));if(!r.length)return[n,n.childNodes.length];let i;for(let e of r){let n=Number(e.dataset.o),r=pu(e);if(t.o>=n&&t.o<=r&&(i=e,t.o<r||!e.hasAttribute(`data-obj`)))break}i??(i=r[r.length-1]);let a=Number(i.dataset.o);if(i.hasAttribute(`data-obj`)||i.hasAttribute(`data-empty`)){let e=i.parentNode,n=Array.prototype.indexOf.call(e.childNodes,i);if(i.hasAttribute(`data-empty`)){let t=i.firstChild;return t?[t,0]:[e,n]}return[e,t.o>a?n+1:n]}let o=Math.max(0,t.o-a),s=document.createTreeWalker(i,NodeFilter.SHOW_TEXT),c=null;for(let e=s.nextNode();e;e=s.nextNode()){let t=e.textContent?.length??0;if(o<=t)return[e,o];o-=t,c=e}return c?[c,c.textContent?.length??0]:[i,0]}function gu(e){let t=e.getRootNode();return typeof ShadowRoot<`u`&&t instanceof ShadowRoot&&typeof t.getSelection==`function`?t.getSelection():(e.ownerDocument??document).getSelection()}function _u(e){let t=e.getRootNode(),n=gu(e);if(!n)return null;if(typeof ShadowRoot<`u`&&t instanceof ShadowRoot&&n.anchorNode&&!e.contains(n.anchorNode)){let e=n.getComposedRanges?.call(n,{shadowRoots:[t]})[0];if(e)return{anchorNode:e.startContainer,anchorOffset:e.startOffset,focusNode:e.endContainer,focusOffset:e.endOffset}}return n}var vu=class{constructor(e){A(this,`host`,void 0),A(this,`root`,null),A(this,`composing`,null),A(this,`justComposed`,``),A(this,`raf`,0),A(this,`lastSel`,null),A(this,`override`,null),A(this,`onBeforeInput`,e=>{let t=e.inputType;if(this.composing||t===`insertCompositionText`)return;if(t===`deleteCompositionText`||t===`insertFromComposition`){if(e.cancelable&&e.preventDefault(),t===`insertFromComposition`&&e.data&&e.data!==this.justComposed){let t=this.sel();t&&cu(this.host,t,e.data,{remount:!0})}this.justComposed=``;return}e.preventDefault();let n=this.rangeSel(e.getTargetRanges?.()[0]),r=this.sel();if(!r)return;let i=this.host;switch(t){case`insertText`:case`insertReplacementText`:{let a=e.data??e.dataTransfer?.getData(`text/plain`)??``;cu(i,t===`insertReplacementText`&&n?n:r,a);break}case`insertParagraph`:lu(i,r);break;case`insertLineBreak`:cu(i,r,`
|
|
26
|
+
`,{label:`linebreak`});break;case`insertFromPaste`:case`insertFromDrop`:case`insertFromYank`:{if(e.dataTransfer&&i.pasteRich?.(t===`insertFromDrop`&&n?n:r,e.dataTransfer))break;let a=e.dataTransfer?.getData(`text/plain`)??e.data??``;a&&cu(i,r,a);break}case`deleteContentBackward`:uu(i,r);break;case`deleteWordBackward`:uu(i,r,!0);break;case`deleteContentForward`:du(i,r);break;case`deleteWordForward`:du(i,r,!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:case`deleteSoftLineForward`:case`deleteHardLineForward`:case`deleteByCut`:case`deleteByDrag`:case`deleteContent`:case`deleteEntireSoftLine`:Hl(r)?n&&!Hl(n)&&au(i,n):au(i,r);break;case`historyUndo`:i.undo();break;case`historyRedo`:i.redo();break;case`formatBold`:i.toggle?.(`b`);break;case`formatItalic`:i.toggle?.(`i`);break;case`formatUnderline`:i.toggle?.(`u`)}}),A(this,`onCompStart`,()=>{this.composing=this.sel()}),A(this,`onCompEnd`,e=>{let t=this.composing;this.composing=null,t&&(this.justComposed=e.data??``,e.data?cu(this.host,t,e.data,{remount:!0}):cu(this.host,t,``,{remount:!0}),setTimeout(()=>this.justComposed=``,0))}),A(this,`onKeyDown`,e=>{if(e.isComposing||this.composing)return;let t=e.metaKey||e.ctrlKey,n=e.key.toLowerCase();if(this.host.shortcut?.(e))e.preventDefault();else{if(t&&!e.altKey){if(n===`z`){e.preventDefault(),e.shiftKey?this.host.redo():this.host.undo();return}if(n===`y`){e.preventDefault(),this.host.redo();return}if(n===`a`&&!e.shiftKey){this.selectAll()&&e.preventDefault();return}if(n===`b`||n===`i`||n===`u`){e.preventDefault(),this.host.toggle?.(n);return}}if(e.key===`Tab`&&!t){e.preventDefault();let t=this.sel();if(!t)return;!this.host.tab?.(t,e.shiftKey)&&!e.shiftKey&&cu(this.host,t,` `)}}}),A(this,`onSelChange`,()=>{this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0;let e=this.readSel(),t=this.override;if(t&&e&&!ru(e,t.dom))this.override=null;else if(t){this.host.onSelection?.(t.model);return}e&&(this.lastSel=e),this.host.onSelection?.(e)}))}),this.host=e}attach(e){this.root!==e&&(this.detach(),this.root=e,e.addEventListener(`beforeinput`,this.onBeforeInput),e.addEventListener(`compositionstart`,this.onCompStart),e.addEventListener(`compositionend`,this.onCompEnd),e.addEventListener(`keydown`,this.onKeyDown),document.addEventListener(`selectionchange`,this.onSelChange))}detach(){let e=this.root;e&&(e.removeEventListener(`beforeinput`,this.onBeforeInput),e.removeEventListener(`compositionstart`,this.onCompStart),e.removeEventListener(`compositionend`,this.onCompEnd),e.removeEventListener(`keydown`,this.onKeyDown),document.removeEventListener(`selectionchange`,this.onSelChange),cancelAnimationFrame(this.raf),this.root=null,this.override=null)}get isComposing(){return!!this.composing}readSel(){let e=this.root,t=e?_u(e):null;if(!e||!t||!t.anchorNode||!t.focusNode||!e.contains(t.anchorNode)||!e.contains(t.focusNode))return null;let n=mu(e,t.anchorNode,t.anchorOffset),r=mu(e,t.focusNode,t.focusOffset);return n&&r?{a:n,f:r}:null}sel(){return this.override?.model??this.readSel()??this.lastSel}selectAll(){let e=this.root,t=this.host.all?.();if(!e||!t)return!1;let n=Array.from(e.querySelectorAll(`[data-pa]`)).filter(t=>{let n=t.closest(`[contenteditable="false"]`);return this.host.para(t.dataset.pa)&&!(n&&e.contains(n))}),r=n[0],i=n[n.length-1],a=r&&i?{a:{pa:r.dataset.pa,o:0},f:{pa:i.dataset.pa,o:Vl(this.host.para(i.dataset.pa).runs)}}:t;return this.restore(a),this.override={model:t,dom:this.readSel()??a},this.host.onSelection?.(t),!0}restore(e,t=!0){let n=this.root;if(!n||!e)return!1;this.override=null;let r=hu(n,e.a),i=hu(n,e.f);if(!r||!i)return this.lastSel=e,!1;let a=n.getRootNode().activeElement;t&&a!==n&&!n.contains(a)&&n.focus({preventScroll:!0});let o=gu(n);try{o?.setBaseAndExtent(r[0],r[1],i[0],i[1])}catch{}return this.lastSel=e,!0}rangeSel(e){if(!e||!this.root)return null;let t=mu(this.root,e.startContainer,e.startOffset),n=mu(this.root,e.endContainer,e.endOffset);return t&&n?{a:t,f:n}:null}};function yu(e){switch(e.t){case`text`:return{text:e.text,src:e.src,set:e.d&&Object.keys(e.d).length?e.d:void 0,lk:e.lk};case`field`:return{obj:`field`,kind:e.kind};case`img`:return e.src?{obj:`copy`,src:e.src,size:e.resized?[e.w,e.h]:void 0,alt:e.altSet?e.alt??``:void 0,rid:e.repl?e.rid:void 0}:e.rid?{obj:`image`,rid:e.rid,w:e.w,h:e.h,alt:e.alt}:{text:``};default:return e.src?{obj:`copy`,src:e.src}:{text:``}}}function bu(e){let t=e[0];return{pid:t.pid,from:t.from??t.pid,orig:t.orig,pd:t.pd,keepSect:t.keepSect,pristine:!e.some(e=>e.edited)&&(t.from===void 0||t.from===t.pid),parts:e.map(e=>e.runs.map(yu))}}var xu=new Set([`P`,`DIV`,`H1`,`H2`,`H3`,`H4`,`H5`,`H6`,`LI`,`TR`,`BLOCKQUOTE`,`PRE`,`SECTION`,`ARTICLE`,`HEADER`,`FOOTER`,`UL`,`OL`,`TABLE`,`TBODY`,`THEAD`,`DL`,`DT`,`DD`,`FIGURE`]),Su=new Set([`SCRIPT`,`STYLE`,`HEAD`,`TITLE`,`META`,`LINK`,`NOSCRIPT`,`TEMPLATE`]);function Cu(e){if(!e)return;let t=e.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return`#`+[...t.slice(1)].map(e=>e+e).join(``);let n=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/.exec(t);if(n)return n[4]!==void 0&&Number(n[4])===0?void 0:`#`+[n[1],n[2],n[3]].map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}function wu(e){let t=/^([\d.]+)(pt|px|em|rem)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);return t[2]===`px`?n*.75:t[2]===`em`||t[2]===`rem`?n*11:n}function Tu(e,t){let n={...t};switch(e.tagName){case`B`:case`STRONG`:n.b=!0;break;case`I`:case`EM`:n.i=!0;break;case`U`:case`INS`:n.u=`single`;break;case`S`:case`STRIKE`:case`DEL`:n.strike=!0;break;case`SUP`:n.va=`sup`;break;case`SUB`:n.va=`sub`;break;case`A`:e.href&&!e.href.startsWith(`javascript:`)&&(n.href=e.getAttribute(`href`)??void 0,n.u=`single`,n.color=`#0563c1`);break;case`FONT`:{let t=Cu(e.getAttribute(`color`));t&&(n.color=t);let r=e.getAttribute(`face`);r&&(n.fontName=r.split(`,`)[0].replace(/['"]/g,``).trim());break}case`CODE`:case`KBD`:n.fontName=`Courier New`}let r=e.style;r.fontWeight&&(n.b=r.fontWeight===`bold`||r.fontWeight===`bolder`||Number(r.fontWeight)>=600),r.fontStyle&&(n.i=r.fontStyle===`italic`||r.fontStyle===`oblique`);let i=`${r.textDecoration} ${r.textDecorationLine}`;i.includes(`underline`)&&(n.u=`single`),i.includes(`line-through`)&&(n.strike=!0),r.textDecoration===`none`&&e.tagName!==`A`&&(n.u=void 0);let a=Cu(r.color);a&&(n.color=a);let o=Cu(r.backgroundColor);if(o&&o!==`#ffffff`&&(n.hl=o),r.fontSize){let e=wu(r.fontSize);e&&e>=4&&e<=200&&(n.sz=Math.round(e*2)/2)}return r.fontFamily&&(n.fontName=r.fontFamily.split(`,`)[0].replace(/['"]/g,``).trim()),r.verticalAlign===`super`?n.va=`sup`:r.verticalAlign===`sub`&&(n.va=`sub`),n}function Eu(e,t){let{href:n,fontName:r,...i}=t,a={...i};r&&(a.font=$e(r));let o={};return t.b!==void 0&&(o.b=t.b),t.i!==void 0&&(o.i=t.i),t.u&&(o.u=t.u),t.strike&&(o.strike=!0),t.color&&(o.color=t.color),t.sz&&(o.sz=t.sz),r&&(o.font=r),t.hl&&(o.hl=t.hl),t.va&&(o.va=t.va),{t:`text`,text:e,s:a,d:Object.keys(o).length?o:void 0,href:n}}function Du(e){let t=new DOMParser().parseFromString(e,`text/html`),n=[],r=null,i=(e={})=>(r={runs:[],...e},n.push(r),r),a=(e,t,n,o)=>{for(let s of Array.from(e.childNodes)){if(s.nodeType===3){let e=s.textContent??``;if(o||(e=e.replace(/[\s ]+/g,e=>e.includes(`\xA0`)&&e.length===1?`\xA0`:` `)),!e||!o&&!r&&!e.trim())continue;(r??i()).runs.push(Eu(e,t));continue}if(s.nodeType!==1)continue;let e=s;if(Su.has(e.tagName))continue;if(e.tagName===`BR`){(r??i()).runs.push(Eu(`
|
|
27
|
+
`,t));continue}if(e.tagName===`TD`||e.tagName===`TH`){r&&r.runs.length&&r.runs.push(Eu(` `,t)),a(e,Tu(e,t),n,o);continue}let c=Tu(e,t);if(xu.has(e.tagName)){let t=e.tagName===`UL`?`bullet`:e.tagName===`OL`?`number`:n;if(e.tagName!==`UL`&&e.tagName!==`OL`&&e.tagName!==`TABLE`&&e.tagName!==`TBODY`&&e.tagName!==`THEAD`){let n=/^H([1-6])$/.exec(e.tagName);i({heading:n?Number(n[1]):void 0,list:e.tagName===`LI`?t??`bullet`:void 0})}a(e,c,t,o||e.tagName===`PRE`),r=null}else a(e,c,n,o)}};a(t.body,{},void 0,!1);for(let e of n){let t=e.runs[0];t?.t===`text`&&(t.text=t.text.replace(/^ +/,``));let n=e.runs[e.runs.length-1];n?.t===`text`&&(n.text=n.text.replace(/ +$/,``)),e.runs=e.runs.filter(e=>e.t!==`text`||e.text)}for(;n.length&&!n[0].runs.length;)n.shift();for(;n.length&&!n[n.length-1].runs.length;)n.pop();return n}function Ou(e){let t=[],n=[];return e.rows.forEach((e,r)=>{let i=0;e.cells.forEach((e,a)=>{for(var o;t[r]?.[i];)i++;for(let n=r;n<r+Math.max(1,e.rowSpan);n++)for(let r=i;r<i+Math.max(1,e.colSpan);r++)(t[o=n]??(t[o]=[]))[r]=!0;n.push({ri:r,ci:a,g:i,cell:e}),i+=Math.max(1,e.colSpan)})}),{cells:n,nCols:Math.max(e.cols.length,...n.map(e=>e.g+e.cell.colSpan)),at:(e,t)=>n.find(n=>e>=n.ri&&e<n.ri+n.cell.rowSpan&&t>=n.g&&t<n.g+n.cell.colSpan)}}function ku(e,t,n=1){return{...e,blocks:[t(e)],colSpan:n,rowSpan:1}}function Au(e,t){let n=e.reduce((e,t)=>e+t,0)||1;return e.map(e=>+(e*t/n).toFixed(2))}function ju(e,t,n,r){let{cells:i,nCols:a,at:o}=Ou(e),s=n?t+1:t,c=e.rows.map(e=>({...e,cells:[...e.cells]})),l=[];for(let e=0;e<a;){let n=o(t,e);if(!n)e++;else{if(n.ri<s&&n.ri+n.cell.rowSpan>s){let e=c[n.ri];e.cells[n.ci]={...e.cells[n.ci],rowSpan:e.cells[n.ci].rowSpan+1}}else l.push(ku(n.cell,r,n.cell.colSpan));e+=n.cell.colSpan}}let u={...e.rows[t],cells:l};return c.splice(s,0,u),{...e,rows:c}}function Mu(e,t){if(e.rows.length<=1)return null;let{cells:n}=Ou(e),r=e.rows.map(e=>({...e,cells:[...e.cells]}));for(let e of n)e.ri<t&&e.ri+e.cell.rowSpan>t&&(r[e.ri].cells[e.ci]={...r[e.ri].cells[e.ci],rowSpan:e.cell.rowSpan-1});return r.splice(t,1),{...e,rows:r}}function Nu(e,t,n,r){let{cells:i,nCols:a}=Ou(e),o=n?t+1:t,s=e.rows.map(e=>({...e,cells:[...e.cells]})),c=e.cols.reduce((e,t)=>e+t,0);e.rows.forEach((e,t)=>{let n=i.filter(e=>e.ri===t),a=i.find(e=>e.ri<=t&&t<e.ri+e.cell.rowSpan&&e.g<o&&e.g+e.cell.colSpan>o);if(a){a.ri===t&&(s[t].cells[a.ci]={...s[t].cells[a.ci],colSpan:a.cell.colSpan+1});return}if(i.find(e=>e.ri<t&&t<e.ri+e.cell.rowSpan&&e.g+e.cell.colSpan===o)&&!n.length)return;let c=n.filter(e=>e.g<o).length,l=n[Math.max(0,c-1)]?.cell??n[0]?.cell;l&&s[t].cells.splice(c,0,ku(l,r))});let l=[...e.cols.length?e.cols:Array(a).fill(c/Math.max(1,a))];return l.splice(o,0,l[Math.min(t,l.length-1)]??72),{...e,rows:s,cols:c?Au(l,c):l}}function Pu(e,t){let{cells:n,nCols:r}=Ou(e);if(r<=1)return null;let i=e.rows.map(e=>({...e,cells:[...e.cells]})),a=new Set;for(let e of n)t<e.g||t>=e.g+e.cell.colSpan||(e.cell.colSpan>1?i[e.ri].cells[e.ci]={...i[e.ri].cells[e.ci],colSpan:e.cell.colSpan-1}:a.add(`${e.ri}:${e.ci}`));i.forEach((e,t)=>e.cells=e.cells.filter((e,n)=>!a.has(`${t}:${n}`)));let o=e.cols.reduce((e,t)=>e+t,0),s=[...e.cols];return s.splice(t,1),{...e,rows:i.filter(e=>e.cells.length),cols:o&&s.length?Au(s,o):s}}function Fu(e,t,n,r){let i=`0.5pt solid #000000`,a=+(n/t).toFixed(2);return{t:`tbl`,cols:Array(t).fill(a),rows:Array.from({length:e},()=>({cells:Array.from({length:t},()=>({blocks:[r()],colSpan:1,rowSpan:1,borders:{t:i,r:i,b:i,l:i},pad:[0,5.4,0,5.4]}))}))}}var Iu=e=>e.split(`.`).map(Number);function Lu(e,t,n){if(t===n)return e;let r=e=>e.replace(/\.?\d+$/,``),i=Number(n.split(`.`).pop())-Number(t.split(`.`).pop()),a=e=>r(e.pa)===r(t)?{...e,pa:r(n)?`${r(n)}.${Number(e.pa.split(`.`).pop())+i}`:String(Number(e.pa.split(`.`).pop())+i)}:e;return{a:a(e.a),f:a(e.f)}}var Ru=class{constructor(e,t,n){A(this,`client`,void 0),A(this,`st`,void 0),A(this,`changed`,void 0),A(this,`input`,void 0),A(this,`pendingSel`,null),A(this,`styles`,[]),A(this,`history`,[]),A(this,`future`,[]),A(this,`pend`,null),A(this,`nextPid`,1e9),A(this,`inflight`,0),A(this,`onState`,void 0),A(this,`onImage`,void 0),A(this,`onStyles`,void 0),A(this,`shortcut`,void 0),A(this,`onDirty`,void 0),A(this,`painter`,null),A(this,`onPainter`,void 0),A(this,`onCommit`,void 0),A(this,`contentW`,468),A(this,`defaultFont`,void 0),A(this,`defaultSz`,void 0),this.client=e,this.st=t,this.changed=n,this.input=new vu(this)}container(e){let t=Iu(e);if(t.length===1)return{list:this.st.blocks,at:t[0]};let n=this.st.blocks[t[0]];if(n?.t!==`tbl`)return;let r=n.rows[t[1]]?.cells[t[2]];return r?{list:r.blocks,at:t[3],cell:[t[0],t[1],t[2]]}:void 0}para(e){let t=this.container(e),n=t?.list[t.at];return n&&n.t===`p`&&n.pid!==void 0&&!n.ro?n:void 0}span(e,t){let n=Iu(e),r=Iu(t);if(n.length!==r.length||n.slice(0,-1).join(`.`)!==r.slice(0,-1).join(`.`))return null;let i=[];for(let t=n[n.length-1];t<=r[r.length-1];t++){let r=Ul(e,t-n[n.length-1]);if(!this.para(r))return null;i.push(r)}return i}prev(e){let t=Iu(e).pop(),n=Ul(e,-1);return t>0&&this.para(n)?n:void 0}next(e){let t=Ul(e,1);return this.para(t)?t:void 0}cmp(e,t){let n=Iu(e),r=Iu(t);for(let e=0;e<Math.min(n.length,r.length);e++)if(n[e]!==r[e])return n[e]-r[e];return n.length-r.length}all(){let e=-1,t=-1;return this.st.blocks.forEach((n,r)=>{this.para(String(r))&&(e<0&&(e=r),t=r)}),e<0?null:{a:{pa:String(e),o:0},f:{pa:String(t),o:Vl(this.para(String(t)).runs)}}}selectAll(){this.input.selectAll()}deleteAcross(e,t){let n=Iu(e.pa),r=Iu(t.pa);if(n.length!==1||r.length!==1||n[0]>=r[0])return null;let i=this.para(e.pa),a=this.para(t.pa);if(!i||!a)return null;let o=(e,t)=>this.st.blocks[e]?.t===`p`&&this.st.blocks[e].pid===t.pid;if(o(n[0]-1,i)||o(r[0]+1,a))return null;let s=ql([...Jl(i.runs,e.o)[0],...Jl(a.runs,t.o)[1]]),c=this.st.blocks.slice(n[0]+1,r[0]).filter(e=>e.t===`sect`);return this.replaceBlocks(n[0],r[0]-n[0]+1,[this.join(i,a,s),...c],{a:e,f:e}),e}withRuns(e,t){return{...e,runs:t,edited:!0}}origOf(e){return e.orig??(e.pid===(e.from??e.pid)?[e.pid]:[])}defaultRun(e){if(e.caret)return{...e.caret,text:``};let t=[...e.runs].reverse().find(e=>e.t===`text`);return t?{...t,text:``}:{t:`text`,s:{sz:e.markSz,font:e.markFont}}}split(e,t,n,r){let i=e.keepSect??e.pid===(e.from??e.pid),a={...e,runs:t,edited:!0,keepSect:!1},o={...e,runs:n,pid:this.nextPid++,from:e.from??e.pid,orig:[],edited:!0,keepSect:i,pb:!1,ver:0,caret:n.length?void 0:Yl(t,Vl(t))??e.caret};if(r){let t=this.styles.find(t=>t.id===e.sid)?.next;t&&t!==e.sid&&(o.pd={...o.pd??{},style:t},o.sid=t)}return[a,o]}join(e,t,n){return{...e,runs:n,edited:!0,orig:[...this.origOf(e),...this.origOf(t)],keepSect:(e.keepSect??e.pid===(e.from??e.pid))||(t.keepSect??t.pid===(t.from??t.pid))}}splice(e,t,n){let r=this.container(e);if(!r.cell)return this.st.blocks.splice(r.at,t,...n),this.st.blocks;let[i,a,o]=r.cell,s=this.st.blocks[i],c=[...r.list];c.splice(r.at,t,...n);let l={...s,rows:s.rows.map((e,t)=>t===a?{...e,cells:e.cells.map((e,t)=>t===o?{...e,blocks:c}:e)}:e)};return this.st.heights.set(l,this.st.heights.get(s)??0),this.st.dirty.add(l),this.st.blocks[i]=l,c}replace(e,t,n,r={}){let i=e.map(e=>this.para(e));if(i.some(e=>!e))return;r.remount&&(t=t.map(e=>({...e,ver:(e.ver??0)+1})));let a=this.container(e[0]),o=a.at,s=this.splice(e[0],e.length,t),c=i[i.length-1],l=t[t.length-1];if(l&&c.pid!==l.pid)for(let e=o+t.length;e<s.length;e++){let t=s[e];if(t.t!==`p`||t.pid!==c.pid||!t.pb)break;s[e]={...t,pid:l.pid,from:l.from??l.pid,edited:!0}}if(!a.cell){t.forEach((e,t)=>{this.st.heights.set(e,this.st.heights.get(i[t]??i[0])??0),this.st.dirty.add(e)});for(let e of[o-1,o+t.length])s[e]&&this.st.dirty.add(s[e]);o<this.st.frontier&&(this.st.frontier=Math.max(0,this.st.frontier+t.length-e.length))}if(r.history!==!1){let a=Date.now(),o=this.history[this.history.length-1],s=r.label??`edit`,c=this.input.lastSel??n;s===`type`&&o?.label===`type`&&e.length===1&&t.length===1&&o.after.length===1&&o.pas[0]===e[0]&&a-o.t<1500?(o.after=t,o.selAfter=n,o.t=a):(this.history.push({pas:e,before:i,after:t,selBefore:c,selAfter:n,label:s,t:a}),this.history.length>500&&this.history.shift()),this.future=[]}this.commit(e[0],i,t,r.want),this.onCommit?.({kind:`paras`,before:i,next:t}),this.pendingSel=n,this.onDirty?.(),this.changed(),this.emitState(n)}partsOf(e,t,n){let r=n;for(;r>0&&e[r-1].pid===t&&e[r-1].t===`p`;)r--;let i=[];for(;r<e.length&&e[r].t===`p`&&e[r].pid===t;r++)i.push(e[r]);return i}commit(e,t,n,r){let i=this.container(e);if(i.cell&&this.st.blocks[i.cell[0]].tid!==void 0){this.commitTable(i.cell[0]);return}let a=i.list,o=[];n.forEach(e=>e.pid!==void 0&&!o.includes(e.pid)&&o.push(e.pid));let s=o.map(e=>{let t=i.at+n.findIndex(t=>t.pid===e);return bu(this.partsOf(a,e,t))}),c=[];for(let e of t){if(e.pid===void 0||o.includes(e.pid)||c.includes(e.pid))continue;let t=a.findIndex(t=>t.t===`p`&&t.pid===e.pid);t>=0?s.push(bu(this.partsOf(a,e.pid,t))):c.push(e.pid)}let l=t[0].pid,u=r||n.some(e=>e.pd!==t.find(t=>t.pid===e.pid)?.pd),d=new Set(n),f={anchor:l,list:s,remove:c,want:u};this.inflight++,this.client.call(`docx.edit`,f).then(e=>this.applyResult(e,d)).catch(e=>console.error(`[office-engine] edit failed`,e)).finally(()=>this.inflight--)}get busy(){return this.inflight>0}locate(e){let t=[];return this.st.blocks.forEach((n,r)=>{n.t===`p`&&n.pid===e?t.push({list:this.st.blocks,index:r,pa:String(r)}):n.t===`tbl`&&n.rows.forEach((n,i)=>n.cells.forEach((n,a)=>n.blocks.forEach((o,s)=>{o.t===`p`&&o.pid===e&&t.push({list:n.blocks,index:s,pa:`${r}.${i}.${a}.${s}`})})))}),t}put(e,t){let n=this.container(e);if(!n)return;let r=n.list[n.at];this.splice(e,1,[t]),n.cell||(this.st.heights.set(t,this.st.heights.get(r)??0),this.st.dirty.add(t))}applyResult(e,t){if(this.input.isComposing)return;let n=!1;for(let[r,i]of Object.entries(e.blocks)){let e=this.locate(Number(r)),a=i.filter(e=>e.t===`p`);e.length&&a.length===e.length&&e.every(e=>t.has(e.list[e.index]))&&(e.forEach((e,t)=>{let n=e.list[e.index];this.put(e.pa,{...a[t],from:n.from,orig:n.orig,pd:n.pd,edited:n.edited,keepSect:n.keepSect,ver:n.ver,pb:n.pb})}),n=!0)}for(let[t,r]of Object.entries(e.markers))for(let e of this.locate(Number(t))){let t=e.list[e.index];e.list[e.index-1]?.pid!==t.pid&&(this.put(e.pa,{...t,marker:r?{text:r.text,s:r.s,tab:r.tab}:void 0,lst:r?.lst}),n=!0)}n&&this.changed()}whereNow(e,t){let n=e[0];if(!n)return t;if(n.t===`p`)return n.pid===void 0?void 0:this.locate(n.pid)[0]?.pa;if(n.t===`tbl`){let e=this.st.blocks.findIndex(e=>e.t===`tbl`&&(n.tid!==void 0&&e.tid===n.tid||n.item!==void 0&&e.item===n.item));return e>=0?String(e):void 0}return t}keepCurrent(e,t,n){let r=new Map(this.st.blocks.slice(t,t+n).flatMap(e=>e.t===`p`&&e.pid!==void 0?[[e.pid,e]]:[]));return e.map(e=>e.t===`p`&&e.pid!==void 0&&r.has(e.pid)?r.get(e.pid):e)}undo(){let e=this.history.pop();if(!e)return;if(e.blocks){let t=this.whereNow(e.blocks.after,String(e.blocks.bi));if(t===void 0)return;this.replaceBlocks(Number(t),e.blocks.after.length,this.keepCurrent(e.blocks.before,Number(t),e.blocks.after.length),e.selBefore,!1),this.future.push(e);return}let t=this.whereNow(e.after,e.pas[0]);if(t===void 0)return;let n=e.after.map((e,n)=>Ul(t,n));n.some((t,n)=>this.para(t)?.pid!==e.after[n].pid)||(this.replace(n.length?n:[t],e.before,Lu(e.selBefore,e.pas[0],t),{history:!1,label:`undo`,want:!0}),this.future.push(e))}redo(){let e=this.future.pop();if(!e)return;if(e.blocks){let t=this.whereNow(e.blocks.before,String(e.blocks.bi));if(t===void 0)return;this.replaceBlocks(Number(t),e.blocks.before.length,this.keepCurrent(e.blocks.after,Number(t),e.blocks.before.length),e.selAfter,!1),this.history.push(e);return}let t=this.whereNow(e.before,e.pas[0]);if(t===void 0)return;let n=e.before.map((e,n)=>Ul(t,n));n.some((t,n)=>this.para(t)?.pid!==e.before[n].pid)||(this.replace(n,e.after,Lu(e.selAfter,e.pas[0],t),{history:!1,label:`redo`,want:!0}),this.history.push(e))}get canUndo(){return this.history.length>0}get canRedo(){return this.future.length>0}pendingStyle(){return this.pend?{s:this.pend.s,d:this.pend.d}:void 0}clearPending(){this.pend=null}selectedParas(e){let[t,n]=tu(this,e),r=t.pa===n.pa?this.para(t.pa)?[t.pa]:null:this.span(t.pa,n.pa);return r?{pas:r,s:t,e:n}:null}format(e,t,n={}){let r=this.input.sel();if(!r)return;if(Hl(r)){this.pend={s:{...this.pend?.s??{},...e},d:{...this.pend?.d??{},...t},at:r.a},this.input.restore(r),this.emitState(r);return}let i=this.selectedParas(r);if(!i)return;let a=i.pas.map((n,r)=>{let a=this.para(n),o=r===0?i.s.o:0,s=r===i.pas.length-1?i.e.o:Vl(a.runs);return this.withRuns(a,Ql(a.runs,o,s,e,t))});this.replace(i.pas,a,r,{label:`format`,want:n.want})}toggle(e){let t=this.state(),n=!(t&&t[e]);e===`u`?this.format({u:n?`single`:`none`},{u:n?`single`:`none`}):this.format({[e]:n},{[e]:n})}setFont(e){this.format({font:$e(e)},{font:e})}setSize(e){this.format({sz:e},{sz:e})}setColor(e){this.format({color:e??void 0},{color:e})}setHighlight(e){this.format({hl:e??void 0,shd:void 0},{hl:e})}clearFormat(){this.format({b:!1,i:!1,u:`none`,strike:!1,hl:void 0},{b:!1,i:!1,u:`none`,strike:!1,color:null,hl:null,va:null},{want:!0})}setPara(e,t={},n=this.input.sel()){if(!n)return;let r=this.selectedParas(n);if(!r)return;let i=r.pas.map(n=>{let r=this.para(n),i={...r.pd??{},...e};return{...r,pd:i,ps:{...r.ps,...t},edited:!0,sid:e.style??r.sid}});this.replace(r.pas,i,n,{label:`para`,want:!0})}toggleList(e){let t=this.input.sel();if(!t)return;let n=this.selectedParas(t);if(!n)return;let r=n.pas.every(t=>this.para(t)?.lst===e);this.setPara({list:r?`none`:e,ilvl:r?void 0:0},{},t)}indent(e,t=this.input.sel()){if(!t)return;let n=this.selectedParas(t);if(!n)return;let r=n.pas.map(t=>{let n=this.para(t),r={...n.pd??{}};return n.lst?r.ilvl=Math.max(0,Math.min(8,(n.ilvl??0)+e)):r.indL=Math.max(0,(n.ps.indL??0)+e*36),{...n,pd:r,ps:n.lst?n.ps:{...n.ps,indL:r.indL},edited:!0}});this.replace(n.pas,r,t,{label:`para`,want:!0})}tab(e,t){if(e.f.pa.includes(`.`)){let[n,r,i]=e.f.pa.split(`.`).map(Number),a=this.st.blocks[n].rows.flatMap((e,t)=>e.cells.map((e,n)=>[t,n])),o=a.findIndex(([e,t])=>e===r&&t===i)+(t?-1:1);if(o>=a.length&&!t)return this.tableOp(`rowBelow`),!0;let[s,c]=a[Math.max(0,o)],l=`${n}.${s}.${c}.0`,u=this.para(l);return this.input.restore({a:{pa:l,o:0},f:{pa:l,o:u?Vl(u.runs):0}}),!0}return this.para(e.a.pa)?.lst?(this.indent(t?-1:1,e),!0):!1}backspaceAtStart(e,t){return t.lst?(this.setPara({list:`none`},{},{a:{pa:e,o:0},f:{pa:e,o:0}}),!0):!1}prevParaPid(e){for(let t=e-1;t>=0;t--){let e=this.st.blocks[t];if(e.t===`p`&&e.pid!==void 0)return e.pid}}tableSpec(e){return{tid:e.tid,item:e.item,cols:e.cols,rows:e.rows.map(e=>({src:e.src,cells:e.cells.map(e=>({src:e.src,colSpan:e.colSpan,rowSpan:e.rowSpan,paras:e.blocks.filter(e=>e.t===`p`&&e.pid!==void 0).map(e=>bu([e]))}))}))}}commitTable(e){let t=this.st.blocks[e];t?.t===`tbl`&&t.tid!==void 0&&this.send(`docx.table`,{tid:t.tid,item:t.item,anchor:t.item===void 0?this.prevParaPid(e):void 0,spec:this.tableSpec(t)})}send(e,t){this.inflight++,this.client.call(e,t).then(t=>e===`docx.edit`&&this.applyResult(t,new Set)).catch(e=>console.error(`[office-engine] edit failed`,e)).finally(()=>this.inflight--)}replaceBlocks(e,t,n,r,i=!0){let a=this.st.blocks.slice(e,e+t);this.st.blocks.splice(e,t,...n),n.forEach((e,t)=>{this.st.heights.set(e,this.st.heights.get(a[t]??a[0])??0),this.st.dirty.add(e)}),e<this.st.frontier&&(this.st.frontier=Math.max(0,this.st.frontier+n.length-t));let o=e=>e.t===`tbl`?`t${e.tid??`i`+e.item}`:e.t===`p`?`p${e.pid}`:``,s=new Set(n.map(o)),c=new Set(a.map(o)),l=[...a,...n].find(e=>e.t===`p`&&e.pid!==void 0&&c.has(o(e))&&s.has(o(e))),u=n.filter(e=>e.t===`p`&&e.pid!==void 0&&!c.has(o(e))),d=a.filter(e=>e.t===`p`&&e.pid!==void 0&&!s.has(o(e))),f=new Map(a.map(e=>[o(e),e])),p=n.some(e=>e.t===`p`&&e.pid!==void 0&&f.has(o(e))&&f.get(o(e))!==e);if(l&&(u.length||d.length||p)){let e=n.filter(e=>e.t===`p`&&e.pid!==void 0);this.send(`docx.edit`,{anchor:l.pid,list:e.map(e=>bu([e])),remove:d.map(e=>e.pid)})}for(let e of a)e.t!==`tbl`||s.has(o(e))||e.tid===void 0&&e.item===void 0||this.send(`docx.table`,{tid:e.tid??-1,item:e.item,spec:null});if(n.forEach((t,n)=>{t.t===`tbl`&&(t.tid===void 0&&!c.has(o(t))&&(this.st.blocks[e+n]={...t,tid:this.nextPid++}),this.commitTable(e+n))}),this.onCommit?.({kind:`blocks`,bi:e,before:a,next:n}),i){let t=r??this.input.lastSel??{a:{pa:String(e),o:0},f:{pa:String(e),o:0}};this.history.push({pas:[],before:[],after:[],blocks:{bi:e,before:a,after:n},selBefore:this.input.lastSel??t,selAfter:t,label:`table`,t:Date.now()}),this.future=[]}r&&(this.pendingSel=r),this.onDirty?.(),this.changed()}emptyPara(e){return{t:`p`,ps:{...e.ps,indFirst:void 0,indL:void 0},runs:[],markSz:e.markSz,markFont:e.markFont,pid:this.nextPid++,from:e.from??e.pid,orig:[],edited:!0,keepSect:!1,pd:{style:``,list:`none`},sid:void 0}}insertTable(e,t){let n=this.input.sel(),r=n?Number(n.f.pa.split(`.`)[0]):-1,i=this.st.blocks[r];if(!n||n.f.pa.includes(`.`)||i?.t!==`p`||i.pid===void 0)return;let a=[i,{...Fu(e,t,this.contentW,()=>this.emptyPara(i)),tid:this.nextPid++}],o=this.st.blocks[r+1];o&&o.t===`p`||a.push(this.emptyPara(i)),this.replaceBlocks(r,1,a,{a:{pa:`${r+1}.0.0.0`,o:0},f:{pa:`${r+1}.0.0.0`,o:0}})}tableOp(e){let t=this.input.sel();if(!t||!t.f.pa.includes(`.`))return;let[n,r,i]=t.f.pa.split(`.`).map(Number),a=this.st.blocks[n];if(a?.t!==`tbl`)return;let o=Ou(a).cells.find(e=>e.ri===r&&e.ci===i)?.g??0,s=e=>{let t=e.blocks.find(e=>e.t===`p`)??this.st.blocks.find(e=>e.t===`p`&&e.pid!==void 0);return{...this.emptyPara(t),pd:{},ps:t.ps,sid:t.sid}},c=a,l=`${n}.${r}.${i}.0`;switch(e){case`rowAbove`:c=ju(a,r,!1,s),l=`${n}.${r}.0.0`;break;case`rowBelow`:c=ju(a,r,!0,s),l=`${n}.${r+1}.0.0`;break;case`colLeft`:c=Nu(a,o,!1,s);break;case`colRight`:c=Nu(a,o,!0,s),l=`${n}.${r}.${i+1}.0`;break;case`delRow`:c=Mu(a,r),l=`${n}.${Math.max(0,Math.min(r,(c?.rows.length??1)-1))}.0.0`;break;case`delCol`:c=Pu(a,o),l=`${n}.${r}.${Math.max(0,i-1)}.0`;break;case`delTable`:c=null}if(c)c={...c,tid:a.tid??this.nextPid++},this.replaceBlocks(n,1,[c],{a:{pa:l,o:0},f:{pa:l,o:0}});else{let e=this.st.blocks[n+1];this.replaceBlocks(n,1,[],e?.t===`p`?{a:{pa:String(n),o:0},f:{pa:String(n),o:0}}:null)}}async insertImages(e,t){let n=t??this.input.sel();if(!n)return;let r=[];for(let t of e){let e=(t.type.split(`/`)[1]??`png`).replace(`svg+xml`,`svg`).replace(`jpeg`,`jpg`),{rid:n,path:i}=await this.client.call(`docx.image`,await t.arrayBuffer(),e),a=await zu(t),o=Math.min(1,this.contentW/Math.max(1,a.w*.75));r.push({t:`img`,target:i,w:+(a.w*.75*o).toFixed(1),h:+(a.h*.75*o).toFixed(1),rid:n})}su(this,n,[r],{label:`image`})}async setLink(e){let t=this.input.sel();if(!t)return;if(!e){this.patchRuns(t,e=>({...e,href:void 0,lk:void 0}));return}let n=/^[a-z][\w+.-]*:/i.test(e)||e.startsWith(`#`)?e:`https://`+e,r=await this.client.call(`docx.link`,n),i={color:`#0563c1`,u:`single`};Hl(t)?su(this,t,[[{t:`text`,text:e,href:n,lk:r,s:{...Yl(this.para(t.a.pa)?.runs??[],t.a.o)?.s??{},...i},d:i}]],{label:`link`}):this.patchRuns(t,e=>({...e,href:n,lk:r,s:{...e.s??{},...i},d:{...e.d??{},...i}}))}patchRuns(e,t){let n=this.selectedParas(e);if(!n)return;let r=n.pas.map((e,r)=>{let i=this.para(e),a=r===0?n.s.o:0,o=r===n.pas.length-1?n.e.o:Vl(i.runs),[s,c]=Jl(i.runs,a),[l,u]=Jl(c,o-a);return this.withRuns(i,[...s,...l.map(e=>e.t===`text`?t(e):e),...u])});this.replace(n.pas,r,e,{label:`format`})}insertPageBreak(){let e=this.input.sel();if(!e)return;let t=this.para(e.f.pa);if(!t||e.f.pa.includes(`.`))return;let[n,r]=Jl(t.runs,e.f.o),[i,a]=this.split(t,n,r,!1),o={...a,pb:!0,pd:{...a.pd??{},pageBreak:!0}};this.replace([e.f.pa],[i,o],{a:{pa:Ul(e.f.pa,1),o:0},f:{pa:Ul(e.f.pa,1),o:0}},{label:`pagebreak`,want:!0})}resizeImage(e){let t=this.input.sel();if(!t)return;let[n]=tu(this,t);this.patchObjects(t,t=>{if(t.t!==`img`)return t;let n=e===`fit`?this.contentW/t.w:e;return{...t,w:+(t.w*n).toFixed(1),h:+(t.h*n).toFixed(1),resized:!0}}),this.pendingSel={a:n,f:{...n,o:n.o+1}}}patchObjects(e,t){let[n,r]=tu(this,e),i=this.para(n.pa);if(!i||n.pa!==r.pa)return;let[a,o]=Jl(i.runs,n.o),[s,c]=Jl(o,r.o-n.o);this.replace([n.pa],[this.withRuns(i,[...a,...s.map(t),...c])],e,{label:`image`})}pasteRich(e,t){let n=Array.from(t.files??[]).filter(e=>e.type.startsWith(`image/`));if(n.length)return this.insertImages(n,e),!0;let r=t.getData(`text/html`);if(!r)return!1;let i=Du(r);return i.length?((async()=>{let t=new Map;for(let e of i)for(let n of e.runs)n.t===`text`&&n.href&&!t.has(n.href)&&t.set(n.href,await this.client.call(`docx.link`,n.href));let n=i.map(e=>e.runs.map(e=>e.t===`text`&&e.href?{...e,lk:t.get(e.href)}:e)),r=e=>this.styles.find(t=>t.name.toLowerCase()===`heading ${e}`)?.id,a=i.map(e=>{if(e.heading||e.list)return t=>{let n={...t.pd??{}},i=e.heading?r(e.heading):void 0;return i&&(n.style=i),e.list&&(n.list=e.list),{...t,pd:n,sid:i??t.sid,edited:!0}}});su(this,e,n,{label:`paste`},a)})(),!0):!1}async applyCanon(e){let t=this.input.sel();if(!t)return;let n=this.styles.find(t=>t.canon===e)?.id;if(!n){let t=await this.client.call(`docx.style`,e);this.styles=t.styles,this.onStyles?.(t.styles),n=t.id}n&&this.setPara({style:n},{},t)}selectObject(e,t){let n={a:{pa:e,o:t},f:{pa:e,o:t+1}};this.input.restore(n),this.onSelection(n)}imageSel(){let e=this.input.sel(),t=e&&this.state(e)?.img;return t?{a:{pa:t.pa,o:t.o},f:{pa:t.pa,o:t.o+1}}:null}patchImage(e){let t=this.imageSel();t&&(this.patchObjects(t,t=>t.t===`img`?e(t):t),this.pendingSel=t)}setImageSize(e,t){this.patchImage(n=>({...n,w:+Math.max(4,e).toFixed(1),h:+Math.max(4,t).toFixed(1),resized:!0}))}imageOriginal(e,t){let n=Math.min(1,this.contentW/Math.max(1,e*.75));this.setImageSize(e*.75*n,t*.75*n)}setAltText(e){this.patchImage(t=>({...t,alt:e||void 0,altSet:!0}))}async replaceImage(e){let t=this.imageSel();if(!t)return;let n=(e.type.split(`/`)[1]??`png`).replace(`svg+xml`,`svg`).replace(`jpeg`,`jpg`),{rid:r,path:i}=await this.client.call(`docx.image`,await e.arrayBuffer(),n),a=await zu(e);this.input.restore(t),this.patchImage(e=>{let t=+(e.w*(a.h/Math.max(1,a.w))).toFixed(1);return{...e,target:i,rid:r,repl:!!e.src,h:t,resized:!0}})}deleteSelection(){let e=this.input.sel();e&&!Hl(e)&&cu(this,e,``)}insertText(e){let t=this.input.sel();t&&cu(this,t,e)}copyFormat(){if(this.painter){this.painter=null,this.onPainter?.(!1);return}let e=this.state();e&&(this.painter={b:e.b,i:e.i,u:e.u?`single`:`none`,strike:e.strike,color:e.color??null,hl:e.hl??null,va:e.va??null,sz:e.sz,font:e.font?/^\s*"?([^",]+)/.exec(e.font)?.[1]??e.font:void 0},this.onPainter?.(!0))}applyPainter(){let e=this.painter,t=this.input.readSel();if(!e||!t||Hl(t))return!1;this.painter=null,this.onPainter?.(!1);let n={};for(let[t,r]of Object.entries(e))t===`font`?n.font=r?$e(r):void 0:t===`u`?n.u=r:n[t]=r===null?void 0:r;return this.format(n,e),!0}state(e=this.input.sel()){if(!e)return null;let[t]=tu(this,e),n=this.para(t.pa);if(!n)return null;let r=Yl(n.runs,Hl(e)?t.o:t.o+ +(Vl(n.runs)>t.o)),i={...r?.s??{},...Hl(e)?this.pend?.s??{}:{}},[,a]=tu(this,e),o;if(t.pa===a.pa&&a.o===t.o+1){let[,e]=Jl(n.runs,t.o),r=e[0];r?.t===`img`&&(o={w:r.w,h:r.h,alt:r.alt,target:r.target,pa:t.pa,o:t.o})}return{line:n.pd?.line??(n.ps.lineRule===`auto`||!n.ps.lineRule?n.ps.line:void 0),va:i.va,link:r?.href,inTable:t.pa.includes(`.`),img:o,b:!!i.b,i:!!i.i,u:!!i.u&&i.u!==`none`,strike:!!i.strike,color:i.color,hl:i.hl,sz:i.sz??n.markSz??this.defaultSz,font:i.font??n.markFont??this.defaultFont,align:n.ps.align??`left`,style:n.sid,lst:n.lst,canUndo:this.canUndo,canRedo:this.canRedo}}emitState(e){let t=e?this.state(e):null;this.onState?.(t),this.onImage?.(t?.img??null)}onSelection(e){e&&this.pend&&(e.a.pa!==this.pend.at.pa||e.a.o!==this.pend.at.o)&&(this.pend=null),this.emitState(e)}};function zu(e){return new Promise(t=>{let n=URL.createObjectURL(e),r=new Image;r.onload=()=>{t({w:r.naturalWidth||300,h:r.naturalHeight||200}),URL.revokeObjectURL(n)},r.onerror=()=>{t({w:300,h:200}),URL.revokeObjectURL(n)},r.src=n})}var Bu=[`#ffff00`,`#00ff00`,`#00ffff`,`#ff00ff`,`#0000ff`,`#ff0000`,`#000080`,`#008080`,`#008000`,`#800080`,`#800000`,`#808000`,`#808080`,`#c0c0c0`,`#000000`],Vu=[{value:1,label:`Single`},{value:1.15,label:`1.15`},{value:1.5,label:`1.5`},{value:2,label:`Double`},{value:2.5,label:`2.5`},{value:3,label:`Triple`}],Hu=[{k:`normal`,label:`Normal text`,look:{}},{k:`title`,label:`Title`,look:{fontSize:22}},{k:`subtitle`,label:`Subtitle`,look:{fontSize:15,color:`#5a5a5a`}},{k:`h1`,label:`Heading 1`,look:{fontSize:18,color:`#2f5496`}},{k:`h2`,label:`Heading 2`,look:{fontSize:16,color:`#2f5496`}},{k:`h3`,label:`Heading 3`,look:{fontSize:14,color:`#1f3763`}},{k:`h4`,label:`Heading 4`,look:{fontSize:13,color:`#2f5496`,fontStyle:`italic`}},{k:`h5`,label:`Heading 5`,look:{fontSize:13,color:`#2f5496`}},{k:`h6`,label:`Heading 6`,look:{fontSize:13,color:`#1f3763`,fontStyle:`italic`}}],Uu=`©.®.™.§.¶.†.‡.•.….–.—.‰.€.£.¥.¢.₫.$.°.±.×.÷.≈.≠.≤.≥.∞.√.∑.∏.∫.π.µ.Ω.α.β.←.→.↑.↓.↔.⇒.✓.✗.★.☆.♥.♦.«.».“.”.‘.’.¼.½.¾.¹.².³`.split(`.`);function Wu(e){let t=e?.preview;if(t)return{fontSize:t.sz?Math.max(12,Math.min(22,t.sz)):void 0,fontWeight:t.b?700:void 0,fontStyle:t.i?`italic`:void 0,color:t.color&&!/^#?f{6}$/i.test(t.color.replace(`#`,``))?t.color:void 0,fontFamily:t.font,lineHeight:1.25}}function Gu(e){let{editor:t,styles:n,image:r}=e,[i,a]=(0,u.useState)(null);(0,u.useEffect)(()=>(t.onState=a,()=>{t.onState=void 0}),[t]);let o=Sl(i?.font),s=!i,c=i?.sz?Math.round(i.sz*2)/2:void 0,l=i?.line?Math.round(i.line*100)/100:``,d=/Mac|iPhone|iPad/.test(typeof navigator<`u`?navigator.platform:``)?`⌥`:`Alt+`,f=Hu.map(({k:e,label:t,look:r},i)=>{let a=n.find(t=>t.canon===e),o=e===`normal`?`${Q}${d}0`:e.startsWith(`h`)?`${Q}${d}${e.slice(1)}`:void 0;return{value:a?.id??`@${e}`,label:t,hint:o,style:{lineHeight:1.25,...e===`normal`?{}:Wu(a)??r},sep:i===1}});n.filter(e=>!e.canon).forEach((e,t)=>f.push({value:e.id,label:e.name,style:Wu(e),sep:t===0}));let p=i?.style&&f.some(e=>e.value===i.style)?i.style:i&&!i.style?n.find(e=>e.canon===`normal`)?.id??``:``;return(0,X.jsxs)(jl,{children:[(0,X.jsx)(Z,{icon:`undo`,title:`Undo (${Q}Z)`,disabled:!t.canUndo,onClick:()=>t.undo()}),(0,X.jsx)(Z,{icon:`redo`,title:`Redo (${Q}Y)`,disabled:!t.canRedo,onClick:()=>t.redo()}),(0,X.jsx)(Z,{icon:`paint`,title:`Paint format (click, then select text)`,active:e.painter,disabled:s,onClick:()=>t.copyFormat()}),i?.inTable&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Table`,label:`Table`,icon:`table`,items:[{value:`rowAbove`,label:`Insert row above`,icon:`rowAbove`},{value:`rowBelow`,label:`Insert row below`,icon:`rowBelow`},{value:`colLeft`,label:`Insert column left`,icon:`colLeft`},{value:`colRight`,label:`Insert column right`,icon:`colRight`},{value:`delRow`,label:`Delete row`,icon:`delRow`,sep:!0},{value:`delCol`,label:`Delete column`,icon:`delCol`},{value:`delTable`,label:`Delete table`,icon:`trash`}],onPick:e=>t.tableOp(e)})]}),i?.img&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`minus`,title:`Smaller`,onClick:()=>t.resizeImage(.8)}),(0,X.jsxs)(`span`,{className:`de-tb-hint`,style:{margin:0},children:[Math.round(i.img.w),`×`,Math.round(i.img.h),`pt`]}),(0,X.jsx)(Z,{icon:`plus`,title:`Larger`,onClick:()=>t.resizeImage(1.25)}),(0,X.jsx)(Z,{icon:`fit`,title:`Fit page width`,onClick:()=>t.resizeImage(`fit`)}),(0,X.jsx)(Z,{icon:`imgOrig`,title:`Original size`,onClick:r.original}),(0,X.jsx)(Z,{icon:`imgReplace`,title:`Replace image`,onClick:r.replace}),(0,X.jsx)(Z,{icon:`alt`,title:`Alt text`,active:!!i.img.alt,onClick:r.alt}),r.download&&(0,X.jsx)(Z,{icon:`save`,title:`Download image`,onClick:r.download}),(0,X.jsx)(Z,{icon:`trash`,title:`Delete image`,onClick:()=>t.deleteSelection()})]}),(0,X.jsx)(nl,{}),(0,X.jsx)(il,{title:`Paragraph style`,width:118,menuWidth:250,disabled:s,value:p,placeholder:`Style`,options:f,onChange:e=>e.startsWith(`@`)?void t.applyCanon(e.slice(1)):t.setPara({style:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(il,{title:`Font`,width:118,menuWidth:200,disabled:s,value:o,placeholder:`Font`,options:xl(o),onChange:e=>t.setFont(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(al,{value:c,disabled:s,onChange:e=>t.setSize(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bold`,title:`Bold (${Q}B)`,active:i?.b,disabled:s,onClick:()=>t.toggle(`b`)}),(0,X.jsx)(Z,{icon:`italic`,title:`Italic (${Q}I)`,active:i?.i,disabled:s,onClick:()=>t.toggle(`i`)}),(0,X.jsx)(Z,{icon:`underline`,title:`Underline (${Q}U)`,active:i?.u,disabled:s,onClick:()=>t.toggle(`u`)}),(0,X.jsx)(Z,{icon:`strike`,title:`Strikethrough`,active:i?.strike,disabled:s,onClick:()=>t.toggle(`strike`)}),(0,X.jsx)(vl,{icon:`color`,title:`Text color`,value:i?.color,onPick:e=>t.setColor(e),noneLabel:`Automatic`}),(0,X.jsx)(vl,{icon:`highlight`,title:`Highlight color`,value:i?.hl,palette:Bu,onPick:e=>t.setHighlight(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`link`,title:`Insert link (${Q}K)`,active:!!i?.link,disabled:s,onClick:e.onLink}),(0,X.jsx)(Z,{icon:`image`,title:`Insert image`,disabled:s,onClick:()=>void Dl().then(e=>void(e.length&&t.insertImages(e)))}),(0,X.jsx)(Tl,{icon:`table`,title:`Insert table`,disabled:s||i?.inTable,children:e=>(0,X.jsx)(El,{onPick:(n,r)=>(e(),t.insertTable(n,r))})}),(0,X.jsx)(Tl,{icon:`omega`,title:`Special characters`,disabled:s,children:e=>(0,X.jsx)(`div`,{className:`de-symbols`,children:Uu.map(n=>(0,X.jsx)(`button`,{type:`button`,title:`U+${n.codePointAt(0).toString(16).toUpperCase().padStart(4,`0`)}`,onClick:()=>(e(),t.insertText(n)),children:n},n))})}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`alignLeft`,title:`Align left`,active:i?.align===`left`,disabled:s,onClick:()=>t.setPara({align:`left`},{align:`left`})}),(0,X.jsx)(Z,{icon:`alignCenter`,title:`Center`,active:i?.align===`center`,disabled:s,onClick:()=>t.setPara({align:`center`},{align:`center`})}),(0,X.jsx)(Z,{icon:`alignRight`,title:`Align right`,active:i?.align===`right`,disabled:s,onClick:()=>t.setPara({align:`right`},{align:`right`})}),(0,X.jsx)(Z,{icon:`justify`,title:`Justify`,active:i?.align===`justify`,disabled:s,onClick:()=>t.setPara({align:`justify`},{align:`justify`})}),(0,X.jsx)(rl,{title:`Line & paragraph spacing`,icon:`lineSpacing`,label:null,menuWidth:150,disabled:s,value:l,options:Vu,onChange:e=>t.setPara({line:e},{line:e,lineRule:`auto`})}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bullets`,title:`Bulleted list`,active:i?.lst===`bullet`,disabled:s,onClick:()=>t.toggleList(`bullet`)}),(0,X.jsx)(Z,{icon:`numbers`,title:`Numbered list`,active:i?.lst===`number`,disabled:s,onClick:()=>t.toggleList(`number`)}),(0,X.jsx)(Z,{icon:`outdent`,title:`Decrease indent (Shift+Tab)`,disabled:s,onClick:()=>t.indent(-1)}),(0,X.jsx)(Z,{icon:`indent`,title:`Increase indent (Tab)`,disabled:s,onClick:()=>t.indent(1)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`sup`,title:`Superscript`,active:i?.va===`sup`,disabled:s,onClick:()=>t.format({va:i?.va===`sup`?void 0:`sup`},{va:i?.va===`sup`?null:`sup`})}),(0,X.jsx)(Z,{icon:`sub`,title:`Subscript`,active:i?.va===`sub`,disabled:s,onClick:()=>t.format({va:i?.va===`sub`?void 0:`sub`},{va:i?.va===`sub`?null:`sub`})}),(0,X.jsx)(Z,{icon:`pagebreak`,title:`Page break (${Q}Enter)`,disabled:s||i?.inTable,onClick:()=>t.insertPageBreak()}),(0,X.jsx)(Z,{icon:`clear`,title:`Clear formatting (${Q}\\)`,disabled:s,onClick:()=>t.clearFormat()}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`outline`,title:`Document outline`,active:e.outline,onClick:e.onOutline}),(0,X.jsx)(Z,{icon:`search`,title:`Find & replace (${Q}F)`,onClick:e.onFind})]})}function Ku(e){let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(``),[i,a]=(0,u.useState)(!!e.replace);return(0,u.useEffect)(()=>{t.current?.focus(),t.current?.select()},[]),(0,X.jsxs)(`div`,{className:`de-find`,role:`search`,onKeyDown:t=>t.key===`Escape`&&e.onClose(),children:[(0,X.jsxs)(`div`,{className:`de-find-row`,children:[(0,X.jsx)(`input`,{ref:t,value:e.query,placeholder:e.placeholder??`Find in document`,"aria-label":`Find`,onChange:t=>e.onQuery(t.target.value),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),e.onNav(t.shiftKey?-1:1))}}),(0,X.jsx)(`span`,{className:`de-find-count`,children:e.query?e.count?`${Math.min(e.index+1,e.count)} / ${e.count}`:`0 / 0`:``}),(0,X.jsx)(Z,{icon:`up`,title:`Previous (Shift+Enter)`,onClick:()=>e.onNav(-1),disabled:!e.count}),(0,X.jsx)(Z,{icon:`down`,title:`Next (Enter)`,onClick:()=>e.onNav(1),disabled:!e.count}),e.editable&&(0,X.jsx)(Z,{label:`⇄`,title:`Replace`,active:i,onClick:()=>a(e=>!e)}),(0,X.jsx)(Z,{icon:`close`,title:`Close (Esc)`,onClick:e.onClose})]}),e.options&&(0,X.jsx)(`div`,{className:`de-find-row de-find-opts`,children:e.options}),e.editable&&i&&(0,X.jsxs)(`div`,{className:`de-find-row`,children:[(0,X.jsx)(`input`,{value:n,placeholder:`Replace with`,"aria-label":`Replace with`,onChange:e=>r(e.target.value)}),(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,disabled:!e.count,onClick:()=>e.onReplace(n,!1),children:`Replace`}),(0,X.jsx)(`button`,{type:`button`,className:`de-btn`,disabled:!e.count,onClick:()=>e.onReplace(n,!0),children:`All`})]})]})}var qu=e=>e.map(e=>e.t===`text`||e.t===`ref`?e.s.vanish?``:e.text:``).join(``),Ju=e=>e.filter(e=>e.t===`p`).map(e=>qu(e.runs)).join(` `).replace(/\s+/g,` `).trim();function Yu(e){let t=[];for(let n of e)if(n.t===`p`)t.push((n.marker?n.marker.text+(n.marker.tab?` `:` `):``)+qu(n.runs));else if(n.t===`tbl`)for(let e of n.rows)t.push(e.cells.map(e=>Ju(e.blocks)).join(` `));return t.join(`
|
|
28
28
|
`)+`
|
|
29
|
-
`}var
|
|
30
|
-
`),o=a.trim();if(!o){n+=a;continue}let s=(i.s.b&&!t?`**`:``)+(i.s.i&&!t?`*`:``),c=i.s.strike?`~~`:``,l=a.slice(0,a.indexOf(o[0])),u=a.slice(a.lastIndexOf(o[o.length-1])+1);n+=`${l}${c}${s}${
|
|
31
|
-
`)}function
|
|
29
|
+
`}var Xu=e=>e.replace(/([\\`*_[\]<>])/g,`\\$1`);function Zu(e,t=!1){let n=``,r=0;for(;r<e.length;){let i=e[r];if(i.t!==`text`&&i.t!==`ref`){r++;continue}if(i.t===`text`&&i.href){let t=``,a=i.href;for(;r<e.length&&e[r].t===`text`&&e[r].href===a;)t+=e[r++].text;n+=`[${Xu(t)}](${a.replace(/[()\s]/g,encodeURIComponent)})`;continue}if(r++,i.s.vanish)continue;let a=i.text.replace(/\t/g,` `).replace(/\n/g,`
|
|
30
|
+
`),o=a.trim();if(!o){n+=a;continue}let s=(i.s.b&&!t?`**`:``)+(i.s.i&&!t?`*`:``),c=i.s.strike?`~~`:``,l=a.slice(0,a.indexOf(o[0])),u=a.slice(a.lastIndexOf(o[o.length-1])+1);n+=`${l}${c}${s}${Xu(o)}${[...s].reverse().join(``)}${c}${u}`}return n.replace(/\*\*\*\*/g,``)}function Qu(e){let t=e.rows.map(e=>e.cells.map(e=>Ju(e.blocks).replace(/\|/g,`\\|`)||` `));if(!t.length)return``;let n=Math.max(...t.map(e=>e.length)),r=e=>`| ${Array.from({length:n},(t,n)=>e[n]??` `).join(` | `)} |`;return[r(t[0]),`|${` --- |`.repeat(n)}`,...t.slice(1).map(r)].join(`
|
|
31
|
+
`)}function $u(e){let t=[],n=!1;for(let r of e){if(r.t===`tbl`){t.push(Qu(r),``),n=!1;continue}if(r.t!==`p`)continue;let e=r.ps.outline,i=e!==void 0&&e<6,a=Zu(r.runs,i).trim();if(r.marker){let e=/^[\da-zA-Z]{1,4}[.)]$/.test(r.marker.text.trim()),i=Math.max(0,Math.round(((r.ps.indL??36)-36)/36));!n&&t.length&&t[t.length-1]!==``&&t.push(``),t.push(`${` `.repeat(i)}${e?`1.`:`-`} ${a}`),n=!0}else n&&t.push(``),n=!1,a&&t.push(i?`${`#`.repeat(e+1)} ${a}`:a,``)}return t.join(`
|
|
32
32
|
`).replace(/\n{3,}/g,`
|
|
33
33
|
|
|
34
34
|
`).trim()+`
|
|
35
|
-
`}var
|
|
35
|
+
`}var ed=e=>e?e.paras.map(e=>(e.bullet?e.bullet.text+` `:``)+e.runs.map(e=>e.br?`
|
|
36
36
|
`:e.text).join(``)).filter(e=>e.trim()).join(`
|
|
37
|
-
`):``;function
|
|
37
|
+
`):``;function td(e){let t=[];for(let n of e){t.push(`Slide ${n.index+1}`,``);for(let e of n.els)if(e.t===`shape`){let n=ed(e.text);n&&t.push(n,``)}else if(e.t===`table`){for(let n of e.rows)t.push(n.cells.filter(e=>!e.hidden).map(e=>ed(e.text).replace(/\s+/g,` `)).join(` `));t.push(``)}n.notes?.trim()&&t.push(`Notes:`,n.notes.trim(),``),t.push(``)}return t.join(`
|
|
38
38
|
`).replace(/\n{3,}/g,`
|
|
39
39
|
|
|
40
40
|
`).trim()+`
|
|
41
|
-
`}function
|
|
41
|
+
`}function nd(e,t=`,`){let n=e=>e.includes(t)||/["\r\n]/.test(e)||/^\s|\s$/.test(e)?`"${e.replace(/"/g,`""`)}"`:e;return e.map(e=>e.map(n).join(t)).join(`\r
|
|
42
42
|
`)+`\r
|
|
43
|
-
`}var nd=e=>e?`${+e.toFixed(2)}pt`:void 0,rd={double:`double`,dotted:`dotted`,dottedHeavy:`dotted`,dash:`dashed`,dashedHeavy:`dashed`,dashLong:`dashed`,wave:`wavy`,wavyHeavy:`wavy`,wavyDouble:`wavy`};function id(e){let t={};if(!e)return t;e.b?t.fontWeight=700:e.b===!1&&(t.fontWeight=400),e.i?t.fontStyle=`italic`:e.i===!1&&(t.fontStyle=`normal`);let n=e.u&&e.u!==`none`,r=[n?`underline`:``,e.strike||e.dstrike?`line-through`:``].filter(Boolean).join(` `);return r?t.textDecoration=r:(e.u===`none`||e.strike===!1)&&(t.textDecoration=`none`),n&&rd[e.u]&&(t.textDecorationStyle=rd[e.u]),e.dstrike&&(t.textDecorationStyle=`double`),e.color&&(t.color=e.color),e.sz&&(t.fontSize=`${e.va?e.sz*.65:e.sz}pt`),e.font&&(t.fontFamily=e.font),(e.hl||e.shd)&&(t.background=e.hl??e.shd),e.va&&(t.verticalAlign=e.va===`sup`?`super`:`sub`),e.caps&&(t.textTransform=`uppercase`),e.smallCaps&&(t.fontVariant=`small-caps`),e.spacing&&(t.letterSpacing=`${e.spacing}pt`),t}function ad(e){return e.line?e.lineRule===`exact`?`${e.line}pt`:e.lineRule===`atLeast`?`max(${e.line}pt, 1.17em)`:+(e.line*1.17).toFixed(3):1.17}function od(e,t,n){return!e||e.t!==`p`||!e.ps.contextual?``:(t?.t===`p`&&t.sid===e.sid?`b`:``)+(n?.t===`p`&&n.sid===e.sid?`a`:``)}function sd(e,t){let n={paddingTop:t.includes(`b`)?void 0:nd(e.before),paddingBottom:t.includes(`a`)?void 0:nd(e.after),paddingLeft:nd(e.indL),paddingRight:nd(e.indR),textIndent:nd(e.indFirst),textAlign:e.align,lineHeight:ad(e)};e.shd&&(n.background=e.shd);let r=e=>e?`${e.w}pt ${e.style} ${e.color}`:void 0;return e.bTop&&(n.borderTop=r(e.bTop)),e.bBottom&&(n.borderBottom=r(e.bBottom)),e.bLeft&&(n.borderLeft=r(e.bLeft)),e.bRight&&(n.borderRight=r(e.bRight)),n}function cd({ctx:e,target:t,w:n,h:r,alt:i}){let a=qc(e.client,t,!e.measuring),o={width:`${n}pt`,height:`${r}pt`};return e.measuring||!a?(0,X.jsx)(`span`,{className:`de-img-missing`,style:{...o,borderStyle:`none`}}):a===`unsupported`?(0,X.jsxs)(`span`,{className:`de-img-missing`,style:o,title:t,children:[t.split(`.`).pop()?.toUpperCase(),` image`]}):(0,X.jsx)(`img`,{src:a,alt:i??``,style:{...o,verticalAlign:`bottom`,display:`inline-block`},draggable:!1})}function ld({x:e,ctx:t,o:n}){let r={"data-o":n,"data-obj":``,contentEditable:!t.editable&&void 0};switch(e.t){case`text`:{let r=(0,X.jsx)(`span`,{"data-o":n,style:id(e.s),children:e.text});return e.href&&!t.measuring&&!t.editable?(0,X.jsx)(`a`,{href:e.href,target:e.href.startsWith(`#`)?void 0:`_blank`,rel:`noreferrer noopener`,children:r}):r}case`field`:{let n=e.kind===`PAGE`?t.page>=0?t.page+1:1:t.pages||1;return(0,X.jsx)(`span`,{...r,style:id(e.s),children:n})}case`ref`:return(0,X.jsx)(`span`,{...r,style:id(e.s),children:e.text});case`img`:{let n=(0,X.jsx)(cd,{ctx:t,target:e.target,w:e.w,h:e.h,alt:e.alt});return(0,X.jsx)(`span`,{...r,children:e.href&&!t.measuring&&!t.editable?(0,X.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,children:n}):n})}case`box`:return(0,X.jsx)(`span`,{...r,className:`de-tbox`,style:{width:e.w?`${e.w}pt`:void 0,minHeight:e.h?`${e.h}pt`:void 0,background:e.fill,border:e.border},children:e.blocks.map((e,n)=>(0,X.jsx)(fd,{block:e,ctx:t},n))});case`shape`:return e.label?(0,X.jsx)(`span`,{...r,className:`de-ph`,style:{width:`${e.w}pt`,height:`${e.h}pt`},children:e.label}):(0,X.jsx)(`span`,{...r})}}function ud({p:e,ctx:t,pa:n,sp:r}){let i=e.ps.indFirst&&e.ps.indFirst<0?-e.ps.indFirst:0,a=e.runs.length>0,o=sd(e.ps,r);a||(o.fontSize=nd(e.markSz),e.markFont&&(o.fontFamily=e.markFont));let s=t.editable&&n!==void 0,c=0,l=e.runs.map((e,n)=>{let r=(0,X.jsx)(ld,{x:e,ctx:t,o:c},n);return c+=e.t===`text`?e.text.length:1,r});return(0,X.jsxs)(`div`,{className:`de-p`,style:o,"data-pa":n,contentEditable:t.editable&&!s?!1:void 0,children:[e.marker&&(0,X.jsxs)(`span`,{className:`de-marker`,contentEditable:!t.editable&&void 0,style:{...id(e.marker.s),minWidth:e.marker.tab&&i?`${i}pt`:void 0},children:[e.marker.text,e.marker.tab&&!i?` `:``]}),l,!a&&(s?(0,X.jsx)(`span`,{"data-o":0,"data-empty":``,children:``}):``)]})}function dd({t:e,ctx:t,pa:n}){let r=e.cols.reduce((e,t)=>e+t,0),i={width:r?`${r}pt`:`100%`};return e.align===`center`?i.margin=`0 auto`:e.align===`right`?i.marginLeft=`auto`:e.indL&&(i.marginLeft=`${e.indL}pt`),(0,X.jsxs)(`table`,{className:`de-tbl`,style:i,children:[r>0&&(0,X.jsx)(`colgroup`,{children:e.cols.map((e,t)=>(0,X.jsx)(`col`,{style:{width:`${e}pt`}},t))}),(0,X.jsx)(`tbody`,{children:e.rows.map((e,r)=>(0,X.jsx)(`tr`,{style:{height:e.h?`${e.h}pt`:void 0},children:e.cells.map((e,i)=>(0,X.jsx)(`td`,{colSpan:e.colSpan>1?e.colSpan:void 0,rowSpan:e.rowSpan>1?e.rowSpan:void 0,style:{borderTop:e.borders.t,borderRight:e.borders.r,borderBottom:e.borders.b,borderLeft:e.borders.l,background:e.shd,verticalAlign:e.vAlign,padding:`${e.pad[0]}pt ${e.pad[1]}pt ${e.pad[2]}pt ${e.pad[3]}pt`},children:e.blocks.map((a,o)=>(0,X.jsx)(fd,{block:a,ctx:t,pa:n!==void 0&&a.t===`p`&&a.pid!==void 0&&!a.ro?`${n}.${r}.${i}.${o}`:void 0,sp:od(a,e.blocks[o-1],e.blocks[o+1]),nested:!0},a.t===`p`?`${o}:${a.ver??0}`:o))},i))},r))})]})}var fd=(0,u.memo)(function({block:e,ctx:t,pa:n,sp:r=``,nested:i}){switch(e.t){case`p`:return(0,X.jsx)(ud,{p:e,ctx:t,pa:n,sp:r});case`tbl`:return(0,X.jsx)(`div`,{style:{overflow:`visible`},contentEditable:t.editable&&(i||n===void 0)?!1:void 0,children:(0,X.jsx)(dd,{t:e,ctx:t,pa:i?void 0:n})});default:return(0,X.jsx)(`div`,{})}}),pd=4/3,md=16,hd=24;function gd(e,t,n,r){let i=[],a={start:0,end:0,used:0};for(let o=0;o<n;o++){let n=e[o],s=t.get(n)??0;n.t===`sect`?(a.end=o+1,n.kind!==`continuous`&&(i.push(a),a={start:o+1,end:o+1,used:0})):((n.t===`p`&&n.pb&&a.end>a.start||a.used>0&&a.used+s>r)&&(i.push(a),a={start:o,end:o,used:0}),a.end=o+1,a.used+=s)}return(a.end>a.start||!i.length)&&i.push(a),i}var _d=new WeakSet;function vd(e,t,n){for(let r of e.querySelectorAll(`[data-pa="${t}"]`))for(let e of r.querySelectorAll(`[data-obj][data-o="${n}"]`))if(e.closest(`[data-pa]`)===r)return e.querySelector(`img`)??e;return null}var yd=[`nw`,`n`,`ne`,`e`,`se`,`s`,`sw`,`w`];function bd(e,t){let n=[];return e.forEach((e,r)=>{if(e.t!==`p`||e.pid===void 0)return;let i=!!t&&e.sid===t,a=i?0:e.ps.outline;if(a===void 0||a>5)return;let o=Wl(e.runs).trim();o&&n.push({bi:r,lvl:i?0:a+ +!!t,text:o})}),n}var xd=e=>!!e&&e.t===`p`&&e.pid!==void 0&&!e.ro;function Sd({client:e,onStatus:t,initialZoom:n=`fit`}){let r=kl(),i=(0,u.useRef)({blocks:[],heights:new WeakMap,dirty:new Set,frontier:0}).current,[a,o]=Wc(),[s,c]=(0,u.useState)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(n),[m,h]=Gc(),g=Kc(m),_=(0,u.useRef)(null),v=(0,u.useMemo)(()=>new Lu(e,i,o),[e,i,o]),y=r.editable&&!!l&&!l.error,[b,x]=(0,u.useState)({open:!1,q:``,idx:0}),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),[ee,O]=(0,u.useState)(!1),[te,ne]=(0,u.useState)(!1),[re,ie]=(0,u.useState)(null),[ae,oe]=(0,u.useState)(null),k=(0,u.useRef)(!1),se=(0,u.useRef)(null);(0,u.useEffect)(()=>(v.onImage=e=>ie(t=>t?.pa===e?.pa&&t?.o===e?.o&&t?.w===e?.w&&t?.h===e?.h&&t?.target===e?.target&&t?.alt===e?.alt?t:e),v.onStyles=e=>c(t=>t&&{...t,styles:e}),v.onPainter=ne,()=>{v.onImage=v.onStyles=v.onPainter=void 0}),[v]),(0,u.useEffect)(()=>l&&!l.error?Mc(e,`docx`,{editor:v,st:i}):void 0,[e,v,i,l]),(0,u.useEffect)(()=>{let t=[e.on(`docx:blocks`,e=>{for(let t of e)i.blocks.push(t);o()}),e.on(`docx:meta`,e=>{c(e),e.styles&&(v.styles=e.styles)}),e.on(`docx:done`,d)];return _d.has(e)||(_d.add(e),e.call(`docx.start`).catch(()=>{})),()=>t.forEach(e=>e())},[e,o,i,v]);let ce=s?.page??yt,A=ce.w-ce.ml-ce.mr,le=(ce.h-ce.mt-ce.mb)*pd,[ue,de]=(0,u.useState)(40),j=(0,u.useRef)(null),M=`${A}|${s?.font}|${s?.sz}`,N=(0,u.useRef)(M);N.current!==M&&(N.current=M,i.heights=new WeakMap,i.dirty.clear(),i.frontier=0);let fe=i.blocks.length,pe=[];for(let e of i.dirty){if(pe.length>=50)break;let t=i.blocks.indexOf(e);t<0?i.dirty.delete(e):pe.push({b:e,i:t})}let me=Math.min(fe,i.frontier+ue);for(let e=i.frontier;e<me;e++)pe.push({b:i.blocks[e],i:e});let he=performance.now(),ge=(0,u.useMemo)(()=>({client:e,page:-1,pages:0,measuring:!0,editable:!1}),[e]);Uc(()=>{let e=j.current;if(!e||!pe.length||!s)return;let t=Array.from(e.children).map(e=>e.getBoundingClientRect().height),n=performance.now()-he,r=setTimeout(()=>{pe.forEach((e,n)=>{i.heights.set(e.b,t[n]??0),i.dirty.delete(e.b)}),me>i.frontier&&(i.frontier=me),de(e=>n<10?Math.min(e*2,1500):n>30?Math.max(10,e>>1):e),o()},0);return()=>clearTimeout(r)});let P=(0,u.useMemo)(()=>gd(i.blocks,i.heights,Math.min(i.frontier,fe),le),[a,le,fe]),_e=ce.w*pd,ve=ce.h*pd,ye=h.w?Math.max(.2,Math.min(2,(h.w-48)/_e)):1,be=f===`fit`?Math.min(ye,1.25):f,xe=!!l&&i.frontier>=fe,F=P.map(e=>Math.max(ve,(ce.mt+ce.mb)*pd+e.used)*be),I=[],Se=hd;for(let e of F)I.push(Se),Se+=e+md;let Ce=+!xe,we=Se+Ce*(ve*be+md)+hd-md,Te=Math.max(h.w,_e*be+48),Ee=Math.max(hd,(Te-_e*be)/2),De=I.length?Jc(I,g.y-ve*be):0,Oe=I.length?Jc(I,g.y+h.h+200):-1,ke=xe?P.length:0,L=y&&v.input.lastSel?Number(v.input.lastSel.f.pa.split(`.`)[0]):-1,R=L>=0?P.findIndex(e=>L>=e.start&&L<e.end):-1;v.contentW=A,v.defaultFont=s?.font,v.defaultSz=s?.sz;let z=I.length?Jc(I,g.y+h.h/3)+1:0,[Ae,B]=(0,u.useState)(0);(0,u.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>{let e=0,t=n=>{if(n.t===`p`)e+=Wl(n.runs).split(/\s+/).filter(e=>/[\p{L}\p{N}]/u.test(e)).length;else if(n.t===`tbl`)for(let e of n.rows)for(let n of e.cells)n.blocks.forEach(t)};i.blocks.forEach(t),B(e)},600);return()=>clearTimeout(e)},[a,l,i]);let V=l?.error?`Error: ${l.error}`:xe?`Page ${z} of ${P.length} · ${Ae.toLocaleString()} words`:`Page ${z} of ${P.length}+ · loading…`;(0,u.useEffect)(()=>{let e=_.current;if(y&&e)return v.input.attach(e),v.onDirty=()=>r.setDirty(!0),()=>v.input.detach()},[y,v,r]),(0,u.useEffect)(()=>{v.shortcut=e=>{let t=e.metaKey||e.ctrlKey;if(t&&e.key.toLowerCase()===`s`)return r.save(),!0;if(t&&e.key.toLowerCase()===`f`)return x(e=>({...e,open:!0})),!0;if(t&&e.key===`Enter`)return v.insertPageBreak(),!0;if(t&&e.key.toLowerCase()===`k`)return Fe(),!0;if(t&&e.altKey&&/^Digit[0-6]$/.test(e.code)){let t=Number(e.code.slice(5));return v.applyCanon(t?`h${t}`:`normal`),!0}return t&&e.key===`\\`?(v.clearFormat(),!0):e.key===`Escape`&&v.painter?(v.copyFormat(),!0):!1}},[v,r]),Uc(()=>{let e=v.pendingSel;if(!e||!_.current)return;if(!v.input.restore(e)){let t=Number(e.f.pa.split(`.`)[0]),n=P.findIndex(e=>t>=e.start&&t<e.end);n>=0&&m.current&&(m.current.scrollTop=Math.max(0,I[n]-16)),(n<0||n>=De&&n<=Oe)&&(v.pendingSel=null);return}v.pendingSel=null;let t=hu(_.current),n=t?.rangeCount?t.getRangeAt(0):null,r=m.current;if(n&&r){let e=n.getBoundingClientRect(),t=r.getBoundingClientRect();e.height&&e.bottom>t.bottom-24?r.scrollTop+=e.bottom-t.bottom+48:e.height&&e.top<t.top+8&&(r.scrollTop-=t.top-e.top+48)}});let je=(0,u.useMemo)(()=>{let e=b.q.toLowerCase();if(!b.open||!e)return[];let t=[],n=(n,r,i)=>{let a=Wl(n.runs).toLowerCase();for(let n=a.indexOf(e);n>=0&&t.length<5e3;n=a.indexOf(e,n+e.length))t.push({pa:r,a:n,b:n+e.length,bi:i})};return i.blocks.forEach((e,t)=>{xd(e)?n(e,String(t),t):e.t===`tbl`&&e.rows.forEach((e,r)=>e.cells.forEach((e,i)=>e.blocks.forEach((e,a)=>xd(e)&&n(e,`${t}.${r}.${i}.${a}`,t))))}),t},[b.q,b.open,a]),Me=e=>{let t=je[e],n=m.current;if(!t||!n)return;let r=P.findIndex(e=>t.bi>=e.start&&t.bi<e.end);r>=0&&(n.scrollTop=Math.max(0,I[r]-16)),x(t=>({...t,idx:e})),requestAnimationFrame(()=>requestAnimationFrame(()=>{let e=_.current;if(!e)return;let r=mu(e,{pa:t.pa,o:t.a}),i=mu(e,{pa:t.pa,o:t.b});if(!r||!i)return;let a=document.createRange();a.setStart(r[0],r[1]),a.setEnd(i[0],i[1]);let o=a.getBoundingClientRect(),s=n.getBoundingClientRect();n.scrollTop+=o.top-s.top-s.height/3,y&&v.input.restore({a:{pa:t.pa,o:t.a},f:{pa:t.pa,o:t.b}},!1)}))};Uc(()=>{let e=globalThis.Highlight,t=CSS.highlights;if(!e||!t)return;let n=_.current;if(!n||!je.length){t.delete(`de-find`),t.delete(`de-find-cur`);return}let r=[],i;je.forEach((e,t)=>{if(e.bi<(P[De]?.start??0)||e.bi>=(P[Oe]?.end??0))return;let a=mu(n,{pa:e.pa,o:e.a}),o=mu(n,{pa:e.pa,o:e.b});if(!a||!o)return;let s=document.createRange();s.setStart(a[0],a[1]),s.setEnd(o[0],o[1]),t===b.idx?i=s:r.push(s)}),t.set(`de-find`,new e(...r)),i?t.set(`de-find-cur`,new e(i)):t.delete(`de-find-cur`)});let Ne=(e,t)=>su(v,{a:{pa:e.pa,o:e.a},f:{pa:e.pa,o:e.b}},t),Pe={fontFamily:s?.font,fontSize:s?`${s.sz}pt`:void 0};Al({printable:async()=>{if(!xe)throw Error(`The document is still loading — try again in a moment`);return{size:`${ce.w}pt ${ce.h}pt`,margin:`0`,node:P.map((t,n)=>(0,X.jsx)(`div`,{className:`de-print-page`,style:{width:`${ce.w}pt`,height:`${ce.h}pt`},children:(0,X.jsx)(Cd,{index:n,count:P.length,slice:t,blocks:i.blocks,meta:s,page:ce,top:0,left:0,height:ve,zoom:1,client:e,docStyle:Pe,editing:!1})},n))}},text:async e=>{if(!l)throw Error(`The document is still loading — try again in a moment`);return e===`md`?Qu(i.blocks):Ju(i.blocks)},stats:()=>{let e=0,t=0,n=r=>{if(r.t===`p`){let n=Wl(r.runs);e+=n.length,n.trim()&&t++}else if(r.t===`tbl`)for(let e of r.rows)for(let t of e.cells)t.blocks.forEach(n)};i.blocks.forEach(n);let r=xe?``:`+`;return[[`Pages`,P.length.toLocaleString()+r],[`Words`,Ae.toLocaleString()+r],[`Characters`,e.toLocaleString()+r],[`Paragraphs`,t.toLocaleString()+r],[`Page size`,`${+(ce.w/72).toFixed(2)} × ${+(ce.h/72).toFixed(2)} in`]]}});let Fe=()=>{let e=v.state()?.link;T({title:e?`Edit link`:`Insert link`,placeholder:`https://…`,initial:e,ok:`Apply`,onOk:e=>void v.setLink(e.trim()||null),extra:e?{label:`Remove`,run:()=>void v.setLink(null)}:void 0})},Ie=()=>{let e=v.state()?.img;e&&T({title:`Alt text`,label:`Describe the picture for screen readers`,initial:e.alt??``,area:!0,ok:`Save`,onOk:e=>v.setAltText(e.trim())})},Le=async e=>{let t=v.input.sel();if(t)try{if(!e&&navigator.clipboard?.read)for(let e of await navigator.clipboard.read()){let n=e.types.find(e=>e.startsWith(`image/`));if(n)return void v.insertImages([await e.getType(n)],t);if(e.types.includes(`text/html`)){let n=await(await e.getType(`text/html`)).text();if(v.pasteRich(t,{files:[],getData:e=>e===`text/html`?n:``}))return}}let n=await navigator.clipboard.readText();n&&su(v,t,n)}catch{D(`The browser blocked clipboard access — use ${Q}V to paste`)}},Re=e=>{document.execCommand(e)||D(`Use ${Q}${e===`copy`?`C`:`X`}`)},ze=()=>void Dl().then(e=>void(e.length&&v.insertImages(e))),Be=()=>re&&_.current?vd(_.current,re.pa,re.o):null,Ve={original:()=>{let e=Be();e?.naturalWidth&&v.imageOriginal(e.naturalWidth,e.naturalHeight)},replace:()=>void Dl(`image/*`,!1).then(e=>e[0]&&v.replaceImage(e[0])),alt:Ie,download:r.canDownload?()=>{let e=Be();e?.src&&re&&fetch(e.src).then(e=>e.blob()).then(e=>Cl(e,re.target.split(`/`).pop()??`image`))}:void 0};Uc(()=>{if(k.current)return;let e=_.current,t=m.current,n=null;if(y&&re&&e&&t){let r=vd(e,re.pa,re.o);if(r){let e=r.getBoundingClientRect(),i=t.getBoundingClientRect();n={x:e.left-i.left+t.scrollLeft,y:e.top-i.top+t.scrollTop,w:e.width,h:e.height}}}oe(e=>e===n||e&&n&&e.x===n.x&&e.y===n.y&&e.w===n.w&&e.h===n.h?e:n)});let He=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=Be();if(!re||!ae||!n)return;let{w:r,h:i,x:a,y:o}=ae,s=re.w/Math.max(1,r),c=t.clientX,l=t.clientY,u=r,d=i;k.current=!0,se.current=s;let f=t=>{let f=t.clientX-c,p=t.clientY-l,m=r+(e.includes(`e`)?f:e.includes(`w`)?-f:0),h=i+(e.includes(`s`)?p:e.includes(`n`)?-p:0);if(e.length===2&&!t.shiftKey){let e=Math.max(m/r,h/i);m=r*e,h=i*e}let g=A/s*1;u=Math.max(8,Math.min(m,g*2)),d=Math.max(8,h),n.style.width=`${u*s}pt`,n.style.height=`${d*s}pt`,oe({x:a,y:o,w:u,h:d})},p=()=>{window.removeEventListener(`mousemove`,f),window.removeEventListener(`mouseup`,p),k.current=!1,se.current=null,u!==r||d!==i?v.setImageSize(u*s,d*s):oe(null)};window.addEventListener(`mousemove`,f),window.addEventListener(`mouseup`,p)},Ue=()=>{let e=v.state(),t=v.input.sel(),n=!!t&&(t.a.pa!==t.f.pa||t.a.o!==t.f.o),r=[];if(e?.img&&r.push({head:`Image`,label:`Original size`,icon:`imgOrig`,run:Ve.original},{label:`Fit to page width`,icon:`fit`,run:()=>v.resizeImage(`fit`)},{label:`Replace image…`,icon:`imgReplace`,run:Ve.replace},{label:`Alt text…`,icon:`alt`,run:Ie},...Ve.download?[{label:`Download image`,icon:`save`,run:Ve.download}]:[],{label:`Delete image`,icon:`trash`,run:()=>v.deleteSelection()}),r.push({label:`Cut`,icon:`cut`,hint:`${Q}X`,disabled:!n,run:()=>Re(`cut`),sep:r.length>0},{label:`Copy`,icon:`copy`,hint:`${Q}C`,disabled:!n,run:()=>Re(`copy`)},{label:`Paste`,icon:`paste`,hint:`${Q}V`,run:()=>void Le(!1)},{label:`Paste without formatting`,icon:`pastePlain`,hint:`${Q}⇧V`,run:()=>void Le(!0)},{label:`Delete`,icon:`trash`,disabled:!n||!!e?.img,run:()=>v.deleteSelection()}),e?.link?r.push({label:`Open link`,icon:`external`,sep:!0,run:()=>window.open(e.link,`_blank`,`noopener`)},{label:`Edit link…`,icon:`link`,hint:`${Q}K`,run:Fe},{label:`Remove link`,icon:`unlink`,run:()=>void v.setLink(null)}):r.push({label:`Insert link…`,icon:`link`,hint:`${Q}K`,sep:!0,run:Fe,disabled:!e}),e?.inTable){let e=e=>()=>v.tableOp(e);r.push({head:`Table`,label:`Insert row above`,icon:`rowAbove`,sep:!0,run:e(`rowAbove`)},{label:`Insert row below`,icon:`rowBelow`,run:e(`rowBelow`)},{label:`Insert column left`,icon:`colLeft`,run:e(`colLeft`)},{label:`Insert column right`,icon:`colRight`,run:e(`colRight`)},{label:`Delete row`,icon:`delRow`,run:e(`delRow`)},{label:`Delete column`,icon:`delCol`,run:e(`delCol`)},{label:`Delete table`,icon:`trash`,run:e(`delTable`)})}else r.push({label:`Insert image…`,icon:`image`,sep:!0,run:ze,disabled:!e},{label:`Insert table`,icon:`table`,run:()=>v.insertTable(3,3),disabled:!e},{label:`Page break`,icon:`pagebreak`,hint:`${Q}↵`,run:()=>v.insertPageBreak(),disabled:!e});return r.push({label:`Clear formatting`,icon:`clear`,hint:`${Q}\\`,sep:!0,run:()=>v.clearFormat(),disabled:!e},{label:`Select all`,icon:`selectAll`,hint:`${Q}A`,run:()=>document.execCommand(`selectAll`)}),r},We=s?.styles?.find(e=>e.canon===`title`)?.id,Ge=(0,u.useMemo)(()=>ee?bd(i.blocks,We):[],[ee,a,We]),Ke=P[Math.max(0,z-1)]?.start??0,qe=Ge.reduce((e,t,n)=>t.bi<=Math.max(Ke,L)?n:e,-1),H=e=>{let t=m.current,n=P.findIndex(t=>e>=t.start&&e<t.end);!t||n<0||(t.scrollTop=Math.max(0,I[n]-16),requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=_.current?.querySelector(`[data-pa="${e}"]`);n&&(t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-24),y&&v.input.restore({a:{pa:String(e),o:0},f:{pa:String(e),o:0}})})))};return(0,X.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,display:`flex`},children:[(0,X.jsxs)(`div`,{ref:m,className:`de-scroll`,tabIndex:-1,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`f`&&(e.preventDefault(),x(e=>({...e,open:!0})))},children:[s&&pe.length>0&&(0,X.jsx)(`div`,{ref:j,className:`de-measure de-doc`,style:{...Pe,width:`${A}pt`},children:pe.map(({b:e,i:t})=>(0,X.jsx)(fd,{block:e,ctx:ge,sp:od(e,i.blocks[t-1],i.blocks[t+1])},t))}),(0,X.jsxs)(`div`,{ref:_,className:y?`de-pages de-editing`:`de-pages`,style:{height:we,width:Te},contentEditable:y||void 0,suppressContentEditableWarning:!0,spellCheck:!1,onMouseDown:e=>{if(!y)return;let t=e.target,n=t.tagName===`IMG`?t.closest(`[data-obj]`):null,r=n&&_.current?pu(_.current,n,0):null;r&&(e.preventDefault(),v.selectObject(r.pa,r.o))},onMouseUp:()=>{v.painter&&setTimeout(()=>v.applyPainter(),0)},onContextMenu:e=>{y&&(e.preventDefault(),C({x:e.clientX,y:e.clientY}))},children:[P.map((t,n)=>(n<De||n>Oe)&&n!==R?null:(0,X.jsx)(Cd,{index:n,count:ke,slice:t,blocks:i.blocks,meta:s,page:ce,top:I[n],left:Ee,height:F[n],zoom:be,client:e,docStyle:Pe,editing:y},n)),Ce>0&&(0,X.jsx)(`div`,{className:`de-page-skeleton`,contentEditable:!1,style:{top:Se,left:Ee,width:_e*be,height:ve*be}})]}),ae&&(0,X.jsxs)(`div`,{className:`de-img-sel`,style:{left:ae.x,top:ae.y,width:ae.w,height:ae.h},children:[yd.map(e=>(0,X.jsx)(`span`,{className:`de-img-h de-img-${e}`,onMouseDown:t=>He(e,t)},e)),se.current&&(0,X.jsxs)(`span`,{className:`de-img-size`,children:[Math.round(ae.w*se.current),` × `,Math.round(ae.h*se.current),` pt`]})]})]}),ee&&(0,X.jsxs)(`nav`,{className:`de-outline`,"aria-label":`Document outline`,children:[(0,X.jsxs)(`div`,{className:`de-outline-head`,children:[(0,X.jsx)(`span`,{children:`Outline`}),(0,X.jsx)(`button`,{type:`button`,className:`de-tb`,title:`Close outline`,"aria-label":`Close outline`,onClick:()=>O(!1),children:`×`})]}),Ge.length?Ge.map((e,t)=>(0,X.jsx)(`button`,{type:`button`,className:t===qe?`de-outline-item on`:`de-outline-item`,style:{paddingLeft:10+e.lvl*14},onClick:()=>H(e.bi),children:e.text},e.bi)):(0,X.jsx)(`div`,{className:`de-outline-empty`,children:`Headings you add to the document will appear here.`})]}),b.open&&(0,X.jsx)(Gu,{query:b.q,index:b.idx,count:je.length,editable:y,onQuery:e=>x({open:!0,q:e,idx:0}),onNav:e=>je.length&&Me((b.idx+e+je.length)%je.length),onClose:()=>x({open:!1,q:b.q,idx:0}),onReplace:(e,t)=>{je.length&&(t?[...je].reverse().forEach(t=>Ne(t,e)):Ne(je[Math.min(b.idx,je.length-1)],e))}}),y&&(0,X.jsx)(Wu,{editor:v,styles:s?.styles??[],onFind:()=>x(e=>({...e,open:!0})),outline:ee,onOutline:()=>O(e=>!e),painter:te,onLink:Fe,image:Ve}),!y&&l&&(0,X.jsx)(`button`,{type:`button`,className:ee?`de-outline-toggle on`:`de-outline-toggle`,title:`Document outline`,onClick:()=>O(e=>!e),children:`☰`}),S&&(0,X.jsx)(Il,{x:S.x,y:S.y,items:Ue(),onClose:()=>C(null)}),w&&(0,X.jsx)(Ll,{spec:w,onClose:()=>T(null)}),E&&(0,X.jsx)(zl,{text:E,onDone:()=>D(null)}),(0,X.jsx)(Fl,{zoom:f,effective:be,onChange:p}),(0,X.jsx)(Nl,{text:V,onStatus:t})]})}function Cd({index:e,count:t,slice:n,blocks:r,meta:i,page:a,top:o,left:s,height:c,zoom:l,client:d,docStyle:f,editing:p}){let m=(0,u.useMemo)(()=>({client:d,page:e,pages:t,measuring:!1,editable:p}),[d,e,t,p]),h=(0,u.useMemo)(()=>({...m,editable:!1}),[m]),g=e===0&&i?.titlePg,_=g?i?.firstHeader:i?.header,v=g?i?.firstFooter:i?.footer,y=[];for(let e=n.start;e<n.end;e++){let t=r[e];y.push((0,X.jsx)(fd,{block:t,ctx:m,pa:xd(t)||t.t===`tbl`?String(e):void 0,sp:od(t,r[e-1],r[e+1])},`${e}:${t.t===`p`?t.ver??0:0}`))}return(0,X.jsx)(`div`,{className:`de-page`,style:{top:o,left:s,width:a.w*pd*l,height:c},"data-page":e+1,children:(0,X.jsxs)(`div`,{className:`de-page-inner de-doc`,style:{...f,width:`${a.w}pt`,height:c/l,zoom:l},children:[_&&(0,X.jsx)(`div`,{className:`de-hf`,contentEditable:!p&&void 0,style:{top:`${a.header}pt`,padding:`0 ${a.mr}pt 0 ${a.ml}pt`},children:_.map((e,t)=>(0,X.jsx)(fd,{block:e,ctx:h},t))}),(0,X.jsx)(`div`,{style:{position:`absolute`,top:`${a.mt}pt`,left:`${a.ml}pt`,width:`${a.w-a.ml-a.mr}pt`},children:y}),v&&(0,X.jsx)(`div`,{className:`de-hf`,contentEditable:!p&&void 0,style:{bottom:`${a.footer}pt`,padding:`0 ${a.mr}pt 0 ${a.ml}pt`},children:v.map((e,t)=>(0,X.jsx)(fd,{block:e,ctx:h},t))})]})})}var wd=[[`title`,`Title`],[`subject`,`Subject`],[`creator`,`Author`],[`keywords`,`Keywords`],[`description`,`Comments`],[`lastModifiedBy`,`Last modified by`],[`created`,`Created`],[`modified`,`Modified`]];async function Td(e){let t=await(await e.call(`part`,`docProps/core.xml`)).text(),n=new DOMParser().parseFromString(t,`application/xml`),r=[];for(let[e,t]of wd){let i=n.getElementsByTagNameNS(`*`,e)[0]?.textContent?.trim();if(!i)continue;let a=e===`created`||e===`modified`?new Date(i):null;r.push([t,a&&!isNaN(a.getTime())?a.toLocaleString():i])}return r}function Ed(e){let[t,n]=(0,u.useState)([]),r=(0,u.useRef)(null);(0,u.useEffect)(()=>{r.current?.focus();let t=!0;return Td(e.client).then(e=>t&&n(e),()=>{}),()=>{t=!1}},[e.client]);let i=[e.file,t,e.stats].filter(e=>e.length);return(0,X.jsx)(`div`,{className:`de-dialog-back`,onMouseDown:t=>t.target===t.currentTarget&&e.onClose(),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onClose())},children:(0,X.jsxs)(`div`,{className:`de-dialog`,role:`dialog`,"aria-label":`Document details`,children:[(0,X.jsx)(`div`,{className:`de-dialog-title`,children:`Document details`}),(0,X.jsx)(`dl`,{className:`de-details`,children:i.map((e,t)=>(0,X.jsxs)(u.Fragment,{children:[t>0&&(0,X.jsx)(`div`,{className:`de-details-sep`}),e.map(([e,t])=>(0,X.jsxs)(u.Fragment,{children:[(0,X.jsx)(`dt`,{children:e}),(0,X.jsx)(`dd`,{children:t})]},e))]},t))}),(0,X.jsx)(`div`,{className:`de-dialog-btns`,children:(0,X.jsx)(`button`,{ref:r,type:`button`,className:`de-btn de-btn-primary`,onClick:e.onClose,children:`Close`})})]})})}var Dd=`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,Od=`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,kd=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
44
|
-
`,
|
|
43
|
+
`}var rd=e=>e?`${+e.toFixed(2)}pt`:void 0,id={double:`double`,dotted:`dotted`,dottedHeavy:`dotted`,dash:`dashed`,dashedHeavy:`dashed`,dashLong:`dashed`,wave:`wavy`,wavyHeavy:`wavy`,wavyDouble:`wavy`};function ad(e){let t={};if(!e)return t;e.b?t.fontWeight=700:e.b===!1&&(t.fontWeight=400),e.i?t.fontStyle=`italic`:e.i===!1&&(t.fontStyle=`normal`);let n=e.u&&e.u!==`none`,r=[n?`underline`:``,e.strike||e.dstrike?`line-through`:``].filter(Boolean).join(` `);return r?t.textDecoration=r:(e.u===`none`||e.strike===!1)&&(t.textDecoration=`none`),n&&id[e.u]&&(t.textDecorationStyle=id[e.u]),e.dstrike&&(t.textDecorationStyle=`double`),e.color&&(t.color=e.color),e.sz&&(t.fontSize=`${e.va?e.sz*.65:e.sz}pt`),e.font&&(t.fontFamily=e.font),(e.hl||e.shd)&&(t.background=e.hl??e.shd),e.va&&(t.verticalAlign=e.va===`sup`?`super`:`sub`),e.caps&&(t.textTransform=`uppercase`),e.smallCaps&&(t.fontVariant=`small-caps`),e.spacing&&(t.letterSpacing=`${e.spacing}pt`),t}function od(e){return e.line?e.lineRule===`exact`?`${e.line}pt`:e.lineRule===`atLeast`?`max(${e.line}pt, 1.17em)`:+(e.line*1.17).toFixed(3):1.17}function sd(e,t,n){return!e||e.t!==`p`||!e.ps.contextual?``:(t?.t===`p`&&t.sid===e.sid?`b`:``)+(n?.t===`p`&&n.sid===e.sid?`a`:``)}function cd(e,t){let n={paddingTop:t.includes(`b`)?void 0:rd(e.before),paddingBottom:t.includes(`a`)?void 0:rd(e.after),paddingLeft:rd(e.indL),paddingRight:rd(e.indR),textIndent:rd(e.indFirst),textAlign:e.align,lineHeight:od(e)};e.shd&&(n.background=e.shd);let r=e=>e?`${e.w}pt ${e.style} ${e.color}`:void 0;return e.bTop&&(n.borderTop=r(e.bTop)),e.bBottom&&(n.borderBottom=r(e.bBottom)),e.bLeft&&(n.borderLeft=r(e.bLeft)),e.bRight&&(n.borderRight=r(e.bRight)),n}function ld({ctx:e,target:t,w:n,h:r,alt:i}){let a=qc(e.client,t,!e.measuring),o={width:`${n}pt`,height:`${r}pt`};return e.measuring||!a?(0,X.jsx)(`span`,{className:`de-img-missing`,style:{...o,borderStyle:`none`}}):a===`unsupported`?(0,X.jsxs)(`span`,{className:`de-img-missing`,style:o,title:t,children:[t.split(`.`).pop()?.toUpperCase(),` image`]}):(0,X.jsx)(`img`,{src:a,alt:i??``,style:{...o,verticalAlign:`bottom`,display:`inline-block`},draggable:!1})}function ud({x:e,ctx:t,o:n}){let r={"data-o":n,"data-obj":``,contentEditable:!t.editable&&void 0};switch(e.t){case`text`:{let r=(0,X.jsx)(`span`,{"data-o":n,style:ad(e.s),children:e.text});return e.href&&!t.measuring&&!t.editable?(0,X.jsx)(`a`,{href:e.href,target:e.href.startsWith(`#`)?void 0:`_blank`,rel:`noreferrer noopener`,children:r}):r}case`field`:{let n=e.kind===`PAGE`?t.page>=0?t.page+1:1:t.pages||1;return(0,X.jsx)(`span`,{...r,style:ad(e.s),children:n})}case`ref`:return(0,X.jsx)(`span`,{...r,style:ad(e.s),children:e.text});case`img`:{let n=(0,X.jsx)(ld,{ctx:t,target:e.target,w:e.w,h:e.h,alt:e.alt});return(0,X.jsx)(`span`,{...r,children:e.href&&!t.measuring&&!t.editable?(0,X.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,children:n}):n})}case`box`:return(0,X.jsx)(`span`,{...r,className:`de-tbox`,style:{width:e.w?`${e.w}pt`:void 0,minHeight:e.h?`${e.h}pt`:void 0,background:e.fill,border:e.border},children:e.blocks.map((e,n)=>(0,X.jsx)(pd,{block:e,ctx:t},n))});case`shape`:return e.label?(0,X.jsx)(`span`,{...r,className:`de-ph`,style:{width:`${e.w}pt`,height:`${e.h}pt`},children:e.label}):(0,X.jsx)(`span`,{...r})}}function dd({p:e,ctx:t,pa:n,sp:r}){let i=e.ps.indFirst&&e.ps.indFirst<0?-e.ps.indFirst:0,a=e.runs.length>0,o=cd(e.ps,r);a||(o.fontSize=rd(e.markSz),e.markFont&&(o.fontFamily=e.markFont));let s=t.editable&&n!==void 0,c=0,l=e.runs.map((e,n)=>{let r=(0,X.jsx)(ud,{x:e,ctx:t,o:c},n);return c+=e.t===`text`?e.text.length:1,r});return(0,X.jsxs)(`div`,{className:`de-p`,style:o,"data-pa":n,contentEditable:t.editable&&!s?!1:void 0,children:[e.marker&&(0,X.jsxs)(`span`,{className:`de-marker`,contentEditable:!t.editable&&void 0,style:{...ad(e.marker.s),minWidth:e.marker.tab&&i?`${i}pt`:void 0},children:[e.marker.text,e.marker.tab&&!i?` `:``]}),l,!a&&(s?(0,X.jsx)(`span`,{"data-o":0,"data-empty":``,children:``}):``)]})}function fd({t:e,ctx:t,pa:n}){let r=e.cols.reduce((e,t)=>e+t,0),i={width:r?`${r}pt`:`100%`};return e.align===`center`?i.margin=`0 auto`:e.align===`right`?i.marginLeft=`auto`:e.indL&&(i.marginLeft=`${e.indL}pt`),(0,X.jsxs)(`table`,{className:`de-tbl`,style:i,children:[r>0&&(0,X.jsx)(`colgroup`,{children:e.cols.map((e,t)=>(0,X.jsx)(`col`,{style:{width:`${e}pt`}},t))}),(0,X.jsx)(`tbody`,{children:e.rows.map((e,r)=>(0,X.jsx)(`tr`,{style:{height:e.h?`${e.h}pt`:void 0},children:e.cells.map((e,i)=>(0,X.jsx)(`td`,{colSpan:e.colSpan>1?e.colSpan:void 0,rowSpan:e.rowSpan>1?e.rowSpan:void 0,style:{borderTop:e.borders.t,borderRight:e.borders.r,borderBottom:e.borders.b,borderLeft:e.borders.l,background:e.shd,verticalAlign:e.vAlign,padding:`${e.pad[0]}pt ${e.pad[1]}pt ${e.pad[2]}pt ${e.pad[3]}pt`},children:e.blocks.map((a,o)=>(0,X.jsx)(pd,{block:a,ctx:t,pa:n!==void 0&&a.t===`p`&&a.pid!==void 0&&!a.ro?`${n}.${r}.${i}.${o}`:void 0,sp:sd(a,e.blocks[o-1],e.blocks[o+1]),nested:!0},a.t===`p`?`${o}:${a.ver??0}`:o))},i))},r))})]})}var pd=(0,u.memo)(function({block:e,ctx:t,pa:n,sp:r=``,nested:i}){switch(e.t){case`p`:return(0,X.jsx)(dd,{p:e,ctx:t,pa:n,sp:r});case`tbl`:return(0,X.jsx)(`div`,{style:{overflow:`visible`},contentEditable:t.editable&&(i||n===void 0)?!1:void 0,children:(0,X.jsx)(fd,{t:e,ctx:t,pa:i?void 0:n})});default:return(0,X.jsx)(`div`,{})}}),md=4/3,hd=16,gd=24;function _d(e,t,n,r){let i=[],a={start:0,end:0,used:0};for(let o=0;o<n;o++){let n=e[o],s=t.get(n)??0;n.t===`sect`?(a.end=o+1,n.kind!==`continuous`&&(i.push(a),a={start:o+1,end:o+1,used:0})):((n.t===`p`&&n.pb&&a.end>a.start||a.used>0&&a.used+s>r)&&(i.push(a),a={start:o,end:o,used:0}),a.end=o+1,a.used+=s)}return(a.end>a.start||!i.length)&&i.push(a),i}var vd=new WeakSet;function yd(e,t,n){for(let r of e.querySelectorAll(`[data-pa="${t}"]`))for(let e of r.querySelectorAll(`[data-obj][data-o="${n}"]`))if(e.closest(`[data-pa]`)===r)return e.querySelector(`img`)??e;return null}var bd=[`nw`,`n`,`ne`,`e`,`se`,`s`,`sw`,`w`];function xd(e,t){let n=[];return e.forEach((e,r)=>{if(e.t!==`p`||e.pid===void 0)return;let i=!!t&&e.sid===t,a=i?0:e.ps.outline;if(a===void 0||a>5)return;let o=Wl(e.runs).trim();o&&n.push({bi:r,lvl:i?0:a+ +!!t,text:o})}),n}var Sd=e=>!!e&&e.t===`p`&&e.pid!==void 0&&!e.ro;function Cd({client:e,onStatus:t,initialZoom:n=`fit`}){let r=kl(),i=(0,u.useRef)({blocks:[],heights:new WeakMap,dirty:new Set,frontier:0}).current,[a,o]=Wc(),[s,c]=(0,u.useState)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(n),[m,h]=Gc(),g=Kc(m),_=(0,u.useRef)(null),v=(0,u.useMemo)(()=>new Ru(e,i,o),[e,i,o]),y=r.editable&&!!l&&!l.error,[b,x]=(0,u.useState)({open:!1,q:``,idx:0}),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),[ee,O]=(0,u.useState)(!1),[te,ne]=(0,u.useState)(!1),[re,ie]=(0,u.useState)(null),[ae,oe]=(0,u.useState)(null),k=(0,u.useRef)(!1),se=(0,u.useRef)(null);(0,u.useEffect)(()=>(v.onImage=e=>ie(t=>t?.pa===e?.pa&&t?.o===e?.o&&t?.w===e?.w&&t?.h===e?.h&&t?.target===e?.target&&t?.alt===e?.alt?t:e),v.onStyles=e=>c(t=>t&&{...t,styles:e}),v.onPainter=ne,()=>{v.onImage=v.onStyles=v.onPainter=void 0}),[v]),(0,u.useEffect)(()=>l&&!l.error?Mc(e,`docx`,{editor:v,st:i}):void 0,[e,v,i,l]),(0,u.useEffect)(()=>{let t=[e.on(`docx:blocks`,e=>{for(let t of e)i.blocks.push(t);o()}),e.on(`docx:meta`,e=>{c(e),e.styles&&(v.styles=e.styles)}),e.on(`docx:done`,d)];return vd.has(e)||(vd.add(e),e.call(`docx.start`).catch(()=>{})),()=>t.forEach(e=>e())},[e,o,i,v]);let ce=s?.page??yt,A=ce.w-ce.ml-ce.mr,le=(ce.h-ce.mt-ce.mb)*md,[ue,de]=(0,u.useState)(40),j=(0,u.useRef)(null),M=`${A}|${s?.font}|${s?.sz}`,N=(0,u.useRef)(M);N.current!==M&&(N.current=M,i.heights=new WeakMap,i.dirty.clear(),i.frontier=0);let fe=i.blocks.length,pe=[];for(let e of i.dirty){if(pe.length>=50)break;let t=i.blocks.indexOf(e);t<0?i.dirty.delete(e):pe.push({b:e,i:t})}let me=Math.min(fe,i.frontier+ue);for(let e=i.frontier;e<me;e++)pe.push({b:i.blocks[e],i:e});let he=performance.now(),ge=(0,u.useMemo)(()=>({client:e,page:-1,pages:0,measuring:!0,editable:!1}),[e]);Uc(()=>{let e=j.current;if(!e||!pe.length||!s)return;let t=Array.from(e.children).map(e=>e.getBoundingClientRect().height),n=performance.now()-he,r=setTimeout(()=>{pe.forEach((e,n)=>{i.heights.set(e.b,t[n]??0),i.dirty.delete(e.b)}),me>i.frontier&&(i.frontier=me),de(e=>n<10?Math.min(e*2,1500):n>30?Math.max(10,e>>1):e),o()},0);return()=>clearTimeout(r)});let P=(0,u.useMemo)(()=>_d(i.blocks,i.heights,Math.min(i.frontier,fe),le),[a,le,fe]),_e=ce.w*md,ve=ce.h*md,ye=h.w?Math.max(.2,Math.min(2,(h.w-48)/_e)):1,be=f===`fit`?Math.min(ye,1.25):f,xe=!!l&&i.frontier>=fe,F=P.map(e=>Math.max(ve,(ce.mt+ce.mb)*md+e.used)*be),I=[],Se=gd;for(let e of F)I.push(Se),Se+=e+hd;let Ce=+!xe,we=Se+Ce*(ve*be+hd)+gd-hd,Te=Math.max(h.w,_e*be+48),Ee=Math.max(gd,(Te-_e*be)/2),De=I.length?Jc(I,g.y-ve*be):0,Oe=I.length?Jc(I,g.y+h.h+200):-1,ke=xe?P.length:0,L=y&&v.input.lastSel?Number(v.input.lastSel.f.pa.split(`.`)[0]):-1,R=L>=0?P.findIndex(e=>L>=e.start&&L<e.end):-1;v.contentW=A,v.defaultFont=s?.font,v.defaultSz=s?.sz;let z=I.length?Jc(I,g.y+h.h/3)+1:0,[Ae,B]=(0,u.useState)(0);(0,u.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>{let e=0,t=n=>{if(n.t===`p`)e+=Wl(n.runs).split(/\s+/).filter(e=>/[\p{L}\p{N}]/u.test(e)).length;else if(n.t===`tbl`)for(let e of n.rows)for(let n of e.cells)n.blocks.forEach(t)};i.blocks.forEach(t),B(e)},600);return()=>clearTimeout(e)},[a,l,i]);let V=l?.error?`Error: ${l.error}`:xe?`Page ${z} of ${P.length} · ${Ae.toLocaleString()} words`:`Page ${z} of ${P.length}+ · loading…`;(0,u.useEffect)(()=>{let e=_.current;if(y&&e)return v.input.attach(e),v.onDirty=()=>r.setDirty(!0),()=>v.input.detach()},[y,v,r]),(0,u.useEffect)(()=>{v.shortcut=e=>{let t=e.metaKey||e.ctrlKey;if(t&&e.key.toLowerCase()===`s`)return r.save(),!0;if(t&&e.key.toLowerCase()===`f`)return x(e=>({...e,open:!0})),!0;if(t&&e.key===`Enter`)return v.insertPageBreak(),!0;if(t&&e.key.toLowerCase()===`k`)return Fe(),!0;if(t&&e.altKey&&/^Digit[0-6]$/.test(e.code)){let t=Number(e.code.slice(5));return v.applyCanon(t?`h${t}`:`normal`),!0}return t&&e.key===`\\`?(v.clearFormat(),!0):e.key===`Escape`&&v.painter?(v.copyFormat(),!0):!1}},[v,r]),Uc(()=>{let e=v.pendingSel;if(!e||!_.current)return;if(!v.input.restore(e)){let t=Number(e.f.pa.split(`.`)[0]),n=P.findIndex(e=>t>=e.start&&t<e.end);n>=0&&m.current&&(m.current.scrollTop=Math.max(0,I[n]-16)),(n<0||n>=De&&n<=Oe)&&(v.pendingSel=null);return}v.pendingSel=null;let t=gu(_.current),n=t?.rangeCount?t.getRangeAt(0):null,r=m.current;if(n&&r){let e=n.getBoundingClientRect(),t=r.getBoundingClientRect();e.height&&e.bottom>t.bottom-24?r.scrollTop+=e.bottom-t.bottom+48:e.height&&e.top<t.top+8&&(r.scrollTop-=t.top-e.top+48)}});let je=(0,u.useMemo)(()=>{let e=b.q.toLowerCase();if(!b.open||!e)return[];let t=[],n=(n,r,i)=>{let a=Wl(n.runs).toLowerCase();for(let n=a.indexOf(e);n>=0&&t.length<5e3;n=a.indexOf(e,n+e.length))t.push({pa:r,a:n,b:n+e.length,bi:i})};return i.blocks.forEach((e,t)=>{Sd(e)?n(e,String(t),t):e.t===`tbl`&&e.rows.forEach((e,r)=>e.cells.forEach((e,i)=>e.blocks.forEach((e,a)=>Sd(e)&&n(e,`${t}.${r}.${i}.${a}`,t))))}),t},[b.q,b.open,a]),Me=e=>{let t=je[e],n=m.current;if(!t||!n)return;let r=P.findIndex(e=>t.bi>=e.start&&t.bi<e.end);r>=0&&(n.scrollTop=Math.max(0,I[r]-16)),x(t=>({...t,idx:e})),requestAnimationFrame(()=>requestAnimationFrame(()=>{let e=_.current;if(!e)return;let r=hu(e,{pa:t.pa,o:t.a}),i=hu(e,{pa:t.pa,o:t.b});if(!r||!i)return;let a=document.createRange();a.setStart(r[0],r[1]),a.setEnd(i[0],i[1]);let o=a.getBoundingClientRect(),s=n.getBoundingClientRect();n.scrollTop+=o.top-s.top-s.height/3,y&&v.input.restore({a:{pa:t.pa,o:t.a},f:{pa:t.pa,o:t.b}},!1)}))};Uc(()=>{let e=globalThis.Highlight,t=CSS.highlights;if(!e||!t)return;let n=_.current;if(!n||!je.length){t.delete(`de-find`),t.delete(`de-find-cur`);return}let r=[],i;je.forEach((e,t)=>{if(e.bi<(P[De]?.start??0)||e.bi>=(P[Oe]?.end??0))return;let a=hu(n,{pa:e.pa,o:e.a}),o=hu(n,{pa:e.pa,o:e.b});if(!a||!o)return;let s=document.createRange();s.setStart(a[0],a[1]),s.setEnd(o[0],o[1]),t===b.idx?i=s:r.push(s)}),t.set(`de-find`,new e(...r)),i?t.set(`de-find-cur`,new e(i)):t.delete(`de-find-cur`)});let Ne=(e,t)=>cu(v,{a:{pa:e.pa,o:e.a},f:{pa:e.pa,o:e.b}},t),Pe={fontFamily:s?.font,fontSize:s?`${s.sz}pt`:void 0};Al({printable:async()=>{if(!xe)throw Error(`The document is still loading — try again in a moment`);return{size:`${ce.w}pt ${ce.h}pt`,margin:`0`,node:P.map((t,n)=>(0,X.jsx)(`div`,{className:`de-print-page`,style:{width:`${ce.w}pt`,height:`${ce.h}pt`},children:(0,X.jsx)(wd,{index:n,count:P.length,slice:t,blocks:i.blocks,meta:s,page:ce,top:0,left:0,height:ve,zoom:1,client:e,docStyle:Pe,editing:!1})},n))}},text:async e=>{if(!l)throw Error(`The document is still loading — try again in a moment`);return e===`md`?$u(i.blocks):Yu(i.blocks)},stats:()=>{let e=0,t=0,n=r=>{if(r.t===`p`){let n=Wl(r.runs);e+=n.length,n.trim()&&t++}else if(r.t===`tbl`)for(let e of r.rows)for(let t of e.cells)t.blocks.forEach(n)};i.blocks.forEach(n);let r=xe?``:`+`;return[[`Pages`,P.length.toLocaleString()+r],[`Words`,Ae.toLocaleString()+r],[`Characters`,e.toLocaleString()+r],[`Paragraphs`,t.toLocaleString()+r],[`Page size`,`${+(ce.w/72).toFixed(2)} × ${+(ce.h/72).toFixed(2)} in`]]}});let Fe=()=>{let e=v.state()?.link;T({title:e?`Edit link`:`Insert link`,placeholder:`https://…`,initial:e,ok:`Apply`,onOk:e=>void v.setLink(e.trim()||null),extra:e?{label:`Remove`,run:()=>void v.setLink(null)}:void 0})},Ie=()=>{let e=v.state()?.img;e&&T({title:`Alt text`,label:`Describe the picture for screen readers`,initial:e.alt??``,area:!0,ok:`Save`,onOk:e=>v.setAltText(e.trim())})},Le=async e=>{let t=v.input.sel();if(t)try{if(!e&&navigator.clipboard?.read)for(let e of await navigator.clipboard.read()){let n=e.types.find(e=>e.startsWith(`image/`));if(n)return void v.insertImages([await e.getType(n)],t);if(e.types.includes(`text/html`)){let n=await(await e.getType(`text/html`)).text();if(v.pasteRich(t,{files:[],getData:e=>e===`text/html`?n:``}))return}}let n=await navigator.clipboard.readText();n&&cu(v,t,n)}catch{D(`The browser blocked clipboard access — use ${Q}V to paste`)}},Re=e=>{document.execCommand(e)||D(`Use ${Q}${e===`copy`?`C`:`X`}`)},ze=()=>void Dl().then(e=>void(e.length&&v.insertImages(e))),Be=()=>re&&_.current?yd(_.current,re.pa,re.o):null,Ve={original:()=>{let e=Be();e?.naturalWidth&&v.imageOriginal(e.naturalWidth,e.naturalHeight)},replace:()=>void Dl(`image/*`,!1).then(e=>e[0]&&v.replaceImage(e[0])),alt:Ie,download:r.canDownload?()=>{let e=Be();e?.src&&re&&fetch(e.src).then(e=>e.blob()).then(e=>Cl(e,re.target.split(`/`).pop()??`image`))}:void 0};Uc(()=>{if(k.current)return;let e=_.current,t=m.current,n=null;if(y&&re&&e&&t){let r=yd(e,re.pa,re.o);if(r){let e=r.getBoundingClientRect(),i=t.getBoundingClientRect();n={x:e.left-i.left+t.scrollLeft,y:e.top-i.top+t.scrollTop,w:e.width,h:e.height}}}oe(e=>e===n||e&&n&&e.x===n.x&&e.y===n.y&&e.w===n.w&&e.h===n.h?e:n)});let He=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=Be();if(!re||!ae||!n)return;let{w:r,h:i,x:a,y:o}=ae,s=re.w/Math.max(1,r),c=t.clientX,l=t.clientY,u=r,d=i;k.current=!0,se.current=s;let f=t=>{let f=t.clientX-c,p=t.clientY-l,m=r+(e.includes(`e`)?f:e.includes(`w`)?-f:0),h=i+(e.includes(`s`)?p:e.includes(`n`)?-p:0);if(e.length===2&&!t.shiftKey){let e=Math.max(m/r,h/i);m=r*e,h=i*e}let g=A/s*1;u=Math.max(8,Math.min(m,g*2)),d=Math.max(8,h),n.style.width=`${u*s}pt`,n.style.height=`${d*s}pt`,oe({x:a,y:o,w:u,h:d})},p=()=>{window.removeEventListener(`mousemove`,f),window.removeEventListener(`mouseup`,p),k.current=!1,se.current=null,u!==r||d!==i?v.setImageSize(u*s,d*s):oe(null)};window.addEventListener(`mousemove`,f),window.addEventListener(`mouseup`,p)},Ue=()=>{let e=v.state(),t=v.input.sel(),n=!!t&&(t.a.pa!==t.f.pa||t.a.o!==t.f.o),r=[];if(e?.img&&r.push({head:`Image`,label:`Original size`,icon:`imgOrig`,run:Ve.original},{label:`Fit to page width`,icon:`fit`,run:()=>v.resizeImage(`fit`)},{label:`Replace image…`,icon:`imgReplace`,run:Ve.replace},{label:`Alt text…`,icon:`alt`,run:Ie},...Ve.download?[{label:`Download image`,icon:`save`,run:Ve.download}]:[],{label:`Delete image`,icon:`trash`,run:()=>v.deleteSelection()}),r.push({label:`Cut`,icon:`cut`,hint:`${Q}X`,disabled:!n,run:()=>Re(`cut`),sep:r.length>0},{label:`Copy`,icon:`copy`,hint:`${Q}C`,disabled:!n,run:()=>Re(`copy`)},{label:`Paste`,icon:`paste`,hint:`${Q}V`,run:()=>void Le(!1)},{label:`Paste without formatting`,icon:`pastePlain`,hint:`${Q}⇧V`,run:()=>void Le(!0)},{label:`Delete`,icon:`trash`,disabled:!n||!!e?.img,run:()=>v.deleteSelection()}),e?.link?r.push({label:`Open link`,icon:`external`,sep:!0,run:()=>window.open(e.link,`_blank`,`noopener`)},{label:`Edit link…`,icon:`link`,hint:`${Q}K`,run:Fe},{label:`Remove link`,icon:`unlink`,run:()=>void v.setLink(null)}):r.push({label:`Insert link…`,icon:`link`,hint:`${Q}K`,sep:!0,run:Fe,disabled:!e}),e?.inTable){let e=e=>()=>v.tableOp(e);r.push({head:`Table`,label:`Insert row above`,icon:`rowAbove`,sep:!0,run:e(`rowAbove`)},{label:`Insert row below`,icon:`rowBelow`,run:e(`rowBelow`)},{label:`Insert column left`,icon:`colLeft`,run:e(`colLeft`)},{label:`Insert column right`,icon:`colRight`,run:e(`colRight`)},{label:`Delete row`,icon:`delRow`,run:e(`delRow`)},{label:`Delete column`,icon:`delCol`,run:e(`delCol`)},{label:`Delete table`,icon:`trash`,run:e(`delTable`)})}else r.push({label:`Insert image…`,icon:`image`,sep:!0,run:ze,disabled:!e},{label:`Insert table`,icon:`table`,run:()=>v.insertTable(3,3),disabled:!e},{label:`Page break`,icon:`pagebreak`,hint:`${Q}↵`,run:()=>v.insertPageBreak(),disabled:!e});return r.push({label:`Clear formatting`,icon:`clear`,hint:`${Q}\\`,sep:!0,run:()=>v.clearFormat(),disabled:!e},{label:`Select all`,icon:`selectAll`,hint:`${Q}A`,run:()=>v.selectAll()}),r},We=s?.styles?.find(e=>e.canon===`title`)?.id,Ge=(0,u.useMemo)(()=>ee?xd(i.blocks,We):[],[ee,a,We]),Ke=P[Math.max(0,z-1)]?.start??0,qe=Ge.reduce((e,t,n)=>t.bi<=Math.max(Ke,L)?n:e,-1),H=e=>{let t=m.current,n=P.findIndex(t=>e>=t.start&&e<t.end);!t||n<0||(t.scrollTop=Math.max(0,I[n]-16),requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=_.current?.querySelector(`[data-pa="${e}"]`);n&&(t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-24),y&&v.input.restore({a:{pa:String(e),o:0},f:{pa:String(e),o:0}})})))};return(0,X.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,display:`flex`},children:[(0,X.jsxs)(`div`,{ref:m,className:`de-scroll`,tabIndex:-1,onKeyDown:e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase();t&&n===`f`?(e.preventDefault(),x(e=>({...e,open:!0}))):t&&n===`a`&&!e.shiftKey&&!y&&_.current&&(e.preventDefault(),gu(_.current)?.selectAllChildren(_.current))},children:[s&&pe.length>0&&(0,X.jsx)(`div`,{ref:j,className:`de-measure de-doc`,style:{...Pe,width:`${A}pt`},children:pe.map(({b:e,i:t})=>(0,X.jsx)(pd,{block:e,ctx:ge,sp:sd(e,i.blocks[t-1],i.blocks[t+1])},t))}),(0,X.jsxs)(`div`,{ref:_,className:y?`de-pages de-editing`:`de-pages`,style:{height:we,width:Te},contentEditable:y||void 0,suppressContentEditableWarning:!0,spellCheck:!1,onMouseDown:e=>{if(!y)return;let t=e.target,n=t.tagName===`IMG`?t.closest(`[data-obj]`):null,r=n&&_.current?mu(_.current,n,0):null;r&&(e.preventDefault(),v.selectObject(r.pa,r.o))},onMouseUp:()=>{v.painter&&setTimeout(()=>v.applyPainter(),0)},onContextMenu:e=>{y&&(e.preventDefault(),C({x:e.clientX,y:e.clientY}))},children:[P.map((t,n)=>(n<De||n>Oe)&&n!==R?null:(0,X.jsx)(wd,{index:n,count:ke,slice:t,blocks:i.blocks,meta:s,page:ce,top:I[n],left:Ee,height:F[n],zoom:be,client:e,docStyle:Pe,editing:y},n)),Ce>0&&(0,X.jsx)(`div`,{className:`de-page-skeleton`,contentEditable:!1,style:{top:Se,left:Ee,width:_e*be,height:ve*be}})]}),ae&&(0,X.jsxs)(`div`,{className:`de-img-sel`,style:{left:ae.x,top:ae.y,width:ae.w,height:ae.h},children:[bd.map(e=>(0,X.jsx)(`span`,{className:`de-img-h de-img-${e}`,onMouseDown:t=>He(e,t)},e)),se.current&&(0,X.jsxs)(`span`,{className:`de-img-size`,children:[Math.round(ae.w*se.current),` × `,Math.round(ae.h*se.current),` pt`]})]})]}),ee&&(0,X.jsxs)(`nav`,{className:`de-outline`,"aria-label":`Document outline`,children:[(0,X.jsxs)(`div`,{className:`de-outline-head`,children:[(0,X.jsx)(`span`,{children:`Outline`}),(0,X.jsx)(`button`,{type:`button`,className:`de-tb`,title:`Close outline`,"aria-label":`Close outline`,onClick:()=>O(!1),children:`×`})]}),Ge.length?Ge.map((e,t)=>(0,X.jsx)(`button`,{type:`button`,className:t===qe?`de-outline-item on`:`de-outline-item`,style:{paddingLeft:10+e.lvl*14},onClick:()=>H(e.bi),children:e.text},e.bi)):(0,X.jsx)(`div`,{className:`de-outline-empty`,children:`Headings you add to the document will appear here.`})]}),b.open&&(0,X.jsx)(Ku,{query:b.q,index:b.idx,count:je.length,editable:y,onQuery:e=>x({open:!0,q:e,idx:0}),onNav:e=>je.length&&Me((b.idx+e+je.length)%je.length),onClose:()=>x({open:!1,q:b.q,idx:0}),onReplace:(e,t)=>{je.length&&(t?[...je].reverse().forEach(t=>Ne(t,e)):Ne(je[Math.min(b.idx,je.length-1)],e))}}),y&&(0,X.jsx)(Gu,{editor:v,styles:s?.styles??[],onFind:()=>x(e=>({...e,open:!0})),outline:ee,onOutline:()=>O(e=>!e),painter:te,onLink:Fe,image:Ve}),!y&&l&&(0,X.jsx)(`button`,{type:`button`,className:ee?`de-outline-toggle on`:`de-outline-toggle`,title:`Document outline`,onClick:()=>O(e=>!e),children:`☰`}),S&&(0,X.jsx)(Il,{x:S.x,y:S.y,items:Ue(),onClose:()=>C(null)}),w&&(0,X.jsx)(Ll,{spec:w,onClose:()=>T(null)}),E&&(0,X.jsx)(zl,{text:E,onDone:()=>D(null)}),(0,X.jsx)(Fl,{zoom:f,effective:be,onChange:p}),(0,X.jsx)(Nl,{text:V,onStatus:t})]})}function wd({index:e,count:t,slice:n,blocks:r,meta:i,page:a,top:o,left:s,height:c,zoom:l,client:d,docStyle:f,editing:p}){let m=(0,u.useMemo)(()=>({client:d,page:e,pages:t,measuring:!1,editable:p}),[d,e,t,p]),h=(0,u.useMemo)(()=>({...m,editable:!1}),[m]),g=e===0&&i?.titlePg,_=g?i?.firstHeader:i?.header,v=g?i?.firstFooter:i?.footer,y=[];for(let e=n.start;e<n.end;e++){let t=r[e];y.push((0,X.jsx)(pd,{block:t,ctx:m,pa:Sd(t)||t.t===`tbl`?String(e):void 0,sp:sd(t,r[e-1],r[e+1])},`${e}:${t.t===`p`?t.ver??0:0}`))}return(0,X.jsx)(`div`,{className:`de-page`,style:{top:o,left:s,width:a.w*md*l,height:c},"data-page":e+1,children:(0,X.jsxs)(`div`,{className:`de-page-inner de-doc`,style:{...f,width:`${a.w}pt`,height:c/l,zoom:l},children:[_&&(0,X.jsx)(`div`,{className:`de-hf`,contentEditable:!p&&void 0,style:{top:`${a.header}pt`,padding:`0 ${a.mr}pt 0 ${a.ml}pt`},children:_.map((e,t)=>(0,X.jsx)(pd,{block:e,ctx:h},t))}),(0,X.jsx)(`div`,{style:{position:`absolute`,top:`${a.mt}pt`,left:`${a.ml}pt`,width:`${a.w-a.ml-a.mr}pt`},children:y}),v&&(0,X.jsx)(`div`,{className:`de-hf`,contentEditable:!p&&void 0,style:{bottom:`${a.footer}pt`,padding:`0 ${a.mr}pt 0 ${a.ml}pt`},children:v.map((e,t)=>(0,X.jsx)(pd,{block:e,ctx:h},t))})]})})}var Td=[[`title`,`Title`],[`subject`,`Subject`],[`creator`,`Author`],[`keywords`,`Keywords`],[`description`,`Comments`],[`lastModifiedBy`,`Last modified by`],[`created`,`Created`],[`modified`,`Modified`]];async function Ed(e){let t=await(await e.call(`part`,`docProps/core.xml`)).text(),n=new DOMParser().parseFromString(t,`application/xml`),r=[];for(let[e,t]of Td){let i=n.getElementsByTagNameNS(`*`,e)[0]?.textContent?.trim();if(!i)continue;let a=e===`created`||e===`modified`?new Date(i):null;r.push([t,a&&!isNaN(a.getTime())?a.toLocaleString():i])}return r}function Dd(e){let[t,n]=(0,u.useState)([]),r=(0,u.useRef)(null);(0,u.useEffect)(()=>{r.current?.focus();let t=!0;return Ed(e.client).then(e=>t&&n(e),()=>{}),()=>{t=!1}},[e.client]);let i=[e.file,t,e.stats].filter(e=>e.length);return(0,X.jsx)(`div`,{className:`de-dialog-back`,onMouseDown:t=>t.target===t.currentTarget&&e.onClose(),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),e.onClose())},children:(0,X.jsxs)(`div`,{className:`de-dialog`,role:`dialog`,"aria-label":`Document details`,children:[(0,X.jsx)(`div`,{className:`de-dialog-title`,children:`Document details`}),(0,X.jsx)(`dl`,{className:`de-details`,children:i.map((e,t)=>(0,X.jsxs)(u.Fragment,{children:[t>0&&(0,X.jsx)(`div`,{className:`de-details-sep`}),e.map(([e,t])=>(0,X.jsxs)(u.Fragment,{children:[(0,X.jsx)(`dt`,{children:e}),(0,X.jsx)(`dd`,{children:t})]},e))]},t))}),(0,X.jsx)(`div`,{className:`de-dialog-btns`,children:(0,X.jsx)(`button`,{ref:r,type:`button`,className:`de-btn de-btn-primary`,onClick:e.onClose,children:`Close`})})]})})}var Od=`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,kd=`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,Ad=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
44
|
+
`,jd=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,Md=`http://schemas.openxmlformats.org/package/2006/relationships`,Nd=`<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>`,Pd=e=>`${Ad}<Relationships xmlns="${Md}"><Relationship Id="rId1" Type="${jd}/officeDocument" Target="${e}"/></Relationships>`;function Fd(e){let t=e.slice(0,4096).split(/\r?\n/,1)[0],n=e=>t.split(e).length-1,r=n(` `),i=n(`;`),a=n(`,`);return r>0&&r>=i&&r>=a?` `:i>a?`;`:`,`}function Id(e,t=Fd(e)){let n=[],r=[],i=``,a=!1,o=+(e.charCodeAt(0)===65279),s=e.length;for(;o<s;o++){let s=e[o];a?s===`"`?e[o+1]===`"`?(i+=`"`,o++):a=!1:i+=s:s===`"`&&i===``?a=!0:s===t?(r.push(i),i=``):s===`
|
|
45
45
|
`||s===`\r`?(s===`\r`&&e[o+1]===`
|
|
46
|
-
`&&o++,r.push(i),n.push(r),r=[],i=``):i+=s}return(i!==``||r.length)&&(r.push(i),n.push(r)),n}function
|
|
47
|
-
`).map(e=>e.length));o>(r[i]??0)&&(r[i]=o)}),a&&(i+=`<row r="${t+1}">${a}</row>`)});let a=``;r.forEach((e,t)=>{e>9&&(a+=`<col min="${t+1}" max="${t+1}" width="${Math.min(60,e+2)}" customWidth="1"/>`)});let o=t.replace(/[\\/?*[\]:]/g,` `).slice(0,31).trim()||`Sheet1`,s=`http://schemas.openxmlformats.org/spreadsheetml/2006/main`;return be(new Map([[`[Content_Types].xml`,`${
|
|
48
|
-
`))}</code></pre>`);continue}if(!s.trim()){a(),o();continue}let l=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(s);if(l){a(),o(),n.push(`<h${l[1].length}>${Hd(
|
|
49
|
-
`)}var
|
|
50
|
-
`?`<w:br/>`:`<w:t xml:space="preserve">${te(n)}</w:t>`);return t?`<w:r>${Gd(e.set)}${t}</w:r>`:``}function qd(){let e=[20,16,14,12,11,11],t=``;return e.forEach((e,n)=>{let r=n+1;t+=`<w:style w:type="paragraph" w:styleId="Heading${r}"><w:name w:val="heading ${r}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="${r<=2?360:240}" w:after="${r<=2?120:80}"/><w:outlineLvl w:val="${n}"/></w:pPr><w:rPr>${r<=4?`<w:b/>`:``}${r>=5?`<w:i/>`:``}<w:color w:val="${r<=2?`1F3864`:`2F5496`}"/><w:sz w:val="${e*2}"/><w:szCs w:val="${e*2}"/></w:rPr></w:style>`}),t}function Jd(e){let t=[`•`,`◦`,`▪`],n=[`decimal`,`lowerLetter`,`lowerRoman`],r=e=>Array.from({length:9},(r,i)=>{let a=e===`bullet`?`bullet`:n[i%3],o=e===`bullet`?t[i%3]:`%${i+1}.`,s=e===`bullet`?`<w:rPr><w:rFonts w:ascii="Arial" w:hAnsi="Arial"/></w:rPr>`:``;return`<w:lvl w:ilvl="${i}"><w:start w:val="1"/><w:numFmt w:val="${a}"/><w:lvlText w:val="${o}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(i+1)}" w:hanging="360"/></w:pPr>${s}</w:lvl>`}).join(``),i=`${kd}<w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">`;return i+=`<w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="hybridMultilevel"/>${r(`bullet`)}</w:abstractNum>`,i+=`<w:abstractNum w:abstractNumId="1"><w:multiLevelType w:val="hybridMultilevel"/>${r(`number`)}</w:abstractNum>`,e.forEach((e,t)=>{i+=`<w:num w:numId="${t+1}"><w:abstractNumId w:val="${e===`bullet`?0:1}"/>`,e===`number`&&(i+=`<w:lvlOverride w:ilvl="0"><w:startOverride w:val="1"/></w:lvlOverride>`),i+=`</w:num>`}),i+`</w:numbering>`}function Yd(e){let t=`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,n=[],r=[],i,a=``;for(let t of e){let e=``;t.heading&&t.heading>=1&&t.heading<=6?e+=`<w:pStyle w:val="Heading${t.heading}"/>`:t.list&&(e+=`<w:pStyle w:val="ListParagraph"/>`),t.list&&(t.list!==i&&r.push(t.list),e+=`<w:numPr><w:ilvl w:val="0"/><w:numId w:val="${r.length}"/></w:numPr>`),i=t.list;let o=``;for(let e=0;e<t.runs.length;){let r=t.runs[e].href;if(!r){o+=Kd(t.runs[e++]);continue}let i=``;for(;e<t.runs.length&&t.runs[e].href===r;)i+=Kd(t.runs[e++]);/^\s*javascript:/i.test(r)?o+=i:(n.push(r),o+=`<w:hyperlink r:id="rIdL${n.length}" w:history="1">${i}</w:hyperlink>`)}a+=`<w:p>${e?`<w:pPr>${e}</w:pPr>`:``}${o}</w:p>`}a||(a=`<w:p/>`);let o=`${kd}<w:styles xmlns:w="${t}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Calibri" w:cs="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="en-US"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="160" w:line="259" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>`+qd()+`<w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:uiPriority w:val="34"/><w:qFormat/><w:pPr><w:spacing w:after="40"/><w:ind w:left="720"/><w:contextualSpacing/></w:pPr></w:style><w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/><w:uiPriority w:val="1"/><w:semiHidden/></w:style></w:styles>`,s=`${kd}<Relationships xmlns="${jd}"><Relationship Id="rId1" Type="${Ad}/styles" Target="styles.xml"/><Relationship Id="rId2" Type="${Ad}/numbering" Target="numbering.xml"/>`+n.map((e,t)=>`<Relationship Id="rIdL${t+1}" Type="${Ad}/hyperlink" Target="${ne(e)}" TargetMode="External"/>`).join(``)+`</Relationships>`;return be(new Map([[`[Content_Types].xml`,`${kd}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">${Md}<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/></Types>`],[`_rels/.rels`,Nd(`word/document.xml`)],[`word/_rels/document.xml.rels`,s],[`word/document.xml`,`${kd}<w:document xmlns:w="${t}" xmlns:r="${Ad}"><w:body>${a}<w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/></w:sectPr></w:body></w:document>`],[`word/styles.xml`,o],[`word/numbering.xml`,Jd(r)]]),Dd)}var Xd=`http://schemas.openxmlformats.org/drawingml/2006/main`,Zd=`xmlns:a="${Xd}" xmlns:r="${Ad}" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"`,Qd=`<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>`;function $d(e,t,n,r,i,a=`<a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p>`){return`<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${t}"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph${(n?` type="${n}"`:``)+(r===null?``:` idx="${r}"`)}/></p:nvPr></p:nvSpPr>${i?`<p:spPr><a:xfrm><a:off x="${i[0]}" y="${i[1]}"/><a:ext cx="${i[2]}" cy="${i[3]}"/></a:xfrm></p:spPr>`:`<p:spPr/>`}<p:txBody>${a}</p:txBody></p:sp>`}var ef=`${kd}<a:theme xmlns:a="${Xd}" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="44546A"/></a:dk2><a:lt2><a:srgbClr val="E7E6E6"/></a:lt2><a:accent1><a:srgbClr val="4472C4"/></a:accent1><a:accent2><a:srgbClr val="ED7D31"/></a:accent2><a:accent3><a:srgbClr val="A5A5A5"/></a:accent3><a:accent4><a:srgbClr val="FFC000"/></a:accent4><a:accent5><a:srgbClr val="5B9BD5"/></a:accent5><a:accent6><a:srgbClr val="70AD47"/></a:accent6><a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Calibri Light"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="Calibri"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="60000"/></a:schemeClr></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:shade val="80000"/></a:schemeClr></a:solidFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="12700"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="19050"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/></a:schemeClr></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:shade val="90000"/></a:schemeClr></a:solidFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements></a:theme>`,tf=(e,t,n)=>`<a:lvl${e}pPr marL="${n?228600+(e-1)*457200:0}" indent="${n?-228600:0}" algn="l">`+(n?`<a:buFont typeface="Arial"/><a:buChar char="•"/>`:`<a:buNone/>`)+`<a:defRPr sz="${t}" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/></a:defRPr></a:lvl${e}pPr>`;function nf(){let e=`${kd}<p:sldMaster ${Zd}><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree>${Qd}`+$d(2,`Title Placeholder 1`,`title`,null,[838200,365125,10515600,1325563],`<a:bodyPr anchor="ctr"/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p>`)+$d(3,`Text Placeholder 2`,`body`,1,[838200,1825625,10515600,4351338])+`</p:spTree></p:cSld><p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/><p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/><p:sldLayoutId id="2147483650" r:id="rId2"/><p:sldLayoutId id="2147483651" r:id="rId3"/></p:sldLayoutIdLst><p:txStyles><p:titleStyle><a:lvl1pPr algn="l"><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle>${tf(1,2800,!0)}${tf(2,2400,!0)}${tf(3,2e3,!0)}${tf(4,1800,!0)}${tf(5,1800,!0)}</p:bodyStyle><p:otherStyle>${tf(1,1800,!1)}</p:otherStyle></p:txStyles></p:sldMaster>`,t=(e,t,n)=>`${kd}<p:sldLayout ${Zd} type="${e}" preserve="1"><p:cSld name="${t}"><p:spTree>${Qd}${n}</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`,n=(e,t)=>`<a:bodyPr anchor="${t}"/><a:lstStyle><a:lvl1pPr algn="ctr"><a:buNone/><a:defRPr sz="${e}"/></a:lvl1pPr></a:lstStyle><a:p><a:endParaRPr lang="en-US"/></a:p>`,r=t(`title`,`Title Slide`,$d(2,`Title 1`,`ctrTitle`,null,[1524e3,1122363,9144e3,2387600],n(6e3,`b`))+$d(3,`Subtitle 2`,`subTitle`,1,[1524e3,3602038,9144e3,1655762],n(2400,`t`))),i=`${kd}<p:sld ${Zd}><p:cSld><p:spTree>${Qd}`+$d(2,`Title 1`,`ctrTitle`,null)+$d(3,`Subtitle 2`,`subTitle`,1)+`</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`,a=(e,t,n)=>`<Relationship Id="rId${e}" Type="${Ad}/${t}" Target="${n}"/>`,o=(...e)=>`${kd}<Relationships xmlns="${jd}">${e.join(``)}</Relationships>`,s=`application/vnd.openxmlformats-officedocument.presentationml`;return be(new Map([[`[Content_Types].xml`,`${kd}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">${Md}<Override PartName="/ppt/presentation.xml" ContentType="${s}.presentation.main+xml"/><Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="${s}.slideMaster+xml"/>`+[1,2,3].map(e=>`<Override PartName="/ppt/slideLayouts/slideLayout${e}.xml" ContentType="${s}.slideLayout+xml"/>`).join(``)+`<Override PartName="/ppt/slides/slide1.xml" ContentType="${s}.slide+xml"/><Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/></Types>`],[`_rels/.rels`,Nd(`ppt/presentation.xml`)],[`ppt/presentation.xml`,`${kd}<p:presentation ${Zd} saveSubsetFonts="1"><p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst><p:sldIdLst><p:sldId id="256" r:id="rId2"/></p:sldIdLst><p:sldSz cx="12192000" cy="6858000"/><p:notesSz cx="6858000" cy="9144000"/></p:presentation>`],[`ppt/_rels/presentation.xml.rels`,o(a(1,`slideMaster`,`slideMasters/slideMaster1.xml`),a(2,`slide`,`slides/slide1.xml`),a(3,`theme`,`theme/theme1.xml`))],[`ppt/slideMasters/slideMaster1.xml`,e],[`ppt/slideMasters/_rels/slideMaster1.xml.rels`,o(a(1,`slideLayout`,`../slideLayouts/slideLayout1.xml`),a(2,`slideLayout`,`../slideLayouts/slideLayout2.xml`),a(3,`slideLayout`,`../slideLayouts/slideLayout3.xml`),a(4,`theme`,`../theme/theme1.xml`))],[`ppt/slideLayouts/slideLayout1.xml`,r],[`ppt/slideLayouts/slideLayout2.xml`,t(`obj`,`Title and Content`,$d(2,`Title 1`,`title`,null)+$d(3,`Content Placeholder 2`,null,1))],[`ppt/slideLayouts/slideLayout3.xml`,t(`blank`,`Blank`,``)],...[1,2,3].map(e=>[`ppt/slideLayouts/_rels/slideLayout${e}.xml.rels`,o(a(1,`slideMaster`,`../slideMasters/slideMaster1.xml`))]),[`ppt/slides/slide1.xml`,i],[`ppt/slides/_rels/slide1.xml.rels`,o(a(1,`slideLayout`,`../slideLayouts/slideLayout1.xml`))],[`ppt/theme/theme1.xml`,ef]]),`application/vnd.openxmlformats-officedocument.presentationml.presentation`)}var rf=new Set([`docx`,`dotx`,`xlsx`,`xltx`,`pptx`,`potx`]),af=new Set([`csv`,`tsv`,`tab`]),of=new Set([`txt`,`text`,`log`]),sf=new Set([`md`,`markdown`]),cf=new Set([`html`,`htm`,`xhtml`]),lf=[...rf,...af,...of,...sf,...cf].map(e=>`.`+e).join(`,`),uf=e=>Eu(e).map(e=>({heading:e.heading,list:e.list,runs:e.runs.flatMap(e=>e.t===`text`?[{text:e.text,set:e.d,href:e.href}]:[])}));async function df(e){let t=/\.([^./\\]+)$/.exec(e.name)?.[1].toLowerCase()??``,n=e.name.replace(/\.[^./\\]+$/,``)||`document`;if(rf.has(t))return{src:e,name:e.name,converted:!1};if(af.has(t)){let r=await e.text(),i=t===`csv`?Pd(r):` `;return{src:await zd(Fd(r,i),n,i===`;`),name:`${n}.xlsx`,converted:!0}}let r;if(of.has(t)?r=Bd(await e.text()):sf.has(t)?r=uf(Ud(await e.text())):cf.has(t)&&(r=uf(await e.text())),r)return{src:await Yd(r),name:`${n}.docx`,converted:!0};let i=new Uint8Array(await e.slice(0,4).arrayBuffer());if(i[0]===80&&i[1]===75)return{src:e,name:e.name,converted:!1};throw Error(`Cannot open “${e.name}”: supported files are Word, Excel, PowerPoint, CSV, text, Markdown and HTML`)}var ff=`.de-root{--de-bg:#e9ebee;--de-chrome:#fff;--de-border:#dadde1;--de-text:#1d2127;--de-muted:#69707a;--de-accent:#1a73e8;--de-accent-soft:#1a73e81f;--de-grid:#e2e4e7;--de-head:#f6f7f8;--de-shadow:0 1px 2px #0f172a1a, 0 2px 8px #0f172a0f;background:var(--de-bg);width:100%;height:100%;min-height:200px;color:var(--de-text);text-align:left;isolation:isolate;flex-direction:column;font:13px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,Arial,sans-serif;display:flex;position:relative;overflow:hidden}.de-root *,.de-root :before,.de-root :after{box-sizing:border-box}.de-root img{max-width:none}.de-bar{background:var(--de-chrome);border-bottom:1px solid var(--de-border);z-index:21;flex:none;align-items:center;gap:10px;min-height:40px;padding:6px 12px;display:flex;position:relative}.de-badge{letter-spacing:.06em;text-transform:uppercase;color:#fff;border-radius:4px;flex:none;padding:4px 6px;font:600 10px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-badge-docx{background:#2b579a}.de-badge-xlsx{background:#217346}.de-badge-pptx{background:#c43e1c}.de-title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:600;overflow:hidden}.de-status{color:var(--de-muted);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}.de-progress{background:var(--de-accent);height:2px;transition:width .2s,opacity .4s;position:absolute;bottom:-1px;left:0}.de-body{flex:1;min-height:0;display:flex;position:relative}.de-scroll{overscroll-behavior:contain;flex:1;min-width:0;position:relative;overflow:auto}.de-center{color:var(--de-muted);text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:12px;padding:24px;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}.de-spinner{border:3px solid var(--de-accent-soft);border-top-color:var(--de-accent);border-radius:50%;width:28px;height:28px;animation:.8s linear infinite de-spin}@keyframes de-spin{to{transform:rotate(360deg)}}.de-error{color:#b42318;max-width:460px;box-shadow:var(--de-shadow);background:#fff;border:1px solid #f3c2bd;border-radius:8px;padding:14px 18px}.de-zoom{z-index:4;background:var(--de-chrome);border:1px solid var(--de-border);box-shadow:var(--de-shadow);border-radius:8px;align-items:center;display:flex;position:absolute;bottom:16px;right:16px;overflow:hidden}.de-zoom button,.de-tab,.de-btn{-webkit-appearance:none;appearance:none;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0}.de-zoom button{width:32px;height:30px;font-size:16px;line-height:1}.de-zoom button:hover,.de-btn:hover{background:var(--de-accent-soft)}.de-zoom span{text-align:center;font-variant-numeric:tabular-nums;cursor:pointer;min-width:52px;font-size:12px}.de-btn{border-radius:6px;padding:4px 8px}.de-pages{position:relative}.de-page{box-shadow:var(--de-shadow);background:#fff;position:absolute;overflow:hidden}.de-page-inner{transform-origin:0 0;position:relative}.de-page-skeleton{box-shadow:var(--de-shadow);opacity:.6;background:#fff;position:absolute}.de-page-skeleton:after{content:"";background:repeating-linear-gradient(#eef0f2 0 10px,#0000 10px 24px);animation:1.4s ease-in-out infinite de-pulse;position:absolute;top:12%;bottom:12%;left:12%;right:12%}@keyframes de-pulse{50%{opacity:.45}}.de-doc{color:#000;font-kerning:normal;text-rendering:optimizelegibility}.de-doc a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}.de-hf{position:absolute;left:0;right:0}.de-measure{visibility:hidden;pointer-events:none;contain:layout style;position:absolute;top:0;left:-100000px}.de-p{white-space:pre-wrap;overflow-wrap:break-word;-moz-tab-size:36pt;tab-size:36pt;margin:0}.de-p>span{white-space:inherit}.de-marker{text-indent:0;white-space:pre;display:inline-block}.de-tbl{border-collapse:collapse;table-layout:fixed}.de-tbl td{vertical-align:top;overflow-wrap:break-word;text-indent:0;padding:0}.de-img-missing,.de-ph{color:#6a737d;text-indent:0;vertical-align:bottom;background:repeating-linear-gradient(45deg,#f6f7f9 0 8px,#eff1f4 8px 16px);border:1px dashed #b8bec6;justify-content:center;align-items:center;font:12px/1.2 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:inline-flex;overflow:hidden}.de-tbox{vertical-align:top;text-indent:0;padding:3.6pt 7.2pt;display:inline-block;overflow:hidden}.de-xlsx{flex-direction:column;flex:1;min-width:0;display:flex}.de-fx{background:var(--de-chrome);border-bottom:1px solid var(--de-border);flex:none;align-items:stretch;height:30px;font:12px/30px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;display:flex}.de-fx-ref{border-right:1px solid var(--de-border);width:88px;color:var(--de-muted);flex:none;padding:0 10px}.de-fx-val{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;padding:0 10px;overflow:hidden}.de-grid{background:#fff;outline:none;flex:1;min-height:0;position:relative;overflow:auto}.de-grid-view{z-index:1;position:sticky;top:0;left:0;overflow:hidden}.de-region{position:absolute;overflow:hidden}.de-gl-h,.de-gl-v{background:var(--de-grid);position:absolute}.de-gl-h{height:1px;left:0;right:0}.de-gl-v{width:1px;top:0;bottom:0}.de-cell{white-space:pre;align-items:flex-end;padding:0 3px 1px;line-height:1.2;display:flex;position:absolute;overflow:hidden}.de-cell>span{min-width:0}.de-cell.de-ov{overflow:visible}.de-head-c,.de-head-r{background:var(--de-head);color:#5f6368;font-variant-numeric:tabular-nums;-webkit-user-select:none;user-select:none;border-bottom:1px solid #d3d6da;border-right:1px solid #d3d6da;justify-content:center;align-items:center;font:11px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:flex;position:absolute}.de-head-on{color:#0b57d0;background:#d3e3fd;font-weight:600}.de-corner{background:var(--de-head);z-index:2;border-bottom:1px solid #c4c7cc;border-right:1px solid #c4c7cc;position:absolute;top:0;left:0}.de-freeze-h,.de-freeze-v{z-index:2;background:#b9bdc3;position:absolute}.de-sel{border:2px solid var(--de-accent);pointer-events:none;z-index:3;position:absolute}.de-tabs{background:var(--de-head);border-top:1px solid var(--de-border);scrollbar-width:thin;flex:none;align-items:stretch;gap:2px;height:34px;padding:0 8px;display:flex;overflow-x:auto}.de-tab{color:var(--de-muted);white-space:nowrap;border-radius:0 0 6px 6px;flex:none;padding:0 14px}.de-tab:hover{background:#eceef1}.de-tab[aria-selected=true]{color:#188038;background:#fff;font-weight:600;box-shadow:inset 0 2px #188038}.de-thumbs{border-right:1px solid var(--de-border);background:var(--de-chrome);flex:none;width:188px;position:relative;overflow-y:auto}.de-thumb{cursor:pointer;gap:6px;padding:0 10px 0 6px;display:flex;position:absolute;left:0;right:0}.de-thumb-n{text-align:right;width:18px;color:var(--de-muted);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.de-thumb .de-slide{outline:1px solid var(--de-border)}.de-thumb[aria-current=true] .de-slide{outline:2px solid var(--de-accent)}.de-slide{background:#fff;position:relative;overflow:hidden}.de-slide-frame{box-shadow:var(--de-shadow);position:absolute}.de-slide-inner{transform-origin:0 0;color:#000;position:absolute;top:0;left:0;overflow:hidden}.de-el{position:absolute}.de-txt{flex-direction:column;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}.de-txt>div{white-space:pre-wrap;overflow-wrap:break-word}.de-txt.de-nowrap>div{white-space:pre}.de-slide-editable .de-el>.de-txt:empty{outline-offset:-1px;outline:1.5px dashed #3c404366}.de-slide-editable .de-el>.de-txt:empty:after{content:"Click to add text";color:#80868b;text-align:center;pointer-events:none;font:28px/1.2 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,Arial,sans-serif}.de-bul{text-indent:0;white-space:pre;display:inline-block}.de-stbl{border-collapse:collapse;table-layout:fixed;width:100%}.de-stbl td{vertical-align:top;padding:0;position:relative}.de-hidden-slide{opacity:.55}.de-mode{border:1px solid var(--de-border);background:var(--de-chrome);height:28px;color:inherit;font:inherit;cursor:pointer;border-radius:6px;flex:none;align-items:center;gap:6px;padding:0 10px;font-weight:500;display:inline-flex}.de-mode:hover{background:var(--de-accent-soft)}.de-mode-on{border-color:var(--de-accent);color:var(--de-accent)}.de-save-dirty{background:var(--de-accent);border-color:var(--de-accent);color:#fff}.de-save-dirty:hover{background:#1765cc}.de-mode:disabled{opacity:.6;cursor:default}.de-ebar-host{background:var(--de-chrome);border-bottom:1px solid var(--de-border);z-index:20;flex:none;padding:6px 10px;position:relative}.de-ebar{--de-tb-ink:#444746;--de-tb-hover:#44474614;--de-tb-on:#d3e3fd;min-width:0;height:40px;color:var(--de-tb-ink);background:#eef2f9;border-radius:20px;flex-wrap:nowrap;align-items:center;gap:2px;padding:0 8px;display:flex}.de-ebar-it{flex:none;align-items:center;display:inline-flex}.de-ebar-morewrap{margin-left:auto}.de-tb-pop.de-ebar-more{background:#eef2f9;flex-wrap:wrap;align-items:center;gap:2px;width:max-content;max-width:min(360px,90vw);padding:6px;display:flex;left:auto;right:0}.de-tb{-webkit-appearance:none;appearance:none;width:28px;height:28px;color:var(--de-tb-ink,#444746);cursor:pointer;background:0 0;border:0;border-radius:4px;justify-content:center;align-items:center;padding:0;font:600 14px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;transition:background-color .1s;display:inline-flex;position:relative}.de-tb:hover:not(:disabled){background:var(--de-tb-hover,#44474614)}.de-tb:focus-visible{outline:2px solid var(--de-accent);outline-offset:-2px}.de-dd:focus-visible{outline:2px solid var(--de-accent);outline-offset:-2px}.de-tb-on{color:#041e49;background:var(--de-tb-on,#d3e3fd)!important}.de-tb:disabled{opacity:.38;cursor:default}.de-tb-chev{gap:0;width:auto;padding:0 2px 0 4px}.de-tb-sep{background:#c7c7c7;flex:none;width:1px;height:20px;margin:0 5px}.de-tb-color{display:inline-flex;position:relative}.de-tb-swatch{border-radius:1px;height:3px;position:absolute;bottom:3px;left:6px;right:6px;box-shadow:inset 0 0 0 1px #0000001f}.de-tb-pop{z-index:30;background:#fff;border-radius:8px;padding:10px;position:absolute;top:calc(100% + 6px);left:0;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-tb-none{border:1px solid var(--de-border);width:100%;font:inherit;cursor:pointer;background:#fff;border-radius:4px;margin-bottom:8px;padding:5px}.de-tb-none:hover{background:#f1f3f4}.de-dd-wrap{display:inline-flex;position:relative}.de-dd{-webkit-appearance:none;appearance:none;color:#1f1f1f;cursor:pointer;background:0 0;border:0;border-radius:4px;align-items:center;gap:4px;height:28px;padding:0 2px 0 6px;font:13px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;transition:background-color .1s;display:inline-flex}.de-dd:hover:not(:disabled),.de-dd-open{background:var(--de-tb-hover,#44474614)}.de-dd:disabled{opacity:.38;cursor:default}.de-dd>svg{color:var(--de-tb-ink,#444746);flex:none}.de-dd-label{text-overflow:ellipsis;white-space:nowrap;text-align:left;flex:1;min-width:0;overflow:hidden}.de-dd-ph{color:var(--de-muted)}.de-dd-pop{z-index:40;color:#1f1f1f;background:#fff;border-radius:8px;min-width:100%;max-height:min(380px,60vh);padding:6px 0;font:13px/1.3 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-dd-opt{white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:8px;min-height:32px;padding:4px 16px 4px 10px;display:flex}.de-dd-opt>svg{color:#444746;flex:none}.de-dd-hi{background:#f1f3f4}.de-dd-dis{opacity:.4;cursor:default}.de-dd-check{color:#0b57d0;flex:none;width:16px;display:inline-flex}.de-dd-text{text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.de-dd-hint{color:var(--de-muted);font-variant-numeric:tabular-nums;margin-left:auto;padding-left:28px;font-size:12px}.de-dd-sep{background:#e3e3e3;height:1px;margin:6px 0}.de-dd-head{color:var(--de-muted);letter-spacing:.04em;text-transform:uppercase;-webkit-user-select:none;user-select:none;padding:6px 16px 2px 10px;font-size:11px;font-weight:600}.de-dd.de-file{flex:none;padding:0 4px 0 8px;font-weight:500}.de-dd.de-file+.de-dd-pop{max-height:720px}.de-size{align-items:center;gap:1px;display:inline-flex;position:relative}.de-size-step{width:24px}.de-size-input{color:#1f1f1f;text-align:center;background:0 0;border:1px solid #747775;border-radius:4px;outline:none;width:38px;height:26px;padding:0;font:13px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-size-input:focus{border-color:var(--de-accent);box-shadow:inset 0 0 0 1px var(--de-accent);background:#fff}.de-size-input:disabled{opacity:.38}.de-size-pop{width:40px;min-width:40px;padding:4px 0;left:25px}.de-size-pop .de-dd-opt{justify-content:center;min-height:28px;padding:0}.de-borders{grid-template-columns:repeat(4,30px);gap:4px;display:grid}.de-borders .de-tb{width:30px;height:30px}.de-tb-grid{grid-template-columns:repeat(8,18px);gap:4px;display:grid}.de-tb-grid button{cursor:pointer;border:1px solid #00000026;border-radius:50%;width:18px;height:18px;padding:0}.de-tb-grid button:hover{transform:scale(1.15)}.de-tb-grid button.on{box-shadow:0 0 0 2px #fff, 0 0 0 3.5px var(--de-accent)}.de-tb-custom{color:var(--de-muted);letter-spacing:.04em;text-transform:uppercase;margin:10px 0 6px;font-size:11px;font-weight:600}.de-tb-grid button.de-tb-add{color:#444746;background:#fff;border:1px dashed #80868b;justify-content:center;align-items:center;display:inline-flex}.de-tb-native{opacity:0;pointer-events:none;border:0;width:1px;height:1px;padding:0;position:absolute;bottom:0;left:0}.de-editing{caret-color:#000;outline:none}.de-editing .de-page-inner{cursor:text}.de-editing [contenteditable=false]{cursor:default}.de-find{z-index:6;border:1px solid var(--de-border);box-shadow:var(--de-shadow);background:#fff;border-radius:8px;flex-direction:column;gap:4px;padding:6px;display:flex;position:absolute;top:10px;right:18px}.de-find-row{align-items:center;gap:2px;display:flex}.de-find input{border:1px solid var(--de-border);width:200px;height:28px;font:inherit;border-radius:6px;outline:none;padding:0 8px}.de-find input:focus{border-color:var(--de-accent)}.de-find-count{text-align:center;min-width:56px;color:var(--de-muted);font-variant-numeric:tabular-nums;font-size:12px}::highlight(de-find){background-color:#fde293}::highlight(de-find-cur){background-color:#ff9632}.de-range{pointer-events:none;z-index:2;background:#1a73e81a;border:1px solid #1a73e899;position:absolute}.de-cell-edit{z-index:5;border:2px solid var(--de-accent);resize:none;white-space:pre-wrap;background:#fff;outline:none;padding:1px 3px;line-height:1.2;position:absolute;overflow:hidden;box-shadow:0 2px 8px #00000026}.de-fx-input{font:inherit;color:inherit;background:0 0;border:0;outline:none}.de-fx-input:focus{box-shadow:inset 0 -2px 0 var(--de-accent);background:#fff}.de-tb-hint{color:var(--de-muted);margin-left:8px;font-size:12px}.de-slide-editable [data-sid]:hover{outline:1px dashed #1a73e899}.de-txt-edit{outline:2px solid var(--de-accent);outline-offset:0;caret-color:#000;cursor:text;z-index:2}.de-gridpick{grid-template-columns:repeat(8,16px);gap:3px;display:grid}.de-gridpick button{cursor:pointer;background:#fff;border:1px solid #c8ccd1;border-radius:2px;width:16px;height:16px;padding:0}.de-gridpick button.on{border-color:var(--de-accent);background:#d3e3fd}.de-gridpick-label{text-align:center;color:var(--de-muted);margin-top:6px;font-size:12px}.de-prompt{align-items:center;gap:6px;display:flex}.de-prompt input{border:1px solid var(--de-border);width:240px;height:28px;font:inherit;border-radius:6px;outline:none;padding:0 8px}.de-prompt input:focus{border-color:var(--de-accent)}.de-prompt .de-btn{border:1px solid var(--de-border);background:#fff}.de-shape-sel{border:1.5px solid var(--de-accent);pointer-events:none;z-index:5;transform-origin:50%;position:absolute}.de-handle{border:1px solid var(--de-accent);pointer-events:auto;background:#fff;border-radius:2px;position:absolute}.de-h-nw,.de-h-se{cursor:nwse-resize}.de-h-ne,.de-h-sw{cursor:nesw-resize}.de-h-n,.de-h-s{cursor:ns-resize}.de-h-e,.de-h-w{cursor:ew-resize}.de-slide-editable [data-top]{cursor:move}.de-slide-editable [data-sid]{cursor:text}.de-present{z-index:2147483000;cursor:none;background:#000;outline:none;justify-content:center;align-items:center;display:flex;position:fixed;top:0;bottom:0;left:0;right:0}.de-present .de-slide{box-shadow:none}.de-present-n{color:#ffffff80;font:12px system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:12px;right:16px}.de-present-btn{z-index:4;position:absolute;bottom:56px;right:16px}.de-grip-c{cursor:col-resize;z-index:3;width:6px;position:absolute;top:0}.de-grip-r{cursor:row-resize;z-index:3;height:6px;position:absolute;left:0}.de-grip-c:hover,.de-grip-r:hover{background:#1a73e859}.de-ctx{z-index:50;color:#1f1f1f;-webkit-user-select:none;user-select:none;background:#fff;border-radius:8px;min-width:240px;max-width:340px;padding:6px 0;font:13px/1.3 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:fixed;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-ctx-row{display:contents}.de-ctx button{width:100%;min-height:30px;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:10px;padding:4px 16px 4px 12px;display:flex}.de-ctx button.de-ctx-hi:not(:disabled){background:#f1f3f4}.de-ctx button:disabled{color:#b0b4ba;cursor:default}.de-ctx-icon{color:#444746;flex:none;width:16px;display:inline-flex}.de-ctx button:disabled .de-ctx-icon{opacity:.4}.de-ctx-label{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.de-ctx-hint{color:var(--de-muted);margin-left:16px;font-size:12px}.de-ctx-sep{background:#e3e3e3;height:1px;margin:6px 0}.de-ctx-head{color:var(--de-muted);letter-spacing:.03em;text-transform:uppercase;padding:6px 16px 2px 38px;font-size:11px;font-weight:600}.de-tab-add{padding:0 10px;font-size:18px}.de-tab-input{border:1px solid var(--de-accent);width:120px;font:inherit;border-radius:4px;margin:4px 2px;padding:0 6px}.de-fx{position:relative}.de-fref{pointer-events:none;z-index:2;border:2px solid;position:absolute}.de-fref-pt{border-style:dashed}.de-cell-hl{z-index:4;pointer-events:none;color:#202124;overflow-wrap:break-word;overflow:hidden}.de-cell-edit{overflow-wrap:break-word}.de-cell-edit-fx{color:#0000;caret-color:#202124;box-shadow:none;background:0 0}.de-cell-edit-fx::selection{color:#0000;background:#1a73e840}.de-fassist-at{z-index:30;position:absolute}.de-fassist{border:1px solid var(--de-border);min-width:240px;max-width:420px;color:var(--de-text);text-align:left;white-space:normal;background:#fff;border-radius:6px;padding:4px 0;font:12px/1.45 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 4px 16px #0f172a29}.de-fsug{cursor:pointer;text-overflow:ellipsis;white-space:nowrap;padding:3px 10px;overflow:hidden}.de-fsug.on{background:#e8f0fe}.de-fsug-name{font-weight:600}.de-fsug-args{color:var(--de-muted);margin-left:2px}.de-fsug-desc{color:var(--de-muted);white-space:normal;margin-top:2px;font-size:11.5px}.de-fhint{padding:6px 10px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.de-fhint .de-fsug-desc{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-fhint b{color:var(--de-accent)}.de-img-sel{z-index:4;border:1.5px solid var(--de-accent);pointer-events:none;position:absolute}.de-img-h{border:1.5px solid var(--de-accent);pointer-events:auto;background:#fff;border-radius:2px;width:9px;height:9px;margin:-5px 0 0 -5px;position:absolute}.de-img-nw{cursor:nwse-resize;top:0;left:0}.de-img-n{cursor:ns-resize;top:0;left:50%}.de-img-ne{cursor:nesw-resize;top:0;left:100%}.de-img-e{cursor:ew-resize;top:50%;left:100%}.de-img-se{cursor:nwse-resize;top:100%;left:100%}.de-img-s{cursor:ns-resize;top:100%;left:50%}.de-img-sw{cursor:nesw-resize;top:100%;left:0}.de-img-w{cursor:ew-resize;top:50%;left:0}.de-img-size{color:#fff;white-space:nowrap;background:#202124d9;border-radius:4px;padding:2px 6px;font:11px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:-28px;left:50%;transform:translate(-50%)}.de-outline{z-index:6;background:#fff;border-radius:10px;flex-direction:column;width:240px;max-height:calc(100% - 24px);padding:6px 6px 10px;font:13px/1.35 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:flex;position:absolute;top:12px;left:12px;overflow-y:auto;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-outline-head{color:#1f1f1f;flex-shrink:0;justify-content:space-between;align-items:center;padding:4px 4px 6px 10px;font-weight:600;display:flex}.de-outline-item{color:#3c4043;width:100%;font:inherit;text-align:left;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;flex-shrink:0;padding:5px 10px;display:block;overflow:hidden}.de-outline-item:hover{background:#f1f3f4}.de-outline-item.on{color:#0b57d0;font-weight:600}.de-outline-empty{color:var(--de-muted);flex-shrink:0;padding:8px 10px}.de-outline-toggle{z-index:6;border:1px solid var(--de-border);width:34px;height:34px;box-shadow:var(--de-shadow);cursor:pointer;background:#fff;border-radius:8px;font-size:16px;position:absolute;top:12px;left:12px}.de-outline-toggle.on{display:none}.de-symbols{grid-template-columns:repeat(12,26px);gap:2px;display:grid}.de-symbols button{color:#1f1f1f;cursor:pointer;background:0 0;border:0;border-radius:4px;width:26px;height:26px;padding:0;font:15px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-symbols button:hover{background:#e8f0fe}.de-dialog-back{z-index:60;background:#20212452;justify-content:center;align-items:flex-start;padding-top:18vh;display:flex;position:fixed;top:0;bottom:0;left:0;right:0}.de-dialog{color:#1f1f1f;background:#fff;border-radius:12px;flex-direction:column;gap:10px;width:min(420px,100vw - 32px);padding:20px;font:14px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:flex;box-shadow:0 8px 28px #00000047}.de-dialog-title{font-size:16px;font-weight:600}.de-dialog-label,.de-dialog-note{color:var(--de-muted);font-size:12.5px}.de-dialog input,.de-dialog textarea{width:100%;font:inherit;resize:vertical;border:1px solid #747775;border-radius:6px;outline:none;padding:8px 10px}.de-dialog input:focus,.de-dialog textarea:focus{border-color:var(--de-accent);box-shadow:inset 0 0 0 1px var(--de-accent)}.de-dialog-btns{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}.de-dialog-btns .de-btn{border:1px solid var(--de-border);background:#fff;border-radius:18px;padding:7px 14px}.de-dialog-btns .de-btn-primary{background:var(--de-accent);border-color:var(--de-accent);color:#fff}.de-dialog-btns .de-btn-primary:hover{background:#1765cc}.de-dialog-extra{margin-right:auto}.de-details{grid-template-columns:max-content 1fr;gap:7px 18px;margin:4px 0;font-size:13px;display:grid}.de-details dt{color:var(--de-muted)}.de-details dd{overflow-wrap:anywhere;min-width:0;margin:0}.de-details-sep{background:#e3e3e3;grid-column:1/-1;height:1px}.de-toast{z-index:60;color:#fff;background:#323232;border-radius:6px;padding:10px 16px;font:13px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000004d}.de-xlsx{position:relative}.de-xlsx .de-find{top:40px}.de-find-opts{color:#3c4043;gap:10px;padding:2px 4px;font-size:12px}.de-find-opt{cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:4px;display:inline-flex}.de-findcell{z-index:1;pointer-events:none;background:#fbbc0447;position:absolute}.de-findcell.on{background:#ff963273;box-shadow:inset 0 0 0 1.5px #e37400}.de-borders-pop{align-items:flex-start;gap:8px;display:flex}.de-borders-side{border-left:1px solid #e3e3e3;flex-direction:column;gap:4px;padding-left:8px;display:flex}.de-find .de-find-opt input{width:auto;height:auto;accent-color:var(--de-accent);margin:0;padding:0}.de-find-opts{justify-content:flex-start}.de-collab{flex:none;align-items:center;gap:8px;display:inline-flex}.de-collab-status{height:24px;color:var(--de-muted);background:var(--de-head);white-space:nowrap;border-radius:12px;align-items:center;gap:6px;padding:0 9px;font-size:12px;display:inline-flex}.de-collab-dot{background:#9aa0a6;border-radius:50%;flex:none;width:7px;height:7px}.de-collab-live .de-collab-dot{background:#1e8e3e;box-shadow:0 0 0 3px #1e8e3e2e}.de-collab-live{color:#137333}.de-collab-connecting .de-collab-dot,.de-collab-syncing .de-collab-dot{background:#f9ab00;animation:1s ease-in-out infinite alternate de-collab-pulse}.de-collab-offline .de-collab-dot{background:#9aa0a6}.de-collab-error{color:#c5221f}.de-collab-error .de-collab-dot{background:#d93025}@keyframes de-collab-pulse{to{opacity:.35}}@media (max-width:640px){.de-collab-label{display:none}}.de-peers{align-items:center;display:inline-flex}.de-peer{border:2px solid var(--de-chrome);color:#fff;letter-spacing:.02em;cursor:default;-webkit-user-select:none;user-select:none;border-radius:50%;place-items:center;width:26px;height:26px;margin-left:-6px;font-size:11px;font-weight:600;display:inline-grid}.de-peer:first-child{margin-left:0}.de-peer-more{background:var(--de-muted)}.de-peer-layer{pointer-events:none;z-index:4;position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden}.de-peer-caret{background:var(--peer);border-radius:1px;width:2px;margin-left:-1px;position:absolute}.de-peer-caret:before{content:"";background:var(--peer);border-radius:50%;width:6px;height:6px;position:absolute;top:-3px;left:-2px}.de-peer-flag{background:var(--peer);color:#fff;white-space:nowrap;border-radius:4px 4px 4px 0;margin-bottom:2px;padding:1px 6px;font:600 11px/16px system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:100%;left:-1px}.de-peer-sel{background:var(--peer);opacity:.18;border-radius:1px;position:absolute}.de-peer-outline{border:2px solid var(--peer);border-radius:3px;position:absolute}.de-peer-outline>.de-peer-flag{margin-bottom:1px;left:-2px}.de-peer-range{pointer-events:none;z-index:2;border:2px solid;position:absolute}.de-peer-tag{color:#fff;white-space:nowrap;border-radius:3px 3px 3px 0;padding:0 5px;font:600 10px/15px system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:-17px;left:-2px}`,pf=`office-engine-styles`;function mf(e=typeof document<`u`?document:void 0){if(!e)return;let t=e instanceof Document?e.head:e;if(t.querySelector?.(`style#${pf}`))return;let n=(e instanceof Document?e:e.ownerDocument).createElement(`style`);n.id=pf,n.textContent=ff,t.appendChild(n)}var hf=`
|
|
46
|
+
`&&o++,r.push(i),n.push(r),r=[],i=``):i+=s}return(i!==``||r.length)&&(r.push(i),n.push(r)),n}function Ld(e){let t=``;for(let n=e+1;n>0;n=Math.floor((n-1)/26))t=String.fromCharCode(65+(n-1)%26)+t;return t}var Rd=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/;function zd(e,t,n){if(t===``)return``;let r=t.trim();return n&&/^[-+]?\d*,\d+$/.test(r)&&(r=r.replace(`,`,`.`)),Rd.test(r)&&!/^[-+]?0\d/.test(r)&&r.replace(/\D/g,``).length<=15?`<c r="${e}"><v>${Number(r)}</v></c>`:/^(true|false)$/i.test(r)?`<c r="${e}" t="b"><v>${+!!/^true$/i.test(r)}</v></c>`:`<c r="${e}" t="inlineStr"><is><t xml:space="preserve">${te(t)}</t></is></c>`}function Bd(e,t=`Sheet1`,n=!1){let r=[],i=``;e.forEach((e,t)=>{let a=``;e.forEach((e,i)=>{a+=zd(Ld(i)+(t+1),e,n);let o=Math.max(...e.split(`
|
|
47
|
+
`).map(e=>e.length));o>(r[i]??0)&&(r[i]=o)}),a&&(i+=`<row r="${t+1}">${a}</row>`)});let a=``;r.forEach((e,t)=>{e>9&&(a+=`<col min="${t+1}" max="${t+1}" width="${Math.min(60,e+2)}" customWidth="1"/>`)});let o=t.replace(/[\\/?*[\]:]/g,` `).slice(0,31).trim()||`Sheet1`,s=`http://schemas.openxmlformats.org/spreadsheetml/2006/main`;return be(new Map([[`[Content_Types].xml`,`${Ad}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">${Nd}<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>`],[`_rels/.rels`,Pd(`xl/workbook.xml`)],[`xl/workbook.xml`,`${Ad}<workbook xmlns="${s}" xmlns:r="${jd}"><bookViews><workbookView/></bookViews><sheets><sheet name="${ne(o)}" sheetId="1" r:id="rId1"/></sheets></workbook>`],[`xl/_rels/workbook.xml.rels`,`${Ad}<Relationships xmlns="${Md}"><Relationship Id="rId1" Type="${jd}/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="${jd}/styles" Target="styles.xml"/></Relationships>`],[`xl/styles.xml`,`${Ad}<styleSheet xmlns="${s}"><fonts count="1"><font><sz val="11"/><name val="Calibri"/><family val="2"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`],[`xl/worksheets/sheet1.xml`,`${Ad}<worksheet xmlns="${s}" xmlns:r="${jd}"><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/>${a?`<cols>${a}</cols>`:``}<sheetData>${i}</sheetData></worksheet>`]]),kd)}function Vd(e){return e.replace(/^/,``).split(/\r\n|\r|\n/).map(e=>({runs:e?[{text:e}]:[]}))}var Hd=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`);function Ud(e){let t=[];return e=e.replace(/`([^`]+)`/g,(e,n)=>`\u0000${t.push(n)-1}\u0000`),e=e.replace(/!\[([^\]]*)\]\(([^)\s]+)[^)]*\)/g,`$1`).replace(/\[([^\]]+)\]\(([^)\s]+)[^)]*\)/g,(e,t,n)=>/^\s*javascript:/i.test(n)?t:`<a href="${n}">${t}</a>`).replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g,`<b>$2</b>`).replace(/(^|[^*\w])\*(?=\S)(.+?)(?<=\S)\*(?!\*)/g,`$1<i>$2</i>`).replace(/(^|[^_\w])_(?=\S)(.+?)(?<=\S)_(?!\w)/g,`$1<i>$2</i>`).replace(/~~(?=\S)(.+?)(?<=\S)~~/g,`<s>$1</s>`),e.replace(/\u0000(\d+)\u0000/g,(e,n)=>`<code>${t[Number(n)]}</code>`)}function Wd(e){let t=e.replace(/^/,``).split(/\r\n|\r|\n/),n=[],r=[],i=null,a=()=>{r.length&&n.push(`<p>${Ud(Hd(r.join(` `)))}</p>`),r=[]},o=()=>{i&&n.push(`</${i}>`),i=null};for(let e=0;e<t.length;e++){let s=t[e],c=/^\s*(```|~~~)/.exec(s);if(c){a(),o();let r=[];for(;++e<t.length&&!t[e].trimStart().startsWith(c[1]);)r.push(t[e]);n.push(`<pre><code>${Hd(r.join(`
|
|
48
|
+
`))}</code></pre>`);continue}if(!s.trim()){a(),o();continue}let l=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(s);if(l){a(),o(),n.push(`<h${l[1].length}>${Ud(Hd(l[2]))}</h${l[1].length}>`);continue}if(/^\s{0,3}([-*_])(\s*\1){2,}\s*$/.test(s)){a(),o();continue}if(s.includes(`|`)&&/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/.test(t[e+1]??``)){a(),o();let r=e=>e.trim().replace(/^\||\|$/g,``).split(`|`).map(e=>Ud(Hd(e.trim()))),i=[`<tr>${r(s).map(e=>`<th><b>${e}</b></th>`).join(``)}</tr>`];for(e++;e+1<t.length&&t[e+1].includes(`|`)&&t[e+1].trim();)i.push(`<tr>${r(t[++e]).map(e=>`<td>${e}</td>`).join(``)}</tr>`);n.push(`<table>${i.join(``)}</table>`);continue}let u=/^\s*(?:([-*+])|(\d+)[.)])\s+(.*)$/.exec(s);if(u){a();let e=u[1]?`ul`:`ol`;i!==e&&(o(),n.push(`<${e}>`),i=e),n.push(`<li>${Ud(Hd(u[3].replace(/^\[[ xX]\]\s+/,e=>e[1]===` `?`☐ `:`☑ `)))}</li>`);continue}let d=/^\s*>\s?(.*)$/.exec(s);d?(a(),o(),n.push(`<blockquote><i>${Ud(Hd(d[1]))}</i></blockquote>`)):i&&/^\s{2,}\S/.test(s)?n[n.length-1]=n[n.length-1].replace(/<\/li>$/,` ${Ud(Hd(s.trim()))}</li>`):(o(),r.push(s.trim()))}return a(),o(),n.join(`
|
|
49
|
+
`)}var Gd=Object.fromEntries(Object.entries(et).map(([e,t])=>[t,e]));function Kd(e){if(!e)return``;let t=``;e.font&&(t+=`<w:rFonts w:ascii="${ne(e.font)}" w:hAnsi="${ne(e.font)}" w:eastAsia="${ne(e.font)}" w:cs="${ne(e.font)}"/>`),e.b&&(t+=`<w:b/>`),e.i&&(t+=`<w:i/>`),e.strike&&(t+=`<w:strike/>`),e.color&&(t+=`<w:color w:val="${e.color.replace(`#`,``).toUpperCase()}"/>`),e.sz&&(t+=`<w:sz w:val="${Math.round(e.sz*2)}"/><w:szCs w:val="${Math.round(e.sz*2)}"/>`);let n=e.hl?Gd[e.hl.toLowerCase()]:void 0;return n&&(t+=`<w:highlight w:val="${n}"/>`),e.u&&e.u!==`none`&&(t+=`<w:u w:val="${e.u}"/>`),e.hl&&!n&&(t+=`<w:shd w:val="clear" w:color="auto" w:fill="${e.hl.replace(`#`,``).toUpperCase()}"/>`),e.va&&(t+=`<w:vertAlign w:val="${e.va===`sup`?`superscript`:`subscript`}"/>`),t?`<w:rPr>${t}</w:rPr>`:``}function qd(e){let t=``;for(let n of e.text.split(/(\t|\n)/))n&&(t+=n===` `?`<w:tab/>`:n===`
|
|
50
|
+
`?`<w:br/>`:`<w:t xml:space="preserve">${te(n)}</w:t>`);return t?`<w:r>${Kd(e.set)}${t}</w:r>`:``}function Jd(){let e=[20,16,14,12,11,11],t=``;return e.forEach((e,n)=>{let r=n+1;t+=`<w:style w:type="paragraph" w:styleId="Heading${r}"><w:name w:val="heading ${r}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="${r<=2?360:240}" w:after="${r<=2?120:80}"/><w:outlineLvl w:val="${n}"/></w:pPr><w:rPr>${r<=4?`<w:b/>`:``}${r>=5?`<w:i/>`:``}<w:color w:val="${r<=2?`1F3864`:`2F5496`}"/><w:sz w:val="${e*2}"/><w:szCs w:val="${e*2}"/></w:rPr></w:style>`}),t}function Yd(e){let t=[`•`,`◦`,`▪`],n=[`decimal`,`lowerLetter`,`lowerRoman`],r=e=>Array.from({length:9},(r,i)=>{let a=e===`bullet`?`bullet`:n[i%3],o=e===`bullet`?t[i%3]:`%${i+1}.`,s=e===`bullet`?`<w:rPr><w:rFonts w:ascii="Arial" w:hAnsi="Arial"/></w:rPr>`:``;return`<w:lvl w:ilvl="${i}"><w:start w:val="1"/><w:numFmt w:val="${a}"/><w:lvlText w:val="${o}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(i+1)}" w:hanging="360"/></w:pPr>${s}</w:lvl>`}).join(``),i=`${Ad}<w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">`;return i+=`<w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="hybridMultilevel"/>${r(`bullet`)}</w:abstractNum>`,i+=`<w:abstractNum w:abstractNumId="1"><w:multiLevelType w:val="hybridMultilevel"/>${r(`number`)}</w:abstractNum>`,e.forEach((e,t)=>{i+=`<w:num w:numId="${t+1}"><w:abstractNumId w:val="${e===`bullet`?0:1}"/>`,e===`number`&&(i+=`<w:lvlOverride w:ilvl="0"><w:startOverride w:val="1"/></w:lvlOverride>`),i+=`</w:num>`}),i+`</w:numbering>`}function Xd(e){let t=`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,n=[],r=[],i,a=``;for(let t of e){let e=``;t.heading&&t.heading>=1&&t.heading<=6?e+=`<w:pStyle w:val="Heading${t.heading}"/>`:t.list&&(e+=`<w:pStyle w:val="ListParagraph"/>`),t.list&&(t.list!==i&&r.push(t.list),e+=`<w:numPr><w:ilvl w:val="0"/><w:numId w:val="${r.length}"/></w:numPr>`),i=t.list;let o=``;for(let e=0;e<t.runs.length;){let r=t.runs[e].href;if(!r){o+=qd(t.runs[e++]);continue}let i=``;for(;e<t.runs.length&&t.runs[e].href===r;)i+=qd(t.runs[e++]);/^\s*javascript:/i.test(r)?o+=i:(n.push(r),o+=`<w:hyperlink r:id="rIdL${n.length}" w:history="1">${i}</w:hyperlink>`)}a+=`<w:p>${e?`<w:pPr>${e}</w:pPr>`:``}${o}</w:p>`}a||(a=`<w:p/>`);let o=`${Ad}<w:styles xmlns:w="${t}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Calibri" w:cs="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="en-US"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="160" w:line="259" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>`+Jd()+`<w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:uiPriority w:val="34"/><w:qFormat/><w:pPr><w:spacing w:after="40"/><w:ind w:left="720"/><w:contextualSpacing/></w:pPr></w:style><w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/><w:uiPriority w:val="1"/><w:semiHidden/></w:style></w:styles>`,s=`${Ad}<Relationships xmlns="${Md}"><Relationship Id="rId1" Type="${jd}/styles" Target="styles.xml"/><Relationship Id="rId2" Type="${jd}/numbering" Target="numbering.xml"/>`+n.map((e,t)=>`<Relationship Id="rIdL${t+1}" Type="${jd}/hyperlink" Target="${ne(e)}" TargetMode="External"/>`).join(``)+`</Relationships>`;return be(new Map([[`[Content_Types].xml`,`${Ad}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">${Nd}<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/></Types>`],[`_rels/.rels`,Pd(`word/document.xml`)],[`word/_rels/document.xml.rels`,s],[`word/document.xml`,`${Ad}<w:document xmlns:w="${t}" xmlns:r="${jd}"><w:body>${a}<w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/></w:sectPr></w:body></w:document>`],[`word/styles.xml`,o],[`word/numbering.xml`,Yd(r)]]),Od)}var Zd=`http://schemas.openxmlformats.org/drawingml/2006/main`,Qd=`xmlns:a="${Zd}" xmlns:r="${jd}" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"`,$d=`<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>`;function ef(e,t,n,r,i,a=`<a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p>`){return`<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${t}"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph${(n?` type="${n}"`:``)+(r===null?``:` idx="${r}"`)}/></p:nvPr></p:nvSpPr>${i?`<p:spPr><a:xfrm><a:off x="${i[0]}" y="${i[1]}"/><a:ext cx="${i[2]}" cy="${i[3]}"/></a:xfrm></p:spPr>`:`<p:spPr/>`}<p:txBody>${a}</p:txBody></p:sp>`}var tf=`${Ad}<a:theme xmlns:a="${Zd}" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="44546A"/></a:dk2><a:lt2><a:srgbClr val="E7E6E6"/></a:lt2><a:accent1><a:srgbClr val="4472C4"/></a:accent1><a:accent2><a:srgbClr val="ED7D31"/></a:accent2><a:accent3><a:srgbClr val="A5A5A5"/></a:accent3><a:accent4><a:srgbClr val="FFC000"/></a:accent4><a:accent5><a:srgbClr val="5B9BD5"/></a:accent5><a:accent6><a:srgbClr val="70AD47"/></a:accent6><a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Calibri Light"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="Calibri"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="60000"/></a:schemeClr></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:shade val="80000"/></a:schemeClr></a:solidFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="12700"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="19050"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/></a:schemeClr></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:shade val="90000"/></a:schemeClr></a:solidFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements></a:theme>`,nf=(e,t,n)=>`<a:lvl${e}pPr marL="${n?228600+(e-1)*457200:0}" indent="${n?-228600:0}" algn="l">`+(n?`<a:buFont typeface="Arial"/><a:buChar char="•"/>`:`<a:buNone/>`)+`<a:defRPr sz="${t}" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/></a:defRPr></a:lvl${e}pPr>`;function rf(){let e=`${Ad}<p:sldMaster ${Qd}><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree>${$d}`+ef(2,`Title Placeholder 1`,`title`,null,[838200,365125,10515600,1325563],`<a:bodyPr anchor="ctr"/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p>`)+ef(3,`Text Placeholder 2`,`body`,1,[838200,1825625,10515600,4351338])+`</p:spTree></p:cSld><p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/><p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/><p:sldLayoutId id="2147483650" r:id="rId2"/><p:sldLayoutId id="2147483651" r:id="rId3"/></p:sldLayoutIdLst><p:txStyles><p:titleStyle><a:lvl1pPr algn="l"><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle>${nf(1,2800,!0)}${nf(2,2400,!0)}${nf(3,2e3,!0)}${nf(4,1800,!0)}${nf(5,1800,!0)}</p:bodyStyle><p:otherStyle>${nf(1,1800,!1)}</p:otherStyle></p:txStyles></p:sldMaster>`,t=(e,t,n)=>`${Ad}<p:sldLayout ${Qd} type="${e}" preserve="1"><p:cSld name="${t}"><p:spTree>${$d}${n}</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`,n=(e,t)=>`<a:bodyPr anchor="${t}"/><a:lstStyle><a:lvl1pPr algn="ctr"><a:buNone/><a:defRPr sz="${e}"/></a:lvl1pPr></a:lstStyle><a:p><a:endParaRPr lang="en-US"/></a:p>`,r=t(`title`,`Title Slide`,ef(2,`Title 1`,`ctrTitle`,null,[1524e3,1122363,9144e3,2387600],n(6e3,`b`))+ef(3,`Subtitle 2`,`subTitle`,1,[1524e3,3602038,9144e3,1655762],n(2400,`t`))),i=`${Ad}<p:sld ${Qd}><p:cSld><p:spTree>${$d}`+ef(2,`Title 1`,`ctrTitle`,null)+ef(3,`Subtitle 2`,`subTitle`,1)+`</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`,a=(e,t,n)=>`<Relationship Id="rId${e}" Type="${jd}/${t}" Target="${n}"/>`,o=(...e)=>`${Ad}<Relationships xmlns="${Md}">${e.join(``)}</Relationships>`,s=`application/vnd.openxmlformats-officedocument.presentationml`;return be(new Map([[`[Content_Types].xml`,`${Ad}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">${Nd}<Override PartName="/ppt/presentation.xml" ContentType="${s}.presentation.main+xml"/><Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="${s}.slideMaster+xml"/>`+[1,2,3].map(e=>`<Override PartName="/ppt/slideLayouts/slideLayout${e}.xml" ContentType="${s}.slideLayout+xml"/>`).join(``)+`<Override PartName="/ppt/slides/slide1.xml" ContentType="${s}.slide+xml"/><Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/></Types>`],[`_rels/.rels`,Pd(`ppt/presentation.xml`)],[`ppt/presentation.xml`,`${Ad}<p:presentation ${Qd} saveSubsetFonts="1"><p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst><p:sldIdLst><p:sldId id="256" r:id="rId2"/></p:sldIdLst><p:sldSz cx="12192000" cy="6858000"/><p:notesSz cx="6858000" cy="9144000"/></p:presentation>`],[`ppt/_rels/presentation.xml.rels`,o(a(1,`slideMaster`,`slideMasters/slideMaster1.xml`),a(2,`slide`,`slides/slide1.xml`),a(3,`theme`,`theme/theme1.xml`))],[`ppt/slideMasters/slideMaster1.xml`,e],[`ppt/slideMasters/_rels/slideMaster1.xml.rels`,o(a(1,`slideLayout`,`../slideLayouts/slideLayout1.xml`),a(2,`slideLayout`,`../slideLayouts/slideLayout2.xml`),a(3,`slideLayout`,`../slideLayouts/slideLayout3.xml`),a(4,`theme`,`../theme/theme1.xml`))],[`ppt/slideLayouts/slideLayout1.xml`,r],[`ppt/slideLayouts/slideLayout2.xml`,t(`obj`,`Title and Content`,ef(2,`Title 1`,`title`,null)+ef(3,`Content Placeholder 2`,null,1))],[`ppt/slideLayouts/slideLayout3.xml`,t(`blank`,`Blank`,``)],...[1,2,3].map(e=>[`ppt/slideLayouts/_rels/slideLayout${e}.xml.rels`,o(a(1,`slideMaster`,`../slideMasters/slideMaster1.xml`))]),[`ppt/slides/slide1.xml`,i],[`ppt/slides/_rels/slide1.xml.rels`,o(a(1,`slideLayout`,`../slideLayouts/slideLayout1.xml`))],[`ppt/theme/theme1.xml`,tf]]),`application/vnd.openxmlformats-officedocument.presentationml.presentation`)}var af=new Set([`docx`,`dotx`,`xlsx`,`xltx`,`pptx`,`potx`]),of=new Set([`csv`,`tsv`,`tab`]),sf=new Set([`txt`,`text`,`log`]),cf=new Set([`md`,`markdown`]),lf=new Set([`html`,`htm`,`xhtml`]),uf=[...af,...of,...sf,...cf,...lf].map(e=>`.`+e).join(`,`),df=e=>Du(e).map(e=>({heading:e.heading,list:e.list,runs:e.runs.flatMap(e=>e.t===`text`?[{text:e.text,set:e.d,href:e.href}]:[])}));async function ff(e){let t=/\.([^./\\]+)$/.exec(e.name)?.[1].toLowerCase()??``,n=e.name.replace(/\.[^./\\]+$/,``)||`document`;if(af.has(t))return{src:e,name:e.name,converted:!1};if(of.has(t)){let r=await e.text(),i=t===`csv`?Fd(r):` `;return{src:await Bd(Id(r,i),n,i===`;`),name:`${n}.xlsx`,converted:!0}}let r;if(sf.has(t)?r=Vd(await e.text()):cf.has(t)?r=df(Wd(await e.text())):lf.has(t)&&(r=df(await e.text())),r)return{src:await Xd(r),name:`${n}.docx`,converted:!0};let i=new Uint8Array(await e.slice(0,4).arrayBuffer());if(i[0]===80&&i[1]===75)return{src:e,name:e.name,converted:!1};throw Error(`Cannot open “${e.name}”: supported files are Word, Excel, PowerPoint, CSV, text, Markdown and HTML`)}var pf=`.de-root{--de-bg:#e9ebee;--de-chrome:#fff;--de-border:#dadde1;--de-text:#1d2127;--de-muted:#69707a;--de-accent:#1a73e8;--de-accent-soft:#1a73e81f;--de-grid:#e2e4e7;--de-head:#f6f7f8;--de-shadow:0 1px 2px #0f172a1a, 0 2px 8px #0f172a0f;background:var(--de-bg);width:100%;height:100%;min-height:200px;color:var(--de-text);text-align:left;isolation:isolate;flex-direction:column;font:13px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,Arial,sans-serif;display:flex;position:relative;overflow:hidden}.de-root *,.de-root :before,.de-root :after{box-sizing:border-box}.de-root img{max-width:none}.de-bar{background:var(--de-chrome);border-bottom:1px solid var(--de-border);z-index:21;flex:none;align-items:center;gap:10px;min-height:40px;padding:6px 12px;display:flex;position:relative}.de-badge{letter-spacing:.06em;text-transform:uppercase;color:#fff;border-radius:4px;flex:none;padding:4px 6px;font:600 10px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-badge-docx{background:#2b579a}.de-badge-xlsx{background:#217346}.de-badge-pptx{background:#c43e1c}.de-title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:600;overflow:hidden}.de-status{color:var(--de-muted);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}.de-progress{background:var(--de-accent);height:2px;transition:width .2s,opacity .4s;position:absolute;bottom:-1px;left:0}.de-body{flex:1;min-height:0;display:flex;position:relative}.de-scroll{overscroll-behavior:contain;flex:1;min-width:0;position:relative;overflow:auto}.de-center{color:var(--de-muted);text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:12px;padding:24px;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}.de-spinner{border:3px solid var(--de-accent-soft);border-top-color:var(--de-accent);border-radius:50%;width:28px;height:28px;animation:.8s linear infinite de-spin}@keyframes de-spin{to{transform:rotate(360deg)}}.de-error{color:#b42318;max-width:460px;box-shadow:var(--de-shadow);background:#fff;border:1px solid #f3c2bd;border-radius:8px;padding:14px 18px}.de-zoom{z-index:4;background:var(--de-chrome);border:1px solid var(--de-border);box-shadow:var(--de-shadow);border-radius:8px;align-items:center;display:flex;position:absolute;bottom:16px;right:16px;overflow:hidden}.de-zoom button,.de-tab,.de-btn{-webkit-appearance:none;appearance:none;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0}.de-zoom button{width:32px;height:30px;font-size:16px;line-height:1}.de-zoom button:hover,.de-btn:hover{background:var(--de-accent-soft)}.de-zoom span{text-align:center;font-variant-numeric:tabular-nums;cursor:pointer;min-width:52px;font-size:12px}.de-btn{border-radius:6px;padding:4px 8px}.de-pages{position:relative}.de-page{box-shadow:var(--de-shadow);background:#fff;position:absolute;overflow:hidden}.de-page-inner{transform-origin:0 0;position:relative}.de-page-skeleton{box-shadow:var(--de-shadow);opacity:.6;background:#fff;position:absolute}.de-page-skeleton:after{content:"";background:repeating-linear-gradient(#eef0f2 0 10px,#0000 10px 24px);animation:1.4s ease-in-out infinite de-pulse;position:absolute;top:12%;bottom:12%;left:12%;right:12%}@keyframes de-pulse{50%{opacity:.45}}.de-doc{color:#000;font-kerning:normal;text-rendering:optimizelegibility}.de-doc a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}.de-hf{position:absolute;left:0;right:0}.de-measure{visibility:hidden;pointer-events:none;contain:layout style;position:absolute;top:0;left:-100000px}.de-p{white-space:pre-wrap;overflow-wrap:break-word;-moz-tab-size:36pt;tab-size:36pt;margin:0}.de-p>span{white-space:inherit}.de-marker{text-indent:0;white-space:pre;display:inline-block}.de-tbl{border-collapse:collapse;table-layout:fixed}.de-tbl td{vertical-align:top;overflow-wrap:break-word;text-indent:0;padding:0}.de-img-missing,.de-ph{color:#6a737d;text-indent:0;vertical-align:bottom;background:repeating-linear-gradient(45deg,#f6f7f9 0 8px,#eff1f4 8px 16px);border:1px dashed #b8bec6;justify-content:center;align-items:center;font:12px/1.2 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:inline-flex;overflow:hidden}.de-tbox{vertical-align:top;text-indent:0;padding:3.6pt 7.2pt;display:inline-block;overflow:hidden}.de-xlsx{flex-direction:column;flex:1;min-width:0;display:flex}.de-fx{background:var(--de-chrome);border-bottom:1px solid var(--de-border);flex:none;align-items:stretch;height:30px;font:12px/30px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;display:flex}.de-fx-ref{border-right:1px solid var(--de-border);width:88px;color:var(--de-muted);flex:none;padding:0 10px}.de-fx-val{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;padding:0 10px;overflow:hidden}.de-grid{background:#fff;outline:none;flex:1;min-height:0;position:relative;overflow:auto}.de-grid-view{z-index:1;position:sticky;top:0;left:0;overflow:hidden}.de-region{position:absolute;overflow:hidden}.de-gl-h,.de-gl-v{background:var(--de-grid);position:absolute}.de-gl-h{height:1px;left:0;right:0}.de-gl-v{width:1px;top:0;bottom:0}.de-cell{white-space:pre;align-items:flex-end;padding:0 3px 1px;line-height:1.2;display:flex;position:absolute;overflow:hidden}.de-cell>span{min-width:0}.de-cell.de-ov{overflow:visible}.de-head-c,.de-head-r{background:var(--de-head);color:#5f6368;font-variant-numeric:tabular-nums;-webkit-user-select:none;user-select:none;border-bottom:1px solid #d3d6da;border-right:1px solid #d3d6da;justify-content:center;align-items:center;font:11px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:flex;position:absolute}.de-head-on{color:#0b57d0;background:#d3e3fd;font-weight:600}.de-corner{background:var(--de-head);z-index:2;border-bottom:1px solid #c4c7cc;border-right:1px solid #c4c7cc;position:absolute;top:0;left:0}.de-freeze-h,.de-freeze-v{z-index:2;background:#b9bdc3;position:absolute}.de-sel{border:2px solid var(--de-accent);pointer-events:none;z-index:3;position:absolute}.de-tabs{background:var(--de-head);border-top:1px solid var(--de-border);scrollbar-width:thin;flex:none;align-items:stretch;gap:2px;height:34px;padding:0 8px;display:flex;overflow-x:auto}.de-tab{color:var(--de-muted);white-space:nowrap;border-radius:0 0 6px 6px;flex:none;padding:0 14px}.de-tab:hover{background:#eceef1}.de-tab[aria-selected=true]{color:#188038;background:#fff;font-weight:600;box-shadow:inset 0 2px #188038}.de-thumbs{border-right:1px solid var(--de-border);background:var(--de-chrome);flex:none;width:188px;position:relative;overflow-y:auto}.de-thumb{cursor:pointer;gap:6px;padding:0 10px 0 6px;display:flex;position:absolute;left:0;right:0}.de-thumb-n{text-align:right;width:18px;color:var(--de-muted);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.de-thumb .de-slide{outline:1px solid var(--de-border)}.de-thumb[aria-current=true] .de-slide{outline:2px solid var(--de-accent)}.de-slide{background:#fff;position:relative;overflow:hidden}.de-slide-frame{box-shadow:var(--de-shadow);position:absolute}.de-slide-inner{transform-origin:0 0;color:#000;position:absolute;top:0;left:0;overflow:hidden}.de-el{position:absolute}.de-txt{flex-direction:column;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}.de-txt>div{white-space:pre-wrap;overflow-wrap:break-word}.de-txt.de-nowrap>div{white-space:pre}.de-slide-editable .de-el>.de-txt:empty{outline-offset:-1px;outline:1.5px dashed #3c404366}.de-slide-editable .de-el>.de-txt:empty:after{content:"Click to add text";color:#80868b;text-align:center;pointer-events:none;font:28px/1.2 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,Arial,sans-serif}.de-bul{text-indent:0;white-space:pre;display:inline-block}.de-stbl{border-collapse:collapse;table-layout:fixed;width:100%}.de-stbl td{vertical-align:top;padding:0;position:relative}.de-hidden-slide{opacity:.55}.de-mode{border:1px solid var(--de-border);background:var(--de-chrome);height:28px;color:inherit;font:inherit;cursor:pointer;border-radius:6px;flex:none;align-items:center;gap:6px;padding:0 10px;font-weight:500;display:inline-flex}.de-mode:hover{background:var(--de-accent-soft)}.de-mode-on{border-color:var(--de-accent);color:var(--de-accent)}.de-save-dirty{background:var(--de-accent);border-color:var(--de-accent);color:#fff}.de-save-dirty:hover{background:#1765cc}.de-mode:disabled{opacity:.6;cursor:default}.de-ebar-host{background:var(--de-chrome);border-bottom:1px solid var(--de-border);z-index:20;flex:none;padding:6px 10px;position:relative}.de-ebar{--de-tb-ink:#444746;--de-tb-hover:#44474614;--de-tb-on:#d3e3fd;min-width:0;height:40px;color:var(--de-tb-ink);background:#eef2f9;border-radius:20px;flex-wrap:nowrap;align-items:center;gap:2px;padding:0 8px;display:flex}.de-ebar-it{flex:none;align-items:center;display:inline-flex}.de-ebar-morewrap{margin-left:auto}.de-tb-pop.de-ebar-more{background:#eef2f9;flex-wrap:wrap;align-items:center;gap:2px;width:max-content;max-width:min(360px,90vw);padding:6px;display:flex;left:auto;right:0}.de-tb{-webkit-appearance:none;appearance:none;width:28px;height:28px;color:var(--de-tb-ink,#444746);cursor:pointer;background:0 0;border:0;border-radius:4px;justify-content:center;align-items:center;padding:0;font:600 14px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;transition:background-color .1s;display:inline-flex;position:relative}.de-tb:hover:not(:disabled){background:var(--de-tb-hover,#44474614)}.de-tb:focus-visible{outline:2px solid var(--de-accent);outline-offset:-2px}.de-dd:focus-visible{outline:2px solid var(--de-accent);outline-offset:-2px}.de-tb-on{color:#041e49;background:var(--de-tb-on,#d3e3fd)!important}.de-tb:disabled{opacity:.38;cursor:default}.de-tb-chev{gap:0;width:auto;padding:0 2px 0 4px}.de-tb-sep{background:#c7c7c7;flex:none;width:1px;height:20px;margin:0 5px}.de-tb-color{display:inline-flex;position:relative}.de-tb-swatch{border-radius:1px;height:3px;position:absolute;bottom:3px;left:6px;right:6px;box-shadow:inset 0 0 0 1px #0000001f}.de-tb-pop{z-index:30;background:#fff;border-radius:8px;padding:10px;position:absolute;top:calc(100% + 6px);left:0;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-tb-none{border:1px solid var(--de-border);width:100%;font:inherit;cursor:pointer;background:#fff;border-radius:4px;margin-bottom:8px;padding:5px}.de-tb-none:hover{background:#f1f3f4}.de-dd-wrap{display:inline-flex;position:relative}.de-dd{-webkit-appearance:none;appearance:none;color:#1f1f1f;cursor:pointer;background:0 0;border:0;border-radius:4px;align-items:center;gap:4px;height:28px;padding:0 2px 0 6px;font:13px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;transition:background-color .1s;display:inline-flex}.de-dd:hover:not(:disabled),.de-dd-open{background:var(--de-tb-hover,#44474614)}.de-dd:disabled{opacity:.38;cursor:default}.de-dd>svg{color:var(--de-tb-ink,#444746);flex:none}.de-dd-label{text-overflow:ellipsis;white-space:nowrap;text-align:left;flex:1;min-width:0;overflow:hidden}.de-dd-ph{color:var(--de-muted)}.de-dd-pop{z-index:40;color:#1f1f1f;background:#fff;border-radius:8px;min-width:100%;max-height:min(380px,60vh);padding:6px 0;font:13px/1.3 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-dd-opt{white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:8px;min-height:32px;padding:4px 16px 4px 10px;display:flex}.de-dd-opt>svg{color:#444746;flex:none}.de-dd-hi{background:#f1f3f4}.de-dd-dis{opacity:.4;cursor:default}.de-dd-check{color:#0b57d0;flex:none;width:16px;display:inline-flex}.de-dd-text{text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.de-dd-hint{color:var(--de-muted);font-variant-numeric:tabular-nums;margin-left:auto;padding-left:28px;font-size:12px}.de-dd-sep{background:#e3e3e3;height:1px;margin:6px 0}.de-dd-head{color:var(--de-muted);letter-spacing:.04em;text-transform:uppercase;-webkit-user-select:none;user-select:none;padding:6px 16px 2px 10px;font-size:11px;font-weight:600}.de-dd.de-file{flex:none;padding:0 4px 0 8px;font-weight:500}.de-dd.de-file+.de-dd-pop{max-height:720px}.de-size{align-items:center;gap:1px;display:inline-flex;position:relative}.de-size-step{width:24px}.de-size-input{color:#1f1f1f;text-align:center;background:0 0;border:1px solid #747775;border-radius:4px;outline:none;width:38px;height:26px;padding:0;font:13px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-size-input:focus{border-color:var(--de-accent);box-shadow:inset 0 0 0 1px var(--de-accent);background:#fff}.de-size-input:disabled{opacity:.38}.de-size-pop{width:40px;min-width:40px;padding:4px 0;left:25px}.de-size-pop .de-dd-opt{justify-content:center;min-height:28px;padding:0}.de-borders{grid-template-columns:repeat(4,30px);gap:4px;display:grid}.de-borders .de-tb{width:30px;height:30px}.de-tb-grid{grid-template-columns:repeat(8,18px);gap:4px;display:grid}.de-tb-grid button{cursor:pointer;border:1px solid #00000026;border-radius:50%;width:18px;height:18px;padding:0}.de-tb-grid button:hover{transform:scale(1.15)}.de-tb-grid button.on{box-shadow:0 0 0 2px #fff, 0 0 0 3.5px var(--de-accent)}.de-tb-custom{color:var(--de-muted);letter-spacing:.04em;text-transform:uppercase;margin:10px 0 6px;font-size:11px;font-weight:600}.de-tb-grid button.de-tb-add{color:#444746;background:#fff;border:1px dashed #80868b;justify-content:center;align-items:center;display:inline-flex}.de-tb-native{opacity:0;pointer-events:none;border:0;width:1px;height:1px;padding:0;position:absolute;bottom:0;left:0}.de-editing{caret-color:#000;outline:none}.de-editing .de-page-inner{cursor:text}.de-editing [contenteditable=false]{cursor:default}.de-find{z-index:6;border:1px solid var(--de-border);box-shadow:var(--de-shadow);background:#fff;border-radius:8px;flex-direction:column;gap:4px;padding:6px;display:flex;position:absolute;top:10px;right:18px}.de-find-row{align-items:center;gap:2px;display:flex}.de-find input{border:1px solid var(--de-border);width:200px;height:28px;font:inherit;border-radius:6px;outline:none;padding:0 8px}.de-find input:focus{border-color:var(--de-accent)}.de-find-count{text-align:center;min-width:56px;color:var(--de-muted);font-variant-numeric:tabular-nums;font-size:12px}::highlight(de-find){background-color:#fde293}::highlight(de-find-cur){background-color:#ff9632}.de-range{pointer-events:none;z-index:2;background:#1a73e81a;border:1px solid #1a73e899;position:absolute}.de-cell-edit{z-index:5;border:2px solid var(--de-accent);resize:none;white-space:pre-wrap;background:#fff;outline:none;padding:1px 3px;line-height:1.2;position:absolute;overflow:hidden;box-shadow:0 2px 8px #00000026}.de-fx-input{font:inherit;color:inherit;background:0 0;border:0;outline:none}.de-fx-input:focus{box-shadow:inset 0 -2px 0 var(--de-accent);background:#fff}.de-tb-hint{color:var(--de-muted);margin-left:8px;font-size:12px}.de-slide-editable [data-sid]:hover{outline:1px dashed #1a73e899}.de-txt-edit{outline:2px solid var(--de-accent);outline-offset:0;caret-color:#000;cursor:text;z-index:2}.de-gridpick{grid-template-columns:repeat(8,16px);gap:3px;display:grid}.de-gridpick button{cursor:pointer;background:#fff;border:1px solid #c8ccd1;border-radius:2px;width:16px;height:16px;padding:0}.de-gridpick button.on{border-color:var(--de-accent);background:#d3e3fd}.de-gridpick-label{text-align:center;color:var(--de-muted);margin-top:6px;font-size:12px}.de-prompt{align-items:center;gap:6px;display:flex}.de-prompt input{border:1px solid var(--de-border);width:240px;height:28px;font:inherit;border-radius:6px;outline:none;padding:0 8px}.de-prompt input:focus{border-color:var(--de-accent)}.de-prompt .de-btn{border:1px solid var(--de-border);background:#fff}.de-shape-sel{border:1.5px solid var(--de-accent);pointer-events:none;z-index:5;transform-origin:50%;position:absolute}.de-handle{border:1px solid var(--de-accent);pointer-events:auto;background:#fff;border-radius:2px;position:absolute}.de-h-nw,.de-h-se{cursor:nwse-resize}.de-h-ne,.de-h-sw{cursor:nesw-resize}.de-h-n,.de-h-s{cursor:ns-resize}.de-h-e,.de-h-w{cursor:ew-resize}.de-slide-editable [data-top]{cursor:move}.de-slide-editable [data-sid]{cursor:text}.de-present{z-index:2147483000;cursor:none;background:#000;outline:none;justify-content:center;align-items:center;display:flex;position:fixed;top:0;bottom:0;left:0;right:0}.de-present .de-slide{box-shadow:none}.de-present-n{color:#ffffff80;font:12px system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:12px;right:16px}.de-present-btn{z-index:4;position:absolute;bottom:56px;right:16px}.de-grip-c{cursor:col-resize;z-index:3;width:6px;position:absolute;top:0}.de-grip-r{cursor:row-resize;z-index:3;height:6px;position:absolute;left:0}.de-grip-c:hover,.de-grip-r:hover{background:#1a73e859}.de-ctx{z-index:50;color:#1f1f1f;-webkit-user-select:none;user-select:none;background:#fff;border-radius:8px;min-width:240px;max-width:340px;padding:6px 0;font:13px/1.3 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:fixed;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-ctx-row{display:contents}.de-ctx button{width:100%;min-height:30px;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:10px;padding:4px 16px 4px 12px;display:flex}.de-ctx button.de-ctx-hi:not(:disabled){background:#f1f3f4}.de-ctx button:disabled{color:#b0b4ba;cursor:default}.de-ctx-icon{color:#444746;flex:none;width:16px;display:inline-flex}.de-ctx button:disabled .de-ctx-icon{opacity:.4}.de-ctx-label{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.de-ctx-hint{color:var(--de-muted);margin-left:16px;font-size:12px}.de-ctx-sep{background:#e3e3e3;height:1px;margin:6px 0}.de-ctx-head{color:var(--de-muted);letter-spacing:.03em;text-transform:uppercase;padding:6px 16px 2px 38px;font-size:11px;font-weight:600}.de-tab-add{padding:0 10px;font-size:18px}.de-tab-input{border:1px solid var(--de-accent);width:120px;font:inherit;border-radius:4px;margin:4px 2px;padding:0 6px}.de-fx{position:relative}.de-fref{pointer-events:none;z-index:2;border:2px solid;position:absolute}.de-fref-pt{border-style:dashed}.de-cell-hl{z-index:4;pointer-events:none;color:#202124;overflow-wrap:break-word;overflow:hidden}.de-cell-edit{overflow-wrap:break-word}.de-cell-edit-fx{color:#0000;caret-color:#202124;box-shadow:none;background:0 0}.de-cell-edit-fx::selection{color:#0000;background:#1a73e840}.de-fassist-at{z-index:30;position:absolute}.de-fassist{border:1px solid var(--de-border);min-width:240px;max-width:420px;color:var(--de-text);text-align:left;white-space:normal;background:#fff;border-radius:6px;padding:4px 0;font:12px/1.45 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 4px 16px #0f172a29}.de-fsug{cursor:pointer;text-overflow:ellipsis;white-space:nowrap;padding:3px 10px;overflow:hidden}.de-fsug.on{background:#e8f0fe}.de-fsug-name{font-weight:600}.de-fsug-args{color:var(--de-muted);margin-left:2px}.de-fsug-desc{color:var(--de-muted);white-space:normal;margin-top:2px;font-size:11.5px}.de-fhint{padding:6px 10px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.de-fhint .de-fsug-desc{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-fhint b{color:var(--de-accent)}.de-img-sel{z-index:4;border:1.5px solid var(--de-accent);pointer-events:none;position:absolute}.de-img-h{border:1.5px solid var(--de-accent);pointer-events:auto;background:#fff;border-radius:2px;width:9px;height:9px;margin:-5px 0 0 -5px;position:absolute}.de-img-nw{cursor:nwse-resize;top:0;left:0}.de-img-n{cursor:ns-resize;top:0;left:50%}.de-img-ne{cursor:nesw-resize;top:0;left:100%}.de-img-e{cursor:ew-resize;top:50%;left:100%}.de-img-se{cursor:nwse-resize;top:100%;left:100%}.de-img-s{cursor:ns-resize;top:100%;left:50%}.de-img-sw{cursor:nesw-resize;top:100%;left:0}.de-img-w{cursor:ew-resize;top:50%;left:0}.de-img-size{color:#fff;white-space:nowrap;background:#202124d9;border-radius:4px;padding:2px 6px;font:11px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:-28px;left:50%;transform:translate(-50%)}.de-outline{z-index:6;background:#fff;border-radius:10px;flex-direction:column;width:240px;max-height:calc(100% - 24px);padding:6px 6px 10px;font:13px/1.35 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:flex;position:absolute;top:12px;left:12px;overflow-y:auto;box-shadow:0 2px 6px 2px #3c404326,0 1px 2px #3c40434d}.de-outline-head{color:#1f1f1f;flex-shrink:0;justify-content:space-between;align-items:center;padding:4px 4px 6px 10px;font-weight:600;display:flex}.de-outline-item{color:#3c4043;width:100%;font:inherit;text-align:left;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;flex-shrink:0;padding:5px 10px;display:block;overflow:hidden}.de-outline-item:hover{background:#f1f3f4}.de-outline-item.on{color:#0b57d0;font-weight:600}.de-outline-empty{color:var(--de-muted);flex-shrink:0;padding:8px 10px}.de-outline-toggle{z-index:6;border:1px solid var(--de-border);width:34px;height:34px;box-shadow:var(--de-shadow);cursor:pointer;background:#fff;border-radius:8px;font-size:16px;position:absolute;top:12px;left:12px}.de-outline-toggle.on{display:none}.de-symbols{grid-template-columns:repeat(12,26px);gap:2px;display:grid}.de-symbols button{color:#1f1f1f;cursor:pointer;background:0 0;border:0;border-radius:4px;width:26px;height:26px;padding:0;font:15px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.de-symbols button:hover{background:#e8f0fe}.de-dialog-back{z-index:60;background:#20212452;justify-content:center;align-items:flex-start;padding-top:18vh;display:flex;position:fixed;top:0;bottom:0;left:0;right:0}.de-dialog{color:#1f1f1f;background:#fff;border-radius:12px;flex-direction:column;gap:10px;width:min(420px,100vw - 32px);padding:20px;font:14px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;display:flex;box-shadow:0 8px 28px #00000047}.de-dialog-title{font-size:16px;font-weight:600}.de-dialog-label,.de-dialog-note{color:var(--de-muted);font-size:12.5px}.de-dialog input,.de-dialog textarea{width:100%;font:inherit;resize:vertical;border:1px solid #747775;border-radius:6px;outline:none;padding:8px 10px}.de-dialog input:focus,.de-dialog textarea:focus{border-color:var(--de-accent);box-shadow:inset 0 0 0 1px var(--de-accent)}.de-dialog-btns{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}.de-dialog-btns .de-btn{border:1px solid var(--de-border);background:#fff;border-radius:18px;padding:7px 14px}.de-dialog-btns .de-btn-primary{background:var(--de-accent);border-color:var(--de-accent);color:#fff}.de-dialog-btns .de-btn-primary:hover{background:#1765cc}.de-dialog-extra{margin-right:auto}.de-details{grid-template-columns:max-content 1fr;gap:7px 18px;margin:4px 0;font-size:13px;display:grid}.de-details dt{color:var(--de-muted)}.de-details dd{overflow-wrap:anywhere;min-width:0;margin:0}.de-details-sep{background:#e3e3e3;grid-column:1/-1;height:1px}.de-toast{z-index:60;color:#fff;background:#323232;border-radius:6px;padding:10px 16px;font:13px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000004d}.de-xlsx{position:relative}.de-xlsx .de-find{top:40px}.de-find-opts{color:#3c4043;gap:10px;padding:2px 4px;font-size:12px}.de-find-opt{cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:4px;display:inline-flex}.de-findcell{z-index:1;pointer-events:none;background:#fbbc0447;position:absolute}.de-findcell.on{background:#ff963273;box-shadow:inset 0 0 0 1.5px #e37400}.de-borders-pop{align-items:flex-start;gap:8px;display:flex}.de-borders-side{border-left:1px solid #e3e3e3;flex-direction:column;gap:4px;padding-left:8px;display:flex}.de-find .de-find-opt input{width:auto;height:auto;accent-color:var(--de-accent);margin:0;padding:0}.de-find-opts{justify-content:flex-start}.de-collab{flex:none;align-items:center;gap:8px;display:inline-flex}.de-collab-status{height:24px;color:var(--de-muted);background:var(--de-head);white-space:nowrap;border-radius:12px;align-items:center;gap:6px;padding:0 9px;font-size:12px;display:inline-flex}.de-collab-dot{background:#9aa0a6;border-radius:50%;flex:none;width:7px;height:7px}.de-collab-live .de-collab-dot{background:#1e8e3e;box-shadow:0 0 0 3px #1e8e3e2e}.de-collab-live{color:#137333}.de-collab-connecting .de-collab-dot,.de-collab-syncing .de-collab-dot{background:#f9ab00;animation:1s ease-in-out infinite alternate de-collab-pulse}.de-collab-offline .de-collab-dot{background:#9aa0a6}.de-collab-error{color:#c5221f}.de-collab-error .de-collab-dot{background:#d93025}@keyframes de-collab-pulse{to{opacity:.35}}@media (max-width:640px){.de-collab-label{display:none}}.de-peers{align-items:center;display:inline-flex}.de-peer{border:2px solid var(--de-chrome);color:#fff;letter-spacing:.02em;cursor:default;-webkit-user-select:none;user-select:none;border-radius:50%;place-items:center;width:26px;height:26px;margin-left:-6px;font-size:11px;font-weight:600;display:inline-grid}.de-peer:first-child{margin-left:0}.de-peer-more{background:var(--de-muted)}.de-peer-layer{pointer-events:none;z-index:4;position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden}.de-peer-caret{background:var(--peer);border-radius:1px;width:2px;margin-left:-1px;position:absolute}.de-peer-caret:before{content:"";background:var(--peer);border-radius:50%;width:6px;height:6px;position:absolute;top:-3px;left:-2px}.de-peer-flag{background:var(--peer);color:#fff;white-space:nowrap;border-radius:4px 4px 4px 0;margin-bottom:2px;padding:1px 6px;font:600 11px/16px system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;bottom:100%;left:-1px}.de-peer-sel{background:var(--peer);opacity:.18;border-radius:1px;position:absolute}.de-peer-outline{border:2px solid var(--peer);border-radius:3px;position:absolute}.de-peer-outline>.de-peer-flag{margin-bottom:1px;left:-2px}.de-peer-range{pointer-events:none;z-index:2;border:2px solid;position:absolute}.de-peer-tag{color:#fff;white-space:nowrap;border-radius:3px 3px 3px 0;padding:0 5px;font:600 10px/15px system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:-17px;left:-2px}`,mf=`office-engine-styles`;function hf(e=typeof document<`u`?document:void 0){if(!e)return;let t=e instanceof Document?e.head:e;if(t.querySelector?.(`style#${mf}`))return;let n=(e instanceof Document?e:e.ownerDocument).createElement(`style`);n.id=mf,n.textContent=pf,t.appendChild(n)}var gf=`
|
|
51
51
|
html, body { margin: 0; padding: 0; background: #fff; }
|
|
52
52
|
.de-print {
|
|
53
53
|
color: #000;
|
|
@@ -74,12 +74,12 @@ html, body { margin: 0; padding: 0; background: #fff; }
|
|
|
74
74
|
@media print {
|
|
75
75
|
.de-print-fit { zoom: var(--de-fit, 1); }
|
|
76
76
|
}
|
|
77
|
-
`,
|
|
78
|
-
`)){let i=t+n.length,a=
|
|
79
|
-
`)])}}for(let[e,t]of i)e.data=t;for(let e of a)e.style.overflow=`hidden`}async function
|
|
80
|
-
`:e.text,s:Pf(e),src:e.src})),base:e,algn:e.algn,k:e.k}}var If=e=>e.pp?.bullet??e.base.buKind??`none`,Lf=e=>e.pp?.lvl??e.base.lvl??0;function Rf(e,t=0){let n=If(e),r=Lf(e),i=e.runs.find(e=>e.t===`text`)?.s?.sz??e.base.endSz,a=e.pp?.bullet?n===`none`?void 0:{text:n===`bullet`?`•`:`${t}.`,sz:i,color:e.base.bullet?.color}:e.base.bullet,o=(r-(e.base.lvl??0))*48,s=e.pp?.bullet&&n!==`none`&&!e.base.bullet?27:0;return{...e.base,bullet:a,marL:Math.max(0,e.base.marL+o+s),indent:s?-s:e.base.indent,lnPct:e.pp?.lnPct??e.base.lnPct,algn:e.algn,runs:e.runs.map(e=>e.t===`fld`?{...e.s,text:e.text??``,fld:!0}:{...e.s,text:e.text??``})}}var zf=class{constructor(e){A(this,`client`,void 0),A(this,`input`,void 0),A(this,`paras`,[]),A(this,`body`,void 0),A(this,`slide`,-1),A(this,`sid`,-1),A(this,`pendingSel`,null),A(this,`history`,[]),A(this,`future`,[]),A(this,`pend`,null),A(this,`timer`,void 0),A(this,`changedSinceCommit`,!1),A(this,`onChange`,void 0),A(this,`onCommitted`,void 0),A(this,`onDirty`,void 0),A(this,`onState`,void 0),A(this,`shortcut`,void 0),this.client=e,this.input=new _u(this)}get active(){return this.sid>=0}begin(e,t,n){this.end(),this.slide=e,this.sid=t,this.body=n,this.paras=(n.paras.length?n.paras:[{algn:`left`,marL:0,indent:0,spcBef:0,spcAft:0,runs:[],endSz:18}]).map(Ff),this.history=[],this.future=[],this.pend=null}end(){this.sid>=0&&this.changedSinceCommit&&this.commit(),this.input.detach(),this.sid=-1,this.slide=-1,this.body=void 0,this.onState?.(null)}text(){if(!this.body)return;let e=[],t=this.paras.map(t=>{let n=Lf(t);return If(t)===`number`?e[n]=(e[n]??0)+1:e[n]=0,e.length=n+1,Rf(t,e[n])});return{...this.body,empty:!1,paras:t}}para(e){return this.paras[Number(e)]}span(e,t){let n=[];for(let r=Number(e);r<=Number(t);r++)n.push(String(r));return n}prev(e){return Number(e)>0?String(Number(e)-1):void 0}next(e){return Number(e)<this.paras.length-1?String(Number(e)+1):void 0}cmp(e,t){return Number(e)-Number(t)}withRuns(e,t){return{...e,runs:t}}split(e,t,n){return[{...e,runs:t},{...e,runs:n,caret:n.length?void 0:Yl(t,Vl(t))??e.caret}]}join(e,t,n){return{...e,runs:n}}defaultRun(e){if(e.caret)return{...e.caret,text:``};let t=[...e.runs].reverse().find(e=>e.t===`text`);return t?{...t,text:``}:{t:`text`,s:{sz:e.base.endSz}}}pendingStyle(){return this.pend?{s:this.pend.s,d:this.pend.d}:void 0}clearPending(){this.pend=null}replace(e,t,n,r={}){let i=this.paras,a=Number(e[0]);if(this.paras=[...i.slice(0,a),...t,...i.slice(a+e.length)],r.history!==!1){let e=Date.now(),t=this.history[this.history.length-1],a=r.label??`edit`;a===`type`&&t?.label===`type`&&e-t.t<1500?(t.after=this.paras,t.selAfter=n,t.t=e):this.history.push({before:i,after:this.paras,selBefore:this.input.lastSel??n,selAfter:n,label:a,t:e}),this.future=[]}this.pendingSel=n,this.changedSinceCommit=!0,this.onDirty?.(),clearTimeout(this.timer),this.timer=setTimeout(()=>this.commit(),400),this.onChange?.(),this.onState?.(this.state(n))}undo(){let e=this.history.pop();e&&(this.future.push(e),this.restore(e.before,e.selBefore))}redo(){let e=this.future.pop();e&&(this.history.push(e),this.restore(e.after,e.selAfter))}restore(e,t){this.paras=e,this.pendingSel=t,this.changedSinceCommit=!0,clearTimeout(this.timer),this.timer=setTimeout(()=>this.commit(),400),this.onChange?.(),this.onState?.(this.state(t))}commit(){if(clearTimeout(this.timer),this.sid<0||!this.changedSinceCommit)return;this.changedSinceCommit=!1;let e=this.slide,t=this.paras.map(e=>({k:e.k,algn:e.algnSet?e.algn:void 0,...e.pp,runs:e.runs.map(e=>e.t===`fld`?{text:``,src:e.src,fld:!0}:{text:e.text??``,src:e.src,set:e.d})}));this.client.call(`pptx.setText`,e,this.sid,t).then(t=>this.onCommitted?.(e,t)).catch(e=>console.error(`[office-engine] slide edit failed`,e))}format(e,t){let n=this.input.sel();if(!n)return;if(Hl(n)){this.pend={s:{...this.pend?.s??{},...e},d:{...this.pend?.d??{},...t},at:n.a},this.input.restore(n),this.onState?.(this.state(n));return}let[r,i]=tu(this,n),a=this.span(r.pa,i.pa),o=a.map((n,o)=>{let s=this.para(n),c=o===0?r.o:0,l=o===a.length-1?i.o:Vl(s.runs);return this.withRuns(s,Ql(s.runs,c,l,e,t))});this.replace(a,o,n,{label:`format`})}toggle(e){let t=this.state(),n=!(t&&t[e]);this.format({[e]:n},{[e]:n})}setSize(e){this.format({sz:e},{sz:e})}setColor(e){this.format({color:e??void 0},{color:e})}setFont(e){this.format({font:$e(e)},{font:e})}setAlign(e){let t=this.input.sel();if(!t)return;let[n,r]=tu(this,t),i=this.span(n.pa,r.pa);this.replace(i,i.map(t=>({...this.para(t),algn:e,algnSet:!0})),t,{label:`align`})}paraOp(e,t){let n=this.input.sel();if(!n)return;let[r,i]=tu(this,n),a=this.span(r.pa,i.pa);this.replace(a,a.map(t=>e(this.para(t))),n,{label:t})}toggleBullet(e){let t=this.state()?.bullet===e?`none`:e;this.paraOp(e=>({...e,pp:{...e.pp,bullet:t}}),`bullet`)}indentLevel(e){this.paraOp(t=>({...t,pp:{...t.pp,lvl:Math.max(0,Math.min(8,Lf(t)+e))}}),`indent`)}setLineSpacing(e){this.paraOp(t=>({...t,pp:{...t.pp,lnPct:e}}),`spacing`)}setHighlight(e){this.format({hl:e??void 0},{hl:e})}toggleBaseline(e){let t=this.state()?.baseline??0,n=e===`sup`?t>0?0:30:t<0?0:-25;this.format({baseline:n||void 0},{baseline:n||null})}clearFormat(){this.format({b:!1,i:!1,u:!1,strike:!1,hl:void 0,baseline:void 0},{b:!1,i:!1,u:!1,strike:!1,hl:null,baseline:null})}state(e=this.input.sel()){if(!e||this.sid<0)return null;let[t]=tu(this,e),n=this.para(t.pa);if(!n)return null;let r={...Yl(n.runs,Hl(e)?t.o:t.o+1)?.s??{},...Hl(e)?this.pend?.s??{}:{}};return{b:!!r.b,i:!!r.i,u:!!r.u,strike:!!r.strike,sz:r.sz,color:r.color,font:r.font,algn:n.algn,hl:r.hl,baseline:r.baseline,bullet:If(n),lvl:Lf(n),lnPct:n.pp?.lnPct??n.base.lnPct}}onSelection(e){e&&this.pend&&(e.a.pa!==this.pend.at.pa||e.a.o!==this.pend.at.o)&&(this.pend=null),this.onState?.(e?this.state(e):null)}},Bf=[`#ffff00`,`#00ff00`,`#00ffff`,`#ff00ff`,`#ff0000`,`#0000ff`,`#ffc000`,`#92d050`,`#c0c0c0`,`#000000`],Vf=[{value:`text`,label:`Text box`,icon:`textbox`},{value:`image`,label:`Image…`,icon:`image`},{value:`line`,label:`Line`,icon:`line`},{value:`rect`,label:`Rectangle`,icon:`rect`,sep:!0},{value:`roundRect`,label:`Rounded rectangle`,icon:`roundRect`},{value:`ellipse`,label:`Ellipse`,icon:`ellipse`},{value:`triangle`,label:`Triangle`,icon:`triangle`},{value:`rtTriangle`,label:`Right triangle`},{value:`diamond`,label:`Diamond`},{value:`parallelogram`,label:`Parallelogram`},{value:`trapezoid`,label:`Trapezoid`},{value:`pentagon`,label:`Pentagon`},{value:`hexagon`,label:`Hexagon`},{value:`octagon`,label:`Octagon`},{value:`donut`,label:`Donut`},{value:`can`,label:`Cylinder`},{value:`heart`,label:`Heart`},{value:`plus`,label:`Plus`},{value:`rightArrow`,label:`Arrow right`,icon:`arrow`,sep:!0},{value:`leftArrow`,label:`Arrow left`},{value:`upArrow`,label:`Arrow up`},{value:`downArrow`,label:`Arrow down`},{value:`leftRightArrow`,label:`Double arrow`},{value:`chevron`,label:`Chevron`},{value:`homePlate`,label:`Pentagon arrow`},{value:`star4`,label:`4-point star`,sep:!0},{value:`star5`,label:`5-point star`,icon:`star`},{value:`star6`,label:`6-point star`},{value:`wedgeRectCallout`,label:`Callout`,sep:!0},{value:`wedgeRoundRectCallout`,label:`Rounded callout`}],Hf=[.75,1,1.5,2.25,3,4.5,6].map(e=>({value:e,label:`${e} pt`})),Uf=[{value:`solid`,label:`Solid`,hint:`────`},{value:`sysDot`,label:`Dotted`,hint:`········`},{value:`dash`,label:`Dashed`,hint:`- - - -`},{value:`lgDash`,label:`Long dash`,hint:`— — —`},{value:`dashDot`,label:`Dash dot`,hint:`-·-·-·`}],Wf=[1,1.15,1.5,2].map(e=>({value:e,label:e===1?`Single`:e===2?`Double`:String(e)})),Gf=[{value:`t`,label:`Top`,icon:`vTop`},{value:`ctr`,label:`Middle`,icon:`vMiddle`},{value:`b`,label:`Bottom`,icon:`vBottom`}];function Kf(e){let{editor:t}=e,[n,r]=(0,u.useState)(null);(0,u.useEffect)(()=>(t.onState=r,()=>{t.onState=void 0}),[t]);let i=!!n&&t.active,a=Sl(n?.font),o=n?.sz?Math.round(n.sz*2)/2:void 0,s=i?e.textAnchor:e.shape?.anchor;return(0,X.jsxs)(jl,{children:[(0,X.jsx)(Z,{icon:`undo`,title:`Undo (${Q}Z)`,disabled:!i&&!e.canUndo,onClick:()=>i?t.undo():e.onUndo(!1)}),(0,X.jsx)(Z,{icon:`redo`,title:`Redo (${Q}Y)`,onClick:()=>i?t.redo():e.onUndo(!0)}),(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Insert`,label:`Insert`,icon:`plus`,items:Vf,onPick:t=>e.onInsert(t)}),(0,X.jsx)(wl,{title:`Slide`,label:`Slide`,icon:`slideAdd`,items:[{value:`add`,label:`New slide`,icon:`slideAdd`,hint:`${Q}M`},{value:`duplicate`,label:`Duplicate slide`,icon:`copy`},{value:`delete`,label:`Delete slide`,icon:`trash`},{value:`up`,label:`Move slide up`,icon:`up`,sep:!0},{value:`down`,label:`Move slide down`,icon:`down`},{value:`hide`,label:`Hide / show slide`,icon:`hide`,sep:!0}],onPick:t=>e.onSlide(t)}),(0,X.jsx)(nl,{}),i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(il,{title:`Font`,width:112,menuWidth:200,value:a,placeholder:`Font`,options:xl(a),onChange:e=>t.setFont(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(al,{value:o,onChange:e=>t.setSize(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bold`,title:`Bold (${Q}B)`,active:n?.b,onClick:()=>t.toggle(`b`)}),(0,X.jsx)(Z,{icon:`italic`,title:`Italic (${Q}I)`,active:n?.i,onClick:()=>t.toggle(`i`)}),(0,X.jsx)(Z,{icon:`underline`,title:`Underline (${Q}U)`,active:n?.u,onClick:()=>t.toggle(`u`)}),(0,X.jsx)(Z,{icon:`strike`,title:`Strikethrough`,active:n?.strike,onClick:()=>t.toggle(`strike`)}),(0,X.jsx)(vl,{icon:`color`,title:`Text color`,value:n?.color,onPick:e=>t.setColor(e),noneLabel:`Automatic`}),(0,X.jsx)(vl,{icon:`highlight`,title:`Highlight color`,value:n?.hl,palette:Bf,onPick:e=>t.setHighlight(e)}),(0,X.jsx)(Z,{icon:`sup`,title:`Superscript`,active:(n?.baseline??0)>0,onClick:()=>t.toggleBaseline(`sup`)}),(0,X.jsx)(Z,{icon:`sub`,title:`Subscript`,active:(n?.baseline??0)<0,onClick:()=>t.toggleBaseline(`sub`)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`alignLeft`,title:`Align left`,active:n?.algn===`left`,onClick:()=>t.setAlign(`left`)}),(0,X.jsx)(Z,{icon:`alignCenter`,title:`Center`,active:n?.algn===`center`,onClick:()=>t.setAlign(`center`)}),(0,X.jsx)(Z,{icon:`alignRight`,title:`Align right`,active:n?.algn===`right`,onClick:()=>t.setAlign(`right`)}),(0,X.jsx)(Z,{icon:`justify`,title:`Justify`,active:n?.algn===`justify`,onClick:()=>t.setAlign(`justify`)}),(0,X.jsx)(rl,{title:`Vertical align`,icon:Gf.find(e=>e.value===s)?.icon??`vTop`,label:null,menuWidth:140,value:s??`t`,options:Gf.map(e=>({...e})),onChange:e.onAnchor}),(0,X.jsx)(rl,{title:`Line spacing`,icon:`lineSpacing`,label:null,menuWidth:140,value:n?.lnPct?Math.round(n.lnPct*100)/100:``,options:Wf,onChange:e=>t.setLineSpacing(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bullets`,title:`Bulleted list`,active:n?.bullet===`bullet`,onClick:()=>t.toggleBullet(`bullet`)}),(0,X.jsx)(Z,{icon:`numbers`,title:`Numbered list`,active:n?.bullet===`number`,onClick:()=>t.toggleBullet(`number`)}),(0,X.jsx)(Z,{icon:`outdent`,title:`Decrease indent (Shift+Tab)`,disabled:!n?.lvl,onClick:()=>t.indentLevel(-1)}),(0,X.jsx)(Z,{icon:`indent`,title:`Increase indent`,onClick:()=>t.indentLevel(1)}),(0,X.jsx)(Z,{icon:`clear`,title:`Clear formatting`,onClick:()=>t.clearFormat()})]}):e.shape?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(vl,{icon:`fill`,title:`Fill color`,onPick:e.onFill,noneLabel:`Transparent`}),(0,X.jsx)(vl,{icon:`borders`,title:`Border color`,onPick:t=>e.onLine({color:t}),noneLabel:`Transparent`}),(0,X.jsx)(rl,{title:`Border weight`,icon:`lineWeight`,label:null,menuWidth:120,options:Hf,onChange:t=>e.onLine({w:t})}),(0,X.jsx)(rl,{title:`Border dash`,icon:`lineStyle`,label:null,menuWidth:170,options:Uf,onChange:t=>e.onLine({dash:t})}),(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Arrange`,label:`Arrange`,icon:`front`,items:[{value:`front`,label:`Bring to front`,icon:`front`,hint:`${Q}⇧↑`},{value:`forward`,label:`Bring forward`,hint:`${Q}↑`},{value:`backward`,label:`Send backward`,hint:`${Q}↓`},{value:`back`,label:`Send to back`,icon:`back`,hint:`${Q}⇧↓`}],onPick:t=>e.onArrange(t)}),(0,X.jsx)(rl,{title:`Rotate`,icon:`rotate`,label:null,menuWidth:220,options:[{value:`cw`,label:`Rotate 90° clockwise`,icon:`rotate`},{value:`ccw`,label:`Rotate 90° counter-clockwise`,icon:`rotateCcw`},{value:`flipH`,label:`Flip horizontally`,icon:`flipH`,sep:!0},{value:`flipV`,label:`Flip vertically`,icon:`flipV`}],onChange:t=>e.onRotate(t)}),(0,X.jsx)(rl,{title:`Align on slide`,icon:`alignObj`,label:null,menuWidth:150,options:[{value:`left`,label:`Left`,icon:`alignLeft`},{value:`center`,label:`Center`,icon:`alignCenter`},{value:`right`,label:`Right`,icon:`alignRight`},{value:`top`,label:`Top`,icon:`vTop`,sep:!0},{value:`middle`,label:`Middle`,icon:`vMiddle`},{value:`bottom`,label:`Bottom`,icon:`vBottom`}],onChange:t=>e.onAlign(t)}),e.shape.canText&&(0,X.jsx)(rl,{title:`Vertical text align`,icon:Gf.find(e=>e.value===s)?.icon??`vTop`,label:null,menuWidth:140,value:s??`t`,options:Gf.map(e=>({...e})),onChange:e.onAnchor}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`copy`,title:`Duplicate (${Q}D)`,onClick:e.onDuplicate}),(0,X.jsx)(Z,{icon:`trash`,title:`Delete (Del)`,onClick:e.onDelete})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(vl,{icon:`fill`,title:`Slide background`,onPick:e.onBackground,noneLabel:`Layout default`}),(0,X.jsx)(`span`,{className:`de-tb-hint`,children:`Click a shape or text to edit it`})]}),(0,X.jsx)(nl,{}),(0,X.jsx)(rl,{title:`Present`,icon:`play`,label:`Present`,menuWidth:200,options:[{value:`cur`,label:`From current slide`,hint:`F5`},{value:`start`,label:`From beginning`,hint:`⇧F5`}],onChange:t=>e.onPresent(t===`start`)})]})}function qf({client:e,meta:t,start:n,onClose:r}){let i=(0,u.useRef)(null),a=t.slides.filter(e=>!e.hidden).map(e=>e.index),o=a.length?a:t.slides.map(e=>e.index),[s,c]=(0,u.useState)(Math.max(0,o.findIndex(e=>e>=n))),[l,d]=(0,u.useState)({w:window.innerWidth,h:window.innerHeight});(0,u.useEffect)(()=>{let e=i.current;e?.focus(),e?.requestFullscreen?.().catch(()=>{});let t=()=>d({w:window.innerWidth,h:window.innerHeight}),n=()=>!document.fullscreenElement&&r();return window.addEventListener(`resize`,t),document.addEventListener(`fullscreenchange`,n),()=>{window.removeEventListener(`resize`,t),document.removeEventListener(`fullscreenchange`,n),document.fullscreenElement&&document.exitFullscreen().catch(()=>{})}},[r]);let f=e=>c(t=>Math.max(0,Math.min(o.length-1,t+e))),p=Math.min(l.w/t.w,l.h/t.h);return(0,X.jsxs)(`div`,{ref:i,className:`de-present`,tabIndex:-1,onClick:()=>f(1),onContextMenu:e=>{e.preventDefault(),f(-1)},onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`PageDown`,` `,`Enter`,`n`].includes(e.key))f(1);else if([`ArrowLeft`,`ArrowUp`,`PageUp`,`Backspace`,`p`].includes(e.key))f(-1);else if(e.key===`Home`)c(0);else if(e.key===`End`)c(o.length-1);else if(e.key===`Escape`)r();else return;e.preventDefault()},children:[(0,X.jsx)(`div`,{style:{width:t.w*p,height:t.h*p},children:(0,X.jsx)(yp,{client:e,index:o[s],meta:t,scale:p,live:!0},o[s])}),(0,X.jsxs)(`div`,{className:`de-present-n`,children:[s+1,` / `,o.length]})]})}var $=e=>+e.toFixed(2),Jf=e=>`M`+e.map(([e,t])=>`${$(e)} ${$(t)}`).join(` L`)+` Z`,Yf=(e,t,n)=>(e?.[t]??n)/1e5;function Xf(e,t){let n=e/2,r=t/2;return`M0 ${$(r)} A${$(n)} ${$(r)} 0 1 0 ${$(e)} ${$(r)} A${$(n)} ${$(r)} 0 1 0 0 ${$(r)} Z`}function Zf(e,t,n){return n=Math.min(n,e/2,t/2),`M${$(n)} 0 H${$(e-n)} A${$(n)} ${$(n)} 0 0 1 ${$(e)} ${$(n)} V${$(t-n)} A${$(n)} ${$(n)} 0 0 1 ${$(e-n)} ${$(t)} H${$(n)} A${$(n)} ${$(n)} 0 0 1 0 ${$(t-n)} V${$(n)} A${$(n)} ${$(n)} 0 0 1 ${$(n)} 0 Z`}function Qf(e,t,n,r=-Math.PI/2){let i=[];for(let a=0;a<n;a++){let o=r+a*2*Math.PI/n;i.push([e/2+e/2*Math.cos(o),t/2+t/2*Math.sin(o)])}return Jf(i)}function $f(e,t,n,r){let i=[];for(let a=0;a<n*2;a++){let o=-Math.PI/2+a*Math.PI/n,s=a%2?r:1;i.push([e/2+e/2*s*Math.cos(o),t/2+t/2*s*Math.sin(o)])}return Jf(i)}var ep=new Set([`line`,`straightConnector1`,`bentConnector2`,`bentConnector3`,`bentConnector4`,`curvedConnector3`,`curvedConnector2`,`curvedConnector4`]);function tp(e,t,n,r){let i=Math.min(t,n);switch(e){case`ellipse`:case`flowChartConnector`:case`cloud`:return Xf(t,n);case`roundRect`:case`flowChartAlternateProcess`:return Zf(t,n,i*Yf(r,`adj`,16667));case`flowChartTerminator`:return Zf(t,n,n/2);case`triangle`:return Jf([[t*Yf(r,`adj`,5e4),0],[t,n],[0,n]]);case`rtTriangle`:return Jf([[0,0],[t,n],[0,n]]);case`diamond`:case`flowChartDecision`:return Jf([[t/2,0],[t,n/2],[t/2,n],[0,n/2]]);case`parallelogram`:case`flowChartInputOutput`:{let e=i*Yf(r,`adj`,25e3);return Jf([[e,0],[t,0],[t-e,n],[0,n]])}case`trapezoid`:{let e=i*Yf(r,`adj`,25e3);return Jf([[e,0],[t-e,0],[t,n],[0,n]])}case`pentagon`:return Qf(t,n,5);case`hexagon`:{let e=i*Yf(r,`adj`,25e3);return Jf([[e,0],[t-e,0],[t,n/2],[t-e,n],[e,n],[0,n/2]])}case`heptagon`:return Qf(t,n,7);case`octagon`:{let e=i*Yf(r,`adj`,29289);return Jf([[e,0],[t-e,0],[t,e],[t,n-e],[t-e,n],[e,n],[0,n-e],[0,e]])}case`decagon`:return Qf(t,n,10);case`dodecagon`:return Qf(t,n,12);case`star4`:return $f(t,n,4,.38);case`star5`:return $f(t,n,5,.38);case`star6`:return $f(t,n,6,.5);case`star8`:return $f(t,n,8,.6);case`star10`:case`star12`:case`star16`:case`star24`:return $f(t,n,Number(e.slice(4)),.7);case`homePlate`:{let e=i*Yf(r,`adj`,5e4);return Jf([[0,0],[t-e,0],[t,n/2],[t-e,n],[0,n]])}case`chevron`:{let e=i*Yf(r,`adj`,5e4);return Jf([[0,0],[t-e,0],[t,n/2],[t-e,n],[0,n],[e,n/2]])}case`rightArrow`:case`leftArrow`:{let a=n*Yf(r,`adj1`,5e4),o=i*Yf(r,`adj2`,5e4),s=(n-a)/2,c=[[0,s],[t-o,s],[t-o,0],[t,n/2],[t-o,n],[t-o,s+a],[0,s+a]];return Jf(e===`leftArrow`?c.map(([e,n])=>[t-e,n]):c)}case`upArrow`:case`downArrow`:{let a=t*Yf(r,`adj1`,5e4),o=i*Yf(r,`adj2`,5e4),s=(t-a)/2,c=[[s,n],[s,o],[0,o],[t/2,0],[t,o],[s+a,o],[s+a,n]];return Jf(e===`downArrow`?c.map(([e,t])=>[e,n-t]):c)}case`leftRightArrow`:{let e=n*Yf(r,`adj1`,5e4),a=i*Yf(r,`adj2`,5e4),o=(n-e)/2;return Jf([[0,n/2],[a,0],[a,o],[t-a,o],[t-a,0],[t,n/2],[t-a,n],[t-a,o+e],[a,o+e],[a,n]])}case`plus`:case`mathPlus`:{let e=i*Yf(r,`adj`,25e3);return Jf([[e,0],[t-e,0],[t-e,e],[t,e],[t,n-e],[t-e,n-e],[t-e,n],[e,n],[e,n-e],[0,n-e],[0,e],[e,e]])}case`snip1Rect`:{let e=i*Yf(r,`adj`,16667);return Jf([[0,0],[t-e,0],[t,e],[t,n],[0,n]])}case`snip2SameRect`:{let e=i*Yf(r,`adj1`,16667);return Jf([[e,0],[t-e,0],[t,e],[t,n],[0,n],[0,e]])}case`round1Rect`:case`round2SameRect`:{let e=i*Yf(r,`adj1`,16667)||i*Yf(r,`adj`,16667);return`M${$(e)} 0 H${$(t-e)} A${$(e)} ${$(e)} 0 0 1 ${$(t)} ${$(e)} V${$(n)} H0 V${$(e)} A${$(e)} ${$(e)} 0 0 1 ${$(e)} 0 Z`}case`can`:case`flowChartMagneticDisk`:{let e=i*Yf(r,`adj`,25e3)/2;return`M0 ${$(e)} A${$(t/2)} ${$(e)} 0 0 1 ${$(t)} ${$(e)} V${$(n-e)} A${$(t/2)} ${$(e)} 0 0 1 0 ${$(n-e)} Z M0 ${$(e)} A${$(t/2)} ${$(e)} 0 0 0 ${$(t)} ${$(e)}`}case`donut`:{let e=i*Yf(r,`adj`,25e3);return Xf(t,n)+` M${$(e)} ${$(n/2)} A${$(t/2-e)} ${$(n/2-e)} 0 1 1 ${$(t-e)} ${$(n/2)} A${$(t/2-e)} ${$(n/2-e)} 0 1 1 ${$(e)} ${$(n/2)} Z`}case`heart`:return`M${$(t/2)} ${$(n*.25)} C${$(t/2)} 0 0 0 0 ${$(n*.3)} C0 ${$(n*.6)} ${$(t/2)} ${$(n*.8)} ${$(t/2)} ${$(n)} C${$(t/2)} ${$(n*.8)} ${$(t)} ${$(n*.6)} ${$(t)} ${$(n*.3)} C${$(t)} 0 ${$(t/2)} 0 ${$(t/2)} ${$(n*.25)} Z`;case`wedgeRectCallout`:case`wedgeRoundRectCallout`:{let e=t/2+t*Yf(r,`adj1`,-20833),i=n/2+n*Yf(r,`adj2`,62500);return Jf([[0,0],[t,0],[t,n],[t*.58,n],[e,i],[t*.42,n],[0,n]])}case`line`:case`straightConnector1`:return`M0 0 L${$(t)} ${$(n)}`;case`bentConnector2`:return`M0 0 H${$(t)} V${$(n)}`;case`bentConnector3`:return`M0 0 H${$(t*Yf(r,`adj1`,5e4))} V${$(n)} H${$(t)}`;case`bentConnector4`:return`M0 0 H${$(t/2)} V${$(n)} H${$(t)}`;case`curvedConnector2`:case`curvedConnector3`:case`curvedConnector4`:return`M0 0 C${$(t/2)} 0 ${$(t/2)} ${$(n)} ${$(t)} ${$(n)}`;default:return`M0 0 H${$(t)} V${$(n)} H0 Z`}}function np(e){let t=[];return e.rot&&t.push(`rotate(${e.rot}deg)`),{left:e.x,top:e.y,width:e.w,height:e.h,transform:t.length?t.join(` `):void 0}}function rp(e,t,n){let r=qc(e,t?.t===`img`?t.target:void 0,n);if(t)switch(t.t){case`solid`:return{background:t.c};case`grad`:return{background:t.css};case`img`:return r&&r!==`unsupported`?{backgroundImage:`url("${r}")`,backgroundSize:t.tile?`auto`:`100% 100%`,backgroundRepeat:t.tile?`repeat`:`no-repeat`}:void 0;default:return}}function ip(e){let t={fontSize:`${e.baseline?e.sz*.65:e.sz}pt`};e.b&&(t.fontWeight=700),e.i&&(t.fontStyle=`italic`);let n=[e.u?`underline`:``,e.strike?`line-through`:``].filter(Boolean).join(` `);return n&&(t.textDecoration=n),e.color&&(t.color=e.color),e.font&&(t.fontFamily=e.font),e.baseline&&(t.verticalAlign=e.baseline>0?`super`:`sub`),e.caps&&(t.textTransform=`uppercase`),e.hl&&(t.background=e.hl),t}function ap({text:e,flow:t,edit:n}){let[r,i,a,o]=e.ins,s={...t?{position:`relative`,inset:`auto`,minHeight:`100%`}:{},padding:`${i}px ${a}px ${o}px ${r}px`,justifyContent:e.anchor===`ctr`?`center`:e.anchor===`b`?`flex-end`:`flex-start`};return e.vert&&(s.writingMode=e.vert===`vert270`?`sideways-lr`:`vertical-rl`),e.empty&&!n?(0,X.jsx)(`div`,{className:`de-txt`,style:s}):(0,X.jsx)(`div`,{ref:n?.root,className:(e.wrap?`de-txt`:`de-txt de-nowrap`)+(n?` de-txt-edit`:``),style:s,contentEditable:n?!0:void 0,suppressContentEditableWarning:!0,spellCheck:!n&&void 0,children:e.paras.map((e,t)=>{let r={textAlign:e.algn,paddingLeft:e.marL||void 0,textIndent:e.indent||void 0,paddingTop:e.spcBef||void 0,paddingBottom:e.spcAft||void 0,lineHeight:e.lnPx?`${e.lnPx}px`:e.lnPct?+(e.lnPct*1.2).toFixed(3):1.2};(!e.runs.length||e.runs.every(e=>!e.text&&!e.br))&&(r.fontSize=`${e.endSz}pt`);let i=e.indent<0?-e.indent:0,a=0,o=e.runs.map((e,t)=>{let r=a;return a+=e.fld||e.br?1:e.text.length,n?e.fld?(0,X.jsx)(`span`,{"data-o":r,"data-obj":``,contentEditable:!1,style:ip(e),children:e.text},t):(0,X.jsx)(`span`,{"data-o":r,style:ip(e),children:e.br?`
|
|
81
|
-
`:e.text},t):e.br?(0,X.jsx)(`br`,{},t):e.href?(0,X.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,style:{color:`inherit`},children:(0,X.jsx)(`span`,{style:ip(e),children:e.text})},t):(0,X.jsx)(`span`,{style:ip(e),children:e.text},t)}),s=a===0;return(0,X.jsxs)(`div`,{style:r,"data-pa":n?String(t):void 0,children:[e.bullet&&!s&&(0,X.jsx)(`span`,{className:`de-bul`,contentEditable:!n&&void 0,style:{minWidth:i||void 0,paddingRight:i?void 0:`0.4em`,fontSize:`${e.bullet.sz}pt`,color:e.bullet.color,fontFamily:e.bullet.font},children:e.bullet.text}),o,s&&(n?(0,X.jsx)(`span`,{"data-o":0,"data-empty":``,children:``}):``)]},t)})})}function op({id:e,s:t}){return(0,X.jsx)(`marker`,{id:e,viewBox:`0 0 10 10`,refX:`5`,refY:`5`,markerWidth:`4`,markerHeight:`4`,orient:`auto-start-reverse`,children:(0,X.jsx)(`path`,{d:`M0 0 L10 5 L0 10 Z`,fill:t.c})})}function sp({el:e,client:t,live:n,editing:r}){let i=(0,u.useId)().replace(/:/g,``),{box:a}=e,o=ep.has(e.geom),s=rp(t,e.fill,n),c=e.path??tp(e.geom,a.w,a.h,e.adj),l=a.flipH||a.flipV,d=l?`translate(${a.flipH?a.w:0} ${a.flipV?a.h:0}) scale(${a.flipH?-1:1} ${a.flipV?-1:1})`:void 0,f=!o&&!e.path&&(e.geom===`rect`||e.geom===`flowChartProcess`),p=!o&&e.fill?.t===`solid`?e.fill.c:void 0,m=!o&&s&&e.fill?.t!==`solid`?s:void 0,h=e.stroke,g=Math.max(a.w,1),_=Math.max(a.h,1);return(0,X.jsxs)(`div`,{className:`de-el`,style:np(a),"data-sid":e.sid!==void 0&&e.text?e.sid:void 0,"data-top":e.top,children:[f&&!h&&(p||m)?(0,X.jsx)(`div`,{style:{position:`absolute`,inset:0,...m??{background:p}}}):(0,X.jsxs)(X.Fragment,{children:[m&&(0,X.jsx)(`div`,{style:{position:`absolute`,inset:0,...m,clipPath:f?void 0:`path("${c}")`,transform:l?`scale(${a.flipH?-1:1}, ${a.flipV?-1:1})`:void 0}}),(p||h)&&(0,X.jsxs)(`svg`,{width:g,height:_,viewBox:`0 0 ${g} ${_}`,style:{position:`absolute`,left:0,top:0,overflow:`visible`},children:[h&&(h.head||h.tail)&&(0,X.jsxs)(`defs`,{children:[h.head&&(0,X.jsx)(op,{id:`h${i}`,s:h}),h.tail&&(0,X.jsx)(op,{id:`t${i}`,s:h})]}),(0,X.jsx)(`path`,{d:c,transform:d,fill:p??`none`,fillRule:`evenodd`,stroke:h?.c??`none`,strokeWidth:h?.w,strokeDasharray:h?.dash,strokeLinejoin:`round`,markerStart:h?.head?`url(#h${i})`:void 0,markerEnd:h?.tail?`url(#t${i})`:void 0})]})]}),r&&r.sid===e.sid?(0,X.jsx)(ap,{text:r.text,edit:r.edit}):e.text&&(0,X.jsx)(ap,{text:e.text})]})}function cp({el:e,client:t,live:n}){let r=qc(t,e.target,n),{box:i}=e,a={...np(i),overflow:`hidden`},o=e.top;e.geom===`ellipse`?a.borderRadius=`50%`:e.geom===`roundRect`&&(a.borderRadius=Math.min(i.w,i.h)*.1667),e.stroke&&(a.outline=`${e.stroke.w}px solid ${e.stroke.c}`);let s={position:`absolute`,left:0,top:0,width:`100%`,height:`100%`};if(e.crop){let[t,n,r,a]=e.crop,o=i.w/Math.max(.01,1-t-r),c=i.h/Math.max(.01,1-n-a);s={position:`absolute`,left:-t*o,top:-n*c,width:o,height:c}}let c=i.flipH||i.flipV?`scale(${i.flipH?-1:1}, ${i.flipV?-1:1})`:void 0;return c&&(s.transform=c),(0,X.jsxs)(`div`,{className:`de-el`,style:a,"data-top":o,children:[r&&r!==`unsupported`?(0,X.jsx)(`img`,{src:r,alt:``,style:s,draggable:!1}):r===`unsupported`?(0,X.jsxs)(`div`,{className:`de-ph`,style:{width:`100%`,height:`100%`},children:[e.target?.split(`.`).pop()?.toUpperCase(),` image`]}):null,e.video&&(0,X.jsx)(`div`,{className:`de-ph`,style:{position:`absolute`,right:8,bottom:8,padding:`2px 6px`,border:0,background:`rgba(0,0,0,.6)`,color:`#fff`},children:`▶ media`})]})}var lp=e=>e?`${Math.max(1,e.w)}px solid ${e.c}`:void 0;function up({cell:e,client:t,live:n,h:r}){let i=rp(t,e.fill,n);return(0,X.jsx)(`td`,{colSpan:e.colSpan>1?e.colSpan:void 0,rowSpan:e.rowSpan>1?e.rowSpan:void 0,style:{...i??{},borderLeft:lp(e.bl),borderRight:lp(e.br),borderTop:lp(e.bt),borderBottom:lp(e.bb),height:r},children:e.text&&(0,X.jsx)(ap,{text:e.text,flow:!0})})}function dp({el:e,client:t,live:n}){return(0,X.jsx)(`div`,{className:`de-el`,style:{...np(e.box),height:`auto`},"data-top":e.top,children:(0,X.jsxs)(`table`,{className:`de-stbl`,children:[(0,X.jsx)(`colgroup`,{children:e.cols.map((e,t)=>(0,X.jsx)(`col`,{style:{width:e}},t))}),(0,X.jsx)(`tbody`,{children:e.rows.map((e,r)=>(0,X.jsx)(`tr`,{children:e.cells.map((r,i)=>r.hidden?null:(0,X.jsx)(up,{cell:r,client:t,live:n,h:e.h},i))},r))})]})})}function fp({el:e,client:t,live:n,editing:r}){switch(e.t){case`shape`:return(0,X.jsx)(sp,{el:e,client:t,live:n,editing:r});case`pic`:return(0,X.jsx)(cp,{el:e,client:t,live:n});case`table`:return(0,X.jsx)(dp,{el:e,client:t,live:n});case`placeholder`:return(0,X.jsx)(`div`,{className:`de-el de-ph`,style:{...np(e.box),display:`flex`},"data-top":e.top,children:e.label})}}var pp=(0,u.memo)(function({model:e,client:t,scale:n,live:r=!0,editing:i,overlay:a}){let o=rp(t,e.bg,r);return(0,X.jsx)(`div`,{className:e.hidden?`de-slide de-hidden-slide`:`de-slide`,style:{width:e.w*n,height:e.h*n},children:(0,X.jsxs)(`div`,{className:`de-slide-inner`,style:{width:e.w,height:e.h,transform:`scale(${n})`,background:`#fff`,...o??{}},children:[e.els.map((e,n)=>(0,X.jsx)(fp,{el:e,client:t,live:r,editing:i},n)),a]})})}),mp=new WeakMap;function hp(e){let t=mp.get(e);return t||mp.set(e,t={models:new Map,pending:new Map,listeners:new Map}),t}function gp(e,t,n){let r=hp(e);r.models.set(t,n);for(let e of r.listeners.get(t)??[])e(n)}function _p(e){let t=hp(e);t.models.clear(),t.pending.clear()}function vp(e,t){let n=hp(e),[r,i]=(0,u.useState)(()=>n.models.get(t));return(0,u.useEffect)(()=>{let e=n.listeners.get(t);e||n.listeners.set(t,e=new Set);let r=e=>i(e);return e.add(r),()=>{e.delete(r)}},[n,t]),(0,u.useEffect)(()=>{let r=n.models.get(t);if(r)return i(r);let a=!0,o=n.pending.get(t);return o||(o=e.call(`pptx.slide`,t),n.pending.set(t,o),o.then(e=>{n.models.set(t,e),n.pending.delete(t),n.models.size>120&&n.models.delete(n.models.keys().next().value)},()=>n.pending.delete(t))),o.then(e=>a&&i(e),e=>a&&i({error:e.message})),()=>{a=!1}},[e,n,t]),r}function yp(e){let{client:t,index:n,meta:r,scale:i,live:a,editing:o,overlay:s}=e,c=vp(t,n);return c?`error`in c?(0,X.jsx)(`div`,{className:`de-slide de-ph`,style:{width:r.w*i,height:r.h*i,display:`flex`},children:c.error}):(0,X.jsx)(pp,{model:c,client:t,scale:i,live:a,editing:o,overlay:s}):(0,X.jsx)(`div`,{className:`de-slide`,style:{width:r.w*i,height:r.h*i,background:`#fff`}})}var bp=[`nw`,`n`,`ne`,`e`,`se`,`s`,`sw`,`w`];function xp(e,t){let n=e?.els.filter(e=>e.top===t)??[];if(!n.length)return;let r=Math.min(...n.map(e=>e.box.x)),i=Math.min(...n.map(e=>e.box.y)),a=Math.max(...n.map(e=>e.box.x+e.box.w)),o=Math.max(...n.map(e=>e.box.y+e.box.h));return{x:r,y:i,w:a-r,h:o-i,rot:n.length===1?n[0].box.rot:void 0}}function Sp(e,t,n,r,i){if(t===`move`)return{...e,x:e.x+n,y:e.y+r};let{x:a,y:o,w:s,h:c}=e;if(t.includes(`e`)&&(s+=n),t.includes(`s`)&&(c+=r),t.includes(`w`)&&(a+=n,s-=n),t.includes(`n`)&&(o+=r,c-=r),i&&t.length===2&&e.w&&e.h){let n=Math.max(s/e.w,c/e.h),r=e.w*n,i=e.h*n;t.includes(`w`)&&(a=e.x+e.w-r),t.includes(`n`)&&(o=e.y+e.h-i),s=r,c=i}return{...e,x:a,y:o,w:Math.max(4,s),h:Math.max(4,c)}}function Cp({box:e,scale:t,onHandle:n}){let r=9/t,i={nw:[0,0],n:[.5,0],ne:[1,0],e:[1,.5],se:[1,1],s:[.5,1],sw:[0,1],w:[0,.5],move:[0,0]};return(0,X.jsx)(`div`,{className:`de-shape-sel`,style:{left:e.x,top:e.y,width:e.w,height:e.h,borderWidth:1.5/t,transform:e.rot?`rotate(${e.rot}deg)`:void 0},children:bp.map(a=>(0,X.jsx)(`div`,{className:`de-handle de-h-${a}`,style:{width:r,height:r,left:i[a][0]*e.w-r/2,top:i[a][1]*e.h-r/2,borderWidth:1/t},onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),n(a,e)}},a))})}var wp=24,Tp=24;function Ep({client:e,onStatus:t,initialZoom:n=`fit`,thumbnails:r=!0}){let i=kl(),a=e.info.pptx;Al({printable:async()=>{let t=e.info.pptx,n=await Promise.all(t.slides.map(t=>e.call(`pptx.slide`,t.index))),r=n.filter(e=>!e.hidden),i=r.length?r:n;return{size:`${t.w}px ${t.h}px`,margin:`0`,node:i.map(n=>(0,X.jsx)(`div`,{className:`de-print-page`,style:{width:t.w,height:t.h},children:(0,X.jsx)(pp,{model:{...n,hidden:!1},client:e,scale:1})},n.index))}},text:async()=>{let t=e.info.pptx;return ed(await Promise.all(t.slides.map(t=>e.call(`pptx.slide`,t.index))))},stats:()=>{let t=e.info.pptx;return[[`Slides`,t.count.toLocaleString()],[`Slide size`,`${+(t.w/96).toFixed(2)} × ${+(t.h/96).toFixed(2)} in`]]}});let[o,s]=Gc(),[c,l]=Gc(),d=Kc(c),f=(0,u.useRef)(null),p=Kc(f),[m,h]=(0,u.useState)(n),g=r&&s.w>=720&&a.count>1,[,_]=Wc(),v=(0,u.useMemo)(()=>new zf(e),[e]),y=(0,u.useRef)(null),b=(0,u.useRef)(null),[x,S]=(0,u.useState)(null),[C,w]=(0,u.useState)(null),[T,E]=(0,u.useState)(0),[D,ee]=(0,u.useState)(null),[O,te]=(0,u.useState)(null),[ne,re]=(0,u.useState)(0),ie=l.w?(l.w-48)/a.w:1,ae=l.h?(l.h-48)/a.h:1,oe=Math.max(.1,Math.min(ie,Math.max(ae,ie*.6),2)),k=m===`fit`?oe:m,se=a.h*k,ce=a.w*k,A=se+Tp,le=48+a.count*A-Tp,ue=Math.max(l.w,ce+48),de=Math.max(wp,(ue-ce)/2),j=Math.max(0,Math.floor((d.y-wp)/A)-1),M=Math.min(a.count-1,Math.floor((d.y+l.h)/A)+1),N=Math.min(a.count-1,Math.max(0,Math.floor((d.y+l.h/3-wp)/A))),fe=142/a.w,pe=a.h*fe,me=pe+14,he=Math.max(0,Math.floor(p.y/me)-1),ge=Math.min(a.count-1,Math.floor((p.y+l.h)/me)+1);(0,u.useEffect)(()=>{let e=f.current;if(!e)return;let t=10+N*me;(t<e.scrollTop||t+pe>e.scrollTop+e.clientHeight)&&(e.scrollTop=t-e.clientHeight/2+pe/2)},[N,me,pe]),(0,u.useEffect)(()=>{v.onChange=_,v.onDirty=()=>i.setDirty(!0),v.onCommitted=(t,n)=>gp(e,t,n),v.shortcut=e=>(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`?(i.save(),!0):e.key===`Escape`&&(P(),!0)}),(0,u.useEffect)(()=>(i.editable||P(),()=>v.end()),[i.editable]);let P=()=>{v.active&&(v.end(),b.current&&hu(b.current)?.removeAllRanges(),c.current?.focus({preventScroll:!0}),_())},_e=(0,u.useRef)(P);_e.current=P,(0,u.useEffect)(()=>Mc(e,`pptx`,{endEditing:()=>_e.current()}),[e]),(0,u.useEffect)(()=>e.on(`collab:pptx`,t=>{t.meta?(_p(e),S(null),E(e=>e+1)):t.slide!==void 0&&t.model&&gp(e,t.slide,t.model)}),[e]),(0,u.useEffect)(()=>Vc(e,{slide:x?.slide??N,top:x?.top}),[e,x?.slide,x?.top,N]);let ve=v.active&&v.text()?{sid:v.sid,text:v.text(),edit:{root:e=>{b.current=e,e&&v.input.attach(e)}}}:void 0;Uc(()=>{let e=b.current;if(!v.active||!e)return;if(y.current){let{x:t,y:n}=y.current;y.current=null,e.focus({preventScroll:!0});let r=e.ownerDocument,i=r.caretPositionFromPoint?.(t,n),a=i?null:r.caretRangeFromPoint?.(t,n),o=i?.offsetNode??a?.startContainer,s=i?.offset??a?.startOffset??0,c=hu(e);o&&e.contains(o)?c?.collapse(o,s):(c?.selectAllChildren(e),c?.collapseToEnd()),v.input.lastSel=v.input.readSel();return}let t=v.pendingSel;t&&(v.pendingSel=null,v.input.restore(t))});let ye=t=>hp(e).models.get(t),be=(e,t,n,r)=>{let i=ye(e)?.els.find(e=>e.t===`shape`&&e.sid===t);i&&i.t===`shape`&&i.text&&(v.begin(e,t,i.text),y.current={x:n,y:r},_())},xe=(e,t)=>{if(!i.editable||t.button!==0)return;let n=t.target;if(v.active&&b.current?.contains(n))return;let r=n.closest(`[data-top]`),a=r?Number(r.dataset.top):NaN;if(P(),!r||Number.isNaN(a)){S(null);return}t.preventDefault(),c.current?.focus({preventScroll:!0});let o=xp(ye(e),a);if(S({slide:e,top:a}),!o)return;let s=n.closest(`[data-sid]`);w({slide:e,top:a,mode:`move`,sx:t.clientX,sy:t.clientY,box:o,cur:o,moved:!1,sid:s?Number(s.dataset.sid):void 0,px:t.clientX,py:t.clientY})},F=async(t,n,r=!1)=>{try{let a=await e.call(`pptx.shapes`,t,n);if(gp(e,t,a),i.setDirty(!0),re(e=>e+1),r){let e=a.els.map(e=>e.top??-1);S({slide:t,top:Math.max(...e)})}return a}catch(e){console.error(`[office-engine]`,e)}};(0,u.useEffect)(()=>{if(!C)return;let e=e=>{let t=(e.clientX-C.sx)/k,n=(e.clientY-C.sy)/k,r=C.moved||Math.abs(e.clientX-C.sx)+Math.abs(e.clientY-C.sy)>3;w({...C,moved:r,cur:r?Sp(C.box,C.mode,t,n,e.shiftKey):C.box})},t=()=>{let e=C;w(null),e.moved?F(e.slide,[{op:`xfrm`,top:e.top,box:e.cur}]):e.mode===`move`&&e.sid!==void 0&&be(e.slide,e.sid,e.px,e.py)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t,{once:!0}),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}});let I=async(t,n)=>{let r=n??x?.slide??N,i=t===`text`?a.w*.4:t===`line`?a.w*.25:a.w*.2,o=t===`text`?a.h*.1:t===`line`?1:a.w*.2,s={x:(a.w-i)/2,y:(a.h-o)/2,w:i,h:o},l;if(t===`image`){let[t]=await Dl(`image/*`,!1);if(!t)return;l=await e.call(`pptx.image`,r,await t.arrayBuffer(),(t.type.split(`/`)[1]??`png`).replace(`svg+xml`,`svg`));let n=await new Promise(e=>{let n=new Image;n.onload=()=>e({w:n.naturalWidth,h:n.naturalHeight}),n.onerror=()=>e({w:400,h:300}),n.src=URL.createObjectURL(t)}),i=Math.min(1,a.w*.6/n.w,a.h*.6/n.h);s={x:(a.w-n.w*i)/2,y:(a.h-n.h*i)/2,w:n.w*i,h:n.h*i}}let u=await F(r,[{op:`insert`,kind:t,box:s,rid:l,text:t===`text`?`Text`:void 0}],!0);if(c.current?.focus({preventScroll:!0}),u&&t===`text`){let e=u.els[u.els.length-1];e?.t===`shape`&&e.sid!==void 0&&e.text&&(v.begin(r,e.sid,e.text),_())}},Se=async(t,n)=>{P(),S(null);let r=await e.call(`pptx.slides`,t);Object.assign(a,r),_p(e),i.setDirty(!0),E(e=>e+1),n!==void 0&&requestAnimationFrame(()=>R(n))},Ce=async t=>{let n=await e.call(`pptx.undo`,t);n&&(gp(e,n.index,n.model),re(e=>Math.max(0,e+(t?1:-1))),S(null),R(n.index))},we=(e,t=N)=>{e===`add`?Se({op:`add`,after:t},t+1):e===`duplicate`?Se({op:`duplicate`,index:t},t+1):e===`delete`?Se({op:`delete`,index:t},Math.max(0,t-1)):e===`up`?t>0&&Se({op:`move`,from:t,to:t-1},t-1):e===`down`?t<a.count-1&&Se({op:`move`,from:t,to:t+1},t+1):e===`hide`&&Se({op:`hide`,index:t,hidden:!ye(t)?.hidden},t)},Te=e=>e?ye(e.slide)?.els.find(t=>t.top===e.top):void 0,Ee=(0,u.useRef)(x);Ee.current=x;let De={arrange:e=>{let t=Ee.current;t&&F(t.slide,[{op:`order`,top:t.top,to:e}])},duplicate:()=>{let e=Ee.current;e&&F(e.slide,[{op:`duplicate`,top:e.top}],!0)},remove:()=>{let e=Ee.current;e&&F(e.slide,[{op:`delete`,top:e.top}]),S(null)},rotate:e=>{let t=Ee.current,n=Te(t),r=t&&xp(ye(t.slide),t.top);if(!t||!r)return;let i={...r,flipH:n?.box.flipH,flipV:n?.box.flipV};e===`cw`?i.rot=(i.rot??0)+90:e===`ccw`?i.rot=(i.rot??0)-90:e===`flipH`?i.flipH=!i.flipH:i.flipV=!i.flipV,F(t.slide,[{op:`xfrm`,top:t.top,box:i}])},align:e=>{let t=Ee.current,n=t&&xp(ye(t.slide),t.top);if(!t||!n)return;let r={...n},i=(n.rot??0)*Math.PI/180,o=Math.abs(n.w*Math.cos(i))+Math.abs(n.h*Math.sin(i)),s=Math.abs(n.w*Math.sin(i))+Math.abs(n.h*Math.cos(i)),c=(o-n.w)/2,l=(s-n.h)/2;e===`left`?r.x=c:e===`center`||e===`both`?r.x=(a.w-r.w)/2:e===`right`?r.x=a.w-r.w-c:e===`top`?r.y=l:e===`middle`?r.y=(a.h-r.h)/2:e===`bottom`&&(r.y=a.h-r.h-l),e===`both`&&(r.y=(a.h-r.h)/2),F(t.slide,[{op:`xfrm`,top:t.top,box:r}])},anchor:e=>{if(v.active&&v.body){v.body={...v.body,anchor:e},F(v.slide,[{op:`anchor`,sid:v.sid,anchor:e}]),_();return}let t=Ee.current,n=Te(t);t&&n?.t===`shape`&&n.sid!==void 0&&F(t.slide,[{op:`anchor`,sid:n.sid,anchor:e}])}},Oe=()=>[{label:`Duplicate`,icon:`copy`,hint:`${Q}D`,run:De.duplicate},{label:`Delete`,icon:`trash`,hint:`Del`,run:De.remove},{label:`Bring to front`,icon:`front`,hint:`${Q}⇧↑`,sep:!0,run:()=>De.arrange(`front`)},{label:`Bring forward`,hint:`${Q}↑`,run:()=>De.arrange(`forward`)},{label:`Send backward`,hint:`${Q}↓`,run:()=>De.arrange(`backward`)},{label:`Send to back`,icon:`back`,hint:`${Q}⇧↓`,run:()=>De.arrange(`back`)},{label:`Rotate 90° clockwise`,icon:`rotate`,sep:!0,run:()=>De.rotate(`cw`)},{label:`Rotate 90° counter-clockwise`,icon:`rotateCcw`,run:()=>De.rotate(`ccw`)},{label:`Flip horizontally`,icon:`flipH`,run:()=>De.rotate(`flipH`)},{label:`Flip vertically`,icon:`flipV`,run:()=>De.rotate(`flipV`)},{label:`Center on slide`,icon:`alignObj`,sep:!0,run:()=>De.align(`both`)}],ke=e=>[{label:`New slide`,icon:`slideAdd`,hint:`${Q}M`,run:()=>we(`add`,e)},{label:`Duplicate slide`,icon:`copy`,run:()=>we(`duplicate`,e)},{label:`Delete slide`,icon:`trash`,run:()=>we(`delete`,e),disabled:a.count<=1},{label:ye(e)?.hidden?`Show slide`:`Hide slide`,icon:`hide`,run:()=>we(`hide`,e)},{label:`Move slide up`,icon:`up`,sep:!0,run:()=>we(`up`,e),disabled:e===0},{label:`Move slide down`,icon:`down`,run:()=>we(`down`,e),disabled:e>=a.count-1},{label:`Insert text box`,icon:`textbox`,sep:!0,run:()=>void I(`text`,e)},{label:`Insert image…`,icon:`image`,run:()=>void I(`image`,e)},{label:`Present from this slide`,icon:`play`,sep:!0,run:()=>ee(e)}],L=e=>{if(!x||v.active||!i.editable)return!1;let t=xp(ye(x.slide),x.top),n=e.shiftKey?10:1,r={ArrowUp:[0,-n],ArrowDown:[0,n],ArrowLeft:[-n,0],ArrowRight:[n,0]},a=e.metaKey||e.ctrlKey;if(a&&e.key.toLowerCase()===`d`)De.duplicate();else if(a&&(e.key===`ArrowUp`||e.key===`ArrowDown`))De.arrange(e.key===`ArrowUp`?e.shiftKey?`front`:`forward`:e.shiftKey?`back`:`backward`);else if(e.key===`Delete`||e.key===`Backspace`)F(x.slide,[{op:`delete`,top:x.top}]),S(null);else if(r[e.key]&&t)F(x.slide,[{op:`xfrm`,top:x.top,box:{...t,x:t.x+r[e.key][0],y:t.y+r[e.key][1]}}]);else if(e.key===`Escape`)S(null);else return!1;return e.preventDefault(),!0},R=e=>{let t=c.current;t&&(t.scrollTop=wp+Math.max(0,Math.min(a.count-1,e))*A-Math.max(0,(l.h-se)/2))},z=e=>{if(v.active||e.defaultPrevented||L(e))return;if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){e.preventDefault(),i.save();return}if(e.key===`F5`){e.preventDefault(),ee(e.shiftKey?0:N);return}let t=e.metaKey||e.ctrlKey;if(i.editable&&t&&(e.key.toLowerCase()===`z`||e.key.toLowerCase()===`y`))e.preventDefault(),Ce(e.key.toLowerCase()===`y`||e.shiftKey);else if(i.editable&&t&&e.key.toLowerCase()===`m`)e.preventDefault(),we(`add`);else{if(e.key===`PageDown`||e.key===`ArrowRight`||e.key===` `&&!e.shiftKey)R(N+1);else if(e.key===`PageUp`||e.key===`ArrowLeft`)R(N-1);else if(e.key===`Home`)R(0);else if(e.key===`End`)R(a.count-1);else return;e.preventDefault()}},Ae=e=>{let t=C&&C.slide===e&&C.moved?C.cur:x?xp(ye(e),x.top):void 0;if(t&&x)return(0,X.jsx)(Cp,{box:t,scale:k,onHandle:(t,n)=>{let r=xp(ye(e),x.top);r&&w({slide:e,top:x.top,mode:t,sx:n.clientX,sy:n.clientY,box:r,cur:r,moved:!1,px:n.clientX,py:n.clientY})}})},B=[];for(let t=j;t<=M;t++)B.push((0,X.jsx)(`div`,{className:i.editable?`de-slide-frame de-slide-editable`:`de-slide-frame`,style:{top:wp+t*A,left:de},"data-slide":t+1,onMouseDown:e=>xe(t,e),onContextMenu:e=>{if(!i.editable)return;let n=e.target;if(v.active&&b.current?.contains(n))return;e.preventDefault();let r=n.closest(`[data-top]`);if(r){P();let n={slide:t,top:Number(r.dataset.top)};Ee.current=n,S(n),te({x:e.clientX,y:e.clientY,items:Oe()})}else te({x:e.clientX,y:e.clientY,items:ke(t)})},children:(0,X.jsx)(yp,{client:e,index:t,meta:a,scale:k,live:!0,editing:v.slide===t?ve:void 0,overlay:i.editable&&x?.slide===t?Ae(t):void 0})},`${T}:${t}`));v.active&&(v.slide<j||v.slide>M)&&P();let V=[];if(g)for(let t=he;t<=ge;t++)V.push((0,X.jsxs)(`div`,{className:`de-thumb`,style:{top:10+t*me},"aria-current":t===N,onClick:()=>R(t),onContextMenu:e=>{i.editable&&(e.preventDefault(),R(t),te({x:e.clientX,y:e.clientY,items:ke(t)}))},children:[(0,X.jsx)(`span`,{className:`de-thumb-n`,children:t+1}),(0,X.jsx)(yp,{client:e,index:t,meta:a,scale:fe,live:!0})]},`${T}:${t}`));return(0,X.jsxs)(`div`,{ref:o,style:{display:`flex`,flex:1,minWidth:0},children:[g&&(0,X.jsx)(`div`,{ref:f,className:`de-thumbs`,children:(0,X.jsx)(`div`,{style:{height:20+a.count*me,position:`relative`},children:V})}),(0,X.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,display:`flex`},children:[(0,X.jsx)(`div`,{ref:c,className:`de-scroll`,tabIndex:0,onKeyDown:z,style:{outline:`none`},onMouseDown:e=>e.target===e.currentTarget&&P(),children:(0,X.jsx)(`div`,{style:{position:`relative`,height:le,width:ue},onMouseDown:e=>e.target===e.currentTarget&&P(),children:B})}),(0,X.jsx)(Fl,{zoom:m,effective:k,onChange:h}),!i.editable&&(0,X.jsx)(`button`,{type:`button`,className:`de-mode de-present-btn`,title:`Present (F5)`,onClick:()=>ee(N),children:`▶ Present`}),(0,X.jsx)(Nl,{text:`Slide ${N+1} of ${a.count}`,onStatus:t}),i.editable&&(0,X.jsx)(Kf,{editor:v,shape:x&&!v.active?(()=>{let e=Te(x),t=e?.t===`shape`?e:void 0;return{canText:t?.sid!==void 0,anchor:t?.text?.anchor}})():null,textAnchor:v.body?.anchor,canUndo:ne>0,onUndo:e=>void Ce(e),onInsert:e=>void I(e),onFill:e=>x&&void F(x.slide,[{op:`fill`,top:x.top,color:e}]),onLine:e=>x&&void F(x.slide,[{op:`line`,top:x.top,...e}]),onArrange:De.arrange,onRotate:De.rotate,onAlign:De.align,onAnchor:De.anchor,onDuplicate:De.duplicate,onDelete:De.remove,onBackground:e=>void F(N,[{op:`bg`,color:e}]),onSlide:e=>we(e),onPresent:e=>ee(e?0:N)}),O&&(0,X.jsx)(Il,{x:O.x,y:O.y,items:O.items,onClose:()=>te(null)}),D!==null&&(0,X.jsx)(qf,{client:e,meta:a,start:D,onClose:()=>ee(null)})]})]})}function Dp(e,t={}){let[n,r]=(0,u.useState)({client:null,error:null,loading:!!e,progress:null}),{name:i,worker:a,credentials:o}=t,s=t.headers?JSON.stringify(t.headers):``;return(0,u.useEffect)(()=>{if(!e){r({client:null,error:null,loading:!1,progress:null});return}let t=!0,n=null;return r({client:null,error:null,loading:!0,progress:null}),kc.open(e,{name:i,worker:a,credentials:o,headers:s?JSON.parse(s):void 0,onProgress:e=>t&&r(t=>({...t,progress:e}))}).then(e=>{if(!t)return e.destroy();n=e,e.on(`progress`,e=>t&&r(t=>({...t,progress:e}))),r(t=>({...t,client:e,loading:!1}))},e=>t&&r({client:null,error:e,loading:!1,progress:null})),()=>{t=!1,n?.destroy()}},[e,i,a,o,s]),n}var Op=[{value:`General`,label:`Automatic`,hint:`1000.12`},{value:`@`,label:`Plain text`,hint:`abc`},{value:`0`,label:`Number`,hint:`1000`,sep:!0},{value:`0.00`,label:`Number`,hint:`1000.12`},{value:`#,##0`,label:`Number`,hint:`1,000`},{value:`#,##0.00`,label:`Number`,hint:`1,000.12`},{value:`0.00E+00`,label:`Scientific`,hint:`1.01E+03`},{value:`0%`,label:`Percent`,hint:`10%`,sep:!0},{value:`0.00%`,label:`Percent`,hint:`10.12%`},{value:`"$"#,##0.00`,label:`Currency`,hint:`$1,000.12`,sep:!0},{value:`"$"#,##0`,label:`Currency rounded`,hint:`$1,000`},{value:`_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)`,label:`Accounting`,hint:`$ (1,000.12)`},{value:`#,##0 "₫"`,label:`Currency`,hint:`1,000 ₫`},{value:`# ?/?`,label:`Fraction`,hint:`1000 1/8`},{value:`yyyy-mm-dd`,label:`Date`,hint:`2026-09-26`,sep:!0},{value:`dd/mm/yyyy`,label:`Date`,hint:`26/09/2026`},{value:`d mmmm yyyy`,label:`Long date`,hint:`26 September 2026`},{value:`h:mm`,label:`Time`,hint:`15:59`},{value:`h:mm:ss AM/PM`,label:`Time`,hint:`3:59:00 PM`},{value:`yyyy-mm-dd h:mm`,label:`Date time`,hint:`2026-09-26 15:59`},{value:`[h]:mm:ss`,label:`Duration`,hint:`24:01:00`}],kp=[6,7,8,9,10,11,12,14,16,18,20,24,28,36,48],Ap=[{k:`all`,icon:`bAll`,title:`All borders`},{k:`inner`,icon:`bInner`,title:`Inner borders`},{k:`outer`,icon:`bOuter`,title:`Outer borders`},{k:`none`,icon:`bNone`,title:`Clear borders`},{k:`top`,icon:`bTop`,title:`Top border`},{k:`bottom`,icon:`bBottom`,title:`Bottom border`},{k:`left`,icon:`bLeft`,title:`Left border`},{k:`right`,icon:`bRight`,title:`Right border`}],jp=[{value:`thin`,label:`Thin`,hint:`───`},{value:`medium`,label:`Medium`,hint:`━━━`},{value:`thick`,label:`Thick`,hint:`▬▬▬`},{value:`dashed`,label:`Dashed`,hint:`- - -`},{value:`dotted`,label:`Dotted`,hint:`·····`},{value:`double`,label:`Double`,hint:`═══`}],Mp=[{value:`left`,label:`Left`,icon:`alignLeft`},{value:`center`,label:`Center`,icon:`alignCenter`},{value:`right`,label:`Right`,icon:`alignRight`}],Np=[{value:`top`,label:`Top`,icon:`vTop`},{value:`center`,label:`Middle`,icon:`vMiddle`},{value:`bottom`,label:`Bottom`,icon:`vBottom`}],Pp=[{value:0,label:`None`,icon:`rotNone`},{value:45,label:`Tilt up`,icon:`rotUp`},{value:-45,label:`Tilt down`,icon:`rotDown`},{value:255,label:`Stack vertically`,icon:`rotStack`},{value:90,label:`Rotate up`,icon:`rotUp90`},{value:-90,label:`Rotate down`,icon:`rotDown90`}],Fp=[`SUM`,`AVERAGE`,`COUNT`,`MAX`,`MIN`];function Ip(e,t){let n=e===`General`||e===`@`?`0`:e,r=/0(\.0*)?/.exec(n);if(!r)return t>0?`0.0`:`0`;let i=Math.max(0,(r[1]?r[1].length-1:0)+t);return n.slice(0,r.index)+`0`+(i?`.`+`0`.repeat(i):``)+n.slice(r.index+r[0].length)}function Lp(e){let{css:t,onFormat:n}=e,[r,i]=(0,u.useState)(`#000000`),[a,o]=(0,u.useState)(`thin`),s=String(t.textDecoration??``),c=t.textAlign??``,l=t.alignItems===`flex-start`?`top`:t.alignItems===`center`?`center`:`bottom`,d=Number(t.textRotate??0),f=e=>typeof e==`string`&&e.endsWith(`pt`)?parseFloat(e):typeof e==`number`?Math.round(e*.75*2)/2:void 0,p=f(t.fontSize)??f(e.base.fontSize),m=Sl(t.fontFamily??e.base.fontFamily),h=Op.find(t=>t.value===e.format),g=h?Op:[{value:e.format,label:`Custom`,hint:e.format},...Op];return(0,X.jsxs)(jl,{children:[(0,X.jsx)(Z,{icon:`undo`,title:`Undo (${Q}Z)`,onClick:e.onUndo}),(0,X.jsx)(Z,{icon:`redo`,title:`Redo (${Q}Y)`,onClick:e.onRedo}),(0,X.jsx)(Z,{icon:`paint`,title:`Paint format (click, then select cells)`,active:e.painter,onClick:e.onPaint}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`currency`,title:`Format as currency`,onClick:()=>n({numFmt:`"$"#,##0.00`})}),(0,X.jsx)(Z,{icon:`percent`,title:`Format as percent`,onClick:()=>n({numFmt:`0%`})}),(0,X.jsx)(Z,{icon:`decLess`,title:`Decrease decimal places`,onClick:()=>n({numFmt:Ip(e.format,-1)})}),(0,X.jsx)(Z,{icon:`decMore`,title:`Increase decimal places`,onClick:()=>n({numFmt:Ip(e.format,1)})}),(0,X.jsx)(il,{title:`Number format: ${h?.label??`Custom`}`,width:96,menuWidth:270,value:e.format,options:g,onChange:e=>n({numFmt:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(il,{title:`Font`,width:112,menuWidth:200,value:m,placeholder:`Font`,options:xl(m),onChange:e=>n({font:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(al,{value:p,sizes:kp,onChange:e=>n({sz:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bold`,title:`Bold (${Q}B)`,active:t.fontWeight===700,onClick:()=>e.onToggle(`b`)}),(0,X.jsx)(Z,{icon:`italic`,title:`Italic (${Q}I)`,active:t.fontStyle===`italic`,onClick:()=>e.onToggle(`i`)}),(0,X.jsx)(Z,{icon:`underline`,title:`Underline (${Q}U)`,active:s.includes(`underline`),onClick:()=>e.onToggle(`u`)}),(0,X.jsx)(Z,{icon:`strike`,title:`Strikethrough (${Q}⇧X)`,active:s.includes(`line-through`),onClick:()=>e.onToggle(`strike`)}),(0,X.jsx)(vl,{icon:`color`,title:`Text color`,value:t.color,onPick:e=>n({color:e}),noneLabel:`Automatic`}),(0,X.jsx)(nl,{}),(0,X.jsx)(vl,{icon:`fill`,title:`Fill color`,value:typeof t.background==`string`&&!t.background.includes(`gradient`)?t.background:void 0,onPick:e=>n({fill:e}),noneLabel:`No fill`}),(0,X.jsx)(Tl,{icon:`borders`,title:`Borders`,chevron:!0,children:e=>(0,X.jsxs)(`div`,{className:`de-borders-pop`,children:[(0,X.jsx)(`div`,{className:`de-borders`,role:`group`,"aria-label":`Borders`,children:Ap.map(t=>(0,X.jsx)(`button`,{type:`button`,className:`de-tb`,title:t.title,"aria-label":t.title,onClick:()=>{e(),n({border:t.k,borderColor:r,borderStyle:a})},children:(0,X.jsx)(Qc,{name:t.icon})},t.k))}),(0,X.jsxs)(`div`,{className:`de-borders-side`,children:[(0,X.jsx)(vl,{icon:`color`,title:`Border color`,value:r,onPick:e=>i(e??`#000000`),noneLabel:`Black`}),(0,X.jsx)(rl,{title:`Border style`,icon:`lineStyle`,label:null,menuWidth:150,value:a,options:[...jp],onChange:e=>o(e)})]})]})}),(0,X.jsx)(rl,{title:`Merge cells`,icon:`merge`,label:null,menuWidth:190,options:[{value:`all`,label:`Merge all`},{value:`across`,label:`Merge horizontally`},{value:`down`,label:`Merge vertically`},{value:`unmerge`,label:`Unmerge`,disabled:!e.merged,sep:!0}],onChange:t=>e.onMerge(t)}),(0,X.jsx)(nl,{}),(0,X.jsx)(rl,{title:`Horizontal align`,icon:Mp.find(e=>e.value===c)?.icon??`alignLeft`,label:null,menuWidth:140,value:c,options:Mp.map(e=>({...e})),onChange:e=>n({align:e===c?null:e})}),(0,X.jsx)(rl,{title:`Vertical align`,icon:Np.find(e=>e.value===l).icon,label:null,menuWidth:140,value:l,options:Np.map(e=>({...e})),onChange:e=>n({valign:e})}),(0,X.jsx)(Z,{icon:`wrap`,title:`Wrap text`,active:t.whiteSpace===`pre-wrap`,onClick:()=>n({wrap:t.whiteSpace!==`pre-wrap`})}),(0,X.jsx)(rl,{title:`Text rotation`,icon:Pp.find(e=>e.value===d)?.icon??`rotNone`,label:null,menuWidth:180,value:d,options:Pp,onChange:e=>n({rotate:e||null})}),(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Insert, delete or hide rows & columns`,label:`Rows`,icon:`rowAdd`,items:[{value:`rowAbove`,label:`Insert row above`,icon:`rowAbove`},{value:`rowBelow`,label:`Insert row below`,icon:`rowBelow`},{value:`colLeft`,label:`Insert column left`,icon:`colLeft`},{value:`colRight`,label:`Insert column right`,icon:`colRight`},{value:`delRow`,label:`Delete row(s)`,icon:`delRow`,sep:!0},{value:`delCol`,label:`Delete column(s)`,icon:`delCol`},{value:`hideRows`,label:`Hide row(s)`,icon:`hide`,sep:!0},{value:`hideCols`,label:`Hide column(s)`,icon:`hide`},{value:`unhideRows`,label:`Unhide rows`,icon:`view`},{value:`unhideCols`,label:`Unhide columns`,icon:`view`}],onPick:t=>e.onRows(t)}),(0,X.jsx)(rl,{title:`Functions`,icon:`sum`,label:null,menuWidth:170,options:[...Fp.map(e=>({value:e,label:e})),{value:``,label:`More functions…`,sep:!0}],onChange:t=>e.onFunc(t||null)}),(0,X.jsx)(rl,{title:`Sort range`,icon:`sort`,label:null,menuWidth:200,options:[{value:`asc`,label:`Sort range A → Z`,icon:`sortAZ`},{value:`desc`,label:`Sort range Z → A`,icon:`sortZA`}],onChange:t=>e.onSort(t===`desc`)}),(0,X.jsx)(wl,{title:`View: freeze, gridlines`,label:`View`,icon:`freeze`,items:[{value:`row`,label:`Freeze 1 row`},{value:`col`,label:`Freeze 1 column`},{value:`sel`,label:`Freeze up to current cell`},{value:`none`,label:`Unfreeze`,disabled:!e.frozen},{value:`grid`,label:e.gridlines?`Hide gridlines`:`Show gridlines`,icon:`gridlines`,sep:!0}],onPick:t=>t===`grid`?e.onGridlines():e.onFreeze(t)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`clear`,title:`Clear formatting (${Q}\\)`,onClick:()=>n({clear:!0})}),(0,X.jsx)(Z,{icon:`search`,title:`Find & replace (${Q}F)`,onClick:e.onFind})]})}var Rp=class{constructor(e){A(this,`def`,void 0),A(this,`count`,0),A(this,`custom`,new Map),A(this,`keys`,[]),A(this,`cum`,[]),A(this,`dirty`,!1),this.def=e}set(e,t){t===this.def?this.custom.delete(e):this.custom.set(e,t),this.dirty=!0}setRange(e,t,n){let r=Math.min(t,e+2e4);for(let t=e;t<=r;t++)this.set(t,n)}build(){if(!this.dirty)return;this.keys=[...this.custom.keys()].sort((e,t)=>e-t);let e=0;this.cum=this.keys.map(t=>e+=this.custom.get(t)-this.def),this.dirty=!1}size(e){return this.custom.get(e)??this.def}pos(e){this.build();let t=0,n=this.keys.length-1,r=-1;for(;t<=n;){let i=t+n>>1;this.keys[i]<e?(r=i,t=i+1):n=i-1}return e*this.def+(r>=0?this.cum[r]:0)}total(){return this.pos(this.count)}index(e){if(e<=0)return 0;let t=0,n=Math.max(0,this.count-1);for(;t<n;){let r=t+n+1>>1;this.pos(r)<=e?t=r:n=r-1}return t}},zp=(e,t)=>typeof e==`string`&&e.endsWith(`pt`)?parseFloat(e)*4/3:typeof e==`number`?e:t;function Bp(e,t,n){let r=n*.56;if(e.length*r<=t)return e;let i=/^(-?\d+)\.(\d+)$/.exec(e);if(i&&(i[1].length+(e.startsWith(`-`),0))*r<=t){let n=Math.max(0,Math.floor(t/r)-i[1].length-1),a=Number(e).toFixed(n);if(a.length*r<=t)return a}return`#`.repeat(Math.max(1,Math.floor(t/r)))}var Vp=2e3,Hp=2e4,Up=100,Wp=700,Gp=960;async function Kp(e,t,n){let r=new Map;for(let i=0;i<n;i+=Vp){let a=await e.call(`xlsx.block`,t,i,Math.min(n,i+Vp));for(let e of a.rows)r.set(e.r,e.cells)}return r}var qp=()=>Error(`The sheet is still loading — try again in a moment`);async function Jp(e,t,n,r){if(!n.done)throw qp();let i=await Kp(e,t,n.rows),a=-1,o=-1;for(let[e,t]of i)for(let n of t)n[1]!==``&&(a=Math.max(a,e),o=Math.max(o,n[0]));let s=[];for(let e=0;e<=a;e++){let t=Array(o+1).fill(``);for(let n of i.get(e)??[])n[0]<=o&&(t[n[0]]=n[1]);s.push(t)}return(r===`,`?``:``)+td(s,r)}var Yp={"flex-start":`top`,center:`middle`,"flex-end":`bottom`};async function Xp(e,t,n,r){if(!n.done)throw qp();let i=await Kp(e,t,Math.min(n.rows,Hp)),a=-1,o=-1;for(let[e,t]of i)for(let n of t)(n[1]!==``||n[2])&&(a=Math.max(a,e),o=Math.max(o,n[0]));let s=n.merges.filter(e=>e.r0<=a&&e.c0<=o);for(let e of s)a=Math.max(a,Math.min(e.r1,19999)),o=Math.max(o,e.c1);let c=[];for(let e=0;e<=o;e++)n.colAxis.size(e)>0&&c.push(e);let l=new Map,u=new Set,d=(e,t)=>e*16384+t,f=new Int32Array(a+2);for(let e of s){l.set(d(e.r0,e.c0),e);let t=Math.min(e.r1,a);for(let n=e.r0;n<=t;n++)for(let t=e.c0;t<=e.c1;t++)(n!==e.r0||t!==e.c0)&&u.add(d(n,t));t>e.r0&&(f[e.r0+1]++,f[t+1]--)}let p=(e,t,n)=>{let r=0;for(let i=t;i<=n;i++)e.size(i)>0&&r++;return Math.max(1,r)},m=zp(r.baseFont.fontSize,14.67),h=[],g=[],_=0;for(let e=0;e<=a;e++){_+=f[e],!_&&g.length>=Up&&(h.push(g),g=[]);let t=n.rowAxis.size(e);if(!t)continue;let s=new Map((i.get(e)??[]).map(e=>[e[0],e])),v=[];c.forEach((t,i)=>{if(u.has(d(e,t)))return;let f=s.get(t),h=l.get(d(e,t)),[,g=``,_=0,y=0,b]=f??[],{textAlign:x,textRotate:S,alignItems:C,whiteSpace:w,...T}=r.styles[_]??{},E=h?n.colAxis.pos(Math.min(h.c1,o)+1)-n.colAxis.pos(h.c0):n.colAxis.size(t),D=y===1&&g?Bp(g,E-6,zp(T.fontSize,m)):g,ee=x??(y===1?`right`:y===2?`center`:`left`),O=c[i+1],te=!!D&&!h&&ee===`left`&&!w&&(O===void 0||!s.get(O)?.[1]&&!u.has(d(e,O))),ne={...T};ee!==`left`&&(ne.textAlign=ee);let re=Yp[C];re&&re!==`bottom`&&(ne.verticalAlign=re),w&&(ne.whiteSpace=w),b&&(ne.color=b),v.push((0,X.jsx)(`td`,{style:ne,"data-de-fit":D&&!te?y===1?`#`:``:void 0,colSpan:h?p(n.colAxis,h.c0,Math.min(h.c1,o)):void 0,rowSpan:h?p(n.rowAxis,h.r0,Math.min(h.r1,a)):void 0,children:D},t))}),g.push((0,X.jsx)(`tr`,{style:{height:t},children:v},e))}(g.length||!h.length)&&h.push(g);let v=c.reduce((e,t)=>e+n.colAxis.size(t),0),y=v>Wp,b=Math.max(.35,Math.min(1,(y?Gp:Wp)/Math.max(1,v))),x=n.gridLines?`de-print-table de-print-grid`:`de-print-table`,S={width:v,...r.baseFont},C=(0,X.jsx)(`colgroup`,{children:c.map(e=>(0,X.jsx)(`col`,{style:{width:n.colAxis.size(e)}},e))});return{node:(0,X.jsx)(`div`,{className:`de-print-sheet de-print-fit`,style:{"--de-fit":b},children:h.map((e,t)=>(0,X.jsxs)(`table`,{className:x,style:S,children:[C,(0,X.jsx)(`tbody`,{children:e})]},t))}),size:y?`landscape`:`auto`,margin:`12mm`,notice:n.rows>Hp?`Only the first ${Hp.toLocaleString()} rows are included`:void 0}}var Zp=128,Qp=22,$p=12e6,em=class{constructor(){A(this,`rows`,0),A(this,`cols`,0),A(this,`done`,!1),A(this,`error`,void 0),A(this,`header`,!1),A(this,`rowAxis`,new Rp(20)),A(this,`colAxis`,new Rp(64)),A(this,`merges`,[]),A(this,`frozen`,{rows:0,cols:0}),A(this,`gridLines`,!0),A(this,`blocks`,new Map),A(this,`inflight`,new Set),A(this,`sel`,void 0),A(this,`scrollPos`,void 0)}},tm=class{constructor(e){A(this,`client`,void 0),A(this,`sheets`,new Map),A(this,`focusGrid`,!1),A(this,`listeners`,new Set),A(this,`off`,void 0),this.client=e;let t=[e.on(`xlsx:progress`,e=>this.onProgress(e)),e.on(`collab:xlsx`,t=>this.applied(t,e.info.xlsx))];this.off=()=>t.forEach(e=>e())}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(){for(let e of this.listeners)e()}sheet(e){let t=this.sheets.get(e);return t||(t=new em,this.sheets.set(e,t),this.client.call(`xlsx.load`,e).catch(e=>{t.error=e.message,t.done=!0,this.emit()})),t}onProgress(e){let t=this.sheet(e.sheet);if(e.defaultRowH!==void 0&&!t.header){t.header=!0,t.rowAxis.def=e.defaultRowH||20,t.colAxis.def=e.defaultColW||64;for(let n of e.colInfo??[])t.colAxis.setRange(n.min,n.max,n.w);t.frozen=e.frozen??t.frozen,t.gridLines=e.gridLines??!0}for(let[n,r]of e.rowSizes)t.rowAxis.set(n,r);e.recalc&&t.blocks.clear(),t.rows=Math.max(t.rows,e.rows),t.cols=Math.max(t.cols,e.cols),e.merges&&(t.merges=e.merges),e.error&&(t.error=e.error),t.done=e.done,this.emit()}ensure(e,t,n){let r=this.sheet(e);if(r.header||r.done)for(let i=Math.floor(t/Zp);i<=Math.floor(n/Zp);i++){let t=r.blocks.get(i);if(r.inflight.has(i)||t&&(t.complete||t.rowsAt===r.rows&&!r.done)||i*Zp>r.rows&&!r.done&&t)continue;r.inflight.add(i);let n=r.rows;this.client.call(`xlsx.block`,e,i*Zp,(i+1)*Zp).then(e=>{let t=new Map;for(let n of e.rows)t.set(n.r,n.cells);if(r.blocks.set(i,{rows:t,complete:e.complete,rowsAt:n}),r.blocks.size>400){let e=r.blocks.keys().next().value;r.blocks.delete(e)}}).catch(()=>{}).finally(()=>{r.inflight.delete(i),this.emit()})}}invalidate(e,t,n){let r=this.sheet(e);for(let e=Math.floor(t/Zp);e<=Math.floor(n/Zp);e++)r.blocks.delete(e);r.rows=Math.max(r.rows,n+1),this.emit()}applied(e,t){if(!e)return;for(let n of e.styles??[])t.styles[n.index]=n.css,t.formats[n.index]=n.format;for(let t of e.recalc??[])this.sheets.get(t)?.blocks.clear();if(e.sheets){t.sheets=e.sheets,this.sheets.clear(),this.emit();return}let n=this.sheet(e.sheet);if(e.layout){let t=e.layout;n.rowAxis=new Rp(t.defaultRowH||n.rowAxis.def),n.colAxis=new Rp(t.defaultColW||n.colAxis.def);for(let e of t.colInfo??[])n.colAxis.setRange(e.min,e.max,e.w);for(let[e,r]of t.rowSizes)n.rowAxis.set(e,r);n.merges=t.merges??[],n.frozen=t.frozen??n.frozen,t.gridLines!==void 0&&(n.gridLines=t.gridLines),n.rows=t.rows,n.cols=t.cols,n.blocks.clear(),this.emit()}else n.cols=Math.max(n.cols,e.range.c1+1),this.invalidate(e.sheet,e.range.r0,e.range.r1)}row(e,t){return this.sheets.get(e)?.blocks.get(Math.floor(t/Zp))?.rows.get(t)}dispose(){this.off(),this.listeners.clear()}},nm=new WeakMap;function rm(e){let t=nm.get(e);return t||nm.set(e,t=new tm(e)),t}function im({client:e,onStatus:t,initialSheet:n}){let r=e.info.xlsx,i=r.sheets.filter(e=>!e.hidden),[a,o]=(0,u.useState)(n??i[0]?.index??0),s=(0,u.useMemo)(()=>rm(e),[e]),[,c]=Wc();(0,u.useEffect)(()=>s.subscribe(c),[s,c]);let l=s.sheet(a),d=l.error?`Error: ${l.error}`:`${l.rows.toLocaleString()} rows × ${l.cols.toLocaleString()} cols${l.done?``:` · loading…`}`,f=kl();Al({printable:()=>Xp(e,v,s.sheet(v),r),text:t=>Jp(e,v,s.sheet(v),t===`tsv`?` `:`,`),stats:()=>{let e=s.sheet(v);return[[`Sheets`,`${r.sheets.length}${r.sheets.some(e=>e.hidden)?` (${r.sheets.filter(e=>e.hidden).length} hidden)`:``}`],[`Current sheet`,r.sheets[v]?.name??``],[`Used range`,`${e.rows.toLocaleString()} rows × ${e.cols.toLocaleString()} columns${e.done?``:` (loading)`}`]]},importTable:async(t,n)=>{let i=await e.call(`xlsx.bookOp`,{op:`add`,name:n,after:v});s.applied(i,r),f.setDirty(!0);let a=v+1;o(a),await new Promise((e,t)=>{let n=()=>{},r=()=>{let r=s.sheet(a);if(r.error)t(Error(r.error));else if(r.done)e();else return;n()};n=s.subscribe(r),r()});let l=[];t.forEach((e,t)=>e.forEach((e,n)=>e!==``&&l.push({r:t,c:n,input:e}))),l.length&&s.applied(await e.call(`xlsx.set`,a,l),r),c()}});let[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),_=async(t,n)=>{try{let i=await e.call(`xlsx.bookOp`,t);s.applied(i,r),f.setDirty(!0),n!==void 0&&o(Math.max(0,Math.min(n,r.sheets.length-1))),c()}catch(e){am(e)}},v=Math.min(a,r.sheets.length-1),[y,b]=(0,u.useState)(null),x=(0,u.useRef)(!1),S=!!y&&_o(y.value)&&cm(y,bo(y.value,y.caret));return(0,X.jsxs)(`div`,{className:`de-xlsx`,children:[(0,X.jsx)(Nl,{text:d,onStatus:t}),(0,X.jsx)(mm,{store:s,sheet:v,meta:r,client:e,edit:y,setEdit:b,hold:x,onSheet:o},`${v}:${r.sheets[v]?.path}`),(0,X.jsxs)(`div`,{className:`de-tabs`,role:`tablist`,children:[f.editable&&(0,X.jsx)(`button`,{type:`button`,className:`de-tab de-tab-add`,title:`Add sheet`,onClick:()=>void _({op:`add`,after:v},v+1),children:`+`}),r.sheets.filter(e=>!e.hidden).map(e=>p===e.index?(0,X.jsx)(`input`,{className:`de-tab-input`,autoFocus:!0,defaultValue:e.name,onBlur:t=>{m(null),t.target.value.trim()&&t.target.value!==e.name&&_({op:`rename`,index:e.index,name:t.target.value})},onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&m(null)}},e.index):(0,X.jsx)(`button`,{type:`button`,role:`tab`,className:`de-tab`,"aria-selected":e.index===v,onMouseDown:t=>{S&&(t.preventDefault(),e.index!==v&&(x.current=!0))},onClick:()=>o(e.index),onDoubleClick:()=>f.editable&&m(e.index),onContextMenu:t=>{f.editable&&(t.preventDefault(),g({index:e.index,x:t.clientX,y:t.clientY}))},children:e.name},e.index))]}),h&&(0,X.jsx)(Il,{x:h.x,y:h.y,onClose:()=>g(null),items:[{label:`Rename`,run:()=>m(h.index)},{label:`Duplicate name → new sheet`,run:()=>void _({op:`add`,after:h.index,name:r.sheets[h.index].name+` (2)`},h.index+1)},{label:`Move left`,disabled:h.index===0,run:()=>void _({op:`move`,from:h.index,to:h.index-1},h.index-1)},{label:`Move right`,disabled:h.index>=r.sheets.length-1,run:()=>void _({op:`move`,from:h.index,to:h.index+1},h.index+1)},{label:`Delete sheet`,disabled:r.sheets.length<=1,run:()=>void _({op:`delete`,index:h.index},Math.max(0,h.index-1))}]})]})}function am(e){console.error(`[office-engine]`,e)}function om(e){return e===255?{writingMode:`vertical-rl`,textOrientation:`upright`,whiteSpace:`nowrap`}:e===90?{writingMode:`vertical-rl`,transform:`rotate(180deg)`,whiteSpace:`nowrap`}:e===-90?{writingMode:`vertical-rl`,whiteSpace:`nowrap`}:{display:`inline-block`,transform:`rotate(${-e}deg)`,whiteSpace:`nowrap`}}var sm={center:`center`,right:`flex-end`,left:`flex-start`,justify:`flex-start`};function cm(e,t){return t?e.point&&e.point.e===e.caret&&e.caret===e.caretEnd?!0:e.caret===e.caretEnd?t.pointable:t.refs.some(t=>t.s===e.caret&&t.e===e.caretEnd):!1}var lm=[`#1a73e8`,`#e8710a`,`#9334e6`,`#188038`,`#d93025`,`#12a4b8`,`#e52592`,`#b08800`],um=e=>e.replace(/\$/g,``).toUpperCase(),dm={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]},fm=e=>({r0:Math.min(e.ar,e.fr),c0:Math.min(e.ac,e.fc),r1:Math.max(e.ar,e.fr),c1:Math.max(e.ac,e.fc)});function pm(e,t){let n=e;for(let e=!0;e;){e=!1;for(let r of t)r.r1<n.r0||r.r0>n.r1||r.c1<n.c0||r.c0>n.c1||r.r0>=n.r0&&r.r1<=n.r1&&r.c0>=n.c0&&r.c1<=n.c1||(n={r0:Math.min(n.r0,r.r0),c0:Math.min(n.c0,r.c0),r1:Math.max(n.r1,r.r1),c1:Math.max(n.c1,r.c1)},e=!0)}return n}function mm({store:e,sheet:t,meta:n,client:r,edit:i,setEdit:a,hold:o,onSheet:s}){let c=kl(),l=c.editable,d=e.sheet(t),[f,p]=Gc(),m=Kc(f),[h,g]=(0,u.useState)(()=>d.sel??{ar:0,ac:0,fr:0,fc:0});d.sel=h;let[_,v]=(0,u.useState)(null),y=_&&_.r===h.ar&&_.c===h.ac?_.d:void 0,[b,x]=(0,u.useState)(0),S=(0,u.useRef)(!1),C=(0,u.useRef)(null),w=(0,u.useRef)(null),T=(0,u.useRef)(null),[E,D]=(0,u.useState)(0),[ee,O]=(0,u.useState)(null),[te,ne]=(0,u.useState)(null),re=(0,u.useRef)(null),[ie,ae]=(0,u.useState)({open:!1,q:``,idx:0,replace:!1,tick:0}),[oe,k]=(0,u.useState)({}),[se,ce]=(0,u.useState)([]),[A,le]=(0,u.useState)(null),[ue,de]=(0,u.useState)(null),{rowAxis:j,colAxis:M,frozen:N}=d,fe=Math.max(40,12+7*String(Math.max(d.rows,1e3)).length),pe=Math.max(0,p.w-fe),me=Math.max(0,p.h-Qp);j.count=Math.max(d.rows+(d.done?20:1),Math.ceil(me/j.def)+1,N.rows+1,h.fr+2),M.count=Math.max(d.cols+3,26,Math.ceil(pe/Math.max(1,M.def))+1,N.cols+1,h.fc+2);let he=M.pos(N.cols),ge=j.pos(N.rows),P=M.total(),_e=j.total(),ve=fe+P,ye=Math.min(Qp+_e,$p),be=Math.max(0,Qp+_e-p.h),xe=Math.max(0,ye-p.h),F=xe>0?Math.min(be,m.y/xe*be):0,I=m.x,Se=he+I,Ce=ge+F,we=Math.max(0,pe-he),Te=Math.max(0,me-ge),Ee=j.index(Ce),De=Math.min(j.count-1,j.index(Ce+Te)),Oe=M.index(Se),ke=Math.min(M.count-1,M.index(Se+we)),L=(0,u.useMemo)(()=>d.merges.filter(e=>e.r1>=Ee&&e.r0<=De||e.r0<N.rows?e.c1>=Oe&&e.c0<=ke||e.c0<N.cols:!1),[d.merges,Ee,De,Oe,ke,N.rows,N.cols]);(0,u.useEffect)(()=>{N.rows&&e.ensure(t,0,N.rows-1),e.ensure(t,Math.max(0,Ee-20),De+40);for(let n of L)n.r0<Ee&&e.ensure(t,n.r0,n.r0)}),(0,u.useEffect)(()=>{let e=!0,{ar:n,ac:i}=h;return r.call(`xlsx.cell`,t,n,i).then(t=>e&&v({r:n,c:i,d:t}),()=>{}),()=>{e=!1}},[r,t,h.ar,h.ac,d.done,b]);let R=n.styles,z=zp(n.baseFont.fontSize,14.67),Ae=(e,t)=>d.merges.find(n=>e>=n.r0&&e<=n.r1&&t>=n.c0&&t<=n.c1),B=pm(fm(h),d.merges),V=B.r0===B.r1&&B.c0===B.c1||d.merges.some(e=>e.r0===B.r0&&e.c0===B.c0&&e.r1===B.r1&&e.c1===B.c1),je=(0,u.useRef)(B);je.current=B,(0,u.useEffect)(()=>Vc(r,{sheet:t,range:B,ar:h.ar,ac:h.ac}),[r,t,B.r0,B.c0,B.r1,B.c1,h.ar,h.ac]);let Me=(0,u.useSyncExternalStore)(e=>Bc(r,e),()=>zc(r)),Ne=n.sheets[t]?.path,Pe=Me.flatMap(e=>{let t=e.presence;return t?.k===`xlsx`&&t.sheet===Ne&&t.range?[{...e,range:t.range,ar:t.ar??t.range.r0,ac:t.ac??t.range.c0}]:[]});(0,u.useLayoutEffect)(()=>{o.current=!1;let t=f.current;return t&&d.scrollPos&&(t.scrollLeft=d.scrollPos.x,t.scrollTop=d.scrollPos.y),e.focusGrid&&(e.focusGrid=!1,t?.focus({preventScroll:!0})),()=>{t?.isConnected&&(d.scrollPos={x:t.scrollLeft,y:t.scrollTop})}},[]);let Fe=e=>{let t=Ae(e.ar,e.ac);t&&(e={...e,ar:t.r0,ac:t.c0}),g(e)};function Ie(n,r,i,a,o,s,c,l,u,f,p){if(f<=0||p<=0||i<r||o<a)return null;let m=[];if(d.gridLines){for(let e=r;e<=i;e++)m.push((0,X.jsx)(`div`,{className:`de-gl-h`,style:{top:j.pos(e+1)-c-1}},`h`+e));for(let e=a;e<=o;e++)m.push((0,X.jsx)(`div`,{className:`de-gl-v`,style:{left:M.pos(e+1)-s-1}},`v`+e))}let g=new Set,_=[];for(let e of L)if(!(e.r1<r||e.r0>i||e.c1<a||e.c0>o)){_.push(e);for(let t=Math.max(e.r0,r);t<=Math.min(e.r1,i);t++)for(let n=Math.max(e.c0,a);n<=Math.min(e.c1,o);n++)g.add(t*16384+n)}let v=(e,t,n,r,i,a=!1)=>{let[l,u,d,f,p]=t,m=n??M.size(l),h=r??j.size(e);if(!m||!h)return null;let _=R[d]??{},v=u;f===1&&u&&(v=Bp(u,m-6,zp(_.fontSize,z)));let{textAlign:y,textRotate:b,alignItems:x,whiteSpace:S,...C}=_,w=Number(b??0),T=y&&sm[y]||(f===1?`flex-end`:f===2?`center`:`flex-start`),E=0;if(v&&!w&&!S&&T===`flex-start`&&!a&&i){let t=l+1;for(;t<=o+8&&!i.has(t)&&!g.has(e*16384+t);)t++;E=M.pos(t)-M.pos(l)}let D={...C,left:M.pos(l)-s,top:j.pos(e)-c,width:m,height:h,justifyContent:T,alignItems:x??`flex-end`,textAlign:y??void 0};p&&(D.color=p),S&&(D.whiteSpace=S),a&&!C.background&&(D.background=`linear-gradient(#fff, #fff) 0 0 / calc(100% - 1px) calc(100% - 1px) no-repeat`);let ee=E>m;return(0,X.jsx)(`div`,{className:ee?`de-cell de-ov`:`de-cell`,style:D,children:v&&(0,X.jsx)(`span`,{style:w?om(w):ee?{maxWidth:E-6,overflow:`hidden`,flex:`none`}:void 0,children:v})},`${e}:${l}`)};for(let n of _){let r=e.row(t,n.r0)?.find(e=>e[0]===n.c0)??[n.c0,``,0,0];m.push(v(n.r0,r,M.pos(n.c1+1)-M.pos(n.c0),j.pos(n.r1+1)-j.pos(n.r0),void 0,!0))}for(let n=r;n<=i;n++){let r=e.row(t,n);if(!r)continue;let i;for(let e of r){let t=e[0];t<a-8||t>o||g.has(n*16384+t)||t<a&&(!e[1]||e[3]!==0)||_.some(e=>e.r0===n&&e.c0===t)||(!i&&e[3]===0&&e[1]&&(i=new Set(r.filter(e=>e[1]!==``).map(e=>e[0]))),m.push(v(n,e,void 0,void 0,i)))}}if(B.r1>=r&&B.r0<=i&&B.c1>=a&&B.c0<=o&&!V&&m.push((0,X.jsx)(`div`,{className:`de-range`,style:{left:M.pos(B.c0)-s,top:j.pos(B.r0)-c,width:M.pos(B.c1+1)-M.pos(B.c0),height:j.pos(B.r1+1)-j.pos(B.r0)}},`range`)),h.ar>=r-1&&h.ar<=i&&h.ac>=a-1&&h.ac<=o){let e=Ae(h.ar,h.ac),t=e?M.pos(e.c1+1)-M.pos(e.c0):M.size(h.ac),n=e?j.pos(e.r1+1)-j.pos(e.r0):j.size(h.ar);m.push((0,X.jsx)(`div`,{className:`de-sel`,style:{left:M.pos(h.ac)-s-1,top:j.pos(h.ar)-c-1,width:t+1,height:n+1}},`sel`))}for(let e of Pe){let t=e.range;if(t.r1<r||t.r0>i||t.c1<a||t.c0>o)continue;let n=M.pos(t.c0),l=j.pos(t.r0),u=M.pos(t.c1+1),d=j.pos(t.r1+1);m.push((0,X.jsx)(`div`,{className:`de-peer-range`,style:{left:n-s-1,top:l-c-1,width:u-n+1,height:d-l+1,borderColor:e.color,background:e.color+`12`},children:e.ar>=r&&e.ar<=i&&e.ac>=a&&e.ac<=o&&(0,X.jsx)(`span`,{className:`de-peer-tag`,style:{background:e.color},children:e.name})},`peer`+e.site))}return Vt.forEach((e,t)=>{e.r<r||e.r>i||e.c<a||e.c>o||m.push((0,X.jsx)(`div`,{className:t===ie.idx?`de-findcell on`:`de-findcell`,style:{left:M.pos(e.c)-s,top:j.pos(e.r)-c,width:M.size(e.c),height:j.size(e.r)}},`fm`+t))}),ot.forEach((e,t)=>{if(e.r1<r||e.r0>i||e.c1<a||e.c0>o)return;let n=j.pos(Math.max(e.r0,r-1)),l=j.pos(Math.min(e.r1,i+1)+1),u=M.pos(Math.max(e.c0,a-1)),d=M.pos(Math.min(e.c1,o+1)+1);m.push((0,X.jsx)(`div`,{className:e.point?`de-fref de-fref-pt`:`de-fref`,style:{left:u-s-1,top:n-c-1,width:d-u+1,height:l-n+1,borderColor:e.color,background:e.color+`14`}},`fr`+t))}),(0,X.jsx)(`div`,{className:`de-region`,style:{left:l,top:u,width:f,height:p},children:m},n)}function Le(e,t,n,r,i,a){if(a<=0)return null;let o=[];for(let e=t;e<=n;e++){let t=M.size(e);t&&(o.push((0,X.jsx)(`div`,{"data-col":e,className:e>=B.c0&&e<=B.c1?`de-head-c de-head-on`:`de-head-c`,style:{left:M.pos(e)-r,top:0,width:t,height:Qp},children:$o(e)},e)),l&&o.push((0,X.jsx)(`div`,{"data-grip-col":e,className:`de-grip-c`,style:{left:M.pos(e+1)-r-3,height:Qp}},`g`+e)))}return(0,X.jsx)(`div`,{className:`de-region`,style:{left:i,top:0,width:a,height:Qp},children:o},e)}function Re(e,t,n,r,i,a){if(a<=0)return null;let o=[];for(let e=t;e<=n;e++){let t=j.size(e);t&&(o.push((0,X.jsx)(`div`,{"data-row":e,className:e>=B.r0&&e<=B.r1?`de-head-r de-head-on`:`de-head-r`,style:{left:0,top:j.pos(e)-r,width:fe,height:t},children:e+1},e)),l&&o.push((0,X.jsx)(`div`,{"data-grip-row":e,className:`de-grip-r`,style:{top:j.pos(e+1)-r-3,width:fe}},`g`+e)))}return(0,X.jsx)(`div`,{className:`de-region`,style:{left:0,top:i,width:fe,height:a},children:o},e)}let ze=N.rows,Be=N.cols,Ve=Math.min(he,pe),He=Math.min(ge,me),Ue=(e,t)=>{let n=Ae(e,t);return{x:fe+M.pos(t)-(t>=Be?I:0),y:Qp+j.pos(e)-(e>=ze?F:0),w:n?M.pos(n.c1+1)-M.pos(n.c0):M.size(t),h:n?j.pos(n.r1+1)-j.pos(n.r0):j.size(e)}},We=(e,t)=>{let n=f.current;if(!n)return;let r=M.pos(t),i=j.pos(e);if(t>=Be&&(r-he<I?n.scrollLeft=r-he:r+M.size(t)>Se+we&&(n.scrollLeft=r+M.size(t)-he-we)),e>=ze&&be>0){let t=F;i-ge<F?t=i-ge:i+j.size(e)>Ce+Te&&(t=i+j.size(e)-ge-Te),t!==F&&(n.scrollTop=t/be*xe)}},Ge=(e,t,n)=>{let r=n.getBoundingClientRect(),i=e-r.left-fe,a=t-r.top-Qp,o=i<he?i:i+I,s=a<ge?a:a+F;return{r:a<0?-1:j.index(Math.max(0,s)),c:i<0?-1:M.index(Math.max(0,o))}},Ke=()=>f.current?.focus({preventScroll:!0}),qe=(n,r)=>e.row(t,n)?.find(e=>e[0]===r)?.[2]??0,H=async t=>{try{let r=await t;e.applied(r,n),r&&c.setDirty(!0),x(e=>e+1)}catch(e){console.error(`[office-engine]`,e)}},Je=(r,i,a)=>r?r.formula?r.formula:r.type===`number`&&/[dmyhs]/i.test((n.formats[qe(i,a)]??``).replace(/"[^"]*"|\[[^\]]*\]/g,``))?e.row(t,i)?.find(e=>e[0]===a)?.[1]??r.value:r.value:``,Ye=async(e,n=!1)=>{if(!l||!d.done||i)return;let{ar:o,ac:s}=h,c=(e,r,i)=>a({sheet:t,r:o,c:s,value:e,initial:r,bar:n,mode:i,caret:e.length,caretEnd:e.length,sync:+!n});if(e!==void 0)return c(e,`\0`,`enter`);let u=_&&_.r===o&&_.c===s?_.d:await r.call(`xlsx.cell`,t,o,s).catch(()=>void 0),f=Je(u,o,s);c(f,f,`edit`)},Xe=(0,u.useRef)(null),Ze=e=>{let n=i;if(!n||Xe.current===n)return;Xe.current=n,a(null);let o=So(n.value);if(o!==n.initial&&H(r.call(`xlsx.set`,n.sheet,[{r:n.r,c:n.c,input:o}])),n.sheet!==t)return $e(n,e);e&&vt(e[0],e[1],!1),Ke()},Qe=()=>{let e=i;if(a(null),e&&e.sheet!==t)return $e(e);Ke()},$e=(t,n)=>{let r=Math.max(0,t.r+(n?.[0]??0)),i=Math.max(0,t.c+(n?.[1]??0));e.sheet(t.sheet).sel={ar:r,ac:i,fr:r,fc:i},e.focusGrid=!0,s(t.sheet)},et=!!i&&i.sheet===t,tt=et&&!i?.bar,nt=i&&_o(i.value)?bo(i.value,i.caret):null,rt=!!i&&cm(i,nt),it=!!i?.point&&i.point.e===i.caret&&i.caret===i.caretEnd,at=[],ot=[];if(nt&&i){let e=new Map;for(let r of nt.refs){let a=um(r.text),o=e.get(a);o||e.set(a,o=lm[e.size%lm.length]),at.push({s:r.s,e:r.e,color:o});let s=r.ref.sheet;(s===void 0?i.sheet:n.sheets.findIndex(e=>e.name.toLowerCase()===s.toLowerCase()))===t&&ot.push({r0:r.ref.r0,c0:r.ref.c0,r1:r.ref.r1,c1:r.ref.c1,color:o,point:it&&r.s===i.point.s})}}let st=nt?.word&&i?.noSuggest!==nt.word.s&&i?.caret===i?.caretEnd?nt.word:void 0,ct=st?Do(st.text,8):[],lt=!ct.length&&nt?.call?Eo(nt.call.name):void 0,ut=st?`${st.s}:${st.text}`:``;(0,u.useEffect)(()=>D(0),[ut]);let dt=()=>tt?C.current:T.current;(0,u.useLayoutEffect)(()=>{if(!i)return;let e=dt();e&&(e.getRootNode().activeElement!==e&&e.focus({preventScroll:!0}),i.sync&&e.setSelectionRange(i.caret,i.caretEnd))},[i?.sync,tt,i!==null]);let ft=e=>{let t=e.selectionStart??e.value.length,n=e.selectionEnd??t;a(e=>e&&(e.caret!==t||e.caretEnd!==n)?{...e,caret:t,caretEnd:n}:e)},pt=e=>{let t=e.value,n=e.selectionStart??t.length,r=e.selectionEnd??n;a(e=>e&&{...e,value:t,caret:n,caretEnd:r,point:void 0})},mt=(e,r,i,o)=>{a(a=>{if(!a)return a;let s=xo(e,r,i,o,t===a.sheet?void 0:n.sheets[t]?.name),c=a.point&&a.point.e===a.caret&&a.caret===a.caretEnd,l=c?a.point.s:a.caret,u=c?a.point.e:a.caretEnd;if(c&&a.value.slice(l,u)===s)return a;let d=l+s.length;return{...a,value:a.value.slice(0,l)+s+a.value.slice(u),caret:d,caretEnd:d,sync:a.sync+1,point:{s:l,e:d,sheet:t,ar:e,ac:r,fr:i,fc:o}}})},ht=(0,u.useRef)(null),gt=(e,n,r)=>{let a=i?.point&&it&&i.point.sheet===t?i.point:null,o=a?a.ar:et?i.r:h.ar,s=a?a.ac:et?i.c:h.ac,c=e=>Math.max(0,Math.min(j.count-1,e)),l=e=>Math.max(0,Math.min(M.count-1,e));if(r){let t=c((a?a.fr:o)+e),r=l((a?a.fc:s)+n);mt(o,s,t,r),We(t,r)}else{let t=c(o+e),r=l(s+n);mt(t,r,t,r),We(t,r)}},_t=e=>{let t=st;t&&a(n=>{if(!n)return n;let r=!e.args.length&&!e.variadic,i=e.name+(t.call?``:r?`()`:`(`),a=t.s+e.name.length+(r&&!t.call?2:1);return{...n,value:n.value.slice(0,t.s)+i+n.value.slice(t.e),caret:a,caretEnd:a,sync:n.sync+1,point:void 0}})},vt=(e,t,n)=>{let r=n?h.fr:h.ar,i=n?h.fc:h.ac,a=n?void 0:Ae(h.ar,h.ac),o=r+e,s=i+t;for(a&&e>0&&(o=a.r1+e),a&&t>0&&(s=a.c1+t),o=Math.max(0,Math.min(j.count-1,o)),s=Math.max(0,Math.min(M.count-1,s));o>0&&j.size(o)===0&&e<0;)o--;for(;j.size(o)===0&&o<j.count-1;)o++;for(;s>0&&M.size(s)===0&&t<0;)s--;for(;M.size(s)===0&&s<M.count-1;)s++;n?g({...h,fr:o,fc:s}):Fe({ar:o,ac:s,fr:o,fc:s}),We(o,s)},yt=()=>{let n=[],i={...B,r1:Math.min(B.r1,B.r0+5e3),c1:Math.min(B.c1,B.c0+200)};for(let r=i.r0;r<=i.r1;r++){let a=e.row(t,r);for(let e=i.c0;e<=i.c1;e++)a?.some(t=>t[0]===e&&t[1]!==``)&&n.push({r,c:e,input:``})}n.length&&H(r.call(`xlsx.set`,t,n))},bt=R[qe(h.ar,h.ac)]??{},xt=e=>St(B,e),St=(e,n)=>{H(r.call(`xlsx.format`,t,e,n)),Ke()},Ct=e=>{let t=e===`b`?bt.fontWeight===700:e===`i`?bt.fontStyle===`italic`:String(bt.textDecoration??``).includes(e===`u`?`underline`:`line-through`);xt({[e]:!t})},wt=()=>void H(r.call(`xlsx.undo`)),Tt=()=>void H(r.call(`xlsx.redo`)),Et=()=>{let n=[],r={...B,r1:Math.min(B.r1,B.r0+2e4)};for(let i=r.r0;i<=r.r1;i++){let a=e.row(t,i),o=[];for(let e=r.c0;e<=r.c1;e++)o.push(a?.find(t=>t[0]===e)?.[1]??``);n.push(o.join(` `))}return n.join(`
|
|
82
|
-
`)},Dt=e=>{if(i)return;let t=e.metaKey||e.ctrlKey,n=e.key.toLowerCase();if(t&&n===`s`){e.preventDefault(),c.save();return}if(l&&t&&!e.altKey){if(n===`z`){e.preventDefault(),e.shiftKey?Tt():wt();return}if(n===`y`){e.preventDefault(),Tt();return}if(n===`b`||n===`i`||n===`u`){e.preventDefault(),Ct(n);return}if(n===`d`||n===`r`){e.preventDefault(),At({op:`fill`,range:B,dir:n===`d`?`down`:`right`});return}if(n===`\\`){e.preventDefault(),xt({clear:!0});return}if(n===`x`&&e.shiftKey){e.preventDefault(),Ct(`strike`);return}}if(t&&(n===`f`||n===`h`)){e.preventDefault(),ae(e=>({...e,open:!0,replace:n===`h`||e.replace,tick:e.tick+1}));return}if(e.key===`Escape`&&te!==null){ne(null);return}let r=Math.max(1,Math.floor(Te/j.def)-1),a={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1],PageDown:[r,0],PageUp:[-r,0]};if(a[e.key]){e.preventDefault();let[n,r]=a[e.key];t?vt(n?n>0?Math.max(0,d.rows-1-(e.shiftKey?h.fr:h.ar)):-1e9:0,r?r>0?Math.max(0,d.cols-1-(e.shiftKey?h.fc:h.ac)):-1e9:0,e.shiftKey):vt(n,r,e.shiftKey)}else e.key===`Enter`||e.key===`Tab`?(e.preventDefault(),e.key===`Enter`?vt(e.shiftKey?-1:1,0,!1):vt(0,e.shiftKey?-1:1,!1)):l&&(e.key===`F2`?(e.preventDefault(),Ye()):e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),yt()):e.key.length===1&&!t&&!e.altKey&&(e.preventDefault(),Ye(e.key)))},Ot=e=>{if(e.button!==0)return;let n=e.target.closest(`[data-grip-col],[data-grip-row]`);if(n){e.preventDefault();let t=n.dataset.gripCol,r=Number(t??n.dataset.gripRow);de(t===void 0?{axis:`row`,i:r,start:e.clientY,size:j.size(r)}:{axis:`col`,i:r,start:e.clientX,size:M.size(r)});return}let r=e.currentTarget,{r:a,c:o}=Ge(e.clientX,e.clientY,r);if(i&&rt){if(e.preventDefault(),a<0&&o<0)return;let n=a<0?`col`:o<0?`row`:`cell`,[r,s]=[Math.max(a,0),Math.max(o,0)],c=n===`cell`?Ae(a,o):void 0;c&&([r,s]=[c.r0,c.c0]);let l=e.shiftKey&&it&&i.point.sheet===t?i.point:null;l&&([r,s]=[l.ar,l.ac]),ht.current={ar:r,ac:s,axis:n},kt(r,s,a,o,n)}else{if(i&&Ze(),e.preventDefault(),te!==null&&a>=0&&o>=0){let e=te;re.current=()=>{ne(null),St(je.current,{xf:e})}}Ke(),a<0&&o<0?Fe({ar:0,ac:0,fr:Math.max(0,d.rows-1),fc:Math.max(0,d.cols-1)}):(a<0?Fe({ar:0,ac:o,fr:Math.max(0,d.rows-1),fc:o}):o<0?Fe({ar:a,ac:0,fr:a,fc:Math.max(0,d.cols-1)}):e.shiftKey?g({...h,fr:a,fc:o}):Fe({ar:a,ac:o,fr:a,fc:o}),a>=0&&o>=0&&(S.current=!0))}},kt=(e,t,n,r,i)=>{if(i===`col`)mt(0,t,vr,Math.max(0,r));else if(i===`row`)mt(e,0,Math.max(0,n),yr);else{let i=Ae(n,r),a=i&&!(e>=i.r0&&e<=i.r1&&t>=i.c0&&t<=i.c1)?i:void 0,o=a?a.r0<e?a.r0:a.r1:Math.max(0,n),s=a?a.c0<t?a.c0:a.c1:Math.max(0,r);mt(e,t,o,s)}};(0,u.useEffect)(()=>{let e=()=>{S.current=!1,ht.current=null;let e=re.current;re.current=null,e&&setTimeout(e,0)};return window.addEventListener(`mouseup`,e),()=>window.removeEventListener(`mouseup`,e)},[]),(0,u.useEffect)(()=>{if(!ue)return;let e=ue.axis===`col`?M:j,t=t=>{let n=(ue.axis===`col`?t.clientX:t.clientY)-ue.start;e.set(ue.i,Math.max(ue.axis===`col`?8:6,Math.round(ue.size+n))),x(e=>e+1)},n=()=>{let t=e.size(ue.i);de(null);let[n,r]=(ue.axis===`col`?B.r0===0&&B.r1>=d.rows-1&&ue.i>=B.c0&&ue.i<=B.c1:B.c0===0&&B.c1>=d.cols-1&&ue.i>=B.r0&&ue.i<=B.r1)?ue.axis===`col`?[B.c0,B.c1]:[B.r0,B.r1]:[ue.i,ue.i];At(ue.axis===`col`?{op:`colWidth`,c0:n,c1:r,px:t}:{op:`rowHeight`,r0:n,r1:r,px:t})};return window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n,{once:!0}),()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)}});let At=e=>H(r.call(`xlsx.sheetOp`,t,e)),jt=d.merges.some(e=>e.r0>=B.r0&&e.r1<=B.r1&&e.c0>=B.c0&&e.c1<=B.c1),Mt=()=>void At({op:jt?`unmerge`:`merge`,range:B}),Nt=e=>void At(e===`unmerge`?{op:`unmerge`,range:B}:{op:`merge`,range:B,mode:e}),Pt=e=>void At({op:`freeze`,rows:e===`row`?1:e===`sel`?h.ar:0,cols:e===`col`?1:e===`sel`?h.ac:0}),Ft=(n=`SUM`)=>{let{ar:i,ac:a}=h;if(!V){let e=`${$o(B.c0)}${B.r0+1}:${$o(B.c1)}${B.r1+1}`;H(r.call(`xlsx.set`,t,[{r:B.r1+1,c:B.c0,input:`=${n}(${e})`}]));return}let o=(n,r)=>e.row(t,n)?.find(e=>e[0]===r)?.[3]===1,s=i-1;for(;s>=0&&o(s,a);)s--;let c=``;if(s<i-1)c=`${$o(a)}${s+2}:${$o(a)}${i}`;else{let e=a-1;for(;e>=0&&o(i,e);)e--;e<a-1&&(c=`${$o(e+1)}${i+1}:${$o(a-1)}${i+1}`)}if(!c)return void Ye(`=${n}(`);H(r.call(`xlsx.set`,t,[{r:i,c:a,input:`=${n}(${c})`}]))},It=e=>{let t=B.r0===B.r1?{r0:N.rows,c0:0,r1:Math.max(N.rows,d.rows-1),c1:Math.max(0,d.cols-1)}:B;At({op:`sort`,range:t,col:h.ac,desc:e})},Lt=e=>{let t=B.r1-B.r0+1,n=B.c1-B.c0+1,r={rowAbove:{op:`insertRows`,at:B.r0,n:t},rowBelow:{op:`insertRows`,at:B.r1+1,n:t},colLeft:{op:`insertCols`,at:B.c0,n},colRight:{op:`insertCols`,at:B.c1+1,n},delRow:{op:`deleteRows`,at:B.r0,n:t},delCol:{op:`deleteCols`,at:B.c0,n},hideRows:{op:`hideRows`,a:B.r0,b:B.r1,hidden:!0},hideCols:{op:`hideCols`,a:B.c0,b:B.c1,hidden:!0},unhideRows:{op:`hideRows`,a:Math.max(0,B.r0-+(t===1)),b:B.r1+ +(t===1),hidden:!1},unhideCols:{op:`hideCols`,a:Math.max(0,B.c0-+(n===1)),b:B.c1+ +(n===1),hidden:!1}};r[e]&&At(r[e])},Rt=e=>{let n=e.replace(/\r\n?/g,`
|
|
77
|
+
`,_f=e=>`${pf}\n${gf}\n@page { size: ${e.size}; margin: ${e.margin}; }\n`,vf=e=>new Promise(t=>setTimeout(t,e));async function yf(e,t){await vf(0),await new Promise(e=>{let n,r=setTimeout(a,8e3),i=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(a,250)});function a(){i.disconnect(),clearTimeout(n),clearTimeout(r),e()}i.observe(t,{subtree:!0,childList:!0,attributes:!0}),n=setTimeout(a,250)});let n=new Set;for(let e of t.querySelectorAll(`[style*="url("]`))for(let t of e.style.backgroundImage.matchAll(/url\(["']?([^"')]+)["']?\)/g))n.add(t[1]);let r=[...t.querySelectorAll(`img`)].map(e=>e.complete?null:new Promise(t=>(e.onload=t,e.onerror=t)));for(let e of n)r.push(new Promise(t=>{let n=new Image;n.onload=n.onerror=t,n.src=e}));await Promise.race([Promise.all(r),vf(1e4)]),await Promise.race([e.fonts?.ready,vf(3e3)])}var bf=/[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/;function xf(e,t,n){for(;e<t;){let r=e+t>>1;n(r)?t=r:e=r+1}return e}function Sf(e){let t=e.ownerDocument.defaultView,n=e.ownerDocument.createRange(),r=(e,t)=>(n.setStart(e,t),n.setEnd(e,t+1),n.getBoundingClientRect()),i=[],a=[];for(let o of e.querySelectorAll(`[data-de-fit]`)){let e=o.firstChild;if(e?.nodeType!==Node.TEXT_NODE||e.nextSibling)continue;let s=e,c=s.data;n.selectNodeContents(s);let l=n.getBoundingClientRect(),u=o.getBoundingClientRect(),d=u.left+o.clientLeft-.5,f=u.left+o.clientLeft+o.clientWidth+.5;if(l.left>=d&&l.right<=f)continue;let p=t.getComputedStyle(o);if(o.dataset.deFit===`#`){let e=o.clientWidth-parseFloat(p.paddingLeft)-parseFloat(p.paddingRight);i.push([s,`#`.repeat(Math.max(1,Math.floor(e/(l.width/c.length))))])}else if(bf.test(c)||p.whiteSpace!==`pre`&&p.whiteSpace!==`nowrap`)a.push(o);else{let e=[],t=0;for(let n of c.split(`
|
|
78
|
+
`)){let i=t+n.length,a=xf(t,i,e=>r(s,e).left>=d),o=xf(a,i,e=>r(s,e).right>f);/[\udc00-\udfff]/.test(c[a]??``)&&a++,/[\ud800-\udbff]/.test(c[o-1]??``)&&o--,e.push(c.slice(a,Math.max(a,o))),t=i+1}i.push([s,e.join(`
|
|
79
|
+
`)])}}for(let[e,t]of i)e.data=t;for(let e of a)e.style.overflow=`hidden`}async function Cf(e,t){let n=document.createElement(`iframe`);n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,n.style.cssText=`position:fixed;left:-20000px;top:0;width:1100px;height:800px;border:0;visibility:hidden`,document.body.appendChild(n);let r=n.contentDocument;r.open(),r.write(`<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>`),r.close(),r.title=t;let i=r.createElement(`style`);i.textContent=_f(e),r.head.appendChild(i);let a=r.createElement(`div`);a.className=`de-print`,r.body.appendChild(a);let o=(0,d.createRoot)(a);o.render(e.node);let s=!1,c=()=>{s||(s=!0,o.unmount(),n.remove())};try{await yf(r,a),Sf(a)}catch(e){throw c(),e}return{frame:n,doc:r,host:a,dispose:c}}var wf=null;async function Tf(e,t){wf?.dispose();let n=await Cf(e,t);wf=n;let r=n.frame.contentWindow,i=()=>{wf===n&&(wf=null),setTimeout(()=>n.dispose(),1e3)};r.addEventListener(`afterprint`,i,{once:!0}),setTimeout(i,6e5);let a=document.title;document.title=t;try{r.focus();let e=!1;try{e=r.document.execCommand(`print`,!1)}catch{e=!1}e||r.print()}finally{document.title=a}}var Ef=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);function Df(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}async function Of(e,t){let n=await Cf(e,t);try{let r=n.host.outerHTML.replace(/ contenteditable="(?:true|false)"| data-de-fit="#?"/g,``),i=new Set(r.match(/blob:[^"'()\s&]+/g)??[]);for(let e of i)try{let t=await Df(await(await fetch(e)).blob());r=r.split(e).join(t)}catch{}let a=`<!doctype html>\n<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${Ef(t)}</title><style>${_f(e)}</style></head><body>${r}</body></html>\n`;return new Blob([a],{type:`text/html;charset=utf-8`})}finally{n.dispose()}}var kf={docx:`Word document`,xlsx:`Excel workbook`,pptx:`PowerPoint presentation`},Af={docx:`.docx`,xlsx:`.xlsx`,pptx:`.pptx`},jf={docx:[{id:`txt`,label:`Plain text`,ext:`.txt`,mime:`text/plain`},{id:`md`,label:`Markdown`,ext:`.md`,mime:`text/markdown`}],xlsx:[{id:`csv`,label:`CSV (current sheet)`,ext:`.csv`,mime:`text/csv`},{id:`tsv`,label:`TSV (current sheet)`,ext:`.tsv`,mime:`text/tab-separated-values`}],pptx:[{id:`txt`,label:`Plain text`,ext:`.txt`,mime:`text/plain`}]},Mf=/^(new:|open$|import$|rename$|details$|close$|extra:)/;function Nf(e){let[t,n]=(0,u.useState)(!1),r=(0,u.useRef)(!1),i=(0,u.useRef)(e);i.current=e;let a=e.kind,o=[],s=e=>{e.length&&(e[0]={...e[0],sep:o.length>0},o.push(...e))};s(e.canOpen?[{value:`new:docx`,label:`Document`,icon:`doc`,head:`New`},{value:`new:xlsx`,label:`Spreadsheet`,icon:`table`},{value:`new:pptx`,label:`Presentation`,icon:`slides`},{value:`open`,label:`Open…`,icon:`open`,hint:`${Q}O`,sep:!0}]:[]),e.canImport&&a===`xlsx`&&o.push({value:`import`,label:`Import CSV into new sheet…`,icon:`table`,sep:!e.canOpen&&o.length>0});let c=[];a&&e.canSave&&c.push({value:`save`,label:`Save`,icon:`save`,hint:`${Q}S`}),a&&e.rename&&c.push({value:`rename`,label:`Rename…`,icon:`edit`}),s(c),e.canDownload&&a&&s([{value:`original`,label:kf[a],icon:`save`,hint:Af[a],head:`Download as`},{value:`pdf`,label:`PDF document`,icon:`pdf`,hint:`.pdf`},{value:`html`,label:`Web page`,icon:`html`,hint:`.html`},...jf[a].map(e=>({value:`text:`+e.id,label:e.label,icon:`doc`,hint:e.ext}))]);let l=[];a&&e.details&&l.push({value:`details`,label:`Document details`,icon:`info`}),a&&e.canDownload&&l.push({value:`print`,label:`Print`,icon:`print`,hint:`${Q}P`}),s(l),s(e.extra.map((e,t)=>({value:`extra:${t}`,label:e.label,icon:e.icon,hint:e.hint,disabled:e.disabled}))),e.close&&s([{value:`close`,label:`Close`,icon:`close`}]);let d=async e=>{let t=i.current;if(e.startsWith(`new:`))return t.create(e.slice(4));if(e.startsWith(`extra:`))return t.extra[Number(e.slice(6))]?.onClick();switch(e){case`open`:{let[e]=await Dl(uf,!1);e&&t.open(e);return}case`rename`:return t.rename?.();case`details`:return t.details?.();case`close`:return t.close?.();case`save`:return t.save()}let n=t.ops.current;if(e===`import`){let[e]=await Dl(`.csv,.tsv,.tab,.txt`,!1);if(!e)return;if(!n?.importTable)throw Error(`The document is still loading — try again in a moment`);let t=await e.text(),r=/\.(tsv|tab)$/i.test(e.name)?` `:Fd(t);await n.importTable(Id(t,r),e.name.replace(/\.[^.]+$/,``).slice(0,31)||`Imported`)}else if(t.kind&&t.canDownload){if(e===`original`)return t.downloadOriginal();if(!n)throw Error(`The document is still loading — try again in a moment`);if(e.startsWith(`text:`)){let r=jf[t.kind].find(t=>`text:`+t.id===e);if(!r)return;Cl(new Blob([await n.text(r.id)],{type:`${r.mime};charset=utf-8`}),t.base+r.ext)}else if(e===`pdf`||e===`print`||e===`html`){t.notify(e===`pdf`?`Preparing PDF… choose “Save as PDF” in the print dialog`:`Preparing…`);let r=await n.printable();r.notice&&t.notify(r.notice),e===`html`?Cl(await Of(r,t.base),t.base+`.html`):await Tf(r,t.base)}}};return{options:o,busy:t,run:e=>{let t=Mf.test(e);(!r.current||t)&&(t||(r.current=!0,n(!0)),Promise.resolve().then(()=>d(e)).catch(e=>i.current.notify(e.message||String(e))).finally(()=>{t||(r.current=!1,n(!1))}))}}}function Pf({actions:e}){return e.options.length?(0,X.jsx)(rl,{title:`File`,label:`File`,className:`de-file`,options:e.options,onChange:e.run,menuWidth:280,disabled:e.busy}):null}var Ff=e=>({sz:e.sz,b:e.b,i:e.i,u:e.u,strike:e.strike,color:e.color,font:e.font,baseline:e.baseline,caps:e.caps,hl:e.hl});function If(e){return{runs:ql(e.runs.map(e=>e.fld?{t:`fld`,text:e.text,s:Ff(e),src:e.src}:{t:`text`,text:e.br?`
|
|
80
|
+
`:e.text,s:Ff(e),src:e.src})),base:e,algn:e.algn,k:e.k}}var Lf=e=>e.pp?.bullet??e.base.buKind??`none`,Rf=e=>e.pp?.lvl??e.base.lvl??0;function zf(e,t=0){let n=Lf(e),r=Rf(e),i=e.runs.find(e=>e.t===`text`)?.s?.sz??e.base.endSz,a=e.pp?.bullet?n===`none`?void 0:{text:n===`bullet`?`•`:`${t}.`,sz:i,color:e.base.bullet?.color}:e.base.bullet,o=(r-(e.base.lvl??0))*48,s=e.pp?.bullet&&n!==`none`&&!e.base.bullet?27:0;return{...e.base,bullet:a,marL:Math.max(0,e.base.marL+o+s),indent:s?-s:e.base.indent,lnPct:e.pp?.lnPct??e.base.lnPct,algn:e.algn,runs:e.runs.map(e=>e.t===`fld`?{...e.s,text:e.text??``,fld:!0}:{...e.s,text:e.text??``})}}var Bf=class{constructor(e){A(this,`client`,void 0),A(this,`input`,void 0),A(this,`paras`,[]),A(this,`body`,void 0),A(this,`slide`,-1),A(this,`sid`,-1),A(this,`pendingSel`,null),A(this,`history`,[]),A(this,`future`,[]),A(this,`pend`,null),A(this,`timer`,void 0),A(this,`changedSinceCommit`,!1),A(this,`onChange`,void 0),A(this,`onCommitted`,void 0),A(this,`onDirty`,void 0),A(this,`onState`,void 0),A(this,`shortcut`,void 0),this.client=e,this.input=new vu(this)}get active(){return this.sid>=0}begin(e,t,n){this.end(),this.slide=e,this.sid=t,this.body=n,this.paras=(n.paras.length?n.paras:[{algn:`left`,marL:0,indent:0,spcBef:0,spcAft:0,runs:[],endSz:18}]).map(If),this.history=[],this.future=[],this.pend=null}end(){this.sid>=0&&this.changedSinceCommit&&this.commit(),this.input.detach(),this.sid=-1,this.slide=-1,this.body=void 0,this.onState?.(null)}text(){if(!this.body)return;let e=[],t=this.paras.map(t=>{let n=Rf(t);return Lf(t)===`number`?e[n]=(e[n]??0)+1:e[n]=0,e.length=n+1,zf(t,e[n])});return{...this.body,empty:!1,paras:t}}para(e){return this.paras[Number(e)]}span(e,t){let n=[];for(let r=Number(e);r<=Number(t);r++)n.push(String(r));return n}prev(e){return Number(e)>0?String(Number(e)-1):void 0}next(e){return Number(e)<this.paras.length-1?String(Number(e)+1):void 0}cmp(e,t){return Number(e)-Number(t)}withRuns(e,t){return{...e,runs:t}}split(e,t,n){return[{...e,runs:t},{...e,runs:n,caret:n.length?void 0:Yl(t,Vl(t))??e.caret}]}join(e,t,n){return{...e,runs:n}}defaultRun(e){if(e.caret)return{...e.caret,text:``};let t=[...e.runs].reverse().find(e=>e.t===`text`);return t?{...t,text:``}:{t:`text`,s:{sz:e.base.endSz}}}pendingStyle(){return this.pend?{s:this.pend.s,d:this.pend.d}:void 0}clearPending(){this.pend=null}replace(e,t,n,r={}){let i=this.paras,a=Number(e[0]);if(this.paras=[...i.slice(0,a),...t,...i.slice(a+e.length)],r.history!==!1){let e=Date.now(),t=this.history[this.history.length-1],a=r.label??`edit`;a===`type`&&t?.label===`type`&&e-t.t<1500?(t.after=this.paras,t.selAfter=n,t.t=e):this.history.push({before:i,after:this.paras,selBefore:this.input.lastSel??n,selAfter:n,label:a,t:e}),this.future=[]}this.pendingSel=n,this.changedSinceCommit=!0,this.onDirty?.(),clearTimeout(this.timer),this.timer=setTimeout(()=>this.commit(),400),this.onChange?.(),this.onState?.(this.state(n))}undo(){let e=this.history.pop();e&&(this.future.push(e),this.restore(e.before,e.selBefore))}redo(){let e=this.future.pop();e&&(this.history.push(e),this.restore(e.after,e.selAfter))}restore(e,t){this.paras=e,this.pendingSel=t,this.changedSinceCommit=!0,clearTimeout(this.timer),this.timer=setTimeout(()=>this.commit(),400),this.onChange?.(),this.onState?.(this.state(t))}commit(){if(clearTimeout(this.timer),this.sid<0||!this.changedSinceCommit)return;this.changedSinceCommit=!1;let e=this.slide,t=this.paras.map(e=>({k:e.k,algn:e.algnSet?e.algn:void 0,...e.pp,runs:e.runs.map(e=>e.t===`fld`?{text:``,src:e.src,fld:!0}:{text:e.text??``,src:e.src,set:e.d})}));this.client.call(`pptx.setText`,e,this.sid,t).then(t=>this.onCommitted?.(e,t)).catch(e=>console.error(`[office-engine] slide edit failed`,e))}format(e,t){let n=this.input.sel();if(!n)return;if(Hl(n)){this.pend={s:{...this.pend?.s??{},...e},d:{...this.pend?.d??{},...t},at:n.a},this.input.restore(n),this.onState?.(this.state(n));return}let[r,i]=tu(this,n),a=this.span(r.pa,i.pa),o=a.map((n,o)=>{let s=this.para(n),c=o===0?r.o:0,l=o===a.length-1?i.o:Vl(s.runs);return this.withRuns(s,Ql(s.runs,c,l,e,t))});this.replace(a,o,n,{label:`format`})}toggle(e){let t=this.state(),n=!(t&&t[e]);this.format({[e]:n},{[e]:n})}setSize(e){this.format({sz:e},{sz:e})}setColor(e){this.format({color:e??void 0},{color:e})}setFont(e){this.format({font:$e(e)},{font:e})}setAlign(e){let t=this.input.sel();if(!t)return;let[n,r]=tu(this,t),i=this.span(n.pa,r.pa);this.replace(i,i.map(t=>({...this.para(t),algn:e,algnSet:!0})),t,{label:`align`})}paraOp(e,t){let n=this.input.sel();if(!n)return;let[r,i]=tu(this,n),a=this.span(r.pa,i.pa);this.replace(a,a.map(t=>e(this.para(t))),n,{label:t})}toggleBullet(e){let t=this.state()?.bullet===e?`none`:e;this.paraOp(e=>({...e,pp:{...e.pp,bullet:t}}),`bullet`)}indentLevel(e){this.paraOp(t=>({...t,pp:{...t.pp,lvl:Math.max(0,Math.min(8,Rf(t)+e))}}),`indent`)}setLineSpacing(e){this.paraOp(t=>({...t,pp:{...t.pp,lnPct:e}}),`spacing`)}setHighlight(e){this.format({hl:e??void 0},{hl:e})}toggleBaseline(e){let t=this.state()?.baseline??0,n=e===`sup`?t>0?0:30:t<0?0:-25;this.format({baseline:n||void 0},{baseline:n||null})}clearFormat(){this.format({b:!1,i:!1,u:!1,strike:!1,hl:void 0,baseline:void 0},{b:!1,i:!1,u:!1,strike:!1,hl:null,baseline:null})}state(e=this.input.sel()){if(!e||this.sid<0)return null;let[t]=tu(this,e),n=this.para(t.pa);if(!n)return null;let r={...Yl(n.runs,Hl(e)?t.o:t.o+1)?.s??{},...Hl(e)?this.pend?.s??{}:{}};return{b:!!r.b,i:!!r.i,u:!!r.u,strike:!!r.strike,sz:r.sz,color:r.color,font:r.font,algn:n.algn,hl:r.hl,baseline:r.baseline,bullet:Lf(n),lvl:Rf(n),lnPct:n.pp?.lnPct??n.base.lnPct}}onSelection(e){e&&this.pend&&(e.a.pa!==this.pend.at.pa||e.a.o!==this.pend.at.o)&&(this.pend=null),this.onState?.(e?this.state(e):null)}},Vf=[`#ffff00`,`#00ff00`,`#00ffff`,`#ff00ff`,`#ff0000`,`#0000ff`,`#ffc000`,`#92d050`,`#c0c0c0`,`#000000`],Hf=[{value:`text`,label:`Text box`,icon:`textbox`},{value:`image`,label:`Image…`,icon:`image`},{value:`line`,label:`Line`,icon:`line`},{value:`rect`,label:`Rectangle`,icon:`rect`,sep:!0},{value:`roundRect`,label:`Rounded rectangle`,icon:`roundRect`},{value:`ellipse`,label:`Ellipse`,icon:`ellipse`},{value:`triangle`,label:`Triangle`,icon:`triangle`},{value:`rtTriangle`,label:`Right triangle`},{value:`diamond`,label:`Diamond`},{value:`parallelogram`,label:`Parallelogram`},{value:`trapezoid`,label:`Trapezoid`},{value:`pentagon`,label:`Pentagon`},{value:`hexagon`,label:`Hexagon`},{value:`octagon`,label:`Octagon`},{value:`donut`,label:`Donut`},{value:`can`,label:`Cylinder`},{value:`heart`,label:`Heart`},{value:`plus`,label:`Plus`},{value:`rightArrow`,label:`Arrow right`,icon:`arrow`,sep:!0},{value:`leftArrow`,label:`Arrow left`},{value:`upArrow`,label:`Arrow up`},{value:`downArrow`,label:`Arrow down`},{value:`leftRightArrow`,label:`Double arrow`},{value:`chevron`,label:`Chevron`},{value:`homePlate`,label:`Pentagon arrow`},{value:`star4`,label:`4-point star`,sep:!0},{value:`star5`,label:`5-point star`,icon:`star`},{value:`star6`,label:`6-point star`},{value:`wedgeRectCallout`,label:`Callout`,sep:!0},{value:`wedgeRoundRectCallout`,label:`Rounded callout`}],Uf=[.75,1,1.5,2.25,3,4.5,6].map(e=>({value:e,label:`${e} pt`})),Wf=[{value:`solid`,label:`Solid`,hint:`────`},{value:`sysDot`,label:`Dotted`,hint:`········`},{value:`dash`,label:`Dashed`,hint:`- - - -`},{value:`lgDash`,label:`Long dash`,hint:`— — —`},{value:`dashDot`,label:`Dash dot`,hint:`-·-·-·`}],Gf=[1,1.15,1.5,2].map(e=>({value:e,label:e===1?`Single`:e===2?`Double`:String(e)})),Kf=[{value:`t`,label:`Top`,icon:`vTop`},{value:`ctr`,label:`Middle`,icon:`vMiddle`},{value:`b`,label:`Bottom`,icon:`vBottom`}];function qf(e){let{editor:t}=e,[n,r]=(0,u.useState)(null);(0,u.useEffect)(()=>(t.onState=r,()=>{t.onState=void 0}),[t]);let i=!!n&&t.active,a=Sl(n?.font),o=n?.sz?Math.round(n.sz*2)/2:void 0,s=i?e.textAnchor:e.shape?.anchor;return(0,X.jsxs)(jl,{children:[(0,X.jsx)(Z,{icon:`undo`,title:`Undo (${Q}Z)`,disabled:!i&&!e.canUndo,onClick:()=>i?t.undo():e.onUndo(!1)}),(0,X.jsx)(Z,{icon:`redo`,title:`Redo (${Q}Y)`,onClick:()=>i?t.redo():e.onUndo(!0)}),(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Insert`,label:`Insert`,icon:`plus`,items:Hf,onPick:t=>e.onInsert(t)}),(0,X.jsx)(wl,{title:`Slide`,label:`Slide`,icon:`slideAdd`,items:[{value:`add`,label:`New slide`,icon:`slideAdd`,hint:`${Q}M`},{value:`duplicate`,label:`Duplicate slide`,icon:`copy`},{value:`delete`,label:`Delete slide`,icon:`trash`},{value:`up`,label:`Move slide up`,icon:`up`,sep:!0},{value:`down`,label:`Move slide down`,icon:`down`},{value:`hide`,label:`Hide / show slide`,icon:`hide`,sep:!0}],onPick:t=>e.onSlide(t)}),(0,X.jsx)(nl,{}),i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(il,{title:`Font`,width:112,menuWidth:200,value:a,placeholder:`Font`,options:xl(a),onChange:e=>t.setFont(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(al,{value:o,onChange:e=>t.setSize(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bold`,title:`Bold (${Q}B)`,active:n?.b,onClick:()=>t.toggle(`b`)}),(0,X.jsx)(Z,{icon:`italic`,title:`Italic (${Q}I)`,active:n?.i,onClick:()=>t.toggle(`i`)}),(0,X.jsx)(Z,{icon:`underline`,title:`Underline (${Q}U)`,active:n?.u,onClick:()=>t.toggle(`u`)}),(0,X.jsx)(Z,{icon:`strike`,title:`Strikethrough`,active:n?.strike,onClick:()=>t.toggle(`strike`)}),(0,X.jsx)(vl,{icon:`color`,title:`Text color`,value:n?.color,onPick:e=>t.setColor(e),noneLabel:`Automatic`}),(0,X.jsx)(vl,{icon:`highlight`,title:`Highlight color`,value:n?.hl,palette:Vf,onPick:e=>t.setHighlight(e)}),(0,X.jsx)(Z,{icon:`sup`,title:`Superscript`,active:(n?.baseline??0)>0,onClick:()=>t.toggleBaseline(`sup`)}),(0,X.jsx)(Z,{icon:`sub`,title:`Subscript`,active:(n?.baseline??0)<0,onClick:()=>t.toggleBaseline(`sub`)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`alignLeft`,title:`Align left`,active:n?.algn===`left`,onClick:()=>t.setAlign(`left`)}),(0,X.jsx)(Z,{icon:`alignCenter`,title:`Center`,active:n?.algn===`center`,onClick:()=>t.setAlign(`center`)}),(0,X.jsx)(Z,{icon:`alignRight`,title:`Align right`,active:n?.algn===`right`,onClick:()=>t.setAlign(`right`)}),(0,X.jsx)(Z,{icon:`justify`,title:`Justify`,active:n?.algn===`justify`,onClick:()=>t.setAlign(`justify`)}),(0,X.jsx)(rl,{title:`Vertical align`,icon:Kf.find(e=>e.value===s)?.icon??`vTop`,label:null,menuWidth:140,value:s??`t`,options:Kf.map(e=>({...e})),onChange:e.onAnchor}),(0,X.jsx)(rl,{title:`Line spacing`,icon:`lineSpacing`,label:null,menuWidth:140,value:n?.lnPct?Math.round(n.lnPct*100)/100:``,options:Gf,onChange:e=>t.setLineSpacing(e)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bullets`,title:`Bulleted list`,active:n?.bullet===`bullet`,onClick:()=>t.toggleBullet(`bullet`)}),(0,X.jsx)(Z,{icon:`numbers`,title:`Numbered list`,active:n?.bullet===`number`,onClick:()=>t.toggleBullet(`number`)}),(0,X.jsx)(Z,{icon:`outdent`,title:`Decrease indent (Shift+Tab)`,disabled:!n?.lvl,onClick:()=>t.indentLevel(-1)}),(0,X.jsx)(Z,{icon:`indent`,title:`Increase indent`,onClick:()=>t.indentLevel(1)}),(0,X.jsx)(Z,{icon:`clear`,title:`Clear formatting`,onClick:()=>t.clearFormat()})]}):e.shape?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(vl,{icon:`fill`,title:`Fill color`,onPick:e.onFill,noneLabel:`Transparent`}),(0,X.jsx)(vl,{icon:`borders`,title:`Border color`,onPick:t=>e.onLine({color:t}),noneLabel:`Transparent`}),(0,X.jsx)(rl,{title:`Border weight`,icon:`lineWeight`,label:null,menuWidth:120,options:Uf,onChange:t=>e.onLine({w:t})}),(0,X.jsx)(rl,{title:`Border dash`,icon:`lineStyle`,label:null,menuWidth:170,options:Wf,onChange:t=>e.onLine({dash:t})}),(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Arrange`,label:`Arrange`,icon:`front`,items:[{value:`front`,label:`Bring to front`,icon:`front`,hint:`${Q}⇧↑`},{value:`forward`,label:`Bring forward`,hint:`${Q}↑`},{value:`backward`,label:`Send backward`,hint:`${Q}↓`},{value:`back`,label:`Send to back`,icon:`back`,hint:`${Q}⇧↓`}],onPick:t=>e.onArrange(t)}),(0,X.jsx)(rl,{title:`Rotate`,icon:`rotate`,label:null,menuWidth:220,options:[{value:`cw`,label:`Rotate 90° clockwise`,icon:`rotate`},{value:`ccw`,label:`Rotate 90° counter-clockwise`,icon:`rotateCcw`},{value:`flipH`,label:`Flip horizontally`,icon:`flipH`,sep:!0},{value:`flipV`,label:`Flip vertically`,icon:`flipV`}],onChange:t=>e.onRotate(t)}),(0,X.jsx)(rl,{title:`Align on slide`,icon:`alignObj`,label:null,menuWidth:150,options:[{value:`left`,label:`Left`,icon:`alignLeft`},{value:`center`,label:`Center`,icon:`alignCenter`},{value:`right`,label:`Right`,icon:`alignRight`},{value:`top`,label:`Top`,icon:`vTop`,sep:!0},{value:`middle`,label:`Middle`,icon:`vMiddle`},{value:`bottom`,label:`Bottom`,icon:`vBottom`}],onChange:t=>e.onAlign(t)}),e.shape.canText&&(0,X.jsx)(rl,{title:`Vertical text align`,icon:Kf.find(e=>e.value===s)?.icon??`vTop`,label:null,menuWidth:140,value:s??`t`,options:Kf.map(e=>({...e})),onChange:e.onAnchor}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`copy`,title:`Duplicate (${Q}D)`,onClick:e.onDuplicate}),(0,X.jsx)(Z,{icon:`trash`,title:`Delete (Del)`,onClick:e.onDelete})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(vl,{icon:`fill`,title:`Slide background`,onPick:e.onBackground,noneLabel:`Layout default`}),(0,X.jsx)(`span`,{className:`de-tb-hint`,children:`Click a shape or text to edit it`})]}),(0,X.jsx)(nl,{}),(0,X.jsx)(rl,{title:`Present`,icon:`play`,label:`Present`,menuWidth:200,options:[{value:`cur`,label:`From current slide`,hint:`F5`},{value:`start`,label:`From beginning`,hint:`⇧F5`}],onChange:t=>e.onPresent(t===`start`)})]})}function Jf({client:e,meta:t,start:n,onClose:r}){let i=(0,u.useRef)(null),a=t.slides.filter(e=>!e.hidden).map(e=>e.index),o=a.length?a:t.slides.map(e=>e.index),[s,c]=(0,u.useState)(Math.max(0,o.findIndex(e=>e>=n))),[l,d]=(0,u.useState)({w:window.innerWidth,h:window.innerHeight});(0,u.useEffect)(()=>{let e=i.current;e?.focus(),e?.requestFullscreen?.().catch(()=>{});let t=()=>d({w:window.innerWidth,h:window.innerHeight}),n=()=>!document.fullscreenElement&&r();return window.addEventListener(`resize`,t),document.addEventListener(`fullscreenchange`,n),()=>{window.removeEventListener(`resize`,t),document.removeEventListener(`fullscreenchange`,n),document.fullscreenElement&&document.exitFullscreen().catch(()=>{})}},[r]);let f=e=>c(t=>Math.max(0,Math.min(o.length-1,t+e))),p=Math.min(l.w/t.w,l.h/t.h);return(0,X.jsxs)(`div`,{ref:i,className:`de-present`,tabIndex:-1,onClick:()=>f(1),onContextMenu:e=>{e.preventDefault(),f(-1)},onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`PageDown`,` `,`Enter`,`n`].includes(e.key))f(1);else if([`ArrowLeft`,`ArrowUp`,`PageUp`,`Backspace`,`p`].includes(e.key))f(-1);else if(e.key===`Home`)c(0);else if(e.key===`End`)c(o.length-1);else if(e.key===`Escape`)r();else return;e.preventDefault()},children:[(0,X.jsx)(`div`,{style:{width:t.w*p,height:t.h*p},children:(0,X.jsx)(bp,{client:e,index:o[s],meta:t,scale:p,live:!0},o[s])}),(0,X.jsxs)(`div`,{className:`de-present-n`,children:[s+1,` / `,o.length]})]})}var $=e=>+e.toFixed(2),Yf=e=>`M`+e.map(([e,t])=>`${$(e)} ${$(t)}`).join(` L`)+` Z`,Xf=(e,t,n)=>(e?.[t]??n)/1e5;function Zf(e,t){let n=e/2,r=t/2;return`M0 ${$(r)} A${$(n)} ${$(r)} 0 1 0 ${$(e)} ${$(r)} A${$(n)} ${$(r)} 0 1 0 0 ${$(r)} Z`}function Qf(e,t,n){return n=Math.min(n,e/2,t/2),`M${$(n)} 0 H${$(e-n)} A${$(n)} ${$(n)} 0 0 1 ${$(e)} ${$(n)} V${$(t-n)} A${$(n)} ${$(n)} 0 0 1 ${$(e-n)} ${$(t)} H${$(n)} A${$(n)} ${$(n)} 0 0 1 0 ${$(t-n)} V${$(n)} A${$(n)} ${$(n)} 0 0 1 ${$(n)} 0 Z`}function $f(e,t,n,r=-Math.PI/2){let i=[];for(let a=0;a<n;a++){let o=r+a*2*Math.PI/n;i.push([e/2+e/2*Math.cos(o),t/2+t/2*Math.sin(o)])}return Yf(i)}function ep(e,t,n,r){let i=[];for(let a=0;a<n*2;a++){let o=-Math.PI/2+a*Math.PI/n,s=a%2?r:1;i.push([e/2+e/2*s*Math.cos(o),t/2+t/2*s*Math.sin(o)])}return Yf(i)}var tp=new Set([`line`,`straightConnector1`,`bentConnector2`,`bentConnector3`,`bentConnector4`,`curvedConnector3`,`curvedConnector2`,`curvedConnector4`]);function np(e,t,n,r){let i=Math.min(t,n);switch(e){case`ellipse`:case`flowChartConnector`:case`cloud`:return Zf(t,n);case`roundRect`:case`flowChartAlternateProcess`:return Qf(t,n,i*Xf(r,`adj`,16667));case`flowChartTerminator`:return Qf(t,n,n/2);case`triangle`:return Yf([[t*Xf(r,`adj`,5e4),0],[t,n],[0,n]]);case`rtTriangle`:return Yf([[0,0],[t,n],[0,n]]);case`diamond`:case`flowChartDecision`:return Yf([[t/2,0],[t,n/2],[t/2,n],[0,n/2]]);case`parallelogram`:case`flowChartInputOutput`:{let e=i*Xf(r,`adj`,25e3);return Yf([[e,0],[t,0],[t-e,n],[0,n]])}case`trapezoid`:{let e=i*Xf(r,`adj`,25e3);return Yf([[e,0],[t-e,0],[t,n],[0,n]])}case`pentagon`:return $f(t,n,5);case`hexagon`:{let e=i*Xf(r,`adj`,25e3);return Yf([[e,0],[t-e,0],[t,n/2],[t-e,n],[e,n],[0,n/2]])}case`heptagon`:return $f(t,n,7);case`octagon`:{let e=i*Xf(r,`adj`,29289);return Yf([[e,0],[t-e,0],[t,e],[t,n-e],[t-e,n],[e,n],[0,n-e],[0,e]])}case`decagon`:return $f(t,n,10);case`dodecagon`:return $f(t,n,12);case`star4`:return ep(t,n,4,.38);case`star5`:return ep(t,n,5,.38);case`star6`:return ep(t,n,6,.5);case`star8`:return ep(t,n,8,.6);case`star10`:case`star12`:case`star16`:case`star24`:return ep(t,n,Number(e.slice(4)),.7);case`homePlate`:{let e=i*Xf(r,`adj`,5e4);return Yf([[0,0],[t-e,0],[t,n/2],[t-e,n],[0,n]])}case`chevron`:{let e=i*Xf(r,`adj`,5e4);return Yf([[0,0],[t-e,0],[t,n/2],[t-e,n],[0,n],[e,n/2]])}case`rightArrow`:case`leftArrow`:{let a=n*Xf(r,`adj1`,5e4),o=i*Xf(r,`adj2`,5e4),s=(n-a)/2,c=[[0,s],[t-o,s],[t-o,0],[t,n/2],[t-o,n],[t-o,s+a],[0,s+a]];return Yf(e===`leftArrow`?c.map(([e,n])=>[t-e,n]):c)}case`upArrow`:case`downArrow`:{let a=t*Xf(r,`adj1`,5e4),o=i*Xf(r,`adj2`,5e4),s=(t-a)/2,c=[[s,n],[s,o],[0,o],[t/2,0],[t,o],[s+a,o],[s+a,n]];return Yf(e===`downArrow`?c.map(([e,t])=>[e,n-t]):c)}case`leftRightArrow`:{let e=n*Xf(r,`adj1`,5e4),a=i*Xf(r,`adj2`,5e4),o=(n-e)/2;return Yf([[0,n/2],[a,0],[a,o],[t-a,o],[t-a,0],[t,n/2],[t-a,n],[t-a,o+e],[a,o+e],[a,n]])}case`plus`:case`mathPlus`:{let e=i*Xf(r,`adj`,25e3);return Yf([[e,0],[t-e,0],[t-e,e],[t,e],[t,n-e],[t-e,n-e],[t-e,n],[e,n],[e,n-e],[0,n-e],[0,e],[e,e]])}case`snip1Rect`:{let e=i*Xf(r,`adj`,16667);return Yf([[0,0],[t-e,0],[t,e],[t,n],[0,n]])}case`snip2SameRect`:{let e=i*Xf(r,`adj1`,16667);return Yf([[e,0],[t-e,0],[t,e],[t,n],[0,n],[0,e]])}case`round1Rect`:case`round2SameRect`:{let e=i*Xf(r,`adj1`,16667)||i*Xf(r,`adj`,16667);return`M${$(e)} 0 H${$(t-e)} A${$(e)} ${$(e)} 0 0 1 ${$(t)} ${$(e)} V${$(n)} H0 V${$(e)} A${$(e)} ${$(e)} 0 0 1 ${$(e)} 0 Z`}case`can`:case`flowChartMagneticDisk`:{let e=i*Xf(r,`adj`,25e3)/2;return`M0 ${$(e)} A${$(t/2)} ${$(e)} 0 0 1 ${$(t)} ${$(e)} V${$(n-e)} A${$(t/2)} ${$(e)} 0 0 1 0 ${$(n-e)} Z M0 ${$(e)} A${$(t/2)} ${$(e)} 0 0 0 ${$(t)} ${$(e)}`}case`donut`:{let e=i*Xf(r,`adj`,25e3);return Zf(t,n)+` M${$(e)} ${$(n/2)} A${$(t/2-e)} ${$(n/2-e)} 0 1 1 ${$(t-e)} ${$(n/2)} A${$(t/2-e)} ${$(n/2-e)} 0 1 1 ${$(e)} ${$(n/2)} Z`}case`heart`:return`M${$(t/2)} ${$(n*.25)} C${$(t/2)} 0 0 0 0 ${$(n*.3)} C0 ${$(n*.6)} ${$(t/2)} ${$(n*.8)} ${$(t/2)} ${$(n)} C${$(t/2)} ${$(n*.8)} ${$(t)} ${$(n*.6)} ${$(t)} ${$(n*.3)} C${$(t)} 0 ${$(t/2)} 0 ${$(t/2)} ${$(n*.25)} Z`;case`wedgeRectCallout`:case`wedgeRoundRectCallout`:{let e=t/2+t*Xf(r,`adj1`,-20833),i=n/2+n*Xf(r,`adj2`,62500);return Yf([[0,0],[t,0],[t,n],[t*.58,n],[e,i],[t*.42,n],[0,n]])}case`line`:case`straightConnector1`:return`M0 0 L${$(t)} ${$(n)}`;case`bentConnector2`:return`M0 0 H${$(t)} V${$(n)}`;case`bentConnector3`:return`M0 0 H${$(t*Xf(r,`adj1`,5e4))} V${$(n)} H${$(t)}`;case`bentConnector4`:return`M0 0 H${$(t/2)} V${$(n)} H${$(t)}`;case`curvedConnector2`:case`curvedConnector3`:case`curvedConnector4`:return`M0 0 C${$(t/2)} 0 ${$(t/2)} ${$(n)} ${$(t)} ${$(n)}`;default:return`M0 0 H${$(t)} V${$(n)} H0 Z`}}function rp(e){let t=[];return e.rot&&t.push(`rotate(${e.rot}deg)`),{left:e.x,top:e.y,width:e.w,height:e.h,transform:t.length?t.join(` `):void 0}}function ip(e,t,n){let r=qc(e,t?.t===`img`?t.target:void 0,n);if(t)switch(t.t){case`solid`:return{background:t.c};case`grad`:return{background:t.css};case`img`:return r&&r!==`unsupported`?{backgroundImage:`url("${r}")`,backgroundSize:t.tile?`auto`:`100% 100%`,backgroundRepeat:t.tile?`repeat`:`no-repeat`}:void 0;default:return}}function ap(e){let t={fontSize:`${e.baseline?e.sz*.65:e.sz}pt`};e.b&&(t.fontWeight=700),e.i&&(t.fontStyle=`italic`);let n=[e.u?`underline`:``,e.strike?`line-through`:``].filter(Boolean).join(` `);return n&&(t.textDecoration=n),e.color&&(t.color=e.color),e.font&&(t.fontFamily=e.font),e.baseline&&(t.verticalAlign=e.baseline>0?`super`:`sub`),e.caps&&(t.textTransform=`uppercase`),e.hl&&(t.background=e.hl),t}function op({text:e,flow:t,edit:n}){let[r,i,a,o]=e.ins,s={...t?{position:`relative`,inset:`auto`,minHeight:`100%`}:{},padding:`${i}px ${a}px ${o}px ${r}px`,justifyContent:e.anchor===`ctr`?`center`:e.anchor===`b`?`flex-end`:`flex-start`};return e.vert&&(s.writingMode=e.vert===`vert270`?`sideways-lr`:`vertical-rl`),e.empty&&!n?(0,X.jsx)(`div`,{className:`de-txt`,style:s}):(0,X.jsx)(`div`,{ref:n?.root,className:(e.wrap?`de-txt`:`de-txt de-nowrap`)+(n?` de-txt-edit`:``),style:s,contentEditable:n?!0:void 0,suppressContentEditableWarning:!0,spellCheck:!n&&void 0,children:e.paras.map((e,t)=>{let r={textAlign:e.algn,paddingLeft:e.marL||void 0,textIndent:e.indent||void 0,paddingTop:e.spcBef||void 0,paddingBottom:e.spcAft||void 0,lineHeight:e.lnPx?`${e.lnPx}px`:e.lnPct?+(e.lnPct*1.2).toFixed(3):1.2};(!e.runs.length||e.runs.every(e=>!e.text&&!e.br))&&(r.fontSize=`${e.endSz}pt`);let i=e.indent<0?-e.indent:0,a=0,o=e.runs.map((e,t)=>{let r=a;return a+=e.fld||e.br?1:e.text.length,n?e.fld?(0,X.jsx)(`span`,{"data-o":r,"data-obj":``,contentEditable:!1,style:ap(e),children:e.text},t):(0,X.jsx)(`span`,{"data-o":r,style:ap(e),children:e.br?`
|
|
81
|
+
`:e.text},t):e.br?(0,X.jsx)(`br`,{},t):e.href?(0,X.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,style:{color:`inherit`},children:(0,X.jsx)(`span`,{style:ap(e),children:e.text})},t):(0,X.jsx)(`span`,{style:ap(e),children:e.text},t)}),s=a===0;return(0,X.jsxs)(`div`,{style:r,"data-pa":n?String(t):void 0,children:[e.bullet&&!s&&(0,X.jsx)(`span`,{className:`de-bul`,contentEditable:!n&&void 0,style:{minWidth:i||void 0,paddingRight:i?void 0:`0.4em`,fontSize:`${e.bullet.sz}pt`,color:e.bullet.color,fontFamily:e.bullet.font},children:e.bullet.text}),o,s&&(n?(0,X.jsx)(`span`,{"data-o":0,"data-empty":``,children:``}):``)]},t)})})}function sp({id:e,s:t}){return(0,X.jsx)(`marker`,{id:e,viewBox:`0 0 10 10`,refX:`5`,refY:`5`,markerWidth:`4`,markerHeight:`4`,orient:`auto-start-reverse`,children:(0,X.jsx)(`path`,{d:`M0 0 L10 5 L0 10 Z`,fill:t.c})})}function cp({el:e,client:t,live:n,editing:r}){let i=(0,u.useId)().replace(/:/g,``),{box:a}=e,o=tp.has(e.geom),s=ip(t,e.fill,n),c=e.path??np(e.geom,a.w,a.h,e.adj),l=a.flipH||a.flipV,d=l?`translate(${a.flipH?a.w:0} ${a.flipV?a.h:0}) scale(${a.flipH?-1:1} ${a.flipV?-1:1})`:void 0,f=!o&&!e.path&&(e.geom===`rect`||e.geom===`flowChartProcess`),p=!o&&e.fill?.t===`solid`?e.fill.c:void 0,m=!o&&s&&e.fill?.t!==`solid`?s:void 0,h=e.stroke,g=Math.max(a.w,1),_=Math.max(a.h,1);return(0,X.jsxs)(`div`,{className:`de-el`,style:rp(a),"data-sid":e.sid!==void 0&&e.text?e.sid:void 0,"data-top":e.top,children:[f&&!h&&(p||m)?(0,X.jsx)(`div`,{style:{position:`absolute`,inset:0,...m??{background:p}}}):(0,X.jsxs)(X.Fragment,{children:[m&&(0,X.jsx)(`div`,{style:{position:`absolute`,inset:0,...m,clipPath:f?void 0:`path("${c}")`,transform:l?`scale(${a.flipH?-1:1}, ${a.flipV?-1:1})`:void 0}}),(p||h)&&(0,X.jsxs)(`svg`,{width:g,height:_,viewBox:`0 0 ${g} ${_}`,style:{position:`absolute`,left:0,top:0,overflow:`visible`},children:[h&&(h.head||h.tail)&&(0,X.jsxs)(`defs`,{children:[h.head&&(0,X.jsx)(sp,{id:`h${i}`,s:h}),h.tail&&(0,X.jsx)(sp,{id:`t${i}`,s:h})]}),(0,X.jsx)(`path`,{d:c,transform:d,fill:p??`none`,fillRule:`evenodd`,stroke:h?.c??`none`,strokeWidth:h?.w,strokeDasharray:h?.dash,strokeLinejoin:`round`,markerStart:h?.head?`url(#h${i})`:void 0,markerEnd:h?.tail?`url(#t${i})`:void 0})]})]}),r&&r.sid===e.sid?(0,X.jsx)(op,{text:r.text,edit:r.edit}):e.text&&(0,X.jsx)(op,{text:e.text})]})}function lp({el:e,client:t,live:n}){let r=qc(t,e.target,n),{box:i}=e,a={...rp(i),overflow:`hidden`},o=e.top;e.geom===`ellipse`?a.borderRadius=`50%`:e.geom===`roundRect`&&(a.borderRadius=Math.min(i.w,i.h)*.1667),e.stroke&&(a.outline=`${e.stroke.w}px solid ${e.stroke.c}`);let s={position:`absolute`,left:0,top:0,width:`100%`,height:`100%`};if(e.crop){let[t,n,r,a]=e.crop,o=i.w/Math.max(.01,1-t-r),c=i.h/Math.max(.01,1-n-a);s={position:`absolute`,left:-t*o,top:-n*c,width:o,height:c}}let c=i.flipH||i.flipV?`scale(${i.flipH?-1:1}, ${i.flipV?-1:1})`:void 0;return c&&(s.transform=c),(0,X.jsxs)(`div`,{className:`de-el`,style:a,"data-top":o,children:[r&&r!==`unsupported`?(0,X.jsx)(`img`,{src:r,alt:``,style:s,draggable:!1}):r===`unsupported`?(0,X.jsxs)(`div`,{className:`de-ph`,style:{width:`100%`,height:`100%`},children:[e.target?.split(`.`).pop()?.toUpperCase(),` image`]}):null,e.video&&(0,X.jsx)(`div`,{className:`de-ph`,style:{position:`absolute`,right:8,bottom:8,padding:`2px 6px`,border:0,background:`rgba(0,0,0,.6)`,color:`#fff`},children:`▶ media`})]})}var up=e=>e?`${Math.max(1,e.w)}px solid ${e.c}`:void 0;function dp({cell:e,client:t,live:n,h:r}){let i=ip(t,e.fill,n);return(0,X.jsx)(`td`,{colSpan:e.colSpan>1?e.colSpan:void 0,rowSpan:e.rowSpan>1?e.rowSpan:void 0,style:{...i??{},borderLeft:up(e.bl),borderRight:up(e.br),borderTop:up(e.bt),borderBottom:up(e.bb),height:r},children:e.text&&(0,X.jsx)(op,{text:e.text,flow:!0})})}function fp({el:e,client:t,live:n}){return(0,X.jsx)(`div`,{className:`de-el`,style:{...rp(e.box),height:`auto`},"data-top":e.top,children:(0,X.jsxs)(`table`,{className:`de-stbl`,children:[(0,X.jsx)(`colgroup`,{children:e.cols.map((e,t)=>(0,X.jsx)(`col`,{style:{width:e}},t))}),(0,X.jsx)(`tbody`,{children:e.rows.map((e,r)=>(0,X.jsx)(`tr`,{children:e.cells.map((r,i)=>r.hidden?null:(0,X.jsx)(dp,{cell:r,client:t,live:n,h:e.h},i))},r))})]})})}function pp({el:e,client:t,live:n,editing:r}){switch(e.t){case`shape`:return(0,X.jsx)(cp,{el:e,client:t,live:n,editing:r});case`pic`:return(0,X.jsx)(lp,{el:e,client:t,live:n});case`table`:return(0,X.jsx)(fp,{el:e,client:t,live:n});case`placeholder`:return(0,X.jsx)(`div`,{className:`de-el de-ph`,style:{...rp(e.box),display:`flex`},"data-top":e.top,children:e.label})}}var mp=(0,u.memo)(function({model:e,client:t,scale:n,live:r=!0,editing:i,overlay:a}){let o=ip(t,e.bg,r);return(0,X.jsx)(`div`,{className:e.hidden?`de-slide de-hidden-slide`:`de-slide`,style:{width:e.w*n,height:e.h*n},children:(0,X.jsxs)(`div`,{className:`de-slide-inner`,style:{width:e.w,height:e.h,transform:`scale(${n})`,background:`#fff`,...o??{}},children:[e.els.map((e,n)=>(0,X.jsx)(pp,{el:e,client:t,live:r,editing:i},n)),a]})})}),hp=new WeakMap;function gp(e){let t=hp.get(e);return t||hp.set(e,t={models:new Map,pending:new Map,listeners:new Map}),t}function _p(e,t,n){let r=gp(e);r.models.set(t,n);for(let e of r.listeners.get(t)??[])e(n)}function vp(e){let t=gp(e);t.models.clear(),t.pending.clear()}function yp(e,t){let n=gp(e),[r,i]=(0,u.useState)(()=>n.models.get(t));return(0,u.useEffect)(()=>{let e=n.listeners.get(t);e||n.listeners.set(t,e=new Set);let r=e=>i(e);return e.add(r),()=>{e.delete(r)}},[n,t]),(0,u.useEffect)(()=>{let r=n.models.get(t);if(r)return i(r);let a=!0,o=n.pending.get(t);return o||(o=e.call(`pptx.slide`,t),n.pending.set(t,o),o.then(e=>{n.models.set(t,e),n.pending.delete(t),n.models.size>120&&n.models.delete(n.models.keys().next().value)},()=>n.pending.delete(t))),o.then(e=>a&&i(e),e=>a&&i({error:e.message})),()=>{a=!1}},[e,n,t]),r}function bp(e){let{client:t,index:n,meta:r,scale:i,live:a,editing:o,overlay:s}=e,c=yp(t,n);return c?`error`in c?(0,X.jsx)(`div`,{className:`de-slide de-ph`,style:{width:r.w*i,height:r.h*i,display:`flex`},children:c.error}):(0,X.jsx)(mp,{model:c,client:t,scale:i,live:a,editing:o,overlay:s}):(0,X.jsx)(`div`,{className:`de-slide`,style:{width:r.w*i,height:r.h*i,background:`#fff`}})}var xp=[`nw`,`n`,`ne`,`e`,`se`,`s`,`sw`,`w`];function Sp(e,t){let n=e?.els.filter(e=>e.top===t)??[];if(!n.length)return;let r=Math.min(...n.map(e=>e.box.x)),i=Math.min(...n.map(e=>e.box.y)),a=Math.max(...n.map(e=>e.box.x+e.box.w)),o=Math.max(...n.map(e=>e.box.y+e.box.h));return{x:r,y:i,w:a-r,h:o-i,rot:n.length===1?n[0].box.rot:void 0}}function Cp(e,t,n,r,i){if(t===`move`)return{...e,x:e.x+n,y:e.y+r};let{x:a,y:o,w:s,h:c}=e;if(t.includes(`e`)&&(s+=n),t.includes(`s`)&&(c+=r),t.includes(`w`)&&(a+=n,s-=n),t.includes(`n`)&&(o+=r,c-=r),i&&t.length===2&&e.w&&e.h){let n=Math.max(s/e.w,c/e.h),r=e.w*n,i=e.h*n;t.includes(`w`)&&(a=e.x+e.w-r),t.includes(`n`)&&(o=e.y+e.h-i),s=r,c=i}return{...e,x:a,y:o,w:Math.max(4,s),h:Math.max(4,c)}}function wp({box:e,scale:t,onHandle:n}){let r=9/t,i={nw:[0,0],n:[.5,0],ne:[1,0],e:[1,.5],se:[1,1],s:[.5,1],sw:[0,1],w:[0,.5],move:[0,0]};return(0,X.jsx)(`div`,{className:`de-shape-sel`,style:{left:e.x,top:e.y,width:e.w,height:e.h,borderWidth:1.5/t,transform:e.rot?`rotate(${e.rot}deg)`:void 0},children:xp.map(a=>(0,X.jsx)(`div`,{className:`de-handle de-h-${a}`,style:{width:r,height:r,left:i[a][0]*e.w-r/2,top:i[a][1]*e.h-r/2,borderWidth:1/t},onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),n(a,e)}},a))})}var Tp=24,Ep=24;function Dp({client:e,onStatus:t,initialZoom:n=`fit`,thumbnails:r=!0}){let i=kl(),a=e.info.pptx;Al({printable:async()=>{let t=e.info.pptx,n=await Promise.all(t.slides.map(t=>e.call(`pptx.slide`,t.index))),r=n.filter(e=>!e.hidden),i=r.length?r:n;return{size:`${t.w}px ${t.h}px`,margin:`0`,node:i.map(n=>(0,X.jsx)(`div`,{className:`de-print-page`,style:{width:t.w,height:t.h},children:(0,X.jsx)(mp,{model:{...n,hidden:!1},client:e,scale:1})},n.index))}},text:async()=>{let t=e.info.pptx;return td(await Promise.all(t.slides.map(t=>e.call(`pptx.slide`,t.index))))},stats:()=>{let t=e.info.pptx;return[[`Slides`,t.count.toLocaleString()],[`Slide size`,`${+(t.w/96).toFixed(2)} × ${+(t.h/96).toFixed(2)} in`]]}});let[o,s]=Gc(),[c,l]=Gc(),d=Kc(c),f=(0,u.useRef)(null),p=Kc(f),[m,h]=(0,u.useState)(n),g=r&&s.w>=720&&a.count>1,[,_]=Wc(),v=(0,u.useMemo)(()=>new Bf(e),[e]),y=(0,u.useRef)(null),b=(0,u.useRef)(null),[x,S]=(0,u.useState)(null),[C,w]=(0,u.useState)(null),[T,E]=(0,u.useState)(0),[D,ee]=(0,u.useState)(null),[O,te]=(0,u.useState)(null),[ne,re]=(0,u.useState)(0),ie=l.w?(l.w-48)/a.w:1,ae=l.h?(l.h-48)/a.h:1,oe=Math.max(.1,Math.min(ie,Math.max(ae,ie*.6),2)),k=m===`fit`?oe:m,se=a.h*k,ce=a.w*k,A=se+Ep,le=48+a.count*A-Ep,ue=Math.max(l.w,ce+48),de=Math.max(Tp,(ue-ce)/2),j=Math.max(0,Math.floor((d.y-Tp)/A)-1),M=Math.min(a.count-1,Math.floor((d.y+l.h)/A)+1),N=Math.min(a.count-1,Math.max(0,Math.floor((d.y+l.h/3-Tp)/A))),fe=142/a.w,pe=a.h*fe,me=pe+14,he=Math.max(0,Math.floor(p.y/me)-1),ge=Math.min(a.count-1,Math.floor((p.y+l.h)/me)+1);(0,u.useEffect)(()=>{let e=f.current;if(!e)return;let t=10+N*me;(t<e.scrollTop||t+pe>e.scrollTop+e.clientHeight)&&(e.scrollTop=t-e.clientHeight/2+pe/2)},[N,me,pe]),(0,u.useEffect)(()=>{v.onChange=_,v.onDirty=()=>i.setDirty(!0),v.onCommitted=(t,n)=>_p(e,t,n),v.shortcut=e=>(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`?(i.save(),!0):e.key===`Escape`&&(P(),!0)}),(0,u.useEffect)(()=>(i.editable||P(),()=>v.end()),[i.editable]);let P=()=>{v.active&&(v.end(),b.current&&gu(b.current)?.removeAllRanges(),c.current?.focus({preventScroll:!0}),_())},_e=(0,u.useRef)(P);_e.current=P,(0,u.useEffect)(()=>Mc(e,`pptx`,{endEditing:()=>_e.current()}),[e]),(0,u.useEffect)(()=>e.on(`collab:pptx`,t=>{t.meta?(vp(e),S(null),E(e=>e+1)):t.slide!==void 0&&t.model&&_p(e,t.slide,t.model)}),[e]),(0,u.useEffect)(()=>Vc(e,{slide:x?.slide??N,top:x?.top}),[e,x?.slide,x?.top,N]);let ve=v.active&&v.text()?{sid:v.sid,text:v.text(),edit:{root:e=>{b.current=e,e&&v.input.attach(e)}}}:void 0;Uc(()=>{let e=b.current;if(!v.active||!e)return;if(y.current){let{x:t,y:n}=y.current;y.current=null,e.focus({preventScroll:!0});let r=e.ownerDocument,i=r.caretPositionFromPoint?.(t,n),a=i?null:r.caretRangeFromPoint?.(t,n),o=i?.offsetNode??a?.startContainer,s=i?.offset??a?.startOffset??0,c=gu(e);o&&e.contains(o)?c?.collapse(o,s):(c?.selectAllChildren(e),c?.collapseToEnd()),v.input.lastSel=v.input.readSel();return}let t=v.pendingSel;t&&(v.pendingSel=null,v.input.restore(t))});let ye=t=>gp(e).models.get(t),be=(e,t,n,r)=>{let i=ye(e)?.els.find(e=>e.t===`shape`&&e.sid===t);i&&i.t===`shape`&&i.text&&(v.begin(e,t,i.text),y.current={x:n,y:r},_())},xe=(e,t)=>{if(!i.editable||t.button!==0)return;let n=t.target;if(v.active&&b.current?.contains(n))return;let r=n.closest(`[data-top]`),a=r?Number(r.dataset.top):NaN;if(P(),!r||Number.isNaN(a)){S(null);return}t.preventDefault(),c.current?.focus({preventScroll:!0});let o=Sp(ye(e),a);if(S({slide:e,top:a}),!o)return;let s=n.closest(`[data-sid]`);w({slide:e,top:a,mode:`move`,sx:t.clientX,sy:t.clientY,box:o,cur:o,moved:!1,sid:s?Number(s.dataset.sid):void 0,px:t.clientX,py:t.clientY})},F=async(t,n,r=!1)=>{try{let a=await e.call(`pptx.shapes`,t,n);if(_p(e,t,a),i.setDirty(!0),re(e=>e+1),r){let e=a.els.map(e=>e.top??-1);S({slide:t,top:Math.max(...e)})}return a}catch(e){console.error(`[office-engine]`,e)}};(0,u.useEffect)(()=>{if(!C)return;let e=e=>{let t=(e.clientX-C.sx)/k,n=(e.clientY-C.sy)/k,r=C.moved||Math.abs(e.clientX-C.sx)+Math.abs(e.clientY-C.sy)>3;w({...C,moved:r,cur:r?Cp(C.box,C.mode,t,n,e.shiftKey):C.box})},t=()=>{let e=C;w(null),e.moved?F(e.slide,[{op:`xfrm`,top:e.top,box:e.cur}]):e.mode===`move`&&e.sid!==void 0&&be(e.slide,e.sid,e.px,e.py)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t,{once:!0}),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}});let I=async(t,n)=>{let r=n??x?.slide??N,i=t===`text`?a.w*.4:t===`line`?a.w*.25:a.w*.2,o=t===`text`?a.h*.1:t===`line`?1:a.w*.2,s={x:(a.w-i)/2,y:(a.h-o)/2,w:i,h:o},l;if(t===`image`){let[t]=await Dl(`image/*`,!1);if(!t)return;l=await e.call(`pptx.image`,r,await t.arrayBuffer(),(t.type.split(`/`)[1]??`png`).replace(`svg+xml`,`svg`));let n=await new Promise(e=>{let n=new Image;n.onload=()=>e({w:n.naturalWidth,h:n.naturalHeight}),n.onerror=()=>e({w:400,h:300}),n.src=URL.createObjectURL(t)}),i=Math.min(1,a.w*.6/n.w,a.h*.6/n.h);s={x:(a.w-n.w*i)/2,y:(a.h-n.h*i)/2,w:n.w*i,h:n.h*i}}let u=await F(r,[{op:`insert`,kind:t,box:s,rid:l,text:t===`text`?`Text`:void 0}],!0);if(c.current?.focus({preventScroll:!0}),u&&t===`text`){let e=u.els[u.els.length-1];e?.t===`shape`&&e.sid!==void 0&&e.text&&(v.begin(r,e.sid,e.text),_())}},Se=async(t,n)=>{P(),S(null);let r=await e.call(`pptx.slides`,t);Object.assign(a,r),vp(e),i.setDirty(!0),E(e=>e+1),n!==void 0&&requestAnimationFrame(()=>R(n))},Ce=async t=>{let n=await e.call(`pptx.undo`,t);n&&(_p(e,n.index,n.model),re(e=>Math.max(0,e+(t?1:-1))),S(null),R(n.index))},we=(e,t=N)=>{e===`add`?Se({op:`add`,after:t},t+1):e===`duplicate`?Se({op:`duplicate`,index:t},t+1):e===`delete`?Se({op:`delete`,index:t},Math.max(0,t-1)):e===`up`?t>0&&Se({op:`move`,from:t,to:t-1},t-1):e===`down`?t<a.count-1&&Se({op:`move`,from:t,to:t+1},t+1):e===`hide`&&Se({op:`hide`,index:t,hidden:!ye(t)?.hidden},t)},Te=e=>e?ye(e.slide)?.els.find(t=>t.top===e.top):void 0,Ee=(0,u.useRef)(x);Ee.current=x;let De={arrange:e=>{let t=Ee.current;t&&F(t.slide,[{op:`order`,top:t.top,to:e}])},duplicate:()=>{let e=Ee.current;e&&F(e.slide,[{op:`duplicate`,top:e.top}],!0)},remove:()=>{let e=Ee.current;e&&F(e.slide,[{op:`delete`,top:e.top}]),S(null)},rotate:e=>{let t=Ee.current,n=Te(t),r=t&&Sp(ye(t.slide),t.top);if(!t||!r)return;let i={...r,flipH:n?.box.flipH,flipV:n?.box.flipV};e===`cw`?i.rot=(i.rot??0)+90:e===`ccw`?i.rot=(i.rot??0)-90:e===`flipH`?i.flipH=!i.flipH:i.flipV=!i.flipV,F(t.slide,[{op:`xfrm`,top:t.top,box:i}])},align:e=>{let t=Ee.current,n=t&&Sp(ye(t.slide),t.top);if(!t||!n)return;let r={...n},i=(n.rot??0)*Math.PI/180,o=Math.abs(n.w*Math.cos(i))+Math.abs(n.h*Math.sin(i)),s=Math.abs(n.w*Math.sin(i))+Math.abs(n.h*Math.cos(i)),c=(o-n.w)/2,l=(s-n.h)/2;e===`left`?r.x=c:e===`center`||e===`both`?r.x=(a.w-r.w)/2:e===`right`?r.x=a.w-r.w-c:e===`top`?r.y=l:e===`middle`?r.y=(a.h-r.h)/2:e===`bottom`&&(r.y=a.h-r.h-l),e===`both`&&(r.y=(a.h-r.h)/2),F(t.slide,[{op:`xfrm`,top:t.top,box:r}])},anchor:e=>{if(v.active&&v.body){v.body={...v.body,anchor:e},F(v.slide,[{op:`anchor`,sid:v.sid,anchor:e}]),_();return}let t=Ee.current,n=Te(t);t&&n?.t===`shape`&&n.sid!==void 0&&F(t.slide,[{op:`anchor`,sid:n.sid,anchor:e}])}},Oe=()=>[{label:`Duplicate`,icon:`copy`,hint:`${Q}D`,run:De.duplicate},{label:`Delete`,icon:`trash`,hint:`Del`,run:De.remove},{label:`Bring to front`,icon:`front`,hint:`${Q}⇧↑`,sep:!0,run:()=>De.arrange(`front`)},{label:`Bring forward`,hint:`${Q}↑`,run:()=>De.arrange(`forward`)},{label:`Send backward`,hint:`${Q}↓`,run:()=>De.arrange(`backward`)},{label:`Send to back`,icon:`back`,hint:`${Q}⇧↓`,run:()=>De.arrange(`back`)},{label:`Rotate 90° clockwise`,icon:`rotate`,sep:!0,run:()=>De.rotate(`cw`)},{label:`Rotate 90° counter-clockwise`,icon:`rotateCcw`,run:()=>De.rotate(`ccw`)},{label:`Flip horizontally`,icon:`flipH`,run:()=>De.rotate(`flipH`)},{label:`Flip vertically`,icon:`flipV`,run:()=>De.rotate(`flipV`)},{label:`Center on slide`,icon:`alignObj`,sep:!0,run:()=>De.align(`both`)}],ke=e=>[{label:`New slide`,icon:`slideAdd`,hint:`${Q}M`,run:()=>we(`add`,e)},{label:`Duplicate slide`,icon:`copy`,run:()=>we(`duplicate`,e)},{label:`Delete slide`,icon:`trash`,run:()=>we(`delete`,e),disabled:a.count<=1},{label:ye(e)?.hidden?`Show slide`:`Hide slide`,icon:`hide`,run:()=>we(`hide`,e)},{label:`Move slide up`,icon:`up`,sep:!0,run:()=>we(`up`,e),disabled:e===0},{label:`Move slide down`,icon:`down`,run:()=>we(`down`,e),disabled:e>=a.count-1},{label:`Insert text box`,icon:`textbox`,sep:!0,run:()=>void I(`text`,e)},{label:`Insert image…`,icon:`image`,run:()=>void I(`image`,e)},{label:`Present from this slide`,icon:`play`,sep:!0,run:()=>ee(e)}],L=e=>{if(!x||v.active||!i.editable)return!1;let t=Sp(ye(x.slide),x.top),n=e.shiftKey?10:1,r={ArrowUp:[0,-n],ArrowDown:[0,n],ArrowLeft:[-n,0],ArrowRight:[n,0]},a=e.metaKey||e.ctrlKey;if(a&&e.key.toLowerCase()===`d`)De.duplicate();else if(a&&(e.key===`ArrowUp`||e.key===`ArrowDown`))De.arrange(e.key===`ArrowUp`?e.shiftKey?`front`:`forward`:e.shiftKey?`back`:`backward`);else if(e.key===`Delete`||e.key===`Backspace`)F(x.slide,[{op:`delete`,top:x.top}]),S(null);else if(r[e.key]&&t)F(x.slide,[{op:`xfrm`,top:x.top,box:{...t,x:t.x+r[e.key][0],y:t.y+r[e.key][1]}}]);else if(e.key===`Escape`)S(null);else return!1;return e.preventDefault(),!0},R=e=>{let t=c.current;t&&(t.scrollTop=Tp+Math.max(0,Math.min(a.count-1,e))*A-Math.max(0,(l.h-se)/2))},z=e=>{if(v.active||e.defaultPrevented||L(e))return;if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){e.preventDefault(),i.save();return}if(e.key===`F5`){e.preventDefault(),ee(e.shiftKey?0:N);return}let t=e.metaKey||e.ctrlKey;if(i.editable&&t&&(e.key.toLowerCase()===`z`||e.key.toLowerCase()===`y`))e.preventDefault(),Ce(e.key.toLowerCase()===`y`||e.shiftKey);else if(i.editable&&t&&e.key.toLowerCase()===`m`)e.preventDefault(),we(`add`);else{if(e.key===`PageDown`||e.key===`ArrowRight`||e.key===` `&&!e.shiftKey)R(N+1);else if(e.key===`PageUp`||e.key===`ArrowLeft`)R(N-1);else if(e.key===`Home`)R(0);else if(e.key===`End`)R(a.count-1);else return;e.preventDefault()}},Ae=e=>{let t=C&&C.slide===e&&C.moved?C.cur:x?Sp(ye(e),x.top):void 0;if(t&&x)return(0,X.jsx)(wp,{box:t,scale:k,onHandle:(t,n)=>{let r=Sp(ye(e),x.top);r&&w({slide:e,top:x.top,mode:t,sx:n.clientX,sy:n.clientY,box:r,cur:r,moved:!1,px:n.clientX,py:n.clientY})}})},B=[];for(let t=j;t<=M;t++)B.push((0,X.jsx)(`div`,{className:i.editable?`de-slide-frame de-slide-editable`:`de-slide-frame`,style:{top:Tp+t*A,left:de},"data-slide":t+1,onMouseDown:e=>xe(t,e),onContextMenu:e=>{if(!i.editable)return;let n=e.target;if(v.active&&b.current?.contains(n))return;e.preventDefault();let r=n.closest(`[data-top]`);if(r){P();let n={slide:t,top:Number(r.dataset.top)};Ee.current=n,S(n),te({x:e.clientX,y:e.clientY,items:Oe()})}else te({x:e.clientX,y:e.clientY,items:ke(t)})},children:(0,X.jsx)(bp,{client:e,index:t,meta:a,scale:k,live:!0,editing:v.slide===t?ve:void 0,overlay:i.editable&&x?.slide===t?Ae(t):void 0})},`${T}:${t}`));v.active&&(v.slide<j||v.slide>M)&&P();let V=[];if(g)for(let t=he;t<=ge;t++)V.push((0,X.jsxs)(`div`,{className:`de-thumb`,style:{top:10+t*me},"aria-current":t===N,onClick:()=>R(t),onContextMenu:e=>{i.editable&&(e.preventDefault(),R(t),te({x:e.clientX,y:e.clientY,items:ke(t)}))},children:[(0,X.jsx)(`span`,{className:`de-thumb-n`,children:t+1}),(0,X.jsx)(bp,{client:e,index:t,meta:a,scale:fe,live:!0})]},`${T}:${t}`));return(0,X.jsxs)(`div`,{ref:o,style:{display:`flex`,flex:1,minWidth:0},children:[g&&(0,X.jsx)(`div`,{ref:f,className:`de-thumbs`,children:(0,X.jsx)(`div`,{style:{height:20+a.count*me,position:`relative`},children:V})}),(0,X.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,display:`flex`},children:[(0,X.jsx)(`div`,{ref:c,className:`de-scroll`,tabIndex:0,onKeyDown:z,style:{outline:`none`},onMouseDown:e=>e.target===e.currentTarget&&P(),children:(0,X.jsx)(`div`,{style:{position:`relative`,height:le,width:ue},onMouseDown:e=>e.target===e.currentTarget&&P(),children:B})}),(0,X.jsx)(Fl,{zoom:m,effective:k,onChange:h}),!i.editable&&(0,X.jsx)(`button`,{type:`button`,className:`de-mode de-present-btn`,title:`Present (F5)`,onClick:()=>ee(N),children:`▶ Present`}),(0,X.jsx)(Nl,{text:`Slide ${N+1} of ${a.count}`,onStatus:t}),i.editable&&(0,X.jsx)(qf,{editor:v,shape:x&&!v.active?(()=>{let e=Te(x),t=e?.t===`shape`?e:void 0;return{canText:t?.sid!==void 0,anchor:t?.text?.anchor}})():null,textAnchor:v.body?.anchor,canUndo:ne>0,onUndo:e=>void Ce(e),onInsert:e=>void I(e),onFill:e=>x&&void F(x.slide,[{op:`fill`,top:x.top,color:e}]),onLine:e=>x&&void F(x.slide,[{op:`line`,top:x.top,...e}]),onArrange:De.arrange,onRotate:De.rotate,onAlign:De.align,onAnchor:De.anchor,onDuplicate:De.duplicate,onDelete:De.remove,onBackground:e=>void F(N,[{op:`bg`,color:e}]),onSlide:e=>we(e),onPresent:e=>ee(e?0:N)}),O&&(0,X.jsx)(Il,{x:O.x,y:O.y,items:O.items,onClose:()=>te(null)}),D!==null&&(0,X.jsx)(Jf,{client:e,meta:a,start:D,onClose:()=>ee(null)})]})]})}function Op(e,t={}){let[n,r]=(0,u.useState)({client:null,error:null,loading:!!e,progress:null}),{name:i,worker:a,credentials:o}=t,s=t.headers?JSON.stringify(t.headers):``;return(0,u.useEffect)(()=>{if(!e){r({client:null,error:null,loading:!1,progress:null});return}let t=!0,n=null;return r({client:null,error:null,loading:!0,progress:null}),kc.open(e,{name:i,worker:a,credentials:o,headers:s?JSON.parse(s):void 0,onProgress:e=>t&&r(t=>({...t,progress:e}))}).then(e=>{if(!t)return e.destroy();n=e,e.on(`progress`,e=>t&&r(t=>({...t,progress:e}))),r(t=>({...t,client:e,loading:!1}))},e=>t&&r({client:null,error:e,loading:!1,progress:null})),()=>{t=!1,n?.destroy()}},[e,i,a,o,s]),n}var kp=[{value:`General`,label:`Automatic`,hint:`1000.12`},{value:`@`,label:`Plain text`,hint:`abc`},{value:`0`,label:`Number`,hint:`1000`,sep:!0},{value:`0.00`,label:`Number`,hint:`1000.12`},{value:`#,##0`,label:`Number`,hint:`1,000`},{value:`#,##0.00`,label:`Number`,hint:`1,000.12`},{value:`0.00E+00`,label:`Scientific`,hint:`1.01E+03`},{value:`0%`,label:`Percent`,hint:`10%`,sep:!0},{value:`0.00%`,label:`Percent`,hint:`10.12%`},{value:`"$"#,##0.00`,label:`Currency`,hint:`$1,000.12`,sep:!0},{value:`"$"#,##0`,label:`Currency rounded`,hint:`$1,000`},{value:`_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)`,label:`Accounting`,hint:`$ (1,000.12)`},{value:`#,##0 "₫"`,label:`Currency`,hint:`1,000 ₫`},{value:`# ?/?`,label:`Fraction`,hint:`1000 1/8`},{value:`yyyy-mm-dd`,label:`Date`,hint:`2026-09-26`,sep:!0},{value:`dd/mm/yyyy`,label:`Date`,hint:`26/09/2026`},{value:`d mmmm yyyy`,label:`Long date`,hint:`26 September 2026`},{value:`h:mm`,label:`Time`,hint:`15:59`},{value:`h:mm:ss AM/PM`,label:`Time`,hint:`3:59:00 PM`},{value:`yyyy-mm-dd h:mm`,label:`Date time`,hint:`2026-09-26 15:59`},{value:`[h]:mm:ss`,label:`Duration`,hint:`24:01:00`}],Ap=[6,7,8,9,10,11,12,14,16,18,20,24,28,36,48],jp=[{k:`all`,icon:`bAll`,title:`All borders`},{k:`inner`,icon:`bInner`,title:`Inner borders`},{k:`outer`,icon:`bOuter`,title:`Outer borders`},{k:`none`,icon:`bNone`,title:`Clear borders`},{k:`top`,icon:`bTop`,title:`Top border`},{k:`bottom`,icon:`bBottom`,title:`Bottom border`},{k:`left`,icon:`bLeft`,title:`Left border`},{k:`right`,icon:`bRight`,title:`Right border`}],Mp=[{value:`thin`,label:`Thin`,hint:`───`},{value:`medium`,label:`Medium`,hint:`━━━`},{value:`thick`,label:`Thick`,hint:`▬▬▬`},{value:`dashed`,label:`Dashed`,hint:`- - -`},{value:`dotted`,label:`Dotted`,hint:`·····`},{value:`double`,label:`Double`,hint:`═══`}],Np=[{value:`left`,label:`Left`,icon:`alignLeft`},{value:`center`,label:`Center`,icon:`alignCenter`},{value:`right`,label:`Right`,icon:`alignRight`}],Pp=[{value:`top`,label:`Top`,icon:`vTop`},{value:`center`,label:`Middle`,icon:`vMiddle`},{value:`bottom`,label:`Bottom`,icon:`vBottom`}],Fp=[{value:0,label:`None`,icon:`rotNone`},{value:45,label:`Tilt up`,icon:`rotUp`},{value:-45,label:`Tilt down`,icon:`rotDown`},{value:255,label:`Stack vertically`,icon:`rotStack`},{value:90,label:`Rotate up`,icon:`rotUp90`},{value:-90,label:`Rotate down`,icon:`rotDown90`}],Ip=[`SUM`,`AVERAGE`,`COUNT`,`MAX`,`MIN`];function Lp(e,t){let n=e===`General`||e===`@`?`0`:e,r=/0(\.0*)?/.exec(n);if(!r)return t>0?`0.0`:`0`;let i=Math.max(0,(r[1]?r[1].length-1:0)+t);return n.slice(0,r.index)+`0`+(i?`.`+`0`.repeat(i):``)+n.slice(r.index+r[0].length)}function Rp(e){let{css:t,onFormat:n}=e,[r,i]=(0,u.useState)(`#000000`),[a,o]=(0,u.useState)(`thin`),s=String(t.textDecoration??``),c=t.textAlign??``,l=t.alignItems===`flex-start`?`top`:t.alignItems===`center`?`center`:`bottom`,d=Number(t.textRotate??0),f=e=>typeof e==`string`&&e.endsWith(`pt`)?parseFloat(e):typeof e==`number`?Math.round(e*.75*2)/2:void 0,p=f(t.fontSize)??f(e.base.fontSize),m=Sl(t.fontFamily??e.base.fontFamily),h=kp.find(t=>t.value===e.format),g=h?kp:[{value:e.format,label:`Custom`,hint:e.format},...kp];return(0,X.jsxs)(jl,{children:[(0,X.jsx)(Z,{icon:`undo`,title:`Undo (${Q}Z)`,onClick:e.onUndo}),(0,X.jsx)(Z,{icon:`redo`,title:`Redo (${Q}Y)`,onClick:e.onRedo}),(0,X.jsx)(Z,{icon:`paint`,title:`Paint format (click, then select cells)`,active:e.painter,onClick:e.onPaint}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`currency`,title:`Format as currency`,onClick:()=>n({numFmt:`"$"#,##0.00`})}),(0,X.jsx)(Z,{icon:`percent`,title:`Format as percent`,onClick:()=>n({numFmt:`0%`})}),(0,X.jsx)(Z,{icon:`decLess`,title:`Decrease decimal places`,onClick:()=>n({numFmt:Lp(e.format,-1)})}),(0,X.jsx)(Z,{icon:`decMore`,title:`Increase decimal places`,onClick:()=>n({numFmt:Lp(e.format,1)})}),(0,X.jsx)(il,{title:`Number format: ${h?.label??`Custom`}`,width:96,menuWidth:270,value:e.format,options:g,onChange:e=>n({numFmt:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(il,{title:`Font`,width:112,menuWidth:200,value:m,placeholder:`Font`,options:xl(m),onChange:e=>n({font:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(al,{value:p,sizes:Ap,onChange:e=>n({sz:e})}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`bold`,title:`Bold (${Q}B)`,active:t.fontWeight===700,onClick:()=>e.onToggle(`b`)}),(0,X.jsx)(Z,{icon:`italic`,title:`Italic (${Q}I)`,active:t.fontStyle===`italic`,onClick:()=>e.onToggle(`i`)}),(0,X.jsx)(Z,{icon:`underline`,title:`Underline (${Q}U)`,active:s.includes(`underline`),onClick:()=>e.onToggle(`u`)}),(0,X.jsx)(Z,{icon:`strike`,title:`Strikethrough (${Q}⇧X)`,active:s.includes(`line-through`),onClick:()=>e.onToggle(`strike`)}),(0,X.jsx)(vl,{icon:`color`,title:`Text color`,value:t.color,onPick:e=>n({color:e}),noneLabel:`Automatic`}),(0,X.jsx)(nl,{}),(0,X.jsx)(vl,{icon:`fill`,title:`Fill color`,value:typeof t.background==`string`&&!t.background.includes(`gradient`)?t.background:void 0,onPick:e=>n({fill:e}),noneLabel:`No fill`}),(0,X.jsx)(Tl,{icon:`borders`,title:`Borders`,chevron:!0,children:e=>(0,X.jsxs)(`div`,{className:`de-borders-pop`,children:[(0,X.jsx)(`div`,{className:`de-borders`,role:`group`,"aria-label":`Borders`,children:jp.map(t=>(0,X.jsx)(`button`,{type:`button`,className:`de-tb`,title:t.title,"aria-label":t.title,onClick:()=>{e(),n({border:t.k,borderColor:r,borderStyle:a})},children:(0,X.jsx)(Qc,{name:t.icon})},t.k))}),(0,X.jsxs)(`div`,{className:`de-borders-side`,children:[(0,X.jsx)(vl,{icon:`color`,title:`Border color`,value:r,onPick:e=>i(e??`#000000`),noneLabel:`Black`}),(0,X.jsx)(rl,{title:`Border style`,icon:`lineStyle`,label:null,menuWidth:150,value:a,options:[...Mp],onChange:e=>o(e)})]})]})}),(0,X.jsx)(rl,{title:`Merge cells`,icon:`merge`,label:null,menuWidth:190,options:[{value:`all`,label:`Merge all`},{value:`across`,label:`Merge horizontally`},{value:`down`,label:`Merge vertically`},{value:`unmerge`,label:`Unmerge`,disabled:!e.merged,sep:!0}],onChange:t=>e.onMerge(t)}),(0,X.jsx)(nl,{}),(0,X.jsx)(rl,{title:`Horizontal align`,icon:Np.find(e=>e.value===c)?.icon??`alignLeft`,label:null,menuWidth:140,value:c,options:Np.map(e=>({...e})),onChange:e=>n({align:e===c?null:e})}),(0,X.jsx)(rl,{title:`Vertical align`,icon:Pp.find(e=>e.value===l).icon,label:null,menuWidth:140,value:l,options:Pp.map(e=>({...e})),onChange:e=>n({valign:e})}),(0,X.jsx)(Z,{icon:`wrap`,title:`Wrap text`,active:t.whiteSpace===`pre-wrap`,onClick:()=>n({wrap:t.whiteSpace!==`pre-wrap`})}),(0,X.jsx)(rl,{title:`Text rotation`,icon:Fp.find(e=>e.value===d)?.icon??`rotNone`,label:null,menuWidth:180,value:d,options:Fp,onChange:e=>n({rotate:e||null})}),(0,X.jsx)(nl,{}),(0,X.jsx)(wl,{title:`Insert, delete or hide rows & columns`,label:`Rows`,icon:`rowAdd`,items:[{value:`rowAbove`,label:`Insert row above`,icon:`rowAbove`},{value:`rowBelow`,label:`Insert row below`,icon:`rowBelow`},{value:`colLeft`,label:`Insert column left`,icon:`colLeft`},{value:`colRight`,label:`Insert column right`,icon:`colRight`},{value:`delRow`,label:`Delete row(s)`,icon:`delRow`,sep:!0},{value:`delCol`,label:`Delete column(s)`,icon:`delCol`},{value:`hideRows`,label:`Hide row(s)`,icon:`hide`,sep:!0},{value:`hideCols`,label:`Hide column(s)`,icon:`hide`},{value:`unhideRows`,label:`Unhide rows`,icon:`view`},{value:`unhideCols`,label:`Unhide columns`,icon:`view`}],onPick:t=>e.onRows(t)}),(0,X.jsx)(rl,{title:`Functions`,icon:`sum`,label:null,menuWidth:170,options:[...Ip.map(e=>({value:e,label:e})),{value:``,label:`More functions…`,sep:!0}],onChange:t=>e.onFunc(t||null)}),(0,X.jsx)(rl,{title:`Sort range`,icon:`sort`,label:null,menuWidth:200,options:[{value:`asc`,label:`Sort range A → Z`,icon:`sortAZ`},{value:`desc`,label:`Sort range Z → A`,icon:`sortZA`}],onChange:t=>e.onSort(t===`desc`)}),(0,X.jsx)(wl,{title:`View: freeze, gridlines`,label:`View`,icon:`freeze`,items:[{value:`row`,label:`Freeze 1 row`},{value:`col`,label:`Freeze 1 column`},{value:`sel`,label:`Freeze up to current cell`},{value:`none`,label:`Unfreeze`,disabled:!e.frozen},{value:`grid`,label:e.gridlines?`Hide gridlines`:`Show gridlines`,icon:`gridlines`,sep:!0}],onPick:t=>t===`grid`?e.onGridlines():e.onFreeze(t)}),(0,X.jsx)(nl,{}),(0,X.jsx)(Z,{icon:`clear`,title:`Clear formatting (${Q}\\)`,onClick:()=>n({clear:!0})}),(0,X.jsx)(Z,{icon:`search`,title:`Find & replace (${Q}F)`,onClick:e.onFind})]})}var zp=class{constructor(e){A(this,`def`,void 0),A(this,`count`,0),A(this,`custom`,new Map),A(this,`keys`,[]),A(this,`cum`,[]),A(this,`dirty`,!1),this.def=e}set(e,t){t===this.def?this.custom.delete(e):this.custom.set(e,t),this.dirty=!0}setRange(e,t,n){let r=Math.min(t,e+2e4);for(let t=e;t<=r;t++)this.set(t,n)}build(){if(!this.dirty)return;this.keys=[...this.custom.keys()].sort((e,t)=>e-t);let e=0;this.cum=this.keys.map(t=>e+=this.custom.get(t)-this.def),this.dirty=!1}size(e){return this.custom.get(e)??this.def}pos(e){this.build();let t=0,n=this.keys.length-1,r=-1;for(;t<=n;){let i=t+n>>1;this.keys[i]<e?(r=i,t=i+1):n=i-1}return e*this.def+(r>=0?this.cum[r]:0)}total(){return this.pos(this.count)}index(e){if(e<=0)return 0;let t=0,n=Math.max(0,this.count-1);for(;t<n;){let r=t+n+1>>1;this.pos(r)<=e?t=r:n=r-1}return t}},Bp=(e,t)=>typeof e==`string`&&e.endsWith(`pt`)?parseFloat(e)*4/3:typeof e==`number`?e:t;function Vp(e,t,n){let r=n*.56;if(e.length*r<=t)return e;let i=/^(-?\d+)\.(\d+)$/.exec(e);if(i&&(i[1].length+(e.startsWith(`-`),0))*r<=t){let n=Math.max(0,Math.floor(t/r)-i[1].length-1),a=Number(e).toFixed(n);if(a.length*r<=t)return a}return`#`.repeat(Math.max(1,Math.floor(t/r)))}var Hp=2e3,Up=2e4,Wp=100,Gp=700,Kp=960;async function qp(e,t,n){let r=new Map;for(let i=0;i<n;i+=Hp){let a=await e.call(`xlsx.block`,t,i,Math.min(n,i+Hp));for(let e of a.rows)r.set(e.r,e.cells)}return r}var Jp=()=>Error(`The sheet is still loading — try again in a moment`);async function Yp(e,t,n,r){if(!n.done)throw Jp();let i=await qp(e,t,n.rows),a=-1,o=-1;for(let[e,t]of i)for(let n of t)n[1]!==``&&(a=Math.max(a,e),o=Math.max(o,n[0]));let s=[];for(let e=0;e<=a;e++){let t=Array(o+1).fill(``);for(let n of i.get(e)??[])n[0]<=o&&(t[n[0]]=n[1]);s.push(t)}return(r===`,`?``:``)+nd(s,r)}var Xp={"flex-start":`top`,center:`middle`,"flex-end":`bottom`};async function Zp(e,t,n,r){if(!n.done)throw Jp();let i=await qp(e,t,Math.min(n.rows,Up)),a=-1,o=-1;for(let[e,t]of i)for(let n of t)(n[1]!==``||n[2])&&(a=Math.max(a,e),o=Math.max(o,n[0]));let s=n.merges.filter(e=>e.r0<=a&&e.c0<=o);for(let e of s)a=Math.max(a,Math.min(e.r1,19999)),o=Math.max(o,e.c1);let c=[];for(let e=0;e<=o;e++)n.colAxis.size(e)>0&&c.push(e);let l=new Map,u=new Set,d=(e,t)=>e*16384+t,f=new Int32Array(a+2);for(let e of s){l.set(d(e.r0,e.c0),e);let t=Math.min(e.r1,a);for(let n=e.r0;n<=t;n++)for(let t=e.c0;t<=e.c1;t++)(n!==e.r0||t!==e.c0)&&u.add(d(n,t));t>e.r0&&(f[e.r0+1]++,f[t+1]--)}let p=(e,t,n)=>{let r=0;for(let i=t;i<=n;i++)e.size(i)>0&&r++;return Math.max(1,r)},m=Bp(r.baseFont.fontSize,14.67),h=[],g=[],_=0;for(let e=0;e<=a;e++){_+=f[e],!_&&g.length>=Wp&&(h.push(g),g=[]);let t=n.rowAxis.size(e);if(!t)continue;let s=new Map((i.get(e)??[]).map(e=>[e[0],e])),v=[];c.forEach((t,i)=>{if(u.has(d(e,t)))return;let f=s.get(t),h=l.get(d(e,t)),[,g=``,_=0,y=0,b]=f??[],{textAlign:x,textRotate:S,alignItems:C,whiteSpace:w,...T}=r.styles[_]??{},E=h?n.colAxis.pos(Math.min(h.c1,o)+1)-n.colAxis.pos(h.c0):n.colAxis.size(t),D=y===1&&g?Vp(g,E-6,Bp(T.fontSize,m)):g,ee=x??(y===1?`right`:y===2?`center`:`left`),O=c[i+1],te=!!D&&!h&&ee===`left`&&!w&&(O===void 0||!s.get(O)?.[1]&&!u.has(d(e,O))),ne={...T};ee!==`left`&&(ne.textAlign=ee);let re=Xp[C];re&&re!==`bottom`&&(ne.verticalAlign=re),w&&(ne.whiteSpace=w),b&&(ne.color=b),v.push((0,X.jsx)(`td`,{style:ne,"data-de-fit":D&&!te?y===1?`#`:``:void 0,colSpan:h?p(n.colAxis,h.c0,Math.min(h.c1,o)):void 0,rowSpan:h?p(n.rowAxis,h.r0,Math.min(h.r1,a)):void 0,children:D},t))}),g.push((0,X.jsx)(`tr`,{style:{height:t},children:v},e))}(g.length||!h.length)&&h.push(g);let v=c.reduce((e,t)=>e+n.colAxis.size(t),0),y=v>Gp,b=Math.max(.35,Math.min(1,(y?Kp:Gp)/Math.max(1,v))),x=n.gridLines?`de-print-table de-print-grid`:`de-print-table`,S={width:v,...r.baseFont},C=(0,X.jsx)(`colgroup`,{children:c.map(e=>(0,X.jsx)(`col`,{style:{width:n.colAxis.size(e)}},e))});return{node:(0,X.jsx)(`div`,{className:`de-print-sheet de-print-fit`,style:{"--de-fit":b},children:h.map((e,t)=>(0,X.jsxs)(`table`,{className:x,style:S,children:[C,(0,X.jsx)(`tbody`,{children:e})]},t))}),size:y?`landscape`:`auto`,margin:`12mm`,notice:n.rows>Up?`Only the first ${Up.toLocaleString()} rows are included`:void 0}}var Qp=128,$p=22,em=12e6,tm=class{constructor(){A(this,`rows`,0),A(this,`cols`,0),A(this,`done`,!1),A(this,`error`,void 0),A(this,`header`,!1),A(this,`rowAxis`,new zp(20)),A(this,`colAxis`,new zp(64)),A(this,`merges`,[]),A(this,`frozen`,{rows:0,cols:0}),A(this,`gridLines`,!0),A(this,`blocks`,new Map),A(this,`inflight`,new Set),A(this,`sel`,void 0),A(this,`scrollPos`,void 0)}},nm=class{constructor(e){A(this,`client`,void 0),A(this,`sheets`,new Map),A(this,`focusGrid`,!1),A(this,`listeners`,new Set),A(this,`off`,void 0),this.client=e;let t=[e.on(`xlsx:progress`,e=>this.onProgress(e)),e.on(`collab:xlsx`,t=>this.applied(t,e.info.xlsx))];this.off=()=>t.forEach(e=>e())}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(){for(let e of this.listeners)e()}sheet(e){let t=this.sheets.get(e);return t||(t=new tm,this.sheets.set(e,t),this.client.call(`xlsx.load`,e).catch(e=>{t.error=e.message,t.done=!0,this.emit()})),t}onProgress(e){let t=this.sheet(e.sheet);if(e.defaultRowH!==void 0&&!t.header){t.header=!0,t.rowAxis.def=e.defaultRowH||20,t.colAxis.def=e.defaultColW||64;for(let n of e.colInfo??[])t.colAxis.setRange(n.min,n.max,n.w);t.frozen=e.frozen??t.frozen,t.gridLines=e.gridLines??!0}for(let[n,r]of e.rowSizes)t.rowAxis.set(n,r);e.recalc&&t.blocks.clear(),t.rows=Math.max(t.rows,e.rows),t.cols=Math.max(t.cols,e.cols),e.merges&&(t.merges=e.merges),e.error&&(t.error=e.error),t.done=e.done,this.emit()}ensure(e,t,n){let r=this.sheet(e);if(r.header||r.done)for(let i=Math.floor(t/Qp);i<=Math.floor(n/Qp);i++){let t=r.blocks.get(i);if(r.inflight.has(i)||t&&(t.complete||t.rowsAt===r.rows&&!r.done)||i*Qp>r.rows&&!r.done&&t)continue;r.inflight.add(i);let n=r.rows;this.client.call(`xlsx.block`,e,i*Qp,(i+1)*Qp).then(e=>{let t=new Map;for(let n of e.rows)t.set(n.r,n.cells);if(r.blocks.set(i,{rows:t,complete:e.complete,rowsAt:n}),r.blocks.size>400){let e=r.blocks.keys().next().value;r.blocks.delete(e)}}).catch(()=>{}).finally(()=>{r.inflight.delete(i),this.emit()})}}invalidate(e,t,n){let r=this.sheet(e);for(let e=Math.floor(t/Qp);e<=Math.floor(n/Qp);e++)r.blocks.delete(e);r.rows=Math.max(r.rows,n+1),this.emit()}applied(e,t){if(!e)return;for(let n of e.styles??[])t.styles[n.index]=n.css,t.formats[n.index]=n.format;for(let t of e.recalc??[])this.sheets.get(t)?.blocks.clear();if(e.sheets){t.sheets=e.sheets,this.sheets.clear(),this.emit();return}let n=this.sheet(e.sheet);if(e.layout){let t=e.layout;n.rowAxis=new zp(t.defaultRowH||n.rowAxis.def),n.colAxis=new zp(t.defaultColW||n.colAxis.def);for(let e of t.colInfo??[])n.colAxis.setRange(e.min,e.max,e.w);for(let[e,r]of t.rowSizes)n.rowAxis.set(e,r);n.merges=t.merges??[],n.frozen=t.frozen??n.frozen,t.gridLines!==void 0&&(n.gridLines=t.gridLines),n.rows=t.rows,n.cols=t.cols,n.blocks.clear(),this.emit()}else n.cols=Math.max(n.cols,e.range.c1+1),this.invalidate(e.sheet,e.range.r0,e.range.r1)}row(e,t){return this.sheets.get(e)?.blocks.get(Math.floor(t/Qp))?.rows.get(t)}dispose(){this.off(),this.listeners.clear()}},rm=new WeakMap;function im(e){let t=rm.get(e);return t||rm.set(e,t=new nm(e)),t}function am({client:e,onStatus:t,initialSheet:n}){let r=e.info.xlsx,i=r.sheets.filter(e=>!e.hidden),[a,o]=(0,u.useState)(n??i[0]?.index??0),s=(0,u.useMemo)(()=>im(e),[e]),[,c]=Wc();(0,u.useEffect)(()=>s.subscribe(c),[s,c]);let l=s.sheet(a),d=l.error?`Error: ${l.error}`:`${l.rows.toLocaleString()} rows × ${l.cols.toLocaleString()} cols${l.done?``:` · loading…`}`,f=kl();Al({printable:()=>Zp(e,v,s.sheet(v),r),text:t=>Yp(e,v,s.sheet(v),t===`tsv`?` `:`,`),stats:()=>{let e=s.sheet(v);return[[`Sheets`,`${r.sheets.length}${r.sheets.some(e=>e.hidden)?` (${r.sheets.filter(e=>e.hidden).length} hidden)`:``}`],[`Current sheet`,r.sheets[v]?.name??``],[`Used range`,`${e.rows.toLocaleString()} rows × ${e.cols.toLocaleString()} columns${e.done?``:` (loading)`}`]]},importTable:async(t,n)=>{let i=await e.call(`xlsx.bookOp`,{op:`add`,name:n,after:v});s.applied(i,r),f.setDirty(!0);let a=v+1;o(a),await new Promise((e,t)=>{let n=()=>{},r=()=>{let r=s.sheet(a);if(r.error)t(Error(r.error));else if(r.done)e();else return;n()};n=s.subscribe(r),r()});let l=[];t.forEach((e,t)=>e.forEach((e,n)=>e!==``&&l.push({r:t,c:n,input:e}))),l.length&&s.applied(await e.call(`xlsx.set`,a,l),r),c()}});let[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),_=async(t,n)=>{try{let i=await e.call(`xlsx.bookOp`,t);s.applied(i,r),f.setDirty(!0),n!==void 0&&o(Math.max(0,Math.min(n,r.sheets.length-1))),c()}catch(e){om(e)}},v=Math.min(a,r.sheets.length-1),[y,b]=(0,u.useState)(null),x=(0,u.useRef)(!1),S=!!y&&_o(y.value)&&lm(y,bo(y.value,y.caret));return(0,X.jsxs)(`div`,{className:`de-xlsx`,children:[(0,X.jsx)(Nl,{text:d,onStatus:t}),(0,X.jsx)(hm,{store:s,sheet:v,meta:r,client:e,edit:y,setEdit:b,hold:x,onSheet:o},`${v}:${r.sheets[v]?.path}`),(0,X.jsxs)(`div`,{className:`de-tabs`,role:`tablist`,children:[f.editable&&(0,X.jsx)(`button`,{type:`button`,className:`de-tab de-tab-add`,title:`Add sheet`,onClick:()=>void _({op:`add`,after:v},v+1),children:`+`}),r.sheets.filter(e=>!e.hidden).map(e=>p===e.index?(0,X.jsx)(`input`,{className:`de-tab-input`,autoFocus:!0,defaultValue:e.name,onBlur:t=>{m(null),t.target.value.trim()&&t.target.value!==e.name&&_({op:`rename`,index:e.index,name:t.target.value})},onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&m(null)}},e.index):(0,X.jsx)(`button`,{type:`button`,role:`tab`,className:`de-tab`,"aria-selected":e.index===v,onMouseDown:t=>{S&&(t.preventDefault(),e.index!==v&&(x.current=!0))},onClick:()=>o(e.index),onDoubleClick:()=>f.editable&&m(e.index),onContextMenu:t=>{f.editable&&(t.preventDefault(),g({index:e.index,x:t.clientX,y:t.clientY}))},children:e.name},e.index))]}),h&&(0,X.jsx)(Il,{x:h.x,y:h.y,onClose:()=>g(null),items:[{label:`Rename`,run:()=>m(h.index)},{label:`Duplicate name → new sheet`,run:()=>void _({op:`add`,after:h.index,name:r.sheets[h.index].name+` (2)`},h.index+1)},{label:`Move left`,disabled:h.index===0,run:()=>void _({op:`move`,from:h.index,to:h.index-1},h.index-1)},{label:`Move right`,disabled:h.index>=r.sheets.length-1,run:()=>void _({op:`move`,from:h.index,to:h.index+1},h.index+1)},{label:`Delete sheet`,disabled:r.sheets.length<=1,run:()=>void _({op:`delete`,index:h.index},Math.max(0,h.index-1))}]})]})}function om(e){console.error(`[office-engine]`,e)}function sm(e){return e===255?{writingMode:`vertical-rl`,textOrientation:`upright`,whiteSpace:`nowrap`}:e===90?{writingMode:`vertical-rl`,transform:`rotate(180deg)`,whiteSpace:`nowrap`}:e===-90?{writingMode:`vertical-rl`,whiteSpace:`nowrap`}:{display:`inline-block`,transform:`rotate(${-e}deg)`,whiteSpace:`nowrap`}}var cm={center:`center`,right:`flex-end`,left:`flex-start`,justify:`flex-start`};function lm(e,t){return t?e.point&&e.point.e===e.caret&&e.caret===e.caretEnd?!0:e.caret===e.caretEnd?t.pointable:t.refs.some(t=>t.s===e.caret&&t.e===e.caretEnd):!1}var um=[`#1a73e8`,`#e8710a`,`#9334e6`,`#188038`,`#d93025`,`#12a4b8`,`#e52592`,`#b08800`],dm=e=>e.replace(/\$/g,``).toUpperCase(),fm={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]},pm=e=>({r0:Math.min(e.ar,e.fr),c0:Math.min(e.ac,e.fc),r1:Math.max(e.ar,e.fr),c1:Math.max(e.ac,e.fc)});function mm(e,t){let n=e;for(let e=!0;e;){e=!1;for(let r of t)r.r1<n.r0||r.r0>n.r1||r.c1<n.c0||r.c0>n.c1||r.r0>=n.r0&&r.r1<=n.r1&&r.c0>=n.c0&&r.c1<=n.c1||(n={r0:Math.min(n.r0,r.r0),c0:Math.min(n.c0,r.c0),r1:Math.max(n.r1,r.r1),c1:Math.max(n.c1,r.c1)},e=!0)}return n}function hm({store:e,sheet:t,meta:n,client:r,edit:i,setEdit:a,hold:o,onSheet:s}){let c=kl(),l=c.editable,d=e.sheet(t),[f,p]=Gc(),m=Kc(f),[h,g]=(0,u.useState)(()=>d.sel??{ar:0,ac:0,fr:0,fc:0});d.sel=h;let[_,v]=(0,u.useState)(null),y=_&&_.r===h.ar&&_.c===h.ac?_.d:void 0,[b,x]=(0,u.useState)(0),S=(0,u.useRef)(!1),C=(0,u.useRef)(null),w=(0,u.useRef)(null),T=(0,u.useRef)(null),[E,D]=(0,u.useState)(0),[ee,O]=(0,u.useState)(null),[te,ne]=(0,u.useState)(null),re=(0,u.useRef)(null),[ie,ae]=(0,u.useState)({open:!1,q:``,idx:0,replace:!1,tick:0}),[oe,k]=(0,u.useState)({}),[se,ce]=(0,u.useState)([]),[A,le]=(0,u.useState)(null),[ue,de]=(0,u.useState)(null),{rowAxis:j,colAxis:M,frozen:N}=d,fe=Math.max(40,12+7*String(Math.max(d.rows,1e3)).length),pe=Math.max(0,p.w-fe),me=Math.max(0,p.h-$p);j.count=Math.max(d.rows+(d.done?20:1),Math.ceil(me/j.def)+1,N.rows+1,h.fr+2),M.count=Math.max(d.cols+3,26,Math.ceil(pe/Math.max(1,M.def))+1,N.cols+1,h.fc+2);let he=M.pos(N.cols),ge=j.pos(N.rows),P=M.total(),_e=j.total(),ve=fe+P,ye=Math.min($p+_e,em),be=Math.max(0,$p+_e-p.h),xe=Math.max(0,ye-p.h),F=xe>0?Math.min(be,m.y/xe*be):0,I=m.x,Se=he+I,Ce=ge+F,we=Math.max(0,pe-he),Te=Math.max(0,me-ge),Ee=j.index(Ce),De=Math.min(j.count-1,j.index(Ce+Te)),Oe=M.index(Se),ke=Math.min(M.count-1,M.index(Se+we)),L=(0,u.useMemo)(()=>d.merges.filter(e=>e.r1>=Ee&&e.r0<=De||e.r0<N.rows?e.c1>=Oe&&e.c0<=ke||e.c0<N.cols:!1),[d.merges,Ee,De,Oe,ke,N.rows,N.cols]);(0,u.useEffect)(()=>{N.rows&&e.ensure(t,0,N.rows-1),e.ensure(t,Math.max(0,Ee-20),De+40);for(let n of L)n.r0<Ee&&e.ensure(t,n.r0,n.r0)}),(0,u.useEffect)(()=>{let e=!0,{ar:n,ac:i}=h;return r.call(`xlsx.cell`,t,n,i).then(t=>e&&v({r:n,c:i,d:t}),()=>{}),()=>{e=!1}},[r,t,h.ar,h.ac,d.done,b]);let R=n.styles,z=Bp(n.baseFont.fontSize,14.67),Ae=(e,t)=>d.merges.find(n=>e>=n.r0&&e<=n.r1&&t>=n.c0&&t<=n.c1),B=mm(pm(h),d.merges),V=B.r0===B.r1&&B.c0===B.c1||d.merges.some(e=>e.r0===B.r0&&e.c0===B.c0&&e.r1===B.r1&&e.c1===B.c1),je=(0,u.useRef)(B);je.current=B,(0,u.useEffect)(()=>Vc(r,{sheet:t,range:B,ar:h.ar,ac:h.ac}),[r,t,B.r0,B.c0,B.r1,B.c1,h.ar,h.ac]);let Me=(0,u.useSyncExternalStore)(e=>Bc(r,e),()=>zc(r)),Ne=n.sheets[t]?.path,Pe=Me.flatMap(e=>{let t=e.presence;return t?.k===`xlsx`&&t.sheet===Ne&&t.range?[{...e,range:t.range,ar:t.ar??t.range.r0,ac:t.ac??t.range.c0}]:[]});(0,u.useLayoutEffect)(()=>{o.current=!1;let t=f.current;return t&&d.scrollPos&&(t.scrollLeft=d.scrollPos.x,t.scrollTop=d.scrollPos.y),e.focusGrid&&(e.focusGrid=!1,t?.focus({preventScroll:!0})),()=>{t?.isConnected&&(d.scrollPos={x:t.scrollLeft,y:t.scrollTop})}},[]);let Fe=e=>{let t=Ae(e.ar,e.ac);t&&(e={...e,ar:t.r0,ac:t.c0}),g(e)};function Ie(n,r,i,a,o,s,c,l,u,f,p){if(f<=0||p<=0||i<r||o<a)return null;let m=[];if(d.gridLines){for(let e=r;e<=i;e++)m.push((0,X.jsx)(`div`,{className:`de-gl-h`,style:{top:j.pos(e+1)-c-1}},`h`+e));for(let e=a;e<=o;e++)m.push((0,X.jsx)(`div`,{className:`de-gl-v`,style:{left:M.pos(e+1)-s-1}},`v`+e))}let g=new Set,_=[];for(let e of L)if(!(e.r1<r||e.r0>i||e.c1<a||e.c0>o)){_.push(e);for(let t=Math.max(e.r0,r);t<=Math.min(e.r1,i);t++)for(let n=Math.max(e.c0,a);n<=Math.min(e.c1,o);n++)g.add(t*16384+n)}let v=(e,t,n,r,i,a=!1)=>{let[l,u,d,f,p]=t,m=n??M.size(l),h=r??j.size(e);if(!m||!h)return null;let _=R[d]??{},v=u;f===1&&u&&(v=Vp(u,m-6,Bp(_.fontSize,z)));let{textAlign:y,textRotate:b,alignItems:x,whiteSpace:S,...C}=_,w=Number(b??0),T=y&&cm[y]||(f===1?`flex-end`:f===2?`center`:`flex-start`),E=0;if(v&&!w&&!S&&T===`flex-start`&&!a&&i){let t=l+1;for(;t<=o+8&&!i.has(t)&&!g.has(e*16384+t);)t++;E=M.pos(t)-M.pos(l)}let D={...C,left:M.pos(l)-s,top:j.pos(e)-c,width:m,height:h,justifyContent:T,alignItems:x??`flex-end`,textAlign:y??void 0};p&&(D.color=p),S&&(D.whiteSpace=S),a&&!C.background&&(D.background=`linear-gradient(#fff, #fff) 0 0 / calc(100% - 1px) calc(100% - 1px) no-repeat`);let ee=E>m;return(0,X.jsx)(`div`,{className:ee?`de-cell de-ov`:`de-cell`,style:D,children:v&&(0,X.jsx)(`span`,{style:w?sm(w):ee?{maxWidth:E-6,overflow:`hidden`,flex:`none`}:void 0,children:v})},`${e}:${l}`)};for(let n of _){let r=e.row(t,n.r0)?.find(e=>e[0]===n.c0)??[n.c0,``,0,0];m.push(v(n.r0,r,M.pos(n.c1+1)-M.pos(n.c0),j.pos(n.r1+1)-j.pos(n.r0),void 0,!0))}for(let n=r;n<=i;n++){let r=e.row(t,n);if(!r)continue;let i;for(let e of r){let t=e[0];t<a-8||t>o||g.has(n*16384+t)||t<a&&(!e[1]||e[3]!==0)||_.some(e=>e.r0===n&&e.c0===t)||(!i&&e[3]===0&&e[1]&&(i=new Set(r.filter(e=>e[1]!==``).map(e=>e[0]))),m.push(v(n,e,void 0,void 0,i)))}}if(B.r1>=r&&B.r0<=i&&B.c1>=a&&B.c0<=o&&!V&&m.push((0,X.jsx)(`div`,{className:`de-range`,style:{left:M.pos(B.c0)-s,top:j.pos(B.r0)-c,width:M.pos(B.c1+1)-M.pos(B.c0),height:j.pos(B.r1+1)-j.pos(B.r0)}},`range`)),h.ar>=r-1&&h.ar<=i&&h.ac>=a-1&&h.ac<=o){let e=Ae(h.ar,h.ac),t=e?M.pos(e.c1+1)-M.pos(e.c0):M.size(h.ac),n=e?j.pos(e.r1+1)-j.pos(e.r0):j.size(h.ar);m.push((0,X.jsx)(`div`,{className:`de-sel`,style:{left:M.pos(h.ac)-s-1,top:j.pos(h.ar)-c-1,width:t+1,height:n+1}},`sel`))}for(let e of Pe){let t=e.range;if(t.r1<r||t.r0>i||t.c1<a||t.c0>o)continue;let n=M.pos(t.c0),l=j.pos(t.r0),u=M.pos(t.c1+1),d=j.pos(t.r1+1);m.push((0,X.jsx)(`div`,{className:`de-peer-range`,style:{left:n-s-1,top:l-c-1,width:u-n+1,height:d-l+1,borderColor:e.color,background:e.color+`12`},children:e.ar>=r&&e.ar<=i&&e.ac>=a&&e.ac<=o&&(0,X.jsx)(`span`,{className:`de-peer-tag`,style:{background:e.color},children:e.name})},`peer`+e.site))}return Vt.forEach((e,t)=>{e.r<r||e.r>i||e.c<a||e.c>o||m.push((0,X.jsx)(`div`,{className:t===ie.idx?`de-findcell on`:`de-findcell`,style:{left:M.pos(e.c)-s,top:j.pos(e.r)-c,width:M.size(e.c),height:j.size(e.r)}},`fm`+t))}),ot.forEach((e,t)=>{if(e.r1<r||e.r0>i||e.c1<a||e.c0>o)return;let n=j.pos(Math.max(e.r0,r-1)),l=j.pos(Math.min(e.r1,i+1)+1),u=M.pos(Math.max(e.c0,a-1)),d=M.pos(Math.min(e.c1,o+1)+1);m.push((0,X.jsx)(`div`,{className:e.point?`de-fref de-fref-pt`:`de-fref`,style:{left:u-s-1,top:n-c-1,width:d-u+1,height:l-n+1,borderColor:e.color,background:e.color+`14`}},`fr`+t))}),(0,X.jsx)(`div`,{className:`de-region`,style:{left:l,top:u,width:f,height:p},children:m},n)}function Le(e,t,n,r,i,a){if(a<=0)return null;let o=[];for(let e=t;e<=n;e++){let t=M.size(e);t&&(o.push((0,X.jsx)(`div`,{"data-col":e,className:e>=B.c0&&e<=B.c1?`de-head-c de-head-on`:`de-head-c`,style:{left:M.pos(e)-r,top:0,width:t,height:$p},children:$o(e)},e)),l&&o.push((0,X.jsx)(`div`,{"data-grip-col":e,className:`de-grip-c`,style:{left:M.pos(e+1)-r-3,height:$p}},`g`+e)))}return(0,X.jsx)(`div`,{className:`de-region`,style:{left:i,top:0,width:a,height:$p},children:o},e)}function Re(e,t,n,r,i,a){if(a<=0)return null;let o=[];for(let e=t;e<=n;e++){let t=j.size(e);t&&(o.push((0,X.jsx)(`div`,{"data-row":e,className:e>=B.r0&&e<=B.r1?`de-head-r de-head-on`:`de-head-r`,style:{left:0,top:j.pos(e)-r,width:fe,height:t},children:e+1},e)),l&&o.push((0,X.jsx)(`div`,{"data-grip-row":e,className:`de-grip-r`,style:{top:j.pos(e+1)-r-3,width:fe}},`g`+e)))}return(0,X.jsx)(`div`,{className:`de-region`,style:{left:0,top:i,width:fe,height:a},children:o},e)}let ze=N.rows,Be=N.cols,Ve=Math.min(he,pe),He=Math.min(ge,me),Ue=(e,t)=>{let n=Ae(e,t);return{x:fe+M.pos(t)-(t>=Be?I:0),y:$p+j.pos(e)-(e>=ze?F:0),w:n?M.pos(n.c1+1)-M.pos(n.c0):M.size(t),h:n?j.pos(n.r1+1)-j.pos(n.r0):j.size(e)}},We=(e,t)=>{let n=f.current;if(!n)return;let r=M.pos(t),i=j.pos(e);if(t>=Be&&(r-he<I?n.scrollLeft=r-he:r+M.size(t)>Se+we&&(n.scrollLeft=r+M.size(t)-he-we)),e>=ze&&be>0){let t=F;i-ge<F?t=i-ge:i+j.size(e)>Ce+Te&&(t=i+j.size(e)-ge-Te),t!==F&&(n.scrollTop=t/be*xe)}},Ge=(e,t,n)=>{let r=n.getBoundingClientRect(),i=e-r.left-fe,a=t-r.top-$p,o=i<he?i:i+I,s=a<ge?a:a+F;return{r:a<0?-1:j.index(Math.max(0,s)),c:i<0?-1:M.index(Math.max(0,o))}},Ke=()=>f.current?.focus({preventScroll:!0}),qe=(n,r)=>e.row(t,n)?.find(e=>e[0]===r)?.[2]??0,H=async t=>{try{let r=await t;e.applied(r,n),r&&c.setDirty(!0),x(e=>e+1)}catch(e){console.error(`[office-engine]`,e)}},Je=(r,i,a)=>r?r.formula?r.formula:r.type===`number`&&/[dmyhs]/i.test((n.formats[qe(i,a)]??``).replace(/"[^"]*"|\[[^\]]*\]/g,``))?e.row(t,i)?.find(e=>e[0]===a)?.[1]??r.value:r.value:``,Ye=async(e,n=!1)=>{if(!l||!d.done||i)return;let{ar:o,ac:s}=h,c=(e,r,i)=>a({sheet:t,r:o,c:s,value:e,initial:r,bar:n,mode:i,caret:e.length,caretEnd:e.length,sync:+!n});if(e!==void 0)return c(e,`\0`,`enter`);let u=_&&_.r===o&&_.c===s?_.d:await r.call(`xlsx.cell`,t,o,s).catch(()=>void 0),f=Je(u,o,s);c(f,f,`edit`)},Xe=(0,u.useRef)(null),Ze=e=>{let n=i;if(!n||Xe.current===n)return;Xe.current=n,a(null);let o=So(n.value);if(o!==n.initial&&H(r.call(`xlsx.set`,n.sheet,[{r:n.r,c:n.c,input:o}])),n.sheet!==t)return $e(n,e);e&&vt(e[0],e[1],!1),Ke()},Qe=()=>{let e=i;if(a(null),e&&e.sheet!==t)return $e(e);Ke()},$e=(t,n)=>{let r=Math.max(0,t.r+(n?.[0]??0)),i=Math.max(0,t.c+(n?.[1]??0));e.sheet(t.sheet).sel={ar:r,ac:i,fr:r,fc:i},e.focusGrid=!0,s(t.sheet)},et=!!i&&i.sheet===t,tt=et&&!i?.bar,nt=i&&_o(i.value)?bo(i.value,i.caret):null,rt=!!i&&lm(i,nt),it=!!i?.point&&i.point.e===i.caret&&i.caret===i.caretEnd,at=[],ot=[];if(nt&&i){let e=new Map;for(let r of nt.refs){let a=dm(r.text),o=e.get(a);o||e.set(a,o=um[e.size%um.length]),at.push({s:r.s,e:r.e,color:o});let s=r.ref.sheet;(s===void 0?i.sheet:n.sheets.findIndex(e=>e.name.toLowerCase()===s.toLowerCase()))===t&&ot.push({r0:r.ref.r0,c0:r.ref.c0,r1:r.ref.r1,c1:r.ref.c1,color:o,point:it&&r.s===i.point.s})}}let st=nt?.word&&i?.noSuggest!==nt.word.s&&i?.caret===i?.caretEnd?nt.word:void 0,ct=st?Do(st.text,8):[],lt=!ct.length&&nt?.call?Eo(nt.call.name):void 0,ut=st?`${st.s}:${st.text}`:``;(0,u.useEffect)(()=>D(0),[ut]);let dt=()=>tt?C.current:T.current;(0,u.useLayoutEffect)(()=>{if(!i)return;let e=dt();e&&(e.getRootNode().activeElement!==e&&e.focus({preventScroll:!0}),i.sync&&e.setSelectionRange(i.caret,i.caretEnd))},[i?.sync,tt,i!==null]);let ft=e=>{let t=e.selectionStart??e.value.length,n=e.selectionEnd??t;a(e=>e&&(e.caret!==t||e.caretEnd!==n)?{...e,caret:t,caretEnd:n}:e)},pt=e=>{let t=e.value,n=e.selectionStart??t.length,r=e.selectionEnd??n;a(e=>e&&{...e,value:t,caret:n,caretEnd:r,point:void 0})},mt=(e,r,i,o)=>{a(a=>{if(!a)return a;let s=xo(e,r,i,o,t===a.sheet?void 0:n.sheets[t]?.name),c=a.point&&a.point.e===a.caret&&a.caret===a.caretEnd,l=c?a.point.s:a.caret,u=c?a.point.e:a.caretEnd;if(c&&a.value.slice(l,u)===s)return a;let d=l+s.length;return{...a,value:a.value.slice(0,l)+s+a.value.slice(u),caret:d,caretEnd:d,sync:a.sync+1,point:{s:l,e:d,sheet:t,ar:e,ac:r,fr:i,fc:o}}})},ht=(0,u.useRef)(null),gt=(e,n,r)=>{let a=i?.point&&it&&i.point.sheet===t?i.point:null,o=a?a.ar:et?i.r:h.ar,s=a?a.ac:et?i.c:h.ac,c=e=>Math.max(0,Math.min(j.count-1,e)),l=e=>Math.max(0,Math.min(M.count-1,e));if(r){let t=c((a?a.fr:o)+e),r=l((a?a.fc:s)+n);mt(o,s,t,r),We(t,r)}else{let t=c(o+e),r=l(s+n);mt(t,r,t,r),We(t,r)}},_t=e=>{let t=st;t&&a(n=>{if(!n)return n;let r=!e.args.length&&!e.variadic,i=e.name+(t.call?``:r?`()`:`(`),a=t.s+e.name.length+(r&&!t.call?2:1);return{...n,value:n.value.slice(0,t.s)+i+n.value.slice(t.e),caret:a,caretEnd:a,sync:n.sync+1,point:void 0}})},vt=(e,t,n)=>{let r=n?h.fr:h.ar,i=n?h.fc:h.ac,a=n?void 0:Ae(h.ar,h.ac),o=r+e,s=i+t;for(a&&e>0&&(o=a.r1+e),a&&t>0&&(s=a.c1+t),o=Math.max(0,Math.min(j.count-1,o)),s=Math.max(0,Math.min(M.count-1,s));o>0&&j.size(o)===0&&e<0;)o--;for(;j.size(o)===0&&o<j.count-1;)o++;for(;s>0&&M.size(s)===0&&t<0;)s--;for(;M.size(s)===0&&s<M.count-1;)s++;n?g({...h,fr:o,fc:s}):Fe({ar:o,ac:s,fr:o,fc:s}),We(o,s)},yt=()=>{let n=[],i={...B,r1:Math.min(B.r1,B.r0+5e3),c1:Math.min(B.c1,B.c0+200)};for(let r=i.r0;r<=i.r1;r++){let a=e.row(t,r);for(let e=i.c0;e<=i.c1;e++)a?.some(t=>t[0]===e&&t[1]!==``)&&n.push({r,c:e,input:``})}n.length&&H(r.call(`xlsx.set`,t,n))},bt=R[qe(h.ar,h.ac)]??{},xt=e=>St(B,e),St=(e,n)=>{H(r.call(`xlsx.format`,t,e,n)),Ke()},Ct=e=>{let t=e===`b`?bt.fontWeight===700:e===`i`?bt.fontStyle===`italic`:String(bt.textDecoration??``).includes(e===`u`?`underline`:`line-through`);xt({[e]:!t})},wt=()=>void H(r.call(`xlsx.undo`)),Tt=()=>void H(r.call(`xlsx.redo`)),Et=()=>{let n=[],r={...B,r1:Math.min(B.r1,B.r0+2e4)};for(let i=r.r0;i<=r.r1;i++){let a=e.row(t,i),o=[];for(let e=r.c0;e<=r.c1;e++)o.push(a?.find(t=>t[0]===e)?.[1]??``);n.push(o.join(` `))}return n.join(`
|
|
82
|
+
`)},Dt=e=>{if(i)return;let t=e.metaKey||e.ctrlKey,n=e.key.toLowerCase();if(t&&n===`s`){e.preventDefault(),c.save();return}if(t&&n===`a`&&!e.altKey&&!e.shiftKey){e.preventDefault(),Fe({ar:0,ac:0,fr:Math.max(0,d.rows-1),fc:Math.max(0,d.cols-1)});return}if(l&&t&&!e.altKey){if(n===`z`){e.preventDefault(),e.shiftKey?Tt():wt();return}if(n===`y`){e.preventDefault(),Tt();return}if(n===`b`||n===`i`||n===`u`){e.preventDefault(),Ct(n);return}if(n===`d`||n===`r`){e.preventDefault(),At({op:`fill`,range:B,dir:n===`d`?`down`:`right`});return}if(n===`\\`){e.preventDefault(),xt({clear:!0});return}if(n===`x`&&e.shiftKey){e.preventDefault(),Ct(`strike`);return}}if(t&&(n===`f`||n===`h`)){e.preventDefault(),ae(e=>({...e,open:!0,replace:n===`h`||e.replace,tick:e.tick+1}));return}if(e.key===`Escape`&&te!==null){ne(null);return}let r=Math.max(1,Math.floor(Te/j.def)-1),a={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1],PageDown:[r,0],PageUp:[-r,0]};if(a[e.key]){e.preventDefault();let[n,r]=a[e.key];t?vt(n?n>0?Math.max(0,d.rows-1-(e.shiftKey?h.fr:h.ar)):-1e9:0,r?r>0?Math.max(0,d.cols-1-(e.shiftKey?h.fc:h.ac)):-1e9:0,e.shiftKey):vt(n,r,e.shiftKey)}else e.key===`Enter`||e.key===`Tab`?(e.preventDefault(),e.key===`Enter`?vt(e.shiftKey?-1:1,0,!1):vt(0,e.shiftKey?-1:1,!1)):l&&(e.key===`F2`?(e.preventDefault(),Ye()):e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),yt()):e.key.length===1&&!t&&!e.altKey&&(e.preventDefault(),Ye(e.key)))},Ot=e=>{if(e.button!==0)return;let n=e.target.closest(`[data-grip-col],[data-grip-row]`);if(n){e.preventDefault();let t=n.dataset.gripCol,r=Number(t??n.dataset.gripRow);de(t===void 0?{axis:`row`,i:r,start:e.clientY,size:j.size(r)}:{axis:`col`,i:r,start:e.clientX,size:M.size(r)});return}let r=e.currentTarget,{r:a,c:o}=Ge(e.clientX,e.clientY,r);if(i&&rt){if(e.preventDefault(),a<0&&o<0)return;let n=a<0?`col`:o<0?`row`:`cell`,[r,s]=[Math.max(a,0),Math.max(o,0)],c=n===`cell`?Ae(a,o):void 0;c&&([r,s]=[c.r0,c.c0]);let l=e.shiftKey&&it&&i.point.sheet===t?i.point:null;l&&([r,s]=[l.ar,l.ac]),ht.current={ar:r,ac:s,axis:n},kt(r,s,a,o,n)}else{if(i&&Ze(),e.preventDefault(),te!==null&&a>=0&&o>=0){let e=te;re.current=()=>{ne(null),St(je.current,{xf:e})}}Ke(),a<0&&o<0?Fe({ar:0,ac:0,fr:Math.max(0,d.rows-1),fc:Math.max(0,d.cols-1)}):(a<0?Fe({ar:0,ac:o,fr:Math.max(0,d.rows-1),fc:o}):o<0?Fe({ar:a,ac:0,fr:a,fc:Math.max(0,d.cols-1)}):e.shiftKey?g({...h,fr:a,fc:o}):Fe({ar:a,ac:o,fr:a,fc:o}),a>=0&&o>=0&&(S.current=!0))}},kt=(e,t,n,r,i)=>{if(i===`col`)mt(0,t,vr,Math.max(0,r));else if(i===`row`)mt(e,0,Math.max(0,n),yr);else{let i=Ae(n,r),a=i&&!(e>=i.r0&&e<=i.r1&&t>=i.c0&&t<=i.c1)?i:void 0,o=a?a.r0<e?a.r0:a.r1:Math.max(0,n),s=a?a.c0<t?a.c0:a.c1:Math.max(0,r);mt(e,t,o,s)}};(0,u.useEffect)(()=>{let e=()=>{S.current=!1,ht.current=null;let e=re.current;re.current=null,e&&setTimeout(e,0)};return window.addEventListener(`mouseup`,e),()=>window.removeEventListener(`mouseup`,e)},[]),(0,u.useEffect)(()=>{if(!ue)return;let e=ue.axis===`col`?M:j,t=t=>{let n=(ue.axis===`col`?t.clientX:t.clientY)-ue.start;e.set(ue.i,Math.max(ue.axis===`col`?8:6,Math.round(ue.size+n))),x(e=>e+1)},n=()=>{let t=e.size(ue.i);de(null);let[n,r]=(ue.axis===`col`?B.r0===0&&B.r1>=d.rows-1&&ue.i>=B.c0&&ue.i<=B.c1:B.c0===0&&B.c1>=d.cols-1&&ue.i>=B.r0&&ue.i<=B.r1)?ue.axis===`col`?[B.c0,B.c1]:[B.r0,B.r1]:[ue.i,ue.i];At(ue.axis===`col`?{op:`colWidth`,c0:n,c1:r,px:t}:{op:`rowHeight`,r0:n,r1:r,px:t})};return window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n,{once:!0}),()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)}});let At=e=>H(r.call(`xlsx.sheetOp`,t,e)),jt=d.merges.some(e=>e.r0>=B.r0&&e.r1<=B.r1&&e.c0>=B.c0&&e.c1<=B.c1),Mt=()=>void At({op:jt?`unmerge`:`merge`,range:B}),Nt=e=>void At(e===`unmerge`?{op:`unmerge`,range:B}:{op:`merge`,range:B,mode:e}),Pt=e=>void At({op:`freeze`,rows:e===`row`?1:e===`sel`?h.ar:0,cols:e===`col`?1:e===`sel`?h.ac:0}),Ft=(n=`SUM`)=>{let{ar:i,ac:a}=h;if(!V){let e=`${$o(B.c0)}${B.r0+1}:${$o(B.c1)}${B.r1+1}`;H(r.call(`xlsx.set`,t,[{r:B.r1+1,c:B.c0,input:`=${n}(${e})`}]));return}let o=(n,r)=>e.row(t,n)?.find(e=>e[0]===r)?.[3]===1,s=i-1;for(;s>=0&&o(s,a);)s--;let c=``;if(s<i-1)c=`${$o(a)}${s+2}:${$o(a)}${i}`;else{let e=a-1;for(;e>=0&&o(i,e);)e--;e<a-1&&(c=`${$o(e+1)}${i+1}:${$o(a-1)}${i+1}`)}if(!c)return void Ye(`=${n}(`);H(r.call(`xlsx.set`,t,[{r:i,c:a,input:`=${n}(${c})`}]))},It=e=>{let t=B.r0===B.r1?{r0:N.rows,c0:0,r1:Math.max(N.rows,d.rows-1),c1:Math.max(0,d.cols-1)}:B;At({op:`sort`,range:t,col:h.ac,desc:e})},Lt=e=>{let t=B.r1-B.r0+1,n=B.c1-B.c0+1,r={rowAbove:{op:`insertRows`,at:B.r0,n:t},rowBelow:{op:`insertRows`,at:B.r1+1,n:t},colLeft:{op:`insertCols`,at:B.c0,n},colRight:{op:`insertCols`,at:B.c1+1,n},delRow:{op:`deleteRows`,at:B.r0,n:t},delCol:{op:`deleteCols`,at:B.c0,n},hideRows:{op:`hideRows`,a:B.r0,b:B.r1,hidden:!0},hideCols:{op:`hideCols`,a:B.c0,b:B.c1,hidden:!0},unhideRows:{op:`hideRows`,a:Math.max(0,B.r0-+(t===1)),b:B.r1+ +(t===1),hidden:!1},unhideCols:{op:`hideCols`,a:Math.max(0,B.c0-+(n===1)),b:B.c1+ +(n===1),hidden:!1}};r[e]&&At(r[e])},Rt=e=>{let n=e.replace(/\r\n?/g,`
|
|
83
83
|
`).replace(/\n$/,``).split(`
|
|
84
|
-
`).flatMap((e,t)=>e.split(` `).map((e,n)=>({r:h.ar+t,c:h.ac+n,input:e})));n.length&&H(r.call(`xlsx.set`,t,n.slice(0,1e5)))},zt=()=>{let e=B.r1-B.r0+1,t=B.c1-B.c0+1,n=e===1?`row ${B.r0+1}`:`rows ${B.r0+1}–${B.r1+1}`,r=t===1?`column ${$o(B.c0)}`:`columns ${$o(B.c0)}–${$o(B.c1)}`,i=e===1&&t===1;return[{label:`Cut`,icon:`cut`,hint:`${Q}X`,run:()=>document.execCommand(`cut`)},{label:`Copy`,icon:`copy`,hint:`${Q}C`,run:()=>document.execCommand(`copy`)},{label:`Paste`,icon:`paste`,hint:`${Q}V`,run:()=>void navigator.clipboard?.readText().then(Rt).catch(()=>le(`The browser blocked clipboard access — use ${Q}V to paste`))},{label:`Insert ${e} row${e>1?`s`:``} above`,icon:`rowAbove`,sep:!0,run:()=>Lt(`rowAbove`)},{label:`Insert ${e} row${e>1?`s`:``} below`,icon:`rowBelow`,run:()=>Lt(`rowBelow`)},{label:`Insert ${t} column${t>1?`s`:``} left`,icon:`colLeft`,run:()=>Lt(`colLeft`)},{label:`Insert ${t} column${t>1?`s`:``} right`,icon:`colRight`,run:()=>Lt(`colRight`)},{label:`Delete ${n}`,icon:`delRow`,sep:!0,run:()=>Lt(`delRow`)},{label:`Delete ${r}`,icon:`delCol`,run:()=>Lt(`delCol`)},{label:`Hide ${n}`,icon:`hide`,sep:!0,run:()=>Lt(`hideRows`)},{label:`Hide ${r}`,icon:`hide`,run:()=>Lt(`hideCols`)},{label:`Unhide rows`,icon:`view`,run:()=>Lt(`unhideRows`)},{label:`Unhide columns`,icon:`view`,run:()=>Lt(`unhideCols`)},{label:jt?`Unmerge cells`:`Merge cells`,icon:`merge`,sep:!0,run:Mt,disabled:i&&!jt},{label:`Sort ${i?`sheet`:`range`} by ${$o(h.ac)}, A → Z`,icon:`sortAZ`,run:()=>It(!1)},{label:`Sort ${i?`sheet`:`range`} by ${$o(h.ac)}, Z → A`,icon:`sortZA`,run:()=>It(!0)},{label:`Fill down`,icon:`down`,hint:`${Q}D`,run:()=>void At({op:`fill`,range:B,dir:`down`}),disabled:e===1},{label:`Fill right`,hint:`${Q}R`,run:()=>void At({op:`fill`,range:B,dir:`right`}),disabled:t===1},{label:`Clear contents`,icon:`trash`,hint:`Del`,sep:!0,run:yt},{label:`Clear formatting`,icon:`clear`,hint:`${Q}\\`,run:()=>xt({clear:!0})},{label:`Freeze up to ${$o(h.ac)}${h.ar+1}`,icon:`freeze`,sep:!0,run:()=>Pt(`sel`)},{label:`Unfreeze`,run:()=>Pt(`none`),disabled:!N.rows&&!N.cols}]};(0,u.useEffect)(()=>{if(!ie.open||!ie.q){ce([]);return}let e=!0,n=setTimeout(()=>{r.call(`xlsx.find`,t,ie.q,oe).then(t=>e&&ce(t),()=>{})},150);return()=>{e=!1,clearTimeout(n)}},[r,t,ie.open,ie.q,ie.tick,oe,b]);let Bt=e=>{let t=se[e];t&&(ae(t=>({...t,idx:e})),Fe({ar:t.r,ac:t.c,fr:t.r,fc:t.c}),We(t.r,t.c))},Vt=ie.open?se:[],Ht=e=>{let t=ht.current;if(t){let{r:n,c:r}=Ge(e.clientX,e.clientY,e.currentTarget);kt(t.ar,t.ac,n,r,t.axis);return}if(!S.current)return;let{r:n,c:r}=Ge(e.clientX,e.clientY,e.currentTarget);n>=0&&r>=0&&(n!==h.fr||r!==h.fc)&&g(e=>({...e,fr:n,fc:r}))},Ut=i&&et?Ue(i.r,i.c):null,Wt=i?i.value:Je(y,h.ar,h.ac),Gt=e=>{if(!i||e.nativeEvent.isComposing)return;let t=e.metaKey||e.ctrlKey;if(ct.length){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=ct.length;D(n=>(Math.min(n,t-1)+(e.key===`ArrowDown`?1:t-1))%t);return}if(e.key===`Tab`||e.key===`Enter`&&!e.altKey&&!e.shiftKey){e.preventDefault(),_t(ct[Math.min(E,ct.length-1)]);return}if(e.key===`Escape`){e.preventDefault();let t=st?.s;a(e=>e&&{...e,noSuggest:t});return}}let n=
|
|
85
|
-
`).length*18+4),...n.baseFont}:void 0,Jt=[];if(i&&at.length){let e=0;for(let t of at)t.s>e&&Jt.push(i.value.slice(e,t.s)),Jt.push((0,X.jsx)(`span`,{style:{color:t.color},children:i.value.slice(t.s,t.e)},t.s)),e=t.e;Jt.push(i.value.slice(e)+``)}let Yt=(()=>{if(!qt||!Kt)return;let e=qt.top+qt.height+2;return e+200>p.h&&qt.top>200?{left:qt.left,bottom:p.h-qt.top+2}:{left:qt.left,top:e}})();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`de-fx`,children:[(0,X.jsxs)(`div`,{className:`de-fx-ref`,children:[$o(h.ac),h.ar+1,!V&&`:${$o(B.c1)}${B.r1+1}`]}),l?(0,X.jsx)(`input`,{ref:T,className:`de-fx-val de-fx-input`,value:Wt,spellCheck:!1,"aria-label":`Cell content`,onFocus:()=>!i&&void Ye(void 0,!0),onChange:e=>pt(e.target),onSelect:e=>ft(e.currentTarget),onKeyDown:Gt,onBlur:()=>{o.current||i&&(i.bar||!et)&&Ze()}}):(0,X.jsx)(`div`,{className:`de-fx-val`,title:Wt,children:Wt}),i&&!tt&&Kt&&(0,X.jsx)(`div`,{className:`de-fassist-at`,style:{left:88,top:30},children:Kt})]}),(0,X.jsx)(`div`,{ref:f,className:`de-grid`,tabIndex:0,onKeyDown:Dt,onCopy:e=>{i||(e.preventDefault(),e.clipboardData.setData(`text/plain`,Et()))},onCut:e=>{!i&&l&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,Et()),yt())},onPaste:e=>{!i&&l&&(e.preventDefault(),Rt(e.clipboardData.getData(`text/plain`)))},children:(0,X.jsx)(`div`,{style:{position:`relative`,width:Math.max(ve,p.w),height:Math.max(ye,p.h)},children:(0,X.jsxs)(`div`,{className:`de-grid-view`,style:{width:p.w,height:p.h,...n.baseFont},onMouseDown:Ot,onMouseMove:Ht,onContextMenu:e=>{if(!l)return;e.preventDefault();let{r:t,c:n}=Ge(e.clientX,e.clientY,e.currentTarget);t>=0&&n>=0&&(t<B.r0||t>B.r1||n<B.c0||n>B.c1)&&Fe({ar:t,ac:n,fr:t,fc:n}),O({x:e.clientX,y:e.clientY})},onDoubleClick:()=>!i&&void Ye(),children:[Ie(`main`,Ee,De,Oe,ke,Se,Ce,fe+Ve,Qp+He,we,Te),ze>0&&Ie(`top`,0,ze-1,Oe,ke,Se,0,fe+Ve,Qp,we,He),Be>0&&Ie(`left`,Ee,De,0,Be-1,0,Ce,fe,Qp+He,Ve,Te),ze>0&&Be>0&&Ie(`tl`,0,ze-1,0,Be-1,0,0,fe,Qp,Ve,He),Le(`ch`,Oe,ke,Se,fe+Ve,we),Be>0&&Le(`chf`,0,Be-1,0,fe,Ve),Re(`rh`,Ee,De,Ce,Qp+He,Te),ze>0&&Re(`rhf`,0,ze-1,0,Qp,He),ze>0&&(0,X.jsx)(`div`,{className:`de-freeze-h`,style:{left:0,top:Qp+He-1,width:p.w,height:2}}),Be>0&&(0,X.jsx)(`div`,{className:`de-freeze-v`,style:{left:fe+Ve-1,top:0,width:2,height:p.h}}),(0,X.jsx)(`div`,{className:`de-corner`,style:{width:fe,height:Qp}}),i&&tt&&qt&&(0,X.jsxs)(X.Fragment,{children:[Jt.length>0&&(0,X.jsx)(`div`,{ref:w,className:`de-cell-edit de-cell-hl`,style:qt,"aria-hidden":!0,children:Jt}),(0,X.jsx)(`textarea`,{ref:C,className:Jt.length?`de-cell-edit de-cell-edit-fx`:`de-cell-edit`,spellCheck:!1,value:i.value,style:qt,onMouseDown:e=>e.stopPropagation(),onChange:e=>pt(e.target),onSelect:e=>ft(e.currentTarget),onScroll:e=>{w.current&&(w.current.scrollTop=e.currentTarget.scrollTop)},onKeyDown:Gt,onBlur:e=>{if(!o.current){if(e.relatedTarget&&e.relatedTarget===T.current)return a(e=>e&&{...e,bar:!0,sync:0});Ze()}}}),Kt&&Yt&&(0,X.jsx)(`div`,{className:`de-fassist-at`,style:Yt,children:Kt})]})]})})}),l&&(0,X.jsx)(Lp,{css:bt,base:n.baseFont,format:n.formats[qe(h.ar,h.ac)]??`General`,merged:jt,frozen:!!(N.rows||N.cols),gridlines:d.gridLines,painter:te!==null,onToggle:Ct,onFormat:xt,onUndo:wt,onRedo:Tt,onPaint:()=>{ne(e=>e===null?qe(h.ar,h.ac):null),Ke()},onMerge:Nt,onFreeze:Pt,onGridlines:()=>void At({op:`gridlines`,show:!d.gridLines}),onFunc:e=>e?Ft(e):void Ye(`=`),onSort:It,onRows:Lt,onFind:()=>ae(e=>({...e,open:!0,tick:e.tick+1}))}),ie.open&&(0,X.jsx)(Gu,{query:ie.q,index:ie.idx,count:se.length,editable:l,replace:ie.replace,placeholder:`Find in sheet`,onQuery:e=>ae(t=>({...t,q:e,idx:0})),onNav:e=>se.length&&Bt((ie.idx+e+se.length)%se.length),onClose:()=>{ae(e=>({...e,open:!1})),Ke()},onReplace:(e,n)=>{let i=se[Math.min(ie.idx,se.length-1)];i&&H(r.call(`xlsx.replace`,t,ie.q,e,oe,n?void 0:{r:i.r,c:i.c}))},options:(0,X.jsx)(X.Fragment,{children:[[`matchCase`,`Match case`],[`whole`,`Entire cell`],[`formulas`,`In formulas`]].map(([e,t])=>(0,X.jsxs)(`label`,{className:`de-find-opt`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:!!oe[e],onChange:t=>k(n=>({...n,[e]:t.target.checked}))}),t]},e))})}),A&&(0,X.jsx)(zl,{text:A,onDone:()=>le(null)}),ee&&(0,X.jsx)(Il,{x:ee.x,y:ee.y,items:zt(),onClose:()=>O(null)})]})}var hm=new Set([`open`,`part`,`docx.start`,`save`,`dirty`]),gm=e=>e.t===`p`?e.pid===void 0?null:{p:e.pid}:e.t===`tbl`?{tid:e.tid,item:e.item}:null;function _m(e,t){return e?`p`in t?e.t===`p`&&e.pid===t.p:e.t===`tbl`&&(t.tid!==void 0&&e.tid===t.tid||t.item!==void 0&&e.item===t.item):!1}var vm=e=>[...new Set(e)];function ym(e,t=[]){for(let n of e)if(n.t===`p`&&n.pid!==void 0)t.push(n.pid);else if(n.t===`tbl`)for(let e of n.rows)for(let n of e.cells)ym(n.blocks,t);return t}function bm(e){if(e.t!==`text`)return JSON.stringify(e);let{text:t,...n}=e;return JSON.stringify(n)}function xm(e,t){let n=e=>{let t=[];for(let n of e){let e=bm(n);if(n.t===`text`)for(let r=0;r<n.text.length;r++)t.push(e+`\0`+n.text[r]);else t.push(e)}return t},r=n(e),i=n(t),a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a++;let o=0;for(;o<r.length-a&&o<i.length-a&&r[r.length-1-o]===i[i.length-1-o];)o++;if(a===r.length&&a===i.length)return null;let[,s]=Jl(t,a),[c]=Jl(s,i.length-a-o);return{at:a,del:r.length-a-o,ins:c}}function Sm(e,t,n,r){let i=Vl(e),a=Math.max(0,Math.min(t,i)),o=Math.max(0,Math.min(n,i-a)),[s,c]=Jl(e,a),[,l]=Jl(c,o);return[...s,...r,...l]}function Cm(e,t,n,r,i){return e<t||e===t&&(n>0||i)?e:e>=t+n?e-n+r:t+r}function wm(e,t,n){if(t===n)return e;let r=0;for(;r<t.length&&r<n.length&&t[r]===n[r];)r++;let i=0;for(;i<t.length-r&&i<n.length-r&&t[t.length-1-i]===n[n.length-1-i];)i++;return e<=r?e:e>=t.length-i?n.length-(t.length-e):n.length-i}var Tm=(e,t)=>e.pid===t.pid&&e.from===t.from&&e.sid===t.sid&&!!e.pb==!!t.pb&&e.keepSect===t.keepSect&&JSON.stringify(e.pd??null)===JSON.stringify(t.pd??null)&&JSON.stringify(e.ps)===JSON.stringify(t.ps)&&JSON.stringify(e.orig??null)===JSON.stringify(t.orig??null),Em=class{constructor(e){A(this,`client`,void 0),A(this,`host`,void 0),A(this,`suppress`,0),A(this,`res`,new Map),A(this,`resKey`,new Map),A(this,`results`,new WeakMap),A(this,`snap`,null),A(this,`touchedModel`,!1),A(this,`site`,0),A(this,`counter`,0),A(this,`offHost`,void 0),A(this,`onPresence`,void 0),A(this,`lastPresence`,``),A(this,`raf`,0),A(this,`push`,void 0),A(this,`submit`,void 0),A(this,`onSel`,()=>{!this.raf&&this.host&&(this.raf=requestAnimationFrame(()=>{this.raf=0;let e=this.host&&this.ed.input.readSel();if(!e)return;let t=this.toD(e.a),n=this.toD(e.f);if(!t||!n)return;let r={k:`docx`,a:t,f:n},i=JSON.stringify(r);i!==this.lastPresence&&(this.lastPresence=i,this.onPresence?.(r))}))}),this.client=e}ready(){return new Promise(e=>{this.offHost=Pc(this.client,`docx`,t=>{this.host?.editor!==t.editor&&(this.host&&(this.host.editor.onCommit=void 0),this.host=t,t.editor.onCommit=e=>this.onCommit(e),this.allocPids(),e())}),typeof document<`u`&&document.addEventListener(`selectionchange`,this.onSel)})}setSite(e){this.site=e,this.allocPids()}allocPids(){let e=this.host?.editor;if(!e||!this.site)return;let t=2e9+this.site*1e7;(e.nextPid<t||e.nextPid>=t+1e7)&&(e.nextPid=t)}dispose(){this.offHost?.(),this.host&&(this.host.editor.onCommit=void 0),typeof document<`u`&&document.removeEventListener(`selectionchange`,this.onSel),this.raf&&cancelAnimationFrame(this.raf)}captures(e){return!this.suppress&&!hm.has(e)&&e!==`docx.edit`&&e!==`docx.table`&&e.startsWith(`docx.`)}intercept(e,t){if(this.submit&&this.captures(e)){switch(e){case`docx.image`:{let e=new Uint8Array(t[0].slice(0));return this.submit({t:`image`,key:this.key(),bytes:e,ext:t[1]})}case`docx.link`:return this.submit({t:`link`,key:this.key(),url:t[0]})}return this.submit({t:`call`,method:e,args:t})}}key(){return`${this.site}:${++this.counter}:${Math.random().toString(36).slice(2,7)}`}get st(){return this.host.st}get ed(){return this.host.editor}locate(e){let t=[];return this.st.blocks.forEach((n,r)=>{n.t===`p`?n.pid===e&&t.push({list:this.st.blocks,index:r,pa:String(r),p:n}):n.t===`tbl`&&n.rows.forEach((n,i)=>n.cells.forEach((n,a)=>n.blocks.forEach((o,s)=>{o.t===`p`&&o.pid===e&&t.push({list:n.blocks,index:s,pa:`${r}.${i}.${a}.${s}`,p:o})})))}),t}topIndex(e){return this.st.blocks.findIndex(t=>_m(t,e))}region(e){let t=new Set(e);for(let n of e){let e=this.locate(n)[0];if(!e)continue;let r=[];for(let n=e.index;n<e.list.length;n++){let i=e.list[n];if(i.t!==`p`||i.pid===void 0||!t.has(i.pid))break;r.push(e.pa.replace(/\d+$/,String(n)))}return r}return null}remap(e){if(e.t===`img`){let t=e.ck,n=t?this.res.get(t):void 0;return n&&typeof n==`object`?{...e,rid:n.rid,target:n.path}:e}if(e.t===`text`){let t=e.lck,n=t?this.res.get(t):void 0;return typeof n==`string`?{...e,lk:n}:e}return e.t===`p`?{...e,runs:e.runs.map(e=>this.remap(e))}:e.t===`tbl`?{...e,rows:e.rows.map(e=>({...e,cells:e.cells.map(e=>({...e,blocks:e.blocks.map(e=>this.remap(e))}))}))}:e}tag(e){return e.t===`img`&&e.rid&&this.resKey.has(e.rid)&&!e.ck?{...e,ck:this.resKey.get(e.rid)}:e.t===`text`&&e.lk&&this.resKey.has(e.lk)&&!e.lck?{...e,lck:this.resKey.get(e.lk)}:e.t===`p`?{...e,runs:e.runs.map(e=>this.tag(e)),caret:void 0}:e.t===`tbl`?{...e,rows:e.rows.map(e=>({...e,cells:e.cells.map(e=>({...e,blocks:e.blocks.map(e=>this.tag(e))}))}))}:e}async fetchRes(e){if(e.t===`image`&&!this.res.has(e.key)){let t=await this.client.direct(`docx.image`,e.bytes.slice().buffer,e.ext);this.res.set(e.key,t),this.resKey.set(t.rid,e.key)}else if(e.t===`link`&&!this.res.has(e.key)){let t=await this.client.direct(`docx.link`,e.url);this.res.set(e.key,t),this.resKey.set(t,e.key)}else if(e.t===`call`&&!this.results.has(e)){let t=this.client.direct;this.results.set(e,await t(e.method,...e.args))}}onCommit(e){if(this.suppress||!this.push)return;if(e.kind===`paras`){let t=e.before,n=e.next;if(t.length===1&&n.length===1&&t[0].pid!==void 0&&Tm(t[0],n[0])&&this.locate(t[0].pid).length===1){let e=xm(t[0].runs,n[0].runs);if(!e)return;this.push({t:`text`,pid:t[0].pid,at:e.at,del:e.del,ins:e.ins.map(e=>this.tag(e))},[{t:`paras`,before:t,next:n}]);return}this.push({t:`paras`,before:t.map(e=>e.pid),next:n.map(e=>this.tag(e))},[{t:`paras`,before:t,next:n}]);return}let t=e.bi>0?gm(this.st.blocks[e.bi-1]):null;this.push({t:`blocks`,before:e.before.map(gm).filter(e=>!!e),prev:t,next:e.next.map(e=>this.tag(e))},[{t:`blocks`,before:e.before,next:e.next,prev:t}])}transform(e,t){if(e.t!==`text`)return e;if(t.t===`text`&&t.pid===e.pid){let n=Vl(t.ins),r=Cm(e.at,t.at,t.del,n,!1),i=e.del?Math.max(r,Cm(e.at+e.del,t.at,t.del,n,!0)):r;return r===e.at&&i-r===e.del?e:{...e,at:r,del:i-r}}return t.t===`paras`&&(t.before.includes(e.pid)||t.next.some(t=>t.pid===e.pid))?t.next.some(t=>t.pid===e.pid)?e:null:t.t===`blocks`&&t.before.some(t=>`p`in t&&t.p===e.pid)&&!ym(t.next).includes(e.pid)?null:e}touched(e){switch(e.t){case`text`:return[`p`+e.pid];case`paras`:return[...e.before,...e.next.map(e=>e.pid)].map(e=>`p`+e);case`blocks`:{let t=[...e.before,...e.prev?[e.prev]:[],...e.next.map(gm).filter(e=>!!e)].map(e=>`p`in e?`p`+e.p:`t`+(e.item??`n`+e.tid));for(let n of ym(e.next))t.push(`p`+n);return t}default:return[]}}conflicts(e,t){let n=new Set(e.flatMap(e=>this.touched(e)));return t.some(e=>this.touched(e).some(e=>n.has(e)))}pessimistic(e){return e.t===`call`}async prepare(e){for(;this.host?.editor.input.isComposing;)await new Promise(e=>setTimeout(e,50));for(let t of e)await this.fetchRes(t);this.capture()}async apply(e,t){switch(e.t){case`image`:case`link`:return await this.fetchRes(e),{result:this.res.get(e.key)};case`call`:{await this.fetchRes(e);let t=this.results.get(e);if(e.method===`docx.style`&&t&&typeof t==`object`&&this.host){let e=t.styles;this.ed.styles=e,this.ed.onStyles?.(e)}return{result:t}}}if(!this.host)throw Error(`Document editor not ready`);(t===`remote`||t===`replay`)&&this.capture(),this.touchedModel=!0,this.suppress++;try{return{undo:this.run(e)}}finally{this.suppress--}}run(e){let t=this.ed;if(e.t===`text`){let n=this.locate(e.pid);if(n.length!==1||!t.para(n[0].pa))return null;let r=n[0].p,i={...r,runs:Sm(r.runs,e.at,e.del,e.ins.map(e=>this.remap(e))),edited:!0};return t.replace([n[0].pa],[i],this.sel(),{history:!1,label:`collab`}),[{t:`paras`,before:[r],next:[i]}]}if(e.t===`paras`){let n=e.next.map(e=>this.remap(e)),r=new Set(n.map(e=>e.pid)),i=this.region(e.before);if(!i||!i.length)return null;let a=[],o=new Set(i.map(e=>t.para(e)?.pid??-1));for(let n of vm([...e.before,...r]))if(!o.has(n))for(let e of this.locate(n).reverse()){if(!t.para(e.pa))continue;let n=t=>{let n=e.list[t];return n?.t===`p`&&n.pid!==void 0?{pid:n.pid,k:this.locate(n.pid).findIndex(n=>n.list===e.list&&n.index===t)}:void 0},r={t:`paras`,before:[e.p],next:[],prev:n(e.index-1),after:n(e.index+1)};t.replace([e.pa],[],this.sel(),{history:!1,label:`collab`}),a.push(r)}let s=this.region(e.before);if(!s?.length)return a;let c=s.map(e=>t.para(e)).filter(Boolean);return c.length===s.length&&(t.replace(s,n,this.sel(),{history:!1,label:`collab`}),a.push({t:`paras`,before:c,next:n})),a}if(e.t===`blocks`){let n=e.next.map(e=>this.remap(e)),r,i=0;if(e.before.length){if(r=this.topIndex(e.before[0]),r<0){let t=e.before.find(e=>this.topIndex(e)>=0);if(!t)return null;r=this.topIndex(t)}for(;r+i<this.st.blocks.length&&e.before.some(e=>_m(this.st.blocks[r+i],e));)i++}else if(r=e.prev?this.topIndex(e.prev)+1:0,e.prev&&r===0)return null;let a=this.st.blocks.slice(r,r+i),o=new Map(a.flatMap(e=>e.t===`p`&&e.pid!==void 0?[[e.pid,e]]:[]));return n=n.map(e=>e.t===`p`&&e.pid!==void 0&&o.has(e.pid)?o.get(e.pid):e),t.replaceBlocks(r,i,n,null,!1),[{t:`blocks`,before:a,next:n,prev:r>0?gm(this.st.blocks[r-1]):null}]}return null}revert(e){let t=e;if(t&&this.host){this.capture(),this.touchedModel=!0,this.suppress++;try{for(let e=t.length-1;e>=0;e--)this.undoStep(t[e])}finally{this.suppress--}}}undoStep(e){let t=this.ed;if(e.t===`paras`){if(!e.next.length){let n=e=>e?this.locate(e.pid)[e.k]:void 0,r=n(e.prev);if(r&&t.para(r.pa))return t.replace([r.pa],[r.p,...e.before],this.sel(),{history:!1,label:`collab`});let i=n(e.after);i&&t.para(i.pa)&&t.replace([i.pa],[...e.before,i.p],this.sel(),{history:!1,label:`collab`});return}let n=this.locate(e.next[0].pid)[0];if(!n)return;let r=e.next.map((e,t)=>n.pa.replace(/\d+$/,String(n.index+t)));if(r.some((n,r)=>t.para(n)?.pid!==e.next[r].pid))return;t.replace(r,e.before,this.sel(),{history:!1,label:`collab`});return}let n=e.next.length?gm(e.next[0]):null,r=n?this.topIndex(n):e.prev?this.topIndex(e.prev)+1:0;if(r<0)return;let i=new Map(this.st.blocks.slice(r,r+e.next.length).flatMap(e=>e.t===`p`&&e.pid!==void 0?[[e.pid,e]]:[]));t.replaceBlocks(r,e.next.length,e.before.map(e=>e.t===`p`&&e.pid!==void 0&&i.has(e.pid)?i.get(e.pid):e),null,!1)}toD(e){let t=this.ed.para(e.pa);if(!t||t.pid===void 0)return null;let n=this.locate(t.pid);return{pid:t.pid,k:Math.max(0,n.findIndex(t=>t.pa===e.pa)),o:e.o}}fromD(e){let t=this.locate(e.pid),n=t[Math.min(e.k,t.length-1)];return n?{pa:n.pa,o:Math.min(e.o,Vl(n.p.runs))}:null}capture(){if(this.snap||!this.host)return;let e=!!this.ed.input.readSel(),t=this.ed.input.sel(),n=t&&this.toD(t.a),r=t&&this.toD(t.f);if(!n||!r)return;let i=new Map;for(let e of[n,r]){let t=this.locate(e.pid)[e.k];t&&i.set(`${e.pid}:${e.k}`,Wl(t.p.runs))}this.snap={a:n,f:r,text:i,focused:e}}sel(){let e=this.snap,t={pa:`0`,o:0};if(!e)return this.ed.input.lastSel??{a:t,f:t};let n=n=>{let r=this.locate(n.pid)[n.k]??this.locate(n.pid)[0];if(!r)return this.ed.input.lastSel?.f??t;let i=e.text.get(`${n.pid}:${n.k}`),a=Wl(r.p.runs);return{pa:r.pa,o:i===void 0?Math.min(n.o,a.length):wm(n.o,i,a)}};return{a:n(e.a),f:n(e.f)}}settled(){let e=this.snap,t=this.touchedModel;if(this.touchedModel=!1,!this.host)return;if(!e){t&&(this.ed.pendingSel=null);return}let n=this.sel();this.snap=null,this.ed.pendingSel=e.focused?n:null,e.focused||(this.ed.input.lastSel=n)}rects(e,t){if(!this.host)return{caret:null,sel:[]};let n=e.querySelector(`.de-pages`),r=this.fromD(t.a),i=this.fromD(t.f);if(!n||!r||!i)return{caret:null,sel:[]};let a=mu(n,i),o=null;if(a){let e=document.createRange();try{e.setStart(a[0],a[1]),e.collapse(!0),o=e.getClientRects()[0]??(a[0].nodeType===1?a[0].getBoundingClientRect():e.getBoundingClientRect())}catch{o=null}}let s=[],c=mu(n,r);if(c&&a&&(r.pa!==i.pa||r.o!==i.o)){let e=document.createRange();try{this.ed.cmp(r.pa,i.pa)<0||r.pa===i.pa&&r.o<i.o?(e.setStart(c[0],c[1]),e.setEnd(a[0],a[1])):(e.setStart(a[0],a[1]),e.setEnd(c[0],c[1]));for(let t of Array.from(e.getClientRects()))t.width>.5&&s.push(t)}catch{}}return{caret:o,sel:s}}},Dm=e=>e!==null,Om=class{constructor(e,t,n){A(this,`transport`,void 0),A(this,`adapter`,void 0),A(this,`opts`,void 0),A(this,`site`,0),A(this,`rev`,0),A(this,`status`,`connecting`),A(this,`error`,void 0),A(this,`peers`,new Map),A(this,`log`,[]),A(this,`inflight`,null),A(this,`buffer`,[]),A(this,`queue`,void 0),A(this,`joined`,!1),A(this,`online`,!1),A(this,`counter`,0),A(this,`listeners`,new Map),A(this,`presence`,void 0),A(this,`presenceTimer`,void 0),A(this,`presenceAt`,0),A(this,`closed`,!1),this.transport=e,this.adapter=t,this.opts=n,this.rev=n.base??0,this.queue=Promise.resolve(t.ready?.()).catch(e=>this.fail(e.message)),e.onMessage=e=>this.enqueue(()=>this.onMessage(e)),e.onStatus=t=>{t===`open`?(this.online=!0,e.send(this.joined?{t:`hello`,room:n.room,user:n.user,have:this.rev,site:this.site}:{t:`hello`,room:n.room,user:n.user,base:n.base||void 0})):t===`closed`&&(this.online=!1,this.peers.clear(),this.emit(`peers`,[]),this.status!==`error`&&this.setStatus(this.joined?`offline`:`connecting`))},e.connect()}get pending(){return(this.inflight?.items.length??0)+this.buffer.length}nextId(){return`${this.site}.${++this.counter}.${Math.random().toString(36).slice(2,6)}`}submit(e){return new Promise((t,n)=>this.enqueue(async()=>{if(this.status===`error`)return n(Error(this.error??`Collaboration stopped`));if(this.adapter.pessimistic?.(e))this.buffer.push({op:e,applied:!1,done:t});else{let r;try{r=await this.adapter.apply(e,`local`)}catch(e){return n(e)}this.buffer.push({op:e,applied:!0,undo:r.undo}),t(r.result)}this.flush()}))}push(e,t){this.buffer.push({op:e,applied:!0,undo:t}),this.enqueue(async()=>this.flush())}setPresence(e){if(this.presence=e,this.presenceTimer)return;let t=Math.max(0,80-(Date.now()-this.presenceAt));this.presenceTimer=setTimeout(()=>{this.presenceTimer=void 0,this.presenceAt=Date.now(),this.online&&this.joined&&this.transport.send({t:`presence`,data:this.presence})},t)}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>n.delete(t)}context(e=this.opts.logWindow??5e3){return e>0?this.log.slice(-e):[]}idle(){return this.queue}close(){this.closed=!0,clearTimeout(this.presenceTimer),this.transport.close(),this.listeners.clear()}emit(e,t){for(let n of this.listeners.get(e)??[])n(t)}setStatus(e){this.status!==e&&(this.status=e,this.emit(`status`,e))}fail(e){this.error=e,this.setStatus(`error`),this.emit(`error`,Error(e))}enqueue(e){this.queue=this.queue.then(e).catch(e=>{console.error(`[office-engine collab]`,e),this.emit(`error`,e)})}async onMessage(e){if(!(this.closed||this.status===`error`))switch(e.t){case`welcome`:{if(e.reset)return this.fail(`The shared document history was reset; reopen the document`);let t=!this.joined;this.site=e.site,this.joined=!0,t&&(this.log=e.ctx??[],this.setStatus(`syncing`)),this.peers.clear();for(let t of e.peers)this.peers.set(t.site,t);this.emit(`peers`,[...this.peers.values()]);for(let t of e.log)await this.onBatch(t);this.inflight&&(this.inflight.base=this.rev,this.transport.send({t:`ops`,id:this.inflight.id,base:this.rev,ops:this.inflight.items.map(e=>e.op).filter(Dm)})),this.flush(),this.presence!==void 0&&this.transport.send({t:`presence`,data:this.presence}),this.setStatus(`live`);return}case`batch`:return this.onBatch(e.b);case`presence`:{let t=this.peers.get(e.site);t&&(this.peers.set(e.site,{...t,presence:e.data}),this.emit(`peers`,[...this.peers.values()]));return}case`join`:this.peers.set(e.peer.site,e.peer),this.emit(`peers`,[...this.peers.values()]);return;case`leave`:this.peers.delete(e.site),this.emit(`peers`,[...this.peers.values()]);return;case`error`:return this.fail(e.message)}}async onBatch(e){if(e.seq<=this.rev)return;if(e.seq!==this.rev+1)return this.fail(`Missed operations (${this.rev+1}…${e.seq-1})`);if(this.inflight&&e.id===this.inflight.id)await this.ack(e);else{let t=this.canonical(e);if(t===null)return;await this.remote(t),this.log.push({seq:e.seq,site:e.site,ops:t})}this.rev=e.seq;let t=this.opts.logWindow??5e3;this.log.length>t&&this.log.splice(0,this.log.length-t),this.flush(),this.adapter.settled?.(),this.emit(`change`,void 0)}canonical(e){let t=e.ops.map(e=>e);if(e.base<e.seq-1&&(this.log[0]?.seq??1/0)>e.base+1&&this.rev>e.base)return this.fail(`Operation is too old to merge; reopen the document`),null;for(let n of this.log)if(!(n.seq<=e.base||n.site===e.site))for(let e of n.ops)t=t.map(t=>t===null?null:this.adapter.transform(t,e));return t.filter(Dm)}async revertAll(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.applied){try{await this.adapter.revert(n.undo)}catch(e){console.error(`[office-engine collab] revert failed`,e)}n.applied=!1,n.undo=void 0}}}async replay(e,t){if(e.op)try{let n=await this.adapter.apply(e.op,t);e.undo=n.undo,e.applied=!0,e.done&&(e.done(n.result),e.done=void 0)}catch(e){console.error(`[office-engine collab] replay failed`,e)}}async remote(e){await this.adapter.prepare?.(e);let t=[...this.inflight?.items??[],...this.buffer];if(!t.length){for(let t of e)await this.applyRemote(t);return}let n=t.map(t=>{let n=t.op;for(let t of e)n!==null&&(n=this.adapter.transform(n,t));return n}),r=t.filter(e=>e.applied&&e.op).map(e=>e.op),i=n.some((e,n)=>e!==t[n].op)||r.length>0&&(this.adapter.conflicts?.(r,e)??!0);i&&await this.revertAll(t);for(let t of e)await this.applyRemote(t);if(t.forEach((e,t)=>e.op=n[t]),i)for(let e of t)!e.op||this.adapter.pessimistic?.(e.op)&&!e.applied&&e.done||await this.replay(e,`replay`)}async applyRemote(e){try{await this.adapter.apply(e,`remote`)}catch(t){console.error(`[office-engine collab] remote op failed`,t,e),this.emit(`error`,t)}}async ack(e){let t=this.inflight.items;this.inflight=null;let n=t.findIndex(e=>e.op&&!e.applied);if(n>=0){let e=[...t.slice(n),...this.buffer];await this.adapter.prepare?.(t.slice(n).filter(e=>e.op&&!e.applied).map(e=>e.op)),await this.revertAll(e);for(let n of e)!t.includes(n)&&n.op&&this.adapter.pessimistic?.(n.op)&&n.done||await this.replay(n,n.done?`local`:`replay`)}for(let e of t)e.done&&e.done(null);this.log.push({seq:e.seq,site:e.site,ops:t.map(e=>e.op).filter(Dm)})}flush(){if(this.inflight||!this.buffer.length||!this.online||!this.joined||this.status===`error`)return;let e=this.buffer;this.buffer=[];let t=`${this.site}-${Date.now().toString(36)}-${++this.counter}`;this.inflight={id:t,base:this.rev,items:e},this.transport.send({t:`ops`,id:t,base:this.rev,ops:e.map(e=>e.op).filter(Dm)})}},km=`$b64`;function Am(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function jm(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Mm(e){return JSON.stringify(e,(e,t)=>t instanceof Uint8Array?{[km]:Am(t)}:t instanceof ArrayBuffer?{[km]:Am(new Uint8Array(t))}:t)}function Nm(e){return JSON.parse(e,(e,t)=>t&&typeof t==`object`&&typeof t[km]==`string`&&Object.keys(t).length===1?jm(t[km]):t)}var Pm=class{constructor(e,t){A(this,`url`,void 0),A(this,`protocols`,void 0),A(this,`onMessage`,void 0),A(this,`onStatus`,void 0),A(this,`ws`,void 0),A(this,`closed`,!1),A(this,`retry`,0),A(this,`timer`,void 0),this.url=e,this.protocols=t}connect(){this.closed=!1,this.open()}open(){if(this.closed)return;this.onStatus?.(`connecting`);let e=this.ws=new WebSocket(this.url,this.protocols);e.onopen=()=>{this.retry=0,this.onStatus?.(`open`)},e.onmessage=e=>{typeof e.data==`string`&&this.onMessage?.(Nm(e.data))},e.onclose=()=>{if(this.ws!==e||(this.ws=void 0,this.onStatus?.(`closed`),this.closed))return;let t=Math.min(1e4,300*2**this.retry++)*(.75+Math.random()*.5);this.timer=setTimeout(()=>this.open(),t)},e.onerror=()=>e.close()}send(e){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(Mm(e))}close(){this.closed=!0,clearTimeout(this.timer);let e=this.ws;this.ws=void 0,e?.close(),this.onStatus?.(`closed`)}},Fm=new Set([`xlsx.set`,`xlsx.format`,`xlsx.sheetOp`,`xlsx.replace`,`xlsx.bookOp`,`xlsx.undo`,`xlsx.redo`]),Im=class{constructor(e){A(this,`client`,void 0),A(this,`submit`,void 0),A(this,`nextId`,void 0),A(this,`onPresence`,void 0),A(this,`undoStack`,[]),A(this,`redoStack`,[]),A(this,`offLocal`,void 0),this.client=e,this.offLocal=Hc(e,e=>{let t=e,n=this.path(t.sheet);n&&this.onPresence?.({k:`xlsx`,sheet:n,range:t.range,ar:t.ar,ac:t.ac})})}dispose(){this.offLocal()}get meta(){return this.client.info.xlsx}path(e){return this.meta.sheets[e]?.path??``}id(){return this.nextId()}captures(e){return Fm.has(e)}intercept(e,t){if(!this.submit)return;let n=t;switch(e){case`xlsx.set`:return this.local({t:`set`,id:this.id(),sheet:this.path(n[0]),cells:n[1]});case`xlsx.format`:return this.local({t:`fmt`,id:this.id(),sheet:this.path(n[0]),range:n[1],patch:n[2]});case`xlsx.sheetOp`:return this.local({t:`sheet`,id:this.id(),sheet:this.path(n[0]),op:n[1]});case`xlsx.replace`:return this.local({t:`replace`,id:this.id(),sheet:this.path(n[0]),query:n[1],by:n[2],opts:n[3],at:n[4]});case`xlsx.bookOp`:return this.local({t:`book`,id:this.id(),op:this.pbook(n[0])});case`xlsx.undo`:return this.history(this.undoStack,this.redoStack,`prev`);case`xlsx.redo`:return this.history(this.redoStack,this.undoStack,`next`)}}pbook(e){switch(e.op){case`add`:return{op:`add`,name:e.name,after:e.after===void 0?void 0:this.path(e.after)};case`rename`:return{op:`rename`,path:this.path(e.index),name:e.name};case`delete`:return{op:`delete`,path:this.path(e.index)};case`move`:return{op:`move`,path:this.path(e.from),to:e.to}}}local(e){if(e.t===`sheet`&&(e.op.op===`insertRows`||e.op.op===`insertCols`)){let t={op:e.op.op===`insertRows`?`deleteRows`:`deleteCols`,at:e.op.at,n:e.op.n};this.undoStack.push({kind:`inverse`,sheet:e.sheet,undo:t,redo:e.op})}else uc(e)||this.undoStack.push({kind:`op`,id:e.id});return this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],this.submit(e)}history(e,t,n){let r=e.pop();return r?(t.push(r),r.kind===`op`?this.submit({t:`revert`,id:this.id(),target:r.id,which:n}):this.submit({t:`sheet`,id:this.id(),sheet:r.sheet,op:n===`prev`?r.undo:r.redo})):Promise.resolve(null)}transform(e,t){return hc(e,t)}conflicts(e,t){return yc(e,t)}pessimistic(e){return uc(e)}async apply(e,t){let{res:n,rec:r}=await this.client.direct(`collab.xlsx.apply`,e);if(uc(e)){let e=e=>e.kind===`inverse`&&t===`local`;this.undoStack=this.undoStack.filter(e),this.redoStack=this.redoStack.filter(e)}return t!==`local`&&n&&this.client.notify(`collab:xlsx`,n),{result:n,undo:r}}async revert(e){if(typeof e!=`number`)return;let t=await this.client.direct(`collab.xlsx.revert`,e);t&&this.client.notify(`collab:xlsx`,t)}};function Lm(e,t){return t.t===`slides`&&t.op.op===`delete`&&`slide`in e&&e.slide===t.op.path?null:e}function Rm(e,t){if(t.some(e=>e.t===`slides`||e.t===`revert`)||e.some(e=>e.t===`revert`))return!0;let n=new Set(e.flatMap(e=>`slide`in e&&e.t!==`image`?[e.slide]:[]));return t.some(e=>`slide`in e&&e.t!==`image`&&n.has(e.slide))}var zm=new Set([`pptx.setText`,`pptx.shapes`,`pptx.slides`,`pptx.image`,`pptx.undo`]),Bm=class{constructor(e){A(this,`client`,void 0),A(this,`submit`,void 0),A(this,`nextId`,void 0),A(this,`onPresence`,void 0),A(this,`undoStack`,[]),A(this,`redoStack`,[]),A(this,`ridKey`,new Map),A(this,`offLocal`,void 0),this.client=e,this.offLocal=Hc(e,e=>{let t=e,n=this.path(t.slide);n&&this.onPresence?.({k:`pptx`,slide:n,top:t.top})})}dispose(){this.offLocal()}get meta(){return this.client.info.pptx}path(e){return this.meta.slides[e]?.path??``}id(){return this.nextId()}captures(e){return zm.has(e)}intercept(e,t){if(!this.submit)return;let n=t;switch(e){case`pptx.setText`:return this.local({t:`text`,id:this.id(),slide:this.path(n[0]),sid:n[1],paras:n[2]}).then(e=>e.model);case`pptx.shapes`:{let e=n[1].map(e=>e.op===`insert`&&e.rid&&this.ridKey.has(e.rid)?{...e,rid:void 0,key:this.ridKey.get(e.rid)}:e);return this.local({t:`shapes`,id:this.id(),slide:this.path(n[0]),ops:e}).then(e=>e.model)}case`pptx.image`:{let e=`${this.id()}`,t=new Uint8Array(n[1].slice(0));return this.submit({t:`image`,id:e,key:e,slide:this.path(n[0]),bytes:t,ext:n[2]}).then(t=>{let n=t.rid;return n&&this.ridKey.set(n,e),n})}case`pptx.slides`:return this.submit({t:`slides`,id:this.id(),op:this.pslide(n[0])}).then(e=>e?.meta??this.meta);case`pptx.undo`:return this.history(n[0]?this.redoStack:this.undoStack,n[0]?this.undoStack:this.redoStack,n[0]?`next`:`prev`)}}pslide(e){switch(e.op){case`add`:return{op:`add`,after:e.after>=0&&this.path(e.after)||null,layout:e.layout};case`duplicate`:return{op:`duplicate`,path:this.path(e.index)};case`delete`:return{op:`delete`,path:this.path(e.index)};case`move`:return{op:`move`,path:this.path(e.from),to:e.to};case`hide`:return{op:`hide`,path:this.path(e.index),hidden:e.hidden}}}local(e){return this.undoStack.push(e.id),this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],this.submit(e)}async history(e,t,n){let r=e.pop();if(!r)return null;t.push(r);let i=await this.submit({t:`revert`,id:this.id(),target:r,which:n});return i.model&&i.slide!==void 0?{index:i.slide,model:i.model}:null}transform(e,t){return Lm(e,t)}conflicts(e,t){return Rm(e,t)}pessimistic(e){return e.t===`slides`}prepare(e){e.some(e=>e.t===`slides`)&&Nc(this.client,`pptx`)?.endEditing()}async apply(e,t){let{res:n,rec:r}=await this.client.direct(`collab.pptx.apply`,e);return e.t===`slides`&&(this.undoStack=[],this.redoStack=[],n.meta&&Object.assign(this.meta,n.meta)),t!==`local`&&this.client.notify(`collab:pptx`,n),{result:n,undo:r}}async revert(e){typeof e==`number`&&this.client.notify(`collab:pptx`,await this.client.direct(`collab.pptx.revert`,e))}};function Vm(e,t){let n=typeof t.transport==`string`?new Pm(t.transport):t.transport,r=e.kind===`docx`?new Em(e):void 0,i=r??(e.kind===`xlsx`?new Im(e):new Bm(e)),a=new Om(n,i,{room:t.room,user:t.user,base:t.base});i.submit=e=>a.submit(e),i.push=(e,t)=>a.push(e,t),i.nextId=()=>a.nextId(),i.onPresence=e=>a.setPresence(e),e.interceptor=(e,t)=>{if(i.captures(e))return a.status===`connecting`||a.status===`syncing`||a.status===`error`?Promise.reject(Error(a.status===`error`?a.error??`Collaboration stopped`:`Document is still syncing`)):i.intercept(e,t)};let o=[a.on(`peers`,t=>Lc(e,t)),a.on(`status`,e=>{e===`live`&&i.setSite?.(a.site)})];return{session:a,get status(){return a.status},get peers(){return[...a.peers.values()]},get pending(){return a.pending},on:(e,t)=>a.on(e,t),rects:(e,t)=>{let n=t.presence;return r&&n?.k===`docx`?r.rects(e,n):null},close(){o.forEach(e=>e()),a.close(),e.interceptor&&(e.interceptor=void 0),i.dispose?.(),Lc(e,[])}}}var Hm=new WeakMap,Um=0;function Wm(e){if(!e)return``;let t;if(typeof e.transport==`string`)t=e.transport;else{let n=Hm.get(e.transport);n===void 0&&Hm.set(e.transport,n=++Um),t=`#${n}`}return`${t}|${e.room}|${e.base??0}|${e.user.id??``}|${e.user.name}|${e.user.color??``}`}function Gm(e,t){let[n,r]=(0,u.useState)({collab:null,status:null}),i=Wm(t),a=(0,u.useRef)(t);return a.current=t,(0,u.useEffect)(()=>{let t=a.current;if(!e||!t){r({collab:null,status:null});return}let n;try{n=Vm(e,t)}catch(e){r({collab:null,status:`error`,error:e.message});return}let i=()=>r({collab:n,status:n.status,error:n.session.error});i();let o=[n.on(`status`,i),n.on(`error`,i)];return()=>{o.forEach(e=>e()),n.close()}},[e,i]),n}var Km=e=>e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``)||`?`,qm={connecting:`Connecting…`,syncing:`Syncing…`,live:`Live`,offline:`Offline · changes will sync`,error:`Not synced`};function Jm({client:e,state:t}){let n=(0,u.useSyncExternalStore)(t=>Bc(e,t),()=>zc(e)),[r,i]=(0,u.useState)(0);if((0,u.useEffect)(()=>{let e=t.collab?.session;if(!e)return;let n=setInterval(()=>i(e.pending),500);return()=>clearInterval(n)},[t.collab]),!t.status)return null;let a=t.status===`error`?t.error??`Collaboration stopped`:t.status===`live`&&r?`Saving ${r} change${r>1?`s`:``}…`:qm[t.status];return(0,X.jsxs)(`span`,{className:`de-collab`,children:[(0,X.jsxs)(`span`,{className:`de-collab-status de-collab-${t.status}`,title:a,children:[(0,X.jsx)(`span`,{className:`de-collab-dot`}),(0,X.jsx)(`span`,{className:`de-collab-label`,children:t.status===`live`?n.length?`${n.length+1} editing`:`Live`:qm[t.status]})]}),n.length>0&&(0,X.jsxs)(`span`,{className:`de-peers`,children:[n.slice(0,5).map(e=>(0,X.jsx)(`span`,{className:`de-peer`,style:{background:e.color},title:e.name,children:Km(e.name)},e.site)),n.length>5&&(0,X.jsxs)(`span`,{className:`de-peer de-peer-more`,title:n.slice(5).map(e=>e.name).join(`, `),children:[`+`,n.length-5]})]})]})}function Ym({client:e,collab:t}){let n=(0,u.useRef)(null),r=(0,u.useSyncExternalStore)(t=>Bc(e,t),()=>zc(e)),[i,a]=(0,u.useState)([]),o=(0,u.useMemo)(()=>r.filter(e=>e.presence&&e.presence.k!==`xlsx`),[r]);return(0,u.useEffect)(()=>{let r=n.current,i=r?.parentElement;if(!r||!i||!o.length){a([]);return}let s=0,c=()=>{s=0;let n=r.getBoundingClientRect(),c=e=>({x:e.left-n.left,y:e.top-n.top,w:e.width,h:e.height}),l=[];for(let r of o){let a=Xm(r,i,t,e);a&&l.push({key:String(r.site),color:r.color,name:r.name,caret:a.caret?{x:a.caret.left-n.left,y:a.caret.top-n.top,h:a.caret.height||16}:void 0,boxes:a.sel.map(c),outline:a.outline?c(a.outline):void 0})}a(l)},l=()=>{s||(s=requestAnimationFrame(c))};l(),i.addEventListener(`scroll`,l,!0),window.addEventListener(`resize`,l);let u=t?.on(`change`,l),d=setInterval(l,400);return()=>{cancelAnimationFrame(s),i.removeEventListener(`scroll`,l,!0),window.removeEventListener(`resize`,l),u?.(),clearInterval(d)}},[o,t,e]),(0,X.jsx)(`div`,{ref:n,className:`de-peer-layer`,"aria-hidden":!0,children:i.map(e=>(0,X.jsxs)(`div`,{style:{"--peer":e.color},children:[e.boxes.map((e,t)=>(0,X.jsx)(`div`,{className:`de-peer-sel`,style:{left:e.x,top:e.y,width:e.w,height:e.h}},t)),e.outline&&(0,X.jsx)(`div`,{className:`de-peer-outline`,style:{left:e.outline.x-3,top:e.outline.y-3,width:e.outline.w+6,height:e.outline.h+6},children:(0,X.jsx)(`span`,{className:`de-peer-flag`,children:e.name})}),e.caret&&(0,X.jsx)(`div`,{className:`de-peer-caret`,style:{left:e.caret.x,top:e.caret.y,height:e.caret.h},children:(0,X.jsx)(`span`,{className:`de-peer-flag`,children:e.name})})]},e.key))})}function Xm(e,t,n,r){let i=e.presence;if(i.k===`docx`){let r=n?.rects(t,e);return r?{caret:r.caret,sel:r.sel}:null}if(i.k===`pptx`&&i.slide){let e=r.info.pptx?.slides.findIndex(e=>e.path===i.slide)??-1,n=e>=0?t.querySelector(`[data-slide="${e+1}"]`):null;return n?{sel:[],outline:((i.top===void 0?null:n.querySelector(`[data-top="${i.top}"]`))??n).getBoundingClientRect()}:null}return null}var Zm={docx:`.docx`,xlsx:`.xlsx`,pptx:`.pptx`},Qm={docx:`Untitled document`,xlsx:`Untitled spreadsheet`,pptx:`Untitled presentation`};function $m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function eh(e){let{src:t,name:n,className:r,style:i,toolbar:a=!0,toolbarExtra:o,zoom:s,thumbnails:c,headers:l,credentials:d,worker:f,styleTarget:p,onLoad:m,onError:h}=e,{allowEdit:g=!0,allowSave:_=!0,allowDownload:v=!0,fileMenu:y=!0,allowOpen:b=!0,onSave:x,onDirtyChange:S}=e,[C,w]=(0,u.useState)(!!e.editable);(0,u.useEffect)(()=>{e.editable!==void 0&&w(!!e.editable)},[e.editable]);let[T,E]=(0,u.useState)(!1),[D,ee]=(0,u.useState)(!1),[O,te]=(0,u.useState)(null);(0,u.useInsertionEffect)(()=>mf(p),[p]);let[ne,re]=(0,u.useState)(null),[ie,ae]=(0,u.useState)(null);(0,u.useEffect)(()=>{re(null),ae(null)},[t]);let oe=ne?ne.name:n,{client:k,error:se,loading:ce,progress:A}=Dp(ne?ne.src:t,{name:oe,headers:l,credentials:d,worker:f}),le=ie??oe,ue=Gm(k,e.collab),de=!e.collab||ue.status===`live`||ue.status===`offline`,[j,M]=(0,u.useState)(null);(0,u.useEffect)(()=>{k&&m?.(k)},[k,m]),(0,u.useEffect)(()=>{se&&h?.(se)},[se,h]);let N=(0,u.useRef)(!1);(0,u.useEffect)(()=>{E(!!k&&N.current),k&&(N.current=!1)},[k]);let fe=(0,u.useCallback)(e=>E(t=>(t!==e&&S?.(e),e)),[S]),pe=(ie??(k?.name||le||`document`)).replace(/\.[^.]+$/,``),me=pe+(k?Zm[k.kind]:``),he=_&&(!!x||v),ge=(0,u.useCallback)(async()=>{if(k&&!D&&he){ee(!0);try{let e=await k.call(`save`);x?await x(e,me):Cl(e,me),fe(!1)}catch(e){h?.(e),console.error(`[office-engine] save failed`,e)}finally{ee(!1)}}},[k,D,he,x,me,fe,h]),P=(0,u.useRef)(null),_e=(0,u.useMemo)(()=>({bar:O,editable:C&&de,setDirty:fe,save:ge,canDownload:v,client:k,fileOps:P}),[O,C,de,fe,ge,v,k]),[ve,ye]=(0,u.useState)(null),be=(0,u.useCallback)(()=>ye(null),[]),[xe,F]=(0,u.useState)(null),[I,Se]=(0,u.useState)(!1),[Ce,we]=(0,u.useState)(!1),Te=(e,t)=>T?F({message:e,run:t}):t(),Ee=(0,u.useCallback)((e,t=!1)=>{N.current=e.converted,ae(null),re(e),t&&w(!0)},[]),De=y&&b&&!e.collab,Oe=Mf({kind:k?.kind,base:pe,canOpen:De,canImport:y&&g&&de,canSave:y&&he,canDownload:y&&v&&!!k,ops:P,create:e=>Te(`A new ${Qm[e].split(` `)[1]} replaces the current document. Your changes are not saved.`,()=>{(e===`docx`?Yd([]):e===`xlsx`?zd([],`Sheet1`):nf()).then(t=>Ee({src:t,name:Qm[e]+Zm[e],converted:!1},g),e=>ye(e.message))}),open:e=>Te(`Opening “${e.name}” replaces the current document. Your changes are not saved.`,()=>{df(e).then(Ee,e=>ye(e.message))}),save:ge,downloadOriginal:async()=>{k&&(Cl(await k.call(`save`),me),x||fe(!1))},rename:()=>Se(!0),details:()=>we(!0),close:e.onClose,extra:e.fileMenuItems??[],notify:ye}),ke=e=>{if(!y||e.defaultPrevented||!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey)return;let t=e.key.toLowerCase();t===`p`?(e.preventDefault(),v&&Oe.run(`print`)):t===`o`&&De&&(e.preventDefault(),Oe.run(`open`))},L=A&&A.total>0?Math.min(100,A.loaded/A.total*100):0,R=ce||!!A&&L<100,z=ie??k?.name??le??(typeof t==`string`?decodeURIComponent(t.split(/[?#]/)[0].split(`/`).pop()??``):t?.name)??``,Ae;return Ae=se?(0,X.jsx)(`div`,{className:`de-center`,children:(0,X.jsxs)(`div`,{className:`de-error`,role:`alert`,children:[(0,X.jsx)(`strong`,{children:`Cannot open document.`}),(0,X.jsx)(`div`,{children:se.message})]})}):k?k.kind===`docx`?(0,X.jsx)(Sd,{client:k,initialZoom:s},String(k.name)+k.size):k.kind===`xlsx`?(0,X.jsx)(im,{client:k}):(0,X.jsx)(Ep,{client:k,initialZoom:s,thumbnails:c}):t||ne?(0,X.jsxs)(`div`,{className:`de-center`,children:[(0,X.jsx)(`div`,{className:`de-spinner`}),(0,X.jsx)(`div`,{children:A?.phase===`download`&&A.total?`Downloading… ${$m(A.loaded)} / ${$m(A.total)}`:`Opening…`})]}):(0,X.jsx)(`div`,{className:`de-center`,children:`No document`}),(0,X.jsxs)(`div`,{className:r?`de-root ${r}`:`de-root`,style:i,onKeyDown:ke,children:[a&&(0,X.jsxs)(`div`,{className:`de-bar`,children:[k&&(0,X.jsx)(`span`,{className:`de-badge de-badge-${k.kind}`,children:k.kind}),y&&(0,X.jsx)(Nf,{actions:Oe}),(0,X.jsx)(`span`,{className:`de-title`,title:z,children:z}),(0,X.jsx)(`span`,{className:`de-status`,ref:M,hidden:!k}),k&&k.size>0&&(0,X.jsx)(`span`,{className:`de-status`,children:$m(k.size)}),k&&e.collab&&(0,X.jsx)(Jm,{client:k,state:ue}),o,k&&g&&(0,X.jsxs)(`button`,{type:`button`,className:C?`de-mode de-mode-on`:`de-mode`,onClick:()=>w(e=>!e),title:C?`Switch to viewing`:`Edit document`,children:[(0,X.jsx)(Qc,{name:C?`view`:`edit`,size:16}),C?`View`:`Edit`]}),k&&he&&(C||T)&&(0,X.jsxs)(`button`,{type:`button`,className:T?`de-mode de-save-dirty`:`de-mode`,disabled:D,onClick:()=>void ge(),title:`Save a copy (Ctrl+S)`,children:[(0,X.jsx)(Qc,{name:`save`,size:16}),D?`Saving…`:T||x?`Save`:`Download`]}),(0,X.jsx)(`div`,{className:`de-progress`,style:{width:`${R?Math.max(L,3):100}%`,opacity:+!!R}})]}),a&&k&&C&&de&&(0,X.jsx)(`div`,{className:`de-ebar-host`,ref:te}),(0,X.jsxs)(`div`,{className:`de-body`,children:[(0,X.jsx)(Ol.Provider,{value:_e,children:(0,X.jsx)(Ml.Provider,{value:j,children:Ae})}),k&&ue.collab&&(0,X.jsx)(Ym,{client:k,collab:ue.collab})]}),ve&&(0,X.jsx)(zl,{text:ve,onDone:be}),xe&&(0,X.jsx)(Rl,{title:`Discard unsaved changes?`,message:xe.message,ok:`Continue`,onOk:xe.run,onClose:()=>F(null)}),I&&k&&(0,X.jsx)(Ll,{spec:{title:`Rename`,label:`File name`,initial:pe,ok:`Rename`,onOk:t=>{let n=t.trim().replace(/[\\/:*?"<>|]+/g,` `).replace(RegExp(`\\${Zm[k.kind]}$`,`i`),``);n&&(ae(n+Zm[k.kind]),e.onRename?.(n+Zm[k.kind]))}},onClose:()=>Se(!1)}),Ce&&k&&(0,X.jsx)(Ed,{client:k,file:[[`Name`,me],[`Type`,Of[k.kind]],...k.size>0?[[`File size`,$m(k.size)]]:[],...T?[[`Status`,`Unsaved changes`]]:[]],stats:P.current?.stats()??[],onClose:()=>we(!1)})]})}function th(e,t){let n=(0,d.createRoot)(e),r=t,i=e.getRootNode()instanceof ShadowRoot?e.getRootNode():void 0,a=()=>n?.render((0,u.createElement)(eh,{...r,styleTarget:i}));return a(),{update(e){r={...r,...e},a()},destroy(){n?.unmount(),n=null}}}var nh=class extends HTMLElement{constructor(...e){super(...e),A(this,`viewer`,void 0),A(this,`_file`,void 0)}get file(){return this._file}set file(e){this._file=e,this.sync()}connectedCallback(){if(this.viewer)return;let e=this.shadowRoot??this.attachShadow({mode:`open`}),t=document.createElement(`div`);t.style.cssText=`width:100%;height:100%`,e.innerHTML=`<style>:host{display:block;height:480px;position:relative}</style>`,e.appendChild(t),this.viewer=th(t,this.props())}disconnectedCallback(){this.viewer?.destroy(),this.viewer=void 0,this.shadowRoot&&(this.shadowRoot.innerHTML=``)}attributeChangedCallback(){this.sync()}props(){return{src:this._file??this.getAttribute(`src`),name:this.getAttribute(`name`)??void 0,toolbar:this.getAttribute(`toolbar`)!==`false`,thumbnails:this.getAttribute(`thumbnails`)!==`false`,editable:this.hasAttribute(`editable`)&&this.getAttribute(`editable`)!==`false`,allowSave:this.getAttribute(`save`)!==`false`,allowDownload:this.getAttribute(`download`)!==`false`,fileMenu:this.getAttribute(`file-menu`)!==`false`,allowOpen:this.getAttribute(`open`)!==`false`,collab:this.getAttribute(`collab`)&&this.getAttribute(`room`)?{transport:this.getAttribute(`collab`),room:this.getAttribute(`room`),base:Number(this.getAttribute(`base`))||0,user:{name:this.getAttribute(`user`)||`Guest`}}:void 0,onLoad:e=>this.dispatchEvent(new CustomEvent(`load`,{detail:{kind:e.kind,name:e.name}})),onError:e=>this.dispatchEvent(new CustomEvent(`error`,{detail:e}))}}sync(){this.viewer?.update(this.props())}};A(nh,`observedAttributes`,[`src`,`name`,`toolbar`,`thumbnails`,`editable`,`save`,`download`,`file-menu`,`open`,`collab`,`room`,`user`,`base`]);function rh(e=`office-viewer`){typeof customElements<`u`&&!customElements.get(e)&&customElements.define(e,nh)}return rh(),e.DocViewer=eh,e.OfficeViewerElement=nh,e.defineElement=rh,e.mount=th,e})({});
|
|
84
|
+
`).flatMap((e,t)=>e.split(` `).map((e,n)=>({r:h.ar+t,c:h.ac+n,input:e})));n.length&&H(r.call(`xlsx.set`,t,n.slice(0,1e5)))},zt=()=>{let e=B.r1-B.r0+1,t=B.c1-B.c0+1,n=e===1?`row ${B.r0+1}`:`rows ${B.r0+1}–${B.r1+1}`,r=t===1?`column ${$o(B.c0)}`:`columns ${$o(B.c0)}–${$o(B.c1)}`,i=e===1&&t===1;return[{label:`Cut`,icon:`cut`,hint:`${Q}X`,run:()=>document.execCommand(`cut`)},{label:`Copy`,icon:`copy`,hint:`${Q}C`,run:()=>document.execCommand(`copy`)},{label:`Paste`,icon:`paste`,hint:`${Q}V`,run:()=>void navigator.clipboard?.readText().then(Rt).catch(()=>le(`The browser blocked clipboard access — use ${Q}V to paste`))},{label:`Insert ${e} row${e>1?`s`:``} above`,icon:`rowAbove`,sep:!0,run:()=>Lt(`rowAbove`)},{label:`Insert ${e} row${e>1?`s`:``} below`,icon:`rowBelow`,run:()=>Lt(`rowBelow`)},{label:`Insert ${t} column${t>1?`s`:``} left`,icon:`colLeft`,run:()=>Lt(`colLeft`)},{label:`Insert ${t} column${t>1?`s`:``} right`,icon:`colRight`,run:()=>Lt(`colRight`)},{label:`Delete ${n}`,icon:`delRow`,sep:!0,run:()=>Lt(`delRow`)},{label:`Delete ${r}`,icon:`delCol`,run:()=>Lt(`delCol`)},{label:`Hide ${n}`,icon:`hide`,sep:!0,run:()=>Lt(`hideRows`)},{label:`Hide ${r}`,icon:`hide`,run:()=>Lt(`hideCols`)},{label:`Unhide rows`,icon:`view`,run:()=>Lt(`unhideRows`)},{label:`Unhide columns`,icon:`view`,run:()=>Lt(`unhideCols`)},{label:jt?`Unmerge cells`:`Merge cells`,icon:`merge`,sep:!0,run:Mt,disabled:i&&!jt},{label:`Sort ${i?`sheet`:`range`} by ${$o(h.ac)}, A → Z`,icon:`sortAZ`,run:()=>It(!1)},{label:`Sort ${i?`sheet`:`range`} by ${$o(h.ac)}, Z → A`,icon:`sortZA`,run:()=>It(!0)},{label:`Fill down`,icon:`down`,hint:`${Q}D`,run:()=>void At({op:`fill`,range:B,dir:`down`}),disabled:e===1},{label:`Fill right`,hint:`${Q}R`,run:()=>void At({op:`fill`,range:B,dir:`right`}),disabled:t===1},{label:`Clear contents`,icon:`trash`,hint:`Del`,sep:!0,run:yt},{label:`Clear formatting`,icon:`clear`,hint:`${Q}\\`,run:()=>xt({clear:!0})},{label:`Freeze up to ${$o(h.ac)}${h.ar+1}`,icon:`freeze`,sep:!0,run:()=>Pt(`sel`)},{label:`Unfreeze`,run:()=>Pt(`none`),disabled:!N.rows&&!N.cols}]};(0,u.useEffect)(()=>{if(!ie.open||!ie.q){ce([]);return}let e=!0,n=setTimeout(()=>{r.call(`xlsx.find`,t,ie.q,oe).then(t=>e&&ce(t),()=>{})},150);return()=>{e=!1,clearTimeout(n)}},[r,t,ie.open,ie.q,ie.tick,oe,b]);let Bt=e=>{let t=se[e];t&&(ae(t=>({...t,idx:e})),Fe({ar:t.r,ac:t.c,fr:t.r,fc:t.c}),We(t.r,t.c))},Vt=ie.open?se:[],Ht=e=>{let t=ht.current;if(t){let{r:n,c:r}=Ge(e.clientX,e.clientY,e.currentTarget);kt(t.ar,t.ac,n,r,t.axis);return}if(!S.current)return;let{r:n,c:r}=Ge(e.clientX,e.clientY,e.currentTarget);n>=0&&r>=0&&(n!==h.fr||r!==h.fc)&&g(e=>({...e,fr:n,fc:r}))},Ut=i&&et?Ue(i.r,i.c):null,Wt=i?i.value:Je(y,h.ar,h.ac),Gt=e=>{if(!i||e.nativeEvent.isComposing)return;let t=e.metaKey||e.ctrlKey;if(ct.length){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=ct.length;D(n=>(Math.min(n,t-1)+(e.key===`ArrowDown`?1:t-1))%t);return}if(e.key===`Tab`||e.key===`Enter`&&!e.altKey&&!e.shiftKey){e.preventDefault(),_t(ct[Math.min(E,ct.length-1)]);return}if(e.key===`Escape`){e.preventDefault();let t=st?.s;a(e=>e&&{...e,noSuggest:t});return}}let n=fm[e.key];if(n&&!t&&!e.altKey&&i.mode===`enter`){if(rt){e.preventDefault(),gt(n[0],n[1],e.shiftKey);return}if(tt&&!e.shiftKey){e.preventDefault(),Ze(n);return}}if((e.key===`Home`||e.key===`End`)&&!t&&!e.altKey){e.preventDefault();let t=e.currentTarget,n=t.value.length;e.key===`Home`?t.setSelectionRange(0,e.shiftKey?t.selectionEnd??0:0,e.shiftKey?`backward`:`none`):t.setSelectionRange(e.shiftKey?t.selectionStart??n:n,n),ft(t)}else e.key===`F2`?(e.preventDefault(),a(e=>e&&{...e,mode:e.mode===`enter`?`edit`:`enter`})):e.key===`Enter`&&!e.altKey?(e.preventDefault(),Ze([e.shiftKey?-1:1,0])):e.key===`Tab`?(e.preventDefault(),Ze([0,e.shiftKey?-1:1])):e.key===`Escape`&&(e.preventDefault(),Qe())},Kt=null;if(i&&(ct.length||lt)){let e=lt&&nt?.call?Oo(lt,nt.call.arg):-1;Kt=ct.length?(0,X.jsx)(`div`,{className:`de-fassist`,role:`listbox`,onMouseDown:e=>e.preventDefault(),children:ct.map((e,t)=>{let n=t===Math.min(E,ct.length-1);return(0,X.jsxs)(`div`,{role:`option`,"aria-selected":n,className:n?`de-fsug on`:`de-fsug`,onMouseEnter:()=>D(t),onClick:()=>_t(e),children:[(0,X.jsx)(`span`,{className:`de-fsug-name`,children:e.name}),(0,X.jsxs)(`span`,{className:`de-fsug-args`,children:[`(`,[...e.args,...e.variadic?[`...`]:[]].join(`, `),`)`]}),n&&(0,X.jsx)(`div`,{className:`de-fsug-desc`,children:e.desc})]},e.name)})}):(0,X.jsxs)(`div`,{className:`de-fassist de-fhint`,onMouseDown:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{children:[lt.name,`(`,[...lt.args,...lt.variadic?[`...`]:[]].map((t,n,r)=>(0,X.jsxs)(`span`,{children:[n===e?(0,X.jsx)(`b`,{children:t}):t,n<r.length-1?`, `:``]},n)),`)`]}),(0,X.jsx)(`div`,{className:`de-fsug-desc`,children:lt.desc})]})}let qt=i&&Ut?{left:Ut.x-1,top:Ut.y-1,minWidth:Ut.w+2,width:Math.max(Ut.w+2,Math.min(480,i.value.length*8+16)),height:Math.max(Ut.h+2,i.value.split(`
|
|
85
|
+
`).length*18+4),...n.baseFont}:void 0,Jt=[];if(i&&at.length){let e=0;for(let t of at)t.s>e&&Jt.push(i.value.slice(e,t.s)),Jt.push((0,X.jsx)(`span`,{style:{color:t.color},children:i.value.slice(t.s,t.e)},t.s)),e=t.e;Jt.push(i.value.slice(e)+``)}let Yt=(()=>{if(!qt||!Kt)return;let e=qt.top+qt.height+2;return e+200>p.h&&qt.top>200?{left:qt.left,bottom:p.h-qt.top+2}:{left:qt.left,top:e}})();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`de-fx`,children:[(0,X.jsxs)(`div`,{className:`de-fx-ref`,children:[$o(h.ac),h.ar+1,!V&&`:${$o(B.c1)}${B.r1+1}`]}),l?(0,X.jsx)(`input`,{ref:T,className:`de-fx-val de-fx-input`,value:Wt,spellCheck:!1,"aria-label":`Cell content`,onFocus:()=>!i&&void Ye(void 0,!0),onChange:e=>pt(e.target),onSelect:e=>ft(e.currentTarget),onKeyDown:Gt,onBlur:()=>{o.current||i&&(i.bar||!et)&&Ze()}}):(0,X.jsx)(`div`,{className:`de-fx-val`,title:Wt,children:Wt}),i&&!tt&&Kt&&(0,X.jsx)(`div`,{className:`de-fassist-at`,style:{left:88,top:30},children:Kt})]}),(0,X.jsx)(`div`,{ref:f,className:`de-grid`,tabIndex:0,onKeyDown:Dt,onCopy:e=>{i||(e.preventDefault(),e.clipboardData.setData(`text/plain`,Et()))},onCut:e=>{!i&&l&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,Et()),yt())},onPaste:e=>{!i&&l&&(e.preventDefault(),Rt(e.clipboardData.getData(`text/plain`)))},children:(0,X.jsx)(`div`,{style:{position:`relative`,width:Math.max(ve,p.w),height:Math.max(ye,p.h)},children:(0,X.jsxs)(`div`,{className:`de-grid-view`,style:{width:p.w,height:p.h,...n.baseFont},onMouseDown:Ot,onMouseMove:Ht,onContextMenu:e=>{if(!l)return;e.preventDefault();let{r:t,c:n}=Ge(e.clientX,e.clientY,e.currentTarget);t>=0&&n>=0&&(t<B.r0||t>B.r1||n<B.c0||n>B.c1)&&Fe({ar:t,ac:n,fr:t,fc:n}),O({x:e.clientX,y:e.clientY})},onDoubleClick:()=>!i&&void Ye(),children:[Ie(`main`,Ee,De,Oe,ke,Se,Ce,fe+Ve,$p+He,we,Te),ze>0&&Ie(`top`,0,ze-1,Oe,ke,Se,0,fe+Ve,$p,we,He),Be>0&&Ie(`left`,Ee,De,0,Be-1,0,Ce,fe,$p+He,Ve,Te),ze>0&&Be>0&&Ie(`tl`,0,ze-1,0,Be-1,0,0,fe,$p,Ve,He),Le(`ch`,Oe,ke,Se,fe+Ve,we),Be>0&&Le(`chf`,0,Be-1,0,fe,Ve),Re(`rh`,Ee,De,Ce,$p+He,Te),ze>0&&Re(`rhf`,0,ze-1,0,$p,He),ze>0&&(0,X.jsx)(`div`,{className:`de-freeze-h`,style:{left:0,top:$p+He-1,width:p.w,height:2}}),Be>0&&(0,X.jsx)(`div`,{className:`de-freeze-v`,style:{left:fe+Ve-1,top:0,width:2,height:p.h}}),(0,X.jsx)(`div`,{className:`de-corner`,style:{width:fe,height:$p}}),i&&tt&&qt&&(0,X.jsxs)(X.Fragment,{children:[Jt.length>0&&(0,X.jsx)(`div`,{ref:w,className:`de-cell-edit de-cell-hl`,style:qt,"aria-hidden":!0,children:Jt}),(0,X.jsx)(`textarea`,{ref:C,className:Jt.length?`de-cell-edit de-cell-edit-fx`:`de-cell-edit`,spellCheck:!1,value:i.value,style:qt,onMouseDown:e=>e.stopPropagation(),onChange:e=>pt(e.target),onSelect:e=>ft(e.currentTarget),onScroll:e=>{w.current&&(w.current.scrollTop=e.currentTarget.scrollTop)},onKeyDown:Gt,onBlur:e=>{if(!o.current){if(e.relatedTarget&&e.relatedTarget===T.current)return a(e=>e&&{...e,bar:!0,sync:0});Ze()}}}),Kt&&Yt&&(0,X.jsx)(`div`,{className:`de-fassist-at`,style:Yt,children:Kt})]})]})})}),l&&(0,X.jsx)(Rp,{css:bt,base:n.baseFont,format:n.formats[qe(h.ar,h.ac)]??`General`,merged:jt,frozen:!!(N.rows||N.cols),gridlines:d.gridLines,painter:te!==null,onToggle:Ct,onFormat:xt,onUndo:wt,onRedo:Tt,onPaint:()=>{ne(e=>e===null?qe(h.ar,h.ac):null),Ke()},onMerge:Nt,onFreeze:Pt,onGridlines:()=>void At({op:`gridlines`,show:!d.gridLines}),onFunc:e=>e?Ft(e):void Ye(`=`),onSort:It,onRows:Lt,onFind:()=>ae(e=>({...e,open:!0,tick:e.tick+1}))}),ie.open&&(0,X.jsx)(Ku,{query:ie.q,index:ie.idx,count:se.length,editable:l,replace:ie.replace,placeholder:`Find in sheet`,onQuery:e=>ae(t=>({...t,q:e,idx:0})),onNav:e=>se.length&&Bt((ie.idx+e+se.length)%se.length),onClose:()=>{ae(e=>({...e,open:!1})),Ke()},onReplace:(e,n)=>{let i=se[Math.min(ie.idx,se.length-1)];i&&H(r.call(`xlsx.replace`,t,ie.q,e,oe,n?void 0:{r:i.r,c:i.c}))},options:(0,X.jsx)(X.Fragment,{children:[[`matchCase`,`Match case`],[`whole`,`Entire cell`],[`formulas`,`In formulas`]].map(([e,t])=>(0,X.jsxs)(`label`,{className:`de-find-opt`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:!!oe[e],onChange:t=>k(n=>({...n,[e]:t.target.checked}))}),t]},e))})}),A&&(0,X.jsx)(zl,{text:A,onDone:()=>le(null)}),ee&&(0,X.jsx)(Il,{x:ee.x,y:ee.y,items:zt(),onClose:()=>O(null)})]})}var gm=new Set([`open`,`part`,`docx.start`,`save`,`dirty`]),_m=e=>e.t===`p`?e.pid===void 0?null:{p:e.pid}:e.t===`tbl`?{tid:e.tid,item:e.item}:null;function vm(e,t){return e?`p`in t?e.t===`p`&&e.pid===t.p:e.t===`tbl`&&(t.tid!==void 0&&e.tid===t.tid||t.item!==void 0&&e.item===t.item):!1}var ym=e=>[...new Set(e)];function bm(e,t=[]){for(let n of e)if(n.t===`p`&&n.pid!==void 0)t.push(n.pid);else if(n.t===`tbl`)for(let e of n.rows)for(let n of e.cells)bm(n.blocks,t);return t}function xm(e){if(e.t!==`text`)return JSON.stringify(e);let{text:t,...n}=e;return JSON.stringify(n)}function Sm(e,t){let n=e=>{let t=[];for(let n of e){let e=xm(n);if(n.t===`text`)for(let r=0;r<n.text.length;r++)t.push(e+`\0`+n.text[r]);else t.push(e)}return t},r=n(e),i=n(t),a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a++;let o=0;for(;o<r.length-a&&o<i.length-a&&r[r.length-1-o]===i[i.length-1-o];)o++;if(a===r.length&&a===i.length)return null;let[,s]=Jl(t,a),[c]=Jl(s,i.length-a-o);return{at:a,del:r.length-a-o,ins:c}}function Cm(e,t,n,r){let i=Vl(e),a=Math.max(0,Math.min(t,i)),o=Math.max(0,Math.min(n,i-a)),[s,c]=Jl(e,a),[,l]=Jl(c,o);return[...s,...r,...l]}function wm(e,t,n,r,i){return e<t||e===t&&(n>0||i)?e:e>=t+n?e-n+r:t+r}function Tm(e,t,n){if(t===n)return e;let r=0;for(;r<t.length&&r<n.length&&t[r]===n[r];)r++;let i=0;for(;i<t.length-r&&i<n.length-r&&t[t.length-1-i]===n[n.length-1-i];)i++;return e<=r?e:e>=t.length-i?n.length-(t.length-e):n.length-i}var Em=(e,t)=>e.pid===t.pid&&e.from===t.from&&e.sid===t.sid&&!!e.pb==!!t.pb&&e.keepSect===t.keepSect&&JSON.stringify(e.pd??null)===JSON.stringify(t.pd??null)&&JSON.stringify(e.ps)===JSON.stringify(t.ps)&&JSON.stringify(e.orig??null)===JSON.stringify(t.orig??null),Dm=class{constructor(e){A(this,`client`,void 0),A(this,`host`,void 0),A(this,`suppress`,0),A(this,`res`,new Map),A(this,`resKey`,new Map),A(this,`results`,new WeakMap),A(this,`snap`,null),A(this,`touchedModel`,!1),A(this,`site`,0),A(this,`counter`,0),A(this,`offHost`,void 0),A(this,`onPresence`,void 0),A(this,`lastPresence`,``),A(this,`raf`,0),A(this,`push`,void 0),A(this,`submit`,void 0),A(this,`onSel`,()=>{!this.raf&&this.host&&(this.raf=requestAnimationFrame(()=>{this.raf=0;let e=this.host&&this.ed.input.readSel();if(!e)return;let t=this.toD(e.a),n=this.toD(e.f);if(!t||!n)return;let r={k:`docx`,a:t,f:n},i=JSON.stringify(r);i!==this.lastPresence&&(this.lastPresence=i,this.onPresence?.(r))}))}),this.client=e}ready(){return new Promise(e=>{this.offHost=Pc(this.client,`docx`,t=>{this.host?.editor!==t.editor&&(this.host&&(this.host.editor.onCommit=void 0),this.host=t,t.editor.onCommit=e=>this.onCommit(e),this.allocPids(),e())}),typeof document<`u`&&document.addEventListener(`selectionchange`,this.onSel)})}setSite(e){this.site=e,this.allocPids()}allocPids(){let e=this.host?.editor;if(!e||!this.site)return;let t=2e9+this.site*1e7;(e.nextPid<t||e.nextPid>=t+1e7)&&(e.nextPid=t)}dispose(){this.offHost?.(),this.host&&(this.host.editor.onCommit=void 0),typeof document<`u`&&document.removeEventListener(`selectionchange`,this.onSel),this.raf&&cancelAnimationFrame(this.raf)}captures(e){return!this.suppress&&!gm.has(e)&&e!==`docx.edit`&&e!==`docx.table`&&e.startsWith(`docx.`)}intercept(e,t){if(this.submit&&this.captures(e)){switch(e){case`docx.image`:{let e=new Uint8Array(t[0].slice(0));return this.submit({t:`image`,key:this.key(),bytes:e,ext:t[1]})}case`docx.link`:return this.submit({t:`link`,key:this.key(),url:t[0]})}return this.submit({t:`call`,method:e,args:t})}}key(){return`${this.site}:${++this.counter}:${Math.random().toString(36).slice(2,7)}`}get st(){return this.host.st}get ed(){return this.host.editor}locate(e){let t=[];return this.st.blocks.forEach((n,r)=>{n.t===`p`?n.pid===e&&t.push({list:this.st.blocks,index:r,pa:String(r),p:n}):n.t===`tbl`&&n.rows.forEach((n,i)=>n.cells.forEach((n,a)=>n.blocks.forEach((o,s)=>{o.t===`p`&&o.pid===e&&t.push({list:n.blocks,index:s,pa:`${r}.${i}.${a}.${s}`,p:o})})))}),t}topIndex(e){return this.st.blocks.findIndex(t=>vm(t,e))}region(e){let t=new Set(e);for(let n of e){let e=this.locate(n)[0];if(!e)continue;let r=[];for(let n=e.index;n<e.list.length;n++){let i=e.list[n];if(i.t!==`p`||i.pid===void 0||!t.has(i.pid))break;r.push(e.pa.replace(/\d+$/,String(n)))}return r}return null}remap(e){if(e.t===`img`){let t=e.ck,n=t?this.res.get(t):void 0;return n&&typeof n==`object`?{...e,rid:n.rid,target:n.path}:e}if(e.t===`text`){let t=e.lck,n=t?this.res.get(t):void 0;return typeof n==`string`?{...e,lk:n}:e}return e.t===`p`?{...e,runs:e.runs.map(e=>this.remap(e))}:e.t===`tbl`?{...e,rows:e.rows.map(e=>({...e,cells:e.cells.map(e=>({...e,blocks:e.blocks.map(e=>this.remap(e))}))}))}:e}tag(e){return e.t===`img`&&e.rid&&this.resKey.has(e.rid)&&!e.ck?{...e,ck:this.resKey.get(e.rid)}:e.t===`text`&&e.lk&&this.resKey.has(e.lk)&&!e.lck?{...e,lck:this.resKey.get(e.lk)}:e.t===`p`?{...e,runs:e.runs.map(e=>this.tag(e)),caret:void 0}:e.t===`tbl`?{...e,rows:e.rows.map(e=>({...e,cells:e.cells.map(e=>({...e,blocks:e.blocks.map(e=>this.tag(e))}))}))}:e}async fetchRes(e){if(e.t===`image`&&!this.res.has(e.key)){let t=await this.client.direct(`docx.image`,e.bytes.slice().buffer,e.ext);this.res.set(e.key,t),this.resKey.set(t.rid,e.key)}else if(e.t===`link`&&!this.res.has(e.key)){let t=await this.client.direct(`docx.link`,e.url);this.res.set(e.key,t),this.resKey.set(t,e.key)}else if(e.t===`call`&&!this.results.has(e)){let t=this.client.direct;this.results.set(e,await t(e.method,...e.args))}}onCommit(e){if(this.suppress||!this.push)return;if(e.kind===`paras`){let t=e.before,n=e.next;if(t.length===1&&n.length===1&&t[0].pid!==void 0&&Em(t[0],n[0])&&this.locate(t[0].pid).length===1){let e=Sm(t[0].runs,n[0].runs);if(!e)return;this.push({t:`text`,pid:t[0].pid,at:e.at,del:e.del,ins:e.ins.map(e=>this.tag(e))},[{t:`paras`,before:t,next:n}]);return}this.push({t:`paras`,before:t.map(e=>e.pid),next:n.map(e=>this.tag(e))},[{t:`paras`,before:t,next:n}]);return}let t=e.bi>0?_m(this.st.blocks[e.bi-1]):null;this.push({t:`blocks`,before:e.before.map(_m).filter(e=>!!e),prev:t,next:e.next.map(e=>this.tag(e))},[{t:`blocks`,before:e.before,next:e.next,prev:t}])}transform(e,t){if(e.t!==`text`)return e;if(t.t===`text`&&t.pid===e.pid){let n=Vl(t.ins),r=wm(e.at,t.at,t.del,n,!1),i=e.del?Math.max(r,wm(e.at+e.del,t.at,t.del,n,!0)):r;return r===e.at&&i-r===e.del?e:{...e,at:r,del:i-r}}return t.t===`paras`&&(t.before.includes(e.pid)||t.next.some(t=>t.pid===e.pid))?t.next.some(t=>t.pid===e.pid)?e:null:t.t===`blocks`&&t.before.some(t=>`p`in t&&t.p===e.pid)&&!bm(t.next).includes(e.pid)?null:e}touched(e){switch(e.t){case`text`:return[`p`+e.pid];case`paras`:return[...e.before,...e.next.map(e=>e.pid)].map(e=>`p`+e);case`blocks`:{let t=[...e.before,...e.prev?[e.prev]:[],...e.next.map(_m).filter(e=>!!e)].map(e=>`p`in e?`p`+e.p:`t`+(e.item??`n`+e.tid));for(let n of bm(e.next))t.push(`p`+n);return t}default:return[]}}conflicts(e,t){let n=new Set(e.flatMap(e=>this.touched(e)));return t.some(e=>this.touched(e).some(e=>n.has(e)))}pessimistic(e){return e.t===`call`}async prepare(e){for(;this.host?.editor.input.isComposing;)await new Promise(e=>setTimeout(e,50));for(let t of e)await this.fetchRes(t);this.capture()}async apply(e,t){switch(e.t){case`image`:case`link`:return await this.fetchRes(e),{result:this.res.get(e.key)};case`call`:{await this.fetchRes(e);let t=this.results.get(e);if(e.method===`docx.style`&&t&&typeof t==`object`&&this.host){let e=t.styles;this.ed.styles=e,this.ed.onStyles?.(e)}return{result:t}}}if(!this.host)throw Error(`Document editor not ready`);(t===`remote`||t===`replay`)&&this.capture(),this.touchedModel=!0,this.suppress++;try{return{undo:this.run(e)}}finally{this.suppress--}}run(e){let t=this.ed;if(e.t===`text`){let n=this.locate(e.pid);if(n.length!==1||!t.para(n[0].pa))return null;let r=n[0].p,i={...r,runs:Cm(r.runs,e.at,e.del,e.ins.map(e=>this.remap(e))),edited:!0};return t.replace([n[0].pa],[i],this.sel(),{history:!1,label:`collab`}),[{t:`paras`,before:[r],next:[i]}]}if(e.t===`paras`){let n=e.next.map(e=>this.remap(e)),r=new Set(n.map(e=>e.pid)),i=this.region(e.before);if(!i||!i.length)return null;let a=[],o=new Set(i.map(e=>t.para(e)?.pid??-1));for(let n of ym([...e.before,...r]))if(!o.has(n))for(let e of this.locate(n).reverse()){if(!t.para(e.pa))continue;let n=t=>{let n=e.list[t];return n?.t===`p`&&n.pid!==void 0?{pid:n.pid,k:this.locate(n.pid).findIndex(n=>n.list===e.list&&n.index===t)}:void 0},r={t:`paras`,before:[e.p],next:[],prev:n(e.index-1),after:n(e.index+1)};t.replace([e.pa],[],this.sel(),{history:!1,label:`collab`}),a.push(r)}let s=this.region(e.before);if(!s?.length)return a;let c=s.map(e=>t.para(e)).filter(Boolean);return c.length===s.length&&(t.replace(s,n,this.sel(),{history:!1,label:`collab`}),a.push({t:`paras`,before:c,next:n})),a}if(e.t===`blocks`){let n=e.next.map(e=>this.remap(e)),r,i=0;if(e.before.length){if(r=this.topIndex(e.before[0]),r<0){let t=e.before.find(e=>this.topIndex(e)>=0);if(!t)return null;r=this.topIndex(t)}for(;r+i<this.st.blocks.length&&e.before.some(e=>vm(this.st.blocks[r+i],e));)i++}else if(r=e.prev?this.topIndex(e.prev)+1:0,e.prev&&r===0)return null;let a=this.st.blocks.slice(r,r+i),o=new Map(a.flatMap(e=>e.t===`p`&&e.pid!==void 0?[[e.pid,e]]:[]));return n=n.map(e=>e.t===`p`&&e.pid!==void 0&&o.has(e.pid)?o.get(e.pid):e),t.replaceBlocks(r,i,n,null,!1),[{t:`blocks`,before:a,next:n,prev:r>0?_m(this.st.blocks[r-1]):null}]}return null}revert(e){let t=e;if(t&&this.host){this.capture(),this.touchedModel=!0,this.suppress++;try{for(let e=t.length-1;e>=0;e--)this.undoStep(t[e])}finally{this.suppress--}}}undoStep(e){let t=this.ed;if(e.t===`paras`){if(!e.next.length){let n=e=>e?this.locate(e.pid)[e.k]:void 0,r=n(e.prev);if(r&&t.para(r.pa))return t.replace([r.pa],[r.p,...e.before],this.sel(),{history:!1,label:`collab`});let i=n(e.after);i&&t.para(i.pa)&&t.replace([i.pa],[...e.before,i.p],this.sel(),{history:!1,label:`collab`});return}let n=this.locate(e.next[0].pid)[0];if(!n)return;let r=e.next.map((e,t)=>n.pa.replace(/\d+$/,String(n.index+t)));if(r.some((n,r)=>t.para(n)?.pid!==e.next[r].pid))return;t.replace(r,e.before,this.sel(),{history:!1,label:`collab`});return}let n=e.next.length?_m(e.next[0]):null,r=n?this.topIndex(n):e.prev?this.topIndex(e.prev)+1:0;if(r<0)return;let i=new Map(this.st.blocks.slice(r,r+e.next.length).flatMap(e=>e.t===`p`&&e.pid!==void 0?[[e.pid,e]]:[]));t.replaceBlocks(r,e.next.length,e.before.map(e=>e.t===`p`&&e.pid!==void 0&&i.has(e.pid)?i.get(e.pid):e),null,!1)}toD(e){let t=this.ed.para(e.pa);if(!t||t.pid===void 0)return null;let n=this.locate(t.pid);return{pid:t.pid,k:Math.max(0,n.findIndex(t=>t.pa===e.pa)),o:e.o}}fromD(e){let t=this.locate(e.pid),n=t[Math.min(e.k,t.length-1)];return n?{pa:n.pa,o:Math.min(e.o,Vl(n.p.runs))}:null}capture(){if(this.snap||!this.host)return;let e=!!this.ed.input.readSel(),t=this.ed.input.sel(),n=t&&this.toD(t.a),r=t&&this.toD(t.f);if(!n||!r)return;let i=new Map;for(let e of[n,r]){let t=this.locate(e.pid)[e.k];t&&i.set(`${e.pid}:${e.k}`,Wl(t.p.runs))}this.snap={a:n,f:r,text:i,focused:e}}sel(){let e=this.snap,t={pa:`0`,o:0};if(!e)return this.ed.input.lastSel??{a:t,f:t};let n=n=>{let r=this.locate(n.pid)[n.k]??this.locate(n.pid)[0];if(!r)return this.ed.input.lastSel?.f??t;let i=e.text.get(`${n.pid}:${n.k}`),a=Wl(r.p.runs);return{pa:r.pa,o:i===void 0?Math.min(n.o,a.length):Tm(n.o,i,a)}};return{a:n(e.a),f:n(e.f)}}settled(){let e=this.snap,t=this.touchedModel;if(this.touchedModel=!1,!this.host)return;if(!e){t&&(this.ed.pendingSel=null);return}let n=this.sel();this.snap=null,this.ed.pendingSel=e.focused?n:null,e.focused||(this.ed.input.lastSel=n)}rects(e,t){if(!this.host)return{caret:null,sel:[]};let n=e.querySelector(`.de-pages`),r=this.fromD(t.a),i=this.fromD(t.f);if(!n||!r||!i)return{caret:null,sel:[]};let a=hu(n,i),o=null;if(a){let e=document.createRange();try{e.setStart(a[0],a[1]),e.collapse(!0),o=e.getClientRects()[0]??(a[0].nodeType===1?a[0].getBoundingClientRect():e.getBoundingClientRect())}catch{o=null}}let s=[],c=hu(n,r);if(c&&a&&(r.pa!==i.pa||r.o!==i.o)){let e=document.createRange();try{this.ed.cmp(r.pa,i.pa)<0||r.pa===i.pa&&r.o<i.o?(e.setStart(c[0],c[1]),e.setEnd(a[0],a[1])):(e.setStart(a[0],a[1]),e.setEnd(c[0],c[1]));for(let t of Array.from(e.getClientRects()))t.width>.5&&s.push(t)}catch{}}return{caret:o,sel:s}}},Om=e=>e!==null,km=class{constructor(e,t,n){A(this,`transport`,void 0),A(this,`adapter`,void 0),A(this,`opts`,void 0),A(this,`site`,0),A(this,`rev`,0),A(this,`status`,`connecting`),A(this,`error`,void 0),A(this,`peers`,new Map),A(this,`log`,[]),A(this,`inflight`,null),A(this,`buffer`,[]),A(this,`queue`,void 0),A(this,`joined`,!1),A(this,`online`,!1),A(this,`counter`,0),A(this,`listeners`,new Map),A(this,`presence`,void 0),A(this,`presenceTimer`,void 0),A(this,`presenceAt`,0),A(this,`closed`,!1),this.transport=e,this.adapter=t,this.opts=n,this.rev=n.base??0,this.queue=Promise.resolve(t.ready?.()).catch(e=>this.fail(e.message)),e.onMessage=e=>this.enqueue(()=>this.onMessage(e)),e.onStatus=t=>{t===`open`?(this.online=!0,e.send(this.joined?{t:`hello`,room:n.room,user:n.user,have:this.rev,site:this.site}:{t:`hello`,room:n.room,user:n.user,base:n.base||void 0})):t===`closed`&&(this.online=!1,this.peers.clear(),this.emit(`peers`,[]),this.status!==`error`&&this.setStatus(this.joined?`offline`:`connecting`))},e.connect()}get pending(){return(this.inflight?.items.length??0)+this.buffer.length}nextId(){return`${this.site}.${++this.counter}.${Math.random().toString(36).slice(2,6)}`}submit(e){return new Promise((t,n)=>this.enqueue(async()=>{if(this.status===`error`)return n(Error(this.error??`Collaboration stopped`));if(this.adapter.pessimistic?.(e))this.buffer.push({op:e,applied:!1,done:t});else{let r;try{r=await this.adapter.apply(e,`local`)}catch(e){return n(e)}this.buffer.push({op:e,applied:!0,undo:r.undo}),t(r.result)}this.flush()}))}push(e,t){this.buffer.push({op:e,applied:!0,undo:t}),this.enqueue(async()=>this.flush())}setPresence(e){if(this.presence=e,this.presenceTimer)return;let t=Math.max(0,80-(Date.now()-this.presenceAt));this.presenceTimer=setTimeout(()=>{this.presenceTimer=void 0,this.presenceAt=Date.now(),this.online&&this.joined&&this.transport.send({t:`presence`,data:this.presence})},t)}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>n.delete(t)}context(e=this.opts.logWindow??5e3){return e>0?this.log.slice(-e):[]}idle(){return this.queue}close(){this.closed=!0,clearTimeout(this.presenceTimer),this.transport.close(),this.listeners.clear()}emit(e,t){for(let n of this.listeners.get(e)??[])n(t)}setStatus(e){this.status!==e&&(this.status=e,this.emit(`status`,e))}fail(e){this.error=e,this.setStatus(`error`),this.emit(`error`,Error(e))}enqueue(e){this.queue=this.queue.then(e).catch(e=>{console.error(`[office-engine collab]`,e),this.emit(`error`,e)})}async onMessage(e){if(!(this.closed||this.status===`error`))switch(e.t){case`welcome`:{if(e.reset)return this.fail(`The shared document history was reset; reopen the document`);let t=!this.joined;this.site=e.site,this.joined=!0,t&&(this.log=e.ctx??[],this.setStatus(`syncing`)),this.peers.clear();for(let t of e.peers)this.peers.set(t.site,t);this.emit(`peers`,[...this.peers.values()]);for(let t of e.log)await this.onBatch(t);this.inflight&&(this.inflight.base=this.rev,this.transport.send({t:`ops`,id:this.inflight.id,base:this.rev,ops:this.inflight.items.map(e=>e.op).filter(Om)})),this.flush(),this.presence!==void 0&&this.transport.send({t:`presence`,data:this.presence}),this.setStatus(`live`);return}case`batch`:return this.onBatch(e.b);case`presence`:{let t=this.peers.get(e.site);t&&(this.peers.set(e.site,{...t,presence:e.data}),this.emit(`peers`,[...this.peers.values()]));return}case`join`:this.peers.set(e.peer.site,e.peer),this.emit(`peers`,[...this.peers.values()]);return;case`leave`:this.peers.delete(e.site),this.emit(`peers`,[...this.peers.values()]);return;case`error`:return this.fail(e.message)}}async onBatch(e){if(e.seq<=this.rev)return;if(e.seq!==this.rev+1)return this.fail(`Missed operations (${this.rev+1}…${e.seq-1})`);if(this.inflight&&e.id===this.inflight.id)await this.ack(e);else{let t=this.canonical(e);if(t===null)return;await this.remote(t),this.log.push({seq:e.seq,site:e.site,ops:t})}this.rev=e.seq;let t=this.opts.logWindow??5e3;this.log.length>t&&this.log.splice(0,this.log.length-t),this.flush(),this.adapter.settled?.(),this.emit(`change`,void 0)}canonical(e){let t=e.ops.map(e=>e);if(e.base<e.seq-1&&(this.log[0]?.seq??1/0)>e.base+1&&this.rev>e.base)return this.fail(`Operation is too old to merge; reopen the document`),null;for(let n of this.log)if(!(n.seq<=e.base||n.site===e.site))for(let e of n.ops)t=t.map(t=>t===null?null:this.adapter.transform(t,e));return t.filter(Om)}async revertAll(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.applied){try{await this.adapter.revert(n.undo)}catch(e){console.error(`[office-engine collab] revert failed`,e)}n.applied=!1,n.undo=void 0}}}async replay(e,t){if(e.op)try{let n=await this.adapter.apply(e.op,t);e.undo=n.undo,e.applied=!0,e.done&&(e.done(n.result),e.done=void 0)}catch(e){console.error(`[office-engine collab] replay failed`,e)}}async remote(e){await this.adapter.prepare?.(e);let t=[...this.inflight?.items??[],...this.buffer];if(!t.length){for(let t of e)await this.applyRemote(t);return}let n=t.map(t=>{let n=t.op;for(let t of e)n!==null&&(n=this.adapter.transform(n,t));return n}),r=t.filter(e=>e.applied&&e.op).map(e=>e.op),i=n.some((e,n)=>e!==t[n].op)||r.length>0&&(this.adapter.conflicts?.(r,e)??!0);i&&await this.revertAll(t);for(let t of e)await this.applyRemote(t);if(t.forEach((e,t)=>e.op=n[t]),i)for(let e of t)!e.op||this.adapter.pessimistic?.(e.op)&&!e.applied&&e.done||await this.replay(e,`replay`)}async applyRemote(e){try{await this.adapter.apply(e,`remote`)}catch(t){console.error(`[office-engine collab] remote op failed`,t,e),this.emit(`error`,t)}}async ack(e){let t=this.inflight.items;this.inflight=null;let n=t.findIndex(e=>e.op&&!e.applied);if(n>=0){let e=[...t.slice(n),...this.buffer];await this.adapter.prepare?.(t.slice(n).filter(e=>e.op&&!e.applied).map(e=>e.op)),await this.revertAll(e);for(let n of e)!t.includes(n)&&n.op&&this.adapter.pessimistic?.(n.op)&&n.done||await this.replay(n,n.done?`local`:`replay`)}for(let e of t)e.done&&e.done(null);this.log.push({seq:e.seq,site:e.site,ops:t.map(e=>e.op).filter(Om)})}flush(){if(this.inflight||!this.buffer.length||!this.online||!this.joined||this.status===`error`)return;let e=this.buffer;this.buffer=[];let t=`${this.site}-${Date.now().toString(36)}-${++this.counter}`;this.inflight={id:t,base:this.rev,items:e},this.transport.send({t:`ops`,id:t,base:this.rev,ops:e.map(e=>e.op).filter(Om)})}},Am=`$b64`;function jm(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function Mm(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Nm(e){return JSON.stringify(e,(e,t)=>t instanceof Uint8Array?{[Am]:jm(t)}:t instanceof ArrayBuffer?{[Am]:jm(new Uint8Array(t))}:t)}function Pm(e){return JSON.parse(e,(e,t)=>t&&typeof t==`object`&&typeof t[Am]==`string`&&Object.keys(t).length===1?Mm(t[Am]):t)}var Fm=class{constructor(e,t){A(this,`url`,void 0),A(this,`protocols`,void 0),A(this,`onMessage`,void 0),A(this,`onStatus`,void 0),A(this,`ws`,void 0),A(this,`closed`,!1),A(this,`retry`,0),A(this,`timer`,void 0),this.url=e,this.protocols=t}connect(){this.closed=!1,this.open()}open(){if(this.closed)return;this.onStatus?.(`connecting`);let e=this.ws=new WebSocket(this.url,this.protocols);e.onopen=()=>{this.retry=0,this.onStatus?.(`open`)},e.onmessage=e=>{typeof e.data==`string`&&this.onMessage?.(Pm(e.data))},e.onclose=()=>{if(this.ws!==e||(this.ws=void 0,this.onStatus?.(`closed`),this.closed))return;let t=Math.min(1e4,300*2**this.retry++)*(.75+Math.random()*.5);this.timer=setTimeout(()=>this.open(),t)},e.onerror=()=>e.close()}send(e){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(Nm(e))}close(){this.closed=!0,clearTimeout(this.timer);let e=this.ws;this.ws=void 0,e?.close(),this.onStatus?.(`closed`)}},Im=new Set([`xlsx.set`,`xlsx.format`,`xlsx.sheetOp`,`xlsx.replace`,`xlsx.bookOp`,`xlsx.undo`,`xlsx.redo`]),Lm=class{constructor(e){A(this,`client`,void 0),A(this,`submit`,void 0),A(this,`nextId`,void 0),A(this,`onPresence`,void 0),A(this,`undoStack`,[]),A(this,`redoStack`,[]),A(this,`offLocal`,void 0),this.client=e,this.offLocal=Hc(e,e=>{let t=e,n=this.path(t.sheet);n&&this.onPresence?.({k:`xlsx`,sheet:n,range:t.range,ar:t.ar,ac:t.ac})})}dispose(){this.offLocal()}get meta(){return this.client.info.xlsx}path(e){return this.meta.sheets[e]?.path??``}id(){return this.nextId()}captures(e){return Im.has(e)}intercept(e,t){if(!this.submit)return;let n=t;switch(e){case`xlsx.set`:return this.local({t:`set`,id:this.id(),sheet:this.path(n[0]),cells:n[1]});case`xlsx.format`:return this.local({t:`fmt`,id:this.id(),sheet:this.path(n[0]),range:n[1],patch:n[2]});case`xlsx.sheetOp`:return this.local({t:`sheet`,id:this.id(),sheet:this.path(n[0]),op:n[1]});case`xlsx.replace`:return this.local({t:`replace`,id:this.id(),sheet:this.path(n[0]),query:n[1],by:n[2],opts:n[3],at:n[4]});case`xlsx.bookOp`:return this.local({t:`book`,id:this.id(),op:this.pbook(n[0])});case`xlsx.undo`:return this.history(this.undoStack,this.redoStack,`prev`);case`xlsx.redo`:return this.history(this.redoStack,this.undoStack,`next`)}}pbook(e){switch(e.op){case`add`:return{op:`add`,name:e.name,after:e.after===void 0?void 0:this.path(e.after)};case`rename`:return{op:`rename`,path:this.path(e.index),name:e.name};case`delete`:return{op:`delete`,path:this.path(e.index)};case`move`:return{op:`move`,path:this.path(e.from),to:e.to}}}local(e){if(e.t===`sheet`&&(e.op.op===`insertRows`||e.op.op===`insertCols`)){let t={op:e.op.op===`insertRows`?`deleteRows`:`deleteCols`,at:e.op.at,n:e.op.n};this.undoStack.push({kind:`inverse`,sheet:e.sheet,undo:t,redo:e.op})}else uc(e)||this.undoStack.push({kind:`op`,id:e.id});return this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],this.submit(e)}history(e,t,n){let r=e.pop();return r?(t.push(r),r.kind===`op`?this.submit({t:`revert`,id:this.id(),target:r.id,which:n}):this.submit({t:`sheet`,id:this.id(),sheet:r.sheet,op:n===`prev`?r.undo:r.redo})):Promise.resolve(null)}transform(e,t){return hc(e,t)}conflicts(e,t){return yc(e,t)}pessimistic(e){return uc(e)}async apply(e,t){let{res:n,rec:r}=await this.client.direct(`collab.xlsx.apply`,e);if(uc(e)){let e=e=>e.kind===`inverse`&&t===`local`;this.undoStack=this.undoStack.filter(e),this.redoStack=this.redoStack.filter(e)}return t!==`local`&&n&&this.client.notify(`collab:xlsx`,n),{result:n,undo:r}}async revert(e){if(typeof e!=`number`)return;let t=await this.client.direct(`collab.xlsx.revert`,e);t&&this.client.notify(`collab:xlsx`,t)}};function Rm(e,t){return t.t===`slides`&&t.op.op===`delete`&&`slide`in e&&e.slide===t.op.path?null:e}function zm(e,t){if(t.some(e=>e.t===`slides`||e.t===`revert`)||e.some(e=>e.t===`revert`))return!0;let n=new Set(e.flatMap(e=>`slide`in e&&e.t!==`image`?[e.slide]:[]));return t.some(e=>`slide`in e&&e.t!==`image`&&n.has(e.slide))}var Bm=new Set([`pptx.setText`,`pptx.shapes`,`pptx.slides`,`pptx.image`,`pptx.undo`]),Vm=class{constructor(e){A(this,`client`,void 0),A(this,`submit`,void 0),A(this,`nextId`,void 0),A(this,`onPresence`,void 0),A(this,`undoStack`,[]),A(this,`redoStack`,[]),A(this,`ridKey`,new Map),A(this,`offLocal`,void 0),this.client=e,this.offLocal=Hc(e,e=>{let t=e,n=this.path(t.slide);n&&this.onPresence?.({k:`pptx`,slide:n,top:t.top})})}dispose(){this.offLocal()}get meta(){return this.client.info.pptx}path(e){return this.meta.slides[e]?.path??``}id(){return this.nextId()}captures(e){return Bm.has(e)}intercept(e,t){if(!this.submit)return;let n=t;switch(e){case`pptx.setText`:return this.local({t:`text`,id:this.id(),slide:this.path(n[0]),sid:n[1],paras:n[2]}).then(e=>e.model);case`pptx.shapes`:{let e=n[1].map(e=>e.op===`insert`&&e.rid&&this.ridKey.has(e.rid)?{...e,rid:void 0,key:this.ridKey.get(e.rid)}:e);return this.local({t:`shapes`,id:this.id(),slide:this.path(n[0]),ops:e}).then(e=>e.model)}case`pptx.image`:{let e=`${this.id()}`,t=new Uint8Array(n[1].slice(0));return this.submit({t:`image`,id:e,key:e,slide:this.path(n[0]),bytes:t,ext:n[2]}).then(t=>{let n=t.rid;return n&&this.ridKey.set(n,e),n})}case`pptx.slides`:return this.submit({t:`slides`,id:this.id(),op:this.pslide(n[0])}).then(e=>e?.meta??this.meta);case`pptx.undo`:return this.history(n[0]?this.redoStack:this.undoStack,n[0]?this.undoStack:this.redoStack,n[0]?`next`:`prev`)}}pslide(e){switch(e.op){case`add`:return{op:`add`,after:e.after>=0&&this.path(e.after)||null,layout:e.layout};case`duplicate`:return{op:`duplicate`,path:this.path(e.index)};case`delete`:return{op:`delete`,path:this.path(e.index)};case`move`:return{op:`move`,path:this.path(e.from),to:e.to};case`hide`:return{op:`hide`,path:this.path(e.index),hidden:e.hidden}}}local(e){return this.undoStack.push(e.id),this.undoStack.length>200&&this.undoStack.shift(),this.redoStack=[],this.submit(e)}async history(e,t,n){let r=e.pop();if(!r)return null;t.push(r);let i=await this.submit({t:`revert`,id:this.id(),target:r,which:n});return i.model&&i.slide!==void 0?{index:i.slide,model:i.model}:null}transform(e,t){return Rm(e,t)}conflicts(e,t){return zm(e,t)}pessimistic(e){return e.t===`slides`}prepare(e){e.some(e=>e.t===`slides`)&&Nc(this.client,`pptx`)?.endEditing()}async apply(e,t){let{res:n,rec:r}=await this.client.direct(`collab.pptx.apply`,e);return e.t===`slides`&&(this.undoStack=[],this.redoStack=[],n.meta&&Object.assign(this.meta,n.meta)),t!==`local`&&this.client.notify(`collab:pptx`,n),{result:n,undo:r}}async revert(e){typeof e==`number`&&this.client.notify(`collab:pptx`,await this.client.direct(`collab.pptx.revert`,e))}};function Hm(e,t){let n=typeof t.transport==`string`?new Fm(t.transport):t.transport,r=e.kind===`docx`?new Dm(e):void 0,i=r??(e.kind===`xlsx`?new Lm(e):new Vm(e)),a=new km(n,i,{room:t.room,user:t.user,base:t.base});i.submit=e=>a.submit(e),i.push=(e,t)=>a.push(e,t),i.nextId=()=>a.nextId(),i.onPresence=e=>a.setPresence(e),e.interceptor=(e,t)=>{if(i.captures(e))return a.status===`connecting`||a.status===`syncing`||a.status===`error`?Promise.reject(Error(a.status===`error`?a.error??`Collaboration stopped`:`Document is still syncing`)):i.intercept(e,t)};let o=[a.on(`peers`,t=>Lc(e,t)),a.on(`status`,e=>{e===`live`&&i.setSite?.(a.site)})];return{session:a,get status(){return a.status},get peers(){return[...a.peers.values()]},get pending(){return a.pending},on:(e,t)=>a.on(e,t),rects:(e,t)=>{let n=t.presence;return r&&n?.k===`docx`?r.rects(e,n):null},close(){o.forEach(e=>e()),a.close(),e.interceptor&&(e.interceptor=void 0),i.dispose?.(),Lc(e,[])}}}var Um=new WeakMap,Wm=0;function Gm(e){if(!e)return``;let t;if(typeof e.transport==`string`)t=e.transport;else{let n=Um.get(e.transport);n===void 0&&Um.set(e.transport,n=++Wm),t=`#${n}`}return`${t}|${e.room}|${e.base??0}|${e.user.id??``}|${e.user.name}|${e.user.color??``}`}function Km(e,t){let[n,r]=(0,u.useState)({collab:null,status:null}),i=Gm(t),a=(0,u.useRef)(t);return a.current=t,(0,u.useEffect)(()=>{let t=a.current;if(!e||!t){r({collab:null,status:null});return}let n;try{n=Hm(e,t)}catch(e){r({collab:null,status:`error`,error:e.message});return}let i=()=>r({collab:n,status:n.status,error:n.session.error});i();let o=[n.on(`status`,i),n.on(`error`,i)];return()=>{o.forEach(e=>e()),n.close()}},[e,i]),n}var qm=e=>e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``)||`?`,Jm={connecting:`Connecting…`,syncing:`Syncing…`,live:`Live`,offline:`Offline · changes will sync`,error:`Not synced`};function Ym({client:e,state:t}){let n=(0,u.useSyncExternalStore)(t=>Bc(e,t),()=>zc(e)),[r,i]=(0,u.useState)(0);if((0,u.useEffect)(()=>{let e=t.collab?.session;if(!e)return;let n=setInterval(()=>i(e.pending),500);return()=>clearInterval(n)},[t.collab]),!t.status)return null;let a=t.status===`error`?t.error??`Collaboration stopped`:t.status===`live`&&r?`Saving ${r} change${r>1?`s`:``}…`:Jm[t.status];return(0,X.jsxs)(`span`,{className:`de-collab`,children:[(0,X.jsxs)(`span`,{className:`de-collab-status de-collab-${t.status}`,title:a,children:[(0,X.jsx)(`span`,{className:`de-collab-dot`}),(0,X.jsx)(`span`,{className:`de-collab-label`,children:t.status===`live`?n.length?`${n.length+1} editing`:`Live`:Jm[t.status]})]}),n.length>0&&(0,X.jsxs)(`span`,{className:`de-peers`,children:[n.slice(0,5).map(e=>(0,X.jsx)(`span`,{className:`de-peer`,style:{background:e.color},title:e.name,children:qm(e.name)},e.site)),n.length>5&&(0,X.jsxs)(`span`,{className:`de-peer de-peer-more`,title:n.slice(5).map(e=>e.name).join(`, `),children:[`+`,n.length-5]})]})]})}function Xm({client:e,collab:t}){let n=(0,u.useRef)(null),r=(0,u.useSyncExternalStore)(t=>Bc(e,t),()=>zc(e)),[i,a]=(0,u.useState)([]),o=(0,u.useMemo)(()=>r.filter(e=>e.presence&&e.presence.k!==`xlsx`),[r]);return(0,u.useEffect)(()=>{let r=n.current,i=r?.parentElement;if(!r||!i||!o.length){a([]);return}let s=0,c=()=>{s=0;let n=r.getBoundingClientRect(),c=e=>({x:e.left-n.left,y:e.top-n.top,w:e.width,h:e.height}),l=[];for(let r of o){let a=Zm(r,i,t,e);a&&l.push({key:String(r.site),color:r.color,name:r.name,caret:a.caret?{x:a.caret.left-n.left,y:a.caret.top-n.top,h:a.caret.height||16}:void 0,boxes:a.sel.map(c),outline:a.outline?c(a.outline):void 0})}a(l)},l=()=>{s||(s=requestAnimationFrame(c))};l(),i.addEventListener(`scroll`,l,!0),window.addEventListener(`resize`,l);let u=t?.on(`change`,l),d=setInterval(l,400);return()=>{cancelAnimationFrame(s),i.removeEventListener(`scroll`,l,!0),window.removeEventListener(`resize`,l),u?.(),clearInterval(d)}},[o,t,e]),(0,X.jsx)(`div`,{ref:n,className:`de-peer-layer`,"aria-hidden":!0,children:i.map(e=>(0,X.jsxs)(`div`,{style:{"--peer":e.color},children:[e.boxes.map((e,t)=>(0,X.jsx)(`div`,{className:`de-peer-sel`,style:{left:e.x,top:e.y,width:e.w,height:e.h}},t)),e.outline&&(0,X.jsx)(`div`,{className:`de-peer-outline`,style:{left:e.outline.x-3,top:e.outline.y-3,width:e.outline.w+6,height:e.outline.h+6},children:(0,X.jsx)(`span`,{className:`de-peer-flag`,children:e.name})}),e.caret&&(0,X.jsx)(`div`,{className:`de-peer-caret`,style:{left:e.caret.x,top:e.caret.y,height:e.caret.h},children:(0,X.jsx)(`span`,{className:`de-peer-flag`,children:e.name})})]},e.key))})}function Zm(e,t,n,r){let i=e.presence;if(i.k===`docx`){let r=n?.rects(t,e);return r?{caret:r.caret,sel:r.sel}:null}if(i.k===`pptx`&&i.slide){let e=r.info.pptx?.slides.findIndex(e=>e.path===i.slide)??-1,n=e>=0?t.querySelector(`[data-slide="${e+1}"]`):null;return n?{sel:[],outline:((i.top===void 0?null:n.querySelector(`[data-top="${i.top}"]`))??n).getBoundingClientRect()}:null}return null}var Qm={docx:`.docx`,xlsx:`.xlsx`,pptx:`.pptx`},$m={docx:`Untitled document`,xlsx:`Untitled spreadsheet`,pptx:`Untitled presentation`};function eh(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function th(e){let{src:t,name:n,className:r,style:i,toolbar:a=!0,toolbarExtra:o,zoom:s,thumbnails:c,headers:l,credentials:d,worker:f,styleTarget:p,onLoad:m,onError:h}=e,{allowEdit:g=!0,allowSave:_=!0,allowDownload:v=!0,fileMenu:y=!0,allowOpen:b=!0,onSave:x,onDirtyChange:S}=e,[C,w]=(0,u.useState)(!!e.editable);(0,u.useEffect)(()=>{e.editable!==void 0&&w(!!e.editable)},[e.editable]);let[T,E]=(0,u.useState)(!1),[D,ee]=(0,u.useState)(!1),[O,te]=(0,u.useState)(null);(0,u.useInsertionEffect)(()=>hf(p),[p]);let[ne,re]=(0,u.useState)(null),[ie,ae]=(0,u.useState)(null);(0,u.useEffect)(()=>{re(null),ae(null)},[t]);let oe=ne?ne.name:n,{client:k,error:se,loading:ce,progress:A}=Op(ne?ne.src:t,{name:oe,headers:l,credentials:d,worker:f}),le=ie??oe,ue=Km(k,e.collab),de=!e.collab||ue.status===`live`||ue.status===`offline`,[j,M]=(0,u.useState)(null);(0,u.useEffect)(()=>{k&&m?.(k)},[k,m]),(0,u.useEffect)(()=>{se&&h?.(se)},[se,h]);let N=(0,u.useRef)(!1);(0,u.useEffect)(()=>{E(!!k&&N.current),k&&(N.current=!1)},[k]);let fe=(0,u.useCallback)(e=>E(t=>(t!==e&&S?.(e),e)),[S]),pe=(ie??(k?.name||le||`document`)).replace(/\.[^.]+$/,``),me=pe+(k?Qm[k.kind]:``),he=_&&(!!x||v),ge=(0,u.useCallback)(async()=>{if(k&&!D&&he){ee(!0);try{let e=await k.call(`save`);x?await x(e,me):Cl(e,me),fe(!1)}catch(e){h?.(e),console.error(`[office-engine] save failed`,e)}finally{ee(!1)}}},[k,D,he,x,me,fe,h]),P=(0,u.useRef)(null),_e=(0,u.useMemo)(()=>({bar:O,editable:C&&de,setDirty:fe,save:ge,canDownload:v,client:k,fileOps:P}),[O,C,de,fe,ge,v,k]),[ve,ye]=(0,u.useState)(null),be=(0,u.useCallback)(()=>ye(null),[]),[xe,F]=(0,u.useState)(null),[I,Se]=(0,u.useState)(!1),[Ce,we]=(0,u.useState)(!1),Te=(e,t)=>T?F({message:e,run:t}):t(),Ee=(0,u.useCallback)((e,t=!1)=>{N.current=e.converted,ae(null),re(e),t&&w(!0)},[]),De=y&&b&&!e.collab,Oe=Nf({kind:k?.kind,base:pe,canOpen:De,canImport:y&&g&&de,canSave:y&&he,canDownload:y&&v&&!!k,ops:P,create:e=>Te(`A new ${$m[e].split(` `)[1]} replaces the current document. Your changes are not saved.`,()=>{(e===`docx`?Xd([]):e===`xlsx`?Bd([],`Sheet1`):rf()).then(t=>Ee({src:t,name:$m[e]+Qm[e],converted:!1},g),e=>ye(e.message))}),open:e=>Te(`Opening “${e.name}” replaces the current document. Your changes are not saved.`,()=>{ff(e).then(Ee,e=>ye(e.message))}),save:ge,downloadOriginal:async()=>{k&&(Cl(await k.call(`save`),me),x||fe(!1))},rename:()=>Se(!0),details:()=>we(!0),close:e.onClose,extra:e.fileMenuItems??[],notify:ye}),ke=e=>{if(!y||e.defaultPrevented||!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey)return;let t=e.key.toLowerCase();t===`p`?(e.preventDefault(),v&&Oe.run(`print`)):t===`o`&&De&&(e.preventDefault(),Oe.run(`open`))},L=A&&A.total>0?Math.min(100,A.loaded/A.total*100):0,R=ce||!!A&&L<100,z=ie??k?.name??le??(typeof t==`string`?decodeURIComponent(t.split(/[?#]/)[0].split(`/`).pop()??``):t?.name)??``,Ae;return Ae=se?(0,X.jsx)(`div`,{className:`de-center`,children:(0,X.jsxs)(`div`,{className:`de-error`,role:`alert`,children:[(0,X.jsx)(`strong`,{children:`Cannot open document.`}),(0,X.jsx)(`div`,{children:se.message})]})}):k?k.kind===`docx`?(0,X.jsx)(Cd,{client:k,initialZoom:s},String(k.name)+k.size):k.kind===`xlsx`?(0,X.jsx)(am,{client:k}):(0,X.jsx)(Dp,{client:k,initialZoom:s,thumbnails:c}):t||ne?(0,X.jsxs)(`div`,{className:`de-center`,children:[(0,X.jsx)(`div`,{className:`de-spinner`}),(0,X.jsx)(`div`,{children:A?.phase===`download`&&A.total?`Downloading… ${eh(A.loaded)} / ${eh(A.total)}`:`Opening…`})]}):(0,X.jsx)(`div`,{className:`de-center`,children:`No document`}),(0,X.jsxs)(`div`,{className:r?`de-root ${r}`:`de-root`,style:i,onKeyDown:ke,children:[a&&(0,X.jsxs)(`div`,{className:`de-bar`,children:[k&&(0,X.jsx)(`span`,{className:`de-badge de-badge-${k.kind}`,children:k.kind}),y&&(0,X.jsx)(Pf,{actions:Oe}),(0,X.jsx)(`span`,{className:`de-title`,title:z,children:z}),(0,X.jsx)(`span`,{className:`de-status`,ref:M,hidden:!k}),k&&k.size>0&&(0,X.jsx)(`span`,{className:`de-status`,children:eh(k.size)}),k&&e.collab&&(0,X.jsx)(Ym,{client:k,state:ue}),o,k&&g&&(0,X.jsxs)(`button`,{type:`button`,className:C?`de-mode de-mode-on`:`de-mode`,onClick:()=>w(e=>!e),title:C?`Switch to viewing`:`Edit document`,children:[(0,X.jsx)(Qc,{name:C?`view`:`edit`,size:16}),C?`View`:`Edit`]}),k&&he&&(C||T)&&(0,X.jsxs)(`button`,{type:`button`,className:T?`de-mode de-save-dirty`:`de-mode`,disabled:D,onClick:()=>void ge(),title:`Save a copy (Ctrl+S)`,children:[(0,X.jsx)(Qc,{name:`save`,size:16}),D?`Saving…`:T||x?`Save`:`Download`]}),(0,X.jsx)(`div`,{className:`de-progress`,style:{width:`${R?Math.max(L,3):100}%`,opacity:+!!R}})]}),a&&k&&C&&de&&(0,X.jsx)(`div`,{className:`de-ebar-host`,ref:te}),(0,X.jsxs)(`div`,{className:`de-body`,children:[(0,X.jsx)(Ol.Provider,{value:_e,children:(0,X.jsx)(Ml.Provider,{value:j,children:Ae})}),k&&ue.collab&&(0,X.jsx)(Xm,{client:k,collab:ue.collab})]}),ve&&(0,X.jsx)(zl,{text:ve,onDone:be}),xe&&(0,X.jsx)(Rl,{title:`Discard unsaved changes?`,message:xe.message,ok:`Continue`,onOk:xe.run,onClose:()=>F(null)}),I&&k&&(0,X.jsx)(Ll,{spec:{title:`Rename`,label:`File name`,initial:pe,ok:`Rename`,onOk:t=>{let n=t.trim().replace(/[\\/:*?"<>|]+/g,` `).replace(RegExp(`\\${Qm[k.kind]}$`,`i`),``);n&&(ae(n+Qm[k.kind]),e.onRename?.(n+Qm[k.kind]))}},onClose:()=>Se(!1)}),Ce&&k&&(0,X.jsx)(Dd,{client:k,file:[[`Name`,me],[`Type`,kf[k.kind]],...k.size>0?[[`File size`,eh(k.size)]]:[],...T?[[`Status`,`Unsaved changes`]]:[]],stats:P.current?.stats()??[],onClose:()=>we(!1)})]})}function nh(e,t){let n=(0,d.createRoot)(e),r=t,i=e.getRootNode()instanceof ShadowRoot?e.getRootNode():void 0,a=()=>n?.render((0,u.createElement)(th,{...r,styleTarget:i}));return a(),{update(e){r={...r,...e},a()},destroy(){n?.unmount(),n=null}}}var rh=class extends HTMLElement{constructor(...e){super(...e),A(this,`viewer`,void 0),A(this,`_file`,void 0)}get file(){return this._file}set file(e){this._file=e,this.sync()}connectedCallback(){if(this.viewer)return;let e=this.shadowRoot??this.attachShadow({mode:`open`}),t=document.createElement(`div`);t.style.cssText=`width:100%;height:100%`,e.innerHTML=`<style>:host{display:block;height:480px;position:relative}</style>`,e.appendChild(t),this.viewer=nh(t,this.props())}disconnectedCallback(){this.viewer?.destroy(),this.viewer=void 0,this.shadowRoot&&(this.shadowRoot.innerHTML=``)}attributeChangedCallback(){this.sync()}props(){return{src:this._file??this.getAttribute(`src`),name:this.getAttribute(`name`)??void 0,toolbar:this.getAttribute(`toolbar`)!==`false`,thumbnails:this.getAttribute(`thumbnails`)!==`false`,editable:this.hasAttribute(`editable`)&&this.getAttribute(`editable`)!==`false`,allowSave:this.getAttribute(`save`)!==`false`,allowDownload:this.getAttribute(`download`)!==`false`,fileMenu:this.getAttribute(`file-menu`)!==`false`,allowOpen:this.getAttribute(`open`)!==`false`,collab:this.getAttribute(`collab`)&&this.getAttribute(`room`)?{transport:this.getAttribute(`collab`),room:this.getAttribute(`room`),base:Number(this.getAttribute(`base`))||0,user:{name:this.getAttribute(`user`)||`Guest`}}:void 0,onLoad:e=>this.dispatchEvent(new CustomEvent(`load`,{detail:{kind:e.kind,name:e.name}})),onError:e=>this.dispatchEvent(new CustomEvent(`error`,{detail:e}))}}sync(){this.viewer?.update(this.props())}};A(rh,`observedAttributes`,[`src`,`name`,`toolbar`,`thumbnails`,`editable`,`save`,`download`,`file-menu`,`open`,`collab`,`room`,`user`,`base`]);function ih(e=`office-viewer`){typeof customElements<`u`&&!customElements.get(e)&&customElements.define(e,rh)}return ih(),e.DocViewer=th,e.OfficeViewerElement=rh,e.defineElement=ih,e.mount=nh,e})({});
|