const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/home-Bsv14hb9.js","assets/jsx-runtime-Bzw2jH9X.js","assets/services-DDmOapmW.js","assets/createLucideIcon-BkIMvJln.js","assets/modalStore-B5-16H5z.js","assets/date-CTxYulDo.js","assets/spin-D_N6wvMK.js","assets/useSize--KU1gilk.js","assets/arrow-right-BKCuK_oe.js","assets/calendar-CXtwVZ74.js","assets/chart-column-DA9TLGLl.js","assets/chart-pie-CZHaV8Kf.js","assets/compass-CrZr7WA1.js","assets/cpu-BzMyVirC.js","assets/database-BGadKx4F.js","assets/ellipsis-BH-VjFh2.js","assets/globe-DQDWxvBZ.js","assets/shield-check-Ctx3NQgx.js","assets/target-BnV5l8X3.js","assets/zap-Djh21f18.js","assets/assets-MAw11Or6.js","assets/AuthContext-CVAOVikM.js","assets/react-9QMQ-6_p.js","assets/AnimatePresence-DYGjgYfI.js","assets/GeoSEO-CGNu8OMD.js","assets/SEO-0ojKpipv.js","assets/geo-seo-46UpT7ft.js","assets/consultCustomResearch-BIjS5hgv.js","assets/knowledgePlatform-CGg_UzaS.js","assets/agentInterface-ByfjrT82.js","assets/clipboard-B2Pydpr4.js","assets/bot-2-Ob4PwZ.js","assets/key-round-C8ZIZlRJ.js","assets/skillAuthorization-CZtxaKlV.js","assets/gift-sdmSj7g-.js","assets/useWechatLoginSocket-BL49Sk_x.js","assets/about-CiiXB8Tn.js","assets/researchPlatformDetail-cPjTj-Cf.js","assets/network-BfSKTPLo.js","assets/DetailPageLayout-CAk_Oqwd.js","assets/DetailCTA-G4ki4xBo.js","assets/dataProductsDetail-CwX_IuyW.js","assets/customResearchDetail-BR-KR85P.js","assets/industryCollabDetail-bRCyhBW2.js","assets/lightbulb-DrPhLIFI.js","assets/scan-Ddd75hxP.js","assets/categoryReport-Ce7QVDrX.js","assets/pagination-Bcbu3lil.js","assets/KeyCode-Bm8t-2oB.js","assets/fallbackProp-89N2dBfL.js","assets/es-C117l6fq.js","assets/ContextIsolator-Dybn1jhL.js","assets/motion-Yy2vjOYP.js","assets/Compact-XqF1GfzW.js","assets/AntdIconLight-BcAeGYSx.js","assets/DisabledContext-BTU2x9XV.js","assets/LeftOutlined-CiD5Gglb.js","assets/EllipsisOutlined-HCtjXyMo.js","assets/report_default_cover-Cy6cvkAO.js","assets/HotKeywords-D-94DbPU.js","assets/flame-BhIku_X_.js","assets/useCategory-CuCUkPMF.js","assets/standard-D_IVPt7a.js","assets/chart-column-increasing-Btdnamvz.js","assets/chevron-up-Es8-Ld7o.js","assets/circle-check-big-EkF1HrxD.js","assets/InstitutionSelector-D5Lix75r.js","assets/x-CkbzgTHo.js","assets/rotate-ccw-zNFKfco9.js","assets/vip-CFqDioag.js","assets/Button-CZzJ734d.js","assets/icon-pdf-Dqc8I27s.js","assets/DateRangePicker-CjQJSCWJ.js","assets/date-picker-DDtTa-xg.js","assets/compact-item-DEzs8Bfx.js","assets/Button-DiayXriw.js","assets/color-ETsnQMUW.js","assets/roundedArrow-CoDucUHT.js","assets/useRequireAccess-Bb8_zAMF.js","assets/SearchModeToggle-B5VPortZ.js","assets/ai-DHGd1fVu.js","assets/clock-B5dcDzZw.js","assets/AiHistoryModal-D3NI-VFg.js","assets/AiSessionPage-COvAbOSR.js","assets/tooltip-DZPBnAt6.js","assets/zoom-DYsSht_L.js","assets/image-JADyR5vX.js","assets/CloseOutlined-DlVaArUV.js","assets/useMergedMask-nIddI_yq.js","assets/arrow-left-SNHzY-1I.js","assets/PdfViewer-DII2FpKl.js","assets/minimize-2-B3GalKo_.js","assets/share-2-D5hzKC5B.js","assets/PdfViewer-CvNwDP7y.css","assets/plus-C1OQIJyL.js","assets/lib-C2bPEITi.js","assets/reportPreview-BNqeBYO5.js","assets/landmark-DkMwc64y.js","assets/seo-text-Do_deNpV.js","assets/reportDetail-DYfSGE0b.js","assets/FolderPickerModal-BprZO79B.js","assets/FileOutlined-m7ZycFiA.js","assets/ReportDetailHeader-Cpp_ZX-J.js","assets/industryResearch-CY9FPBhr.js","assets/grid-3x3-Ce8xd-cB.js","assets/mapList-DPMsWCrt.js","assets/mapDetail-Dm2qy1Dr.js","assets/topics-t4Tkc3_G.js","assets/topicCollection-ktzmUDwR.js","assets/paidReports-CVx99Bsn.js","assets/tool-BhYJBQKo.js","assets/paidReportDetail-DdTeAvmN.js","assets/modal-DO3hc1E8.js","assets/useModal-BJBU4GQb.js","assets/CheckCircleFilled-h0rRpzYC.js","assets/style-bqr3G5xz.js","assets/companyResearch-CufICH27.js","assets/detail-Bu5wHcqL.js","assets/CategoricalChart-Dlb8zNPi.js","assets/detail-Bb_gDL8B.js","assets/dataCenter-lZaJis53.js","assets/image-BI7uqiMZ.js","assets/table-CIJE80kX.js","assets/chart-C8jaY0Rv.js","assets/macro-B8YxhlaD.js","assets/search-x-zQXEEMzi.js","assets/partner-BQpcMNdI.js","assets/dataDetail-D15sXXBl.js","assets/insightCenter-twmpJaYt.js","assets/articleDetail-Cb3Jiv9a.js","assets/services-B2hJvn_-.js","assets/contact-Bi8Tn34F.js","assets/profile-CxH_dSDs.js","assets/rss-DpI4WkBj.js","assets/upload-CK84pCTM.js","assets/vip-h6tjDGxu.js","assets/card-03RS6BiY.js","assets/orders-yODE3uI7.js","assets/downloads-wREb_G5A.js","assets/uploads-B8o8SExx.js","assets/uploadInfo-wpW-DDVS.js","assets/history-WRKbNdGq.js","assets/subscription-C2QU-sdW.js","assets/mail-BsXRenGu.js","assets/developer-BhKRawE3.js","assets/messages-BcYdGgxt.js","assets/benefits-3yLySvdV.js","assets/ambassador-fzp9cMbG.js","assets/favorites-DX1JtF9q.js","assets/protocol-BXYuVI1K.js","assets/Privacy-cLejP_cP.js","assets/Service-CgTeg-5o.js","assets/Tort-wVjp-ySU.js","assets/notFound-D4MV7NIp.js"])))=>i.map(i=>d[i]);
import{n as e,r as t,s as n,t as r}from"./jsx-runtime-Bzw2jH9X.js";import{$ as i,At as a,C as o,Ct as s,E as c,Et as l,G as u,I as d,J as f,K as p,M as m,St as h,T as g,Tt as _,V as v,W as y,X as b,Y as x,_ as S,b as C,c as w,ct as T,d as E,et as D,f as O,ft as k,g as A,gt as j,ht as M,i as N,it as P,kt as F,l as I,n as L,nt as R,o as z,ot as ee,pt as B,rt as V,s as te,t as ne,tt as re,u as ie,v as ae,w as oe,wt as H,x as se,xt as ce,y as U,yt as le,z as W}from"./useSize--KU1gilk.js";import{$ as ue,At as de,B as fe,Ct as pe,Ht as me,I as he,J as ge,Jt as _e,K as ve,Lt as ye,Q as be,Qt as xe,R as Se,Rt as Ce,St as we,T as Te,X as Ee,Xt as De,Yt as Oe,Z as ke,Zt as G,an as Ae,c as je,ft as Me,gt as Ne,ht as Pe,mt as Fe,nt as Ie,o as Le,pt as Re,tt as ze,un as Be,wt as Ve,xt as He,z as Ue}from"./services-DDmOapmW.js";import{t as K}from"./preload-helper-BZ1Pz5am.js";import{i as We,n as Ge,t as Ke}from"./es-C117l6fq.js";import{S as qe,T as Je,a as Ye,c as Xe,d as Ze,f as Qe,g as $e,h as et,i as tt,l as nt,m as rt,n as it,o as at,p as ot,r as st,s as ct,t as lt,u as ut,v as dt,w as ft,x as pt,y as mt}from"./ContextIsolator-Dybn1jhL.js";import{t as q}from"./KeyCode-Bm8t-2oB.js";import{i as ht,n as gt,r as _t,s as vt,t as yt}from"./motion-Yy2vjOYP.js";import{a as bt,i as xt,r as St,t as Ct}from"./Compact-XqF1GfzW.js";import{_ as wt,g as Tt,t as Et,v as Dt}from"./useModal-BJBU4GQb.js";import{t as Ot}from"./tooltip-DZPBnAt6.js";import{i as kt,l as At,n as jt,o as Mt,t as Nt,u as Pt}from"./fallbackProp-89N2dBfL.js";import{t as Ft}from"./CheckCircleFilled-h0rRpzYC.js";import{t as It}from"./AntdIconLight-BcAeGYSx.js";import{t as Lt}from"./CloseOutlined-DlVaArUV.js";import{i as Rt,n as zt,r as Bt}from"./style-bqr3G5xz.js";import{n as Vt,t as Ht}from"./DisabledContext-BTU2x9XV.js";import{n as Ut,t as Wt}from"./compact-item-DEzs8Bfx.js";import{t as Gt}from"./Button-DiayXriw.js";import{n as Kt}from"./zoom-DYsSht_L.js";import{n as qt,o as Jt,r as Yt,s as Xt,t as Zt}from"./date-CTxYulDo.js";import{t as Qt}from"./spin-D_N6wvMK.js";import{t as $t}from"./createLucideIcon-BkIMvJln.js";import{t as en}from"./gift-sdmSj7g-.js";import{t as tn}from"./x-CkbzgTHo.js";import{i as nn,r as rn,t as an}from"./vip-CFqDioag.js";import{n as on,r as sn,t as cn}from"./modalStore-B5-16H5z.js";import{n as ln,t as un}from"./AuthContext-CVAOVikM.js";import{t as dn}from"./react-9QMQ-6_p.js";import{t as fn}from"./AnimatePresence-DYGjgYfI.js";import{i as pn,r as mn,t as hn}from"./useWechatLoginSocket-BL49Sk_x.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function gn(e){typeof e.getOrInsert!=`function`&&(e.getOrInsert=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)}),typeof e.getOrInsertComputed!=`function`&&(e.getOrInsertComputed=function(e,t){if(this.has(e))return this.get(e);let n=t(e);return this.set(e,n),n})}gn(Map.prototype),gn(WeakMap.prototype);var _n=t(((e,t)=>{var n=typeof Element<`u`,r=typeof Map==`function`,i=typeof Set==`function`,a=typeof ArrayBuffer==`function`&&!!ArrayBuffer.isView;function o(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor!==t.constructor)return!1;var s,c,l;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(c=s;c--!==0;)if(!o(e[c],t[c]))return!1;return!0}var u;if(r&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!t.has(c.value[0]))return!1;for(u=e.entries();!(c=u.next()).done;)if(!o(c.value[1],t.get(c.value[0])))return!1;return!0}if(i&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!t.has(c.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(s=e.length,s!=t.length)return!1;for(c=s;c--!==0;)if(e[c]!==t[c])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf==`function`&&typeof t.valueOf==`function`)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString==`function`&&typeof t.toString==`function`)return e.toString()===t.toString();if(l=Object.keys(e),s=l.length,s!==Object.keys(t).length)return!1;for(c=s;c--!==0;)if(!Object.prototype.hasOwnProperty.call(t,l[c]))return!1;if(n&&e instanceof Element)return!1;for(c=s;c--!==0;)if((l[c]!==`_owner`&&l[c]!==`__v`&&l[c]!==`__o`||!e.$$typeof)&&!o(e[l[c]],t[l[c]]))return!1;return!0}return e!==e&&t!==t}t.exports=function(e,t){try{return o(e,t)}catch(e){if((e.message||``).match(/stack|recursion/i))return console.warn(`react-fast-compare cannot handle circular refs`),!1;throw e}}})),vn=t(((e,t)=>{t.exports=function(e,t,n,r,i,a,o,s){if(!e){var c;if(t===void 0)c=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var l=[n,r,i,a,o,s],u=0;c=Error(t.replace(/%s/g,function(){return l[u++]})),c.name=`Invariant Violation`}throw c.framesToPop=1,c}}})),yn=t(((e,t)=>{t.exports=function(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;c<a.length;c++){var l=a[c];if(!s(l))return!1;var u=e[l],d=t[l];if(i=n?n.call(r,u,d,l):void 0,i===!1||i===void 0&&u!==d)return!1}return!0}})),bn=a(),J=n(e()),xn=n(_n()),Sn=n(vn()),Cn=n(yn()),wn=(e=>(e.BASE=`base`,e.BODY=`body`,e.HEAD=`head`,e.HTML=`html`,e.LINK=`link`,e.META=`meta`,e.NOSCRIPT=`noscript`,e.SCRIPT=`script`,e.STYLE=`style`,e.TITLE=`title`,e.FRAGMENT=`Symbol(react.fragment)`,e))(wn||{}),Tn={link:{rel:[`amphtml`,`canonical`,`alternate`]},script:{type:[`application/ld+json`]},meta:{charset:``,name:[`generator`,`robots`,`description`],property:[`og:type`,`og:title`,`og:url`,`og:image`,`og:image:alt`,`og:description`,`twitter:url`,`twitter:title`,`twitter:description`,`twitter:image`,`twitter:image:alt`,`twitter:card`,`twitter:site`]}},En=Object.values(wn),Dn={accesskey:`accessKey`,charset:`charSet`,class:`className`,contenteditable:`contentEditable`,contextmenu:`contextMenu`,"http-equiv":`httpEquiv`,itemprop:`itemProp`,tabindex:`tabIndex`},On=Object.entries(Dn).reduce((e,[t,n])=>(e[n]=t,e),{}),kn=`data-rh`,An={DEFAULT_TITLE:`defaultTitle`,DEFER:`defer`,ENCODE_SPECIAL_CHARACTERS:`encodeSpecialCharacters`,ON_CHANGE_CLIENT_STATE:`onChangeClientState`,TITLE_TEMPLATE:`titleTemplate`,PRIORITIZE_SEO_TAGS:`prioritizeSeoTags`},jn=(e,t)=>{for(let n=e.length-1;n>=0;--n){let r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},Mn=e=>{let t=jn(e,`title`),n=jn(e,An.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join(``)),n&&t)return n.replace(/%s/g,()=>t);let r=jn(e,An.DEFAULT_TITLE);return t||r||void 0},Nn=e=>jn(e,An.ON_CHANGE_CLIENT_STATE)||(()=>{}),Pn=(e,t)=>t.filter(t=>t[e]!==void 0).map(t=>t[e]).reduce((e,t)=>({...e,...t}),{}),Fn=(e,t)=>t.filter(e=>e.base!==void 0).map(e=>e.base).reverse().reduce((t,n)=>{if(!t.length){let r=Object.keys(n);for(let i=0;i<r.length;i+=1){let a=r[i].toLowerCase();if(e.indexOf(a)!==-1&&n[a])return t.concat(n)}}return t},[]),In=e=>console&&typeof console.warn==`function`&&console.warn(e),Ln=(e,t,n)=>{let r={};return n.filter(t=>Array.isArray(t[e])?!0:(t[e]!==void 0&&In(`Helmet: ${e} should be of type "Array". Instead found type "${typeof t[e]}"`),!1)).map(t=>t[e]).reverse().reduce((e,n)=>{let i={};n.filter(e=>{let n,a=Object.keys(e);for(let r=0;r<a.length;r+=1){let i=a[r],o=i.toLowerCase();t.indexOf(o)!==-1&&(n!==`rel`||e[n].toLowerCase()!==`canonical`)&&(o!==`rel`||e[o].toLowerCase()!==`stylesheet`)&&(n=o),t.indexOf(i)!==-1&&(i===`innerHTML`||i===`cssText`||i===`itemprop`)&&(n=i)}if(!n||!e[n])return!1;let o=e[n].toLowerCase();return r[n]||(r[n]={}),i[n]||(i[n]={}),!r[n][o]&&(i[n][o]=!0,!0)}).reverse().forEach(t=>e.push(t));let a=Object.keys(i);for(let e=0;e<a.length;e+=1){let t=a[e],n={...r[t],...i[t]};r[t]=n}return e},[]).reverse()},Rn=(e,t)=>{if(Array.isArray(e)&&e.length){for(let n=0;n<e.length;n+=1)if(e[n][t])return!0}return!1},zn=e=>({baseTag:Fn([`href`],e),bodyAttributes:Pn(`bodyAttributes`,e),defer:jn(e,An.DEFER),encode:jn(e,An.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Pn(`htmlAttributes`,e),linkTags:Ln(`link`,[`rel`,`href`],e),metaTags:Ln(`meta`,[`name`,`charset`,`http-equiv`,`property`,`itemprop`],e),noscriptTags:Ln(`noscript`,[`innerHTML`],e),onChangeClientState:Nn(e),scriptTags:Ln(`script`,[`src`,`innerHTML`],e),styleTags:Ln(`style`,[`cssText`],e),title:Mn(e),titleAttributes:Pn(`titleAttributes`,e),prioritizeSeoTags:Rn(e,An.PRIORITIZE_SEO_TAGS)}),Bn=e=>Array.isArray(e)?e.join(``):e,Vn=(e,t)=>{let n=Object.keys(e);for(let r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1},Hn=(e,t)=>Array.isArray(e)?e.reduce((e,n)=>(Vn(n,t)?e.priority.push(n):e.default.push(n),e),{priority:[],default:[]}):{default:e,priority:[]},Un=(e,t)=>({...e,[t]:void 0}),Wn=[`noscript`,`script`,`style`],Gn=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`),Kn=e=>Object.keys(e).reduce((t,n)=>{let r=e[n]===void 0?`${n}`:`${n}="${e[n]}"`;return t?`${t} ${r}`:r},``),qn=(e,t,n,r)=>{let i=Kn(n),a=Bn(t);return i?`<${e} ${kn}="true" ${i}>${Gn(a,r)}</${e}>`:`<${e} ${kn}="true">${Gn(a,r)}</${e}>`},Jn=(e,t,n=!0)=>t.reduce((t,r)=>{let i=r,a=Object.keys(i).filter(e=>e!==`innerHTML`&&e!==`cssText`).reduce((e,t)=>{let r=i[t]===void 0?t:`${t}="${Gn(i[t],n)}"`;return e?`${e} ${r}`:r},``),o=i.innerHTML||i.cssText||``;return`${t}<${e} ${kn}="true" ${a}${Wn.indexOf(e)===-1?`/>`:`>${o}</${e}>`}`},``),Yn=(e,t={})=>Object.keys(e).reduce((t,n)=>{let r=Dn[n];return t[r||n]=e[n],t},t),Xn=(e,t,n)=>{let r=Yn(n,{key:t,[kn]:!0});return[J.createElement(`title`,r,t)]},Zn=(e,t)=>t.map((t,n)=>{let r={key:n,[kn]:!0};return Object.keys(t).forEach(e=>{let n=Dn[e]||e;if(n===`innerHTML`||n===`cssText`){let e=t.innerHTML||t.cssText;r.dangerouslySetInnerHTML={__html:e}}else r[n]=t[e]}),J.createElement(e,r)}),Qn=(e,t,n=!0)=>{switch(e){case`title`:return{toComponent:()=>Xn(e,t.title,t.titleAttributes),toString:()=>qn(e,t.title,t.titleAttributes,n)};case`bodyAttributes`:case`htmlAttributes`:return{toComponent:()=>Yn(t),toString:()=>Kn(t)};default:return{toComponent:()=>Zn(e,t),toString:()=>Jn(e,t,n)}}},$n=({metaTags:e,linkTags:t,scriptTags:n,encode:r})=>{let i=Hn(e,Tn.meta),a=Hn(t,Tn.link),o=Hn(n,Tn.script);return{priorityMethods:{toComponent:()=>[...Zn(`meta`,i.priority),...Zn(`link`,a.priority),...Zn(`script`,o.priority)],toString:()=>`${Qn(`meta`,i.priority,r)} ${Qn(`link`,a.priority,r)} ${Qn(`script`,o.priority,r)}`},metaTags:i.default,linkTags:a.default,scriptTags:o.default}},er=e=>{let{baseTag:t,bodyAttributes:n,encode:r=!0,htmlAttributes:i,noscriptTags:a,styleTags:o,title:s=``,titleAttributes:c,prioritizeSeoTags:l}=e,{linkTags:u,metaTags:d,scriptTags:f}=e,p={toComponent:()=>[],toString:()=>``};return l&&({priorityMethods:p,linkTags:u,metaTags:d,scriptTags:f}=$n(e)),{priority:p,base:Qn(`base`,t,r),bodyAttributes:Qn(`bodyAttributes`,n,r),htmlAttributes:Qn(`htmlAttributes`,i,r),link:Qn(`link`,u,r),meta:Qn(`meta`,d,r),noscript:Qn(`noscript`,a,r),script:Qn(`script`,f,r),style:Qn(`style`,o,r),title:Qn(`title`,{title:s,titleAttributes:c},r)}},tr=[],nr=!!(typeof window<`u`&&window.document&&window.document.createElement),rr=class{instances=[];canUseDOM=nr;context;value={setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?tr:this.instances,add:e=>{(this.canUseDOM?tr:this.instances).push(e)},remove:e=>{let t=(this.canUseDOM?tr:this.instances).indexOf(e);(this.canUseDOM?tr:this.instances).splice(t,1)}}};constructor(e,t){this.context=e,this.canUseDOM=t||!1,t||(e.helmet=er({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:``,titleAttributes:{}}))}},ir=parseInt(`19.3.0`.split(`.`)[0],10)>=19,ar=J.createContext({}),or=class e extends J.Component{static canUseDOM=nr;helmetData;constructor(t){super(t),this.helmetData=ir?null:new rr(this.props.context||{},e.canUseDOM)}render(){return ir?J.createElement(J.Fragment,null,this.props.children):J.createElement(ar.Provider,{value:this.helmetData.value},this.props.children)}},sr=(e,t)=>{let n=document.head||document.querySelector(`head`),r=n.querySelectorAll(`${e}[${kn}]`),i=[].slice.call(r),a=[],o;return t&&t.length&&t.forEach(t=>{let n=document.createElement(e);for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(e===`innerHTML`)n.innerHTML=t.innerHTML;else if(e===`cssText`){let e=t.cssText;n.appendChild(document.createTextNode(e))}else{let r=e,i=t[r]===void 0?``:t[r];n.setAttribute(e,i)}}n.setAttribute(kn,`true`),i.some((e,t)=>(o=t,n.isEqualNode(e)))?i.splice(o,1):a.push(n)}),i.forEach(e=>e.parentNode?.removeChild(e)),a.forEach(e=>n.appendChild(e)),{oldTags:i,newTags:a}},cr=(e,t)=>{let n=document.getElementsByTagName(e)[0];if(!n)return;let r=n.getAttribute(kn),i=r?r.split(`,`):[],a=[...i],o=Object.keys(t);for(let e of o){let r=t[e]||``;n.getAttribute(e)!==r&&n.setAttribute(e,r),i.indexOf(e)===-1&&i.push(e);let o=a.indexOf(e);o!==-1&&a.splice(o,1)}for(let e=a.length-1;e>=0;--e)n.removeAttribute(a[e]);i.length===a.length?n.removeAttribute(kn):n.getAttribute(kn)!==o.join(`,`)&&n.setAttribute(kn,o.join(`,`))},lr=(e,t)=>{e!==void 0&&document.title!==e&&(document.title=Bn(e)),cr(`title`,t)},ur=(e,t)=>{let{baseTag:n,bodyAttributes:r,htmlAttributes:i,linkTags:a,metaTags:o,noscriptTags:s,onChangeClientState:c,scriptTags:l,styleTags:u,title:d,titleAttributes:f}=e;cr(`body`,r),cr(`html`,i),lr(d,f);let p={baseTag:sr(`base`,n),linkTags:sr(`link`,a),metaTags:sr(`meta`,o),noscriptTags:sr(`noscript`,s),scriptTags:sr(`script`,l),styleTags:sr(`style`,u)},m={},h={};Object.keys(p).forEach(e=>{let{newTags:t,oldTags:n}=p[e];t.length&&(m[e]=t),n.length&&(h[e]=p[e].oldTags)}),t&&t(),c(e,m,h)},dr=null,fr=e=>{dr&&cancelAnimationFrame(dr),e.defer?dr=requestAnimationFrame(()=>{ur(e,()=>{dr=null})}):(ur(e),dr=null)},pr=class extends J.Component{rendered=!1;shouldComponentUpdate(e){return!(0,Cn.default)(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){let{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){let{helmetInstances:e,setHelmet:t}=this.props.context,n=null,r=zn(e.get().map(e=>{let{context:t,...n}=e.props;return n}));or.canUseDOM?fr(r):er&&(n=er(r)),t(n)}init(){if(this.rendered)return;this.rendered=!0;let{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},mr=[],hr=e=>{let t={};for(let n of Object.keys(e))t[On[n]||n]=e[n];return t},gr=e=>{let t={};for(let n of Object.keys(e)){let r=Dn[n];t[r||n]=e[n]}return t},_r=(e,t)=>{if(!nr)return;let n=document.getElementsByTagName(e)[0];if(!n)return;let r=`data-rh-managed`,i=n.getAttribute(r),a=i?i.split(`,`):[],o=Object.keys(t);for(let e of a)o.includes(e)||n.removeAttribute(e);for(let e of o){let r=t[e];r==null||r===!1?n.removeAttribute(e):r===!0?n.setAttribute(e,``):n.setAttribute(e,String(r))}o.length>0?n.setAttribute(r,o.join(`,`)):n.removeAttribute(r)},vr=()=>{let e={},t={};for(let n of mr){let{htmlAttributes:r,bodyAttributes:i}=n.props;r&&Object.assign(e,hr(r)),i&&Object.assign(t,hr(i))}_r(`html`,e),_r(`body`,t)},yr=class extends J.Component{componentDidMount(){mr.push(this),vr()}componentDidUpdate(){vr()}componentWillUnmount(){let e=mr.indexOf(this);e!==-1&&mr.splice(e,1),vr()}resolveTitle(){let{title:e,titleTemplate:t,defaultTitle:n}=this.props;return e&&t?t.replace(/%s/g,()=>Array.isArray(e)?e.join(``):e):e||n||void 0}renderTitle(){let e=this.resolveTitle();if(e===void 0)return null;let t=this.props.titleAttributes||{};return J.createElement(`title`,gr(t),e)}renderBase(){let{base:e}=this.props;return e?J.createElement(`base`,gr(e)):null}renderMeta(){let{meta:e}=this.props;return!e||!Array.isArray(e)?null:e.map((e,t)=>J.createElement(`meta`,{key:t,...gr(e)}))}renderLink(){let{link:e}=this.props;return!e||!Array.isArray(e)?null:e.map((e,t)=>J.createElement(`link`,{key:t,...gr(e)}))}renderScript(){let{script:e}=this.props;return!e||!Array.isArray(e)?null:e.map((e,t)=>{let{innerHTML:n,...r}=e,i=gr(r);return n&&(i.dangerouslySetInnerHTML={__html:n}),J.createElement(`script`,{key:t,...i})})}renderStyle(){let{style:e}=this.props;return!e||!Array.isArray(e)?null:e.map((e,t)=>{let{cssText:n,...r}=e,i=gr(r);return n&&(i.dangerouslySetInnerHTML={__html:n}),J.createElement(`style`,{key:t,...i})})}renderNoscript(){let{noscript:e}=this.props;return!e||!Array.isArray(e)?null:e.map((e,t)=>{let{innerHTML:n,...r}=e,i=gr(r);return n&&(i.dangerouslySetInnerHTML={__html:n}),J.createElement(`noscript`,{key:t,...i})})}render(){return J.createElement(J.Fragment,null,this.renderTitle(),this.renderBase(),this.renderMeta(),this.renderLink(),this.renderScript(),this.renderStyle(),this.renderNoscript())}},br=class extends J.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(e){return!(0,xn.default)(Un(this.props,`helmetData`),Un(e,`helmetData`))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case`script`:case`noscript`:return{innerHTML:t};case`style`:return{cssText:t};default:throw Error(`<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(e,t,n,r){return{...t,[e.type]:[...t[e.type]||[],{...n,...this.mapNestedChildrenToProps(e,r)}]}}mapObjectTypeChildren(e,t,n,r){switch(e.type){case`title`:return{...t,[e.type]:r,titleAttributes:{...n}};case`body`:return{...t,bodyAttributes:{...n}};case`html`:return{...t,htmlAttributes:{...n}};default:return{...t,[e.type]:{...n}}}}mapArrayTypeChildrenToProps(e,t){let n={...t};return Object.keys(e).forEach(t=>{n={...n,[t]:e[t]}}),n}warnOnInvalidChildren(e,t){return(0,Sn.default)(En.some(t=>e.type===t),typeof e.type==`function`?`You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.`:`Only elements types ${En.join(`, `)} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),(0,Sn.default)(!t||typeof t==`string`||Array.isArray(t)&&!t.some(e=>typeof e!=`string`),`Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`}</${e.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(e,t){let n={};return J.Children.forEach(e,e=>{if(!e||!e.props)return;let{children:r,...i}=e.props,a=Object.keys(i).reduce((e,t)=>(e[On[t]||t]=i[t],e),{}),{type:o}=e;switch(typeof o==`symbol`?o=o.toString():this.warnOnInvalidChildren(e,r),o){case`Symbol(react.fragment)`:t=this.mapChildrenToProps(r,t);break;case`link`:case`meta`:case`noscript`:case`script`:case`style`:n=this.flattenArrayTypeChildren(e,n,a,r);break;default:t=this.mapObjectTypeChildren(e,t,a,r)}}),this.mapArrayTypeChildrenToProps(n,t)}render(){let{children:e,...t}=this.props,n={...t},{helmetData:r}=t;return e&&(n=this.mapChildrenToProps(e,n)),r&&!(r instanceof rr)&&(r=new rr(r.context,!0),delete n.helmetData),ir?J.createElement(yr,{...n}):r?J.createElement(pr,{...n,context:r.value}):J.createElement(ar.Consumer,null,e=>J.createElement(pr,{...n,context:e}))}},xr=e=>{throw TypeError(e)},Sr=(e,t,n)=>t.has(e)||xr(`Cannot `+n),Cr=(e,t,n)=>(Sr(e,t,`read from private field`),n?n.call(e):t.get(e)),wr=(e,t,n)=>t.has(e)?xr(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Tr=(e,t,n,r)=>(Sr(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),Er=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Dr=/^[\\/]{2}/;function Or(e,t){return t+e.replace(/\\/g,`/`)}var kr=`popstate`;function Ar(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function jr(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Ir(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Lr(t)}return zr(t,n,null,e)}function Mr(e,t){if(e===!1||e==null)throw Error(t)}function Nr(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Pr(){return Math.random().toString(36).substring(2,10)}function Fr(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ir(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Rr(t):t,state:n,key:t&&t.key||r||Pr(),mask:i}}function Lr({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Rr(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function zr(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Ar(e)?e:Ir(h.location,e,t);n&&n(r,e),l=u()+1;let d=Fr(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Ar(e)?e:Ir(h.location,e,t);n&&n(r,e),l=u();let i=Fr(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Br(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(kr,d),c=e,()=>{i.removeEventListener(kr,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Br(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),Mr(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Lr(t);return i=i.replace(/ $/,`%20`),!n&&Dr.test(i)&&(i=r+i),new URL(i,r)}var Vr,Hr=class{constructor(e){if(wr(this,Vr,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Cr(this,Vr).has(e))return Cr(this,Vr).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){Cr(this,Vr).set(e,t)}};Vr=new WeakMap;var Ur=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function Wr(e){return Ur.has(e)}var Gr=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function Kr(e){return Gr.has(e)}function qr(e){return e.index===!0}function Jr(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Mr(e.index!==!0||!e.children,`Cannot specify children on an index route`),Mr(i||!r[s],`Found a route id collision on id "${s}".  Route id's must be globally unique within Data Router usages`),qr(e)){let n={...e,id:s};return r[s]=Yr(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=Yr(n,t(n)),e.children&&(n.children=Jr(e.children,t,o,r,i)),n}})}function Yr(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function Xr(e,t,n=`/`){return Zr(e,t,n,!1)}function Zr(e,t,n,r,i){let a=_i((typeof t==`string`?Rr(t):t).pathname||`/`,n);if(a==null)return null;let o=i??$r(e),s=null,c=gi(a);for(let e=0;s==null&&e<o.length;++e)s=fi(o[e],c,r);return s}function Qr(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function $r(e){let t=ei(e);return ni(t),t}function ei(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Mr(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Di([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Mr(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ei(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:ui(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=hi(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ti(e.path))a(e,t,!0,n)}),t}function ti(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ti(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ni(e){e.sort((e,t)=>e.score===t.score?di(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ri=/^:[\w-]+$/,ii=3,ai=2,oi=1,si=10,ci=-2,li=e=>e===`*`;function ui(e,t){let n=e.split(`/`),r=n.length;return n.some(li)&&(r+=ci),t&&(r+=ai),n.filter(e=>!li(e)).reduce((e,t)=>e+(ri.test(t)?ii:t===``?oi:si),r)}function di(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function fi(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?mi(u,l,s.matcher,s.compiledParams):pi(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=pi({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Di([a,d.pathname]),pathnameBase:ki(Di([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=Di([a,d.pathnameBase]))}return o}function pi(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=hi(e.path,e.caseSensitive,e.end);return mi(e,t,n,r)}function mi(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=Oi(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=Oi(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function hi(e,t=!1,n=!0){Nr(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function gi(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Nr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function _i(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function vi({basename:e,pathname:t}){return t===`/`?e:Di([e,t])}var yi=e=>Er.test(e);function bi(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Rr(e):e,a;return n?(n=Ei(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?xi(n.substring(1),`/`):xi(n,t)):a=t,{pathname:a,search:Ai(r),hash:ji(i)}}function xi(e,t){let n=Oi(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Si(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}].  Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ci(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function wi(e){let t=Ci(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ti(e,t,n,r=!1){let i;typeof e==`string`?i=Rr(e):(i={...e},Mr(!i.pathname||!i.pathname.includes(`?`),Si(`?`,`pathname`,`search`,i)),Mr(!i.pathname||!i.pathname.includes(`#`),Si(`#`,`pathname`,`hash`,i)),Mr(!i.search||!i.search.includes(`#`),Si(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=bi(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ei=e=>e.replace(/[\\/]{2,}/g,`/`),Di=e=>Ei(e.join(`/`));function Oi(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var ki=e=>Oi(e).replace(/^\/*/,`/`),Ai=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ji=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Mi=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Ni=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Pi(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Fi(e){return Di(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ii=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Li(e,t){let n=e;if(typeof n!=`string`||!Er.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ii)try{let e=new URL(window.location.href),r=Dr.test(n)?new URL(Or(n,e.protocol)):new URL(n),a=_i(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Nr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var Ri=Symbol(`Uninstrumented`);function zi(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=Vi(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=Vi(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[Ri]??i,a=Vi(n[e],t,(...e)=>Ui(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[Ri]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[Ri]??e,r=Vi(n.middleware,t,(...e)=>Ui(e[0]));return r?(r[Ri]=t,r):e})),r}function Bi(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[Ri]??e.navigate,r=Vi(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?Lr(n):`.`,...Wi(e,r??{})}});r&&(r[Ri]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[Ri]??e.fetch,r=Vi(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...Wi(e,i??{})}});r&&(r[Ri]=t,e.fetch=r)}return e}function Vi(e,t,n){return e.length===0?null:async(...r)=>{let i=await Hi(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function Hi(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=Hi(e,t,n,r-1),a=await o,Mr(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function Ui(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:Gi(t),params:{...r},pattern:i,context:Ki(n)}}function Wi(e,t){return{currentUrl:Lr(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Gi(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Ki(e){if(Ji(e)){let t={...e};return Object.freeze(t),t}return{get:t=>e.get(t)}}var qi=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Ji(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===qi}var Yi=new URL(`http://localhost`);function Xi(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Yi)}catch{return Yi}}function Zi(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Qi(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function $i(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Zi(i,n),s=!Zi(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Qi(e,i)||!Zi(i,a)))throw Error(`External navigation is not allowed`)}var ea=[`POST`,`PUT`,`PATCH`,`DELETE`],ta=new Set(ea),na=[`GET`,...ea],ra=new Set(na),ia=new Set([301,302,303,307,308]),aa=new Set([307,308]),oa={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},sa={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ca={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},la=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ua=`remix-router-transitions`,da=Symbol(`ResetLoaderData`),fa,pa,ma,ha,ga=class{constructor(e){wr(this,fa),wr(this,pa),wr(this,ma),wr(this,ha),Tr(this,fa,e),Tr(this,pa,$r(e))}get stableRoutes(){return Cr(this,fa)}get activeRoutes(){return Cr(this,ma)??Cr(this,fa)}get branches(){return Cr(this,ha)??Cr(this,pa)}get hasHMRRoutes(){return Cr(this,ma)!=null}setRoutes(e){Tr(this,fa,e),Tr(this,pa,$r(e))}setHmrRoutes(e){Tr(this,ma,e),Tr(this,ha,$r(e))}commitHmrRoutes(){Cr(this,ma)&&(Tr(this,fa,Cr(this,ma)),Tr(this,pa,Cr(this,ha)),Tr(this,ma,void 0),Tr(this,ha,void 0))}};fa=new WeakMap,pa=new WeakMap,ma=new WeakMap,ha=new WeakMap;function _a(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Mr(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||la,a=i;if(e.instrumentations){let t=e.instrumentations;a=e=>({...i(e),...zi(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new ga(Jr(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||Pa,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=Zr(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=ao(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=io(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&Re(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=Re(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>Sa(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=Ca(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:oa,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,P=new Set,F=new Map,I=0,L=-1,R=new Map,z=new Set,ee=new Map,B=new Map,V=new Set,te=new Map,ne,re=null;function ie(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(ne){ne(),ne=void 0;return}Nr(te.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs.  This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Me({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ne=e});e.history.go(r*-1),je(i,{state:`blocked`,location:n,proceed(){je(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,ca),H({blockers:e})}}),E?.resolve(),E=null;return}return le(t,n)}),n){Ao(t,A);let e=()=>jo(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||le(`POP`,w.location,{initialHydration:!0}),C}function ae(){d&&d(),j&&j(),f.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>we(w.fetchers,t)),w.blockers.forEach((e,t)=>Ae(t))}function oe(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function H(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(V.has(t)?n.push(t):r.push(t))}),V.forEach(e=>{!w.fetchers.has(e)&&!F.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>we(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function se(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&xo(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?to(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&(c=new Map(c),c.forEach((e,t)=>c.set(t,ca)));let l=!M&&Le(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&xo(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}H({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:oa,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,re?.resolve(),re=null}async function ce(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=Mo();let n=E.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=ba(!1,ya(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),o;if(n?.mask){let t=typeof n.mask==`string`?Rr(n.mask):{...w.location.mask,...n.mask};if(o={pathname:t.pathname??``,search:t.search??``,hash:t.hash??``},Dr.test(o.pathname))throw Error(`External navigation is not allowed`);o.pathname.startsWith(`\\`)&&(o.pathname=o.pathname.replace(/^\\+/,`/`)),$i(typeof n.mask==`string`?n.mask:Lr(n.mask),Lr(o),e.history.createURL(`/`),`reject`)}let s=w.location,l=Ir(s,r,n&&n.state,void 0,o);l={...l,...e.history.encodeLocation(l)},$i(t==null?e.history.createHref(w.location):typeof t==`string`?t:Lr(t),e.history.createHref(l.mask||l),e.history.createURL(`/`),`reject`);let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&xo(i.formMethod)&&i.formAction===w.location.pathname+w.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Me({currentLocation:s,nextLocation:l,historyAction:d});if(m){je(m,{state:`blocked`,location:l,proceed(){je(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),ce(t,n)},reset(){let e=new Map(w.blockers);e.set(m,ca),H({blockers:e})}});return}await le(d,l,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate})}function U(){re||=Mo(),ye(),H({revalidation:`loading`});let e=re.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(le(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(le(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function le(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Ie(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:Zr(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!N&&co(w.location,n)&&!(r&&r.submission&&xo(r.submission.formMethod))){se(n,{matches:a},{flushSync:o});return}let l=Re(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),!a){let{error:e,notFoundMatches:t,route:r}=Ne(n.pathname);se(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;O=new AbortController;let d=Ya(e.history,n,O.signal,r&&r.submission),f=e.getContext?await e.getContext():new Hr,p;if(r&&r.pendingError)p=[ro(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&xo(r.submission.formMethod)){let i=await W(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(mo(t)&&Pi(t.error)&&t.error.status===404){O=null,se(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=To(n,a,t,r.submission),o=!1,l.active=!1,d=Ya(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await ue(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(O=null,se(n,{matches:h||a,...no(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function W(t,n,i,l,u,d,f,p,m={}){if(ye(),H({navigation:Eo(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await ze(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=io(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=ro(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ne(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=Co(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:ao(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await _e(t,n,Ba(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(ho(h)){let n;return n=m&&m.replace!=null?m.replace:Ja(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await ge(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(mo(h)){let e=ro(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function ue(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||To(n,i,l,p),x=p||m||wo(b),S=!M&&!g;if(d){if(S){let e=de(v);H({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await ze(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=io(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=ro(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ne(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=xa(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,P,V,ee,z,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(L=++I,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=Oe(e);return se(n,{matches:i,loaderData:{},errors:v&&mo(v[1])?{[v[0]]:v[1].error}:null,...no(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=de(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=fe(E)),H(e,{flushSync:_})}E.forEach(e=>{Ee(e.key),e.controller&&F.set(e.key,e.controller)});let D=()=>E.forEach(e=>Ee(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await ve(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>F.delete(e.key));let j=oo(k);if(j)return await ge(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=oo(A),j)return z.add(j.key),await ge(t,j.result,!0,{replace:h}),{shortCircuited:!0};let R=new Map(w.fetchers),{loaderData:B,errors:te}=eo(w,i,k,v,E,A,R);g&&w.errors&&(te={...w.errors,...te});let ne=Oe(R),re=ke(L,R),ie=ne||re||E.length>0;return{matches:i,loaderData:B,errors:te,...ie?{workingFetchers:R}:{}}}function de(e){if(e&&!mo(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function fe(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=Do(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function pe(t,n,r,i){Ee(t);let a=(i&&i.flushSync)===!0,o=s.activeRoutes,l=ya(w.location,w.matches,c,r,n,i?.relative),u=Zr(o,l,c,!1,s.branches),d=Re(u,o,l);if(d.active&&d.matches&&(u=d.matches),!u){xe(t,n,ao(404,{pathname:l}),{flushSync:a});return}let{path:f,submission:p,error:m}=ba(!0,l,i);if(m){xe(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new Hr,g=(i&&i.preventScrollReset)===!0;if(p&&xo(p.formMethod)){await me(t,n,f,u,h,d.active,a,g,p,i&&i.defaultShouldRevalidate);return}ee.set(t,{routeId:n,path:f}),await he(t,n,f,u,h,d.active,a,g,p)}async function me(t,n,i,l,u,d,f,p,m,h){ye(),ee.delete(t),be(t,Oo(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=Ya(e.history,i,g.signal,m);if(d){let e=await ze(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:f});return}if(e.matches)l=e.matches;else{xe(t,n,ao(404,{pathname:i}),{flushSync:f});return}}let v=Co(l,i);if(!v.route.action&&!v.route.lazy){xe(t,n,ao(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}F.set(t,g);let y=I,b=Ba(a,o,_,i,l,v,r,u),x=await _e(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){F.get(t)===g&&F.delete(t);return}if(V.has(t)){if(ho(S)||mo(S)){be(t,ko(void 0));return}}else{if(ho(S)){if(F.delete(t),L>y){be(t,ko(void 0));return}return z.add(t),be(t,Do(m)),ge(_,S,!1,{fetcherSubmission:m,preventScrollReset:p})}if(mo(S)){xe(t,n,S.error);return}}let C=w.navigation.location||w.location,E=Ya(e.history,C,g.signal),D=s.activeRoutes,k=w.navigation.state===`idle`?w.matches:Zr(D,w.navigation.location,c,!1,s.branches);Mr(k,`Didn't find any matches after fetcher action`);let A=++I;R.set(t,A);let{dsMatches:j,revalidatingFetchers:M}=xa(E,u,a,o,e.history,w,k,m,C,r,!1,N,P,V,ee,z,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),B=Do(m,S.data),te=new Map(w.fetchers);te.set(t,B),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=te.get(t),r=Do(void 0,n?n.data:void 0);te.set(t,r),Ee(t),e.controller&&F.set(t,e.controller)}),H({fetchers:te});let ne=()=>M.forEach(e=>Ee(e.key));g.signal.addEventListener(`abort`,ne);let{loaderResults:re,fetcherResults:ie}=await ve(j,M,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,ne),R.delete(t),F.delete(t),M.forEach(e=>F.delete(e.key));let ae=w.fetchers.has(t),oe=e=>{if(!ae)return e;let n=new Map(e.fetchers);return n.set(t,ko(S.data)),{...e,fetchers:n}},ce=oo(re);if(ce)return w=oe(w),ge(E,ce.result,!1,{preventScrollReset:p});if(ce=oo(ie),ce)return z.add(ce.key),w=oe(w),ge(E,ce.result,!1,{preventScrollReset:p});let U=new Map(w.fetchers);ae&&U.set(t,ko(S.data));let{loaderData:le,errors:W}=eo(w,k,re,void 0,M,ie,U);ke(A,U),w.navigation.state===`loading`&&A>L?(Mr(T,`Expected pending action`),O&&O.abort(),se(w.navigation.location,{matches:k,loaderData:le,errors:W,fetchers:U})):(H({errors:W,loaderData:to(w.loaderData,le,k,W),fetchers:U}),N=!1)}async function he(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);be(t,Do(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Ya(e.history,i,m.signal);if(l){let e=await ze(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:u});return}if(e.matches)s=e.matches;else{xe(t,n,ao(404,{pathname:i}),{flushSync:u});return}}let g=Co(s,i);F.set(t,m);let _=I,v=await _e(h,i,Ba(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(F.get(t)===m&&F.delete(t),!h.signal.aborted){if(V.has(t)){be(t,ko(void 0));return}if(ho(y)){if(L>_){be(t,ko(void 0));return}z.add(t),await ge(h,y,!1,{preventScrollReset:d});return}if(mo(y)){xe(t,n,y.error);return}be(t,ko(y.data))}}async function ge(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);Mr(d,`Expected a Location header on the redirect Response`);let f=d,p=new URL(r.url);d=Ja(d,p,c,e.history),$i(f,d,p,`allow-explicit`);let m=Ir(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(yi(d)){let n=Br(t,d,!0);e=n.origin!==t.location.origin||_i(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let h=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:g,formAction:_,formEncType:v}=w.navigation;!o&&!s&&g&&_&&v&&(o=wo(w.navigation));let y=o||s;aa.has(i.response.status)&&y&&xo(y.formMethod)?await le(h,m,{submission:{...y,formAction:d},preventScrollReset:l||D,enableViewTransition:a?k:void 0}):await le(h,m,{overrideNavigation:To(m,[],h,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?k:void 0})}async function _e(e,t,n,r,i){let a,o={};try{a=await Va(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!xo(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(po(r)){let i=r.result;o[t]={type:`redirect`,response:Ga(i,e,t,n,c)}}else o[t]=await Wa(r);return o}async function ve(e,t,n,r,i){let a=_e(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await _e(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:ao(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function ye(){N=!0,ee.forEach((e,t)=>{F.has(t)&&P.add(t),Ee(t)})}function be(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),H({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function xe(e,t,n,r={}){let i=ro(w.matches,t),a=new Map(w.fetchers);we(a,e),H({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Se(e){return B.set(e,(B.get(e)||0)+1),V.has(e)&&V.delete(e),w.fetchers.get(e)||sa}function Ce(e,t){Ee(e,t?.reason),be(e,ko(null))}function we(e,t){let n=w.fetchers.get(t);F.has(t)&&!(n&&n.state===`loading`&&R.has(t))&&Ee(t),ee.delete(t),R.delete(t),z.delete(t),V.delete(t),P.delete(t),e.delete(t)}function Te(e){let t=(B.get(e)||0)-1;t<=0?(B.delete(e),V.add(e)):B.set(e,t),H({fetchers:new Map(w.fetchers)})}function Ee(e,t){let n=F.get(e);n&&(n.abort(t),F.delete(e))}function De(e,t){for(let n of e){let e=t.get(n);Mr(e,`Expected fetcher: ${n}`);let r=ko(e.data);t.set(n,r)}}function Oe(e){let t=[],n=!1;for(let r of z){let i=e.get(r);Mr(i,`Expected fetcher: ${r}`),i.state===`loading`&&(z.delete(r),t.push(r),n=!0)}return De(t,e),n}function ke(e,t){let n=[];for(let[r,i]of R)if(i<e){let e=t.get(r);Mr(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Ee(r),R.delete(r),n.push(r))}return De(n,t),n.length>0}function G(e,t){let n=w.blockers.get(e)||ca;return te.get(e)!==t&&te.set(e,t),n}function Ae(e){w.blockers.delete(e),te.delete(e)}function je(e,t){let n=w.blockers.get(e)||ca;Mr(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),H({blockers:r})}function Me({currentLocation:e,nextLocation:t,historyAction:n}){if(te.size===0)return;te.size>1&&Nr(!1,`A router only supports one blocker at a time`);let r=Array.from(te.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ne(e){let t=ao(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=io(n);return{notFoundMatches:r,route:i,error:t}}function Pe(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===oa){_=!0;let e=Le(w.location,w.matches);e!=null&&H({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Fe(e,t){return h&&h(e,t.map(e=>Qr(e,w.loaderData)))||e.key}function Ie(e,t){if(m&&g){let n=Fe(e,t);m[n]=g()}}function Le(e,t){if(m){let n=Fe(e,t),r=m[n];if(typeof r==`number`)return r}return null}function Re(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:Zr(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:Zr(n,r,c,!0,e)}}return{active:!1,matches:null}}async function ze(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||Da(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=Zr(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=Zr(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Be(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=Zr(s.activeRoutes,n,c,!0,u),!f||Be(l,f))return{type:`success`,matches:null};l=f}}function Be(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function Ve(e){o={},s.setHmrRoutes(Jr(e,a,void 0,o))}function He(e,t,n=!1){Da(e,t,s,o,a,n),s.hasHMRRoutes||H({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:ie,subscribe:oe,enableScrollRestoration:Pe,navigate:ce,fetch:pe,revalidate:U,createHref:t=>e.history.createHref(t),createURL:t=>e.history.createURL(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Se,resetFetcher:Ce,deleteFetcher:Te,dispose:ae,getBlocker:G,deleteBlocker:Ae,patchRoutes:He,_internalFetchControllers:F,_internalSetRoutes:Ve,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){H(e)}},e.instrumentations&&(C=Bi(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function va(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function ya(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=Ti(r||`.`,wi(o),_i(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=So(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=vi({basename:n,pathname:c.pathname})),Lr(c)}function ba(e,t,n){if(!n||!va(n))return{path:t};if(n.formMethod&&!bo(n.formMethod))return{path:t,error:ao(405,{method:n.formMethod})};let r=()=>({path:t,error:ao(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=so(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!xo(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!xo(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}Mr(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=Za(n.formData),s=n.formData;else if(n.body instanceof FormData)o=Za(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Qa(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Qa(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(xo(c.formMethod))return{path:t,submission:c};let l=Rr(t);return e&&l.search&&So(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:Lr(l),submission:c}}function xa(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?mo(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&mo(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=Fi(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!Sa(s))f=!1;else if(u){let{shouldLoad:e}=Ca(s,a.loaderData,a.errors);f=e}else wa(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return za(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?Ta(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p},h=Ea(i,m);return za(n,r,e,c,k,i,l,t,h,m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=Zr(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=Co(b,e.path),C=new AbortController,w=Ya(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=Ba(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=Ba(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:!D&&d;let a={...O,defaultShouldRevalidate:i};Ea(S,a)&&(T=Ba(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function Sa(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Ca(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Sa(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function wa(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Ta(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function Ea(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function Da(e,t,n,r,i,a){let o;if(e){let t=r[e];Mr(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>Oa(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=Jr(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=Jr([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function Oa(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>Oa(e,t)))??!1}var ka=new WeakMap,Aa=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(Mr(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=ka.get(i);o||(o={},ka.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=Wr(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)Nr(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)Nr(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},ja=new WeakMap;function Ma(e,t,n,r,i){let a=n[e.id];if(Mr(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=ja.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{Mr(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=Kr(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?Nr(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?Nr(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return ja.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=Aa({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function Na(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function Pa(e){return e.matches.some(e=>e.route.middleware)?Fa(e,()=>Na(e)):Na(e)}function Fa(e,t){return Ia(e,t,e=>{if(yo(e))throw e;return e},uo,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=ro(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function Ia(e,t,n,r,i){let{matches:a,...o}=e;return await La(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function La(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await La(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Ra(e,t,n,r,i){let a=Aa({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Ma(r.route,xo(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function za(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Ra(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?Ea(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?Ea(a,{...l,defaultShouldRevalidate:e}):Ea(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!xo(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(xo(n.method)||!p)?Ha({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function Ba(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?za(e,t,n,r,Fi(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Ra(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Va(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:Xa(t,n),pattern:Fi(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response.  You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return Fa(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function Ha({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=xo(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:Xa(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw ao(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw ao(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Ua(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Wa(e){let{result:t,type:n}=e;if(_o(t)){let e;try{e=await Ua(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Ni(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?go(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:lo(t),statusCode:Pi(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Pi(t)?t.status:void 0}:go(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function Ga(e,t,n,r,i){let a=e.headers.get(`Location`);if(Mr(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!yi(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=ya(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Ka=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function qa(e){try{return Ka.includes(new URL(e).protocol)}catch{return!1}}function Ja(e,t,n,r){if(yi(e)){let r=e,i=Dr.test(r)?new URL(Or(r,t.protocol)):new URL(r);if(qa(i.toString()))throw Error(`Invalid redirect location`);let a=_i(i.pathname,n)!=null;if(i.origin===t.origin&&a)return Ei(i.pathname)+i.search+i.hash}try{if(qa(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Ya(e,t,n,r){let i=e.createURL(so(t)).toString(),a={signal:n};if(r&&xo(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?Za(r.formData):r.formData}return new Request(i,a)}function Xa(e,t){let n=new URL(e.url),r=typeof t==`string`?Rr(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function Za(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Qa(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function $a(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&mo(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(Mr(!ho(f),`Cannot handle redirect results in processLoaderData`),mo(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=ro(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=da),c||(c=!0,s=Pi(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function eo(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=$a(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(Mr(s,`Did not find corresponding fetcher result`),mo(s)){let t=ro(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(ho(s))Mr(!1,`Unhandled fetcher revalidation redirect`);else{let e=ko(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function to(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==da).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function no(e){return e?mo(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ro(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function io(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function ao(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Ni(e||500,o,Error(s),!0)}function oo(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(ho(r))return{key:n,result:r}}}function so(e){return Lr({...typeof e==`string`?Rr(e):e,hash:``})}function co(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function lo(e){return new Ni(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function uo(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&fo(t))}function fo(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function po(e){return _o(e.result)&&ia.has(e.result.status)}function mo(e){return e.type===`error`}function ho(e){return(e&&e.type)===`redirect`}function go(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function _o(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function vo(e){return ia.has(e)}function yo(e){return _o(e)&&vo(e.status)&&e.headers.has(`Location`)}function bo(e){return ra.has(e.toUpperCase())}function xo(e){return ta.has(e.toUpperCase())}function So(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function Co(e,t){let n=typeof t==`string`?Rr(t).search:t.search;if(e[e.length-1].route.index&&So(n||``))return e[e.length-1];let r=Ci(e);return r[r.length-1]}function wo(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function To(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Eo(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function Do(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Oo(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ko(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Ao(e,t){try{let n=e.sessionStorage.getItem(ua);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function jo(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(ua,JSON.stringify(n))}catch(e){Nr(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Mo(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var No=J.createContext(null);No.displayName=`DataRouter`;var Po=J.createContext(null);Po.displayName=`DataRouterState`;var Fo=J.createContext(!1);function Io(){return J.useContext(Fo)}var Lo=J.createContext({isTransitioning:!1});Lo.displayName=`ViewTransition`;var Ro=J.createContext(new Map);Ro.displayName=`Fetchers`;var zo=J.createContext(null);zo.displayName=`Await`;var Bo=J.createContext(null);Bo.displayName=`Navigation`;var Vo=J.createContext(null);Vo.displayName=`Location`;var Ho=J.createContext({outlet:null,matches:[],isDataRoute:!1});Ho.displayName=`Route`;var Uo=J.createContext(null);Uo.displayName=`RouteError`;var Wo=`REACT_ROUTER_ERROR`,Go=`REDIRECT`,Ko=`ROUTE_ERROR_RESPONSE`;function qo(e){if(e.startsWith(`${Wo}:${Go}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Jo(e){if(e.startsWith(`${Wo}:${Ko}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ni(t.status,t.statusText,t.data)}catch{}}function Yo(e,{relative:t}={}){Mr(Xo(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=J.useContext(Bo),{hash:i,pathname:a,search:o}=as(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Di([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Xo(){return J.useContext(Vo)!=null}function Zo(){return Mr(Xo(),`useLocation() may be used only in the context of a <Router> component.`),J.useContext(Vo).location}var Qo=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function $o(e){J.useContext(Bo).static||J.useLayoutEffect(e)}function es(){let{isDataRoute:e}=J.useContext(Ho);return e?Cs():ts()}function ts(){Mr(Xo(),`useNavigate() may be used only in the context of a <Router> component.`);let e=J.useContext(No),{basename:t,navigator:n}=J.useContext(Bo),{matches:r}=J.useContext(Ho),{pathname:i}=Zo(),a=JSON.stringify(wi(r)),o=J.useRef(!1);return $o(()=>{o.current=!0}),J.useCallback((r,s={})=>{if(Nr(o.current,Qo),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ti(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Di([t,c.pathname])),$i(typeof r==`string`?r:Lr(r),n.createHref(c),Xi(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var ns=J.createContext(null);function rs(e){let t=J.useContext(Ho).outlet;return J.useMemo(()=>t&&J.createElement(ns.Provider,{value:e},t),[t,e])}function is(){let{matches:e}=J.useContext(Ho);return e[e.length-1]?.params??{}}function as(e,{relative:t}={}){let{matches:n}=J.useContext(Ho),{pathname:r}=Zo(),i=JSON.stringify(wi(n));return J.useMemo(()=>Ti(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function os(e,t,n){Mr(Xo(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=J.useContext(Bo),{matches:i}=J.useContext(Ho),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Ts(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Zo(),d;if(t){let e=typeof t==`string`?Rr(t):t;Mr(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Xr(e,{pathname:p});Nr(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),Nr(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=ps(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Di([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Di([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?J.createElement(Vo.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function ss(){let e=Ss(),t=Pi(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=J.createElement(J.Fragment,null,J.createElement(`p`,null,`💿 Hey developer 👋`),J.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,J.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,J.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),J.createElement(J.Fragment,null,J.createElement(`h2`,null,`Unexpected Application Error!`),J.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?J.createElement(`pre`,{style:i},n):null,o)}var cs=J.createElement(ss,null),ls=class extends J.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Jo(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:J.createElement(Ho.Provider,{value:this.props.routeContext},J.createElement(Uo.Provider,{value:e,children:this.props.component}));return this.context?J.createElement(ds,{error:e},t):t}};ls.contextType=Fo;var us=new WeakMap;function ds({children:e,error:t}){let{basename:n,navigator:r}=J.useContext(Bo);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=qo(t.digest);if(e){let i=us.get(t);if(i)throw i;let a=Li(e.location,n),o=a.absoluteURL||a.to;if($i(e.location,o,Xi(r),`allow-explicit`),qa(o))throw Error(`Invalid redirect location`);if(Ii&&!us.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw us.set(t,n),n}}return J.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function fs({routeContext:e,match:t,children:n}){let r=J.useContext(No);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),J.createElement(Ho.Provider,{value:e},n)}function ps(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);Mr(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Fi(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||cs,o&&(s<0&&c===0?(Ts(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?J.createElement(n.route.Component,null):n.route.element?n.route.element:e,J.createElement(fs,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?J.createElement(ls,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function ms(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function hs(e){let t=J.useContext(No);return Mr(t,ms(e)),t}function gs(e){let t=J.useContext(Po);return Mr(t,ms(e)),t}function _s(e){let t=J.useContext(Ho);return Mr(t,ms(e)),t}function vs(e){let t=_s(e),n=t.matches[t.matches.length-1];return Mr(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ys(){return vs(`useRouteId`)}function bs(){let e=gs(`useNavigation`);return J.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function xs(){let{matches:e,loaderData:t}=gs(`useMatches`);return J.useMemo(()=>e.map(e=>Qr(e,t)),[e,t])}function Ss(){let e=J.useContext(Uo),t=gs(`useRouteError`),n=vs(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Cs(){let{router:e}=hs(`useNavigate`),t=vs(`useNavigate`),n=J.useRef(!1);return $o(()=>{n.current=!0}),J.useCallback(async(r,i={})=>{Nr(n.current,Qo),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ws={};function Ts(e,t,n){!t&&!ws[e]&&(ws[e]=!0,Nr(!1,n))}var Es={};function Ds(e,t){!e&&!Es[t]&&(Es[t]=!0,console.warn(t))}var Os=J.useOptimistic,ks=()=>void 0;function As(e){return Os?Os(e):[e,ks]}function js(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Nr(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:J.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Nr(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:J.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Nr(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:J.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Ms=[`HydrateFallback`,`hydrateFallbackElement`],Ns=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Ps({router:e,flushSync:t,onError:n,useTransitions:r}){r=Io()||r;let[i,a]=J.useState(e.state),[o,s]=As(i),[c,l]=J.useState(),[u,d]=J.useState({isTransitioning:!1}),[f,p]=J.useState(),[m,h]=J.useState(),[g,_]=J.useState(),v=J.useRef(new Map),y=J.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:Fi(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),Ds(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable.  Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Ds(g==null||y,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):J.startTransition(()=>{r===!0&&s(e=>Fs(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);J.useLayoutEffect(()=>e.subscribe(y),[e,y]),J.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new Ns)},[u]),J.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):J.startTransition(()=>{r===!0&&s(e=>Fs(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),J.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),J.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let b=J.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),x=e.basename||`/`,S=J.useMemo(()=>({router:e,navigator:b,static:!1,basename:x,onError:n}),[e,b,x,n]);return J.createElement(J.Fragment,null,J.createElement(No.Provider,{value:S},J.createElement(Po.Provider,{value:o},J.createElement(Ro.Provider,{value:v.current},J.createElement(Lo.Provider,{value:u},J.createElement(Bs,{basename:x,location:o.location,navigationType:o.historyAction,navigator:b,useTransitions:r},J.createElement(Is,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function Fs(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Is=J.memo(Ls);function Ls({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return os(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Rs({to:e,replace:t,state:n,relative:r}){Mr(Xo(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=J.useContext(Bo);Nr(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=J.useContext(Ho),{pathname:s}=Zo(),c=es(),l=Ti(e,wi(o),s,r===`path`);$i(typeof e==`string`?e:Lr(e),a.createHref(l),Xi(a),`reject`);let u=JSON.stringify(l);return J.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function zs(e){return rs(e.context)}function Bs({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){Mr(!Xo(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=J.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Rr(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=J.useMemo(()=>{let e=_i(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Nr(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:J.createElement(Bo.Provider,{value:c},J.createElement(Vo.Provider,{children:t,value:h}))}J.Component;var Vs=`get`,Hs=`application/x-www-form-urlencoded`;function Us(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Ws(e){return Us(e)&&e.tagName.toLowerCase()===`button`}function Gs(e){return Us(e)&&e.tagName.toLowerCase()===`form`}function Ks(e){return Us(e)&&e.tagName.toLowerCase()===`input`}function qs(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Js(e,t){return e.button===0&&(!t||t===`_self`)&&!qs(e)}function Ys(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Xs(e,t){let n=Ys(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Zs=null;function Qs(){if(Zs===null)try{new FormData(document.createElement(`form`),0),Zs=!1}catch{Zs=!0}return Zs}var $s=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ec(e){return e!=null&&!$s.has(e)?(Nr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Hs}"`),null):e}function tc(e,t){let n,r,i,a,o;if(Gs(e)){let o=e.getAttribute(`action`);r=o?_i(o,t):null,n=e.getAttribute(`method`)||Vs,i=ec(e.getAttribute(`enctype`))||Hs,a=new FormData(e)}else if(Ws(e)||Ks(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?_i(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Vs,i=ec(e.getAttribute(`formenctype`))||ec(o.getAttribute(`enctype`))||Hs,a=new FormData(o,e),!Qs()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Us(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Vs,r=null,i=Hs,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var nc={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},rc=/[&><\u2028\u2029]/g;function ic(e){return e.replace(rc,e=>nc[e])}function ac(e,t){if(e===!1||e==null)throw Error(t)}function oc(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&_i(i.pathname,t)===`/`?`${Oi(t)}/_root.${r}`:`${Oi(i.pathname)}.${r}`,i}async function sc(e,t){if(e.id in t)return t[e.id];try{let n=await K(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function cc(e){return e!=null&&typeof e.page==`string`}function lc(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function uc(e,t,n){return hc((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await sc(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(lc).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function dc(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function fc(e,t,{includeHydrateFallback:n}={}){return pc(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function pc(e){return[...new Set(e)]}function mc(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function hc(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!cc(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(mc(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function gc(){let e=J.useContext(No);return ac(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function _c(){let e=J.useContext(Po);return ac(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var vc=J.createContext(void 0);vc.displayName=`FrameworkContext`;function yc(){let e=J.useContext(vc);return ac(e,`You must render this element inside a <HydratedRouter> element`),e}function bc(e,t){let n=J.useContext(vc),[r,i]=J.useState(!1),[a,o]=J.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=J.useRef(null);J.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),J.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:xc(s,p),onBlur:xc(c,m),onMouseEnter:xc(l,p),onMouseLeave:xc(u,m),onTouchStart:xc(d,p)}]:[a,f,{}]:[!1,f,{}]}function xc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Sc({page:e,...t}){let n=Io(),{nonce:r}=yc(),{router:i}=gc(),a=J.useMemo(()=>Xr(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?J.createElement(wc,{page:e,matches:a,...t}):J.createElement(Tc,{page:e,matches:a,...t})):null}function Cc(e){let{manifest:t,routeModules:n}=yc(),[r,i]=J.useState([]);return J.useEffect(()=>{let r=!1;return uc(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function wc({page:e,matches:t,...n}){let r=Zo(),{future:i}=yc(),{basename:a}=gc(),o=J.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=oc(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return J.createElement(J.Fragment,null,o.map(e=>J.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Tc({page:e,matches:t,...n}){let r=Zo(),{future:i,manifest:a,routeModules:o}=yc(),{basename:s}=gc(),{loaderData:c,matches:l}=_c(),u=J.useMemo(()=>dc(e,t,l,a,r,`data`),[e,t,l,a,r]),d=J.useMemo(()=>dc(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=J.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=oc(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=J.useMemo(()=>fc(d,a),[d,a]),m=Cc(d);return J.createElement(J.Fragment,null,f.map(e=>J.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>J.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>J.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Ec(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}J.Component;var Dc=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Dc&&(window.__reactRouterVersion=`7.18.3`)}catch{}function Oc(e,t){return _a({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:jr({window:t?.window}),hydrationData:t?.hydrationData||kc(),routes:e,mapRouteProperties:js,hydrationRouteProperties:Ms,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function kc(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Ac(e.errors)}),e}function Ac(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new Ni(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&Mi.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var jc=J.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=J.useContext(Bo),v=typeof l==`string`&&Er.test(l),y=Li(l,h);l=y.to;let b=Yo(l,{relative:r}),x=Zo(),S=null;if(o){let e=Ti(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Di([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=bc(n,p),E=Rc(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=J.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:Ec(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?J.createElement(J.Fragment,null,k,J.createElement(Sc,{page:b})):k});jc.displayName=`Link`;var Mc=J.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=as(a,{relative:c.relative}),d=Zo(),f=J.useContext(Po),{navigator:p,basename:m}=J.useContext(Bo),h=f!=null&&Yc(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=_i(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return J.createElement(jc,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Mc.displayName=`NavLink`;var Nc=J.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Vs,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=J.useContext(Bo),g=Hc(),_=Uc(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Er.test(s);return J.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?J.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Nc.displayName=`Form`;function Pc({getKey:e,storageKey:t,...n}){let r=J.useContext(vc),{basename:i}=J.useContext(Bo),a=Zo(),o=xs();qc({getKey:e,storageKey:t});let s=J.useMemo(()=>{if(!r||!e)return null;let t=Kc(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),J.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${ic(JSON.stringify(t||Wc))}, ${ic(JSON.stringify(s))})`}})}Pc.displayName=`ScrollRestoration`;function Fc(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ic(e){let t=J.useContext(No);return Mr(t,Fc(e)),t}function Lc(e){let t=J.useContext(Po);return Mr(t,Fc(e)),t}function Rc(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=es(),d=Zo(),f=as(e,{relative:o});return J.useCallback(p=>{if(Js(p,t)){p.preventDefault();let t=n===void 0?Lr(d)===Lr(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?J.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function zc(e){Nr(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=J.useRef(Ys(e)),n=J.useRef(!1),r=Zo(),i=J.useMemo(()=>Xs(r.search,n.current?null:t.current),[r.search]),a=es();return[i,J.useCallback((e,t)=>{let r=Ys(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Bc=0,Vc=()=>`__${String(++Bc)}__`;function Hc(){let{router:e}=Ic(`useSubmit`),{basename:t}=J.useContext(Bo),n=ys(),r=e.fetch,i=e.navigate;return J.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=tc(e,t);if(a.navigate===!1){let e=a.fetcherKey||Vc();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Uc(e,{relative:t}={}){let{basename:n}=J.useContext(Bo),r=J.useContext(Ho);Mr(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...as(e||`.`,{relative:t})},o=Zo();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Di([n,a.pathname])),Lr(a)}var Wc=`react-router-scroll-positions`,Gc={};function Kc(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:_i(e.pathname,n)||e.pathname},t)),i??=e.key,i}function qc({getKey:e,storageKey:t}={}){let{router:n}=Ic(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Lc(`useScrollRestoration`),{basename:a}=J.useContext(Bo),o=Zo(),s=xs(),c=bs();J.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Jc(J.useCallback(()=>{if(c.state===`idle`){let t=Kc(o,s,a,e);Gc[t]=window.scrollY}try{sessionStorage.setItem(t||Wc,JSON.stringify(Gc))}catch(e){Nr(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(J.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Wc);e&&(Gc=JSON.parse(e))}catch{}},[t]),J.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Gc,()=>window.scrollY,e?(t,n)=>Kc(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),J.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{Nr(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Jc(e,t){let{capture:n}=t||{};J.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Yc(e,{relative:t}={}){let n=J.useContext(Lo);Mr(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ic(`useViewTransitionState`),i=as(e,{relative:t});if(!n.isTransitioning)return!1;let a=_i(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=_i(n.nextLocation.pathname,r)||n.nextLocation.pathname;return pi(i.pathname,o)!=null||pi(i.pathname,a)!=null}var Xc=n(Be(),1);function Zc(e){return J.createElement(Ps,{flushSync:Xc.flushSync,...e})}var Qc=e=>typeof e==`object`&&!!e&&e.nodeType===1,$c=(e,t)=>(!t||e!==`hidden`)&&e!==`visible`&&e!==`clip`,el=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return $c(n.overflowY,t)||$c(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch{return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},tl=(e,t,n,r,i,a,o,s)=>a<e&&o>t||a>e&&o<t?0:a<=e&&s<=n||o>=t&&s>=n?a-e-r:o>t&&s<n||a<e&&s>n?o-t+i:0,nl=e=>e.parentElement??(e.getRootNode().host||null),rl=(e,t)=>{if(typeof document>`u`)return[];let{scrollMode:n,block:r,inline:i,boundary:a,skipOverflowHiddenElements:o}=t,s=typeof a==`function`?a:e=>e!==a;if(!Qc(e))throw TypeError(`Invalid target`);let c=document.scrollingElement||document.documentElement,l=[],u=e;for(;Qc(u)&&s(u);){if(u=nl(u),u===c){l.push(u);break}u!=null&&u===document.body&&el(u)&&!el(document.documentElement)||u!=null&&el(u,o)&&l.push(u)}let d=window.visualViewport?.width??innerWidth,f=window.visualViewport?.height??innerHeight,{scrollX:p,scrollY:m}=window,{height:h,width:g,top:_,right:v,bottom:y,left:b}=e.getBoundingClientRect(),{top:x,right:S,bottom:C,left:w}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),T=r===`start`||r===`nearest`?_-x:r===`end`?y+C:_+h/2-x+C,E=i===`center`?b+g/2-w+S:i===`end`?v+S:b-w,D=[];for(let e=0;e<l.length;e++){let t=l[e],{height:a,width:o,top:s,right:u,bottom:x,left:S}=t.getBoundingClientRect();if(n===`if-needed`&&_>=0&&b>=0&&y<=f&&v<=d&&(t===c&&!el(t)||_>=s&&y<=x&&b>=S&&v<=u))return D;let C=getComputedStyle(t),w=parseInt(C.borderLeftWidth,10),O=parseInt(C.borderTopWidth,10),k=parseInt(C.borderRightWidth,10),A=parseInt(C.borderBottomWidth,10),j=0,M=0,N=`offsetWidth`in t?t.offsetWidth-t.clientWidth-w-k:0,P=`offsetHeight`in t?t.offsetHeight-t.clientHeight-O-A:0,F=`offsetWidth`in t?t.offsetWidth===0?0:o/t.offsetWidth:0,I=`offsetHeight`in t?t.offsetHeight===0?0:a/t.offsetHeight:0;if(c===t)j=r===`start`?T:r===`end`?T-f:r===`nearest`?tl(m,m+f,f,O,A,m+T,m+T+h,h):T-f/2,M=i===`start`?E:i===`center`?E-d/2:i===`end`?E-d:tl(p,p+d,d,w,k,p+E,p+E+g,g),j=Math.max(0,j+m),M=Math.max(0,M+p);else{j=r===`start`?T-s-O:r===`end`?T-x+A+P:r===`nearest`?tl(s,x,a,O,A+P,T,T+h,h):T-(s+a/2)+P/2,M=i===`start`?E-S-w:i===`center`?E-(S+o/2)+N/2:i===`end`?E-u+k+N:tl(S,u,o,w,k+N,E,E+g,g);let{scrollLeft:e,scrollTop:n}=t;j=I===0?0:Math.max(0,Math.min(n+j/I,t.scrollHeight-a/I+P)),M=F===0?0:Math.max(0,Math.min(e+M/F,t.scrollWidth-o/F+N)),T+=n-j,E+=e-M}D.push({el:t,top:j,left:M})}return D},il=e=>!1===e?{block:`end`,inline:`nearest`}:(e=>e===Object(e)&&Object.keys(e).length!==0)(e)?e:{block:`start`,inline:`nearest`};function al(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if((e=>typeof e==`object`&&typeof e.behavior==`function`)(t))return t.behavior(rl(e,t));let r=typeof t==`boolean`||t==null?void 0:t.behavior;for(let{el:i,top:a,left:o}of rl(e,il(t))){let e=a-n.top+n.bottom,t=o-n.left+n.right;i.scroll({top:e,left:t,behavior:r})}}function ol(){let[e,t]=J.useState({});return[e,J.useCallback((e,n)=>{if(!n){t(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n});return}let r={width:n.offsetWidth,height:n.offsetHeight};t(t=>{let n=t[e];return n&&n.width===r.width&&n.height===r.height?t:{...t,[e]:r}})},[])]}function sl(e,t,n=0){let[r,i]=ol(),[a,o,s,c]=J.useMemo(()=>{let i=0,a=0,o=t?.threshold??0,s=new Map,c,l;return e.slice().reverse().forEach((e,u)=>{let d=String(e.key),f=r[d]?.height??0,p=t&&u>0?i+(t.offset??0)-f:i;s.set(d,p),u===0&&(c=f,l=r[d]?.width??0),(!t||u<o)&&(a=Math.max(a,p+f)),t?i=p+f:i+=f+n}),[s,a,c,l]},[e,n,r,t]);return[a,i,o,s,c]}var cl=8,ll=3,ul=e=>{let t={offset:cl,threshold:ll};return e&&typeof e==`object`&&(t.offset=e.offset??cl,t.threshold=e.threshold??ll),[!!e,t]};function dl(e,t,n){let r=Math.max(typeof e==`number`?e:0,0)*1e3,i=F(t),a=F(n),[o,c]=J.useState(r>0),l=J.useRef(0),u=J.useRef(null);function d(){let e=Date.now(),t=u.current;t!==null&&(l.current+=e-t),u.current=e}let f=J.useCallback(()=>{d(),c(!1)},[]),p=J.useCallback(()=>{r>0?(u.current=Date.now(),c(!0)):a(0)},[r]);return J.useEffect(()=>{l.current=0,c(r>0)},[r]),J.useEffect(()=>{if(!o)return;let e=null;function t(){d(),l.current>=r?(a(1),i()):(a(Math.min(l.current/r,1)),e=s(t))}return t(),()=>{s.cancel(e)}},[r,o]),[p,f]}function fl(e){let t=J.useMemo(()=>e===!1?{closeIcon:null,disabled:!0}:typeof e==`object`&&e?e:{},[e]),n=J.useMemo(()=>({...t,closeIcon:`closeIcon`in t?t.closeIcon:`×`,disabled:t.disabled??!1}),[t]),r=J.useMemo(()=>D(n,!0),[n]);return[!!e,n,r]}var pl=({className:e,style:t,percent:n})=>J.createElement(`progress`,{className:e,max:`100`,value:n,style:t});function ml(){return ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ml.apply(this,arguments)}var hl=J.forwardRef((e,t)=>{let{prefixCls:n,className:r,style:i,classNames:a,styles:o,components:s,title:c,description:l,icon:u,actions:d,role:f,closable:p,offset:m,notificationIndex:h,stackInThreshold:g,props:_,duration:v=4.5,showProgress:y,hovering:x,pauseOnHover:S=!0,onClick:C,onMouseEnter:w,onMouseLeave:T,onClose:E}=e,[D,O]=J.useState(0),k=`${n}-notice`,[A,j,M]=fl(p),N=F(()=>{j.onClose?.(),E?.()}),[P,I]=J.useState(!1),[L,R]=dl(v,N,O),z=100-Math.min(Math.max(D*100,0),100),ee=s?.progress||pl;J.useEffect(()=>{S&&(x?R():P||L())},[x,P,R,L,S]);function B(e){I(!0),S&&R(),w?.(e)}function V(e){I(!1),S&&!x&&L(),T?.(e)}function te(e){e.preventDefault(),e.stopPropagation(),N()}let ne=J.useRef(m);m!==void 0&&(ne.current=m);let re=J.useRef(h);h!==void 0&&(re.current=h);let ie=m??ne.current,ae=h??re.current??0,oe=c==null?null:J.createElement(`div`,{className:b(`${k}-title`,a?.title),style:o?.title},c),H=l==null?null:J.createElement(`div`,{className:b(`${k}-description`,a?.description),style:o?.description},l),se=oe!==null,ce=H!==null,U;U=se&&ce?J.createElement(`div`,{className:b(`${k}-section`,a?.section),style:o?.section},oe,H):oe||H,u!=null&&(U=J.createElement(`div`,{className:b(`${k}-wrapper`,a?.wrapper),style:o?.wrapper},J.createElement(`div`,{className:b(`${k}-icon`,a?.icon),style:o?.icon},u),U));let le=d?J.createElement(`div`,{className:b(`${k}-actions`,a?.actions),style:o?.actions},d):null,W={"--notification-index":ae,...o?.root,...i};ie!==void 0&&(W[`--notification-y`]=`${ie}px`);let ue=f??_?.role??`alert`;return J.createElement(`div`,ml({},_,{ref:t,role:ue,"data-notification-index":ae,className:b(k,r,a?.root,{[`${k}-closable`]:A,[`${k}-stack-in-threshold`]:g}),style:W,onClick:C,onMouseEnter:B,onMouseLeave:V}),U,le,A&&J.createElement(`button`,ml({type:`button`,className:b(`${k}-close`,a?.close),"aria-label":`Close`},M,{style:o?.close,onClick:te}),j.closeIcon),y&&typeof v==`number`&&v>0&&J.createElement(ee,{className:b(`${k}-progress`,a?.progress),percent:z,style:o?.progress}))}),gl=J.createContext({}),_l=({children:e,classNames:t})=>{let n=J.useMemo(()=>({classNames:t}),[t]);return J.createElement(gl.Provider,{value:n},e)};function vl(){return vl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vl.apply(this,arguments)}var yl=J.forwardRef((e,t)=>{let{listPrefixCls:n,height:r,topNoticeHeight:i=0,topNoticeWidth:a=0,className:o,style:s,...c}=e,l=`${n}-content`,u=J.useRef(r),d=r<u.current?`decrease`:`increase`;u.current=r;let f={...s,height:r,"--top-notificiation-height":`${i}px`,"--top-notificiation-width":`${a}px`};return J.createElement(`div`,vl({},c,{className:b(l,`${l}-${d}`,o),style:f,ref:t}))});function bl(){return bl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bl.apply(this,arguments)}var xl=[`wrapper`,`root`,`icon`,`section`,`title`,`description`,`actions`,`close`,`progress`];function Sl(e){return xl.reduce((t,n)=>(t[n]=b(...e.map(e=>e?.[n])),t),{})}function Cl(e){return xl.reduce((t,n)=>(t[n]=Object.assign({},...e.map(e=>e?.[n])),t),{})}function wl(e,t){let n=String(t),r=e.findIndex(e=>e.key===n);if(r!==-1)return e.length-r-1}var Tl=e=>{let{config:t,components:n,contextClassNames:r,classNames:i,styles:a,className:o,style:s,nodeRef:c,listHovering:l,stackEnabled:u,pauseOnHover:d,setNodeSize:f,onNoticeClose:p,...m}=e,{key:h,placement:g,..._}=t,v=String(h),y=J.useCallback(e=>{f(v,e)},[f,v]),x=j(c,y);return J.createElement(hl,bl({},_,m,{ref:x,className:b(r?.notice,t.className,o),style:{...s,...t.style},classNames:Sl([i,t.classNames]),styles:Cl([a,t.styles]),components:{...n,...t.components},hovering:u&&l,pauseOnHover:t.pauseOnHover??d,onClose:()=>{t.onClose?.(),p?.(h)}}))},El=e=>{let{configList:t=[],prefixCls:n=`rc-notification`,pauseOnHover:r,classNames:i,styles:a,components:o,stack:s,motion:c,placement:l,className:u,style:d,onNoticeClose:f,onAllRemoved:p}=e,{classNames:m}=J.useContext(gl),h=J.useMemo(()=>t.map(e=>({config:e,key:String(e.key)})),[t]),g=typeof c==`function`?c(l):c,[_,{offset:v,threshold:y}]=ul(s),[x,S]=J.useState(!1),C=_&&(x||h.length<=y),w=J.useMemo(()=>{if(_&&!C)return{offset:v,threshold:y}},[C,v,_,y]),[T,E]=J.useState(0),D=J.useRef(null),[O,k,A,j,M]=sl(t,w,T),N=!!t.length;J.useEffect(()=>{let e=D.current;if(!e)return;let{gap:t,rowGap:n}=window.getComputedStyle(e),r=parseFloat(n||t)||0;E(e=>e===r?e:r)},[N]);let P=`${n}-list`;return J.createElement(`div`,{className:b(n,P,`${n}-${l}`,m?.list,u,i?.list,{[`${n}-stack`]:_,[`${n}-stack-expanded`]:C,[`${P}-hovered`]:x}),onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},style:{...a?.list,...d}},J.createElement(yl,{listPrefixCls:P,height:A,topNoticeHeight:j,topNoticeWidth:M,className:i?.listContent,style:a?.listContent,ref:D},J.createElement(Ge,bl({component:!1,keys:h,motionAppear:!0},g,{onAllRemoved:()=>{l&&p?.(l)}}),({config:e,className:t,style:s},c)=>{let{key:l}=e,u=String(l),d=wl(h,l),p=_&&d!==void 0&&d<y;return J.createElement(Tl,{key:l,config:e,components:o,contextClassNames:m,classNames:i,styles:a,className:t,style:s,nodeRef:c,prefixCls:n,offset:O.get(u),notificationIndex:d,stackInThreshold:p,listHovering:x,stackEnabled:_,pauseOnHover:r,setNodeSize:k,onNoticeClose:f})})))},Dl=J.forwardRef((e,t)=>{let{prefixCls:n=`rc-notification`,container:r,motion:i,maxCount:a,pauseOnHover:o,classNames:s,styles:c,components:l,className:u,style:d,onAllRemoved:f,stack:p,renderNotifications:m}=e,[h,g]=J.useState([]),[_,v]=J.useState({}),y=J.useRef(!1);J.useImperativeHandle(t,()=>({open:e=>{g(t=>{let n=[...t],r=n.findIndex(t=>t.key===e.key),i={...e};return r>=0?(i.times=(t[r]?.times??0)+1,n[r]=i):(i.times=0,n.push(i)),a&&a>0&&n.length>a&&(n=n.slice(-a)),n})},close:e=>{g(t=>t.filter(t=>t.key!==e))},destroy:()=>{g([])}})),J.useEffect(()=>{let e={};h.forEach(t=>{let n=t.placement??`topRight`;e[n]=e[n]||[],e[n].push(t)}),Object.keys(_).forEach(t=>{e[t]=e[t]||[]}),v(e)},[h]);let b=F(e=>{v(t=>{let n={...t};return(n[e]||[]).length||delete n[e],n})});if(J.useEffect(()=>{Object.keys(_).length>0?y.current=!0:y.current&&=(f?.(),!1)},[_,f]),!r)return null;let x=Object.keys(_);return(0,Xc.createPortal)(J.createElement(J.Fragment,null,x.map(e=>{let t=J.createElement(El,{key:e,configList:_[e],placement:e,prefixCls:n,pauseOnHover:o,classNames:s,styles:c,components:l,className:u?.(e),style:d?.(e),motion:i,stack:p,onNoticeClose:e=>{g(t=>t.filter(t=>t.key!==e))},onAllRemoved:b});return m?J.cloneElement(m(t,{prefixCls:n,key:e}),{key:e}):t})),r)}),Ol=()=>document.body,kl=0;function Al(...e){let t={};return e.forEach(e=>{e&&Object.keys(e).forEach(n=>{let r=e[n];r!==void 0&&(t[n]=r)})}),t}function jl(e={}){let{getContainer:t=Ol,motion:n,prefixCls:r,placement:i,closable:a,duration:o,showProgress:s,pauseOnHover:c,classNames:l,styles:u,components:d,maxCount:f,className:p,style:m,onAllRemoved:h,stack:g,renderNotifications:_}=e,v={placement:i,closable:a,duration:o,showProgress:s},[y,b]=J.useState(),x=J.useRef(null),[S,C]=J.useState([]),w=J.createElement(Dl,{container:y,ref:x,prefixCls:r,motion:n,maxCount:f,pauseOnHover:c,classNames:l,styles:u,components:d,className:p,style:m,onAllRemoved:h,stack:g,renderNotifications:_}),T=F(e=>{let t=Al(v,e);(t.key===null||t.key===void 0)&&(t.key=`rc-notification-${kl}`,kl+=1),C(e=>[...e,{type:`open`,config:t}])}),E=J.useMemo(()=>({open:T,close:e=>{C(t=>[...t,{type:`close`,key:e}])},destroy:()=>{C(e=>[...e,{type:`destroy`}])}}),[]);return J.useEffect(()=>{b(t())}),J.useEffect(()=>{x.current&&S.length&&(S.forEach(e=>{switch(e.type){case`open`:x.current?.open(e.config);break;case`close`:x.current?.close(e.key);break;case`destroy`:x.current?.destroy()}}),C(e=>{let t=e.filter(e=>!S.includes(e));return t.length===e.length?e:t}))},[S]),[E,w]}var Ml=(e,t)=>J.useMemo(()=>{let n=e??t;return n?{...E(t)?t:{},...E(n)?n:{}}:!1},[e,t]);function Nl(e,t){return{...re(e)&&{"--notification-top":v(e)},...re(t)&&{"--notification-bottom":v(t)}}}function Pl(e){return{motionName:`${e}-fade`}}function Fl(e,t,n){return e===void 0?t?.closeIcon===void 0?n?.closeIcon:t.closeIcon:e}var Il=e=>{let{allowClear:t,clearIcon:n,contextAllowClear:r,contextClearIcon:i,defaultAllowClear:a,componentName:o}=e;return(0,J.useMemo)(()=>t??r??a?{clearIcon:Nt(E(t)?t?.clearIcon:n,E(r)?r?.clearIcon:i,J.createElement(Pt,null)),disabled:(E(t)?t?.disabled:void 0)??(E(r)?r?.disabled:void 0)}:!1,[t,n,r,i,a])},Ll=()=>J.useReducer(e=>e+1,0),Rl=e=>{let{motionDurationMid:t,motionEaseInOut:n}=e,r=`${t} ${n}`;return{transform:`scale(var(--notification-scale, 1))`,transition:[`transform`,`inset`,`clip-path`,`opacity`].map(e=>`${e} ${r}`).join(`, `)}},zl=(e,t)=>{let{componentCls:n,antCls:r,colorSuccess:i,colorInfo:a,colorWarning:o,colorError:s,colorTextHeading:c,colorText:l,boxShadow:u,borderRadiusLG:d,fontSize:f,lineHeight:p,notificationBg:m,notificationPadding:h,notificationMarginEdge:g,margin:_,calc:y}=e,b=`${n}-notice`,[x,S]=A(r,`notification`);return{[b]:{position:`absolute`,width:t.width,maxWidth:`calc(100vw - ${v(y(g).mul(2).equal())})`,padding:h,pointerEvents:`auto`,[x(`icon-font-size`)]:t.iconFontSize,[x(`title-font-size`)]:t.titleFontSize,[x(`title-line-height`)]:t.titleLineHeight,boxSizing:`border-box`,color:l,background:m,borderRadius:d,boxShadow:u,fontSize:f,lineHeight:p,wordWrap:`break-word`,overflow:`visible`,...Rl(e),...t.noticeStyle,"&::after":{position:`absolute`,insetInline:0,top:y(_).mul(-1).equal(),height:_,content:`""`},...t.typeStyle&&{"&-success":{background:S(`color-success-bg`,m)},"&-error":{background:S(`color-error-bg`,m)},"&-info":{background:S(`color-info-bg`,m)},"&-warning":{background:S(`color-warning-bg`,m)}}},[`${b}-wrapper`]:{display:`flex`,...t.contentStyle},[`${b}-title`]:{color:c,fontSize:S(`title-font-size`),lineHeight:S(`title-line-height`)},[`${b}-icon`]:{flex:`none`,fontSize:S(`icon-font-size`),lineHeight:1,[`&${b}-icon-success`]:{color:i},[`&${b}-icon-info, &${b}-icon-loading`]:{color:a},[`&${b}-icon-warning`]:{color:o},[`&${b}-icon-error`]:{color:s}}}},Bl=e=>{let{componentCls:t,progressBg:n,notificationProgressHeight:r,fontSize:i,borderRadiusLG:a,width:o,notificationIconSize:s,colorText:c,motionDurationMid:l,fontSizeLG:u,lineHeightLG:d,marginSM:f,marginXS:p,paddingLG:m,notificationPaddingVertical:h,notificationPaddingHorizontal:g,notificationCloseButtonSize:_,colorIcon:y,borderRadiusSM:b,colorIconHover:x,colorBgTextHover:S,colorBgTextActive:C}=e,w=`${t}-notice`;return{...zl(e,{width:o,iconFontSize:s,titleFontSize:u,titleLineHeight:d,contentStyle:{alignItems:`flex-start`,gap:f},typeStyle:!0}),[`${w}-section`]:{display:`flex`,flexDirection:`column`,flex:`auto`,gap:p,minWidth:0},[`${w}-description`]:{color:c,fontSize:i},[`${w}-closable`]:{[`${w}-title, ${w}-description`]:{paddingInlineEnd:m},[`${w}-title + ${w}-description`]:{paddingInlineEnd:0}},[`${w}-close`]:{position:`absolute`,top:h,insetInlineEnd:g,display:`flex`,alignItems:`center`,justifyContent:`center`,width:_,height:_,color:y,background:`none`,border:`none`,borderRadius:b,outline:`none`,transition:[`color`,`background-color`].map(e=>`${e} ${l}`).join(`, `),"&:hover":{color:x,backgroundColor:S},"&:active":{backgroundColor:C},...se(e)},[`${w}-progress`]:{position:`absolute`,bottom:0,display:`block`,appearance:`none`,inlineSize:`calc(100% - ${v(a)} * 2)`,blockSize:r,border:0,left:{_skip_check_:!0,value:a},right:{_skip_check_:!0,value:a},"&, &::-webkit-progress-bar":{borderRadius:a,backgroundColor:`rgba(0, 0, 0, 0.04)`},"&::-moz-progress-bar":{background:n},"&::-webkit-progress-value":{borderRadius:a,background:n}},[`${w}-actions`]:{float:`right`,marginTop:f}}},Vl=e=>{let{componentCls:t,width:n}=e,r=`${t}-notice`,i=`${r}-actions`,a=Bl(e);return{[`${r}-pure-panel`]:{width:n,maxWidth:`100%`,...a,[r]:{...a[r],position:`relative`,width:`100%`,maxWidth:`100%`},[i]:{...a[i],float:`none`,textAlign:`end`}}}},Hl=e=>{let{componentCls:t}=e;return{[t]:Bl(e)}},Ul=[`top`,`topLeft`,`topRight`,`bottom`,`bottomLeft`,`bottomRight`],Wl=`--notification-margin-edge`,Gl=(e,t)=>({blockEnd:e===`top`?`bottom`:`top`,inlineEnd:t===`left`?`right`:`left`}),Kl=e=>`translate3d(${e?.x??`0`}, ${e?.y??`0`}, 0) scale(var(--notification-scale, 1))`,ql=(e,t)=>{let n=e.startsWith(`bottom`)?`bottom`:`top`,r=e.endsWith(`Right`)?`right`:`left`,{blockEnd:i,inlineEnd:a}=Gl(n,r),o=e===`top`||e===`bottom`,s=e===`top`||e.endsWith(`Left`)?`-${t}`:t;return{placement:e,vertical:n,blockEnd:i,horizontal:r,inlineEnd:a,motionOffset:o?{x:`-50%`,y:s}:{x:s},baseMotionOffset:o?{x:`-50%`}:void 0,isCenterPlacement:o}},Jl=e=>e===`bottom`?`column-reverse`:`column`,Yl=e=>{let t=`var(${Wl}, 0px)`;return`calc(var(--notification-${e}, ${t}) - ${t})`},Xl=e=>e===`bottom`?`center top`:`center bottom`,Zl=e=>v(e.calc(e.marginXXL).mul(-1).equal()),Ql=e=>{let t=Zl(e);return`inset(${t} ${t} ${t} ${t})`},$l=(e,t)=>{let n=Zl(e);return t===`bottom`?`inset(${n} ${n} 50% ${n})`:`inset(50% ${n} ${n} ${n})`},eu=(e,t)=>{let{componentCls:n}=e,{placement:r,vertical:i,blockEnd:a,horizontal:o,inlineEnd:s,isCenterPlacement:c}=t,l=`${n}-notice`,u=`${l}${n}-fade`,d=Kl(t.motionOffset),f=Kl(t.baseMotionOffset),p=Xl(i);return{[`&${n}-${r}`]:{[i]:Yl(i),[a]:`auto`,display:`flex`,flexDirection:Jl(i),...c?{marginInline:0,left:`50%`,right:`auto`,transform:`translateX(-50%)`}:{[o]:0,[s]:`auto`},[l]:{[i]:`var(--notification-y, 0)`,...c?{left:`50%`,transform:f}:{[o]:`var(--notification-x, 0)`},transformOrigin:p},[`${u}-appear-prepare, ${u}-enter-prepare`]:{opacity:0,transform:d,transition:`none`},[`${u}-appear-start, ${u}-enter-start`]:{opacity:0,transform:d},[`${u}-appear-active, ${u}-enter-active`]:{opacity:1,transform:f},[`${u}-leave-start`]:{opacity:1,transform:f},[`${u}-leave-active`]:{opacity:0,transform:d},[`&${n}-stack:not(${n}-stack-expanded)`]:{[l]:{clipPath:$l(e,i)},[`${l}[data-notification-index='0']`]:{clipPath:Ql(e)}}}}},tu=(e,t=Ul)=>{let{notificationMotionOffset:n}=e,r=v(n);return{...t.reduce((t,n)=>({...t,...eu(e,ql(n,r))}),{})}},nu=e=>{let{componentCls:t}=e;return{[t]:tu(e)}},ru=3,iu=e=>({zIndexPopup:e.zIndexPopupBase+_t+50,width:384,progressBg:`linear-gradient(90deg, ${e.colorPrimaryBorderHover}, ${e.colorPrimary})`,colorSuccessBg:void 0,colorErrorBg:void 0,colorInfoBg:void 0,colorWarningBg:void 0}),au=e=>{let t=e.paddingMD,n=e.paddingLG;return d(e,{notificationBg:e.colorBgElevated,notificationPaddingVertical:t,notificationPaddingHorizontal:n,notificationIconSize:e.calc(e.fontSizeLG).mul(e.lineHeightLG).equal(),notificationCloseButtonSize:e.calc(e.controlHeightLG).mul(.55).equal(),notificationMarginBottom:e.margin,notificationPadding:`${v(e.paddingMD)} ${v(e.paddingContentHorizontalLG)}`,notificationMarginEdge:e.marginLG,notificationProgressHeight:2,notificationMotionOffset:64})},ou=e=>`inset(${e} ${e} ${e} ${e})`,su=e=>{let{componentCls:t,motionDurationMid:n,motionDurationSlow:r,motionEaseInOut:i}=e,a=`${`${t}-list`}-content`;return{[a]:{position:`relative`,display:`flex`,flexShrink:0,flexDirection:`column`,gap:e.notificationMarginBottom,width:`100%`,willChange:`height, transform`,transition:`none`,[`&${a}-decrease`]:{transition:`height calc(${r} * 2) ${i} ${n}`}},[`${t}-fade`]:{backfaceVisibility:`hidden`,willChange:`transform, opacity`}}},cu=(e,t)=>{let{componentCls:n,notificationMarginEdge:r}=e,i=`--notification-margin-edge`,a=`${n}-notice`,s=`${n}-list`,c=t.listWidthKey?e.calc(e[t.listWidthKey]).add(e.calc(r).mul(2)).equal():`100%`,l=`${a}:nth-last-child(n + ${(t.stackVisibleCount??ru)+1})`,u=ou(v(e.calc(e.marginXXL).mul(-1).equal()));return{[n]:{...o(e),[i]:v(r),position:`fixed`,zIndex:e.zIndexPopup,width:c,maxWidth:`100vw`,height:`100vh`,overflow:`hidden`,overscrollBehavior:`contain`,[`${n}-hook-holder`]:{position:`relative`},[`&${s}`]:{maxHeight:`100vh`,padding:`var(${i})`,overflowX:`hidden`,overflowY:`auto`,overscrollBehavior:`contain`,scrollbarWidth:`none`,msOverflowStyle:`none`,pointerEvents:`none`,"&::-webkit-scrollbar":{display:`none`,width:0,height:0}},...su(e),[`&${n}-stack`]:{[a]:{clipPath:u},[`&:not(${n}-stack-expanded)`]:{[a]:{"--notification-scale":`calc(1 - min(var(--notification-index, 0), 2) * 0.06)`},[`${a}:not(${a}-stack-in-threshold)`]:{opacity:0,pointerEvents:`none`},[l]:{opacity:0,pointerEvents:`none`}}},"&-rtl":{direction:`rtl`,[`${a}-actions`]:{float:`left`}}}}};ae([`Notification`,`PurePanel`],e=>Vl(au(e)),iu);var lu=(e,t)=>{let n=t.itemStyle??Hl;return[cu(e,t),n(e),nu(e)]},uu=S(`Notification`,e=>lu(au(e),{listWidthKey:`width`}),iu),du=e=>{let t=e.calc(e.controlHeightLG).sub(e.calc(e.fontSize).mul(e.lineHeight)).div(2).equal(),n=e.paddingSM;return d(au(e),{notificationBg:e.contentBg,notificationPadding:e.contentPadding,notificationPaddingVertical:t,notificationPaddingHorizontal:n})},fu=e=>({zIndexPopup:e.zIndexPopupBase+_t+10,contentBg:e.colorBgElevated,contentPadding:`${(e.controlHeightLG-e.fontSize*e.lineHeight)/2}px ${e.paddingSM}px`}),pu=e=>{let{fontSize:t,fontSizeLG:n,lineHeight:r}=e;return zl(e,{width:`max-content`,iconFontSize:n,titleFontSize:t,titleLineHeight:r,contentStyle:{alignItems:`center`,gap:e.marginXS},noticeStyle:{zIndex:1}})},mu=e=>{let{componentCls:t}=e,n=`${t}-notice`,r=`${t}-list-content`,{"&::after":i,...a}=pu(e)[n],o={...a,position:`absolute`,zIndex:-1,left:`50%`,height:e.calc(e.marginXS).mul(2).equal(),padding:0,boxShadow:e.boxShadowTertiary,opacity:0,pointerEvents:`none`,transform:`translateX(-50%) translateY(100%)`,transition:[`opacity ${e.motionDurationFast} ${e.motionEaseInOut}`,`transform ${e.motionDurationFast} ${e.motionEaseInOut}`,`width ${e.motionDurationSlow} ${e.motionEaseInOut}`].join(`, `),content:`""`};return{[t]:{[`&${t}-stack`]:{[r]:{isolation:`isolate`,"&::before":{...o,top:`calc(var(--top-notificiation-height) - ${v(e.marginXS)})`,width:`calc(var(--top-notificiation-width) - ${v(e.margin)})`},"&::after":{...o,zIndex:-2,top:`var(--top-notificiation-height)`,width:`calc(var(--top-notificiation-width) - ${v(e.calc(e.margin).mul(2).equal())})`}},[`&:not(${t}-stack-expanded)`]:{[r]:{"&::before, &::after":{opacity:1,transform:`translateX(-50%) translateY(0)`}}}}}}},hu=e=>{let{componentCls:t}=e,n=`${t}-notice`,r=pu(e);return{[`${n}-pure-panel`]:{width:`max-content`,maxWidth:`100%`,...r,[n]:{...r[n],position:`relative`,width:`max-content`,maxWidth:`100%`}}}};ae([`Message`,`PurePanel`],e=>hu(du(e)),fu);var gu=e=>({[e.componentCls]:pu(e)}),_u=S(`Message`,e=>{let t=du(e);return[lu(t,{stackVisibleCount:1,itemStyle:gu}),mu(t)]},fu),vu={info:J.createElement(Dt,null),success:J.createElement(Ft,null),error:J.createElement(Pt,null),warning:J.createElement(Rt,null),loading:J.createElement(Ut,null)},yu=(e,t)=>t||e&&vu[e]||null;function bu(e,t){return{motionName:t??`${e}-fade`}}function xu(e){let t,n=new Promise(n=>{t=e(()=>{n(!0)})}),r=()=>{t?.()};return r.then=(e,t)=>n.then(e,t),r.promise=n,r}var Su=8,Cu=3,wu=!1,Tu=({children:e,prefixCls:t})=>{let n=vt(t),[r,i]=_u(t,n);return J.createElement(_l,{classNames:{list:b(r,i,n)}},e)},Eu=(e,{prefixCls:t,key:n})=>J.createElement(Tu,{prefixCls:t,key:n},e),Du=J.forwardRef((e,t)=>{let{top:n,prefixCls:r,getContainer:i,maxCount:a,duration:o=Cu,rtl:s,classNames:c,styles:l,transitionName:d,pauseOnHover:p=!0,stack:m,onAllRemoved:h}=e,{getPrefixCls:g,direction:_,getPopupContainer:v}=f(`message`),{message:y}=J.useContext(u),x=r||g(`message`),S=w(y?.style),[C,T]=te([y?.classNames,c],[y?.styles,S,l],{props:e}),[E,D]=jl({prefixCls:x,style:()=>Nl(n??Su),className:()=>b({[`${x}-rtl`]:s??_===`rtl`}),motion:()=>bu(x,d),closable:!1,duration:o,getContainer:()=>i?.()||v?.()||document.body,maxCount:a,onAllRemoved:h,classNames:C,styles:T,renderNotifications:Eu,pauseOnHover:p,stack:Ml(m,wu)});return J.useImperativeHandle(t,()=>({...E,prefixCls:x,message:y})),D}),Ou=0;function ku(e){let t=J.useRef(null);return pt(`Message`),[J.useMemo(()=>{let n=e=>{t.current?.close(e)},r=r=>{if(!t.current){let e=()=>{};return e.then=()=>{},e}let{open:i,prefixCls:a,message:o}=t.current,s=o?.className||{},c=`${a}-notice`,{content:l,icon:u,type:d,key:f,className:p,style:m,onClose:h,classNames:g={},styles:_={},...v}=r,y=f;re(y)||(Ou+=1,y=`antd-message-${Ou}`);let x={...e,...r},S=z(g,{props:x}),C=z(_,{props:x}),w=yu(d,u),T=d?`${c}-icon-${d}`:void 0;return xu(e=>(i({...v,key:y,icon:w,title:l,classNames:{...S,wrapper:b(d&&`${a}-${d}`,S?.wrapper),icon:b(T,S?.icon)},styles:C,placement:`top`,className:b({[`${c}-${d}`]:d},p,s),style:m,onClose:()=>{h?.(),e()}}),()=>{n(y)}))},i={open:r,destroy:e=>{e===void 0?t.current?.destroy():n(e)}};return[`info`,`success`,`warning`,`error`,`loading`].forEach(e=>{i[e]=(t,n,i)=>{let a;a=E(t)&&`content`in t?t:{content:t};let o,s;I(n)?s=n:(o=n,s=i);let c={onClose:s,duration:o,...a,type:e};return r(c)}}),i},[]),J.createElement(Du,{key:`message-holder`,...e,ref:t})]}function Au(e){return ku(e)}var ju=e=>{let{componentCls:t,antCls:n,motionDurationMid:r,motionEaseInOut:i}=e;return{[t]:{[`${n}-motion-collapse-legacy`]:{overflow:`hidden`,"&-active":{transition:`${[`height`,`opacity`].map(e=>`${e} ${r} ${i}`).join(`, `)} !important`}},[`${n}-motion-collapse`]:{overflow:`hidden`,transition:`${[`height`,`opacity`].map(e=>`${e} ${r} ${i}`).join(`, `)} !important`}}}},Mu=new W(`antMoveDownIn`,{"0%":{transform:`translate3d(0, 100%, 0)`,transformOrigin:`0 0`,opacity:0},"100%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1}}),Nu=new W(`antMoveDownOut`,{"0%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1},"100%":{transform:`translate3d(0, 100%, 0)`,transformOrigin:`0 0`,opacity:0}}),Pu=new W(`antMoveLeftIn`,{"0%":{transform:`translate3d(-100%, 0, 0)`,transformOrigin:`0 0`,opacity:0},"100%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1}}),Fu=new W(`antMoveLeftOut`,{"0%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1},"100%":{transform:`translate3d(-100%, 0, 0)`,transformOrigin:`0 0`,opacity:0}}),Iu=new W(`antMoveRightIn`,{"0%":{transform:`translate3d(100%, 0, 0)`,transformOrigin:`0 0`,opacity:0},"100%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1}}),Lu=new W(`antMoveRightOut`,{"0%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1},"100%":{transform:`translate3d(100%, 0, 0)`,transformOrigin:`0 0`,opacity:0}}),Ru={"move-up":{inKeyframes:new W(`antMoveUpIn`,{"0%":{transform:`translate3d(0, -100%, 0)`,transformOrigin:`0 0`,opacity:0},"100%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1}}),outKeyframes:new W(`antMoveUpOut`,{"0%":{transform:`translate3d(0, 0, 0)`,transformOrigin:`0 0`,opacity:1},"100%":{transform:`translate3d(0, -100%, 0)`,transformOrigin:`0 0`,opacity:0}})},"move-down":{inKeyframes:Mu,outKeyframes:Nu},"move-left":{inKeyframes:Pu,outKeyframes:Fu},"move-right":{inKeyframes:Iu,outKeyframes:Lu}},zu=(e,t)=>{let{antCls:n}=e,r=`${n}-${t}`,{inKeyframes:i,outKeyframes:a}=Ru[t];return[$e(r,i,a,e.motionDurationMid),{[`
        ${r}-enter,
        ${r}-appear
      `]:{opacity:0,animationTimingFunction:e.motionEaseOutCirc},[`${r}-leave`]:{animationTimingFunction:e.motionEaseInOutCirc}}]},Bu=new W(`antSlideUpIn`,{"0%":{transform:`scaleY(0.8)`,transformOrigin:`0% 0%`,opacity:0},"100%":{transform:`scaleY(1)`,transformOrigin:`0% 0%`,opacity:1}}),Vu=new W(`antSlideUpOut`,{"0%":{transform:`scaleY(1)`,transformOrigin:`0% 0%`,opacity:1},"100%":{transform:`scaleY(0.8)`,transformOrigin:`0% 0%`,opacity:0}}),Hu=new W(`antSlideDownIn`,{"0%":{transform:`scaleY(0.8)`,transformOrigin:`100% 100%`,opacity:0},"100%":{transform:`scaleY(1)`,transformOrigin:`100% 100%`,opacity:1}}),Uu=new W(`antSlideDownOut`,{"0%":{transform:`scaleY(1)`,transformOrigin:`100% 100%`,opacity:1},"100%":{transform:`scaleY(0.8)`,transformOrigin:`100% 100%`,opacity:0}}),Wu=new W(`antSlideLeftIn`,{"0%":{transform:`scaleX(0.8)`,transformOrigin:`0% 0%`,opacity:0},"100%":{transform:`scaleX(1)`,transformOrigin:`0% 0%`,opacity:1}}),Gu=new W(`antSlideLeftOut`,{"0%":{transform:`scaleX(1)`,transformOrigin:`0% 0%`,opacity:1},"100%":{transform:`scaleX(0.8)`,transformOrigin:`0% 0%`,opacity:0}}),Ku=new W(`antSlideRightIn`,{"0%":{transform:`scaleX(0.8)`,transformOrigin:`100% 0%`,opacity:0},"100%":{transform:`scaleX(1)`,transformOrigin:`100% 0%`,opacity:1}}),qu=new W(`antSlideRightOut`,{"0%":{transform:`scaleX(1)`,transformOrigin:`100% 0%`,opacity:1},"100%":{transform:`scaleX(0.8)`,transformOrigin:`100% 0%`,opacity:0}}),Ju={"slide-up":{inKeyframes:Bu,outKeyframes:Vu},"slide-down":{inKeyframes:Hu,outKeyframes:Uu},"slide-left":{inKeyframes:Wu,outKeyframes:Gu},"slide-right":{inKeyframes:Ku,outKeyframes:qu}},Yu=(e,t)=>{let{antCls:n}=e,r=`${n}-${t}`,{inKeyframes:i,outKeyframes:a}=Ju[t];return[$e(r,i,a,e.motionDurationMid),{[`
      ${r}-enter,
      ${r}-appear
    `]:{transform:`scale(0)`,transformOrigin:`0% 0%`,opacity:0,animationTimingFunction:e.motionEaseOutQuint,"&-prepare":{transform:`scale(1)`}},[`${r}-leave`]:{animationTimingFunction:e.motionEaseInQuint}}]};function Xu(){return Xu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xu.apply(null,arguments)}var Zu={info:J.createElement(Dt,null),success:J.createElement(Ft,null),error:J.createElement(Pt,null),warning:J.createElement(Rt,null),loading:J.createElement(Ut,null)};function Qu(e,t){return t===null||t===!1?null:t||J.createElement(Lt,{className:`${e}-close-icon`})}var $u=4.5,ed=`topRight`,td={offset:8},nd=({children:e,prefixCls:t})=>{let n=vt(t),[r,i]=uu(t,n);return J.createElement(_l,{classNames:{list:b(r,i,n)}},e)},rd=(e,{prefixCls:t,key:n})=>J.createElement(nd,{prefixCls:t,key:n},e),id=J.forwardRef((e,t)=>{let{top:n,bottom:r,prefixCls:i,getContainer:a,maxCount:o,rtl:s,onAllRemoved:c,stack:l,duration:d=$u,pauseOnHover:p=!0,showProgress:m}=e,{getPrefixCls:h,getPopupContainer:g,direction:_}=f(`notification`),{notification:v}=(0,J.useContext)(u),[y]=kt(`global`,Mt.global),x=i||h(`notification`),S=(0,J.useMemo)(()=>ie(d)&&d>0?d:!1,[d]),C=w(v?.style),[T,E]=te([v?.classNames,e?.classNames],[v?.styles,C,e?.styles],{props:e}),D=()=>Nl(n,r),O=()=>b({[`${x}-rtl`]:s??_===`rtl`}),k=()=>Pl(x),A=Ml(l,td),[j,M]=jl({prefixCls:x,style:D,className:O,motion:k,closable:{closeIcon:Qu(x)},duration:S,getContainer:()=>a?.()||g?.()||document.body,maxCount:o,pauseOnHover:p,showProgress:m,classNames:T,styles:E,onAllRemoved:c,renderNotifications:rd,stack:A});return J.useImperativeHandle(t,()=>({...j,prefixCls:x,notification:v,closeLabel:y.close??Mt.global?.close??`Close`})),M});function ad(e){let t=J.useRef(null);pt(`Notification`);let{notification:n}=J.useContext(u);return[J.useMemo(()=>{let r=r=>{if(!t.current)return;let{open:i,prefixCls:a,notification:o,closeLabel:s}=t.current,c=o?.className||{},l=`${a}-notice`,{title:u,message:d,description:f,icon:p,type:m,btn:h,actions:g,className:_,style:v,role:y=`alert`,closeIcon:x,closable:S,classNames:C={},styles:w={},...T}=r,D=u??d,O=R(D),k=g??h,A=Qu(l,Fl(x,e,o)),[j,M,,N]=Tt(wt({...e||{},...r}),wt(n),{closable:!0,closeIcon:A},s),P=j?{onClose:E(S)?S.onClose:void 0,closeIcon:M,...N}:!1,F=z(C,{props:r}),I=z(w,{props:r}),L=p||(m?Zu[m]:null),ee=!p&&m?`${l}-icon-${m}`:void 0;return i({placement:e?.placement??ed,...T,title:O?D:null,description:f,icon:L,actions:k,role:y,classNames:{...F,icon:b(ee,F?.icon)},styles:I,className:b({[`${l}-${m}`]:m},_,c),style:v,closable:P})},i={open:r,destroy:e=>{e===void 0?t.current?.destroy():t.current?.close(e)}};return[`success`,`info`,`warning`,`error`].forEach(e=>{i[e]=t=>r({...t,type:e})}),i},[e,n]),J.createElement(id,{key:`notification-holder`,...e,ref:t})]}function od(e){return ad(e)}var sd=J.createContext({}),cd=J.createContext({message:{},notification:{},modal:{}}),ld=S(`App`,e=>{let{componentCls:t,colorText:n,fontSize:r,lineHeight:i,fontFamily:a}=e;return{[t]:{color:n,fontSize:r,lineHeight:i,fontFamily:a,[`&${t}-rtl`]:{direction:`rtl`}}}},()=>({})),ud=J.forwardRef((e,t)=>{let{prefixCls:n,children:r,className:i,rootClassName:a,message:o,notification:s,style:c,component:l=`div`}=e,{direction:u,getPrefixCls:d,className:p,style:m}=f(`app`),h=d(`app`,n),[g,_]=ld(h),v=b(g,h,i,a,_,{[`${h}-rtl`]:u===`rtl`}),y=(0,J.useContext)(sd),x=J.useMemo(()=>({message:{...y.message,...o},notification:{...y.notification,...s}}),[o,s,y.message,y.notification]),[S,C]=Au(x.message),[w,T]=od(x.notification),[E,D]=Et(),O=J.useMemo(()=>({message:S,notification:w,modal:E}),[S,w,E]),k=qe(`App`);k(!(_&&l===!1&&(i||a||c||p||m)),`usage`,"When using cssVar, ensure `component` is assigned a valid React component string."),k(!t||l!==!1,`usage`,"`ref` is not supported when `component` is `false`. Please provide a valid `component` instead.");let A=l===!1?J.Fragment:l,j={className:b(p,v),style:{...m,...c}};return J.createElement(cd.Provider,{value:O},J.createElement(sd.Provider,{value:x},J.createElement(A,{...l===!1?void 0:{...j,ref:t}},D,C,T,r)))}),dd=()=>J.useContext(cd),fd=ud;fd.useApp=dd;function pd(e){return t=>J.createElement(jt,{theme:{token:{motion:!1,zIndexPopupBase:0}}},J.createElement(e,{...t}))}var md=(e,t,n,r,i)=>pd(a=>{let{prefixCls:o,style:s}=a,c=J.useRef(null),[l,d]=J.useState(0),[f,p]=J.useState(0),[m,h]=H(!1,a.open),{getPrefixCls:g}=J.useContext(u),_=g(r||`select`,o);J.useEffect(()=>{if(h(!0),typeof ResizeObserver<`u`){let e=new ResizeObserver(e=>{let t=e[0].target;d(t.offsetHeight+8),p(t.offsetWidth)}),t=setInterval(()=>{let n=i?`.${i(_)}`:`.${_}-dropdown`,r=c.current?.querySelector(n);r&&(clearInterval(t),e.observe(r))},10);return()=>{clearInterval(t),e.disconnect()}}},[_]);let v={...a,style:{...s,margin:0},open:m,getPopupContainer:()=>c.current};n&&(v=n(v)),t&&(v={...v,[t]:{overflow:{adjustX:!1,adjustY:!1}}});let y={paddingBottom:l,position:`relative`,minWidth:f};return J.createElement(`div`,{ref:c,style:y},J.createElement(e,{...v}))}),hd=(e,t,n,r,i=!1,a,o)=>{let s=(0,J.useMemo)(()=>typeof n==`boolean`?{allowClear:n}:n&&typeof n==`object`?n:{allowClear:!1},[n]);return(0,J.useMemo)(()=>{let e=!i&&s.allowClear!==!1&&(t.length||a)&&(o!==`combobox`||a!==``);return{allowClear:e,clearIcon:e?s.clearIcon||r||`×`:null,label:e?s.label??`Clear`:``}},[s,r,i,t.length,a,o])},gd=J.createContext(null);function _d(){return J.useContext(gd)}function vd(e=250){let t=J.useRef(null),n=J.useRef(null);J.useEffect(()=>()=>{window.clearTimeout(n.current)},[]);function r(r){(r||t.current===null)&&(t.current=r),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current=null},e)}return[()=>t.current,r]}function yd(e,t){return e.filter(e=>e).some(e=>e.contains(t)||e===t)}function bd(e,t,n,r){let i=F(i=>{if(r)return;let a=i.target;a.shadowRoot&&i.composed&&(a=i.composedPath()[0]||a),i._ori_target&&(a=i._ori_target),t&&!yd(e(),a)&&n(!1)});J.useEffect(()=>(window.addEventListener(`mousedown`,i),()=>window.removeEventListener(`mousedown`,i)),[i])}function xd(){return xd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xd.apply(this,arguments)}var Sd=e=>{let t=e===!0?0:1;return{bottomLeft:{points:[`tl`,`bl`],offset:[0,4],overflow:{adjustX:t,adjustY:1},htmlRegion:`scroll`},bottomRight:{points:[`tr`,`br`],offset:[0,4],overflow:{adjustX:t,adjustY:1},htmlRegion:`scroll`},topLeft:{points:[`bl`,`tl`],offset:[0,-4],overflow:{adjustX:t,adjustY:1},htmlRegion:`scroll`},topRight:{points:[`br`,`tr`],offset:[0,-4],overflow:{adjustX:t,adjustY:1},htmlRegion:`scroll`}}},Cd=J.forwardRef((e,t)=>{let{prefixCls:n,disabled:r,visible:i,children:a,popupElement:o,animation:s,transitionName:c,popupStyle:l,popupClassName:u,direction:d=`ltr`,placement:f,builtinPlacements:p,popupMatchSelectWidth:m,popupRender:h,popupAlign:g,getPopupContainer:_,empty:v,onPopupVisibleChange:y,onPopupMouseEnter:x,onPopupMouseDown:S,onPopupBlur:C,...w}=e,T=`${n}-dropdown`,E=o;h&&(E=h(o));let D=J.useMemo(()=>p||Sd(m),[p,m]),O=s?`${T}-${s}`:c,k=typeof m==`number`,A=J.useMemo(()=>m===!1||k?`minWidth`:`width`,[m,k]),j=l;k&&(j={...l,width:m});let M=J.useRef(null);return J.useImperativeHandle(t,()=>({getPopupElement:()=>M.current?.popupElement})),J.createElement(dt,xd({},w,{showAction:y?[`click`]:[],hideAction:y?[`click`]:[],popupPlacement:f||(d===`rtl`?`bottomRight`:`bottomLeft`),builtinPlacements:D,prefixCls:T,popupMotion:{motionName:O},popup:J.createElement(`div`,{onMouseEnter:x,onMouseDown:S,onBlur:C},E),ref:M,stretch:A,popupAlign:g,popupVisible:i,getPopupContainer:_,popupClassName:b(u,{[`${T}-empty`]:v}),popupStyle:j,onPopupVisibleChange:y}),a)});function wd(e,t){let{key:n}=e,r;return`value`in e&&({value:r}=e),n??(r===void 0?`rc-index-key-${t}`:r)}function Td(e){return e!==void 0&&!Number.isNaN(e)}function Ed(e,t){let{label:n,value:r,options:i,groupLabel:a}=e||{},o=n||(t?`children`:`label`);return{label:o,value:r||`value`,options:i||`options`,groupLabel:a||o}}function Dd(e,{fieldNames:t,childrenAsData:n}={}){let r=[],{label:i,value:a,options:o,groupLabel:s}=Ed(t,!1);function c(e,t){Array.isArray(e)&&e.forEach(e=>{if(t||!(o in e)){let n=e[a];r.push({key:wd(e,r.length),groupOption:t,data:e,label:e[i],value:n})}else{let t=e[s];t===void 0&&n&&(t=e.label),r.push({key:wd(e,r.length),group:!0,data:e,label:t}),c(e[o],!0)}})}return c(e,!1),r}function Od(e){let t={...e};return`props`in t||Object.defineProperty(t,"props",{get(){return P(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),t}}),t}var kd=(e,t,n)=>{if(!t||!t.length)return null;let r=!1,i=(e,[t,...n])=>{if(!t)return[e];let a=e.split(t);return r||=a.length>1,a.reduce((e,t)=>[...e,...i(t,n)],[]).filter(Boolean)},a=i(e,t);return r?n===void 0?a:a.slice(0,n):null};function Ad(e){let{visible:t,values:n}=e;return t?J.createElement(`span`,{"aria-live":`polite`,style:{width:0,height:0,position:`absolute`,overflow:`hidden`,opacity:0}},`${n.slice(0,50).map(({label:e,value:t})=>[`number`,`string`].includes(typeof e)?e:t).join(`, `)}`,n.length>50?`, ...`:null):null}var jd=e=>{let t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(null)},Md=(e,t=1)=>{if(t<=0){e();return}jd(()=>{Md(e,t-1)})};function Nd(e,t,n,r){let[i,a]=(0,J.useState)(!1);(0,J.useEffect)(()=>{a(!0)},[]);let[o,s]=H(e,t),[c,l]=(0,J.useState)(!1),u=i?o:!1,d=r(u),f=(0,J.useRef)(0),p=F(e=>{n&&d!==e&&n(e),s(e)});return[u,d,F((e,t={})=>{let{cancelFun:n}=t;f.current+=1;let r=f.current,i=typeof e==`boolean`?e:!d;l(!i);function a(){r===f.current&&!n?.()&&(p(i),l(!1))}i?a():Md(()=>{a()})}),c]}function Pd(e){let{children:t,...n}=e;return t?J.createElement(`div`,n,t):null}var Fd=J.createContext(null);function Id(){return J.useContext(Fd)}var Ld=J.forwardRef((e,t)=>{let{onChange:n,onKeyDown:r,onBlur:i,style:a,syncWidth:o,value:s,className:c,autoComplete:u,...d}=e,{prefixCls:f,mode:p,onSearch:m,onSearchSubmit:h,onInputBlur:g,autoFocus:_,tokenWithEnter:v,placeholder:y,components:{input:x=`input`}}=Id(),{id:S,classNames:C,styles:w,open:T,activeDescendantId:E,role:D,disabled:O}=_d()||{},A=b(`${f}-input`,C?.input,c),j=J.useRef(!1),M=J.useRef(null),N=J.useRef(null);J.useImperativeHandle(t,()=>N.current);let P=e=>{let{value:t}=e.target;if(v&&M.current&&/[\r\n]/.test(M.current)){let e=M.current.replace(/[\r\n]+$/,``).replace(/\r\n/g,` `).replace(/[\r\n]/g,` `);t=t.replace(e,M.current)}M.current=null,m&&m(t,!0,j.current),n?.(e)},F=e=>{let{key:t}=e,{value:n}=e.currentTarget;t===`Enter`&&p===`tags`&&!T&&!j.current&&h&&h(n),r?.(e)},I=e=>{g?.(),i?.(e)},L=()=>{j.current=!0},R=e=>{if(j.current=!1,p!==`combobox`){let{value:t}=e.currentTarget;m?.(t,!0,!1)}},z=e=>{let{clipboardData:t}=e,n=t?.getData(`text`);M.current=n||``},[ee,B]=J.useState(void 0);l(()=>{let e=N.current;if(o&&e){e.style.width=`0px`;let t=e.scrollWidth;B(t),e.style.width=``}},[o,s]);let V={id:S,type:`text`,...d,ref:N,style:{...w?.input,...a,"--select-input-width":ee},autoFocus:_,autoComplete:u||`new-password`,className:A,disabled:O,value:s||``,onChange:P,onKeyDown:F,onBlur:I,onPaste:z,onCompositionStart:L,onCompositionEnd:R,role:D||`combobox`,"aria-expanded":T||!1,"aria-haspopup":`listbox`,"aria-owns":T?`${S}_list`:void 0,"aria-autocomplete":`list`,"aria-controls":T?`${S}_list`:void 0,"aria-activedescendant":T?E:void 0};if(J.isValidElement(x)){let t=x.props||{},n={placeholder:e.placeholder||y,...V,...t};return Object.keys(t).forEach(e=>{let r=t[e];typeof r==`function`&&(n[e]=(...t)=>{r(...t),V[e]?.(...t)})}),n.ref=k(x.ref,V.ref),J.cloneElement(x,n)}let te=x;return J.createElement(te,V)});function Rd(e){let{prefixCls:t,placeholder:n,displayValues:r}=Id(),{classNames:i,styles:a}=_d(),{show:o=!0}=e;return r.length?null:J.createElement(`div`,{className:b(`${t}-placeholder`,i?.placeholder),style:{...o?{}:{visibility:`hidden`},...a?.placeholder}},n)}var zd=J.createContext(null);function Bd(e){return Array.isArray(e)?e:e===void 0?[]:[e]}typeof window<`u`&&window.document&&window.document.documentElement;function Vd(e){return e!=null}function Hd(e){return!e&&e!==0}function Ud(e){return[`string`,`number`].includes(typeof e)}function Wd(e){let t;return e&&(Ud(e.title)?t=e.title.toString():Ud(e.label)&&(t=e.label.toString())),t}function Gd(){return Gd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gd.apply(this,arguments)}var Kd=J.forwardRef(({inputProps:e},t)=>{let{prefixCls:n,searchValue:r,activeValue:i,displayValues:a,maxLength:o,mode:s,components:c}=Id(),{triggerOpen:l,title:u,showSearch:d,classNames:f,styles:p}=_d(),m=J.useContext(zd),[h,g]=J.useState(!1),_=s===`combobox`,v=a[0],y=J.useMemo(()=>_&&i&&!h&&l?i:d?r:``,[_,i,h,l,r,d]),[x,S,C,w]=J.useMemo(()=>{let e,t,n;if(v&&m?.flattenOptions){let r=m.flattenOptions.find(e=>e.value===v.value);r?.data&&(e=r.data.className,t=r.data.style,n=Wd(r.data))}return v&&!n&&(n=Wd(v)),u!==void 0&&(n=u),[e,t,n,!!e||!!t]},[v,m?.flattenOptions,u]);J.useEffect(()=>{_&&g(!1)},[_,i]);let T=v&&v.label!==null&&v.label!==void 0&&String(v.label).trim()!==``,E=_&&c?.input?null:v?w?J.createElement(`div`,{className:b(`${n}-content-value`,x),style:{...y?{visibility:`hidden`}:{},...S},title:C},v.label):v.label:J.createElement(Rd,{show:!y});return J.createElement(`div`,{className:b(`${n}-content`,T&&`${n}-content-has-value`,y&&`${n}-content-has-search-value`,w&&`${n}-content-has-option-style`,f?.content),style:p?.content,title:w?void 0:C},E,J.createElement(Ld,Gd({ref:t},e,{value:y,maxLength:s===`combobox`?o:void 0,onChange:t=>{g(!0),e.onChange?.(t)}})))}),qd=void 0;function Jd(e,t){let{prefixCls:n,invalidate:r,item:i,renderItem:a,responsive:o,responsiveDisabled:s,registerSize:c,itemKey:l,className:u,style:d,children:f,display:p,order:m,component:h=`div`,...g}=e,_=o&&!p;function v(e){c(l,e)}J.useEffect(()=>()=>{v(null)},[]);let y=a&&i!==qd?a(i,{index:m}):f,x;r||(x={opacity:+!_,height:_?0:qd,overflowY:_?`hidden`:qd,order:o?m:qd,pointerEvents:_?`none`:qd,position:_?`absolute`:qd});let S={};_&&(S[`aria-hidden`]=!0);let C=J.createElement(h,Xu({className:b(!r&&n,u),style:{...x,...d}},S,g,{ref:t}),y);return o&&(C=J.createElement(mt,{onResize:({offsetWidth:e})=>{v(e)},disabled:s},C)),C}var Yd=J.forwardRef(Jd);function Xd(e){if(typeof MessageChannel>`u`)s(e);else{let t=new MessageChannel;t.port1.onmessage=()=>e(),t.port2.postMessage(void 0)}}function Zd(){let e=J.useRef(null);return t=>{e.current||(e.current=[],Xd(()=>{(0,Xc.unstable_batchedUpdates)(()=>{e.current.forEach(e=>{e()}),e.current=null})})),e.current.push(t)}}function Qd(e,t){let[n,r]=J.useState(t);return[n,F(t=>{e(()=>{r(t)})})]}var $d=J.createContext(null),ef=J.forwardRef((e,t)=>{let n=J.useContext($d);if(!n){let{component:n=`div`,...r}=e;return J.createElement(n,Xu({},r,{ref:t}))}let{className:r,...i}=n,{className:a,...o}=e;return J.createElement($d.Provider,{value:null},J.createElement(Yd,Xu({ref:t,className:b(r,a)},i,o)))}),tf=`responsive`,nf=`invalidate`;function rf(e){return`+ ${e.length} ...`}function af(e,t){let{prefixCls:n=`rc-overflow`,data:r=[],renderItem:i,renderRawItem:a,itemKey:o,itemWidth:s=10,ssr:c,style:u,className:d,maxCount:f,renderRest:p,renderRawRest:m,prefix:h,suffix:g,component:_=`div`,itemComponent:v,onVisibleChange:y,...x}=e,S=c===`full`,C=Zd(),[w,T]=Qd(C,null),E=w||0,[D,O]=Qd(C,new Map),[k,A]=Qd(C,0),[j,M]=Qd(C,0),[N,P]=Qd(C,0),[F,I]=Qd(C,0),[L,R]=(0,J.useState)(null),[z,ee]=(0,J.useState)(null),B=J.useMemo(()=>z===null&&S?2**53-1:z||0,[z,w]),[V,te]=(0,J.useState)(!1),ne=`${n}-item`,re=Math.max(k,j),ie=f===tf,ae=r.length&&ie,oe=f===nf,H=ae||typeof f==`number`&&r.length>f,se=(0,J.useMemo)(()=>{let e=r;return ae?e=w===null&&S?r:r.slice(0,Math.min(r.length,E/s)):typeof f==`number`&&(e=r.slice(0,f)),e},[r,s,w,f,ae]),ce=(0,J.useMemo)(()=>ae?r.slice(B+1):r.slice(se.length),[r,se,ae,B]),U=(0,J.useCallback)((e,t)=>typeof o==`function`?o(e):(o&&e?.[o])??t,[o]),le=(0,J.useCallback)(i||(e=>e),[i]);function W(e,t,n){(z!==e||t!==void 0&&t!==L)&&(ee(e),n||(te(e<r.length-1),y?.(e)),t!==void 0&&R(t))}function ue(e,t){T(t.clientWidth)}function de(e,t){O(n=>{let r=new Map(n);return t===null?r.delete(e):r.set(e,t),r})}function fe(e,t){M(t),A(j)}function pe(e,t){P(t)}function me(e,t){I(t)}function he(e){return D.get(U(se[e],e))}l(()=>{if(E&&typeof re==`number`&&se){let e=N+F,t=se.length,n=t-1;if(!t){W(0,null);return}for(let r=0;r<t;r+=1){let t=he(r);if(S&&(t||=0),t===void 0){W(r-1,void 0,!0);break}if(e+=t,n===0&&e<=E||r===n-1&&e+he(n)<=E){W(n,null);break}if(e+re>E){W(r-1,e-t-F+j);break}}g&&he(0)+F>E&&R(null)}},[E,D,j,N,F,U,se]);let ge=V&&!!ce.length,_e={};L!==null&&ae&&(_e={position:`absolute`,top:0,insetInlineStart:L});let ve={prefixCls:ne,responsive:ae,component:v,invalidate:oe},ye=a?(e,t)=>{let n=U(e,t);return J.createElement($d.Provider,{key:n,value:{...ve,order:t,item:e,itemKey:n,registerSize:de,display:t<=B}},a(e,t))}:(e,t)=>{let n=U(e,t);return J.createElement(Yd,Xu({},ve,{order:t,key:n,item:e,renderItem:le,itemKey:n,registerSize:de,display:t<=B}))},be={order:ge?B:2**53-1,className:`${ne}-rest`,registerSize:fe,display:ge},xe=p||rf,Se=m?J.createElement($d.Provider,{value:{...ve,...be}},m(ce)):J.createElement(Yd,Xu({},ve,be),typeof xe==`function`?xe(ce):xe),Ce=J.createElement(_,Xu({className:b(!oe&&n,d),style:u,ref:t},x),h&&J.createElement(Yd,Xu({},ve,{responsive:ie,responsiveDisabled:!ae,order:-1,className:`${ne}-prefix`,registerSize:pe,display:!0}),h),se.map(ye),H?Se:null,g&&J.createElement(Yd,Xu({},ve,{responsive:ie,responsiveDisabled:!ae,order:B,className:`${ne}-suffix`,registerSize:me,display:!0,style:_e}),g));return ie?J.createElement(mt,{onResize:ue,disabled:!ae},Ce):Ce}var of=J.forwardRef(af);of.Item=ef,of.RESPONSIVE=tf,of.INVALIDATE=nf;var sf=of,cf=e=>{let{className:t,style:n,customizeIcon:r,customizeIconProps:i,children:a,onMouseDown:o,onClick:s}=e,c=typeof r==`function`?r(i):r;return J.createElement(`span`,{className:t,onMouseDown:e=>{e.preventDefault(),o?.(e)},style:{userSelect:`none`,WebkitUserSelect:`none`,...n},unselectable:`on`,onClick:s,"aria-hidden":!0},c===void 0?J.createElement(`span`,{className:b(t.split(/\s+/).map(e=>`${e}-icon`))},a):c)};function lf(){return lf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lf.apply(this,arguments)}function uf(e){return e.key??e.value}var df=e=>{e.preventDefault(),e.stopPropagation()},ff=J.forwardRef(function({inputProps:e},t){let{prefixCls:n,displayValues:r,searchValue:i,mode:a,onSelectorRemove:o,removeIcon:s}=Id(),{disabled:c,showSearch:l,triggerOpen:u,rawOpen:d,toggleOpen:f,autoClearSearchValue:p,tagRender:m,maxTagPlaceholder:h,maxTagTextLength:g,maxTagCount:_,classNames:v,styles:y}=_d(),x=`${n}-selection-item`,S=i;!d&&a===`multiple`&&p!==!1&&(S=``);let C=l&&S||``,w=l&&!c,T=s??`×`,E=h??(e=>`+ ${e.length} ...`),D=m,O=e=>{f(e)},k=e=>{o?.(e)},A=(e,t,n,r,i)=>J.createElement(`span`,{title:Wd(e),className:b(x,{[`${x}-disabled`]:n},v?.item),style:y?.item},J.createElement(`span`,{className:b(`${x}-content`,v?.itemContent),style:y?.itemContent},t),r&&J.createElement(cf,{className:b(`${x}-remove`,v?.itemRemove),style:y?.itemRemove,onMouseDown:df,onClick:i,customizeIcon:T},`×`)),j=(e,t,n,r,i,a,o)=>J.createElement(`span`,{onMouseDown:e=>{df(e),O(!u)}},D({label:t,value:e,index:o?.index,disabled:n,closable:r,onClose:i,isMaxTag:!!a}));return J.createElement(sf,{prefixCls:`${n}-content`,className:v?.content,style:y?.content,prefix:!r.length&&!C&&J.createElement(Rd,null),data:r,renderItem:(e,t)=>{let{disabled:n,label:r,value:i}=e,a=!c&&!n,o=r;if(typeof g==`number`&&(typeof r==`string`||typeof r==`number`)){let e=String(o);e.length>g&&(o=`${e.slice(0,g)}...`)}let s=t=>{t&&t.stopPropagation(),k(e)};return typeof D==`function`?j(i,o,n,a,s,void 0,t):A(e,o,n,a,s)},renderRest:e=>{if(!r.length)return null;let t=typeof E==`function`?E(e):E;return typeof D==`function`?j(void 0,t,!1,!1,void 0,!0):A({title:t},t,!1)},suffix:J.createElement(Ld,lf({ref:t,disabled:c,readOnly:!w},e,{value:C||``,syncWidth:!0})),itemKey:uf,maxCount:_})}),pf=J.forwardRef(function(e,t){let{multiple:n,onInputKeyDown:r,tabIndex:i}=Id(),a=_d(),{showSearch:o}=a,s={...D(a,{aria:!0}),onKeyDown:r,readOnly:!o,tabIndex:i};return n?J.createElement(ff,{ref:t,inputProps:s}):J.createElement(Kd,{ref:t,inputProps:s})});function mf(e){return e&&![q.ESC,q.SHIFT,q.BACKSPACE,q.TAB,q.WIN_KEY,q.ALT,q.META,q.WIN_KEY_RIGHT,q.CTRL,q.SEMICOLON,q.EQUALS,q.CAPS_LOCK,q.CONTEXT_MENU,q.UP,q.LEFT,q.RIGHT,q.F1,q.F2,q.F3,q.F4,q.F5,q.F6,q.F7,q.F8,q.F9,q.F10,q.F11,q.F12].includes(e)}function hf(){return hf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hf.apply(this,arguments)}var gf=[`value`,`onChange`,`removeIcon`,`placeholder`,`maxTagCount`,`maxTagTextLength`,`maxTagPlaceholder`,`choiceTransitionName`,`onInputKeyDown`,`onPopupScroll`,`tabIndex`,`activeValue`,`onSelectorRemove`,`focused`],_f=J.forwardRef(function(e,t){let{prefixCls:n,className:r,style:i,prefix:a,suffix:o,clearIcon:s,clearLabel:c,children:l,multiple:u,displayValues:d,placeholder:f,mode:p,searchValue:m,onSearch:h,onSearchSubmit:g,onInputBlur:_,maxLength:v,autoFocus:y,onMouseDown:x,onClearMouseDown:S,onInputKeyDown:C,onSelectorRemove:w,tokenWithEnter:T,components:E,...O}=e,{triggerOpen:A,toggleOpen:j,showSearch:M,disabled:N,loading:P,classNames:I,styles:L}=_d(),R=J.useRef(null),z=J.useRef(null),ee=F(e=>{let{which:t}=e,n=z.current instanceof HTMLTextAreaElement;!n&&A&&(t===q.UP||t===q.DOWN)&&e.preventDefault(),C&&C(e),!(n&&!A&&~[q.UP,q.DOWN,q.LEFT,q.RIGHT].indexOf(t))&&!(e.ctrlKey||e.altKey||e.metaKey)&&mf(t)&&j(!0)});J.useImperativeHandle(t,()=>({focus:e=>{(z.current||R.current).focus?.(e)},blur:()=>{(z.current||R.current).blur?.()},nativeElement:We(R.current)}));let B=F(e=>{if(!N){let t=We(z.current);e.nativeEvent._ori_target=t;let n=t===e.target||t?.contains(e.target);t&&!n&&e.preventDefault();let r=A&&!u&&(p===`combobox`||M)||A&&u&&n;e.nativeEvent._select_lazy?A&&!u&&j(!1):(z.current?.focus(),r||j())}x?.(e)}),V=e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},{root:te}=E,ne=bt(O,gf),re=D(ne,{aria:!0}),ie=Object.keys(re),ae={...e,onInputKeyDown:ee};if(te){let e=te.props||{},t={...e,...ne};return Object.keys(e).forEach(n=>{let r=e[n],i=ne[n];typeof r==`function`&&typeof i==`function`&&(t[n]=(...e)=>{i(...e),r(...e)})}),J.isValidElement(te)?J.cloneElement(te,{...t,ref:k(te.ref,R)}):J.createElement(te,hf({},t,{ref:R}))}return J.createElement(Fd.Provider,{value:ae},J.createElement(`div`,hf({},bt(ne,ie),{ref:R,className:r,style:i,onMouseDown:B}),J.createElement(Pd,{className:b(`${n}-prefix`,I?.prefix),style:L?.prefix},a),J.createElement(pf,{ref:z}),J.createElement(Pd,{className:b(`${n}-suffix`,{[`${n}-suffix-loading`]:P},I?.suffix),style:L?.suffix},o),s&&J.createElement(`button`,{type:`button`,"aria-label":c,className:b(`${n}-clear`,I?.clear),style:L?.clear,onMouseDown:e=>{e.preventDefault(),e.nativeEvent._select_lazy=!0},onKeyDown:V,onClick:S},s),l))});function vf(e,t,n){return J.useMemo(()=>{let{root:r,input:i}=e||{};return n&&(r=n()),t&&(i=t()),{root:r,input:i}},[e,t,n])}function yf(){return yf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yf.apply(this,arguments)}var bf=e=>e===`tags`||e===`multiple`,xf=J.forwardRef((e,t)=>{let{id:n,prefixCls:r,className:i,styles:a,classNames:o,showSearch:s,tagRender:c,showScrollBar:l=`optional`,direction:u,omitDomProps:d,displayValues:f,onDisplayValuesChange:p,emptyOptions:m,notFoundContent:h=`Not Found`,onClear:g,maxCount:_,placeholder:v,mode:y,disabled:x,loading:S,getInputElement:C,getRawInputElement:w,open:T,defaultOpen:E,onPopupVisibleChange:D,activeValue:O,onActiveValueChange:k,activeDescendantId:A,searchValue:j,autoClearSearchValue:M,onSearch:N,onSearchSplit:P,tokenSeparators:I,allowClear:L,prefix:R,suffix:z,suffixIcon:ee,clearIcon:B,OptionList:V,animation:te,transitionName:ne,popupStyle:re,popupClassName:ie,popupMatchSelectWidth:ae,popupRender:oe,popupAlign:H,placement:se,builtinPlacements:ce,getPopupContainer:U,showAction:le=[],onFocus:W,onBlur:ue,onKeyUp:de,onKeyDown:fe,onMouseDown:pe,components:me,...he}=e,ge=bf(y),_e=J.useRef(null),ve=J.useRef(null),ye=J.useRef(null),[be,xe]=J.useState(!1);J.useImperativeHandle(t,()=>({focus:_e.current?.focus,blur:_e.current?.blur,scrollTo:e=>ye.current?.scrollTo(e),nativeElement:We(_e.current)}));let Se=vf(me,C,w),Ce=J.useMemo(()=>{if(y!==`combobox`)return j;let e=f[0]?.value;return typeof e==`string`||typeof e==`number`?String(e):``},[j,y,f]),we=y===`combobox`&&typeof C==`function`&&C()||null,Te=!h&&m,[Ee,De,Oe,ke]=Nd(E||!1,T,D,e=>x||Te?!1:e),G=J.useMemo(()=>typeof I==`function`||(I||[]).some(e=>[`
`,`\r
`].includes(e)),[I]),Ae=J.useMemo(()=>typeof I==`function`?(e,t)=>{let n=I(e),r=Array.isArray(n)&&n.length===1&&n[0]===e;return!Array.isArray(n)||!n.length||r?null:t===void 0?n:n.slice(0,t)}:(e,t)=>kd(e,I,t),[I]),je=(e,t,n)=>{if(ge&&Td(_)&&f.length>=_)return;let r=!0,i=e;k?.(null);let a=Td(_)?_-f.length:void 0,o=n?null:Ae(e,a);return y!==`combobox`&&o&&(i=``,P?.(o),Oe(!1),r=!1),N&&Ce!==i&&N(i,{source:t?`typing`:`effect`}),e&&t&&r&&Oe(!0),r},Me=e=>{e&&e.trim()&&N(e,{source:`submit`})};J.useEffect(()=>{!Ee&&!ge&&y!==`combobox`&&je(``,!1,!1)},[Ee]),J.useEffect(()=>{x&&(Oe(!1),xe(!1))},[x,De]);let[Ne,Pe]=vd(),Fe=J.useRef(!1),Ie=e=>{let t=Ne(),{key:n}=e,r=n===`Enter`,i=n===` `;if(r||i){let t=y===`combobox`;(i&&!(t||s)||r&&!t)&&e.preventDefault(),De||Oe(!0)}if(Pe(!!Ce),n===`Backspace`&&!t&&ge&&!Ce&&f.length){let e=[...f],t=null;for(let n=e.length-1;n>=0;--n){let r=e[n];if(!r.disabled){e.splice(n,1),t=r;break}}t&&p(e,{type:`remove`,values:[t]})}De&&(!r||!Fe.current)&&!i&&(r&&(Fe.current=!0),ye.current?.onKeyDown(e)),fe?.(e)},Le=(e,...t)=>{De&&ye.current?.onKeyUp(e,...t),e.key===`Enter`&&(Fe.current=!1),de?.(e,...t)},Re=F(e=>{let t=f.filter(t=>t!==e);p(t,{type:`remove`,values:[e]})}),ze=()=>{Fe.current=!1},Be=()=>[We(_e.current),ve.current?.getPopupElement()];bd(Be,De,Oe,!!Se.root);let Ve=J.useRef(!1),He=e=>{xe(!0),x||(le.includes(`focus`)&&Oe(!0),W?.(e))},Ue=()=>{De&&!Ve.current&&Oe(!1,{cancelFun:()=>yd(Be(),document.activeElement)})},K=e=>{xe(!1),Ce&&(y===`tags`?N(Ce,{source:`submit`}):y===`multiple`&&N(``,{source:`blur`})),Ue(),x||ue?.(e)},Ge=(e,...t)=>{let{target:n}=e;(ve.current?.getPopupElement())?.contains(n)&&Oe&&Oe(!0),pe?.(e,...t),Ve.current=!0,Md(()=>{Ve.current=!1})},[,Ke]=J.useState({});function qe(){Ke({})}let Je;Se.root&&(Je=e=>{Oe(e)});let Ye=J.useMemo(()=>({...e,notFoundContent:h,open:De,triggerOpen:De,rawOpen:Ee,id:n,showSearch:s,multiple:ge,toggleOpen:Oe,showScrollBar:l,styles:a,classNames:o,lockOptions:ke}),[e,h,Oe,n,s,ge,De,Ee,l,a,o,ke]),Xe=J.useMemo(()=>{let e=z??ee;return typeof e==`function`?e({searchValue:Ce,open:De,focused:be,showSearch:s,loading:S}):e},[z,ee,Ce,De,be,s,S]),Ze=()=>{g?.(),_e.current?.focus(),p([],{type:`clear`,values:f}),je(``,!1,!1)},{allowClear:Qe,clearIcon:$e,label:et}=hd(r,f,L,B,x,Ce,y),tt=J.createElement(V,{ref:ye}),nt=b(r,i,{[`${r}-focused`]:be,[`${r}-multiple`]:ge,[`${r}-single`]:!ge,[`${r}-allow-clear`]:Qe,[`${r}-show-arrow`]:Xe!=null,[`${r}-disabled`]:x,[`${r}-loading`]:S,[`${r}-open`]:De,[`${r}-customize-input`]:we,[`${r}-show-search`]:s}),rt=J.createElement(_f,yf({},he,{ref:_e,prefixCls:r,className:nt,focused:be,prefix:R,suffix:Xe,clearIcon:$e,clearLabel:et,multiple:ge,mode:y,displayValues:f,placeholder:v,searchValue:Ce,activeValue:O,onSearch:je,onSearchSubmit:Me,onInputBlur:ze,onFocus:He,onBlur:K,onClearMouseDown:Ze,onKeyDown:Ie,onKeyUp:Le,onSelectorRemove:Re,tokenWithEnter:G,onMouseDown:Ge,components:Se}));return rt=J.createElement(Cd,{ref:ve,disabled:x,prefixCls:r,visible:De,popupElement:tt,animation:te,transitionName:ne,popupStyle:re,popupClassName:ie,direction:u,popupMatchSelectWidth:ae,popupRender:oe,popupAlign:H,placement:se,builtinPlacements:ce,getPopupContainer:U,empty:m,onPopupVisibleChange:Je,onPopupMouseEnter:qe,onPopupMouseDown:Ge,onPopupBlur:Ue},rt),J.createElement(gd.Provider,{value:Ye},J.createElement(Ad,{visible:be&&!De,values:f}),rt)}),Sf=()=>null;Sf.isSelectOptGroup=!0;var Cf=()=>null;Cf.isSelectOption=!0;function wf(){return wf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wf.apply(this,arguments)}var Tf=J.forwardRef(({height:e,offsetY:t,offsetX:n,children:r,prefixCls:i,onInnerResize:a,innerProps:o,rtl:s,extra:c},l)=>{let u={},d={display:`flex`,flexDirection:`column`};return t!==void 0&&(u={height:e,position:`relative`,overflow:`hidden`},d={...d,transform:`translateY(${t}px)`,[s?`marginRight`:`marginLeft`]:-n,position:`absolute`,left:0,right:0,top:0}),J.createElement(`div`,{style:u},J.createElement(mt,{onResize:({offsetHeight:e})=>{e&&a&&a()}},J.createElement(`div`,wf({style:d,className:b({[`${i}-holder-inner`]:i}),ref:l},o),r,c)))});Tf.displayName=`Filler`;function Ef({children:e,setRef:t}){let n=J.useCallback(e=>{t(e)},[t]);return J.cloneElement(e,{ref:n})}function Df(e,t,n,r,i,a,o,{getKey:s}){return e.slice(t,n+1).map((e,n)=>{let c=o(e,t+n,{style:{width:r},offsetX:i}),l=s(e);return J.createElement(Ef,{key:l,setRef:t=>a(e,t)},c)})}function Of(e,t,n){let r=e.length,i=t.length,a,o;if(r===0&&i===0)return null;r<i?(a=e,o=t):(a=t,o=e);let s={__EMPTY_ITEM__:!0};function c(e){return e===void 0?s:n(e)}let l=null,u=Math.abs(r-i)!==1;for(let e=0;e<o.length;e+=1){let t=c(a[e]);if(t!==c(o[e])){l=e,u||=t!==c(o[e+1]);break}}return l===null?null:{index:l,multiple:u}}function kf(e,t,n){let[r,i]=J.useState(e),[a,o]=J.useState(null);return J.useEffect(()=>{let a=Of(r||[],e||[],t);a?.index!==void 0&&(n?.(a.index),o(e[a.index])),i(e)},[e]),[a]}var Af=typeof navigator==`object`&&/Firefox/i.test(navigator.userAgent),jf=((e,t,n,r)=>{let i=(0,J.useRef)(!1),a=(0,J.useRef)(null);function o(){clearTimeout(a.current),i.current=!0,a.current=setTimeout(()=>{i.current=!1},50)}let s=(0,J.useRef)({top:e,bottom:t,left:n,right:r});return s.current.top=e,s.current.bottom=t,s.current.left=n,s.current.right=r,(e,t,n=!1)=>{let r=e?t<0&&s.current.left||t>0&&s.current.right:t<0&&s.current.top||t>0&&s.current.bottom;return n&&r?(clearTimeout(a.current),i.current=!1):(!r||i.current)&&o(),!i.current&&r}});function Mf(e,t,n,r,i,a,o){let c=(0,J.useRef)(0),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(!1),f=jf(t,n,r,i);function p(e,t){if(s.cancel(l.current),f(!1,t))return;let n=e;if(!n._virtualHandled)n._virtualHandled=!0;else return;c.current+=t,u.current=t,Af||n.preventDefault(),l.current=s(()=>{let e=d.current?10:1;o(c.current*e,!1),c.current=0})}function m(e,t){o(t,!0),Af||e.preventDefault()}let h=(0,J.useRef)(null),g=(0,J.useRef)(null);function _(t){if(!e)return;s.cancel(g.current),g.current=s(()=>{h.current=null},2);let{deltaX:n,deltaY:r,shiftKey:i}=t,o=n,c=r;(h.current===`sx`||!h.current&&i&&r&&!n)&&(o=r,c=0,h.current=`sx`);let l=Math.abs(o),u=Math.abs(c);h.current===null&&(h.current=a&&l>u?`x`:`y`),h.current===`y`?p(t,c):m(t,o)}function v(t){e&&(d.current=t.detail===u.current)}return[_,v]}function Nf(e,t,n,r){let[i,a]=J.useMemo(()=>[new Map,[]],[e,n.id,r]);return(o,s=o)=>{let c=i.get(o),l=i.get(s);if(c===void 0||l===void 0){let u=e.length;for(let d=a.length;d<u;d+=1){let u=e[d],f=t(u);i.set(f,d);let p=n.get(f)??r;if(a[d]=(a[d-1]||0)+p,f===o&&(c=d),f===s&&(l=d),c!==void 0&&l!==void 0)break}}return{top:a[c-1]||0,bottom:a[l]}}}var Pf=class{maps;id=0;diffRecords=new Map;constructor(){this.maps=Object.create(null)}set(e,t){this.diffRecords.set(e,this.maps[e]),this.maps[e]=t,this.id+=1}get(e){return this.maps[e]}resetRecord(){this.diffRecords.clear()}getRecord(){return this.diffRecords}};function Ff(e){let t=parseFloat(e);return isNaN(t)?0:t}function If(e,t,n){let[r,i]=J.useState(0),a=(0,J.useRef)(new Map),o=(0,J.useRef)(new Pf),s=(0,J.useRef)(0);function c(){s.current+=1}function l(e=!1){c();let t=()=>{let e=!1;a.current.forEach((t,n)=>{if(t&&t.offsetParent){let{offsetHeight:r}=t,{marginTop:i,marginBottom:a}=getComputedStyle(t),s=Ff(i),c=Ff(a),l=r+s+c;o.current.get(n)!==l&&(o.current.set(n,l),e=!0)}}),e&&i(e=>e+1)};if(e)t();else{s.current+=1;let e=s.current;Promise.resolve().then(()=>{e===s.current&&t()})}}function u(r,i){let o=e(r),s=a.current.get(o);i?(a.current.set(o,i),l()):a.current.delete(o),!s!=!i&&(i?t?.(r):n?.(r))}return(0,J.useEffect)(()=>c,[]),[u,l,o.current,r]}var Lf=14/15;function Rf(e,t,n){let r=(0,J.useRef)(!1),i=(0,J.useRef)(0),a=(0,J.useRef)(0),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c,u=e=>{if(r.current){let t=Math.ceil(e.touches[0].pageX),r=Math.ceil(e.touches[0].pageY),o=i.current-t,c=a.current-r,l=Math.abs(o)>Math.abs(c);l?i.current=t:a.current=r;let u=n(l,l?o:c,!1,e);u&&e.preventDefault(),clearInterval(s.current),u&&(s.current=setInterval(()=>{l?o*=Lf:c*=Lf;let e=Math.floor(l?o:c);(!n(l,e,!0)||Math.abs(e)<=.1)&&clearInterval(s.current)},16))}},d=()=>{r.current=!1,c()},f=e=>{c(),e.touches.length===1&&!r.current&&(r.current=!0,i.current=Math.ceil(e.touches[0].pageX),a.current=Math.ceil(e.touches[0].pageY),o.current=e.target,o.current.addEventListener(`touchmove`,u,{passive:!1}),o.current.addEventListener(`touchend`,d,{passive:!0}))};c=()=>{o.current&&(o.current.removeEventListener(`touchmove`,u),o.current.removeEventListener(`touchend`,d))},l(()=>(e&&t.current.addEventListener(`touchstart`,f,{passive:!0}),()=>{t.current?.removeEventListener(`touchstart`,f),c(),clearInterval(s.current)}),[e])}function zf(e){return Math.floor(e**.5)}function Bf(e,t){return(`touches`in e?e.touches[0]:e)[t?`pageX`:`pageY`]-window[t?`scrollX`:`scrollY`]}function Vf(e,t,n){J.useEffect(()=>{let r=t.current;if(e&&r){let e=!1,t,i,a=()=>{s.cancel(t)},o=()=>{a(),t=s(()=>{n(i),o()})},c=()=>{e=!1,a()},l=t=>{if(t.target.draggable||t.button!==0)return;let n=t;n._virtualHandled||(n._virtualHandled=!0,e=!0)},u=t=>{if(e){let e=Bf(t,!1),{top:n,bottom:s}=r.getBoundingClientRect();e<=n?(i=-zf(n-e),o()):e>=s?(i=zf(e-s),o()):a()}};return r.addEventListener(`mousedown`,l),r.ownerDocument.addEventListener(`mouseup`,c),r.ownerDocument.addEventListener(`mousemove`,u),r.ownerDocument.addEventListener(`dragend`,c),()=>{r.removeEventListener(`mousedown`,l),r.ownerDocument.removeEventListener(`mouseup`,c),r.ownerDocument.removeEventListener(`mousemove`,u),r.ownerDocument.removeEventListener(`dragend`,c),a()}}},[e])}var Hf=10;function Uf(e,t){let n=typeof e==`function`?e(t):e;return Number.isFinite(n)?n:0}function Wf(e,t,n,r,i,a,o,c,u){let d=J.useRef(void 0),[f,p]=J.useState(null);return l(()=>{if(f&&f.times<Hf){if(!e.current){p(e=>({...e}));return}o();let{targetAlign:s,originAlign:l,offset:u}=f,d=f.index>=0?f.index:t.findIndex(e=>i(e)===f.key),m=s||l,h=Uf(u,{getSize:a,align:m}),g=e.current.clientHeight,_=d<0,v=s,y=null;if(g&&d>=0){let a=0,o=0,s=0,l=Math.min(t.length-1,d);for(let e=0;e<=l;e+=1){let c=i(t[e]);o=a;let l=n.get(c);s=o+(l===void 0?r:l),a=s}let u=m===`top`?h:g-h;for(let e=l;e>=0;--e){let r=i(t[e]),a=n.get(r);if(a===void 0){_=!0;break}if(u-=a,u<=0)break}switch(m){case`top`:y=o-h;break;case`bottom`:y=s-g+h;break;default:{let{scrollTop:t}=e.current,n=t+g;o<t?v=`top`:s>n&&(v=`bottom`)}}y!==null&&c(y),y!==f.lastTop&&(_=!0)}_&&p(e=>({...e,times:e.times+1,index:d,targetAlign:v,lastTop:y}))}},[f,e.current]),e=>{if(e==null){u();return}if(s.cancel(d.current),typeof e==`number`)c(e);else if(e&&typeof e==`object`){let n,r,{align:a}=e;`index`in e?{index:n}=e:(r=e.key,n=t.findIndex(e=>i(e)===r));let{offset:o=0}=e;p({times:0,index:n,key:r,offset:o,originAlign:a})}}}function Gf(e,t,n){if(t<=0||n<=0)return 0;let r=Math.max(Math.min(e,n),0)/n,i=Math.ceil(r*t);return i=Math.max(i,0),i=Math.min(i,t),i}var Kf=J.forwardRef((e,t)=>{let{prefixCls:n,rtl:r,scrollOffset:i,scrollRange:a,onStartMove:o,onStopMove:c,onScroll:l,horizontal:u,spinSize:d,containerSize:f,style:p,thumbStyle:m,showScrollBar:h}=e,[g,_]=J.useState(!1),[v,y]=J.useState(null),[x,S]=J.useState(null),C=!r,w=J.useRef(null),T=J.useRef(null),[E,D]=J.useState(h),O=J.useRef(void 0),k=()=>{h!==!0&&h!==!1&&(clearTimeout(O.current),D(!0),O.current=setTimeout(()=>{D(!1)},3e3))},A=a-f||0,j=f-d||0,M=J.useMemo(()=>i===0||A===0?0:i/A*j,[i,A,j]),N=e=>!!e&&T.current?.contains(e),P=e=>{let t=w.current;if(!t)return;let n=t.getBoundingClientRect(),r=Bf(e,u),i;if(Number.isFinite(r)){if(u){let e=C?n.left:n.right;if(!Number.isFinite(e))return;i=(C?r-e:e-r)-d/2}else{if(!Number.isFinite(n.top))return;i=r-n.top-d/2}l(Gf(i,A,j),u)}},I=e=>{e.stopPropagation(),e.preventDefault(),!(e.button!==0||N(e.target))&&P(e)},L=J.useRef({top:M,dragging:g,pageY:v,startTop:x});L.current={top:M,dragging:g,pageY:v,startTop:x};let R=F(e=>{_(!0),y(Bf(e,u)),S(L.current.top),o(),e.stopPropagation(),e.preventDefault()});J.useEffect(()=>{let e=e=>{e.preventDefault()},t=w.current,n=T.current;return t.addEventListener(`touchstart`,e,{passive:!1}),n.addEventListener(`touchstart`,R,{passive:!1}),()=>{t.removeEventListener(`touchstart`,e),n.removeEventListener(`touchstart`,R)}},[R]);let z=J.useRef(void 0);z.current=A;let ee=J.useRef(void 0);ee.current=j,J.useEffect(()=>{if(g){let e,t=t=>{let{dragging:n,pageY:r,startTop:i}=L.current;s.cancel(e);let a=w.current.getBoundingClientRect(),o=f/(u?a.width:a.height);if(n){let n=(Bf(t,u)-r)*o,a=i;!C&&u?a-=n:a+=n;let c=z.current,d=ee.current,f=Gf(a,c,d);e=s(()=>{l(f,u)})}},n=()=>{_(!1),c()};return window.addEventListener(`mousemove`,t,{passive:!0}),window.addEventListener(`touchmove`,t,{passive:!0}),window.addEventListener(`mouseup`,n,{passive:!0}),window.addEventListener(`touchend`,n,{passive:!0}),()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`touchmove`,t),window.removeEventListener(`mouseup`,n),window.removeEventListener(`touchend`,n),s.cancel(e)}}},[g]),J.useEffect(()=>(k(),()=>{clearTimeout(O.current)}),[i]),J.useImperativeHandle(t,()=>({delayHidden:k}));let B=`${n}-scrollbar`,V={position:`absolute`,visibility:E?null:`hidden`},te={position:`absolute`,borderRadius:99,background:`var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))`,cursor:`pointer`,userSelect:`none`};return u?(Object.assign(V,{height:8,left:0,right:0,bottom:0}),Object.assign(te,{height:`100%`,width:d,[C?`left`:`right`]:M})):(Object.assign(V,{width:8,top:0,bottom:0,[C?`right`:`left`]:0}),Object.assign(te,{width:`100%`,height:d,top:M})),J.createElement(`div`,{ref:w,className:b(B,{[`${B}-horizontal`]:u,[`${B}-vertical`]:!u,[`${B}-visible`]:E}),style:{...V,...p},onMouseDown:I,onMouseMove:k},J.createElement(`div`,{ref:T,className:b(`${B}-thumb`,{[`${B}-thumb-moving`]:g}),style:{...te,...m},onMouseDown:R}))}),qf=20;function Jf(e=0,t=0){let n=e/t*e;return isNaN(n)&&(n=0),n=Math.max(n,qf),Math.floor(n)}function Yf(){return Yf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yf.apply(this,arguments)}var Xf=[],Zf={overflowY:`auto`,overflowAnchor:`none`};function Qf(e,t){let{prefixCls:n=`rc-virtual-list`,className:r,height:i,itemHeight:a,fullHeight:o=!0,style:s,data:c,children:u,itemKey:d,virtual:f,direction:p,scrollWidth:m,component:h=`div`,onScroll:g,onVirtualScroll:_,onVisibleChange:v,innerProps:y,extraRender:x,styles:S,showScrollBar:C=`optional`,...w}=e,T=J.useCallback(e=>typeof d==`function`?d(e):e?.[d],[d]),[E,D,O,k]=If(T,null,null),A=!!(f!==!1&&i&&a),j=J.useMemo(()=>Object.values(O.maps).reduce((e,t)=>e+t,0),[O.id,O.maps]),M=A&&c&&(Math.max(a*c.length,j)>i||!!m),N=p===`rtl`,P=b(n,{[`${n}-rtl`]:N},r),I=c||Xf,L=(0,J.useRef)(null),R=(0,J.useRef)(null),z=(0,J.useRef)(null),[ee,B]=(0,J.useState)(0),[V,te]=(0,J.useState)(0),[ne,re]=(0,J.useState)(!1),ie=()=>{re(!0)},ae=()=>{re(!1)},oe={getKey:T};function H(e){B(t=>{let n;n=typeof e==`function`?e(t):e;let r=xe(n);return L.current.scrollTop=r,r})}let se=(0,J.useRef)({start:0,end:I.length}),ce=(0,J.useRef)(void 0),[U]=kf(I,T);ce.current=U;let{scrollHeight:le,start:W,end:ue,offset:de}=J.useMemo(()=>{if(!A)return{scrollHeight:void 0,start:0,end:I.length-1,offset:void 0};if(!M)return{scrollHeight:R.current?.offsetHeight||0,start:0,end:I.length-1,offset:void 0};let e=0,t,n,r,o=I.length;for(let s=0;s<o;s+=1){let o=I[s],c=T(o),l=O.get(c),u=e+(l===void 0?a:l);u>=ee&&t===void 0&&(t=s,n=e),u>ee+i&&r===void 0&&(r=s),e=u}return t===void 0&&(t=0,n=0,r=Math.ceil(i/a)),r===void 0&&(r=I.length-1),r=Math.min(r+1,I.length-1),{scrollHeight:e,start:t,end:r,offset:n}},[M,A,ee,I,k,i]);se.current.start=W,se.current.end=ue,J.useLayoutEffect(()=>{let e=O.getRecord();if(e.size===1){let t=Array.from(e.keys())[0],n=e.get(t),r=I[W];if(r&&n===void 0&&T(r)===t){let e=O.get(t)-a;H(t=>t+e)}}O.resetRecord()},[le]);let[fe,pe]=J.useState({width:0,height:i}),me=e=>{pe({width:e.offsetWidth,height:e.offsetHeight})},he=(0,J.useRef)(null),ge=(0,J.useRef)(null),_e=J.useMemo(()=>Jf(fe.width,m),[fe.width,m]),ve=J.useMemo(()=>Jf(fe.height,le),[fe.height,le]),ye=le-i,be=(0,J.useRef)(ye);be.current=ye;function xe(e){let t=e;return Number.isNaN(be.current)||(t=Math.min(t,be.current)),t=Math.max(t,0),t}let Se=ee<=0,Ce=ee>=ye,we=V<=0,Te=V>=m,Ee=jf(Se,Ce,we,Te),De=()=>({x:N?-V:V,y:ee}),Oe=(0,J.useRef)(De()),ke=F(e=>{if(_){let t={...De(),...e};(Oe.current.x!==t.x||Oe.current.y!==t.y)&&(_(t),Oe.current=t)}});function G(e,t){let n=e;t?((0,Xc.flushSync)(()=>{te(n)}),ke()):H(n)}function Ae(e){let{scrollTop:t}=e.currentTarget;t!==ee&&H(t),g?.(e),ke()}let je=e=>{let t=e,n=m?m-fe.width:0;return t=Math.max(t,0),t=Math.min(t,n),t},Me=F((e,t)=>{t?((0,Xc.flushSync)(()=>{te(t=>{let n=t+(N?-e:e);return je(n)})}),ke()):H(t=>t+e)}),[Ne,Pe]=Mf(A,Se,Ce,we,Te,!!m,Me);Rf(A,L,(e,t,n,r)=>{let i=r;return Ee(e,t,n)?!1:!i||!i._virtualHandled?(i&&(i._virtualHandled=!0),Ne({preventDefault(){},deltaX:e?t:0,deltaY:e?0:t}),!0):!1}),Vf(M,L,e=>{H(t=>t+e)}),l(()=>{function e(e){let t=Se&&e.detail<0,n=Ce&&e.detail>0;A&&!t&&!n&&e.preventDefault()}let t=L.current;return t.addEventListener(`wheel`,Ne,{passive:!1}),t.addEventListener(`DOMMouseScroll`,Pe,{passive:!0}),t.addEventListener(`MozMousePixelScroll`,e,{passive:!1}),()=>{t.removeEventListener(`wheel`,Ne),t.removeEventListener(`DOMMouseScroll`,Pe),t.removeEventListener(`MozMousePixelScroll`,e)}},[A,Se,Ce]),l(()=>{if(m){let e=je(V);te(e),ke({x:e})}},[fe.width,m]);let Fe=()=>{he.current?.delayHidden(),ge.current?.delayHidden()},Ie=Nf(I,T,O,a),Le=Wf(L,I,O,a,T,Ie,()=>D(!0),H,Fe);J.useImperativeHandle(t,()=>({nativeElement:z.current,getScrollInfo:De,scrollTo:e=>{function t(e){return e&&typeof e==`object`&&(`left`in e||`top`in e)}t(e)?(e.left!==void 0&&te(je(e.left)),Le(e.top)):Le(e)}})),l(()=>{if(v){let e=I.slice(W,ue+1);v(e,I)}},[W,ue,I]);let Re=x?.({start:W,end:ue,virtual:M,offsetX:V,scrollTop:ee,offsetY:de,rtl:N,getSize:Ie}),ze=Df(I,W,ue,m,V,E,u,oe),Be=null;i&&(Be={[o?`height`:`maxHeight`]:i,...Zf},A&&(Be.overflowY=`hidden`,m&&(Be.overflowX=`hidden`),ne&&(Be.pointerEvents=`none`)));let Ve={};return N&&(Ve.dir=`rtl`),J.createElement(`div`,Yf({ref:z,style:{...s,position:`relative`},className:P},Ve,w),J.createElement(mt,{onResize:me},J.createElement(h,{className:`${n}-holder`,style:Be,ref:L,onScroll:Ae,onMouseEnter:Fe},J.createElement(Tf,{prefixCls:n,height:le,offsetX:V,offsetY:de,scrollWidth:m,onInnerResize:D,ref:R,innerProps:y,rtl:N,extra:Re},ze))),M&&le>i&&J.createElement(Kf,{ref:he,prefixCls:n,scrollOffset:ee,scrollRange:le,rtl:N,onScroll:G,onStartMove:ie,onStopMove:ae,spinSize:ve,containerSize:fe.height,style:S?.verticalScrollBar,thumbStyle:S?.verticalScrollBarThumb,showScrollBar:C}),M&&m>fe.width&&J.createElement(Kf,{ref:ge,prefixCls:n,scrollOffset:V,scrollRange:m,rtl:N,onScroll:G,onStartMove:ie,onStopMove:ae,spinSize:_e,containerSize:fe.width,horizontal:!0,style:S?.horizontalScrollBar,thumbStyle:S?.horizontalScrollBarThumb,showScrollBar:C}))}var $f=J.forwardRef(Qf);$f.displayName=`List`;var ep=J.forwardRef((e,t)=>Qf({...e,virtual:!1},t));ep.displayName=`List`;var tp=$f;function np(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}function rp(){return rp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rp.apply(this,arguments)}function ip(e){return typeof e==`string`||typeof e==`number`}var ap=J.forwardRef((e,t)=>{let{prefixCls:n,id:r,open:i,multiple:a,mode:o,searchValue:s,toggleOpen:c,notFoundContent:l,onPopupScroll:u,showScrollBar:d,lockOptions:f}=_d(),{maxCount:p,flattenOptions:m,onActiveValue:h,defaultActiveFirstOption:g,onSelect:_,menuItemSelectedIcon:v,rawValues:y,fieldNames:x,virtual:S,direction:C,listHeight:w,listItemHeight:T,optionRender:E,classNames:O,styles:k}=J.useContext(zd),A=`${n}-item`,j=le(()=>m,[i,f],(e,t)=>t[0]&&!t[1]),M=J.useRef(null),N=J.useMemo(()=>a&&Td(p)&&y?.size>=p,[a,p,y?.size]),P=e=>{e.preventDefault()},F=e=>{M.current?.scrollTo(typeof e==`number`?{index:e}:e)},I=J.useCallback(e=>o!==`combobox`&&y.has(e),[o,[...y].toString(),y.size]),L=(e,t=1)=>{let n=j.length;for(let r=0;r<n;r+=1){let i=(e+r*t+n)%n,{group:a,data:o}=j[i]||{};if(!a&&!o?.disabled&&(I(o.value)||!N))return i}return-1},[R,z]=J.useState(()=>L(0)),ee=(e,t=!1)=>{z(e);let n={source:t?`keyboard`:`mouse`},r=j[e];if(!r){h(null,-1,n);return}h(r.value,e,n)};(0,J.useEffect)(()=>{ee(g===!1?-1:L(0))},[j.length,s]);let B=J.useCallback(e=>o===`combobox`?String(e).toLowerCase()===s.toLowerCase():y.has(e),[o,s,[...y].toString(),y.size]);(0,J.useEffect)(()=>{let e;if(!a&&i&&y.size===1){let t=Array.from(y)[0],n=j.findIndex(({data:e})=>s?String(e.value).startsWith(s):e.value===t);n!==-1&&(ee(n),e=setTimeout(()=>{F(n)}))}return i&&M.current?.scrollTo(void 0),()=>clearTimeout(e)},[i,s]);let V=e=>{e!==void 0&&_(e,{selected:!y.has(e)}),a||c(!1)};if(J.useImperativeHandle(t,()=>({onKeyDown:e=>{let{which:t,ctrlKey:n}=e;switch(t){case q.N:case q.P:case q.UP:case q.DOWN:{let e=0;if(t===q.UP?e=-1:t===q.DOWN?e=1:np()&&n&&(t===q.N?e=1:t===q.P&&(e=-1)),e!==0){let t=L(R+e,e);F(t),ee(t,!0)}break}case q.TAB:case q.ENTER:{let t=j[R];if(!t||t.data.disabled)return V(void 0);!N||y.has(t.value)?V(t.value):V(void 0),i&&e.preventDefault();break}case q.ESC:c(!1),i&&e.stopPropagation()}},onKeyUp:()=>{},scrollTo:e=>{F(e)}})),j.length===0)return J.createElement(`div`,{role:`listbox`,id:`${r}_list`,className:`${A}-empty`,onMouseDown:P},l);let te=Object.keys(x).map(e=>x[e]),ne=e=>e.label;function re(e,t){let{group:n}=e;return{role:n?`presentation`:`option`,id:`${r}_list_${t}`}}let ie=e=>{let t=j[e];if(!t)return null;let n=t.data||{},{value:r,disabled:i}=n,{group:a}=t,o=D(n,!0),s=ne(t);return t?J.createElement(`div`,rp({"aria-label":typeof s==`string`&&!a?s:null},o,{key:e},re(t,e),{"aria-selected":B(r),"aria-disabled":i}),r):null},ae={role:`listbox`,id:`${r}_list`};return J.createElement(J.Fragment,null,S&&J.createElement(`div`,rp({},ae,{style:{height:0,width:0,overflow:`hidden`}}),ie(R-1),ie(R),ie(R+1)),J.createElement(tp,{prefixCls:`${n}-dropdown-list`,itemKey:`key`,ref:M,data:j,height:w,itemHeight:T,fullHeight:!1,onMouseDown:P,onScroll:u,virtual:S,direction:C,innerProps:S?null:ae,showScrollBar:d,className:O?.popup?.list,style:k?.popup?.list},(e,t)=>{let{group:n,groupOption:r,data:i,label:a,value:o}=e,{key:s}=i;if(n){let e=i.title??(ip(a)?a.toString():void 0);return J.createElement(`div`,{className:b(A,`${A}-group`,i.className),title:e},a===void 0?s:a)}let{disabled:c,title:l,children:u,style:d,className:f,...p}=i,m=bt(p,te),h=I(o),g=c||!h&&N,_=`${A}-option`,y=b(A,_,f,O?.popup?.listItem,{[`${_}-grouped`]:r,[`${_}-active`]:R===t&&!g,[`${_}-disabled`]:g,[`${_}-selected`]:h}),x=ne(e),C=!v||typeof v==`function`||h,w=typeof x==`number`?x:x||o,T=ip(w)?w.toString():void 0;return l!==void 0&&(T=l),J.createElement(`div`,rp({},D(m),S?{}:re(e,t),{"aria-selected":S?void 0:B(o),"aria-disabled":g,className:y,title:T,onMouseMove:()=>{R===t||g||ee(t)},onClick:()=>{g||V(o)},style:{...k?.popup?.listItem,...d}}),J.createElement(`div`,{className:`${_}-content`},typeof E==`function`?E(e,{index:t}):w),J.isValidElement(v)||h,C&&J.createElement(cf,{className:`${A}-option-state`,customizeIcon:v,customizeIconProps:{value:o,disabled:g,isSelected:h}},h?`✓`:null))}))}),op=((e,t)=>{let n=J.useRef({values:new Map,options:new Map});return[J.useMemo(()=>{let{values:r,options:i}=n.current,a=e.map(e=>e.label===void 0?{...e,label:r.get(e.value)?.label}:e),o=new Map,s=new Map;return a.forEach(e=>{o.set(e.value,e),s.set(e.value,t.get(e.value)||i.get(e.value))}),n.current.values=o,n.current.options=s,a},[e,t]),J.useCallback(e=>t.get(e)||n.current.options.get(e),[t])]});function sp(e,t){return Bd(e).join(``).toUpperCase().includes(t)}var cp=((e,t,n,r,i)=>J.useMemo(()=>{if(!n||r===!1)return e;let{options:a,label:o,value:s}=t,c=[],l=typeof r==`function`,u=n.toUpperCase(),d=l?r:(e,t)=>i&&i.length?i.some(e=>sp(t[e],u)):t[a]?sp(t[o===`children`?`label`:o],u):sp(t[s],u),f=l?e=>Od(e):e=>e;return e.forEach(e=>{if(e[a]){if(d(n,f(e)))c.push(e);else{let t=e[a].filter(e=>d(n,f(e)));t.length&&c.push({...e,[a]:t})}return}d(n,f(e))&&c.push(e)}),c},[e,r,i,n,t]));function lp(e){let{key:t,props:{children:n,value:r,...i}}=e;return{key:t,value:r===void 0?t:r,children:n,...i}}function up(e,t=!1){return i(e).map((e,n)=>{if(!J.isValidElement(e)||!e.type)return null;let{type:{isSelectOptGroup:r},key:i,props:{children:a,...o}}=e;return t||!r?lp(e):{key:`__RC_SELECT_GRP__${i===null?n:i}__`,label:i,...o,options:up(a)}}).filter(e=>e)}var dp=(e,t,n,r,i)=>J.useMemo(()=>{let a=e;e||(a=up(t));let o=new Map,s=new Map,c=(e,t,n)=>{n&&typeof n==`string`&&e.set(t[n],t)},l=(e,t=!1)=>{for(let a=0;a<e.length;a+=1){let u=e[a];!u[n.options]||t?(o.set(u[n.value],u),c(s,u,n.label),r.forEach(e=>{c(s,u,e)}),c(s,u,i)):l(u[n.options],!0)}};return l(a),{options:a,valueOptions:o,labelOptions:s}},[e,t,n,r,i]);function fp(e){let t=J.useRef(e);return t.current=e,J.useCallback((...e)=>t.current(...e),[])}function pp(e,t,n){let{filterOption:r,searchValue:i,optionFilterProp:a,filterSort:o,onSearch:s,autoClearSearchValue:c}=t;return J.useMemo(()=>{let t=typeof e==`object`,l={filterOption:r,searchValue:i,optionFilterProp:a,filterSort:o,onSearch:s,autoClearSearchValue:c,...t?e:{}};return[t||n===`combobox`||n===`tags`||n===`multiple`&&e===void 0?!0:e,l]},[n,e,r,i,a,o,s,c])}function mp(){return mp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mp.apply(this,arguments)}var hp=[`inputValue`];function gp(e){return!e||typeof e!=`object`}var _p=J.forwardRef((e,t)=>{let{id:n,mode:r,prefixCls:i=`rc-select`,backfill:a,fieldNames:o,showSearch:s,searchValue:c,onSearch:l,autoClearSearchValue:u,filterOption:d,optionFilterProp:f,filterSort:p,onSelect:m,onDeselect:h,onActive:g,popupMatchSelectWidth:_=!0,optionLabelProp:v,options:y,optionRender:b,children:x,defaultActiveFirstOption:S,menuItemSelectedIcon:C,virtual:w,direction:T,listHeight:E=200,listItemHeight:D=20,labelRender:O,value:k,defaultValue:A,labelInValue:j,onChange:M,maxCount:N,classNames:P,styles:F,...I}=e,[L,R]=pp(s,{searchValue:c,onSearch:l,autoClearSearchValue:u,filterOption:d,optionFilterProp:f,filterSort:p},r),{filterOption:z,searchValue:ee,optionFilterProp:B,filterSort:V,onSearch:te,autoClearSearchValue:ne=!0}=R,re=J.useMemo(()=>B?Array.isArray(B)?B:[B]:[],[B]),ie=ce(n),ae=bf(r),oe=!(y||!x),se=J.useMemo(()=>z===void 0&&r===`combobox`?!1:z,[z,r]),U=J.useMemo(()=>Ed(o,oe),[JSON.stringify(o),oe]),[le,W]=H(``,ee),ue=le||``,de=dp(y,x,U,re,v),{valueOptions:fe,labelOptions:pe,options:me}=de,he=J.useCallback(e=>Bd(e).map(e=>{let t,n,r,i;gp(e)?t=e:(n=e.label,t=e.value);let a=fe.get(t);return a&&(n===void 0&&(n=a?.[v||U.label]),r=a?.disabled,i=a?.title),{label:n,value:t,key:t,disabled:r,title:i}}),[U,v,fe]),[ge,_e]=H(A,k),[ve,ye]=op(J.useMemo(()=>{let e=he(ae&&ge===null?[]:ge);return r===`combobox`&&Hd(e[0]?.value)?[]:e},[ge,he,r,ae]),fe),be=J.useMemo(()=>{if(!r&&ve.length===1){let e=ve[0];if(e.value===null&&(e.label===null||e.label===void 0))return[]}return ve.map(e=>({...e,label:(typeof O==`function`?O(e):e.label)??e.value}))},[r,ve,O]),xe=J.useMemo(()=>new Set(ve.map(e=>e.value)),[ve]);J.useEffect(()=>{if(r===`combobox`){let e=ve[0]?.value;W(Vd(e)?String(e):``)}},[ve]);let Se=fp((e,t)=>{let n=t??e;return{[U.value]:e,[U.label]:n}}),Ce=cp(J.useMemo(()=>{if(r!==`tags`)return me;let e=[...me],t=e=>fe.has(e);return[...ve].sort((e,t)=>e.value<t.value?-1:1).forEach(n=>{let r=n.value;t(r)||e.push(Se(r,n.label))}),e},[Se,me,fe,ve,r]),U,ue,se,re),we=J.useMemo(()=>{let e=e=>re.length?re.some(t=>e?.[t]===ue):e?.value===ue;return r!==`tags`||!ue||Ce.some(t=>e(t))||Ce.some(e=>e[U.value]===ue)||fe.get(ue)?.disabled?Ce:[Se(ue),...Ce]},[Se,re,r,Ce,ue,U,fe]),Te=e=>[...e].sort((e,t)=>V(e,t,{searchValue:ue})).map(e=>Array.isArray(e.options)?{...e,options:e.options.length>0?Te(e.options):e.options}:e),Ee=J.useMemo(()=>V?Te(we):we,[we,V,ue]),De=J.useMemo(()=>Dd(Ee,{fieldNames:U,childrenAsData:oe}),[Ee,U,oe]),Oe=e=>{let t=he(e);if(_e(t),M&&(t.length!==ve.length||t.some((e,t)=>ve[t]?.value!==e?.value))){let e=j?t.map(({label:e,value:t})=>({label:e,value:t})):t.map(e=>e.value),n=t.map(e=>Od(ye(e.value)));M(ae?e:e[0],ae?n:n[0])}},[ke,G]=J.useState(null),[Ae,je]=J.useState(0),Me=S===void 0?r!==`combobox`:S,Ne=J.useRef(void 0),Pe=J.useCallback((e,t,{source:n=`keyboard`}={})=>{je(t),a&&r===`combobox`&&e!==null&&n===`keyboard`&&G(String(e));let i=Promise.resolve().then(()=>{Ne.current===i&&g?.(e)});Ne.current=i},[a,r,g]),Fe=(e,t,n)=>{let r=()=>{let t=ye(e);return[j?{label:t?.[U.label],value:e}:e,Od(t)]};if(t&&m){let[e,t]=r();m(e,t)}else if(!t&&h&&n!==`clear`){let[e,t]=r();h(e,t)}},Ie=fp((e,t)=>{let n,i=!ae||t.selected;n=i?ae?[...ve,e]:[e]:ve.filter(t=>t.value!==e),Oe(n),Fe(e,i),r===`combobox`?G(``):(!bf||ne)&&(W(``),G(``))}),Le=(e,t)=>{Oe(e);let{type:n,values:r}=t;(n===`remove`||n===`clear`)&&r.forEach(e=>{Fe(e.value,!1,n)})},Re=(e,t)=>{if(W(e),G(null),t.source===`submit`){let t=(e||``).trim();if(t){if(fe.get(t)?.disabled){W(``);return}let e=Array.from(new Set([...xe,t]));Oe(e),Fe(t,!0),W(``)}return}t.source!==`blur`&&(r===`combobox`&&Oe(e),te?.(e))},ze=e=>{let t=e;r!==`tags`&&(t=e.map(e=>pe.get(e)?.value).filter(e=>e!==void 0)),r===`tags`&&(t=t.filter(e=>!fe.get(e)?.disabled));let n=Array.from(new Set([...xe,...t]));Oe(n),n.forEach(e=>{Fe(e,!0)})},Be=J.useMemo(()=>{let e=w!==!1&&_!==!1;return{...de,flattenOptions:De,onActiveValue:Pe,defaultActiveFirstOption:Me,onSelect:Ie,menuItemSelectedIcon:C,rawValues:xe,fieldNames:U,virtual:e,direction:T,listHeight:E,listItemHeight:D,childrenAsData:oe,maxCount:N,optionRender:b,classNames:P,styles:F}},[N,de,De,Pe,Me,Ie,C,xe,U,w,_,T,E,D,oe,b,P,F]);return J.createElement(zd.Provider,{value:Be},J.createElement(xf,mp({},I,{id:ie,prefixCls:i,ref:t,omitDomProps:hp,mode:r,classNames:P,styles:F,displayValues:be,onDisplayValuesChange:Le,maxCount:N,direction:T,showSearch:L,searchValue:ue,onSearch:Re,autoClearSearchValue:ne,onSearchSplit:ze,popupMatchSelectWidth:_,OptionList:ap,emptyOptions:!De.length,activeValue:ke,activeDescendantId:`${ie}_list_${Ae}`})))});_p.Option=Cf,_p.OptGroup=Sf;var vp=_p,yp=(e,t,n)=>e===!1?null:e===!0?n:e&&t&&e[t]!==void 0?e[t]:n,bp=(e,t,n)=>b({[`${e}-status-success`]:t===`success`,[`${e}-status-warning`]:t===`warning`,[`${e}-status-error`]:t===`error`,[`${e}-status-validating`]:t===`validating`,[`${e}-has-feedback`]:n}),xp=(e,t)=>t||e,Sp=(e,t)=>e?.startsWith(`var(`)||t?.startsWith(`var(`)?e:new m(e).onBackground(t).toHexString(),Cp=()=>{let[,e]=c(),[t]=kt(`Empty`),{colorBgContainer:n,colorFill:r,colorFillSecondary:i,colorFillTertiary:a,colorTextQuaternary:o}=e,{panelBgColor:s,borderColor:l,detailColor:u,shadowColor:d,iconColor:f}=(0,J.useMemo)(()=>({panelBgColor:Sp(a,n),borderColor:Sp(o,n),detailColor:Sp(r,n),shadowColor:Sp(i,n),iconColor:n}),[n,r,i,a,o]);return J.createElement(`svg`,{width:`184`,height:`152`,viewBox:`0 0 184 152`,xmlns:`http://www.w3.org/2000/svg`},J.createElement(`title`,null,t?.description||`Empty`),J.createElement(`g`,{fill:`none`,fillRule:`evenodd`},J.createElement(`g`,{transform:`translate(24 31.7)`},J.createElement(`ellipse`,{fillOpacity:`.8`,fill:d,cx:`67.8`,cy:`106.9`,rx:`67.8`,ry:`12.7`}),J.createElement(`path`,{fill:l,d:`M122 69.7 98.1 40.2a6 6 0 0 0-4.6-2.2H42.1a6 6 0 0 0-4.6 2.2l-24 29.5V85H122z`}),J.createElement(`path`,{fill:s,d:`M33.8 0h68a4 4 0 0 1 4 4v93.3a4 4 0 0 1-4 4h-68a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4`}),J.createElement(`path`,{fill:u,d:`M42.7 10h50.2a2 2 0 0 1 2 2v25a2 2 0 0 1-2 2H42.7a2 2 0 0 1-2-2V12a2 2 0 0 1 2-2m.2 39.8h49.8a2.3 2.3 0 1 1 0 4.5H42.9a2.3 2.3 0 0 1 0-4.5m0 11.7h49.8a2.3 2.3 0 1 1 0 4.6H42.9a2.3 2.3 0 0 1 0-4.6m79 43.5a7 7 0 0 1-6.8 5.4H20.5a7 7 0 0 1-6.7-5.4l-.2-1.8V69.7h26.3c2.9 0 5.2 2.4 5.2 5.4s2.4 5.4 5.3 5.4h34.8c2.9 0 5.3-2.4 5.3-5.4s2.3-5.4 5.2-5.4H122v33.5q0 1-.2 1.8`})),J.createElement(`path`,{fill:u,d:`m149.1 33.3-6.8 2.6a1 1 0 0 1-1.3-1.2l2-6.2q-4.1-4.5-4.2-10.4c0-10 10.1-18.1 22.6-18.1S184 8.1 184 18.1s-10.1 18-22.6 18q-6.8 0-12.3-2.8`}),J.createElement(`g`,{fill:f,transform:`translate(149.7 15.4)`},J.createElement(`circle`,{cx:`20.7`,cy:`3.2`,r:`2.8`}),J.createElement(`path`,{d:`M5.7 5.6H0L2.9.7zM9.3.7h5v5h-5z`}))))},wp=()=>{let[,e]=c(),[t]=kt(`Empty`),{colorFill:n,colorFillTertiary:r,colorFillQuaternary:i,colorBgContainer:a}=e,{borderColor:o,shadowColor:s,contentColor:l}=(0,J.useMemo)(()=>({borderColor:Sp(n,a),shadowColor:Sp(r,a),contentColor:Sp(i,a)}),[n,r,i,a]);return J.createElement(`svg`,{width:`64`,height:`41`,viewBox:`0 0 64 41`,xmlns:`http://www.w3.org/2000/svg`},J.createElement(`title`,null,t?.description||`Empty`),J.createElement(`g`,{transform:`translate(0 1)`,fill:`none`,fillRule:`evenodd`},J.createElement(`ellipse`,{fill:s,cx:`32`,cy:`33`,rx:`32`,ry:`7`}),J.createElement(`g`,{fillRule:`nonzero`,stroke:o},J.createElement(`path`,{d:`M55 12.8 44.9 1.3Q44 0 42.9 0H21.1q-1.2 0-2 1.3L9 12.8V22h46z`}),J.createElement(`path`,{d:`M41.6 16c0-1.7 1-3 2.2-3H55v18.1c0 2.2-1.3 3.9-3 3.9H12c-1.7 0-3-1.7-3-3.9V13h11.2c1.2 0 2.2 1.3 2.2 3s1 2.9 2.2 2.9h14.8c1.2 0 2.2-1.4 2.2-3`,fill:l}))))},Tp=e=>{let{componentCls:t,margin:n,marginXS:r,marginXL:i,fontSize:a,lineHeight:o}=e;return{[t]:{marginInline:r,fontSize:a,lineHeight:o,textAlign:`center`,[`${t}-image`]:{height:e.emptyImgHeight,marginBottom:r,opacity:e.opacityImage,img:{height:`100%`},svg:{maxWidth:`100%`,height:`100%`,margin:`auto`}},[`${t}-description`]:{color:e.colorTextDescription},[`${t}-footer`]:{marginTop:n},"&-normal":{marginBlock:i,color:e.colorTextDescription,[`${t}-description`]:{color:e.colorTextDescription},[`${t}-image`]:{height:e.emptyImgHeightMD}},"&-small":{marginBlock:r,color:e.colorTextDescription,[`${t}-image`]:{height:e.emptyImgHeightSM}}}}},Ep=S(`Empty`,e=>{let{componentCls:t,controlHeightLG:n,calc:r}=e;return Tp(d(e,{emptyImgCls:`${t}-img`,emptyImgHeight:r(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:r(n).mul(.875).equal()}))}),Dp=J.createElement(Cp,null),Op=J.createElement(wp,null),kp=J.forwardRef((e,t)=>{let{className:n,rootClassName:r,prefixCls:i,image:a,description:o,children:s,imageStyle:c,style:l,classNames:u,styles:d,...p}=e,{getPrefixCls:m,direction:h,className:g,style:_,classNames:v,styles:y,image:x}=f(`empty`),S=m(`empty`,i),[C,T]=Ep(S),E=w(_),D=w(l),[O,k]=te([v,u],[y,E,d,D],{props:e}),[A]=kt(`Empty`),j=o===void 0?A?.description:o,M=typeof j==`string`?j:`empty`,N=a??x??Dp,P=null;P=typeof N==`string`?J.createElement(`img`,{draggable:!1,alt:M,src:N}):N;let F=J.useRef(null);return J.useImperativeHandle(t,()=>({nativeElement:F.current})),J.createElement(`div`,{ref:F,className:b(C,T,S,g,{[`${S}-normal`]:N===Op,[`${S}-rtl`]:h===`rtl`},n,r,O.root),style:k.root,...p},J.createElement(`div`,{className:b(`${S}-image`,O.image),style:{...c,...k.image}},P),R(j)&&J.createElement(`div`,{className:b(`${S}-description`,O.description),style:k.description},j),R(s)&&J.createElement(`div`,{className:b(`${S}-footer`,O.footer),style:k.footer},s))});kp.PRESENTED_IMAGE_DEFAULT=Dp,kp.PRESENTED_IMAGE_SIMPLE=Op;var Ap=e=>{let{componentName:t}=e,{getPrefixCls:n}=(0,J.useContext)(u),r=n(`empty`);switch(t){case`Table`:case`List`:return J.createElement(kp,{image:kp.PRESENTED_IMAGE_SIMPLE});case`Select`:case`TreeSelect`:case`Cascader`:case`Transfer`:case`Mentions`:return J.createElement(kp,{image:kp.PRESENTED_IMAGE_SIMPLE,className:`${r}-small`});case`Table.filter`:return null;default:return J.createElement(kp,null)}},jp=(e,t,n,r)=>{let i=J.useContext(u),{variant:a,[e]:o}=i,s=J.useContext(Xe),c=r?i[r]:void 0,l=o?.variant??c?.variant,d=t!==void 0||n===!1||s!==void 0||l!==void 0||a!==void 0,f;f=t===void 0?n===!1?`borderless`:s??l??a??`outlined`:t;let m=p.includes(f);return[f,m,d]},Mp=e=>{let t={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:e===`scroll`?`scroll`:`visible`,dynamicInset:!0};return{bottomLeft:{...t,points:[`tl`,`bl`],offset:[0,4]},bottomRight:{...t,points:[`tr`,`br`],offset:[0,4]},topLeft:{...t,points:[`bl`,`tl`],offset:[0,-4]},topRight:{...t,points:[`br`,`tr`],offset:[0,-4]}}};function Np(e,t){return e||Mp(t)}var Pp=e=>{let{optionHeight:t,optionFontSize:n,optionLineHeight:r,optionPadding:i}=e;return{position:`relative`,display:`block`,minHeight:t,padding:i,color:e.colorText,fontWeight:`normal`,fontSize:n,lineHeight:r,boxSizing:`border-box`}},Fp=e=>{let{antCls:t,componentCls:n}=e,r=`${n}-item`,i=`&${t}-slide-up-enter${t}-slide-up-enter-active`,a=`&${t}-slide-up-appear${t}-slide-up-appear-active`,s=`&${t}-slide-up-leave${t}-slide-up-leave-active`,c=`${n}-dropdown-placement-`,l=`${r}-option-selected`;return[{[`${n}-dropdown`]:{...o(e),position:`absolute`,top:-9999,zIndex:e.zIndexPopup,boxSizing:`border-box`,padding:e.paddingXXS,overflow:`hidden`,fontSize:e.fontSize,fontVariant:`initial`,backgroundColor:e.colorBgElevated,borderRadius:e.borderRadiusLG,outline:`none`,boxShadow:e.boxShadowSecondary,[`
          ${i}${c}bottomLeft,
          ${a}${c}bottomLeft
        `]:{animationName:Bu},[`
          ${i}${c}topLeft,
          ${a}${c}topLeft,
          ${i}${c}topRight,
          ${a}${c}topRight
        `]:{animationName:Hu},[`${s}${c}bottomLeft`]:{animationName:Vu},[`
          ${s}${c}topLeft,
          ${s}${c}topRight
        `]:{animationName:Uu},"&-hidden":{display:`none`},[`${n}-dropdown-list-scrollbar`]:{cursor:`pointer`,"&:hover":{backgroundColor:e.colorFillQuaternary}},[r]:{...Pp(e),cursor:`pointer`,transition:`background-color ${e.motionDurationSlow} ease`,borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:`default`},"&-option":{display:`flex`,"&-content":{flex:`auto`,...g},"&-state":{flex:`none`,display:`flex`,alignItems:`center`},[`&-selected:not(${r}-option-disabled)`]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,[`${r}-option-state`]:{color:e.colorPrimary}},[`&-active:not(${r}-option-disabled)`]:{backgroundColor:e.optionActiveBg},[`&-selected${r}-option-active:not(${r}-option-disabled)`]:{backgroundColor:e.controlItemBgActiveHover},"&-disabled":{[`&${r}-option-selected`]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:`not-allowed`},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}},"&-empty":{...Pp(e),color:e.colorTextDisabled}},[`${l}:has(+ ${l})`]:{borderEndStartRadius:0,borderEndEndRadius:0,[`& + ${l}`]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:`rtl`}}},Yu(e,`slide-up`),Yu(e,`slide-down`),zu(e,`move-up`),zu(e,`move-down`)]},Ip=e=>{let{antCls:t,componentCls:n}=e,r={background:`transparent`},i=[`> input[disabled]`,`> textarea[disabled]`,`> ${n}-input`,`> ${t}-input-affix-wrapper-disabled`,`> ${t}-input-search`].join(`, `);return{[`&${n}-customize`]:{border:0,padding:0,fontSize:`inherit`,lineHeight:`inherit`,[`${n}-placeholder`]:{display:`none`},[`${n}-content`]:{margin:0,padding:0,"&-value":{display:`none`}},[`&${n}-filled ${n}-content`]:{[`${t}-input-filled`]:r},[`&${n}-disabled ${n}-content`]:{[i]:r,"input[disabled], textarea[disabled]":r}}}},Lp=4,Rp=e=>{let{componentCls:t,calc:n,iconCls:r,paddingXS:i,paddingXXS:a,INTERNAL_FIXED_ITEM_MARGIN:o,lineWidth:s,lineType:c,colorIcon:l,colorIconHover:u,inputPaddingHorizontalBase:d,antCls:f}=e,[p,m]=A(f,`select`);return{"&-multiple":{[p(`multi-item-background`)]:e.multipleItemBg,[p(`multi-item-border-color`)]:`transparent`,[p(`multi-item-border-radius`)]:e.borderRadiusSM,[p(`multi-item-height`)]:e.multipleItemHeight,[p(`multi-padding-base`)]:`calc((${m(`height`)} - ${m(`multi-item-height`)}) / 2)`,[p(`multi-padding-vertical`)]:`calc(${m(`multi-padding-base`)} - ${o} - ${s})`,[p(`multi-item-padding-horizontal`)]:`calc(${d} - ${m(`multi-padding-vertical`)} - ${s} * 2)`,paddingBlock:m(`multi-padding-vertical`),paddingInlineStart:`calc(${m(`multi-padding-base`)} - ${s})`,[`${t}-prefix`]:{marginInlineStart:m(`multi-item-padding-horizontal`)},[`${t}-prefix + ${t}-content`]:{[`${t}-placeholder`]:{insetInlineStart:0},[`${t}-content-item${t}-content-item-suffix`]:{marginInlineStart:0}},[`${t}-placeholder`]:{position:`absolute`,lineHeight:m(`line-height`),insetInlineStart:m(`multi-item-padding-horizontal`),width:`calc(100% - ${m(`multi-item-padding-horizontal`)})`,top:`50%`,transform:`translateY(-50%)`},[`${t}-content`]:{flexWrap:`wrap`,alignItems:`center`,lineHeight:1,"&-item-prefix":{height:m(`font-size`)},"&-item":{lineHeight:1,maxWidth:`calc(100% - ${Lp}px)`},[`${t}-content-item-prefix + ${t}-content-item-suffix,
          ${t}-content-item-suffix:first-child`]:{marginInlineStart:m(`multi-item-padding-horizontal`)},[`${t}-selection-item`]:{lineHeight:`calc(${m(`multi-item-height`)} - ${s} * 2)`,border:`${s} ${c} ${m(`multi-item-border-color`)}`,display:`flex`,marginBlock:o,marginInlineEnd:n(o).mul(2).equal(),background:m(`multi-item-background`),borderRadius:m(`multi-item-border-radius`),paddingInlineStart:i,paddingInlineEnd:a,transition:[`height`,`line-height`,`padding`].map(t=>`${t} ${e.motionDurationSlow}`).join(`,`),"&-content":{...g,marginInlineEnd:a},"&-remove":{...oe(),display:`inline-flex`,alignItems:`center`,color:l,fontWeight:`bold`,fontSize:10,lineHeight:`inherit`,cursor:`pointer`,[`> ${r}`]:{verticalAlign:`-0.2em`},"&:hover":{color:u}}},[`${t}-input`]:{lineHeight:n(o).mul(2).add(m(`multi-item-height`)).equal(),width:`calc(var(--select-input-width, 0) * 1px)`,minWidth:Lp,maxWidth:`100%`,transition:`line-height ${e.motionDurationSlow}`}},[`&${t}-sm`]:{[p(`multi-item-height`)]:e.multipleItemHeightSM,[p(`multi-item-border-radius`)]:e.borderRadiusXS},[`&${t}-lg`]:{[p(`multi-item-height`)]:e.multipleItemHeightLG,[p(`multi-item-border-radius`)]:e.borderRadius},[`&${t}-filled`]:{[p(`multi-item-border-color`)]:e.colorSplit,[p(`multi-item-background`)]:e.colorBgContainer,[`&${t}-disabled`]:{[p(`multi-item-border-color`)]:`transparent`}}}}},zp=(e,t)=>{let{componentCls:n,antCls:r}=e,[i]=A(r,`select`),{border:a,borderHover:o,borderActive:s,borderOutline:c}=t,l=t.background||e.selectorBg||e.colorBgContainer;return{[i(`border-color`)]:a,[i(`background-color`)]:l,[i(`affix-color`)]:t.affixColor,[`&:not(${n}-disabled)`]:{"&:hover":{[i(`border-color`)]:o,[i(`background-color`)]:t.backgroundHover||l},[`&${n}-focused`]:{[i(`border-color`)]:s,[i(`background-color`)]:t.backgroundActive||l,boxShadow:`0 0 0 ${v(e.controlOutlineWidth)} ${c}`}},[`&${n}-disabled`]:{[i(`border-color`)]:t.borderDisabled||t.border,[i(`background-color`)]:t.backgroundDisabled||t.background}}},Bp=(e,t,n,r,i,a)=>{let{componentCls:o}=e;return{[`&${o}-${t}`]:[zp(e,n),{[`&${o}-status-error`]:zp(e,{...n,...r}),[`&${o}-status-warning`]:zp(e,{...n,...i})},a]}},Vp=(e,t)=>({outline:`${v(e.lineWidthFocus)} ${e.lineType} ${t}`,outlineOffset:v(e.calc(e.lineWidth).mul(-1).equal()),transition:[`outline-offset`,`outline`].map(e=>`${e} 0s`).join(`, `)}),Hp=e=>{let{componentCls:t,fontHeight:n,controlHeight:r,fontSizeIcon:i,showArrowPaddingInlineEnd:a,iconCls:s,antCls:c,max:l,calc:u}=e,[d,f]=A(c,`select`),p=l(u(a).sub(i).equal(),0);return{[t]:[{[d(`border-radius`)]:e.borderRadius,[d(`border-color`)]:`#000`,[d(`border-size`)]:e.lineWidth,[d(`background-color`)]:e.colorBgContainer,[d(`font-size`)]:e.fontSize,[d(`line-height`)]:e.lineHeight,[d(`font-height`)]:n,[d(`color`)]:e.colorText,[d(`affix-color`)]:e.colorText,[d(`height`)]:r,[d(`padding-horizontal`)]:u(e.paddingSM).sub(e.lineWidth).equal(),[d(`padding-vertical`)]:`calc((${f(`height`)} - ${f(`font-height`)}) / 2 - ${f(`border-size`)})`,...o(e),display:`inline-flex`,flexWrap:`nowrap`,position:`relative`,transition:`all ${e.motionDurationSlow}`,alignItems:`flex-start`,outline:0,cursor:`pointer`,borderRadius:f(`border-radius`),borderWidth:f(`border-size`),borderStyle:e.lineType,borderColor:f(`border-color`),background:f(`background-color`),fontSize:f(`font-size`),lineHeight:f(`line-height`),color:f(`color`),paddingInline:f(`padding-horizontal`),paddingBlock:f(`padding-vertical`),[`${t}-prefix`]:{color:f(`affix-color`),flex:`none`,lineHeight:1},[`${t}-placeholder`]:{...g,color:e.colorTextPlaceholder,pointerEvents:`none`,zIndex:1},[`${t}-content`]:{flex:`auto`,minWidth:0,position:`relative`,display:`flex`,marginInlineEnd:p,"&:before":{content:`"\\a0"`,width:0,overflow:`hidden`},"&-value":{visibility:`inherit`},"input[readonly]":{cursor:`inherit`,caretColor:`transparent`}},[`${t}-suffix`]:{flex:`none`,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,lineHeight:1,transition:[`opacity`,`color`].map(t=>`${t} ${e.motionDurationMid} ease`).join(`, `),"> :not(:last-child)":{marginInlineEnd:e.marginXS}},[`${t}-prefix, ${t}-suffix`]:{alignSelf:`center`,[s]:{verticalAlign:`top`}},"&-disabled":{background:e.colorBgContainerDisabled,[d(`color`)]:e.colorTextDisabled,cursor:`not-allowed`,input:{cursor:`not-allowed`}},"&-sm":{[d(`height`)]:e.controlHeightSM,[d(`padding-horizontal`)]:u(e.paddingXS).sub(e.lineWidth).equal(),[d(`border-radius`)]:e.borderRadiusSM,[`${t}-clear`]:{insetInlineEnd:f(`padding-horizontal`)}},"&-lg":{[d(`height`)]:e.controlHeightLG,[d(`font-size`)]:e.fontSizeLG,[d(`line-height`)]:e.lineHeightLG,[d(`font-height`)]:e.fontHeightLG,[d(`border-radius`)]:e.borderRadiusLG}},{[`&:not(${t}-customize)`]:{[`${t}-input`]:{outline:`none`,background:`transparent`,appearance:`none`,border:0,margin:0,padding:0,color:f(`color`),fontFamily:`inherit`,fontSize:`inherit`,"&::-webkit-search-cancel-button":{display:`none`,appearance:`none`}}}},{[`&-single:not(${t}-customize)`]:{[`${t}-input`]:{position:`absolute`,inset:0,lineHeight:`inherit`},[`${t}-content`]:{...g,alignSelf:`center`,"&-has-value":{display:`block`,"&:before":{display:`none`}},"&-has-search-value":{color:`transparent`,[`> *:not(${t}-input)`]:{opacity:0}},"&-value":{transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,zIndex:1,opacity:1}},[`&${t}-open ${t}-content`]:{"&-has-value":{opacity:.25},"&-has-search-value":{opacity:1,transition:`opacity ${e.motionDurationMid} ${e.motionEaseInOut}`,color:`transparent`,[`> *:not(${t}-input)`]:{opacity:0}}}}},{[`&-show-search:not(${t}-customize-input):not(${t}-disabled)`]:{cursor:`text`}},Rp(e),Bp(e,`outlined`,{border:e.colorBorder,borderHover:e.hoverBorderColor,borderActive:e.activeBorderColor,borderOutline:e.activeOutlineColor,borderDisabled:e.colorBorderDisabled},{border:e.colorError,borderHover:e.colorErrorBorderHover,borderActive:e.colorError,borderOutline:e.colorErrorOutline,affixColor:e.colorErrorAffix},{border:e.colorWarning,borderHover:e.colorWarningHover,borderActive:e.colorWarning,borderOutline:e.colorWarningOutline,affixColor:e.colorWarningAffix}),Bp(e,`filled`,{border:`transparent`,borderHover:`transparent`,borderActive:e.activeBorderColor,borderOutline:`transparent`,borderDisabled:e.colorBorderDisabled,background:e.colorFillTertiary,backgroundHover:e.colorFillSecondary,backgroundActive:e.colorBgContainer},{color:e.colorErrorText,background:e.colorErrorBg,backgroundHover:e.colorErrorBgHover,borderActive:e.colorError},{background:e.colorWarningBg,backgroundHover:e.colorWarningBgHover,borderActive:e.colorWarning}),Bp(e,`borderless`,{border:`transparent`,borderHover:`transparent`,borderActive:`transparent`,borderOutline:`transparent`,background:`transparent`},{},{},{[`&:not(${t}-disabled):has(input:focus-visible), &:not(${t}-disabled):has(textarea:focus-visible)`]:Vp(e,e.activeBorderColor),[`&${t}-status-error:not(${t}-disabled):has(input:focus-visible), &${t}-status-error:not(${t}-disabled):has(textarea:focus-visible)`]:Vp(e,e.colorError),[`&${t}-status-warning:not(${t}-disabled):has(input:focus-visible), &${t}-status-warning:not(${t}-disabled):has(textarea:focus-visible)`]:Vp(e,e.colorWarning)}),Bp(e,`underlined`,{border:e.colorBorder,borderHover:e.hoverBorderColor,borderActive:e.activeBorderColor,borderOutline:`transparent`},{border:e.colorError,borderHover:e.colorErrorBorderHover,borderActive:e.colorError},{border:e.colorWarning,borderHover:e.colorWarningHover,borderActive:e.colorWarning},{borderRadius:0,borderTopColor:`transparent`,borderInlineColor:`transparent`}),Ip(e)]}},Up=e=>{let{fontSize:t,lineHeight:n,lineWidth:r,lineWidthFocus:i,controlHeight:a,controlHeightSM:o,controlHeightLG:s,paddingXXS:c,controlPaddingHorizontal:l,zIndexPopupBase:u,colorText:d,fontWeightStrong:f,controlItemBgActive:p,controlItemBgHover:m,colorBgContainer:h,colorFillSecondary:g,colorBgContainerDisabled:_,colorTextDisabled:v,colorPrimaryHover:y,colorPrimary:b,controlOutline:x}=e,S=c*2,C=r*2,w=Math.min(a-S,a-C),T=Math.min(o-S,o-C),E=Math.min(s-S,s-C),D=Math.floor(c/2);return{lineWidthFocus:i===0?0:r,INTERNAL_FIXED_ITEM_MARGIN:D,zIndexPopup:u+50,optionSelectedColor:d,optionSelectedFontWeight:f,optionSelectedBg:p,optionActiveBg:m,optionPadding:`${(a-t*n)/2}px ${l}px`,optionFontSize:t,optionLineHeight:n,optionHeight:a,selectorBg:h,clearBg:h,singleItemHeightLG:s,multipleItemBg:g,multipleItemBorderColor:`transparent`,multipleItemHeight:w,multipleItemHeightSM:T,multipleItemHeightLG:E,multipleSelectorBgDisabled:_,multipleItemColorDisabled:v,multipleItemBorderColorDisabled:`transparent`,showArrowPaddingInlineEnd:Math.ceil(e.fontSize*1.25),hoverBorderColor:y,activeBorderColor:b,activeOutlineColor:x,selectAffixPadding:c}},Wp=e=>{let{antCls:t,componentCls:n,motionDurationMid:r,inputPaddingHorizontalBase:i}=e,a={[`${n}-clear`]:{opacity:1},[`${n}-suffix:not(:last-child)`]:{opacity:0,pointerEvents:`none`},[`&${n}-allow-clear:not(${n}-show-arrow):not(${n}-customize) ${n}-content`]:{marginInlineEnd:e.showArrowPaddingInlineEnd}};return{[n]:{...o(e),[`${n}-selection-item`]:{flex:1,fontWeight:`normal`,position:`relative`,userSelect:`none`,...g,[`> ${t}-typography`]:{display:`inline`}},[`${n}-prefix`]:{flex:`none`,marginInlineEnd:e.selectAffixPadding},[`${n}-clear`]:{position:`absolute`,top:`50%`,insetInlineStart:`auto`,insetInlineEnd:i,zIndex:1,display:`inline-block`,width:e.fontSizeIcon,height:e.fontSizeIcon,marginTop:e.calc(e.fontSizeIcon).mul(-1).div(2).equal(),padding:0,background:`transparent`,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,fontFamily:`inherit`,fontStyle:`normal`,lineHeight:1,textAlign:`center`,textTransform:`none`,appearance:`none`,border:0,cursor:`pointer`,opacity:0,transition:[`color`,`opacity`].map(e=>`${e} ${r} ease`).join(`, `),textRendering:`auto`,transform:`translateZ(0)`,"&:before":{display:`block`},"&:hover":{color:e.colorIcon}},"@media(hover:none)":a,"&:hover":a},[`${n}-status`]:{"&-error, &-warning, &-success, &-validating":{[`&${n}-has-feedback`]:{[`${n}-clear`]:{insetInlineEnd:e.calc(i).add(e.fontSize).add(e.paddingXS).equal()}}}}}},Gp=e=>{let{componentCls:t}=e;return[{[t]:{[`&${t}-in-form-item`]:{width:`100%`}}},Wp(e),Fp(e),{[`${t}-rtl`]:{direction:`rtl`}},Wt(e,{focusElCls:`${t}-focused`})]},Kp=S(`Select`,(e,{rootPrefixCls:t})=>{let n=d(e,{rootPrefixCls:t,inputPaddingHorizontalBase:e.calc(e.paddingSM).sub(e.lineWidth).equal(),multipleSelectItemHeight:e.multipleItemHeight,selectHeight:e.controlHeight});return[Gp(n),Hp(n)]},Up,{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}}),qp={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z`}}]},name:`check`,theme:`outlined`};function Jp(){return Jp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jp.apply(this,arguments)}var Yp=J.forwardRef((e,t)=>J.createElement(It,Jp({},e,{ref:t,icon:qp}))),Xp={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z`}}]},name:`down`,theme:`outlined`};function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zp.apply(this,arguments)}var Qp=J.forwardRef((e,t)=>J.createElement(It,Zp({},e,{ref:t,icon:Xp}))),$p={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z`}}]},name:`search`,theme:`outlined`};function em(){return em=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},em.apply(this,arguments)}var tm=J.forwardRef((e,t)=>J.createElement(It,em({},e,{ref:t,icon:$p})));function nm({suffixIcon:e,contextSuffixIcon:t,clearIcon:n,contextClearIcon:r,menuItemSelectedIcon:i,contextMenuItemSelectedIcon:a,removeIcon:o,contextRemoveIcon:s,loading:c,loadingIcon:l,contextLoadingIcon:u,searchIcon:d,contextSearchIcon:f,multiple:p,hasFeedback:m,showSuffixIcon:h,feedbackIcon:g,showArrow:_,componentName:v}){return J.useMemo(()=>{let v=Nt(n,r,J.createElement(Pt,null)),y=t=>e===null&&!m&&!_?null:J.createElement(J.Fragment,null,h!==!1&&t,m&&g),b=null;b=e===void 0?c?y(Nt(l,u,J.createElement(Ut,{spin:!0}))):({open:e,showSearch:n})=>y(e&&n?Nt(d,f,J.createElement(tm,null)):Nt(t,J.createElement(Qp,null))):y(e);let x=Nt(i,a,p?J.createElement(Yp,null):null),S=Nt(o,s,J.createElement(Lt,null));return{clearIcon:v,suffixIcon:b,itemIcon:x,removeIcon:S}},[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_])}function rm(e){return J.useMemo(()=>{if(e)return(...t)=>J.createElement(lt,{space:!0},e.apply(void 0,t))},[e])}function im(e,t){return t===void 0?e!==null:t}var am=`SECRET_COMBOBOX_MODE_DO_NOT_USE`,om=J.forwardRef((e,t)=>{let{prefixCls:n,bordered:r,className:i,rootClassName:a,getPopupContainer:o,popupClassName:s,dropdownClassName:l,listHeight:d=256,placement:p,listItemHeight:m,size:h,disabled:g,notFoundContent:_,status:v,builtinPlacements:y,dropdownMatchSelectWidth:x,popupMatchSelectWidth:S,direction:C,style:T,allowClear:E,variant:D,popupStyle:O,dropdownStyle:k,transitionName:A,tagRender:j,maxCount:M,prefix:N,dropdownRender:P,popupRender:F,onDropdownVisibleChange:I,onOpenChange:L,styles:R,classNames:z,clearIcon:ee,showSearch:B,...V}=e,{getPopupContainer:re,getPrefixCls:ie,renderEmpty:ae,direction:oe,virtual:H,popupMatchSelectWidth:se,popupOverflow:ce}=J.useContext(u),{showSearch:U,allowClear:le,style:W,styles:ue,className:de,classNames:fe,clearIcon:pe,loadingIcon:me,menuItemSelectedIcon:he,removeIcon:ge,suffixIcon:_e}=f(`select`),[,ve]=c(),ye=m??ve?.controlHeight,be=ie(`select`,n),xe=ie(),Se=C??oe,{compactSize:Ce,compactItemClassnames:we}=St(be,Se),[Te,Ee]=jp(`select`,D,r),De=vt(be),[Oe,ke]=Kp(be,De),G=J.useMemo(()=>{let{mode:t}=e;if(t!==`combobox`)return t===am?`combobox`:t},[e.mode]),Ae=G===`multiple`||G===`tags`,je=im(e.suffixIcon,e.showArrow),Me=S??x??se,Ne=rm(F||P),Pe=L||I,{status:Fe,hasFeedback:Ie,isFormItemInput:Le,feedbackIcon:Re}=J.useContext(st),ze=xp(Fe,v),Be;Be=_===void 0?G===`combobox`?null:ae?.(`Select`)||J.createElement(Ap,{componentName:`Select`}):_;let{suffixIcon:Ve,itemIcon:He,removeIcon:Ue,clearIcon:K}=nm({...V,multiple:Ae,hasFeedback:Ie,feedbackIcon:Re,showSuffixIcon:je,prefixCls:be,componentName:`Select`,clearIcon:ee,searchIcon:yp(B,`searchIcon`),contextClearIcon:pe,contextLoadingIcon:me,contextMenuItemSelectedIcon:he,contextRemoveIcon:ge,contextSearchIcon:yp(U,`searchIcon`),contextSuffixIcon:_e}),We=E??le,Ge=We===!0?{clearIcon:K}:We,Ke=B??U,qe=bt(V,[`suffixIcon`,`itemIcon`]),Je=ne(e=>h??Ce??e),Ye=J.useContext(Ht),Xe=g??Ye,Ze={...e,variant:Te,status:ze,disabled:Xe,size:Je},Qe=w(W),$e=w(T),[et,tt]=te([fe,z],[ue,Qe,R,$e],{props:Ze},{popup:{_default:`root`}}),nt=b(et.popup.root,s,l,{[`${be}-dropdown-${Se}`]:Se===`rtl`},a,ke,De,Oe),rt={...tt.popup?.root,...O??k},it=b({[`${be}-lg`]:Je===`large`,[`${be}-sm`]:Je===`small`,[`${be}-rtl`]:Se===`rtl`,[`${be}-${Te}`]:Ee,[`${be}-in-form-item`]:Le},bp(be,ze,Ie),we,de,i,et.root,a,ke,De,Oe),at=J.useMemo(()=>p===void 0?Se===`rtl`?`bottomRight`:`bottomLeft`:p,[p,Se]),[ot]=ht(`SelectLike`,tt.popup.root?.zIndex??rt.zIndex);return J.createElement(vp,{ref:t,virtual:H,classNames:et,styles:tt,showSearch:Ke,...qe,style:tt.root,popupMatchSelectWidth:Me,transitionName:yt(xe,`slide-up`,A),builtinPlacements:Np(y,ce),listHeight:d,listItemHeight:ye,mode:G,prefixCls:be,placement:at,direction:Se,prefix:N,suffixIcon:Ve,menuItemSelectedIcon:He,removeIcon:Ue,allowClear:Ge,notFoundContent:Be,className:it,getPopupContainer:o||re,popupClassName:nt,disabled:Xe,popupStyle:{...tt.popup.root,...rt,zIndex:ot},maxCount:Ae?M:void 0,tagRender:Ae?j:void 0,popupRender:Ne,onPopupVisibleChange:Pe})}),sm=md(om,`popupAlign`);om.SECRET_COMBOBOX_MODE_DO_NOT_USE=am,om.Option=Cf,om.OptGroup=Sf,om._InternalPanelDoNotUseOrYouWillBeFired=sm;var cm=[`xxxl`,`xxl`,`xl`,`lg`,`md`,`sm`,`xs`],lm=[].concat(cm).reverse(),um=e=>({xs:`(max-width: ${e.screenXSMax}px)`,sm:`(min-width: ${e.screenSM}px)`,md:`(min-width: ${e.screenMD}px)`,lg:`(min-width: ${e.screenLG}px)`,xl:`(min-width: ${e.screenXL}px)`,xxl:`(min-width: ${e.screenXXL}px)`,xxxl:`(min-width: ${e.screenXXXL}px)`}),dm=e=>{let t=e,n=[].concat(cm).reverse();return n.forEach((e,r)=>{let i=e.toUpperCase(),a=`screen${i}Min`,o=`screen${i}`;if(!(t[a]<=t[o]))throw Error(`${a}<=${o} fails : !(${t[a]}<=${t[o]})`);if(r<n.length-1){let e=`screen${i}Max`;if(!(t[o]<=t[e]))throw Error(`${o}<=${e} fails : !(${t[o]}<=${t[e]})`);let a=`screen${n[r+1].toUpperCase()}Min`;if(!(t[e]<=t[a]))throw Error(`${e}<=${a} fails : !(${t[e]}<=${t[a]})`)}}),e},fm=()=>{let[,e]=c(),t=um(dm(e));return J.useMemo(()=>{let e=new Map,n=-1,r={};return{responsiveMap:t,matchHandlers:{},dispatch(t){return r=t,e.forEach(e=>{e(r)}),e.size>=1},subscribe(t){return e.size||this.register(),n+=1,e.set(n,t),t(r),n},unsubscribe(t){e.delete(t),e.size||this.unregister()},register(){Object.entries(t).forEach(([e,t])=>{let n=({matches:t})=>{this.dispatch({...r,[e]:t})},i=window.matchMedia(t);I(i.addEventListener)&&i.addEventListener(`change`,n),this.matchHandlers[t]={mql:i,listener:n},n(i)})},unregister(){Object.values(t).forEach(e=>{let t=this.matchHandlers[e];I(t?.mql.removeEventListener)&&t.mql.removeEventListener(`change`,t?.listener)}),e.clear()}}},[t])};function pm(e=!0,t={}){let n=(0,J.useRef)(t),[,r]=Ll(),i=fm();return l(()=>{let t=i.subscribe(t=>{n.current=t,e&&r()});return()=>i.unsubscribe(t)},[e]),n.current}var mm=Gt,hm=[`parentNode`],gm=`form_item`;function _m(e){return e===void 0||e===!1?[]:Array.isArray(e)?e:[e]}function vm(e,t){if(!e.length)return;let n=e.join(`_`);return t?`${t}_${n}`:hm.includes(n)?`${gm}_${n}`:n}function ym(e,t,n,r,i,a){let o=r;return a===void 0?n.validating?o=`validating`:e.length?o=`error`:t.length?o=`warning`:(n.touched||i&&n.validated)&&(o=`success`):o=a,o}function bm(e){return _m(e).join(`_`)}function xm(e,t){let n=t.getFieldInstance(e),r=We(n);if(r)return r;let i=vm(_m(e),t.__INTERNAL__.name);if(i)return document.getElementById(i)}function Sm(e){let[t]=Ze(),n=J.useRef({}),r=J.useMemo(()=>e??{...t,__INTERNAL__:{itemRef:e=>t=>{let r=bm(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:(e,t={})=>{let{focus:n,...i}=t,a=xm(e,r);a&&(al(a,{scrollMode:`if-needed`,block:`nearest`,...i}),n&&r.focusField(e))},focusField:e=>{let t=r.getFieldInstance(e);I(t?.focus)?t.focus():xm(e,r)?.focus?.()},getFieldInstance:e=>{let t=bm(e);return n.current[t]}},[e,t]);return[r]}function Cm(e){return d(e,{inputAffixPadding:e.paddingXXS})}var wm=e=>{let{controlHeight:t,fontSize:n,lineHeight:r,lineWidth:i,lineWidthFocus:a,controlHeightSM:o,controlHeightLG:s,fontSizeLG:c,lineHeightLG:l,paddingSM:u,controlPaddingHorizontalSM:d,controlPaddingHorizontal:f,colorFillAlter:p,colorPrimaryHover:m,colorPrimary:h,controlOutlineWidth:g,controlOutline:_,colorErrorOutline:v,colorWarningOutline:y,colorBgContainer:b,inputFontSize:x,inputFontSizeLG:S,inputFontSizeSM:C}=e,w=x||n,T=C||w,E=S||c,D=Math.round((t-w*r)/2*10)/10-i,O=Math.round((o-T*r)/2*10)/10-i,k=Math.ceil((s-E*l)/2*10)/10-i;return{lineWidthFocus:a===0?0:i,paddingBlock:Math.max(D,0),paddingBlockSM:Math.max(O,0),paddingBlockLG:Math.max(k,0),paddingInline:u-i,paddingInlineSM:d-i,paddingInlineLG:f-i,addonBg:p,activeBorderColor:h,hoverBorderColor:m,activeShadow:`0 0 0 ${g}px ${_}`,errorActiveShadow:`0 0 0 ${g}px ${v}`,warningActiveShadow:`0 0 0 ${g}px ${y}`,hoverBg:b,activeBg:b,inputFontSize:w,inputFontSizeLG:E,inputFontSizeSM:T}},Tm=e=>({borderColor:e.hoverBorderColor,backgroundColor:e.hoverBg}),Em=e=>({color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorderDisabled,boxShadow:`none`,cursor:`not-allowed`,opacity:1,"input[disabled], textarea[disabled]":{cursor:`not-allowed`},"&:hover:not([disabled])":{...Tm(d(e,{hoverBorderColor:e.colorBorderDisabled,hoverBg:e.colorBgContainerDisabled}))}}),Dm=(e,t)=>({background:e.colorBgContainer,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:t.borderColor,"&:hover":{borderColor:t.hoverBorderColor,backgroundColor:e.hoverBg},"&:focus, &:focus-within":{borderColor:t.activeBorderColor,boxShadow:t.activeShadow,outline:0,backgroundColor:e.activeBg}}),Om=(e,t)=>({[`&${e.componentCls}-status-${t.status}:not(${e.componentCls}-disabled)`]:{...Dm(e,t),[`${e.componentCls}-prefix, ${e.componentCls}-suffix`]:{color:t.affixColor}},[`&${e.componentCls}-status-${t.status}${e.componentCls}-disabled`]:{borderColor:t.borderColor}}),km=(e,t)=>({"&-outlined":{...Dm(e,{borderColor:e.colorBorder,hoverBorderColor:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeShadow:e.activeShadow}),[`&${e.componentCls}-disabled, &[disabled]`]:{...Em(e)},...Om(e,{status:`error`,borderColor:e.colorError,hoverBorderColor:e.colorErrorBorderHover,activeBorderColor:e.colorError,activeShadow:e.errorActiveShadow,affixColor:e.colorErrorAffix}),...Om(e,{status:`warning`,borderColor:e.colorWarning,hoverBorderColor:e.colorWarningBorderHover,activeBorderColor:e.colorWarning,activeShadow:e.warningActiveShadow,affixColor:e.colorWarningAffix}),...t}}),Am=(e,t)=>({[`&${e.componentCls}-group-wrapper-status-${t.status}`]:{[`${e.componentCls}-group-addon`]:{borderColor:t.addonBorderColor,color:t.addonColor}}}),jm=e=>({"&-outlined":{[`${e.componentCls}-group`]:{"&-addon":{background:e.addonBg,border:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}},...Am(e,{status:`error`,addonBorderColor:e.colorError,addonColor:e.colorErrorText}),...Am(e,{status:`warning`,addonBorderColor:e.colorWarning,addonColor:e.colorWarningText}),[`&${e.componentCls}-group-wrapper-disabled`]:{[`${e.componentCls}-group-addon`]:{...Em(e)}}}}),Mm=`&:focus-visible, &:has(input:focus-visible), &:has(textarea:focus-visible)`,Nm=(e,t)=>({outline:`${v(e.lineWidthFocus)} ${e.lineType} ${t}`,outlineOffset:v(e.calc(e.lineWidth).mul(-1).equal()),transition:[`outline-offset`,`outline`].map(e=>`${e} 0s`).join(`, `)}),Pm=(e,t)=>({"&, & input, & textarea":{color:t.color},[Mm]:Nm(e,t.color),[`${e.componentCls}-prefix, ${e.componentCls}-suffix`]:{color:t.affixColor}}),Fm=(e,t)=>{let{componentCls:n}=e;return{"&-borderless":{background:`transparent`,border:`none`,paddingBlock:e.calc(e.paddingBlock).add(e.lineWidth).equal(),[`&${n}-sm, &${n}-affix-wrapper-sm`]:{paddingBlock:e.calc(e.paddingBlockSM).add(e.lineWidth).equal()},[`&${n}-lg, &${n}-affix-wrapper-lg`]:{paddingBlock:e.calc(e.paddingBlockLG).add(e.lineWidth).equal()},"&:focus, &:focus-within":{outline:`none`},[Mm]:Nm(e,e.activeBorderColor),[`&${n}-disabled, &[disabled]`]:{color:e.colorTextDisabled,cursor:`not-allowed`},[`&${n}-status-error`]:Pm(e,{color:e.colorError,affixColor:e.colorErrorAffix}),[`&${n}-status-warning`]:Pm(e,{color:e.colorWarning,affixColor:e.colorWarningAffix}),...t}}},Im=(e,t)=>({background:t.bg,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:`transparent`,"input&, & input, textarea&, & textarea":{color:t?.inputColor??`unset`},"&:hover":{background:t.hoverBg},"&:focus, &:focus-within":{outline:0,borderColor:t.activeBorderColor,backgroundColor:e.activeBg}}),Lm=(e,t)=>({[`&${e.componentCls}-status-${t.status}:not(${e.componentCls}-disabled)`]:{...Im(e,t),[`${e.componentCls}-prefix, ${e.componentCls}-suffix`]:{color:t.affixColor}}}),Rm=(e,t)=>({"&-filled":{...Im(e,{bg:e.colorFillTertiary,hoverBg:e.colorFillSecondary,activeBorderColor:e.activeBorderColor,inputColor:e.colorText}),[`&${e.componentCls}-disabled, &[disabled]`]:{...Em(e)},...Lm(e,{status:`error`,bg:e.colorErrorBg,hoverBg:e.colorErrorBgHover,activeBorderColor:e.colorError,inputColor:e.colorErrorText,affixColor:e.colorErrorAffix}),...Lm(e,{status:`warning`,bg:e.colorWarningBg,hoverBg:e.colorWarningBgHover,activeBorderColor:e.colorWarning,inputColor:e.colorWarningText,affixColor:e.colorWarningAffix}),...t}}),zm=(e,t)=>({[`&${e.componentCls}-group-wrapper-status-${t.status}`]:{[`${e.componentCls}-group-addon`]:{background:t.addonBg,color:t.addonColor}}}),Bm=e=>({"&-filled":{[`${e.componentCls}-group-addon`]:{background:e.colorFillTertiary,"&:last-child":{position:`static`}},...zm(e,{status:`error`,addonBg:e.colorErrorBg,addonColor:e.colorErrorText}),...zm(e,{status:`warning`,addonBg:e.colorWarningBg,addonColor:e.colorWarningText}),[`&${e.componentCls}-group-wrapper-disabled`]:{[`${e.componentCls}-group`]:{"&-addon":{background:e.colorFillTertiary,color:e.colorTextDisabled},"&-addon:first-child":{borderInlineStart:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderTop:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderBottom:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},"&-addon:last-child":{borderInlineEnd:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderTop:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderBottom:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`}}}}}),Vm=(e,t)=>({background:e.colorBgContainer,borderWidth:`${v(e.lineWidth)} 0`,borderStyle:`${e.lineType} none`,borderColor:`transparent transparent ${t.borderColor} transparent`,borderRadius:0,"&:hover":{borderColor:`transparent transparent ${t.hoverBorderColor} transparent`,backgroundColor:e.hoverBg},"&:focus, &:focus-within":{borderColor:`transparent transparent ${t.activeBorderColor} transparent`,outline:0,backgroundColor:e.activeBg}}),Hm=(e,t)=>({[`&${e.componentCls}-status-${t.status}:not(${e.componentCls}-disabled)`]:{...Vm(e,t),[`${e.componentCls}-prefix, ${e.componentCls}-suffix`]:{color:t.affixColor}},[`&${e.componentCls}-status-${t.status}${e.componentCls}-disabled`]:{borderColor:`transparent transparent ${t.borderColor} transparent`}}),Um=(e,t)=>({"&-underlined":{...Vm(e,{borderColor:e.colorBorder,hoverBorderColor:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeShadow:e.activeShadow}),[`&${e.componentCls}-disabled, &[disabled]`]:{color:e.colorTextDisabled,boxShadow:`none`,cursor:`not-allowed`,"&:hover":{borderColor:`transparent transparent ${e.colorBorder} transparent`}},"input[disabled], textarea[disabled]":{cursor:`not-allowed`},...Hm(e,{status:`error`,borderColor:e.colorError,hoverBorderColor:e.colorErrorBorderHover,activeBorderColor:e.colorError,activeShadow:e.errorActiveShadow,affixColor:e.colorErrorAffix}),...Hm(e,{status:`warning`,borderColor:e.colorWarning,hoverBorderColor:e.colorWarningBorderHover,activeBorderColor:e.colorWarning,activeShadow:e.warningActiveShadow,affixColor:e.colorWarningAffix}),...t}}),Wm=e=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:e,userSelect:`none`},"&:placeholder-shown":{textOverflow:`ellipsis`}}),Gm=e=>{let{paddingBlockLG:t,lineHeightLG:n,borderRadiusLG:r,paddingInlineLG:i}=e;return{padding:`${v(t)} ${v(i)}`,fontSize:e.inputFontSizeLG,lineHeight:n,borderRadius:r}},Km=e=>({padding:`${v(e.paddingBlockSM)} ${v(e.paddingInlineSM)}`,fontSize:e.inputFontSizeSM,borderRadius:e.borderRadiusSM}),qm=(e,t={})=>({position:`relative`,display:`inline-block`,width:`100%`,minWidth:0,padding:`${v(e.paddingBlock)} ${v(e.paddingInline)}`,color:e.colorText,fontSize:e.inputFontSize,lineHeight:e.lineHeight,borderRadius:e.borderRadius,transition:`all ${e.motionDurationMid}`,...Wm(e.colorTextPlaceholder),"&-lg":{...Gm(e),...t.largeStyle},"&-sm":{...Km(e),...t.smallStyle},"&-rtl, &-textarea-rtl":{direction:`rtl`}}),Jm=e=>{let{componentCls:t,antCls:n}=e;return{position:`relative`,display:`table`,width:`100%`,borderCollapse:`separate`,borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:e.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${t}, &-lg > ${t}-group-addon`]:{...Gm(e)},[`&-sm ${t}, &-sm > ${t}-group-addon`]:{...Km(e)},[`&-lg ${n}-select-single`]:{height:e.controlHeightLG},[`&-sm ${n}-select-single`]:{height:e.controlHeightSM},[`> ${t}`]:{display:`table-cell`,"&:not(:first-child):not(:last-child)":{borderRadius:0}},[`${t}-group`]:{"&-addon, &-wrap":{display:`table-cell`,width:1,whiteSpace:`nowrap`,verticalAlign:`middle`,"&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:`block !important`},"&-addon":{position:`relative`,padding:`0 ${v(e.paddingInline)}`,color:e.colorText,fontWeight:`normal`,fontSize:e.inputFontSize,textAlign:`center`,borderRadius:e.borderRadius,transition:`all ${e.motionDurationSlow}`,lineHeight:1,[`${n}-select`]:{margin:`${v(e.calc(e.paddingBlock).add(1).mul(-1).equal())} ${v(e.calc(e.paddingInline).mul(-1).equal())}`,[`&${n}-select-single:not(${n}-select-customize-input):not(${n}-pagination-size-changer)`]:{backgroundColor:`inherit`,border:`${v(e.lineWidth)} ${e.lineType} transparent`,boxShadow:`none`}},[`${n}-cascader-picker`]:{margin:`-9px ${v(e.calc(e.paddingInline).mul(-1).equal())}`,backgroundColor:`transparent`,[`${n}-cascader-input`]:{textAlign:`start`,border:0,boxShadow:`none`}}}},[t]:{width:`100%`,marginBottom:0,textAlign:`inherit`,"&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1}},[`> ${t}:first-child, ${t}-group-addon:first-child`]:{borderStartEndRadius:0,borderEndEndRadius:0,[`${n}-select`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${t}-affix-wrapper`]:{[`&:not(:first-child) ${t}`]:{borderStartStartRadius:0,borderEndStartRadius:0},[`&:not(:last-child) ${t}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${t}:last-child, ${t}-group-addon:last-child`]:{borderStartStartRadius:0,borderEndStartRadius:0,[`${n}-select`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`${t}-affix-wrapper`]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0},"&:not(:first-child)":{borderStartStartRadius:0,borderEndStartRadius:0}},[`&${t}-group-compact`]:{display:`block`,...U(),[`${t}-group-addon, ${t}-group-wrap, > ${t}`]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:e.lineWidth,"&:hover, &:focus":{zIndex:1}}},"& > *":{display:`inline-flex`,float:`none`,verticalAlign:`top`,borderRadius:0},[`
        & > ${t}-affix-wrapper,
        & > ${t}-number-affix-wrapper,
        & > ${n}-picker-range
      `]:{display:`inline-flex`},"& > *:not(:last-child)":{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal(),borderInlineEndWidth:e.lineWidth},[t]:{float:`none`},[`& > ${n}-select,
      & > ${n}-select-auto-complete ${t},
      & > ${n}-cascader-picker ${t},
      & > ${t}-group-wrapper ${t}`]:{borderInlineEndWidth:e.lineWidth,borderRadius:0,"&:hover, &:focus":{zIndex:1}},[`& > ${n}-select-focused`]:{zIndex:1},[`& > ${n}-select > ${n}-select-arrow`]:{zIndex:1},[`& > *:first-child,
      & > ${n}-select:first-child,
      & > ${n}-select-auto-complete:first-child ${t},
      & > ${n}-cascader-picker:first-child ${t}`]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius},[`& > *:last-child,
      & > ${n}-select:last-child,
      & > ${n}-cascader-picker:last-child ${t},
      & > ${n}-cascader-picker-focused:last-child ${t}`]:{borderInlineEndWidth:e.lineWidth,borderStartEndRadius:e.borderRadius,borderEndEndRadius:e.borderRadius},[`& > ${n}-select-auto-complete ${t}`]:{verticalAlign:`top`},[`${t}-group-wrapper + ${t}-group-wrapper`]:{marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),[`${t}-affix-wrapper`]:{}}}}},Ym=e=>{let{componentCls:t,controlHeightSM:n,lineWidth:r,calc:i}=e,a=i(n).sub(i(r).mul(2)).sub(16).div(2).equal();return{[t]:{...o(e),...qm(e),...km(e),...Rm(e),...Fm(e),...Um(e),'&[type="color"]':{height:e.controlHeight,[`&${t}-lg`]:{height:e.controlHeightLG},[`&${t}-sm`]:{height:n,paddingTop:a,paddingBottom:a}},'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':{appearance:`none`}}}},Xm=e=>{let{componentCls:t}=e;return{[`${t}-clear-icon`]:{margin:0,padding:0,lineHeight:0,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,verticalAlign:-1,cursor:`pointer`,transition:`color ${e.motionDurationSlow}`,border:`none`,outline:`none`,backgroundColor:`transparent`,"&:hover":{color:e.colorIcon},"&:focus-visible":{color:e.colorIcon,borderRadius:e.borderRadiusSM,...C(e)},"&:active":{color:e.colorText},"&-hidden":{visibility:`hidden`},"&-has-suffix":{margin:`0 ${v(e.inputAffixPadding)}`}}}},Zm=e=>{let{componentCls:t,inputAffixPadding:n,colorTextDescription:r,motionDurationSlow:i,colorIcon:a,colorIconHover:o}=e,s=`${t}-affix-wrapper`,c=`${t}-affix-wrapper-disabled`;return{[s]:{...qm(e),display:`inline-flex`,"&-focused, &:focus":{zIndex:1},[`> input${t}`]:{padding:0},[`> input${t}, > textarea${t}`]:{fontSize:`inherit`,border:`none`,borderRadius:0,outline:`none`,background:`transparent`,color:`inherit`,"&::-ms-reveal":{display:`none`},"&:focus":{boxShadow:`none !important`}},"&::before":{display:`inline-block`,width:0,visibility:`hidden`,content:`"\\a0"`},[t]:{"&-prefix, &-suffix":{display:`flex`,flex:`none`,alignItems:`center`,"> *:not(:last-child)":{marginInlineEnd:e.paddingXS}},"&-show-count-suffix":{color:r,direction:`ltr`},"&-show-count-has-suffix":{marginInlineEnd:e.paddingXXS},"&-prefix":{marginInlineEnd:n},"&-suffix":{marginInlineStart:n},"&-password-icon":{display:`inline-flex`,color:a,cursor:`pointer`,transition:`all ${i}`,"&:hover":{color:o}}},...Xm(e)},[`${t}-underlined`]:{borderRadius:0},[c]:{[`${t}-password-icon`]:{color:a,cursor:`not-allowed`,"&:hover":{color:a}}}}},Qm=e=>{let{componentCls:t,borderRadiusLG:n,borderRadiusSM:r}=e;return{[`${t}-group`]:{...o(e),...Jm(e),"&-rtl":{direction:`rtl`},"&-wrapper":{display:`inline-block`,width:`100%`,textAlign:`start`,verticalAlign:`top`,"&-rtl":{direction:`rtl`},"&-lg":{[`${t}-group-addon`]:{borderRadius:n,fontSize:e.inputFontSizeLG}},"&-sm":{[`${t}-group-addon`]:{borderRadius:r}},...jm(e),...Bm(e),[`&:not(${t}-compact-first-item):not(${t}-compact-last-item)${t}-compact-item`]:{[`${t}, ${t}-group-addon`]:{borderRadius:0}},[`&:not(${t}-compact-last-item)${t}-compact-first-item`]:{[`${t}, ${t}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${t}-compact-first-item)${t}-compact-last-item`]:{[`${t}, ${t}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&:not(${t}-compact-last-item)${t}-compact-item`]:{[`${t}-affix-wrapper`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${t}-compact-first-item)${t}-compact-item`]:{[`${t}-affix-wrapper`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}}},$m=e=>{let{componentCls:t}=e;return{[`${t}-out-of-range`]:{[`&, & input, & textarea, ${t}-show-count-suffix, ${t}-data-count`]:{color:e.colorError}}}},eh=S([`Input`,`Shared`],e=>{let t=d(e,Cm(e));return[Ym(t),Zm(t)]},wm,{resetFont:!1}),th=S([`Input`,`Component`],e=>{let t=d(e,Cm(e));return[Qm(t),$m(t),Wt(t,{focus:!0,focusElCls:`${t.componentCls}-affix-wrapper-focused`})]},wm,{resetFont:!1}),nh=(0,J.createContext)({});function rh(e){return e===`auto`?`1 1 auto`:ie(e)?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}var ih=J.forwardRef((e,t)=>{let{getPrefixCls:n,direction:r}=J.useContext(u),{gutter:i,wrap:a}=J.useContext(nh),{prefixCls:o,span:s,order:c,offset:l,push:d,pull:f,className:p,children:m,flex:h,style:g,..._}=e,v=n(`col`,o),y=n(),[x,S]=zt(v),[C]=A(y,`col`),w={},T={};lm.forEach(t=>{let n={},i=e[t];ie(i)?n.span=i:E(i)&&(n=i||{}),delete _[t],T={...T,[`${v}-${t}-${n.span}`]:re(n.span),[`${v}-${t}-order-${n.order}`]:n.order||n.order===0,[`${v}-${t}-offset-${n.offset}`]:n.offset||n.offset===0,[`${v}-${t}-push-${n.push}`]:n.push||n.push===0,[`${v}-${t}-pull-${n.pull}`]:n.pull||n.pull===0,[`${v}-rtl`]:r===`rtl`},(n.flex||n.flex===0)&&(T[`${v}-${t}-flex`]=!0,w[C(`${t}-flex`)]=rh(n.flex))});let D=b(v,{[`${v}-${s}`]:s!==void 0,[`${v}-order-${c}`]:c,[`${v}-offset-${l}`]:l,[`${v}-push-${d}`]:d,[`${v}-pull-${f}`]:f},p,T,x,S),O={};return i?.[0]&&(O.paddingInline=ie(i[0])?`${i[0]/2}px`:`calc(${i[0]} / 2)`),(h||h===0)&&(O.flex=rh(h),a===!1&&!O.minWidth&&(O.minWidth=0)),J.createElement(`div`,{..._,style:{...O,...g,...w},className:D,ref:t},m)});function ah(e,t){let n=[void 0,void 0],r=Array.isArray(e)?e:[e,void 0],i=t||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0,xxxl:!0};return r.forEach((e,t)=>{if(E(e))for(let r=0;r<cm.length;r++){let a=cm[r];if(i[a]&&e[a]!==void 0){n[t]=e[a];break}}else n[t]=e}),n}var oh=(e,t)=>{if(O(e))return e;if(E(e))for(let n=0;n<cm.length;n++){let r=cm[n];if(!t||!t[r])continue;let i=e[r];if(i!==void 0)return i}return``},sh=J.forwardRef((e,t)=>{let{prefixCls:n,justify:r,align:i,className:a,style:o,children:s,gutter:c=0,wrap:l,...d}=e,{getPrefixCls:f,direction:p}=J.useContext(u),m=pm(!0,null),h=oh(i,m),g=oh(r,m),_=f(`row`,n),[v,y]=Bt(_),x=ah(c,m),S=b(_,{[`${_}-no-wrap`]:l===!1,[`${_}-${g}`]:g,[`${_}-${h}`]:h,[`${_}-rtl`]:p===`rtl`},a,v,y),C={};x?.[0]&&(C.marginInline=ie(x[0])?`${x[0]/-2}px`:`calc(${x[0]} / -2)`);let[w,T]=x;C.rowGap=T;let E=J.useMemo(()=>({gutter:[w,T],wrap:l}),[w,T,l]);return J.createElement(nh.Provider,{value:E},J.createElement(`div`,{...d,className:S,style:{...C,...o},ref:t},s))}),ch=e=>{let{componentCls:t,borderRadius:n,paddingSM:r,colorBorder:i,paddingXS:a,fontSizeLG:s,fontSizeSM:c,borderRadiusLG:l,borderRadiusSM:u,colorBgContainerDisabled:d,lineWidth:f,lineType:p,antCls:m}=e,[h,g]=A(m,`space-addon`);return{[t]:[{...o(e),display:`inline-flex`,alignItems:`center`,gap:0,whiteSpace:`nowrap`,paddingInline:r,margin:0,borderWidth:f,borderStyle:p,borderRadius:n,"&:hover":{zIndex:0},[`&${t}-disabled`]:{color:e.colorTextDisabled},"&-large":{fontSize:s,borderRadius:l},"&-small":{paddingInline:a,borderRadius:u,fontSize:c},"&-compact-last-item":{borderEndStartRadius:0,borderStartStartRadius:0},"&-compact-first-item":{borderEndEndRadius:0,borderStartEndRadius:0},"&-compact-item:not(:first-child):not(:last-child)":{borderRadius:0},"&-compact-item:not(:last-child)":{borderInlineEndWidth:0},"&-compact-item:not(:first-child)":{borderInlineStartWidth:0}},{[h(`addon-border-color`)]:i,[h(`addon-background`)]:d,[h(`addon-border-color-outlined`)]:i,[h(`addon-background-filled`)]:d,borderColor:g(`addon-border-color`),background:g(`addon-background`),"&-variant-outlined":{[h(`addon-border-color`)]:g(`addon-border-color-outlined`)},"&-variant-filled":{[h(`addon-border-color`)]:`transparent`,[h(`addon-background`)]:g(`addon-background-filled`),[`&${t}-disabled`]:{[h(`addon-border-color`)]:i,[h(`addon-background`)]:d}},"&-variant-borderless":{border:`none`,background:`transparent`},"&-variant-underlined":{border:`none`,background:`transparent`}},{"&-status-error":{[h(`addon-border-color-outlined`)]:e.colorError,[h(`addon-background-filled`)]:e.colorErrorBg,color:e.colorError},"&-status-warning":{[h(`addon-border-color-outlined`)]:e.colorWarning,[h(`addon-background-filled`)]:e.colorWarningBg,color:e.colorWarning}}]}},lh=S(`Addon`,e=>[ch(e),Wt(e,{focus:!1})]),uh=J.forwardRef((e,t)=>{let{className:n,children:r,style:i,prefixCls:a,variant:o=`outlined`,disabled:s,status:c,...l}=e,{getPrefixCls:d,direction:f}=J.useContext(u),p=d(`space-addon`,a),[m,h]=lh(p),{compactItemClassnames:g,compactSize:_}=St(p,f),v=bp(p,c),y=b(p,m,g,h,`${p}-variant-${o}`,v,{[`${p}-${_}`]:_,[`${p}-disabled`]:s},n);return J.createElement(`div`,{ref:t,className:y,style:i,...l},r)});function dh(e){return!!(e.addonBefore||e.addonAfter)}function fh(e){return!!(e.prefix||e.suffix||e.allowClear)}function ph(e,t,n){let r=t.cloneNode(!0),i=Object.create(e,{target:{value:r},currentTarget:{value:r}});return r.value=n,typeof t.selectionStart==`number`&&typeof t.selectionEnd==`number`&&(r.selectionStart=t.selectionStart,r.selectionEnd=t.selectionEnd),r.setSelectionRange=(...e)=>{t.setSelectionRange(...e)},i}function mh(e,t,n,r){if(!n)return;let i=t;if(t.type===`click`){i=ph(t,e,``),n(i);return}if(e.type!==`file`&&r!==void 0){i=ph(t,e,r),n(i);return}n(i)}function hh(){return hh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hh.apply(this,arguments)}var gh=J.forwardRef((e,t)=>{let{inputElement:n,children:r,prefixCls:i,prefix:a,suffix:o,addonBefore:s,addonAfter:c,className:l,style:u,disabled:d,readOnly:f,focused:p,triggerFocus:m,allowClear:h,value:g,handleReset:_,hidden:v,classes:y,classNames:x,dataAttrs:S,styles:C,components:w,onClear:T}=e,E=r??n,D=w?.affixWrapper||`span`,O=w?.groupWrapper||`span`,k=w?.wrapper||`span`,A=w?.groupAddon||`span`,j=(0,J.useRef)(null),M=e=>{j.current?.contains(e.target)&&m?.()},N=fh(e),P=(0,J.cloneElement)(E,{value:g,className:b(E.props?.className,!N&&x?.variant)||null}),F=(0,J.useRef)(null);if(J.useImperativeHandle(t,()=>({nativeElement:F.current||j.current})),N){let e=null;if(h){let t=!d&&!f&&g&&!(typeof h==`object`&&h.disabled),n=`${i}-clear-icon`,r=typeof h==`object`&&h?.clearIcon?h.clearIcon:`✖`;e=J.createElement(`button`,{type:`button`,onClick:e=>{_?.(e),T?.()},onMouseDown:e=>e.preventDefault(),className:b(n,{[`${n}-hidden`]:!t,[`${n}-has-suffix`]:!!o},x?.clear),style:C?.clear},r)}let t=`${i}-affix-wrapper`,n=b(t,{[`${i}-disabled`]:d,[`${t}-disabled`]:d,[`${t}-focused`]:p,[`${t}-readonly`]:f,[`${t}-input-with-clear-btn`]:o&&h&&g},y?.affixWrapper,x?.affixWrapper,x?.variant),r=(o||h)&&J.createElement(`span`,{className:b(`${i}-suffix`,x?.suffix),style:C?.suffix},e,o);P=J.createElement(D,hh({className:n,style:C?.affixWrapper,onClick:M},S?.affixWrapper,{ref:j}),a&&J.createElement(`span`,{className:b(`${i}-prefix`,x?.prefix),style:C?.prefix},a),P,r)}if(dh(e)){let e=`${i}-group`,t=`${e}-addon`,n=`${e}-wrapper`,r=b(`${i}-wrapper`,e,y?.wrapper,x?.wrapper),a=b(n,{[`${n}-disabled`]:d},y?.group,x?.groupWrapper);P=J.createElement(O,{className:a,ref:F},J.createElement(k,{className:r},s&&J.createElement(A,{className:t},s),P,c&&J.createElement(A,{className:t},c)))}return J.cloneElement(P,{className:b(P.props?.className,l)||null,style:{...P.props?.style,...u},hidden:v})});function _h(e,t){return J.useMemo(()=>{let n={};t&&(n.show=typeof t==`object`&&t.formatter?t.formatter:!!t),n={...n,...e};let{show:r,...i}=n;return{...i,show:!!r,showFormatter:typeof r==`function`?r:void 0,strategy:i.strategy||(e=>e.length)}},[e,t])}function vh({countConfig:e,value:t,maxLength:n}){return J.useMemo(()=>{let r=e.max??n,i=e.strategy(t),a=!!r&&i>r,o=Number(r)>0;return{mergedMax:r,isOutOfRange:a,dataCount:e.show?e.showFormatter?e.showFormatter({value:t,count:i,maxLength:r}):`${i}${o?` / ${r}`:``}`:void 0}},[e,n,t])}function yh({countConfig:e,getTarget:t}){let[n,r]=J.useState(null),i=J.useRef(t);return J.useEffect(()=>{i.current=t},[t]),J.useEffect(()=>{n&&(i.current()?.setSelectionRange(...n),r(null))},[n]),J.useCallback((t,n)=>{let a=t;return!n&&e.exceedFormatter&&e.max&&e.strategy(t)>e.max&&(a=e.exceedFormatter(t,{max:e.max}),t!==a&&r([i.current()?.selectionStart||0,i.current()?.selectionEnd||0])),a},[e])}function bh(e,t){let[n,r]=H(e,t);return{value:n,setValue:r,formatValue:n==null?``:String(n)}}function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xh.apply(this,arguments)}var Sh=(0,J.forwardRef)((e,t)=>{let{autoComplete:n,onChange:r,onFocus:i,onBlur:a,onPressEnter:o,onKeyDown:s,onKeyUp:c,prefixCls:l=`rc-input`,disabled:u,htmlSize:d,className:f,maxLength:p,suffix:m,showCount:h,count:g,type:_=`text`,classes:v,classNames:y,styles:x,onCompositionStart:S,onCompositionEnd:C,...w}=e,[T,E]=(0,J.useState)(!1),D=(0,J.useRef)(!1),O=(0,J.useRef)(!1),k=(0,J.useRef)(null),A=(0,J.useRef)(null),j=e=>{k.current&&ee(k.current,e)},{setValue:M,formatValue:N}=bh(e.defaultValue,e.value),P=_h(g,h),{isOutOfRange:F,dataCount:I}=vh({countConfig:P,value:N,maxLength:p}),L=yh({countConfig:P,getTarget:()=>k.current});(0,J.useImperativeHandle)(t,()=>({focus:j,blur:()=>{k.current?.blur()},setSelectionRange:(e,t,n)=>{k.current?.setSelectionRange(e,t,n)},select:()=>{k.current?.select()},input:k.current,nativeElement:A.current?.nativeElement||k.current})),(0,J.useEffect)(()=>{O.current&&=!1,E(e=>e&&u?!1:e)},[u]);let R=(e,t,n)=>{let i=L(t,D.current);(n.source!==`compositionEnd`||t!==i)&&(M(i),k.current&&mh(k.current,e,r,i))},z=e=>{R(e,e.target.value,{source:`change`})},B=e=>{D.current=!1,R(e,e.currentTarget.value,{source:`compositionEnd`}),C?.(e)},V=e=>{o&&e.key===`Enter`&&!O.current&&!e.nativeEvent.isComposing&&(O.current=!0,o(e)),s?.(e)},te=e=>{e.key===`Enter`&&(O.current=!1),c?.(e)},ne=e=>{E(!0),i?.(e)},re=e=>{O.current&&=!1,E(!1),a?.(e)},ie=e=>{M(``),j(),k.current&&mh(k.current,e,r)},ae=F&&`${l}-out-of-range`;return J.createElement(gh,xh({},w,{prefixCls:l,className:b(f,ae),handleReset:ie,value:N,focused:T,triggerFocus:j,suffix:m||P.show?J.createElement(J.Fragment,null,P.show&&J.createElement(`span`,{className:b(`${l}-show-count-suffix`,{[`${l}-show-count-has-suffix`]:!!m},y?.count),style:{...x?.count}},I),m):null,disabled:u,classes:v,classNames:y,styles:x,ref:A}),(()=>{let t=bt(e,[`prefixCls`,`onPressEnter`,`addonBefore`,`addonAfter`,`prefix`,`suffix`,`allowClear`,`defaultValue`,`showCount`,`count`,`classes`,`htmlSize`,`styles`,`classNames`,`onClear`]);return J.createElement(`input`,xh({autoComplete:n},t,{onChange:z,onFocus:ne,onBlur:re,onKeyDown:V,onKeyUp:te,className:b(l,{[`${l}-disabled`]:u},y?.input),style:x?.input,ref:k,size:d,type:_,onCompositionStart:e=>{D.current=!0,S?.(e)},onCompositionEnd:B}))})())}),Ch=`
  min-height:0 !important;
  max-height:none !important;
  height:0 !important;
  visibility:hidden !important;
  overflow:hidden !important;
  position:absolute !important;
  z-index:-1000 !important;
  top:0 !important;
  right:0 !important;
  pointer-events: none !important;
`,wh=[`letter-spacing`,`line-height`,`padding-top`,`padding-bottom`,`font-family`,`font-weight`,`font-size`,`font-variant`,`text-rendering`,`text-transform`,`width`,`text-indent`,`padding-left`,`padding-right`,`border-width`,`box-sizing`,`word-break`,`white-space`],Th={},Eh;function Dh(e,t=!1){let n=e.getAttribute(`id`)||e.getAttribute(`data-reactid`)||e.getAttribute(`name`);if(t&&Th[n])return Th[n];let r=window.getComputedStyle(e),i=r.getPropertyValue(`box-sizing`)||r.getPropertyValue(`-moz-box-sizing`)||r.getPropertyValue(`-webkit-box-sizing`),a=parseFloat(r.getPropertyValue(`padding-bottom`))+parseFloat(r.getPropertyValue(`padding-top`)),o=parseFloat(r.getPropertyValue(`border-bottom-width`))+parseFloat(r.getPropertyValue(`border-top-width`)),s={sizingStyle:wh.map(e=>`${e}:${r.getPropertyValue(e)}`).join(`;`),paddingSize:a,borderSize:o,boxSizing:i};return t&&n&&(Th[n]=s),s}function Oh(e,t=!1,n=null,r=null){Eh||(Eh=document.createElement(`textarea`),Eh.setAttribute(`tab-index`,`-1`),Eh.setAttribute(`aria-hidden`,`true`),Eh.setAttribute(`name`,`hiddenTextarea`),document.body.appendChild(Eh)),e.getAttribute(`wrap`)?Eh.setAttribute(`wrap`,e.getAttribute(`wrap`)):Eh.removeAttribute(`wrap`);let{paddingSize:i,borderSize:a,boxSizing:o,sizingStyle:s}=Dh(e,t);Eh.setAttribute(`style`,`${s};${Ch}`),Eh.value=e.value||e.placeholder||``;let c,l,u,d=Eh.scrollHeight;if(o===`border-box`?d+=a:o===`content-box`&&(d-=i),n!==null||r!==null){Eh.value=` `;let e=Eh.scrollHeight-i;n!==null&&(c=e*n,o===`border-box`&&(c=c+i+a),d=Math.max(c,d)),r!==null&&(l=e*r,o===`border-box`&&(l=l+i+a),u=d>l?void 0:`hidden`,d=Math.min(l,d))}let f={height:d,overflowY:u,resize:`none`};return c&&(f.minHeight=c),l&&(f.maxHeight=l),f}function kh(){return kh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kh.apply(this,arguments)}var Ah=0,jh=1,Mh=2,Nh=J.forwardRef((e,t)=>{let{prefixCls:n,defaultValue:r,value:i,autoSize:a,onResize:o,className:c,style:u,disabled:d,onChange:f,onInternalAutoSize:p,...m}=e,[h,g]=H(r,i),_=h??``,v=e=>{g(e.target.value),f?.(e)},y=J.useRef(null);J.useImperativeHandle(t,()=>({textArea:y.current}));let[x,S]=J.useMemo(()=>a&&typeof a==`object`?[a.minRows,a.maxRows]:[],[a]),C=!!a,[w,T]=J.useState(Mh),[E,D]=J.useState(),O=()=>{T(Ah)};l(()=>{C&&O()},[i,x,S,C]),l(()=>{if(w===Ah)T(jh);else if(w===jh){let e=Oh(y.current,!1,x,S);T(Mh),D(e)}},[w]);let k=J.useRef(void 0),A=()=>{k.current!==void 0&&s.cancel(k.current)},j=e=>{w===Mh&&(o?.(e),a&&(A(),k.current=s(()=>{O()})))};J.useEffect(()=>A,[]);let M=C?E:null,N={...u,...M};return(w===Ah||w===jh)&&(N.overflowY=`hidden`,N.overflowX=`hidden`),J.createElement(mt,{onResize:j,disabled:!(a||o)},J.createElement(`textarea`,kh({},m,{ref:y,style:N,className:b(n,c,{[`${n}-disabled`]:d}),disabled:d,value:_,onChange:v})))});function Ph(){return Ph=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ph.apply(this,arguments)}var Fh=J.forwardRef(({defaultValue:e,value:t,onFocus:n,onBlur:r,onChange:i,allowClear:a,maxLength:o,onCompositionStart:s,onCompositionEnd:c,suffix:l,prefixCls:u=`rc-textarea`,showCount:d,count:f,className:p,style:m,disabled:h,hidden:g,classNames:_,styles:v,onResize:y,onClear:x,onPressEnter:S,readOnly:C,autoSize:w,onKeyDown:T,...E},D)=>{let[O,k]=J.useState(!1),A=J.useRef(!1),[j,M]=J.useState(null),N=(0,J.useRef)(null),P=(0,J.useRef)(null),F=()=>P.current?.textArea||null,{setValue:I,formatValue:L}=bh(e,t),R=_h(f,d),{isOutOfRange:z,dataCount:ee}=vh({countConfig:R,value:L,maxLength:o}),B=yh({countConfig:R,getTarget:()=>P.current?.textArea||null}),V=()=>{F()?.focus()};(0,J.useImperativeHandle)(D,()=>({resizableTextArea:P.current,focus:V,blur:()=>{F()?.blur()},nativeElement:N.current?.nativeElement||F()})),(0,J.useEffect)(()=>{k(e=>!h&&e)},[h]);let te=(e,t)=>{let n=B(t,A.current);I(n),mh(e.currentTarget,e,i,n)},ne=e=>{A.current=!0,s?.(e)},re=e=>{A.current=!1,te(e,e.currentTarget.value),c?.(e)},ie=e=>{te(e,e.target.value)},ae=e=>{e.key===`Enter`&&S&&!e.nativeEvent.isComposing&&S(e),T?.(e)},oe=e=>{k(!0),n?.(e)},H=e=>{k(!1),r?.(e)},se=e=>{I(``),V();let t=F();t&&mh(t,e,i)},ce=l;R.show&&(ce=J.createElement(J.Fragment,null,ce,J.createElement(`span`,{className:b(`${u}-data-count`,_?.count),style:v?.count},ee)));let U=e=>{y?.(e),F()?.style.height&&M(!0)},le=!w&&!d&&!a;return J.createElement(gh,{ref:N,value:L,allowClear:a,handleReset:se,suffix:ce,prefixCls:u,classNames:{..._,affixWrapper:b(_?.affixWrapper,{[`${u}-show-count`]:d,[`${u}-textarea-allow-clear`]:a})},disabled:h,focused:O,className:b(p,z&&`${u}-out-of-range`),style:{...m,...j&&!le?{height:`auto`}:{}},dataAttrs:typeof ee==`string`?{affixWrapper:{"data-count":ee}}:void 0,styles:v,hidden:g,readOnly:C,onClear:x},J.createElement(Nh,Ph({},E,{autoSize:w,maxLength:o,onKeyDown:ae,onChange:ie,onFocus:oe,onBlur:H,onCompositionStart:ne,onCompositionEnd:re,className:b(_?.textarea),style:{resize:m?.resize,...v?.textarea},disabled:h,prefixCls:u,onResize:U,ref:P,readOnly:C})))}),Ih=Sh;function Lh(e,t){let n=(0,J.useRef)([]),r=()=>{n.current.push(setTimeout(()=>{e.current?.input&&e.current?.input.getAttribute(`type`)===`password`&&e.current?.input.hasAttribute(`value`)&&e.current?.input.removeAttribute(`value`)}))};return(0,J.useEffect)(()=>(t&&r(),()=>n.current.forEach(e=>{e&&clearTimeout(e)})),[t]),r}function Rh(e){return!!(e.prefix||e.suffix||e.allowClear||e.showCount)}var zh=(0,J.forwardRef)((e,t)=>{let{prefixCls:n,bordered:r=!0,status:i,size:a,disabled:o,onBlur:s,onFocus:c,suffix:l,allowClear:u,addonAfter:d,addonBefore:p,className:m,style:h,styles:g,rootClassName:_,onChange:v,classNames:y,variant:x,...S}=e,{getPrefixCls:C,direction:T,allowClear:E,autoComplete:D,className:O,style:A,classNames:j,styles:M}=f(`input`),N=C(`input`,n),P=(0,J.useRef)(null),F=vt(N),[I,L]=eh(N,_);th(N,F);let{compactSize:R,compactItemClassnames:z}=St(N,T),ee=ne(e=>a??R??e),B=J.useContext(Ht),V=o??B,re={...e,size:ee,disabled:V},ie=w(A),ae=w(h),[oe,H]=te([j,y],[M,ie,g,ae],{props:re}),{status:se,hasFeedback:ce,feedbackIcon:U}=(0,J.useContext)(st),le=xp(se,i),W=Rh(e)||!!ce;(0,J.useRef)(W);let ue=Lh(P,!0),de=e=>{ue(),s?.(e)},fe=e=>{ue(),c?.(e)},pe=e=>{ue(),v?.(e)},me=(ce||l)&&J.createElement(J.Fragment,null,l,ce&&U),he=Il({allowClear:u,contextAllowClear:E,componentName:`Input`}),[ge,_e]=jp(`input`,x,r);return J.createElement(Ih,{ref:k(t,P),prefixCls:N,autoComplete:D,...S,disabled:V,onBlur:de,onFocus:fe,style:H.root,styles:H,suffix:me,allowClear:he,className:b(m,_,L,F,z,O,oe.root),onChange:pe,addonBefore:p&&J.createElement(lt,{form:!0,space:!0},p),addonAfter:d&&J.createElement(lt,{form:!0,space:!0},d),classNames:{...oe,input:b({[`${N}-sm`]:ee===`small`,[`${N}-lg`]:ee===`large`,[`${N}-rtl`]:T===`rtl`},oe.input,I),variant:b({[`${N}-${ge}`]:_e},bp(N,le)),affixWrapper:b({[`${N}-affix-wrapper-sm`]:ee===`small`,[`${N}-affix-wrapper-lg`]:ee===`large`,[`${N}-affix-wrapper-rtl`]:T===`rtl`},I),wrapper:b({[`${N}-group-rtl`]:T===`rtl`},I),groupWrapper:b({[`${N}-group-wrapper-sm`]:ee===`small`,[`${N}-group-wrapper-lg`]:ee===`large`,[`${N}-group-wrapper-rtl`]:T===`rtl`,[`${N}-group-wrapper-${ge}`]:_e},bp(`${N}-group-wrapper`,le,ce),I)}})});function Bh(e,t,n){return(e-t)/(n-t)}function Vh(e,t,n,r){let i=Bh(t,n,r),a={};switch(e){case`rtl`:a.right=`${i*100}%`,a.transform=`translateX(50%)`;break;case`btt`:a.bottom=`${i*100}%`,a.transform=`translateY(50%)`;break;case`ttb`:a.top=`${i*100}%`,a.transform=`translateY(-50%)`;break;default:a.left=`${i*100}%`,a.transform=`translateX(-50%)`}return a}function Hh(e,t){return Array.isArray(e)?e[t]:e}var Uh=J.createContext({min:0,max:0,direction:`ltr`,step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{},isHandleDisabled:()=>!1}),Wh=J.createContext({});function Gh(){return Gh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gh.apply(this,arguments)}var Kh=J.forwardRef((e,t)=>{let{prefixCls:n,value:r,valueIndex:i,onStartMove:a,onDelete:o,style:s,render:c,dragging:l,draggingDelete:u,onOffsetChange:d,onChangeComplete:f,onFocus:p,onMouseEnter:m,...h}=e,{min:g,max:_,direction:v,keyboard:y,range:x,tabIndex:S,ariaLabelForHandle:C,ariaLabelledByForHandle:w,ariaRequired:T,ariaValueTextFormatterForHandle:E,styles:D,classNames:O,isHandleDisabled:k}=J.useContext(Uh),A=k(i),j=`${n}-handle`,M=e=>{if(A){e.stopPropagation();return}a(e,i)},N=e=>{p?.(e,i)},P=e=>{m(e,i)},F=e=>{if(!A&&y){let t;switch(e.which||e.keyCode){case q.LEFT:t=v===`ltr`||v===`btt`?-1:1;break;case q.RIGHT:t=v===`ltr`||v===`btt`?1:-1;break;case q.UP:t=v===`ttb`?-1:1;break;case q.DOWN:t=v===`ttb`?1:-1;break;case q.HOME:t=`min`;break;case q.END:t=`max`;break;case q.PAGE_UP:t=2;break;case q.PAGE_DOWN:t=-2;break;case q.BACKSPACE:case q.DELETE:o?.(i)}t!==void 0&&(e.preventDefault(),d(t,i))}},I=e=>{switch(e.which||e.keyCode){case q.LEFT:case q.RIGHT:case q.UP:case q.DOWN:case q.HOME:case q.END:case q.PAGE_UP:case q.PAGE_DOWN:f?.()}},L=Vh(v,r,g,_),R={};i!==null&&(R={tabIndex:A?void 0:Hh(S,i)??void 0,role:`slider`,"aria-valuemin":g,"aria-valuemax":_,"aria-valuenow":r,"aria-disabled":A,"aria-label":Hh(C,i),"aria-labelledby":Hh(w,i),"aria-required":Hh(T,i),"aria-valuetext":Hh(E,i)?.(r),"aria-orientation":v===`ltr`||v===`rtl`?`horizontal`:`vertical`,onMouseDown:M,onTouchStart:M,onFocus:N,onMouseEnter:P,onKeyDown:F,onKeyUp:I});let z=J.createElement(`div`,Gh({ref:t,className:b(j,{[`${j}-${i+1}`]:i!==null&&x,[`${j}-dragging`]:l,[`${j}-dragging-delete`]:u,[`${j}-disabled`]:A},O.handle),style:{...L,...s,...D.handle}},R,h));return c&&(z=c(z,{index:i,prefixCls:n,value:r,dragging:l,draggingDelete:u})),z});function qh(){return qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qh.apply(this,arguments)}var Jh=J.forwardRef((e,t)=>{let{prefixCls:n,style:r,onStartMove:i,onOffsetChange:a,values:o,handleRender:s,activeHandleRender:c,draggingIndex:l,draggingDelete:u,onFocus:d,...f}=e,p=J.useRef({}),[m,h]=J.useState(!1),[g,_]=J.useState(-1),v=e=>{_(e),h(!0)},y=(e,t)=>{v(t),d?.(e)},b=(e,t)=>{v(t)};J.useImperativeHandle(t,()=>({focus:e=>{p.current[e]?.focus()},hideHelp:()=>{(0,Xc.flushSync)(()=>{h(!1)})}}));let x={prefixCls:n,onStartMove:i,onOffsetChange:a,render:s,onFocus:y,onMouseEnter:b,...f};return J.createElement(J.Fragment,null,o.map((e,t)=>{let n=l===t;return J.createElement(Kh,qh({ref:e=>{e?p.current[t]=e:delete p.current[t]},dragging:n,draggingDelete:n&&u,style:Hh(r,t),key:t,value:e,valueIndex:t},x))}),c&&m&&J.createElement(Kh,qh({key:`a11y`},x,{value:o[g],valueIndex:null,dragging:l!==-1,draggingDelete:u,render:c,style:{pointerEvents:`none`},tabIndex:void 0,"aria-hidden":!0})))}),Yh=e=>{let{prefixCls:t,style:n,children:r,value:i,onClick:a}=e,{min:o,max:s,direction:c,includedStart:l,includedEnd:u,included:d}=J.useContext(Uh),f=`${t}-text`,p=Vh(c,i,o,s);return J.createElement(`span`,{className:b(f,{[`${f}-active`]:d&&l<=i&&i<=u}),style:{...p,...n},onMouseDown:e=>{e.stopPropagation()},onClick:()=>{a(i)}},r)},Xh=e=>{let{prefixCls:t,marks:n=[],onClick:r}=e,i=`${t}-mark`;return n.length?J.createElement(`div`,{className:i},n.map(({value:e,style:t,label:n})=>J.createElement(Yh,{key:e,prefixCls:i,style:t,value:e,onClick:r},n))):null},Zh=e=>{let{prefixCls:t,value:n,style:r,activeStyle:i}=e,{min:a,max:o,direction:s,included:c,includedStart:l,includedEnd:u}=J.useContext(Uh),d=`${t}-dot`,f=c&&l<=n&&n<=u,p={...Vh(s,n,a,o),...typeof r==`function`?r(n):r};return f&&(p={...p,...typeof i==`function`?i(n):i}),J.createElement(`span`,{className:b(d,{[`${d}-active`]:f}),style:p})},Qh=e=>{let{prefixCls:t,marks:n,dots:r,style:i,activeStyle:a}=e,{min:o,max:s,step:c}=J.useContext(Uh),l=J.useMemo(()=>{let e=new Set;if(n.forEach(t=>{e.add(t.value)}),r&&c!==null){let t=o;for(;t<=s;)e.add(t),t+=c}return Array.from(e)},[o,s,c,r,n]);return J.createElement(`div`,{className:`${t}-step`},l.map(e=>J.createElement(Zh,{prefixCls:t,key:e,value:e,style:i,activeStyle:a})))},$h=e=>{let{prefixCls:t,style:n,start:r,end:i,index:a,onStartMove:o,replaceCls:s}=e,{direction:c,min:l,max:u,disabled:d,range:f,classNames:p}=J.useContext(Uh),m=`${t}-track`,h=Bh(r,l,u),g=Bh(i,l,u),_=e=>{!d&&o&&o(e,-1)},v={};switch(c){case`rtl`:v.right=`${h*100}%`,v.width=`${g*100-h*100}%`;break;case`btt`:v.bottom=`${h*100}%`,v.height=`${g*100-h*100}%`;break;case`ttb`:v.top=`${h*100}%`,v.height=`${g*100-h*100}%`;break;default:v.left=`${h*100}%`,v.width=`${g*100-h*100}%`}let y=s||b(m,{[`${m}-${a+1}`]:a!==null&&f,[`${t}-track-draggable`]:o},p.track);return J.createElement(`div`,{className:y,style:{...v,...n},onMouseDown:_,onTouchStart:_})},eg=e=>{let{prefixCls:t,style:n,values:r,startPoint:i,onStartMove:a}=e,{included:o,range:s,min:c,styles:l,classNames:u,isHandleDisabled:d}=J.useContext(Uh),f=J.useMemo(()=>r.some((e,t)=>d(t)),[d,r])?void 0:a,p=J.useMemo(()=>{if(!s){if(r.length===0)return[];let e=i??c,t=r[0];return[{start:Math.min(e,t),end:Math.max(e,t)}]}let e=[];for(let t=0;t<r.length-1;t+=1)e.push({start:r[t],end:r[t+1]});return e},[r,s,i,c]);if(!o)return null;let m=p?.length&&(u.tracks||l.tracks)?J.createElement($h,{index:null,prefixCls:t,start:p[0].start,end:p[p.length-1].end,replaceCls:b(u.tracks,`${t}-tracks`),style:l.tracks}):null;return J.createElement(J.Fragment,null,m,p.map(({start:e,end:r},i)=>J.createElement($h,{index:i,prefixCls:t,style:{...Hh(n,i),...l.track},start:e,end:r,key:i,onStartMove:f})))},tg=e=>{let t=J.useCallback(t=>typeof e==`boolean`?e:e[t]??!1,[e]),n=J.useCallback(n=>typeof e==`boolean`?[e,e&&n.length>0]:[n.length>0&&n.every((e,n)=>t(n)),n.some((e,n)=>t(n))],[e,t]);return J.useMemo(()=>[t,n],[t,n])},ng=130;function rg(e){let t=`targetTouches`in e?e.targetTouches[0]:e;return{pageX:t.pageX,pageY:t.pageY}}function ig(e,t,n,r,i,a,o,s,c,u,d,f){let[p,m]=J.useState(null),[h,g]=J.useState(-1),[_,v]=J.useState(!1),[y,b]=J.useState(n),[x,S]=J.useState(n),C=J.useRef(null),w=J.useRef(null),T=J.useRef(null),{onDragStart:E,onDragChange:D}=J.useContext(Wh);l(()=>{h===-1&&b(n)},[n,h]),J.useEffect(()=>()=>{C.current&&document.removeEventListener(`mousemove`,C.current),w.current&&document.removeEventListener(`mouseup`,w.current),T.current&&(C.current&&T.current.removeEventListener(`touchmove`,C.current),w.current&&T.current.removeEventListener(`touchend`,w.current))},[]);let O=(e,t,n)=>{t!==void 0&&m(t),b(e);let r=e;n&&(r=e.filter((e,t)=>t!==h)),o(r),D&&D({rawValues:e,deleteIndex:n?h:-1,draggingIndex:h,draggingValue:t})},k=F((e,t,n)=>{if(e===-1){if(x.some((e,t)=>f(t)))return;let e=x[0],n=x[x.length-1],o=r-e,s=i-n,c=t*(i-r);c=Math.max(c,o),c=Math.min(c,s),c=a(e+c)-e;let l=x.map(e=>e+c);O(l)}else{let a=(i-r)*t,o=[...y];o[e]=x[e];let s=c(o,a,e,`dist`);O(s.values,s.value,n)}});return[h,p,_,J.useMemo(()=>{let e=[...n].sort((e,t)=>e-t),t=[...y].sort((e,t)=>e-t),r={};t.forEach(e=>{r[e]=(r[e]||0)+1}),e.forEach(e=>{r[e]=(r[e]||0)-1});let i=+!!u;return Object.values(r).reduce((e,t)=>e+Math.abs(t),0)<=i?y:n},[n,y,u]),(r,i,a)=>{r.stopPropagation();let o=a||n;if(f(i))return;let c=o[i];g(i),m(c),S(o),b(o),v(!1);let{pageX:l,pageY:p}=rg(r),h=!1;E&&E({rawValues:o,draggingIndex:i,draggingValue:c});let _=n=>{n.preventDefault();let{pageX:r,pageY:a}=rg(n),o=r-l,s=a-p,{width:c,height:f}=e.current.getBoundingClientRect(),m,g;switch(t){case`btt`:m=-s/f,g=o;break;case`ttb`:m=s/f,g=o;break;case`rtl`:m=-o/c,g=s;break;default:m=o/c,g=s}h=u?Math.abs(g)>ng&&d<y.length:!1,v(h),k(i,m,h)},x=e=>{e.preventDefault(),document.removeEventListener(`mouseup`,x),document.removeEventListener(`mousemove`,_),T.current&&(C.current&&T.current.removeEventListener(`touchmove`,C.current),w.current&&T.current.removeEventListener(`touchend`,w.current)),C.current=null,w.current=null,T.current=null,s(h),g(-1),v(!1)};document.addEventListener(`mouseup`,x),document.addEventListener(`mousemove`,_),r.currentTarget.addEventListener(`touchend`,x),r.currentTarget.addEventListener(`touchmove`,_),C.current=_,w.current=x,T.current=r.currentTarget}]}var ag=(e,t,n,r,i,a)=>{let o=typeof i==`number`?i:0,s=n,c=r;for(let n=t-1;n>=0;--n)if(a(n)){s=e[n]+o;break}for(let n=t+1;n<e.length;n+=1)if(a(n)){c=e[n]-o;break}return[s,c]},og=(e,t,n,r,i,a)=>{let o=-1,s=r-n;return e.forEach((c,l)=>{if(a(l))return;let[u,d]=ag(e,l,n,r,i,a);if(u<=t&&t<=d){let e=Math.abs(t-c);e<=s&&(s=e,o=l)}}),o};function sg(e,t,n,r,i,a,o){let s=J.useCallback(n=>Math.max(e,Math.min(t,n)),[e,t]),c=J.useCallback(r=>{if(n!==null){let i=e+Math.round((s(r)-e)/n)*n,a=e=>(String(e).split(`.`)[1]||``).length,o=Math.max(a(n),a(t),a(e)),c=Number(i.toFixed(o));return e<=c&&c<=t?c:null}return null},[n,e,t,s]),l=J.useCallback(i=>{let a=s(i),o=r.map(e=>e.value);n!==null&&o.push(c(i)),o.push(e,t);let l=o[0],u=t-e;return o.forEach(e=>{let t=Math.abs(a-e);t<=u&&(l=e,u=t)}),l},[e,t,r,n,s,c]),u=(i,a,o,s=`unit`)=>{if(typeof a==`number`){let l,d=i[o],f=d+a,p=[];r.forEach(e=>{p.push(e.value)}),p.push(e,t),p.push(c(d));let m=a>0?1:-1;s===`unit`?p.push(c(d+m*n)):p.push(c(f)),p=p.filter(e=>e!==null).filter(e=>a<0?e<=d:e>=d),s===`unit`&&(p=p.filter(e=>e!==d));let h=s===`unit`?d:f;l=p[0];let g=Math.abs(l-h);if(p.forEach(e=>{let t=Math.abs(e-h);t<g&&(l=e,g=t)}),l===void 0)return a<0?e:t;if(s===`dist`)return l;if(Math.abs(a)>1){let e=[...i];return e[o]=l,u(e,a-m,o,s)}return l}return a===`min`?e:t},d=(e,t,n,r=`unit`)=>{let i=e[n],a=u(e,t,n,r);return{value:a,changed:a!==i}},f=e=>a===null&&e===0||typeof a==`number`&&e<a;return[l,(n,r,s,c=`unit`)=>{let p=n.map(l),m=p[s],[h,g]=ag(p,s,e,t,a,o);if(p[s]=u(p,r,s,c),p[s]=h<=g?Math.max(h,Math.min(g,p[s])):m,i===!1){let e=a||0;s>0&&p[s-1]!==m&&(p[s]=Math.max(p[s],p[s-1]+e)),s<p.length-1&&p[s+1]!==m&&(p[s]=Math.min(p[s],p[s+1]-e))}else if(typeof a==`number`||a===null){for(let n=s+1;n<p.length&&!o(n);n+=1){let r=!0;for(;f(p[n]-p[n-1])&&r;)({value:p[n],changed:r}=d(p,1,n));let[,i]=ag(p,n,e,t,a,o);p[n]=Math.min(p[n],i)}for(let n=s;n>0&&!o(n-1);--n){let r=!0;for(;f(p[n]-p[n-1])&&r;)({value:p[n-1],changed:r}=d(p,-1,n-1));let[i]=ag(p,n-1,e,t,a,o);p[n-1]=Math.max(p[n-1],i)}for(let n=p.length-1;n>0;--n){if(o(n)||o(n-1))continue;let r=!0;for(;f(p[n]-p[n-1])&&r;)({value:p[n-1],changed:r}=d(p,-1,n-1));let[i]=ag(p,n-1,e,t,a,o);p[n-1]=Math.max(p[n-1],i)}for(let n=0;n<p.length-1;n+=1){if(o(n)||o(n+1))continue;let r=!0;for(;f(p[n+1]-p[n])&&r;)({value:p[n+1],changed:r}=d(p,1,n+1));let[,i]=ag(p,n+1,e,t,a,o);p[n+1]=Math.min(p[n+1],i)}}return{value:p[s],values:p}}]}function cg(e){return(0,J.useMemo)(()=>{if(e===!0||!e)return[!!e,!1,!1,0];let{editable:t,draggableTrack:n,minCount:r,maxCount:i}=e;return[!0,!!t,!t&&!!n,r||0,i]},[e])}var lg=J.forwardRef((e,t)=>{let{prefixCls:n=`rc-slider`,className:r,style:i,classNames:a,styles:o,id:s,disabled:c=!1,keyboard:l=!0,autoFocus:u,onFocus:d,onBlur:f,min:p=0,max:m=100,step:h=1,value:g,defaultValue:_,range:v,count:y,onChange:x,onBeforeChange:S,onAfterChange:C,onChangeComplete:w,allowCross:T=!0,pushable:E=!1,reverse:D,vertical:O,included:k=!0,startPoint:A,trackStyle:j,handleStyle:M,railStyle:N,dotStyle:I,activeDotStyle:L,marks:R,dots:z,handleRender:ee,activeHandleRender:B,track:te,tabIndex:ne=0,ariaLabelForHandle:re,ariaLabelledByForHandle:ie,ariaRequired:ae,ariaValueTextFormatterForHandle:oe}=e,se=J.useRef(null),ce=J.useRef(null),[U,le]=H(_,g),W=J.useMemo(()=>O?D?`ttb`:`btt`:D?`rtl`:`ltr`,[D,O]),[ue,de,fe,pe,me]=cg(v),he=J.useMemo(()=>isFinite(p)?p:0,[p]),ge=J.useMemo(()=>isFinite(m)?m:100,[m]),_e=J.useMemo(()=>h!==null&&h<=0?1:h,[h]),ve=J.useMemo(()=>typeof E==`boolean`?E?_e:!1:E>=0&&E,[E,_e]),ye=J.useMemo(()=>{let e=R||{};return Object.keys(e).map(t=>{let n=e[t],r={value:Number(t)};return n&&typeof n==`object`&&!J.isValidElement(n)&&(`label`in n||`style`in n)?(r.style=n.style,r.label=n.label):r.label=n,r}).filter(({label:e})=>e||typeof e==`number`).sort((e,t)=>e.value-t.value)},[R]),[be,xe]=tg(c),[Se,Ce]=sg(he,ge,_e,ye,T,ve,be),we=J.useMemo(()=>{let e=U==null?[]:Array.isArray(U)?U:[U],[t=he]=e,n=U===null?[]:[t];if(ue){if(n=[...e],y||U===void 0){let e=y!==void 0&&y>=0?y+1:2;for(n=n.slice(0,e);n.length<e;)n.push(n[n.length-1]??he)}n.sort((e,t)=>e-t)}return n.forEach((e,t)=>{n[t]=Se(e)}),n},[U,ue,he,y,Se]),[Te,Ee]=J.useMemo(()=>xe(we),[xe,we]),De=de&&!Ee,Oe=e=>ue?e:e[0],ke=F(e=>{let t=[...e].sort((e,t)=>e-t);x&&!V(t,we,!0)&&x(Oe(t)),le(t)}),G=F(e=>{e&&se.current.hideHelp();let t=Oe(we);C?.(t),P(!C,"[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead."),w?.(t)}),Ae=e=>{if(Te||!De||we.length<=pe)return;let t=[...we];t.splice(e,1),S?.(Oe(t)),ke(t);let n=Math.max(0,e-1);se.current.hideHelp(),se.current.focus(n)},[je,Me,Ne,Pe,Fe]=ig(ce,W,we,he,ge,Se,ke,G,Ce,De,pe,be),Ie=(e,t)=>{if(!Te){let n=we.length?og(we,e,he,ge,ve,be):0;if(n===-1)return;let r=[...we],i=0,a=we.length?Math.abs(e-we[n]):ge-he;we.forEach((t,n)=>{t<e&&(i=n)});let o=n;De&&a!==0&&(!me||we.length<me)?(r.splice(i+1,0,e),o=i+1):(r[n]=e,o=n),ue&&!we.length&&y===void 0&&r.push(e);let s=Oe(r);S?.(s),ke(r),t?(document.activeElement?.blur?.(),se.current.focus(o),Fe(t,o,r)):(C?.(s),P(!C,"[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead."),w?.(s))}},Le=e=>{e.preventDefault();let{width:t,height:n,left:r,top:i,bottom:a,right:o}=ce.current.getBoundingClientRect(),{clientX:s,clientY:c}=e,l;switch(W){case`btt`:l=(a-c)/n;break;case`ttb`:l=(c-i)/n;break;case`rtl`:l=(o-s)/t;break;default:l=(s-r)/t}let u=he+l*(ge-he);Ie(Se(u),e)},[Re,ze]=J.useState(null),Be=(e,t)=>{if(!Te&&!be(t)){let n=Ce(we,e,t);S?.(Oe(we)),ke(n.values),ze({value:n.value,index:t})}};J.useEffect(()=>{if(Re!==null){let{value:e,index:t}=Re,n=we[t]===e?t:we.indexOf(e);n>=0&&se.current.focus(n)}ze(null)},[Re]);let Ve=J.useMemo(()=>fe&&_e===null?!1:fe,[fe,_e]),He=F((e,t)=>{Fe(e,t),S?.(Oe(we))}),Ue=je!==-1;J.useEffect(()=>{if(!Ue){let e=we.lastIndexOf(Me);se.current.focus(e)}},[Ue]);let K=J.useMemo(()=>[...Pe].sort((e,t)=>e-t),[Pe]),[We,Ge]=J.useMemo(()=>ue?[K[0],K[K.length-1]]:[he,K[0]],[K,ue,he]);J.useImperativeHandle(t,()=>({focus:()=>{se.current.focus(0)},blur:()=>{let{activeElement:e}=document;ce.current?.contains(e)&&e?.blur()}}));let Ke=J.useRef(u);J.useEffect(()=>{Ke.current&&se.current.focus(0)},[]);let qe=J.useMemo(()=>({min:he,max:ge,direction:W,disabled:Te,keyboard:l,step:_e,included:k,includedStart:We,includedEnd:Ge,range:ue,tabIndex:ne,ariaLabelForHandle:re,ariaLabelledByForHandle:ie,ariaRequired:ae,ariaValueTextFormatterForHandle:oe,styles:o||{},classNames:a||{},isHandleDisabled:be}),[he,ge,W,Te,l,_e,k,We,Ge,ue,ne,re,ie,ae,oe,o,a,be]);return J.createElement(Uh.Provider,{value:qe},J.createElement(`div`,{ref:ce,className:b(n,r,{[`${n}-disabled`]:Te,[`${n}-vertical`]:O,[`${n}-horizontal`]:!O,[`${n}-with-marks`]:ye.length}),style:i,onMouseDown:Le,id:s},J.createElement(`div`,{className:b(`${n}-rail`,a?.rail),style:{...N,...o?.rail}}),te!==!1&&J.createElement(eg,{prefixCls:n,style:j,values:we,startPoint:A,onStartMove:Ve?He:void 0}),J.createElement(Qh,{prefixCls:n,marks:ye,dots:z,style:I,activeStyle:L}),J.createElement(Jh,{ref:se,prefixCls:n,style:M,values:Pe,draggingIndex:je,draggingDelete:Ne,onStartMove:He,onOffsetChange:Be,onFocus:d,onBlur:f,handleRender:ee,activeHandleRender:B,onChangeComplete:G,onDelete:De?Ae:void 0}),J.createElement(Xh,{prefixCls:n,marks:ye,onClick:Ie})))}),ug=(0,J.createContext)({}),dg=J.forwardRef((e,t)=>{let{open:n,draggingDelete:r,value:i}=e,a=(0,J.useRef)(null),o=n&&!r,c=(0,J.useRef)(null);function l(){s.cancel(c.current),c.current=null}function u(){c.current=s(()=>{a.current?.forceAlign(),c.current=null})}return J.useEffect(()=>(o?u():l(),l),[o,e.title,i]),J.createElement(Ot,{ref:k(a,t),...e,open:o})}),fg=e=>{let{componentCls:t,antCls:n,controlSize:r,dotSize:i,marginFull:a,marginPart:s,colorFillContentHover:c,handleColorDisabled:l,calc:u,handleSize:d,handleSizeHover:f,handleActiveColor:p,handleActiveOutlineColor:m,handleLineWidth:h,handleLineWidthHover:g,motionDurationMid:_}=e,y={backgroundColor:e.colorBgElevated,cursor:`not-allowed`,width:d,height:d,boxShadow:`0 0 0 ${v(h)} ${l}`,insetInlineStart:0,insetBlockStart:0};return{[t]:{...o(e),position:`relative`,height:r,margin:`${v(s)} ${v(a)}`,padding:0,cursor:`pointer`,touchAction:`none`,userSelect:`none`,"&-vertical":{margin:`${v(a)} ${v(s)}`},[`${t}-rail`]:{position:`absolute`,backgroundColor:e.railBg,borderRadius:e.borderRadiusXS,transition:`background-color ${_}`},[`${t}-track,${t}-tracks`]:{position:`absolute`,transition:`background-color ${_}`},[`${t}-track`]:{backgroundColor:e.trackBg,borderRadius:e.borderRadiusXS},[`${t}-track-draggable`]:{boxSizing:`content-box`,backgroundClip:`content-box`,border:`solid rgba(0,0,0,0)`},"&:hover":{[`${t}-rail`]:{backgroundColor:e.railHoverBg},[`${t}-track`]:{backgroundColor:e.trackHoverBg},[`${t}-dot`]:{borderColor:c},[`${t}-handle:not(${t}-handle-disabled)::after`]:{boxShadow:`0 0 0 ${v(h)} ${e.colorPrimaryBorderHover}`},[`${t}-dot-active`]:{borderColor:e.dotActiveBorderColor}},[`${t}-handle`]:{position:`absolute`,width:d,height:d,outline:`none`,userSelect:`none`,"&-dragging-delete":{opacity:0},"&::before":{content:`""`,position:`absolute`,insetInlineStart:u(h).mul(-1).equal(),insetBlockStart:u(h).mul(-1).equal(),width:u(d).add(u(h).mul(2)).equal(),height:u(d).add(u(h).mul(2)).equal(),backgroundColor:`transparent`},"&::after":{content:`""`,position:`absolute`,insetBlockStart:0,insetInlineStart:0,width:d,height:d,backgroundColor:e.colorBgElevated,boxShadow:`0 0 0 ${v(h)} ${e.handleColor}`,outline:`0px solid transparent`,borderRadius:`50%`,cursor:`pointer`,transition:[`inset-inline-start`,`inset-block-start`,`width`,`height`,`box-shadow`,`outline`].map(e=>`${e} ${_}`).join(`, `)},"&:hover, &:active, &:focus":{[`&:not(${t}-handle-disabled)::before`]:{insetInlineStart:u(f).sub(d).div(2).add(g).mul(-1).equal(),insetBlockStart:u(f).sub(d).div(2).add(g).mul(-1).equal(),width:u(f).add(u(g).mul(2)).equal(),height:u(f).add(u(g).mul(2)).equal()},[`&:not(${t}-handle-disabled)::after`]:{boxShadow:`0 0 0 ${v(g)} ${p}`,outline:`6px solid ${m}`,width:f,height:f,insetInlineStart:e.calc(d).sub(f).div(2).equal(),insetBlockStart:e.calc(d).sub(f).div(2).equal()}}},[`&-lock ${t}-handle`]:{"&::before, &::after":{transition:`none`}},[`${t}-mark`]:{position:`absolute`,fontSize:e.fontSize},[`${t}-mark-text`]:{position:`absolute`,display:`inline-block`,color:e.colorTextDescription,textAlign:`center`,wordBreak:`keep-all`,cursor:`pointer`,userSelect:`none`,"&-active":{color:e.colorText}},[`${t}-step`]:{position:`absolute`,background:`transparent`,pointerEvents:`none`},[`${t}-dot`]:{position:`absolute`,width:i,height:i,backgroundColor:e.colorBgElevated,border:`${v(h)} solid ${e.dotBorderColor}`,borderRadius:`50%`,cursor:`pointer`,transition:`border-color ${e.motionDurationSlow}`,pointerEvents:`auto`,"&-active":{borderColor:e.dotActiveBorderColor}},[`&${t}-disabled`]:{cursor:`not-allowed`,[`${t}-rail`]:{backgroundColor:`${e.railBg} !important`},[`${t}-track`]:{backgroundColor:`${e.trackBgDisabled} !important`},[`
          ${t}-dot
        `]:{backgroundColor:e.colorBgElevated,borderColor:e.trackBgDisabled,boxShadow:`none`,cursor:`not-allowed`},[`${t}-handle::after`]:{...y},[`
          ${t}-mark-text,
          ${t}-dot
        `]:{cursor:`not-allowed !important`}},[`${t}-handle-disabled::after`]:{...y},[`&-tooltip ${n}-tooltip-container`]:{minWidth:`unset`}}}},pg=(e,t)=>{let{componentCls:n,railSize:r,handleSize:i,dotSize:a,marginFull:o,calc:s}=e,c=t?`paddingBlock`:`paddingInline`,l=t?`width`:`height`,u=t?`height`:`width`,d=t?`insetBlockStart`:`insetInlineStart`,f=t?`top`:`insetInlineStart`,p=s(r).mul(3).sub(i).div(2).equal(),m=s(i).sub(r).div(2).equal(),h=t?{borderWidth:`${v(m)} 0`,transform:`translateY(${v(s(m).mul(-1).equal())})`}:{borderWidth:`0 ${v(m)}`,transform:`translateX(${v(e.calc(m).mul(-1).equal())})`};return{[c]:r,[u]:s(r).mul(3).equal(),[`${n}-rail`]:{[l]:`100%`,[u]:r},[`${n}-track,${n}-tracks`]:{[u]:r},[`${n}-track-draggable`]:{...h},[`${n}-handle`]:{[d]:p},[`${n}-mark`]:{insetInlineStart:0,top:0,[f]:s(r).mul(3).add(t?0:o).equal(),[l]:`100%`},[`${n}-step`]:{insetInlineStart:0,top:0,[f]:r,[l]:`100%`,[u]:r},[`${n}-dot`]:{position:`absolute`,[d]:s(r).sub(a).div(2).equal()}}},mg=e=>{let{componentCls:t,marginPartWithMark:n}=e;return{[`${t}-horizontal`]:{...pg(e,!0),[`&${t}-with-marks`]:{marginBottom:n}}}},hg=e=>{let{componentCls:t}=e;return{[`${t}-vertical`]:{...pg(e,!1),height:`100%`}}},gg=S(`Slider`,e=>{let t=d(e,{marginPart:e.calc(e.controlHeight).sub(e.controlSize).div(2).equal(),marginFull:e.calc(e.controlSize).div(2).equal(),marginPartWithMark:e.calc(e.controlHeightLG).sub(e.controlSize).equal()});return[fg(t),mg(t),hg(t)]},e=>{let t=e.controlHeightLG/4,n=e.controlHeightSM/2,r=e.lineWidth+1,i=e.lineWidth+1.5,a=e.colorPrimary,o=new m(a).setA(.2).toRgbString();return{controlSize:t,railSize:4,handleSize:t,handleSizeHover:n,dotSize:8,handleLineWidth:r,handleLineWidthHover:i,railBg:e.colorFillTertiary,railHoverBg:e.colorFillSecondary,trackBg:e.colorPrimaryBorder,trackHoverBg:e.colorPrimaryBorderHover,handleColor:e.colorPrimaryBorder,handleActiveColor:a,handleActiveOutlineColor:o,handleColorDisabled:new m(e.colorTextDisabled).onBackground(e.colorBgContainer).toHexString(),dotBorderColor:e.colorBorderSecondary,dotActiveBorderColor:e.colorPrimaryBorder,trackBgDisabled:e.colorBgContainerDisabled}});function _g(e){return e||e===null?e:e=>ie(e)?e.toString():``}var vg=J.forwardRef((e,t)=>{let{prefixCls:n,range:r,className:i,rootClassName:a,style:o,disabled:c,tooltip:l={},onChangeComplete:u,classNames:d,styles:p,vertical:m,orientation:g,..._}=e,[,v]=xt(g,m),{getPrefixCls:y,direction:x,className:S,style:C,classNames:T,styles:E,getPopupContainer:D}=f(`slider`),O=J.useContext(Ht),k=c??O,A={...e,disabled:k,vertical:v},j=w(C),M=w(o),[N,P]=te([T,d],[E,j,p,M],{props:A}),{handleRender:F,direction:I}=J.useContext(ug),L=(I||x)===`rtl`,[R,z]=h(!1),[ee,B]=h(!1),V={...l},{open:ne,placement:re,getPopupContainer:ie,prefixCls:ae,formatter:oe}=V,H=ne,se=(R||ee)&&H!==!1,ce=_g(oe),[U,le]=h(!1),W=e=>{u?.(e),le(!1)},ue=(e,t)=>e||(t?L?`left`:`right`:`top`),de=y(`slider`,n),[fe,pe]=gg(de),me=b(i,S,N.root,a,{[`${de}-rtl`]:L,[`${de}-lock`]:U},fe,pe);L&&!v&&(_.reverse=!_.reverse),J.useEffect(()=>{let e=()=>{s(()=>{B(!1)},1)};return document.addEventListener(`mouseup`,e),()=>{document.removeEventListener(`mouseup`,e)}},[]);let he=r&&!H,ge=F||((e,t)=>{let{index:n}=t,r=e.props;function i(e,t){r[e]?.(t)}let a={...r,onMouseEnter:e=>{z(!0,!0),i(`onMouseEnter`,e)},onMouseLeave:e=>{z(!1),i(`onMouseLeave`,e)},onMouseDown:e=>{B(!0,!0),le(!0,!0),i(`onMouseDown`,e)},onFocus:e=>{B(!0,!0),i(`onFocus`,e)},onBlur:e=>{B(!1),i(`onBlur`,e)}},o=J.cloneElement(e,a),s=(!!H||se)&&ce!==null;return he?o:J.createElement(dg,{...V,prefixCls:y(`tooltip`,ae),title:ce?ce(t.value):void 0,value:t.value,open:s,placement:ue(re,v),key:n,classNames:{root:`${de}-tooltip`},getPopupContainer:ie||D},o)}),_e=he?(e,t)=>{let n=J.cloneElement(e,{style:{...e.props.style,visibility:`hidden`}});return J.createElement(dg,{...V,prefixCls:y(`tooltip`,ae),title:ce?ce(t.value):void 0,open:ce!==null&&se,placement:ue(re,v),key:`tooltip`,classNames:{root:`${de}-tooltip`},getPopupContainer:ie||D,draggingDelete:t.draggingDelete},n)}:void 0,ve={...P.root};return J.createElement(lg,{..._,classNames:N,styles:P,step:_.step,range:r,className:me,style:ve,disabled:k,vertical:v,ref:t,prefixCls:de,handleRender:ge,activeHandleRender:_e,onChangeComplete:W})});function yg(e){return[`small`,`middle`,`medium`,`large`].includes(e)}function bg(e){return e?ie(e):!1}var xg=J.createContext({latestIndex:0}),Sg=xg.Provider,Cg=e=>{let{className:t,prefix:n,index:r,children:i,separator:a,style:o,classNames:s,styles:c}=e,{latestIndex:l}=J.useContext(xg);return R(i)?J.createElement(J.Fragment,null,J.createElement(`div`,{className:t,style:o},i),r<l&&a&&J.createElement(`span`,{className:b(`${n}-item-separator`,s?.separator),style:c?.separator},a)):null},wg=e=>{let{componentCls:t,antCls:n}=e;return{[t]:{display:`inline-flex`,"&-rtl":{direction:`rtl`},"&-vertical":{flexDirection:`column`},"&-align":{flexDirection:`column`,"&-center":{alignItems:`center`},"&-start":{alignItems:`flex-start`},"&-end":{alignItems:`flex-end`},"&-baseline":{alignItems:`baseline`}},[`${t}-item:empty`]:{display:`none`},[`${t}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:`block`}}}},Tg=e=>{let{componentCls:t}=e;return{[t]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-medium, &-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-medium, &-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}},Eg=S(`Space`,e=>{let t=d(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[wg(t),Tg(t)]},()=>({}),{resetStyle:!1}),Dg=J.forwardRef((e,t)=>{let{getPrefixCls:n,direction:r,size:a,className:o,style:s,classNames:c,styles:l}=f(`space`),{size:u=a??`small`,align:d,className:p,rootClassName:m,children:h,direction:g,orientation:_,prefixCls:v,split:y,separator:x,style:S,vertical:C,wrap:T=!1,classNames:E,styles:D,...O}=e,[k,A]=Array.isArray(u)?u:[u,u],j=yg(A),M=yg(k),N=bg(A),P=bg(k),F=i(h,{keepEmpty:!0}),[I,L]=xt(_,C,g),z=d===void 0&&!L?`center`:d,ee=x??y,B=n(`space`,v),[V,ne]=Eg(B),re={...e,size:u,orientation:I,align:z},ie=w(s),ae=w(S),[oe,H]=te([c,E],[l,ie,D,ae],{props:re}),se=b(B,o,V,`${B}-${I}`,{[`${B}-rtl`]:r===`rtl`,[`${B}-align-${z}`]:z,[`${B}-gap-row-${A}`]:j,[`${B}-gap-col-${k}`]:M},p,m,ne,oe.root),ce=b(`${B}-item`,oe.item),U=F.map((e,t)=>{let n=e?.key||`${ce}-${t}`;return J.createElement(Cg,{prefix:B,classNames:oe,styles:H,className:ce,key:n,index:t,separator:ee,style:H.item},e)}),le=J.useMemo(()=>({latestIndex:F.reduce((e,t,n)=>R(t)?n:e,0)}),[F]);if(F.length===0)return null;let W={};return T&&(W.flexWrap=`wrap`),!M&&P&&(W.columnGap=k),!j&&N&&(W.rowGap=A),J.createElement(`div`,{ref:t,className:se,style:{...W,...H.root},...O},J.createElement(Sg,{value:le},U))});Dg.Compact=Ct,Dg.Addon=uh;var Og=(e,t)=>R(e)?E(e)&&!(0,J.isValidElement)(e)?{...t,...e}:{...t,title:e}:null;function kg(e){let[t,n]=h(e);return J.useEffect(()=>{n(e,{ms:e.length?0:10})},[e]),t}var Ag=e=>{let{componentCls:t,motionDurationFast:n,motionEaseInOut:r}=e,i=`${t}-show-help`,a=`${t}-show-help-item`;return{[i]:{transition:`opacity ${n} ${r}`,"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[a]:{overflow:`hidden`,transition:`${[`height`,`opacity`,`transform`].map(e=>`${e} ${n} ${r}`).join(`, `)} !important`,[`&${a}-appear, &${a}-enter`]:{transform:`translateY(-5px)`,opacity:0,"&-active":{transform:`translateY(0)`,opacity:1}},[`&${a}-leave-active`]:{transform:`translateY(-5px)`}}}}},jg=e=>({legend:{display:`block`,width:`100%`,marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:`inherit`,border:0,borderBottom:`${v(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},'input[type="search"]':{boxSizing:`border-box`},'input[type="radio"], input[type="checkbox"]':{lineHeight:`normal`},'input[type="file"]':{display:`block`},'input[type="range"]':{display:`block`,width:`100%`},"select[multiple], select[size]":{height:`auto`},"input[type='file']:focus, input[type='radio']:focus, input[type='checkbox']:focus":{outline:0,boxShadow:`0 0 0 ${v(e.controlOutlineWidth)} ${e.controlOutline}`},output:{display:`block`,paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),Mg=(e,t)=>{let{formItemCls:n}=e;return{[n]:{[`${n}-label > label`]:{height:t},[`${n}-control-input`]:{minHeight:t}}}},Ng=e=>{let{componentCls:t}=e;return{[t]:{...o(e),...jg(e),[`${t}-text`]:{display:`inline-block`,paddingInlineEnd:e.paddingSM},"&-small":{...Mg(e,e.controlHeightSM)},"&-large":{...Mg(e,e.controlHeightLG)}}}},Pg=e=>{let{formItemCls:t,iconCls:n,rootPrefixCls:r,antCls:i,labelRequiredMarkColor:a,labelColor:s,labelFontSize:c,labelHeight:l,labelColonMarginInlineStart:u,labelColonMarginInlineEnd:d,itemMarginBottom:f}=e,[p]=A(i,`grid`);return{[t]:{...o(e),marginBottom:f,verticalAlign:`top`,"&-with-help":{transition:`none`},[`&-hidden,
        &-hidden${i}-row`]:{display:`none`},[`${t}-label`]:{flexGrow:0,overflow:`hidden`,whiteSpace:`nowrap`,textAlign:`end`,verticalAlign:`middle`,"&-left":{textAlign:`start`},"&-wrap":{overflow:`unset`,lineHeight:e.lineHeight,whiteSpace:`unset`,"> label":{verticalAlign:`middle`,textWrap:`balance`}},"> label":{position:`relative`,display:`inline-flex`,alignItems:`center`,maxWidth:`100%`,height:l,color:s,fontSize:c,[`> ${n}`]:{fontSize:e.fontSize,verticalAlign:`top`},[`&${t}-required`]:{"&::before":{display:`inline-block`,marginInlineEnd:e.marginXXS,color:a,fontSize:e.fontSize,fontFamily:`sans-serif`,lineHeight:1,content:`"*"`},[`&${t}-required-mark-hidden, &${t}-required-mark-optional`]:{"&::before":{display:`none`}}},[`${t}-optional`]:{display:`inline-block`,marginInlineStart:e.marginXXS,color:e.colorTextDescription,[`&${t}-required-mark-hidden`]:{display:`none`}},[`${t}-tooltip`]:{color:e.colorTextDescription,cursor:`help`,writingMode:`horizontal-tb`,marginInlineStart:e.marginXXS},"&::after":{content:`":"`,position:`relative`,marginBlock:0,marginInlineStart:u,marginInlineEnd:d},[`&${t}-no-colon::after`]:{content:`"\\a0"`}}},[`${t}-control`]:{[p(`display`)]:`flex`,flexDirection:`column`,flexGrow:1,[`&:first-child:not([class^="'${r}-col-'"]):not([class*="' ${r}-col-'"])`]:{width:`100%`},"&-input":{position:`relative`,display:`flex`,alignItems:`center`,minHeight:e.controlHeight,"&-content":{flex:`auto`,maxWidth:`100%`,[`&:has(> ${i}-switch:only-child, > ${i}-rate:only-child)`]:{display:`flex`,alignItems:`center`}}}},[t]:{"&-additional":{display:`flex`,flexDirection:`column`},"&-explain, &-extra":{clear:`both`,color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:`100%`},"&-extra":{minHeight:e.controlHeightSM,transition:`color ${e.motionDurationMid} ${e.motionEaseOut}`},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},[`&-with-help ${t}-explain`]:{height:`auto`,opacity:1},[`${t}-feedback-icon`]:{fontSize:e.fontSize,textAlign:`center`,visibility:`visible`,animationName:Kt,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:`none`,"&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}}}},Fg=e=>({padding:e.verticalLabelPadding,whiteSpace:`initial`,textAlign:`start`,"> label":{margin:0,"&::after":{visibility:`hidden`}}}),Ig=e=>({...Fg(e),margin:e.verticalLabelMargin}),Lg=e=>{let[t]=A(e.antCls,`form`);return{...Fg(e),[t(`item-label-margin`)]:e.verticalLabelMargin}},Rg=e=>{let{antCls:t,formItemCls:n}=e;return{[`${n}-horizontal`]:{[`${n}-label`]:{flexGrow:0},[`${n}-control`]:{flex:`1 1 0`,minWidth:0},[`${n}-label[class$='-24'], ${n}-label[class*='-24 ']`]:{[`& + ${n}-control`]:{minWidth:`unset`}},[`> ${n}-row > ${t}-col-24${n}-label,
        > ${n}-row > ${t}-col-xl-24${n}-label`]:Ig(e)}}},zg=e=>{let{componentCls:t,formItemCls:n,inlineItemMarginBottom:r}=e;return{[`${t}-inline`]:{display:`flex`,flexWrap:`wrap`,[`${n}-inline`]:{flex:`none`,marginInlineEnd:e.margin,marginBottom:r,"&-row":{flexWrap:`nowrap`},[`> ${n}-label,
        > ${n}-control`]:{display:`inline-block`,verticalAlign:`top`},[`> ${n}-label`]:{flex:`none`},[`${t}-text`]:{display:`inline-block`},[`${n}-has-feedback`]:{display:`inline-block`}}}}},Bg=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{[`${n}:not(${n}-vertical) > ${n}-row > ${n}-label`]:Ig(e),[`${t}:not(${t}-inline)`]:{[n]:{flexWrap:`wrap`,[`${n}-label, ${n}-control`]:{[`&:not([class*=" ${r}-col-xs"])`]:{flex:`0 0 100%`,maxWidth:`100%`}}}}}},Vg=e=>{let{componentCls:t,formItemCls:n,antCls:r,verticalLabelHeight:i}=e,[a,o]=A(r,`form`);return{[n]:{[a(`item-label-margin`)]:`initial`},[`${n}-label`]:{margin:o(`item-label-margin`)},[`${n}-vertical`]:{[`${n}-row`]:{flexDirection:`column`},[`${n}-label > label`]:{height:i},[`${n}-control`]:{width:`100%`},[`> ${n}-row > ${n}-label,
        > ${n}-row > ${r}-col-24${n}-label,
        > ${n}-row > ${r}-col-xl-24${n}-label`]:Lg(e)},[`@media (max-width: ${v(e.screenXSMax)})`]:[Bg(e),{[t]:{[`${n}:not(${n}-horizontal):not(${n}-vertical)`]:{[`> ${n}-row > ${r}-col-xs-24${n}-label`]:Ig(e)}}}],[`@media (max-width: ${v(e.screenSMMax)})`]:{[t]:{[`${n}:not(${n}-horizontal):not(${n}-vertical)`]:{[`> ${n}-row > ${r}-col-sm-24${n}-label`]:Ig(e)}}},[`@media (max-width: ${v(e.screenMDMax)})`]:{[t]:{[`${n}:not(${n}-horizontal):not(${n}-vertical)`]:{[`> ${n}-row > ${r}-col-md-24${n}-label`]:Ig(e)}}},[`@media (max-width: ${v(e.screenLGMax)})`]:{[t]:{[`${n}:not(${n}-horizontal):not(${n}-vertical)`]:{[`> ${n}-row > ${r}-col-lg-24${n}-label`]:Ig(e)}}}}},Hg=e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,verticalLabelHeight:e.labelHeight??`auto`,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:`0 0 ${e.paddingXS}px`,verticalLabelMargin:0,inlineItemMarginBottom:0}),Ug=(e,t)=>d(e,{formItemCls:`${e.componentCls}-item`,rootPrefixCls:t}),Wg=S(`Form`,(e,{rootPrefixCls:t})=>{let n=Ug(e,t);return[Ng(n),Pg(n),Ag(n),Rg(n),zg(n),Vg(n),ju(n),Kt]},Hg,{order:-1e3}),Gg=[];function Kg(e,t,n,r=0){return{key:typeof e==`string`?e:`${t}-${r}`,error:e,errorStatus:n}}var qg=({help:e,helpStatus:t,errors:n=Gg,warnings:r=Gg,className:i,fieldId:a,onVisibleChanged:o})=>{let{prefixCls:s}=J.useContext(tt),{classNames:c,styles:l}=J.useContext(it),u=`${s}-item-explain`,d=vt(s),[f,p]=Wg(s,d),m=J.useMemo(()=>gt(s),[s]),h=kg(n),g=kg(r),_=re(e),v=J.useMemo(()=>_?[Kg(e,`help`,t)]:[].concat(x(h.map((e,t)=>Kg(e,`error`,`error`,t))),x(g.map((e,t)=>Kg(e,`warning`,`warning`,t)))),[e,t,_,h,g]),y=J.useMemo(()=>{let e={};return v.forEach(({key:t})=>{e[t]=(e[t]||0)+1}),v.map((t,n)=>({...t,key:e[t.key]>1?`${t.key}-fallback-${n}`:t.key}))},[v]),S={};return a&&(S.id=`${a}_help`),J.createElement(Ke,{motionDeadline:m.motionDeadline,motionName:`${s}-show-help`,visible:!!y.length,onVisibleChanged:o},e=>{let{className:t,style:n}=e;return J.createElement(`div`,{...S,className:b(u,t,c?.help,p,d,i,f),style:{...l?.help,...n}},J.createElement(Ge,{keys:y,...gt(s),motionName:`${s}-show-help-item`,component:!1},e=>{let{key:t,error:n,errorStatus:r,className:i,style:a}=e;return J.createElement(`div`,{key:t,className:b(i,c?.helpItem,{[`${u}-${r}`]:r}),style:{...l?.helpItem,...a}},n)}))})},Jg=J.forwardRef((e,t)=>{let n=J.useContext(Ht),{getPrefixCls:r,direction:i,requiredMark:a,colon:o,scrollToFirstError:s,className:c,style:l,styles:u,classNames:d,tooltip:p,labelAlign:m,labelWrap:h}=f(`form`),{prefixCls:g,className:_,rootClassName:v,size:y,disabled:x=n,form:S,colon:C,labelAlign:T,labelWrap:D,labelCol:O,wrapperCol:k,layout:A=`horizontal`,scrollToFirstError:j,requiredMark:M,onFinishFailed:N,name:P,style:F,feedbackIcons:I,variant:R,classNames:z,styles:ee,tooltip:B,...V}=e,re=ne(y),ie=J.useContext(At),ae=J.useMemo(()=>M===void 0?a===void 0||a:M,[M,a]),oe=C??o,H=T??m,se=D??h,ce={...p,...B},U=r(`form`,g),le=vt(U),[W,ue]=Wg(U,le),de={...e,size:re,disabled:x,layout:A,colon:oe,requiredMark:ae,labelAlign:H,labelWrap:se},fe=w(l),pe=w(F),[me,he]=te([d,z],[u,fe,ee,pe],{props:de}),ge=b(U,`${U}-${A}`,{[`${U}-hide-required-mark`]:ae===!1,[`${U}-rtl`]:i===`rtl`,[`${U}-large`]:re===`large`,[`${U}-small`]:re===`small`},ue,le,W,c,_,v,me.root),[_e]=Sm(S),{__INTERNAL__:ve}=_e;ve.name=P;let ye=J.useMemo(()=>({name:P,labelAlign:H,labelCol:O,labelWrap:se,wrapperCol:k,layout:A,colon:oe,requiredMark:ae,itemRef:ve.itemRef,form:_e,feedbackIcons:I,tooltip:ce,classNames:me,styles:he}),[P,H,se,O,k,A,oe,ae,_e,I,me,he,ce]),be=J.useRef(null);J.useImperativeHandle(t,()=>({..._e,nativeElement:be.current?.nativeElement}));let xe=(e,t)=>{if(e){let n={block:`nearest`};E(e)&&(n={...n,...e}),_e.scrollToField(t,n)}},Se=e=>{if(N?.(e),e.errorFields.length){let t=e.errorFields[0].name;if(j!==void 0){xe(j,t);return}s!==void 0&&xe(s,t)}};return J.createElement(Xe.Provider,{value:R},J.createElement(Vt,{disabled:x},J.createElement(L.Provider,{value:re},J.createElement(Ye,{validateMessages:ie},J.createElement(it.Provider,{value:ye},J.createElement(at,{status:!0},J.createElement(nt,{id:P,...V,name:P,onFinishFailed:Se,form:_e,ref:be,style:he?.root,className:ge})))))))}),Yg=e=>{if(I(e))return e;let t=i(e);return t.length<=1?t[0]:t},Xg=()=>{let{status:e,errors:t=[],warnings:n=[]}=J.useContext(st);return{status:e,errors:t,warnings:n}};Xg.Context=st;function Zg(e){let[t,n]=J.useState(e),r=J.useRef(null),i=J.useRef([]),a=J.useRef(!1);J.useEffect(()=>(a.current=!1,()=>{a.current=!0,s.cancel(r.current),r.current=null}),[]);function o(e){a.current||(r.current===null&&(i.current=[],r.current=s(()=>{r.current=null,n(e=>{let t=e;return i.current.forEach(e=>{t=e(t)}),t})})),i.current.push(e))}return[t,o]}var Qg=()=>{let{itemRef:e}=J.useContext(it),t=J.useRef({});return(n,r)=>{let i=r&&E(r)&&B(r),a=n.join(`_`);return(t.current.name!==a||t.current.originRef!==i)&&(t.current.name=a,t.current.originRef=i,t.current.ref=k(e(n),i)),t.current.ref}},$g=e=>{let{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{[`${t}-control`]:{display:`flex`}}}},e_=ae([`Form`,`item-item`],(e,{rootPrefixCls:t})=>$g(Ug(e,t))),t_=24,n_=e=>{let{prefixCls:t,status:n,labelCol:r,wrapperCol:i,children:a,errors:o,warnings:s,_internalItemRender:c,extra:u,help:d,fieldId:f,marginBottom:p,onErrorVisibleChanged:m,label:h}=e,g=`${t}-item`,_=J.useContext(it),{classNames:v,styles:y}=_,S=J.useMemo(()=>{let e={...i||_.wrapperCol||{}};return h===null&&!r&&!i&&_.labelCol&&[void 0].concat(x(lm)).forEach(t=>{let n=t?[t]:[],r=Je(_.labelCol,n),i=E(r)?r:{},a=Je(e,n),o=E(a)?a:{};`span`in i&&!(`offset`in o)&&i.span<t_&&(e=ft(e,[].concat(n,[`offset`]),i.span))}),e},[i,_.wrapperCol,_.labelCol,h,r]),C=b(`${g}-control`,S.className),w=J.useMemo(()=>{let{labelCol:e,wrapperCol:t,...n}=_;return n},[_]),T=J.useRef(null),[D,O]=J.useState(0);l(()=>{u&&T.current?O(T.current.clientHeight):O(0)},[u]);let k=J.createElement(`div`,{className:`${g}-control-input`},J.createElement(`div`,{className:b(`${g}-control-input-content`,v?.content),style:y?.content},a)),A=J.useMemo(()=>({prefixCls:t,status:n}),[t,n]),j=p!==null||o.length||s.length?J.createElement(tt.Provider,{value:A},J.createElement(qg,{fieldId:f,errors:o,warnings:s,help:d,helpStatus:n,className:`${g}-explain-connected`,onVisibleChanged:m})):null,M={};f&&(M.id=`${f}_extra`);let N=u?J.createElement(`div`,{...M,className:b(`${g}-extra`,v?.extra),style:y?.extra,ref:T},u):null,P=j||N?J.createElement(`div`,{className:`${g}-additional`,style:p?{minHeight:p+D}:{}},j,N):null,F=c&&c.mark===`pro_table_render`&&c.render?c.render(e,{input:k,errorList:j,extra:N}):J.createElement(J.Fragment,null,k,P);return J.createElement(it.Provider,{value:w},J.createElement(ih,{...S,className:C},F),J.createElement(e_,{prefixCls:t}))},r_={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}},{tag:`path`,attrs:{d:`M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z`}}]},name:`question-circle`,theme:`outlined`};function i_(){return i_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i_.apply(this,arguments)}var a_=J.forwardRef((e,t)=>J.createElement(It,i_({},e,{ref:t,icon:r_}))),o_=({prefixCls:e,label:t,htmlFor:n,labelCol:r,labelAlign:i,colon:a,required:o,requiredMark:s,tooltip:c,vertical:l})=>{let[u]=kt(`Form`),{labelAlign:d,labelCol:f,labelWrap:p,colon:m,classNames:h,styles:g,tooltip:_}=J.useContext(it);if(!R(t))return null;let v=r||f||{},y=i||d,x=`${e}-item-label`,S=b(x,y===`left`&&`${x}-left`,v.className,{[`${x}-wrap`]:!!p}),C=t,w=a===!0||m!==!1&&a!==!1;w&&!l&&typeof t==`string`&&t.trim()&&(C=t.replace(/[:|:]\s*$/,``));let T=Og(c,_);if(T){let t=J.createElement(Ot,{...T},J.createElement(`span`,{className:`${e}-item-tooltip`,onClick:e=>{e.preventDefault()},tabIndex:-1},T.icon||T.children||J.createElement(a_,null)));C=J.createElement(J.Fragment,null,C,t)}let E=s===`optional`,D=I(s),O=s===!1;D?C=s(C,{required:!!o}):E&&!o&&(C=J.createElement(J.Fragment,null,C,J.createElement(`span`,{className:`${e}-item-optional`},u?.optional||Mt.Form?.optional)));let k;O?k=`hidden`:(E||D)&&(k=`optional`);let A=b(h?.label,{[`${e}-item-required`]:o,[`${e}-item-required-mark-${k}`]:k,[`${e}-item-no-colon`]:!w});return J.createElement(ih,{...v,className:S},J.createElement(`label`,{htmlFor:n,className:A,style:g?.label,title:typeof t==`string`?t:void 0},C))},s_={success:Ft,warning:Rt,error:Pt,validating:Ut};function c_({children:e,errors:t,warnings:n,hasFeedback:r,validateStatus:i,prefixCls:a,meta:o,noStyle:s,name:c}){let l=`${a}-item`,{feedbackIcons:u}=J.useContext(it),d=ym(t,n,o,null,!!r,i),{isFormItemInput:f,status:p,hasFeedback:m,feedbackIcon:h,name:g}=J.useContext(st),_=J.useMemo(()=>{let e;if(r){let i=r!==!0&&r.icons||u,a=d&&i?.({status:d,errors:t,warnings:n})?.[d],o=d?s_[d]:null;e=a!==!1&&o?J.createElement(`span`,{className:b(`${l}-feedback-icon`,`${l}-feedback-icon-${d}`)},a||J.createElement(o,null)):null}let i={status:d||``,errors:t,warnings:n,hasFeedback:!!r,feedbackIcon:e,isFormItemInput:!0,name:c};return s&&(i.status=(d??p)||``,i.isFormItemInput=f,i.hasFeedback=!!(r??m),i.feedbackIcon=r===void 0?h:i.feedbackIcon,i.name=c??g),i},[d,t,n,r,u,s,c,f,p,l,m,h,g]);return J.createElement(st.Provider,{value:_},e)}function l_(e){let{prefixCls:t,className:n,rootClassName:r,style:i,help:a,errors:o,warnings:s,validateStatus:c,meta:u,hasFeedback:d,hidden:f,children:p,fieldId:m,required:h,isRequired:g,onSubItemMetaChange:_,layout:v,name:y,...x}=e,S=`${t}-item`,{requiredMark:C,layout:w}=J.useContext(it),E=v||w,D=E===`vertical`,O=J.useRef(null),k=kg(o),A=kg(s),j=re(a),M=!!(j||k.length||A.length),N=!!O.current&&T(O.current),[P,F]=J.useState(null);l(()=>{if(M&&O.current){let e=getComputedStyle(O.current);F(Number.parseInt(e.marginBottom,10))}},[M,N]);let I=e=>{!e&&!M&&F(null)},L=((e=!1)=>ym(e?k:u.errors,e?A:u.warnings,u,``,!!d,c))(),R=b(S,n,r,{[`${S}-with-help`]:j||k.length||A.length,[`${S}-has-feedback`]:L&&d,[`${S}-has-success`]:L===`success`,[`${S}-has-warning`]:L===`warning`,[`${S}-has-error`]:L===`error`,[`${S}-is-validating`]:L===`validating`,[`${S}-hidden`]:f,[`${S}-${E}`]:E});return J.createElement(`div`,{className:R,style:i,ref:O},J.createElement(sh,{className:`${S}-row`,...bt(x,`_internalItemRender.colon.dependencies.extra.fieldKey.getValueFromEvent.getValueProps.htmlFor.id.initialValue.isListField.label.labelAlign.labelCol.labelWrap.messageVariables.name.normalize.noStyle.preserve.requiredMark.rules.shouldUpdate.trigger.tooltip.validateFirst.validateTrigger.valuePropName.wrapperCol.validateDebounce`.split(`.`))},J.createElement(o_,{htmlFor:m,...e,requiredMark:C,required:h??g,prefixCls:t,vertical:D}),J.createElement(n_,{...e,...u,errors:k,warnings:A,prefixCls:t,status:L,help:a,marginBottom:P,onErrorVisibleChanged:I},J.createElement(ct.Provider,{value:_},J.createElement(c_,{prefixCls:t,meta:u,errors:u.errors,warnings:u.warnings,hasFeedback:d,validateStatus:L,name:y},p)))),!!P&&J.createElement(`div`,{className:`${S}-margin-offset`,style:{marginBottom:-P}}))}var u_=`__SPLIT__`;function d_(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],i=t[n];return r===i||I(r)||I(i)})}var f_=J.memo(e=>e.children,(e,t)=>d_(e.control,t.control)&&e.update===t.update&&e.childProps.length===t.childProps.length&&e.childProps.every((e,n)=>e===t.childProps[n]));function p_(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}function m_(e){let{name:t,noStyle:n,className:r,dependencies:i,prefixCls:a,shouldUpdate:o,rules:s,children:c,required:l,label:d,messageVariables:f,trigger:p=`onChange`,validateTrigger:m,hidden:h,help:g,layout:v}=e,{getPrefixCls:y}=J.useContext(u),{name:S}=J.useContext(it),C=Yg(c),w=I(C),T=J.useContext(ct),{validateTrigger:D}=J.useContext(et),O=re(m)?m:D,k=re(t),A=y(`form`,a),j=vt(A),[P,F]=Wg(A,j);qe(`Form.Item`);let L=J.useContext(rt),R=J.useRef(null),[z,ee]=Zg({}),[B,V]=_(()=>p_()),te=e=>{let t=L?.getKey(e.name);if(V(e.destroy?p_():e,!0),n&&g!==!1&&T){let n=e.name;if(e.destroy)n=R.current||n;else if(t!==void 0){let[e,r]=t;n=[e].concat(x(r)),R.current=n}T(e,n)}},ne=(e,t)=>{ee(n=>{let r={...n},i=[].concat(x(e.name.slice(0,-1)),x(t)).join(u_);return e.destroy?delete r[i]:r[i]=e,r})},[ie,ae]=J.useMemo(()=>{let e=x(B.errors),t=x(B.warnings);return Object.values(z).forEach(n=>{e.push.apply(e,x(n.errors||[])),t.push.apply(t,x(n.warnings||[]))}),[e,t]},[z,B.errors,B.warnings]),oe=Qg();function H(i,a,o){return n&&!h?J.createElement(c_,{prefixCls:A,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:B,errors:ie,warnings:ae,noStyle:!0,name:t},i):J.createElement(l_,{key:`row`,...e,className:b(r,F,j,P),prefixCls:A,fieldId:a,isRequired:o,errors:ie,warnings:ae,meta:B,onSubItemMetaChange:ne,layout:v,name:t},i)}if(!k&&!w&&!i)return H(C);let se={};return typeof d==`string`?se.label=d:t&&(se.label=String(t)),f&&(se={...se,...f}),J.createElement(ot,{...e,messageVariables:se,trigger:p,validateTrigger:O,onMetaChange:te},(n,r,a)=>{let c=_m(t).length&&r?r.name:[],u=vm(c,S),d=l===void 0?s?.some(e=>{if(E(e)&&e.required&&!e.warningOnly)return!0;if(I(e)){let t=e(a);return t?.required&&!t?.warningOnly}return!1}):l,f={...n},m=null;if(Array.isArray(C)&&k)m=C;else if((!w||(o||i)&&!k)&&(!i||w||k)){if(J.isValidElement(C)){let t={...C.props,...f};if(t.id||=u,g||ie.length>0||ae.length>0||e.extra){let n=[];(g||ie.length>0)&&n.push(`${u}_help`),e.extra&&n.push(`${u}_extra`),t[`aria-describedby`]=n.join(` `)}ie.length>0&&(t[`aria-invalid`]=`true`),d&&(t[`aria-required`]=`true`),M(C)&&(t.ref=oe(c,C)),new Set([].concat(x(_m(p)),x(_m(O)))).forEach(e=>{t[e]=(...t)=>{f[e]?.(...t),C.props[e]?.(...t)}});let n=[t[`aria-required`],t[`aria-invalid`],t[`aria-describedby`]];m=J.createElement(f_,{control:f,update:C,childProps:n},N(C,t))}else m=w&&(o||i)&&!k?C(a):C}return H(m,u,d)})}var h_=m_;h_.useStatus=Xg;var g_=({prefixCls:e,children:t,...n})=>{let{getPrefixCls:r}=J.useContext(u),i=r(`form`,e),a=J.useMemo(()=>({prefixCls:i,status:`error`}),[i]);return J.createElement(Qe,{...n},(e,n,r)=>J.createElement(tt.Provider,{value:a},t(e.map(e=>({...e,fieldKey:e.key})),n,{errors:r.errors,warnings:r.warnings})))};function __(){let{form:e}=J.useContext(it);return e}var v_=Jg;v_.Item=h_,v_.List=g_,v_.ErrorList=qg,v_.useForm=Sm,v_.useFormInstance=__,v_.useWatch=ut,v_.Provider=Ye;var y_=e=>{let{getPrefixCls:t,direction:n}=(0,J.useContext)(u),{prefixCls:r,className:i}=e,a=t(`input-group`,r),[o,s]=th(t(`input`)),c=b(a,s,{[`${a}-lg`]:e.size===`large`,[`${a}-sm`]:e.size===`small`,[`${a}-compact`]:e.compact,[`${a}-rtl`]:n===`rtl`},o,i),l=(0,J.useContext)(st),d=(0,J.useMemo)(()=>({...l,isFormItemInput:!1}),[l]);return J.createElement(st.Provider,{value:d},J.createElement(Dg.Compact,{className:c,style:e.style,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onFocus:e.onFocus,onBlur:e.onBlur},e.children))},b_=e=>{let{componentCls:t,paddingXS:n}=e;return{[t]:{display:`inline-flex`,alignItems:`center`,flexWrap:`nowrap`,columnGap:n,[`${t}-input-wrapper`]:{position:`relative`,[`${t}-mask-icon`]:{position:`absolute`,zIndex:`1`,top:`50%`,right:`50%`,transform:`translate(50%, -50%)`,pointerEvents:`none`},[`${t}-mask-input`]:{color:`transparent`,caretColor:e.colorText,"&::selection":{color:`transparent`}},[`${t}-mask-input[type=number]::-webkit-inner-spin-button`]:{"-webkit-appearance":`none`,margin:0},[`${t}-mask-input[type=number]`]:{"-moz-appearance":`textfield`}},"&-rtl":{direction:`rtl`},[`${t}-input`]:{textAlign:`center`,paddingInline:e.paddingXXS},[`&${t}-sm ${t}-input`]:{paddingInline:e.calc(e.paddingXXS).div(2).equal()},[`&${t}-lg ${t}-input`]:{paddingInline:e.paddingXS}}}},x_=S([`Input`,`OTP`],e=>b_(d(e,Cm(e))),wm),S_=`•`,C_=J.forwardRef((e,t)=>{let{className:n,value:r,onChange:i,onActiveChange:a,index:o,mask:c,onFocus:l,type:d,...f}=e,{getPrefixCls:p}=J.useContext(u),m=p(`otp`),h=typeof c==`string`?c:S_,g=J.useRef(null);J.useImperativeHandle(t,()=>g.current);let _=e=>{i(o,e.target.value)},v=()=>{s(()=>{let e=g.current?.input;document.activeElement===e&&e&&e.select()})},y=e=>{l?.(e),v()},x=e=>{let{key:t,ctrlKey:n,metaKey:i}=e;t===`ArrowLeft`?a(o-1):t===`ArrowRight`?a(o+1):t===`z`&&(n||i)?e.preventDefault():t===`Backspace`&&!r&&a(o-1),v()};return J.createElement(`span`,{className:`${m}-input-wrapper`,role:`presentation`},c&&r!==``&&r!==void 0&&J.createElement(`span`,{className:`${m}-mask-icon`,"aria-hidden":`true`},h),J.createElement(zh,{"aria-label":`OTP Input ${o+1}`,...f,type:d??(c?`password`:`text`),ref:g,value:r,onInput:_,onFocus:y,onKeyDown:x,onMouseDown:v,onMouseUp:v,className:b(n,{[`${m}-mask-input`]:c})}))});function w_(e){return(e||``).split(``)}var T_=e=>{let{index:t,prefixCls:n,separator:r,className:i,style:a}=e,o=I(r)?r(t):r;return o?J.createElement(`span`,{className:b(`${n}-separator`,i),style:a},o):null},E_=J.forwardRef((e,t)=>{let{prefixCls:n,length:r=6,size:i,defaultValue:a,value:o,onChange:s,formatter:c,separator:l,variant:u,disabled:d,status:p,autoFocus:m,mask:h,type:g,autoComplete:_,onInput:v,onFocus:y,inputMode:S,classNames:C,styles:T,className:E,style:O,...k}=e,{classNames:A,styles:j,getPrefixCls:M,direction:N,style:P,className:I}=f(`otp`),L=M(`otp`,n),[R]=jp(`otp`,u,void 0,`input`),z={...e,length:r,variant:R},ee=w(P),B=w(O),[V,re]=te([A,C],[j,ee,T,B],{props:z}),ie=D(k,{aria:!0,data:!0,attr:!0}),[ae,oe]=x_(L),H=ne(e=>i??e),se=J.useContext(st),ce=xp(se.status,p),U=J.useMemo(()=>({...se,status:ce,hasFeedback:!1,feedbackIcon:null}),[se,ce]),le=J.useRef(null),W=J.useRef({});J.useImperativeHandle(t,()=>({focus:()=>{W.current[0]?.focus()},blur:()=>{for(let e=0;e<r;e+=1)W.current[e]?.blur()},nativeElement:le.current}));let ue=e=>c?c(e):e,[de,fe]=J.useState(()=>w_(ue(a||``)));J.useEffect(()=>{o!==void 0&&fe(w_(o))},[o]);let pe=F(e=>{fe(e),v&&v(e),s&&e.length===r&&e.every(e=>e)&&e.some((e,t)=>de[t]!==e)&&s(e.join(``))}),me=F((e,t)=>{let n=x(de);for(let t=0;t<e;t+=1)n[t]||(n[t]=``);t.length<=1?n[e]=t:n=n.slice(0,e).concat(w_(t)),n=n.slice(0,r);for(let e=n.length-1;e>=0&&!n[e];--e)n.pop();return n=w_(ue(n.map(e=>e||` `).join(``))).map((e,t)=>e===` `&&!n[t]?n[t]:e),n}),he=(e,t)=>{let n=me(e,t),i=Math.min(e+t.length,r-1);i!==e&&n[e]!==void 0&&W.current[i]?.focus(),pe(n)},ge=e=>{W.current[e]?.focus()},_e=(e,t)=>{for(let e=0;e<t;e+=1)if(!W.current[e]?.input?.value){W.current[e]?.focus();break}y?.(e)},ve={variant:R,disabled:d,status:ce,mask:h,type:g,inputMode:S,autoComplete:_};return J.createElement(`div`,{...ie,ref:le,className:b(E,L,{[`${L}-sm`]:H===`small`,[`${L}-lg`]:H===`large`,[`${L}-rtl`]:N===`rtl`},oe,ae,I,V.root),style:re.root,role:`group`},J.createElement(st.Provider,{value:U},Array.from({length:r}).map((e,t)=>{let n=`otp-${t}`,i=de[t]||``;return J.createElement(J.Fragment,{key:n},J.createElement(C_,{ref:e=>{W.current[t]=e},index:t,size:H,htmlSize:1,className:b(V.input,`${L}-input`),style:re.input,onChange:he,value:i,onActiveChange:ge,autoFocus:t===0&&m,onFocus:e=>_e(e,t),...ve}),t<r-1&&J.createElement(T_,{separator:l,index:t,prefixCls:L,className:b(V.separator),style:re.separator}))})))}),D_={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z`}},{tag:`path`,attrs:{d:`M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z`}}]},name:`eye-invisible`,theme:`outlined`};function O_(){return O_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},O_.apply(this,arguments)}var k_=J.forwardRef((e,t)=>J.createElement(It,O_({},e,{ref:t,icon:D_}))),A_={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z`}}]},name:`eye`,theme:`outlined`};function j_(){return j_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j_.apply(this,arguments)}var M_=J.forwardRef((e,t)=>J.createElement(It,j_({},e,{ref:t,icon:A_}))),N_=e=>e?J.createElement(M_,null):J.createElement(k_,null),P_={click:`onClick`,hover:`onMouseOver`},F_=J.forwardRef((e,t)=>{let{disabled:n,action:r=`click`,visibilityToggle:i=!0,iconRender:a,prefixCls:o,inputPrefixCls:s,suffix:c,className:l,style:u,classNames:d,styles:p,variant:m,...h}=e,{getPrefixCls:g,className:_,style:v,classNames:y,styles:x,iconRender:S}=f(`inputPassword`),[C]=jp(`inputPassword`,m,e.bordered,`input`),[T]=kt(`global`),D=J.useContext(Ht),O=n??D,A={...e,disabled:O,variant:C},j=w(v),M=w(u),[N,P]=te([y,d],[x,j,p,M],{props:A}),F=E(i)&&i.visible!==void 0,[I,L]=(0,J.useState)(()=>F?i.visible:!1),R=(0,J.useRef)(null);J.useEffect(()=>{F&&L(i.visible)},[F,i]);let z=Lh(R),ee=()=>{if(O)return;I&&z();let e=!I;F||L(e),E(i)&&i.onVisibleChange?.(e)},B=e=>{let t=P_[r]||``,n=(a||S||N_)(I),o=E(i)?i.tabIndex:void 0;return J.createElement(`span`,{key:`passwordIcon`,role:`button`,tabIndex:O?-1:o??0,className:`${e}-icon`,"aria-disabled":O,"aria-pressed":I,"aria-label":I?T.hide:T.show,onMouseDown:e=>{e.preventDefault()},onMouseUp:e=>{e.preventDefault()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.repeat||ee())},[t]:ee},n)},V=g(`input`,s),ne=g(`input-password`,o),re=i&&B(ne),ie=b(ne,_,l,{[`${ne}-${e.size}`]:!!e.size}),ae={...h,type:I?`text`:`password`,prefixCls:V,suffix:J.createElement(J.Fragment,null,re,c),disabled:O,className:ie,classNames:N,styles:P,variant:C};return J.createElement(zh,{ref:k(t,R),...ae})}),I_=e=>{let{componentCls:t,antCls:n,calc:r,max:i}=e,a=`${t}-btn`,[o,s]=A(n,`input-search`),c=e.inputFontSizeSM??e.fontSize,l=i(e.controlHeightSM,r(c).mul(e.lineHeight).add(r(e.paddingBlockSM).mul(2)).add(r(e.lineWidth).mul(2)).equal());return{[t]:{[o(`btn-height`)]:v(e.controlHeight),width:`100%`,[a]:{height:s(`btn-height`),"&:focus-visible":{zIndex:5},[`&${n}-btn-icon-only`]:{width:s(`btn-height`)},"&-filled":{background:e.colorFillTertiary,"&:not(:disabled)":{"&:hover":{background:e.colorFillSecondary},"&:active":{background:e.colorFill}}}},[`&${t}-large`]:{[o(`btn-height`)]:v(e.controlHeightLG)},[`&${t}-small`]:{[o(`btn-height`)]:v(e.controlHeightSM)},[`&${t}-small ${a}`]:{minHeight:l,[`&${e.antCls}-btn-icon-only`]:{minWidth:l}}}}},L_=S([`Input`,`Search`],e=>I_(d(e,Cm(e))),wm),R_=J.forwardRef((e,t)=>{let{prefixCls:n,inputPrefixCls:r,className:i,size:a,style:o,enterButton:s=!1,searchIcon:c,addonAfter:l,loading:u,disabled:d,onSearch:p,onChange:m,onCompositionStart:h,onCompositionEnd:g,variant:_,onPressEnter:v,classNames:y,styles:x,hidden:S,...C}=e,{direction:T,getPrefixCls:E,className:O,style:A,classNames:j,styles:M,searchIcon:P}=f(`inputSearch`),F=J.useContext(Ht),I=d??F,[L,,R]=jp(`inputSearch`,_,e.bordered),z=R?L:void 0,[ee]=jp(`inputSearch`,_,e.bordered,`input`),B={...e,enterButton:s,variant:z},V=w(A),re=w(o),[ie,ae]=te([j,y],[M,V,x,re],{props:B},{button:{_default:`root`}}),oe=J.useRef(!1),H=E(`input-search`,n),se=E(`input`,r),[ce,U]=L_(H),{compactSize:le}=St(H,T),W=ne(e=>a??le??e),ue=J.useRef(null),de=e=>{e?.target&&e.type===`click`&&p&&p(e.target.value,e,{source:`clear`}),m?.(e)},fe=e=>{document.activeElement===ue.current?.input&&e.preventDefault()},pe=e=>{p&&p(ue.current?.input?.value,e,{source:`input`})},me=e=>{oe.current||u||(v?.(e),pe(e))},he=typeof s==`boolean`?Nt(c,P,J.createElement(tm,null)):null,ge=`${H}-btn`,_e=b(ge,{[`${ge}-${z}`]:z}),ve,ye=s||{},be=ye.type&&ye.type.__ANT_BUTTON===!0;if(be||ye.type===`button`){let e=ye.props;ve=N(ye,{disabled:I||e.disabled||!be&&u,onMouseDown:t=>{e.onMouseDown?.(t),fe(t)},onClick:e=>{ye?.props?.onClick?.(e),pe(e)},key:`enterButton`,...be?{className:b(_e,e.className),loading:u||e.loading,size:W}:{}})}else ve=J.createElement(Gt,{classNames:ie.button,styles:ae.button,className:_e,color:s?`primary`:`default`,size:W,disabled:d,key:`enterButton`,onMouseDown:fe,onClick:pe,loading:u,icon:he,variant:z===`borderless`||z===`filled`||z===`underlined`?`text`:s?`solid`:void 0},s);l&&(ve=[ve,N(l,{key:`addonAfter`})]);let xe=b(H,U,{[`${H}-rtl`]:T===`rtl`,[`${H}-${W}`]:!!W,[`${H}-with-button`]:!!s},i,O,ce,ie.root),Se=e=>{oe.current=!0,h?.(e)},Ce=e=>{oe.current=!1,g?.(e)},we=D(C,{data:!0}),Te=bt({...C,classNames:bt(ie,[`button`,`root`]),styles:bt(ae,[`button`,`root`]),prefixCls:se,type:`search`,size:W,variant:ee,onPressEnter:me,onCompositionStart:Se,onCompositionEnd:Ce,onChange:de,disabled:d},Object.keys(we));return J.createElement(Ct,{className:xe,style:ae.root,...we,hidden:S},J.createElement(zh,{ref:k(ue,t),...Te}),ve)}),z_=e=>{let{componentCls:t,paddingLG:n}=e,r=`${t}-textarea`;return{[`textarea${t}`]:{maxWidth:`100%`,height:`auto`,minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:`bottom`,transition:`all ${e.motionDurationSlow}`,resize:`vertical`,"@media (hover: none) and (pointer: coarse)":{resize:`none`},[`&${t}-mouse-active`]:{transition:`all ${e.motionDurationSlow}, height 0s, width 0s`}},[`${t}-textarea-affix-wrapper-resize-dirty`]:{width:`auto`},[r]:{position:`relative`,"&-show-count":{[`${t}-data-count`]:{position:`absolute`,bottom:e.calc(e.fontSize).mul(e.lineHeight).mul(-1).equal(),insetInlineEnd:0,color:e.colorTextDescription,whiteSpace:`nowrap`,pointerEvents:`none`}},[`
        &-allow-clear > ${t},
        &-affix-wrapper${r}-has-feedback ${t}
      `]:{paddingInlineEnd:n},[`&-affix-wrapper${t}-affix-wrapper`]:{padding:0,[`> textarea${t}`]:{fontSize:`inherit`,border:`none`,outline:`none`,background:`transparent`,minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:`none !important`}},[`${t}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${t}-clear-icon`]:{position:`absolute`,insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},[`${r}-suffix`]:{position:`absolute`,top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:`inline-flex`,alignItems:`center`,margin:`auto`,pointerEvents:`none`}}},[`&-affix-wrapper${t}-affix-wrapper-rtl`]:{[`${t}-suffix`]:{[`${t}-data-count`]:{direction:`ltr`,insetInlineStart:0}}},[`&-affix-wrapper${t}-affix-wrapper-sm`]:{[`${t}-suffix`]:{[`${t}-clear-icon`]:{insetInlineEnd:e.paddingInlineSM}}}}}},B_=S([`Input`,`TextArea`],e=>z_(d(e,Cm(e))),wm,{resetFont:!1}),V_=(0,J.forwardRef)((e,t)=>{let{prefixCls:n,bordered:r=!0,size:i,disabled:a,status:o,allowClear:s,classNames:c,rootClassName:l,className:u,style:d,styles:p,variant:m,showCount:h,onMouseDown:g,onResize:_,...v}=e,{getPrefixCls:y,direction:x,allowClear:S,autoComplete:C,className:T,style:E,classNames:D,styles:O}=f(`textArea`),k=J.useContext(Ht),A=a??k,{status:j,hasFeedback:M,feedbackIcon:N}=J.useContext(st),P=xp(j,o),F=w(E),L=w(d),[R,z]=te([D,c],[O,F,p,L],{props:e}),B=J.useRef(null);J.useImperativeHandle(t,()=>({resizableTextArea:B.current?.resizableTextArea,focus:e=>{ee(B.current?.resizableTextArea?.textArea,e)},blur:()=>B.current?.blur(),nativeElement:B.current?.nativeElement||null}));let V=y(`input`,n),re=vt(V),[ie,ae]=eh(V,l);B_(V,re);let{compactSize:oe,compactItemClassnames:H}=St(V,x),se=ne(e=>i??oe??e),[ce,U]=jp(`textArea`,m,r),le=Il({allowClear:s,contextAllowClear:S,componentName:`TextArea`}),[W,ue]=J.useState(!1),[de,fe]=J.useState(!1),pe=e=>{ue(!0),g?.(e);let t=()=>{ue(!1),document.removeEventListener(`mouseup`,t)};document.addEventListener(`mouseup`,t)},me=e=>{if(_?.(e),W&&I(getComputedStyle)){let e=B.current?.nativeElement?.querySelector(`textarea`);e&&getComputedStyle(e).resize===`both`&&fe(!0)}};return J.createElement(Fh,{autoComplete:C,...v,style:z.root,styles:z,disabled:A,allowClear:le,className:b(ae,re,u,l,H,T,R.root,{[`${V}-textarea-affix-wrapper-resize-dirty`]:de}),classNames:{...R,textarea:b({[`${V}-sm`]:se===`small`,[`${V}-lg`]:se===`large`},ie,R.textarea,W&&`${V}-mouse-active`),variant:b({[`${V}-${ce}`]:U},bp(V,P)),affixWrapper:b(`${V}-textarea-affix-wrapper`,{[`${V}-affix-wrapper-rtl`]:x===`rtl`,[`${V}-affix-wrapper-sm`]:se===`small`,[`${V}-affix-wrapper-lg`]:se===`large`,[`${V}-textarea-show-count`]:h||e.count?.show},ie)},prefixCls:V,suffix:M&&J.createElement(`span`,{className:`${V}-textarea-suffix`},N),showCount:h,ref:B,onResize:me,onMouseDown:pe})}),H_=zh;H_.Group=y_,H_.Search=R_,H_.TextArea=V_,H_.Password=F_,H_.OTP=E_;var U_={name:`arrow-up-to-line`,size:24,node:[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]};U_.node;var W_=$t(U_),G_={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};G_.node;var K_=$t(G_),q_={name:`award`,size:24,node:[[`path`,{d:`m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526`,key:`1yiouv`}],[`circle`,{cx:`12`,cy:`8`,r:`6`,key:`1vp47v`}]]};q_.node;var J_=$t(q_),Y_={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};Y_.node;var X_=$t(Y_),Z_={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};Z_.node;var Q_=$t(Z_),$_={name:`briefcase`,size:24,node:[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]};$_.node;var ev=$t($_),tv={name:`building-2`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]};tv.node;var nv=$t(tv),rv={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};rv.node;var iv=$t(rv),av={name:`chart-line`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]],aliases:[`line-chart`]};av.node;var ov=$t(av),sv={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};sv.node;var cv=$t(sv),lv={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};lv.node;var uv=$t(lv),dv={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};dv.node;var fv=$t(dv),pv={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};pv.node;var mv=$t(pv),hv={name:`clipboard-list`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]};hv.node;var gv=$t(hv),_v={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};_v.node;var vv=$t(_v),yv={name:`crown`,size:24,node:[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]};yv.node;var bv=$t(yv),xv={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};xv.node;var Sv=$t(xv),Cv={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Cv.node;var wv=$t(Cv),Tv={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Tv.node;var Ev=$t(Tv),Dv={name:`file-down`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`m9 15 3 3 3-3`,key:`1npd3o`}]]};Dv.node;var Ov=$t(Dv),kv={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};kv.node;var Av=$t(kv),jv={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};jv.node;var Mv=$t(jv),Nv={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Nv.node;var Pv=$t(Nv),Fv={name:`gem`,size:24,node:[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]};Fv.node;var Iv=$t(Fv),Lv={name:`git-compare`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]};Lv.node;var Rv=$t(Lv),zv={name:`graduation-cap`,size:24,node:[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]};zv.node;var Bv=$t(zv),Vv={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};Vv.node;var Hv=$t(Vv),Uv={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Uv.node;var Wv=$t(Uv),Gv={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Gv.node;var Kv=$t(Gv),qv={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};qv.node;var Jv=$t(qv),Yv={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};Yv.node;var Xv=$t(Yv),Zv={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Zv.node;var Qv=$t(Zv),$v={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};$v.node;var ey=$t($v),ty={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};ty.node;var ny=$t(ty),ry={name:`monitor-down`,size:24,node:[[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`m15 10-3 3-3-3`,key:`lzhmyn`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]};ry.node;var iy=$t(ry),ay={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};ay.node;var oy=$t(ay),sy={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};sy.node;var cy=$t(sy),ly={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};ly.node;var uy=$t(ly),dy={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};dy.node;var fy=$t(dy),py={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};py.node;var my=$t(py),hy={name:`square-pen`,size:24,node:[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]],aliases:[`pen-box`,`edit`,`pen-square`]};hy.node;var gy=$t(hy),_y={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};_y.node;var vy=$t(_y),yy={name:`trending-up`,size:24,node:[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]};yy.node;var by=$t(yy),xy={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};xy.node;var Sy=$t(xy),Cy={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};Cy.node;var wy=$t(Cy),Ty={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};Ty.node;var Ey=$t(Ty),Dy=t(((e,t)=>{function n(e){return e&&e.__esModule?e:{default:e}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Oy=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={items_per_page:`条/页`,jump_to:`跳至`,jump_to_confirm:`确定`,page:`页`,prev_page:`上一页`,next_page:`下一页`,prev_5:`向前 5 页`,next_5:`向后 5 页`,prev_3:`向前 3 页`,next_3:`向后 3 页`,page_size:`页码`}})),ky=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.commonLocale=void 0,e.commonLocale={yearFormat:`YYYY`,dayFormat:`D`,cellMeridiemFormat:`A`,monthBeforeYear:!0}})),Ay=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={...ky().commonLocale,locale:`zh_CN`,today:`今天`,now:`此刻`,backToToday:`返回今天`,ok:`确定`,timeSelect:`选择时间`,dateSelect:`选择日期`,weekSelect:`选择周`,clear:`清除`,week:`周`,month:`月`,year:`年`,previousMonth:`上个月`,nextMonth:`下个月`,monthSelect:`选择月份`,yearSelect:`选择年份`,decadeSelect:`选择年代`,previousYear:`上一年`,nextYear:`下一年`,previousDecade:`上一年代`,nextDecade:`下一年代`,previousCentury:`上一世纪`,nextCentury:`下一世纪`,yearFormat:`YYYY年`,cellDateFormat:`D`,monthBeforeYear:!1}})),jy=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={placeholder:`请选择时间`,rangePlaceholder:[`开始时间`,`结束时间`]}})),My=t((e=>{var t=Dy().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(Ay()),r=t(jy()),i={lang:{placeholder:`请选择日期`,yearPlaceholder:`请选择年份`,quarterPlaceholder:`请选择季度`,monthPlaceholder:`请选择月份`,weekPlaceholder:`请选择周`,rangePlaceholder:[`开始日期`,`结束日期`],rangeYearPlaceholder:[`开始年份`,`结束年份`],rangeMonthPlaceholder:[`开始月份`,`结束月份`],rangeQuarterPlaceholder:[`开始季度`,`结束季度`],rangeWeekPlaceholder:[`开始周`,`结束周`],...n.default},timePickerLocale:{...r.default}};i.lang.ok=`确定`,e.default=i})),Ny=t((e=>{var t=Dy().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=t(My()).default})),Py=t((e=>{var t=Dy().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(Oy()),r=t(Ny()),i=t(My()),a=t(jy()),o="${label}不是一个有效的${type}";e.default={locale:`zh-cn`,Pagination:n.default,DatePicker:i.default,TimePicker:a.default,Calendar:r.default,global:{placeholder:`请选择`,close:`关闭`,sortable:`可排序`,show:`显示`,hide:`隐藏`},Table:{filterTitle:`筛选`,filterConfirm:`确定`,filterReset:`重置`,filterEmptyText:`无筛选项`,filterCheckAll:`全选`,filterSearchPlaceholder:`在筛选项中搜索`,emptyText:`暂无数据`,selectAll:`全选当页`,selectInvert:`反选当页`,selectNone:`清空所有`,selectionAll:`全选所有`,sortTitle:`排序`,expand:`展开行`,collapse:`关闭行`,triggerDesc:`点击降序`,triggerAsc:`点击升序`,cancelSort:`取消排序`},Modal:{okText:`确定`,cancelText:`取消`,justOkText:`知道了`},Tour:{Next:`下一步`,Previous:`上一步`,Finish:`结束导览`},Popconfirm:{cancelText:`取消`,okText:`确定`},Transfer:{titles:[``,``],searchPlaceholder:`请输入搜索内容`,itemUnit:`项`,itemsUnit:`项`,remove:`删除`,selectCurrent:`全选当页`,removeCurrent:`删除当页`,selectAll:`全选所有`,deselectAll:`取消全选`,removeAll:`删除全部`,selectInvert:`反选当页`},Upload:{uploading:`文件上传中`,removeFile:`删除文件`,uploadError:`上传错误`,previewFile:`预览文件`,downloadFile:`下载文件`},Empty:{description:`暂无数据`},Icon:{icon:`图标`},Text:{edit:`编辑`,copy:`复制`,copied:`复制成功`,expand:`展开`,collapse:`收起`},Carousel:{prevSlide:`上一张幻灯片`,nextSlide:`下一张幻灯片`},Form:{optional:`(可选)`,defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:o,method:o,array:o,object:o,number:o,date:o,boolean:o,integer:o,float:o,regexp:o,email:o,url:o,hex:o},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},QRCode:{expired:`二维码过期`,refresh:`点击刷新`,scanned:`已扫描`},ColorPicker:{presetEmpty:`暂无`,transparent:`无色`,singleColor:`单色`,gradientColor:`渐变色`}}})),Fy=n(t(((e,t)=>{t.exports=Py()}))(),1),Iy={token:{colorPrimary:`#2563eb`}},Y=r();function Ly({children:e}){return(0,Y.jsx)(y,{layer:!0,children:(0,Y.jsx)(jt,{locale:Fy.default,theme:Iy,children:(0,Y.jsx)(fd,{children:e})})})}function Ry(e){return Pi(e)?{code:String(e.status),message:(typeof e.data==`string`?e.data:e.statusText)||`请求处理失败`}:e instanceof Error?{code:`错误`,message:e.message}:{code:`错误`,message:`页面加载失败,请稍后重试`}}function zy(){let{code:e,message:t}=Ry(Ss());return(0,Y.jsxs)(`div`,{className:`relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-linear-to-b from-slate-50 via-white to-blue-50/40 px-4 py-10`,children:[(0,Y.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,Y.jsx)(`span`,{className:`select-none text-[12rem] font-black leading-none text-slate-100`,children:e})}),(0,Y.jsxs)(`div`,{className:`relative w-full max-w-lg rounded-2xl border border-slate-100 bg-white/90 p-10 shadow-xl shadow-slate-200/60 backdrop-blur-sm`,children:[(0,Y.jsx)(`div`,{className:`mx-auto flex h-14 w-14 items-center justify-center rounded-2xl bg-amber-50 text-amber-500 ring-1 ring-amber-100`,children:(0,Y.jsx)(Sy,{className:`h-7 w-7`,strokeWidth:2})}),(0,Y.jsx)(`h1`,{className:`mt-6 text-center text-2xl font-bold text-slate-900`,children:`页面异常`}),(0,Y.jsx)(`p`,{className:`mt-3 text-center text-sm leading-relaxed text-slate-500`,children:t}),!1,(0,Y.jsxs)(`div`,{className:`mt-8 flex flex-row gap-2 justify-center`,children:[(0,Y.jsxs)(jc,{to:`/home`,className:`inline-flex items-center justify-center gap-2 rounded-xl bg-linear-to-br from-blue-600 to-indigo-600 px-6 py-2.5 text-sm font-bold text-white shadow-lg shadow-blue-500/20 transition-all hover:opacity-90 active:scale-95`,children:[(0,Y.jsx)(Hv,{className:`h-4 w-4`}),`返回首页`]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`inline-flex items-center justify-center gap-2 rounded-xl border border-slate-200 bg-white px-6 py-2.5 text-sm font-bold text-slate-600 transition-all hover:border-blue-200 hover:text-blue-600 active:scale-95`,children:[(0,Y.jsx)(cy,{className:`h-4 w-4`}),`刷新页面`]})]})]})]})}function By(e,t,n){(0,J.useEffect)(()=>{if(!t)return;let r=t=>{e.current?.contains(t.target)||n()};return document.addEventListener(`mousedown`,r),()=>document.removeEventListener(`mousedown`,r)},[t,n,e])}var Vy=sn((e,t)=>({unreadCount:0,latest:[],reset:()=>e({unreadCount:0,latest:[]}),fetchSummary:async()=>{try{let t=await Se({hasRead:!1,page:1,limit:3,sort:`createdAt`,order:`DESC`});e({latest:t.data,unreadCount:t.meta.itemCount})}catch(e){console.error(e)}},markItemReaded:async n=>{try{await fe(n),e(e=>({latest:e.latest.filter(e=>e.id!==n),unreadCount:Math.max(0,e.unreadCount-1)})),t().fetchSummary()}catch(e){console.error(e),G.error(`操作失败,请稍后重试`)}},markAllReaded:async()=>{try{await Ue(),e({unreadCount:0,latest:[]})}catch(e){console.error(e),G.error(`操作失败,请稍后重试`)}}}));function Hy(e){if(!e?.type||!e.data)return G.info(`消息内容不完整`),!1;let{type:t,data:n}=e;return n.id?t===`report`?(window.open(`/report/${n.id}`,`_blank`,`noopener,noreferrer`),!0):n.type===`url`?n.url?(window.open(n.url,`_blank`,`noopener,noreferrer`),!0):(G.info(`消息内容不完整`),!1):(window.open(`/insight-center/article/${n.id}`,`_blank`,`noopener,noreferrer`),!0):(G.info(`消息内容不完整`),!1)}var Uy=`/assets/logo-DXHiWTgZ.png`;function Wy({open:e,onClose:t,onConfirm:n}){let[r,i]=(0,J.useState)(!1);if(!e)return null;let a=()=>{i(!1),t()};return(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.overlay} flex items-center justify-center p-4`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-black/30`,onClick:a}),(0,Y.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-slate-100 bg-white p-6 shadow-2xl`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-base font-bold text-slate-800`,children:`即将离开当前页面前往研墨AI`}),(0,Y.jsx)(`p`,{className:`mb-5 text-sm leading-relaxed text-slate-500`,children:`您确认离开当前页面吗?`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 select-none`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked),className:`h-3.5 w-3.5 rounded border-slate-300 text-blue-600 focus:ring-blue-500/30`}),(0,Y.jsx)(`span`,{className:`text-xs text-slate-500`,children:`下次不再提醒`})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:a,className:`rounded-lg px-4 py-2 text-sm text-slate-600 hover:bg-slate-100`,children:`取消`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{n(r),a()},className:`rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700`,children:`确认离开`})]})]})]})]})}var Gy=[{label:`官网首页`,href:`/`},{label:`综合搜索`,href:`/search`},{label:`行业研究`,href:`/industry-research`,subItems:[{label:`全景产业链图谱`,href:`/industry-research/map-list`,icon:(0,Y.jsx)(ey,{size:16}),desc:`上下游核心标的穿透`},{label:`行业专题报告`,href:`/industry-research/topics`,icon:(0,Y.jsx)(Wv,{size:16}),desc:`热门赛道深度合集`},{label:`精选付费报告`,href:`/industry-research/paid-reports`,icon:(0,Y.jsx)(Iv,{size:16}),desc:`高价值独家深度研报`}]},{label:`公司研究`,href:`/company-research`},{label:`数据中心`,href:`/data`},{label:`洞察中心`,href:`/insight-center`},{label:`会员服务`,href:`/services`}];function Ky(e){return e===`service`?`bg-emerald-50 text-emerald-600`:e===`activity`?`bg-amber-50 text-amber-600`:e===`subscribe`?`bg-violet-50 text-violet-600`:`bg-blue-50 text-blue-600`}function qy(){let e=on(e=>e.open),{user:t,logout:n}=ln(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),d=(0,J.useRef)(null);By(d,s,(0,J.useCallback)(()=>c(!1),[]));let f=Zo(),p=es(),m=Vy(e=>e.unreadCount),h=Vy(e=>e.latest),g=Vy(e=>e.fetchSummary),_=Vy(e=>e.reset),v=Vy(e=>e.markItemReaded),y=Vy(e=>e.markAllReaded);(0,J.useEffect)(()=>{if(!t){_();return}g()},[t,g,_]);let b=()=>{y()},x=e=>{c(!1);let{category:t,url:n,extra:r}=e.notification;if(t===`subscribe`){if(!Hy(r)||e.hasRead)return;v(e.id);return}if(t!==`activity`){p(`/profile/messages`,{state:{openNotifyItem:e}});return}n&&window.open(n,`_blank`,`noopener,noreferrer`),!e.hasRead&&v(e.id)},S=e=>e===`/`?f.pathname===`/home`:f.pathname.startsWith(e),C=()=>{let e=`https://www.yanmoai.com/know?channel=djyanbao&djToken=${localStorage.getItem(`token`)??``}`;window.open(e,`_blank`,`noopener,noreferrer`)};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`header`,{className:`fixed top-0 left-0 right-0 ${xe.chrome} h-16 bg-[#0b2961] border-b border-[#1d3352]/40`,children:(0,Y.jsx)(`div`,{className:`max-w-7xl mx-auto pl-8 pr-3 h-full`,children:(0,Y.jsxs)(`div`,{className:`flex justify-between items-center h-full`,children:[(0,Y.jsx)(jc,{to:`/`,className:`shrink-0 flex items-center cursor-pointer`,children:(0,Y.jsx)(`img`,{src:Uy,alt:`洞见研报`,className:`h-10 w-auto max-w-55 object-contain`})}),(0,Y.jsxs)(`nav`,{className:`flex items-center`,children:[Gy.map(e=>{let t=S(e.href),n=e.subItems&&e.subItems.length>0;return(0,Y.jsxs)(`div`,{className:`relative group/nav`,onMouseEnter:()=>n&&i(e.label),onMouseLeave:()=>n&&i(null),children:[(0,Y.jsxs)(jc,{to:e.href,className:`relative px-3 py-2 text-sm font-medium transition-all rounded-full flex items-center gap-1 ${t?`text-white bg-white/10 shadow-inner`:`text-slate-300 hover:text-white hover:bg-white/5`}`,children:[e.label,n&&(0,Y.jsx)(uv,{size:12,className:`opacity-50 transition-transform duration-200 ${r===e.label?`rotate-180`:``}`})]}),n&&r===e.label&&(0,Y.jsx)(`div`,{className:`absolute top-full left-1/2 -translate-x-1/2 pt-4 w-64`,children:(0,Y.jsx)(`div`,{className:`bg-[#0b2961]/95 backdrop-blur-xl border border-[#1d3352] rounded-2xl shadow-2xl p-2 overflow-hidden ring-1 ring-black/5`,children:(0,Y.jsx)(`div`,{className:`grid gap-0.5`,children:e.subItems?.map((e,t)=>(0,Y.jsxs)(jc,{to:e.href,className:`flex items-start gap-3 p-3 rounded-xl hover:bg-white/5 transition-colors group/sub`,onClick:()=>i(null),children:[(0,Y.jsx)(`div`,{className:`mt-0.5 text-slate-400 group-hover/sub:text-blue-400 transition-colors`,children:e.icon}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-sm font-medium text-slate-200 group-hover/sub:text-white`,children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-slate-500 mt-0.5 leading-tight`,children:e.desc})]})]},t))})})})]},e.label)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{if(localStorage.getItem(`yanmo:no-prompt`)===`1`){C();return}u(!0)},className:`relative px-3 py-2 text-sm font-medium transition-all rounded-full flex items-center gap-1 text-slate-300 hover:text-white hover:bg-white/5 cursor-pointer`,children:`研墨AI`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,Y.jsxs)(`button`,{onClick:()=>p(`/contact`),className:`px-3 py-2 rounded-full bg-blue-500 text-white text-xs font-black shadow-lg shadow-blue-500/10 hover:brightness-110 active:scale-[0.98] transition-all flex items-center gap-1.5 cursor-pointer shrink-0`,children:[(0,Y.jsx)(oy,{size:14,className:`stroke-white stroke-[2.5]`}),(0,Y.jsx)(`span`,{children:`合作咨询`})]}),t&&(0,Y.jsxs)(`div`,{ref:d,className:`relative`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>c(!s),className:`transition-colors p-2 rounded-full relative group/bell ${s?`text-white bg-white/10`:`text-slate-400 hover:text-white`}`,children:[(0,Y.jsx)(X_,{size:18,className:`stroke-[2.2]`}),m>0&&(0,Y.jsx)(`span`,{className:`absolute top-1.5 right-1.5 w-2.5 h-2.5 bg-[#EF4444] rounded-full ring-2 ring-[#0a1526] group-hover/bell:ring-slate-800 transition-all`})]}),s&&(0,Y.jsx)(`div`,{className:`absolute top-full right-0 pt-4 w-80 z-50`,children:(0,Y.jsxs)(`div`,{className:`bg-white rounded-2xl shadow-2xl overflow-hidden ring-1 ring-black/5 animate-in fade-in zoom-in-95 duration-200 origin-top-right`,children:[(0,Y.jsxs)(`div`,{className:`px-5 py-4 border-b border-slate-100 flex justify-between items-center`,children:[(0,Y.jsx)(`span`,{className:`text-slate-800 font-bold text-sm`,children:`最新消息`}),m>0&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void b(),className:`text-[10px] text-blue-600 hover:text-blue-700 font-medium cursor-pointer`,children:`全部已读`})]}),h.length>0?(0,Y.jsx)(`div`,{className:`max-h-70 overflow-y-auto divide-y divide-slate-50`,children:h.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>void x(e),className:`w-full text-left p-4 hover:bg-slate-50/80 transition-all flex gap-2.5 relative cursor-pointer outline-none border-none`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[9px] font-extrabold px-1.5 py-0.5 rounded ${Ky(e.notification.category)}`,children:e.notification.categoryName}),(0,Y.jsx)(`span`,{className:`text-[10px] text-slate-400 font-mono shrink-0`,children:qt(e.notification.createdAt)})]}),(0,Y.jsx)(`p`,{className:`text-xs mt-1.5 leading-snug wrap-break-word font-black text-slate-800`,children:e.notification.category===`subscribe`&&e.notification.extra?.data?.title||e.notification.title})]}),(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-blue-600 shrink-0 mt-2.5`})]},e.id))}):(0,Y.jsxs)(`div`,{className:`p-10 flex flex-col items-center justify-center bg-slate-50/50`,children:[(0,Y.jsxs)(`div`,{className:`relative w-24 h-24 flex items-center justify-center`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-blue-50 rounded-full scale-90 opacity-50`}),(0,Y.jsx)(`div`,{className:`relative z-10 bg-white p-4 rounded-xl shadow-sm border border-slate-100`,children:(0,Y.jsx)(Mv,{size:32,className:`text-slate-200`})})]}),(0,Y.jsx)(`span`,{className:`text-slate-400 text-xs mt-6 font-medium tracking-wide`,children:`暂无未读消息`})]}),(0,Y.jsx)(`div`,{className:`px-5 py-3 bg-slate-50 border-t border-slate-100 text-center`,children:(0,Y.jsx)(jc,{to:`/profile/messages`,onClick:()=>c(!1),className:`text-xs text-slate-500 hover:text-[#1875e5] hover:underline transition-colors font-extrabold block w-full text-center`,children:`查看历史通知`})})]})})]}),(0,Y.jsxs)(jc,{to:`/ambassador`,className:`flex items-center text-[#E2AF5E] hover:text-[#f3c578] transition-colors text-sm font-bold mr-2 group shrink-0`,children:[(0,Y.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`w-4.5 h-4.5 shrink-0 group-hover:scale-110 transition-transform`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,Y.jsx)(`path`,{d:`M9 15L7 22L12 20.2L17 22L15 15`,fill:`#E28F1B`,stroke:`#B45309`,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M10 15L8.5 19.5L12 18.2L15.5 19.5L14 15`,fill:`#B45309`,strokeWidth:`0`}),(0,Y.jsx)(`circle`,{cx:`12`,cy:`10`,r:`6`,fill:`#FCD34D`,stroke:`#D97706`,strokeWidth:`1.2`}),(0,Y.jsx)(`circle`,{cx:`12`,cy:`10`,r:`4.2`,fill:`#FBBF24`,stroke:`#D97706`,strokeWidth:`0.8`}),(0,Y.jsx)(`circle`,{cx:`12`,cy:`10`,r:`1.5`,fill:`#78350F`})]}),(0,Y.jsx)(`span`,{className:`tracking-wide`,children:`洞见大使`})]}),t?(0,Y.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 pl-2 group/user hover:bg-white/5 p-1 rounded-full transition-colors cursor-pointer select-none`,children:[(0,Y.jsx)(`div`,{className:`w-8 h-8 rounded-full overflow-hidden flex items-center justify-center shrink-0 shadow-inner`,children:t.avatar?(0,Y.jsx)(`img`,{src:t.avatar,alt:``,className:`h-full w-full object-cover`}):(0,Y.jsxs)(`svg`,{viewBox:`0 0 36 36`,className:`w-full h-full`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,Y.jsx)(`rect`,{width:`36`,height:`36`,fill:`#CBD5E1`}),(0,Y.jsx)(`path`,{d:`M4 32C4 28 8 26 18 26C28 26 32 28 32 32V36H4V32Z`,fill:`#1E293B`}),(0,Y.jsx)(`path`,{d:`M14 26L18 31L22 26H14Z`,fill:`#F8FAFC`}),(0,Y.jsx)(`path`,{d:`M16 26L18 32L20 26H16Z`,fill:`#3B82F6`}),` `,(0,Y.jsx)(`circle`,{cx:`18`,cy:`15`,r:`6`,fill:`#FDBA74`}),(0,Y.jsx)(`path`,{d:`M11 14C11 11.5 13 9 18 9C23 9 25 11.5 25 14C25 14.5 23.5 15.5 22.5 15.5H13.5C12.5 15.5 11 14.5 11 14Z`,fill:`#334155`}),(0,Y.jsx)(`path`,{d:`M13.5 11.5C15 10 17 10 18 10.5C19 10 21 10 22.5 11.5C21.5 10.5 19.5 10 18 10C16.5 10 14.5 10.5 13.5 11.5Z`,fill:`#1E293B`})]})}),(0,Y.jsx)(`span`,{className:`max-w-24 truncate text-sm font-semibold text-slate-200 group-hover/user:text-white transition-colors`,children:t.nickName||`洞见研报用户`}),(0,Y.jsx)(uv,{size:14,className:`text-slate-400 transition-transform duration-200 ${a?`rotate-180`:``}`})]}),a&&(0,Y.jsx)(`div`,{className:`absolute top-full right-0 pt-4 w-56`,children:(0,Y.jsx)(`div`,{className:`bg-[#0b2961]/95 backdrop-blur-xl border border-[#1d3352] rounded-2xl shadow-2xl p-2 overflow-hidden ring-1 ring-black/5`,children:(0,Y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition-colors group/item cursor-pointer text-left`,onClick:()=>{o(!1),e(`questionnaire`)},children:[(0,Y.jsx)(gv,{size:16,className:`text-slate-400 group-hover/item:text-blue-400`}),(0,Y.jsx)(`span`,{className:`text-sm font-medium text-slate-200 group-hover/item:text-white`,children:`填问卷得奖励`})]}),(0,Y.jsxs)(jc,{to:`/profile`,className:`flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition-colors group/item`,onClick:()=>o(!1),children:[(0,Y.jsx)(wy,{size:16,className:`text-slate-400 group-hover/item:text-blue-400`}),(0,Y.jsx)(`span`,{className:`text-sm font-medium text-slate-200 group-hover/item:text-white`,children:`个人中心`})]}),(0,Y.jsxs)(jc,{to:`/benefits`,className:`flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition-colors group/item`,onClick:()=>o(!1),children:[(0,Y.jsx)(bv,{size:16,className:`text-slate-400 group-hover/item:text-amber-400`}),(0,Y.jsx)(`span`,{className:`text-sm font-medium text-slate-200 group-hover/item:text-white`,children:`我的权益`})]}),(0,Y.jsxs)(jc,{to:`/favorites`,className:`flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition-colors group/item`,onClick:()=>o(!1),children:[(0,Y.jsx)(vy,{size:16,className:`text-slate-400 group-hover/item:text-yellow-400`}),(0,Y.jsx)(`span`,{className:`text-sm font-medium text-slate-200 group-hover/item:text-white`,children:`我的收藏`})]}),(0,Y.jsxs)(`button`,{onClick:()=>{o(!1),e(`resetPassword`)},className:`w-full flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition-colors group/item`,children:[(0,Y.jsx)(Xv,{size:16,className:`text-slate-400 group-hover/item:text-blue-400`}),(0,Y.jsx)(`span`,{className:`text-sm font-medium text-slate-200 group-hover/item:text-white text-left`,children:`重置密码`})]}),(0,Y.jsx)(`div`,{className:`h-px bg-white/5 my-1 mx-2`}),(0,Y.jsxs)(`button`,{onClick:()=>{o(!1),n().then(()=>p(`/`))},className:`w-full flex items-center gap-3 p-3 rounded-xl hover:bg-rose-500/10 transition-colors group/item text-rose-500`,children:[(0,Y.jsx)(Qv,{size:16}),(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`退出登录`})]})]})})})]}):(0,Y.jsx)(`button`,{onClick:()=>e(`login`),className:`text-sm font-medium text-slate-300 hover:text-white transition-colors`,children:`登录 / 注册`})]})]})})}),(0,Y.jsx)(Wy,{open:l,onClose:()=>u(!1),onConfirm:e=>{e&&localStorage.setItem(Ae,`1`),C()}})]})}var Jy=`/assets/logo-light-CAENEWny.png`,Yy=`/assets/assistant2-IaPTywot.png`;function Xy(){return(0,Y.jsx)(`footer`,{className:`bg-slate-50 border-t border-slate-200 pt-6 pb-6 overflow-hidden relative text-slate-900`,children:(0,Y.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,14rem)_1.25fr_1.15fr] gap-8 mb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(jc,{to:`/`,className:`inline-flex items-center group`,children:(0,Y.jsx)(`img`,{src:Jy,alt:`洞见研报`,className:`h-10 w-auto max-w-60 object-contain`})}),(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-bold text-slate-900 leading-relaxed`,children:`让决策有依据,让增长有方向。`}),(0,Y.jsx)(`p`,{className:`text-xs text-slate-500 leading-relaxed italic max-w-xs`,children:`致力于打造专业的研究资源库与决策支持系统,为用户提供穿透迷雾的行业洞察与数据分析。`})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-black text-slate-400 uppercase tracking-[0.2em] border-b border-slate-100 pb-3 italic`,children:`关于平台 / ABOUT`}),(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-slate-600 leading-relaxed font-medium`,children:[(0,Y.jsx)(`span`,{className:`text-blue-600`,children:`洞见研报`}),` 隶属于`,` `,(0,Y.jsx)(`span`,{className:`text-slate-900`,children:`上海顺铭信息科技有限公司`}),`,是以研究与数据驱动的专业信息服务平台。平台覆盖宏观策略、行业发展、上市公司分析等全投资领域资源,整合 7100+ 机构报告与百万级图表数据,构建可追溯、可验证的信息资产库。`]}),(0,Y.jsx)(`p`,{className:`text-xs text-slate-500 leading-relaxed`,children:`依托智能搜索引擎、OCR识别、文档结构化解析与自然语言处理技术,为金融投资、企业管理、咨询、研究及运营领域的专业人士提供高效、实时、专业的决策支持。`})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-black text-slate-400 uppercase tracking-[0.2em] border-b border-slate-100 pb-3 italic`,children:`服务模式 / SERVICES`}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-5`,children:[(0,Y.jsx)(`ul`,{className:`min-w-0 flex-1 space-y-3`,children:[{t:`会员订阅`,d:`获取行业洞察与数据分析`},{t:`企业方案`,d:`定制报告/API,实现信息闭环`},{t:`咨询服务`,d:`提供专家分析与可执行方案`},{t:`商业延伸`,d:`辅助投研与决策落地`}].map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-blue-600 mt-1.5 shrink-0`}),(0,Y.jsxs)(`div`,{className:`text-[11px] leading-tight`,children:[(0,Y.jsxs)(`span`,{className:`font-bold text-slate-800`,children:[e.t,`:`]}),(0,Y.jsx)(`span`,{className:`text-slate-500`,children:e.d})]})]},t))}),(0,Y.jsxs)(`div`,{className:`shrink-0 flex flex-col items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`h-40 w-40 overflow-hidden border border-slate-200 bg-white p-1.5 shadow-sm`,children:(0,Y.jsx)(`img`,{src:Yy,alt:`客服二维码`,className:`h-full w-full object-cover`})}),(0,Y.jsx)(`div`,{className:`text-center text-[10px] font-bold leading-tight text-slate-500`,children:`扫码添加客服`})]})]}),(0,Y.jsxs)(`div`,{className:`pt-4 border-t border-slate-100 flex flex-col gap-2`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] font-black text-slate-400 uppercase tracking-widest text-wrap leading-relaxed`,children:`商务合作、企业采购、机构入驻、报告发布请联系`}),(0,Y.jsx)(`a`,{href:`mailto:collaboration@djyanbao.com`,className:`text-xs font-bold text-blue-600 hover:underline`,children:`collaboration@djyanbao.com`})]})]})]}),(0,Y.jsx)(`div`,{className:`pt-3 border-t border-slate-100`,children:(0,Y.jsxs)(`div`,{className:`flex flex-row justify-between items-end gap-10`,children:[(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-black text-slate-900 uppercase tracking-widest italic`,children:`© 2026 上海顺铭信息科技有限公司`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[10px] font-bold text-slate-400`,children:[(0,Y.jsx)(`span`,{className:`hover:text-slate-900 cursor-pointer transition-colors`,children:`沪ICP备2021005678号-1`}),(0,Y.jsx)(`span`,{className:`hover:text-slate-900 cursor-pointer transition-colors`,children:`沪公网安备 31011002005605号`})]})]}),(0,Y.jsx)(`div`,{className:`text-[10px] font-bold text-slate-400 uppercase tracking-widest`,children:`版本信息:洞见研报 V2.1.0 | 开发者:上海顺铭信息科技有限公司`})]}),(0,Y.jsx)(`div`,{className:`flex flex-col items-end gap-4`,children:(0,Y.jsxs)(`div`,{className:`flex gap-6 text-[10px] font-black text-slate-400 uppercase tracking-widest`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>window.open(`/protocol/privacy`,`_blank`,`noopener,noreferrer`),className:`hover:text-blue-600 transition-colors cursor-pointer`,children:`隐私政策`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>window.open(`/protocol/service`,`_blank`,`noopener,noreferrer`),className:`hover:text-blue-600 transition-colors cursor-pointer`,children:`服务协议`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>window.open(`/protocol/tort`,`_blank`,`noopener,noreferrer`),className:`hover:text-blue-600 transition-colors cursor-pointer`,children:`侵权举报`})]})})]})})]})})}var Zy=sn(e=>({installPrompt:null,canInstall:!1,setInstallPrompt:t=>e({installPrompt:t,canInstall:t!=null}),clear:()=>e({installPrompt:null,canInstall:!1})}));function Qy(){let e=navigator.userAgent.match(/Chrome\/(\d+)/);return e!=null&&Number(e[1])>=79}Qy()&&(window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),Zy.getState().setInstallPrompt(e)}),window.addEventListener(`appinstalled`,()=>{Zy.getState().clear()}));function $y(){let e=Zy(e=>e.installPrompt),t=Zy(e=>e.canInstall),n=Zy(e=>e.clear);return{canInstall:t,install:async()=>{if(!e){G.info(`当前浏览器暂不支持,请使用最新版 Chrome / Edge 访问`);return}try{await e.prompt();let{outcome:t}=await e.userChoice;t===`accepted`?(G.success(`安装成功`),n()):G.error(`安装失败`)}catch{G.error(`安装失败`)}}}}var eb=`/assets/gzh-wmKT-ASu.webp`,tb=`/assets/mini-BvpkFO3_.jpg`,nb=`/assets/app-BVSW1IBg.png`,rb=`/assets/assistant-D1hm7qpC.png`,ib={wechat:eb,miniprogram:tb,app:nb,customer:rb};function ab(){let e=es(),{isAuthenticated:t}=ln(),n=on(e=>e.open),{canInstall:r}=$y(),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(()=>window.scrollY>0);(0,J.useEffect)(()=>{let e=()=>{s(window.scrollY>0)};return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]);let c=()=>{document.documentElement.scrollTo({top:0,behavior:`smooth`})};return(0,Y.jsxs)(`div`,{className:`fixed top-1/2 right-0 ${xe.chrome} -translate-y-1/2`,children:[(0,Y.jsxs)(`div`,{className:`absolute top-1/2 right-0 z-10 flex -translate-y-1/2 flex-col items-end ${i?`pointer-events-auto opacity-100 delay-200 duration-300`:`pointer-events-none opacity-0 delay-0 duration-150`} transition-opacity ease-out`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>a(!1),title:`展开侧边栏`,className:`flex cursor-pointer items-center justify-center rounded-l-2xl border border-slate-200/50 bg-white p-2.5 text-blue-500 shadow-[0_10px_30px_rgba(15,23,42,0.08)] transition-colors hover:text-blue-700`,children:(0,Y.jsx)(fv,{size:18,className:`stroke-[2.5]`})}),(0,Y.jsx)(`button`,{type:`button`,onClick:c,title:`返回顶部`,"aria-hidden":!o,tabIndex:o&&i?0:-1,className:`mt-2.5 flex cursor-pointer items-center justify-center rounded-l-2xl border border-slate-200/50 bg-white p-2.5 text-blue-500 transition-opacity duration-300 hover:text-blue-700 ${o?`opacity-100`:`pointer-events-none opacity-0`}`,children:(0,Y.jsx)(W_,{size:18,className:`stroke-[2.5]`})})]}),(0,Y.jsx)(`div`,{className:`relative z-20 will-change-transform transition-transform duration-500 ease-in-out ${i?`pointer-events-none translate-x-19`:`translate-x-0`}`,children:(0,Y.jsxs)(`div`,{className:`flex w-19 flex-col items-center gap-1.5 rounded-l-3xl border-y border-l border-slate-200/50 bg-white/90 p-2 py-2.5 shadow-[0_20px_50px_rgba(15,23,42,0.08)]`,children:[(0,Y.jsx)(sb,{icon:(0,Y.jsx)(wy,{size:20,className:`stroke-[2.25]`}),label:`公众号`,qrType:`wechat`,iconColorClass:`text-[#2E78C7]`}),(0,Y.jsx)(sb,{icon:(0,Y.jsx)(ob,{}),label:`接入AI`,onClick:()=>e(`/agent-interface`),featured:!0}),(0,Y.jsx)(sb,{icon:(0,Y.jsx)(Kv,{size:20,className:`stroke-[2.25]`}),label:`小程序`,qrType:`miniprogram`,iconColorClass:`text-[#2E78C7]`}),(0,Y.jsx)(sb,{icon:(0,Y.jsx)(fy,{size:20,className:`stroke-[2.25]`}),label:`APP`,qrType:`app`,iconColorClass:`text-[#2E78C7]`}),(0,Y.jsx)(sb,{icon:(0,Y.jsx)(ny,{size:20,className:`stroke-[2.25]`}),label:`联系客服`,qrType:`customer`,iconColorClass:`text-[#2E78C7]`}),r&&(0,Y.jsx)(sb,{icon:(0,Y.jsx)(iy,{size:20,className:`stroke-[2.25]`}),label:`桌面端`,onClick:()=>n(`desktopInstall`),iconColorClass:`text-[#2E78C7]`}),(0,Y.jsx)(sb,{icon:(0,Y.jsx)(en,{size:20,className:`stroke-[2.25]`}),label:`邀请有奖`,onClick:()=>{if(!t){n(`login`);return}n(`inviteReward`)},iconBgClass:`bg-linear-to-tr from-[#FFF3E0] to-[#FFE0B2]`,iconColorClass:`text-[#2E78C7]`}),(0,Y.jsx)(sb,{icon:(0,Y.jsx)(bv,{size:20,className:`stroke-[2.25]`}),label:`立即加入计划`,onClick:()=>e(`/services`),iconBgClass:`bg-linear-to-tr from-[#FFE0E6] to-[#FFCDD2]`,iconColorClass:`text-[#2E78C7]`,labelClassName:`text-[9px]`}),(0,Y.jsx)(`div`,{className:`w-full overflow-hidden transition-[max-height,opacity] duration-300 ease-out ${o?`max-h-16 opacity-100`:`max-h-0 opacity-0`}`,children:(0,Y.jsx)(sb,{icon:(0,Y.jsx)(K_,{size:20,className:`stroke-[2.25]`}),label:`回到顶部`,onClick:c,iconColorClass:`text-[#2E78C7]`})}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>a(!0),title:`收起侧边栏`,className:`mt-1 flex h-7 w-full shrink-0 cursor-pointer items-center justify-center border-t border-slate-100/60 pt-2 text-blue-500 transition-colors hover:text-blue-700`,children:(0,Y.jsx)(mv,{size:18,className:`stroke-[2.5]`})})]})})]})}function ob(){return(0,Y.jsxs)(`svg`,{viewBox:`0 0 40 40`,className:`h-9 w-9 drop-shadow-[0_2px_8px_rgba(37,99,235,0.35)]`,"aria-hidden":!0,children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsxs)(`linearGradient`,{id:`aiRobotFace`,x1:`8`,y1:`10`,x2:`32`,y2:`32`,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#60A5FA`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#2563EB`})]}),(0,Y.jsxs)(`linearGradient`,{id:`aiRobotShell`,x1:`6`,y1:`4`,x2:`34`,y2:`36`,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#EFF6FF`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#DBEAFE`})]})]}),(0,Y.jsx)(`circle`,{cx:`20`,cy:`5.5`,r:`1.6`,fill:`#38BDF8`}),(0,Y.jsx)(`path`,{d:`M20 7.2V10`,stroke:`#93C5FD`,strokeWidth:`1.4`,strokeLinecap:`round`}),(0,Y.jsx)(`ellipse`,{cx:`20`,cy:`21`,rx:`13.5`,ry:`12.5`,fill:`url(#aiRobotShell)`}),(0,Y.jsx)(`ellipse`,{cx:`7.2`,cy:`20`,rx:`3.2`,ry:`4`,fill:`#C4B5FD`}),(0,Y.jsx)(`ellipse`,{cx:`32.8`,cy:`20`,rx:`3.2`,ry:`4`,fill:`#C4B5FD`}),(0,Y.jsx)(`rect`,{x:`10`,y:`13.5`,width:`20`,height:`15`,rx:`5`,fill:`url(#aiRobotFace)`}),(0,Y.jsx)(`circle`,{cx:`16.2`,cy:`21`,r:`3.1`,fill:`white`}),(0,Y.jsx)(`circle`,{cx:`23.8`,cy:`21`,r:`3.1`,fill:`white`}),(0,Y.jsx)(`circle`,{cx:`16.6`,cy:`21.3`,r:`1.45`,fill:`#1E3A8A`}),(0,Y.jsx)(`circle`,{cx:`24.2`,cy:`21.3`,r:`1.45`,fill:`#1E3A8A`}),(0,Y.jsx)(`circle`,{cx:`17.1`,cy:`20.7`,r:`0.45`,fill:`white`}),(0,Y.jsx)(`circle`,{cx:`24.7`,cy:`20.7`,r:`0.45`,fill:`white`})]})}var sb=({icon:e,label:t,qrType:n,iconBgClass:r=``,iconColorClass:i=`text-blue-500/85`,labelClassName:a=`text-[10px]`,featured:o=!1,onClick:s})=>{let c=n?{wechat:{title:`微信扫码关注公众号`,desc:`「洞见研报」官方服务号`,badge:`关注即领 25元 洞见卡`,badgeClass:`bg-emerald-50 text-emerald-700 border-emerald-100/60`},miniprogram:{title:`微信扫码查报告`,desc:`海量全景行业与公司研究成果`,badge:`一键查阅 · 同步追踪`,badgeClass:`bg-blue-50 text-blue-700 border-blue-100/60`},app:{title:`扫客户端体验更佳`,desc:`随时随地深度解锁精彩研报`,badge:`支持 iOS & Android`,badgeClass:`bg-indigo-50 text-indigo-700 border-indigo-100/60`},customer:{title:`扫码添加客服`,desc:`快速详细解答您的任何疑惑`}}[n]:null,l=n===`wechat`?`border-emerald-100`:n===`miniprogram`?`border-blue-100`:n===`app`?`border-indigo-100`:`border-cyan-100`;return(0,Y.jsxs)(`div`,{className:`relative group w-full flex flex-col items-center`,children:[(0,Y.jsxs)(`div`,{role:s?`button`:void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}:void 0,className:o?`relative z-0 w-full h-14 py-1 flex flex-col items-center justify-center cursor-pointer rounded-2xl select-none`:`w-full h-14 py-1 flex flex-col items-center justify-center cursor-pointer rounded-xl select-none transition-colors duration-200 hover:bg-slate-50`,children:[o&&(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 -z-10 rounded-2xl bg-[radial-gradient(circle_at_50%_40%,rgba(96,165,250,0.38)_0%,rgba(147,197,253,0.16)_48%,transparent_74%)]`}),(0,Y.jsx)(`div`,{className:o?`flex h-9 w-9 items-center justify-center transition-transform duration-200 group-hover:scale-110`:`w-9 h-9 rounded-full flex items-center justify-center ${r||`bg-transparent`} ${i}`,children:e}),(0,Y.jsx)(`span`,{className:`${a} tracking-tight mt-0.5 text-center leading-tight px-0.5 ${o?`font-bold text-[#2563eb]`:`font-semibold text-slate-500`}`,children:t})]}),n&&c&&(0,Y.jsx)(`div`,{className:`absolute right-full top-1/2 z-50 -translate-y-1/2 pr-3 opacity-0 pointer-events-none translate-x-1 transition-[opacity,transform] duration-200 ease-out group-hover:opacity-100 group-hover:pointer-events-auto group-hover:translate-x-0`,children:(0,Y.jsxs)(`div`,{className:`w-50 rounded-2xl border bg-white p-3.5 text-center shadow-[0_12px_32px_rgba(15,23,42,0.12)] ${l}`,children:[(0,Y.jsxs)(`div`,{className:`mb-2.5 space-y-1`,children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-bold text-slate-800 leading-snug tracking-tight`,children:c.title}),(0,Y.jsx)(`p`,{className:`text-[11px] text-slate-400 font-medium leading-snug`,children:c.desc})]}),(0,Y.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-slate-100 bg-slate-50 p-2`,children:(0,Y.jsx)(`img`,{src:ib[n],alt:c.title,className:`h-30 w-30 rounded-lg object-contain bg-white`})}),c.badge&&c.badgeClass&&(0,Y.jsx)(`div`,{className:`mt-2.5 inline-flex text-[10px] font-semibold py-1 px-2.5 rounded-md border leading-none ${c.badgeClass}`,children:c.badge})]})})]})},cb=`https://www.djyanbao.com`.replace(/\/$/,``),lb=`洞见研报`,ub=`${cb}/#organization`,db=`${cb}/#website`,fb=`洞见研报收录最新、最全行业研究报告,免费阅读下载市场分析报告,公司研究报告,竞对分析,全文关键词高级检索,下载PDF,PPT,Word等格式`;function pb(e){return!e||e===`/`?`${cb}/`:`${cb}${e.startsWith(`/`)?e:`/${e}`}`}var mb=(0,J.createContext)(null);function hb({children:e,siteJsonLd:t=[]}){let{pathname:n}=Zo(),[r,i]=(0,J.useState)(null),a=(0,J.useCallback)(e=>{i(e)},[]),o=`${lb}-专业的研究资源库与决策支持系统`,s=r?.title?r.noTitleSuffix?r.title:`${r.title} | ${lb}`:o,c=r?.description||`洞见研报收录最新、最全行业研究报告,免费阅读下载市场分析报告,公司研究报告,竞对分析,全文关键词高级检索,下载PDF,PPT,Word等格式`,l=r?.keywords||`咨询报告,行业研究,券商研报,研报下载,智库,管理咨询`,u=r?.canonical||pb(n),d=r?.noindex??!1,f=r?.jsonLd?Array.isArray(r.jsonLd)?r.jsonLd:[r.jsonLd]:[],p=[...t,...f];return(0,Y.jsxs)(mb.Provider,{value:{setPageSeo:a},children:[(0,Y.jsxs)(br,{children:[(0,Y.jsx)(`html`,{lang:`zh-CN`}),(0,Y.jsx)(`title`,{children:s}),(0,Y.jsx)(`meta`,{name:`description`,content:c}),(0,Y.jsx)(`meta`,{name:`keywords`,content:l}),d?(0,Y.jsx)(`meta`,{name:`robots`,content:`noindex, nofollow`}):null,(0,Y.jsx)(`meta`,{property:`og:title`,content:s}),(0,Y.jsx)(`meta`,{property:`og:description`,content:c}),(0,Y.jsx)(`meta`,{property:`og:type`,content:`website`}),(0,Y.jsx)(`meta`,{property:`og:url`,content:u}),(0,Y.jsx)(`meta`,{property:`og:locale`,content:`zh_CN`}),(0,Y.jsx)(`link`,{rel:`canonical`,href:u}),p.map((e,t)=>(0,Y.jsx)(`script`,{type:`application/ld+json`,children:JSON.stringify(e)},t))]}),e]})}function gb(e){let t=(0,J.useContext)(mb);if(t==null)throw Error(`useRegisterPageSeo must be used within SeoProvider`);let{setPageSeo:n}=t,{title:r,description:i,keywords:a,canonical:o,jsonLd:s,noTitleSuffix:c=!1,noindex:l=!1}=e,u=JSON.stringify(s??null);(0,J.useLayoutEffect)(()=>(n({title:r,description:i,keywords:a,canonical:o,jsonLd:s,noTitleSuffix:c,noindex:l}),()=>n(null)),[n,r,i,a,o,s,u,c,l])}function _b(){return{"@context":`https://schema.org`,"@type":`Organization`,"@id":ub,name:lb,url:`${cb}/`,description:fb,areaServed:{"@type":`Country`,name:`中国`}}}function vb(){return{"@context":`https://schema.org`,"@type":`WebSite`,"@id":db,url:`${cb}/`,name:lb,alternateName:`洞见研报-专业的研究资源库与决策支持系统`,description:fb,publisher:{"@id":ub},inLanguage:`zh-CN`}}function yb(e){return{"@context":`https://schema.org`,"@type":`BreadcrumbList`,itemListElement:e.map((e,t)=>({"@type":`ListItem`,position:t+1,name:e.name,item:pb(e.path)}))}}function bb(e){return{"@context":`https://schema.org`,"@type":`FAQPage`,mainEntity:e.map(e=>({"@type":`Question`,name:e.q,acceptedAnswer:{"@type":`Answer`,text:e.a}}))}}function xb(e){let t=pb(e.path);return{"@context":`https://schema.org`,"@type":`Article`,"@id":`${t}#article`,headline:e.headline,description:e.description,author:{"@id":ub},publisher:{"@id":ub},datePublished:e.datePublished,inLanguage:`zh-CN`,mainEntityOfPage:t,...e.image?{image:e.image}:{}}}function Sb(...e){let t=[];for(let n of e)n&&(Array.isArray(n)?t.push(...n):t.push(n));return t}function Cb(){let e=xs(),t=e.some(e=>e.handle?.hideHeader),n=e.some(e=>e.handle?.hideFooter),r=e.some(e=>e.handle?.hideSidebar),i=Sb(_b(),vb());return(0,Y.jsx)(hb,{siteJsonLd:i,children:(0,Y.jsxs)(`main`,{className:`flex min-h-screen flex-col selection:bg-blue-100 selection:text-primary`,children:[!t&&(0,Y.jsx)(qy,{}),!t&&(0,Y.jsx)(`div`,{className:`h-16 shrink-0`}),(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,Y.jsx)(zs,{})}),!n&&(0,Y.jsx)(Xy,{}),!r&&(0,Y.jsx)(ab,{})]})})}var wb=`请输入手机号`,Tb=`请输入正确的手机号`,Eb=`请输入验证码`,Db=`请输入4位数字验证码`,Ob=`请输入密码`,kb=`密码仅支持6-18位数字和字母`,Ab=`请再次输入密码`,jb=`两次输入的密码不一致`,Mb=`邮箱不能为空`,Nb=`邮箱格式错误`;function Pb(e){return/^1[3-9]\d{9}$/.test(e)}function Fb(e){return/^[a-zA-Z0-9]{6,18}$/.test(e)}function Ib(e){return/^\d{4}$/.test(e)}function Lb(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function Rb(e){let t=e.trim();return t?Pb(t)?{ok:!0,value:t}:{ok:!1,message:Tb}:{ok:!1,message:wb}}function zb(e){let t=e.trim();return t?Ib(t)?{ok:!0,value:t}:{ok:!1,message:Db}:{ok:!1,message:Eb}}function Bb(e){return e?Fb(e)?{ok:!0,value:e}:{ok:!1,message:kb}:{ok:!1,message:Ob}}function Vb(e,t){return t?e===t?{ok:!0,value:t}:{ok:!1,message:jb}:{ok:!1,message:Ab}}function Hb(e){let t=e.trim();return t?Lb(t)?{ok:!0,value:t}:{ok:!1,message:Nb}:{ok:!1,message:Mb}}function Ub(){window.open(`/protocol/service`,`_blank`,`noopener,noreferrer`)}function Wb({isOpen:e,onClose:t,onForgotPassword:n,onLoginSuccess:r}){let{login:i,loginByWechat:a}=ln(),[o,s]=(0,J.useState)(`qr`),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!0),[v,y]=(0,J.useState)(!1),[b,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(0),[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(null),[O,k]=(0,J.useState)(!1),A=(0,J.useCallback)(e=>{if(e.message){G.error(e.message);return}a({user:e.user,accessToken:e.token.accessToken}),G.success(`登录成功`),t(),r?.()},[a,t,r]);hn(e&&o===`qr`,E,A,`mp_login`,`mp_login_rst`),(0,J.useEffect)(()=>{if(!e||o!==`qr`)return;let t=mn(),n=!1;return k(!0),T(null),D(null),(async()=>{try{let e=await Ne({scene:t});if(n)return;T(e.url),D(t)}catch{if(n)return;T(null),D(null)}finally{n||k(!1)}})(),()=>{n=!0}},[e,o]),(0,J.useEffect)(()=>{if(S<=0)return;let e=setInterval(()=>{C(e=>e<=1?0:e-1)},1e3);return()=>clearInterval(e)},[S]);let j=()=>{let e=Rb(c);return e.ok===!1?(G.info(e.message),null):e.value},M=async()=>{if(S>0)return;let e=j();if(e){x(!0);try{await we({mobile:e}),G.success(`验证码已发送`),C(60)}finally{x(!1)}}},N=async()=>{if(!g){G.info(`请先同意服务协议`);return}let e=j();if(e){if(o===`password`){let e=Bb(u);if(e.ok===!1){G.info(e.message);return}}else if(o===`code`){let e=zb(f);if(e.ok===!1){G.info(e.message);return}}y(!0);try{o===`password`?await i({type:`password`,phone:e,password:u}):await i({type:`sms`,mobile:e,code:f.trim()}),G.success(`登录成功`),t(),r?.()}finally{y(!1)}}},P=(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer group`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500/20 cursor-pointer`}),(0,Y.jsxs)(`span`,{className:`text-xs text-slate-400 group-hover:text-slate-500 transition-colors`,children:[`登录即表示您同意`,` `,(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),Ub()},className:`text-[#1875e5] hover:underline font-semibold`,children:`《洞见研报网站服务协议》`})]})]});return e?(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-start justify-center pt-[15vh] p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},className:`relative w-full ${o===`qr`?`max-w-140`:`max-w-105`} bg-white border border-slate-100 rounded-[28px] shadow-[0_25px_60px_rgba(0,0,0,0.12)] overflow-hidden transition-all duration-300`,children:[(0,Y.jsx)(`div`,{className:`absolute top-0 inset-x-0 h-1.5 bg-linear-to-r from-blue-500 via-indigo-500 to-blue-600`}),(0,Y.jsx)(`button`,{onClick:t,className:`absolute top-5 right-5 text-slate-400 hover:text-slate-600 transition-colors p-1.5 hover:bg-slate-50 rounded-full z-20 cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsx)(`div`,{className:`relative z-10 p-10`,children:o===`qr`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4 mb-8`,children:[(0,Y.jsx)(`div`,{className:`w-10 h-10 bg-[#07c160] rounded-full flex items-center justify-center text-white shrink-0`,children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`w-5.5 h-5.5 fill-current`,children:(0,Y.jsx)(`path`,{d:`M8.5 13.5c-.828 0-1.5-.672-1.5-1.5s.672-1.5 1.5-1.5 1.5.672 1.5 1.5-.672 1.5-1.5 1.5zm7 0c-.828 0-1.5-.672-1.5-1.5s.672-1.5 1.5-1.5 1.5.672 1.5 1.5-.672 1.5-1.5 1.5zM12 2C6.477 2 2 6.477 2 12c0 1.891.524 3.66 1.435 5.168L2.12 21.88l4.712-1.312C8.34 21.476 10.109 22 12 22c5.523 0 10-4.477 10-10S17.523 2 12 2zm0 18c-1.477 0-2.87-.393-4.073-1.078l-.293-.167-2.827.787.787-2.827-.167-.293A7.95 7.95 0 014 12c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z`})})}),(0,Y.jsx)(`h2`,{className:`text-2xl font-bold text-[#113171] leading-tight tracking-tight`,children:`微信扫码关注公众号立即登录`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-row items-start gap-8`,children:[(0,Y.jsx)(`div`,{className:`bg-slate-50 p-2 rounded-2xl border border-slate-100 shadow-sm shrink-0`,children:(0,Y.jsx)(`div`,{className:`bg-white p-2 rounded-xl w-39 h-39 flex items-center justify-center`,children:O?(0,Y.jsx)(`span`,{className:`text-xs text-slate-400 text-center`,children:`二维码加载中...`}):w?(0,Y.jsx)(pn,{value:w,size:140,bgColor:`#ffffff`,fgColor:`#333333`,level:`L`,marginSize:0,"aria-label":`微信登录二维码`}):(0,Y.jsx)(`span`,{className:`text-xs text-slate-400 text-center`,children:`二维码加载失败`})})}),(0,Y.jsxs)(`div`,{className:`flex-1 space-y-4 pt-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,Y.jsx)(`div`,{className:`mt-0.5 text-amber-500`,children:(0,Y.jsx)(en,{size:22,fill:`currentColor`})}),(0,Y.jsx)(`p`,{className:`text-sm font-bold text-slate-800 leading-snug`,children:`新用户注册成功后,联系小助理可获百份深度热门研报`})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-slate-500 leading-relaxed bg-amber-50/50 border border-amber-50 rounded-xl p-3`,children:[`关注公众号即得价值 `,(0,Y.jsx)(`span`,{className:`text-[#113171] font-bold`,children:`¥ 25元`}),` `,`洞见卡,畅享研报免费下载`]})]})]}),(0,Y.jsxs)(`div`,{className:`mt-10 pt-6 border-t border-slate-100 flex flex-row items-center justify-between gap-4`,children:[P,(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>s(`password`),className:`text-slate-500 hover:text-[#1875e5] text-xs font-bold flex items-center gap-0.5 group shrink-0`,children:[(0,Y.jsx)(`span`,{children:`密码登录`}),(0,Y.jsx)(mv,{size:14,className:`group-hover:translate-x-0.5 transition-transform text-slate-400 group-hover:text-[#1875e5]`})]})]})]}):(0,Y.jsxs)(`div`,{className:`animate-in fade-in slide-in-from-bottom-3 duration-200`,children:[(0,Y.jsxs)(`div`,{className:`text-center mb-8`,children:[(0,Y.jsx)(`h2`,{className:`text-[26px] font-bold text-[#113171] tracking-tight`,children:o===`password`?`密码登录`:`验证码登录`}),(0,Y.jsx)(`p`,{className:`text-[#8a8a8a] text-sm mt-2`,children:`欢迎回来,请填写您的账号信息`})]}),(0,Y.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),N()},children:[(0,Y.jsx)(`div`,{className:`space-y-1`,children:(0,Y.jsx)(`input`,{type:`tel`,value:c,onChange:e=>l(e.target.value),placeholder:`请输入手机号`,maxLength:11,className:`w-full bg-white border border-[#e1e1e1] rounded-2xl py-3.5 px-5 text-slate-800 placeholder:text-slate-400 outline-none focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50 transition-[border-color,box-shadow] font-medium text-sm`})}),o===`password`?(0,Y.jsxs)(`div`,{className:`space-y-1 relative`,children:[(0,Y.jsx)(`input`,{type:m?`text`:`password`,value:u,onChange:e=>d(e.target.value),placeholder:`请输入密码`,maxLength:18,className:`w-full bg-white border border-[#e1e1e1] rounded-2xl py-3.5 px-5 pr-12 text-slate-800 placeholder:text-slate-400 outline-none focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50 transition-[border-color,box-shadow] font-medium text-sm`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 transition-colors p-0.5 cursor-pointer`,"aria-label":m?`隐藏密码`:`显示密码`,children:m?(0,Y.jsx)(Ev,{size:18}):(0,Y.jsx)(wv,{size:18})})]}):(0,Y.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,Y.jsx)(`input`,{type:`text`,inputMode:`numeric`,value:f,onChange:e=>p(e.target.value.replace(/\D/g,``).slice(0,4)),placeholder:`验证码`,maxLength:4,className:`flex-1 bg-white border border-[#e1e1e1] rounded-2xl py-3.5 px-5 text-slate-800 placeholder:text-slate-400 outline-none focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50 transition-[border-color,box-shadow] font-medium text-sm`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void M(),disabled:b||S>0,className:`px-5 bg-slate-50 hover:bg-slate-100 border border-[#e1e1e1] rounded-2xl text-xs font-bold text-slate-700 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed shrink-0 min-w-25`,children:b?`发送中...`:S>0?`${S}s后重发`:`获取验证码`})]}),(0,Y.jsx)(`div`,{className:`pt-1`,children:P}),(0,Y.jsx)(`button`,{type:`submit`,disabled:v,className:`w-full bg-[#1875e5] hover:bg-[#1669ce] text-white font-bold py-3.5 rounded-full shadow-lg shadow-blue-500/10 transition-all active:scale-[0.98] mt-2 text-[15px] cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed`,children:v?`登录中...`:`立即登录`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-xs pt-3 px-1 text-[#8a8a8a] font-semibold`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>s(o===`password`?`code`:`password`),className:`hover:text-[#1875e5] transition-colors cursor-pointer`,children:o===`password`?`验证码登录`:`密码登录`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{t(),n?.()},className:`hover:text-[#1875e5] transition-colors cursor-pointer`,children:`忘记密码?`})]})]}),(0,Y.jsx)(`div`,{className:`mt-10 text-center border-t border-slate-100 pt-5`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>s(`qr`),className:`text-[#1875e5] hover:text-[#1669ce] text-sm font-bold flex items-center justify-center gap-1 mx-auto hover:underline cursor-pointer`,children:`返回扫码登录`})})]})})]})]})}):null}function Gb({isOpen:e,onClose:t}){let{user:n}=ln(),[r,i]=(0,J.useState)(n?.phone??``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(0),x=(0,J.useCallback)(()=>{i(``),o(``),c(``),u(``),f(!1),m(!1),b(0)},[]),S=()=>{t()},C=()=>{x(),t()};(0,J.useEffect)(()=>{if(y<=0)return;let e=setInterval(()=>{b(e=>e<=1?0:e-1)},1e3);return()=>clearInterval(e)},[y]);let w=()=>{let e=Rb(r);return e.ok===!1?(G.info(e.message),null):e.value},T=async()=>{if(y>0)return;let e=w();if(e){v(!0);try{await we({mobile:e}),G.success(`验证码已发送`),b(60)}finally{v(!1)}}},E=async()=>{let e=w();if(!e)return;let t=zb(a);if(t.ok===!1){G.info(t.message);return}let n=Bb(s);if(n.ok===!1){G.info(n.message);return}let r=Vb(s,l);if(r.ok===!1){G.info(r.message);return}g(!0);try{await He({phone:e,code:t.value,password:s}),G.success(`密码重置成功`),C()}catch{G.error(`密码重置失败,请稍后重试`)}finally{g(!1)}};return e?(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:S,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-105 bg-white border border-slate-100 rounded-[28px] shadow-[0_25px_60px_rgba(0,0,0,0.12)] overflow-hidden transition-all duration-300`,children:[(0,Y.jsx)(`div`,{className:`absolute top-0 inset-x-0 h-1.5 bg-linear-to-r from-blue-500 via-indigo-500 to-blue-600`}),(0,Y.jsx)(`button`,{type:`button`,onClick:S,className:`absolute top-5 right-5 text-slate-400 hover:text-slate-600 transition-colors p-1.5 hover:bg-slate-50 rounded-full z-20 cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`relative z-10 p-10`,children:[(0,Y.jsxs)(`div`,{className:`text-center mb-8`,children:[(0,Y.jsx)(`h2`,{className:`text-[26px] font-bold text-[#113171] tracking-tight`,children:`重置密码`}),(0,Y.jsx)(`p`,{className:`text-[#8a8a8a] text-sm mt-2`,children:`请验证您的手机号并设置新密码`})]}),(0,Y.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),E()},children:[(0,Y.jsx)(`input`,{type:`tel`,value:r,onChange:e=>i(e.target.value),placeholder:`请输入手机号`,maxLength:11,className:`w-full bg-white border border-[#e1e1e1] rounded-2xl py-3.5 px-5 text-slate-800 placeholder:text-slate-400 outline-none focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50 transition-[border-color,box-shadow] font-medium text-sm`}),(0,Y.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,Y.jsx)(`input`,{type:`text`,inputMode:`numeric`,value:a,onChange:e=>o(e.target.value.replace(/\D/g,``).slice(0,4)),placeholder:`验证码`,maxLength:4,className:`flex-1 bg-white border border-[#e1e1e1] rounded-2xl py-3.5 px-5 text-slate-800 placeholder:text-slate-400 outline-none focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50 transition-[border-color,box-shadow] font-medium text-sm`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void T(),disabled:_||y>0,className:`px-5 bg-slate-50 hover:bg-slate-100 border border-[#e1e1e1] rounded-2xl text-xs font-bold text-slate-700 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed shrink-0 min-w-25`,children:_?`发送中...`:y>0?`${y}s后重发`:`获取验证码`})]}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:d?`text`:`password`,value:s,onChange:e=>c(e.target.value),placeholder:`请输入新密码(6-18位数字或字母)`,maxLength:18,className:`w-full bg-white border border-[#e1e1e1] rounded-2xl py-3.5 pl-5 pr-12 text-slate-800 placeholder:text-slate-400 outline-none focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50 transition-[border-color,box-shadow] font-medium text-sm`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),className:`absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 transition-colors p-0.5 cursor-pointer`,"aria-label":d?`隐藏密码`:`显示密码`,children:d?(0,Y.jsx)(Ev,{size:18}):(0,Y.jsx)(wv,{size:18})})]}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:p?`text`:`password`,value:l,onChange:e=>u(e.target.value),placeholder:`请再次输入新密码`,maxLength:18,className:`w-full bg-white border border-[#e1e1e1] rounded-2xl py-3.5 pl-5 pr-12 text-slate-800 placeholder:text-slate-400 outline-none focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50 transition-[border-color,box-shadow] font-medium text-sm`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 transition-colors p-0.5 cursor-pointer`,"aria-label":p?`隐藏确认密码`:`显示确认密码`,children:p?(0,Y.jsx)(Ev,{size:18}):(0,Y.jsx)(wv,{size:18})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 pt-4 mt-2`,children:[(0,Y.jsx)(`button`,{type:`submit`,disabled:h,className:`flex-1 bg-[#1875e5] hover:bg-[#1669ce] text-white font-bold py-3.5 rounded-full shadow-lg shadow-blue-500/10 transition-all active:scale-[0.98] text-[15px] cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed`,children:h?`提交中...`:`重置密码`}),(0,Y.jsx)(`button`,{type:`button`,onClick:C,className:`px-6 py-3.5 border border-[#e1e1e1] hover:bg-slate-50 text-slate-500 hover:text-slate-700 text-sm font-semibold rounded-full transition-colors cursor-pointer`,children:`取消`})]})]})]})]})]})}):null}var Kb=`/assets/service-Cvh5Crlp.png`;function qb({isOpen:e,onClose:t,subtitle:n}){return e?(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-105 bg-white border border-slate-100 rounded-[28px] shadow-[0_25px_60px_rgba(0,0,0,0.12)] overflow-hidden transition-all duration-300`,children:[(0,Y.jsx)(`div`,{className:`absolute top-0 inset-x-0 h-1.5 bg-linear-to-r from-blue-500 via-indigo-500 to-blue-600`}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`absolute top-5 right-5 text-slate-400 hover:text-slate-600 transition-colors p-1.5 hover:bg-slate-50 rounded-full z-20 cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`relative z-10 p-10 text-center`,children:[(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`div`,{className:`w-12 h-12 bg-blue-50 text-blue-600 rounded-full flex items-center justify-center mx-auto mb-3.5`,children:(0,Y.jsx)(ny,{size:24})}),(0,Y.jsx)(`h2`,{className:`text-[26px] font-bold text-[#113171] tracking-tight`,children:`添加客服微信`}),n?(0,Y.jsx)(`p`,{className:`text-[#8a8a8a] text-sm mt-2 leading-relaxed`,children:n}):null]}),(0,Y.jsxs)(`div`,{className:`relative overflow-hidden p-4 bg-slate-50 rounded-2xl border border-slate-100 w-fit mx-auto mb-4 shadow-inner`,children:[(0,Y.jsx)(`img`,{src:Kb,alt:`客服二维码`,className:`w-48 h-48 rounded-xl object-cover`}),(0,Y.jsx)(`div`,{className:`service-wechat-qr-scan-line`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-blue-600 text-[13px] font-extrabold bg-blue-50 px-3 py-1 rounded-full w-fit mx-auto`,children:`微信扫一扫 · 添加好友`}),(0,Y.jsx)(`p`,{className:`text-slate-400 text-[10px]`,children:`1对1 深度适配客户需求,伴您洞见商机`})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`mt-8 w-full bg-[#1875e5] hover:bg-[#1669ce] text-white font-bold py-3.5 rounded-full shadow-lg shadow-blue-500/10 transition-all active:scale-[0.98] text-[15px] cursor-pointer`,children:`我知道了`})]})]})]})}):null}var Jb=`/assets/limit_banner-CPeFI-dG.png`,Yb=`/assets/read_limit_banner-DxxiHXll.png`,Xb=`/assets/svip-author-B96ZFrSR.png`,Zb=n(Xt(),1);function Qb(e,t=(0,Zb.default)()){return e?Jt(e).endOf(`day`).isAfter(Jt(t)):!1}function $b(e,t){if(!e||e.userLevel!==t)return!1;let n=rn[t];return Qb(e[n])}function ex(e){let t=$b(e,`VIP0`),n=$b(e,`VIP`),r=$b(e,`SVIP`),i=$b(e,`SHARED_VIP`),a=t||n||r||i;return{hasActiveVipMembership:a,isStandardVip:t,isAdvancedVip:n,isCoCreationVip:r,isTeamVip:i,activeMembershipLevel:a&&e?e.userLevel:`NONE`}}function tx(){let{user:e}=ln();return(0,J.useMemo)(()=>ex(e),[e])}function nx(e,t){return e===`view`?``:e===`download`?t?`您本月的报告查看或下载额度已用完,请使用洞见卡支付`:`下载该报告需开通VIP或使用洞见卡支付`:e===`favorite`?`您的收藏篇数已达免费用户上限,获取无限收藏容量,您可以`:e===`chart`?`洞见数据仅限高阶VIP用户使用。`:`该功能为VIP用户专享,每天仅需0.45元,畅享全部功能和报告下载!`}function rx(e){return e===`view`?Yb:e===`chart`?Xb:Jb}function ix({isOpen:e,onClose:t,type:n=`other`,reportId:r}){let i=on(e=>e.open),{hasActiveVipMembership:a}=tx(),o=a,[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(0),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),_=n===`view`||n===`download`,v=!o||n===`chart`,y=n===`view`,b=(0,J.useCallback)(async()=>{await Promise.all([(async()=>{try{let e=await ve();u(e.balance)}catch{}})(),(async()=>{if(r!=null)try{let e=await ye(r);f(e),c(e.cards)}catch{}})()])},[r]);if((0,J.useEffect)(()=>{e&&b()},[e,b]),!e)return null;let x=nx(n,o),S=rx(n),C=()=>{t()},w=()=>{m(!1),t()};return(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:C,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-122 bg-white border border-slate-100 rounded-[28px] shadow-[0_25px_60px_rgba(0,0,0,0.12)] overflow-hidden`,children:[(0,Y.jsx)(`div`,{className:`absolute top-0 inset-x-0 h-1.5 bg-linear-to-r from-blue-500 via-indigo-500 to-blue-600 z-10`}),!p&&(0,Y.jsx)(`button`,{type:`button`,onClick:C,className:`absolute top-5 right-5 text-slate-400 hover:text-slate-600 transition-colors p-1.5 hover:bg-white/80 rounded-full z-20 cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsx)(`img`,{src:S,alt:``,className:`w-full h-40 object-cover bg-[#eaf1fe]`}),(0,Y.jsxs)(`div`,{className:`px-8 py-6 text-center`,children:[x?(0,Y.jsx)(`p`,{className:`text-[18px] font-bold text-[#202a33] leading-8 mb-5`,children:x}):(0,Y.jsx)(`div`,{className:`h-2`}),v&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{w(),i(`payVip`)},className:`block w-full max-w-70 mx-auto bg-[#1875e5] hover:bg-[#1669ce] text-white font-bold py-3.5 rounded-full shadow-lg shadow-blue-500/10 transition-all active:scale-[0.98] text-[14px] cursor-pointer`,children:`开通VIP免费下载,低至14元/月`}),_&&(0,Y.jsxs)(`button`,{type:`button`,disabled:h,onClick:async()=>{if(!(h||r==null)){if(l<s){G.error(`洞见卡余额不足`);return}g(!0);try{let e=await be({commodityType:`dj_report`,commodityId:r});await ze(e.orderNo,{payType:`balance`,payChannel:`NATIVE`}),G.success(`洞见卡支付成功`),t(),n===`download`&&d?i(`reportDownload`,{report:d}):n===`view`&&_e.emit(`report:quotaUnlocked`,{reportId:r})}catch(e){console.error(e),g(!1)}}},className:`mt-3 block w-full max-w-70 mx-auto border border-slate-200 hover:border-blue-300 hover:bg-blue-50/40 text-[#202a33] font-semibold py-3.5 rounded-full transition-all active:scale-[0.98] text-[14px] cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed`,children:[`洞见卡支付(需要:`,s,`,余额:`,l,`)`]}),y&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>m(!0),className:`mt-3 block w-full max-w-70 mx-auto border border-slate-200 hover:border-blue-300 hover:bg-blue-50/40 text-[#202a33] font-semibold py-3.5 rounded-full transition-all active:scale-[0.98] text-[14px] cursor-pointer`,children:`关注公众号解锁永久阅读额度`})]})]}),p&&(0,Y.jsxs)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center p-4`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-black/40`,onClick:()=>m(!1)}),(0,Y.jsxs)(`div`,{className:`relative w-full max-w-125 bg-white rounded-[28px] shadow-[0_25px_60px_rgba(0,0,0,0.12)] px-6 py-8`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>m(!1),className:`absolute top-5 right-5 z-20 text-slate-400 hover:text-slate-600 transition-colors p-1.5 hover:bg-slate-50 rounded-full cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsx)(`h3`,{className:`text-center text-[20px] font-bold text-[#202a33] mb-5`,children:`关注公众号,解锁阅读权限`}),(0,Y.jsx)(ax,{title:`洞见研报公众号`,reward:`+25 洞见卡`,desc:`永久解锁+1篇阅读额度`,qrSrc:eb}),(0,Y.jsx)(ax,{title:`添加小助理客服微信`,reward:`+8 洞见卡`,desc:`永久解锁+1篇阅读额度`,qrSrc:rb}),(0,Y.jsx)(ax,{title:`去应用商店,下载并登录 [洞见研报] APP`,reward:`+25 洞见卡`,desc:`永久解锁+2篇阅读额度`,qrSrc:nb})]})]})]})})}function ax({title:e,reward:t,desc:n,qrSrc:r}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 mt-4 rounded-2xl bg-[#eaf1fe] px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,Y.jsx)(`div`,{className:`text-xs text-[#394551] mb-2`,children:e}),(0,Y.jsxs)(`div`,{className:`text-sm text-[#202a33]`,children:[(0,Y.jsx)(`span`,{className:`text-[#327bfa] font-semibold mr-3`,children:t}),n]})]}),(0,Y.jsx)(`div`,{className:`relative w-20 h-20 shrink-0 rounded-md bg-white shadow-sm overflow-hidden`,children:(0,Y.jsx)(`img`,{src:r,alt:``,className:`w-full h-full object-cover`})})]})}var ox={fail:{banner:`/assets/convert-fail-Cjzv-cjc.png`,title:`亲爱的共创小伙伴,感谢你为大家找到了一个新功能异常,工程师会尽快排查,请稍后再试`},noQuota:{banner:`/assets/convert-noQuota-CUWgLBEL.png`,title:`亲爱的共创小伙伴,你最近下载了好多PPT/Word文件,请多多下载PDF文件吧`}};function sx({isOpen:e,onClose:t,type:n=`noQuota`}){if(!e)return null;let{banner:r,title:i}=ox[n];return(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-122 bg-white border border-slate-100 rounded-[28px] shadow-[0_25px_60px_rgba(0,0,0,0.12)] overflow-hidden`,children:[(0,Y.jsx)(`div`,{className:`absolute top-0 inset-x-0 h-1.5 bg-linear-to-r from-blue-500 via-indigo-500 to-blue-600 z-10`}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`absolute top-5 right-5 text-slate-400 hover:text-slate-600 transition-colors p-1.5 hover:bg-white/80 rounded-full z-20 cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsx)(`img`,{src:r,alt:``,className:`w-full h-40 object-cover bg-[#eaf1fe]`}),(0,Y.jsxs)(`div`,{className:`px-8 py-7 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-[18px] font-bold text-[#202a33] leading-8`,children:i}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`mt-7 w-full max-w-62.5 bg-[#1875e5] hover:bg-[#1669ce] text-white font-bold py-3.5 rounded-full shadow-lg shadow-blue-500/10 transition-all active:scale-[0.98] text-[15px] cursor-pointer`,children:`我知道了`})]})]})]})})}var cx=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAABlVJREFUWAnNWXlsVEUYn+/tLj1oIeWONeABSpAAIttSs11aIOEo7XpQhaAxRoMSjUAChgSVBqLGqIh/mCCRhD8IoCDp9qCCQrEt0IPDqHgA2ioqZ6j0oKW7733+Ztu3vPf6dttSTDvJZma+a35vZr5jWhKGlsu5jkv+P5ZoxItAniqYh6NXDCL/x1ATRFdIiFMkaNfInDHbd9NuVV8I9PbmKU55QAT4SyF4ok7rm55+dBEvLPUd/1WuHwLYAe4YwA3pG1CWVYnqhZOmV2RVn1HksVJA29NvwEmszEkSk8TmGDp14BIW4mXLN/SH6cjmM9fPwgFCDtEfANlg4EVOFjQFIG2YZhIu63VQSuHUZaTw3wo5LmuCB0B3mGBtgqaRl0ikMbPTrHn7M4nNifMeEc0EgP1MpLw3PnnKji3TtgSiyc4sTEsOaMGX8LkrYDcxmmy3eAhzlJ7vDrJgh1WBiIKgrR+Vc887xrhklbObdwDdjN1cYMfvLg1xUY0AkFoUhRaU5VQf6q4xqxzAkbcgZSP6FVZed+cSYKcsIYmIjk/0BpwEgBPgcl/NStja2l1AdnKdLjST2FThq/nKKJxR7J6iBsUqwXSi/LHqj4w8OZ71TcrQtmbeIIhbHYkJbx3OPNykyyS6hr/SGLg6HXfyIZ3Wk96yg3Q5PjZpndWAGuAdOCrES23jDH9qppUfaOL14C9jTazUGm6sMvJL5pfchJOtNdJ6MjYDJLHzwJwDzVYDTNSm05DZw2Odhl0P0zQWnTy9PKfKj6tTp8v3pDcdMdDutVN2CX4aF/M1VkRNeU7lEatMgktZ1xTQWhBOWx2D4z+08jNKM5xqY3Op0MTzVl5Xc5MXx1FM8te+I/90pdQVPz0/dYIQ2kLcSZRrVA+HxjEj0JM2CCBHQT8V9EfswpvRtnRY0w4GBrkuGwV6Os7wp41VRfB1EtqfsbGuzQfmHI1oz1PkSSK19UVki+VwoORIa5l2UImj0WVzas5HEo5G9xSkLCbWvPExrrX75x67Fk3WyMPxJ6gNTe8zdy5YOu2g0ua4H8o9Buj1u5fg/o0r8x1fZly8O+OOkLQMNn7RmDdZdUxerKpqllWgq3m6P3WSJoS3zFedp8t2ZJGZmYUpk3Wasc/0T3vQ43fPlfWeTi/z1XyMHftAn+u9CSDCxQu5R9PidGZ3esTGvESXstoo6y1MfVXTtIMBVfvOW+R+1MiT1XuQ6TTuXcmFgro8I88xeOCbSEG/G2kmgFBKung1uMYoEG0sMwwJPlsyv6rBKIcK6IacyzvE7Gg18pyK0gbvloWIfG+E5HQ+jrsVOp/qc9mbAYLAGr/hyXfPNgpFGquqeFxxKEVWPvL4ViLHZIoT95ZnV5408g/Pq6wbIBxjnKS4kavfNfLk2ElcbKSZwkwHQ8GnfYGU9uS3vioUqJEbUttYjuHP7CTKfVXf29El7aCv6hI6+evUEmhUbb24EKZ32sEQB0etsrrf6095LixpM0DBMlhpdcbYsG6b1Cga443K9gDbJVx4wI83ClvHKKl+YwqMs9J7M2dxw2TP7ojD9p1C8ctJqJxq4jVMeA4KOoEr8JMgZwtr6k0E2KcgUhJW6uVA01jaCzdTJglT5YDo0hAxYNy/om054txqePggEz88oRbhFBMrFtSYwkOY3YNBRmHGMFVtqsWbJkGqySgQ+YiZW69x2zlE9w2RwUkzHCeCYlvu6Vy88G6/yaCtqs27dHC6pcgAhRiDxUfogtF7Tr94rnYv8mpsdDl7rtS7WFC3DdXNLKtENIBW2ahz3MUstaH5RHphWkpUQQtz3r7UQdA7ivT4jIUVmt4xgNIaFpnAWqASeXbfjEJ3tqxU7BZdenypS8/DCfNGo4Lnu+3kJI08+dNuou/V/YlovP1t/QOQX4DT1QMIANNd6CdB5zxobzsSB24PNjR/ApmlNnbapBefx9lH/AIbpTtKQiytxWuxAkXHs1bD8OK/nPDlk6jl+gwgrsW92FH8bBqwKXix7bJh9QuSxKbMzp7/Obb5VL9AZAAhMYWwSZqnyH0fKrdKhAq8wvq+4QV4hR34EzCyUyjMyIEkgGGq3foCqsSgg5Pro6i91fI4TzlUWLwQRetipJyHwR0OgfC74ZbknRthHRVO2v5vCIV2zszO2pNHeUj/7e0/9lB1yrC4oG4AAAAASUVORK5CYII=`;function lx({isOpen:e,currentNickName:t,onClose:n,onSaved:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),c=(0,J.useCallback)(()=>{a(``)},[]),l=()=>{n()},u=()=>{c(),n()};(0,J.useEffect)(()=>{e&&a(e=>e||t)},[e,t]);let d=async()=>{let e=i.trim();if(!e){G.info(`请先输入昵称`);return}s(!0);try{await Ve({nickName:e}),r(e),G.success(`修改成功`),u()}catch{G.error(`修改失败,请稍后重试`)}finally{s(!1)}};return e?(0,Xc.createPortal)((0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:l,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-[420px] overflow-hidden rounded-[28px] border border-slate-100 bg-white shadow-[0_25px_60px_rgba(0,0,0,0.12)]`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:l,className:`absolute top-5 right-5 z-20 cursor-pointer rounded-full p-1.5 text-slate-400 transition-colors hover:bg-slate-50 hover:text-slate-600`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`p-10`,children:[(0,Y.jsx)(`h2`,{className:`mb-6 text-center text-[26px] font-bold tracking-tight text-[#113171]`,children:`修改用户名`}),(0,Y.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),o||d()},children:[(0,Y.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),maxLength:20,placeholder:`请输入昵称`,className:`w-full rounded-2xl border border-[#e1e1e1] bg-white px-5 py-3.5 text-sm font-medium text-slate-800 outline-none transition-[border-color,box-shadow] placeholder:text-slate-400 focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50`}),(0,Y.jsxs)(`div`,{className:`mt-8 flex justify-end gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:u,className:`cursor-pointer rounded-xl px-5 py-2.5 text-sm font-bold text-slate-500 transition-colors hover:bg-slate-50`,children:`取消`}),(0,Y.jsx)(`button`,{type:`submit`,disabled:o,className:`cursor-pointer rounded-xl bg-[#1875e5] px-5 py-2.5 text-sm font-bold text-white transition-colors hover:bg-[#1568cc] disabled:cursor-not-allowed disabled:opacity-60`,children:o?`保存中...`:`保存`})]})]})]})]})]})}),document.body):null}var ux=t(((e,t)=>{var n=!1,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;function v(){if(!n){n=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),v=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(m=/\b(iPhone|iP[ao]d)/.exec(e),h=/\b(iP[ao]d)/.exec(e),f=/Android/i.exec(e),g=/FBAN\/\w+;/i.exec(e),_=/Mobile/i.exec(e),p=!!/Win64/.exec(e),t){r=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN,r&&document&&document.documentMode&&(r=document.documentMode);var y=/(?:Trident\/(\d+.\d+))/.exec(e);c=y?parseFloat(y[1])+4:r,i=t[2]?parseFloat(t[2]):NaN,a=t[3]?parseFloat(t[3]):NaN,o=t[4]?parseFloat(t[4]):NaN,o?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),s=t&&t[1]?parseFloat(t[1]):NaN):s=NaN}else r=i=a=s=o=NaN;if(v){if(v[1]){var b=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);l=!b||parseFloat(b[1].replace(`_`,`.`))}else l=!1;u=!!v[2],d=!!v[3]}else l=u=d=!1}}var y={ie:function(){return v()||r},ieCompatibilityMode:function(){return v()||c>r},ie64:function(){return y.ie()&&p},firefox:function(){return v()||i},opera:function(){return v()||a},webkit:function(){return v()||o},safari:function(){return y.webkit()},chrome:function(){return v()||s},windows:function(){return v()||u},osx:function(){return v()||l},linux:function(){return v()||d},iphone:function(){return v()||m},mobile:function(){return v()||m||h||f||_},nativeApp:function(){return v()||g},android:function(){return v()||f},ipad:function(){return v()||h}};t.exports=y})),dx=t(((e,t)=>{var n=!!(typeof window<`u`&&window.document&&window.document.createElement);t.exports={canUseDOM:n,canUseWorkers:typeof Worker<`u`,canUseEventListeners:n&&!!(window.addEventListener||window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n}})),fx=t(((e,t)=>{var n=dx(),r;n.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature(``,``)!==!0);function i(e,t){if(!n.canUseDOM||t&&!(`addEventListener`in document))return!1;var i=`on`+e,a=i in document;if(!a){var o=document.createElement(`div`);o.setAttribute(i,`return;`),a=typeof o[i]==`function`}return!a&&r&&e===`wheel`&&(a=document.implementation.hasFeature(`Events.wheel`,`3.0`)),a}t.exports=i})),px=t(((e,t)=>{var n=ux(),r=fx(),i=10,a=40,o=800;function s(e){var t=0,n=0,r=0,s=0;return`detail`in e&&(n=e.detail),`wheelDelta`in e&&(n=-e.wheelDelta/120),`wheelDeltaY`in e&&(n=-e.wheelDeltaY/120),`wheelDeltaX`in e&&(t=-e.wheelDeltaX/120),`axis`in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=t*i,s=n*i,`deltaY`in e&&(s=e.deltaY),`deltaX`in e&&(r=e.deltaX),(r||s)&&e.deltaMode&&(e.deltaMode==1?(r*=a,s*=a):(r*=o,s*=o)),r&&!t&&(t=r<1?-1:1),s&&!n&&(n=s<1?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:s}}s.getEventType=function(){return n.firefox()?`DOMMouseScroll`:r(`wheel`)?`wheel`:`mousewheel`},t.exports=s})),mx=n(t(((e,t)=>{t.exports=px()}))(),1);function hx(e){"@babel/helpers - typeof";return hx=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},hx(e)}function gx(e,t){if(hx(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(hx(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _x(e){var t=gx(e,`string`);return hx(t)==`symbol`?t:t+``}function vx(e,t,n){return(t=_x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yx(Object(n),!0).forEach(function(t){vx(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yx(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xx(e,t,n,r,i,a=0){let{width:o,height:s}=Fx(e,t,a),c=Math.min(o,n),l=Math.min(s,r);return c>l*i?{width:l*i,height:l}:{width:c,height:c/i}}function Sx(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}function Cx(e,t,n,r,i=0){let{width:a,height:o}=Fx(t.width,t.height,i);return{x:wx(e.x,a,n.width,r),y:wx(e.y,o,n.height,r)}}function wx(e,t,n,r){let i=Math.abs(t*r/2-n/2);return Ix(e,-i,i)}function Tx(e,t){return Math.sqrt((e.y-t.y)**2+(e.x-t.x)**2)}function Ex(e,t){return Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI}function Dx(e,t,n,r,i,a=0,o=!0){let s=o?Ox:kx,c=Fx(t.width,t.height,a),l=Fx(t.naturalWidth,t.naturalHeight,a),u={x:s(100,((c.width-n.width/i)/2-e.x/i)/c.width*100),y:s(100,((c.height-n.height/i)/2-e.y/i)/c.height*100),width:s(100,n.width/c.width*100/i),height:s(100,n.height/c.height*100/i)},d=Math.round(s(l.width,u.width*l.width/100)),f=Math.round(s(l.height,u.height*l.height/100)),p=l.width>=l.height*r?{width:Math.round(f*r),height:f}:{width:d,height:Math.round(d/r)};return{croppedAreaPercentages:u,croppedAreaPixels:bx(bx({},p),{},{x:Math.round(s(l.width-p.width,u.x*l.width/100)),y:Math.round(s(l.height-p.height,u.y*l.height/100))})}}function Ox(e,t){return Math.min(e,Math.max(0,t))}function kx(e,t){return t}function Ax(e,t,n,r,i,a){let o=Fx(t.width,t.height,n),s=Ix(r.width/o.width*(100/e.width),i,a);return{crop:{x:s*o.width/2-r.width/2-o.width*s*(e.x/100),y:s*o.height/2-r.height/2-o.height*s*(e.y/100)},zoom:s}}function jx(e,t,n){let r=Sx(t);return n.height>n.width?n.height/(e.height*r):n.width/(e.width*r)}function Mx(e,t,n=0,r,i,a){let o=Fx(t.naturalWidth,t.naturalHeight,n),s=Ix(jx(e,t,r),i,a),c=r.height>r.width?r.height/e.height:r.width/e.width;return{crop:{x:((o.width-e.width)/2-e.x)*c,y:((o.height-e.height)/2-e.y)*c},zoom:s}}function Nx(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function Px(e){return e*Math.PI/180}function Fx(e,t,n){let r=Px(n);return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}function Ix(e,t,n){return Math.min(Math.max(e,t),n)}function Lx(...e){return e.filter(e=>typeof e==`string`&&e.length>0).join(` `).trim()}var Rx=`.reactEasyCrop_Container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: move;
  display: flex;
  justify-content: center;
  align-items: center;
}

.reactEasyCrop_Image,
.reactEasyCrop_Video {
  will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
  max-width: unset; /* prevent global img/video reset rules from constraining the cropper media */
}

.reactEasyCrop_Contain {
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}
.reactEasyCrop_Cover_Horizontal {
  width: 100%;
  height: auto;
}
.reactEasyCrop_Cover_Vertical {
  width: auto;
  height: 100%;
}

.reactEasyCrop_CropArea {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-sizing: border-box;
  box-shadow: 0 0 0 9999em;
  color: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.reactEasyCrop_CropAreaRound {
  border-radius: 50%;
}

.reactEasyCrop_CropAreaGrid::before {
  content: ' ';
  box-sizing: border-box;
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.5);
  top: 0;
  bottom: 0;
  left: 33.33%;
  right: 33.33%;
  border-top: 0;
  border-bottom: 0;
}

.reactEasyCrop_CropAreaGrid::after {
  content: ' ';
  box-sizing: border-box;
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.5);
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-left: 0;
  border-right: 0;
}
`,zx=250,Bx=1,Vx=3,Hx=1,Ux=class e extends J.Component{constructor(...t){super(...t),this.cropperRef=J.createRef(),this.imageRef=J.createRef(),this.videoRef=J.createRef(),this.containerPosition={x:0,y:0},this.containerRef=null,this.styleRef=null,this.containerRect=null,this.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},this.dragStartPosition={x:0,y:0},this.dragStartCrop={x:0,y:0},this.gestureZoomStart=0,this.gestureRotationStart=0,this.isTouching=!1,this.lastPinchDistance=0,this.lastPinchRotation=0,this.rafDragTimeout=null,this.rafPinchTimeout=null,this.wheelTimer=null,this.resizeEmitTimer=null,this.currentDoc=typeof document<`u`?document:null,this.currentWindow=typeof window<`u`?window:null,this.resizeObserver=null,this.previousCropSize=null,this.isInitialized=!1,this.dragInteractionSource=null,this.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},this.initResizeObserver=()=>{if(window.ResizeObserver===void 0||!this.containerRef)return;let e=!0;this.resizeObserver=new window.ResizeObserver(t=>{if(e){e=!1;return}this.computeSizes({isResizeTriggered:!0})}),this.resizeObserver.observe(this.containerRef)},this.onWindowResize=()=>{this.computeSizes({isResizeTriggered:!0})},this.preventZoomSafari=e=>e.preventDefault(),this.cleanEvents=()=>{this.currentDoc&&(this.currentDoc.removeEventListener(`mousemove`,this.onMouseMove),this.currentDoc.removeEventListener(`mouseup`,this.onDragStopped),this.currentDoc.removeEventListener(`touchmove`,this.onTouchMove),this.currentDoc.removeEventListener(`touchend`,this.onDragStopped),this.currentDoc.removeEventListener(`gesturechange`,this.onGestureChange),this.currentDoc.removeEventListener(`gestureend`,this.onGestureEnd),this.currentDoc.removeEventListener(`scroll`,this.onScroll))},this.clearScrollEvent=()=>{this.containerRef&&this.containerRef.removeEventListener(`wheel`,this.onWheel),this.wheelTimer&&clearTimeout(this.wheelTimer)},this.onMediaLoad=()=>{let e=this.computeSizes();e&&(this.previousCropSize=e,this.emitCropData(),this.setInitialCrop(e),this.isInitialized=!0),this.props.onMediaLoaded&&this.props.onMediaLoaded(this.mediaSize)},this.setInitialCrop=e=>{if(this.props.initialCroppedAreaPercentages){let{crop:t,zoom:n}=Ax(this.props.initialCroppedAreaPercentages,this.mediaSize,this.props.rotation,e,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(t),this.props.onZoomChange&&this.props.onZoomChange(n)}else if(this.props.initialCroppedAreaPixels){let{crop:t,zoom:n}=Mx(this.props.initialCroppedAreaPixels,this.mediaSize,this.props.rotation,e,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(t),this.props.onZoomChange&&this.props.onZoomChange(n)}},this.computeSizes=({isResizeTriggered:e=!1}={})=>{let t=this.imageRef.current||this.videoRef.current;if(t&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect(),this.saveContainerPosition();let n=this.containerRect.width/this.containerRect.height,r=this.imageRef.current?.naturalWidth||this.videoRef.current?.videoWidth||0,i=this.imageRef.current?.naturalHeight||this.videoRef.current?.videoHeight||0,a=t.offsetWidth<r||t.offsetHeight<i,o=r/i,s;if(a)switch(this.state.mediaObjectFit){default:case`contain`:s=n>o?{width:this.containerRect.height*o,height:this.containerRect.height}:{width:this.containerRect.width,height:this.containerRect.width/o};break;case`horizontal-cover`:s={width:this.containerRect.width,height:this.containerRect.width/o};break;case`vertical-cover`:s={width:this.containerRect.height*o,height:this.containerRect.height}}else s={width:t.offsetWidth,height:t.offsetHeight};this.mediaSize=bx(bx({},s),{},{naturalWidth:r,naturalHeight:i}),this.props.setMediaSize&&this.props.setMediaSize(this.mediaSize);let c=this.props.cropSize?this.props.cropSize:xx(this.mediaSize.width,this.mediaSize.height,this.containerRect.width,this.containerRect.height,this.props.aspect,this.props.rotation);return(this.state.cropSize?.height!==c.height||this.state.cropSize?.width!==c.width)&&this.props.onCropSizeChange&&this.props.onCropSizeChange(c),this.setState({cropSize:c},()=>this.recomputeCropPosition({isResizeTriggered:e})),this.props.setCropSize&&this.props.setCropSize(c),c}},this.saveContainerPosition=()=>{if(this.containerRef){let e=this.containerRef.getBoundingClientRect();this.containerPosition={x:e.left,y:e.top}}},this.onMouseDown=t=>{this.currentDoc&&(t.preventDefault(),this.currentDoc.addEventListener(`mousemove`,this.onMouseMove),this.currentDoc.addEventListener(`mouseup`,this.onDragStopped),this.saveContainerPosition(),this.onDragStart(e.getMousePoint(t),`mouse`))},this.onMouseMove=t=>this.onDrag(e.getMousePoint(t)),this.onScroll=e=>{this.currentDoc&&(e.preventDefault(),this.saveContainerPosition())},this.onTouchStart=t=>{this.currentDoc&&(this.isTouching=!0,(!this.props.onTouchRequest||this.props.onTouchRequest(t))&&(this.currentDoc.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),this.currentDoc.addEventListener(`touchend`,this.onDragStopped),this.saveContainerPosition(),t.touches.length===2?this.onPinchStart(t):t.touches.length===1&&this.onDragStart(e.getTouchPoint(t.touches[0]),`touch`)))},this.onTouchMove=t=>{t.preventDefault(),t.touches.length===2?this.onPinchMove(t):t.touches.length===1&&this.onDrag(e.getTouchPoint(t.touches[0]))},this.onGestureStart=e=>{this.currentDoc&&(e.preventDefault(),this.currentDoc.addEventListener(`gesturechange`,this.onGestureChange),this.currentDoc.addEventListener(`gestureend`,this.onGestureEnd),this.gestureZoomStart=this.props.zoom,this.gestureRotationStart=this.props.rotation)},this.onGestureChange=t=>{if(t.preventDefault(),this.isTouching)return;let n=e.getMousePoint(t),r=this.gestureZoomStart-1+t.scale;if(this.setNewZoom(r,n,{shouldUpdatePosition:!0}),this.props.onRotationChange){let e=this.gestureRotationStart+t.rotation;this.props.onRotationChange(e)}},this.onGestureEnd=e=>{this.cleanEvents()},this.onDragStart=({x:e,y:t},n)=>{var r,i;this.dragStartPosition={x:e,y:t},this.dragStartCrop=bx({},this.props.crop),this.dragInteractionSource=n,(r=(i=this.props).onInteractionStart)==null||r.call(i,{source:n})},this.onDrag=({x:e,y:t})=>{this.currentWindow&&(this.rafDragTimeout&&this.currentWindow.cancelAnimationFrame(this.rafDragTimeout),this.rafDragTimeout=this.currentWindow.requestAnimationFrame(()=>{if(!this.state.cropSize||e===void 0||t===void 0)return;let n=e-this.dragStartPosition.x,r=t-this.dragStartPosition.y,i={x:this.dragStartCrop.x+n,y:this.dragStartCrop.y+r},a=this.props.restrictPosition?Cx(i,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):i;this.props.onCropChange(a)}))},this.onDragStopped=()=>{var e,t;this.isTouching=!1,this.cleanEvents(),this.emitCropData(),(e=(t=this.props).onInteractionEnd)==null||e.call(t,{source:this.dragInteractionSource??`mouse`}),this.dragInteractionSource=null},this.onWheel=t=>{if(!this.currentWindow||this.props.onWheelRequest&&!this.props.onWheelRequest(t))return;t.preventDefault();let n=e.getMousePoint(t),{pixelY:r}=(0,mx.default)(t),i=this.props.zoom-r*this.props.zoomSpeed/200;this.setNewZoom(i,n,{shouldUpdatePosition:!0}),this.state.hasWheelJustStarted||this.setState({hasWheelJustStarted:!0},()=>{var e;return(e=this.props).onInteractionStart?.call(e,{source:`wheel`})}),this.wheelTimer&&clearTimeout(this.wheelTimer),this.wheelTimer=this.currentWindow.setTimeout(()=>this.setState({hasWheelJustStarted:!1},()=>{var e;return(e=this.props).onInteractionEnd?.call(e,{source:`wheel`})}),250)},this.getPointOnContainer=({x:e,y:t},n)=>{if(!this.containerRect)throw Error(`The Cropper is not mounted`);return{x:this.containerRect.width/2-(e-n.x),y:this.containerRect.height/2-(t-n.y)}},this.getPointOnMedia=({x:e,y:t})=>{let{crop:n,zoom:r}=this.props;return{x:(e+n.x)/r,y:(t+n.y)/r}},this.setNewZoom=(e,t,{shouldUpdatePosition:n=!0}={})=>{if(!this.state.cropSize||!this.props.onZoomChange)return;let r=Ix(e,this.props.minZoom,this.props.maxZoom);if(n){let e=this.getPointOnContainer(t,this.containerPosition),n=this.getPointOnMedia(e),i={x:n.x*r-e.x,y:n.y*r-e.y},a=this.props.restrictPosition?Cx(i,this.mediaSize,this.state.cropSize,r,this.props.rotation):i;this.props.onCropChange(a)}this.props.onZoomChange(r)},this.getCropData=()=>this.state.cropSize?Dx(this.props.restrictPosition?Cx(this.props.crop,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):this.props.crop,this.mediaSize,this.state.cropSize,this.getAspect(),this.props.zoom,this.props.rotation,this.props.restrictPosition):null,this.emitCropData=()=>{this.resizeEmitTimer&&=(clearTimeout(this.resizeEmitTimer),null);let e=this.getCropData();if(!e)return;let{croppedAreaPercentages:t,croppedAreaPixels:n}=e;this.props.onCropComplete&&this.props.onCropComplete(t,n),this.props.onCropAreaChange&&this.props.onCropAreaChange(t,n)},this.emitCropAreaChange=()=>{let e=this.getCropData();if(!e)return;let{croppedAreaPercentages:t,croppedAreaPixels:n}=e;this.props.onCropAreaChange&&this.props.onCropAreaChange(t,n)},this.recomputeCropPosition=({isResizeTriggered:e=!1}={})=>{if(!this.state.cropSize)return;let t=this.props.crop;if(this.isInitialized&&this.previousCropSize?.width&&this.previousCropSize?.height&&(Math.abs(this.previousCropSize.width-this.state.cropSize.width)>1e-6||Math.abs(this.previousCropSize.height-this.state.cropSize.height)>1e-6)){let e=this.state.cropSize.width/this.previousCropSize.width,n=this.state.cropSize.height/this.previousCropSize.height;t={x:this.props.crop.x*e,y:this.props.crop.y*n}}let n=this.props.restrictPosition?Cx(t,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):t;this.previousCropSize=this.state.cropSize,this.props.onCropChange(n),e?this.debouncedEmitCropData():this.emitCropData()},this.debouncedEmitCropData=()=>{this.currentWindow&&(this.resizeEmitTimer&&clearTimeout(this.resizeEmitTimer),this.resizeEmitTimer=this.currentWindow.setTimeout(()=>{this.emitCropData()},zx))},this.onKeyDown=e=>{let{crop:t,onCropChange:n,keyboardStep:r,zoom:i,rotation:a}=this.props,o=r;if(!this.state.cropSize)return;e.shiftKey&&(o*=.2);let s=bx({},t);switch(e.key){case`ArrowUp`:s.y-=o,e.preventDefault();break;case`ArrowDown`:s.y+=o,e.preventDefault();break;case`ArrowLeft`:s.x-=o,e.preventDefault();break;case`ArrowRight`:s.x+=o,e.preventDefault();break;default:return}if(this.props.restrictPosition&&(s=Cx(s,this.mediaSize,this.state.cropSize,i,a)),!e.repeat){var c,l;(c=(l=this.props).onInteractionStart)==null||c.call(l,{source:`keyboard`})}n(s)},this.onKeyUp=e=>{var t,n;switch(e.key){case`ArrowUp`:case`ArrowDown`:case`ArrowLeft`:case`ArrowRight`:e.preventDefault();break;default:return}this.emitCropData(),(t=(n=this.props).onInteractionEnd)==null||t.call(n,{source:`keyboard`})}}componentDidMount(){this.currentDoc&&this.currentWindow&&(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),window.ResizeObserver===void 0&&this.currentWindow.addEventListener(`resize`,this.onWindowResize),this.props.zoomWithScroll&&this.containerRef.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.containerRef.addEventListener(`gesturestart`,this.onGestureStart)),this.currentDoc.addEventListener(`scroll`,this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement(`style`),this.styleRef.setAttribute(`type`,`text/css`),this.props.nonce&&this.styleRef.setAttribute(`nonce`,this.props.nonce),this.styleRef.innerHTML=Rx,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))}componentWillUnmount(){var e;if(this.currentDoc&&this.currentWindow){if(window.ResizeObserver===void 0&&this.currentWindow.removeEventListener(`resize`,this.onWindowResize),(e=this.resizeObserver)==null||e.disconnect(),this.resizeEmitTimer&&clearTimeout(this.resizeEmitTimer),this.containerRef&&this.containerRef.removeEventListener(`gesturestart`,this.preventZoomSafari),this.styleRef){var t;(t=this.styleRef.parentNode)==null||t.removeChild(this.styleRef)}this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()}}componentDidUpdate(e){if(e.rotation===this.props.rotation?e.aspect===this.props.aspect&&e.objectFit===this.props.objectFit?e.zoom===this.props.zoom?e.cropSize?.height!==this.props.cropSize?.height||e.cropSize?.width!==this.props.cropSize?.width?this.computeSizes():(e.crop?.x!==this.props.crop?.x||e.crop?.y!==this.props.crop?.y)&&this.emitCropAreaChange():this.recomputeCropPosition():this.computeSizes():(this.computeSizes(),this.recomputeCropPosition()),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener(`wheel`,this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video){var t;(t=this.videoRef.current)==null||t.load()}let n=this.getObjectFit();n!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:n},this.computeSizes)}getAspect(){let{cropSize:e,aspect:t}=this.props;return e?e.width/e.height:t}getObjectFit(){if(this.props.objectFit===`cover`){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();let e=this.containerRect.width/this.containerRect.height;return(this.imageRef.current?.naturalWidth||this.videoRef.current?.videoWidth||0)/(this.imageRef.current?.naturalHeight||this.videoRef.current?.videoHeight||0)<e?`horizontal-cover`:`vertical-cover`}return`horizontal-cover`}return this.props.objectFit}onPinchStart(t){let n=e.getTouchPoint(t.touches[0]),r=e.getTouchPoint(t.touches[1]);this.lastPinchDistance=Tx(n,r),this.lastPinchRotation=Ex(n,r),this.onDragStart(Nx(n,r),`touch`)}onPinchMove(t){if(!this.currentDoc||!this.currentWindow)return;let n=e.getTouchPoint(t.touches[0]),r=e.getTouchPoint(t.touches[1]),i=Nx(n,r);this.onDrag(i),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(()=>{let e=Tx(n,r),t=this.props.zoom*(e/this.lastPinchDistance);this.setNewZoom(t,i,{shouldUpdatePosition:!1}),this.lastPinchDistance=e;let a=Ex(n,r),o=this.props.rotation+(a-this.lastPinchRotation);this.props.onRotationChange&&this.props.onRotationChange(o),this.lastPinchRotation=a})}render(){let{image:e,video:t,mediaProps:n,cropperProps:r,transform:i,crop:{x:a,y:o},rotation:s,zoom:c,cropShape:l,showGrid:u,roundCropAreaPixels:d,style:{containerStyle:f,cropAreaStyle:p,mediaStyle:m},classes:{containerClassName:h,cropAreaClassName:g,mediaClassName:_}}=this.props,v=this.state.mediaObjectFit??this.getObjectFit();return J.createElement(`div`,{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:e=>this.containerRef=e,"data-testid":`container`,style:f,className:Lx(`reactEasyCrop_Container`,h)},e?J.createElement(`img`,bx(bx({alt:``,className:Lx(`reactEasyCrop_Image`,v===`contain`&&`reactEasyCrop_Contain`,v===`horizontal-cover`&&`reactEasyCrop_Cover_Horizontal`,v===`vertical-cover`&&`reactEasyCrop_Cover_Vertical`,_)},n),{},{src:e,ref:this.imageRef,style:bx(bx({},m),{},{transform:i||`translate(${a}px, ${o}px) rotate(${s}deg) scale(${c})`}),onLoad:this.onMediaLoad})):t&&J.createElement(`video`,bx(bx({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:Lx(`reactEasyCrop_Video`,v===`contain`&&`reactEasyCrop_Contain`,v===`horizontal-cover`&&`reactEasyCrop_Cover_Horizontal`,v===`vertical-cover`&&`reactEasyCrop_Cover_Vertical`,_)},n),{},{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:bx(bx({},m),{},{transform:i||`translate(${a}px, ${o}px) rotate(${s}deg) scale(${c})`}),controls:!1}),(Array.isArray(t)?t:[{src:t}]).map(e=>J.createElement(`source`,bx({key:e.src},e)))),this.state.cropSize&&J.createElement(`div`,bx({ref:this.cropperRef,style:bx(bx({},p),{},{width:d?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:d?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":`cropper`,className:Lx(`reactEasyCrop_CropArea`,l===`round`&&`reactEasyCrop_CropAreaRound`,u&&`reactEasyCrop_CropAreaGrid`,g)},r)))}};Ux.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:Vx,minZoom:Bx,cropShape:`rect`,objectFit:`contain`,showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:Hx},Ux.getMousePoint=e=>({x:Number(e.clientX),y:Number(e.clientY)}),Ux.getTouchPoint=e=>({x:Number(e.clientX),y:Number(e.clientY)});var Wx=Ux;function Gx(e){return new Promise((t,n)=>{let r=new Image;r.addEventListener(`load`,()=>t(r)),r.addEventListener(`error`,n),r.setAttribute(`crossOrigin`,`anonymous`),r.src=e})}async function Kx(e,t){let n=await Gx(e),r=document.createElement(`canvas`),i=r.getContext(`2d`);if(!i)throw Error(`无法创建画布`);return r.width=t.width,r.height=t.height,i.drawImage(n,t.x,t.y,t.width,t.height,0,0,t.width,t.height),new Promise((e,t)=>{r.toBlob(n=>{n?e(n):t(Error(`裁剪失败`))},`image/png`)})}function qx({isOpen:e,imageSrc:t,fileName:n,onClose:r,onSaved:i}){let[a,o]=(0,J.useState)({x:0,y:0}),[s,c]=(0,J.useState)(1),l=(0,J.useRef)(null),[u,d]=(0,J.useState)(!1),f=()=>{r()},p=(0,J.useCallback)((e,t)=>{l.current=t},[]),m=async()=>{let e=l.current;if(e){d(!0);try{let a=await Kx(t,e),o=await ge(a,n);await Ve({avatar:o}),i(o),G.success(`修改成功`),r()}catch{G.error(`上传失败,请稍后重试`)}finally{d(!1)}}};return e?(0,Xc.createPortal)((0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:f,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-[480px] overflow-hidden rounded-[28px] border border-slate-100 bg-white shadow-[0_25px_60px_rgba(0,0,0,0.12)]`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:f,className:`absolute top-5 right-5 z-20 cursor-pointer rounded-full p-1.5 text-slate-400 transition-colors hover:bg-slate-50 hover:text-slate-600`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`p-8 pt-6`,children:[(0,Y.jsx)(`h2`,{className:`mb-6 text-center text-xl font-bold tracking-tight text-[#113171]`,children:`修改头像`}),(0,Y.jsx)(`div`,{className:`relative mx-auto h-70 w-full overflow-hidden rounded-2xl bg-slate-100`,children:(0,Y.jsx)(Wx,{image:t,crop:a,zoom:s,aspect:1,cropShape:`round`,showGrid:!1,onCropChange:o,onZoomChange:c,onCropComplete:p})}),(0,Y.jsx)(`div`,{className:`mt-4 px-1`,children:(0,Y.jsx)(vg,{min:1,max:3,step:.05,value:s,onChange:c,tooltip:{formatter:null},styles:{track:{backgroundColor:`#1875e5`},handle:{borderColor:`#1875e5`}}})}),(0,Y.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:f,className:`cursor-pointer rounded-xl px-5 py-2.5 text-sm font-bold text-slate-500 transition-colors hover:bg-slate-50`,children:`取消`}),(0,Y.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void m(),className:`cursor-pointer rounded-xl bg-[#1875e5] px-5 py-2.5 text-sm font-bold text-white transition-colors hover:bg-[#1568cc] disabled:cursor-not-allowed disabled:opacity-60`,children:u?`保存中...`:`保存`})]})]})]})]})}),document.body):null}function Jx({isOpen:e,onClose:t,onBound:n}){let[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(0),y=(0,J.useCallback)(()=>{i(``),o(``),c(``),u(``),f(!1),v(0)},[]),b=()=>{t()},x=()=>{y(),t()};(0,J.useEffect)(()=>{if(_<=0)return;let e=setInterval(()=>{v(e=>e<=1?0:e-1)},1e3);return()=>clearInterval(e)},[_]);let S=async()=>{if(_>0)return;let e=Rb(r);if(e.ok===!1){G.info(e.message);return}g(!0);try{await we({mobile:e.value}),G.success(`验证码已发送`),v(60)}finally{g(!1)}},C=async()=>{let e=Rb(r);if(e.ok===!1){G.info(e.message);return}let t=zb(a);if(t.ok===!1){G.info(t.message);return}let i=Bb(s);if(i.ok===!1){G.info(i.message);return}let o=Vb(s,l);if(o.ok===!1){G.info(o.message);return}m(!0);try{await Me({phone:e.value,code:t.value,oauthType:`wx_mp`}),await pe({password:i.value}),n(e.value),G.success(`绑定成功`),x()}catch{G.error(`绑定失败,请稍后重试`)}finally{m(!1)}};if(!e)return null;let w=`w-full rounded-[16px] border border-[#e1e1e1] bg-white px-5 py-3.5 text-sm font-medium text-slate-800 outline-none transition-[border-color,box-shadow] placeholder:text-slate-400 focus:border-[#1875e5] focus:ring-4 focus:ring-blue-50`;return(0,Xc.createPortal)((0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:b,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-[440px] overflow-hidden rounded-[28px] border border-slate-100 bg-white shadow-[0_25px_60px_rgba(0,0,0,0.12)]`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-1.5 bg-linear-to-r from-[#1875e5] via-accent to-[#1875e5]`}),(0,Y.jsx)(`button`,{type:`button`,onClick:b,className:`absolute top-5 right-5 z-20 cursor-pointer rounded-full p-1.5 text-slate-400 transition-colors hover:bg-slate-50 hover:text-slate-600`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`p-8 pt-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center justify-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex h-11 w-11 items-center justify-center rounded-full bg-blue-50 text-[#1875e5]`,children:(0,Y.jsx)(fy,{size:22,strokeWidth:2})}),(0,Y.jsx)(`h2`,{className:`text-xl font-bold tracking-tight text-[#113171]`,children:`绑定手机号`})]}),(0,Y.jsx)(`p`,{className:`mb-6 text-center text-sm text-slate-500`,children:`设置手机号和密码,便于跨平台登录`}),(0,Y.jsxs)(`form`,{className:`space-y-3.5`,onSubmit:e=>{e.preventDefault(),p||C()},children:[(0,Y.jsx)(`input`,{type:`tel`,value:r,onChange:e=>i(e.target.value),maxLength:11,placeholder:`请输入手机号`,className:w}),(0,Y.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,Y.jsx)(`input`,{type:`text`,inputMode:`numeric`,value:a,onChange:e=>o(e.target.value.replace(/\D/g,``).slice(0,4)),maxLength:4,placeholder:`验证码`,className:`flex-1 ${w}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:h||_>0,className:`shrink-0 cursor-pointer rounded-2xl border border-[#e1e1e1] bg-slate-50 px-4 text-xs font-bold text-slate-700 transition-colors hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-50 min-w-[100px]`,children:h?`发送中...`:_>0?`${_}s后重发`:`获取验证码`})]}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:d?`text`:`password`,value:s,onChange:e=>c(e.target.value),maxLength:18,autoComplete:`new-password`,placeholder:`请输入密码(6-18位数字或字母)`,className:`${w} pr-12`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),className:`absolute right-4 top-1/2 -translate-y-1/2 cursor-pointer p-0.5 text-slate-400 transition-colors hover:text-slate-600`,"aria-label":d?`隐藏密码`:`显示密码`,children:d?(0,Y.jsx)(Ev,{size:18}):(0,Y.jsx)(wv,{size:18})})]}),(0,Y.jsx)(`input`,{type:d?`text`:`password`,value:l,onChange:e=>u(e.target.value),maxLength:18,placeholder:`请确认密码`,className:w}),(0,Y.jsx)(`button`,{type:`submit`,disabled:p,className:`mt-2 w-full cursor-pointer rounded-full bg-[#1875e5] py-3.5 text-sm font-bold text-white shadow-lg shadow-blue-500/10 transition-colors hover:bg-[#1568cc] disabled:cursor-not-allowed disabled:opacity-60`,children:p?`提交中...`:`确认绑定`}),(0,Y.jsx)(`button`,{type:`button`,onClick:b,className:`w-full cursor-pointer py-2 text-center text-sm font-semibold text-slate-400 transition-colors hover:text-slate-600`,children:`暂时跳过`})]})]})]})]})}),document.body)}function Yx({isOpen:e,onClose:t,onBound:n}){let{user:r,loginByWechat:i}=ln(),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=()=>{t()},f=(0,J.useCallback)(e=>{if(e.message){G.error(e.message);return}if(!r){G.error(`请先登录`);return}if(e.user.id!==r.id){G.error(`扫码账号与当前登录账号不一致,请使用当前账号绑定的微信扫码`);return}i({user:e.user,accessToken:e.token.accessToken}),n(),G.success(`关注成功`),t()},[i,n,t,r]);return hn(e,s,f,`mp_login`,`mp_login_rst`),(0,J.useEffect)(()=>{if(!e){o(null),c(null),u(!1);return}let t=mn(),n=!1;return u(!0),(async()=>{try{let e=await Ne({scene:t});if(n)return;o(e.url),c(t)}catch{if(n)return;o(null),c(null)}finally{n||u(!1)}})(),()=>{n=!0}},[e]),e?(0,Xc.createPortal)((0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:d,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-110 overflow-hidden rounded-[28px] border border-slate-100 bg-white shadow-[0_25px_60px_rgba(0,0,0,0.12)]`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-1.5 bg-linear-to-r from-[#07c160] via-[#2dd36f] to-[#07c160]`}),(0,Y.jsx)(`button`,{type:`button`,onClick:d,className:`absolute top-5 right-5 z-20 cursor-pointer rounded-full p-1.5 text-slate-400 transition-colors hover:bg-slate-50 hover:text-slate-600`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`p-8 pt-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-6 flex items-center justify-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex h-11 w-11 items-center justify-center rounded-full bg-[#07c160] text-white shadow-md shadow-green-500/20`,children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-5.5 w-5.5 fill-current`,"aria-hidden":!0,children:(0,Y.jsx)(`path`,{d:`M8.5 13.5c-.828 0-1.5-.672-1.5-1.5s.672-1.5 1.5-1.5 1.5.672 1.5 1.5-.672 1.5-1.5 1.5zm7 0c-.828 0-1.5-.672-1.5-1.5s.672-1.5 1.5-1.5 1.5.672 1.5 1.5-.672 1.5-1.5 1.5zM12 2C6.477 2 2 6.477 2 12c0 1.891.524 3.66 1.435 5.168L2.12 21.88l4.712-1.312C8.34 21.476 10.109 22 12 22c5.523 0 10-4.477 10-10S17.523 2 12 2zm0 18c-1.477 0-2.87-.393-4.073-1.078l-.293-.167-2.827.787.787-2.827-.167-.293A7.95 7.95 0 014 12c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z`})})}),(0,Y.jsx)(`h2`,{className:`text-xl font-bold tracking-tight text-[#113171]`,children:`关注微信公众号`})]}),(0,Y.jsxs)(`p`,{className:`mb-5 text-center text-sm leading-relaxed text-slate-500`,children:[`扫码关注公众号,领取新人礼包和`,(0,Y.jsx)(`span`,{className:`font-bold text-amber-600`,children:` ¥25 `}),`洞见卡`]}),(0,Y.jsx)(`div`,{className:`mx-auto w-fit rounded-2xl border border-emerald-100 bg-linear-to-b from-emerald-50/80 to-white p-4 shadow-sm`,children:(0,Y.jsx)(`div`,{className:`flex h-42 w-42 items-center justify-center rounded-xl bg-white p-2`,children:l?(0,Y.jsx)(`span`,{className:`text-xs text-slate-400`,children:`二维码加载中...`}):a?(0,Y.jsx)(pn,{value:a,size:152,bgColor:`#ffffff`,fgColor:`#333333`,level:`L`,marginSize:0,"aria-label":`微信公众号二维码`}):(0,Y.jsx)(`span`,{className:`text-xs text-slate-400`,children:`二维码加载失败`})})}),(0,Y.jsxs)(`div`,{className:`mt-5 flex items-start gap-2.5 rounded-xl border border-amber-100 bg-amber-50/60 px-4 py-3`,children:[(0,Y.jsx)(en,{size:18,className:`mt-0.5 shrink-0 text-amber-500`,fill:`currentColor`}),(0,Y.jsx)(`p`,{className:`text-xs leading-relaxed text-slate-600`,children:`关注后即可畅享研报免费下载,并同步获取平台最新动态与福利活动。`})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:d,className:`mt-6 w-full cursor-pointer text-center text-sm font-semibold text-slate-400 transition-colors hover:text-slate-600`,children:`暂时跳过`})]})]})]})}),document.body):null}function Xx(e){if(!e||e.userLevel===`NONE`)return`您当前还不是VIP哦~`;let t=e[rn[e.userLevel]];if(!t)return`您当前还不是VIP哦~`;let n=Yt(t);return`${nn[e.userLevel]}还有${n}天,有效期到${Zt(t)}`}function Zx(e){let t=JSON.parse(e.comment),[n,r=``]=t[1].split(`/`),i=e.type===`dj_svip`,a=Math.floor(e.days/365)>=1;return{id:e.id,commodityType:e.type,title:`${t[0]} ${t[2]}`.trim(),price:n,unit:`元/${r}`,original:String(e.originPrice/100),gift:i?`研墨 VIP/先见AI VIP(2选1)`:a?`1年研墨VIP`:`1个月研墨VIP`,reducedYuan:e.reducedAmount?e.reducedAmount/100:0}}function Qx(e){return e.filter(e=>e.id!==12).sort((e,t)=>t.iapPrice-e.iapPrice).map(Zx)}var $x=`image/jpeg,image/png,image/gif,image/bmp`,eS=5;function tS({totalVip:e,statisticsLoading:t}){let{user:n,patchUser:r}=ln(),i=(0,J.useRef)(null),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(void 0),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(!1),x=h!==void 0,S=!n?.phone,C=x&&h!==`true`,w=Xx(n);(0,J.useEffect)(()=>{if(!n)return;let e=!1;return Pe({field:`has_follow_mp`}).then(t=>{e||g(t.hasFollowMp??``)}).catch(()=>{e||g(``)}),()=>{e=!0}},[n?.id]);let T=()=>{d&&(URL.revokeObjectURL(d),f(null)),m(``)};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`relative overflow-hidden rounded-[28px] border border-amber-100/70 bg-linear-to-br from-white via-amber-50/30 to-orange-50/20 px-8 py-5 shadow-[0_12px_40px_rgba(0,0,0,0.03)]`,children:[(0,Y.jsx)(`div`,{className:`pointer-events-none absolute -left-8 top-1/2 h-32 w-32 -translate-y-1/2 rounded-full bg-amber-100/30`}),(0,Y.jsx)(`div`,{className:`pointer-events-none absolute right-10 top-2 h-20 w-20 rounded-full bg-orange-100/25`}),(0,Y.jsxs)(`div`,{className:`relative flex items-center gap-5`,children:[(0,Y.jsxs)(`div`,{className:`relative h-[66px] w-[66px] shrink-0`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,Y.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-hidden rounded-full border-2 border-white bg-linear-to-br from-accent to-[#1875e5] shadow-sm`,children:n?.avatar?(0,Y.jsx)(`img`,{src:n.avatar,alt:``,className:`h-full w-full object-cover`}):(0,Y.jsx)(wy,{size:32,className:`text-white`,strokeWidth:1.5})}),a&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>i.current?.click(),className:`absolute inset-0 flex cursor-pointer items-center justify-center rounded-full bg-black/30`,"aria-label":`修改头像`,children:(0,Y.jsx)(iv,{size:24,className:`text-white`})}),(0,Y.jsx)(`input`,{ref:i,type:`file`,accept:$x,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];if(e.target.value=``,!t)return;if(!/\.(gif|jpg|jpeg|png|bmp)$/i.test(t.name)){G.info(`图片类型必须是 gif、jpeg、jpg、png、bmp 中的一种`);return}if(t.size/1024/1024>eS){G.info(`上传文件大小不能超过 5MB`);return}T();let n=URL.createObjectURL(t);f(n),m(t.name),u(!0),o(!1)}})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xl font-extrabold text-slate-800`,children:n?.nickName??`洞见研报用户`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>c(!0),className:`flex h-5 w-5 cursor-pointer items-center justify-center text-slate-400 transition-colors hover:text-[#1875e5] select-none`,"aria-label":`修改用户名`,children:(0,Y.jsx)(gy,{size:16,strokeWidth:2})}),S&&(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>v(!0),className:`flex cursor-pointer items-center gap-1.5 rounded-full border border-slate-200 bg-white px-2.5 py-0.5 text-xs font-semibold text-slate-600 shadow-sm transition-colors hover:border-[#1875e5]/30 hover:text-[#1875e5] select-none`,children:[(0,Y.jsx)(`span`,{children:`绑定手机号`}),(0,Y.jsx)(fy,{size:14,className:`text-[#1875e5]`,strokeWidth:2.5})]}),C&&(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:`flex cursor-pointer items-center gap-1.5 rounded-full border border-slate-200 bg-white px-2.5 py-0.5 text-xs font-semibold text-slate-600 shadow-sm transition-colors hover:border-[#1875e5]/30 hover:text-[#1875e5] select-none`,children:[(0,Y.jsx)(`span`,{children:`绑定微信号`}),(0,Y.jsx)(`img`,{src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAABlVJREFUWAnNWXlsVEUYn+/tLj1oIeWONeABSpAAIttSs11aIOEo7XpQhaAxRoMSjUAChgSVBqLGqIh/mCCRhD8IoCDp9qCCQrEt0IPDqHgA2ioqZ6j0oKW7733+Ztu3vPf6dttSTDvJZma+a35vZr5jWhKGlsu5jkv+P5ZoxItAniqYh6NXDCL/x1ATRFdIiFMkaNfInDHbd9NuVV8I9PbmKU55QAT4SyF4ok7rm55+dBEvLPUd/1WuHwLYAe4YwA3pG1CWVYnqhZOmV2RVn1HksVJA29NvwEmszEkSk8TmGDp14BIW4mXLN/SH6cjmM9fPwgFCDtEfANlg4EVOFjQFIG2YZhIu63VQSuHUZaTw3wo5LmuCB0B3mGBtgqaRl0ikMbPTrHn7M4nNifMeEc0EgP1MpLw3PnnKji3TtgSiyc4sTEsOaMGX8LkrYDcxmmy3eAhzlJ7vDrJgh1WBiIKgrR+Vc887xrhklbObdwDdjN1cYMfvLg1xUY0AkFoUhRaU5VQf6q4xqxzAkbcgZSP6FVZed+cSYKcsIYmIjk/0BpwEgBPgcl/NStja2l1AdnKdLjST2FThq/nKKJxR7J6iBsUqwXSi/LHqj4w8OZ71TcrQtmbeIIhbHYkJbx3OPNykyyS6hr/SGLg6HXfyIZ3Wk96yg3Q5PjZpndWAGuAdOCrES23jDH9qppUfaOL14C9jTazUGm6sMvJL5pfchJOtNdJ6MjYDJLHzwJwDzVYDTNSm05DZw2Odhl0P0zQWnTy9PKfKj6tTp8v3pDcdMdDutVN2CX4aF/M1VkRNeU7lEatMgktZ1xTQWhBOWx2D4z+08jNKM5xqY3Op0MTzVl5Xc5MXx1FM8te+I/90pdQVPz0/dYIQ2kLcSZRrVA+HxjEj0JM2CCBHQT8V9EfswpvRtnRY0w4GBrkuGwV6Os7wp41VRfB1EtqfsbGuzQfmHI1oz1PkSSK19UVki+VwoORIa5l2UImj0WVzas5HEo5G9xSkLCbWvPExrrX75x67Fk3WyMPxJ6gNTe8zdy5YOu2g0ua4H8o9Buj1u5fg/o0r8x1fZly8O+OOkLQMNn7RmDdZdUxerKpqllWgq3m6P3WSJoS3zFedp8t2ZJGZmYUpk3Wasc/0T3vQ43fPlfWeTi/z1XyMHftAn+u9CSDCxQu5R9PidGZ3esTGvESXstoo6y1MfVXTtIMBVfvOW+R+1MiT1XuQ6TTuXcmFgro8I88xeOCbSEG/G2kmgFBKung1uMYoEG0sMwwJPlsyv6rBKIcK6IacyzvE7Gg18pyK0gbvloWIfG+E5HQ+jrsVOp/qc9mbAYLAGr/hyXfPNgpFGquqeFxxKEVWPvL4ViLHZIoT95ZnV5408g/Pq6wbIBxjnKS4kavfNfLk2ElcbKSZwkwHQ8GnfYGU9uS3vioUqJEbUttYjuHP7CTKfVXf29El7aCv6hI6+evUEmhUbb24EKZ32sEQB0etsrrf6095LixpM0DBMlhpdcbYsG6b1Cga443K9gDbJVx4wI83ClvHKKl+YwqMs9J7M2dxw2TP7ojD9p1C8ctJqJxq4jVMeA4KOoEr8JMgZwtr6k0E2KcgUhJW6uVA01jaCzdTJglT5YDo0hAxYNy/om054txqePggEz88oRbhFBMrFtSYwkOY3YNBRmHGMFVtqsWbJkGqySgQ+YiZW69x2zlE9w2RwUkzHCeCYlvu6Vy88G6/yaCtqs27dHC6pcgAhRiDxUfogtF7Tr94rnYv8mpsdDl7rtS7WFC3DdXNLKtENIBW2ahz3MUstaH5RHphWkpUQQtz3r7UQdA7ivT4jIUVmt4xgNIaFpnAWqASeXbfjEJ3tqxU7BZdenypS8/DCfNGo4Lnu+3kJI08+dNuou/V/YlovP1t/QOQX4DT1QMIANNd6CdB5zxobzsSB24PNjR/ApmlNnbapBefx9lH/AIbpTtKQiytxWuxAkXHs1bD8OK/nPDlk6jl+gwgrsW92FH8bBqwKXix7bJh9QuSxKbMzp7/Obb5VL9AZAAhMYWwSZqnyH0fKrdKhAq8wvq+4QV4hR34EzCyUyjMyIEkgGGq3foCqsSgg5Pro6i91fI4TzlUWLwQRetipJyHwR0OgfC74ZbknRthHRVO2v5vCIV2zszO2pNHeUj/7e0/9lB1yrC4oG4AAAAASUVORK5CYII=`,alt:``,className:`h-[18px] w-[18px] object-contain`})]})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm font-medium text-amber-800/75`,children:w})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 pr-2 text-center`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-medium text-slate-500`,children:`当前会员人数`}),(0,Y.jsx)(`div`,{className:`text-2xl font-black leading-8 text-amber-700`,children:t||e==null?`--`:e.toLocaleString(`en-US`)})]})]})]}),(0,Y.jsx)(lx,{isOpen:s,currentNickName:n?.nickName??``,onClose:()=>c(!1),onSaved:e=>r({nickName:e})}),(0,Y.jsx)(Jx,{isOpen:_,onClose:()=>v(!1),onBound:e=>r({phone:e,hasPassword:!0})}),(0,Y.jsx)(Yx,{isOpen:y,onClose:()=>b(!1),onBound:()=>g(`true`)}),d&&(0,Y.jsx)(qx,{isOpen:l,imageSrc:d,fileName:p,onClose:()=>{u(!1),T()},onSaved:e=>r({avatar:e})})]})}var nS=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAABTRJREFUWAnNWFtsVEUY/v7ttopBagwEUsGqaLyARCOo8UFLTBo1ISpKozVgWiwxijHhxQeEB/TFqEE0EtPdpmrAxjXR+EDUJxKjiZG7BDBqjZeU1lCoaEVLy47ff0737Mzu2Z7TQ1s6yZz555//8p25/HMR2MkYQRZNZD3OvIx5LgyqbJEJpvMQnKCPQyxzuBXvY6kM2z4kqHSaqzCCjyi8NOBNNSH4gS5XoU2+K7j2AfrgviG4uYWGC1gOIoW78ZQcUAwp6LD6PTcdwCmmmeyoT5AzM3yAOucu5LAqitJkUI/TeEbZaYJrLm1PUD/KSd4T6BlcQ3phUE9C+LheF2RMD0HWJbHh6Qi1r8AMPCBDgY2M2UTulqCejMjjOlyUou75zz0bXDIwYVop/ILZXCSTGufCHMfnjSCtPTitUzoCXTeX0ZoxZQzHoDQJd4QqfFnKLquP4BXy7ijjW4wogMM4h98s+XhkDfoxhP8ihQWDIb/nqEUBvIEGfnc0Siu6ijXg22kIG8jdYrOS0q7hpFYmUS+qB33Xgm9J7AvFETYHDQ4wcGdD5ZVpcBe/N1VstxoE7aZ8klsCo+QmrJOXy9kJORmzhyCjT02CBXEBDrJHBhPC2c7j00uBbsbMJ7ix53VBmADjDbF/wphZ0BtXWY3PHXnBQwQYO032IulGi+xx0OSx0qlHVMbqQR3WDxlAPmN5jKe0HvzLsJ1HNXugjuUi5sW0v4jti8mrL/MleNPhZcwS1hvG04PhAAUf4BKsxxMy4DgoVvpI7i9WSWXNtXT8MCnNd5I+iXllK3kj+cVrhmMgvFK+SPSv2+R5T3yHmcUd4TbSl9PwPzTdzz7sxZNSPPuF2e0087gDXclju4YnP3WY68k7ykr8aRWySA6jVncB73a3GWdIA7NGXfjFORYZc5KA9xHwVyw/Zgg64si0iPaw5mLK4zFW4oMb1XR7UHi6bpMuxsa32L6+aD2S+p6u2/krGTRJ5XD0rlnI+88jnLsr+XO3Rw53SRzM8wRyGZWvJpyDkcrhmAdooxFrZW94s8XtMHX0oSFHcwNbqq1WnyRAu8t7afhv/tl9CcGp0VwscCq5Vo5zjmoQb2S3zKHfZuYcW/7S5kIKW8WnCo3jKoVXxVo86+i0m+fodAEuxlasll6nza40yWlWu7ycMzX4E8up9yBHY8ieg3nOoznMVZwnP1HYXRy2QZvW45bBq7zgbMRyGQmasqaV/Kw3GoKzLHfQ6WvssWOBTAzCHuIU518TWuUEDa1hPhupLzju/ek6eaEE3Craynjg1IhBDb+tzEcYAXYxZt6r7DjJ7kHQWR/7b4kHMmNupOHNNHI/c21gzAd+kPW3+djT5Tz2GJNCB1709KIvY4c4Wls5Tl1c+RU7wwWoKITxrYqgtCc17TZpdPPmazCb/AG08DIokvfa7I+uyjx2Uq7BZsegdW5u51b6Dpqlv1ReAWrotYdaQf7BvIFvAzln6Eq1td5pbsYwnqb8aoK7NEwkFk+8O8xO7lTbeMA4XNDRl4U+Gg6/vIt3bttF4a+Zdb5pENZXiHr2lh4O9Eamp+OJTrvpaxsX1Kfag1/QeuNEezhve4K9BLgsRaQaHKdfErynoFLesyvw47RCqOELPPJ5APVNWPAo6cqbvEpOXTrDaLGC26C3o/mrV9+E07iHQH+dOhwhngQ/E8MKhrj9hVb3dKvPrvqy6T8e3kIhN/wUtCa61CuF4Zybjzecd0b6cQHajjVA832O+3LYgcKWTE7r5prCKca9iu84/wMLwnCuhhEazwAAAABJRU5ErkJggg==`;function rS({commodityType:e,commodityId:t,payMethod:n,enabled:r,onPaid:i}){let[a,o]=(0,J.useState)(),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(null),p=(0,J.useRef)(null),m=(0,J.useRef)(0),h=(0,J.useRef)(i);(0,J.useEffect)(()=>{h.current=i},[i]);let g=(0,J.useCallback)(()=>{p.current&&=(clearInterval(p.current),null)},[]),_=(0,J.useCallback)(()=>{m.current+=1,g()},[g]),v=(0,J.useCallback)(async()=>{let r=++m.current;g(),c(!0),u(null);try{let i=await be({commodityType:e,commodityId:t});if(r!==m.current)return;f(i.totalAmount);let a=await ze(i.orderNo,{payType:n,payChannel:`NATIVE`});if(r!==m.current)return;o(a?.code_url),p.current=setInterval(()=>{ue(i.orderNo).then(e=>{r===m.current&&e.orderStatus===`paid`&&(g(),h.current?.())}).catch(console.error)},3e3)}catch{if(r!==m.current)return;u(`支付初始化失败`),o(void 0),f(null)}finally{r===m.current&&c(!1)}},[e,t,n,g]);return(0,J.useEffect)(()=>{if(!r){_();return}return v(),_},[r,v,_]),(0,J.useEffect)(()=>{if(!r)return;let e=()=>{document.visibilityState===`hidden`?_():v()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[r,v,_]),{qrUrl:a,loading:s,error:l,totalAmountCents:d}}var iS=[{id:`alipay`,label:`支付宝`,icon:nS},{id:`wechat`,label:`微信支付`,icon:cx}];function aS(e){return e.startsWith(`洞见者`)?e.replace(/^洞见者(.*)(.{2})$/g,`洞见者***$2`):e.replace(/^(.{1})(.*)(.{1})$/g,`$1***$3`)}function oS({selectedCommodityId:e,selectedCommodityType:t,commoditiesLoading:n,price:r,reducedYuan:i=0,recentVips:a,statisticsLoading:o,showActivities:s=!0,onPaid:c}){let[l,u]=(0,J.useState)(`alipay`),d=l===`wechat`?`wxpay`:`alipay`,{qrUrl:f,loading:p,error:m,totalAmountCents:h}=rS({commodityType:t,commodityId:e,payMethod:d,enabled:!n&&e!=null&&t!=null,onPaid:(0,J.useCallback)(()=>{G.success(`恭喜你成为我们的会员,开始享受VIP权益`),c?.()},[c])}),g=h==null?n?`--`:r:(h/100).toFixed(2),_=a.map(e=>({name:aS(e.nickName),action:`加入了${nn[e.userLevel]}`})),v=s&&(o||_.length>0);return(0,Y.jsx)(`div`,{className:`rounded-[28px] border border-slate-100 bg-white p-6 shadow-[0_12px_40px_rgba(0,0,0,0.03)]`,children:(0,Y.jsxs)(`div`,{className:`h-40 flex items-center gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex w-36 shrink-0 flex-col gap-2.5`,children:iS.map(({id:e,label:t,icon:n})=>{let r=l===e;return(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:`relative flex h-12 w-full items-center justify-center gap-2 overflow-hidden rounded-xl border-2 transition-all select-none cursor-pointer ${r?`border-[#1875e5] bg-white text-[#1875e5] shadow-sm`:`border-slate-200 bg-white text-slate-600 hover:border-slate-300 hover:bg-white`}`,children:[r&&(0,Y.jsx)(`div`,{className:`absolute top-0 left-0 w-0 h-0 border-t-18 border-t-[#1875e5] border-r-18 border-r-transparent`,children:(0,Y.jsx)(cv,{size:8,className:`absolute -top-4 left-px text-white stroke-[3.5]`})}),(0,Y.jsx)(`img`,{src:n,alt:``,className:`h-5 w-5 shrink-0 object-contain`}),(0,Y.jsx)(`span`,{className:`text-xs ${r?`font-bold`:`font-semibold`}`,children:t})]},e)})}),(0,Y.jsxs)(`div`,{className:`flex w-full flex-1 items-center gap-4 rounded-[22px] border border-slate-100/80 bg-[#f8fbfe]/60 p-4`,children:[(0,Y.jsxs)(`div`,{className:`relative flex h-33 w-33 shrink-0 items-center justify-center overflow-hidden rounded-2xl border border-slate-100 bg-white p-2.5 shadow-md`,children:[f?(0,Y.jsx)(pn,{value:f,size:112,bgColor:`#ffffff`,fgColor:`#333333`,level:`L`,marginSize:0,"aria-label":`支付二维码`,className:`relative z-10`},`${d}-${e}`):p?(0,Y.jsx)(Jv,{size:28,className:`animate-spin text-slate-400`}):m?(0,Y.jsx)(`span`,{className:`px-2 text-center text-xs leading-relaxed text-red-500`,children:m}):(0,Y.jsx)(`span`,{className:`px-2 text-center text-xs text-slate-400`,children:`等待生成二维码`}),f&&(0,Y.jsx)(`div`,{className:`vip-qrcode-scan-line`})]}),(0,Y.jsxs)(`div`,{className:`flex-1 space-y-2 text-left`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`mb-0.5 text-xs font-bold text-slate-400`,children:`金额总计:`}),(0,Y.jsxs)(`div`,{className:`flex items-baseline justify-start gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-base font-extrabold text-rose-500`,children:`¥`}),(0,Y.jsx)(`span`,{className:`text-4xl font-black tracking-tight text-rose-500`,children:g}),i>0?(0,Y.jsxs)(`span`,{className:`ml-1 text-sm font-bold text-rose-500`,children:[`(立减`,i,`)`]}):null]})]}),(0,Y.jsx)(`span`,{className:`block text-xs font-bold text-[#1875e5]`,children:`可扫页面底部二维码添加客服好友开发票`}),(0,Y.jsxs)(`div`,{className:`text-[10px] font-semibold text-slate-400`,children:[`支付即表示您同意`,(0,Y.jsx)(`button`,{type:`button`,onClick:()=>window.open(`/protocol/service`,`_blank`,`noopener,noreferrer`),className:`cursor-pointer font-bold text-slate-500 hover:underline`,children:`《洞见研报网站服务协议》`})]})]})]}),v&&(0,Y.jsx)(`div`,{className:`flex h-full w-60 shrink-0 flex-col text-left`,children:(0,Y.jsx)(`div`,{className:`relative h-full overflow-hidden rounded-3xl border border-slate-100/60 bg-slate-50/40 p-3`,children:o?(0,Y.jsx)(sS,{name:`--`,action:`--`}):(0,Y.jsx)(`div`,{className:`vip-scroll-vertical flex flex-col`,children:[0,1].map(e=>(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map((t,n)=>(0,Y.jsx)(sS,{name:t.name,action:t.action},`${e}-${n}`))},e))})})})]})})}function sS({name:e,action:t}){return(0,Y.jsxs)(`div`,{className:`flex h-[38px] shrink-0 items-center justify-between rounded-full border border-slate-100/80 bg-white px-4 py-2 transition-all duration-200 select-none hover:shadow-sm`,children:[(0,Y.jsx)(`span`,{className:`max-w-20 truncate text-[11px] font-bold text-slate-600`,children:e}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-extrabold text-[#1875e5]`,children:t})]})}function cS(){return(0,Y.jsxs)(`div`,{className:`animate-pulse space-y-3 rounded-3xl border-2 border-slate-100 bg-white px-3 py-4 shadow-sm`,children:[(0,Y.jsx)(`div`,{className:`mx-auto h-5 w-2/3 rounded bg-slate-100`}),(0,Y.jsx)(`div`,{className:`mx-auto h-9 w-20 rounded bg-slate-100`}),(0,Y.jsx)(`div`,{className:`mx-auto h-3 w-24 rounded bg-slate-100`}),(0,Y.jsx)(`div`,{className:`border-t border-slate-50 pt-2.5`,children:(0,Y.jsx)(`div`,{className:`mx-auto h-3 w-28 rounded bg-slate-100`})})]})}function lS({title:e,price:t,unit:n,original:r,gift:i,active:a,showPopularBadge:o=!1,onClick:s}){return(0,Y.jsxs)(`div`,{onClick:s,className:`relative rounded-3xl border-2 px-3 py-4 transition-all duration-300 select-none overflow-hidden cursor-pointer ${a?`bg-linear-to-b from-[#fff5f5] via-[#fdf0f0] to-[#fce8e8] border-[#e1251b] shadow-lg shadow-red-500/5 scale-[1.01]`:`bg-white border-slate-100 hover:border-slate-200 shadow-sm hover:bg-slate-50/50`}`,children:[o&&(0,Y.jsx)(`div`,{className:`absolute top-0 right-0 overflow-hidden w-24 h-24 pointer-events-none rounded-tr-3xl z-20`,children:(0,Y.jsx)(`div`,{className:`absolute top-4 -right-6 rotate-45 bg-[#e1251b] text-white text-[9px] font-black py-0.5 px-7 text-center select-none shadow-sm uppercase tracking-wider`,children:`85%用户选择`})}),(0,Y.jsx)(`div`,{className:`mb-3 transition-colors duration-200 ${a?`text-red-900`:`text-[#113171]`}`,children:(e=>{if(e.includes(`(`)){let t=e.split(`(`);return(0,Y.jsxs)(`div`,{className:`text-center text-base font-black leading-tight`,children:[(0,Y.jsx)(`span`,{children:t[0]}),(0,Y.jsxs)(`span`,{className:`ml-1 text-xs font-bold tracking-wide ${a?`text-rose-900/80`:`text-slate-400`}`,children:[`(`,t[1]]})]})}return(0,Y.jsx)(`div`,{className:`text-center text-base font-bold leading-tight`,children:e})})(e)}),(0,Y.jsxs)(`div`,{className:`mb-2 flex flex-col items-center justify-center gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline justify-center gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`mr-0.5 text-xs font-black ${a?`text-red-650`:`text-slate-800`}`,children:`¥`}),(0,Y.jsx)(`span`,{className:`text-3xl font-extrabold tracking-tight ${a?`text-[#e1251b]`:`text-[#113171]`}`,children:t}),(0,Y.jsx)(`span`,{className:`ml-0.5 text-sm font-semibold ${a?`text-rose-900/70`:`text-slate-500`}`,children:n})]}),(0,Y.jsxs)(`span`,{className:`text-[11px] font-semibold line-through ${a?`text-rose-900/50`:`text-slate-400`}`,children:[`原价¥`,r]})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-center gap-0.5 border-t pt-2.5 text-center text-xs font-black ${a?`border-red-100 text-[#e1251b]`:`border-slate-50 text-rose-500`}`,children:[(0,Y.jsx)(`span`,{children:`赠:`}),(0,Y.jsx)(`span`,{children:i})]}),a&&(0,Y.jsx)(`div`,{className:`absolute bottom-1 right-2 text-red-500/5 pointer-events-none select-none`,children:(0,Y.jsx)(bv,{size:44,className:`translate-x-2 translate-y-1 rotate-12`})})]})}function uS({icon:e,label:t,sub:n,active:r}){return(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 select-none transition-all duration-300 ${r?`opacity-100`:`opacity-[0.38]`}`,children:[(0,Y.jsx)(`div`,{className:`w-12 h-12 rounded-full flex items-center justify-center shrink-0 transition-transform hover:scale-105 duration-200 ${r?`bg-[#fdf3e7] text-[#ca9440] shadow-sm shadow-[#fca327]/5`:`bg-[#f1f5f9] text-slate-400`}`,children:(0,J.isValidElement)(e)&&(0,J.cloneElement)(e,{size:20})}),(0,Y.jsxs)(`div`,{className:`text-left`,children:[(0,Y.jsx)(`div`,{className:`text-[14px] font-extrabold tracking-wide ${r?`text-slate-800`:`text-slate-500`}`,children:t}),(0,Y.jsx)(`div`,{className:`text-[11px] font-bold mt-0.5 leading-none whitespace-nowrap ${r?`text-slate-400`:`text-slate-300`}`,children:n})]})]})}function dS(e){let t=e===`dj_svip`;return[{id:`read`,label:`研报阅读`,sub:`3000篇/月`,icon:(0,Y.jsx)(Q_,{}),active:!0},{id:`download`,label:`研报下载`,sub:t?`500篇/月`:`300篇/月`,icon:(0,Y.jsx)(Sv,{}),active:!0},{id:`search`,label:`全文检索`,sub:`标题与正文精准查找`,icon:(0,Y.jsx)(uy,{}),active:!0},{id:`filter`,label:`多维筛选`,sub:`行业、机构等组合筛选`,icon:(0,Y.jsx)(Pv,{}),active:!0},{id:`format`,label:`多格式下载`,sub:`支持PDF/PPT/Word`,icon:(0,Y.jsx)(Ov,{}),active:!0},{id:`company`,label:`公司研究`,sub:`聚合企业研究资料`,icon:(0,Y.jsx)(nv,{}),active:!0},{id:`compete`,label:`竞对分析`,sub:`多维对比竞争企业`,icon:(0,Y.jsx)(Rv,{}),active:!0},{id:`dashboard`,label:`数据看板`,sub:`宏观及行业数据`,icon:(0,Y.jsx)(ov,{}),active:!0},{id:`ai`,label:`AI增值权益`,sub:t?`智能撰写平台二选一`:`研墨AI会员`,icon:(0,Y.jsx)(my,{}),active:!0}]}function fS({commodityType:e,onViewAll:t,className:n}){let r=dS(e);return(0,Y.jsxs)(`div`,{className:n??`rounded-[28px] border border-slate-100 bg-white px-6 py-4 shadow-[0_12px_40px_rgba(0,0,0,0.03)]`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between border-b border-slate-50 pb-4`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-black text-[#113171] select-none`,children:[(0,Y.jsx)(`div`,{className:`h-5 w-1 rounded-full bg-[#1875e5]`}),`VIP权益`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`animate-pulse-slow cursor-pointer text-xs font-bold text-slate-400 transition-colors hover:text-slate-600 hover:underline select-none`,children:`查看完整权益 >`})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-5 gap-x-2 gap-y-4`,children:r.map(e=>(0,Y.jsx)(uS,{icon:e.icon,label:e.label,sub:e.sub,active:e.active},e.id))})]})}function pS({isOpen:e,onClose:t,defaultCommodityType:n}){let r=es(),{patchUser:i}=ln(),[a,o]=(0,J.useState)(0),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!0),[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(!0);if((0,J.useEffect)(()=>{e&&(async()=>{u(!0),m(!0);try{let[e,t]=await Promise.all([ke(),Ee({types:`dj_svip,dj_vip,dj_vip0`})]);c(e);let r=Qx(t);if(f(r),n){let e=r.findIndex(e=>e.commodityType===n);e!==-1&&o(e)}}catch(e){console.error(e)}finally{u(!1),m(!1)}})()},[e,n]),!e)return null;let h=d[a],g=()=>{t()},_=async()=>{try{let e=await Fe();i(e)}catch(e){console.error(e)}t()};return(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:g,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative flex max-h-[90vh] w-full max-w-4xl flex-col overflow-hidden rounded-[28px] border border-slate-100 bg-white shadow-[0_25px_60px_rgba(0,0,0,0.12)]`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-10 h-1.5 bg-linear-to-r from-blue-500 via-indigo-500 to-blue-600`}),(0,Y.jsx)(`button`,{type:`button`,onClick:g,className:`absolute top-4 right-4 z-20 cursor-pointer rounded-full p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`overflow-y-auto px-6 pt-7 pb-6`,children:[(0,Y.jsx)(`div`,{className:`mb-5`,children:(0,Y.jsx)(tS,{totalVip:s?.totalVip,statisticsLoading:l})}),(0,Y.jsx)(`div`,{className:`mb-5 grid grid-cols-3 gap-3`,children:p?Array.from({length:3},(e,t)=>(0,Y.jsx)(cS,{},t)):d.map((e,t)=>(0,Y.jsx)(lS,{title:e.title,price:e.price,unit:e.unit,original:e.original,gift:e.gift,active:a===t,showPopularBadge:t===0,onClick:()=>o(t)},e.id))}),(0,Y.jsx)(`div`,{className:`mb-5`,children:(0,Y.jsx)(fS,{commodityType:h?.commodityType,onViewAll:()=>{g(),r(`/services`)},className:`rounded-2xl border border-slate-100 bg-white px-5 py-4`})}),(0,Y.jsx)(oS,{selectedCommodityId:h?.id,selectedCommodityType:h?.commodityType,commoditiesLoading:p,price:h?.price??``,reducedYuan:h?.reducedYuan,recentVips:s?.recentVips??[],statisticsLoading:l,onPaid:()=>void _()})]})]})]})})}var mS=[{name:`报告搜索结果全部展现`,included:!0},{name:`全屏阅读`,included:!0},{name:`去广告弹窗`,included:!0},{name:`洞见数据`,included:!0},{name:`PPT/Word格式下载`,included:!0},{name:`报告筛选全部功能`,included:!0},{name:`新功能优先使用`,included:!0},{name:`免费阅读(9000篇/月)`,included:!0},{name:`免费下载(1500篇/月)`,included:!0},{name:`付费研报折扣(9折)`,included:!0}];function hS({isOpen:e,onClose:t}){let{patchUser:n}=ln(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!0);if((0,J.useEffect)(()=>{e&&(async()=>{o(!0);try{let e=(await Ee({types:`dj_shared_vip`}))[0];e&&i(Zx(e))}catch(e){console.error(e)}finally{o(!1)}})()},[e]),!e)return null;let s=()=>{t()},c=async()=>{try{let e=await Fe();n(e)}catch(e){console.error(e)}t()};return(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:s,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative flex max-h-[90vh] w-full max-w-170 flex-col overflow-hidden rounded-[28px] border border-slate-100 bg-white shadow-[0_25px_60px_rgba(0,0,0,0.12)]`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-10 h-1.5 bg-linear-to-r from-blue-500 via-indigo-500 to-blue-600`}),(0,Y.jsx)(`button`,{type:`button`,onClick:s,className:`absolute top-4 right-4 z-20 cursor-pointer rounded-full p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600`,children:(0,Y.jsx)(tn,{size:20})}),(0,Y.jsxs)(`div`,{className:`overflow-y-auto px-6 pt-7 pb-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-5 flex items-center gap-2.5`,children:[(0,Y.jsx)(Ey,{size:22,className:`text-amber-500`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-bold leading-6 text-slate-800`,children:`团队版VIP`}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-slate-500`,children:`3人共享,更多权益`})]})]}),(0,Y.jsx)(`div`,{className:`mb-5 flex h-32 flex-col justify-between overflow-hidden rounded-2xl border border-amber-100/70 bg-linear-to-br from-white via-amber-50/40 to-orange-50/30`,children:a||!r?(0,Y.jsx)(`div`,{className:`flex flex-1 animate-pulse items-center justify-center text-sm text-slate-400`,children:`加载中...`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-5 px-6 py-5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline`,children:[(0,Y.jsx)(`span`,{className:`text-lg font-bold text-amber-600`,children:`¥`}),(0,Y.jsx)(`span`,{className:`text-4xl font-black tracking-tight text-amber-800`,children:r.price}),(0,Y.jsx)(`span`,{className:`ml-1 text-sm font-semibold text-slate-500`,children:r.unit})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-base font-bold text-slate-800`,children:`团队版VIP · 3人共享`}),(0,Y.jsx)(`span`,{className:`truncate text-sm text-slate-500`,children:`送先见AI / 研磨AI一年权益(二选一)`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-amber-100/70 bg-amber-50/60 px-6 py-2.5 text-xs font-semibold text-amber-800/80`,children:[(0,Y.jsx)(Ey,{size:14,className:`shrink-0 text-amber-500`}),`可共用人数:3人(团队版VIP支持最多3台设备同时使用)`]})]})}),(0,Y.jsxs)(`div`,{className:`mb-5 rounded-2xl border border-amber-100/70 bg-linear-to-br from-white via-amber-50/30 to-orange-50/20 px-6 py-5`,children:[(0,Y.jsx)(`div`,{className:`mb-4 flex items-center border-b border-amber-100/60 pb-3`,children:(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-base font-bold text-slate-800`,children:[(0,Y.jsx)(`div`,{className:`h-4 w-1 rounded-full bg-amber-500`}),`团队版权益`]})}),(0,Y.jsx)(`ul`,{className:`grid grid-cols-2 gap-x-6 gap-y-3`,children:mS.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-sm text-[#394551]`,children:[e.included?(0,Y.jsx)(`span`,{className:`flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-full bg-amber-500/15`,children:(0,Y.jsx)(cv,{size:12,className:`text-amber-600`})}):(0,Y.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-slate-300`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]},e.name))})]}),(0,Y.jsx)(oS,{selectedCommodityId:r?.id,selectedCommodityType:r?.commodityType,commoditiesLoading:a,price:r?.price??``,reducedYuan:r?.reducedYuan,recentVips:[],statisticsLoading:!1,showActivities:!1,onPaid:()=>void c()})]})]})]})})}var gS=`https://www.djyanbao.com`,_S={invite:25,publish:30};function vS(e,t){let n=gS.replace(/\/$/,``),r=e.startsWith(`/`)?e:`/${e}`;return`${n}${r}${r.includes(`?`)?`&`:`?`}invite_code=${t}`}function yS({isOpen:e,onClose:t,defaultTab:n=`invite`}){let{pathname:r,search:i}=Zo(),[a,o]=(0,J.useState)(n),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1),h=_S[a],g=l?vS(r+i,l):``;return(0,J.useEffect)(()=>{e&&(async()=>{try{u(await Re())}catch{u(``)}})()},[e]),e?(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-start justify-center pt-[10vh] p-4`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-black/60`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:12},transition:{duration:.2},onClick:e=>e.stopPropagation(),className:`relative w-180 bg-white rounded-3xl shadow-[0_30px_70px_rgba(0,0,0,0.22)] overflow-hidden flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`relative h-45 bg-linear-to-r from-[#FF512F] via-[#F09819] to-[#FF512F] p-8 flex items-center justify-between overflow-hidden`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(45deg,rgba(255,255,255,0.1)_25%,transparent_25%,transparent_50%,rgba(255,255,255,0.1)_50%,rgba(255,255,255,0.1)_75%,transparent_75%,transparent)] bg-size-[40px_40px] opacity-15`}),(0,Y.jsx)(`div`,{className:`absolute top-1/2 left-1/4 -translate-y-1/2 w-72 h-72 rounded-full bg-yellow-300/25`}),(0,Y.jsxs)(`div`,{className:`relative z-10 text-white shrink-0`,children:[(0,Y.jsx)(`h2`,{className:`text-4xl font-black tracking-wider drop-shadow-[0_2px_4px_rgba(0,0,0,0.15)]`,children:`分享送洞见卡`}),(0,Y.jsx)(`p`,{className:`text-yellow-100 text-sm font-bold tracking-wide mt-2 drop-shadow-sm`,children:`邀好友注册,双向获赠高价值研报阅读专属特权`})]}),(0,Y.jsxs)(`div`,{className:`relative z-10 flex items-center pr-10 shrink-0 select-none`,children:[(0,Y.jsx)(`div`,{className:`absolute -top-6 -left-6 w-10 h-10 bg-linear-to-tr from-amber-400 to-yellow-200 rounded-full shadow-lg flex items-center justify-center font-bold text-amber-800 text-lg border border-amber-300`,children:`¥`}),(0,Y.jsxs)(`div`,{className:`bg-linear-to-br from-rose-100 to-white text-[#E53935] p-5 rounded-2xl shadow-lg flex flex-col items-center justify-center border-2 border-yellow-200/60 relative w-32.5 h-27.5`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] uppercase font-black tracking-widest text-[#D32F2F] bg-red-100 px-1.5 py-0.5 rounded leading-none`,children:`Voucher`}),(0,Y.jsxs)(`div`,{className:`flex items-baseline text-red-600 font-extrabold mt-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:`¥`}),(0,Y.jsx)(`span`,{className:`text-3xl tracking-tighter leading-none ml-0.5`,children:h})]}),(0,Y.jsx)(`div`,{className:`text-[11px] font-black text-slate-800 mt-1`,children:`洞见卡`}),(0,Y.jsx)(`div`,{className:`absolute top-1/2 -left-2 w-4 h-4 rounded-full bg-linear-to-r from-transparent to-[#F09819] -translate-y-1/2`}),(0,Y.jsx)(`div`,{className:`absolute top-1/2 -right-2 w-4 h-4 rounded-full bg-linear-to-l from-transparent to-[#F09819] -translate-y-1/2`})]}),(0,Y.jsx)(`div`,{className:`absolute -bottom-4 -right-2 w-8 h-8 bg-linear-to-tr from-amber-500 to-yellow-300 rounded-full shadow-md flex items-center justify-center font-bold text-amber-900 border border-amber-400`,children:`¥`})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`absolute top-5 right-5 text-white/80 hover:text-white transition-colors p-1.5 hover:bg-white/10 rounded-full z-30 cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})})]}),(0,Y.jsxs)(`div`,{className:`p-8 flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex border border-blue-500 rounded-lg overflow-hidden shrink-0`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(`invite`),className:`flex-1 text-center px-4 py-2 text-sm font-bold transition-all cursor-pointer ${a===`invite`?`bg-blue-600 text-white`:`bg-white text-blue-600 hover:bg-blue-50`}`,children:`方式一:邀请注册成功送洞见卡`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(`publish`),className:`flex-1 text-center px-4 py-2 text-sm font-bold transition-all cursor-pointer ${a===`publish`?`bg-blue-600 text-white`:`bg-white text-blue-600 hover:bg-blue-50`}`,children:`方式二:在平台发布或评论符合要求的内容并@官方账号`})]}),a===`invite`?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-col`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-[#E05221] font-bold text-center leading-relaxed mb-6`,children:[`复制以下链接,发送给你的好友,完成注册后将分别获赠价值¥`,h,`元的洞见卡`]}),(0,Y.jsxs)(`div`,{className:`bg-slate-50 border border-slate-200/60 p-5 rounded-2xl flex flex-row gap-5 items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 w-full space-y-3 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-bold text-slate-800 leading-normal`,children:`洞见报告 - 海量行业、上市公司研究报告,访问我的邀请链接:`}),(0,Y.jsxs)(`div`,{className:`flex items-stretch rounded-xl overflow-hidden border border-slate-200 bg-white`,children:[(0,Y.jsx)(`div`,{className:`flex-1 px-3.5 py-2.5 text-xs text-slate-700 font-mono select-all truncate`,children:g||`加载中…`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{g&&navigator.clipboard.writeText(g).then(()=>{c(!0),G.success(`复制成功`),setTimeout(()=>c(!1),2e3)})},disabled:!g,className:`px-5 py-2.5 flex items-center gap-1.5 text-xs font-bold text-white transition-all cursor-pointer whitespace-nowrap shrink-0 disabled:opacity-50 disabled:cursor-not-allowed ${s?`bg-emerald-600`:`bg-blue-600 hover:bg-blue-500`}`,children:s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(cv,{size:14}),(0,Y.jsx)(`span`,{children:`已复制`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(vv,{size:14}),(0,Y.jsx)(`span`,{children:`复制`})]})})]}),(0,Y.jsx)(`div`,{className:`text-[11px] text-slate-400 font-semibold leading-relaxed`,children:`新用户登录即赠洞见卡,开启每日免费阅读报告权益!`})]}),(0,Y.jsx)(`div`,{className:`w-35 h-35 bg-white p-2.5 rounded-2xl border border-slate-100 shrink-0 flex items-center justify-center shadow-sm`,children:(0,Y.jsx)(`img`,{src:tb,alt:`小程序分享码`,className:`w-30 h-30 object-contain rounded`})})]})]}):(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-4 text-sm font-bold text-slate-800`,children:[(0,Y.jsx)(`p`,{children:`发布内容:对于洞见研报平台的体验分享、搜检攻略、获取洞见卡的攻略等`}),(0,Y.jsx)(`p`,{children:`发布平台:小红书、知乎、雪球、百家号、今日头条、顶端号`})]}),(0,Y.jsxs)(`p`,{className:`text-sm text-[#E05221] font-bold`,children:[`创作图文或视频、发表评论都可获得价值¥`,h,`元的洞见卡`]}),(0,Y.jsxs)(`p`,{className:`text-sm font-semibold text-slate-800 truncate`,children:[`撰文或评论中需包含此链接:`,(0,Y.jsx)(`span`,{className:`text-blue-600 ml-1`,children:g||`加载中…`})]}),(0,Y.jsxs)(`div`,{className:`bg-slate-50 border border-slate-200/60 p-5 rounded-2xl`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-bold text-slate-800 mb-3`,children:`粘贴文章/评论所在的链接`}),(0,Y.jsxs)(`div`,{className:`flex items-stretch rounded-xl overflow-hidden border border-slate-200 bg-white`,children:[(0,Y.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`粘贴图文、视频或评论所在帖子的链接`,className:`flex-1 px-3.5 py-2.5 text-sm text-slate-700 outline-none min-w-0`}),(0,Y.jsx)(`button`,{type:`button`,onClick:async()=>{if(!d.trim()){G.error(`请粘贴帖子链接`);return}m(!0);try{await he({link:d.trim()}),G.success(`提交成功`)}catch{}finally{m(!1)}},disabled:p,className:`px-5 py-2.5 text-sm font-bold text-white bg-blue-600 hover:bg-blue-500 transition-all cursor-pointer whitespace-nowrap shrink-0 disabled:opacity-50 disabled:cursor-not-allowed`,children:`提交`})]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-slate-400 font-semibold leading-relaxed mt-3`,children:`提交后系统将在2个工作日内完成审核`})]})]})]})]})]})}):null}var bS=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),xS=[1/0,1/0,-1/0,-1/0],SS=new Float32Array(xS),CS=[.001,0,0,.001,0,0],wS=`http://www.w3.org/2000/svg`,TS={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},ES={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},DS=`pdfjs_internal_id_`,OS=`pdfjs_internal_editor_`,kS={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},AS={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},jS={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},MS={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},NS={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},PS={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},FS={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},IS={ERRORS:0,WARNINGS:1,INFOS:5},LS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},RS={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},zS={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},BS=IS.WARNINGS;function VS(e){Number.isInteger(e)&&(BS=e)}function HS(){return BS}function US(e){BS>=IS.INFOS&&console.info(`Info: ${e}`)}function WS(e){BS>=IS.WARNINGS&&console.warn(`Warning: ${e}`)}function GS(e){throw Error(e)}function KS(e,t){e||GS(t)}function qS(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function JS(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=sC(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return qS(r)?r:null}function YS(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&JS(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function XS(e){return e.substring(e.lastIndexOf(`/`)+1)}function X(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var ZS=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),QS=class extends ZS{constructor(e,t){super(e,`PasswordException`),this.code=t}},$S=class extends ZS{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},eC=class extends ZS{constructor(e){super(e,`InvalidPDFException`)}},tC=class extends ZS{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},nC=class extends ZS{constructor(e){super(e,`FormatError`)}},rC=class extends ZS{constructor(e){super(e,`AbortException`)}};function iC(e){(typeof e!=`object`||e?.length===void 0)&&GS(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function aC(e){typeof e!=`string`&&GS(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}var oC=class{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let t=new Uint32Array(e.buffer,0,1);return X(this,`isLittleEndian`,t[0]===1)}static get isOffscreenCanvasSupported(){return X(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return X(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return X(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return X(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return X(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported?e=new OffscreenCanvas(1,1).getContext(`2d`):typeof document<`u`&&(e=document.createElement(`canvas`).getContext(`2d`)),X(this,`isCanvasFilterSupported`,e?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>`u`)return X(this,`isAlphaColorInputSupported`,!1);let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,X(this,`isAlphaColorInputSupported`,e.value!==`#ff0000`)}static get isBackdropFilterSupported(){return X(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},Z=class{static get hexNums(){return X(this,`hexNums`,Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static#e(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}static#t(e,t,n,r,i,a,o,s,c,l,u,d){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,n,r,i,a,o,s,-u/l,d);return}let f=l**2-4*u*c;if(f<0)return;let p=Math.sqrt(f),m=2*c;this.#e(e,t,n,r,i,a,o,s,(-l+p)/m,d),this.#e(e,t,n,r,i,a,o,s,(-l-p)/m,d)}static bezierBoundingBox(e,t,n,r,i,a,o,s,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,s),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,s),this.#t(e,n,i,o,t,r,a,s,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),c),this.#t(e,n,i,o,t,r,a,s,3*(-t+3*(r-a)+s),6*(t-2*r+a),3*(r-t),c)}};function sC(e){return decodeURIComponent(escape(e))}var cC=null,lC=null;function uC(e){return cC||(cC=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,lC=new Map([[`ſt`,`ſt`]])),e.replaceAll(cC,(e,t,n)=>t?t.normalize(`NFKC`):lC.get(n))}function dC(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),iC(e)}function fC(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}var pC=()=>[],mC=()=>new Map,hC=()=>Object.create(null),gC=()=>new Set;typeof Iterator.prototype.join!=`function`&&(Iterator.prototype.join=function(e){return[...this].join(e)});function _C(e,t,n){return Math.min(Math.max(e,t),n)}var vC=class e{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=a,n*=t;let s=(e[2]+e[0])/2,c=(e[3]+e[1])/2,l,u,d,f;switch(r%=360,r<0&&(r+=360),r){case 180:l=-1,u=0,d=0,f=1;break;case 90:l=0,u=1,d=1,f=0;break;case 270:l=0,u=-1,d=-1,f=0;break;case 0:l=1,u=0,d=0,f=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}o&&(d=-d,f=-f);let p,m,h,g;l===0?(p=Math.abs(c-e[1])*n+i,m=Math.abs(s-e[0])*n+a,h=(e[3]-e[1])*n,g=(e[2]-e[0])*n):(p=Math.abs(s-e[0])*n+i,m=Math.abs(c-e[1])*n+a,h=(e[2]-e[0])*n,g=(e[3]-e[1])*n),this.transform=[l*n,u*n,d*n,f*n,p-l*n*s-d*n*c,m-u*n*s-f*n*c],this.width=h,this.height=g}get rawDims(){let e=this.viewBox;return X(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:t=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new e({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:n,offsetX:r,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){let n=[e,t];return Z.applyTransform(n,this.transform),n}convertToPdfPoint(e,t){let n=[e,t];return Z.applyInverseTransform(n,this.transform),n}},yC=class e{static textContent(t){let n=[],r={items:n,styles:Object.create(null)};function i(t){if(!t)return;let r=null,a=t.name;if(a===`#text`)r=t.value;else if(e.shouldBuildText(a))t?.attributes?.textContent?r=t.attributes.textContent:t.value&&(r=t.value);else return;if(r!==null&&n.push({str:r}),t.children)for(let e of t.children)i(e)}return i(t),r}static shouldBuildText(e){return e!==`textarea`&&e!==`input`&&e!==`option`&&e!==`select`}},bC=/url\(|image-set\(/i,xC=/^on/i,SC=class{static get _allowedHtmlElements(){return X(this,`_allowedHtmlElements`,new Set([`a`,`b`,`br`,`button`,`div`,`i`,`img`,`input`,`label`,`li`,`ol`,`option`,`p`,`select`,`span`,`sub`,`sup`,`textarea`,`ul`]))}static get _allowedSvgElements(){return X(this,`_allowedSvgElements`,new Set([`ellipse`,`line`,`path`,`rect`,`svg`]))}static get _allowedRichTextElements(){return X(this,`_allowedRichTextElements`,new Set([`a`,`b`,`br`,`div`,`i`,`li`,`ol`,`p`,`span`,`sub`,`sup`,`ul`]))}static get _allowedRichTextAttributes(){return X(this,`_allowedRichTextAttributes`,new Set([`class`,`dir`,`style`]))}static get _allowedRichTextStyles(){return X(this,`_allowedRichTextStyles`,new Set(`color.font.fontFamily.fontSize.fontStretch.fontStyle.fontWeight.kerningMode.letterSpacing.lineHeight.margin.marginBottom.marginLeft.marginRight.marginTop.orphans.paddingLeft.paddingRight.breakAfter.breakBefore.breakInside.tabInterval.tabStop.textAlign.textDecoration.textIndent.transform.verticalAlign.widows`.split(`.`)))}static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})})}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null&&!xC.test(t)&&(r!==`richText`||this._allowedRichTextAttributes.has(t)))switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:if(r===`richText`){let t=this._allowedRichTextStyles;for(let[r,i]of Object.entries(n))t.has(r)&&!bC.test(i)&&(e.style[r]=i)}else Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i?.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static#e(e,t,n){return n===`richText`?!t&&this._allowedRichTextElements.has(e)?document.createElement(e):null:t?t===wS&&this._allowedSvgElements.has(e)?document.createElementNS(wS,e):null:this._allowedHtmlElements.has(e)?document.createElement(e):null}static render(e){let t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||`display`,a=this.#e(r.name,r.attributes?.xmlns,i)??document.createElement(`div`);r.attributes&&this.setAttributes({html:a,element:r,intent:i,linkService:n});let o=i!==`richText`,s=e.div;if(s.append(a),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;s.style.transform=t}o&&s.setAttribute(`class`,`xfaLayer xfaFont`);let c=[];if(r.children.length===0){if(r.value){let e=document.createTextNode(r.value);a.append(e),o&&yC.shouldBuildText(r.name)&&c.push(e)}return{textDivs:c}}let l=[[r,-1,a]];for(;l.length>0;){let[e,r,a]=l.at(-1);if(r+1===e.children.length){l.pop();continue}let s=e.children[++l.at(-1)[1]];if(s===null)continue;let{name:u}=s;if(u===`#text`){let e=document.createTextNode(s.value);c.push(e),a.append(e);continue}let d=this.#e(u,s.attributes?.xmlns,i);if(d){if(a.append(d),s.attributes&&this.setAttributes({html:d,element:s,storage:t,intent:i,linkService:n}),s.children?.length>0)l.push([s,-1,d]);else if(s.value){let e=document.createTextNode(s.value);o&&yC.shouldBuildText(u)&&c.push(e),d.append(e)}}}for(let e of s.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:c}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}static getPageViewport(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new vC({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}},CC=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function wC(e,t=`text`){if(jC(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);switch(t){case`blob`:return n.blob();case`bytes`:return n.bytes();case`json`:return n.json()}return n.text()}return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.responseType=t===`bytes`?`arraybuffer`:t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case`bytes`:n(new Uint8Array(i.response));return;case`blob`:case`json`:n(i.response);return}n(i.responseText);return}r(Error(i.statusText))}},i.send(null)})}var TC=class extends ZS{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}};function EC(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function DC(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function OC(e){return[e]=e.split(/[#?]/,1),XS(e)}function kC(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(EC(e))return WS(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=(e=>{try{return new URL(e)}catch{}try{return new URL(decodeURIComponent(e))}catch{}try{return new URL(e,`https://foo.bar`)}catch{}try{return new URL(decodeURIComponent(e),`https://foo.bar`)}catch{}return null})(e);if(!n)return t;let r=e=>{try{let t=decodeURIComponent(e);return t.includes(`/`)&&(t=XS(t),t.length===4&&i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=XS(n.pathname);if(i.test(a))return r(a);if(n.searchParams.size>0){let e=e=>[...e].findLast(e=>i.test(e)),t=e(n.searchParams.values())??e(n.searchParams.keys());if(t)return r(t)}if(n.hash){let{hash:e}=n,t=-1;for(let{index:n}of e.matchAll(/\.pdf\b/gi))t=n;if(t>0){let n=t;for(;n>0&&!`/?#=`.includes(e[n-1]);)n--;if(n<t)return r(e.slice(n,t+4))}}return t}var AC=class{#e=new Map;times=[];time(e){this.#e.has(e)&&WS(`Timer is already running for ${e}`),this.#e.set(e,Date.now())}timeEnd(e){this.#e.has(e)||WS(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.#e.get(e),end:Date.now()}),this.#e.delete(e)}toString(){let e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms\n`).join(``)}};function jC(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test(n?.protocol??``)}function MC(e){e.preventDefault()}function NC(e){e.preventDefault(),e.stopPropagation()}var PC=class{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!=`string`)return null;this.#e||=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?`);let t=this.#e.exec(e);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;let c=t[7]||`Z`,l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,c===`-`?(a+=l,o+=u):c===`+`&&(a-=l,o-=u),new Date(Date.UTC(n,r,i,a,o,s))}};function FC(e){if(e.startsWith(`#`)){let t=e.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(e.startsWith(`rgb(`)){let[t,n,r]=e.slice(4,-1).split(`,`).map(e=>parseInt(e,10));return[t,n,r,1]}if(e.startsWith(`rgba(`)){let t=e.slice(5,-1).split(`,`);return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}let t=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!==`none`?parseFloat(t[4]):1]:null}function IC(e){let t=FC(e);return t?t.slice(0,3):(WS(`Not a valid color format: "${e}"`),[0,0,0])}function LC(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,t.style.colorScheme=`only light`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,IC(r))}t.remove()}function RC(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function zC(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function BC(e,t,n=!1,r=!0){if(t instanceof vC){let{pageWidth:r,pageHeight:i}=t.rawDims,{style:a}=e,o=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-x))`,s=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-y))`;!n||t.rotation%180==0?(a.width=o,a.height=s):(a.width=s,a.height=o)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}var VC=class e{constructor(){let{pixelRatio:t}=e;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,n,r,i,a=-1){let o=1/0,s=1/0,c=1/0;r=e.capPixels(r,a),r>0&&(o=Math.sqrt(r/(t*n))),i!==-1&&(s=i/t,c=i/n);let l=Math.min(o,s,c);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},HC=[`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`],UC=class{static get isDarkMode(){return X(this,`isDarkMode`,!!window?.matchMedia?.(`(prefers-color-scheme: dark)`).matches)}},WC=class{static get commentForegroundColor(){let e=document.createElement(`span`);e.classList.add(`comment`,`sidebar`);let{style:t}=e;t.width=t.height=`0`,t.display=`none`,t.color=`var(--comment-fg-color)`,document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),X(this,`commentForegroundColor`,IC(n))}};function GC(e,t){t=_C(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function KC(e,t){let n=e[0]/255,r=e[1]/255,i=e[2]/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)t[0]=t[1]=0;else{let e=a-o;switch(t[1]=s<.5?e/(a+o):e/(2-a-o),a){case n:t[0]=((r-i)/e+(r<i?6:0))*60;break;case r:t[0]=((i-n)/e+2)*60;break;case i:t[0]=((n-r)/e+4)*60}}t[2]=s}function qC(e,t){let n=e[0],r=e[1],i=e[2],a=(1-Math.abs(2*i-1))*r,o=a*(1-Math.abs(n/60%2-1)),s=i-a/2;switch(Math.floor(n/60)){case 0:t[0]=a+s,t[1]=o+s,t[2]=s;break;case 1:t[0]=o+s,t[1]=a+s,t[2]=s;break;case 2:t[0]=s,t[1]=a+s,t[2]=o+s;break;case 3:t[0]=s,t[1]=o+s,t[2]=a+s;break;case 4:t[0]=o+s,t[1]=s,t[2]=a+s;break;case 5:case 6:t[0]=a+s,t[1]=s,t[2]=o+s}}function JC(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function YC(e,t,n){qC(e,n),n.map(JC);let r=.2126*n[0]+.7152*n[1]+.0722*n[2];qC(t,n),n.map(JC);let i=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)}var XC=new Map;function ZC(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=XC.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);KC(e,o);let s=i.subarray(6,9);KC(t,s);let c=s[2]<.5,l=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),YC(o,s,a)<l){let e,t;for(c?(e=o[2],t=1):(e=0,t=o[2]);t-e>.005;){let n=o[2]=(e+t)/2;c===YC(o,s,a)<l?e=n:t=n}o[2]=c?t:e}return qC(o,a),r=Z.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),XC.set(n,r),r}function QC({html:e,dir:t,className:n},r){let i=document.createDocumentFragment();if(typeof e==`string`){let n=document.createElement(`p`);n.dir=t||`auto`;let r=e.split(/\r\n?|\n/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}i.append(n)}else SC.render({xfaHtml:e,div:i,intent:`richText`});i.firstElementChild.classList.add(`richText`,n),r.append(i)}function $C(e){let t=new Path2D;if(!e)return t;for(let n=0,r=e.length;n<r;)switch(e[n++]){case RS.moveTo:t.moveTo(e[n++],e[n++]);break;case RS.lineTo:t.lineTo(e[n++],e[n++]);break;case RS.curveTo:t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);break;case RS.quadraticCurveTo:t.quadraticCurveTo(e[n++],e[n++],e[n++],e[n++]);break;case RS.closePath:t.closePath();break;default:WS(`Unrecognized drawing path operator: ${e[n-1]}`)}return t}var ew=class e{#e=null;#t=null;#n;#r=null;#i=null;#a=null;#o=null;#s=null;static#c=null;constructor(t){this.#n=t,e.#c||=Object.freeze({freetext:`pdfjs-editor-remove-freetext-button`,highlight:`pdfjs-editor-remove-highlight-button`,ink:`pdfjs-editor-remove-ink-button`,stamp:`pdfjs-editor-remove-stamp-button`,signature:`pdfjs-editor-remove-signature-button`})}render(){let t=this.#e=document.createElement(`div`);t.classList.add(`editToolbar`,`hidden`),t.setAttribute(`role`,`toolbar`);let n=this.#n._uiManager._signal;n instanceof AbortSignal&&!n.aborted&&(t.addEventListener(`contextmenu`,MC,{signal:n}),t.addEventListener(`pointerdown`,e.#l,{signal:n}));let r=this.#r=document.createElement(`div`);r.className=`buttons`,t.append(r);let i=this.#n.toolbarPosition;if(i){let{style:e}=t;e.insetInlineEnd=`${100*(this.#n._uiManager.direction===`ltr`?1-i[0]:i[0])}%`,e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#e}static#l(e){e.stopPropagation()}#u(e){this.#n._focusEventsAllowed=!1,NC(e)}#d(e){this.#n._focusEventsAllowed=!0,NC(e)}#f(e){let t=this.#n._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener(`focusin`,this.#u.bind(this),{capture:!0,signal:t}),e.addEventListener(`focusout`,this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener(`contextmenu`,MC,{signal:t}),!0)}hide(){this.#e.classList.add(`hidden`),this.#t?.hideDropdown()}show(){this.#e.classList.remove(`hidden`),this.#i?.shown(),this.#a?.shown()}addDeleteButton(){let{editorType:t,_uiManager:n}=this.#n,r=document.createElement(`button`);r.classList.add(`basic`,`deleteButton`),r.tabIndex=0,r.setAttribute(`data-l10n-id`,e.#c[t]),this.#f(r)&&r.addEventListener(`click`,e=>{n.delete()},{signal:n._signal}),this.#r.append(r)}get#p(){let e=document.createElement(`div`);return e.className=`divider`,e}async addAltText(e){let t=await e.render();this.#f(t),this.#r.append(t,this.#p),this.#i=e}addComment(e,t=null){if(this.#a)return;let n=e.renderForToolbar();if(!n)return;this.#f(n);let r=this.#o=this.#p;t?(this.#r.insertBefore(n,t),this.#r.insertBefore(r,t)):this.#r.append(n,r),this.#a=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let t=e.renderButton();this.#f(t),this.#r.append(t,this.#p)}async addEditSignatureButton(e){let t=this.#s=await e.renderEditButton(this.#n);this.#f(t),this.#r.append(t,this.#p)}removeButton(e){e===`comment`&&(this.#a?.removeToolbarCommentButton(),this.#a=null,this.#o?.remove(),this.#o=null)}async addButton(e,t){switch(e){case`colorPicker`:t&&this.addColorPicker(t);break;case`altText`:t&&await this.addAltText(t);break;case`editSignature`:t&&await this.addEditSignatureButton(t);break;case`delete`:this.addDeleteButton();break;case`comment`:t&&this.addComment(t)}}async addButtonBefore(e,t,n){if(!t&&e===`comment`)return;let r=this.#r.querySelector(n);r&&e===`comment`&&this.addComment(t,r)}updateEditSignatureButton(e){this.#s&&(this.#s.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}},tw=class{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){let e=this.#t=document.createElement(`div`);e.className=`editToolbar`,e.setAttribute(`role`,`toolbar`),e.dir=this.#n.direction;let t=this.#n._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener(`contextmenu`,MC,{signal:t});let n=this.#e=document.createElement(`div`);return n.className=`buttons`,e.append(n),this.#n.hasCommentManager()&&this.#a(`commentButton`,`pdfjs-comment-floating-button`,`pdfjs-comment-floating-button-label`,()=>{this.#n.commentSelection(`floating_button`)}),this.#a(`highlightButton`,`pdfjs-highlight-floating-button1`,`pdfjs-highlight-floating-button-label`,()=>{this.#n.highlightSelection(`floating_button`)}),e}#i(e,t){let n=0,r=0;for(let i of e){let e=i.y+i.height;if(e<n)continue;let a=i.x+(t?i.width:0);if(e>n){r=a,n=e;continue}t?a>r&&(r=a):a<r&&(r=a)}return[t?1-r:r,n]}show(e,t,n){let[r,i]=this.#i(t,n),{style:a}=this.#t||=this.#r();e.append(this.#t),a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#a(e,t,n,r){let i=document.createElement(`button`);i.classList.add(`basic`,e),i.tabIndex=0,i.setAttribute(`data-l10n-id`,t);let a=document.createElement(`span`);i.append(a),a.className=`visuallyHidden`,a.setAttribute(`data-l10n-id`,n);let o=this.#n._signal;o instanceof AbortSignal&&!o.aborted&&(i.addEventListener(`contextmenu`,MC,{signal:o}),i.addEventListener(`click`,r,{signal:o})),this.#e.append(i)}},nw=Object.freeze({internal:`59968104-cc61-4cf9-b570-014b35b3709c`});function rw(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}var iw=class e{static#e=NaN;static#t=null;static#n=NaN;static#r=null;static initializeAndAddPointerId(t){(e.#t||=new Set).add(t)}static setPointer(t,n){e.#e||=n,e.#r??=t}static setTimeStamp(t){e.#n=t}static isSamePointerId(t){return e.#e===t}static isSamePointerIdOrRemove(t){return e.#e===t||(e.#t?.delete(t),!1)}static isSamePointerType(t){return e.#r===t}static isInitializedAndDifferentPointerType(t){return e.#r!==null&&!e.isSamePointerType(t)}static isSameTimeStamp(t){return e.#n===t}static isUsingMultiplePointers(){return e.#t?.size>=1}static clearPointerType(){e.#r=null}static clearPointerIds(){e.#e=NaN,e.#t=null}static clearTimeStamp(){e.#n=NaN}},aw=class{#e=0;get id(){return`${OS}${this.#e++}`}},ow=class e{#e=dC();#t=0;#n=null;static get _isSVGFittingCanvas(){let e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${wS}"><rect width="1" height="1" style="fill:red;"/></svg>`,t=new OffscreenCanvas(1,3).getContext(`2d`,{willReadFrequently:!0}),n=new Image;n.src=e;let r=n.decode().then(()=>(t.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return X(this,`_isSVGFittingCanvas`,r)}async#r(t,n){this.#n||=new Map;let r=this.#n.get(t);if(r===null)return null;if(r?.bitmap)return r.refCounter+=1,r;try{r||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let t;if(typeof n==`string`?(r.url=n,t=await wC(n,`blob`)):n instanceof File?t=r.file=n:n instanceof Blob&&(t=n),t.type===`image/svg+xml`){let n=e._isSVGFittingCanvas,i=new FileReader,a=new Image,o=new Promise((e,t)=>{a.onload=()=>{r.bitmap=a,r.isSvg=!0,e()},i.onload=async()=>{let e=r.svgUrl=i.result;a.src=await n?`${e}#svgView(preserveAspectRatio(none))`:e},a.onerror=i.onerror=t});i.readAsDataURL(t),await o}else r.bitmap=await createImageBitmap(t);r.refCounter=1}catch(e){WS(e),r=null}return this.#n.set(t,r),r&&this.#n.set(r.id,r),r}async getFromFile(e){let{lastModified:t,name:n,size:r,type:i}=e;return this.#r(`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,t){let n=await t;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;let r=new OffscreenCanvas(t.width,t.height);return r.getContext(`2d`).drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t||(--t.refCounter,t.refCounter!==0))return;let{bitmap:n}=t;if(!t.url&&!t.file){let e=new OffscreenCanvas(n.width,n.height);e.getContext(`bitmaprenderer`).transferFromImageBitmap(n),t.blobPromise=e.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}},sw=class{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(r&&e(),this.#t)return;let s={cmd:e,undo:t,post:n,type:i};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(s);return}if(a&&this.#e[this.#r].type===i){o&&(s.undo=this.#e[this.#r].undo),this.#e[this.#r]=s;return}let c=this.#r+1;c===this.#n?this.#e.splice(0,1):(this.#r=c,c<this.#e.length&&this.#e.splice(c)),this.#e.push(s)}undo(){if(this.#r===-1)return;this.#t=!0;let{undo:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1,--this.#r}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;let{cmd:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let t=this.#r;t>=0;t--)if(this.#e[t].type!==e){this.#e.splice(t+1,this.#r-t),this.#r=t;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}},cw=class e{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:n}=oC.platform;for(let[r,i,a={}]of t){let t=r.some(e=>e.startsWith(`mac+`));for(let o of r){let r=o;if(t){let e=o.startsWith(`mac+`);if(n!==e)continue;e&&(r=o.slice(4))}let[s,c]=e.#e(r);s!==null&&this.callbacks.getOrInsertComputed(s,pC).push({callback:i,options:a,modifiers:c})}}}static#e(t){let n=null,r=0;for(let i of t.split(`+`)){if(i=i.trim(),!i)continue;let a=i.toUpperCase(),o=e[a];if(o){r|=o;continue}if(n!==null){WS(`KeyboardManager: multiple keys in shortcut "${t}"`);break}n=a===`SPACE`?` `:i}return n===null&&WS(`KeyboardManager: no key found in shortcut "${t}"`),[n,r]}static#t(e){let t=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);return t?t[1]?.toLowerCase()??t[2]:null}exec(t,n){let r=this.callbacks.get(n.key);if(!r){if(/^[a-z]$/i.test(n.key))return;let t=e.#t(n.code);if(t===null||t===n.key||(r=this.callbacks.get(t),!r))return}let i=(n.altKey?e.ALT:0)|(n.ctrlKey?e.CTRL:0)|(n.metaKey?e.META:0)|(n.shiftKey?e.SHIFT:0),a=r.find(e=>e.modifiers===i);if(!a)return;let{callback:o,options:{bubbles:s=!1,args:c=[],checker:l=null}}=a;(!l||l(t,n))&&(o.bind(t,...c,n)(),s||NC(n))}},lw=class e{static _colorsMapping=new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]);get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return LC(e),X(this,`_colors`,e)}convert(t){let n=IC(t);if(!window.matchMedia(`(forced-colors: active)`).matches)return n;for(let[t,r]of this._colors)if(r.every((e,t)=>e===n[t]))return e._colorsMapping.get(t);return n}getHexCode(e){let t=this._colors.get(e);return t?Z.makeHexColor(...t):e}},uw=class e{#e=new AbortController;#t=null;#n=null;#r=new Map;#i=new Map;#a=null;#o=null;#s=null;#c=null;#l=null;#u=new sw;#d=null;#f=null;#p=null;#m=0;#h=new Set;#g=null;#_=null;#v=new Set;_editorUndoBar=null;#y=!1;#b=!1;#x=!1;#S=null;#C=null;#w=null;#T=null;#E=!1;#D=null;#O=new aw;#k=!1;#A=!1;#j=!1;#M=null;#N=null;#P=null;#F=null;#I=null;#L=kS.NONE;#R=new Set;#z=null;#B=null;#V=null;#H=null;#U=null;#W={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#G=[0,0];#K=null;#q=null;#J=null;#Y=null;#X=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.#q.contains(document.activeElement)&&document.activeElement.tagName!==`BUTTON`&&e.hasSomethingToControl(),r=(e,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!==`text`&&e!==`number`}return!0},i=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return X(this,`_keyboardManager`,new cw([[[`ctrl+a`,`mac+meta+a`],t.selectAll,{checker:r}],[[`ctrl+z`,`mac+meta+z`],t.undo,{checker:r}],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],t.redo,{checker:r}],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],t.delete,{checker:r}],[[`Enter`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#q.contains(t)&&!e.isEnterHandled}],[[`Space`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#q.contains(document.activeElement)}],[[`Escape`],t.unselectAll],[[`ArrowLeft`],t.translateSelectedEditors,{args:[-i,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t.translateSelectedEditors,{args:[-a,0],checker:n}],[[`ArrowRight`],t.translateSelectedEditors,{args:[i,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t.translateSelectedEditors,{args:[a,0],checker:n}],[[`ArrowUp`],t.translateSelectedEditors,{args:[0,-i],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t.translateSelectedEditors,{args:[0,-a],checker:n}],[[`ArrowDown`],t.translateSelectedEditors,{args:[0,i],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t.translateSelectedEditors,{args:[0,a],checker:n}]]))}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this._signal=this.#e.signal;this.#q=e,this.#J=t,this.#Y=n,this.#s=r,this.#d=i,this.#B=a,this.#U=s,this._eventBus=o;let _={signal:g,...nw};o.on(`editingaction`,this.onEditingAction.bind(this),_),o.on(`pagechanging`,this.onPageChanging.bind(this),_),o.on(`scalechanging`,this.onScaleChanging.bind(this),_),o.on(`rotationchanging`,this.onRotationChanging.bind(this),_),o.on(`setpreference`,this.onSetPreference.bind(this),_),o.on(`switchannotationeditorparams`,e=>this.updateParams(e.type,e.value),_),window.addEventListener(`pointerdown`,()=>{this.#A=!0},{capture:!0,signal:g}),window.addEventListener(`pointerup`,()=>{this.#A=!1},{capture:!0,signal:g}),window.addEventListener(`beforeunload`,this.endCurrentEditing.bind(this),{capture:!0,signal:g}),this.#ne(),this.#le(),this.#ae(),this.#c=s.annotationStorage,this.#S=s.filterFactory,this.#V=c,this.#T=l||null,this.#y=u,this.#b=d,this.#x=f,this.#I=p||null,this.viewParameters={realScale:CC.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=h!==!1,i?.setSidebarUiManager(this)}destroy(){this.#X?.resolve(),this.#X=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#i.values())e.destroy();this.#i.clear(),this.#r.clear(),this.#v.clear(),this.#F?.clear(),this.#t=null,this.#R.clear(),this.#u.destroy(),this.#s?.destroy(),this.#d?.destroy(),this.#B?.destroy(),this.#D?.hide(),this.#D=null,this.#P?.destroy(),this.#P=null,this.#n=null,this.#C&&=(clearTimeout(this.#C),null),this.#K&&=(clearTimeout(this.#K),null),this._editorUndoBar?.destroy(),this.#U=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#I}get useNewAltTextFlow(){return this.#b}get useNewAltTextWhenAddingImage(){return this.#x}get hcmFilter(){return X(this,`hcmFilter`,this.#V?this.#S.addHCMFilter(this.#V.foreground,this.#V.background):`none`)}get direction(){return X(this,`direction`,getComputedStyle(this.#q).direction)}get _highlightColors(){return X(this,`_highlightColors`,this.#T?new Map(this.#T.split(`,`).map(e=>(e=e.split(`=`).map(e=>e.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return X(this,`highlightColors`,null);let t=new Map,n=!!this.#V;for(let[r,i]of e){let e=r.endsWith(`_HCM`);if(n&&e){t.set(r.replace(`_HCM`,``),i);continue}!n&&!e&&t.set(r,i)}return X(this,`highlightColors`,t)}get highlightColorNames(){return X(this,`highlightColorNames`,this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#p=e}setMainHighlightColorPicker(e){this.#P=e}editAltText(e,t=!1){this.#s?.editAltText(this,e,t)}hasCommentManager(){return!!this.#d}editComment(e,t,n,r){this.#d?.showDialog(this,e,t,n,r)}selectComment(e,t){(this.#i.get(e)?.getEditorByUID(t))?.toggleComment(!0,!0)}updateComment(e){this.#d?.updateComment(e.getData())}updatePopupColor(e){this.#d?.updatePopupColor(e)}removeComment(e){this.#d?.removeComments([e.uid])}deleteComment(e,t){let n=()=>{e.comment=t};this.addCommands({cmd:()=>{this._editorUndoBar?.show(n,`comment`),this.toggleComment(null),e.comment=null},undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){this.#d?.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){return e&&this.#d?.makeCommentColor(e,t)||null}getCommentDialogElement(){return this.#d?.dialogElement||null}async waitForEditorsRendered(e){if(this.#i.has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),r=n=>{n.pageNumber===e&&(this._eventBus.off(`editorsrendered`,r),t())};this._eventBus.on(`editorsrendered`,r,nw),await n}getSignature(e){this.#B?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#B}switchToMode(e,t){this._eventBus.on(`annotationeditormodechanged`,t,{once:!0,signal:this._signal,...nw}),this._eventBus.dispatch(`showannotationeditorui`,{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch(`setpreference`,{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){e===`enableNewAltTextWhenAddingImage`&&(this.#x=t)}onPageChanging({pageNumber:e}){this.#m=e-1}deletePage(e){for(let t of this.getEditors(e))t.remove();this.#i.delete(e),this.#m===e&&(this.#m=0)}focusMainContainer(){this.#q.focus()}findParent(e,t){for(let n of this.#i.values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){this.#J.classList.toggle(`noUserSelect`,e)}addShouldRescale(e){this.#v.add(e)}removeShouldRescale(e){this.#v.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*CC.PDF_TO_CSS_UNITS;for(let e of this.#v)e.onScaleChanging();this.#p?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#Z({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Q(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let t of this.#i.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=``,t=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=n,s=n.toString(),c=this.#Z(n).closest(`.textLayer`),l=this.getSelectionBoxes(c);if(!l)return;n.empty();let u=this.#Q(c),d=this.#L===kS.NONE,f=()=>{let n=u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o,text:s});d&&this.showAllEditors(`highlight`,!0,!0),t&&n?.editComment()};if(d){this.switchToMode(kS.HIGHLIGHT,f);return}f()}commentSelection(e=``){this.highlightSelection(e,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#$(){let e=document.getSelection();if(!e||e.isCollapsed)return;let t=this.#Z(e).closest(`.textLayer`),n=this.getSelectionBoxes(t);n&&(this.#D||=new tw(this),this.#D.show(t,n,this.direction===`ltr`))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#c)return null;let t=`${OS}${e}`,n=this.#c.getRawValue(t);return n&&this.#c.remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&this.#c&&!this.#c.has(e.id)&&this.#c.setValue(e.id,e)}a11yAlert(e,t=null){let n=this.#Y;n&&(n.setAttribute(`data-l10n-id`,e),t?n.setAttribute(`data-l10n-args`,JSON.stringify(t)):n.removeAttribute(`data-l10n-args`))}#ee(){let e=document.getSelection();if(!e||e.isCollapsed){this.#z&&(this.#D?.hide(),this.#z=null,this.#ue({hasSelectedText:!1}));return}let{anchorNode:t}=e;if(t===this.#z)return;let n=this.#Z(e).closest(`.textLayer`);if(!n){this.#z&&(this.#D?.hide(),this.#z=null,this.#ue({hasSelectedText:!1}));return}if(this.#D?.hide(),this.#z=t,this.#ue({hasSelectedText:!0}),(this.#L===kS.HIGHLIGHT||this.#L===kS.NONE)&&(this.#L===kS.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),this.#E=this.isShiftKeyDown,!this.isShiftKeyDown)){let e=this.#L===kS.HIGHLIGHT?this.#Q(n):null;if(e?.toggleDrawing(),this.#A){let t=new AbortController,n=this.combinedSignal(t),r=n=>{(n.type!==`pointerup`||n.button===0)&&(t.abort(),e?.toggleDrawing(!0),n.type===`pointerup`&&this.#te(`main_toolbar`))};window.addEventListener(`pointerup`,r,{signal:n}),window.addEventListener(`blur`,r,{signal:n})}else e?.toggleDrawing(!0),this.#te(`main_toolbar`)}}#te(e=``){this.#L===kS.HIGHLIGHT?this.highlightSelection(e):this.#y&&this.#$()}#ne(){document.addEventListener(`selectionchange`,this.#ee.bind(this),{signal:this._signal})}#re(){if(this.#w)return;this.#w=new AbortController;let e=this.combinedSignal(this.#w);window.addEventListener(`focus`,this.focus.bind(this),{signal:e}),window.addEventListener(`blur`,this.blur.bind(this),{signal:e})}#ie(){this.#w?.abort(),this.#w=null}blur(){if(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#te(`main_toolbar`)),!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#R)if(t.div.contains(e)){this.#N=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#N)return;let[e,t]=this.#N;this.#N=null,t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}#ae(){if(this.#M)return;this.#M=new AbortController;let e=this.combinedSignal(this.#M);window.addEventListener(`keydown`,this.keydown.bind(this),{signal:e}),window.addEventListener(`keyup`,this.keyup.bind(this),{signal:e})}#oe(){this.#M?.abort(),this.#M=null}#se(){if(this.#f)return;this.#f=new AbortController;let e=this.combinedSignal(this.#f);document.addEventListener(`copy`,this.copy.bind(this),{signal:e}),document.addEventListener(`cut`,this.cut.bind(this),{signal:e}),document.addEventListener(`paste`,this.paste.bind(this),{signal:e})}#ce(){this.#f?.abort(),this.#f=null}#le(){let e=this._signal;document.addEventListener(`dragover`,this.dragOver.bind(this),{signal:e}),document.addEventListener(`drop`,this.drop.bind(this),{signal:e})}addEditListeners(){this.#ae(),this.setEditingState(!0)}removeEditListeners(){this.#oe(),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of this.#_)if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect=`copy`,e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of this.#_)if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let e of this.#R){let n=e.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of this.#_)if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let n=t.getData(`application/pdfjs`);if(!n)return;try{n=JSON.parse(n)}catch(e){WS(`paste: "${e.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let r=this.currentLayer;try{let e=[];for(let t of n){let n=await r.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)this.#me(t);this.#_e(e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){WS(`paste: "${e.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key===`Shift`&&(this.isShiftKeyDown=!0),this.#L!==kS.NONE&&!this.isEditorHandlingKeyboard&&e._keyboardManager.exec(this,t)}keyup(e){this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#te(`main_toolbar`)))}onEditingAction({name:e}){switch(e){case`undo`:case`redo`:case`delete`:case`selectAll`:this[e]();break;case`highlightSelection`:this.highlightSelection(`context_menu`);break;case`commentSelection`:this.commentSelection(`context_menu`)}}updatePageIndex(e,t){for(let n of this.#o.get(e)||[])n.pageIndex=t;let n=this.#a.get(e);n&&(n.pageIndex=t,this.#i.set(t,n),this.#k?n.enable():n.disable())}startUpdatePages(){this.#a=new Map(this.#i),this.#i.clear();let e=this.#o=new Map,t=t=>{e.getOrInsertComputed(t.pageIndex,pC).push(t)};for(let e of this.#r.values())t(e);for(let[e,n]of this.#c)e.startsWith(OS)&&!this.#r.has(e)&&Number.isInteger(n?.pageIndex)&&t(n)}endUpdatePages(){this.#a=null,this.#o=null}clonePage(e,t){for(let n of this.getEditors(e)){let e=n.serialize(n.mode!==kS.HIGHLIGHT);e&&(e.pageIndex=t,e.id=this.getId(),e.isClone=!0,delete e.popupRef,this.#c.setValue(e.id,e))}}findClonesForPage(e){let t=[],{pageIndex:n}=e;for(let[r,i]of this.#c)i.pageIndex===n&&i.isClone&&(this.#c.remove(r),t.push(e.deserialize(i).then(t=>{t&&(t.isClone=!0,e.addOrRebuild(t))})));return Promise.all(t)}#ue(e){Object.entries(e).some(([e,t])=>this.#W[e]!==t)&&(this._eventBus.dispatch(`editingstateschanged`,{source:this,details:Object.assign(this.#W,e)}),this.#L===kS.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#de([[AS.HIGHLIGHT_FREE,!0]]))}#de(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}setEditingState(e){e?(this.#re(),this.#se(),this.#ue({isEditing:this.#L!==kS.NONE,isEmpty:this.#ge(),hasSomethingToUndo:this.#u.hasSomethingToUndo(),hasSomethingToRedo:this.#u.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ie(),this.#ce(),this.#ue({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#_){this.#_=e;for(let e of this.#_)this.#de(e.defaultPropertiesToUpdate)}}getId(){return this.#O.id}get currentLayer(){return this.#i.get(this.#m)}getLayer(e){return this.#i.get(e)}get currentPageIndex(){return this.#m}addLayer(e){this.#i.set(e.pageIndex,e),this.#k?e.enable():e.disable()}removeLayer(e){this.#i.delete(e.pageIndex)}async updateMode(e,t=null,n=!1,r=!1,i=!1,a=!1){if(this.#L!==e&&!(this.#X&&(await this.#X.promise,!this.#X))){if(this.#X=Promise.withResolvers(),this.#p?.commitOrRemove(),this.#L===kS.POPUP&&this.#d?.hideSidebar(),this.#d?.destroyPopup(),this.#L=e,e===kS.NONE){this.setEditingState(!1),this.#pe();for(let e of this.#r.values())e.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#X.resolve();return}for(let e of this.#r.values())e.addStandaloneCommentButton();e===kS.SIGNATURE&&await this.#B?.loadSignatures(),n&&iw.clearPointerType(),this.setEditingState(!0),await this.#fe(),this.unselectAll();for(let t of this.#i.values())t.updateMode(e);if(e===kS.POPUP){this.#n||=await this.#U.getAnnotationsByType(new Set(this.#_.map(e=>e._editorType)));let e=new Set,t=[];for(let n of this.#r.values()){let{annotationElementId:r,hasComment:i,deleted:a}=n;r&&e.add(r),i&&!a&&t.push(n.getData())}for(let n of this.#n){let{id:r,popupRef:i,contentsObj:a}=n;i&&a?.str&&!e.has(r)&&!this.#h.has(r)&&t.push(n)}this.#d?.showSidebar(t)}if(!t){r&&this.addNewEditorFromKeyboard(),this.#X.resolve();return}for(let e of this.#r.values())e.uid===t?(this.setSelected(e),a?e.editComment():i?e.enterInEditMode():e.focus()):e.unselect();this.#X.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#L&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,...e})}updateParams(e,t){if(this.#_){switch(e){case AS.CREATE:this.currentLayer.addNewEditor(t);return;case AS.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:{type:`highlight`,action:`toggle_visibility`}}}),(this.#H||=new Map).set(e,t),this.showAllEditors(`highlight`,t)}if(this.hasSelection)for(let n of this.#R)n.updateParams(e,t);else for(let n of this.#_)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(let n of this.#r.values())n.editorType===e&&n.show(t);(this.#H?.get(AS.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#de([[AS.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#j!==e){this.#j=e;for(let t of this.#i.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}async#fe(){if(!this.#k){this.#k=!0;let e=[];for(let t of this.#i.values())e.push(t.enable());await Promise.all(e);for(let e of this.#r.values())e.enable()}}#pe(){if(this.unselectAll(),this.#k){this.#k=!1;for(let e of this.#i.values())e.disable();for(let e of this.#r.values())e.disable()}}*getEditors(e){for(let t of this.#r.values())t.pageIndex===e&&(yield t)}getEditor(e){return this.#r.get(e)}addEditor(e){this.#r.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#C&&clearTimeout(this.#C),this.#C=setTimeout(()=>{this.focusMainContainer(),this.#C=null},0)),this.#r.delete(e.id),e.annotationElementId&&this.#F?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#h.has(e.annotationElementId))&&this.#c?.remove(e.id)}addDeletedAnnotationElement(e){this.#h.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#h.has(e)}removeDeletedAnnotationElement(e){this.#h.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#me(e){let t=this.#i.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#de(e.propertiesToUpdate))}get#he(){let e=null;for(e of this.#R);return e}updateUI(e){this.#he===e&&this.#de(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#de(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#R.has(e)){this.#R.delete(e),e.unselect(),this.#ue({hasSelectedEditor:this.hasSelection});return}this.#R.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#p?.commitOrRemove();for(let t of this.#R)t!==e&&t.unselect();this.#d?.destroyPopup(),this.#R.clear(),this.#R.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#R.values().next().value}unselect(e){e.unselect(),this.#R.delete(e),this.#ue({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#R.size!==0}get isEnterHandled(){return this.#R.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#u.undo(),this.#ue({hasSomethingToUndo:this.#u.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#ge()}),this._editorUndoBar?.hide()}redo(){this.#u.redo(),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:this.#u.hasSomethingToRedo(),isEmpty:this.#ge()})}addCommands(e){this.#u.add(e),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#ge()})}cleanUndoStack(e){this.#u.cleanType(e)}#ge(){if(this.#r.size===0)return!0;if(this.#r.size===1)for(let e of this.#r.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let t=e?[e]:[...this.#R],n=()=>{this._editorUndoBar?.show(r,t.length===1?t[0].editorType:t.length);for(let e of t)e.remove()},r=()=>{for(let e of t)this.#me(e)};this.addCommands({cmd:n,undo:r,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#_e(e){for(let e of this.#R)e.unselect();this.#R.clear();for(let t of e)t.isEmpty()||(this.#R.add(t),t.select());this.#ue({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#R)e.commit();this.#_e(this.#r.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#L!==kS.NONE))&&!this.#p?.commitOrRemove()&&(this.#d?.destroyPopup(),this.hasSelection)){for(let e of this.#R)e.unselect();this.#R.clear(),this.#ue({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#G[0]+=e,this.#G[1]+=t;let[r,i]=this.#G,a=[...this.#R];this.#K&&clearTimeout(this.#K),this.#K=setTimeout(()=>{this.#K=null,this.#G[0]=this.#G[1]=0,this.addCommands({cmd:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(r,i),e.translationDone())},undo:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(-r,-i),e.translationDone())},mustExec:!1})},1e3);for(let n of a)n.translateInPage(e,t),n.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#g=new Map;for(let e of this.#R)this.#g.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#g)return!1;this.disableUserSelect(!1);let e=this.#g;this.#g=null;let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex;if(!t)return!1;let n=(e,t,n,r)=>{if(this.#r.has(e.id)){let i=this.#i.get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#g)for(let n of this.#g.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#R.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#L}isEditingMode(){return this.#L!==kS.NONE}get imageManager(){return X(this,`imageManager`,new ow)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;let{x:n,y:r,width:i,height:a}=e.getBoundingClientRect(),o;switch(e.getAttribute(`data-main-rotation`)){case`90`:o=(e,t,o,s)=>({x:(t-r)/a,y:1-(e+o-n)/i,width:s/a,height:o/i});break;case`180`:o=(e,t,o,s)=>({x:1-(e+o-n)/i,y:1-(t+s-r)/a,width:o/i,height:s/a});break;case`270`:o=(e,t,o,s)=>({x:1-(t+s-r)/a,y:(e-n)/i,width:s/a,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-n)/i,y:(t-r)/a,width:o/i,height:s/a})}let s=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(!n.collapsed)for(let{x:e,y:t,width:r,height:i}of n.getClientRects())r!==0&&i!==0&&s.push(o(e,t,r,i))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#l||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#l?.delete(e)}renderAnnotationElement(e){let t=this.#l?.get(e.data.id);if(!t)return;let n=this.#c.getRawValue(t);n&&(this.#L!==kS.NONE||n.hasBeenModified)&&n.renderAnnotationElement(e)}setMissingCanvas(e,t,n){let r=this.#F?.get(e);r&&(r.setCanvas(t,n),this.#F.delete(e))}addMissingCanvas(e,t){(this.#F||=new Map).set(e,t)}},dw=class e{#e=null;#t=!1;#n=null;#r=null;#i=null;#a=null;#o=!1;#s=null;#c=null;#l=null;#u=null;#d=!1;static#f=null;static _l10n=null;constructor(t){this.#c=t,this.#d=t._uiManager.useNewAltTextFlow,e.#f||=Object.freeze({added:`pdfjs-editor-new-alt-text-added-button`,"added-label":`pdfjs-editor-new-alt-text-added-button-label`,missing:`pdfjs-editor-new-alt-text-missing-button`,"missing-label":`pdfjs-editor-new-alt-text-missing-button-label`,review:`pdfjs-editor-new-alt-text-to-review-button`,"review-label":`pdfjs-editor-new-alt-text-to-review-button-label`})}static initialize(t){e._l10n??=t}async render(){let t=this.#n=document.createElement(`button`);t.className=`altText`,t.tabIndex=`0`;let n=this.#r=document.createElement(`span`);t.append(n),this.#d?(t.classList.add(`new`),t.setAttribute(`data-l10n-id`,e.#f.missing),n.setAttribute(`data-l10n-id`,e.#f[`missing-label`])):(t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button`),n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button-label`));let r=this.#c._uiManager._signal;t.addEventListener(`contextmenu`,MC,{signal:r}),t.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:r});let i=e=>{e.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#d&&this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_clicked`,data:{label:this.#p}})};return t.addEventListener(`click`,i,{capture:!0,signal:r}),t.addEventListener(`keydown`,e=>{e.target===t&&e.key===`Enter`&&(this.#o=!0,i(e))},{signal:r}),await this.#m(),t}get#p(){return this.#e&&`added`||this.#e===null&&this.guessedText&&`review`||`missing`}finish(){this.#n&&(this.#n.focus({focusVisible:this.#o}),this.#o=!1)}isEmpty(){return this.#d?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#d?this.#e!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#e===null&&(this.#l=t,this.#u=await e._l10n.get(`pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer`,{generatedAltText:t}),this.#m())}toggleAltTextBadge(e=!1){if(!this.#d||this.#e){this.#s?.remove(),this.#s=null;return}if(!this.#s){let e=this.#s=document.createElement(`div`);e.className=`noAltTextBadge`,this.#c.div.append(e)}this.#s.classList.toggle(`hidden`,!e)}serialize(e){let t=this.#e;return!e&&this.#l===t&&(t=this.#u),{altText:t,decorative:this.#t,guessedText:this.#l,textWithDisclaimer:this.#u}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:i=!1}){n&&(this.#l=n,this.#u=r),(this.#e!==e||this.#t!==t)&&(i||(this.#e=e,this.#t=t),this.#m())}toggle(e=!1){this.#n&&(!e&&this.#a&&(clearTimeout(this.#a),this.#a=null),this.#n.disabled=!e)}shown(){this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_displayed`,data:{label:this.#p}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#i=null,this.#s?.remove(),this.#s=null}async#m(){let t=this.#n;if(!t)return;if(this.#d){if(t.classList.toggle(`done`,!!this.#e),t.setAttribute(`data-l10n-id`,e.#f[this.#p]),this.#r?.setAttribute(`data-l10n-id`,e.#f[`${this.#p}-label`]),!this.#e){this.#i?.remove();return}}else{if(!this.#e&&!this.#t){t.classList.remove(`done`),this.#i?.remove();return}t.classList.add(`done`),t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-edit-button`)}let n=this.#i;if(!n){this.#i=n=document.createElement(`span`),n.className=`tooltip`,n.setAttribute(`role`,`tooltip`),n.id=`alt-text-tooltip-${this.#c.id}`;let e=this.#c._uiManager._signal;e.addEventListener(`abort`,()=>{clearTimeout(this.#a),this.#a=null},{once:!0}),t.addEventListener(`mouseenter`,()=>{this.#a=setTimeout(()=>{this.#a=null,this.#i.classList.add(`show`),this.#c._reportTelemetry({action:`alt_text_tooltip`})},100)},{signal:e}),t.addEventListener(`mouseleave`,()=>{this.#a&&=(clearTimeout(this.#a),null),this.#i?.classList.remove(`show`)},{signal:e})}this.#t?n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-decorative-tooltip`):(n.removeAttribute(`data-l10n-id`),n.textContent=this.#e),n.parentNode||t.append(n),this.#c.getElementForAltText()?.setAttribute(`aria-describedby`,n.id)}},fw=class{#e=null;#t=null;#n=!1;#r=null;#i=null;#a=null;#o=null;#s=null;#c=!1;#l=null;constructor(e){this.#r=e}renderForToolbar(){let e=this.#t=document.createElement(`button`);return e.className=`comment`,this.#u(e,!1)}renderForStandalone(){let e=this.#e=document.createElement(`button`);e.className=`annotationCommentButton`;let t=this.#r.commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(this.#r._uiManager.direction===`ltr`?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let r=this.#r.commentButtonColor;r&&(n.backgroundColor=r)}return this.#u(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#r.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#r._uiManager.updatePopupColor(this.#r)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#r.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#e)return null;let{x:e,y:t,height:n}=this.#e.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#r.parent.boundingClientRect;return[(e-r)/a,(t+n-i)/o]}set commentPopupPositionInLayer(e){this.#l=e}hasDefaultPopupPosition(){return this.#l===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:t}){this.#e&&(this.#e.classList.toggle(`selected`,e),this.#e.ariaExpanded=t)}#u(e,t){if(!this.#r._uiManager.hasCommentManager())return null;e.tabIndex=`0`,e.ariaHasPopup=`dialog`,t?(e.ariaControls=`commentPopup`,e.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`)):(e.ariaControlsElements=[this.#r._uiManager.getCommentDialogElement()],e.setAttribute(`data-l10n-id`,`pdfjs-editor-add-comment-button`));let n=this.#r._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener(`contextmenu`,MC,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{this.#r._focusEventsAllowed=!1,NC(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{this.#r._focusEventsAllowed=!0,NC(e)},{capture:!0,signal:n})),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:n});let r=t=>{t.preventDefault(),e===this.#t?this.edit():this.#r.toggleComment(!0)};return e.addEventListener(`click`,r,{capture:!0,signal:n}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(this.#n=!0,r(t))},{signal:n}),e.addEventListener(`pointerenter`,()=>{this.#r.toggleComment(!1,!0)},{signal:n}),e.addEventListener(`pointerleave`,()=>{this.#r.toggleComment(!1,!1)},{signal:n}),e}edit(e){let t=this.commentPopupPositionInLayer,n,r;if(t)[n,r]=t;else{[n,r]=this.#r.commentButtonPosition;let{width:e,height:t,x:i,y:a}=this.#r;n=i+n*e,r=a+r*t}let i=this.#r.parent.boundingClientRect,{x:a,y:o,width:s,height:c}=i;this.#r._uiManager.editComment(this.#r,a+n*s,o+r*c,{...e,parentDimensions:i})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#n}),this.#n=!1)}isDeleted(){return this.#c||this.#o===``}isEmpty(){return this.#o===null}hasBeenEdited(){return this.isDeleted()||this.#o!==this.#i}serialize(){return this.data}get data(){return{text:this.#o,richText:this.#a,date:this.#s,deleted:this.isDeleted()}}set data(e){if(e!==this.#o&&(this.#a=null),e===null){this.#o=``,this.#c=!0;return}this.#o=e,this.#s=new Date,this.#c=!1}restoreData({text:e,richText:t,date:n}){this.#o=e,this.#a=t,this.#s=n,this.#c=!1}setInitialText(e,t=null){this.#i=e,this.data=e,this.#s=null,this.#a=t}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#o=``,this.#a=null,this.#s=null,this.#r=null,this.#n=!1,this.#c=!1}};function pw(e){e.preventDefault()}var mw=1e-4;function hw(e){return e.cancelable?(NC(e),!0):(e.stopPropagation(),!1)}var gw=class{#e;#t=!1;#n=null;#r;#i;#a;#o;#s;#c=!1;#l=null;#u;#d=new Set;#f=null;#p;#m=null;#h=0;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:i=null,onPinchEnd:a=null,onPanning:o=null,signal:s}){this.#e=e,this.#n=n,this.#r=t,this.#i=r,this.#a=i,this.#o=a,this.#s=o,this.#p=new AbortController,this.#u=AbortSignal.any([s,this.#p.signal]),e.addEventListener(`touchstart`,this.#g.bind(this),{passive:!1,signal:this.#u})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/VC.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/VC.pixelRatio}#g(e){if(this.#r?.())return;this.#v(e);let t=this.#d;for(let{identifier:n}of e.changedTouches)t.add(n);if(t.size===1){this.#_();return}if(!this.#m){this.#m=new AbortController;let e=AbortSignal.any([this.#u,this.#m.signal]),t=this.#e,n={signal:e,capture:!1,passive:!1};t.addEventListener(`touchmove`,this.#x.bind(this),n);let r=this.#S.bind(this);t.addEventListener(`touchend`,r,n),t.addEventListener(`touchcancel`,r,n),n.capture=!0,t.addEventListener(`pointerdown`,NC,n),t.addEventListener(`pointermove`,NC,n),t.addEventListener(`pointercancel`,pw,n),t.addEventListener(`pointerup`,pw,n),this.#i?.()}this.#c=hw(e),this.#b(e)}#_(){if(this.#l)return;let e=this.#l=new AbortController,t=AbortSignal.any([this.#u,e.signal]),n=this.#e,r={capture:!0,signal:t,passive:!1},i=e=>{e.pointerType===`touch`&&(this.#l?.abort(),this.#l=null)};n.addEventListener(`pointerdown`,e=>{e.pointerType===`touch`&&(NC(e),i(e))},r),n.addEventListener(`pointerup`,i,r),n.addEventListener(`pointercancel`,i,r)}#v(e){let t=this.#d;if(t.size===0)return;let n=this.#d=new Set;for(let{identifier:r}of e.touches)t.has(r)&&n.add(r)}#y(e){let t=this.#d,n=[];for(let r of e.touches)t.has(r.identifier)&&n.push(r);return n}#b(e){let t=this.#y(e);if(t.length!==2||this.#n?.()){this.#f=null;return}let[n,r]=t;this.#f={touch0X:n.screenX,touch0Y:n.screenY,touch1X:r.screenX,touch1Y:r.screenY,panX:(n.clientX+r.clientX)/2,panY:(n.clientY+r.clientY)/2,screenPanX:(n.screenX+r.screenX)/2,screenPanY:(n.screenY+r.screenY)/2}}#x(e){if(!this.#f)return;let t=this.#y(e);if(t.length!==2)return;let n=this.#c;if(this.#c=hw(e),!this.#c)return;if(!n){this.#b(e);return}let[r,i]=t,{screenX:a,screenY:o}=r,{screenX:s,screenY:c}=i,l=this.#f,{touch0X:u,touch0Y:d,touch1X:f,touch1Y:p,panX:m,panY:h}=l,g=f-u,_=p-d,v=s-a,y=c-o,b=(r.clientX+i.clientX)/2,x=(r.clientY+i.clientY)/2;l.panX=b,l.panY=x;let S=b-m,C=x-h,w=(a+s)/2,T=(o+c)/2,E=Math.hypot(w-l.screenPanX,T-l.screenPanY);l.screenPanX=w,l.screenPanY=T;let D=Math.hypot(v,y),O=Math.hypot(g,_),k=this.#t?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*E;if(D<mw||O<mw||Math.abs(O-D)<=k){(S||C)&&this.#s?.(S,C);return}l.touch0X=a,l.touch0Y=o,l.touch1X=s,l.touch1Y=c;let A=Math.sign(D-O);if(!this.#t){this.#t=!0,this.#h=A,(S||C)&&this.#s?.(S,C);return}if(this.#h){let e=this.#h;if(this.#h=0,A!==e&&Math.abs(D-O)<=2*E){this.#t=!1,(S||C)&&this.#s?.(S,C);return}}this.#a?.([m,h],O,D,S,C)}#S(e){if(this.#v(e),this.#d.size>=2){this.#b(e);return}let t=!!this.#f;this.#C(),this.#d.size===1&&this.#_(),t&&hw(e)}#C(){this.#f=null,this.#t=!1,this.#h=0,this.#c=!1,this.#m&&(this.#m.abort(),this.#m=null,this.#o?.())}destroy(){this.#C(),this.#d.clear(),this.#p?.abort(),this.#p=null,this.#l?.abort(),this.#l=null}},_w=class e{#e=null;#t=null;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=``;#c=null;#l=null;#u=null;#d=null;#f=null;#p=``;#m=!1;#h=null;#g=!1;#_=!1;#v=!1;#y=null;#b=0;#x=0;#S=null;#C=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#w=!1;#T=e._zIndex++;static _borderLineWidth=-1;static _colorManager=new lw;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=e.prototype._resizeWithKeyboard,n=uw.TRANSLATE_SMALL,r=uw.TRANSLATE_BIG;return X(this,`_resizerKeyboardManager`,new cw([[[`ArrowLeft`],t,{args:[-n,0]}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t,{args:[-r,0]}],[[`ArrowRight`],t,{args:[n,0]}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t,{args:[r,0]}],[[`ArrowUp`],t,{args:[0,-n]}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t,{args:[0,-r]}],[[`ArrowDown`],t,{args:[0,n]}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t,{args:[0,r]}],[[`Escape`],e.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[i,a];let[o,s]=this.parentDimensions;this.x=e.x/o,this.y=e.y/s,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return X(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new vw({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(t,n){if(e._l10n??=t,e._l10nAlert??=Object.freeze({highlight:`pdfjs-editor-highlight-added-alert`,freetext:`pdfjs-editor-freetext-added-alert`,ink:`pdfjs-editor-ink-added-alert`,stamp:`pdfjs-editor-stamp-added-alert`,signature:`pdfjs-editor-signature-added-alert`}),e._l10nResizer??=Object.freeze({topLeft:`pdfjs-editor-resizer-top-left`,topMiddle:`pdfjs-editor-resizer-top-middle`,topRight:`pdfjs-editor-resizer-top-right`,middleRight:`pdfjs-editor-resizer-middle-right`,bottomRight:`pdfjs-editor-resizer-bottom-right`,bottomMiddle:`pdfjs-editor-resizer-bottom-middle`,bottomLeft:`pdfjs-editor-resizer-bottom-left`,middleLeft:`pdfjs-editor-resizer-middle-left`}),e._borderLineWidth!==-1)return;let r=getComputedStyle(document.documentElement);e._borderLineWidth=parseFloat(r.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){GS(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#w}set _isDraggable(e){this.#w=e,this.div?.classList.toggle(`draggable`,e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#T}setParent(e){e===null?(this.#G(),this.#d?.remove(),this.#d=null):(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#m?this.#m=!1:this.parent.setSelected(this))}focusout(e){this._focusEventsAllowed&&this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}#E([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#E(this.parentDimensions,e,t)}translateInPage(e,t){this.#h||=[this.x,this.y,this.width,this.height],this.#E(this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){this.#h||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this,[s,c]=this.getBaseTranslation();a+=s,o+=c;let{style:l}=n;l.left=`${(100*a).toFixed(2)}%`,l.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o)}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#h&&(this.#h[0]!==this.x||this.#h[1]!==this.y)}get _hasBeenResized(){return!!this.#h&&(this.#h[2]!==this.width||this.#h[3]!==this.height)}getBaseTranslation(){let[t,n]=this.parentDimensions,{_borderLineWidth:r}=e,i=r/t,a=r/n;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,r]}=this,{x:i,y:a,width:o,height:s}=this;if(o*=n,s*=r,i*=n,a*=r,this._mustFixPosition)switch(e){case 0:i=_C(i,0,n-o),a=_C(a,0,r-s);break;case 90:i=_C(i,0,n-s),a=_C(a,o,r);break;case 180:i=_C(i,o,n),a=_C(a,s,r);break;case 270:i=_C(i,s,n),a=_C(a,0,r-o)}this.x=i/=n,this.y=a/=r;let[c,l]=this.getBaseTranslation();i+=c,a+=l,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}static#D(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(t,n){return e.#D(t,n,this.parentRotation)}pageTranslationToScreen(t,n){return e.#D(t,n,360-this.parentRotation)}#O(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#k(){if(this.#c)return;this.#c=document.createElement(`div`),this.#c.classList.add(`resizers`);let e=this._willKeepAspectRatio?[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`]:[`topLeft`,`topMiddle`,`topRight`,`middleRight`,`bottomRight`,`bottomMiddle`,`bottomLeft`,`middleLeft`],t=this._uiManager._signal;for(let n of e){let e=document.createElement(`div`);this.#c.append(e),e.classList.add(`resizer`,n),e.setAttribute(`data-resizer-name`,n),e.addEventListener(`pointerdown`,this.#A.bind(this,n),{signal:t}),e.addEventListener(`contextmenu`,MC,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#c)}#A(e,t){t.preventDefault();let{isMac:n}=oC.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#n?.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,this.#l=[t.screenX,t.screenY];let i=new AbortController,a=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener(`pointermove`,this.#N.bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener(`touchmove`,NC,{passive:!1,signal:a}),window.addEventListener(`contextmenu`,MC,{signal:a}),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let o=this.parent.div.style.cursor,s=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let c=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=o,this.div.style.cursor=s,this.#M()};window.addEventListener(`pointerup`,c,{signal:a}),window.addEventListener(`blur`,c,{signal:a})}#j(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#M(){if(!this.#u)return;let{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=this.#u;this.#u=null;let i=this.x,a=this.y,o=this.width,s=this.height;(i!==e||a!==t||o!==n||s!==r)&&this.addCommands({cmd:this.#j.bind(this,i,a,o,s),undo:this.#j.bind(this,e,t,n,r),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#N(t,n){let[r,i]=this.parentDimensions,a=this.x,o=this.y,s=this.width,c=this.height,l=e.MIN_SIZE/r,u=e.MIN_SIZE/i,d=this.#O(this.rotation),f=(e,t)=>[d[0]*e+d[2]*t,d[1]*e+d[3]*t],p=this.#O(360-this.rotation),m=(e,t)=>[p[0]*e+p[2]*t,p[1]*e+p[3]*t],h,g,_=!1,v=!1;switch(t){case`topLeft`:_=!0,h=(e,t)=>[0,0],g=(e,t)=>[e,t];break;case`topMiddle`:h=(e,t)=>[e/2,0],g=(e,t)=>[e/2,t];break;case`topRight`:_=!0,h=(e,t)=>[e,0],g=(e,t)=>[0,t];break;case`middleRight`:v=!0,h=(e,t)=>[e,t/2],g=(e,t)=>[0,t/2];break;case`bottomRight`:_=!0,h=(e,t)=>[e,t],g=(e,t)=>[0,0];break;case`bottomMiddle`:h=(e,t)=>[e/2,t],g=(e,t)=>[e/2,0];break;case`bottomLeft`:_=!0,h=(e,t)=>[0,t],g=(e,t)=>[e,0];break;case`middleLeft`:v=!0,h=(e,t)=>[0,t/2],g=(e,t)=>[e,t/2]}let y=h(s,c),b=g(s,c),x=f(...b),S=e._round(a+x[0]),C=e._round(o+x[1]),w=1,T=1,E,D;if(n.fromKeyboard)({deltaX:E,deltaY:D}=n);else{let{screenX:e,screenY:t}=n,[r,i]=this.#l;[E,D]=this.screenToPageTranslation(e-r,t-i),this.#l[0]=e,this.#l[1]=t}if([E,D]=m(E/r,D/i),_){let e=Math.hypot(s,c);w=T=Math.max(Math.min(Math.hypot(b[0]-y[0]-E,b[1]-y[1]-D)/e,1/s,1/c),l/s,u/c)}else v?w=_C(Math.abs(b[0]-y[0]-E),l,1)/s:T=_C(Math.abs(b[1]-y[1]-D),u,1)/c;let O=e._round(s*w),k=e._round(c*T);x=f(...g(O,k));let A=S-x[0],j=C-x[1];this.#h||=[this.x,this.y,this.width,this.height],this.width=O,this.height=k,this.x=A,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#_)return this._editToolbar;this._editToolbar=new ew(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton(`comment`,this.addCommentButton()),this._editToolbar.addButton(`delete`),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore(`comment`,this.addCommentButton(),`.deleteButton`)}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton(`comment`)}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){let t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#n||(dw.initialize(e._l10n),this.#n=new dw(this),this.#e&&=(this.#n.data=this.#e,null)),this.#n}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#r?.focusButton()}addCommentButton(){return this.canAddComment?this.#r||=new fw(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#i){this._uiManager.isEditingMode()&&this.#i.classList.remove(`hidden`);return}this.hasComment&&(this.#i=this.#r.renderForStandalone(),this.div.append(this.#i))}}removeStandaloneCommentButton(){this.#r.removeStandaloneCommentButton(),this.#i=null}hideStandaloneCommentButton(){this.#i?.classList.add(`hidden`)}get comment(){if(!this.#r)return null;let{data:{richText:e,text:t,date:n,deleted:r}}=this.#r;return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#r||=new fw(this),typeof e==`object`&&e?this.#r.restoreData(e):this.#r.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(this.#r||=new fw(this),this.#r.setInitialText(e,n),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){return this.#r?.hasBeenEdited()}get hasDeletedComment(){return this.#r?.isDeleted()}get hasComment(){return!!this.#r&&!this.#r.isEmpty()&&!this.#r.isDeleted()}async editComment(e){this.#r||=new fw(this),this.#r.edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){this.#r.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,t]=e.rect,[n]=this.pageDimensions,[r]=this.pageTranslation,i=r+n+1,a=t-100,o=i+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[i,a,o,t]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){this.#r.data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement(`div`);e.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),e.className=this.name,e.setAttribute(`id`,this.id),e.tabIndex=this.#a?-1:0,e.setAttribute(`role`,`application`),this.defaultL10nId&&e.setAttribute(`data-l10n-id`,this.defaultL10nId),this._isVisible||e.classList.add(`hidden`),this.setInForeground(),this.#z();let[t,n]=this.parentDimensions;this.parentRotation%180!=0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);let[r,i]=this.getInitialTranslation();return this.translate(r,i),rw(this,e,[`keydown`,`pointerdown`,`dblclick`]),this.#B(),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#P(){this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#F(t,n,r){let i=.7,a=r/n*i+1-i;if(a===1)return;let o=this.#O(this.rotation),s=(e,t)=>[o[0]*e+o[2]*t,o[1]*e+o[3]*t],[c,l]=this.parentDimensions,u=this.x,d=this.y,f=this.width,p=this.height,m=e.MIN_SIZE/c,h=e.MIN_SIZE/l;a=Math.max(Math.min(a,1/f,1/p),m/f,h/p);let g=e._round(f*a),_=e._round(p*a);if(g===f&&_===p)return;this.#h||=[u,d,f,p];let v=s(f/2,p/2),y=e._round(u+v[0]),b=e._round(d+v[1]),x=s(g/2,_/2);this.x=y-x[0],this.y=b-x[1],this.width=g,this.height=_,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#I(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#M()}pointerdown(e){let{isMac:t}=oC.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(this.#m=!0,this._isDraggable){this.#R(e);return}this.#L(e)}#L(e){let{isMac:t}=oC.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#R(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1,r=new AbortController,i=this._uiManager.combinedSignal(r),a={capture:!0,passive:!1,signal:i},o=e=>{r.abort(),this.#o=null,this.#m=!1,this._uiManager.endDragSession()||this.#L(e),n&&this._onStopDragging()};t&&(this.#b=e.clientX,this.#x=e.clientY,this.#o=e.pointerId,this.#s=e.pointerType,window.addEventListener(`pointermove`,e=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:t,clientY:r,pointerId:i}=e;if(i!==this.#o){NC(e);return}let[a,o]=this.screenToPageTranslation(t-this.#b,r-this.#x);this.#b=t,this.#x=r,this._uiManager.dragSelectedEditors(a,o),this.div.scrollIntoView({block:`nearest`})},a),window.addEventListener(`touchmove`,NC,a),window.addEventListener(`pointerdown`,e=>{e.pointerType===this.#s&&(this.#C||e.isPrimary)&&o(e),NC(e)},a));let s=e=>{if(!this.#o||this.#o===e.pointerId){o(e);return}NC(e)};window.addEventListener(`pointerup`,s,{signal:i}),window.addEventListener(`blur`,s,{signal:i})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let r=this.parentScale,[i,a]=this.pageDimensions,[o,s]=this.pageTranslation,c=e/r,l=t/r,u=this.x*i,d=this.y*a,f=this.width*i,p=this.height*a;switch(n){case 0:return[u+c+o,a-d-l-p+s,u+c+f+o,a-d-l+s];case 90:return[u+l+o,a-d+c+s,u+l+p+o,a-d+c+f+s];case 180:return[u-c-f+o,a-d+l+s,u-c+o,a-d+l+p+s];case 270:return[u-l-p+o,a-d-c-f+s,u-l+o,a-d-c+s];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&e._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#r?.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:a},uid:o,pageIndex:s,creationDate:c,modificationDate:l}=this;return{id:o,pageIndex:s,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:c,modificationDate:n||l,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),this.#_=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#_=!1,!0):!1}isInEditMode(){return this.#_}shouldGetKeyboardEvents(){return this.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:a}=window;return t<a&&r>0&&e<i&&n>0}#z(){if(this.#f||!this.div)return;this.#f=new AbortController;let e=this._uiManager.combinedSignal(this.#f);this.div.addEventListener(`focusin`,this.focusin.bind(this),{signal:e}),this.div.addEventListener(`focusout`,this.focusout.bind(this),{signal:e})}#B(){this.#C||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||(this.#C=new gw({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#P.bind(this),onPinching:this.#F.bind(this),onPinchEnd:this.#I.bind(this),signal:this._uiManager._signal}))}rebuild(){this.#z(),this.#B()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||``}}serialize(e=!1,t=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||``}}static async deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,r.#e=e.accessibilityData,r._isCopy=e.isCopy||!1;let[i,a]=r.pageDimensions,[o,s,c,l]=r.getRectInCurrentCoords(e.rect,a);return r.x=o/i,r.y=s/a,r.width=c/i,r.height=l/a,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.#C?.destroy(),this.#C=null,this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&=(clearTimeout(this.#y),null),this.#G(),this.removeEditToolbar(),this.#S){for(let e of this.#S.values())clearTimeout(e);this.#S=null}this.parent=null,this.#d?.remove(),this.#d=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#k(),this.#c.classList.remove(`hidden`))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction===`ltr`?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,n]}=this,[r,i,a,o]=this.getPDFRect();return[e._round(r+(a-r)*t),e._round(i+(o-i)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#r.commentPopupPositionInLayer}set commentPopupPosition(e){this.#r.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#r.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#r.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#r?.setCommentButtonStates(e)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!==`Enter`)return;this._uiManager.setSelected(this),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let n=this.#c.children;if(!this.#t){this.#t=Array.from(n);let t=this.#V.bind(this),r=this.#H.bind(this),i=this._uiManager._signal;for(let n of this.#t){let a=n.getAttribute(`data-resizer-name`);n.setAttribute(`role`,`spinbutton`),n.addEventListener(`keydown`,t,{signal:i}),n.addEventListener(`blur`,r,{signal:i}),n.addEventListener(`focus`,this.#U.bind(this,a),{signal:i}),n.setAttribute(`data-l10n-id`,e._l10nResizer[a])}}let r=this.#t[0],i=0;for(let e of n){if(e===r)break;i++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==i){if(a<i)for(let e=0;e<i-a;e++)this.#c.append(this.#c.firstElementChild);else if(a>i)for(let e=0;e<a-i;e++)this.#c.firstElementChild.before(this.#c.lastElementChild);let t=0;for(let r of n){let n=this.#t[t++].getAttribute(`data-resizer-name`);r.setAttribute(`data-l10n-id`,e._l10nResizer[n])}}this.#W(0),this.#v=!0,this.#c.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#V(t){e._resizerKeyboardManager.exec(this,t)}#H(e){this.#v&&e.relatedTarget?.parentNode!==this.#c&&this.#G()}#U(e){this.#p=this.#v?e:``}#W(e){if(this.#t)for(let t of this.#t)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#v&&this.#N(this.#p,{deltaX:e,deltaY:t,fromKeyboard:!0})}#G(){this.#v=!1,this.#W(-1),this.#M()}_stopResizingWithKeyboard(){this.#G(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add(`selectedEditor`),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains(`selectedEditor`)&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#c?.classList.add(`hidden`),this.div?.classList.remove(`selectedEditor`),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!==`BUTTON`&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(e){this.#g=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:`added`}}get telemetryFinalData(){return null}_reportTelemetry(t,n=!1){if(n){this.#S||=new Map;let{action:n}=t,r=this.#S.get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(t),this.#S.delete(n),this.#S.size===0&&(this.#S=null)},e._telemetryTimeout),this.#S.set(n,r);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:t}})}show(e=this._isVisible){this.div.classList.toggle(`hidden`,!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#a=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#a=!0}updateFakeAnnotationElement(e){if(!this.#d&&!this.deleted){this.#d=e.addFakeAnnotation(this);return}if(this.deleted){this.#d.remove(),this.#d=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#d.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(`.annotationContent`);if(!t)t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.container.prepend(t);else if(t.nodeName===`CANVAS`){let e=t;t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;t?.nodeName===`DIV`&&t.classList.contains(`annotationContent`)&&t.remove()}},vw=class extends _w{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},yw=3285377520,bw=4294901760,xw=65535,Sw=class{constructor(e){this.h1=e?e&4294967295:yw,this.h2=e?e&4294967295:yw}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw Error(`Invalid data format, must be a string or TypedArray.`);let r=n>>2,i=n-r*4,a=new Uint32Array(t.buffer,0,r),o=0,s=0,c=this.h1,l=this.h2,u=3432918353,d=461845907,f=11601,p=13715;for(let e=0;e<r;e++)e&1?(o=a[e],o=o*u&bw|o*f&xw,o=o<<15|o>>>17,o=o*d&bw|o*p&xw,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&bw|s*f&xw,s=s<<15|s>>>17,s=s*d&bw|s*p&xw,l^=s,l=l<<13|l>>>19,l=l*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*u&bw|o*f&xw,o=o<<15|o>>>17,o=o*d&bw|o*p&xw,r&1?c^=o:l^=o}this.h1=c,this.h2=l}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&bw|e*36045&xw,t=t*4283543511&bw|((t<<16|e>>>16)*2950163797&bw)>>>16,e^=t>>>1,e=e*444984403&bw|e*60499&xw,t=t*3301882366&bw|((t<<16|e>>>16)*3120437893&bw)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},Cw=Object.freeze({map:null,hash:``,transfer:void 0}),ww=class{#e=!1;#t=null;#n=null;#r=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(e,t){let n=this.#r.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#r.get(e)}remove(e){let t=this.#r.get(e);t!==void 0&&(t instanceof _w&&this.#n.delete(t.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),!this.#r.values().some(e=>e instanceof _w)&&this.onAnnotationEditor?.(null))}setValue(e,t){let n=this.#r.get(e),r=!1;if(n!==void 0)for(let[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this.#r.set(e,t);r&&this.#i(),t instanceof _w&&((this.#n||=new Map).set(t.annotationElementId,t),this.onAnnotationEditor?.(t.constructor._type))}has(e){return this.#r.has(e)}get size(){return this.#r.size}#i(){this.#e||(this.#e=!0,this.onSetModified?.())}resetModified(){this.#e&&(this.#e=!1,this.onResetModified?.())}get print(){return new Tw(this)}get serializable(){if(this.#r.size===0)return Cw;let e=new Map,t=new Sw,n=[],r=Object.create(null),i=!1;for(let[n,a]of this.#r){let o=a instanceof _w?a.serialize(!1,r):a;a.page&&(a.pageIndex=a.page._pageIndex,delete a.page),o&&(e.set(n,o),t.update(`${n}:${JSON.stringify(o)}`),i||=!!o.bitmap)}if(i)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:Cw}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let i of this.#r.values()){if(!(i instanceof _w)){i.popup&&(i.popup.deleted?r+=1:n+=1);continue}i.isCommentDeleted?r+=1:i.hasEditedComment&&(n+=1);let a=i.telemetryFinalData;if(!a)continue;let{type:o}=a;t.getOrInsertComputed(o,()=>Object.getPrototypeOf(i).constructor),e||=Object.create(null);let s=e[o]||=new Map;for(let[e,t]of Object.entries(a)){if(e===`type`)continue;let n=s.getOrInsertComputed(e,mC);n.set(t,(n.get(t)??0)+1)}}if((r>0||n>0)&&(e||=Object.create(null),e.comments={deleted:r,edited:n}),!e)return null;for(let[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,t){let n=this.#n?.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let t of this.#n.values())t.serialize()&&e.push(t.annotationElementId);let t=``;if(e.length){let n=new Sw;n.update(e.join(`,`)),t=n.hexdigest()}return this.#t={ids:new Set(e),hash:t}}[Symbol.iterator](){return this.#r.entries()}},Tw=class extends ww{#e=Cw;constructor(e){super();let{serializable:t}=e;if(t===Cw)return;let{map:n,hash:r,transfer:i}=t,a=structuredClone(n,i?{transfer:i}:null);this.#e={map:a,hash:r,transfer:[]}}get print(){GS(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}get modifiedIds(){return X(this,`modifiedIds`,{ids:new Set,hash:``})}},Ew=`__forcedDependency`,{floor:Dw,ceil:Ow}=Math;function kw(e,t,n,r,i,a){e[t*4+0]=Math.min(e[t*4+0],n),e[t*4+1]=Math.min(e[t*4+1],r),e[t*4+2]=Math.max(e[t*4+2],i),e[t*4+3]=Math.max(e[t*4+3],a)}function Aw(e,t,n,r,i){let a;e?(e<0&&(a=i[0],i[0]=i[2],i[2]=a),i[0]*=e,i[2]*=e,t<0&&(a=i[1],i[1]=i[3],i[3]=a),i[1]*=t,i[3]*=t):i.fill(0),i[0]+=n,i[1]+=r,i[2]+=n,i[3]+=r}var jw=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Mw=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===jw}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}},Nw=(e,t)=>e?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Pw=class{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(xS);_pendingBBoxIdx=-1;#r;#i;#a;#o;_savesStack=[];_markedContentStack=[];constructor(e,t){this.#r=e.width,this.#i=e.height,this.#s(t)}growOperationsCount(e){e>=this.#o.length&&this.#s(e,this.#o)}#s(e,t){let n=new ArrayBuffer(e*4);this.#a=new Uint8ClampedArray(n),this.#o=new Uint32Array(n),t&&t.length>0?(this.#o.set(t),this.#o.fill(jw,t.length)):this.#o.fill(jw)}get clipBox(){return this.#t}save(e){return this.#t={__proto__:this.#t},this._savesStack.push(e),this}restore(e,t){let n=Object.getPrototypeOf(this.#t);if(n===null)return this;this.#t=n;let r=this._savesStack.pop();return r!==void 0&&(t?.(r,e),this.#o[e]=this.#o[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){let n=this._savesStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){let n=this._markedContentStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}pushBaseTransform(e){return this.#e.push(Z.multiplyByDOMMatrix(this.#e.at(-1),e.getTransform())),this}popBaseTransform(){return this.#e.length>1&&this.#e.pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,this.#n.set(xS,0)),this}recordClipBox(e,t,n,r,i,a){let o=Z.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform()),s=xS.slice();Z.axialAlignedBoundingBox([n,i,r,a],o,s);let c=Z.intersect(this.#t,s);return c?(this.#t[0]=c[0],this.#t[1]=c[1],this.#t[2]=c[2],this.#t[3]=c[3]):(this.#t[0]=this.#t[1]=1/0,this.#t[2]=this.#t[3]=-1/0),this}recordBBox(e,t,n,r,i,a){let o=this.#t;if(o[0]===1/0)return this;let s=Z.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform());if(o[0]===-1/0)return Z.axialAlignedBoundingBox([n,i,r,a],s,this.#n),this;let c=xS.slice();return Z.axialAlignedBoundingBox([n,i,r,a],s,c),this.#n[0]=_C(c[0],o[0],this.#n[0]),this.#n[1]=_C(c[1],o[1],this.#n[1]),this.#n[2]=_C(c[2],this.#n[2],o[2]),this.#n[3]=_C(c[3],this.#n[3],o[3]),this}recordFullPageBBox(e){return this.#n[0]=Math.max(0,this.#t[0]),this.#n[1]=Math.max(0,this.#t[1]),this.#n[2]=Math.min(this.#r,this.#t[2]),this.#n[3]=Math.min(this.#i,this.#t[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;let r=Dw(this.#n[0]*256/this.#r),i=Dw(this.#n[1]*256/this.#i),a=Ow(this.#n[2]*256/this.#r),o=Ow(this.#n[3]*256/this.#i);if(kw(this.#a,e,r,i,a,o),n)for(let t of n)for(let n of t)n!==e&&kw(this.#a,n,r,i,a,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,this.#t[0]=Math.max(this.#t[0],this.#n[0]),this.#t[1]=Math.max(this.#t[1],this.#n[1]),this.#t[2]=Math.min(this.#t[2],this.#n[2]),this.#t[3]=Math.min(this.#t[3],this.#n[3])),this}take(){return new Mw(this.#o,this.#a)}takeDebugMetadata(){throw Error(`Unreachable`)}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}},Fw=class{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[Ew]:[]};#n=new Map;#r=new Set;#i=new Map;#a;#o;#s;constructor(e,t=!1){this.#s=e,t&&(this.#a=new Map,this.#o=(e,t)=>{Nw(this.#a,t).dependencies.add(e)})}get clipBox(){return this.#s.clipBox}growOperationsCount(e){this.#s.growOperationsCount(e)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[Ew]:{__proto__:this.#t[Ew]}},this.#s.save(e),this}restore(e){this.#s.restore(e,this.#o);let t=Object.getPrototypeOf(this.#e);return t===null?this:(this.#e=t,this.#t=Object.getPrototypeOf(this.#t),this)}recordOpenMarker(e){return this.#s.recordOpenMarker(e,this.#o),this}getOpenMarker(){return this.#s.getOpenMarker()}recordCloseMarker(e){return this.#s.recordCloseMarker(e,this.#o),this}beginMarkedContent(e){return this.#s.beginMarkedContent(e),this}endMarkedContent(e){return this.#s.endMarkedContent(e,this.#o),this}pushBaseTransform(e){return this.#s.pushBaseTransform(e),this}popBaseTransform(){return this.#s.popBaseTransform(),this}recordSimpleData(e,t){return this.#e[e]=t,this}recordIncrementalData(e,t){return this.#t[e].push(t),this}resetIncrementalData(e,t){return this.#t[e].length=0,this}recordNamedData(e,t){return this.#n.set(e,t),this}recordSimpleDataFromNamed(e,t,n){this.#e[e]=this.#n.get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(Ew,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in this.#e&&this.recordFutureForcedDependency(t,this.#e[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#r)this.recordFutureForcedDependency(Ew,e);return this}resetBBox(e){return this.#s.resetBBox(e),this}recordClipBox(e,t,n,r,i,a){return this.#s.recordClipBox(e,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#s.recordBBox(e,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){let s=n.bbox,c,l;if(s&&(c=s[2]!==s[0]&&s[3]!==s[1]&&this.#i.get(n),c!==!1&&(l=[0,0,0,0],Z.axialAlignedBoundingBox(s,n.fontMatrix,l),(r!==1||i!==0||a!==0)&&Aw(r,-r,i,a,l),c)))return this.recordBBox(e,t,l[0],l[2],l[1],l[3]);if(!o)return this.recordFullPageBBox(e);let u=o();return s&&l&&c===void 0&&(c=l[0]<=i-u.actualBoundingBoxLeft&&l[2]>=i+u.actualBoundingBoxRight&&l[1]<=a-u.actualBoundingBoxAscent&&l[3]>=a+u.actualBoundingBoxDescent,this.#i.set(n,c),c)?this.recordBBox(e,t,l[0],l[2],l[1],l[3]):this.recordBBox(e,t,i-u.actualBoundingBoxLeft,i+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#s.recordFullPageBBox(e),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,t){let n=this.#r,r=this.#e,i=this.#t;for(let e of t)e in this.#e?n.add(r[e]):e in i&&i[e].forEach(n.add,n);return this}recordNamedDependency(e,t){return this.#n.has(t)&&this.#r.add(this.#n.get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[Ew]),this.#a){let t=Nw(this.#a,e),{dependencies:n}=t;this.#r.forEach(n.add,n),this.#s._savesStack.forEach(n.add,n),this.#s._markedContentStack.forEach(n.add,n),n.delete(e),t.isRenderingOperation=!0}let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.recordOperation(e,t,[this.#r,this.#s._savesStack,this.#s._markedContentStack]),n&&this.#r.clear(),this}recordShowTextOperation(e,t=!1){let n=Array.from(this.#r);this.recordOperation(e,t),this.recordIncrementalData(`sameLineText`,e);for(let e of n)this.recordIncrementalData(`sameLineText`,e);return this}bboxToClipBoxDropOperation(e,t=!1){let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.bboxToClipBoxDropOperation(e),n&&this.#r.clear(),this}take(){return this.#i.clear(),this.#s.take()}takeDebugMetadata(){return this.#a}},Iw=class e{#e;#t;#n;#r=0;#i=0;constructor(t,n,r){if(t instanceof e&&t.#n===!!r)return t;this.#e=t,this.#t=n,this.#n=!!r}get clipBox(){return this.#e.clipBox}growOperationsCount(){throw Error(`Unreachable`)}save(e){return this.#i++,this.#e.save(this.#t),this}restore(e){return this.#i>0&&(this.#e.restore(this.#t),this.#i--),this}recordOpenMarker(e){return this.#r++,this}getOpenMarker(){return this.#r>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#r--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,t){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,t){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,t){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this.#e.recordSimpleDataFromNamed(e,t,this.#t),this}recordFutureForcedDependency(e,t){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#n||this.#e.resetBBox(this.#t),this}recordClipBox(e,t,n,r,i,a){return this.#n||this.#e.recordClipBox(this.#t,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#n||this.#e.recordBBox(this.#t,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r,i,a,o){return this.#n||this.#e.recordCharacterBBox(this.#t,t,n,r,i,a,o),this}recordFullPageBBox(e){return this.#n||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,t){return this.#e.recordDependencies(this.#t,t),this}recordNamedDependency(e,t){return this.#e.recordNamedDependency(this.#t,t),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#n||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw Error(`Unreachable`)}takeDebugMetadata(){throw Error(`Unreachable`)}},Lw={stroke:[`path`,`transform`,`filter`,`strokeColor`,`strokeAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`dash`],fill:[`path`,`transform`,`filter`,`fillColor`,`fillAlpha`,`globalCompositeOperation`,`SMask`],imageXObject:[`transform`,`SMask`,`filter`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`],rawFillPath:[`filter`,`fillColor`,`fillAlpha`],showText:[`transform`,`leading`,`charSpacing`,`wordSpacing`,`hScale`,`textRise`,`moveText`,`textMatrix`,`font`,`fontObj`,`filter`,`fillColor`,`textRenderingMode`,`SMask`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`,`sameLineText`],transform:[`transform`],transformAndFill:[`transform`,`fillColor`]},Rw=class e{#e;#t;#n=4;#r=0;#i=new e.#a(this.#n*6);static#a=oC.isFloat16ArraySupported?Float16Array:Float32Array;constructor(e){this.#e=e.width,this.#t=e.height}record(t,n,r,i){if(this.#r===this.#n){this.#n*=2;let t=new e.#a(this.#n*6);t.set(this.#i),this.#i=t}let a=RC(t),o;if(i[0]!==1/0){let e=xS.slice();Z.axialAlignedBoundingBox([0,-r,n,0],a,e);let t=Z.intersect(i,e);if(!t)return;let[s,c,l,u]=t;if(s!==e[0]||c!==e[1]||l!==e[2]||u!==e[3]){let e=Math.atan2(a[1],a[0]),t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e));if(t<1e-6||n<1e-6||Math.abs(t-n)<1e-6)o=[s,c,s,u,l,c];else{let e=l-s,r=u-c,i=t*t,a=n*n,d=n*t,f=a-i,p=(r*a-e*d)/f;o=[s+(r*d-e*i)/f,c,s,c+p,l,u-p]}}}o||(o=[0,-r,0,0,n,-r],Z.applyTransform(o,a,0),Z.applyTransform(o,a,2),Z.applyTransform(o,a,4)),o[0]/=this.#e,o[1]/=this.#t,o[2]/=this.#e,o[3]/=this.#t,o[4]/=this.#e,o[5]/=this.#t,this.#i.set(o,this.#r*6),this.#r++}take(){return this.#i.subarray(0,this.#r*6)}},zw=/\p{Cc}/u;function Bw(e){let t=e[0];if(e.length<2||t!==`"`&&t!==`'`||e.at(-1)!==t)return!1;let n=e.length-1;for(let r=1;r<n;r++){let i=e[r];if(i===t||zw.test(i)||i===`\\`&&(++r>=n||zw.test(e[r])))return!1}return!0}function Vw(e){return Bw(e)?e:`"${e.replaceAll(/["\\\p{Cc}]/gu,e=>e===`"`||e===`\\`?`\\${e}`:`\\${e.codePointAt(0).toString(16)} `)}"`}var Hw=class{#e=new Set;#t=null;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){let t=this.#n();t.insertRule(e,t.cssRules.length)}#n(){if(this.#t)return this.#t;let e=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&e){let{adoptedStyleSheets:t}=this._document;if(t){let n=new e;return t.push(n),this.#t=n}}return this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement)),this.#t=this.styleElement.sheet}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);if(this.nativeFontFaces.clear(),this.#e.clear(),this.#t){let{adoptedStyleSheets:e}=this._document;e?.includes(this.#t)&&(this._document.adoptedStyleSheets=e.filter(e=>e!==this.#t)),this.#t=null}this.styleElement&&=(this.styleElement.remove(),null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(e&&!this.#e.has(e.loadedName)){if(KS(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:r,style:i}=e,a=new FontFace(t,r,i);this.addNativeFontFace(a);try{await a.load(),this.#e.add(t),n?.(e)}catch{WS(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}GS(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw WS(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return X(this,`isFontLoadingAPISupported`,e)}get isSyncFontLoadingSupported(){return X(this,`isSyncFontLoadingSupported`,bS||oC.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(KS(!r.done,`completeRequest() cannot be called twice.`),r.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,r={done:!1,complete:t,callback:e};return n.push(r),r}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return X(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function r(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){WS(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=1482184792,m=n(f,16);for(a=0,o=d.length-3;a<o;a+=4)m=m-p+n(d,a)|0;a<d.length&&(m=m-p+n(d+`XXX`,a)|0),f=i(f,16,4,r(m));let h=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(f)});`}}`;this.insertRule(h);let g=this._document.createElement(`div`);g.style.visibility=`hidden`,g.style.width=g.style.height=`10px`,g.style.position=`absolute`,g.style.top=g.style.left=`0px`;for(let t of[e.loadedName,d]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,g.append(e)}this._document.body.append(g),u(d,()=>{g.remove(),t.complete()})}},Uw=class{compiledGlyphs=Object.create(null);#e;constructor(e,t=null,n,r){this.#e=e,this._inspectFont=t,n&&(this.charProcOperatorList=n),r&&Object.assign(this,r)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(Vw(this.cssFontInfo.fontFamily),this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:${Vw(this.cssFontInfo.fontFamily)};${n}src:${e}}`}return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n=this.loadedName+`_path_`+t,r;try{r=e.get(n)}catch(e){WS(`getPathGenerator - ignoring character: "${e}".`)}let i=$C(r?.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=i}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace}set disableFontFace(e){X(this,`disableFontFace`,!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}},Ww=class{static strings=[`fontFamily`,`fontWeight`,`italicAngle`]},Gw=class{static strings=[`css`,`loadedName`,`baseFontName`,`src`]},Kw=class{static bools=[`black`,`bold`,`disableFontFace`,`fontExtraProperties`,`isInvalidPDFjsFont`,`isType3Font`,`italic`,`missingFile`,`remeasure`,`vertical`];static numbers=[`ascent`,`defaultWidth`,`descent`];static strings=[`fallbackName`,`loadedName`,`mimetype`,`name`];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6},qw=class{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16},Jw=class{static get decoder(){return X(this,`decoder`,new TextDecoder)}static get encoder(){return X(this,`encoder`,new TextEncoder)}},Yw=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){KS(e<Ww.strings.length,`Invalid string index`);let{decoder:t}=Jw,n=0;for(let t=0;t<e;t++)n+=this.#t.getUint32(n)+4;let r=this.#t.getUint32(n);return t.decode(new Uint8Array(this.#e,n+4,r))}get fontFamily(){return this.#n(0)}get fontWeight(){return this.#n(1)}get italicAngle(){return this.#n(2)}},Xw=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}get guessFallback(){return this.#t.getUint8(0)!==0}#n(e){KS(e<Gw.strings.length,`Invalid string index`);let{decoder:t}=Jw,n=5;for(let t=0;t<e;t++)n+=this.#t.getUint32(n)+4;let r=this.#t.getUint32(n);return t.decode(new Uint8Array(this.#e,n+4,r))}get css(){return this.#n(0)}get loadedName(){return this.#n(1)}get baseFontName(){return this.#n(2)}get src(){return this.#n(3)}get style(){let{decoder:e}=Jw,t=1;t+=4+this.#t.getUint32(t);let n=this.#t.getUint32(t),r=e.decode(new Uint8Array(this.#e,t+4,n));t+=4+n;let i=this.#t.getUint32(t);return{style:r,weight:e.decode(new Uint8Array(this.#e,t+4,i))}}},Zw=class{#e;#t;constructor({buffer:e,extra:t}){this.#e=e,this.#t=new DataView(e),t&&Object.assign(this,t)}#n(e){KS(e<Kw.bools.length,`Invalid boolean index`);let t=Math.floor(e/4),n=e*2%8,r=this.#t.getUint8(t)>>n&3;return r===0?void 0:r===2}get black(){return this.#n(0)}get bold(){return this.#n(1)}get disableFontFace(){return this.#n(2)}get fontExtraProperties(){return this.#n(3)}get isInvalidPDFjsFont(){return this.#n(4)}get isType3Font(){return this.#n(5)}get italic(){return this.#n(6)}get missingFile(){return this.#n(7)}get remeasure(){return this.#n(8)}get vertical(){return this.#n(9)}#r(e){return KS(e<Kw.numbers.length,`Invalid number index`),this.#t.getFloat64(Kw.OFFSET_NUMBERS+e*8)}get ascent(){return this.#r(0)}get defaultWidth(){return this.#r(1)}get descent(){return this.#r(2)}#i(e,t,n,r){let i=this.#t.getUint8(e);if(i===0)return;KS(i===t,`Invalid array length.`),e+=1;let a=Array(i);for(let t=0;t<i;t++)a[t]=this.#t[n](e,!0),e+=r;return a}get bbox(){return this.#i(Kw.OFFSET_BBOX,4,`getInt16`,2)}get fontMatrix(){return this.#i(Kw.OFFSET_FONT_MATRIX,6,`getFloat64`,8)}get defaultVMetrics(){return this.#i(Kw.OFFSET_DEFAULT_VMETRICS,3,`getInt16`,2)}#a(e){KS(e<Kw.strings.length,`Invalid string index`);let{decoder:t}=Jw,n=Kw.OFFSET_STRINGS+4;for(let t=0;t<e;t++)n+=this.#t.getUint32(n)+4;let r=this.#t.getUint32(n);return t.decode(new Uint8Array(this.#e,n+4,r))}get fallbackName(){return this.#a(0)}get loadedName(){return this.#a(1)}get mimetype(){return this.#a(2)}get name(){return this.#a(3)}#o(){let e=Kw.OFFSET_STRINGS,t=this.#t.getUint32(e);e+=4+t;let n=this.#t.getUint32(e);e+=4+n;let r=this.#t.getUint32(e);e+=4+r;let i=this.#t.getUint32(e);return{offset:e,length:i}}get data(){let{offset:e,length:t}=this.#o();return t===0?void 0:new Uint8Array(this.#e,e+4,t)}clearData(){let{offset:e,length:t}=this.#o();t!==0&&(this.#t.setUint32(e,0),this.#e=new Uint8Array(this.#e,0,e+4).slice().buffer,this.#t=new DataView(this.#e))}get cssFontInfo(){let e=Kw.OFFSET_STRINGS,t=this.#t.getUint32(e);e+=4+t;let n=this.#t.getUint32(e);e+=4+n;let r=this.#t.getUint32(e);if(r===0)return null;let i=new Uint8Array(r);return i.set(new Uint8Array(this.#e,e+4,r)),new Yw(i.buffer)}get systemFontInfo(){let e=Kw.OFFSET_STRINGS,t=this.#t.getUint32(e);e+=4+t;let n=this.#t.getUint32(e);if(n===0)return null;let r=new Uint8Array(n);return r.set(new Uint8Array(this.#e,e+4,n)),new Xw(r.buffer)}},Qw=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,t=this.data[qw.KIND],n=!!this.data[qw.HAS_BBOX],r=!!this.data[qw.HAS_BACKGROUND],i=e.getUint32(qw.N_COORD,!0),a=e.getUint32(qw.N_COLOR,!0),o=e.getUint32(qw.N_STOP,!0),s=20,c=new Float32Array(this.buffer,s,i*2);s+=i*8;let l=new Uint8Array(this.buffer,s,a*4);s+=a*4;let u=[];for(let t=0;t<o;++t){let t=e.getFloat32(s,!0);s+=4;let n=e.getUint32(s,!0);s+=4,u.push([t,`#${n.toString(16).padStart(6,`0`)}`])}let d=null;if(n){d=[];for(let t=0;t<4;++t)d.push(e.getFloat32(s,!0)),s+=4}let f=null;if(r&&(f=new Uint8Array(this.buffer,s,3),s+=3),t===1)return[`RadialAxial`,`axial`,d,u,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(t===2)return[`RadialAxial`,`radial`,d,u,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(t===3){let e=this.data[qw.SHADING_TYPE],t=null;if(c.length>0){t=xS.slice();for(let e=0,n=c.length;e<n;e+=2)Z.pointBoundingBox(c[e],c[e+1],t)}return[`Mesh`,e,c,l,i,t,d,f]}throw Error(`Unsupported pattern kind: ${t}`)}},$w=class{#e;constructor(e){this.#e=e}get path(){return oC.isFloat16ArraySupported?new Float16Array(this.#e):new Float32Array(this.#e)}};function eT(e){if(e instanceof URL)return e;if(typeof e==`string`){if(bS){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let t=process.getBuiltinModule(`url`);return new URL(t.pathToFileURL(e))}let t=URL.parse(e,window.location);if(t)return t}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function tT(e){if(bS&&typeof Buffer<`u`&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return aC(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==`object`&&!isNaN(e?.length))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}function nT(e){if(typeof e!=`string`)return null;if(e.endsWith(`/`))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var rT=e=>typeof e==`object`&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,iT=fC.bind(null,rT,e=>typeof e==`object`&&typeof e?.name==`string`),aT=class{#e=new Map;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let[e]of this.#e)e.call(this,n)})}addEventListener(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){let{signal:i}=n;if(i.aborted){WS("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}this.#e.set(t,r)}removeEventListener(e,t){this.#e.get(t)?.(),this.#e.delete(t)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}},oT={DATA:1,ERROR:2},sT={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function cT(){}function lT(e){if(e instanceof rC||e instanceof eC||e instanceof QS||e instanceof tC||e instanceof $S)return e;switch(e instanceof Error||typeof e==`object`&&e||GS(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new rC(e.message);case`InvalidPDFException`:return new eC(e.message);case`PasswordException`:return new QS(e.message,e.code);case`ResponseException`:return new tC(e.message,e.status,e.missing);case`UnknownErrorException`:return new $S(e.message,e.details)}return new $S(e.message,e.toString())}var uT=class{#e=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener(`message`,this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#r(e);return}if(e.callback){let t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===oT.DATA)n.resolve(e.data);else if(e.callback===oT.ERROR)n.reject(lT(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.actionHandler[e.action];if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(t){i.postMessage({sourceName:n,targetName:r,callback:oT.DATA,callbackId:e.callbackId,data:t})},function(t){i.postMessage({sourceName:n,targetName:r,callback:oT.ERROR,callbackId:e.callbackId,reason:lT(t)})});return}if(e.streamId){this.#n(e);return}t(e.data)}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.streamId++,a=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.streamControllers[i]={controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:n.desiredSize},r),c.promise},pull:e=>{let t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:sT.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{KS(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:sT.CANCEL,streamId:i,reason:lT(e)}),t.promise}},n)}#n(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this,o=this.actionHandler[e.action],s={enqueue(e,a=1,o){if(this.isCancelled)return;let s=this.desiredSize;this.desiredSize-=a,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:sT.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:sT.CLOSE,streamId:t}),delete a.streamSinks[t])},error(e){KS(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:sT.ERROR,streamId:t,reason:lT(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,Promise.try(o,e.data,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:sT.START_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:sT.START_COMPLETE,streamId:t,reason:lT(e)})})}#r(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case sT.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(lT(e.reason));break;case sT.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(lT(e.reason));break;case sT.PULL:if(!o){i.postMessage({sourceName:n,targetName:r,stream:sT.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||cT).then(function(){i.postMessage({sourceName:n,targetName:r,stream:sT.PULL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:sT.PULL_COMPLETE,streamId:t,reason:lT(e)})});break;case sT.ENQUEUE:if(KS(a,`enqueue should have stream controller`),a.isClosed)break;a.controller.enqueue(e.chunk);break;case sT.CLOSE:if(KS(a,`close should have stream controller`),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#i(a,t);break;case sT.ERROR:KS(a,`error should have stream controller`),a.controller.error(lT(e.reason)),this.#i(a,t);break;case sT.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(lT(e.reason)),this.#i(a,t);break;case sT.CANCEL:if(!o)break;let s=lT(e.reason);Promise.try(o.onCancel||cT,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:sT.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:sT.CANCEL_COMPLETE,streamId:t,reason:lT(e)})}),o.sinkCapability.reject(s),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async#i(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#e?.abort(),this.#e=null}},dT=class{#e=Object.freeze({cMapUrl:`CMap`,standardFontDataUrl:`font`,wasmUrl:`wasm`});constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case`cMapUrl`:case`standardFontDataUrl`:case`wasmUrl`:break;default:GS(`Not implemented: ${e}`)}let n=this[e];if(!n)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let r=`${n}${t}`;return this._fetch(r,e).catch(t=>{throw Error(`Unable to load ${this.#e[e]} data at: ${r}`)})}async _fetch(e,t){GS("Abstract method `_fetch` called.")}},fT=class extends dT{async _fetch(e,t){let n=await wC(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:aC(n)}},pT=class{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`,{willReadFrequently:!this.#e})}}reset({canvas:e},t,n){if(!e)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.width=t,e.height=n}destroy(e){let{canvas:t}=e;if(!t)throw Error(`Canvas is not specified`);t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){GS("Abstract method `_createCanvas` called.")}},mT=class extends pT{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},hT=class{addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addAlphaFilter(e){return`none`}addLuminosityFilter(e){return`none`}addKnockoutFilter(e=0){return`none`}addHighlightHCMFilter(e,t,n,r,i){return`none`}addSelectionHCMFilter(e,t){return`none`}addSelectionFilter(){return`none`}createSelectionStyle(e=null){return null}destroy(e=!1){}},gT=class extends hT{#e;#t;#n;#r;#i;#a;#o=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#s(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){let e=this.#i.createElement(`div`),{style:t}=e;t.colorScheme=`only light`,t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#i.createElementNS(wS,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(wS,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){if(e.length===1){let t=e[0],n=Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;let r=n.join(`,`);return[r,r,r]}let[t,n,r]=e,i=Array(256),a=Array(256),o=Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,a[e]=n[e]/255,o[e]=r[e]/255;return[i.join(`,`),a.join(`,`),o.join(`,`)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(EC(e)?WS(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=YS(e,``))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return`none`;let t=this.#s.get(e);if(t)return t;let[n,r,i]=this.#u(e),a=e.length===1?n:`${n}${r}${i}`;if(t=this.#s.get(a),t)return this.#s.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#o++}`,s=this.#d(o);this.#s.set(e,s),this.#s.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`,r=`base`,i=this.#c.get(r);if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url=`none`,i.filter=null):(i={key:n,url:`none`,filter:null},this.#c.set(r,i)),!e||!t))return i.url;let a=this.#v(e);e=Z.makeHexColor(...a);let o=this.#v(t);if(t=Z.makeHexColor(...o),this.#b(),e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array.from({length:256},(e,t)=>JC(t/255)).join(`,`),c=`g_${this.#r}_hcm_filter`,l=i.filter=this.#m(c);this.#g(s,s,s,l),this.#p(l);let u=(e,t)=>{let n=a[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return this.#g(u(0,5),u(1,5),u(2,5),l),i.url=this.#d(c),i.url}addSelectionHCMFilter(e,t){return this.addHighlightHCMFilter(`selection`,e,t,`HighlightText`,`Highlight`)}addSelectionFilter(){return this.addHighlightHCMFilter(`selection_default`,`black`,`white`,`HighlightText`,`Highlight`)}createSelectionStyle(e=null){let t=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return t===`none`||!oC.platform.isFirefox?null:{"backdrop-filter":t,"background-color":`transparent`}}addAlphaFilter(e){let t=this.#s.get(e);if(t)return t;let[n]=this.#u([e]),r=`alpha_${n}`;if(t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_alpha_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#_(n,o),a}addLuminosityFilter(e){let t=this.#s.get(e||`luminosity`);if(t)return t;let n,r;if(e?([n]=this.#u([e]),r=`luminosity_${n}`):r=`luminosity`,t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_luminosity_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#f(o),e&&this.#_(n,o),a}addKnockoutFilter(e=0){let t=e>0?Math.min(1/e,1e6):1e6,n=`knockout_${t}`,r=this.#s.get(n);if(r)return r;let i=`g_${this.#r}_knockout_filter_${this.#o++}`,a=this.#d(i);this.#s.set(n,a);let o=this.#m(i),s=this.#i.createElementNS(wS,`feComponentTransfer`);o.append(s);let c=this.#i.createElementNS(wS,`feFuncA`);return c.setAttribute(`type`,`linear`),c.setAttribute(`slope`,`${t}`),c.setAttribute(`intercept`,`0`),s.append(c),a}addHighlightHCMFilter(e,t,n,r,i){let a=`${t}-${n}-${r}-${i}`,o=this.#c.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url=`none`,o.filter=null):(o={key:a,url:`none`,filter:null},this.#c.set(e,o)),!t||!n))return o.url;let[s,c]=[t,n].map(this.#v.bind(this)),l=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[r,i].map(this.#x.bind(this));u<l&&([l,u,d,f]=[u,l,f,d]),this.#b();let p=(e,t,n)=>{let r=Array(256),i=(u-l)/n,a=e/255,o=(t-e)/(255*n),s=0;for(let e=0;e<=n;e++){let t=Math.round(l+e*i),n=a+e*o;for(let e=s;e<=t;e++)r[e]=n;s=t+1}for(let e=s;e<256;e++)r[e]=r[s-1];return r.join(`,`)},m=`g_${this.#r}_hcm_${e}_filter`,h=o.filter=this.#m(m);return this.#p(h),this.#g(p(d[0],f[0],5),p(d[1],f[1],5),p(d[2],f[2],5),h),o.url=this.#d(m),o.url}destroy(e=!1){e&&this.#a?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#a?.clear(),this.#a=null,this.#o=0)}#f(e){let t=this.#i.createElementNS(wS,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0`),e.append(t)}#p(e){let t=this.#i.createElementNS(wS,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}#m(e){let t=this.#i.createElementNS(wS,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#l.append(t),t}#h(e,t,n){let r=this.#i.createElementNS(wS,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#i.createElementNS(wS,`feComponentTransfer`);r.append(i),this.#h(i,`feFuncR`,e),this.#h(i,`feFuncG`,t),this.#h(i,`feFuncB`,n)}#_(e,t){let n=this.#i.createElementNS(wS,`feComponentTransfer`);t.append(n),this.#h(n,`feFuncA`,e)}#v(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,IC(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#y(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,FC(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#b(){this.#l.style.color=``,this.#l.style.backgroundColor=``}#x(e){let[t,n,r,i]=this.#y(e);if(i===1)return[t,n,r];let[a,o,s]=this.#v(`Canvas`);return[_T(t,a,i),_T(n,o,i),_T(r,s,i)]}};function _T(e,t,n){return Math.round(n*e+(1-n)*t)}bS&&WS("Please use the `legacy` build in Node.js environments.");async function vT(e){let t=await process.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(t)}var yT=class extends hT{},bT=class extends pT{_createCanvas(e,t){return process.getBuiltinModule(`module`).createRequire(import.meta.url)(`@napi-rs/canvas`).createCanvas(e,t)}},xT=class extends dT{async _fetch(e,t){return vT(e)}};function ST({src:e,srcPos:t=0,dest:n,width:r,height:i,nonBlackColor:a=4294967295,inverseDecode:o=!1}){let s=oC.isLittleEndian?4278190080:255,[c,l]=o?[a,s]:[s,a],u=r>>3,d=r&7,f=c^l,p=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<i;++r){for(let r=t+u;t<r;++t,m+=8){let r=e[t];n[m]=c^-(r>>7&1)&f,n[m+1]=c^-(r>>6&1)&f,n[m+2]=c^-(r>>5&1)&f,n[m+3]=c^-(r>>4&1)&f,n[m+4]=c^-(r>>3&1)&f,n[m+5]=c^-(r>>2&1)&f,n[m+6]=c^-(r>>1&1)&f,n[m+7]=c^-(r&1)&f}if(d===0)continue;let r=t<p?e[t++]:255;for(let e=0;e<d;++e,++m)n[m]=c^-(r>>7-e&1)&f}return{srcPos:t,destPos:m}}function CT({src:e,srcPos:t=0,dest:n,destPos:r=0,width:i,height:a}){let o=0,s=i*a*3,c=s>>2,l=new Uint32Array(e.buffer,t,c),u=oC.isLittleEndian?4278190080:255;if(oC.isLittleEndian){for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e>>>24|t<<8|u,n[r+2]=t>>>16|i<<16|u,n[r+3]=i>>>8|u}for(let i=o*4,a=t+s;i<a;i+=3)n[r++]=e[i]|e[i+1]<<8|e[i+2]<<16|u}else{for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e<<24|t>>>8|u,n[r+2]=t<<16|i>>>16|u,n[r+3]=i<<8|u}for(let i=o*4,a=t+s;i<a;i+=3)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|u}return{srcPos:t+s,destPos:r}}var wT=`
struct Uniforms {
  offsetX      : f32,
  offsetY      : f32,
  scaleX       : f32,
  scaleY       : f32,
  paddedWidth  : f32,
  paddedHeight : f32,
  borderSize   : f32,
  _pad         : f32,
};

@group(0) @binding(0) var<uniform> u : Uniforms;

struct VertexInput {
  @location(0) position : vec2<f32>,
  @location(1) color    : vec4<f32>,
};

struct VertexOutput {
  @builtin(position) position : vec4<f32>,
  @location(0)       color    : vec3<f32>,
};

@vertex
fn vs_main(in : VertexInput) -> VertexOutput {
  var out : VertexOutput;
  let cx = (in.position.x + u.offsetX) * u.scaleX;
  let cy = (in.position.y + u.offsetY) * u.scaleY;
  out.position = vec4<f32>(
    ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
    1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
    0.0,
    1.0
  );
  out.color = in.color.rgb;
  return out;
}

@fragment
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
  return vec4<f32>(in.color, 1.0);
}
`,TT=new class{#e=null;#t=null;#n=null;#r=null;async#i(){if(!globalThis.navigator?.gpu)return!1;try{let e=await navigator.gpu.requestAdapter();return e?(this.#r=navigator.gpu.getPreferredCanvasFormat(),this.#t=await e.requestDevice(),!0):!1}catch{return!1}}init(){return this.#e||=this.#i()}get isReady(){return this.#t!==null}loadMeshShader(){if(!this.#t||this.#n)return;let e=this.#t.createShaderModule({code:wT});this.#n=this.#t.createRenderPipeline({layout:`auto`,vertex:{module:e,entryPoint:`vs_main`,buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:`float32x2`}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:`unorm8x4`}]}]},fragment:{module:e,entryPoint:`fs_main`,targets:[{format:this.#r}]},primitive:{topology:`triangle-list`}})}draw(e,t,n,r,i,a,o,s){this.loadMeshShader();let c=this.#t,{offsetX:l,offsetY:u,scaleX:d,scaleY:f}=r,p=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(p,0,e);let m=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(m,0,t);let h=c.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(h,0,new Float32Array([l,u,d,f,a,o,s,0]));let g=c.createBindGroup({layout:this.#n.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:h}}]}),_=new OffscreenCanvas(a,o),v=_.getContext(`webgpu`);v.configure({device:c,format:this.#r,alphaMode:i?`opaque`:`premultiplied`});let y=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},b=c.createCommandEncoder(),x=b.beginRenderPass({colorAttachments:[{view:v.getCurrentTexture().createView(),clearValue:y,loadOp:`clear`,storeOp:`store`}]});return n>0&&(x.setPipeline(this.#n),x.setBindGroup(0,g),x.setVertexBuffer(0,p),x.setVertexBuffer(1,m),x.draw(n)),x.end(),c.queue.submit([b.finish()]),p.destroy(),m.destroy(),h.destroy(),_.transferToImageBitmap()}};function ET(){return TT.init()}function DT(){return TT.isReady}function OT(){TT.loadMeshShader()}function kT(e,t,n,r,i,a,o,s){return TT.draw(e,t,n,r,i,a,o,s)}var AT={FILL:`Fill`,STROKE:`Stroke`,SHADING:`Shading`};function jT(e,t){if(!t)return;let n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}var MT=class{matrix=null;isModifyingCurrentTransform(){return!1}getPattern(){GS("Abstract method `getPattern` called.")}},NT=class extends MT{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type===`radial`}areConic(){if(!this.isRadial())return!1;let e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,t=null){let n,r=this._p0,i=this._p1;if(t&&(r=r.slice(),i=i.slice(),Z.applyTransform(r,t),Z.applyTransform(i,t)),this._type===`axial`)n=e.createLinearGradient(r[0],r[1],i[0],i[1]);else if(this._type===`radial`){let a=this._r0,o=this._r1;if(t){let e=new Float32Array(2);Z.singularValueDecompose2dScale(t,e),a*=e[0],o*=e[0]}n=e.createRadialGradient(r[0],r[1],a,i[0],i[1],o)}for(let e of this._colorStops)n.addColorStop(e[0],e[1]);return n}_createReversedGradient(e,t=null){let n=this._p1,r=this._p0;t&&(n=n.slice(),r=r.slice(),Z.applyTransform(n,t),Z.applyTransform(r,t));let i=this._r1,a=this._r0;if(t){let e=new Float32Array(2);Z.singularValueDecompose2dScale(t,e),i*=e[0],a*=e[0]}let o=e.createRadialGradient(n[0],n[1],i,r[0],r[1],a),s=this._colorStops.map(([e,t])=>[1-e,t]).reverse();for(let[e,t]of s)o.addColorStop(e,t);return o}getPattern(e,t,n,r){let i;if(r===AT.STROKE||r===AT.FILL){if(this.isOriginBased()){let r=Z.transform(n,t.baseTransform);this.matrix&&(r=Z.transform(r,this.matrix));let i=.001,a=Math.hypot(r[0],r[1]),o=Math.hypot(r[2],r[3]),s=(r[0]*r[2]+r[1]*r[3])/(a*o);if(Math.abs(s)<i){if(this.isRadial()){if(Math.abs(a-o)<i)return this._createGradient(e,r)}else return this._createGradient(e,r)}}let a=t.current.getClippedPathBoundingBox(r,RC(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,s=Math.ceil(a[3]-a[1])||1,c=t.canvasFactory.create(o,s),l=c.context;l.clearRect(0,0,l.canvas.width,l.canvas.height),l.beginPath(),l.rect(0,0,l.canvas.width,l.canvas.height),l.translate(-a[0],-a[1]),n=Z.transform(n,[1,0,0,1,a[0],a[1]]),l.transform(...t.baseTransform),this.matrix&&l.transform(...this.matrix),jT(l,this._bbox),this.areConic()&&(l.fillStyle=this._createReversedGradient(l),l.fill()),l.fillStyle=this._createGradient(l),l.fill(),i=e.createPattern(c.canvas,`no-repeat`),t.canvasFactory.destroy(c);let u=new DOMMatrix(n);i.setTransform(u)}else this.areConic()&&(e.save(),jT(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-1e10,-1e10,2e10,2e10),e.restore()),jT(e,this._bbox),i=this._createGradient(e);return i}};function PT(e,t,n,r,i,a,o,s){let c=t.coords,l=t.colors,u=e.data,d=e.width*4,f;c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f),c[r*2+1]>c[i*2+1]&&(f=r,r=i,i=f,f=o,o=s,s=f),c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f);let p=(c[n*2]+t.offsetX)*t.scaleX,m=(c[n*2+1]+t.offsetY)*t.scaleY,h=(c[r*2]+t.offsetX)*t.scaleX,g=(c[r*2+1]+t.offsetY)*t.scaleY,_=(c[i*2]+t.offsetX)*t.scaleX,v=(c[i*2+1]+t.offsetY)*t.scaleY;if(m>=v)return;let y=l[a*4],b=l[a*4+1],x=l[a*4+2],S=l[o*4],C=l[o*4+1],w=l[o*4+2],T=l[s*4],E=l[s*4+1],D=l[s*4+2],O=Math.round(m),k=Math.round(v),A,j,M,N,P,F,I,L;for(let e=O;e<=k;e++){if(e<g){let t=e<m?0:(m-e)/(m-g);A=p-(p-h)*t,j=y-(y-S)*t,M=b-(b-C)*t,N=x-(x-w)*t}else{let t;t=e>v?1:g===v?0:(g-e)/(g-v),A=h-(h-_)*t,j=S-(S-T)*t,M=C-(C-E)*t,N=w-(w-D)*t}let t;t=e<m?0:e>v?1:(m-e)/(m-v),P=p-(p-_)*t,F=y-(y-T)*t,I=b-(b-E)*t,L=x-(x-D)*t;let n=Math.round(Math.min(A,P)),r=Math.round(Math.max(A,P)),i=d*e+n*4;for(let e=n;e<=r;e++)t=(A-e)/(A-P),t<0?t=0:t>1&&(t=1),u[i++]=j-(j-F)*t|0,u[i++]=M-(M-I)*t|0,u[i++]=N-(N-L)*t|0,u[i++]=255}}var FT=class extends MT{constructor(e){super(),this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],OT()}_createMeshCanvas(e,t,n){let r=1.1,i=3e3,a=Math.floor(this._bounds[0]),o=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-a,c=Math.ceil(this._bounds[3])-o,l=Math.min(Math.ceil(Math.abs(s*e[0]*r)),i)||1,u=Math.min(Math.ceil(Math.abs(c*e[1]*r)),i)||1,d=s?s/l:1,f=c?c/u:1,p={coords:this._posData,colors:this._colData,offsetX:-a,offsetY:-o,scaleX:1/d,scaleY:1/f},m=l+4,h=u+4,g=n.create(m,h);if(DT()&&this._vertexCount>48)g.context.drawImage(kT(this._posData,this._colData,this._vertexCount,p,t,m,h,2),0,0);else{let e=g.context.createImageData(l,u);if(t){let n=e.data;for(let e=0,r=n.length;e<r;e+=4)n[e]=t[0],n[e+1]=t[1],n[e+2]=t[2],n[e+3]=255}for(let t=0,n=this._vertexCount;t<n;t+=3)PT(e,p,t,t+1,t+2,t,t+1,t+2);g.context.putImageData(e,2,2)}return{canvas:g.canvas,offsetX:a-2*d,offsetY:o-2*f,scaleX:d,scaleY:f}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,r){jT(e,this._bbox);let i=new Float32Array(2);if(r===AT.SHADING)Z.singularValueDecompose2dScale(RC(e),i);else if(this.matrix){Z.singularValueDecompose2dScale(this.matrix,i);let[e,n]=i;Z.singularValueDecompose2dScale(t.baseTransform,i),i[0]*=e,i[1]*=n}else Z.singularValueDecompose2dScale(t.baseTransform,i);let a=this._createMeshCanvas(i,r===AT.SHADING?null:this._background,t.canvasFactory);r!==AT.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY);let o=e.createPattern(a.canvas,`no-repeat`);return t.canvasFactory.destroy(a),o}},IT=class extends MT{getPattern(){return`hotpink`}};function LT(e){switch(e[0]){case`RadialAxial`:return new NT(e);case`Mesh`:return new FT(e);case`Dummy`:return new IT}throw Error(`Unknown IR type: ${e[0]}`)}var RT={COLORED:1,UNCOLORED:2},zT=class e{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.needsIsolation=e[9]??!0,this.ctx=t,this.canvasGraphicsFactory=n,this.baseTransform=r,this.patternBaseMatrix=this.matrix?Z.transform(r,this.matrix):r}canSkipPatternCanvas([e,t,n,r]){let[i,a,o,s]=this.bbox,c=Math.abs(this.xstep),l=Math.abs(this.ystep);if(e>c+1e-6||t>l+1e-6)return null;let u=Math.floor((n-o)/c)+1,d=Math.ceil((n+e-i)/c)-1,f=Math.floor((r-s)/l)+1,p=Math.ceil((r+t-a)/l)-1;return d<=u&&p<=f?[u,f]:null}updatePatternDims(e,t){let n=Z.inverseTransform(this.patternBaseMatrix),r=[e[0],e[1]],i=[e[2],e[3]];Z.applyTransform(r,n),Z.applyTransform(i,n),t[0]=Math.abs(i[0]-r[0]),t[1]=Math.abs(i[1]-r[1]),t[2]=Math.min(r[0],i[0]),t[3]=Math.min(r[1],i[1])}_renderTileCanvas(e,t,n,r){let[i,a,o,s]=this.bbox,c=e.canvasFactory.create(n.size,r.size),l=c.context,u=this.canvasGraphicsFactory.createCanvasGraphics(l,t);return u.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),l.translate(-n.scale*i,-r.scale*a),u.transform(0,n.scale,0,0,r.scale,0,0),l.save(),u.dependencyTracker?.save(),this.clipBbox(u,i,a,o,s),u.baseTransform=RC(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),u.dependencyTracker?.restore(),l.restore(),c}_getCombinedScales(){let e=new Float32Array(2);Z.singularValueDecompose2dScale(this.matrix,e);let[t,n]=e;return Z.singularValueDecompose2dScale(this.baseTransform,e),[t*e[0],n*e[1]]}drawPattern(e,t,n=!1,[r,i],a){let[o,s,c,l]=this.bbox,u=e.dependencyTracker;if(u&&(e.dependencyTracker=new Iw(u,a)),e.save(),n?e.ctx.clip(t,`evenodd`):e.ctx.clip(t),e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(r*this.xstep,i*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!==`source-over`||e.inSMaskMode){let t=c-o,n=l-s,[r,i]=this._getCombinedScales(),u=this.getSizeAndScale(t,this.ctx.canvas.width,r),d=this.getSizeAndScale(n,this.ctx.canvas.height,i),f=this._renderTileCanvas(e,a,u,d);e.ctx.drawImage(f.canvas,o,s,t,n),e.canvasFactory.destroy(f)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,o,s,c,l),e.baseTransformStack.push(e.baseTransform),e.baseTransform=RC(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();e.restore(),u&&(e.dependencyTracker=u)}createPatternCanvas(e,t){let[n,r,i,a]=this.bbox,o=i-n,s=a-r,{xstep:c,ystep:l}=this;c=Math.abs(c),l=Math.abs(l),US(`TilingType: `+this.tilingType);let[u,d]=this._getCombinedScales(),f=o,p=s,m=!1,h=!1;Math.ceil(c*u)>=Math.ceil(o*u)?f=c:m=!0,Math.ceil(l*d)>=Math.ceil(s*d)?p=l:h=!0;let g=this.getSizeAndScale(f,this.ctx.canvas.width,u),_=this.getSizeAndScale(p,this.ctx.canvas.height,d),v=this._renderTileCanvas(e,t,g,_);if(m||h){let t=v.canvas;m&&(f=c),h&&(p=l);let i=this.getSizeAndScale(f,this.ctx.canvas.width,u),a=this.getSizeAndScale(p,this.ctx.canvas.height,d),g=i.size,_=a.size,y=e.canvasFactory.create(g,_),b=y.context,x=m?Math.floor(o/c):0,S=h?Math.floor(s/l):0;for(let e=0;e<=x;e++)for(let n=0;n<=S;n++)b.drawImage(t,g*e,_*n,g,_,0,0,g,_);return e.canvasFactory.destroy(v),{canvas:y.canvas,canvasEntry:y,scaleX:i.scale,scaleY:a.scale,offsetX:n,offsetY:r}}return{canvas:v.canvas,canvasEntry:v,scaleX:g.scale,scaleY:_.scale,offsetX:n,offsetY:r}}getSizeAndScale(t,n,r){let i=Math.max(e.MAX_PATTERN_SIZE,n),a=Math.ceil(t*r);return a>=i?a=i:r=a/t,{scale:r,size:a}}clipBbox(e,t,n,r,i){let a=r-t,o=i-n,s=new Path2D;s.rect(t,n,a,o),Z.axialAlignedBoundingBox([t,n,r,i],RC(e.ctx),e.current.minMax),e.ctx.clip(s),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,n){let r=e.ctx,i=e.current;switch(i.patternFill=i.patternStroke=!1,t){case RT.COLORED:let{fillStyle:e,strokeStyle:a}=this.ctx;r.fillStyle=i.fillColor=e,r.strokeStyle=i.strokeColor=a;break;case RT.UNCOLORED:r.fillStyle=r.strokeStyle=n,i.fillColor=i.strokeColor=n;break;default:throw new nC(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,r,i){let a=r===AT.SHADING?n:Z.transform(n,this.patternBaseMatrix),o=this.createPatternCanvas(t,i),s=new DOMMatrix(a);s=s.translate(o.offsetX,o.offsetY),s=s.scale(1/o.scaleX,1/o.scaleY);let c=e.createPattern(o.canvas,`repeat`);return t.canvasFactory.destroy(o.canvasEntry),c.setTransform(s),c}},BT=16,VT=100,HT=15,UT=10,WT=16,GT=new Float32Array(2);function KT(e,t){if(e._removeMirroring)throw Error(`Context is already forwarding operations.`);let n=new Map;for(let r of[`save`,`restore`,`rotate`,`scale`,`translate`,`transform`,`setTransform`,`resetTransform`,`clip`,`moveTo`,`lineTo`,`bezierCurveTo`,`quadraticCurveTo`,`arc`,`arcTo`,`ellipse`,`rect`,`roundRect`,`closePath`,`beginPath`]){let i=e[r];typeof i==`function`&&typeof t[r]==`function`&&(n.set(r,i),e[r]=function(...e){return t[r](...e),i.apply(this,e)})}e._removeMirroring=()=>{for(let[t,r]of n)e[t]=r;delete e._removeMirroring}}function qT(e,t,n,r,i,a,o,s,c,l){let[u,d,f,p,m,h]=RC(e);if(d===0&&f===0){let g=o*u+m,_=Math.round(g),v=s*p+h,y=Math.round(v),b=(o+c)*u+m,x=Math.abs(Math.round(b)-_)||1,S=(s+l)*p+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(Math.sign(u),0,0,Math.sign(p),_,y),e.drawImage(t,n,r,i,a,0,0,x,C),e.setTransform(u,d,f,p,m,h),[x,C]}if(u===0&&p===0){let g=s*f+m,_=Math.round(g),v=o*d+h,y=Math.round(v),b=(s+l)*f+m,x=Math.abs(Math.round(b)-_)||1,S=(o+c)*d+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(0,Math.sign(d),Math.sign(f),0,_,y),e.drawImage(t,n,r,i,a,0,0,C,x),e.setTransform(u,d,f,p,m,h),[C,x]}e.drawImage(t,n,r,i,a,o,s,c,l);let g=Math.hypot(u,d),_=Math.hypot(f,p);return[g*c,_*l]}var JT=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=CS;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=MS.FILL;textRise=0;fillColor=`#000000`;strokeColor=`#000000`;tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps=`none`;minMax=SS.slice();constructor(e,t){this.clipBox=new Float32Array([0,0,e,t])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=this.tilingPatternDims?.slice(),e}getPathBoundingBox(e=AT.FILL,t=null){let n=this.minMax.slice();if(e===AT.STROKE){t||GS(`Stroke bounding box must include transform.`),Z.singularValueDecompose2dScale(t,GT);let e=GT[0]*this.lineWidth/2,r=GT[1]*this.lineWidth/2;n[0]-=e,n[1]-=r,n[2]+=e,n[3]+=r}return n}updateClipFromPath(){let e=Z.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(SS,0)}getClippedPathBoundingBox(e=AT.FILL,t=null){return Z.intersect(this.clipBox,this.getPathBoundingBox(e,t))}};function YT(e,t){let{width:n,height:r,kind:i}=t,a=r%WT,o=(r-a)/WT,s=a===0?o:o+1,c=e.createImageData(n,WT),l=0,u=t.data,d=c.data,f;if(i===NS.GRAYSCALE_1BPP)for(f=0;f<s;f++)({srcPos:l}=ST({src:u,srcPos:l,dest:d,width:n,height:f<o?WT:a})),e.putImageData(c,0,f*WT);else if(i===NS.RGBA_32BPP){let t=0,r=n*WT*4;for(f=0;f<o;f++)d.set(u.subarray(l,l+r)),l+=r,e.putImageData(c,0,t),t+=WT;f<s&&(r=n*a*4,d.set(u.subarray(l,l+r)),e.putImageData(c,0,t))}else if(i===NS.RGB_24BPP)for(f=0;f<s;f++)({srcPos:l}=CT({src:u,srcPos:l,dest:new Uint32Array(d.buffer),width:n,height:f<o?WT:a})),e.putImageData(c,0,f*WT);else throw Error(`bad image kind: ${i}`)}function XT(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let{width:n,height:r}=t,i=r%WT,a=(r-i)/WT,o=i===0?a:a+1,s=e.createImageData(n,WT),c=0,l=t.data,u=s.data;for(let t=0;t<o;t++)({srcPos:c}=ST({src:l,srcPos:c,dest:u,width:n,height:t<a?WT:i,nonBlackColor:0})),e.putImageData(s,0,t*WT)}function ZT(e,t){for(let n of[`strokeStyle`,`fillStyle`,`fillRule`,`globalAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`globalCompositeOperation`,`font`,`filter`])e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function QT(e){e.strokeStyle=e.fillStyle=`#000000`,e.fillRule=`nonzero`,e.globalAlpha=1,e.lineWidth=1,e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=10,e.globalCompositeOperation=`source-over`,e.font=`10px sans-serif`,e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0);let{filter:t}=e;t!==`none`&&t!==``&&(e.filter=`none`)}function $T(e,t){if(t)return!0;Z.singularValueDecompose2dScale(e,GT);let n=Math.fround(VC.pixelRatio*CC.PDF_TO_CSS_UNITS);return GT[0]<=n&&GT[1]<=n}var eE=[`butt`,`round`,`square`],tE=[`miter`,`round`,`bevel`],nE={},rE={},iE=class e{static#e=null;#t=0;#n=0;#r=null;#i=null;#a=null;#o=null;#s=1;#c;#l=null;#u=[];constructor(e,t,n,r,i,{optionalContentConfig:a,markedContentStack:o=null},s,c,l,u){this.ctx=e,this.current=new JT(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=l??null,this.imagesTracker=u??null}getObject(e,t,n=null){return typeof t==`string`?(this.dependencyTracker?.recordNamedDependency(e,t),t.startsWith(`g_`)?this.commonObjs.get(t):this.objs.get(t)):n}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){let i=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=r||`#ffffff`,this.ctx.fillRect(0,0,i,a),this.ctx.fillStyle=o,n){let e=this.transparentCanvasEntry=this.canvasFactory.create(i,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=e,this.ctx.save(),this.ctx.transform(...RC(this.compositeCtx))}this.ctx.save(),QT(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=RC(this.ctx)}executeOperatorList(e,t,n,r,i){let a=e.argsArray,o=e.fnArray,s=t||0,c=a.length;if(c===s)return s;let l=c-s>UT&&typeof n==`function`,u=l?Date.now()+HT:0,d=0,f=this.commonObjs,p=this.objs,m,h;for(;;){if(r!==void 0){if(s===r.nextBreakPoint)return r.breakIt(s,n),s;if(r.shouldSkip(s)){if(++s===c)return s;continue}}if(!i||i(s)){if(m=o[s],h=a[s]??null,m!==LS.dependency)h===null?this[m](s):this[m](s,...h);else for(let e of h){this.dependencyTracker?.recordNamedData(e,s);let t=e.startsWith(`g_`)?f:p;if(!t.has(e))return t.get(e,n),s}}if(s++,s===c)return s;if(l&&++d>UT){if(Date.now()>u)return n(),s;d=0}}}#d(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#d();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#u)this.#b(e);this.#u.length=0,this.#r=null,this.#i=null,this.#a=null,this.#o=null,this.#s=1,this.#l=null,this.#n=0,this.#t=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#f()}#f(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width??e.displayWidth,r=e.height??e.displayHeight,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[],s=i,c=a,l=n,u=r;for(;s>2&&l>1||c>2&&u>1;){let e=l,t=u;s>2&&l>1&&(e=Math.ceil(l/2),s/=l/e),c>2&&u>1&&(t=Math.ceil(u/2),c/=u/t),o.push({newWidth:e,newHeight:t}),l=e,u=t}if(o.length===0)return{img:e,paintWidth:n,paintHeight:r,tmpCanvas:null};if(o.length===1){let{newWidth:t,newHeight:i}=o[0],a=this.canvasFactory.create(t,i);return a.context.drawImage(e,0,0,n,r,0,0,t,i),{img:a.canvas,paintWidth:t,paintHeight:i,tmpCanvas:a}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),p=n,m=r,h=e;for(let{newWidth:e,newHeight:t}of o)this.canvasFactory.reset(f,e,t),f.context.drawImage(h,0,0,p,m,0,0,e,t),[d,f]=[f,d],h=d.canvas,p=e,m=t;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:p,paintHeight:m,tmpCanvas:d}}_createMaskCanvas(e,t){let n=this.ctx,{width:r,height:i}=t,a=this.current.fillColor,o=this.current.patternFill,s=RC(n),c,l,u,d;if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;l=JSON.stringify(o?s:[s.slice(0,4),a]),c=this._cachedBitmapsMap.getOrInsertComputed(n,mC);let r=c.get(l);if(r&&!o){let t=Math.round(Math.min(s[0],s[2])+s[4]),n=Math.round(Math.min(s[1],s[3])+s[5]);return this.dependencyTracker?.recordDependencies(e,Lw.transformAndFill),{canvas:r,offsetX:t,offsetY:n}}u=r}u||(d=this.canvasFactory.create(r,i),XT(d.context,t));let f=Z.transform(s,[1/r,0,0,-1/i,0,0]);f=Z.transform(f,[1,0,0,1,0,-i]);let p=SS.slice();Z.axialAlignedBoundingBox([0,0,r,i],f,p);let[m,h,g,_]=p,v=Math.round(g-m)||1,y=Math.round(_-h)||1,b=this.canvasFactory.create(v,y),x=b.context,S=m,C=h;x.translate(-S,-C),x.transform(...f);let w=null;if(!u){let e=this._scaleImage(d.canvas,zC(x));u=e.img,w=e.tmpCanvas,u!==d.canvas&&(this.canvasFactory.destroy(d),d=null),c&&o&&(c.set(l,u),w=null,d=null)}x.imageSmoothingEnabled=$T(RC(x),t.interpolate),qT(x,u,0,0,u.width,u.height,0,0,r,i),w&&this.canvasFactory.destroy(w),d&&this.canvasFactory.destroy(d),x.globalCompositeOperation=`source-in`;let T=Z.transform(zC(x),[1,0,0,1,-S,-C]);return x.fillStyle=o?a.getPattern(n,this,T,AT.FILL,e):a,x.fillRect(0,0,r,i),c&&!o&&c.set(l,b.canvas),this.dependencyTracker?.recordDependencies(e,Lw.transformAndFill),{canvas:b.canvas,canvasEntry:c&&!o?null:b,offsetX:Math.round(S),offsetY:Math.round(C)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData(`lineWidth`,e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData(`lineCap`,e),this.ctx.lineCap=eE[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData(`lineJoin`,e),this.ctx.lineJoin=tE[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData(`miterLimit`,e),this.ctx.miterLimit=t}setDash(e,t,n){this.dependencyTracker?.recordSimpleData(`dash`,e);let r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(t),r.lineDashOffset=n)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(let[n,r]of t)switch(n){case`LW`:this.setLineWidth(e,r);break;case`LC`:this.setLineCap(e,r);break;case`LJ`:this.setLineJoin(e,r);break;case`ML`:this.setMiterLimit(e,r);break;case`D`:this.setDash(e,r[0],r[1]);break;case`RI`:this.setRenderingIntent(e,r);break;case`FL`:this.setFlatness(e,r);break;case`Font`:this.setFont(e,r[0],r[1]);break;case`CA`:this.dependencyTracker?.recordSimpleData(`strokeAlpha`,e),this.current.strokeAlpha=r;break;case`ca`:this.dependencyTracker?.recordSimpleData(`fillAlpha`,e),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case`BM`:this.dependencyTracker?.recordSimpleData(`globalCompositeOperation`,e),this.ctx.globalCompositeOperation=r;break;case`SMask`:this.dependencyTracker?.recordSimpleData(`SMask`,e),this.current.activeSMask=r?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case`TR`:this.dependencyTracker?.recordSimpleData(`filter`,e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r)}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&=(this.canvasFactory.destroy(this.smaskPreparedEntry),null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:t,subtype:n,backdrop:r,transferMap:i}=e,a=n===`Luminosity`||n===`Alpha`&&i;if(!a&&!(n===`Luminosity`&&r)){this.smaskPreparedFor=e;return}let o;if(n===`Luminosity`&&r){let[e,t,n]=FC(r),a=Math.round(.3*e+.59*t+.11*n);o=i?.[a]??a}else o=i?.[0]??0;let{width:s,height:c}=this.ctx.canvas,l=t.width*t.height,u=s*c<4*l,d=a?{url:n===`Alpha`?this.filterFactory.addAlphaFilter(i):this.filterFactory.addLuminosityFilter(i),subtype:n,transferMap:i}:null,f=n===`Luminosity`?r:null,p,m,h;u?(p=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,s,c,f,d),m=0,h=0):(p=this._bakeSMaskCanvas(t,0,0,t.width,t.height,f,d),m=e.offsetX,h=e.offsetY),this.smaskPreparedEntry=p,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=m,this.smaskPreparedOffsetY=h,this.smaskPreparedOOBAlpha=!u&&o!==0?o:null}_bakeSMaskCanvas(e,t,n,r,i,a,o){!a&&!o&&GS(`_bakeSMaskCanvas with neither backdrop nor filter`);let s=this.canvasFactory.create(r,i),c=s.context;if(c.drawImage(e,t,n),a&&(c.globalCompositeOperation=`destination-atop`,c.fillStyle=a,c.fillRect(0,0,r,i)),!o)return s;let l=this.canvasFactory.create(r,i),u=l.context;u.filter=o.url;let d=oC.isCanvasFilterSupported&&u.filter!==`none`&&u.filter!==``;if(u.drawImage(s.canvas,0,0),oC.isCanvasFilterSupported&&(u.filter=`none`),!d){let e=u.getImageData(0,0,r,i),{data:t}=e,{transferMap:n}=o;if(o.subtype===`Luminosity`)for(let e=0,r=t.length;e<r;e+=4){let r=.3*t[e]+.59*t[e+1]+.11*t[e+2]+.5|0;t[e]=t[e+1]=t[e+2]=0,t[e+3]=n?.[r]??r}else for(let e=3,r=t.length;e<r;e+=4)t[e]=n[t[e]];u.putImageData(e,0,0)}return this.canvasFactory.destroy(s),l}beginSMaskMode(e){if(this.inSMaskMode)throw Error(`beginSMaskMode called while already in smask mode`);let{width:t,height:n}=this.ctx.canvas,r=this.canvasFactory.create(t,n);this.smaskScratchCanvas=r,this.suspendedCtx=this.ctx;let i=this.ctx=r.context;i.setTransform(this.suspendedCtx.getTransform()),ZT(this.suspendedCtx,i),KT(i,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[[`BM`,`source-over`]])}endSMaskMode(){if(!this.inSMaskMode)throw Error(`endSMaskMode called while not in smask mode`);this.ctx._removeMirroring(),ZT(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#p(e,t=null,n=1){let{width:r,height:i}=e,a=t??this.canvasFactory.create(r,i),o=a.context;n=Math.round(n*255)/255;let s=n<1;s&&this.#c===void 0&&(this.#c=oC.isCanvasFilterSupported?new Map:`none`);let c=`none`;if(s&&this.#c instanceof Map&&(c=this.#c.getOrInsertComputed(n,()=>this.filterFactory.addKnockoutFilter(n))),!s||c!==`none`)return t&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,r,i),o.restore()),o.filter=c,o.drawImage(e,0,0),o.filter=`none`,a;let l=e.getContext(`2d`,{willReadFrequently:!0}).getImageData(0,0,r,i),u=o.createImageData(r,i),d=l.data,f=u.data,p=n>0?1/n:1e6;for(let e=3,t=d.length;e<t;e+=4)f[e]=Math.min(Math.round(d[e]*p),255);return o.putImageData(u,0,0),a}#m(e,t,n,r){let i=e?.[t]??null;if(i&&(i.canvas.width!==n||i.canvas.height!==r)&&(this.canvasFactory.destroy(i),i=null),!i)return i=this.canvasFactory.create(n,r),e&&(e[t]=i),i;let a=i.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,n,r),a.restore(),i}#h(e,t,n={}){let{backdropCanvas:r=null,destTransform:i=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:s=null,sourceAlpha:c=1,sourceFilter:l=`none`,knockoutAlpha:u=1}=n,{width:d,height:f}=t,p=this.#p(t,o,u),m=e.globalCompositeOperation;if(e.save(),e.setTransform(...i),e.globalAlpha=1,oC.isCanvasFilterSupported&&(e.filter=`none`),e.globalCompositeOperation=`destination-out`,e.drawImage(p.canvas,0,0),r){let[t,n]=a,i=this.#m(s,`knockoutBackdropEntry`,d,f),o=i.context;o.drawImage(r,t,n,d,f,0,0,d,f),o.globalCompositeOperation=`destination-in`,o.drawImage(p.canvas,0,0),o.globalCompositeOperation=`source-over`,e.globalCompositeOperation=`destination-over`,e.drawImage(i.canvas,0,0),s||this.canvasFactory.destroy(i)}e.globalCompositeOperation=m,e.globalAlpha=c,oC.isCanvasFilterSupported&&(e.filter=l??`none`),e.drawImage(t,0,0),e.restore(),o||this.canvasFactory.destroy(p)}#g(e=1){if(this.#t===0||this.#n>0||!this.contentVisible)return!1;this.#n++,this.#s=e;let t=this.#u.at(-1),{canvas:n}=this.ctx,r=this.#m(t,`knockoutTempEntry`,n.width,n.height);this.#r=r;let i=r.context;return i.save(),i.setTransform(this.ctx.getTransform()),ZT(this.ctx,i),this.#o=i.globalCompositeOperation,i.globalCompositeOperation=`source-over`,KT(i,this.ctx),this.#l=t,this.#i=this.ctx,this.#a=this.suspendedCtx,this.ctx=i,this.inSMaskMode&&(this.suspendedCtx=i),!0}#_(e){if(!e)return;let t=this.#r,n=this.#i,r=this.#a,i=t.context;this.#r=null,this.#i=null,this.#a=null,this.inSMaskMode&&this.suspendedCtx===i&&this.ctx!==i&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=r),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#o,this.#o=null,ZT(this.ctx,n),this.ctx=n;let a=this.#l;this.#l=null;let o=this.#s;this.#s=1;try{this.#h(r??n,t.canvas,{backdropCanvas:a?.backdropCtx?.canvas??null,backdropOffset:a?.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:a?.knockoutMaskEntry??null,poolMeta:a,knockoutAlpha:o})}finally{i.restore(),this.#n--,a||this.canvasFactory.destroy(t)}}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,n=this.suspendedCtx,r=this.#n>0&&n===this.ctx;this.composeSMask(r?null:n,t,this.ctx,e),!r&&(this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(e,t,n,r){let i=r[0],a=r[1],o=r[2]-i,s=r[3]-a;if(o===0||s===0)return;let c=this.smaskPreparedEntry;if(c){let e=i,r=a,l=o,u=s,d=this.smaskPreparedOOBAlpha,f=d!==null;if(f){e=Math.max(i,t.offsetX),r=Math.max(a,t.offsetY);let n=Math.min(i+o,t.offsetX+t.canvas.width),c=Math.min(a+s,t.offsetY+t.canvas.height);l=n-e,u=c-r}if(l>0&&u>0){let t=e-this.smaskPreparedOffsetX,i=r-this.smaskPreparedOffsetY;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let a=new Path2D;a.rect(e,r,l,u),n.clip(a),n.globalCompositeOperation=`destination-in`,n.drawImage(c.canvas,t,i,l,u,e,r,l,u),n.restore()}f&&d<255&&this._applySMaskOOBAlpha(n,i,a,o,s,e,r,e+l,r+u,d)}else this.genericComposeSMask(t,n,o,s,i,a);e&&(e.save(),e.globalAlpha=1,e.globalCompositeOperation=t.blendMode||`source-over`,e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,i,a,o,s,i,a,o,s),e.restore())}_applySMaskOOBAlpha(e,t,n,r,i,a,o,s,c,l){let u=a<s&&o<c;if(u&&a===t&&o===n&&s===t+r&&c===n+i)return;let d=new Path2D;d.rect(t,n,r,i),u&&d.rect(a,o,s-a,c-o),e.save(),e.globalAlpha=l/255,e.setTransform(1,0,0,1,0,0),e.clip(d,`evenodd`),e.globalCompositeOperation=`destination-in`,e.fillStyle=`#000000`,e.fillRect(t,n,r,i),e.restore()}genericComposeSMask(e,t,n,r,i,a){let{context:o,offsetX:s,offsetY:c}=e;t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let l=new Path2D;l.rect(i,a,n,r),t.clip(l),t.globalCompositeOperation=`destination-in`,t.drawImage(o.canvas,i-s,a-c,n,r,i,a,n,r),t.restore()}save(e){this.inSMaskMode&&ZT(this.ctx,this.suspendedCtx),this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(ZT(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,n,r,i,a,o){this.dependencyTracker?.recordIncrementalData(`transform`,e),this.ctx.transform(t,n,r,i,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n,r){let[i]=n;if(!r){i||=n[0]=new Path2D,t!==LS.stroke&&t!==LS.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,i);return}if(this.dependencyTracker!==null){let n=t===LS.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,r[0]-n,r[2]+n,r[1]-n,r[3]+n).recordDependencies(e,[`transform`])}i instanceof Path2D||(i=n[0]=$C(i)),Z.axialAlignedBoundingBox(r,RC(this.ctx),this.current.minMax);let a=this.current.tilingPatternDims;if(a&&t!==LS.stroke&&t!==LS.closeStroke&&this.current.fillColor instanceof zT){let e=Z.intersect(this.current.clipBox,this.current.minMax);e?this.current.fillColor.updatePatternDims(e,a):this.current.tilingPatternDims=null}this[t](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,n=!0){let r=n&&this.#g(this.current.strokeAlpha),i=this.ctx,a=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible){if(typeof a==`object`&&a?.getPattern){let n=a.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=a.getPattern(i,this,zC(i),AT.STROKE,e),n){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(n)),t=e}this.rescaleAndStroke(t,!1),i.restore()}else this.rescaleAndStroke(t,!0)}this.dependencyTracker?.recordDependencies(e,Lw.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(AT.STROKE,RC(this.ctx))),i.globalAlpha=this.current.fillAlpha,this.#_(r)}closeStroke(e,t){this.stroke(e,t)}fill(e,t,n=!0){let r=n&&this.#g(this.current.fillAlpha),i=this.ctx,a=this.current.fillColor,o=this.current.patternFill,s=!1,c=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(e,Lw.fill),o){let o=this.current.tilingPatternDims,l=o&&a.canSkipPatternCanvas(o);if(l){a.drawPattern(this,t,this.pendingEOFill,l,e),this.pendingEOFill=!1,n&&this.consumePath(e,t,c),this.current.tilingPatternDims=null,this.#_(r);return}let u=a.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(e),i.save(),i.fillStyle=a.getPattern(i,this,zC(i),AT.FILL,e),u){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(u)),t=e}s=!0}this.contentVisible&&c!==null&&(this.pendingEOFill?(i.fill(t,`evenodd`),this.pendingEOFill=!1):i.fill(t)),s&&(i.restore(),this.dependencyTracker?.restore(e)),n&&this.consumePath(e,t,c),this.#_(r)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){let n=this.#g(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t),this.#_(n)}eoFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){let n=this.#g(this.current.fillAlpha);this.ctx.fill(t),this.dependencyTracker?.recordDependencies(e,Lw.rawFillPath).recordOperation(e),this.#_(n)}clip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=nE}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=rE}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData(`sameLineText`).resetIncrementalData(`moveText`,e)}endText(e){let t=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:n}=this;t!==void 0&&n.recordFutureForcedDependency(`textClip`,n.getOpenMarker()).recordFutureForcedDependency(`textClip`,e),n.recordCloseMarker(e)}if(t!==void 0){let e=new Path2D,r=n.getTransform().invertSelf();for(let{transform:n,x:i,y:a,fontSize:o,path:s}of t)s&&e.addPath(s,new DOMMatrix(n).preMultiplySelf(r).translate(i,a).scale(o,-o));n.clip(e)}delete this.pendingTextPaths}setCharSpacing(e,t){this.dependencyTracker?.recordSimpleData(`charSpacing`,e),this.current.charSpacing=t}setWordSpacing(e,t){this.dependencyTracker?.recordSimpleData(`wordSpacing`,e),this.current.wordSpacing=t}setHScale(e,t){this.dependencyTracker?.recordSimpleData(`hScale`,e),this.current.textHScale=t/100}setLeading(e,t){this.dependencyTracker?.recordSimpleData(`leading`,e),this.current.leading=-t}setFont(e,t,n){this.dependencyTracker?.recordSimpleData(`font`,e).recordSimpleDataFromNamed(`fontObj`,t,e);let r=this.commonObjs.get(t),i=this.current;if(!r)throw Error(`Can't find font for ${t}`);if(i.fontMatrix=r.fontMatrix||CS,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&WS(`Invalid font matrix for font `+t),n<0?(n=-n,i.fontDirection=-1):i.fontDirection=1,this.current.font=r,this.current.fontSize=n,r.isType3Font)return;let a=r.loadedName||`sans-serif`,o=r.systemFontInfo?.css||`"${a}", ${r.fallbackName}`,s=`normal`;r.black?s=`900`:r.bold&&(s=`bold`);let c=r.italic?`italic`:`normal`,l=_C(n,BT,VT);this.current.fontSizeScale=n/l,this.ctx.font=`${c} ${s} ${l}px ${o}`}setTextRenderingMode(e,t){this.dependencyTracker?.recordSimpleData(`textRenderingMode`,e),this.current.textRenderingMode=t}setTextRise(e,t){this.dependencyTracker?.recordSimpleData(`textRise`,e),this.current.textRise=t}moveText(e,t,n){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordIncrementalData(`moveText`,e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=n}setLeadingMoveText(e,t,n){this.setLeading(e,-n),this.moveText(e,t,n)}setTextMatrix(e,t){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordSimpleData(`textMatrix`,e);let{current:n}=this;n.textMatrix=t,n.textMatrixScale=Math.hypot(t[0],t[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData(`moveText`,this.dependencyTracker.getSimpleIndex(`leading`)??e)}#v(e,t,n){let r=new Path2D;return r.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),r}paintChar(e,t,n,r,i,a){let o=this.ctx,s=this.current,c=s.font,l=s.textRenderingMode,u=s.fontSize/s.fontSizeScale,d=l&MS.FILL_STROKE_MASK,f=!!(l&MS.ADD_TO_PATH_FLAG),p=s.patternFill&&!c.missingFile,m=s.patternStroke&&!c.missingFile,h;if((c.disableFontFace||f||p||m)&&!c.missingFile&&(h=c.getPathGenerator(this.commonObjs,t)),h&&(c.disableFontFace||p||m)){o.save(),o.translate(n,r),o.scale(u,-u),this.dependencyTracker?.recordCharacterBBox(e,o,c);let t;if(d===MS.FILL||d===MS.FILL_STROKE){if(i){t=o.getTransform(),o.setTransform(...i);let e=this.#v(h,t,i);o.fill(e)}else o.fill(h)}if(d===MS.STROKE||d===MS.FILL_STROKE){if(a){t||=o.getTransform(),o.setTransform(...a);let{a:e,b:n,c:r,d:i}=t,s=Z.inverseTransform(a),c=Z.transform([e,n,r,i,0,0],s);Z.singularValueDecompose2dScale(c,GT),o.lineWidth*=Math.max(GT[0],GT[1])/u,o.stroke(this.#v(h,t,a))}else o.lineWidth/=u,o.stroke(h)}o.restore()}else(d===MS.FILL||d===MS.FILL_STROKE)&&(o.fillText(t,n,r),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t))),(d===MS.STROKE||d===MS.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t)).recordDependencies(e,Lw.stroke),o.strokeText(t,n,r));f&&((this.pendingTextPaths||=[]).push({transform:RC(o),x:n,y:r,fontSize:u,path:h}),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r))}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText(`I`,0,10);let n=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let r=!1;for(let e=3;e<n.length;e+=4)if(n[e]>0&&n[e]<255){r=!0;break}return X(this,`isFontSubpixelAAEnabled`,r)}showText(e,t){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,Lw.showText).resetBBox(e),this.current.textRenderingMode&MS.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency(`textClip`,e).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,r=n.font;if(r.isType3Font){let r=this.#g(n.fillAlpha);this.showType3Text(e,t),this.dependencyTracker?.recordShowTextOperation(e),this.#_(r);return}let i=n.fontSize;if(i===0){this.dependencyTracker?.recordOperation(e);return}let a=this.#g(n.fillAlpha),o=this.ctx,s=n.fontSizeScale,c=n.charSpacing,l=n.wordSpacing,u=n.fontDirection,d=n.textHScale*u,f=t.length,p=r.vertical,m=p?1:-1,h=r.defaultVMetrics,g=i*n.fontMatrix[0],_=n.textRenderingMode===MS.FILL&&!r.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),u>0?o.scale(d,-1):o.scale(d,1);let v,y,b=n.textRenderingMode&MS.FILL_STROKE_MASK,x=b===MS.FILL||b===MS.FILL_STROKE,S=b===MS.STROKE||b===MS.FILL_STROKE,C=n.lineWidth,w=n.textMatrixScale;if(w===0||C===0?S&&(C=this.getSinglePixelWidth()):C/=w,s!==1&&(o.scale(s,s),C/=s),o.lineWidth=C,x&&n.patternFill){o.save();let t=n.fillColor.getPattern(o,this,zC(o),AT.FILL,e);v=RC(o),o.restore(),o.fillStyle=t}if(S&&n.patternStroke){o.save();let t=n.strokeColor.getPattern(o,this,zC(o),AT.STROKE,e);y=RC(o),o.restore(),o.strokeStyle=t}if(r.isInvalidPDFjsFont){let r=[],i=0;for(let e of t)r.push(e.unicode),i+=e.width;let s=r.join(``);if(o.fillText(s,0,0),this.dependencyTracker!==null){let t=o.measureText(s);this.dependencyTracker.recordBBox(e,this.ctx,-t.actualBoundingBoxLeft,t.actualBoundingBoxRight,-t.actualBoundingBoxAscent,t.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=i*g*d,o.restore(),this.compose(),this.#_(a);return}let T=0,E=0;for(;E<f;++E){let n=t[E];if(typeof n==`number`){T+=m*n*i/1e3;continue}let a=!1,d=(n.isSpace?l:0)+c,f=n.fontChar,b=n.accent,x,S,C=n.width;if(p){let e=n.vmetric||h,t=-(n.vmetric?e[1]:C*.5)*g,r=e[2]*g;C=e?-e[0]:C,x=t/s,S=(T+r)/s}else x=T/s,S=0;let w;if(r.remeasure&&C>0){w=o.measureText(f);let e=w.width*1e3/i*s;if(C<e&&this.isFontSubpixelAAEnabled){let t=C/e;a=!0,o.save(),o.scale(t,1),x/=t}else C!==e&&(x+=(C-e)/2e3*i/s)}if(this.contentVisible&&(n.isInFont||r.missingFile)){if(_&&!b)o.fillText(f,x,S),this.dependencyTracker?.recordCharacterBBox(e,o,w?{bbox:null}:r,i/s,x,S,()=>w??o.measureText(f));else if(this.paintChar(e,f,x,S,v,y),b){let t=x+i*b.offset.x/s,n=S-i*b.offset.y/s;this.paintChar(e,b.fontChar,t,n,v,y)}}let D=p?C*g-d*u:C*g+d*u;T+=D,a&&o.restore()}p?n.y-=T:n.x+=T*d,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e),this.#_(a)}showType3Text(e,t){let n=this.ctx,r=this.current,i=r.font,a=r.fontSize,o=r.fontDirection,s=i.vertical?1:-1,c=r.charSpacing,l=r.wordSpacing,u=r.textHScale*o,d=r.fontMatrix||CS,f=t.length,p=r.textRenderingMode===MS.INVISIBLE,m,h,g,_;if(p||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),r.textMatrix&&n.transform(...r.textMatrix),n.translate(r.x,r.y+r.textRise),n.scale(u,o);let v=this.dependencyTracker;for(this.dependencyTracker=v?new Iw(v,e):null,m=0;m<f;++m){if(h=t[m],typeof h==`number`){_=s*h*a/1e3,this.ctx.translate(_,0),r.x+=_*u;continue}let e=(h.isSpace?l:0)+c,o=i.charProcOperatorList.get(h.operatorListId);o?this.contentVisible&&(this.save(),o.fnArray[0]===LS.setCharWidth&&(r.fillAlpha=r.strokeAlpha=1,n.globalAlpha=1),n.scale(a,a),n.transform(...d),this.executeOperatorList(o),this.restore()):WS(`Type3 character "${h.operatorListId}" is not available.`);let f=[h.width,0];Z.applyTransform(f,d),g=f[0]*a+e,n.translate(g,0),r.x+=g*u}n.restore(),v&&(this.dependencyTracker=v)}setCharWidth(e,t,n){}setCharWidthAndBounds(e,t,n,r,i,a,o){let s=new Path2D;s.rect(r,i,a-r,o-i),this.ctx.clip(s),this.dependencyTracker?.recordBBox(e,this.ctx,r,a,i,o).recordClipBox(e,this.ctx,r,a,i,o),this.endPath(e)}getColorN_Pattern(t,n){let r;if(n[0]===`TilingPattern`){let t=this.baseTransform||RC(this.ctx);r=new zT(n,this.ctx,{createCanvasGraphics:(t,n)=>new e(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Iw(this.dependencyTracker,n,!0):null)},t)}else r=this._getPattern(t,n[1],n[2]);return r}setStrokeColorN(e,...t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){this.dependencyTracker?.recordSimpleData(`fillColor`,e);let n=this.current.fillColor=this.getColorN_Pattern(e,t);this.current.patternFill=!0,this.current.tilingPatternDims=n instanceof zT?[0,0,0,0]:null}setStrokeRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.ctx.strokeStyle=this.current.strokeColor=`transparent`,this.current.patternStroke=!1}setFillRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.ctx.fillStyle=this.current.fillColor=`transparent`,this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,t,n=null){let r=this.cachedPatterns.getOrInsertComputed(t,()=>LT(this.getObject(e,t)));return n&&(r.matrix=n),r}shadingFill(e,t){if(!this.contentVisible)return;let n=this.#g(this.current.fillAlpha),r=this.ctx;this.save(e),r.fillStyle=this._getPattern(e,t).getPattern(r,this,zC(r),AT.SHADING,e);let i=zC(r);if(i){let{width:e,height:t}=r.canvas,n=SS.slice();Z.axialAlignedBoundingBox([0,0,e,t],i,n);let[a,o,s,c]=n;this.ctx.fillRect(a,o,s-a,c-o)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,Lw.transform).recordDependencies(e,Lw.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),this.#_(n)}beginInlineImage(){GS(`Should not call beginInlineImage`)}beginImageData(){GS(`Should not call beginImageData`)}paintFormXObjectBegin(e,t,n){if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=RC(this.ctx),n)){Z.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[t,r,i,a]=n,o=new Path2D;o.rect(t,r,i-t,a-r),this.ctx.clip(o),this.dependencyTracker?.recordClipBox(e,this.ctx,t,i,r,a),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){if(!this.contentVisible)return;this.save(e);let{inSMaskMode:n}=this;n&&(this.endSMaskMode(),this.current.activeSMask=null);let r=this.ctx;if((!t.needsIsolation||!t.isolated&&!t.hasSoftMask)&&!t.knockout&&!t.isGray&&this.#t===0&&r.globalAlpha===1&&r.globalCompositeOperation===`source-over`&&!n){if(t.bbox){let e=new Path2D,[n,i,a,o]=t.bbox;if(e.rect(n,i,a-n,o-i),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}r.clip(e)}this.groupStack.push(null),this.#u.push(null),this.groupLevel++;return}!t.isolated&&!t.knockout&&this.#t===0&&US(`TODO: Fully support non-isolated non-knockout groups.`);let i=RC(r);t.matrix&&r.transform(...t.matrix);let a=[0,0,r.canvas.width,r.canvas.height],o;t.bbox?(o=SS.slice(),Z.axialAlignedBoundingBox(t.bbox,RC(r),o),o=Z.intersect(o,a)||[0,0,0,0]):o=a;let s=Math.floor(o[0]),c=Math.floor(o[1]),l=Math.max(Math.ceil(o[2])-s,1),u=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,l,u]);let d=this.canvasFactory.create(l,u);t.smask&&this.smaskGroupCanvases.push(d);let f=d.context,p=t.knockout&&!t.isolated?r:null,m=!t.isolated&&!t.knockout&&!t.smask&&t.needsIsolation&&this.#t>0,h=t.knockout?this.canvasFactory.create(l,u):null,g=this.#t;t.knockout?this.#t++:this.#t=0,f.translate(-s,-c),f.transform(...i);let _=!t.isolated&&!t.smask&&t.needsIsolation,v=_&&!n&&g===0&&!t.knockout&&!t.isGray&&t.hasSoftMask&&r.globalAlpha===1&&r.globalCompositeOperation===`source-over`&&this.current.transferMaps===`none`;if(_&&(n||v)&&(f.save(),f.setTransform(1,0,0,1,0,0),f.drawImage(r.canvas,-s,-c),f.restore()),t.bbox){let e=new Path2D,[n,r,i,a]=t.bbox;if(e.rect(n,r,i-n,a-r),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}f.clip(e)}t.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:s,offsetY:c,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null}),(!t.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(s,c),r.save()),ZT(r,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies([`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`]).pushBaseTransform(r),this.setGState(e,[[`BM`,`source-over`],[`ca`,1],[`CA`,1],[`TR`,null]]),this.groupStack.push(r),this.#u.push({backdropCtx:p,savedKnockoutLevel:g,offsetX:s,offsetY:c,hasInnerBackdrop:m,replaceBackdrop:v,knockoutMaskEntry:h,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,t){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,r=this.groupStack.pop(),i=this.#u.pop();if(i&&(this.#t=i.savedKnockoutLevel),r===null){this.restore(e);return}if(t.isGray&&this.#y(n),this.ctx=r,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),this.#b(i);else{this.ctx.restore();let t=RC(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...t);let a=SS.slice();Z.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],t,a);let o=this.#u.at(-1);if(this.#t>0){if(i.hasInnerBackdrop){let{width:e,height:a}=n.canvas,o=this.canvasFactory.create(e,a),s=o.context;s.drawImage(r.canvas,i.offsetX,i.offsetY,e,a,0,0,e,a),s.globalCompositeOperation=`source-over`,s.drawImage(n.canvas,0,0);let c=this.#p(n.canvas);s.globalCompositeOperation=`destination-in`,s.drawImage(c.canvas,0,0);let l=this.ctx.globalCompositeOperation,u=this.ctx.globalAlpha,d=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...t),this.ctx.globalAlpha=1,oC.isCanvasFilterSupported&&(this.ctx.filter=`none`),this.ctx.globalCompositeOperation=`destination-out`,this.ctx.drawImage(c.canvas,0,0),this.ctx.globalCompositeOperation=l,this.ctx.globalAlpha=u,oC.isCanvasFilterSupported&&(this.ctx.filter=d??`none`),this.ctx.drawImage(o.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(c),this.canvasFactory.destroy(o)}else{let e=o?.backdropCtx??null;this.#h(this.ctx,n.canvas,{backdropCanvas:e?.canvas??null,destTransform:t,backdropOffset:e?[o.offsetX+i.offsetX,o.offsetY+i.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}}else{if(i.replaceBackdrop){let e=new Path2D;e.rect(0,0,n.canvas.width,n.canvas.height),this.ctx.clip(e),this.ctx.globalCompositeOperation=`copy`}this.ctx.drawImage(n.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.#b(i),this.compose(a)}}#y(e){let{canvas:t}=e,{width:n,height:r}=t;if(oC.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter=`grayscale(1)`,e.globalAlpha=1,e.globalCompositeOperation=`copy`,e.drawImage(t,0,0),e.restore();return}let i=e.getImageData(0,0,n,r),{data:a}=i;for(let e=0,t=a.length;e<t;e+=4){let t=a[e]*.2126+a[e+1]*.7152+a[e+2]*.0722+.5|0;a[e]=a[e+1]=a[e+2]=t}e.putImageData(i,0,0)}#b(e){e&&(e.knockoutMaskEntry&&=(this.canvasFactory.destroy(e.knockoutMaskEntry),null),e.knockoutTempEntry&&=(this.canvasFactory.destroy(e.knockoutTempEntry),null),e.knockoutBackdropEntry&&=(this.canvasFactory.destroy(e.knockoutBackdropEntry),null))}beginAnnotation(e,t,n,r,i,a,o){if(this.#d(),QT(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let i=n[2]-n[0],s=n[3]-n[1];if(a&&this.annotationCanvasMap){r=r.slice(),r[4]-=n[0],r[5]-=n[1],Z.singularValueDecompose2dScale(RC(this.ctx),GT);let{viewportScale:e}=this,a=Math.ceil(i*this.outputScaleX*e),c=Math.ceil(s*this.outputScaleY*e);this.annotationCanvas=this.canvasFactory.create(a,c);let{canvas:l,context:u}=this.annotationCanvas;if(o){let e=this.annotationCanvasMap.getOrInsertComputed(t,pC);l.setAttribute(`data-canvas-name`,o);let n=e.findIndex(e=>e.getAttribute(`data-canvas-name`)===o);n===-1?e.push(l):e[n]=l}else this.annotationCanvasMap.set(t,l);this.annotationCanvas.savedCtx=this.ctx,this.ctx=u,this.ctx.save(),this.ctx.setTransform(GT[0],0,0,-GT[1],0,s*GT[1]),QT(this.ctx)}else{QT(this.ctx),this.endPath(e);let t=new Path2D;t.rect(n[0],n[1],i,s),this.ctx.clip(t)}}this.current=new JT(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...r),this.transform(e,...i),this.baseTransform=RC(this.ctx)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),this.#f(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,t){if(!this.contentVisible)return;let n=t.count;t=this.getObject(e,t.data,t),t.count=n;let r=this.#g(this.current.fillAlpha),i=this.ctx,a=this._createMaskCanvas(e,t),o=a.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(o,a.offsetX,a.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(e),i.restore(),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),this.#_(r)}paintImageMaskXObjectRepeat(e,t,n,r=0,i=0,a,o){if(!this.contentVisible)return;t=this.getObject(e,t.data,t);let s=this.#g(this.current.fillAlpha),c=this.ctx;c.save();let l=RC(c);c.transform(n,r,i,a,0,0);let u=this._createMaskCanvas(e,t);c.setTransform(1,0,0,1,u.offsetX-l[4],u.offsetY-l[5]),this.dependencyTracker?.resetBBox(e);for(let t=0,s=o.length;t<s;t+=2){let s=Z.transform(l,[n,r,i,a,o[t],o[t+1]]);c.drawImage(u.canvas,s[4],s[5]),this.dependencyTracker?.recordBBox(e,this.ctx,s[4],s[4]+u.canvas.width,s[5],s[5]+u.canvas.height)}c.restore(),u.canvasEntry&&this.canvasFactory.destroy(u.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(e),this.#_(s)}paintImageMaskXObjectGroup(e,t){if(!this.contentVisible)return;let n=this.#g(this.current.fillAlpha),r=this.ctx,i=this.current.fillColor,a=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,Lw.transformAndFill);for(let n of t){let{data:t,width:o,height:s,transform:c}=n,l=this.canvasFactory.create(o,s),u=l.context;u.save(),XT(u,this.getObject(e,t,n)),u.globalCompositeOperation=`source-in`,u.fillStyle=a?i.getPattern(u,this,zC(r),AT.FILL,e):i,u.fillRect(0,0,o,s),u.restore(),r.save(),r.transform(...c),r.scale(1,-1),qT(r,l.canvas,0,0,o,s,0,-1,1,1),this.canvasFactory.destroy(l),this.dependencyTracker?.recordBBox(e,r,0,o,0,s),r.restore()}this.compose(),this.dependencyTracker?.recordOperation(e),this.#_(n)}paintImageXObject(e,t){if(!this.contentVisible)return;let n=this.getObject(e,t);if(!n){WS(`Dependent image isn't ready yet`);return}this.paintInlineImageXObject(e,n)}paintImageXObjectRepeat(e,t,n,r,i){if(!this.contentVisible)return;let a=this.getObject(e,t);if(!a){WS(`Dependent image isn't ready yet`);return}let o=a.width,s=a.height,c=[];for(let e=0,t=i.length;e<t;e+=2)c.push({transform:[n,0,0,r,i[e],i[e+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(e,a,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps!==`none`&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter=`none`),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps===`none`)return{img:e.bitmap,canvasEntry:null};let{bitmap:t,width:n,height:r}=e,i=this.canvasFactory.create(n,r),a=i.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter=`none`,{img:i.canvas,canvasEntry:i}}paintInlineImageXObject(e,t){if(!this.contentVisible)return;let n=t.width,r=t.height,i=this.#g(this.current.fillAlpha),a=this.ctx;this.save(e);let{filter:o}=a;o!==`none`&&o!==``&&(a.filter=`none`),a.scale(1/n,-1/r);let s,c=null;if(t.bitmap){let e=this.applyTransferMapsToBitmap(t);s=e.img,c=e.canvasEntry}else{let e=this.canvasFactory.create(n,r);YT(e.context,t),s=this.applyTransferMapsToCanvas(e.context),c=e}let l=this._scaleImage(s,zC(a));a.imageSmoothingEnabled=$T(RC(a),t.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(e).recordBBox(e,a,0,n,-r,0).recordDependencies(e,Lw.imageXObject).recordOperation(e),this.imagesTracker?.record(a,n,r,this.dependencyTracker.clipBox)),qT(a,l.img,0,0,l.paintWidth,l.paintHeight,0,-r,n,r),l.tmpCanvas&&this.canvasFactory.destroy(l.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(e),this.#_(i)}paintInlineImageXObjectGroup(e,t,n){if(!this.contentVisible)return;let r=this.#g(this.current.fillAlpha),i=this.ctx,a,o=null;if(t.bitmap)a=t.bitmap;else{let e=t.width,n=t.height,r=this.canvasFactory.create(e,n);YT(r.context,t),a=this.applyTransferMapsToCanvas(r.context),o=r}this.dependencyTracker?.resetBBox(e);for(let t of n)i.save(),i.transform(...t.transform),i.scale(1,-1),qT(i,a,t.x,t.y,t.w,t.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,i,0,1,-1,0),i.restore();o&&this.canvasFactory.destroy(o),this.dependencyTracker?.recordOperation(e),this.compose(),this.#_(r)}paintSolidColorImageMask(e){if(!this.contentVisible)return;let t=this.#g(this.current.fillAlpha);this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,Lw.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),this.#_(t)}markPoint(e,t){}markPointProps(e,t,n){}beginMarkedContent(e,t){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,n){this.dependencyTracker?.beginMarkedContent(e),t===`OC`?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,n){let r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let i=this.ctx;this.pendingClip?(r||(this.pendingClip===rE?i.clip(t,`evenodd`):i.clip(t)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency(`clipPath`,e)):this.dependencyTracker?.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=RC(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:t,b:n,c:r,d:i}=this.ctx.getTransform(),a,o;if(n===0&&r===0){let n=Math.abs(t),r=Math.abs(i);if(n===r){if(e===0)a=o=1/n;else{let t=n*e;a=o=t<1?1/t:1}}else if(e===0)a=1/n,o=1/r;else{let t=n*e,i=r*e;a=t<1?1/t:1,o=i<1?1/i:1}}else{let s=Math.abs(t*i-n*r),c=Math.hypot(t,n),l=Math.hypot(r,i);if(e===0)a=l/s,o=c/s;else{let t=e*s;a=l>t?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,n){let{ctx:r,current:{lineWidth:i}}=this,[a,o]=this.getScaleForStroking();if(a===o){r.lineWidth=(i||1)*a,r.stroke(t);return}let s=e.#e??=new DOMMatrix,c=r.getLineDash();n&&r.save(),r.scale(a,o),s.a=1/a,s.d=1/o;let l=new Path2D;if(l.addPath(t,s),c.length>0){let e=Math.max(a,o);r.setLineDash(c.map(t=>t/e)),r.lineDashOffset/=e}r.lineWidth=i||1,r.stroke(l),n&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(let e in LS)iE.prototype[e]!==void 0&&(iE.prototype[LS[e]]=iE.prototype[e]);var aE=class{#e=null;#t=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(e,t,n){this._source=e,this.#e=t,this.#t=n}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return KS(!this._fullReader,`BasePDFStream.getFullReader can only be called once.`),this._fullReader=new this.#e(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new this.#t(this,e,t);return this._rangeReaders.add(n),n}cancelAllRequests(e){this._fullReader?.cancel(e);for(let t of new Set(this._rangeReaders))t.cancel(e)}},oE=class{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(e){this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){GS("Abstract method `read` called")}cancel(e){GS("Abstract method `cancel` called")}},sE=class{_stream=null;constructor(e,t,n){this._stream=e}async read(){GS("Abstract method `read` called")}cancel(e){GS("Abstract method `cancel` called")}};function cE(e){let t=!0,n=r(`filename\\*`,`i`).exec(e);if(n){n=n[1];let e=s(n);return e=unescape(e),e=c(e),e=l(e),a(e)}if(n=o(e),n)return a(l(n));if(n=r(`filename`,`i`).exec(e),n){n=n[1];let e=s(n);return e=l(e),a(e)}function r(e,t){return RegExp(`(?:^|;)\\s*`+e+`\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)`,t)}function i(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{let r=new TextDecoder(e,{fatal:!0}),i=aC(n);n=r.decode(i),t=!1}catch{}}return n}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=i(`utf-8`,e),t&&(e=i(`iso-8859-1`,e))),e}function o(e){let t=[],n,i=r(`filename\\*((?!0\\d)\\d+)(\\*?)`,`ig`);for(;(n=i.exec(e))!==null;){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(e===0)break;continue}t[e]=[r,i]}let a=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=s(r),n&&(r=unescape(r),e===0&&(r=c(r))),a.push(r)}return a.join(``)}function s(e){if(e.startsWith(`"`)){let t=e.slice(1).split(`\\"`);for(let e=0;e<t.length;++e){let n=t[e].indexOf(`"`);n!==-1&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,`$1`)}e=t.join(`"`)}return e}function c(e){let t=e.indexOf(`'`);return t===-1?e:i(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,``))}function l(e){return!e.startsWith(`=?`)||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(e,t,n,r){if(n===`q`||n===`Q`)return r=r.replaceAll(`_`,` `),r=r.replaceAll(/=([0-9a-f]{2})/gi,function(e,t){return String.fromCharCode(parseInt(t,16))}),i(t,r);try{r=atob(r)}catch{}return i(t,r)})}return``}function lE(e,t){let n=new Headers;if(!e||!t||typeof t!=`object`)return n;for(let e in t){let r=t[e];r!==void 0&&n.append(e,r)}return n}function uE(e){let t=e.length;for(;t>0&&e[t-1]!==` `&&/\s/.test(e[t-1]);)t--;return e.slice(0,t)}function dE(e){return URL.parse(e)?.origin??null}function fE({responseHeaders:e,isHttp:t,rangeChunkSize:n,disableRange:r}){let i={contentLength:0,isRangeSupported:!1},a=parseInt(e.get(`Content-Length`),10);return!Number.isInteger(a)||(i.contentLength=a,a<=2*n)||r||!t||e.get(`Accept-Ranges`)!==`bytes`||(e.get(`Content-Encoding`)||`identity`)===`identity`&&(i.isRangeSupported=!0),i}function pE(e){let t=e.get(`Content-Disposition`);if(t){let e=cE(t);if(e.includes(`%`))try{e=decodeURIComponent(e)}catch{}if(DC(e))return e}return null}function mE(e,t){return new tC(`Unexpected server response (${e}) while retrieving PDF "${t.href}".`,e,e===404||e===0&&t.protocol===`file:`)}function hE(e,t){if(e!==t)throw Error(`Expected range response-origin "${e}" to match "${t}".`)}function gE(e,t,n,r){return fetch(e,{method:`GET`,headers:t,signal:r.signal,mode:`cors`,credentials:n?`include`:`same-origin`,redirect:`follow`})}function _E(e,t){if(e!==200&&e!==206)throw mE(e,t)}function vE(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw Error(`getArrayBuffer - unexpected data: ${e}`)}var yE=class extends aE{_responseOrigin=null;constructor(e){super(e,bE,xE);let{httpHeaders:t,url:n}=e;KS(/https?:/.test(n.protocol),`PDFFetchStream only supports http(s):// URLs.`),this.headers=lE(!0,t)}},bE=class extends oE{_abortController=new AbortController;_reader=null;constructor(e){super(e);let{disableRange:t,disableStream:n,rangeChunkSize:r,url:i,withCredentials:a}=e._source;this._isStreamingSupported=!n,gE(i,new Headers(e.headers),a,this._abortController).then(n=>{e._responseOrigin=dE(n.url),_E(n.status,i),this._reader=n.body.getReader();let a=n.headers,{contentLength:o,isRangeSupported:s}=fE({responseHeaders:a,isHttp:!0,rangeChunkSize:r,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=pE(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new rC(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:vE(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},xE=class extends sE{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r,withCredentials:i}=e._source,a=new Headers(e.headers);a.append(`Range`,`bytes=${t}-${n-1}`),gE(r,a,i,this._abortController).then(t=>{hE(dE(t.url),e._responseOrigin),_E(t.status,r),this._reader=t.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:vE(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};function SE(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function CE(){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}var wE=class extends aE{_progressiveDone=!1;_queuedChunks=[];constructor(e){super(e,TE,EE);let{pdfDataRangeTransport:t}=e,{initialData:n,progressiveDone:r}=t;if(n?.length>0){let e=SE(n);this._queuedChunks.push(e)}this._progressiveDone=r,t.transportReady(e=>{switch(e.type){case`range`:case`progressiveRead`:this.#e(e.begin,e.chunk);break;case`progressiveDone`:this._fullReader?.progressiveDone(),this._progressiveDone=!0}})}#e(e,t){let n=SE(t);if(e===void 0)this._fullReader?this._fullReader._enqueue(n):this._queuedChunks.push(n);else{let t=this._rangeReaders.keys().find(t=>t._begin===e);KS(t,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),t._enqueue(n)}}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onDone=()=>this._rangeReaders.delete(n),this._source.pdfDataRangeTransport.requestDataRange(e,t)),n}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}},TE=class extends oE{#e=CE.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(e){super(e);let{pdfDataRangeTransport:t,disableRange:n,disableStream:r}=e._source,{length:i,contentDispositionFilename:a}=t;this._queuedChunks=e._queuedChunks||[];for(let e of this._queuedChunks)this._loaded+=e.byteLength;this._done=e._progressiveDone,this._contentLength=i,this._isStreamingSupported=!r,this._isRangeSupported=!n,DC(a)&&(this._filename=a),this._headersCapability.resolve();let o=this._loaded;Promise.resolve().then(()=>{o>0&&this._loaded===o&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e()}progressiveDone(){this._done||=!0,this._queuedChunks.length===0&&this.#e()}},EE=class extends sE{#e=CE.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(e,t,n){super(e,t,n),this._begin=t}_enqueue(e){this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),this.#e()),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this.onDone?.()}},DE=200,OE=206;function kE(e){return typeof e==`string`?aC(e).buffer:e}var AE=class extends aE{#e=new WeakMap;_responseOrigin=null;constructor(e){super(e,jE,ME);let{httpHeaders:t,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=lE(this.isHttp,t)}_request(e){let t=new XMLHttpRequest,n={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};this.#e.set(t,n),t.open(`GET`,this.url),t.withCredentials=this._source.withCredentials;for(let[e,n]of this.headers)t.setRequestHeader(e,n);return this.isHttp&&`begin`in e&&`end`in e?(t.setRequestHeader(`Range`,`bytes=${e.begin}-${e.end-1}`),n.validateStatus=e=>e===OE||e===DE):n.validateStatus=e=>e===DE,t.responseType=`arraybuffer`,KS(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>e.onError(t.status),t.onreadystatechange=this.#n.bind(this,t),t.onprogress=this.#t.bind(this,t),t.send(null),t}#t(e,t){this.#e.get(e)?.onProgress?.(t)}#n(e,t){let n=this.#e.get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!this.#e.has(e))return;if(this.#e.delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let r=e.status||DE;if(!n.validateStatus(r)){n.onError(e.status);return}let i=kE(e.response);if(r===OE){let t=e.getResponseHeader(`Content-Range`);/bytes \d+-\d+\/\d+/.test(t)?n.onDone(i):(WS(`Missing or invalid "Content-Range" header.`),n.onError(0))}else i?n.onDone(i):n.onError(e.status)}_abortRequest(e){this.#e.has(e)&&(this.#e.delete(e),e.abort())}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}},jE=class extends oE{#e=CE.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(e){super(e),this._fullRequestXhr=e._request({onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:this.#i.bind(this)})}#t(){let e=this._stream,{disableRange:t,rangeChunkSize:n}=e._source,r=this._fullRequestXhr;e._responseOrigin=dE(r.responseURL);let i=r.getAllResponseHeaders(),a=new Headers(i?uE(i.trimStart()).split(/[\r\n]+/).map(e=>{let[t,...n]=e.split(`: `);return[t,n.join(`: `)]}):[]),{contentLength:o,isRangeSupported:s}=fE({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:n,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=pE(a),this._isRangeSupported&&e._abortRequest(r),this._headersCapability.resolve()}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&this.#e()}#r(e){this._storedError=mE(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#i(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),this.#e(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}},ME=class extends sE{#e=CE.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(e,t,n){super(e,t,n),this._requestXhr=e._request({begin:t,end:n,onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:null})}#t(){let e=dE(this._requestXhr?.responseURL);try{hE(e,this._stream._responseOrigin)}catch(e){this._storedError=e,this.#r(0)}}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this.#e(),this.onClosed?.()}#r(e){this._storedError??=mE(e,this._stream.url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};function NE(e,t=null){let n=process.getBuiltinModule(`fs`),{Readable:r}=process.getBuiltinModule(`stream`),i=n.createReadStream(e,t);return r.toWeb(i)}var PE=class extends aE{constructor(e){super(e,FE,IE);let{url:t}=e;KS(t.protocol===`file:`,`PDFNodeStream only supports file:// URLs.`)}},FE=class extends oE{_reader=null;constructor(e){super(e);let{disableRange:t,disableStream:n,rangeChunkSize:r,url:i}=e._source;this._isStreamingSupported=!n,process.getBuiltinModule(`fs/promises`).lstat(i).then(e=>{let n=NE(i);this._reader=n.getReader();let{size:a}=e;this._contentLength=a,this._isRangeSupported=!t&&a>2*r,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new rC(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(e=>{e.code===`ENOENT`&&(e=mE(0,i)),this._headersCapability.reject(e)})}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:vE(e),done:!1})}cancel(e){this._reader?.cancel(e)}},IE=class extends sE{_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r}=e._source;try{let e=NE(r,{start:t,end:n-1});this._reader=e.getReader(),this._readCapability.resolve()}catch(e){this._readCapability.reject(e)}}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:vE(e),done:!1}}cancel(e){this._reader?.cancel(e)}};function LE(e){return jC(e)?yE:bS?PE:AE}var RE=class{static#e=null;static#t=``;static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<`u`&&e instanceof Worker)&&e!==null)throw Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!=`string`)throw Error("Invalid `workerSrc` type.");this.#t=e}},zE=class{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}},BE=Symbol(`INTERNAL`),VE=class{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:t,intent:n,usage:r,rbGroups:i}){this.#e=!!(e&TS.DISPLAY),this.#t=!!(e&TS.PRINT),this.name=t,this.intent=n,this.usage=r,this.rbGroups=i}get visible(){if(this.#n)return this.#r;if(!this.#r)return!1;let{print:e,view:t}=this.usage;return this.#e?t?.viewState!==`OFF`:!this.#t||e?.printState!==`OFF`}_setVisible(e,t,n=!1){e!==BE&&GS("Internal method `_setVisible` called."),this.#n=n,this.#r=t}get serializable(){return{userSet:this.#n,visible:this.#r}}},HE=class e{#e=null;#t=new Map;#n=null;#r=null;#i;creator=null;name=null;constructor(e,t=TS.DISPLAY,n=null){if(this.#i=e,this.renderingIntent=t,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(let n of e.groups)this.#t.set(n.id,new VE(t,n));if(n){n.size!==this.#t.size&&GS(`Incorrect serialized groupState.`);for(let[e,t]of n)this.#t.get(e)._setVisible(BE,t.visible,t.userSet)}else{if(e.baseState===`OFF`)for(let e of this.#t.values())e._setVisible(BE,!1);for(let t of e.on)this.#t.get(t)._setVisible(BE,!0);for(let t of e.off)this.#t.get(t)._setVisible(BE,!1)}this.#n=this.getHash()}}#a(e){let t=e.length;if(t<2)return!0;let n=e[0];for(let r=1;r<t;r++){let t=e[r],i;if(Array.isArray(t))i=this.#a(t);else if(this.#t.has(t))i=this.#t.get(t).visible;else return WS(`Optional content group not found: ${t}`),!0;switch(n){case`And`:if(!i)return!1;break;case`Or`:if(i)return!0;break;case`Not`:return!i;default:return!0}}return n===`And`}isVisible(e){if(this.#t.size===0)return!0;if(!e)return US(`Optional content group not defined.`),!0;if(e.type===`OCG`)return this.#t.has(e.id)?this.#t.get(e.id).visible:(WS(`Optional content group not found: ${e.id}`),!0);if(e.type===`OCMD`){if(e.expression)return this.#a(e.expression);if(!e.policy||e.policy===`AnyOn`){for(let t of e.ids){if(!this.#t.has(t))return WS(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}if(e.policy===`AllOn`){for(let t of e.ids){if(!this.#t.has(t))return WS(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}if(e.policy===`AnyOff`){for(let t of e.ids){if(!this.#t.has(t))return WS(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}if(e.policy===`AllOff`){for(let t of e.ids){if(!this.#t.has(t))return WS(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return WS(`Unknown optional content policy ${e.policy}.`),!0}return WS(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){let r=this.#t.get(e);if(!r){WS(`Optional content group not found: ${e}`);return}if(n&&t&&r.rbGroups.length)for(let t of r.rbGroups)for(let n of t)n!==e&&this.#t.get(n)?._setVisible(BE,!1,!0);r._setVisible(BE,!!t,!0),this.#e=null}setOCGState({state:e,preserveRB:t}){let n;for(let r of e){switch(r){case`ON`:case`OFF`:case`Toggle`:n=r;continue}let e=this.#t.get(r);if(e)switch(n){case`ON`:this.setVisibility(r,!0,t);break;case`OFF`:this.setVisibility(r,!1,t);break;case`Toggle`:this.setVisibility(r,!e.visible,t)}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new Sw;for(let[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}get serializable(){let e=new Map;for(let[t,n]of this.#t)e.set(t,n.serializable);return{data:this.#i,renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:t,renderingIntent:n,groupState:r}){return new e(t,n,r)}},UE=class{#e=null;#t=null;#n=0;#r=null;#i=null;get pagesNumber(){return this.#n}set pagesNumber(e){this.#n!==e&&(this.#n=e,this.#e=null,this.#t=null)}#a(){if(this.#e)return;let e=this.#n,t=this.#e=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=n+1;this.#t=new Int32Array(t)}#o(){let e=new Map,t=this.#e;for(let n=0,r=this.#n;n<r;n++){let r=t[n],i=e.get(r);i?i.push(n+1):e.set(r,[n+1])}return e}movePages(e,t,n){this.#a();let r=this.#e,i=t.length,a=new Uint32Array(i),o=0;for(let e=0;e<i;e++){let i=t[e]-1;a[e]=r[i],i<n&&o++}let s=this.#n,c=s-i,l=new Int32Array(s),u=_C(n-o,0,c);for(let t=0,n=0;t<s;t++)e.has(t+1)||(r[n]=r[t],l[n++]=t+1);r.copyWithin(u+i,u,c),r.set(a,u),l.copyWithin(u+i,u,c),l.set(t,u),this.#t=l,r.every((e,t)=>e===t+1)&&(this.#e=null)}deletePages(e){this.#a();let t=this.#e,n=this.#o();this.#i={pageNumberToId:t.slice(),pagesNumber:this.#n,prevPageNumbers:this.#t.slice()};let r=this.#n-e.length;this.#n=r;let i=this.#e=new Uint32Array(r);this.#t=new Int32Array(r);let a=0,o=0;for(let n of e){let e=n-1;e!==a&&(i.set(t.subarray(a,e),o),o+=e-a),a=e+1}a<t.length&&i.set(t.subarray(a),o),this.#s(n,new Set(e))}cancelDelete(){this.#i&&=(this.#e=this.#i.pageNumberToId,this.#n=this.#i.pagesNumber,this.#t=this.#i.prevPageNumbers,null)}cleanSavedData(){this.#i=null}copyPages(e){this.#a(),this.#r={pageNumbers:e,pageIds:e.map(e=>this.#e[e-1])}}cancelCopy(){this.#r=null}pastePages(e){this.#a();let t=this.#e,n=this.#o(),{pageNumbers:r,pageIds:i}=this.#r,a=this.#n+r.length;this.#n=a;let o=this.#e=new Uint32Array(a);this.#t=new Int32Array(a),o.set(t.subarray(0,e),0),o.set(i,e),o.set(t.subarray(e),e+r.length),this.#s(n,null,e,r),this.#r=null}#s(e,t=null,n=-1,r=null){let i=this.#t,a=this.#e,o=n+(r?.length??0),s=new Map;for(let c=0,l=this.#n;c<l;c++){if(c>=n&&c<o){i[c]=-r[c-n];continue}let l=a[c],u=e.get(l),d=s.get(l)||0;if(t&&u)for(;d<u.length&&t.has(u[d]);)d++;i[c]=u?.[d],s.set(l,d+1)}}hasBeenAltered(){return this.#e!==null}#c(e=null){if(!this.#e)return null;let t=new Int32Array(this.#n).fill(-1),n=new Map;if(e)for(let r of e){let e=this.getPageId(r),i=n.get(e)??0;n.set(e,i+1),t[r-1]=i}else for(let e=0,r=this.#n;e<r;e++){let r=this.#e[e],i=n.get(r)??0;n.set(r,i+1),t[e]=i}return t}getPageMappingForSaving(e=null,t=this.#c()){e??=this.#o();let n=0;for(let t of e.values())n=Math.max(n,t.length);let r=Array(n);for(let e=0;e<n;e++)r[e]={document:null,pageIndices:[],includePages:[]};for(let[t,n]of e)for(let e=0,i=n.length;e<i;e++)r[e].includePages.push([t-1,n[e]-1]);for(let{includePages:e,pageIndices:t}of r){e.sort((e,t)=>e[0]-t[0]);for(let n=0,r=e.length;n<r;n++)t.push(e[n][1]),e[n]=e[n][0]}return{pageInfos:r,copyLevels:t}}extractPages(e){e=Array.from(e).sort((e,t)=>e-t);let t=new Map;for(let n=0,r=e.length;n<r;n++){let r=this.getPageId(e[n]);t.getOrInsertComputed(r,pC).push(n+1)}return this.getPageMappingForSaving(t,this.#c(e))}getPrevPageNumber(e){return this.#t?.[e-1]??0}getPageNumber(e){if(!this.#e)return e;let t=this.#e;for(let n=0,r=this.#n;n<r;n++)if(t[n]===e)return n+1;return 0}getPageId(e){return this.#e?.[e-1]??e}getMapping(){return this.#e?.subarray(0,this.pagesNumber)}},WE=Symbol(`INITIAL_DATA`),GE=()=>({...Promise.withResolvers(),data:WE}),KE=class{#e=new Map;get(e,t=null){if(t){let n=this.#e.getOrInsertComputed(e,GE);return n.promise.then(()=>t(n.data)),null}let n=this.#e.get(e);if(!n||n.data===WE)throw Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){let t=this.#e.get(e);return!!t&&t.data!==WE}delete(e){let t=this.#e.get(e);return!t||t.data===WE?!1:(this.#e.delete(e),!0)}resolve(e,t=null){let n=this.#e.getOrInsertComputed(e,GE);if(n.data!==WE)throw Error(`Object already resolved ${e}.`);n.data=t,n.resolve()}clear(){for(let{data:e}of this.#e.values())e?.bitmap?.close();this.#e.clear()}*[Symbol.iterator](){for(let[e,{data:t}]of this.#e)t!==WE&&(yield[e,t])}},qE=1e5,JE=30,YE=class e{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#i=null;#a=null;#o=null;#s=0;#c=0;#l=null;#u=null;#d=0;#f=0;#p=Object.create(null);#m=[];#h=null;#g=[];#_=new WeakMap;#v=null;static#y=new Map;static#b=new Map;static#x=new WeakMap;static#S=null;static#C=new Set;constructor({textContentSource:t,images:n,container:r,viewport:i}){if(t instanceof ReadableStream)this.#h=t;else if(typeof t==`object`)this.#h=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error(`No "textContentSource" parameter specified.`);this.#t=this.#u=r,this.#i=n,this.#f=i.scale*VC.pixelRatio,this.#d=i.rotation,this.#o={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:o,pageX:s,pageY:c}=i.rawDims;this.#v=[1,0,0,-1,-s,c+o],this.#c=a,this.#s=o,e.#k(),r.style.setProperty(`--min-font-size`,e.#S),BC(r,i),this.#e.promise.finally(()=>{e.#C.delete(this),this.#o=null,this.#p=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:t}=oC.platform;return X(this,`fontFamilyMap`,new Map([[`sans-serif`,`${e&&t?`Calibri, `:``}sans-serif`],[`monospace`,`${e&&t?`Lucida Console, `:``}monospace`]]))}render(){this.#i&&this.#t.append(this.#i.render());let t=()=>{this.#l.read().then(({value:e,done:n})=>{if(n){this.#e.resolve();return}this.#a??=e.lang,Object.assign(this.#p,e.styles),this.#w(e.items),t()},this.#e.reject)};return this.#l=this.#h.getReader(),e.#C.add(this),t(),this.#e.promise}update({viewport:t,onBefore:n=null}){let r=t.scale*VC.pixelRatio,i=t.rotation;if(i!==this.#d&&(n?.(),this.#d=i,BC(this.#u,{rotation:i})),r!==this.#f){n?.(),this.#f=r;let t={div:null,properties:null,ctx:e.#D(this.#a)};for(let e of this.#g)t.properties=this.#_.get(e),t.div=e,this.#E(t)}}cancel(){let e=new rC(`TextLayer task cancelled.`);this.#l?.cancel(e).catch(()=>{}),this.#l=null,this.#e.reject(e)}get textDivs(){return this.#g}get textContentItemsStr(){return this.#m}#w(t){if(this.#n)return;this.#o.ctx??=e.#D(this.#a);let n=this.#g,r=this.#m;for(let e of t){if(n.length>qE){WS(`Ignoring additional textDivs for performance reasons.`),this.#n=!0;return}if(e.str===void 0){if(e.type===`beginMarkedContentProps`||e.type===`beginMarkedContent`){let t=this.#t;this.#t=document.createElement(`span`),this.#t.classList.add(`markedContent`),e.id&&this.#t.setAttribute(`id`,e.id),e.tag===`Artifact`&&(this.#t.ariaHidden=!0),t.append(this.#t)}else e.type===`endMarkedContent`&&(this.#t=this.#t.parentNode);continue}r.push(e.str),this.#T(e)}}#T(t){let n=document.createElement(`span`),r={angle:0,canvasWidth:0,hasText:t.str!==``,hasEOL:t.hasEOL,fontSize:0};this.#g.push(n);let i=Z.transform(this.#v,t.transform),a=Math.atan2(i[1],i[0]),o=this.#p[t.fontName];o.vertical&&(a+=Math.PI/2);let s=this.#r&&o.fontSubstitution||o.fontFamily;s=e.fontFamilyMap.get(s)||s;let c=Math.hypot(i[2],i[3]),l=c*e.#A(s,o,this.#a),u,d;a===0?(u=i[4],d=i[5]-l):(u=i[4]+l*Math.sin(a),d=i[5]-l*Math.cos(a));let f=n.style;f.left=`${(100*u/this.#c).toFixed(2)}%`,f.top=`${(100*d/this.#s).toFixed(2)}%`,f.setProperty(`--font-height`,`${c.toFixed(2)}px`),f.fontFamily=s,r.fontSize=c,n.setAttribute(`role`,`presentation`),n.textContent=t.str,n.dir=t.dir,this.#r&&(n.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),a!==0&&(r.angle=180/Math.PI*a);let p=!1;if(t.str.length>1)p=!0;else if(t.str!==` `&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(p=!0)}if(p&&(r.canvasWidth=o.vertical?t.height:t.width),this.#_.set(n,r),this.#o.div=n,this.#o.properties=r,this.#E(this.#o),r.hasText&&this.#t.append(n),r.hasEOL){let e=document.createElement(`br`);e.setAttribute(`role`,`presentation`),this.#t.append(e)}}#E(t){let{div:n,properties:r,ctx:i}=t,{style:a}=n;if(r.canvasWidth!==0&&r.hasText){let{fontFamily:t}=a,{canvasWidth:o,fontSize:s}=r;e.#O(i,s*this.#f,t);let{width:c}=i.measureText(n.textContent);c>0&&a.setProperty(`--scale-x`,o*this.#f/c)}r.angle!==0&&a.setProperty(`--rotate`,`${r.angle}deg`)}static cleanup(){if(!(this.#C.size>0)){this.#y.clear();for(let{canvas:e}of this.#b.values())e.remove();this.#b.clear()}}static#D(e=null){let t=this.#b.get(e||=``);if(!t){let n=document.createElement(`canvas`);n.style.cssText=`position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal`,n.lang=e,document.body.append(n),t=n.getContext(`2d`,{alpha:!1,willReadFrequently:!0}),this.#b.set(e,t),this.#x.set(t,{size:0,family:``})}return t}static#O(e,t,n){let r=this.#x.get(e);(t!==r.size||n!==r.family)&&(e.font=`${t}px ${n}`,r.size=t,r.family=n)}static#k(){if(this.#S!==null)return;let e=document.createElement(`div`);e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize=`1px`,e.style.position=`absolute`,e.textContent=`X`,document.body.append(e),this.#S=e.getBoundingClientRect().height,e.remove()}static#A(e,t,n){let r=this.#y.get(e);if(r)return r;let i=this.#D(n);i.canvas.width=i.canvas.height=JE,this.#O(i,JE,e);let a=i.measureText(``),o=a.fontBoundingBoxAscent,s=Math.abs(a.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let c=.8;return o?c=o/(o+s):(oC.platform.isFirefox&&WS("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?c=t.ascent:t.descent&&(c=1+t.descent)),this.#y.set(e,c),c}},XE=100;function ZE(e={}){let t=new QE,{docId:n}=t,r=e.url?eT(e.url):null,i=e.data?tT(e.data):null,a=e.httpHeaders||null,o=e.withCredentials===!0,s=e.password??null,c=e.range instanceof $E?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:2**16,u=e.worker instanceof nD?e.worker:null,d=e.verbosity,f=typeof e.docBaseUrl==`string`&&!EC(e.docBaseUrl)?e.docBaseUrl:null,p=nT(e.cMapUrl),m=e.cMapPacked!==!1,h=nT(e.iccUrl),g=nT(e.standardFontDataUrl),_=nT(e.wasmUrl),v=e.stopAtErrors!==!0,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=typeof e.isOffscreenCanvasSupported==`boolean`?e.isOffscreenCanvasSupported:!bS,x=typeof e.isImageDecoderSupported==`boolean`?e.isImageDecoderSupported:!bS,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,C=typeof e.disableFontFace==`boolean`?e.disableFontFace:bS,w=e.fontExtraProperties===!0,T=e.enableXfa===!0,E=e.ownerDocument||globalThis.document,D=e.disableRange===!0,O=e.disableStream===!0,k=e.disableAutoFetch===!0,A=e.pdfBug===!0,j=e.CanvasFactory||(bS?bT:mT),M=e.FilterFactory||(bS?yT:gT),N=e.BinaryDataFactory||(bS?xT:fT),P=e.enableHWA===!0,F=e.enableWebGPU===!0?ET():Promise.resolve(!1),I=e.useWasm!==!1,L=e.pagesMapper||new UE,R=typeof e.useSystemFonts==`boolean`?e.useSystemFonts:!bS&&!C,z=typeof e.useWorkerFetch==`boolean`?e.useWorkerFetch:!!(N===fT&&p&&m&&g&&_&&jC(p,document.baseURI)&&jC(g,document.baseURI)&&jC(_,document.baseURI));VS(d);let ee={canvasFactory:new j({ownerDocument:E,enableHWA:P}),filterFactory:new M({docId:n,ownerDocument:E}),binaryDataFactory:z?null:new N({cMapUrl:p,standardFontDataUrl:g,wasmUrl:_})};u||(u=nD.create({verbosity:d,port:RE.workerPort}),t._worker=u);let B={docId:n,apiVersion:`6.3.289`,data:i,password:s,disableAutoFetch:k,rangeChunkSize:l,docBaseUrl:f,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:C,ignoreErrors:v,isOffscreenCanvasSupported:b,isImageDecoderSupported:x,canvasMaxAreaInBytes:S,fontExtraProperties:w,useSystemFonts:R,useWasm:I,useWorkerFetch:z,cMapUrl:p,cMapPacked:m,iccUrl:h,standardFontDataUrl:g,wasmUrl:_,hasGPU:!1}},V={ownerDocument:E,pdfBug:A,styleElement:null,enableHWA:P,loadingParams:{disableAutoFetch:k,enableXfa:T}};return Promise.all([u.promise,F]).then(function([,e]){if(u.destroyed)throw Error(`Worker was destroyed`);B.evaluatorOptions.hasGPU=e;let s=u.messageHandler.sendWithPromise(`GetDocRequest`,B,i?[i.buffer]:null),d;if(!i){if(c)d=new wE({pdfDataRangeTransport:c,disableRange:D,disableStream:O});else if(r)d=new(LE(r))({url:r,httpHeaders:a,withCredentials:o,rangeChunkSize:l,disableRange:D,disableStream:O});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.")}return s.then(e=>{if(u.destroyed)throw Error(`Worker was destroyed`);let r=new uT(n,e,u.port),i=new rD(r,t,d,V,ee,L);if(t._transport=i,t.destroyed)throw Error(`Loading aborted`);r.send(`Ready`,null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}var QE=class e{static#e=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${e.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}},$E=class{#e=Promise.withResolvers();#t=null;constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r}onDataRange(e,t){this.#t({type:`range`,begin:e,chunk:t})}onDataProgressiveRead(e){this.#e.promise.then(()=>{this.#t({type:`progressiveRead`,chunk:e})})}onDataProgressiveDone(){this.#e.promise.then(()=>{this.#t({type:`progressiveDone`})})}transportReady(e){this.#t=e,this.#e.resolve()}requestDataRange(e,t){GS(`Abstract method PDFDataRangeTransport.requestDataRange`)}abort(){}},eD=class{constructor(e,t){this._pdfInfo=e,this._transport=t}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return X(this,`isPureXfa`,!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e,t=null){return this._transport.extractPages(e,t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(e){return this._transport.getSignatureData(e)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},tD=class e{#e=!1;#t=null;constructor(e,t,n,r,i=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=i?new AC:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new KE,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#t=r,this.imageCoordinates=null}clone(t){let n=new e(t,this._pageInfo,this._transport,this.#t,this._pdfBug);return n.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(n),n}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new vC({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return X(this,`isPureXfa`,!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:t=e.canvas,viewport:n,intent:r=`display`,annotationMode:i=ES.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:s=null,annotationCanvasMap:c=null,pageColors:l=null,printAnnotationStorage:u=null,isEditing:d=!1,recordImages:f=!1,recordOperations:p=!1,operationsFilter:m=null}){this._stats?.time(`Overall`);let h=this._transport.getRenderingIntent(r,i,u,d),{renderingIntent:g,cacheKey:_}=h;this.#e=!1,s||=this._transport.getOptionalContentConfig(g);let v=this._intentStates.getOrInsertComputed(_,hC);v.streamReaderCancelTimeout&&=(clearTimeout(v.streamReaderCancelTimeout),null);let y=!!(g&TS.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(h));let b=!!(this._pdfBug&&globalThis.StepperManager?.enabled),x=!!t&&!this.recordedBBoxes&&(p||b),S=!!t&&!this.imageCoordinates&&f,C=e=>{if(v.renderTasks.delete(E),x){let e=E.gfx?.dependencyTracker.take();e&&(E.stepper?.setOperatorBBoxes(e,E.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=e))}S&&!e&&(this.imageCoordinates=E.gfx?.imagesTracker.take()),y&&(this.#e=!0),this.#n(),e?(E.capability.reject(e),this._abortOperatorList({intentState:v,reason:e instanceof Error?e:Error(e)})):E.capability.resolve(),this._stats&&(this._stats.timeEnd(`Rendering`),this._stats.timeEnd(`Overall`),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},w=null,T=null;(x||S)&&(T=new Pw(t,v.operatorList.length)),x&&(w=new Fw(T,b));let E=new aD({callback:C,params:{canvas:t,canvasContext:e,dependencyTracker:w??T,imagesTracker:S?new Rw(t):null,viewport:n,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:l,enableHWA:this._transport.enableHWA,operationsFilter:m});(v.renderTasks||=new Set).add(E);let D=E.task;return Promise.all([v.displayReadyCapability.promise,s]).then(([e,t])=>{if(this.destroyed){C();return}if(this._stats?.time(`Rendering`),!(t.renderingIntent&g))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");E.initializeGraphics({transparency:e,optionalContentConfig:t}),E.operatorListChanged()}).catch(C),D}getOperatorList({intent:e=`display`,annotationMode:t=ES.ENABLE,printAnnotationStorage:n=null,isEditing:r=!1}={}){function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(s))}let a=this._transport.getRenderingIntent(e,t,n,r,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,hC),s;return o.opListReadCapability||(s=Object.create(null),s.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(s),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream(`GetTextContent`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(e){return e.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(e=>yC.textContent(e));let t=this.streamTextContent(e),n={items:[],styles:Object.create(null),lang:null};for await(let e of t)n.lang??=e.lang,Object.assign(n.styles,e.styles),n.items.push(...e.items);return n}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:Error(`Page was destroyed.`),force:!0}),!t.opListReadCapability)for(let n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;let t=this.#n();return e&&t&&(this._stats&&=new AC),t}#n(){if(!this.#e||this.destroyed)return!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,t){let n=this._intentStates.get(t);n&&(this._stats?.timeEnd(`Page Request`),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(let e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#n()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:r}){let{map:i,transfer:a}=n,o=this._transport.messageHandler.sendWithStream(`GetOperatorList`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:r},void 0,a).getReader(),s=this._intentStates.get(t);s.streamReader=o;let c=()=>{o.read().then(({value:e,done:t})=>{if(t){s.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(e,s),c())},e=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(let e of s.renderTasks)e.operatorListChanged();this.#n()}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else if(s.opListReadCapability)s.opListReadCapability.reject(e);else throw e}})};c()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&=(clearTimeout(e.streamReaderCancelTimeout),null),!n){if(e.renderTasks.size>0)return;if(t instanceof TC){let n=XE;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new rC(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}},nD=class e{#e=Promise.withResolvers();#t=null;#n=null;#r=null;static#i=0;static#a=!1;static#o=new WeakMap;static{bS&&(this.#a=!0,RE.workerSrc||=`./pdf.worker.mjs`),this._isSameOrigin=(e,t)=>{let n=URL.parse(e);if(!n?.origin||n.origin===`null`)return!1;let r=new URL(t,n);return n.origin===r.origin},this._createCDNWrapper=e=>{let t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:`text/javascript`}))}}constructor({name:t=null,port:n=null,verbosity:r=HS()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=r,n){if(e.#o.has(n))throw Error(`Cannot use more than one PDFWorker per port.`);e.#o.set(n,this),this.#c(n)}else this.#l()}get promise(){return this.#e.promise}#s(){this.#e.resolve(),this.#t.send(`configure`,{verbosity:this.verbosity})}get port(){return this.#n}get messageHandler(){return this.#t}#c(e){this.#n=e,this.#t=new uT(`main`,`worker`,e),this.#t.on(`ready`,()=>{}),this.#s()}#l(){if(e.#a||e.#d){this.#u();return}let{workerSrc:t}=e;try{e._isSameOrigin(window.location,t)||(t=e._createCDNWrapper(new URL(t,window.location).href));let n=new Worker(t,{type:`module`}),r=new uT(`main`,`worker`,n),i=()=>{a.abort(),r.destroy(),n.terminate(),this.destroyed?this.#e.reject(Error(`Worker was destroyed`)):this.#u()},a=new AbortController;n.addEventListener(`error`,()=>{this.#r||i()},{signal:a.signal}),r.on(`test`,e=>{if(a.abort(),this.destroyed||!e){i();return}this.#t=r,this.#n=n,this.#r=n,this.#s()}),r.on(`ready`,e=>{if(a.abort(),this.destroyed){i();return}try{o()}catch{this.#u()}});let o=()=>{let e=new Uint8Array;r.send(`test`,e,[e.buffer])};o();return}catch{US(`The worker has been disabled.`)}this.#u()}#u(){e.#a||=(WS(`Setting up fake worker.`),!0),e._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#e.reject(Error(`Worker was destroyed`));return}let n=new aT;this.#n=n;let r=`fake${e.#i++}`,i=new uT(r+`_worker`,r,n);t.setup(i,n),this.#t=new uT(r,r+`_worker`,n),this.#s()}).catch(e=>{this.#e.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this.#r?.terminate(),this.#r=null,e.#o.delete(this.#n),this.#n=null,this.#t?.destroy(),this.#t=null}static create(t){let n=this.#o.get(t?.port);if(n){if(n._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new e(t)}static get workerSrc(){if(RE.workerSrc)return RE.workerSrc;throw Error(`No "GlobalWorkerOptions.workerSrc" specified.`)}static get#d(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return X(this,`_setupFakeWorkerGlobal`,(async()=>this.#d?this.#d:(await K(()=>import(this.workerSrc),[])).WorkerMessageHandler)())}},rD=class{downloadInfoCapability=Promise.withResolvers();#e=null;#t=new Map;#n=null;#r=new Map;#i=new Map;#a=new Map;#o=null;constructor(e,t,n,r,i,a){this.messageHandler=e,this.loadingTask=t,this.#n=n,this.commonObjs=new KE,this.fontLoader=new Hw({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.enableHWA=r.enableHWA,this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.binaryDataFactory=i.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){let{_pageIndex:t}=e;this.#r.set(t,e),this.#i.set(t,Promise.resolve(e))}#s(e,t=null){return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))}#c({loaded:e,total:t}){this.loadingTask.onProgress?.({loaded:e,total:t,percent:t?_C(Math.round(e/t*100),0,100):NaN})}get annotationStorage(){return X(this,`annotationStorage`,new ww)}getRenderingIntent(e,t=ES.ENABLE,n=null,r=!1,i=!1){let a=TS.DISPLAY,o=Cw;switch(e){case`any`:a=TS.ANY;break;case`display`:break;case`print`:a=TS.PRINT;break;default:WS(`getRenderingIntent - invalid intent: ${e}`)}let s=a&TS.PRINT&&n instanceof Tw?n:this.annotationStorage;switch(t){case ES.DISABLE:a+=TS.ANNOTATIONS_DISABLE;break;case ES.ENABLE:break;case ES.ENABLE_FORMS:a+=TS.ANNOTATIONS_FORMS;break;case ES.ENABLE_STORAGE:a+=TS.ANNOTATIONS_STORAGE,o=s.serializable;break;default:WS(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(a+=TS.IS_EDITING),i&&(a+=TS.OPLIST);let{ids:c,hash:l}=s.modifiedIds,u=[a,o.hash,l];return{renderingIntent:a,cacheKey:u.join(`_`),annotationStorageSerializable:o,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#o?.reject(Error(`Worker was destroyed during onPassword callback`));let e=[];for(let t of this.#r.values())e.push(t._destroy());this.#r.clear(),this.#i.clear(),this.#a.clear(),Object.hasOwn(this,`annotationStorage`)&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise(`Terminate`,null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),YE.cleanup(),this.#n?.cancelAllRequests(new rC(`Worker was terminated.`)),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on(`GetReader`,(e,t)=>{KS(this.#n,"GetReader - no `BasePDFStream` instance available."),this.#e=this.#n.getFullReader(),this.#e.onProgress=e=>this.#c(e),t.onPull=()=>{this.#e.read().then(function({value:e,done:n}){if(n){t.close();return}KS(e instanceof ArrayBuffer,`GetReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{this.#e.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`ReaderHeadersReady`,async e=>{await this.#e.headersReady;let{isStreamingSupported:t,isRangeSupported:n,contentLength:r}=this.#e;return t&&n&&(this.#e.onProgress=null),{isStreamingSupported:t,isRangeSupported:n,contentLength:r}}),e.on(`GetRangeReader`,(e,t)=>{KS(this.#n,"GetRangeReader - no `BasePDFStream` instance available.");let n=this.#n.getRangeReader(e.begin,e.end);if(!n){t.close();return}t.onPull=()=>{n.read().then(function({value:e,done:n}){if(n){t.close();return}KS(e instanceof ArrayBuffer,`GetRangeReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{n.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`GetDoc`,({pdfInfo:e})=>{this.pagesMapper.pagesNumber=e.numPages,this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new eD(e,this))}),e.on(`DocException`,e=>{t._capability.reject(lT(e))}),e.on(`PasswordRequest`,e=>{this.#o=Promise.withResolvers();try{if(!t.onPassword)throw lT(e);t.onPassword(e=>{e instanceof Error?this.#o.reject(e):this.#o.resolve({password:e})},e.code)}catch(e){this.#o.reject(e)}return this.#o.promise}),e.on(`DataLoaded`,e=>{this.#c({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on(`StartRenderPage`,e=>{this.destroyed||this.#r.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}),e.on(`commonobj`,([t,n,r])=>{if(this.destroyed||this.commonObjs.has(t))return null;switch(n){case`Font`:if(`error`in r){let e=r.error;WS(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let i=new Uw(new Zw(r),this._params.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,r.charProcOperatorList,r.extra);this.fontLoader.bind(i).catch(()=>e.sendWithPromise(`FontFallback`,{id:t})).finally(()=>{i.fontExtraProperties||i.clearData(),this.commonObjs.resolve(t,i)});break;case`CopyLocalImage`:let{imageRef:a}=r;KS(a,`The imageRef must be defined.`);for(let e of this.#r.values())for(let[,n]of e.objs){if(n?.ref!==a)continue;if(!n.dataLen)return null;let e=structuredClone(n);return this.commonObjs.resolve(t,e),n.dataLen}break;case`FontPath`:this.commonObjs.resolve(t,new $w(r));break;case`Image`:this.commonObjs.resolve(t,r);break;case`Pattern`:let o=new Qw(r);this.commonObjs.resolve(t,o.getIR());break;default:throw Error(`Got unknown common object type ${n}`)}return null}),e.on(`obj`,([e,t,n,r])=>{if(this.destroyed)return;let i=this.#r.get(t);if(!i.objs.has(e)){if(i._intentStates.size===0){r?.bitmap?.close();return}switch(n){case`Image`:case`Pattern`:i.objs.resolve(e,r);break;default:throw Error(`Got unknown object type ${n}`)}}}),e.on(`DocProgress`,e=>{this.destroyed||this.#c(e)}),e.on(`FetchBinaryData`,async e=>{if(this.destroyed)throw Error(`Worker was destroyed.`);if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(e)})}getData(){return this.messageHandler.sendWithPromise(`GetData`,null)}saveDocument(){this.annotationStorage.size<=0&&WS("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise(`SaveDocument`,{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this.#e?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e,t=null){let n={pageInfos:e},r,i=globalThis.ImageBitmap;if(typeof i==`function`){let t=Array.isArray(e)?e:[e];for(let e of t)e?.image instanceof i&&(r||=[]).push(e.image)}if(this.annotationStorage.size>0){let e=this.annotationStorage.serializable,{map:i}=e;e.transfer?.length&&(r?r.push(...e.transfer):r=e.transfer);let a=this.pagesMapper.getMapping();if(a){let e=new Map;for(let[n,r]of i){if(r?.pageIndex!==void 0&&r.pageIndex>=0&&r.pageIndex<a.length){let i=t?.[r.pageIndex]??0,o=a[r.pageIndex]-1;if(o!==r.pageIndex||i!==0){e.set(n,{...r,pageIndex:o,copyLevel:i});continue}}e.set(n,r)}i=e}n.annotationStorage=i}return this.messageHandler.sendWithPromise(`ExtractPages`,n,r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(Error(`Invalid page request.`));let t=e-1,n=this.pagesMapper.getPageId(e)-1,r=this.#i.get(t);if(r)return r;let i=this.messageHandler.sendWithPromise(`GetPage`,{pageIndex:n}).then(e=>{if(this.destroyed)throw Error(`Transport destroyed`);e.refStr&&this.#a.set(e.refStr,n);let r=new tD(t,e,this,this.pagesMapper,this._params.pdfBug);return this.#r.set(t,r),r});return this.#i.set(t,i),i}async getPageIndex(e){if(!rT(e))throw Error(`Invalid pageIndex request.`);let t=await this.messageHandler.sendWithPromise(`GetPageIndex`,{num:e.num,gen:e.gen}),n=this.pagesMapper.getPageNumber(t+1);if(n===0)throw Error(`GetPageIndex: page has been removed.`);return n-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise(`GetAnnotations`,{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return this.#s(`GetFieldObjects`)}getSignatures(){return this.#s(`GetSignatures`)}getSignatureData(e){return this.messageHandler.sendWithPromise(`GetSignatureData`,e)}hasJSActions(){return this.#s(`HasJSActions`)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise(`GetCalculationOrderIds`,null)}getDestinations(){return this.messageHandler.sendWithPromise(`GetDestinations`,null)}getDestination(e){return typeof e==`string`?this.messageHandler.sendWithPromise(`GetDestination`,{id:e}):Promise.reject(Error(`Invalid destination request.`))}getPageLabels(){return this.messageHandler.sendWithPromise(`GetPageLabels`,null)}getPageLayout(){return this.messageHandler.sendWithPromise(`GetPageLayout`,null)}getPageMode(){return this.messageHandler.sendWithPromise(`GetPageMode`,null)}getViewerPreferences(){return this.messageHandler.sendWithPromise(`GetViewerPreferences`,null)}getOpenAction(){return this.messageHandler.sendWithPromise(`GetOpenAction`,null)}getAttachments(){return this.messageHandler.sendWithPromise(`GetAttachments`,null)}getAttachmentContent(e){return this.messageHandler.sendWithPromise(`GetAttachmentContent`,e)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise(`GetAnnotationsByType`,{types:e,pageIndexesToSkip:t})}getDocJSActions(){return this.#s(`GetDocJSActions`)}getPageJSActions(e){return this.messageHandler.sendWithPromise(`GetPageJSActions`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise(`GetStructTree`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise(`GetOutline`,null)}getOptionalContentConfig(e){return this.#s(`GetOptionalContentConfig`).then(t=>new HE(t,e))}getPermissions(){return this.messageHandler.sendWithPromise(`GetPermissions`,null)}getMetadata(){let e=`GetMetadata`;return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new zE(e[1]):null,contentDispositionFilename:this.#e?.filename??null,contentLength:this.#e?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise(`GetMarkInfo`,null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise(`Cleanup`,null);for(let e of this.#r.values())if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0),YE.cleanup()}}cachedPageNumber(e){if(!rT(e))return null;let t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,n=this.#a.get(t);if(n>=0){let e=this.pagesMapper.getPageNumber(n+1);if(e!==0)return e}return null}},iD=class{_internalRenderTask=null;onContinue=null;onError=null;constructor(e){this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this._internalRenderTask;return e.form||e.canvas&&t?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},aD=class e{#e=null;static#t=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:a,pageIndex:o,canvasFactory:s,filterFactory:c,useRequestAnimationFrame:l=!1,pdfBug:u=!1,pageColors:d=null,enableHWA:f=!1,operationsFilter:p=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=c,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=l===!0&&typeof window<`u`,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new iD(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=f,this._dependencyTracker=t.dependencyTracker,this._imagesTracker=t.imagesTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:n}){if(this.cancelled)return;if(this._canvas){if(e.#t.has(this._canvas))throw Error(`Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.`);e.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:r,transform:i,background:a,dependencyTracker:o,imagesTracker:s}=this.params,c=this._canvasContext||this._canvas.getContext(`2d`,{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new iE(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,o,s),this.gfx.beginDrawing({transform:i,viewport:r,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,n=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&=(window.cancelAnimationFrame(this.#e),null),e.#t.delete(this._canvas),t||=new TC(`Rendering cancelled, page ${this._pageIndex+1}`,n),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),e.#t.delete(this._canvas),this.callback())))}},oD=`6.3.289`,sD=`1c8020a7d`,cD=class e{#e=null;#t=null;#n;#r=null;#i=!1;#a=!1;#o=null;#s;#c=null;#l=null;static#u=null;static get _keyboardManager(){return X(this,`_keyboardManager`,new cw([[[`Escape`],e.prototype._hideDropdownFromKeyboard],[[`Space`],e.prototype._colorSelectFromKeyboard],[[`ArrowDown`,`ArrowRight`],e.prototype._moveToNext],[[`ArrowUp`,`ArrowLeft`],e.prototype._moveToPrevious],[[`Home`],e.prototype._moveToBeginning],[[`End`],e.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:n=null}){t?(this.#a=!1,this.#o=t):this.#a=!0,this.#l=t?._uiManager||n,this.#s=this.#l._eventBus,this.#n=t?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||`#FFFF98`,e.#u||=Object.freeze({blue:`pdfjs-editor-colorpicker-blue`,green:`pdfjs-editor-colorpicker-green`,pink:`pdfjs-editor-colorpicker-pink`,red:`pdfjs-editor-colorpicker-red`,yellow:`pdfjs-editor-colorpicker-yellow`})}renderButton(){let e=this.#e=document.createElement(`button`);e.className=`colorPicker`,e.tabIndex=`0`,e.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-button`),e.ariaHasPopup=`true`,this.#o&&(e.ariaControls=`${this.#o.id}_colorpicker_dropdown`);let t=this.#l._signal;e.addEventListener(`click`,this.#m.bind(this),{signal:t}),e.addEventListener(`keydown`,this.#p.bind(this),{signal:t});let n=this.#t=document.createElement(`span`);return n.className=`swatch`,n.ariaHidden=`true`,n.style.backgroundColor=this.#n,e.append(n),e}renderMainDropdown(){let e=this.#r=this.#d();return e.ariaOrientation=`horizontal`,e.ariaLabelledBy=`highlightColorPickerLabel`,e}#d(){let t=document.createElement(`div`),n=this.#l._signal;t.addEventListener(`contextmenu`,MC,{signal:n}),t.className=`dropdown`,t.role=`listbox`,t.ariaMultiSelectable=`false`,t.ariaOrientation=`vertical`,t.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-dropdown`),this.#o&&(t.id=`${this.#o.id}_colorpicker_dropdown`);for(let[r,i]of this.#l.highlightColors){let a=document.createElement(`button`);a.tabIndex=`0`,a.role=`option`,a.setAttribute(`data-color`,i),a.title=r,a.setAttribute(`data-l10n-id`,e.#u[r]);let o=document.createElement(`span`);a.append(o),o.className=`swatch`,o.style.backgroundColor=i,a.ariaSelected=i===this.#n,a.addEventListener(`click`,this.#f.bind(this,i),{signal:n}),t.append(a)}return t.addEventListener(`keydown`,this.#p.bind(this),{signal:n}),t}#f(e,t){t.stopPropagation(),this.#s.dispatch(`switchannotationeditorparams`,{source:this,type:AS.HIGHLIGHT_COLOR,value:e}),this.update(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#m(e);return}let t=e.target.getAttribute(`data-color`);t&&this.#f(t,e)}_moveToNext(e){if(!this.#g){this.#m(e);return}if(e.target===this.#e){this.#r.firstElementChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#r?.firstElementChild||e.target===this.#e){this.#g&&this._hideDropdownFromKeyboard();return}this.#g||this.#m(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#g){this.#m(e);return}this.#r.firstElementChild?.focus()}_moveToEnd(e){if(!this.#g){this.#m(e);return}this.#r.lastElementChild?.focus()}#p(t){e._keyboardManager.exec(this,t)}#m(e){if(this.#g){this.hideDropdown();return}if(this.#i=e.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener(`pointerdown`,this.#h.bind(this),{signal:this.#l.combinedSignal(this.#c)})),this.#e.ariaExpanded=`true`,this.#r){this.#r.classList.remove(`hidden`);return}let t=this.#r=this.#d();this.#e.append(t)}#h(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add(`hidden`),this.#e.ariaExpanded=`false`,this.#c?.abort(),this.#c=null}get#g(){return this.#r&&!this.#r.classList.contains(`hidden`)}_hideDropdownFromKeyboard(){if(!this.#a){if(!this.#g){this.#o?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#i})}}update(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;let t=this.#l.highlightColors.values();for(let n of this.#r.children)n.ariaSelected=t.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}},lD=class e{#e=null;#t=!1;#n=null;#r=null;static#i=null;constructor(t){this.#n=t,this.#r=t._uiManager,e.#i||=Object.freeze({freetext:`pdfjs-editor-color-picker-free-text-input`,ink:`pdfjs-editor-color-picker-ink-input`})}renderButton(){if(this.#e)return this.#e;let{editorType:t,colorType:n,colorAndOpacityType:r,opacityType:i,color:a,opacity:o}=this.#n,s=this.#t=oC.isAlphaColorInputSupported&&i!==void 0,c=this.#e=document.createElement(`input`);if(c.type=`color`,s){c.setAttribute(`alpha`,``);let e=Z.hexNums[Math.round((o??1)*255)];c.value=(a||`#000000`)+e}else c.value=a||`#000000`;return c.className=`basicColorPicker`,c.tabIndex=0,c.setAttribute(`data-l10n-id`,e.#i[t]),c.addEventListener(`input`,()=>{if(s){let e=FC(c.value);if(!e)return;let[t,a,o,s]=e,l=Z.makeHexColor(t,a,o);r===void 0?(this.#r.updateParams(n,l),this.#r.updateParams(i,s)):this.#r.updateParams(r,{color:l,opacity:s})}else this.#r.updateParams(n,c.value)},{signal:this.#r._signal}),c}update(e){if(this.#e){if(this.#t){let t=Z.hexNums[Math.round(this.#n.opacity*255)];this.#e.value=e+t}else this.#e.value=e}}updateOpacity(e){if(!this.#e||!this.#t)return;let t=Z.hexNums[Math.round(e*255)];this.#e.value=this.#n.color+t}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}};function uD(e){return Math.floor(_C(e,0,1)*255).toString(16).padStart(2,`0`)}function dD(e){return _C(e,0,1)*255}var fD=class{static CMYK_G([e,t,n,r]){return[`G`,1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return[`CMYK`,0,0,0,1-e]}static G_RGB([e]){return[`RGB`,e,e,e]}static G_rgb([e]){return e=dD(e),[e,e,e]}static G_HTML([e]){let t=uD(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return[`G`,.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(dD)}static RGB_HTML(e){return`#${e.map(uD).join(``)}`}static T_HTML(){return`#00000000`}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return[`RGB`,1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,r]){return[dD(1-Math.min(1,e+r)),dD(1-Math.min(1,n+r)),dD(1-Math.min(1,t+r))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){let r=1-e,i=1-t,a=1-n;return[`CMYK`,r,i,a,Math.min(r,i,a)]}},pD=class{create(e,t,n=!1){if(e<=0||t<=0)throw Error(`Invalid SVG dimensions`);let r=this._createSVG(`svg:svg`);return r.setAttribute(`version`,`1.1`),n||(r.setAttribute(`width`,`${e}px`),r.setAttribute(`height`,`${t}px`)),r.setAttribute(`preserveAspectRatio`,`none`),r.setAttribute(`viewBox`,`0 0 ${e} ${t}`),r}createElement(e){if(typeof e!=`string`)throw Error(`Invalid SVG element type`);return this._createSVG(e)}_createSVG(e){GS("Abstract method `_createSVG` called.")}},mD=class extends pD{_createSVG(e){return document.createElementNS(wS,e)}},hD=9,gD=new WeakSet,_D=new Date().getTimezoneOffset()*60*1e3,vD=class{static create(e){switch(e.data.annotationType){case PS.LINK:return new xD(e);case PS.TEXT:return new SD(e);case PS.WIDGET:switch(e.data.fieldType){case`Tx`:return new wD(e);case`Btn`:return e.data.radioButton?new DD(e):e.data.checkBox?new ED(e):new OD(e);case`Ch`:return new kD(e);case`Sig`:return new TD(e)}return new CD(e);case PS.POPUP:return new AD(e);case PS.FREETEXT:return new MD(e);case PS.LINE:return new ND(e);case PS.SQUARE:return new PD(e);case PS.CIRCLE:return new FD(e);case PS.POLYLINE:return new ID(e);case PS.CARET:return new RD(e);case PS.INK:return new zD(e);case PS.POLYGON:return new LD(e);case PS.HIGHLIGHT:return new BD(e);case PS.UNDERLINE:return new VD(e);case PS.SQUIGGLY:return new HD(e);case PS.STRIKEOUT:return new UD(e);case PS.STAMP:return new WD(e);case PS.FILEATTACHMENT:return new GD(e);case PS.RICHMEDIA:case PS.SCREEN:case PS.SOUND:return new KD(e);default:return new yD(e)}}},yD=class e{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,t&&(this.contentElement=this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e?.str||t?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return e._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:e}=this,t=this.annotationStorage?.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;let{quadPoints:t,inkLists:n,rect:r}=this.data,i=-1/0,a=-1/0;if(t?.length>=8){for(let e=0;e<t.length;e+=8)t[e+1]>a?(a=t[e+1],i=t[e+2]):t[e+1]===a&&(i=Math.max(i,t[e+2]));return[i,a]}if(n?.length>=1){for(let e of n)for(let t=0,n=e.length;t<n;t+=2)e[t+1]>a?(a=e[t+1],i=e[t]):e[t+1]===a&&(i=Math.max(i,e[t]));if(i!==1/0)return[i,a]}return r?[r[2],r[3]]:null}_normalizePoint(e){let{page:{view:t},viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-i)/n,e[1]=100*(e[1]-a)/r,e}get commentText(){let{data:e}=this;return this.annotationStorage.getRawValue(`${OS}${e.id}`)?.popup?.contents||e.contentsObj?.str||``}set commentText(e){let{data:t}=this,n={deleted:!e,contents:e||``};this.annotationStorage.updateEditor(t.id,{popup:n})||this.annotationStorage.setValue(`${OS}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:n,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});let{rect:t,popup:n}=e;t&&this.#r(t);let r=this.#n?.popup||this.popup;!r&&n?.text&&(this._createPopup(n),r=this.#n.popup),r&&(r.updateEdited(e),n?.deleted&&(r.remove(),this.#n=null,this.popup=null))}resetEdited(){this.#e&&=(this.#r(this.#e.rect),this.#n?.popup.resetEdited(),null)}#r(e){let{container:{style:t},data:{rect:n,rotation:r},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:a,pageX:o,pageY:s}}}}=this;n?.splice(0,4,...e),t.left=`${100*(e[0]-o)/i}%`,t.top=`${100*(a-e[3]+s)/a}%`,r===0?(t.width=`${100*(e[2]-e[0])/i}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(r)}_createContainer(e){let{data:t,parent:{page:n,viewport:r}}=this,i=document.createElement(`section`);i.setAttribute(`data-annotation-id`,t.id),!(this instanceof CD)&&!(this instanceof xD)&&!(this instanceof KD)&&(i.tabIndex=0);let{style:a}=i;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add(`norotate`),!t.rect||this instanceof AD){let{rotation:e}=t;return!t.hasOwnCanvas&&e!==0&&this.setRotation(e,i),i}let{width:o,height:s}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;let e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;switch((e>0||n>0)&&(a.borderRadius=`calc(${e}px * var(--total-scale-factor)) / calc(${n}px * var(--total-scale-factor))`),t.borderStyle.style){case FS.SOLID:a.borderStyle=`solid`;break;case FS.DASHED:a.borderStyle=`dashed`;break;case FS.BEVELED:WS(`Unimplemented border style: beveled`);break;case FS.INSET:WS(`Unimplemented border style: inset`);break;case FS.UNDERLINE:a.borderBottomStyle=`solid`}let r=t.borderColor||null;r?(this.#t=!0,a.borderColor=Z.makeHexColor(...r)):a.borderWidth=0}let c=Z.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:l,pageHeight:u,pageX:d,pageY:f}=r.rawDims;a.left=`${100*(c[0]-d)/l}%`,a.top=`${100*(c[1]-f)/u}%`;let{rotation:p}=t;return t.hasOwnCanvas||p===0?(a.width=`${100*o/l}%`,a.height=`${100*s/u}%`):this.setRotation(p,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:i,height:a}=this;e%180!=0&&([i,a]=[a,i]),t.style.width=`${100*i/n}%`,t.style.height=`${100*a/r}%`,t.setAttribute(`data-main-rotation`,(360-e)%360)}get _commonActions(){let e=(e,t,n)=>{let r=n.detail[e],i=r[0],a=r.slice(1);n.target.style[t]=fD[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:fD[`${i}_rgb`](a)})};return X(this,`_commonActions`,{display:e=>{let{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:t===1||t===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:t}=e.detail;this.container.style.visibility=t?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e(`bgColor`,`backgroundColor`,t)},fillColor:t=>{e(`fillColor`,`backgroundColor`,t)},fgColor:t=>{e(`fgColor`,`color`,t)},textColor:t=>{e(`textColor`,`color`,t)},borderColor:t=>{e(`borderColor`,`borderColor`,t)},strokeColor:t=>{e(`strokeColor`,`borderColor`,t)},rotation:e=>{let t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){let n=this._commonActions;for(let r of Object.keys(t.detail))(e[r]||n[r])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let n=this._commonActions;for(let[r,i]of Object.entries(t)){let a=n[r];a&&(a({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[t,n,r,i]=this.data.rect.map(Math.fround);if(e.length===8){let[a,o,s,c]=e.subarray(2,6);if(r===a&&i===o&&t===s&&n===c)return}let{style:a}=this.container,o;if(this.#t){let{borderColor:e,borderWidth:t}=a;a.borderWidth=0,o=[`url('data:image/svg+xml;utf8,`,`<svg xmlns="${wS}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add(`hasBorder`)}let s=r-t,c=i-n,{svgFactory:l}=this,u=l.createElement(`svg`);u.classList.add(`quadrilateralsContainer`),u.setAttribute(`width`,0),u.setAttribute(`height`,0),u.role=`none`;let d=l.createElement(`defs`);u.append(d);let f=l.createElement(`clipPath`),p=`clippath_${this.data.id}`;f.setAttribute(`id`,p),f.setAttribute(`clipPathUnits`,`objectBoundingBox`),d.append(f);for(let n=2,r=e.length;n<r;n+=8){let r=e[n],a=e[n+1],u=e[n+2],d=e[n+3],p=l.createElement(`rect`),m=(u-t)/s,h=(i-a)/c,g=(r-u)/s,_=(a-d)/c;p.setAttribute(`x`,m),p.setAttribute(`y`,h),p.setAttribute(`width`,g),p.setAttribute(`height`,_),f.append(p),o?.push(`<rect vector-effect="non-scaling-stroke" x="${m}" y="${h}" width="${g}" height="${_}"/>`)}this.#t&&(o.push(`</g></svg>')`),a.backgroundImage=o.join(``)),this.container.append(u),this.container.style.clipPath=`url(#${p})`}_createPopup(e=null){let{data:t}=this,n,r;e?(n={str:e.text},r=e.date):(n=t.contentsObj,r=t.modificationDate),this.#n=new AD({data:{color:t.color,titleObj:t.titleObj,modificationDate:r,contentsObj:n,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){GS("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){let n=[];if(this._fieldObjects){let r=this._fieldObjects.get(e)||[];for(let{page:e,id:i,exportValues:a}of r){if(e===-1||i===t)continue;let r=typeof a==`string`?a:null,o=document.querySelector(`[data-element-id="${i}"]`);if(o&&!gD.has(o)){WS(`_getElementsByName - element not allowed: ${i}`);continue}n.push({id:i,exportValue:r,domElement:o})}return n}for(let r of document.getElementsByName(e)){let{exportValue:e}=r,i=r.getAttribute(`data-element-id`);i!==t&&gD.has(r)&&n.push({id:i,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add(`highlightArea`);else e.classList.add(`highlightArea`)}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener(`dblclick`,()=>{this.linkService.eventBus?.dispatch(`switchannotationeditormode`,{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}updateOC(e){this.data.oc&&e&&(e.isVisible(this.data.oc)?this.show():this.hide())}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?`transparent`:Z.makeHexColor(...t)}},bD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className=`editorAnnotation`,this.container}createOrUpdatePopup(){let{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},xD=class extends yD{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,n=document.createElement(`a`);n.setAttribute(`data-element-id`,e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action,e.overlaidText),r=!0):e.attachment?(this.#t(n,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),r=!0):e.setOCGState?(this.#n(n,e.setOCGState,e.overlaidText),r=!0):e.dest?(this._bindLink(n,e.dest,e.overlaidText),r=!0):(e.actions&&(e.actions.has(`Action`)||e.actions.has(`Mouse Up`)||e.actions.has(`Mouse Down`))&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,``),r=!0)),this.container.classList.add(`linkAnnotation`),r&&(this.contentElement=n,this.container.append(n)),this.container}#e(){this.container.setAttribute(`data-internal-link`,``)}_bindLink(e,t,n=``){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t===``)&&this.#e(),n&&(e.title=n)}_bindNamedAction(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),n&&(e.title=n),this.#e()}#t(e,t,n,r=``,i=null){e.href=this.linkService.getAnchorUrl(``),n.description?e.title=n.description:r&&(e.title=r);let a=async()=>{let e=await this.linkService.getAttachmentContent(t);e&&this.downloadManager?.openOrDownloadData(e,n.filename,i)};e.onclick=()=>(a(),!1),this.#e()}#n(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),n&&(e.title=n),this.#e()}_bindJSAction(e,{actions:t,id:n,overlaidText:r}){e.href=this.linkService.getAnchorUrl(``);let i=new Map([[`Action`,`onclick`],[`Mouse Up`,`onmouseup`],[`Mouse Down`,`onmousedown`]]);for(let r of t.keys()){let t=i.get(r);t&&(e[t]=()=>(this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:n,name:r}}),!1))}r&&(e.title=r),e.onclick||=()=>!1,this.#e()}_bindResetFormAction(e,t){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl(``)),this.#e(),!this._fieldObjects){WS('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();let{fields:e,refs:r,include:i}=t,a=[];if(e.length!==0||r.length!==0){let t=new Set(r);for(let n of e){let e=this._fieldObjects.get(n)||[];for(let{id:n}of e)t.add(n)}for(let e of this._fieldObjects.values())for(let n of e)t.has(n.id)===i&&a.push(n)}else for(let e of this._fieldObjects.values())a.push(...e);let o=this.annotationStorage,s=[];for(let e of a){let{id:t}=e;switch(s.push(t),e.type){case`text`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}case`checkbox`:case`radiobutton`:{let n=e.defaultValue===e.exportValues;o.setValue(t,{value:n});break}case`combobox`:case`listbox`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}default:continue}let n=document.querySelector(`[data-element-id="${t}"]`);if(n){if(!gD.has(n)){WS(`_bindResetFormAction - element not allowed: ${t}`);continue}n.dispatchEvent(new Event(`resetform`))}}return this.enableScripting&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:`app`,ids:s,name:`ResetForm`}}),!1}}},SD=class extends yD{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add(`textAnnotation`);let e=document.createElement(`img`);return e.src=this.imageResourcesPath+`annotation-`+this.data.name.toLowerCase()+`.svg`,e.setAttribute(`data-l10n-id`,`pdfjs-text-annotation-type`),e.setAttribute(`data-l10n-args`,JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}},CD=class extends yD{render(){return this.container}_getKeyModifier(e){return oC.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,r,i){n.includes(`mouse`)?e.addEventListener(n,e=>{this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(n,e=>{if(n===`blur`){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if(n===`focus`){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e)}})})}_setEventListeners(e,t,n,r){let{actions:i}=this.data;for(let[a,o]of n)(o===`Action`||i?.has(o))&&((o===`Focus`||o===`Blur`)&&(t||={focused:!1}),this._setEventListener(e,t,a,o,r),o===`Focus`&&!i?.has(`Blur`)?this._setEventListener(e,t,`blur`,`Blur`,null):o===`Blur`&&!i?.has(`Focus`)&&this._setEventListener(e,t,`focus`,`Focus`,null))}_setTextStyle(e){let t=[`left`,`center`,`right`],{fontColor:n}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||hD,i=e.style,a,o=e=>Math.round(10*e)/10;if(this.data.multiLine){let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(1.35*r))||1);a=Math.min(r,o(t/1.35))}else{let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(r,o(e/1.35))}i.fontSize=`calc(${a}px * var(--total-scale-factor))`,i.color=Z.makeHexColor(...n),this.data.textAlignment!==null&&!this.data.comb&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute(`required`,!0):e.removeAttribute(`required`),e.setAttribute(`aria-required`,t)}},wD=class extends CD{constructor(e){let t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,r){let i=this.annotationStorage;for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=n),i.setValue(a.id,{[r]:n})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add(`textWidgetAnnotation`);let n=null;if(this.renderForms){let r=e.getValue(t,{value:this.data.fieldValue}),i=r.value||``,a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let o=r.formattedValue||this.data.textContent?.join(`
`)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,``));let s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement(`textarea`),n.textContent=o??i,this.data.doNotScroll&&(n.style.overflowY=`hidden`)):(n=document.createElement(`input`),n.type=this.data.password?`password`:`text`,n.setAttribute(`value`,o??i),this.data.doNotScroll&&(n.style.overflowX=`hidden`)),this.data.hasOwnCanvas&&(this.container.classList.add(`hasOwnCanvas`),e.has(t)&&this.container.classList.add(`sandboxModified`)),gD.add(n),this.contentElement=n,n.setAttribute(`data-element-id`,t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:c,datetimeType:l,timeStep:u}=this.data,d=!!l&&this.enableScripting;c&&(n.title=c),this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener(`input`,r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,`value`,r.target.value,`value`),s.formattedValue=null}),n.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue??``;n.value=s.userValue=t,s.formattedValue=null});let f=e=>{let{formattedValue:t}=s;t!=null&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener(`focus`,e=>{if(s.focused)return;let{target:t}=e;if(d&&(t.type=l,u&&(t.step=u)),s.userValue){let e=s.userValue;if(d){if(l===`time`){let n=new Date(e);t.value=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>e.toString().padStart(2,`0`)).join(`:`)}else t.value=new Date(e-_D).toISOString().split(l===`date`?`T`:`.`,1)[0]}else t.value=e}s.lastCommittedValue=t.value,s.commitKey=1,this.data.actions?.has(`Focus`)||(s.focused=!0)}),n.addEventListener(`updatefromsandbox`,n=>{this.container.classList.add(`sandboxModified`),this._dispatchEventFromSandbox({value(n){s.userValue=n.detail.value??``,d||e.setValue(t,{value:s.userValue.toString()}),n.target.value=s.userValue},formattedValue(n){let{formattedValue:r}=n.detail;s.formattedValue=r,r!=null&&n.target!==document.activeElement&&(n.target.value=r);let i={formattedValue:r};d&&(i.value=r),e.setValue(t,i)},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{let{charLimit:r}=n.detail,{target:i}=n;if(r===0){i.removeAttribute(`maxLength`);return}i.setAttribute(`maxLength`,r);let a=s.userValue;!a||a.length<=r||(a=a.slice(0,r),i.value=s.userValue=a,e.setValue(t,{value:a}),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:a,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}},n)}),n.addEventListener(`keydown`,e=>{s.commitKey=1;let n=-1;if(e.key===`Escape`?n=0:e.key===`Enter`&&!this.data.multiLine?n=2:e.key===`Tab`&&(s.commitKey=3),n===-1)return;let{value:r}=e.target;s.lastCommittedValue!==r&&(s.lastCommittedValue=r,s.userValue=r,this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))});let r=f;f=null,n.addEventListener(`blur`,e=>{if(!s.focused||!e.relatedTarget)return;this.data.actions?.has(`Blur`)||(s.focused=!1);let{target:n}=e,{value:i}=n;if(d){if(i&&l===`time`){let e=i.split(`:`).map(e=>parseInt(e,10));i=new Date(2e3,0,1,e[0],e[1],e[2]||0).valueOf(),n.step=``}else i.includes(`T`)||(i=`${i}T00:00`),i=new Date(i).valueOf();n.type=`text`}s.userValue=i,s.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,willCommit:!0,commitKey:s.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)}),this.data.actions?.has(`Keystroke`)&&n.addEventListener(`beforeinput`,e=>{s.lastCommittedValue=null;let{data:n,target:r}=e,{value:i,selectionStart:a,selectionEnd:o}=r,c=a,l=o;switch(e.inputType){case`deleteWordBackward`:{let e=/\w/;for(;c>0&&!e.test(i[c-1]);)c--;for(;c>0&&e.test(i[c-1]);)c--;break}case`deleteWordForward`:{let e=i.substring(a).match(/^\W*\w*/);e&&(l+=e[0].length);break}case`deleteContentBackward`:a===o&&--c;break;case`deleteContentForward`:a===o&&(l+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,change:n||``,willCommit:!1,selStart:c,selEnd:l}})}),this._setEventListeners(n,s,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.value)}if(f&&n.addEventListener(`blur`,f),this.data.comb){let e=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add(`comb`),n.style.setProperty(`--comb-width`,`calc(${e}px * var(--total-scale-factor))`);let t=this.data.textAlignment;if(t===1||t===2){let e=()=>{let e=a-n.value.length;n.style.setProperty(`--comb-offset`,`${t===1?e>>1:e}`)};e();for(let t of[`input`,`blur`,`resetform`,`updatefromsandbox`])n.addEventListener(t,e)}}}else n=document.createElement(`div`),n.textContent=this.data.fieldValue,n.style.verticalAlign=`middle`,n.style.display=`table-cell`,this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},TD=class extends CD{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}},ED=class extends CD{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof r==`string`&&(r=r!==`Off`,e.setValue(n,{value:r})),this.container.classList.add(`buttonWidgetAnnotation`,`checkBox`);let i=document.createElement(`input`);return gD.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`checkbox`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.setAttribute(`exportValue`,t.exportValue),i.tabIndex=0,i.addEventListener(`change`,r=>{let{name:i,checked:a}=r.target;for(let r of this._getElementsByName(i,n)){let n=a&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:a})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue||`Off`;e.target.checked=n===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value(t){t.target.checked=t.detail.value!==`Off`,e.setValue(n,{value:t.target.checked})}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},DD=class extends CD{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`buttonWidgetAnnotation`,`radioButton`);let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.buttonValue!==null&&t.fieldValue===t.buttonValue}).value;if(typeof r==`string`&&(r=r!==t.buttonValue,e.setValue(n,{value:r})),r)for(let r of this._getElementsByName(t.fieldName,n))e.setValue(r.id,{value:!1});let i=document.createElement(`input`);if(gD.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`radio`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.tabIndex=0,i.addEventListener(`change`,t=>{let{name:r,checked:i}=t.target;for(let t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue;e.target.checked=n!=null&&n===t.buttonValue}),this.enableScripting&&this.hasJSActions){let r=t.buttonValue;i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value:t=>{let i=r===t.detail.value;for(let r of this._getElementsByName(t.target.name)){let t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)}return this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},OD=class extends xD{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add(`buttonWidgetAnnotation`,`pushButton`);let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener(`updatefromsandbox`,e=>{this._dispatchEventFromSandbox({},e)})),e}},kD=class extends CD{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`choiceWidgetAnnotation`);let e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement(`select`);gD.add(r),r.setAttribute(`data-element-id`,t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue;for(let e of r.options)e.selected=e.value===t});let a=(e,t)=>{let n=t.replaceAll(` `,`\xA0`);e.textContent=n,n!==t&&e.setAttribute(`display-value`,t)};for(let e of this.data.options){let t=document.createElement(`option`);a(t,e.displayValue),t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute(`selected`,!0),i=!1),r.append(t)}let o=null;if(i){let e=document.createElement(`option`);e.value=` `,e.setAttribute(`hidden`,!0),e.setAttribute(`selected`,!0),r.prepend(e),o=()=>{e.remove(),r.removeEventListener(`input`,o),o=null},r.addEventListener(`input`,o)}let s=e=>{let t=e?`value`:`textContent`,{options:n,multiple:i}=r;return i?Array.prototype.filter.call(n,e=>e.selected).map(e=>e[t]):n.selectedIndex===-1?null:n[n.selectedIndex][t]},c=s(!1),l=e=>{let t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.getAttribute(`display-value`)||e.textContent,exportValue:e.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener(`updatefromsandbox`,n=>{this._dispatchEventFromSandbox({value(n){o?.();let i=n.detail.value,a=new Set(Array.isArray(i)?i:[i]);for(let e of r.options)e.selected=a.has(e.value);e.setValue(t,{value:s(!0)}),c=s(!1)},multipleSelection(e){r.multiple=!0},remove(n){let i=r.options,a=n.detail.remove;i[a].selected=!1,r.remove(a),i.length>0&&Array.prototype.findIndex.call(i,e=>e.selected)===-1&&(i[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},clear(n){for(;r.length!==0;)r.remove(0);e.setValue(t,{value:null,items:[]}),c=s(!1)},insert(n){let{index:i,displayValue:o,exportValue:u}=n.detail.insert,d=r.children[i],f=document.createElement(`option`);a(f,o),f.value=u,d?d.before(f):r.append(f),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},items(n){let{items:i}=n.detail;for(;r.length!==0;)r.remove(0);for(let e of i){let{displayValue:t,exportValue:n}=e,i=document.createElement(`option`);a(i,t),i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},indices(n){let r=new Set(n.detail.indices);for(let e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:s(!0)}),c=s(!1)},editable(e){e.target.disabled=!e.detail.editable}},n)}),r.addEventListener(`input`,n=>{let r=s(!0),i=s(!1);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:c,change:i,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`],[`input`,`Action`],[`input`,`Validate`]],e=>e.target.value)):r.addEventListener(`input`,function(n){e.setValue(t,{value:s(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}},AD=class extends yD{constructor(e){let{data:t,elements:n,parent:r}=e,i=!!r._commentManager;if(super(e,{isRenderable:!i&&yD._hasPopupData(t)}),this.elements=n,i&&yD._hasPopupData(t)){let e=this.popup=this.#e();for(let t of n)t.popup=e}else this.popup=null}#e(){return new jD({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){let{container:e}=this;e.classList.add(`popupAnnotation`),e.role=`comment`;let t=this.popup=this.#e(),n=[];for(let e of this.elements)e.popup=t,e.container.ariaHasPopup=`dialog`,n.push(e.data.id),e.addHighlightArea();return this.container.setAttribute(`aria-controls`,n.map(e=>`${DS}${e}`).join(`,`)),this.container}},jD=class{#e=null;#t=this.#P.bind(this);#n=this.#R.bind(this);#r=this.#L.bind(this);#i=this.#I.bind(this);#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=null;#f=!1;#p=null;#m=null;#h=null;#g=null;#_=null;#v=null;#y=null;#b=null;#x=null;#S=null;#C=!1;#w=null;#T=null;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:i,contentsObj:a,richText:o,parent:s,rect:c,parentRect:l,open:u,commentManager:d=null}){this.#o=e,this.#x=r,this.#s=a,this.#b=o,this.#u=s,this.#a=t,this.#y=c,this.#d=l,this.#l=n,this.#e=d,this.#w=n[0],this.#c=PC.toDateObject(i),this.trigger=n.flatMap(e=>e.getElementsToTriggerPopup()),d||(this.#E(),this.#o.hidden=!0,u&&this.#I())}#E(){if(this.#m)return;this.#m=new AbortController;let{signal:e}=this.#m;for(let t of this.trigger)t.addEventListener(`click`,this.#i,{signal:e}),t.addEventListener(`pointerenter`,this.#r,{signal:e}),t.addEventListener(`pointerleave`,this.#n,{signal:e}),t.classList.add(`popupTriggerArea`);for(let t of this.#l)t.container?.addEventListener(`keydown`,this.#t,{signal:e})}#D(){let e=this.#l.find(e=>e.hasCommentButton);e&&(this.#_=e._normalizePoint(e.commentButtonPosition))}renderCommentButton(){if(this.#g){this.#g.parentNode||this.#w.container.after(this.#g);return}if(this.#_||this.#D(),!this.#_)return;let{signal:e}=this.#m=new AbortController,t=this.#w.hasOwnCommentButton,n=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!t)},r=()=>{this.#e.toggleCommentPopup(this,!1,!0,!t)},i=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(t){this.#g=this.#w.container;for(let t of this.trigger)t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),t.classList.add(`popupTriggerArea`)}else{let t=this.#g=document.createElement(`button`);t.className=`annotationCommentButton`;let a=this.#w.container;t.style.zIndex=parseInt(a.style.zIndex,10)+1,t.tabIndex=0,t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`),this.#k(),this.#O(),t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),a.after(t)}}#O(){if(this.#w.extraPopupElement&&!this.#w.editor)return;this.#g||this.renderCommentButton();let[e,t]=this.#_,{style:n}=this.#g;n.left=`calc(${e}%)`,n.top=`calc(${t}% - var(--comment-button-dim))`}#k(){this.#w.extraPopupElement||(this.#g||this.renderCommentButton(),this.#g.style.backgroundColor=this.commentButtonColor||``)}get commentButtonColor(){let{color:e,opacity:t}=this.#w.commentData;return e?this.#u._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{this.#g?.focus()},0)}getData(){let{richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}=this.#w.commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}}get elementBeforePopup(){return this.#g}get comment(){return this.#T||=this.#w.commentText,this.#T}set comment(e){e!==this.comment&&(this.#w.commentText=this.#T=e)}focus(){this.#w.container?.focus()}get parentBoundingClientRect(){return this.#w.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){this.#g&&(this.#g.classList.toggle(`selected`,e),this.#g.ariaExpanded=t)}setSelectedCommentButton(e){this.#g.classList.toggle(`selected`,e)}get commentPopupPosition(){if(this.#v)return this.#v;let{x:e,y:t,height:n}=this.#g.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#w.layer.getBoundingClientRect();return[(e-r)/a,(t+n-i)/o]}set commentPopupPosition(e){this.#v=e}hasDefaultPopupPosition(){return this.#v===null}get commentButtonPosition(){return this.#_}get commentButtonWidth(){return this.#g.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){let[t,n]=this.#v||this.commentButtonPosition.map(e=>e/100),r=this.parentBoundingClientRect,{x:i,y:a,width:o,height:s}=r;this.#e.showDialog(null,this,i+t*o,a+n*s,{...e,parentDimensions:r})}render(){if(this.#p)return;let e=this.#p=document.createElement(`div`);if(e.className=`popup`,this.#a){let t=e.style.outlineColor=Z.makeHexColor(...this.#a);e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`}let t=document.createElement(`span`);if(t.className=`header`,this.#x?.str){let e=document.createElement(`span`);e.className=`title`,t.append(e),{dir:e.dir,str:e.textContent}=this.#x}if(e.append(t),this.#c){let e=document.createElement(`time`);e.className=`popupDate`,e.setAttribute(`data-l10n-id`,`pdfjs-annotation-date-time-string`),e.setAttribute(`data-l10n-args`,JSON.stringify({dateObj:this.#c.valueOf()})),e.dateTime=this.#c.toISOString(),t.append(e)}QC({html:this.#A||this.#s.str,dir:this.#s?.dir,className:`popupContent`},e),this.#o.append(e)}get#A(){let e=this.#b,t=this.#s;return e?.str&&(!t?.str||t.str===e.str)&&this.#b.html||null}get#j(){return this.#A?.attributes?.style?.fontSize||0}get#M(){return this.#A?.attributes?.style?.color||null}#N(e){let t=[],n={str:e,html:{name:`div`,attributes:{dir:`auto`},children:[{name:`p`,children:t}]}},r={style:{color:this.#M,fontSize:this.#j?`calc(${this.#j}px * var(--total-scale-factor))`:``}};for(let n of e.split(`
`))t.push({name:`span`,value:n,attributes:r});return n}#P(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key===`Enter`||e.key===`Escape`&&this.#f)&&this.#I()}updateEdited({rect:e,popup:t,deleted:n}){if(this.#e){n?(this.remove(),this.#T=null):t&&(t.deleted?this.remove():(this.#k(),this.#T=t.text)),e&&(this.#_=null,this.#D(),this.#O());return}if(n||t?.deleted){this.remove();return}this.#E(),this.#S||={contentsObj:this.#s,richText:this.#b},e&&(this.#h=null),t&&t.text&&(this.#b=this.#N(t.text),this.#c=PC.toDateObject(t.date),this.#s=null),this.#p?.remove(),this.#p=null}resetEdited(){this.#S&&({contentsObj:this.#s,richText:this.#b}=this.#S,this.#S=null,this.#p?.remove(),this.#p=null,this.#h=null)}remove(){if(this.#m?.abort(),this.#m=null,this.#p?.remove(),this.#p=null,this.#C=!1,this.#f=!1,this.#g?.remove(),this.#g=null,this.trigger)for(let e of this.trigger)e.classList.remove(`popupTriggerArea`)}#F(){if(this.#h!==null)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:r,pageY:i}}}=this.#u,a=!!this.#d,o=a?this.#d:this.#y;for(let e of this.#l)if(!o||Z.intersect(e.data.rect,o)!==null){o=e.data.rect,a=!0;break}let s=Z.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=a?o[2]-o[0]+5:0,l=s[0]+c,u=s[1];this.#h=[100*(l-r)/t,100*(u-i)/n];let{style:d}=this.#o;d.left=`${this.#h[0]}%`,d.top=`${this.#h[1]}%`}#I(){if(this.#e){this.#e.toggleCommentPopup(this,!1);return}this.#f=!this.#f,this.#f?(this.#L(),this.#o.addEventListener(`click`,this.#i),this.#o.addEventListener(`keydown`,this.#t)):(this.#R(),this.#o.removeEventListener(`click`,this.#i),this.#o.removeEventListener(`keydown`,this.#t))}#L(){this.#p||this.render(),this.isVisible?this.#f&&this.#o.classList.add(`focused`):(this.#F(),this.#o.hidden=!1,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)+1e3)}#R(){this.#o.classList.remove(`focused`),!(this.#f||!this.isVisible)&&(this.#o.hidden=!0,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)-1e3)}forceHide(){this.#C=this.isVisible,this.#C&&(this.#o.hidden=!0)}maybeShow(){this.#e||(this.#E(),this.#C&&(this.#p||this.#L(),this.#C=!1,this.#o.hidden=!1))}get isVisible(){return!this.#e&&this.#o.hidden===!1}},MD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=kS.FREETEXT}render(){if(this.container.classList.add(`freeTextAnnotation`),this.textContent){let e=this.contentElement=document.createElement(`div`);e.classList.add(`annotationTextContent`),e.setAttribute(`role`,`comment`);for(let t of this.textContent){let n=document.createElement(`span`);n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},ND=class extends yD{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`lineAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=this.#e=this.svgFactory.createElement(`svg:line`);return i.setAttribute(`x1`,e.rect[2]-e.lineCoordinates[0]),i.setAttribute(`y1`,e.rect[3]-e.lineCoordinates[1]),i.setAttribute(`x2`,e.rect[2]-e.lineCoordinates[2]),i.setAttribute(`y2`,e.rect[3]-e.lineCoordinates[3]),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),r.append(i),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},PD=class extends yD{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`squareAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:rect`);return a.setAttribute(`x`,i/2),a.setAttribute(`y`,i/2),a.setAttribute(`width`,t-i),a.setAttribute(`height`,n-i),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},FD=class extends yD{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`circleAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:ellipse`);return a.setAttribute(`cx`,t/2),a.setAttribute(`cy`,n/2),a.setAttribute(`rx`,t/2-i/2),a.setAttribute(`ry`,n/2-i/2),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},ID=class extends yD{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`polylineAnnotation`,this.svgElementName=`svg:polyline`}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:t,borderStyle:n,popupRef:r},width:i,height:a}=this;if(!t)return this.container;let o=this.svgFactory.create(i,a,!0),s=[];for(let n=0,r=t.length;n<r;n+=2){let r=t[n]-e[0],i=e[3]-t[n+1];s.push(`${r},${i}`)}s=s.join(` `);let c=this.#e=this.svgFactory.createElement(this.svgElementName);return c.setAttribute(`points`,s),c.setAttribute(`stroke-width`,n.width||1),c.setAttribute(`stroke`,`transparent`),c.setAttribute(`fill`,`transparent`),o.append(c),this.container.append(o),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},LD=class extends ID{constructor(e){super(e),this.containerClassName=`polygonAnnotation`,this.svgElementName=`svg:polygon`}},RD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`caretAnnotation`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},zD=class extends yD{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`inkAnnotation`,this.svgElementName=`svg:polyline`,this.annotationEditorType=this.data.it===`InkHighlight`?kS.HIGHLIGHT:kS.INK}#n(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:t,inkLists:n,borderStyle:r,popupRef:i}}=this,{transform:a,width:o,height:s}=this.#n(t,e),c=this.svgFactory.create(o,s,!0),l=this.#e=this.svgFactory.createElement(`svg:g`);c.append(l),l.setAttribute(`stroke-width`,r.width||1),l.setAttribute(`stroke-linecap`,`round`),l.setAttribute(`stroke-linejoin`,`round`),l.setAttribute(`stroke-miterlimit`,10),l.setAttribute(`stroke`,`transparent`),l.setAttribute(`fill`,`transparent`),l.setAttribute(`transform`,a);for(let e of n){let t=this.svgFactory.createElement(this.svgElementName);this.#t.push(t),t.setAttribute(`points`,e.join(`,`)),l.append(t)}return!i&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:t,points:n,rect:r}=e,i=this.#e;if(t>=0&&i.setAttribute(`stroke-width`,t||1),n)for(let e=0,t=this.#t.length;e<t;e++)this.#t[e].setAttribute(`points`,n[e].join(`,`));if(r){let{transform:e,width:t,height:n}=this.#n(this.data.rotation,r);i.parentElement.setAttribute(`viewBox`,`0 0 ${t} ${n}`),i.setAttribute(`transform`,e)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add(`highlightArea`)}},BD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=kS.HIGHLIGHT}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`highlightAnnotation`),this._editOnDoubleClick(),e){let t=document.createElement(`mark`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},VD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`underlineAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},HD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`squigglyAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},UD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`strikeoutAnnotation`),e){let t=document.createElement(`s`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},WD=class extends yD{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=kS.STAMP}render(){return this.container.classList.add(`stampAnnotation`),this.container.setAttribute(`role`,`img`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},GD=class extends yD{#e=null;constructor(e){super(e,{isRenderable:!0});let{fileId:t,file:n}=this.data;this.filename=n.filename,this.content=n.content,this.fileId=t,this.linkService.eventBus?.dispatch(`fileattachmentannotation`,{source:this,attachmentId:this.fileId,...n})}render(){this.container.classList.add(`fileAttachmentAnnotation`);let{container:e,data:t}=this,n;t.hasAppearance||t.fillAlpha===0?n=document.createElement(`div`):(n=document.createElement(`img`),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?`paperclip`:`pushpin`}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener(`dblclick`,this.#t.bind(this)),this.#e=n;let{isMac:r}=oC.platform;return e.addEventListener(`keydown`,e=>{e.key===`Enter`&&(r?e.metaKey:e.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add(`popupTriggerArea`),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}async#t(){let{fileId:e,filename:t,content:n}=this,r=await this.linkService.getAttachmentContent(e)||n;r&&this.downloadManager?.openOrDownloadData(r,t)}},KD=class extends yD{#e=new AbortController;#t=null;#n=null;constructor(e){super(e,{isRenderable:!!e.data.richMedia})}render(){this.container.classList.add(`mediaAnnotation`);let{filename:e}=this.data.richMedia,t=document.createElement(`button`);return t.className=`mediaPlayButton`,t.type=`button`,t.title=t.ariaLabel=e,t.addEventListener(`click`,()=>this.#r(t),{signal:this.#e.signal}),this.container.append(t),this.container}async#r(e){let{fileId:t,filename:n,contentType:r}=this.data.richMedia;e.disabled=!0;let i;try{i=await this.linkService.getAttachmentContent(t)}catch{return}finally{e.disabled=!1}if(!i||!e.isConnected)return;let{signal:a}=this.#e,o=URL.createObjectURL(new Blob([i],{type:r}));this.#t=o;let s=r.startsWith(`audio/`),c=document.createElement(s?`audio`:`video`);if(this.#n=c,c.className=`mediaContent`,this._setBackgroundColor(c),c.src=o,c.title=n,c.controls=!0,c.autoplay=!0,c.tabIndex=0,s){let e=!1,t=!1,n=()=>{c.controls=e||t};this.container.addEventListener(`pointerenter`,()=>{e=!0,n()},{signal:a}),this.container.addEventListener(`pointerleave`,()=>{e=!1,n()},{signal:a}),this.container.addEventListener(`focusin`,()=>{t=!0,n()},{signal:a}),this.container.addEventListener(`focusout`,()=>{t=!1,n()},{signal:a})}c.addEventListener(`emptied`,()=>this.#i(o),{once:!0,signal:a}),e.replaceWith(c),c.play().catch(()=>{})}#i(e=this.#t){e&&e===this.#t&&(URL.revokeObjectURL(e),this.#t=null)}destroy(){this.#e.abort(),this.#n&&=(this.#n.pause(),this.#n.removeAttribute(`src`),this.#n.load(),null),this.#i()}},qD=class e{#e=null;#t=null;#n=null;#r=new Map;#i=null;#a=null;#o=[];#s=!1;zIndex=0;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:r,page:i,viewport:a,structTreeLayer:o,commentManager:s,linkService:c,annotationStorage:l}){this.div=e,this.#e=t,this.#t=n,this.#i=o||null,this.#a=c||null,this.#n=l||new ww,this.page=i,this.viewport=a,this._annotationEditorUIManager=r,this._commentManager=s||null}hasEditableAnnotations(){return this.#r.size>0}async render(e){let{annotations:t,optionalContentConfig:n}=e,r=this.div;BC(r,this.viewport);let i=new Map,a=[],o={data:null,layer:r,linkService:this.#a,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||``,renderForms:e.renderForms!==!1,svgFactory:new mD,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let e of t){if(e.noHTML)continue;let t=e.annotationType===PS.POPUP;if(t){let t=i.get(e.id);if(!t)continue;if(!this._commentManager){a.push(e);continue}o.elements=t}else if(e.rect[2]===e.rect[0]||e.rect[3]===e.rect[1])continue;o.data=e;let r=vD.create(o);if(!r.isRenderable)continue;t||(this.#o.push(r),e.popupRef&&i.getOrInsertComputed(e.popupRef,pC).push(r));let s=r.render();e.hidden&&(s.style.visibility=`hidden`),r.updateOC(n),r._isEditable&&(this.#r.set(r.data.id,r),this._annotationEditorUIManager?.renderAnnotationElement(r))}await this.#c();for(let e of a){let t=o.elements=i.get(e.id);o.data=e;let n=vD.create(o);if(!n.isRenderable)continue;let r=n.render();n.contentElement.id=`${DS}${e.id}`,e.hidden&&(r.style.visibility=`hidden`),t.at(-1).container.after(r)}this.#l()}async#c(){if(this.#o.length===0)return;this.div.replaceChildren();let e=[];if(!this.#s){this.#s=!0;for(let{contentElement:t,data:{hidden:n,id:r,oc:i}}of this.#o){let a=t.id=`${DS}${r}`,o=t.localName===`a`&&!n&&!i;e.push(this.#i?.getAriaAttributes(a,{enableLinkOwnership:o}).then(e=>{if(e)for(let[n,r]of e)t.setAttribute(n,r)}))}}this.#o.sort(({data:{rect:[e,t,n,r]}},{data:{rect:[i,a,o,s]}})=>{if(e===n&&t===r)return 1;if(i===o&&a===s)return-1;let c=r,l=t,u=(t+r)/2,d=s,f=a,p=(a+s)/2;return u>=d&&p<=l?-1:p>=c&&u<=f?1:(e+n)/2-(i+o)/2});let t=document.createDocumentFragment();for(let e of this.#o)t.append(e.container),this._commentManager?(e.extraPopupElement?.popup||e.popup)?.renderCommentButton():e.extraPopupElement&&t.append(e.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),this.#e){let e=await this.#i?.getAnnotationIds();for(let{contentElement:t}of this.#o)e?.has(t.id)||this.#e.addPointerInTextLayer(t,!1)}}async addLinkAnnotations(t){let n={data:null,layer:this.div,linkService:this.#a,svgFactory:new mD,parent:this};for(let r of t){r.borderStyle||=e._defaultBorderStyle,n.data=r;let t=vD.create(n);t.isRenderable&&(t.render(),t.contentElement.id=`${DS}${r.id}`,this.#o.push(t))}await this.#c()}update({viewport:e,optionalContentConfig:t}){let n=this.div;this.viewport=e,BC(n,{rotation:e.rotation});for(let e of this.#o)e.updateOC(t);this.#l(),n.hidden=!1}destroy(){for(let e of this.#o)e.destroy?.(),this.#e?.removePointerInTextLayer(e.contentElement);this.#o.length=0,this.#r.clear(),this.div.replaceChildren()}#l(){if(!this.#t)return;let e=this.div;for(let[t,n]of this.#t){let r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;if(Array.isArray(n))for(let e of n)e.className=`annotationContent`,e.ariaHidden=!0;else n.className=`annotationContent`,n.ariaHidden=!0;let i=[];for(let e of r.children)e.nodeName===`CANVAS`&&i.push(e);for(let e of i)e.remove();let a=Array.isArray(n)?n[0]:n,{firstChild:o}=r;if(o?o.classList.contains(`annotationContent`)?o.after(a):o.before(a):r.append(a),Array.isArray(n)){let e=a;for(let t=1,r=n.length;t<r;t++)e.after(n[t]),e=n[t]}this.#t.delete(t);let s=this.#r.get(t);s&&(s._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(t,r.id,n),s._hasNoCanvas=!1):s.canvas=n)}}refreshCanvases(){this.#l()}getEditableAnnotations(){return this.#r.values()}getEditableAnnotation(e){return this.#r.get(e)}addFakeAnnotation(e){let{div:t}=this,{id:n,rotation:r}=e,i=new bD({data:{id:n,rect:e.getPDFRect(),rotation:r},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:this.#a,annotationStorage:this.#n});return i.render(),i.contentElement.id=`${DS}${n}`,i.createOrUpdatePopup(),this.#o.push(i),i}removeAnnotation(e){let t=this.#o.findIndex(t=>t.data.id===e);if(t<0)return;let[n]=this.#o.splice(t,1);this.#e?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(let t of e)t.updateFakeAnnotationElement(this);this.#c()}}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}static get _defaultBorderStyle(){return X(this,`_defaultBorderStyle`,Object.freeze({width:1,rawWidth:1,style:FS.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},JD=/\r\n?|\n/g,YD=class e extends _w{#e=``;#t=`${this.id}-editor`;#n=null;#r;_colorPicker=null;static _freeTextDefaultContent=``;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.isEmpty(),r=uw.TRANSLATE_SMALL,i=uw.TRANSLATE_BIG;return X(this,`_keyboardManager`,new cw([[[`ctrl+s`,`mac+meta+s`,`ctrl+p`,`mac+meta+p`],t.commitOrRemove,{bubbles:!0}],[[`ctrl+Enter`,`mac+meta+Enter`],t.commitOrRemove],[[`Escape`],t.commitOrRemove],[[`ArrowLeft`],t._translateEmpty,{args:[-r,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t._translateEmpty,{args:[-i,0],checker:n}],[[`ArrowRight`],t._translateEmpty,{args:[r,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t._translateEmpty,{args:[i,0],checker:n}],[[`ArrowUp`],t._translateEmpty,{args:[0,-r],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t._translateEmpty,{args:[0,-i],checker:n}],[[`ArrowDown`],t._translateEmpty,{args:[0,r],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t._translateEmpty,{args:[0,i],checker:n}]]))}static _type=`freetext`;static _editorType=kS.FREETEXT;constructor(t){super({...t,name:`freeTextEditor`}),this.color=t.color||e._defaultColor||_w._defaultLineColor,this.#r=t.fontSize||e._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert(_w._l10nAlert.freetext),this.canAddComment=!1}static initialize(e,t){_w.initialize(e,t);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue(`--freetext-padding`))}static updateDefaultParams(t,n){switch(t){case AS.FREETEXT_SIZE:e._defaultFontSize=n;break;case AS.FREETEXT_COLOR:e._defaultColor=n}}updateParams(e,t){switch(e){case AS.FREETEXT_SIZE:this.#i(t);break;case AS.FREETEXT_COLOR:this.#a(t)}}static get defaultPropertiesToUpdate(){return[[AS.FREETEXT_SIZE,e._defaultFontSize],[AS.FREETEXT_COLOR,e._defaultColor||_w._defaultLineColor]]}get propertiesToUpdate(){return[[AS.FREETEXT_SIZE,this.#r],[AS.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new lD(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return AS.FREETEXT_COLOR}#i(e){let t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--total-scale-factor))`,this.translate(0,-(e-this.#r)*this.parentScale),this.#r=e,this.#s()},n=this.#r;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AS.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#a(e){let t=e=>{this.color=e,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AS.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){let t=this.parentScale;return[-e._internalPadding*t,-(e._internalPadding+this.#r)*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove(`enabled`),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute(`aria-activedescendant`),this.#n=new AbortController;let e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener(`keydown`,this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener(`focus`,this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener(`blur`,this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener(`input`,this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener(`paste`,this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add(`enabled`),this.editorDiv.contentEditable=!1,this.div.setAttribute(`aria-activedescendant`,this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add(`freetextEditing`),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===``}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add(`freetextEditing`)),super.remove()}#o(){let t=[];this.editorDiv.normalize();let n=null;for(let r of this.editorDiv.childNodes)(n?.nodeType!==Node.TEXT_NODE||r.nodeName!==`BR`)&&(t.push(e.#c(r)),n=r);return t.join(`
`)}#s(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:e,div:t}=this,r=t.style.display,i=t.classList.contains(`hidden`);t.classList.remove(`hidden`),t.style.display=`hidden`,e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r,t.classList.toggle(`hidden`,i)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#e,t=this.#e=this.#o().trimEnd();if(e===t)return;let n=e=>{if(this.#e=e,!e){this.remove();return}this.#l(),this._uiManager.rebuild(this),this.#s()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#s()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key===`Enter`&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(t){e._keyboardManager.exec(this,t)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle(`freetextEditing`,this.isEmpty())}disableEditing(){this.editorDiv.setAttribute(`role`,`comment`),this.editorDiv.removeAttribute(`aria-multiline`)}enableEditing(){this.editorDiv.setAttribute(`role`,`textbox`),this.editorDiv.setAttribute(`aria-multiline`,!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,t;(this._isCopy||this.annotationElementId)&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement(`div`),this.editorDiv.className=`internal`,this.editorDiv.setAttribute(`id`,this.#t),this.editorDiv.setAttribute(`data-l10n-id`,`pdfjs-free-text2`),this.editorDiv.setAttribute(`data-l10n-attrs`,`default-content`),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement(`div`),this.overlayDiv.classList.add(`overlay`,`enabled`),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[n,r]=this.parentDimensions;if(this.annotationElementId){let{position:i}=this._initialData,[a,o]=this.getInitialTranslation();[a,o]=this.pageTranslationToScreen(a,o);let[s,c]=this.pageDimensions,[l,u]=this.pageTranslation,d,f;switch(this.rotation){case 0:d=e+(i[0]-l)/s,f=t+this.height-(i[1]-u)/c;break;case 90:d=e+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[o,-a];break;case 180:d=e-this.width+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[-a,-o];break;case 270:d=e+(i[0]-l-this.height*c)/s,f=t+(i[1]-u-this.width*s)/c,[a,o]=[-o,a]}this.setAt(d*n,f*r,a,o)}else this._moveAfterPaste(e,t);this.#l(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#c(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(JD,``)}editorDivPaste(t){let n=t.clipboardData||window.clipboardData,{types:r}=n;if(r.length===1&&r[0]===`text/plain`)return;t.preventDefault();let i=e.#d(n.getData(`text`)||``).replaceAll(JD,`
`);if(!i)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let o=a.getRangeAt(0);if(!i.includes(`
`)){o.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:s,startOffset:c}=o,l=[],u=[];if(s.nodeType===Node.TEXT_NODE){let t=s.parentElement;if(u.push(s.nodeValue.slice(c).replaceAll(JD,``)),t!==this.editorDiv){let n=l;for(let r of this.editorDiv.childNodes){if(r===t){n=u;continue}n.push(e.#c(r))}}l.push(s.nodeValue.slice(0,c).replaceAll(JD,``))}else if(s===this.editorDiv){let t=l,n=0;for(let r of this.editorDiv.childNodes)n++===c&&(t=u),t.push(e.#c(r))}this.#e=`${l.join(`
`)}${i}${u.join(`
`)}`,this.#l();let d=new Range,f=Math.sumPrecise(l.map(e=>e.length));for(let{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){let t=e.nodeValue.length;if(f<=t){d.setStart(e,f),d.setEnd(e,f);break}f-=t}a.removeAllRanges(),a.addRange(d)}#l(){if(this.editorDiv.replaceChildren(),this.#e)for(let e of this.#e.split(`
`)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}#u(){return this.#e.replaceAll(`\xA0`,` `)}static#d(e){return e.replaceAll(` `,`\xA0`)}get contentDiv(){return this.editorDiv}getPDFRect(){let t=e._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,n,r){let i=null;if(t instanceof MD){let{data:{defaultAppearanceData:{fontSize:e,fontColor:n},rect:r,rotation:a,id:o,popupRef:s,richText:c,contentsObj:l,creationDate:u,modificationDate:d},textContent:f,textPosition:p,parent:{page:{pageNumber:m}}}=t;if(!f?.length)return null;i=t={annotationType:kS.FREETEXT,color:Array.from(n),fontSize:e,value:f.join(`
`),position:p,pageIndex:m-1,rect:r.slice(0),rotation:a,annotationElementId:o,id:o,deleted:!1,popupRef:s,comment:l?.str||null,richText:c,creationDate:u,modificationDate:d}}let a=await super.deserialize(t,n,r);return a.#r=t.fontSize,a.color=Z.makeHexColor(...t.color),a.#e=e.#d(t.value),a._initialData=i,t.comment&&a.setCommentData(t),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let t=_w._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:t,fontSize:this.#r,value:this.#u()});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!this.#f(n)?null:(n.id=this.annotationElementId,n)}#f(e){let{value:t,fontSize:n,color:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==i}renderAnnotationElement(e){let t=super.renderAnnotationElement(e);if(!t)return null;let{style:n}=t;n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,t.replaceChildren();for(let e of this.#e.split(`
`)){let n=document.createElement(`div`);n.append(e?document.createTextNode(e):document.createElement(`br`)),t.append(n)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}},XD=class{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith(`_`)||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){GS(`Not implemented`)}},ZD=class e extends _w{#e=null;#t;_clipPathId=null;_colorPicker=null;_drawId=null;_drawOutlines=null;_focusDrawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#i=null;static#a=null;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){e.drawOutlines&&(this.#o(e),this.#m())}#o({drawOutlines:e,drawId:t,drawingOptions:n,clipPathId:r}){this._drawOutlines=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(_w._l10nAlert[this.editorType]),t>=0?(this._drawId=t,this._clipPathId=r??null,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties),this.#c(this.parent)):this._drawId=this.#s(e,this.parent),this.#_(e.box)}#s(t,n){let{id:r,clipPathId:i}=n.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=i),this.#c(n),r}#c(e){let t=this._drawOutlines.getFocusSVGProperties(this.#f);t&&(this._focusDrawId=e.drawLayer.drawOutline(t,this._drawOutlines.focusMustRemoveSelfIntersections))}#l(e=this.#f){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e))}#u(e){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,{rootClass:e})}#d(){let{parent:e,_drawId:t,_focusDrawId:n,_isVisible:r}=this;if(!e||t===null)return;let i={hidden:!r};e.drawLayer.updateProperties(t,{rootClass:i}),n!==null&&e.drawLayer.updateProperties(n,{rootClass:i})}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[r,i]of Object.entries(t))n.has(r)?Object.assign(e[r],i):e[r]=i;return e}static getDefaultDrawingOptions(e){GS(`Not implemented`)}static get typesMap(){GS(`Not implemented`)}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}get#f(){return(this.parentRotation-this._drawRotation+360)%360}static updateDefaultParams(t,n){let r=this.typesMap.get(t);r&&this._defaultDrawingOptions.updateProperty(r,n),this._currentParent&&(e.#n.updateProperty(r,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){let r=this._drawingOptions,i=r[t],a=n=>{r.updateProperty(t,n);let i=this._drawOutlines.updateProperty(t,n);i&&this.#_(i),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:a.bind(this,n),undo:a.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t,n=this.colorAndOpacityType){let r=this.constructor.typesMap.get(this.colorType),i=this._opacityName,a=this._drawingOptions,o=a[r],s=a[i],c=(e,t)=>{a.updateProperty(r,e),a.updateProperty(i,t),this._drawOutlines.updateProperty(r,e),this._drawOutlines.updateProperty(i,t),this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,e,t),undo:c.bind(this,o,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:n,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(this.#g()),{bbox:this.#v()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(this.#g()),{bbox:this.#v()})),this.#l()}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#v()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(this.#g(),this.parentDimensions),{bbox:this.#v()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle(`disabled`,!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle(`disabled`,!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),this.#p(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#m(),this.#_(this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#p()):e&&(this._uiManager.addShouldRescale(this),this.#m(e),t=!this.parent&&this.div?.classList.contains(`selectedEditor`)),super.setParent(e),this.#d(),t&&this.select()}#p(){if(this._drawId===null||!this.parent)return;let{drawLayer:e}=this.parent;e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(e.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()}#m(e=this.parent){if(this._drawId===null||this.parent!==e){if(this._drawId!==null){let{drawLayer:t}=this.parent;t.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null&&t.updateParent(this._focusDrawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#s(this._drawOutlines,e),this._clipPathId&&this.#e&&(this.#e.style.clipPath=this._clipPathId)}}#h([e,t,n,r]){let{parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[t,1-e,a/i*n,i/a*r];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,a/i*n,i/a*r];default:return[e,t,n,r]}}#g(){let{x:e,y:t,width:n,height:r,parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[1-t,e,i/a*n,a/i*r];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,i/a*n,a/i*r];default:return[e,t,n,r]}}#_(e){[this.x,this.y,this.width,this.height]=this.#h(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#v(e=this.parentRotation){let{x:t,y:n,width:r,height:i,_drawRotation:a,parentDimensions:[o,s]}=this;switch((a*4+e)/90){case 1:return[1-n-i,t,i,r];case 2:return[1-t-r,1-n-i,r,i];case 3:return[n,1-t-r,i,r];case 4:return[t,n-o/s*r,s/o*i,o/s*r];case 5:return[1-n,t,o/s*r,s/o*i];case 6:return[1-t-s/o*i,1-n,s/o*i,o/s*r];case 7:return[n-o/s*r,1-t-s/o*i,o/s*r,s/o*i];case 8:return[t-r,n-i,r,i];case 9:return[1-n,t-r,i,r];case 10:return[1-t,1-n,r,i];case 11:return[n-i,1-t,i,r];case 12:return[t-s/o*i,n,s/o*i,o/s*r];case 13:return[1-n-o/s*r,t-s/o*i,o/s*r,s/o*i];case 14:return[1-t,1-n-o/s*r,s/o*i,o/s*r];case 15:return[n,1-t,o/s*r,s/o*i];default:return[t,n,r,i]}}rotate(t=this.parentRotation){if(!this.parent||this._drawId===null)return;let n=(t-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#v(t)},this._drawOutlines.updateRotation(n))),this.#l(n)}show(e=this._isVisible){super.show(e),this.#d()}select(){super.select(),this.#u({hovered:!1,selected:!0})}unselect(){super.unselect(),this.#u({selected:!1})}pointerover(){this.isSelected||this.#u({hovered:!0})}pointerleave(){this.isSelected||this.#u({hovered:!1})}onScaleChanging(){if(!this.parent)return;let e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);e&&this.#_(e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();this.constructor._hasDrawClass&&n.classList.add(`draw`);let r=this.#e=document.createElement(`div`);return n.append(r),r.setAttribute(`aria-hidden`,`true`),r.className=`internal`,this._clipPathId&&(r.style.clipPath=this._clipPathId),rw(this,r,[`pointerover`,`pointerleave`]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e){GS(`Not implemented`)}static _getDrawingTarget(e,{target:t}){return t}static _getPointerCoords({offsetX:e,offsetY:t,clientX:n,clientY:r},i=null){if(!i)return[e,t];let a=n-i.clientX,o=r-i.clientY;switch(this._currentParent.viewport.rotation){case 90:[a,o]=[o,-a];break;case 180:[a,o]=[-a,-o];break;case 270:[a,o]=[-o,a]}return[i.offsetX+a,i.offsetY+o]}static _addDrawingListeners(e,t){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(t,n,r,i){let{pointerId:a,pointerType:o}=i;if(iw.isInitializedAndDifferentPointerType(o))return;let s=this._getDrawingTarget(t,i),[c,l]=this._getPointerCoords(i),{viewport:{rotation:u}}=t,{x:d,y:f,width:p,height:m}=s.getBoundingClientRect(),h=e.#r=new AbortController,g=t.combinedSignal(h);if(iw.setPointer(o,a),window.addEventListener(`pointerup`,e=>{iw.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:g}),window.addEventListener(`pointercancel`,e=>{iw.isSamePointerIdOrRemove(e.pointerId)&&this._endDrawingSession()},{signal:g}),window.addEventListener(`pointerdown`,t=>{iw.isSamePointerType(t.pointerType)&&(iw.initializeAndAddPointerId(t.pointerId),e.#n.isCancellable()&&(e.#n.removeLastElement(),e.#n.isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener(`contextmenu`,MC,{signal:g}),s.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:g}),s.addEventListener(`touchmove`,e=>{iw.isSameTimeStamp(e.timeStamp)&&NC(e)},{signal:g}),this._addDrawingListeners(s,g),t.toggleDrawing(),n._editorUndoBar?.hide(),e.#n){t.drawLayer.updateProperties(this._currentDrawId,e.#n.startNew(c,l,p,m,u));return}n.updateUIForDefaultProperties(this),e.#n=this.createDrawerInstance({x:c,y:l,box:[d,f,p,m],rotation:u,parent:t,isLTR:r}),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t;let{id:_,clipPathId:v}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#n.defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=_,e.#a=this._hasClipPath?v:null}static _drawMove(t){if(iw.isSameTimeStamp(t.timeStamp),!e.#n||!iw.isSamePointerId(t.pointerId))return;if(iw.isUsingMultiplePointers()){this._endDraw(t);return}let n,r=t.getCoalescedEvents?.();if(r?.length){let i=[];for(let e of r)i.push(...this._getPointerCoords(e,t));n=e.#n.addPoints(i)}else n=e.#n.add(...this._getPointerCoords(t));this._currentParent.drawLayer.updateProperties(this._currentDrawId,n),iw.setTimeStamp(t.timeStamp),NC(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#n=null,e.#i=null,e.#a=null,iw.clearTimeStamp()),e.#r&&(e.#r.abort(),e.#r=null,iw.clearPointerIds())}static _endDraw(t){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),n.drawLayer.updateProperties(this._currentDrawId,t?.target===n.div?e.#n.end(...this._getPointerCoords(t)):e.#n.end()),this.supportMultipleDrawings){let t=e.#n,r=this._currentDrawId,i=t.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(r,t.setLastElement(i))},undo:()=>{n.drawLayer.updateProperties(r,t.removeLastElement())},mustExec:!1,type:AS.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(AS.DRAW_STEP),!e.#n.isEmpty()){let{pageDimensions:[r,i],scale:a}=n,o=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:e.#a,drawOutlines:e.#n.getOutlines(r*a,i*a,a,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),o}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,i,a,o){GS(`Not implemented`)}static async deserialize(e,t,n){let{rawDims:{pageWidth:r,pageHeight:i,pageX:a,pageY:o}}=t.viewport,s=this.deserializeDraw(a,o,r,i,this._INNER_MARGIN,e,n),c=await super.deserialize(e,t,n);return c.createDrawingOptions(e),c.#o({drawOutlines:s}),c.#m(),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){let[t,n]=this.pageTranslation,[r,i]=this.pageDimensions;return this._drawOutlines.serialize([t,n,r,i],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},Q=class{static PRECISION=1e-4;focusOutline=null;toSVGPath(){GS("Abstract method `toSVGPath` must be implemented.")}get box(){GS("Abstract getter `box` must be implemented.")}serialize(e,t){GS("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){GS("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,t){return null}updateParentDimensions(e,t){return null}serializeQuadPoints(e,t){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,t){return{}}static _rotateBox([e,t,n,r],i){switch(i){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}static _rescale(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o]*r,a[o+1]=n+e[o+1]*i;return a}static _rescaleAndSwap(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o+1]*r,a[o+1]=n+e[o]*i;return a}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let i=0,a=e.length;i<a;i+=2)r[i]=t+e[i],r[i+1]=n+e[i+1];return r}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,r,i){switch(i){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static createBezierPoints(e,t,n,r,i,a){return[(e+5*n)/6,(t+5*r)/6,(5*n+i)/6,(5*r+a)/6,(n+i)/2,(r+a)/2]}},QD=class e{#e;#t=[];#n;#r;#i=[];#a=new Float32Array(18);#o;#s;#c;#l;#u;#d;#f=[];static#p=8;static#m=2;static#h=e.#p+e.#m;constructor(t,n,r,i,a,o,s=0){this.#e=r,this.#d=a*i,this.#r=o,this.#a.set([NaN,NaN,NaN,NaN,t,n],6),this.#n=s,this.#l=e.#p*i,this.#c=e.#h*i,this.#u=i,this.#f.push(t,n)}isEmpty(){return isNaN(this.#a[8])}isCancellable(){return this.#f.length<=10}removeLastElement(){return this.#a.fill(NaN),this.#i.length=this.#t.length=this.#f.length=0,{path:{d:``}}}#g(){let e=this.#a.subarray(4,6),t=this.#a.subarray(16,18),[n,r,i,a]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/i,(this.#s+(e[1]-t[1])/2-r)/a,(this.#o+(t[0]-e[0])/2-n)/i,(this.#s+(t[1]-e[1])/2-r)/a]}add(e,t){this.#o=e,this.#s=t;let[n,r,i,a]=this.#e,[o,s,c,l]=this.#a.subarray(8,12),u=e-c,d=t-l,f=Math.hypot(u,d);if(f<this.#c)return!1;let p=f-this.#l,m=p/f,h=m*u,g=m*d,_=o,v=s;o=c,s=l,c+=h,l+=g,this.#f?.push(e,t);let y=-g/p,b=h/p,x=y*this.#d,S=b*this.#d;return this.#a.set(this.#a.subarray(2,8),0),this.#a.set([c+x,l+S],4),this.#a.set(this.#a.subarray(14,18),12),this.#a.set([c-x,l-S],16),isNaN(this.#a[6])?(this.#i.length===0&&(this.#a.set([o+x,s+S],2),this.#i.push(NaN,NaN,NaN,NaN,(o+x-n)/i,(s+S-r)/a),this.#a.set([o-x,s-S],14),this.#t.push(NaN,NaN,NaN,NaN,(o-x-n)/i,(s-S-r)/a)),this.#a.set([_,v,o,s,c,l],6),!this.isEmpty()):(this.#a.set([_,v,o,s,c,l],6),Math.abs(Math.atan2(v-s,_-o)-Math.atan2(g,h))<Math.PI/2?([o,s,c,l]=this.#a.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/i,((s+l)/2-r)/a),[o,s,_,v]=this.#a.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((_+o)/2-n)/i,((v+s)/2-r)/a),!0):([_,v,o,s,c,l]=this.#a.subarray(0,6),this.#i.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),[c,l,o,s,_,v]=this.#a.subarray(12,18),this.#t.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),!0))}toSVGPath(){if(this.isEmpty())return``;let e=this.#i,t=this.#t;if(isNaN(this.#a[6])&&!this.isEmpty())return this.#_();let n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#y(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new $D(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#f[e]-r)/a,s[e+1]=(this.#f[e+1]-i)/o;if(s[s.length-2]=(this.#o-r)/a,s[s.length-1]=(this.#s-i)/o,isNaN(n[6])&&!this.isEmpty())return this.#b(s);let c=new Float32Array(this.#i.length+24+this.#t.length),l=e.length;for(let t=0;t<l;t+=2){if(isNaN(e[t])){c[t]=c[t+1]=NaN;continue}c[t]=e[t],c[t+1]=e[t+1]}l=this.#S(c,l);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2){if(isNaN(t[e+n])){c[l]=c[l+1]=NaN,l+=2;continue}c[l]=t[e+n],c[l+1]=t[e+n+1],l+=2}return this.#x(c,l),this.newFreeDrawOutline(c,s,this.#e,this.#u,this.#n,this.#r)}#b(e){let t=this.#a,[n,r,i,a]=this.#e,[o,s,c,l]=this.#g(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-n)/i,(t[3]-r)/a,NaN,NaN,NaN,NaN,(t[4]-n)/i,(t[5]-r)/a,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,(t[16]-n)/i,(t[17]-r)/a,NaN,NaN,NaN,NaN,(t[14]-n)/i,(t[15]-r)/a],0),this.newFreeDrawOutline(u,e,this.#e,this.#u,this.#n,this.#r)}#x(e,t){let n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#S(e,t){let n=this.#a.subarray(4,6),r=this.#a.subarray(16,18),[i,a,o,s]=this.#e,[c,l,u,d]=this.#g();return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-a)/s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-a)/s],t),t+=24}},$D=class extends Q{#e;#t=new Float32Array(4);#n;#r;#i;#a;#o;constructor(e,t,n,r,i,a){super(),this.#o=e,this.#i=t,this.#e=n,this.#a=r,this.#n=i,this.#r=a,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#s(a);let[o,s,c,l]=this.#t;for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-o)/c,e[t+1]=(e[t+1]-s)/l;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-o)/c,t[e+1]=(t[e+1]-s)/l}toSVGPath(){let e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6){if(isNaN(this.#o[t])){e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`);continue}e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`)}return e.push(`Z`),e.join(` `)}serialize([e,t,n,r],i){let a=n-e,o=r-t,s,c;switch(i){case 0:s=Q._rescale(this.#o,e,r,a,-o),c=Q._rescale(this.#i,e,r,a,-o);break;case 90:s=Q._rescaleAndSwap(this.#o,e,t,a,o),c=Q._rescaleAndSwap(this.#i,e,t,a,o);break;case 180:s=Q._rescale(this.#o,n,t,-a,o),c=Q._rescale(this.#i,n,t,-a,o);break;case 270:s=Q._rescaleAndSwap(this.#o,n,r,-a,-o),c=Q._rescaleAndSwap(this.#i,n,r,-a,-o)}return{outline:Array.from(s),points:[Array.from(c)]}}#s(e){let t=this.#o,n=t[4],r=t[5],i=[n,r,n,r],a=n,o=r,s=n,c=r,l=e?Math.max:Math.min,u=new Float32Array(4);for(let e=6,d=t.length;e<d;e+=6){let d=t[e+4],f=t[e+5];isNaN(t[e])?(Z.pointBoundingBox(d,f,i),o>f?(a=d,o=f):o===f&&(a=l(a,d)),c<f?(s=d,c=f):c===f&&(s=l(s,d))):(u.set(xS,0),Z.bezierBoundingBox(n,r,...t.slice(e,e+6),u),Z.rectBoundingBox(...u,i),o>u[1]?(a=u[0],o=u[1]):o===u[1]&&(a=l(a,u[0])),c<u[3]?(s=u[2],c=u[3]):c===u[3]&&(s=l(s,u[2]))),n=d,r=f}let d=this.#t;d[0]=i[0]-this.#n,d[1]=i[1]-this.#n,d[2]=i[2]-i[0]+2*this.#n,d[3]=i[3]-i[1]+2*this.#n,this.firstPoint=[a,o],this.lastPoint=[s,c]}get box(){return this.#t}newOutliner(e,t,n,r,i,a,o=0){return new QD(e,t,n,r,i,a,o)}updateThickness(e){let t=this.getNewOutline(e);return this.#o=t.#o,this.#i=t.#i,this.#t.set(t.#t),this.firstPoint=t.firstPoint,this.lastPoint=t.lastPoint,this.#t}getNewOutline(e,t){let[n,r,i,a]=this.#t,[o,s,c,l]=this.#e,u=i*c,d=a*l,f=n*c+o,p=r*l+s,m=this.#i,h=this.newOutliner(m[0]*u+f,m[1]*d+p,this.#e,this.#a,e,this.#r,t??this.#n);for(let e=2,t=m.length;e<t;e+=2)h.add(m[e]*u+f,m[e+1]*d+p);return h.getOutlines()}};function eO(e){return{bbox:e.box,root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function tO(e,t){let{focusOutline:n}=e;return{bbox:Q._rotateBox(n.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:n.toSVGPath()}}}var nO=class{#e;#t;#n;#r=[];#i=[];constructor(e,t=0,n=0,r=!0){let i=xS.slice(),a=10**-4;for(let{x:n,y:r,width:o,height:s}of e){let e=Math.floor((n-t)/a)*a,c=Math.ceil((n+o+t)/a)*a,l=Math.floor((r-t)/a)*a,u=Math.ceil((r+s+t)/a)*a,d=[e,l,u,!0],f=[c,l,u,!1];this.#r.push(d,f),Z.rectBoundingBox(e,l,c,u,i)}let o=i[2]-i[0]+2*n,s=i[3]-i[1]+2*n,c=i[0]-n,l=i[1]-n,u=r?-1/0:1/0,d=1/0,f=this.#r.at(r?-1:-2),p=[f[0],f[2]];for(let e of this.#r){let[t,n,i,a]=e;!a&&r?n<d?(d=n,u=t):n===d&&(u=Math.max(u,t)):a&&!r&&(n<d?(d=n,u=t):n===d&&(u=Math.min(u,t))),e[0]=(t-c)/o,e[1]=(n-l)/s,e[2]=(i-l)/s}this.#e=new Float32Array([c,l,o,s]),this.#t=[u,d],this.#n=p}getOutlines(){this.#r.sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);let e=[];for(let t of this.#r)t[3]?(e.push(...this.#l(t)),this.#s(t)):(this.#c(t),e.push(...this.#l(t)));return this.#a(e)}#a(e){let t=[],n=new Set;for(let n of e){let[e,r,i]=n;t.push([e,r,n],[e,i,n])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,r=t.length;e<r;e+=2){let r=t[e][2],i=t[e+1][2];r.push(i),i.push(r),n.add(r),n.add(i)}let r=[],i;for(;n.size>0;){let e=n.values().next().value,[t,a,o,s,c]=e;n.delete(e);let l=t,u=a;for(i=[t,o],r.push(i);;){let e;if(n.has(s))e=s;else if(n.has(c))e=c;else break;n.delete(e),[t,a,o,s,c]=e,l!==t&&(i.push(l,u,t,u===a?a:o),l=t),u=u===a?o:a}i.push(l,u)}return new rO(r,this.#e,this.#t,this.#n)}#o(e){let t=this.#i,n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i][0];if(a===e)return i;a<e?n=i+1:r=i-1}return r+1}#s([,e,t]){let n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){let n=this.#o(e);for(let r=n;r<this.#i.length;r++){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}for(let r=n-1;r>=0;r--){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}}#l(e){let[t,n,r]=e,i=[[t,n,r]],a=this.#o(r);for(let e=0;e<a;e++){let[n,r]=this.#i[e];for(let e=0,a=i.length;e<a;e++){let[,o,s]=i[e];if(!(r<=o||s<=n)){if(o>=n){if(s>r)i[e][1]=r;else{if(a===1)return[];i.splice(e,1),e--,a--}continue}i[e][2]=n,s>r&&i.push([t,r,s])}}}return i}},rO=class extends Q{#e;#t=null;#n;constructor(e,t,n,r){super(),this.#n=e,this.#e=t,this.firstPoint=n,this.lastPoint=r}static build(e,t){let n=new nO(e,.001).getOutlines();return n.#t=e,n.focusOutline=new nO(e,.0025,.001,t).getOutlines(),n}get isFree(){return!1}get defaultSVGProperties(){return eO(this)}getFocusSVGProperties(e){return tO(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,t],[n,r]){let i=this.#t,a=new Float32Array(i.length*8),o=0;for(let{x:s,y:c,width:l,height:u}of i){let i=s*n+e,d=(1-c)*r+t;a[o]=a[o+4]=i,a[o+1]=a[o+3]=d,a[o+2]=a[o+6]=i+l*n,a[o+5]=a[o+7]=d-u*r,o+=8}return a}toSVGPath(){let e=[];for(let t of this.#n){let[n,r]=t;e.push(`M${n} ${r}`);for(let i=2;i<t.length;i+=2){let a=t[i],o=t[i+1];a===n?(e.push(`V${o}`),r=o):o===r&&(e.push(`H${a}`),n=a)}e.push(`Z`)}return e.join(` `)}serialize([e,t,n,r],i){let a=[],o=n-e,s=r-t;for(let t of this.#n){let n=Array(t.length);for(let i=0;i<t.length;i+=2)n[i]=e+t[i]*o,n[i+1]=r-t[i+1]*s;a.push(n)}return a}get box(){return this.#e}},iO=class extends QD{newFreeDrawOutline(e,t,n,r,i,a){return new oO(e,t,n,r,i,a)}},aO=class{#e;#t;constructor(e,t,n,r,i,a,o){this.#e=new iO(e,t,n,r,i,a,o),this.#t=i}add(e,t){return this.#e.add(e,t)?{path:{d:this.#e.toSVGPath()}}:null}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)t=this.#e.add(e[n],e[n+1])||t;return t?{path:{d:this.#e.toSVGPath()}}:null}end(e,t){return e===void 0?null:this.add(e,t)}isEmpty(){return this.#e.isEmpty()}isCancellable(){return this.#e.isCancellable()}removeLastElement(){return this.#e.removeLastElement()}updateProperty(e,t){return null}getOutlines(){let e=this.#e.getOutlines();return e.buildFocusOutline(2*this.#t),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:!0},path:{d:this.#e.toSVGPath()}}}},oO=class e extends $D{static#e=1.5;newOutliner(e,t,n,r,i,a,o=0){return new iO(e,t,n,r,i,a,o)}get isFree(){return!0}buildFocusOutline(t){this.focusOutline=this.getNewOutline(t/2+e.#e,.0025)}get defaultSVGProperties(){return eO(this)}getFocusSVGProperties(e){return tO(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,t){if(e!==`thickness`)return null;let n=this.updateThickness(t/2);return this.buildFocusOutline(t),n}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}},sO=class e extends XD{constructor(e=null){super(),super.updateProperties(e)}updateSVGProperty(e,t){e!==`thickness`&&super.updateSVGProperty(e,t)}clone(){let t=new e;return t.updateAll(this),t}},cO=class e extends ZD{#e=null;#t=0;#n=null;#r=0;#i=``;#a=``;static _DEFAULT_OPACITY=1;static _DEFAULT_THICKNESS=12;static _defaultDrawingOptions=null;static _type=`highlight`;static _editorType=kS.HIGHLIGHT;static get _keyboardManager(){let t=e.prototype;return X(this,`_keyboardManager`,new cw([[[`ArrowLeft`],t._moveCaret,{args:[0]}],[[`ArrowRight`],t._moveCaret,{args:[1]}],[[`ArrowUp`],t._moveCaret,{args:[2]}],[[`ArrowDown`],t._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:`highlightEditor`}),this.#e=e.anchorNode||null,this.#t=e.anchorOffset||0,this.#n=e.focusNode||null,this.#r=e.focusOffset||0,this.#i=e.methodOfCreation||(this._drawOutlines?.isFree?`main_toolbar`:``),this.#a=e.text||``,this._isDraggable=!1,this.defaultL10nId=`pdfjs-editor-highlight-editor`,this.rotate()}static initialize(t,n){_w.initialize(t,n),this._defaultDrawingOptions||=new sO({fill:n.highlightColors?.values().next().value||`#fff066`,"fill-opacity":e._DEFAULT_OPACITY,thickness:e._DEFAULT_THICKNESS})}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get typesMap(){return X(this,`typesMap`,new Map([[AS.HIGHLIGHT_COLOR,`fill`],[AS.HIGHLIGHT_THICKNESS,`thickness`]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(t){let{boxes:n,drawOutlines:r}=t;(n||r)&&(this._drawingOptions||=t.drawingOptions||e.getDefaultDrawingOptions(),n&&(t={...t,drawOutlines:rO.build(n,this._uiManager.direction===`ltr`)}),super._addOutlines(t))}get colorType(){return AS.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions[`fill-opacity`]}get _opacityName(){return`fill-opacity`}get _drawRotation(){return this._drawOutlines?.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){return!this._drawOutlines?.isFree}get telemetryInitialData(){return{action:`added`,type:this._drawOutlines.isFree?`free_highlight`:`highlight`,color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:this.#i}}get telemetryFinalData(){return{type:`highlight`,color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get(`color`).size}}translateInPage(e,t){}get toolbarPosition(){return this.#o(this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return this.#o(this._drawOutlines.firstPoint)}#o([e,t]){let[n,r,i,a]=this._drawOutlines.box;return[(e-n)/i,(t-r)/a]}updateParams(t,n){switch(t){case AS.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,e._DEFAULT_OPACITY,t),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(n)},!0);break;case AS.HIGHLIGHT_THICKNESS:super.updateParams(t,n),this._reportTelemetry({action:`thickness_changed`,thickness:n},!0)}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([AS.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new cD({editor:this}),[[`colorPicker`,this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,t){return super.getRect(e,t,this._drawRotation)}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this._reportTelemetry({action:`deleted`}),super.remove()}render(){if(this.div)return this.div;let e=super.render();return this.#a&&(e.setAttribute(`aria-label`,this.#a),e.setAttribute(`role`,`mark`)),this._drawOutlines.isFree?e.classList.add(`free`):e.addEventListener(`keydown`,this.#s.bind(this),{signal:this._uiManager._signal}),this.enableEditing(),e}#s(t){e._keyboardManager.exec(this,t)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#c(!0);break;case 1:case 3:this.#c(!1)}}#c(e){if(!this.#e)return;let t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#n,this.#r)}unselect(){super.unselect(),this._drawOutlines.isFree||this.#c(!1)}static createDrawerInstance({x:e,y:t,box:n,parent:r,isLTR:i}){return new aO(e,t,n,r.scale,this._defaultDrawingOptions.thickness/2,i,.001)}static _getDrawingTarget(e,{target:t}){return t.closest(`.textLayer`)}static _getPointerCoords({x:e,y:t}){return[e,t]}static _addDrawingListeners(e,t){e.classList.add(`free`),t.addEventListener(`abort`,()=>e.classList.remove(`free`),{once:!0}),window.addEventListener(`blur`,()=>this._endDraw(null),{signal:t}),window.addEventListener(`pointerdown`,NC,{capture:!0,passive:!1,signal:t})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:t,opacity:n,thickness:r}){let{_defaultDrawingOptions:i,_DEFAULT_OPACITY:a}=e;this._drawingOptions=e.getDefaultDrawingOptions({fill:Z.makeHexColor(...t),"fill-opacity":n||a,thickness:r||i.thickness})}static deserializeDraw(e,t,n,r,i,a,o){let{quadPoints:s}=a;if(s){let i=[];for(let a=0,o=s.length;a<o;a+=8)i.push({x:(s[a]-e)/n,y:1-(s[a+1]-t)/r,width:(s[a+2]-s[a])/n,height:(s[a+1]-s[a+5])/r});return rO.build(i,o.direction===`ltr`)}let c=a.thickness||this._defaultDrawingOptions.thickness,l=(a.inkLists||a.outlines.points)[0],u=new iO(l[0]-e,r-(l[1]-t),[0,0,n,r],1,c/2,!0,.001);for(let n=0,i=l.length;n<i;n+=2)u.add(l[n]-e,r-(l[n+1]-t));let d=u.getOutlines();return d.buildFocusOutline(c),d}static async deserialize(e,t,n){let r=null;if(e instanceof BD){let{data:{quadPoints:t,rect:n,rotation:i,id:a,color:o,opacity:s,popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:kS.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}else if(e instanceof zD){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,borderStyle:{rawWidth:s},popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:kS.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=super.serialize(e);return Object.assign(t,{color:_w._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(t.rect,this._drawRotation)}),this.addComment(t),this.annotationElementId&&!this.#l(t)?null:(t.id=this.annotationElementId,t)}#l(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,n)=>e!==t[n])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},lO=class{#e=new Float64Array(6);#t=new Float64Array(2);#n;#r;#i;#a;#o;#s=``;#c=0;#l=new uO;#u;#d;constructor(e,t,n,r,i,a){this.#u=n,this.#d=r,this.#i=i,this.#a=a,[e,t]=this.#f(e,t);let o=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#r=[{line:o,points:this.#o}],this.#e.set(o,0),this.#t.set([e,t],0)}updateProperty(e,t){e===`stroke-width`&&(this.#a=t)}#f(e,t){return Q._normalizePoint(e,t,this.#u,this.#d,this.#i)}isEmpty(){return!this.#r?.length}isCancellable(){return this.#o.length<=10}add(e,t){return this.#p(e,t)&&this.toSVGPath(),{path:{d:this.#m()}}}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)this.#p(e[n],e[n+1])&&(t=!0,this.#o.length<=6&&(this.toSVGPath(),t=!1));return t&&this.toSVGPath(),{path:{d:this.#m()}}}#p(e,t){[e,t]=this.#f(e,t),this.#t.set([e,t],0);let[n,r,i,a]=this.#e.subarray(2,6),o=e-i,s=t-a;return Math.hypot(this.#u*o,this.#d*s)<=2?!1:(this.#o.push(e,t),isNaN(n)?(this.#e.set([i,a,e,t],2),this.#n.push(NaN,NaN,NaN,NaN,e,t),!0):(isNaN(this.#e[0])&&this.#n.splice(6,6),this.#e.set([n,r,i,a,e,t],0),this.#n.push(...Q.createBezierPoints(n,r,i,a,e,t)),!0))}end(e,t){return e!==void 0&&this.#p(e,t)||this.#o.length===2?{path:{d:this.toSVGPath()}}:{path:{d:this.#s}}}startNew(e,t,n,r,i){this.#u=n,this.#d=r,this.#i=i,[e,t]=this.#f(e,t);let a=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#t.set([e,t],0);let o=this.#r.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#r.push({line:a,points:this.#o}),this.#e.set(a,0),this.#c=0,this.toSVGPath(),null}getLastElement(){return this.#r.at(-1)}setLastElement(e){return this.#r?(this.#r.push(e),this.#n=e.line,this.#o=e.points,this.#c=0,{path:{d:this.toSVGPath()}}):this.#l.setLastElement(e)}removeLastElement(){if(!this.#r)return this.#l.removeLastElement();this.#r.pop(),this.#s=``;for(let e=0,t=this.#r.length;e<t;e++){let{line:t,points:n}=this.#r[e];this.#n=t,this.#o=n,this.#c=0,this.toSVGPath()}return{path:{d:this.#s}}}#m(){let e=Q.svgRound(this.#t[0]),t=Q.svgRound(this.#t[1]);if(this.#o.length===2){let n=Q.svgRound(this.#n[4]),r=Q.svgRound(this.#n[5]);return`${this.#s} M ${n} ${r} L ${e} ${t}`}return`${this.#s} L ${e} ${t}`}toSVGPath(){let e=Q.svgRound(this.#n[4]),t=Q.svgRound(this.#n[5]);if(this.#o.length===2)return this.#s=`${this.#s} M ${e} ${t} Z`,this.#s;if(this.#o.length<=6){let n=this.#s.lastIndexOf(`M`);this.#s=`${this.#s.slice(0,n)} M ${e} ${t}`,this.#c=6}if(this.#o.length===4){let e=Q.svgRound(this.#n[10]),t=Q.svgRound(this.#n[11]);return this.#s=`${this.#s} L ${e} ${t}`,this.#c=12,this.#s}let n=[];this.#c===0&&(n.push(`M ${e} ${t}`),this.#c=6);for(let e=this.#c,t=this.#n.length;e<t;e+=6){let[t,r,i,a,o,s]=this.#n.slice(e,e+6).map(Q.svgRound);n.push(`C${t} ${r} ${i} ${a} ${o} ${s}`)}return this.#s+=n.join(` `),this.#c=this.#n.length,this.#s}getOutlines(e,t,n,r){let i=this.#r.at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),this.#l.build(this.#r,e,t,n,this.#i,this.#a,r),this.#e=null,this.#n=null,this.#r=null,this.#s=null,this.#l}get defaultSVGProperties(){return{root:{viewBox:`0 0 10000 10000`},rootClass:{draw:!0},bbox:[0,0,1,1]}}},uO=class extends Q{#e;#t=0;#n;#r;#i;#a;#o;#s;#c;build(e,t,n,r,i,a,o){this.#i=t,this.#a=n,this.#o=r,this.#s=i,this.#c=a,this.#n=o??0,this.#r=e,this.#d()}get thickness(){return this.#c}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#r){if(e.push(`M${Q.svgRound(t[4])} ${Q.svgRound(t[5])}`),t.length===6){e.push(`Z`);continue}if(t.length===12&&isNaN(t[6])){e.push(`L${Q.svgRound(t[10])} ${Q.svgRound(t[11])}`);continue}for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map(Q.svgRound);e.push(`C${r} ${i} ${a} ${o} ${s} ${c}`)}}return e.join(``)}serialize([e,t,n,r],i){let a=[],o=[],[s,c,l,u]=this.#u(),d,f,p,m,h,g,_,v,y;switch(this.#s){case 0:y=Q._rescale,d=e,f=t+r,p=n,m=-r,h=e+s*n,g=t+(1-c-u)*r,_=e+(s+l)*n,v=t+(1-c)*r;break;case 90:y=Q._rescaleAndSwap,d=e,f=t,p=n,m=r,h=e+c*n,g=t+s*r,_=e+(c+u)*n,v=t+(s+l)*r;break;case 180:y=Q._rescale,d=e+n,f=t,p=-n,m=r,h=e+(1-s-l)*n,g=t+c*r,_=e+(1-s)*n,v=t+(c+u)*r;break;case 270:y=Q._rescaleAndSwap,d=e+n,f=t+r,p=-n,m=-r,h=e+(1-c-u)*n,g=t+(1-s-l)*r,_=e+(1-c)*n,v=t+(1-s)*r}for(let{line:e,points:t}of this.#r)a.push(y(e,d,f,p,m,i?Array(e.length):null)),o.push(y(t,d,f,p,m,i?Array(t.length):null));return{lines:a,points:o,rect:[h,g,_,v]}}static deserialize(e,t,n,r,i,{paths:{lines:a,points:o},rotation:s,thickness:c}){let l=[],u,d,f,p,m;switch(s){case 0:m=Q._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=Q._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=Q._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=Q._rescaleAndSwap,u=t/r+1,d=e/n+1,f=-1/r,p=-1/n}if(!a){a=[];for(let e of o){let t=e.length;if(t===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(t===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}let n=new Float32Array(3*(t-2));a.push(n);let[r,i,o,s]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,i],0);for(let a=4;a<t;a+=2){let t=e[a],c=e[a+1];n.set(Q.createBezierPoints(r,i,o,s,t,c),(a-2)*3),[r,i,o,s]=[o,s,t,c]}}}for(let e=0,t=a.length;e<t;e++)l.push({line:m(a[e].map(e=>e??NaN),u,d,f,p),points:m(o[e].map(e=>e??NaN),u,d,f,p)});let h=new this.prototype.constructor;return h.build(l,n,r,1,s,c,i),h}#l(e=this.#c){let t=this.#n+e/2*this.#o;return this.#s%180==0?[t/this.#i,t/this.#a]:[t/this.#a,t/this.#i]}#u(){let[e,t,n,r]=this.#e,[i,a]=this.#l(0);return[e+i,t+a,n-2*i,r-2*a]}#d(){let e=this.#e=SS.slice();for(let{line:t}of this.#r){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)Z.pointBoundingBox(t[n],t[n+1],e);continue}let n=t[4],r=t[5];for(let i=6,a=t.length;i<a;i+=6){let[a,o,s,c,l,u]=t.subarray(i,i+6);Z.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,n]=this.#l();e[0]=_C(e[0]-t,0,1),e[1]=_C(e[1]-n,0,1),e[2]=_C(e[2]+t,0,1),e[3]=_C(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e===`stroke-width`?this.#f(t):null}#f(e){let[t,n]=this.#l();this.#c=e;let[r,i]=this.#l(),[a,o]=[r-t,i-n],s=this.#e;return s[0]-=a,s[1]-=o,s[2]+=2*a,s[3]+=2*o,s}updateParentDimensions([e,t],n){let[r,i]=this.#l();this.#i=e,this.#a=t,this.#o=n;let[a,o]=this.#l(),s=a-r,c=o-i,l=this.#e;return l[0]-=s,l[1]-=c,l[2]+=2*s,l[3]+=2*c,l}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Q.svgRound).join(` `)}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Q.svgRound(e)} ${Q.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,n=0,r=0,i=0,a=0,o=0,s=0;switch(this.#t){case 90:r=t/e,i=-e/t,o=e;break;case 180:n=-1,a=-1,o=e,s=t;break;case 270:r=-t/e,i=e/t,s=t;break;default:return``}return`matrix(${n} ${r} ${i} ${a} ${Q.svgRound(o)} ${Q.svgRound(s)})`}getPathResizingSVGProperties([e,t,n,r]){let[i,a]=this.#l(),[o,s,c,l]=this.#e;if(Math.abs(c-i)<=Q.PRECISION||Math.abs(l-a)<=Q.PRECISION){let i=e+n/2-(o+c/2),a=t+r/2-(s+l/2);return{path:{"transform-origin":`${Q.svgRound(e)} ${Q.svgRound(t)}`,transform:`${this.rotationTransform} translate(${i} ${a})`}}}let u=(n-2*i)/(c-2*i),d=(r-2*a)/(l-2*a),f=c/n,p=l/r;return{path:{"transform-origin":`${Q.svgRound(o)} ${Q.svgRound(s)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${Q.svgRound(i)} ${Q.svgRound(a)}) scale(${u} ${d}) translate(${Q.svgRound(-i)} ${Q.svgRound(-a)})`}}}getPathResizedSVGProperties([e,t,n,r]){let[i,a]=this.#l(),o=this.#e,[s,c,l,u]=o;if(o[0]=e,o[1]=t,o[2]=n,o[3]=r,Math.abs(l-i)<=Q.PRECISION||Math.abs(u-a)<=Q.PRECISION){let i=e+n/2-(s+l/2),a=t+r/2-(c+u/2);for(let{line:e,points:t}of this.#r)Q._translate(e,i,a,e),Q._translate(t,i,a,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Q.svgRound(e)} ${Q.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*i)/(l-2*i),f=(r-2*a)/(u-2*a),p=-d*(s+i)+e+i,m=-f*(c+a)+t+a;if(d!==1||f!==1||p!==0||m!==0)for(let{line:e,points:t}of this.#r)Q._rescale(e,p,m,d,f,e),Q._rescale(t,p,m,d,f,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Q.svgRound(e)} ${Q.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[r,i]=n,a=this.#e,o=e-a[0],s=t-a[1];if(this.#i===r&&this.#a===i)for(let{line:e,points:t}of this.#r)Q._translate(e,o,s,e),Q._translate(t,o,s,t);else{let e=this.#i/r,t=this.#a/i;this.#i=r,this.#a=i;for(let{line:n,points:r}of this.#r)Q._rescale(n,o,s,e,t,n),Q._rescale(r,o,s,e,t,r);a[2]*=e,a[3]*=t}return a[0]=e,a[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Q.svgRound(e)} ${Q.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Q.svgRound(e[0])} ${Q.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},dO=class e extends XD{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:_w._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":10})}updateSVGProperty(e,t){e===`stroke-width`&&(t??=this[`stroke-width`],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},fO=class e extends ZD{static _type=`ink`;static _editorType=kS.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:`inkEditor`}),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){_w.initialize(e,t),this._defaultDrawingOptions=new dO(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return X(this,`typesMap`,new Map([[AS.INK_THICKNESS,`stroke-width`],[AS.INK_COLOR,`stroke`],[AS.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance({x:e,y:t,box:[,,n,r],rotation:i}){return new lO(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return uO.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof zD){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,opacity:s,borderStyle:{rawWidth:c},popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},parent:{page:{pageNumber:m}}}=e;r=e={annotationType:kS.INK,color:Array.from(o),thickness:c,opacity:s,paths:{points:t},boxes:null,pageIndex:m-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}get toolbarButtons(){return this._colorPicker||=new lD(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return AS.INK_COLOR}get colorAndOpacityType(){return AS.INK_COLOR_AND_OPACITY}get opacityType(){return AS.INK_OPACITY}updateParams(e,t){if(e===AS.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(t.color,t.opacity);return}super.updateParams(e,t)}static updateDefaultParams(e,t){if(e===AS.INK_COLOR_AND_OPACITY){super.updateDefaultParams(AS.INK_COLOR,t.color),super.updateDefaultParams(AS.INK_OPACITY,t.opacity);return}super.updateDefaultParams(e,t)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions[`stroke-opacity`]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty(`stroke-width`),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty(`stroke-width`),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:r}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:Z.makeHexColor(...t),"stroke-width":n,"stroke-opacity":r})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":i,"stroke-width":a}}=this,o=Object.assign(super.serialize(e),{color:_w._colorManager.convert(r),opacity:i,thickness:a,paths:{lines:t,points:n}});return this.addComment(o),e?(o.isCopy=!0,o):this.annotationElementId&&!this.#e(o)?null:(o.id=this.annotationElementId,o)}#e(e){let{color:t,thickness:n,opacity:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,n)=>e!==t[n])||e.thickness!==n||e.opacity!==r||e.pageIndex!==i}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions[`stroke-width`],points:t,popup:this.comment}),null}},pO=class extends uO{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}},mO=8,hO=3,gO=class{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,r){return n-=e,r-=t,n===0?r>0?0:4:n===1?r+6:2-r}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(-i+s-o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#i(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(i+s+o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#a(e,t,n,r){let i=e.length,a=new Int32Array(i);for(let t=0;t<i;t++)a[t]=+(e[t]<=r);for(let e=1;e<n-1;e++)a[e*t]=a[e*t+t-1]=0;for(let e=0;e<t;e++)a[e]=a[t*n-1-e]=0;let o=1,s,c=[];for(let e=1;e<n-1;e++){s=1;for(let n=1;n<t-1;n++){let r=e*t+n,i=a[r];if(i===0)continue;let l=e,u=n;if(i===1&&a[r-1]===0)o+=1,--u;else if(i>=1&&a[r+1]===0)o+=1,u+=1,i>1&&(s=i);else{i!==1&&(s=Math.abs(i));continue}let d=[n,e],f=u===n+1,p={isHole:f,points:d,id:o,parent:0};c.push(p);let m;for(let e of c)if(e.id===s){m=e;break}p.parent=m?m.isHole?f?m.parent:s:f?s:m.parent:f?s:0;let h=this.#r(a,t,e,n,l,u,0);if(h===-1){a[r]=-o,a[r]!==1&&(s=Math.abs(a[r]));continue}let g=this.#n[2*h],_=this.#n[2*h+1],v=e+g,y=n+_;l=v,u=y;let b=e,x=n;for(;;){let i=this.#i(a,t,b,x,l,u,1);g=this.#n[2*i],_=this.#n[2*i+1];let c=b+g,f=x+_;d.push(f,c);let p=b*t+x;if(a[p+1]===0?a[p]=-o:a[p]===1&&(a[p]=o),c===e&&f===n&&b===v&&x===y){a[r]!==1&&(s=Math.abs(a[r]));break}l=b,u=x,b=c,x=f}}}return c}static#o(e,t,n,r){if(n-t<=4){for(let i=t;i<n-2;i+=2)r.push(e[i],e[i+1]);return}let i=e[t],a=e[t+1],o=e[n-4]-i,s=e[n-3]-a,c=Math.hypot(o,s),l=o/c,u=s/c,d=l*a-u*i,f=s/o,p=1/c,m=Math.atan(f),h=Math.cos(m),g=Math.sin(m),_=p*(Math.abs(h)+Math.abs(g)),v=p*(1-_+_**2),y=Math.max(Math.atan(Math.abs(g+h)*v),Math.atan(Math.abs(g-h)*v)),b=0,x=t;for(let r=t+2;r<n-2;r+=2){let t=Math.abs(d-l*e[r+1]+u*e[r]);t>b&&(x=r,b=t)}b>(c*y)**2?(this.#o(e,t,x+2,r),this.#o(e,x,n,r)):r.push(i,a)}static#s(e){let t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,r,i,a){let o=new Float32Array(a**2),s=-2*r**2,c=a>>1;for(let e=0;e<a;e++){let t=(e-c)**2;for(let n=0;n<a;n++)o[e*a+n]=Math.exp((t+(n-c)**2)/s)}let l=new Float32Array(256),u=-2*i**2;for(let e=0;e<256;e++)l[e]=Math.exp(e**2/u);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let s=r*t+i,u=e[s],d=0,m=0;for(let s=0;s<a;s++){let f=r+s-c;if(!(f<0||f>=n))for(let n=0;n<a;n++){let r=i+n-c;if(r<0||r>=t)continue;let p=e[f*t+r],h=o[s*a+n]*l[Math.abs(p-u)];d+=p*h,m+=h}}let h=f[s]=Math.round(d/m);p[h]++}return[f,p]}static#l(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}static#u(e){let t=e.length,n=new Uint8ClampedArray(t>>2),r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t]=e[t<<2];r=Math.max(r,a),i=Math.min(i,a)}let a=255/(r-i);for(let e=0,t=n.length;e<t;e++)n[e]=(n[e]-i)*a;return n}static#d(e){let t,n=-1/0,r=-1/0,i=e.findIndex(e=>e!==0),a=i,o=i;for(t=i;t<256;t++){let i=e[t];i>n&&(t-a>r&&(r=t-a,o=t-1),n=i,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){let t=e,{width:n,height:r}=e,{maxDim:i}=this.#e,a=n,o=r;if(n>i||r>i){let s=n,c=r,l=Math.log2(Math.max(n,r)/i),u=Math.floor(l);l=l===u?u-1:u;for(let n=0;n<l;n++){a=Math.ceil(s/2),o=Math.ceil(c/2);let n=new OffscreenCanvas(a,o);n.getContext(`2d`).drawImage(e,0,0,s,c,0,0,a,o),s=a,c=o,e!==t&&e.close(),e=n.transferToImageBitmap()}let d=Math.min(i/a,i/o);a=Math.round(a*d),o=Math.round(o*d)}let s=new OffscreenCanvas(a,o).getContext(`2d`,{willReadFrequently:!0});s.fillStyle=`white`,s.fillRect(0,0,a,o),s.filter=`grayscale(1)`,s.drawImage(e,0,0,e.width,e.height,0,0,a,o);let c=s.getImageData(0,0,a,o).data;return[this.#u(c),a,o]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:r},i,a,o,s){let c=new OffscreenCanvas(1,1),l=c.getContext(`2d`,{alpha:!1}),u=l.font=`${n} ${r} 200px ${t}`,{actualBoundingBoxLeft:d,actualBoundingBoxRight:f,actualBoundingBoxAscent:p,actualBoundingBoxDescent:m,fontBoundingBoxAscent:h,fontBoundingBoxDescent:g,width:_}=l.measureText(e),v=1.5,y=Math.ceil(Math.max(Math.abs(d)+Math.abs(f)||0,_)*v),b=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||200,Math.abs(h)+Math.abs(g)||200)*v);c=new OffscreenCanvas(y,b),l=c.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),l.font=u,l.filter=`grayscale(1)`,l.fillStyle=`white`,l.fillRect(0,0,y,b),l.fillStyle=`black`,l.fillText(e,y*.5/2,b*1.5/2);let x=this.#u(l.getImageData(0,0,y,b).data),S=this.#l(x),C=this.#d(S),w=this.#a(x,y,b,C);return this.processDrawnLines({lines:{curves:w,width:y,height:b},pageWidth:i,pageHeight:a,rotation:o,innerMargin:s,mustSmooth:!0,areContours:!0})}static process(e,t,n,r,i){let[a,o,s]=this.#f(e),[c,l]=this.#c(a,o,s,Math.hypot(o,s)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),u=this.#d(l),d=this.#a(c,o,s,u);return this.processDrawnLines({lines:{curves:d,width:o,height:s},pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:a,areContours:o}){r%180!=0&&([t,n]=[n,t]);let{curves:s,width:c,height:l}=e,u=e.thickness??0,d=[],f=Math.min(t/c,n/l),p=f/t,m=f/n,h=[];for(let{points:e}of s){let t=a?this.#s(e):e;if(!t)continue;h.push(t);let n=t.length,r=new Float32Array(n),i=new Float32Array(3*(n===2?2:n-2));if(d.push({line:i,points:r}),n===2){r[0]=t[0]*p,r[1]=t[1]*m,i.set([NaN,NaN,NaN,NaN,r[0],r[1]],0);continue}let[o,s,c,l]=t;o*=p,s*=m,c*=p,l*=m,r.set([o,s,c,l],0),i.set([NaN,NaN,NaN,NaN,o,s],0);for(let e=4;e<n;e+=2){let n=r[e]=t[e]*p,a=r[e+1]=t[e+1]*m;i.set(Q.createBezierPoints(o,s,c,l,n,a),(e-2)*3),[o,s,c,l]=[c,l,n,a]}}if(d.length===0)return null;let g=o?new pO:new uO;return g.build(d,t,n,1,r,o?0:u,i),{outline:g,newCurves:h,areContours:o,thickness:u,width:c,height:l}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:r,height:i}){let a=1/0,o=-1/0,s=0;for(let t of e){s+=t.length;for(let e=2,n=t.length;e<n;e++){let n=t[e]-t[e-2];a=Math.min(a,n),o=Math.max(o,n)}}let c;c=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let l=e.length,u=mO+hO*l,d=new Uint32Array(u),f=0;d[f++]=u*Uint32Array.BYTES_PER_ELEMENT+(s-2*l)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=r,d[f++]=i,d[f++]=+!t,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=l,d[f++]=c.BYTES_PER_ELEMENT;for(let t of e)d[f++]=t.length-2,d[f++]=t[0],d[f++]=t[1];let p=new CompressionStream(`deflate-raw`),m=p.writable.getWriter();await m.ready,m.write(d);let h=c.prototype.constructor;for(let t of e){let e=new h(t.length-2);for(let n=2,r=t.length;n<r;n++)e[n-2]=t[n]-t[n-2];m.write(e)}return m.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:n,writable:r}=new DecompressionStream(`deflate-raw`),i=r.getWriter();await i.ready,i.write(t).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let a=null,o=0;for await(let e of n)a||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]),a.set(e,o),o+=e.length;let s=new Uint32Array(a.buffer,0,a.length>>2),c=s[1];if(c!==0)throw Error(`Invalid version: ${c}`);let l=s[2],u=s[3],d=s[4]===0,f=s[5],p=s[6],m=s[7],h=[],g=(mO+hO*p)*Uint32Array.BYTES_PER_ELEMENT,_;switch(m){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,g)}o=0;for(let e=0;e<p;e++){let t=s[hO*e+mO],n=new Float32Array(t+2);h.push(n);for(let t=0;t<2;t++)n[t]=s[hO*e+mO+t+1];for(let e=0;e<t;e++)n[e+2]=n[e]+_[o++]}return{areContours:d,thickness:f,outlines:h,width:l,height:u}}catch(e){return WS(`decompressSignature: ${e}`),null}}},_O=class e extends XD{constructor(){super(),super.updateProperties({fill:_w._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},vO=class e extends dO{constructor(e){super(e),super.updateProperties({stroke:_w._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},yO=class e extends ZD{#e=!1;#t=null;#n=null;#r=null;static _type=`signature`;static _editorType=kS.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:`signatureEditor`}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId=`pdfjs-editor-signature-editor1`}static initialize(e,t){_w.initialize(e,t),this._defaultDrawingOptions=new _O,this._defaultDrawnSignatureOptions=new vO(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return X(this,`typesMap`,new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:`signature`,hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let t=e.get(`hasDescription`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n,{_isCopy:r}=this;if(r&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null){if(this.#n){let{lines:t,mustSmooth:n,areContours:r,description:i,uuid:a,heightInPage:o}=this.#n,{rawDims:{pageWidth:s,pageHeight:c},rotation:l}=this.parent.viewport,u=gO.processDrawnLines({lines:t,pageWidth:s,pageHeight:c,rotation:l,innerMargin:e._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(u,o,i,a)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:``})),this.div.hidden=!0,this._uiManager.getSignature(this)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:this.#t||``}));return r&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}=this.#n,a=Math.max(r,i);return{areContours:t,outline:gO.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:a,y:o}=this,{outline:s}=this.#n=t;this.#e=s instanceof pO,this.description=r;let c;this.#e?c=e.getDefaultDrawingOptions():(c=e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":s.thickness})),this._addOutlines({drawOutlines:s,drawingOptions:c});let[,l]=this.pageDimensions,u=n/l;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return gO.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return gO.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return gO.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=this.#r,i.isCopy=!0):i.lines=t,this.#t&&(i.accessibilityData={type:`Figure`,alt:this.#t}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?pO.deserialize(e,t,n,r,i,a):uO.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=await super.deserialize(e,t,n);return r.#e=e.areContours,r.description=e.accessibilityData?.alt||``,r.#r=e.uuid,r}},bO=class extends _w{#e=null;#t=null;#n=null;#r=null;#i=null;#a=``;#o=null;#s=!1;#c=null;#l=!1;#u=!1;static _type=`stamp`;static _editorType=kS.STAMP;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){_w.initialize(e,t)}static isHandlingMimeForPasting(e){return HC.includes(e)}static paste(e,t){t.pasteEditor({mode:kS.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:`stamp`,hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get(`hasAltText`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#d(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:`pdfjs.image.image_added`,data:{alt_text_modal:!1,alt_text_type:`empty`}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#p(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#d(e,!0)).finally(()=>this.#f());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#d(e)).finally(()=>this.#f());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#d(e)).finally(()=>this.#f());return}let e=document.createElement(`input`);e.type=`file`,e.accept=HC.join(`,`);let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(t)}n()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&=(clearTimeout(this.#c),null)),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#p();return}super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#s)}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#s||(this.#e?this.#m():this.#p()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,r&&(this.#e=r),this.#s=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#c=null,this.#g()},200))}#m(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}this._uiManager.enableWaiting(!1);let o=this.#o=document.createElement(`canvas`);o.setAttribute(`role`,`img`),this.addContainer(o),this.width=t/r,this.height=n/i,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#g(),this.#u||=(this.parent.addUndoableEditor(this),!0),this._reportTelemetry({action:`inserted_image`}),this.#a&&this.div.setAttribute(`aria-description`,this.#a),this.annotationElementId||this._uiManager.a11yAlert(_w._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new VC,o=this.#e,s=r,c=i,l=null;if(t){if(r>t||i>t){let e=Math.min(t/r,t/i);s=Math.floor(r*e),c=Math.floor(i*e)}l=document.createElement(`canvas`);let e=l.width=Math.ceil(s*a.sx),n=l.height=Math.ceil(c*a.sy);this.#l||(o=this.#h(e,n));let u=l.getContext(`2d`);u.filter=this._uiManager.hcmFilter;let d=`white`,f=`#cfcfd8`;this._uiManager.hcmFilter===`none`?UC.isDarkMode&&(d=`#8f8f9d`,f=`#42414d`):f=`black`;let p=15*a.sx,m=15*a.sy,h=new OffscreenCanvas(p*2,m*2),g=h.getContext(`2d`);g.fillStyle=d,g.fillRect(0,0,p*2,m*2),g.fillStyle=f,g.fillRect(0,0,p,m),g.fillRect(p,m,p,m),u.fillStyle=u.createPattern(h,`repeat`),u.fillRect(0,0,e,n),u.drawImage(o,0,0,o.width,o.height,0,0,e,n)}let u=null;if(n){let t,n;if(a.symmetric&&o.width<e&&o.height<e)t=o.width,n=o.height;else if(o=this.#e,r>e||i>e){let a=Math.min(e/r,e/i);t=Math.floor(r*a),n=Math.floor(i*a),this.#l||(o=this.#h(t,n))}let s=new OffscreenCanvas(t,n).getContext(`2d`,{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,n),u={width:t,height:n,data:s.getImageData(0,0,t,n).data}}return{canvas:l,width:s,height:c,imageData:u}}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=Math.ceil(i/2)),a>2*t&&(a=Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(){let[e,t]=this.parentDimensions,{width:n,height:r}=this,i=new VC,a=Math.ceil(n*e*i.sx),o=Math.ceil(r*t*i.sy),s=this.#o;if(!s||s.width===a&&s.height===o)return;s.width=a,s.height=o;let c=this.#l?this.#e:this.#h(a,o),l=s.getContext(`2d`);l.filter=this._uiManager.hcmFilter,l.drawImage(c,0,0,c.width,c.height,0,0,a,o)}#_(e){if(e){if(this.#l){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#l){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*CC.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*CC.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let r=null,i=!1;if(e instanceof WD){let{data:{rect:a,rotation:o,id:s,structParent:c,popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},container:m,parent:{page:{pageNumber:h}},canvas:g}=e,_,v;g?(delete e.canvas,{id:_,bitmap:v}=n.imageManager.getFromCanvas(m.id,g),g.remove()):(i=!0,e._hasNoCanvas=!0);let y=(await t._structTree.getAriaAttributes(`${DS}${s}`))?.get(`aria-label`)||``;r=e={annotationType:kS.STAMP,bitmapId:_,bitmap:v,pageIndex:h-1,rect:a.slice(0),rotation:o,annotationElementId:s,id:s,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:c,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let a=await super.deserialize(e,t,n),{rect:o,bitmap:s,bitmapUrl:c,bitmapId:l,isSvg:u,accessibilityData:d}=e;i?(n.addMissingCanvas(e.id,a),a.#s=!0):l&&n.imageManager.isValidId(l)?(a.#t=l,s&&(a.#e=s)):a.#r=c,a.#l=u;let[f,p]=a.pageDimensions;return a.width=(o[2]-o[0])/f,a.height=(o[3]-o[1])/p,d&&(a.altTextData=d),a._initialData=r,e.comment&&a.setCommentData(e),a.#u=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#l});if(this.addComment(n),e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:r,altText:i}=this.serializeAltText(!1);if(!r&&i&&(n.accessibilityData={type:`Figure`,alt:i}),this.annotationElementId){let e=this.#v(n);return e.isSame?null:(e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;let a=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:a,serialized:n}),n.bitmap=this.#_(!1);else if(this.#l){let e=t.stamps.get(this.#t);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}#v(e){let{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,i=(e.accessibilityData?.alt||``)===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&i,isSameAltText:i}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},xO=class e{#e;#t=!1;#n=null;#r=null;#i=null;#a=new Map;#o=!1;#s=!1;#c=!1;#l=null;#u=null;#d=null;#f=null;#p=null;#m=-1;#h;static _initialized=!1;static#g=new Map([YD,fO,bO,cO,yO].map(e=>[e._editorType,e]));constructor({uiManager:t,pageIndex:n,div:r,structTreeLayer:i,accessibilityManager:a,annotationLayer:o,drawLayer:s,textLayer:c,viewport:l,l10n:u}){let d=[...e.#g.values()];if(!e._initialized){e._initialized=!0;for(let e of d)e.initialize(u,t)}t.registerEditorTypes(d),this.#h=t,this.pageIndex=n,this.div=r,this.#e=a,this.#n=o,this.viewport=l,this.#d=c,this.drawLayer=s,this._structTree=i,this.#h.addLayer(this)}get isEmpty(){return this.#a.size===0}get isInvisible(){return this.isEmpty&&this.#h.getMode()===kS.NONE}updateToolbar(e){this.#h.updateToolbar(e)}updateMode(t=this.#h.getMode()){switch(this.#S(),t){case kS.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case kS.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case kS.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle(`nonEditing`,!1),t===kS.POPUP)n.toggle(`commentEditing`,!0);else{n.toggle(`commentEditing`,!1);for(let r of e.#g.values())n.toggle(`${r._type}Editing`,t===r._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#d?.div}setEditingState(e){this.#h.setEditingState(e)}addCommands(e){this.#h.addCommands(e)}cleanUndoStack(e){this.#h.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle(`drawing`,!e)}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#_(){return this.#a.size===0?this.#h.getEditors(this.pageIndex):this.#a.values()}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle(`nonEditing`,!1),this.#p?.abort(),this.#p=null;let e=new Set;for(let t of this.#_)t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#h.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));let t=this.#n;if(t)for(let n of t.getEditableAnnotations()){if(n.hide(),this.#h.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#c=!1,this.#h._eventBus.dispatch(`editorsrendered`,{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#s=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle(`nonEditing`,!0),this.#d&&!this.#p){this.#p=new AbortController;let e=this.#h.combinedSignal(this.#p);this.#d.div.addEventListener(`pointerdown`,e=>{let{clientX:t,clientY:n,timeStamp:r}=e;if(r-this.#m>500){this.#m=r;return}this.#m=-1;let{classList:i}=this.div;i.toggle(`getElements`,!0);let a=document.elementsFromPoint(t,n);if(i.toggle(`getElements`,!1),!this.div.contains(a[0]))return;let o,s=RegExp(`^${OS}[0-9]+$`);for(let e of a)if(s.test(e.id)){o=e.id;break}if(!o)return;let c=this.#a.get(o);c?.annotationElementId===null&&(NC(e),c.dblclick(e))},{signal:e,capture:!0})}let t=this.#n,n=[];if(t){let e=new Map,r=new Map;for(let t of this.#_){if(t.disableEditing(),!t.annotationElementId){n.push(t);continue}if(t.serialize()!==null){e.set(t.annotationElementId,t);continue}r.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()}for(let n of t.getEditableAnnotations()){let{id:t}=n.data;if(this.#h.isDeletedAnnotationElement(t)){n.updateEdited({deleted:!0});continue}let i=r.get(t);if(i){i.resetAnnotationElement(n),i.show(!1),n.show();continue}i=e.get(t),i&&(this.#h.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show()}}this.#S(),this.isEmpty&&(this.div.hidden=!0);let{classList:r}=this.div;for(let t of e.#g.values())r.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(n),this.#s=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#h.getActive()!==e&&this.#h.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#f){this.#f=new AbortController;let e=this.#h.combinedSignal(this.#f);this.#d.div.addEventListener(`pointerdown`,this.#v.bind(this),{signal:e}),this.#d.div.classList.add(`highlighting`)}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#d.div.classList.remove(`highlighting`))}#v(e){this.#h.unselectAll();let{target:t}=e;if(t===this.#d.div||(t.getAttribute(`role`)===`img`||t.classList.contains(`endOfContent`)||t.classList.contains(`textLayerImages`)||t.classList.contains(`textLayerImagePlaceholder`))&&this.#d.div.contains(t)){let{isMac:t}=oC.platform;if(e.button!==0||e.ctrlKey&&t)return;this.#h.showAllEditors(`highlight`,!0,!0),cO.startDrawing(this,this.#h,this.#h.direction===`ltr`,e),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;let e=this.#h.combinedSignal(this.#r);this.div.addEventListener(`pointerdown`,this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener(`pointerup`,t,{signal:e}),this.div.addEventListener(`pointercancel`,t,{signal:e})}disableClick(){this.#r?.abort(),this.#r=null}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#h.isDeletedAnnotationElement(t)&&this.#h.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#s&&e.annotationElementId&&this.#h.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#h.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#h.addDeletedAnnotationElement(e),_w.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#h.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#h.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#h._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(let t of this.#a.values())if(t.uid===e)return t;return null}get#y(){return e.#g.get(this.#h.getMode())}combinedSignal(e){return this.#h.combinedSignal(e)}#b(e){let t=this.#y;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#h.updateMode(e.mode);let{offsetX:n,offsetY:r}=this.#x(),i=this.#h.getId(),a=this.#b({parent:this,id:i,x:n,y:r,uiManager:this.#h,isCentered:!0,...t});a&&this.add(a)}async deserialize(t){return await e.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#h)||null}createAndAddNewEditor(e,t,n={}){let r=this.#h.getId(),i=this.#b({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#h,isCentered:t,...n});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#h.setSelected(e)}toggleSelected(e){this.#h.toggleSelected(e)}unselect(e){this.#h.unselect(e)}pointerup(e){let{isMac:t}=oC.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}let n=this.#h.getMode();if(n===kS.STAMP||n===kS.POPUP||n===kS.SIGNATURE){this.#h.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#h.getMode()===kS.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:t}=oC.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let n=this.#h.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#h,!1,e);return}this.#h.setCurrentDrawingSession(this),this.#l=new AbortController;let t=this.#h.combinedSignal(this.#l);this.div.addEventListener(`blur`,({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#y.startDrawing(this,this.#h,!1,e)}pause(e){if(e){let{activeElement:e}=document;this.div.contains(e)&&(this.#u=e);return}this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#l?(this.#h.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#u=null,this.#y.endDrawing(e)):null}findNewParent(e,t,n){let r=this.#h.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#h.getActive()?.parent===this&&(this.#h.commitOrRemove(),this.#h.setActiveEditor(null)),this.#i&&=(clearTimeout(this.#i),null);for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#h.removeLayer(this)}#S(){for(let e of this.#a.values())e.isEmpty()&&e.remove()}async render({viewport:e}){this.viewport=e,BC(this.div,e);for(let e of this.#h.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#h.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#h.commitOrRemove(),this.#S();let t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,BC(this.div,{rotation:n}),t!==n)for(let e of this.#a.values())e.rotate(n)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#h.viewParameters.realScale}};function SO(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function CO(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(`.textLayer`):e.parentElement?.closest(`.textLayer`)||null:null}function wO(e,t,n,r){if(e===n)return t<=r;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function TO(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains(`textLayer`)||t!==e.childNodes.length)return{container:e,offset:t};let r=e.lastChild;return r?.nodeType===Node.ELEMENT_NODE&&r.classList.contains(`endOfContent`)&&(r=r.previousSibling),!r||!n.contains(r)?null:r.nodeType===Node.TEXT_NODE?{container:r,offset:r.textContent.length}:{container:r,offset:r.childNodes.length}}var EO=class e{#e=null;#t=new Map;#n=null;#r=null;#i=null;#a=null;#o=new Map;static#s=0;static#c=0;static#l=null;static#u=new Set;static#d=!1;static#f=new Set;static#p=new WeakMap;constructor({filterFactory:t=null,pageColors:n=null,pageIndex:r,textLayer:i=null}){if(this.pageIndex=r,this.#r=t,this.#i=n,i){let t=e.#p.get(i);if(t?.selectionDiv&&(t.selectionDiv.remove(),e.#u.delete(t.selectionDiv)),e.#p.set(i,{drawLayer:this}),e.#f.add(i),this.#n=i,this.#a=new MutationObserver(t=>{if(this.#e&&this.#n?.isConnected&&e.#h()){for(let{addedNodes:n}of t)for(let t of n)if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){e.#_();return}}}),this.#a.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:t}=e.#l;document.addEventListener(`selectionchange`,e.#_.bind(e),{signal:t}),document.addEventListener(`pointerdown`,()=>{e.#d=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{e.#d=!1},{signal:t}),window.addEventListener(`blur`,()=>{e.#d=!1},{signal:t})}}}setParent(t){if(!this.#e){this.#e=t,this.#n?.isConnected&&e.#h()&&e.#_();return}if(this.#e!==t){if(this.#t.size>0)for(let e of this.#t.values())e.remove(),t.append(e);this.#e=t}}static#m(e){let t=this.#p.get(e);t?.selectionDiv&&(t.selectionDiv.remove(),this.#u.delete(t.selectionDiv),t.selectionDiv=null,t.path=null)}static#h(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#g(){return this.#f.keys().filter(e=>e.isConnected).toArray().sort(SO)}static#_(){let t=document.getSelection();if(!t||t.isCollapsed){for(let e of this.#u)e.remove();this.#u.clear();return}let n=new WeakMap,r=this.#g(),i=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(n.collapsed)continue;let{startContainer:a,startOffset:o,endContainer:s,endOffset:c}=n,l=CO(a),u=CO(s),d=l===null,f=u===null;if(this.#d&&d!==f)return;if(t.rangeCount===1){let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:i}=t,d=CO(e),f=CO(r),p=wO(e,n,r,i);d&&f&&p!==null&&(p?(a=e,o=n,l=d,s=r,c=i,u=f):(a=r,o=i,l=f,s=e,c=n,u=d))}let p=r.filter(e=>n.intersectsNode(e));if(p.length===0)continue;let m=!1;if(l||(l=p[0],a=l,o=0,m=!0),u||(u=p.at(-1),s=u,c=u.childNodes.length,m=!0),s.nodeType===Node.ELEMENT_NODE){if(s.classList.contains(`endOfContent`)){let e=s.previousSibling;if(!e)continue;s=e,c=e.nodeType===Node.TEXT_NODE?e.textContent.length:e.childNodes.length}else if(s.classList.contains(`textLayer`)&&s.childNodes.length===c){let e=TO(s,c,u);if(!e)continue;s=e.container,c=e.offset}}if(a.nodeType===Node.ELEMENT_NODE){let e=TO(a,o,l);if(!e)continue;a=e.container,o=e.offset}if(l===u&&!m&&p.includes(l)){i.push([n,l]);continue}for(let e of p){let t=e.firstChild;if(!t)continue;let n=document.createRange();if(e===l?n.setStart(a,o):n.setStartBefore(t),e===u)n.setEnd(s,c);else{let t=e.lastChild;if(!t)continue;if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){let e=t.previousSibling;if(!e)continue;n.setEndAfter(e)}else n.setEndAfter(t)}n.collapsed||i.push([n,e])}}let a=new Set(i.map(e=>e[1]));for(let e of this.#f)a.has(e)||this.#m(e);for(let[t,r]of i){let i=e.#p.get(r);if(!i)continue;let a=n.get(r);if(!a){let e=r.getBoundingClientRect();a=(t,n,r,i)=>({x:(t-e.x)/e.width,y:(n-e.y)/e.height,width:r/e.width,height:i/e.height}),n.set(r,a)}let o=[];for(let{x:e,y:n,width:r,height:i}of t.getClientRects())r!==0&&i!==0&&({x:e,y:n,width:r,height:i}=a(e,n,r,i),(r!==1||i!==1)&&o.push(`M${e} ${n} h${r} v${i} h-${r} Z`));if(o.length===0)continue;let s=i.drawLayer,c=i.selectionDiv,l=i.path;if(!c){let t=`clip_selection_${e.#c++}`;c=document.createElement(`div`),c.className=`selection`,c.style.clipPath=`url(#${t})`;let n=s.#r?.createSelectionStyle(s.#i);if(n)for(let[e,t]of Object.entries(n))c.style.setProperty(e,t);let r=e._svgFactory.create(1,1,!0);r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`);let a=e._svgFactory.createElement(`clipPath`);a.setAttribute(`id`,t),a.setAttribute(`clipPathUnits`,`objectBoundingBox`),l=e._svgFactory.createElement(`path`),a.append(l),r.append(a),c.append(r),i.path=l,i.selectionDiv=c}s.#e&&c.parentNode!==s.#e&&(s.#e.append(c),this.#u.add(c)),l.setAttribute(`d`,o.join(` `))}}static get _svgFactory(){return X(this,`_svgFactory`,new mD)}static#v(e,[t,n,r,i]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*r}%`,a.height=`${100*i}%`}#y(){let t=e._svgFactory.create(1,1,!0);return this.#e.append(t),t.setAttribute(`aria-hidden`,`true`),t}#b(t,n){let r=e._svgFactory.createElement(`clipPath`);t.append(r);let i=`clip_${n}`;r.setAttribute(`id`,i),r.setAttribute(`clipPathUnits`,`objectBoundingBox`);let a=e._svgFactory.createElement(`use`);return r.append(a),a.setAttribute(`href`,`#${n}`),a.classList.add(`clip`),i}#x(e,t){for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)}draw(t,n=!1,r=!1){let i=e.#s++,a=this.#y(),o=e._svgFactory.createElement(`defs`);a.append(o);let s=e._svgFactory.createElement(`path`);o.append(s);let c=`path_${i}`;s.setAttribute(`id`,c),s.setAttribute(`vector-effect`,`non-scaling-stroke`),n&&this.#o.set(i,s);let l=r?this.#b(o,c):null,u=e._svgFactory.createElement(`use`);return a.append(u),u.setAttribute(`href`,`#${c}`),this.updateProperties(a,t),this.#t.set(i,a),{id:i,clipPathId:`url(#${l})`}}drawOutline(t,n){let r=e.#s++,i=this.#y(),a=e._svgFactory.createElement(`defs`);i.append(a);let o=e._svgFactory.createElement(`path`);a.append(o);let s=`path_${r}`;o.setAttribute(`id`,s),o.setAttribute(`vector-effect`,`non-scaling-stroke`);let c;if(n){let t=e._svgFactory.createElement(`mask`);a.append(t),c=`mask_${r}`,t.setAttribute(`id`,c),t.setAttribute(`maskUnits`,`objectBoundingBox`);let n=e._svgFactory.createElement(`rect`);t.append(n),n.setAttribute(`width`,`1`),n.setAttribute(`height`,`1`),n.setAttribute(`fill`,`white`);let i=e._svgFactory.createElement(`use`);t.append(i),i.setAttribute(`href`,`#${s}`),i.setAttribute(`stroke`,`none`),i.setAttribute(`fill`,`black`),i.setAttribute(`fill-rule`,`nonzero`),i.classList.add(`mask`)}let l=e._svgFactory.createElement(`use`);i.append(l),l.setAttribute(`href`,`#${s}`),c&&l.setAttribute(`mask`,`url(#${c})`);let u=l.cloneNode();return i.append(u),l.classList.add(`mainOutline`),u.classList.add(`secondaryOutline`),this.updateProperties(i,t),this.#t.set(r,i),r}finalizeDraw(e,t){this.#o.delete(e),this.updateProperties(e,t)}updateProperties(t,n){if(!n)return;let{root:r,bbox:i,rootClass:a,path:o}=n,s=typeof t==`number`?this.#t.get(t):t;if(s){if(r&&this.#x(s,r),i&&e.#v(s,i),a){let{classList:e}=s;for(let[t,n]of Object.entries(a))e.toggle(t,n)}if(o){let e=s.firstElementChild.firstElementChild;this.#x(e,o)}}}updateParent(e,t){if(t===this)return;let n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#o.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();this.#t.clear(),this.#o.clear(),this.#a?.disconnect(),this.#a=null,this.#n&&=(e.#p.get(this.#n)?.drawLayer===this&&(e.#m(this.#n),e.#p.delete(this.#n),e.#f.delete(this.#n),e.#f.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),null)}};function DO(e){return`${(e*100).toFixed(2)}%`}var OO=class e{#e=[];#t=new Map;#n=null;#r=0;#i=0;#a=0;static#o=null;constructor(e,t,n,r){this.#r=e,this.#e=t,this.#i=n.rawDims.pageWidth,this.#a=n.rawDims.pageHeight,this.#n=r}render(){let t=document.createElement(`div`);t.className=`textLayerImages`;for(let e=0;e<this.#e.length;e+=6){let n=this.#s(this.#e.subarray(e,e+6));n&&t.append(n)}return t.addEventListener(`contextmenu`,t=>{if(!(t.target instanceof HTMLCanvasElement))return;let n=t.target,r=this.#t.get(n);if(!r)return;let i=e.#o?.deref();if(i===n)return;i&&(i.width=0,i.height=0),e.#o=new WeakRef(n);let{inverseTransform:a,x1:o,y1:s,width:c,height:l}=r,u=this.#n(),d=Math.ceil(o*u.width),f=Math.ceil(s*u.height),p=Math.floor((o+c/this.#i)*u.width),m=Math.floor((s+l/this.#a)*u.height);n.width=p-d,n.height=m-f;let h=n.getContext(`2d`);h.setTransform(...a),h.translate(-d,-f),h.drawImage(u,0,0)}),t}#s([e,t,n,r,i,a]){let o=Math.hypot((i-e)*this.#i,(a-t)*this.#a),s=Math.hypot((n-e)*this.#i,(r-t)*this.#a);if(o<this.#r||s<this.#r)return null;let c=[(i-e)*this.#i/o,(a-t)*this.#a/o,(n-e)*this.#i/s,(r-t)*this.#a/s,0,0],l=Z.inverseTransform(c),u=document.createElement(`canvas`);return u.className=`textLayerImagePlaceholder`,u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:`absolute`,left:DO(e),top:DO(t),width:DO(o/this.#i),height:DO(s/this.#a),transformOrigin:`0% 0%`,transform:`matrix(${c.join(`,`)})`}),this.#t.set(u,{inverseTransform:l,width:o,height:s,x1:e,y1:t}),u}};globalThis._pdfjsTestingUtils={HighlightOutliner:nO},globalThis.pdfjsLib={AbortException:rC,AnnotationEditorLayer:xO,AnnotationEditorParamsType:AS,AnnotationEditorType:kS,AnnotationEditorUIManager:uw,AnnotationLayer:qD,AnnotationMode:ES,AnnotationType:PS,applyOpacity:GC,build:sD,ColorPicker:cD,createValidAbsoluteUrl:JS,CSSConstants:WC,DOMSVGFactory:mD,DrawLayer:EO,FeatureTest:oC,fetchData:wC,findContrastColor:ZC,getDocument:ZE,getFilenameFromUrl:OC,getPdfFilenameFromUrl:kC,getRGB:IC,getRGBA:FC,getUuid:dC,GlobalWorkerOptions:RE,ImageKind:NS,InvalidPDFException:eC,isDataScheme:EC,isPdfFile:DC,isValidExplicitDest:iT,makeArr:pC,makeMap:mC,makeObj:hC,makeSet:gC,MathClamp:_C,noContextMenu:MC,normalizeUnicode:uC,OPS:LS,OutputScale:VC,PasswordException:QS,PasswordResponses:zS,PDFDataRangeTransport:$E,PDFDateString:PC,PDFWorker:nD,PermissionFlag:jS,PixelsPerInch:CC,RenderingCancelledException:TC,renderRichText:QC,ResponseException:tC,setLayerDimensions:BC,shadow:X,SignatureExtractor:gO,stopEvent:NC,SupportedImageMimeTypes:HC,TextLayer:YE,TextLayerImages:OO,TouchManager:gw,updateUrlHash:YS,Util:Z,VerbosityLevel:IS,version:oD,XfaLayer:SC};var kO=`/assets/pdf.worker.min-Dswkl-cV.mjs`;RE.workerSrc=kO;function AO(e){if(e<1048576){let t=e/1024;return`${parseFloat(t.toFixed(1))}KB`}{let t=e/1048576;return`${parseFloat(t.toFixed(1))}MB`}}async function jO(e,t,n){try{let r=await Oe({method:`get`,url:e,responseType:`blob`,headers:n?.headers,onDownloadProgress:e=>{n?.onProgress&&e.total&&n.onProgress(Math.floor(e.loaded/e.total*100))}}),i=new Blob([r.data]),a=document.createElement(`a`),o=URL.createObjectURL(i);a.href=o,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)}catch(e){throw console.error(`下载失败:`,e),G.error(`下载失败`),e}}async function MO(e){let t=ZE({data:await e.arrayBuffer()});try{return(await t.promise).numPages}finally{await t.destroy()}}function NO(e,t){return`${e.orgName?`【${e.orgName}】`:``}${e.title}【洞见研报DJyanbao.com】.${t}`}function PO(e){return e===`pdf`?`PDF`:e===`docx`?`Word`:`PPT`}function FO({isOpen:e,onClose:t,report:n,onDownloadSuccess:r}){let i=on(e=>e.open),{isAdvancedVip:a,isCoCreationVip:o,isTeamVip:s}=tx(),c=a||o||s,[l,u]=(0,J.useState)(`idle`),[d,f]=(0,J.useState)(`pdf`),[p,m]=(0,J.useState)(0),h=(0,J.useRef)(null),g=(0,J.useRef)(!1),_=(0,J.useRef)(!1),v=(0,J.useCallback)((e=!0)=>{h.current!=null&&(clearInterval(h.current),h.current=null),g.current=!1,e&&(_.current=!0)},[]);(0,J.useEffect)(()=>()=>{v(!1)},[v]);let y=()=>{v(),t()};if(!e||!n)return null;let b=async(e,t)=>{f(e),u(`downloading`),m(0);try{await jO(t,NO(n,e),{onProgress:m}),await me({reportId:n.id,format:e}),r?.(n.id),m(100),u(`success`),setTimeout(()=>{y()},1e3)}catch{v(),u(`idle`),m(0)}},x=async()=>{f(`pdf`),m(0);try{let e=await Ce(n.id,{action:`download`,format:`pdf`});if(!e.fileUrl){G.error(`未获取到下载地址`);return}await b(`pdf`,e.fileUrl)}catch{v(),u(`idle`),m(0)}},S=e=>{v(),_.current=!1,u(`converting`);let r=()=>{g.current||(g.current=!0,(async()=>{try{let r=await de({reportId:n.id,format:e});if(_.current)return;if(r.status===`success`){v(!1);let e=await Ce(n.id,{action:`download`,format:r.format});if(_.current)return;if(!e.fileUrl){G.error(`未获取到下载地址`),v(),u(`idle`),m(0);return}await b(r.format,e.fileUrl)}else r.status===`fail`&&(v(),G.error(`文件转换失败`),t(),i(`convertFail`,{convertFailType:`fail`}))}catch{v(),u(`idle`),m(0)}finally{g.current=!1}})())};r(),h.current=setInterval(r,3e3)},C=async()=>{if(!n.canConvert){G.error(`当前报告不支持转换`);return}if(!c){t(),i(`payVip`);return}let e=n.isHorizontal?`pptx`:`docx`;f(e),m(0),u(`converting`);try{let t=await Ce(n.id,{action:`download`,format:e});if(t.fileUrl){await b(e,t.fileUrl);return}S(e)}catch{v(),u(`idle`),m(0)}},w=`${n.pageTotal}页 · ${AO(n.fileSize)}`,T=n.canConvert;return(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`absolute inset-0 bg-slate-900/60`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.95,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:15},className:`relative w-full max-w-xl bg-white rounded-3xl shadow-[0_20px_60px_rgba(15,23,42,0.18)] overflow-hidden flex flex-col font-sans border border-slate-100`,children:[(0,Y.jsxs)(`div`,{className:`bg-[#eff5ff] px-8 py-7 border-b border-blue-100 relative`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:y,className:`absolute top-5 right-5 text-slate-500 hover:text-slate-700 transition-colors p-1.5 hover:bg-blue-100/50 rounded-full cursor-pointer`,children:(0,Y.jsx)(tn,{size:18})}),(0,Y.jsx)(`h2`,{className:`text-lg font-bold text-slate-900 leading-snug tracking-tight mb-3 pr-6 text-left`,children:n.title}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs font-semibold select-none`,children:[(0,Y.jsx)(`span`,{className:`px-2.5 py-1 rounded bg-[#fef1d8] text-[#e28a1e] text-[11px] font-bold`,children:w}),(0,Y.jsx)(`span`,{className:`text-slate-500 font-medium ml-1`,children:n.orgName}),n.authors&&(0,Y.jsx)(`span`,{className:`text-slate-400 font-normal`,children:n.authors})]})]}),(0,Y.jsxs)(`div`,{className:`p-10 flex flex-col items-center justify-center min-h-55`,children:[l===`idle`&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-12 w-full justify-center px-6`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>void x(),className:`flex flex-col items-center group cursor-pointer border-0 bg-transparent`,children:[(0,Y.jsx)(`div`,{className:`w-24 h-28 bg-rose-50 border border-rose-200 hover:border-rose-400 rounded-2xl flex items-center justify-center shadow-sm hover:shadow-md transition-all group-hover:scale-105 duration-200 relative mb-4`,children:(0,Y.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,Y.jsxs)(`div`,{className:`w-12 h-14 bg-rose-500 rounded-lg flex flex-col justify-between p-1.5 text-white relative shadow-inner`,children:[(0,Y.jsx)(`div`,{className:`text-[9px] font-black leading-none tracking-tighter`,children:`PDF`}),(0,Y.jsx)(`div`,{className:`w-full flex justify-center py-1`,children:(0,Y.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`w-6 h-6 text-white text-center`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),(0,Y.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})}),(0,Y.jsx)(`div`,{className:`h-1 w-full bg-rose-200 rounded`})]})})}),(0,Y.jsx)(`span`,{className:`text-sm font-bold text-slate-800 group-hover:text-rose-600 transition-colors`,children:`下载 PDF`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>void C(),className:`flex flex-col items-center group relative border-0 bg-transparent ${T?`cursor-pointer`:`cursor-not-allowed opacity-60`}`,children:[(0,Y.jsx)(`div`,{className:`absolute -top-11 z-20 animate-bounce`,children:(0,Y.jsxs)(`div`,{className:`text-white text-[10px] font-bold px-3 py-1.5 rounded-full shadow-lg whitespace-nowrap relative flex items-center justify-center ${T?`bg-linear-to-r from-amber-500 to-orange-500 shadow-orange-500/20`:`bg-slate-400 shadow-slate-400/20`}`,children:[T?`高级 / 高阶 / 团队VIP`:`本文暂不支持`,(0,Y.jsx)(`div`,{className:`absolute -bottom-1 left-1/2 -translate-x-1/2 w-0.5 h-0.5 border-t-4 border-x-4 border-x-transparent ${T?`border-t-amber-500`:`border-t-slate-400`}`})]})}),n.isHorizontal?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`w-24 h-28 rounded-2xl flex items-center justify-center shadow-sm relative mb-4 border ${T?`bg-orange-50 border-orange-200 hover:border-orange-400 hover:shadow-md transition-all group-hover:scale-105 duration-200`:`bg-slate-50 border-slate-200`}`,children:(0,Y.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,Y.jsxs)(`div`,{className:`w-12 h-14 rounded-lg flex flex-col justify-between p-1.5 text-white relative shadow-inner ${T?`bg-orange-500`:`bg-slate-400`}`,children:[(0,Y.jsx)(`div`,{className:`text-[9px] font-black leading-none tracking-tighter`,children:`PPT`}),(0,Y.jsx)(`div`,{className:`w-full flex items-center justify-center py-1`,children:(0,Y.jsx)(`span`,{className:`text-base font-extrabold tracking-tighter font-serif`,children:`P`})}),(0,Y.jsx)(`div`,{className:`h-1 w-full rounded ${T?`bg-orange-200`:`bg-slate-300`}`})]})})}),(0,Y.jsx)(`span`,{className:`text-sm font-bold transition-colors ${T?`text-slate-800 group-hover:text-orange-600`:`text-slate-500`}`,children:`下载 PPT`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`w-24 h-28 rounded-2xl flex items-center justify-center shadow-sm relative mb-4 border ${T?`bg-[#edf5ff] border-blue-200 hover:border-blue-400 hover:shadow-md group-hover:scale-105 duration-200`:`bg-slate-50 border-slate-200`}`,children:(0,Y.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,Y.jsxs)(`div`,{className:`w-12 h-14 rounded-lg flex flex-col justify-between p-1.5 text-white relative shadow-inner ${T?`bg-blue-600`:`bg-slate-400`}`,children:[(0,Y.jsx)(`div`,{className:`text-[9px] font-black leading-none tracking-tighter`,children:`WORD`}),(0,Y.jsx)(`div`,{className:`w-full flex items-center justify-center py-1`,children:(0,Y.jsx)(`span`,{className:`text-base font-extrabold tracking-tighter font-serif`,children:`W`})}),(0,Y.jsx)(`div`,{className:`h-1 w-full rounded ${T?`bg-blue-200`:`bg-slate-300`}`})]})})}),(0,Y.jsx)(`span`,{className:`text-sm font-bold transition-colors ${T?`text-slate-800 group-hover:text-blue-600`:`text-slate-500`}`,children:`下载 Word`})]})]})]}),l===`converting`&&(0,Y.jsxs)(`div`,{className:`flex flex-col items-center justify-center w-full max-w-sm px-6 py-4 text-center`,children:[(0,Y.jsx)(Jv,{className:`w-10 h-10 text-blue-600 animate-spin mb-4`}),(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-slate-700`,children:`您的报告正在加速转换中,大约30s完成`}),(0,Y.jsx)(`p`,{className:`text-xs text-slate-400 mt-2`,children:`完成后将自动开始下载,请勿关闭本窗口`})]}),l===`downloading`&&(0,Y.jsxs)(`div`,{className:`flex flex-col items-center justify-center w-full max-w-sm px-6 py-4`,children:[(0,Y.jsx)(Jv,{className:`w-10 h-10 text-blue-600 animate-spin mb-4`}),(0,Y.jsx)(`div`,{className:`w-full bg-slate-100 rounded-full h-2 mb-3 overflow-hidden`,children:(0,Y.jsx)(dn.div,{className:`bg-blue-600 h-full rounded-full`,style:{width:`${p}%`},transition:{ease:`easeOut`}})}),(0,Y.jsxs)(`p`,{className:`text-sm font-semibold text-slate-700 animate-pulse`,children:[`正在下载 `,PO(d),` (`,Math.min(100,p),`%)...`]}),(0,Y.jsx)(`p`,{className:`text-xs text-slate-400 mt-1`,children:`请勿关闭本窗口`})]}),l===`success`&&(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:`flex flex-col items-center justify-center text-center`,children:[(0,Y.jsx)(`div`,{className:`w-16 h-16 bg-emerald-50 rounded-full flex items-center justify-center text-emerald-500 mb-4 border border-emerald-100`,children:(0,Y.jsx)(`svg`,{className:`w-8 h-8 stroke-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,children:(0,Y.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})}),(0,Y.jsx)(`h3`,{className:`text-lg font-bold text-slate-900 mb-1`,children:`下载成功!`}),(0,Y.jsx)(`p`,{className:`text-xs text-slate-500`,children:`请在浏览器下载列表中查看文件`})]})]})]})]})})}function IO(e){return`${e.orgName?`【${e.orgName}】`:``}${e.title}【洞见研报DJyanbao.com】.pdf`}function LO(e){return e===`pdf`?`PDF`:e===`docx`?`Word`:e===`pptx`?`PPT`:`Excel`}var RO={pdf:{wrap:`bg-rose-50 text-rose-500`,icon:Mv},docx:{wrap:`bg-blue-50 text-blue-600`,icon:Mv},pptx:{wrap:`bg-orange-50 text-orange-500`,icon:Mv},xlsx:{wrap:`bg-emerald-50 text-emerald-600`,icon:Av}};function zO({format:e}){let{wrap:t,icon:n}=RO[e];return(0,Y.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl ${t}`,children:(0,Y.jsx)(n,{size:18,strokeWidth:1.75})})}function BO({isOpen:e,onClose:t,policy:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null);if(!e||!n)return null;let s=()=>{i(!1),o(null),t()},c=async()=>{i(!0);try{let e=await je(n.id,{action:`download`,format:`pdf`});if(!e.fileUrl){G.error(`未获取到下载地址`);return}await jO(e.fileUrl,IO(n))}catch(e){console.error(e)}finally{i(!1)}},l=async e=>{o(e.id);try{let t=await Le(e.id,n.id);if(!t.fileUrl){G.error(`未获取到下载地址`);return}let r=e.format===`docx`?`doc`:e.format;await jO(t.fileUrl,`${e.name}【洞见研报DJyanbao.com】.${r}`)}catch(e){console.error(e)}finally{o(null)}},u=n.attachments??[],d=`${n.pageTotal}页 · ${AO(n.fileSize)}`;return(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`absolute inset-0 bg-slate-900/60`,onClick:s}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.95,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:15},className:`relative flex w-full max-w-xl flex-col overflow-hidden rounded-3xl border border-slate-100 bg-white font-sans shadow-[0_20px_60px_rgba(15,23,42,0.18)]`,children:[(0,Y.jsxs)(`div`,{className:`relative border-b border-blue-100 bg-[#eff5ff] px-8 py-7`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:s,className:`absolute top-5 right-5 cursor-pointer rounded-full p-1.5 text-slate-500 transition-colors hover:bg-blue-100/50 hover:text-slate-700`,children:(0,Y.jsx)(tn,{size:18})}),(0,Y.jsx)(`h2`,{className:`mb-3 pr-6 text-left text-lg leading-snug font-bold tracking-tight text-slate-900`,title:n.title,children:n.title}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs select-none`,children:[(0,Y.jsx)(`span`,{className:`rounded bg-[#fef1d8] px-2.5 py-1 text-[11px] font-bold text-[#e28a1e]`,children:d}),(0,Y.jsx)(`span`,{className:`font-medium text-slate-500`,children:n.orgName}),(0,Y.jsx)(`span`,{className:`font-normal text-slate-400`,children:Zt(n.publishAt)})]})]}),(0,Y.jsxs)(`div`,{className:`max-h-96 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3.5 rounded-2xl border border-slate-100 bg-slate-50/80 px-4 py-3.5`,children:[(0,Y.jsx)(zO,{format:`pdf`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-slate-800`,children:`正文 PDF`}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-xs text-slate-400`,children:[n.pageTotal,` 页 · `,AO(n.fileSize)]})]}),(0,Y.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void c(),className:`inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-lg bg-[#1875e5] px-3.5 py-2 text-xs font-semibold text-white transition-colors hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-60`,children:r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Jv,{size:13,className:`animate-spin`}),`下载中`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Sv,{size:13}),`下载`]})})]}),u.length>0&&(0,Y.jsxs)(`div`,{className:`mt-4`,children:[(0,Y.jsxs)(`p`,{className:`mb-2 px-1 text-xs font-medium text-slate-400`,children:[`附件(`,u.length,`)`]}),(0,Y.jsx)(`ul`,{className:`divide-y divide-slate-100 rounded-2xl border border-slate-100`,children:u.map(e=>{let t=a===e.id;return(0,Y.jsxs)(`li`,{className:`flex items-center gap-3.5 px-4 py-3 transition-colors hover:bg-slate-50/80`,children:[(0,Y.jsx)(zO,{format:e.format}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`truncate text-sm font-medium text-slate-700`,title:e.name,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-xs text-slate-400`,children:[LO(e.format),e.fileSize>0?` · ${AO(e.fileSize)}`:``]})]}),(0,Y.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>void l(e),className:`inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border border-slate-200 bg-white px-3.5 py-2 text-xs font-semibold text-slate-600 transition-colors hover:border-blue-200 hover:bg-blue-50 hover:text-blue-600 disabled:cursor-not-allowed disabled:opacity-60`,children:t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Jv,{size:13,className:`animate-spin`}),`下载中`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Sv,{size:13}),`下载`]})})]},e.id)})})]})]})]})]})})}var VO=[{name:`在校学生`,eName:`School student`,icon:Bv,iconClass:`bg-amber-50 text-amber-600`},{name:`创业者`,eName:`Entrepreneur`,icon:ev,iconClass:`bg-blue-50 text-blue-600`},{name:`初入职场`,eName:`First entry into the workplace`,icon:by,iconClass:`bg-emerald-50 text-emerald-600`},{name:`中层管理`,eName:`Middle management`,icon:Ey,iconClass:`bg-violet-50 text-violet-600`},{name:`公司高层`,eName:`Company executives`,icon:J_,iconClass:`bg-sky-50 text-sky-600`}],HO=[{value:1,label:`博士`},{value:2,label:`硕士`},{value:3,label:`本科`},{value:4,label:`大专`},{value:5,label:`高中/中专`}],UO={profession:``,organization:``,job:``,education:3,email:``,mobile:``,verifyCode:``};function WO({isOpen:e,onClose:t,onComplete:n}){let{user:r}=ln(),i=r?.phone,a=!i,[o,s]=(0,J.useState)(0),[c,l]=(0,J.useState)(0),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1),[m]=v_.useForm(),h=v_.useWatch(`profession`,m),g=h===`在校学生`,_=g?`学校`:`公司名`,v=g?`专业`:`岗位`,y=g?`请填写您的学校名称`:`请填写您的公司名称`,b=g?`请填写您在学校的专业`:`请填写您在公司的岗位`,x=(0,J.useCallback)(()=>{s(0),l(0),d(!1),p(!1),m.setFieldsValue(UO)},[m]);(0,J.useEffect)(()=>{e&&i&&(m.getFieldValue(`mobile`)||m.setFieldValue(`mobile`,i))},[e,i,m]),(0,J.useEffect)(()=>{if(c<=0)return;let e=setInterval(()=>{l(e=>e<=1?0:e-1)},1e3);return()=>clearInterval(e)},[c]);let S=()=>{t()},C=()=>{x(),t()},w=e=>{m.setFieldValue(`profession`,e),m.setFields([{name:`organization`,value:``,errors:[]},{name:`job`,value:``,errors:[]}])},T=()=>{if(!m.getFieldValue(`profession`)){G.info(`请先选择您的职业`);return}s(1)},E=()=>{s(0)},D=async()=>{if(c>0||u)return;let e=Rb(m.getFieldValue(`mobile`)??``);if(e.ok===!1){G.info(e.message);return}d(!0);try{await we({mobile:e.value}),G.success(`验证码已发送`),l(60)}finally{d(!1)}},O=async()=>{let e;try{e=await m.validateFields()}catch{return}let r={profession:e.profession,organization:e.organization.trim(),job:e.job.trim(),education:e.education,email:e.email.trim()};a?(r.mobile=e.mobile.trim(),r.verifyCode=e.verifyCode.trim()):r.mobile=i,p(!0);try{await Te(r),G.success(`提交成功`),x(),n?.(),t()}catch{}finally{p(!1)}};return e?(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:S,className:`absolute inset-0 bg-black/50`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:12},transition:{duration:.2},onClick:e=>e.stopPropagation(),className:`relative w-180 bg-white rounded-2xl shadow-[0_24px_60px_rgba(15,23,42,0.18)] overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`relative px-8 py-6 bg-linear-to-r from-[#2563eb] to-[#1d4ed8] text-white overflow-hidden`,children:[(0,Y.jsx)(`div`,{className:`absolute -right-8 -top-10 w-40 h-40 rounded-full bg-white/10`}),(0,Y.jsx)(`div`,{className:`absolute right-24 -bottom-12 w-28 h-28 rounded-full bg-white/10`}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-bold tracking-wide`,children:`问卷调查`}),(0,Y.jsx)(`p`,{className:`mt-1.5 text-sm text-blue-100`,children:`填写问卷得 25 个洞见卡(免费下载 up to 5 篇研报)`})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:S,className:`absolute top-4 right-4 w-8 h-8 rounded-full bg-white/15 hover:bg-white/25 flex items-center justify-center text-white/90 transition-colors cursor-pointer`,children:(0,Y.jsx)(tn,{size:16,strokeWidth:2.5})})]}),(0,Y.jsxs)(`div`,{className:`px-8 pt-6 pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 mb-6`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsxs)(`span`,{className:`text-[15px] font-semibold text-slate-800`,children:[o===0?`您的职业是?`:`职业相关信息`,` (`,o+1,`/2)`]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`h-1.5 rounded-full transition-all ${o===0?`w-6 bg-blue-600`:`w-1.5 bg-slate-200`}`}),(0,Y.jsx)(`span`,{className:`h-1.5 rounded-full transition-all ${o===1?`w-6 bg-blue-600`:`w-1.5 bg-slate-200`}`})]})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:C,className:`text-xs text-slate-400 hover:text-slate-600 transition-colors cursor-pointer shrink-0`,children:`暂时不填,放弃最多免费下载 5 份研报的机会`})]}),(0,Y.jsxs)(v_,{form:m,layout:`vertical`,requiredMark:!1,initialValues:UO,children:[(0,Y.jsx)(v_.Item,{name:`profession`,hidden:!0,rules:[{required:!0,message:`请先选择您的职业`}],children:(0,Y.jsx)(H_,{})}),o===0&&(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-3 pb-2`,children:VO.map(e=>{let t=e.icon,n=h===e.name;return(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>w(e.name),className:`flex items-center gap-3.5 px-4 py-3.5 rounded-xl border text-left transition-all cursor-pointer ${n?`border-blue-600 bg-blue-50/80 shadow-sm shadow-blue-600/10`:`border-slate-100 bg-[#f5f8ff] hover:border-blue-200 hover:bg-blue-50/40`}`,children:[(0,Y.jsx)(`div`,{className:`w-11 h-11 rounded-lg flex items-center justify-center shrink-0 ${e.iconClass}`,children:(0,Y.jsx)(t,{size:22,strokeWidth:2})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-[15px] font-semibold text-slate-800`,children:e.name}),(0,Y.jsx)(`p`,{className:`text-[11px] text-slate-400 mt-0.5 truncate`,children:e.eName})]})]},e.name)})}),(0,Y.jsxs)(`div`,{className:o===1?`grid grid-cols-2 gap-x-6`:`hidden`,children:[(0,Y.jsx)(v_.Item,{name:`organization`,label:_,rules:[{required:!0,message:`请填写您的${_}`}],children:(0,Y.jsx)(H_,{placeholder:y,maxLength:50,size:`large`})}),(0,Y.jsx)(v_.Item,{name:`job`,label:v,rules:[{required:!0,message:`请填写您的${v}`}],children:(0,Y.jsx)(H_,{placeholder:b,maxLength:50,size:`large`})}),(0,Y.jsx)(v_.Item,{name:`education`,label:`学历`,rules:[{required:!0,message:`请选择您的最高学历`}],children:(0,Y.jsx)(om,{options:HO,placeholder:`请选择学历`,size:`large`})}),(0,Y.jsx)(v_.Item,{name:`email`,label:`邮箱`,rules:[{validator:async(e,t)=>{let n=Hb(t??``);if(n.ok===!1)throw Error(n.message)}}],children:(0,Y.jsx)(H_,{placeholder:`请填写您的邮箱地址`,maxLength:80,size:`large`})}),a&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(v_.Item,{name:`mobile`,label:`手机号`,rules:[{validator:async(e,t)=>{let n=Rb(t??``);if(n.ok===!1)throw Error(n.message)}}],children:(0,Y.jsx)(H_,{placeholder:`请填写您的手机号`,maxLength:11,size:`large`})}),(0,Y.jsx)(v_.Item,{name:`verifyCode`,label:`验证码`,rules:[{validator:async(e,t)=>{let n=zb(t??``);if(n.ok===!1)throw Error(n.message)}}],children:(0,Y.jsx)(H_,{placeholder:`手机验证码`,maxLength:4,size:`large`,suffix:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void D(),disabled:c>0||u,className:`text-sm font-medium whitespace-nowrap cursor-pointer ${c>0||u?`text-slate-400 cursor-not-allowed`:`text-blue-600 hover:text-blue-700`}`,children:c>0?`重新发送 ${c}s`:u?`发送中...`:`发送验证码`})})})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-3 px-8 py-5 border-t border-slate-100`,children:[o===1&&(0,Y.jsx)(mm,{size:`large`,onClick:E,className:`min-w-28`,children:`上一步`}),o===0?(0,Y.jsx)(mm,{type:`primary`,size:`large`,onClick:T,className:`min-w-28`,children:`下一步`}):(0,Y.jsx)(mm,{type:`primary`,size:`large`,loading:f,onClick:()=>void O(),className:`min-w-28`,children:`提交`})]})]})]})}):null}function GO(e){if(!e?.uri)return;let t=e.uri.trim();t.startsWith(`http`)?window.open(t,`_blank`,`noopener,noreferrer`):ok.navigate(t)}function KO(e){return{position:`index_popup`,vip0ValidDate:e.userLevel===`NONE`?void 0:e[rn[e.userLevel]],createdAt:e.createdAt||void 0}}function qO(){let[e,t]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let e=async e=>{try{let n=await Ie(KO(e));if(!n)return;t(n)}catch(e){console.error(e)}},n=({user:t})=>void e(t);return _e.on(`auth:login`,n),()=>_e.off(`auth:login`,n)},[]),e?(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},className:`absolute inset-0 bg-slate-900/70`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.92},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.92},transition:{duration:.25},className:`relative rounded-2xl`,children:[(0,Y.jsx)(`img`,{src:e.image,alt:`广告`,onClick:()=>{GO(e),t(null)},className:`max-w-200 max-h-[80vh] w-auto h-auto rounded-2xl object-contain select-none ${e.uri?`cursor-pointer`:``}`}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`关闭广告`,onClick:()=>t(null),className:`absolute -top-3.5 -right-3.5 flex h-9 w-9 items-center justify-center rounded-full bg-slate-900/70 text-white backdrop-blur-sm transition-colors hover:bg-slate-900/90 cursor-pointer`,children:(0,Y.jsx)(tn,{size:18,strokeWidth:2.5})})]})]})}):null}var JO=`/assets/add-shortcut-banner-DzRBrAOp.png`;function YO({isOpen:e,onClose:t}){let{install:n}=$y();return e?(0,Y.jsx)(fn,{children:(0,Y.jsxs)(`div`,{className:`fixed inset-0 ${xe.global} flex items-center justify-center p-4 select-none`,children:[(0,Y.jsx)(dn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-black/50 backdrop-blur-[3px]`}),(0,Y.jsxs)(dn.div,{initial:{opacity:0,scale:.96,y:15},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:15},onClick:e=>e.stopPropagation(),className:`relative w-full max-w-105 bg-white rounded-3xl shadow-[0_25px_60px_rgba(0,0,0,0.16)] overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`img`,{src:JO,alt:`添加到桌面`,className:`w-full h-36 object-cover`}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`关闭`,className:`absolute top-4 right-4 text-white/90 hover:text-white transition-colors p-1.5 hover:bg-white/20 rounded-full cursor-pointer`,children:(0,Y.jsx)(tn,{size:20})})]}),(0,Y.jsxs)(`div`,{className:`px-10 pt-8 pb-10 flex flex-col items-center`,children:[(0,Y.jsx)(`div`,{className:`w-13 h-13 bg-blue-50 text-blue-600 rounded-2xl flex items-center justify-center mb-4`,children:(0,Y.jsx)(iy,{size:26})}),(0,Y.jsx)(`h2`,{className:`text-[22px] font-bold text-[#113171] tracking-tight text-center`,children:`添加【洞见研报】快捷方式到桌面`}),(0,Y.jsx)(`p`,{className:`text-sm text-slate-400 mt-2.5`,children:`下次访问更便捷`}),(0,Y.jsx)(`button`,{type:`button`,onClick:async()=>{await n(),t()},className:`mt-8 w-full bg-[#1875e5] hover:bg-[#1669ce] text-white font-bold py-3.5 rounded-full shadow-lg shadow-blue-500/20 transition-all active:scale-[0.98] text-[15px] cursor-pointer`,children:`立即添加`})]})]})]})}):null}function XO(){let e=on(e=>e.modal),t=on(e=>e.serviceWechatSubtitle),n=on(e=>e.userBuyType),r=on(e=>e.reportId),i=on(e=>e.report),a=on(e=>e.policy),o=on(e=>e.onDownloadSuccess),s=on(e=>e.convertFailType),c=on(e=>e.onQuestionnaireComplete),l=on(e=>e.onLoginSuccess),u=on(e=>e.defaultCommodityType),d=on(e=>e.inviteRewardTab),f=on(e=>e.open),p=on(e=>e.close);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Wb,{isOpen:e===`login`,onClose:p,onForgotPassword:()=>{p(),f(`resetPassword`)},onLoginSuccess:l},e===`login`?`login-open`:`login-closed`),(0,Y.jsx)(Gb,{isOpen:e===`resetPassword`,onClose:p},e===`resetPassword`?`resetPassword-open`:`resetPassword-closed`),(0,Y.jsx)(qb,{isOpen:e===`serviceWechat`,onClose:p,subtitle:t},e===`serviceWechat`?`serviceWechat-open`:`serviceWechat-closed`),(0,Y.jsx)(ix,{isOpen:e===`userBuy`,onClose:p,type:n,reportId:r},e===`userBuy`?`userBuy-open`:`userBuy-closed`),(0,Y.jsx)(sx,{isOpen:e===`convertFail`,onClose:p,type:s},e===`convertFail`?`convertFail-open`:`convertFail-closed`),(0,Y.jsx)(pS,{isOpen:e===`payVip`,onClose:p,defaultCommodityType:u},e===`payVip`?`payVip-open`:`payVip-closed`),(0,Y.jsx)(hS,{isOpen:e===`payTeamVip`,onClose:p},e===`payTeamVip`?`payTeamVip-open`:`payTeamVip-closed`),(0,Y.jsx)(yS,{isOpen:e===`inviteReward`,onClose:p,defaultTab:d},e===`inviteReward`?`inviteReward-open`:`inviteReward-closed`),(0,Y.jsx)(FO,{isOpen:e===`reportDownload`,onClose:p,report:i,onDownloadSuccess:o},e===`reportDownload`?`reportDownload-open`:`reportDownload-closed`),(0,Y.jsx)(BO,{isOpen:e===`policyDownload`,onClose:p,policy:a},e===`policyDownload`?`policyDownload-open`:`policyDownload-closed`),(0,Y.jsx)(WO,{isOpen:e===`questionnaire`,onClose:p,onComplete:c},e===`questionnaire`?`questionnaire-open`:`questionnaire-closed`),(0,Y.jsx)(YO,{isOpen:e===`desktopInstall`,onClose:p},e===`desktopInstall`?`desktopInstall-open`:`desktopInstall-closed`),(0,Y.jsx)(qO,{})]})}function ZO(){return(0,Y.jsxs)(J.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-zinc-50`,children:(0,Y.jsx)(Qt,{description:`加载中...`})}),children:[(0,Y.jsx)(Pc,{}),(0,Y.jsx)(zs,{}),(0,Y.jsx)(XO,{})]})}function $(e){return{lazy:async()=>{let{default:t}=await e();return{Component:t}}}}var QO={redirectTo:null,prompt:null};function $O(e,t){return e.replace(/:([A-Za-z]+)/g,(e,n)=>t[n]??``)}function ek(e,t,n){return(e.login||e.levels?.length)&&!t?`needLogin`:e.levels?.length?e.levels.some(e=>$b(n,e))?null:`needVip`:null}function tk(e){let{auth:t,isAuthenticated:n,user:r,params:i}=e;if(!t||n&&!r)return QO;let a=ek(t,n,r);return a?a===`needLogin`&&t.guestPath?{redirectTo:$O(t.guestPath,i),prompt:null}:{redirectTo:null,prompt:a}:QO}function nk(e){let t=ek(e.auth,e.isAuthenticated,e.user);return!t||(rk(t,e.auth.levels),!1)}function rk(e,t=[]){if(e===`needLogin`){G.info(`请先登录`),cn(`login`);return}let n=t.length===an.length&&an.every(e=>t.includes(e));G.info(n?`开通会员后可访问`:`开通${t.map(e=>nn[e]).join(`或`)}后可访问`),cn(`payVip`)}function ik(){let e=xs(),{isAuthenticated:t,user:n}=ln(),r=is(),i=e.findLast(e=>e.handle?.auth)?.handle?.auth,{redirectTo:a,prompt:o}=tk({auth:i,isAuthenticated:t,user:n,params:r});return(0,J.useEffect)(()=>{o&&rk(o,i?.levels)},[o,i]),t&&!n?(0,Y.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-zinc-50`,children:(0,Y.jsx)(Qt,{description:`加载中...`})}):a?(0,Y.jsx)(Rs,{to:a,replace:!0}):o?null:(0,Y.jsx)(zs,{})}function ak(){return(0,Y.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-zinc-50`,children:(0,Y.jsx)(Qt,{description:`加载中...`})})}var ok=Oc([{Component:ZO,HydrateFallback:ak,errorElement:(0,Y.jsx)(zy,{}),children:[{path:`/`,Component:Cb,children:[{index:!0,element:(0,Y.jsx)(Rs,{to:`/home`,replace:!0})},{path:`home`,...$(()=>K(()=>import(`./home-Bsv14hb9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])))},{path:`home/consulting`,...$(()=>K(()=>import(`./consultCustomResearch-BIjS5hgv.js`),__vite__mapDeps([27,1,8,3,16,19,24,25,26])))},{path:`home/knowledge-platform`,...$(()=>K(()=>import(`./knowledgePlatform-CGg_UzaS.js`),__vite__mapDeps([28,1,8,3,4,21,2,6,7,24,25,26])))},{path:`agent-interface`,...$(()=>K(()=>import(`./agentInterface-ByfjrT82.js`),__vite__mapDeps([29,1,2,3,4,8,30,31,32,17,21,6,7,22])))},{path:`auth/account`,...$(()=>K(()=>import(`./skillAuthorization-CZtxaKlV.js`),__vite__mapDeps([33,1,2,3,4,34,32,17,21,6,7,35]))),handle:{hideHeader:!0,hideFooter:!0,hideSidebar:!0}},{path:`about`,...$(()=>K(()=>import(`./about-CiiXB8Tn.js`),__vite__mapDeps([36,1,3,8,12,14,16,18,24,25,26])))},{path:`about/platform`,...$(()=>K(()=>import(`./researchPlatformDetail-cPjTj-Cf.js`),__vite__mapDeps([37,1,10,3,13,14,38,19,24,25,26,39,8,40])))},{path:`about/data`,...$(()=>K(()=>import(`./dataProductsDetail-CwX_IuyW.js`),__vite__mapDeps([41,1,38,3,24,25,26,39,8,40])))},{path:`about/research`,...$(()=>K(()=>import(`./customResearchDetail-BR-KR85P.js`),__vite__mapDeps([42,1,8,3,10,16,18,19,24,25,26,39])))},{path:`about/collab`,...$(()=>K(()=>import(`./industryCollabDetail-bRCyhBW2.js`),__vite__mapDeps([43,1,44,3,24,25,26,39,8,40])))},{path:`login/scan`,...$(()=>K(()=>import(`./scan-Ddd75hxP.js`),__vite__mapDeps([45,1,2,3,4,21,6,7,35,25]))),handle:{hideHeader:!0,hideFooter:!0,hideSidebar:!0}},{path:`category-report`,...$(()=>K(()=>import(`./categoryReport-Ce7QVDrX.js`),__vite__mapDeps([46,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,24,25,26,58,59,60,61])))},{path:`search`,...$(()=>K(()=>import(`./standard-D_IVPt7a.js`),__vite__mapDeps([62,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,8,9,63,64,65,66,67,68,69,21,24,25,26,59,60,61,70,71,72,73,74,75,76,77,78,79])))},{path:`search/ai`,...$(()=>K(()=>import(`./ai-DHGd1fVu.js`),__vite__mapDeps([80,1,2,3,4,5,63,81,44,17,67,82,6,7,21,24,25,26,70,79])))},{path:`search/ai/:sessionId`,Component:ik,handle:{auth:{login:!0},hideFooter:!0},children:[{index:!0,...$(()=>K(()=>import(`./AiSessionPage-COvAbOSR.js`),__vite__mapDeps([83,1,7,2,3,4,52,84,51,50,53,85,76,77,6,86,48,54,87,88,56,89,31,90,91,68,92,21,93,81,94,67,82,5,22,23,25,70,95])))}]},{path:`report-preview/:id`,...$(()=>K(()=>import(`./reportPreview-BNqeBYO5.js`),__vite__mapDeps([96,1,2,3,4,5,6,7,8,97,21,25,26,58,59,60,61,98,95])))},{path:`report/:id`,Component:ik,handle:{auth:{login:!0,guestPath:`/report-preview/:id`},hideHeader:!0,hideFooter:!0,hideSidebar:!0},children:[{index:!0,...$(()=>K(()=>import(`./reportDetail-DYfSGE0b.js`),__vite__mapDeps([99,1,2,3,4,5,6,7,100,50,52,53,54,55,74,75,76,101,15,94,67,22,90,91,68,92,21,93,23,102])))}]},{path:`industry-research`,...$(()=>K(()=>import(`./industryResearch-CY9FPBhr.js`),__vite__mapDeps([103,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,8,63,104,67,69,24,25,26,61,71,78,21])))},{path:`industry-research/map-list`,...$(()=>K(()=>import(`./mapList-DPMsWCrt.js`),__vite__mapDeps([105,1,2,3,4,5,6,7,89,8,69,24,25,26,78,21])))},{path:`industry-research/map-list/:id`,Component:ik,handle:{auth:{levels:[`SVIP`,`SHARED_VIP`]}},children:[{index:!0,...$(()=>K(()=>import(`./mapDetail-Dm2qy1Dr.js`),__vite__mapDeps([106,1,2,3,4,5,6,7,86,50,48,52,54,87,88,56,65,81,14,16,91,94,67,25,26,70])))}]},{path:`industry-research/topics`,...$(()=>K(()=>import(`./topics-t4Tkc3_G.js`),__vite__mapDeps([107,1,2,3,4,6,7,89,8,81,24,25,26,70])))},{path:`industry-research/collection/:id`,...$(()=>K(()=>import(`./topicCollection-ktzmUDwR.js`),__vite__mapDeps([108,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,65,81,67,19,21,22,23,25,26])))},{path:`industry-research/paid-reports`,...$(()=>K(()=>import(`./paidReports-CVx99Bsn.js`),__vite__mapDeps([109,1,2,3,4,6,7,47,48,49,50,51,52,53,54,55,56,57,9,64,81,104,24,25,26,61,70,72,5,73,74,75,76,77,110])))},{path:`industry-research/paid-report/:id`,...$(()=>K(()=>import(`./paidReportDetail-DdTeAvmN.js`),__vite__mapDeps([111,1,2,3,4,6,7,112,52,113,50,51,53,49,54,55,114,87,115,88,75,74,76,85,90,91,68,92,21,93,60,67,35,25,26,61,70,98,110,5])))},{path:`company-research`,...$(()=>K(()=>import(`./companyResearch-CufICH27.js`),__vite__mapDeps([116,1,2,3,4,84,7,51,50,52,53,85,76,77,5,6,47,48,49,54,55,56,57,24,25,26,61,70,71])))},{path:`company-research/survey/:id`,...$(()=>K(()=>import(`./detail-Bu5wHcqL.js`),__vite__mapDeps([117,1,7,2,3,4,5,6,25,26,118,98]))),handle:{hideHeader:!0}},{path:`company-research/policy/:id`,...$(()=>K(()=>import(`./detail-Bb_gDL8B.js`),__vite__mapDeps([119,1,2,3,4,5,6,7,90,91,68,92,21,93,25,26]))),handle:{hideHeader:!0,hideFooter:!0,hideSidebar:!0}},{path:`/data`,...$(()=>K(()=>import(`./dataCenter-lZaJis53.js`),__vite__mapDeps([120,1,121,3,122,24,25,26]))),children:[{index:!0,element:(0,Y.jsx)(Rs,{to:`chart`,replace:!0})},{path:`chart`,...$(()=>K(()=>import(`./chart-C8jaY0Rv.js`),__vite__mapDeps([123,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,9,66,67,121,69,20,24,25,26,61,72,73,74,75,76,77,78,21])))},{path:`macro`,...$(()=>K(()=>import(`./macro-B8YxhlaD.js`),__vite__mapDeps([124,1,7,2,3,4,50,51,52,53,48,84,85,76,77,57,54,5,6,121,125,122,69,20,24,25,26,70,118,72,73,49,55,74,75,78,21])))},{path:`partner`,...$(()=>K(()=>import(`./partner-BQpcMNdI.js`),__vite__mapDeps([126,1,4,24,25,26,70])))}]},{path:`data/detail/:id`,Component:ik,handle:{auth:{levels:[`SVIP`,`SHARED_VIP`]},hideHeader:!0,hideFooter:!0,hideSidebar:!0},children:[{index:!0,...$(()=>K(()=>import(`./dataDetail-D15sXXBl.js`),__vite__mapDeps([127,1,2,3,4,6,7,100,50,52,53,54,55,74,75,76,101,15,94,67,22,90,91,68,92,21,93,102,5])))}]},{path:`insight-center`,...$(()=>K(()=>import(`./insightCenter-twmpJaYt.js`),__vite__mapDeps([128,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,89,8,81,97,19,22,24,25,26])))},{path:`insight-center/article/:id`,...$(()=>K(()=>import(`./articleDetail-Cb3Jiv9a.js`),__vite__mapDeps([129,1,2,3,4,5,6,7,8,9,25,26])))},{path:`services`,...$(()=>K(()=>import(`./services-B2hJvn_-.js`),__vite__mapDeps([130,1,4,21,2,3,6,7,22,23,24,25,26])))},{path:`contact`,...$(()=>K(()=>import(`./contact-Bi8Tn34F.js`),__vite__mapDeps([131,1,2,3,4,67,24,25,26])))},{path:`profile`,Component:ik,handle:{auth:{login:!0}},children:[{...$(()=>K(()=>import(`./profile-CxH_dSDs.js`),__vite__mapDeps([132,1,3,32,133,134,25]))),children:[{index:!0,element:(0,Y.jsx)(Rs,{to:`vip`,replace:!0})},{path:`vip`,...$(()=>K(()=>import(`./vip-h6tjDGxu.js`),__vite__mapDeps([135,1,2,3,4,21,6,7,22])))},{path:`card`,...$(()=>K(()=>import(`./card-03RS6BiY.js`),__vite__mapDeps([136,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,19,22])))},{path:`orders`,...$(()=>K(()=>import(`./orders-yODE3uI7.js`),__vite__mapDeps([137,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,22])))},{path:`downloads`,...$(()=>K(()=>import(`./downloads-wREb_G5A.js`),__vite__mapDeps([138,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,22,61,71])))},{path:`uploads`,...$(()=>K(()=>import(`./uploads-B8o8SExx.js`),__vite__mapDeps([139,1,7,2,3,4,50,52,53,84,51,85,76,77,49,54,55,114,87,74,75,5,6,47,48,56,57,101,22,61])))},{path:`uploadInfo`,...$(()=>K(()=>import(`./uploadInfo-wpW-DDVS.js`),__vite__mapDeps([140,1,7,2,3,4,48,84,51,50,52,53,85,76,77,55,74,54,75,5,73,49,22,61,70])))},{path:`history`,...$(()=>K(()=>import(`./history-WRKbNdGq.js`),__vite__mapDeps([141,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,22,61,71])))},{path:`subscription`,...$(()=>K(()=>import(`./subscription-C2QU-sdW.js`),__vite__mapDeps([142,1,2,3,4,6,7,11,60,97,143,133,67,22,23])))},{path:`developer`,...$(()=>K(()=>import(`./developer-BhKRawE3.js`),__vite__mapDeps([144,1,2,3,4,5,6,7,8,30,32,94,67,22,70])))},{path:`messages`,...$(()=>K(()=>import(`./messages-BcYdGgxt.js`),__vite__mapDeps([145,1,2,3,4,5,6,7,47,48,49,50,51,52,53,54,55,56,57,112,113,114,87,115,88,75,74,76,85,22])))}]}]},{path:`benefits`,...$(()=>K(()=>import(`./benefits-3yLySvdV.js`),__vite__mapDeps([146,1,2,3,4,6,7,9,143,92,17,134,67,22,23,24,25,26])))},{path:`ambassador`,...$(()=>K(()=>import(`./ambassador-fzp9cMbG.js`),__vite__mapDeps([147,1,3,34,92,19,4,24,25,26])))},{path:`favorites`,Component:ik,handle:{auth:{login:!0}},children:[{index:!0,...$(()=>K(()=>import(`./favorites-DX1JtF9q.js`),__vite__mapDeps([148,1,2,3,4,84,7,51,50,52,53,85,76,77,5,6,100,54,55,74,75,101,15,94,67,22,47,48,49,56,57,8,64,13,25])))}]},{path:`protocol`,...$(()=>K(()=>import(`./protocol-BXYuVI1K.js`),__vite__mapDeps([149,1]))),handle:{hideHeader:!0,hideFooter:!0,hideSidebar:!0},children:[{path:`privacy`,...$(()=>K(()=>import(`./Privacy-cLejP_cP.js`),__vite__mapDeps([150,1,149])))},{path:`service`,...$(()=>K(()=>import(`./Service-CgTeg-5o.js`),__vite__mapDeps([151,1,149])))},{path:`tort`,...$(()=>K(()=>import(`./Tort-wVjp-ySU.js`),__vite__mapDeps([152,1,149])))}]}]},{path:`*`,...$(()=>K(()=>import(`./notFound-D4MV7NIp.js`),__vite__mapDeps([153,1,89,3,125])))}]}]);(0,bn.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(J.StrictMode,{children:(0,Y.jsx)(or,{children:(0,Y.jsx)(Ly,{children:(0,Y.jsxs)(un,{children:[(0,Y.jsx)(Zc,{router:ok}),(0,Y.jsx)(De,{})]})})})}));export{Jv as $,Vu as $t,yb as A,Rm as At,By as B,jp as Bt,Kb as C,qm as Ct,Bb as D,Dm as Dt,Hb as E,Wm as Et,nb as F,mm as Ft,my as G,sf as Gt,wy as H,xp as Ht,Jy as I,pm as It,cy as J,fd as Jt,fy as K,md as Kt,Uy as L,om as Lt,Sb as M,Um as Mt,gb as N,wm as Nt,Rb as O,Fm as Ot,pb as P,Cm as Pt,Xv as Q,Bu as Qt,Hy as R,nm as Rt,Jb as S,v_ as St,Pb as T,Km as Tt,by as U,bp as Ut,Ey as V,kp as Vt,vy as W,tp as Wt,ey as X,Hu as Xt,ny as Y,Yu as Yt,Qv as Z,Uu as Zt,tS as _,Q_ as _t,MO as a,Mc as an,Ev as at,cx as b,H_ as bt,YE as c,Zo as cn,bv as ct,fS as d,zc as dn,fv as dt,zu as en,Wv as et,lS as f,uv as ft,nS as g,ev as gt,rS as h,nv as ht,AO as i,jc as in,Av as it,bb as j,km as jt,xb as k,Em as kt,IS as l,es as ln,vv as lt,oS as m,ov as mt,GO as n,Ll as nn,Pv as nt,kO as o,Rs as on,wv as ot,cS as p,cv as pt,uy as q,pd as qt,jO as r,Il as rn,Mv as rt,RE as s,zs as sn,Sv as st,nk as t,ju as tn,Hv as tt,ZE as u,is as un,mv as ut,Qx as v,X_ as vt,Tb as w,Gm as wt,tx as x,M_ as xt,Yx as y,J_ as yt,Vy as z,Yp as zt};