From 89d1981e9db55f3eab371eac0811eb72733d849f Mon Sep 17 00:00:00 2001 From: Alpaq92 Date: Wed, 21 Oct 2026 16:22:23 +0200 Subject: [PATCH] Publish the dist-embed build so it can be served from jsDelivr Galena loads the viewer from cdn.jsdelivr.net/gh/Alpaq92/ReaderJS@/dist-embed/ instead of vendoring it, so the built bundle is committed and pinned by commit SHA. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 1 - dist-embed/assets/PptxViewJS.es-DznKWbU1.js | 12 + dist-embed/assets/UTIF-CE5fEjqo.js | 1 + dist-embed/assets/base-renderer-DM6Nw1yD.js | 1 + dist-embed/assets/canvas-driver-BnEksqHW.js | 1 + dist-embed/assets/chm-reader-Bjyc0KjP.js | 1 + dist-embed/assets/chm-renderer-C7xAtyOx.js | 1 + .../assets/classPrivateFieldSet2-CUhwy2NK.js | 1 + dist-embed/assets/code-renderer-CXvWkmtj.js | 2 + dist-embed/assets/comic-book-Bc_1EzdL.js | 1 + dist-embed/assets/comic-renderer-glidoIQE.js | 1 + dist-embed/assets/common-D7sP-4Y_.js | 5 + dist-embed/assets/csv-renderer-BilbplpS.js | 2 + dist-embed/assets/defineProperty-BbfpZ9Tg.js | 1 + dist-embed/assets/diff-view-D2QtiOFi.js | 7 + dist-embed/assets/djvu-renderer-DqS9P2fI.js | 2 + dist-embed/assets/doc-renderer-BiIZu55h.js | 2 + dist-embed/assets/document-BvO1jqhz.js | 7 + dist-embed/assets/docx-renderer-DbfurWuz.js | 2 + dist-embed/assets/driver-0cTj10HJ.js | 1 + dist-embed/assets/epub-BRc42rrU.js | 2 + dist-embed/assets/epub-renderer-Bme3iMY3.js | 10 + dist-embed/assets/epubcfi-CnTj7mGe.js | 1 + dist-embed/assets/fb2-DgH9Jg0u.js | 53 + dist-embed/assets/fflate-CIG33RrD.js | 1 + dist-embed/assets/fixed-layout-BfuYLi-X.js | 8 + .../assets/foliate-pdf-stub-D0ViEO2I.js | 1 + dist-embed/assets/full.esm-BRjqxzY6.js | 2 + dist-embed/assets/github-DdKuH37F.css | 1 + dist-embed/assets/image-renderer-C77Qgqch.js | 2 + dist-embed/assets/jszip.min-C__FR9jF.js | 2 + dist-embed/assets/lib-CTiWugWo.js | 14 + dist-embed/assets/lib-sUWhpJan.js | 220 +++ dist-embed/assets/libarchive-Dhbbd3NZ.js | 1 + dist-embed/assets/marked.esm-N0v7i-_3.js | 64 + dist-embed/assets/md-renderer-tgJ5KDQ7.js | 2 + dist-embed/assets/mhtml-renderer-BSbibdXo.js | 1 + dist-embed/assets/mobi-Ub-LpPzr.js | 6 + dist-embed/assets/odf-renderer-Ij9kGdvb.js | 1 + dist-embed/assets/paginator-CX7swKUE.js | 97 ++ dist-embed/assets/papaparse.min-D30bkSB7.js | 10 + dist-embed/assets/pdf-renderer-iP_6_5Hj.js | 55 + dist-embed/assets/pdf.worker.min-DEtVeC4l.mjs | 29 + .../assets/postscript-renderer-DiBp0fnh.js | 2 + dist-embed/assets/pptx-renderer-CmpjxzD-.js | 2 + dist-embed/assets/reader-Bd1ccloG.js | 8 + dist-embed/assets/reader-BsenByj_.css | 1 + dist-embed/assets/render-D6jv0HaF.js | 34 + .../assets/rolldown-runtime-DAXXjFlN.js | 1 + dist-embed/assets/rtf-renderer-BL_n3PS3.js | 1 + dist-embed/assets/search-CJ5IhiMB.js | 1 + dist-embed/assets/tts-C1bDd3kL.js | 1 + dist-embed/assets/txt-renderer-CK6R3ofv.js | 1 + dist-embed/assets/worker-OhPDRroP.js | 1 + dist-embed/assets/worker-bundle-Dx5mKZOL.js | 6 + dist-embed/assets/xlsx-renderer-CcmbFi9z.js | 1 + dist-embed/assets/xlsx-vk3JpTXp.js | 141 ++ dist-embed/assets/zip-CvNGKDey.js | 1 + dist-embed/jsdoc/docToText.js | 1258 +++++++++++++++++ dist-embed/libarchive/libarchive.wasm | Bin 0 -> 1002547 bytes dist-embed/libarchive/worker-bundle.js | 6 + dist-embed/reader.html | 152 ++ dist-embed/readerjs.js | 1 + dist-embed/rtfjs/EMFJS.bundle.min.js | 2 + dist-embed/rtfjs/RTFJS.bundle.min.js | 3 + dist-embed/rtfjs/WMFJS.bundle.min.js | 2 + dist-embed/rtfjs/jquery.min.js | 2 + 67 files changed, 2262 insertions(+), 1 deletion(-) create mode 100644 dist-embed/assets/PptxViewJS.es-DznKWbU1.js create mode 100644 dist-embed/assets/UTIF-CE5fEjqo.js create mode 100644 dist-embed/assets/base-renderer-DM6Nw1yD.js create mode 100644 dist-embed/assets/canvas-driver-BnEksqHW.js create mode 100644 dist-embed/assets/chm-reader-Bjyc0KjP.js create mode 100644 dist-embed/assets/chm-renderer-C7xAtyOx.js create mode 100644 dist-embed/assets/classPrivateFieldSet2-CUhwy2NK.js create mode 100644 dist-embed/assets/code-renderer-CXvWkmtj.js create mode 100644 dist-embed/assets/comic-book-Bc_1EzdL.js create mode 100644 dist-embed/assets/comic-renderer-glidoIQE.js create mode 100644 dist-embed/assets/common-D7sP-4Y_.js create mode 100644 dist-embed/assets/csv-renderer-BilbplpS.js create mode 100644 dist-embed/assets/defineProperty-BbfpZ9Tg.js create mode 100644 dist-embed/assets/diff-view-D2QtiOFi.js create mode 100644 dist-embed/assets/djvu-renderer-DqS9P2fI.js create mode 100644 dist-embed/assets/doc-renderer-BiIZu55h.js create mode 100644 dist-embed/assets/document-BvO1jqhz.js create mode 100644 dist-embed/assets/docx-renderer-DbfurWuz.js create mode 100644 dist-embed/assets/driver-0cTj10HJ.js create mode 100644 dist-embed/assets/epub-BRc42rrU.js create mode 100644 dist-embed/assets/epub-renderer-Bme3iMY3.js create mode 100644 dist-embed/assets/epubcfi-CnTj7mGe.js create mode 100644 dist-embed/assets/fb2-DgH9Jg0u.js create mode 100644 dist-embed/assets/fflate-CIG33RrD.js create mode 100644 dist-embed/assets/fixed-layout-BfuYLi-X.js create mode 100644 dist-embed/assets/foliate-pdf-stub-D0ViEO2I.js create mode 100644 dist-embed/assets/full.esm-BRjqxzY6.js create mode 100644 dist-embed/assets/github-DdKuH37F.css create mode 100644 dist-embed/assets/image-renderer-C77Qgqch.js create mode 100644 dist-embed/assets/jszip.min-C__FR9jF.js create mode 100644 dist-embed/assets/lib-CTiWugWo.js create mode 100644 dist-embed/assets/lib-sUWhpJan.js create mode 100644 dist-embed/assets/libarchive-Dhbbd3NZ.js create mode 100644 dist-embed/assets/marked.esm-N0v7i-_3.js create mode 100644 dist-embed/assets/md-renderer-tgJ5KDQ7.js create mode 100644 dist-embed/assets/mhtml-renderer-BSbibdXo.js create mode 100644 dist-embed/assets/mobi-Ub-LpPzr.js create mode 100644 dist-embed/assets/odf-renderer-Ij9kGdvb.js create mode 100644 dist-embed/assets/paginator-CX7swKUE.js create mode 100644 dist-embed/assets/papaparse.min-D30bkSB7.js create mode 100644 dist-embed/assets/pdf-renderer-iP_6_5Hj.js create mode 100644 dist-embed/assets/pdf.worker.min-DEtVeC4l.mjs create mode 100644 dist-embed/assets/postscript-renderer-DiBp0fnh.js create mode 100644 dist-embed/assets/pptx-renderer-CmpjxzD-.js create mode 100644 dist-embed/assets/reader-Bd1ccloG.js create mode 100644 dist-embed/assets/reader-BsenByj_.css create mode 100644 dist-embed/assets/render-D6jv0HaF.js create mode 100644 dist-embed/assets/rolldown-runtime-DAXXjFlN.js create mode 100644 dist-embed/assets/rtf-renderer-BL_n3PS3.js create mode 100644 dist-embed/assets/search-CJ5IhiMB.js create mode 100644 dist-embed/assets/tts-C1bDd3kL.js create mode 100644 dist-embed/assets/txt-renderer-CK6R3ofv.js create mode 100644 dist-embed/assets/worker-OhPDRroP.js create mode 100644 dist-embed/assets/worker-bundle-Dx5mKZOL.js create mode 100644 dist-embed/assets/xlsx-renderer-CcmbFi9z.js create mode 100644 dist-embed/assets/xlsx-vk3JpTXp.js create mode 100644 dist-embed/assets/zip-CvNGKDey.js create mode 100644 dist-embed/jsdoc/docToText.js create mode 100644 dist-embed/libarchive/libarchive.wasm create mode 100644 dist-embed/libarchive/worker-bundle.js create mode 100644 dist-embed/reader.html create mode 100644 dist-embed/readerjs.js create mode 100644 dist-embed/rtfjs/EMFJS.bundle.min.js create mode 100644 dist-embed/rtfjs/RTFJS.bundle.min.js create mode 100644 dist-embed/rtfjs/WMFJS.bundle.min.js create mode 100644 dist-embed/rtfjs/jquery.min.js diff --git a/.gitignore b/.gitignore index 517c4d0..23bde5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ node_modules/ dist/ -dist-embed/ .env .env.* *.local diff --git a/dist-embed/assets/PptxViewJS.es-DznKWbU1.js b/dist-embed/assets/PptxViewJS.es-DznKWbU1.js new file mode 100644 index 0000000..7213278 --- /dev/null +++ b/dist-embed/assets/PptxViewJS.es-DznKWbU1.js @@ -0,0 +1,12 @@ +import{o as e,t}from"./rolldown-runtime-DAXXjFlN.js";import{t as n}from"./defineProperty-BbfpZ9Tg.js";import{t as r}from"./jszip.min-C__FR9jF.js";function i(e){return e+.5|0}var a=(e,t,n)=>Math.max(Math.min(e,n),t);function o(e){return a(i(e*2.55),0,255)}function s(e){return a(i(e*255),0,255)}function c(e){return a(i(e/2.55)/100,0,1)}function l(e){return a(i(e*100),0,100)}var u={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},d=[...`0123456789ABCDEF`],f=e=>d[e&15],p=e=>d[(e&240)>>4]+d[e&15],m=e=>(e&240)>>4==(e&15),h=e=>m(e.r)&&m(e.g)&&m(e.b)&&m(e.a);function g(e){var t=e.length,n;return e[0]===`#`&&(t===4||t===5?n={r:255&u[e[1]]*17,g:255&u[e[2]]*17,b:255&u[e[3]]*17,a:t===5?u[e[4]]*17:255}:(t===7||t===9)&&(n={r:u[e[1]]<<4|u[e[2]],g:u[e[3]]<<4|u[e[4]],b:u[e[5]]<<4|u[e[6]],a:t===9?u[e[7]]<<4|u[e[8]]:255})),n}var _=(e,t)=>e<255?t(e):``;function v(e){var t=h(e)?f:p;return e?`#`+t(e.r)+t(e.g)+t(e.b)+_(e.a,t):void 0}var y=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function b(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function x(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function S(e,t,n){let r=b(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function C(e,t,n,r,i){return e===i?(t-n)/r+(t.5?l/(2-i-a):l/(i+a),s=C(t,n,r,l,i),s=s*60+.5),[s|0,c||0,o]}function T(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(s)}function E(e,t,n){return T(b,e,t,n)}function D(e,t,n){return T(S,e,t,n)}function O(e,t,n){return T(x,e,t,n)}function k(e){return(e%360+360)%360}function A(e){let t=y.exec(e),n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?o(+t[5]):s(+t[5]));let i=k(+t[2]),a=t[3]/100,c=t[4]/100;return r=t[1]===`hwb`?D(i,a,c):t[1]===`hsv`?O(i,a,c):E(i,a,c),{r:r[0],g:r[1],b:r[2],a:n}}function j(e,t){var n=w(e);n[0]=k(n[0]+t),n=E(n),e.r=n[0],e.g=n[1],e.b=n[2]}function ee(e){if(!e)return;let t=w(e),n=t[0],r=l(t[1]),i=l(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${c(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}var te={x:`dark`,Z:`light`,Y:`re`,X:`blu`,W:`gr`,V:`medium`,U:`slate`,A:`ee`,T:`ol`,S:`or`,B:`ra`,C:`lateg`,D:`ights`,R:`in`,Q:`turquois`,E:`hi`,P:`ro`,O:`al`,N:`le`,M:`de`,L:`yello`,F:`en`,K:`ch`,G:`arks`,H:`ea`,I:`ightg`,J:`wh`},ne={OiceXe:`f0f8ff`,antiquewEte:`faebd7`,aqua:`ffff`,aquamarRe:`7fffd4`,azuY:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`0`,blanKedOmond:`ffebcd`,Xe:`ff`,XeviTet:`8a2be2`,bPwn:`a52a2a`,burlywood:`deb887`,caMtXe:`5f9ea0`,KartYuse:`7fff00`,KocTate:`d2691e`,cSO:`ff7f50`,cSnflowerXe:`6495ed`,cSnsilk:`fff8dc`,crimson:`dc143c`,cyan:`ffff`,xXe:`8b`,xcyan:`8b8b`,xgTMnPd:`b8860b`,xWay:`a9a9a9`,xgYF:`6400`,xgYy:`a9a9a9`,xkhaki:`bdb76b`,xmagFta:`8b008b`,xTivegYF:`556b2f`,xSange:`ff8c00`,xScEd:`9932cc`,xYd:`8b0000`,xsOmon:`e9967a`,xsHgYF:`8fbc8f`,xUXe:`483d8b`,xUWay:`2f4f4f`,xUgYy:`2f4f4f`,xQe:`ced1`,xviTet:`9400d3`,dAppRk:`ff1493`,dApskyXe:`bfff`,dimWay:`696969`,dimgYy:`696969`,dodgerXe:`1e90ff`,fiYbrick:`b22222`,flSOwEte:`fffaf0`,foYstWAn:`228b22`,fuKsia:`ff00ff`,gaRsbSo:`dcdcdc`,ghostwEte:`f8f8ff`,gTd:`ffd700`,gTMnPd:`daa520`,Way:`808080`,gYF:`8000`,gYFLw:`adff2f`,gYy:`808080`,honeyMw:`f0fff0`,hotpRk:`ff69b4`,RdianYd:`cd5c5c`,Rdigo:`4b0082`,ivSy:`fffff0`,khaki:`f0e68c`,lavFMr:`e6e6fa`,lavFMrXsh:`fff0f5`,lawngYF:`7cfc00`,NmoncEffon:`fffacd`,ZXe:`add8e6`,ZcSO:`f08080`,Zcyan:`e0ffff`,ZgTMnPdLw:`fafad2`,ZWay:`d3d3d3`,ZgYF:`90ee90`,ZgYy:`d3d3d3`,ZpRk:`ffb6c1`,ZsOmon:`ffa07a`,ZsHgYF:`20b2aa`,ZskyXe:`87cefa`,ZUWay:`778899`,ZUgYy:`778899`,ZstAlXe:`b0c4de`,ZLw:`ffffe0`,lime:`ff00`,limegYF:`32cd32`,lRF:`faf0e6`,magFta:`ff00ff`,maPon:`800000`,VaquamarRe:`66cdaa`,VXe:`cd`,VScEd:`ba55d3`,VpurpN:`9370db`,VsHgYF:`3cb371`,VUXe:`7b68ee`,VsprRggYF:`fa9a`,VQe:`48d1cc`,VviTetYd:`c71585`,midnightXe:`191970`,mRtcYam:`f5fffa`,mistyPse:`ffe4e1`,moccasR:`ffe4b5`,navajowEte:`ffdead`,navy:`80`,Tdlace:`fdf5e6`,Tive:`808000`,TivedBb:`6b8e23`,Sange:`ffa500`,SangeYd:`ff4500`,ScEd:`da70d6`,pOegTMnPd:`eee8aa`,pOegYF:`98fb98`,pOeQe:`afeeee`,pOeviTetYd:`db7093`,papayawEp:`ffefd5`,pHKpuff:`ffdab9`,peru:`cd853f`,pRk:`ffc0cb`,plum:`dda0dd`,powMrXe:`b0e0e6`,purpN:`800080`,YbeccapurpN:`663399`,Yd:`ff0000`,Psybrown:`bc8f8f`,PyOXe:`4169e1`,saddNbPwn:`8b4513`,sOmon:`fa8072`,sandybPwn:`f4a460`,sHgYF:`2e8b57`,sHshell:`fff5ee`,siFna:`a0522d`,silver:`c0c0c0`,skyXe:`87ceeb`,UXe:`6a5acd`,UWay:`708090`,UgYy:`708090`,snow:`fffafa`,sprRggYF:`ff7f`,stAlXe:`4682b4`,tan:`d2b48c`,teO:`8080`,tEstN:`d8bfd8`,tomato:`ff6347`,Qe:`40e0d0`,viTet:`ee82ee`,JHt:`f5deb3`,wEte:`ffffff`,wEtesmoke:`f5f5f5`,Lw:`ffff00`,LwgYF:`9acd32`};function re(){let e={},t=Object.keys(ne),n=Object.keys(te),r,i,a,o,s;for(r=0;r>16&255,a>>8&255,a&255]}return e}var M;function ie(e){M||(M=re(),M.transparent=[0,0,0,0]);let t=M[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var ae=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function oe(e){let t=ae.exec(e),n=255,r,i,s;if(t){if(t[7]!==r){let e=+t[7];n=t[8]?o(e):a(e*255,0,255)}return r=+t[1],i=+t[3],s=+t[5],r=255&(t[2]?o(r):a(r,0,255)),i=255&(t[4]?o(i):a(i,0,255)),s=255&(t[6]?o(s):a(s,0,255)),{r,g:i,b:s,a:n}}}function se(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${c(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var ce=e=>e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055,le=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;function ue(e,t,n){let r=le(c(e.r)),i=le(c(e.g)),a=le(c(e.b));return{r:s(ce(r+n*(le(c(t.r))-r))),g:s(ce(i+n*(le(c(t.g))-i))),b:s(ce(a+n*(le(c(t.b))-a))),a:e.a+n*(t.a-e.a)}}function de(e,t,n){if(e){let r=w(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=E(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function fe(e,t){return e&&Object.assign(t||{},e)}function pe(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=s(e[3]))):(t=fe(e,{r:0,g:0,b:0,a:1}),t.a=s(t.a)),t}function me(e){return e.charAt(0)===`r`?oe(e):A(e)}var he=class e{constructor(t){if(t instanceof e)return t;let n=typeof t,r;n===`object`?r=pe(t):n===`string`&&(r=g(t)||ie(t)||me(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=fe(this._rgb);return e&&(e.a=c(e.a)),e}set rgb(e){this._rgb=pe(e)}rgbString(){return this._valid?se(this._rgb):void 0}hexString(){return this._valid?v(this._rgb):void 0}hslString(){return this._valid?ee(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,i,a=t===i?.5:t,o=2*a-1,s=n.a-r.a,c=((o*s===-1?o:(o+s)/(1+o*s))+1)/2;i=1-c,n.r=255&c*n.r+i*r.r+.5,n.g=255&c*n.g+i*r.g+.5,n.b=255&c*n.b+i*r.b+.5,n.a=a*n.a+(1-a)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=ue(this._rgb,e._rgb,t)),this}clone(){return new e(this.rgb)}alpha(e){return this._rgb.a=s(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb;return e.r=e.g=e.b=i(e.r*.3+e.g*.59+e.b*.11),this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return de(this._rgb,2,e),this}darken(e){return de(this._rgb,2,-e),this}saturate(e){return de(this._rgb,1,e),this}desaturate(e){return de(this._rgb,1,-e),this}rotate(e){return j(this._rgb,e),this}};function ge(){}var _e=(()=>{let e=0;return()=>e++})();function N(e){return e==null}function P(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)===`[object`&&t.slice(-6)===`Array]`}function F(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function I(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function L(e,t){return I(e)?e:t}function R(e,t){return e===void 0?t:e}var ve=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100:+e/t,ye=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*t:+e;function z(e,t,n){if(e&&typeof e.call==`function`)return e.apply(n,t)}function B(e,t,n,r){let i,a,o;if(P(e))if(a=e.length,r)for(i=a-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;ie,x:e=>e.x,y:e=>e.y};function Oe(e){let t=e.split(`.`),n=[],r=``;for(let e of t)r+=e,r.endsWith(`\\`)?r=r.slice(0,-1)+`.`:(n.push(r),r=``);return n}function ke(e){let t=Oe(e);return e=>{for(let n of t){if(n===``)break;e=e&&e[n]}return e}}function Ae(e,t){return(De[t]||(De[t]=ke(t)))(e)}function je(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Me=e=>e!==void 0,Ne=e=>typeof e==`function`,Pe=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function Fe(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var V=Math.PI,H=2*V,Ie=H+V,Le=1/0,Re=V/180,U=V/2,ze=V/4,Be=V*2/3,Ve=Math.log10,He=Math.sign;function Ue(e,t,n){return Math.abs(e-t)e-t).pop(),t}function Ke(e){return typeof e==`symbol`||typeof e==`object`&&!!e&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function qe(e){return!Ke(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function Je(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function Ye(e,t,n){let r,i,a;for(r=0,i=e.length;rc&&l=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function at(e,t,n){n=n||(n=>e[n]1;)a=i+r>>1,n(a)?i=a:r=a;return{lo:i,hi:r}}var K=(e,t,n,r)=>at(e,n,r?r=>{let i=e[r][t];return ie[r][t]at(e,n,r=>e[r][t]>=n);function st(e,t,n){let r=0,i=e.length;for(;rr&&e[i-1]>n;)i--;return r>0||i{let n=`_onData`+je(t),r=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let i=r.apply(this,t);return e._chartjs.listeners.forEach(e=>{typeof e[n]==`function`&&e[n](...t)}),i}})})}function ut(e,t){let n=e._chartjs;if(!n)return;let r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(ct.forEach(t=>{delete e[t]}),delete e._chartjs)}function dt(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var ft=function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame}();function pt(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,ft.call(window,()=>{r=!1,e.apply(t,n)}))}}function mt(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}var ht=e=>e===`start`?`left`:e===`end`?`right`:`center`,q=(e,t,n)=>e===`start`?t:e===`end`?n:(t+n)/2,gt=(e,t,n,r)=>e===(r?`left`:`right`)?n:e===`center`?(t+n)/2:t;function _t(e,t,n){let r=t.length,i=0,a=r;if(e._sorted){let{iScale:o,vScale:s,_parsed:c}=e,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=o.axis,{min:d,max:f,minDefined:p,maxDefined:m}=o.getUserBounds();if(p){if(i=Math.min(K(c,u,d).lo,n?r:K(t,u,o.getPixelForValue(d)).lo),l){let e=c.slice(0,i+1).reverse().findIndex(e=>!N(e[s.axis]));i-=Math.max(0,e)}i=G(i,0,r-1)}if(m){let e=Math.max(K(c,o.axis,f,!0).hi+1,n?0:K(t,u,o.getPixelForValue(f),!0).hi+1);if(l){let t=c.slice(e-1).findIndex(e=>!N(e[s.axis]));e+=Math.max(0,t)}a=G(e,i,r)-i}else a=r-i}return{start:i,count:a}}function vt(e){let{xScale:t,yScale:n,_scaleRanges:r}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=i,!0;let a=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,i),a}var yt=e=>e===0||e===1,bt=(e,t,n)=>-(2**(10*--e)*Math.sin((e-t)*H/n)),xt=(e,t,n)=>2**(-10*e)*Math.sin((e-t)*H/n)+1,St={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-(--e*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>--e*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*U)+1,easeOutSine:e=>Math.sin(e*U),easeInOutSine:e=>-.5*(Math.cos(V*e)-1),easeInExpo:e=>e===0?0:2**(10*(e-1)),easeOutExpo:e=>e===1?1:-(2**(-10*e))+1,easeInOutExpo:e=>yt(e)?e:e<.5?.5*2**(10*(e*2-1)):.5*(-(2**(-10*(e*2-1)))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1- --e*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>yt(e)?e:bt(e,.075,.3),easeOutElastic:e=>yt(e)?e:xt(e,.075,.3),easeInOutElastic(e){let t=.1125,n=.45;return yt(e)?e:e<.5?.5*bt(e*2,t,n):.5+.5*xt(e*2-1,t,n)},easeInBack(e){return e*e*(2.70158*e-1.70158)},easeOutBack(e){return--e*e*(2.70158*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-St.easeOutBounce(1-e),easeOutBounce(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?St.easeInBounce(e*2)*.5:St.easeOutBounce(e*2-1)*.5+.5};function Ct(e){if(e&&typeof e==`object`){let t=e.toString();return t===`[object CanvasPattern]`||t===`[object CanvasGradient]`}return!1}function wt(e){return Ct(e)?e:new he(e)}function Tt(e){return Ct(e)?e:new he(e).saturate(.5).darken(.1).hexString()}var Et=[`x`,`y`,`borderWidth`,`radius`,`tension`],Dt=[`color`,`borderColor`,`backgroundColor`];function Ot(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:e=>e!==`onProgress`&&e!==`onComplete`&&e!==`fn`}),e.set(`animations`,{colors:{type:`color`,properties:Dt},numbers:{type:`number`,properties:Et}}),e.describe(`animations`,{_fallback:`animation`}),e.set(`transitions`,{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:`transparent`},visible:{type:`boolean`,duration:0}}},hide:{animations:{colors:{to:`transparent`},visible:{type:`boolean`,easing:`linear`,fn:e=>e|0}}}})}function kt(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var At=new Map;function jt(e,t){t=t||{};let n=e+JSON.stringify(t),r=At.get(n);return r||(r=new Intl.NumberFormat(e,t),At.set(n,r)),r}function Mt(e,t,n){return jt(t,n).format(e)}var Nt={values(e){return P(e)?e:``+e},numeric(e,t,n){if(e===0)return`0`;let r=this.chart.options.locale,i,a=e;if(n.length>1){let t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>0x38d7ea4c68000)&&(i=`scientific`),a=Pt(e,n)}let o=Ve(Math.abs(a)),s=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:i,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(c,this.options.ticks.format),Mt(e,r,c)},logarithmic(e,t,n){if(e===0)return`0`;let r=n[t].significand||e/10**Math.floor(Ve(e));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Nt.numeric.call(this,e,t,n):``}};function Pt(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Ft={formatters:Nt};function It(e){e.set(`scale`,{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:`ticks`,clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:``,padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:``,padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ft.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:e=>!e.startsWith(`before`)&&!e.startsWith(`after`)&&e!==`callback`&&e!==`parser`,_indexable:e=>e!==`borderDash`&&e!==`tickBorderDash`&&e!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:e=>e!==`backdropPadding`&&e!==`callback`,_indexable:e=>e!==`backdropPadding`})}var Lt=Object.create(null),Rt=Object.create(null);function zt(e,t){if(!t)return e;let n=t.split(`.`);for(let t=0,r=n.length;te.chart.platform.getDevicePixelRatio(),this.elements={},this.events=[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`],this.font={family:`'Helvetica Neue', 'Helvetica', 'Arial', sans-serif`,size:12,style:`normal`,lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,t)=>Tt(t.backgroundColor),this.hoverBorderColor=(e,t)=>Tt(t.borderColor),this.hoverColor=(e,t)=>Tt(t.color),this.indexAxis=`x`,this.interaction={mode:`nearest`,intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return Bt(this,e,t)}get(e){return zt(this,e)}describe(e,t){return Bt(Rt,e,t)}override(e,t){return Bt(Lt,e,t)}route(e,t,n,r){let i=zt(this,e),a=zt(this,n),o=`_`+t;Object.defineProperties(i,{[o]:{value:i[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[o],t=a[r];return F(e)?Object.assign({},t,e):R(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[Ot,kt,It]);function Vt(e){return!e||N(e.size)||N(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function Ht(e,t,n,r,i){let a=t[i];return a||(a=t[i]=e.measureText(i).width,n.push(i)),a>r&&(r=a),r}function Ut(e,t,n,r){r=r||{};let i=r.data=r.data||{},a=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},a=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let o=0,s=n.length,c,l,u,d,f;for(c=0;cn.length){for(c=0;c0&&e.stroke()}}function Jt(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&a.strokeColor!==``,c,l;for(e.save(),e.font=i.string,$t(e,a),c=0;c+e||0;function ln(e,t){let n={},r=F(t),i=r?Object.keys(t):t,a=F(e)?r?n=>R(e[n],e[t[n]]):t=>e[t]:()=>e;for(let e of i)n[e]=cn(a(e));return n}function un(e){return ln(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function dn(e){return ln(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function Y(e){let t=un(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function X(e,t){e=e||{},t=t||J.font;let n=R(e.size,t.size);typeof n==`string`&&(n=parseInt(n,10));let r=R(e.style,t.style);r&&!(``+r).match(on)&&(console.warn(`Invalid font style specified: "`+r+`"`),r=void 0);let i={family:R(e.family,t.family),lineHeight:sn(R(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:R(e.weight,t.weight),string:``};return i.string=Vt(i),i}function fn(e,t,n,r){let i=!0,a,o,s;for(a=0,o=e.length;an&&e===0?0:e+t;return{min:o(r,-Math.abs(a)),max:o(i,a)}}function mn(e,t){return Object.assign(Object.create(e),t)}function hn(e,t=[``],n,r,i=()=>e[0]){let a=n||e;return r===void 0&&(r=An(`_fallback`,e)),new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:i,override:n=>hn([n,...e],t,a,r)},{deleteProperty(t,n){return delete t[n],delete t._keys,delete e[0][n],!0},get(n,r){return yn(n,r,()=>kn(r,t,e,n))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return jn(e).includes(t)},ownKeys(e){return jn(e)},set(e,t,n){let r=e._storage||(e._storage=i());return e[t]=r[t]=n,delete e._keys,!0}})}function Z(e,t,n,r){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:gn(e,r),setContext:t=>Z(e,t,n,r),override:i=>Z(e.override(i),t,n,r)};return new Proxy(i,{deleteProperty(t,n){return delete t[n],delete e[n],!0},get(e,t,n){return yn(e,t,()=>bn(e,t,n))},getOwnPropertyDescriptor(t,n){return t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(t,n,r){return e[n]=r,delete t[n],!0}})}function gn(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:Ne(n)?n:()=>n,isIndexable:Ne(r)?r:()=>r}}var _n=(e,t)=>e?e+je(t):t,vn=(e,t)=>F(t)&&e!==`adapters`&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function yn(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t===`constructor`)return e[t];let r=n();return e[t]=r,r}function bn(e,t,n){let{_proxy:r,_context:i,_subProxy:a,_descriptors:o}=e,s=r[t];return Ne(s)&&o.isScriptable(t)&&(s=xn(t,s,e,n)),P(s)&&s.length&&(s=Sn(t,s,e,o.isIndexable)),vn(t,s)&&(s=Z(s,i,a&&a[t],o)),s}function xn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_stack:s}=n;if(s.has(e))throw Error(`Recursion detected: `+Array.from(s).join(`->`)+`->`+e);s.add(e);let c=t(a,o||r);return s.delete(e),vn(e,c)&&(c=En(i._scopes,i,e,c)),c}function Sn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_descriptors:s}=n;if(a.index!==void 0&&r(e))return t[a.index%t.length];if(F(t[0])){let n=t,r=i._scopes.filter(e=>e!==n);t=[];for(let c of n){let n=En(r,i,e,c);t.push(Z(n,a,o&&o[e],s))}}return t}function Cn(e,t,n){return Ne(e)?e(t,n):e}var wn=(e,t)=>e===!0?t:typeof e==`string`?Ae(t,e):void 0;function Tn(e,t,n,r,i){for(let a of t){let t=wn(n,a);if(t){e.add(t);let a=Cn(t._fallback,n,i);if(a!==void 0&&a!==n&&a!==r)return a}else if(t===!1&&r!==void 0&&n!==r)return null}return!1}function En(e,t,n,r){let i=t._rootScopes,a=Cn(t._fallback,n,r),o=[...e,...i],s=new Set;s.add(r);let c=Dn(s,o,n,a||n,r);return c===null||a!==void 0&&a!==n&&(c=Dn(s,o,a,c,r),c===null)?!1:hn(Array.from(s),[``],i,a,()=>On(t,n,r))}function Dn(e,t,n,r,i){for(;n;)n=Tn(e,t,n,r,i);return n}function On(e,t,n){let r=e._getTarget();t in r||(r[t]={});let i=r[t];return P(i)&&F(n)?n:i||{}}function kn(e,t,n,r){let i;for(let a of t)if(i=An(_n(a,e),n),i!==void 0)return vn(e,i)?En(n,r,e,i):i}function An(e,t){for(let n of t){if(!n)continue;let t=n[e];if(t!==void 0)return t}}function jn(e){let t=e._keys;return t||(t=e._keys=Mn(e._scopes)),t}function Mn(e){let t=new Set;for(let n of e)for(let e of Object.keys(n).filter(e=>!e.startsWith(`_`)))t.add(e);return Array.from(t)}function Nn(e,t,n,r){let{iScale:i}=e,{key:a=`r`}=this._parsing,o=Array(r),s,c,l,u;for(s=0,c=r;ste===`x`?`y`:`x`;function Ln(e,t,n,r){let i=e.skip?t:e,a=t,o=n.skip?t:n,s=et(a,i),c=et(o,a),l=s/(s+c),u=c/(s+c);l=isNaN(l)?0:l,u=isNaN(u)?0:u;let d=r*l,f=r*u;return{previous:{x:a.x-d*(o.x-i.x),y:a.y-d*(o.y-i.y)},next:{x:a.x+f*(o.x-i.x),y:a.y+f*(o.y-i.y)}}}function Rn(e,t,n){let r=e.length,i,a,o,s,c,l=Fn(e,0);for(let u=0;u!e.skip)),t.cubicInterpolationMode===`monotone`)Bn(e,i);else{let n=r?e[e.length-1]:e[0];for(a=0,o=e.length;ae.ownerDocument.defaultView.getComputedStyle(e,null);function Jn(e,t){return qn(e).getPropertyValue(t)}var Yn=[`top`,`right`,`bottom`,`left`];function Xn(e,t,n){let r={};n=n?`-`+n:``;for(let i=0;i<4;i++){let a=Yn[i];r[a]=parseFloat(e[t+`-`+a+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}var Zn=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Qn(e,t){let n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:a}=r,o=!1,s,c;if(Zn(i,a,e.target))s=i,c=a;else{let e=t.getBoundingClientRect();s=r.clientX-e.left,c=r.clientY-e.top,o=!0}return{x:s,y:c,box:o}}function $n(e,t){if(`native`in e)return e;let{canvas:n,currentDevicePixelRatio:r}=t,i=qn(n),a=i.boxSizing===`border-box`,o=Xn(i,`padding`),s=Xn(i,`border`,`width`),{x:c,y:l,box:u}=Qn(e,n),d=o.left+(u&&s.left),f=o.top+(u&&s.top),{width:p,height:m}=t;return a&&(p-=o.width+s.width,m-=o.height+s.height),{x:Math.round((c-d)/p*n.width/r),y:Math.round((l-f)/m*n.height/r)}}function er(e,t,n){let r,i;if(t===void 0||n===void 0){let a=e&&Gn(e);if(!a)t=e.clientWidth,n=e.clientHeight;else{let e=a.getBoundingClientRect(),o=qn(a),s=Xn(o,`border`,`width`),c=Xn(o,`padding`);t=e.width-c.width-s.width,n=e.height-c.height-s.height,r=Kn(o.maxWidth,a,`clientWidth`),i=Kn(o.maxHeight,a,`clientHeight`)}}return{width:t,height:n,maxWidth:r||Le,maxHeight:i||Le}}var tr=e=>Math.round(e*10)/10;function nr(e,t,n,r){let i=qn(e),a=Xn(i,`margin`),o=Kn(i.maxWidth,e,`clientWidth`)||Le,s=Kn(i.maxHeight,e,`clientHeight`)||Le,c=er(e,t,n),{width:l,height:u}=c;if(i.boxSizing===`content-box`){let e=Xn(i,`border`,`width`),t=Xn(i,`padding`);l-=t.width+e.width,u-=t.height+e.height}return l=Math.max(0,l-a.width),u=Math.max(0,r?l/r:u-a.height),l=tr(Math.min(l,o,c.maxWidth)),u=tr(Math.min(u,s,c.maxHeight)),l&&!u&&(u=tr(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=tr(Math.floor(u*r))),{width:l,height:u}}function rr(e,t,n){let r=t||1,i=tr(e.height*r),a=tr(e.width*r);e.height=tr(e.height),e.width=tr(e.width);let o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||o.height!==i||o.width!==a?(e.currentDevicePixelRatio=r,o.height=i,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}var ir=function(){let e=!1;try{let t={get passive(){return e=!0,!1}};Wn()&&(window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t))}catch{}return e}();function ar(e,t){let n=Jn(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function or(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function sr(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r===`middle`?n<.5?e.y:t.y:r===`after`?n<1?e.y:t.y:n>0?t.y:e.y}}function cr(e,t,n,r){let i={x:e.cp2x,y:e.cp2y},a={x:t.cp1x,y:t.cp1y},o=or(e,i,n),s=or(i,a,n),c=or(a,t,n);return or(or(o,s,n),or(s,c,n),n)}var lr=function(e,t){return{x(n){return e+e+t-n},setWidth(e){t=e},textAlign(e){return e===`center`?e:e===`right`?`left`:`right`},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},ur=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function dr(e,t,n){return e?lr(t,n):ur()}function fr(e,t){let n,r;(t===`ltr`||t===`rtl`)&&(n=e.canvas.style,r=[n.getPropertyValue(`direction`),n.getPropertyPriority(`direction`)],n.setProperty(`direction`,t,`important`),e.prevTextDirection=r)}function pr(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,t[0],t[1]))}function mr(e){return e===`angle`?{between:nt,compare:tt,normalize:W}:{between:it,compare:(e,t)=>e-t,normalize:e=>e}}function hr({start:e,end:t,count:n,loop:r,style:i}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:i}}function gr(e,t,n){let{property:r,start:i,end:a}=n,{between:o,normalize:s}=mr(r),c=t.length,{start:l,end:u,loop:d}=e,f,p;if(d){for(l+=c,u+=c,f=0,p=c;fc(i,y,_)&&s(i,y)!==0,x=()=>s(a,_)===0||c(a,y,_),S=()=>h||b(),C=()=>!h||x();for(let e=u,n=u;e<=d;++e)v=t[e%o],!v.skip&&(_=l(v[r]),_!==y&&(h=c(_,i,a),g===null&&S()&&(g=s(_,i)===0?e:n),g!==null&&C()&&(m.push(hr({start:g,end:e,loop:f,count:o,style:p})),g=null),n=e,y=_));return g!==null&&m.push(hr({start:g,end:d,loop:f,count:o,style:p})),m}function vr(e,t){let n=[],r=e.segments;for(let i=0;ii&&e[a%t].skip;)a--;return a%=t,{start:i,end:a}}function br(e,t,n,r){let i=e.length,a=[],o=t,s=e[t],c;for(c=t+1;c<=n;++c){let n=e[c%i];n.skip||n.stop?s.skip||(r=!1,a.push({start:t%i,end:(c-1)%i,loop:r}),t=o=n.stop?c:null):(o=c,s.skip&&(t=c)),s=n}return o!==null&&a.push({start:t%i,end:o%i,loop:r}),a}function xr(e,t){let n=e.points,r=e.options.spanGaps,i=n.length;if(!i)return[];let a=!!e._loop,{start:o,end:s}=yr(n,i,a,r);return r===!0?Sr(e,[{start:o,end:s,loop:a}],n,t):Sr(e,br(n,o,sr({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ft.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}},Ar=`transparent`,jr={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let r=wt(e||Ar),i=r.valid&&wt(t||Ar);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}},Mr=class{constructor(e,t,n,r){let i=t[n];r=fn([e.to,r,i,e.from]);let a=fn([e.from,i,r]);this._active=!0,this._fn=e.fn||jr[e.type||typeof a],this._easing=St[e.easing]||St.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],i=n-this._start,a=this._duration-i;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=fn([e.to,t,r,e.from]),this._from=fn([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}wait(){let e=this._promises||(this._promises=[]);return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e{let i=e[r];if(!F(i))return;let a={};for(let e of t)a[e]=i[e];(P(i.properties)&&i.properties||[r]).forEach(e=>{(e===r||!n.has(e))&&n.set(e,a)})})}_animateOptions(e,t){let n=t.options,r=Fr(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&Pr(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||(e.$animations={}),a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u)if(d&&u.active()){u.update(d,l,o);continue}else u.cancel();if(!d||!d.duration){e[c]=l;continue}i[c]=u=new Mr(d,e,c,l),r.push(u)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return kr.add(this._chart,n),!0}};function Pr(e,t){let n=[],r=Object.keys(t);for(let t=0;t0||!n&&t<0)return i.index}return null}function qr(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||(n._stacks={}),{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=Ur(a,o,r),d=t.length,f;for(let e=0;en[e].axis===t).shift()}function Yr(e,t){return mn(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function Xr(e,t,n){return mn(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function Zr(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(let e of t){let t=e._stacks;if(!t||t[r]===void 0||t[r][n]===void 0)return;delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n]}}}var Qr=e=>e===`reset`||e===`none`,$r=(e,t)=>t?e:Object.assign({},e),ei=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:zr(n,!0),values:null},ti=class{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Hr(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled(`filler`)&&console.warn(`Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options`)}updateIndex(e){this.index!==e&&Zr(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=R(n.xAxisID,Jr(e,`x`)),a=t.yAxisID=R(n.yAxisID,Jr(e,`y`)),o=t.rAxisID=R(n.rAxisID,Jr(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&ut(this._data,this),e._stacked&&Zr(e)}_dataCheck(){let e=this.getDataset(),t=e.data||(e.data=[]),n=this._data;if(F(t)){let e=this._cachedMeta;this._data=Vr(t,e)}else if(n!==t){if(n){ut(n,this);let e=this._cachedMeta;Zr(e),e._parsed=[]}t&&Object.isExtensible(t)&<(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=Hr(t.vScale,t),t.stack!==n.stack&&(r=!0,Zr(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(qr(this,t._parsed),t._stacked=Hr(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:i,_stacked:a}=n,o=i.axis,s=e===0&&t===r.length?!0:n._sorted,c=e>0&&n._parsed[e-1],l,u,d;if(this._parsing===!1)n._parsed=r,n._sorted=!0,d=r;else{d=P(r[e])?this.parseArrayData(n,r,e,t):F(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let i=()=>u[o]===null||c&&u[o]t||u=0;--d)if(!p()){this.updateRangeFromParsed(c,e,f,s);break}}return c}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r=0&&ethis.getContext(n,r,t),u);return p.$shared&&(p.$shared=s,i[a]=Object.freeze($r(p,s))),p}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Nr(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||Qr(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){Qr(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!Qr(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;oe-t))}return e._cache.$bar}function ri(e){let t=e.iScale,n=ni(t,e.type),r=t._length,i,a,o,s,c=()=>{o===32767||o===-32768||(Me(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i0?i[e-1]:null,s=eMath.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function si(e,t,n,r){return P(e)?oi(e,t,n,r):t[n.axis]=n.parse(e,r),t}function ci(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l=n?1:-1):He(e)}function di(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.basee.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(N(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[R(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;i=0;--n)t=Math.max(t,e[n].size(this.resolveDataElementOptions(n))/2);return t>0&&t}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y),c=a._custom;return{label:n[e]||``,value:`(`+o+`, `+s+(c?`, `+c:``)+`)`}}update(e){let t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:s,includeOptions:c}=this._getSharedOptions(t,r),l=a.axis,u=o.axis;for(let d=t;dnt(e,s,c,!0)?1:Math.max(t,t*n,r,r*n),m=(e,t,r)=>nt(e,s,c,!0)?-1:Math.min(t,t*n,r,r*n),h=p(0,l,d),g=p(U,u,f),_=m(V,l,d),v=m(V+U,u,f);r=(h-_)/2,i=(g-v)/2,a=-(h+_)/2,o=-(g+v)/2}return{ratioX:r,ratioY:i,offsetX:a,offsetY:o}}var yi=class extends ti{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let n=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=n;else{let i=e=>+n[e];if(F(n[e])){let{key:e=`value`}=this._parsing;i=t=>+Ae(n[t],e)}let a,o;for(a=e,o=e+t;a0&&!isNaN(e)?Math.abs(e)/t*H:0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=Mt(t._parsed[e],n.options.locale);return{label:r[e]||``,value:i}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;re!==`spacing`,_indexable:e=>e!==`spacing`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)}),n(yi,`overrides`,{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}});var bi=class extends ti{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){let t=this._cachedMeta,{dataset:n,data:r=[],_dataset:i}=t,a=this.chart._animationsDisabled,{start:o,count:s}=_t(t,r,a);this._drawStart=o,this._drawCount=s,vt(t)&&(o=0,s=r.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!i._decimated,n.points=r;let c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},e),this.updateElements(r,o,s,e)}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o,_stacked:s,_dataset:c}=this._cachedMeta,{sharedOptions:l,includeOptions:u}=this._getSharedOptions(t,r),d=a.axis,f=o.axis,{spanGaps:p,segment:m}=this.options,h=qe(p)?p:1/0,g=this.chart._animationsDisabled||i||r===`none`,_=t+n,v=e.length,y=t>0&&this.getParsed(t-1);for(let n=0;n=_){v.skip=!0;continue}let b=this.getParsed(n),x=N(b[f]),S=v[d]=a.getPixelForValue(b[d],n),C=v[f]=i||x?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,b,s):b[f],n);v.skip=isNaN(S)||isNaN(C)||x,v.stop=n>0&&Math.abs(b[d]-y[d])>h,m&&(v.parsed=b,v.raw=c.data[n]),u&&(v.options=l||this.resolveDataElementOptions(n,p.active?`active`:r)),g||this.updateElement(p,n,v,r),y=b}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,r=e.data||[];if(!r.length)return n;let i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(n,i,a)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}};n(bi,`id`,`line`),n(bi,`defaults`,{datasetElementType:`line`,dataElementType:`point`,showLine:!0,spanGaps:!1}),n(bi,`overrides`,{scales:{_index_:{type:`category`},_value_:{type:`linear`}}});var xi=class extends ti{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=Mt(t._parsed[e].r,n.options.locale);return{label:r[e]||``,value:i}}parseObjectData(e,t,n,r){return Nn.bind(this)(e,t,n,r)}update(e){let t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){let e=this._cachedMeta,t={min:1/0,max:-1/0};return e.data.forEach((e,n)=>{let r=this.getParsed(n).r;!isNaN(r)&&this.chart.getDataVisibility(n)&&(rt.max&&(t.max=r))}),t}_updateRadius(){let e=this.chart,t=e.chartArea,n=e.options,r=Math.min(t.right-t.left,t.bottom-t.top),i=Math.max(r/2,0),a=(i-Math.max(n.cutoutPercentage?i/100*n.cutoutPercentage:1,0))/e.getVisibleDatasetCount();this.outerRadius=i-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,n,r){let i=r===`reset`,a=this.chart,o=a.options.animation,s=this._cachedMeta.rScale,c=s.xCenter,l=s.yCenter,u=s.getIndexAngle(0)-.5*V,d=u,f,p=360/this.countVisibleElements();for(f=0;f{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(e,t,n){return this.chart.getDataVisibility(e)?Xe(this.resolveDataElementOptions(e,t).angle||n):0}};n(xi,`id`,`polarArea`),n(xi,`defaults`,{dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:`number`,properties:[`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`]}},indexAxis:`r`,startAngle:0}),n(xi,`overrides`,{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:n,color:r}}=e.legend.options;return t.labels.map((t,i)=>{let a=e.getDatasetMeta(0).controller.getStyle(i);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(i),index:i}})}return[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}},scales:{r:{type:`radialLinear`,angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});var Si=class extends yi{};n(Si,`id`,`pie`),n(Si,`defaults`,{cutout:0,rotation:0,circumference:360,radius:`100%`});var Ci=class extends ti{getLabelAndValue(e){let t=this._cachedMeta.vScale,n=this.getParsed(e);return{label:t.getLabels()[e],value:``+t.getLabelForValue(n[t.axis])}}parseObjectData(e,t,n,r){return Nn.bind(this)(e,t,n,r)}update(e){let t=this._cachedMeta,n=t.dataset,r=t.data||[],i=t.iScale.getLabels();if(n.points=r,e!==`resize`){let t=this.resolveDatasetElementOptions(e);this.options.showLine||(t.borderWidth=0);let a={_loop:!0,_fullLoop:i.length===r.length,options:t};this.updateElement(n,void 0,a,e)}this.updateElements(r,0,r.length,e)}updateElements(e,t,n,r){let i=this._cachedMeta.rScale,a=r===`reset`;for(let o=t;o0&&this.getParsed(t-1);for(let l=t;l0&&Math.abs(n[f]-v[f])>g,h&&(m.parsed=n,m.raw=c.data[l]),d&&(m.options=u||this.resolveDataElementOptions(l,t.active?`active`:r)),_||this.updateElement(t,l,m,r),v=n}this.updateSharedOptions(u,r,l)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}let n=e.dataset,r=n.options&&n.options.borderWidth||0;if(!t.length)return r;let i=t[0].size(this.resolveDataElementOptions(0)),a=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(r,i,a)/2}};n(wi,`id`,`scatter`),n(wi,`defaults`,{datasetElementType:!1,dataElementType:`point`,showLine:!1,fill:!1}),n(wi,`overrides`,{interaction:{mode:`point`},scales:{x:{type:`linear`},y:{type:`linear`}}});var Ti=Object.freeze({__proto__:null,BarController:_i,BubbleController:Q,DoughnutController:yi,LineController:bi,PieController:Si,PolarAreaController:xi,RadarController:Ci,ScatterController:wi});function Ei(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var Di={_date:class e{static override(t){Object.assign(e.prototype,t)}constructor(e){n(this,`options`,void 0),this.options=e||{}}init(){}formats(){return Ei()}parse(){return Ei()}format(){return Ei()}add(){return Ei()}diff(){return Ei()}startOf(){return Ei()}endOf(){return Ei()}}};function Oi(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?ot:K;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!N(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!N(e[t.axis]));r.hi+=Math.max(0,o)}return r}else if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function ki(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s=s||e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var Ii={evaluateInteractionItems:ki,modes:{index(e,t,n,r){let i=$n(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?ji(e,i,a,r,o):Pi(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=$n(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?ji(e,i,a,r,o):Pi(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;ee.pos===t)}function zi(e,t){return e.filter(e=>Li.indexOf(e.pos)===-1&&e.box.axis===t)}function Bi(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function Vi(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;ne.box.fullSize),!0),r=Bi(Ri(t,`left`),!0),i=Bi(Ri(t,`right`)),a=Bi(Ri(t,`top`),!0),o=Bi(Ri(t,`bottom`)),s=zi(t,`x`),c=zi(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:Ri(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function Gi(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function Ki(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function qi(e,t,n,r){let{pos:i,box:a}=n,o=e.maxPadding;if(!F(i)){n.size&&(e[i]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?a.height:a.width),n.size=t.size/t.count,e[i]+=n.size}a.getPadding&&Ki(o,a.getPadding());let s=Math.max(0,t.outerWidth-Gi(o,e,`left`,`right`)),c=Math.max(0,t.outerHeight-Gi(o,e,`top`,`bottom`)),l=s!==e.w,u=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function Ji(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function Yi(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function Xi(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);Ki(f,Y(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=Ui(c.concat(l),d);Xi(s.fullSize,p,d,m),Xi(c,p,d,m),Xi(l,p,d,m)&&Xi(c,p,d,m),Ji(p),Qi(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,Qi(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},B(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},$i=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},ea=class extends $i{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}},ta=`$chartjs`,na={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},ra=e=>e===null||e===``;function ia(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[ta]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,ra(i)){let t=ar(e,`width`);t!==void 0&&(e.width=t)}if(ra(r))if(e.style.height===``)e.height=e.width/(t||2);else{let t=ar(e,`height`);t!==void 0&&(e.height=t)}return e}var aa=ir?{passive:!0}:!1;function oa(e,t,n){e&&e.addEventListener(t,n,aa)}function sa(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,aa)}function ca(e,t){let n=na[e.type]||e.type,{x:r,y:i}=$n(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function la(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function ua(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t=t||la(n.addedNodes,r),t=t&&!la(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function da(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t=t||la(n.removedNodes,r),t=t&&!la(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var fa=new Map,pa=0;function ma(){let e=window.devicePixelRatio;e!==pa&&(pa=e,fa.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function ha(e,t){fa.size||window.addEventListener(`resize`,ma),fa.set(e,t)}function ga(e){fa.delete(e),fa.size||window.removeEventListener(`resize`,ma)}function _a(e,t,n){let r=e.canvas,i=r&&Gn(r);if(!i)return;let a=pt((e,t)=>{let r=i.clientWidth;n(e,t),r{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||a(n,r)});return o.observe(i),ha(e,a),o}function va(e,t,n){n&&n.disconnect(),t===`resize`&&ga(e)}function ya(e,t,n){let r=e.canvas,i=pt(t=>{e.ctx!==null&&n(ca(t,e))},e);return oa(r,t,i),i}var ba=class extends $i{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(ia(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[ta])return!1;let n=t[ta].initial;[`height`,`width`].forEach(e=>{let r=n[e];N(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[ta],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||(e.$proxies={});r[t]=({attach:ua,detach:da,resize:_a}[t]||ya)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||(e.$proxies={}),r=n[t];r&&(({attach:va,detach:va,resize:va}[t]||sa)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return nr(e,t,n,r)}isAttached(e){let t=e&&Gn(e);return!!(t&&t.isConnected)}};function xa(e){return!Wn()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?ea:ba}var Sa=class{constructor(){n(this,`x`,void 0),n(this,`y`,void 0),n(this,`active`,!1),n(this,`options`,void 0),n(this,`$animations`,void 0)}tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return qe(this.x)&&qe(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};n(Sa,`defaults`,{}),n(Sa,`defaultRoutes`,void 0);function Ca(e,t){let n=e.options.ticks,r=wa(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?Ea(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Da(t,l,a,o/i),l;let u=Ta(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(Oa(t,l,u,N(r)?0:s-r,s),e=0,n=o-1;ei)return t}return Math.max(i,1)}function Ea(e){let t=[],n,r;for(n=0,r=e.length;ne===`left`?`right`:e===`right`?`left`:e,ja=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,Ma=(e,t)=>Math.min(t||e,e);function Na(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;ao+s)))return c}function Fa(e,t){B(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;in?n:t,n=r&&t>n?t:n,{min:L(t,L(n,t)),max:L(n,L(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){z(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=pn(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=G(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-Ia(e.grid)-t.padding-La(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=Ze(Math.min(Math.asin(G((l.highest.height+6)/o,-1,1)),Math.asin(G(s/c,-1,1))-Math.asin(G(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){z(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){z(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=La(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=Ia(i)+a):(e.height=this.maxHeight,e.width=Ia(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=Xe(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){z(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t({width:a[e]||0,height:o[e]||0});return{first:C(0),last:C(t-1),widest:C(x),highest:C(S),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return rt(this._alignToPixels?Wt(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&eo*r?o/n:s/r:s*r0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:i,position:a,border:o}=r,s=i.offset,c=this.isHorizontal(),l=this.ticks.length+ +!!s,u=Ia(i),d=[],f=o.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,h=function(e){return Wt(n,e,p)},g,_,v,y,b,x,S,C,w,T,E,D;if(a===`top`)g=h(this.bottom),x=this.bottom-u,C=g-m,T=h(e.top)+m,D=e.bottom;else if(a===`bottom`)g=h(this.top),T=e.top,D=h(e.bottom)-m,x=g+m,C=this.top+u;else if(a===`left`)g=h(this.right),b=this.right-u,S=g-m,w=h(e.left)+m,E=e.right;else if(a===`right`)g=h(this.left),w=e.left,E=h(e.right)-m,b=g+m,S=this.left+u;else if(t===`x`){if(a===`center`)g=h((e.top+e.bottom)/2+.5);else if(F(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}T=e.top,D=e.bottom,x=g+m,C=x+u}else if(t===`y`){if(a===`center`)g=h((e.left+e.right)/2);else if(F(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}b=g-m,S=b-u,w=e.left,E=e.right}let O=R(r.ticks.maxTicksLimit,l),k=Math.max(1,Math.ceil(l/O));for(_=0;_0&&(a-=r/2);break}f={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}h.push({label:y,font:w,textOffset:D,options:{rotation:m,color:n,strokeColor:s,strokeWidth:l,textAlign:d,textBaseline:O,translation:[b,x],backdrop:f}})}return h}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-Xe(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e)),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i{this.draw(e)}}]:[{z:r,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i{let r=n.split(`.`),i=r.pop(),a=[e].concat(r).join(`.`),o=t[n].split(`.`),s=o.pop(),c=o.join(`.`);J.route(a,i,c,s)})}function Ka(e){return`id`in e&&`defaults`in e}var qa=new class{constructor(){this.controllers=new Ua(ti,`datasets`,!0),this.elements=new Ua(Sa,`elements`),this.plugins=new Ua(Object,`plugins`),this.scales=new Ua(Ha,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,n){[...t].forEach(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):B(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=je(e);z(n[`before`+r],[],n),t[e](n),z(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;te.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function Ya(e){let t={},n=[],r=Object.keys(qa.plugins.items);for(let e=0;e1&&no(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function ao(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function oo(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return ao(e,`x`,n[0])||ao(e,`y`,n[0])}return{}}function so(e,t){let n=Lt[e.type]||{scales:{}},r=t.scales||{},i=$a(e.type,t),a=Object.create(null);return Object.keys(r).forEach(t=>{let o=r[t];if(!F(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let s=io(t,o,oo(t,e),J.scales[o.type]),c=to(s,i),l=n.scales||{};a[t]=Te(Object.create(null),[{axis:s},o,l[s],l[c]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,o=n.indexAxis||$a(i,t),s=(Lt[i]||{}).scales||{};Object.keys(s).forEach(e=>{let t=eo(e,o),i=n[t+`AxisID`]||t;a[i]=a[i]||Object.create(null),Te(a[i],[{axis:t},r[i],s[e]])})}),Object.keys(a).forEach(e=>{let t=a[e];Te(t,[J.scales[t.type],J.scale])}),a}function co(e){let t=e.options||(e.options={});t.plugins=R(t.plugins,{}),t.scales=so(e,t)}function lo(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function uo(e){return e=e||{},e.data=lo(e.data),co(e),e}var fo=new Map,po=new Set;function mo(e,t){let n=fo.get(e);return n||(n=t(),fo.set(e,n),po.add(n)),n}var ho=(e,t,n)=>{let r=Ae(t,n);r!==void 0&&e.add(r)},go=class{constructor(e){this._config=uo(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=lo(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),co(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return mo(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return mo(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return mo(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return mo(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,a=this._cachedScopes(e,n),o=a.get(t);if(o)return o;let s=new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>ho(s,e,t))),t.forEach(e=>ho(s,r,e)),t.forEach(e=>ho(s,Lt[i]||{},e)),t.forEach(e=>ho(s,J,e)),t.forEach(e=>ho(s,Rt,e))});let c=Array.from(s);return c.length===0&&c.push(Object.create(null)),po.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,Lt[t]||{},J.datasets[t]||{},{type:t},J,Rt]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=_o(this._resolverCache,e,r),s=a;if(yo(a,t)){i.$shared=!1,n=Ne(n)?n():n;let t=this.createResolver(e,n,o);s=Z(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:i}=_o(this._resolverCache,e,n);return F(t)?Z(i,t,void 0,r):i}};function _o(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:hn(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}var vo=e=>F(e)&&Object.getOwnPropertyNames(e).some(t=>Ne(e[t]));function yo(e,t){let{isScriptable:n,isIndexable:r}=gn(e);for(let i of t){let t=n(i),a=r(i),o=(a||t)&&e[i];if(t&&(Ne(o)||vo(o))||a&&P(o))return!0}return!1}var bo=`4.5.1`,xo=[`top`,`bottom`,`left`,`right`,`chartArea`];function So(e,t){return e===`top`||e===`bottom`||xo.indexOf(e)===-1&&t===`x`}function Co(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function wo(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),z(n&&n.onComplete,[e],t)}function To(e){let t=e.chart,n=t.options.animation;z(n&&n.onProgress,[e],t)}function Eo(e){return Wn()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var Do={},Oo=e=>{let t=Eo(e);return Object.values(Do).filter(e=>e.canvas===t).pop()};function ko(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function Ao(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var jo=class{static register(...e){qa.add(...e),Mo()}static unregister(...e){qa.remove(...e),Mo()}constructor(e,t){let n=this.config=new go(t),r=Eo(e),i=Oo(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(xa(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;if(this.id=_e(),this.ctx=o,this.canvas=s,this.width=l,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Ja,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=mt(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],Do[this.id]=this,!o||!s){console.error(`Failed to create chart: can't acquire context from the given item`);return}kr.listen(this,`complete`,wo),kr.listen(this,`progress`,To),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return N(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return qa}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():rr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return Gt(this.canvas,this.ctx),this}stop(){return kr.stop(this),this}resize(e,t){kr.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,rr(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),z(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){B(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=io(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),B(i,t=>{let i=t.options,a=i.id,o=io(a,i),s=R(i.type,t.dtype);(i.position===void 0||So(i.position,o)!==So(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(qa.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),B(r,(e,t)=>{e||delete n[t]}),B(n,e=>{$.configure(this,e,e.options),$.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;et.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(Co(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){B(this.scales,e=>{$.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;(!Pe(new Set(Object.keys(this._listeners)),new Set(e.events))||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)ko(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;ee.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;$.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],B(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=Or(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&Yt(t,r),e.controller.draw(),r&&Xt(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return Jt(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=Ii.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||(this.$context=mn(null,{chart:this,type:`chart`}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);Me(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),kr.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};B(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){B(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},B(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});be(n,t)||(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=Fe(e),c=Ao(e,this._lastEvent,n,s);n&&(this._lastEvent=null,z(i.onHover,[e,o,this],this),s&&z(i.onClick,[e,o,this],this));let l=!be(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};n(jo,`defaults`,J),n(jo,`instances`,Do),n(jo,`overrides`,Lt),n(jo,`registry`,qa),n(jo,`version`,bo),n(jo,`getChart`,Oo);function Mo(){return B(jo.instances,e=>e._plugins.invalidate())}function No(e,t,n){let{startAngle:r,x:i,y:a,outerRadius:o,innerRadius:s,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/o,W(r-n));if(e.beginPath(),e.arc(i,a,o-l/2,r+d/2,n-d/2),s>0){let t=Math.min(l/s,W(r-n));e.arc(i,a,s+l/2,n-t/2,r+t/2,!0)}else{let t=Math.min(l/2,o*W(r-n));if(u===`round`)e.arc(i,a,t,n-V/2,r+V/2,!0);else if(u===`bevel`){let o=2*t*t,s=-o*Math.cos(n+V/2)+i,c=-o*Math.sin(n+V/2)+a,l=o*Math.cos(r+V/2)+i,u=o*Math.sin(r+V/2)+a;e.lineTo(s,c),e.lineTo(l,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function Po(e,t,n){let{startAngle:r,pixelMargin:i,x:a,y:o,outerRadius:s,innerRadius:c}=t,l=i/s;e.beginPath(),e.arc(a,o,s,r-l,n+l),c>i?(l=i/c,e.arc(a,o,c,n+l,r-l,!0)):e.arc(a,o,i,n+U,r-U),e.closePath(),e.clip()}function Fo(e){return ln(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function Io(e,t,n,r){let i=Fo(e.options.borderRadius),a=(n-t)/2,o=Math.min(a,r*t/2),s=e=>{let t=(n-Math.min(a,e))*r/2;return G(e,0,Math.min(a,t))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:G(i.innerStart,0,o),innerEnd:G(i.innerEnd,0,o)}}function Lo(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Ro(e,t,n,r,i,a){let{x:o,y:s,startAngle:c,pixelMargin:l,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-l,0),f=u>0?u+r+n+l:0,p=0,m=i-c;if(r){let e=((u>0?u-r:0)+(d>0?d-r:0))/2;p=(m-(e===0?m:m*e/(e+r)))/2}let h=(m-Math.max(.001,m*d-n/V)/d)/2,g=c+h+p,_=i-h-p,{outerStart:v,outerEnd:y,innerStart:b,innerEnd:x}=Io(t,f,d,_-g),S=d-v,C=d-y,w=g+v/S,T=_-y/C,E=f+b,D=f+x,O=g+b/E,k=_-x/D;if(e.beginPath(),a){let t=(w+T)/2;if(e.arc(o,s,d,w,t),e.arc(o,s,d,t,T),y>0){let t=Lo(C,T,o,s);e.arc(t.x,t.y,y,T,_+U)}let n=Lo(D,_,o,s);if(e.lineTo(n.x,n.y),x>0){let t=Lo(D,k,o,s);e.arc(t.x,t.y,x,_+U,k+Math.PI)}let r=(_-x/f+(g+b/f))/2;if(e.arc(o,s,f,_-x/f,r,!0),e.arc(o,s,f,r,g+b/f,!0),b>0){let t=Lo(E,O,o,s);e.arc(t.x,t.y,b,O+Math.PI,g-U)}let i=Lo(S,g,o,s);if(e.lineTo(i.x,i.y),v>0){let t=Lo(S,w,o,s);e.arc(t.x,t.y,v,g-U,w)}}else{e.moveTo(o,s);let t=Math.cos(w)*d+o,n=Math.sin(w)*d+s;e.lineTo(t,n);let r=Math.cos(T)*d+o,i=Math.sin(T)*d+s;e.lineTo(r,i)}e.closePath()}function zo(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s}=t,c=t.endAngle;if(a){Ro(e,t,n,r,c,i);for(let t=0;t=V&&p===0&&u!==`miter`&&No(e,t,h),a||(Ro(e,t,n,r,h,i),e.stroke())}var Vo=class extends Sa{constructor(e){super(),n(this,`circumference`,void 0),n(this,`endAngle`,void 0),n(this,`fullCircles`,void 0),n(this,`innerRadius`,void 0),n(this,`outerRadius`,void 0),n(this,`pixelMargin`,void 0),n(this,`startAngle`,void 0),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){let{angle:r,distance:i}=$e(this.getProps([`x`,`y`],n),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:s,outerRadius:c,circumference:l}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],n),u=(this.options.spacing+this.options.borderWidth)/2,d=R(l,o-a),f=nt(r,a,o)&&a!==o,p=d>=H||f,m=it(i,s+u,c+u);return p&&m}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,i=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=n>H?Math.floor(n/H):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let s=r*(1-Math.sin(Math.min(V,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,zo(e,this,s,i,a),Bo(e,this,s,i,a),e.restore()}};n(Vo,`id`,`arc`),n(Vo,`defaults`,{borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),n(Vo,`defaultRoutes`,{backgroundColor:`backgroundColor`}),n(Vo,`descriptors`,{_scriptable:!0,_indexable:e=>e!==`borderDash`});function Ho(e,t,n=t){e.lineCap=R(n.borderCapStyle,t.borderCapStyle),e.setLineDash(R(n.borderDash,t.borderDash)),e.lineDashOffset=R(n.borderDashOffset,t.borderDashOffset),e.lineJoin=R(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=R(n.borderWidth,t.borderWidth),e.strokeStyle=R(n.borderColor,t.borderColor)}function Uo(e,t,n){e.lineTo(n.x,n.y)}function Wo(e){return e.stepped?Zt:e.tension||e.cubicInterpolationMode===`monotone`?Qt:Uo}function Go(e,t,n={}){let r=e.length,{start:i=0,end:a=r-1}=n,{start:o,end:s}=t,c=Math.max(i,o),l=Math.min(a,s),u=is&&a>s;return{count:r,start:c,loop:t.loop,ilen:l(o+(l?s-e:e))%a,y=()=>{h!==g&&(e.lineTo(u,g),e.lineTo(u,h),e.lineTo(u,_))};for(c&&(p=i[v(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[v(f)],p.skip)continue;let t=p.x,n=p.y,r=t|0;r===m?(ng&&(g=n),u=(d*u+t)/++d):(y(),e.lineTo(t,n),m=r,d=0,h=g=n),_=n}y()}function Jo(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!==`monotone`&&!t.stepped&&!n?qo:Ko}function Yo(e){return e.stepped?sr:e.tension||e.cubicInterpolationMode===`monotone`?cr:or}function Xo(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),Ho(e,t.options),e.stroke(i)}function Zo(e,t,n,r){let{segments:i,options:a}=t,o=Jo(t);for(let s of i)Ho(e,a,s.style),e.beginPath(),o(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}var Qo=typeof Path2D==`function`;function $o(e,t,n,r){Qo&&!t.options.segment?Xo(e,t,n,r):Zo(e,t,n,r)}var es=class extends Sa{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){let n=this.options;if((n.tension||n.cubicInterpolationMode===`monotone`)&&!n.stepped&&!this._pointsUpdated){let r=n.spanGaps?this._loop:this._fullLoop;Un(this._points,n,e,r,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=xr(this,this.options.segment))}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){let n=this.options,r=e[t],i=this.points,a=vr(this,{property:t,start:r,end:r});if(!a.length)return;let o=[],s=Yo(n),c,l;for(c=0,l=a.length;ce!==`borderDash`&&e!==`fill`});function ts(e,t,n,r){let i=e.options,{[n]:a}=e.getProps([n],r);return Math.abs(t-a)e.replace(`rgb(`,`rgba(`).replace(`)`,`, 0.5)`));function gs(e){return ms[e%ms.length]}function _s(e){return hs[e%hs.length]}function vs(e,t){return e.borderColor=gs(t),e.backgroundColor=_s(t),++t}function ys(e,t){return e.backgroundColor=e.data.map(()=>gs(t++)),t}function bs(e,t){return e.backgroundColor=e.data.map(()=>_s(t++)),t}function xs(e){let t=0;return(n,r)=>{let i=e.getDatasetMeta(r).controller;i instanceof yi?t=ys(n,t):i instanceof xi?t=bs(n,t):i&&(t=vs(n,t))}}function Ss(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function Cs(e){return e&&(e.borderColor||e.backgroundColor)}function ws(){return J.borderColor!==`rgba(0,0,0,0.1)`||J.backgroundColor!==`rgba(0,0,0,0.1)`}var Ts={id:`colors`,defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;let{data:{datasets:r},options:i}=e.config,{elements:a}=i,o=Ss(r)||Cs(i)||a&&Ss(a)||ws();if(!n.forceOverride&&o)return;let s=xs(e);r.forEach(s)}};function Es(e,t,n,r,i){let a=i.samples||r;if(a>=n)return e.slice(t,t+n);let o=[],s=(n-2)/(a-2),c=0,l=t+n-1,u=t,d,f,p,m,h;for(o[c++]=e[u],d=0;dp&&(p=m,f=e[a],h=a);o[c++]=f,u=h}return o[c++]=e[l],o}function Ds(e,t,n,r){let i=0,a=0,o,s,c,l,u,d,f,p,m,h,g=[],_=t+n-1,v=e[t].x,y=e[_].x-v;for(o=t;oh&&(h=l,f=o),i=(a*i+s.x)/++a;else{let n=o-1;if(!N(d)&&!N(f)){let t=Math.min(d,f),r=Math.max(d,f);t!==p&&t!==n&&g.push({...e[t],x:i}),r!==p&&r!==n&&g.push({...e[r],x:i})}o>0&&n!==p&&g.push(e[n]),g.push(s),u=t,a=0,m=h=l,d=f=p=o}}return g}function Os(e){if(e._decimated){let t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function ks(e){e.data.datasets.forEach(e=>{Os(e)})}function As(e,t){let n=t.length,r=0,i,{iScale:a}=e,{min:o,max:s,minDefined:c,maxDefined:l}=a.getUserBounds();return c&&(r=G(K(t,a.axis,o).lo,0,n-1)),i=l?G(K(t,a.axis,s).hi+1,r,n)-r:n-r,{start:r,count:i}}var js={id:`decimation`,defaults:{algorithm:`min-max`,enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){ks(e);return}let r=e.width;e.data.datasets.forEach((t,i)=>{let{_data:a,indexAxis:o}=t,s=e.getDatasetMeta(i),c=a||t.data;if(fn([o,e.options.indexAxis])===`y`||!s.controller.supportsDecimation)return;let l=e.scales[s.xAxisID];if(l.type!==`linear`&&l.type!==`time`||e.options.parsing)return;let{start:u,count:d}=As(s,c);if(d<=(n.threshold||4*r)){Os(t);return}N(a)&&(t._data=c,delete t.data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(e){this._data=e}}));let f;switch(n.algorithm){case`lttb`:f=Es(c,u,d,r,n);break;case`min-max`:f=Ds(c,u,d,r);break;default:throw Error(`Unsupported decimation algorithm '${n.algorithm}'`)}t._decimated=f})},destroy(e){ks(e)}};function Ms(e,t,n){let r=e.segments,i=e.points,a=t.points,o=[];for(let e of r){let{start:r,end:s}=e;s=Fs(r,s,i);let c=Ns(n,i[r],i[s],e.loop);if(!t.segments){o.push({source:e,target:c,start:i[r],end:i[s]});continue}let l=vr(t,c);for(let t of l){let r=Ns(n,a[t.start],a[t.end],t.loop),s=_r(e,i,r);for(let e of s)o.push({source:e,target:t,start:{[n]:Is(c,r,`start`,Math.max)},end:{[n]:Is(c,r,`end`,Math.min)}})}}return o}function Ns(e,t,n,r){if(r)return;let i=t[e],a=n[e];return e===`angle`&&(i=W(i),a=W(a)),{property:e,start:i,end:a}}function Ps(e,t){let{x:n=null,y:r=null}=e||{},i=t.points,a=[];return t.segments.forEach(({start:e,end:t})=>{t=Fs(e,t,i);let o=i[e],s=i[t];r===null?n!==null&&(a.push({x:n,y:o.y}),a.push({x:n,y:s.y})):(a.push({x:o.x,y:r}),a.push({x:s.x,y:r}))}),a}function Fs(e,t,n){for(;t>e;t--){let e=n[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function Is(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function Ls(e,t){let n=[],r=!1;return P(e)?(r=!0,n=e):n=Ps(e,t),n.length?new es({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function Rs(e){return e&&e.fill!==!1}function zs(e,t,n){let r=e[t].fill,i=[t],a;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!I(r))return r;if(a=e[r],!a)return!1;if(a.visible)return r;i.push(r),r=a.fill}return!1}function Bs(e,t,n){let r=Ws(e);if(F(r))return isNaN(r.value)?!1:r;let i=parseFloat(r);return I(i)&&Math.floor(i)===i?Vs(r[0],t,i,n):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(r)>=0&&r}function Vs(e,t,n,r){return(e===`-`||e===`+`)&&(n=t+n),n===t||n<0||n>=r?!1:n}function Hs(e,t){let n=null;return e===`start`?n=t.bottom:e===`end`?n=t.top:F(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function Us(e,t,n){let r;return r=e===`start`?n:e===`end`?t.options.reverse?t.min:t.max:F(e)?e.value:t.getBaseValue(),r}function Ws(e){let t=e.options,n=t.fill,r=R(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?`origin`:r}function Gs(e){let{scale:t,index:n,line:r}=e,i=[],a=r.segments,o=r.points,s=Ks(t,n);s.push(Ls({x:null,y:t.bottom},r));for(let e=0;e=0;--t){let n=i[t].$filler;n&&(n.line.updateControlPoints(a,n.axis),r&&n.fill&&tc(e.ctx,n,a))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!==`beforeDatasetsDraw`)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let n=r[t].$filler;Rs(n)&&tc(e.ctx,n,e.chartArea)}},beforeDatasetDraw(e,t,n){let r=t.meta.$filler;!Rs(r)||n.drawTime!==`beforeDatasetDraw`||tc(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}},lc=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},uc=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,dc=class extends Sa{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let e=this.options.labels||{},t=z(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,r=X(n.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:s}=lc(n,i),c,l;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,l=this._fitRows(a,i,o,s)+10):(l=this.maxHeight,c=this._fitCols(a,r,o,s)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(l,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=fc(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:i}}=this,a=dr(i,this.left,this.width);if(this.isHorizontal()){let i=0,o=q(n,this.left+r,this.right-this.lineWidths[i]);for(let s of t)i!==s.row&&(i=s.row,o=q(n,this.left+r,this.right-this.lineWidths[i])),s.top+=this.top+e+r,s.left=a.leftForLtr(a.x(o),s.width),o+=s.width+r}else{let i=0,o=q(n,this.top+e+r,this.bottom-this.columnSizes[i].height);for(let s of t)s.col!==i&&(i=s.col,o=q(n,this.top+e+r,this.bottom-this.columnSizes[i].height)),s.top=o,s.left+=this.left+r,s.left=a.leftForLtr(a.x(s.left),s.width),o+=s.height+r}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;Yt(e,this),this._draw(),Xt(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:i,labels:a}=e,o=J.color,s=dr(e.rtl,this.left,this.width),c=X(a.font),{padding:l}=a,u=c.size,d=u/2,f;this.drawTitle(),r.textAlign=s.textAlign(`left`),r.textBaseline=`middle`,r.lineWidth=.5,r.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:h}=lc(a,u),g=function(e,t,n){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;r.save();let i=R(n.lineWidth,1);if(r.fillStyle=R(n.fillStyle,o),r.lineCap=R(n.lineCap,`butt`),r.lineDashOffset=R(n.lineDashOffset,0),r.lineJoin=R(n.lineJoin,`miter`),r.lineWidth=i,r.strokeStyle=R(n.strokeStyle,o),r.setLineDash(R(n.lineDash,[])),a.usePointStyle)qt(r,{radius:m*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:i},s.xPlus(e,p/2),t+d,a.pointStyleWidth&&p);else{let a=t+Math.max((u-m)/2,0),o=s.leftForLtr(e,p),c=dn(n.borderRadius);r.beginPath(),Object.values(c).some(e=>e!==0)?rn(r,{x:o,y:a,w:p,h:m,radius:c}):r.rect(o,a,p,m),r.fill(),i!==0&&r.stroke()}r.restore()},_=function(e,t,n){nn(r,n.text,e,t+h/2,c,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();f=v?{x:q(i,this.left+l,this.right-n[0]),y:this.top+l+y,line:0}:{x:this.left+l,y:q(i,this.top+y+l,this.bottom-t[0].height),line:0},fr(this.ctx,e.textDirection);let b=h+l;this.legendItems.forEach((o,u)=>{r.strokeStyle=o.fontColor,r.fillStyle=o.fontColor;let m=r.measureText(o.text).width,h=s.textAlign(o.textAlign||(o.textAlign=a.textAlign)),x=p+d+m,S=f.x,C=f.y;if(s.setWidth(this.width),v?u>0&&S+x+l>this.right&&(C=f.y+=b,f.line++,S=f.x=q(i,this.left+l,this.right-n[f.line])):u>0&&C+b>this.bottom&&(S=f.x=S+t[f.line].width+l,f.line++,C=f.y=q(i,this.top+y+l,this.bottom-t[f.line].height)),g(s.x(S),C,o),S=gt(h,S+p+d,v?S+x:this.right,e.rtl),_(s.x(S),C,o),v)f.x+=x+l;else if(typeof o.text!=`string`){let e=c.lineHeight;f.y+=hc(o,e)+l}else f.y+=b}),pr(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=X(t.font),r=Y(t.padding);if(!t.display)return;let i=dr(e.rtl,this.left,this.width),a=this.ctx,o=t.position,s=n.size/2,c=r.top+s,l,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+c,u=q(e.align,u,this.right-d);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);l=c+q(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let f=q(o,u,u+d);a.textAlign=i.textAlign(ht(o)),a.textBaseline=`middle`,a.strokeStyle=t.color,a.fillStyle=t.color,a.font=n.string,nn(a,t.text,f,l,n)}_computeTitleHeight(){let e=this.options.title,t=X(e.font),n=Y(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,i;if(it(e,this.left,this.right)&&it(t,this.top,this.bottom)){for(i=this.legendHitBoxes,n=0;ne.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function mc(e,t,n){let r=e;return typeof t.text!=`string`&&(r=hc(t,n)),r}function hc(e,t){return t*(e.text?e.text.length:0)}function gc(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var _c={id:`legend`,_element:dc,start(e,t,n){let r=e.legend=new dc({ctx:e.ctx,options:n,chart:e});$.configure(e,r,n),$.addBox(e,r)},stop(e){$.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;$.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:a,useBorderRadius:o,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(n?0:void 0),l=Y(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(s||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}},vc=class extends Sa{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let r=P(n.text)?n.text.length:1;this._padding=Y(n.padding);let i=r*X(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){let e=this.options.position;return e===`top`||e===`bottom`}_drawArgs(e){let{top:t,left:n,bottom:r,right:i,options:a}=this,o=a.align,s=0,c,l,u;return this.isHorizontal()?(l=q(o,n,i),u=t+e,c=i-n):(a.position===`left`?(l=n+e,u=q(o,r,t),s=V*-.5):(l=i-e,u=q(o,t,r),s=V*.5),c=r-t),{titleX:l,titleY:u,maxWidth:c,rotation:s}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let n=X(t.font),r=n.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:o,rotation:s}=this._drawArgs(r);nn(e,t.text,0,0,n,{color:t.color,maxWidth:o,rotation:s,textAlign:ht(t.align),textBaseline:`middle`,translation:[i,a]})}};function yc(e,t){let n=new vc({ctx:e.ctx,options:t,chart:e});$.configure(e,n,t),$.addBox(e,n),e.titleBlock=n}var bc={id:`title`,_element:vc,start(e,t,n){yc(e,n)},stop(e){let t=e.titleBlock;$.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){let r=e.titleBlock;$.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`bold`},fullSize:!0,padding:10,position:`top`,text:``,weight:2e3},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},xc=new WeakMap,Sc={id:`subtitle`,start(e,t,n){let r=new vc({ctx:e.ctx,options:n,chart:e});$.configure(e,r,n),$.addBox(e,r),xc.set(e,r)},stop(e){$.removeBox(e,xc.get(e)),xc.delete(e)},beforeUpdate(e,t,n){let r=xc.get(e);$.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`normal`},fullSize:!0,padding:0,position:`top`,text:``,weight:1500},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},Cc={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,a=0;for(t=0,n=e.length;te+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;a-1?e.split(` +`):e}function Ec(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Dc(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=X(t.bodyFont),l=X(t.titleFont),u=X(t.footerFont),d=a.length,f=i.length,p=r.length,m=Y(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,B(e.title,y),n.font=c.string,B(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,B(r,e=>{B(e.before,y),B(e.lines,y),B(e.after,y)}),v=0,n.font=u.string,B(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function Oc(e,t){let{y:n,height:r}=t;return ne.height-r/2?`bottom`:`center`}function kc(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function Ac(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),kc(l,e,t,n)&&(l=`center`),l}function jc(e,t,n){let r=n.yAlign||t.yAlign||Oc(e,n);return{xAlign:n.xAlign||t.xAlign||Ac(e,t,n,r),yAlign:r}}function Mc(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function Nc(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:t===`bottom`?r-=i+n:r-=i/2,r}function Pc(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=dn(o),m=Mc(t,s),h=Nc(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:G(m,0,r.width-t.width),y:G(h,0,r.height-t.height)}}function Fc(e,t,n){let r=Y(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function Ic(e){return wc([],Tc(e))}function Lc(e,t,n){return mn(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function Rc(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var zc={beforeTitle:ge,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex{let t={before:[],lines:[],after:[]},i=Rc(n,e);wc(t.before,Tc(Bc(i,`beforeLabel`,this,e))),wc(t.lines,Bc(i,`label`,this,e)),wc(t.after,Tc(Bc(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return Ic(Bc(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Bc(n,`beforeFooter`,this,e),i=Bc(n,`footer`,this,e),a=Bc(n,`afterFooter`,this,e),o=[];return o=wc(o,Tc(r)),o=wc(o,Tc(i)),o=wc(o,Tc(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;se.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),B(o,t=>{let n=Rc(e.callbacks,t);r.push(Bc(n,`labelColor`,this,t)),i.push(Bc(n,`labelPointStyle`,this,t)),a.push(Bc(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=Cc[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=Dc(this,n),o=Object.assign({},e,t),s=jc(this.chart,n,o),c=Pc(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=dn(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=dr(n.rtl,this.x,this.width);for(e.x=Fc(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=X(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;se!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,rn(e,{x:t,y:p,w:c,h:s,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),rn(e,{x:n,y:p+1,w:c-2,h:s-2,radius:o}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(t,p,c,s),e.strokeRect(t,p,c,s),e.fillStyle=a.backgroundColor,e.fillRect(n,p+1,c-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=X(n.bodyFont),d=u.lineHeight,f=0,p=dr(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=Fc(this,h,n),t.fillStyle=n.bodyColor,B(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=Cc[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=Dc(this,e),o=Object.assign({},n,this._size),s=jc(t,e,o),c=Pc(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=Y(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),fr(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),pr(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!be(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!be(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=Cc[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}};n(Vc,`positioners`,Cc);var Hc=Object.freeze({__proto__:null,Colors:Ts,Decimation:js,Filler:cc,Legend:_c,SubTitle:Sc,Title:bc,Tooltip:{id:`tooltip`,_element:Vc,positioners:Cc,afterInit(e,t,n){n&&(e.tooltip=new Vc({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:`average`,backgroundColor:`rgba(0,0,0,0.8)`,titleColor:`#fff`,titleFont:{weight:`bold`},titleSpacing:2,titleMarginBottom:6,titleAlign:`left`,bodyColor:`#fff`,bodySpacing:2,bodyFont:{},bodyAlign:`left`,footerColor:`#fff`,footerSpacing:2,footerMarginTop:6,footerFont:{weight:`bold`},footerAlign:`left`,padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:`#fff`,displayColors:!0,boxPadding:0,borderColor:`rgba(0,0,0,0)`,borderWidth:0,animation:{duration:400,easing:`easeOutQuart`},animations:{numbers:{type:`number`,properties:[`x`,`y`,`width`,`height`,`caretX`,`caretY`]},opacity:{easing:`linear`,duration:200}},callbacks:zc},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]}}),Uc=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Wc(e,t,n,r){let i=e.indexOf(t);return i===-1?Uc(e,t,n,r):i===e.lastIndexOf(t)?i:n}var Gc=(e,t)=>e===null?null:G(Math.round(e),0,t);function Kc(e){let t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};n(qc,`id`,`category`),n(qc,`defaults`,{ticks:{callback:Kc}});function Jc(e,t){let n=[],{bounds:r,step:i,min:a,max:o,precision:s,count:c,maxTicks:l,maxDigits:u,includeBounds:d}=e,f=i||1,p=l-1,{min:m,max:h}=t,g=!N(a),_=!N(o),v=!N(c),y=(h-m)/(u+1),b=We((h-m)/p/f)*f,x,S,C,w;if(b<1e-14&&!g&&!_)return[{value:m},{value:h}];w=Math.ceil(h/b)-Math.floor(m/b),w>p&&(b=We(w*b/p/f)*f),N(s)||(x=10**s,b=Math.ceil(b*x)/x),r===`ticks`?(S=Math.floor(m/b)*b,C=Math.ceil(h/b)*b):(S=m,C=h),g&&_&&i&&Je((o-a)/i,b/1e3)?(w=Math.round(Math.min((o-a)/b,l)),b=(o-a)/w,S=a,C=o):v?(S=g?a:S,C=_?o:C,w=c-1,b=(C-S)/w):(w=(C-S)/b,w=Ue(w,Math.round(w),b/1e3)?Math.round(w):Math.ceil(w));let T=Math.max(Qe(b),Qe(S));x=10**(N(s)?T:s),S=Math.round(S*x)/x,C=Math.round(C*x)/x;let E=0;for(g&&(d&&S!==a?(n.push({value:a}),So)break;n.push({value:e})}return _&&d&&C!==o?n.length&&Ue(n[n.length-1].value,o,Yc(o,y,e))?n[n.length-1].value=o:n.push({value:o}):(!_||C===o)&&n.push({value:C}),n}function Yc(e,t,{horizontal:n,minRotation:r}){let i=Xe(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}var Xc=class extends Ha{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return N(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=He(r),t=He(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=Jc({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&Ye(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return Mt(e,this.chart.options.locale,this.options.ticks.format)}},Zc=class extends Xc{determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=I(e)?e:0,this.max=I(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=Xe(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}};n(Zc,`id`,`linear`),n(Zc,`defaults`,{ticks:{callback:Ft.formatters.numeric}});var Qc=e=>Math.floor(Ve(e)),$c=(e,t)=>10**(Qc(e)+t);function el(e){return e/10**Qc(e)==1}function tl(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function nl(e,t){let n=Qc(t-e);for(;tl(e,t,n)>10;)n++;for(;tl(e,t,n)<10;)n--;return Math.min(n,Qc(e))}function rl(e,{min:t,max:n}){t=L(e.min,t);let r=[],i=Qc(t),a=nl(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=L(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=L(e.max,f);return r.push({value:p,major:el(p),significand:d}),r}var il=class extends Ha{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=Xc.prototype.parse.apply(this,[e,t]);if(n===0){this._zero=!0;return}return I(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=I(e)?Math.max(0,e):null,this.max=I(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!I(this._userMin)&&(this.min=e===$c(this.min,0)?$c(this.min,-1):$c(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i($c(n,-1)),a($c(r,1)))),n<=0&&i($c(r,-1)),r<=0&&a($c(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=rl({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&Ye(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:Mt(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=Ve(e),this._valueRange=Ve(this.max)-Ve(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Ve(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}};n(il,`id`,`logarithmic`),n(il,`defaults`,{ticks:{callback:Ft.formatters.logarithmic,major:{enabled:!0}}});function al(e){let t=e.ticks;if(t.display&&e.display){let e=Y(t.backdropPadding);return R(t.font&&t.font.size,J.font.size)+e.height}return 0}function ol(e,t,n){return n=P(n)?n:[n],{w:Ut(e,t.string,n),h:n.length*t.lineHeight}}function sl(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:ei?{start:t-n,end:t}:{start:t,end:t+n}}function cl(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?V/a:0;for(let c=0;ct.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.startt.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function ul(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(Ze(W(c.angle+U))),u=hl(c.y,s.h,l),d=pl(l),f=ml(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function dl(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(Jt({x:n,y:r},t)||Jt({x:n,y:a},t)||Jt({x:i,y:r},t)||Jt({x:i,y:a},t))}function fl(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:al(a)/2,additionalAngle:o?V/i:0},l;for(let a=0;a270||n<90)&&(e-=t),e}function gl(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!N(s)){let n=dn(t.borderRadius),c=Y(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),rn(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function _l(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));gl(n,a,t);let o=X(a.font),{x:s,y:c,textAlign:l}=t;nn(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function vl(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,H);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a{let n=z(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?cl(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=H/(this._pointLabels.length||1),n=this.options.startAngle||0;return W(e*t+Xe(n))}getDistanceFromCenterForValue(e){if(N(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(N(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);yl(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;!a||!i||(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=X(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=Y(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}nn(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}};n(xl,`id`,`radialLinear`),n(xl,`defaults`,{display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ft.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),n(xl,`defaultRoutes`,{"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`}),n(xl,`descriptors`,{angleLines:{_fallback:`grid`}});var Sl={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Cl=Object.keys(Sl);function wl(e,t){return e-t}function Tl(e,t){if(N(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),I(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(qe(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function El(e,t,n,r){let i=Cl.length;for(let a=Cl.indexOf(e);a=Cl.indexOf(n);a--){let n=Cl[a];if(Sl[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return Cl[n?Cl.indexOf(n):0]}function Ol(e){for(let t=Cl.indexOf(e)+1,n=Cl.length;t=t?n[r]:n[i];e[a]=!0}}function Al(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function jl(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=G(t,0,a),n=G(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||El(i.minUnit,t,n,this._getLabelCapacity(t)),o=R(r.ticks.stepSize,1),s=a===`week`?i.isoWeekday:!1,c=qe(s)||s===!0,l={},u=t,d,f;if(c&&(u=+e.startOf(u,`isoWeek`,s)),u=+e.startOf(u,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let p=r.ticks.source===`data`&&this.getDataTimestamps();for(d=u,f=0;d+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return z(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=K(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=K(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}var Pl=class extends Ml{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=Nl(t,this.min),this._tableRange=Nl(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;ae-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(Nl(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return Nl(this._table,n*this._tableRange+this._minPos,!0)}};n(Pl,`id`,`timeseries`),n(Pl,`defaults`,Ml.defaults);var Fl=[Ti,ps,Hc,Object.freeze({__proto__:null,CategoryScale:qc,LinearScale:Zc,LogarithmicScale:il,RadialLinearScale:xl,TimeScale:Ml,TimeSeriesScale:Pl})];jo.register(...Fl);var Il=jo,Ll=t(((e,t)=>{function n(e){"@babel/helpers - typeof";return t.exports=n=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},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Rl=t(((e,t)=>{var n=Ll().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),zl=t(((e,t)=>{var n=Ll().default,r=Rl();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),Bl=t(((e,t)=>{var n=zl();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),Vl=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n[`@kurkle/color`]=r())})(e,(function(){function e(e){return e+.5|0}let t=(e,t,n)=>Math.max(Math.min(e,n),t);function n(n){return t(e(n*2.55),0,255)}function r(n){return t(e(n/2.55),0,100)}function i(n){return t(e(n*255),0,255)}function a(n){return t(e(n/2.55)/100,0,1)}function o(n){return t(e(n*100),0,100)}let s={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},c=[...`0123456789ABCDEF`],l=e=>c[e&15],u=e=>c[(e&240)>>4]+c[e&15],d=e=>(e&240)>>4==(e&15),f=e=>d(e.r)&&d(e.g)&&d(e.b)&&d(e.a);function p(e){var t=e.length,n;return e[0]===`#`&&(t===4||t===5?n={r:255&s[e[1]]*17,g:255&s[e[2]]*17,b:255&s[e[3]]*17,a:t===5?s[e[4]]*17:255}:(t===7||t===9)&&(n={r:s[e[1]]<<4|s[e[2]],g:s[e[3]]<<4|s[e[4]],b:s[e[5]]<<4|s[e[6]],a:t===9?s[e[7]]<<4|s[e[8]]:255})),n}let m=(e,t)=>e<255?t(e):``;function h(e){var t=f(e)?l:u;return e?`#`+t(e.r)+t(e.g)+t(e.b)+m(e.a,t):void 0}let g=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function _(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function v(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function y(e,t,n){let r=_(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function b(e,t,n,r,i){return e===i?(t-n)/r+(t.5?l/(2-i-a):l/(i+a),s=b(t,n,r,l,i),s=s*60+.5),[s|0,c||0,o]}function S(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(i)}function C(e,t,n){return S(_,e,t,n)}function w(e,t,n){return S(y,e,t,n)}function T(e,t,n){return S(v,e,t,n)}function E(e){return(e%360+360)%360}function D(e){let t=g.exec(e),r=255,a;if(!t)return;t[5]!==a&&(r=t[6]?n(+t[5]):i(+t[5]));let o=E(+t[2]),s=t[3]/100,c=t[4]/100;return a=t[1]===`hwb`?w(o,s,c):t[1]===`hsv`?T(o,s,c):C(o,s,c),{r:a[0],g:a[1],b:a[2],a:r}}function O(e,t){var n=x(e);n[0]=E(n[0]+t),n=C(n),e.r=n[0],e.g=n[1],e.b=n[2]}function k(e){if(!e)return;let t=x(e),n=t[0],r=o(t[1]),i=o(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${a(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}let A={x:`dark`,Z:`light`,Y:`re`,X:`blu`,W:`gr`,V:`medium`,U:`slate`,A:`ee`,T:`ol`,S:`or`,B:`ra`,C:`lateg`,D:`ights`,R:`in`,Q:`turquois`,E:`hi`,P:`ro`,O:`al`,N:`le`,M:`de`,L:`yello`,F:`en`,K:`ch`,G:`arks`,H:`ea`,I:`ightg`,J:`wh`},j={OiceXe:`f0f8ff`,antiquewEte:`faebd7`,aqua:`ffff`,aquamarRe:`7fffd4`,azuY:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`0`,blanKedOmond:`ffebcd`,Xe:`ff`,XeviTet:`8a2be2`,bPwn:`a52a2a`,burlywood:`deb887`,caMtXe:`5f9ea0`,KartYuse:`7fff00`,KocTate:`d2691e`,cSO:`ff7f50`,cSnflowerXe:`6495ed`,cSnsilk:`fff8dc`,crimson:`dc143c`,cyan:`ffff`,xXe:`8b`,xcyan:`8b8b`,xgTMnPd:`b8860b`,xWay:`a9a9a9`,xgYF:`6400`,xgYy:`a9a9a9`,xkhaki:`bdb76b`,xmagFta:`8b008b`,xTivegYF:`556b2f`,xSange:`ff8c00`,xScEd:`9932cc`,xYd:`8b0000`,xsOmon:`e9967a`,xsHgYF:`8fbc8f`,xUXe:`483d8b`,xUWay:`2f4f4f`,xUgYy:`2f4f4f`,xQe:`ced1`,xviTet:`9400d3`,dAppRk:`ff1493`,dApskyXe:`bfff`,dimWay:`696969`,dimgYy:`696969`,dodgerXe:`1e90ff`,fiYbrick:`b22222`,flSOwEte:`fffaf0`,foYstWAn:`228b22`,fuKsia:`ff00ff`,gaRsbSo:`dcdcdc`,ghostwEte:`f8f8ff`,gTd:`ffd700`,gTMnPd:`daa520`,Way:`808080`,gYF:`8000`,gYFLw:`adff2f`,gYy:`808080`,honeyMw:`f0fff0`,hotpRk:`ff69b4`,RdianYd:`cd5c5c`,Rdigo:`4b0082`,ivSy:`fffff0`,khaki:`f0e68c`,lavFMr:`e6e6fa`,lavFMrXsh:`fff0f5`,lawngYF:`7cfc00`,NmoncEffon:`fffacd`,ZXe:`add8e6`,ZcSO:`f08080`,Zcyan:`e0ffff`,ZgTMnPdLw:`fafad2`,ZWay:`d3d3d3`,ZgYF:`90ee90`,ZgYy:`d3d3d3`,ZpRk:`ffb6c1`,ZsOmon:`ffa07a`,ZsHgYF:`20b2aa`,ZskyXe:`87cefa`,ZUWay:`778899`,ZUgYy:`778899`,ZstAlXe:`b0c4de`,ZLw:`ffffe0`,lime:`ff00`,limegYF:`32cd32`,lRF:`faf0e6`,magFta:`ff00ff`,maPon:`800000`,VaquamarRe:`66cdaa`,VXe:`cd`,VScEd:`ba55d3`,VpurpN:`9370db`,VsHgYF:`3cb371`,VUXe:`7b68ee`,VsprRggYF:`fa9a`,VQe:`48d1cc`,VviTetYd:`c71585`,midnightXe:`191970`,mRtcYam:`f5fffa`,mistyPse:`ffe4e1`,moccasR:`ffe4b5`,navajowEte:`ffdead`,navy:`80`,Tdlace:`fdf5e6`,Tive:`808000`,TivedBb:`6b8e23`,Sange:`ffa500`,SangeYd:`ff4500`,ScEd:`da70d6`,pOegTMnPd:`eee8aa`,pOegYF:`98fb98`,pOeQe:`afeeee`,pOeviTetYd:`db7093`,papayawEp:`ffefd5`,pHKpuff:`ffdab9`,peru:`cd853f`,pRk:`ffc0cb`,plum:`dda0dd`,powMrXe:`b0e0e6`,purpN:`800080`,YbeccapurpN:`663399`,Yd:`ff0000`,Psybrown:`bc8f8f`,PyOXe:`4169e1`,saddNbPwn:`8b4513`,sOmon:`fa8072`,sandybPwn:`f4a460`,sHgYF:`2e8b57`,sHshell:`fff5ee`,siFna:`a0522d`,silver:`c0c0c0`,skyXe:`87ceeb`,UXe:`6a5acd`,UWay:`708090`,UgYy:`708090`,snow:`fffafa`,sprRggYF:`ff7f`,stAlXe:`4682b4`,tan:`d2b48c`,teO:`8080`,tEstN:`d8bfd8`,tomato:`ff6347`,Qe:`40e0d0`,viTet:`ee82ee`,JHt:`f5deb3`,wEte:`ffffff`,wEtesmoke:`f5f5f5`,Lw:`ffff00`,LwgYF:`9acd32`};function ee(){let e={},t=Object.keys(j),n=Object.keys(A),r,i,a,o,s;for(r=0;r>16&255,a>>8&255,a&255]}return e}let te;function ne(e){te||(te=ee(),te.transparent=[0,0,0,0]);let t=te[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}let re=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function M(e){let r=re.exec(e),i=255,a,o,s;if(r){if(r[7]!==a){let e=+r[7];i=r[8]?n(e):t(e*255,0,255)}return a=+r[1],o=+r[3],s=+r[5],a=255&(r[2]?n(a):t(a,0,255)),o=255&(r[4]?n(o):t(o,0,255)),s=255&(r[6]?n(s):t(s,0,255)),{r:a,g:o,b:s,a:i}}}function ie(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${a(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}let ae=e=>e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055,oe=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;function se(e,t,n){let r=oe(a(e.r)),o=oe(a(e.g)),s=oe(a(e.b));return{r:i(ae(r+n*(oe(a(t.r))-r))),g:i(ae(o+n*(oe(a(t.g))-o))),b:i(ae(s+n*(oe(a(t.b))-s))),a:e.a+n*(t.a-e.a)}}function ce(e,t,n){if(e){let r=x(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=C(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function le(e,t){return e&&Object.assign(t||{},e)}function ue(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=i(e[3]))):(t=le(e,{r:0,g:0,b:0,a:1}),t.a=i(t.a)),t}function de(e){return e.charAt(0)===`r`?M(e):D(e)}class fe{constructor(e){if(e instanceof fe)return e;let t=typeof e,n;t===`object`?n=ue(e):t===`string`&&(n=p(e)||ne(e)||de(e)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var e=le(this._rgb);return e&&(e.a=a(e.a)),e}set rgb(e){this._rgb=ue(e)}rgbString(){return this._valid?ie(this._rgb):void 0}hexString(){return this._valid?h(this._rgb):void 0}hslString(){return this._valid?k(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,i,a=t===i?.5:t,o=2*a-1,s=n.a-r.a,c=((o*s===-1?o:(o+s)/(1+o*s))+1)/2;i=1-c,n.r=255&c*n.r+i*r.r+.5,n.g=255&c*n.g+i*r.g+.5,n.b=255&c*n.b+i*r.b+.5,n.a=a*n.a+(1-a)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=se(this._rgb,e._rgb,t)),this}clone(){return new fe(this.rgb)}alpha(e){return this._rgb.a=i(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let t=this._rgb;return t.r=t.g=t.b=e(t.r*.3+t.g*.59+t.b*.11),this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return ce(this._rgb,2,e),this}darken(e){return ce(this._rgb,2,-e),this}saturate(e){return ce(this._rgb,1,e),this}desaturate(e){return ce(this._rgb,1,-e),this}rotate(e){return O(this._rgb,e),this}}function pe(e){return new fe(e)}return Object.assign(pe,Object.freeze({__proto__:null,Color:fe,b2n:a,b2p:r,default:pe,hexParse:p,hexString:h,hsl2rgb:C,hslString:k,hsv2rgb:T,hueParse:D,hwb2rgb:w,lim:t,n2b:i,n2p:o,nameParse:ne,p2b:n,rgb2hsl:x,rgbParse:M,rgbString:ie,rotate:O,round:e}))}))})),Hl=t((e=>{var t=Vl();function n(){}var r=(()=>{let e=0;return()=>e++})();function i(e){return e==null}function a(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)===`[object`&&t.slice(-6)===`Array]`}function o(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function s(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function c(e,t){return s(e)?e:t}function l(e,t){return e===void 0?t:e}var u=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100:+e/t,d=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*t:+e;function f(e,t,n){if(e&&typeof e.call==`function`)return e.apply(n,t)}function p(e,t,n,r){let i,s,c;if(a(e))if(s=e.length,r)for(i=s-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;ie,x:e=>e.x,y:e=>e.y};function C(e){let t=e.split(`.`),n=[],r=``;for(let e of t)r+=e,r.endsWith(`\\`)?r=r.slice(0,-1)+`.`:(n.push(r),r=``);return n}function w(e){let t=C(e);return e=>{for(let n of t){if(n===``)break;e=e&&e[n]}return e}}function T(e,t){return(S[t]||(S[t]=w(t)))(e)}function E(e){return e.charAt(0).toUpperCase()+e.slice(1)}var D=e=>e!==void 0,O=e=>typeof e==`function`,k=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function A(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var j=Math.PI,ee=2*j,te=ee+j,ne=1/0,re=j/180,M=j/2,ie=j/4,ae=j*2/3,oe=Math.log10,se=Math.sign;function ce(e,t,n){return Math.abs(e-t)e-t).pop(),t}function de(e){return typeof e==`symbol`||typeof e==`object`&&!!e&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function fe(e){return!de(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function pe(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function me(e,t,n){let r,i,a;for(r=0,i=e.length;rc&&l=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function z(e,t,n){n=n||(n=>e[n]1;)a=i+r>>1,n(a)?i=a:r=a;return{lo:i,hi:r}}var B=(e,t,n,r)=>z(e,n,r?r=>{let i=e[r][t];return ie[r][t]z(e,n,r=>e[r][t]>=n);function xe(e,t,n){let r=0,i=e.length;for(;rr&&e[i-1]>n;)i--;return r>0||i{let n=`_onData`+E(t),r=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let i=r.apply(this,t);return e._chartjs.listeners.forEach(e=>{typeof e[n]==`function`&&e[n](...t)}),i}})})}function we(e,t){let n=e._chartjs;if(!n)return;let r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(Se.forEach(t=>{delete e[t]}),delete e._chartjs)}function Te(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}function Ee(e,t,n){return t+` `+e+`px `+n}var De=function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame}();function Oe(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,De.call(window,()=>{r=!1,e.apply(t,n)}))}}function ke(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}var Ae=e=>e===`start`?`left`:e===`end`?`right`:`center`,je=(e,t,n)=>e===`start`?t:e===`end`?n:(t+n)/2,Me=(e,t,n,r)=>e===(r?`left`:`right`)?n:e===`center`?(t+n)/2:t;function Ne(e,t,n){let r=t.length,a=0,o=r;if(e._sorted){let{iScale:s,vScale:c,_parsed:l}=e,u=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,d=s.axis,{min:f,max:p,minDefined:m,maxDefined:h}=s.getUserBounds();if(m){if(a=Math.min(B(l,d,f).lo,n?r:B(t,d,s.getPixelForValue(f)).lo),u){let e=l.slice(0,a+1).reverse().findIndex(e=>!i(e[c.axis]));a-=Math.max(0,e)}a=R(a,0,r-1)}if(h){let e=Math.max(B(l,s.axis,p,!0).hi+1,n?0:B(t,d,s.getPixelForValue(p),!0).hi+1);if(u){let t=l.slice(e-1).findIndex(e=>!i(e[c.axis]));e+=Math.max(0,t)}o=R(e,a,r)-a}else o=r-a}return{start:a,count:o}}function Pe(e){let{xScale:t,yScale:n,_scaleRanges:r}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=i,!0;let a=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,i),a}var Fe=e=>e===0||e===1,V=(e,t,n)=>-(2**(10*--e)*Math.sin((e-t)*ee/n)),H=(e,t,n)=>2**(-10*e)*Math.sin((e-t)*ee/n)+1,Ie={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-(--e*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>--e*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*M)+1,easeOutSine:e=>Math.sin(e*M),easeInOutSine:e=>-.5*(Math.cos(j*e)-1),easeInExpo:e=>e===0?0:2**(10*(e-1)),easeOutExpo:e=>e===1?1:-(2**(-10*e))+1,easeInOutExpo:e=>Fe(e)?e:e<.5?.5*2**(10*(e*2-1)):.5*(-(2**(-10*(e*2-1)))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1- --e*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Fe(e)?e:V(e,.075,.3),easeOutElastic:e=>Fe(e)?e:H(e,.075,.3),easeInOutElastic(e){let t=.1125,n=.45;return Fe(e)?e:e<.5?.5*V(e*2,t,n):.5+.5*H(e*2-1,t,n)},easeInBack(e){return e*e*(2.70158*e-1.70158)},easeOutBack(e){return--e*e*(2.70158*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Ie.easeOutBounce(1-e),easeOutBounce(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?Ie.easeInBounce(e*2)*.5:Ie.easeOutBounce(e*2-1)*.5+.5};function Le(e){if(e&&typeof e==`object`){let t=e.toString();return t===`[object CanvasPattern]`||t===`[object CanvasGradient]`}return!1}function Re(e){return Le(e)?e:new t.Color(e)}function U(e){return Le(e)?e:new t.Color(e).saturate(.5).darken(.1).hexString()}var ze=[`x`,`y`,`borderWidth`,`radius`,`tension`],Be=[`color`,`borderColor`,`backgroundColor`];function Ve(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:e=>e!==`onProgress`&&e!==`onComplete`&&e!==`fn`}),e.set(`animations`,{colors:{type:`color`,properties:Be},numbers:{type:`number`,properties:ze}}),e.describe(`animations`,{_fallback:`animation`}),e.set(`transitions`,{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:`transparent`},visible:{type:`boolean`,duration:0}}},hide:{animations:{colors:{to:`transparent`},visible:{type:`boolean`,easing:`linear`,fn:e=>e|0}}}})}function He(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Ue=new Map;function We(e,t){t=t||{};let n=e+JSON.stringify(t),r=Ue.get(n);return r||(r=new Intl.NumberFormat(e,t),Ue.set(n,r)),r}function Ge(e,t,n){return We(t,n).format(e)}var Ke={values(e){return a(e)?e:``+e},numeric(e,t,n){if(e===0)return`0`;let r=this.chart.options.locale,i,a=e;if(n.length>1){let t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>0x38d7ea4c68000)&&(i=`scientific`),a=qe(e,n)}let o=oe(Math.abs(a)),s=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:i,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(c,this.options.ticks.format),Ge(e,r,c)},logarithmic(e,t,n){if(e===0)return`0`;let r=n[t].significand||e/10**Math.floor(oe(e));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Ke.numeric.call(this,e,t,n):``}};function qe(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Je={formatters:Ke};function Ye(e){e.set(`scale`,{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:`ticks`,clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:``,padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:``,padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Je.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:e=>!e.startsWith(`before`)&&!e.startsWith(`after`)&&e!==`callback`&&e!==`parser`,_indexable:e=>e!==`borderDash`&&e!==`tickBorderDash`&&e!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:e=>e!==`backdropPadding`&&e!==`callback`,_indexable:e=>e!==`backdropPadding`})}var Xe=Object.create(null),Ze=Object.create(null);function Qe(e,t){if(!t)return e;let n=t.split(`.`);for(let t=0,r=n.length;te.chart.platform.getDevicePixelRatio(),this.elements={},this.events=[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`],this.font={family:`'Helvetica Neue', 'Helvetica', 'Arial', sans-serif`,size:12,style:`normal`,lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,t)=>U(t.backgroundColor),this.hoverBorderColor=(e,t)=>U(t.borderColor),this.hoverColor=(e,t)=>U(t.color),this.indexAxis=`x`,this.interaction={mode:`nearest`,intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return $e(this,e,t)}get(e){return Qe(this,e)}describe(e,t){return $e(Ze,e,t)}override(e,t){return $e(Xe,e,t)}route(e,t,n,r){let i=Qe(this,e),a=Qe(this,n),s=`_`+t;Object.defineProperties(i,{[s]:{value:i[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[s],t=a[r];return o(e)?Object.assign({},t,e):l(e,t)},set(e){this[s]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[Ve,He,Ye]);function tt(e){return!e||i(e.size)||i(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function W(e,t,n,r,i){let a=t[i];return a||(a=t[i]=e.measureText(i).width,n.push(i)),a>r&&(r=a),r}function nt(e,t,n,r){r=r||{};let i=r.data=r.data||{},o=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},o=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let s=0,c=n.length,l,u,d,f,p;for(l=0;ln.length){for(l=0;l0&&e.stroke()}}function K(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&s.strokeColor!==``,u,d;for(e.save(),e.font=o.string,ut(e,s),u=0;u+e||0;function vt(e,t){let n={},r=o(t),i=r?Object.keys(t):t,a=o(e)?r?n=>l(e[n],e[t[n]]):t=>e[t]:()=>e;for(let e of i)n[e]=_t(a(e));return n}function yt(e){return vt(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function bt(e){return vt(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function xt(e){let t=yt(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function St(e,t){e=e||{},t=t||et.font;let n=l(e.size,t.size);typeof n==`string`&&(n=parseInt(n,10));let r=l(e.style,t.style);r&&!(``+r).match(q)&&(console.warn(`Invalid font style specified: "`+r+`"`),r=void 0);let i={family:l(e.family,t.family),lineHeight:gt(l(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:l(e.weight,t.weight),string:``};return i.string=tt(i),i}function Ct(e,t,n,r){let i=!0,o,s,c;for(o=0,s=e.length;on&&e===0?0:e+t;return{min:o(r,-Math.abs(a)),max:o(i,a)}}function Tt(e,t){return Object.assign(Object.create(e),t)}function Et(e,t=[``],n,r,i=()=>e[0]){let a=n||e;return r===void 0&&(r=Vt(`_fallback`,e)),new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:i,override:n=>Et([n,...e],t,a,r)},{deleteProperty(t,n){return delete t[n],delete t._keys,delete e[0][n],!0},get(n,r){return jt(n,r,()=>J(r,t,e,n))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return Ht(e).includes(t)},ownKeys(e){return Ht(e)},set(e,t,n){let r=e._storage||(e._storage=i());return e[t]=r[t]=n,delete e._keys,!0}})}function Dt(e,t,n,r){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Ot(e,r),setContext:t=>Dt(e,t,n,r),override:i=>Dt(e.override(i),t,n,r)};return new Proxy(i,{deleteProperty(t,n){return delete t[n],delete e[n],!0},get(e,t,n){return jt(e,t,()=>Mt(e,t,n))},getOwnPropertyDescriptor(t,n){return t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(t,n,r){return e[n]=r,delete t[n],!0}})}function Ot(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:O(n)?n:()=>n,isIndexable:O(r)?r:()=>r}}var kt=(e,t)=>e?e+E(t):t,At=(e,t)=>o(t)&&e!==`adapters`&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function jt(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t===`constructor`)return e[t];let r=n();return e[t]=r,r}function Mt(e,t,n){let{_proxy:r,_context:i,_subProxy:o,_descriptors:s}=e,c=r[t];return O(c)&&s.isScriptable(t)&&(c=Nt(t,c,e,n)),a(c)&&c.length&&(c=Pt(t,c,e,s.isIndexable)),At(t,c)&&(c=Dt(c,i,o&&o[t],s)),c}function Nt(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_stack:s}=n;if(s.has(e))throw Error(`Recursion detected: `+Array.from(s).join(`->`)+`->`+e);s.add(e);let c=t(a,o||r);return s.delete(e),At(e,c)&&(c=Rt(i._scopes,i,e,c)),c}function Pt(e,t,n,r){let{_proxy:i,_context:a,_subProxy:s,_descriptors:c}=n;if(a.index!==void 0&&r(e))return t[a.index%t.length];if(o(t[0])){let n=t,r=i._scopes.filter(e=>e!==n);t=[];for(let o of n){let n=Rt(r,i,e,o);t.push(Dt(n,a,s&&s[e],c))}}return t}function Ft(e,t,n){return O(e)?e(t,n):e}var It=(e,t)=>e===!0?t:typeof e==`string`?T(t,e):void 0;function Lt(e,t,n,r,i){for(let a of t){let t=It(n,a);if(t){e.add(t);let a=Ft(t._fallback,n,i);if(a!==void 0&&a!==n&&a!==r)return a}else if(t===!1&&r!==void 0&&n!==r)return null}return!1}function Rt(e,t,n,r){let i=t._rootScopes,a=Ft(t._fallback,n,r),o=[...e,...i],s=new Set;s.add(r);let c=zt(s,o,n,a||n,r);return c===null||a!==void 0&&a!==n&&(c=zt(s,o,a,c,r),c===null)?!1:Et(Array.from(s),[``],i,a,()=>Bt(t,n,r))}function zt(e,t,n,r,i){for(;n;)n=Lt(e,t,n,r,i);return n}function Bt(e,t,n){let r=e._getTarget();t in r||(r[t]={});let i=r[t];return a(i)&&o(n)?n:i||{}}function J(e,t,n,r){let i;for(let a of t)if(i=Vt(kt(a,e),n),i!==void 0)return At(e,i)?Rt(n,r,e,i):i}function Vt(e,t){for(let n of t){if(!n)continue;let t=n[e];if(t!==void 0)return t}}function Ht(e){let t=e._keys;return t||(t=e._keys=Ut(e._scopes)),t}function Ut(e){let t=new Set;for(let n of e)for(let e of Object.keys(n).filter(e=>!e.startsWith(`_`)))t.add(e);return Array.from(t)}function Wt(e,t,n,r){let{iScale:i}=e,{key:a=`r`}=this._parsing,o=Array(r),s,c,l,u;for(s=0,c=r;ste===`x`?`y`:`x`;function Jt(e,t,n,r){let i=e.skip?t:e,a=t,o=n.skip?t:n,s=P(a,i),c=P(o,a),l=s/(s+c),u=c/(s+c);l=isNaN(l)?0:l,u=isNaN(u)?0:u;let d=r*l,f=r*u;return{previous:{x:a.x-d*(o.x-i.x),y:a.y-d*(o.y-i.y)},next:{x:a.x+f*(o.x-i.x),y:a.y+f*(o.y-i.y)}}}function Yt(e,t,n){let r=e.length,i,a,o,s,c,l=Kt(e,0);for(let u=0;u!e.skip)),t.cubicInterpolationMode===`monotone`)Zt(e,i);else{let n=r?e[e.length-1]:e[0];for(a=0,o=e.length;ae.ownerDocument.defaultView.getComputedStyle(e,null);function on(e,t){return an(e).getPropertyValue(t)}var sn=[`top`,`right`,`bottom`,`left`];function cn(e,t,n){let r={};n=n?`-`+n:``;for(let i=0;i<4;i++){let a=sn[i];r[a]=parseFloat(e[t+`-`+a+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}var ln=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function un(e,t){let n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:a}=r,o=!1,s,c;if(ln(i,a,e.target))s=i,c=a;else{let e=t.getBoundingClientRect();s=r.clientX-e.left,c=r.clientY-e.top,o=!0}return{x:s,y:c,box:o}}function dn(e,t){if(`native`in e)return e;let{canvas:n,currentDevicePixelRatio:r}=t,i=an(n),a=i.boxSizing===`border-box`,o=cn(i,`padding`),s=cn(i,`border`,`width`),{x:c,y:l,box:u}=un(e,n),d=o.left+(u&&s.left),f=o.top+(u&&s.top),{width:p,height:m}=t;return a&&(p-=o.width+s.width,m-=o.height+s.height),{x:Math.round((c-d)/p*n.width/r),y:Math.round((l-f)/m*n.height/r)}}function Y(e,t,n){let r,i;if(t===void 0||n===void 0){let a=e&&nn(e);if(!a)t=e.clientWidth,n=e.clientHeight;else{let e=a.getBoundingClientRect(),o=an(a),s=cn(o,`border`,`width`),c=cn(o,`padding`);t=e.width-c.width-s.width,n=e.height-c.height-s.height,r=rn(o.maxWidth,a,`clientWidth`),i=rn(o.maxHeight,a,`clientHeight`)}}return{width:t,height:n,maxWidth:r||ne,maxHeight:i||ne}}var X=e=>Math.round(e*10)/10;function fn(e,t,n,r){let i=an(e),a=cn(i,`margin`),o=rn(i.maxWidth,e,`clientWidth`)||ne,s=rn(i.maxHeight,e,`clientHeight`)||ne,c=Y(e,t,n),{width:l,height:u}=c;if(i.boxSizing===`content-box`){let e=cn(i,`border`,`width`),t=cn(i,`padding`);l-=t.width+e.width,u-=t.height+e.height}return l=Math.max(0,l-a.width),u=Math.max(0,r?l/r:u-a.height),l=X(Math.min(l,o,c.maxWidth)),u=X(Math.min(u,s,c.maxHeight)),l&&!u&&(u=X(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=X(Math.floor(u*r))),{width:l,height:u}}function pn(e,t,n){let r=t||1,i=X(e.height*r),a=X(e.width*r);e.height=X(e.height),e.width=X(e.width);let o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||o.height!==i||o.width!==a?(e.currentDevicePixelRatio=r,o.height=i,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}var mn=function(){let e=!1;try{let t={get passive(){return e=!0,!1}};tn()&&(window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t))}catch{}return e}();function hn(e,t){let n=on(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function Z(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function gn(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r===`middle`?n<.5?e.y:t.y:r===`after`?n<1?e.y:t.y:n>0?t.y:e.y}}function _n(e,t,n,r){let i={x:e.cp2x,y:e.cp2y},a={x:t.cp1x,y:t.cp1y},o=Z(e,i,n),s=Z(i,a,n),c=Z(a,t,n);return Z(Z(o,s,n),Z(s,c,n),n)}var vn=function(e,t){return{x(n){return e+e+t-n},setWidth(e){t=e},textAlign(e){return e===`center`?e:e===`right`?`left`:`right`},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},yn=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function bn(e,t,n){return e?vn(t,n):yn()}function xn(e,t){let n,r;(t===`ltr`||t===`rtl`)&&(n=e.canvas.style,r=[n.getPropertyValue(`direction`),n.getPropertyPriority(`direction`)],n.setProperty(`direction`,t,`important`),e.prevTextDirection=r)}function Sn(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,t[0],t[1]))}function Cn(e){return e===`angle`?{between:L,compare:F,normalize:I}:{between:ye,compare:(e,t)=>e-t,normalize:e=>e}}function wn({start:e,end:t,count:n,loop:r,style:i}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:i}}function Tn(e,t,n){let{property:r,start:i,end:a}=n,{between:o,normalize:s}=Cn(r),c=t.length,{start:l,end:u,loop:d}=e,f,p;if(d){for(l+=c,u+=c,f=0,p=c;fc(i,y,_)&&s(i,y)!==0,x=()=>s(a,_)===0||c(a,y,_),S=()=>h||b(),C=()=>!h||x();for(let e=u,n=u;e<=d;++e)v=t[e%o],!v.skip&&(_=l(v[r]),_!==y&&(h=c(_,i,a),g===null&&S()&&(g=s(_,i)===0?e:n),g!==null&&C()&&(m.push(wn({start:g,end:e,loop:f,count:o,style:p})),g=null),n=e,y=_));return g!==null&&m.push(wn({start:g,end:d,loop:f,count:o,style:p})),m}function Dn(e,t){let n=[],r=e.segments;for(let i=0;ii&&e[a%t].skip;)a--;return a%=t,{start:i,end:a}}function kn(e,t,n,r){let i=e.length,a=[],o=t,s=e[t],c;for(c=t+1;c<=n;++c){let n=e[c%i];n.skip||n.stop?s.skip||(r=!1,a.push({start:t%i,end:(c-1)%i,loop:r}),t=o=n.stop?c:null):(o=c,s.skip&&(t=c)),s=n}return o!==null&&a.push({start:t%i,end:o%i,loop:r}),a}function An(e,t){let n=e.points,r=e.options.spanGaps,i=n.length;if(!i)return[];let a=!!e._loop,{start:o,end:s}=On(n,i,a,r);return r===!0?jn(e,[{start:o,end:s,loop:a}],n,t):jn(e,kn(n,o,s{var t=Bl(),n=Hl();Vl();var r=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){let i=t.listeners[r],a=t.duration;i.forEach(r=>r({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=n.requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}},i=`transparent`,a={boolean(e,t,n){return n>.5?t:e},color(e,t,r){let a=n.color(e||i),o=a.valid&&n.color(t||i);return o&&o.valid?o.mix(a,r).hexString():t},number(e,t,n){return e+(t-e)*n}},o=class{constructor(e,t,r,i){let o=t[r];i=n.resolve([e.to,i,o,e.from]);let s=n.resolve([e.from,o,i]);this._active=!0,this._fn=e.fn||a[e.type||typeof s],this._easing=n.effects[e.easing]||n.effects.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=r,this._from=s,this._to=i,this._promises=void 0}active(){return this._active}update(e,t,r){if(this._active){this._notify(!1);let i=this._target[this._prop],a=r-this._start,o=this._duration-a;this._start=r,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=a,this._loop=!!e.loop,this._to=n.resolve([e.to,t,i,e.from]),this._from=n.resolve([e.from,i,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}wait(){let e=this._promises||(this._promises=[]);return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e{let a=e[i];if(!n.isObject(a))return;let o={};for(let e of t)o[e]=a[e];(n.isArray(a.properties)&&a.properties||[i]).forEach(e=>{(e===i||!r.has(e))&&r.set(e,o)})})}_animateOptions(e,t){let n=t.options,r=l(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&c(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||(e.$animations={}),a=Object.keys(t),s=Date.now(),c;for(c=a.length-1;c>=0;--c){let l=a[c];if(l.charAt(0)===`$`)continue;if(l===`options`){r.push(...this._animateOptions(e,t));continue}let u=t[l],d=i[l],f=n.get(l);if(d)if(f&&d.active()){d.update(f,u,s);continue}else d.cancel();if(!f||!f.duration){e[l]=u;continue}i[l]=d=new o(f,e,l,u),r.push(d)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return r.add(this._chart,n),!0}};function c(e,t){let n=[],r=Object.keys(t);for(let t=0;t0||!n&&t<0)return i.index}return null}function x(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||(n._stacks={}),{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=_(a,o,r),d=t.length,f;for(let e=0;en[e].axis===t).shift()}function C(e,t){return n.createContext(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function w(e,t,r){return n.createContext(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:r,index:t,mode:`default`,type:`data`})}function T(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(let e of t){let t=e._stacks;if(!t||t[r]===void 0||t[r][n]===void 0)return;delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n]}}}var E=e=>e===`reset`||e===`none`,D=(e,t)=>t?e:Object.assign({},e),O=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:p(n,!0),values:null},k=class{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=g(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled(`filler`)&&console.warn(`Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options`)}updateIndex(e){this.index!==e&&T(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,r=this.getDataset(),i=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,a=t.xAxisID=n.valueOrDefault(r.xAxisID,S(e,`x`)),o=t.yAxisID=n.valueOrDefault(r.yAxisID,S(e,`y`)),s=t.rAxisID=n.valueOrDefault(r.rAxisID,S(e,`r`)),c=t.indexAxis,l=t.iAxisID=i(c,a,o,s),u=t.vAxisID=i(c,o,a,s);t.xScale=this.getScaleForId(a),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(s),t.iScale=this.getScaleForId(l),t.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&n.unlistenArrayEvents(this._data,this),e._stacked&&T(e)}_dataCheck(){let e=this.getDataset(),t=e.data||(e.data=[]),r=this._data;if(n.isObject(t)){let e=this._cachedMeta;this._data=h(t,e)}else if(r!==t){if(r){n.unlistenArrayEvents(r,this);let e=this._cachedMeta;T(e),e._parsed=[]}t&&Object.isExtensible(t)&&n.listenArrayEvents(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=g(t.vScale,t),t.stack!==n.stack&&(r=!0,T(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(x(this,t._parsed),t._stacked=g(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:r,_data:i}=this,{iScale:a,_stacked:o}=r,s=a.axis,c=e===0&&t===i.length?!0:r._sorted,l=e>0&&r._parsed[e-1],u,d,f;if(this._parsing===!1)r._parsed=i,r._sorted=!0,f=i;else{f=n.isArray(i[e])?this.parseArrayData(r,i,e,t):n.isObject(i[e])?this.parseObjectData(r,i,e,t):this.parsePrimitiveData(r,i,e,t);let a=()=>d[s]===null||l&&d[s]t||d=0;--f)if(!m()){this.updateRangeFromParsed(l,e,p,c);break}}return l}getAllParsedValues(e){let t=this._cachedMeta._parsed,r=[],i,a,o;for(i=0,a=t.length;i=0&&ethis.getContext(r,i,t),d);return m.$shared&&(m.$shared=c,a[o]=Object.freeze(D(m,c))),m}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let c;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);c=r.createResolver(a,this.getContext(e,n,t))}let l=new s(r,c&&c.animations);return c&&c._cacheable&&(i[a]=Object.freeze(l)),l}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||E(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){E(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!E(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;oe-t))}return e._cache.$bar}function j(e){let t=e.iScale,r=A(t,e.type),i=t._length,a,o,s,c,l=()=>{s===32767||s===-32768||(n.defined(c)&&(i=Math.min(i,Math.abs(s-c)||i)),c=s)};for(a=0,o=r.length;a0?i[e-1]:null,s=eMath.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function re(e,t,r,i){return n.isArray(e)?ne(e,t,r,i):t[r.axis]=r.parse(e,i),t}function M(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l=r?1:-1):n.sign(e)}function oe(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.basee.controller.options.grouped),a=r.options.stacked,o=[],s=this._cachedMeta.controller.getParsed(t),c=s&&s[r.axis],l=e=>{let t=e._parsed.find(e=>e[r.axis]===c),i=t&&t[e.vScale.axis];if(n.isNullOrUndef(i)||isNaN(i))return!0};for(let n of i)if(!(t!==void 0&&l(n))&&((a===!1||o.indexOf(n.stack)===-1||a===void 0&&n.stack===void 0)&&o.push(n.stack),n.index===e))break;return o.length||o.push(void 0),o}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let r of this.chart.data.datasets)e[n.valueOrDefault(this.chart.options.indexAxis===`x`?r.xAxisID:r.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;i=0;--n)t=Math.max(t,e[n].size(this.resolveDataElementOptions(n))/2);return t>0&&t}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y),c=a._custom;return{label:n[e]||``,value:`(`+o+`, `+s+(c?`, `+c:``)+`)`}}update(e){let t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:s,includeOptions:c}=this._getSharedOptions(t,r),l=a.axis,u=o.axis;for(let d=t;dn._angleBetween(e,c,l,!0)?1:Math.max(t,t*r,i,i*r),h=(e,t,i)=>n._angleBetween(e,c,l,!0)?-1:Math.min(t,t*r,i,i*r),g=m(0,u,f),_=m(n.HALF_PI,d,p),v=h(n.PI,u,f),y=h(n.PI+n.HALF_PI,d,p);i=(g-v)/2,a=(_-y)/2,o=-(g+v)/2,s=-(_+y)/2}return{ratioX:i,ratioY:a,offsetX:o,offsetY:s}}var he=class extends k{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let r=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=r;else{let a=e=>+r[e];if(n.isObject(r[e])){let{key:e=`value`}=this._parsing;a=t=>+n.resolveObjectKey(r[t],e)}let o,s;for(o=e,s=e+t;o0&&!isNaN(e)?n.TAU*(Math.abs(e)/t):0}getLabelAndValue(e){let t=this._cachedMeta,r=this.chart,i=r.data.labels||[],a=n.formatNumber(t._parsed[e],r.options.locale);return{label:i[e]||``,value:a}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;re!==`spacing`,_indexable:e=>e!==`spacing`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)}),t(he,`overrides`,{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}});var ge=class extends k{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){let t=this._cachedMeta,{dataset:r,data:i=[],_dataset:a}=t,o=this.chart._animationsDisabled,{start:s,count:c}=n._getStartAndCountOfVisiblePoints(t,i,o);this._drawStart=s,this._drawCount=c,n._scaleRangesChanged(t)&&(s=0,c=i.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!a._decimated,r.points=i;let l=this.resolveDatasetElementOptions(e);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(r,void 0,{animated:!o,options:l},e),this.updateElements(i,s,c,e)}updateElements(e,t,r,i){let a=i===`reset`,{iScale:o,vScale:s,_stacked:c,_dataset:l}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(t,i),f=o.axis,p=s.axis,{spanGaps:m,segment:h}=this.options,g=n.isNumber(m)?m:1/0,_=this.chart._animationsDisabled||a||i===`none`,v=t+r,y=e.length,b=t>0&&this.getParsed(t-1);for(let r=0;r=v){y.skip=!0;continue}let x=this.getParsed(r),S=n.isNullOrUndef(x[p]),C=y[f]=o.getPixelForValue(x[f],r),w=y[p]=a||S?s.getBasePixel():s.getPixelForValue(c?this.applyStack(s,x,c):x[p],r);y.skip=isNaN(C)||isNaN(w)||S,y.stop=r>0&&Math.abs(x[f]-b[f])>g,h&&(y.parsed=x,y.raw=l.data[r]),d&&(y.options=u||this.resolveDataElementOptions(r,m.active?`active`:i)),_||this.updateElement(m,r,y,i),b=x}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,r=e.data||[];if(!r.length)return n;let i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(n,i,a)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}};t(ge,`id`,`line`),t(ge,`defaults`,{datasetElementType:`line`,dataElementType:`point`,showLine:!0,spanGaps:!1}),t(ge,`overrides`,{scales:{_index_:{type:`category`},_value_:{type:`linear`}}});var _e=class extends k{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){let t=this._cachedMeta,r=this.chart,i=r.data.labels||[],a=n.formatNumber(t._parsed[e].r,r.options.locale);return{label:i[e]||``,value:a}}parseObjectData(e,t,r,i){return n._parseObjectDataRadialScale.bind(this)(e,t,r,i)}update(e){let t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){let e=this._cachedMeta,t={min:1/0,max:-1/0};return e.data.forEach((e,n)=>{let r=this.getParsed(n).r;!isNaN(r)&&this.chart.getDataVisibility(n)&&(rt.max&&(t.max=r))}),t}_updateRadius(){let e=this.chart,t=e.chartArea,n=e.options,r=Math.min(t.right-t.left,t.bottom-t.top),i=Math.max(r/2,0),a=(i-Math.max(n.cutoutPercentage?i/100*n.cutoutPercentage:1,0))/e.getVisibleDatasetCount();this.outerRadius=i-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,r,i){let a=i===`reset`,o=this.chart,s=o.options.animation,c=this._cachedMeta.rScale,l=c.xCenter,u=c.yCenter,d=c.getIndexAngle(0)-.5*n.PI,f=d,p,m=360/this.countVisibleElements();for(p=0;p{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(e,t,r){return this.chart.getDataVisibility(e)?n.toRadians(this.resolveDataElementOptions(e,t).angle||r):0}};t(_e,`id`,`polarArea`),t(_e,`defaults`,{dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:`number`,properties:[`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`]}},indexAxis:`r`,startAngle:0}),t(_e,`overrides`,{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:n,color:r}}=e.legend.options;return t.labels.map((t,i)=>{let a=e.getDatasetMeta(0).controller.getStyle(i);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(i),index:i}})}return[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}},scales:{r:{type:`radialLinear`,angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});var N=class extends he{};t(N,`id`,`pie`),t(N,`defaults`,{cutout:0,rotation:0,circumference:360,radius:`100%`});var P=class extends k{getLabelAndValue(e){let t=this._cachedMeta.vScale,n=this.getParsed(e);return{label:t.getLabels()[e],value:``+t.getLabelForValue(n[t.axis])}}parseObjectData(e,t,r,i){return n._parseObjectDataRadialScale.bind(this)(e,t,r,i)}update(e){let t=this._cachedMeta,n=t.dataset,r=t.data||[],i=t.iScale.getLabels();if(n.points=r,e!==`resize`){let t=this.resolveDatasetElementOptions(e);this.options.showLine||(t.borderWidth=0);let a={_loop:!0,_fullLoop:i.length===r.length,options:t};this.updateElement(n,void 0,a,e)}this.updateElements(r,0,r.length,e)}updateElements(e,t,n,r){let i=this._cachedMeta.rScale,a=r===`reset`;for(let o=t;o0&&this.getParsed(t-1);for(let u=t;u0&&Math.abs(r[p]-y[p])>_,g&&(h.parsed=r,h.raw=l.data[u]),f&&(h.options=d||this.resolveDataElementOptions(u,t.active?`active`:i)),v||this.updateElement(t,u,h,i),y=r}this.updateSharedOptions(d,i,u)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}let n=e.dataset,r=n.options&&n.options.borderWidth||0;if(!t.length)return r;let i=t[0].size(this.resolveDataElementOptions(0)),a=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(r,i,a)/2}};t(F,`id`,`scatter`),t(F,`defaults`,{datasetElementType:!1,dataElementType:`point`,showLine:!1,fill:!1}),t(F,`overrides`,{interaction:{mode:`point`},scales:{x:{type:`linear`},y:{type:`linear`}}});var I=Object.freeze({__proto__:null,BarController:fe,BubbleController:pe,DoughnutController:he,LineController:ge,PieController:N,PolarAreaController:_e,RadarController:P,ScatterController:F});function L(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var R={_date:class e{static override(t){Object.assign(e.prototype,t)}constructor(e){t(this,`options`,void 0),this.options=e||{}}init(){}formats(){return L()}parse(){return L()}format(){return L()}add(){return L()}diff(){return L()}startOf(){return L()}endOf(){return L()}}};function ve(e,t,r,i){let{controller:a,data:o,_sorted:s}=e,c=a._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(c&&t===c.axis&&t!==`r`&&s&&o.length){let s=c._reversePixels?n._rlookupByKey:n._lookupByKey;if(!i){let i=s(o,t,r);if(l){let{vScale:t}=a._cachedMeta,{_parsed:r}=e,o=r.slice(0,i.lo+1).reverse().findIndex(e=>!n.isNullOrUndef(e[t.axis]));i.lo-=Math.max(0,o);let s=r.slice(i.hi).findIndex(e=>!n.isNullOrUndef(e[t.axis]));i.hi+=Math.max(0,s)}return i}else if(a._sharedOptions){let e=o[0],n=typeof e.getRange==`function`&&e.getRange(t);if(n){let e=s(o,t,r-n),i=s(o,t,r+n);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:o.length-1}}function ye(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s=s||e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var we={evaluateInteractionItems:ye,modes:{index(e,t,r,i){let a=n.getRelativePosition(t,e),o=r.axis||`x`,s=r.includeInvisible||!1,c=r.intersect?B(e,a,o,i,s):Se(e,a,o,!1,i,s),l=[];return c.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=c[0].index,n=e.data[t];n&&!n.skip&&l.push({element:n,datasetIndex:e.index,index:t})}),l):[]},dataset(e,t,r,i){let a=n.getRelativePosition(t,e),o=r.axis||`xy`,s=r.includeInvisible||!1,c=r.intersect?B(e,a,o,i,s):Se(e,a,o,!1,i,s);if(c.length>0){let t=c[0].datasetIndex,n=e.getDatasetMeta(t).data;c=[];for(let e=0;ee.pos===t)}function De(e,t){return e.filter(e=>Te.indexOf(e.pos)===-1&&e.box.axis===t)}function Oe(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function ke(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;ne.box.fullSize),!0),r=Oe(Ee(t,`left`),!0),i=Oe(Ee(t,`right`)),a=Oe(Ee(t,`top`),!0),o=Oe(Ee(t,`bottom`)),s=De(t,`x`),c=De(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:Ee(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function Ne(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function Pe(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Fe(e,t,r,i){let{pos:a,box:o}=r,s=e.maxPadding;if(!n.isObject(a)){r.size&&(e[a]-=r.size);let t=i[r.stack]||{size:0,count:1};t.size=Math.max(t.size,r.horizontal?o.height:o.width),r.size=t.size/t.count,e[a]+=r.size}o.getPadding&&Pe(s,o.getPadding());let c=Math.max(0,t.outerWidth-Ne(s,e,`left`,`right`)),l=Math.max(0,t.outerHeight-Ne(s,e,`top`,`bottom`)),u=c!==e.w,d=l!==e.h;return e.w=c,e.h=l,r.horizontal?{same:u,other:d}:{same:d,other:u}}function V(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function H(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function Ie(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a{typeof e.beforeLayout==`function`&&e.beforeLayout()});let d=l.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:r,padding:a,availableWidth:o,availableHeight:s,vBoxMaxWidth:o/2/d,hBoxMaxHeight:s/2}),p=Object.assign({},a);Pe(p,n.toPadding(i));let m=Object.assign({maxPadding:p,w:o,h:s,x:a.left,y:a.top},a),h=je(l.concat(u),f);Ie(c.fullSize,m,f,h),Ie(l,m,f,h),Ie(u,m,f,h)&&Ie(l,m,f,h),V(m),Re(c.leftAndTop,m,f,h),m.x+=m.w,m.y+=m.h,Re(c.rightAndBottom,m,f,h),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},n.each(c.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}},ze=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},Be=class extends ze{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}},Ve=`$chartjs`,He={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},Ue=e=>e===null||e===``;function We(e,t){let r=e.style,i=e.getAttribute(`height`),a=e.getAttribute(`width`);if(e[Ve]={initial:{height:i,width:a,style:{display:r.display,height:r.height,width:r.width}}},r.display=r.display||`block`,r.boxSizing=r.boxSizing||`border-box`,Ue(a)){let t=n.readUsedSize(e,`width`);t!==void 0&&(e.width=t)}if(Ue(i))if(e.style.height===``)e.height=e.width/(t||2);else{let t=n.readUsedSize(e,`height`);t!==void 0&&(e.height=t)}return e}var Ge=n.supportsEventListenerOptions?{passive:!0}:!1;function Ke(e,t,n){e&&e.addEventListener(t,n,Ge)}function qe(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Ge)}function Je(e,t){let r=He[e.type]||e.type,{x:i,y:a}=n.getRelativePosition(e,t);return{type:r,chart:t,native:e,x:i===void 0?null:i,y:a===void 0?null:a}}function Ye(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function Xe(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t=t||Ye(n.addedNodes,r),t=t&&!Ye(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function Ze(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t=t||Ye(n.removedNodes,r),t=t&&!Ye(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var Qe=new Map,$e=0;function et(){let e=window.devicePixelRatio;e!==$e&&($e=e,Qe.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function tt(e,t){Qe.size||window.addEventListener(`resize`,et),Qe.set(e,t)}function W(e){Qe.delete(e),Qe.size||window.removeEventListener(`resize`,et)}function nt(e,t,r){let i=e.canvas,a=i&&n._getParentNode(i);if(!a)return;let o=n.throttled((e,t)=>{let n=a.clientWidth;r(e,t),n{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||o(n,r)});return s.observe(a),tt(e,o),s}function G(e,t,n){n&&n.disconnect(),t===`resize`&&W(e)}function rt(e,t,r){let i=e.canvas,a=n.throttled(t=>{e.ctx!==null&&r(Je(t,e))},e);return Ke(i,t,a),a}var it=class extends ze{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(We(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[Ve])return!1;let r=t[Ve].initial;[`height`,`width`].forEach(e=>{let i=r[e];n.isNullOrUndef(i)?t.removeAttribute(e):t.setAttribute(e,i)});let i=r.style||{};return Object.keys(i).forEach(e=>{t.style[e]=i[e]}),t.width=t.width,delete t[Ve],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||(e.$proxies={});r[t]=({attach:Xe,detach:Ze,resize:nt}[t]||rt)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||(e.$proxies={}),r=n[t];r&&(({attach:G,detach:G,resize:G}[t]||qe)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,r,i){return n.getMaximumSize(e,t,r,i)}isAttached(e){let t=e&&n._getParentNode(e);return!!(t&&t.isConnected)}};function at(e){return!n._isDomSupported()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?Be:it}var K=class{constructor(){t(this,`x`,void 0),t(this,`y`,void 0),t(this,`active`,!1),t(this,`options`,void 0),t(this,`$animations`,void 0)}tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return n.isNumber(this.x)&&n.isNumber(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};t(K,`defaults`,{}),t(K,`defaultRoutes`,void 0);function ot(e,t){let r=e.options.ticks,i=st(e),a=Math.min(r.maxTicksLimit||i,i),o=r.major.enabled?lt(t):[],s=o.length,c=o[0],l=o[s-1],u=[];if(s>a)return ut(t,u,o,s/a),u;let d=ct(o,t,a);if(s>0){let e,r,i=s>1?Math.round((l-c)/(s-1)):null;for(dt(t,u,d,n.isNullOrUndef(i)?0:c-i,c),e=0,r=s-1;ea)return t}return Math.max(a,1)}function lt(e){let t=[],n,r;for(n=0,r=e.length;ne===`left`?`right`:e===`right`?`left`:e,mt=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,ht=(e,t)=>Math.min(t||e,e);function q(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;ao+s)))return c}function _t(e,t){n.each(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;ir?r:t,r=i&&t>r?t:r,{min:n.finiteOrDefault(t,n.finiteOrDefault(r,t)),max:n.finiteOrDefault(r,n.finiteOrDefault(t,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){n.callback(this.options.beforeUpdate,[this])}update(e,t,r){let{beginAtZero:i,grace:a,ticks:o}=this.options,s=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=n._addGrace(this,a,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let c=s=a||r<=1||!this.isHorizontal()){this.labelRotation=i;return}let u=this._getLabelSizes(),d=u.widest.width,f=u.highest.height,p=n._limitValue(this.chart.width-d,0,this.maxWidth);s=e.offset?this.maxWidth/r:p/(r-1),d+6>s&&(s=p/(r-(e.offset?.5:1)),c=this.maxHeight-vt(e.grid)-t.padding-yt(e.title,this.chart.options.font),l=Math.sqrt(d*d+f*f),o=n.toDegrees(Math.min(Math.asin(n._limitValue((u.highest.height+6)/s,-1,1)),Math.asin(n._limitValue(c/l,-1,1))-Math.asin(n._limitValue(f/l,-1,1)))),o=Math.max(i,Math.min(a,o))),this.labelRotation=o}afterCalculateLabelRotation(){n.callback(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){n.callback(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:r,title:i,grid:a}}=this,o=this._isVisible(),s=this.isHorizontal();if(o){let o=yt(i,t.options.font);if(s?(e.width=this.maxWidth,e.height=vt(a)+o):(e.height=this.maxHeight,e.width=vt(a)+o),r.display&&this.ticks.length){let{first:t,last:i,widest:a,highest:o}=this._getLabelSizes(),c=r.padding*2,l=n.toRadians(this.labelRotation),u=Math.cos(l),d=Math.sin(l);if(s){let t=r.mirror?0:d*a.width+u*o.height;e.height=Math.min(this.maxHeight,e.height+t+c)}else{let t=r.mirror?0:u*a.width+d*o.height;e.width=Math.min(this.maxWidth,e.width+t+c)}this._calculatePadding(t,i,d,u)}}this._handleMargins(),s?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){n.callback(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,r;for(t=0,r=e.length;t({width:o[e]||0,height:s[e]||0});return{first:w(0),last:w(t-1),widest:w(S),highest:w(C),widths:o,heights:s}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return n._int16Range(this._alignToPixels?n._alignPixel(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&es*i?s/r:c/i:c*i0:!!e}_computeGridLineItems(e){let t=this.axis,r=this.chart,i=this.options,{grid:a,position:o,border:s}=i,c=a.offset,l=this.isHorizontal(),u=this.ticks.length+ +!!c,d=vt(a),f=[],p=s.setContext(this.getContext()),m=p.display?p.width:0,h=m/2,g=function(e){return n._alignPixel(r,e,m)},_,v,y,b,x,S,C,w,T,E,D,O;if(o===`top`)_=g(this.bottom),S=this.bottom-d,w=_-h,E=g(e.top)+h,O=e.bottom;else if(o===`bottom`)_=g(this.top),E=e.top,O=g(e.bottom)-h,S=_+h,w=this.top+d;else if(o===`left`)_=g(this.right),x=this.right-d,C=_-h,T=g(e.left)+h,D=e.right;else if(o===`right`)_=g(this.left),T=e.left,D=g(e.right)-h,x=_+h,C=this.left+d;else if(t===`x`){if(o===`center`)_=g((e.top+e.bottom)/2+.5);else if(n.isObject(o)){let e=Object.keys(o)[0],t=o[e];_=g(this.chart.scales[e].getPixelForValue(t))}E=e.top,O=e.bottom,S=_+h,w=S+d}else if(t===`y`){if(o===`center`)_=g((e.left+e.right)/2);else if(n.isObject(o)){let e=Object.keys(o)[0],t=o[e];_=g(this.chart.scales[e].getPixelForValue(t))}x=_-h,C=x-d,T=e.left,D=e.right}let k=n.valueOrDefault(i.ticks.maxTicksLimit,u),A=Math.max(1,Math.ceil(u/k));for(v=0;v0&&(o-=i/2);break}p={left:o,top:a,width:i+t.width,height:r+t.height,color:e.backdropColor}}g.push({label:b,font:T,textOffset:O,options:{rotation:h,color:r,strokeColor:c,strokeWidth:u,textAlign:f,textBaseline:k,translation:[x,S],backdrop:p}})}return g}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-n.toRadians(this.labelRotation))return e===`top`?`left`:`right`;let r=`center`;return t.align===`start`?r=`left`:t.align===`end`?r=`right`:t.align===`inner`&&(r=`inner`),r}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e)),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i{this.draw(e)}}]:[{z:i,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:a,draw:()=>{this.drawBorder()}},{z:r,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i{let i=r.split(`.`),a=i.pop(),o=[e].concat(i).join(`.`),s=t[r].split(`.`),c=s.pop(),l=s.join(`.`);n.defaults.route(o,a,l,c)})}function Ot(e){return`id`in e&&`defaults`in e}var kt=new class{constructor(){this.controllers=new Tt(k,`datasets`,!0),this.elements=new Tt(K,`elements`),this.plugins=new Tt(Object,`plugins`),this.scales=new Tt(wt,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,r){[...t].forEach(t=>{let i=r||this._getRegistryForType(t);r||i.isForType(t)||i===this.plugins&&t.id?this._exec(e,i,t):n.each(t,t=>{let n=r||this._getRegistryForType(t);this._exec(e,n,t)})})}_exec(e,t,r){let i=n._capitalize(e);n.callback(r[`before`+i],[],r),t[e](r),n.callback(r[`after`+i],[],r)}_getRegistryForType(e){for(let t=0;te.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function jt(e){let t={},n=[],r=Object.keys(kt.plugins.items);for(let e=0;e1&&Rt(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function J(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function Vt(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return J(e,`x`,n[0])||J(e,`y`,n[0])}return{}}function Ht(e,t){let r=n.overrides[e.type]||{scales:{}},i=t.scales||{},a=Ft(e.type,t),o=Object.create(null);return Object.keys(i).forEach(t=>{let s=i[t];if(!n.isObject(s))return console.error(`Invalid scale configuration for scale: ${t}`);if(s._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let c=Bt(t,s,Vt(t,e),n.defaults.scales[s.type]),l=Lt(c,a),u=r.scales||{};o[t]=n.mergeIf(Object.create(null),[{axis:c},s,u[c],u[l]])}),e.data.datasets.forEach(r=>{let a=r.type||e.type,s=r.indexAxis||Ft(a,t),c=(n.overrides[a]||{}).scales||{};Object.keys(c).forEach(e=>{let t=It(e,s),a=r[t+`AxisID`]||t;o[a]=o[a]||Object.create(null),n.mergeIf(o[a],[{axis:t},i[a],c[e]])})}),Object.keys(o).forEach(e=>{let t=o[e];n.mergeIf(t,[n.defaults.scales[t.type],n.defaults.scale])}),o}function Ut(e){let t=e.options||(e.options={});t.plugins=n.valueOrDefault(t.plugins,{}),t.scales=Ht(e,t)}function Wt(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Gt(e){return e=e||{},e.data=Wt(e.data),Ut(e),e}var Kt=new Map,qt=new Set;function Jt(e,t){let n=Kt.get(e);return n||(n=t(),Kt.set(e,n),qt.add(n)),n}var Yt=(e,t,r)=>{let i=n.resolveObjectKey(t,r);i!==void 0&&e.add(i)},Xt=class{constructor(e){this._config=Gt(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Wt(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),Ut(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Jt(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return Jt(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return Jt(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return Jt(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,r){let{options:i,type:a}=this,o=this._cachedScopes(e,r),s=o.get(t);if(s)return s;let c=new Set;t.forEach(t=>{e&&(c.add(e),t.forEach(t=>Yt(c,e,t))),t.forEach(e=>Yt(c,i,e)),t.forEach(e=>Yt(c,n.overrides[a]||{},e)),t.forEach(e=>Yt(c,n.defaults,e)),t.forEach(e=>Yt(c,n.descriptors,e))});let l=Array.from(c);return l.length===0&&l.push(Object.create(null)),qt.has(t)&&o.set(t,l),l}chartOptionScopes(){let{options:e,type:t}=this;return[e,n.overrides[t]||{},n.defaults.datasets[t]||{},{type:t},n.defaults,n.descriptors]}resolveNamedOptions(e,t,r,i=[``]){let a={$shared:!0},{resolver:o,subPrefixes:s}=Zt(this._resolverCache,e,i),c=o;if($t(o,t)){a.$shared=!1,r=n.isFunction(r)?r():r;let t=this.createResolver(e,r,s);c=n._attachContext(o,r,t)}for(let e of t)a[e]=c[e];return a}createResolver(e,t,r=[``],i){let{resolver:a}=Zt(this._resolverCache,e,r);return n.isObject(t)?n._attachContext(a,t,void 0,i):a}};function Zt(e,t,r){let i=e.get(t);i||(i=new Map,e.set(t,i));let a=r.join(),o=i.get(a);return o||(o={resolver:n._createResolver(t,r),subPrefixes:r.filter(e=>!e.toLowerCase().includes(`hover`))},i.set(a,o)),o}var Qt=e=>n.isObject(e)&&Object.getOwnPropertyNames(e).some(t=>n.isFunction(e[t]));function $t(e,t){let{isScriptable:r,isIndexable:i}=n._descriptors(e);for(let a of t){let t=r(a),o=i(a),s=(o||t)&&e[a];if(t&&(n.isFunction(s)||Qt(s))||o&&n.isArray(s))return!0}return!1}var en=`4.5.1`,tn=[`top`,`bottom`,`left`,`right`,`chartArea`];function nn(e,t){return e===`top`||e===`bottom`||tn.indexOf(e)===-1&&t===`x`}function rn(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function an(e){let t=e.chart,r=t.options.animation;t.notifyPlugins(`afterRender`),n.callback(r&&r.onComplete,[e],t)}function on(e){let t=e.chart,r=t.options.animation;n.callback(r&&r.onProgress,[e],t)}function sn(e){return n._isDomSupported()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var cn={},ln=e=>{let t=sn(e);return Object.values(cn).filter(e=>e.canvas===t).pop()};function un(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function dn(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var Y=class{static register(...e){kt.add(...e),X()}static unregister(...e){kt.remove(...e),X()}constructor(e,t){let i=this.config=new Xt(t),a=sn(e),o=ln(a);if(o)throw Error(`Canvas is already in use. Chart with ID '`+o.id+`' must be destroyed before the canvas with ID '`+o.canvas.id+`' can be reused.`);let s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||(at(a))),this.platform.updateConfig(i);let c=this.platform.acquireContext(a,s.aspectRatio),l=c&&c.canvas,u=l&&l.height,d=l&&l.width;if(this.id=n.uid(),this.ctx=c,this.canvas=l,this.width=d,this.height=u,this._options=s,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new At,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=n.debounce(e=>this.update(e),s.resizeDelay||0),this._dataChanges=[],cn[this.id]=this,!c||!l){console.error(`Failed to create chart: can't acquire context from the given item`);return}r.listen(this,`complete`,an),r.listen(this,`progress`,on),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:r,height:i,_aspectRatio:a}=this;return n.isNullOrUndef(e)?t&&a?a:i?r/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return kt}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():n.retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return n.clearCanvas(this.canvas,this.ctx),this}stop(){return r.stop(this),this}resize(e,t){r.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let r=this.options,i=this.canvas,a=r.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(i,e,t,a),s=r.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?`resize`:`attach`;this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,n.retinaScale(this,s,!0)&&(this.notifyPlugins(`resize`,{size:o}),n.callback(r.onResize,[this,o],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};n.each(e,(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,r=this.scales,i=Object.keys(r).reduce((e,t)=>(e[t]=!1,e),{}),a=[];t&&(a=a.concat(Object.keys(t).map(e=>{let n=t[e],r=Bt(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),n.each(a,t=>{let a=t.options,o=a.id,s=Bt(o,a),c=n.valueOrDefault(a.type,t.dtype);(a.position===void 0||nn(a.position,s)!==nn(t.dposition))&&(a.position=t.dposition),i[o]=!0;let l=null;o in r&&r[o].type===c?l=r[o]:(l=new(kt.getScale(c))({id:o,type:c,ctx:this.ctx,chart:this}),r[l.id]=l),l.init(a,e)}),n.each(i,(e,t)=>{e||delete r[t]}),n.each(r,e=>{U.configure(this,e,e.options),U.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;et.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,r,i;for(this._removeUnreferencedMetasets(),r=0,i=t.length;r{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let r=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let a=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let o=0;for(let e=0,t=this.data.datasets.length;e{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(rn(`z`,`_idx`));let{_active:s,_lastEvent:c}=this;c?this._eventHandler(c,!0):s.length&&this._updateHoverStyles(s,s,!0),this.render()}_updateScales(){n.each(this.scales,e=>{U.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options,t=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!n.setsEqual(t,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)un(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,r=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),i=r(0);for(let e=1;ee.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;U.update(this,this.width,this.height,e);let t=this.chartArea,r=t.width<=0||t.height<=0;this._layers=[],n.each(this.boxes,e=>{r&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,r={meta:e,index:e.index,cancelable:!0},i=n.getDatasetClipArea(this,e);this.notifyPlugins(`beforeDatasetDraw`,r)!==!1&&(i&&n.clipArea(t,i),e.controller.draw(),i&&n.unclipArea(t),r.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,r))}isPointInArea(e){return n._isPointInArea(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=we.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||(this.$context=n.createContext(null,{chart:this,type:`chart`}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,r){let i=r?`show`:`hide`,a=this.getDatasetMeta(e),o=a.controller._resolveAnimations(void 0,i);n.defined(t)?(a.data[t].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),o.update(a,{visible:r}),this.update(t=>t.datasetIndex===e?i:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),r.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,n,r),e[n]=r},i=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};n.each(this.options.events,e=>r(e,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){n.each(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},n.each(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});n._elementsEqual(r,t)||(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,r){let{_active:i=[],options:a}=this,o=t,s=this._getActiveElements(e,i,r,o),c=n._isClickEvent(e),l=dn(e,this._lastEvent,r,c);r&&(this._lastEvent=null,n.callback(a.onHover,[e,s,this],this),c&&n.callback(a.onClick,[e,s,this],this));let u=!n._elementsEqual(s,i);return(u||t)&&(this._active=s,this._updateHoverStyles(s,i,t)),this._lastEvent=l,u}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};t(Y,`defaults`,n.defaults),t(Y,`instances`,cn),t(Y,`overrides`,n.overrides),t(Y,`registry`,kt),t(Y,`version`,en),t(Y,`getChart`,ln);function X(){return n.each(Y.instances,e=>e._plugins.invalidate())}function fn(e,t,r){let{startAngle:i,x:a,y:o,outerRadius:s,innerRadius:c,options:l}=t,{borderWidth:u,borderJoinStyle:d}=l,f=Math.min(u/s,n._normalizeAngle(i-r));if(e.beginPath(),e.arc(a,o,s-u/2,i+f/2,r-f/2),c>0){let t=Math.min(u/c,n._normalizeAngle(i-r));e.arc(a,o,c+u/2,r-t/2,i+t/2,!0)}else{let t=Math.min(u/2,s*n._normalizeAngle(i-r));if(d===`round`)e.arc(a,o,t,r-n.PI/2,i+n.PI/2,!0);else if(d===`bevel`){let s=2*t*t,c=-s*Math.cos(r+n.PI/2)+a,l=-s*Math.sin(r+n.PI/2)+o,u=s*Math.cos(i+n.PI/2)+a,d=s*Math.sin(i+n.PI/2)+o;e.lineTo(c,l),e.lineTo(u,d)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function pn(e,t,r){let{startAngle:i,pixelMargin:a,x:o,y:s,outerRadius:c,innerRadius:l}=t,u=a/c;e.beginPath(),e.arc(o,s,c,i-u,r+u),l>a?(u=a/l,e.arc(o,s,l,r+u,i-u,!0)):e.arc(o,s,a,r+n.HALF_PI,i-n.HALF_PI),e.closePath(),e.clip()}function mn(e){return n._readValueToProps(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function hn(e,t,r,i){let a=mn(e.options.borderRadius),o=(r-t)/2,s=Math.min(o,i*t/2),c=e=>{let t=(r-Math.min(o,e))*i/2;return n._limitValue(e,0,Math.min(o,t))};return{outerStart:c(a.outerStart),outerEnd:c(a.outerEnd),innerStart:n._limitValue(a.innerStart,0,s),innerEnd:n._limitValue(a.innerEnd,0,s)}}function Z(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function gn(e,t,r,i,a,o){let{x:s,y:c,startAngle:l,pixelMargin:u,innerRadius:d}=t,f=Math.max(t.outerRadius+i+r-u,0),p=d>0?d+i+r+u:0,m=0,h=a-l;if(i){let e=((d>0?d-i:0)+(f>0?f-i:0))/2;m=(h-(e===0?h:h*e/(e+i)))/2}let g=(h-Math.max(.001,h*f-r/n.PI)/f)/2,_=l+g+m,v=a-g-m,{outerStart:y,outerEnd:b,innerStart:x,innerEnd:S}=hn(t,p,f,v-_),C=f-y,w=f-b,T=_+y/C,E=v-b/w,D=p+x,O=p+S,k=_+x/D,A=v-S/O;if(e.beginPath(),o){let t=(T+E)/2;if(e.arc(s,c,f,T,t),e.arc(s,c,f,t,E),b>0){let t=Z(w,E,s,c);e.arc(t.x,t.y,b,E,v+n.HALF_PI)}let r=Z(O,v,s,c);if(e.lineTo(r.x,r.y),S>0){let t=Z(O,A,s,c);e.arc(t.x,t.y,S,v+n.HALF_PI,A+Math.PI)}let i=(v-S/p+(_+x/p))/2;if(e.arc(s,c,p,v-S/p,i,!0),e.arc(s,c,p,i,_+x/p,!0),x>0){let t=Z(D,k,s,c);e.arc(t.x,t.y,x,k+Math.PI,_-n.HALF_PI)}let a=Z(C,_,s,c);if(e.lineTo(a.x,a.y),y>0){let t=Z(C,T,s,c);e.arc(t.x,t.y,y,_-n.HALF_PI,T)}}else{e.moveTo(s,c);let t=Math.cos(T)*f+s,n=Math.sin(T)*f+c;e.lineTo(t,n);let r=Math.cos(E)*f+s,i=Math.sin(E)*f+c;e.lineTo(r,i)}e.closePath()}function _n(e,t,r,i,a){let{fullCircles:o,startAngle:s,circumference:c}=t,l=t.endAngle;if(o){gn(e,t,r,i,l,a);for(let t=0;t=n.PI&&m===0&&d!==`miter`&&fn(e,t,g),o||(gn(e,t,r,i,g,a),e.stroke())}var yn=class extends K{constructor(e){super(),t(this,`circumference`,void 0),t(this,`endAngle`,void 0),t(this,`fullCircles`,void 0),t(this,`innerRadius`,void 0),t(this,`outerRadius`,void 0),t(this,`pixelMargin`,void 0),t(this,`startAngle`,void 0),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,r){let i=this.getProps([`x`,`y`],r),{angle:a,distance:o}=n.getAngleFromPoint(i,{x:e,y:t}),{startAngle:s,endAngle:c,innerRadius:l,outerRadius:u,circumference:d}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],r),f=(this.options.spacing+this.options.borderWidth)/2,p=n.valueOrDefault(d,c-s),m=n._angleBetween(a,s,c)&&s!==c,h=p>=n.TAU||m,g=n._isBetween(o,l+f,u+f);return h&&g}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:r}=this,i=(t.offset||0)/4,a=(t.spacing||0)/2,o=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=r>n.TAU?Math.floor(r/n.TAU):0,r===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let s=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(s)*i,Math.sin(s)*i);let c=i*(1-Math.sin(Math.min(n.PI,r||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,_n(e,this,c,a,o),vn(e,this,c,a,o),e.restore()}};t(yn,`id`,`arc`),t(yn,`defaults`,{borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),t(yn,`defaultRoutes`,{backgroundColor:`backgroundColor`}),t(yn,`descriptors`,{_scriptable:!0,_indexable:e=>e!==`borderDash`});function bn(e,t,r=t){e.lineCap=n.valueOrDefault(r.borderCapStyle,t.borderCapStyle),e.setLineDash(n.valueOrDefault(r.borderDash,t.borderDash)),e.lineDashOffset=n.valueOrDefault(r.borderDashOffset,t.borderDashOffset),e.lineJoin=n.valueOrDefault(r.borderJoinStyle,t.borderJoinStyle),e.lineWidth=n.valueOrDefault(r.borderWidth,t.borderWidth),e.strokeStyle=n.valueOrDefault(r.borderColor,t.borderColor)}function xn(e,t,n){e.lineTo(n.x,n.y)}function Sn(e){return e.stepped?n._steppedLineTo:e.tension||e.cubicInterpolationMode===`monotone`?n._bezierCurveTo:xn}function Cn(e,t,n={}){let r=e.length,{start:i=0,end:a=r-1}=n,{start:o,end:s}=t,c=Math.max(i,o),l=Math.min(a,s),u=is&&a>s;return{count:r,start:c,loop:t.loop,ilen:l(o+(l?s-e:e))%a,y=()=>{h!==g&&(e.lineTo(u,g),e.lineTo(u,h),e.lineTo(u,_))};for(c&&(p=i[v(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[v(f)],p.skip)continue;let t=p.x,n=p.y,r=t|0;r===m?(ng&&(g=n),u=(d*u+t)/++d):(y(),e.lineTo(t,n),m=r,d=0,h=g=n),_=n}y()}function En(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!==`monotone`&&!t.stepped&&!n?Tn:wn}function Dn(e){return e.stepped?n._steppedInterpolation:e.tension||e.cubicInterpolationMode===`monotone`?n._bezierInterpolation:n._pointInLine}function On(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),bn(e,t.options),e.stroke(i)}function kn(e,t,n,r){let{segments:i,options:a}=t,o=En(t);for(let s of i)bn(e,a,s.style),e.beginPath(),o(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}var An=typeof Path2D==`function`;function jn(e,t,n,r){An&&!t.options.segment?On(e,t,n,r):kn(e,t,n,r)}var Mn=class extends K{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){let r=this.options;if((r.tension||r.cubicInterpolationMode===`monotone`)&&!r.stepped&&!this._pointsUpdated){let i=r.spanGaps?this._loop:this._fullLoop;n._updateBezierControlPoints(this._points,r,e,i,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=n._computeSegments(this,this.options.segment))}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){let r=this.options,i=e[t],a=this.points,o=n._boundSegments(this,{property:t,start:i,end:i});if(!o.length)return;let s=[],c=Dn(r),l,u;for(l=0,u=o.length;le!==`borderDash`&&e!==`fill`});function Nn(e,t,n,r){let i=e.options,{[n]:a}=e.getProps([n],r);return Math.abs(t-a)e.replace(`rgb(`,`rgba(`).replace(`)`,`, 0.5)`));function Jn(e){return Kn[e%Kn.length]}function Yn(e){return qn[e%qn.length]}function Xn(e,t){return e.borderColor=Jn(t),e.backgroundColor=Yn(t),++t}function Zn(e,t){return e.backgroundColor=e.data.map(()=>Jn(t++)),t}function Qn(e,t){return e.backgroundColor=e.data.map(()=>Yn(t++)),t}function $n(e){let t=0;return(n,r)=>{let i=e.getDatasetMeta(r).controller;i instanceof he?t=Zn(n,t):i instanceof _e?t=Qn(n,t):i&&(t=Xn(n,t))}}function er(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function tr(e){return e&&(e.borderColor||e.backgroundColor)}function nr(){return n.defaults.borderColor!==`rgba(0,0,0,0.1)`||n.defaults.backgroundColor!==`rgba(0,0,0,0.1)`}var rr={id:`colors`,defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;let{data:{datasets:r},options:i}=e.config,{elements:a}=i,o=er(r)||tr(i)||a&&er(a)||nr();if(!n.forceOverride&&o)return;let s=$n(e);r.forEach(s)}};function ir(e,t,n,r,i){let a=i.samples||r;if(a>=n)return e.slice(t,t+n);let o=[],s=(n-2)/(a-2),c=0,l=t+n-1,u=t,d,f,p,m,h;for(o[c++]=e[u],d=0;dp&&(p=m,f=e[a],h=a);o[c++]=f,u=h}return o[c++]=e[l],o}function ar(e,t,r,i){let a=0,o=0,s,c,l,u,d,f,p,m,h,g,_=[],v=t+r-1,y=e[t].x,b=e[v].x-y;for(s=t;sg&&(g=u,p=s),a=(o*a+c.x)/++o;else{let r=s-1;if(!n.isNullOrUndef(f)&&!n.isNullOrUndef(p)){let t=Math.min(f,p),n=Math.max(f,p);t!==m&&t!==r&&_.push({...e[t],x:a}),n!==m&&n!==r&&_.push({...e[n],x:a})}s>0&&r!==m&&_.push(e[r]),_.push(c),d=t,o=0,h=g=u,f=p=m=s}}return _}function or(e){if(e._decimated){let t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function sr(e){e.data.datasets.forEach(e=>{or(e)})}function cr(e,t){let r=t.length,i=0,a,{iScale:o}=e,{min:s,max:c,minDefined:l,maxDefined:u}=o.getUserBounds();return l&&(i=n._limitValue(n._lookupByKey(t,o.axis,s).lo,0,r-1)),a=u?n._limitValue(n._lookupByKey(t,o.axis,c).hi+1,i,r)-i:r-i,{start:i,count:a}}var lr={id:`decimation`,defaults:{algorithm:`min-max`,enabled:!1},beforeElementsUpdate:(e,t,r)=>{if(!r.enabled){sr(e);return}let i=e.width;e.data.datasets.forEach((t,a)=>{let{_data:o,indexAxis:s}=t,c=e.getDatasetMeta(a),l=o||t.data;if(n.resolve([s,e.options.indexAxis])===`y`||!c.controller.supportsDecimation)return;let u=e.scales[c.xAxisID];if(u.type!==`linear`&&u.type!==`time`||e.options.parsing)return;let{start:d,count:f}=cr(c,l);if(f<=(r.threshold||4*i)){or(t);return}n.isNullOrUndef(o)&&(t._data=l,delete t.data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(e){this._data=e}}));let p;switch(r.algorithm){case`lttb`:p=ir(l,d,f,i,r);break;case`min-max`:p=ar(l,d,f,i);break;default:throw Error(`Unsupported decimation algorithm '${r.algorithm}'`)}t._decimated=p})},destroy(e){sr(e)}};function ur(e,t,r){let i=e.segments,a=e.points,o=t.points,s=[];for(let e of i){let{start:i,end:c}=e;c=pr(i,c,a);let l=dr(r,a[i],a[c],e.loop);if(!t.segments){s.push({source:e,target:l,start:a[i],end:a[c]});continue}let u=n._boundSegments(t,l);for(let t of u){let i=dr(r,o[t.start],o[t.end],t.loop),c=n._boundSegment(e,a,i);for(let e of c)s.push({source:e,target:t,start:{[r]:mr(l,i,`start`,Math.max)},end:{[r]:mr(l,i,`end`,Math.min)}})}}return s}function dr(e,t,r,i){if(i)return;let a=t[e],o=r[e];return e===`angle`&&(a=n._normalizeAngle(a),o=n._normalizeAngle(o)),{property:e,start:a,end:o}}function fr(e,t){let{x:n=null,y:r=null}=e||{},i=t.points,a=[];return t.segments.forEach(({start:e,end:t})=>{t=pr(e,t,i);let o=i[e],s=i[t];r===null?n!==null&&(a.push({x:n,y:o.y}),a.push({x:n,y:s.y})):(a.push({x:o.x,y:r}),a.push({x:s.x,y:r}))}),a}function pr(e,t,n){for(;t>e;t--){let e=n[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function mr(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function hr(e,t){let r=[],i=!1;return n.isArray(e)?(i=!0,r=e):r=fr(e,t),r.length?new Mn({points:r,options:{tension:0},_loop:i,_fullLoop:i}):null}function gr(e){return e&&e.fill!==!1}function _r(e,t,r){let i=e[t].fill,a=[t],o;if(!r)return i;for(;i!==!1&&a.indexOf(i)===-1;){if(!n.isNumberFinite(i))return i;if(o=e[i],!o)return!1;if(o.visible)return i;a.push(i),i=o.fill}return!1}function vr(e,t,r){let i=Sr(e);if(n.isObject(i))return isNaN(i.value)?!1:i;let a=parseFloat(i);return n.isNumberFinite(a)&&Math.floor(a)===a?yr(i[0],t,a,r):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(i)>=0&&i}function yr(e,t,n,r){return(e===`-`||e===`+`)&&(n=t+n),n===t||n<0||n>=r?!1:n}function br(e,t){let r=null;return e===`start`?r=t.bottom:e===`end`?r=t.top:n.isObject(e)?r=t.getPixelForValue(e.value):t.getBasePixel&&(r=t.getBasePixel()),r}function xr(e,t,r){let i;return i=e===`start`?r:e===`end`?t.options.reverse?t.min:t.max:n.isObject(e)?e.value:t.getBaseValue(),i}function Sr(e){let t=e.options,r=t.fill,i=n.valueOrDefault(r&&r.target,r);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?`origin`:i}function Cr(e){let{scale:t,index:n,line:r}=e,i=[],a=r.segments,o=r.points,s=wr(t,n);s.push(hr({x:null,y:t.bottom},r));for(let e=0;e=0;--t){let n=i[t].$filler;n&&(n.line.updateControlPoints(a,n.axis),r&&n.fill&&Nr(e.ctx,n,a))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!==`beforeDatasetsDraw`)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let n=r[t].$filler;gr(n)&&Nr(e.ctx,n,e.chartArea)}},beforeDatasetDraw(e,t,n){let r=t.meta.$filler;!gr(r)||n.drawTime!==`beforeDatasetDraw`||Nr(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}},Vr=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},Hr=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,Ur=class extends K{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let e=this.options.labels||{},t=n.callback(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let r=e.labels,i=n.toFont(r.font),a=i.size,o=this._computeTitleHeight(),{boxWidth:s,itemHeight:c}=Vr(r,a),l,u;t.font=i.string,this.isHorizontal()?(l=this.maxWidth,u=this._fitRows(o,a,s,c)+10):(u=this.maxHeight,l=this._fitCols(o,i,s,c)+10),this.width=Math.min(l,e.maxWidth||this.maxWidth),this.height=Math.min(u,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=Wr(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:r,labels:{padding:i},rtl:a}}=this,o=n.getRtlAdapter(a,this.left,this.width);if(this.isHorizontal()){let a=0,s=n._alignStartEnd(r,this.left+i,this.right-this.lineWidths[a]);for(let c of t)a!==c.row&&(a=c.row,s=n._alignStartEnd(r,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+e+i,c.left=o.leftForLtr(o.x(s),c.width),s+=c.width+i}else{let a=0,s=n._alignStartEnd(r,this.top+e+i,this.bottom-this.columnSizes[a].height);for(let c of t)c.col!==a&&(a=c.col,s=n._alignStartEnd(r,this.top+e+i,this.bottom-this.columnSizes[a].height)),c.top=s,c.left+=this.left+i,c.left=o.leftForLtr(o.x(c.left),c.width),s+=c.height+i}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;n.clipArea(e,this),this._draw(),n.unclipArea(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:r,ctx:i}=this,{align:a,labels:o}=e,s=n.defaults.color,c=n.getRtlAdapter(e.rtl,this.left,this.width),l=n.toFont(o.font),{padding:u}=o,d=l.size,f=d/2,p;this.drawTitle(),i.textAlign=c.textAlign(`left`),i.textBaseline=`middle`,i.lineWidth=.5,i.font=l.string;let{boxWidth:m,boxHeight:h,itemHeight:g}=Vr(o,d),_=function(e,t,r){if(isNaN(m)||m<=0||isNaN(h)||h<0)return;i.save();let a=n.valueOrDefault(r.lineWidth,1);if(i.fillStyle=n.valueOrDefault(r.fillStyle,s),i.lineCap=n.valueOrDefault(r.lineCap,`butt`),i.lineDashOffset=n.valueOrDefault(r.lineDashOffset,0),i.lineJoin=n.valueOrDefault(r.lineJoin,`miter`),i.lineWidth=a,i.strokeStyle=n.valueOrDefault(r.strokeStyle,s),i.setLineDash(n.valueOrDefault(r.lineDash,[])),o.usePointStyle){let s={radius:h*Math.SQRT2/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:a},l=c.xPlus(e,m/2),u=t+f;n.drawPointLegend(i,s,l,u,o.pointStyleWidth&&m)}else{let o=t+Math.max((d-h)/2,0),s=c.leftForLtr(e,m),l=n.toTRBLCorners(r.borderRadius);i.beginPath(),Object.values(l).some(e=>e!==0)?n.addRoundedRectPath(i,{x:s,y:o,w:m,h,radius:l}):i.rect(s,o,m,h),i.fill(),a!==0&&i.stroke()}i.restore()},v=function(e,t,r){n.renderText(i,r.text,e,t+g/2,l,{strikethrough:r.hidden,textAlign:c.textAlign(r.textAlign)})},y=this.isHorizontal(),b=this._computeTitleHeight();p=y?{x:n._alignStartEnd(a,this.left+u,this.right-r[0]),y:this.top+u+b,line:0}:{x:this.left+u,y:n._alignStartEnd(a,this.top+b+u,this.bottom-t[0].height),line:0},n.overrideTextDirection(this.ctx,e.textDirection);let x=g+u;this.legendItems.forEach((s,d)=>{i.strokeStyle=s.fontColor,i.fillStyle=s.fontColor;let h=i.measureText(s.text).width,g=c.textAlign(s.textAlign||(s.textAlign=o.textAlign)),S=m+f+h,C=p.x,w=p.y;if(c.setWidth(this.width),y?d>0&&C+S+u>this.right&&(w=p.y+=x,p.line++,C=p.x=n._alignStartEnd(a,this.left+u,this.right-r[p.line])):d>0&&w+x>this.bottom&&(C=p.x=C+t[p.line].width+u,p.line++,w=p.y=n._alignStartEnd(a,this.top+b+u,this.bottom-t[p.line].height)),_(c.x(C),w,s),C=n._textX(g,C+m+f,y?C+S:this.right,e.rtl),v(c.x(C),w,s),y)p.x+=S+u;else if(typeof s.text!=`string`){let e=l.lineHeight;p.y+=qr(s,e)+u}else p.y+=x}),n.restoreTextDirection(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,r=n.toFont(t.font),i=n.toPadding(t.padding);if(!t.display)return;let a=n.getRtlAdapter(e.rtl,this.left,this.width),o=this.ctx,s=t.position,c=r.size/2,l=i.top+c,u,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+l,d=n._alignStartEnd(e.align,d,this.right-f);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);u=l+n._alignStartEnd(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let p=n._alignStartEnd(s,d,d+f);o.textAlign=a.textAlign(n._toLeftRightCenter(s)),o.textBaseline=`middle`,o.strokeStyle=t.color,o.fillStyle=t.color,o.font=r.string,n.renderText(o,t.text,p,u,r)}_computeTitleHeight(){let e=this.options.title,t=n.toFont(e.font),r=n.toPadding(e.padding);return e.display?t.lineHeight+r.height:0}_getLegendItemAt(e,t){let r,i,a;if(n._isBetween(e,this.left,this.right)&&n._isBetween(t,this.top,this.bottom)){for(a=this.legendHitBoxes,r=0;re.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function Kr(e,t,n){let r=e;return typeof t.text!=`string`&&(r=qr(t,n)),r}function qr(e,t){return t*(e.text?e.text.length:0)}function Jr(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var Yr={id:`legend`,_element:Ur,start(e,t,n){let r=e.legend=new Ur({ctx:e.ctx,options:n,chart:e});U.configure(e,r,n),U.addBox(e,r)},stop(e){U.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;U.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:r,pointStyle:i,textAlign:a,color:o,useBorderRadius:s,borderRadius:c}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let l=e.controller.getStyle(r?0:void 0),u=n.toPadding(l.borderWidth);return{text:t[e.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!e.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:l.borderColor,pointStyle:i||l.pointStyle,rotation:l.rotation,textAlign:a||l.textAlign,borderRadius:s&&(c||l.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}},Xr=class extends K{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){let r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let i=n.isArray(r.text)?r.text.length:1;this._padding=n.toPadding(r.padding);let a=i*n.toFont(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=a:this.width=a}isHorizontal(){let e=this.options.position;return e===`top`||e===`bottom`}_drawArgs(e){let{top:t,left:r,bottom:i,right:a,options:o}=this,s=o.align,c=0,l,u,d;return this.isHorizontal()?(u=n._alignStartEnd(s,r,a),d=t+e,l=a-r):(o.position===`left`?(u=r+e,d=n._alignStartEnd(s,i,t),c=n.PI*-.5):(u=a-e,d=n._alignStartEnd(s,t,i),c=n.PI*.5),l=i-t),{titleX:u,titleY:d,maxWidth:l,rotation:c}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let r=n.toFont(t.font),i=r.lineHeight/2+this._padding.top,{titleX:a,titleY:o,maxWidth:s,rotation:c}=this._drawArgs(i);n.renderText(e,t.text,0,0,r,{color:t.color,maxWidth:s,rotation:c,textAlign:n._toLeftRightCenter(t.align),textBaseline:`middle`,translation:[a,o]})}};function Zr(e,t){let n=new Xr({ctx:e.ctx,options:t,chart:e});U.configure(e,n,t),U.addBox(e,n),e.titleBlock=n}var Qr={id:`title`,_element:Xr,start(e,t,n){Zr(e,n)},stop(e){let t=e.titleBlock;U.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){let r=e.titleBlock;U.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`bold`},fullSize:!0,padding:10,position:`top`,text:``,weight:2e3},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},$r=new WeakMap,ei={id:`subtitle`,start(e,t,n){let r=new Xr({ctx:e.ctx,options:n,chart:e});U.configure(e,r,n),U.addBox(e,r),$r.set(e,r)},stop(e){U.removeBox(e,$r.get(e)),$r.delete(e)},beforeUpdate(e,t,n){let r=$r.get(e);U.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`normal`},fullSize:!0,padding:0,position:`top`,text:``,weight:1500},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},ti={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,a=0;for(t=0,n=e.length;te+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let r=t.x,i=t.y,a=1/0,o,s,c;for(o=0,s=e.length;o-1?e.split(` +`):e}function ii(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function ai(e,t){let r=e.chart.ctx,{body:i,footer:a,title:o}=e,{boxWidth:s,boxHeight:c}=t,l=n.toFont(t.bodyFont),u=n.toFont(t.titleFont),d=n.toFont(t.footerFont),f=o.length,p=a.length,m=i.length,h=n.toPadding(t.padding),g=h.height,_=0,v=i.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(v+=e.beforeBody.length+e.afterBody.length,f&&(g+=f*u.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),v){let e=t.displayColors?Math.max(c,l.lineHeight):l.lineHeight;g+=m*e+(v-m)*l.lineHeight+(v-1)*t.bodySpacing}p&&(g+=t.footerMarginTop+p*d.lineHeight+(p-1)*t.footerSpacing);let y=0,b=function(e){_=Math.max(_,r.measureText(e).width+y)};return r.save(),r.font=u.string,n.each(e.title,b),r.font=l.string,n.each(e.beforeBody.concat(e.afterBody),b),y=t.displayColors?s+2+t.boxPadding:0,n.each(i,e=>{n.each(e.before,b),n.each(e.lines,b),n.each(e.after,b)}),y=0,r.font=d.string,n.each(e.footer,b),r.restore(),_+=h.width,{width:_,height:g}}function oi(e,t){let{y:n,height:r}=t;return ne.height-r/2?`bottom`:`center`}function si(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function ci(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),si(l,e,t,n)&&(l=`center`),l}function li(e,t,n){let r=n.yAlign||t.yAlign||oi(e,n);return{xAlign:n.xAlign||t.xAlign||ci(e,t,n,r),yAlign:r}}function ui(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function di(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:t===`bottom`?r-=i+n:r-=i/2,r}function fi(e,t,r,i){let{caretSize:a,caretPadding:o,cornerRadius:s}=e,{xAlign:c,yAlign:l}=r,u=a+o,{topLeft:d,topRight:f,bottomLeft:p,bottomRight:m}=n.toTRBLCorners(s),h=ui(t,c),g=di(t,l,u);return l===`center`?c===`left`?h+=u:c===`right`&&(h-=u):c===`left`?h-=Math.max(d,p)+a:c===`right`&&(h+=Math.max(f,m)+a),{x:n._limitValue(h,0,i.width-t.width),y:n._limitValue(g,0,i.height-t.height)}}function pi(e,t,r){let i=n.toPadding(r.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-i.right:e.x+i.left}function mi(e){return ni([],ri(e))}function hi(e,t,r){return n.createContext(e,{tooltip:t,tooltipItems:r,type:`tooltip`})}function gi(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var _i={beforeTitle:n.noop,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex{let t={before:[],lines:[],after:[]},n=gi(r,e);ni(t.before,ri(Q(n,`beforeLabel`,this,e))),ni(t.lines,Q(n,`label`,this,e)),ni(t.after,ri(Q(n,`afterLabel`,this,e))),i.push(t)}),i}getAfterBody(e,t){return mi(Q(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Q(n,`beforeFooter`,this,e),i=Q(n,`footer`,this,e),a=Q(n,`afterFooter`,this,e),o=[];return o=ni(o,ri(r)),o=ni(o,ri(i)),o=ni(o,ri(a)),o}_createItems(e){let t=this._active,r=this.chart.data,i=[],a=[],o=[],s=[],c,l;for(c=0,l=t.length;ce.filter(t,n,i,r))),e.itemSort&&(s=s.sort((t,n)=>e.itemSort(t,n,r))),n.each(s,t=>{let n=gi(e.callbacks,t);i.push(Q(n,`labelColor`,this,t)),a.push(Q(n,`labelPointStyle`,this,t)),o.push(Q(n,`labelTextColor`,this,t))}),this.labelColors=i,this.labelPointStyles=a,this.labelTextColors=o,this.dataPoints=s,s}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=ti[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=ai(this,n),o=Object.assign({},e,t),s=li(this.chart,n,o),c=fi(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,r){let{xAlign:i,yAlign:a}=this,{caretSize:o,cornerRadius:s}=r,{topLeft:c,topRight:l,bottomLeft:u,bottomRight:d}=n.toTRBLCorners(s),{x:f,y:p}=e,{width:m,height:h}=t,g,_,v,y,b,x;return a===`center`?(b=p+h/2,i===`left`?(g=f,_=g-o,y=b+o,x=b-o):(g=f+m,_=g+o,y=b-o,x=b+o),v=g):(_=i===`left`?f+Math.max(c,u)+o:i===`right`?f+m-Math.max(l,d)-o:this.caretX,a===`top`?(y=p,b=y-o,g=_-o,v=_+o):(y=p+h,b=y+o,g=_+o,v=_-o),x=y),{x1:g,x2:_,x3:v,y1:y,y2:b,y3:x}}drawTitle(e,t,r){let i=this.title,a=i.length,o,s,c;if(a){let l=n.getRtlAdapter(r.rtl,this.x,this.width);for(e.x=pi(this,r.titleAlign,r),t.textAlign=l.textAlign(r.titleAlign),t.textBaseline=`middle`,o=n.toFont(r.titleFont),s=r.titleSpacing,t.fillStyle=r.titleColor,t.font=o.string,c=0;ce!==0)?(e.beginPath(),e.fillStyle=a.multiKeyBackground,n.addRoundedRectPath(e,{x:t,y:m,w:l,h:c,radius:s}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),n.addRoundedRectPath(e,{x:r,y:m+1,w:l-2,h:c-2,radius:s}),e.fill()):(e.fillStyle=a.multiKeyBackground,e.fillRect(t,m,l,c),e.strokeRect(t,m,l,c),e.fillStyle=o.backgroundColor,e.fillRect(r,m+1,l-2,c-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,t,r){let{body:i}=this,{bodySpacing:a,bodyAlign:o,displayColors:s,boxHeight:c,boxWidth:l,boxPadding:u}=r,d=n.toFont(r.bodyFont),f=d.lineHeight,p=0,m=n.getRtlAdapter(r.rtl,this.x,this.width),h=function(n){t.fillText(n,m.x(e.x+p),e.y+f/2),e.y+=f+a},g=m.textAlign(o),_,v,y,b,x,S,C;for(t.textAlign=o,t.textBaseline=`middle`,t.font=d.string,e.x=pi(this,g,r),t.fillStyle=r.bodyColor,n.each(this.beforeBody,h),p=s&&g!==`right`?o===`center`?l/2+u:l+2+u:0,b=0,S=i.length;b0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=ti[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=ai(this,e),o=Object.assign({},n,this._size),s=li(t,e,o),c=fi(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),r=this.opacity;if(!r)return;this._updateAnimationTarget(t);let i={width:this.width,height:this.height},a={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;let o=n.toPadding(t.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&s&&(e.save(),e.globalAlpha=r,this.drawBackground(a,e,i,t),n.overrideTextDirection(e,t.textDirection),a.y+=o.top,this.drawTitle(a,e,t),this.drawBody(a,e,t),this.drawFooter(a,e,t),n.restoreTextDirection(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let r=this._active,i=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),a=!n._elementsEqual(r,i),o=this._positionChanged(i,t);(a||o)&&(this._active=i,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,r=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let i=this.options,a=this._active||[],o=this._getActiveElements(e,a,t,r),s=this._positionChanged(o,e),c=t||!n._elementsEqual(o,a)||s;return c&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),c}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=ti[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}};t(vi,`positioners`,ti);var yi={id:`tooltip`,_element:vi,positioners:ti,afterInit(e,t,n){n&&(e.tooltip=new vi({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:`average`,backgroundColor:`rgba(0,0,0,0.8)`,titleColor:`#fff`,titleFont:{weight:`bold`},titleSpacing:2,titleMarginBottom:6,titleAlign:`left`,bodyColor:`#fff`,bodySpacing:2,bodyFont:{},bodyAlign:`left`,footerColor:`#fff`,footerSpacing:2,footerMarginTop:6,footerFont:{weight:`bold`},footerAlign:`left`,padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:`#fff`,displayColors:!0,boxPadding:0,borderColor:`rgba(0,0,0,0)`,borderWidth:0,animation:{duration:400,easing:`easeOutQuart`},animations:{numbers:{type:`number`,properties:[`x`,`y`,`width`,`height`,`caretX`,`caretY`]},opacity:{easing:`linear`,duration:200}},callbacks:_i},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]},bi=Object.freeze({__proto__:null,Colors:rr,Decimation:lr,Filler:Br,Legend:Yr,SubTitle:ei,Title:Qr,Tooltip:yi}),xi=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Si(e,t,n,r){let i=e.indexOf(t);return i===-1?xi(e,t,n,r):i===e.lastIndexOf(t)?i:n}var Ci=(e,t)=>e===null?null:n._limitValue(Math.round(e),0,t);function wi(e){let t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};t(Ti,`id`,`category`),t(Ti,`defaults`,{ticks:{callback:wi}});function Ei(e,t){let r=[],{bounds:i,step:a,min:o,max:s,precision:c,count:l,maxTicks:u,maxDigits:d,includeBounds:f}=e,p=a||1,m=u-1,{min:h,max:g}=t,_=!n.isNullOrUndef(o),v=!n.isNullOrUndef(s),y=!n.isNullOrUndef(l),b=(g-h)/(d+1),x=n.niceNum((g-h)/m/p)*p,S,C,w,T;if(x<1e-14&&!_&&!v)return[{value:h},{value:g}];T=Math.ceil(g/x)-Math.floor(h/x),T>m&&(x=n.niceNum(T*x/m/p)*p),n.isNullOrUndef(c)||(S=10**c,x=Math.ceil(x*S)/S),i===`ticks`?(C=Math.floor(h/x)*x,w=Math.ceil(g/x)*x):(C=h,w=g),_&&v&&a&&n.almostWhole((s-o)/a,x/1e3)?(T=Math.round(Math.min((s-o)/x,u)),x=(s-o)/T,C=o,w=s):y?(C=_?o:C,w=v?s:w,T=l-1,x=(w-C)/T):(T=(w-C)/x,T=n.almostEquals(T,Math.round(T),x/1e3)?Math.round(T):Math.ceil(T));let E=Math.max(n._decimalPlaces(x),n._decimalPlaces(C));S=10**(n.isNullOrUndef(c)?E:c),C=Math.round(C*S)/S,w=Math.round(w*S)/S;let D=0;for(_&&(f&&C!==o?(r.push({value:o}),Cs)break;r.push({value:e})}return v&&f&&w!==s?r.length&&n.almostEquals(r[r.length-1].value,s,Di(s,b,e))?r[r.length-1].value=s:r.push({value:s}):(!v||w===s)&&r.push({value:w}),r}function Di(e,t,{horizontal:r,minRotation:i}){let a=n.toRadians(i),o=(r?Math.sin(a):Math.cos(a))||.001,s=.75*t*(``+e).length;return Math.min(t/o,s)}var Oi=class extends wt{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return n.isNullOrUndef(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:r}=this.getUserBounds(),{min:i,max:a}=this,o=e=>i=t?i:e,s=e=>a=r?a:e;if(e){let e=n.sign(i),t=n.sign(a);e<0&&t<0?s(0):e>0&&t>0&&o(0)}if(i===a){let t=a===0?1:Math.abs(a*.05);s(a+t),e||o(i-t)}this.min=i,this.max=a}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,r=this.getTickLimit();r=Math.max(2,r);let i=Ei({maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&n._setMinAndMaxByKey(i,this,`value`),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return n.formatNumber(e,this.chart.options.locale,this.options.ticks.format)}},ki=class extends Oi{determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=n.isNumberFinite(e)?e:0,this.max=n.isNumberFinite(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,r=n.toRadians(this.options.ticks.minRotation),i=(e?Math.sin(r):Math.cos(r))||.001,a=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,a.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}};t(ki,`id`,`linear`),t(ki,`defaults`,{ticks:{callback:n.Ticks.formatters.numeric}});var Ai=e=>Math.floor(n.log10(e)),ji=(e,t)=>10**(Ai(e)+t);function Mi(e){return e/10**Ai(e)==1}function Ni(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function Pi(e,t){let n=Ai(t-e);for(;Ni(e,t,n)>10;)n++;for(;Ni(e,t,n)<10;)n--;return Math.min(n,Ai(e))}function Fi(e,{min:t,max:r}){t=n.finiteOrDefault(e.min,t);let i=[],a=Ai(t),o=Pi(t,r),s=o<0?10**Math.abs(o):1,c=10**o,l=a>o?10**a:0,u=Math.round((t-l)*s)/s,d=Math.floor((t-l)/c/10)*c*10,f=Math.floor((u-d)/10**o),p=n.finiteOrDefault(e.min,Math.round((l+d+f*10**o)*s)/s);for(;p=10?f=f<15?15:20:f++,f>=20&&(o++,f=2,s=o>=0?1:s),p=Math.round((l+d+f*10**o)*s)/s;let m=n.finiteOrDefault(e.max,p);return i.push({value:m,major:Mi(m),significand:f}),i}var Ii=class extends wt{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let r=Oi.prototype.parse.apply(this,[e,t]);if(r===0){this._zero=!0;return}return n.isNumberFinite(r)&&r>0?r:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=n.isNumberFinite(e)?Math.max(0,e):null,this.max=n.isNumberFinite(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!n.isNumberFinite(this._userMin)&&(this.min=e===ji(this.min,0)?ji(this.min,-1):ji(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(ji(n,-1)),a(ji(r,1)))),n<=0&&i(ji(r,-1)),r<=0&&a(ji(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=Fi({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&n._setMinAndMaxByKey(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:n.formatNumber(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=n.log10(e),this._valueRange=n.log10(this.max)-n.log10(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(n.log10(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}};t(Ii,`id`,`logarithmic`),t(Ii,`defaults`,{ticks:{callback:n.Ticks.formatters.logarithmic,major:{enabled:!0}}});function Li(e){let t=e.ticks;if(t.display&&e.display){let e=n.toPadding(t.backdropPadding);return n.valueOrDefault(t.font&&t.font.size,n.defaults.font.size)+e.height}return 0}function Ri(e,t,r){return r=n.isArray(r)?r:[r],{w:n._longestText(e,t.string,r),h:r.length*t.lineHeight}}function zi(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:ei?{start:t-n,end:t}:{start:t,end:t+n}}function Bi(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},r=Object.assign({},t),i=[],a=[],o=e._pointLabels.length,s=e.options.pointLabels,c=s.centerPointLabels?n.PI/o:0;for(let l=0;lt.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.startt.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function Hi(e,t,r){let i=e.drawingArea,{extra:a,additionalAngle:o,padding:s,size:c}=r,l=e.getPointPosition(t,i+a+s,o),u=Math.round(n.toDegrees(n._normalizeAngle(l.angle+n.HALF_PI))),d=qi(l.y,c.h,u),f=Gi(u),p=Ki(l.x,c.w,f);return{visible:!0,x:l.x,y:d,textAlign:f,left:p,top:d,right:p+c.w,bottom:d+c.h}}function Ui(e,t){if(!t)return!0;let{left:r,top:i,right:a,bottom:o}=e;return!(n._isPointInArea({x:r,y:i},t)||n._isPointInArea({x:r,y:o},t)||n._isPointInArea({x:a,y:i},t)||n._isPointInArea({x:a,y:o},t))}function Wi(e,t,r){let i=[],a=e._pointLabels.length,o=e.options,{centerPointLabels:s,display:c}=o.pointLabels,l={extra:Li(o)/2,additionalAngle:s?n.PI/a:0},u;for(let n=0;n270||n<90)&&(e-=t),e}function Ji(e,t,r){let{left:i,top:a,right:o,bottom:s}=r,{backdropColor:c}=t;if(!n.isNullOrUndef(c)){let r=n.toTRBLCorners(t.borderRadius),l=n.toPadding(t.backdropPadding);e.fillStyle=c;let u=i-l.left,d=a-l.top,f=o-i+l.width,p=s-a+l.height;Object.values(r).some(e=>e!==0)?(e.beginPath(),n.addRoundedRectPath(e,{x:u,y:d,w:f,h:p,radius:r}),e.fill()):e.fillRect(u,d,f,p)}}function Yi(e,t){let{ctx:r,options:{pointLabels:i}}=e;for(let a=t-1;a>=0;a--){let t=e._pointLabelItems[a];if(!t.visible)continue;let o=i.setContext(e.getPointLabelContext(a));Ji(r,o,t);let s=n.toFont(o.font),{x:c,y:l,textAlign:u}=t;n.renderText(r,e._pointLabels[a],c,l+s.lineHeight/2,s,{color:o.color,textAlign:u,textBaseline:`middle`})}}function Xi(e,t,r,i){let{ctx:a}=e;if(r)a.arc(e.xCenter,e.yCenter,t,0,n.TAU);else{let n=e.getPointPosition(0,t);a.moveTo(n.x,n.y);for(let r=1;r{let r=n.callback(this.options.pointLabels.callback,[e,t],this);return r||r===0?r:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?Bi(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=n.TAU/(this._pointLabels.length||1),r=this.options.startAngle||0;return n._normalizeAngle(e*t+n.toRadians(r))}getDistanceFromCenterForValue(e){if(n.isNullOrUndef(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(n.isNullOrUndef(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);Zi(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;!a||!i||(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,r=t.ticks;if(!r.display)return;let i=this.getIndexAngle(0),a,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(i),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((i,s)=>{if(s===0&&this.min>=0&&!t.reverse)return;let c=r.setContext(this.getContext(s)),l=n.toFont(c.font);if(a=this.getDistanceFromCenterForValue(this.ticks[s].value),c.showLabelBackdrop){e.font=l.string,o=e.measureText(i.label).width,e.fillStyle=c.backdropColor;let t=n.toPadding(c.backdropPadding);e.fillRect(-o/2-t.left,-a-l.size/2-t.top,o+t.width,l.size+t.height)}n.renderText(e,i.label,0,-a,l,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),e.restore()}drawTitle(){}};t($,`id`,`radialLinear`),t($,`defaults`,{display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:n.Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),t($,`defaultRoutes`,{"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`}),t($,`descriptors`,{angleLines:{_fallback:`grid`}});var $i={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ea=Object.keys($i);function ta(e,t){return e-t}function na(e,t){if(n.isNullOrUndef(t))return null;let r=e._adapter,{parser:i,round:a,isoWeekday:o}=e._parseOpts,s=t;return typeof i==`function`&&(s=i(s)),n.isNumberFinite(s)||(s=typeof i==`string`?r.parse(s,i):r.parse(s)),s===null?null:(a&&(s=a===`week`&&(n.isNumber(o)||o===!0)?r.startOf(s,`isoWeek`,o):r.startOf(s,a)),+s)}function ra(e,t,n,r){let i=ea.length;for(let a=ea.indexOf(e);a=ea.indexOf(n);a--){let n=ea[a];if($i[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return ea[n?ea.indexOf(n):0]}function aa(e){for(let t=ea.indexOf(e)+1,n=ea.length;t=t?r[i]:r[a];e[o]=!0}}function sa(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function ca(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o+e.value))}initOffsets(e=[]){let t=0,r=0,i,a;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),t=e.length===1?1-i:(this.getDecimalForValue(e[1])-i)/2,a=this.getDecimalForValue(e[e.length-1]),r=e.length===1?a:(a-this.getDecimalForValue(e[e.length-2]))/2);let o=e.length<3?.5:.25;t=n._limitValue(t,0,o),r=n._limitValue(r,0,o),this._offsets={start:t,end:r,factor:1/(t+1+r)}}_generate(){let e=this._adapter,t=this.min,r=this.max,i=this.options,a=i.time,o=a.unit||ra(a.minUnit,t,r,this._getLabelCapacity(t)),s=n.valueOrDefault(i.ticks.stepSize,1),c=o===`week`?a.isoWeekday:!1,l=n.isNumber(c)||c===!0,u={},d=t,f,p;if(l&&(d=+e.startOf(d,`isoWeek`,c)),d=+e.startOf(d,l?`day`:o),e.diff(r,t,o)>1e5*s)throw Error(t+` and `+r+` are too far apart with stepSize of `+s+` `+o);let m=i.ticks.source===`data`&&this.getDataTimestamps();for(f=d,p=0;f+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,r,i){let a=this.options,o=a.ticks.callback;if(o)return n.callback(o,[e,t,r],this);let s=a.time.displayFormats,c=this._unit,l=this._majorUnit,u=c&&s[c],d=l&&s[l],f=r[t],p=l&&d&&f&&f.major;return this._adapter.format(e,i||(p?d:u))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t=e[i].pos&&t<=e[a].pos&&({lo:i,hi:a}=n._lookupByKey(e,`pos`,t)),{pos:o,time:c}=e[i],{pos:s,time:l}=e[a]):(t>=e[i].time&&t<=e[a].time&&({lo:i,hi:a}=n._lookupByKey(e,`time`,t)),{time:o,pos:c}=e[i],{time:s,pos:l}=e[a]);let u=s-o;return u?c+(l-c)*(t-o)/u:c}var da=class extends la{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=ua(t,this.min),this._tableRange=ua(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;ae-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(ua(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return ua(this._table,n*this._tableRange+this._minPos,!0)}};t(da,`id`,`timeseries`),t(da,`defaults`,la.defaults);var fa=Object.freeze({__proto__:null,CategoryScale:Ti,LinearScale:ki,LogarithmicScale:Ii,RadialLinearScale:$,TimeScale:la,TimeSeriesScale:da}),pa=[I,Gn,bi,fa];e.Ticks=n.Ticks,e.defaults=n.defaults,e.Animation=o,e.Animations=s,e.ArcElement=yn,e.BarController=fe,e.BarElement=Wn,e.BasePlatform=ze,e.BasicPlatform=Be,e.BubbleController=pe,e.CategoryScale=Ti,e.Chart=Y,e.Colors=rr,e.DatasetController=k,e.Decimation=lr,e.DomPlatform=it,e.DoughnutController=he,e.Element=K,e.Filler=Br,e.Interaction=we,e.Legend=Yr,e.LineController=ge,e.LineElement=Mn,e.LinearScale=ki,e.LogarithmicScale=Ii,e.PieController=N,e.PointElement=Pn,e.PolarAreaController=_e,e.RadarController=P,e.RadialLinearScale=$,e.Scale=wt,e.ScatterController=F,e.SubTitle=ei,e.TimeScale=la,e.TimeSeriesScale=da,e.Title=Qr,e.Tooltip=yi,e._adapters=R,e._detectPlatform=at,e.animator=r,e.controllers=I,e.elements=Gn,e.layouts=U,e.plugins=bi,e.registerables=pa,e.registry=kt,e.scales=fa})),Wl=t(((e,t)=>{var n=Ul(),{Chart:r,registerables:i}=n;r.register(...i),t.exports=Object.assign(r,n)})),Gl=e(r()),Kl={},ql;function Jl(){if(ql)return Kl;ql=1;class e{constructor(e=`Default`){this.category=e,this.logElement=null,this.logHistory=[]}init(){this.logElement=document.getElementById(`log`)}log(e,t,n,r=null){let i=new Date().toISOString().split(`T`)[1].split(`.`)[0],a={timestamp:i,level:e.toUpperCase(),category:t,message:n,data:r};this.logHistory.push(a);let o=`[${t}] ${n}`;if(!new Set([`PPTXSlideRenderer`,`PPTXProcessor`,`Thumbnail Debug`]).has(t))switch(e.toLowerCase()){case`error`:console.error(o,r);break;case`warn`:console.warn(o,r);break;case`info`:console.info(o,r);break;case`debug`:console.debug(o,r);break;default:console.log(o,r)}if(this.logElement){let a=r?` | ${JSON.stringify(r)}`:``,o=`[${i}] [${e.toUpperCase()}] [${t}] ${n}${a}\n`;this.logElement.textContent+=o,this.logElement.scrollTop=this.logElement.scrollHeight}}debug(e,t,n=null){this.log(`debug`,e,t,n)}info(e,t,n=null){this.log(`info`,e,t,n)}warn(e,t,n=null){this.log(`warn`,e,t,n)}error(e,t,n=null){this.log(`error`,e,t,n)}trace(e,t,n=null){this.log(`trace`,e,t,n)}logError(e,t){let n=`Unknown error`,r={};t&&typeof t==`object`?(n=t.message||t.toString()||`Unknown error`,r={stack:t.stack,name:t.name||`Error`}):n=typeof t==`string`?t:String(t),this.log(`error`,e,n,r)}markTiming(e){if(typeof window<`u`&&window.getGlobalMonitor)window.getGlobalMonitor().start(e,{category:this.category});else if(typeof performance<`u`&&performance.mark)try{performance.mark(e)}catch{console.time(e)}}measureTiming(e){if(typeof window<`u`&&window.getGlobalMonitor){let t=window.getGlobalMonitor().end(e,{category:this.category});t&&this.log(`trace`,this.category,`${e} completed in ${Math.round(t.duration)}ms`)}else if(typeof performance<`u`&&performance.mark)try{performance.measure(e);let t=performance.getEntriesByName(e,`measure`);if(t.length>0){let n=Math.round(t[t.length-1].duration);this.log(`trace`,this.category,`${e} completed in ${n}ms`)}}catch{console.timeEnd(e)}}}let t=new e;class r{constructor(){this.steps={1:{name:`ZIP Processing`,progress:0},2:{name:`XML Parsing`,progress:0},3:{name:`DOM Creation`,progress:0},4:{name:`Canvas Rendering`,progress:0}}}updateProgress(e,t){if(this.steps[e]){this.steps[e].progress=Math.min(100,Math.max(0,t));let n=document.getElementById(`progress${e}`),r=document.getElementById(`step${e}`);n&&(n.style.width=`${this.steps[e].progress}%`),r&&(r.classList.remove(`active`,`processing`),t>=100?r.classList.add(`active`):t>0&&r.classList.add(`processing`))}}reset(){for(let e in this.steps)this.updateProgress(parseInt(e),0)}}let i=new r;class a{static async readAsArrayBuffer(e,t={}){if(!e||!(e instanceof File||e instanceof Blob))throw Error(`Invalid file parameter: must be File or Blob instance`);if(e.size===0)throw Error(`Cannot read empty file`);let{maxSize:n=100*1024*1024,timeout:r=8e4}=t;if(e.size>n)throw Error(`File too large: ${e.size} bytes (max: ${n} bytes)`);return new Promise((t,n)=>{let i=new window.FileReader,a=setTimeout(()=>{i.abort(),n(Error(`File reading timed out after ${r}ms`))},r);i.onload=e=>{clearTimeout(a);let r=e.target?.result;r instanceof ArrayBuffer?t(r):n(Error(`Failed to read file as ArrayBuffer`))},i.onerror=()=>{clearTimeout(a);let e=i.error||Error(`Unknown file reading error`);n(Error(`Failed to read file: ${e.message}`))},i.onabort=()=>{clearTimeout(a),n(Error(`File reading was aborted`))};try{i.readAsArrayBuffer(e)}catch(e){clearTimeout(a),n(Error(`Failed to start file reading: ${e.message}`))}})}static async readAsText(e,t={}){if(!e||!(e instanceof File||e instanceof Blob))throw Error(`Invalid file parameter: must be File or Blob instance`);let{encoding:n=`UTF-8`,maxSize:r=50*1024*1024,timeout:i=8e4,validateText:a=!0}=t;if(e.size>r)throw Error(`File too large: ${e.size} bytes (max: ${r} bytes)`);return new Promise((t,r)=>{let o=new window.FileReader,s=setTimeout(()=>{o.abort(),r(Error(`File reading timed out after ${i}ms`))},i);o.onload=e=>{clearTimeout(s);let n=e.target?.result;if(typeof n==`string`){if(a&&n.includes(`�`)){r(Error(`File contains invalid characters - may not be a text file`));return}t(n)}else r(Error(`Failed to read file as text`))},o.onerror=()=>{clearTimeout(s);let e=o.error||Error(`Unknown file reading error`);r(Error(`Failed to read file as text: ${e.message}`))},o.onabort=()=>{clearTimeout(s),r(Error(`File reading was aborted`))};try{o.readAsText(e,n)}catch(e){clearTimeout(s),r(Error(`Failed to start file reading: ${e.message}`))}})}static async readAsDataURL(e,t={}){if(!e||!(e instanceof File||e instanceof Blob))throw Error(`Invalid file parameter: must be File or Blob instance`);let{maxSize:n=10*1024*1024,timeout:r=8e4}=t;if(e.size>n)throw Error(`File too large for Data URL: ${e.size} bytes (max: ${n} bytes)`);return new Promise((t,n)=>{let i=new window.FileReader,a=setTimeout(()=>{i.abort(),n(Error(`File reading timed out after ${r}ms`))},r);i.onload=e=>{clearTimeout(a);let r=e.target?.result;typeof r==`string`&&r.startsWith(`data:`)?t(r):n(Error(`Failed to read file as Data URL`))},i.onerror=()=>{clearTimeout(a);let e=i.error||Error(`Unknown file reading error`);n(Error(`Failed to read file as Data URL: ${e.message}`))},i.onabort=()=>{clearTimeout(a),n(Error(`File reading was aborted`))};try{i.readAsDataURL(e)}catch(e){clearTimeout(a),n(Error(`Failed to start file reading: ${e.message}`))}})}static async readMultipleFiles(e,t=`arrayBuffer`,n={}){if(!Array.isArray(e)||e.length===0)throw Error(`Invalid files parameter: must be non-empty array`);let{onProgress:r=null,maxConcurrent:i=3,...a}=n,o=this[`readAs${t.charAt(0).toUpperCase()+t.slice(1)}`];if(!o)throw Error(`Invalid read type: ${t}`);let s=[],c=0;for(let t=0;t{try{let s=await o.call(this,n,a);return c++,r&&r({completed:c,total:e.length,progress:c/e.length*100,currentFile:n.name||`File ${t+i+1}`}),s}catch(a){throw c++,r&&r({completed:c,total:e.length,progress:c/e.length*100,currentFile:n.name||`File ${t+i+1}`,error:a.message}),a}}),l=await Promise.all(n);s.push(...l)}return s}}let o=a;class s{static handle(e,t={}){let{context:n=`Unknown`,severity:r=this.SEVERITY_LEVELS.MEDIUM,displayToUser:i=!0,logToConsole:a=!0,throwAfterHandle:o=!1,customHandler:s=null}=t,c=this.normalizeError(e,n);if(a&&this.logError(c,r),i&&this.displayError(c,r),s&&typeof s==`function`)try{s(c,r)}catch(e){console.error(`Error in custom error handler:`,e)}if(o)throw e instanceof Error?e:Error(c.message);return c}static normalizeError(e,t){let n=`Unknown error occurred`,r=null,i=this.ERROR_TYPES.UNKNOWN,a=e;return e instanceof Error?(n=e.message||`Error occurred`,r=e.stack,i=e.name||this.categorizeError(e)):typeof e==`string`?n=e:e&&typeof e==`object`?(n=e.message||e.toString()||`Object error`,r=e.stack,i=e.name||this.ERROR_TYPES.UNKNOWN):n=String(e),{message:n,context:t,stack:r,name:i,timestamp:new Date().toISOString(),originalError:a,userAgent:navigator?.userAgent||`Unknown`}}static categorizeError(e){let t=e.message?.toLowerCase()||``;return t.includes(`validation`)||t.includes(`invalid`)?this.ERROR_TYPES.VALIDATION:t.includes(`file`)||t.includes(`read`)||t.includes(`write`)?this.ERROR_TYPES.FILE_IO:t.includes(`parse`)||t.includes(`xml`)||t.includes(`json`)?this.ERROR_TYPES.PARSING:t.includes(`render`)||t.includes(`canvas`)||t.includes(`draw`)?this.ERROR_TYPES.RENDERING:t.includes(`network`)||t.includes(`fetch`)||t.includes(`load`)?this.ERROR_TYPES.NETWORK:t.includes(`timeout`)||t.includes(`timed out`)?this.ERROR_TYPES.TIMEOUT:t.includes(`memory`)||t.includes(`allocation`)?this.ERROR_TYPES.MEMORY:this.ERROR_TYPES.UNKNOWN}static logError(e,t){let n=`[${e.context}] ${e.message}`;switch(t){case this.SEVERITY_LEVELS.LOW:console.info(`🔵`,n,e);break;case this.SEVERITY_LEVELS.MEDIUM:console.warn(`🟡`,n,e);break;case this.SEVERITY_LEVELS.HIGH:console.error(`🔴`,n,e);break;case this.SEVERITY_LEVELS.CRITICAL:console.error(`💥`,n,e),e.stack&&console.error(`Stack trace:`,e.stack);break;default:console.log(n,e)}}static displayError(e,t){let n=document.getElementById(`output`);if(!n)return;let r=document.createElement(`div`);r.className=`error error--${t}`;let i=document.createElement(`div`);i.className=`error__header`,i.innerHTML=` + ${this.getSeverityIcon(t)} + Error in ${e.context} + ${e.name} + `;let a=document.createElement(`div`);a.className=`error__message`,a.textContent=e.message;let o=document.createElement(`div`);o.className=`error__time`,o.textContent=new Date(e.timestamp).toLocaleTimeString(),r.appendChild(i),r.appendChild(a),r.appendChild(o);let s=document.createElement(`button`);s.className=`error__dismiss`,s.innerHTML=`×`,s.onclick=()=>r.remove(),r.appendChild(s),r.style.transform=`translateY(-100%)`,r.style.transition=`transform 0.3s ease-in-out`,n.insertBefore(r,n.firstChild),requestAnimationFrame(()=>{r.style.transform=`translateY(0)`});let c=this.getAutoDismissTime(t);c>0&&setTimeout(()=>{r.parentNode&&(r.style.transform=`translateY(-100%)`,setTimeout(()=>r.remove(),300))},c)}static getSeverityIcon(e){switch(e){case this.SEVERITY_LEVELS.LOW:return`ℹ️`;case this.SEVERITY_LEVELS.MEDIUM:return`⚠️`;case this.SEVERITY_LEVELS.HIGH:return`❌`;case this.SEVERITY_LEVELS.CRITICAL:return`💥`;default:return`❓`}}static getAutoDismissTime(e){switch(e){case this.SEVERITY_LEVELS.LOW:return 3e3;case this.SEVERITY_LEVELS.MEDIUM:return 5e3;case this.SEVERITY_LEVELS.HIGH:return 8e3;case this.SEVERITY_LEVELS.CRITICAL:return 0;default:return 5e3}}static createError(e,t={}){let{name:n=this.ERROR_TYPES.UNKNOWN,context:r=`Unknown`,cause:i=null,code:a=null,details:o=null}=t,s=Error(e);return s.name=n,s.context=r,s.timestamp=new Date().toISOString(),i&&(s.cause=i),a&&(s.code=a),o&&(s.details=o),s}}n(s,`ERROR_TYPES`,{VALIDATION:`ValidationError`,FILE_IO:`FileIOError`,PARSING:`ParsingError`,RENDERING:`RenderingError`,NETWORK:`NetworkError`,TIMEOUT:`TimeoutError`,MEMORY:`MemoryError`,UNKNOWN:`UnknownError`}),n(s,`SEVERITY_LEVELS`,{LOW:`low`,MEDIUM:`medium`,HIGH:`high`,CRITICAL:`critical`});class c{static validateInput(e,t,n={}){if(typeof e!=`number`||!isFinite(e))throw s.createError(`Invalid ${t} value: must be a finite number`,{name:s.ERROR_TYPES.VALIDATION,context:`CoordinateTransform`});let{min:r=-1/0,max:i=1/0}=n;if(ei)throw s.createError(`${t} value out of range: ${e} (valid range: ${r} to ${i})`,{name:s.ERROR_TYPES.VALIDATION,context:`CoordinateTransform`});return e}static emuToMM(e){return this.validateInput(e,`EMU`,{min:this.VALIDATION.MIN_EMU,max:this.VALIDATION.MAX_EMU})/this.UNITS.EMU_PER_MM}static mmToEMU(e){let t=this.validateInput(e,`MM`,{min:-this.VALIDATION.MAX_MM,max:this.VALIDATION.MAX_MM})*this.UNITS.EMU_PER_MM;return Math.max(this.VALIDATION.MIN_EMU,Math.min(this.VALIDATION.MAX_EMU,Math.round(t)))}static emuToPoints(e){return this.validateInput(e,`EMU`,{min:this.VALIDATION.MIN_EMU,max:this.VALIDATION.MAX_EMU})/this.UNITS.EMU_PER_POINT}static pointsToEMU(e){let t=this.validateInput(e,`Points`,{min:-3e4,max:3e4})*this.UNITS.EMU_PER_POINT;return Math.max(this.VALIDATION.MIN_EMU,Math.min(this.VALIDATION.MAX_EMU,Math.round(t)))}static emuToPixels(e,t=96){let n=this.validateInput(e,`EMU`,{min:this.VALIDATION.MIN_EMU,max:this.VALIDATION.MAX_EMU}),r=this.validateInput(t,`DPI`,{min:this.VALIDATION.MIN_DPI,max:this.VALIDATION.MAX_DPI}),i=n/this.UNITS.EMU_PER_INCH;return Math.round(i*r)}static pixelsToEMU(e,t=96){let n=this.validateInput(e,`Pixels`,{min:-this.VALIDATION.MAX_PIXELS,max:this.VALIDATION.MAX_PIXELS})/this.validateInput(t,`DPI`,{min:this.VALIDATION.MIN_DPI,max:this.VALIDATION.MAX_DPI})*this.UNITS.EMU_PER_INCH;return Math.max(this.VALIDATION.MIN_EMU,Math.min(this.VALIDATION.MAX_EMU,Math.round(n)))}static mmToPixels(e,t=96){let n=this.validateInput(e,`MM`,{min:-this.VALIDATION.MAX_MM,max:this.VALIDATION.MAX_MM}),r=this.validateInput(t,`DPI`,{min:this.VALIDATION.MIN_DPI,max:this.VALIDATION.MAX_DPI}),i=n*this.UNITS.INCHES_PER_MM;return Math.round(i*r)}static pixelsToMM(e,t=96){return this.validateInput(e,`Pixels`,{min:-this.VALIDATION.MAX_PIXELS,max:this.VALIDATION.MAX_PIXELS})/this.validateInput(t,`DPI`,{min:this.VALIDATION.MIN_DPI,max:this.VALIDATION.MAX_DPI})*this.UNITS.MM_PER_INCH}static convert(e,t,n,r=96){if(t===n)return e;let i=t.toLowerCase(),a=n.toLowerCase(),o;switch(i){case`emu`:o=e;break;case`mm`:o=this.mmToEMU(e);break;case`pixels`:case`px`:o=this.pixelsToEMU(e,r);break;case`points`:case`pt`:o=this.pointsToEMU(e);break;case`inches`:case`in`:let n=this.validateInput(e,`Inches`,{min:-100,max:100});o=Math.round(n*this.UNITS.EMU_PER_INCH);break;default:throw s.createError(`Unsupported source unit: ${t}`,{name:s.ERROR_TYPES.VALIDATION,context:`CoordinateTransform`})}switch(a){case`emu`:return o;case`mm`:return this.emuToMM(o);case`pixels`:case`px`:return this.emuToPixels(o,r);case`points`:case`pt`:return this.emuToPoints(o);case`inches`:case`in`:return o/this.UNITS.EMU_PER_INCH;default:throw s.createError(`Unsupported target unit: ${n}`,{name:s.ERROR_TYPES.VALIDATION,context:`CoordinateTransform`})}}static convertBatch(e,t,n,r=96){if(!Array.isArray(e))throw s.createError(`Values must be an array`,{name:s.ERROR_TYPES.VALIDATION,context:`CoordinateTransform`});return e.map(e=>this.convert(e,t,n,r))}static getConversionFactor(e,t,n=96){return this.convert(1,e,t,n)}}n(c,`UNITS`,{EMU_PER_INCH:914400,EMU_PER_CM:36e4,EMU_PER_MM:36e3,EMU_PER_POINT:12700,INCHES_PER_MM:1/25.4,MM_PER_INCH:25.4,POINTS_PER_INCH:72}),n(c,`VALIDATION`,{MAX_EMU:2147483647,MIN_EMU:-2147483648,MAX_PIXELS:32767,MAX_MM:59652,MIN_DPI:1,MAX_DPI:600});class l{static decodeXMLEntities(e){if(!e)return e;let t={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`};return e.replace(/&[a-zA-Z0-9#]+;/g,e=>t[e]||e)}static encodeXMLEntities(e){return e&&e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}static extractNamespace(e){let t=e.indexOf(`:`);return t===-1?``:e.substring(0,t)}static extractLocalName(e){let t=e.indexOf(`:`);return t===-1?e:e.substring(t+1)}}class u{static getAttributeValue(e,t){return e.getAttribute?e.getAttribute(t):null}static getChildElements(e){return e.children?Array.from(e.children):[]}static getElementByTagName(e,t){if(!e.getElementsByTagName)return null;let n=e.getElementsByTagName(t);return n.length>0?n[0]:null}static getElementsByTagName(e,t){return e.getElementsByTagName?Array.from(e.getElementsByTagName(t)):[]}static getTextContent(e){return e.textContent||e.innerText||``}}class d{static easeInOut(e){return e<.5?2*e*e:-1+(4-2*e)*e}static animate(e,t,n=null){let r=performance.now();function i(a){let o=a-r,s=Math.min(o/e,1);t(s),s<1?requestAnimationFrame(i):n&&n()}requestAnimationFrame(i)}}document.addEventListener(`DOMContentLoaded`,function(){t.init()});let f=null;if(typeof window<`u`)try{window.PerformanceMonitor&&(f=new window.PerformanceMonitor({enabled:!0,collectMemoryData:!0,enableConsoleReports:!1,maxHistoryEntries:500}),window.performanceMonitor=f)}catch{}class p extends e{constructor(e){super(e),this.performanceMonitor=f}startPerformance(e,t={}){this.performanceMonitor&&this.performanceMonitor.start(e,{...t,category:this.category}),this.markTiming(e)}endPerformance(e,t={}){if(this.performanceMonitor){let n=this.performanceMonitor.end(e,{...t,category:this.category});if(n){let t=Math.round(n.duration*100)/100;this.trace(this.category,`${e} completed in ${t}ms`,{duration:t,memoryUsage:n.memorySnapshot?.jsHeapSize}),t>1e3&&this.warn(this.category,`Slow operation detected: ${e} took ${t}ms`)}}this.measureTiming(e)}measureSync(e,t,n={}){if(this.performanceMonitor){let{result:r,measure:i}=this.performanceMonitor.measure(e,t,{...n,category:this.category});if(i){let t=Math.round(i.duration*100)/100;this.trace(this.category,`${e} completed in ${t}ms`)}return r}else{this.startPerformance(e,n);try{let r=t();return this.endPerformance(e,n),r}catch(t){throw this.endPerformance(e,{...n,error:!0}),t}}}async measureAsync(e,t,n={}){if(this.performanceMonitor){let{result:r,measure:i}=await this.performanceMonitor.measureAsync(e,t,{...n,category:this.category});if(i){let t=Math.round(i.duration*100)/100;this.trace(this.category,`${e} completed in ${t}ms`)}return r}else{this.startPerformance(e,n);try{let r=await t();return this.endPerformance(e,n),r}catch(t){throw this.endPerformance(e,{...n,error:!0}),t}}}getPerformanceStats(){if(!this.performanceMonitor)return null;let e=this.performanceMonitor.getHistory().filter(e=>e.startMetadata?.category===this.category||e.endMetadata?.category===this.category);if(e.length===0)return{category:this.category,operations:0};let t=e.reduce((e,t)=>e+t.duration,0),n=t/e.length,r=e.reduce((e,t)=>t.duration>e.duration?t:e),i=e.reduce((e,t)=>t.duration=3)return{r:Number(t[0]),g:Number(t[1]),b:Number(t[2])}}return{r:0,g:0,b:0}}_normalizeFontConfig(e){return{fontFamily:e.fontFamily||e.family||`Calibri`,fontSize:Math.max(6,Math.min(120,Number(e.fontSize||e.size||11))),bold:!!e.bold,italic:!!e.italic,color:this._normalizeColor(e.color)}}_getFallbackFont(){return{fontFamily:`Arial, sans-serif`,fontSize:11,bold:!1,italic:!1,color:{r:0,g:0,b:0}}}_getCurrentDpi(){try{return 96*(typeof window<`u`&&window.devicePixelRatio||1)}catch{return 96}}_createFallbackLogger(){return{debug:(...e)=>{},info:(...e)=>{},warn:(...e)=>{},error:(...e)=>{}}}_validateOptions(e){return{enableResponsiveScaling:e.enableResponsiveScaling!==!1,enableDpiScaling:e.enableDpiScaling!==!1,enablePptxOverrides:e.enablePptxOverrides!==!1,logLevel:e.logLevel||`warn`,...e}}setElementDefault(e,t){this.defaults[e]?(this.defaults[e]={...this.defaults[e],...this._normalizeFontConfig(t)},this.logger.log(`info`,this.constructor.name,`Updated default font for ${e}`)):this.logger.log(`warn`,this.constructor.name,`Unknown element type: ${e}`)}getElementTypes(){return Object.keys(this.defaults)}toCssString(e){let t=this._normalizeFontConfig(e);return`${t.italic?`italic `:``}${t.bold?`bold `:``}${t.fontSize}px ${t.fontFamily}`}toColorString(e){let t=this._normalizeColor(e.color);return`rgb(${t.r}, ${t.g}, ${t.b})`}}typeof window<`u`&&(window.ChartFontConfig=t),e.exports&&(e.exports={ChartFontConfig:t})})(Yl),Yl.exports)}Zl();var Ql={},$l;function eu(){if($l)return Ql;$l=1;async function e(){if(typeof window<`u`&&window.JSZip&&typeof window.JSZip.loadAsync==`function`)return window.JSZip;if(typeof globalThis<`u`&&globalThis.JSZip&&typeof globalThis.JSZip.loadAsync==`function`)return globalThis.JSZip;try{let e=r();if(e&&typeof e.loadAsync==`function`)return e;if(e&&e.default&&typeof e.default.loadAsync==`function`)return e.default}catch{}if(typeof document<`u`&&(await new Promise((e,t)=>{let n=document.createElement(`script`);n.src=`https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js`,n.onload=()=>e(),n.onerror=()=>t(Error(`Failed to load JSZip`)),document.head.appendChild(n)}),window.JSZip))return window.JSZip;throw Error(`JSZip is not available`)}class t{constructor(){this.engine=null,this.files={},this.isModuleInit=!0,typeof Logger<`u`?this.logger=new Logger(`ZLib`):typeof window<`u`&&window.Logger?this.logger=new window.Logger(`ZLib`):typeof globalThis<`u`&&globalThis.Logger?this.logger=new globalThis.Logger(`ZLib`):this.logger={info:()=>{},debug:()=>{},warn:()=>{},error:()=>{},log:()=>{},logError:()=>{}},this.isOpen=!1,this.lastError=null}validateInput(e,t){return e==null?(this.lastError=Error(`${t}: Input data is null or undefined`),!1):!(e instanceof ArrayBuffer)&&!(e instanceof Uint8Array)&&!(e instanceof Blob)?(this.lastError=Error(`${t}: Invalid data type. Expected ArrayBuffer, Uint8Array, or Blob`),!1):e.byteLength===0||e.size!==void 0&&e.size===0?(this.lastError=Error(`${t}: Input data is empty`),!1):!0}async open(t){try{if(this.isOpen=!1,this.lastError=null,!this.validateInput(t,`open`))return this.logger.logError(`ZLib`,`Failed to open ZIP:`,this.lastError.message),!1;let n=await e(),r=t;if(t instanceof Uint8Array&&(r=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),this.engine=await n.loadAsync(r),!this.engine)return this.lastError=Error(`Failed to create JSZip instance`),this.logger.logError(`ZLib`,`Failed to open ZIP:`,this.lastError.message),!1;this.files={};let i=0;return this.engine.forEach((e,t)=>{t.dir||(this.files[e]=null,i++)}),i===0&&(this.lastError=Error(`ZIP file contains no readable files`),this.logger.log(`warn`,`ZLib`,`Opened ZIP file has no readable files`)),this.isOpen=!0,!0}catch(e){return this.lastError=e,this.isOpen=!1,this.logger.logError(`ZLib`,`Failed to open ZIP:`,e.message),e.message.includes(`End of central directory not found`)?this.logger.logError(`ZLib`,`Invalid ZIP file: corrupted or not a ZIP file`):e.message.includes(`encrypted`)?this.logger.logError(`ZLib`,`Cannot open encrypted ZIP files`):e.message.includes(`Unsupported compression`)&&this.logger.logError(`ZLib`,`ZIP file uses unsupported compression method`),!1}}validatePath(e,t){return typeof e==`string`?e.length===0?(this.lastError=Error(`${t}: Path cannot be empty`),!1):e.includes(`..`)||e.includes(`//`)?(this.lastError=Error(`${t}: Invalid path contains dangerous patterns`),!1):!0:(this.lastError=Error(`${t}: Path must be a string`),!1)}checkReady(e){return!this.isOpen||!this.engine?(this.lastError=Error(`${e}: ZIP archive is not open`),!1):!0}async getFile(e){try{if(!this.checkReady(`getFile`))return this.logger.logError(`ZLib`,`Cannot get file:`,this.lastError.message),null;if(!this.validatePath(e,`getFile`))return this.logger.logError(`ZLib`,`Invalid file path:`,this.lastError.message),null;let t=this.engine.file(e);if(!t&&e.startsWith(`/`)&&(t=this.engine.file(e.substring(1))),!t)return this.logger.log(`warn`,`ZLib`,`File not found in ZIP: ${e}`),null;let n=await t.async(`arraybuffer`);return!n||n.byteLength===0?(this.logger.log(`warn`,`ZLib`,`File is empty: ${e}`),new Uint8Array):new Uint8Array(n)}catch(t){return this.lastError=t,this.logger.logError(`ZLib`,`Failed to get file ${e}:`,t.message),null}}async getFileText(e){try{if(!this.checkReady(`getFileText`))return this.logger.logError(`ZLib`,`Cannot get file text:`,this.lastError.message),null;if(!this.validatePath(e,`getFileText`))return this.logger.logError(`ZLib`,`Invalid file path:`,this.lastError.message),null;let t=this.engine.file(e);if(!t&&e.startsWith(`/`)&&(t=this.engine.file(e.substring(1))),!t)return this.logger.log(`warn`,`ZLib`,`File not found in ZIP: ${e}`),null;let n=await t.async(`text`);return typeof n==`string`?n:(this.logger.log(`warn`,`ZLib`,`File ${e} did not return valid text content`),null)}catch(t){return this.lastError=t,this.logger.logError(`ZLib`,`Failed to get file text ${e}:`,t.message),t.message.includes(`binary`)?this.logger.logError(`ZLib`,`File ${e} appears to be binary, cannot read as text`):t.message.includes(`encoding`)&&this.logger.logError(`ZLib`,`File ${e} has encoding issues`),null}}getPaths(){try{return this.checkReady(`getPaths`)?this.engine&&this.engine.files?Object.keys(this.engine.files):Object.keys(this.files):(this.logger.logError(`ZLib`,`Cannot get paths:`,this.lastError.message),[])}catch(e){return this.lastError=e,this.logger.logError(`ZLib`,`Failed to get file paths:`,e.message),[]}}fileExists(e){try{return!this.validatePath(e,`fileExists`)||!this.checkReady(`fileExists`)?!1:this.files.hasOwnProperty(e)}catch(t){return this.lastError=t,this.logger.logError(`ZLib`,`Error checking file existence for ${e}:`,t.message),!1}}getFileSize(e){try{if(!this.validatePath(e,`getFileSize`)||!this.checkReady(`getFileSize`))return-1;let t=this.engine.file(e);return t?t._data?t._data.uncompressedSize:0:-1}catch(t){return this.lastError=t,this.logger.logError(`ZLib`,`Error getting file size for ${e}:`,t.message),-1}}getLastError(){return this.lastError}close(){try{this.engine&&(this.engine=null),this.files={},this.isOpen=!1,this.lastError=null}catch(e){this.logger.logError(`ZLib`,`Error during ZIP cleanup:`,e.message)}}async getFileData(e){try{if(!this.checkReady(`getFileData`)||!this.validatePath(e,`getFileData`))throw this.lastError;let t=e.startsWith(`/`)?e.substring(1):e,n=this.engine.file(t);if(!n)throw Error(`File not found: ${e}`);let r=await n.async(`arraybuffer`);if(!r)throw Error(`Failed to read file data: ${e}`);return r}catch(t){throw this.lastError=t,this.logger.logError(`ZLib`,`Failed to get file data for ${e}:`,t.message),Error(`Failed to extract file data: ${e} - ${t.message}`)}}getStats(){try{if(!this.checkReady(`getStats`))return{isOpen:!1,fileCount:0,totalSize:0,error:this.lastError?.message};let e=Object.keys(this.files),t=0;return e.forEach(e=>{let n=this.getFileSize(e);n>0&&(t+=n)}),{isOpen:this.isOpen,fileCount:e.length,totalSize:t,files:e,lastError:this.lastError?.message||null}}catch(e){return this.lastError=e,this.logger.logError(`ZLib`,`Error getting archive stats:`,e.message),{isOpen:!1,fileCount:0,totalSize:0,error:e.message}}}}class n{constructor(e){this.zip=e,this.parts={},this.contentTypes={},this.relationships={}}async initialize(){let e=await this.zip.getFileText(`[Content_Types].xml`);e&&this.parseContentTypes(e);let t=await this.zip.getFileText(`_rels/.rels`);t&&(this.relationships[``]=this.parseRelationships(t));let n=this.zip.getPaths();for(let e of n)if(e.startsWith(`_rels/`)&&e.endsWith(`.rels`)&&e!==`_rels/.rels`){let t=e.match(/^(.+)\/_rels\/(.+)\.rels$/);if(t){let n=`/${t[1]}/${t[2]}`,r=await this.zip.getFileText(e);r&&(this.relationships[n]=this.parseRelationships(r))}}for(let e of n)if(!e.startsWith(`_rels/`)&&e!==`[Content_Types].xml`){let t=`/${e}`,n=this.getContentType(t);this.parts[t]=new i(this,t,n)}}parseContentTypes(e){let t=new DOMParser().parseFromString(e,`text/xml`),n=e=>{let n=t.getElementsByTagName(`*`),r=[];for(let t=0;t{let t=e.getAttribute(`Extension`),n=e.getAttribute(`ContentType`);t&&n&&(this.contentTypes[`ext:${t}`]=n)}),n(`Override`).forEach(e=>{let t=e.getAttribute(`PartName`),n=e.getAttribute(`ContentType`);t&&n&&(this.contentTypes[t]=n)})}parseRelationships(e){let t=new DOMParser().parseFromString(e,`text/xml`),n={};return(e=>{let n=t.getElementsByTagName(`*`),r=[];for(let t=0;t{let t=e.getAttribute(`Id`),r=e.getAttribute(`Type`),i=e.getAttribute(`Target`);t&&(n[t]={type:r,target:i,targetMode:e.getAttribute(`TargetMode`)||`Internal`})}),n}getContentType(e){if(this.contentTypes[e])return this.contentTypes[e];let t=e.split(`.`).pop();return t&&this.contentTypes[`ext:${t}`]?this.contentTypes[`ext:${t}`]:`application/octet-stream`}getPartByRelationshipType(e){let t=this.relationships[``]||{};for(let n of Object.values(t))if(n.type===e){let e=n.target.startsWith(`/`)?n.target:`/${n.target}`;return this.parts[e]}return null}getPartByUri(e){return this.parts[e]}}class i{constructor(e,t,n){this.package=e,this.uri=t,this.contentType=n,this._content=null}async getDocumentContent(){if(this._content===null){let e=this.uri.startsWith(`/`)?this.uri.substring(1):this.uri;this._content=await this.package.zip.getFileText(e)}return this._content}async getRelationships(){if(this.package.relationships[this.uri])return this.package.relationships[this.uri];let e=this.uri.replace(/\/([^\/]+)$/,`/_rels/$1.rels`),t=e.startsWith(`/`)?e.substring(1):e,n=await this.package.zip.getFileText(t);return n?this.package.parseRelationships(n):{}}}let a={presentation:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`},extendedFileProperties:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`},coreFileProperties:{relationType:`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`},customFileProperties:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties`},presentationProperties:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps`},slide:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide`},slideLayout:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout`},slideMaster:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster`},theme:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`},image:{relationType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`}};return typeof window<`u`&&(window.ZLib=t,window.OpenXmlPackage=n,window.OpenXmlPart=i,window.OpenXmlTypes=a),typeof globalThis<`u`&&(globalThis.ZLib=t,globalThis.OpenXmlPackage=n,globalThis.OpenXmlPart=i,globalThis.OpenXmlTypes=a),Ql}eu();var tu={},nu;function ru(){if(nu)return tu;nu=1;class e{constructor(){this.zip=null,this.imageMap={},this.layoutsMap={},this.mastersMap={},this.tablesMap={},this.tableStylesMap={},this.smartarts=[],this.connectorsPr=[],this.slideLayoutRels=new Map,this.slideMasterRels=new Map,this.masterLayoutMap=new Map,this.themeMap={},this.colorMaps={},this.logger=new Logger(`XmlParserContext`)}registerSlideMaster(e,t){this.slideMasterRels.set(e,t),this.mastersMap[e]=t,this.masterLayoutMap.has(e)||this.masterLayoutMap.set(e,[])}registerSlideLayout(e,t,n){this.slideLayoutRels.set(e,t),this.layoutsMap[e]=t,n&&(t.masterId=n,this.masterLayoutMap.has(n)||this.masterLayoutMap.set(n,[]),this.masterLayoutMap.get(n).push(e))}getSlideMaster(e){return this.slideMasterRels.get(e)}getSlideLayout(e){return this.slideLayoutRels.get(e)}getLayoutsForMaster(e){return(this.masterLayoutMap.get(e)||[]).map(e=>this.getSlideLayout(e)).filter(Boolean)}loadDataLinks(){return this.imageMap}generateSmartArts(){return this.smartarts}}class t{constructor(e,t,n){this.xml=e,this.part=t,this.context=n,this.parser=new DOMParser,this.doc=null,this.currentElement=null,this.depth=0,this.namespaces={p:`http://schemas.openxmlformats.org/presentationml/2006/main`,a:`http://schemas.openxmlformats.org/drawingml/2006/main`,r:`http://schemas.openxmlformats.org/officeDocument/2006/relationships`},this.logger=new Logger(`StaxParser`)}parse(){try{this.doc=this.parser.parseFromString(this.xml,`text/xml`);let e=this.doc.querySelector(`parsererror`);if(e)throw Error(`XML parsing failed: `+e.textContent);return this.doc}catch{return null}}parseSlideMaster(e){this.doc||this.parse();let t=this.doc.documentElement;return!t||t.localName!==`sldMaster`?null:{id:e,type:`slideMaster`,name:this.getAttributeValue(t,`name`)||`Master ${e}`,preserve:this.getAttributeValue(t,`preserve`)===`true`,cSld:this.parseCommonSlideData(t),clrMap:this.parseColorMap(t),txStyles:this.parseTextStyles(t),sldLayoutLst:[],themeId:this.extractThemeId(t),hf:this.parseHeaderFooter(t),timing:this.parseTiming(t),transition:this.parseTransition(t)}}parseSlideLayout(e,t){this.doc||this.parse();let n=this.doc.documentElement;return!n||n.localName!==`sldLayout`?null:{id:e,masterId:t,type:`slideLayout`,name:this.getAttributeValue(n,`name`)||`Layout ${e}`,matchingName:this.getAttributeValue(n,`matchingName`)||``,preserve:this.getAttributeValue(n,`preserve`)===`true`,showMasterSp:this.getAttributeValue(n,`showMasterSp`)!==`false`,showMasterPhAnim:this.getAttributeValue(n,`showMasterPhAnim`)===`true`,userDrawn:this.getAttributeValue(n,`userDrawn`)!==`false`,layoutType:this.getLayoutType(n),cSld:this.parseCommonSlideData(n),clrMapOvr:this.parseColorMapOverride(n),hf:this.parseHeaderFooter(n),timing:this.parseTiming(n),transition:this.parseTransition(n)}}parseCommonSlideData(e){let t=this.getChildElement(e,`cSld`);return t?{name:this.getAttributeValue(t,`name`)||``,bg:this.parseBackground(t),spTree:this.parseShapeTree(t)}:{name:``,bg:null,spTree:[]}}parseShapeTree(e){let t=this.getChildElement(e,`spTree`);if(!t)return[];let n=[],r=t.children;for(let e=0;e{if(e)t.chartData=e,window.currentProcessor&&window.currentProcessor.reRenderShape&&window.currentProcessor.reRenderShape(t);else{let e=n.parseEmbeddedChartData(r);e&&(t.chartData=e)}}).catch(e=>{try{let e=n.parseEmbeddedChartData(r);e&&(t.chartData=e)}catch{}})}catch{}else t.graphicData.isChart=!0,t.graphicData.chartXml=new XMLSerializer().serializeToString(r)}}}return t}parseHeaderFooter(e){return null}parseTiming(e){return null}parseTransition(e){return null}extractThemeId(e){return null}parseFill(e){return null}parseImageEffects(e){return null}parseTransform(e){let t=e.querySelector(`xfrm`)||e.querySelector(`p\\:xfrm`)||e.querySelector(`[*|localName="xfrm"]`);if(!t)return{x:0,y:0,width:0,height:0};let n=t.querySelector(`off`)||t.querySelector(`a\\:off`)||t.querySelector(`[*|localName="off"]`),r=0,i=0;n&&(r=parseInt(n.getAttribute(`x`)||`0`,10),i=parseInt(n.getAttribute(`y`)||`0`,10));let a=t.querySelector(`ext`)||t.querySelector(`a\\:ext`)||t.querySelector(`[*|localName="ext"]`),o=0,s=0;return a&&(o=parseInt(a.getAttribute(`cx`)||`0`,10),s=parseInt(a.getAttribute(`cy`)||`0`,10)),{x:r,y:i,width:o,height:s}}parseSlide(e){try{let t={shapes:[],background:null,name:``,id:null},n=e.getAttribute(`id`);n&&(t.id=n);let r=this.getChildElement(e,`cSld`);if(r){let e=r.getAttribute(`name`);e&&(t.name=e),t.background=this.parseBackground(r),t.shapes=this.parseShapeTree(r)}return t}catch{return{shapes:[],background:null,name:``,id:null}}}}return typeof window<`u`&&(window.XmlParserContext=e,window.StaxParser=t),typeof globalThis<`u`&&(globalThis.XmlParserContext=e,globalThis.StaxParser=t),tu}ru();var iu={},au;function ou(){if(au)return iu;au=1;class e{constructor(){this.type=`CPresentation`,this.id=Math.random().toString(36).substr(2,9),this.slides=[],this.slideMasters=[],this.notesMasters=[],this.slideSize={cx:9144e3,cy:6858e3},this.currentSlide=0,this.app=null,this.core=null,this.customProperties=null,this.masterIds=[],this.theme=null}getSlidesCount(){return this.slides.length}getCurrentSlide(){return this.slides[this.currentSlide]||null}getSlide(e){return this.slides[e]||null}addSlide(e){this.slides.push(e),e.setParent(this)}setCurrentSlide(e){e>=0&&e=0&&e0&&e.groupExt.cx>0&&(t=e.groupExt.cx/e.chExt.cx),e.chExt.cy>0&&e.groupExt.cy>0&&(n=e.groupExt.cy/e.chExt.cy);let r=e.groupOff.x-e.chOff.x*t,i=e.groupOff.y-e.chOff.y*n;return{m11:t,m12:0,m21:0,m22:n,dx:r,dy:i}}createRotationMatrix(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return{m11:n,m12:r,m21:-r,m22:n,dx:0,dy:0}}createScaleMatrix(e,t){return{m11:e,m12:0,m21:0,m22:t,dx:0,dy:0}}drawSingleShape(e,t){let n=t.properties.transform;if(!n)return;let r=CoordinateTransform.emuToMM(n.x||0),i=CoordinateTransform.emuToMM(n.y||0),a=CoordinateTransform.emuToMM(n.width||0),o=CoordinateTransform.emuToMM(n.height||0),s=this.getShapeFillColor(t),c=this.getShapeStrokeColor(t),l=this.getShapeLineWidth(t);switch(t.type){case`sp`:this.drawTextShape(e,t,r,i,a,o,s,c,l);break;case`pic`:this.drawImageShape(e,t,r,i,a,o);break;case`cxnSp`:this.drawConnectorShape(e,t,r,i,a,o,c,l);break;case`graphicFrame`:this.drawGraphicFrame(e,t,r,i,a,o);break;default:this.drawDefaultShape(e,t,r,i,a,o,s,c,l);break}}drawTextShape(e,t,n,r,i,a,o,s,c){let l=t.geometry||t.properties?.geometry;l&&l.preset?e.drawPresetGeometry(l.preset,n,r,i,a,o,s,c):l&&l.pathLst?this.drawCustomGeometry(e,l,n,r,i,a,o,s,c):(o&&e.fillRect(n,r,i,a,o),s&&e.strokeRect(n,r,i,a,s,c)),this.drawTextContent(e,t,n,r,i,a)}drawCustomGeometry(e,t,n,r,i,a,o,s,c){e.SaveGrState();let l=i/(t.pathW||i),u=a/(t.pathH||a);if(e.context.translate(n,r),e.context.scale(l,u),t.pathLst)for(let n=0;nr+s)break;let t=n+5;for(let n of i.runs)if(n.text&&o<=r+s){let r={fontSize:n.properties?.fontSize||18,fontFamily:n.properties?.fontFamily||`Arial`,bold:n.properties?.bold||!1,italic:n.properties?.italic||!1,color:n.properties?.color||{r:0,g:0,b:0},highlight:n.properties?.highlight||null};e.fillText(n.text,t,o,r),t+=n.text.length*(r.fontSize*.6)}o+=14}}drawImageShape(e,t,n,r,i,a){e.strokeRect(n,r,i,a,{r:160,g:160,b:160},1),t.imageData&&e.drawImage(t.imageData,n,r,i,a)}drawConnectorShape(e,t,n,r,i,a,o,s){let c=n,l=r,u=n+i,d=r+a;e.drawLine(c,l,u,d,o,s)}drawGraphicFrame(e,t,n,r,i,a){if(t.graphicData,t.asyncChartProcessing){e.strokeRect(n,r,i,a,{r:200,g:200,b:200},1);return}if(t.chartData)window.ChartRenderer?new ChartRenderer(e).renderChart(t.chartData,n,r,i,a):e.strokeRect(n,r,i,a,{r:160,g:160,b:160},1);else if(t.graphicData&&t.graphicData.uri===`http://schemas.openxmlformats.org/drawingml/2006/chart`)if(window.ChartProcessor){let o=new ChartProcessor().parseEmbeddedChartData(t.graphicData);o?(t.chartData=o,window.ChartRenderer&&new ChartRenderer(e).renderChart(o,n,r,i,a)):e.strokeRect(n,r,i,a,{r:160,g:160,b:160},1)}else e.strokeRect(n,r,i,a,{r:160,g:160,b:160},1);else if(t.table&&t.table instanceof s)t.table.draw(e,n,r,i,a);else if(t.graphicData&&t.graphicData.uri===`http://schemas.openxmlformats.org/drawingml/2006/table`)try{let o=this.parseSimpleTable(t.graphicData.tableXml);o?(t.table=o,o.draw(e,n,r,i,a)):e.strokeRect(n,r,i,a,{r:160,g:160,b:160},1)}catch{e.strokeRect(n,r,i,a,{r:160,g:160,b:160},1)}else e.strokeRect(n,r,i,a,{r:160,g:160,b:160},1)}parseSimpleTable(e){if(!e)return null;try{let t=new DOMParser().parseFromString(e,`text/xml`);if(t.documentElement.nodeName===`parsererror`)return null;let n=new s,r=t.querySelector(`tblGrid`);if(r||(r=t.querySelector(`a\\:tblGrid`)),r){let e=r.querySelectorAll(`gridCol`);e.length===0&&(e=r.querySelectorAll(`a\\:gridCol`));let t=[];e.forEach(e=>{let n=e.getAttribute(`w`);t.push({width:n?parseInt(n):914400})}),n.setTableGrid(t)}let i=t.querySelectorAll(`tr`);return i.length===0&&(i=t.querySelectorAll(`a\\:tr`)),i.forEach(e=>{let t=new c,r=e.querySelector(`trPr`);if(r||(r=e.querySelector(`a\\:trPr`)),r){let e=r.querySelector(`trHeight`);e||(e=r.querySelector(`a\\:trHeight`)),e&&(t.height=parseInt(e.getAttribute(`val`))||null)}let i=e.querySelectorAll(`tc`);i.length===0&&(i=e.querySelectorAll(`a\\:tc`)),i.forEach(e=>{let n=new l,r=e.querySelector(`tcPr`);if(r||(r=e.querySelector(`a\\:tcPr`)),r){let e=r.querySelector(`gridSpan`);e||(e=r.querySelector(`a\\:gridSpan`)),e&&(n.gridSpan=parseInt(e.getAttribute(`val`))||1);let t=r.querySelector(`rowSpan`);t||(t=r.querySelector(`a\\:rowSpan`)),t&&(n.rowSpan=parseInt(t.getAttribute(`val`))||1);let i=r.querySelector(`solidFill`);if(i||(i=r.querySelector(`a\\:solidFill`)),i){let e=i.querySelector(`srgbClr, schemeClr, scrgbClr`);if(e||(e=i.querySelector(`a\\:srgbClr, a\\:schemeClr, a\\:scrgbClr`)),e){let t=this.parseSimpleColor(e);t&&(n.fill={color:t})}}}let i=this.parseSimpleTextContent(e);i&&n.setTextBody(i),t.addCell(n)}),n.addRow(t)}),n}catch{return null}}parseSimpleColor(e){if(e.tagName.includes(`srgbClr`)){let t=e.getAttribute(`val`);if(t){let e=t.replace(`#`,``);return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:255}}}return{r:200,g:200,b:200,a:255}}parseSimpleTextContent(e){let t=e.querySelectorAll(`r, a\\:r`);if(t.length===0)return null;let n={paragraphs:[],bodyProperties:{wrap:!0,verticalAlign:`top`}},r={runs:[],properties:{}};return t.forEach(e=>{let t=e.querySelector(`t, a\\:t`),n=t?t.textContent:``;if(n){let t=e.querySelector(`rPr, a\\:rPr`),i={fontSize:12,fontFamily:`Arial`,bold:!1,italic:!1,color:{r:0,g:0,b:0,a:255}};if(t){let e=t.getAttribute(`sz`);e&&(i.fontSize=parseInt(e)/100),t.getAttribute(`b`)===`1`&&(i.bold=!0);let n=t.querySelector(`solidFill, a\\:solidFill`);if(n){let e=n.querySelector(`srgbClr, a\\:srgbClr`);if(e){let t=e.getAttribute(`val`);t&&(i.color={r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:255})}}}r.runs.push({text:n,properties:i})}}),r.runs.length>0&&n.paragraphs.push(r),n.paragraphs.length>0?n:null}drawDefaultShape(e,t,n,r,i,a,o,s,c){o&&e.fillRect(n,r,i,a,o),s&&e.strokeRect(n,r,i,a,s,c)}getShapeFillColor(e){return e.brush?.color?e.brush.color:e.fill?.color?e.fill.color:e.properties?.fill?.color?e.properties.fill.color:{r:200,g:200,b:200,a:255}}getShapeStrokeColor(e){return e.pen===null||e.pen===`none`||e.stroke===null||e.stroke===`none`||e.properties?.stroke===null||e.properties?.stroke===`none`||e.pen?.width===0||e.stroke?.width===0||e.properties?.stroke?.width===0?null:e.pen?.color?e.pen.color:e.stroke?.color?e.stroke.color:e.properties?.stroke?.color?e.properties.stroke.color:null}getShapeLineWidth(e){return e.pen===null||e.pen===`none`||e.stroke===null||e.stroke===`none`||e.properties?.stroke===null||e.properties?.stroke===`none`?0:e.pen?.width===void 0?e.stroke?.width===void 0?e.properties?.stroke?.width===void 0?0:CoordinateTransform.emuToMM(e.properties.stroke.width):CoordinateTransform.emuToMM(e.stroke.width):CoordinateTransform.emuToMM(e.pen.width)}createShapeTransformMatrix(e){let t=new CMatrix;if(e.rotation){let n=e.rotation/6e4*Math.PI/180,r=Math.cos(n),i=Math.sin(n);t.sx=r,t.sy=r,t.shx=-i,t.shy=i}return t.tx=CoordinateTransform.emuToMM(e.x||0),t.ty=CoordinateTransform.emuToMM(e.y||0),t}}class n{constructor(){this.name=``,this.shapeTree=[],this.background=null,this.colorMap=null,this.parent=null}setParent(e){this.parent=e}addToSpTree(e,t){e??(e=this.shapeTree.length),this.shapeTree.splice(e,0,t),t.setParent(this)}removeFromSpTree(e){return e>=0&&e=0&&e0&&e.groupExt.cx>0&&(t=e.groupExt.cx/e.chExt.cx),e.chExt.cy>0&&e.groupExt.cy>0&&(n=e.groupExt.cy/e.chExt.cy);for(let r of this.shapeTree)if(r.bounds){let i=r.bounds;r.originalBounds||(r.originalBounds={...i}),r.bounds={l:e.groupOff.x+(i.l-e.chOff.x)*t,t:e.groupOff.y+(i.t-e.chOff.y)*n,r:e.groupOff.x+(i.r-e.chOff.x)*t,b:e.groupOff.y+(i.b-e.chOff.y)*n},r.groupTransform={scaleX:t,scaleY:n,offsetX:e.groupOff.x-e.chOff.x*t,offsetY:e.groupOff.y-e.chOff.y*n}}}recalculateBounds(){if(this.shapeTree.length===0){super.recalculateBounds();return}let e=1/0,t=1/0,n=-1/0,r=-1/0,i=!1;for(let a of this.shapeTree)a.recalculateBounds&&a.recalculateBounds(),a.bounds&&(e=Math.min(e,a.bounds.l),t=Math.min(t,a.bounds.t),n=Math.max(n,a.bounds.r),r=Math.max(r,a.bounds.b),i=!0);i?(this.bounds.l=e,this.bounds.t=t,this.bounds.r=n,this.bounds.b=r):(this.bounds.l=914400,this.bounds.t=914400,this.bounds.r=5486400,this.bounds.b=2743200)}draw(e){if(!this.isHidden){this.recalculateBounds(),e.SaveGrState();try{if(this.transform){if(this.transform.rotation&&this.transform.rotation!==0){let t=this.createRotationMatrix(this.transform.rotation);e.transform3(t)}if(this.transform.flipH||this.transform.flipV){let t=this.transform.flipH?-1:1,n=this.transform.flipV?-1:1,r=this.createScaleMatrix(t,n);e.transform3(r)}}if(this.groupCoordSystem){let t=this.createGroupCoordinateMatrix(this.groupCoordSystem);t&&e.transform3(t)}for(let t of this.shapeTree)t.draw(e)}finally{e.RestoreGrState()}}}createGroupCoordinateMatrix(e){if(!e)return null;let t=1,n=1;e.chExt.cx>0&&e.groupExt.cx>0&&(t=e.groupExt.cx/e.chExt.cx),e.chExt.cy>0&&e.groupExt.cy>0&&(n=e.groupExt.cy/e.chExt.cy);let r=e.groupOff.x-e.chOff.x*t,i=e.groupOff.y-e.chOff.y*n;return{m11:t,m12:0,m21:0,m22:n,dx:r,dy:i}}createRotationMatrix(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return{m11:n,m12:r,m21:-r,m22:n,dx:0,dy:0}}createScaleMatrix(e,t){return{m11:e,m12:0,m21:0,m22:t,dx:0,dy:0}}getObjectType(){return`group`}isGroup(){return!0}}class a{constructor(){this.id=Math.random().toString(36).substr(2,9),this.commonSlideData=new n,this.theme=null,this.layouts=[],this.parent=null}setParent(e){this.parent=e}addLayout(e){this.layouts.push(e),e.setMaster(this)}}class o{constructor(){this.id=Math.random().toString(36).substr(2,9),this.commonSlideData=new n,this.master=null,this.type=`blank`}setMaster(e){this.master=e}}class s{constructor(){this.id=Math.random().toString(36).substr(2,9),this.type=`table`,this.rows=[],this.tableGrid=[],this.tableProperties=null,this.parent=null,this.firstRow=!1,this.firstCol=!1,this.lastRow=!1,this.lastCol=!1,this.bandRow=!1,this.bandCol=!1,this.tableStyleId=null,this.bounds={l:0,t:0,r:0,b:0}}setParent(e){this.parent=e}addRow(e){this.rows.push(e),e.setParent(this),e.rowIndex=this.rows.length-1}setTableGrid(e){this.tableGrid=e||[]}getTotalWidth(){return this.tableGrid.reduce((e,t)=>e+(t.width||0),0)}getRowCount(){return this.rows.length}getColumnCount(){let e=this.tableGrid.length,t=0;for(let e of this.rows){let n=e.getCells().length;n>t&&(t=n)}return Math.max(e,t)}getTableProperties(){return this.tableProperties||{}}getTableBorders(){return this.tableProperties?.borders||{}}getTableShading(){return this.tableProperties?.shading||{}}getTableGrid(){return this.tableGrid||[]}getCell(e,t){if(e>=0&&e=0&&t=0&&ee+(t.height||0),0);this.bounds.r=this.bounds.l+CoordinateTransform.emuToMM(e),this.bounds.b=this.bounds.t+CoordinateTransform.emuToMM(t)}draw(e,t,n,r,i){if(!this.rows||this.rows.length===0){e.strokeRect(t,n,r,i,{r:160,g:160,b:160},1);return}let a=this.getColumnCount(),o=this.getRowCount(),s=a>0?r/a:r,c=o>0?i/o:i,l=n;for(let n=0;nn+o)break;let i=t+5;if(r.runs){for(let t of r.runs)if(t.text&&a<=n+o){let n={fontSize:t.properties?.fontSize||12,fontFamily:t.properties?.fontFamily||`Arial`,bold:t.properties?.bold||!1,italic:t.properties?.italic||!1,color:t.properties?.color||{r:0,g:0,b:0}};e.fillText(t.text,i,a,n),i+=t.text.length*(n.fontSize*.6)}}a+=14}}getGridSpan(){return this.gridSpan||1}getRowSpan(){return this.rowSpan||1}getCellShading(){return this.shading}getTextBody(){return this.textBody}getCellBorders(){return this.borders}}class u{constructor(){this.id=Math.random().toString(36).substr(2,9),this.name=`Default Theme`,this.colorScheme=null,this.fontScheme=null,this.formatScheme=null}}return typeof window<`u`&&(window.CPresentation=e,window.CSlide=t,window.CSld=n,window.CShape=r,window.CGroupShape=i,window.CSlideMaster=a,window.CSlideLayout=o,window.CTheme=u,window.CTable=s,window.CTableRow=c,window.CTableCell=l),typeof globalThis<`u`&&(globalThis.CPresentation=e,globalThis.CSlide=t,globalThis.CSld=n,globalThis.CShape=r,globalThis.CGroupShape=i,globalThis.CSlideMaster=a,globalThis.CSlideLayout=o,globalThis.CTheme=u,globalThis.CTable=s,globalThis.CTableRow=c,globalThis.CTableCell=l),iu}ou(),typeof globalThis<`u`&&(globalThis.TableProcessor=class{constructor(e={}){this.logger=new Logger(`TableProcessor`),this.validator=this._getValidator(),this.errorBoundary=new(this._getErrorBoundary())({context:`TableProcessor`,enableLogging:e.enableLogging!==!1}),this.tableCache=new Map,this.config=this._validateConfig({maxTableSize:e.maxTableSize||1e3,maxCellTextLength:e.maxCellTextLength||1e4,enableCaching:e.enableCaching!==!1,enableValidation:e.enableValidation!==!1,renderTimeout:e.renderTimeout||5e3,...e}),this.performanceMetrics={tablesProcessed:0,cacheHits:0,cacheMisses:0,averageRenderTime:0}}async renderTableFrame(e,t,n,r,i,a,o={}){let s=this._validateRenderInput(e,t,n,r,i,a,o);if(!s.valid){this._handleValidationError(`renderTableFrame`,s.errors),this.drawTablePlaceholder(e,n,r,i,a);return}return this.errorBoundary.wrap(async()=>{let o=performance.now();try{let s=await this._getTableInstanceWithTimeout(t,this.config.renderTimeout);if(!s){this.logger&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`No valid table data found, drawing placeholder`),this.drawTablePlaceholder(e,n,r,i,a);return}this.config.enableValidation&&this._validateTableStructure(s),e.SaveGrState();try{await this._safeDrawTableBackgroundAndOuterBorder(e,s,n,r,i,a),await this._safeDrawCellsBackground(e,s,n,r,i,a),await this._safeDrawCellsContent(e,s,n,r,i,a),await this._safeDrawCellsBorders(e,s,n,r,i,a),this._updatePerformanceMetrics(o)}finally{e.RestoreGrState()}}catch(t){throw console.error(`[TableProcessor] MAIN RENDER ERROR:`,t.message),console.error(`[TableProcessor] Error stack:`,t.stack),console.error(`[TableProcessor] Error name:`,t.name),this.logger&&this.logger.logError(this.constructor.name,`TableProcessor`,`Error during table rendering:`,t),this.drawTablePlaceholder(e,n,r,i,a),this._enhanceError(t,`table_rendering`,{x:n,y:r,w:i,h:a})}},{context:`renderTableFrame`})()}async getTableInstance(e){return this.errorBoundary.wrap(async()=>{if(!e||typeof e!=`object`)throw this._createError(`Invalid shape object provided`,{name:`ValidationError`,code:`INVALID_SHAPE`});if(e.table&&e.table instanceof CTable)return this.performanceMetrics.cacheHits++,e.table;if(this.performanceMetrics.cacheMisses++,e.graphicData&&e.graphicData.tableXml)try{this.config.enableValidation&&this._validateTableXML(e.graphicData.tableXml);let t=await this.parseTableFromXML(e.graphicData.tableXml);if(t)return this.config.enableValidation&&this._validateParsedTable(t),this.config.enableCaching&&(e.table=t),t}catch(e){throw this.logger&&this.logger.logError(this.constructor.name,`TableProcessor`,`Failed to parse table XML:`,e),this._enhanceError(e,`table_parsing`)}return null},{context:`getTableInstance`})()}async _getTableInstanceWithTimeout(e,t){return new Promise(async(n,r)=>{let i=setTimeout(()=>{r(this._createError(`Table parsing timed out after ${t}ms`,{name:`TimeoutError`,code:`TABLE_PARSING_TIMEOUT`}))},t);try{let t=await this.getTableInstance(e);clearTimeout(i),n(t)}catch(e){clearTimeout(i),r(e)}})}drawTableBackgroundAndOuterBorder(e,t,n,r,i,a){t.getTableProperties();let o=t.getTableBorders(),s=t.getTableShading();if(s&&s.fill){let t=this.resolveTableBackgroundColor(s);e.b_color1(t.r,t.g,t.b,t.a||255),e.TableRect(n,r,i,a)}o&&Object.keys(o).length>0&&this.drawTableOuterBorder(e,o,n,r,i,a)}drawCellsBackground(e,t,n,r,i,a){let o=t.getRows(),s=this.calculateCellWidths(t,i),c=this.calculateCellHeights(t,a),l=t.getTableProperties()||{},u=r;for(let t=0;t0&&r[0].textBody?.paragraphs?.[0]?.runs?.[0]?.text===`TOTAL`,d=r.length>0&&r[0].textBody?.paragraphs?.[0]?.runs?.[0]?.text===`Product`;for(let i=0;i{let s=t[o];if(s&&s.style!==`none`){let t=this.resolveBorderColor(s),c=Math.max(s.width||1,3);switch(e.p_color(t.r,t.g,t.b,t.a||255),e.p_width(c),o){case`top`:e.drawHorLine(n,r,n+i,r,c);break;case`right`:e.drawVerLine(n+i,r,r+a,c);break;case`bottom`:e.drawHorLine(n,r+a,n+i,r+a,c);break;case`left`:e.drawVerLine(n,r,r+a,c);break}}})}drawCellBackground(e,t,n,r,i,a,o={}){let s=null;if(t.shading&&t.shading.fillColor&&(s=t.shading.fillColor),!s&&typeof t.getCellShading==`function`)try{let e=t.getCellShading();e&&e.fill&&e.fill.color&&(s=e.fill.color)}catch{}if(!s&&t.shading&&t.shading.color&&(s=t.shading.color),!s){let e=t.properties||t.cellProperties;e&&e.shading&&e.shading.fillColor&&(s=e.shading.fillColor)}if(!s&&o.tableProps){let e=o.tableProps,n=o.rowIndex||0,r=t.logicalColIndex||0;e.firstRow&&n===0?s={r:68,g:114,b:196,a:255}:e.bandRow&&n>0?(e.firstRow?n-1:n)%2==1&&(s={r:242,g:242,b:242,a:255}):e.firstCol&&r===0&&n>0&&(s={r:221,g:235,b:247,a:255})}s&&s.r!==void 0&&s.g!==void 0&&s.b!==void 0&&e.m_oContext&&(e.m_oContext.save(),e.m_oContext.fillStyle=`rgba(${s.r}, ${s.g}, ${s.b}, ${(s.a||255)/255})`,e.m_oContext.fillRect(n,r,i,a),e.m_oContext.restore())}drawCellContent(e,t,n,r,i,a){let o=t.getTextBody();if(!o||!o.paragraphs)return;let s=this.convertEMUToPixels(38100),c=s,l=s,u=s,d=s;if(t.margins&&(c=t.margins.left?this.convertEMUToPixels(t.margins.left):s,l=t.margins.right?this.convertEMUToPixels(t.margins.right):s,u=t.margins.top?this.convertEMUToPixels(t.margins.top):s,d=t.margins.bottom?this.convertEMUToPixels(t.margins.bottom):s),o.bodyProperties){let e=o.bodyProperties;e.leftMargin!=null&&(c=this.convertEMUToPixels(e.leftMargin)),e.rightMargin!=null&&(l=this.convertEMUToPixels(e.rightMargin)),e.topMargin!=null&&(u=this.convertEMUToPixels(e.topMargin)),e.bottomMargin!=null&&(d=this.convertEMUToPixels(e.bottomMargin))}let f=n+c,p=r+u,m=Math.max(0,i-(c+l)),h=Math.max(0,a-(u+d));this.renderCellTextContent(e,o,f,p,m,h,t)}drawCellBorders(e,t,n,r,i,a,o,s,c){let l=t.getCellBorders();l&&[`top`,`right`,`bottom`,`left`].forEach(u=>{let d=l[u];if(!(!d||d.style===`none`||!d.color||d.width===0)&&this.shouldDrawBorder(u,o,s,c,t)){let t=this.resolveBorderColor(d),o=d.width;if(e.m_oContext){switch(e.m_oContext.save(),e.m_oContext.strokeStyle=`rgba(${t.r}, ${t.g}, ${t.b}, ${(t.a||255)/255})`,e.m_oContext.lineWidth=o,e.m_oContext.beginPath(),u){case`top`:e.m_oContext.moveTo(n,r),e.m_oContext.lineTo(n+i,r);break;case`right`:e.m_oContext.moveTo(n+i,r),e.m_oContext.lineTo(n+i,r+a);break;case`bottom`:e.m_oContext.moveTo(n,r+a),e.m_oContext.lineTo(n+i,r+a);break;case`left`:e.m_oContext.moveTo(n,r),e.m_oContext.lineTo(n,r+a);break}e.m_oContext.stroke(),e.m_oContext.restore()}}})}shouldDrawBorder(e,t,n,r,i=null){let a=r.getRowCount(),o=r.getColumnCount(),s=i?Math.max(1,i.gridSpan||1):1,c=i?Math.max(1,i.rowSpan||1):1;switch(e){case`top`:return t===0?!0:!(i&&i.isMergedContinue&&i.vMerge===`continue`);case`right`:return n+s-1,o-1,!0;case`bottom`:return t+c-1,a-1,!0;case`left`:return!0;default:return!0}}calculateCellWidths(e,t){let n=e.getTableGrid();if(!n||n.length===0){let n=e.getColumnCount();return Array(n).fill(t/n)}let r=n.map(e=>Math.max(0,parseInt(e.width)||0)),i=r.reduce((e,t)=>e+t,0)||1,a=r.map(e=>e/i*t),o=e.getColumnCount();if(a.lengthe+t,0))/Math.max(e,1);for(let t=0;te+t,0)||n;return r.map(e=>e/i*t)}isStartingCellOfMerge(e,t,n){return!0}calculateMergedCellWidth(e,t,n){let r=0;for(let i=0;ie.fontSizePx)),o=Math.round(a*1.25);s.push({runSegments:i,textAlign:r,lineHeight:o})}if(s.length===0)return;let c=s.reduce((e,t)=>e+t.lineHeight,0),l=`ctr`;o&&o.verticalAlignment?l=o.verticalAlignment:t.bodyProperties&&t.bodyProperties.anchor&&(l=t.bodyProperties.anchor);let u=r;if(u=l===`t`||l===`top`?r:l===`ctr`||l===`center`||l===`middle`?r+Math.max(0,(a-c)/2):l===`b`||l===`bottom`?r+Math.max(0,a-c):r+Math.max(0,(a-c)/2),isFinite(u)||(u=r),e.m_oContext)for(let t=0;t0){for(let t of e.runs)if(t.properties&&t.properties.color)return t.properties.color}return{r:159,g:159,b:159,a:255}}drawCenteredText(e,t,n,r,i,a){e.m_oContext&&(e.m_oContext.save(),e.m_oContext.fillStyle=`rgba(128, 128, 128, 0.8)`,e.m_oContext.font=`14px Arial`,e.m_oContext.textAlign=`center`,e.m_oContext.textBaseline=`middle`,e.m_oContext.fillText(t,n+i/2,r+a/2),e.m_oContext.restore())}parseTableFromXML(e){if(!e)return null;try{let t=new DOMParser().parseFromString(e,`text/xml`);if(t.documentElement.nodeName===`parsererror`)return console.warn(`XML parsing error in table XML`),null;let n=new CTable;if(this.tableRowData=[],this.parseTableProperties(t,n),this.parseTableGrid(t,n),this.parseTableRows(t,n),this.processTableMerges(n),!this.validateTableStructure(n)){console.warn(`Table structure validation failed`);try{let e=(n.getTableGrid()||[]).length;console.warn(`[TableProcessor][DEBUG] Grid columns:`,e);let t=n.getRows();for(let e=0;e`c${t}{gs:${e.gridSpan||1},rs:${e.rowSpan||1},cont:${!!e.isMergedContinue},v:${e.vMerge||``},lc:${e.logicalColIndex||0}}`).join(` | `);console.warn(`[TableProcessor][DEBUG] Row ${e} cells(${n.length}): ${r}`)}}catch{}}return n}catch(e){return console.warn(`Error parsing table XML:`,e),null}finally{this.tableRowData=null}}parseTableProperties(e,t){let n=e.querySelector(`tblPr`);if(n||(n=e.querySelector(`a\\:tblPr`)),n){let e={},r=n.getAttribute(`firstRow`);(r===`1`||r===`true`)&&(e.firstRow=!0);let i=n.getAttribute(`bandRow`);(i===`1`||i===`true`)&&(e.bandRow=!0);let a=n.getAttribute(`firstCol`);(a===`1`||a===`true`)&&(e.firstCol=!0);let o=n.getAttribute(`lastRow`);(o===`1`||o===`true`)&&(e.lastRow=!0);let s=n.getAttribute(`lastCol`);(s===`1`||s===`true`)&&(e.lastCol=!0);let c=n.getAttribute(`bandCol`);(c===`1`||c===`true`)&&(e.bandCol=!0);let l=n.querySelector(`tblStyle`);l||(l=n.querySelector(`a\\:tblStyle`)),l&&(e.style=l.getAttribute(`val`));let u=n.querySelector(`tblBorders`);u||(u=n.querySelector(`a\\:tblBorders`)),u&&(e.borders=this.parseTableBorders(u));let d=n.querySelector(`tblShading`);d||(d=n.querySelector(`a\\:tblShading`)),d&&(e.shading=this.parseTableShading(d));let f=n.querySelector(`tblLayout`);f||(f=n.querySelector(`a\\:tblLayout`)),f&&(e.layout=f.getAttribute(`type`)||`autofit`);let p=n.querySelector(`tblW`);if(p||(p=n.querySelector(`a\\:tblW`)),p){let t=p.getAttribute(`w`),n=p.getAttribute(`type`)||p.getAttribute(`wtype`)||`auto`;t?e.preferredWidth={value:parseInt(t)||0,type:n.toLowerCase()}:e.preferredWidth={value:0,type:n.toLowerCase()}}t.tableProperties=e}}parseTableGrid(e,t){let n=e.querySelector(`tblGrid`);if(n||(n=e.querySelector(`a\\:tblGrid`)),n){let e=n.querySelectorAll(`gridCol`);e.length===0&&(e=n.querySelectorAll(`a\\:gridCol`));let r=[];e.forEach(e=>{let t=e.getAttribute(`w`),n={width:t?parseInt(t):914400,type:e.getAttribute(`type`)||`auto`};r.push(n)}),t.setTableGrid(r)}}parseTableRows(e,t){let n=e.querySelectorAll(`tr`);n.length===0&&(n=e.querySelectorAll(`a\\:tr`)),n.forEach((e,n)=>{let r=new CTableRow;this.parseRowProperties(e,r),this.parseRowCells(e,r,n),t.addRow(r)})}parseRowProperties(e,t){let n=e.querySelector(`trPr`);if(n||(n=e.querySelector(`a\\:trPr`)),n){let e=n.querySelector(`trHeight`);if(e||(e=n.querySelector(`a\\:trHeight`)),e){let n=parseInt(e.getAttribute(`val`),10);Number.isNaN(n)||(t.height=n),t.heightRule=e.getAttribute(`hRule`)||`auto`}let r=n.querySelector(`tblHeader`);r||(r=n.querySelector(`a\\:tblHeader`)),r&&(t.isHeader=!0)}if((!t.height||t.height<=0)&&e){let n=e.getAttribute(`h`);if(n!==null){let e=parseInt(n,10);!Number.isNaN(e)&&e>0&&(t.height=e,t.heightRule||(t.heightRule=`auto`))}}}parseRowCells(e,t,n){let r=e.querySelectorAll(`tc`);r.length===0&&(r=e.querySelectorAll(`a\\:tc`));let i=e.closest(`tbl`)||e.closest(`a\\:tbl`),a=10;if(i){let e=i.querySelector(`tblGrid`);if(e||(e=i.querySelector(`a\\:tblGrid`)),e){let t=e.querySelectorAll(`gridCol`);t.length===0&&(t=e.querySelectorAll(`a\\:gridCol`)),a=t.length}}let o=Array(a).fill(!1);if(n>0&&this.tableRowData)for(let e=0;e{if(t.rowSpan>1&&e+t.rowSpan-1>=n){let e=t.logicalColIndex,n=e+(t.gridSpan||1);for(let t=e;t{let i=e.getAttribute(`vMerge`),c=e.getAttribute(`gridSpan`),l=e.getAttribute(`rowSpan`),u=e.getAttribute(`hMerge`),d=e.querySelector(`tcPr`);d||(d=e.querySelector(`a\\:tcPr`));let f=null;d&&(f=d.querySelector(`vMerge`)||d.querySelector(`a\\:vMerge`));let p=u===`1`||u===`true`||s>0,m=i===`1`||i===`true`||i===`continue`,h=f&&f.getAttribute(`val`)!==`restart`,g=m||h,_=c?parseInt(c):1,v=l?parseInt(l):1;if(d){let e=d.querySelector(`gridSpan`)||d.querySelector(`a\\:gridSpan`);if(e){let t=parseInt(e.getAttribute(`val`));t>1&&(_=t)}let t=d.querySelector(`rowSpan`)||d.querySelector(`a\\:rowSpan`);if(t){let e=parseInt(t.getAttribute(`val`));e>1&&(v=e)}}let y=0;if(g){for(;y=a&&(y=0)}else{for(;y=a&&(y=Math.min(r,a-1))}let b=new CTableCell;g&&(b.isMergedContinue=!0,b.vMerge=`continue`),v>1&&(b.rowSpan=v),_>1&&(b.gridSpan=_);let x=p?0:g?1:_;for(let e=0;e0&&s--:s=!g&&_>1?_-1:0,this.parseCellProperties(e,b,n,r),this.parseCellContent(e,b),p&&(b.isMergedContinue=!0,b.mergeParent=null),b.logicalRowIndex=n,b.logicalColIndex=y,this.tableRowData[n].push({logicalColIndex:y,gridSpan:_,rowSpan:v,isVerticalContinuation:g}),t.addCell(b)})}parseCellProperties(e,t,n,r){let i=e.querySelector(`tcPr`);if(i||(i=e.querySelector(`a\\:tcPr`)),i){let e=i.querySelector(`gridSpan`);e||(e=i.querySelector(`a\\:gridSpan`)),e&&(t.gridSpan=parseInt(e.getAttribute(`val`))||1);let n=i.querySelector(`rowSpan`);n||(n=i.querySelector(`a\\:rowSpan`)),n&&(t.rowSpan=parseInt(n.getAttribute(`val`))||1);let r=i.querySelector(`vMerge`);r||(r=i.querySelector(`a\\:vMerge`)),r&&(t.vMerge=r.getAttribute(`val`)===`restart`?`start`:`continue`);let a=i.getAttribute(`anchor`);a&&(t.verticalAlignment=a);let o=i.getAttribute(`vert`);o&&(t.textDirection=o);let s=this.parseCellBordersFromTcPr(i);s&&(t.borders=s);let c=Array.from(i.children).find(e=>e.tagName===`a:solidFill`||e.tagName===`solidFill`);if(c)t.shading=this.parseCellShading(c);else{let e=i.querySelectorAll(`solidFill, a\\:solidFill`),n=null;for(let t of e){let e=t.parentElement,r=!1;for(;e&&e!==i;){if(e.tagName===`a:lnL`||e.tagName===`a:lnR`||e.tagName===`a:lnT`||e.tagName===`a:lnB`||e.tagName===`lnL`||e.tagName===`lnR`||e.tagName===`lnT`||e.tagName===`lnB`){r=!0;break}e=e.parentElement}if(!r){n=t;break}}n&&(t.shading=this.parseCellShading(n))}let l=i.querySelector(`tcMar`);if(l||(l=i.querySelector(`a\\:tcMar`)),l)t.margins=this.parseCellMargins(l);else{let e=i.getAttribute(`marL`),n=i.getAttribute(`marR`),r=i.getAttribute(`marT`),a=i.getAttribute(`marB`);(e||n||r||a)&&(t.margins={left:e?parseInt(e):null,right:n?parseInt(n):null,top:r?parseInt(r):null,bottom:a?parseInt(a):null})}}}parseCellContent(e,t){let n=this.parseTextBodyFromElement(e);n&&t.setTextBody(n)}appendMergedCellText(e,t){if(!t||t.mergedContentTransferred)return;let n=t.getTextBody&&t.getTextBody();if(!n||!n.paragraphs||n.paragraphs.length===0||!e.getTextBody||!e.setTextBody)return;let r=e.getTextBody();!r||!r.paragraphs?e.setTextBody({paragraphs:[...n.paragraphs]}):(r.paragraphs.length>0&&r.paragraphs.push({runs:[],properties:{}}),r.paragraphs.push(...n.paragraphs)),t.mergedContentTransferred=!0,t.setTextBody&&t.setTextBody({paragraphs:[]})}processTableMerges(e){let t=e.getRows();for(let n=0;n1&&this.processHorizontalMerge(e,n,i,a.gridSpan),a.rowSpan>1&&this.processVerticalMerge(e,n,i,a.rowSpan),a.vMerge===`start`){let r=1;for(let o=n+1;o=0;t--){let r=e.getCell(t,i);if(!r)break;if(r.vMerge===`start`){a.isMergedContinue=!0,a.mergeParent={row:t,col:i};let e=n-t+1;(!r.rowSpan||r.rowSpan1&&r+a.rowSpan-1>=e){let e=Math.max(0,a.logicalColIndex||0),r=Math.min(n,e+Math.max(1,a.gridSpan||1));for(let n=e;no*2)){console.warn(`Row ${e}: total span ${i} mismatches available columns ${o} (grid cols ${n}, covered from above ${a})`);try{let t=r.map((e,t)=>`c${t}{gs:${e.gridSpan||1},rs:${e.rowSpan||1},cont:${!!e.isMergedContinue},v:${e.vMerge||``},lc:${e.logicalColIndex||0}}`).join(` | `);console.warn(`[TableProcessor][DEBUG] Row ${e} cells(${r.length}): ${t}`)}catch{}return!1}}return!0}parseTableBorders(e){let t={};return[`top`,`left`,`bottom`,`right`,`insideH`,`insideV`].forEach(n=>{let r=e.querySelector(n);r||(r=e.querySelector(`a\\:${n}`)),r&&(t[n]=this.parseBorderProperties(r))}),t}parseCellBordersFromTcPr(e){let t={};for(let[n,r]of Object.entries({lnL:`left`,lnR:`right`,lnT:`top`,lnB:`bottom`})){let i=e.querySelector(n);if(i||(i=e.querySelector(`a\\:${n}`)),i){let e=parseInt(i.getAttribute(`w`))||0,n=this.parseColor(i),a=e>0?Math.max(1,Math.round(this.convertEMUToPixels(e))):1;n!==null&&a>0&&(t[r]={style:`single`,width:a,color:n})}}return Object.keys(t).length>0?t:null}parseCellBorders(e){return this.parseTableBorders(e)}parseBorderProperties(e){let t=this.parseColor(e),n=parseInt(e.getAttribute(`w`))||0,r=0;if(n>0)r=Math.max(1,Math.round(this.convertEMUToPixels(n)));else{let t=parseInt(e.getAttribute(`sz`))||0;if(t>0){let e=t/8;r=Math.max(1,Math.round(96/72*e))}}return{style:e.getAttribute(`val`)||`single`,width:r,size:parseInt(e.getAttribute(`sz`))||0,color:t,space:parseInt(e.getAttribute(`space`))||0}}parseTableShading(e){return this.parseCellShading(e)}parseCellShading(e){let t=e.getAttribute(`fill`),n=e.getAttribute(`color`),r=null;if(e.tagName===`a:solidFill`||e.tagName===`solidFill`)r=this.parseColor(e);else{let t=e.querySelector(`solidFill`)||e.querySelector(`a\\:solidFill`);t&&(r=this.parseColor(t))}return{fill:t,color:n?this.parseColorFromHex(n):null,fillColor:r}}parseCellMargins(e){let t={};return[`top`,`left`,`bottom`,`right`].forEach(n=>{let r=e.querySelector(n);r||(r=e.querySelector(`a\\:${n}`)),r&&(t[n]=parseInt(r.getAttribute(`w`))||0)}),t}extractTableStructure(e){if(!e.graphicData||!e.graphicData.tableXml)return null;try{let t=this.parseTableFromXML(e.graphicData.tableXml);return t?{id:e.id,name:e.name,type:`table`,properties:this.extractTableProperties(t),structure:this.extractTableStructureData(t),content:this.extractTableContent(t),styling:this.extractTableStyling(t),position:e.bounds||e.properties?.transform,metadata:{rowCount:t.getRowCount(),columnCount:t.getColumnCount(),hasMergedCells:this.hasMergedCells(t),tableStyle:t.getTableProperties()?.style||`TableGrid`}}:null}catch(e){return console.warn(`Error extracting table structure:`,e),null}}extractTableProperties(e){let t=e.getTableProperties()||{};return{style:t.style||`TableGrid`,layout:t.layout||`autofit`,width:t.width||`auto`,alignment:t.alignment||`left`,borders:t.borders||{},shading:t.shading||{},spacing:{before:t.spacing?.before||0,after:t.spacing?.after||0,line:t.spacing?.line||240}}}extractTableStructureData(e){let t=e.getRows();return{grid:e.getTableGrid().map((e,t)=>({index:t,width:e.width,type:e.type||`auto`})),rows:t.map((e,t)=>({index:t,height:e.height,heightRule:e.heightRule||`auto`,isHeader:e.isHeader||!1,cells:e.getCells().map((e,t)=>({index:t,gridSpan:e.gridSpan||1,rowSpan:e.rowSpan||1,vMerge:e.vMerge||null,isMergedContinue:e.isMergedContinue||!1,mergeParent:e.mergeParent||null}))}))}}extractTableContent(e){return{cells:e.getRows().map((e,t)=>e.getCells().map((e,n)=>({rowIndex:t,cellIndex:n,text:this.extractCellText(e),textBody:this.extractCellTextBody(e),content:this.extractCellContent(e)})))}}extractTableStyling(e){let t=e.getRows();return{table:{borders:e.getTableProperties()?.borders||{},shading:e.getTableProperties()?.shading||{},style:e.getTableProperties()?.style||`TableGrid`},rows:t.map((e,t)=>({index:t,height:e.height,heightRule:e.heightRule||`auto`,isHeader:e.isHeader||!1})),cells:t.map((e,t)=>e.getCells().map((e,n)=>({rowIndex:t,cellIndex:n,borders:e.borders||{},shading:e.shading||{},margins:e.margins||{},verticalAlignment:e.verticalAlignment||`top`,textDirection:e.textDirection||`lr`})))}}hasMergedCells(e){let t=e.getRows();for(let e of t)for(let t of e.getCells())if(t.gridSpan>1||t.rowSpan>1||t.isMergedContinue)return!0;return!1}extractCellTextBody(e){let t=e.getTextBody();return!t||!t.paragraphs?null:{paragraphs:t.paragraphs.map(e=>({properties:e.properties||{},runs:e.runs?.map(e=>({text:e.text||``,properties:e.properties||{}}))||[]}))}}extractCellContent(e){let t={type:`text`,data:null},n=e.getTextBody();return n&&n.paragraphs&&(t.type=`text`,t.data=this.extractCellTextBody(e)),t}extractCellText(e){return!e.textBody||!e.textBody.paragraphs?``:e.textBody.paragraphs.map(e=>e.runs?e.runs.map(e=>e.text||``).join(``):``).join(` +`)}getTableData(e){return null}getAllTableData(e){let t=[];for(let n=0;n{let t={runs:[],properties:{}},r=e.querySelector(`pPr`);if(r||(r=e.querySelector(`a\\:pPr`)),r){let e=r.getAttribute(`algn`);e&&(t.properties.alignment=e)}let i=e.querySelectorAll(`r`);i.length===0&&(i=e.querySelectorAll(`a\\:r`)),i.forEach(e=>{let n={text:``,properties:{}},r=e.querySelector(`t`);r||(r=e.querySelector(`a\\:t`)),r&&(n.text=r.textContent||``);let i=e.querySelector(`rPr`);if(i||(i=e.querySelector(`a\\:rPr`)),i){let e=i.querySelector(`solidFill`)||i.querySelector(`a\\:solidFill`);e&&(n.properties.color=this.parseColor(e));let t=i.getAttribute(`sz`);t?n.properties.fontSize=parseInt(t)/100:n.properties.fontSize=12,n.properties.bold=i.getAttribute(`b`)===`1`,n.properties.italic=i.getAttribute(`i`)===`1`;let r=i.getAttribute(`u`);r&&r!==`none`&&(n.properties.underline=!0);let a=i.getAttribute(`strike`);a&&a!==`noStrike`&&(n.properties.strikethrough=!0);let o=i.getAttribute(`typeface`)||i.getAttribute(`fontFamily`);if(!o){let e=i.querySelector(`latin`)||i.querySelector(`a\\:latin`);e&&(o=e.getAttribute(`typeface`))}o?n.properties.fontFamily=o:n.properties.fontFamily=`Arial`}t.runs.push(n)}),n.paragraphs.push(t)}),n.paragraphs.length>0?n:null}parseColor(e){if(!e||e.querySelector(`noFill`)||e.querySelector(`a\\:noFill`))return null;let t=e.querySelector(`solidFill`)||e.querySelector(`a\\:solidFill`);if(t){let e=t.querySelector(`srgbClr`)||t.querySelector(`a\\:srgbClr`);if(e){let t=e.getAttribute(`val`);if(t){let e=this.parseColorFromHex(t);if(e)return e}}let n=t.querySelector(`schemeClr`)||t.querySelector(`a\\:schemeClr`);if(n){let e=n.getAttribute(`val`),t=this.resolveSchemeColor(e);if(t)return t}}let n=e.querySelector(`srgbClr`)||e.querySelector(`a\\:srgbClr`);if(n){let e=n.getAttribute(`val`);if(e){let t=this.parseColorFromHex(e);if(t)return t}}let r=e.querySelector(`schemeClr`)||e.querySelector(`a\\:schemeClr`);if(r){let e=r.getAttribute(`val`),t=this.resolveSchemeColor(e);if(t)return t}let i=e.getAttribute(`color`);if(i){let e=this.parseColorFromHex(i);if(e)return e}return null}resolveSchemeColor(e){if(!e)return null;let t={tx1:`#000000`,tx2:`#FFFFFF`,bg1:`#FFFFFF`,bg2:`#EEECE1`,accent1:`#5B9BD5`,accent2:`#ED7D31`,accent3:`#A5A5A5`,accent4:`#FFC000`,accent5:`#4472C4`,accent6:`#70AD47`}[e];return t?this.parseColorFromHex(t):null}parseColorFromHex(e){return!e||typeof e!=`string`?null:(e=e.replace(`#`,``),e.length===6?{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:255}:e.length===3?{r:parseInt(e.charAt(0)+e.charAt(0),16),g:parseInt(e.charAt(1)+e.charAt(1),16),b:parseInt(e.charAt(2)+e.charAt(2),16),a:255}:null)}convertEMUToPixels(e){return!e||typeof e!=`number`?3.78:e/914400*96}cleanup(){this.tableCache.clear()}_getValidator(){return typeof window<`u`&&window.DataValidator?window.DataValidator:class{validate(){return{valid:!0,errors:[]}}}}_getErrorBoundary(){return typeof window<`u`&&window.ErrorBoundary?window.ErrorBoundary:class{constructor(){}wrap(e){return e}}}_validateConfig(e){let t={type:`object`,properties:{maxTableSize:{type:`number`,minimum:1,maximum:1e4},maxCellTextLength:{type:`number`,minimum:1,maximum:1e5},enableCaching:{type:`boolean`},enableValidation:{type:`boolean`},renderTimeout:{type:`number`,minimum:1e3,maximum:6e4}}};try{let n=new(this._getValidator())({throwOnError:!1}).validate(e,t);!n.valid&&this.logger&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`Invalid configuration:`,n.errors)}catch{}return e}_validateRenderInput(e,t,n,r,i,a,o){let s=[];if(!e||typeof e!=`object`)s.push(`Graphics object is required`);else for(let t of[`SaveGrState`,`RestoreGrState`,`b_color1`,`TableRect`])typeof e[t]!=`function`&&s.push(`Graphics object missing required method: ${t}`);return(!t||typeof t!=`object`)&&s.push(`Shape object is required`),(typeof n!=`number`||!isFinite(n))&&s.push(`X coordinate must be a finite number`),(typeof r!=`number`||!isFinite(r))&&s.push(`Y coordinate must be a finite number`),(typeof i!=`number`||!isFinite(i)||i<=0)&&s.push(`Width must be a positive finite number`),(typeof a!=`number`||!isFinite(a)||a<=0)&&s.push(`Height must be a positive finite number`),o&&typeof o!=`object`&&s.push(`Options must be an object`),{valid:s.length===0,errors:s}}_validateTableXML(e){if(typeof e!=`string`||e.trim().length===0)throw this._createError(`Table XML must be a non-empty string`,{name:`ValidationError`,code:`INVALID_TABLE_XML`});if(!e.includes(`<`)||!e.includes(`>`))throw this._createError(`Table XML does not appear to be valid XML`,{name:`ValidationError`,code:`MALFORMED_TABLE_XML`});if(![`tbl`,`tr`,`tc`].some(t=>e.includes(`<${t}`)||e.includes(`this.config.maxTableSize)throw this._createError(`Table size ${t*n} exceeds maximum ${this.config.maxTableSize}`,{name:`ValidationError`,code:`TABLE_TOO_LARGE`})}_validateTableStructure(e){try{let t=e.getRowCount(),n=e.getColumnCount();(t>100||n>50)&&this.logger&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`Large table detected: ${t}x${n}`);let r=0;for(let i=0;ithis.config.maxCellTextLength&&this.logger&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`Cell text length ${n.textBody.length} exceeds maximum ${this.config.maxCellTextLength}`))}if(r===0)throw this._createError(`Table has no valid cells`,{name:`ValidationError`,code:`EMPTY_TABLE`})}catch(e){throw this._enhanceError(e,`table_structure_validation`)}}async _safeDrawTableBackgroundAndOuterBorder(e,t,n,r,i,a){try{this.drawTableBackgroundAndOuterBorder(e,t,n,r,i,a)}catch(e){this.logger&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`Error drawing table background/border:`,e)}}async _safeDrawCellsBackground(e,t,n,r,i,a){try{this.drawCellsBackground(e,t,n,r,i,a)}catch(e){this.logger&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`Error drawing cell backgrounds:`,e)}}async _safeDrawCellsContent(e,t,n,r,i,a){try{this.drawCellsContent(e,t,n,r,i,a)}catch(e){throw console.error(`[TableProcessor] DETAILED ERROR drawing cell content:`),console.error(`[TableProcessor] Error message:`,e.message),console.error(`[TableProcessor] Error stack:`,e.stack),console.error(`[TableProcessor] Error object:`,e),this.logger&&this.logger.logError(this.constructor.name,`TableProcessor`,`Error drawing cell content:`,e),e}}async _safeDrawCellsBorders(e,t,n,r,i,a){try{this.drawCellsBorders(e,t,n,r,i,a)}catch(e){this.logger&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`Error drawing cell borders:`,e)}}_handleValidationError(e,t){let n=`Validation failed for ${e}: ${t.join(`, `)}`;return this.logger&&this.logger.logError(this.constructor.name,`TableProcessor`,n),this._createError(n,{name:`ValidationError`,code:`INPUT_VALIDATION_FAILED`,details:{operation:e,errors:t}})}_updatePerformanceMetrics(e){this.performanceMetrics.tablesProcessed++;let t=performance.now()-e,n=this.performanceMetrics.averageRenderTime*(this.performanceMetrics.tablesProcessed-1);this.performanceMetrics.averageRenderTime=(n+t)/this.performanceMetrics.tablesProcessed,this.logger&&t>1e3&&this.logger.log(`warn`,this.constructor.name,`TableProcessor`,`Slow table render: ${Math.round(t)}ms`)}_createError(e,t={}){let n=Error(e);return n.name=t.name||`TableProcessingError`,n.code=t.code||null,n.context=`TableProcessor`,n.timestamp=new Date().toISOString(),n.recoverable=t.recoverable!==!1,t.details&&(n.details=t.details),n}_enhanceError(e,t,n={}){if(e.enhanced)return e;let r=e instanceof Error?e:Error(String(e));return r.operation=t,r.tableProcessorContext=n,r.timestamp=new Date().toISOString(),r.enhanced=!0,r}getPerformanceMetrics(){return{...this.performanceMetrics,cacheHitRatio:this.performanceMetrics.cacheHits/(this.performanceMetrics.cacheHits+this.performanceMetrics.cacheMisses)||0}}resetPerformanceMetrics(){this.performanceMetrics={tablesProcessed:0,cacheHits:0,cacheMisses:0,averageRenderTime:0}}});var su={exports:{}};su.exports;var cu;function lu(){return cu?su.exports:(cu=1,(function(e){class t{constructor(){this.type=``,this.subtype=``,this.is3D=!1,this.title=``,this.series=[],this.categories=[],this.styling={},this.legend=null,this.axes={},this.plotArea={},this.dataLabels={},this.raw=null}}class n{constructor(){this.index=0,this.name=``,this.values=[],this.categories=[],this.fill=null,this.line=null,this.marker=null,this.dataLabels=null,this.trendlines=[]}}class r{constructor(e,t={}){this.context=e,this.currentSlideContext=null;try{this.logger=new Logger(`ChartProcessor`)}catch(e){console.warn(`[ChartProcessor] Logger initialization failed, using fallback:`,e),this.logger=this._createFallbackLogger()}this.fontConfig=null}setSlideContext(e){this.currentSlideContext=e}clearSlideContext(){this.currentSlideContext=null}async parseChartFromGraphicFrame(e){try{let t=this.getShapeName(e),n=e.querySelector(`graphic`)||e.querySelector(`a\\:graphic`)||e.querySelector(`[*|localName="graphic"]`);if(!n)return null;let r=n.querySelector(`graphicData`)||n.querySelector(`a\\:graphicData`)||n.querySelector(`[*|localName="graphicData"]`);if(!r||r.getAttribute(`uri`)!==`http://schemas.openxmlformats.org/drawingml/2006/chart`)return null;let i=r.querySelector(`chart`)||r.querySelector(`c\\:chart`)||r.querySelector(`[*|localName="chart"]`);if(!i)return r.querySelector(`chartSpace, c\\:chartSpace`)?this.parseEmbeddedChartData(r,t):null;let a=i.getAttribute(`r:id`);if(!a){let e=this.parseEmbeddedChartData(r,t);return e&&this.hasRealChartData(e)?e:null}return this.currentSlideContext?await this.loadChartFromRelationship(a,this.currentSlideContext):{type:`DEFERRED_CHART`,relationshipId:a,needsSlideContext:!0}}catch(e){return this.logger.logError(this.constructor.name,`ChartProcessor`,`Error parsing chart from graphic frame`,e),null}}parseEmbeddedChartData(e,n=null){let r=new t;try{let t=e.querySelector(`chartSpace, c\\:chartSpace`);return t?(this.parseChartSpace(t,r),r):null}catch(e){return this.logger.logError(this.constructor.name,`ChartProcessor`,`Error parsing embedded chart data`,e),null}}parseChartSpace(e,t){let n=e.querySelector(`roundedCorners, c\\:roundedCorners`);if(n){let e=n.getAttribute(`val`);t.roundedCorners=e===`1`||e===`true`}else t.roundedCorners=!1;let r=e.querySelector(`chart, c\\:chart`);r&&this.parseChart(r,t);let i=Array.from(e.children||[]).find(e=>e.localName===`spPr`);i&&(t.chartSpaceShapeProperties=this.parseShapeProperties(i)),this.parsePrintSettings(e,t),this.parseExternalData(e,t)}parseChart(e,t){let n=e.querySelector(`title, c\\:title`);n&&(t.title=this.parseTitle(n));let r=e.querySelector(`plotArea, c\\:plotArea`);r&&this.parsePlotArea(r,t);let i=e.querySelector(`legend, c\\:legend`);i&&(t.legend=this.parseLegend(i));let a=e.querySelector(`autoTitleDeleted, c\\:autoTitleDeleted`);a&&a.getAttribute(`val`)===`1`&&(t.title=``),t.hasDataTable=!!e.querySelector(`dTable, c\\:dTable`)}parsePlotArea(e,t){t.plotArea=this.parsePlotAreaProperties(e);let n=[`barChart`,`bar3DChart`,`colChart`,`col3DChart`,`lineChart`,`line3DChart`,`pieChart`,`pie3DChart`,`doughnutChart`,`areaChart`,`area3DChart`,`scatterChart`,`bubbleChart`,`radarChart`,`stockChart`,`surfaceChart`,`surface3DChart`,`waterfallChart`,`comboChart`,`sunburstChart`,`treemapChart`,`histogramChart`,`boxWhiskerChart`],r=!1;for(let i of n){let n=e.querySelectorAll(`${i}, c\\:${i}`);for(let e of n)if(!r)this.parseSpecificChart(e,i,t),r=!0;else{let n=this.normalizeChartType(i),r=e.querySelectorAll(`ser, c\\:ser`);for(let e=0;e0&&(r.pointFills=[],e.forEach(e=>{let t=e.querySelector(`idx, c\\:idx`),n=e.querySelector(`spPr, c\\:spPr`);if(t&&n){let e=parseInt(t.getAttribute(`val`));if(!isNaN(e)){let t=this.parseShapeProperties(n);t&&t.fill&&(r.pointFills[e]=t.fill)}}}))}catch(e){this.logger.log(`warn`,this.constructor.name,`Error parsing data point formatting (dPt):`,e)}!r.dataLabels&&n.dataLabels?r.dataLabels={...n.dataLabels}:r.dataLabels,n.series.push(r)}}try{if(n.type===`pie`||n.type===`doughnut`){let t=e.querySelector(`firstSliceAng, c\\:firstSliceAng`);if(t){let e=parseInt(t.getAttribute(`val`));isNaN(e)||(n.firstSliceAng=e)}let r=e.querySelector(`holeSize, c\\:holeSize`);if(r){let e=parseInt(r.getAttribute(`val`));isNaN(e)||(n.holeSize=e)}}if(n.type===`waterfall`){n.waterfallType=`standard`;let t=e.querySelectorAll(`subtotal, c\\:subtotal`);t.length>0&&(n.subtotals=[],t.forEach(e=>{let t=e.getAttribute(`val`);t&&n.subtotals.push({value:t})}))}if(n.type===`combo`&&(n.comboTypes=[],[`barChart`,`lineChart`,`areaChart`,`scatterChart`].forEach(t=>{e.querySelector(`${t}, c\\:${t}`)&&n.comboTypes.push(this.normalizeChartType(t))})),n.type===`radar`){let t=e.querySelector(`radarStyle, c\\:radarStyle`);t?n.radarStyle=t.getAttribute(`val`)||`standard`:n.radarStyle=`standard`}if(n.type===`bubble`){let t=e.querySelector(`bubble3D, c\\:bubble3D`);t&&(n.bubble3D=t.getAttribute(`val`)===`1`);let r=e.querySelector(`bubbleScale, c\\:bubbleScale`);if(r){let e=parseInt(r.getAttribute(`val`));isNaN(e)||(n.bubbleScale=e)}}}catch(e){this.logger.log(`warn`,this.constructor.name,`Error parsing chart type-specific properties:`,e)}n.categories.length===0&&n.series.length>0&&(n.categories=[...n.series[0].categories]),n.series.length>0&&n.series[0].categoryFormatCode&&(n.categoryFormatCode=n.series[0].categoryFormatCode),n.series.length>0&&n.series[0].outerCategoryLevels&&(n.outerCategoryLevels=n.series[0].outerCategoryLevels)}parseSeries(e,t){let r=new n;try{let t=e.querySelector(`idx, c\\:idx`);t&&(r.index=parseInt(t.getAttribute(`val`))||0);let n=e.querySelector(`tx, c\\:tx`);n&&(r.name=this.parseSeriesText(n));let i=e.querySelector(`cat, c\\:cat`),a=e.querySelector(`xVal, c\\:xVal`);if(i){r.categories=this.parseSeriesData(i);let e=i.querySelector(`numRef, c\\:numRef`);if(e){let t=e.querySelector(`numCache, c\\:numCache`);if(t){let e=t.querySelector(`formatCode, c\\:formatCode`);e&&e.textContent&&(r.categoryFormatCode=e.textContent.trim())}}let t=i.querySelector(`multiLvlStrRef, c\\:multiLvlStrRef`);t&&(r.outerCategoryLevels=this.parseOuterCategoryLevels(t,r.categories.length))}else a&&(r.categories=this.parseSeriesData(a));let o=e.querySelector(`val, c\\:val`),s=e.querySelector(`yVal, c\\:yVal`);o?r.values=this.parseSeriesData(o):s&&(r.values=this.parseSeriesData(s));let c=e.querySelector(`bubbleSize, c\\:bubbleSize`);c&&(r.bubbleSizes=this.parseSeriesData(c)),r.fill=this.parseSeriesFill(e),r.line=this.parseSeriesLine(e),r.marker=this.parseSeriesMarker(e);let l=e.querySelector(`spPr, c\\:spPr`);if(l){let e=this.parseShapeProperties(l);e.outerShadow&&(r.outerShadow=e.outerShadow)}let u=e.querySelector(`smooth, c\\:smooth`);r.smooth=u?u.getAttribute(`val`)===`1`:!1,r.fill&&r.fill!==`noFill`&&(r.fill.r!==void 0||typeof r.fill==`string`)?r.color=r.fill:r.line&&(r.line.r!==void 0||typeof r.line==`string`)&&(r.color=r.line);let d=e.querySelector(`dLbls, c\\:dLbls`);if(d&&(r.dataLabels=this.parseDataLabels(d),r.dataLabels&&r.dataLabels.formatting&&r.dataLabels.formatting.font)){let e=r.dataLabels.formatting.font;e.size&&!e.fontSize&&(e.fontSize=e.size,delete e.size)}return r}catch(e){return this.logger.logError(this.constructor.name,`ChartProcessor`,`Error parsing series`,e),null}}parseSeriesData(e){let t=[];try{let t=e.querySelector(`numRef, c\\:numRef`),n=e.querySelector(`strRef, c\\:strRef`),r=e.querySelector(`multiLvlStrRef, c\\:multiLvlStrRef`),i=e.querySelector(`numLit, c\\:numLit`),a=e.querySelector(`strLit, c\\:strLit`);if(t)return this.parseNumberReference(t);if(n)return this.parseStringReference(n);if(r)return this.parseMultiLevelStringReference(r);if(i)return this.parseNumberLiteral(i);if(a)return this.parseStringLiteral(a)}catch(e){this.logger.logError(this.constructor.name,`ChartProcessor`,`Error parsing series data`,e)}return t}parseNumberReference(e){let t=[],n=e.querySelector(`numCache, c\\:numCache`);if(n){let e=n.querySelectorAll(`pt, c\\:pt`);for(let n of e){let e=n.querySelector(`v, c\\:v`);if(e){let n=parseFloat(e.textContent);t.push(isNaN(n)?0:n)}}}return t}parseStringReference(e){let t=[],n=e.querySelector(`strCache, c\\:strCache`);if(n){let e=n.querySelectorAll(`pt, c\\:pt`);for(let n of e){let e=n.querySelector(`v, c\\:v`);e&&t.push(e.textContent||``)}}return t}parseMultiLevelStringReference(e){let t=[];try{let n=e.querySelector(`multiLvlStrCache, c\\:multiLvlStrCache`);if(n){let e=n.querySelectorAll(`lvl, c\\:lvl`),r=e.length>0?e[0]:null;if(r){let e=r.querySelectorAll(`pt, c\\:pt`);for(let n of e){let e=n.querySelector(`v, c\\:v`);e&&t.push(e.textContent||``)}}}return t}catch(e){return this.logger.logError(this.constructor.name,`ChartProcessor`,`Error parsing multi-level string reference`,e),[]}}parseOuterCategoryLevels(e,t){try{let n=e.querySelector(`multiLvlStrCache, c\\:multiLvlStrCache`);if(!n)return null;let r=n.querySelectorAll(`lvl, c\\:lvl`);if(r.length<2)return null;let i=[];for(let e=1;e0&&i.push(a)}return i.length>0?i:null}catch{return null}}parseNumberLiteral(e){let t=[],n=e.querySelectorAll(`pt, c\\:pt`);for(let e of n){let n=e.querySelector(`v, c\\:v`);if(n){let e=parseFloat(n.textContent);t.push(isNaN(e)?0:e)}}return t}parseStringLiteral(e){let t=[],n=e.querySelectorAll(`pt, c\\:pt`);for(let e of n){let n=e.querySelector(`v, c\\:v`);n&&t.push(n.textContent||``)}return t}parseSeriesText(e){let t=e.querySelector(`strRef, c\\:strRef`);if(t){let e=t.querySelector(`strCache, c\\:strCache`);if(e){let t=e.querySelector(`pt, c\\:pt`);if(t){let e=t.querySelector(`v, c\\:v`);if(e)return e.textContent||``}}}let n=e.querySelector(`v, c\\:v`);return n&&n.textContent||``}normalizeChartType(e,t=null){let n={barChart:`bar`,bar3DChart:`bar`,colChart:`column`,col3DChart:`column`,lineChart:`line`,line3DChart:`line`,pieChart:`pie`,pie3DChart:`pie`,doughnutChart:`doughnut`,areaChart:`area`,area3DChart:`area`,scatterChart:`scatter`,bubbleChart:`bubble`,radarChart:`radar`,stockChart:`stock`,surfaceChart:`surface`,surface3DChart:`surface`,waterfallChart:`waterfall`,comboChart:`combo`,sunburstChart:`sunburst`,treemapChart:`treemap`,histogramChart:`histogram`,boxWhiskerChart:`boxWhisker`}[e]||e;return(e===`barChart`||e===`bar3DChart`)&&t&&t.barDirection&&(t.barDirection===`col`?n=`column`:t.barDirection===`bar`&&(n=`bar`)),n}hasRealChartData(e){if(!e||!e.series||e.series.length===0)return!1;let t=e.series[0];if(!t.values||t.values.length===0)return!1;let n=[4500,5200,4800,6100,5900];return!(t.values.length===n.length&&t.values.every((e,t)=>e===n[t]))}createPlaceholderChart(e,r=null){let i=new t;i.type=`line`,i.title={text:r||`Chart`,formatting:{font:{fontFamily:`Calibri`,fontSize:16,bold:!0},color:{r:0,g:0,b:0},alignment:`center`}},i.subtitle=`Quarterly Revenue Trends 2023-2024`,i.categories=[`Q1 2023`,`Q2 2023`,`Q3 2023`,`Q4 2023`,`Q1 2024`];let a=new n;return a.index=0,a.name=`Sales Trend`,a.values=[4500,5200,4800,6100,5900],a.categories=[...i.categories],i.series.push(a),i.axes={category:{id:`catAx1`,type:`category`,position:`bottom`,title:`Time Period`,scaling:{min:null,max:null,orientation:`minMax`},tickMarks:{major:`outside`,minor:`none`},tickLabels:{position:`nextTo`,rotation:null,format:null},gridlines:{major:!0,minor:!1},visible:!0,crosses:`autoZero`},value:{id:`valAx1`,type:`value`,position:`left`,title:`Revenue ($000s)`,scaling:{min:0,max:7e3,orientation:`minMax`},tickMarks:{major:`outside`,minor:`none`},tickLabels:{position:`nextTo`,format:{formatCode:`#,##0`,sourceLinked:!1}},gridlines:{major:!0,minor:!1},visible:!0,crosses:`autoZero`},series:null},i.legend={position:`b`,overlay:!1,visible:!0,legendPos:`b`},i.dataLabels={showValue:!0,showCategoryName:!1,showSeriesName:!1,showPercent:!1,position:`above`,formatting:{font:{fontFamily:`Arial`,fontSize:9,bold:!0},color:{r:60,g:60,b:60},number:{formatCode:`#,##0`,sourceLinked:!1}},separator:`, `,delete:!1},i.showDataLabels=!0,i.styling={chartArea:{proportions:{width:.85,height:.75}},plotArea:{margins:{left:80,right:20,top:20,bottom:70}}},i}extractChartData(e,t={}){try{if(!e)throw Error(`Shape parameter is required`);let n=null;if(e.type===`graphicFrame`)n=this.parseChartFromGraphicFrame(e.element||e);else if(e.graphicData)if(e.graphicData.element)n=this.parseEmbeddedChartData(e.graphicData.element,e.name);else return null;else n=e.tagName?this.parseChartFromGraphicFrame(e):this.extractFromRawData(e,t);return n&&this.validateChartData(n,t)&&this.hasRealChartData(n)?n:(this.logger.log(`warn`,this.constructor.name,`Chart data extraction failed validation or contains hardcoded data`),null)}catch(e){if(this.logger.logError(this.constructor.name,`ChartProcessor`,`Error extracting chart data`,e),console.error(`[ChartProcessor] Error extracting chart data`,e),t.throwOnError)throw e;return null}}validateChartData(e,n={}){try{if(!e||!(e instanceof t)&&(this.logger.log(`warn`,this.constructor.name,`Chart data is not an instance of ChartData class`),n.strict))return!1;let r={hasType:this.validateChartType(e.type),hasSeries:this.validateChartSeries(e.series),hasValidData:this.validateChartDataContent(e),hasValidStructure:this.validateChartStructure(e)};return[`hasType`,`hasSeries`,`hasValidData`].every(e=>r[e])?n.strict&&!r.hasValidStructure?(this.logger.log(`warn`,this.constructor.name,`Chart data failed strict structure validation`),!1):!0:(this.logger.log(`warn`,this.constructor.name,`Chart data failed required validation checks:`,{type:r.hasType,series:r.hasSeries,data:r.hasValidData}),!1)}catch(e){return this.logger.logError(this.constructor.name,`ChartProcessor`,`Error validating chart data`,e),!1}}validateChartType(e){return typeof e==`string`&&e.length>0&&[`area`,`bar`,`bar3d`,`bubble`,`doughnut`,`line`,`pie`,`radar`,`scatter`,`stock`,`surface`,`waterfall`,`combo`,`sunburst`,`treemap`,`histogram`,`boxWhisker`].includes(e.toLowerCase())}validateChartSeries(e){return!Array.isArray(e)||e.length===0?!1:e.every(e=>this.validateSingleSeries(e))}validateSingleSeries(e){if(!e)return!1;let t=typeof e.index==`number`&&e.index>=0,n=Array.isArray(e.values)&&e.values.length>0,r=typeof e.name==`string`,i=this.validateSeriesDataConsistency(e);return t&&n&&r&&i}validateSeriesDataConsistency(e){if(!e.values||e.values.length===0)return!1;let t=e.values.every(e=>typeof e==`number`&&!isNaN(e)&&isFinite(e)),n=!0;return e.categories&&e.categories.length>0&&(n=e.categories.length===e.values.length),t&&n}validateChartDataContent(e){return!e.series||e.series.length===0?!1:e.series.some(e=>e.values&&e.values.length>0&&e.values.some(e=>e!==0&&e!=null))}validateChartStructure(e){try{if(this.hasCircularReferences(e))return!1;let t=typeof e.type==`string`&&Array.isArray(e.series)&&Array.isArray(e.categories),n=e.series.every(e=>e&&typeof e.index==`number`&&Array.isArray(e.values));return t&&n}catch(e){return this.logger.logError(this.constructor.name,`ChartProcessor`,`Error validating chart structure`,e),!1}}hasCircularReferences(e,t=new Set){if(typeof e!=`object`||!e)return!1;if(t.has(e))return!0;t.add(e);try{for(let n in e)if(e.hasOwnProperty(n)&&this.hasCircularReferences(e[n],t))return!0}catch{return!0}return t.delete(e),!1}extractFromRawData(e,r={}){try{let r=new t;return e.type&&(r.type=this.normalizeChartType(e.type)),e.title&&(r.title=String(e.title)),e.series&&Array.isArray(e.series)&&(r.series=e.series.map((e,t)=>{let r=new n;return r.index=e.index||t,r.name=e.name||`Series ${t+1}`,r.values=Array.isArray(e.values)?e.values:[],r.categories=Array.isArray(e.categories)?e.categories:[],r})),e.categories&&Array.isArray(e.categories)&&(r.categories=e.categories),r}catch(e){return this.logger.logError(this.constructor.name,`ChartProcessor`,`Error extracting from raw data`,e),null}}parseTitle(e){try{let t={text:``,formatting:{font:{fontFamily:`Calibri`,fontSize:16,bold:!1},color:{r:0,g:0,b:0},alignment:`center`},overlay:!1,position:`top`},n=e.querySelector(`tx, c\\:tx`);if(n&&(t.text=this.parseRichText(n)),!t.text){let n=e.querySelector(`v, c\\:v`);n&&(t.text=n.textContent||``)}if(!t.text){let n=e.querySelector(`rich, c\\:rich`);n&&(t.text=this.parseRichTextBody(n))}if(!t.text){let n=e.querySelectorAll(`t, c\\:t, a\\:t`);n.length>0&&(t.text=Array.from(n).map(e=>e.textContent||``).join(` `).trim())}let r=e.querySelector(`txPr, c\\:txPr`);if(r){let e=this.parseTextProperties(r);if(e){let n={...t.formatting.font||{},...e.font||{}};t.formatting={...t.formatting,...e,font:n},t.formatting.font&&t.formatting.font.size&&!t.formatting.font.fontSize&&(t.formatting.font.fontSize=t.formatting.font.size,delete t.formatting.font.size)}}let i=this.extractFontFromElement(e);if(i){let{color:e,...n}=i;t.formatting.font={...t.formatting.font||{},...n},e&&(t.formatting.color=e)}let a=e.querySelector(`layout, c\\:layout`);if(a){let e=a.querySelector(`manualLayout, c\\:manualLayout`);e&&(t.position=this.parseManualLayout(e))}let o=e.querySelector(`overlay, c\\:overlay`);return o&&(t.overlay=o.getAttribute(`val`)===`1`),t}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing title:`,e),``}}parseLegend(e){try{let t={position:`right`,overlay:!1,visible:!0},n=e.querySelector(`legendPos, c\\:legendPos`);if(n){let e=n.getAttribute(`val`);e&&(t.position=e)}let r=e.querySelector(`overlay, c\\:overlay`);return r&&(t.overlay=r.getAttribute(`val`)===`1`),t}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing legend:`,e),{}}}parsePlotAreaProperties(e){try{let t={},n=e.querySelector(`layout, c\\:layout`);n&&(t.layout=this.parseLayout(n));let r=null;for(let t=0;t0&&(t.axes.value=this.parseAxis(i[0])),i.length>1){let e=i[1],n=e.querySelector(`c\\:axPos`)||e.querySelector(`axPos`),r=n?n.getAttribute(`val`):`l`;if(r===`r`||r===`t`)t.hasSecondaryAxis=!0,t.axes.valueSecondary=this.parseAxis(i[1]);else if(t.type===`scatter`){let e=i[0],n=e.querySelector(`c\\:axPos`)||e.querySelector(`axPos`),r=n?n.getAttribute(`val`):`l`;(r===`b`||r===`t`)&&(t.axes.category=this.parseAxis(i[0]),t.axes.value=this.parseAxis(i[1]))}else t.axes.valueSecondary=this.parseAxis(i[1])}let a=e.querySelector(`serAx, c\\:serAx`);a&&(t.axes.series=this.parseAxis(a))}catch(e){this.logger.log(`warn`,this.constructor.name,`Error parsing axes:`,e)}}parseSeriesFill(e){try{let t=e.querySelector(`spPr, c\\:spPr`);if(t){let e=this.parseShapeProperties(t);return e.noFill?`noFill`:e.fill}return null}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing series fill:`,e),null}}parseSeriesLine(e){try{let t=e.querySelector(`spPr, c\\:spPr`);return t?this.parseShapeProperties(t).line:null}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing series line:`,e),null}}parseSeriesMarker(e){try{let t=e.querySelector(`marker, c\\:marker`);return t?{symbol:this.parseMarkerSymbol(t),size:this.parseMarkerSize(t),fill:this.parseMarkerFill(t),line:this.parseMarkerLine(t)}:null}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing series marker:`,e),null}}parseDataLabels(e){try{let t={showValue:!1,showCategoryName:!1,showSeriesName:!1,showPercent:!1,showBubbleSize:!1,showLeaderLines:!1,position:`center`,separator:null,formatting:{font:null,color:null,number:null},delete:!1},n=e.querySelector(`showVal, c\\:showVal`);n&&(t.showValue=n.getAttribute(`val`)!==`0`);let r=e.querySelector(`showCatName, c\\:showCatName`);r&&(t.showCategoryName=r.getAttribute(`val`)!==`0`);let i=e.querySelector(`showSerName, c\\:showSerName`);i&&(t.showSeriesName=i.getAttribute(`val`)!==`0`);let a=e.querySelector(`showPercent, c\\:showPercent`);a&&(t.showPercent=a.getAttribute(`val`)!==`0`);let o=e.querySelector(`showBubbleSize, c\\:showBubbleSize`);o&&(t.showBubbleSize=o.getAttribute(`val`)!==`0`);let s=e.querySelector(`showLeaderLines, c\\:showLeaderLines`);s&&(t.showLeaderLines=s.getAttribute(`val`)!==`0`);let c=e.querySelector(`separator, c\\:separator`);c&&(t.separator=c.textContent||`, `);let l=e.querySelector(`dLblPos, c\\:dLblPos`);l&&(t.position=l.getAttribute(`val`)||`center`);let u=e.querySelector(`delete, c\\:delete`);u&&(t.delete=u.getAttribute(`val`)===`1`);let d=e.querySelector(`numFmt, c\\:numFmt`);d&&(t.formatting.number={formatCode:d.getAttribute(`formatCode`)||`#,##0`,sourceLinked:d.getAttribute(`sourceLinked`)===`1`});let f=e.querySelector(`txPr, c\\:txPr`);if(f){let e=f.querySelector(`defRPr, a\\:defRPr`);if(e){t.formatting.font||(t.formatting.font={}),this.parseRunProperties(e,t.formatting.font),t.formatting.font.fontFamily||(t.formatting.font.fontFamily=`Arial`),t.formatting.font.fontSize||(t.formatting.font.fontSize=9),(t.formatting.font.bold===null||t.formatting.font.bold===void 0)&&(t.formatting.font.bold=!0);let n=e.querySelector(`solidFill, a\\:solidFill`);n&&(t.formatting.color=this.parseColorElement(n))}}let p=e.querySelector(`spPr, c\\:spPr`);if(p&&(t.formatting.shape=this.parseShapeProperties(p)),t.formatting&&t.formatting.font){let e=t.formatting.font;e.size&&!e.fontSize&&(e.fontSize=e.size,delete e.size)}return t}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing data labels:`,e),null}}parsePrintSettings(e,t){try{let n=e.querySelector(`printSettings, c\\:printSettings`);n&&(t.printSettings={headerFooter:this.parsePrintHeaderFooter(n),pageMargins:this.parsePrintMargins(n),pageSetup:this.parsePrintPageSetup(n)})}catch(e){this.logger.log(`warn`,this.constructor.name,`Error parsing print settings:`,e)}}parseExternalData(e,t){try{let n=e.querySelector(`externalData, c\\:externalData`);n&&(t.externalData={id:n.getAttribute(`r:id`),autoUpdate:n.getAttribute(`autoUpdate`)===`1`})}catch(e){this.logger.log(`warn`,this.constructor.name,`Error parsing external data:`,e)}}parseLayout(e){return{}}parseShapeProperties(e){try{let t={fill:null,line:null};if(!e)return t;let n=!1;for(let r=0;r{t[e]!==null&&t[e]!==void 0&&(a[e]=t[e])}),Object.keys(a).length>0?a:null}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error extracting font from element:`,e),null}}parseAxis(e){try{let t={id:null,type:`category`,position:`bottom`,title:null,scaling:{min:null,max:null,logBase:null,orientation:`minMax`},tickMarks:{major:`outside`,minor:`none`},tickLabels:{position:`nextTo`,rotation:null,format:null},gridlines:{major:!0,minor:!1},visible:!0,crosses:`autoZero`},n=e.querySelector(`axId, c\\:axId`);n&&(t.id=n.getAttribute(`val`));let r=e.querySelector(`axPos, c\\:axPos`);r&&(t.position=r.getAttribute(`val`)||`bottom`);let i=e.querySelector(`title, c\\:title`);if(i){let e=this.parseTitle(i);typeof e==`string`?t.title={text:e,formatting:{font:{fontFamily:`Calibri`,fontSize:12,bold:!0},color:{r:68,g:68,b:68}}}:t.title=e}let a=e.querySelector(`txPr, c\\:txPr`);if(a){t.tickLabels.formatting=this.parseTextProperties(a);let e=a.querySelector(`bodyPr, a\\:bodyPr`);if(e){let n=e.getAttribute(`rot`);n&&(t.tickLabels.rotation=parseInt(n)/6e4)}}else{let n=this.extractFontFromElement(e);n&&(t.tickLabels.formatting={font:n,color:n.color||{r:68,g:68,b:68}})}let o=e.querySelector(`scaling, c\\:scaling`);o&&(t.scaling=this.parseAxisScaling(o));let s=e.querySelector(`majorTickMark, c\\:majorTickMark`);s&&(t.tickMarks.major=s.getAttribute(`val`)||`outside`);let c=e.querySelector(`minorTickMark, c\\:minorTickMark`);c&&(t.tickMarks.minor=c.getAttribute(`val`)||`none`);let l=e.querySelector(`tickLblPos, c\\:tickLblPos`);l&&(t.tickLabels.position=l.getAttribute(`val`)||`nextTo`);let u=e.querySelector(`majorGridlines, c\\:majorGridlines`);if(u){t.gridlines.major=!0;let e=u.querySelector(`prstDash, a\\:prstDash`);if(e){let n=e.getAttribute(`val`)||`solid`;t.gridlines.dash=n!==`solid`&&n!==`sysDot`?n:null}let n=u.querySelector(`srgbClr, a\\:srgbClr`);n&&(t.gridlines.color=`#`+(n.getAttribute(`val`)||`888888`))}e.querySelector(`minorGridlines, c\\:minorGridlines`)&&(t.gridlines.minor=!0);let d=e.querySelector(`numFmt, c\\:numFmt`);d&&(t.tickLabels.format={formatCode:d.getAttribute(`formatCode`),sourceLinked:d.getAttribute(`sourceLinked`)===`1`});let f=e.querySelector(`delete, c\\:delete`)||e.getElementsByTagName(`c:delete`)[0]||e.getElementsByTagName(`delete`)[0];if(f){let e=f.getAttribute(`val`);(e===`1`||e===`true`)&&(t.visible=!1)}let p=e.querySelector(`majorUnit, c\\:majorUnit`);p&&t.scaling.majorUnit===null&&(t.scaling.majorUnit=parseFloat(p.getAttribute(`val`)));let m=e.querySelector(`minorUnit, c\\:minorUnit`);m&&t.scaling.minorUnit===null&&(t.scaling.minorUnit=parseFloat(m.getAttribute(`val`)));let h=e.querySelector(`dispUnits, c\\:dispUnits`);if(h){let e=h.querySelector(`builtInUnit, c\\:builtInUnit`),n=h.querySelector(`custUnit, c\\:custUnit`),r={hundreds:100,thousands:1e3,tenOfThousands:1e4,hundredsOfThousands:1e5,millions:1e6,tenOfMillions:1e7,hundredsOfMillions:1e8,billions:1e9,trillions:0xe8d4a51000};e?t.scaling.displayUnit=r[e.getAttribute(`val`)]||1:n&&(t.scaling.displayUnit=parseFloat(n.getAttribute(`val`))||1)}let g=e.querySelector(`crosses, c\\:crosses`);g&&(t.crosses=g.getAttribute(`val`)||`autoZero`);let _=e.tagName.toLowerCase();return _.includes(`catax`)?t.type=`category`:_.includes(`valax`)?t.type=`value`:_.includes(`serax`)?t.type=`series`:_.includes(`dateax`)&&(t.type=`date`),t}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing axis:`,e),{id:null,type:`category`,position:`bottom`,visible:!0}}}parseMarkerSymbol(e){let t=e.querySelector(`symbol, c\\:symbol`);return t?t.getAttribute(`val`):`circle`}parseMarkerSize(e){let t=e.querySelector(`size, c\\:size`);return t?parseInt(t.getAttribute(`val`)):5}parseMarkerFill(e){try{let t=e.querySelector(`spPr, c\\:spPr`);if(t){if(t.querySelector(`noFill, a\\:noFill`))return`noFill`;let e=t.querySelector(`solidFill, a\\:solidFill`);if(e)return this.parseColorElement(e)}return null}catch{return null}}parseMarkerLine(e){try{let t=e.querySelector(`spPr, c\\:spPr`);if(t){let e=t.querySelector(`ln, a\\:ln`);if(e){let t=e.querySelector(`solidFill, a\\:solidFill`);return t?{color:this.parseColorElement(t),width:parseInt(e.getAttribute(`w`))||9525}:null}}return null}catch{return null}}parsePrintHeaderFooter(e){return{}}parsePrintMargins(e){return{}}parsePrintPageSetup(e){return{}}parseRichText(e){try{let t=e.querySelector(`strRef, c\\:strRef`);if(t){let e=t.querySelector(`strCache, c\\:strCache`);if(e){let t=e.querySelector(`pt, c\\:pt`);if(t){let e=t.querySelector(`v, c\\:v`);if(e)return e.textContent||``}}}let n=e.querySelector(`v, c\\:v`);if(n)return n.textContent||``;let r=e.querySelector(`rich, c\\:rich`);return r?this.parseRichTextBody(r):e.textContent||``}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing rich text:`,e),``}}parseRichTextBody(e){try{let t=``,n=e.querySelectorAll(`p, a\\:p`);for(let e of n){let n=e.querySelectorAll(`r, a\\:r`);for(let e of n){let n=e.querySelector(`t, a\\:t`);n&&(t+=n.textContent||``)}t+=` `}return t.trim()}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing rich text body:`,e),``}}parseTextProperties(e){try{let t={font:{fontFamily:`Calibri`,fontSize:11,bold:!1,italic:!1},color:{r:0,g:0,b:0},alignment:`left`},n=e.querySelector(`defRPr, a\\:defRPr`);n&&this.parseRunProperties(n,t.font);let r=e.querySelector(`latin, a\\:latin`);r&&(t.font.fontFamily=r.getAttribute(`typeface`)||`Calibri`);let i=e.getAttribute(`sz`);i&&(t.font.fontSize=this.convertPptxFontSize(i,`hundredths`));let a=e.querySelector(`b, a\\:b`)||e.hasAttribute(`b`);if(a){let n=a.getAttribute?a.getAttribute(`val`):e.getAttribute(`b`);t.font.bold=n!==`0`&&n!==`false`}let o=e.querySelector(`i, a\\:i`)||e.hasAttribute(`i`);if(o){let n=o.getAttribute?o.getAttribute(`val`):e.getAttribute(`i`);t.font.italic=n!==`0`&&n!==`false`}let s=e.querySelector(`solidFill, a\\:solidFill`);if(s){let e=this.parseColorElement(s);e&&(t.color=e)}let c=e.querySelector(`algn, a\\:algn`);return c&&(t.alignment=c.getAttribute(`val`)||`left`),t}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing text properties:`,e),{font:{fontFamily:`Calibri`,fontSize:11,bold:!1,italic:!1},color:{r:0,g:0,b:0},alignment:`left`}}}parseColorElement(e){try{let t=e.querySelector(`srgbClr, a\\:srgbClr`);if(t){let e=t.getAttribute(`val`);if(e&&e.length===6){let n={r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)},r=t.querySelector(`alpha, a\\:alpha`);return r&&(n.a=(parseInt(r.getAttribute(`val`))||1e5)/1e5),n}}let n=e.getAttribute(`val`);if(n&&n.length===6&&/^[0-9A-Fa-f]{6}$/.test(n))return{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16)};let r=e.querySelector(`schemeClr, a\\:schemeClr`);if(r){let e=r.getAttribute(`val`);return this.getSchemeColor(e)}return{r:0,g:0,b:0}}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing color:`,e),{r:0,g:0,b:0}}}getSchemeColor(e){return{dk1:{r:0,g:0,b:0},lt1:{r:255,g:255,b:255},dk2:{r:68,g:84,b:106},lt2:{r:231,g:230,b:230},accent1:{r:68,g:114,b:196},accent2:{r:237,g:125,b:49},accent3:{r:165,g:165,b:165},accent4:{r:255,g:192,b:0},accent5:{r:91,g:155,b:213},accent6:{r:112,g:173,b:71},bg1:{r:255,g:255,b:255},bg2:{r:231,g:230,b:230},tx1:{r:0,g:0,b:0},tx2:{r:68,g:84,b:106}}[e]||{r:128,g:128,b:128}}parseManualLayout(e){try{let t={layoutTarget:`inner`,xMode:`edge`,yMode:`edge`,x:0,y:0,w:1,h:1},n=e.querySelector(`layoutTarget, c\\:layoutTarget`);n&&(t.layoutTarget=n.getAttribute(`val`)||`inner`);let r=e.querySelector(`xMode, c\\:xMode`);r&&(t.xMode=r.getAttribute(`val`)||`edge`);let i=e.querySelector(`yMode, c\\:yMode`);i&&(t.yMode=i.getAttribute(`val`)||`edge`);let a=e.querySelector(`x, c\\:x`);a&&(t.x=parseFloat(a.getAttribute(`val`))||0);let o=e.querySelector(`y, c\\:y`);o&&(t.y=parseFloat(o.getAttribute(`val`))||0);let s=e.querySelector(`w, c\\:w`);s&&(t.w=parseFloat(s.getAttribute(`val`))||1);let c=e.querySelector(`h, c\\:h`);return c&&(t.h=parseFloat(c.getAttribute(`val`))||1),t}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing manual layout:`,e),{layoutTarget:`inner`,xMode:`edge`,yMode:`edge`,x:0,y:0,w:1,h:1}}}parseAxisScaling(e){try{let t={min:null,max:null,majorUnit:null,minorUnit:null,logBase:null,orientation:`minMax`},n=e.querySelector(`min, c\\:min`);n&&(t.min=parseFloat(n.getAttribute(`val`)));let r=e.querySelector(`max, c\\:max`);r&&(t.max=parseFloat(r.getAttribute(`val`)));let i=e.querySelector(`majorUnit, c\\:majorUnit`);i&&(t.majorUnit=parseFloat(i.getAttribute(`val`)));let a=e.querySelector(`minorUnit, c\\:minorUnit`);a&&(t.minorUnit=parseFloat(a.getAttribute(`val`)));let o=e.querySelector(`logBase, c\\:logBase`);o&&(t.logBase=parseFloat(o.getAttribute(`val`)));let s=e.querySelector(`orientation, c\\:orientation`);return s&&(t.orientation=s.getAttribute(`val`)||`minMax`),t}catch(e){return this.logger.log(`warn`,this.constructor.name,`Error parsing axis scaling:`,e),{min:null,max:null,majorUnit:null,minorUnit:null,logBase:null,orientation:`minMax`}}}_validateConfig(e){return{enablePerformanceMonitoring:!!e.enablePerformanceMonitoring,enableValidation:!!e.enableValidation,maxChartComplexity:Math.max(1e3,Math.min(5e4,e.maxChartComplexity||1e4)),processingTimeout:Math.max(5e3,Math.min(12e4,e.processingTimeout||8e4)),enableCaching:!!e.enableCaching,...e}}_createErrorBoundary(){return typeof window<`u`&&window.ErrorBoundary?new window.ErrorBoundary({context:`ChartProcessor`,enableLogging:!0,errorHandler:e=>{this.logger.logError(this.constructor.name,`ChartProcessor`,`Error boundary caught:`,e)}}):{wrap:e=>e}}getMetrics(){return{...this.metrics}}resetMetrics(){this.metrics={chartsProcessed:0,averageProcessingTime:0,cacheHitRate:0,errorRate:0}}async loadChartFromRelationship(e,t=null){try{t&&`${t.slideIndex+1}${t.slideName}`;let n=null,r=null;if(window.PPTXSlideRenderer&&window.PPTXSlideRenderer.currentZip&&(n=window.PPTXSlideRenderer.currentZip),!n&&window.currentProcessor){let e=window.currentProcessor;e.processor&&e.processor.zipProcessor&&e.processor.zipProcessor.zip?(n=e.processor.zipProcessor.zip,r=e.processor.zipProcessor.package):e.processor&&e.processor.zip&&(n=e.processor.zip)}if(!n&&window.currentZipData&&(n=window.currentZipData),!n&&this.context&&this.context.zip&&(n=this.context.zip,this.context.package&&(r=this.context.package)),!n)return null;let i=null;if(r&&r.relationships&&(i=await this.resolveChartPathFromRelationships(r,e,t)),i||(i=await this.resolveChartFromSlideRelationships(n,e,t)),!i){let r=e.replace(`rId`,``)||`1`,a=parseInt(r),o=[];if(t&&t.slideIndex!==void 0){let n=t.slideIndex,i={"0_rId1":`chart1.xml`,"1_rId1":`chart2.xml`,"1_rId2":`chart3.xml`,"1_rId3":`chart4.xml`,"1_rId4":`chart5.xml`}[`${n}_${e}`];if(i)o.push(`ppt/charts/${i}`);else if(n===0)o.push(`ppt/charts/chart${r}.xml`);else{let e=a+n;o.push(`ppt/charts/chart${e}.xml`),o.push(`ppt/charts/chart${r}.xml`)}}else o.push(`ppt/charts/chart${r}.xml`);if(o.length===1)for(let e=1;e<=5;e++)e!==a&&o.push(`ppt/charts/chart${e}.xml`);let s=o;if(n.getPaths&&typeof n.getPaths==`function`){let e=n.getPaths().filter(e=>e.startsWith(`ppt/charts/`)&&e.endsWith(`.xml`));s.push(...e)}for(let e of s)if(await this.loadChartXmlFile(n,e)){i=e;break}}let a=null;return i&&(a=await this.loadChartXmlFile(n,i)),a?this.parseChartXmlData(a):null}catch{return null}}async resolveChartFromSlideRelationships(e,t,n=null){try{let r=[];if(n&&n.slideIndex!==void 0)r=[`ppt/slides/_rels/slide${n.slideIndex+1}.xml.rels`];else{if(e.getPaths&&typeof e.getPaths==`function`)try{r=e.getPaths().filter(e=>e.includes(`slides/_rels/`)&&e.endsWith(`.xml.rels`))}catch{}if(r.length===0&&e.files)try{r=Object.keys(e.files).filter(e=>e.includes(`slides/_rels/`)&&e.endsWith(`.xml.rels`))}catch{}r.length===0&&(r=[`ppt/slides/_rels/slide1.xml.rels`,`ppt/slides/_rels/slide2.xml.rels`,`ppt/slides/_rels/slide3.xml.rels`,`ppt/slides/_rels/slide4.xml.rels`,`ppt/slides/_rels/slide5.xml.rels`])}for(let n of r)try{let r=null;if(e.getFileText&&typeof e.getFileText==`function`)try{r=await e.getFileText(n)}catch{}if(!r&&e.file&&typeof e.file==`function`){let t=e.file(n);if(t&&t.async)try{r=await t.async(`string`)}catch{}}if(!r&&e.files&&e.files[n]){let t=e.files[n];if(t&&t.async)try{r=await t.async(`string`)}catch{}}if(!r&&e.getFileAsString)try{r=await e.getFileAsString(n)}catch{}if(r){let e=new DOMParser().parseFromString(r,`text/xml`).querySelectorAll(`Relationship`);for(let n of e){let e=n.getAttribute(`Id`),r=n.getAttribute(`Type`),i=n.getAttribute(`Target`);if(e===t&&r&&r.includes(`chart`)){let e=i;return e.startsWith(`../charts/`)?e=`ppt/charts/`+e.substring(10):e.startsWith(`/ppt/charts/`)?e=e.substring(1):e.startsWith(`ppt/charts/`)||(e=`ppt/charts/`+e),e}}}}catch{}return null}catch{return null}}async resolveChartPathFromRelationships(e,t,n=null){try{let r=Object.entries(e.relationships),i=null;n&&n.slideIndex!==void 0&&(i=`/ppt/slides/slide${n.slideIndex+1}.xml`);for(let[e,a]of r)if(!(i&&!e.endsWith(`slide${n.slideIndex+1}.xml`))&&a&&a[t]){let n=a[t];if(n.Type&&n.Type.includes(`chart`)){let t=n.Target;return t.startsWith(`../`)?t=t.substring(3):t.startsWith(`./`)?t=t.substring(2):t.startsWith(`/`)?t=t.substring(1):(t=e.substring(0,e.lastIndexOf(`/`))+`/`+t,t.startsWith(`/`)&&(t=t.substring(1))),t}}return null}catch{return null}}async loadChartXmlFile(e,t){try{if(!e)return null;if(e.getPaths&&typeof e.getPaths==`function`&&e.getPaths().filter(e=>e.includes(`chart`)),e.getFileText&&typeof e.getFileText==`function`)return await e.getFileText(t)||null;if(e.file&&typeof e.file==`function`){let n=e.file(t);return n?await n.async(`text`):null}else return null}catch{return null}}parseChartXmlData(e){try{let n=new DOMParser().parseFromString(e,`text/xml`);if(n.getElementsByTagName(`parsererror`).length>0)return null;let r=n.querySelector(`c\\:chartSpace, chartSpace`);if(!r&&!(n.querySelector(`chartSpace`)||n.getElementsByTagName(`chartSpace`)[0]||n.querySelector(`[*|localName="chartSpace"]`)))return null;let i=new t;return this.parseChartSpace(r,i),i}catch{return null}}getShapeName(e){let t=e.querySelector(`cNvPr`)||e.querySelector(`p\\:cNvPr`)||e.querySelector(`[*|localName="cNvPr"]`);return t&&t.getAttribute(`name`)||``}_createFallbackLogger(){return{debug:()=>{},info:()=>{},warn:(...e)=>console.warn(`[ChartProcessor]`,...e),error:(...e)=>console.error(`[ChartProcessor]`,...e)}}cleanup(){this.chartCache&&this.chartCache.clear(),this.seriesCache&&this.seriesCache.clear(),this.resetMetrics()}}e.exports&&(e.exports={ChartProcessor:r,ChartData:t,ChartSeries:n,createChartProcessor:(e,t={})=>new r(e,t)}),typeof window<`u`&&(window.ChartData=t,window.ChartSeries=n,window.ChartProcessor=r,window.createChartProcessor=(e,t={})=>new r(e,t))})(su),su.exports)}lu();var uu={exports:{}};uu.exports;var du;function fu(){return du?uu.exports:(du=1,(function(e){class t{constructor(e,t={}){this.graphics=e,this.options=t;try{this.logger=new Logger(`ChartRenderer`)}catch(e){console.warn(`[ChartRenderer] Logger initialization failed, using fallback:`,e),this.logger=this._createFallbackLogger()}this.initializeFontSystem(t.fontConfig),this.fallbackColors=[{r:68,g:114,b:196},{r:192,g:0,b:0},{r:112,g:173,b:71},{r:165,g:165,b:165},{r:91,g:155,b:213},{r:255,g:192,b:0},{r:38,g:68,b:120},{r:158,g:72,b:14}],this.themeColors=null,this.themeProcessor=t.themeProcessor||null,this.defaultFont={fontFamily:`Arial`,fontSize:12,bold:!1,italic:!1,color:{r:0,g:0,b:0}}}initializeFontSystem(e={}){this.fontConfig=null}async renderWithChartJS(e,t,n,r,i){try{let a=new ChartJSRenderer,o=this.getCanvasContext();if(!o)throw Error(`Canvas context not available`);let s=this.graphics&&this.graphics.coordinateSystem&&typeof this.graphics.coordinateSystem.scale==`number`?this.graphics.coordinateSystem.scale:1,c=typeof window<`u`&&window.devicePixelRatio?window.devicePixelRatio:1;e._scalingInfo=Object.assign({},e._scalingInfo||{},{displayScale:s,devicePixelRatio:c});let l={x:t,y:n,width:r,height:i};e.series&&e.series.forEach((e,t)=>{if(e.color)typeof e.color==`object`&&e.color.r!==void 0&&(e.color=`rgb(${e.color.r}, ${e.color.g}, ${e.color.b})`);else{let n=this.fallbackColors[t%this.fallbackColors.length];e.color=`rgb(${n.r}, ${n.g}, ${n.b})`}}),await a.renderChart(o,e,l)}catch(e){throw this.logger.logError(this.constructor.name,`Chart.js rendering failed - no fallback available:`,e),console.error(`[ChartRenderer] Chart.js rendering failed:`,e),Error(`Chart.js rendering failed: ${e.message}`)}}renderChartNative(e,t,n,r,i){let a=this.calculateLayout(e,t,n,r,i);if(!a||!a.chartArea)throw Error(`Failed to calculate chart layout`);this.renderChartContent(e,a)}getElementFont(e,t={},n={},r={}){try{if(this.fontConfig&&typeof this.fontConfig.getFont==`function`)return this.fontConfig.getFont(e,t,n,r)}catch(e){console.warn(`[ChartRenderer] Font system error, falling back to legacy fonts:`,e),this.logger.log(`warn`,this.constructor.name,`Font configuration error:`,e.message)}return this.getLegacyFont(e,t,n)}getLegacyFont(e,t={},n={}){let r={...this.defaultFont};switch(e){case`title`:r.fontSize=18,r.bold=!1;break;case`subtitle`:r.fontSize=14,r.color={r:100,g:100,b:100};break;case`axisTitle`:r.fontSize=12,r.bold=!0,r.color={r:68,g:68,b:68};break;case`axisLabels`:r.fontSize=11,r.color={r:68,g:68,b:68};break;case`legend`:r.fontSize=11,r.color={r:60,g:60,b:60};break;case`dataLabels`:r.fontSize=9,r.bold=!0,r.color={r:50,g:50,b:50};break}return t&&(t.fontFamily&&(r.fontFamily=t.fontFamily),t.fontSize!==void 0&&(r.fontSize=t.fontSize),t.bold!==void 0&&(r.bold=t.bold),t.italic!==void 0&&(r.italic=t.italic),t.color&&(r.color=t.color)),n&&(n.fontFamily&&(r.fontFamily=n.fontFamily),n.fontSize!==void 0&&(r.fontSize=n.fontSize),n.bold!==void 0&&(r.bold=n.bold),n.italic!==void 0&&(r.italic=n.italic),n.color&&(r.color=n.color)),r}async renderChart(e,t,n,r,i){if(!e){this.logger.log(`warn`,this.constructor.name,`No chart data provided`),this.renderPlaceholder(t,n,r,i);return}if(!e.series||e.series.length===0){this.logger.log(`warn`,this.constructor.name,`Chart data has no series`),this.renderPlaceholder(t,n,r,i);return}if(!this.validateGraphicsContext()){this.renderPlaceholder(t,n,r,i);return}try{let a=this.calculateLayout(e,t,n,r,i);if(!a||!a.chartArea)throw Error(`Failed to calculate chart layout`);if((e.type||`bar`).toLowerCase(),typeof window>`u`)throw Error(`[ChartRenderer] Window object not available - cannot render charts`);if(!window.Chart)throw Error(`[ChartRenderer] Chart.js library not loaded - ensure Chart.js CDN is available`);if(!ChartJSRenderer)throw Error(`[ChartRenderer] ChartJSRenderer not available - ensure chartjs-renderer.js is loaded`);return await this.renderWithChartJS(e,t,n,r,i)}catch(e){this.logger.logError(this.constructor.name,`Error rendering chart: ${e.message}`),this.renderPlaceholder(t,n,r,i)}}calculateLayout(e,t,n,r,i){let a={total:{x:t,y:n,width:r,height:i},title:null,legend:null,chartArea:null},o=i,s=r,c=n,l=t,u=typeof e.title==`string`?e.title:e.title&&e.title.text?e.title.text:``;if(u&&u.trim()){let t=u.includes(`Chart1`)||u.includes(`Sales Trend`)||u.includes(`Test Layout`)?35:30,n=typeof e.subtitle==`string`?e.subtitle:e.subtitle&&e.subtitle.text?e.subtitle.text:``;n&&n.trim()&&(t+=20),a.title={x:l,y:c,width:s,height:t},c+=t,o-=t}if(e.legend&&e.legend.visible!==!1&&(e.series.length>1||e.legend.visible===!0)){let t=e.legend.position||`b`;if(e.legend.manualLayout){let t=e.legend.manualLayout;a.legend={x:l+t.x*s,y:c+t.y*o,width:t.w*s,height:t.h*o}}else t===`b`||t===`bottom`?(a.legend={x:l+10,y:c+o-45,width:s-20,height:45},o-=50):t===`t`||t===`top`?(a.legend={x:l+10,y:c,width:s-20,height:45},c+=50,o-=50):(a.legend={x:l+s-120,y:c+10,width:120,height:o-20},s-=125)}let d=u&&(u.includes(`Sales Trend`)||u.includes(`Chart1`)||u.includes(`Test Layout`)||u.includes(`Performance Analysis`)),f=d?80:10,p=d?20:10,m=d?20:10,h=d?70:10;if(e.styling?.plotArea?.margins){let t=e.styling.plotArea.margins;f=t.left||f,p=t.right||p,m=t.top||m,h=t.bottom||h}let g=s-f-p,_=o-m-h;if(e.styling?.chartArea?.proportions){let t=e.styling.chartArea.proportions;t.width&&t.width>0&&t.width<=1&&(g=Math.min(g,s*t.width-f-p)),t.height&&t.height>0&&t.height<=1&&(_=Math.min(_,o*t.height-m-h))}return a.chartArea={x:l+f,y:c+m,width:Math.max(200,g),height:Math.max(150,_)},a}renderBarChart(e,t){let{chartArea:n}=t,r=e.series,i=e.categories;if(!i||i.length===0||!r||r.length===0){this.logger.log(`warn`,this.constructor.name,`Bar chart: No data to render`);return}let a=this.getMaxValue(r),o=Math.min(0,this.getMinValue(r)),s=Math.ceil(a*1.2),c=this.calculateOptimalSteps(s,s),l=this.getPlotArea(n),u=s-o,d=n.x+60,f=n.y+10,p=n.width-60-20,m=n.height-50-10;f+m,l.height/u,l.y+l.height;let h=p/i.length,g=h/(r.length+.5),_=g*.1;this.drawAxes(n,i,a,e.axes,r);for(let t=0;te.values&&e.values.length>0)){this.logger.log(`warn`,this.constructor.name,`Line chart: No data values found in series`);return}let a=this.getMaxValue(r),o=this.getMinValue(r),s=a-o||1,c=n.height*.8/s,l=Math.max(...r.map(e=>e.values?e.values.length:0)),u=i&&i.length>0?i:Array.from({length:l},(e,t)=>`Point ${t+1}`),d=n.width/Math.max(u.length,1),f=n.y+n.height-40;this.drawAxes(n,u,a,null,r);for(let t=0;t0)for(let e=0;ee>0),a=e.categories||r.categories||[],o=i.reduce((e,t)=>e+t,0);if(o===0||i.length===0){this.logger.log(`warn`,this.constructor.name,`Pie chart: No valid data values`);return}let s=n.x+n.width*.4,c=n.y+n.height/2,l=Math.min(n.width*.6,n.height)*.35,u=-Math.PI/2;for(let e=0;e5){let e=u+r/2,t=l*.7,i=s+Math.cos(e)*t,a=c+Math.sin(e)*t,o={...this.defaultFont,fontSize:10,color:{r:255,g:255,b:255},bold:!0};this.graphics.fillText(`${n.toFixed(1)}%`,i,a,o)}u=a}this.drawPieLegend(n,i,a,s+l+20,c-i.length*15/2)}renderDoughnutChart(e,t){let{chartArea:n}=t;if(!e.series||e.series.length===0)return;let r=e.series[0].values,i=r.reduce((e,t)=>e+t,0);if(i===0)return;let a=n.x+n.width/2,o=n.y+n.height/2,s=Math.min(n.width,n.height)*.35,c=s*.5,l=-Math.PI/2;for(let e=0;e1&&this.drawStraightLine(m,p,2)}}renderOverlappingAreaSeries(e,t,n,r,i,a){let o=t.x+30;for(let t=e.length-1;t>=0;t--){let s=e[t],c=this.getSeriesColor(t),l=[];l.push({x:o,y:i});for(let t=0;t1&&this.drawStraightLine(p,f,3);for(let e of p)this.graphics.fillCircle(e.x,e.y,4,c),this.graphics.strokeCircle(e.x,e.y,4,{r:255,g:255,b:255},2)}}renderScatterChart(e,t){let{chartArea:n}=t,r=e.series;if(!r||r.length===0)return;let i=Math.max(...r.flatMap(e=>e.categories.map(e=>parseFloat(e)||0))),a=this.getMaxValue(r),o=n.width*.9/i,s=n.height*.8/a;this.drawNumericalAxes(n,i,a);for(let e=0;ee.categories.map(e=>parseFloat(e)||0))),a=this.getMaxValue(r),o=Math.max(...r.flatMap(e=>e.bubbleSizes||[10])),s=n.width*.9/i,c=n.height*.8/a,l=20/o;this.drawNumericalAxes(n,i,a);for(let e=0;e0?n[e%n.length]:this.fallbackColors[e%this.fallbackColors.length]}extractThemeColors(e=null){if(this.themeColors)return this.themeColors;if(this.themeProcessor&&e)try{let t=[];for(let n=1;n<=6;n++){let r=this.themeProcessor.resolveColor(`accent${n}`,e);r&&t.push(r)}if(t.length>0)return this.themeColors=t,t}catch(e){console.warn(`[ChartRenderer] Failed to extract theme colors:`,e)}return null}convertColorValue(e){if(!e)return{r:0,g:0,b:0};if(typeof e==`object`&&`r`in e&&`g`in e&&`b`in e)return{r:Math.round(Math.min(255,Math.max(0,e.r))),g:Math.round(Math.min(255,Math.max(0,e.g))),b:Math.round(Math.min(255,Math.max(0,e.b)))};if(typeof e==`string`){let t=e.replace(`#`,``);if(t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),t.length===6)return{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16)}}return Array.isArray(e)&&e.length>=3?{r:Math.round(Math.min(255,Math.max(0,e[0]))),g:Math.round(Math.min(255,Math.max(0,e[1]))),b:Math.round(Math.min(255,Math.max(0,e[2])))}:(console.warn(`[ChartRenderer] Unable to convert color:`,e),{r:0,g:0,b:0})}drawAxes(e,t,n,r=null,i=null){let{x:a,y:o,width:s,height:c}=e,l=a+60,u=o+10,d=s-60-20,f=c-50-10;if(!this.graphics||!this.graphics._context)return;this.drawCategoryAxis(l,u+f,d,t,r?.category),this.drawValueAxis(l,u,f,n,r?.value);let p={r:230,g:230,b:230};if((!r||r.category?.gridlines?.major!==!1)&&this.drawCategoryGridlines(l,u,d,f,t.length,p),!r||r.value?.gridlines?.major!==!1){let e=Math.min(0,this.getMinValue(i||[])),t,a;n>=2e3&&n<=3500?(t=Math.ceil(n/500)*500,a=t/500):(t=r?.value?.scaling?.max||Math.ceil(n*1.2),a=this.calculateOptimalSteps(t,n)),this.drawValueGridlines(l,u,d,f,a,p,e,t)}}drawCategoryAxis(e,t,n,r,i=null){if(!r||r.length===0||!this.graphics||!this.graphics._context)return;let a={r:68,g:68,b:68},o={};if(i&&i.tickLabels&&i.tickLabels.formatting){let e=i.tickLabels.formatting;e.font&&(o={fontFamily:e.font.fontFamily||e.font.family,fontSize:e.font.fontSize||e.font.size,bold:e.font.bold,italic:e.font.italic,color:e.color||a})}let s={chartWidth:n*2,chartHeight:300},c=this.getElementFont(`axisLabels`,o,{},s);try{this.graphics.drawLine(e,t,e+n,t,a,2)}catch{if(this.graphics._context){let r=this.graphics._context;r.save(),r.strokeStyle=`rgb(${a.r}, ${a.g}, ${a.b})`,r.lineWidth=2,r.beginPath(),r.moveTo(e,t),r.lineTo(e+n,t),r.stroke(),r.restore()}}let l=n/Math.max(r.length,1);try{for(let n=0;n=2e3&&r<=3500)u=3e3;else if(r>3e3&&r<8e3)u=7e3;else{let e=10**Math.floor(Math.log10(r)),t;t=r<=e*2?2:r<=e*2.5?2.5:r<=e*5?5:10,u=t*e}let d=u-l,f=this.calculateOptimalSteps(d,u),p=d/f;try{for(let r=0;r<=f;r++){let o=l+r*p,s=(o-l)/d,u=t+n-s*n,f=this.formatValueLabel(o,i?.tickLabels?.format);if(!i||i.tickMarks?.major!==`none`){let t=i?.tickMarks?.major===`inside`?8:-8;this.graphics.drawLine(e,u,e+t,u,a,1)}if(!i||i.tickLabels?.position!==`none`){let t=e-12;this.renderEnhancedText(f,t,u,c,`right`)}}if(i?.title){let r=``,a={};if(typeof i.title==`string`?r=i.title:typeof i.title==`object`&&i.title.text&&(r=i.title.text,i.title.formatting&&i.title.formatting.font&&(a={fontFamily:i.title.formatting.font.fontFamily||i.title.formatting.font.family,fontSize:i.title.formatting.font.fontSize||i.title.formatting.font.size,bold:i.title.formatting.font.bold,italic:i.title.formatting.font.italic,color:i.title.formatting.color})),r){let r=this.getElementFont(`axisTitle`,a,{},s),o=e-45,c=t+n/2;try{let e=this.graphics._context;e&&e.save&&e.rotate?(e.save(),e.translate(o,c),e.rotate(-Math.PI/2),e.fillStyle=`rgb(${r.color.r}, ${r.color.g}, ${r.color.b})`,e.font=`${r.bold?`bold `:``}${r.fontSize}px ${r.fontFamily}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(i.title,0,0),e.restore()):this.renderEnhancedText(i.title,o,c,r,`center`)}catch{this.renderEnhancedText(i.title,o,c,r,`center`)}}}}catch{this.renderBasicAxisLabels(e,t,n,[l,u],`value`)}}drawCategoryGridlines(e,t,n,r,i,a){let o=n/Math.max(i,1);for(let n=0;n=2e3&&t<=3500)return Math.ceil(t/500)*500/500;if(t&&t>3e3&&t<8e3)return 7;let n=e/10**Math.floor(Math.log10(e));return n<=1.5||n<=2.5?5:n<=4||n<=6?6:n<=10?7:8}getPlotArea(e){return{x:e.x+60,y:e.y+10,width:e.width-60-20,height:e.height-50-10}}formatCategoryLabel(e){if(e==null)return``;let t=String(e);if(t.includes(`Point`)){let e=t.match(/Point\s+(\d+)/);if(e)return[`Q1 2023`,`Q2 2023`,`Q3 2023`,`Q4 2023`,`Q1 2024`][parseInt(e[1])-1]||t}return t.match(/^Q[1-4]\s+\d{4}$/)?t:t.match(/\d{4}-\d{2}/)||t.match(/\d{1,2}\/\d{4}/)?this.convertToQuarterlyLabel(t):t}formatValueLabel(e,t=null){if(e==null||isNaN(e))return`0`;if(t?.formatCode)try{if(t.formatCode.includes(`%`))return(e*100).toFixed(1)+`%`;if(t.formatCode.includes(`$`))return`$`+e.toFixed(2);if(t.formatCode.includes(`#,##0`))return this.formatCleanValue(e)}catch{}return this.formatCleanValue(e)}formatCleanValue(e){if(e==null||isNaN(e))return`0`;let t=Math.round(e);return new Intl.NumberFormat(`en-US`,{maximumFractionDigits:0,useGrouping:!0}).format(t)}convertToQuarterlyLabel(e){try{let t=e.match(/(\d{4})-(\d{2})/);if(t){let e=t[1],n=parseInt(t[2]);return`Q${Math.ceil(n/3)} ${e}`}let n=e.match(/(\d{1,2})\/(\d{4})/);if(n){let e=parseInt(n[1]),t=n[2];return`Q${Math.ceil(e/3)} ${t}`}return e}catch{return e}}drawPieSlice(e,t,n,r,i,a){try{let o=this.graphics._context;if(!o){this.logger.log(`warn`,this.constructor.name,`Canvas context not available for pie slice`);return}o.save(),o.beginPath(),o.moveTo(e,t),o.arc(e,t,n,r,i),o.closePath(),o.fillStyle=`rgba(${a.r}, ${a.g}, ${a.b}, ${a.a||1})`,o.fill(),o.strokeStyle=`rgba(255, 255, 255, 0.8)`,o.lineWidth=1,o.stroke(),o.restore()}catch(r){this.logger.logError(this.constructor.name,`Error drawing pie slice:`,r),this.graphics.fillCircle(e,t,n*.3,a)}}drawDoughnutSlice(e,t,n,r,i,a,o){try{let s=this.graphics._context;if(!s){this.logger.log(`warn`,this.constructor.name,`Canvas context not available for doughnut slice`);return}s.save(),s.beginPath(),s.arc(e,t,r,i,a,!1),s.arc(e,t,n,a,i,!0),s.closePath(),s.fillStyle=`rgba(${o.r}, ${o.g}, ${o.b}, ${o.a||1})`,s.fill(),s.strokeStyle=`rgba(255, 255, 255, 0.8)`,s.lineWidth=1,s.stroke(),s.restore()}catch(i){this.logger.logError(this.constructor.name,`Error drawing doughnut slice:`,i),this.graphics.fillCircle(e,t,r,o),this.graphics.fillCircle(e,t,n,{r:255,g:255,b:255})}}drawPolygon(e,t,n){if(!(!e||e.length<3))try{let r=this.graphics._context;if(!r){this.logger.log(`warn`,this.constructor.name,`Canvas context not available for polygon`);return}r.save(),r.beginPath(),r.moveTo(e[0].x,e[0].y);for(let t=1;te.toString()),n)}drawRadarGrid(e,t,n,r){let i={r:230,g:230,b:230};for(let r=1;r<=5;r++){let a=n*r/5;this.graphics.strokeCircle(e,t,a,i,1)}for(let a=0;a1||e.legend&&e.legend.visible===!0)){let{legend:n}=t,r=e.legend?.position||`right`;if(r===`b`||r===`bottom`||r===`t`||r===`top`){let r=Math.min(150,n.width/e.series.length),i=n.x+(n.width-r*e.series.length)/2,a=n.y+n.height/2;for(let n=0;n1}catch{return!1}}renderTextWithFallback(e,t,n,r){try{this.graphics.fillText(e,t,n,r)}catch{try{let i=this.graphics._context;if(i){i.save();let a=r.fontFamily||`Arial, sans-serif`,o=r.fontSize||12,s=r.bold?`bold`:`normal`;i.font=`${r.italic?`italic`:`normal`} ${s} ${o}px ${a}`,i.fillStyle=`rgb(${r.color.r||0}, ${r.color.g||0}, ${r.color.b||0})`,i.textAlign=`center`,i.textBaseline=`middle`,i.fillText(e,t,n),i.restore()}else throw Error(`No canvas context available`)}catch{try{let i={fontFamily:`Arial`,fontSize:10,color:r.color||{r:0,g:0,b:0}};this.graphics.fillText(e,t,n,i)}catch{}}}}renderEnhancedText(e,t,n,r,i=`center`){try{let a=this.graphics._context;if(a){a.save();let o=r.fontFamily||`Arial, sans-serif`,s=r.fontSize||12,c=r.bold?`bold`:`normal`;a.font=`${r.italic?`italic`:`normal`} ${c} ${s}px ${o}`,a.fillStyle=`rgb(${r.color.r||0}, ${r.color.g||0}, ${r.color.b||0})`,a.textAlign=i,a.textBaseline=`middle`,a.shadowColor=`rgba(255, 255, 255, 0.8)`,a.shadowBlur=1,a.shadowOffsetX=.5,a.shadowOffsetY=.5,a.fillText(e,t,n),a.restore()}else this.graphics.fillText(e,t,n,r)}catch{try{this.graphics.fillText(e,t,n,r)}catch{}}}renderBasicAxisLabels(e,t,n,r,i){try{let a={fontFamily:`Arial`,fontSize:9,color:{r:68,g:68,b:68}};if(i===`category`){let i=n/Math.max(r.length,1),o=i/2;for(let n=0;n{},info:()=>{},warn:(...e)=>console.warn(`[ChartRenderer]`,...e),error:(...e)=>console.error(`[ChartRenderer]`,...e)}}validateGraphicsContext(){if(!this.graphics)return console.error(`[ChartRenderer] No graphics object available`),!1;let e=null;if(this.graphics._context?e=this.graphics._context:this.graphics.context?e=this.graphics.context:this.graphics.m_oContext&&(e=this.graphics.m_oContext),!e)return console.error(`[ChartRenderer] No canvas context found in graphics object`),!1;try{return e.save(),e.restore(),!0}catch(e){return console.error(`[ChartRenderer] Canvas context is not functional:`,e),!1}}getCanvasContext(){return this.graphics&&(this.graphics._context||this.graphics.context||this.graphics.m_oContext)||null}}typeof window<`u`&&(window.ChartRenderer=t,window.createChartRenderer=(e,n={})=>new t(e,n)),typeof globalThis<`u`&&(globalThis.ChartRenderer=t),e.exports&&(e.exports={ChartRenderer:t,createChartRenderer:(e,n={})=>new t(e,n)})})(uu),uu.exports)}fu();function pu(e){throw Error(`Could not dynamically require "`+e+`". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.`)}var mu={exports:{}};mu.exports;var hu;function gu(){return hu?mu.exports:(hu=1,(function(e){class t{constructor(){this.Chart=null,this.initialized=!1}async initialize(){if(!this.initialized){if(typeof window<`u`&&window.Chart){this.Chart=window.Chart,this.initialized=!0;return}if(pu!==void 0)try{let e=Wl();this.Chart=e.default||e,this.initialized=!0}catch(e){throw console.error(`Failed to load Chart.js:`,e),Error(`Chart.js is required but not available`)}}}async renderChart(e,t,n){if(await this.initialize(),!this.Chart)throw Error(`Chart.js not initialized`);let r={x:n.x,y:n.y,width:Math.round(n.width*1),height:Math.round(n.height*1)},i=this.convertToChartJSConfig(t,r),a=i.type,o=t.hasDataTable&&t.series&&t.series.length>0?t.series:null,s=o?(o.length+1)*18:0;s>0&&i.options&&i.options.layout&&i.options.layout.padding&&(i.options.layout.padding.bottom=(i.options.layout.padding.bottom||0)+s);let c=document.createElement(`canvas`),l=t&&t._scalingInfo&&typeof t._scalingInfo.displayScale==`number`?t._scalingInfo.displayScale:1,u=l>0?1/l:1,d=Math.max(1,Math.round((r.width+0+0)*u)),f=Math.max(1,Math.round((r.height+0+0+0+0)*u));c.width=d,c.height=f,c.style.width=d+`px`,c.style.height=f+`px`;let p=c.getContext(`2d`);p.clearRect(0,0,c.width,c.height);let m=t&&t.chartSpaceShapeProperties&&t.chartSpaceShapeProperties.fill;if(m){let e=this.convertColorToHex(m),n=m&&typeof m.a==`number`?m.a:1,r=t.roundedCorners,a=c.width,o=c.height,s=n<1?this.hexToRgba(e,n):e;if(e){let e={id:`chartSpaceBackground`,beforeDraw(e){let{ctx:t}=e;if(t.save(),t.fillStyle=s,r){let e=Math.min(a,o)*.04;t.beginPath(),t.moveTo(e,0),t.lineTo(a-e,0),t.arcTo(a,0,a,e,e),t.lineTo(a,o-e),t.arcTo(a,o,a-e,o,e),t.lineTo(e,o),t.arcTo(0,o,0,o-e,e),t.lineTo(0,e),t.arcTo(0,0,e,0,e),t.closePath(),t.fill()}else t.fillRect(0,0,a,o);t.restore()}};i.plugins?i.plugins.unshift(e):i.plugins=[e]}}if(t&&t.series&&t.series.some(e=>e.outerShadow)){let e={id:`seriesShadow`,beforeDatasetsDraw(e){let{ctx:t}=e,n=1/9525;for(let r=0;r0&&t.arc(n+l,r+u,i,s,o,!0),t.closePath(),t.fill()}t.restore()}}};i.plugins?i.plugins.push(e):i.plugins=[e]}if(a===`radar`){let e={id:`radarOverlay`,afterDatasetsDraw(e){let t=e.scales.r;if(!t)return;let{ctx:n}=e,r=t.options.grid?.color||`rgba(136, 136, 136, 0.8)`,i=t.options.angleLines?.color||r,a=t._pointLabels?t._pointLabels.length:6,o=t.ticks;if(!o||!o.length)return;n.save(),n.strokeStyle=r,n.lineWidth=1;for(let e of o){n.beginPath();for(let r=0;rsetTimeout(e,100)),a===`pie`||a===`doughnut`?this.drawPieDataLabels(p,h,t):this.drawDataLabels(p,h,t),o&&s>0&&this.drawDataTable(p,h,t,o,18,s),e.save(),e.globalCompositeOperation=`source-over`;let r=n.x,i=n.y,l=n.width,u=n.height;e.beginPath(),e.rect(r,i,l,u),e.clip(),e.drawImage(c,0,0,c.width,c.height,r,i,l,u),e.restore()}finally{h.destroy()}return null}validateChartData(e){if(!e)return console.error(`[Chart.js] No chart data provided - cannot render without real data`),null;typeof window<`u`&&(window.debugChartData=e);let t=e.type===`bubble`,n=e.type===`scatter`,r=!1;return r=t?e.series&&e.series.length>0&&e.series.some(e=>e.bubbleSizes&&e.bubbleSizes.length>0&&e.values&&e.values.length>0&&e.categories&&e.categories.length>0):e.series&&e.series.length>0&&e.series[0].values&&e.series[0].values.length>0,r?(typeof window<`u`&&(window.lastProcessedChartData=e),e):(console.error(`[Chart.js] Chart data does not contain real series values from PPTX DOM`),t?console.error(`[Chart.js] Bubble chart validation: expected bubbleSizes array in series data`):n&&console.error(`[Chart.js] Scatter chart validation: expected values array in series data`),null)}convertToChartJSConfig(e,t){let n=this.validateChartData(e);if(!n)throw Error(`Cannot render chart without real data from PPTX DOM`);let{type:r,series:i,categories:a,title:o,legend:s,plotArea:c,axes:l,subtype:u}=n,d=n.outerCategoryLevels||null,f={column:`bar`,bar:`bar`,line:`line`,pie:`pie`,doughnut:`doughnut`,area:`line`,scatter:`scatter`,bubble:`bubble`,radar:`radar`,combo:`bar`,stock:`line`,surface:`line`,waterfall:`bar`,histogram:`bar`,boxWhisker:`bar`,sunburst:`pie`,treemap:`pie`}[r]||`bar`,p=r===`area`&&(u===`stacked`||u===`percentStacked`||u===`standard`&&i.length>1)||r===`column`&&(u===`stacked`||u===`percentStacked`)||r===`bar`&&(u===`stacked`||u===`percentStacked`),m=a||[],h=n.categoryFormatCode;if(h&&m.length>0){let e=parseFloat(m[0]);!isNaN(e)&&e>1e3&&(m=m.map(e=>{let t=parseFloat(e);return!isNaN(t)&&t>1e3?this.formatExcelDate(t,h):e}))}(f===`pie`||f===`doughnut`)&&i.length===1&&i[0].categories&&i[0].categories.length>0&&(m=i[0].categories),f===`radar`&&(i.length>0&&i[0].categories&&i[0].categories.length>0?m=i[0].categories:a&&a.length>0?m=a:console.warn(`[Radar Chart Debug] No categories found for radar chart labels`)),f===`bubble`&&(m=[]);let g=this.convertSeriesToDatasets(i,f,p,r,e,t),_=i.flatMap(e=>e.values||[]),v=Math.min(..._,0),y=Math.max(..._),b=v<0?v:0,x,S,{max:C,step:w}=this.calculateOptimalAxisScale(y,v);if(x=C,S=w,l&&l.value&&l.value.scaling){let e=l.value.scaling;e.min!==null&&e.min!==void 0&&e.min<0&&(b=e.min),e.max!==null&&e.max!==void 0&&(x=e.max),e.majorUnit!==null&&e.majorUnit!==void 0&&(S=e.majorUnit)}if(b<0&&S>0&&l?.value?.scaling?.min==null&&(b=Math.floor(b/S)*S),r===`column`&&y>=900&&y<=1200)b=0,x=1200,S=200;else if(!l?.value?.scaling?.majorUnit&&l?.value?.scaling?.max==null)if(p){let e=i.filter(e=>!e.isSecondaryAxis),t=Math.max(...e.map(e=>e.values?e.values.length:0),0),n=0;for(let r=0;re+(t.values&&t.values[r]?t.values[r]:0),0);n=Math.max(n,t)}if(n>=1100&&n<=1150)x=1200,S=200;else{let{max:e,step:t}=this.calculateOptimalAxisScale(n,0);x=e,S=t}r===`area`&&y<=31200&&y>=3e4&&(x=35e3,S=5e3)}else r===`area`&&y<=31200&&y>=3e4&&(x=Math.ceil(y*1.1/5e3)*5e3,S=5e3);u===`percentStacked`&&(b=0,x=1,S=.1);let T=`x`;f===`bar`&&(r===`bar`?T=`y`:r===`column`&&(T=`x`),n.barDirection&&(n.barDirection===`bar`?T=`y`:n.barDirection===`col`&&(T=`x`)));let E=l?.category?.scaling?.orientation===`maxMin`;T===`y`&&!p&&!E&&g.length>1&&(g.forEach((e,t)=>{e._originalIndex??(e._originalIndex=t)}),g.reverse());let D=Math.min(1.5,Math.max(1,(t?t.height:400)/500)),O=this.extractFontConfig(s);O.size=Math.round(O.size*D);let k={type:f,data:{labels:m,datasets:g},options:{responsive:!1,maintainAspectRatio:!1,indexAxis:T,layout:{padding:{top:f===`doughnut`||f===`pie`?40:f===`radar`?10:s&&(s.position===`t`||s.position===`tr`||s.position===`tl`)&&o&&(o.text||typeof o==`string`)?30:10,right:f===`doughnut`||f===`pie`?50:20,bottom:f===`doughnut`||f===`pie`?40:d?20+d.length*22:20,left:20}},scales:this.getScalesConfig(f,b,x,S,p,l,i,T,u),plugins:{legend:{display:s&&s.visible!==!1,position:this.mapLegendPosition(s),labels:{padding:Math.round(5*D),font:O,boxWidth:Math.round(15*D),boxHeight:Math.round(8*D),usePointStyle:f===`line`&&r!==`area`,generateLabels:function(e){let t=e.data,n=t.datasets.length===1&&Array.isArray(t.datasets[0].backgroundColor)&&t.labels.length>0;if(e.config.type===`pie`||e.config.type===`doughnut`||n){if(t.labels.length&&t.datasets.length)return t.labels.map((e,n)=>{let r=t.datasets[0],i=Array.isArray(r.backgroundColor)?r.backgroundColor[n]:r.backgroundColor;return{text:e,fillStyle:i,strokeStyle:i,lineWidth:1,hidden:!1,index:n}})}else if(t.datasets.length>0){let e=t.datasets.map((e,t)=>({text:e.label||`Series ${t+1}`,fillStyle:e.backgroundColor||e.borderColor,strokeStyle:e.borderColor||e.backgroundColor,lineWidth:e.borderWidth||1,hidden:!1,index:t,datasetIndex:t,_originalIndex:e._originalIndex==null?t:e._originalIndex}));e.sort((e,t)=>e._originalIndex-t._originalIndex);let n=s&&s.position;return p&&(r===`column`||r===`bar`)&&(!n||n===`r`||n===`l`||n===`tr`||n===`tl`||n===`br`||n===`bl`)&&e.reverse(),e}return[]}}},tooltip:this.getTooltipConfig(f,p),border:{display:!1}},animation:{duration:0}}},A=n&&n.plotArea&&n.plotArea.shapeProperties&&n.plotArea.shapeProperties.fill;if(A){let e=this.convertColorToHex(A),t=A&&typeof A.a==`number`?A.a:1,n=t<1?this.hexToRgba(e,t):e;if(!(e&&e.replace(`#`,``).toLowerCase()===`ffffff`)&&f!==`pie`&&f!==`doughnut`){let e={id:`plotAreaBackground`,beforeDraw(e){let{ctx:t,chartArea:r}=e;r&&(t.save(),t.fillStyle=n,t.fillRect(r.left,r.top,r.right-r.left,r.bottom-r.top),t.restore())}};k.plugins?k.plugins.push(e):k.plugins=[e]}}let j=n&&n.plotArea&&n.plotArea.shapeProperties&&n.plotArea.shapeProperties.line;if(j&&j.color){let e=this.convertColorToHex(j.color),t=Math.max(.5,(j.width||12700)/12700*1.333);if(e&&f!==`pie`&&f!==`doughnut`){let n={id:`plotAreaBorder`,afterDraw(n){let{ctx:r,chartArea:i}=n;i&&(r.save(),r.strokeStyle=e,r.lineWidth=t,r.strokeRect(i.left,i.top,i.right-i.left,i.bottom-i.top),r.restore())}};k.plugins?k.plugins.push(n):k.plugins=[n]}}if(!j&&f!==`pie`&&f!==`doughnut`&&f!==`radar`){let e={id:`defaultPlotAreaBorder`,afterDraw(e){let{ctx:t,chartArea:n}=e;n&&(t.save(),t.strokeStyle=`rgba(136, 136, 136, 0.6)`,t.lineWidth=1,t.strokeRect(n.left,n.top,n.right-n.left,n.bottom-n.top),t.restore())}};k.plugins?k.plugins.push(e):k.plugins=[e]}if(d&&d.length>0&&f!==`pie`&&f!==`doughnut`){let e={id:`multiLevelAxis`,afterDraw(e){let t=e.scales.x;if(!t)return;let n=e.ctx,r=t.ticks?t.ticks.length:0;if(!r)return;n.save(),n.fillStyle=`#333333`,n.textAlign=`center`,n.textBaseline=`middle`;let i=r>1?Math.abs(t.getPixelForTick(1)-t.getPixelForTick(0))/2:20;d.forEach((e,a)=>{let o=t.bottom+4+a*20+20/2;n.font=a===0?`11px Arial, sans-serif`:`bold 12px Arial, sans-serif`,e.forEach((e,s)=>{let c=Math.max(0,Math.min(e.startIndex,r-1)),l=Math.max(0,Math.min(e.endIndex,r-1)),u=t.getPixelForTick(c)-i,d=t.getPixelForTick(l)+i,f=(u+d)/2;n.fillText(e.label,f,o),n.strokeStyle=`#888888`,n.lineWidth=1;let p=t.bottom+2+a*20,m=p+20;s===0&&(n.beginPath(),n.moveTo(u,p),n.lineTo(u,m),n.stroke()),n.beginPath(),n.moveTo(d,p),n.lineTo(d,m),n.stroke()}),n.strokeStyle=`#888888`,n.lineWidth=1,n.beginPath();let s=t.bottom+2+a*20,c=t.getPixelForTick(0)-i,l=t.getPixelForTick(r-1)+i;n.moveTo(c,s),n.lineTo(l,s),n.stroke()}),n.restore()}};k.plugins?k.plugins.push(e):k.plugins=[e]}if(r===`waterfall`&&(k.plugins=[{id:`waterfallConnectors`,afterDatasetsDraw(e){let t=e.ctx,n=e.getDatasetMeta(0);if(!(!n||!n.data)){t.save(),t.strokeStyle=`#999999`,t.lineWidth=1,t.setLineDash([4,4]);for(let e=0;ee.seriesType===`line`||e.isSecondaryAxis).flatMap(e=>e.values||[]).filter(e=>typeof e==`number`),t=e.length>0?Math.min(...e,0):0,n=e.length>0?Math.max(...e):100,r=l?.valueSecondary?.scaling,a=r?.min??null,o=r?.max??null,s=l?.valueSecondary?.scaling?.majorUnit??null,c,u;o==null?{max:c,step:u}=this.calculateOptimalAxisScale(n,t):(c=o,u=s??this.calculateOptimalAxisScale(c,a??t).step);let d=a??(t<0?t:0),f=l?.valueSecondary?.title?.text||``,p=l?.valueSecondary?.title?.color?this.convertColorToHex(l.valueSecondary.title.color):`#666666`;k.options.scales.y1={type:`linear`,position:`right`,beginAtZero:d>=0,min:d,max:c,ticks:{stepSize:u,font:{size:11},color:`#666666`},grid:{drawOnChartArea:!1},title:{display:!!f,text:f,color:p,font:{size:11}}}}return k}convertSeriesToDatasets(e,t,n=!1,r=null,i=null,a=null){let o=r===`area`&&n;if(t===`radar`){let t=i&&i.radarStyle||`standard`,n=t===`filled`,r=t===`marker`,a={diamond:`rectRot`,square:`rect`,triangle:`triangle`,circle:`circle`,star:`star`,x:`crossRot`,plus:`cross`,dash:`dash`,dot:`circle`};return(n?[...e].reverse():e).map((t,i)=>{let o=n?e.length-1-i:i,s=this.getSeriesColor(t,o),c=`transparent`;if(t.line&&t.line.color?s=`rgb(${t.line.color.r}, ${t.line.color.g}, ${t.line.color.b})`:t.fill&&(s=`rgb(${t.fill.r}, ${t.fill.g}, ${t.fill.b})`),n&&t.fill){let e=t.fill,n=e.a===void 0?1:e.a;c=`rgba(${e.r}, ${e.g}, ${e.b}, ${n})`}else n&&(c=s);let l=0,u=`circle`;if(r&&(l=5,t.marker&&t.marker.symbol&&(u=a[t.marker.symbol]||`circle`),t.marker&&t.marker.size)){let e=t.marker.size>100?t.marker.size/100:t.marker.size;l=Math.max(2,Math.min(10,Math.round(e/2)))}let d=s;if(t.marker&&t.marker.fill){let e=t.marker.fill;d=`rgb(${e.r}, ${e.g}, ${e.b})`}let f=s;t.marker&&t.marker.line&&t.marker.line.color&&(f=this.convertColorToHex(t.marker.line.color));let p=t.line&&t.line.width?Math.max(1,Math.round(t.line.width/12700)):2,m=t.marker&&t.marker.line&&t.marker.line.width?Math.max(1,Math.round(t.marker.line.width/12700)):1;return{label:t.name||`Series ${i+1}`,data:t.values||[],fill:n,backgroundColor:c,borderColor:s,borderWidth:p,pointRadius:l,pointStyle:u,pointBackgroundColor:d,pointBorderColor:f,pointBorderWidth:m,pointHoverRadius:Math.max(l+2,4),tension:t.smooth?.4:0}})}if(t===`scatter`){let t=i?.scatterStyle||`marker`;return e.map((e,n)=>{let r=this.getSeriesColor(e,n),i=e.categories||e.xValues||[],a=e.values||[],o=Math.max(i.length,a.length),s=[];for(let e=0;e100?e.marker.size/100:e.marker.size)*(96/72);p=Math.max(2,Math.min(8,Math.round(t/2)))}return t===`line`&&(p=0),{label:e.name||`Series ${n+1}`,data:s,showLine:l,backgroundColor:f,borderColor:l?u:f,borderWidth:l?d:1,pointRadius:p,pointHoverRadius:Math.max(p+2,4)}})}if(t===`bubble`){let t=e.flatMap(e=>(e.bubbleSizes||[]).map(e=>parseFloat(e)).filter(e=>!isNaN(e)&&e>0)),n=t.length>0?Math.min(...t):1;(t.length>0?Math.max(...t):1)-n;let r=t.map(e=>Math.sqrt(e)),o=r.length>0?Math.min(...r):1,s=(r.length>0?Math.max(...r):1)-o;return e.map((e,t)=>{let r=this.getSeriesColor(e,t),c=[],l=e.categories||[],u=e.values||[],d=e.bubbleSizes||[],f=Math.max(l.length,u.length,d.length);for(let e=0;e0?g+(_-o)/s*(h-g):(g+h)/2,v=Math.max(v,2),c.push({x:t,y:r,r:v})}let p=r,m=r,h=2;if(e.fill){let t=e.fill,n=t.a===void 0?1:t.a;p=`rgba(${t.r}, ${t.g}, ${t.b}, ${n})`}if(e.line&&e.line.color){let t=e.line.color;m=`rgb(${t.r}, ${t.g}, ${t.b})`}return e.line&&e.line.width&&(h=Math.max(1,Math.min(16,Math.round(e.line.width/12700)))),{label:e.name||`Series ${t+1}`,data:c,backgroundColor:p,borderColor:m,borderWidth:h,pointRadius:0,pointHoverRadius:0}})}if(t===`pie`||t===`doughnut`){if(e.length===1&&e[0].values&&e[0].values.length>1){let n;return n=e[0].pointFills&&e[0].pointFills.length?e[0].values.map((t,n)=>this.convertColorToHex(e[0].pointFills[n]||this.getPieSegmentColor(n))):e[0].values.map((e,t)=>this.getPieSegmentColor(t)),[{data:e[0].values,backgroundColor:n,borderColor:n.map(e=>this.darkenColor(e)),borderWidth:2,label:e[0].name||(t===`doughnut`?`Doughnut Chart`:`Pie Chart`)}]}else if(e.length>1){let n=e.map(e=>e.values&&e.values.length>0?e.values[0]:0),r=e.map((e,t)=>e.pointFills&&e.pointFills[0]?this.convertColorToHex(e.pointFills[0]):this.getPieSegmentColor(t));return[{data:n,backgroundColor:r,borderColor:r.map(e=>this.darkenColor(e)),borderWidth:2,label:t===`doughnut`?`Doughnut Chart`:`Pie Chart`}]}}if(i&&i.subtype===`percentStacked`){let t=Math.max(...e.map(e=>(e.values||[]).length)),n=[];for(let r=0;re+(parseFloat(t.values&&t.values[r])||0),0);e=e.map(e=>{let t=(e.values||[]).map((e,t)=>{let r=n[t]||1;return parseFloat(e)/r});return Object.assign({},e,{values:t})})}let s=[...e];if(n&&e.length===2){let t=e.some(e=>e.name&&e.name.toLowerCase().includes(`website`)),n=e.some(e=>e.name&&e.name.toLowerCase().includes(`mobile`));t&&n&&r===`area`&&(s=[...e].reverse())}return s.map((e,a)=>{let c=this.getSeriesColor(e,a);if(o){let t={"Website Traffic":`#27AE60`,"Mobile Traffic":`#3498DB`};if(t[e.name])c=t[e.name];else if(e.name&&e.name.toLowerCase().includes(`website`))c=`#27AE60`;else if(e.name&&e.name.toLowerCase().includes(`mobile`))c=`#3498DB`;else{let e=[`#3498DB`,`#27AE60`];c=e[a%e.length]}}let l=c,u=c;if(e.fill===`noFill`)l=`rgba(0,0,0,0)`,u=`rgba(0,0,0,0)`;else if(e.fill&&e.fill.a!==void 0&&e.fill.a<1){let t=c.startsWith(`#`)?c:`#${c}`,n=this.hexToRgb(t);n&&(l=`rgba(${n.r}, ${n.g}, ${n.b}, ${e.fill.a})`)}let d={label:e.name||`Series ${a+1}`,data:e.values||[],backgroundColor:l,borderColor:u,borderWidth:1,_outerShadow:e.outerShadow||null};if(t===`bar`&&i&&i.gapWidth!=null&&(d.categoryPercentage=1/(1+i.gapWidth/100),d.barPercentage=1),e.seriesType&&e.seriesType!==r&&(d.type={line:`line`,bar:`bar`,column:`bar`,area:`line`}[e.seriesType]||e.seriesType,d.type===`line`)){d.fill=!1,d.tension=e.smooth?.4:.1,d.order=0,e.line&&e.line.noFill?(d.borderWidth=0,d.showLine=!1):d.borderWidth=e.line?.width?Math.max(1,Math.round(e.line.width/12700)):2.5;let t=e.marker?.symbol,n=t===`none`?0:5;if(t!==`none`&&e.marker&&typeof e.marker.size==`number`){let t=e.marker.size*(96/72);n=Math.max(2,Math.min(10,Math.round(t/2)))}d.pointRadius=n;let r=c;e.marker?.fill&&e.marker.fill!==`noFill`?r=this.convertColorToHex(e.marker.fill):e.marker?.fill===`noFill`&&(r=`#ffffff`),d.pointBackgroundColor=r,d.pointBorderColor=e.marker?.line?.color?this.convertColorToHex(e.marker.line.color):c,d.pointBorderWidth=e.marker?.line?.width?Math.max(1,Math.round(e.marker.line.width/12700)):1,d.pointStyle=t===`diamond`?`rectRot`:t===`square`?`rect`:t===`triangle`?`triangle`:`circle`,i&&i.hasSecondaryAxis&&(d.yAxisID=`y1`)}if(e.isSecondaryAxis&&i&&i.hasSecondaryAxis&&!d.yAxisID&&(d.yAxisID=`y1`),r===`area`&&t===`line`){r===`area`&&n?a===0?d.fill=`origin`:d.fill=`-1`:(d.fill=`origin`,d.order=s.length-a);let t=c.startsWith(`#`)?c:`#${c}`,i=this.hexToRgb(t);if(i){let t=r===`area`&&n,o;o=e.fill&&e.fill.a!==void 0?e.fill.a:t?a===0?.7:.6:.95,d.backgroundColor=`rgba(${i.r}, ${i.g}, ${i.b}, ${o})`}if(e.line&&e.line.color){let t=e.line.color;d.borderColor=`rgb(${t.r}, ${t.g}, ${t.b})`}else d.borderColor=c;d.borderWidth=e.line?.width?Math.max(1,Math.round(e.line.width/12700)):2,d.tension=.2,d.pointRadius=0,d.pointHoverRadius=4,d.pointHoverBackgroundColor=c,d.pointHoverBorderColor=`#ffffff`,d.pointHoverBorderWidth=2}else if((r===`column`||r===`bar`)&&t===`bar`&&!e.seriesType){if((r===`column`||r===`bar`)&&n&&(d.stack=`Stack 0`,d.order=1),e.pointFills&&e.pointFills.length>0){let t=(e.values||[]).map((t,n)=>{let r=e.pointFills[n];return r?this.convertColorToHex(r):c});d.backgroundColor=t,d.borderColor=t}}else if(t===`line`){d.fill=!1,d.tension=e.smooth?.4:0,d.borderWidth=e.line?.width?Math.max(1,Math.round(e.line.width/12700)):2.5;let t={circle:`circle`,dot:`circle`,diamond:`rectRot`,square:`rect`,triangle:`triangle`,star:`star`,x:`crossRot`,plus:`cross`,dash:`dash`},n=e.marker?.symbol,r=n===`none`||n===`dash`?0:5;if(r>0&&e.marker&&typeof e.marker.size==`number`){let t=e.marker.size*(96/72);r=Math.max(n===`dot`?1:3,Math.round(t/2)),n===`dot`&&(r=Math.max(1,Math.round(r/2)))}d.pointRadius=r,d.pointHoverRadius=r>0?r+2:0,n&&n!==`none`&&t[n]&&(d.pointStyle=t[n]);let i=c;e.marker?.fill&&e.marker.fill!==`noFill`?i=this.convertColorToHex(e.marker.fill):e.marker?.fill===`noFill`&&(i=`#ffffff`),d.pointBackgroundColor=i,d.pointBorderColor=e.marker?.line?.color?this.convertColorToHex(e.marker.line.color):c,d.pointBorderWidth=1}return d})}getSeriesColor(e,t){if(e.color)return this.convertColorToHex(e.color);if(e.marker&&e.marker.fill)return this.convertColorToHex(e.marker.fill);if(e.marker&&e.marker.line&&e.marker.line.color)return this.convertColorToHex(e.marker.line.color);if(e.fill&&e.fill!==`noFill`)return this.convertColorToHex(e.fill);if(e.line&&e.line.color)return this.convertColorToHex(e.line.color);let n=[`#4472C4`,`#C00000`,`#70AD47`,`#A5A5A5`,`#5B9BD5`,`#FFC000`,`#264478`,`#7F0000`];return n[t%n.length]}mapLegendPosition(e){return!e||!e.position?`right`:{r:`right`,l:`left`,t:`top`,b:`bottom`,tr:`right`,tl:`left`,br:`right`,bl:`left`}[e.position]||`right`}drawPieDataLabels(e,t,n){let r=t.data.datasets,i=t.getDatasetMeta(0);if(!i||!i.data||i.data.length===0)return;e.save();let a={family:`Calibri`,size:11,weight:`normal`},o=`#FFFFFF`;if(n&&n.series&&n.series[0]&&n.series[0].dataLabels){let e=n.series[0].dataLabels;e.formatting&&(a=this.extractFontConfig(e),o=this.extractColorFromFormatting(e))}else a.size=this.getDOMFontSize(null,12);e.font=`${a.style||`normal`} ${a.weight} ${a.size}px ${a.family}`,e.fillStyle=o,e.textAlign=`center`,e.textBaseline=`middle`;let s=i.data[0].x,c=i.data[0].y,l=[];i.data.forEach((e,t)=>{let n=r[0].data[t],i=r[0].data.reduce((e,t)=>e+t,0),a=Math.round(n/i*100),o=(e.startAngle+e.endAngle)/2,u=e.outerRadius,d=e.innerRadius||0,f=d>0?(d+u)/2:u*.65,p=s+Math.cos(o)*f,m=c+Math.sin(o)*f;l.push({x:p,y:m,value:n,percentage:a,index:t})}),this.adjustLabelPositions(l,a.size).forEach(t=>{let r=n?.series?.[0]?.dataLabels,i=n?.dataLabels?.showValue===!0||r?.showValue===!0,o=n?.dataLabels?.showPercent===!0||r?.showPercent===!0,s=n?.dataLabels?.showCategoryName===!0||r?.showCategoryName===!0,c=s&&n?.categories?.[t.index]||``,l=[];if(s&&c&&l.push(c),i&&l.push(t.value.toString()),o&&l.push(`${t.percentage}%`),l.length===0)return;let u=a.size*1.2,d=u*l.length,f=t.y-d/2+u/2;l.forEach((n,r)=>{e.fillText(n,t.x,f+r*u)})}),e.restore()}adjustLabelPositions(e,t){let n=[...e],r=t*3;for(let e=0;e{e.save(),e.fillStyle=o||getSeriesLabelColor(a);let c=t.getDatasetMeta(a),l=t.config.options?.indexAxis===`y`;c.data.forEach((o,u)=>{let d=r.data[u],f=r.pointRadius||5,p,m;s?(p=o.x+f+4,m=o.y,e.textAlign=`left`,e.textBaseline=`middle`):l?(d>=0?Math.min(o.x,o.base||o.x):Math.max(o.x,o.base||o.x),p=(d>=0?Math.max(o.x,o.base||o.x):Math.min(o.x,o.base||o.x))+4,m=o.y,e.textAlign=`left`,e.textBaseline=`middle`):(p=o.x,m=t.scales?.y?.options?.reverse===!0?o.y-5:Math.min(o.y,o.base||o.y)-5,e.textAlign=`center`,e.textBaseline=`bottom`);let h,g=n?.series?.[a]?.dataLabels||n?.dataLabels,_=g?.formatting?.number?.formatCode||``,v=g?.showSeriesName===!0,y=t.config.type;if(y!==`radar`){if(y===`bubble`)if(v&&g?.showValue!==!0)h=r.label||``;else{let e=c._parsed?.[u]?.y??(typeof d==`object`&&d?d.y:d),t=typeof e==`number`?e:parseFloat(e);if(isNaN(t))return;h=_.includes(`%`)?Math.round(t*100)+`%`:_&&!_.includes(`.`)&&(_.includes(`#,##0`)||_===`0`)?Math.round(t).toLocaleString():t.toLocaleString()}else if(Array.isArray(d)){let e=d[1]-d[0];h=(e>=0?`+`:``)+e.toLocaleString()}else if(v&&g?.showValue===!1)h=r.label||``;else if(typeof d==`object`&&d&&!Array.isArray(d)){let e=d.y;h=_.includes(`%`)?Math.round(e*100)+`%`:_&&!_.includes(`.`)&&(_.includes(`#,##0`)||_===`0`)?Math.round(e).toLocaleString():typeof e==`number`?e.toLocaleString():String(e)}else if(typeof d==`number`)if(_.includes(`%`))h=Math.round(d*100)+`%`;else if(_&&(_.includes(`#,##0`)||_===`0`)&&!_.match(/\.\d/))h=Math.round(d).toLocaleString();else if(_&&_.match(/[#0]\.\d+/)){let e=(_.split(`.`)[1]||``).replace(/[^0]/g,``).length||(_.split(`.`)[1]||``).length;h=d.toFixed(e)}else h=d.toLocaleString();else h=String(d);s&&i&&p+e.measureText(h).width>i.right&&(p=o.x-f-4,e.textAlign=`right`),e.fillText(h,p,m)}}),e.restore()}),e.restore()}getDOMFontSize(e,t=12){let n=t;if(e&&e.font){let r=e.font;if(n=r.fontSize||r.size||t,typeof n==`string`){let e=n.trim().toLowerCase();if(e.endsWith(`pt`))n=parseFloat(e.slice(0,-2));else if(e.endsWith(`px`)){let t=parseFloat(e.slice(0,-2));return Math.max(8,Math.round(t))}else{let t=parseFloat(e);isNaN(t)||(n=t)}}typeof n==`number`&&n>100&&(n/=100)}let r=n*1.3333333333333333;return Math.max(8,Math.round(r))}extractFontConfig(e){let t={size:12,family:`Calibri`,weight:`normal`};if(!e||!e.formatting||!e.formatting.font)return t;let n=e.formatting.font;return{size:this.getDOMFontSize(e.formatting,t.size),family:n.fontFamily||n.family||t.family,weight:n.bold===!0?`bold`:n.weight||t.weight,style:n.italic===!0?`italic`:`normal`}}extractColorFromFormatting(e){return!e||!e.formatting||!e.formatting.color?`#000000`:this.convertColorToHex(e.formatting.color)}convertColorToHex(e){if(!e)return`#000000`;if(typeof e==`string`){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t){let e=parseInt(t[1]),n=parseInt(t[2]),r=parseInt(t[3]);return`#${e.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}return e.match(/^[0-9A-Fa-f]{6}$/)?`#${e}`:e.startsWith(`#`)&&e.match(/^#[0-9A-Fa-f]{6}$/)?e:`#000000`}if(typeof e==`object`){if(e.r!==void 0&&e.g!==void 0&&e.b!==void 0){let t=Math.round(e.r),n=Math.round(e.g),r=Math.round(e.b);return`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}return e.color?this.convertColorToHex(e.color):`#000000`}return`#000000`}extractBackgroundColor(e){let t=`#ffffff`;return e&&e.plotArea&&e.plotArea.shapeProperties&&e.plotArea.shapeProperties.fill&&(t=this.convertColorToHex(e.plotArea.shapeProperties.fill)),t}async renderColumnChart(e,t,n){return t.type=`column`,this.renderChart(e,t,n)}getPieSegmentColor(e){let t=[`#E74C3C`,`#3498DB`,`#2ECC71`,`#F39C12`,`#9B59B6`,`#FF6B6B`,`#4ECDC4`,`#45B7D1`,`#96CEB4`,`#FFEAA7`];return t[e%t.length]}darkenColor(e){if(e.startsWith(`#`)){let t=e.slice(1),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=Math.floor(n*.8),o=Math.floor(r*.8),s=Math.floor(i*.8);return`#${a.toString(16).padStart(2,`0`)}${o.toString(16).padStart(2,`0`)}${s.toString(16).padStart(2,`0`)}`}return e}hexToRgb(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}hexToRgba(e,t=1){let n=this.hexToRgb(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`:`rgba(0, 0, 0, ${t})`}getScalesConfig(e,t,n,r,i,a,o,s=`x`,c=null){if(e===`pie`||e===`doughnut`)return{};if(e===`radar`){let e=0,t=null,n=null;if(a&&a.value&&a.value.scaling){let r=a.value.scaling;r.min!=null&&(e=r.min),r.max!=null&&(t=r.max),r.majorUnit!=null&&(n=r.majorUnit)}if(t===null||n===null){let e=o.flatMap(e=>(e.values||[]).map(e=>parseFloat(e)).filter(e=>!isNaN(e))),r=e.length?Math.max(...e):100;if(n===null){let e=r/5,t=10**Math.floor(Math.log10(e||1));n=[1,2,2.5,5,10].map(e=>e*t).find(t=>t>=e)||t*10}t===null&&(t=Math.ceil(r/n)*n)}return{r:{z:1,angleLines:{display:!0,color:a?.value?.gridlines?.color||`rgba(136, 136, 136, 0.8)`,lineWidth:1},min:e,max:t,beginAtZero:!0,ticks:{stepSize:n,display:!1,font:{size:this.getDOMFontSize(a?.value?.tickLabels?.formatting,12),weight:`normal`},color:`#000000`,backdropColor:`transparent`,showLabelBackdrop:!1,padding:5,callback:function(e){return e.toString()}},pointLabels:{font:{size:this.getDOMFontSize(a?.category?.tickLabels?.formatting,14),weight:`normal`},color:a?.category?.tickLabels?.formatting?.color?this.convertColorToHex(a.category.tickLabels.formatting.color):`#000000`,padding:20,centerPointLabels:!1},grid:{circular:!1,color:a?.value?.gridlines?.color||`rgba(136, 136, 136, 0.8)`,lineWidth:1}}}}if(e===`scatter`){let e=o.flatMap(e=>e.categories||e.xValues||[]).map(e=>parseFloat(e)).filter(e=>!isNaN(e)),t=o.flatMap(e=>e.values||[]).map(e=>parseFloat(e)).filter(e=>!isNaN(e)),n=e.length?Math.min(...e):0,r=e.length?Math.max(...e):1,i=t.length?Math.min(...t):0,s=t.length?Math.max(...t):1,c=n>=0?0:n,l=i>=0?0:i,u=this.calculateOptimalAxisScale(r,c),d=this.calculateOptimalAxisScale(s,l),f={min:c,max:u.max,stepSize:u.step},p={min:l,max:d.max,stepSize:d.step};if(a?.category?.scaling){let e=a.category.scaling;e.min!==null&&e.min!==void 0&&(f.min=e.min),e.max!==null&&e.max!==void 0&&(f.max=e.max),e.majorUnit!==null&&e.majorUnit!==void 0&&(f.stepSize=e.majorUnit)}if(a?.value?.scaling){let e=a.value.scaling;e.min!==null&&e.min!==void 0&&(p.min=e.min),e.max!==null&&e.max!==void 0&&(p.max=e.max),e.majorUnit!==null&&e.majorUnit!==void 0&&(p.stepSize=e.majorUnit)}return{x:{type:`linear`,position:`bottom`,min:f.min,max:f.max,ticks:{stepSize:f.stepSize,font:{size:this.getDOMFontSize(a?.category?.formatting,12)}},title:{display:!!a?.category?.title?.text,text:a?.category?.title?.text||``},grid:{display:!0,color:`rgba(200,200,200,0.3)`,lineWidth:1}},y:{type:`linear`,min:p.min,max:p.max,ticks:{stepSize:p.stepSize,font:{size:this.getDOMFontSize(a?.value?.formatting,12)}},title:{display:!!a?.value?.title?.text,text:a?.value?.title?.text||``},grid:{display:!0,color:`rgba(200,200,200,0.3)`,lineWidth:1}}}}if(e===`bubble`){let e=a?.value||null,t=a?.valueSecondary||null,n=o.flatMap(e=>e.categories||[]).map(e=>parseFloat(e)).filter(e=>!isNaN(e)),r=o.flatMap(e=>e.values||[]).map(e=>parseFloat(e)).filter(e=>!isNaN(e));if(n.length===0||r.length===0)return{};let i=Math.min(...n),s=Math.max(...n),c=Math.min(...r),l=Math.max(...r),u=i>=0?0:i,d=c>=0?0:c,f=e=>{if(e<=0)return 1;let t=e/10,n=10**Math.floor(Math.log10(t));for(let e of[1,2,2.5,5,10])if(n*e>=t)return n*e;return n*10},p=e?.scaling?.majorUnit||f(s),m=t?.scaling?.majorUnit||f(l),h={min:u,max:Math.ceil(s*1.2/p)*p,stepSize:p},g={min:d,max:Math.ceil(l*1.1/m)*m,stepSize:m};e?.scaling?.min!=null&&(h.min=e.scaling.min),e?.scaling?.max!=null&&(h.max=e.scaling.max),e?.scaling?.majorUnit!=null&&(h.stepSize=e.scaling.majorUnit),t?.scaling?.min!=null&&(g.min=t.scaling.min),t?.scaling?.max!=null&&(g.max=t.scaling.max),t?.scaling?.majorUnit!=null&&(g.stepSize=t.scaling.majorUnit);let _=this.shouldReverseAxis(e?.scaling,`value`),v=this.shouldReverseAxis(t?.scaling,`value`);return{x:{type:`linear`,position:`bottom`,min:h.min,max:h.max,reverse:_,title:{display:!!e?.title?.text,text:e?.title?.text||``},ticks:{stepSize:h.stepSize,font:{size:this.getDOMFontSize(e?.formatting,12)},callback:function(e){return e.toString()}},grid:{display:!1}},y:{type:`linear`,position:`left`,min:g.min,max:g.max,reverse:v,title:{display:!!t?.title?.text,text:t?.title?.text||``},ticks:{stepSize:g.stepSize,font:{size:this.getDOMFontSize(t?.formatting,12)},callback:function(e){return e.toString()}},grid:{color:t?.gridlines?.color||`rgba(136, 136, 136, 0.8)`,lineWidth:1,display:!0}}}}let l=a?.value?.tickLabels?.formatting,u=a?.category?.tickLabels?.formatting,d=l?.color?this.convertColorToHex(l.color):`#666666`,f=u?.color?this.convertColorToHex(u.color):`#666666`,p=a?.value?.tickLabels?.format?.formatCode||``,m=p.includes(`%`),h=/,\s*"?K"?\s*$/.test(p)||/\d"?K"?\s*$/.test(p),g=/,\s*"?M"?\s*$/.test(p),_=!m&&!h&&!g&&(p.includes(`#,##0`)||p.includes(`,`)),v=!m&&!h&&!g&&!_?p.match(/^[#0.,]+\s*("([^"]+)"|([^#0.,\s%]+))$/):null,y=((e,t,n,r,i,a)=>e?function(e){return Math.round(e*100)+`%`}:t?function(e){return(e/a/1e3).toLocaleString()+`K`}:n?function(e){return(e/a/1e6).toLocaleString()+`M`}:a>1?function(e){let t=e/a;return r?Number(t).toLocaleString():Number.isInteger(t)?t.toString():t.toFixed(1)}:r?function(e){return Number(e).toLocaleString()}:i?function(e){return Math.round(Number(e)).toString()+i}:function(e){return e.toString()})(m,h,g,_,v&&(v[2]||v[3])||null,a?.value?.scaling?.displayUnit||1),b=a?.value?.visible===!1,x=a?.category?.visible===!1,S=e=>({l:`left`,r:`right`,b:`bottom`,t:`top`})[e]||null,C=(e,t)=>{let n=e?.gridlines?.dash,r={color:e?.gridlines?.color||`rgba(136, 136, 136, 0.8)`,lineWidth:1,display:!t,z:1};return n&&(r.borderDash=[5,5]),r},w=(e,t)=>{let n={bottom:`top`,top:`bottom`,left:`right`,right:`left`},r=e||t;return n[r]||r},T=this.shouldReverseAxis(a?.value?.scaling,`value`),E=this.shouldReverseAxis(a?.category?.scaling,`category`),D=a?.category?.crosses,O=a?.value?.crosses,k=e=>!e||e===`autoZero`||e===`min`,A=S(a?.value?.position),j=S(a?.category?.position),ee=s===`y`?`left`:`bottom`,te=s===`y`?`bottom`:`left`,ne=T&&k(D)?w(j,ee):j,re=E&&k(O)?w(A,te):A,M={y:{beginAtZero:t>=0,min:t,max:n,stacked:i,reverse:this.shouldReverseAxis(a?.value?.scaling,`value`),display:!b,...re?{position:re}:{},ticks:{stepSize:r,font:{size:this.getDOMFontSize(l,12)},color:d,callback:y},grid:C(a?.value,b)},x:{stacked:i,display:!x,reverse:this.shouldReverseAxis(a?.category?.scaling,`category`),...a?.category?.tickLabels?.position===`high`?{position:`top`}:ne?{position:ne}:{},ticks:{font:{size:this.getDOMFontSize(u,12)},color:f,...a?.category?.tickLabels?.rotation==null?{}:{maxRotation:a.category.tickLabels.rotation,minRotation:a.category.tickLabels.rotation}},grid:{display:!1}}};if(s===`y`){({...M});let e=this.shouldReverseAxis(a?.value?.scaling,`value`),o=ne;M.x={beginAtZero:t>=0,min:t,max:n,stacked:i,display:b?!!e:!0,reverse:e,...re?{position:re}:{},ticks:{display:!b,stepSize:r,font:{size:this.getDOMFontSize(l,12)},color:d,callback:y},border:{display:!b},grid:C(a?.value,b)},M.y={stacked:i,display:!x,reverse:!this.shouldReverseAxis(a?.category?.scaling,`category`),...o?{position:o}:{},ticks:{font:{size:this.getDOMFontSize(u,12)},color:f},grid:C(a?.category,x)}}return s===`y`?(a?.value?.title&&(M.x.title={display:!0,text:a.value.title.text||a.value.title,font:{size:this.getDOMFontSize(a?.value?.title?.formatting,14),weight:`bold`},color:a?.value?.title?.formatting?.color?this.convertColorToHex(a.value.title.formatting.color):`#666666`}),a?.category?.title&&(M.y.title={display:!0,text:a.category.title.text||a.category.title,font:{size:this.getDOMFontSize(a?.category?.title?.formatting,14),weight:`bold`},color:a?.category?.title?.formatting?.color?this.convertColorToHex(a.category.title.formatting.color):`#666666`})):(a?.value?.title&&(M.y.title={display:!0,text:a.value.title.text||a.value.title,font:{size:this.getDOMFontSize(a?.value?.title?.formatting,14),weight:`bold`},color:a?.value?.title?.formatting?.color?this.convertColorToHex(a.value.title.formatting.color):`#666666`}),a?.category?.title&&(M.x.title={display:!0,text:a.category.title.text||a.category.title,font:{size:this.getDOMFontSize(a?.category?.title?.formatting,14),weight:`bold`},color:a?.category?.title?.formatting?.color?this.convertColorToHex(a.category.title.formatting.color):`#666666`})),M}getTooltipConfig(e,t){return e===`bubble`?{mode:`point`,intersect:!0,callbacks:{title:function(e){return e[0].dataset.label||``},label:function(e){let t=e.parsed;return[`Market Share: ${t.x}%`,`Revenue: $${t.y.toLocaleString()}k`,`Customer Base: ${t.r} units`]}}}:{mode:t?`index`:`nearest`,intersect:!1,callbacks:{label:function(e){let t=e.dataset.label||``;return t&&(t+=`: `),e.parsed.y!==null&&(t+=e.parsed.y.toLocaleString()),t}}}}shouldShowDataLabels(e){if(e&&e.series&&e.series.length>0){let t=!1;for(let n of e.series)if(n.dataLabels&&(t=!0,n.dataLabels.showValue===!0||n.dataLabels.showSeriesName===!0))return!0;if(t)return!1}if(e&&e.dataLabels){let t=e.dataLabels.showValue,n=e.dataLabels.showSeriesName===!0;if(t===!0||n)return!0;if(t===!1&&!n)return!1}return e&&e.showDataLabels!==void 0?e.showDataLabels:!1}shouldReverseAxis(e,t){return!e||!e.orientation?!1:e.orientation===`maxMin`}formatExcelDate(e,t){let n=(e-25569)*86400*1e3,r=new Date(n);if(isNaN(r.getTime()))return String(e);let i=r.getUTCFullYear(),a=String(r.getUTCMonth()+1).padStart(2,`0`),o=String(i).slice(-2),s=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][r.getUTCMonth()],c=(t||``).toLowerCase();return c===`yyyy-mm`||c===`yyyy\\-mm`?`${i}-${a}`:c===`mmm-yy`||c===`mmm\\-yy`||c.includes(`mmm`)&&c.includes(`yy`)?`${s}-${o}`:(c.includes(`yyyy`)&&c.includes(`mm`),`${i}-${a}`)}calculateOptimalAxisScale(e,t=0){if(e<=0)return{max:10,step:2};let n=e-Math.min(t,0),r=10**Math.floor(Math.log10(n)),i=[1,2,5,10],a=r;for(let t of i){let n=r/10*t;if(n>0){let t=Math.ceil(e*1.05/n);if(t>=4&&t<=8){a=n;break}}}if(a===r)for(let t of i){let n=t*r,i=Math.ceil(e*1.05/n);if(i>=4&&i<=8){a=n;break}}let o=Math.ceil(e*1.05/a)*a;if(e<1){let t=e<.1?.02:.2;return{max:Math.ceil(e*1.1/t)*t,step:t}}return{max:o,step:a}}}e.exports&&(e.exports=t),typeof window<`u`&&(window.ChartJSRenderer=t)})(mu),mu.exports)}gu();var _u={},vu;function yu(){if(vu)return _u;vu=1,typeof AscCommon>`u`&&(window.AscCommon={});function e(){n!==void 0&&(n.prototype.drawLineWithArrows||(n.prototype.drawLineWithArrows=function(e,t,n,r,i,a=1,o=null){let s=this._context;if(!s)return;s.save(),s.beginPath(),s.moveTo(e,t),s.lineTo(n,r);let c=(typeof this.colorToRgb==`function`?this.colorToRgb(i):null)||`rgba(0,0,0,1)`,l=Math.max(CoordinateTransform.mmToPixels(a||1),1);if(s.strokeStyle=c,s.lineWidth=l,o&&o.dashArray&&o.dashArray.length>0){let e=o.dashArray.map(e=>e*l);s.setLineDash(e)}if(o&&typeof this.applyStrokeStyle==`function`)try{this.applyStrokeStyle(s,o,l)}catch{}s.stroke();let u=e=>{if(typeof e==`number`)return e;let t=(e||``).toString().toLowerCase();return t===`lg`||t===`large`?3:t===`med`||t===`medium`?2:t===`sm`||t===`small`?1:2},d=o&&o.headEnd,f=o&&o.tailEnd,p=d&&d.type,m=f&&f.type,h=!!(d&&p&&p!==`none`),g=!!(f&&m&&m!==`none`);if(h||g){let i=Math.atan2(r-t,n-e),a=s.getTransform();Math.sqrt(a.a*a.a+a.b*a.b);let o=l*3,p=l*2.5,m=(e,t,n,r)=>{if(!r)return;let i=r.lengthScale||u(r.len),a=r.widthScale||u(r.w),d=o*i,f=p*a,m=(r.type||r.val||`arrow`).toString().toLowerCase(),h=f/2;s.save(),s.translate(e,t),s.rotate(n),s.beginPath(),m===`open`?(s.moveTo(0,0),s.lineTo(-d,-h),s.moveTo(0,0),s.lineTo(-d,h),s.strokeStyle=c,s.lineWidth=Math.max(1,l),s.stroke()):m===`stealth`?(s.moveTo(0,0),s.lineTo(-d,-(h*.5)),s.lineTo(-d*.85,0),s.lineTo(-d,h*.5),s.closePath(),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(.5,l*.3),s.stroke()):m===`diamond`?(s.moveTo(0,0),s.lineTo(-d/2,-h),s.lineTo(-d,0),s.lineTo(-d/2,h),s.closePath(),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(.5,l*.3),s.stroke()):m===`oval`?(s.ellipse(-d/2,0,d/2,h,0,0,Math.PI*2),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(.5,l*.3),s.stroke()):(s.moveTo(0,0),s.lineTo(-d,-h),s.lineTo(-d,h),s.closePath(),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(.5,l*.3),s.stroke()),s.restore()};h&&m(e,t,i+Math.PI,d),g&&m(n,r,i,f)}s.restore()}))}typeof AscFormat>`u`&&(window.AscFormat={});class t{constructor(){this.sx=1,this.sy=1,this.shx=0,this.shy=0,this.tx=0,this.ty=0}TransformPointX(e,t){return e*this.sx+t*this.shx+this.tx}TransformPointY(e,t){return e*this.shy+t*this.sy+this.ty}Invert(){let e=this.sx*this.sy-this.shx*this.shy;if(Math.abs(e)<1e-12)return;let t=1/e,n=this.sy*t,r=this.sx*t,i=-this.shx*t,a=-this.shy*t,o=(this.shx*this.ty-this.sy*this.tx)*t,s=(this.shy*this.tx-this.sx*this.ty)*t;this.sx=n,this.sy=r,this.shx=i,this.shy=a,this.tx=o,this.ty=s}createDuplicate(){let e=new t;return e.sx=this.sx,e.sy=this.sy,e.shx=this.shx,e.shy=this.shy,e.tx=this.tx,e.ty=this.ty,e}reset(){this.sx=1,this.sy=1,this.shx=0,this.shy=0,this.tx=0,this.ty=0}}typeof CBrush>`u`&&(window.CBrush=class{constructor(){this.Color1={R:0,G:0,B:0,A:255},this.Color2={R:0,G:0,B:0,A:255},this.Type=0}GetType(){return this.Type}}),typeof CPen>`u`&&(window.CPen=class{constructor(){this.Color={R:0,G:0,B:0,A:255},this.Size=1,this.DashStyle=0}}),typeof CFontManager>`u`&&(window.CFontManager=class{constructor(){this.m_oGlyphString={m_fX:0,m_fY:0,m_pGlyphsBuffer:[]}}LoadString4C(e,t,n){return this.m_oGlyphString.m_fX=t,this.m_oGlyphString.m_fY=n,t+10}LoadString2(e,t,n){this.m_oGlyphString.m_fX=t,this.m_oGlyphString.m_fY=n}GetNextChar2(){return null}});class n{constructor(){this.canvas=null,this._context=null,this.widthPx=0,this.heightPx=0,this.widthMM=0,this.heightMM=0,this.dpiX=96,this.dpiY=96,this.transform=new t,this.grStateStack=[],this.clipStack=[],this.font=null,this.brush=new CBrush,this.pen=new CPen,this.currentPath=null,this.isPathStarted=!1,this.customGeometryProcessor=new i}get context(){return this._context}init(e,t,n,r,i){this._context=e,this.widthPx=t,this.heightPx=n,this.widthMM=r||t*25.4/96,this.heightMM=i||n*25.4/96,this.dpiX=96,this.dpiY=96,this.transform.sx=1,this.transform.sy=1,this.transform.shx=0,this.transform.shy=0,this.transform.tx=0,this.transform.ty=0,this.recalculateTransforms()}recalculateTransforms(){this.transform=this.transform.createDuplicate();let e=this.transform.sx*this.transform.sx+this.transform.shx*this.transform.shy,t=this.transform.sy*this.transform.sy+this.transform.shy*this.transform.shx,n=this.transform.sx*this.transform.shx+this.transform.shx*this.transform.sy,r=this.transform.sy*this.transform.shy+this.transform.shy*this.transform.sx,i=this.transform.sx*this.transform.tx+this.transform.shx*this.transform.ty+this.transform.tx,a=this.transform.sy*this.transform.ty+this.transform.shy*this.transform.tx+this.transform.ty;this.transform.sx=e,this.transform.sy=t,this.transform.shx=n,this.transform.shy=r,this.transform.tx=i,this.transform.ty=a,this.transform=this.transform.createDuplicate(),this.transform.Invert()}resetState(){this.coordinateSystem=null,this.transform.reset(),this.grStateStack=[],this.clipStack=[],this.currentRenderingShape=null,this.customGeometryProcessor&&this.customGeometryProcessor.cache.clear(),this.currentPath=null,this.isPathStarted=!1,this.brush=new CBrush,this.pen=new CPen}SaveGrState(){this._context&&(this._context.save(),this.grStateStack.push({transform:this.transform.createDuplicate(),fullTransform:this.transform.createDuplicate(),invertFullTransform:this.transform.createDuplicate()}))}RestoreGrState(){if(this._context&&(this._context.restore(),this.grStateStack.length>0)){let e=this.grStateStack.pop();this.transform=e.transform,this.transform=e.fullTransform,this.transform=e.invertFullTransform}}transform3(e){this.transform=e.createDuplicate(),this.recalculateTransforms(),this._context&&this._context.setTransform(this.transform.sx,this.transform.shy,this.transform.shx,this.transform.sy,this.transform.tx,this.transform.ty)}AddClipRect(e,t,n,r){this._context&&(this._context.save(),this._context.beginPath(),this._context.rect(e,t,n,r),this._context.clip())}clear(){this._context&&(this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this.widthPx,this.heightPx),this._context.restore())}t(e,t,n,r){if(this.bIsBreak||!this._context)return;let i=t,a=n;this._context.fillStyle=this.colorToRgb(this.brush.Color1),this._context.textBaseline=`alphabetic`;let o=i,s=null;this._context.fillText(e,o,a);let c=this._context.measureText(e);return r&&(s={x:i,y:a,r:i+c.width,b:a},c.actualBoundingBoxAscent!==void 0&&(s.y=a-c.actualBoundingBoxAscent),c.actualBoundingBoxDescent!==void 0&&(s.b=a+c.actualBoundingBoxDescent)),o+=c.width,s}b_color1(e,t,n,r=255){this.brush.Color1.R=e,this.brush.Color1.G=t,this.brush.Color1.B=n,this.brush.Color1.A=r,this.bBrushColorInit=!0}p_color(e,t,n,r=255){this.pen.Color.R=e,this.pen.Color.G=t,this.pen.Color.B=n,this.pen.Color.A=r,this.bPenColorInit=!0}p_width(e){this.pen.Size=e,this._context&&(this._context.lineWidth=e)}fillRect(e,t,n,r,i){!this._context||!i||(this._context.save(),this._context.fillStyle=this.colorToRgb(i),this._context.fillRect(e,t,n,r),this._context.restore())}strokeRect(e,t,n,r,i,a=1){this._context&&(this._context.save(),this._context.strokeStyle=this.colorToRgb(i)||this.colorToRgb(this.pen.Color),this._context.lineWidth=a,this._context.strokeRect(e,t,n,r),this._context.restore())}drawLine(e,t,n,r,i,a=1){this._context&&(this._context.save(),this._context.strokeStyle=this.colorToRgb(i),this._context.lineWidth=a,this._context.beginPath(),this._context.moveTo(e,t),this._context.lineTo(n,r),this._context.stroke(),this._context.restore())}fillCircle(e,t,n,r){this._context&&(this._context.save(),this._context.fillStyle=this.colorToRgb(r),this._context.beginPath(),this._context.arc(e,t,n,0,2*Math.PI),this._context.fill(),this._context.restore())}strokeCircle(e,t,n,r,i=1){this._context&&(this._context.save(),this._context.strokeStyle=this.colorToRgb(r),this._context.lineWidth=i,this._context.beginPath(),this._context.arc(e,t,n,0,2*Math.PI),this._context.stroke(),this._context.restore())}fillText(e,t,n,r={}){if(!this._context)return;this._context.save();let i=r.fontSize||r.size||12,a=r.fontFamily||r.family||`Arial`,o=r.bold?`bold`:`normal`,s=r.italic?`italic`:`normal`;this._context.font=`${s} ${o} ${i}px ${a}`,this._context.fillStyle=this.colorToRgb(r.color||{r:0,g:0,b:0}),this._context.textAlign=r.textAlign||`left`,this._context.textBaseline=r.textBaseline||`alphabetic`,this._context.fillText(e,t,n),this._context.restore()}colorToRgb(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e.r===void 0?e.R===void 0?0:e.R:e.r,n=e.g===void 0?e.G===void 0?0:e.G:e.g,r=e.b===void 0?e.B===void 0?0:e.B:e.b,i=e.a===void 0?e.A===void 0?255:e.A:e.a;return i!==void 0&&i!==255?`rgba(${t}, ${n}, ${r}, ${i/255})`:`rgb(${t}, ${n}, ${r})`}return`rgb(0, 0, 0)`}Start_Command(e){this.commandStack.push(e)}End_Command(e){this.commandStack.length>0&&this.commandStack.pop()}get context(){return this._context}isBoundsChecker(){return!1}drawPresetGeometry(e,t,n,r,i,a,o,s=1,c=null,l={}){if(!this._context)return;let u=this._context;if(u.save(),a&&typeof a==`object`&&a.a!==void 0&&a.a<255&&(u.globalAlpha=a.a/255,a={...a,a:255}),a&&typeof a==`object`&&a.type===`linear`&&a.stops){let e={x:t,y:n,w:r,h:i},o=this.createCanvasGradient?this.createCanvasGradient(u,e,a):null;o?u.fillStyle=o:a.stops[0]?.color&&(u.fillStyle=this.colorToRgb(a.stops[0].color))}else a&&(u.fillStyle=this.colorToRgb(a));switch(o&&(u.strokeStyle=this.colorToRgb(o),u.lineWidth=CoordinateTransform.mmToPixels(s||1)),u.beginPath(),e){case`teardrop`:this.drawTeardropPath(u,t,n,r,i);break;case`rect`:case`rectangle`:u.rect(t,n,r,i);break;case`ellipse`:case`oval`:u.ellipse(t+r/2,n+i/2,r/2,i/2,0,0,2*Math.PI);break;case`roundRect`:{let e=l.adj===void 0?16667:l.adj,a=Math.min(5e4,Math.max(0,e))/1e5*Math.min(r,i);this.drawRoundRectPath(u,t,n,r,i,a);break}case`triangle`:this.drawTrianglePath(u,t,n,r,i);break;case`diamond`:this.drawDiamondPath(u,t,n,r,i);break;case`pentagon`:this.drawPentagonPath(u,t,n,r,i);break;case`hexagon`:this.drawHexagonPath(u,t,n,r,i);break;case`octagon`:this.drawOctagonPath(u,t,n,r,i);break;case`star`:case`star5`:this.drawStarPath(u,t,n,r,i);break;case`star4`:this.drawStar4Path(u,t,n,r,i);break;case`star6`:this.drawStar6Path(u,t,n,r,i);break;case`star8`:this.drawStar8Path(u,t,n,r,i);break;case`star10`:this.drawStar10Path(u,t,n,r,i);break;case`star12`:this.drawStar12Path(u,t,n,r,i);break;case`star16`:this.drawStar16Path(u,t,n,r,i);break;case`star24`:this.drawStar24Path(u,t,n,r,i);break;case`star32`:this.drawStar32Path(u,t,n,r,i);break;case`heart`:this.drawHeartPath(u,t,n,r,i);break;case`flowChartProcess`:this.drawFlowChartProcessPath(u,t,n,r,i);break;case`flowChartDecision`:this.drawFlowChartDecisionPath(u,t,n,r,i);break;case`flowChartInputOutput`:this.drawFlowChartInputOutputPath(u,t,n,r,i);break;case`flowChartPredefinedProcess`:this.drawFlowChartPredefinedProcessPath(u,t,n,r,i);break;case`flowChartInternalStorage`:this.drawFlowChartInternalStoragePath(u,t,n,r,i);break;case`flowChartDocument`:this.drawFlowChartDocumentPath(u,t,n,r,i);break;case`flowChartMultidocument`:this.drawFlowChartMultidocumentPath(u,t,n,r,i);break;case`flowChartTerminator`:this.drawRoundRectPath(u,t,n,r,i,Math.min(r,i)*.2);break;case`flowChartPreparation`:this.drawFlowChartPreparationPath(u,t,n,r,i);break;case`flowChartManualInput`:this.drawFlowChartManualInputPath(u,t,n,r,i);break;case`flowChartManualOperation`:this.drawFlowChartManualOperationPath(u,t,n,r,i);break;case`flowChartConnector`:u.ellipse(t+r/2,n+i/2,r/2,i/2,0,0,2*Math.PI);break;case`flowChartOffpageConnector`:this.drawFlowChartOffpageConnectorPath(u,t,n,r,i);break;case`flowChartPunchedCard`:this.drawFlowChartPunchedCardPath(u,t,n,r,i);break;case`flowChartPunchedTape`:this.drawFlowChartPunchedTapePath(u,t,n,r,i);break;case`flowChartSummingJunction`:this.drawFlowChartSummingJunctionPath(u,t,n,r,i);break;case`flowChartOr`:this.drawFlowChartOrPath(u,t,n,r,i);break;case`flowChartCollate`:this.drawFlowChartCollatePath(u,t,n,r,i);break;case`flowChartSort`:this.drawFlowChartSortPath(u,t,n,r,i);break;case`flowChartExtract`:this.drawFlowChartExtractPath(u,t,n,r,i);break;case`flowChartMerge`:this.drawFlowChartMergePath(u,t,n,r,i);break;case`flowChartStoredData`:this.drawFlowChartStoredDataPath(u,t,n,r,i);break;case`flowChartDelay`:this.drawFlowChartDelayPath(u,t,n,r,i);break;case`flowChartMagneticTape`:this.drawFlowChartMagneticTapePath(u,t,n,r,i);break;case`flowChartMagneticDisk`:this.drawFlowChartMagneticDiskPath(u,t,n,r,i);break;case`flowChartMagneticDrum`:this.drawFlowChartMagneticDrumPath(u,t,n,r,i);break;case`flowChartDisplay`:this.drawFlowChartDisplayPath(u,t,n,r,i);break;case`rightArrow`:this.drawRightArrowPath(u,t,n,r,i);break;case`leftArrow`:this.drawLeftArrowPath(u,t,n,r,i);break;case`upArrow`:this.drawUpArrowPath(u,t,n,r,i);break;case`downArrow`:this.drawDownArrowPath(u,t,n,r,i);break;case`leftRightArrow`:this.drawLeftRightArrowPath(u,t,n,r,i);break;case`upDownArrow`:this.drawUpDownArrowPath(u,t,n,r,i);break;case`quadArrow`:this.drawQuadArrowPath(u,t,n,r,i);break;case`bentArrow`:this.drawBentArrowPath(u,t,n,r,i);break;case`uturnArrow`:this.drawUturnArrowPath(u,t,n,r,i);break;case`curvedRightArrow`:this.drawCurvedRightArrowPath(u,t,n,r,i);break;case`curvedLeftArrow`:this.drawCurvedLeftArrowPath(u,t,n,r,i);break;case`callout1`:this.drawCallout1Path(u,t,n,r,i);break;case`callout2`:this.drawCallout2Path(u,t,n,r,i);break;case`callout3`:this.drawCallout3Path(u,t,n,r,i);break;case`accentCallout1`:this.drawAccentCallout1Path(u,t,n,r,i);break;case`accentCallout2`:this.drawAccentCallout2Path(u,t,n,r,i);break;case`accentCallout3`:this.drawAccentCallout3Path(u,t,n,r,i);break;case`borderCallout1`:this.drawBorderCallout1Path(u,t,n,r,i);break;case`borderCallout2`:this.drawBorderCallout2Path(u,t,n,r,i);break;case`borderCallout3`:this.drawBorderCallout3Path(u,t,n,r,i);break;case`accentBorderCallout1`:this.drawAccentCallout1Path(u,t,n,r,i);break;case`accentBorderCallout2`:this.drawAccentCallout2Path(u,t,n,r,i);break;case`accentBorderCallout3`:this.drawAccentCallout3Path(u,t,n,r,i);break;case`lightningBolt`:this.drawLightningBoltPath(u,t,n,r,i);break;case`sun`:this.drawSunPath(u,t,n,r,i);break;case`moon`:this.drawMoonPath(u,t,n,r,i);break;case`cloud`:this.drawCloudPath(u,t,n,r,i);break;case`wave`:this.drawWavePath(u,t,n,r,i);break;case`doubleWave`:this.drawDoubleWavePath(u,t,n,r,i);break;case`smileyFace`:this.drawSmileyFacePath(u,t,n,r,i);break;case`noSmoking`:this.drawNoSmokingPath(u,t,n,r,i);break;case`blockArc`:this.drawBlockArcPath(u,t,n,r,i);break;case`foldedCorner`:this.drawFoldedCornerPath(u,t,n,r,i);break;case`bevel`:this.drawBevelPath(u,t,n,r,i);break;case`donut`:this.drawDonutPath(u,t,n,r,i);break;case`noSymbol`:this.drawNoSymbolPath(u,t,n,r,i);break;case`cube`:this.drawCubePath(u,t,n,r,i);break;case`can`:this.drawCanPath(u,t,n,r,i);break;case`cone`:this.drawConePath(u,t,n,r,i);break;case`pyramid`:this.drawPyramidPath(u,t,n,r,i);break;case`plus`:this.drawPlusPath(u,t,n,r,i);break;case`minus`:this.drawMinusPath(u,t,n,r,i);break;case`multiply`:this.drawMultiplyPath(u,t,n,r,i);break;case`divide`:this.drawDividePath(u,t,n,r,i);break;case`equal`:this.drawEqualPath(u,t,n,r,i);break;case`notEqual`:this.drawNotEqualPath(u,t,n,r,i);break;case`line`:this.drawLinePath(u,t,n,r,i);break;case`straightConnector1`:this.drawLinePath(u,t,n,r,i);break;case`bentConnector2`:this.drawBentConnector2Path(u,t,n,r,i);break;case`bentConnector3`:this.drawBentConnector3Path(u,t,n,r,i);break;case`bentConnector4`:this.drawBentConnector4Path(u,t,n,r,i);break;case`bentConnector5`:this.drawBentConnector5Path(u,t,n,r,i);break;case`curvedConnector2`:this.drawCurvedConnector2Path(u,t,n,r,i);break;case`curvedConnector3`:this.drawCurvedConnector3Path(u,t,n,r,i);break;case`curvedConnector4`:this.drawCurvedConnector4Path(u,t,n,r,i);break;case`curvedConnector5`:this.drawCurvedConnector5Path(u,t,n,r,i);break;case`rtTriangle`:u.moveTo(t,n+i),u.lineTo(t+r,n+i),u.lineTo(t,n),u.closePath();break;case`arc`:{let e=(l.adj1===void 0?0:l.adj1)/6e4,a=(l.adj2===void 0?216e5:l.adj2)/6e4,o=e*Math.PI/180,s=a*Math.PI/180,c=t+r/2,d=n+i/2,f=r/2,p=i/2;u.moveTo(c,d),u.ellipse(c,d,f,p,0,o,s),u.closePath();break}case`pie`:case`pieWedge`:{let e=t+r/2,a=n+i/2;u.moveTo(e,a),u.arc(e,a,Math.min(r,i)/2,-Math.PI/2,0),u.closePath();break}case`chord`:u.arc(t+r/2,n+i/2,Math.min(r,i)/2,0,Math.PI*1.5,!0),u.closePath();break;case`frame`:{let e=Math.min(r,i)*.15;u.rect(t,n,r,i),u.moveTo(t+e,n+e),u.rect(t+e,n+e,r-2*e,i-2*e);break}case`parallelogram`:{let e=r*.25;u.moveTo(t+e,n),u.lineTo(t+r,n),u.lineTo(t+r-e,n+i),u.lineTo(t,n+i),u.closePath();break}case`trapezoid`:{let e=r*.2;u.moveTo(t+e,n),u.lineTo(t+r-e,n),u.lineTo(t+r,n+i),u.lineTo(t,n+i),u.closePath();break}case`cross`:this.drawPlusPath(u,t,n,r,i);break;case`chevron`:{let e=r*.25;u.moveTo(t,n),u.lineTo(t+r-e,n),u.lineTo(t+r,n+i/2),u.lineTo(t+r-e,n+i),u.lineTo(t,n+i),u.lineTo(t+e,n+i/2),u.closePath();break}case`homePlate`:{let e=r*.2;u.moveTo(t,n),u.lineTo(t+r-e,n),u.lineTo(t+r,n+i/2),u.lineTo(t+r-e,n+i),u.lineTo(t,n+i),u.closePath();break}case`notchedRightArrow`:this.drawRightArrowPath(u,t,n,r,i);break;case`stripedRightArrow`:this.drawRightArrowPath(u,t,n,r,i);break;case`leftBracket`:{let e=i*.15;u.moveTo(t+r*.4,n),u.quadraticCurveTo(t,n,t,n+e),u.lineTo(t,n+i-e),u.quadraticCurveTo(t,n+i,t+r*.4,n+i);break}case`rightBracket`:{let e=i*.15;u.moveTo(t+r*.6,n),u.quadraticCurveTo(t+r,n,t+r,n+e),u.lineTo(t+r,n+i-e),u.quadraticCurveTo(t+r,n+i,t+r*.6,n+i);break}case`leftBrace`:{let e=n+i/2,a=r*.4;u.moveTo(t+r,n),u.quadraticCurveTo(t+a,n,t+a,e-i*.1),u.quadraticCurveTo(t+a,e,t,e),u.quadraticCurveTo(t+a,e,t+a,e+i*.1),u.quadraticCurveTo(t+a,n+i,t+r,n+i);break}case`rightBrace`:{let e=n+i/2,a=r*.6;u.moveTo(t,n),u.quadraticCurveTo(t+a,n,t+a,e-i*.1),u.quadraticCurveTo(t+a,e,t+r,e),u.quadraticCurveTo(t+a,e,t+a,e+i*.1),u.quadraticCurveTo(t+a,n+i,t,n+i);break}case`bracketPair`:{let e=Math.min(r,i)*.15;u.moveTo(t+e,n),u.arc(t+e,n+e,e,-Math.PI/2,Math.PI,!0),u.lineTo(t,n+i-e),u.arc(t+e,n+i-e,e,Math.PI,Math.PI/2,!0),u.moveTo(t+r-e,n),u.arc(t+r-e,n+e,e,-Math.PI/2,0),u.lineTo(t+r,n+i-e),u.arc(t+r-e,n+i-e,e,0,Math.PI/2);break}case`bracePair`:{let e=Math.min(r,i)*.15;u.moveTo(t+e,n),u.arc(t+e,n+e,e,-Math.PI/2,Math.PI,!0),u.lineTo(t,n+i-e),u.arc(t+e,n+i-e,e,Math.PI,Math.PI/2,!0),u.moveTo(t+r-e,n),u.arc(t+r-e,n+e,e,-Math.PI/2,0),u.lineTo(t+r,n+i-e),u.arc(t+r-e,n+i-e,e,0,Math.PI/2);break}case`diagStripe`:u.moveTo(t,n),u.lineTo(t+r,n),u.lineTo(t,n+i),u.closePath();break;case`corner`:{let e=r*.4,a=i*.4;u.moveTo(t,n),u.lineTo(t+e,n),u.lineTo(t+e,n+i-a),u.lineTo(t+r,n+i-a),u.lineTo(t+r,n+i),u.lineTo(t,n+i),u.closePath();break}case`halfFrame`:{let e=r*.2,a=i*.2;u.moveTo(t,n),u.lineTo(t+r,n),u.lineTo(t+r-e,n+a),u.lineTo(t+e,n+a),u.lineTo(t+e,n+i),u.lineTo(t,n+i),u.closePath();break}case`snip1Rect`:case`snip2SameRect`:case`snip2DiagRect`:case`snipRoundRect`:{let e=Math.min(r,i)*.15;u.moveTo(t+e,n),u.lineTo(t+r-e,n),u.lineTo(t+r,n+e),u.lineTo(t+r,n+i),u.lineTo(t,n+i),u.lineTo(t,n+e),u.closePath();break}case`round1Rect`:case`round2SameRect`:case`round2DiagRect`:this.drawRoundRectPath(u,t,n,r,i,Math.min(r,i)*.15);break;case`ribbon`:case`ribbon2`:u.moveTo(t,n+i*.3),u.lineTo(t+r*.15,n+i*.15),u.lineTo(t+r*.15,n),u.lineTo(t+r*.85,n),u.lineTo(t+r*.85,n+i*.15),u.lineTo(t+r,n+i*.3),u.lineTo(t+r*.85,n+i*.45),u.lineTo(t+r*.85,n+i),u.lineTo(t+r*.15,n+i),u.lineTo(t+r*.15,n+i*.45),u.closePath();break;case`mathPlus`:this.drawPlusPath(u,t,n,r,i);break;case`mathMinus`:this.drawMinusPath(u,t,n,r,i);break;case`mathMultiply`:this.drawMultiplyPath(u,t,n,r,i);break;case`mathDivide`:this.drawDividePath(u,t,n,r,i);break;case`mathEqual`:this.drawEqualPath(u,t,n,r,i);break;case`mathNotEqual`:this.drawNotEqualPath(u,t,n,r,i);break;case`circularArrow`:u.arc(t+r/2,n+i/2,Math.min(r,i)/2,0,Math.PI*1.5,!0);break;default:u.rect(t,n,r,i);break}if(a&&u.fill(),o){if(u.globalAlpha=1,c&&c.dashArray&&c.dashArray.length>0){let e=CoordinateTransform.mmToPixels(s||1),t=c.dashArray.map(t=>t*e);u.setLineDash(t)}u.stroke()}u.restore()}drawTeardropPath(e,t,n,r,i){let a=r/1001,o=i/992,s=e=>t+e*a,c=e=>n+e*o;e.moveTo(s(711),c(7)),e.bezierCurveTo(s(475),c(8),s(442),c(8),s(423),c(12)),e.bezierCurveTo(s(312),c(31),s(221),c(77),s(144),c(154)),e.bezierCurveTo(s(53),c(247),s(4),c(363),s(4),c(492)),e.bezierCurveTo(s(4),c(565),s(16),c(625),s(46),c(689)),e.bezierCurveTo(s(82),c(769),s(143),c(842),s(219),c(894)),e.bezierCurveTo(s(258),c(921),s(307),c(945),s(359),c(961)),e.bezierCurveTo(s(418),c(980),s(509),c(987),s(577),c(977)),e.bezierCurveTo(s(720),c(956),s(845),c(878),s(922),c(758)),e.bezierCurveTo(s(953),c(710),s(977),c(654),s(988),c(603)),e.bezierCurveTo(s(1001),c(544),s(1001),c(546),s(1001),c(265)),e.lineTo(s(1001),c(7)),e.lineTo(s(989),c(6)),e.bezierCurveTo(s(983),c(6),s(857),c(6),s(711),c(7)),e.closePath()}drawRoundRectPath(e,t,n,r,i,a){e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}drawTrianglePath(e,t,n,r,i){e.moveTo(t+r/2,n),e.lineTo(t+r,n+i),e.lineTo(t,n+i),e.closePath()}drawDiamondPath(e,t,n,r,i){e.moveTo(t+r/2,n),e.lineTo(t+r,n+i/2),e.lineTo(t+r/2,n+i),e.lineTo(t,n+i/2),e.closePath()}drawPentagonPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2;for(let t=0;t<5;t++){let n=t*2*Math.PI/5-Math.PI/2,r=a+s*Math.cos(n),i=o+s*Math.sin(n);t===0?e.moveTo(r,i):e.lineTo(r,i)}e.closePath()}drawHexagonPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2;for(let t=0;t<6;t++){let n=t*2*Math.PI/6,r=a+s*Math.cos(n),i=o+s*Math.sin(n);t===0?e.moveTo(r,i):e.lineTo(r,i)}e.closePath()}drawStarPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2,c=s*.4;for(let t=0;t<10;t++){let n=t*Math.PI/5-Math.PI/2,r=t%2==0?s:c,i=a+r*Math.cos(n),l=o+r*Math.sin(n);t===0?e.moveTo(i,l):e.lineTo(i,l)}e.closePath()}drawHeartPath(e,t,n,r,i){let a=r/20,o=i/18.35,s=e=>t+(e-2)*a,c=e=>n+(e-3)*o;e.moveTo(s(12),c(21.35)),e.lineTo(s(10.55),c(20.03)),e.bezierCurveTo(s(5.4),c(15.36),s(2),c(12.28),s(2),c(8.5)),e.bezierCurveTo(s(2),c(5.42),s(4.42),c(3),s(7.5),c(3)),e.bezierCurveTo(s(9.24),c(3),s(10.91),c(3.81),s(12),c(5.09)),e.bezierCurveTo(s(13.09),c(3.81),s(14.76),c(3),s(16.5),c(3)),e.bezierCurveTo(s(19.58),c(3),s(22),c(5.42),s(22),c(8.5)),e.bezierCurveTo(s(22),c(12.28),s(18.6),c(15.36),s(13.45),c(20.04)),e.lineTo(s(12),c(21.35)),e.closePath()}drawOctagonPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2;for(let t=0;t<8;t++){let n=t*2*Math.PI/8,r=a+s*Math.cos(n),i=o+s*Math.sin(n);t===0?e.moveTo(r,i):e.lineTo(r,i)}e.closePath()}drawStar4Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,4)}drawStar6Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,6)}drawStar8Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,8)}drawStar10Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,10)}drawStar12Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,12)}drawStar16Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,16)}drawStar24Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,24)}drawStar32Path(e,t,n,r,i){this.drawStarGeneric(e,t,n,r,i,32)}drawStarGeneric(e,t,n,r,i,a){let o=t+r/2,s=n+i/2,c=Math.min(r,i)/2,l=c*.4;for(let t=0;t{i.commands&&i.commands.forEach(i=>{i.x!==void 0&&(e=Math.min(e,i.x),t=Math.max(t,i.x)),i.y!==void 0&&(n=Math.min(n,i.y),r=Math.max(r,i.y)),i.x1!==void 0&&(e=Math.min(e,i.x1),t=Math.max(t,i.x1),n=Math.min(n,i.y1),r=Math.max(r,i.y1)),i.x2!==void 0&&(e=Math.min(e,i.x2),t=Math.max(t,i.x2),n=Math.min(n,i.y2),r=Math.max(r,i.y2))})}),u=t-e,d=r-n,u===0&&(u=100),d===0&&(d=100)}l.restore(),c.forEach((e,c)=>{let l=1/0,f=1/0;e.commands.forEach(e=>{e.x!==void 0&&(l=Math.min(l,e.x),f=Math.min(f,e.y)),e.x1!==void 0&&(l=Math.min(l,e.x1),f=Math.min(f,e.y1)),e.x2!==void 0&&(l=Math.min(l,e.x2),f=Math.min(f,e.y2)),e.x3!==void 0&&(l=Math.min(l,e.x3),f=Math.min(f,e.y3))}),this.currentShapeBounds={x:t,y:n,w:r,h:i},this.drawGeometryPathDirectly(e,a,o,s,t,n,r,i,u,d,l,f)})}catch{this.context.restore()}}drawGeometryPath(e,t,n,r){if(!e||!e.commands||e.commands.length===0)return;let i=this.context;i.beginPath(),e.commands.forEach((e,t)=>{switch(e.type){case`moveTo`:i.moveTo(e.x,e.y);break;case`lineTo`:i.lineTo(e.x,e.y);break;case`curveTo`:case`cubicBezTo`:let t=e.x===void 0?e.x3:e.x,n=e.y===void 0?e.y3:e.y;t!==void 0&&n!==void 0&&i.bezierCurveTo(e.x1,e.y1,e.x2,e.y2,t,n);break;case`quadTo`:case`quadBezTo`:i.quadraticCurveTo(e.x1,e.y1,e.x,e.y);break;case`arcTo`:i.arcTo(e.x1,e.y1,e.x,e.y,e.radius||0);break;case`close`:i.closePath();break;default:}}),n&&r>0&&(this.setStrokeStyle(n,r),i.stroke()),t&&(!n||r===0)&&(this.setFillStyle(t),i.fill()),i.restore()}setStrokeStyle(e,t){let n=this.context;n.strokeStyle=e,n.lineWidth=CoordinateTransform.mmToPixels(t||1),n.lineCap=`round`,n.lineJoin=`round`}setFillStyle(e){let t=this.context;t.fillStyle=e}drawGeometryPathDirectly(e,t,n,r,i,a,o,s,c,l,u,d){if(!e||!e.commands||e.commands.length===0)return;let f=this.context,p=o/c,m=s/l;f.save(),f.beginPath();let h=e=>i+(e-u)*p,g=e=>a+(e-d)*m,_=!1,v=0,y=0;if(e.commands.forEach((e,t)=>{switch(e.type){case`moveTo`:let t=h(e.x),n=g(e.y);f.moveTo(t,n),v=t,y=n;break;case`lineTo`:let r=h(e.x),i=g(e.y);f.lineTo(r,i),v=r,y=i,_=!0;break;case`curveTo`:case`cubicBezTo`:let a=e.x3===void 0?e.x:e.x3,o=e.y3===void 0?e.y:e.y3;if(a!==void 0&&o!==void 0){let t=h(e.x1),n=g(e.y1),r=h(e.x2),i=g(e.y2),s=h(a),c=g(o);this.isStraightLine(v,y,t,n,r,i,s,c)?f.lineTo(s,c):f.bezierCurveTo(t,n,r,i,s,c),v=s,y=c,_=!0}break;case`quadTo`:case`quadBezTo`:{let t=h(e.x1),n=g(e.y1),r=h(e.x),i=g(e.y);f.quadraticCurveTo(t,n,r,i),v=r,y=i,_=!0;break}case`close`:f.closePath();break}}),e.commands.some(e=>e.type===`close`)&&t&&t!==`none`)if(_){if(typeof t==`object`&&t.r!==void 0)f.fillStyle=`rgba(${t.r}, ${t.g}, ${t.b}, ${t.a/255})`;else if(typeof t==`object`&&t.type)if(t.type===`linear`&&t.stops){let e=this.getCanvasBounds(f),n=this.createCanvasGradient(f,e,t);if(n)f.fillStyle=n;else{let e=t.stops[0]?.color;if(e)f.fillStyle=this.colorToRgb(e);else return}}else return;else typeof t==`string`&&t!==`none`&&t!==`null`&&(f.fillStyle=t);f.fill()}else typeof t==`object`&&t.r!==void 0?f.fillStyle=`rgba(${t.r}, ${t.g}, ${t.b}, ${t.a/255})`:typeof t==`string`&&t!==`none`&&t!==`null`&&(f.fillStyle=t),f.fillRect(i,a,o,s);if(n&&n!==`none`&&_){let e=CoordinateTransform.mmToPixels(r>0?r:1),t=o*s,i=Math.sqrt(t/921600),a=Math.max(e*i,.5);typeof n==`object`&&n.r!==void 0?f.strokeStyle=`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a/255})`:f.strokeStyle=n,f.lineWidth=a,f.lineCap=`square`,f.lineJoin=`miter`,f.stroke()}f.restore()}isStraightLine(e,t,n,r,i,a,o,s){let c=o-e,l=s-t;if(Math.abs(c)<.1&&Math.abs(l)<.1)return!0;let u=e+c*.33,d=t+l*.33,f=e+c*.67,p=t+l*.67,m=Math.sqrt((n-u)**2+(r-d)**2),h=Math.sqrt((i-f)**2+(a-p)**2);return m<2&&h<2}_s(){this._context.beginPath()}_m(e,t){this._context.moveTo(e,t)}_l(e,t){this._context.lineTo(e,t)}_c(e,t,n,r,i,a){this._context.bezierCurveTo(e,t,n,r,i,a)}_z(){this._context.closePath()}ds(){this._context.stroke()}df(){this._context.fill()}fillText(e,t,n,r={}){if(!(!this._context||!e)){this._context.save();try{let i=(r.fontSize||12)*this.getTextScaleFactor(),a=r.fontFamily||`Arial`,o=r.fontWeight||(r.bold?`bold`:`normal`),s=r.fontStyle||(r.italic?`italic`:`normal`);if(this._context.font=`${s} ${o} ${i}px "${a}"`,r.color)if(typeof r.color==`object`&&r.color.r!==void 0){let e=r.color.a===void 0?1:r.color.a/255,t=`rgba(${r.color.r}, ${r.color.g}, ${r.color.b}, ${e})`;this._context.fillStyle=t}else typeof r.color==`string`?this._context.fillStyle=r.color:this._context.fillStyle=`#000000`;else this._context.fillStyle=`#000000`;this._context.textBaseline=r.textBaseline||`alphabetic`,this._context.textAlign=r.textAlign||`left`,this._context.fillText(e,t,n)}catch{}finally{this._context.restore()}}}measureText(e,t={}){if(!this._context||!e)return{width:0,height:0};this._context.save();try{let n=(t.fontSize||12)*this.getTextScaleFactor(),r=t.fontFamily||`Arial`,i=t.fontWeight||(t.bold?`bold`:`normal`),a=t.fontStyle||(t.italic?`italic`:`normal`);this._context.font=`${a} ${i} ${n}px "${r}"`;let o=this._context.measureText(e),s=n;return o.actualBoundingBoxAscent!==void 0&&o.actualBoundingBoxDescent!==void 0&&(s=o.actualBoundingBoxAscent+o.actualBoundingBoxDescent),{width:o.width,height:s}}catch{return{width:0,height:0}}finally{this._context.restore()}}getCanvasBounds(e){e.getTransform();let t,n;return e.canvas.style.width&&e.canvas.style.height?(t=parseFloat(e.canvas.style.width),n=parseFloat(e.canvas.style.height)):(t=e.canvas.width/(window.devicePixelRatio||1),n=e.canvas.height/(window.devicePixelRatio||1)),this.currentShapeBounds||{x:0,y:0,w:t,h:n}}createCanvasGradient(e,t,n){if(!n||!n.stops||n.stops.length===0)return null;let r;if(n.type===`linear`){let i=(n.angle||0)*Math.PI/180,a=t.x+t.w/2-Math.cos(i)*t.w/2,o=t.y+t.h/2-Math.sin(i)*t.h/2,s=t.x+t.w/2+Math.cos(i)*t.w/2,c=t.y+t.h/2+Math.sin(i)*t.h/2;r=e.createLinearGradient(a,o,s,c)}else if(n.type===`radial`){let n=t.x+t.w/2,i=t.y+t.h/2,a=Math.max(t.w,t.h)/2;r=e.createRadialGradient(n,i,0,n,i,a)}else return null;for(let e of n.stops){let t=this.colorToRgb(e.color);r.addColorStop(e.position,t)}return r}colorToRgb(e){if(this.graphics&&typeof this.graphics.colorToRgb==`function`)return this.graphics.colorToRgb(e);if(this.graphicsEngine&&typeof this.graphicsEngine.colorToRgb==`function`)return this.graphicsEngine.colorToRgb(e);if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e.r===void 0?e.R===void 0?0:e.R:e.r,n=e.g===void 0?e.G===void 0?0:e.G:e.g,r=e.b===void 0?e.B===void 0?0:e.B:e.b,i=e.a===void 0?e.A===void 0?255:e.A:e.a;return i!==void 0&&i!==255?`rgba(${t}, ${n}, ${r}, ${i/255})`:`rgb(${t}, ${n}, ${r})`}return`rgb(0, 0, 0)`}}class r{constructor(){this.graphics=null,this.canvas=null,this.processor=null,this.logger=new Logger(`CDrawingDocument`),this.currentLayer=null}init(e,t=null){if(this.canvas=e,this.processor=t,this.graphics)this.graphics.resetState();else{this.graphics=new n;try{let t=typeof globalThis<`u`&&globalThis.CGraphics?globalThis.CGraphics:typeof window<`u`&&window.CGraphics?window.CGraphics:null;typeof t==`function`&&(this.graphicsEngine=new t(e),this.graphics.drawLineWithArrows=(e,t,n,r,i,a=1,o=null)=>{this.graphicsEngine.drawLineWithArrows(e,t,n,r,i,a,o)},this.graphics.applyStrokeInfo=e=>{typeof this.graphicsEngine.applyStrokeInfo==`function`&&this.graphicsEngine.applyStrokeInfo(e)})}catch{}}let r,i,a=typeof e.getBoundingClientRect==`function`?e.getBoundingClientRect():{width:0,height:0},o=parseFloat(e.style.width),s=parseFloat(e.style.height);if(o>0&&s>0)r=o,i=s;else if(a.width>0&&a.height>0)r=a.width,i=a.height;else if(e.style.width&&e.style.height)r=o,i=s;else{let t=typeof window<`u`&&window.devicePixelRatio?window.devicePixelRatio:1;r=e.width/t,i=e.height/t}let c=this.processor&&this.processor.renderContext&&this.processor.renderContext.pixelRatio||typeof window<`u`&&window.devicePixelRatio||1,l=Math.max(1,Math.round(r*c)),u=Math.max(1,Math.round(i*c));(e.width!==l||e.height!==u)&&(e.width=l,e.height=u),e.style.width||(e.style.width=`${r}px`),e.style.height||(e.style.height=`${i}px`);let d=e.getContext(`2d`);d&&(d.setTransform(1,0,0,1,0,0),d.scale(c,c)),this.graphics&&typeof this.graphics.init==`function`&&d&&this.graphics.init(d,r,i,r*25.4/96,i*25.4/96)}colorToRgb(e){if(this.graphics&&typeof this.graphics.colorToRgb==`function`)return this.graphics.colorToRgb(e);if(this.graphicsEngine&&typeof this.graphicsEngine.colorToRgb==`function`)return this.graphicsEngine.colorToRgb(e);if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e.r===void 0?e.R===void 0?0:e.R:e.r,n=e.g===void 0?e.G===void 0?0:e.G:e.g,r=e.b===void 0?e.B===void 0?0:e.B:e.b,i=e.a===void 0?e.A===void 0?255:e.A:e.a;return i!==void 0&&i!==255?`rgba(${t}, ${n}, ${r}, ${i/255})`:`rgb(${t}, ${n}, ${r})`}return`rgb(0, 0, 0)`}async drawSlide(e,t){this.graphics&&(this.currentSlide=e,this.currentSlideIndex=t,this.graphics.clear(),await this.drawSlideContent(e))}async drawSlideContent(e){e.layout,this.setupSlideCoordinateSystem();try{let e=this.graphics?.context,t=this.coordinateSystem;if(e&&t){let n=Math.round(t.offsetX),r=Math.round(t.offsetY),i=Math.round(t.scaledWidth),a=Math.round(t.scaledHeight);e.save(),e.beginPath(),e.rect(n,r,i,a),e.clip(),this._slideClipApplied=!0}}catch{this._slideClipApplied=!1}if(this.drawSlideBackground(e),e.showMasterShapes!==!1&&e.layout&&e.layout.master&&await this.drawMasterElements(e.layout.master),e.layout&&await this.drawLayoutElements(e.layout),e.commonSlideData&&e.commonSlideData.shapeTree){let t=e.commonSlideData.shapeTree,n=this.sortShapesByRenderOrder(t),r=this.currentLayer;this.currentLayer=`slide`;for(let e=0;e{let r=t.order||t.zOrder||t.index||0,i=n.order||n.zOrder||n.index||0;return r===i?e.indexOf(t)-e.indexOf(n):r-i}),t}drawSlideBackground(e){if(!this.graphics||!this.graphics.context)return;let t=this.graphics.context,n=null;if(e.backgroundFill)n=this.getBackgroundColor(e.backgroundFill);else if(e.layout&&e.layout.commonSlideData&&e.layout.commonSlideData.backgroundFill)n=this.getBackgroundColor(e.layout.commonSlideData.backgroundFill);else if(e.layout&&e.layout.cSld&&e.layout.cSld.bg)n=this.getBackgroundColor(e.layout.cSld.bg);else if(e.layout&&e.layout.master&&e.layout.master.commonSlideData&&e.layout.master.commonSlideData.backgroundFill)n=this.getBackgroundColor(e.layout.master.commonSlideData.backgroundFill);else if(e.layout&&e.layout.master&&e.layout.master.theme){let t=e.layout.master.theme;t.colors&&t.colors.bg1?n=t.colors.bg1:t.colors&&t.colors.bg2&&(n=t.colors.bg2)}if(this.coordinateSystem){let{scale:e,offsetX:r,offsetY:i}=this.coordinateSystem,a=this.coordinateSystem.slideWidthPx,o=this.coordinateSystem.slideHeightPx,s=Math.round(a*e),c=Math.round(o*e),l=Math.round(r),u=Math.round(i);if(t.save(),n&&n.type===`image`&&n.imageData?.relationshipId){let e=n.imageData.resolvedCacheKey||n.imageData.relationshipId,r=this.processor?.imageCache?.get(e);if(r&&r.image){t.drawImage(r.image,l,u,s,c),t.restore();return}t.fillStyle=`#ffffff`}else if(n&&n.type===`gradient`&&n.gradient){let e=n.gradient,r=e.stops||[],i;if(e.type===`radial`){let e=l+s/2,n=u+c/2,r=Math.max(s,c)/2;i=t.createRadialGradient(e,n,0,e,n,r)}else{let n=(e.angle||0)*Math.PI/180,r=Math.cos(n),a=Math.sin(n),o=l+s/2-r*s/2,d=u+c/2-a*c/2,f=l+s/2+r*s/2,p=u+c/2+a*c/2;i=t.createLinearGradient(o,d,f,p)}for(let e of r){let t=e.position===void 0?0:e.position/1e5,n=this.parseColorToHex(e.color)||`#ffffff`;i.addColorStop(Math.min(1,Math.max(0,t)),n)}t.fillStyle=i}else t.fillStyle=(typeof n==`string`?n:null)||`#ffffff`;t.fillRect(l,u,s,c),t.restore()}else{if(t.save(),n&&n.type===`image`&&n.imageData?.relationshipId){let e=n.imageData.resolvedCacheKey||n.imageData.relationshipId,r=this.processor?.imageCache?.get(e);if(r&&r.image){t.drawImage(r.image,0,0,this.canvas.width,this.canvas.height),t.restore();return}t.fillStyle=`#ffffff`}else if(n&&n.type===`gradient`&&n.gradient){let e=n.gradient,r=e.stops||[],i=this.canvas.width,a=this.canvas.height,o;if(e.type===`radial`)o=t.createRadialGradient(i/2,a/2,0,i/2,a/2,Math.max(i,a)/2);else{let n=(e.angle||0)*Math.PI/180,r=Math.cos(n),s=Math.sin(n);o=t.createLinearGradient(i/2-r*i/2,a/2-s*a/2,i/2+r*i/2,a/2+s*a/2)}for(let e of r){let t=e.position===void 0?0:e.position/1e5,n=this.parseColorToHex(e.color)||`#ffffff`;o.addColorStop(Math.min(1,Math.max(0,t)),n)}t.fillStyle=o}else t.fillStyle=(typeof n==`string`?n:null)||`#ffffff`;t.fillRect(0,0,this.canvas.width,this.canvas.height),t.restore()}}async drawMasterElements(e){if(!e||!e.commonSlideData||!e.commonSlideData.shapeTree)return;let t=e.commonSlideData.shapeTree,n=this.sortShapesByRenderOrder(t),r=this.currentLayer;this.currentLayer=`master`;try{for(let e=0;e{});let n=this.sortShapesByRenderOrder(t),r=this.currentLayer;this.currentLayer=`layout`;try{for(let e=0;ee.runs&&e.runs.some(e=>(e.text||``).trim().length>0||e.fieldType))||e.graphicData&&e.graphicData.tableXml)}processPlaceholderShape(e,t){if(!e.isPlaceholder||!e.placeholder)return e;let n=e.placeholder,r=null,i=null;return t.layout&&t.layout.commonSlideData&&t.layout.commonSlideData.shapeTree&&(i=this.findMatchingPlaceholder(t.layout.commonSlideData.shapeTree,n)),t.layout&&t.layout.master&&t.layout.master.commonSlideData&&t.layout.master.commonSlideData.shapeTree&&(r=this.findMatchingPlaceholder(t.layout.master.commonSlideData.shapeTree,n)),i?this.applyPlaceholderStyling(e,i):r&&this.applyPlaceholderStyling(e,r),e}findMatchingPlaceholder(e,t){for(let n of e)if(n.isPlaceholder&&n.placeholder){let e=n.placeholder;if(e.type===t.type&&e.idx===t.idx||e.type===t.type&&!e.idx)return n}return null}applyPlaceholderStyling(e,t){t.textBody&&(e.textBody||(e.textBody={paragraphs:[]}),t.textBody.bodyProperties&&!e.textBody.bodyProperties&&(e.textBody.bodyProperties=JSON.parse(JSON.stringify(t.textBody.bodyProperties))),t.textBody.lstStyle&&!e.textBody.lstStyle&&(e.textBody.lstStyle=JSON.parse(JSON.stringify(t.textBody.lstStyle)))),t.fill&&!e.fill&&(e.fill=t.fill),t.stroke&&!e.stroke&&(e.stroke=t.stroke),t.geometry&&!e.geometry&&(e.geometry=t.geometry),t.style&&!e.style&&(e.style=t.style)}shouldRenderText(e){try{if(this.currentLayer&&this.currentLayer!==`slide`&&this.isPlaceholderShape(e))return!1;if(this.isPlaceholderShape(e))return!!(e.textBody&&Array.isArray(e.textBody.paragraphs)&&e.textBody.paragraphs.some(e=>Array.isArray(e.runs)&&e.runs.some(e=>(e.text||``).trim().length>0)))}catch{}return!0}getBackgroundColor(e){if(!e)return this.resolveInheritedBackgroundColor()||null;if(e.type===`solid`&&e.color)return this.parseColorToHex(e.color);if(e.fill&&e.fill.type===`solid`&&e.fill.color)return this.parseColorToHex(e.fill.color);if(e.type===`bgPr`&&e.fill){if(e.fill.type===`solid`&&e.fill.color)return this.parseColorToHex(e.fill.color);if(e.fill.type===`gradient`&&e.fill.gradient&&e.fill.gradient.stops&&e.fill.gradient.stops.length>0)return{type:`gradient`,gradient:e.fill.gradient};if(e.fill.type===`image`&&e.fill.imageData?.relationshipId)return{type:`image`,imageData:e.fill.imageData}}if(e.type===`bgRef`){let t=e.idx;if(t!==void 0){if(t>1e3){if(t-1e3,this.currentSlide&&this.currentSlide.theme&&this.currentSlide.theme.colors){let e=this.currentSlide.theme;return this.parseColorToHex(e.colors.bg2)||this.parseColorToHex(e.colors.bg1)||this.parseColorToHex(e.colors.lt1)}}else{let e={0:`bg1`,1:`tx1`,2:`bg2`,3:`tx2`}[t.toString()];if(e&&this.currentSlide&&this.currentSlide.theme&&this.currentSlide.theme.colors)return this.parseColorToHex(this.currentSlide.theme.colors[e])}return null}return null}return null}resolveInheritedBackgroundColor(){try{if(!this.currentSlide)return null;if(this.currentSlide.layout&&this.currentSlide.layout.backgroundFill){let e=this.getBackgroundColorFromFill(this.currentSlide.layout.backgroundFill);if(e)return e}if(this.currentSlide.layout&&this.currentSlide.layout.master&&this.currentSlide.layout.master.backgroundFill){let e=this.getBackgroundColorFromFill(this.currentSlide.layout.master.backgroundFill);if(e)return e}if(this.currentSlide.theme&&this.currentSlide.theme.colors){let e=this.parseColorToHex(this.currentSlide.theme.colors.bg1)||this.parseColorToHex(this.currentSlide.theme.colors.lt1)||this.parseColorToHex(this.currentSlide.theme.colors.bg2);if(e)return e}return null}catch{return null}}getBackgroundColorFromFill(e){if(!e)return null;if(e.type===`solid`&&e.color)return this.parseColorToHex(e.color);if(e.fill&&e.fill.type===`solid`&&e.fill.color||e.type===`bgPr`&&e.fill&&e.fill.type===`solid`&&e.fill.color)return this.parseColorToHex(e.fill.color);if(e.type===`bgRef`){let t=e.idx;if(t!==void 0)return{0:`#ffffff`,1:`#000000`,2:`#f5f5f5`,3:`#404040`,1e3:`#ffffff`}[t.toString()]||null}return null}parseColorToHex(e){if(!e)return`#ffffff`;if(typeof e==`string`)return e.startsWith(`#`)?e:`#${e}`;if(e.scheme){let t={bg1:`#ffffff`,tx1:`#000000`,bg2:`#f8f8f8`,tx2:`#404040`,accent1:`#4f81bd`,accent2:`#c0504d`,accent3:`#9bbb59`,accent4:`#8064a2`,accent5:`#4bacc6`,accent6:`#f79646`,lt1:`#ffffff`,dk1:`#000000`,lt2:`#f0f0f0`,dk2:`#404040`}[e.scheme];if(t)return t=this.applyColorModifications(t,e),t}return e.r!==void 0&&e.g!==void 0&&e.b!==void 0?e.a!==void 0&&e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${(e.a/255).toFixed(4)})`:`#${e.r.toString(16).padStart(2,`0`)}${e.g.toString(16).padStart(2,`0`)}${e.b.toString(16).padStart(2,`0`)}`:`#ffffff`}applyColorModificationsLegacy(e,t){if(!t||!t.tint&&!t.shade&&!t.lumMod&&!t.lumOff)return e;let n=parseInt(e.substr(1,2),16),r=parseInt(e.substr(3,2),16),i=parseInt(e.substr(5,2),16),a=n,o=r,s=i;if(t.tint!==void 0){let e=t.tint/1e5;a=Math.round(n+(255-n)*e),o=Math.round(r+(255-r)*e),s=Math.round(i+(255-i)*e)}if(t.shade!==void 0){let e=t.shade/1e5;a=Math.round(n*(1-e)),o=Math.round(r*(1-e)),s=Math.round(i*(1-e))}if(t.lumMod!==void 0){let e=t.lumMod/1e5;a=Math.round(n*e),o=Math.round(r*e),s=Math.round(i*e)}if(t.lumOff!==void 0){let e=t.lumOff/1e5*255;a=Math.round(Math.min(255,n+e)),o=Math.round(Math.min(255,r+e)),s=Math.round(Math.min(255,i+e))}return a=Math.max(0,Math.min(255,a)),o=Math.max(0,Math.min(255,o)),s=Math.max(0,Math.min(255,s)),`#${a.toString(16).padStart(2,`0`)}${o.toString(16).padStart(2,`0`)}${s.toString(16).padStart(2,`0`)}`}setupSlideCoordinateSystem(){if(this.processor&&this.processor.calculateCanvasRect){let e=this.processor.getSlideDimensions(),t=this.processor.calculateCanvasRect(this.canvas,e);this.coordinateSystem={slideWidthEMU:e.cx,slideHeightEMU:e.cy,slideWidthPx:t.slideWidthPx,slideHeightPx:t.slideHeightPx,scale:t.scale,offsetX:t.offsetX,offsetY:t.offsetY,scaledWidth:t.scaledWidth,scaledHeight:t.scaledHeight}}else{let e=this.processor.getSlideDimensions(),t=e.cx,n=e.cy,r=t/914400*96,i=n/914400*96,a,o,s=typeof this.canvas.getBoundingClientRect==`function`?this.canvas.getBoundingClientRect():{width:0,height:0};if(s.width>0&&s.height>0)a=s.width,o=s.height;else if(this.canvas.style.width&&this.canvas.style.height)a=parseFloat(this.canvas.style.width),o=parseFloat(this.canvas.style.height);else{let e=typeof window<`u`&&window.devicePixelRatio?window.devicePixelRatio:1;a=this.canvas.width/e,o=this.canvas.height/e}let c=a/r,l=o/i,u=Math.min(c,l),d=r*u,f=i*u,p=(a-d)/2,m=(o-f)/2;d=Math.round(d),f=Math.round(f),p=Math.round(p),m=Math.round(m),this.coordinateSystem={slideWidthEMU:t,slideHeightEMU:n,slideWidthPx:r,slideHeightPx:i,scale:u,offsetX:p,offsetY:m,scaledWidth:d,scaledHeight:f,canvasWidth:a,canvasHeight:o}}}async drawShapeEnhanced(e,t){try{this.processor&&typeof this.processor.applyPropertyInheritance==`function`&&this.processor.applyPropertyInheritance(e,this.currentSlide)}catch{}let n=this.getShapeBounds(e);if(n&&(n.h===0||!isFinite(n.h)||n.h<1)&&e&&e.textBody&&e.textBody.paragraphs&&e.textBody.paragraphs.length>0&&!this.isLineLikeShape(e))try{let t=this.estimateTextBoxHeightPx(e,n.w);t&&t>0&&(n.h=Math.ceil(t))}catch{}if(!(!this.graphics||!e))try{let t=this.isLineLikeShape(e);if(!n||n.w<=0&&n.h<=0||!t&&(n.w<=0||n.h<=0))return;switch(e.type){case`sp`:this.drawRegularShape(e,n);break;case`pic`:this.drawPictureShape(e,n);break;case`grpSp`:this.drawGroupShape(e,n);break;case`cxnSp`:this.drawConnectorShape(e,n);break;case`graphicFrame`:await this.drawGraphicFrame(e,n);break;default:this.drawDefaultShape(e,n);break}}catch{}}drawShapeGeometry(e,t){if(!t||t.w<=0||t.h<=0)return;let n=this.getShapeFillColor(e),r=this.getShapeStrokeColor(e),i=this.getShapeLineWidth(e);if(n){let e=this.parseColor(n);this.graphics.b_color1(e.r,e.g,e.b,e.a)}if(r){let e=this.parseColor(r);this.graphics.p_color(e.r,e.g,e.b,e.a),this.graphics.p_width(i)}switch(e.type){case`sp`:case`shape`:this.drawRegularShape(e,t);break;case`pic`:this.drawPictureShape(e,t);break;case`grpSp`:this.drawGroupShape(e,t);break;default:this.drawDefaultShape(e,t);break}}drawRegularShape(e,t){if(!t)return;if(this.isLineLikeShape(e)){if(t.w<=0&&t.h<=0)return}else if(t.w<=0||t.h<=0)return;if(!this.graphics||!this.graphics.context)return;let n=this.graphics.context;n.save();let r=e.properties?.transform;if(r&&r.rotation&&r.rotation!==0){let e=t.x+t.w/2,i=t.y+t.h/2;n.translate(e,i),n.rotate(r.rotation*Math.PI/180),n.translate(-e,-i)}let i=this.getShapeFillColor(e),a=this.getShapeStrokeColor(e),o=this.getShapeLineWidth(e),s=this.getShapeStrokeInfo(e);e.properties&&e.properties.effectLst&&this.applyEffectsToCanvas(n,e.properties.effectLst);let c=null;if(c=this.processor&&this.processor.getShapePresetGeometry?this.processor.getShapePresetGeometry(e,this.processor.currentSlide):this.getShapePreset(e),c===`line`||this.isLineLikeShape(e)){if(this.drawEngineLine(t,e),this.resetEffectsOnContext(n),e.textBody&&e.textBody.paragraphs&&this.shouldRenderText(e)){let n=this.estimateTextBoxHeightPx(e,t.w)||24,r=e.textBody.paragraphs[0],i=r?.properties?.align||r?.properties?.alignment||r?.paragraphProperties?.align||r?.pPr?.algn||`l`,a;a=i===`r`||i===`right`?t.x-t.w:i===`ctr`||i===`center`?t.x-t.w/2:t.x;let o={x:a,y:t.y-n/2,w:t.w,h:n};this.setCurrentRenderingShape(e),this.drawShapeText(e,o)}n.restore();return}let l=r&&(r.flipH||r.flipV);if(l){n.save();let e=t.x+t.w/2,i=t.y+t.h/2;n.translate(e,i),n.scale(r.flipH?-1:1,r.flipV?-1:1),n.translate(-e,-i)}if(e.geometry&&e.geometry.type===`custom`)try{this.currentShapeBounds=t,e.properties&&e.properties.effectLst&&this.applyEffectsToCanvas(n,e.properties.effectLst),this.graphics.drawCustomGeometry(e.geometry,t.x,t.y,t.w,t.h,i,a,o),this.resetEffectsOnContext(n)}catch{this.graphics.drawPresetGeometry(`rect`,t.x,t.y,t.w,t.h,i,a,o,s)}else if(this.graphics.drawPresetGeometry&&c){e.properties&&e.properties.effectLst&&this.applyEffectsToCanvas(n,e.properties.effectLst);let r=e.geometry?.adjustments||e.properties?.geometry?.adjustments||{};this.graphics.drawPresetGeometry(c,t.x,t.y,t.w,t.h,i,a,o,s,r),this.resetEffectsOnContext(n)}else{let e=a&&o>2||a&&!i;a&&e&&(n.strokeStyle=this.graphics.colorToRgb(a),n.lineWidth=CoordinateTransform.mmToPixels(o),s&&this.applyStrokeStyle(n,s,CoordinateTransform.mmToPixels(o)),n.strokeRect(t.x,t.y,t.w,t.h)),e||(i&&i.type===`linear`?this.drawGradientFill(n,t,i):i&&(n.fillStyle=this.graphics.colorToRgb(i),n.fillRect(t.x,t.y,t.w,t.h)),a&&(n.strokeStyle=this.graphics.colorToRgb(a),n.lineWidth=CoordinateTransform.mmToPixels(o),s&&this.applyStrokeStyle(n,s,CoordinateTransform.mmToPixels(o)),n.strokeRect(t.x,t.y,t.w,t.h)))}l&&n.restore(),e.textBody&&e.textBody.paragraphs&&this.shouldRenderText(e)&&(this.setCurrentRenderingShape(e),this.drawShapeText(e,t)),this.resetEffectsOnContext(n),n.restore()}isLineLikeShape(e){let t=e&&(e.geometry?.preset||e.properties?.geometry?.preset||this.getShapePreset(e))||null,n=typeof t==`string`?t.toLowerCase():``;return!!(n===`line`||n.includes(`connector`)||e&&(e.type===`cxnSp`||e.type===`connector`))}drawEngineLine(e,t){let n=this.getShapeStrokeColor(t),r=this.getShapeLineWidth(t)||1,i=this.getShapeStrokeInfo(t),{x1:a,y1:o,x2:s,y2:c}=this._computeConnectorEndpoints(e,t);if(this.graphics&&typeof this.graphics.drawLineWithArrows==`function`){let e=n||{r:0,g:0,b:0,a:255},t=r&&r>0?r:.75;this.graphics.drawLineWithArrows(a,o,s,c,e,t,i)}else if(this.graphicsEngine&&typeof this.graphicsEngine.drawLineWithArrows==`function`){let e=n||{r:0,g:0,b:0,a:255},t=r&&r>0?r:.75;this.graphicsEngine.drawLineWithArrows(a,o,s,c,e,t,i)}else if(this.graphics&&typeof this.graphics.drawLine==`function`){let e=n||{r:0,g:0,b:0,a:255},t=r&&r>0?r:.75;this.graphics.drawLine(a,o,s,c,e,t)}else if(this.graphics&&this.graphics.context){let e=this.graphics.context;if(e.save(),e.beginPath(),e.moveTo(a,o),e.lineTo(s,c),n){e.strokeStyle=this.graphics.colorToRgb(n);let t=this.graphics&&this.graphics.CoordinateTransform?this.graphics.CoordinateTransform.mmToPixels(r):CoordinateTransform.mmToPixels(r);e.lineWidth=Math.max(t,1);try{this.applyStrokeStyle(e,i,e.lineWidth)}catch{}e.stroke()}e.restore()}}_computeConnectorEndpoints(e,t){let n=Math.max(0,e.w),r=Math.max(0,e.h),i=e.x+n/2,a=e.y+r/2,o,s,c,l,u=t&&(t.geometry||t.properties?.geometry)||null,d=u&&(u.pathList||u.pathLst);if(Array.isArray(d)&&d.length>0){let t=d[0],i=t.commands||[],a=null,f=null;for(let e=0;e0){let e=i[0];e.x!=null&&e.y!=null&&(a={x:e.x,y:e.y})}if(!f&&a&&(f={...a}),a&&f){let i=t.w||u.pathW||100,d=t.h||u.pathH||100,p=i===0?1:n/i,m=d===0?1:r/d;o=e.x+a.x*p,s=e.y+a.y*m,c=e.x+f.x*p,l=e.y+f.y*m}}if(o===void 0){o=e.x,s=e.y,c=e.x+n,l=e.y+r;let i=t&&(t.spPr?.xfrm||t.transform);(i&&(i.cy===void 0?i.height:i.cy))===0&&(s=e.y+r/2,l=s)}let f=!!(t&&t.transform&&t.transform.flipH),p=!!(t&&t.transform&&t.transform.flipV);f&&(o=i-(o-i),c=i-(c-i)),p&&(s=a-(s-a),l=a-(l-a));let m=t&&t.transform&&(t.transform.rot||t.transform.rotation)||0;if(m){let e=m*Math.PI/180,t=Math.cos(e),n=Math.sin(e),r=(e,r)=>({x:i+(e-i)*t-(r-a)*n,y:a+(e-i)*n+(r-a)*t}),u=r(o,s),d=r(c,l);o=u.x,s=u.y,c=d.x,l=d.y}return{x1:o,y1:s,x2:c,y2:l}}drawLinePath(e,t,n,r,i){if(this.graphics&&typeof this.graphics.drawLineWithArrows==`function`){let e=this.getShapeStrokeColor(this.getCurrentShape()),a=this.getShapeLineWidth(this.getCurrentShape())||1,o=this.getShapeStrokeInfo(this.getCurrentShape()),s=t,c=n,l=t+r,u=n+i;this.graphics.drawLineWithArrows(s,c,l,u,e,a,o);return}e.moveTo(t,n+i/2),e.lineTo(t+r,n+i/2)}drawLineWithArrows(e,t,n,r,i,a=1,o=null){let s=this._context;if(!s)return;s.save(),s.beginPath(),s.moveTo(e,t),s.lineTo(n,r);let c=this.colorToRgb(i)||`rgba(0,0,0,1)`,l=Math.max(CoordinateTransform.mmToPixels(a||1),1);if(s.strokeStyle=c,s.lineWidth=l,o)try{this.applyStrokeStyle(s,o,l)}catch{}s.stroke();let u=e=>{if(typeof e==`number`)return e;let t=(e||``).toString();return t===`lg`||t===`large`?2:t===`med`||t===`medium`?1.5:1},d=o&&o.tailEnd,f=o&&o.headEnd;if(d||f){let i=Math.atan2(r-t,n-e),a=s.getTransform(),o=Math.sqrt(a.a*a.a+a.b*a.b),p=Math.max(4,10*o),m=Math.max(2.5,6*o),h=Math.max(p,l*8),g=Math.max(m,l*3),_=(e,t,n,r)=>{if(!r)return;let i=h*(r.lengthScale||u(r.len)),a=g*(r.widthScale||u(r.w)),o=(r.type||r.val||`arrow`).toString(),d=a/2;s.save(),s.translate(e,t),s.rotate(n),s.beginPath(),o===`open`?(s.moveTo(0,0),s.lineTo(-i,-d),s.moveTo(0,0),s.lineTo(-i,d),s.strokeStyle=c,s.lineWidth=Math.max(1,l),s.stroke()):o===`stealth`?(s.moveTo(0,0),s.lineTo(-i,-(d*.6)),s.lineTo(-i,d*.6),s.closePath(),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(1,l*.5),s.stroke()):o===`diamond`?(s.moveTo(0,0),s.lineTo(-i/2,-d),s.lineTo(-i,0),s.lineTo(-i/2,d),s.closePath(),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(1,l*.5),s.stroke()):o===`oval`?(s.ellipse(-i/2,0,i/2,d,0,0,Math.PI*2),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(1,l*.5),s.stroke()):(s.moveTo(0,0),s.lineTo(-i,-d),s.lineTo(-i,d),s.closePath(),s.fillStyle=c,s.fill(),s.strokeStyle=c,s.lineWidth=Math.max(1,l*.5),s.stroke()),s.restore()};hasStart&&_(e,t,i+Math.PI,d),hasEnd&&_(n,r,i,f)}s.restore()}drawGradientFill(e,t,n){if(!n||!n.stops||n.stops.length===0)return;let r;if(n.type===`linear`){let i=(n.angle||0)*Math.PI/180,a=t.x+t.w/2-Math.cos(i)*t.w/2,o=t.y+t.h/2-Math.sin(i)*t.h/2,s=t.x+t.w/2+Math.cos(i)*t.w/2,c=t.y+t.h/2+Math.sin(i)*t.h/2;r=e.createLinearGradient(a,o,s,c)}else{let n=t.x+t.w/2,i=t.y+t.h/2,a=Math.max(t.w,t.h)/2;r=e.createRadialGradient(n,i,0,n,i,a)}for(let e of n.stops)r.addColorStop(e.position,this.graphics.colorToRgb(e.color));e.fillStyle=r,e.fillRect(t.x,t.y,t.w,t.h)}applyStrokeStyle(e,t,n){if(!(!e||!t)){if(t.cap)switch(t.cap){case`rnd`:e.lineCap=`round`;break;case`sq`:e.lineCap=`square`;break;default:e.lineCap=`butt`;break}if(t.join)switch(t.join){case`round`:e.lineJoin=`round`;break;case`bevel`:e.lineJoin=`bevel`;break;default:e.lineJoin=`miter`;break}if(t.dashArray&&t.dashArray.length>0){let r=t.dashArray.map(e=>e*n);e.setLineDash(r)}else e.setLineDash([])}}getShapePreset(e){return e.geometry&&e.geometry.preset?e.geometry.preset:e.properties&&e.properties.geometry&&e.properties.geometry.preset?e.properties.geometry.preset:e.spPr&&e.spPr.geometry&&e.spPr.geometry.preset?e.spPr.geometry.preset:e.spPr&&e.spPr.prstGeom&&e.spPr.prstGeom.prst?e.spPr.prstGeom.prst:this.isPlaceholderShape(e)||e.type===`sp`||e.type===`shape`?`rect`:null}drawPictureShape(e,t){if(!t||t.w<=0||t.h<=0||!this.graphics||!this.graphics.context)return;let n=this.graphics.context;n.save();let r=e.properties?.transform;if(r&&r.rotation&&r.rotation!==0){let e=t.x+t.w/2,i=t.y+t.h/2;n.translate(e,i),n.rotate(r.rotation*Math.PI/180),n.translate(-e,-i)}let i=this.getShapePreset(e);if(i&&i!==`rect`&&i===`ellipse`&&(n.beginPath(),n.ellipse(t.x+t.w/2,t.y+t.h/2,t.w/2,t.h/2,0,0,2*Math.PI),n.clip()),e.imageRelId&&this.processor&&this.processor.imageCache){let r=this.processor.imageCache.get(e.imageRelId);if(r&&r.type===`svg`&&this.processor.svgRenderer)try{this.processor.svgRenderer.renderSVG(r.content,t.x,t.y,t.w,t.h,{preserveAspectRatio:!0}).then(()=>{}).catch(()=>{}),n.restore();return}catch{}if(r&&r.image)try{let i=r.image,{width:a,height:o}=r,s=t.x,c=t.y,l=t.w,u=t.h;if(e.imageFillMode===`stretch`){if(e.imageSrcRect){let r=e.imageSrcRect,i=1e5-r.l-r.r,a=1e5-r.t-r.b;i>0&&a>0&&(s=t.x+t.w*-r.l/i,c=t.y+t.h*-r.t/a,l=t.w*1e5/i,u=t.h*1e5/a,n.beginPath(),n.rect(t.x,t.y,t.w,t.h),n.clip())}else if(e.imageFillRect){let n=e.imageFillRect;s=t.x+t.w*n.l/1e5,c=t.y+t.h*n.t/1e5,l=t.w*(1e5-n.l-n.r)/1e5,u=t.h*(1e5-n.t-n.b)/1e5}}else if(e.imageFillMode===`tile`)s=t.x,c=t.y,l=t.w,u=t.h;else{let e=a/o;e>t.w/t.h?(l=t.w,u=t.w/e,s=t.x,c=t.y+(t.h-u)/2):(u=t.h,l=t.h*e,s=t.x+(t.w-l)/2,c=t.y)}n.drawImage(i,s,c,l,u),n.restore();return}catch{}}n.restore(),e.textBody&&e.textBody.paragraphs&&this.shouldRenderText(e)&&(this.setCurrentRenderingShape(e),this.drawShapeText(e,t))}drawImagePlaceholder(e,t,n,r,i,a=`IMAGE`){let o=this.m_oContext;o&&(o.save(),o.fillStyle=`#f8f9fa`,o.fillRect(t,n,r,i),o.strokeStyle=`#dee2e6`,o.lineWidth=1,o.strokeRect(t,n,r,i),o.restore())}drawGroupShape(e,t){if(!(!t||t.w<=0||t.h<=0)&&!(!this.graphics||!this.graphics.context)){this.graphics.SaveGrState();try{if(e.transform){let n=this.graphics.context;if(e.transform.rotation&&e.transform.rotation!==0){let r=t.x+t.w/2,i=t.y+t.h/2;n.save(),n.translate(r,i),n.rotate(e.transform.rotation*Math.PI/180),n.translate(-r,-i)}if(e.transform.flipH||e.transform.flipV){let r=e.transform.flipH?-1:1,i=e.transform.flipV?-1:1,a=t.x+t.w/2,o=t.y+t.h/2;n.save(),n.translate(a,o),n.scale(r,i),n.translate(-a,-o)}}if(e.shapeTree&&e.shapeTree.length>0){let t=this.sortShapesByRenderOrder(e.shapeTree);for(let e=0;e0&&e.h>0&&this.drawShapeGeometry(n,e)}catch{}}}}catch{}finally{this.graphics.RestoreGrState()}}}calculateChildShapeBounds(e,t){if(!e.bounds)return{x:t.x,y:t.y,w:50,h:50};let n=e.bounds,r=this.processor?this.processor.getSlideDimensions():{cx:9144e3,cy:6858e3},i=this.processor?this.processor.calculateCanvasRect(this.canvas,r):{scale:1,offsetX:0,offsetY:0,slideWidthPx:this.canvas.width,slideHeightPx:this.canvas.height},a=i.slideWidthPx,o=i.slideHeightPx,s={x:(n.l||0)/r.cx*a,y:(n.t||0)/r.cy*o,w:((n.r||0)-(n.l||0))/r.cx*a,h:((n.b||0)-(n.t||0))/r.cy*o};return{x:i.offsetX+s.x*i.scale,y:i.offsetY+s.y*i.scale,w:s.w*i.scale,h:s.h*i.scale}}drawDefaultShape(e,t){if(!t||t.w<=0||t.h<=0||!this.graphics||!this.graphics.context)return;let n=this.graphics.context;n.save();let r=e.properties?.transform;if(r&&r.rotation&&r.rotation!==0){let e=t.x+t.w/2,i=t.y+t.h/2;n.translate(e,i),n.rotate(r.rotation*Math.PI/180),n.translate(-e,-i)}n.fillStyle=`#e0e0e0`,n.fillRect(t.x,t.y,t.w,t.h),n.strokeStyle=`#999`,n.lineWidth=1,n.strokeRect(t.x,t.y,t.w,t.h),n.restore(),e.textBody&&e.textBody.paragraphs&&(this.setCurrentRenderingShape(e),this.drawShapeText(e,t))}drawConnectorShape(e,t){!t||t.w<=0&&t.h<=0||this.drawEngineLine(t,e)}async drawGraphicFrame(e,t){e.graphicData,!(!t||t.w<=0||t.h<=0)&&(e.graphicData&&e.graphicData.uri===`http://schemas.openxmlformats.org/drawingml/2006/table`?this.drawTable(e,t):e.graphicData&&e.graphicData.uri===`http://schemas.openxmlformats.org/drawingml/2006/chart`?await this.drawChart(e,t):this.drawDefaultShape(e,t))}drawTable(e,t){if(e.graphicData&&e.graphicData.tableXml)try{this.tableProcessor||(this.tableProcessor=new TableProcessor);let n=this.tableProcessor.parseTableFromXML(e.graphicData.tableXml);if(n){let e=t.x,r=t.y,i=t.w,a=t.h;try{let e=typeof n.getTableProperties==`function`?n.getTableProperties()||{}:n.tableProperties||{};e&&e.layout&&String(e.layout).toLowerCase();let r=this.coordinateSystem&&typeof this.coordinateSystem.scale==`number`?this.coordinateSystem.scale:1,o=0,s=typeof n.getTableGrid==`function`?n.getTableGrid():n.tableGrid||[];Array.isArray(s)&&s.length>0&&(o=s.reduce((e,t)=>e+(parseInt(t.width)||0),0)/914400*96*r);let c=0,l=n.rows||[];if(l.length>0&&l.some(e=>e&&e.height)&&(c=l.reduce((e,t)=>e+(parseInt(t&&t.height)||0),0)/914400*96*r),!o&&e&&e.preferredWidth){let n=e.preferredWidth;if(n.type===`pct`){let e=(parseInt(n.value)||0)/5e3;o=Math.max(0,t.w*e)}else n.type===`dxa`&&(o=(parseInt(n.value)||0)/1440*96*r)}let u=o>0?o/t.w:0;(o>t.w||u<.9)&&(i=o),c>0&&(a=c)}catch{}let o=this.canvas.getContext(`2d`),s=null;try{s=this.computeTableLayout(n,i,a,o),s&&typeof s.height==`number`&&s.height>0&&(a=s.height)}catch{s=null}if(o.save(),o.rect(e,r,i,a),o.clip(),!this.graphics.context)return;this.drawTableDirect(n,o,e,r,i,a,s),o.restore()}else this.drawTablePlaceholder(t,`Parse Failed`),tableCtx.restore()}catch{this.drawTablePlaceholder(t,`Error`),tableCtx.restore()}else this.drawTablePlaceholder(t,`No Data`)}computeTableLayout(e,t,n,r){let i={cellWidths:[],cellHeights:[],height:n};if(!e)return i;let a=typeof e.getRowCount==`function`?e.getRowCount():e.rows?e.rows.length:0,o=typeof e.getColumnCount==`function`?e.getColumnCount():0;if(a<=0)return i;let s=this.coordinateSystem&&typeof this.coordinateSystem.scale==`number`?this.coordinateSystem.scale:1,c;try{let n=typeof e.getTableGrid==`function`?e.getTableGrid():e.tableGrid||[];if(Array.isArray(n)&&n.length>0){c=n.map(e=>(parseInt(e.width,10)||0)/914400*96*s);let e=c.reduce((e,t)=>e+t,0);if(e>0&&isFinite(t)&&t>0&&Math.abs(e-t)>1){let n=t/e;c=c.map(e=>e*n)}let r=Math.max(o,c.length);if(c.length0){let e=r-c.length,n=c.reduce((e,t)=>e+t,0),i=e>0?(t-n)/e:0;for(let t=0;te)}let u=Array(a),d=Array(a).fill(!1),f=isFinite(n)&&n>0?n/Math.max(a,1):0;for(let t=0;t0&&(r=e/914400*96*s)}r&&r>0?u[t]=r:(u[t]=0,d[t]=!0)}let p=(e,t,n)=>{let r=0;for(let i=0;i_){let e=g-_;if(d===1)t[r]=Math.max(t[r],e);else{let n=e/d;for(let e=0;e=a)break;t[i]=Math.max(t[i],n)}}}o+=l}}}finally{typeof n.restore==`function`&&n.restore()}for(let e=0;e0&&(u[e]+=t[e])}for(let e=0;ee+(t||0),0);return i.cellWidths=c,i.cellHeights=u,m>0?i.height=m:isFinite(n)&&n>0?i.height=n:i.height=0,i}drawTableDirect(e,t,n,r,i,a,o=null){if(!e||!t)return;t.save();let s=typeof e.getRowCount==`function`?e.getRowCount():e.rows?e.rows.length:0,c=typeof e.getColumnCount==`function`?e.getColumnCount():0;if(s===0||c===0&&!(e.rows&&e.rows[0]&&e.rows[0].cells)){t.restore();return}let l=o;l||(l=this.computeTableLayout(e,i,a,t));let u=Array.isArray(l?.cellWidths)?l.cellWidths.slice():null,d=u&&u.length>0?u.length:Math.max(c,1);(!u||u.length===0)&&(u=Array.from({length:d},()=>i/Math.max(d,1)));let f=Array.isArray(l?.cellHeights)?l.cellHeights.slice():null;(!f||f.length===0)&&(f=Array.from({length:s},()=>a/Math.max(s,1))),l&&typeof l.height==`number`&&l.height>0&&(a=l.height);let p=(e,t,n)=>{let r=0;for(let i=0;i{let n=0;for(let r=0;rMath.max(1,Math.round((e.width||1)*v));if(h){if(h.top&&h.top.color){let e=h.top;t.strokeStyle=`rgb(${e.color.r}, ${e.color.g}, ${e.color.b})`,t.lineWidth=y(e),t.beginPath(),t.moveTo(n,r),t.lineTo(n+i,r),t.stroke()}if(h.left&&h.left.color){let e=h.left;t.strokeStyle=`rgb(${e.color.r}, ${e.color.g}, ${e.color.b})`,t.lineWidth=y(e),t.beginPath(),t.moveTo(n,r),t.lineTo(n,r+a),t.stroke()}if(h.right&&h.right.color){let e=h.right;t.strokeStyle=`rgb(${e.color.r}, ${e.color.g}, ${e.color.b})`,t.lineWidth=y(e),t.beginPath(),t.moveTo(n+i,r),t.lineTo(n+i,r+a),t.stroke()}if(h.bottom&&h.bottom.color){let e=h.bottom;t.strokeStyle=`rgb(${e.color.r}, ${e.color.g}, ${e.color.b})`,t.lineWidth=y(e),t.beginPath(),t.moveTo(n,r+a),t.lineTo(n+i,r+a),t.stroke()}if(h.insideH&&h.insideH.color){let e=h.insideH;t.strokeStyle=`rgb(${e.color.r}, ${e.color.g}, ${e.color.b})`,t.lineWidth=y(e);for(let e=0;e<_.length-1;e++){let r=_[e];t.beginPath(),t.moveTo(n,r),t.lineTo(n+i,r),t.stroke()}}if(h.insideV&&h.insideV.color){let e=h.insideV;t.strokeStyle=`rgb(${e.color.r}, ${e.color.g}, ${e.color.b})`,t.lineWidth=y(e);let i=n;for(let e=0;e{let n=o[t.name];n&&n.color&&n.width&&n.width>0&&(e.strokeStyle=`rgb(${n.color.r}, ${n.color.g}, ${n.color.b})`,e.lineWidth=Math.max(1,Math.round(n.width*s)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke())})}extractCellStyle(e,t,n){let r={};if(!e)return r;if(e.shading&&e.shading.fillColor&&e.shading.fillColor.r!==void 0&&e.shading.fillColor.g!==void 0&&e.shading.fillColor.b!==void 0){let t=e.shading.fillColor;r.backgroundColor=`rgba(${t.r}, ${t.g}, ${t.b}, ${(t.a||255)/255})`}else if(e.shading&&e.shading.fill&&e.shading.fill!==`none`){let t=e.shading.fill.startsWith(`#`)?e.shading.fill.slice(1):null;t&&t.length===6&&(r.backgroundColor=`rgb(${parseInt(t.substring(0,2),16)}, ${parseInt(t.substring(2,4),16)}, ${parseInt(t.substring(4,6),16)})`)}if(!r.backgroundColor&&n&&t!==void 0){let i=typeof n.getTableProperties==`function`?n.getTableProperties():n.tableProperties||{};if(i){let n=e.logicalColIndex||0;i.firstRow&&t===0?r.backgroundColor=`rgba(68, 114, 196, 1)`:i.bandRow&&t>0?(i.firstRow?t-1:t)%2==1&&(r.backgroundColor=`rgba(242, 242, 242, 1)`):i.firstCol&&n===0&&t>0&&(r.backgroundColor=`rgba(221, 235, 247, 1)`)}}if(e.textBody&&e.textBody.paragraphs&&e.textBody.paragraphs.length>0){let i=e.textBody.paragraphs[0];if(i.runs&&i.runs.length>0){let e=i.runs[0];if(e.properties&&e.properties.color){let t=e.properties.color;r.textColor=`rgba(${t.r}, ${t.g}, ${t.b}, ${(t.a||255)/255})`}else r.textColor=this.getTableStyleTextColor(t,n)}else r.textColor=this.getTableStyleTextColor(t,n)}else r.textColor=this.getTableStyleTextColor(t,n);return r}getTableStyleTextColor(e,t){let n=t&&typeof t.getTableProperties==`function`?t.getTableProperties():t&&t.tableProperties?t.tableProperties:{};return n&&e!==void 0&&n.firstRow&&e===0?`rgb(255, 255, 255)`:`rgb(0, 0, 0)`}getCellMarginsPx(e){let t=this.coordinateSystem&&typeof this.coordinateSystem.scale==`number`?this.coordinateSystem.scale:1,n=3.78*t,r={left:n,top:n,right:n,bottom:n};if(!e)return r;let i={...r},a=e=>{let n=Number(e);return Number.isFinite(n)?n/914400*96*t:null};return(e=>{if(e){if(e.marL!==void 0){let t=a(e.marL);t!==null&&(i.left=t)}if(e.marT!==void 0){let t=a(e.marT);t!==null&&(i.top=t)}if(e.marR!==void 0){let t=a(e.marR);t!==null&&(i.right=t)}if(e.marB!==void 0){let t=a(e.marB);t!==null&&(i.bottom=t)}}})(e.cellProperties),(e=>{if(e){if(e.left!==void 0){let t=a(e.left);t!==null&&(i.left=t)}if(e.top!==void 0){let t=a(e.top);t!==null&&(i.top=t)}if(e.right!==void 0){let t=a(e.right);t!==null&&(i.right=t)}if(e.bottom!==void 0){let t=a(e.bottom);t!==null&&(i.bottom=t)}}})(e.margins),i}computeCellTextLayout(e,t,n,r=1/0,i={}){let a={lines:[],totalHeight:0};if(!t||!t.textBody||!Array.isArray(t.textBody.paragraphs)||n<=0)return a;let o=typeof r==`number`&&r>0?r:1/0,s=i&&typeof i.contentX==`number`?i.contentX:0,c=0,l=this.coordinateSystem&&typeof this.coordinateSystem.scale==`number`?this.coordinateSystem.scale:1,u=!!(t.textBody&&t.textBody.bodyProperties&&t.textBody.bodyProperties.wrap===!1),d=e?e.font:null;for(let r of t.textBody.paragraphs){if(!r||!Array.isArray(r.runs)||r.runs.length===0)continue;if(c>=o)break;let t=`left`,d=s;if(r.properties&&r.properties.alignment){let e=r.properties.alignment,i=typeof e==`string`?e.toLowerCase():e;i===`center`||i===`ctr`?(t=`center`,d=s+n/2):i===`right`||i===`r`||i===`end`?(t=`right`,d=s+n):(i===`start`||i===`left`||i===`l`||i===`justify`)&&(t=`left`,d=s)}let f=r.runs.find(e=>(e.text||``).trim().length>0)||r.runs[0],p=12;if(f?.properties?.fontSize)p=f.properties.fontSize;else if(f?.properties?.sz){let e=parseInt(f.properties.sz,10);Number.isNaN(e)||(p=e/100)}let m=Math.max(1,Math.round(96/72*p*l)),h=f?.properties?.fontFamily||`Arial`,g=!!f?.properties?.bold,_=!!f?.properties?.italic,v=!!f?.properties?.underline,y=i.defaultTextColor||`rgb(159, 159, 159)`;if(f?.properties?.color){let e=f.properties.color;y=`rgba(${e.r}, ${e.g}, ${e.b}, ${(e.a||255)/255})`}let b=1.2;r.properties&&(typeof r.properties.lineSpacingFactor==`number`?b=r.properties.lineSpacingFactor:typeof r.properties.lineSpacingPct==`number`&&(b=Math.max(.5,Math.min(4,r.properties.lineSpacingPct/100))));let x=Math.max(1,Math.round(m*b)),S=r.runs.map(e=>e.text||``).join(``);if(!S)continue;let C=!u,w=`${_?`italic `:``}${g?`bold `:``}${m}px ${h}`;e&&typeof e.font==`string`&&(e.font=w);let T=null;if(f?.properties?.highlight){let e=f.properties.highlight;typeof e==`object`&&e.r!==void 0?T=`rgba(${e.r}, ${e.g}, ${e.b}, ${(e.a||255)/255})`:typeof e==`string`&&(T=e)}let E=e=>{e&&(a.lines.push({text:e,textX:d,textAlign:t,fontSizePixels:m,fontFamily:h,isBold:g,isItalic:_,isUnderline:v,colorStr:y,lineHeight:x,highlightStr:T}),c+=x)};if(C){let t=S.trim();for(;t.length>0&&!(c+x>o);){let r=1,i=t.length,a=1;for(;r<=i;){let o=r+i>>1,s=t.slice(0,o);(e&&typeof e.measureText==`function`?e.measureText(s):{width:s.length*m*.5}).width<=n||o===1?(a=o,r=o+1):i=o-1}let o=a;if(a0&&(o=e)}let s=Math.max(1,o),c=t.slice(0,s).trimEnd();c||(c=t.charAt(0),s=1),E(c),t=t.slice(s).trimStart()}}else{if(c+x>o)break;E(S.trimEnd())}}return e&&d!==null&&(e.font=d),a.totalHeight=c,a}drawCellText(e,t,n,r,i,a,o){if(!t||!t.textBody||!t.textBody.paragraphs)return;e.save(),e.textBaseline=`top`;let s=this.getCellMarginsPx(t),c=Math.max(0,i-s.left-s.right),l=Math.max(0,a-s.top-s.bottom);if(c<=0||l<=0){e.restore();return}let u=n+s.left,d=r+s.top;e.beginPath(),e.rect(u,d,c,l),e.clip();let f=this.computeCellTextLayout(e,t,c,l,{contentX:u,defaultTextColor:o.textColor});if(f.lines.length>0){let n=f.totalHeight,r=`top`;if(t&&typeof t.verticalAlignment==`string`)r=t.verticalAlignment.toLowerCase();else if(t&&t.textBody&&t.textBody.bodyProperties&&t.textBody.bodyProperties.anchor){let e=String(t.textBody.bodyProperties.anchor).toLowerCase();e===`ctr`||e===`center`||e===`middle`?r=`middle`:(e===`b`||e===`bottom`)&&(r=`bottom`)}let i=f.lines[f.lines.length-1],a=i?Math.max(0,i.lineHeight-i.fontSizePixels):0,o=d;r===`middle`||r===`center`||r===`ctr`?o=d+Math.max(0,(l-n)/2)+a/2:(r===`b`||r===`bottom`)&&(o=d+Math.max(0,l-n)+a);for(let t of f.lines){let n=``;if(t.isItalic&&(n+=`italic `),t.isBold&&(n+=`bold `),e.font=`${n}${t.fontSizePixels}px ${t.fontFamily}`,e.textAlign=t.textAlign,t.highlightStr){let n=e.measureText(t.text);e.save(),e.fillStyle=t.highlightStr,e.fillRect(Math.round(t.textX),Math.round(o-t.fontSizePixels),n.width,t.fontSizePixels*1.2),e.restore()}if(e.fillStyle=t.colorStr,e.fillText(t.text,Math.round(t.textX),Math.round(o)),t.isUnderline){let n=e.measureText(t.text).width,r=Math.round(o+t.fontSizePixels*1.1),i=t.textAlign===`center`?Math.round(t.textX-n/2):t.textAlign===`right`?Math.round(t.textX-n):Math.round(t.textX);e.save(),e.strokeStyle=t.colorStr,e.lineWidth=Math.max(1,t.fontSizePixels*.08),e.beginPath(),e.moveTo(i,r),e.lineTo(i+n,r),e.stroke(),e.restore()}if(o+=t.lineHeight,o>d+l)break}}e.restore()}getScaledFontSize(e){let t=e;return this.coordinateSystem&&this.coordinateSystem.scale&&(t=e*this.coordinateSystem.scale,t=Math.max(t,8),t=Math.min(t,72)),Math.round(t)}drawTablePlaceholder(e,t){let n={r:100,g:100,b:200,a:255};this.graphics.p_color(n.r,n.g,n.b,n.a),this.graphics.p_width(2),this.graphics._s(),this.graphics._m(e.x,e.y),this.graphics._l(e.x+e.w,e.y),this.graphics._l(e.x+e.w,e.y+e.h),this.graphics._l(e.x,e.y+e.h),this.graphics._z(),typeof this.graphics.ds==`function`&&this.graphics.ds()}async drawChart(e,t){let n=this.currentSlideIndex,r=this.currentSlide;if(e.chartData){if(e.chartData.type===`DEFERRED_CHART`)if(window.ChartProcessor){let i=new ChartProcessor(this.context);if(n!==void 0&&r){let a={slideIndex:n,slideName:r?.name||`slide${n+1}`,slide:r};i.setSlideContext(a);try{let n=await i.loadChartFromRelationship(e.chartData.relationshipId,a);if(n&&n.type!==`DEFERRED_CHART`)e.chartData=n;else{this.drawChartPlaceholder(t,`Load Failed`);return}}catch{this.drawChartPlaceholder(t,`Load Error`);return}}else{this.drawChartPlaceholder(t,`No Context`);return}}else{this.drawChartPlaceholder(t,`No Processor`);return}try{await new ChartRenderer(this.graphics).renderChart(e.chartData,t.x,t.y,t.w,t.h)}catch{this.drawChartPlaceholder(t,`Render Failed`)}}else if(e.graphicData&&e.graphicData.element&&window.ChartProcessor)try{let i=new ChartProcessor(this.context);if(n!==void 0&&r){let e={slideIndex:n,slideName:r?.name||`slide${n+1}`,slide:r};i.setSlideContext(e)}let a=i.parseEmbeddedChartData(e.graphicData.element);if(a){e.chartData=a,await new ChartRenderer(this.graphics).renderChart(a,t.x,t.y,t.w,t.h);return}if(e.graphicData.chartRef){let a={slideIndex:n,slideName:r?.name||`slide${n+1}`,slide:r};try{let n=await i.loadChartFromRelationship(e.graphicData.chartRef,a);n?(e.chartData=n,await new ChartRenderer(this.graphics).renderChart(n,t.x,t.y,t.w,t.h)):this.drawChartPlaceholder(t,`Processing Failed`)}catch{this.drawChartPlaceholder(t,`Processing Error`)}return}this.drawChartPlaceholder(t,`No Chart Reference`)}catch{this.drawChartPlaceholder(t,`Processing Failed`)}else this.drawChartPlaceholder(t,`No Chart Data`)}drawChartStyling(e,t,n,r,i){if(!e)return;let a=null;if(this.graphics&&this.graphics.ctx?a=this.graphics.ctx:this.graphics&&this.graphics._context?a=this.graphics._context:this.graphics&&this.graphics.context?a=this.graphics.context:this.graphics&&this.graphics.m_oContext&&(a=this.graphics.m_oContext),!a)return;let o=(e.plotArea?.shapeProperties||e.shapeProperties||{}).line;if(!o||!o.color)return;let s=12700,c=Math.max(1,Math.round((o.width||s)/s)),l=typeof o.color==`string`?o.color:this.colorToRgb(o.color),u=e.roundedCorners?Math.min(20,Math.floor(Math.min(r,i)*.1)):0;if(a.save(),a.strokeStyle=l,a.lineWidth=c,a.lineCap=`round`,a.lineJoin=`round`,a.globalCompositeOperation=`source-over`,a.beginPath(),e.roundedCorners&&u>0){let e=t+c/2,o=n+c/2,s=r-c,l=i-c;this.graphics&&typeof this.graphics.drawRoundRectPath==`function`?this.graphics.drawRoundRectPath(a,e,o,s,l,u):typeof this.drawRoundRectPath==`function`?this.drawRoundRectPath(a,e,o,s,l,u):a.rect(e,o,s,l)}else{let e=t+c/2,o=n+c/2,s=r-c,l=i-c;a.rect(e,o,s,l)}a.stroke(),a.restore()}drawChartPlaceholder(e,t){let n={r:200,g:100,b:100,a:255};this.graphics.p_color(n.r,n.g,n.b,n.a),this.graphics.p_width(2),this.graphics._s(),this.graphics._m(e.x,e.y),this.graphics._l(e.x+e.w,e.y),this.graphics._l(e.x+e.w,e.y+e.h),this.graphics._l(e.x,e.y+e.h),this.graphics._z(),typeof this.graphics.ds==`function`&&this.graphics.ds()}drawShapeText(e,t){if(!(!e||!e.textBody||!e.textBody.paragraphs||e.textBody.paragraphs.length===0)){this.setCurrentRenderingShape(e),this.graphics.SaveGrState();try{let n=this.calculateTextBounds(e,t);this.drawTextContent(e.textBody,n)}catch{this.drawFallbackText(e,t)}finally{this.graphics.RestoreGrState(),this.setCurrentRenderingShape(null)}}}calculateTextBounds(e,t){let{x:n,y:r,w:i,h:a}=t,o=e.textBody?.bodyProperties||e.textBody?.bodyPr||{};this.getShapePreset(e)===`rtTriangle`&&(r+=a/2,a/=2);let s=Math.max(22860,i*.02*914400),c=Math.max(11430,a*.01*914400),l=this.emuToPixels(o.leftMargin||s),u=this.emuToPixels(o.rightMargin||s),d=this.emuToPixels(o.topMargin||c),f=this.emuToPixels(o.bottomMargin||c);if(this.coordinateSystem){let{scale:e}=this.coordinateSystem,t=Math.round(l*e),o=Math.round(u*e),s=Math.round(d*e),c=Math.round(f*e);return{x:n+t,y:r+s,w:Math.max(i-(t+o),0),h:Math.max(a-(s+c),0),scale:e,margins:{left:t,right:o,top:s,bottom:c}}}return{x:n+l,y:r+d,w:Math.max(i-(l+u),0),h:Math.max(a-(d+f),0),scale:1,margins:{left:l,right:u,top:d,bottom:f}}}drawFallbackText(e,t){let n=this.graphics.context;if(!n)return;let{x:r,y:i,w:a,h:o}=t;n.save(),n.font=`${12*this.getTextScaleFactor()}px Arial`,n.fillStyle=`#000000`,n.textAlign=`left`,n.textBaseline=`top`;let s=i+5;for(let t of e.textBody.paragraphs){if(s>i+o-16)break;for(let e of t.runs)e.text&&s<=i+o-16&&(n.fillText(e.text,r+5,s),s+=16)}n.restore()}drawTextContent(e,t){if(!e||!e.paragraphs||e.paragraphs.length===0||!this.graphics||!this.graphics.context)return;this.graphics.context;let{x:n,y:r,w:i,h:a}=t;if(!a||a<1){let n=this.estimateTextHeightPx(e,i);if(n&&n>0){let r={...t,h:n};this.renderTextBodyStandard(e,r);return}}this.renderTextBodyStandard(e,t)}estimateTextHeightPx(e,t){try{if(!e||!e.paragraphs||e.paragraphs.length===0)return 0;let n=e.bodyProperties||e.bodyPr||{},r=this.emuToPixels(n.leftMargin||0),i=this.emuToPixels(n.rightMargin||0),a=Math.max(0,t-r-i),o=0;for(let t of e.paragraphs){let e=this.parseParagraphProperties(t,this.getCurrentShape()),n=this.calculateWrappedLines(t,e,a,this.getCurrentShape()),r=this.calculateStandardLineHeight(e,n),i=this.emuToPixels(e.spaceBefore||0),s=this.emuToPixels(e.spaceAfter||0);o+=i+n.length*r+s}let s=this.emuToPixels(n.topMargin||0),c=this.emuToPixels(n.bottomMargin||0);return o+=s+c,Math.ceil(o)}catch{return 0}}estimateTextBoxHeightPx(e,t){let n=e&&e.textBody;return n?this.estimateTextHeightPx(n,t):0}renderTextBodyStandard(e,t){let{x:n,y:r,w:i,h:a,margins:o,scale:s}=t,c=n,l=r,u=i,d=a,f=e.bodyProperties||e.bodyPr||{},p=f.anchor||f.verticalAlign||`t`;switch(p){case`top`:p=`t`;break;case`middle`:case`center`:p=`ctr`;break;case`bottom`:p=`b`;break}let m=l,h=[],g=0;for(let t=0;t1){let e=Math.max(0,d-g);e>0&&(p===`just`?y=e/(h.length-1):p===`dist`&&(y=e/(h.length+1),_+=y))}let b={},x=-1,S={},C=new Set;for(let e=0;ee-t),T=w.length>0?w[0]:0,E=e=>{let t=e&&typeof e.level==`number`?e.level:0;if(t>0)return t;let n=e.indent&&typeof e.indent.left==`number`?e.indent.left:0;if(w.length<=1)return t;if(n<=T)return 0;let r=w.indexOf(n);return r===-1&&(r=w.findIndex(e=>e>=n),r===-1&&(r=w.length-1)),Math.max(0,r)};for(let e=0;ex&&(b[n]=0);!b[n]&&b[n]!==0&&(b[n]=r?i-1:0),b[n]||(b[n]=0),b[n]++,S[e]=b[n],x=n}}for(let e=0;e=v)break;let{paraProps:n,wrappedLines:r,lineHeight:i,spaceBefore:a,spaceAfter:o}=t;_+=a||0;let l=E(n);if(n.bullet&&(n.bullet.type===`number`||n.bullet.type===`autoNumber`)){if(l!==x)if(lx&&(b[l]=0);b[l]||(b[l]=0),b[l]++,x=l}for(let t=0;th?p+f:h}let x=m;for(let e of a.runs){let{text:t,runProps:n}=e,r=t;if(n.cap&&n.cap!==`none`)switch(n.cap){case`all`:case`small`:r=r.toUpperCase();break;case`words`:r=r.replace(/\b\w/g,e=>e.toUpperCase());break}if(this.setupStandardFont(n),n.highlight){let e=this.graphics.context;if(e){let t=n.highlight,i;if(typeof t==`object`&&t.r!==void 0?i=`rgba(${t.r}, ${t.g}, ${t.b}, ${(t.a||255)/255})`:typeof t==`string`&&(i=t),i){let t=e.measureText(r).width,a=n.scaledFontSize||(n.fontSize||12)*this.getTextScaleFactor();e.save(),e.fillStyle=i,e.fillRect(Math.round(x),Math.round(y-a*.85),t,a*1.15),e.restore(),e.fillStyle=this.graphics.colorToRgb(n.color)}}}let i=this.graphics.context,a=!1;if(n.effectLst&&i){let e=n.effectLst;if(e.outerShadow){let t=e.outerShadow;i.save(),a=!0;let n=(t.blurRadius||0)/12700,r=(t.distance||0)/12700,o=(t.direction||0)/6e4*Math.PI/180;if(i.shadowOffsetX=Math.cos(o)*r*this.getTextScaleFactor(),i.shadowOffsetY=Math.sin(o)*r*this.getTextScaleFactor(),i.shadowBlur=n*this.getTextScaleFactor(),t.color){let e=t.color,n=0,r=0,a=0,o=.5;if(e.r!==void 0)n=e.r,r=e.g,a=e.b,o=e.a===void 0?.5:e.a/255;else if(e.value){let t=e.value.replace(`#`,``);n=parseInt(t.slice(0,2),16)||0,r=parseInt(t.slice(2,4),16)||0,a=parseInt(t.slice(4,6),16)||0,o=e.alpha===void 0?.5:e.alpha}i.shadowColor=`rgba(${n}, ${r}, ${a}, ${o})`}else i.shadowColor=`rgba(0, 0, 0, 0.4)`}else if(e.glow){let t=e.glow;i.save(),a=!0;let n=(t.radius||0)/12700;if(i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=n*this.getTextScaleFactor(),t.color){let e=t.color;i.shadowColor=`rgba(${e.r||0}, ${e.g||0}, ${e.b||0}, ${(e.a||255)/255})`}else i.shadowColor=`rgba(255, 0, 0, 0.6)`}}let o=y;if(n.verticalAlign&&n.verticalAlign!==`normal`&&n.verticalAlign!==`baseline`){let e=n.scaledFontSize||(n.fontSize||12)*this.getTextScaleFactor();n.verticalAlign===`superscript`||n.verticalAlign===`super`?o=y-e*.35:(n.verticalAlign===`subscript`||n.verticalAlign===`sub`)&&(o=y+e*.2)}x=this.renderRunTextStandard(r,x,o,n,c+u),a&&i&&(i.restore(),i.fillStyle=this.graphics.colorToRgb(n.color))}_+=i}_+=o||0,e0&&(a.runs.length>0&&i.push(a),a={runs:[],width:0});let t=u[e];if(!t)continue;let r=t.split(/(\s+)/);for(let e of r){if(!e)continue;let t=this.measureRunText(e,c);if(a.width+t<=n)a.runs.push({text:e,runProps:c}),a.width+=t;else if(t<=n)a.runs.length>0&&i.push(a),a={runs:[{text:e,runProps:c}],width:t};else{a.runs.length>0&&(i.push(a),a={runs:[],width:0});let t=``,r=0;for(let o of e){let e=this.measureRunText(o,c);r+e>n&&t.length>0&&(a.runs.push({text:t,runProps:c}),a.width+=r,i.push(a),a={runs:[],width:0},t=``,r=0),t+=o,r+=e}t&&(a.runs.push({text:t,runProps:c}),a.width+=r)}}}}return a.runs.length>0&&i.push(a),i.length===0&&i.push({runs:[],width:0}),i}setupStandardFont(e){let t=this.graphics.context;if(!t)return;let n=this.getTextScaleFactor(),r=(e.fontSize||12)*n;t.font=`${e.italic?`italic`:`normal`} ${e.bold?`bold`:`normal`} ${r}px ${`"${e.fontFamily||`Arial`}", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif`}`,t.fillStyle=this.graphics.colorToRgb(e.color),t.textBaseline=`alphabetic`,e.scaledFontSize=r}getBulletWidth(e,t,n=0,r=null){let i=this.graphics.context;if(!i||!e)return 0;i.save();try{let r=(t.fontSize||12)*this.getTextScaleFactor(),a=t.fontFamily||`Arial`,o=t.bold?`bold`:`normal`;i.font=`${t.italic?`italic`:`normal`} ${o} ${r}px ${a}`;let s=``;switch(e.type){case`character`:s=e.char||`•`;break;case`number`:s=`${(e.startAt||1)-1+(t&&typeof t._bulletNumber==`number`?t._bulletNumber:n)}.`;break;case`autoNumber`:{let r=(e.startAt||1)-1,i=t&&typeof t._bulletNumber==`number`?t._bulletNumber:n;s=this.getAutoNumberBullet(e.subType,r+i)}break;default:s=`•`;break}let c=i.measureText(s).width;return i.restore(),c}catch{return i.restore(),0}}calculateBulletInfo(e,t,n=0){let r=this.graphics.getContext();r.save();let i=t.fontSize||12,a=this.getTextScaleFactor(),o=Math.max(i*a,14),s=t.fontFamily||`Arial`,c=t.bold?`bold`:`normal`;r.font=`${t.italic?`italic`:`normal`} ${c} ${o}px ${s}`;let l=``;switch(e.type){case`character`:l=e.char||`•`;break;case`number`:l=`${(e.startAt||1)-1+(t&&typeof t._bulletNumber==`number`?t._bulletNumber:n)}.`;break;case`autoNumber`:{let r=(e.startAt||1)-1+(t&&typeof t._bulletNumber==`number`?t._bulletNumber:n);l=this.getAutoNumberBullet(e.subType,r)}break;default:l=`•`;break}let u=r.measureText(l).width,d=o*.5;return r.restore(),{bulletText:l,bulletWidth:u,bulletSpacing:d,totalWidth:u+d}}generateHierarchicalNumber(e,t,n,r){let i=t.level||0,a=r&&r[i]?r[i]:(e.startAt||1)+n;return this.getAutoNumberBullet(e.subType,a)}renderBullet(e,t,n,r,i,a=null){let o=this.graphics.context;if(!(!o||!e)){o.save();try{let a=(r.fontSize||12)*this.getTextScaleFactor(),s=r.fontFamily||`Arial`,c=r.bold?`bold`:`normal`;o.font=`${r.italic?`italic`:`normal`} ${c} ${a}px ${s}`;let l=r.color||{r:0,g:0,b:0,a:255};o.fillStyle=this.graphics.colorToRgb(l),o.textBaseline=`alphabetic`;let u=``;switch(e.type){case`character`:u=e.char||`•`;break;case`number`:u=`${(e.startAt||1)-1+(r&&typeof r._bulletNumber==`number`?r._bulletNumber:i)}.`;break;case`autoNumber`:{let t=(e.startAt||1)-1,n=r&&typeof r._bulletNumber==`number`?r._bulletNumber:i;u=this.getAutoNumberBullet(e.subType,t+n)}break;default:u=`•`;break}o.fillText(u,t,n)}catch{}finally{o.restore()}}}getAutoNumberBullet(e,t){switch(e){case`arabicPeriod`:case`arabic1Minus`:case`arabic2Minus`:return`${t}.`;case`arabicParenR`:return`${t})`;case`arabicParenBoth`:return`(${t})`;case`romanUcPeriod`:return`${this.toRoman(t,!0)}.`;case`romanLcPeriod`:return`${this.toRoman(t,!1)}.`;case`alphaUcPeriod`:return`${this.toAlpha(t,!0)}.`;case`alphaLcPeriod`:return`${this.toAlpha(t,!1)}.`;case`alphaUcParenR`:return`${this.toAlpha(t,!0)})`;case`alphaLcParenR`:return`${this.toAlpha(t,!1)})`;case`alphaUcParenBoth`:return`(${this.toAlpha(t,!0)})`;case`alphaLcParenBoth`:return`(${this.toAlpha(t,!1)})`;default:return`${t}.`}}toRoman(e,t=!0){let n=[1e3,900,500,400,100,90,50,40,10,9,5,4,1],r=t?[`M`,`CM`,`D`,`CD`,`C`,`XC`,`L`,`XL`,`X`,`IX`,`V`,`IV`,`I`]:[`m`,`cm`,`d`,`cd`,`c`,`xc`,`l`,`xl`,`x`,`ix`,`v`,`iv`,`i`],i=``;for(let t=0;t=n[t];)i+=r[t],e-=n[t];return i}toAlpha(e,t=!0){let n=``,r=t?65:97;for(;e>0;)e--,n=String.fromCharCode(r+e%26)+n,e=Math.floor(e/26);return n||(t?`A`:`a`)}renderRunTextStandard(e,t,n,r,i){let a=this.graphics.context;if(!a||!e)return t;let o=t;this.currentRenderingShape&&this.currentRenderingShape.effects&&this.applyTextEffectsToContext(a,this.currentRenderingShape.effects);let s=r.letterSpacing||0;if(s===0)a.fillText(e,o,n),o+=a.measureText(e).width;else{let t=Array.from(e);for(let e=0;e0){let e=0;for(let n of t)for(let t of n.runs||[])t.runProps&&t.runProps.fontSize>0&&(e=Math.max(e,t.runProps.fontSize));e>0&&ee+t.width,0),s=n,c=a.align||`left`,l=this.coordinateSystem?.scale||1;i*l,o*l,c===`center`||c===`ctr`?s=n+Math.max(0,i-o)/2:c===`right`||c===`r`?s=n+Math.max(0,i-o):c===`justify`&&t.length>1&&(s=n);let u=s;for(let n of t){if(e.font=n.font,e.fillStyle=this.graphics.colorToRgb(n.props.color||{r:0,g:0,b:0,a:255}),e.textBaseline=`alphabetic`,e.textAlign=`left`,n.props.highlight){let t=n.props.highlight,i;if(typeof t==`object`&&t.r!==void 0?i=`rgba(${t.r}, ${t.g}, ${t.b}, ${(t.a||255)/255})`:typeof t==`string`&&(i=t),i){let t=this.getTextScaleFactor(),a=(n.props.fontSize||12)*t;e.save(),e.fillStyle=i,e.fillRect(Math.round(u),Math.round(r-a),n.width,a*1.2),e.restore(),e.fillStyle=this.graphics.colorToRgb(n.props.color||{r:0,g:0,b:0,a:255})}}if(e.fillText(n.text,Math.round(u),Math.round(r)),n.props.underline&&(e.save(),e.strokeStyle=e.fillStyle,e.lineWidth=1,e.beginPath(),e.moveTo(u,r+2),e.lineTo(u+n.width,r+2),e.stroke(),e.restore()),n.props.strike){e.save(),e.strokeStyle=e.fillStyle,e.lineWidth=1,e.beginPath();let t=this.getTextScaleFactor(),i=r-(n.props.fontSize||12)*t*.3;e.moveTo(u,i),e.lineTo(u+n.width,i),e.stroke(),e.restore()}u+=n.width}}parseParagraphProperties(e,t=null){let n={align:`left`,lineHeight:120,spaceBefore:0,spaceAfter:0,fontSize:18,fontFamily:`Arial`,color:{r:0,g:0,b:0,a:255},bold:!1,italic:!1,bullet:null,indent:{left:0,hanging:0}},r=e.properties&&typeof e.properties.level==`number`?e.properties.level:0,i=this.resolveInheritedTextProperties(t,`paragraph`,r);for(let e in i)e===`leftMargin`?n.indent.left=i.leftMargin:e===`hangingIndent`?n.indent.hanging=i.hangingIndent:e!==`leftMargin`&&e!==`hangingIndent`&&(n[e]=i[e]);if(i.align&&(n.align={l:`left`,left:`left`,ctr:`center`,center:`center`,r:`right`,right:`right`,just:`justify`,justify:`justify`}[i.align]||i.align),t&&t.placeholder)switch(t.placeholder.type){case`title`:case`ctrTitle`:break;case`subTitle`:break;case`body`:break;case`obj`:break}if(e.properties){let t=e.properties;t.align&&(n.align={l:`left`,left:`left`,ctr:`center`,center:`center`,r:`right`,right:`right`,just:`justify`,justify:`justify`}[t.align]||t.align),t.lineHeight!==void 0&&(n.lineHeight=t.lineHeight),t.lineHeightPoints!==void 0&&(n.lineHeightPoints=t.lineHeightPoints),t.spacing&&(t.spacing.before&&(n.spaceBefore=t.spacing.before),t.spacing.after&&(n.spaceAfter=t.spacing.after)),t.fontSize!==void 0&&(n.fontSize=t.fontSize),t.fontFamily&&(n.fontFamily=t.fontFamily),t.color&&(n.color=t.color),t.bold!==void 0&&(n.bold=t.bold),t.italic!==void 0&&(n.italic=t.italic),t.bullet&&(n.bullet=t.bullet),t.indent&&(n.indent.left=t.indent.left,n.indent.hanging=t.indent.hanging)}return n}parseRunProperties(e,t,n=null){let r={fontSize:18,fontFamily:`Arial`,color:this.currentSlide?.type===`layout`?{r:68,g:68,b:68,a:255}:{r:0,g:0,b:0,a:255},bold:!1,italic:!1,underline:!1,strike:!1,verticalAlign:`normal`,letterSpacing:0,cap:`none`},i=this.resolveInheritedTextProperties(n,`run`);if(Object.assign(r,i),t&&(t.fontSize!==void 0&&(r.fontSize=t.fontSize),t.fontFamily&&(r.fontFamily=t.fontFamily),t.color&&(r.color=t.color),t.bold!==void 0&&(r.bold=t.bold),t.italic!==void 0&&(r.italic=t.italic)),e.properties){let t=e.properties;t.fontSize!==void 0&&(r.fontSize=t.fontSize),t.fontFamily&&(r.fontFamily=t.fontFamily),t.color&&(r.color=t.color),t.bold!==void 0&&(r.bold=t.bold),t.italic!==void 0&&(r.italic=t.italic),t.underline!==void 0&&(r.underline=t.underline),t.strike!==void 0&&(r.strike=t.strike),t.verticalAlign&&(r.verticalAlign=t.verticalAlign),t.letterSpacing!==void 0&&(r.letterSpacing=t.letterSpacing),t.cap&&(r.cap=t.cap),t.highlight&&(r.highlight=t.highlight),t.effectLst&&(r.effectLst=t.effectLst)}return r}emuToPixels(e){return CoordinateTransform.emuToPixels(e,96)}colorToRgbAlternative(e){if(typeof e==`string`)return e.startsWith(`#`)||e.match(/^[a-z]+$/i),e;if(!e)return`rgb(0, 0, 0)`;let t=0,n=0,r=0,i=255;return typeof e==`object`&&(t=e.r===void 0?e.R===void 0?0:e.R:e.r,n=e.g===void 0?e.G===void 0?0:e.G:e.g,r=e.b===void 0?e.B===void 0?0:e.B:e.b,i=e.a===void 0?e.A===void 0?255:e.A:e.a,t=Math.max(0,Math.min(255,Math.round(t))),n=Math.max(0,Math.min(255,Math.round(n))),r=Math.max(0,Math.min(255,Math.round(r))),i=Math.max(0,Math.min(255,Math.round(i)))),i!==void 0&&i!==255?`rgba(${t}, ${n}, ${r}, ${i/255})`:`rgb(${t}, ${n}, ${r})`}isHiddenShape(e){return e.hidden===!0}getShapeTransform(e){return null}getShapeBounds(e){if(e&&e.type===`graphicFrame`&&e.position){let t=e.position,n=t.x||0,r=t.y||0,i=t.width||914400,a=t.height||914400;if(this.coordinateSystem){let{slideWidthEMU:e,slideHeightEMU:t}=this.coordinateSystem,o=e||9144e3,s=t||6858e3,c={x:n/o,y:r/s,w:i/o,h:a/s},l=this.graphics.context.canvas,u,d;l.style.width&&l.style.height?(u=parseFloat(l.style.width),d=parseFloat(l.style.height)):(u=l.width/(window.devicePixelRatio||1),d=l.height/(window.devicePixelRatio||1));let f=o/s,p=u/d,m,h,g,_;return f>p?(m=u,h=u/f,g=0,_=(d-h)/2):(m=d*f,h=d,g=(u-m)/2,_=0),{x:Math.round(g+c.x*m),y:Math.round(_+c.y*h),w:Math.round(c.w*m),h:Math.round(c.h*h)}}let o=e=>e/914400*96;return{x:o(n),y:o(r),w:o(i),h:o(a)}}if(e.spPr&&e.spPr.xfrm){let t=e.spPr.xfrm,n=t.x===void 0?(t.off&&t.off.x)===void 0?0:t.off.x:t.x,r=t.y===void 0?(t.off&&t.off.y)===void 0?0:t.off.y:t.y,i=t.width===void 0?t.cx===void 0?(t.ext&&t.ext.cx)===void 0?914400:t.ext.cx:t.cx:t.width,a=t.height===void 0?t.cy===void 0?(t.ext&&t.ext.cy)===void 0?914400:t.ext.cy:t.cy:t.height;if(this.coordinateSystem){let{slideWidthEMU:e,slideHeightEMU:t}=this.coordinateSystem,o=e||9144e3,s=t||6858e3,c={x:n/o,y:r/s,w:i/o,h:a/s},l=this.graphics.context.canvas,u,d;l.style.width&&l.style.height?(u=parseFloat(l.style.width),d=parseFloat(l.style.height)):(u=l.width/(window.devicePixelRatio||1),d=l.height/(window.devicePixelRatio||1));let f=o/s,p=u/d,m,h,g,_;return f>p?(m=u,h=u/f,g=0,_=(d-h)/2):(m=d*f,h=d,g=(u-m)/2,_=0),{x:Math.round(g+c.x*m),y:Math.round(_+c.y*h),w:Math.round(c.w*m),h:Math.round(c.h*h)}}let o=e=>e/914400*96;return{x:o(n),y:o(r),w:o(i),h:o(a)}}if(e.properties&&e.properties.transform){let t=e.properties.transform,n=t.x||0,r=t.y||0,i=t.width||914400,a=t.height||914400;if(this.coordinateSystem){let{scale:e,offsetX:t,offsetY:o,slideWidthEMU:s,slideHeightEMU:c}=this.coordinateSystem,l=s||9144e3,u=c||6858e3,d={x:n/l,y:r/u,w:i/l,h:a/u},f=this.graphics.context.canvas,p,m;f.style.width&&f.style.height?(p=parseFloat(f.style.width),m=parseFloat(f.style.height)):(p=f.width/(window.devicePixelRatio||1),m=f.height/(window.devicePixelRatio||1));let h=l/u,g=p/m,_,v,y,b;return h>g?(_=p,v=p/h,y=0,b=(m-v)/2):(_=m*h,v=m,y=(p-_)/2,b=0),{x:Math.round(y+d.x*_),y:Math.round(b+d.y*v),w:Math.round(d.w*_),h:Math.round(d.h*v)}}let o=e=>e/914400*96;return{x:o(n),y:o(r),w:o(i),h:o(a)}}let t=e.position||e.transform;if(t&&(t.x!==void 0||t.y!==void 0||t.width!==void 0||t.height!==void 0)){let e=t.x||0,n=t.y||0,r=t.width||914400,i=t.height||914400;if(this.coordinateSystem){let{slideWidthEMU:t,slideHeightEMU:a}=this.coordinateSystem,o=t||9144e3,s=a||6858e3,c={x:e/o,y:n/s,w:r/o,h:i/s},l=this.graphics.context.canvas,u,d;l.style.width&&l.style.height?(u=parseFloat(l.style.width),d=parseFloat(l.style.height)):(u=l.width/(window.devicePixelRatio||1),d=l.height/(window.devicePixelRatio||1));let f=o/s,p=u/d,m,h,g,_;return f>p?(m=u,h=u/f,g=0,_=(d-h)/2):(m=d*f,h=d,g=(u-m)/2,_=0),{x:Math.round(g+c.x*m),y:Math.round(_+c.y*h),w:Math.round(c.w*m),h:Math.round(c.h*h)}}let a=e=>e/914400*96;return{x:a(e),y:a(n),w:a(r),h:a(i)}}if(e.bounds){let t=e.bounds.l||0,n=e.bounds.t||0,r=typeof e.bounds.r==`number`?e.bounds.r:t+1e6,i=typeof e.bounds.b==`number`?e.bounds.b:n+1e6;if(this.coordinateSystem){let{scale:e,offsetX:a,offsetY:o,slideWidthEMU:s,slideHeightEMU:c}=this.coordinateSystem,l=s||9144e3,u=c||6858e3,d={x:t/l,y:n/u,w:(r-t)/l,h:(i-n)/u},f=this.graphics.context.canvas,p,m;f.style.width&&f.style.height?(p=parseFloat(f.style.width),m=parseFloat(f.style.height)):(p=f.width/(window.devicePixelRatio||1),m=f.height/(window.devicePixelRatio||1));let h=l/u,g=p/m,_,v,y,b;return h>g?(_=p,v=p/h,y=0,b=(m-v)/2):(_=m*h,v=m,y=(p-_)/2,b=0),{x:Math.round(y+d.x*_),y:Math.round(b+d.y*v),w:Math.round(d.w*_),h:Math.round(d.h*v)}}let a=e=>e/914400*96;return{x:a(t),y:a(n),w:a(r-t),h:a(i-n)}}return{x:50,y:50,w:100,h:50}}getShapeFillColor(e){if(e.fill&&e.fill.type===`none`||e.properties&&e.properties.fill&&e.properties.fill.type===`none`||(this.processor&&this.processor.applyPropertyInheritance&&(!e.fill||e.fill===null)&&(!e.properties?.fill||e.properties?.fill===null)&&this.processor.applyPropertyInheritance(e,this.currentSlide),e.fill&&e.fill.type===`none`)||e.properties&&e.properties.fill&&e.properties.fill.type===`none`||e.textBody&&e.placeholder&&!e.fill&&!e.properties?.fill&&!e.fillColor)return null;if(this.processor&&this.processor.getShapeFillColor){let t=this.processor.getShapeFillColor(e);if(t!==void 0)return t}let t=e.preservedStyle||e.style;if(t&&t.fillRef){if(e.textBody&&e.placeholder&&!e.fill&&!e.properties?.fill&&!e.fillColor)return null;if(this.processor&&this.processor.resolveStyleFillColor){let e=this.processor.resolveStyleFillColor(t.fillRef);if(e)return e}return t.fillRef.color?t.fillRef.color:this.currentSlide?.type===`layout`&&e.textBody&&!e.fill&&!e.properties?.fill?null:`#FFFFFF`}if(e.textBody&&!e.placeholder&&e.fillColor){let t=e.fillColor;if(typeof t==`string`){let e=t.replace(`#`,``);if(e.length===6){let t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2,2),16),r=parseInt(e.substr(4,2),16);if(t>200&&n>240&&r>240)return null}}else if(typeof t==`object`&&t.r!==void 0&&t.r>200&&t.g>240&&t.b>240)return null}return e.fill&&e.fill.type===`solid`&&e.fill.color?e.fill.color:e.properties&&e.properties.fill&&e.properties.fill.color?e.properties.fill.color:e.fillColor||null}getShapeStrokeColor(e){if(!(e&&e.spPr&&e.spPr.ln||e&&e.properties&&e.properties.stroke||e&&e.stroke))return null;if(this.processor&&this.processor.getShapeStrokeColor)return this.processor.getShapeStrokeColor(e);let t=e.preservedStyle||e.style;if(t&&t.lnRef){if(this.processor&&this.processor.resolveStyleStrokeColor){let e=this.processor.resolveStyleStrokeColor(t.lnRef);if(e)return e}if(t.lnRef.color)return t.lnRef.color}return e.stroke&&e.stroke.color?e.stroke.color:e.properties&&e.properties.stroke&&e.properties.stroke.color?e.properties.stroke.color:e.strokeColor||null}getShapeLineWidth(e){return this.processor&&this.processor.getShapeLineWidth?this.processor.getShapeLineWidth(e):e&&e.spPr&&e.spPr.ln||e&&e.properties&&e.properties.stroke||e&&e.stroke?e.stroke&&e.stroke.width?e.stroke.width/914400*25.4:e.properties&&e.properties.stroke&&e.properties.stroke.width?e.properties.stroke.width/914400*25.4:e.spPr&&e.spPr.ln&&e.spPr.ln.w?e.spPr.ln.w/914400*25.4:0:0}getShapeStrokeInfo(e){return this.processor&&this.processor.getShapeStrokeInfo?this.processor.getShapeStrokeInfo(e):e.stroke?e.stroke:e.properties&&e.properties.stroke?e.properties.stroke:null}getShapeStrokeInfoLegacy(e){return this.processor&&this.processor.getShapeStrokeInfo?this.processor.getShapeStrokeInfo(e):e.stroke?e.stroke:e.properties&&e.properties.stroke?e.properties.stroke:null}getParagraphProperties(e){return e.properties||{}}getRunProperties(e,t){return{...t,...e.properties||{}}}parseColor(e){if(typeof e==`string`&&e.startsWith(`#`)){let t=e.slice(1);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:255}}return e&&typeof e==`object`?e:null}clipTextRect(e){this.graphics.AddClipRect(e.x,e.y,e.w,e.h)}getCanvasBounds(e){e.getTransform();let t,n;return e.canvas.style.width&&e.canvas.style.height?(t=parseFloat(e.canvas.style.width),n=parseFloat(e.canvas.style.height)):(t=e.canvas.width/(window.devicePixelRatio||1),n=e.canvas.height/(window.devicePixelRatio||1)),this.currentShapeBounds||{x:0,y:0,w:t,h:n}}createCanvasGradient(e,t,n){if(!n||!n.stops||n.stops.length===0)return null;let r;if(n.type===`linear`){let i=(n.angle||0)*Math.PI/180,a=t.x+t.w/2-Math.cos(i)*t.w/2,o=t.y+t.h/2-Math.sin(i)*t.h/2,s=t.x+t.w/2+Math.cos(i)*t.w/2,c=t.y+t.h/2+Math.sin(i)*t.h/2;r=e.createLinearGradient(a,o,s,c)}else if(n.type===`radial`){let n=t.x+t.w/2,i=t.y+t.h/2,a=Math.max(t.w,t.h)/2;r=e.createRadialGradient(n,i,0,n,i,a)}else return null;for(let e of n.stops){let t=this.colorToRgb(e.color);r.addColorStop(e.position,t)}return r}colorToRgbAlternative2(e){return typeof e==`string`?e:e&&typeof e==`object`?`rgba(${e.r||e.R||0}, ${e.g||e.G||0}, ${e.b||e.B||0}, ${(e.a===void 0?e.A===void 0?255:e.A:e.a)/255})`:`#000000`}findLayoutShapeForPlaceholder(e,t){if(!t||!t.placeholder||!e)return null;let n=t.placeholder;for(let t of e)if(t.placeholder){let e=t.placeholder,r=n.idx===void 0||n.idx===null||isNaN(Number(n.idx))?void 0:Number(n.idx),i=e.idx===void 0||e.idx===null||isNaN(Number(e.idx))?void 0:Number(e.idx),a=(e,t)=>{if(e===t)return!0;let n=new Set([e,t]);return!!(n.has(`title`)&&n.has(`ctrTitle`)||n.has(`body`)&&n.has(`obj`))};if(a(e.type,n.type)&&r!==void 0&&i!==void 0&&r===i||a(e.type,n.type)&&(r===void 0||i===void 0))return t}return null}resolveInheritedTextProperties(e,t=`run`,n=0){let r={};try{let i=this.buildSlideContext(),a=`otherStyle`;if(e&&e.placeholder)switch(e.placeholder.type){case`title`:case`ctrTitle`:a=`titleStyle`;break;case`body`:case`subTitle`:case`obj`:a=`bodyStyle`;break;default:a=`otherStyle`}if(i.theme&&(i.theme.fonts&&(r.fontFamily=a===`titleStyle`?i.theme.fonts.major:i.theme.fonts.minor),i.theme.colors&&i.theme.colors.text1&&(r.color=this.parseColorFromTheme(i.theme.colors.text1))),i.master&&i.master.txStyles){let e=i.master.txStyles[a];if(e){let i=this.extractTextPropertiesFromStyle(e,t,n);Object.assign(r,i)}}if(i.layout&&i.layout.txStyles){let e=i.layout.txStyles[a];if(e){let i=this.extractTextPropertiesFromStyle(e,t,n);Object.assign(r,i)}}let o=!1;if(i.layout&&i.layout.shapes){let t=this.findLayoutShapeForPlaceholder(i.layout.shapes,e);if(t&&t.textBody&&t.textBody.lstStyle){o=!0;let n=t.textBody.lstStyle,i=0;try{if(e&&e.textBody&&Array.isArray(e.textBody.paragraphs)&&e.textBody.paragraphs.length>0){let t=e.textBody.paragraphs[0]?.properties?.level;typeof t==`number`&&t>=0&&t<=8&&(i=t)}}catch{}let a=n[`lvl${i+1}pPr`]||n.lvl1pPr;a&&(a.fontSize&&(r.fontSize=a.fontSize),a.fontFamily&&(r.fontFamily=a.fontFamily),a.color&&(r.color=a.color),a.bold!==void 0&&(r.bold=a.bold),a.italic!==void 0&&(r.italic=a.italic),a.align&&(r.align=a.align),a.cap&&(r.cap=a.cap))}}if((!r.fontSize||!r.align||!r.fontFamily)&&i.master&&i.master.cSld&&i.master.cSld.spTree){let t=i.master.cSld.spTree,n=this.findLayoutShapeForPlaceholder(t,e);if(n&&n.textBody&&n.textBody.lstStyle){let e=n.textBody.lstStyle;if(e.lvl1pPr){let t=e.lvl1pPr;!r.fontSize&&t.fontSize&&(r.fontSize=t.fontSize),!r.fontFamily&&t.fontFamily&&(r.fontFamily=t.fontFamily),!r.color&&t.color&&(r.color=t.color),t.bold!==void 0&&r.bold===void 0&&(r.bold=t.bold),t.italic!==void 0&&r.italic===void 0&&(r.italic=t.italic),!r.align&&t.align&&(r.align=t.align),!r.cap&&t.cap&&(r.cap=t.cap)}}}if(e&&e.placeholder)switch(e.placeholder.type){case`title`:case`ctrTitle`:r.bold===void 0&&!o&&(r.bold=!0);break;case`subTitle`:break;case`body`:break;case`obj`:break}(e?.placeholder?.type===`title`||e?.placeholder?.type===`ctrTitle`)&&(r.align||(r.align=`ctr`),r.fontSize||(r.fontSize=44))}catch{}return r}extractTextPropertiesFromStyle(e,t=`run`,n=0){let r={};if(!e||!e.element)return r;try{e.parsed||(e.parsedData=this.parseTextStyleElement(e.element),e.parsed=!0);let i=e.parsedData;if(!i)return r;if(t===`paragraph`||t===`run`){let e=i.defPPr;e&&(e.align&&(r.align=e.align),e.lineHeight&&(r.lineHeight=e.lineHeight),e.spaceBefore&&(r.spaceBefore=e.spaceBefore),e.spaceAfter&&(r.spaceAfter=e.spaceAfter),e.bullet&&(r.bullet=e.bullet));let t=i.defRPr;t&&(t.fontSize&&(r.fontSize=t.fontSize),t.fontFamily&&(r.fontFamily=t.fontFamily),t.color&&(r.color=t.color),t.bold!==void 0&&(r.bold=t.bold),t.italic!==void 0&&(r.italic=t.italic),t.underline!==void 0&&(r.underline=t.underline),t.strike!==void 0&&(r.strike=t.strike),t.cap&&(r.cap=t.cap));let a=i[`lvl${n+1}pPr`];if(a&&(a.align&&(r.align=a.align),a.lineHeight&&(r.lineHeight=a.lineHeight),a.bullet&&(r.bullet=a.bullet),a.leftMargin!==void 0&&(r.leftMargin=a.leftMargin),a.indent!==void 0&&(r.hangingIndent=a.indent),a.spaceBefore!==void 0&&(r.spaceBefore=a.spaceBefore),a.spaceBeforePct!==void 0&&(r.spaceBeforePct=a.spaceBeforePct),a.spaceAfter!==void 0&&(r.spaceAfter=a.spaceAfter),a.spaceAfterPct!==void 0&&(r.spaceAfterPct=a.spaceAfterPct),a.defRPr)){let e=a.defRPr;e.fontSize&&(r.fontSize=e.fontSize),e.fontFamily&&(r.fontFamily=e.fontFamily),e.color&&(r.color=e.color),e.bold!==void 0&&(r.bold=e.bold),e.italic!==void 0&&(r.italic=e.italic),e.cap&&(r.cap=e.cap)}}}catch{}return r}parseColorFromTheme(e){if(typeof e==`string`&&e.startsWith(`#`)){let t=e.substring(1);return{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:255}}return null}parseTextStyleElement(e){let t={};if(!e)return t;try{let n=e.querySelector(`defPPr, a\\:defPPr`);n&&(t.defPPr=this.parseStyleParagraphProperties(n));let r=e.querySelector(`defRPr, a\\:defRPr`)||e.querySelector(`defPPr > defRPr, a\\:defPPr > a\\:defRPr`);r&&(t.defRPr=this.parseStyleRunProperties(r));for(let n=1;n<=9;n++){let r=e.querySelector(`lvl${n}pPr, a\\:lvl${n}pPr`);if(r){let e=this.parseStyleParagraphProperties(r),i=r.querySelector(`defRPr, a\\:defRPr`);i&&(e.defRPr=this.parseStyleRunProperties(i)),t[`lvl${n}pPr`]=e}}}catch{}return t}parseStyleParagraphProperties(e){let t={};if(!e)return t;try{let n=e.getAttribute(`algn`)||e.getAttribute(`align`);n&&(t.align={l:`left`,left:`left`,ctr:`center`,center:`center`,r:`right`,right:`right`,just:`justify`,justify:`justify`}[n]||n);let r=e.getAttribute(`lnSpc`)||e.getAttribute(`lineHeight`);r&&(t.lineHeight=parseInt(r)||120);let i=e.querySelector(`spcBef, a\\:spcBef`);if(i){let e=i.querySelector(`spcPct, a\\:spcPct`),n=i.querySelector(`spcPts, a\\:spcPts`);e?t.spaceBeforePct=parseInt(e.getAttribute(`val`))/1e5:n&&(t.spaceBefore=parseInt(n.getAttribute(`val`))*127)}let a=e.querySelector(`spcAft, a\\:spcAft`);if(a){let e=a.querySelector(`spcPct, a\\:spcPct`),n=a.querySelector(`spcPts, a\\:spcPts`);e?t.spaceAfterPct=parseInt(e.getAttribute(`val`))/1e5:n&&(t.spaceAfter=parseInt(n.getAttribute(`val`))*127)}let o=e.getAttribute(`marL`)||e.getAttribute(`leftMargin`);o&&(t.leftMargin=parseInt(o)||0);let s=e.getAttribute(`marR`)||e.getAttribute(`rightMargin`);s&&(t.rightMargin=parseInt(s)||0);let c=e.getAttribute(`indent`);c&&(t.indent=parseInt(c)||0);let l=e.querySelector(`buChar, a\\:buChar`);if(l){let e=l.getAttribute(`char`);e&&(t.bullet={type:`character`,char:e})}let u=e.querySelector(`buAutoNum, a\\:buAutoNum`);if(u){let e=u.getAttribute(`type`)||`arabicPeriod`,n=u.getAttribute(`startAt`)||`1`;t.bullet={type:`autoNumber`,subType:e,startAt:parseInt(n)}}e.querySelector(`buNone, a\\:buNone`)&&(t.bullet={type:`none`})}catch{}return t}parseStyleRunProperties(e){let t={};if(!e)return t;try{let n=e.getAttribute(`sz`)||e.getAttribute(`fontSize`);if(n){let e=parseInt(n);t.fontSize=e>100?e/100:e}let r=e.getAttribute(`typeface`)||e.getAttribute(`fontFamily`);r&&(t.fontFamily=r);let i=e.getAttribute(`b`)||e.getAttribute(`bold`);i!==null&&(t.bold=i===`1`||i===`true`||i===!0);let a=e.getAttribute(`i`)||e.getAttribute(`italic`);a!==null&&(t.italic=a===`1`||a===`true`||a===!0);let o=e.getAttribute(`u`)||e.getAttribute(`underline`);o!==null&&(t.underline=o!==`none`&&o!==``&&o!==`0`&&o!==`false`);let s=e.getAttribute(`strike`)||e.getAttribute(`strikethrough`);s!==null&&(t.strike=s!==`noStrike`&&s!==`0`&&s!==`false`&&s!==!1);let c=e.getAttribute(`cap`)||e.getAttribute(`capitalization`);c&&(t.cap=c);let l=e.querySelector(`solidFill, a\\:solidFill`)||e.querySelector(`schemeClr, a\\:schemeClr`)||e.querySelector(`srgbClr, a\\:srgbClr`);l&&(t.color=this.parseColorFromElement(l));let u=e.getAttribute(`spc`)||e.getAttribute(`letterSpacing`);u&&(t.letterSpacing=parseInt(u)||0)}catch{}return t}parseColorFromElement(e){try{let t=e.querySelector(`srgbClr, a\\:srgbClr`);if(t){let e=t.getAttribute(`val`);if(e&&e.length===6)return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:255}}let n=e.querySelector(`schemeClr, a\\:schemeClr`);if(n)return{}[n.getAttribute(`val`)]||null}catch{}return null}buildSlideContext(){let e={};return this.currentSlide&&(e.slide=this.currentSlide,(this.currentSlide.layout||this.currentSlide.Layout)&&(e.layout=this.currentSlide.layout||this.currentSlide.Layout,e.layout.commonSlideData&&e.layout.commonSlideData.shapeTree?e.layout.shapes=e.layout.commonSlideData.shapeTree:e.layout.cSld&&e.layout.cSld.spTree&&(e.layout.shapes=e.layout.cSld.spTree),(e.layout.master||e.layout.Master)&&(e.master=e.layout.master||e.layout.Master)),(this.currentSlide.theme||this.currentSlide.Theme)&&(e.theme=this.currentSlide.theme||this.currentSlide.Theme)),e}getCurrentShape(){return this.currentRenderingShape||null}applyPreciseTransform(e,t=1,n=0){return Math.round(e*t+n)}setCurrentRenderingShape(e){this.currentRenderingShape=e}}class i{constructor(){this.cache=new Map}processShapeGeometry(e){let t=this.generateCacheKey(e);if(this.cache.has(t))return this.cache.get(t);let n=null;return e.geometry&&e.geometry.type===`custom`?n=this.processCustomGeometry(e.geometry):e.properties&&e.properties.geometry&&e.properties.geometry.type===`custom`&&(n=this.processCustomGeometry(e.properties.geometry)),n&&this.cache.set(t,n),n}processCustomGeometry(e){if(!e.pathLst||e.pathLst.length===0)return null;let t={type:`custom`,pathLst:[]};for(let n of e.pathLst){let e=this.processPath(n);e&&t.pathLst.push(e)}return t}processPath(e){return!e.commands||e.commands.length===0?null:{w:e.w||100,h:e.h||100,commands:e.commands.map(e=>this.normalizeCommand(e)),fill:e.fill!==!1,stroke:e.stroke!==!1}}normalizeCommand(e){let t={...e};switch(e.type){case`M`:case`moveTo`:t.type=`moveTo`;break;case`L`:case`lineTo`:t.type=`lineTo`;break;case`C`:case`curveTo`:case`cubicBezTo`:t.type=`cubicBezTo`;break;case`Q`:case`quadTo`:case`quadBezTo`:t.type=`quadBezTo`;break;case`A`:case`arcTo`:t.type=`arcTo`;break;case`Z`:case`close`:t.type=`close`;break}return t}generateCacheKey(e){let t=e.geometry||e.properties?.geometry;if(!t)return`no-geometry`;let n=t.pathLst||[];return`custom-${JSON.stringify(n).substring(0,100)}-${n.length}`}}if(typeof window<`u`){window.CanvasGraphicsAdapter=n,window.CDrawingDocument=r,window.GraphicsMatrix=t;try{e()}catch{}}return typeof Logger>`u`&&typeof window<`u`&&(window.Logger=class{constructor(e){this.name=e}log(e,t,n){}logError(e,t){}}),_u}yu();var bu={exports:{}};bu.exports;var xu;function Su(){return xu?bu.exports:(xu=1,(function(e){let t={rect:1,roundRect:2,ellipse:3,diamond:4,triangle:5,rtTriangle:6,parallelogram:7,trapezoid:8,hexagon:9,octagon:10,plus:11,star5:12,rightArrow:13,leftArrow:66,upArrow:68,downArrow:67,leftRightArrow:69,upDownArrow:70,quadArrow:76,heart:74,lightningBolt:73,can:22,cube:16,donut:23,arc:19,line:20,plaque:21,bevel:1e3,frame:75,pentagon:56,star4:1e3,star6:1e3,star8:58,star12:1e3,star16:59,star24:1e3,star32:60,teardrop:1e3,flowChartProcess:1e3,flowChartDecision:4,flowChartTerminator:2,flowChartInputOutput:7,flowChartDocument:1e3,flowChartMultidocument:1e3,flowChartPreparation:1e3,flowChartManualInput:1e3,flowChartManualOperation:1e3,flowChartConnector:3,flowChartOffpageConnector:1e3,flowChartPunchedCard:1e3,flowChartPunchedTape:1e3,flowChartSummingJunction:1e3,flowChartOr:1e3,flowChartCollate:1e3,flowChartSort:1e3,flowChartExtract:1e3,flowChartMerge:1e3,flowChartStoredData:1e3,flowChartDelay:1e3,flowChartSequentialAccessStorage:1e3,flowChartMagneticDisk:1e3,flowChartDirectAccessStorage:1e3,flowChartDisplay:1e3,flowChartInternalStorage:1e3,flowChartAlternateProcess:1e3,flowChartMagneticDrum:1e3,flowChartMagneticTape:1e3,callout1:1e3,callout2:1e3,callout3:1e3,accentCallout1:1e3,accentCallout2:1e3,accentCallout3:1e3,borderCallout1:1e3,borderCallout2:1e3,borderCallout3:1e3,accentBorderCallout1:1e3,accentBorderCallout2:1e3,accentBorderCallout3:1e3,ribbon:1e3,ribbon2:1e3,ellipseRibbon:1e3,ellipseRibbon2:1e3,leftRightRibbon:1e3,verticalScroll:1e3,horizontalScroll:1e3,wave:1e3,doubleWave:1e3,bentArrow:1e3,uturnArrow:1e3,circularArrow:1e3,leftUpArrow:1e3,bentUpArrow:1e3,curvedRightArrow:1e3,curvedLeftArrow:1e3,curvedUpArrow:1e3,curvedDownArrow:1e3,stripedRightArrow:1e3,notchedRightArrow:1e3,blockArc:1e3,swooshArrow:1e3,leftBracket:1e3,rightBracket:1e3,leftBrace:1e3,rightBrace:1e3,bracketPair:1e3,bracePair:1e3,straightConnector1:20,bentConnector2:1e3,bentConnector3:1e3,bentConnector4:1e3,bentConnector5:1e3,curvedConnector2:1e3,curvedConnector3:1e3,curvedConnector4:1e3,curvedConnector5:1e3,sun:1e3,moon:1e3,cloud:1e3,irregularSeal1:1e3,irregularSeal2:1e3,foldedCorner:1e3,smileyFace:1e3,noSmoking:1e3,mathPlus:11,mathMinus:1e3,mathMultiply:1e3,mathDivide:1e3,mathEqual:1e3,mathNotEqual:1e3,actionButtonBlank:1e3,actionButtonHome:1e3,actionButtonHelp:1e3,actionButtonInformation:1e3,actionButtonForwardNext:1e3,actionButtonBackPrevious:1e3,actionButtonEnd:1e3,actionButtonBeginning:1e3,actionButtonReturn:1e3,actionButtonDocument:1e3,actionButtonSound:1e3,actionButtonMovie:1e3},n={RECTANGLE:`rect`,ELLIPSE:`ellipse`,LINE:`line`,ROUND_RECTANGLE:`roundRect`,RIGHT_ARROW:`rightArrow`,LEFT_ARROW:`leftArrow`,UP_ARROW:`upArrow`,DOWN_ARROW:`downArrow`,LEFT_RIGHT_ARROW:`leftRightArrow`,UP_DOWN_ARROW:`upDownArrow`,QUAD_ARROW:`quadArrow`,LEFT_RIGHT_UP_ARROW:`leftRightUpArrow`,BENT_ARROW:`bentArrow`,UTURN_ARROW:`uturnArrow`,LEFT_UP_ARROW:`leftUpArrow`,BENT_UP_ARROW:`bentUpArrow`,CURVED_RIGHT_ARROW:`curvedRightArrow`,CURVED_LEFT_ARROW:`curvedLeftArrow`,CURVED_UP_ARROW:`curvedUpArrow`,CURVED_DOWN_ARROW:`curvedDownArrow`,STRIPED_RIGHT_ARROW:`stripedRightArrow`,NOTCHED_RIGHT_ARROW:`notchedRightArrow`,BLOCK_ARC:`blockArc`,SWOOSH_ARROW:`swooshArrow`,CIRCULAR_ARROW:`circularArrow`,FLOWCHART_PROCESS:`flowChartProcess`,FLOWCHART_DECISION:`flowChartDecision`,FLOWCHART_START_END:`flowChartTerminator`,FLOWCHART_INPUT_OUTPUT:`flowChartInputOutput`,FLOWCHART_PREDEFINED_PROCESS:`flowChartPredefinedProcess`,FLOWCHART_INTERNAL_STORAGE:`flowChartInternalStorage`,FLOWCHART_DOCUMENT:`flowChartDocument`,FLOWCHART_MULTIDOCUMENT:`flowChartMultidocument`,FLOWCHART_PREPARATION:`flowChartPreparation`,FLOWCHART_MANUAL_INPUT:`flowChartManualInput`,FLOWCHART_MANUAL_OPERATION:`flowChartManualOperation`,FLOWCHART_CONNECTOR:`flowChartConnector`,FLOWCHART_OFFPAGE_CONNECTOR:`flowChartOffpageConnector`,FLOWCHART_PUNCHED_CARD:`flowChartPunchedCard`,FLOWCHART_PUNCHED_TAPE:`flowChartPunchedTape`,FLOWCHART_SUMMING_JUNCTION:`flowChartSummingJunction`,FLOWCHART_OR:`flowChartOr`,FLOWCHART_COLLATE:`flowChartCollate`,FLOWCHART_SORT:`flowChartSort`,FLOWCHART_EXTRACT:`flowChartExtract`,FLOWCHART_MERGE:`flowChartMerge`,FLOWCHART_STORED_DATA:`flowChartStoredData`,FLOWCHART_DELAY:`flowChartDelay`,FLOWCHART_SEQUENTIAL_ACCESS_STORAGE:`flowChartSequentialAccessStorage`,FLOWCHART_MAGNETIC_DISK:`flowChartMagneticDisk`,FLOWCHART_DIRECT_ACCESS_STORAGE:`flowChartDirectAccessStorage`,FLOWCHART_DISPLAY:`flowChartDisplay`,FLOWCHART_ALTERNATE_PROCESS:`flowChartAlternateProcess`,FLOWCHART_MAGNETIC_DRUM:`flowChartMagneticDrum`,FLOWCHART_MAGNETIC_TAPE:`flowChartMagneticTape`,CALLOUT_1:`callout1`,CALLOUT_2:`callout2`,CALLOUT_3:`callout3`,ACCENT_CALLOUT_1:`accentCallout1`,ACCENT_CALLOUT_2:`accentCallout2`,ACCENT_CALLOUT_3:`accentCallout3`,BORDER_CALLOUT_1:`borderCallout1`,BORDER_CALLOUT_2:`borderCallout2`,BORDER_CALLOUT_3:`borderCallout3`,ACCENT_BORDER_CALLOUT_1:`accentBorderCallout1`,ACCENT_BORDER_CALLOUT_2:`accentBorderCallout2`,ACCENT_BORDER_CALLOUT_3:`accentBorderCallout3`,STAR_4:`star4`,STAR_5:`star5`,STAR_6:`star6`,STAR_8:`star8`,STAR_12:`star12`,STAR_16:`star16`,STAR_24:`star24`,STAR_32:`star32`,TRIANGLE:`triangle`,RIGHT_TRIANGLE:`rtTriangle`,DIAMOND:`diamond`,PENTAGON:`pentagon`,HEXAGON:`hexagon`,HEPTAGON:`heptagon`,OCTAGON:`octagon`,DECAGON:`decagon`,DODECAGON:`dodecagon`,PARALLELOGRAM:`parallelogram`,TRAPEZOID:`trapezoid`,PLUS:`plus`,CROSS:`cross`,STRAIGHT_CONNECTOR_1:`straightConnector1`,BENT_CONNECTOR_2:`bentConnector2`,BENT_CONNECTOR_3:`bentConnector3`,BENT_CONNECTOR_4:`bentConnector4`,BENT_CONNECTOR_5:`bentConnector5`,CURVED_CONNECTOR_2:`curvedConnector2`,CURVED_CONNECTOR_3:`curvedConnector3`,CURVED_CONNECTOR_4:`curvedConnector4`,CURVED_CONNECTOR_5:`curvedConnector5`,RIBBON:`ribbon`,RIBBON_2:`ribbon2`,ELLIPSE_RIBBON:`ellipseRibbon`,ELLIPSE_RIBBON_2:`ellipseRibbon2`,LEFT_RIGHT_RIBBON:`leftRightRibbon`,VERTICAL_SCROLL:`verticalScroll`,HORIZONTAL_SCROLL:`horizontalScroll`,WAVE:`wave`,DOUBLE_WAVE:`doubleWave`,LEFT_BRACKET:`leftBracket`,RIGHT_BRACKET:`rightBracket`,LEFT_BRACE:`leftBrace`,RIGHT_BRACE:`rightBrace`,BRACKET_PAIR:`bracketPair`,BRACE_PAIR:`bracePair`,FRAME:`frame`,L_SHAPE:`lShape`,DIAGONAL_STRIPE:`diagStripe`,CHORD:`chord`,ARC:`arc`,CUBE:`cube`,CAN:`can`,CONE:`cone`,PYRAMID:`pyramid`,HEART:`heart`,LIGHTNING_BOLT:`lightningBolt`,SUN:`sun`,MOON:`moon`,CLOUD:`cloud`,SMILEY_FACE:`smileyFace`,IRREGULAR_SEAL_1:`irregularSeal1`,IRREGULAR_SEAL_2:`irregularSeal2`,FOLDED_CORNER:`foldedCorner`,BEVEL:`bevel`,DONUT:`donut`,NO_SMOKING:`noSmoking`,BLOCK_ARC_2:`blockArc2`,PLUS_MATH:`mathPlus`,MINUS:`mathMinus`,MULTIPLY:`mathMultiply`,DIVIDE:`mathDivide`,EQUAL:`mathEqual`,NOT_EQUAL:`mathNotEqual`,ACTION_BUTTON_BLANK:`actionButtonBlank`,ACTION_BUTTON_HOME:`actionButtonHome`,ACTION_BUTTON_HELP:`actionButtonHelp`,ACTION_BUTTON_INFORMATION:`actionButtonInformation`,ACTION_BUTTON_FORWARD_NEXT:`actionButtonForwardNext`,ACTION_BUTTON_BACK_PREVIOUS:`actionButtonBackPrevious`,ACTION_BUTTON_END:`actionButtonEnd`,ACTION_BUTTON_BEGINNING:`actionButtonBeginning`,ACTION_BUTTON_RETURN:`actionButtonReturn`,ACTION_BUTTON_DOCUMENT:`actionButtonDocument`,ACTION_BUTTON_SOUND:`actionButtonSound`,ACTION_BUTTON_MOVIE:`actionButtonMovie`,TEARDROP:`teardrop`};class r{constructor(e){this.setupHighResolutionCanvas(e),this.m_oContext=e.getContext(`2d`),this.m_dDpiX=96,this.m_dDpiY=96,this.m_dWidthMM=210,this.m_dHeightMM=297,e.style.width&&e.style.height?(this.m_dWidth=parseFloat(e.style.width),this.m_dHeight=parseFloat(e.style.height)):(this.m_dWidth=e.width/(window.devicePixelRatio||1),this.m_dHeight=e.height/(window.devicePixelRatio||1)),this.m_oTransform=new a,this.devicePixelRatio=window.devicePixelRatio||1,this.m_oCoordTransform=new a,this.m_oFullTransform=new a,this.m_oTransformStack=[],this.m_oClipStack=[],this.m_oPen=new o,this.m_oBrush=new s,this.m_oFont=new c,this.m_bIntegerGrid=!1,this.m_bGlobalAlpha=!1,this.m_dGlobalAlpha=1,this.m_bIsClipping=!1,this.m_oClipRect=null,this.m_oPath=null,this.m_bIsDrawing=!1,this.m_oEnhancedGeometryProcessor=new f,this.m_oCustomGeometryProcessor=new GeometryProcessor,this.calculateCoordTransform(),this.calculateFullTransform(),this.m_oContext.lineCap=`round`,this.m_oContext.lineJoin=`round`,this.m_oContext.textBaseline=`alphabetic`,this.m_oContext.textAlign=`left`}setupHighResolutionCanvas(e){let t=e.getContext(`2d`),n=window.devicePixelRatio||1,r=e.clientWidth||e.width,i=e.clientHeight||e.height;e.width=r*n,e.height=i*n,e.style.width=r+`px`,e.style.height=i+`px`,t.scale(n,n),t.imageSmoothingEnabled=!0,t.imageSmoothingQuality=`high`}drawImageHighRes(e,t,n,r,i,a=0,o=0,s=null,c=null){if(!(!this.m_oContext||!e)){this.m_oContext.save(),this.m_oContext.imageSmoothingEnabled=!0,this.m_oContext.imageSmoothingQuality=`high`;try{s!==null&&c!==null?this.m_oContext.drawImage(e,a,o,s,c,t,n,r,i):this.m_oContext.drawImage(e,t,n,r,i)}catch{}finally{this.m_oContext.restore()}}}drawImage(e,t,n,r,i){this.drawImageHighRes(e,t,n,r,i)}drawPresetGeometry(e,n,r,i,a,o,s,c=1,l=null,u={}){if(this.m_oContext){this.SaveGrState();try{let d=t[e]||1e3;d===1e3?this.drawCustomShape(e,n,r,i,a,o,s,c,l,u):this.drawStandardPresetShape(d,e,n,r,i,a,o,s,c,l,u)}catch{this.drawRectangle(n,r,i,a,o,s,c,l)}finally{this.RestoreGrState()}}}drawStandardPresetShape(e,t,n,r,i,a,o,s,c,l,u){let d=this.m_oEnhancedGeometryProcessor.processPresetGeometry(t,21600,21600,u);d?this.renderEnhancedGeometry(d,n,r,i,a,o,s,c,l):this.drawBasicShape(t,n,r,i,a,o,s,c,l)}renderEnhancedGeometry(e,t,n,r,i,a,o,s,c){let l=this.m_oContext,u=e.getPathList(),d=r/e.width,f=i/e.height;l.save(),l.translate(t,n),l.scale(d,f),u.forEach(l=>{this.renderEnhancedPath(l,e,a,o,s,c,{x:t,y:n,w:r,h:i})}),l.restore()}renderEnhancedPath(e,t,n,r,i,a,o=null){let s=this.m_oContext;if(s.beginPath(),e.commands.forEach(e=>{switch(e.type){case`M`:s.moveTo(e.args[0],e.args[1]);break;case`L`:s.lineTo(e.args[0],e.args[1]);break;case`C`:s.bezierCurveTo(e.args[0],e.args[1],e.args[2],e.args[3],e.args[4],e.args[5]);break;case`Q`:s.quadraticCurveTo(e.args[0],e.args[1],e.args[2],e.args[3]);break;case`A`:this.renderArcCommand(s,e.args);break;case`Z`:s.closePath();break}}),e.fill!==`none`&&n){if(n&&typeof n==`object`&&n.type&&n.stops){let e=o||{x:0,y:0,w:200,h:50},t=this.createGradient(e.x,e.y,e.w,e.h,n);t?s.fillStyle=t:s.fillStyle=this.colorToRgb(n.stops[0]?.color||{r:0,g:0,b:0})}else s.fillStyle=this.colorToRgb(n);s.fill()}if(e.stroke&&r){s.strokeStyle=this.colorToRgb(r);let e=CoordinateTransform.mmToPixels(i||1),n=t?t.width:21600,c=t?t.height:21600,l=o&&o.w>0?o.w/n:1,u=o&&o.h>0?o.h/c:1;s.lineWidth=e/(Math.min(l,u)||1),a&&this.applyStrokeInfo(a),s.stroke()}}renderArcCommand(e,t){let[n,r,i,a,o,s,c]=t,l=this.getCurrentPoint(e);if(l)try{let t=(l.x+s)/2,i=(l.y+c)/2,a=Math.min(n,r),u=Math.atan2(l.y-i,l.x-t),d=Math.atan2(c-i,s-t);e.arc(t,i,a,u,d,!o)}catch{e.lineTo(s,c)}}getCurrentPoint(e){return{x:0,y:0}}drawCustomShape(e,t,n,r,i,a,o,s,c,l){let u=this.m_oCustomGeometryProcessor.processCustomShape(e,{x:t,y:n,width:r,height:i,adjustments:l});u&&u.pathLst?this.drawCustomGeometry(u,t,n,r,i,a,o,s):this.drawBasicShape(e,t,n,r,i,a,o,s,c)}applyStrokeInfo(e){if(!e||!this.m_oContext)return;let t=this.m_oContext;if(e.dashArray&&e.dashArray.length>0){let n=t.lineWidth||1,r=e.dashArray.map(e=>e*n);t.setLineDash(r)}let n=e.lineCap||e.cap;if(n)switch(n){case`rnd`:case`round`:t.lineCap=`round`;break;case`sq`:case`square`:t.lineCap=`square`;break;default:t.lineCap=`butt`;break}let r=e.lineJoin||e.join;if(r)switch(r){case`round`:t.lineJoin=`round`;break;case`bevel`:t.lineJoin=`bevel`;break;default:t.lineJoin=`miter`;break}e.miterLimit&&(t.miterLimit=e.miterLimit)}drawBasicShape(e,t,n,r,i,a,o,s,c){let l=this.m_oContext;switch(l.save(),l.beginPath(),e){case`rect`:case`rectangle`:l.rect(t,n,r,i);break;case`ellipse`:case`oval`:l.ellipse(t+r/2,n+i/2,r/2,i/2,0,0,2*Math.PI);break;case`roundRect`:this.drawRoundRectPath(l,t,n,r,i,Math.min(r,i)*.16667);break;case`triangle`:this.drawTrianglePath(l,t,n,r,i);break;case`diamond`:this.drawDiamondPath(l,t,n,r,i);break;case`pentagon`:this.drawPentagonPath(l,t,n,r,i);break;case`hexagon`:this.drawHexagonPath(l,t,n,r,i);break;case`octagon`:this.drawOctagonPath(l,t,n,r,i);break;case`star`:case`star5`:this.drawStarPath(l,t,n,r,i);break;case`rightArrow`:this.drawRightArrowPath(l,t,n,r,i);break;case`leftArrow`:this.drawLeftArrowPath(l,t,n,r,i);break;case`upArrow`:this.drawUpArrowPath(l,t,n,r,i);break;case`downArrow`:this.drawDownArrowPath(l,t,n,r,i);break;default:l.rect(t,n,r,i);break}a&&(l.fillStyle=this.colorToRgb(a),l.fill()),o&&(l.strokeStyle=this.colorToRgb(o),l.lineWidth=CoordinateTransform.mmToPixels(s||1),c&&this.applyStrokeInfo(c),l.stroke()),l.restore()}drawCustomGeometry(e,t,n,r,i,a,o,s){try{if(!e||!e.pathLst||e.pathLst.length===0)return;this.m_oContext.save(),this.m_oContext.translate(t,n);let c=e.coordSize?.width||1e3,l=e.coordSize?.height||1e3;this.m_oContext.scale(r/c,i/l),e.pathLst.forEach((e,t)=>{this.drawGeometryPath(e,a,o,s)}),this.m_oContext.restore()}catch{this.m_oContext.restore()}}drawGeometryPath(e,t,n,r){!e||!e.commands||e.commands.length===0||(this.m_oContext.beginPath(),e.commands.forEach(n=>{switch(n.type){case`moveTo`:this.m_oContext.moveTo(n.x,n.y);break;case`lineTo`:this.m_oContext.lineTo(n.x,n.y);break;case`curveTo`:this.m_oContext.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y);break;case`close`:t&&e.fill!==!1&&e.fill!==`none`&&this.m_oContext.closePath();break;case`arcTo`:this.m_oContext.arcTo(n.x1,n.y1,n.x2,n.y2,n.radius);break;case`quadraticCurveTo`:this.m_oContext.quadraticCurveTo(n.x1,n.y1,n.x,n.y);break}}),n&&e.stroke!==!1&&(this.m_oContext.strokeStyle=this.colorToRgb(n),this.m_oContext.lineWidth=CoordinateTransform.mmToPixels(r||1),this.m_oContext.stroke()),t&&e.fill!==!1&&e.fill!==`none`&&(this.m_oContext.fillStyle=this.colorToRgb(t),this.m_oContext.fill()))}drawShapePath(e,t,n,r,i){!e||!e.commands||(this.m_oContext.beginPath(),e.commands.forEach(e=>{switch(e.type){case`M`:this.m_oContext.moveTo(e.x,e.y);break;case`L`:this.m_oContext.lineTo(e.x,e.y);break;case`C`:this.m_oContext.bezierCurveTo(e.x1,e.y1,e.x2,e.y2,e.x,e.y);break;case`Q`:this.m_oContext.quadraticCurveTo(e.x1,e.y1,e.x,e.y);break;case`A`:this.drawArcCommand(e);break;case`Z`:t&&path.fill!==!1&&path.fill!==`none`&&this.m_oContext.closePath();break}}),t&&(this.m_oContext.fillStyle=this.colorToRgb(t),this.m_oContext.fill()),n&&(this.m_oContext.strokeStyle=this.colorToRgb(n),this.m_oContext.lineWidth=r||1,i&&this.applyStrokeInfo(i),this.m_oContext.stroke()))}applyStrokeInfoAlternative(e){e&&(e.dashArray&&e.dashArray.length>0&&this.m_oContext.setLineDash(e.dashArray),e.lineCap&&(this.m_oContext.lineCap=e.lineCap),e.lineJoin&&(this.m_oContext.lineJoin=e.lineJoin),e.miterLimit&&(this.m_oContext.miterLimit=e.miterLimit))}drawArcCommand(e){let t=e.cx||e.x,n=e.cy||e.y,r=e.r||e.radius,i=e.startAngle||0,a=e.endAngle||Math.PI*2,o=e.counterclockwise||!1;this.m_oContext.arc(t,n,r,i,a,o)}drawRectangle(e,t,n,r,i,a,o,s){if(this.m_oContext){if(this.m_oContext.save(),i){if(typeof i==`object`&&i.type&&i.stops){let a=this.createGradient(e,t,n,r,i);this.m_oContext.fillStyle=a||this.colorToRgb(i.stops[0]?.color||{r:0,g:0,b:0})}else this.m_oContext.fillStyle=this.colorToRgb(i);this.m_oContext.fillRect(e,t,n,r)}a&&(this.m_oContext.strokeStyle=this.colorToRgb(a),this.m_oContext.lineWidth=o||1,s&&this.applyStrokeInfo(s),this.m_oContext.strokeRect(e,t,n,r)),this.m_oContext.restore()}}drawEllipse(e,t,n,r,i,a,o){if(!this.m_oContext)return;this.m_oContext.save(),this.m_oContext.beginPath();let s=e+n/2,c=t+r/2,l=n/2,u=r/2;this.m_oContext.ellipse(s,c,l,u,0,0,2*Math.PI),i&&(this.m_oContext.fillStyle=this.colorToRgb(i),this.m_oContext.fill()),a&&(this.m_oContext.strokeStyle=this.colorToRgb(a),this.m_oContext.lineWidth=o||1,this.m_oContext.stroke()),this.m_oContext.restore()}drawRoundedRectangle(e,t,n,r,i,a,o,s){if(!this.m_oContext)return;this.m_oContext.save(),this.m_oContext.beginPath();let c=Math.min(n,r)/2;i=Math.min(i,c),this.m_oContext.moveTo(e+i,t),this.m_oContext.lineTo(e+n-i,t),this.m_oContext.quadraticCurveTo(e+n,t,e+n,t+i),this.m_oContext.lineTo(e+n,t+r-i),this.m_oContext.quadraticCurveTo(e+n,t+r,e+n-i,t+r),this.m_oContext.lineTo(e+i,t+r),this.m_oContext.quadraticCurveTo(e,t+r,e,t+r-i),this.m_oContext.lineTo(e,t+i),this.m_oContext.quadraticCurveTo(e,t,e+i,t),this.m_oContext.closePath(),a&&(this.m_oContext.fillStyle=this.colorToRgb(a),this.m_oContext.fill()),o&&(this.m_oContext.strokeStyle=this.colorToRgb(o),this.m_oContext.lineWidth=s||1,this.m_oContext.stroke()),this.m_oContext.restore()}drawTriangle(e,t,n,r,i,a,o){this.m_oContext&&(this.m_oContext.save(),this.m_oContext.beginPath(),this.m_oContext.moveTo(e+n/2,t),this.m_oContext.lineTo(e+n,t+r),this.m_oContext.lineTo(e,t+r),this.m_oContext.closePath(),i&&(this.m_oContext.fillStyle=this.colorToRgb(i),this.m_oContext.fill()),a&&(this.m_oContext.strokeStyle=this.colorToRgb(a),this.m_oContext.lineWidth=o||1,this.m_oContext.stroke()),this.m_oContext.restore())}drawDiamond(e,t,n,r,i,a,o){if(!this.m_oContext)return;this.m_oContext.save(),this.m_oContext.beginPath();let s=e+n/2,c=t+r/2;this.m_oContext.moveTo(s,t),this.m_oContext.lineTo(e+n,c),this.m_oContext.lineTo(s,t+r),this.m_oContext.lineTo(e,c),this.m_oContext.closePath(),i&&(this.m_oContext.fillStyle=this.colorToRgb(i),this.m_oContext.fill()),a&&(this.m_oContext.strokeStyle=this.colorToRgb(a),this.m_oContext.lineWidth=o||1,this.m_oContext.stroke()),this.m_oContext.restore()}drawRegularPolygon(e,t,n,r,i,a,o,s){if(!this.m_oContext||i<3)return;this.m_oContext.save(),this.m_oContext.beginPath();let c=e+n/2,l=t+r/2,u=Math.min(n,r)/2;for(let e=0;e{let t=(e||``).toString().toLowerCase();return t===`lg`||t===`large`?3:t===`med`||t===`medium`?2:t===`sm`||t===`small`?1:2},u=o&&o.headEnd?{type:o.headEnd.type||o.headEnd.val||`none`,lengthScale:l(o.headEnd.len),widthScale:l(o.headEnd.w)}:null,d=o&&o.tailEnd?{type:o.tailEnd.type||o.tailEnd.val||`none`,lengthScale:l(o.tailEnd.len),widthScale:l(o.tailEnd.w)}:null;if(u&&(u.type===`none`||u.type===null||u.type===void 0)&&(u=null),d&&(d.type===`none`||d.type===null||d.type===void 0)&&(d=null),u||d){let i=Math.atan2(r-t,n-e),a=s.getTransform();Math.sqrt(a.a*a.a+a.b*a.b);let o=s.lineWidth*3,l=s.lineWidth*2.5;if(u){let n=u.lengthScale||1,r=u.widthScale||1;this._drawArrowHead(s,e,t,i+Math.PI,o*n,l*r,c,s.lineWidth,u.type)}if(d){let e=d.lengthScale||1,t=d.widthScale||1;this._drawArrowHead(s,n,r,i,o*e,l*t,c,s.lineWidth,d.type)}}s.restore()}_drawArrowHead(e,t,n,r,i,a,o,s,c=`triangle`){e.save(),e.translate(t,n),e.rotate(r);let l=a/2,u=(c||`triangle`).toString().toLowerCase();switch(e.beginPath(),u){case`open`:e.moveTo(0,0),e.lineTo(-i,-l),e.moveTo(0,0),e.lineTo(-i,l);break;case`stealth`:e.moveTo(0,0),e.lineTo(-i,-(l*.5)),e.lineTo(-i*.85,0),e.lineTo(-i,l*.5),e.closePath();break;case`diamond`:e.moveTo(0,0),e.lineTo(-i/2,-l),e.lineTo(-i,0),e.lineTo(-i/2,l),e.closePath();break;case`oval`:e.ellipse(-i/2,0,i/2,l,0,0,Math.PI*2);break;default:e.moveTo(0,0),e.lineTo(-i,-l),e.lineTo(-i,l),e.closePath();break}let d=typeof o==`string`?o:this.colorToRgb(o)||`rgba(0,0,0,1)`;u===`open`?(e.strokeStyle=d,e.lineWidth=s||1,e.stroke()):(e.fillStyle=d,e.fill(),e.strokeStyle=d,e.lineWidth=Math.max(.5,(s||1)*.3),e.stroke()),e.restore()}darkenColor(e,t){if(typeof e==`string`){let n=this.hexToRgb(e);return{r:Math.floor(n.r*t),g:Math.floor(n.g*t),b:Math.floor(n.b*t),a:n.a}}else if(e.r!==void 0)return{r:Math.floor(e.r*t),g:Math.floor(e.g*t),b:Math.floor(e.b*t),a:e.a};return e}colorToRgb(e){if(typeof e==`string`)return e;if(e&&e.r!==void 0){let t=e.a===void 0?1:e.a/255;return`rgba(${e.r}, ${e.g}, ${e.b}, ${t})`}return null}createGradient(e,t,n,r,i){if(!this.m_oContext||!i||!i.stops||i.stops.length===0)return null;let a;if(i.type===`linear`){let o=(i.angle||0)*Math.PI/180,s=e+n/2-Math.cos(o)*n/2,c=t+r/2-Math.sin(o)*r/2,l=e+n/2+Math.cos(o)*n/2,u=t+r/2+Math.sin(o)*r/2;a=this.m_oContext.createLinearGradient(s,c,l,u)}else{let i=e+n/2,o=t+r/2,s=Math.max(n,r)/2;a=this.m_oContext.createRadialGradient(i,o,0,i,o,s)}for(let e of i.stops)a.addColorStop(e.position,this.colorToRgb(e.color));return a}fillRect(e,t,n,r,i){if(!(!this.m_oContext||!i)){if(this.m_oContext.save(),i&&typeof i==`object`&&i.type===`linear`&&i.stops){let a=this.createGradient(e,t,n,r,i);a?this.m_oContext.fillStyle=a:this.m_oContext.fillStyle=this.colorToRgb(i.stops[0]?.color||{r:0,g:0,b:0})}else this.m_oContext.fillStyle=this.colorToRgb(i);this.m_oContext.fillRect(e,t,n,r),this.m_oContext.restore()}}hexToRgb(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:255}:{r:0,g:0,b:0,a:255}}SaveGrState(){this.m_oContext.save(),this.m_oTransformStack.push(this.m_oTransform.CreateDublicate())}RestoreGrState(){this.m_oContext.restore(),this.m_oTransformStack.length>0&&(this.m_oTransform=this.m_oTransformStack.pop())}calculateCoordTransform(){this.m_oCoordTransform.Reset(),this.m_oCoordTransform.sx=this.m_dWidth/this.m_dWidthMM,this.m_oCoordTransform.sy=this.m_dHeight/this.m_dHeightMM}calculateFullTransform(){this.m_oFullTransform=this.m_oCoordTransform.CreateDublicate(),this.m_oFullTransform.Multiply(this.m_oTransform,1)}drawRoundRectPath(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n)}drawTrianglePath(e,t,n,r,i){e.moveTo(t+r/2,n),e.lineTo(t+r,n+i),e.lineTo(t,n+i),e.closePath()}drawDiamondPath(e,t,n,r,i){e.moveTo(t+r/2,n),e.lineTo(t+r,n+i/2),e.lineTo(t+r/2,n+i),e.lineTo(t,n+i/2),e.closePath()}drawPentagonPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2;e.moveTo(a,n);for(let t=1;t<5;t++){let n=t*2*Math.PI/5-Math.PI/2,r=a+s*Math.cos(n),i=o+s*Math.sin(n);e.lineTo(r,i)}e.closePath()}drawHexagonPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2;e.moveTo(a+s,o);for(let t=1;t<6;t++){let n=t*Math.PI/3,r=a+s*Math.cos(n),i=o+s*Math.sin(n);e.lineTo(r,i)}e.closePath()}drawOctagonPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2;e.moveTo(a+s,o);for(let t=1;t<8;t++){let n=t*Math.PI/4,r=a+s*Math.cos(n),i=o+s*Math.sin(n);e.lineTo(r,i)}e.closePath()}drawStarPath(e,t,n,r,i){let a=t+r/2,o=n+i/2,s=Math.min(r,i)/2,c=s*.4;e.moveTo(a,n);for(let t=0;t<10;t++){let n=t*Math.PI/5-Math.PI/2,r=t%2==0?s:c,i=a+r*Math.cos(n),l=o+r*Math.sin(n);e.lineTo(i,l)}e.closePath()}drawRightArrowPath(e,t,n,r,i){let a=r*.6,o=i*.6,s=n+(i-o)/2;e.moveTo(t,s),e.lineTo(t+a,s),e.lineTo(t+a,n),e.lineTo(t+r,n+i/2),e.lineTo(t+a,n+i),e.lineTo(t+a,s+o),e.lineTo(t,s+o),e.closePath()}drawLeftArrowPath(e,t,n,r,i){let a=r*.4,o=i*.6,s=n+(i-o)/2;e.moveTo(t,n+i/2),e.lineTo(t+a,n),e.lineTo(t+a,s),e.lineTo(t+r,s),e.lineTo(t+r,s+o),e.lineTo(t+a,s+o),e.lineTo(t+a,n+i),e.closePath()}drawUpArrowPath(e,t,n,r,i){let a=i*.4,o=r*.6,s=t+(r-o)/2;e.moveTo(t+r/2,n),e.lineTo(t+r,n+a),e.lineTo(s+o,n+a),e.lineTo(s+o,n+i),e.lineTo(s,n+i),e.lineTo(s,n+a),e.lineTo(t,n+a),e.closePath()}drawDownArrowPath(e,t,n,r,i){let a=i*.4,o=r*.6,s=t+(r-o)/2,c=n+i-a;e.moveTo(s,n),e.lineTo(s+o,n),e.lineTo(s+o,c),e.lineTo(t+r,c),e.lineTo(t+r/2,n+i),e.lineTo(t,c),e.lineTo(s,c),e.closePath()}}class i{constructor(){this.shapeCache=new Map,this.pathCache=new Map}processPresetShape(e,t,n){let r=`${e}_${t}_${n.width}_${n.height}`;if(this.shapeCache.has(r))return this.shapeCache.get(r);let i=null;switch(e){case 1:i=this.createRectangleShape(n);break;case 2:i=this.createRoundRectShape(n);break;case 3:i=this.createEllipseShape(n);break;case 4:i=this.createDiamondShape(n);break;case 5:i=this.createTriangleShape(n);break;case 6:i=this.createRightTriangleShape(n);break;case 7:i=this.createParallelogramShape(n);break;case 8:i=this.createTrapezoidShape(n);break;case 9:i=this.createHexagonShape(n);break;case 10:i=this.createOctagonShape(n);break;case 11:i=this.createPlusShape(n);break;case 12:i=this.createStar5Shape(n);break;case 13:i=this.createRightArrowShape(n);break;case 20:i=this.createLineShape(n);break;case 22:i=this.createCylinderShape(n);break;case 56:i=this.createPentagonShape(n);break;case 66:i=this.createLeftArrowShape(n);break;case 67:i=this.createDownArrowShape(n);break;case 68:i=this.createUpArrowShape(n);break;case 69:i=this.createLeftRightArrowShape(n);break;case 70:i=this.createUpDownArrowShape(n);break;case 74:i=this.createHeartShape(n);break;case 76:i=this.createQuadArrowShape(n);break;default:return null}return i&&this.shapeCache.set(r,i),i}createRectangleShape(e){return{type:`preset`,onlyOfficeType:1,path:{commands:[{type:`M`,x:e.x,y:e.y},{type:`L`,x:e.x+e.width,y:e.y},{type:`L`,x:e.x+e.width,y:e.y+e.height},{type:`L`,x:e.x,y:e.y+e.height},{type:`Z`}]}}}createEllipseShape(e){let t=e.x+e.width/2,n=e.y+e.height/2,r=e.width/2,i=e.height/2;return{type:`preset`,onlyOfficeType:3,path:{commands:[{type:`M`,x:t+r,y:n},{type:`A`,rx:r,ry:i,x:t-r,y:n,rotation:0,largeArc:0,sweep:1},{type:`A`,rx:r,ry:i,x:t+r,y:n,rotation:0,largeArc:0,sweep:1},{type:`Z`}]}}}createDiamondShape(e){let t=e.x+e.width/2,n=e.y+e.height/2;return{type:`preset`,onlyOfficeType:4,path:{commands:[{type:`M`,x:t,y:e.y},{type:`L`,x:e.x+e.width,y:n},{type:`L`,x:t,y:e.y+e.height},{type:`L`,x:e.x,y:n},{type:`Z`}]}}}createTriangleShape(e){return{type:`preset`,onlyOfficeType:5,path:{commands:[{type:`M`,x:e.x+e.width/2,y:e.y},{type:`L`,x:e.x+e.width,y:e.y+e.height},{type:`L`,x:e.x,y:e.y+e.height},{type:`Z`}]}}}createRightArrowShape(e){let t=e.width*.7,n=e.height*.4;e.width*.3;let r=e.height*.6;return{type:`preset`,onlyOfficeType:13,path:{commands:[{type:`M`,x:e.x,y:e.y+(e.height-n)/2},{type:`L`,x:e.x+t,y:e.y+(e.height-n)/2},{type:`L`,x:e.x+t,y:e.y+(e.height-r)/2},{type:`L`,x:e.x+e.width,y:e.y+e.height/2},{type:`L`,x:e.x+t,y:e.y+(e.height+r)/2},{type:`L`,x:e.x+t,y:e.y+(e.height+n)/2},{type:`L`,x:e.x,y:e.y+(e.height+n)/2},{type:`Z`}]}}}createHeartShape(e){let t=e.x+e.width/2,n=e.y+e.height*.3;return{type:`preset`,onlyOfficeType:74,path:{commands:[{type:`M`,x:t,y:n},{type:`C`,x1:t-e.width*.3,y1:e.y,x2:e.x,y2:e.y+e.height*.3,x:t,y:e.y+e.height*.8},{type:`C`,x1:e.x+e.width,y1:e.y+e.height*.3,x2:t+e.width*.3,y2:e.y,x:t,y:n},{type:`Z`}]}}}createLeftArrowShape(e){e.width*.7;let t=e.height*.4,n=e.width*.3,r=e.height*.6;return{type:`preset`,onlyOfficeType:66,path:{commands:[{type:`M`,x:e.x,y:e.y+e.height/2},{type:`L`,x:e.x+n,y:e.y+(e.height-r)/2},{type:`L`,x:e.x+n,y:e.y+(e.height-t)/2},{type:`L`,x:e.x+e.width,y:e.y+(e.height-t)/2},{type:`L`,x:e.x+e.width,y:e.y+(e.height+t)/2},{type:`L`,x:e.x+n,y:e.y+(e.height+t)/2},{type:`L`,x:e.x+n,y:e.y+(e.height+r)/2},{type:`Z`}]}}}createPlusShape(e){let t=Math.min(e.width,e.height)*.3,n=e.x+e.width/2,r=e.y+e.height/2;return{type:`preset`,onlyOfficeType:11,path:{commands:[{type:`M`,x:e.x,y:r-t/2},{type:`L`,x:e.x+e.width,y:r-t/2},{type:`L`,x:e.x+e.width,y:r+t/2},{type:`L`,x:e.x,y:r+t/2},{type:`Z`},{type:`M`,x:n-t/2,y:e.y},{type:`L`,x:n+t/2,y:e.y},{type:`L`,x:n+t/2,y:e.y+e.height},{type:`L`,x:n-t/2,y:e.y+e.height},{type:`Z`}]}}}}class a{constructor(){this.sx=1,this.shy=0,this.shx=0,this.sy=1,this.tx=0,this.ty=0}Reset(){this.sx=1,this.shy=0,this.shx=0,this.sy=1,this.tx=0,this.ty=0}CreateDublicate(){let e=new a;return e.sx=this.sx,e.shy=this.shy,e.shx=this.shx,e.sy=this.sy,e.tx=this.tx,e.ty=this.ty,e}Multiply(e,t){if(t===1){let t=this.sx*e.sx+this.shy*e.shx,n=this.sx*e.shy+this.shy*e.sy,r=this.shx*e.sx+this.sy*e.shx,i=this.shx*e.shy+this.sy*e.sy,a=this.tx*e.sx+this.ty*e.shx+e.tx,o=this.tx*e.shy+this.ty*e.sy+e.ty;this.sx=t,this.shy=n,this.shx=r,this.sy=i,this.tx=a,this.ty=o}else{let t=e.sx*this.sx+e.shy*this.shx,n=e.sx*this.shy+e.shy*this.sy,r=e.shx*this.sx+e.sy*this.shx,i=e.shx*this.shy+e.sy*this.sy,a=e.tx*this.sx+e.ty*this.shx+this.tx,o=e.tx*this.shy+e.ty*this.sy+this.ty;this.sx=t,this.shy=n,this.shx=r,this.sy=i,this.tx=a,this.ty=o}}}class o{constructor(){this.Color={r:0,g:0,b:0,a:255},this.Alpha=255,this.Size=1,this.DashStyle=0,this.LineJoin=0,this.LineCap=0,this.MiterLimit=10}}class s{constructor(){this.Type=0,this.Color1={r:0,g:0,b:0,a:255},this.Color2={r:255,g:255,b:255,a:255},this.Alpha1=255,this.Alpha2=255,this.TexturePath=``,this.TextureMode=0,this.TextureAlpha=255,this.LinearAngle=0,this.Rectable={x:0,y:0,w:0,h:0}}}class c{constructor(){this.Name=`Arial`,this.Size=12,this.Bold=!1,this.Italic=!1,this.Underline=!1,this.Strikeout=!1,this.Path=``,this.FaceIndex=0,this.CharSpace=0}}e.exports&&(e.exports={CGraphics:r,StandardShapeProcessor:i,StandardShapeTypes:t,OpenXmlShapeTypes:n,CMatrix:a,CPen:o,CBrush:s,CFont:c});let l={toRadians:function(e){return e*Math.PI/180},toDegrees:function(e){return e*180/Math.PI},Sin:function(e){return Math.sin(e*Math.PI/108e5)},Cos:function(e){return Math.cos(e*Math.PI/108e5)},Tan:function(e){return Math.tan(e*Math.PI/108e5)},ATan2:function(e,t){return Math.atan2(e,t)*108e5/Math.PI},CAt2:function(e,t,n){return e*Math.cos(Math.atan2(n,t))},SAt2:function(e,t,n){return e*Math.sin(Math.atan2(n,t))}};class u{constructor(){this.preset=null,this.pathLst=[],this.gdLst={},this.gdLstInfo=[],this.avLst={},this.adjLst={},this.ahXYLst=[],this.ahPolarLst=[],this.cnxLst=[],this.rect=null,this.width=21600,this.height=21600,this.isCalculated=!1}setPreset(e){this.preset=e,this.isCalculated=!1}addAdjustment(e,t,n,r){this.adjLst[e]={value:t,min:n||null,max:r||null},this.avLst[e]=!0,this.isCalculated=!1}addGuide(e,t,n,r,i){this.gdLstInfo.push({name:e,formula:t,x:n,y:r,z:i}),this.isCalculated=!1}calculateGuideValue(e,t,n,r,i){let a=this.getValue(n),o=this.getValue(r),s=this.getValue(i),c=0;switch(t){case 0:c=s===0?0:a*o/s;break;case 1:c=a+o-s;break;case 2:c=s===0?0:(a+o)/s;break;case 3:c=a>0?o:s;break;case 4:c=Math.abs(a);break;case 5:c=l.ATan2(o,a);break;case 6:c=l.CAt2(a,o,s);break;case 7:c=a*l.Cos(o);break;case 8:c=Math.max(a,o);break;case 9:c=Math.min(a,o);break;case 10:c=Math.sqrt(a*a+o*o+s*s);break;case 11:c=os?s:o;break;case 12:c=l.SAt2(a,o,s);break;case 13:c=a*l.Sin(o);break;case 14:c=Math.sqrt(Math.max(0,a));break;case 15:c=a*l.Tan(o);break;case 16:c=a;break;default:c=0;break}return isNaN(c)&&(c=0),this.gdLst[e]=c,c}getValue(e){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseFloat(e);if(!isNaN(t))return t;switch(e){case`w`:return this.width;case`h`:return this.height;case`ss`:return Math.min(this.width,this.height);case`ls`:return Math.max(this.width,this.height);case`hc`:return this.width/2;case`vc`:return this.height/2;case`l`:return 0;case`t`:return 0;case`r`:return this.width;case`b`:return this.height;case`wd2`:return this.width/2;case`hd2`:return this.height/2;case`wd4`:return this.width/4;case`hd4`:return this.height/4;case`wd6`:return this.width/6;case`hd6`:return this.height/6;case`wd8`:return this.width/8;case`hd8`:return this.height/8;case`cd2`:return 108e5;case`cd4`:return 54e5;case`cd8`:return 27e5;case`_3cd4`:return 162e5;case`_3cd8`:return 81e5;case`_5cd8`:return 135e5;case`_7cd8`:return 189e5}if(this.gdLst.hasOwnProperty(e))return this.gdLst[e];if(this.adjLst.hasOwnProperty(e))return this.adjLst[e].value}return 0}calculateGuides(){this.gdLst={};for(let e=0;e{let t=r[e.name]||e.value;o.addAdjustment(e.name,t,e.min,e.max)}),a.guides&&a.guides.forEach(e=>{o.addGuide(e.name,e.formula,e.x,e.y,e.z)}),a.paths&&a.paths.forEach(e=>{let t=new d;t.setFill(e.fill),t.setStroke(e.stroke),e.commands.forEach(e=>{let n=e.args.map(e=>typeof e==`string`?o.getValue(e):e);t.addCommand(e.type,...n)}),o.addPath(t)}),o.calculateGuides(),this.shapeCache.set(i,o),o}createDefaultGeometry(e,t){return this.processPresetGeometry(`rect`,e,t)}fillText(e,t,n,r={}){if(!(!this.m_oContext||!e)){this.m_oContext.save();try{let i=(r.fontSize||12)*(this.m_oGraphicsAdapter&&this.m_oGraphicsAdapter.getTextScaleFactor?this.m_oGraphicsAdapter.getTextScaleFactor():1),a=r.fontFamily||`Arial`,o=r.fontWeight||(r.bold?`bold`:`normal`),s=r.fontStyle||(r.italic?`italic`:`normal`),c=`"${a}", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", Arial, sans-serif`;if(this.m_oContext.font=`${s} ${o} ${i}px ${c}`,r.color)if(typeof r.color==`object`&&r.color.r!==void 0){let e=r.color.a===void 0?1:r.color.a/255,t=`rgba(${r.color.r}, ${r.color.g}, ${r.color.b}, ${e})`;this.m_oContext.fillStyle=t}else typeof r.color==`string`?this.m_oContext.fillStyle=r.color:this.m_oContext.fillStyle=`#000000`;else this.m_oContext.fillStyle=`#000000`;if(this.m_oContext.textBaseline=r.textBaseline||`alphabetic`,this.m_oContext.textAlign=r.textAlign||`left`,this.m_oFullTransform&&!this.m_oFullTransform.IsIdentity()){let e=this.m_oFullTransform;this.m_oContext.setTransform(e.sx,e.shy,e.shx,e.sy,e.tx,e.ty)}if(r.highlight){let a=r.highlight,o;if(typeof a==`object`&&a.r!==void 0){let e=a.a===void 0?1:a.a/255;o=`rgba(${a.r}, ${a.g}, ${a.b}, ${e})`}else typeof a==`string`&&(o=a);if(o){let r=this.m_oContext.measureText(e),a=i*1.2,s=this.m_oContext.fillStyle;this.m_oContext.fillStyle=o,this.m_oContext.fillRect(t,n-i,r.width,a),this.m_oContext.fillStyle=s}}this.applyTextEffects(r.effects),this.m_oContext.fillText(e,t,n),this.resetTextEffects()}catch{}finally{this.m_oContext.restore()}}}applyTextEffects(e){!e||!this.m_oContext||(e.outerShadow&&this.applyOuterShadow(e.outerShadow),e.glow&&this.applyGlowEffect(e.glow),e.innerShadow&&this.applyInnerShadow(e.innerShadow))}applyOuterShadow(e){if(!e||!this.m_oContext)return;let t=(e.blurRadius||0)/9525,n=(e.distance||0)/9525,r=(e.direction||0)/6e4*Math.PI/180,i=Math.cos(r)*n,a=Math.sin(r)*n;if(this.m_oContext.shadowOffsetX=i,this.m_oContext.shadowOffsetY=a,this.m_oContext.shadowBlur=t,e.color){let t=this.convertColorToString(e.color);this.m_oContext.shadowColor=t}else this.m_oContext.shadowColor=`rgba(0, 0, 0, 0.5)`}applyGlowEffect(e){if(!e||!this.m_oContext)return;let t=(e.radius||0)/9525;if(this.m_oContext.shadowOffsetX=0,this.m_oContext.shadowOffsetY=0,this.m_oContext.shadowBlur=t,e.color){let t=this.convertColorToString(e.color);this.m_oContext.shadowColor=t}else this.m_oContext.shadowColor=`rgba(255, 255, 255, 0.8)`}applyInnerShadow(e){}resetTextEffects(){this.m_oContext&&(this.m_oContext.shadowOffsetX=0,this.m_oContext.shadowOffsetY=0,this.m_oContext.shadowBlur=0,this.m_oContext.shadowColor=`transparent`)}convertColorToString(e){if(!e)return`black`;if(e.type===`srgb`){let t=e.value;return`rgba(${parseInt(t.substr(0,2),16)}, ${parseInt(t.substr(2,2),16)}, ${parseInt(t.substr(4,2),16)}, ${e.alpha||1})`}else if(e.type===`scheme`){let t={dk1:`#000000`,lt1:`#FFFFFF`,dk2:`#44546A`,lt2:`#E7E6E6`}[e.value]||`#000000`,n=e.alpha||1;return`rgba(${parseInt(t.substr(1,2),16)}, ${parseInt(t.substr(3,2),16)}, ${parseInt(t.substr(5,2),16)}, ${n})`}return`black`}measureText(e,t={}){if(!this.m_oContext||!e)return{width:0,height:0};this.m_oContext.save();try{let n=(t.fontSize||12)*(this.m_oGraphicsAdapter&&this.m_oGraphicsAdapter.getTextScaleFactor?this.m_oGraphicsAdapter.getTextScaleFactor():1),r=t.fontFamily||`Arial`,i=t.fontWeight||(t.bold?`bold`:`normal`),a=t.fontStyle||(t.italic?`italic`:`normal`),o=`"${r}", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", Arial, sans-serif`;this.m_oContext.font=`${a} ${i} ${n}px ${o}`;let s=this.m_oContext.measureText(e),c=n;return s.actualBoundingBoxAscent!==void 0&&s.actualBoundingBoxDescent!==void 0&&(c=s.actualBoundingBoxAscent+s.actualBoundingBoxDescent),{width:s.width,height:c}}catch{return{width:0,height:0}}finally{this.m_oContext.restore()}}}typeof window<`u`&&(window.CGraphics=r,window.StandardShapeProcessor=i)})(bu),bu.exports)}Su();var Cu={},wu;function Tu(){if(wu)return Cu;wu=1;class e{constructor(){this.logger=new Logger(`FontEngine`),this.initializeFontSystem(),this.availableFonts=new Set([`Arial`,`Calibri`,`Times New Roman`,`Courier New`,`Verdana`,`Georgia`,`Tahoma`,`Helvetica`,`Garamond`,`Impact`,`Segoe UI`,`Comic Sans MS`,`Trebuchet MS`,`Lucida Sans Unicode`,`Palatino Linotype`,`Book Antiqua`,`Bookman Old Style`,`Century Gothic`]),this.documentFonts=new Set,this.missingFonts=new Set,this.fontCache=new Map,this.fontManager=null}initializeFontSystem(){try{window.AscFonts===void 0?this.fontManager=new t:(this.fontManager=new window.AscFonts.CFontManagerEngine,this.initializeFonts())}catch{this.fontManager=new t}}initializeFonts(){try{typeof self.queryLocalFonts==`function`?this.loadSystemFonts():this.loadFallbackFonts()}catch{this.loadFallbackFonts()}}async loadSystemFonts(){try{(await self.queryLocalFonts()).forEach(e=>{this.availableFonts.add(e.family)})}catch{this.loadFallbackFonts()}}loadFallbackFonts(){`Arial.Helvetica.Times New Roman.Times.Courier New.Courier.Verdana.Georgia.Palatino.Garamond.Bookman.Comic Sans MS.Trebuchet MS.Arial Black.Impact.Lucida Sans Unicode.Tahoma.Geneva.Lucida Grande.Segoe UI.Calibri.Cambria.Candara.Consolas.Constantia.Corbel.Franklin Gothic Medium.Gill Sans.Lucida Console.Lucida Sans Typewriter.MS Gothic.MS Mincho.MS PGothic.MS PMincho.MS Reference Sans Serif.MS Reference Specialty.MS Sans Serif.MS Serif.Myriad Pro.Optima.Perpetua.Rockwell.Rockwell Extra Bold.Segoe Print.Segoe Script.Segoe UI Light.Segoe UI Semibold.Segoe UI Symbol.Tw Cen MT.Tw Cen MT Condensed.Tw Cen MT Condensed Extra Bold`.split(`.`).forEach(e=>{this.availableFonts.add(e)})}analyzeDocument(e){return this.documentFonts.clear(),e.defaultTextStyle&&this.addFontFromStyle(e.defaultTextStyle),e.slides.forEach(e=>{e.commonSlideData&&e.commonSlideData.shapeTree&&e.commonSlideData.shapeTree.forEach(e=>{this.analyzeShape(e)})}),Array.from(this.documentFonts)}addFontFromStyle(e){e&&e.font&&this.documentFonts.add(e.font)}analyzeShape(e){e&&(e.textBody&&e.textBody.paragraphs&&e.textBody.paragraphs.forEach(e=>{e.runs&&e.runs.forEach(e=>{e.properties&&e.properties.font&&this.documentFonts.add(e.properties.font)})}),e.shapeTree&&e.shapeTree.forEach(e=>{this.analyzeShape(e)}))}loadFonts(){this.missingFonts.clear(),this.documentFonts.forEach(e=>{this.availableFonts.has(e)||this.missingFonts.add(e)})}getResults(){return{documentFonts:Array.from(this.documentFonts),availableFonts:Array.from(this.availableFonts),missingFonts:Array.from(this.missingFonts)}}getFontMetrics(e,t,n){let r=`${e}_${t}_${n}`;if(this.fontCache.has(r))return this.fontCache.get(r);let i={width:n.length*t*.6,height:t*1.2,ascent:t*.8,descent:t*.2,baseline:t*.8};return this.fontCache.set(r,i),i}isFontAvailable(e){return this.availableFonts.has(e)||this.documentFonts.has(e)}getFallbackFont(e){return this.isFontAvailable(e)?e:`Arial, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif`}renderText(e,t,n,r,i){let a=this.getFallbackFont(i.fontFamily||`Arial`),o=i.fontSize||12,s=i.fontWeight||(i.bold?`bold`:`normal`);e.font=`${i.fontStyle||(i.italic?`italic`:`normal`)} ${s} ${o}px "${a}"`;let c=`#000000`;if(i.color)if(typeof i.color==`object`&&i.color.r!==void 0){let e=i.color.a===void 0?1:i.color.a/255;c=`rgba(${i.color.r}, ${i.color.g}, ${i.color.b}, ${e})`}else c=typeof i.color==`string`?i.color:`#000000`;else c=`#000000`;if(e.fillStyle=c,e.textBaseline=`alphabetic`,i.textAlign&&(e.textAlign=i.textAlign),t.length===1)e.fillText(t,n,r);else{let a=n;for(let n=0;ne.querySelector(t))||this.hasVideoMimeType(e)}isAudioElement(e){return[`audio`,`p:audio`,`a:audio`].some(t=>e.querySelector(t))||this.hasAudioMimeType(e)}isImageElement(e){return[`pic`,`p:pic`,`image`,`img`].some(t=>e.querySelector(t))||this.hasImageMimeType(e)}isYouTubeEmbed(e){let t=e.textContent||``,n=e.innerHTML||``;return t.includes(`youtube.com`)||t.includes(`youtu.be`)||n.includes(`youtube.com`)||n.includes(`youtu.be`)}parseVideoElement(t){let n=new e;n.type=`video`,this.parseCommonMediaAttributes(t,n);let r=t.querySelector(`video, p\\:video, a\\:video`);return r&&(n.poster=r.getAttribute(`poster`)||``,n.autoplay=r.hasAttribute(`autoplay`),n.loop=r.hasAttribute(`loop`),n.controls=!r.hasAttribute(`controls`)||r.getAttribute(`controls`)!==`false`,n.muted=r.hasAttribute(`muted`)),this.extractMediaSource(t,n),n}parseAudioElement(t){let n=new e;n.type=`audio`,this.parseCommonMediaAttributes(t,n);let r=t.querySelector(`audio, p\\:audio, a\\:audio`);if(r){n.autoplay=r.hasAttribute(`autoplay`),n.loop=r.hasAttribute(`loop`),n.controls=!r.hasAttribute(`controls`)||r.getAttribute(`controls`)!==`false`,n.muted=r.hasAttribute(`muted`);let e=r.getAttribute(`volume`);e&&(n.volume=parseFloat(e)||1)}return this.extractMediaSource(t,n),n}parseImageElement(t){let n=new e;return n.type=`image`,this.parseCommonMediaAttributes(t,n),this.extractMediaSource(t,n),n}parseYouTubeEmbed(n){let r=new e;r.type=`youtube`;let i=new t,a=n.textContent||``,o=n.innerHTML||``,s=a+` `+o,c=this.extractYouTubeVideoId(s);c&&(i.videoId=c,i.fullUrl=`https://www.youtube.com/watch?v=${c}`,i.embedUrl=`https://www.youtube.com/embed/${c}`,i.thumbnailUrl=`https://img.youtube.com/vi/${c}/maxresdefault.jpg`);let l=s.match(/[?&]t=(\d+)/);return l&&(i.startTime=parseInt(l[1])),r.source=i.embedUrl,r.embeddedData=i,r}parseCommonMediaAttributes(e,t){let n=e.getAttribute(`width`)||e.getAttribute(`w`),r=e.getAttribute(`height`)||e.getAttribute(`h`);n&&(t.width=parseInt(n)||0),r&&(t.height=parseInt(r)||0);let i=e.getAttribute(`duration`);i&&(t.duration=parseFloat(i)||0);let a=e.getAttribute(`r:id`)||e.getAttribute(`rid`);a&&(t.relationship=a)}extractMediaSource(e,t){let n=e.getAttribute(`src`);if(n){t.source=n,t.mimeType=this.getMimeTypeFromExtension(n);return}let r=e.querySelector(`source`);if(r){t.source=r.getAttribute(`src`)||``,t.mimeType=r.getAttribute(`type`)||this.getMimeTypeFromExtension(t.source);return}if(t.relationship&&this.context){let e=this.resolveRelationship(t.relationship);if(e){if(t.source=e,t.mimeType=this.getMimeTypeFromExtension(e),this.getMimeTypeFromExtension(e)===`image/svg+xml`)try{let n=this.getZipPackage();n&&n.getFileData&&n.getFileData(e).then(e=>{if(e){let n=new TextDecoder(`utf-8`).decode(e);t.embeddedData=`data:image/svg+xml;base64,${btoa(n)}`}}).catch(t=>{this.logger.log(`warn`,this.constructor.name,`Failed to create SVG data URI for ${e}:`,t)})}catch(t){this.logger.log(`warn`,this.constructor.name,`Error creating SVG data URI for ${e}:`,t)}return}}let i=this.extractEmbeddedData(e);i&&(t.embeddedData=i,t.mimeType=this.getMimeTypeFromData(i))}getZipPackage(){return this.context&&this.context.zip?this.context.zip:this.context&&this.context.package?this.context.package:window.currentProcessor&&window.currentProcessor.package?window.currentProcessor.package:window.currentProcessor&&window.currentProcessor.zip?window.currentProcessor.zip:null}extractYouTubeVideoId(e){for(let t of[/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\n?#]+)/,/youtube\.com\/embed\/([^&\n?#]+)/,/youtube\.com\/v\/([^&\n?#]+)/]){let n=e.match(t);if(n&&n[1])return n[1]}return null}getMimeTypeFromExtension(e){return e&&{mp4:`video/mp4`,webm:`video/webm`,ogg:`video/ogg`,avi:`video/x-msvideo`,mov:`video/quicktime`,wmv:`video/x-ms-wmv`,mp3:`audio/mpeg`,wav:`audio/wav`,aac:`audio/aac`,m4a:`audio/mp4`,wma:`audio/x-ms-wma`,jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`}[e.split(`.`).pop().toLowerCase()]||``}resolveRelationship(e){try{if(!e||!this.context)return null;let t=null;if(this.context.zip?t=this.context.zip:this.context.package?t=this.context.package:window.currentProcessor&&window.currentProcessor.package&&(t=window.currentProcessor.package),!t||!t.relationships)return null;let n=Object.values(t.relationships);for(let t of n)if(t&&t[e]){let n=t[e].target;return n.startsWith(`../`)?n=n.replace(`../`,`ppt/`):n.startsWith(`/`)||(n=`/ppt/${n}`),n}return this.logger.log(`warn`,this.constructor.name,`Could not resolve relationship ID: ${e}`),null}catch(t){return this.logger.logError(this.constructor.name,`Error resolving relationship ${e}:`,t),null}}extractEmbeddedData(e){for(let t of[`data`,`data-src`,`data-url`,`src`,`href`]){let n=e.getAttribute(t);if(n&&n.startsWith(`data:`))return n}let t=(e.textContent||``).match(/data:[^;]+;base64,[A-Za-z0-9+/]+=*/g);return t&&t.length>0?t[0]:null}getMimeTypeFromData(e){if(!e||!e.startsWith(`data:`))return``;let t=e.match(/^data:([^;]+)/);return t?t[1]:``}isSVGDataUri(e){return!e||!e.startsWith(`data:`)?!1:this.getMimeTypeFromData(e)===`image/svg+xml`}extractSVGFromDataUri(e){if(!this.isSVGDataUri(e))return null;try{let t=e.split(`,`)[1];return t?atob(t):null}catch{return null}}hasVideoMimeType(e){return(e.getAttribute(`type`)||``).startsWith(`video/`)}hasAudioMimeType(e){return(e.getAttribute(`type`)||``).startsWith(`audio/`)}hasImageMimeType(e){return(e.getAttribute(`type`)||``).startsWith(`image/`)}createPlaceholder(t=`media`){let n=new e;return n.type=t,n.source=``,n.width=320,n.height=240,n.controls=!0,n}}return typeof window<`u`&&(window.MediaInfo=e,window.YouTubeEmbed=t,window.MediaProcessor=n),Eu}Ou();var ku={},Au;function ju(){if(Au)return ku;Au=1;class e{constructor(e){this.graphics=e,this.logger=new Logger(`SVGRenderer`),this.parser=new DOMParser}async renderSVG(e,t,n,r,i,a={}){try{let o=null;if(typeof e==`string`){let a=e.trim();if(a.startsWith(`parseFloat(e));if(e.length===4)return{x:e[0],y:e[1],width:e[2],height:e[3]}}return null}getSVGDimensions(e,t){let n=parseFloat(e.getAttribute(`width`))||0,r=parseFloat(e.getAttribute(`height`))||0;return!n&&!r&&t&&(n=t.width,r=t.height),n||(n=100),r||(r=100),{width:n,height:r}}canUseImageMethod(){let e=typeof Image<`u`,t=this.graphics._context||this.graphics.m_oContext,n=t&&typeof t.drawImage==`function`;return e&&t&&n}enhanceSVGForRendering(e,t,n){try{let r=this.parser.parseFromString(e,`image/svg+xml`).documentElement;if(!r.hasAttribute(`viewBox`)){let e=r.getAttribute(`width`)||t,i=r.getAttribute(`height`)||n;r.setAttribute(`viewBox`,`0 0 ${e} ${i}`)}return r.setAttribute(`width`,t.toString()),r.setAttribute(`height`,n.toString()),r.hasAttribute(`xmlns`)||r.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),new XMLSerializer().serializeToString(r)}catch(t){return this.logger.log(`warn`,this.constructor.name,`Could not enhance SVG, using original:`,t),e}}async renderSVGViaImage(e,t,n,r,i,a,o){return new Promise((a,o)=>{try{let s=new XMLSerializer().serializeToString(e),c=this.enhanceSVGForRendering(s,r,i),l=`data:image/svg+xml;base64,`+btoa(c),u=new Image;u.onload=()=>{try{if(this.graphics._context||this.graphics.m_oContext){let e=this.graphics._context||this.graphics.m_oContext;e.save();let a=r,o=i,s=t,c=n;if(u.naturalWidth>0&&u.naturalHeight>0){let e=u.naturalWidth/u.naturalHeight;e>r/i?(a=r,o=r/e,c=n+(i-o)/2):(o=i,a=i*e,s=t+(r-a)/2)}e.drawImage(u,s,c,a,o),e.restore()}else this.logger.logError(this.constructor.name,`No canvas context available for SVG drawing`);a()}catch(e){this.logger.logError(this.constructor.name,`Error drawing SVG image:`,e),this.renderSVGPlaceholder(t,n,r,i,`SVG Draw Error`),o(e)}},u.onerror=e=>{this.logger.logError(this.constructor.name,`SVG image load error:`,e),this.renderSVGPlaceholder(t,n,r,i,`SVG Load Error`),o(e)},u.crossOrigin=`anonymous`,u.src=l,setTimeout(()=>{u.complete===!1&&(this.logger.log(`warn`,this.constructor.name,`SVG loading timed out`),this.renderSVGPlaceholder(t,n,r,i,`SVG Timeout`),o(Error(`SVG loading timeout`)))},5e3)}catch(e){this.logger.logError(this.constructor.name,`Error in SVG Image rendering:`,e),this.renderSVGPlaceholder(t,n,r,i,`SVG Render Error`),o(e)}})}renderSVGViaParsing(e,t,n,r,i){try{if(!this.graphics._context)return;this.graphics._context.save(),this.graphics._context.translate(t,n),this.graphics._context.scale(r,r),this.processSVGElements(e.children),this.graphics._context.restore()}catch(e){this.logger.logError(this.constructor.name,`Error in SVG parsing rendering:`,e),this.renderSVGPlaceholder(t,n,100,100,`SVG Parse Error`)}}processSVGElements(e){for(let t of e)this.processSVGElement(t)}processSVGElement(e){switch(e.tagName.toLowerCase()){case`rect`:this.renderSVGRect(e);break;case`circle`:this.renderSVGCircle(e);break;case`ellipse`:this.renderSVGEllipse(e);break;case`line`:this.renderSVGLine(e);break;case`polyline`:case`polygon`:this.renderSVGPolygon(e);break;case`path`:this.renderSVGPath(e);break;case`text`:this.renderSVGText(e);break;case`g`:this.graphics._context.save(),this.applySVGTransform(e),this.processSVGElements(e.children),this.graphics._context.restore();break;default:break}}renderSVGRect(e){let t=parseFloat(e.getAttribute(`x`))||0,n=parseFloat(e.getAttribute(`y`))||0,r=parseFloat(e.getAttribute(`width`))||0,i=parseFloat(e.getAttribute(`height`))||0;this.applySVGStyles(e);let a=this.graphics._context;a.fillRect(t,n,r,i),a.strokeRect(t,n,r,i)}renderSVGCircle(e){let t=parseFloat(e.getAttribute(`cx`))||0,n=parseFloat(e.getAttribute(`cy`))||0,r=parseFloat(e.getAttribute(`r`))||0;this.applySVGStyles(e);let i=this.graphics._context;i.beginPath(),i.arc(t,n,r,0,2*Math.PI),i.fill(),i.stroke()}renderSVGLine(e){let t=parseFloat(e.getAttribute(`x1`))||0,n=parseFloat(e.getAttribute(`y1`))||0,r=parseFloat(e.getAttribute(`x2`))||0,i=parseFloat(e.getAttribute(`y2`))||0;this.applySVGStyles(e);let a=this.graphics._context;a.beginPath(),a.moveTo(t,n),a.lineTo(r,i),a.stroke()}renderSVGText(e){let t=parseFloat(e.getAttribute(`x`))||0,n=parseFloat(e.getAttribute(`y`))||0,r=e.textContent||``;this.applySVGStyles(e),this.graphics._context.fillText(r,t,n)}applySVGStyles(e){let t=this.graphics._context,n=e.getAttribute(`fill`);n&&n!==`none`?t.fillStyle=n:t.fillStyle=`transparent`;let r=e.getAttribute(`stroke`);r&&r!==`none`?t.strokeStyle=r:t.strokeStyle=`transparent`;let i=e.getAttribute(`stroke-width`);i&&(t.lineWidth=parseFloat(i));let a=e.getAttribute(`opacity`);a&&(t.globalAlpha=parseFloat(a))}applySVGTransform(e){let t=e.getAttribute(`transform`);if(t){let e=t.match(/translate\(([^)]+)\)/);if(e){let t=e[1].split(`,`).map(e=>parseFloat(e.trim()));t.length>=2&&this.graphics._context.translate(t[0],t[1])}let n=t.match(/scale\(([^)]+)\)/);if(n){let e=n[1].split(`,`).map(e=>parseFloat(e.trim()));if(e.length>=1){let t=e[0],n=e.length>1?e[1]:t;this.graphics._context.scale(t,n)}}let r=t.match(/rotate\(([^)]+)\)/);if(r){let e=parseFloat(r[1]);this.graphics._context.rotate(e*Math.PI/180)}}}renderSVGPlaceholder(e,t,n,r,i=`SVG`){this.graphics.fillRect(e,t,n,r,{r:240,g:240,b:240}),this.graphics.strokeRect(e,t,n,r,{r:200,g:200,b:200},1)}renderSVGEllipse(e){let t=parseFloat(e.getAttribute(`cx`))||0,n=parseFloat(e.getAttribute(`cy`))||0,r=parseFloat(e.getAttribute(`rx`))||0,i=parseFloat(e.getAttribute(`ry`))||0;this.applySVGStyles(e);let a=this.graphics._context;a.save(),a.translate(t,n),a.scale(r,i),a.beginPath(),a.arc(0,0,1,0,2*Math.PI),a.restore(),a.fill(),a.stroke()}renderSVGPolygon(e){let t=e.getAttribute(`points`)||``,n=e.tagName.toLowerCase()===`polygon`;if(!t.trim())return;this.applySVGStyles(e);let r=this.graphics._context,i=t.trim().split(/[\s,]+/);if(i.length<4)return;r.beginPath();let a=parseFloat(i[0]),o=parseFloat(i[1]);r.moveTo(a,o);for(let e=2;eparseFloat(e)).filter(e=>!isNaN(e)):[];t.push({command:e,params:i})}return t}executeSVGPathCommands(e,t){let n=0,r=0;for(let{command:i,params:a}of e)switch(i.toLowerCase()){case`m`:if(a.length>=2){i===`M`?(n=a[0],r=a[1]):(n+=a[0],r+=a[1]),t.moveTo(n,r);for(let e=2;e0&&i>0?{x:t,y:n,width:r,height:i}:null}}return typeof window<`u`&&(window.SVGRenderer=e),ku}ju();var Mu={},Nu;function Pu(){if(Nu)return Mu;Nu=1;class e{constructor(){this.name=``,this.colorScheme={},this.fontScheme={},this.formatScheme={},this.backgroundStyles=[],this.effects=[],this.themeElements={}}}class t{constructor(){this.dk1=null,this.lt1=null,this.dk2=null,this.lt2=null,this.accent1=null,this.accent2=null,this.accent3=null,this.accent4=null,this.accent5=null,this.accent6=null,this.hlink=null,this.folHlink=null}}class n{constructor(){this.majorFont={},this.minorFont={}}}class r{constructor(){this.id=``,this.name=``,this.preserve=!1,this.cSld=null,this.clrMap=null,this.txStyles=null,this.sldLayoutLst=[],this.themeId=``,this.hf=null,this.timing=null,this.transition=null}}class i{constructor(){this.id=``,this.masterId=``,this.name=``,this.type=`custom`,this.preserve=!1,this.showMasterSp=!0,this.showMasterPhAnim=!1,this.userDrawn=!1,this.cSld=null,this.clrMapOvr=null,this.hf=null,this.timing=null,this.transition=null}}class a{constructor(e){this.context=e,this.logger=new Logger(`ThemeProcessor`),this.themes=new Map,this.masters=new Map,this.layouts=new Map}processTheme(t,n){try{let r=new DOMParser().parseFromString(t,`text/xml`).querySelector(`theme, a\\:theme`);if(!r)return this.logger.log(`warn`,this.constructor.name,`No theme element found in XML`),this.createDefaultTheme(n);let i=new e;return i.name=r.getAttribute(`name`)||`Theme${n}`,this.processThemeElements(r,i),this.processColorScheme(r,i),this.processFontScheme(r,i),this.processFormatScheme(r,i),this.themes.set(n,i),i}catch(e){return this.logger.logError(this.constructor.name,`Error processing theme:`,e),this.createDefaultTheme(n)}}processMasterSlide(e,t){try{let n=new DOMParser().parseFromString(e,`text/xml`).querySelector(`sldMaster, p\\:sldMaster`);if(!n)return this.logger.log(`warn`,this.constructor.name,`No slide master element found in XML`),this.createDefaultMaster(t);let i=new r;return i.id=t,i.name=n.getAttribute(`name`)||`Master${t}`,i.preserve=n.getAttribute(`preserve`)===`true`,this.processMasterElements(n,i),this.masters.set(t,i),i}catch(e){return this.logger.logError(this.constructor.name,`Error processing master slide:`,e),this.createDefaultMaster(t)}}processLayoutSlide(e,t,n){try{let r=new DOMParser().parseFromString(e,`text/xml`).querySelector(`sldLayout, p\\:sldLayout`);if(!r)return this.logger.log(`warn`,this.constructor.name,`No slide layout element found in XML`),this.createDefaultLayout(t,n);let a=new i;a.id=t,a.masterId=n,a.name=r.getAttribute(`name`)||`Layout${t}`,a.type=r.getAttribute(`type`)||`custom`,a.preserve=r.getAttribute(`preserve`)===`true`,a.showMasterSp=r.getAttribute(`showMasterSp`)!==`false`,a.showMasterPhAnim=r.getAttribute(`showMasterPhAnim`)===`true`,a.userDrawn=r.getAttribute(`userDrawn`)===`true`,this.processLayoutElements(r,a),this.layouts.set(t,a);let o=this.masters.get(n);return o&&o.sldLayoutLst.push(t),a}catch(e){return this.logger.logError(this.constructor.name,`Error processing layout slide:`,e),this.createDefaultLayout(t,n)}}processThemeElements(e,t){let n=e.querySelector(`themeElements, a\\:themeElements`);n&&(t.themeElements={element:n,parsed:!1})}processColorScheme(e,n){let r=e.querySelector(`clrScheme, a\\:clrScheme`);if(!r)return;let i=new t;for(let[e,t]of Object.entries({dk1:`dk1`,lt1:`lt1`,dk2:`dk2`,lt2:`lt2`,accent1:`accent1`,accent2:`accent2`,accent3:`accent3`,accent4:`accent4`,accent5:`accent5`,accent6:`accent6`,hlink:`hlink`,folHlink:`folHlink`})){let n=r.querySelector(`${e}, a\\:${e}`);n&&(i[t]=this.parseColor(n))}n.colorScheme=i}processFontScheme(e,t){let r=e.querySelector(`fontScheme, a\\:fontScheme`);if(!r)return;let i=new n,a=r.querySelector(`majorFont, a\\:majorFont`);a&&(i.majorFont=this.parseFontCollection(a));let o=r.querySelector(`minorFont, a\\:minorFont`);o&&(i.minorFont=this.parseFontCollection(o)),t.fontScheme=i}processFormatScheme(e,t){let n=e.querySelector(`fmtScheme, a\\:fmtScheme`);n&&(t.formatScheme={fillStyleLst:this.processFillStyles(n),lnStyleLst:this.processLineStyles(n),effectStyleLst:this.processEffectStyles(n),bgFillStyleLst:this.processBackgroundFillStyles(n)})}processMasterElements(e,t){let n=e.querySelector(`cSld, p\\:cSld`);n&&(t.cSld=this.parseCommonSlideData(n));let r=e.querySelector(`clrMap, p\\:clrMap`);r&&(t.clrMap=this.parseColorMap(r));let i=e.querySelector(`txStyles, p\\:txStyles`);i&&(t.txStyles=this.parseTextStyles(i)),t.hf=this.parseHeaderFooter(e),t.timing=this.parseTiming(e),t.transition=this.parseTransition(e)}processLayoutElements(e,t){let n=e.querySelector(`cSld, p\\:cSld`);n&&(t.cSld=this.parseCommonSlideData(n));let r=e.querySelector(`clrMapOvr, p\\:clrMapOvr`);r&&(t.clrMapOvr=this.parseColorMapOverride(r)),t.hf=this.parseHeaderFooter(e),t.timing=this.parseTiming(e),t.transition=this.parseTransition(e)}getTheme(e){return this.themes.get(e)||null}getMaster(e){return this.masters.get(e)||null}getLayout(e){return this.layouts.get(e)||null}resolveColor(e,t,n=null){let r=this.getTheme(t);if(!r||!r.colorScheme)return null;let i=n&&n[e]?n[e]:e;return r.colorScheme[i]||null}resolveFont(e,t,n=`latin`){let r=this.getTheme(t);if(!r||!r.fontScheme)return null;let i=e===`major`?r.fontScheme.majorFont:r.fontScheme.minorFont;return i[n]||i.latin||null}parseColor(e){let t=e.querySelector(`sysClr, a\\:sysClr`),n=e.querySelector(`srgbClr, a\\:srgbClr`);if(e.querySelector(`schemeClr, a\\:schemeClr`),n){let e=n.getAttribute(`val`);if(e)return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return t&&{windowText:{r:0,g:0,b:0},window:{r:255,g:255,b:255}}[t.getAttribute(`val`)]||{r:0,g:0,b:0}}parseFontCollection(e){let t={},n=e.querySelector(`latin, a\\:latin`);n&&(t.latin=n.getAttribute(`typeface`));let r=e.querySelector(`cs, a\\:cs`);return r&&(t.cs=r.getAttribute(`typeface`)),t}parseCommonSlideData(e){return{name:e.getAttribute(`name`)||``,bg:this.parseBackground(e),spTree:this.parseShapeTree(e)}}parseColorMap(e){let t={},n=e.attributes;for(let e=0;ee.x+e.w||this.x+this.we.y+e.h||this.y+this.he.includes(`slide`)&&e.endsWith(`.xml`));let t=typeof globalThis<`u`&&globalThis.OpenXmlPackage||typeof window<`u`&&window.OpenXmlPackage||(function(){class e{constructor(e,t,n){this.package=e,this.uri=t,this.contentType=n,this._content=null}async getDocumentContent(){if(this._content===null){let e=this.uri.startsWith(`/`)?this.uri.substring(1):this.uri;this._content=await this.package.zip.getFileText(e)}return this._content}async getRelationships(){if(this.package.relationships[this.uri])return this.package.relationships[this.uri];let e=this.uri.replace(/\/([^\/]+)$/,`/_rels/$1.rels`),t=e.startsWith(`/`)?e.substring(1):e,n=await this.package.zip.getFileText(t);return n?this.package.parseRelationships(n):{}}}class t{constructor(e){this.zip=e,this.parts={},this.contentTypes={},this.relationships={}}async initialize(){let t=await this.zip.getFileText(`[Content_Types].xml`);t&&this.parseContentTypes(t);let n=await this.zip.getFileText(`_rels/.rels`);n&&(this.relationships[``]=this.parseRelationships(n));let r=this.zip.getPaths();for(let e of r)if(e.startsWith(`_rels/`)&&e.endsWith(`.rels`)&&e!==`_rels/.rels`){let t=e.match(/^(.+)\/_rels\/(.+)\.rels$/);if(t){let n=`/${t[1]}/${t[2]}`,r=await this.zip.getFileText(e);r&&(this.relationships[n]=this.parseRelationships(r))}}for(let t of r)if(!t.startsWith(`_rels/`)&&t!==`[Content_Types].xml`){let n=`/${t}`,r=this.getContentType(n);this.parts[n]=new e(this,n,r)}}parseContentTypes(e){let t=new DOMParser().parseFromString(e,`text/xml`);t.querySelectorAll(`Default`).forEach(e=>{let t=e.getAttribute(`Extension`),n=e.getAttribute(`ContentType`);t&&(this.contentTypes[`ext:${t}`]=n)}),t.querySelectorAll(`Override`).forEach(e=>{let t=e.getAttribute(`PartName`),n=e.getAttribute(`ContentType`);t&&(this.contentTypes[t]=n)})}parseRelationships(e){let t=new DOMParser().parseFromString(e,`text/xml`),n={},r=t.getElementsByTagName(`*`);for(let e=0;e/presentation\.xml$/i.test(e));e&&(n=this.package.getPartByUri(e))}if(!n&&this.zip&&typeof this.zip.getPaths==`function`)try{let e=this.zip.getPaths(),t=e.find(e=>/^(?:\/?|)ppt\/presentation\.xml$/i.test(e));if(t||(t=e.find(e=>/presentation\.xml$/i.test(e))),t){let e=t.startsWith(`/`)?t:`/${t}`,r=this,i=new class{constructor(e,t){this.package=e,this.uri=t,this._content=null}async getDocumentContent(){if(this._content===null){let e=this.uri.startsWith(`/`)?this.uri.substring(1):this.uri;this._content=await r.zip.getFileText(e)}return this._content}async getRelationships(){let e=this.uri.replace(/\/([^\/]+)$/,`/_rels/$1.rels`),t=e.startsWith(`/`)?e.substring(1):e,n=await r.zip.getFileText(t);return n&&r.package&&typeof r.package.parseRelationships==`function`?r.package.parseRelationships(n):{}}}(this.package,e);this.package&&this.package.parts&&(this.package.parts[e]=i),n=i}}catch{}if(!n)throw Error(`No presentation document found in PPTX file`)}let r=await n.getDocumentContent();if(!r)throw Error(`Failed to extract presentation XML content`);let i=typeof globalThis<`u`&&globalThis.StaxParser||typeof window<`u`&&window.StaxParser||null;if(!i)throw Error(`StaxParser is not defined`);let a=new i(r,n,t).parse();if(!a)throw Error(`Failed to parse presentation XML document`);if(this.presentation=this.createPresentationFromXML(a),!this.presentation)throw Error(`Failed to create presentation object from XML`);await this.processThemes(t,n),await this.processSlideMasters(t,n),await this.processSlides(t),await this.processImages(t),this.buildSVGRelationshipMapping()}catch(e){throw e}}createPresentationFromXML(e){try{let t=typeof globalThis<`u`&&globalThis.CPresentation||typeof window<`u`&&window.CPresentation||null;if(!t)throw Error(`CPresentation is not defined`);let n=new t,r=e.documentElement;if(r){let e=r.querySelector(`sldSz, p\\:sldSz`);e&&(n.slideSize={cx:parseInt(e.getAttribute(`cx`))||9144e3,cy:parseInt(e.getAttribute(`cy`))||6858e3});let t=r.querySelector(`sldMasterIdLst, p\\:sldMasterIdLst`);if(t){let e=[];t.querySelectorAll(`sldMasterId, p\\:sldMasterId`).forEach(t=>{let n=t.getAttribute(`r:id`)||t.getAttribute(`id`);n&&e.push(n)}),n.masterIds=e}let i=r.querySelector(`sldIdLst, p\\:sldIdLst`);if(i){let e=[];i.querySelectorAll(`sldId, p\\:sldId`).forEach(t=>{let n=t.getAttribute(`r:id`)||t.getAttribute(`id`);n&&e.push(n)}),n.slideIds=e}let a=r.querySelector(`defaultTextStyle, p\\:defaultTextStyle`);a&&(n.defaultTextStyle=this.parseTextStyleElement(a))}return n}catch{let e=new CPresentation;return e.slideSize={cx:9144e3,cy:6858e3},e}}async processImages(e){try{typeof this.extractMediaMap==`function`?await this.extractMediaMap():await this.extractImageMap()}catch{await this.extractImageMap()}await this.preloadAllImages(),this.logImageProcessingResults()}logImageProcessingResults(){let e=[];for(let[t,n]of this.imageMap){let r=this.imageCache.has(t);e.push({relId:t,imagePath:n,cached:r})}this.zip.getPaths().filter(e=>e.startsWith(`ppt/media/`)&&this.isImageFile(e))}async extractMediaMap(){let e=[],t=this.zip.getPaths();for(let n of t)n.startsWith(`ppt/media/`)&&e.push(n);let n=[],r=this.package.getPartByRelationshipType(Bu.presentation.relationType);if(r&&n.push(r),this.slides&&this.slides.length>0){let e=Object.keys(this.package.parts);Object.keys(this.package.relationships);for(let t of e)if(t.includes(`/slides/slide`)&&t.endsWith(`.xml`)){let e=this.package.getPartByUri(t);e&&n.push(e)}}if(this.slideMasters&&this.slideMasters.length>0){let e=Object.keys(this.package.parts);for(let t of e)if(t.includes(`/slideMasters/slideMaster`)&&t.endsWith(`.xml`)){let e=this.package.getPartByUri(t);e&&n.push(e)}}if(this.slideLayouts&&this.slideLayouts.length>0){let e=Object.keys(this.package.parts);for(let t of e)if(t.includes(`/slideLayouts/slideLayout`)&&t.endsWith(`.xml`)){let e=this.package.getPartByUri(t);e&&n.push(e)}}for(let e of n)await this.extractPartMediaRelationships(e)}async extractImageMap(){let e=[],t=this.zip.getPaths();for(let n of t)n.startsWith(`ppt/media/`)&&this.isImageFile(n)&&e.push(n);let n=[this.package.getPartByRelationshipType(Bu.presentation.relationType),...this.slides.map((e,t)=>this.package.getPartByUri(`/ppt/slides/slide${t+1}.xml`)),...this.slideMasters.map((e,t)=>this.package.getPartByUri(`/ppt/slideMasters/slideMaster${t+1}.xml`)),...this.slideLayouts.map((e,t)=>this.package.getPartByUri(`/ppt/slideLayouts/slideLayout${t+1}.xml`))].filter(e=>e!==null);for(let e of n)await this.extractPartImageRelationships(e)}async extractPartImageRelationships(e){try{let t=await e.getRelationships();for(let[e,n]of Object.entries(t))if(n.type===Bu.image.relationType){let t=n.target;t.startsWith(`../`)?t=t.replace(`../`,`ppt/`):t.startsWith(`/`)||(t=`/ppt/${t}`),this.imageMap.set(e,t)}}catch{}}isImageFile(e){let t=[`.png`,`.jpg`,`.jpeg`,`.gif`,`.bmp`,`.svg`,`.webp`,`.tiff`],n=e.toLowerCase();return t.some(e=>n.endsWith(e))}async preloadSlideImages(e){if(!this.slides[e]||!this.slides[e].commonSlideData)return;let t=this.slides[e],n=this.extractImageRelationshipsFromSlide(t).map(e=>this.loadImage(e));await Promise.allSettled(n)}async preloadAllImages(){let e=new Set;for(let t of this.slides)this.extractImageRelationshipsFromSlide(t).forEach(t=>e.add(t)),t.backgroundFill&&t.backgroundFill.fill&&t.backgroundFill.fill.type===`image`&&t.backgroundFill.fill.imageData?.relationshipId&&e.add(t.backgroundFill.fill.imageData.relationshipId);for(let t of this.slideMasters)t.cSld?.bg?.fill?.type===`image`&&t.cSld.bg.fill.imageData?.relationshipId&&e.add(t.cSld.bg.fill.imageData.relationshipId);let t=Array.from(e);for(let e=0;ethis.loadImage(e));await Promise.allSettled(n),Math.min(100,Math.round((e+5)/t.length*100))}}extractImageRelationshipsFromSlide(e){let t=[];if(e.commonSlideData&&e.commonSlideData.shapeTree)for(let n of e.commonSlideData.shapeTree)n.type===`pic`&&n.imageRelId&&t.push(n.imageRelId),n.type===`grpSp`&&n.shapeTree&&t.push(...this.extractImageRelationshipsFromShapeTree(n.shapeTree));return t}extractImageRelationshipsFromShapeTree(e){let t=[];for(let n of e)n.type===`pic`&&n.imageRelId&&t.push(n.imageRelId),n.type===`grpSp`&&n.shapeTree&&t.push(...this.extractImageRelationshipsFromShapeTree(n.shapeTree));return t}updateShapeImageRelIds(e,t,n){if(!e.commonSlideData?.shapeTree)return;let r=e=>{for(let i of e)i.type===`pic`&&i.imageRelId===t&&(i.imageRelId=n),i.type===`grpSp`&&i.shapeTree&&r(i.shapeTree)};r(e.commonSlideData.shapeTree)}async preloadAllImages(){try{let e=new Set;for(let t=0;tnull);if(t){let n=new Blob([t],{type:this.getMimeType(e)}),i=URL.createObjectURL(n),a=await this.imageLoader.loadImageFromUrl(i);this.imageCache.set(r,{image:a,url:i,path:e,width:a.naturalWidth,height:a.naturalHeight})}}catch{}this.updateShapeImageRelIds(n,t,r)}else e.add(t)}else r.forEach(t=>e.add(t))}catch{r.forEach(t=>e.add(t))}else r.forEach(t=>e.add(t))}for(let t of this.slideLayouts){let n=t.cSld?.bg?.fill||t.commonSlideData?.backgroundFill?.fill;if(n?.type===`image`&&n.imageData?.relationshipId&&t.layoutPath){let r=n.imageData.relationshipId,i=`layout_bg:${t.layoutPath}`;try{let e=this.package.getPartByUri(`/`+t.layoutPath);if(e){let t=await e.getRelationships();if(t&&t[r]){let e=t[r].target;e.startsWith(`../`)?e=e.replace(`../`,`ppt/`):e.startsWith(`/`)||(e=`ppt/${e}`);let a=await this.zip.getFileData(e);if(a&&!this.isSVGFile(e)){let t=new Blob([a],{type:this.getMimeType(e)}),r=URL.createObjectURL(t),o=await this.imageLoader.loadImageFromUrl(r);this.imageCache.set(i,{image:o,url:r,path:e,width:o.naturalWidth,height:o.naturalHeight}),n.imageData.resolvedCacheKey=i}}}}catch{e.add(r)}}}for(let t of this.slideLayouts){if(!t.layoutPath)continue;let n=this.extractImageRelationshipsFromSlide(t);if(n.length!==0)try{let r=this.package.getPartByUri(`/`+t.layoutPath);if(r){let i=await r.getRelationships();for(let r of n)if(i&&i[r]){let e=i[r].target;e.startsWith(`../`)?e=e.replace(`../`,`ppt/`):!e.startsWith(`/`)&&!e.startsWith(`ppt/`)&&(e=`ppt/${e}`);let n=`layout:${t.layoutPath}:${r}`;if(!this.imageCache.has(n)){let t=await this.zip.getFileData(e).catch(()=>null);if(t&&!this.isSVGFile(e)){let r=new Blob([t],{type:this.getMimeType(e)}),i=URL.createObjectURL(r),a=await this.imageLoader.loadImageFromUrl(i);this.imageCache.set(n,{image:a,url:i,path:e,width:a.naturalWidth,height:a.naturalHeight})}}this.updateShapeImageRelIds(t,r,n)}else e.add(r)}else n.forEach(t=>e.add(t))}catch{n.forEach(t=>e.add(t))}}let t=Array.from(e).map(e=>this.loadImage(e).catch(t=>(this.logger.log(`warn`,this.constructor.name,`Failed to preload image ${e}:`,t),null)));(await Promise.allSettled(t)).filter(e=>e.status===`fulfilled`&&e.value!==null).length}catch(e){this.logger.logError(this.constructor.name,`Error during image preloading:`,e)}}async loadImage(e){let t=this.svgRelationshipMap.get(e);if(t&&(e=t),this.imageCache.has(e))return this.imageCache.get(e);let n=this.imageMap.get(e);if(!n)return this.logger.log(`warn`,this.constructor.name,`No image path found for relId: ${e}`),null;if(n.startsWith(`data:`)){if(n.startsWith(`data:image/svg+xml`))try{let t=n.split(`,`)[1],r=atob(t);return this.imageCache.set(e,{type:`svg`,content:r,path:n,width:100,height:100}),this.imageCache.get(e)}catch(t){return this.logger.logError(this.constructor.name,`Failed to decode SVG data URI for ${e}:`,t),null}return null}try{let t=await this.zip.getFileData(n);if(!t)return null;let r=new Blob([t],{type:this.getMimeType(n)}),i=URL.createObjectURL(r),a=await this.imageLoader.loadImageFromUrl(i);return this.imageCache.set(e,{image:a,url:i,path:n,width:a.naturalWidth,height:a.naturalHeight}),this.imageCache.get(e)}catch{return null}}getMimeType(e){return{png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,bmp:`image/bmp`,svg:`image/svg+xml`,webp:`image/webp`,tiff:`image/tiff`}[e.toLowerCase().split(`.`).pop()]||`image/png`}async processThemes(e,t){try{let e=await t.getRelationships();if(!e){let e=new CTheme;this.presentation.theme=e;return}let n=Object.values(e).find(e=>e.type&&e.type.includes(`theme`)&&e.target);if(!n){let e=new CTheme;this.presentation.theme=e;return}let r=n.target;r.startsWith(`/`)?r=r.substring(1):r.startsWith(`../`)&&(r=r.replace(`../`,``)),r.startsWith(`ppt/`)||(r=`ppt/`+r);let i=await this.zip.getFileText(r);if(!i){let e=new CTheme;this.presentation.theme=e;return}let a=new DOMParser().parseFromString(i,`text/xml`);if(a.documentElement.nodeName===`parsererror`){let e=new CTheme;this.presentation.theme=e;return}let o=this.parseThemeFromXML(a);if(o)this.presentation.theme=o;else{let e=new CTheme;this.presentation.theme=e}}catch{let e=new CTheme;this.presentation.theme=e}}parseThemeFromXML(e){try{let t=e.querySelector(`a\\:theme, theme`);if(!t)return null;let n=t.querySelector(`a\\:themeElements a\\:clrScheme, themeElements clrScheme`);if(!n)return null;let r=new CTheme;r.name=t.getAttribute(`name`)||`Default Theme`,r.colors={},r.fonts={major:`Calibri`,minor:`Calibri`},r.colors=this.extractEnhancedThemeColors(n),r.colors.accent6&&this.parseColorFromHex(r.colors.accent6);let i=t.querySelector(`a\\:themeElements a\\:fontScheme, themeElements fontScheme`);if(i){let e=i.querySelector(`a\\:majorFont a\\:latin, majorFont latin`),t=i.querySelector(`a\\:minorFont a\\:latin, minorFont latin`);e&&(r.fonts.major=e.getAttribute(`typeface`)||`Calibri`),t&&(r.fonts.minor=t.getAttribute(`typeface`)||`Calibri`)}let a=t.querySelector(`a\\:themeElements a\\:fmtScheme, themeElements fmtScheme`);return a?r.formatScheme=this.parseEnhancedFormatScheme(a,r.colors):r.formatScheme=this.createEnhancedDefaultFormatScheme(r.colors),r.metadata={extracted:!0,source:`pptx_file`,timestamp:new Date().toISOString(),colorCount:Object.keys(r.colors).length,fillStyleCount:r.formatScheme.fillStyles?.length||0,backgroundFillCount:r.formatScheme.backgroundFills?.length||0},window.extractedTheme=r,r}catch{return null}}extractEnhancedThemeColors(e){let t={};try{for(let n of[`dk1`,`lt1`,`dk2`,`lt2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`,`bg1`,`tx1`,`bg2`,`tx2`]){let r=e.querySelector(`a\\:${n}, ${n}`)||e.querySelector(`[name="${n}"]`);if(r){let e=this.extractColorFromThemeElement(r);e&&(t[n]=e)}}let n=e.querySelectorAll(`*`);for(let e of n){let n=e.tagName.replace(`a:`,``);if(!t[n]&&n!==`clrScheme`&&n!==`themeElements`){let r=this.extractColorFromThemeElement(e);r&&(t[n]=r)}}t.dk1&&!t.tx1&&(t.tx1=t.dk1),t.lt1&&!t.bg1&&(t.bg1=t.lt1),t.dk2&&!t.tx2&&(t.tx2=t.dk2),t.lt2&&!t.bg2&&(t.bg2=t.lt2)}catch{}return t}extractColorFromThemeElement(e){try{let t=e.querySelector(`a\\:srgbClr, srgbClr`);if(t){let e=t.getAttribute(`val`);if(e&&/^[0-9A-Fa-f]{6}$/.test(e))return`#${e.toUpperCase()}`}let n=e.querySelector(`a\\:sysClr, sysClr`);if(n){let e=n.getAttribute(`lastClr`);if(e&&/^[0-9A-Fa-f]{6}$/.test(e))return`#${e.toUpperCase()}`;let t=n.getAttribute(`val`),r={windowText:`#000000`,window:`#FFFFFF`,btnFace:`#F0F0F0`,btnText:`#000000`};if(t&&r[t])return r[t]}let r=e.querySelector(`a\\:hslClr, hslClr`);if(r){let e=parseInt(r.getAttribute(`hue`)||`0`),t=parseInt(r.getAttribute(`sat`)||`0`)/1e5,n=parseInt(r.getAttribute(`lum`)||`0`)/1e5;return this.hslToHex(e/6e4,t,n)}let i=e.querySelector(`a\\:prstClr, prstClr`);if(i){let e=i.getAttribute(`val`),t={black:`#000000`,white:`#FFFFFF`,red:`#FF0000`,green:`#00FF00`,blue:`#0000FF`,yellow:`#FFFF00`,magenta:`#FF00FF`,cyan:`#00FFFF`};if(e&&t[e])return t[e]}}catch{}return null}hslToHex(e,t,n){let r=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),i=n<.5?n*(1+t):n+t-n*t,a=2*n-i,o=Math.round(r(a,i,e+1/3)*255),s=Math.round(r(a,i,e)*255),c=Math.round(r(a,i,e-1/3)*255);return`#${((1<<24)+(o<<16)+(s<<8)+c).toString(16).slice(1).toUpperCase()}`}parseFormatScheme(e){let t={fillStyles:[],backgroundFills:[],lineStyles:[]};try{let n=e.querySelector(`a\\:fillStyleLst, fillStyleLst`);if(n){let e=n.children;for(let n=0;n0&&(r.color=this.applyColorModifications(r.color,n)),r.scheme=e,r.modifications=n,r}}let a=e.querySelector(`a\\:srgbClr, srgbClr`);if(a){let e=a.getAttribute(`val`);if(e)return r.color=this.parseColorFromHex(`#${e}`),r}r.color=this.getDefaultColorForIndex(n,t),r.isDefault=!0}catch{r.color=this.getDefaultColorForIndex(n,t),r.isDefault=!0}return r}parseThemeAwareGradientFill(e,t,n){let r={type:`gradient`,index:n,gradient:{type:`linear`,stops:[]}};try{let n=e.querySelectorAll(`a\\:gs, gs`);for(let e=0;e0&&(a.color=this.applyColorModifications(a.color,n))}}if(!a.color){let e=i.querySelector(`a\\:srgbClr, srgbClr`);if(e){let t=e.getAttribute(`val`);t&&(a.color=this.parseColorFromHex(`#${t}`))}}a.color||(a.color=this.getDefaultColorForIndex(e,t)),r.gradient.stops.push(a)}let i=e.querySelector(`a\\:lin, lin`);if(i){let e=parseInt(i.getAttribute(`ang`)||`0`);r.gradient.angle=e/6e4}return r}catch{return{type:`solid`,index:n,color:this.getDefaultColorForIndex(n,t),isDefault:!0}}}getDefaultColorForIndex(e,t){let n=[`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`],r=n[e%n.length];return t&&t[r]?this.parseColorFromHex(t[r]):null}ensureMinimumFormatSchemeStyles(e,t){for(;e.fillStyles.length<6;){let n=e.fillStyles.length,r=this.createFallbackFillStyle(n,t);e.fillStyles.push(r)}for(;e.backgroundFills.length<3;){let n=e.backgroundFills.length,r=this.createFallbackBackgroundFillStyle(n,t);e.backgroundFills.push(r)}}createFallbackFillStyle(e,t){return{type:`solid`,index:e,color:this.getDefaultColorForIndex(e,t),isDefault:!0}}createFallbackBackgroundFillStyle(e,t){let n=[t?.bg1?this.parseColorFromHex(t.bg1):{r:255,g:255,b:255,a:255},t?.bg2?this.parseColorFromHex(t.bg2):{r:245,g:245,b:245,a:255},{r:220,g:220,b:220,a:255}];return{type:`solid`,index:e,color:n[e%n.length],isDefault:!0}}createEnhancedDefaultFormatScheme(e){let t={fillStyles:[],backgroundFills:[],lineStyles:[]};for(let n=0;n<6;n++)t.fillStyles.push(this.createFallbackFillStyle(n,e));for(let n=0;n<3;n++)t.backgroundFills.push(this.createFallbackBackgroundFillStyle(n,e));return t}createDefaultFormatScheme(){return{fillStyles:[],backgroundFills:[],lineStyles:[]}}async processSlideMasters(e,t){let n=this.presentation.masterIds||[],r=await t.getRelationships();for(let t of n){let n=r[t];if(n&&n.target){let t=n.target;t.startsWith(`/`)?t=t.substring(1):t.startsWith(`../`)&&(t=t.replace(`../`,``)),t.startsWith(`ppt/`)||(t=`ppt/`+t);let r=this.package.getPartByUri(`/`+t);if(r){let t=await r.getDocumentContent();if(t){let n=new StaxParser(t,r,e).parse();if(n){let t=this.createSlideMasterFromXML(n,r);t&&(this.slideMasters.push(t),this.presentation.addSlideMaster(t),await this.processSlideLayouts(e,t,r))}}}}}}async processSlideLayouts(e,t,n){let r=await n.getRelationships();for(let[n,i]of Object.entries(r))if(i.type===Bu.slideLayout.relationType){let r=i.target;r.startsWith(`/`)?r=r.substring(1):r.startsWith(`../`)&&(r=r.replace(`../`,``)),r.startsWith(`ppt/`)||(r=`ppt/`+r);let a=this.package.getPartByUri(`/`+r);if(a){let o=await a.getDocumentContent();if(o){let s=new StaxParser(o,a,e).parse();if(s){let e=this.createSlideLayoutFromXML(s,t.id,n,i.target,r);e&&(this.slideLayouts.push(e),t.addLayout(e))}}}}}createSlideMasterFromXML(e,t){let n=e.documentElement,r=t.uri||`master_`+this.slideMasters.length,i=new CSlideMaster;i.id=r,i.name=n.getAttribute(`name`)||`Master ${this.slideMasters.length+1}`,i.layoutIds=[];let a=e.querySelector(`sldLayoutIdLst, p\\:sldLayoutIdLst`);a&&a.querySelectorAll(`sldLayoutId, p\\:sldLayoutId`).forEach(e=>{let t=e.getAttribute(`r:id`);t&&i.layoutIds.push(t)});let o=e.querySelector(`cSld, p\\:cSld`);o&&(i.cSld={name:o.getAttribute(`name`)||``,bg:this.parseBackground(o),spTree:this.processShapeTree(o.querySelector(`spTree, p\\:spTree`))},i.commonSlideData=new CSld,i.commonSlideData.name=i.cSld.name,i.commonSlideData.backgroundFill=i.cSld.bg,i.commonSlideData.shapeTree=i.cSld.spTree);let s=e.querySelector(`txStyles, p\\:txStyles`);s&&(i.txStyles={titleStyle:this.parseTextStyleElement(s.querySelector(`titleStyle, p\\:titleStyle`)),bodyStyle:this.parseTextStyleElement(s.querySelector(`bodyStyle, p\\:bodyStyle`)),otherStyle:this.parseTextStyleElement(s.querySelector(`otherStyle, p\\:otherStyle`))});let c=e.querySelector(`clrMap, p\\:clrMap`);return c&&(i.clrMap=this.parseColorMapElement(c)),this.xmlParser.registerSlideMaster(i.id,i),i}createSlideLayoutFromXML(e,t,n=null,r=null,i=null){let a=e.documentElement,o=n||`layout_${this.slideLayouts.length}`,s=new CSlideLayout;s.id=o,s.relId=n,s.relTarget=r,s.layoutPath=i,s.uri=r,s.masterId=t,s.name=a.getAttribute(`name`)||`Layout ${this.slideLayouts.length+1}`,s.type=a.getAttribute(`type`)||`blank`,s.matchingName=a.getAttribute(`matchingName`)||``,s.preserve=a.getAttribute(`preserve`)===`true`,s.showMasterSp=a.getAttribute(`showMasterSp`)!==`false`,s.showMasterPhAnim=a.getAttribute(`showMasterPhAnim`)===`true`,s.userDrawn=a.getAttribute(`userDrawn`)!==`false`,s.type===`blank`?s.layoutType=this.inferLayoutTypeFromPlaceholders(a):s.layoutType=s.type;let c=e.querySelector(`cSld, p\\:cSld`);if(c){let e=c.querySelector(`spTree, p\\:spTree`),t=this.processShapeTree(e);s.cSld={name:c.getAttribute(`name`)||``,bg:this.parseBackground(c),spTree:t},s.commonSlideData=new CSld,s.commonSlideData.name=s.cSld.name,s.commonSlideData.backgroundFill=s.cSld.bg,s.commonSlideData.shapeTree=s.cSld.spTree}let l=e.querySelector(`txStyles, p\\:txStyles`);l&&(s.txStyles={titleStyle:this.parseTextStyleElement(l.querySelector(`titleStyle, p\\:titleStyle`)),bodyStyle:this.parseTextStyleElement(l.querySelector(`bodyStyle, p\\:bodyStyle`)),otherStyle:this.parseTextStyleElement(l.querySelector(`otherStyle, p\\:otherStyle`))});let u=e.querySelector(`clrMapOvr, p\\:clrMapOvr`);return u&&(s.clrMapOvr=this.parseColorMapOverride(u)),this.xmlParser.registerSlideLayout(s.id,s,t),s}async processSlides(e){let t=await this.package.getPartByRelationshipType(Bu.presentation.relationType).getRelationships(),n=[];for(let[e,r]of Object.entries(t))r.type===Bu.slide.relationType&&n.push({id:e,target:r.target});if(n.length===0)return;let r=n;try{let e=this.presentation&&Array.isArray(this.presentation.slideIds)?this.presentation.slideIds:[];if(e&&e.length>0){let t=new Map(n.map(e=>[e.id,e])),i=[];for(let n of e){let e=t.get(n);e&&(i.push(e),t.delete(n))}if(t.size>0)for(let e of t.values())i.push(e);i.length>0&&(r=i)}}catch{}for(let t=0;t!!(r.target&&e.relTarget&&r.target.split(`/`).pop()===e.relTarget.split(`/`).pop()));if(n||(n=this.slideLayouts.find(e=>e.uri===r.target)),n||(n=this.slideLayouts.find(e=>{if(r.target&&e.relTarget){let t=e=>e.replace(/^\.\.\//,``).replace(/^\//,``);if(t(r.target)===t(e.relTarget))return!0}return!1})),n||(n=this.slideLayouts.find(e=>e.relId===t)),n){e.layout=n,e.Layout=n;let t=this.slideMasters.find(e=>e.id===n.masterId);t&&(e.master=t,e.Master=t,n.master=t,n.Master=t);break}}!e.layout&&this.slideLayouts.length>0?(e.layout=this.slideLayouts[0],e.Layout=this.slideLayouts[0]):e.layout}catch{}}processShapeTree(e){let t=[];try{if(!e)return t;let n=e.children;for(let e=0;e{e.querySelector(`a\\:fillRef, fillRef`)});let t=e.querySelector(`spPr, p\\:spPr`);if(t){let e=this.processShapeProperties(t);e.transform&&!n.properties?.transform&&(n.properties=n.properties||{},n.properties.transform=e.transform,(!n.bounds||n.bounds.l===0&&n.bounds.t===0&&n.bounds.r===0&&n.bounds.b===0)&&(n.bounds={l:e.transform.x||0,t:e.transform.y||0,r:(e.transform.x||0)+(e.transform.cx||e.transform.width||0),b:(e.transform.y||0)+(e.transform.cy||e.transform.height||0)})),e.fill&&!n.fill&&(n.fill=e.fill),e.stroke&&!n.stroke&&(n.stroke=e.stroke),e.geometry&&!n.geometry&&(n.geometry=e.geometry),n.spPr||(n.spPr=e),e.effectLst&&(n.effects=e.effectLst),n.style||n.preservedStyle}let r=e.querySelector(`txBody, p\\:txBody`);r&&(n.textBody=this.processTextBody(r))}return n}catch{return{type:`unknown`,id:Math.random().toString(36).substr(2,9),name:`Unknown Shape`,bounds:{l:914400,t:914400,r:5486400,b:2743200}}}}processRegularShape(e){let t=new CShape;t.type=`sp`,t.name=this.getShapeName(e);let n=e.querySelector(`nvSpPr, p\\:nvSpPr`),r=n?.querySelector(`cNvPr, p\\:cNvPr`);if(t.id=r?.getAttribute(`id`)||e.getAttribute(`id`)||null,r){Array.from(r.attributes).map(e=>`${e.name}="${e.value}"`);let e=r.getAttribute(`order`)||r.getAttribute(`z-order`)||r.getAttribute(`zOrder`)||r.getAttribute(`drawOrder`);e&&(t.order=parseInt(e))}let i=e.getAttribute(`order`)||e.getAttribute(`z-order`)||e.getAttribute(`zOrder`)||e.getAttribute(`drawOrder`);i&&(t.order=parseInt(i));try{if(n){t.nvSpPr={cNvPr:null,nvPr:null},r&&(t.name=r.getAttribute(`name`)||t.name,t.nvSpPr.cNvPr={name:t.name,id:t.id});let e=n.querySelector(`nvPr, p\\:nvPr`);if(e){let n=e.querySelector(`ph, p\\:ph`);n&&(t.placeholder=this.parsePlaceholder(n),t.isPlaceholder=!0),t.nvSpPr.nvPr={placeholder:t.placeholder}}}t.type=`sp`;let i=e.querySelector(`spPr, p\\:spPr`);if(i){let e=this.processShapeProperties(i);t.properties=e,t.spPr=e,e.effectLst&&(t.effects=e.effectLst),e.transform?t.bounds={l:e.transform.x||0,t:e.transform.y||0,r:(e.transform.x||0)+(e.transform.cx||e.transform.width||0),b:(e.transform.y||0)+(e.transform.cy||e.transform.height||0)}:t.bounds={l:914400,t:914400,r:5486400,b:2743200},e.fill!==void 0&&(t.fill=e.fill),e.stroke&&(t.stroke=e.stroke);let n=i.querySelector(`prstGeom, a\\:prstGeom`);if(n){let e=n.getAttribute(`prst`)||`rect`,r={},i=n.querySelector(`avLst, a\\:avLst`);i&&i.querySelectorAll(`gd, a\\:gd`).forEach(e=>{let t=e.getAttribute(`name`),n=(e.getAttribute(`fmla`)||``).match(/^val\s+(-?\d+)$/);t&&n&&(r[t]=parseInt(n[1]))}),t.geometry={type:`preset`,preset:e,adjustments:r}}let r=i.querySelector(`custGeom, a\\:custGeom`);r&&(t.geometry={type:`custom`,pathList:this.parseCustomGeometry(r)})}else t.bounds={l:914400,t:914400,r:5486400,b:2743200};let a=e.querySelector(`txBody, p\\:txBody`);if(a&&(t.textBody=this.processTextBody(a),t.textBody&&t.textBody.paragraphs)){let e=``;for(let n of t.textBody.paragraphs)for(let t of n.runs)t.text&&t.text.trim()&&(e+=t.text+` `)}let o=!1,s=e.querySelector(`style, p\\:style`);if(s&&(t.style=this.parseShapeStyle(s),t.preservedStyle=t.style,o=!0),!o&&window.currentSlideData&&window.currentSlideData.rawXMLShapes){let e=window.currentSlideData.rawXMLShapes.find(e=>e.name===t.name||e.id===t.id);e&&e.style&&(t.style=e.style,t.preservedStyle=e.style,o=!0)}if(!o){let n=this.extractStyleFromElement(e);n&&Object.keys(n).length>0&&(t.style=n,t.preservedStyle=n,o=!0)}o?(window.currentSlideData=window.currentSlideData||{},window.currentSlideData.rawXMLShapes=window.currentSlideData.rawXMLShapes||[],window.currentSlideData.rawXMLShapes.findIndex(e=>e.name===t.name||e.id===t.id)===-1&&window.currentSlideData.rawXMLShapes.push({name:t.name,id:t.id,styleElement:s,style:t.style,hasStyle:!0})):(window.currentSlideData=window.currentSlideData||{},window.currentSlideData.rawXMLShapes=window.currentSlideData.rawXMLShapes||[],window.currentSlideData.rawXMLShapes.push({name:t.name,id:t.id,xmlElement:e,innerHTML:e.innerHTML.substring(0,500),hasStyle:!1}))}catch{}return this.applyPropertyInheritance(t),t}processPictureShape(e){let t=new CShape;t.type=`pic`;let n=!1,r=e.querySelector(`style, p\\:style`);if(r&&(t.style=this.parseShapeStyle(r),t.preservedStyle=t.style,n=!0),!n&&window.currentSlideData&&window.currentSlideData.rawXMLShapes){let e=window.currentSlideData.rawXMLShapes.find(e=>e.name===t.name||e.id===t.id);e&&e.style&&(t.style=e.style,t.preservedStyle=e.style,n=!0)}if(!n){let r=this.extractStyleFromElement(e);r&&Object.keys(r).length>0&&(t.style=r,t.preservedStyle=r,n=!0)}let i=e.querySelector(`spPr, p\\:spPr`);if(i){let e=this.processShapeProperties(i);t.properties=e,e.transform?t.bounds={l:e.transform.x||0,t:e.transform.y||0,r:(e.transform.x||0)+(e.transform.cx||e.transform.width||0),b:(e.transform.y||0)+(e.transform.cy||e.transform.height||0)}:t.bounds={l:914400,t:914400,r:5486400,b:2743200}}else t.bounds={l:914400,t:914400,r:5486400,b:2743200};let a=e.querySelector(`blipFill, p\\:blipFill`);if(a){let e=a.querySelector(`blip, a\\:blip`);if(e){let n=this.extractSVGRelationshipId(e);if(n)t.imageRelId=n,t.hasSVGAlternative=!0;else{let n=e.getAttribute(`r:embed`);n&&(t.imageRelId=n)}let r=e.querySelector(`effects, a\\:effects`);r&&(t.imageEffects=this.parseImageEffects(r))}let n=a.querySelector(`stretch, a\\:stretch`),r=a.querySelector(`tile, a\\:tile`);if(n){t.imageFillMode=`stretch`;let e=n.querySelector(`fillRect, a\\:fillRect`);e&&(t.imageFillRect={l:parseInt(e.getAttribute(`l`))||0,t:parseInt(e.getAttribute(`t`))||0,r:parseInt(e.getAttribute(`r`))||0,b:parseInt(e.getAttribute(`b`))||0})}else r?(t.imageFillMode=`tile`,t.imageTileProperties={tx:parseInt(r.getAttribute(`tx`))||0,ty:parseInt(r.getAttribute(`ty`))||0,sx:parseInt(r.getAttribute(`sx`))||1e5,sy:parseInt(r.getAttribute(`sy`))||1e5,flip:r.getAttribute(`flip`)||`none`,algn:r.getAttribute(`algn`)||`tl`}):t.imageFillMode=`stretch`;let i=a.querySelector(`srcRect, a\\:srcRect`);i&&(t.imageSrcRect={l:parseInt(i.getAttribute(`l`)||`0`),t:parseInt(i.getAttribute(`t`)||`0`),r:parseInt(i.getAttribute(`r`)||`0`),b:parseInt(i.getAttribute(`b`)||`0`)})}return t.name=this.getShapeName(e),this.applyPropertyInheritance(t),t}parseImageEffects(e){let t={},n=e.querySelector(`alphaMod, a\\:alphaMod`);n&&(t.alpha=parseInt(n.getAttribute(`val`))/1e5);let r=e.querySelector(`lum, a\\:lum`);r&&(t.brightness=parseInt(r.getAttribute(`bright`))||0,t.contrast=parseInt(r.getAttribute(`contrast`))||0);let i=e.querySelector(`clrMod, a\\:clrMod`);return i&&(t.colorMod=i.getAttribute(`val`)),e.querySelector(`grayscl, a\\:grayscl`)&&(t.grayscale=!0),t}parseEffectList(e){let t={},n=e.querySelector(`outerShdw, a\\:outerShdw`);n&&(t.outerShadow=this.parseOuterShadow(n));let r=e.querySelector(`innerShdw, a\\:innerShdw`);r&&(t.innerShadow=this.parseInnerShadow(r));let i=e.querySelector(`glow, a\\:glow`);i&&(t.glow=this.parseGlow(i));let a=e.querySelector(`reflection, a\\:reflection`);a&&(t.reflection=this.parseReflection(a));let o=e.querySelector(`softEdge, a\\:softEdge`);o&&(t.softEdge=this.parseSoftEdge(o));let s=e.querySelector(`prstShdw, a\\:prstShdw`);return s&&(t.presetShadow=this.parsePresetShadow(s)),t}parseOuterShadow(e){let t={};t.blurRadius=parseInt(e.getAttribute(`blurRad`))||0,t.distance=parseInt(e.getAttribute(`dist`))||0,t.direction=parseInt(e.getAttribute(`dir`))||0,t.scaleX=parseInt(e.getAttribute(`sx`))/1e5||1,t.scaleY=parseInt(e.getAttribute(`sy`))/1e5||1,t.skewX=parseInt(e.getAttribute(`kx`))||0,t.skewY=parseInt(e.getAttribute(`ky`))||0,t.alignment=e.getAttribute(`algn`)||`bl`,t.rotateWithShape=e.getAttribute(`rotWithShape`)===`1`;let n=e.querySelector(`srgbClr, a\\:srgbClr, schemeClr, a\\:schemeClr`);return n&&(t.color=this.parseColor(n)),t}parseInnerShadow(e){let t={};t.blurRadius=parseInt(e.getAttribute(`blurRad`))||0,t.distance=parseInt(e.getAttribute(`dist`))||0,t.direction=parseInt(e.getAttribute(`dir`))||0;let n=e.querySelector(`srgbClr, a\\:srgbClr, schemeClr, a\\:schemeClr`);return n&&(t.color=this.parseColor(n)),t}parseGlow(e){let t={};t.radius=parseInt(e.getAttribute(`rad`))||0;let n=e.querySelector(`srgbClr, a\\:srgbClr, schemeClr, a\\:schemeClr`);return n&&(t.color=this.parseColor(n)),t}parseReflection(e){let t={};return t.blurRadius=parseInt(e.getAttribute(`blurRad`))||0,t.startOpacity=parseInt(e.getAttribute(`stA`))/1e5||1,t.endOpacity=parseInt(e.getAttribute(`endA`))/1e5||0,t.distance=parseInt(e.getAttribute(`dist`))||0,t.direction=parseInt(e.getAttribute(`dir`))||0,t.fadeDirection=parseInt(e.getAttribute(`fadeDir`))||0,t.scaleX=parseInt(e.getAttribute(`sx`))/1e5||1,t.scaleY=parseInt(e.getAttribute(`sy`))/1e5||1,t.skewX=parseInt(e.getAttribute(`kx`))||0,t.skewY=parseInt(e.getAttribute(`ky`))||0,t.alignment=e.getAttribute(`algn`)||`bl`,t}parseSoftEdge(e){let t={};return t.radius=parseInt(e.getAttribute(`rad`))||0,t}parsePresetShadow(e){let t={};return t.preset=e.getAttribute(`prst`)||`shdw1`,t.distance=parseInt(e.getAttribute(`dist`))||0,t.direction=parseInt(e.getAttribute(`dir`))||0,t}parseColor(e){let t={};e.tagName.includes(`srgbClr`)?(t.type=`srgb`,t.value=e.getAttribute(`val`)||`000000`):e.tagName.includes(`schemeClr`)&&(t.type=`scheme`,t.value=e.getAttribute(`val`)||`dk1`);let n=e.querySelector(`alpha, a\\:alpha`);return n?t.alpha=parseInt(n.getAttribute(`val`))/1e5||1:t.alpha=1,t}processGroupShape(e){let t=new CShape;t.type=`grpSp`,t.name=this.getShapeName(e),t.id=e.getAttribute(`id`)||Math.random().toString(36).substr(2,9),t.shapeTree=[],t.groupCoordSystem={chOff:{x:0,y:0},chExt:{cx:0,cy:0},groupOff:{x:0,y:0},groupExt:{cx:0,cy:0}},this.applyComprehensiveStyleExtraction(t,e,`group`);let n=e.querySelector(`grpSpPr, p\\:grpSpPr`);n&&this.processGroupProperties(n,t);let r=e.querySelector(`spTree, p\\:spTree`);if(r)t.shapeTree=this.processShapeTreeInGroup(r,t);else{let n=e.children;for(let e=0;e0&&n.groupExt.cx>0&&(i=n.groupExt.cx/n.chExt.cx),n.chExt.cy>0&&n.groupExt.cy>0&&(a=n.groupExt.cy/n.chExt.cy);let o={l:n.groupOff.x+(r.l-n.chOff.x)*i,t:n.groupOff.y+(r.t-n.chOff.y)*a,r:n.groupOff.x+(r.r-n.chOff.x)*i,b:n.groupOff.y+(r.b-n.chOff.y)*a};e.originalBounds={...r},e.bounds=o,e.groupTransform={scaleX:i,scaleY:a,offsetX:n.groupOff.x-n.chOff.x*i,offsetY:n.groupOff.y-n.chOff.y*a}}calculateGroupBounds(e){if(!e.shapeTree||e.shapeTree.length===0){e.bounds={l:914400,t:914400,r:5486400,b:2743200};return}let t=1/0,n=1/0,r=-1/0,i=-1/0,a=!1;for(let o of e.shapeTree)o.bounds&&(t=Math.min(t,o.bounds.l),n=Math.min(n,o.bounds.t),r=Math.max(r,o.bounds.r),i=Math.max(i,o.bounds.b),a=!0);a?e.bounds={l:t,t:n,r,b:i}:e.bounds={l:914400,t:914400,r:5486400,b:2743200}}processConnectorShape(e){let t=new CShape;t.type=`cxnSp`,this.applyComprehensiveStyleExtraction(t,e,`connector`);try{let t=e.getAttribute(`id`)||e.getAttribute(`r:id`);this.logger?.log(`info`,this.constructor.name,`[Connector Parse] start`,{id:t})}catch{}let n=e.querySelector(`spPr, p\\:spPr`);if(n){let e=this.processShapeProperties(n);t.properties=e,e&&e.stroke&&(t.properties.line||(t.properties.line=e.stroke),t.stroke||(t.stroke=e.stroke)),e&&e.transform&&(t.transform=Object.assign(t.transform||{},e.transform));try{let e=n.querySelector(`a\\:ln, ln, p\\:ln`);if(e){let n=this.parseStroke(e);t.properties=t.properties||{},t.properties.stroke=n,t.properties.line=n,t.stroke=n,t.spPr=t.spPr||{},t.spPr.ln=Object.assign({},n)}}catch{}if(e.geometry&&(t.geometry=e.geometry),e.transform){t.bounds={l:e.transform.x||0,t:e.transform.y||0,r:(e.transform.x||0)+(e.transform.cx||e.transform.width||0),b:(e.transform.y||0)+(e.transform.cy||e.transform.height||0)};try{this.logger?.log(`info`,this.constructor.name,`[Connector Parse] bounds from transform`,{bounds:t.bounds,transform:e.transform})}catch{}}else{t.bounds={l:914400,t:914400,r:5486400,b:2743200};try{this.logger?.log(`warn`,this.constructor.name,`[Connector Parse] no transform, using fallback bounds`)}catch{}try{console.warn(`[Connector Parse] no transform; using fallback bounds`,t.bounds)}catch{}}}else{t.bounds={l:914400,t:914400,r:5486400,b:2743200};try{this.logger?.log(`warn`,this.constructor.name,`[Connector Parse] no spPr found, using fallback bounds`)}catch{}try{console.warn(`[Connector Parse] no spPr; using fallback bounds`,t.bounds)}catch{}}this.applyPropertyInheritance(t);try{this.getShapeStrokeColor(t),this.getShapeLineWidth(t),this.getShapeStrokeInfo(t)}catch{}return t}processGraphicFrame(e){let t=new CShape;t.type=`graphicFrame`,this.applyComprehensiveStyleExtraction(t,e,`graphic frame`);let n=e.querySelector(`spPr, p\\:spPr`);if(n){let e=this.processShapeProperties(n);if(e.transform){let n=e.transform.x||0,r=e.transform.y||0,i=e.transform.cx||e.transform.width||0,a=e.transform.cy||e.transform.height||0;t.bounds={l:n,t:r,r:n+i,b:r+a},t.x=n,t.y=r,t.w=i,t.h=a,t.properties||(t.properties={}),t.properties.transform={x:n,y:r,width:i,height:a,cx:i,cy:a}}else t.bounds={l:914400,t:914400,r:5486400,b:2743200},t.x=914400,t.y=914400,t.w=4572e3,t.h=1828800}else{let n=e.querySelector(`xfrm, p\\:xfrm`);if(n){let r=n.querySelector(`off, p\\:off`),i=n.querySelector(`ext, p\\:ext`);if(r&&i){let n=parseInt(r.getAttribute(`x`))||0,a=parseInt(r.getAttribute(`y`))||0,o=parseInt(i.getAttribute(`cx`)),s=parseInt(i.getAttribute(`cy`)),c=Number.isFinite(o)&&o>=0?o:914400,l=Number.isFinite(s)&&s>=0?s:914400;if(t.bounds={l:n,t:a,r:n+c,b:a+l},t.x=n,t.y=a,t.w=c,t.h=l,t.properties||(t.properties={}),t.properties.transform={x:n,y:a,width:c,height:l,cx:c,cy:l},n===0&&a===0||c<=1e5&&l<=1e5){let r=e.parentElement;for(;r&&r.tagName;){let e=r.querySelector(`xfrm, p\\:xfrm`);if(e){let n=e.querySelector(`off, p\\:off`),r=e.querySelector(`ext, p\\:ext`);if(n&&r){let e=parseInt(n.getAttribute(`x`))||0,i=parseInt(n.getAttribute(`y`))||0,a=parseInt(r.getAttribute(`cx`))||0,o=parseInt(r.getAttribute(`cy`))||0;if(a>1e5&&o>1e5){t.bounds={l:e,t:i,r:e+a,b:i+o},t.x=e,t.y=i,t.w=a,t.h=o,t.properties||(t.properties={}),t.properties.transform={x:e,y:i,width:a,height:o,cx:a,cy:o};break}}}r=r.parentElement}!t.bounds||t.x===n&&t.y}}else t.bounds={l:914400,t:914400,r:5486400,b:2743200},t.x=914400,t.y=914400,t.w=4572e3,t.h=1828800}else t.bounds={l:914400,t:914400,r:5486400,b:2743200},t.x=914400,t.y=914400,t.w=4572e3,t.h=1828800}let r=e.querySelector(`graphic`);if(r||(r=e.querySelector(`p\\:graphic`)),r||(r=e.querySelector(`a\\:graphic`)),r||(r=Array.from(e.children).find(e=>e.tagName.toLowerCase().includes(`graphic`))),r){let n=r.querySelector(`graphicData`);if(n||(n=r.querySelector(`p\\:graphicData`)),n||(n=r.querySelector(`a\\:graphicData`)),n||(n=Array.from(r.children).find(e=>e.tagName.toLowerCase().includes(`graphicdata`))),n){let r=n.getAttribute(`uri`);if(t.graphicData={uri:r},r===`http://schemas.openxmlformats.org/drawingml/2006/table`){let e=n.querySelector(`tbl`);e||(e=n.querySelector(`a\\:tbl`)),e||(e=Array.from(n.children).find(e=>e.tagName.toLowerCase().includes(`tbl`))),e&&(t.graphicData.tableXml=new XMLSerializer().serializeToString(e))}else if(r===`http://schemas.openxmlformats.org/drawingml/2006/chart`){t.graphicData.element=n;let r=n.querySelector(`chart`)||n.querySelector(`c\\:chart`)||n.querySelector(`[*|localName="chart"]`);if(r){let e=r.getAttribute(`r:id`);e&&(t.graphicData.chartRef=e)}if(ChartProcessor)try{t.asyncChartProcessing=!0,t.originalBounds={l:t.bounds.l,t:t.bounds.t,r:t.bounds.r,b:t.bounds.b};let n=t.originalBounds.r-t.originalBounds.l,r=t.originalBounds.b-t.originalBounds.t;t._debugInfo={event:`ORIGINAL_BOUNDS_STORAGE`,shapeType:t.type,rawBounds:t.bounds,originalBounds:t.originalBounds,originalDimensions:{width:n,height:r,widthInches:(n/914400).toFixed(2),heightInches:(r/914400).toFixed(2)}};let i={...this.context,zip:this.zip||this.zipProcessor?.zip};new ChartProcessor(i).parseChartFromGraphicFrame(e).then(e=>{e&&(t.chartData=e,t.asyncChartProcessing=!1,typeof window<`u`&&window.dispatchEvent(new CustomEvent(`chartRenderingComplete`,{detail:{chartData:e}})))}).catch(e=>{console.error(`[Chart Debug] Failed to parse chart data in slide-renderer:`,e),t.asyncChartProcessing=!1})}catch(e){console.error(`[Chart Debug] Failed to schedule chart parsing in slide-renderer:`,e)}else console.warn(`[Chart Debug] ChartProcessor not available on window object in slide-renderer`)}}}return t}processDefaultShape(e){let t=new CShape;t.type=`unknown`,this.applyComprehensiveStyleExtraction(t,e,`default shape`);let n=e.querySelector(`spPr, p\\:spPr`);if(n){let e=this.processShapeProperties(n);e.transform?t.bounds={l:e.transform.x||0,t:e.transform.y||0,r:(e.transform.x||0)+(e.transform.cx||e.transform.width||0),b:(e.transform.y||0)+(e.transform.cy||e.transform.height||0)}:t.bounds={l:914400,t:914400,r:5486400,b:2743200}}else t.bounds={l:914400,t:914400,r:5486400,b:2743200};return this.applyPropertyInheritance(t),t}getShapeName(e){let t=e.querySelector(`nvSpPr, p\\:nvSpPr`)||e.querySelector(`nvPicPr, p\\:nvPicPr`)||e.querySelector(`nvGrpSpPr, p\\:nvGrpSpPr`);if(t){let e=t.querySelector(`cNvPr, p\\:cNvPr`);if(e)return e.getAttribute(`name`)||``}return``}processShapeProperties(e){let t={};if(!e)return t;Array.from(e.children);try{let n=e.querySelector(`xfrm, p\\:xfrm, a\\:xfrm`);if(n||(n=e.querySelector(`xfrm`)),!n){for(let t of e.children)if(t.tagName===`xfrm`||t.tagName===`a:xfrm`||t.tagName===`p:xfrm`){n=t;break}}if(n){Array.from(n.children);let e=n.querySelector(`off, p\\:off, a\\:off`);if(e||(e=n.querySelector(`off`)),!e){for(let t of n.children)if(t.tagName===`off`||t.tagName===`a:off`||t.tagName===`p:off`){e=t;break}}let r=n.querySelector(`ext, p\\:ext, a\\:ext`);if(r||(r=n.querySelector(`ext`)),!r){for(let e of n.children)if(e.tagName===`ext`||e.tagName===`a:ext`||e.tagName===`p:ext`){r=e;break}}if(e&&(e.getAttribute(`x`),e.getAttribute(`y`)),r&&(r.getAttribute(`cx`),r.getAttribute(`cy`)),e&&r){let n=parseInt(e.getAttribute(`x`))||0,i=parseInt(e.getAttribute(`y`))||0,a=parseInt(r.getAttribute(`cx`))||100,o=parseInt(r.getAttribute(`cy`))||100;t.transform={x:n,y:i,cx:a,cy:o,width:a,height:o}}let i=n.getAttribute(`rot`);if(i){t.transform=t.transform||{};let e=parseInt(i)/6e4||0;t.transform.rot=e,t.transform.rotation=e,t.transform.rotEMU=parseInt(i)||0}let a=n.getAttribute(`flipH`),o=n.getAttribute(`flipV`);(a!==null||o!==null)&&(t.transform=t.transform||{},a!==null&&(t.transform.flipH=a===`1`||a===`true`),o!==null&&(t.transform.flipV=o===`1`||o===`true`))}let r=[`gradFill`,`solidFill`,`blipFill`,`pattFill`,`noFill`],i=null;for(let t of e.children){let e=t.localName||t.tagName?.replace(/^.*:/,``);if(r.includes(e)){i=t;break}}if(i){this._currentProcessingShape={name:this.getShapeName(e.closest(`sp, p\\:sp`))||`Unknown`},t.fill=this.parseFill(i),this._currentProcessingShape=null;let n=this.getShapeName(e.closest(`sp, p\\:sp`));n===`Rectangle 3`||n?.includes(`Rectangle 3`)}let a=e.querySelector(`ln, p\\:ln, a\\:ln`);a&&(t.stroke=this.parseStroke(a));let o=e.querySelector(`prstGeom, p\\:prstGeom, a\\:prstGeom`);if(o){let e=o.getAttribute(`prst`)||`rect`,n={},r=o.querySelector(`avLst, a\\:avLst`);r&&r.querySelectorAll(`gd, a\\:gd`).forEach(e=>{let t=e.getAttribute(`name`),r=(e.getAttribute(`fmla`)||``).match(/^val\s+(-?\d+)$/);t&&r&&(n[t]=parseInt(r[1]))}),t.geometry={type:`preset`,preset:e,adjustments:n}}else Array.from(e.children);let s=e.querySelector(`custGeom, p\\:custGeom, a\\:custGeom`);s&&(t.geometry={type:`custom`,pathList:this.parseCustomGeometry(s)});let c=e.querySelector(`effectLst, p\\:effectLst, a\\:effectLst`);c&&(t.effectLst=this.parseEffectList(c))}catch{}return t}processTextBody(e){let t={paragraphs:[],bodyProperties:this.parseBodyProperties(e)};try{let n=e.querySelector(`lstStyle, a\\:lstStyle`);n&&(t.lstStyle=this.parseListStyle(n));let r=e.querySelectorAll(`p, a\\:p`);for(let e of r){let n={runs:[],properties:this.parseParagraphProperties(e)},r=e.querySelectorAll(`r, a\\:r, fld, a\\:fld`);for(let e of r){let t=e.tagName?e.tagName.toLowerCase():``,r=t===`a:fld`||t===`fld`,i=e.querySelector(`t, a\\:t`),a={text:(i?i.textContent:``)||``,properties:this.parseRunProperties(e)};if(r){let t=e.getAttribute(`type`)||``;a.fieldType=t,!a.text&&(t===`slidenum`||t===`slideNum`)&&(a.text=`1`)}n.runs.push(a)}n.runs.length===0&&n.runs.push({text:``,properties:{}}),t.paragraphs.push(n)}t.paragraphs.reduce((e,t)=>e+t.runs.length,0),t.paragraphs.reduce((e,t)=>e+t.runs.filter(e=>e.text&&e.text.trim()).length,0),t.paragraphs.map(e=>e.runs.map(e=>e.text||``).join(``)).join(` `).trim()}catch{}return t}parseListStyle(e){let t={};try{for(let n=1;n<=9;n++){let r=e.querySelector(`lvl${n}pPr, a\\:lvl${n}pPr`);if(r){let e={align:r.getAttribute(`algn`)||`left`,marL:parseInt(r.getAttribute(`marL`))||0,indent:parseInt(r.getAttribute(`indent`))||0},i=r.querySelector(`defRPr, a\\:defRPr`);if(i){let t=i.getAttribute(`sz`);if(t){let n=parseInt(t);n>0&&(e.fontSize=n/100)}let n=i.getAttribute(`b`);n!==null&&(e.bold=n===`1`||n===`true`);let r=i.getAttribute(`i`);r!==null&&(e.italic=r===`1`||r===`true`);let a=i.getAttribute(`cap`);a&&(e.cap=a);let o=i.querySelector(`latin, a\\:latin`);o&&(e.fontFamily=o.getAttribute(`typeface`)||`Arial`);let s=i.querySelector(`solidFill, a\\:solidFill`);s&&(e.color=this.parseColor(s))}let a=r.querySelector(`spcBef, a\\:spcBef`);if(a){let t=a.querySelector(`spcPct, a\\:spcPct`),n=a.querySelector(`spcPts, a\\:spcPts`);t?e.spaceBeforePct=parseInt(t.getAttribute(`val`))/1e5:n&&(e.spaceBefore=parseInt(n.getAttribute(`val`))*127)}let o=r.querySelector(`spcAft, a\\:spcAft`);if(o){let t=o.querySelector(`spcPct, a\\:spcPct`),n=o.querySelector(`spcPts, a\\:spcPts`);t?e.spaceAfterPct=parseInt(t.getAttribute(`val`))/1e5:n&&(e.spaceAfter=parseInt(n.getAttribute(`val`))*127)}t[`lvl${n}pPr`]=e}}}catch{}return t}parseBodyProperties(e){let t={wrap:!0,verticalAlign:`top`,anchorX:`center`,anchorY:`middle`};try{let n=e.querySelector(`bodyPr, a\\:bodyPr`);if(n){n.getAttribute(`wrap`)===`none`&&(t.wrap=!1);let e=n.getAttribute(`anchor`);e&&(t.verticalAlign=e),t.anchorX=n.getAttribute(`anchorX`)||`center`,t.anchorY=n.getAttribute(`anchorY`)||`middle`,t.leftMargin=parseInt(n.getAttribute(`lIns`))||45720,t.rightMargin=parseInt(n.getAttribute(`rIns`))||45720,t.topMargin=parseInt(n.getAttribute(`tIns`))||22860,t.bottomMargin=parseInt(n.getAttribute(`bIns`))||22860}}catch{}return t}parseParagraphProperties(e){let t={align:`left`,lineHeight:100,spacing:{before:0,after:0},bullet:null};try{let n=e.querySelector(`pPr, a\\:pPr`);if(n){let e=n.getAttribute(`lvl`);e==null?t.level=0:t.level=parseInt(e)||0;let r=n.getAttribute(`algn`);r&&(t.align=r);let i=n.querySelector(`lnSpc, a\\:lnSpc`);if(i){let e=i.querySelector(`spcPct, a\\:spcPct`),n=i.querySelector(`spcPts, a\\:spcPts`);e?t.lineHeight=parseInt(e.getAttribute(`val`))/1e3:n&&(t.lineHeightPoints=parseInt(n.getAttribute(`val`))/100)}let a=n.querySelector(`spcBef, a\\:spcBef`);if(a){let e=a.querySelector(`spcPts, a\\:spcPts`);e&&(t.spacing.before=parseInt(e.getAttribute(`val`))*127)}let o=n.querySelector(`spcAft, a\\:spcAft`);if(o){let e=o.querySelector(`spcPts, a\\:spcPts`);e&&(t.spacing.after=parseInt(e.getAttribute(`val`))*127)}let s=n.getAttribute(`marL`),c=n.getAttribute(`indent`);(s!==null||c!==null)&&(t.indent={left:s?parseInt(s):0,hanging:c?parseInt(c):0}),this.parseBulletProperties(n,t);let l=n.querySelector(`defRPr, a\\:defRPr`);if(l){let e=parseInt(l.getAttribute(`sz`));e&&(t.fontSize=e/100),t.bold=l.getAttribute(`b`)===`1`,t.italic=l.getAttribute(`i`)===`1`;let n=l.querySelector(`latin, a\\:latin`);n&&(t.fontFamily=n.getAttribute(`typeface`)||`Arial`);let r=l.querySelector(`solidFill, a\\:solidFill`);r&&(t.color=this.parseColor(r))}}}catch{}return t}parseBulletProperties(e,t){try{let n=e.querySelector(`buChar, a\\:buChar`);if(n){let e=n.getAttribute(`char`);if(e){t.bullet={type:`character`,char:e};return}}let r=e.querySelector(`buNum, a\\:buNum`);if(r){let e=r.getAttribute(`startAt`)||`1`;t.bullet={type:`number`,startAt:parseInt(e)};return}let i=e.querySelector(`buAutoNum, a\\:buAutoNum`);if(i){let e=i.getAttribute(`type`)||`arabicPeriod`,n=i.getAttribute(`startAt`)||`1`;t.bullet={type:`autoNumber`,subType:e,startAt:parseInt(n)};return}if(e.querySelector(`buNone, a\\:buNone`)){t.bullet={type:`none`};return}}catch{}}parseRunProperties(e){let t={};try{let n=e.querySelector(`rPr, a\\:rPr`);if(n){let e=null;if(n.hasAttribute(`sz`))e=parseInt(n.getAttribute(`sz`));else{let t=n.querySelector(`sz, a\\:sz`);t&&(e=parseInt(t.getAttribute(`val`)))}e&&e>0&&(t.fontSize=e/100);let r=n.querySelector(`latin, a\\:latin`);if(r?t.fontFamily=r.getAttribute(`typeface`)||`Arial`:t.fontFamily=null,n.hasAttribute(`b`)){let e=n.getAttribute(`b`);t.bold=e!==`0`&&e!==`false`}if(n.hasAttribute(`i`)){let e=n.getAttribute(`i`);t.italic=e!==`0`&&e!==`false`}if(n.hasAttribute(`u`)&&(t.underline=n.getAttribute(`u`)!==`none`),n.hasAttribute(`strike`)&&(t.strike=n.getAttribute(`strike`)!==`noStrike`),n.hasAttribute(`baseline`)){let e=parseInt(n.getAttribute(`baseline`))||0;e>0?t.verticalAlign=`superscript`:e<0&&(t.verticalAlign=`subscript`)}n.hasAttribute(`cap`)&&(t.cap=n.getAttribute(`cap`)),n.hasAttribute(`spc`)&&(t.letterSpacing=parseInt(n.getAttribute(`spc`))/100);let i=n.querySelector(`solidFill, a\\:solidFill`);i&&(t.color=this.parseColor(i));let a=n.querySelector(`highlight, a\\:highlight`);a&&(t.highlight=this.parseColor(a));let o=n.querySelector(`effectLst, a\\:effectLst`);o&&(t.effectLst=this.parseEffectList(o))}}catch{}return t}parseFill(e){if(!e)return null;let t=this._currentProcessingShape;if(t&&(t.name===`Rectangle 3`||t.name?.includes(`Rectangle 3`)),(e.tagName||e.localName||``).indexOf(`gradFill`)>=0||(e.localName||``).indexOf(`gradFill`)>=0)return{type:`gradient`,gradient:this.parseGradient(e)};let n=e.querySelector(`solidFill, a\\:solidFill`);if(!n&&(e.tagName===`a:solidFill`||e.tagName===`solidFill`)&&(n=e),n){let e=null;try{e=this.parseColor(n)}catch{return null}return{type:`solid`,color:e}}let r=e.querySelector(`gradFill, a\\:gradFill`);if(r)return{type:`gradient`,gradient:this.parseGradient(r)};let i=e.querySelector(`pattFill, a\\:pattFill`);if(i)return{type:`pattern`,pattern:this.parsePattern(i)};let a=e.querySelector(`blipFill, a\\:blipFill`);return a?{type:`image`,imageData:this.parseBlipFill(a)}:e.querySelector(`noFill, a\\:noFill`)||e.tagName===`a:noFill`||e.tagName===`noFill`||e.localName===`noFill`?{type:`none`}:null}parseBlipFill(e){let t=e.querySelector(`blip, a\\:blip`);if(!t)return null;let n={},r=t.getAttribute(`r:embed`);r&&(n.relationshipId=r);let i=e.querySelector(`effects, a\\:effects`);i&&(n.effects=this.parseImageEffects(i));let a=e.querySelector(`stretch, a\\:stretch`),o=e.querySelector(`tile, a\\:tile`);if(a){n.fillMode=`stretch`;let e=a.querySelector(`fillRect, a\\:fillRect`);e&&(n.fillRect={l:parseInt(e.getAttribute(`l`))||0,t:parseInt(e.getAttribute(`t`))||0,r:parseInt(e.getAttribute(`r`))||0,b:parseInt(e.getAttribute(`b`))||0})}else o?(n.fillMode=`tile`,n.tileProperties={tx:parseInt(o.getAttribute(`tx`))||0,ty:parseInt(o.getAttribute(`ty`))||0,sx:parseInt(o.getAttribute(`sx`))||1e5,sy:parseInt(o.getAttribute(`sy`))||1e5,flip:o.getAttribute(`flip`)||`none`,algn:o.getAttribute(`algn`)||`tl`}):n.fillMode=`stretch`;let s=e.querySelector(`srcRect, a\\:srcRect`);return s&&(n.sourceRect={l:parseInt(s.getAttribute(`l`))||0,t:parseInt(s.getAttribute(`t`))||0,r:parseInt(s.getAttribute(`r`))||0,b:parseInt(s.getAttribute(`b`))||0}),n}parseColor(e){if(!e)return{r:0,g:0,b:0,a:255};let t=e.querySelector(`srgbClr, a\\:srgbClr`);if(t){let e=t.getAttribute(`val`);if(e){let n={r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:255};return n=this.applyColorModificationsToRgb(t,n),n}}let n=e.querySelector(`schemeClr, a\\:schemeClr`);if(n){let e=n.getAttribute(`val`),t=this._currentProcessingShape;if(t&&(t.name===`Rectangle 3`||t.name?.includes(`Rectangle 3`))&&this.presentation?.theme?.colors,e===`phClr`)return{type:`placeholder`,scheme:`phClr`,modifications:this.parseColorModifications(n),r:128,g:128,b:128,a:255};let r=null;if(this.presentation&&this.presentation.theme&&this.presentation.theme.colors){let t=this.presentation.theme.colors[e];t&&(r=this.parseColorFromHex(t))}return r||(r={}[e]||null),r=this.applyColorModificationsToRgb(n,r),r}return{r:0,g:0,b:0,a:255}}parseColorModifications(e){let t=[],n=e.querySelectorAll(`*`);for(let e of n){let n=e.tagName.replace(`a:`,``).toLowerCase(),r=e.getAttribute(`val`);r&&t.push({type:n,value:parseInt(r)})}return t}applyColorModificationsToRgb(e,t){if(!e)return t;let n={...t},r=e.querySelector(`tint, a\\:tint`);if(r){let e=parseInt(r.getAttribute(`val`))/1e5;n.r=Math.round(n.r+(255-n.r)*e),n.g=Math.round(n.g+(255-n.g)*e),n.b=Math.round(n.b+(255-n.b)*e)}let i=e.querySelector(`shade, a\\:shade`);if(i){let e=parseInt(i.getAttribute(`val`))/1e5;n.r=Math.round(n.r*(1-e)),n.g=Math.round(n.g*(1-e)),n.b=Math.round(n.b*(1-e))}let a=e.querySelector(`lumMod, a\\:lumMod`);if(a){let e=parseInt(a.getAttribute(`val`))/1e5;n.r=Math.round(n.r*e),n.g=Math.round(n.g*e),n.b=Math.round(n.b*e)}let o=e.querySelector(`lumOff, a\\:lumOff`);if(o){let e=parseInt(o.getAttribute(`val`))/1e5*255;n.r=Math.round(Math.min(255,n.r+e)),n.g=Math.round(Math.min(255,n.g+e)),n.b=Math.round(Math.min(255,n.b+e))}let s=e.querySelector(`alpha, a\\:alpha`);if(s){let e=parseInt(s.getAttribute(`val`))/1e5;n.a=Math.round(255*e)}return n.r=Math.max(0,Math.min(255,n.r)),n.g=Math.max(0,Math.min(255,n.g)),n.b=Math.max(0,Math.min(255,n.b)),n.a=Math.max(0,Math.min(255,n.a)),n}parseGradient(e){let t={stops:[],type:`linear`},n=e.querySelector(`gsLst, a\\:gsLst`);n&&n.querySelectorAll(`gs, a\\:gs`).forEach(e=>{let n=parseInt(e.getAttribute(`pos`))||0,r=this.parseColor(e);t.stops.push({position:n/1e5,color:r})});let r=e.querySelector(`lin, a\\:lin`);return r&&(t.angle=parseInt(r.getAttribute(`ang`))||0,t.scaled=r.getAttribute(`scaled`)===`true`),e.querySelector(`rad, a\\:rad`)&&(t.type=`radial`),t}parsePattern(e){return{preset:e.getAttribute(`prst`),foregroundColor:this.parseColor(e.querySelector(`fgClr, a\\:fgClr`)),backgroundColor:this.parseColor(e.querySelector(`bgClr, a\\:bgClr`))}}parseStroke(e){try{let t={};if(e.querySelector(`noFill, a\\:noFill`))return t.noFill=!0,t.width=0,t;let n=e.getAttribute(`w`);n?t.width=parseInt(n)||12700:t.width=12700;let r=e.querySelector(`solidFill, a\\:solidFill`);r?t.color=this.parseColor(r):(r=e.querySelector(`gradFill, a\\:gradFill`),r&&(t.gradient=this.parseGradient(r),t.color=t.gradient));let i=e.getAttribute(`cap`);i?t.cap=i:t.cap=`flat`;let a=e.getAttribute(`join`);a?t.join=a:t.join=`round`;let o=e.getAttribute(`cmpd`);o?t.compound=o:t.compound=`sng`;let s=e.querySelector(`prstDash, a\\:prstDash`);s?(t.dashStyle=s.getAttribute(`val`)||`solid`,t.dashArray=this.getDashArray(t.dashStyle)):(t.dashStyle=`solid`,t.dashArray=[]);let c=e.querySelector(`custDash, a\\:custDash`);c&&(t.dashArray=this.parseCustomDash(c),t.dashStyle=`custom`);let l=e.getAttribute(`algn`);l?t.alignment=l:t.alignment=`ctr`;let u=e.querySelector(`headEnd, a\\:headEnd`);u&&(t.headEnd={type:u.getAttribute(`type`)||u.getAttribute(`val`)||`none`,w:u.getAttribute(`w`)||u.getAttribute(`width`)||`med`,len:u.getAttribute(`len`)||u.getAttribute(`length`)||`med`});let d=e.querySelector(`tailEnd, a\\:tailEnd`);return d&&(t.tailEnd={type:d.getAttribute(`type`)||d.getAttribute(`val`)||`none`,w:d.getAttribute(`w`)||d.getAttribute(`width`)||`med`,len:d.getAttribute(`len`)||d.getAttribute(`length`)||`med`}),t}catch{return{color:{r:0,g:0,b:0,a:255},width:12700,cap:`flat`,join:`round`,compound:`sng`,dashStyle:`solid`,dashArray:[],alignment:`ctr`}}}getDashArray(e){return{solid:[],dot:[1,1],dash:[3,1],dashDot:[3,1,1,1],dashDotDot:[3,1,1,1,1,1],lgDash:[8,3],lgDashDot:[8,3,1,3],lgDashDotDot:[8,3,1,3,1,3],sysDash:[2,2],sysDot:[1,2],sysDashDot:[2,2,1,2],sysDashDotDot:[2,2,1,2,1,2]}[e]||[]}parseCustomDash(e){let t=[];try{let n=e.querySelectorAll(`ds, a\\:ds`);for(let e of n){let n=parseInt(e.getAttribute(`d`))||1e5,r=parseInt(e.getAttribute(`sp`))||1e5;t.push(n/1e5,r/1e5)}}catch{}return t}parseCustomGeometry(e){let t=[];try{let n=e.querySelector(`pathLst, a\\:pathLst`);if(n){let e=n.querySelectorAll(`path, a\\:path`);for(let n of e){let e={w:parseInt(n.getAttribute(`w`))||100,h:parseInt(n.getAttribute(`h`))||100,commands:[]},r=n.querySelectorAll(`moveTo, lnTo, lineTo, cubicBezTo, quadBezTo, close, a\\:moveTo, a\\:lnTo, a\\:lineTo, a\\:cubicBezTo, a\\:quadBezTo, a\\:close`);for(let t of r){let n=this.parsePathCommand(t);n&&e.commands.push(n)}t.push(e)}}}catch{}return t}parsePathCommand(e){switch(e.tagName.toLowerCase().replace(/^a:/,``)){case`moveto`:let t=e.querySelector(`pt, a\\:pt`);if(t)return{type:`moveTo`,x:parseInt(t.getAttribute(`x`))||0,y:parseInt(t.getAttribute(`y`))||0};break;case`lnto`:case`lineto`:{let t=e.querySelector(`pt, a\\:pt`);if(t)return{type:`lineTo`,x:parseInt(t.getAttribute(`x`))||0,y:parseInt(t.getAttribute(`y`))||0};break}case`cubicbezto`:let n=e.querySelectorAll(`pt, a\\:pt`);if(n.length>=3)return{type:`cubicBezTo`,x1:parseInt(n[0].getAttribute(`x`))||0,y1:parseInt(n[0].getAttribute(`y`))||0,x2:parseInt(n[1].getAttribute(`x`))||0,y2:parseInt(n[1].getAttribute(`y`))||0,x3:parseInt(n[2].getAttribute(`x`))||0,y3:parseInt(n[2].getAttribute(`y`))||0};break;case`quadbezto`:{let t=e.querySelectorAll(`pt, a\\:pt`);if(t.length>=2)return{type:`quadBezTo`,x1:parseInt(t[0].getAttribute(`x`))||0,y1:parseInt(t[0].getAttribute(`y`))||0,x:parseInt(t[1].getAttribute(`x`))||0,y:parseInt(t[1].getAttribute(`y`))||0};break}case`close`:return{type:`close`}}return null}parseShapeStyle(e){let t={};try{let n=e.querySelector(`fillRef, a\\:fillRef`);n&&(t.fillRef={idx:parseInt(n.getAttribute(`idx`))||0,color:this.parseColor(n)});let r=e.querySelector(`lnRef, a\\:lnRef`);r&&(t.lnRef={idx:parseInt(r.getAttribute(`idx`))||0,color:this.parseColor(r)});let i=e.querySelector(`effectRef, a\\:effectRef`);i&&(t.effectRef={idx:parseInt(i.getAttribute(`idx`))||0});let a=e.querySelector(`fontRef, a\\:fontRef`);a&&(t.fontRef={idx:a.getAttribute(`idx`)||`minor`})}catch{}return t}extractStyleFromElement(e){let t={};try{let n=e.querySelector(`style, p\\:style, a\\:style`);if(n)return this.parseShapeStyle(n);let r=e.querySelector(`spPr, p\\:spPr`);if(r){let e=this.extractStyleAttributesFromSpPr(r);e&&Object.keys(e).length>0&&Object.assign(t,e)}let i=this.extractStyleAttributesFromElement(e);i&&Object.keys(i).length>0&&Object.assign(t,i);let a=e.querySelector(`nvSpPr, p\\:nvSpPr`);if(a){let e=this.extractStyleAttributesFromNvSpPr(a);e&&Object.keys(e).length>0&&Object.assign(t,e)}}catch{}return t}extractStyleAttributesFromSpPr(e){let t={};try{let n=e.getAttribute(`style`)||e.getAttribute(`styleRef`);if(n){let e=this.parseStyleReference(n);e&&Object.assign(t,e)}let r=e.querySelector(`schemeClr, a\\:schemeClr`);if(r){let e=r.getAttribute(`val`);e&&(t.schemeColor=e)}}catch{}return t}extractStyleAttributesFromElement(e){let t={};try{[`style`,`styleRef`,`themeRef`,`colorRef`].forEach(n=>{let r=e.getAttribute(n);r&&(t[n]=r)})}catch{}return t}extractStyleAttributesFromNvSpPr(e){let t={};try{let n=e.querySelector(`ph, p\\:ph`);if(n){let e=n.getAttribute(`type`);if(n.getAttribute(`idx`),e){let n={title:{fillRef:{idx:1}},body:{fillRef:{idx:2}},ctrTitle:{fillRef:{idx:1}},subTitle:{fillRef:{idx:2}},obj:{fillRef:{idx:3}}};n[e]&&Object.assign(t,n[e])}}}catch{}return t}parseStyleReference(e){try{if(e.includes(`fillRef`)){let t=e.match(/fillRef:(\d+)/);if(t)return{fillRef:{idx:parseInt(t[1])||0}}}}catch{}return null}applyComprehensiveStyleExtraction(e,t,n=`shape`){let r=!1,i=t.querySelector(`style, p\\:style`);if(i&&(e.style=this.parseShapeStyle(i),e.preservedStyle=e.style,r=!0),!r&&window.currentSlideData&&window.currentSlideData.rawXMLShapes){let t=window.currentSlideData.rawXMLShapes.find(t=>t.name===e.name||t.id===e.id);t&&t.style&&(e.style=t.style,e.preservedStyle=t.style,r=!0)}if(!r){let n=this.extractStyleFromElement(t);n&&Object.keys(n).length>0&&(e.style=n,e.preservedStyle=n,r=!0)}return r}hexToRgb(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:0,g:0,b:0}}initializeRendering(){try{let e=document.createElement(`canvas`);if(e.width=800,e.height=600,this.getGraphicsEngine()||this.initializeGraphicsEngine(),this.drawingDocument){this.drawingDocument.init(e,this);let t=typeof globalThis<`u`&&globalThis.SVGRenderer||typeof window<`u`&&window.SVGRenderer||null;if(t&&this.drawingDocument.graphics)this.svgRenderer=new t(this.drawingDocument.graphics);else throw Error(`SVGRenderer is not defined`)}else throw Error(`standard graphics engine not available`)}catch(e){throw Error(`Failed to initialize rendering system: `+e.message)}}async renderSlide(e,t){let n=performance.now();try{if(!e)throw Error(`Canvas is required for rendering`);if(t<0||t>=this.slides.length)throw Error(`Invalid slide index: ${t}`);let r=this.slides[t];if(!r)throw Error(`Slide at index ${t} is null`);this.currentSlide=r,this.getGraphicsEngine()||this.initializeGraphicsEngine();let i=this.getSlideDimensions();if(this.calculateCanvasRect(e,i),!this.drawingDocument)throw Error(`standard graphics engine not available`);this.drawingDocument.init(e,this);let a=this.drawingDocument.graphics;this.renderContext.enableOptimizations&&(a.updatedRect=new Vu(0,0,parseFloat(e.style.width)||e.width/(window.devicePixelRatio||1),parseFloat(e.style.height)||e.height/(window.devicePixelRatio||1))),a.clear(),await this.preloadSlideImages(t),this.logSlideImageStatus(r,t),this.currentSlideIndex=t,await this.drawingDocument.drawSlide(r,t),performance.now()-n}catch(t){if(e){let n=e.getContext(`2d`);n.fillStyle=`#ffebee`,n.fillRect(0,0,e.width,e.height),n.fillStyle=`#f44336`,n.font=`16px Arial`,n.textAlign=`center`,n.fillText(`Rendering Error`,e.width/2,e.height/2),n.fillText(t.message,e.width/2,e.height/2+25)}}}async renderMaster(e,t){try{if(!e)throw Error(`Canvas is required for rendering`);if(t<0||t>=this.slideMasters.length)throw Error(`Invalid master index: ${t}`);let n=this.slideMasters[t];if(!n)throw Error(`Master at index ${t} is null`);let r={name:n.name||`Master ${t+1}`,type:`master`,commonSlideData:n.commonSlideData||n.cSld,backgroundFill:n.cSld?.bg,showMasterShapes:!1,layout:null,master:null};this.currentSlide=r;let i=this.getSlideDimensions();this.calculateCanvasRect(e,i),this.drawingDocument||this.initializeRendering(),this.drawingDocument.init(e,this),this.drawingDocument.graphics.clear(),await this.drawingDocument.drawSlide(r,t)}catch(t){if(e){let n=e.getContext(`2d`);n.fillStyle=`#f0f8ff`,n.fillRect(0,0,e.width,e.height),n.fillStyle=`#e74c3c`,n.font=`16px Arial`,n.textAlign=`center`,n.fillText(`Master Rendering Error`,e.width/2,e.height/2),n.fillText(t.message,e.width/2,e.height/2+25)}}}async renderLayout(e,t){try{if(!e)throw Error(`Canvas is required for rendering`);if(t<0||t>=this.slideLayouts.length)throw Error(`Invalid layout index: ${t}`);let n=this.slideLayouts[t];if(!n)throw Error(`Layout at index ${t} is null`);let r=this.slideMasters.find(e=>e.id===n.masterId),i={name:n.name||`Layout ${t+1}`,type:`layout`,commonSlideData:n.commonSlideData||n.cSld,backgroundFill:n.cSld?.bg||r?.cSld?.bg,showMasterShapes:n.showMasterSp!==!1,layout:n,master:r};this.currentSlide=i;let a=this.getSlideDimensions();this.calculateCanvasRect(e,a),this.drawingDocument||this.initializeRendering(),this.drawingDocument.init(e,this),this.drawingDocument.graphics.clear(),await this.drawingDocument.drawSlide(i,t)}catch(t){if(e){let n=e.getContext(`2d`);n.fillStyle=`#fff5f5`,n.fillRect(0,0,e.width,e.height),n.fillStyle=`#e74c3c`,n.font=`16px Arial`,n.textAlign=`center`,n.fillText(`Layout Rendering Error`,e.width/2,e.height/2),n.fillText(t.message,e.width/2,e.height/2+25)}}}drawRegularShapeGeometry(e,t,n,r,i,a,o,s,c,l=null){let u=this.getShapePreset(t);!u&&t.geometry&&(u=t.geometry.preset),!u&&t.properties&&t.properties.geometry&&(u=t.properties.geometry.preset),l?o=l:o&&typeof o==`object`&&o.type;let d=null,f=null;o&&(o.type===`linear`&&o.stops?d=o:typeof o==`string`?d=this.hexToRgb(o):o.r!==void 0&&(d=o)),s&&(typeof s==`string`?f=this.hexToRgb(s):s.r!==void 0&&(f=s));let p=this.getShapeStrokeInfo(t);u?e.drawPresetGeometry(u,n,r,i,a,d,f,c,p):e.drawRectangle(n,r,i,a,d,f,c,p)}getSlideCount(){return this.slides.length}getCurrentSlideIndex(){return this.currentSlideIndex}getSlideInfo(e){let t=this.slides[e];return t?{index:e,name:t.getName(),shapeCount:t.getShapeTree().length}:null}getSlideDimensions(){return this.presentation?.slideSize||{cx:9144e3,cy:6858e3}}getSlideDimensionsForCanvas(e,t){let n=this.getSlideDimensions(),r=e/n.cx,i=t/n.cy,a=Math.min(r,i);return{width:n.cx*a,height:n.cy*a,scale:a,offsetX:(e-n.cx*a)/2,offsetY:(t-n.cy*a)/2}}async generateSlideThumbnail(e,t=320,n=240){try{if(this.getGraphicsEngine()||this.initializeGraphicsEngine(),!this.slides[e])return this.createFallbackThumbnail(e,t,n);let r=this.slides[e],i=this.getSlideDimensions();i.cx/i.cy;let a=i.cx/914400*96,o=i.cy/914400*96,s=t/a,c=n/o,l=Math.min(s,c),u=a*l,d=o*l;u=Math.max(u,100),d=Math.max(d,75);let f=document.createElement(`canvas`);if(this.setupHighResolutionCanvas(f,u,d),this.drawingDocument){this.drawingDocument.init(f,this);try{return await this.drawingDocument.drawSlide(r,e),f}catch{return this.createFallbackThumbnail(e,u,d)}}else return this.createFallbackThumbnail(e,u,d)}catch{return this.createFallbackThumbnail(e,t,n)}}createFallbackThumbnail(e,t,n){let r=document.createElement(`canvas`);this.setupHighResolutionCanvas(r,t,n);let i=r.getContext(`2d`);i.fillStyle=`#f0f0f0`,i.fillRect(0,0,t,n),i.fillStyle=`#666`,i.font=`16px Arial`,i.textAlign=`center`,i.fillText(`Slide ${e+1}`,t/2,n/2);try{let e=this.getSlideDimensions(),r=e.cx/e.cy;i.font=`12px Arial`,i.fillText(`${r.toFixed(2)}:1`,t/2,n/2+20)}catch{}return r}inferLayoutTypeFromPlaceholders(e){let t=e.querySelector(`cSld, p\\:cSld`);if(!t)return`blank`;let n=t.querySelector(`spTree, p\\:spTree`);if(!n)return`blank`;let r=[],i=n.children;for(let e=0;e{let t=this.rgbToHex(e.color);o.addColorStop(e.position,t)}),r.fillStyle=o,r.fillRect(0,0,i,a)}renderImageBackground(e,t,n){if(!t.imageData||!t.imageData.relationshipId){e.fillRect(0,0,n.widthPx,n.heightPx,`#f0f0f0`);return}let r=t.imageData.relationshipId,i=this.imageCache.get(r);if(i&&i.image)this.drawBackgroundImage(e,i.image,t.imageData,n);else{e.fillRect(0,0,n.widthPx,n.heightPx,`#f8f9fa`);let t=e.context;t.fillStyle=`#6c757d`,t.font=`14px Arial`,t.textAlign=`center`,t.fillText(`Loading background...`,n.widthPx/2,n.heightPx/2),this.loadImageAsync(r)}}drawBackgroundImage(e,t,n,r){let i=e.context,{widthMM:a,heightMM:o}=r;i.save();try{if(n.fillMode===`tile`)this.drawTiledBackgroundImage(i,t,n.tileProperties,a,o);else{let r=0,i=0,s=a,c=o;if(n.fillRect){let e=n.fillRect;r=a*e.l/1e5,i=o*e.t/1e5,s=a*(1e5-e.l-e.r)/1e5,c=o*(1e5-e.t-e.b)/1e5}if(n.sourceRect){let a=n.sourceRect,o=t.naturalWidth*a.l/1e5,l=t.naturalHeight*a.t/1e5,u=t.naturalWidth*(1e5-a.l-a.r)/1e5,d=t.naturalHeight*(1e5-a.t-a.b)/1e5;e.drawImageHighRes(t,o,l,u,d,r,i,s,c)}else e.drawImageHighRes(t,r,i,s,c)}n.effects&&this.applyImageEffects(e,n.effects)}catch{i.fillStyle=`#f0f0f0`,i.fillRect(0,0,a,o)}finally{i.restore()}}drawTiledBackgroundImage(e,t,n,r,i){if(!n)return;let a=n.sx/1e5,o=n.sy/1e5,s=n.tx/914400*25.4,c=n.ty/914400*25.4,l=t.naturalWidth*a,u=t.naturalHeight*o,d=document.createElement(`canvas`);d.width=l,d.height=u;let f=d.getContext(`2d`);f.imageSmoothingEnabled=!0,f.imageSmoothingQuality=`high`,f.drawImage(t,0,0,l,u);let p=e.createPattern(d,`repeat`);e.save(),e.translate(s,c),e.fillStyle=p,e.fillRect(-s,-c,r,i),e.restore()}renderPatternBackground(e,t,n){let r=t.pattern?.foregroundColor||{r:128,g:128,b:128,a:255},i=this.rgbToHex(r);e.fillRect(0,0,n.widthMM,n.heightMM,i)}getShapeFillColor(e){if(this._currentProcessingShape=e,e&&(e.name===`Rectangle 3`||e.name?.includes(`Rectangle 3`)),e.fill){if(e.fill.type===`solid`&&e.fill.color){let t=this.processShapeColor(e.fill.color);return this._currentProcessingShape=null,t}if(e.fill.type===`gradient`&&e.fill.gradient)return this._currentProcessingShape=null,this.processGradientFill(e.fill.gradient);if(e.fill.type===`none`)return this._currentProcessingShape=null,null}if(e.properties&&e.properties.fill){if(e.properties.fill.type===`solid`&&e.properties.fill.color){let t=this.processShapeColor(e.properties.fill.color);return this._currentProcessingShape=null,t}if(e.properties.fill.type===`gradient`&&e.properties.fill.gradient)return this.processGradientFill(e.properties.fill.gradient);if(e.properties.fill.type===`none`)return null}if(e.type===`sp`&&e.placeholder&&e.placeholder.type)switch(e.placeholder.type){case`title`:case`ctrTitle`:case`body`:case`obj`:return this._currentProcessingShape=null,null;default:return this._currentProcessingShape=null,null}let t=e.preservedStyle||e.style;if(t&&t.fillRef){this._currentProcessingShape=e;let n=this.resolveStyleFillColor(t.fillRef);if(n)return this._currentProcessingShape=null,n}if(e.type===`pic`)return this._currentProcessingShape=null,null;let n;if(e.name&&e.name.includes(`Rectangle`)){let t=e.name.match(/\d+/);t&&parseInt(t[0]),n=null}else n=null;return this._currentProcessingShape=null,n}_normalizeColorDescriptor(e){if(!e)return null;if(typeof e==`object`&&e.r!==void 0||typeof e==`string`)return e;if(typeof e==`object`&&e.type&&e.value){if(e.type===`scheme`)return{scheme:e.value,alpha:e.alpha};if(e.type===`srgb`)return`#${e.value}`}return e}resolveStyleStrokeColor(e){try{if(!e)return null;let t=this._normalizeColorDescriptor(e.color||e);return this.processShapeColor(t)}catch{return null}}getShapeStrokeColor(e){try{if(e?.properties?.stroke?.noFill||e?.stroke?.noFill)return null;if(e?.properties?.stroke?.color){let t=this._normalizeColorDescriptor(e.properties.stroke.color);return this.processShapeColor(t)}if(e?.stroke?.color){let t=this._normalizeColorDescriptor(e.stroke.color);return this.processShapeColor(t)}let t=e?.preservedStyle||e?.style;if(t?.lnRef){let e=this.resolveStyleStrokeColor(t.lnRef);if(e)return e}}catch{}return e&&(e.type===`cxnSp`||e.type===`connector`)?{r:80,g:80,b:80,a:255}:null}getShapeLineWidth(e){try{let t=null;t=e?.properties?.stroke?.width===void 0?e?.stroke?.width===void 0?12700:parseInt(e.stroke.width)||12700:parseInt(e.properties.stroke.width)||12700;let n=t/914400*25.4;return Math.max(n,2*25.4/96)}catch{return .75}}resolveInheritedFillColor(e){try{let t=this.slides[this.getCurrentSlideIndex()];if(!t||!e.placeholder||!e.placeholder.type)return null;let n=e.placeholder.type,r=e.placeholder.idx||0;if(t.layout&&t.layout.cSld&&t.layout.cSld.spTree){for(let e of t.layout.cSld.spTree)if(this.isMatchingPlaceholder(e,n,r)){let t=this.extractShapeFillColor(e);if(t)return t}}if(t.layout&&t.layout.master&&t.layout.master.cSld&&t.layout.master.cSld.spTree){for(let e of t.layout.master.cSld.spTree)if(this.isMatchingPlaceholder(e,n,r)){let t=this.extractShapeFillColor(e);if(t)return t}}return this.getThemeColorForPlaceholder(n)||null}catch{return null}}isMatchingPlaceholder(e,t,n){return e.placeholder?e.placeholder.type===t?n!==void 0&&e.placeholder.idx!==void 0?e.placeholder.idx===n:!0:t===`title`&&e.placeholder.type===`ctrTitle`||t===`ctrTitle`&&e.placeholder.type===`title`:!1}inheritShapeStyles(e,t){try{if(t.spPr&&(e.spPr||(e.spPr={}),t.spPr.solidFill&&!e.spPr.solidFill&&(e.spPr.solidFill=t.spPr.solidFill),t.spPr.gradFill&&!e.spPr.gradFill&&(e.spPr.gradFill=t.spPr.gradFill),t.spPr.pattFill&&!e.spPr.pattFill&&(e.spPr.pattFill=t.spPr.pattFill),t.spPr.blipFill&&!e.spPr.blipFill&&(e.spPr.blipFill=t.spPr.blipFill),t.spPr.noFill&&!e.spPr.noFill&&(e.spPr.noFill=t.spPr.noFill),t.spPr.ln&&!e.spPr.ln&&(e.spPr.ln=t.spPr.ln),t.spPr.effectLst&&!e.spPr.effectLst&&(e.spPr.effectLst=t.spPr.effectLst),t.spPr.geometry&&!e.spPr.geometry&&!this.isTextPlaceholder(e)&&(e.spPr.geometry=t.spPr.geometry),t.spPr.xfrm&&!e.spPr.xfrm&&(e.spPr.xfrm=t.spPr.xfrm)),t.style&&(e.style||(e.style={}),t.style.fillRef&&!e.style.fillRef&&(e.style.fillRef=t.style.fillRef),t.style.lnRef&&!e.style.lnRef&&(e.style.lnRef=t.style.lnRef),t.style.effectRef&&!e.style.effectRef&&(e.style.effectRef=t.style.effectRef),t.style.fontRef&&!e.style.fontRef&&(e.style.fontRef=t.style.fontRef)),(this.isTextPlaceholder(e)||e.textBody)&&this.inheritTextProperties(e,t),t.effects&&!e.effects&&(e.effects=t.effects),t.fill&&(!e.fill||e.fill===null)&&(e.fill=t.fill),t.properties&&t.properties.fill&&(e.properties||(e.properties={}),(!e.properties.fill||e.properties.fill===null)&&(e.properties.fill=t.properties.fill)),t.properties&&t.properties.transform&&(e.properties||(e.properties={}),e.properties.transform||(e.properties.transform=JSON.parse(JSON.stringify(t.properties.transform)))),(!e.properties||!e.properties.transform)&&e.spPr&&e.spPr.xfrm){let t=e.spPr.xfrm,n=t.x===void 0?(t.off&&t.off.x)===void 0?0:t.off.x:t.x,r=t.y===void 0?(t.off&&t.off.y)===void 0?0:t.off.y:t.y,i=t.width===void 0?t.cx===void 0?(t.ext&&t.ext.cx)===void 0?void 0:t.ext.cx:t.cx:t.width,a=t.height===void 0?t.cy===void 0?(t.ext&&t.ext.cy)===void 0?void 0:t.ext.cy:t.cy:t.height;i!==void 0&&a!==void 0&&(e.properties||(e.properties={}),e.properties.transform={x:n,y:r,width:i,height:a})}}catch{}}inheritTextProperties(e,t){try{if(t.textBody){e.textBody||(e.textBody={paragraphs:[]});let n=t.textBody.bodyProperties||t.textBody.bodyPr;if(!e.textBody.bodyProperties)n&&(e.textBody.bodyProperties=JSON.parse(JSON.stringify(n)));else if(n){let t=e.textBody.bodyProperties;(!t.anchor&&!t.verticalAlign||t.verticalAlign===`top`||t.verticalAlign===`t`)&&(n.anchor?t.anchor=n.anchor:n.verticalAlign&&(t.verticalAlign=n.verticalAlign)),t.leftMargin===void 0&&n.leftMargin!==void 0&&(t.leftMargin=n.leftMargin),t.rightMargin===void 0&&n.rightMargin!==void 0&&(t.rightMargin=n.rightMargin),t.topMargin===void 0&&n.topMargin!==void 0&&(t.topMargin=n.topMargin),t.bottomMargin===void 0&&n.bottomMargin!==void 0&&(t.bottomMargin=n.bottomMargin)}t.textBody.lstStyle&&!e.textBody.lstStyle&&(e.textBody.lstStyle=t.textBody.lstStyle)}t.txBody&&!e.txBody&&(e.txBody=t.txBody)}catch{}}isTextPlaceholder(e){let t=e?.placeholder?.type||e.nvSpPr&&e.nvSpPr.nvPr&&e.nvSpPr.nvPr.ph&&e.nvSpPr.nvPr.ph.type;return t?[`title`,`body`,`ctrTitle`,`subTitle`,`dt`,`ftr`,`hdr`,`sldNum`].includes(t):!1}applyPropertyInheritance(e,t=null){try{let n=t||this.currentSlide;if(!n)return;if(n.layout&&n.layout.cSld&&n.layout.cSld.spTree){let t=this.findMatchingShapeInTemplate(e,n.layout.cSld.spTree);t&&this.inheritShapeStyles(e,t)}if(n.layout&&n.layout.master&&n.layout.master.cSld&&n.layout.master.cSld.spTree){let t=this.findMatchingShapeInTemplate(e,n.layout.master.cSld.spTree);t&&this.inheritShapeStyles(e,t)}}catch{}}findMatchingShapeInTemplate(e,t){if(!t||!Array.isArray(t))return null;if(e.placeholder){for(let n of t)if(this.isMatchingPlaceholder(n,e.placeholder.type,e.placeholder.idx))return n}if(e.name){for(let n of t)if(n.name===e.name)return n}if(e.name&&e.name.includes(`Text Placeholder`)&&e.textBody){for(let e of t)if(e.name&&e.name.includes(`Text Placeholder`)&&e.textBody)return e}if(e.bounds&&!e.placeholder){for(let n of t)if(this.isShapeAtSimilarPosition(e,n))return n}return null}isShapeAtSimilarPosition(e,t){if(!e.bounds||!t.bounds)return!1;let n=91440,r=Math.abs(e.bounds.l-t.bounds.l)<=n,i=Math.abs(e.bounds.t-t.bounds.t)<=n;return r&&i}extractShapeGeometry(e){return e.spPr&&e.spPr.geometry?e.spPr.geometry:e.geometry?e.geometry:e.properties&&e.properties.geometry?e.properties.geometry:null}extractShapeFillColor(e){return e.fill&&e.fill.color?this.processShapeColor(e.fill.color):e.properties&&e.properties.fill&&e.properties.fill.color?this.processShapeColor(e.properties.fill.color):e.style&&e.style.fillRef?this.resolveStyleFillColor(e.style.fillRef):null}getThemeColorForPlaceholder(e){let t=this.presentation?.theme;if(!t||!t.colors)return null;switch(e){case`title`:case`ctrTitle`:return null;case`body`:case`obj`:return null;case`subTitle`:return{r:245,g:245,b:245,a:255};default:return null}}processShapeColor(e){if(!e)return null;if(e.r!==void 0&&e.g!==void 0&&e.b!==void 0)return e;if(typeof e==`string`&&e.startsWith(`#`))return this.hexToRgb(e);if(e.scheme){let t=this.resolveThemeColor(e.scheme);if(t)return this.applyColorModifications(t,e)}if(e.type===`srgb`&&e.value){let t=e.value;return{r:parseInt(t.substring(0,2),16)||0,g:parseInt(t.substring(2,4),16)||0,b:parseInt(t.substring(4,6),16)||0,a:e.alpha!==void 0&&e.alpha!==null?Math.round(e.alpha*255):255}}if(e.type===`scheme`&&e.value){let t=this.resolveThemeColor(e.value);if(t)return this.applyColorModifications(t,e)}return e}processGradientFill(e){return!e||!e.stops||e.stops.length===0?null:{type:e.type||`linear`,angle:e.angle||0,stops:e.stops.map(e=>({position:e.position,color:this.processShapeColor(e.color)}))}}resolveThemeColor(e){if(this.presentation&&this.presentation.theme&&this.presentation.theme.colors){let t=this.presentation.theme.colors[e];if(t){let e=this.parseColorFromHex(t);if(e)return e}}return{}[e]||null}resolvePlaceholderColor(e,t=null){if(!e||e.type!==`placeholder`)return e;let n=t;if(!n&&this.presentation&&this.presentation.theme&&this.presentation.theme.colors){let e=this.presentation.theme.colors.accent1;e&&(n=this.parseColorFromHex(e))}return n?(e.modifications&&e.modifications.length>0&&(n=this.applyColorModifications(n,e.modifications)),n):null}rgbToHsl(e,t,n){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r===i)a=o=0;else{let c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),i,a,o;if(t===0)i=a=o=n;else{let s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;i=r(c,s,e+1/3),a=r(c,s,e),o=r(c,s,e-1/3)}return{r:Math.round(i*255),g:Math.round(a*255),b:Math.round(o*255)}}parseColorFromHex(e){if(!e||typeof e!=`string`)return null;let t=e.replace(`#`,``);return t.length===6?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:255}:null}applyColorModifications(e,t){if(!e||!t||t.length===0)return e;let n={...e},{h:r,s:i,l:a}=this.rgbToHsl(n.r,n.g,n.b);for(let e of t){let t=e.value;switch(e.type){case`tint`:let e=t/1e5;a+=(1-a)*e;break;case`shade`:let o=t/1e5;a*=1-o;break;case`lummod`:case`lumMod`:let s=t/1e5;a*=s;break;case`lumoff`:case`lumOff`:let c=t/1e5;a=Math.min(1,Math.max(0,a+c));break;case`satmod`:case`satMod`:let l=t/1e5;i*=l;break;case`satoff`:case`satOff`:let u=t/1e5;i=Math.min(1,Math.max(0,i+u));break;case`hue`:r=t/6e4%360;break;case`hueoff`:case`hueOff`:let d=t/6e4;r=(r+d)%360;break;case`huemod`:case`hueMod`:let f=t/1e5;r=r*f%360;break;case`alpha`:n.a=Math.round(t/1e5*255);break;case`alphamod`:case`alphaMod`:let p=t/1e5;n.a=Math.round(n.a*p);break;case`alphaoff`:case`alphaOff`:let m=t/1e5;n.a=Math.min(255,Math.max(0,Math.round(n.a+m*255)));break}}let o=this.hslToRgb(r,i,a);return n.r=o.r,n.g=o.g,n.b=o.b,n.r=Math.min(255,Math.max(0,Math.round(n.r))),n.g=Math.min(255,Math.max(0,Math.round(n.g))),n.b=Math.min(255,Math.max(0,Math.round(n.b))),n.a=Math.min(255,Math.max(0,Math.round(n.a||255))),n}rgbToHsl(e,t,n){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r===i)a=o=0;else{let c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return{r:Math.round(r*255),g:Math.round(i*255),b:Math.round(a*255)}}parseColorFromHex(e){if(!e||typeof e!=`string`)return null;let t=e.replace(`#`,``);return t.length===6?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:255}:null}applyColorModifications(e,t){let n={...e};if(t.tint!==void 0){let e=t.tint/1e5;n.r=Math.round(n.r+(255-n.r)*e),n.g=Math.round(n.g+(255-n.g)*e),n.b=Math.round(n.b+(255-n.b)*e)}if(t.shade!==void 0){let e=t.shade/1e5;n.r=Math.round(n.r*(1-e)),n.g=Math.round(n.g*(1-e)),n.b=Math.round(n.b*(1-e))}if(t.sat!==void 0){let e=t.sat/1e5,r=.299*n.r+.587*n.g+.114*n.b;n.r=Math.round(r+(n.r-r)*e),n.g=Math.round(r+(n.g-r)*e),n.b=Math.round(r+(n.b-r)*e)}return t.alpha!==void 0&&(n.a=Math.round(255*(t.alpha/1e5))),n.r=Math.max(0,Math.min(255,n.r)),n.g=Math.max(0,Math.min(255,n.g)),n.b=Math.max(0,Math.min(255,n.b)),n.a=Math.max(0,Math.min(255,n.a)),n}getAllShapesFromTree(e){let t=[],n=e=>{e&&(Array.isArray(e)?e.forEach(n):typeof e==`object`&&((e.nvSpPr||e.nvPicPr||e.nvGrpSpPr)&&t.push(e),Object.values(e).forEach(e=>{e&&typeof e==`object`&&n(e)})))};return n(e),t}resolveStyleFillColor(e){try{if(!e)return null;let t=this._currentProcessingShape,n=t&&(t.name===`Rectangle 3`||t.name?.includes(`Rectangle 3`)),r=e.idx||0;if(e.color){let t=this.processShapeColor(e.color);return t&&t.r!==void 0?`${t.r}${t.g}${t.b}${t.a||255}`:JSON.stringify(t),t}let i=this.presentation?.theme;if(n&&i&&i.colors&&i.colors.accent6&&this.parseColorFromHex(i.colors.accent6),i&&i.formatScheme){if(n&&i.formatScheme.fillStyles&&i.formatScheme.fillStyles.forEach((e,t)=>{}),r<1e3){let t=r-1;if(t>=0&&i.formatScheme.fillStyles&&t=1001){let t=r-1001;if(t>=0&&i.formatScheme.backgroundFills&&t0?n=e.stops[0].color:e.gradient&&e.gradient.colors&&e.gradient.colors.length>0&&(n=e.gradient.colors[0]),n){if(n.type===`placeholder`&&n.value===`phClr`){let e=this._currentProcessingShape;if(e&&!e.placeholder)return null;let r=t?this.processShapeColor(t):null,i=this.resolvePlaceholderColor(n,r);return n.modifications&&n.modifications.length>0&&(i=this.applyColorModifications(i,n.modifications)),i}if(n.type===`scheme`){let e=this.getThemeColor(n.value);if(e){let t=e;return n.modifications&&n.modifications.length>0&&(t=this.applyColorModifications(t,n.modifications)),t}}return t?this.processShapeColor(t):this.processShapeColor(n)}}if(e.type===`pattern`&&e.fgColor)return t?this.processShapeColor(t):this.processShapeColor(e.fgColor);if(e.type===`blip`||e.type===`image`||e.type===`none`||e.type===`noFill`)return null}catch{}return null}isImageLoading(e){return!this.imageCache.has(e)&&this.imageMap.has(e)}triggerSlideRerender(){typeof window<`u`&&window.dispatchEvent(new Event(`slideImageLoaded`,{detail:{slideIndex:this.currentSlideIndex}}))}logSlideImageStatus(e,t){if(e.backgroundFill&&e.backgroundFill.fill){let t=e.backgroundFill.fill;if(t.type===`image`&&t.imageData){let e=t.imageData.relationshipId;this.imageCache.has(e)}}let n=0;if(e.commonSlideData&&e.commonSlideData.shapeTree)for(let t of e.commonSlideData.shapeTree)t.type===`pic`&&t.imageRelId&&(this.imageCache.has(t.imageRelId),n++)}async drawGroupShapeGeometry(e,t,n,r,i,a,o,s,c,l){e.SaveGrState();try{if(t.transform){if(t.transform.rotation&&t.transform.rotation!==0){let o=n+i/2,s=r+a/2;e.transform(Math.cos(t.transform.rotation*Math.PI/180),Math.sin(t.transform.rotation*Math.PI/180),-Math.sin(t.transform.rotation*Math.PI/180),Math.cos(t.transform.rotation*Math.PI/180),o-o*Math.cos(t.transform.rotation*Math.PI/180)+s*Math.sin(t.transform.rotation*Math.PI/180),s-o*Math.sin(t.transform.rotation*Math.PI/180)-s*Math.cos(t.transform.rotation*Math.PI/180))}if(t.transform.flipH||t.transform.flipV){let o=t.transform.flipH?-1:1,s=t.transform.flipV?-1:1,c=n+i/2,l=r+a/2;e.transform(o,0,0,s,c-c*o,l-l*s)}}if(o)if(typeof o==`object`&&o.type===`linear`)e.fillRect(n,r,i,a,o);else{let t=null;typeof o==`string`?t=this.hexToRgb(o):o.r!==void 0&&(t=o),t&&e.drawRectangle(n,r,i,a,t,null,0)}if(s&&c>0){let t=null;typeof s==`string`?t=this.hexToRgb(s):s.r!==void 0&&(t=s),t&&e.drawRectangle(n,r,i,a,null,t,c)}if(t.shapeTree&&t.shapeTree.length>0){let n=this.sortShapesByRenderOrder(t.shapeTree);for(let t=0;t{let t=Math.max(0,Math.min(255,Math.round(e))).toString(16);return t.length===1?`0`+t:t};return`#${t(e.r||e.R||0)}${t(e.g||e.G||0)}${t(e.b||e.B||0)}`}createRotationMatrix(e,t,n){let r=e*Math.PI/180,i=Math.cos(r),a=Math.sin(r);return{a:i,b:a,c:-a,d:i,e:t-t*i+n*a,f:n-t*a-n*i}}applyRotationTransform(e,t,n,r,i,a){let o=this.getShapeRotation(t);if(!o||o===0)return!1;let s=n+i/2,c=r+a/2,l=this.createRotationMatrix(o,s,c),u={sx:l.a,sy:l.d,shx:l.c,shy:l.b,tx:l.e,ty:l.f,createDuplicate(){return{sx:this.sx,sy:this.sy,shx:this.shx,shy:this.shy,tx:this.tx,ty:this.ty,createDuplicate:this.createDuplicate}}};return e.transform3?e.transform3(u):e.transform&&e.transform(l.a,l.b,l.c,l.d,l.e,l.f),!0}getShapeRotation(e){return e.properties?.transform?.rot===void 0?e.transform?.rotation===void 0?e.spPr?.transform?.rot===void 0?0:e.spPr.transform.rot:e.transform.rotation:e.properties.transform.rot}calculateRotatedBounds(e,t){if(!t||t===0)return e;let{x:n,y:r,w:i,h:a}=e,o=n+i/2,s=r+a/2,c=[{x:n,y:r},{x:n+i,y:r},{x:n+i,y:r+a},{x:n,y:r+a}],l=t*Math.PI/180,u=Math.cos(l),d=Math.sin(l),f=c.map(e=>{let t=e.x-o,n=e.y-s;return{x:o+t*u-n*d,y:s+t*d+n*u}}),p=Math.min(...f.map(e=>e.x)),m=Math.min(...f.map(e=>e.y)),h=Math.max(...f.map(e=>e.x)),g=Math.max(...f.map(e=>e.y));return{x:p,y:m,w:h-p,h:g-m}}getDefaultTextColor(e){return this.presentation?.theme?.colors?e.placeholder?.type===`title`||e.placeholder?.type===`ctrTitle`?this.resolveThemeColor(`dk2`)||this.resolveThemeColor(`dk1`)||this.presentation.theme.colors.tx1||{r:0,g:0,b:0,a:255}:this.presentation.theme.colors.tx1||this.presentation.theme.colors.tx2||{r:0,g:0,b:0,a:255}:{r:0,g:0,b:0,a:255}}async extractPartMediaRelationships(e){try{let t=await e.getRelationships();for(let[e,n]of Object.entries(t))if(n.type===Bu.image.relationType||n.type.includes(`video`)||n.type.includes(`audio`)){let t=n.target;if(t.startsWith(`../`)?t=t.replace(`../`,`ppt/`):t.startsWith(`/`)||(t=`/ppt/${t}`),this.mediaMap.set(e,{path:t,type:n.type}),this.isImageFile(t)){let n=this.imageMap.get(e);!n||this.isSVGFile(t)&&!this.isSVGFile(n)?(this.imageMap.set(e,t),this.isSVGFile(t)):!this.isSVGFile(t)&&this.isSVGFile(n)||this.imageMap.set(e,t)}}}catch{}}isMediaFile(e){let t=[`.png`,`.jpg`,`.jpeg`,`.gif`,`.bmp`,`.svg`,`.webp`,`.tiff`,`.mp4`,`.mov`,`.avi`,`.mp3`,`.wav`,`.ogg`],n=e.toLowerCase();return t.some(e=>n.endsWith(e))}isSVGFile(e){return e&&e.toLowerCase().endsWith(`.svg`)}extractSVGRelationshipId(e){try{let t=e.getElementsByTagName(`*`);for(let e=0;e{o.onload=()=>{s={image:o,width:o.naturalWidth,height:o.naturalHeight,url:a},this.imageCache.set(t.imageRelId,s),e()},o.onerror=()=>{n(Error(`Failed to load image`))},o.src=a})}this.drawActualImage(e,t,s,r,i,a,o)}catch{this.drawImagePlaceholder(e,t,r,i,a,o)}}async loadAndDrawSVGImage(e,t,n,r,i,a,o){try{let e=this.imageCache.get(t.imageRelId);if(!e){let r=await this.zip.getFileData(n.path);if(!r)throw Error(`SVG file not found in ZIP`);e={content:new TextDecoder(`utf-8`).decode(r),type:`svg`,path:n.path,width:100,height:100},this.imageCache.set(t.imageRelId,e)}let s={x:r,y:i,w:a,h:o};await this.svgRenderer.renderSVG(e.content,s.x,s.y,s.w,s.h,{preserveAspectRatio:!0})}catch(s){this.logger.logError(this.constructor.name,`Failed to load/render SVG: ${n.path}`,s);try{let s=await this.zip.getFileData(n.path);if(s){let n=new Blob([s],{type:`image/svg+xml`}),c=URL.createObjectURL(n),l=new Image;l.crossOrigin=`anonymous`,await new Promise((n,s)=>{l.onload=()=>{let s={image:l,width:l.naturalWidth,height:l.naturalHeight,url:c};this.drawActualImage(e,t,s,r,i,a,o),n()},l.onerror=s,l.src=c})}}catch{this.logger.log(`warn`,this.constructor.name,`SVG fallback also failed, showing placeholder`),this.drawImagePlaceholder(e,t,r,i,a,o)}}}drawFilePlaceholder(e,t,n,r,i,a,o){let s=e.getContext();s.save(),s.fillStyle=`#e9ecef`,s.fillRect(r,i,a,o),s.strokeStyle=`#adb5bd`,s.lineWidth=1,s.strokeRect(r,i,a,o);let c=`❓`;n.includes(`video`)?c=`🎬`:n.includes(`audio`)&&(c=`🎵`),s.fillStyle=`#495057`,s.font=`${Math.min(a,o)*.5}px Arial`,s.textAlign=`center`,s.textBaseline=`middle`,s.fillText(c,r+a/2,i+o/2),s.restore()}async renderShape(e,t,n){try{if(!t)return;let r=this.getShapeBounds(t,n);if(!r||r.w<=0||r.h<=0)return;let{x:i,y:a,w:o,h:s}=r;if(t.groupTransform){e.SaveGrState();let r=this.createTransformMatrix(t,n);e.transform3(r)}switch(t.graphicData&&t.graphicData.uri,t.type){case`sp`:this.renderRegularShape(e,t,i,a,o,s);break;case`pic`:await this.renderPictureShape(e,t,i,a,o,s);break;case`grpSp`:this.renderGroupShape(e,t);break;case`cxnSp`:this.renderConnectorShape(e,t,i,a,o,s);break;case`graphicFrame`:await this.renderGraphicFrame(e,t,i,a,o,s);break;default:this.renderDefaultShape(e,t,i,a,o,s);break}t.groupTransform&&e.RestoreGrState()}catch{}}renderRegularShape(e,t,n,r,i,a){let o=this.getShapeRotation(t);o!==0&&e.SaveGrState(),this.applyRotationTransform(e,t,n,r,i,a);let s=this.getShapeFillColor(t),c=this.getShapeStrokeColor(t),l=this.getShapeLineWidth(t),u=this.getShapeStrokeInfo(t),d=this.getShapePresetGeometry(t),f=this.extractShapeAdjustments(t),p=s,m=null,h=null;p&&(typeof p==`object`&&p.type&&p.stops?m=p:typeof p==`string`?m=this.hexToRgb(p):p.r!==void 0&&(m=p)),c&&(typeof c==`string`?h=this.hexToRgb(c):c.r!==void 0&&(h=c)),d?e.drawPresetGeometry(d,n,r,i,a,m,h,l,u,f):e.drawRectangle(n,r,i,a,m,h,l||2,u),o!==0&&e.RestoreGrState()}extractShapeAdjustments(e){let t={};try{if(e.geometry){if(e.geometry.avLst)for(let[n,r]of Object.entries(e.geometry.avLst))typeof r==`object`&&r.val!==void 0?t[n]=r.val:typeof r==`number`&&(t[n]=r);if(e.geometry.adjLst)for(let[n,r]of Object.entries(e.geometry.adjLst))typeof r==`object`&&r.val!==void 0?t[n]=r.val:typeof r==`number`&&(t[n]=r);if(e.geometry.preset&&e.geometry.adjustments)for(let[n,r]of Object.entries(e.geometry.adjustments))t[n]=r}if(e.spPr&&e.spPr.geometry){let n=e.spPr.geometry;if(n.avLst){for(let e of n.avLst)if(e.name&&e.fmla!==void 0){let n=this.parseAdjustmentValue(e.fmla);n!==null&&(t[e.name]=n)}}}e.adjustments&&Object.assign(t,e.adjustments),e.commonSlideData&&e.commonSlideData.adjustments&&Object.assign(t,e.commonSlideData.adjustments)}catch{}return t}parseAdjustmentValue(e){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseFloat(e);if(!isNaN(t))return t;let n=e.match(/val\s+(-?\d+)/);if(n)return parseInt(n[1],10);let r=e.match(/(-?\d+)%/);if(r)return parseInt(r[1],10)*1e3}return null}getShapePresetGeometry(e){return e.geometry&&e.geometry.preset?e.geometry.preset:e.properties&&e.properties.geometry&&e.properties.geometry.preset?e.properties.geometry.preset:e.spPr&&e.spPr.geometry&&e.spPr.geometry.preset?e.spPr.geometry.preset:e.spPr&&e.spPr.prstGeom&&e.spPr.prstGeom.prst?e.spPr.prstGeom.prst:null}getShapeStrokeInfo(e){let t={},n=e.properties?.line||e.properties?.stroke;if(n){if(n.dashArray&&n.dashArray.length>0&&(t.dashArray=n.dashArray),(n.lineCap||n.cap)&&(t.lineCap=n.lineCap||n.cap),(n.lineJoin||n.join)&&(t.lineJoin=n.lineJoin||n.join),n.miterLimit&&(t.miterLimit=n.miterLimit),n.headEnd){let e=n.headEnd;t.headEnd={type:e.type||e.val||`none`,w:e.w||e.width,len:e.len||e.length}}if(n.tailEnd){let e=n.tailEnd;t.tailEnd={type:e.type||e.val||`none`,w:e.w||e.width,len:e.len||e.length}}}if(e.spPr&&e.spPr.ln){let n=e.spPr.ln;n.prstDash&&(t.dashArray=this.convertstandardDashPattern(n.prstDash)),n.cap&&(t.lineCap=this.convertstandardLineCap(n.cap)),n.join&&(t.lineJoin=this.convertstandardLineJoin(n.join)),this._mapArrowSize.bind(this);let r=e=>e?e.toString():`none`;n.headEnd&&(t.headEnd={type:r(n.headEnd.type),w:n.headEnd.w,len:n.headEnd.len}),n.tailEnd&&(t.tailEnd={type:r(n.tailEnd.type),w:n.tailEnd.w,len:n.tailEnd.len})}return Object.keys(t).length>0?t:null}_mapArrowSize(e){switch((e||``).toString()){case`sm`:case`small`:return 1;case`med`:case`medium`:return 1.5;case`lg`:case`large`:return 2;default:return 1}}convertstandardDashPattern(e){return{solid:[],dot:[2,2],dash:[8,4],dashDot:[8,4,2,4],dashDotDot:[8,4,2,4,2,4],lgDash:[16,8],lgDashDot:[16,8,4,8],lgDashDotDot:[16,8,4,8,4,8],sysDash:[6,3],sysDashDot:[6,3,2,3],sysDashDotDot:[6,3,2,3,2,3],sysDot:[1,1]}[e]||[]}convertstandardLineCap(e){return{rnd:`round`,sq:`square`,flat:`butt`}[e]||`round`}convertstandardLineJoin(e){return{round:`round`,bevel:`bevel`,miter:`miter`}[e]||`round`}async renderPictureShape(e,t,n,r,i,a){let o=this.getShapeRotation(t),s=o&&o!==0;s&&(e.SaveGrState(),this.applyRotationTransform(e,t,n,r,i,a));let c=this.getShapePresetGeometry(t);if(c&&c!==`rect`){let o=this.getShapeStrokeColor(t),s=this.getShapeLineWidth(t),l=this.getShapeStrokeInfo(t);e.drawPresetGeometry(c,n,r,i,a,null,o,s,l)}let l=this.getShapeFillColor(t),u=this.getShapeStrokeColor(t),d=this.getShapeLineWidth(t);try{await this.drawPictureShapeGeometry(e,t,n,r,i,a,l,u,d)}catch{this.drawImagePlaceholder(e,t,n,r,i,a)}s&&e.RestoreGrState()}renderConnectorShape(e,t,n,r,i,a){let o=this.getShapeRotation(t),s=o&&o!==0;s&&(e.SaveGrState(),this.applyRotationTransform(e,t,n,r,i,a));let c=this.getShapeStrokeColor(t),l=this.getShapeLineWidth(t),u=this.getShapeStrokeInfo(t),d=this.getConnectorType(t);try{this.logger?.log(`info`,this.constructor.name,`[Connector Render] start`,{connectorType:d,bounds:{x:n,y:r,w:i,h:a},strokeColor:c,lineWidth:l,strokeInfo:u})}catch{}switch(d){case`straight`:typeof e.drawLineWithArrows==`function`?e.drawLineWithArrows(n,r,n+i,r+a,c,l,u):e.drawLine(n,r,n+i,r+a,c,l);break;case`elbow`:this.drawElbowConnector(e,n,r,i,a,c,l,u);break;case`curved`:this.drawCurvedConnector(e,n,r,i,a,c,l,u);break;default:e.drawLine(n,r,n+i,r+a,c,l);break}s&&e.RestoreGrState();try{this.logger?.log(`info`,this.constructor.name,`[Connector Render] done`)}catch{}}getConnectorType(e){if(e.properties&&e.properties.connector)return e.properties.connector.type||`straight`;if(e.spPr&&e.spPr.connector)return e.spPr.connector.type||`straight`;let t=this.getShapePresetGeometry(e);if(t&&t.includes(`Connector`)){if(t.includes(`bent`))return`elbow`;if(t.includes(`curved`))return`curved`}return`straight`}drawElbowConnector(e,t,n,r,i,a,o,s){if(!e.m_oContext)return;e.m_oContext.save(),e.m_oContext.beginPath();let c=t+r*.5,l=n+i*.5;e.m_oContext.moveTo(t,n),e.m_oContext.lineTo(c,n),e.m_oContext.lineTo(c,l),e.m_oContext.lineTo(t+r,l),e.m_oContext.lineTo(t+r,n+i),a&&(e.m_oContext.strokeStyle=e.colorToRgb(a),e.m_oContext.lineWidth=o||1,s&&e.applyStrokeInfo(s),e.m_oContext.stroke()),e.m_oContext.restore()}drawCurvedConnector(e,t,n,r,i,a,o,s){e.m_oContext&&(e.m_oContext.save(),e.m_oContext.beginPath(),e.m_oContext.moveTo(t,n),e.m_oContext.bezierCurveTo(t+r*.3,n,t+r*.7,n+i,t+r,n+i),a&&(e.m_oContext.strokeStyle=e.colorToRgb(a),e.m_oContext.lineWidth=o||1,s&&e.applyStrokeInfo(s),e.m_oContext.stroke()),e.m_oContext.restore())}async renderGraphicFrame(e,t,n,r,i,a){let o=this.getShapeRotation(t),s=o&&o!==0;s&&(e.SaveGrState(),this.applyRotationTransform(e,t,n,r,i,a));let c=this.getShapeStrokeColor(t),l=this.getShapeLineWidth(t)||1,u=this.getShapeStrokeInfo(t);if(e.drawRectangle(n,r,i,a,null,c,l,u),t.graphicData)switch(t.graphicData.uri){case`http://schemas.openxmlformats.org/drawingml/2006/table`:this.renderTableFrame(e,t,n,r,i,a);break;case`http://schemas.openxmlformats.org/drawingml/2006/chart`:await this.renderChartFrame(e,t,n,r,i,a);break;case`http://schemas.openxmlformats.org/drawingml/2006/diagram`:this.renderDiagramFrame(e,t,n,r,i,a);break;default:this.renderGenericFrame(e,t,n,r,i,a);break}else this.renderGenericFrame(e,t,n,r,i,a);s&&e.RestoreGrState()}renderTableFrame(e,t,n,r,i,a){let o=this.getTableInstance(t);if(!o){this.drawTablePlaceholder(e,n,r,i,a);return}e.SaveGrState();try{this.drawTableBackgroundAndOuterBorder(e,o,n,r,i,a),this.drawCellsBackground(e,o,n,r,i,a),this.drawCellsContent(e,o,n,r,i,a),this.drawCellsBorders(e,o,n,r,i,a)}catch{this.drawTablePlaceholder(e,n,r,i,a)}finally{e.RestoreGrState()}}getTableInstance(e){if(e.table&&e.table instanceof CTable)return e.table;if(e.graphicData&&e.graphicData.tableXml)try{let t=this.parseTableFromXML(e.graphicData.tableXml);if(t)return e.table=t,t}catch(e){console.error(`[GetTableInstance] Error parsing table:`,e.message),console.error(`[GetTableInstance] Error stack:`,e.stack)}return null}drawTableBackgroundAndOuterBorder(e,t,n,r,i,a){t.getTableProperties();let o=t.getTableBorders(),s=t.getTableShading();if(s&&s.fill){let t=this.resolveTableBackgroundColor(s);e.b_color1(t.r,t.g,t.b,t.a||255),e.TableRect(n,r,i,a)}o&&this.drawTableOuterBorder(e,o,n,r,i,a)}drawCellsBackground(e,t,n,r,i,a){let o=t.getRowCount(),s=t.getColumnCount(),c=this.calculateCellWidths(t,i),l=this.calculateCellHeights(t,a),u=r;for(let r=0;r=0;a--){let o=t.getCell(i,a);if(!o)continue;let s=c[a],u=l[i],d=n+this.calculateCellXOffset(c,a),f=r+this.calculateCellYOffset(l,i);this.drawCellBorders(e,o,d,f,s,u,i,a,t)}}drawTablePlaceholder(e,t,n,r,i){let a=r/3,o=i/3;for(let r=0;r<3;r++)for(let i=0;i<3;i++){let s=t+i*a,c=n+r*o;e.drawRectangle(s,c,a,o,null,{r:128,g:128,b:128,a:255},1)}this.drawCenteredText(e,`Table`,t,n,r,i)}drawTableOuterBorder(e,t,n,r,i,a){[`top`,`right`,`bottom`,`left`].forEach(o=>{let s=t[o];if(s&&s.style!==`none`){let t=this.resolveBorderColor(s),c=s.width||1;switch(e.p_color(t.r,t.g,t.b,t.a||255),e.p_width(c),o){case`top`:e.drawHorLine(n,r,n+i,r,c);break;case`right`:e.drawVerLine(n+i,r,r+a,c);break;case`bottom`:e.drawHorLine(n,r+a,n+i,r+a,c);break;case`left`:e.drawVerLine(n,r,r+a,c);break}}})}drawCellBackground(e,t,n,r,i,a){let o=t.getCellShading();if(o&&o.fill){let t=this.resolveCellBackgroundColor(o);e.b_color1(t.r,t.g,t.b,t.a||255),e.TableRect(n,r,i,a)}}drawCellContent(e,t,n,r,i,a){let o=t.getTextBody();if(!o||!o.paragraphs)return;let s=n+5,c=r+5,l=i-10,u=a-10;this.renderCellTextContent(e,o,s,c,l,u)}drawCellBorders(e,t,n,r,i,a,o,s,c){let l=t.getCellBorders();l&&[`top`,`right`,`bottom`,`left`].forEach(t=>{let u=l[t];if(!(!u||u.style===`none`)&&this.shouldDrawBorder(t,o,s,c)){let o=this.resolveBorderColor(u),s=u.width||1;switch(e.p_color(o.r,o.g,o.b,o.a||255),e.p_width(s),t){case`top`:e.drawHorLine(n,r,n+i,r,s);break;case`right`:e.drawVerLine(n+i,r,r+a,s);break;case`bottom`:e.drawHorLine(n,r+a,n+i,r+a,s);break;case`left`:e.drawVerLine(n,r,r+a,s);break}}})}shouldDrawBorder(e,t,n,r){let i=r.getRowCount(),a=r.getColumnCount();switch(e){case`top`:return t===0;case`right`:return n===a-1;case`bottom`:return t===i-1;case`left`:return n===0;default:return!0}}calculateCellWidths(e,t){let n=e.getTableGrid();if(!n||n.length===0){let n=e.getColumnCount();return Array(n).fill(t/n)}let r=n.reduce((e,t)=>e+(t.width||0),0);return n.map(e=>(e.width||0)/r*t)}calculateCellHeights(e,t){let n=e.getRowCount(),r=[],i=!1;for(let t=0;tt/n);let a=r.reduce((e,t)=>e+t,0),o=r.filter(e=>e===0).length,s=oe===0?s:e),l=c.reduce((e,t)=>e+t,0);return c.map(e=>e/l*t)}isStartingCellOfMerge(e,t,n){return!e.isMergedContinue}calculateMergedCellWidth(e,t,n){let r=0;for(let i=0;i{if(!t.runs||t.runs.length===0){o+=16;return}let r=t.runs.map(e=>e.text||``).join(``);if(!r.trim()){o+=16;return}let i=t.properties||{},a=i.fontSize||12,s=i.fontFamily||`Arial`,c=i.bold||!1,l=i.italic||!1;e.font(s,a,c?`bold`:`normal`,l?`italic`:`normal`);let u=this.resolveTextColor(t);e.b_color1(u.r,u.g,u.b,u.a||255),e.FillText(n,o,r),o+=16})}resolveTextColor(e){return{r:0,g:0,b:0,a:255}}parseTableFromXML(e){if(!e)return null;try{let t=new DOMParser().parseFromString(e,`text/xml`);if(t.documentElement.nodeName===`parsererror`)return console.error(`[ParseTableXML] XML parsing error`),null;let n=new CTable;return this.parseTableProperties(t,n),this.parseTableGrid(t,n),this.parseTableRows(t,n),this.processTableMerges(n),this.validateTableStructure(n)?n:null}catch(e){return console.error(`[ParseTableXML] Exception during table parsing:`,e.message),console.error(`[ParseTableXML] Error stack:`,e.stack),null}}parseTableProperties(e,t){let n=e.querySelector(`tblPr`);if(n||(n=e.querySelector(`a\\:tblPr`)),n){let e={},r=n.querySelector(`tblStyle`);r||(r=n.querySelector(`a\\:tblStyle`)),r&&(e.style=r.getAttribute(`val`));let i=n.querySelector(`tblBorders`);i||(i=n.querySelector(`a\\:tblBorders`)),i&&(e.borders=this.parseTableBorders(i));let a=n.querySelector(`tblShading`);a||(a=n.querySelector(`a\\:tblShading`)),a&&(e.shading=this.parseTableShading(a));let o=n.querySelector(`tblLayout`);o||(o=n.querySelector(`a\\:tblLayout`)),o&&(e.layout=o.getAttribute(`type`)||`autofit`);let s=n.querySelector(`tblW`);if(s||(s=n.querySelector(`a\\:tblW`)),s){let t=s.getAttribute(`w`),n=s.getAttribute(`type`)||s.getAttribute(`wtype`)||`auto`;t?e.preferredWidth={value:parseInt(t)||0,type:n.toLowerCase()}:e.preferredWidth={value:0,type:n.toLowerCase()}}t.setTableProperties(e)}}parseTableGrid(e,t){let n=e.querySelector(`tblGrid`);if(n||(n=e.querySelector(`a\\:tblGrid`)),n){let e=n.querySelectorAll(`gridCol`);e.length===0&&(e=n.querySelectorAll(`a\\:gridCol`));let r=[];e.forEach(e=>{let t=e.getAttribute(`w`),n={width:t?parseInt(t):914400,type:e.getAttribute(`type`)||`auto`};r.push(n)}),t.setTableGrid(r)}}parseTableRows(e,t){let n=e.querySelectorAll(`tr`);n.length===0&&(n=e.querySelectorAll(`a\\:tr`)),n.forEach((e,n)=>{let r=new CTableRow;this.parseRowProperties(e,r),this.parseRowCells(e,r,n),t.addRow(r)})}parseRowProperties(e,t){let n=e.querySelector(`trPr`);if(n||(n=e.querySelector(`a\\:trPr`)),n){let e=n.querySelector(`trHeight`);if(e||(e=n.querySelector(`a\\:trHeight`)),e){let n=parseInt(e.getAttribute(`val`),10);Number.isNaN(n)||(t.height=n),t.heightRule=e.getAttribute(`hRule`)||`auto`}let r=n.querySelector(`tblHeader`);r||(r=n.querySelector(`a\\:tblHeader`)),r&&(t.isHeader=!0)}if((!t.height||t.height<=0)&&e){let n=e.getAttribute(`h`);if(n!==null){let e=parseInt(n,10);!Number.isNaN(e)&&e>0&&(t.height=e,t.heightRule||(t.heightRule=`auto`))}}}parseRowCells(e,t,n){let r=e.querySelectorAll(`tc`);r.length===0&&(r=e.querySelectorAll(`a\\:tc`)),r.forEach((e,r)=>{let i=new CTableCell;this.parseCellProperties(e,i,n,r),this.parseCellContent(e,i),t.addCell(i)})}parseCellProperties(e,t,n,r){let i=e.getAttribute(`gridSpan`),a=e.getAttribute(`rowSpan`),o=e.getAttribute(`vMerge`),s=e.getAttribute(`hMerge`);if(i){let e=parseInt(i);e>1&&(t.gridSpan=e)}if(a){let e=parseInt(a);e>1&&(t.rowSpan=e)}(o===`1`||o===`true`||o===`continue`)&&(t.isMergedContinue=!0),(s===`1`||s===`true`)&&(t.isMergedContinue=!0);let c=e.querySelector(`tcPr`);if(c||(c=e.querySelector(`a\\:tcPr`)),c){let e=c.querySelector(`gridSpan`);if(e||(e=c.querySelector(`a\\:gridSpan`)),e){let n=parseInt(e.getAttribute(`val`))||1;n>1&&(t.gridSpan=n)}let n=c.querySelector(`rowSpan`);if(n||(n=c.querySelector(`a\\:rowSpan`)),n){let e=parseInt(n.getAttribute(`val`))||1;e>1&&(t.rowSpan=e)}let r=c.querySelector(`vMerge`);r||(r=c.querySelector(`a\\:vMerge`)),r&&r.getAttribute(`val`)!==`restart`&&(t.isMergedContinue=!0);let i=c.querySelector(`tcBorders`);i||(i=c.querySelector(`a\\:tcBorders`)),i&&(t.borders=this.parseCellBorders(i));let a=c.querySelector(`tcShading`);a||(a=c.querySelector(`a\\:tcShading`)),a&&(t.shading=this.parseCellShading(a));let o=c.querySelector(`tcMar`);o||(o=c.querySelector(`a\\:tcMar`)),o&&(t.margins=this.parseCellMargins(o))}}parseCellContent(e,t){let n=this.parseTextBodyFromElement(e);n&&t.setTextBody(n)}processTableMerges(e){let t=e.getRows();for(let n=0;n1&&this.processHorizontalMerge(e,n,t,i.gridSpan),i.rowSpan>1&&this.processVerticalMerge(e,n,t,i.rowSpan)}}}processHorizontalMerge(e,t,n,r){for(let i=1;i{let r=e.querySelector(n);r||(r=e.querySelector(`a\\:${n}`)),r&&(t[n]=this.parseBorderProperties(r))}),t}parseCellBorders(e){return this.parseTableBorders(e)}parseBorderProperties(e){return{style:e.getAttribute(`val`)||`single`,size:parseInt(e.getAttribute(`sz`))||4,color:this.parseColor(e),space:parseInt(e.getAttribute(`space`))||0}}parseTableShading(e){return this.parseCellShading(e)}parseCellShading(e){let t=e.getAttribute(`fill`),n=e.getAttribute(`color`);return{fill:t,color:n?this.parseColorFromHex(n):null}}parseCellMargins(e){let t={};return[`top`,`left`,`bottom`,`right`].forEach(n=>{let r=e.querySelector(n);r||(r=e.querySelector(`a\\:${n}`)),r&&(t[n]=parseInt(r.getAttribute(`w`))||0)}),t}async renderChartFrame(e,t,n,r,i,a){try{let o=t.chartData;if(o&&o.type===`DEFERRED_CHART`&&(o=null,t.chartData=null),!o&&t.graphicData&&window.ChartProcessor){let e=new ChartProcessor(this.context);if(t.graphicData.chartRef){let n={slideIndex:this.currentSlideIndex,slideName:this.currentSlide?.name||`slide${this.currentSlideIndex+1}`,slide:this.currentSlide};try{let r=await e.loadChartFromRelationship(t.graphicData.chartRef,n);r&&(t.chartData=r,o=r)}catch{}}else o=t.graphicData.element?e.parseEmbeddedChartData(t.graphicData.element):e.createPlaceholderChart();o&&(t.chartData=o)}if(o&&ChartRenderer){await new ChartRenderer(e).renderChart(o,n,r,i,a);return}this.renderEnhancedChartPlaceholder(e,t,n,r,i,a)}catch(o){console.error(`[Chart Debug] Error in renderChartFrame:`,o),this.renderSimpleChartPlaceholder(e,t,n,r,i,a)}}renderEnhancedChartPlaceholder(e,t,n,r,i,a){try{e.fillRect(n,r,i,a,{r:248,g:249,b:250}),e.strokeRect(n,r,i,a,{r:200,g:200,b:200},1);let t=n+40,o=r+30,s=i-80,c=a-60,l=[4500,5200,4800,6100,5900],u=7e3,d=o+c-20;e.drawLine(t,o,t,d,{r:68,g:68,b:68},1);for(let n=0;n<=7;n++){let r=d-n*1e3/u*(c-40);n>0&&e.drawLine(t,r,t+s,r,{r:200,g:200,b:200},1)}e.drawLine(t,d,t+s,d,{r:68,g:68,b:68},1);let f=s/(l.length-1),p={r:91,g:155,b:213};for(let n=0;n{e.drawEllipse(t.x-15,t.y-15,30,30,{r:200,g:200,b:200,a:255},{r:128,g:128,b:128,a:255},2)})}renderGenericFrame(e,t,n,r,i,a){e.drawRectangle(n,r,i,a,null,`#a0a0a0`,1)}drawCenteredText(e,t,n,r,i,a){}renderDefaultShape(e,t,n,r,i,a){let o=this.getShapeRotation(t),s=o&&o!==0;s&&(e.SaveGrState(),this.applyRotationTransform(e,t,n,r,i,a));let c=this.getShapeFillColor(t),l=this.getShapeStrokeColor(t),u=this.getShapeLineWidth(t)||1,d=this.getShapeStrokeInfo(t);e.drawRectangle(n,r,i,a,c,l,u,d),this.drawCenteredText(e,t.type||`Shape`,n,r,i,a),s&&e.RestoreGrState()}processShapeColor(e){if(!e)return null;let t;if(typeof e==`string`)if(e.startsWith(`#`))t=this.hexToRgb(e);else return null;else if(typeof e==`object`&&e.r!==void 0)t=e;else return null;`${t.r}${t.g}${t.b}${t.a||255}`;let n={...t};if(e.tint!==void 0){let t=e.tint/1e5;n.r=Math.round(n.r+(255-n.r)*t),n.g=Math.round(n.g+(255-n.g)*t),n.b=Math.round(n.b+(255-n.b)*t)}if(e.shade!==void 0){let t=1-e.shade/1e5;n.r=Math.round(n.r*t),n.g=Math.round(n.g*t),n.b=Math.round(n.b*t)}if(e.satMod!==void 0){let t=this.rgbToHsl(n.r,n.g,n.b);t.s*=e.satMod/1e5;let r=this.hslToRgb(t.h,t.s,t.l);n.r=r.r,n.g=r.g,n.b=r.b}return`${n.r}${n.g}${n.b}${n.a||255}`,n}rgbToHsl(e,t,n){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r===i)a=o=0;else{let c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return{r:Math.round(r*255),g:Math.round(i*255),b:Math.round(a*255)}}sortShapesByRenderOrder(e){if(!e||e.length===0)return[];let t=[...e];return t.sort((t,n)=>{let r=t.order||t.zOrder||t.index||0,i=n.order||n.zOrder||n.index||0;return r===i?e.indexOf(t)-e.indexOf(n):r-i}),t}},Uu=class{constructor(){this.loadingImages=new Set,this.logger=new Logger(`ImageLoader`)}async loadImageFromUrl(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{t(r)},r.onerror=e=>{n(Error(`Failed to load image: ${e.message||`Unknown error`}`))},e.startsWith(`blob:`)&&(r.crossOrigin=`anonymous`),r.src=e})}async loadImageFromData(e,t=`image/png`){try{let n=new Blob([e],{type:t}),r=URL.createObjectURL(n);return await this.loadImageFromUrl(r)}catch(e){throw e}}async preloadImages(e){let t=e.map(e=>this.loadImageFromUrl(e).catch(e=>null));return(await Promise.allSettled(t)).map(e=>e.status===`fulfilled`?e.value:null)}async getImageDimensions(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight,aspectRatio:r.naturalWidth/r.naturalHeight})},r.onerror=()=>{n(Error(`Failed to load image for dimension check`))},r.src=e})}createThumbnail(e,t=150,n=150){let r=document.createElement(`canvas`),i=r.getContext(`2d`),a=e.naturalWidth/e.naturalHeight,o,s;return a>1?(o=Math.min(t,e.naturalWidth),s=o/a):(s=Math.min(n,e.naturalHeight),o=s*a),r.width=o,r.height=s,i.imageSmoothingEnabled=!0,i.imageSmoothingQuality=`high`,i.drawImage(e,0,0,o,s),r}getTableData(e){for(let t=0;t({index:t,width:e.width,type:e.type||`auto`})),rows:t.map((e,t)=>({index:t,height:e.height,heightRule:e.heightRule||`auto`,isHeader:e.isHeader||!1,cells:e.getCells().map((e,t)=>({index:t,gridSpan:e.gridSpan||1,rowSpan:e.rowSpan||1,vMerge:e.vMerge||null,isMergedContinue:e.isMergedContinue||!1,mergeParent:e.mergeParent||null}))}))}}extractTableContent(e){return{cells:e.getRows().map((e,t)=>e.getCells().map((e,n)=>({rowIndex:t,cellIndex:n,text:this.extractCellText(e),textBody:this.extractCellTextBody(e),content:this.extractCellContent(e)})))}}extractTableStyling(e){let t=e.getRows();return{table:{borders:e.getTableProperties()?.borders||{},shading:e.getTableProperties()?.shading||{},style:e.getTableProperties()?.style||`TableGrid`},rows:t.map((e,t)=>({index:t,height:e.height,heightRule:e.heightRule||`auto`,isHeader:e.isHeader||!1})),cells:t.map((e,t)=>e.getCells().map((e,n)=>({rowIndex:t,cellIndex:n,borders:e.borders||{},shading:e.shading||{},margins:e.margins||{},verticalAlignment:e.verticalAlignment||`top`,textDirection:e.textDirection||`lr`})))}}hasMergedCells(e){let t=e.getRows();for(let e of t)for(let t of e.getCells())if(t.gridSpan>1||t.rowSpan>1||t.isMergedContinue)return!0;return!1}extractCellTextBody(e){let t=e.getTextBody();return!t||!t.paragraphs?null:{paragraphs:t.paragraphs.map(e=>({properties:e.properties||{},runs:e.runs?.map(e=>({text:e.text||``,properties:e.properties||{}}))||[]}))}}extractCellContent(e){let t={type:`text`,data:null},n=e.getTextBody();return n&&n.paragraphs&&(t.type=`text`,t.data=this.extractCellTextBody(e)),t}extractCellText(e){return!e.textBody||!e.textBody.paragraphs?``:e.textBody.paragraphs.map(e=>e.runs?e.runs.map(e=>e.text||``).join(``):``).join(` +`)}cleanup(){this.loadingImages.clear()}};typeof globalThis<`u`&&(globalThis.PPTXSlideRenderer=Hu,globalThis.ImageLoader=Uu),typeof window<`u`&&(window.PPTXSlideRenderer||(window.PPTXSlideRenderer=Hu),window.ImageLoader||(window.ImageLoader=Uu));var Wu=class{constructor(e={}){this._getValidator();let t=this._validateConstructorOptions(e);this.errorBoundary=new(this._getErrorBoundary())({context:`PPTXProcessor`,enableLogging:t.enableLogging!==!1,errorHandler:t.errorHandler}),this.processor=null,this.presentation=null,this.isInitialized=!1,this.config={maxFileSize:t.maxFileSize||100*1024*1024,timeout:t.timeout||8e4,enableValidation:t.enableValidation!==!1,strictMode:t.strictMode===!0,retryOptions:{maxAttempts:t.maxRetryAttempts||3,baseDelay:t.retryDelay||1e3},...t},this.performanceMarks=new Map,this.memoryUsage={peak:0,current:0},this.processingState=`idle`,this.lastError=null,this.currentSlideIndex=0,this._initializeMonitoring()}async initialize(){if(!this.isInitialized)return this.errorBoundary.wrap(async()=>{this._markPerformance(`initialize_start`);try{this._validateEnvironment(),await this._initializeWithRetry(),this.isInitialized=!0,this.processingState=`idle`,this._markPerformance(`initialize_end`),window.logger&&window.logger.info(`PPTXProcessor`,`Processor initialized successfully`)}catch(e){throw this.processingState=`error`,this.lastError=e,this._enhanceError(e,`initialization`)}},{context:`initialize`})()}async _ensureInitialized(){if(this.isInitialized||await this.initialize(),!this.processor)throw this._createError(`Failed to initialize PPTX processor`,{name:`ProcessingError`,code:`INITIALIZATION_FAILED`,recoverable:!0})}async processFile(e,t={}){let n=this._validateFileInput(e,t);if(!n.valid)throw this._createValidationError(`Invalid file input`,n.errors);return this.errorBoundary.wrap(async()=>{this._markPerformance(`processFile_start`),this.processingState=`processing`;try{if(await this._ensureInitialized(),this._updateMemoryUsage(),await this._processWithTimeout(()=>this.processor.processFile(e),this.config.timeout),this.presentation=this.processor.presentation,this.processingState=`completed`,this._markPerformance(`processFile_end`),this.config.enableValidation&&this._validateProcessingResult(this.presentation),window.logger){let e=this._getPerformanceTiming(`processFile_start`,`processFile_end`);window.logger.info(`PPTXProcessor`,`File processed successfully in ${e}ms`)}return this.presentation}catch(t){throw this.processingState=`error`,this.lastError=t,this._enhanceError(t,`file_processing`,{arrayBufferSize:e.byteLength})}},{context:`processFile`})()}async loadFromArrayBuffer(e){return this.processFile(e)}async renderSlide(e,t,n={}){let r=this._validateRenderInput(e,t,n);if(!r.valid)throw this._createValidationError(`Invalid render input`,r.errors);return this.errorBoundary.wrap(async()=>{this._markPerformance(`renderSlide_start`);try{await this._ensureInitialized();let r=this.getSlidesCount();if(t<0||t>=r)throw this._createError(`Slide index ${t} out of bounds (0-${r-1})`,{name:`ValidationError`,code:`INVALID_SLIDE_INDEX`});this._updateMemoryUsage();let i=await this._processWithTimeout(()=>this.processor.renderSlide(e,t),n.timeout||this.config.timeout);if(this.currentSlideIndex=t,this._markPerformance(`renderSlide_end`),window.logger){let e=this._getPerformanceTiming(`renderSlide_start`,`renderSlide_end`);window.logger.trace(`PPTXProcessor`,`Slide ${t} rendered in ${e}ms`)}return i}catch(n){throw this._enhanceError(n,`slide_rendering`,{slideIndex:t,canvasSize:`${e.width}x${e.height}`})}},{context:`renderSlide`})()}getSlidesCount(){return!this.processor||!this.processor.slides?0:this.processor.slides.length}getCurrentSlideIndex(){return this.currentSlideIndex===void 0?0:this.currentSlideIndex}getCurrentSlide(e=null){if(!this.processor||!this.processor.slides)return null;let t=e===null?this.getCurrentSlideIndex():e;return this.processor.slides[t]||null}getSlideDimensions(){return this.processor?typeof this.processor.getSlideDimensions==`function`?this.processor.getSlideDimensions():this.processor.presentation&&this.processor.presentation.slideSize?this.processor.presentation.slideSize:{cx:9144e3,cy:6858e3}:{cx:9144e3,cy:6858e3}}clearCaches(){if(this._ensureInitialized(),this.processor){if(this.processor.imageCache){for(let[e,t]of this.processor.imageCache)t.url&&t.url.startsWith(`blob:`)&&URL.revokeObjectURL(t.url);this.processor.imageCache.clear()}this.processor.imageMap&&this.processor.imageMap.clear(),this.processor.mediaMap&&this.processor.mediaMap.clear(),this.processor.clearCaches&&typeof this.processor.clearCaches==`function`&&this.processor.clearCaches(),this.processor.drawingDocument&&this.processor.drawingDocument.graphics&&this.processor.drawingDocument.graphics.resetState(),this.processor.presentation&&(this.processor.presentation=null)}this.presentation=null}getPresentation(){if(!this.presentation&&this.config.strictMode)throw this._createError(`No presentation loaded`,{name:`ProcessingError`,code:`NO_PRESENTATION_LOADED`});return this.presentation}getProcessingStats(){return{state:this.processingState,isInitialized:this.isInitialized,slidesCount:this.getSlidesCount(),memoryUsage:{...this.memoryUsage},lastError:this.lastError?{name:this.lastError.name,message:this.lastError.message,timestamp:this.lastError.timestamp}:null,performanceMarks:Array.from(this.performanceMarks.entries())}}_getValidator(){return typeof window<`u`&&window.DataValidator?window.DataValidator:class{validate(){return{valid:!0,errors:[]}}}}_getErrorBoundary(){return typeof window<`u`&&window.ErrorBoundary?window.ErrorBoundary:class{constructor(){}wrap(e){return e}}}_validateConstructorOptions(e){let t=this._getValidator(),n={type:`object`,properties:{maxFileSize:{type:`number`,minimum:1024,maximum:500*1024*1024},timeout:{type:`number`,minimum:1e3,maximum:3e5},enableLogging:{type:`boolean`},enableValidation:{type:`boolean`},strictMode:{type:`boolean`},maxRetryAttempts:{type:`number`,minimum:0,maximum:10},retryDelay:{type:`number`,minimum:100,maximum:1e4}}};try{let r=new t({throwOnError:!1}).validate(e,n);!r.valid&&window.logger&&window.logger.warn(`PPTXProcessor`,`Invalid constructor options:`,r.errors)}catch{}return e}_validateEnvironment(){let e=[`Logger`,`PPTXSlideRenderer`].filter(e=>globalThis[e]===void 0);if(e.length>0)throw this._createError(`Missing required dependencies: ${e.join(`, `)}`,{name:`ProcessingError`,code:`MISSING_DEPENDENCIES`,details:{missingDependencies:e}})}async _initializeWithRetry(){let{maxAttempts:e,baseDelay:t}=this.config.retryOptions;return(typeof window<`u`&&window.ErrorRecovery?window.ErrorRecovery:{retry:async(e,t)=>{let n;for(let r=0;rsetTimeout(e,t.baseDelay))}throw n}}).retry(async e=>{if(window.logger&&window.logger.trace(`PPTXProcessor`,`Initialization attempt ${e}`),this.processor=new globalThis.PPTXSlideRenderer,!this.processor||typeof this.processor.processFile!=`function`)throw Error(`PPTXSlideRenderer instance is invalid`);return this.processor},{maxAttempts:e,baseDelay:t})}_validateFileInput(e,t){let n=[];if(!(e instanceof ArrayBuffer))n.push(`Input must be an ArrayBuffer`);else{e.byteLength===0&&n.push(`ArrayBuffer cannot be empty`),e.byteLength>this.config.maxFileSize&&n.push(`File size ${e.byteLength} exceeds maximum ${this.config.maxFileSize}`);let t=new Uint8Array(e,0,Math.min(4,e.byteLength));t.length>=2&&(t[0]!==80||t[1]!==75)&&n.push(`File does not appear to be a valid ZIP/PPTX file`)}return t&&typeof t!=`object`&&n.push(`Options must be an object`),{valid:n.length===0,errors:n}}_validateRenderInput(e,t,n){let r=[];return e?e instanceof HTMLCanvasElement?(e.width<=0||e.height<=0)&&r.push(`Canvas must have positive dimensions`):r.push(`Canvas must be an HTMLCanvasElement`):r.push(`Canvas is required`),(typeof t!=`number`||!Number.isInteger(t))&&r.push(`Slide index must be an integer`),n&&typeof n!=`object`&&r.push(`Options must be an object`),{valid:r.length===0,errors:r}}_validateProcessingResult(e){if(!e)throw this._createError(`Processing completed but no presentation was created`,{name:`ProcessingError`,code:`NO_PRESENTATION_RESULT`});this.config.strictMode&&(!this.processor.slides||this.processor.slides.length===0)&&window.logger?.warn(`PPTXProcessor`,`No slides found in presentation`)}async _processWithTimeout(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(this._createError(`Operation timed out after ${t}ms`,{name:`TimeoutError`,code:`OPERATION_TIMEOUT`}))},t);Promise.resolve(e()).then(e=>{clearTimeout(i),n(e)}).catch(e=>{clearTimeout(i),r(e)})})}_initializeMonitoring(){typeof performance<`u`&&performance.mark&&(this.performanceEnabled=!0),typeof performance<`u`&&performance.memory&&(this.memoryMonitoringEnabled=!0)}_markPerformance(e){if(this.performanceEnabled)try{performance.mark(e),this.performanceMarks.set(e,performance.now())}catch{}else this.performanceMarks.set(e,Date.now())}_getPerformanceTiming(e,t){let n=this.performanceMarks.get(e),r=this.performanceMarks.get(t);return n&&r?Math.round(r-n):0}_updateMemoryUsage(){if(this.memoryMonitoringEnabled&&performance.memory)try{let e=performance.memory.usedJSHeapSize;this.memoryUsage.current=e,this.memoryUsage.peak=Math.max(this.memoryUsage.peak,e)}catch{}}_createError(e,t={}){typeof window<`u`&&window.ErrorHandlerFactory&&window.ErrorHandlerFactory;let n=Error(e);return n.name=t.name||`ProcessingError`,n.code=t.code||null,n.context=`PPTXProcessor`,n.timestamp=new Date().toISOString(),n.recoverable=t.recoverable!==!1,t.details&&(n.details=t.details),n}_createValidationError(e,t){let n=this._createError(e,{name:`ValidationError`,code:`INPUT_VALIDATION_FAILED`});return n.validationErrors=t,n}_enhanceError(e,t,n={}){if(e.enhanced)return e;let r=e instanceof Error?e:Error(String(e));return r.operation=t,r.processorContext=n,r.timestamp=new Date().toISOString(),r.memoryUsage={...this.memoryUsage},r.enhanced=!0,r}};(function(){let e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:null;e&&(e.createPPTXProcessor||(e.createPPTXProcessor=(t={})=>{try{return new Wu(t)}catch(t){try{(e.logger||window?.logger)?.error?.(`PPTXProcessor`,`Failed to create processor:`,t)}catch{}throw t}}),e.PPTXProcessor||(e.PPTXProcessor=Wu))})();var Gu=`1.1.8`;try{typeof process<`u`&&{}.npm_package_version&&(Gu={}.npm_package_version)}catch{}var Ku=(e,t)=>{if(e)return e;if(typeof globalThis<`u`&&globalThis[t])return globalThis[t];if(typeof window<`u`&&window[t])return window[t];throw Error(`${t} is required but was not found. Install and import "${t===`Chart`?`chart.js`:`jszip`}" in your application.`)},qu=Ku(Il,`Chart`),Ju=Ku(Gl.default,`JSZip`);if(typeof globalThis<`u`){if(!globalThis.Logger){class e{constructor(){}log(){}info(){}warn(){}error(){}debug(){}trace(){}logError(){}markTiming(){}measureTiming(){}}globalThis.Logger=e}!globalThis.PPTXSlideRenderer&&typeof window<`u`&&window.PPTXSlideRenderer&&(globalThis.PPTXSlideRenderer=window.PPTXSlideRenderer),typeof window<`u`&&!window.PPTXSlideRenderer&&globalThis.PPTXSlideRenderer&&(window.PPTXSlideRenderer=globalThis.PPTXSlideRenderer),!globalThis.FontEngine&&typeof window<`u`&&window.FontEngine&&(globalThis.FontEngine=window.FontEngine),!globalThis.SimplifiedFontManager&&typeof window<`u`&&window.SimplifiedFontManager&&(globalThis.SimplifiedFontManager=window.SimplifiedFontManager),!globalThis.ZLib&&typeof window<`u`&&window.ZLib&&(globalThis.ZLib=window.ZLib),!globalThis.OpenXmlPackage&&typeof window<`u`&&window.OpenXmlPackage&&(globalThis.OpenXmlPackage=window.OpenXmlPackage),!globalThis.OpenXmlPart&&typeof window<`u`&&window.OpenXmlPart&&(globalThis.OpenXmlPart=window.OpenXmlPart),!globalThis.OpenXmlTypes&&typeof window<`u`&&window.OpenXmlTypes&&(globalThis.OpenXmlTypes=window.OpenXmlTypes),!globalThis.SVGRenderer&&typeof window<`u`&&window.SVGRenderer&&(globalThis.SVGRenderer=window.SVGRenderer),!globalThis.XmlParserContext&&typeof window<`u`&&window.XmlParserContext&&(globalThis.XmlParserContext=window.XmlParserContext),!globalThis.StaxParser&&typeof window<`u`&&window.StaxParser&&(globalThis.StaxParser=window.StaxParser),!globalThis.CPresentation&&typeof window<`u`&&window.CPresentation&&(globalThis.CPresentation=window.CPresentation),!globalThis.CSlide&&typeof window<`u`&&window.CSlide&&(globalThis.CSlide=window.CSlide),!globalThis.CSld&&typeof window<`u`&&window.CSld&&(globalThis.CSld=window.CSld),!globalThis.CShape&&typeof window<`u`&&window.CShape&&(globalThis.CShape=window.CShape),!globalThis.CGroupShape&&typeof window<`u`&&window.CGroupShape&&(globalThis.CGroupShape=window.CGroupShape),!globalThis.CSlideMaster&&typeof window<`u`&&window.CSlideMaster&&(globalThis.CSlideMaster=window.CSlideMaster),!globalThis.CSlideLayout&&typeof window<`u`&&window.CSlideLayout&&(globalThis.CSlideLayout=window.CSlideLayout),!globalThis.CTheme&&typeof window<`u`&&window.CTheme&&(globalThis.CTheme=window.CTheme),!globalThis.CTable&&typeof window<`u`&&window.CTable&&(globalThis.CTable=window.CTable),!globalThis.JSZip&&Ju!==void 0&&(globalThis.JSZip=Ju),!globalThis.PPTXProcessor&&typeof Wu==`function`&&(globalThis.PPTXProcessor=Wu),!globalThis.createPPTXProcessor&&typeof Wu==`function`&&(globalThis.createPPTXProcessor=(e={})=>new Wu(e))}typeof globalThis<`u`&&(typeof window<`u`&&(window.CGraphics=window.CGraphics||globalThis.CGraphics||void 0,!window.Chart&&qu!==void 0&&(window.Chart=qu),!window.PPTXSlideRenderer&&globalThis.PPTXSlideRenderer!==void 0&&(window.PPTXSlideRenderer=globalThis.PPTXSlideRenderer),!window.PPTXProcessor&&globalThis.PPTXProcessor!==void 0&&(window.PPTXProcessor=globalThis.PPTXProcessor),!window.createPPTXProcessor&&globalThis.createPPTXProcessor!==void 0&&(window.createPPTXProcessor=globalThis.createPPTXProcessor)),!globalThis.CGraphics&&typeof window<`u`&&window.CGraphics&&(globalThis.CGraphics=window.CGraphics));var Yu=class{constructor(e={}){let t=e||{};this.options={canvas:t.canvas??null,debug:t.debug??!1,enableThumbnails:t.enableThumbnails??!0,slideSizeMode:t.slideSizeMode??`fit`,backgroundColor:t.backgroundColor??`#ffffff`,autoRenderFirstSlide:t.autoRenderFirstSlide??!0,logger:t.logger??(typeof window<`u`?window.console:console),autoExposeGlobals:t.autoExposeGlobals??!0,autoChartRerenderDelayMs:t.autoChartRerenderDelayMs??200},Object.assign(this.options,t),this.processor=null,this.presentation=null,this.currentSlideIndex=0,this.slideCount=0,this.isLoaded=!1,this.eventListeners={},this._initPromise=null,this._scheduledPostLoadRerender=!1}async _initializeProcessor(){return this._initPromise||(this._initPromise=(async()=>{let e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:null,t=()=>({ctor:e&&e.PPTXProcessor||null,factory:e&&e.createPPTXProcessor||null});try{let e=0,n=t();for(;!n.ctor&&!n.factory&&e<100;)await new Promise(e=>setTimeout(e,20)),e+=1,n=t();if(n.ctor&&typeof n.ctor==`function`?this.processor=new n.ctor:n.factory&&typeof n.factory==`function`?this.processor=n.factory():this.processor=null,!this.processor)throw Error(`PPTXProcessor is not available. Ensure processors are loaded.`);return typeof this.processor.initialize==`function`&&await this.processor.initialize(),this.emit(`processorReady`),this.processor}catch(e){throw this.emit(`initError`,e),e}})()),this._initPromise}async loadFile(e,t={}){if(this.isLoaded&&this.processor){try{typeof this.processor.destroy==`function`?this.processor.destroy():typeof this.processor.reset==`function`&&this.processor.reset()}catch{}this.processor=null,this._initPromise=null}await this._initializeProcessor();try{this.emit(`loadStart`);let n;if(typeof File<`u`&&e instanceof File)n=await e.arrayBuffer();else if(e instanceof ArrayBuffer)n=e;else if(e instanceof Uint8Array)n=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);else throw Error(`Input must be File, ArrayBuffer, or Uint8Array`);if(await this.processor.processFile(n,t),this.presentation=this.processor.presentation,this.slideCount=this.processor.getSlidesCount(),this.currentSlideIndex=0,this.isLoaded=!0,this._scheduledPostLoadRerender=!1,this.options.autoExposeGlobals)try{this._exposeGlobalsForCharts()}catch{}return this.emit(`loadComplete`,{slideCount:this.slideCount,presentation:this.presentation}),this}catch(e){throw this.emit(`loadError`,e),e}}async loadFromUrl(e){this.emit(`loadStart`);try{let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch PPTX: ${t.status} ${t.statusText}`);let n=await t.arrayBuffer();return this.loadFile(n)}catch(e){throw this.emit(`loadError`,e),e}}async render(e,t={}){if(!this.isLoaded)throw Error(`No PPTX loaded. Call loadFile() first.`);let n=e||this.options.canvas;if(!n)throw Error(`Canvas element required. Provide canvas parameter or set in constructor.`);let r=t.slideIndex===void 0?this.currentSlideIndex:t.slideIndex;if(r<0||r>=this.slideCount)throw Error(`Invalid slide index: ${r}.`);try{if(this.emit(`renderStart`,r),await this.processor.renderSlide(n,r,t),this.currentSlideIndex=r,this.emit(`renderComplete`,r),this.emit(`slideChanged`,r),this.options.autoChartRerenderDelayMs>0&&!this._scheduledPostLoadRerender){this._scheduledPostLoadRerender=!0;let e=this.options.autoChartRerenderDelayMs;setTimeout(()=>{try{this.render(n,{...t,slideIndex:r})}catch{}},e)}return this}catch(e){throw this.emit(`renderError`,e),e}}async renderSlide(e,t=null,n={}){return this.render(t,{...n,slideIndex:e})}async nextSlide(e=null){return this.currentSlideIndex0&&await this.render(e,{slideIndex:this.currentSlideIndex-1}),this}async goToSlide(e,t=null){return this.render(t,{slideIndex:e})}getSlideCount(){return this.slideCount}getCurrentSlideIndex(){return this.currentSlideIndex}setCanvas(e){return this.options.canvas=e,this}on(e,t){this.eventListeners[e]||(this.eventListeners[e]=[]),this.eventListeners[e].push(t)}off(e,t){if(!this.eventListeners[e])return;let n=this.eventListeners[e].indexOf(t);n>-1&&this.eventListeners[e].splice(n,1)}emit(e,...t){this.eventListeners[e]&&this.eventListeners[e].forEach(e=>{try{e(...t)}catch{}})}destroy(){this.processor=null,this.eventListeners={},this.isLoaded=!1,this.currentSlideIndex=0,this.slideCount=0}_exposeGlobalsForCharts(){try{let e=this.processor;if(!e)return;let t=e.zip||e.processor?.zip||e.zipProcessor?.zip||null,n=e.package||e.processor?.package||e.zipProcessor?.package||null,r={processor:e,zip:t,package:n,reRenderShape:()=>{let e=typeof this.getCurrentSlideIndex==`function`?this.getCurrentSlideIndex():this.currentSlideIndex||0,t=this.options.canvas;t&&this.render(t,{slideIndex:e}).catch(()=>{})}};if(typeof window<`u`){if(window.currentProcessor=r,t&&(window.currentZipData=t),window.PPTXSlideRenderer&&t)try{window.PPTXSlideRenderer.currentZip=r.zip}catch{}try{window.currentProcessor&&window.currentProcessor.processor&&(!window.currentProcessor.processor.zip&&t&&(window.currentProcessor.processor.zip=t),!window.currentProcessor.processor.package&&n&&(window.currentProcessor.processor.package=n),window.currentProcessor.processor.zipProcessor||(window.currentProcessor.processor.zipProcessor={}),t&&!window.currentProcessor.processor.zipProcessor.zip&&(window.currentProcessor.processor.zipProcessor.zip=t),n&&!window.currentProcessor.processor.zipProcessor.package&&(window.currentProcessor.processor.zipProcessor.package=n))}catch{}}}catch{}}};function Xu({canvas:e,fileInput:t,prevBtn:n,nextBtn:r,statusEl:i,options:a={}}={}){if(!e)throw Error(`canvas is required`);let o=new Yu({canvas:e,...a}),s=()=>{try{let e=o.getSlideCount(),t=typeof o.getCurrentSlideIndex==`function`?o.getCurrentSlideIndex():0;n&&(n.disabled=!(t>0)),r&&(r.disabled=!(ts()),o.on(`loadComplete`,()=>{try{if(o&&o.processor&&a.autoExposeGlobals!==!1){let t=o.processor,n={processor:t,zip:t.zip,package:t.package,reRenderShape:()=>{let t=typeof o.getCurrentSlideIndex==`function`?o.getCurrentSlideIndex():0;o.render(e,{slideIndex:t}).catch(()=>{})}};if(typeof window<`u`&&(window.currentProcessor=n,t.zip&&(window.currentZipData=t.zip),window.PPTXSlideRenderer&&n.zip))try{window.PPTXSlideRenderer.currentZip=n.zip}catch{}}}catch{}s()}),t&&t.addEventListener(`change`,async()=>{let n=t.files&&t.files[0];if(n){i&&(i.textContent=`Loading...`);try{await o.loadFile(n);try{if(o&&o.processor&&a.autoExposeGlobals!==!1){let t=o.processor,n=t.zip||t.processor?.zip||t.zipProcessor?.zip||null,r=t.package||t.processor?.package||t.zipProcessor?.package||null;if(typeof window<`u`){window.currentProcessor={processor:t,zip:n,package:r,reRenderShape:()=>{let t=typeof o.getCurrentSlideIndex==`function`?o.getCurrentSlideIndex():0;o.render(e,{slideIndex:t}).catch(()=>{})}},n&&(window.currentZipData=n);try{window.currentProcessor&&window.currentProcessor.processor&&(!window.currentProcessor.processor.zip&&n&&(window.currentProcessor.processor.zip=n),!window.currentProcessor.processor.package&&r&&(window.currentProcessor.processor.package=r),window.currentProcessor.processor.zipProcessor||(window.currentProcessor.processor.zipProcessor={}),n&&!window.currentProcessor.processor.zipProcessor.zip&&(window.currentProcessor.processor.zipProcessor.zip=n),r&&!window.currentProcessor.processor.zipProcessor.package&&(window.currentProcessor.processor.zipProcessor.package=r))}catch{}}}}catch{}await o.render(e,{slideIndex:0});let t=typeof a.autoChartRerenderDelayMs==`number`?a.autoChartRerenderDelayMs:200;t>0&&setTimeout(()=>{let t=typeof o.getCurrentSlideIndex==`function`?o.getCurrentSlideIndex():0;o.render(e,{slideIndex:t}).catch(()=>{})},t)}catch(e){i&&(i.textContent=`Error: `+(e?.message||`Failed to load`))}}}),n&&n.addEventListener(`click`,async()=>{await o.previousSlide(e)}),r&&r.addEventListener(`click`,async()=>{await o.nextSlide(e)}),typeof window<`u`&&window.addEventListener(`chartRenderingComplete`,()=>{if(!o.isLoaded)return;let t=typeof o.getCurrentSlideIndex==`function`?o.getCurrentSlideIndex():0;o.render(e,{slideIndex:t}).catch(()=>{})}),o}var Zu={PPTXViewer:Yu,version:Gu,mountSimpleViewer:Xu};[`CGraphics`,`FontEngine`,`SimplifiedFontManager`,`ZLib`,`OpenXmlPackage`,`OpenXmlPart`,`OpenXmlTypes`,`SVGRenderer`,`XmlParserContext`,`StaxParser`,`CPresentation`,`CSlide`,`CSld`,`CShape`,`CGroupShape`,`CSlideMaster`,`CSlideLayout`,`CTheme`,`CTable`,`PPTXProcessor`,`PPTXSlideRenderer`,`Chart`,`JSZip`].forEach(e=>{try{typeof globalThis<`u`&&globalThis[e]&&!Zu[e]&&(Zu[e]=globalThis[e])}catch{}}),typeof globalThis<`u`&&(globalThis.PptxViewJS=Zu,!globalThis.PPTXProcessor&&Wu!==void 0&&(globalThis.PPTXProcessor=Wu),!globalThis.createPPTXProcessor&&Wu!==void 0&&(globalThis.createPPTXProcessor=(e={})=>new Wu(e))),!globalThis.PPTXSlideRenderer&&typeof Hu==`function`&&(globalThis.PPTXSlideRenderer=Hu);export{Yu as PPTXViewer}; \ No newline at end of file diff --git a/dist-embed/assets/UTIF-CE5fEjqo.js b/dist-embed/assets/UTIF-CE5fEjqo.js new file mode 100644 index 0000000..88f9912 --- /dev/null +++ b/dist-embed/assets/UTIF-CE5fEjqo.js @@ -0,0 +1 @@ +import{i as e,t}from"./rolldown-runtime-DAXXjFlN.js";var n=t((e=>{var t=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Int32Array<`u`;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!=`object`)throw TypeError(r+`must be non-object`);for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+r),i);return}for(var a=0;a{var t=n(),r=4,i=0,a=1,o=2;function s(e){for(var t=e.length;--t>=0;)e[t]=0}var c=0,l=1,u=2,d=3,f=258,p=29,m=256,h=m+1+p,g=30,_=19,v=2*h+1,y=15,b=16,x=7,S=256,C=16,w=17,T=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],A=512,j=Array((h+2)*2);s(j);var M=Array(g*2);s(M);var N=Array(A);s(N);var P=Array(f-d+1);s(P);var F=Array(p);s(F);var I=Array(g);s(I);function L(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var R,z,ee;function te(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function B(e){return e<256?N[e]:N[256+(e>>>7)]}function ne(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function V(e,t,n){e.bi_valid>b-n?(e.bi_buf|=t<>b-e.bi_valid,e.bi_valid+=n-b):(e.bi_buf|=t<>>=1,n<<=1;while(--t>0);return n>>>1}function ae(e){e.bi_valid===16?(ne(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function H(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=y;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;lc&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}}function oe(e,t,n){var r=Array(y+1),i=0,a,o;for(a=1;a<=y;a++)r[a]=i=i+n[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=ie(r[s]++,s))}}function se(){var e,t,n,r,i,a=Array(y+1);for(n=0,r=0;r>=7;r8?ne(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function ue(e,n,r,i){le(e),i&&(ne(e,r),ne(e,~r)),t.arraySet(e.pending_buf,e.window,n,r,e.pending),e.pending+=r}function U(e,t,n,r){var i=t*2,a=n*2;return e[i]>1;o>=1;o--)de(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],de(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,de(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],H(e,t),oe(n,c,e.bl_count)}function G(e,t,n){var r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s=3&&e.bl_tree[k[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function q(e,t,n,r){var i;for(V(e,t-257,5),V(e,n-1,5),V(e,r-4,4),i=0;i>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(n=32;n0?(e.strm.data_type===o&&(e.strm.data_type=J(e)),W(e,e.l_desc),W(e,e.d_desc),c=pe(e),a=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=a&&(a=s)):a=s=n+5,n+4<=a&&t!==-1?X(e,t,n,i):e.strategy===r||s===a?(V(e,(l<<1)+ +!!i,3),fe(e,j,M)):(V(e,(u<<1)+ +!!i,3),q(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),fe(e,e.dyn_ltree,e.dyn_dtree)),ce(e),i&&le(e)}function Z(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(P[n]+m+1)*2]++,e.dyn_dtree[B(t)*2]++),e.last_lit===e.lit_bufsize-1}e._tr_init=Y,e._tr_stored_block=X,e._tr_flush_block=ge,e._tr_tally=Z,e._tr_align=he})),i=t(((e,t)=>{function n(e,t,n,r){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}t.exports=n})),a=t(((e,t)=>{function n(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var r=n();function i(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[(e^t[s])&255];return e^-1}t.exports=i})),o=t(((e,t)=>{t.exports={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`}})),s=t((e=>{var t=n(),s=r(),c=i(),l=a(),u=o(),d=0,f=1,p=3,m=4,h=5,g=0,_=1,v=-2,y=-3,b=-5,x=-1,S=1,C=2,w=3,T=4,E=0,D=2,O=8,k=9,A=15,j=8,M=286,N=30,P=19,F=2*M+1,I=15,L=3,R=258,z=R+L+1,ee=32,te=42,B=69,ne=73,V=91,re=103,ie=113,ae=666,H=1,oe=2,se=3,ce=4,le=3;function ue(e,t){return e.msg=u[t],t}function U(e){return(e<<1)-(e>4?9:0)}function de(e){for(var t=e.length;--t>=0;)e[t]=0}function fe(e){var n=e.state,r=n.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(t.arraySet(e.output,n.pending_buf,n.pending_out,r,e.next_out),e.next_out+=r,n.pending_out+=r,e.total_out+=r,e.avail_out-=r,n.pending-=r,n.pending===0&&(n.pending_out=0))}function W(e,t){s._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,fe(e.strm)}function G(e,t){e.pending_buf[e.pending++]=t}function K(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function pe(e,n,r,i){var a=e.avail_in;return a>i&&(a=i),a===0?0:(e.avail_in-=a,t.arraySet(n,e.input,e.next_in,a,r),e.state.wrap===1?e.adler=c(e.adler,n,a,r):e.state.wrap===2&&(e.adler=l(e.adler,n,a,r)),e.next_in+=a,e.total_in+=a,a)}function q(e,t){var n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+R,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]!==m||l[i+o-1]!==p||l[i]!==l[r]||l[++i]!==l[r+1])continue;r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&ro){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function J(e){var n=e.w_size,r,i,a,o,s;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-z)){t.arraySet(e.window,e.window,n,n,0),e.match_start-=n,e.strstart-=n,e.block_start-=n,i=e.hash_size,r=i;do a=e.head[--r],e.head[r]=a>=n?a-n:0;while(--i);i=n,r=i;do a=e.prev[--r],e.prev[r]=a>=n?a-n:0;while(--i);o+=n}if(e.strm.avail_in===0)break;if(i=pe(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=i,e.lookahead+e.insert>=L)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(J(e),e.lookahead===0&&t===d)return H;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,W(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-z&&(W(e,!1),e.strm.avail_out===0))return H}return e.insert=0,t===m?(W(e,!0),e.strm.avail_out===0?se:ce):(e.strstart>e.block_start&&(W(e,!1),e.strm.avail_out),H)}function Y(e,t){for(var n,r;;){if(e.lookahead=L&&(e.ins_h=(e.ins_h<=L)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-L),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=L){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=L&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=L-1)),e.prev_length>=L&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-L,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-L),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<=L&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+R;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=L?(n=s._tr_tally(e,1,e.match_length-L),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(W(e,!1),e.strm.avail_out===0))return H}return e.insert=0,t===m?(W(e,!0),e.strm.avail_out===0?se:ce):e.last_lit&&(W(e,!1),e.strm.avail_out===0)?H:oe}function ge(e,t){for(var n;;){if(e.lookahead===0&&(J(e),e.lookahead===0)){if(t===d)return H;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(W(e,!1),e.strm.avail_out===0))return H}return e.insert=0,t===m?(W(e,!0),e.strm.avail_out===0?se:ce):e.last_lit&&(W(e,!1),e.strm.avail_out===0)?H:oe}function Z(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var Q=[new Z(0,0,0,0,me),new Z(4,4,8,4,Y),new Z(4,5,16,8,Y),new Z(4,6,32,32,Y),new Z(4,4,16,16,X),new Z(8,16,32,32,X),new Z(8,16,128,128,X),new Z(8,32,128,256,X),new Z(32,128,258,1024,X),new Z(32,258,258,4096,X)];function _e(e){e.window_size=2*e.w_size,de(e.head),e.max_lazy_match=Q[e.level].max_lazy,e.good_match=Q[e.level].good_length,e.nice_match=Q[e.level].nice_length,e.max_chain_length=Q[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=L-1,e.match_available=0,e.ins_h=0}function ve(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=O,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new t.Buf16(F*2),this.dyn_dtree=new t.Buf16((2*N+1)*2),this.bl_tree=new t.Buf16((2*P+1)*2),de(this.dyn_ltree),de(this.dyn_dtree),de(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new t.Buf16(I+1),this.heap=new t.Buf16(2*M+1),de(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new t.Buf16(2*M+1),de(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ye(e){var t;return!e||!e.state?ue(e,v):(e.total_in=e.total_out=0,e.data_type=D,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?te:ie,e.adler=t.wrap===2?0:1,t.last_flush=d,s._tr_init(t),g)}function be(e){var t=ye(e);return t===g&&_e(e.state),t}function xe(e,t){return!e||!e.state||e.state.wrap!==2?v:(e.state.gzhead=t,g)}function Se(e,n,r,i,a,o){if(!e)return v;var s=1;if(n===x&&(n=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),a<1||a>k||r!==O||i<8||i>15||n<0||n>9||o<0||o>T)return ue(e,v);i===8&&(i=9);var c=new ve;return e.state=c,c.strm=e,c.wrap=s,c.gzhead=null,c.w_bits=i,c.w_size=1<h||t<0)return e?ue(e,v):v;if(r=e.state,!e.output||!e.input&&e.avail_in!==0||r.status===ae&&t!==m)return ue(e,e.avail_out===0?b:v);if(r.strm=e,n=r.last_flush,r.last_flush=t,r.status===te)if(r.wrap===2)e.adler=0,G(r,31),G(r,139),G(r,8),r.gzhead?(G(r,+!!r.gzhead.text+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),G(r,r.gzhead.time&255),G(r,r.gzhead.time>>8&255),G(r,r.gzhead.time>>16&255),G(r,r.gzhead.time>>24&255),G(r,r.level===9?2:r.strategy>=C||r.level<2?4:0),G(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(G(r,r.gzhead.extra.length&255),G(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=l(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=B):(G(r,0),G(r,0),G(r,0),G(r,0),G(r,0),G(r,r.level===9?2:r.strategy>=C||r.level<2?4:0),G(r,le),r.status=ie);else{var o=O+(r.w_bits-8<<4)<<8,c=-1;c=r.strategy>=C||r.level<2?0:r.level<6?1:r.level===6?2:3,o|=c<<6,r.strstart!==0&&(o|=ee),o+=31-o%31,r.status=ie,K(r,o),r.strstart!==0&&(K(r,e.adler>>>16),K(r,e.adler&65535)),e.adler=1}if(r.status===B)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=l(e.adler,r.pending_buf,r.pending-i,i)),fe(e),i=r.pending,r.pending===r.pending_buf_size));)G(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=l(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=ne)}else r.status=ne;if(r.status===ne)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=l(e.adler,r.pending_buf,r.pending-i,i)),fe(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindexi&&(e.adler=l(e.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.gzindex=0,r.status=V)}else r.status=V;if(r.status===V)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=l(e.adler,r.pending_buf,r.pending-i,i)),fe(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}a=r.gzindexi&&(e.adler=l(e.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.status=re)}else r.status=re;if(r.status===re&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&fe(e),r.pending+2<=r.pending_buf_size&&(G(r,e.adler&255),G(r,e.adler>>8&255),e.adler=0,r.status=ie)):r.status=ie),r.pending!==0){if(fe(e),e.avail_out===0)return r.last_flush=-1,g}else if(e.avail_in===0&&U(t)<=U(n)&&t!==m)return ue(e,b);if(r.status===ae&&e.avail_in!==0)return ue(e,b);if(e.avail_in!==0||r.lookahead!==0||t!==d&&r.status!==ae){var u=r.strategy===C?ge(r,t):r.strategy===w?he(r,t):Q[r.level].func(r,t);if((u===se||u===ce)&&(r.status=ae),u===H||u===se)return e.avail_out===0&&(r.last_flush=-1),g;if(u===oe&&(t===f?s._tr_align(r):t!==h&&(s._tr_stored_block(r,0,0,!1),t===p&&(de(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),fe(e),e.avail_out===0))return r.last_flush=-1,g}return t===m?r.wrap<=0?_:(r.wrap===2?(G(r,e.adler&255),G(r,e.adler>>8&255),G(r,e.adler>>16&255),G(r,e.adler>>24&255),G(r,e.total_in&255),G(r,e.total_in>>8&255),G(r,e.total_in>>16&255),G(r,e.total_in>>24&255)):(K(r,e.adler>>>16),K(r,e.adler&65535)),fe(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending===0?_:g):g}function we(e){var t;return!e||!e.state?v:(t=e.state.status,t!==te&&t!==B&&t!==ne&&t!==V&&t!==re&&t!==ie&&t!==ae?ue(e,v):(e.state=null,t===ie?ue(e,y):g))}function Te(e,n){var r=n.length,i,a,o,s,l,u,d,f;if(!e||!e.state||(i=e.state,s=i.wrap,s===2||s===1&&i.status!==te||i.lookahead))return v;for(s===1&&(e.adler=c(e.adler,n,r,0)),i.wrap=0,r>=i.w_size&&(s===0&&(de(i.head),i.strstart=0,i.block_start=0,i.insert=0),f=new t.Buf8(i.w_size),t.arraySet(f,n,r-i.w_size,i.w_size,0),n=f,r=i.w_size),l=e.avail_in,u=e.next_in,d=e.input,e.avail_in=r,e.next_in=0,e.input=n,J(i);i.lookahead>=L;){a=i.strstart,o=i.lookahead-(L-1);do i.ins_h=(i.ins_h<{var t=n(),r=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch{r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{i=!1}for(var a=new t.Buf8(256),o=0;o<256;o++)a[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;a[254]=a[254]=1,e.string2buf=function(e){var n,r,i,a,o,s=e.length,c=0;for(a=0;a>>6,n[o++]=128|r&63):r<65536?(n[o++]=224|r>>>12,n[o++]=128|r>>>6&63,n[o++]=128|r&63):(n[o++]=240|r>>>18,n[o++]=128|r>>>12&63,n[o++]=128|r>>>6&63,n[o++]=128|r&63);return n};function s(e,n){if(n<65534&&(e.subarray&&i||!e.subarray&&r))return String.fromCharCode.apply(null,t.shrinkBuf(e,n));for(var a=``,o=0;o4){l[r++]=65533,n+=o-1;continue}for(i&=o===2?31:o===3?15:7;o>1&&n1){l[r++]=65533;continue}i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|i&1023)}return s(l,r)},e.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+a[e[n]]>t?n:t}})),l=t(((e,t)=>{function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}t.exports=n})),u=t((e=>{var t=s(),r=n(),i=c(),a=o(),u=l(),d=Object.prototype.toString,f=0,p=4,m=0,h=1,g=2,_=-1,v=0,y=8;function b(e){if(!(this instanceof b))return new b(e);this.options=r.assign({level:_,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:v,to:``},e||{});var n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var o=t.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(o!==m)throw Error(a[o]);if(n.header&&t.deflateSetHeader(this.strm,n.header),n.dictionary){var s=typeof n.dictionary==`string`?i.string2buf(n.dictionary):d.call(n.dictionary)===`[object ArrayBuffer]`?new Uint8Array(n.dictionary):n.dictionary;if(o=t.deflateSetDictionary(this.strm,s),o!==m)throw Error(a[o]);this._dict_set=!0}}b.prototype.push=function(e,n){var a=this.strm,o=this.options.chunkSize,s,c;if(this.ended)return!1;c=n===~~n?n:n===!0?p:f,typeof e==`string`?a.input=i.string2buf(e):d.call(e)===`[object ArrayBuffer]`?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(a.avail_out===0&&(a.output=new r.Buf8(o),a.next_out=0,a.avail_out=o),s=t.deflate(a,c),s!==h&&s!==m)return this.onEnd(s),this.ended=!0,!1;(a.avail_out===0||a.avail_in===0&&(c===p||c===g))&&(this.options.to===`string`?this.onData(i.buf2binstring(r.shrinkBuf(a.output,a.next_out))):this.onData(r.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||a.avail_out===0)&&s!==h);return c===p?(s=t.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===m):c===g?(this.onEnd(m),a.avail_out=0,!0):!0},b.prototype.onData=function(e){this.chunks.push(e)},b.prototype.onEnd=function(e){e===m&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function x(e,t){var n=new b(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}function S(e,t){return t=t||{},t.raw=!0,x(e,t)}function C(e,t){return t=t||{},t.gzip=!0,x(e,t)}e.Deflate=b,e.deflate=x,e.deflateRaw=S,e.gzip=C})),d=t(((e,t)=>{var n=30;t.exports=function(e,t){var r=e.state,i=e.next_in,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.input,D;a=i+(e.avail_in-5),o=e.next_out,D=e.output,s=o-(t-e.avail_out),c=o+(e.avail_out-257),l=r.dmax,u=r.wsize,d=r.whave,f=r.wnext,p=r.window,m=r.hold,h=r.bits,g=r.lencode,_=r.distcode,v=(1<>>24,m>>>=x,h-=x,x=b>>>16&255,x===0)D[o++]=b&65535;else if(x&16){S=b&65535,x&=15,x&&(h>>=x,h-=x),h<15&&(m+=E[i++]<>>24,m>>>=x,h-=x,x=b>>>16&255,x&16){if(C=b&65535,x&=15,hl){e.msg=`invalid distance too far back`,r.mode=n;break top}if(m>>>=x,h-=x,x=o-s,C>x){if(x=C-x,x>d&&r.sane){e.msg=`invalid distance too far back`,r.mode=n;break top}if(w=0,T=p,f===0){if(w+=u-x,x2;)D[o++]=T[w++],D[o++]=T[w++],D[o++]=T[w++],S-=3;S&&(D[o++]=T[w++],S>1&&(D[o++]=T[w++]))}else{w=o-C;do D[o++]=D[w++],D[o++]=D[w++],D[o++]=D[w++],S-=3;while(S>2);S&&(D[o++]=D[w++],S>1&&(D[o++]=D[w++]))}}else if(x&64){e.msg=`invalid distance code`,r.mode=n;break top}else{b=_[(b&65535)+(m&(1<>3,i-=S,h-=S<<3,m&=(1<{var r=n(),i=15,a=852,o=592,s=0,c=1,l=2,u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],d=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],f=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],p=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,m,h,g,_,v){var y=v.bits,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,A,j,M,N,P,F=null,I=0,L,R=new r.Buf16(i+1),z=new r.Buf16(i+1),ee=null,te=0,B,ne,V;for(b=0;b<=i;b++)R[b]=0;for(x=0;x=1&&R[C]===0;C--);if(w>C&&(w=C),C===0)return h[g++]=20971520,h[g++]=20971520,v.bits=1,0;for(S=1;S0&&(e===s||C!==1))return-1;for(z[1]=0,b=1;ba||e===l&&O>o)return 1;for(;;){B=b-E,_[x]L?(ne=ee[te+_[x]],V=F[I+_[x]]):(ne=96,V=0),A=1<>E)+j]=B<<24|ne<<16|V|0;while(j!==0);for(A=1<>=1;if(A===0?k=0:(k&=A-1,k+=A),x++,--R[b]===0){if(b===C)break;b=t[n+_[x]]}if(b>w&&(k&N)!==M){for(E===0&&(E=w),P+=S,T=b-E,D=1<a||e===l&&O>o)return 1;M=k&N,h[M]=w<<24|T<<16|P-g|0}}return k!==0&&(h[P+k]=b-E<<24|4194304),v.bits=w,0}})),p=t((e=>{var t=n(),r=i(),o=a(),s=d(),c=f(),l=0,u=1,p=2,m=4,h=5,g=6,_=0,v=1,y=2,b=-2,x=-3,S=-4,C=-5,w=8,T=1,E=2,D=3,O=4,k=5,A=6,j=7,M=8,N=9,P=10,F=11,I=12,L=13,R=14,z=15,ee=16,te=17,B=18,ne=19,V=20,re=21,ie=22,ae=23,H=24,oe=25,se=26,ce=27,le=28,ue=29,U=30,de=31,fe=32,W=852,G=592,K=15;function pe(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function q(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function J(e){var n;return!e||!e.state?b:(n=e.state,e.total_in=e.total_out=n.total=0,e.msg=``,n.wrap&&(e.adler=n.wrap&1),n.mode=T,n.last=0,n.havedict=0,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new t.Buf32(W),n.distcode=n.distdyn=new t.Buf32(G),n.sane=1,n.back=-1,_)}function me(e){var t;return!e||!e.state?b:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,J(e))}function Y(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?b:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,me(e))}function X(e,t){var n,r;return e?(r=new q,e.state=r,r.window=null,n=Y(e,t),n!==_&&(e.state=null),n):b}function he(e){return X(e,K)}var ge=!0,Z,Q;function _e(e){if(ge){var n;for(Z=new t.Buf32(512),Q=new t.Buf32(32),n=0;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(c(u,e.lens,0,288,Z,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;c(p,e.lens,0,32,Q,0,e.work,{bits:5}),ge=!1}e.lencode=Z,e.lenbits=9,e.distcode=Q,e.distbits=5}function ve(e,n,r,i){var a,o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(t.arraySet(o.window,n,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(a=o.wsize-o.wnext,a>i&&(a=i),t.arraySet(o.window,n,r-i,a,o.wnext),i-=a,i?(t.arraySet(o.window,n,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=o(i.check,Te,2,0),q=0,J=0,i.mode=E;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((q&255)<<8)+(q>>8))%31){e.msg=`incorrect header check`,i.mode=U;break}if((q&15)!==w){e.msg=`unknown compression method`,i.mode=U;break}if(q>>>=4,J-=4,$=(q&15)+8,i.wbits===0)i.wbits=$;else if($>i.wbits){e.msg=`invalid window size`,i.mode=U;break}i.dmax=1<<$,e.adler=i.check=1,i.mode=q&512?P:I,q=0,J=0;break;case E:for(;J<16;){if(G===0)break inf_leave;G--,q+=a[f++]<>8&1),i.flags&512&&(Te[0]=q&255,Te[1]=q>>>8&255,i.check=o(i.check,Te,2,0)),q=0,J=0,i.mode=D;case D:for(;J<32;){if(G===0)break inf_leave;G--,q+=a[f++]<>>8&255,Te[2]=q>>>16&255,Te[3]=q>>>24&255,i.check=o(i.check,Te,4,0)),q=0,J=0,i.mode=O;case O:for(;J<16;){if(G===0)break inf_leave;G--,q+=a[f++]<>8),i.flags&512&&(Te[0]=q&255,Te[1]=q>>>8&255,i.check=o(i.check,Te,2,0)),q=0,J=0,i.mode=k;case k:if(i.flags&1024){for(;J<16;){if(G===0)break inf_leave;G--,q+=a[f++]<>>8&255,i.check=o(i.check,Te,2,0)),q=0,J=0}else i.head&&(i.head.extra=null);i.mode=A;case A:if(i.flags&1024&&(X=i.length,X>G&&(X=G),X&&(i.head&&($=i.head.extra_len-i.length,i.head.extra||(i.head.extra=Array(i.head.extra_len)),t.arraySet(i.head.extra,a,f,X,$)),i.flags&512&&(i.check=o(i.check,a,X,f)),G-=X,f+=X,i.length-=X),i.length))break inf_leave;i.length=0,i.mode=j;case j:if(i.flags&2048){if(G===0)break inf_leave;X=0;do $=a[f+X++],i.head&&$&&i.length<65536&&(i.head.name+=String.fromCharCode($));while($&&X>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=I;break;case P:for(;J<32;){if(G===0)break inf_leave;G--,q+=a[f++]<>>=J&7,J-=J&7,i.mode=ce;break}for(;J<3;){if(G===0)break inf_leave;G--,q+=a[f++]<>>=1,--J,q&3){case 0:i.mode=R;break;case 1:if(_e(i),i.mode=V,n===g){q>>>=2,J-=2;break inf_leave}break;case 2:i.mode=te;break;case 3:e.msg=`invalid block type`,i.mode=U}q>>>=2,J-=2;break;case R:for(q>>>=J&7,J-=J&7;J<32;){if(G===0)break inf_leave;G--,q+=a[f++]<>>16^65535)){e.msg=`invalid stored block lengths`,i.mode=U;break}if(i.length=q&65535,q=0,J=0,i.mode=z,n===g)break inf_leave;case z:i.mode=ee;case ee:if(X=i.length,X){if(X>G&&(X=G),X>K&&(X=K),X===0)break inf_leave;t.arraySet(d,a,f,X,W),G-=X,f+=X,K-=X,W+=X,i.length-=X;break}i.mode=I;break;case te:for(;J<14;){if(G===0)break inf_leave;G--,q+=a[f++]<>>=5,J-=5,i.ndist=(q&31)+1,q>>>=5,J-=5,i.ncode=(q&15)+4,q>>>=4,J-=4,i.nlen>286||i.ndist>30){e.msg=`too many length or distance symbols`,i.mode=U;break}i.have=0,i.mode=B;case B:for(;i.have>>=3,J-=3}for(;i.have<19;)i.lens[Oe[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Ee={bits:i.lenbits},we=c(l,i.lens,0,19,i.lencode,0,i.work,Ee),i.lenbits=Ee.bits,we){e.msg=`invalid code lengths set`,i.mode=U;break}i.have=0,i.mode=ne;case ne:for(;i.have>>24,ye=Z>>>16&255,be=Z&65535,!(Q<=J);){if(G===0)break inf_leave;G--,q+=a[f++]<>>=Q,J-=Q,i.lens[i.have++]=be;else{if(be===16){for(De=Q+2;J>>=Q,J-=Q,i.have===0){e.msg=`invalid bit length repeat`,i.mode=U;break}$=i.lens[i.have-1],X=3+(q&3),q>>>=2,J-=2}else if(be===17){for(De=Q+3;J>>=Q,J-=Q,$=0,X=3+(q&7),q>>>=3,J-=3}else{for(De=Q+7;J>>=Q,J-=Q,$=0,X=11+(q&127),q>>>=7,J-=7}if(i.have+X>i.nlen+i.ndist){e.msg=`invalid bit length repeat`,i.mode=U;break}for(;X--;)i.lens[i.have++]=$}}if(i.mode===U)break;if(i.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,i.mode=U;break}if(i.lenbits=9,Ee={bits:i.lenbits},we=c(u,i.lens,0,i.nlen,i.lencode,0,i.work,Ee),i.lenbits=Ee.bits,we){e.msg=`invalid literal/lengths set`,i.mode=U;break}if(i.distbits=6,i.distcode=i.distdyn,Ee={bits:i.distbits},we=c(p,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Ee),i.distbits=Ee.bits,we){e.msg=`invalid distances set`,i.mode=U;break}if(i.mode=V,n===g)break inf_leave;case V:i.mode=re;case re:if(G>=6&&K>=258){e.next_out=W,e.avail_out=K,e.next_in=f,e.avail_in=G,i.hold=q,i.bits=J,s(e,Y),W=e.next_out,d=e.output,K=e.avail_out,f=e.next_in,a=e.input,G=e.avail_in,q=i.hold,J=i.bits,i.mode===I&&(i.back=-1);break}for(i.back=0;Z=i.lencode[q&(1<>>24,ye=Z>>>16&255,be=Z&65535,!(Q<=J);){if(G===0)break inf_leave;G--,q+=a[f++]<>xe)],Q=Z>>>24,ye=Z>>>16&255,be=Z&65535,!(xe+Q<=J);){if(G===0)break inf_leave;G--,q+=a[f++]<>>=xe,J-=xe,i.back+=xe}if(q>>>=Q,J-=Q,i.back+=Q,i.length=be,ye===0){i.mode=se;break}if(ye&32){i.back=-1,i.mode=I;break}if(ye&64){e.msg=`invalid literal/length code`,i.mode=U;break}i.extra=ye&15,i.mode=ie;case ie:if(i.extra){for(De=i.extra;J>>=i.extra,J-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=ae;case ae:for(;Z=i.distcode[q&(1<>>24,ye=Z>>>16&255,be=Z&65535,!(Q<=J);){if(G===0)break inf_leave;G--,q+=a[f++]<>xe)],Q=Z>>>24,ye=Z>>>16&255,be=Z&65535,!(xe+Q<=J);){if(G===0)break inf_leave;G--,q+=a[f++]<>>=xe,J-=xe,i.back+=xe}if(q>>>=Q,J-=Q,i.back+=Q,ye&64){e.msg=`invalid distance code`,i.mode=U;break}i.offset=be,i.extra=ye&15,i.mode=H;case H:if(i.extra){for(De=i.extra;J>>=i.extra,J-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg=`invalid distance too far back`,i.mode=U;break}i.mode=oe;case oe:if(K===0)break inf_leave;if(X=Y-K,i.offset>X){if(X=i.offset-X,X>i.whave&&i.sane){e.msg=`invalid distance too far back`,i.mode=U;break}X>i.wnext?(X-=i.wnext,he=i.wsize-X):he=i.wnext-X,X>i.length&&(X=i.length),ge=i.window}else ge=d,he=W-i.offset,X=i.length;X>K&&(X=K),K-=X,i.length-=X;do d[W++]=ge[he++];while(--X);i.length===0&&(i.mode=re);break;case se:if(K===0)break inf_leave;d[W++]=i.length,K--,i.mode=re;break;case ce:if(i.wrap){for(;J<32;){if(G===0)break inf_leave;G--,q|=a[f++]<{t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}})),h=t(((e,t)=>{function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}t.exports=n})),g=t((e=>{var t=p(),r=n(),i=c(),a=m(),s=o(),u=l(),d=h(),f=Object.prototype.toString;function g(e){if(!(this instanceof g))return new g(e);this.options=r.assign({chunkSize:16384,windowBits:0,to:``},e||{});var n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),n.windowBits>=0&&n.windowBits<16&&!(e&&e.windowBits)&&(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(n.windowBits&15||(n.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var o=t.inflateInit2(this.strm,n.windowBits);if(o!==a.Z_OK||(this.header=new d,t.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary==`string`?n.dictionary=i.string2buf(n.dictionary):f.call(n.dictionary)===`[object ArrayBuffer]`&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(o=t.inflateSetDictionary(this.strm,n.dictionary),o!==a.Z_OK))))throw Error(s[o])}g.prototype.push=function(e,n){var o=this.strm,s=this.options.chunkSize,c=this.options.dictionary,l,u,d,p,m,h=!1;if(this.ended)return!1;u=n===~~n?n:n===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof e==`string`?o.input=i.binstring2buf(e):f.call(e)===`[object ArrayBuffer]`?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(o.avail_out===0&&(o.output=new r.Buf8(s),o.next_out=0,o.avail_out=s),l=t.inflate(o,a.Z_NO_FLUSH),l===a.Z_NEED_DICT&&c&&(l=t.inflateSetDictionary(this.strm,c)),l===a.Z_BUF_ERROR&&h===!0&&(l=a.Z_OK,h=!1),l!==a.Z_STREAM_END&&l!==a.Z_OK)return this.onEnd(l),this.ended=!0,!1;o.next_out&&(o.avail_out===0||l===a.Z_STREAM_END||o.avail_in===0&&(u===a.Z_FINISH||u===a.Z_SYNC_FLUSH))&&(this.options.to===`string`?(d=i.utf8border(o.output,o.next_out),p=o.next_out-d,m=i.buf2string(o.output,d),o.next_out=p,o.avail_out=s-p,p&&r.arraySet(o.output,o.output,d,p,0),this.onData(m)):this.onData(r.shrinkBuf(o.output,o.next_out))),o.avail_in===0&&o.avail_out===0&&(h=!0)}while((o.avail_in>0||o.avail_out===0)&&l!==a.Z_STREAM_END);return l===a.Z_STREAM_END&&(u=a.Z_FINISH),u===a.Z_FINISH?(l=t.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,l===a.Z_OK):u===a.Z_SYNC_FLUSH?(this.onEnd(a.Z_OK),o.avail_out=0,!0):!0},g.prototype.onData=function(e){this.chunks.push(e)},g.prototype.onEnd=function(e){e===a.Z_OK&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function _(e,t){var n=new g(t);if(n.push(e,!0),n.err)throw n.msg||s[n.err];return n.result}function v(e,t){return t=t||{},t.raw=!0,_(e,t)}e.Inflate=g,e.inflate=_,e.inflateRaw=v,e.ungzip=_})),_=t(((e,t)=>{var r=n().assign,i=u(),a=g(),o=m(),s={};r(s,i,a,o),t.exports=s})),v=t(((t,n)=>{(function(){var t={};typeof n==`object`?n.exports=t:self.UTIF=t;var r=typeof e==`function`?_():self.pako;function i(){typeof process>`u`&&console.log.apply(console,arguments)}(function(e,t){(function(){var t=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},n=function(){function e(e){this.message=`JPEG error: `+e}return e.prototype=Error(),e.prototype.name=`JpegError`,e.constructor=e}(),r=function(){function e(e,t){this.message=e,this.g=t}return e.prototype=Error(),e.prototype.name=`DNLMarkerError`,e.constructor=e}();(function(){function i(){this.M=null,this.B=-1}function a(e,t){for(var n=0,r=[],i,a,o=16;0>D&1;if(E=e[i++],E===255){var t=e[i++];if(t){if(t===220&&C){i+=2;var o=e[i++]<<8|e[i++];if(0>>7}function h(e){for(;;){if(e=e[m()],typeof e==`number`)return e;if((e===void 0?`undefined`:t(e))!==`object`)throw new n(`invalid huffman sequence`)}}function g(e){for(var t=0;0=1<n;){var r=h(e.o),i=r&15;if(r>>=4,i===0){if(15>r)break;n+=16}else n+=r,e.a[t+l[n]]=_(i),n++}}function y(e,t){var n=h(e.D);n=n===0?0:_(n)<>=4,i===0){if(15>r){O=g(r)+(1<e.a[a]?-1:1;switch(k){case 0:if(i=h(e.o),a=i&15,i>>=4,a===0)15>i?(O=g(i)+(1<=B)throw new n(`marker was not found`);if(65488<=B&&65495>=B)i+=2;else break}return(B=c(e,i))&&B.f&&((0,_util.warn)(`decodeScan - unexpected Scan data, current marker is: `+B.f),i=B.offset),i-T}function s(e,t){for(var r=t.c,i=t.l,a=new Int16Array(64),o=0;of;f+=8){var p=d[c+f],m=d[c+f+1],h=d[c+f+2],g=d[c+f+3],_=d[c+f+4],v=d[c+f+5],y=d[c+f+6],b=d[c+f+7];if(p*=u[f],(m|h|g|_|v|y|b)===0)p=5793*p+512>>10,l[f]=p,l[f+1]=p,l[f+2]=p,l[f+3]=p,l[f+4]=p,l[f+5]=p,l[f+6]=p,l[f+7]=p;else{m*=u[f+1],h*=u[f+2],g*=u[f+3],_*=u[f+4],v*=u[f+5],y*=u[f+6],b*=u[f+7];var x=5793*p+128>>8,S=5793*_+128>>8,C=h,w=y;_=2896*(m-b)+128>>8,b=2896*(m+b)+128>>8,g<<=4,v<<=4,x=x+S+1>>1,S=x-S,p=3784*C+1567*w+128>>8,C=1567*C-3784*w+128>>8,w=p,_=_+v+1>>1,v=_-v,b=b+g+1>>1,g=b-g,x=x+w+1>>1,w=x-w,S=S+C+1>>1,C=S-C,p=2276*_+3406*b+2048>>12,_=3406*_-2276*b+2048>>12,b=p,p=799*g+4017*v+2048>>12,g=4017*g-799*v+2048>>12,v=p,l[f]=x+b,l[f+7]=x-b,l[f+1]=S+v,l[f+6]=S-v,l[f+2]=C+g,l[f+5]=C-g,l[f+3]=w+_,l[f+4]=w-_}}for(u=0;8>u;++u)p=l[u],m=l[u+8],h=l[u+16],g=l[u+24],_=l[u+32],v=l[u+40],y=l[u+48],b=l[u+56],(m|h|g|_|v|y|b)===0?(p=5793*p+8192>>14,p=-2040>p?0:2024<=p?255:p+2056>>4,d[c+u]=p,d[c+u+8]=p,d[c+u+16]=p,d[c+u+24]=p,d[c+u+32]=p,d[c+u+40]=p,d[c+u+48]=p,d[c+u+56]=p):(x=5793*p+2048>>12,S=5793*_+2048>>12,C=h,w=y,_=2896*(m-b)+2048>>12,b=2896*(m+b)+2048>>12,x=(x+S+1>>1)+4112,S=x-S,p=3784*C+1567*w+2048>>12,C=1567*C-3784*w+2048>>12,w=p,_=_+v+1>>1,v=_-v,b=b+g+1>>1,g=b-g,x=x+w+1>>1,w=x-w,S=S+C+1>>1,C=S-C,p=2276*_+3406*b+2048>>12,_=3406*_-2276*b+2048>>12,b=p,p=799*g+4017*v+2048>>12,g=4017*g-799*v+2048>>12,v=p,p=x+b,b=x-b,m=S+v,y=S-v,h=C+g,v=C-g,g=w+_,_=w-_,p=16>p?0:4080<=p?255:p>>4,m=16>m?0:4080<=m?255:m>>4,h=16>h?0:4080<=h?255:h>>4,g=16>g?0:4080<=g?255:g>>4,_=16>_?0:4080<=_?255:_>>4,v=16>v?0:4080<=v?255:v>>4,y=16>y?0:4080<=y?255:y>>4,b=16>b?0:4080<=b?255:b>>4,d[c+u]=p,d[c+u+8]=m,d[c+u+16]=h,d[c+u+24]=g,d[c+u+32]=_,d[c+u+40]=v,d[c+u+48]=y,d[c+u+56]=b)}return t.a}function c(e,t){var n=2=r)return null;var i=e[t]<<8|e[t+1];if(65472<=i&&65534>=i)return{f:null,F:i,offset:t};for(var a=e[n]<<8|e[n+1];!(65472<=a&&65534>=a);){if(++n>=r)return null;a=e[n]<<8|e[n+1]}return{f:i.toString(16),F:a,offset:n}}var l=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);i.prototype={parse:function(e){function t(){var t=e[p]<<8|e[p+1];return p+=2,t}function i(){var n=t();n=p+n-2;var r=c(e,n,p);return r&&r.f&&((0,_util.warn)(`readDataBlock - incorrect length, current marker is: `+r.f),n=r.offset),n=e.subarray(p,n),p+=n.length,n}function u(e){for(var t=Math.ceil(e.v/8/e.s),n=Math.ceil(e.g/8/e.u),r=0;r>4))for(y=0;64>y;y++)b=l[y],S[b]=e[p++];else if(x>>4==1)for(y=0;64>y;y++)b=l[y],S[b]=t();else throw new n(`DQT - invalid table spec`);d[x&15]=S}break;case 65472:case 65473:case 65474:if(C)throw new n(`Only single frame JPEGs supported`);t();var C={};for(C.X=v===65473,C.S=v===65474,C.precision=e[p++],v=t(),C.g=f||v,C.v=t(),C.b=[],C.C={},y=e[p++],v=S=x=0;v>4,T=e[p+1]&15;xy;y++,p++)w+=S[y]=e[p];for(T=new Uint8Array(w),y=0;y>4?g:_)[x&15]=a(S,T)}break;case 65501:t();var E=t();break;case 65498:for(y=++h===1&&!f,t(),x=e[p++],b=[],v=0;v>4],D.o=g[S&15],b.push(D)}v=e[p++],x=e[p++],S=e[p++];try{var O=o(e,p,C,b,E,v,x,S>>4,S&15,y);p+=O}catch(t){if(t instanceof r)return(0,_util.warn)(`Attempting to re-parse JPEG image using "scanLines" parameter found in DNL marker (0xFFDC) segment.`),this.parse(e,{N:t.g});throw t}break;case 65500:p+=4;break;case 65535:e[p]!==255&&p--;break;default:if(e[p-3]===255&&192<=e[p-2]&&254>=e[p-2])p-=3;else if((y=c(e,p-2))&&y.f)(0,_util.warn)(`JpegImage.parse - unexpected data, current marker is: `+y.f),p=y.offset;else throw new n(`unknown marker `+v.toString(16))}v=t()}for(this.width=C.v,this.height=C.g,this.A=m,this.b=[],v=0;v>8)+r[n+1];return c},w:function(){return this.A?!!this.A.W:this.i===3?this.B!==0:this.B===1},I:function(e){for(var t,n,r,i=0,a=e.length;i>>3)]),f??(f=n.t325);var p=new Uint8Array(n.height*(u>>>3)),m=0;if(n.t322!=null){for(var h=n.t322[0],g=n.t323[0],_=Math.floor((n.width+h-1)/h),v=Math.floor((n.height+g-1)/g),y=new Uint8Array(Math.ceil(h*g*l/8)|0),b=0;b>>3,y=n.t278?n.t278[0]:n.height,b=Math.ceil(g*_*n.width/8);if(g==16&&!n.isLE&&n.t33422==null)for(var x=0;x>>8&255}else if(_==3)for(var f=3;f>>(p[m]>>>8),h=0;h>>4,a[o+m+1]=C<<4|T>>>4,a[o+m+2]=T<<4|w>>>4}return}var E=new Uint16Array(16),v,_,D,O,k,A,j,M,N,m,P,F=new Uint8Array(s+1);for(v=0;v>>11,A=15&D>>>22,j=15&D>>>26,M=0;M<4&&128<>3))>>>(N&7)&127)<2047&&(E[m]=2047),N+=7);for(m=0;m<16;m++,_+=2){var S=E[m]<<1;e.decode._putsF(a,(v*s+_)*l,S<<16-l)}_-=_&1?1:31}}},e.decode._decodeNikon=function(t,n,r,i,a,o,s){var c=[[0,0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,5,4,3,6,2,7,1,0,8,9,11,10,12],[0,0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,57,90,56,39,22,5,4,3,2,1,0,11,12,12],[0,0,1,4,2,3,1,2,0,0,0,0,0,0,0,0,0,5,4,6,3,7,2,8,1,9,0,10,11,12],[0,0,1,4,3,1,1,1,1,1,2,0,0,0,0,0,0,5,6,4,7,8,3,9,2,1,0,10,11,12,13,14],[0,0,1,5,1,1,1,1,1,1,1,2,0,0,0,0,0,8,92,75,58,41,7,6,5,4,3,2,1,0,13,14],[0,0,1,4,2,2,3,1,2,0,0,0,0,0,0,0,0,7,6,8,5,9,4,10,3,11,12,2,0,1,13,14]],l=t.t256[0],u=t.t257[0],d=t.t258[0],f=0,p=0,m=e.decode._make_decoder,h=e.decode._getbithuff,g=n[0].exifIFD.makerNote,_=g.t150?g.t150:g.t140,v=0,y=_[v++],b=_[v++];(y==73||b==88)&&(v+=2110),y==70&&(f=2),d==14&&(f+=3);for(var x=[[0,0],[0,0]],S=t.isLE?e._binLE:e._binBE,C=0;C<2;C++)for(var w=0;w<2;w++)x[C][w]=S.readShort(_,v),v+=2;var T=1<1&&(E=Math.floor(T/(D-1))),y==68&&b==32&&E>0&&(p=S.readShort(_,562));var C,O,k,A,j,M,N=[0,0],P=m(c[f]),F=[i,0,0,0];for(O=0;O>>4,M=(h(r,F,A-j,0)<<1)+1<>>1,M&1<>>3;e[r]|=n>>>16,e[r+1]|=n>>>8,e[r+2]|=n},e.decode._getbithuff=function(t,n,r,i){var a=0;e.decode._get_byte;var o,s=n[0],c=n[1],l=n[2],u=n[3];if(r==0||l<0)return 0;for(;!u&&l>>32-r,i?(l-=i[o+1]>>>8,o=i[o+1]&255):l-=r,l<0)throw`e`;return n[0]=s,n[1]=c,n[2]=l,n[3]=u,o},e.decode._make_decoder=function(e){var t,n,r,i,a,o=[];for(t=16;t!=0&&!e[t];t--);var s=17;for(o[0]=t,r=n=1;n<=t;n++)for(i=0;i>>8;else for(var p=0;p>>8,a[o+(p<<1)+1]=_[p]&255;else if(g==14||g==12)for(var y=16-g,p=0;p1),!h){if(t[n]==255&&t[n+1]==a)return{jpegOffset:n};if(y!=null&&(t[n+b]==255&&t[n+b+1]==a?d=n+b:i(`JPEGInterchangeFormat does not point to SOI`),x==null?i(`JPEGInterchangeFormatLength field is missing`):(b>=f||b+S<=f)&&i(`JPEGInterchangeFormatLength field value is invalid`),d!=null))return{jpegOffset:d}}if(w!=null&&(T=w[0],E=w[1]),y!=null&&x!=null)if(S>=2&&b+S<=f){for(p=t[n+b+S-2]==255&&t[n+b+S-1]==a?new Uint8Array(S-2):new Uint8Array(S),g=0;g offset to first strip or tile`);if(p==null){var k=0,A=[];A[k++]=255,A[k++]=a;var j=e.t519;if(j==null)throw Error(`JPEGQTables tag is missing`);for(g=0;g>>8,A[k++]=N&255,A[k++]=g|v<<4,_=0;_<16;_++)A[k++]=t[n+M[g]+_];for(_=0;_>>8&255,A[k++]=e.height&255,A[k++]=e.width>>>8&255,A[k++]=e.width&255,A[k++]=D,D==1)A[k++]=1,A[k++]=17,A[k++]=0;else for(g=0;g<3;g++)A[k++]=g+1,A[k++]=g==0?(T&15)<<4|E&15:17,A[k++]=g;O!=null&&O[0]!=0&&(A[k++]=255,A[k++]=c,A[k++]=0,A[k++]=4,A[k++]=O[0]>>>8&255,A[k++]=O[0]&255),p=new Uint8Array(A)}var P=-1;for(g=0;g>>8&255,p[I++]=e.height&255,p[I++]=e.width>>>8&255,p[I++]=e.width&255,p[I++]=D,D==1)p[I++]=1,p[I++]=17,p[I++]=0;else for(g=0;g<3;g++)p[I++]=g+1,p[I++]=g==0?(T&15)<<4|E&15:17,p[I++]=g}if(t[f]==255&&t[f+1]==u){var L=t[f+2]<<8|t[f+3];for(m=new Uint8Array(L+2),m[0]=t[f],m[1]=t[f+1],m[2]=t[f+2],m[3]=t[f+3],g=0;g>>8&255,u[f.sofPosition+6]=t.height&255,u[f.sofPosition+7]=t.width>>>8&255,u[f.sofPosition+8]=t.width&255,(n[r]!=255||n[r+1]!=SOS)&&(u.set(f.sosMarker,d),d+=sosMarker.length),s=0;s=0&&c<128)for(var l=0;l=-127&&c<0){for(var l=0;l<-c+1;l++)o[i]=a[t],i++;t++}}},e.decode._decodeThunder=function(e,t,n,r,i){for(var a=[0,1,0,-1],o=[0,1,2,3,0,-3,-2,-1],s=t+n,c=i*2,l=0;t>>6,f=u&63;if(t++,d==3&&(l=f&15,r[c>>>1]|=l<<4*(1-c&1),c++),d==0)for(var p=0;p>>1]|=l<<4*(1-c&1),c++;if(d==2)for(var p=0;p<2;p++){var m=f>>>3*(1-p)&7;m!=4&&(l+=o[m],r[c>>>1]|=l<<4*(1-c&1),c++)}if(d==1)for(var p=0;p<3;p++){var m=f>>>2*(2-p)&3;m!=2&&(l+=a[m],r[c>>>1]|=l<<4*(1-c&1),c++)}}},e.decode._dmap={1:0,"011":1,"000011":2,"0000011":3,"010":-1,"000010":-2,"0000010":-3},e.decode._lens=(function(){var e=function(e,t,n,r){for(var i=0;i>>3>>3]>>>7-(l&7)&1),s==2&&(w=t[l>>>3]>>>(l&7)&1),l++,d+=w,x==`H`){if(c._lens[y][d]!=null){var T=c._lens[y][d];d=``,u+=T,T<64&&(c._addNtimes(f,u,y),h+=u,y=1-y,u=0,S--,S==0&&(x=``))}}else d==`0001`&&(d=``,c._addNtimes(f,v-h,y),h=v),d==`001`&&(d=``,x=`H`,S=2),c._dmap[d]!=null&&(g=_+c._dmap[d],c._addNtimes(f,g-h,y),h=g,d=``,y=1-y);f.length==o&&x==``&&(c._writeBits(f,i,a*8+b*C),y=0,b++,h=0,p=c._makeDiff(f),f=[])}},e.decode._findDiff=function(e,t,n){for(var r=0;r=t&&e[r+1]==n)return e[r]},e.decode._makeDiff=function(e){var t=[];e[0]==1&&t.push(0,1);for(var n=1;n>>3>>3]>>>7-(l&7)&1),s==2&&(T=t[l>>>3]>>>(l&7)&1),l++,d+=T,C){if(c._lens[y][d]!=null){var E=c._lens[y][d];d=``,u+=E,E<64&&(c._addNtimes(f,u,y),y=1-y,u=0)}}else if(x==`H`){if(c._lens[y][d]!=null){var E=c._lens[y][d];d=``,u+=E,E<64&&(c._addNtimes(f,u,y),h+=u,y=1-y,u=0,S--,S==0&&(x=``))}}else d==`0001`&&(d=``,c._addNtimes(f,v-h,y),h=v),d==`001`&&(d=``,x=`H`,S=2),c._dmap[d]!=null&&(g=_+c._dmap[d],c._addNtimes(f,g-h,y),h=g,d=``,y=1-y);d.endsWith(`000000000001`)&&(b>=0&&c._writeBits(f,i,a*8+b*w),s==1&&(C=(t[l>>>3]>>>7-(l&7)&1)==1),s==2&&(C=(t[l>>>3]>>>(l&7)&1)==1),l++,c._decodeG3.allow2D??(c._decodeG3.allow2D=C),c._decodeG3.allow2D||(C=!0,l--),d=``,y=0,b++,h=0,p=c._makeDiff(f),f=[])}f.length==o&&c._writeBits(f,i,a*8+b*w)},e.decode._addNtimes=function(e,t,n){for(var r=0;r>>3]|=e[r]<<7-(n+r&7)},e.decode._decodeLZW=function(t,n,r,i){if(e.decode._lzwTab==null){for(var a=new Uint32Array(65535),o=new Uint16Array(65535),s=new Uint8Array(2e6),c=0;c<256;c++)s[c<<2]=c,a[c]=c<<2,o[c]=1;e.decode._lzwTab=[a,o,s]}for(var l=e.decode._copyData,u=e.decode._lzwTab[0],d=e.decode._lzwTab[1],s=e.decode._lzwTab[2],f=258,p=1032,m=9,h=n<<3,g=256,_=257,v=0,y=0,b=0;v=t[h>>>3]<<16|t[h+8>>>3]<<8|t[h+16>>>3],y=v>>24-(h&7)-m&(1<>>3]<<16|t[h+8>>>3]<<8|t[h+16>>>3],y=v>>24-(h&7)-m&(1<=f)u[f]=p,s[u[f]]=x[0],d[f]=1,p=p+1+3&-4,f++;else{u[f]=p;var C=u[b],w=d[b];l(s,C,s,p,w),s[p+w]=s[x],w++,d[f]=w,f++,p=p+w+3&-4}f+1==1<=f)u[f]=p,d[f]=0,f++;else{u[f]=p;var C=u[b],w=d[b];l(s,C,s,p,w),s[p+w]=s[p],w++,d[f]=w,f++,l(s,p,r,i,w),i+=w,p=p+w+3&-4}f+1==1<>>----------------`);for(var u=0;u4&&(t.writeUint(n,r,o),m=o),u==2&&t.writeASCII(n,m,d),u==3)for(var h=0;h4&&(p+=p&1,o+=p),r+=4}return[r,o]},e.toRGBA8=function(e){var t=e.width,n=e.height,r=t*n,a=r*4,o=e.data,s=new Uint8Array(r*4),c=e.t262?e.t262[0]:2,l=e.t258?Math.min(32,e.t258[0]):1;if(c==0)for(var u=Math.ceil(l*t/8),d=0;d>3)]>>7-(m&7)&1;s[h]=s[h+1]=s[h+2]=(1-g)*255,s[h+3]=255}if(l==4)for(var m=0;m>1)]>>4-4*(m&1)&15;s[h]=s[h+1]=s[h+2]=(15-g)*17,s[h+3]=255}if(l==8)for(var m=0;m>3)]>>7-(m&7)&1;s[h]=s[h+1]=s[h+2]=g*255,s[h+3]=255}if(l==2)for(var m=0;m>2)]>>6-2*(m&3)&3;s[h]=s[h+1]=s[h+2]=g*85,s[h+3]=255}if(l==8)for(var m=0;m>8,s[h+1]=y[256+b]>>8,s[h+2]=y[512+b]>>8,s[h+3]=255}else if(c==5)for(var _=e.t258?e.t258.length:4,x=+(_>4),m=0;ma&&(a=l,o=c)}}e.decodeImage(n,o,r);var u=e.toRGBA8(o),d=o.width,f=o.height,p=e._xhrs.indexOf(t.target),c=e._imgs[p];e._xhrs.splice(p,1),e._imgs.splice(p,1);var m=document.createElement(`canvas`);m.width=d,m.height=f;for(var h=m.getContext(`2d`),g=h.createImageData(d,f),s=0;s>8&255,e[t+1]=n&255},writeUint:function(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n>>0&255},writeASCII:function(e,t,n){for(var r=0;r>>8),this._=8),this.G>>>--this._&1},Z:function(e){var t=this._,n=this.G,r=Math.min(t,e);e-=r,t-=r;for(var i=n>>>t&(1<0;)n=this.w[this.N],this.N+=1+(n+1>>>8),r=Math.min(8,e),e-=r,t=8-r,i<<=r,i|=n>>>t&(1<>>8),a=8),i=o>>>--a&1,n=e[n+i],r=e[n+2],r!=-1)return t._=a,t.G=o,t.N=s,r;return-1};function n(t){this.z=new e(t),this.D(this.z)}n.prototype={$:function(e,t){this.Q=e.i(),this.F=e.l(),this.o=e.l();var n=this.O=e.i();this.L=[];for(var r=0;r0;)e-=this.e()},p:function(e,t){var n=e.i();this.U||(this.U=[]);for(var r=0;r>>4]}this.g=e.i(),e.t(e.N+t-(2+n*2))},D:function(e){var t=!1,r=e.l();if(r===n.q)do{var r=e.l(),i=e.l()-2;switch(r){case n.m:this.$(e,i);break;case n.K:this.W(i);break;case n.V:this.p(e,i),t=!0;break;default:e.t(e.N+i);break}}while(!t)},I:function(e,n){var r=t.B(n,e);if(r==16)return-32768;var i=e.Z(r);return i&1<>>1)),e[p]=m+a(n,c[l])}d+=t}}},n.m=65475,n.K=65476,n.q=65496,n.V=65498;function r(e){var t=new n(e),r=new(t.Q>8?Uint16Array:Uint8Array)(t.o*t.F*t.O),i=t.o*t.O;return t.B(r,i),r}return r}()})(t,r)})()}));export default v(); \ No newline at end of file diff --git a/dist-embed/assets/base-renderer-DM6Nw1yD.js b/dist-embed/assets/base-renderer-DM6Nw1yD.js new file mode 100644 index 0000000..5b30b4f --- /dev/null +++ b/dist-embed/assets/base-renderer-DM6Nw1yD.js @@ -0,0 +1 @@ +var e=class{constructor(){this.numPages=1,this.scale=1,this.container=null,this.viewer=null,this.defaultScaleOption=`page-width`}async load(e,t,n){this.container=t,this.viewer=n}scrollToPage(e){let t=this.container?.querySelector(`[data-page="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}setScale(e){this.scale=e,this.container?.querySelectorAll(`.doc-page`).forEach(t=>{t.style.zoom=e===1?``:e})}getPageWidth(){return 816}getPageHeight(){return null}async preparePrint(){}cleanupAfterPrint(){}destroy(){this.container&&(this.container.innerHTML=``)}};export{e as t}; \ No newline at end of file diff --git a/dist-embed/assets/canvas-driver-BnEksqHW.js b/dist-embed/assets/canvas-driver-BnEksqHW.js new file mode 100644 index 0000000..41d26e9 --- /dev/null +++ b/dist-embed/assets/canvas-driver-BnEksqHW.js @@ -0,0 +1 @@ +import{c as e,n as t,r as n,t as r}from"./driver-0cTj10HJ.js";var i=class extends t{constructor(e){super(),this.ctx=e}beginPage(e,t){super.beginPage(e,t),this.ctx.clearRect(0,0,e,t)}_trace(e){let t=this.ctx;t.beginPath();for(let n of e.segs)n.op===`M`?t.moveTo(n.x,n.y):n.op===`L`?t.lineTo(n.x,n.y):n.op===`C`?t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x3,n.y3):n.op===`Z`&&t.closePath()}fill(t,n,r){this.ctx.fillStyle=e(r),this._trace(t),this.ctx.fill(n)}stroke(t,i,a){let o=this.ctx;o.strokeStyle=e(a),o.lineWidth=i.width,o.lineCap=r[i.cap]||`butt`,o.lineJoin=n[i.join]||`miter`,o.miterLimit=i.miter,o.setLineDash(i.dash||[]),o.lineDashOffset=i.offset||0,this._trace(t),o.stroke()}clip(e,t){this._trace(e),this.ctx.clip(t)}save(){this.ctx.save()}restore(){this.ctx.restore()}showText(t,n,r,i,a){let o=this.ctx;o.save(),o.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),o.fillStyle=e(i),o.font=`${(a.italic?`italic `:``)+(a.bold?`bold `:``)}${r}px ${a.family}`,o.textBaseline=`alphabetic`,o.fillText(t,0,0),o.restore()}};export{i as CanvasDriver}; \ No newline at end of file diff --git a/dist-embed/assets/chm-reader-Bjyc0KjP.js b/dist-embed/assets/chm-reader-Bjyc0KjP.js new file mode 100644 index 0000000..686658e --- /dev/null +++ b/dist-embed/assets/chm-reader-Bjyc0KjP.js @@ -0,0 +1 @@ +var e=2**53-1,t=class{constructor(e,t=0){this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=t}get length(){return this.bytes.length}remaining(){return this.bytes.length-this.pos}seek(e){return this.pos=e,this}skip(e){return this.pos+=e,this}u8(){return this.bytes[this.pos++]}u16(){let e=this.view.getUint16(this.pos,!0);return this.pos+=2,e}u32(){let e=this.view.getUint32(this.pos,!0);return this.pos+=4,e}i32(){let e=this.view.getInt32(this.pos,!0);return this.pos+=4,e}u64(){let t=this.view.getUint32(this.pos,!0),n=this.view.getUint32(this.pos+4,!0);this.pos+=8;let r=n*4294967296+t;if(r>e)throw RangeError(`64-bit value 0x${n.toString(16)}${t.toString(16)} exceeds safe integer range`);return r}bytesOf(e){let t=this.bytes.subarray(this.pos,this.pos+e);return this.pos+=e,t}guid(){let e=this.bytesOf(16),t=(t,n)=>{let r=``;for(let i=n-1;i>=0;i--)r+=e[t+i].toString(16).padStart(2,`0`);return r.toUpperCase()},n=Array.from(e.subarray(8,16),e=>e.toString(16).padStart(2,`0`).toUpperCase()).join(``);return`{${t(0,4)}-${t(4,2)}-${t(6,2)}-${n.slice(0,4)}-${n.slice(4)}}`}encint(){let t=0,n;do if(n=this.bytes[this.pos++],t=t*128+(n&127),t>e)throw RangeError(`ENCINT exceeds safe integer range`);while(n&128);return t}},n=new TextDecoder(`utf-8`);function r(e,t,r){return n.decode(e.subarray(t,t+r))}var i=`{7C01FD10-7BAA-11D0-9E0C-00A0C922E6EC}`,a=`{7C01FD11-7BAA-11D0-9E0C-00A0C922E6EC}`,o=`{5D02926A-212E-11D0-9DF9-00A0C922E6EC}`;function s(e){let n=new t(e),s=r(e,0,4);if(s!==`ITSF`)throw Error(`Not a CHM file: expected "ITSF" magic, got ${JSON.stringify(s)}`);n.seek(4);let l=n.u32();n.u32(),n.u32(),n.u32();let u=n.u32(),d=n.guid(),f=n.guid();if(d!==i||f!==a)throw Error(`Unexpected ITSF GUIDs: ${d} / ${f}`);let p=n.u64();n.u64();let m=n.u64(),h=n.u64(),g;g=l>=3?n.u64():m+h,n.seek(p),n.u32(),n.u32();let _=n.u64();n.seek(m);let v=r(e,m,4);if(v!==`ITSP`)throw Error(`Expected "ITSP" directory header, got ${JSON.stringify(v)}`);n.seek(m+4),n.u32();let y=n.u32();n.u32();let b=n.u32();n.u32(),n.u32(),n.i32();let x=n.u32(),S=n.u32();n.i32();let C=n.u32();n.u32();let w=n.guid();if(w!==o)throw Error(`Unexpected ITSP GUID: ${w}`);let T=m+y,E=[];for(let t=x;t<=S;t++)t<0||t>=C||c(e,T+t*b,b,E);let D=new Map;for(let e of E)D.set(e.name,e);return{version:l,languageId:u,fileSize:_||e.length,contentOffset:g,chunkSize:b,entries:E,map:D}}function c(e,n,i,a){if(r(e,n,4)!==`PMGL`)return;let o=new t(e,n+4),s=o.u32();o.u32(),o.i32(),o.i32();let c=n+i-s;for(;o.posc)break;let n=r(e,o.pos,t);o.skip(t);let i=o.encint(),s=o.encint(),l=o.encint();a.push({name:n,section:i,offset:s,length:l})}}var l=32768,u=2,d=256,f=7,p=249,m=20,h=8,g=16,_=1,v=2,y=3,b=new Uint8Array(51);for(let e=0,t=0;e<=50;e+=2)b[e]=t,b[e+1]=t,e!==0&&t<17&&t++;var x=new Int32Array(51);for(let e=0,t=0;e<=50;e++)x[e]=t,t+=1<>>0,this.bitsLeft+=16,this.pos+=2}}readBits(e){if(e===0)return 0;this.ensure(e);let t=this.buf>>>32-e;return this.buf=this.buf<>>0,this.bitsLeft-=e,t}readBit(){this.bitsLeft<1&&this.ensure(1);let e=this.buf>>>31;return this.buf=this.buf<<1>>>0,--this.bitsLeft,e}align16(){return this.ensure(16),this.bitsLeft>16&&(this.pos-=2),this.buf=0,this.bitsLeft=0,this.pos}};function T(e,t){let n=new Int32Array(17);for(let r=0;r0&&o0&&o0&&o>>0,e.R1=(n[r+4]|n[r+5]<<8|n[r+6]<<16|n[r+7]<<24)>>>0,e.R2=(n[r+8]|n[r+9]<<8|n[r+10]<<16|n[r+11]<<24)>>>0,t.pos=r+12}else throw Error(`LZX: invalid block type ${e.blockType}`)}let i=Math.min(e.blockRemaining,a-o);if(e.blockType===y){for(let e=0;e0;){let n=E(t,e.mainTree);if(n>3;if(c>2){let n=b[c],r=x[c]-2;e.blockType===v?n>3?(r+=t.readBits(n-3)<<3,r+=E(t,e.alignedTree)):n===3?r+=E(t,e.alignedTree):n>0&&(r+=t.readBits(n)):n>0&&(r+=t.readBits(n)),c=r,e.R2=e.R1,e.R1=e.R0,e.R0=c}else c===0?c=e.R0:c===1?(c=e.R1,e.R1=e.R0,e.R0=c):(c=e.R2,e.R2=e.R0,e.R0=c);let l=o-c;if(l<0)throw Error(`LZX: match references before start of stream`);s>i&&(s=i);for(let e=0;e=32768)return;if(n<=10||!r.intelStarted){r.intelCurpos+=n;return}let i=r.intelCurpos;r.intelCurpos+=n;let a=r.intelFilesize,o=t+n-10,s=t;for(;s=-i&&t=0?t-i:t+a;e[s]=n&255,e[s+1]=n>>8&255,e[s+2]=n>>16&255,e[s+3]=n>>24&255}s+=4,i+=5}}function O(e,t,n,r,i,a,o,s){let c=new Uint8Array(a),l=new ee(S(s)),u=r.length,d=0;for(let s=0;se.length>0||e.name!==`/`&&!e.name.endsWith(`/`)).map(e=>e.name)}getFile(e){let t=M(e),n=this.dir.map.get(t);if(!n)return null;if(n.length===0)return new Uint8Array;if(n.section===0){let e=this.dir.contentOffset+n.offset;return this.bytes.subarray(e,e+n.length)}return this.readCompressed(n.offset,n.length)}_initLzx(){if(this.lzx)return;let e=this.getFile(`::DataSpace/Storage/MSCompressed/ControlData`);if(!e)throw Error(`CHM has compressed content but no ControlData`);let t=k(e),n=null;for(let e of this.dir.entries)if(e.name.includes(`/InstanceData/ResetTable`)||e.name.endsWith(`ResetTable`)){n=this.getFile(e.name);break}if(!n)throw Error(`CHM has compressed content but no ResetTable`);let r=A(n),i=this.dir.map.get(`::DataSpace/Storage/MSCompressed/Content`);if(!i||i.section!==0)throw Error(`CHM MSCompressed Content blob missing`);let a=this.dir.contentOffset+i.offset,o=Math.min(r.compressedLength,i.length);this.lzx={control:t,reset:r,contentStart:a,compressedLength:o}}_decompressAll(){if(this.stream)return this.stream;this._initLzx();let{control:e,reset:t,contentStart:n,compressedLength:r}=this.lzx;return this.stream=O(this.bytes,n,r,t.offsets,e.resetInterval,t.uncompressedLength,t.frameSize,e.windowSize),this.stream}readCompressed(e,t){let n=this._decompressAll(),r=Math.min(e+t,n.length);return n.subarray(e,r)}};function M(e){return!e||e.startsWith(`::`)||e.startsWith(`/`)?e:`/`+e}var N=new TextDecoder(`latin1`);function P(e){let t=e.length;for(;t>0&&e[t-1]===0;)t--;return e.subarray(0,t)}function F(e){return N.decode(P(e))}function I(e){let n={};if(!e||e.length<4)return n;let r=new t(e);for(n.version=r.u32();r.pos+4<=e.length;){let i=r.u16(),a=r.u16();if(r.pos+a>e.length)break;let o=e.subarray(r.pos,r.pos+a);switch(r.skip(a),i){case 0:n.contentsFile=F(o);break;case 1:n.indexFile=F(o);break;case 2:n.defaultTopic=F(o);break;case 3:n.title=F(o),n.titleBytes=P(o);break;case 4:a>=4&&(n.lcid=new t(o).u32());break;case 6:n.compiledFile=F(o);break;case 9:n.compiler=F(o);break;case 16:n.defaultFont=F(o);break;default:break}}return n}function L(e,n){let r={};if(!e||e.length<8)return r;let i=new t(e),a=i.u32(),o=i.u32();if(!a||o<96)return r;let s=e=>{if(!n||e===0||e>=n.length)return;let t=e;for(;t{let r=8+n;return r+4>e.length?0:new t(e,r).u32()};return r.title=s(c(20)),r.contentsFile=s(c(96)),r.indexFile=s(c(100)),r.defaultTopic=s(c(104)),r}var R={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`,nbsp:`\xA0`};function z(e){return e.replace(/&(#x?[0-9a-f]+|[a-z]+);/gi,(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)?String.fromCodePoint(n):e}let n=R[t.toLowerCase()];return n===void 0?e:n})}function B(e){let t={},n=/([a-z0-9_:-]+)\s*=\s*("([^"]*)"|'([^']*)'|([^\s"'>]+))/gi,r;for(;r=n.exec(e);)t[r[1].toLowerCase()]=z(r[3]??r[4]??r[5]??``);return t}function V(e){let t={name:``,children:[]},n=[t],r=null,i=!1,a=``,o=null,s=/<\s*(\/?)\s*(ul|object|param)\b([^>]*)>/gi,c;for(;c=s.exec(e);){let e=c[1]===`/`,t=c[2].toLowerCase(),s=c[3];if(t===`ul`)e?n.length>1&&(r=n.pop()):(n.push(r||n[n.length-1]),r=null);else if(t===`object`)if(!e)a=(B(s).type||``).toLowerCase(),i=a===`text/sitemap`,o={};else{if(i&&o){let e=H(o);e&&(n[n.length-1].children.push(e),r=e)}i=!1,o=null}else if(t===`param`&&i&&o&&!e){let e=B(s);e.name&&(o[e.name.toLowerCase()]=e.value??``)}}return t.children}function H(e){let t=e.name;if(t===void 0&&e.local===void 0&&e.url===void 0)return null;let n={name:t||``,children:[]};return e.local!==void 0&&(n.local=U(e.local)),e.url!==void 0&&(n.url=e.url),e.merge!==void 0&&(n.merge=e.merge),n}function U(e){let t=e.replace(/\\/g,`/`).trim(),n=t.match(/::(.+)$/);return n&&(t=n[1]),t}var W={1:`windows-1256`,2:`windows-1251`,3:`windows-1252`,4:`gbk`,5:`windows-1250`,6:`windows-1252`,7:`windows-1252`,8:`windows-1253`,9:`windows-1252`,10:`windows-1252`,11:`windows-1252`,12:`windows-1252`,13:`windows-1255`,14:`windows-1250`,15:`windows-1252`,16:`windows-1252`,17:`shift_jis`,18:`euc-kr`,19:`windows-1252`,20:`windows-1252`,21:`windows-1250`,22:`windows-1252`,24:`windows-1250`,25:`windows-1251`,26:`windows-1250`,27:`windows-1250`,28:`windows-1250`,29:`windows-1252`,30:`windows-874`,31:`windows-1254`,34:`windows-1251`,36:`windows-1250`,37:`windows-1257`,38:`windows-1257`,39:`windows-1257`,41:`windows-1256`,42:`windows-1258`};function G(e){if(!e)return`windows-1252`;let t=e&1023;if(t===4){let t=e>>10&63;return t===1||t===3?`big5`:`gbk`}return W[t]||`windows-1252`}function K(e){let t=q(e,1024).toLowerCase(),n=t.match(/]+charset\s*=\s*["']?\s*([a-z0-9_\-]+)/i);return n||(n=t.match(/charset\s*=\s*["']?\s*([a-z0-9_\-]+)/i),n)?J(n[1]):null}function q(e,t){let n=Math.min(e.length,t),r=``;for(let t=0;t!e.name.endsWith(`/`)&&!(e.name.startsWith(`::`)&&e.length===0)).map(e=>e.name)}hasFile(e){return this.content.has(e)}getFile(e){return this.content.getFile(e)}getText(e,t){let n=this.getFile(e);return n?X(n,t||this.charset):null}getContents(){return this._contentsTree||(this._contentsTree=this.contentsPath?V(this.getText(this.contentsPath)||``):[]),this._contentsTree}getIndex(){return this._indexTree||(this._indexTree=this.indexPath?V(this.getText(this.indexPath)||``):[]),this._indexTree}resolvePath(e,t){let n=String(t).replace(/\\/g,`/`),r=n.match(/::(.+)$/);if(r&&(n=r[1]),/^[a-z]+:/i.test(n)&&!n.startsWith(`ms-its:`))return n;if(n.startsWith(`/`))return M(Q(n));let i=(e.replace(/\\/g,`/`).replace(/\/[^/]*$/,`/`)+Q(n)).split(`/`),a=[];for(let e of i)e===``||e===`.`||(e===`..`?a.pop():a.push(e));return`/`+a.join(`/`)}};function Q(e){return e.replace(/[#?].*$/,``)}function re(...e){for(let t of e)if(t)return t}function $(e,...t){for(let n of t){if(!n)continue;let t=M(String(n).replace(/\\/g,`/`));if(e.dir.map.has(t))return t}for(let e of t)if(e)return M(String(e).replace(/\\/g,`/`))}Z.prototype._firstByExt=function(e){let t=this.dir.entries.find(t=>t.section>=0&&t.name.toLowerCase().endsWith(e)&&!t.name.startsWith(`::`));return t?t.name:void 0};export{Z as ChmReader}; \ No newline at end of file diff --git a/dist-embed/assets/chm-renderer-C7xAtyOx.js b/dist-embed/assets/chm-renderer-C7xAtyOx.js new file mode 100644 index 0000000..e22b887 --- /dev/null +++ b/dist-embed/assets/chm-renderer-C7xAtyOx.js @@ -0,0 +1 @@ +import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n=null,r=class extends t{constructor(){super(),this._reader=null,this._blobs=null,this._frame=null,this._onFrameClick=this._onFrameClick.bind(this)}async load(t,r,i){await super.load(t,r,i);let[{ChmReader:a},o]=await Promise.all([e(()=>import(`./chm-reader-Bjyc0KjP.js`),[],import.meta.url),e(()=>import(`./render-D6jv0HaF.js`),[],import.meta.url)]);n=o.renderTopic;let s=a.open(t);this._reader=s,this._blobs=new o.BlobCache(s),r.innerHTML=``;let c=document.createElement(`div`);c.className=`doc-page chm-page`,c.dataset.page=1;let l=document.createElement(`iframe`);l.className=`chm-frame`,l.sandbox=`allow-same-origin`,this._frame=l,c.appendChild(l),r.appendChild(c),this._buildContents(s);let u=s.defaultTopic||s.listFiles().find(e=>/\.html?$/i.test(e));u?this._navigate(u):l.srcdoc=`This .chm has no displayable HTML topic.`,this.numPages=1}_navigate(e,t=``){let r=this._reader;if(!r)return;let i=e.indexOf(`#`);if(i>=0&&(t=t||e.slice(i+1),e=e.slice(0,i)),!r.hasFile(e))return;let a=this._frame;a.onload=()=>{let n=a.contentDocument;if(n){if(a.style.height=`${n.documentElement.scrollHeight}px`,n.addEventListener(`click`,this._onFrameClick,!0),t){let e=n.getElementById(t)||n.querySelector(`a[name="${CSS.escape(t)}"]`);e&&e.scrollIntoView({block:`start`})}this._highlightContents(e)}},a.srcdoc=n(r,e,this._blobs)}_onFrameClick(e){let t=e.target.closest?.(`a`);if(!t)return;let n=t.getAttribute(`data-chm-href`),r=t.getAttribute(`data-chm-ext`);n?(e.preventDefault(),this._navigate(n,t.getAttribute(`data-chm-frag`)||``)):r&&(e.preventDefault(),confirm(`Open external link?\n\n${r}`)&&window.open(r,`_blank`,`noopener`))}_buildContents(e){let t=document.getElementById(`thumbsContent`);if(!t)return;let n=e.getContents();if(!n?.length)return;this.buildsThumbnailsAsync=!0,t.innerHTML=``;let r=document.createElement(`div`);r.className=`chm-toc`,this._renderNodes(e,n,r),t.appendChild(r)}_renderNodes(e,t,n){for(let r of t){let t=document.createElement(`div`);t.className=`chm-toc-row`,t.textContent=r.name||`(untitled)`;let i=this._nodeTarget(e,r);if(i&&(t.classList.add(`chm-toc-link`),t.dataset.target=i,t.addEventListener(`click`,()=>this._navigate(i))),n.appendChild(t),r.children?.length){let t=document.createElement(`div`);t.className=`chm-toc-children`,this._renderNodes(e,r.children,t),n.appendChild(t)}}}_nodeTarget(e,t){if(t.url||!t.local)return null;let n=e.resolvePath(e.contentsPath||`/`,t.local).replace(/#.*$/,``);return e.hasFile(n)?n:null}_highlightContents(e){let t=document.getElementById(`thumbsContent`);t&&(t.querySelectorAll(`.chm-toc-active`).forEach(e=>e.classList.remove(`chm-toc-active`)),t.querySelectorAll(`.chm-toc-row[data-target="${CSS.escape(e)}"]`).forEach(e=>e.classList.add(`chm-toc-active`)))}destroy(){this._blobs?.revokeAll(),this._blobs=null,this._reader=null,this._frame=null;let e=document.getElementById(`thumbsContent`);e&&(e.innerHTML=``),super.destroy()}};export{r as CHMRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/classPrivateFieldSet2-CUhwy2NK.js b/dist-embed/assets/classPrivateFieldSet2-CUhwy2NK.js new file mode 100644 index 0000000..660bccb --- /dev/null +++ b/dist-embed/assets/classPrivateFieldSet2-CUhwy2NK.js @@ -0,0 +1 @@ +function e(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function t(t,n){e(t,n),n.add(t)}function n(t,n,r){e(t,n),n.set(t,r)}function r(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function i(e,t){return e.get(r(e,t))}function a(e,t,n){return e.set(r(e,t),n),n}export{t as a,n as i,i as n,r,a as t}; \ No newline at end of file diff --git a/dist-embed/assets/code-renderer-CXvWkmtj.js b/dist-embed/assets/code-renderer-CXvWkmtj.js new file mode 100644 index 0000000..c997214 --- /dev/null +++ b/dist-embed/assets/code-renderer-CXvWkmtj.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./common-D7sP-4Y_.js","./rolldown-runtime-DAXXjFlN.js","./github-DdKuH37F.css"])))=>i.map(i=>d[i]); +import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n={js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,json:`json`,jsonc:`json`,xml:`xml`,html:`xml`,htm:`xml`,yaml:`yaml`,yml:`yaml`,css:`css`,scss:`scss`,less:`less`,py:`python`,java:`java`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,hpp:`cpp`,cs:`csharp`,go:`go`,rs:`rust`,rb:`ruby`,php:`php`,sh:`bash`,bash:`bash`,sql:`sql`,kt:`kotlin`,swift:`swift`,toml:`ini`,ini:`ini`,diff:`diff`},r=class extends t{async load(t,r,i){await super.load(t,r,i);let a=(await e(async()=>{let{default:e}=await import(`./common-D7sP-4Y_.js`);return{default:e}},__vite__mapDeps([0,1]),import.meta.url)).default;await e(()=>Promise.resolve({}),__vite__mapDeps([2]),import.meta.url);let o=new TextDecoder(`utf-8`).decode(t),s=n[(i?.currentFileName||``).split(`.`).pop().toLowerCase()];if(s===`json`)try{o=JSON.stringify(JSON.parse(o),null,2)}catch{}let c=s&&a.getLanguage(s)?a.highlight(o,{language:s}):a.highlightAuto(o);r.innerHTML=``;let l=document.createElement(`div`);l.className=`doc-page`,l.dataset.page=1;let u=document.createElement(`pre`);u.className=`code-content`;let d=document.createElement(`code`);d.className=`hljs`,d.innerHTML=c.value,u.appendChild(d),l.appendChild(u),r.appendChild(l),this.numPages=1}};export{r as CodeRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/comic-book-Bc_1EzdL.js b/dist-embed/assets/comic-book-Bc_1EzdL.js new file mode 100644 index 0000000..cb997a4 --- /dev/null +++ b/dist-embed/assets/comic-book-Bc_1EzdL.js @@ -0,0 +1 @@ +var e=({entries:e,loadBlob:t,getSize:n},r)=>{let i=new Map,a=new Map,o=async e=>{if(i.has(e))return i.get(e);let n=URL.createObjectURL(await t(e)),r=URL.createObjectURL(new Blob([``],{type:`text/html`}));return a.set(e,[n,r]),i.set(e,r),r},s=e=>{a.get(e)?.forEach?.(e=>URL.revokeObjectURL(e)),a.delete(e),i.delete(e)},c=[`.jpg`,`.jpeg`,`.png`,`.gif`,`.bmp`,`.webp`,`.svg`,`.jxl`,`.avif`],l=e.map(e=>e.filename).filter(e=>c.some(t=>e.endsWith(t))).sort(new Intl.Collator([],{numeric:!0}).compare);if(!l.length)throw Error(`No supported image files in archive`);let u={};return u.getCover=()=>t(l[0]),u.metadata={title:r.name},u.sections=l.map(e=>({id:e,load:()=>o(e),unload:()=>s(e),size:n(e)})),u.toc=l.map(e=>({label:e,href:e})),u.rendition={layout:`pre-paginated`},u.resolveHref=e=>({index:u.sections.findIndex(t=>t.id===e)}),u.splitTOCHref=e=>[e,null],u.getTOCFragment=e=>e.documentElement,u.destroy=()=>{for(let e of a.values())for(let t of e)URL.revokeObjectURL(t)},u};export{e as makeComicBook}; \ No newline at end of file diff --git a/dist-embed/assets/comic-renderer-glidoIQE.js b/dist-embed/assets/comic-renderer-glidoIQE.js new file mode 100644 index 0000000..aa536b6 --- /dev/null +++ b/dist-embed/assets/comic-renderer-glidoIQE.js @@ -0,0 +1 @@ +import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./reader-Bd1ccloG.js";import{t as n}from"./jszip.min-C__FR9jF.js";import{t as r}from"./base-renderer-DM6Nw1yD.js";var i=e(n()),a=/\.(jpe?g|png|gif|webp|bmp|avif)$/i,o={jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`,avif:`image/avif`};function s(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}var c=class extends r{constructor(){super(),this._imgUrls=[],this._observer=null,this._naturalW=0,this._naturalH=0,this.defaultScaleOption=`page-height`}async load(e,t,n){await super.load(e,t,n);let r=await this._extract(e);if(!r.length)throw Error(`No images found in comic archive`);t.innerHTML=``;for(let[e,n]of r.entries()){let r=document.createElement(`div`);r.className=`comic-page`,r.dataset.page=e+1;let i=document.createElement(`img`);i.src=n.url,i.alt=n.name,i.loading=`lazy`,i.draggable=!1,r.appendChild(i),t.appendChild(r)}this.numPages=r.length,await this._measureFirst(r[0].url),this.setScale(this.scale),this._attachScrollObserver(),this._buildThumbnails(r)}async _extract(e){let t=new Uint8Array(e.slice(0,4));return t[0]===80&&t[1]===75?this._extractZip(e):this._extractArchive(e)}async _extractZip(e){let t=await i.default.loadAsync(e),n=[];t.forEach((e,t)=>{!t.dir&&a.test(e)&&n.push({path:e,file:t})}),n.sort((e,t)=>s(e.path,t.path));let r=[];for(let{path:e,file:t}of n){let n=await t.async(`uint8array`);r.push({name:e,url:this._toUrl(n,e)})}return r}async _extractArchive(e){let{Archive:n}=await t(async()=>{let{Archive:e}=await import(`./libarchive-Dhbbd3NZ.js`);return{Archive:e}},[],import.meta.url);n.init({workerUrl:`./libarchive/worker-bundle.js`});let r=await n.open(new Blob([e])),i=(await r.getFilesArray()).filter(e=>a.test(e.file.name)).sort((e,t)=>s((e.path||``)+e.file.name,(t.path||``)+t.file.name)),o=[];for(let e of i){let t=await e.file.extract(),n=new Uint8Array(await t.arrayBuffer());o.push({name:e.file.name,url:this._toUrl(n,e.file.name)})}return await r.close?.(),o}_toUrl(e,t){let n=o[t.split(`.`).pop().toLowerCase()]??`application/octet-stream`,r=URL.createObjectURL(new Blob([e],{type:n}));return this._imgUrls.push(r),r}_measureFirst(e){return new Promise(t=>{let n=new Image;n.onload=()=>{this._naturalW=n.naturalWidth,this._naturalH=n.naturalHeight,t()},n.onerror=()=>t(),n.src=e})}setScale(e){if(this.scale=e,!this._naturalW)return;let t=Math.round(this._naturalW*e);this.container?.querySelectorAll(`.comic-page`).forEach(e=>{e.style.width=`${t}px`})}getPageWidth(){return this._naturalW||null}getPageHeight(){return this._naturalH||null}_attachScrollObserver(){this._observer&&this._observer.disconnect();let e=this.container.parentElement;this._observer=new IntersectionObserver(e=>{let t={ratio:0,page:this.viewer?.currentPage||1};e.forEach(e=>{e.intersectionRatio>t.ratio&&(t={ratio:e.intersectionRatio,page:+e.target.dataset.page})}),t.ratio>0&&this.viewer&&t.page!==this.viewer.currentPage&&(this.viewer.currentPage=t.page,this.viewer.updatePageInfo(),this._highlightThumb(t.page))},{threshold:[0,.25,.5,.75,1],root:e}),this.container.querySelectorAll(`.comic-page`).forEach(e=>this._observer.observe(e))}_buildThumbnails(e){let t=document.getElementById(`thumbsContent`);t&&(t.innerHTML=``,e.forEach((e,n)=>{let r=document.createElement(`div`);r.className=`thumb`,r.dataset.thumbPage=n+1,r.title=`Page ${n+1}`;let i=document.createElement(`img`);i.src=e.url,i.loading=`lazy`;let a=document.createElement(`div`);a.className=`thumb-label`,a.textContent=n+1,r.appendChild(i),r.appendChild(a),r.addEventListener(`click`,()=>this.viewer?.goToPage(n+1)),t.appendChild(r)}))}_highlightThumb(e){document.querySelectorAll(`.thumb`).forEach(t=>{t.classList.toggle(`active`,+t.dataset.thumbPage===e)})}scrollToPage(e){let t=this.container?.querySelector(`.comic-page[data-page="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}destroy(){this._observer?.disconnect(),this._observer=null,this._imgUrls.forEach(e=>URL.revokeObjectURL(e)),this._imgUrls=[],super.destroy()}};export{c as ComicRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/common-D7sP-4Y_.js b/dist-embed/assets/common-D7sP-4Y_.js new file mode 100644 index 0000000..7bd2ca3 --- /dev/null +++ b/dist-embed/assets/common-D7sP-4Y_.js @@ -0,0 +1,5 @@ +import{o as e,t}from"./rolldown-runtime-DAXXjFlN.js";var n=t(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=``,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=``}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),z=I(`#`,`$`),B=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:z,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function V(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function ee(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function H(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=V,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function W(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function G(e,t){e.relevance===void 0&&(e.relevance=1)}var K=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},q=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],te=`keyword`;function J(e,t,n=te){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,J(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,Y(n[0],n[1])]})}}function Y(e,t){return t?Number(t):+!ne(e)}function ne(e){return q.includes(e.toLowerCase())}var re={},X=e=>{console.error(e)},ie=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Z=(e,t)=>{re[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),re[`${e}/${t}`]=!0)},Q=Error();function ae(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function oe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw X(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),Q;if(typeof e.beginScope!=`object`||e.beginScope===null)throw X(`beginScope must be object`),Q;ae(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function se(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw X(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),Q;if(typeof e.endScope!=`object`||e.endScope===null)throw X(`endScope must be object`),Q;ae(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function ce(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function le(e){ce(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),oe(e),se(e)}function ue(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[ee,W,le,K].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[H,U,G].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s=s||/\w+/,n.keywords&&(n.keywords=J(n.keywords,e.case_insensitive)),a.keywordPatternRe=t(s,!0),r&&(n.begin||(n.begin=/\B|\b/),a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||(n.contains=[]),n.contains=[].concat(...n.contains.map(function(e){return fe(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function de(e){return e?e.endsWithParent||de(e.starts):!1}function fe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:de(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var pe=`11.11.1`,me=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},he=i,ge=a,_e=Symbol(`nomatch`),ve=7,ye=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(ie(s.replace(`{}`,n[1])),ie(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(Z(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),Z(`10.7.0`,`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};z(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,z(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=ve&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return _e;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||``)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==_e)return e}if(r.type===`illegal`&&a===``)return P+=` +`,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw X(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=ue(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:he(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:he(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:he(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(z(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new me(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),z(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=ge(l,e)}let E=()=>{k(),Z(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),Z(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(X(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)X(e);else throw e;i=c}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function z(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function V(e){return Z(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),Z(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:V,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:ge,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=pe,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in B)typeof B[e]==`object`&&n(B[e]);return Object.assign(e,B),e},$=ye({});$.newInstance=()=>ye({}),t.exports=$,$.HighlightJS=$,$.default=$})),r=t(((e,t)=>{function n(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin://,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin://,contains:[a,o,c,s]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}t.exports=n})),i=t(((e,t)=>{function n(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}t.exports=n})),a=t(((e,t)=>{function n(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,variants:[{begin:`\\b[a-z\\d_]*_t\\b`},{match:/\batomic_[a-z]{3,6}\b/}]},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d={keyword:`asm.auto.break.case.continue.default.do.else.enum.extern.for.fortran.goto.if.inline.register.restrict.return.sizeof.typeof.typeof_unqual.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local.alignas.alignof.noreturn.static_assert.thread_local._Pragma`.split(`.`),type:`float.double.signed.unsigned.int.short.long.char.void._Bool._BitInt._Complex._Imaginary._Decimal32._Decimal64._Decimal96._Decimal128._Decimal64x._Decimal128x._Float16._Float32._Float64._Float128._Float32x._Float64x._Float128x.const.static.constexpr.complex.bool.imaginary`.split(`.`),literal:`true false NULL`,built_in:`std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr`},f=[c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],p={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:d,contains:f.concat([{begin:/\(/,end:/\)/,keywords:d,contains:f.concat([`self`]),relevance:0}]),relevance:0},m={begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:d,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:d,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(l,{className:`title.function`})],relevance:0},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C`,aliases:[`h`],keywords:d,disableAutodetect:!0,illegal:`=]/,contains:[{beginKeywords:`final class struct`},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:o,keywords:d}}}t.exports=n})),o=t(((e,t)=>{function n(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:``,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}t.exports=n})),s=t(((e,t)=>{function n(e){let t=[`bool`,`byte`,`char`,`decimal`,`delegate`,`double`,`dynamic`,`enum`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`ulong`,`uint`,`ushort`],n=[`public`,`private`,`protected`,`static`,`internal`,`protected`,`abstract`,`async`,`extern`,`override`,`unsafe`,`virtual`,`new`,`sealed`,`partial`],r={keyword:`abstract.as.base.break.case.catch.class.const.continue.do.else.event.explicit.extern.finally.fixed.for.foreach.goto.if.implicit.in.interface.internal.is.lock.namespace.new.operator.out.override.params.private.protected.public.readonly.record.ref.return.scoped.sealed.sizeof.stackalloc.static.struct.switch.this.throw.try.typeof.unchecked.unsafe.using.virtual.void.volatile.while`.split(`.`).concat(`add.alias.and.ascending.args.async.await.by.descending.dynamic.equals.file.from.get.global.group.init.into.join.let.nameof.not.notnull.on.or.orderby.partial.record.remove.required.scoped.select.set.unmanaged.value|0.var.when.where.with.yield`.split(`.`)),built_in:t,literal:[`default`,`false`,`null`,`true`]},i=e.inherit(e.TITLE_MODE,{begin:`[a-zA-Z](\\.?\\w)*`}),a={className:`number`,variants:[{begin:`\\b(0b[01']+)`},{begin:`(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)`},{begin:`(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)`}],relevance:0},o={className:`string`,begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},s={className:`string`,begin:`@"`,end:`"`,contains:[{begin:`""`}]},c=e.inherit(s,{illegal:/\n/}),l={className:`subst`,begin:/\{/,end:/\}/,keywords:r},u=e.inherit(l,{illegal:/\n/}),d={className:`string`,begin:/\$"/,end:`"`,illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,u]},f={className:`string`,begin:/\$@"/,end:`"`,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},l]},p=e.inherit(f,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},u]});l.contains=[f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],u.contains=[p,d,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let m={variants:[o,f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h={begin:`<`,end:`>`,contains:[{beginKeywords:`in out`},i]},g=e.IDENT_RE+`(<`+e.IDENT_RE+`(\\s*,\\s*`+e.IDENT_RE+`)*>)?(\\[\\])?`,_={begin:`@`+e.IDENT_RE,relevance:0};return{name:`C#`,aliases:[`cs`,`c#`],keywords:r,illegal:/::/,contains:[e.COMMENT(`///`,`$`,{returnBegin:!0,contains:[{className:`doctag`,variants:[{begin:`///`,relevance:0},{begin:``},{begin:``}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`meta`,begin:`#`,end:`$`,keywords:{keyword:`if else elif endif define undef warning error line region endregion pragma checksum`}},m,a,{beginKeywords:`class interface`,relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:`where class`},i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`namespace`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`record`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`meta`,begin:`^\\s*\\[(?=[\\w])`,excludeBegin:!0,end:`\\]`,excludeEnd:!0,contains:[{className:`string`,begin:/"/,end:/"/}]},{beginKeywords:`new return throw await else`,relevance:0},{className:`function`,begin:`(`+g+`\\s+)+`+e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:r,contains:[{beginKeywords:n.join(` `),relevance:0},{begin:e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,contains:[e.TITLE_MODE,h],relevance:0},{match:/\(\)/},{className:`params`,begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,relevance:0,contains:[m,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}t.exports=n})),c=t(((e,t)=>{var n=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),i=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),a=[...r,...i],o=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),s=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),c=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),l=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function u(e){let t=e.regex,r=n(e),i={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},u=/@-?\w[\w]*(-\w+)*/,d=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[r.BLOCK_COMMENT,i,r.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+s.join(`|`)+`)`},{begin:`:(:)?(`+c.join(`|`)+`)`}]},r.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+l.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,...d,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...d,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:u},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:o.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...d,r.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+a.join(`|`)+`)\\b`}]}}t.exports=u})),l=t(((e,t)=>{function n(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}t.exports=n})),u=t(((e,t)=>{function n(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}t.exports=n})),d=t(((e,t)=>{function n(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:`alias.and.begin.BEGIN.break.case.class.defined.do.else.elsif.end.END.ensure.for.if.in.module.next.not.or.redo.require.rescue.retry.return.then.undef.unless.until.when.while.yield.include.extend.prepend.public.private.protected.raise.throw`.split(`.`),built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},o={className:`doctag`,begin:`@[A-Za-z]+`},s={begin:`#<`,end:`>`},c=[e.COMMENT(`#`,`$`,{contains:[o]}),e.COMMENT(`^=begin`,`^=end`,{contains:[o],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],l={className:`subst`,begin:/#\{/,end:/\}/,keywords:a},u={className:`string`,contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},d=`[0-9](_?[0-9])*`,f={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},p={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},m=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},{relevance:0,match:r,scope:`title.class`},{match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[p]},{begin:e.IDENT_RE+`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[u,{begin:n}],relevance:0},f,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(s,c),relevance:0}].concat(s,c);l.contains=m,p.contains=m;let h=[{begin:/^\s*=>/,starts:{end:`$`,contains:m}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:a,contains:m}}];return c.unshift(s),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(h,c,m)}}t.exports=n})),f=t(((e,t)=>{function n(e){let t={keyword:[`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`],type:[`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int8`,`int16`,`int32`,`int64`,`string`,`uint8`,`uint16`,`uint32`,`uint64`,`int`,`uint`,`uintptr`,`rune`],literal:[`true`,`false`,`iota`,`nil`],built_in:[`append`,`cap`,`close`,`complex`,`copy`,`imag`,`len`,`make`,`new`,`panic`,`print`,`println`,`real`,`recover`,`delete`]};return{name:`Go`,aliases:[`golang`],keywords:t,illegal:`{function n(e){let t=e.regex;return{name:`GraphQL`,aliases:[`gql`],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:[`query`,`mutation`,`subscription`,`type`,`input`,`schema`,`directive`,`interface`,`union`,`scalar`,`fragment`,`enum`,`on`],literal:[`true`,`false`,`null`]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:`punctuation`,match:/[.]{3}/,relevance:0},{scope:`punctuation`,begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:`variable`,begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:`meta`,match:/@\w+/,excludeEnd:!0},{scope:`symbol`,begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}t.exports=n})),m=t(((e,t)=>{function n(e){let t=e.regex,n={className:`number`,relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:`variable`,variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},a={className:`literal`,begin:/\bon|off|true|false|yes|no\b/},o={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:`'''`,end:`'''`,relevance:10},{begin:`"""`,end:`"""`,relevance:10},{begin:`"`,end:`"`},{begin:`'`,end:`'`}]},s={begin:/\[/,end:/\]/,contains:[r,a,i,o,n,`self`],relevance:0},c=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:`TOML, also INI`,aliases:[`toml`],case_insensitive:!0,illegal:/\S/,contains:[r,{className:`section`,begin:/\[+/,end:/\]+/},{begin:t.concat(c,`(\\s*\\.\\s*`,c,`)*`,t.lookahead(/\s*=\s*[^#\s]/)),className:`attr`,starts:{end:/$/,contains:[r,s,a,i,o,n]}}]}}t.exports=n})),h=t(((e,t)=>{var n=`[0-9](_*[0-9])*`,r=`\\.(${n})`,i=`[0-9a-fA-F](_*[0-9a-fA-F])*`,a={className:`number`,variants:[{begin:`(\\b(${n})((${r})|\\.)?|(${r}))[eE][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(${n})((${r})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${r})[fFdD]?\\b`},{begin:`\\b(${n})[fFdD]\\b`},{begin:`\\b0[xX]((${i})\\.?|(${i})?\\.(${i}))[pP][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${i})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function o(e,t,n){return n===-1?``:e.replace(t,r=>o(e,t,n-1))}function s(e){let t=e.regex,n=`[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,r=n+o(`(?:<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~(?:\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~)*>)?`,/~~~/g,2),i={keyword:`synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when`.split(`.`),literal:[`false`,`true`,`null`],type:[`char`,`boolean`,`long`,`float`,`int`,`byte`,`short`,`double`],built_in:[`super`,`this`]},s={className:`meta`,begin:`@[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,contains:[{begin:/\(/,end:/\)/,contains:[`self`]}]},c={className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:`Java`,aliases:[`jsp`],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:`doctag`,begin:`@[A-Za-z]+`}]}),{begin:/import java\.[a-z]+\./,keywords:`import`,relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:`string`,contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:`keyword`,3:`title.class`}},{match:/non-sealed/,scope:`keyword`},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:`type`,3:`variable`,5:`operator`}},{begin:[/record/,/\s+/,n],className:{1:`keyword`,3:`title.class`},contains:[c,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`new throw return else`,relevance:0},{begin:[`(?:`+r+`\\s+)`,e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:`title.function`},keywords:i,contains:[{className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},a,s]}}t.exports=s})),g=t(((e,t)=>{var n=`[A-Za-z$_][0-9A-Za-z$_]*`,r=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),i=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],a=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),o=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],s=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],c=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],l=[].concat(s,a,o);function u(e){let t=e.regex,u=(e,{after:t})=>{let n=``,end:``},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let n=e[0].length+e.index,r=e.input[n];if(r===`<`||r===`,`){t.ignoreMatch();return}r===`>`&&(u(e,{after:n})||t.ignoreMatch());let i,a=e.input.substring(n);if(i=a.match(/^\s*=/)){t.ignoreMatch();return}if((i=a.match(/^\s+extends\s+/))&&i.index===0){t.ignoreMatch();return}}},h={$pattern:n,keyword:r,literal:i,built_in:l,"variable.language":c},g=`[0-9](_?[0-9])*`,_=`\\.(${g})`,v=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,y={className:`number`,variants:[{begin:`(\\b(${v})((${_})|\\.)?|(${_}))[eE][+-]?(${g})\\b`},{begin:`\\b(${v})\\b((${_})\\b|\\.)?|(${_})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},b={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:h,contains:[]},x={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`xml`}},S={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`css`}},C={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`graphql`}},w={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},T={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,{match:/\$\d+/},y];b.contains=E.concat({begin:/\{/,end:/\}/,keywords:h,contains:[`self`].concat(E)});let D=[].concat(T,b.contains),O=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:[`self`].concat(D)}]),k={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},A={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,t.concat(d,`(`,t.concat(/\./,d),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,d],scope:{1:`keyword`,3:`title.class`}}]},j={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...a,...o]}},M={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[k],illegal:/%/},P={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function F(e){return t.concat(`(?!`,e.join(`|`),`)`)}let I={match:t.concat(/\b/,F([...s,`super`,`import`].map(e=>`${e}\\s*\\(`)),d,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},R={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},k]},z=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,B={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(z)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[k]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:j},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,T,{match:/\$\d+/},y,j,{scope:`attr`,match:d+t.lookahead(`:`),relevance:0},B,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[T,e.REGEXP_MODE,{className:`function`,begin:z,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:f.begin,end:f.end},{match:p},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:`xml`,contains:[{begin:m.begin,end:m.end,skip:!0,contains:[`self`]}]}]},N,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[k,e.inherit(e.TITLE_MODE,{begin:d,className:`title.function`})]},{match:/\.\.\./,relevance:0},L,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[k]},I,P,A,R,{match:/\$[(.]/}]}}t.exports=u})),_=t(((e,t)=>{function n(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}t.exports=n})),v=t(((e,t)=>{var n=`[0-9](_*[0-9])*`,r=`\\.(${n})`,i=`[0-9a-fA-F](_*[0-9a-fA-F])*`,a={className:`number`,variants:[{begin:`(\\b(${n})((${r})|\\.)?|(${r}))[eE][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(${n})((${r})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${r})[fFdD]?\\b`},{begin:`\\b(${n})[fFdD]\\b`},{begin:`\\b0[xX]((${i})\\.?|(${i})?\\.(${i}))[pP][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${i})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function o(e){let t={keyword:`abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual`,built_in:`Byte Short Char Int Long Boolean Float Double Void Unit Nothing`,literal:`true false null`},n={className:`keyword`,begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:`symbol`,begin:/@\w+/}]}},r={className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`@`},i={className:`subst`,begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},o={className:`variable`,begin:`\\$`+e.UNDERSCORE_IDENT_RE},s={className:`string`,variants:[{begin:`"""`,end:`"""(?=[^"])`,contains:[o,i]},{begin:`'`,end:`'`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(s);let c={className:`meta`,begin:`@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*`+e.UNDERSCORE_IDENT_RE+`)?`},l={className:`meta`,begin:`@`+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(s,{className:`string`}),`self`]}]},u=a,d=e.COMMENT(`/\\*`,`\\*/`,{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:`type`,begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},p=f;return p.variants[1].contains=[f],f.variants[1].contains=[p],{name:`Kotlin`,aliases:[`kt`,`kts`],keywords:t,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`}]}),e.C_LINE_COMMENT_MODE,d,n,r,c,l,{className:`function`,beginKeywords:`fun`,end:`[(]|$`,returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+`\\s*\\(`,returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:`type`,begin://,keywords:`reified`,relevance:0},{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,c,l,s,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:`title.class`},keywords:`class interface trait`,end:/[:\{(]|$/,excludeEnd:!0,illegal:`extends implements`,contains:[{beginKeywords:`public protected internal private constructor`},e.UNDERSCORE_TITLE_MODE,{className:`type`,begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},c,l]},s,{className:`meta`,begin:`^#!/usr/bin/env`,end:`$`,illegal:` +`},u]}}t.exports=o})),y=t(((e,t)=>{var n=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),i=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),a=[...r,...i],o=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),s=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),c=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),l=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse(),u=s.concat(c).sort().reverse();function d(e){let t=n(e),r=u,i=`([\\w-]+|@\\{[\\w-]+\\})`,d=[],f=[],p=function(e){return{className:`string`,begin:`~?`+e+`.*?`+e}},m=function(e,t,n){return{className:e,begin:t,relevance:n}},h={$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:o.join(` `)},g={begin:`\\(`,end:`\\)`,contains:f,keywords:h,relevance:0};f.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p(`'`),p(`"`),t.CSS_NUMBER_MODE,{begin:`(url|data-uri)\\(`,starts:{className:`string`,end:`[\\)\\n]`,excludeEnd:!0}},t.HEXCOLOR,g,m(`variable`,`@@?[\\w-]+`,10),m(`variable`,`@\\{[\\w-]+\\}`),m(`built_in`,"~?`[^`]*?`"),{className:`attribute`,begin:`[\\w-]+\\s*:`,end:`:`,returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:`and not`},t.FUNCTION_DISPATCH);let _=f.concat({begin:/\{/,end:/\}/,contains:d}),v={beginKeywords:`when`,endsWithParent:!0,contains:[{beginKeywords:`and not`}].concat(f)},y={begin:`([\\w-]+|@\\{[\\w-]+\\})\\s*:`,returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+l.join(`|`)+`)\\b`,end:/(?=:)/,starts:{endsWithParent:!0,illegal:`[<=$]`,relevance:0,contains:f}}]},b={className:`keyword`,begin:`@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b`,starts:{end:`[;{}]`,keywords:h,returnEnd:!0,contains:f,relevance:0}},x={className:`variable`,variants:[{begin:`@[\\w-]+\\s*:`,relevance:15},{begin:`@[\\w-]+`}],starts:{end:`[;}]`,returnEnd:!0,contains:_}},S={variants:[{begin:`[\\.#:&\\[>]`,end:`[;{}]`},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,v,m(`keyword`,`all\\b`),m(`variable`,`@\\{[\\w-]+\\}`),{begin:`\\b(`+a.join(`|`)+`)\\b`,className:`selector-tag`},t.CSS_NUMBER_MODE,m(`selector-tag`,i,0),m(`selector-id`,`#([\\w-]+|@\\{[\\w-]+\\})`),m(`selector-class`,`\\.([\\w-]+|@\\{[\\w-]+\\})`,0),m(`selector-tag`,`&`,0),t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,begin:`:(`+s.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+c.join(`|`)+`)`},{begin:/\(/,end:/\)/,relevance:0,contains:_},{begin:`!important`},t.FUNCTION_DISPATCH]},C={begin:`[\\w-]+:(:)?(${r.join(`|`)})`,returnBegin:!0,contains:[S]};return d.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,x,C,y,S,v,t.FUNCTION_DISPATCH),{name:`Less`,case_insensitive:!0,illegal:`[=>'/<($"]`,contains:d}}t.exports=d})),b=t(((e,t)=>{function n(e){let t=`\\[=*\\[`,n=`\\]=*\\]`,r={begin:t,end:n,contains:[`self`]},i=[e.COMMENT(`--(?!\\[=*\\[)`,`$`),e.COMMENT(`--\\[=*\\[`,n,{contains:[r],relevance:10})];return{name:`Lua`,aliases:[`pluto`],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:`true false nil`,keyword:`and break do else elseif end for goto if in local not or repeat return then until while`,built_in:`_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove`},contains:i.concat([{className:`function`,beginKeywords:`function`,end:`\\)`,contains:[e.inherit(e.TITLE_MODE,{begin:`([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*`}),{className:`params`,begin:`\\(`,endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:`string`,begin:t,end:n,contains:[r],relevance:5}])}}t.exports=n})),x=t(((e,t)=>{function n(e){let t={className:`variable`,variants:[{begin:`\\$\\(`+e.UNDERSCORE_IDENT_RE+`\\)`,contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%{function n(e){let t=e.regex,n=`abs.accept.alarm.and.atan2.bind.binmode.bless.break.caller.chdir.chmod.chomp.chop.chown.chr.chroot.class.close.closedir.connect.continue.cos.crypt.dbmclose.dbmopen.defined.delete.die.do.dump.each.else.elsif.endgrent.endhostent.endnetent.endprotoent.endpwent.endservent.eof.eval.exec.exists.exit.exp.fcntl.field.fileno.flock.for.foreach.fork.format.formline.getc.getgrent.getgrgid.getgrnam.gethostbyaddr.gethostbyname.gethostent.getlogin.getnetbyaddr.getnetbyname.getnetent.getpeername.getpgrp.getpriority.getprotobyname.getprotobynumber.getprotoent.getpwent.getpwnam.getpwuid.getservbyname.getservbyport.getservent.getsockname.getsockopt.given.glob.gmtime.goto.grep.gt.hex.if.index.int.ioctl.join.keys.kill.last.lc.lcfirst.length.link.listen.local.localtime.log.lstat.lt.ma.map.method.mkdir.msgctl.msgget.msgrcv.msgsnd.my.ne.next.no.not.oct.open.opendir.or.ord.our.pack.package.pipe.pop.pos.print.printf.prototype.push.q|0.qq.quotemeta.qw.qx.rand.read.readdir.readline.readlink.readpipe.recv.redo.ref.rename.require.reset.return.reverse.rewinddir.rindex.rmdir.say.scalar.seek.seekdir.select.semctl.semget.semop.send.setgrent.sethostent.setnetent.setpgrp.setpriority.setprotoent.setpwent.setservent.setsockopt.shift.shmctl.shmget.shmread.shmwrite.shutdown.sin.sleep.socket.socketpair.sort.splice.split.sprintf.sqrt.srand.stat.state.study.sub.substr.symlink.syscall.sysopen.sysread.sysseek.system.syswrite.tell.telldir.tie.tied.time.times.tr.truncate.uc.ucfirst.umask.undef.unless.unlink.unpack.unshift.untie.until.use.utime.values.vec.wait.waitpid.wantarray.warn.when.while.write.x|0.xor.y|0`.split(`.`),r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(` `)},a={className:`subst`,begin:`[$@]\\{`,end:`\\}`,keywords:i},o={begin:/->\{/,end:/\}/},s={scope:`attr`,match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:`variable`,variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,`(?![A-Za-z])(?![@$%])`)},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:`number`,variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,a,c],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(e,n,i=`\\1`)=>{let a=i===`\\1`?i:t.concat(i,n);return t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,i,r)},p=(e,n,i)=>t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,i,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:`string`,contains:u,variants:[{begin:`q[qwxr]?\\s*\\(`,end:`\\)`,relevance:5},{begin:`q[qwxr]?\\s*\\[`,end:`\\]`,relevance:5},{begin:`q[qwxr]?\\s*\\{`,end:`\\}`,relevance:5},{begin:`q[qwxr]?\\s*\\|`,end:`\\|`,relevance:5},{begin:`q[qwxr]?\\s*<`,end:`>`,relevance:5},{begin:`qw\\s+q`,end:`q`,relevance:5},{begin:`'`,end:`'`,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:`-?\\w+\\s*=>`,relevance:0}]},l,{begin:`(\\/\\/|`+e.RE_STARTERS_RE+`|\\b(split|return|print|reverse|grep)\\b)\\s*`,keywords:`split return print reverse grep`,relevance:0,contains:[e.HASH_COMMENT_MODE,{className:`regexp`,variants:[{begin:f(`s|tr|y`,t.either(...d,{capture:!0}))},{begin:f(`s|tr|y`,`\\(`,`\\)`)},{begin:f(`s|tr|y`,`\\[`,`\\]`)},{begin:f(`s|tr|y`,`\\{`,`\\}`)}],relevance:2},{className:`regexp`,variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p(`(?:m|qr)?`,/\//,/\//)},{begin:p(`m|qr`,t.either(...d,{capture:!0}),/\1/)},{begin:p(`m|qr`,/\(/,/\)/)},{begin:p(`m|qr`,/\[/,/\]/)},{begin:p(`m|qr`,/\{/,/\}/)}]}]},{className:`function`,beginKeywords:`sub method`,end:`(\\s*\\(.*?\\))?[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:`class`,beginKeywords:`class`,end:`[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:`-\\w\\b`,relevance:0},{begin:`^__DATA__$`,end:`^__END__$`,subLanguage:`mojolicious`,contains:[{begin:`^@@.*`,end:`$`,className:`comment`}]}];return a.contains=m,o.contains=m,{name:`Perl`,aliases:[`pl`,`pm`],keywords:i,contains:m}}t.exports=n})),C=t(((e,t)=>{function n(e){let t={className:`built_in`,begin:`\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+`},n=/[a-zA-Z@][a-zA-Z0-9_]*/,r={"variable.language":[`this`,`super`],$pattern:n,keyword:`while.export.sizeof.typedef.const.struct.for.union.volatile.static.mutable.if.do.return.goto.enum.else.break.extern.asm.case.default.register.explicit.typename.switch.continue.inline.readonly.assign.readwrite.self.@synchronized.id.typeof.nonatomic.IBOutlet.IBAction.strong.weak.copy.in.out.inout.bycopy.byref.oneway.__strong.__weak.__block.__autoreleasing.@private.@protected.@public.@try.@property.@end.@throw.@catch.@finally.@autoreleasepool.@synthesize.@dynamic.@selector.@optional.@required.@encode.@package.@import.@defs.@compatibility_alias.__bridge.__bridge_transfer.__bridge_retained.__bridge_retain.__covariant.__contravariant.__kindof._Nonnull._Nullable._Null_unspecified.__FUNCTION__.__PRETTY_FUNCTION__.__attribute__.getter.setter.retain.unsafe_unretained.nonnull.nullable.null_unspecified.null_resettable.class.instancetype.NS_DESIGNATED_INITIALIZER.NS_UNAVAILABLE.NS_REQUIRES_SUPER.NS_RETURNS_INNER_POINTER.NS_INLINE.NS_AVAILABLE.NS_DEPRECATED.NS_ENUM.NS_OPTIONS.NS_SWIFT_UNAVAILABLE.NS_ASSUME_NONNULL_BEGIN.NS_ASSUME_NONNULL_END.NS_REFINED_FOR_SWIFT.NS_SWIFT_NAME.NS_SWIFT_NOTHROW.NS_DURING.NS_HANDLER.NS_ENDHANDLER.NS_VALUERETURN.NS_VOIDRETURN`.split(`.`),literal:[`false`,`true`,`FALSE`,`TRUE`,`nil`,`YES`,`NO`,`NULL`],built_in:[`dispatch_once_t`,`dispatch_queue_t`,`dispatch_sync`,`dispatch_async`,`dispatch_once`],type:[`int`,`float`,`char`,`unsigned`,`signed`,`short`,`long`,`double`,`wchar_t`,`unichar`,`void`,`bool`,`BOOL`,`id|0`,`_Bool`]},i={$pattern:n,keyword:[`@interface`,`@class`,`@protocol`,`@implementation`]};return{name:`Objective-C`,aliases:[`mm`,`objc`,`obj-c`,`obj-c++`,`objective-c++`],keywords:r,illegal:`/,end:/$/,illegal:`\\n`},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`class`,begin:`(`+i.keyword.join(`|`)+`)\\b`,end:/(\{|$)/,excludeEnd:!0,keywords:i,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:`\\.`+e.UNDERSCORE_IDENT_RE,relevance:0}]}}t.exports=n})),w=t(((e,t)=>{function n(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:`variable`,match:`\\$+`+r},s={scope:`meta`,variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:`subst`,variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ +]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,m,h,x],O={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[O,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,O,o,C,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}t.exports=n})),T=t(((e,t)=>{function n(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}t.exports=n})),E=t(((e,t)=>{function n(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}t.exports=n})),D=t(((e,t)=>{function n(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}t.exports=n})),O=t(((e,t)=>{function n(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}t.exports=n})),k=t(((e,t)=>{function n(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}t.exports=n})),A=t(((e,t)=>{function n(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),s=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],c=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),l=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:l,keyword:o,literal:s,built_in:c},illegal:``},a]}}t.exports=n})),j=t(((e,t)=>{var n=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),i=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),a=[...r,...i],o=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),s=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),c=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),l=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function u(e){let t=n(e),r=c,i=s,u=`@[a-z-]+`,d={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+a.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+i.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+r.join(`|`)+`)`},d,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+l.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,d,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:u,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:o.join(` `)},contains:[{begin:u,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},d,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}t.exports=u})),M=t(((e,t)=>{function n(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}t.exports=n})),N=t(((e,t)=>{function n(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t=t||[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}t.exports=n})),P=t(((e,t)=>{function n(e){return e?typeof e==`string`?e:e.source:null}function r(e){return i(`(?=`,e,`)`)}function i(...e){return e.map(e=>n(e)).join(``)}function a(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function o(...e){return`(`+(a(e).capture?``:`?:`)+e.map(e=>n(e)).join(`|`)+`)`}var s=e=>i(/\b/,e,/\w$/.test(e)?/\b/:/\B/),c=[`Protocol`,`Type`].map(s),l=[`init`,`self`].map(s),u=[`Any`,`Self`],d=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],f=[`false`,`nil`,`true`],p=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],m=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],h=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),g=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_=o(g,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),v=i(g,_,`*`),y=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),b=o(y,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),x=i(y,b,`*`),S=i(/[A-Z]/,b,`*`),C=[`attached`,`autoclosure`,i(/convention\(/,o(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,i(/objc\(/,x,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],w=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function T(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),a=[e.C_LINE_COMMENT_MODE,n],g={match:[/\./,o(...c,...l)],className:{2:`keyword`}},y={match:i(/\./,o(...d)),relevance:0},T=d.filter(e=>typeof e==`string`).concat([`_|0`]),E={variants:[{className:`keyword`,match:o(...d.filter(e=>typeof e!=`string`).concat(u).map(s),...l)}]},D={$pattern:o(/\b\w+/,/#\w+/),keyword:T.concat(m),literal:f},O=[g,y,E],k=[{match:i(/\./,o(...h)),relevance:0},{className:`built_in`,match:i(/\b/,o(...h),/(?=\()/)}],A={match:/->/,relevance:0},j=[A,{className:`operator`,relevance:0,variants:[{match:v},{match:`\\.(\\.|${_})+`}]}],M=`([0-9]_*)+`,N=`([0-9a-fA-F]_*)+`,P={className:`number`,relevance:0,variants:[{match:`\\b(${M})(\\.(${M}))?([eE][+-]?(${M}))?\\b`},{match:`\\b0x(${N})(\\.(${N}))?([pP][+-]?(${M}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},F=(e=``)=>({className:`subst`,variants:[{match:i(/\\/,e,/[0\\tnr"']/)},{match:i(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),I=(e=``)=>({className:`subst`,match:i(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),L=(e=``)=>({className:`subst`,label:`interpol`,begin:i(/\\/,e,/\(/),end:/\)/}),R=(e=``)=>({begin:i(e,/"""/),end:i(/"""/,e),contains:[F(e),I(e),L(e)]}),z=(e=``)=>({begin:i(e,/"/),end:i(/"/,e),contains:[F(e),L(e)]}),B={className:`string`,variants:[R(),R(`#`),R(`##`),R(`###`),z(),z(`#`),z(`##`),z(`###`)]},V=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],ee={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:V},H=e=>{let t=i(e,/\//),n=i(/\//,e);return{begin:t,end:n,contains:[...V,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},U={scope:`regexp`,variants:[H(`###`),H(`##`),H(`#`),ee]},W={match:i(/`/,x,/`/)},G=[W,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${b}+`}],K=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:w,contains:[...j,P,B]}]}},{scope:`keyword`,match:i(/@/,o(...C),r(o(/\(/,/\s+/)))},{scope:`meta`,match:i(/@/,x)}],q={match:r(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:i(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,b,`+`)},{className:`type`,match:S,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:i(/\s+&\s+/,r(S)),relevance:0}]},te={begin://,keywords:D,contains:[...a,...O,...K,A,q]};q.contains.push(te);let J={begin:/\(/,end:/\)/,relevance:0,keywords:D,contains:[`self`,{match:i(x,/\s*:/),keywords:`_|0`,relevance:0},...a,U,...O,...k,...j,P,B,...G,...K,q]},Y={begin://,keywords:`repeat each`,contains:[...a,q]},ne={begin:/\(/,end:/\)/,keywords:D,contains:[{begin:o(r(i(x,/\s*:/)),r(i(x,/\s+/,x,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:x}]},...a,...O,...j,P,B,...K,q,J],endsParent:!0,illegal:/["']/},re={match:[/(func|macro)/,/\s+/,o(W.match,x,v)],className:{1:`keyword`,3:`title.function`},contains:[Y,ne,t],illegal:[/\[/,/%/]},X={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[Y,ne,t],illegal:/\[|%/},ie={match:[/operator/,/\s+/,v],className:{1:`keyword`,3:`title`}},Z={begin:[/precedencegroup/,/\s+/,S],className:{1:`keyword`,3:`title`},contains:[q],keywords:[...p,...f],end:/}/},Q={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},ae={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},oe={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,x,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:D,contains:[Y,...O,{begin:/:/,end:/\{/,keywords:D,contains:[{scope:`title.class.inherited`,match:S},...O],relevance:0}]};for(let e of B.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=D;let n=[...O,...k,...j,P,B,...G];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:D,contains:[...a,re,X,Q,ae,oe,ie,Z,{beginKeywords:`import`,end:/$/,contains:[...a],relevance:0},U,...O,...k,...j,P,B,...G,...K,q,J]}}t.exports=T})),F=t(((e,t)=>{function n(e){let t=`true false yes no null`,n={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},a={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},c={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},l={begin:/\{/,end:/\}/,contains:[c],illegal:`\\n`,relevance:0},u={begin:`\\[`,end:`\\]`,contains:[c],illegal:`\\n`,relevance:0},d=[n,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!<[\\w#;/?:@&=+$,.~*'()[\\]]+>`},{className:`type`,begin:`![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},s,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},l,u,i,a],f=[...d];return f.pop(),f.push(o),c.contains=f,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:d}}t.exports=n})),I=t(((e,t)=>{var n=`[A-Za-z$_][0-9A-Za-z$_]*`,r=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),i=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],a=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),o=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],s=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],c=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],l=[].concat(s,a,o);function u(e){let t=e.regex,u=(e,{after:t})=>{let n=``,end:``},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let n=e[0].length+e.index,r=e.input[n];if(r===`<`||r===`,`){t.ignoreMatch();return}r===`>`&&(u(e,{after:n})||t.ignoreMatch());let i,a=e.input.substring(n);if(i=a.match(/^\s*=/)){t.ignoreMatch();return}if((i=a.match(/^\s+extends\s+/))&&i.index===0){t.ignoreMatch();return}}},h={$pattern:n,keyword:r,literal:i,built_in:l,"variable.language":c},g=`[0-9](_?[0-9])*`,_=`\\.(${g})`,v=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,y={className:`number`,variants:[{begin:`(\\b(${v})((${_})|\\.)?|(${_}))[eE][+-]?(${g})\\b`},{begin:`\\b(${v})\\b((${_})\\b|\\.)?|(${_})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},b={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:h,contains:[]},x={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`xml`}},S={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`css`}},C={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`graphql`}},w={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},T={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,{match:/\$\d+/},y];b.contains=E.concat({begin:/\{/,end:/\}/,keywords:h,contains:[`self`].concat(E)});let D=[].concat(T,b.contains),O=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:[`self`].concat(D)}]),k={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},A={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,t.concat(d,`(`,t.concat(/\./,d),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,d],scope:{1:`keyword`,3:`title.class`}}]},j={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...a,...o]}},M={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[k],illegal:/%/},P={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function F(e){return t.concat(`(?!`,e.join(`|`),`)`)}let I={match:t.concat(/\b/,F([...s,`super`,`import`].map(e=>`${e}\\s*\\(`)),d,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},R={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},k]},z=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,B={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(z)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[k]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:j},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,T,{match:/\$\d+/},y,j,{scope:`attr`,match:d+t.lookahead(`:`),relevance:0},B,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[T,e.REGEXP_MODE,{className:`function`,begin:z,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:f.begin,end:f.end},{match:p},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:`xml`,contains:[{begin:m.begin,end:m.end,skip:!0,contains:[`self`]}]}]},N,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[k,e.inherit(e.TITLE_MODE,{begin:d,className:`title.function`})]},{match:/\.\.\./,relevance:0},L,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[k]},I,P,A,R,{match:/\$[(.]/}]}}function d(e){let t=e.regex,a=u(e),o=n,s=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],d={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},f={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:s},contains:[a.exports.CLASS_REFERENCE]},p={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},m={$pattern:n,keyword:r.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:i,built_in:l.concat(s),"variable.language":c},h={className:`meta`,begin:`@[A-Za-z$_][0-9A-Za-z$_]*`},g=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(a.keywords,m),a.exports.PARAMS_CONTAINS.push(h);let _=a.contains.find(e=>e.scope===`attr`),v=Object.assign({},_,{match:t.concat(o,t.lookahead(/\s*\?:/))});a.exports.PARAMS_CONTAINS.push([a.exports.CLASS_REFERENCE,_,v]),a.contains=a.contains.concat([h,d,f,v]),g(a,`shebang`,e.SHEBANG()),g(a,`use_strict`,p);let y=a.contains.find(e=>e.label===`func.def`);return y.relevance=0,Object.assign(a,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),a}t.exports=d})),L=t(((e,t)=>{function n(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}t.exports=n})),R=t(((e,t)=>{function n(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}t.exports=n})),z=e(t(((e,t)=>{var z=n();z.registerLanguage(`xml`,r()),z.registerLanguage(`bash`,i()),z.registerLanguage(`c`,a()),z.registerLanguage(`cpp`,o()),z.registerLanguage(`csharp`,s()),z.registerLanguage(`css`,c()),z.registerLanguage(`markdown`,l()),z.registerLanguage(`diff`,u()),z.registerLanguage(`ruby`,d()),z.registerLanguage(`go`,f()),z.registerLanguage(`graphql`,p()),z.registerLanguage(`ini`,m()),z.registerLanguage(`java`,h()),z.registerLanguage(`javascript`,g()),z.registerLanguage(`json`,_()),z.registerLanguage(`kotlin`,v()),z.registerLanguage(`less`,y()),z.registerLanguage(`lua`,b()),z.registerLanguage(`makefile`,x()),z.registerLanguage(`perl`,S()),z.registerLanguage(`objectivec`,C()),z.registerLanguage(`php`,w()),z.registerLanguage(`php-template`,T()),z.registerLanguage(`plaintext`,E()),z.registerLanguage(`python`,D()),z.registerLanguage(`python-repl`,O()),z.registerLanguage(`r`,k()),z.registerLanguage(`rust`,A()),z.registerLanguage(`scss`,j()),z.registerLanguage(`shell`,M()),z.registerLanguage(`sql`,N()),z.registerLanguage(`swift`,P()),z.registerLanguage(`yaml`,F()),z.registerLanguage(`typescript`,I()),z.registerLanguage(`vbnet`,L()),z.registerLanguage(`wasm`,R()),z.HighlightJS=z,z.default=z,t.exports=z}))()).default;export{z as default}; \ No newline at end of file diff --git a/dist-embed/assets/csv-renderer-BilbplpS.js b/dist-embed/assets/csv-renderer-BilbplpS.js new file mode 100644 index 0000000..3fd7b52 --- /dev/null +++ b/dist-embed/assets/csv-renderer-BilbplpS.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./papaparse.min-D30bkSB7.js","./rolldown-runtime-DAXXjFlN.js"])))=>i.map(i=>d[i]); +import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./reader-Bd1ccloG.js";import{t as n}from"./base-renderer-DM6Nw1yD.js";var r=class extends n{async load(n,r,i){await super.load(n,r,i);let a=(await t(async()=>{let{default:t}=await import(`./papaparse.min-D30bkSB7.js`).then(t=>e(t.default));return{default:t}},__vite__mapDeps([0,1]),import.meta.url)).default,o=new TextDecoder(`utf-8`).decode(n),s=i?.currentFileName||``,c=/\.tsv$/i.test(s)?` `:``,l=a.parse(o,{delimiter:c,skipEmptyLines:!0}).data;r.innerHTML=``;let u=document.createElement(`div`);u.className=`doc-page`,u.dataset.page=1;let d=document.createElement(`table`);d.className=`data-table`,l.forEach((e,t)=>{let n=document.createElement(`tr`);e.forEach(e=>{let r=document.createElement(t===0?`th`:`td`);r.textContent=e,n.appendChild(r)}),d.appendChild(n)});let f=document.createElement(`div`);f.className=`data-table-wrap`,f.appendChild(d),u.appendChild(f),r.appendChild(u),this.numPages=1}};export{r as CSVRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/defineProperty-BbfpZ9Tg.js b/dist-embed/assets/defineProperty-BbfpZ9Tg.js new file mode 100644 index 0000000..fd7cfc6 --- /dev/null +++ b/dist-embed/assets/defineProperty-BbfpZ9Tg.js @@ -0,0 +1 @@ +function e(t){"@babel/helpers - typeof";return e=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},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}export{r as t}; \ No newline at end of file diff --git a/dist-embed/assets/diff-view-D2QtiOFi.js b/dist-embed/assets/diff-view-D2QtiOFi.js new file mode 100644 index 0000000..9d9ceb0 --- /dev/null +++ b/dist-embed/assets/diff-view-D2QtiOFi.js @@ -0,0 +1,7 @@ +import{r as e}from"./reader-Bd1ccloG.js";var t=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends t{};function n(e,t){let n;for(n=0;nt.length&&(n=e.length-t.length);let r=t.length;e.length0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function u(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function d(e,t){if(t)return p(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function f(e,t){if(t)return p(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function p(e,t){if(!t)return[f(e),d(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=u(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var m=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,h=RegExp(`[${m}]+|\\s+|[^${m}]`,`ug`);new class extends t{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=u(e,r)}else n=e.match(h)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&g(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&g(n,i,r,null,t.intlSegmenter),e}};function g(e,t,l,u,m){if(t&&l){let[c,d]=p(t.value,m),[f,h]=p(l.value,m);if(e){let r=n(c,f);e.value=a(e.value,f,r),t.value=o(t.value,r),l.value=o(l.value,r)}if(u){let e=r(d,h);u.value=i(u.value,h,e),t.value=s(t.value,e),l.value=s(l.value,e)}}else if(l){if(e){let e=f(l.value,m);l.value=l.value.substring(e.length)}if(u){let e=f(u.value,m);u.value=u.value.substring(e.length)}}else if(e&&u){let c=f(u.value,m),[l,d]=p(t.value,m),h=n(c,l);t.value=o(t.value,h);let g=r(o(c,h),d);t.value=s(t.value,g),u.value=i(u.value,c,g),e.value=a(e.value,c,c.slice(0,c.length-g.length))}else if(u){let e=f(u.value,m),n=c(d(t.value,m),e);t.value=s(t.value,n)}else if(e){let n=c(d(e.value,m),f(t.value,m));t.value=o(t.value,n)}}var _=new class extends t{tokenize(e){let t=RegExp(`(\\r?\\n)|[${m}]+|[^\\S\\n\\r]+|[^${m}]`,`ug`);return e.match(t)||[]}};function v(e,t,n){return _.diff(e,t,n)}var y=new class extends t{constructor(){super(...arguments),this.tokenize=x}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(` +`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(` +`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(` +`)&&(e=e.slice(0,-1)),t.endsWith(` +`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function b(e,t,n){return y.diff(e,t,n)}function x(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,` +`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;et===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(C(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function C(e,t,n,r,i){t=t||[],n=n||[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a{for(let e of o)r.push({type:`del`,leftLineNo:e.lineNo,rightLineNo:null,leftText:e.text,rightText:``});o=[]};for(let e of n){let t=D(e.value);if(e.removed)for(let e of t)i++,o.push({text:e,lineNo:i});else if(e.added){let e=t.map(e=>(a++,{text:e,lineNo:a})),n=Math.min(o.length,e.length);for(let t=0;t(a.has(e)||a.set(e,O(n[e].leftText,n[e].rightText)),a.get(e)),s=0;t.innerHTML=``;let c=document.createElement(`div`);c.className=`diff-body`,t.appendChild(c);let l=document.createElement(`div`);l.className=`diff-tooltip hidden`;let u=document.createElement(`div`);u.className=`diff-tip-head`;let d=document.createElement(`button`);d.className=`diff-pin-btn`,d.appendChild(E(w)),d.dataset.i18nTitle=`compare.pin`,d.title=e(`compare.pin`),d.addEventListener(`click`,e=>{e.stopPropagation(),l._row&&l._anchor&&g(l._row,l._anchor)}),u.appendChild(d);let f=document.createElement(`div`);f.className=`diff-tip-body`,l.append(u,f),c.appendChild(l);let p=[];function m(t,n){t.innerHTML=``;let i=document.createElement(`h3`);i.dataset.i18n=`blame.heading`,i.textContent=e(`blame.heading`),t.appendChild(i);let a=n.rightLineNo==null?null:r[n.rightLineNo];if(a){let n=document.createElement(`dl`);for(let t of[`author`,`date`,`commit`,`message`]){if(a[t]==null||a[t]===``)continue;let r=document.createElement(`dt`);r.dataset.i18n=`blame.`+t,r.textContent=e(`blame.`+t);let i=document.createElement(`dd`);i.textContent=a[t],n.append(r,i)}t.appendChild(n)}else{let r=document.createElement(`p`);r.className=`diff-tip-note`;let i=n.rightLineNo==null?`compare.removed`:`compare.noBlame`;r.dataset.i18n=i,r.textContent=e(i),t.appendChild(r)}}function h(e,t){let n=c.getBoundingClientRect(),r=t.getBoundingClientRect();e.style.top=r.bottom-n.top+4+`px`,e.style.left=Math.max(4,Math.min(r.left-n.left,c.clientWidth-e.offsetWidth-8))+`px`}function g(t,n){let r=document.createElement(`div`);r.className=`diff-pin`;let i=document.createElement(`div`);i.className=`diff-tip-head`;let a=document.createElement(`button`);a.className=`diff-pin-close`,a.appendChild(E(T)),a.dataset.i18nTitle=`compare.unpin`,a.title=e(`compare.unpin`),a.addEventListener(`click`,()=>{r.remove();let e=p.indexOf(r);e>=0&&p.splice(e,1)}),i.appendChild(a);let o=document.createElement(`div`);o.className=`diff-tip-body`,m(o,t),r.append(i,o),c.appendChild(r),h(r,n),p.push(r),v()}let _=null,v=()=>l.classList.add(`hidden`);function y(e){clearTimeout(_),l._row=e._row,l._anchor=e,m(f,e._row),l.classList.remove(`hidden`),h(l,e)}let b=()=>{clearTimeout(_),_=setTimeout(v,180)};c.addEventListener(`mouseover`,e=>{let t=e.target.closest(`.diff-change`);t&&t._row&&y(t)}),c.addEventListener(`mouseout`,e=>{e.target.closest(`.diff-change`)&&b()}),l.addEventListener(`mouseenter`,()=>clearTimeout(_)),l.addEventListener(`mouseleave`,b);let x=R[i]?i:`side-by-side`;function S(){[...c.children].forEach(e=>{e!==l&&e.remove()}),p.splice(0).forEach(e=>e.remove()),v(),R[x](c,o(s))}function C(e){R[e]&&(x=e,S())}function D(e){e>=0&&ee.remove()),l.remove(),t.innerHTML=``}}}export{z as renderCompare}; \ No newline at end of file diff --git a/dist-embed/assets/djvu-renderer-DqS9P2fI.js b/dist-embed/assets/djvu-renderer-DqS9P2fI.js new file mode 100644 index 0000000..fcf78e8 --- /dev/null +++ b/dist-embed/assets/djvu-renderer-DqS9P2fI.js @@ -0,0 +1,2 @@ +import{t as e}from"./base-renderer-DM6Nw1yD.js";var t=2e3,n=200,r=class extends e{constructor(){super(),this._worker=null,this._reqId=0,this._pending=new Map,this._infos=[],this._pageW=800,this._pageH=1e3,this._gen=0,this._renderObs=null,this._pageObs=null,this.defaultScaleOption=`page-height`,this.buildsThumbnailsAsync=!0}_call(e,t){return new Promise((n,r)=>{let i=++this._reqId;this._pending.set(i,{resolve:n,reject:r}),this._worker.postMessage({id:i,type:e,...t})})}_spawnWorker(){this._worker=new Worker(new URL(``+new URL(`worker-OhPDRroP.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),this._worker.onmessage=e=>{let{id:t,error:n}=e.data,r=this._pending.get(t);r&&(this._pending.delete(t),n?r.reject(Error(n)):r.resolve(e.data))}}async extractText(e){this._spawnWorker();try{let t=await this._call(`open`,{buffer:e}),n=[];for(let e=0;e<(t.pageCount||1);e++){let{words:t}=await this._call(`text`,{index:e}),r=[],i=[],a=null;for(let e of t||[]){let t=e.ymax-e.ymin||10;a!=null&&Math.abs(e.ymin-a)>t*.7&&(r.push(i.join(` `)),i=[]),i.push(e.str),a=e.ymin}i.length&&r.push(i.join(` `)),n.push(r.join(` +`))}return n}finally{this._worker?.terminate(),this._worker=null}}_logical(e){let t=e?.dpi||300;return{w:Math.max(1,Math.round((e?.width||800)*96/t)),h:Math.max(1,Math.round((e?.height||1e3)*96/t))}}async load(e,t,n){await super.load(e,t,n);let r=++this._gen;this._spawnWorker();let i=await this._call(`open`,{buffer:e});if(r!==this._gen)return;this.numPages=i.pageCount||1,this._infos=i.infos||[];let a=this._logical(this._infos[0]);this._pageW=a.w,this._pageH=a.h,t.innerHTML=``;for(let e=0;e=0&&t{e.forEach(e=>{let t=e.target.dataset.page-1;e.isIntersecting?this._renderPage(t):this._clearPage(e.target)})},{root:e,rootMargin:`150% 0px`,threshold:0}),this._pageObs=new IntersectionObserver(e=>{let t={ratio:0,page:this.viewer?.currentPage||1};e.forEach(e=>{e.intersectionRatio>t.ratio&&(t={ratio:e.intersectionRatio,page:+e.target.dataset.page})}),t.ratio>0&&this.viewer&&t.page!==this.viewer.currentPage&&(this.viewer.currentPage=t.page,this.viewer.updatePageInfo(),this._highlightThumb(t.page))},{root:e,threshold:[0,.25,.5,.75,1]}),this.container.querySelectorAll(`.djvu-page`).forEach(e=>{this._renderObs.observe(e),this._pageObs.observe(e)})}_subsample(e,t){let n=e?.width||800;return Math.max(1,Math.round(n/Math.min(n,t)))}_canvasFromRender(e){let t=document.createElement(`canvas`);return t.width=e.width,t.height=e.height,t.getContext(`2d`).putImageData(new ImageData(e.rgba,e.width,e.height),0,0),t}async _renderPage(e){let n=this.container?.querySelector(`.djvu-page[data-page="${e+1}"]`);if(!n||n.dataset.rendered)return;n.dataset.rendered=`1`;let r=this._gen;try{let i=await this._call(`render`,{index:e,subsample:this._subsample(this._infos[e],t)});if(r!==this._gen||!this._worker)return;let a=this._canvasFromRender(i);n.innerHTML=``,n.appendChild(a)}catch{n.dataset.rendered=``}}_clearPage(e){e.dataset.rendered&&(e.innerHTML=``,e.dataset.rendered=``)}setScale(e){this.scale=e,this.container?.querySelectorAll(`.djvu-page`).forEach(t=>{t.style.width=`${Math.round((+t.dataset.lw||this._pageW)*e)}px`,t.style.height=`${Math.round((+t.dataset.lh||this._pageH)*e)}px`})}getPageWidth(){return this._pageW}getPageHeight(){return this._pageH}scrollToPage(e){let t=this.container?.querySelector(`.djvu-page[data-page="${e}"]`);t&&(this._renderWindow(e-1),t.scrollIntoView({behavior:`smooth`,block:`start`}))}async _buildThumbnails(e){let t=document.getElementById(`thumbsContent`);if(t){for(let r=0;rthis.viewer?.goToPage(r+1)),t.appendChild(c)}this._highlightThumb(this.viewer?.currentPage||1)}}_highlightThumb(e){document.querySelectorAll(`#thumbsContent .thumb`).forEach(t=>{t.classList.toggle(`active`,+t.dataset.thumbPage===e)})}destroy(){this._gen++,this._renderObs?.disconnect(),this._pageObs?.disconnect(),this._renderObs=this._pageObs=null,this._pending.clear(),this._worker?.terminate(),this._worker=null,super.destroy()}};export{r as DjVuRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/doc-renderer-BiIZu55h.js b/dist-embed/assets/doc-renderer-BiIZu55h.js new file mode 100644 index 0000000..5d63e74 --- /dev/null +++ b/dist-embed/assets/doc-renderer-BiIZu55h.js @@ -0,0 +1,2 @@ +import{t as e}from"./base-renderer-DM6Nw1yD.js";var t=[``,`center`,`right`,`justify`],n=null;function r(){return window.docToText?Promise.resolve():n||(n=new Promise((e,t)=>{let n=document.createElement(`script`);n.src=`./jsdoc/docToText.js`,n.onload=()=>{e()},n.onerror=()=>t(Error(`Failed to load /jsdoc/docToText.js`)),document.head.appendChild(n)}),n)}function i(e){return String(e).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}function a(e){if(!e)return``;let t=``;return e.indL&&(t+=`margin-left:${e.indL/20}pt;`),e.indR&&(t+=`margin-right:${e.indR/20}pt;`),e.ind1&&(t+=`text-indent:${e.ind1/20}pt;`),e.spB&&(t+=`margin-bottom:${e.spB/20}pt;`),e.spA&&(t+=`margin-top:${e.spA/20}pt;`),e.line&&(t+=`line-height:${e.lineMult?e.line/240:Math.abs(e.line)/20+`pt`};`),t}function o(e){let t=``;e.b&&(t+=`font-weight:bold;`),e.i&&(t+=`font-style:italic;`);let n=(e.u?`underline `:``)+(e.strike?`line-through`:``);return n.trim()&&(t+=`text-decoration:${n.trim()};`),e.size&&(t+=`font-size:${e.size}pt;`),e.font&&(t+=`font-family:'${String(e.font).replace(/['\\<>]/g,``)}';`),e.color!=null&&(t+=`color:rgb(${e.color&255},${e.color>>8&255},${e.color>>16&255});`),t}function s(e,t){let n=``;for(let r of e||[])if(r.image&&r.image.bytes)try{let e=URL.createObjectURL(new Blob([r.image.bytes],{type:r.image.mime||`image/png`}));t.push(e),n+=`embedded image`}catch{}else if(r.ftnRef!=null)n+=`${r.ftnRef+1}`;else if(r.endRef!=null){let e=[`i`,`ii`,`iii`,`iv`,`v`,`vi`,`vii`,`viii`,`ix`,`x`][r.endRef]||r.endRef+1;n+=`${e}`}else if(r.comRef!=null)n+=`✎`;else if(r.text){let e=o(r),t=e?`${i(r.text)}`:i(r.text);r.url&&(t=`${t}`),n+=t}return n}function c(e,n){let r=``,i=0,o=null,c=()=>{o&&(r+=``,o=null)};for(;i{e.tblw&&e.tblw.forEach(e=>{o[e]=1})});let l=Object.keys(o).map(Number).sort((e,t)=>e-t),u=l.length>2,d=``;if(u){let e=l[l.length-1]-l[0];if(e>0){d=``;for(let t=0;t`;d+=``}}r+=`${d}`,t.forEach(e=>{r+=``;for(let t=0;t2){let n=e.tblw[t],r=e.tblw[t+1],a=0;for(let e=0;en&&l[e]>8&255},${a>>16&255})`;r+=`1?` colspan="${i}"`:``}${o?` style="background:${o}"`:``}>${s(e.cells[t].runs,n)||` `}`}r+=``}),r+=`
`}else{let e=l.align?`text-align:${t[l.align]};`:``,u=s(l.runs,n);if(l.list){let t=l.list.kind===`number`?`ol`:`ul`;o!==t&&(c(),r+=`<${t}>`,o=t),r+=`${u||` `}`}else{c();let t=e+a(l.pp);r+=`${u||`
`}

`}i++}}return c(),r||`

(document contains no main-body text)

`}function l(e){let t=e.split(` +`),n=``,r=0;for(;r`;for(let t=0;t`+e[t].map(e=>`<${r}>${e}`).join(``)+``}n+=``}else t[r].trim()&&(n+=`

${t[r]}

`),r++;return n||`

(document contains no main-body text)

`}var u=class extends e{constructor(){super(),this._imgUrls=[]}async load(e,t,n){await super.load(e,t,n),await r();let a=window.docToText;if(typeof a!=`function`)throw Error(`docToText library failed to load.`);let o=null;try{o=a.model(e)}catch{}let s;if(o&&o.body){if(s=c(o.body,this._imgUrls),o.props){let e=[];[[`title`,`Title`],[`author`,`Author`],[`subject`,`Subject`]].forEach(([t,n])=>{o.props[t]&&e.push(`${n}: ${i(o.props[t])}`)}),e.length&&(s=`
${e.join(`  ·  `)}
`+s)}for(let[e,t]of[[`footnotes`,`Footnotes`],[`endnotes`,`Endnotes`],[`annotations`,`Comments`],[`textboxes`,`Text boxes`]])o[e]&&o[e].length&&(s+=`

${t}

`+c(o[e],this._imgUrls));o.header&&o.header.length&&(s+=`

Header

`+c(o.header,this._imgUrls)),o.footer&&o.footer.length&&(s+=`

Footer

`+c(o.footer,this._imgUrls))}else{let t=null;try{t=a.html(e)}catch{}if(!t||!t.body)throw Error(`Could not read .doc file — may be Word 6/95, encrypted, or corrupt.`);s=l(t.body)}t.innerHTML=``;let u=document.createElement(`div`);u.className=`doc-page`,u.dataset.page=1,u.innerHTML=s,t.appendChild(u),this.numPages=1}destroy(){this._imgUrls.forEach(e=>URL.revokeObjectURL(e)),this._imgUrls=[],super.destroy()}};export{u as DOCRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/document-BvO1jqhz.js b/dist-embed/assets/document-BvO1jqhz.js new file mode 100644 index 0000000..d6ab752 --- /dev/null +++ b/dist-embed/assets/document-BvO1jqhz.js @@ -0,0 +1,7 @@ +import{a as e,i as t,l as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./driver-0cTj10HJ.js";var l=(e,t)=>{let n=e.exec(t);return n?n[1].trim():null};function u(e){let t={title:l(/^%%Title:\s*(.*)$/m,e),creator:l(/^%%Creator:\s*(.*)$/m,e),creationDate:l(/^%%CreationDate:\s*(.*)$/m,e),forJob:l(/^%%For:\s*(.*)$/m,e),languageLevel:l(/^%%LanguageLevel:\s*(.*)$/m,e),boundingBox:null,pagesDeclared:null,media:l(/^%%DocumentMedia:\s*(.*)$/m,e),fonts:[],pageMarkers:[],trailerIndex:-1},n=/^%%BoundingBox:\s*([-\d.]+)\s+([-\d.]+)\s+([-\d.]+)\s+([-\d.]+)/m.exec(e);n&&(t.boundingBox=[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]);let r=/^%%Pages:\s*(\d+)/m.exec(e);r&&(t.pagesDeclared=parseInt(r[1],10));let i=l(/^%%DocumentFonts:\s*(.*)$/m,e);i&&i!==`(atend)`&&(t.fonts=i.split(/\s+/).filter(Boolean));let a=/^%%Page:\s*(.*)$/gm,o;for(;o=a.exec(e);){let e=o[1].trim().split(/\s+/),n=e[0]||String(t.pageMarkers.length+1),r=parseInt(e[1]??e[0],10)||t.pageMarkers.length+1;t.pageMarkers.push({label:n,ordinal:r,index:o.index})}let s=/^%%Trailer\b/m.exec(e);return s&&(t.trailerIndex=s.index),t}var d=Object.freeze({INTEGER:`integer`,REAL:`real`,BOOLEAN:`boolean`,NAME:`name`,STRING:`string`,ARRAY:`array`,DICT:`dict`,OPERATOR:`operator`,MARK:`mark`,NULL:`null`,FILE:`file`,SAVE:`save`,FONTID:`fontid`}),f=Object.freeze({UNLIMITED:0,READONLY:1,EXECUTEONLY:2,NONE:3}),p=new Map,m=[];function h(e){let t=p.get(e);return t===void 0&&(t=m.length,p.set(e,t),m.push(e)),t}function g(e){return m[e]}var _=class e{constructor(e,t=0,n=e.length){this.backing=e,this.offset=t,this.length=n}static from(t){if(t instanceof e)return t;if(typeof t==`string`){let n=new Uint8Array(t.length);for(let e=0;ee.key)}*entries(){for(let e of this.map.values())yield[e.key,e.value]}},te=0,ne=new WeakMap;function y(e){switch(e.type){case d.INTEGER:case d.REAL:return`d`+e.value;case d.NAME:return`n`+e.value;case d.BOOLEAN:return`b`+ +!!e.value;case d.STRING:return`s`+e.value.toJSString();default:{let t=ne.get(e);return t===void 0&&(t=++te,ne.set(e,t)),`o`+t}}}var b=class{constructor(e,t,n=!1,r=f.UNLIMITED){this.type=e,this.value=t,this.executable=n,this.access=r}get isExecutable(){return this.executable}get isLiteralName(){return this.type===d.NAME&&!this.executable}get isExecutableName(){return this.type===d.NAME&&this.executable}get isNumber(){return this.type===d.INTEGER||this.type===d.REAL}asNumber(){return this.value}toString(){switch(this.type){case d.NAME:return(this.executable?``:`/`)+g(this.value);case d.STRING:return`(`+this.value.toJSString()+`)`;case d.ARRAY:{let e=Array.from(this.value).map(String).join(` `);return this.executable?`{${e}}`:`[${e}]`}case d.OPERATOR:return`--`+this.value.name+`--`;case d.FONTID:return`/`+(this.value&&this.value.name?this.value.name:`Font`);case d.MARK:return`mark`;case d.NULL:return`null`;default:return String(this.value)}}},re=Symbol(`mark`),x=new b(d.MARK,re),ie=new b(d.NULL,null),ae=new b(d.BOOLEAN,!0),oe=new b(d.BOOLEAN,!1),S=Object.freeze({int:e=>new b(d.INTEGER,e,!1),real:e=>new b(d.REAL,e,!1),bool:e=>e?ae:oe,name:(e,t=!1)=>new b(d.NAME,h(e),t),string:e=>new b(d.STRING,_.from(e),!1),array:(e,t=!1)=>new b(d.ARRAY,e instanceof ee?e:new ee(e),t),dict:e=>new b(d.DICT,e instanceof v?e:new v,!1),op:(e,t)=>new b(d.OPERATOR,{name:e,fn:t},!0)}),C=class extends Error{constructor(e,t){super(t?`${e}: ${t}`:e),this.psname=e,this.detail=t||null}},se=class{constructor(e,t){this.stack=[e,t],this.systemdict=e,this.userdict=t}push(e){this.stack.push(e)}pop(){if(this.stack.length<=2)throw new C(`dictstackunderflow`);return this.stack.pop()}top(){return this.stack[this.stack.length-1]}def(e,t){this.top().value.put(e,t)}load(e){for(let t=this.stack.length-1;t>=0;t--){let n=this.stack[t].value.get(e);if(n!==void 0)return n}}where(e){for(let t=this.stack.length-1;t>=0;t--)if(this.stack[t].value.knows(e))return this.stack[t];return null}},w=class extends Error{},T=Symbol(`eof`),E=Symbol(`}`),D=new Uint8Array(256);for(let e of[0,9,10,12,13,32])D[e]=1;var ce=new Uint8Array(256);for(let e of[40,41,60,62,91,93,123,125,47,37])ce[e]=1;function le(e){if(e instanceof Uint8Array)return e;if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n=this.len)return T;switch(this.b[this.pos]){case 125:return this.pos++,E;case 41:throw new w(`unmatched ')'`);case 40:return this._readString();case 60:return this._readAngleOpen();case 62:if(this.code(this.pos+1)===62)return this.pos+=2,S.name(`>>`,!0);throw new w(`unmatched '>'`);case 91:return this.pos++,S.name(`[`,!0);case 93:return this.pos++,S.name(`]`,!0);case 123:return this._readProcedure();case 47:return this._readLiteralName();default:return this._readToken()}}_readAngleOpen(){let e=this.code(this.pos+1);if(e===60)return this.pos+=2,S.name(`<<`,!0);if(e===126)throw new w(`ASCII85 strings (<~ ~>) not yet supported`);return this._readHexString()}_readProcedure(){this.pos++;let e=[];for(;;){let t=this._scanOne();if(t===T)throw new w(`unterminated procedure (missing '}')`);if(t===E)break;e.push(t)}return S.array(e,!0)}_readRegularRun(){let e=this.pos,t=this.b;for(;this.pos=48&&t<=55){let r=t-48;for(let e=0;e<2&&n[this.pos]>=48&&n[this.pos]<=55;e++)r=(r<<3)+(n[this.pos++]-48);e.push(r&255)}else e.push(t)}continue}if(r===40){t++,e.push(r);continue}if(r===41){if(--t===0)break;e.push(r);continue}e.push(r)}if(t!==0)throw new w(`unterminated string (missing ")")`);return S.string(new _(Uint8Array.from(e)))}_readHexString(){this.pos++;let e=[],t=-1,n=this.b;for(;this.pos string`);t<0?t=i:(e.push(t<<4|i),t=-1)}return t>=0&&e.push(t<<4),S.string(new _(Uint8Array.from(e)))}};function de(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:-1}var fe=/^(\d{1,2})#([0-9A-Za-z]+)$/,pe=/^[+-]?\d+$/,me=/^[+-]?(?:\d+\.\d*|\.\d+|\d+)(?:[eE][+-]?\d+)?$/;function he(e){if(e.length===0)return null;let t=fe.exec(e);if(t){let e=+t[1];if(e>=2&&e<=36){let n=parseInt(t[2],e);if(!Number.isNaN(n))return{type:`integer`,value:n}}return null}if(pe.test(e))return{type:`integer`,value:parseInt(e,10)};if(me.test(e)&&/[.eE]/.test(e)){let t=parseFloat(e);if(!Number.isNaN(t))return{type:`real`,value:t}}return null}var O=class{constructor(e){this.arr=e,this.i=0}tick(e){if(this.i>=this.arr.length){e.estack.pop();return}e.execObject(this.arr.get(this.i++))}},ge=class{constructor(e){this.scanner=e,this.isFile=!0}get file(){return this._file||(this._file=new b(d.FILE,{scanner:this.scanner,open:!0})),this._file}tick(e){let t=this.scanner.next();if(t===null){e.estack.pop();return}e.execObject(t)}},_e=class{constructor(e,t,n,r,i){this.cur=e,this.inc=t,this.limit=n,this.proc=r,this.isInt=i,this.isLoop=!0}tick(e){if(this.inc>=0?this.cur>this.limit:this.cur=this.arr.length){e.estack.pop();return}e.ostack.push(this.arr.get(this.i++)),e.estack.push(new O(this.proc))}},xe=class{constructor(e,t){this.str=e,this.proc=t,this.i=0,this.isLoop=!0}tick(e){if(this.i>=this.str.length){e.estack.pop();return}e.ostack.push(S.int(this.str.get(this.i++))),e.estack.push(new O(this.proc))}},Se=class{constructor(e,t){this.entries=e,this.proc=t,this.i=0,this.isLoop=!0}tick(e){if(this.i>=this.entries.length){e.estack.pop();return}let[t,n]=this.entries[this.i++];e.ostack.push(t),e.ostack.push(n),e.estack.push(new O(this.proc))}},Ce=class{constructor(){this.isStopBarrier=!0}tick(e){e.estack.pop(),e.ostack.push(S.bool(!1))}};function we(e){for(let t=e.estack.length-1;t>=0;t--)if(e.estack[t].isLoop)return e.estack.length=t,!0;return!1}function Te(e){for(let t=e.estack.length-1;t>=0;t--)if(e.estack[t].isStopBarrier)return e.estack.length=t,e.ostack.push(S.bool(!0)),!0;return!1}function Ee(e){return e instanceof v?e:e.backing}function De(e){return e instanceof v?{kind:`dict`,dict:e,copy:new Map(e.map)}:{kind:e instanceof _?`string`:`array`,backing:e.backing,copy:e.backing.slice()}}function Oe(e){if(e.kind===`dict`){e.dict.map=e.copy;return}if(e.kind===`string`){e.backing.set(e.copy);return}let t=e.backing,n=e.copy;t.length=n.length;for(let e=0;e[1,0,0,1,0,0];function k(e,t){let[n,r,i,a,o,s]=e,[c,l,u,d,f,p]=t;return[n*c+r*u,n*l+r*d,i*c+a*u,i*l+a*d,o*c+s*u+f,o*l+s*d+p]}function A(e,t,n){return[e[0]*t+e[2]*n+e[4],e[1]*t+e[3]*n+e[5]]}function Ae(e,t,n){return[e[0]*t+e[2]*n,e[1]*t+e[3]*n]}function je(e){return e[0]*e[3]-e[1]*e[2]}function j(e){let t=je(e);if(t===0)return null;let[n,r,i,a,o,s]=e,c=1/t;return[a*c,-r*c,-i*c,n*c,(i*s-a*o)*c,(r*o-n*s)*c]}var Me=(e,t,n)=>k([1,0,0,1,t,n],e),Ne=(e,t,n)=>k([t,0,0,n,0,0],e);function Pe(e,t){let n=t*Math.PI/180,r=Math.cos(n),i=Math.sin(n);return k([r,i,-i,r,0,0],e)}var Fe=e=>Math.sqrt(Math.abs(je(e))),M=class e{constructor(){this.segs=[]}moveTo(e,t){this.segs.push({op:`M`,x:e,y:t})}lineTo(e,t){this.segs.push({op:`L`,x:e,y:t})}curveTo(e,t,n,r,i,a){this.segs.push({op:`C`,x1:e,y1:t,x2:n,y2:r,x3:i,y3:a})}close(){this.segs.push({op:`Z`})}get isEmpty(){return this.segs.length===0}clone(){let t=new e;return t.segs=this.segs.slice(),t}};function Ie(e,t,n,r,i,a){let o=r*Math.PI/180,s=i*Math.PI/180;if(a)for(;s>o;)s-=2*Math.PI;else for(;s[e+n*Math.cos(r),t+n*Math.sin(r)],p=f(o),m=[],h=o;for(let e=0;ethis.bbox[2]&&(this.bbox[2]=e),t>this.bbox[3]&&(this.bbox[3]=t)):this.bbox=[e,t,e,t]}clone(){let e=new t;return e.ctm=this.ctm.slice(),e.lineWidth=this.lineWidth,e.lineCap=this.lineCap,e.lineJoin=this.lineJoin,e.miterLimit=this.miterLimit,e.flatness=this.flatness,e.dashArray=this.dashArray.slice(),e.dashOffset=this.dashOffset,e.strokePaint=this.strokePaint,e.fillPaint=this.fillPaint,e.path=this.path.clone(),e.clip=this.clip,e.font=this.font,e.cpx=this.cpx,e.cpy=this.cpy,e.hasCP=this.hasCP,e.startx=this.startx,e.starty=this.starty,e.bbox=this.bbox?this.bbox.slice():null,e}},Re={dup(e){let t=e.pop();e.push(t),e.push(t)},pop(e){e.pop()},exch(e){let t=e.pop(),n=e.pop();e.push(t),e.push(n)},copy(e){let t=e.pop();if(t.type!==d.INTEGER)throw new C(`typecheck`);let n=t.value;if(n<0)throw new C(`rangecheck`);let r=e.ostack.length;if(n>r)throw new C(`stackunderflow`);for(let t=0;t=n)throw new C(`stackunderflow`);e.push(e.ostack[n-1-t])},roll(e){let t=e.popInt(),n=e.popInt();if(n<0)throw new C(`rangecheck`);if(n>e.ostack.length)throw new C(`stackunderflow`);if(n===0)return;let r=e.ostack.length-n,i=e.ostack.splice(r,n),a=(t%n+n)%n,o=i.slice(n-a).concat(i.slice(0,n-a));for(let t of o)e.ostack.push(t)},clear(e){e.ostack.length=0},count(e){e.push(S.int(e.ostack.length))},mark(e){e.push(x)},cleartomark(e){for(;e.ostack.length;)if(e.ostack.pop().type===d.MARK)return;throw new C(`unmatchedmark`)},counttomark(e){for(let t=e.ostack.length-1;t>=0;t--)if(e.ostack[t].type===d.MARK){e.push(S.int(e.ostack.length-1-t));return}throw new C(`unmatchedmark`)}};function N(e){let t=e.popNum();return[e.popNum(),t]}var P=(e,t)=>e.type===d.INTEGER&&t.type===d.INTEGER,ze=Math.PI/180,Be=180/Math.PI,Ve={add(e){let[t,n]=N(e),r=t.value+n.value;e.push(P(t,n)?S.int(r):S.real(r))},sub(e){let[t,n]=N(e),r=t.value-n.value;e.push(P(t,n)?S.int(r):S.real(r))},mul(e){let[t,n]=N(e),r=t.value*n.value;e.push(P(t,n)?S.int(r):S.real(r))},div(e){let[t,n]=N(e);if(n.value===0)throw new C(`undefinedresult`);e.push(S.real(t.value/n.value))},idiv(e){let t=e.pop(),n=e.pop();if(n.type!==d.INTEGER||t.type!==d.INTEGER)throw new C(`typecheck`);if(t.value===0)throw new C(`undefinedresult`);e.push(S.int(Math.trunc(n.value/t.value)))},mod(e){let t=e.pop(),n=e.pop();if(n.type!==d.INTEGER||t.type!==d.INTEGER)throw new C(`typecheck`);if(t.value===0)throw new C(`undefinedresult`);e.push(S.int(n.value%t.value))},neg(e){let t=e.popNum();e.push(t.type===d.INTEGER?S.int(-t.value):S.real(-t.value))},abs(e){let t=e.popNum();e.push(t.type===d.INTEGER?S.int(Math.abs(t.value)):S.real(Math.abs(t.value)))},sqrt(e){let t=e.popNum();if(t.value<0)throw new C(`rangecheck`);e.push(S.real(Math.sqrt(t.value)))},sin(e){let t=e.popNum();e.push(S.real(Math.sin(t.value*ze)))},cos(e){let t=e.popNum();e.push(S.real(Math.cos(t.value*ze)))},atan(e){let t=e.popNum(),n=e.popNum(),r=Math.atan2(n.value,t.value)*Be;r<0&&(r+=360),e.push(S.real(r))},exp(e){let t=e.popNum(),n=e.popNum();e.push(S.real(n.value**+t.value))},ln(e){let t=e.popNum();e.push(S.real(Math.log(t.value)))},log(e){let t=e.popNum();e.push(S.real(Math.log10(t.value)))},ceiling(e){let t=e.popNum();e.push(t.type===d.INTEGER?t:S.real(Math.ceil(t.value)))},floor(e){let t=e.popNum();e.push(t.type===d.INTEGER?t:S.real(Math.floor(t.value)))},round(e){let t=e.popNum();e.push(t.type===d.INTEGER?t:S.real(Math.round(t.value)))},truncate(e){let t=e.popNum();e.push(t.type===d.INTEGER?t:S.real(Math.trunc(t.value)))}};function He(e,t){if(e.isNumber&&t.isNumber)return e.value===t.value;if(e.type!==t.type)return!1;switch(e.type){case d.BOOLEAN:return e.value===t.value;case d.NAME:return e.value===t.value;case d.STRING:return e.value.toJSString()===t.value.toJSString();case d.NULL:case d.MARK:return!0;default:return e===t||e.value===t.value}}function F(e,t){let n=e.pop(),r=e.pop();if(r.isNumber&&n.isNumber)return e.push(S.bool(t(r.value-n.value)));if(r.type===d.STRING&&n.type===d.STRING){let i=r.value.toJSString(),a=n.value.toJSString();return e.push(S.bool(t(ia))))}throw new C(`typecheck`)}var Ue={eq(e){let t=e.pop(),n=e.pop();e.push(S.bool(He(n,t)))},ne(e){let t=e.pop(),n=e.pop();e.push(S.bool(!He(n,t)))},gt(e){F(e,e=>e>0)},ge(e){F(e,e=>e>=0)},lt(e){F(e,e=>e<0)},le(e){F(e,e=>e<=0)},and(e){let t=e.pop(),n=e.pop();if(n.type===d.BOOLEAN&&t.type===d.BOOLEAN)return e.push(S.bool(n.value&&t.value));if(n.type===d.INTEGER&&t.type===d.INTEGER)return e.push(S.int(n.value&t.value));throw new C(`typecheck`)},or(e){let t=e.pop(),n=e.pop();if(n.type===d.BOOLEAN&&t.type===d.BOOLEAN)return e.push(S.bool(n.value||t.value));if(n.type===d.INTEGER&&t.type===d.INTEGER)return e.push(S.int(n.value|t.value));throw new C(`typecheck`)},xor(e){let t=e.pop(),n=e.pop();if(n.type===d.BOOLEAN&&t.type===d.BOOLEAN)return e.push(S.bool(n.value!==t.value));if(n.type===d.INTEGER&&t.type===d.INTEGER)return e.push(S.int(n.value^t.value));throw new C(`typecheck`)},not(e){let t=e.pop();if(t.type===d.BOOLEAN)return e.push(S.bool(!t.value));if(t.type===d.INTEGER)return e.push(S.int(~t.value));throw new C(`typecheck`)},bitshift(e){let t=e.popInt(),n=e.popInt();e.push(S.int(t>=0?n<>-t))}};function I(e){let t=e.pop();if(t.type!==d.ARRAY||!t.executable)throw new C(`typecheck`);return t}function We(e){let t=e.pop();if(t.type!==d.BOOLEAN)throw new C(`typecheck`);return t.value}var Ge={exec(e){let t=e.pop();t.type===d.ARRAY&&t.executable?e.estack.push(new O(t.value)):e.execObject(t)},if(e){let t=I(e);We(e)&&e.estack.push(new O(t.value))},ifelse(e){let t=I(e),n=I(e);e.estack.push(new O((We(e)?n:t).value))},for(e){let t=I(e),n=e.popNum(),r=e.popNum(),i=e.popNum(),a=i.type===d.INTEGER&&r.type===d.INTEGER&&n.type===d.INTEGER;e.estack.push(new _e(i.value,r.value,n.value,t.value,a))},repeat(e){let t=I(e),n=e.popInt();if(n<0)throw new C(`rangecheck`);e.estack.push(new ve(n,t.value))},loop(e){let t=I(e);e.estack.push(new ye(t.value))},forall(e){let t=I(e),n=e.pop();if(n.type===d.ARRAY)e.estack.push(new be(n.value,t.value));else if(n.type===d.STRING)e.estack.push(new xe(n.value,t.value));else if(n.type===d.DICT){let r=n.value.keys().map(e=>[e,n.value.get(e)]);e.estack.push(new Se(r,t.value))}else throw new C(`typecheck`)},exit(e){if(!we(e))throw new C(`invalidexit`)},stop(e){Te(e)||(e.quit=!0)},stopped(e){let t=e.pop();e.estack.push(new Ce),t.type===d.ARRAY&&t.executable?e.estack.push(new O(t.value)):e.execObject(t)},quit(e){e.quit=!0}},Ke={dict(e){e.popInt(),e.push(S.dict())},"<<"(e){e.push(x)},">>"(e){let t=[];for(;;){if(!e.ostack.length)throw new C(`unmatchedmark`);let n=e.ostack.pop();if(n.type===d.MARK)break;t.push(n)}if(t.length%2!=0)throw new C(`rangecheck`);let n=S.dict();for(let e=0;e=n.value.length)throw new C(`rangecheck`);return e.push(n.value.get(t.value))}if(n.type===d.STRING){if(t.type!==d.INTEGER)throw new C(`typecheck`);if(t.value<0||t.value>=n.value.length)throw new C(`rangecheck`);return e.push(S.int(n.value.get(t.value)))}if(n.type===d.DICT){let r=n.value.get(t);if(r===void 0)throw new C(`undefined`);return e.push(r)}throw new C(`typecheck`)},put(e){let t=e.pop(),n=e.pop(),r=e.pop();if((r.type===d.ARRAY||r.type===d.STRING||r.type===d.DICT)&&e.recordMutation(r.value),r.type===d.ARRAY){if(n.type!==d.INTEGER)throw new C(`typecheck`);if(n.value<0||n.value>=r.value.length)throw new C(`rangecheck`);r.value.put(n.value,t);return}if(r.type===d.STRING){if(n.type!==d.INTEGER||t.type!==d.INTEGER)throw new C(`typecheck`);if(n.value<0||n.value>=r.value.length)throw new C(`rangecheck`);r.value.put(n.value,t.value);return}if(r.type===d.DICT)return void r.value.put(n,t);throw new C(`typecheck`)},getinterval(e){let t=e.popInt(),n=e.popInt(),r=e.pop();if(r.type===d.ARRAY){if(n<0||t<0||n+t>r.value.length)throw new C(`rangecheck`);return e.push(new b(d.ARRAY,r.value.getInterval(n,t),r.executable))}if(r.type===d.STRING){if(n<0||t<0||n+t>r.value.length)throw new C(`rangecheck`);return e.push(new b(d.STRING,r.value.getInterval(n,t),!1))}throw new C(`typecheck`)},putinterval(e){let t=e.pop(),n=e.popInt(),r=e.pop();if((r.type===d.ARRAY||r.type===d.STRING)&&e.recordMutation(r.value),r.type===d.ARRAY&&t.type===d.ARRAY){if(n<0||n+t.value.length>r.value.length)throw new C(`rangecheck`);for(let e=0;er.value.length)throw new C(`rangecheck`);for(let e=0;e=0;r--)t.value.put(r,e.pop());e.push(t)}},Ye={string(e){let t=e.popInt();if(t<0)throw new C(`rangecheck`);e.push(S.string(new _(new Uint8Array(t))))}},Xe={integer:`integertype`,real:`realtype`,boolean:`booleantype`,name:`nametype`,string:`stringtype`,array:`arraytype`,dict:`dicttype`,operator:`operatortype`,mark:`marktype`,null:`nulltype`,file:`filetype`,fontid:`fonttype`,save:`savetype`};function L(e){switch(e.type){case d.INTEGER:return String(e.value);case d.REAL:return Number.isInteger(e.value)?e.value.toFixed(1):String(e.value);case d.BOOLEAN:return e.value?`true`:`false`;case d.NAME:return g(e.value);case d.STRING:return e.value.toJSString();default:return`--`+e.type+`--`}}function Ze(e,t){for(let n=0;ne.charCodeAt(0))),xt=new Set(Array.from(`mwMW@%`).map(e=>e.charCodeAt(0)));function St(e,t){return e.mono?.6:bt.has(t)?.28:xt.has(t)?.83:t>=65&&t<=90?.68:.5}function Ct(e,t,n){let r=0;for(let i=0;i=7&&(H(t,e,n[1][0],n[1][1],n[2][0],n[2][1],n[3][0],n[3][1]),H(t,e,n[4][0],n[4][1],n[5][0],n[5][1],n[6][0],n[6][1])),e.ps.push(r[2]),e.ps.push(r[1]);break}case 3:e.ps.push(r[0]==null?3:r[0]);break;default:for(let t=r.length-1;t>=0;t--)e.ps.push(r[t])}}function Et(e,t,n,r,i,a){if(a>30)return;let o=r.st,s=0;for(;s=32){let t;c<=246?t=c-139:c<=250?t=(c-247)*256+e[s++]+108:c<=254?t=-(c-251)*256-e[s++]-108:(t=e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3],s+=4),o.push(t);continue}switch(c){case 13:r.sbx=o[0],r.width=o[1],r.x=r.sbx,r.y=0,o.length=0;break;case 9:wt(n,r),o.length=0;break;case 21:{let e=o.pop(),t=o.pop();r.x+=t,r.y+=e,r.flexing?r.flexPts.push([r.x,r.y]):B(n,r,r.x,r.y),o.length=0;break}case 22:{let e=o.pop();r.x+=e,r.flexing?r.flexPts.push([r.x,r.y]):B(n,r,r.x,r.y),o.length=0;break}case 4:{let e=o.pop();r.y+=e,r.flexing?r.flexPts.push([r.x,r.y]):B(n,r,r.x,r.y),o.length=0;break}case 5:{let e=o.pop(),t=o.pop();V(n,r,r.x+t,r.y+e),o.length=0;break}case 6:{let e=o.pop();V(n,r,r.x+e,r.y),o.length=0;break}case 7:{let e=o.pop();V(n,r,r.x,r.y+e),o.length=0;break}case 8:{let e=o.pop(),t=o.pop(),i=o.pop(),a=o.pop(),s=o.pop(),c=o.pop(),l=r.x+c,u=r.y+s,d=l+a,f=u+i;H(n,r,l,u,d,f,d+t,f+e),o.length=0;break}case 30:{let e=o.pop(),t=o.pop(),i=o.pop(),a=o.pop(),s=r.x,c=r.y+a,l=s+i,u=c+t;H(n,r,s,c,l,u,l+e,u),o.length=0;break}case 31:{let e=o.pop(),t=o.pop(),i=o.pop(),a=o.pop(),s=r.x+a,c=r.y,l=s+i,u=c+t;H(n,r,s,c,l,u,l,u+e),o.length=0;break}case 10:{let e=t[o.pop()];e&&Et(e,t,n,r,i,a+1);break}case 11:return;case 14:r.done=!0;break;case 1:case 3:o.length=0;break;case 12:switch(e[s++]){case 0:case 1:case 2:o.length=0;break;case 6:{let e=o.pop(),t=o.pop(),a=o.pop(),s=o.pop(),c=o.pop();o.length=0,i.seac&&i.seac(r,n,c,s,a,t,e),r.done=!0;break}case 7:r.sbx=o[0],r.sby=o[1],r.width=o[2],r.x=r.sbx,r.y=r.sby,o.length=0;break;case 12:{let e=o.pop(),t=o.pop();o.push(t/e);break}case 16:{let e=o.pop(),t=o.pop(),i=[];for(let e=0;e{let i=n.encoding?n.encoding[e]:void 0,a=i!=null&&n.charstrings.get(i)||n.charstrings.get(e);return a?Dt(a,{subrs:n.subrs||[],sink:t}).width:.5*r})}function Mt(e,t,n){At(e,t,n,(e,t)=>{let r=n.cmapLookup(e);return n.glyphOutline(r,t),n.advanceWidth(r)})}var Nt={gsave(e){e.gsStack.push(e.gstate.clone()),e.driver.save()},grestore(e){e.gsStack.length&&(e.gstate=e.gsStack.pop(),e.driver.restore())},grestoreall(e){for(;e.gsStack.length;)e.gstate=e.gsStack.pop()},setlinewidth(e){e.gstate.lineWidth=e.popNum().value},currentlinewidth(e){e.push(S.real(e.gstate.lineWidth))},setlinecap(e){e.gstate.lineCap=e.popInt()},currentlinecap(e){e.push(S.int(e.gstate.lineCap))},setlinejoin(e){e.gstate.lineJoin=e.popInt()},currentlinejoin(e){e.push(S.int(e.gstate.lineJoin))},setmiterlimit(e){e.gstate.miterLimit=e.popNum().value},currentmiterlimit(e){e.push(S.real(e.gstate.miterLimit))},setflat(e){e.gstate.flatness=e.popNum().value},currentflat(e){e.push(S.real(e.gstate.flatness))},setdash(e){let t=e.popNum().value,n=e.popType(d.ARRAY);e.gstate.dashArray=Array.from(n.value).map(e=>e.value),e.gstate.dashOffset=t},setgray(t){U(t,e(t.popNum().value))},setrgbcolor(e){let t=e.popNum().value,n=e.popNum().value,r=e.popNum().value;U(e,o(r,n,t))},setcmykcolor(e){let n=e.popNum().value,r=e.popNum().value,i=e.popNum().value,a=e.popNum().value;U(e,t(a,i,r,n))},sethsbcolor(e){let t=e.popNum().value,n=e.popNum().value,r=e.popNum().value;U(e,i(r,n,t))},showpage(e){e.driver.showPage()},erasepage(){},findfont(e){let t=e.pop(),n=t.type===d.NAME?g(t.value):t.type===d.STRING?t.value.toJSString():`Helvetica`,r=e.fonts&&e.fonts.get(n);e.push(new b(d.FONTID,r?{...r,size:1}:{...z(n),size:1},!1))},definefont(e){let t=e.pop();e.pop(),e.push(t)},scalefont(e){let t=e.popNum().value,n=e.pop();if(n.type!==d.FONTID)throw new C(`typecheck`);e.push(new b(d.FONTID,{...n.value,size:n.value.size*t},!1))},setfont(e){let t=e.pop();if(t.type!==d.FONTID)throw new C(`typecheck`);e.gstate.font=t},currentfont(e){e.push(e.gstate.font||new b(d.FONTID,{...z(`Helvetica`),size:1},!1))},show(e){let t=e.popType(d.STRING);if(!e.gstate.hasCP)throw new C(`nocurrentpoint`);let n=t.value.toJSString(),r=e.gstate.font?e.gstate.font.value:{...z(`Helvetica`),size:12};if(r.charstrings){jt(e,n,r);return}if(r.truetype){Mt(e,n,r);return}let i=k([1,0,0,-1,e.gstate.cpx,e.gstate.cpy],e.gstate.ctm);e.driver.showText(n,i,r.size,c(e.gstate.fillPaint),r),e.gstate.cpx+=Ct(r,n,r.size)},stringwidth(e){let t=e.popType(d.STRING),n=e.gstate.font?e.gstate.font.value:{...z(`Helvetica`),size:12};e.push(S.real(Ct(n,t.value.toJSString(),n.size))),e.push(S.real(0))}},G=(e,t,n)=>A(e.gstate.ctm,t,n);function K(e,t,n){e.gstate.cpx=t,e.gstate.cpy=n,e.gstate.hasCP=!0,e.gstate.extendBBox(t,n)}function q(e){if(!e.gstate.hasCP)throw new C(`nocurrentpoint`)}function Pt(e,t){let n=e.popNum().value,r=e.popNum().value,i=e.popNum().value,a=e.popNum().value,o=e.popNum().value,{start:s,segs:c,end:l}=Ie(o,a,i,r,n,t),[u,d]=G(e,s[0],s[1]);e.gstate.hasCP?e.gstate.path.lineTo(u,d):(e.gstate.path.moveTo(u,d),e.gstate.startx=s[0],e.gstate.starty=s[1]);for(let[t,n,r]of c){let i=G(e,t[0],t[1]),a=G(e,n[0],n[1]),o=G(e,r[0],r[1]);e.gstate.path.curveTo(i[0],i[1],a[0],a[1],o[0],o[1])}e.gstate.extendBBox(o-i,a-i),e.gstate.extendBBox(o+i,a+i),e.gstate.cpx=l[0],e.gstate.cpy=l[1],e.gstate.hasCP=!0}var Ft={newpath(e){e.gstate.path=new M,e.gstate.hasCP=!1,e.gstate.bbox=null},moveto(e){let t=e.popNum().value,n=e.popNum().value,[r,i]=G(e,n,t);e.gstate.path.moveTo(r,i),e.gstate.startx=n,e.gstate.starty=t,K(e,n,t)},rmoveto(e){let t=e.popNum().value,n=e.popNum().value;q(e);let r=e.gstate.cpx+n,i=e.gstate.cpy+t,[a,o]=G(e,r,i);e.gstate.path.moveTo(a,o),e.gstate.startx=r,e.gstate.starty=i,K(e,r,i)},lineto(e){let t=e.popNum().value,n=e.popNum().value;q(e);let[r,i]=G(e,n,t);e.gstate.path.lineTo(r,i),K(e,n,t)},rlineto(e){let t=e.popNum().value,n=e.popNum().value;q(e);let r=e.gstate.cpx+n,i=e.gstate.cpy+t,[a,o]=G(e,r,i);e.gstate.path.lineTo(a,o),K(e,r,i)},curveto(e){let t=e.popNum().value,n=e.popNum().value,r=e.popNum().value,i=e.popNum().value,a=e.popNum().value,o=e.popNum().value;q(e);let s=G(e,o,a),c=G(e,i,r),l=G(e,n,t);e.gstate.path.curveTo(s[0],s[1],c[0],c[1],l[0],l[1]),e.gstate.extendBBox(o,a),e.gstate.extendBBox(i,r),K(e,n,t)},rcurveto(e){let t=e.popNum().value,n=e.popNum().value,r=e.popNum().value,i=e.popNum().value,a=e.popNum().value,o=e.popNum().value;q(e);let s=e.gstate.cpx,c=e.gstate.cpy,l=s+o,u=c+a,d=s+i,f=c+r,p=s+n,m=c+t,h=G(e,l,u),g=G(e,d,f),_=G(e,p,m);e.gstate.path.curveTo(h[0],h[1],g[0],g[1],_[0],_[1]),e.gstate.extendBBox(l,u),e.gstate.extendBBox(d,f),K(e,p,m)},closepath(e){e.gstate.path.isEmpty||(e.gstate.path.close(),e.gstate.cpx=e.gstate.startx,e.gstate.cpy=e.gstate.starty,e.gstate.hasCP=!0)},currentpoint(e){q(e),e.push(S.real(e.gstate.cpx)),e.push(S.real(e.gstate.cpy))},arc(e){Pt(e,!1)},arcn(e){Pt(e,!0)},pathbbox(e){if(!e.gstate.bbox)throw new C(`nocurrentpoint`);let[t,n,r,i]=e.gstate.bbox;e.push(S.real(t)),e.push(S.real(n)),e.push(S.real(r)),e.push(S.real(i))}};function It(e){let t=e.lineWidth*Fe(e.ctm);return t>0?t:1}function Lt(e){let t=Fe(e.ctm);return{width:It(e),cap:e.lineCap,join:e.lineJoin,miter:e.miterLimit,dash:e.dashArray.map(e=>e*t),offset:e.dashOffset*t}}function J(e){e.gstate.path=new M,e.gstate.hasCP=!1,e.gstate.bbox=null}var Rt={fill(e){e.driver.fill(e.gstate.path,`nonzero`,c(e.gstate.fillPaint)),J(e)},eofill(e){e.driver.fill(e.gstate.path,`evenodd`,c(e.gstate.fillPaint)),J(e)},stroke(e){e.driver.stroke(e.gstate.path,Lt(e.gstate),c(e.gstate.strokePaint)),J(e)},clip(e){e.driver.clip(e.gstate.path,`nonzero`),e.gstate.clip={path:e.gstate.path.clone(),rule:`nonzero`}},eoclip(e){e.driver.clip(e.gstate.path,`evenodd`),e.gstate.clip={path:e.gstate.path.clone(),rule:`evenodd`}}},Y=e=>Array.from(e.value).map(e=>{if(e.type!==d.INTEGER&&e.type!==d.REAL)throw new C(`typecheck`);return e.value});function X(e){let t=e.popType(d.ARRAY);if(t.value.length!==6)throw new C(`rangecheck`);return Y(t)}var zt=e=>S.array(e.map(e=>S.real(e)),!1);function Z(e,t){for(let n=0;n<6;n++)e.value.put(n,S.real(t[n]));return e}var Bt=[Re,Ve,Ue,Ge,Ke,qe,Je,Ye,Qe,$e,vt,Nt,Ft,Rt,{matrix(e){e.push(zt(ke()))},currentmatrix(e){let t=e.popType(d.ARRAY);if(t.value.length!==6)throw new C(`rangecheck`);e.push(Z(t,e.gstate.ctm))},setmatrix(e){e.gstate.ctm=X(e)},concat(e){e.gstate.ctm=k(X(e),e.gstate.ctm)},concatmatrix(e){let t=e.popType(d.ARRAY),n=X(e),r=X(e);e.push(Z(t,k(r,n)))},translate(e){let t=e.pop();if(t.type===d.ARRAY){let n=e.popNum().value,r=e.popNum().value;e.push(Z(t,[1,0,0,1,r,n]))}else{let n=t.value,r=e.popNum().value;e.gstate.ctm=Me(e.gstate.ctm,r,n)}},scale(e){let t=e.pop();if(t.type===d.ARRAY){let n=e.popNum().value,r=e.popNum().value;e.push(Z(t,[r,0,0,n,0,0]))}else{let n=t.value,r=e.popNum().value;e.gstate.ctm=Ne(e.gstate.ctm,r,n)}},rotate(e){let t=e.pop();if(t.type===d.ARRAY){let n=e.popNum().value*Math.PI/180,r=Math.cos(n),i=Math.sin(n);e.push(Z(t,[r,i,-i,r,0,0]))}else e.gstate.ctm=Pe(e.gstate.ctm,t.value)},transform(e){let t=e.pop(),n,r,i;t.type===d.ARRAY?(n=Y(t),i=e.popNum().value,r=e.popNum().value):(n=e.gstate.ctm,i=t.value,r=e.popNum().value);let[a,o]=A(n,r,i);e.push(S.real(a)),e.push(S.real(o))},dtransform(e){let t=e.pop(),n,r,i;t.type===d.ARRAY?(n=Y(t),i=e.popNum().value,r=e.popNum().value):(n=e.gstate.ctm,i=t.value,r=e.popNum().value);let[a,o]=Ae(n,r,i);e.push(S.real(a)),e.push(S.real(o))},itransform(e){let t=e.pop(),n,r,i;t.type===d.ARRAY?(n=Y(t),i=e.popNum().value,r=e.popNum().value):(n=e.gstate.ctm,i=t.value,r=e.popNum().value);let a=j(n);if(!a)throw new C(`undefinedresult`);let[o,s]=A(a,r,i);e.push(S.real(o)),e.push(S.real(s))},idtransform(e){let t=e.pop(),n,r,i;t.type===d.ARRAY?(n=Y(t),i=e.popNum().value,r=e.popNum().value):(n=e.gstate.ctm,i=t.value,r=e.popNum().value);let a=j(n);if(!a)throw new C(`undefinedresult`);let[o,s]=Ae(a,r,i);e.push(S.real(o)),e.push(S.real(s))},invertmatrix(e){let t=e.popType(d.ARRAY),n=j(X(e));if(!n)throw new C(`undefinedresult`);e.push(Z(t,n))}},{save(e){e.push(e.save())},restore(e){e.restore(e.pop())},vmstatus(e){e.push(S.int(e.saveLevel)),e.push(S.int(0)),e.push(S.int(0))}}];function Vt(e){for(let t of Bt)for(let[n,r]of Object.entries(t))typeof r==`function`&&e.systemdict.value.put(S.name(n),S.op(n,r));e.systemdict.value.put(S.name(`true`),S.bool(!0)),e.systemdict.value.put(S.name(`false`),S.bool(!1)),e.systemdict.value.put(S.name(`null`),ie)}function Ht(e){typeof process<`u`&&process.stdout?process.stdout.write(e):typeof console<`u`&&console.log(e.replace(/\n$/,``))}var Ut=class{constructor({out:e,driver:t}={}){this.ostack=[],this.estack=[],this.hold=[],this.systemdict=S.dict(),this.userdict=S.dict(),this.dictstack=new se(this.systemdict,this.userdict),this.out=e||Ht,this.quit=!1,this.gstate=new Le,this.gsStack=[],this.driver=t||new r,this.saveStack=[],this.saveLevel=0,this.fonts=new Map,Vt(this)}registerFont(e,t){this.fonts.set(e,t)}recordMutation(e){if(this.saveStack.length===0)return;let t=this.saveStack[this.saveStack.length-1],n=Ee(e);t.touched.has(n)||t.touched.set(n,De(e))}save(){this.saveLevel++;let e={level:this.saveLevel,touched:new Map,gstate:this.gstate.clone(),gsStack:this.gsStack.map(e=>e.clone()),dictStack:this.dictstack.stack.slice()};return this.saveStack.push(e),new b(d.SAVE,e)}restore(e){if(e.type!==d.SAVE)throw new C(`typecheck`);let t=e.value,n=this.saveStack.indexOf(t);if(n<0)throw new C(`invalidrestore`);for(let e=this.saveStack.length-1;e>=n;e--)for(let t of this.saveStack[e].touched.values())Oe(t);this.gstate=t.gstate,this.gsStack=t.gsStack,this.dictstack.stack=t.dictStack,this.saveLevel=t.level-1,this.saveStack.length=n}push(e){this.ostack.push(e)}pop(){if(this.ostack.length===0)throw new C(`stackunderflow`);return this.ostack.pop()}popNum(){let e=this.pop();if(e.type!==d.INTEGER&&e.type!==d.REAL)throw new C(`typecheck`);return e}popInt(){let e=this.pop();if(e.type!==d.INTEGER)throw new C(`typecheck`);return e.value}popType(e){let t=this.pop();if(t.type!==e)throw new C(`typecheck`);return t}count(){return this.ostack.length}execObject(e){if(e.type===d.NAME&&e.executable){this.execName(e);return}if(e.type===d.OPERATOR&&e.executable){e.value.fn(this);return}this.ostack.push(e)}execName(e){let t=this.dictstack.load(e);if(t===void 0)throw new C(`undefined`,g(e.value));if(t.type===d.OPERATOR){t.value.fn(this);return}if(t.type===d.ARRAY&&t.executable){this.estack.push(new O(t.value));return}this.ostack.push(t)}run(){for(;this.estack.length&&!this.quit;)try{this.estack[this.estack.length-1].tick(this)}catch(e){if(e instanceof C){if(!Te(this))throw this.estack.length=0,e}else throw e}}runString(e){this.estack.push(new ge(new ue(e))),this.run()}},Q=e=>String(Math.round(e*1e3)/1e3),Wt=class extends r{constructor(){super(),this.parts=[]}beginPage(e,t){super.beginPage(e,t),this.parts=[]}_d(e){let t=``;for(let n of e.segs)n.op===`M`?t+=`M${Q(n.x)} ${Q(n.y)}`:n.op===`L`?t+=`L${Q(n.x)} ${Q(n.y)}`:n.op===`C`?t+=`C${Q(n.x1)} ${Q(n.y1)} ${Q(n.x2)} ${Q(n.y2)} ${Q(n.x3)} ${Q(n.y3)}`:n.op===`Z`&&(t+=`Z`);return t}fill(e,t,r){this.parts.push(``)}stroke(e,t,r){let i=t.dash&&t.dash.length?` stroke-dasharray="${t.dash.map(Q).join(` `)}"`+(t.offset?` stroke-dashoffset="${Q(t.offset)}"`:``):``;this.parts.push(``)}clip(e,t){}showText(e,t,r,i,a){let o=e=>e.replace(/&/g,`&`).replace(//g,`>`),s=(a.italic?` font-style="italic"`:``)+(a.bold?` font-weight="bold"`:``);this.parts.push(`${o(e)}`)}toSVG(){return`\n${this.parts.join(` +`)}\n\n`}};function Gt(e,t,{width:n=612,height:r=792,scale:i=1,out:a}={}){let o=new Ut({driver:t,out:a});return o.gstate.ctm=[i,0,0,-i,0,r],t.beginPage(n,r),o.runString(e),t.endPage(),o}var Kt=[0,0,612,792];function qt(e){let t=u(e),n=Jt(e,t);return{source:e,dsc:t,pages:n,pageCount:n.length}}function Jt(e,t){if(!t.pageMarkers.length)return[{label:`1`,ordinal:1,prolog:``,content:e}];let n=e.slice(0,t.pageMarkers[0].index),r=[];for(let i=0;i=0?t.trailerIndex:e.length;r.push({label:t.pageMarkers[i].label,ordinal:i+1,prolog:n,content:e.slice(a,o)})}return r}function Yt(e,t=0){return e.dsc.boundingBox||Kt}function Xt(e,t=0){let[,,n,r]=Yt(e,t);return{width:n,height:r}}function $(e,t,n,r={}){let i=e.pages[t];if(!i)throw RangeError(`page ${t} out of range (0..${e.pageCount-1})`);let{width:a,height:o}=Xt(e,t);return Gt(i.prolog+` +`+i.content,n,{width:a,height:o,scale:1,...r})}function Zt(e,t,n={}){let r=new Wt;return $(e,t,r,n),r.toSVG()}var Qt=class extends r{constructor(){super(),this.runs=[]}showText(e){this.runs.push(e)}};function $t(e,t){let n=new Qt;return $(e,t,n,{}),n.runs.join(` `)}export{$t as extractText,qt as loadDocument,Yt as pageBBox,Xt as pageSize,$ as renderPageToDriver,Zt as renderPageToSVG}; \ No newline at end of file diff --git a/dist-embed/assets/docx-renderer-DbfurWuz.js b/dist-embed/assets/docx-renderer-DbfurWuz.js new file mode 100644 index 0000000..224b207 --- /dev/null +++ b/dist-embed/assets/docx-renderer-DbfurWuz.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./lib-sUWhpJan.js","./rolldown-runtime-DAXXjFlN.js","./jszip.min-C__FR9jF.js"])))=>i.map(i=>d[i]); +import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./reader-Bd1ccloG.js";import{t as n}from"./base-renderer-DM6Nw1yD.js";var r=class extends n{async load(n,r,i){await super.load(n,r,i);let a;try{let n=await t(()=>import(`./lib-sUWhpJan.js`).then(t=>e(t.default)),__vite__mapDeps([0,1,2]),import.meta.url);a=n.default??n}catch(e){throw Error(`mammoth could not be loaded: ${e.message}`)}let o=await a.convertToHtml({arrayBuffer:n});o.messages?.length&&console.warn(`[DOCX] conversion messages:`,o.messages),r.innerHTML=``;let s=document.createElement(`div`);s.className=`doc-page`,s.dataset.page=1,s.innerHTML=o.value,r.appendChild(s),this.numPages=1}};export{r as DOCXRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/driver-0cTj10HJ.js b/dist-embed/assets/driver-0cTj10HJ.js new file mode 100644 index 0000000..77ac508 --- /dev/null +++ b/dist-embed/assets/driver-0cTj10HJ.js @@ -0,0 +1 @@ +var e=e=>e<0?0:e>1?1:e,t=e=>({space:`gray`,c:[e]}),n=(e,t,n)=>({space:`rgb`,c:[e,t,n]}),r=(e,t,n,r)=>({space:`cmyk`,c:[e,t,n,r]});function i(e,t,r){e=(e%1+1)%1;let i=Math.floor(e*6),a=e*6-i,o=r*(1-t),s=r*(1-a*t),c=r*(1-(1-a)*t),[l,u,d]=[[r,c,o],[s,r,o],[o,r,c],[o,s,r],[c,o,r],[r,o,s]][i%6];return n(l,u,d)}function a(t){switch(t.space){case`gray`:{let n=e(t.c[0]);return{r:n,g:n,b:n,a:1}}case`rgb`:return{r:e(t.c[0]),g:e(t.c[1]),b:e(t.c[2]),a:1};case`cmyk`:{let[n,r,i,a]=t.c;return{r:(1-e(n))*(1-e(a)),g:(1-e(r))*(1-e(a)),b:(1-e(i))*(1-e(a)),a:1}}default:return{r:0,g:0,b:0,a:1}}}function o(t){let n=t=>Math.round(e(t)*255).toString(16).padStart(2,`0`);return`#`+n(t.r)+n(t.g)+n(t.b)}function s(t){let n=t=>Math.round(e(t)*255);return`rgba(${n(t.r)},${n(t.g)},${n(t.b)},${t.a})`}var c=class{beginPage(e,t){this.width=e,this.height=t}save(){}restore(){}fill(e,t,n){}stroke(e,t,n){}clip(e,t){}showText(e,t,n,r,i){}showPage(){}endPage(){}},l=[`butt`,`round`,`square`],u=[`miter`,`round`,`bevel`];export{t as a,s as c,r as i,o as l,c as n,i as o,u as r,n as s,l as t,a as u}; \ No newline at end of file diff --git a/dist-embed/assets/epub-BRc42rrU.js b/dist-embed/assets/epub-BRc42rrU.js new file mode 100644 index 0000000..8ab5dbc --- /dev/null +++ b/dist-embed/assets/epub-BRc42rrU.js @@ -0,0 +1,2 @@ +import{c as e,n as t,o as n,s as r}from"./epubcfi-CnTj7mGe.js";import{a as i,i as a,n as o,r as s,t as c}from"./classPrivateFieldSet2-CUhwy2NK.js";import{t as l}from"./defineProperty-BbfpZ9Tg.js";var u={CONTAINER:`urn:oasis:names:tc:opendocument:xmlns:container`,XHTML:`http://www.w3.org/1999/xhtml`,OPF:`http://www.idpf.org/2007/opf`,EPUB:`http://www.idpf.org/2007/ops`,DC:`http://purl.org/dc/elements/1.1/`,DCTERMS:`http://purl.org/dc/terms/`,ENC:`http://www.w3.org/2001/04/xmlenc#`,NCX:`http://www.daisy.org/z3986/2005/ncx/`,XLINK:`http://www.w3.org/1999/xlink`,SMIL:`http://www.w3.org/ns/SMIL`},d={XML:`application/xml`,NCX:`application/x-dtbncx+xml`,XHTML:`application/xhtml+xml`,HTML:`text/html`,CSS:`text/css`,SVG:`image/svg+xml`,JS:/\/(x-)?(javascript|ecmascript)/},f={a11y:`http://www.idpf.org/epub/vocab/package/a11y/#`,dcterms:`http://purl.org/dc/terms/`,marc:`http://id.loc.gov/vocabulary/`,media:`http://www.idpf.org/epub/vocab/overlays/#`,onix:`http://www.editeur.org/ONIX/book/codelists/current.html#`,rendition:`http://www.idpf.org/vocab/rendition/#`,schema:`http://schema.org/`,xsd:`http://www.w3.org/2001/XMLSchema#`,msv:`http://www.idpf.org/epub/vocab/structure/magazine/#`,prism:`http://www.prismstandard.org/specifications/3.0/PRISM_CV_Spec_3.0.htm#`},p={art:`artist`,aut:`author`,clr:`colorist`,edt:`editor`,ill:`illustrator`,nrt:`narrator`,trl:`translator`,pbl:`publisher`},m={"02":`isbn`,"06":`doi`,15:`isbn`,26:`doi`,34:`issn`},h=e=>e.toLowerCase().replace(/[-:](.)/g,(e,t)=>t.toUpperCase()),g=e=>e?e.replace(/[\t\n\f\r ]+/g,` `).replace(/^[\t\n\f\r ]+/,``).replace(/[\t\n\f\r ]+$/,``):``,_=(e,t,n)=>n?n=>n.getAttribute(e)?.split(/\s/)?.includes(t):typeof t==`function`?n=>t(n.getAttribute(e)):n=>n.getAttribute(e)===t,v=(...e)=>t=>t?Object.fromEntries(e.map(e=>[h(e),t.getAttribute(e)])):null,y=e=>g(e?.textContent),b=(e,t)=>{let n=e.lookupNamespaceURI(null)===t||e.lookupPrefix(t),r=n?(e,n)=>e=>e.namespaceURI===t&&e.localName===n:(e,t)=>e=>e.localName===t;return{$:(e,t)=>[...e.children].find(r(e,t)),$$:(e,t)=>[...e.children].filter(r(e,t)),$$$:n?(e,n)=>[...e.getElementsByTagNameNS(t,n)]:(e,t)=>[...e.getElementsByTagName(t)]}},x=(e,t)=>{try{if(t.includes(`:`))return new URL(e,t);let n=`https://invalid.invalid/`,r=new URL(e,n+t);return r.search=``,decodeURI(r.href.replace(n,``))}catch(t){return console.warn(t),e}},S=e=>/^(?!blob)\w+:/i.test(e),ee=(e,t)=>{if(!e)return t;let n=e.replace(/\/$/,``).split(`/`),r=t.replace(/\/$/,``).split(`/`),i=(n.length>r.length?n:r).findIndex((e,t)=>n[t]!==r[t]);return i<0?``:Array(n.length-i).fill(`..`).concat(r.slice(i)).join(`/`)},te=e=>e.slice(0,e.lastIndexOf(`/`)+1),C=async(e,t,n)=>{let r=[];e.replace(t,(...e)=>(r.push(e),null));let i=[];for(let e of r)i.push(await n(...e));return e.replace(t,()=>i.shift())},w=e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`),T=e=>{for(let[t,n]of Object.entries(e))n==null?delete e[t]:Array.isArray(n)?(e[t]=n.filter(e=>e).map(e=>typeof e==`object`&&!Array.isArray(e)?T(e):e),e[t].length?e[t].length===1&&(e[t]=e[t][0]):delete e[t]):typeof n==`object`&&(e[t]=T(n),Object.keys(n).length||delete e[t]);let t=Object.keys(e);return t.length===1&&t[0]===`name`?e[t[0]]:e},ne=e=>{let t=new Map(Object.entries(f)),n=e.documentElement.getAttributeNS(u.EPUB,`prefix`)||e.documentElement.getAttribute(`prefix`);if(n)for(let[,e,r]of n.matchAll(/(.+): +(.+)[ \t\r\n]*/g))t.set(e,r);return t},re=(e,t)=>{if(!e)return null;let[n,r]=e.split(`:`),i=r?n:null,a=r||n,o=t.get(i);return o?o+a:null},E=e=>{let{$:t}=b(e,u.OPF),n=t(e.documentElement,`metadata`),r=Object.groupBy(n.children,e=>e.namespaceURI===u.DC?`dc`:e.namespaceURI===u.OPF&&e.localName===`meta`?e.hasAttribute(`name`)?`legacyMeta`:`meta`:``),i=n.getAttribute(`xml:lang`)??e.documentElement.getAttribute(`xml:lang`)??`und`,a=ne(e),o=e=>{let t=e.getAttribute(`property`),n=e.getAttribute(`scheme`);return{property:re(t,a)??t,scheme:re(n,a)??n,lang:e.getAttribute(`xml:lang`),value:y(e),props:c(e),attrs:Object.fromEntries(Array.from(e.attributes).filter(e=>e.namespaceURI===u.OPF).map(e=>[e.localName,e.value]))}},s=Map.groupBy(r.meta??[],e=>e.getAttribute(`refines`)),c=e=>{let t=s.get(e?`#`+e.getAttribute(`id`):null);return t?Object.groupBy(t.map(o),e=>e.property):null},l=Object.fromEntries(Object.entries(Object.groupBy(r.dc,e=>e.localName)).map(([e,t])=>[e,t.map(o)])),d=c()??{},g=Object.fromEntries(r.legacyMeta?.map(e=>[e.getAttribute(`name`),e.getAttribute(`content`)])??[]),_=e=>e?.[0]?.value,v=(e,t)=>_(e?.props?.[t]),x=e=>{var t;if(!e)return null;let n=e.props?.[`alternate-script`]??[],r=e.attrs[`alt-rep`];if(!n.length&&(!e.lang||e.lang===i)&&!r)return e.value;let a={[e.lang??i]:e.value};r&&(a[e.attrs[`alt-rep-lang`]]=r);for(let e of n)a[t=e.lang]??(a[t]=e.value);return a},S=e=>e?{name:x(e),sortAs:x(e.props?.[`file-as`]?.[0])??e.attrs[`file-as`],role:e.props?.role?.filter(e=>e.scheme===f.marc+`relators`)?.map(e=>e.value)??[e.attrs.role],code:v(e,`term`)??e.attrs.term,scheme:v(e,`authority`)??e.attrs.authority}:null,ee=e=>({name:x(e),position:_(e.props?.[`group-position`])}),te=e=>{let{value:t}=e;if(/^urn:/i.test(t))return t;if(/^doi:/i.test(t))return`urn:${t}`;let n=e.props?.[`identifier-type`];if(!n){let n=e.attrs.scheme;return n?/^(doi|isbn|uuid)$/i.test(n)?`urn:${n}:${t}`:{scheme:n,value:t}:t}if(n.scheme===f.onix+`codelist5`){let e=m[n.value];if(e)return`urn:${e}:${t}`}return t},C=Object.groupBy(d[`belongs-to-collection`]??[],e=>v(e,`collection-type`)===`series`?`series`:`collection`),w=l.title?.find(e=>v(e,`title-type`)===`main`)??l.title?.[0],E={identifier:de(e),title:x(w),sortAs:x(w?.props?.[`file-as`]?.[0])??w?.attrs?.[`file-as`]??g?.[`calibre:title_sort`],subtitle:l.title?.find(e=>v(e,`title-type`)===`subtitle`)?.value,language:l.language?.map(e=>e.value),description:_(l.description),publisher:l.publisher?.map(S),published:l.date?.find(e=>e.attrs.event===`publication`)?.value??_(l.date),modified:_(d[f.dcterms+`modified`])??l.date?.find(e=>e.attrs.event===`modification`)?.value,subject:l.subject?.map(S),belongsTo:{collection:C.collection?.map(ee),series:C.series?.map(ee)??g?.[`calibre:series`]?{name:g?.[`calibre:series`],position:parseFloat(g?.[`calibre:series_index`])}:null},altIdentifier:l.identifier?.map(te),source:l.source?.map(te),rights:_(l.rights),pageBreakSource:_(d.pageBreakSource)},D=e=>t=>{let n=new Set(t.role?.map(t=>p[t]??e));return[n.size?n:[e],t]};for(let[e,t]of[].concat(l.creator?.map(S)?.map(D(`author`))??[],l.contributor?.map(S)?.map(D(`contributor`))??[]))for(let n of e)E[n]?E[n].push(t):E[n]=[t];T(E),E.altIdentifier===E.identifier&&delete E.altIdentifier;let O={},A={};for(let[e,t]of Object.entries(d))e.startsWith(f.rendition)?O[h(e.replace(f.rendition,``))]=_(t):e.startsWith(f.media)&&(A[h(e.replace(f.media,``))]=_(t));return A.duration&&(A.duration=k(A.duration)),{metadata:E,rendition:O,media:A}},D=(e,t=e=>e)=>{let{$:n,$$:r,$$$:i}=b(e,u.XHTML),a=e=>e?decodeURI(t(e)):null,o=e=>t=>{let r=n(t,`a`)??n(t,`span`),i=n(t,`ol`),o=a(r?.getAttribute(`href`)),c={label:y(r)||r?.getAttribute(`title`),href:o,subitems:s(i)};return e&&(c.type=r?.getAttributeNS(u.EPUB,`type`)?.split(/\s/)),c},s=(e,t)=>e?r(e,`li`).map(o(t)):null,c=(e,t)=>s(n(e,`ol`),t),l=i(e,`nav`),d=null,f=null,p=null,m=[];for(let e of l){let t=e.getAttributeNS(u.EPUB,`type`)?.split(/\s/)??[];t.includes(`toc`)?d??(d=c(e)):t.includes(`page-list`)?f??(f=c(e)):t.includes(`landmarks`)?p??(p=c(e,!0)):m.push({label:y(e.firstElementChild),type:t,list:c(e)})}return{toc:d,pageList:f,landmarks:p,others:m}},O=(e,t=e=>e)=>{let{$:n,$$:r}=b(e,u.NCX),i=e=>e?decodeURI(t(e)):null,a=e=>{let t=n(e,`navLabel`),o=n(e,`content`),s=y(t),c=i(o.getAttribute(`src`));if(e.localName===`navPoint`){let t=r(e,`navPoint`);return{label:s,href:c,subitems:t.length?t.map(a):null}}return{label:s,href:c}},o=(e,t)=>r(e,t).map(a),s=(t,r)=>{let i=n(e.documentElement,t);return i?o(i,r):null};return{toc:s(`navMap`,`navPoint`),pageList:s(`pageList`,`pageTarget`),others:r(e.documentElement,`navList`).map(e=>({label:y(n(e,`navLabel`)),list:o(e,`navTarget`)}))}},k=e=>{if(!e)return;let t=e.split(`:`).map(e=>parseFloat(e));if(t.length===3){let[e,n,r]=t;return e*60*60+n*60+r}if(t.length===2){let[e,n]=t;return e*60+n}let[n,r]=e.split(/(?=[^\d.])/);return parseFloat(n)*(r===`h`?3600:r===`min`?60:r===`ms`?.001:1)},A=new WeakMap,ie=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,ae=new WeakMap,I=new WeakMap,L=new WeakSet,oe=class extends EventTarget{constructor(e,t){super(),i(this,L),a(this,A,void 0),a(this,ie,void 0),a(this,j,void 0),a(this,M,void 0),a(this,N,void 0),a(this,P,void 0),a(this,F,1),a(this,ae,1),a(this,I,void 0),this.book=e,this.loadXML=t}async start(e,t=()=>!0){o(P,this)?.pause();let n=this.book.sections[e],r=n?.id;if(!r)return;let{mediaOverlay:i}=n;if(!i)return this.start(e+1);c(j,this,e),await s(L,this,se).call(this,i);for(let e=0;es(L,this,B).call(this,e))}}pause(){c(I,this,`paused`),o(P,this)?.pause()}resume(){c(I,this,`playing`),o(P,this)?.play().catch(e=>s(L,this,B).call(this,e))}stop(){c(I,this,`stopped`),s(L,this,ce).call(this)}prev(){o(N,this)>0?s(L,this,U).call(this,o(M,this),o(N,this)-1):o(M,this)>0?s(L,this,U).call(this,o(M,this)-1,o(A,this)[o(M,this)-1].items.length-1):o(j,this)>0&&this.start(o(j,this)-1,(e,t,n)=>t===n.length-1)}next(){s(L,this,U).call(this,o(M,this),o(N,this)+1)}setVolume(e){c(F,this,e),o(P,this)&&(o(P,this).volume=e)}setRate(e){c(ae,this,e),o(P,this)&&(o(P,this).playbackRate=e)}};async function se(e){if(o(ie,this)===e)return;let t=await this.loadXML(e.href),n=t=>t?x(t,e.href):null,{$:r,$$$:i}=b(t,u.SMIL);c(M,this,-1),c(N,this,-1),c(A,this,i(t,`par`).reduce((e,t)=>{let i=n(r(t,`text`)?.getAttribute(`src`)),a=r(t,`audio`);if(!i||!a)return e;let o=n(a.getAttribute(`src`)),s=k(a.getAttribute(`clipBegin`)),c=k(a.getAttribute(`clipEnd`)),l=e.at(-1);return l?.src===o?l.items.push({text:i,begin:s,end:c}):e.push({src:o,items:[{text:i,begin:s,end:c}]}),e},[])),c(ie,this,e)}function R(){return o(A,this)[o(M,this)]}function z(){return R.call(s(L,this))?.items?.[o(N,this)]}function B(e){console.error(e),this.dispatchEvent(new CustomEvent(`error`,{detail:e}))}function V(){this.dispatchEvent(new CustomEvent(`highlight`,{detail:z.call(s(L,this))}))}function H(){this.dispatchEvent(new CustomEvent(`unhighlight`,{detail:z.call(s(L,this))}))}async function U(e,t){s(L,this,ce).call(this),c(M,this,e),c(N,this,t);let n=R.call(s(L,this))?.src;if(!n||!z.call(s(L,this)))return this.start(o(j,this)+1);let r=URL.createObjectURL(await this.book.loadBlob(n)),i=new Audio(r);c(P,this,i),i.volume=o(F,this),i.playbackRate=o(ae,this),i.addEventListener(`timeupdate`,()=>{var e;if(i.paused)return;let t=i.currentTime,{items:n}=R.call(s(L,this));if(t>z.call(s(L,this))?.end&&(s(L,this,H).call(this),o(N,this)===n.length-1)){s(L,this,U).call(this,o(M,this)+1,0).catch(e=>s(L,this,B).call(this,e));return}let r=o(N,this);for(;n[o(N,this)+1]?.begin<=t;)c(N,this,(e=o(N,this),e++,e));o(N,this)!==r&&s(L,this,V).call(this)}),i.addEventListener(`error`,()=>s(L,this,B).call(this,Error(`Failed to load ${n}`))),i.addEventListener(`playing`,()=>s(L,this,V).call(this)),i.addEventListener(`ended`,()=>{s(L,this,H).call(this),URL.revokeObjectURL(r),c(P,this,null),s(L,this,U).call(this,e+1,0).catch(e=>s(L,this,B).call(this,e))}),o(I,this)===`paused`?(s(L,this,V).call(this),i.currentTime=z.call(s(L,this)).begin??0):i.addEventListener(`canplaythrough`,()=>{i.currentTime=z.call(s(L,this)).begin??0,c(I,this,`playing`),i.play().catch(e=>s(L,this,B).call(this,e))},{once:!0})}function ce(){o(P,this)&&(o(P,this).pause(),URL.revokeObjectURL(o(P,this).src),c(P,this,null),s(L,this,H).call(this))}var le=/([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})/,ue=e=>{for(let t of e.getElementsByTagNameNS(u.DC,`identifier`)){let[e]=y(t).split(`:`).slice(-1);if(le.test(e))return e}return``},de=e=>y(e.getElementById(e.documentElement.getAttribute(`unique-identifier`))??e.getElementsByTagNameNS(u.DC,`identifier`)[0]),fe=async(e,t,n)=>{let r=new Uint8Array(await n.slice(0,t).arrayBuffer());t=Math.min(t,r.length);for(var i=0;i{let t=new TextEncoder().encode(e),n=await globalThis.crypto.subtle.digest(`SHA-1`,t);return new Uint8Array(n)},me=(e=pe)=>({"http://www.idpf.org/2008/embedding":{key:t=>e(de(t).replaceAll(/[\u0020\u0009\u000d\u000a]/g,``)),decode:(e,t)=>fe(e,1040,t)},"http://ns.adobe.com/pdf/enc#RC":{key:e=>{let t=ue(e).replaceAll(`-`,``);return Uint8Array.from({length:16},(e,n)=>parseInt(t.slice(n*2,n*2+2),16))},decode:(e,t)=>fe(e,1024,t)}}),W=new WeakMap,G=new WeakMap,K=new WeakMap,he=class{constructor(e){a(this,W,new Map),a(this,G,new Map),a(this,K,void 0),c(K,this,e)}async init(e,t){if(!e)return;let n=Array.from(e.getElementsByTagNameNS(u.ENC,`EncryptedData`),e=>({algorithm:e.getElementsByTagNameNS(u.ENC,`EncryptionMethod`)[0]?.getAttribute(`Algorithm`),uri:e.getElementsByTagNameNS(u.ENC,`CipherReference`)[0]?.getAttribute(`URI`)}));for(let{algorithm:e,uri:r}of n){if(!o(G,this).has(e)){let n=o(K,this)[e];if(!n){console.warn(`Unknown encryption algorithm`);continue}let r=await n.key(t);o(G,this).set(e,e=>n.decode(r,e))}o(W,this).set(r,e)}}getDecoder(e){return o(G,this).get(o(W,this).get(e))??(e=>e)}},ge=class{constructor({opf:e,resolveHref:n}){this.opf=e;let{$:r,$$:i,$$$:a}=b(e,u.OPF),o=r(e.documentElement,`manifest`),s=r(e.documentElement,`spine`),c=i(s,`itemref`);this.manifest=i(o,`item`).map(v(`href`,`id`,`media-type`,`properties`,`media-overlay`)).map(e=>(e.href=n(e.href),e.properties=e.properties?.split(/\s/),e)),this.manifestById=new Map(this.manifest.map(e=>[e.id,e])),this.spine=c.map(v(`idref`,`id`,`linear`,`properties`)).map(e=>(e.properties=e.properties?.split(/\s/),e)),this.pageProgressionDirection=s.getAttribute(`page-progression-direction`),this.navPath=this.getItemByProperty(`nav`)?.href,this.ncxPath=(this.getItemByID(s.getAttribute(`toc`))??this.manifest.find(e=>e.mediaType===d.NCX))?.href;let l=r(e.documentElement,`guide`);l&&(this.guide=i(l,`reference`).map(v(`type`,`title`,`href`)).map(({type:e,title:t,href:r})=>({label:t,type:e.split(/\s/),href:n(r)}))),this.cover=this.getItemByProperty(`cover-image`)??this.getItemByID(a(e,`meta`).find(_(`name`,`cover`))?.getAttribute(`content`))??this.getItemByHref(this.guide?.find(e=>e.type.includes(`cover`))?.href),this.cfis=t(c)}getItemByID(e){return this.manifestById.get(e)}getItemByHref(e){return this.manifest.find(t=>t.href===e)}getItemByProperty(e){return this.manifest.find(t=>t.properties?.includes(e))}resolveCFI(t){let i=n(t),a=(i.parent??i).shift(),o=r(this.opf,a);o&&o.nodeName!==`idref`&&(a.at(-1).id=null,o=r(this.opf,a));let s=o?.getAttribute(`idref`);return{index:this.spine.findIndex(e=>e.idref===s),anchor:t=>e(t,i)}}},q=new WeakMap,J=new WeakMap,Y=new WeakMap,_e=class{constructor({loadText:e,loadBlob:t,resources:n}){a(this,q,new Map),a(this,J,new Map),a(this,Y,new Map),l(this,`eventTarget`,new EventTarget),this.loadText=e,this.loadBlob=t,this.manifest=n.manifest,this.assets=n.manifest}async createURL(e,t,n,r){if(!t)return``;let i={data:t,type:n};Object.defineProperty(i,"name",{value:e});let a=new CustomEvent(`data`,{detail:i});this.eventTarget.dispatchEvent(a);let s=await a.detail.data,c=await a.detail.type,l=URL.createObjectURL(new Blob([s],{type:c}));if(o(q,this).set(e,l),o(Y,this).set(e,1),r){let t=o(J,this).get(r);t?t.push(e):o(J,this).set(r,[e])}return l}ref(e,t){let n=o(J,this).get(t);return n?.includes(e)||(o(Y,this).set(e,o(Y,this).get(e)+1),n?n.push(e):o(J,this).set(t,[e])),o(q,this).get(e)}unref(e){if(!o(Y,this).has(e))return;let t=o(Y,this).get(e)-1;if(t<1){URL.revokeObjectURL(o(q,this).get(e)),o(q,this).delete(e),o(Y,this).delete(e);let t=o(J,this).get(e);if(t)for(;t.length;)this.unref(t.pop());o(J,this).delete(e)}else o(Y,this).set(e,t)}async loadItem(e,t=[]){if(!e)return null;let{href:n,mediaType:r}=e,i=d.JS.test(e.mediaType),a=new CustomEvent(`load`,{detail:{type:r,isScript:i,allow:!0}});if(this.eventTarget.dispatchEvent(a),!await a.detail.allow)return null;let s=t.at(-1);if(o(q,this).has(n))return this.ref(n,s);if((i||[d.XHTML,d.HTML,d.CSS,d.SVG].includes(r))&&t.every(e=>e!==n))return this.loadReplaced(e,t);let c=Promise.resolve().then(()=>this.loadBlob(n));return this.createURL(n,c,r,s)}async loadHref(e,t,n=[]){if(S(e))return e;let r=x(e,t),i=this.manifest.find(e=>e.href===r);return i?this.loadItem(i,n.concat(t)):e}async loadReplaced(e,t=[]){let{href:n,mediaType:r}=e,i=t.at(-1),a=``;try{a=await this.loadText(n)}catch(e){return this.createURL(n,Promise.reject(e),r,i)}if(!a)return null;if([d.XHTML,d.HTML,d.SVG].includes(r)){let o=new DOMParser().parseFromString(a,r);if(r===d.XHTML&&(o.querySelector(`parsererror`)||!o.documentElement?.namespaceURI)&&(console.warn(o.querySelector(`parsererror`)?.innerText??`Invalid XHTML`),e.mediaType=d.HTML,o=new DOMParser().parseFromString(a,e.mediaType)),[d.XHTML,d.SVG].includes(e.mediaType)){let e=o.firstChild;for(;e instanceof ProcessingInstruction;){if(e.data){let r=await C(e.data,/(?:^|\s*)(href\s*=\s*['"])([^'"]*)(['"])/i,(e,r,i,a)=>this.loadHref(i,n,t).then(e=>`${r}${e}${a}`));e.replaceWith(o.createProcessingInstruction(e.target,r))}e=e.nextSibling}}let s=async(e,r)=>e.setAttribute(r,await this.loadHref(e.getAttribute(r),n,t));for(let e of o.querySelectorAll(`link[href]`))await s(e,`href`);for(let e of o.querySelectorAll(`[src]`))await s(e,`src`);for(let e of o.querySelectorAll(`[poster]`))await s(e,`poster`);for(let e of o.querySelectorAll(`object[data]`))await s(e,`data`);for(let e of o.querySelectorAll(`[*|href]:not([href])`))e.setAttributeNS(u.XLINK,`href`,await this.loadHref(e.getAttributeNS(u.XLINK,`href`),n,t));for(let e of o.querySelectorAll(`[srcset]`))e.setAttribute(`srcset`,await C(e.getAttribute(`srcset`),/(\s*)(.+?)\s*((?:\s[\d.]+[wx])+\s*(?:,|$)|,\s+|$)/g,(e,r,i,a)=>this.loadHref(i,n,t).then(e=>`${r}${e}${a}`)));for(let e of o.querySelectorAll(`style`))e.textContent&&(e.textContent=await this.replaceCSS(e.textContent,n,t));for(let e of o.querySelectorAll(`[style]`))e.setAttribute(`style`,await this.replaceCSS(e.getAttribute(`style`),n,t));let c=new XMLSerializer().serializeToString(o);return this.createURL(n,c,e.mediaType,i)}let o=r===d.CSS?await this.replaceCSS(a,n,t):await this.replaceString(a,n,t);return this.createURL(n,o,r,i)}async replaceCSS(e,t,n=[]){return C(await C(e,/url\(\s*["']?([^'"\n]*?)\s*["']?\s*\)/gi,(e,r)=>this.loadHref(r,t,n).then(e=>`url("${e}")`)),/@import\s*["']([^"'\n]*?)["']/gi,(e,r)=>this.loadHref(r,t,n).then(e=>`@import "${e}"`))}replaceString(e,t,n=[]){let r=new Map,i=this.assets.map(e=>{if(e.href===t)return;let n=ee(te(t),e.href),i=encodeURI(n),a=`/`+e.href,o=new Set([n,i,a,encodeURI(a)]);for(let t of o)r.set(t,e);return Array.from(o)}).flat().filter(e=>e);return i.length?C(e,new RegExp(i.map(w).join(`|`),`g`),async e=>this.loadItem(r.get(e.replace(/^\//,``)),n.concat(t))):e}unloadItem(e){this.unref(e?.href)}destroy(){for(let e of o(q,this).values())URL.revokeObjectURL(e)}},ve=(e,t)=>e.getElementById(t)??e.querySelector(`[name="${CSS.escape(t)}"]`),ye=e=>{for(let t of e){if(t===`page-spread-left`||t===`rendition:page-spread-left`)return`left`;if(t===`page-spread-right`||t===`rendition:page-spread-right`)return`right`;if(t===`rendition:page-spread-center`)return`center`}},be=e=>e?{fixedLayout:y(e.querySelector(`option[name="fixed-layout"]`)),openToSpread:y(e.querySelector(`option[name="open-to-spread"]`))}:null,X=new WeakMap,Z=new WeakMap,Q=new WeakSet,xe=class{constructor({loadText:e,loadBlob:t,getSize:n,sha1:r}){i(this,Q),l(this,`parser`,new DOMParser),a(this,X,void 0),a(this,Z,void 0),this.loadText=e,this.loadBlob=t,this.getSize=n,c(Z,this,new he(me(r)))}async init(){let e=await s(Q,this,$).call(this,`META-INF/container.xml`);if(!e)throw Error(`Failed to load container file`);let t=Array.from(e.getElementsByTagNameNS(u.CONTAINER,`rootfile`),v(`full-path`,`media-type`)).filter(e=>e.mediaType===`application/oebps-package+xml`);if(!t.length)throw Error(`No package document defined in container`);let n=t[0].fullPath,r=await s(Q,this,$).call(this,n);if(!r)throw Error(`Failed to load package document`);let i=await s(Q,this,$).call(this,`META-INF/encryption.xml`);await o(Z,this).init(i,r),this.resources=new ge({opf:r,resolveHref:e=>x(e,n)}),c(X,this,new _e({loadText:this.loadText,loadBlob:e=>Promise.resolve(this.loadBlob(e)).then(o(Z,this).getDecoder(e)),resources:this.resources})),this.transformTarget=o(X,this).eventTarget,this.sections=this.resources.spine.map((e,t)=>{let{idref:n,linear:r,properties:i=[]}=e,a=this.resources.getItemByID(n);return a?{id:a.href,load:()=>o(X,this).loadItem(a),unload:()=>o(X,this).unloadItem(a),createDocument:()=>this.loadDocument(a),size:this.getSize(a.href),cfi:this.resources.cfis[t],linear:r,pageSpread:ye(i),resolveHref:e=>x(e,a.href),mediaOverlay:a.mediaOverlay?this.resources.getItemByID(a.mediaOverlay):null}:(console.warn(`Could not find item with ID "${n}" in manifest`),null)}).filter(e=>e);let{navPath:a,ncxPath:l}=this.resources;if(a)try{let e=D(await s(Q,this,$).call(this,a),e=>x(e,a));this.toc=e.toc,this.pageList=e.pageList,this.landmarks=e.landmarks}catch(e){console.warn(e)}if(!this.toc&&l)try{let e=O(await s(Q,this,$).call(this,l),e=>x(e,l));this.toc=e.toc,this.pageList=e.pageList}catch(e){console.warn(e)}this.landmarks??(this.landmarks=this.resources.guide);let{metadata:d,rendition:f,media:p}=E(r);this.metadata=d,this.rendition=f,this.media=p,this.dir=this.resources.pageProgressionDirection;let m=be(await s(Q,this,$).call(this,`META-INF/com.apple.ibooks.display-options.xml`)??await s(Q,this,$).call(this,`META-INF/com.kobobooks.display-options.xml`));if(m){var h,g;m.fixedLayout===`true`&&((h=this.rendition).layout??(h.layout=`pre-paginated`)),m.openToSpread===`false`&&((g=this.sections.find(e=>e.linear!==`no`)).pageSpread??(g.pageSpread=this.dir===`rtl`?`left`:`right`))}return this}async loadDocument(e){let t=await this.loadText(e.href);return this.parser.parseFromString(t,e.mediaType)}getMediaOverlay(){return new oe(this,s(Q,this,$).bind(this))}resolveCFI(e){return this.resources.resolveCFI(e)}resolveHref(e){let[t,n]=e.split(`#`),r=this.resources.getItemByHref(decodeURI(t));return r?{index:this.resources.spine.findIndex(({idref:e})=>e===r.id),anchor:n?e=>ve(e,n):()=>0}:null}splitTOCHref(e){return e?.split(`#`)??[]}getTOCFragment(e,t){return e.getElementById(t)??e.querySelector(`[name="${CSS.escape(t)}"]`)}isExternal(e){return S(e)}async getCover(){let e=this.resources?.cover;return e?.href?new Blob([await this.loadBlob(e.href)],{type:e.mediaType}):null}async getCalibreBookmarks(){let e=await this.loadText(`META-INF/calibre_bookmarks.txt`);if(e?.startsWith(`encoding=json+base64:`)){let t=atob(e.slice(21));return JSON.parse(t)}}destroy(){o(X,this)?.destroy()}};async function $(e){let t=await this.loadText(e);if(!t)return null;let n=this.parser.parseFromString(t,d.XML);if(n.querySelector(`parsererror`))throw Error(`XML parsing error: ${e} +${n.querySelector(`parsererror`).innerText}`);return n}export{xe as EPUB}; \ No newline at end of file diff --git a/dist-embed/assets/epub-renderer-Bme3iMY3.js b/dist-embed/assets/epub-renderer-Bme3iMY3.js new file mode 100644 index 0000000..67efae9 --- /dev/null +++ b/dist-embed/assets/epub-renderer-Bme3iMY3.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./epub-BRc42rrU.js","./epubcfi-CnTj7mGe.js","./classPrivateFieldSet2-CUhwy2NK.js","./defineProperty-BbfpZ9Tg.js","./mobi-Ub-LpPzr.js","./fixed-layout-BfuYLi-X.js","./paginator-CX7swKUE.js","./tts-C1bDd3kL.js"])))=>i.map(i=>d[i]); +import{n as e,t}from"./reader-Bd1ccloG.js";import{a as n,c as r,i,o as a,r as o,t as s}from"./epubcfi-CnTj7mGe.js";import{a as c,i as l,n as u,r as d,t as f}from"./classPrivateFieldSet2-CUhwy2NK.js";import{t as p}from"./defineProperty-BbfpZ9Tg.js";import{t as ee}from"./base-renderer-DM6Nw1yD.js";var te=e=>{let t=0,n=e=>{if(e.id=t++,e.subitems)for(let t of e.subitems)n(t)};for(let t of e)n(t);return e},m=e=>e.map(e=>e.subitems?.length?[e,m(e.subitems)].flat():e).flat(),h=class{async init({toc:e,ids:t,splitHref:n,getFragment:r}){te(e);let i=m(e),a=new Map;for(let[e,t]of i.entries()){let[r,o]=await n(t?.href)??[],s={fragment:o,item:t};a.has(r)?a.get(r).items.push(s):a.set(r,{prev:i[e-1],items:[s]})}let o=new Map;for(let[e,n]of t.entries())a.has(n)?o.set(n,a.get(n)):o.set(n,o.get(t[e-1]));this.ids=t,this.map=o,this.getFragment=r}getProgress(e,t){if(!this.ids)return;let n=this.ids[e],r=this.map.get(n);if(!r)return null;let{prev:i,items:a}=r;if(!a)return i;if(!t||a.length===1&&!a[0].fragment)return a[0].item;let o=t.startContainer.getRootNode();for(let[e,{fragment:n}]of a.entries()){let r=this.getFragment(o,n);if(r&&t.comparePoint(r,0)>0)return a[e-1]?.item??i}return a[a.length-1].item}},g=new WeakSet,_=class{constructor(e,t,n){c(this,g),this.sizes=e.map(e=>e.linear!=`no`&&e.size>0?e.size:0),this.sizePerLoc=t,this.sizePerTimeUnit=n,this.sizeTotal=this.sizes.reduce((e,t)=>e+t,0),this.sectionFractions=d(g,this,v).call(this)}getProgress(e,t,n=0){let{sizes:r,sizePerLoc:i,sizePerTimeUnit:a,sizeTotal:o}=this,s=r[e]??0,c=r.slice(0,e).reduce((e,t)=>e+t,0)+t*s,l=c+n*s,u=o-c,d=(1-t)*s;return{fraction:l/o,section:{current:e,total:r.length},location:{current:Math.floor(c/i),next:Math.floor(l/i),total:Math.ceil(o/i)},time:{section:d/a,total:u/a}}}getSection(e){if(e<=0)return[0,0];if(e>=1)return[this.sizes.length-1,1];e+=2**-52;let{sizeTotal:t}=this,n=this.sectionFractions.findIndex(t=>t>e)-1;if(n<0)return[0,0];for(;!this.sizes[n];)n++;let r=(e-this.sectionFractions[n])/(this.sizes[n]/t);return[n,r]}};function v(){let{sizeTotal:e}=this,t=[0],n=0;for(let r of this.sizes)t.push((n+=r)/e);return t}var y=e=>document.createElementNS(`http://www.w3.org/2000/svg`,e),b=new WeakMap,x=new WeakMap,S=class{constructor(){l(this,b,y(`svg`)),l(this,x,new Map),Object.assign(u(b,this).style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,pointerEvents:`none`})}get element(){return u(b,this)}add(e,t,n,r){u(x,this).has(e)&&this.remove(e),typeof t==`function`&&(t=t(u(b,this).getRootNode()));let i=t.getClientRects(),a=n(i,r);u(b,this).append(a),u(x,this).set(e,{range:t,draw:n,options:r,element:a,rects:i})}remove(e){u(x,this).has(e)&&(u(b,this).removeChild(u(x,this).get(e).element),u(x,this).delete(e))}redraw(){for(let e of u(x,this).values()){let{range:t,draw:n,options:r,element:i}=e;u(b,this).removeChild(i);let a=t.getClientRects(),o=n(a,r);u(b,this).append(o),e.element=o,e.rects=a}}hitTest({x:e,y:t}){let n=Array.from(u(x,this).entries());for(let r=n.length-1;r>=0;r--){let[i,a]=n[r];for(let{left:n,top:r,right:o,bottom:s}of a.rects)if(r<=t&&n<=e&&s>t&&o>e)return[i,a.range]}return[]}static underline(e,t={}){let{color:n=`red`,width:r=2,writingMode:i}=t,a=y(`g`);if(a.setAttribute(`fill`,n),i===`vertical-rl`||i===`vertical-lr`)for(let{right:t,top:n,height:i}of e){let e=y(`rect`);e.setAttribute(`x`,t-r),e.setAttribute(`y`,n),e.setAttribute(`height`,i),e.setAttribute(`width`,r),a.append(e)}else for(let{left:t,bottom:n,width:i}of e){let e=y(`rect`);e.setAttribute(`x`,t),e.setAttribute(`y`,n-r),e.setAttribute(`height`,r),e.setAttribute(`width`,i),a.append(e)}return a}static strikethrough(e,t={}){let{color:n=`red`,width:r=2,writingMode:i}=t,a=y(`g`);if(a.setAttribute(`fill`,n),i===`vertical-rl`||i===`vertical-lr`)for(let{right:t,left:n,top:i,height:o}of e){let e=y(`rect`);e.setAttribute(`x`,(t+n)/2),e.setAttribute(`y`,i),e.setAttribute(`height`,o),e.setAttribute(`width`,r),a.append(e)}else for(let{left:t,top:n,bottom:i,width:o}of e){let e=y(`rect`);e.setAttribute(`x`,t),e.setAttribute(`y`,(n+i)/2),e.setAttribute(`height`,r),e.setAttribute(`width`,o),a.append(e)}return a}static squiggly(e,t={}){let{color:n=`red`,width:r=2,writingMode:i}=t,a=y(`g`);a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,n),a.setAttribute(`stroke-width`,r);let o=r*1.5;if(i===`vertical-rl`||i===`vertical-lr`)for(let{right:t,top:n,height:r}of e){let e=y(`path`),i=Math.round(r/o/1.5),s=r/i,c=Array.from({length:i},(e,t)=>`l${t%2?-o:o} ${s}`).join(``);e.setAttribute(`d`,`M${t} ${n}${c}`),a.append(e)}else for(let{left:t,bottom:n,width:r}of e){let e=y(`path`),i=Math.round(r/o/1.5),s=r/i,c=Array.from({length:i},(e,t)=>`l${s} ${t%2?o:-o}`).join(``);e.setAttribute(`d`,`M${t} ${n}${c}`),a.append(e)}return a}static highlight(e,t={}){let{color:n=`red`}=t,r=y(`g`);r.setAttribute(`fill`,n),r.style.opacity=`var(--overlayer-highlight-opacity, .3)`,r.style.mixBlendMode=`var(--overlayer-highlight-blend-mode, normal)`;for(let{left:t,top:n,height:i,width:a}of e){let e=y(`rect`);e.setAttribute(`x`,t),e.setAttribute(`y`,n),e.setAttribute(`height`,i),e.setAttribute(`width`,a),r.append(e)}return r}static outline(e,t={}){let{color:n=`red`,width:r=3,radius:i=3}=t,a=y(`g`);a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,n),a.setAttribute(`stroke-width`,r);for(let{left:t,top:n,height:r,width:o}of e){let e=y(`rect`);e.setAttribute(`x`,t),e.setAttribute(`y`,n),e.setAttribute(`height`,r),e.setAttribute(`width`,o),e.setAttribute(`rx`,i),a.append(e)}return a}static copyImage([e],t={}){let{src:n}=t,r=y(`image`),{left:i,top:a,height:o,width:s}=e;return r.setAttribute(`href`,n),r.setAttribute(`x`,i),r.setAttribute(`y`,a),r.setAttribute(`height`,o),r.setAttribute(`width`,s),r}},ne=(e,t)=>{let n=[];for(let r=t.currentNode;r;r=t.nextNode()){let t=e.comparePoint(r,0);if(t===0)n.push(r);else if(t>0)break}return n},re=(e,t)=>{let n=[];for(let e=t.nextNode();e;e=t.nextNode())n.push(e);return n},ie=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_CDATA_SECTION,ae=e=>{if(e.nodeType===1){let t=e.tagName.toLowerCase();return t===`script`||t===`style`?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_ACCEPT},C=function*(e,t,n){let r=e.commonAncestorContainer??e.body??e,i=document.createTreeWalker(r,ie,{acceptNode:n||ae}),a=(e.commonAncestorContainer?ne:re)(e,i),o=a.map(e=>e.nodeValue??``),s=(e,t,n,r)=>{let i=document.createRange();return i.setStart(a[e],t),i.setEnd(a[n],r),i};for(let e of t(o,s))yield e},w=`foliate-search:`,T=async e=>{let t=new Uint8Array(await e.slice(0,4).arrayBuffer());return t[0]===80&&t[1]===75&&t[2]===3&&t[3]===4},oe=async e=>{let t=new Uint8Array(await e.slice(0,5).arrayBuffer());return t[0]===37&&t[1]===80&&t[2]===68&&t[3]===70&&t[4]===45},E=({name:e,type:t})=>t===`application/vnd.comicbook+zip`||e.endsWith(`.cbz`),D=({name:e,type:t})=>t===`application/x-fictionbook+xml`||e.endsWith(`.fb2`),O=({name:e,type:t})=>t===`application/x-zip-compressed-fb2`||e.endsWith(`.fb2.zip`)||e.endsWith(`.fbz`),k=async e=>{let{configure:n,ZipReader:r,BlobReader:i,TextWriter:a,BlobWriter:o}=await t(async()=>{let{configure:e,ZipReader:t,BlobReader:n,TextWriter:r,BlobWriter:i}=await import(`./zip-CvNGKDey.js`);return{configure:e,ZipReader:t,BlobReader:n,TextWriter:r,BlobWriter:i}},[],import.meta.url);n({useWebWorkers:!1});let s=await new r(new i(e)).getEntries(),c=new Map(s.map(e=>[e.filename,e])),l=e=>(t,...n)=>c.has(t)?e(c.get(t),...n):null;return{entries:s,loadText:l(e=>e.getData(new a)),loadBlob:l((e,t)=>e.getData(new o(t))),getSize:e=>c.get(e)?.uncompressedSize??0}},A=async e=>e.isFile?e:(await Promise.all(Array.from(await new Promise((t,n)=>e.createReader().readEntries(e=>t(e),e=>n(e))),A))).flat(),se=async e=>{let t=await A(e),n=await Promise.all(t.map(e=>new Promise((t,n)=>e.file(n=>t([n,e.fullPath]),e=>n(e))))),r=new Map(n.map(([t,n])=>[n.replace(e.fullPath+`/`,``),t])),i=new TextDecoder,a=e=>e?i.decode(e):null,o=e=>r.get(e)?.arrayBuffer()??null;return{loadText:async e=>a(await o(e)),loadBlob:e=>r.get(e),getSize:e=>r.get(e)?.size??0}},ce=class extends Error{},le=class extends Error{},ue=class extends Error{},de=async e=>{let t=await fetch(e);if(!t.ok)throw new ce(`${t.status} ${t.statusText}`,{cause:t});return new File([await t.blob()],new URL(t.url).pathname)},j=async e=>{typeof e==`string`&&(e=await de(e));let n;if(e.isDirectory){let r=await se(e),{EPUB:i}=await t(async()=>{let{EPUB:e}=await import(`./epub-BRc42rrU.js`);return{EPUB:e}},__vite__mapDeps([0,1,2,3]),import.meta.url);n=await new i(r).init()}else if(!e.size)throw new le(`File not found`);else if(await T(e)){let r=await k(e);if(E(e)){let{makeComicBook:i}=await t(async()=>{let{makeComicBook:e}=await import(`./comic-book-Bc_1EzdL.js`);return{makeComicBook:e}},[],import.meta.url);n=i(r,e)}else if(O(e)){let{makeFB2:e}=await t(async()=>{let{makeFB2:e}=await import(`./fb2-DgH9Jg0u.js`);return{makeFB2:e}},[],import.meta.url),{entries:i}=r,a=i.find(e=>e.filename.endsWith(`.fb2`));n=await e(await r.loadBlob((a??i[0]).filename))}else{let{EPUB:e}=await t(async()=>{let{EPUB:e}=await import(`./epub-BRc42rrU.js`);return{EPUB:e}},__vite__mapDeps([0,1,2,3]),import.meta.url);n=await new e(r).init()}}else if(await oe(e)){let{makePDF:r}=await t(async()=>{let{makePDF:e}=await import(`./foliate-pdf-stub-D0ViEO2I.js`);return{makePDF:e}},[],import.meta.url);n=await r(e)}else{let{isMOBI:r,MOBI:i}=await t(async()=>{let{isMOBI:e,MOBI:t}=await import(`./mobi-Ub-LpPzr.js`);return{isMOBI:e,MOBI:t}},__vite__mapDeps([4,2,3]),import.meta.url);if(await r(e))n=await new i({unzlib:(await t(()=>import(`./fflate-CIG33RrD.js`),[],import.meta.url)).unzlibSync}).open(e);else if(D(e)){let{makeFB2:r}=await t(async()=>{let{makeFB2:e}=await import(`./fb2-DgH9Jg0u.js`);return{makeFB2:e}},[],import.meta.url);n=await r(e)}}if(!n)throw new ue(`File type not supported`);return n},M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=class e{constructor(e,t,n={}){l(this,M,void 0),l(this,N,void 0),l(this,P,void 0),l(this,F,void 0),f(N,this,e),f(P,this,t),f(F,this,n),u(F,this).hidden&&this.hide(),u(N,this).addEventListener(`mousemove`,({screenX:e,screenY:n})=>{e===u(F,this).x&&n===u(F,this).y||(u(F,this).x=e,u(F,this).y=n,this.show(),u(M,this)&&clearTimeout(u(M,this)),t()&&f(M,this,setTimeout(this.hide.bind(this),1e3)))},!1)}cloneFor(t){return new e(t,u(P,this),u(F,this))}hide(){u(N,this).style.cursor=`none`,u(F,this).hidden=!0}show(){u(N,this).style.removeProperty(`cursor`),u(F,this).hidden=!1}},L=new WeakMap,R=new WeakMap,z=class extends EventTarget{constructor(...e){super(...e),l(this,L,[]),l(this,R,-1)}pushState(e){var t;let n=u(L,this)[u(R,this)];n===e||n?.fraction&&n.fraction===e.fraction||(u(L,this)[f(R,this,(t=u(R,this),++t))]=e,u(L,this).length=u(R,this)+1,this.dispatchEvent(new Event(`index-change`)))}replaceState(e){let t=u(R,this);u(L,this)[t]=e}back(){let e=u(R,this);if(e<=0)return;let t={state:u(L,this)[e-1]};f(R,this,e-1),this.dispatchEvent(new CustomEvent(`popstate`,{detail:t})),this.dispatchEvent(new Event(`index-change`))}forward(){let e=u(R,this);if(e>=u(L,this).length-1)return;let t={state:u(L,this)[e+1]};f(R,this,e+1),this.dispatchEvent(new CustomEvent(`popstate`,{detail:t})),this.dispatchEvent(new Event(`index-change`))}get canGoBack(){return u(R,this)>0}get canGoForward(){return u(R,this){if(!e)return{};try{let t=Intl.getCanonicalLocales(e)[0],n=new Intl.Locale(t);return{canonical:t,locale:n,isCJK:[`zh`,`ja`,`kr`].includes(n.language),direction:(n.getTextInfo?.()??n.textInfo)?.direction}}catch(e){return console.warn(e),{}}},V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakSet,fe=class extends HTMLElement{constructor(){super(),c(this,Y),l(this,V,this.attachShadow({mode:`closed`})),l(this,H,void 0),l(this,U,void 0),l(this,W,void 0),l(this,G,new Map),l(this,K,void 0),l(this,q,void 0),l(this,J,new I(this,()=>this.hasAttribute(`autohide-cursor`))),p(this,`isFixedLayout`,!1),p(this,`lastLocation`,void 0),p(this,`history`,new z),this.history.addEventListener(`popstate`,({detail:e})=>{let t=this.resolveNavigation(e.state);this.renderer.goTo(t)})}async open(e){if((typeof e==`string`||typeof e.arrayBuffer==`function`||e.isDirectory)&&(e=await j(e)),this.book=e,this.language=B(e.metadata?.language),e.splitTOCHref&&e.getTOCFragment){let t=e.sections.map(e=>e.id);f(H,this,new _(e.sections,1500,1600));let n=e.splitTOCHref.bind(e),r=e.getTOCFragment.bind(e);f(U,this,new h),await u(U,this).init({toc:e.toc??[],ids:t,splitHref:n,getFragment:r}),f(W,this,new h),await u(W,this).init({toc:e.pageList??[],ids:t,splitHref:n,getFragment:r})}if(this.isFixedLayout=this.book.rendition?.layout===`pre-paginated`,this.isFixedLayout?(await t(()=>import(`./fixed-layout-BfuYLi-X.js`),__vite__mapDeps([5,2,3]),import.meta.url),this.renderer=document.createElement(`foliate-fxl`)):(await t(()=>import(`./paginator-CX7swKUE.js`),__vite__mapDeps([6,2,3]),import.meta.url),this.renderer=document.createElement(`foliate-paginator`)),this.renderer.setAttribute(`exportparts`,`head,foot,filter`),this.renderer.addEventListener(`load`,e=>d(Y,this,pe).call(this,e.detail)),this.renderer.addEventListener(`relocate`,e=>d(Y,this,Z).call(this,e.detail)),this.renderer.addEventListener(`create-overlayer`,e=>e.detail.attach(d(Y,this,he).call(this,e.detail))),this.renderer.open(e),u(V,this).append(this.renderer),e.sections.some(e=>e.mediaOverlay)){let t=e.media.activeClass,n=e.media.playbackActiveClass;this.mediaOverlay=e.getMediaOverlay();let r;this.mediaOverlay.addEventListener(`highlight`,e=>{let i=this.resolveNavigation(e.detail.text);this.renderer.goTo(i).then(()=>{let{doc:e}=this.renderer.getContents().find(e=>e.index=i.index),a=i.anchor(e);a.classList.add(t),n&&a.ownerDocument.documentElement.classList.add(n),r=new WeakRef(a)})}),this.mediaOverlay.addEventListener(`unhighlight`,()=>{let e=r?.deref();e&&(e.classList.remove(t),n&&e.ownerDocument.documentElement.classList.remove(n))})}}close(){this.renderer?.destroy(),this.renderer?.remove(),f(H,this,null),f(U,this,null),f(W,this,null),f(G,this,new Map),this.lastLocation=null,this.history.clear(),this.tts=null,this.mediaOverlay=null}goToTextStart(){return this.goTo(this.book.landmarks?.find(e=>e.type.includes(`bodymatter`)||e.type.includes(`text`))?.href??this.book.sections.findIndex(e=>e.linear!==`no`))}async init({lastLocation:e,showTextStart:t}){let n=e?this.resolveNavigation(e):null;n?(await this.renderer.goTo(n),this.history.pushState(e)):t?await this.goToTextStart():(this.history.pushState(0),await this.next())}async addAnnotation(e,t){let{value:n}=e;if(n.startsWith(w)){let e=n.replace(w,``),{index:r,anchor:i}=await this.resolveNavigation(e),a=d(Y,this,Q).call(this,r);if(a){let{overlayer:e,doc:r}=a;if(t){e.remove(n);return}let o=r?i(r):i;e.add(n,o,u(K,this),u(q,this))}return}let{index:r,anchor:i}=await this.resolveNavigation(n),a=d(Y,this,Q).call(this,r);if(a){let{overlayer:r,doc:o}=a;if(r.remove(n),!t){let t=o?i(o):i;d(Y,this,X).call(this,`draw-annotation`,{draw:(e,i)=>r.add(n,t,e,i),annotation:e,doc:o,range:t})}}return{index:r,label:u(U,this).getProgress(r)?.label??``}}deleteAnnotation(e){return this.addAnnotation(e,!0)}async showAnnotation(e){let{value:t}=e,n=await this.goTo(t);if(n){let{index:e,anchor:r}=n,{doc:i}=d(Y,this,Q).call(this,e),a=r(i);d(Y,this,X).call(this,`show-annotation`,{value:t,index:e,range:a})}}getCFI(e,t){let r=this.book.sections[e].cfi??s.fromIndex(e);return t?n(r,o(t)):r}resolveCFI(e){if(this.book.resolveCFI)return this.book.resolveCFI(e);{let t=a(e);return{index:s.toIndex((t.parent??t).shift()),anchor:e=>r(e,t)}}}resolveNavigation(e){try{if(typeof e==`number`)return{index:e};if(typeof e.fraction==`number`){let[t,n]=u(H,this).getSection(e.fraction);return{index:t,anchor:n}}return i.test(e)?this.resolveCFI(e):this.book.resolveHref(e)}catch(t){console.error(t),console.error(`Could not resolve target ${e}`)}}async goTo(e){let t=this.resolveNavigation(e);try{return await this.renderer.goTo(t),this.history.pushState(e),t}catch(t){console.error(t),console.error(`Could not go to ${e}`)}}async goToFraction(e){let[t,n]=u(H,this).getSection(e);await this.renderer.goTo({index:t,anchor:n}),this.history.pushState({fraction:e})}async select(e){try{let t=await this.resolveNavigation(e);await this.renderer.goTo({...t,select:!0}),this.history.pushState(e)}catch(t){console.error(t),console.error(`Could not go to ${e}`)}}deselect(){for(let{doc:e}of this.renderer.getContents())e.defaultView.getSelection().removeAllRanges()}getSectionFractions(){return(u(H,this)?.sectionFractions??[]).map(e=>e+2**-52)}getProgressOf(e,t){return{tocItem:u(U,this)?.getProgress(e,t),pageItem:u(W,this)?.getProgress(e,t)}}async getTOCItemOf(e){try{let{index:t,anchor:n}=await this.resolveNavigation(e),r=await this.book.sections[t].createDocument(),i=n(r),a=i instanceof Range,o=a?i:r.createRange();return a||o.selectNodeContents(i),u(U,this).getProgress(t,o)}catch(t){console.error(t),console.error(`Could not get ${e}`)}}async prev(e){await this.renderer.prev(e)}async next(e){await this.renderer.next(e)}goLeft(){return this.book.dir===`rtl`?this.next():this.prev()}goRight(){return this.book.dir===`rtl`?this.prev():this.next()}async*search(e){this.clearSearch(),f(K,this,e.draw??S.outline),f(q,this,e.drawOptions);let{searchMatcher:n}=await t(async()=>{let{searchMatcher:e}=await import(`./search-CJ5IhiMB.js`);return{searchMatcher:e}},[],import.meta.url),{query:r,index:i}=e,a=n(C,{defaultLocale:this.language,...e}),o=i==null?d(Y,this,_e).call(this,a,r):d(Y,this,ge).call(this,a,r,i),s=[];u(G,this).set(i,s);for await(let e of o)if(e.subitems){let t=e.subitems.map(({cfi:e})=>({value:w+e}));u(G,this).set(e.index,t);for(let e of t)this.addAnnotation(e);yield{label:u(U,this).getProgress(e.index)?.label??``,subitems:e.subitems}}else{if(e.cfi){let t={value:w+e.cfi};s.push(t),this.addAnnotation(t)}yield e}yield`done`}clearSearch(){for(let e of u(G,this).values())for(let t of e)this.deleteAnnotation(t);u(G,this).clear()}async initTTS(e=`word`,n){let r=this.renderer.getContents()[0].doc;if(this.tts&&this.tts.doc===r)return;let{TTS:i}=await t(async()=>{let{TTS:e}=await import(`./tts-C1bDd3kL.js`);return{TTS:e}},__vite__mapDeps([7,2]),import.meta.url);this.tts=new i(r,C,n||(e=>this.renderer.scrollToAnchor(e,!0)),e)}startMediaOverlay(){let{index:e}=this.renderer.getContents()[0];return this.mediaOverlay.start(e)}};function X(e,t,n){return this.dispatchEvent(new CustomEvent(e,{detail:t,cancelable:n}))}function Z({reason:e,range:t,index:n,fraction:r,size:i}){let a=u(H,this)?.getProgress(n,r,i)??{},o=u(U,this)?.getProgress(n,t),s=u(W,this)?.getProgress(n,t),c=this.getCFI(n,t);this.lastLocation={...a,tocItem:o,pageItem:s,cfi:c,range:t},(e===`snap`||e===`page`||e===`scroll`)&&this.history.replaceState(c),d(Y,this,X).call(this,`relocate`,this.lastLocation)}function pe({doc:e,index:t}){var n,r;(n=e.documentElement).lang||(n.lang=this.language.canonical??``),this.language.isCJK||(r=e.documentElement).dir||(r.dir=this.language.direction??``),d(Y,this,me).call(this,e,t),u(J,this).cloneFor(e.documentElement),d(Y,this,X).call(this,`load`,{doc:e,index:t})}function me(e,t){let{book:n}=this,r=n.sections[t];e.addEventListener(`click`,e=>{let t=e.target.closest(`a[href]`);if(!t)return;e.preventDefault();let i=t.getAttribute(`href`),a=r?.resolveHref?.(i)??i;n?.isExternal?.(a)?Promise.resolve(d(Y,this,X).call(this,`external-link`,{a:t,href_:i},!0)).then(e=>e?globalThis.open(i,`_blank`):null).catch(e=>console.error(e)):Promise.resolve(d(Y,this,X).call(this,`link`,{a:t,href:a},!0)).then(e=>e?this.goTo(a):null).catch(e=>console.error(e))})}function Q(e){return this.renderer.getContents().find(t=>t.index===e&&t.overlayer)}function he({doc:e,index:t}){let n=new S;e.addEventListener(`click`,e=>{let[r,i]=n.hitTest(e);r&&!r.startsWith(w)&&d(Y,this,X).call(this,`show-annotation`,{value:r,index:t,range:i})},!1);let r=u(G,this).get(t);if(r)for(let e of r)this.addAnnotation(e);return d(Y,this,X).call(this,`create-overlay`,{index:t}),n}async function*ge(e,t,n){let r=await this.book.sections[n].createDocument();for(let{range:i,excerpt:a}of e(r,t))yield{cfi:this.getCFI(n,i),excerpt:a}}async function*_e(e,t){let{sections:n}=this.book;for(let[r,{createDocument:i}]of n.entries()){if(!i)continue;let a=await i(),o=Array.from(e(a,t),({range:e,excerpt:t})=>({cfi:this.getCFI(r,e),excerpt:t}));yield{progress:(r+1)/n.length},o.length&&(yield{index:r,subitems:o})}}customElements.define(`foliate-view`,fe);var $=e=>` + html { color-scheme: light dark; font-size: ${Math.round(100*e)}%; } + p, li, blockquote, dd { line-height: 1.5; } +`,ve=new Set([`P`,`DIV`,`LI`,`H1`,`H2`,`H3`,`H4`,`H5`,`H6`,`BLOCKQUOTE`,`PRE`,`TR`,`SECTION`,`ARTICLE`,`FIGCAPTION`,`DD`,`DT`]),ye=new Set([`SCRIPT`,`STYLE`]),be=t=>e(t,ve,ye).replace(/[ \t]+\n/g,` +`).replace(/\n{3,}/g,` + +`),xe=class extends ee{constructor(){super(),this._view=null,this._total=1,this._onResize=null,this.defaultScaleOption=null}async load(e,t,n){await super.load(e,t,n),t.innerHTML=``;let r=document.createElement(`foliate-view`);r.className=`epub-view`,t.appendChild(r),this._view=r,this._sizeView();let i=n?.currentFileName||`book.epub`;await r.open(new File([e],i)),await new Promise(e=>{let t=!1,n=()=>{t||(t=!0,e())};r.addEventListener(`relocate`,e=>{this._onRelocate(e.detail),n()}),r.renderer.setStyles?.($(this.scale)),Promise.resolve(r.renderer.next()).catch(n),setTimeout(n,4e3)}),this._onResize=()=>this._sizeView(),window.addEventListener(`resize`,this._onResize)}_onRelocate(e){let t=e?.location;t&&(this._total=t.total||1,this.numPages=this._total,this.viewer&&(this.viewer.numPages=this._total,this.viewer.currentPage=t.current||1,this.viewer.updatePageInfo()))}_sizeView(){let e=document.getElementById(`viewerContainer`);!e||!this._view||(this._view.style.width=`${Math.max(300,e.clientWidth-40)}px`,this._view.style.height=`${Math.max(300,e.clientHeight-40)}px`)}scrollToPage(e){let t=this.viewer?.currentPage||1;!this._view||e===t||(e===t+1?this._view.next():e===t-1?this._view.prev():this._total>1&&this._view.goToFraction((e-1)/(this._total-1)))}setScale(e){this.scale=e,this._view?.renderer?.setStyles?.($(e))}getPageWidth(){return null}getPageHeight(){return null}async extractText(e,t){let n=await j(new File([e],t||`book.epub`));try{let e=[];for(let t of n.sections||[]){if(typeof t.createDocument!=`function`)continue;let n;try{n=await t.createDocument()}catch{continue}let r=n?.body||n?.documentElement,i=r?be(r).trim():``;i&&e.push(i)}return[e.join(` + +`)]}finally{n?.destroy?.()}}destroy(){this._onResize&&window.removeEventListener(`resize`,this._onResize),this._onResize=null,this._view?.close?.(),this._view?.remove(),this._view=null,super.destroy()}};export{xe as EPUBRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/epubcfi-CnTj7mGe.js b/dist-embed/assets/epubcfi-CnTj7mGe.js new file mode 100644 index 0000000..ceb2969 --- /dev/null +++ b/dist-embed/assets/epubcfi-CnTj7mGe.js @@ -0,0 +1 @@ +var e=(e,t)=>e.map((e,n,r)=>t(e,n,r)?n:null).filter(e=>e!=null),t=(e,t)=>[-1,...t,e.length].reduce(({xs:t,a:n},r)=>({xs:t?.concat([e.slice(n+1,r)])??[],a:r}),{}).xs,n=(e,t)=>e.slice(0,-1).concat([e[e.length-1].concat(t[0])]).concat(t.slice(1)),r=/\d/,i=/^epubcfi\((.*)\)$/,a=e=>e.replace(/[\^[\](),;=]/g,`^$&`),o=e=>i.test(e)?e:`epubcfi(${e})`,s=e=>e.match(i)?.[1]??e,c=(e=>(...t)=>`epubcfi(${e(...t.map(e=>e.match(i)?.[1]??e))})`)((...e)=>e.join(`!`)),l=e=>{let t=[],n,i,a=``,o=e=>(t.push(e),n=null,a=``),s=e=>(a+=e,i=!1);for(let t of Array.from(e.trim()).concat(``)){if(t===`^`&&!i){i=!0;continue}if(n===`!`)o([`!`]);else if(n===`,`)o([`,`]);else if(n===`/`||n===`:`)if(r.test(t)){s(t);continue}else o([n,parseInt(a)]);else if(n===`~`)if(r.test(t)||t===`.`){s(t);continue}else o([`~`,parseFloat(a)]);else if(n===`@`){if(t===`:`){o([`@`,parseFloat(a)]),n=`@`;continue}if(r.test(t)||t===`.`){s(t);continue}else o([`@`,parseFloat(a)])}else if(n===`[`){t===`;`&&!i?(o([`[`,a]),n=`;`):t===`,`&&!i?(o([`[`,a]),n=`[`):t===`]`&&!i?o([`[`,a]):s(t);continue}else if(n?.startsWith(`;`)){t===`=`&&!i?(n=`;${a}`,a=``):t===`;`&&!i?(o([n,a]),n=`;`):t===`]`&&!i?o([n,a]):s(t);continue}(t===`/`||t===`:`||t===`~`||t===`@`||t===`[`||t===`!`||t===`,`)&&(n=t)}return t},u=(t,n)=>e(t,([e])=>e===n),d=e=>{let t=[],n;for(let[r,i]of e){if(r===`/`)t.push({index:i});else{let e=t[t.length-1];if(r===`:`)e.offset=i;else if(r===`~`)e.temporal=i;else if(r===`@`)e.spatial=(e.spatial??[]).concat(i);else if(r===`;s`)e.side=i;else if(r===`[`)if(n===`/`&&i)e.id=i;else{e.text=(e.text??[]).concat(i);continue}}n=r}return t},f=e=>t(e,u(e,`!`)).map(d),p=e=>{let n=l(s(e)),r=u(n,`,`);if(!r.length)return f(n);let[i,a,o]=t(n,r).map(f);return{parent:i,start:a,end:o}},m=({index:e,id:t,offset:n,temporal:r,spatial:i,text:o,side:s})=>{let c=s?`;s=${s}`:``;return`/${e}`+(t?`[${a(t)}${c}]`:``)+(n!=null&&e%2?`:${n}`:``)+(r?`~${r}`:``)+(i?`@${i.join(`:`)}`:``)+(o||!t&&s?`[`+(o?.map(a)?.join(`,`)??``)+c+`]`:``)},h=e=>e.parent?[e.parent,e.start,e.end].map(h).join(`,`):e.map(e=>e.map(m).join(``)).join(`!`),g=e=>o(h(e)),_=(e,t)=>typeof e==`string`?g(_(p(e),t)):e.parent?n(e.parent,e[t?`end`:`start`]):e,v=(e,t)=>{typeof e==`string`&&(e=p(e)),typeof t==`string`&&(t=p(t)),e=_(e),t=_(t,!0);let n=e[e.length-1],r=t[t.length-1],i=[],a=[],o=[],s=!0,c=Math.max(n.length,r.length);for(let e=0;ee===3||e===4,b=({nodeType:e})=>e===1,x=(e,t)=>{let n=Array.from(e.childNodes).filter(e=>y(e)||b(e));return t?n.map(e=>{let n=t(e);return n===NodeFilter.FILTER_REJECT?null:n===NodeFilter.FILTER_SKIP?x(e,t):e}).flat().filter(e=>e):n},S=(e,t)=>{let n=x(e,t).reduce((e,t)=>{let n=e[e.length-1];return n?y(t)?Array.isArray(n)?n.push(t):y(n)?e[e.length-1]=[n,t]:e.push(t):b(n)?e.push(null,t):e.push(t):e.push(t),e},[]);return b(n[0])&&n.unshift(`first`),b(n[n.length-1])&&n.push(`last`),n.unshift(`before`),n.push(`after`),n},C=(e,t,n)=>{let{id:r}=t[t.length-1];if(r){let t=e.ownerDocument.getElementById(r);if(t)return{node:t,offset:0}}for(let{index:r}of t){let t=e?S(e,n)[r]:null;if(t===`first`)return{node:e.firstChild??e};if(t===`last`)return{node:e.lastChild??e};if(t===`before`)return{node:e,before:!0};if(t===`after`)return{node:e,after:!0};e=t}let{offset:i}=t[t.length-1];if(!Array.isArray(e))return{node:e,offset:i};let a=0;for(let t of e){let{length:e}=t.nodeValue;if(a+e>=i)return{node:t,offset:i-a};a+=e}},w=(e,t,n)=>{let{id:r,parentNode:i}=e;for(;n&&i&&i!==e.ownerDocument.documentElement&&n(i)===NodeFilter.FILTER_SKIP;)i=i.parentNode;let a=S(i,n),o=a.findIndex(t=>Array.isArray(t)?t.some(t=>t===e):t===e),s=a[o];if(Array.isArray(s)){let n=0;for(let r of s)if(r===e){n+=t;break}else n+=r.nodeValue.length;t=n}let c={id:r,index:o,offset:t};return(i===e.ownerDocument.documentElement?[c]:w(i,null,n).concat(c)).filter(e=>e.index!==-1)},T=(e,t)=>{let{startContainer:n,startOffset:r,endContainer:i,endOffset:a}=e,o=w(n,r,t);if(e.collapsed)return g([o]);let s=w(i,a,t);return v([o],[s])},E=(e,t,n)=>{let r=_(t),i=_(t,!0),a=e.documentElement,o=C(a,r[0],n),s=C(a,i[0],n),c=e.createRange();return o.before?c.setStartBefore(o.node):o.after?c.setStartAfter(o.node):c.setStart(o.node,o.offset),s.before?c.setEndBefore(s.node):s.after?c.setEndAfter(s.node):c.setEnd(s.node,s.offset),c},D=e=>{let t=[],{parentNode:n}=e[0],r=w(n);for(let[i,a]of S(n).entries()){let n=e[t.length];a===n&&t.push(g([r.concat({id:n.id,index:i})]))}return t},O=(e,t)=>C(e.documentElement,_(t)).node,k={fromIndex:e=>o(`/6/${(e+1)*2}`),toIndex:e=>e?.at(-1).index/2-1};export{c as a,E as c,i,D as n,p as o,T as r,O as s,k as t}; \ No newline at end of file diff --git a/dist-embed/assets/fb2-DgH9Jg0u.js b/dist-embed/assets/fb2-DgH9Jg0u.js new file mode 100644 index 0000000..ba6ba60 --- /dev/null +++ b/dist-embed/assets/fb2-DgH9Jg0u.js @@ -0,0 +1,53 @@ +var e=e=>e?e.replace(/[\t\n\f\r ]+/g,` `).replace(/^[\t\n\f\r ]+/,``).replace(/[\t\n\f\r ]+$/,``):``,t=t=>e(t?.textContent),n={XLINK:`http://www.w3.org/1999/xlink`,EPUB:`http://www.idpf.org/2007/ops`},r={XML:`application/xml`,XHTML:`application/xhtml+xml`},i={strong:[`strong`,`self`],emphasis:[`em`,`self`],style:[`span`,`self`],a:`anchor`,strikethrough:[`s`,`self`],sub:[`sub`,`self`],sup:[`sup`,`self`],code:[`code`,`self`],image:`image`},a={tr:[`tr`,{th:[`th`,i,[`colspan`,`rowspan`,`align`,`valign`]],td:[`td`,i,[`colspan`,`rowspan`,`align`,`valign`]]},[`align`]]},o={epigraph:[`blockquote`],subtitle:[`h2`,i],"text-author":[`p`,i],date:[`p`,i],stanza:`stanza`},s={title:[`header`,{p:[`h1`,i],"empty-line":[`br`]}],epigraph:[`blockquote`,`self`],image:`image`,annotation:[`aside`],section:[`section`,`self`],p:[`p`,i],poem:[`blockquote`,o],subtitle:[`h2`,i],cite:[`blockquote`,`self`],"empty-line":[`br`],table:[`table`,a],"text-author":[`p`,i]};o.epigraph.push(s);var c={image:`image`,title:[`section`,{p:[`h1`,i],"empty-line":[`br`]}],epigraph:[`section`,s],section:[`section`,s]},l=class{constructor(e){this.fb2=e,this.doc=document.implementation.createDocument(n.XHTML,`html`),this.bins=new Map(Array.from(this.fb2.getElementsByTagName(`binary`),e=>[e.id,e]))}getImageSrc(e){let t=e.getAttributeNS(n.XLINK,`href`);if(!t)return`data:,`;let[,r]=t.split(`#`);if(!r)return t;let i=this.bins.get(r);return i?`data:${i.getAttribute(`content-type`)};base64,${i.textContent}`:t}image(e){let t=this.doc.createElement(`img`);return t.alt=e.getAttribute(`alt`),t.title=e.getAttribute(`title`),t.setAttribute(`src`,this.getImageSrc(e)),t}anchor(e){let t=this.convert(e,{a:[`a`,i]});return t.setAttribute(`href`,e.getAttributeNS(n.XLINK,`href`)),e.getAttribute(`type`)===`note`&&t.setAttributeNS(n.EPUB,`epub:type`,`noteref`),t}stanza(e){let t=this.convert(e,{stanza:[`p`,{title:[`header`,{p:[`strong`,i],"empty-line":[`br`]}],subtitle:[`p`,i]}]});for(let n of e.children)n.nodeName===`v`&&(t.append(this.doc.createTextNode(n.textContent)),t.append(this.doc.createElement(`br`)));return t}convert(e,t){if(e.nodeType===3)return this.doc.createTextNode(e.textContent);if(e.nodeType===4)return this.doc.createCDATASection(e.textContent);if(e.nodeType===8)return this.doc.createComment(e.textContent);let n=t?.[e.nodeName];if(!n)return null;if(typeof n==`string`)return this[n](e);let[r,i,a]=n,o=this.doc.createElement(r);if(e.id&&(o.id=e.id),o.classList.add(e.nodeName),Array.isArray(a))for(let t of a){let n=e.getAttribute(t);n&&o.setAttribute(t,n)}let s=i===`self`?t:i,c=e.firstChild;for(;c;){let e=this.convert(c,s);e&&o.append(e),c=c.nextSibling}return o}},u=async e=>{let t=await e.arrayBuffer(),n=new TextDecoder(`utf-8`).decode(t),i=new DOMParser,a=i.parseFromString(n,r.XML),o=a.xmlEncoding||n.match(/^<\?xml\s+version\s*=\s*["']1.\d+"\s+encoding\s*=\s*["']([A-Za-z0-9._-]*)["']/)?.[1];if(o&&o.toLowerCase()!==`utf-8`){let e=new TextDecoder(o).decode(t);return i.parseFromString(e,r.XML)}return a},d=URL.createObjectURL(new Blob([` +@namespace epub "http://www.idpf.org/2007/ops"; +body > img, section > img { + display: block; + margin: auto; +} +.title h1 { + text-align: center; +} +body > section > .title, body.notesBodyType > .title { + margin: 3em 0; +} +body.notesBodyType > section .title h1 { + text-align: start; +} +body.notesBodyType > section .title { + margin: 1em 0; +} +p { + text-indent: 1em; + margin: 0; +} +:not(p) + p, p:first-child { + text-indent: 0; +} +.poem p { + text-indent: 0; + margin: 1em 0; +} +.text-author, .date { + text-align: end; +} +.text-author:before { + content: "—"; +} +table { + border-collapse: collapse; +} +td, th { + padding: .25em; +} +a[epub|type~="noteref"] { + font-size: .75em; + vertical-align: super; +} +body:not(.notesBodyType) > .title, body:not(.notesBodyType) > .epigraph { + margin: 3em 0; +} +`],{type:`text/css`})),f=e=>` + + + ${e} +`,p=`data-foliate-id`,m=async n=>{let i={},a=await u(n),o=new l(a),d=e=>a.querySelector(e),m=e=>[...a.querySelectorAll(e)],h=e=>{let n=t(e.querySelector(`nickname`));if(n)return n;let r=t(e.querySelector(`first-name`)),i=t(e.querySelector(`middle-name`)),a=t(e.querySelector(`last-name`));return{name:[r,i,a].filter(e=>e).join(` `),sortAs:a?[a,[r,i].filter(e=>e).join(` `)].join(`, `):null}},g=e=>e?.getAttribute(`value`)??t(e),_=d(`title-info annotation`);if(i.metadata={title:t(d(`title-info book-title`)),identifier:t(d(`document-info id`)),language:t(d(`title-info lang`)),author:m(`title-info author`).map(h),translator:m(`title-info translator`).map(h),contributor:m(`document-info author`).map(h).concat(m(`document-info program-used`).map(t)).map(e=>Object.assign(typeof e==`string`?{name:e}:e,{role:`bkp`})),publisher:t(d(`publish-info publisher`)),published:g(d(`title-info date`)),modified:g(d(`document-info date`)),description:_?o.convert(_,{annotation:[`div`,s]}).innerHTML:null,subject:m(`title-info genre`).map(t)},d(`coverpage image`)){let e=o.getImageSrc(d(`coverpage image`));i.getCover=()=>fetch(e).then(e=>e.blob())}else i.getCover=()=>null;let v=Array.from(a.querySelectorAll(`body`),e=>{let t=o.convert(e,{body:[`body`,c]});return[Array.from(t.children,e=>({el:e,ids:[e,...e.querySelectorAll(`[id]`)].map(e=>e.id)})),t]}),y=[],b=v[0][0].map(({el:e,ids:n})=>({ids:n,titles:Array.from(e.querySelectorAll(`:scope > section > .title`),(e,n)=>(e.setAttribute(p,n),{title:t(e),index:n})),el:e})).concat(v.slice(1).map(([e,t])=>{let n=e.map(e=>e.ids).flat();return t.classList.add(`notesBodyType`),{ids:n,el:t,linear:`no`}})).map(({ids:t,titles:n,el:i,linear:a})=>{let o=f(i.outerHTML),s=new Blob([o],{type:r.XHTML}),c=URL.createObjectURL(s);return y.push(c),{ids:t,title:e(i.querySelector(`.title, .subtitle, p`)?.textContent??(i.classList.contains(`title`)?i.textContent:``)),titles:n,load:()=>c,createDocument:()=>new DOMParser().parseFromString(o,r.XHTML),size:s.size-Array.from(i.querySelectorAll(`[src]`),e=>e.getAttribute(`src`)?.length??0).reduce((e,t)=>e+t,0),linear:a}}),x=new Map;return i.sections=b.map((e,t)=>{let{ids:n,load:r,createDocument:i,size:a,linear:o}=e;for(let e of n)e&&x.set(e,t);return{id:t,load:r,createDocument:i,size:a,linear:o}}),i.toc=b.map(({title:e,titles:t},n)=>{let r=n.toString();return{label:e,href:r,subitems:t?.length?t.map(({title:e,index:t})=>({label:e,href:`${r}#${t}`})):null}}).filter(e=>e),i.resolveHref=e=>{let[t,n]=e.split(`#`);return t?{index:Number(t),anchor:e=>e.querySelector(`[${p}="${n}"]`)}:{index:x.get(n),anchor:e=>e.getElementById(n)}},i.splitTOCHref=e=>e?.split(`#`)?.map(e=>Number(e))??[],i.getTOCFragment=(e,t)=>e.querySelector(`[${p}="${t}"]`),i.isExternal=e=>/^\w+:/i.test(e),i.destroy=()=>{for(let e of y)URL.revokeObjectURL(e)},i};export{m as makeFB2}; \ No newline at end of file diff --git a/dist-embed/assets/fflate-CIG33RrD.js b/dist-embed/assets/fflate-CIG33RrD.js new file mode 100644 index 0000000..694b145 --- /dev/null +++ b/dist-embed/assets/fflate-CIG33RrD.js @@ -0,0 +1 @@ +var e=Uint8Array,t=Uint16Array,n=Int32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(e,r){for(var i=new t(31),a=0;a<31;++a)i[a]=r+=1<>1|(21845&f)<<1;p=(61680&(p=(52428&p)>>2|(13107&p)<<2))>>4|(3855&p)<<4,d[f]=((65280&p)>>8|(255&p)<<8)>>1}var m=function(e,n,r){for(var i=e.length,a=0,o=new t(n);a>l]=u}else for(s=new t(i),a=0;a>15-e[a]);return s},h=new e(288);for(f=0;f<144;++f)h[f]=8;for(f=144;f<256;++f)h[f]=9;for(f=256;f<280;++f)h[f]=7;for(f=280;f<288;++f)h[f]=8;var g=new e(32);for(f=0;f<32;++f)g[f]=5;var _=m(h,9,1),ee=m(g,5,1),v=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},y=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},b=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},te=function(e){return(e+7)/8|0},x=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],S=function(e,t,n){var r=Error(t||x[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,S),!n)throw r;return r},C=function(t,n,o,s){var l=t.length,d=s?s.length:0;if(!l||n.f&&!n.l)return o||new e(0);var f=!o,p=f||n.i!=2,h=n.i;f&&(o=new e(3*l));var g=function(t){var n=o.length;if(t>n){var r=new e(Math.max(2*n,t));r.set(o),o=r}},x=n.f||0,C=n.p||0,w=n.b||0,T=n.l,E=n.d,D=n.m,O=n.n,k=8*l;do{if(!T){x=y(t,C,1);var A=y(t,C+1,3);if(C+=3,!A){var j=t[(B=te(C)+4)-4]|t[B-3]<<8,M=B+j;if(M>l){h&&S(0);break}p&&g(w+j),o.set(t.subarray(B,M),w),n.b=w+=j,n.p=C=8*M,n.f=x;continue}if(A==1)T=_,E=ee,D=9,O=5;else if(A==2){var N=y(t,C,31)+257,P=y(t,C+10,15)+4,F=N+y(t,C+5,31)+1;C+=14;for(var I=new e(F),L=new e(19),R=0;R>4)<16)I[R++]=B;else{var H=0,U=0;for(B==16?(U=3+y(t,C,3),C+=2,H=I[R-1]):B==17?(U=3+y(t,C,7),C+=3):B==18&&(U=11+y(t,C,127),C+=7);U--;)I[R++]=H}}var W=I.subarray(0,N),G=I.subarray(N);D=v(W),O=v(G),T=m(W,D,1),E=m(G,O,1)}else S(1);if(C>k){h&&S(0);break}}p&&g(w+131072);for(var ie=(1<>4;if((C+=15&H)>k){h&&S(0);break}if(H||S(2),q<256)o[w++]=q;else{if(q==256){K=C,T=null;break}var J=q-254;if(q>264){var Y=r[R=q-257];J=y(t,C,(1<>4;if(X||S(3),C+=15&X,G=u[Z],Z>3&&(Y=i[Z],G+=b(t,C)&(1<k){h&&S(0);break}p&&g(w+131072);var Q=w+J;if(wt.length)&&(r=t.length),new e(t.subarray(n,r))}(o,0,w):o.subarray(0,w)},w=new e(0);function T(e,t){return C(e.subarray((n=e,r=t&&t.dictionary,((15&n[0])!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&S(6,`invalid zlib data`),(n[1]>>5&1)==+!r&&S(6,`invalid zlib data: `+(32&n[1]?`need`:`unexpected`)+` dictionary`),2+(n[1]>>3&4)),-4),{i:2},t&&t.out,t&&t.dictionary);var n,r}var E=typeof TextDecoder<`u`&&new TextDecoder;try{E.decode(w,{stream:!0})}catch{}export{T as unzlibSync}; \ No newline at end of file diff --git a/dist-embed/assets/fixed-layout-BfuYLi-X.js b/dist-embed/assets/fixed-layout-BfuYLi-X.js new file mode 100644 index 0000000..be3eda9 --- /dev/null +++ b/dist-embed/assets/fixed-layout-BfuYLi-X.js @@ -0,0 +1,8 @@ +import{a as e,i as t,n,r,t as i}from"./classPrivateFieldSet2-CUhwy2NK.js";import{t as a}from"./defineProperty-BbfpZ9Tg.js";var o=e=>e?.split(/[,;\s]/)?.filter(e=>e)?.map(e=>e.split(`=`).map(e=>e.trim())),s=(e,t)=>{if(e.documentElement.localName===`svg`){let[,,t,n]=e.documentElement.getAttribute(`viewBox`)?.split(/\s/)??[];return{width:t,height:n}}let n=o(e.querySelector(`meta[name="viewport"]`)?.getAttribute(`content`));if(n)return Object.fromEntries(n);if(typeof t==`string`)return o(t);if(t?.width&&t.height)return t;let r=e.querySelector(`img`);return r?{width:r.naturalWidth,height:r.naturalHeight}:(console.warn(Error(`Missing viewport properties`)),{width:1e3,height:2e3})},c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakSet,y=class extends HTMLElement{constructor(){super(),e(this,v),t(this,c,this.attachShadow({mode:`closed`})),t(this,l,new ResizeObserver(()=>r(v,this,x).call(this))),t(this,u,void 0),t(this,d,-1),a(this,`defaultViewport`,void 0),a(this,`spread`,void 0),t(this,f,!1),t(this,p,void 0),t(this,m,void 0),t(this,h,void 0),t(this,g,void 0),t(this,_,void 0);let i=new CSSStyleSheet;n(c,this).adoptedStyleSheets=[i],i.replaceSync(`:host { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + overflow: auto; + }`),n(l,this).observe(this)}attributeChangedCallback(e,t,n){switch(e){case`zoom`:i(_,this,n!==`fit-width`&&n!==`fit-page`?parseFloat(n):n),r(v,this,x).call(this);break}}open(e){this.book=e;let{rendition:t}=e;this.spread=t?.spread,this.defaultViewport=t?.viewport;let n=e.dir===`rtl`,r=!n;this.rtl=n,t?.spread===`none`?i(u,this,e.sections.map(e=>({center:e}))):i(u,this,e.sections.reduce((e,t,i)=>{let a=e[e.length-1],{pageSpread:o}=t,s=()=>{let t={};return e.push(t),t};if(o===`center`){let e=a.left||a.right?s():a;e.center=t}else if(o===`left`){let e=a.center||a.left||r&&i?s():a;e.left=t}else if(o===`right`){let e=a.center||a.right||n&&i?s():a;e.right=t}else r?a.center||a.right?s().left=t:a.left||!i?a.right=t:a.left=t:a.center||a.left?s().right=t:a.right||!i?a.left=t:a.right=t;return e},[{}]))}get index(){let e=n(u,this)[n(d,this)],t=e?.center??(n(g,this)===`left`?e.left??e.right:e.right??e.left);return this.book.sections.indexOf(t)}getSpreadOf(e){let t=n(u,this);for(let n=0;nn(u,this).length-1)return;if(e===n(d,this)){r(v,this,x).call(this,t);return}i(d,this,e);let o=n(u,this)[e];if(o.center){let e=this.book.sections.indexOf(o.center),t=await o.center?.load?.();await r(v,this,S).call(this,{center:{index:e,src:t}})}else{let e=this.book.sections.indexOf(o.left),n=this.book.sections.indexOf(o.right),i=await o.left?.load?.(),a=await o.right?.load?.(),s={index:e,src:i},c={index:n,src:a};await r(v,this,S).call(this,{left:s,right:c,side:t})}r(v,this,T).call(this,a)}async select(e){await this.goTo(e)}async goTo(e){let{book:t}=this,n=await e,r=t.sections[n.index];if(!r)return;let{index:i,side:a}=this.getSpreadOf(r);await this.goToSpread(i,a)}async next(){if(!(this.rtl?r(v,this,C).call(this):r(v,this,w).call(this)))return this.goToSpread(n(d,this)+1,this.rtl?`right`:`left`,`page`)}async prev(){if(!(this.rtl?r(v,this,w).call(this):r(v,this,C).call(this)))return this.goToSpread(n(d,this)-1,this.rtl?`left`:`right`,`page`)}getContents(){return Array.from(n(c,this).querySelectorAll(`iframe`),e=>({doc:e.contentDocument}))}destroy(){n(l,this).unobserve(this)}};async function b({index:e,src:t}){let r=typeof t==`string`,i=r?t:t?.src,a=r?null:t?.onZoom,o=document.createElement(`div`);o.setAttribute(`dir`,`ltr`);let l=document.createElement(`iframe`);return o.append(l),Object.assign(l.style,{border:`0`,display:`none`,overflow:`hidden`}),l.setAttribute(`sandbox`,`allow-same-origin allow-scripts`),l.setAttribute(`scrolling`,`no`),l.setAttribute(`part`,`filter`),n(c,this).append(o),i?new Promise(t=>{l.addEventListener(`load`,()=>{let n=l.contentDocument;this.dispatchEvent(new CustomEvent(`load`,{detail:{doc:n,index:e}}));let{width:r,height:i}=s(n,this.defaultViewport);t({element:o,iframe:l,width:parseFloat(r),height:parseFloat(i),onZoom:a})},{once:!0}),l.src=i}):{blank:!0,element:o,iframe:l}}function x(e=n(g,this)){if(!e)return;let t=n(p,this)??{},r=n(h,this)??n(m,this)??{},a=e===`left`?t:r,{width:o,height:s}=this.getBoundingClientRect(),c=this.spread!==`both`&&this.spread!==`portrait`&&s>o;i(f,this,c);let l=t.width??r.width??0,u=t.height??r.height??0,d=typeof n(_,this)==`number`&&!isNaN(n(_,this))?n(_,this):(n(_,this)===`fit-width`?c||n(h,this)?o/(a.width??l):o/((t.width??l)+(r.width??l)):c||n(h,this)?Math.min(o/(a.width??l),s/(a.height??u)):Math.min(o/((t.width??l)+(r.width??l)),s/Math.max(t.height??u,r.height??u)))||1,v=e=>{let{element:t,iframe:n,width:r,height:i,blank:o,onZoom:s}=e;if(!n)return;s&&s({doc:e.iframe.contentDocument,scale:d});let f=s?d:1;Object.assign(n.style,{width:`${r*f}px`,height:`${i*f}px`,transform:s?`none`:`scale(${d})`,transformOrigin:`top left`,display:o?`none`:`block`}),Object.assign(t.style,{width:`${(r??l)*d}px`,height:`${(i??u)*d}px`,overflow:`hidden`,display:`block`,flexShrink:`0`,marginBlock:`auto`}),c&&e!==a&&(t.style.display=`none`)};n(h,this)?v(n(h,this)):(v(t),v(r))}async function S({left:e,right:t,center:a,side:o}){n(c,this).replaceChildren(),i(p,this,null),i(m,this,null),i(h,this,null),a?(i(h,this,await r(v,this,b).call(this,a)),i(g,this,`center`),r(v,this,x).call(this)):(i(p,this,await r(v,this,b).call(this,e)),i(m,this,await r(v,this,b).call(this,t)),i(g,this,n(p,this).blank?`right`:n(m,this).blank?`left`:o),r(v,this,x).call(this))}function C(){if(!(n(h,this)||n(p,this)?.blank)&&n(f,this)&&n(p,this)?.element?.style?.display===`none`)return i(g,this,`left`),r(v,this,x).call(this),r(v,this,T).call(this,`page`),!0}function w(){if(!(n(h,this)||n(m,this)?.blank)&&n(f,this)&&n(m,this)?.element?.style?.display===`none`)return i(g,this,`right`),r(v,this,x).call(this),r(v,this,T).call(this,`page`),!0}function T(e){this.dispatchEvent(new CustomEvent(`relocate`,{detail:{reason:e,range:null,index:this.index,fraction:0,size:1}}))}a(y,`observedAttributes`,[`zoom`]),customElements.define(`foliate-fxl`,y);export{y as FixedLayout}; \ No newline at end of file diff --git a/dist-embed/assets/foliate-pdf-stub-D0ViEO2I.js b/dist-embed/assets/foliate-pdf-stub-D0ViEO2I.js new file mode 100644 index 0000000..b317105 --- /dev/null +++ b/dist-embed/assets/foliate-pdf-stub-D0ViEO2I.js @@ -0,0 +1 @@ +var e=()=>{throw Error(`PDFs are handled by ReaderJS PDFRenderer, not foliate-js`)};export{e as makePDF}; \ No newline at end of file diff --git a/dist-embed/assets/full.esm-BRjqxzY6.js b/dist-embed/assets/full.esm-BRjqxzY6.js new file mode 100644 index 0000000..3e63fbd --- /dev/null +++ b/dist-embed/assets/full.esm-BRjqxzY6.js @@ -0,0 +1,2 @@ +import{i as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./reader-Bd1ccloG.js";var n=typeof self<`u`?self:global,r=typeof navigator<`u`,i=r&&typeof HTMLImageElement>`u`,a=!(typeof global>`u`||typeof process>`u`||!process.versions||!process.versions.node),o=n.Buffer,s=n.BigInt,c=!!o,l=e=>e;function u(n,r=l){if(a)try{return typeof e==`function`?Promise.resolve(r(e(n))):t(()=>import(n).then(r),[],import.meta.url)}catch{console.warn(`Couldn't load ${n}`)}}var d=n.fetch,f=e=>d=e;if(!n.fetch){let e=u(`http`,(e=>e)),t=u(`https`,(e=>e)),n=(r,{headers:i}={})=>new Promise((async(a,o)=>{let{port:s,hostname:c,pathname:l,protocol:u,search:d}=new URL(r),f={method:`GET`,hostname:c,path:encodeURI(l)+d,headers:i};s!==``&&(f.port=Number(s));let p=(u===`https:`?await t:await e).request(f,(e=>{if(e.statusCode===301||e.statusCode===302)return n(new URL(e.headers.location,r).toString(),{headers:i}).then(a).catch(o);a({status:e.statusCode,arrayBuffer:()=>new Promise((t=>{let n=[];e.on(`data`,(e=>n.push(e))),e.on(`end`,(()=>t(Buffer.concat(n))))}))})}));p.on(`error`,o),p.end()}));f(n)}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=e=>te(e)?void 0:e,ee=e=>e!==void 0;function te(e){return e===void 0||(e instanceof Map?e.size===0:Object.values(e).filter(ee).length===0)}function h(e){let t=Error(e);throw delete t.stack,t}function g(e){return(e=function(e){for(;e.endsWith(`\0`);)e=e.slice(0,-1);return e}(e).trim())===``?void 0:e}function ne(e){let t=function(e){let t=0;return e.ifd0.enabled&&(t+=1024),e.exif.enabled&&(t+=2048),e.makerNote&&(t+=2048),e.userComment&&(t+=1024),e.gps.enabled&&(t+=512),e.interop.enabled&&(t+=100),e.ifd1.enabled&&(t+=1024),t+2048}(e);return e.jfif.enabled&&(t+=50),e.xmp.enabled&&(t+=2e4),e.iptc.enabled&&(t+=14e3),e.icc.enabled&&(t+=6e3),t}var re=e=>String.fromCharCode.apply(null,e),ie=typeof TextDecoder<`u`?new TextDecoder(`utf-8`):void 0;function ae(e){return ie?ie.decode(e):c?Buffer.from(e).toString(`utf8`):decodeURIComponent(escape(re(e)))}var _=class e{static from(t,n){return t instanceof this&&t.le===n?t:new e(t,void 0,void 0,n)}constructor(t,n=0,r,i){if(typeof i==`boolean`&&(this.le=i),Array.isArray(t)&&(t=new Uint8Array(t)),t===0)this.byteOffset=0,this.byteLength=0;else if(t instanceof ArrayBuffer){r===void 0&&(r=t.byteLength-n);let e=new DataView(t,n,r);this._swapDataView(e)}else if(t instanceof Uint8Array||t instanceof DataView||t instanceof e){r===void 0&&(r=t.byteLength-n),(n+=t.byteOffset)+r>t.byteOffset+t.byteLength&&h(`Creating view outside of available memory in ArrayBuffer`);let e=new DataView(t.buffer,n,r);this._swapDataView(e)}else if(typeof t==`number`){let e=new DataView(new ArrayBuffer(t));this._swapDataView(e)}else h(`Invalid input argument for BufferView: `+t)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(t,n,r=e){return t instanceof DataView||t instanceof e?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t instanceof Uint8Array||h(`BufferView.set(): Invalid data argument.`),this.toUint8().set(t,n),new r(this,n,t.byteLength)}subarray(t,n){return n=n||this._lengthToEnd(t),new e(this,t,n)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return ae(this.getUint8Array(e,t))}getLatin1String(e=0,t=this.byteLength){return re(this.getUint8Array(e,t))}getUnicodeString(e=0,t=this.byteLength){let n=[];for(let r=0;r1e4?de(e,t,`base64`):a&&e.includes(`://`)?ue(e,t,`url`,x):a?de(e,t,`fs`):r?ue(e,t,`url`,x):void h(`Invalid input argument`);var n}async function ue(e,t,n,r){return b.has(n)?de(e,t,n):r?async function(e,t){return new _(await t(e))}(e,r):void h(`Parser ${n} is not loaded`)}async function de(e,t,n){let r=new(b.get(n))(e,t);return await r.read(),r}var x=e=>d(e).then((e=>e.arrayBuffer())),S=e=>new Promise(((t,n)=>{let r=new FileReader;r.onloadend=()=>t(r.result||new ArrayBuffer),r.onerror=n,r.readAsArrayBuffer(e)})),fe=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function C(e,t,n){let r=new fe;for(let[e,t]of n)r.set(e,t);if(Array.isArray(t))for(let n of t)e.set(n,r);else e.set(t,r);return r}function w(e,t,n){let r,i=e.get(t);for(r of n)i.set(r[0],r[1])}var T=new Map,E=new Map,D=new Map,O=[`chunked`,`firstChunkSize`,`firstChunkSizeNode`,`firstChunkSizeBrowser`,`chunkSize`,`chunkLimit`],k=[`jfif`,`xmp`,`icc`,`iptc`,`ihdr`],A=[`tiff`,...k],j=[`ifd0`,`ifd1`,`exif`,`gps`,`interop`],M=[...A,...j],N=[`makerNote`,`userComment`],P=[`translateKeys`,`translateValues`,`reviveValues`,`multiSegment`],F=[...P,`sanitize`,`mergeOutput`,`silentErrors`],pe=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},I=class extends pe{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,n,r){if(super(),p(this,`enabled`,!1),p(this,`skip`,new Set),p(this,`pick`,new Set),p(this,`deps`,new Set),p(this,`translateKeys`,!1),p(this,`translateValues`,!1),p(this,`reviveValues`,!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(r),this.canBeFiltered=j.includes(e),this.canBeFiltered&&(this.dict=T.get(e)),n!==void 0)if(Array.isArray(n))this.parse=this.enabled=!0,this.canBeFiltered&&n.length>0&&this.translateTagSet(n,this.pick);else if(typeof n==`object`){if(this.enabled=!0,this.parse=!1!==n.parse,this.canBeFiltered){let{pick:e,skip:t}=n;e&&e.length>0&&this.translateTagSet(e,this.pick),t&&t.length>0&&this.translateTagSet(t,this.skip)}this.applyInheritables(n)}else!0===n||!1===n?this.parse=this.enabled=n:h(`Invalid options argument: ${n}`)}applyInheritables(e){let t,n;for(t of P)n=e[t],n!==void 0&&(this[t]=n)}translateTagSet(e,t){if(this.dict){let n,r,{tagKeys:i,tagValues:a}=this.dict;for(n of e)typeof n==`string`?(r=a.indexOf(n),r===-1&&(r=i.indexOf(Number(n))),r!==-1&&t.add(Number(i[r]))):t.add(n)}else for(let n of e)t.add(n)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,z(this.pick,this.deps)):this.enabled&&this.pick.size>0&&z(this.pick,this.deps)}},L={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},me=new Map,R=class extends pe{static useCached(e){let t=me.get(e);return t!==void 0||(t=new this(e),me.set(e,t)),t}constructor(e){super(),!0===e?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e==`object`?this.setupFromObject(e):h(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=r?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of O)this[e]=L[e];for(e of F)this[e]=L[e];for(e of N)this[e]=L[e];for(e of M)this[e]=new I(e,L[e],void 0,this)}setupFromTrue(){let e;for(e of O)this[e]=L[e];for(e of F)this[e]=L[e];for(e of N)this[e]=!0;for(e of M)this[e]=new I(e,!0,void 0,this)}setupFromArray(e){let t;for(t of O)this[t]=L[t];for(t of F)this[t]=L[t];for(t of N)this[t]=L[t];for(t of M)this[t]=new I(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,j)}setupFromObject(e){let t;for(t of(j.ifd0=j.ifd0||j.image,j.ifd1=j.ifd1||j.thumbnail,Object.assign(this,e),O))this[t]=ge(e[t],L[t]);for(t of F)this[t]=ge(e[t],L[t]);for(t of N)this[t]=ge(e[t],L[t]);for(t of A)this[t]=new I(t,L[t],e[t],this);for(t of j)this[t]=new I(t,L[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,j,M),!0===e.tiff?this.batchEnableWithBool(j,!0):!1===e.tiff?this.batchEnableWithUserValue(j,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,j):typeof e.tiff==`object`&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,j)}batchEnableWithBool(e,t){for(let n of e)this[n].enabled=t}batchEnableWithUserValue(e,t){for(let n of e){let e=t[n];this[n].enabled=!1!==e&&e!==void 0}}setupGlobalFilters(e,t,n,r=n){if(e&&e.length){for(let e of r)this[e].enabled=!1;let t=he(e,n);for(let[e,n]of t)z(this[e].pick,n),this[e].enabled=!0}else if(t&&t.length){let e=he(t,n);for(let[t,n]of e)z(this[t].skip,n)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:n,iptc:r,icc:i}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),n.enabled||e.skip.add(700),r.enabled||e.skip.add(33723),i.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:n,interop:r}=this;r.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),n.needed&&e.deps.add(34853),this.tiff.enabled=j.some((e=>!0===this[e].enabled))||this.makerNote||this.userComment;for(let e of j)this[e].finalizeFilters()}get onlyTiff(){return!k.map((e=>this[e].enabled)).some((e=>!0===e))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of A)this[e].enabled&&!y.has(e)&&oe(`segment parser`,e)}};function he(e,t){let n,r,i,a,o=[];for(i of t){for(a of(n=T.get(i),r=[],n))(e.includes(a[0])||e.includes(a[1]))&&r.push(a[0]);r.length&&o.push([i,r])}return o}function ge(e,t){return e===void 0?t===void 0?void 0:t:e}function z(e,t){for(let n of t)e.add(n)}p(R,`default`,L);var B=class{constructor(e){p(this,`parsers`,{}),p(this,`output`,{}),p(this,`errors`,[]),p(this,`pushToErrors`,(e=>this.errors.push(e))),this.options=R.useCached(e)}async read(e){this.file=await ce(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[n,r]of v)if(r.canHandle(e,t))return this.fileParser=new r(this.options,this.file,this.parsers),e[n]=!0;this.file.close&&this.file.close(),h(`Unknown file format`)}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),m(e)}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async t=>{let n=await t.parse();t.assignToOutput(e,n)}));this.options.silentErrors&&(t=t.map((e=>e.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,n=y.get(`tiff`,e);var r;if(t.tiff?r={start:0,type:`tiff`}:t.jpeg&&(r=await this.fileParser.getOrFindSegment(`tiff`)),r===void 0)return;let i=await this.fileParser.ensureSegmentChunk(r),a=await(this.parsers.tiff=new n(i,e,t)).extractThumbnail();return t.close&&t.close(),a}};async function V(e,t){let n=new B(t);return await n.read(e),n.parse()}var _e=Object.freeze({__proto__:null,parse:V,Exifr:B,fileParsers:v,segmentParsers:y,fileReaders:b,tagKeys:T,tagValues:E,tagRevivers:D,createDictionary:C,extendDictionary:w,fetchUrlAsArrayBuffer:x,readBlobAsArrayBuffer:S,chunkedProps:O,otherSegments:k,segments:A,tiffBlocks:j,segmentsAndBlocks:M,tiffExtractables:N,inheritables:P,allFormatters:F,Options:R}),H=class{constructor(e,t,n){p(this,`errors`,[]),p(this,`ensureSegmentChunk`,(async e=>{let t=e.start,n=e.size||65536;if(this.file.chunked)if(this.file.available(t,n))e.chunk=this.file.subarray(t,n);else try{e.chunk=await this.file.readChunk(t,n)}catch(t){h(`Couldn't read segment: ${JSON.stringify(e)}. ${t.message}`)}else this.file.byteLength>t+n?e.chunk=this.file.subarray(t,n):e.size===void 0?e.chunk=this.file.subarray(t):h(`Segment unreachable: `+JSON.stringify(e));return e.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=n}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let n=new(y.get(e))(t,this.options,this.file);return this.parsers[e]=n}createParsers(e){for(let t of e){let{type:e,chunk:n}=t,r=this.options[e];if(r&&r.enabled){let t=this.parsers[e];t&&t.append||t||this.createParser(e,n)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}},U=class{static findPosition(e,t){let n=e.getUint16(t+2)+2,r=typeof this.headerLength==`function`?this.headerLength(e,t,n):this.headerLength,i=t+r,a=n-r;return{offset:t,length:n,headerLength:r,start:i,size:a,end:i+a}}static parse(e,t={}){return new this(e,new R({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof _?e:new _(e)}constructor(e,t={},n){p(this,`errors`,[]),p(this,`raw`,new Map),p(this,`handleError`,(e=>{if(!this.options.silentErrors)throw e;this.errors.push(e.message)})),this.chunk=this.normalizeInput(e),this.file=n,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let n=D.get(t),r=E.get(t),i=T.get(t),a=this.options[t],o=a.reviveValues&&!!n,s=a.translateValues&&!!r,c=a.translateKeys&&!!i,l={};for(let[t,a]of e)o&&n.has(t)?a=n.get(t)(a):s&&r.has(t)&&(a=this.translateValue(a,r.get(t))),c&&i.has(t)&&(t=i.get(t)||t),l[t]=a;return l}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,n){if(this.globalOptions.mergeOutput)return Object.assign(e,n);e[t]?Object.assign(e[t],n):e[t]=n}};p(U,`headerLength`,4),p(U,`type`,void 0),p(U,`multiSegment`,!1),p(U,`canHandle`,(()=>!1));function ve(e){return e===192||e===194||e===196||e===219||e===221||e===218||e===254}function ye(e){return e>=224&&e<=239}function be(e,t,n){for(let[r,i]of y)if(i.canHandle(e,t,n))return r}var xe=class extends H{constructor(...e){super(...e),p(this,`appSegments`,[]),p(this,`jpegSegments`,[]),p(this,`unknownSegments`,[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){!0===e?(this.findAll=!0,this.wanted=new Set(y.keyList())):(e=e===void 0?y.keyList().filter((e=>this.options[e].enabled)):e.filter((e=>this.options[e].enabled&&y.has(e))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:n,findAll:r,wanted:i,remaining:a}=this;if(!r&&this.file.chunked&&(r=Array.from(i).some((e=>{let t=y.get(e),n=this.options[e];return t.multiSegment&&n.multiSegment})),r&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,n.byteLength),!this.options.onlyTiff&&n.chunked){let t=!1;for(;a.size>0&&!t&&(n.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:r}=n,i=this.appSegments.some((e=>!this.file.available(e.offset||e.start,e.length||e.size)));if(t=e>r&&!i?!await n.readNextChunk(e):!await n.readNextChunk(r),(e=this.findAppSegmentsInRange(e,n.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let n,r,i,a,o,s,{file:c,findAll:l,wanted:u,remaining:d,options:f}=this;for(;ee.multiSegment)))return;let e=function(e,t){let n,r,i,a=new Map;for(let o=0;o{let n=y.get(e,this.options);return n.handleMultiSegments?{type:e,chunk:n.handleMultiSegments(t)}:t[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};p(xe,`type`,`jpeg`),v.set(`jpeg`,xe);var Se=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Ce=class extends U{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,n=new Map){let{pick:r,skip:i}=this.options[t];r=new Set(r);let a=r.size>0,o=i.size===0,s=this.chunk.getUint16(e);e+=2;for(let c=0;c13)&&h(`Invalid TIFF value type. block: ${n.toUpperCase()}, tag: ${t.toString(16)}, type: ${i}, offset ${e}`),e>r.byteLength&&h(`Invalid TIFF value offset. block: ${n.toUpperCase()}, tag: ${t.toString(16)}, type: ${i}, offset ${e} is outside of chunk size ${r.byteLength}`),i===1)return r.getUint8Array(e,a);if(i===2)return g(r.getString(e,a));if(i===7)return r.getUint8Array(e,a);if(a===1)return this.parseTagValue(i,e);{let t=new(function(e){switch(e){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(i))(a),n=o;for(let r=0;re.byteLength&&h(`IFD0 offset points to outside of file.\nthis.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,ne(this.options));let t=this.parseBlock(this.ifd0Offset,`ifd0`);return t.size===0?void 0:(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t)}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,ne(this.options));let e=this.parseBlock(this.exifOffset,`exif`);return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let n=e.get(t);n&&n.length===1&&e.set(t,n[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,`gps`);return e&&e.has(2)&&e.has(4)&&(e.set(`latitude`,Te(...e.get(2),e.get(1))),e.set(`longitude`,Te(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,`interop`)}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,`ifd1`),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,n,r={};for(t of j)if(e=this[t],!te(e))if(n=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t===`ifd1`)continue;Object.assign(r,n)}else r[t]=n;return this.makerNote&&(r.makerNote=this.makerNote),this.userComment&&(r.userComment=this.userComment),r}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[n,r]of Object.entries(t))this.assignObjectToOutput(e,n,r)}};function Te(e,t,n,r){var i=e+t/60+n/3600;return r!==`S`&&r!==`W`||(i*=-1),i}p(we,`type`,`tiff`),p(we,`headerLength`,10),y.set(`tiff`,we);var Ee=Object.freeze({__proto__:null,default:_e,Exifr:B,fileParsers:v,segmentParsers:y,fileReaders:b,tagKeys:T,tagValues:E,tagRevivers:D,createDictionary:C,extendDictionary:w,fetchUrlAsArrayBuffer:x,readBlobAsArrayBuffer:S,chunkedProps:O,otherSegments:k,segments:A,tiffBlocks:j,segmentsAndBlocks:M,tiffExtractables:N,inheritables:P,allFormatters:F,Options:R,parse:V}),De={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},W=Object.assign({},De,{firstChunkSize:4e4,gps:[1,2,3,4]});async function Oe(e){let t=new B(W);await t.read(e);let n=await t.parse();if(n&&n.gps){let{latitude:e,longitude:t}=n.gps;return{latitude:e,longitude:t}}}var G=Object.assign({},De,{tiff:!1,ifd1:!0,mergeOutput:!1});async function ke(e){let t=new B(G);await t.read(e);let n=await t.extractThumbnail();return n&&c?o.from(n):n}async function Ae(e){let t=await this.thumbnail(e);if(t!==void 0){let e=new Blob([t]);return URL.createObjectURL(e)}}var K=Object.assign({},De,{firstChunkSize:4e4,ifd0:[274]});async function q(e){let t=new B(K);await t.read(e);let n=await t.parse();if(n&&n.ifd0)return n.ifd0[274]}var je=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),J=!0,Y=!0;if(typeof navigator==`object`){let e=navigator.userAgent;if(e.includes(`iPad`)||e.includes(`iPhone`)){let t=e.match(/OS (\d+)_(\d+)/);if(t){let[,e,n]=t;J=Number(e)+.1*Number(n)<13.4,Y=!1}}else if(e.includes(`OS X 10`)){let[,t]=e.match(/OS X 10[_.](\d+)/);J=Y=Number(t)<15}if(e.includes(`Chrome/`)){let[,t]=e.match(/Chrome\/(\d+)/);J=Y=Number(t)<81}else if(e.includes(`Firefox/`)){let[,t]=e.match(/Firefox\/(\d+)/);J=Y=Number(t)<77}}async function Me(e){let t=await q(e);return Object.assign({canvas:J,css:Y},je[t])}var Ne=class extends _{constructor(...e){super(...e),p(this,`ranges`,new Pe),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,n){if(e===0&&this.byteLength===0&&n){let e=new DataView(n.buffer||n,n.byteOffset,n.byteLength);this._swapDataView(e)}else{let n=e+t;if(n>this.byteLength){let{dataView:e}=this._extend(n);this._swapDataView(e)}}}_extend(e){let t;t=c?o.allocUnsafe(e):new Uint8Array(e);let n=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:n}}subarray(e,t,n=!1){return t=t||this._lengthToEnd(e),n&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,n=!1){n&&this._tryExtend(t,e.byteLength,e);let r=super.set(e,t);return this.ranges.add(t,r.byteLength),r}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Pe=class{constructor(){p(this,`list`,[])}get length(){return this.list.length}add(e,t,n=0){let r=e+t,i=this.list.filter((t=>Fe(e,t.offset,r)||Fe(e,t.end,r)));if(i.length>0){e=Math.min(e,...i.map((e=>e.offset))),r=Math.max(r,...i.map((e=>e.end))),t=r-e;let n=i.shift();n.offset=e,n.length=t,n.end=r,this.list=this.list.filter((e=>!i.includes(e)))}else this.list.push({offset:e,length:t,end:r})}available(e,t){let n=e+t;return this.list.some((t=>t.offset<=e&&n<=t.end))}};function Fe(e,t,n){return e<=t&&t<=n}var Ie=class extends Ne{constructor(e,t){super(0),p(this,`chunksRead`,0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,n=await this.readChunk(e,t);return!!n&&n.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksReade.kind===t))}parseBoxHead(e){let t=this.file.getUint32(e),n=this.file.getString(e+4,4),r=e+8;return t===1&&(t=this.file.getUint64(e+8),r+=8),{offset:e,length:t,kind:n,start:r}}parseBoxFullHead(e){e.version===void 0&&(e.version=this.file.getUint32(e.start)>>24,e.start+=4)}},ze=class extends Re{static canHandle(e,t){if(t!==0)return!1;let n=e.getUint16(2);if(n>50)return!1;let r=16,i=[];for(;r=2&&(r=t.version===3?4:2,i=this.file.getString(n+r+2,4),i===`Exif`))return this.file.getUintBytes(n,r);a+=t.length}}get8bits(e){let t=this.file.getUint8(e);return[t>>4,15&t]}findExtentInIloc(e,t){this.parseBoxFullHead(e);let n=e.start,[r,i]=this.get8bits(n++),[a,o]=this.get8bits(n++),s=e.version===2?4:2,c=e.version===1||e.version===2?2:0,l=o+r+i,u=e.version===2?4:2,d=this.file.getUintBytes(n,u);for(n+=u;d--;){let e=this.file.getUintBytes(n,s);n+=s+c+2+a;let u=this.file.getUint16(n);if(n+=2,e===t)return u>1&&console.warn(`ILOC box has more than one extent but we're only processing one +Please create an issue at https://github.com/MikeKovarik/exifr with this file`),[this.file.getUintBytes(n+o,r),this.file.getUintBytes(n+o+r,i)];n+=u*l}}},Be=class extends ze{};p(Be,`type`,`heic`);var Ve=class extends ze{};p(Ve,`type`,`avif`),v.set(`heic`,Be),v.set(`avif`,Ve),C(T,[`ifd0`,`ifd1`],[[256,`ImageWidth`],[257,`ImageHeight`],[258,`BitsPerSample`],[259,`Compression`],[262,`PhotometricInterpretation`],[270,`ImageDescription`],[271,`Make`],[272,`Model`],[273,`StripOffsets`],[274,`Orientation`],[277,`SamplesPerPixel`],[278,`RowsPerStrip`],[279,`StripByteCounts`],[282,`XResolution`],[283,`YResolution`],[284,`PlanarConfiguration`],[296,`ResolutionUnit`],[301,`TransferFunction`],[305,`Software`],[306,`ModifyDate`],[315,`Artist`],[316,`HostComputer`],[317,`Predictor`],[318,`WhitePoint`],[319,`PrimaryChromaticities`],[513,`ThumbnailOffset`],[514,`ThumbnailLength`],[529,`YCbCrCoefficients`],[530,`YCbCrSubSampling`],[531,`YCbCrPositioning`],[532,`ReferenceBlackWhite`],[700,`ApplicationNotes`],[33432,`Copyright`],[33723,`IPTC`],[34665,`ExifIFD`],[34675,`ICC`],[34853,`GpsIFD`],[330,`SubIFD`],[40965,`InteropIFD`],[40091,`XPTitle`],[40092,`XPComment`],[40093,`XPAuthor`],[40094,`XPKeywords`],[40095,`XPSubject`]]),C(T,`exif`,[[33434,`ExposureTime`],[33437,`FNumber`],[34850,`ExposureProgram`],[34852,`SpectralSensitivity`],[34855,`ISO`],[34858,`TimeZoneOffset`],[34859,`SelfTimerMode`],[34864,`SensitivityType`],[34865,`StandardOutputSensitivity`],[34866,`RecommendedExposureIndex`],[34867,`ISOSpeed`],[34868,`ISOSpeedLatitudeyyy`],[34869,`ISOSpeedLatitudezzz`],[36864,`ExifVersion`],[36867,`DateTimeOriginal`],[36868,`CreateDate`],[36873,`GooglePlusUploadCode`],[36880,`OffsetTime`],[36881,`OffsetTimeOriginal`],[36882,`OffsetTimeDigitized`],[37121,`ComponentsConfiguration`],[37122,`CompressedBitsPerPixel`],[37377,`ShutterSpeedValue`],[37378,`ApertureValue`],[37379,`BrightnessValue`],[37380,`ExposureCompensation`],[37381,`MaxApertureValue`],[37382,`SubjectDistance`],[37383,`MeteringMode`],[37384,`LightSource`],[37385,`Flash`],[37386,`FocalLength`],[37393,`ImageNumber`],[37394,`SecurityClassification`],[37395,`ImageHistory`],[37396,`SubjectArea`],[37500,`MakerNote`],[37510,`UserComment`],[37520,`SubSecTime`],[37521,`SubSecTimeOriginal`],[37522,`SubSecTimeDigitized`],[37888,`AmbientTemperature`],[37889,`Humidity`],[37890,`Pressure`],[37891,`WaterDepth`],[37892,`Acceleration`],[37893,`CameraElevationAngle`],[40960,`FlashpixVersion`],[40961,`ColorSpace`],[40962,`ExifImageWidth`],[40963,`ExifImageHeight`],[40964,`RelatedSoundFile`],[41483,`FlashEnergy`],[41486,`FocalPlaneXResolution`],[41487,`FocalPlaneYResolution`],[41488,`FocalPlaneResolutionUnit`],[41492,`SubjectLocation`],[41493,`ExposureIndex`],[41495,`SensingMethod`],[41728,`FileSource`],[41729,`SceneType`],[41730,`CFAPattern`],[41985,`CustomRendered`],[41986,`ExposureMode`],[41987,`WhiteBalance`],[41988,`DigitalZoomRatio`],[41989,`FocalLengthIn35mmFormat`],[41990,`SceneCaptureType`],[41991,`GainControl`],[41992,`Contrast`],[41993,`Saturation`],[41994,`Sharpness`],[41996,`SubjectDistanceRange`],[42016,`ImageUniqueID`],[42032,`OwnerName`],[42033,`SerialNumber`],[42034,`LensInfo`],[42035,`LensMake`],[42036,`LensModel`],[42037,`LensSerialNumber`],[42080,`CompositeImage`],[42081,`CompositeImageCount`],[42082,`CompositeImageExposureTimes`],[42240,`Gamma`],[59932,`Padding`],[59933,`OffsetSchema`],[65e3,`OwnerName`],[65001,`SerialNumber`],[65002,`Lens`],[65100,`RawFile`],[65101,`Converter`],[65102,`WhiteBalance`],[65105,`Exposure`],[65106,`Shadows`],[65107,`Brightness`],[65108,`Contrast`],[65109,`Saturation`],[65110,`Sharpness`],[65111,`Smoothness`],[65112,`MoireFilter`],[40965,`InteropIFD`]]),C(T,`gps`,[[0,`GPSVersionID`],[1,`GPSLatitudeRef`],[2,`GPSLatitude`],[3,`GPSLongitudeRef`],[4,`GPSLongitude`],[5,`GPSAltitudeRef`],[6,`GPSAltitude`],[7,`GPSTimeStamp`],[8,`GPSSatellites`],[9,`GPSStatus`],[10,`GPSMeasureMode`],[11,`GPSDOP`],[12,`GPSSpeedRef`],[13,`GPSSpeed`],[14,`GPSTrackRef`],[15,`GPSTrack`],[16,`GPSImgDirectionRef`],[17,`GPSImgDirection`],[18,`GPSMapDatum`],[19,`GPSDestLatitudeRef`],[20,`GPSDestLatitude`],[21,`GPSDestLongitudeRef`],[22,`GPSDestLongitude`],[23,`GPSDestBearingRef`],[24,`GPSDestBearing`],[25,`GPSDestDistanceRef`],[26,`GPSDestDistance`],[27,`GPSProcessingMethod`],[28,`GPSAreaInformation`],[29,`GPSDateStamp`],[30,`GPSDifferential`],[31,`GPSHPositioningError`]]),C(E,[`ifd0`,`ifd1`],[[274,{1:`Horizontal (normal)`,2:`Mirror horizontal`,3:`Rotate 180`,4:`Mirror vertical`,5:`Mirror horizontal and rotate 270 CW`,6:`Rotate 90 CW`,7:`Mirror horizontal and rotate 90 CW`,8:`Rotate 270 CW`}],[296,{1:`None`,2:`inches`,3:`cm`}]]);var X=C(E,`exif`,[[34850,{0:`Not defined`,1:`Manual`,2:`Normal program`,3:`Aperture priority`,4:`Shutter priority`,5:`Creative program`,6:`Action program`,7:`Portrait mode`,8:`Landscape mode`}],[37121,{0:`-`,1:`Y`,2:`Cb`,3:`Cr`,4:`R`,5:`G`,6:`B`}],[37383,{0:`Unknown`,1:`Average`,2:`CenterWeightedAverage`,3:`Spot`,4:`MultiSpot`,5:`Pattern`,6:`Partial`,255:`Other`}],[37384,{0:`Unknown`,1:`Daylight`,2:`Fluorescent`,3:`Tungsten (incandescent light)`,4:`Flash`,9:`Fine weather`,10:`Cloudy weather`,11:`Shade`,12:`Daylight fluorescent (D 5700 - 7100K)`,13:`Day white fluorescent (N 4600 - 5400K)`,14:`Cool white fluorescent (W 3900 - 4500K)`,15:`White fluorescent (WW 3200 - 3700K)`,17:`Standard light A`,18:`Standard light B`,19:`Standard light C`,20:`D55`,21:`D65`,22:`D75`,23:`D50`,24:`ISO studio tungsten`,255:`Other`}],[37385,{0:`Flash did not fire`,1:`Flash fired`,5:`Strobe return light not detected`,7:`Strobe return light detected`,9:`Flash fired, compulsory flash mode`,13:`Flash fired, compulsory flash mode, return light not detected`,15:`Flash fired, compulsory flash mode, return light detected`,16:`Flash did not fire, compulsory flash mode`,24:`Flash did not fire, auto mode`,25:`Flash fired, auto mode`,29:`Flash fired, auto mode, return light not detected`,31:`Flash fired, auto mode, return light detected`,32:`No flash function`,65:`Flash fired, red-eye reduction mode`,69:`Flash fired, red-eye reduction mode, return light not detected`,71:`Flash fired, red-eye reduction mode, return light detected`,73:`Flash fired, compulsory flash mode, red-eye reduction mode`,77:`Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected`,79:`Flash fired, compulsory flash mode, red-eye reduction mode, return light detected`,89:`Flash fired, auto mode, red-eye reduction mode`,93:`Flash fired, auto mode, return light not detected, red-eye reduction mode`,95:`Flash fired, auto mode, return light detected, red-eye reduction mode`}],[41495,{1:`Not defined`,2:`One-chip color area sensor`,3:`Two-chip color area sensor`,4:`Three-chip color area sensor`,5:`Color sequential area sensor`,7:`Trilinear sensor`,8:`Color sequential linear sensor`}],[41728,{1:`Film Scanner`,2:`Reflection Print Scanner`,3:`Digital Camera`}],[41729,{1:`Directly photographed`}],[41985,{0:`Normal`,1:`Custom`,2:`HDR (no original saved)`,3:`HDR (original saved)`,4:`Original (for HDR)`,6:`Panorama`,7:`Portrait HDR`,8:`Portrait`}],[41986,{0:`Auto`,1:`Manual`,2:`Auto bracket`}],[41987,{0:`Auto`,1:`Manual`}],[41990,{0:`Standard`,1:`Landscape`,2:`Portrait`,3:`Night`,4:`Other`}],[41991,{0:`None`,1:`Low gain up`,2:`High gain up`,3:`Low gain down`,4:`High gain down`}],[41996,{0:`Unknown`,1:`Macro`,2:`Close`,3:`Distant`}],[42080,{0:`Unknown`,1:`Not a Composite Image`,2:`General Composite Image`,3:`Composite Image Captured While Shooting`}]]),He={1:`No absolute unit of measurement`,2:`Inch`,3:`Centimeter`};X.set(37392,He),X.set(41488,He);var Ue={0:`Normal`,1:`Low`,2:`High`};function We(e){return typeof e==`object`&&e.length!==void 0?e[0]:e}function Ge(e){let t=Array.from(e).slice(1);return t[1]>15&&(t=t.map((e=>String.fromCharCode(e)))),t[2]!==`0`&&t[2]!==0||t.pop(),t.join(`.`)}function Ke(e){if(typeof e==`string`){var[t,n,r,i,a,o]=e.trim().split(/[-: ]/g).map(Number),s=new Date(t,n-1,r);return Number.isNaN(i)||Number.isNaN(a)||Number.isNaN(o)||(s.setHours(i),s.setMinutes(a),s.setSeconds(o)),Number.isNaN(+s)?e:s}}function Z(e){if(typeof e==`string`)return e;let t=[];if(e[1]===0&&e[e.length-1]===0)for(let n=0;nArray.from(e).join(`.`)],[7,e=>Array.from(e).join(`:`)]]);var Je=class extends U{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1752462448&&e.getString(t+4,20)===`http://ns.adobe.com/`}static headerLength(e,t){return e.getString(t+4,34)===`http://ns.adobe.com/xmp/extension/`?79:33}static findPosition(e,t){let n=super.findPosition(e,t);return n.multiSegment=n.extended=n.headerLength===79,n.multiSegment?(n.chunkCount=e.getUint8(t+72),n.chunkNumber=e.getUint8(t+76),e.getUint8(t+77)!==0&&n.chunkNumber++):(n.chunkCount=1/0,n.chunkNumber=-1),n}static handleMultiSegments(e){return e.map((e=>e.chunk.getString())).join(``)}normalizeInput(e){return typeof e==`string`?e:_.from(e).getString()}parse(e=this.chunk){if(!this.localOptions.parse)return e;e=function(e){let t={},n={};for(let e of rt)t[e]=[],n[e]=0;return e.replace(it,((e,r,i)=>{if(r===`<`){let r=++n[i];return t[i].push(r),`${e}#${r}`}return`${e}#${t[i].pop()}`}))}(e);let t=Xe.findAll(e,`rdf`,`Description`);t.length===0&&t.push(new Xe(`rdf`,`Description`,void 0,e));let n,r={};for(let e of t)for(let t of e.properties)n=et(t.ns,r),Ze(t,n);return function(e){let t;for(let n in e)t=e[n]=m(e[n]),t===void 0&&delete e[n];return m(e)}(r)}assignToOutput(e,t){if(this.localOptions.parse)for(let[n,r]of Object.entries(t))switch(n){case`tiff`:this.assignObjectToOutput(e,`ifd0`,r);break;case`exif`:this.assignObjectToOutput(e,`exif`,r);break;case`xmlns`:break;default:this.assignObjectToOutput(e,n,r)}else e.xmp=t}};p(Je,`type`,`xmp`),p(Je,`multiSegment`,!0),y.set(`xmp`,Je);var Ye=class e{static findAll(t){return tt(t,/([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(e.unpackMatch)}static unpackMatch(t){let n=t[1],r=t[2],i=t[3].slice(1,-1);return i=nt(i),new e(n,r,i)}constructor(e,t,n){this.ns=e,this.name=t,this.value=n}serialize(){return this.value}},Xe=class e{static findAll(t,n,r){if(n!==void 0||r!==void 0){n=n||`[\\w\\d-]+`,r=r||`[\\w\\d-]+`;var i=RegExp(`<(${n}):(${r})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`,`gm`)}else i=/<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;return tt(t,i).map(e.unpackMatch)}static unpackMatch(t){let n=t[1],r=t[2],i=t[4],a=t[8];return new e(n,r,i,a)}constructor(t,n,r,i){this.ns=t,this.name=n,this.attrString=r,this.innerXml=i,this.attrs=Ye.findAll(r),this.children=e.findAll(i),this.value=this.children.length===0?nt(i):void 0,this.properties=[...this.attrs,...this.children]}get isPrimitive(){return this.value!==void 0&&this.attrs.length===0&&this.children.length===0}get isListContainer(){return this.children.length===1&&this.children[0].isList}get isList(){let{ns:e,name:t}=this;return e===`rdf`&&(t===`Seq`||t===`Bag`||t===`Alt`)}get isListItem(){return this.ns===`rdf`&&this.name===`li`}serialize(){if(this.properties.length===0&&this.value===void 0)return;if(this.isPrimitive)return this.value;if(this.isListContainer)return this.children[0].serialize();if(this.isList)return $e(this.children.map(Qe));if(this.isListItem&&this.children.length===1&&this.attrs.length===0)return this.children[0].serialize();let e={};for(let t of this.properties)Ze(t,e);return this.value!==void 0&&(e.value=this.value),m(e)}};function Ze(e,t){let n=e.serialize();n!==void 0&&(t[e.name]=n)}var Qe=e=>e.serialize(),$e=e=>e.length===1?e[0]:e,et=(e,t)=>t[e]?t[e]:t[e]={};function tt(e,t){let n,r=[];if(!e)return r;for(;(n=t.exec(e))!==null;)r.push(n);return r}function nt(e){if(function(e){return e==null||e===`null`||e===`undefined`||e===``||e.trim()===``}(e))return;let t=Number(e);if(!Number.isNaN(t))return t;let n=e.toLowerCase();return n===`true`||n!==`false`&&e.trim()}var rt=[`rdf:li`,`rdf:Seq`,`rdf:Bag`,`rdf:Alt`,`rdf:Description`],it=RegExp(`(<|\\/)(${rt.join(`|`)})`,`g`),at=Object.freeze({__proto__:null,default:Le,Exifr:B,fileParsers:v,segmentParsers:y,fileReaders:b,tagKeys:T,tagValues:E,tagRevivers:D,createDictionary:C,extendDictionary:w,fetchUrlAsArrayBuffer:x,readBlobAsArrayBuffer:S,chunkedProps:O,otherSegments:k,segments:A,tiffBlocks:j,segmentsAndBlocks:M,tiffExtractables:N,inheritables:P,allFormatters:F,Options:R,parse:V,gpsOnlyOptions:W,gps:Oe,thumbnailOnlyOptions:G,thumbnail:ke,thumbnailUrl:Ae,orientationOnlyOptions:K,orientation:q,rotations:je,get rotateCanvas(){return J},get rotateCss(){return Y},rotation:Me}),ot=[`xmp`,`icc`,`iptc`,`tiff`],st=()=>{};async function ct(e,t,n){let r=new R(t);r.chunked=!1,n===void 0&&typeof e==`string`&&(n=function(e){let t=e.toLowerCase().split(`.`).pop();if(function(e){return e===`exif`||e===`tiff`||e===`tif`}(t))return`tiff`;if(ot.includes(t))return t}(e));let i=await ce(e,r);if(n){if(ot.includes(n))return lt(n,i,r);h(`Invalid segment type`)}else{if(function(e){let t=e.getString(0,50).trim();return t.includes(`e.promises));b.set(`fs`,class extends Ie{async readWhole(){this.chunked=!1,this.fs=await ut;let e=await this.fs.readFile(this.input);this._swapBuffer(e)}async readChunked(){this.chunked=!0,this.fs=await ut,await this.open(),await this.readChunk(0,this.options.firstChunkSize)}async open(){this.fh===void 0&&(this.fh=await this.fs.open(this.input,`r`),this.size=(await this.fh.stat(this.input)).size)}async _readChunk(e,t){this.fh===void 0&&await this.open(),e+t>this.size&&(t=this.size-e);var n=this.subarray(e,t,!0);return await this.fh.read(n.dataView,0,t,e),n}async close(){if(this.fh){let e=this.fh;this.fh=void 0,await e.close()}}}),b.set(`base64`,class extends Ie{constructor(...e){super(...e),this.input=this.input.replace(/^data:([^;]+);base64,/gim,``),this.size=this.input.length/4*3,this.input.endsWith(`==`)?this.size-=2:this.input.endsWith(`=`)&&--this.size}async _readChunk(e,t){let n,r,i=this.input;e===void 0?(e=0,n=0,r=0):(n=4*Math.floor(e/3),r=e-n/4*3),t===void 0&&(t=this.size);let a=e+t,s=n+4*Math.ceil(a/3);i=i.slice(n,s);let l=Math.min(t,this.size-e);if(c){let t=o.from(i,`base64`).slice(r,r+l);return this.set(t,e,!0)}{let t=this.subarray(e,l,!0),n=atob(i),a=t.toUint8();for(let e=0;ethis.errors.push(e))),p(this,`metaChunks`,[]),p(this,`unknownChunks`,[])}static canHandle(e,t){return t===35152&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834}async parse(){let{file:e}=this;await this.findPngChunksInRange(8,e.byteLength),await this.readSegments(this.metaChunks),this.findIhdr(),this.parseTextChunks(),await this.findExif().catch(this.catchError),await this.findXmp().catch(this.catchError),await this.findIcc().catch(this.catchError)}async findPngChunksInRange(e,t){let{file:n}=this;for(;ee.type===`text`));for(let t of e){let[e,n]=this.file.getString(t.start,t.size).split(`\0`);this.injectKeyValToIhdr(e,n)}}injectKeyValToIhdr(e,t){let n=this.parsers.ihdr;n&&n.raw.set(e,t)}findIhdr(){let e=this.metaChunks.find((e=>e.type===`ihdr`));e&&!1!==this.options.ihdr.enabled&&this.createParser(`ihdr`,e.chunk)}async findExif(){let e=this.metaChunks.find((e=>e.type===`exif`));e&&this.injectSegment(`tiff`,e.chunk)}async findXmp(){let e=this.metaChunks.filter((e=>e.type===`itxt`));for(let t of e)t.chunk.getString(0,17)===`XML:com.adobe.xmp`&&this.injectSegment(`xmp`,t.chunk)}async findIcc(){let e=this.metaChunks.find((e=>e.type===`iccp`));if(!e)return;let{chunk:t}=e,n=t.getUint8Array(0,81),r=0;for(;r<80&&n[r]!==0;)r++;let i=r+2,o=t.getString(0,r);if(this.injectKeyValToIhdr(`ProfileName`,o),a){let e=await ft,n=t.getUint8Array(i);n=e.inflateSync(n),this.injectSegment(`icc`,n)}}};p(mt,`type`,`png`),v.set(`png`,mt),C(T,`interop`,[[1,`InteropIndex`],[2,`InteropVersion`],[4096,`RelatedImageFileFormat`],[4097,`RelatedImageWidth`],[4098,`RelatedImageHeight`]]),w(T,`ifd0`,[[11,`ProcessingSoftware`],[254,`SubfileType`],[255,`OldSubfileType`],[263,`Thresholding`],[264,`CellWidth`],[265,`CellLength`],[266,`FillOrder`],[269,`DocumentName`],[280,`MinSampleValue`],[281,`MaxSampleValue`],[285,`PageName`],[286,`XPosition`],[287,`YPosition`],[290,`GrayResponseUnit`],[297,`PageNumber`],[321,`HalftoneHints`],[322,`TileWidth`],[323,`TileLength`],[332,`InkSet`],[337,`TargetPrinter`],[18246,`Rating`],[18249,`RatingPercent`],[33550,`PixelScale`],[34264,`ModelTransform`],[34377,`PhotoshopSettings`],[50706,`DNGVersion`],[50707,`DNGBackwardVersion`],[50708,`UniqueCameraModel`],[50709,`LocalizedCameraModel`],[50736,`DNGLensInfo`],[50739,`ShadowScale`],[50740,`DNGPrivateData`],[33920,`IntergraphMatrix`],[33922,`ModelTiePoint`],[34118,`SEMInfo`],[34735,`GeoTiffDirectory`],[34736,`GeoTiffDoubleParams`],[34737,`GeoTiffAsciiParams`],[50341,`PrintIM`],[50721,`ColorMatrix1`],[50722,`ColorMatrix2`],[50723,`CameraCalibration1`],[50724,`CameraCalibration2`],[50725,`ReductionMatrix1`],[50726,`ReductionMatrix2`],[50727,`AnalogBalance`],[50728,`AsShotNeutral`],[50729,`AsShotWhiteXY`],[50730,`BaselineExposure`],[50731,`BaselineNoise`],[50732,`BaselineSharpness`],[50734,`LinearResponseLimit`],[50735,`CameraSerialNumber`],[50741,`MakerNoteSafety`],[50778,`CalibrationIlluminant1`],[50779,`CalibrationIlluminant2`],[50781,`RawDataUniqueID`],[50827,`OriginalRawFileName`],[50828,`OriginalRawFileData`],[50831,`AsShotICCProfile`],[50832,`AsShotPreProfileMatrix`],[50833,`CurrentICCProfile`],[50834,`CurrentPreProfileMatrix`],[50879,`ColorimetricReference`],[50885,`SRawType`],[50898,`PanasonicTitle`],[50899,`PanasonicTitle2`],[50931,`CameraCalibrationSig`],[50932,`ProfileCalibrationSig`],[50933,`ProfileIFD`],[50934,`AsShotProfileName`],[50936,`ProfileName`],[50937,`ProfileHueSatMapDims`],[50938,`ProfileHueSatMapData1`],[50939,`ProfileHueSatMapData2`],[50940,`ProfileToneCurve`],[50941,`ProfileEmbedPolicy`],[50942,`ProfileCopyright`],[50964,`ForwardMatrix1`],[50965,`ForwardMatrix2`],[50966,`PreviewApplicationName`],[50967,`PreviewApplicationVersion`],[50968,`PreviewSettingsName`],[50969,`PreviewSettingsDigest`],[50970,`PreviewColorSpace`],[50971,`PreviewDateTime`],[50972,`RawImageDigest`],[50973,`OriginalRawFileDigest`],[50981,`ProfileLookTableDims`],[50982,`ProfileLookTableData`],[51043,`TimeCodes`],[51044,`FrameRate`],[51058,`TStop`],[51081,`ReelName`],[51089,`OriginalDefaultFinalSize`],[51090,`OriginalBestQualitySize`],[51091,`OriginalDefaultCropSize`],[51105,`CameraLabel`],[51107,`ProfileHueSatMapEncoding`],[51108,`ProfileLookTableEncoding`],[51109,`BaselineExposureOffset`],[51110,`DefaultBlackRender`],[51111,`NewRawImageDigest`],[51112,`RawToPreviewGain`]]);var ht=[[273,`StripOffsets`],[279,`StripByteCounts`],[288,`FreeOffsets`],[289,`FreeByteCounts`],[291,`GrayResponseCurve`],[292,`T4Options`],[293,`T6Options`],[300,`ColorResponseUnit`],[320,`ColorMap`],[324,`TileOffsets`],[325,`TileByteCounts`],[326,`BadFaxLines`],[327,`CleanFaxData`],[328,`ConsecutiveBadFaxLines`],[330,`SubIFD`],[333,`InkNames`],[334,`NumberofInks`],[336,`DotRange`],[338,`ExtraSamples`],[339,`SampleFormat`],[340,`SMinSampleValue`],[341,`SMaxSampleValue`],[342,`TransferRange`],[343,`ClipPath`],[344,`XClipPathUnits`],[345,`YClipPathUnits`],[346,`Indexed`],[347,`JPEGTables`],[351,`OPIProxy`],[400,`GlobalParametersIFD`],[401,`ProfileType`],[402,`FaxProfile`],[403,`CodingMethods`],[404,`VersionYear`],[405,`ModeNumber`],[433,`Decode`],[434,`DefaultImageColor`],[435,`T82Options`],[437,`JPEGTables`],[512,`JPEGProc`],[515,`JPEGRestartInterval`],[517,`JPEGLosslessPredictors`],[518,`JPEGPointTransforms`],[519,`JPEGQTables`],[520,`JPEGDCTables`],[521,`JPEGACTables`],[559,`StripRowCounts`],[999,`USPTOMiscellaneous`],[18247,`XP_DIP_XML`],[18248,`StitchInfo`],[28672,`SonyRawFileType`],[28688,`SonyToneCurve`],[28721,`VignettingCorrection`],[28722,`VignettingCorrParams`],[28724,`ChromaticAberrationCorrection`],[28725,`ChromaticAberrationCorrParams`],[28726,`DistortionCorrection`],[28727,`DistortionCorrParams`],[29895,`SonyCropTopLeft`],[29896,`SonyCropSize`],[32781,`ImageID`],[32931,`WangTag1`],[32932,`WangAnnotation`],[32933,`WangTag3`],[32934,`WangTag4`],[32953,`ImageReferencePoints`],[32954,`RegionXformTackPoint`],[32955,`WarpQuadrilateral`],[32956,`AffineTransformMat`],[32995,`Matteing`],[32996,`DataType`],[32997,`ImageDepth`],[32998,`TileDepth`],[33300,`ImageFullWidth`],[33301,`ImageFullHeight`],[33302,`TextureFormat`],[33303,`WrapModes`],[33304,`FovCot`],[33305,`MatrixWorldToScreen`],[33306,`MatrixWorldToCamera`],[33405,`Model2`],[33421,`CFARepeatPatternDim`],[33422,`CFAPattern2`],[33423,`BatteryLevel`],[33424,`KodakIFD`],[33445,`MDFileTag`],[33446,`MDScalePixel`],[33447,`MDColorTable`],[33448,`MDLabName`],[33449,`MDSampleInfo`],[33450,`MDPrepDate`],[33451,`MDPrepTime`],[33452,`MDFileUnits`],[33589,`AdventScale`],[33590,`AdventRevision`],[33628,`UIC1Tag`],[33629,`UIC2Tag`],[33630,`UIC3Tag`],[33631,`UIC4Tag`],[33918,`IntergraphPacketData`],[33919,`IntergraphFlagRegisters`],[33921,`INGRReserved`],[34016,`Site`],[34017,`ColorSequence`],[34018,`IT8Header`],[34019,`RasterPadding`],[34020,`BitsPerRunLength`],[34021,`BitsPerExtendedRunLength`],[34022,`ColorTable`],[34023,`ImageColorIndicator`],[34024,`BackgroundColorIndicator`],[34025,`ImageColorValue`],[34026,`BackgroundColorValue`],[34027,`PixelIntensityRange`],[34028,`TransparencyIndicator`],[34029,`ColorCharacterization`],[34030,`HCUsage`],[34031,`TrapIndicator`],[34032,`CMYKEquivalent`],[34152,`AFCP_IPTC`],[34232,`PixelMagicJBIGOptions`],[34263,`JPLCartoIFD`],[34306,`WB_GRGBLevels`],[34310,`LeafData`],[34687,`TIFF_FXExtensions`],[34688,`MultiProfiles`],[34689,`SharedData`],[34690,`T88Options`],[34732,`ImageLayer`],[34750,`JBIGOptions`],[34856,`Opto-ElectricConvFactor`],[34857,`Interlace`],[34908,`FaxRecvParams`],[34909,`FaxSubAddress`],[34910,`FaxRecvTime`],[34929,`FedexEDR`],[34954,`LeafSubIFD`],[37387,`FlashEnergy`],[37388,`SpatialFrequencyResponse`],[37389,`Noise`],[37390,`FocalPlaneXResolution`],[37391,`FocalPlaneYResolution`],[37392,`FocalPlaneResolutionUnit`],[37397,`ExposureIndex`],[37398,`TIFF-EPStandardID`],[37399,`SensingMethod`],[37434,`CIP3DataFile`],[37435,`CIP3Sheet`],[37436,`CIP3Side`],[37439,`StoNits`],[37679,`MSDocumentText`],[37680,`MSPropertySetStorage`],[37681,`MSDocumentTextPosition`],[37724,`ImageSourceData`],[40965,`InteropIFD`],[40976,`SamsungRawPointersOffset`],[40977,`SamsungRawPointersLength`],[41217,`SamsungRawByteOrder`],[41218,`SamsungRawUnknown`],[41484,`SpatialFrequencyResponse`],[41485,`Noise`],[41489,`ImageNumber`],[41490,`SecurityClassification`],[41491,`ImageHistory`],[41494,`TIFF-EPStandardID`],[41995,`DeviceSettingDescription`],[42112,`GDALMetadata`],[42113,`GDALNoData`],[44992,`ExpandSoftware`],[44993,`ExpandLens`],[44994,`ExpandFilm`],[44995,`ExpandFilterLens`],[44996,`ExpandScanner`],[44997,`ExpandFlashLamp`],[46275,`HasselbladRawImage`],[48129,`PixelFormat`],[48130,`Transformation`],[48131,`Uncompressed`],[48132,`ImageType`],[48256,`ImageWidth`],[48257,`ImageHeight`],[48258,`WidthResolution`],[48259,`HeightResolution`],[48320,`ImageOffset`],[48321,`ImageByteCount`],[48322,`AlphaOffset`],[48323,`AlphaByteCount`],[48324,`ImageDataDiscard`],[48325,`AlphaDataDiscard`],[50215,`OceScanjobDesc`],[50216,`OceApplicationSelector`],[50217,`OceIDNumber`],[50218,`OceImageLogic`],[50255,`Annotations`],[50459,`HasselbladExif`],[50547,`OriginalFileName`],[50560,`USPTOOriginalContentType`],[50656,`CR2CFAPattern`],[50710,`CFAPlaneColor`],[50711,`CFALayout`],[50712,`LinearizationTable`],[50713,`BlackLevelRepeatDim`],[50714,`BlackLevel`],[50715,`BlackLevelDeltaH`],[50716,`BlackLevelDeltaV`],[50717,`WhiteLevel`],[50718,`DefaultScale`],[50719,`DefaultCropOrigin`],[50720,`DefaultCropSize`],[50733,`BayerGreenSplit`],[50737,`ChromaBlurRadius`],[50738,`AntiAliasStrength`],[50752,`RawImageSegmentation`],[50780,`BestQualityScale`],[50784,`AliasLayerMetadata`],[50829,`ActiveArea`],[50830,`MaskedAreas`],[50935,`NoiseReductionApplied`],[50974,`SubTileBlockSize`],[50975,`RowInterleaveFactor`],[51008,`OpcodeList1`],[51009,`OpcodeList2`],[51022,`OpcodeList3`],[51041,`NoiseProfile`],[51114,`CacheVersion`],[51125,`DefaultUserCrop`],[51157,`NikonNEFInfo`],[65024,`KdcIFD`]];w(T,`ifd0`,ht),w(T,`exif`,ht),C(E,`gps`,[[23,{M:`Magnetic North`,T:`True North`}],[25,{K:`Kilometers`,M:`Miles`,N:`Nautical Miles`}]]);var gt=class extends U{static canHandle(e,t){return e.getUint8(t+1)===224&&e.getUint32(t+4)===1246120262&&e.getUint8(t+8)===0}parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint16(0)],[2,this.chunk.getUint8(2)],[3,this.chunk.getUint16(3)],[5,this.chunk.getUint16(5)],[7,this.chunk.getUint8(7)],[8,this.chunk.getUint8(8)]])}};p(gt,`type`,`jfif`),p(gt,`headerLength`,9),y.set(`jfif`,gt),C(T,`jfif`,[[0,`JFIFVersion`],[2,`ResolutionUnit`],[3,`XResolution`],[5,`YResolution`],[7,`ThumbnailWidth`],[8,`ThumbnailHeight`]]);var _t=class extends U{parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint32(0)],[4,this.chunk.getUint32(4)],[8,this.chunk.getUint8(8)],[9,this.chunk.getUint8(9)],[10,this.chunk.getUint8(10)],[11,this.chunk.getUint8(11)],[12,this.chunk.getUint8(12)],...Array.from(this.raw)])}};p(_t,`type`,`ihdr`),y.set(`ihdr`,_t),C(T,`ihdr`,[[0,`ImageWidth`],[4,`ImageHeight`],[8,`BitDepth`],[9,`ColorType`],[10,`Compression`],[11,`Filter`],[12,`Interlace`]]),C(E,`ihdr`,[[9,{0:`Grayscale`,2:`RGB`,3:`Palette`,4:`Grayscale with Alpha`,6:`RGB with Alpha`,DEFAULT:`Unknown`}],[10,{0:`Deflate/Inflate`,DEFAULT:`Unknown`}],[11,{0:`Adaptive`,DEFAULT:`Unknown`}],[12,{0:`Noninterlaced`,1:`Adam7 Interlace`,DEFAULT:`Unknown`}]]);var vt=class extends U{static canHandle(e,t){return e.getUint8(t+1)===226&&e.getUint32(t+4)===1229144927}static findPosition(e,t){let n=super.findPosition(e,t);return n.chunkNumber=e.getUint8(t+16),n.chunkCount=e.getUint8(t+17),n.multiSegment=n.chunkCount>1,n}static handleMultiSegments(e){return function(e){return new _(function(e){let t=e[0].constructor,n=0;for(let t of e)n+=t.length;let r=new t(n),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}(e.map((e=>e.chunk.toUint8()))))}(e)}parse(){return this.raw=new Map,this.parseHeader(),this.parseTags(),this.translate(),this.output}parseHeader(){let{raw:e}=this;this.chunk.byteLength<84&&h(`ICC header is too short`);for(let[t,n]of Object.entries(yt)){t=parseInt(t,10);let r=n(this.chunk,t);r!==`\0\0\0\0`&&e.set(t,r)}}parseTags(){let e,t,n,r,i,{raw:a}=this,o=this.chunk.getUint32(128),s=132,c=this.chunk.byteLength;for(;o--;){if(e=this.chunk.getString(s,4),t=this.chunk.getUint32(s+4),n=this.chunk.getUint32(s+8),r=this.chunk.getString(t,4),t+n>c)return void console.warn(`reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.`);i=this.parseTag(r,t,n),i!==void 0&&i!==`\0\0\0\0`&&a.set(e,i),s+=12}}parseTag(e,t,n){switch(e){case`desc`:return this.parseDesc(t);case`mluc`:return this.parseMluc(t);case`text`:return this.parseText(t,n);case`sig `:return this.parseSig(t)}if(!(t+n>this.chunk.byteLength))return this.chunk.getUint8Array(t,n)}parseDesc(e){let t=this.chunk.getUint32(e+8)-1;return g(this.chunk.getString(e+12,t))}parseText(e,t){return g(this.chunk.getString(e+8,t-8))}parseSig(e){return g(this.chunk.getString(e+8,4))}parseMluc(e){let{chunk:t}=this,n=t.getUint32(e+8),r=t.getUint32(e+12),i=e+16,a=[];for(let o=0;o>4,e.getUint8(t+1)%16].map((e=>e.toString(10))).join(`.`)},12:Q,16:Q,20:Q,24:function(e,t){let n=e.getUint16(t),r=e.getUint16(t+2)-1,i=e.getUint16(t+4),a=e.getUint16(t+6),o=e.getUint16(t+8),s=e.getUint16(t+10);return new Date(Date.UTC(n,r,i,a,o,s))},36:Q,40:Q,48:Q,52:Q,64:(e,t)=>e.getUint32(t),80:Q};function Q(e,t){return g(e.getString(t,4))}y.set(`icc`,vt),C(T,`icc`,[[4,`ProfileCMMType`],[8,`ProfileVersion`],[12,`ProfileClass`],[16,`ColorSpaceData`],[20,`ProfileConnectionSpace`],[24,`ProfileDateTime`],[36,`ProfileFileSignature`],[40,`PrimaryPlatform`],[44,`CMMFlags`],[48,`DeviceManufacturer`],[52,`DeviceModel`],[56,`DeviceAttributes`],[64,`RenderingIntent`],[68,`ConnectionSpaceIlluminant`],[80,`ProfileCreator`],[84,`ProfileID`],[`Header`,`ProfileHeader`],[`MS00`,`WCSProfiles`],[`bTRC`,`BlueTRC`],[`bXYZ`,`BlueMatrixColumn`],[`bfd`,`UCRBG`],[`bkpt`,`MediaBlackPoint`],[`calt`,`CalibrationDateTime`],[`chad`,`ChromaticAdaptation`],[`chrm`,`Chromaticity`],[`ciis`,`ColorimetricIntentImageState`],[`clot`,`ColorantTableOut`],[`clro`,`ColorantOrder`],[`clrt`,`ColorantTable`],[`cprt`,`ProfileCopyright`],[`crdi`,`CRDInfo`],[`desc`,`ProfileDescription`],[`devs`,`DeviceSettings`],[`dmdd`,`DeviceModelDesc`],[`dmnd`,`DeviceMfgDesc`],[`dscm`,`ProfileDescriptionML`],[`fpce`,`FocalPlaneColorimetryEstimates`],[`gTRC`,`GreenTRC`],[`gXYZ`,`GreenMatrixColumn`],[`gamt`,`Gamut`],[`kTRC`,`GrayTRC`],[`lumi`,`Luminance`],[`meas`,`Measurement`],[`meta`,`Metadata`],[`mmod`,`MakeAndModel`],[`ncl2`,`NamedColor2`],[`ncol`,`NamedColor`],[`ndin`,`NativeDisplayInfo`],[`pre0`,`Preview0`],[`pre1`,`Preview1`],[`pre2`,`Preview2`],[`ps2i`,`PS2RenderingIntent`],[`ps2s`,`PostScript2CSA`],[`psd0`,`PostScript2CRD0`],[`psd1`,`PostScript2CRD1`],[`psd2`,`PostScript2CRD2`],[`psd3`,`PostScript2CRD3`],[`pseq`,`ProfileSequenceDesc`],[`psid`,`ProfileSequenceIdentifier`],[`psvm`,`PS2CRDVMSize`],[`rTRC`,`RedTRC`],[`rXYZ`,`RedMatrixColumn`],[`resp`,`OutputResponse`],[`rhoc`,`ReflectionHardcopyOrigColorimetry`],[`rig0`,`PerceptualRenderingIntentGamut`],[`rig2`,`SaturationRenderingIntentGamut`],[`rpoc`,`ReflectionPrintOutputColorimetry`],[`sape`,`SceneAppearanceEstimates`],[`scoe`,`SceneColorimetryEstimates`],[`scrd`,`ScreeningDesc`],[`scrn`,`Screening`],[`targ`,`CharTarget`],[`tech`,`Technology`],[`vcgt`,`VideoCardGamma`],[`view`,`ViewingConditions`],[`vued`,`ViewingCondDesc`],[`wtpt`,`MediaWhitePoint`]]);var bt={"4d2p":`Erdt Systems`,AAMA:`Aamazing Technologies`,ACER:`Acer`,ACLT:`Acolyte Color Research`,ACTI:`Actix Sytems`,ADAR:`Adara Technology`,ADBE:`Adobe`,ADI:`ADI Systems`,AGFA:`Agfa Graphics`,ALMD:`Alps Electric`,ALPS:`Alps Electric`,ALWN:`Alwan Color Expertise`,AMTI:`Amiable Technologies`,AOC:`AOC International`,APAG:`Apago`,APPL:`Apple Computer`,AST:`AST`,"AT&T":`AT&T`,BAEL:`BARBIERI electronic`,BRCO:`Barco NV`,BRKP:`Breakpoint`,BROT:`Brother`,BULL:`Bull`,BUS:`Bus Computer Systems`,"C-IT":`C-Itoh`,CAMR:`Intel`,CANO:`Canon`,CARR:`Carroll Touch`,CASI:`Casio`,CBUS:`Colorbus PL`,CEL:`Crossfield`,CELx:`Crossfield`,CGS:`CGS Publishing Technologies International`,CHM:`Rochester Robotics`,CIGL:`Colour Imaging Group, London`,CITI:`Citizen`,CL00:`Candela`,CLIQ:`Color IQ`,CMCO:`Chromaco`,CMiX:`CHROMiX`,COLO:`Colorgraphic Communications`,COMP:`Compaq`,COMp:`Compeq/Focus Technology`,CONR:`Conrac Display Products`,CORD:`Cordata Technologies`,CPQ:`Compaq`,CPRO:`ColorPro`,CRN:`Cornerstone`,CTX:`CTX International`,CVIS:`ColorVision`,CWC:`Fujitsu Laboratories`,DARI:`Darius Technology`,DATA:`Dataproducts`,DCP:`Dry Creek Photo`,DCRC:`Digital Contents Resource Center, Chung-Ang University`,DELL:`Dell Computer`,DIC:`Dainippon Ink and Chemicals`,DICO:`Diconix`,DIGI:`Digital`,"DL&C":`Digital Light & Color`,DPLG:`Doppelganger`,DS:`Dainippon Screen`,DSOL:`DOOSOL`,DUPN:`DuPont`,EPSO:`Epson`,ESKO:`Esko-Graphics`,ETRI:`Electronics and Telecommunications Research Institute`,EVER:`Everex Systems`,EXAC:`ExactCODE`,Eizo:`Eizo`,FALC:`Falco Data Products`,FF:`Fuji Photo Film`,FFEI:`FujiFilm Electronic Imaging`,FNRD:`Fnord Software`,FORA:`Fora`,FORE:`Forefront Technology`,FP:`Fujitsu`,FPA:`WayTech Development`,FUJI:`Fujitsu`,FX:`Fuji Xerox`,GCC:`GCC Technologies`,GGSL:`Global Graphics Software`,GMB:`Gretagmacbeth`,GMG:`GMG`,GOLD:`GoldStar Technology`,GOOG:`Google`,GPRT:`Giantprint`,GTMB:`Gretagmacbeth`,GVC:`WayTech Development`,GW2K:`Sony`,HCI:`HCI`,HDM:`Heidelberger Druckmaschinen`,HERM:`Hermes`,HITA:`Hitachi America`,HP:`Hewlett-Packard`,HTC:`Hitachi`,HiTi:`HiTi Digital`,IBM:`IBM`,IDNT:`Scitex`,IEC:`Hewlett-Packard`,IIYA:`Iiyama North America`,IKEG:`Ikegami Electronics`,IMAG:`Image Systems`,IMI:`Ingram Micro`,INTC:`Intel`,INTL:`N/A (INTL)`,INTR:`Intra Electronics`,IOCO:`Iocomm International Technology`,IPS:`InfoPrint Solutions Company`,IRIS:`Scitex`,ISL:`Ichikawa Soft Laboratory`,ITNL:`N/A (ITNL)`,IVM:`IVM`,IWAT:`Iwatsu Electric`,Idnt:`Scitex`,Inca:`Inca Digital Printers`,Iris:`Scitex`,JPEG:`Joint Photographic Experts Group`,JSFT:`Jetsoft Development`,JVC:`JVC Information Products`,KART:`Scitex`,KFC:`KFC Computek Components`,KLH:`KLH Computers`,KMHD:`Konica Minolta`,KNCA:`Konica`,KODA:`Kodak`,KYOC:`Kyocera`,Kart:`Scitex`,LCAG:`Leica`,LCCD:`Leeds Colour`,LDAK:`Left Dakota`,LEAD:`Leading Technology`,LEXM:`Lexmark International`,LINK:`Link Computer`,LINO:`Linotronic`,LITE:`Lite-On`,Leaf:`Leaf`,Lino:`Linotronic`,MAGC:`Mag Computronic`,MAGI:`MAG Innovision`,MANN:`Mannesmann`,MICN:`Micron Technology`,MICR:`Microtek`,MICV:`Microvitec`,MINO:`Minolta`,MITS:`Mitsubishi Electronics America`,MITs:`Mitsuba`,MNLT:`Minolta`,MODG:`Modgraph`,MONI:`Monitronix`,MONS:`Monaco Systems`,MORS:`Morse Technology`,MOTI:`Motive Systems`,MSFT:`Microsoft`,MUTO:`MUTOH INDUSTRIES`,Mits:`Mitsubishi Electric`,NANA:`NANAO`,NEC:`NEC`,NEXP:`NexPress Solutions`,NISS:`Nissei Sangyo America`,NKON:`Nikon`,NONE:`none`,OCE:`Oce Technologies`,OCEC:`OceColor`,OKI:`Oki`,OKID:`Okidata`,OKIP:`Okidata`,OLIV:`Olivetti`,OLYM:`Olympus`,ONYX:`Onyx Graphics`,OPTI:`Optiquest`,PACK:`Packard Bell`,PANA:`Matsushita Electric Industrial`,PANT:`Pantone`,PBN:`Packard Bell`,PFU:`PFU`,PHIL:`Philips Consumer Electronics`,PNTX:`HOYA`,POne:`Phase One A/S`,PREM:`Premier Computer Innovations`,PRIN:`Princeton Graphic Systems`,PRIP:`Princeton Publishing Labs`,QLUX:`Hong Kong`,QMS:`QMS`,QPCD:`QPcard AB`,QUAD:`QuadLaser`,QUME:`Qume`,RADI:`Radius`,RDDx:`Integrated Color Solutions`,RDG:`Roland DG`,REDM:`REDMS Group`,RELI:`Relisys`,RGMS:`Rolf Gierling Multitools`,RICO:`Ricoh`,RNLD:`Edmund Ronald`,ROYA:`Royal`,RPC:`Ricoh Printing Systems`,RTL:`Royal Information Electronics`,SAMP:`Sampo`,SAMS:`Samsung`,SANT:`Jaime Santana Pomares`,SCIT:`Scitex`,SCRN:`Dainippon Screen`,SDP:`Scitex`,SEC:`Samsung`,SEIK:`Seiko Instruments`,SEIk:`Seikosha`,SGUY:`ScanGuy.com`,SHAR:`Sharp Laboratories`,SICC:`International Color Consortium`,SONY:`Sony`,SPCL:`SpectraCal`,STAR:`Star`,STC:`Sampo Technology`,Scit:`Scitex`,Sdp:`Scitex`,Sony:`Sony`,TALO:`Talon Technology`,TAND:`Tandy`,TATU:`Tatung`,TAXA:`TAXAN America`,TDS:`Tokyo Denshi Sekei`,TECO:`TECO Information Systems`,TEGR:`Tegra`,TEKT:`Tektronix`,TI:`Texas Instruments`,TMKR:`TypeMaker`,TOSB:`Toshiba`,TOSH:`Toshiba`,TOTK:`TOTOKU ELECTRIC`,TRIU:`Triumph`,TSBT:`Toshiba`,TTX:`TTX Computer Products`,TVM:`TVM Professional Monitor`,TW:`TW Casper`,ULSX:`Ulead Systems`,UNIS:`Unisys`,UTZF:`Utz Fehlau & Sohn`,VARI:`Varityper`,VIEW:`Viewsonic`,VISL:`Visual communication`,VIVO:`Vivo Mobile Communication`,WANG:`Wang`,WLBR:`Wilbur Imaging`,WTG2:`Ware To Go`,WYSE:`WYSE Technology`,XERX:`Xerox`,XRIT:`X-Rite`,ZRAN:`Zoran`,Zebr:`Zebra Technologies`,appl:`Apple Computer`,bICC:`basICColor`,berg:`bergdesign`,ceyd:`Integrated Color Solutions`,clsp:`MacDermid ColorSpan`,ds:`Dainippon Screen`,dupn:`DuPont`,ffei:`FujiFilm Electronic Imaging`,flux:`FluxData`,iris:`Scitex`,kart:`Scitex`,lcms:`Little CMS`,lino:`Linotronic`,none:`none`,ob4d:`Erdt Systems`,obic:`Medigraph`,quby:`Qubyx Sarl`,scit:`Scitex`,scrn:`Dainippon Screen`,sdp:`Scitex`,siwi:`SIWI GRAFIKA`,yxym:`YxyMaster`},xt={scnr:`Scanner`,mntr:`Monitor`,prtr:`Printer`,link:`Device Link`,abst:`Abstract`,spac:`Color Space Conversion Profile`,nmcl:`Named Color`,cenc:`ColorEncodingSpace profile`,mid:`MultiplexIdentification profile`,mlnk:`MultiplexLink profile`,mvis:`MultiplexVisualization profile`,nkpf:`Nikon Input Device Profile (NON-STANDARD!)`};C(E,`icc`,[[4,bt],[12,xt],[40,Object.assign({},bt,xt)],[48,bt],[80,bt],[64,{0:`Perceptual`,1:`Relative Colorimetric`,2:`Saturation`,3:`Absolute Colorimetric`}],[`tech`,{amd:`Active Matrix Display`,crt:`Cathode Ray Tube Display`,kpcd:`Photo CD`,pmd:`Passive Matrix Display`,dcam:`Digital Camera`,dcpj:`Digital Cinema Projector`,dmpc:`Digital Motion Picture Camera`,dsub:`Dye Sublimation Printer`,epho:`Electrophotographic Printer`,esta:`Electrostatic Printer`,flex:`Flexography`,fprn:`Film Writer`,fscn:`Film Scanner`,grav:`Gravure`,ijet:`Ink Jet Printer`,imgs:`Photo Image Setter`,mpfr:`Motion Picture Film Recorder`,mpfs:`Motion Picture Film Scanner`,offs:`Offset Lithography`,pjtv:`Projection Television`,rpho:`Photographic Paper Printer`,rscn:`Reflective Scanner`,silk:`Silkscreen`,twax:`Thermal Wax Printer`,vidc:`Video Camera`,vidm:`Video Monitor`}]]);var $=class extends U{static canHandle(e,t,n){return e.getUint8(t+1)===237&&e.getString(t+4,9)===`Photoshop`&&this.containsIptc8bim(e,t,n)!==void 0}static headerLength(e,t,n){let r,i=this.containsIptc8bim(e,t,n);if(i!==void 0)return r=e.getUint8(t+i+7),r%2!=0&&(r+=1),r===0&&(r=4),i+8+r}static containsIptc8bim(e,t,n){for(let r=0;ri.map(i=>d[i]); +import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{r as t,t as n}from"./reader-Bd1ccloG.js";import{t as r}from"./base-renderer-DM6Nw1yD.js";var i={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,avif:`image/avif`,bmp:`image/bmp`,svg:`image/svg+xml`,ico:`image/x-icon`},a=e=>/\.tiff?$/i.test(e);function o(e){if(e<1024)return`${e} B`;let t=e/1024;return t<1024?`${t.toFixed(1)} KB`:`${(t/1024).toFixed(1)} MB`}function s(e){if(!(e instanceof Date)||isNaN(e))return String(e);let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`}var c=class extends r{constructor(){super(),this._urls=[],this._observer=null,this._naturalW=0,this._naturalH=0,this.defaultScaleOption=`page-fit`}async load(e,t,n){await super.load(e,t,n);let r=n?.currentFileName||`image`,i=(r.split(`.`).pop()||``).toLowerCase();t.innerHTML=``;let o=a(r)?await this._decodeTiff(e):[await this._nativeImage(e,i)];for(let[e,n]of o.entries()){let r=document.createElement(`div`);r.className=`image-page`,r.dataset.page=e+1,r.dataset.nw=n.w,r.appendChild(n.node),t.appendChild(r)}this.numPages=o.length,this._naturalW=o[0].w,this._naturalH=o[0].h;let s=await this._readExif(e).catch(()=>null);this._renderInfo(t,i,e.byteLength,o[0],s),this.setScale(this.scale),this._attachScrollObserver(),this._buildThumbnails(o)}async _nativeImage(e,t){let n=i[t]||`application/octet-stream`,r=URL.createObjectURL(new Blob([e],{type:n}));this._urls.push(r);let a=document.createElement(`img`);return a.draggable=!1,a.alt=``,await new Promise(e=>{a.onload=e,a.onerror=e,a.src=r}),{node:a,w:a.naturalWidth||0,h:a.naturalHeight||0}}async _decodeTiff(t){let r=await n(()=>import(`./UTIF-CE5fEjqo.js`).then(t=>e(t.default)),__vite__mapDeps([0,1]),import.meta.url),i=r.default||r,a=i.decode(t),o=[];for(let e of a)try{if(i.decodeImage(t,e,a),!e.width||!e.height)continue;let n=i.toRGBA8(e),r=document.createElement(`canvas`);r.width=e.width,r.height=e.height,r.getContext(`2d`).putImageData(new ImageData(new Uint8ClampedArray(n),e.width,e.height),0,0),o.push({node:r,w:e.width,h:e.height})}catch{}if(!o.length)throw Error(`Could not decode TIFF`);return o}async _readExif(e){let t=await n(()=>import(`./full.esm-BRjqxzY6.js`),__vite__mapDeps([2,1,3,4]),import.meta.url);return(t.default||t).parse(e,{tiff:!0,exif:!0,gps:!0,ifd0:!0})}_renderInfo(e,n,r,i,a){let c=[[`info.format`,n.toUpperCase()],[`info.dimensions`,`${i.w} × ${i.h}`],[`info.size`,o(r)]];if(a){let e=[a.Make,a.Model].filter(Boolean).join(` `).trim();e&&c.push([`info.camera`,e]),a.LensModel&&c.push([`info.lens`,a.LensModel]);let t=a.DateTimeOriginal||a.CreateDate;t&&c.push([`info.dateTaken`,s(t)]),a.FocalLength&&c.push([`info.focalLength`,`${Math.round(a.FocalLength)} mm`]);let n=[];a.FNumber&&n.push(`ƒ/${a.FNumber}`),a.ExposureTime&&n.push(a.ExposureTime>=1?`${a.ExposureTime}s`:`1/${Math.round(1/a.ExposureTime)}s`),a.ISO&&n.push(`ISO ${a.ISO}`),n.length&&c.push([`info.exposure`,n.join(` · `)]),typeof a.latitude==`number`&&typeof a.longitude==`number`&&c.push([`info.gps`,`${a.latitude.toFixed(5)}, ${a.longitude.toFixed(5)}`])}let l=document.createElement(`div`);l.className=`image-info`;let u=document.createElement(`h3`);u.dataset.i18n=`info.heading`,u.textContent=t(`info.heading`),l.appendChild(u);let d=document.createElement(`dl`);for(let[e,n]of c){let r=document.createElement(`dt`);r.dataset.i18n=e,r.textContent=t(e);let i=document.createElement(`dd`);i.textContent=n,d.append(r,i)}l.appendChild(d),e.appendChild(l)}setScale(e){this.scale=e,this.container?.querySelectorAll(`.image-page`).forEach(t=>{let n=+t.dataset.nw||this._naturalW;n&&(t.style.width=`${Math.round(n*e)}px`)})}getPageWidth(){return this._naturalW||null}getPageHeight(){return this._naturalH||null}_attachScrollObserver(){this._observer&&this._observer.disconnect();let e=this.container.parentElement;this._observer=new IntersectionObserver(e=>{let t={ratio:0,page:this.viewer?.currentPage||1};e.forEach(e=>{e.intersectionRatio>t.ratio&&(t={ratio:e.intersectionRatio,page:+e.target.dataset.page})}),t.ratio>0&&this.viewer&&t.page!==this.viewer.currentPage&&(this.viewer.currentPage=t.page,this.viewer.updatePageInfo(),this._highlightThumb(t.page))},{threshold:[0,.25,.5,.75,1],root:e}),this.container.querySelectorAll(`.image-page`).forEach(e=>this._observer.observe(e))}_buildThumbnails(e){let t=document.getElementById(`thumbsContent`);t&&(t.innerHTML=``,e.forEach((e,n)=>{let r=document.createElement(`div`);r.className=`thumb`,r.dataset.thumbPage=n+1;let i=document.createElement(`img`);i.loading=`lazy`,i.src=e.node.tagName===`CANVAS`?e.node.toDataURL(`image/png`):e.node.src;let a=document.createElement(`div`);a.className=`thumb-label`,a.textContent=n+1,r.append(i,a),r.addEventListener(`click`,()=>this.viewer?.goToPage(n+1)),t.appendChild(r)}))}_highlightThumb(e){document.querySelectorAll(`.thumb`).forEach(t=>{t.classList.toggle(`active`,+t.dataset.thumbPage===e)})}scrollToPage(e){let t=this.container?.querySelector(`.image-page[data-page="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}destroy(){this._observer?.disconnect(),this._observer=null,this._urls.forEach(e=>URL.revokeObjectURL(e)),this._urls=[],super.destroy()}};export{c as ImageRenderer}; \ No newline at end of file diff --git a/dist-embed/assets/jszip.min-C__FR9jF.js b/dist-embed/assets/jszip.min-C__FR9jF.js new file mode 100644 index 0000000..8aabb6e --- /dev/null +++ b/dist-embed/assets/jszip.min-C__FR9jF.js @@ -0,0 +1,2 @@ +import{i as e,t}from"./rolldown-runtime-DAXXjFlN.js";var n=t(((t,n)=>{(function(e){typeof t==`object`&&n!==void 0?n.exports=e():typeof define==`function`&&define.amd?define([],e):(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this).JSZip=e()})(function(){return function t(n,r,i){function a(s,c){if(!r[s]){if(!n[s]){var l=typeof e==`function`&&e;if(!c&&l)return l(s,!0);if(o)return o(s,!0);var u=Error(`Cannot find module '`+s+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=r[s]={exports:{}};n[s][0].call(d.exports,function(e){var t=n[s][1][e];return a(t||e)},d,d.exports,t,n,r,i)}return r[s].exports}for(var o=typeof e==`function`&&e,s=0;s>2,s=(3&t)<<4|n>>4,c=1>6:64,l=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),f[u++]=t,s!==64&&(f[u++]=n),c!==64&&(f[u++]=r);return f}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e(`./external`),i=e(`./stream/DataWorker`),a=e(`./stream/Crc32Probe`),o=e(`./stream/DataLengthProbe`);function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o(`data_length`)),t=this;return e.on(`end`,function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error(`Bug : uncompressed data size mismatch`)}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo(`compressedSize`,this.compressedSize).withStreamInfo(`uncompressedSize`,this.uncompressedSize).withStreamInfo(`crc32`,this.crc32).withStreamInfo(`compression`,this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o(`uncompressedSize`)).pipe(t.compressWorker(n)).pipe(new o(`compressedSize`)).withStreamInfo(`compression`,t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e(`./stream/GenericWorker`);n.STORE={magic:`\0\0`,compressWorker:function(){return new r(`STORE compression`)},uncompressWorker:function(){return new r(`STORE decompression`)}},n.DEFLATE=e(`./flate`)},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e(`./utils`),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return e!==void 0&&e.length?r.getTypeOf(e)===`string`?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r=typeof Promise<`u`?Promise:e(`lie`),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Uint32Array<`u`,i=e(`pako`),a=e(`./utils`),o=e(`./stream/GenericWorker`),s=r?`uint8array`:`array`;function c(e,t){o.call(this,`FlateWorker/`+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic=`\b\0`,a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new c(`Deflate`,e)},n.uncompressWorker=function(){return new c(`Inflate`,{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r=``;for(n=0;n>>=8;return r}function i(e,t,n,i,o,u){var d,f,p=e.file,m=e.compression,h=u!==s.utf8encode,g=a.transformTo(`string`,u(p.name)),_=a.transformTo(`string`,s.utf8encode(p.name)),v=p.comment,y=a.transformTo(`string`,u(v)),b=a.transformTo(`string`,s.utf8encode(v)),x=_.length!==p.name.length,S=b.length!==v.length,C=``,w=``,T=``,E=p.dir,D=p.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),h||!x&&!S||(k|=2048);var A=0,j=0;E&&(A|=16),o===`UNIX`?(j=798,A|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,E)):(j=20,A|=function(e){return 63&(e||0)}(p.dosPermissions)),d=D.getUTCHours(),d<<=6,d|=D.getUTCMinutes(),d<<=5,d|=D.getUTCSeconds()/2,f=D.getUTCFullYear()-1980,f<<=4,f|=D.getUTCMonth()+1,f<<=5,f|=D.getUTCDate(),x&&(w=r(1,1)+r(c(g),4)+_,C+=`up`+r(w.length,2)+w),S&&(T=r(1,1)+r(c(y),4)+b,C+=`uc`+r(T.length,2)+T);var M=``;return M+=` +\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return q(e,t,g,15,8,0)},n.deflateInit2=q,n.deflateReset=K,n.deflateResetKeep=G,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)G(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,G(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?Z(e,t,n,r):e.strategy===4||s===o?(R(e,2+ +!!r,3),K(e,T,E)):(R(e,4+ +!!r,3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})}));export{n as t}; \ No newline at end of file diff --git a/dist-embed/assets/lib-CTiWugWo.js b/dist-embed/assets/lib-CTiWugWo.js new file mode 100644 index 0000000..5c81eca --- /dev/null +++ b/dist-embed/assets/lib-CTiWugWo.js @@ -0,0 +1,14 @@ +var e=`onafterprint.onbeforeprint.onbeforeunload.onhashchange.onlanguagechange.onmessage.onmessageerror.onoffline.ononline.onpagehide.onpageshow.onpopstate.onrejectionhandled.onstorage.onunhandledrejection.onunload.ongamepadconnected.ongamepaddisconnected.onabort.onblur.onfocus.oncancel.onauxclick.onbeforeinput.onbeforetoggle.oncanplay.oncanplaythrough.onchange.onclick.onclose.oncontentvisibilityautostatechange.oncontextlost.oncontextmenu.oncontextrestored.oncopy.oncuechange.oncut.ondblclick.ondrag.ondragend.ondragenter.ondragleave.ondragover.ondragstart.ondrop.ondurationchange.onemptied.onended.onformdata.oninput.oninvalid.onkeydown.onkeypress.onkeyup.onload.onloadeddata.onloadedmetadata.onloadstart.onmousedown.onmouseenter.onmouseleave.onmousemove.onmouseout.onmouseover.onmouseup.onwheel.onpaste.onpause.onplay.onplaying.onprogress.onratechange.onreset.onresize.onscroll.onscrollend.onsecuritypolicyviolation.onseeked.onseeking.onselect.onslotchange.onstalled.onsubmit.onsuspend.ontimeupdate.onvolumechange.onwaiting.onselectstart.onselectionchange.ontoggle.onpointercancel.onpointerdown.onpointerup.onpointermove.onpointerout.onpointerover.onpointerenter.onpointerleave.ongotpointercapture.onlostpointercapture.onanimationcancel.onanimationend.onanimationiteration.onanimationstart.ontransitioncancel.ontransitionend.ontransitionrun.ontransitionstart.onerror.onfullscreenchange.onfullscreenerror`.split(`.`);function t(e){let t=[];for(let r=0;r=48&&e<=57||e>=65&&e<=70}}function n(e){let t=``;for(let n=0;ne.charCodeAt(0)));return new TextDecoder(t).decode(n)}function i(e){if(e&&e.startsWith(`=?`)&&e.endsWith(`?=`)){let n=[],i=0;for(;i`}function s(e,t){return new TextDecoder(t).decode(e)}function c(e,t){return new TextEncoder(t).encode(e)}function l(e){let t=e.match(/charset=([^;]+)/);if(t)return u(t[1]).toLowerCase()}function u(e){return e.replace(/^"(.*)"$/,`$1`).replace(/^'(.*)'$/,`$1`).trim()}function d(e,t){return e.replace(/charset=([^;]+)/,`charset=${t}`)}function f(e){return e.startsWith(`text/html`)||e.startsWith(`application/xhtml+xml`)}function p(e){return e.startsWith(`text/css`)}function m(e){return e.startsWith(`text/`)}function h(e){return e.startsWith(`multipart/alternative`)}function g(e){let t=e.split(`;`);t.shift();let n=t.find(e=>e.startsWith(`boundary=`));if(n)return u(n.substring(9))}function _(e,t){let n=new TextEncoder().encode(t);for(let t=0;t=2?e[e.length-2]==13&&e[e.length-1]==10:e.length>=1?e[e.length-1]==13:!1}function b(e){return e.length>=1?e[e.length-1]==10:!1}function ee(e){return e.length>=2?e[0]==45&&e[1]==45:!1}function x({contentType:e,transferEncoding:t,data:n}){return`data:${e};base64,${t===`base64`?n:btoa(unescape(encodeURIComponent(n)))}`}function S(e,t){if(t&&!e.startsWith(`data:`))try{return new URL(e,t).href}catch{if(e.startsWith(`//`)){let n=t.match(/^[^:]+/);return n?`${n[0]}:${e}`:e}else return e}else return e}var C=Object.create,w=Object.defineProperty,te=Object.getOwnPropertyDescriptor,T=Object.getOwnPropertyNames,E=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),k=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of T(t))!D.call(e,i)&&i!==n&&w(e,i,{get:()=>t[i],enumerable:!(r=te(t,i))||r.enumerable});return e},re=(e,t,n)=>(n=e==null?{}:C(E(e)),ne(t||!e||!e.__esModule?w(n,`default`,{value:e,enumerable:!0}):n,e)),ie=O(e=>{var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``);e.encode=function(e){if(0<=e&&e{var t=ie(),n=5,r=1<>1;return t?-n:n}e.encode=function(e){var r=``,s,c=o(e);do s=c&i,c>>>=n,c>0&&(s|=a),r+=t.encode(s);while(c>0);return r},e.decode=function(e,r,o){var c=e.length,l=0,u=0,d,f;do{if(r>=c)throw Error(`Expected more digits in base 64 VLQ value.`);if(f=t.decode(e.charCodeAt(r++)),f===-1)throw Error(`Invalid base64 digit: `+e.charAt(r-1));d=!!(f&a),f&=i,l+=f<{function t(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw Error(`"`+t+`" is a required argument.`)}e.getArg=t;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function i(e){var t=e.match(n);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}e.urlParse=i;function a(e){var t=``;return e.scheme&&(t+=e.scheme+`:`),t+=`//`,e.auth&&(t+=e.auth+`@`),e.host&&(t+=e.host),e.port&&(t+=`:`+e.port),e.path&&(t+=e.path),t}e.urlGenerate=a;var o=32;function s(e){var t=[];return function(n){for(var r=0;ro&&t.pop(),a}}var c=s(function(t){var n=t,r=i(t);if(r){if(!r.path)return t;n=r.path}for(var o=e.isAbsolute(n),s=[],c=0,l=0;;)if(c=l,l=n.indexOf(`/`,c),l===-1){s.push(n.slice(c));break}else for(s.push(n.slice(c,l));l=0;l--)u=s[l],u===`.`?s.splice(l,1):u===`..`?d++:d>0&&(u===``?(s.splice(l+1,d),d=0):(s.splice(l,2),d--));return n=s.join(`/`),n===``&&(n=o?`/`:`.`),r?(r.path=n,a(r)):n});e.normalize=c;function l(e,t){e===``&&(e=`.`),t===``&&(t=`.`);var n=i(t),o=i(e);if(o&&(e=o.path||`/`),n&&!n.scheme)return o&&(n.scheme=o.scheme),a(n);if(n||t.match(r))return t;if(o&&!o.host&&!o.path)return o.host=t,a(o);var s=t.charAt(0)===`/`?t:c(e.replace(/\/+$/,``)+`/`+t);return o?(o.path=s,a(o)):s}e.join=l,e.isAbsolute=function(e){return e.charAt(0)===`/`||n.test(e)};function u(e,t){e===``&&(e=`.`),e=e.replace(/\/$/,``);for(var n=0;t.indexOf(e+`/`)!==0;){var r=e.lastIndexOf(`/`);if(r<0||(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/)))return t;++n}return Array(n+1).join(`../`)+t.substr(e.length+1)}e.relative=u;var d=function(){return!(`__proto__`in Object.create(null))}();function f(e){return e}function p(e){return h(e)?`$`+e:e}e.toSetString=d?f:p;function m(e){return h(e)?e.slice(1):e}e.fromSetString=d?f:m;function h(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var n=t-10;n>=0;n--)if(e.charCodeAt(n)!==36)return!1;return!0}function g(e,t,n){var r=b(e.source,t.source);return r!==0||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:b(e.name,t.name)}e.compareByOriginalPositions=g;function _(e,t,n){var r;return r=e.originalLine-t.originalLine,r!==0||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:b(e.name,t.name)}e.compareByOriginalPositionsNoSource=_;function v(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=b(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:b(e.name,t.name)}e.compareByGeneratedPositionsDeflated=v;function y(e,t,n){var r=e.generatedColumn-t.generatedColumn;return r!==0||n||(r=b(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:b(e.name,t.name)}e.compareByGeneratedPositionsDeflatedNoLine=y;function b(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function ee(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=b(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:b(e.name,t.name)}e.compareByGeneratedPositionsInflated=ee;function x(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,``))}e.parseSourceMapInput=x;function S(e,t,n){if(t=t||``,e&&(e[e.length-1]!==`/`&&t[0]!==`/`&&(e+=`/`),t=e+t),n){var r=i(n);if(!r)throw Error(`sourceMapURL could not be parsed`);if(r.path){var o=r.path.lastIndexOf(`/`);o>=0&&(r.path=r.path.substring(0,o+1))}t=l(a(r),t)}return c(t)}e.computeSourceURL=S}),se=O(e=>{var t=oe(),n=Object.prototype.hasOwnProperty,r=typeof Map<`u`;function i(){this._array=[],this._set=r?new Map:Object.create(null)}i.fromArray=function(e,t){for(var n=new i,r=0,a=e.length;r=0)return i}else{var a=t.toSetString(e);if(n.call(this._set,a))return this._set[a]}throw Error(`"`+e+`" is not in the set.`)},i.prototype.at=function(e){if(e>=0&&e{var t=oe();function n(e,n){var r=e.generatedLine,i=n.generatedLine,a=e.generatedColumn,o=n.generatedColumn;return i>r||i==r&&o>=a||t.compareByGeneratedPositionsInflated(e,n)<=0}function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}r.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},r.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},r.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},e.MappingList=r}),le=O(e=>{var t=ae(),n=oe(),r=se().ArraySet,i=ce().MappingList;function a(e){e||(e={}),this._file=n.getArg(e,`file`,null),this._sourceRoot=n.getArg(e,`sourceRoot`,null),this._skipValidation=n.getArg(e,`skipValidation`,!1),this._sources=new r,this._names=new r,this._mappings=new i,this._sourcesContents=null}a.prototype._version=3,a.fromSourceMap=function(e){var t=e.sourceRoot,r=new a({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var i={generated:{line:e.generatedLine,column:e.generatedColumn}};e.source!=null&&(i.source=e.source,t!=null&&(i.source=n.relative(t,i.source)),i.original={line:e.originalLine,column:e.originalColumn},e.name!=null&&(i.name=e.name)),r.addMapping(i)}),e.sources.forEach(function(i){var a=i;t!==null&&(a=n.relative(t,i)),r._sources.has(a)||r._sources.add(a);var o=e.sourceContentFor(i);o!=null&&r.setSourceContent(i,o)}),r},a.prototype.addMapping=function(e){var t=n.getArg(e,`generated`),r=n.getArg(e,`original`,null),i=n.getArg(e,`source`,null),a=n.getArg(e,`name`,null);this._skipValidation||this._validateMapping(t,r,i,a),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:i,name:a})},a.prototype.setSourceContent=function(e,t){var r=e;this._sourceRoot!=null&&(r=n.relative(this._sourceRoot,r)),t==null?this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null)):(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[n.toSetString(r)]=t)},a.prototype.applySourceMap=function(e,t,i){var a=t;if(t==null){if(e.file==null)throw Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);a=e.file}var o=this._sourceRoot;o!=null&&(a=n.relative(o,a));var s=new r,c=new r;this._mappings.unsortedForEach(function(t){if(t.source===a&&t.originalLine!=null){var r=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});r.source!=null&&(t.source=r.source,i!=null&&(t.source=n.join(i,t.source)),o!=null&&(t.source=n.relative(o,t.source)),t.originalLine=r.line,t.originalColumn=r.column,r.name!=null&&(t.name=r.name))}var l=t.source;l!=null&&!s.has(l)&&s.add(l);var u=t.name;u!=null&&!c.has(u)&&c.add(u)},this),this._sources=s,this._names=c,e.sources.forEach(function(t){var r=e.sourceContentFor(t);r!=null&&(i!=null&&(t=n.join(i,t)),o!=null&&(t=n.relative(o,t)),this.setSourceContent(t,r))},this)},a.prototype._validateMapping=function(e,t,n,r){if(t&&typeof t.line!=`number`&&typeof t.column!=`number`)throw Error(`original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.`);if(!(e&&`line`in e&&`column`in e&&e.line>0&&e.column>=0&&!t&&!n&&!r)){if(e&&`line`in e&&`column`in e&&t&&`line`in t&&`column`in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n)return;throw Error(`Invalid mapping: `+JSON.stringify({generated:e,source:n,original:t,name:r}))}},a.prototype._serializeMappings=function(){for(var e=0,r=1,i=0,a=0,o=0,s=0,c=``,l,u,d,f,p=this._mappings.toArray(),m=0,h=p.length;m0){if(!n.compareByGeneratedPositionsInflated(u,p[m-1]))continue;l+=`,`}l+=t.encode(u.generatedColumn-e),e=u.generatedColumn,u.source!=null&&(f=this._sources.indexOf(u.source),l+=t.encode(f-s),s=f,l+=t.encode(u.originalLine-1-a),a=u.originalLine-1,l+=t.encode(u.originalColumn-i),i=u.originalColumn,u.name!=null&&(d=this._names.indexOf(u.name),l+=t.encode(d-o),o=d)),c+=l}return c},a.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;t!=null&&(e=n.relative(t,e));var r=n.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},a.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},a.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.SourceMapGenerator=a});k({},{AtKeyword:()=>pe,BadString:()=>ge,BadUrl:()=>ve,CDC:()=>Te,CDO:()=>we,Colon:()=>Ee,Comma:()=>Oe,Comment:()=>Fe,Delim:()=>ye,Dimension:()=>Se,EOF:()=>ue,Function:()=>fe,Hash:()=>me,Ident:()=>de,LeftCurlyBracket:()=>Ne,LeftParenthesis:()=>je,LeftSquareBracket:()=>ke,Number:()=>be,Percentage:()=>xe,RightCurlyBracket:()=>Pe,RightParenthesis:()=>Me,RightSquareBracket:()=>Ae,Semicolon:()=>De,String:()=>he,Url:()=>_e,WhiteSpace:()=>Ce});var ue=0,de=1,fe=2,pe=3,me=4,he=5,ge=6,_e=7,ve=8,ye=9,be=10,xe=11,Se=12,Ce=13,we=14,Te=15,Ee=16,De=17,Oe=18,ke=19,Ae=20,je=21,Me=22,Ne=23,Pe=24,Fe=25;function A(e){return e>=48&&e<=57}function j(e){return A(e)||e>=65&&e<=70||e>=97&&e<=102}function Ie(e){return e>=65&&e<=90}function Le(e){return e>=97&&e<=122}function Re(e){return Ie(e)||Le(e)}function ze(e){return e>=128}function Be(e){return Re(e)||ze(e)||e===95}function Ve(e){return Be(e)||A(e)||e===45}function He(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Ue(e){return e===10||e===13||e===12}function We(e){return Ue(e)||e===32||e===9}function M(e,t){return!(e!==92||Ue(t)||t===0)}function Ge(e,t,n){return e===45?Be(t)||t===45||M(t,n):Be(e)?!0:e===92?M(e,t):!1}function Ke(e,t,n){return e===43||e===45?A(t)?2:t===46&&A(n)?3:0:e===46?A(t)?2:0:+!!A(e)}function qe(e){return+(e===65279||e===65534)}var Je=Array(128),Ye=128,Xe=130,Ze=131,Qe=132,$e=133;for(let e=0;ee.length)return!1;for(let i=t;i=0&&We(e.charCodeAt(t));t--);return t+1}function ot(e,t){for(;t=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var pt=`EOF-token.ident-token.function-token.at-keyword-token.hash-token.string-token.bad-string-token.url-token.bad-url-token.delim-token.number-token.percentage-token.dimension-token.whitespace-token.CDO-token.CDC-token.colon-token.semicolon-token.comma-token.[-token.]-token.(-token.)-token.{-token.}-token.comment-token`.split(`.`);function mt(e=null,t){return e===null||e.length0?qe(t.charCodeAt(0)):0,i=mt(e.lines,n),a=mt(e.columns,n),o=e.startLine,s=e.startColumn;for(let e=r;en?n:e}var wt=class{constructor(e,t){this.setSource(e,t)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e=``,t=()=>{}){e=String(e||``);let n=e.length,r=mt(this.offsetAndType,e.length+1),i=mt(this.balance,e.length+1),a=0,o=-1,s=0,c=e.length;this.offsetAndType=null,this.balance=null,i.fill(0),t(e,(e,t,n)=>{let l=a++;if(r[l]=e<>P]}else this.isBlockOpenerTokenType(e)&&(c=l,s=St[e])}),r[a]=0<a&&(i[e]=a)}this.source=e,this.firstCharOffset=o===-1?0:o,this.tokenCount=a,this.offsetAndType=r,this.balance=i,this.reset(),this.next()}lookupType(e){return e+=this.tokenIndex,e>P:0}lookupTypeNonSC(e){for(let t=this.tokenIndex;t>P;if(n!==13&&n!==25&&e--===0)return n}return 0}lookupOffset(e){return e+=this.tokenIndex,e>P;if(n!==13&&n!==25&&e--===0)return t-this.tokenIndex}return 0}lookupValue(e,t){return e+=this.tokenIndex,e0?e>P}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBlockOpenerTokenType(e){return F[e]===bt}isBlockCloserTokenType(e){return F[e]===xt}getBlockTokenPairIndex(e){let t=this.getTokenType(e);if(F[t]===1){let n=this.balance[e],r=this.getTokenType(n);return St[t]===r?n:-1}else if(F[t]===2){let n=this.balance[e];return St[this.getTokenType(n)]===t?n:-1}return-1}isBalanceEdge(e){return this.balance[this.tokenIndex]>P,this.tokenEnd=t&N):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e>P,this.tokenEnd=e&N):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(e,t){let n=e,r=0,i=0;e:for(;n0?this.offsetAndType[n-1]&N:this.firstCharOffset,t(this.source.charCodeAt(i))){case 1:break e;case 2:n++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>P)&&(n=r)}}this.skip(n-this.tokenIndex)}forEachToken(e){for(let t=0,n=this.firstCharOffset;t>P;n=a,e(o,r,a,t)}}dump(){let e=Array(this.tokenCount);return this.forEachToken((t,n,r,i)=>{e[i]={idx:i,type:pt[t],chunk:this.source.substring(n,r),balance:this.balance[i]}}),e}};function Tt(e,t){function n(t){return t=e.length){lString(e+n+1).padStart(u)+` |`+t).join(` +`)}let s=(` +`.repeat(Math.max(r-1,0))+` `.repeat(Math.max(i-1,0))+e).split(/\r\n?|\n|\f/),c=Math.max(1,t-a)-1,l=Math.min(t+a,s.length+1),u=Math.max(4,String(l).length)+1,d=0;n+=(jt.length-1)*(s[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>kt&&(d=n-At+3,n=At-2);for(let e=c;e<=l;e++)e>=0&&e0&&s[e].length>d?`…`:``)+s[e].substr(d,kt-2)+(s[e].length>d+kt-1?`…`:``));return[o(c,t),Array(n+u+2).join(`-`)+`^`,o(t,l)].filter(Boolean).join(` +`).replace(/^(\s+\d+\s+\|\n)+/,``).replace(/\n(\s+\d+\s+\|)+$/,``)}function Nt(e,t,n,r,i,a=1,o=1){return Object.assign(Ot(`SyntaxError`,e),{source:t,offset:n,line:r,column:i,sourceFragment(e){return Mt({source:t,line:r,column:i,baseLine:a,baseColumn:o},isNaN(e)?0:e)},get formattedMessage(){return`Parse error: ${e} +`+Mt({source:t,line:r,column:i,baseLine:a,baseColumn:o},2)}})}function Pt(e){let t=this.createList(),n=!1,r={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:n=!0,this.next();continue}let i=e.getNode.call(this,r);if(i===void 0)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,i,t,r),n=!1),t.push(i)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,r),t}var Ft=()=>{},It=33,Lt=35,Rt=59,zt=123,Bt=0;function Vt(e){return function(){return this[e]()}}function Ht(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n],i=r.parse||r;i&&(t[n]=i)}return t}function Ut(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:Ht(e.atrule),pseudo:Ht(e.pseudo),node:Ht(e.node)};for(let[n,r]of Object.entries(e.parseContext))switch(typeof r){case`function`:t.context[n]=r;break;case`string`:t.context[n]=Vt(r);break}return{config:t,...t,...t.node}}function Wt(e){let t=``,n=``,r=!1,i=Ft,a=!1,o=new yt,s=Object.assign(new wt,Ut(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Pt,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(e){return+(e===zt)},consumeUntilLeftCurlyBracketOrSemicolon(e){return+(e===zt||e===Rt)},consumeUntilExclamationMarkOrSemicolon(e){return+(e===It||e===Rt)},consumeUntilSemicolonIncluded(e){return e===Rt?2:0},createList(){return new Dt},createSingleNodeList(e){return new Dt().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last},parseWithFallback(e,t){let n=this.tokenIndex;try{return e.call(this)}catch(e){if(a)throw e;this.skip(n-this.tokenIndex);let r=t.call(this);return a=!0,i(e,r),a=!1,r}},lookupNonWSType(e){let t;do if(t=this.lookupType(e++),t!==13&&t!==25)return t;while(t!==Bt);return Bt},charCodeAt(e){return e>=0&&ee.toUpperCase()),n=`${/[[\](){}]/.test(t)?`"${t}"`:t} is expected`,r=this.tokenStart;switch(e){case 1:this.tokenType===2||this.tokenType===7?(r=this.tokenEnd-1,n=`Identifier is expected but function found`):n=`Identifier is expected`;break;case 4:this.isDelim(Lt)&&(this.next(),r++,n=`Name is expected`);break;case 11:this.tokenType===10&&(r=this.tokenEnd,n=`Percent sign is expected`);break}this.error(n,r)}this.next()},eatIdent(e){(this.tokenType!==1||this.lookupValue(0,e)===!1)&&this.error(`Identifier "${e}" is expected`),this.next()},eatDelim(e){this.isDelim(e)||this.error(`Delim "${String.fromCharCode(e)}" is expected`),this.next()},getLocation(e,t){return r?o.getLocationRange(e,t,n):null},getLocationFromList(e){if(r){let t=this.getFirstListNode(e),r=this.getLastListNode(e);return o.getLocationRange(t===null?this.tokenStart:t.loc.start.offset-o.startOffset,r===null?this.tokenStart:r.loc.end.offset-o.startOffset,n)}return null},error(e,n){let r=typeof n<`u`&&n({filename:n,source:t,tokenCount:s.tokenCount,getTokenType:e=>s.getTokenType(e),getTokenTypeName:e=>pt[s.getTokenType(e)],getTokenStart:e=>s.getTokenStart(e),getTokenEnd:e=>s.getTokenEnd(e),getTokenValue:e=>s.source.substring(s.getTokenStart(e),s.getTokenEnd(e)),substring:(e,t)=>s.source.substring(e,t),balance:s.balance.subarray(0,s.tokenCount+1),isBlockOpenerTokenType:s.isBlockOpenerTokenType,isBlockCloserTokenType:s.isBlockCloserTokenType,getBlockTokenPairIndex:e=>s.getBlockTokenPairIndex(e),getLocation:e=>o.getLocation(e,n),getRangeLocation:(e,t)=>o.getLocationRange(e,t,n)});return Object.assign(function(e,l){t=e,l=l||{},s.setSource(t,Tt),o.setSource(t,l.offset,l.line,l.column),n=l.filename||``,r=!!l.positions,i=typeof l.onParseError==`function`?l.onParseError:Ft,a=!1,s.parseAtrulePrelude=`parseAtrulePrelude`in l?!!l.parseAtrulePrelude:!0,s.parseRulePrelude=`parseRulePrelude`in l?!!l.parseRulePrelude:!0,s.parseValue=`parseValue`in l?!!l.parseValue:!0,s.parseCustomProperty=`parseCustomProperty`in l?!!l.parseCustomProperty:!1;let{context:u=`default`,onComment:d,onToken:f}=l;if(!(u in s.context))throw Error("Unknown context `"+u+"`");Array.isArray(f)?s.forEachToken((e,t,n)=>{f.push({type:e,start:t,end:n})}):typeof f==`function`&&s.forEachToken(f.bind(c())),typeof d==`function`&&s.forEachToken((e,n,r)=>{if(e===25){let e=s.getLocation(n,r);d(it(t,r-2,r,`*/`)?t.slice(n+2,r-2):t.slice(n+2,r),e)}});let p=s.context[u].call(s,l);return s.eof||s.error(),p},{SyntaxError:Nt,config:s.config})}var Gt=re(le(),1),Kt=new Set([`Atrule`,`Selector`,`Declaration`]);function qt(e){let t=new Gt.SourceMapGenerator,n={line:1,column:0},r={line:0,column:0},i={line:1,column:0},a={generated:i},o=1,s=0,c=!1,l=e.node;e.node=function(e){if(e.loc&&e.loc.start&&Kt.has(e.type)){let l=e.loc.start.line,u=e.loc.start.column-1;(r.line!==l||r.column!==u)&&(r.line=l,r.column=u,n.line=o,n.column=s,c&&(c=!1,(n.line!==i.line||n.column!==i.column)&&t.addMapping(a)),c=!0,t.addMapping({source:e.loc.source,original:r,generated:n}))}l.call(this,e),c&&Kt.has(e.type)&&(i.line=o,i.column=s)};let u=e.emit;e.emit=function(e,t,n){for(let t=0;tnn,spec:()=>tn});var Yt=43,Xt=45,Zt=(e,t)=>{if(e===9&&(e=t),typeof e==`string`){let t=e.charCodeAt(0);return t>127?32768:t<<8}return e},Qt=[[1,1],[1,2],[1,7],[1,8],[1,`-`],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,`-`],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,`-`],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,`-`],[12,10],[12,11],[12,12],[12,15],[`#`,1],[`#`,2],[`#`,7],[`#`,8],[`#`,`-`],[`#`,10],[`#`,11],[`#`,12],[`#`,15],[`-`,1],[`-`,2],[`-`,7],[`-`,8],[`-`,`-`],[`-`,10],[`-`,11],[`-`,12],[`-`,15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,`%`],[10,15],[`@`,1],[`@`,2],[`@`,7],[`@`,8],[`@`,`-`],[`@`,15],[`.`,10],[`.`,11],[`.`,12],[`+`,10],[`+`,11],[`+`,12],[`/`,`*`]],$t=Qt.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,`-`],[22,1],[22,2],[22,11],[22,12],[22,4],[22,`-`]]);function en(e){let t=new Set(e.map(([e,t])=>Zt(e)<<16|Zt(t)));return function(e,n,r){let i=Zt(n,r),a=r.charCodeAt(0);return(a===Xt&&n!==1&&n!==2&&n!==15||a===Yt?t.has(e<<16|a<<8):t.has(e<<16|i))&&this.emit(` `,13,!0),i}}var tn=en(Qt),nn=en($t),rn=92;function an(e,t){if(typeof t==`function`){let n=null;e.children.forEach(e=>{n!==null&&t.call(this,n),this.node(e),n=e});return}e.children.forEach(this.node,this)}function on(e){Tt(e,(t,n,r)=>{this.token(t,e.slice(n,r))})}function sn(e){let t=new Map;for(let[n,r]of Object.entries(e.node))typeof(r.generate||r)==`function`&&t.set(n,r.generate||r);return function(e,n){let r=``,i=0,a={node(e){if(t.has(e.type))t.get(e.type).call(o,e);else throw Error(`Unknown node type: `+e.type)},tokenBefore:nn,token(e,t){i=this.tokenBefore(i,e,t),this.emit(t,e,!1),e===9&&t.charCodeAt(0)===rn&&this.emit(` +`,13,!0)},emit(e){r+=e},result(){return r}};n&&(typeof n.decorator==`function`&&(a=n.decorator(a)),n.sourceMap&&(a=qt(a)),n.mode in Jt&&(a.tokenBefore=Jt[n.mode]));let o={node:e=>a.node(e),children:an,token:(e,t)=>a.token(e,t),tokenize:on};return a.node(e),a.result()}}function cn(e){return{fromPlainObject(t){return e(t,{enter(e){e.children&&!(e.children instanceof Dt)&&(e.children=new Dt().fromArray(e.children))}}),t},toPlainObject(t){return e(t,{leave(e){e.children&&e.children instanceof Dt&&(e.children=e.children.toArray())}}),t}}}var{hasOwnProperty:ln}=Object.prototype,un=function(){};function dn(e){return typeof e==`function`?e:un}function fn(e,t){return function(n,r,i){n.type===t&&e.call(this,n,r,i)}}function pn(e,t){let n=t.structure,r=[];for(let e in n){if(ln.call(n,e)===!1)continue;let t=n[e],i={name:e,type:!1,nullable:!1};Array.isArray(t)||(t=[t]);for(let e of t)e===null?i.nullable=!0:typeof e==`string`?i.type=`node`:Array.isArray(e)&&(i.type=`list`);i.type&&r.push(i)}return r.length?{context:t.walkContext,fields:r}:null}function mn(e){let t={};for(let n in e.node)if(ln.call(e.node,n)){let r=e.node[n];if(!r.structure)throw Error("Missed `structure` field in `"+n+"` node type definition");t[n]=pn(n,r)}return t}function hn(e,t){let n=e.fields.slice(),r=e.context,i=typeof r==`string`;return t&&n.reverse(),function(e,a,o,s){let c;i&&(c=a[r],a[r]=e);for(let r of n){let n=e[r.name];if(!r.nullable||n){if(r.type===`list`){if(t?n.reduceRight(s,!1):n.reduce(s,!1))return!0}else if(o(n))return!0}}i&&(a[r]=c)}}function gn({StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:i}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Rule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Declaration:{StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:i}}}function _n(e){let t=mn(e),n={},r={},i=Symbol(`break-walk`),a=Symbol(`skip-node`);for(let e in t)ln.call(t,e)&&t[e]!==null&&(n[e]=hn(t[e],!1),r[e]=hn(t[e],!0));let o=gn(n),s=gn(r),c=function(e,c){function l(e,t,n){let r=u.call(m,e,t,n);return r===i?!0:r===a?!1:!!(f.hasOwnProperty(e.type)&&f[e.type](e,m,l,p)||d.call(m,e,t,n)===i)}let u=un,d=un,f=n,p=(e,t,n,r)=>e||l(t,n,r),m={break:i,skip:a,root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof c==`function`)u=c;else if(c&&(u=dn(c.enter),d=dn(c.leave),c.reverse&&(f=r),c.visit)){if(o.hasOwnProperty(c.visit))f=c.reverse?s[c.visit]:o[c.visit];else if(!t.hasOwnProperty(c.visit))throw Error("Bad value `"+c.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(`, `)+`)`);u=fn(u,c.visit),d=fn(d,c.visit)}if(u===un&&d===un)throw Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");l(e)};return c.break=i,c.skip=a,c.find=function(e,t){let n=null;return c(e,function(e,r,a){if(t.call(this,e,r,a))return n=e,i}),n},c.findLast=function(e,t){let n=null;return c(e,{reverse:!0,enter(e,r,a){if(t.call(this,e,r,a))return n=e,i}}),n},c.findAll=function(e,t){let n=[];return c(e,function(e,r,i){t.call(this,e,r,i)&&n.push(e)}),n},c}function vn(e){return e}function yn(e){let{min:t,max:n,comma:r}=e;return t===0&&n===0?r?`#?`:`*`:t===0&&n===1?`?`:t===1&&n===0?r?`#`:`+`:t===1&&n===1?``:(r?`#`:``)+(t===n?`{`+t+`}`:`{`+t+`,`+(n===0?``:n)+`}`)}function bn(e){switch(e.type){case`Range`:return` [`+(e.min===null?`-∞`:e.min)+`,`+(e.max===null?`∞`:e.max)+`]`;default:throw Error("Unknown node type `"+e.type+"`")}}function xn(e,t,n,r){let i=e.combinator===` `||r?e.combinator:` `+e.combinator+` `,a=e.terms.map(e=>Sn(e,t,n,r)).join(i);return e.explicit||n?(r||a[0]===`,`?`[`:`[ `)+a+(r?`]`:` ]`):a}function Sn(e,t,n,r){let i;switch(e.type){case`Group`:i=xn(e,t,n,r)+(e.disallowEmpty?`!`:``);break;case`Multiplier`:return Sn(e.term,t,n,r)+t(yn(e),e);case`Boolean`:i=``;break;case`Type`:i=`<`+e.name+(e.opts?t(bn(e.opts),e.opts):``)+`>`;break;case`Property`:i=`<'`+e.name+`'>`;break;case`Keyword`:i=e.name;break;case`AtKeyword`:i=`@`+e.name;break;case`Function`:i=e.name+`(`;break;case`String`:case`Token`:i=e.value;break;case`Comma`:i=`,`;break;default:throw Error("Unknown node type `"+e.type+"`")}return t(i,e)}function Cn(e,t){let n=vn,r=!1,i=!1;return typeof t==`function`?n=t:t&&(r=!!t.forceBraces,i=!!t.compact,typeof t.decorate==`function`&&(n=t.decorate)),Sn(e,n,r,i)}var wn={offset:0,line:1,column:1};function Tn(e,t){let n=e.tokens,r=e.longestMatch,i=r1?(u=En(a||t,`end`)||Dn(wn,l),d=Dn(u)):(u=En(a,`start`)||Dn(En(t,`start`)||wn,l.slice(0,o)),d=En(a,`end`)||Dn(u,l.substr(o,s))),{css:l,mismatchOffset:o,mismatchLength:s,start:u,end:d}}function En(e,t){let n=e&&e.loc&&e.loc[t];return n?`line`in n?Dn(n):n:null}function Dn({offset:e,line:t,column:n},r){let i={offset:e,line:t,column:n};if(r){let e=r.split(/\n|\r\n?|\f/);i.offset+=r.length,i.line+=e.length-1,i.column=e.length===1?i.column+r.length:e.pop().length+1}return i}var On=function(e,t){let n=Ot(`SyntaxReferenceError`,e+(t?" `"+t+"`":``));return n.reference=t,n},kn=function(e,t,n,r){let i=Ot(`SyntaxMatchError`,e),{css:a,mismatchOffset:o,mismatchLength:s,start:c,end:l}=Tn(r,n);return i.rawMessage=e,i.syntax=t?Cn(t):``,i.css=a,i.mismatchOffset=o,i.mismatchLength=s,i.message=e+` + syntax: `+i.syntax+` + value: `+(a||``)+` + --------`+Array(i.mismatchOffset+1).join(`-`)+`^`,Object.assign(i,c),i.loc={source:n&&n.loc&&n.loc.source||``,start:c,end:l},i},An=new Map,jn=new Map,Mn=45,Nn=Ln,Pn=Rn;function Fn(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===Mn&&e.charCodeAt(t+1)===Mn}function In(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===Mn&&e.charCodeAt(t+1)!==Mn){let n=e.indexOf(`-`,t+2);if(n!==-1)return e.substring(t,n+1)}return``}function Ln(e){if(An.has(e))return An.get(e);let t=e.toLowerCase(),n=An.get(t);if(n===void 0){let e=Fn(t,0),r=e?``:In(t,0);n=Object.freeze({basename:t.substr(r.length),name:t,prefix:r,vendor:r,custom:e})}return An.set(e,n),n}function Rn(e){if(jn.has(e))return jn.get(e);let t=e,n=e[0];n===`/`?n=e[1]===`/`?`//`:`/`:n!==`_`&&n!==`*`&&n!==`$`&&n!==`#`&&n!==`+`&&n!==`&`&&(n=``);let r=Fn(t,n.length);if(!r&&(t=t.toLowerCase(),jn.has(t))){let n=jn.get(t);return jn.set(e,n),n}let i=r?``:In(t,n.length),a=t.substr(0,n.length+i.length),o=Object.freeze({basename:t.substr(a.length),name:t.substr(n.length),hack:n,vendor:i,prefix:a,custom:r});return jn.set(e,o),o}var zn=[`initial`,`inherit`,`unset`,`revert`,`revert-layer`],Bn=43,I=45,Vn=110,Hn=!0,Un=!1;function Wn(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function Gn(e,t,n){for(;e!==null&&(e.type===13||e.type===25);)e=n(++t);return t}function Kn(e,t,n,r){if(!e)return 0;let i=e.value.charCodeAt(t);if(i===Bn||i===I){if(n)return 0;t++}for(;t6)return 0}return r}function nr(e,t,n){if(!e)return 0;for(;$n(n(t),Zn);){if(++e>6)return 0;t++}return t}function rr(e,t){let n=0;if(e===null||e.type!==1||!rt(e.value,0,Qn)||(e=t(++n),e===null))return 0;if($n(e,Yn))return e=t(++n),e===null?0:e.type===1?nr(tr(e,0,!0),++n,t):$n(e,Zn)?nr(1,++n,t):0;if(e.type===10){let r=tr(e,1,!0);return r===0?0:(e=t(++n),e===null?n:e.type===12||e.type===10?!er(e,Xn)||!tr(e,1,!1)?0:n+1:nr(r,n,t))}return e.type===12?nr(tr(e,1,!0),++n,t):0}var ir=[`calc(`,`-moz-calc(`,`-webkit-calc(`],ar=new Map([[2,22],[21,22],[19,20],[23,24]]);function L(e,t){return te.max&&typeof e.max!=`string`)return!0}return!1}function ur(e,t){let n=0,r=[],i=0;e:do{switch(e.type){case 24:case 22:case 20:if(e.type!==n)break e;if(n=r.pop(),r.length===0){i++;break e}break;case 2:case 21:case 19:case 23:r.push(n),n=ar.get(e.type);break}i++}while(e=t(i));return i}function R(e){return function(t,n,r){return t===null?0:t.type===2&&sr(t.value,ir)?ur(t,n):e(t,n,r)}}function z(e){return function(t){return t===null||t.type!==e?0:1}}function dr(e){if(e===null||e.type!==1)return 0;let t=e.value.toLowerCase();return sr(t,zn)||or(t,`default`)?0:1}function fr(e){return e===null||e.type!==1||L(e.value,0)!==45||L(e.value,1)!==45?0:1}function pr(e){return!fr(e)||e.value===`--`?0:1}function mr(e){if(e===null||e.type!==4)return 0;let t=e.value.length;if(t!==4&&t!==5&&t!==7&&t!==9)return 0;for(let n=1;nOr,decibel:()=>Nr,flex:()=>Mr,frequency:()=>Ar,length:()=>Dr,resolution:()=>jr,semitones:()=>Pr,time:()=>kr});var Dr=`cm.mm.q.in.pt.pc.px.em.rem.ex.rex.cap.rcap.ch.rch.ic.ric.lh.rlh.vw.svw.lvw.dvw.vh.svh.lvh.dvh.vi.svi.lvi.dvi.vb.svb.lvb.dvb.vmin.svmin.lvmin.dvmin.vmax.svmax.lvmax.dvmax.cqw.cqh.cqi.cqb.cqmin.cqmax`.split(`.`),Or=[`deg`,`grad`,`rad`,`turn`],kr=[`s`,`ms`],Ar=[`hz`,`khz`],jr=[`dpi`,`dpcm`,`dppx`,`x`],Mr=[`fr`],Nr=[`db`],Pr=[`st`];k({},{SyntaxError:()=>Fr,generate:()=>Cn,parse:()=>Ei,walk:()=>ki});function Fr(e,t,n){return Object.assign(Ot(`SyntaxError`,e),{input:t,offset:n,rawMessage:e,message:e+` + `+t+` +--`+Array((n||t.length)+1).join(`-`)+`^`})}var Ir=9,Lr=10,Rr=12,zr=13,Br=32,Vr=new Uint8Array(128).map((e,t)=>+!!/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))),Hr=class{constructor(e){this.str=e,this.pos=0}charCodeAt(e){return e=128||Vr[t]===0)break}return this.pos===e&&this.error(`Expect a keyword`),this.substringToPos(e)}scanNumber(){let e=this.pos;for(;e57)break}return this.pos===e&&this.error(`Expect a number`),this.substringToPos(e)}scanString(){let e=this.str.indexOf(`'`,this.pos+1);return e===-1&&(this.pos=this.str.length,this.error(`Expect an apostrophe`)),this.substringToPos(e+1)}},Ur=9,Wr=10,Gr=12,Kr=13,qr=32,Jr=33,Yr=35,Xr=38,Zr=39,Qr=40,$r=41,ei=42,ti=43,ni=44,ri=45,ii=60,ai=62,oi=63,si=64,ci=91,li=93,ui=123,di=124,fi=125,pi=8734,mi={" ":1,"&&":2,"||":3,"|":4};function hi(e){let t=null,n=null;return e.eat(ui),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===ni?(e.pos++,e.skipWs(),e.charCode()!==fi&&(n=e.scanNumber(e),e.skipWs())):n=t,e.eat(fi),{min:Number(t),max:n?Number(n):0}}function gi(e){let t=null,n=!1;switch(e.charCode()){case ei:e.pos++,t={min:0,max:0};break;case ti:e.pos++,t={min:1,max:0};break;case oi:e.pos++,t={min:0,max:1};break;case Yr:e.pos++,n=!0,e.charCode()===ui?t=hi(e):e.charCode()===oi?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case ui:t=hi(e);break;default:return null}return{type:`Multiplier`,comma:n,min:t.min,max:t.max,term:null}}function V(e,t){let n=gi(e);return n===null?t:(n.term=t,e.charCode()===Yr&&e.charCodeAt(e.pos-1)===ti?V(e,n):n)}function _i(e){let t=e.peek();return t===``?null:V(e,{type:`Token`,value:t})}function vi(e){let t;return e.eat(ii),e.eat(Zr),t=e.scanWord(),e.eat(Zr),e.eat(ai),V(e,{type:`Property`,name:t})}function yi(e){let t=null,n=null,r=1;return e.eat(ci),e.charCode()===ri&&(e.peek(),r=-1),r==-1&&e.charCode()===pi?e.peek():(t=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(ni),e.skipWs(),e.charCode()===pi?e.peek():(r=1,e.charCode()===ri&&(e.peek(),r=-1),n=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(n+=e.scanWord())),e.eat(li),{type:`Range`,min:t,max:n}}function bi(e){let t,n=null;if(e.eat(ii),t=e.scanWord(),t===`boolean-expr`){e.eat(ci);let t=Ci(e,li);return e.eat(li),e.eat(ai),V(e,{type:`Boolean`,term:t.terms.length===1?t.terms[0]:t})}return e.charCode()===Qr&&e.nextCharCode()===$r&&(e.pos+=2,t+=`()`),e.charCodeAt(e.findWsEnd(e.pos))===ci&&(e.skipWs(),n=yi(e)),e.eat(ai),V(e,{type:`Type`,name:t,opts:n})}function xi(e){let t=e.scanWord();return e.charCode()===Qr?(e.pos++,{type:`Function`,name:t}):V(e,{type:`Keyword`,name:t})}function Si(e,t){function n(e,t){return{type:`Group`,terms:e,combinator:t,disallowEmpty:!1,explicit:!1}}let r;for(t=Object.keys(t).sort((e,t)=>mi[e]-mi[t]);t.length>0;){r=t.shift();let i=0,a=0;for(;i1&&(e.splice(a,i-a,n(e.slice(a,i),r)),i=a+1),a=-1))}a!==-1&&t.length&&e.splice(a,i-a,n(e.slice(a,i),r))}return r}function Ci(e,t){let n=Object.create(null),r=[],i,a=null,o=e.pos;for(;e.charCode()!==t&&(i=Ti(e,t));)i.type!==`Spaces`&&(i.type===`Combinator`?((a===null||a.type===`Combinator`)&&(e.pos=o,e.error(`Unexpected combinator`)),n[i.value]=!0):a!==null&&a.type!==`Combinator`&&(n[` `]=!0,r.push({type:`Combinator`,value:` `})),r.push(i),a=i,o=e.pos);return a!==null&&a.type===`Combinator`&&(e.pos-=o,e.error(`Unexpected combinator`)),{type:`Group`,terms:r,combinator:Si(r,n)||` `,disallowEmpty:!1,explicit:!1}}function wi(e,t){let n;return e.eat(ci),n=Ci(e,t),e.eat(li),n.explicit=!0,e.charCode()===Jr&&(e.pos++,n.disallowEmpty=!0),n}function Ti(e,t){let n=e.charCode();switch(n){case li:break;case ci:return V(e,wi(e,t));case ii:return e.nextCharCode()===Zr?vi(e):bi(e);case di:return{type:`Combinator`,value:e.substringToPos(e.pos+(e.nextCharCode()===di?2:1))};case Xr:return e.pos++,e.eat(Xr),{type:`Combinator`,value:`&&`};case ni:return e.pos++,{type:`Comma`};case Zr:return V(e,{type:`String`,value:e.scanString()});case qr:case Ur:case Wr:case Kr:case Gr:return{type:`Spaces`,value:e.scanSpaces()};case si:return n=e.nextCharCode(),e.isNameCharCode(n)?(e.pos++,{type:`AtKeyword`,name:e.scanWord()}):_i(e);case ei:case ti:case oi:case Yr:case Jr:break;case ui:if(n=e.nextCharCode(),n<48||n>57)return _i(e);break;default:return e.isNameCharCode(n)?xi(e):_i(e)}}function Ei(e){let t=new Hr(e),n=Ci(t);return t.pos!==e.length&&t.error(`Unexpected input`),n.terms.length===1&&n.terms[0].type===`Group`?n.terms[0]:n}var Di=function(){};function Oi(e){return typeof e==`function`?e:Di}function ki(e,t,n){function r(e){switch(i.call(n,e),e.type){case`Group`:e.terms.forEach(r);break;case`Multiplier`:case`Boolean`:r(e.term);break;case`Type`:case`Property`:case`Keyword`:case`AtKeyword`:case`Function`:case`String`:case`Token`:case`Comma`:break;default:throw Error(`Unknown type: `+e.type)}a.call(n,e)}let i=Di,a=Di;if(typeof t==`function`?i=t:t&&(i=Oi(t.enter),a=Oi(t.leave)),i===Di&&a===Di)throw Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");r(e,n)}var Ai={decorator(e){let t=[],n=null;return{...e,node(t){let r=n;n=t,e.node.call(this,t),n=r},emit(e,r,i){t.push({type:r,value:e,node:i?null:n})},result(){return t}}}};function ji(e){let t=[];return Tt(e,(n,r,i)=>t.push({type:n,value:e.slice(r,i),node:null})),t}function Mi(e,t){return typeof e==`string`?ji(e):t.generate(e,Ai)}var H={type:`Match`},U={type:`Mismatch`},Ni={type:`DisallowEmpty`},Pi=40,Fi=41;function W(e,t,n){return t===H&&n===U||e===H&&t===H&&n===H?e:(e.type===`If`&&e.else===U&&t===H&&(t=e.then,e=e.match),{type:`If`,match:e,then:t,else:n})}function Ii(e){return e.length>2&&e.charCodeAt(e.length-2)===Pi&&e.charCodeAt(e.length-1)===Fi}function Li(e){return e.type===`Keyword`||e.type===`AtKeyword`||e.type===`Function`||e.type===`Type`&&Ii(e.name)}function G(e,t=` `,n=!1){return{type:`Group`,terms:e,combinator:t,disallowEmpty:!1,explicit:n}}function Ri(e,t,n=new Set){if(!n.has(e))switch(n.add(e),e.type){case`If`:e.match=Ri(e.match,t,n),e.then=Ri(e.then,t,n),e.else=Ri(e.else,t,n);break;case`Type`:return t[e.name]||e}return e}function zi(e,t,n){switch(e){case` `:{let e=H;for(let n=t.length-1;n>=0;n--){let r=t[n];e=W(r,e,U)}return e}case`|`:{let e=U,n=null;for(let r=t.length-1;r>=0;r--){let i=t[r];if(Li(i)&&(n===null&&r>0&&Li(t[r-1])&&(n=Object.create(null),e=W({type:`Enum`,map:n},H,e)),n!==null)){let e=(Ii(i.name)?i.name.slice(0,-1):i.name).toLowerCase();if(!(e in n)){n[e]=i;continue}}n=null,e=W(i,H,e)}return e}case`&&`:{if(t.length>5)return{type:`MatchOnce`,terms:t,all:!0};let n=U;for(let r=t.length-1;r>=0;r--){let i=t[r],a;a=t.length>1?zi(e,t.filter(function(e){return e!==i}),!1):H,n=W(i,a,n)}return n}case`||`:{if(t.length>5)return{type:`MatchOnce`,terms:t,all:!1};let r=n?H:U;for(let n=t.length-1;n>=0;n--){let i=t[n],a;a=t.length>1?zi(e,t.filter(function(e){return e!==i}),!0):H,r=W(i,a,r)}return r}}}function Bi(e){let t=H,n=Vi(e.term);if(e.max===0)n=W(n,Ni,U),t=W(n,null,U),t.then=W(H,H,t),e.comma&&(t.then.else=W({type:`Comma`,syntax:e},t,U));else for(let r=e.min||1;r<=e.max;r++)e.comma&&t!==H&&(t=W({type:`Comma`,syntax:e},t,U)),t=W(n,W(H,H,t),U);if(e.min===0)t=W(H,H,t);else for(let r=0;r=65&&i<=90&&(i|=32),i!==r)return!1}return!0}function ta(e){return e.type===9?e.value!==`?`:!1}function na(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||ta(e)}function ra(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value===`/`}function ia(e,t,n){function r(){do v++,_=vy&&(y=v)}function l(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},b={type:Ki,syntax:t.syntax,token:b.token,prev:b}}function u(){b=b.type===Ki?b.prev:{type:qi,syntax:d.syntax,token:b.token,prev:b},d=d.prev}let d=null,f=null,p=null,m=null,h=0,g=null,_=null,v=-1,y=0,b={type:Wi,syntax:null,token:null,prev:null};for(r();g===null&&++hp.tokenIndex)&&(p=m,m=!1);else if(p===null){g=Yi;break}t=p.nextState,f=p.thenStack,d=p.syntaxStack,b=p.matchStack,v=p.tokenIndex,_=vv){for(;v`:`<'`+t.name+`'>`));if(m!==!1&&_!==null&&t.type===`Type`&&(t.name===`custom-ident`&&_.type===1||t.name===`length`&&_.value===`0`)){m===null&&(m=a(t,p)),t=U;break}l(),t=r.matchRef||r.match;break}case`Keyword`:{let e=t.name;if(_!==null){let n=_.value;if(n.indexOf(`\\`)!==-1&&(n=n.replace(/\\[09].*$/,``)),ea(n,e)){c(),t=H;break}}t=U;break}case`AtKeyword`:case`Function`:if(_!==null&&ea(_.value,t.name)){c(),t=H;break}t=U;break;case`Token`:if(_!==null&&_.value===t.value){c(),t=H;break}t=U;break;case`Comma`:_!==null&&_.type===18?na(b.token)?t=U:(c(),t=ra(_)?U:H):t=na(b.token)||ra(_)?H:U;break;case`String`:let r=``,h=v;for(;hsa,isKeyword:()=>ua,isProperty:()=>la,isType:()=>ca});function sa(e){function t(e){return e===null?!1:e.type===`Type`||e.type===`Property`||e.type===`Keyword`}function n(i){if(Array.isArray(i.match)){for(let e=0;ee.type===`Type`&&e.name===t)}function la(e,t){return da(this,e,e=>e.type===`Property`&&e.name===t)}function ua(e){return da(this,e,e=>e.type===`Keyword`)}function da(e,t,n){let r=sa.call(e,t);return r===null?!1:r.some(n)}function fa(e){return`node`in e?e.node:fa(e.match[0])}function pa(e){return`node`in e?e.node:pa(e.match[e.match.length-1])}function ma(e,t,n,r,i){function a(n){if(n.syntax!==null&&n.syntax.type===r&&n.syntax.name===i){let r=fa(n),i=pa(n);e.syntax.walk(t,function(e,t,n){if(e===r){let e=new Dt;do{if(e.appendData(t.data),t.data===i)break;t=t.next}while(t!==null);o.push({parent:n,nodes:e})}})}Array.isArray(n.match)&&n.match.forEach(a)}let o=[];return n.matched!==null&&a(n.matched),o}var{hasOwnProperty:ha}=Object.prototype;function ga(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e&&e>=0}function _a(e){return!!e&&ga(e.offset)&&ga(e.line)&&ga(e.column)}function va(e,t){return function(n,r){if(!n||n.constructor!==Object)return r(n,`Type of node should be an Object`);for(let i in n){let a=!0;if(ha.call(n,i)!==!1){if(i===`type`)n.type!==e&&r(n,"Wrong node type `"+n.type+"`, expected `"+e+"`");else if(i===`loc`){if(n.loc===null)continue;if(n.loc&&n.loc.constructor===Object)if(typeof n.loc.source!=`string`)i+=`.source`;else if(!_a(n.loc.start))i+=`.start`;else if(!_a(n.loc.end))i+=`.end`;else continue;a=!1}else if(t.hasOwnProperty(i)){a=!1;for(let e=0;!a&&e`);else throw Error("Wrong value `"+i+"` in `"+t+"` structure definition")}return n.join(` | `)}function ba(e,t){let n=t.structure,r={type:String,loc:!0},i={type:`"`+e+`"`};for(let t in n)ha.call(n,t)!==!1&&(i[t]=ya(r[t]=Array.isArray(n[t])?n[t].slice():[n[t]],e+`.`+t));return{docs:i,check:va(e,r)}}function xa(e){let t={};if(e.node){for(let n in e.node)if(ha.call(e.node,n)){let r=e.node[n];if(r.structure)t[n]=ba(n,r);else throw Error("Missed `structure` field in `"+n+"` node type definition")}}return t}function Sa(e,t,n){let r={};for(let i in e)e[i].syntax&&(r[i]=n?e[i].syntax:Cn(e[i].syntax,{compact:t}));return r}function Ca(e,t,n){let r={};for(let[i,a]of Object.entries(e))r[i]={prelude:a.prelude&&(n?a.prelude.syntax:Cn(a.prelude.syntax,{compact:t})),descriptors:a.descriptors&&Sa(a.descriptors,t,n)};return r}function wa(e){for(let t=0;t(n[r]=this.createDescriptor(t.descriptors[r],`AtruleDescriptor`,r,e),n),Object.create(null)):null})}addProperty_(e,t){t&&(this.properties[e]=this.createDescriptor(t,`Property`,e))}addType_(e,t){t&&(this.types[e]=this.createDescriptor(t,`Type`,e))}checkAtruleName(e){if(!this.getAtrule(e))return new On(`Unknown at-rule`,`@`+e)}checkAtrulePrelude(e,t){let n=this.checkAtruleName(e);if(n)return n;let r=this.getAtrule(e);if(!r.prelude&&t)return SyntaxError("At-rule `@"+e+"` should not contain a prelude");if(r.prelude&&!t&&!Ea(this,r.prelude,``,!1).matched)return SyntaxError("At-rule `@"+e+"` should contain a prelude")}checkAtruleDescriptorName(e,t){let n=this.checkAtruleName(e);if(n)return n;let r=this.getAtrule(e),i=Nn(t);if(!r.descriptors)return SyntaxError("At-rule `@"+e+"` has no known descriptors");if(!r.descriptors[i.name]&&!r.descriptors[i.basename])return new On(`Unknown at-rule descriptor`,t)}checkPropertyName(e){if(!this.getProperty(e))return new On(`Unknown property`,e)}matchAtrulePrelude(e,t){let n=this.checkAtrulePrelude(e,t);if(n)return K(null,n);let r=this.getAtrule(e);return r.prelude?Ea(this,r.prelude,t||``,!1):K(null,null)}matchAtruleDescriptor(e,t,n){let r=this.checkAtruleDescriptorName(e,t);if(r)return K(null,r);let i=this.getAtrule(e),a=Nn(t);return Ea(this,i.descriptors[a.name]||i.descriptors[a.basename],n,!1)}matchDeclaration(e){return e.type===`Declaration`?this.matchProperty(e.property,e.value):K(null,Error(`Not a Declaration node`))}matchProperty(e,t){if(Pn(e).custom)return K(null,Error(`Lexer matching doesn't applicable for custom properties`));let n=this.checkPropertyName(e);return n?K(null,n):Ea(this,this.getProperty(e),t,!0)}matchType(e,t){let n=this.getType(e);return n?Ea(this,n,t,!1):K(null,new On(`Unknown type`,e))}match(e,t){return typeof e!=`string`&&(!e||!e.type)?K(null,new On(`Bad syntax`)):((typeof e==`string`||!e.match)&&(e=this.createDescriptor(e,`Type`,`anonymous`)),Ea(this,e,t,!1))}findValueFragments(e,t,n,r){return ma(this,t,this.matchProperty(e,t),n,r)}findDeclarationValueFragments(e,t,n){return ma(this,e.value,this.matchDeclaration(e),t,n)}findAllFragments(e,t,n){let r=[];return this.syntax.walk(e,{visit:`Declaration`,enter:e=>{r.push.apply(r,this.findDeclarationValueFragments(e,t,n))}}),r}getAtrule(e,t=!0){let n=Nn(e);return(n.vendor&&t?this.atrules[n.name]||this.atrules[n.basename]:this.atrules[n.name])||null}getAtrulePrelude(e,t=!0){let n=this.getAtrule(e,t);return n&&n.prelude||null}getAtruleDescriptor(e,t){return this.atrules.hasOwnProperty(e)&&this.atrules.declarators&&this.atrules[e].declarators[t]||null}getProperty(e,t=!0){let n=Pn(e);return(n.vendor&&t?this.properties[n.name]||this.properties[n.basename]:this.properties[n.name])||null}getType(e){return hasOwnProperty.call(this.types,e)?this.types[e]:null}validate(){function e(e,t){return t?`<${e}>`:`<'${e}'>`}function t(a,o,s,c){if(s.has(o))return s.get(o);s.set(o,!1),c.syntax!==null&&ki(c.syntax,function(c){if(c.type!==`Type`&&c.type!==`Property`)return;let l=c.type===`Type`?a.types:a.properties,u=c.type===`Type`?r:i;hasOwnProperty.call(l,c.name)?t(a,c.name,u,l[c.name])&&(n.push(`${e(o,s===r)} used broken syntax definition ${e(c.name,c.type===`Type`)}`),s.set(o,!0)):(n.push(`${e(o,s===r)} used missed syntax definition ${e(c.name,c.type===`Type`)}`),s.set(o,!0))},this)}let n=[],r=new Map,i=new Map;for(let e in this.types)t(this,e,r,this.types[e]);for(let e in this.properties)t(this,e,i,this.properties[e]);let a=[...r.keys()].filter(e=>r.get(e)),o=[...i.keys()].filter(e=>i.get(e));return a.length||o.length?{errors:n,types:a,properties:o}:null}dump(e,t){return{generic:this.generic,cssWideKeywords:this.cssWideKeywords,units:this.units,types:Sa(this.types,!t,e),properties:Sa(this.properties,!t,e),atrules:Ca(this.atrules,!t,e)}}toString(){return JSON.stringify(this.dump())}};function Oa(e,t){return typeof t==`string`&&/^\s*\|/.test(t)?typeof e==`string`?e+t:t.replace(/^\s*\|\s*/,``):t||null}function ka(e,t){let n=Object.create(null);for(let r of Object.keys(e))t.includes(r)&&(n[r]=e[r]);return n}function Aa(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))r[e]={...r[e],...n?ka(i,n):i};return r}function ja(e,t){let n={...e};for(let[r,i]of Object.entries(t))switch(r){case`generic`:n[r]=!!i;break;case`cssWideKeywords`:n[r]=e[r]?[...e[r],...i]:i||[];break;case`units`:n[r]={...e[r]};for(let[e,t]of Object.entries(i))n[r][e]=Array.isArray(t)?t:[];break;case`atrules`:n[r]={...e[r]};for(let[e,t]of Object.entries(i)){let i=n[r][e]||{},a=n[r][e]={prelude:i.prelude||null,descriptors:{...i.descriptors}};if(t){a.prelude=t.prelude?Oa(a.prelude,t.prelude):a.prelude||null;for(let[e,n]of Object.entries(t.descriptors||{}))a.descriptors[e]=n?Oa(a.descriptors[e],n):null;Object.keys(a.descriptors).length||(a.descriptors=null)}}break;case`types`:case`properties`:n[r]={...e[r]};for(let[e,t]of Object.entries(i))n[r][e]=Oa(n[r][e],t);break;case`parseContext`:n[r]={...e[r],...i};break;case`scope`:case`features`:n[r]=Aa(e[r],i);break;case`atrule`:case`pseudo`:n[r]=Aa(e[r],i,[`parse`]);break;case`node`:n[r]=Aa(e[r],i,[`name`,`structure`,`parse`,`generate`,`walkContext`]);break}return n}function Ma(e){let t=Wt(e),n=_n(e),r=sn(e),{fromPlainObject:i,toPlainObject:a}=cn(n),o={lexer:null,createLexer:e=>new Da(e,o,o.lexer.structure),tokenize:Tt,parse:t,generate:r,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:i,toPlainObject:a,fork(t){let n=ja({},e);return Ma(typeof t==`function`?t(n):ja(n,t))}};return o.lexer=new Da({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},o),o}var Na=e=>Ma(ja({},e)),Pa={generic:!0,cssWideKeywords:[`initial`,`inherit`,`unset`,`revert`,`revert-layer`],units:{angle:[`deg`,`grad`,`rad`,`turn`],decibel:[`db`],flex:[`fr`],frequency:[`hz`,`khz`],length:`cm.mm.q.in.pt.pc.px.em.rem.ex.rex.cap.rcap.ch.rch.ic.ric.lh.rlh.vw.svw.lvw.dvw.vh.svh.lvh.dvh.vi.svi.lvi.dvi.vb.svb.lvb.dvb.vmin.svmin.lvmin.dvmin.vmax.svmax.lvmax.dvmax.cqw.cqh.cqi.cqb.cqmin.cqmax`.split(`.`),resolution:[`dpi`,`dpcm`,`dppx`,`x`],semitones:[`st`],time:[`s`,`ms`]},types:{"abs()":`abs( )`,"absolute-size":`xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large`,"acos()":`acos( )`,"alpha-value":`|`,"an+b":`odd|even|||'+'? † n|-n||'+'? † || |'+'? † n |-n | |'+'? † n- |-n- | ['+'|'-'] |'+'? † n ['+'|'-'] |-n ['+'|'-'] `,"anchor()":`anchor( ?&& , ? )`,"anchor-name":``,"anchor-side":`inside|outside|top|left|right|bottom|start|end|self-start|self-end||center`,"anchor-size":`width|height|block|inline|self-block|self-inline`,"anchor-size()":`anchor-size( [||]? , ? )`,"angle-percentage":`|`,"angular-color-hint":`|`,"angular-color-stop":` ?`,"angular-color-stop-list":` , [? , ]#?`,"animateable-feature":`scroll-position|contents|`,"asin()":`asin( )`,"atan()":`atan( )`,"atan2()":`atan2( , )`,attachment:`scroll|fixed|local`,"attr()":`attr( ? [, ]? )`,"attr-matcher":`['~'|'|'|'^'|'$'|'*']? '='`,"attr-modifier":`i|s`,"attribute-selector":`'[' ']'|'[' [|] ? ']'`,"auto-repeat":`repeat( [auto-fill|auto-fit] , [? ]+ ? )`,"auto-track-list":`[? [|]]* ? [? [|]]* ?`,axis:`block|inline|x|y`,"baseline-position":`[first|last]? baseline`,"basic-shape":`||||||`,"basic-shape-rect":`||`,"bg-clip":`|border-area|text`,"bg-image":`none|`,"bg-layer":`|| [/ ]?||||||||`,"bg-position":`[[left|center|right|top|bottom|]|[left|center|right|] [top|center|bottom|]|[center|[left|right] ?]&&[center|[top|bottom] ?]]`,"bg-size":`[|auto]{1,2}|cover|contain`,"blend-mode":`normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity`,"blur()":`blur( ? )`,"brightness()":`brightness( [|]? )`,"calc()":`calc( )`,"calc-constant":`e|pi|infinity|-infinity|NaN`,"calc-product":` ['*' |'/' ]*`,"calc-size()":`calc-size( , )`,"calc-size-basis":`||any|`,"calc-sum":` [['+'|'-'] ]*`,"calc-value":`||||( )`,"cf-final-image":`|`,"cf-mixing-image":`?&&`,"circle()":`circle( ? [at ]? )`,"clamp()":`clamp( #{3} )`,"class-selector":`'.' `,"clip-source":``,color:`|currentColor||||<-non-standard-color>`,"color()":`color( [/ [|none]]? )`,"color-base":`||||transparent`,"color-function":`|||||||||`,"color-interpolation-method":`in [| ?|]`,"color-mix()":`color-mix( , [&&?]#{2} )`,"color-stop":`|`,"color-stop-angle":`[|]{1,2}`,"color-stop-length":`{1,2}`,"color-stop-list":` , [? , ]#?`,"colorspace-params":`[|]`,combinator:`'>'|'+'|'~'|['|' '|']`,"common-lig-values":`[common-ligatures|no-common-ligatures]`,"compat-auto":`searchfield|textarea|push-button|slider-horizontal|checkbox|radio|square-button|menulist|listbox|meter|progress-bar|button`,"complex-selector":` [? ]*`,"complex-selector-list":`#`,"composite-style":`clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor`,"compositing-operator":`add|subtract|intersect|exclude`,"compound-selector":`[? *]!`,"compound-selector-list":`#`,"conic-gradient()":`conic-gradient( [] )`,"conic-gradient-syntax":`[[[from [|]]? [at ]?]||]? , `,"container-condition":`not | [[and ]*|[or ]*]`,"container-name":``,"container-query":`not | [[and ]*|[or ]*]`,"content-distribution":`space-between|space-around|space-evenly|stretch`,"content-list":`[|contents||||||]+`,"content-position":`center|start|end|flex-start|flex-end`,"content-replacement":``,"contextual-alt-values":`[contextual|no-contextual]`,"contrast()":`contrast( [|]? )`,"coord-box":`content-box|padding-box|border-box|fill-box|stroke-box|view-box`,"cos()":`cos( )`,counter:`|`,"counter()":`counter( , ? )`,"counter-name":``,"counter-style":`|symbols( )`,"counter-style-name":``,"counters()":`counters( , , ? )`,"cross-fade()":`cross-fade( , ? )`,"cubic-bezier()":`cubic-bezier( [ , ]#{2} )`,"cubic-bezier-timing-function":`ease|ease-in|ease-out|ease-in-out|`,"custom-color-space":``,"custom-params":` [||none]+`,dasharray:`[[|]+]#`,"dashndashdigit-ident":``,"deprecated-system-color":`ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonHighlight|ButtonShadow|CaptionText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText`,"discretionary-lig-values":`[discretionary-ligatures|no-discretionary-ligatures]`,"display-box":`contents|none`,"display-inside":`flow|flow-root|table|flex|grid|ruby`,"display-internal":`table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container`,"display-legacy":`inline-block|inline-list-item|inline-table|inline-flex|inline-grid`,"display-listitem":`?&&[flow|flow-root]?&&list-item`,"display-outside":`block|inline|run-in`,"drop-shadow()":`drop-shadow( [?&&{2,3}] )`,"easing-function":`||`,"east-asian-variant-values":`[jis78|jis83|jis90|jis04|simplified|traditional]`,"east-asian-width-values":`[full-width|proportional-width]`,"element()":`element( , [first|start|last|first-except]? )|element( )`,"ellipse()":`ellipse( ? [at ]? )`,"env()":`env( , ? )`,"exp()":`exp( )`,"explicit-track-list":`[? ]+ ?`,"family-name":`|+`,"feature-tag-value":` [|on|off]?`,"feature-type":`@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation`,"feature-value-block":` '{' '}'`,"feature-value-block-list":`+`,"feature-value-declaration":` : + ;`,"feature-value-declaration-list":``,"feature-value-name":``,"filter-function":`|||||||||`,"filter-value-list":`[|]+`,"final-bg-layer":`<'background-color'>|||| [/ ]?||||||||`,"fit-content()":`fit-content( )`,"fixed-breadth":``,"fixed-repeat":`repeat( [] , [? ]+ ? )`,"fixed-size":`|minmax( , )|minmax( , )`,"font-stretch-absolute":`normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|`,"font-variant-css21":`[normal|small-caps]`,"font-weight-absolute":`normal|bold|`,"form-control-identifier":`select`,"frequency-percentage":`|`,"generic-complete":`serif|sans-serif|system-ui|cursive|fantasy|math|monospace`,"general-enclosed":`[ ? )]|[( ? )]`,"generic-family":`|||<-non-standard-generic-family>`,"generic-incomplete":`ui-serif|ui-sans-serif|ui-monospace|ui-rounded`,"geometry-box":`|fill-box|stroke-box|view-box`,gradient:`||||||<-legacy-gradient>`,"grayscale()":`grayscale( [|]? )`,"grid-line":`auto||[&&?]|[span&&[||]]`,"historical-lig-values":`[historical-ligatures|no-historical-ligatures]`,"hsl()":`hsl( , , , ? )|hsl( [|none] [||none] [||none] [/ [|none]]? )`,"hsla()":`hsla( , , , ? )|hsla( [|none] [||none] [||none] [/ [|none]]? )`,hue:`|`,"hue-interpolation-method":`[shorter|longer|increasing|decreasing] hue`,"hue-rotate()":`hue-rotate( [|]? )`,"hwb()":`hwb( [|none] [||none] [||none] [/ [|none]]? )`,"hypot()":`hypot( # )`,image:`||||||`,"image()":`image( ? [? , ?]! )`,"image-set()":`image-set( # )`,"image-set-option":`[|] [||type( )]`,"image-src":`|`,"image-tags":`ltr|rtl`,"inflexible-breadth":`|min-content|max-content|auto`,"inset()":`inset( {1,4} [round <'border-radius'>]? )`,"invert()":`invert( [|]? )`,"keyframe-block":`# { }`,"keyframe-selector":`from|to|| `,"keyframes-name":`|`,"lab()":`lab( [||none] [||none] [||none] [/ [|none]]? )`,"layer()":`layer( )`,"layer-name":` ['.' ]*`,"lch()":`lch( [||none] [||none] [|none] [/ [|none]]? )`,"leader()":`leader( )`,"leader-type":`dotted|solid|space|`,"length-percentage":`|`,"light-dark()":`light-dark( , )`,"line-name-list":`[|]+`,"line-names":`'[' * ']'`,"line-style":`none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset`,"line-width":`|thin|medium|thick`,"linear()":`linear( [&&{0,2}]# )`,"linear-color-hint":``,"linear-color-stop":` ?`,"linear-easing-function":`linear|`,"linear-gradient()":`linear-gradient( [] )`,"linear-gradient-syntax":`[[||to ]||]? , `,"log()":`log( , ? )`,"mask-layer":`|| [/ ]?||||||[|no-clip]||||`,"mask-position":`[|left|center|right] [|top|center|bottom]?`,"mask-reference":`none||`,"mask-source":``,"masking-mode":`alpha|luminance|match-source`,"matrix()":`matrix( #{6} )`,"matrix3d()":`matrix3d( #{16} )`,"max()":`max( # )`,"media-and":` [and ]+`,"media-condition":`|||`,"media-condition-without-or":`||`,"media-feature":`( [||] )`,"media-in-parens":`( )||`,"media-not":`not `,"media-or":` [or ]+`,"media-query":`|[not|only]? [and ]?`,"media-query-list":`#`,"media-type":``,"mf-boolean":``,"mf-name":``,"mf-plain":` : `,"mf-range":` ['<'|'>']? '='? | ['<'|'>']? '='? | '<' '='? '<' '='? | '>' '='? '>' '='? `,"mf-value":`|||`,"min()":`min( # )`,"minmax()":`minmax( [|min-content|max-content|auto] , [||min-content|max-content|auto] )`,"mod()":`mod( , )`,"n-dimension":``,"name-repeat":`repeat( [|auto-fill] , + )`,"named-color":`aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen`,"namespace-prefix":``,"ndash-dimension":``,"ndashdigit-dimension":``,"ndashdigit-ident":``,"ns-prefix":`[|'*']? '|'`,"number-percentage":`|`,"numeric-figure-values":`[lining-nums|oldstyle-nums]`,"numeric-fraction-values":`[diagonal-fractions|stacked-fractions]`,"numeric-spacing-values":`[proportional-nums|tabular-nums]`,"offset-path":`||`,"oklab()":`oklab( [||none] [||none] [||none] [/ [|none]]? )`,"oklch()":`oklch( [||none] [||none] [|none] [/ [|none]]? )`,"opacity()":`opacity( [|]? )`,"opacity-value":`|`,"outline-line-style":`none|dotted|dashed|solid|double|groove|ridge|inset|outset`,"outline-radius":`|`,"overflow-position":`unsafe|safe`,"page-body":`? [; ]?| `,"page-margin-box":` '{' '}'`,"page-margin-box-type":`@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom`,"page-selector":`+| *`,"page-selector-list":`[#]?`,"page-size":`A5|A4|A3|B5|B4|JIS-B5|JIS-B4|letter|legal|ledger`,paint:`none|| [none|]?|context-fill|context-stroke`,"paint()":`paint( , ? )`,"paint-box":`|fill-box|stroke-box`,"palette-identifier":``,"palette-mix()":`palette-mix( , [[normal|light|dark||]&&?]#{2} )`,"path()":`path( <'fill-rule'>? , )`,"perspective()":`perspective( [|none] )`,"polar-color-space":`hsl|hwb|lch|oklch`,"polygon()":`polygon( <'fill-rule'>? , [ ]# )`,position:`[[left|center|right]||[top|center|bottom]|[left|center|right|] [top|center|bottom|]?|[[left|right] ]&&[[top|bottom] ]]`,"position-area":`[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|center|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|center|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]`,"pow()":`pow( , )`,"predefined-rgb":`srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020`,"predefined-rgb-params":` [||none]{3}`,"pseudo-class-selector":`':' |':' ')'`,"pseudo-element-selector":`':' |`,"pseudo-page":`: [left|right|first|blank]`,"query-in-parens":`( )|( )|style( )|`,quote:`open-quote|close-quote|no-open-quote|no-close-quote`,"radial-extent":`closest-corner|closest-side|farthest-corner|farthest-side`,"radial-gradient()":`radial-gradient( [] )`,"radial-gradient-syntax":`[[[||]? [at ]?]||]? , `,"radial-shape":`circle|ellipse`,"radial-size":`||{2}`,ratio:` [/ ]?`,"ray()":`ray( &&?&&contain?&&[at ]? )`,"ray-size":`closest-side|closest-corner|farthest-side|farthest-corner|sides`,"rect()":`rect( [|auto]{4} [round <'border-radius'>]? )`,"rectangular-color-space":`srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|lab|oklab|xyz|xyz-d50|xyz-d65`,"relative-selector":`? `,"relative-selector-list":`#`,"relative-size":`larger|smaller`,"rem()":`rem( , )`,"repeat-style":`repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}`,"repeating-conic-gradient()":`repeating-conic-gradient( [] )`,"repeating-linear-gradient()":`repeating-linear-gradient( [] )`,"repeating-radial-gradient()":`repeating-radial-gradient( [] )`,"reversed-counter-name":`reversed( )`,"rgb()":`rgb( #{3} , ? )|rgb( #{3} , ? )|rgb( [||none]{3} [/ [|none]]? )`,"rgba()":`rgba( #{3} , ? )|rgba( #{3} , ? )|rgba( [||none]{3} [/ [|none]]? )`,"rotate()":`rotate( [|] )`,"rotate3d()":`rotate3d( , , , [|] )`,"rotateX()":`rotateX( [|] )`,"rotateY()":`rotateY( [|] )`,"rotateZ()":`rotateZ( [|] )`,"round()":`round( ? , , )`,"rounding-strategy":`nearest|up|down|to-zero`,"saturate()":`saturate( [|]? )`,"scale()":`scale( [|]#{1,2} )`,"scale3d()":`scale3d( [|]#{3} )`,"scaleX()":`scaleX( [|] )`,"scaleY()":`scaleY( [|] )`,"scaleZ()":`scaleZ( [|] )`,"scope-end":``,"scope-start":``,"scroll()":`scroll( [||]? )`,scroller:`root|nearest|self`,"scroll-state-feature":``,"scroll-state-in-parens":`( )|( )|`,"scroll-state-query":`not | [[and ]*|[or ]*]|`,"selector-list":``,"self-position":`center|start|end|self-start|self-end|flex-start|flex-end`,"sepia()":`sepia( [|]? )`,shadow:`inset?&&{2,4}&&?`,"shadow-t":`[{2,3}&&?]`,shape:`rect( , , , )|rect( )`,"shape-box":`|margin-box`,"side-or-corner":`[left|right]||[top|bottom]`,"sign()":`sign( )`,"signed-integer":``,"signless-integer":``,"sin()":`sin( )`,"single-animation":`<'animation-duration'>||||<'animation-delay'>||||||||||[none|]||`,"single-animation-composition":`replace|add|accumulate`,"single-animation-direction":`normal|reverse|alternate|alternate-reverse`,"single-animation-fill-mode":`none|forwards|backwards|both`,"single-animation-iteration-count":`infinite|`,"single-animation-play-state":`running|paused`,"single-animation-timeline":`auto|none|||`,"single-transition":`[none|]||