@revolist/ui 4.0.9 → 4.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +37 -1
  2. package/_chunks/{calendar-C4zH4Ppn.js → calendar-CQHVwHLW.js} +1 -1
  3. package/_chunks/{chart-frame-DzvJooS2.js → chart-frame-pj5EQxXr.js} +1 -1
  4. package/_chunks/{choice-chips-D2cJju-g.js → choice-chips-BIGT7gjO.js} +1 -1
  5. package/_chunks/{color-palette-D7AS20M1.js → color-palette-DL0f3igd.js} +1 -1
  6. package/_chunks/{color-picker-BanAQVfz.js → color-picker-BWBM9GE1.js} +3 -3
  7. package/_chunks/{component-B8SvtSaB.js → component-B22CtP21.js} +49 -34
  8. package/_chunks/{component-metadata-DlVkpW3h.js → component-metadata-B_hLjtM0.js} +4 -1
  9. package/_chunks/{configurator-actions-CvZf5nYp.js → configurator-actions-BhIk4oM_.js} +11 -11
  10. package/_chunks/{control-Dj7IR-i0.js → control-zCLB1tGz.js} +1 -1
  11. package/_chunks/{controls-BF6WlGT4.js → controls-Ip2E6jIu.js} +5 -4
  12. package/_chunks/{date-control-BNj2FBF2.js → date-control-UmJvxQ5C.js} +1 -1
  13. package/_chunks/{date-time-Ucx1ep76.js → date-time-B9YGqree.js} +52 -52
  14. package/_chunks/{dialog.parts-BqkmnhIL.js → dialog.parts-CpMwNhTM.js} +2 -2
  15. package/_chunks/{duration-BIESsyLI.js → duration-BrsE4QgL.js} +11 -11
  16. package/_chunks/{editor-popup-BTmjGg2_.js → editor-popup-Ds0GPAcn.js} +1 -1
  17. package/_chunks/{field-configurator-BWZnm3gE.js → field-configurator-BMQnmWNd.js} +3 -2
  18. package/_chunks/{framework-mount-DQ4opSL0.js → framework-mount-CX0oj05W.js} +1 -1
  19. package/_chunks/{mount-DTCXtKfT.js → mount-BgI_QV2H.js} +3 -3
  20. package/_chunks/native-C9tJWAXF.js +52 -0
  21. package/_chunks/{native-control-xc_B4vfn.js → native-control-DjJ8Na3T.js} +43 -38
  22. package/_chunks/{number-input-C_TPzAJq.js → number-input-Bb5guKP4.js} +2 -2
  23. package/_chunks/{picker-0h5TwXGT.js → picker-DDUmhT93.js} +2 -2
  24. package/_chunks/{popup-CISbXDnE.js → popup-HEUnOeq-.js} +1 -1
  25. package/_chunks/{rating-choice-FhWNdsiC.js → rating-choice-CtrABPp-.js} +1 -1
  26. package/_chunks/{reorder-list-CR1DO4EG.js → reorder-list-DvwZcFPH.js} +1 -1
  27. package/_chunks/{request-trail-ay92DQpo.js → request-trail-D5PKrBlC.js} +2 -2
  28. package/_chunks/{rich-text-ByjXFv1S.js → rich-text-DW1vcBAY.js} +27 -27
  29. package/_chunks/{selection-list-tooltips-DqqLeO_m.js → selection-list-tooltips-j84Wufjj.js} +7 -3
  30. package/_chunks/tooltip-BkuH0JdW.js +93 -0
  31. package/_chunks/tooltip-session-BBKkwhLZ.js +244 -0
  32. package/_chunks/top-layer-popup-DU1r_2v5.js +107 -0
  33. package/ai/index.js +2 -2
  34. package/angular/angular.d.ts +2 -0
  35. package/angular/angular.js +1 -0
  36. package/assignee/index.js +26 -26
  37. package/browser/favicon.svg +9 -0
  38. package/browser/pdf-viewer.css +2 -0
  39. package/browser/pdf.worker.min.mjs +28 -0
  40. package/browser/pdfjs-LICENSE +177 -0
  41. package/browser/revo-ui.global.js +671 -0
  42. package/browser/revo-ui.js +35538 -0
  43. package/browser/robots.txt +4 -0
  44. package/browser.d.ts +3 -0
  45. package/browser.js +34 -0
  46. package/buttons/svg-button.js +3 -3
  47. package/calendar/_calendar.scss +12 -4
  48. package/calendar/calendar.js +1 -1
  49. package/calendar/index.js +2 -2
  50. package/choice-chips/index.js +1 -1
  51. package/color-palette/color-palette.js +1 -1
  52. package/color-palette/color-picker.js +2 -2
  53. package/configurator-actions.js +1 -1
  54. package/configurator-aggregation-list.js +2 -2
  55. package/configurator-drop-zone.js +1 -1
  56. package/controls.js +2 -2
  57. package/core/editor-popup.js +1 -1
  58. package/core/popover-controller.d.ts +31 -6
  59. package/core/popover-controller.js +171 -46
  60. package/core/popup-ownership.d.ts +1 -1
  61. package/core/tooltip-options.d.ts +143 -0
  62. package/core/tooltip-options.js +20 -0
  63. package/core/tooltip-session.d.ts +32 -8
  64. package/core/tooltip-surface.d.ts +14 -3
  65. package/core/tooltip.d.ts +20 -19
  66. package/core/top-layer-popup.d.ts +2 -1
  67. package/core/top-layer-popup.js +1 -1
  68. package/date-time/index.js +1 -1
  69. package/dialog/dialog.dom.js +2 -2
  70. package/dialog/dialog.parts.js +1 -1
  71. package/distribution-chart/area-chart.js +1 -1
  72. package/distribution-chart/bar-chart.js +1 -1
  73. package/distribution-chart/line-chart.js +1 -1
  74. package/dropdown/content.d.ts +3 -1
  75. package/dropdown/content.js +1 -1
  76. package/dropdown/control.js +1 -1
  77. package/dropdown/dropdown.service.js +56 -56
  78. package/dropdown/index.js +2 -2
  79. package/dropdown/lookup-field.js +5 -5
  80. package/dropdown/popup.js +1 -1
  81. package/duration/index.js +1 -1
  82. package/editor-actions.js +1 -1
  83. package/editor-layout/index.js +1 -1
  84. package/field-configurator.js +1 -1
  85. package/filter/filters/slider/runtime.js +1 -1
  86. package/filter/filters/slider/single.js +1 -1
  87. package/filter-badge.js +1 -1
  88. package/filter-controls.js +1 -1
  89. package/form-controls/index.js +2 -2
  90. package/formatting/index.js +2 -2
  91. package/framework.js +133 -133
  92. package/masked-input/index.js +1 -1
  93. package/native-control.js +1 -1
  94. package/native.js +29 -79
  95. package/number-input/index.js +1 -1
  96. package/package.json +19 -3
  97. package/pagination.js +1 -1
  98. package/pdf-viewer/index.js +1 -1
  99. package/pickers.d.ts +11 -4
  100. package/preact.d.ts +2 -0
  101. package/preact.js +64 -63
  102. package/rating-choice.js +1 -1
  103. package/react-adapter.d.ts +1 -1
  104. package/react.d.ts +2 -0
  105. package/react.js +63 -62
  106. package/reorder-list.js +1 -1
  107. package/resource-picker/resource-picker-popup.js +1 -1
  108. package/resource-picker/resource-picker.js +1 -1
  109. package/rich-text/index.js +1 -1
  110. package/select.js +1 -1
  111. package/selection-list.js +1 -1
  112. package/status-feedback/exit-snapshot.js +1 -1
  113. package/status-feedback/popover.js +1 -1
  114. package/styles.css +1 -1
  115. package/surfaces.d.ts +1 -0
  116. package/surfaces.js +24 -23
  117. package/svelte.d.ts +2 -0
  118. package/svelte.js +30 -29
  119. package/switch/index.js +1 -1
  120. package/time-grid.js +1 -1
  121. package/timeline-track/_style.scss +33 -2
  122. package/timeline-track/component.d.ts +10 -1
  123. package/timeline-track/index.js +136 -74
  124. package/ui.css +1 -1
  125. package/vue.d.ts +11 -13
  126. package/vue.js +91 -87
  127. package/_chunks/tooltip-B5ziciEP.js +0 -54
  128. package/_chunks/tooltip-session-D74h-uqu.js +0 -110
  129. package/_chunks/top-layer-popup-BHajfliG.js +0 -59
@@ -0,0 +1,671 @@
1
+ var RevoUI=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e));function f(e,t,n,r=4,i=8){let a=e.bottom+r,o=e.top-t.height-r,s=a+t.height<=n.height-i||o<i?`below`:`above`,c=e.left,l=e.right-t.width,u=c+t.width<=n.width-i||l<i?`left`:`right`;return{left:Math.min(Math.max(u===`left`?c:l,i),Math.max(i,n.width-t.width-i)),top:Math.min(Math.max(s===`below`?a:o,i),Math.max(i,n.height-t.height-i)),placementX:u,placementY:s}}var p=e=>new TextEncoder().encode(JSON.stringify(e)).byteLength,m=e=>{if(!e)return``;if(p(e)<=16384)return e;let t=0,n=Math.min(e.length,16384);for(;t<n;){let r=Math.ceil((t+n)/2);p(e.slice(0,r)+`…`)<=16384?t=r:n=r-1}return/[\uD800-\uDBFF]/.test(e.charAt(t-1))&&t--,e.slice(0,t)+`…`},h=class{messages=[];epoch=0;initialized=!1;requestId;ignoredRequest;currentId;active=!1;lastPhase;key=``;sequence=0;update(e){if(this.initialized||=(this.epoch=e.chatKey??0,!0),(e.chatKey??0)!==this.epoch){this.epoch=e.chatKey??0,this.messages=[],this.requestId=void 0,this.ignoredRequest=e.request?.id,this.currentId=void 0,this.active=!1,this.key=``,this.lastPhase=void 0;return}if(e.phase===`idle`||e.request?.id===this.ignoredRequest&&this.ignoredRequest!==void 0)return;let t=e.request,n=!!t&&t.id!==this.requestId,r=e.phase===`completed`&&e.result&&p(e.result)<=16384?structuredClone(e.result):void 0,i={text:m(e.message),phase:e.phase,details:e.phase===`completed`&&!r&&e.resultDetails?m(e.resultDetails):void 0,pending:!!e.pendingAction,result:r},a=JSON.stringify([t?.id,i]);if(!n&&a===this.key||!n&&!i.text&&!i.pending)return;let o=this.messages.find(e=>e.id===this.currentId),s=this.lastPhase===`completed`&&e.phase===`understanding`&&o?.from===`assistant`,c=o?.from===`system`&&o.phase===`completed`&&(e.phase===`applying`||e.phase===`completed`);if(n){this.requestId=t.id,this.ignoredRequest=void 0;let e=`turn:`+ ++this.sequence;this.currentId=e+`:assistant`,this.messages=[...this.messages,{id:e+`:user`,group:e,from:`user`,text:m(t.prompt)},{id:this.currentId,group:e,from:`assistant`,...i}]}else if((this.active||s||c)&&o)this.messages=this.messages.map(e=>e.id===this.currentId?{...e,...i}:e);else{let e=`system:`+ ++this.sequence;this.currentId=e,this.messages=[...this.messages,{id:e,group:e,from:`system`,...i}]}for(this.active=e.phase===`understanding`||e.phase===`applying`||!!e.pendingAction,this.lastPhase=e.phase,this.key=a;this.messages.length>50||p(this.messages)>65536;){let e=this.messages[0].group;this.messages=this.messages.filter(t=>t.group!==e)}}clear(){this.messages=[],this.requestId=void 0,this.currentId=void 0,this.active=!1,this.key=``}},g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M={},ee=[],te=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ne=Array.isArray;function N(e,t){for(var n in t)e[n]=t[n];return e}function re(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function P(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?g.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return ie(e,o,r,i,null)}function ie(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++v,__i:-1,__u:0};return i==null&&_.vnode!=null&&_.vnode(a),a}function F(e){return e.children}function ae(e,t){this.props=e,this.context=t}function oe(e,t){if(t==null)return e.__?oe(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?oe(e):null}function se(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=N({},t);a.__v=t.__v+1,_.vnode&&_.vnode(a),ye(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??oe(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,xe(r,a,i),t.__e=t.__=null,a.__e!=n&&ce(a)}}function ce(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ce(e)}function le(e){(!e.__d&&(e.__d=!0)&&b.push(e)&&!ue.__r++||x!=_.debounceRendering)&&((x=_.debounceRendering)||S)(ue)}function ue(){try{for(var e,t=1;b.length;)b.length>t&&b.sort(C),e=b.shift(),t=b.length,se(e)}finally{b.length=ue.__r=0}}function de(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||ee,y=t.length;for(c=fe(n,t,v,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&v[p.__i]||M,p.__i=d,g=ye(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&we(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?(c=pe(p,c,e,_),_&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function fe(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=ie(null,o,null,null,null):ne(o)?o=e.__k[a]=ie(F,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=ie(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=he(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=oe(s)),Te(s,s));return r}function pe(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=pe(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=oe(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function me(e,t){return t||=[],e==null||typeof e==`boolean`||(ne(e)?e.some(function(e){me(e,t)}):t.push(e)),t}function he(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ge(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||te.test(t)?n:n+`px`}function _e(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ge(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ge(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(D,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[E]=r[E]:(n[E]=O,e.addEventListener(t,a?A:k,a)):e.removeEventListener(t,a?A:k,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ve(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[T]==null)t[T]=O++;else if(t[T]<n[E])return;return n(_.event?_.event(t):t)}}}function ye(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,v,y,b,x,S,C,w,T,E=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=_.__b)&&u(t);n:if(typeof E==`function`)try{if(v=t.props,y=E.prototype&&E.prototype.render,b=(u=E.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?g=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new E(v,x):(t.__c=d=new ae(v,x),d.constructor=E,d.render=Ee),b&&b.sub(d),d.state||(d.state={}),d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),y&&d.__s==null&&(d.__s=d.state),y&&E.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=N({},d.__s)),N(d.__s,E.getDerivedStateFromProps(v,d.__s))),p=d.props,m=d.state,d.__v=t,f)y&&E.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),y&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(y&&E.getDerivedStateFromProps==null&&v!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,x),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&!1===d.shouldComponentUpdate(v,d.__s,x)){t.__v!=n.__v&&(d.props=v,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ee.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break n}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,x),y&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,m,h)})}if(d.context=x,d.props=v,d.__P=e,d.__e=!1,S=_.__r,C=0,y)d.state=d.__s,d.__d=!1,S&&S(t),u=d.render(d.props,d.state,d.context),ee.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,S&&S(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++C<25);d.state=d.__s,d.getChildContext!=null&&(r=N(N({},r),d.getChildContext())),y&&!f&&d.getSnapshotBeforeUpdate!=null&&(h=d.getSnapshotBeforeUpdate(p,m)),w=u!=null&&u.type===F&&u.key==null?Se(u.props.children):u,s=de(e,ne(w)?w:[w],t,n,r,i,a,o,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),g&&(d.__E=d.__=null)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else{for(T=a.length;T--;)re(a[T]);be(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||be(t);_.__e(e,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Ce(n.__e,t,n,r,i,a,o,c,l);return(u=_.diffed)&&u(t),128&t.__u?void 0:s}function be(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(be))}function xe(e,t,n){for(var r=0;r<n.length;r++)we(n[r],n[++r],n[++r]);_.__c&&_.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){_.__e(e,t.__v)}})}function Se(e){return typeof e!=`object`||!e||e.__b>0?e:ne(e)?e.map(Se):N({},e)}function Ce(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,v=n.props||M,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(b==null)return document.createTextNode(y);e=document.createElementNS(i,b,y.is&&y),s&&=(_.__m&&_.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=g.call(e.childNodes),!s&&a!=null)for(v={},l=0;l<e.attributes.length;l++)v[(p=e.attributes[l]).name]=p.value;for(l in v)p=v[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in y||l==`value`&&`defaultValue`in y||l==`checked`&&`defaultChecked`in y||_e(e,l,null,p,i);for(l in y)p=y[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||v[l]===p||_e(e,l,p,v[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),de(t.type==`template`?e.content:e,ne(f)?f:[f],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&oe(n,0),s,c),a!=null)for(l=a.length;l--;)re(a[l]);s||(l=`value`,b==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||b==`progress`&&!m||b==`option`&&m!=v[l])&&_e(e,l,m,v[l],i),l=`checked`,h!=null&&h!=e[l]&&_e(e,l,h,v[l],i))}return e}function we(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){_.__e(e,n)}}function Te(e,t,n){var r,i;if(_.unmount&&_.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||we(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){_.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Te(r[i],t,n||typeof e.type!=`function`);n||re(e.__e),e.__c=e.__=e.__e=void 0}function Ee(e,t,n){return this.constructor(e,n)}function De(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),_.__&&_.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],ye(t,e=(!r&&n||t).__k=P(F,null,[e]),i||M,M,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?g.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),xe(a,e,o)}function Oe(e,t){De(e,t,Oe)}function ke(e,t,n){var r,i,a,o,s=N({},e.props);for(a in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)a==`key`?r=t[a]:a==`ref`?i=t[a]:s[a]=t[a]===void 0&&o!=null?o[a]:t[a];return arguments.length>2&&(s.children=arguments.length>3?g.call(arguments,2):n),ie(e.type,s,r||e.key,i||e.ref,null)}function Ae(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,le(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c=`__cC`+j++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}g=ee.slice,_={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},v=0,y=function(e){return e!=null&&e.constructor===void 0},ae.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=N({},this.state);typeof e==`function`&&(e=e(N({},n),this.props)),e&&N(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),le(this))},ae.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),le(this))},ae.prototype.render=F,b=[],S=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,C=function(e,t){return e.__v.__b-t.__v.__b},ue.__r=0,w=Math.random().toString(8),T=`__d`+w,E=`__a`+w,D=/(PointerCapture)$|Capture$/i,O=0,k=ve(!1),A=ve(!0),j=0;var je,Me,Ne,Pe,Fe=0,Ie=[],Le=_,Re=Le.__b,ze=Le.__r,Be=Le.diffed,Ve=Le.__c,He=Le.unmount,Ue=Le.__;function We(e,t){Le.__h&&Le.__h(Me,e,Fe||t),Fe=0;var n=Me.__H||(Me.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function I(e){return Fe=1,Ge(rt,e)}function Ge(e,t,n){var r=We(je++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):rt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Me,!Me.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};Me.__f=!0;var a=Me.shouldComponentUpdate,o=Me.componentWillUpdate;Me.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Me.shouldComponentUpdate=i}return r.__N||r.__}function Ke(e,t){var n=We(je++,3);!Le.__s&&nt(n.__H,t)&&(n.__=e,n.u=t,Me.__H.__h.push(n))}function L(e,t){var n=We(je++,4);!Le.__s&&nt(n.__H,t)&&(n.__=e,n.u=t,Me.__h.push(n))}function R(e){return Fe=5,qe(function(){return{current:e}},[])}function qe(e,t){var n=We(je++,7);return nt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Je(e,t){return Fe=8,qe(function(){return e},t)}function Ye(e){var t=Me.context[e.__c],n=We(je++,9);return n.c=e,t?(n.__??(n.__=!0,t.sub(Me)),t.props.value):e.__}function Xe(){var e=We(je++,11);if(!e.__){for(var t=Me.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function Ze(){for(var e;e=Ie.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(et),t.__h.some(tt),t.__h=[]}catch(n){t.__h=[],Le.__e(n,e.__v)}}}Le.__b=function(e){Me=null,Re&&Re(e)},Le.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ue&&Ue(e,t)},Le.__r=function(e){ze&&ze(e),je=0;var t=(Me=e.__c).__H;t&&(Ne===Me?(t.__h=[],Me.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(et),t.__h.some(tt),t.__h=[],je=0)),Ne=Me},Le.diffed=function(e){Be&&Be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ie.push(t)!==1&&Pe===Le.requestAnimationFrame||((Pe=Le.requestAnimationFrame)||$e)(Ze)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Ne=Me=null},Le.__c=function(e,t){t.some(function(e){try{e.__h.some(et),e.__h=e.__h.filter(function(e){return!e.__||tt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Le.__e(n,e.__v)}}),Ve&&Ve(e,t)},Le.unmount=function(e){He&&He(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{et(e)}catch(e){t=e}}),n.__H=void 0,t&&Le.__e(t,n.__v))};var Qe=typeof requestAnimationFrame==`function`;function $e(e){var t,n=function(){clearTimeout(r),Qe&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Qe&&(t=requestAnimationFrame(n))}function et(e){var t=Me,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Me=t}function tt(e){var t=Me;e.__c=e.__(),Me=t}function nt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function rt(e,t){return typeof t==`function`?t(e):t}function it(e,t={},n={}){return(t[e]??e).replace(/\{(\w+)\}/g,(e,t)=>Object.hasOwn(n,t)?String(n[t]):e)}var at=0;Array.isArray;function z(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--at,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return _.vnode&&_.vnode(l),l}var ot=Ae({});function st({translations:e,children:t}){return z(ot.Provider,{value:e,children:t})}function ct(e){let t=Ye(ot),n=e??t;return(e,t)=>it(e,n,t)}function lt(e){return e==null?`—`:typeof e==`number`?Number.isFinite(e)?e.toLocaleString():`—`:String(e)}function ut({result:e}){let t=ct();return z(`section`,{class:`rv-ai-result-content`,"aria-label":e.title,children:z(`div`,{class:`rv-ai-result-table-scroll`,tabIndex:0,role:`region`,"aria-label":e.title,children:[z(`table`,{class:`rv-ai-result-table`,children:[z(`caption`,{children:[z(`strong`,{children:e.title}),e.description&&z(`span`,{children:e.description})]}),z(`thead`,{children:z(`tr`,{children:e.columns.map((e,t)=>z(`th`,{scope:`col`,class:e.numeric?`rv-ai-result-number`:void 0,children:e.label},t))})}),z(`tbody`,{children:e.rows.map((t,n)=>z(`tr`,{children:e.columns.map((e,n)=>z(`td`,{class:e.numeric?`rv-ai-result-number`:void 0,children:lt(t[n])},n))},n))})]}),!e.rows.length&&z(`p`,{class:`rv-ai-result-empty`,children:t(`No results`)})]})})}function dt({result:e}){return z(`section`,{class:`rv-ai-result-content`,"aria-label":e.title,children:[z(`strong`,{children:e.title}),e.description&&z(`p`,{class:`rv-ai-result-description`,children:e.description}),z(`dl`,{class:`rv-ai-result-metrics`,children:e.items.map((e,t)=>z(`div`,{children:[z(`dt`,{children:e.label}),z(`dd`,{children:lt(e.value)})]},t))})]})}function ft({result:e}){return z(`section`,{class:`rv-ai-result-content`,"aria-label":e.title,children:[z(`strong`,{children:e.title}),e.description&&z(`p`,{class:`rv-ai-result-description`,children:e.description}),z(`p`,{class:`rv-ai-result-text`,children:e.text})]})}function pt({result:e,renderTable:t}){switch(e.kind){case`table`:return t?t(e):z(ut,{result:e});case`metrics`:return z(dt,{result:e});case`text`:return z(ft,{result:e})}}var mt=new WeakMap;function ht(e,t,n){let r=e.createDocumentFragment();typeof t.type==`string`&&[`g`,`rect`,`line`,`text`,`title`,`path`,`circle`,`polyline`].includes(t.type)&&Object.defineProperty(r,"namespaceURI",{value:`http://www.w3.org/2000/svg`}),n&&r.append(n),vt(e,()=>{n?Oe(t,r):De(t,r)});let i=r.firstChild;if(!i||i.nodeType!==1)throw Error(`Expected one Preact element root`);return mt.set(i,r),i}function gt(e){let t=mt.get(e);t&&(t.append(e),vt(e.ownerDocument,()=>De(null,t)),mt.delete(e))}function _t(e,t){vt(e.ownerDocument,()=>De(t,e))}function vt(e,t){let n=Object.getOwnPropertyDescriptor(globalThis,`document`),r=globalThis.document===void 0;r&&Object.defineProperty(globalThis,"document",{configurable:!0,value:e});try{t()}finally{r&&(n?Object.defineProperty(globalThis,"document",n):Reflect.deleteProperty(globalThis,`document`))}}var yt=`
2
+ .rv-tooltip.rv-tooltip {
3
+ box-sizing: border-box;
4
+ position: fixed;
5
+ flex-direction: column;
6
+ z-index: 100000;
7
+ margin: 0;
8
+ inset: auto;
9
+ transform: none;
10
+ opacity: 1;
11
+ visibility: visible;
12
+ padding: 6px 10px;
13
+ border: 0;
14
+ border-radius: 6px;
15
+ background: var(--rv-tooltip-bg, #191919);
16
+ color: var(--rv-tooltip-fg, #fff);
17
+ box-shadow: 0 4px 14px var(--rv-ui-shadow, rgb(0 0 0 / 18%));
18
+ font: 12px/1.4 var(--rv-ui-font-family, Inter, ui-sans-serif, system-ui, sans-serif);
19
+ font-weight: 400;
20
+ text-align: start;
21
+ white-space: pre-wrap;
22
+ overflow-wrap: anywhere;
23
+ max-width: min(360px, calc(100vw - 16px));
24
+ max-height: calc(100dvh - 16px);
25
+ overflow: auto;
26
+ pointer-events: auto;
27
+ }
28
+ .rv-tooltip[data-arrow="true"] { overflow: visible; }
29
+ .rv-tooltip__content { display:block; min-height:0; max-height:inherit; overflow:auto; }
30
+ .rv-tooltip[data-arrow="true"]::before { content:''; position:absolute; width:8px; height:8px; background:inherit; transform:rotate(45deg); pointer-events:none; }
31
+ .rv-tooltip[data-side="top"]::before { bottom:-4px; left:calc(var(--rv-tooltip-arrow-x) - 4px); }
32
+ .rv-tooltip[data-side="bottom"]::before { top:-4px; left:calc(var(--rv-tooltip-arrow-x) - 4px); }
33
+ .rv-tooltip[data-side="left"]::before { right:-4px; top:calc(var(--rv-tooltip-arrow-y) - 4px); }
34
+ .rv-tooltip[data-side="right"]::before { left:-4px; top:calc(var(--rv-tooltip-arrow-y) - 4px); }
35
+ .rv-tooltip[data-duration="true"] { transition: opacity var(--rv-tooltip-duration); }
36
+ .rv-tooltip[data-state="opening"], .rv-tooltip[data-state="closing"] { opacity:0; }
37
+ .rv-tooltip[data-state="closing"] { pointer-events:none; }
38
+ @media (prefers-reduced-motion:reduce) { .rv-tooltip[data-duration="true"] { transition:none; } }
39
+ .rv-tooltip[hidden], .rv-tooltip[data-visible="false"] { display: none; }
40
+ .rv-tooltip[data-overflow] { pointer-events: auto; }
41
+ @media (forced-colors: active) {
42
+ .rv-tooltip.rv-tooltip { color: CanvasText; background: Canvas; border: 1px solid CanvasText; }
43
+ }
44
+ `;function bt(e){if(e.querySelector(`style[data-rv-tooltip-styles]`))return;let t=e.nodeType===9?e:e.ownerDocument,n=ht(t,P(`style`,{"data-rv-tooltip-styles":``},yt));e.nodeType===9?t.head.append(n):e.append(n)}function xt(e){e.classList.add(`rv-tooltip`),e.setAttribute(`role`,`tooltip`);let t=e.getRootNode();bt(t.nodeType===11&&`host`in t?t:e.ownerDocument)}function St(e,t,n,r={}){let i=r.direction===`rtl`,a=r.side===`inline-start`?i?`right`:`left`:r.side===`inline-end`?i?`left`:`right`:r.side??`top`,o=r.align??`center`,s=r.collisionBoundary,c=s&&`getBoundingClientRect`in s?s.getBoundingClientRect():s,l=e=>Math.max(0,typeof r.collisionPadding==`number`?r.collisionPadding:r.collisionPadding?.[e]??8),u={left:Math.max(0,c?.left??0)+l(`left`),top:Math.max(0,c?.top??0)+l(`top`),right:Math.min(n.width,c?.right??n.width)-l(`right`),bottom:Math.min(n.height,c?.bottom??n.height)-l(`bottom`)},d=(n,r,i)=>{let a=typeof n==`function`?n({anchor:e,popup:t,side:i,align:o}):n??r;return Number.isFinite(a)?a:r},f=n=>{let a=n===`top`||n===`bottom`,s=d(r.sideOffset,8,n),c=d(r.alignOffset,0,n),l=a?e.left:e.top,u=a?e.width:e.height,f=a?t.width:t.height,p=a&&i&&o!==`center`?o===`start`?`end`:`start`:o,m=(p===`start`?l:p===`end`?l+u-f:l+(u-f)/2)+c;return{left:a?m:n===`left`?e.left-t.width-s:e.right+s,top:a?n===`top`?e.top-t.height-s:e.bottom+s:m}},p=e=>Math.max(0,u.left-e.left)+Math.max(0,e.left+t.width-u.right)+Math.max(0,u.top-e.top)+Math.max(0,e.top+t.height-u.bottom),m=a,h=f(m),g=r.collisionAvoidance;if(g!==!1&&(typeof g!=`object`||g.side!==`none`)){let e={top:`bottom`,bottom:`top`,left:`right`,right:`left`}[m],t=f(e);p(t)<p(h)&&(m=e,h=t)}return g!==!1&&(typeof g!=`object`||g.align!==`none`)&&(h.left=Math.max(u.left,Math.min(h.left,u.right-t.width)),h.top=Math.max(u.top,Math.min(h.top,u.bottom-t.height))),{...h,side:m,align:o,arrowX:Math.max(8,Math.min(t.width-8,e.left+e.width/2-h.left)),arrowY:Math.max(8,Math.min(t.height-8,e.top+e.height/2-h.top)),availableWidth:Math.max(0,u.right-u.left),availableHeight:Math.max(0,u.bottom-u.top)}}function Ct(e,t){if(!t)return[];let n=ht(e,P(`span`,{style:t}));try{return Array.from({length:n.style.length},(e,t)=>{let r=n.style.item(t);return[r,n.style.getPropertyValue(r),n.style.getPropertyPriority(r)]})}finally{gt(n)}}var wt=Symbol.for(`@revolist/tooltip-owner`);function Tt(e,t,n){let r=e,i=r[wt];i?.owner!==t&&(Object.defineProperty(r,wt,{configurable:!0,writable:!0,value:{owner:t,dismiss:n}}),i?.dismiss())}function Et(e,t){let n=e;n[wt]?.owner===t&&delete n[wt]}function Dt(e,t){if(!e||!t)return!1;let n=new Set,r=e=>!n.has(e)&&(n.add(e),e.contains(t)?!0:[...e.querySelectorAll(`[aria-controls], [data-rv-popup-controls]`)].some(t=>[t.getAttribute(`aria-controls`),t.getAttribute(`data-rv-popup-controls`)].filter(Boolean).join(` `).split(/\s+/).some(t=>{let n=e.ownerDocument.getElementById(t);return!!n&&r(n)})));return r(e)}var Ot=new WeakMap;function kt(e,t=`flex`){if(Ot.has(e)||Ot.set(e,e.getAttribute(`data-rv-ui-surface`)),e.setAttribute(`data-rv-ui-surface`,``),e.style.display=t,typeof e.showPopover==`function`){e.setAttribute(`popover`,`manual`);try{return e.showPopover(),`popover`}catch{e.removeAttribute(`popover`)}}return e.style.display=t,`fallback`}function At(e,t){let n=Ot.get(e);if(n!==void 0&&(n===null?e.removeAttribute(`data-rv-ui-surface`):e.setAttribute(`data-rv-ui-surface`,n),Ot.delete(e)),t===`popover`&&typeof e.hidePopover==`function`)try{e.hidePopover(),e.style.removeProperty(`display`);return}catch{}e.style.display=`none`}function jt(e,t){return Dt(e,t)}function Mt(e){let t=[];for(let n=e;n;){t.push(n);let e=n.getRootNode();n=n.parentElement??(e.nodeType===11&&`host`in e?e.host:null)}return t}function Nt(e){if(!e)return!0;let t=e.ownerDocument.defaultView;return t?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||Mt(e).some(e=>e.getAttribute(`data-rv-ui-motion`)===`off`)?!1:t?.getComputedStyle(e).getPropertyValue(`--rv-ui-motion-enabled`).trim()!==`0`}function Pt(e,t,n){let r=(e.ownerDocument.defaultView?.getComputedStyle(e).getPropertyValue(`--rv-ui-motion-${t}`).trim()??``).match(/^((?:\d+(?:\.\d*)?|\.\d+))(ms|s)$/);return r?Number(r[1])*(r[2]===`s`?1e3:1):n}function Ft(e,t){let n=e.ownerDocument.defaultView,r=n?.MutationObserver?new n.MutationObserver(t):void 0;for(let t of Mt(e))r?.observe(t,{attributes:!0,attributeFilter:[`data-rv-ui-motion`,`style`]});let i=n?.matchMedia?.(`(prefers-reduced-motion: reduce)`);return i?.addEventListener?.(`change`,t),()=>{r?.disconnect(),i?.removeEventListener?.(`change`,t)}}function It(e,t){let n=t.getAttribute(`data-rv-ui-motion`),r=()=>{n===null?t.removeAttribute(`data-rv-ui-motion`):t.setAttribute(`data-rv-ui-motion`,n)};if(e===t||!e)return()=>{};let i=()=>{n===`off`||!Nt(e)?t.setAttribute(`data-rv-ui-motion`,`off`):r()};i();let a=Ft(e,i);return()=>{a(),r()}}var Lt=class{anchor;surface;timer;closeTimer;transitionTimer;frame;mode;cleanup;restoreMotion;managedMount=!1;home;pointerFocus=!1;pointerTravel=!1;hoverArea;open=!1;disposed=!1;addedDescription=!1;classes=[];styleKeys=[];details;options={};onShow;onHide;onEscape;delay=0;get isOpen(){return this.open}get isPending(){return this.timer!==void 0}get target(){return this.anchor}get element(){return this.surface}configure(e){let t=this.options.group;this.open&&t!==e.group&&(t?.closed(this),e.group?.opened(this)),this.options=e,e.disabled?this.hide(`disabled`,void 0,!0):this.open&&this.refresh()}setSurface(e){this.surface=e??void 0}duration(){return this.surface&&Nt(this.surface)?Math.max(0,this.options.transitionDuration??0):0}request(e,t,n=!1){return t.reason===`controlled`||t.reason===`destroy`?!0:!n&&this.options.onBeforeOpenChange?.(e,t)===!1?!1:(this.options.onOpenChange?.(e,t),n||this.options.open===void 0||this.options.open===e)}show(e,t=`imperative`,n){if(clearTimeout(this.closeTimer),this.closeTimer=void 0,this.disposed||this.options.disabled||this.anchor===e&&this.open)return;this.hide(`owner-change`,void 0,!0),this.anchor=e,this.details={target:e,reason:t,event:n},this.listen(e);let r=t===`controlled`||t===`click`?0:t===`imperative`?this.delay:t===`focus`?this.options.focusDelay??0:this.options.delay??this.options.group?.getDelay()??this.delay;r>0?this.timer=setTimeout(()=>{this.timer=void 0,this.present()},r):this.present()}applyStyles(e){for(let t of this.styleKeys)e.style.removeProperty(t);let t=Ct(e.ownerDocument,this.options.style);this.styleKeys=t.map(([e])=>e),e.classList.remove(...this.classes),this.classes=this.options.className?.split(/\s+/).filter(Boolean)??[],e.classList.add(...this.classes);let n=(e,t=``)=>typeof e==`number`?`${e}px`:e??t;Object.assign(e.style,{width:n(this.options.width),height:n(this.options.height),maxWidth:n(this.options.maxWidth,`min(360px, calc(100vw - 16px))`),maxHeight:n(this.options.maxHeight,`calc(100dvh - 16px)`)});for(let[n,r,i]of t)e.style.setProperty(n,r,i);e.dataset.arrow=String(this.options.arrow??!1)}present(){let e=this.anchor,t=this.surface,n=this.details;if(!e||!t||!n||!e.isConnected||this.disposed){this.hide(`anchor-removed`,void 0,!0);return}if(!this.request(!0,n)){this.cleanup?.(),this.cleanup=void 0;return}if(this.disposed)return;Tt(e.ownerDocument,this,()=>this.hide(`owner-change`,void 0,!0));let r=this.options.appendTo;r&&t.parentNode!==r?(!this.managedMount&&t.parentNode&&t.isConnected?this.home={parent:t.parentNode,next:t.nextSibling}:this.managedMount=!0,r.append(t)):t.isConnected||(this.managedMount=!0,e.ownerDocument.body.append(t)),xt(t),this.restoreMotion=It(e,t),t.hidden=!1,t.dataset.visible=`true`,this.applyStyles(t),Object.assign(t.style,{position:`fixed`,inset:`auto`,margin:`0`,transform:`none`,visibility:`visible`,positionAnchor:`auto`,positionArea:`none`}),this.mode=kt(t,`flex`);let i=new Set((e.getAttribute(`aria-describedby`)??``).split(/\s+/).filter(Boolean));if(this.addedDescription=!i.has(t.id),i.add(t.id),e.setAttribute(`aria-describedby`,[...i].join(` `)),this.open=!0,this.options.group?.opened(this),this.position(e,t),!this.open)return;let a=this.duration();t.dataset.duration=String(a>0),t.style.setProperty(`--rv-tooltip-duration`,`${a}ms`),t.dataset.state=a?`opening`:`open`,a&&(this.frame=e.ownerDocument.defaultView?.requestAnimationFrame(()=>{this.frame=void 0,this.open&&(t.dataset.state=`open`)}),this.transitionTimer=setTimeout(()=>{this.transitionTimer=void 0,this.open&&this.options.onOpenChangeComplete?.(!0,n)},a)),this.onShow?.(n),this.options.onShow?.(n),!a&&this.open&&this.options.onOpenChangeComplete?.(!0,n)}position(e,t){let n=e.ownerDocument.defaultView,r=e.getBoundingClientRect();if(!this.options.sticky&&r.width>0&&r.height>0&&(r.bottom<0||r.right<0||r.top>(n?.innerHeight??1/0)||r.left>(n?.innerWidth??1/0))){this.hide(`viewport`,void 0,!0);return}let i={...this.options,direction:this.options.direction??(n?.getComputedStyle(e).direction===`rtl`?`rtl`:`ltr`)},a={width:n?.innerWidth??0,height:n?.innerHeight??0},o=t.getBoundingClientRect(),s=St(r,o,a,i);this.options.collisionAvoidance!==!1&&(o.width>s.availableWidth||o.height>s.availableHeight)&&(o.width>s.availableWidth&&(t.style.maxWidth=`${s.availableWidth}px`),o.height>s.availableHeight&&(t.style.maxHeight=`${s.availableHeight}px`),o=t.getBoundingClientRect(),s=St(r,o,a,i)),Object.assign(t.style,{left:`${s.left}px`,top:`${s.top}px`}),t.dataset.side=s.side,t.dataset.align=s.align;for(let[e,n]of Object.entries({"--rv-tooltip-arrow-x":s.arrowX,"--rv-tooltip-arrow-y":s.arrowY,"--anchor-width":r.width,"--anchor-height":r.height,"--available-width":s.availableWidth,"--available-height":s.availableHeight}))t.style.setProperty(e,`${n}px`);this.hoverArea=r.width>0&&o.width>0?{left:Math.min(r.left,s.left),right:Math.max(r.right,s.left+o.width),top:Math.min(r.top,s.top),bottom:Math.max(r.bottom,s.top+o.height)}:void 0}refresh(){this.open&&this.anchor&&this.surface&&(this.applyStyles(this.surface),this.position(this.anchor,this.surface))}hide(e=`imperative`,t,n=!1){if(!n&&!this.open&&this.transitionTimer!==void 0)return;let r=this.anchor,i=this.surface,a=r?{target:r,reason:e,event:t}:void 0;if((this.open||this.isPending)&&a&&!this.request(!1,a,n))return;clearTimeout(this.timer),clearTimeout(this.closeTimer),clearTimeout(this.transitionTimer),this.timer=this.closeTimer=this.transitionTimer=void 0,this.frame!==void 0&&r?.ownerDocument.defaultView?.cancelAnimationFrame(this.frame),this.frame=void 0,this.cleanup?.(),this.cleanup=void 0;let o=this.open&&!n?this.duration():0;this.restoreMotion?.(),this.restoreMotion=void 0,r&&Et(r.ownerDocument,this);let s=this.open;if(this.open=!1,this.pointerTravel=!1,this.hoverArea=void 0,this.options.group?.closed(this),r&&this.addedDescription&&i){let e=(r.getAttribute(`aria-describedby`)??``).split(/\s+/).filter(e=>e&&e!==i.id);e.length?r.setAttribute(`aria-describedby`,e.join(` `)):r.removeAttribute(`aria-describedby`)}this.addedDescription=!1;let c=()=>{if(i){if(At(i,this.mode),i.hidden=!0,i.dataset.visible=`false`,i.dataset.state=`closed`,this.home){let{parent:e,next:t}=this.home;e.insertBefore(i,t?.parentNode===e?t:null),this.home=void 0}else this.managedMount&&!this.options.keepMounted&&i.remove()}this.mode=void 0,s&&a&&e!==`destroy`&&this.options.onOpenChangeComplete?.(!1,a)};o&&i?(i.dataset.state=`closing`,this.transitionTimer=setTimeout(()=>{this.transitionTimer=void 0,c()},o)):c(),s&&(this.onHide?.(),a&&e!==`destroy`&&this.options.onHide?.(a))}focus(e,t){this.show(e,`focus`,t)}blur(e){this.pointerFocus=!1,this.hide(`blur`,e)}pointerDown(){this.pointerFocus=!0}leave(e,t){if(this.options.autoHide!==!1){if(!this.options.disableHoverablePopup&&this.open&&t&&this.insideHoverArea(t))this.pointerTravel=!0;else if(!e||this.pointerFocus||e.ownerDocument.activeElement!==e){let e=this.options.closeDelay??this.options.group?.options.closeDelay??0;e>0&&this.open?(clearTimeout(this.closeTimer),this.closeTimer=setTimeout(()=>{this.closeTimer=void 0,this.hide(`pointer-leave`,t)},e)):this.hide(`pointer-leave`,t)}}}insideHoverArea(e){let t=this.hoverArea;return!!t&&e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom}keyDown(e){e.key===`Escape`&&(this.open||this.isPending)&&!e.defaultPrevented&&this.options.closeOnEscape!==!1?(this.hide(`escape`,e),e.preventDefault(),e.stopPropagation(),this.onEscape?.(),this.options.onEscape?.()):(e.key===`Enter`||e.key===` `)&&this.options.hideOnClick!==!1&&this.hide(`press`,e)}destroy(){this.hide(`destroy`,void 0,!0),this.disposed=!0,this.managedMount&&this.surface?.remove(),this.surface=void 0,this.anchor=void 0}listen(e){let t=e.ownerDocument,n=t.defaultView,r=e.closest(`[popover]`),i=()=>this.hide(`viewport`,void 0,!0),a=t=>{let n=t.composedPath();this.options.closeOnOutside!==!1&&!n.includes(e)&&(!this.surface||!n.includes(this.surface))&&this.hide(`outside-press`,t)},o=t=>{this.pointerTravel&&!this.insideHoverArea(t)&&(this.pointerTravel=!1,this.leave(e))},s=()=>{this.options.disableHoverablePopup||(clearTimeout(this.closeTimer),this.closeTimer=void 0,this.options.disableHoverablePopup||(this.pointerTravel=!0))},c=t=>this.leave(e,t),l=this.surface,u=n=>{let r=n.target;(r===t||r?.contains?.(e))&&(this.open&&(t.activeElement===e||this.options.sticky)&&this.surface?this.position(e,this.surface):i())},d=()=>this.refresh(),f=()=>{r?.matches(`:popover-open`)||i()},p=e=>{e.key===`Escape`&&this.keyDown(e)},m=n?.MutationObserver?new n.MutationObserver(()=>{e.isConnected||this.hide(`anchor-removed`,void 0,!0)}):void 0;m?.observe(t,{childList:!0,subtree:!0});let h,g=n?.ResizeObserver?new n.ResizeObserver(()=>{h===void 0&&(h=n.requestAnimationFrame(()=>{h=void 0,this.refresh()}))}):void 0;g?.observe(e),l&&g?.observe(l),t.addEventListener(`keydown`,p,!0),t.addEventListener(`pointerdown`,a,!0),t.addEventListener(`pointermove`,o,!0),l?.addEventListener(`pointerenter`,s),l?.addEventListener(`pointerleave`,c),t.addEventListener(`scroll`,u,!0),t.addEventListener(`visibilitychange`,i),n?.addEventListener(`resize`,d),n?.addEventListener(`blur`,i),r?.addEventListener(`toggle`,f),this.cleanup=()=>{m?.disconnect(),g?.disconnect(),h!==void 0&&n?.cancelAnimationFrame(h),t.removeEventListener(`keydown`,p,!0),t.removeEventListener(`pointerdown`,a,!0),t.removeEventListener(`pointermove`,o,!0),l?.removeEventListener(`pointerenter`,s),l?.removeEventListener(`pointerleave`,c),t.removeEventListener(`scroll`,u,!0),t.removeEventListener(`visibilitychange`,i),n?.removeEventListener(`resize`,d),n?.removeEventListener(`blur`,i),r?.removeEventListener(`toggle`,f)}}};function Rt(e=`rv-control`){return`${e}-${globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}var zt=new WeakMap,Bt=class{active;get isOpen(){return!!this.active}open(e){this.close(!1);let{anchor:t,content:n}=e,r=t.ownerDocument,i=r.defaultView,a=zt.get(r)??[];zt.set(r,a);let o=n.parentNode,s=n.nextSibling,c=n.hidden,l=n.getAttribute(`style`),u=n.getAttribute(`popover`),d=It(t,n),p=()=>{if(!t.isConnected){g(!1);return}let a=(e.placement===`above`?St:f)(t.getBoundingClientRect(),n.getBoundingClientRect(),{width:r.documentElement.clientWidth||i?.innerWidth||0,height:r.documentElement.clientHeight||i?.innerHeight||0});Object.assign(n.style,{left:`${a.left}px`,top:`${a.top}px`})},m,h=!1,g=(f=e.restoreFocus!==!1)=>{if(h)return;h=!0,r.removeEventListener(`pointerdown`,_,!0),n.removeEventListener(`keydown`,v),r.removeEventListener(`keydown`,v),i?.removeEventListener(`resize`,p),r.removeEventListener(`scroll`,p,!0),y?.disconnect();let g=a.indexOf(n);g!==-1&&a.splice(g,1),At(n,m),d(),o?.isConnected?o.insertBefore(n,s?.parentNode===o?s:null):n.remove(),l===null?n.removeAttribute(`style`):n.setAttribute(`style`,l),n.hidden=c,u===null?n.removeAttribute(`popover`):n.setAttribute(`popover`,u),this.active?.content===n&&(this.active=void 0),f&&t.isConnected&&t.focus({preventScroll:!0}),e.onClose?.()},_=r=>{if(a.at(-1)!==n)return;let i=r.composedPath();e.closeOnOutside!==!1&&!i.includes(t)&&!i.includes(n)&&g(!1)},v=t=>{a.at(-1)===n&&t.key===`Escape`&&e.closeOnEscape!==!1&&!t.defaultPrevented&&(t.preventDefault(),t.stopPropagation(),g())};(e.appendTo??r.body).append(n),n.hidden=!1,Object.assign(n.style,{position:`fixed`,inset:`auto`,margin:`0`}),m=kt(n,e.display??`block`);let y=i?.ResizeObserver?new i.ResizeObserver(p):void 0;return y?.observe(t),y?.observe(n),this.active={content:n,close:g,position:p},a.push(n),r.addEventListener(`pointerdown`,_,!0),n.addEventListener(`keydown`,v),r.addEventListener(`keydown`,v),i?.addEventListener(`resize`,p),r.addEventListener(`scroll`,p,!0),p(),{close:g,refresh:p}}refresh(){this.active?.position()}close(e){this.active?.close(e)}destroy(){this.close(!1)}};function Vt(e,t=`grid-tooltip`){return ht(e,z(`div`,{id:Rt(`rv-tooltip`),class:t,role:`tooltip`,hidden:!0}))}var Ht=class{session;root;content=``;options={};release;abort;context;generation=0;loading=!1;asyncContent;renderedNode;renderedNodes=[];get isOpen(){return this.session?.isOpen??!1}get element(){return this.session?.element}target(){return this.session?.target}render(e){let t=this.element;if(!t)return;let n=e&&typeof e==`object`&&`nodeType`in e?e:void 0,r=n?.nodeType===11?n===this.renderedNode&&!n.childNodes.length?this.renderedNodes:[...n.childNodes]:n?[n]:[];for(let e of this.renderedNodes)t.contains(e)&&e.parentNode?.removeChild(e);this.renderedNode=n,this.renderedNodes=r,_t(t,P(`span`,{class:`rv-tooltip__content`,ref:n?e=>{if(e)for(let t of r)t.parentNode!==e&&e.append(t)}:void 0},n?null:e)),this.session?.refresh()}renderCurrent(){this.context&&this.render(this.options.loadContent&&this.asyncContent!==void 0?this.asyncContent:this.options.renderContent?.(this.context)??this.content)}load(e){this.abort?.abort(),this.abort=new AbortController;let t=++this.generation;this.asyncContent=void 0;let n=this.options.loadContent;if(!n){this.loading=!1,this.renderCurrent();return}this.loading=!0,this.element?.setAttribute(`aria-busy`,`true`),this.render(this.options.loadingContent??this.content);let r=this.abort.signal;Promise.resolve().then(()=>n({...e,signal:r})).then(n=>{!r.aborted&&t===this.generation&&this.isOpen&&(this.loading=!1,this.element?.removeAttribute(`aria-busy`),this.asyncContent=n,this.render(n),this.options.onContentLoad?.(n,e))},n=>{!r.aborted&&t===this.generation&&this.isOpen&&(this.loading=!1,this.element?.removeAttribute(`aria-busy`),this.options.errorContent===void 0?this.hide():(this.asyncContent=this.options.errorContent,this.render(this.options.errorContent)),this.options.onError?.(n,e))})}reveal(e,t,n){this.context={target:e,reason:t,event:n},(!this.isOpen||this.target()!==e)&&this.renderCurrent(),this.session?.show(e,t,n)}bind(e,t,n={}){this.destroy(),this.root=e,this.content=t,this.options=n,n.filter&&e.querySelector(n.filter);let r=n.surface??Vt(e.ownerDocument,`rv-tooltip`);n.id&&(r.id=n.id),r.id||=Rt(`rv-tooltip`);let i=this.session=new Lt;i.setSurface(r),i.configure(n);let a=new Map,o=(e,t)=>{a.has(e)||a.set(e,e.getAttribute(`aria-expanded`)),e.setAttribute(`aria-expanded`,String(t))};n.trigger===`click`&&!n.filter&&o(e,!1),i.onShow=e=>{c().includes(`click`)&&o(e.target,!0),this.context=e,this.load(e)},i.onHide=()=>{this.abort?.abort(),this.generation++,this.loading=!1,r.removeAttribute(`aria-busy`),this.target()&&a.has(this.target())&&o(this.target(),!1)};let s=t=>{if(!this.options.filter)return e;let n=t.target?.closest?.(this.options.filter);return n&&e.contains(n)?n:void 0},c=()=>Array.isArray(this.options.trigger)?this.options.trigger:this.options.trigger===`manual`?[]:this.options.trigger===`click`?[`click`]:this.options.trigger===`focus`?[`focus`]:[`hover`,`focus`],l=[[n.filter?`pointerover`:`pointerenter`,e=>{let t=s(e),n=e.relatedTarget;n&&t?.contains(n)||t&&c().includes(`hover`)&&e.pointerType!==`touch`&&this.reveal(t,`hover`,e)}],[n.filter?`pointerout`:`pointerleave`,e=>{let t=s(e);if(!t||t!==this.target())return;let n=e.relatedTarget;n&&t.contains(n)||i.leave(t,e)}],[`focus`,e=>{let t=s(e);t&&c().includes(`focus`)&&this.reveal(t,`focus`,e)}],[`blur`,e=>{let t=s(e);t&&t===this.target()&&i.blur(e)}],[`pointerdown`,e=>{i.pointerDown(),this.options.hideOnClick!==!1&&!c().includes(`click`)&&i.hide(`press`,e)}],[`keydown`,e=>{(!c().includes(`click`)||e.key===`Escape`)&&i.keyDown(e)}],[`click`,e=>{let t=s(e);t&&(c().includes(`click`)?this.isOpen&&this.target()===t?i.hide(`click`,e):this.reveal(t,`click`,e):this.options.hideOnClick!==!1&&i.hide(`press`,e))}]];for(let[t,n]of l)e.addEventListener(t,n,!0);return this.release=()=>{this.abort?.abort(),this.generation++;for(let[t,n]of l)e.removeEventListener(t,n,!0);i.destroy(),_t(r,null);for(let[e,t]of a)t===null?e.removeAttribute(`aria-expanded`):e.setAttribute(`aria-expanded`,t);n.surface||gt(r)},n.filter||(this.context={target:e,reason:`imperative`},this.renderCurrent()),e.ownerDocument.activeElement===e&&c().includes(`focus`)&&this.reveal(e,`focus`),()=>this.destroy()}update(e){this.options.loadContent&&!e.loadContent&&(this.abort?.abort(),this.generation++,this.loading=!1,this.asyncContent=void 0,this.element?.removeAttribute(`aria-busy`)),this.options=e,this.session?.configure(e),e.id&&this.element&&!this.isOpen&&(this.element.id=e.id),this.isOpen&&!this.loading&&this.renderCurrent()}setContent(e){this.content=e,this.isOpen&&!this.loading&&this.renderCurrent()}show(e=this.target()??this.root){e&&this.reveal(e,`imperative`)}hide(){this.session?.hide()}toggle(e=this.target()??this.root){this.isOpen?this.hide():this.show(e)}setOpen(e,t=this.target()??this.root){e&&t?this.reveal(t,`controlled`):this.session?.hide(`controlled`)}refresh(){this.isOpen&&this.context&&this.load(this.context),this.session?.refresh()}destroy(){this.release?.(),this.release=void 0,this.session=void 0,this.root=void 0,this.context=void 0,this.abort=void 0,this.asyncContent=void 0,this.renderedNode=void 0,this.renderedNodes=[]}};function Ut(e,t){let n=R(null),r=R(t);return r.current=t,L(()=>{if(n.current&&e)return new Ht().bind(n.current,e,{onEscape:()=>r.current?.()})},[e]),n}var Wt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M309.5-18.9c-4.1-8-12.4-13.1-21.4-13.1s-17.3 5.1-21.4 13.1L193.1 125.3 33.2 150.7c-8.9 1.4-16.3 7.7-19.1 16.3s-.5 18 5.8 24.4l114.4 114.5-25.2 159.9c-1.4 8.9 2.3 17.9 9.6 23.2s16.9 6.1 25 2L288.1 417.6 432.4 491c8 4.1 17.7 3.3 25-2s11-14.2 9.6-23.2L441.7 305.9 556.1 191.4c6.4-6.4 8.6-15.8 5.8-24.4s-10.1-14.9-19.1-16.3L383 125.3 309.5-18.9z"/></svg>`,Gt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M288.1-32c9 0 17.3 5.1 21.4 13.1L383 125.3 542.9 150.7c8.9 1.4 16.3 7.7 19.1 16.3s.5 18-5.8 24.4L441.7 305.9 467 465.8c1.4 8.9-2.3 17.9-9.6 23.2s-17 6.1-25 2L288.1 417.6 143.8 491c-8 4.1-17.7 3.3-25-2s-11-14.2-9.6-23.2L134.4 305.9 20 191.4c-6.4-6.4-8.6-15.8-5.8-24.4s10.1-14.9 19.1-16.3l159.9-25.4 73.6-144.2c4.1-8 12.4-13.1 21.4-13.1zm0 76.8L230.3 158c-3.5 6.8-10 11.6-17.6 12.8l-125.5 20 89.8 89.9c5.4 5.4 7.9 13.1 6.7 20.7l-19.8 125.5 113.3-57.6c6.8-3.5 14.9-3.5 21.8 0l113.3 57.6-19.8-125.5c-1.2-7.6 1.3-15.3 6.7-20.7l89.8-89.9-125.5-20c-7.6-1.2-14.1-6-17.6-12.8L288.1 44.8z"/></svg>`;function Kt({svg:e,className:t=`rv-svg-icon`,size:n}){return z(`span`,{class:t,style:n===void 0?void 0:{"--rv-icon-size":`${n}px`},"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:e}})}var qt=Ae({}),Jt={loading:`Loading…`,empty:`No results found`,error:`Unable to load options.`,retry:`Retry`,loadMore:`Load more`,unavailable:e=>`Unavailable (${String(e)})`},Yt=class{source;context;changed;text;settings;cache=new Map;ids=[];items=[];query=``;cursor;seen=new Set;searchAbort;resolveAbort;timer;generation=0;resolution=0;disposed=!1;loading=!1;searchFailed=!1;failedCursor;resolveFailed=!1;opened=!1;constructor(e,t,n,r=Jt,i={}){this.source=e,this.context=t,this.changed=n,this.text=r,this.settings=i}remember(e){for(let t of e){if(typeof t.value!=`string`&&(typeof t.value!=`number`||!Number.isFinite(t.value)))throw TypeError(`Remote dropdown values must be finite numeric or string IDs.`);this.cache.set(t.value,t)}}emit(){this.disposed||this.changed({items:[...this.items],selected:this.ids.map(e=>this.cache.get(e)??{value:e,label:this.text.unavailable(e),unresolved:!0}),loading:this.loading,error:this.searchFailed||this.resolveFailed,hasMore:this.cursor!==void 0})}setSelected(e,t=[]){this.remember(t),this.ids=[...new Set(e)],this.resolveAbort?.abort();let n=++this.resolution,r=this.ids.filter(e=>!this.cache.has(e));if(this.resolveFailed=!1,this.emit(),!r.length||this.disposed)return;let i=this.resolveAbort=new AbortController;Promise.resolve().then(()=>this.source.resolve({ids:r,signal:i.signal,context:this.context})).then(e=>{this.disposed||i.signal.aborted||n!==this.resolution||(this.remember(e),this.emit())}).catch(()=>{this.disposed||i.signal.aborted||n!==this.resolution||(this.resolveFailed=!0,this.emit())})}search(e,t=!1){this.disposed||(this.opened=!0,this.query=e,this.searchAbort?.abort(),clearTimeout(this.timer),++this.generation,this.items=[],this.cursor=void 0,this.seen.clear(),this.loading=!0,this.searchFailed=!1,this.emit(),t?this.page(void 0,this.generation):this.timer=setTimeout(()=>void this.page(void 0,this.generation),this.settings.debounceMs??200))}async page(e,t){if(this.disposed||t!==this.generation||this.seen.has(e))return;this.seen.add(e),this.loading=!0,this.searchFailed=!1,this.emit();let n=this.searchAbort=new AbortController;try{let r=await this.source.search({query:this.query,cursor:e,pageSize:this.settings.pageSize??50,signal:n.signal,context:this.context});if(this.disposed||n.signal.aborted||t!==this.generation)return;this.remember(r.items);let i=new Map(this.items.map(e=>[e.value,e]));r.items.forEach(e=>i.set(e.value,e)),this.items=[...i.values()],this.cursor=r.nextCursor??void 0,this.seen.has(this.cursor)&&(this.cursor=void 0)}catch{if(this.disposed||n.signal.aborted||t!==this.generation)return;this.seen.delete(e),this.failedCursor=e,this.searchFailed=!0}finally{!this.disposed&&!n.signal.aborted&&t===this.generation&&(this.loading=!1,this.emit())}}loadMore(){!this.loading&&!this.searchFailed&&this.cursor!==void 0&&this.page(this.cursor,this.generation)}retry(){this.resolveFailed&&this.setSelected(this.ids),this.searchFailed&&this.opened&&this.page(this.failedCursor,this.generation)}close(){this.opened=!1,this.searchAbort?.abort(),clearTimeout(this.timer),++this.generation,this.loading=!1,this.emit()}destroy(){this.disposed=!0,this.close(),this.resolveAbort?.abort(),++this.resolution}};function Xt(e){let t=qe(()=>({...Jt,...e.remoteText}),[e.remoteText]),[n,r]=I({items:[],selected:[],loading:!1,error:!1,hasMore:!1}),i=R(),a=e.value===null||e.value===void 0?[]:Array.isArray(e.value)?e.value:[e.value],o=JSON.stringify(a);return L(()=>{if(!e.dataSource||e.disabled){r({items:[],selected:[],loading:!1,error:!1,hasMore:!1});return}let n=new Yt(e.dataSource,e.dataContext,r,t);return i.current=n,()=>{n.destroy(),i.current===n&&(i.current=void 0)}},[e.dataSource,e.dataContext,e.disabled,t]),L(()=>{i.current?.setSelected(a,e.source)},[o,e.source,e.dataSource,e.dataContext,e.disabled,t]),L(()=>{e.open?i.current?.search(e.initialQuery,!0):i.current?.close()},[e.open,e.dataSource,e.dataContext,e.disabled,e.initialQuery,t]),{...n,text:t,search:e=>i.current?.search(e),loadMore:()=>i.current?.loadMore(),retry:()=>i.current?.retry()}}function Zt(e,t){for(var n in t)e[n]=t[n];return e}function Qt(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function $t(e,t){this.props=e,this.context=t}($t.prototype=new ae).isPureReactComponent=!0,$t.prototype.shouldComponentUpdate=function(e,t){return Qt(this.props,e)||Qt(this.state,t)};var en=_.__b;_.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),en&&en(e)};var tn=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function nn(e){function t(t){var n=Zt({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=tn,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var rn=_.__e;_.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}rn(e,t,n,r)};var an=_.unmount;function on(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Zt({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return on(e,t,n)})),e}function sn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return sn(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function cn(){this.__u=0,this.o=null,this.__b=null}function ln(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function un(){this.i=null,this.l=null}_.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),an&&an(e)},(cn.prototype=new ae).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=ln(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=sn(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},cn.prototype.componentWillUnmount=function(){this.o=[]},cn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=on(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&P(F,null,e.fallback);return i&&(i.__u&=-33),[P(F,null,t.__a?null:e.children),i]};var dn=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function fn(e){return this.getChildContext=function(){return e.context},e.children}function pn(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){De(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}De(P(fn,{context:t.context},e.__v),t.v)}function mn(e,t){var n=P(pn,{__v:e,h:t});return n.containerInfo=t,n}(un.prototype=new ae).__a=function(e){var t=this,n=ln(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),dn(t,e,r)):i()};n?n(a):a()}},un.prototype.render=function(e){this.i=null,this.l=new Map;var t=me(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},un.prototype.componentDidUpdate=un.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){dn(e,n,t)})};var hn=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,gn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,_n=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,vn=/[A-Z0-9]/g,yn=typeof document<`u`,bn=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};ae.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(ae.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var xn=_.event;_.event=function(e){return xn&&(e=xn(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Sn={configurable:!0,get:function(){return this.class}},Cn=_.vnode;_.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||yn&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||bn(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:_n.test(a)&&(a=s):s=a=`oninput`:i&&gn.test(a)?a=a.replace(vn,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=me(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=me(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Sn)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=hn,Cn&&Cn(e)};var wn=_.__r;_.__r=function(e){wn&&wn(e),e.__c};var Tn=_.diffed;_.diffed=function(e){Tn&&Tn(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};var En=5,Dn=4;function On(e,t,n){let r=e.ownerDocument.defaultView;if(!r)return{top:t,left:n,scaleX:1,scaleY:1};if(r.getComputedStyle(e).position===`fixed`){let r=e.currentCSSZoom,i=Number.isFinite(r)&&r>0?r:1;return{top:t/i,left:n/i,scaleX:i,scaleY:i}}let i=e.offsetParent,a=e.ownerDocument;if(!i||i===a.body||i===a.documentElement)return{top:t+r.scrollY,left:n+r.scrollX,scaleX:1,scaleY:1};let o=i.getBoundingClientRect(),s=i,c=s.offsetWidth>0?o.width/s.offsetWidth:1,l=s.offsetHeight>0?o.height/s.offsetHeight:1,u=Number.isFinite(c)&&c>0?c:1,d=Number.isFinite(l)&&l>0?l:1;return{top:(t-o.top)/d-s.clientTop+s.scrollTop,left:(n-o.left)/u-s.clientLeft+s.scrollLeft,scaleX:u,scaleY:d}}function kn({onPointerRelease:e,triggerRef:t,children:n,portalTarget:r,theme:i,dropdownMenuId:a,popupClassName:o,closeOnClickOutside:s=!1,onClose:c,align:l=`start`,matchTriggerWidth:u=!1,maxHeight:d,observePopupResize:f=!0,topLayer:p=!1}){let m=R(null),[h,g]=I({top:0,left:0,display:`none`});L(()=>{let e=t.current,n=m.current;if(e&&n)return It(e,n)},[r,t]),Ke(()=>{let e=t.current;if(!e)return;let n=e.ownerDocument.defaultView??window,r=()=>{let t=m.current;if(!t)return;let n=e.getBoundingClientRect(),r=On(t,n.bottom+Dn,n.left);g({top:r.top,left:r.left,display:`flex`,...u?{width:n.width/r.scaleX}:{}})},i=()=>{let t=m.current;if(!t)return;let r=e.getBoundingClientRect(),i=t.style.maxHeight;t.style.maxHeight=``;let a=t.getBoundingClientRect(),o=On(t,0,0),s=Math.max(a.height,t.offsetHeight*o.scaleY,t.scrollHeight*o.scaleY);t.style.maxHeight=i;let c=Math.max(a.width,t.offsetWidth*o.scaleX),f=Math.min(s,typeof d==`number`?Math.max(0,d*o.scaleY):1/0),p=n.innerHeight,h=n.innerWidth,_=Math.max(0,r.top-Dn-En),v=Math.max(0,p-r.bottom-Dn-En),y=f>v&&_>v,b=Math.min(f,y?_:v),x=y?r.top-Dn-b:r.bottom+Dn,S=l===`end`?r.right-c:r.left;x=Math.max(En,Math.min(x,p-En-b)),S=Math.max(En,Math.min(S,h-c-En));let C=On(t,x,S);g({top:C.top,left:C.left,display:`flex`,maxHeight:b/C.scaleY,...u?{width:r.width/C.scaleX}:{}})},a=e=>{e.target instanceof n.Node&&Dt(m.current,e.target)||i()};r();let o=n.setTimeout(i,0);n.addEventListener(`resize`,i),n.addEventListener(`scroll`,a,!0);let s=n.ResizeObserver,c=s?new s(i):void 0;c?.observe(e);let p=e.closest(`.rv-dialog__surface, dialog`);return p&&c?.observe(p),f&&m.current&&c?.observe(m.current),()=>{n.clearTimeout(o),n.removeEventListener(`resize`,i),n.removeEventListener(`scroll`,a,!0),c?.disconnect()}},[l,u,d,f,r,t]),L(()=>{let e=m.current;if(!p||!e)return;let t=kt(e);return()=>{At(e,t)}},[r,p]),L(()=>{if(!s||!c)return;let e=r?.ownerDocument??m.current?.ownerDocument??t.current?.ownerDocument??(typeof document<`u`?document:void 0);if(!e)return;let n=e=>{let n=e.target;n&&(Dt(m.current,n)||t.current?.contains(n)||c())};e.addEventListener(`mousedown`,n);let i=n=>{if(n.key!==`Escape`||m.current?.querySelector(`[aria-expanded="true"]`))return;let r=e.activeElement;r&&(m.current?.contains(r)||t.current?.contains(r))&&(n.preventDefault(),n.stopPropagation(),c(),t.current?.querySelector(`button, input, select`)?.focus())};return e.addEventListener(`keydown`,i),()=>{e.removeEventListener(`mousedown`,n),e.removeEventListener(`keydown`,i)}},[s,c,r,t]);let _=z(`div`,{ref:m,id:a,className:`revo-dropdown-menu ${o||``}`,"data-theme":i??`default`,onMouseUp:e,onTouchEnd:e,style:{top:`${h.top}px`,left:`${h.left}px`,...p?{right:`auto`,bottom:`auto`,margin:`0`}:{},display:h.display,maxHeight:h.maxHeight===void 0?void 0:`${h.maxHeight}px`,width:h.width===void 0?void 0:`${h.width}px`},children:n});return r?mn(_,r):_}function An(e=`[role="option"]`){let t=R(void 0);return Je(n=>{if(t.current?.(),t.current=void 0,!n)return;let r=new Lt,i=Vt(n.ownerDocument,`rv-tooltip`);r.setSurface(i);let a;r.onHide=()=>{a=void 0};let o=t=>{let r=t?.closest?.(e);return r&&n.contains(r)?r:void 0},s=()=>{a=void 0,r.hide()},c=e=>{if(!e){s();return}let t=[e,...e.querySelectorAll(`*`)].filter(e=>e.textContent?.trim()&&e.scrollWidth>e.clientWidth),n=t.filter(e=>!t.some(t=>t!==e&&e.contains(t))).map(e=>e.textContent.trim()).join(`
45
+ `);n?a===e&&i.textContent===n&&r.isOpen||(s(),a=e,i.textContent=n,r.show(e)):s()},l=e=>c(o(e.target)),u=e=>{o(e.relatedTarget)!==a&&(e.type===`pointerout`?r.leave(a,e):s())},d=e=>{if(![`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;let t=(n.hasAttribute(`aria-activedescendant`)?n:n.querySelector(`[aria-activedescendant]`))?.getAttribute(`aria-activedescendant`);t&&c(o(n.ownerDocument.getElementById(t)))};n.addEventListener(`pointerover`,l,!0),n.addEventListener(`pointerout`,u,!0),n.addEventListener(`focusin`,l,!0),n.addEventListener(`focusout`,u,!0),n.addEventListener(`pointerdown`,s,!0),n.addEventListener(`keyup`,d),t.current=()=>{r.destroy(),gt(i),n.removeEventListener(`pointerover`,l,!0),n.removeEventListener(`pointerout`,u,!0),n.removeEventListener(`focusin`,l,!0),n.removeEventListener(`focusout`,u,!0),n.removeEventListener(`pointerdown`,s,!0),n.removeEventListener(`keyup`,d)}},[e])}var jn=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase()),Mn=(e,t,n)=>{if(n===`none`)return 0;let r=e.label.localeCompare(t.label);return n===`asc`?r:-r};function Nn(e,t,n){if(t===void 0)return[];if(n&&Array.isArray(t))return e.filter(e=>t.some(t=>JSON.stringify(t)===JSON.stringify(e.value)));let r=e.find(e=>JSON.stringify(e.value)===JSON.stringify(t));return r?[r]:[]}function Pn(e,t,n,r={},i,a){let{search:o=!1,filterFunction:s=jn,sortDirection:c=`none`,sortFunction:l=Mn,multiSelect:u=!1,autocomplete:d=!1,initialSearch:f=``}=r,[p,m]=I(f),[h,g]=I(-1),[_,v]=I(()=>Nn(e,t,u)),y=R(!1);Ke(()=>{v(a?.selected??Nn(e,t,u))},[t,e,u,a?.selected]);let b=qe(()=>{if(a)return e;let t=[...e];return o&&p&&(t=t.filter(e=>s(e,p))),c!==`none`&&t.sort((e,t)=>l(e,t,c)),t},[e,o,p,s,c,l,!!a]);L(()=>{y.current=!1,m(f)},[f]),Ke(()=>{b.length?g(e=>{if(y.current&&e>=0&&e<b.length&&!b[e].disabled)return e;let t=b.findIndex(e=>!e.disabled&&_.some(t=>JSON.stringify(t.value)===JSON.stringify(e.value)));if(t>=0){let n=b[e];if(!_.some(e=>JSON.stringify(e.value)===JSON.stringify(n?.value)))return t}return e>=0&&e<b.length&&!b[e].disabled?e:t>=0?t:b.findIndex(e=>!e.disabled)}):g(-1)},[b,_]);let x=Je(e=>{if(!e.disabled){if(u){let t=_.some(t=>JSON.stringify(t.value)===JSON.stringify(e.value)),r;r=t?_.filter(t=>JSON.stringify(t.value)!==JSON.stringify(e.value)):[..._,e],v(r),n(r.map(e=>e.value)),d&&m(``)}else v([e]),n(e.value),i&&i()}},[u,_,n,d,i]),S=(e,t)=>{let n=b.length,r=e<0?t===1?-1:n:e;for(let e=1;e<=n;e++){let i=((r+t*e)%n+n)%n;if(!b[i].disabled)return i}return-1};return{searchValue:p,focusedIndex:h,selectedOptions:_,filteredOptions:b,handleSelect:x,handleKeyDown:Je(e=>{switch(e.key){case`Escape`:e.preventDefault(),e.stopPropagation();break;case`ArrowDown`:e.preventDefault(),e.stopPropagation(),y.current=!0,g(e=>S(e,1));break;case`ArrowUp`:e.preventDefault(),e.stopPropagation(),y.current=!0,g(e=>S(e,-1));break;case`Enter`:case` `:e.preventDefault(),e.stopPropagation(),h>=0&&h<b.length&&x(b[h])}},[b,h,x]),handleSearchChange:Je(e=>{let t=e.currentTarget.value;t!==p&&(y.current=!1,m(t),a?.search(t),g(-1))},[a,p]),isOptionSelected:Je(e=>_.some(t=>JSON.stringify(t.value)===JSON.stringify(e.value)),[_]),setFocusedIndex:g}}function Fn({options:e,selectedValues:t,remote:n,value:r,onChange:i,config:a,multiSelect:o,search:s,searchPlaceholder:c,listboxId:l,searchId:u,renderOption:d,renderNoResults:f,onClose:p,onTabNavigation:m,theme:h}){let g=R(null),_=R(null),v=R(null),y=R(!1),{searchValue:b,focusedIndex:x,selectedOptions:S,filteredOptions:C,handleSelect:w,handleKeyDown:T,handleSearchChange:E,setFocusedIndex:D}=Pn(e,r,i,a,p,n&&{selected:t??[],search:n.search}),O=x>=0&&x<C.length&&!C[x].disabled?`${l}-option-${x}`:void 0;L(()=>{let e=v.current;if(!y.current||!e||!O)return;y.current=!1;let t=e.ownerDocument.getElementById(O);if(!t)return;let n=e.getBoundingClientRect(),{top:r,bottom:i}=t.getBoundingClientRect();r<n.top?e.scrollTop+=r-n.top:i>n.bottom&&(e.scrollTop+=i-n.bottom)});let k=An(),A=Je(e=>{_.current=e,k(e)},[k]);return Ke(()=>{if(!a.autoFocus)return;let e=()=>{s&&g.current?g.current.focus({preventScroll:!0}):v.current?.focus({preventScroll:!0})},t=_.current?.ownerDocument.defaultView??(typeof window<`u`?window:void 0);if(!t)return;e();let n=t.setTimeout(e,0),r=t.requestAnimationFrame(e),i=t.setTimeout(e,16);return()=>{t.clearTimeout(n),t.cancelAnimationFrame(r),t.clearTimeout(i)}},[a.autoFocus,s]),z(`div`,{ref:A,className:`dropdown-listbox`,"data-theme":h??`default`,onScrollCapture:e=>{let t=e.target;n&&t.scrollHeight-t.scrollTop-t.clientHeight<48&&n.loadMore()},onKeyUp:e=>e.stopPropagation(),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`)e.preventDefault(),e.stopPropagation(),p(!1);else if(e.key===`Tab`){if(a.nativeTabNavigation&&m){m();return}e.preventDefault(),e.stopPropagation(),a.closeOnTab&&p(!0)}else(e.key!==` `||e.target!==g.current)&&(y.current=e.key===`ArrowDown`||e.key===`ArrowUp`,T(e))},children:[s&&z(`div`,{className:`dropdown-search`,children:z(`input`,{ref:g,type:`text`,id:u,className:`dropdown-search-input ${h?`theme-${h}`:``}`,placeholder:c,value:b,onChange:E,onInput:E,"aria-label":a.searchAriaLabel??`Search options`,"aria-controls":l,"aria-activedescendant":O})}),n?.loading&&z(`div`,{role:`status`,children:n.text.loading}),n?.error&&z(`div`,{role:`alert`,children:[n.text.error,` `,z(ur,{onClick:n.retry,children:n.text.retry})]}),z(In,{options:e,filteredOptions:C,multiSelect:o,focusedIndex:x,selectedOptions:S,onKeyDown:T,onSelect:w,onFocusChange:D,renderOption:d,renderNoResults:n?()=>n.loading||n.error?null:n.text.empty:f,dropdownListRef:v,theme:h,optionIdPrefix:l,listboxLabel:a.ariaLabel??a.searchAriaLabel??`Options`,loading:n?.loading}),n?.hasMore&&z(ur,{disabled:n.loading,onClick:n.loadMore,children:n.text.loadMore})]})}function In({options:e,filteredOptions:t,multiSelect:n,focusedIndex:r,selectedOptions:i,onKeyDown:a,onSelect:o,onFocusChange:s,renderOption:c,renderNoResults:l,dropdownListRef:u,theme:d,optionIdPrefix:f,listboxLabel:p,loading:m}){let h=Je(e=>i.some(t=>JSON.stringify(t.value)===JSON.stringify(e.value)),[i]),g=Je((e,t)=>{let i=h(e),a=r===t;return z(`li`,{id:`${f}-option-${t}`,role:`option`,"data-value":typeof e.value==`string`||typeof e.value==`number`?String(e.value):void 0,"aria-selected":i,"aria-disabled":e.disabled,tabIndex:-1,className:`dropdown-option ${i?`selected`:``} ${a?`focused`:``} ${e.disabled?`disabled`:``} ${d?`theme-${d}`:``}`,onClick:()=>o(e),onMouseEnter:()=>{e.disabled||s(t)},children:c?c(P,e,i):z(`div`,{className:`option-content`,children:[n&&z(`input`,{type:`checkbox`,checked:i,readOnly:!0,disabled:e.disabled,tabIndex:-1,"aria-hidden":`true`}),z(`span`,{children:e.label})]})},`${e.label}-${t}`)},[r,o,h,n,c,s,d]);return z(F,{children:[z(`ul`,{ref:u,className:`dropdown-options`,role:`listbox`,id:f,"aria-label":p,"aria-multiselectable":n,"aria-activedescendant":r>=0?`${f}-option-${r}`:void 0,"aria-busy":m,tabIndex:-1,children:t.map(g)}),!t.length&&z(`div`,{className:`no-results`,role:`status`,children:l?l(P):z(`span`,{children:`No results found`})})]})}var Ln=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="currentColor" d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>`,Rn=({onClick:e,disabled:t,rounded:n,className:r,onMouseDown:i,onDblClick:a,locale:o={title:`Remove`,ariaLabel:`Remove`}})=>z(`button`,{onMouseDown:i,onDblClick:a,onClick:e,disabled:t,type:`button`,title:o.title,"aria-label":o.ariaLabel,className:`rounded-lg flex focus:outline-none remove-btn rv-chip-remove${n?` rv-btn-rounded`:``}${r?` ${r}`:``}`,dangerouslySetInnerHTML:{__html:Ln}});function zn({compact:e=!1,className:t=``,...n}){return z(Rn,{...n,className:`rv-remove-button${e?` rv-remove-button--compact`:``} ${t}`})}var Bn=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/></svg>`,Vn=({options:e,className:t,renderValue:n})=>z(`span`,{className:`selected-value ${t}`,children:n?n(P,e[0]):e[0].label}),Hn=({options:e,removeOption:t,className:n,renderValue:r,disabled:i,removeLabel:a})=>z(`div`,{className:`selected-values ${n}`,children:e.map((e,n)=>z(`span`,{className:`selected-tag`,children:[r?r(P,e):e.label,!i&&!e.disabled&&z(zn,{compact:!0,onClick:n=>{n.stopPropagation(),t(e)},locale:{title:a?.(e.label)??`Remove ${e.label}`,ariaLabel:a?.(e.label)??`Remove ${e.label}`}})]},n))}),Un=({className:e})=>z(`span`,{className:`dropdown-arrow ${e}`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:Bn}}),Wn=({placeholder:e,className:t})=>[z(`span`,{className:`placeholder px-2 ${t}`,children:e}),z(Un,{className:`mr-2`})];function Gn({source:e,triggerAttributes:t,dataSource:n,dataContext:r,remoteText:i,value:a,onChange:o,placeholder:s=`Select an option`,disabled:c=!1,name:l,id:u,className:d=``,style:f,config:p={},renderContent:m,renderOption:h,renderValue:g,renderPlaceholder:_,renderSelectedValue:v,renderNoResults:y,onClose:b,beforeOutsideClose:x,environment:S}){let{search:C=!1,searchPlaceholder:w=`Search...`,closeOnClickOutside:T=!0,autoOpen:E=!1,multiSelect:D=!1,portalTarget:O,ariaLabel:k,ariaLabelledBy:A,ariaDescribedBy:j,popupClassName:M,maxHeight:ee}=p,{title:te,...ne}=t??{},N=Ut(typeof te==`string`?te:void 0),re=O??(p.topLayer?N.current?.closest(`dialog[open], [role=dialog], revo-grid`):void 0)??(typeof document<`u`?document.body:null),ie=qe(()=>u||`dropdown-${Math.random().toString(36).substring(2,9)}`,[u]),F=`${ie}-listbox`,ae=`${ie}-search`,oe=`${ie}-menu`,[se,ce]=I(E&&!c),[le,ue]=I(!c&&(E||!!p.autoFocus)),de=R(E),fe=p.theme??`default`;Ke(()=>{E&&!de.current&&!c&&(ue(!0),ce(!0)),de.current=E},[E,c]),Ke(()=>{c&&se&&(ce(!1),b?.(!1))},[c,se]);let pe=Xt({dataSource:n,dataContext:r,remoteText:i,value:a,disabled:c,source:e,open:se,initialQuery:p.initialSearch??``}),me=n?[...new Map([...pe.selected,...pe.items].map(e=>[e.value,e])).values()]:e,he=qe(()=>{if(a===void 0)return[];if(D&&Array.isArray(a))return me.filter(e=>a.some(t=>JSON.stringify(t)===JSON.stringify(e.value)));{let e=me.find(e=>JSON.stringify(e.value)===JSON.stringify(a));return e?[e]:[]}},[a,me,D]),ge=()=>{c||ce(e=>{let t=!e;return t&&ue(!0),t})},_e=(e=!1)=>{ce(t=>(t&&b?.(e),!1))};Ke(()=>{if(!se)return;let e=N.current;if(e)return S?.onOpen?.(e,_e)},[se]);let ve=e=>{if(!(c||e.disabled)){if(D){let t=he.some(t=>JSON.stringify(t.value)===JSON.stringify(e.value)),n;n=t?he.filter(t=>JSON.stringify(t.value)!==JSON.stringify(e.value)):[...he,e],o&&o(n.map(e=>e.value))}else o&&o(e.value),_e()}};Ke(()=>{if(!T||!se)return;let e=re?.ownerDocument??N.current?.ownerDocument??(typeof document<`u`?document:void 0);if(!e)return;let t=t=>{let n=e.getElementById(oe),r=t.target;if(n&&r&&!Dt(n,r)&&N.current&&!N.current.contains(r)){if(x?.()===!1){t.preventDefault(),t.stopImmediatePropagation();return}_e()}},n=!!x;return e.addEventListener(`pointerdown`,t,n),()=>{e.removeEventListener(`pointerdown`,t,n)}},[T,se,oe,re,x]);let ye=()=>{let e=[Un({})];return v?v(P,he,e):he.length>0?D?[z(Hn,{options:he,removeOption:ve,renderValue:g,disabled:c,removeLabel:p.removeLabel}),z(Un,{className:`mr-2`})]:[z(Vn,{options:he,renderValue:g}),z(Un,{className:`mr-2`})]:_?_(P,s,e):z(Wn,{placeholder:s})},be=()=>z(kn,{onPointerRelease:S?.onPointerRelease,topLayer:p.topLayer,triggerRef:N,portalTarget:re,theme:fe,dropdownMenuId:oe,popupClassName:M,maxHeight:ee,children:m?m({id:F,close:_e}):z(Fn,{options:n?pe.items:me,selectedValues:n?pe.selected:void 0,remote:n?pe:void 0,value:a,onChange:e=>{if(!c&&(o?.(e),!D)){let e=N.current;e?.ownerDocument.defaultView?.requestAnimationFrame(()=>{let t=e.ownerDocument.activeElement;e.isConnected&&(!t||t===e.ownerDocument.body||Dt(e,t))&&e.focus({preventScroll:!0})})}},config:{...p,autoFocus:p.autoFocus||le},multiSelect:D,search:!!n||C,searchPlaceholder:w,listboxId:F,searchId:ae,renderOption:h,renderNoResults:y,onClose:_e,onTabNavigation:()=>{_e(),N.current?.focus()},theme:fe})});return z(`div`,{className:`dropdown-container ${d} ${c?`disabled`:``}`,style:f,children:[z(`div`,{...ne,ref:N,className:`dropdown-trigger ${se?`open`:``}`,role:`combobox`,"data-value":Array.isArray(a)?JSON.stringify(a):a==null?``:String(a),"aria-haspopup":m?`dialog`:`listbox`,"aria-expanded":se&&!c,"aria-disabled":c,"aria-owns":se&&!c?F:void 0,"aria-controls":se&&!c?F:void 0,"data-rv-popup-controls":oe,"aria-label":k,"aria-labelledby":A,"aria-describedby":j,tabIndex:c?-1:0,onClick:c?void 0:ge,onKeyDown:e=>{c||e.target!==e.currentTarget||(se&&e.key===`Tab`&&p.nativeTabNavigation?(e.stopPropagation(),_e()):se&&e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),_e()):!se&&(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),e.stopPropagation(),ge()))},children:ye()}),se&&!c&&be(),l&&z(`input`,{type:`hidden`,name:l,value:JSON.stringify(D?he.map(e=>e.value):he[0]?.value||``)})]})}var Kn=(e,t)=>{_t(e,z(Gn,{...t}))},qn=e=>{_t(e,null)};function Jn(e){return Array.isArray(e)?e.map(Jn).join(``):y(e)?Jn(e.props.children):e==null||typeof e==`boolean`?``:String(e)}function Yn(e,t,n=``,r=!1){if(Array.isArray(e))return e.flatMap(e=>Yn(e,t,n,r));if(!y(e))return[];let i=e.props;if(e.type===F)return Yn(i.children,t,n,r);if(e.type===`optgroup`)return Yn(i.children,t,i.label??``,r||!!i.disabled);let a=t?t(i):i,o={...a,disabled:i.disabled||a.disabled,hidden:i.hidden||a.hidden},s=String(o.label??Jn(o.children)).trim();return[{value:String(o.value??s),label:n?`${n}: ${s}`:s,disabled:r||!!o.disabled,hidden:!!o.hidden,selected:!!o.selected}]}function Xn(e){let{children:t,environment:n,value:r,defaultValue:i,onValueChange:a,optionPolicy:o,multiple:s,disabled:c,name:l,class:u,className:d,style:f,...p}=e,m=Ye(qt),h=m.disabled||!!c,g=Yn(t,o),[_,v]=I(()=>{let e=i??(s?g.filter(e=>e.selected).map(e=>e.value):g.find(e=>e.selected)?.value??g[0]?.value??``);return Array.isArray(e)?[...e]:String(e)}),y=r===void 0?_:Array.isArray(r)?[...r]:String(r),b=Array.isArray(y)?y:[y],x=g.filter(e=>!e.hidden||b.includes(e.value)),S=`rv-select rv-select-control ${typeof u==`string`?u:``} ${d??``}`.replace(/\brv-control\b/g,``).trim();return z(F,{children:[z(Gn,{environment:n,renderOption:(e,t)=>z(`span`,{"data-select-option":t.value,children:t.label}),source:x,value:y,disabled:!!h,className:S,style:f,triggerAttributes:{...p,"data-select-value":Array.isArray(y)?JSON.stringify(y):y},config:{nativeTabNavigation:!0,multiSelect:!!s,topLayer:!0,ariaLabel:p[`aria-label`],ariaLabelledBy:p[`aria-labelledby`]??(p[`aria-label`]?void 0:m.labelId),ariaDescribedBy:p[`aria-describedby`]??m.hintId},onChange:e=>{let t=s?Array.isArray(e)?e:[e]:String(Array.isArray(e)?e[0]??``:e);r===void 0&&v(t),a?.(t)}}),l&&b.map(e=>z(`input`,{type:`hidden`,name:l,value:e,disabled:!!h}))]})}function Zn(...e){e=e.map(e=>e&&typeof e==`object`&&`value`in e&&`subscribe`in e?e.value:e);let t=e.flatMap(e=>typeof e==`string`?e.split(/\s+/):e&&typeof e==`object`?Object.entries(e).filter(([,e])=>e).map(([e])=>e):[]);return[...new Set(t.filter(Boolean))].join(` `)}function Qn(e,t={}){let{class:n,className:r,unstyled:i,busy:a,rounded:o,...s}=t,c=e===`button`&&a===!0;if(c){for(let e of Object.keys(s))/^on/i.test(e)&&delete s[e];s.disabled=!0,s[`aria-busy`]=!0,s.onClickCapture=e=>{e.preventDefault(),e.stopPropagation()}}let l=e===`input`?t.type??`text`:void 0,u=e===`button`?i?``:`rv-btn`:e===`summary`?`rv-disclosure-summary`:l===`checkbox`?`rv-checkbox`:l===`radio`?`rv-radio`:l===`range`?`rv-native-slider`:l===`hidden`?``:`rv-control`;return{...e===`button`?{type:`button`}:{},...s,class:Zn(u,n,r,e===`button`&&o&&`rv-btn-rounded`,c&&`rv-btn-busy`,c&&t.disabled&&`rv-btn-busy-disabled`)}}function $n(e,t,n,...r){let i=n??{};if(t===`button`&&i.busy===!0){let n=r.length?r:[i.children];return e(t,Qn(t,i),e(`span`,{class:`rv-button-spinner`,"aria-hidden":`true`}),...n)}return e(t,Qn(t,i),...r)}function er(e,t,n={}){let r=$n(P,t,n);return n.onChange&&!(t===`button`&&n.busy)&&Object.assign(r.props,{onChange:n.onChange}),ht(e,r)}var tr=new WeakMap;function nr(e,t){return tr.set(e,t),e}function rr(e){return typeof e==`string`?e:e&&(typeof e==`function`||typeof e==`object`)?tr.get(e):void 0}var ir=new WeakMap;function ar(e,t){e.classList.add(`rv-btn`,`rv-btn-ghost`,`rv-btn-icon`),e.setAttribute(`aria-label`,t),ir.get(e)?.(),e.removeAttribute(`title`),e.querySelector(`.rv-control-tooltip`)?.remove();let n=ht(e.ownerDocument,z(`span`,{class:`rv-control-tooltip`,role:`tooltip`,hidden:!0,children:t}));e.append(n),ir.set(e,new Ht().bind(e,t,{surface:n}))}function or(e,t,...n){let{onChange:r,...i}=t,a=$n(P,e,i,...n);return r&&!(e===`button`&&t.busy)&&Object.assign(a.props,{onChange:r}),a}function sr(e,t){let n=Ut(typeof e==`string`?e:void 0);return Je(e=>{n.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t])}var cr=nr(nn(({title:e,...t},n)=>{let r=sr(e,n);return or(`input`,{...t,ref:r})}),`input`),lr=nr(nn(({children:e,title:t,...n},r)=>{let i=sr(t,r);return or(`textarea`,{...n,ref:i},e)}),`textarea`),ur=nr(nn(({children:e,title:t,...n},r)=>{let i=Ut(typeof t==`string`?t:void 0),a=Je(e=>{i.current=e,typeof r==`function`?r(e):r&&(r.current=e)},[r]);return or(`button`,{...n,ref:a,"aria-label":n[`aria-label`]??(!e&&typeof t==`string`?t:void 0)},e)}),`button`),dr=nr(nn(({children:e,title:t,...n},r)=>{let i=sr(t,r);return or(`summary`,{...n,ref:i},e)}),`summary`);nr(Xn,`select`);function fr({filled:e}){return z(`span`,{class:`rv-rating__star`,"data-filled":e?`true`:`false`,children:z(Kt,{svg:e?Wt:Gt})})}function pr({filled:e,selected:t,label:n,className:r=``,...i}){return z(ur,{...i,type:`button`,class:`rv-rating-choice ${r}`,role:`radio`,"aria-checked":t,"aria-label":n,children:z(fr,{filled:e})})}function mr(e){let t,n,r=ht(e,z(`div`,{children:[z(`div`,{style:{display:`contents`},ref:e=>{e&&(t=e)}}),z(`input`,{type:`hidden`,ref:e=>{e&&(n=e)}})]}));return{element:r,mount:t,input:n,release:()=>gt(r)}}function hr(e,t){let{element:n,mount:r,input:i,release:a}=mr(e),o={...t},s=!1,c=()=>{s||(i.name=o.name??``,i.disabled=!!o.disabled||!o.name,i.value=o.value==null?``:String(o.value),Kn(r,{...o,config:{nativeTabNavigation:!0,...o.config},name:void 0,className:`rv-select ${o.className??``}`,onChange:e=>{let t=Array.isArray(e)?e[0]:e;o={...o,value:t},c(),l.onChange?.(t)}}))},l={element:n,get value(){return o.value},set value(e){o={...o,value:e},c()},get source(){return o.source??[]},set source(e){o={...o,source:e},c()},get disabled(){return!!o.disabled},set disabled(e){o={...o,disabled:e},c()},onChange:t.onChange?e=>t.onChange?.(e):void 0,update(e){`onChange`in e&&(l.onChange=e.onChange?t=>e.onChange?.(t):void 0),o={...o,...e},c()},destroy(){s||(s=!0,qn(r),a())}};return c(),l}function gr(e,t,n=5){let r=Math.max(0,Math.floor(t));if(!Number.isFinite(r)||!r)return[];let i=Math.min(r,Math.max(1,Math.floor(n)||5)),a=Math.min(r-1,Math.max(0,Math.floor(e)||0)),o=Math.min(Math.max(0,a-Math.floor(i/2)),r-i),s=new Set([0,r-1]);for(let e=o;e<o+i;e++)s.add(e);let c=[],l=-1;for(let e of[...s].sort((e,t)=>e-t))l>=0&&e-l===2?c.push(l+1):l>=0&&e-l>2&&c.push(`ellipsis`),c.push(e),l=e;return c}function _r(e,t){return $n(e,`button`,{class:Zn(`rv-button small rv-pagination-button rv-btn-ghost`,{"rv-pagination-button--icon":!!t.kind,disabled:t.disabled}),disabled:t.disabled,"aria-label":t.label,"aria-current":t.active?`page`:void 0,onClick:t.onClick},...t.kind?[e(`svg`,{viewBox:`0 0 24 24`,width:16,height:16,fill:`none`,stroke:`currentColor`,"stroke-width":1.8,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,class:`rv-pagination-chevron`},e(`path`,{d:{first:`M11 6l-6 6 6 6M19 6l-6 6 6 6`,previous:`M15 6l-6 6 6 6`,next:`M9 6l6 6-6 6`,last:`M5 6l6 6-6 6M13 6l6 6-6 6`}[t.kind]})),e(`span`,{class:`rv-pagination-sr`,"aria-hidden":`true`},t.text)]:[t.text])}var vr=class{onPageChange;h;config={itemsPerPage:0,initialPage:0,total:0};currentPage=0;loading=!1;totalPages=0;locales={previous:`‹`,next:`›`,first:`«`,last:`»`,page:`Page`,of:`of`,items:`items`,loading:`Loading…`};selector;selectorRef=e=>{e?this.selector||(this.selector=hr(e.ownerDocument,this.selectorProps()),e.append(this.selector.element)):(this.selector?.destroy(),this.selector=void 0)};selectorProps(){return{config:{ariaLabel:this.locales.page},value:String(this.currentPage),source:Array.from({length:this.totalPages},(e,t)=>({value:String(t),label:String(t+1)})),onChange:e=>this.setPage(Number(e))}}refresh;constructor(e,t,n){this.onPageChange=t,this.h=n,this.update(e)}setLoading(e){this.loading!==e&&(this.loading=e,this.refresh?.())}setRefresh(e){this.refresh=e}setPage(e,t=!0){let n=Math.max(0,this.totalPages-1),r=Math.min(Math.max(0,e),n);this.currentPage=r,this.refresh?.(),t&&this.onPageChange(this.currentPage)}createButton(e,t,n,r){let i={first:`«`,previous:`‹`,next:`›`,last:`»`}[r]===e?{first:`First page`,previous:`Previous page`,next:`Next page`,last:`Last page`}[r]:e;return _r(this.h,{text:e,label:i,kind:r,disabled:n,onClick:()=>t.call(this)})}render(){this.selector?.update(this.selectorProps());let e=this.h,t=[];if(this.config.navigation!==!1){if(t.push(...this.config.boundaryButtons===!1?[]:[this.createButton(this.locales.first,()=>{this.currentPage>0&&this.setPage(0)},this.currentPage===0,`first`)],this.createButton(this.locales.previous,()=>{this.currentPage>0&&this.setPage(this.currentPage-1)},this.currentPage===0,`previous`)),this.config.buttonCount)for(let n of gr(this.currentPage,this.totalPages,this.config.buttonCount))n===`ellipsis`?t.push(e(`span`,{class:`rv-pagination-ellipsis`,"aria-hidden":`true`},`…`)):t.push(_r(e,{text:String(n+1),label:`${this.locales.page} ${n+1}`,active:n===this.currentPage,disabled:n===this.currentPage,onClick:()=>this.setPage(n)}));t.push(this.createButton(this.locales.next,()=>{this.currentPage<this.totalPages-1&&this.setPage(this.currentPage+1)},this.currentPage>=this.totalPages-1,`next`),...this.config.boundaryButtons===!1?[]:[this.createButton(this.locales.last,()=>{this.setPage(this.totalPages-1)},this.currentPage>=this.totalPages-1,`last`)])}if(this.totalPages>1){let n=[];this.config.info!==!1&&n.push(e(`span`,{class:`rv-pagination-label`},this.locales.page)),n.push(e(`span`,{class:`rv-pagination-dropdown`,ref:this.selectorRef})),this.config.info!==!1&&n.push(e(`span`,null,` ${this.locales.of} ${this.totalPages}`)),t.push(e(`span`,{class:`rv-pagination-selector`},n))}this.loading&&t.push(e(`span`,{role:`status`,"aria-live":`polite`},this.locales.loading));let n=[];if(this.config.totalInfo!==!1){let t=this.config.total>0&&this.config.itemsPerPage>0?this.currentPage*this.config.itemsPerPage+1:0,r=Math.min((this.currentPage+1)*this.config.itemsPerPage,this.config.total);n.push(e(`span`,{dir:`auto`},`${t}-${r} ${this.locales.of} ${this.config.total} ${this.locales.items}`))}return e(`div`,{class:`rv-pagination-panel`,role:`navigation`,"aria-label":this.locales.page},[e(`span`,null,t),e(`span`,null,n)])}update(e){let t=e.itemsPerPage>0&&Number.isFinite(e.total)?Math.max(0,Math.ceil(e.total/e.itemsPerPage)):0;this.currentPage=e.initialPage===this.config.initialPage?t?Math.min(this.currentPage,t-1):0:Math.min(Math.max(0,Math.floor(e.initialPage)||0),Math.max(0,t-1)),this.totalPages=t,this.config=e,this.locales={...this.locales,...e.locales},this.refresh?.()}},yr=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L269.3 256 406.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/></svg>`,br=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"/></svg>`,xr=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M311.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L243.2 256 73.9 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/></svg>`,Sr={first:yr,previous:br,next:xr,last:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M439.1 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L371.2 256 233.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L179.2 256 41.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/></svg>`};function Cr(e,t){return e(`div`,{class:t.className??`rv-spinner`,role:`status`,"aria-label":t.label,ref:t.ref},t.showSpinner?[e(`span`,{class:`rv-spinner__ring`,"aria-hidden":`true`})]:[])}function wr(e,t){return ht(e,z(ur,{unstyled:!0,type:`button`,class:t.className??`rv-btn`,"aria-label":t.label,disabled:!!t.disabled,onClick:t.onClick,children:t.text??t.label}))}function Tr(e,t){return e(`button`,{type:`button`,role:`menuitem`,disabled:t.disabled,tabIndex:-1,"aria-haspopup":t.submenu?`menu`:void 0,style:t.style,onClick:()=>{t.disabled||t.onActivate()}},[t.label,t.submenu?e(`span`,{"aria-hidden":`true`,style:`float:inline-end;margin-inline-start:16px`},`›`):null])}function Er(e,t,n=Math.max(0,Math.floor(t))){let r=Math.round(t);return Array.from({length:Number.isFinite(n)?Math.max(0,Math.floor(n)):0},(t,n)=>e(`span`,{class:n<r?`star filled-star`:`star empty-star`}))}function Dr(e,t){let n=e=>t.max>t.min?Math.max(0,Math.min(100,(e-t.min)/(t.max-t.min)*100)):0;return e(`div`,{class:`revo-slider ${t.thresholdClassNames??``}`},[e(`div`,{class:`revo-slider-container ${t.thresholdClassNames??``}`},[e(`input`,{class:`revo-slider-input rv-single-slider`,style:{"--rv-single-slider-value":`${n(t.value)}%`},type:`range`,min:t.min,max:t.max,step:t.step,value:t.value,"aria-label":t.label,"aria-valuetext":String(t.displayValue??t.value),onInput:e=>{let r=e.target;r.style.setProperty(`--rv-single-slider-value`,`${n(Number(r.value))}%`);let i=r.closest(`.revo-slider`)?.querySelector(`.revo-slider-value`),a=String(t.formatValue?.(Number(r.value))??Number(r.value));r.setAttribute(`aria-valuetext`,a),i&&(i.textContent=a)},onChange:e=>t.onChange(Number(e.target.value),e),onMouseDown:t.onMouseDown}),...(t.thresholds??[]).map(t=>e(`div`,{class:`revo-slider-threshold ${t.className}`,style:{left:`${n(t.value)}%`}}))]),...t.hideValue?[]:[e(`span`,{class:`revo-slider-value rv-badge rv-badge--inline ${t.thresholdClassNames??``}`},t.displayValue??t.value)]])}function Or(e,t){let n=(n,r,i)=>$n(e,`button`,{class:{"revo-counter-button":!0,"revo-counter-button-disabled":r},type:`button`,"aria-label":n<0?t.decreaseLabel??`Decrease value`:t.increaseLabel??`Increase value`,disabled:r,onMouseDown:t.onMouseDown,onClick:e=>{r||t.onChange(Math.min(t.max,Math.max(t.min,t.value+n)),e)}},i);return e(`div`,{class:`revo-counter`},[n(-t.step,t.value<=t.min,`-`),...t.hideValue?[]:[e(`span`,{class:`revo-counter-value`},String(t.value))],n(t.step,t.value>=t.max,`+`)])}function kr(e,t=!0,n){let[r]=I(()=>Rt(`rv-format-control-tooltip`)),i=n?.id??r,[a]=I(()=>new Lt),o=R(null),s=R(!1),c=Je(()=>a.hide(),[a]),l=Je(e=>{e||a.hide(`destroy`,void 0,!0),a.setSurface(e)},[a]),u=()=>{if(n?.anchor&&(o.current=n.anchor),!o.current?.isConnected){let e=a.element?.getRootNode();o.current=[...e?.querySelectorAll(`[aria-describedby]`)??[]].find(e=>e.getAttribute(`aria-describedby`)?.split(/\s+/).includes(i))??null}return o.current};L(()=>{a.hide()},[e,n?.delay]),L(()=>{a.configure(n??{}),(n?.open||n?.defaultOpen)&&u(),n?.open===void 0?s.current||(s.current=!0,n?.defaultOpen&&o.current&&a.show(o.current,`controlled`)):n.open&&o.current?a.show(o.current,`controlled`):a.hide(`controlled`)}),L(()=>()=>a.destroy(),[a]);let d=Array.isArray(n?.trigger)?n.trigger:n?.trigger===`manual`?[]:n?.trigger===`click`?[`click`]:n?.trigger===`focus`?[`focus`]:[`hover`,`focus`];return{id:i,hide:c,show:()=>{let e=u();e&&a.show(e)},refresh:()=>a.refresh(),triggerProps:{"aria-describedby":i,onFocus:e=>{o.current=e.currentTarget,d.includes(`focus`)&&a.focus(e.currentTarget,e)},onBlur:e=>a.blur(e),onMouseEnter:e=>{o.current=e.currentTarget,d.includes(`hover`)&&a.show(e.currentTarget,`hover`,e)},onMouseLeave:e=>a.leave(e?.currentTarget,e),onPointerDown:e=>a.pointerDown(),onPointerCancel:()=>a.hide(),onClickCapture:e=>{o.current=e.currentTarget,d.includes(`click`)?a.isOpen?a.hide(`click`,e):a.show(e.currentTarget,`click`,e):n?.hideOnClick!==!1&&a.hide(`press`,e)},onKeyDown:e=>{(!d.includes(`click`)||e.key===`Escape`)&&a.keyDown(e)}},tooltip:z(`span`,{ref:l,id:i,class:`rv-tooltip ${n?.className??`rv-format-control-tooltip`}`,role:`tooltip`,"data-visible":`false`,hidden:!0,children:z(`span`,{class:`rv-tooltip__content`,children:n?.content??e})})}}function Ar({id:e,text:t,content:n,visible:r,anchor:i=null,className:a=`rv-format-control-tooltip`,...o}){let[s]=I(()=>new Lt),c=Je(e=>{e||s.hide(`destroy`,void 0,!0),s.setSurface(e)},[s]);return L(()=>{s.configure({...o,className:a})}),L(()=>{r&&i?s.show(i,`controlled`):s.hide(`controlled`)},[r,i,o.disabled]),L(()=>()=>s.destroy(),[s]),z(`span`,{ref:c,id:e,class:`rv-tooltip ${a}`,role:`tooltip`,"data-visible":`false`,hidden:!0,children:z(`span`,{class:`rv-tooltip__content`,children:n??t})})}var jr=kr;function Mr({label:e,variant:t,icon:n,visibleLabel:r,className:i,iconClassName:a,labelClassName:o,children:s,iconContent:c,badge:l,badgeClassName:u=``,class:d,disabled:f,title:p,...m}){let h=kr(typeof p==`string`?p:e,!0,{className:`rv-control-tooltip`,placement:`above`});return z(ur,{type:`button`,"aria-label":l===void 0?e:`${e} ${l}`,...m,disabled:f,...h.triggerProps,"aria-describedby":[m[`aria-describedby`],h.id].filter(Boolean).join(` `),onFocus:e=>{h.triggerProps.onFocus(e),m.onFocus?.(e)},onBlur:e=>{h.triggerProps.onBlur(),m.onBlur?.(e)},onMouseEnter:e=>{h.triggerProps.onMouseEnter(e),m.onMouseEnter?.(e)},onMouseLeave:e=>{h.triggerProps.onMouseLeave(e),m.onMouseLeave?.(e)},onPointerDown:e=>{h.triggerProps.onPointerDown(e),m.onPointerDown?.(e)},onPointerCancel:e=>{h.triggerProps.onPointerCancel(),m.onPointerCancel?.(e)},onKeyDown:e=>{h.triggerProps.onKeyDown(e),m.onKeyDown?.(e)},onClick:e=>{h.hide(),m.onClick?.(e)},class:Zn(i??(t?``:`rv-btn-ghost`),t&&`rv-btn-${t}`,d,`rv-icon-action`,!r&&`rv-btn-icon`),children:[n?z(Kt,{svg:n,className:a}):c,r?z(`span`,{class:o,children:r}):null,l!==void 0&&z(`span`,{class:`rv-badge ${u}`,"aria-hidden":`true`,children:l}),s,h.tooltip]})}function Nr(e){if(e===`tablist`)return`tab`;if(e===`radiogroup`)return`radio`}function Pr(e){return Fr(P,e)}function Fr(e,{value:t,options:n,onChange:r,ariaLabel:i,className:a=``,itemClassName:o=``,countClassName:s=``,activeClassName:c=`on`,disabled:l=!1,iconOnly:u=!1,title:d,role:f=`tablist`,testId:p,renderOption:m,renderCount:h}){let g=Nr(f),_=n.filter(e=>!l&&!e.disabled),v=_.some(e=>e.value===t),y=(e,t)=>{if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)||!_.length)return;e.preventDefault();let n=_.findIndex(e=>e.value===t),i=e.key===`ArrowLeft`||e.key===`ArrowUp`,a=e.key===`Home`?0:e.key===`End`?_.length-1:(Math.max(0,n)+(i?-1:1)+_.length)%_.length,o=_[a];r(o.value,o),(e.currentTarget.parentElement?.querySelectorAll(`.rv-segmented-switch-item:not(:disabled)`))?.[a]?.focus()};return e(`div`,{class:`rv-segmented-switch${u?` rv-segmented-switch--icon-only`:``} ${a}`.trim(),role:f,"aria-label":i,title:d,"data-testid":p},...n.map(n=>{let i=n.value===t,a=l||!!n.disabled,d={active:i,disabled:a};return e(`button`,{...n.buttonAttributes,key:String(n.value),type:`button`,role:g,id:n.id,"aria-controls":n.ariaControls,"aria-selected":g===`tab`?i:void 0,"aria-checked":g===`radio`?i:void 0,"aria-pressed":f===`group`?i:void 0,"aria-label":n.ariaLabel??(u&&typeof n.label==`string`?n.label:void 0),title:n.title??(u&&typeof n.label==`string`?n.label:void 0),tabIndex:g&&!a&&(i||!v&&n===_[0])?0:g?-1:void 0,class:`rv-segmented-switch-item ${i?`on ${c}`:``} ${o} ${n.className??``}`.trim(),disabled:a,"data-value":String(n.value),"data-testid":n.testId,onKeyDown:e=>y(e,n.value),onClick:()=>{a||i||r(n.value,n)}},e(`span`,{class:`rv-segmented-switch-label`},m?m(n,d):n.label),n.count===void 0?null:e(`span`,{class:`rv-segmented-switch-count ${s}`.trim()},h?h(n,d):n.count))}))}function Ir({children:e,className:t=``}){return z(`div`,{class:`rv-editor-split ${t}`,children:e})}function Lr({children:e,className:t=``,scrollable:n=!1}){return z(`section`,{class:`rv-editor-pane${n?` rv-editor-pane--scrollable`:``} ${t}`,children:e})}function Rr({children:e,className:t=``,label:n,onSelect:r,listRef:i,variant:a=`default`,spacing:o=`default`}){let s=An();return z(`div`,{ref:Je(e=>{s(e),typeof i==`function`?i(e):i&&(i.current=e)},[s,i]),class:`rv-editor-list${a===`plain`?` rv-editor-list--plain`:``}${o===`comfortable`?` rv-editor-list--comfortable`:``} ${t}`,role:`listbox`,"aria-label":n,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[data-editor-value]:not(:disabled)`));if(!t.length)return;let n=Math.max(0,t.indexOf(e.target)),i=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;e.preventDefault(),t[i].focus(),r(t[i].dataset.editorValue)},children:e})}function zr({value:e,selected:t,icon:n,label:r,description:i,contentClassNames:a,children:o,className:s=``,...c}){return z(`button`,{...c,type:`button`,role:`option`,"data-editor-value":e,"aria-selected":t,tabIndex:c.tabIndex??(t?0:-1),class:`rv-editor-list__item${t?` rv-editor-list__item--selected`:``} ${s}`,children:r===void 0?o:z(Br,{icon:n,label:r,description:i,classNames:a})})}function Br({icon:e,label:t,description:n,classNames:r={}}){return z(`span`,{class:`rv-editor-list__content${e?``:` rv-editor-list__content--text`}`,children:[e&&z(`span`,{class:`rv-editor-list__icon ${r.icon??``}`,"aria-hidden":`true`,children:e}),z(`span`,{class:`rv-editor-list__copy ${r.copy??``}`,children:[z(`span`,{class:`rv-editor-list__label ${r.label??``}`,children:t}),n!==void 0&&z(`span`,{class:`rv-editor-list__description ${r.description??``}`,children:n})]})]})}function Vr({label:e,children:t,className:n=``,labelClassName:r=``}){return z(`div`,{class:`rv-editor-list__group ${n}`,role:`group`,"aria-label":e,children:[z(`div`,{class:`rv-editor-list__group-label ${r}`,children:e}),t]})}function Hr({cancel:e={},save:t={},deleteAction:n=!1,reset:r=!1,start:i,end:a,children:o,actionsClass:s=``,class:c=``,...l}){let u=(e,t,n,r=``,i=`button`)=>{if(t===!1)return null;let{label:a=n,class:o=``,...s}=t;return z(ur,{type:i,...s,class:`rv-btn ${r} ${o}`,"data-dialog-action":e,children:a})};return z(`footer`,{...l,class:`rv-dialog__footer rv-dialog__action-footer ${c}`,children:[o,z(`div`,{class:`rv-dialog__action-panel`,children:[z(`div`,{class:`rv-dialog__action-start`,children:[i,u(`delete`,n,`Delete`,`rv-btn-danger-outline`),u(`reset`,r,`Reset`)]}),z(`div`,{class:`rv-dialog__actions ${s}`,children:[a,u(`cancel`,e,`Cancel`),u(`save`,t,`Save`,`rv-btn-primary`,`submit`)]})]})]})}function Ur(e,t){let n=ht(e.ownerDocument,z(Hr,{...t}));return e.append(n),{destroy(){gt(n)}}}var Wr=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"/></svg>`,Gr=nn(({class:e=``,...t},n)=>z(`header`,{...t,ref:n,class:`rv-dialog__header ${e}`}));function Kr({class:e=``,...t}){return z(`form`,{...t,class:`rv-dialog__surface ${e}`})}var qr=nn(({class:e=``,...t},n)=>z(`div`,{...t,ref:n,class:`rv-dialog__body ${e}`})),Jr=nn(({class:e=``,...t},n)=>z(`footer`,{...t,ref:n,class:`rv-dialog__footer ${e}`})),Yr=nn(({class:e=``,...t},n)=>z(`div`,{...t,ref:n,class:`rv-dialog__actions ${e}`}));function Xr({class:e=``,iconClass:t=``,...n}){return z(ur,{...n,unstyled:!0,type:`button`,class:`rv-dialog__close ${e}`,children:z(`span`,{class:`rv-dialog__close-icon ${t}`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:Wr}})})}var Zr=nn(({class:e=``,...t},n)=>z(cr,{...t,ref:n,class:`rv-dialog__title-input ${e}`})),Qr=nn(({titleId:e,title:t,name:n,description:r,inputLabel:i,titleHidden:a,headingClass:o=``,kickerClass:s=``,titleClass:c=``,inputProps:l,closeLabel:u,closeProps:d,onClose:f,class:p=``,...m},h)=>z(Gr,{...m,ref:h,class:`rv-dialog__header--editable ${p}`,children:[z(`div`,{class:`rv-dialog__heading ${o}`,children:[!a&&n&&z(`span`,{class:`rv-dialog__kicker ${s}`,children:n}),!a&&(l===!1?z(`h3`,{id:e,class:`rv-dialog__title ${c}`,children:t}):z(F,{children:[z(`h3`,{id:e,class:`rv-dialog__sr-only ${c}`,children:t}),z(Zr,{"aria-label":i,value:t,...l})]})),r&&z(`div`,{class:`rv-dialog__description`,children:r})]}),f&&z(Xr,{...d,"aria-label":u,onClick:f})]}));function $r(e){return z(Hr,{...e})}function ei(e,t,n){let r=ii(),i,a,o,s,c;return{root:ht(e,z(`div`,{class:[`rv-dialog-overlay`,t.overlayClass].filter(Boolean).join(` `),role:`dialog`,"aria-modal":`true`,"aria-labelledby":r,"aria-describedby":t.ariaDescribedBy,tabIndex:-1,children:z(`section`,{ref:e=>{i=e},class:[`rv-dialog__surface`,t.surfaceClass].filter(Boolean).join(` `),children:[z(Gr,{ref:e=>{a=e},children:[z(`div`,{class:`rv-dialog__heading`,children:z(`h3`,{id:r,class:`rv-dialog__title`,children:t.title})}),z(Xr,{"aria-label":t.closeLabel,title:t.closeLabel,onClick:n})]}),z(qr,{ref:e=>{o=e}}),z(Jr,{ref:e=>{s=e},children:z(Yr,{ref:e=>{c=e}})})]})})),surface:i,header:a,body:o,footer:s,actions:c}}function ti(e,t,n){return ht(e,z(Xr,{"aria-label":t,title:t,onClick:n}))}function ni(e,t,n,r=`default`){return ht(e,z(ur,{title:t||void 0,class:r==="default"?`rv-btn`:`rv-btn-${r}`,onClick:n,children:t}))}var ri=0;function ii(){return ri+=1,`rv-dialog-title-${ri}`}function ai(e,t){let n=oi(e);if(!n.length){t.preventDefault(),e.focus();return}let r=e.ownerDocument.activeElement,i=n.findIndex(e=>e===r),a=i<0?t.shiftKey?n.length-1:0:t.shiftKey?(i-1+n.length)%n.length:(i+1)%n.length;t.preventDefault(),n[a].focus()}function oi(e){return Array.from(e.querySelectorAll(`a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), iframe, object, embed, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hidden&&!e.closest(`[hidden], [inert], [aria-hidden="true"]`)&&!e.matches(`[tabindex="-1"], :disabled, input[type="hidden"]`))}var si=[`a`,`button`,`input`,`select`,`textarea`,`[contenteditable="true"]`,`[data-dialog-drag-ignore]`].join(`,`);function ci({target:e,handle:t,margin:n=8,ignoreSelector:r=si}){let i=e.ownerDocument.defaultView;if(!i)return()=>void 0;let a=0,o=0,s,c=()=>{e.style.setProperty(`--rv-dialog-translate-x`,`${a}px`),e.style.setProperty(`--rv-dialog-translate-y`,`${o}px`)},l=n=>{if(!s||n&&`pointerId`in n&&typeof n.pointerId==`number`&&n.pointerId!==s.pointerId)return;let r=s.pointerId;s=void 0,e.classList.remove(`rv-dialog__dragging`),i.removeEventListener(`pointermove`,u),i.removeEventListener(`pointerup`,l),i.removeEventListener(`pointercancel`,l),i.removeEventListener(`blur`,l),t.removeEventListener(`lostpointercapture`,l),t.hasPointerCapture?.(r)&&t.releasePointerCapture(r)},u=e=>{if(!s||e.pointerId!==s.pointerId)return;let t=ui(s.rect.left,s.rect.right,i.innerWidth,n),r=ui(s.rect.top,s.rect.bottom,i.innerHeight,n),l=s.translateX+fi(e.clientX-s.clientX,t.min,t.max),u=s.translateY+fi(e.clientY-s.clientY,r.min,r.max);e.preventDefault(),(l!==a||u!==o)&&(a=l,o=u,c())},d=n=>{if(!(n.button!==0||n.isPrimary===!1||li(n.target,t,r))){l(),s={clientX:n.clientX,clientY:n.clientY,pointerId:n.pointerId,rect:e.getBoundingClientRect(),translateX:a,translateY:o},e.classList.add(`rv-dialog__dragging`),i.addEventListener(`pointermove`,u,{passive:!1}),i.addEventListener(`pointerup`,l),i.addEventListener(`pointercancel`,l),i.addEventListener(`blur`,l),t.addEventListener(`lostpointercapture`,l);try{t.setPointerCapture?.(n.pointerId)}catch{}n.preventDefault()}},f=()=>{l();let t=e.getBoundingClientRect(),r=di(t.left,t.right,i.innerWidth,n),s=di(t.top,t.bottom,i.innerHeight,n);(r||s)&&(a+=r,o+=s,c())};e.classList.add(`rv-dialog__draggable`),t.classList.add(`rv-dialog__drag-handle`),t.addEventListener(`pointerdown`,d),i.addEventListener(`resize`,f),i.visualViewport?.addEventListener(`resize`,f);let p=i.ResizeObserver?new i.ResizeObserver(f):void 0;return p?.observe(e),()=>{l(),t.removeEventListener(`pointerdown`,d),i.removeEventListener(`resize`,f),i.visualViewport?.removeEventListener(`resize`,f),p?.disconnect(),t.classList.remove(`rv-dialog__drag-handle`),e.classList.remove(`rv-dialog__draggable`,`rv-dialog__dragging`),e.style.removeProperty(`--rv-dialog-translate-x`),e.style.removeProperty(`--rv-dialog-translate-y`)}}function li(e,t,n){let r=t.ownerDocument.defaultView?.Element;if(!r||!(e instanceof r))return!1;let i=e.closest(n);return!!i&&t.contains(i)}function ui(e,t,n,r){return t-e>=n-r*2?{min:-e,max:n-t}:{min:r-e,max:n-r-t}}function di(e,t,n,r){return t-e>=n-r*2?-e:e<r?r-e:t>n-r?n-r-t:0}function fi(e,t,n){return Math.min(Math.max(e,Math.min(t,n)),Math.max(t,n))}function pi({as:e=`span`,title:t,children:n,...r}){let i=Ut(t);return P(e,{...r,ref:i},n)}var mi=class{options;active=new Set;warmUntil=0;constructor(e={}){this.options=e}getDelay(){return this.active.size||Date.now()<this.warmUntil?0:Math.max(0,this.options.delay??600)}opened(e){this.active.add(e)}closed(e){this.active.delete(e)&&(this.warmUntil=Date.now()+Math.max(0,this.options.skipDelayDuration??400))}},hi=e=>new mi(e),gi=new WeakMap,_i=class{document;environment;active;constructor(e,t={}){this.document=e,this.environment=t}get isOpen(){return!!this.active}open(e){this.close();let t=this.document,n=t.activeElement,r=!1,i,a,o=gi.get(t)??[];gi.set(t,o);let s=()=>{if(r)return;r=!0,i?.(),a?.(),gt(c.root);let t=o.indexOf(c.root),s=t===o.length-1;t!==-1&&o.splice(t,1),this.active?.root===c.root&&(this.active=void 0);try{e.onClose?.()}finally{s&&(this.environment.restoreFocus?this.environment.restoreFocus(e.returnFocus,n??void 0):[e.returnFocus,n].find(e=>e?.isConnected)?.focus?.({preventScroll:!0}))}},c=ei(t,e,s),l={...c,close:s};return this.environment.beforeMount?.(c.root),a=It(e.returnFocus??n,c.root),c.root.addEventListener(`mousedown`,e=>{e.target===c.root&&o.at(-1)===c.root&&s()}),c.root.addEventListener(`keydown`,e=>{o.at(-1)===c.root&&(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),s()):e.key===`Tab`&&ai(c.root,e))}),t.body.append(c.root),o.push(c.root),e.draggable!==!1&&(i=ci({target:c.surface,handle:c.header})),this.active=l,this.environment.onOpen?.(e),queueMicrotask(()=>{!r&&o.at(-1)===c.root&&(oi(c.root)[0]??c.root).focus({preventScroll:!0})}),l}close(e){(!e||this.active?.root===e)&&this.active?.close()}destroy(){this.close()}};function vi(e,t=()=>{},n={}){let r=r=>{let i=Array.from(e.querySelectorAll(`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`)).filter(t=>t.closest(`[role="menu"]`)===e&&t.getAttribute(`aria-disabled`)!==`true`&&!t.hasAttribute(`disabled`)&&!t.hidden),a=i.indexOf(e.ownerDocument.activeElement);[`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(r.key)&&i.length?(r.preventDefault(),r.stopPropagation(),i[r.key===`Home`?0:r.key===`End`?i.length-1:(a+(r.key===`ArrowUp`?-1:1)+i.length)%i.length]?.focus()):r.key===`Escape`&&n.closeOnEscape!==!1&&(r.preventDefault(),r.stopPropagation(),t())};return e.addEventListener(`keydown`,r),()=>e.removeEventListener(`keydown`,r)}function yi(e,t){let n=typeof t==`function`?t:()=>t,r=n().value,i=r,a=()=>{let e=n();return e.value!==i&&(i=e.value,r=e.value),e},o=()=>{},s=t=>{let n=a(),i=Math.min(n.max??1/0,Math.max(n.min??0,t));n.acceptValue?.(i)!==!1&&(r=i,e.setAttribute(`aria-valuenow`,String(r)),n.onChange(r))},c=n();e.setAttribute(`role`,`separator`),e.setAttribute(`aria-orientation`,`vertical`),e.setAttribute(`aria-label`,c.label),e.tabIndex=0,e.setAttribute(`aria-valuenow`,String(r)),c.min!==void 0&&e.setAttribute(`aria-valuemin`,String(c.min)),c.max!==void 0&&e.setAttribute(`aria-valuemax`,String(c.max));let l=e=>{let t=a(),n=t.direction===`rtl`?-1:1;e.key===`ArrowLeft`||e.key===`ArrowRight`?(e.preventDefault(),s(r+(e.key===`ArrowLeft`?-1:1)*n*(t.step??10))):e.key===`Home`&&t.min!==void 0?(e.preventDefault(),s(t.min)):e.key===`End`&&t.max!==void 0&&(e.preventDefault(),s(t.max))},u=t=>{if(t.button!==0)return;t.preventDefault(),o();let n=a().direction===`rtl`?-1:1;e.focus({preventScroll:!0});let i=t.clientX,c=r,l=e.ownerDocument,u=e=>{e.pointerId===t.pointerId&&s(c+(e.clientX-i)*n)},d=e=>{e.pointerId===t.pointerId&&o()};l.addEventListener(`pointermove`,u),l.addEventListener(`pointerup`,d),l.addEventListener(`pointercancel`,d);let f=()=>o();l.defaultView?.addEventListener(`blur`,f),o=()=>{l.removeEventListener(`pointermove`,u),l.removeEventListener(`pointerup`,d),l.removeEventListener(`pointercancel`,d),l.defaultView?.removeEventListener(`blur`,f)}};return e.addEventListener(`keydown`,l),e.addEventListener(`pointerdown`,u),()=>{o(),e.removeEventListener(`keydown`,l),e.removeEventListener(`pointerdown`,u)}}function bi(e,t=0,n=100){let r=xi(t,0),i=xi(n,100),a=Math.min(r,i),o=Math.max(r,i),s=xi(e,a);return{min:a,max:o,percent:a===o?s>=o?100:0:(Math.min(o,Math.max(a,s))-a)/(o-a)*100}}function xi(e,t){let n=Number(e);return Number.isFinite(n)?n:t}function Si({variant:e=`solid`,shape:t=`pill`}={}){return`rv-badge rv-badge--inline rv-badge--${e} rv-badge--${t}`}function Ci({children:e,className:t=``,variant:n,shape:r}){return z(`span`,{class:`${Si({variant:n,shape:r})} ${t}`,children:e})}function wi(e,{children:t,tone:n=`neutral`,label:r,icon:i,title:a,description:o,actions:s,className:c=``,class:l=``,...u}){let d=(t,n,...r)=>e(t,n,r);return d(`div`,{...u,class:`rv-alert rv-alert--${n}${i?` rv-alert--with-icon`:``}${s?` rv-alert--with-actions`:``} ${c} ${l}`.trim(),role:n===`danger`?`alert`:`status`,"aria-label":r??u[`aria-label`]},i&&d(`span`,{class:`rv-alert__icon`,"aria-hidden":`true`},i),d(`div`,{class:`rv-alert__content`},a&&d(`div`,{class:`rv-alert__title`},a),o&&d(`div`,{class:`rv-alert__description`},o),t),s&&d(`div`,{class:`rv-alert__actions`},s))}function Ti(e){return wi(P,e)}var B=nr(nn(function({href:e,target:t,rel:n,rounded:r=!1,variant:i=`default`,size:a=`default`,className:o=``,class:s,...c},l){let u=Ut(e!==void 0&&typeof c.title==`string`?c.title:void 0),d=[i==="default"?`rv-btn`:`rv-btn-${i}`,a===`compact`?`rv-btn-sm`:``,r?`rv-btn-rounded`:``,s,o].filter(Boolean).join(` `);if(e!==void 0){let r=c.disabled||c.busy,{busy:i,disabled:a,title:o,...s}=c;return z(`a`,{...s,ref:u,href:r?void 0:e,target:t,rel:n,class:d,"aria-disabled":r||void 0,"aria-busy":i||void 0,tabIndex:r?-1:c.tabIndex,onClick:e=>{r?e.preventDefault():c.onClick?.(e)}})}return z(ur,{ref:l,rounded:r,type:`button`,...c,class:[i==="default"?`rv-btn`:`rv-btn-${i}`,a===`compact`?`rv-btn-sm`:``,s,o].filter(Boolean).join(` `)})}),`button`);function Ei({label:e,icon:t,badge:n,children:r,className:i=``,variant:a=`ghost`,size:o=`default`,...s}){return z(Mr,{...s,label:e,icon:t,badge:n,className:`rv-btn-icon ${a==="default"?`rv-btn`:`rv-btn-${a}`} ${o===`compact`?`rv-btn-sm`:``} ${i}`,children:r})}function Di({pressed:e,onPressedChange:t,...n}){return z(B,{...n,"aria-pressed":e,onClick:r=>{n.onClick?.(r),r.defaultPrevented||t(!e)}})}function Oi({children:e,className:t=``,label:n}){return z(`div`,{role:`group`,"aria-label":n,class:`rv-btn-group ${t}`,children:e})}function ki(e){return z(Pr,{...e,role:`radiogroup`})}function Ai(e){return z(Pr,{...e,role:`tablist`})}function ji({id:e,labelledBy:t,active:n,children:r}){return z(`div`,{id:e,role:`tabpanel`,"aria-labelledby":t,hidden:!n,children:r})}function Mi({className:e=``,value:t,options:n,onChange:r,label:i,disabled:a,name:o}){let[s]=I(()=>Rt(`rv-ui`));return z(`fieldset`,{class:`rv-radio-group ${e}`,disabled:a,children:[z(`legend`,{children:i}),n.map(e=>z(`label`,{children:[z(cr,{type:`radio`,name:o??s,checked:t===e.value,disabled:e.disabled,onChange:()=>r(e.value)}),e.label]},e.value))]})}function Ni({className:e=``,class:t,onValueChange:n,onInput:r,...i}){return z(cr,{type:`text`,...i,class:`rv-control ${t??``} ${e}`,onInput:e=>{r?.(e),e.defaultPrevented||n?.(e.currentTarget.value)}})}function Pi({className:e=``,class:t,onValueChange:n,onInput:r,...i}){return z(lr,{...i,class:`rv-control ${t??``} ${e}`,onInput:e=>{r?.(e),e.defaultPrevented||n?.(e.currentTarget.value)}})}function Fi({onValueChange:e,...t}){return z(Ni,{...t,type:`number`,onValueChange:t=>{t===``?e?.(void 0):Number.isFinite(Number(t))&&e?.(Number(t))}})}function Ii({value:e,min:t=-1/0,max:n=1/0,step:r=1,onChange:i,label:a,decreaseLabel:o,increaseLabel:s,disabled:c,readOnly:l}){let u=e=>{Number.isFinite(e)&&i(Math.max(t,Math.min(n,e)))};return z(`div`,{class:`rv-number-stepper`,role:`group`,"aria-label":a,children:[z(B,{disabled:c||l||e<=t,"aria-label":o,onClick:()=>u(e-r),children:`−`}),z(Fi,{"aria-label":a,value:e,min:Number.isFinite(t)?t:void 0,max:Number.isFinite(n)?n:void 0,step:r,disabled:c,readOnly:l,onValueChange:e=>{e!==void 0&&u(e)}}),z(B,{disabled:c||l||e>=n,"aria-label":s,onClick:()=>u(e+r),children:`+`})]})}function Li(e){return z(Ni,{...e,type:`date`})}function Ri(e){return z(Ni,{...e,type:`time`})}function zi(e){return z(Ni,{...e,type:`datetime-local`})}function Bi({children:e,className:t=``}){return z(`span`,{class:`rv-btn-pill ${t}`,children:e})}function Vi({children:e,id:t}){return z(`span`,{class:`rv-field__hint`,id:t,children:e})}function Hi({children:e,id:t}){return z(`span`,{class:`rv-field__error`,id:t,role:`alert`,children:e})}function Ui({children:e,title:t,description:n}){return z(`fieldset`,{class:`rv-form-section`,children:[t&&z(`legend`,{class:`rv-form-section__title`,children:t}),n&&z(`p`,{class:`rv-form-description`,children:n}),e]})}function Wi({children:e,className:t=``,summary:n,open:r,onToggle:i}){return z(`details`,{class:`rv-disclosure ${t}`.trim(),open:r,onToggle:i,children:[z(`summary`,{class:`rv-disclosure-summary`,children:n}),e]})}function Gi({children:e,className:t=``,label:n}){return z(`section`,{class:`rv-panel ${t}`,"aria-label":n,children:e})}function Ki({children:e,className:t=``,label:n}){return z(`div`,{class:`rv-toolbar ${t}`,role:`toolbar`,"aria-label":n,children:e})}function qi({children:e,className:t=``,label:n}){return z(`div`,{class:`rv-toolbar-group ${t}`,role:`group`,"aria-label":n,children:e})}function Ji(){return z(`span`,{class:`rv-toolbar-separator`,role:`separator`,"aria-orientation":`vertical`})}function Yi({count:e,label:t}){return z(`span`,{class:`rv-count`,role:`img`,"aria-label":t,children:e})}function Xi({label:e}){return Cr(P,{label:e,showSpinner:!0})}function Zi({busy:e,label:t,children:n}){return z(`div`,{class:`rv-loading-container`,"aria-busy":e,children:[n,e&&z(`div`,{class:`rv-loading-overlay`,children:z(Xi,{label:t})})]})}function Qi({title:e,description:t,children:n}){return z(`div`,{class:`rv-empty-state`,children:[z(`strong`,{children:e}),t&&z(`p`,{children:t}),n]})}function $i({children:e,label:t,onClose:n}){let r=R(null);return L(()=>r.current?vi(r.current,n):void 0,[n]),z(`div`,{ref:r,class:`rv-menu`,role:`menu`,"aria-label":t,children:e})}function ea({children:e,...t}){return z(B,{variant:`ghost`,...t,role:`menuitem`,children:e})}function ta(){return z(`div`,{role:`separator`,class:`rv-menu-separator`})}function na({label:e,children:t}){let[n,r]=I(!1),i=R(null),a=R(null),[o]=I(()=>Rt(`rv-ui`));L(()=>{n&&i.current?.querySelector(`[role="menu"]`)?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()},[n]);let s=()=>{r(!1),a.current?.focus()};return z(`div`,{ref:i,class:`rv-submenu`,onKeyDown:e=>{n&&(e.key===`ArrowLeft`||e.key===`Escape`)&&(e.preventDefault(),e.stopPropagation(),s())},children:[z(B,{ref:a,variant:`ghost`,role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-controls":o,onClick:()=>r(!n),onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),r(!0))},children:e}),n&&z(`div`,{id:o,children:z($i,{label:e,onClose:s,children:t})})]})}function ra(e){let t=R(null),n=R(e);return n.current=e,L(()=>t.current?yi(t.current,()=>n.current):void 0,[]),z(`div`,{class:`rv-resize-handle`,ref:t,role:`separator`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":e.label,"aria-valuenow":e.value,"aria-valuemin":e.min,"aria-valuemax":e.max})}function ia({page:e,pageCount:t,onChange:n,label:r,previousLabel:i,nextLabel:a,firstLabel:o=`First page`,lastLabel:s=`Last page`,variant:c=`compact`,disabled:l=!1,navigation:u=!0,boundaryButtons:d=!1,buttons:f,children:p,className:m=``}){let h=Number.isFinite(t)?Math.max(0,Math.floor(t)):0,g=Math.min(Math.max(0,Math.floor(e)||0),Math.max(0,h-1)),_=(e,t)=>{let r=f?.[e];if(r===!1)return null;let i=e===`first`?0:e===`last`?h-1:g+(e===`previous`?-1:1),a=l||!!r?.disabled||!h||i<0||i>=h||i===g;return z(Ei,{...r,label:t,icon:Sr[e],size:`compact`,className:`rv-pagination-button rv-pagination-button--icon ${r?.className??``}`,disabled:a,onClick:()=>{a||n(i)}})};return z(`nav`,{class:`rv-pagination ${c===`numbered`?`rv-pagination--numbered`:``} ${m}`,"aria-label":r,children:[u&&d&&_(`first`,o),u&&_(`previous`,i),p,c===`numbered`?z(F,{children:[z(`span`,{class:`rv-pagination-pages ${h<=5?`rv-pagination-pages--compact`:``}`,children:gr(g,h,3).map((e,t)=>e===`ellipsis`?z(`span`,{class:`rv-pagination-ellipsis`,"aria-hidden":`true`,children:`…`},`gap-${t}`):_r(P,{text:String(e+1),label:`${e+1}`,active:e===g,disabled:l,onClick:()=>{!l&&e!==g&&n(e)}}))}),h>5&&z(`span`,{class:`rv-pagination-summary rv-pagination-summary--responsive`,"aria-live":`polite`,children:[h?g+1:0,` / `,h]})]}):c===`compact`?z(`span`,{class:`rv-pagination-summary`,"aria-live":`polite`,children:[h?g+1:0,` / `,h]}):null,u&&_(`next`,a),u&&d&&_(`last`,s)]})}function aa({value:e,min:t=0,max:n=100,label:r}){let i=bi(e,t,n);return z(`svg`,{viewBox:`0 0 36 36`,class:`rv-circular-progress`,role:`progressbar`,"aria-label":r,"aria-valuemin":i.min,"aria-valuemax":i.max,"aria-valuenow":i.min+(i.max-i.min)*i.percent/100,children:[z(`circle`,{cx:`18`,cy:`18`,r:`16`,fill:`none`,stroke:`currentColor`,opacity:`0.15`}),z(`circle`,{cx:`18`,cy:`18`,r:`16`,fill:`none`,stroke:`currentColor`,pathLength:`100`,"stroke-dasharray":`${i.percent} 100`,transform:`rotate(-90 18 18)`})]})}function oa({value:e,max:t=5,label:n,onChange:r,disabled:i}){let a=Array.from({length:Math.max(0,Math.min(100,Math.floor(t)))},(e,t)=>t+1);return r?z(Mi,{className:`rv-rating`,label:n,value:e,disabled:i,options:a.map(t=>({value:t,label:z(F,{children:[z(fr,{filled:t<=e}),z(`span`,{class:`rv-visually-hidden`,children:t})]})})),onChange:r}):z(`span`,{class:`rv-rating`,role:`img`,"aria-label":`${n}: ${e} / ${t}`,children:a.map(t=>z(fr,{filled:t<=e}))})}nr(Ni,`input`),nr(Fi,`input`),nr(Li,`input`),nr(Ri,`input`),nr(zi,`input`),nr(Pi,`textarea`);var sa=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zM374 145.7c-10.7-7.8-25.7-5.4-33.5 5.3L221.1 315.2 169 263.1c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l72 72c5 5 11.8 7.5 18.8 7s13.4-4.1 17.5-9.8L379.3 179.2c7.8-10.7 5.4-25.7-5.3-33.5z"/></svg>`,ca=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM167 167c9.4-9.4 24.6-9.4 33.9 0l55 55 55-55c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-55 55 55 55c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-55-55-55 55c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l55-55-55-55c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>`,la=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M464 256a208 208 0 1 1 -416 0 208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0 256 256 0 1 0 -512 0zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"/></svg>`,ua=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM192 160l128 0c17.7 0 32 14.3 32 32l0 128c0 17.7-14.3 32-32 32l-128 0c-17.7 0-32-14.3-32-32l0-128c0-17.7 14.3-32 32-32z"/></svg>`;function da(e){if(!Array.isArray(e))return[];let t=e.slice(-20).filter(e=>typeof e==`string`&&!!e.trim()&&e.length<=4e3).map(e=>e.trim()).filter((e,t,n)=>!t||e!==n[t-1]),n=[];for(let e=t.length-1;e>=0;e--)new TextEncoder().encode(JSON.stringify([t[e],...n])).byteLength<=8192&&n.unshift(t[e]);return n}var fa=class{state;reset(){this.state=void 0}move(e,t,n){let r=JSON.stringify(n);if(this.state&&(this.state.selected!==e||this.state.key!==r)&&this.reset(),!n.length||!this.state&&t===`down`)return;this.state||={index:n.length,draft:e,selected:e,key:r};let i=this.state.index+(t===`up`?-1:1);if(i>=n.length){let e=this.state.draft;return this.reset(),e}return this.state.index=Math.max(0,i),this.state.selected=n[this.state.index],this.state.selected}},pa=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M214.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 109.3 160 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-370.7 105.4 105.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>`,ma=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32z"/></svg>`;function ha({translations:e,value:t,onValueChange:n,onSubmit:r,onStop:i,busy:a=!1,disabled:o=!1,label:s=`Ask AI to change this view`,placeholder:c=`Filter or sort your data…`,submitLabel:l=`Send`,stopLabel:u=`Stop`,promptHistory:d,hint:f=``,actions:p,footer:m,textareaProps:h}){let g=ct(e),_=R(Rt(`ai-prompt`)),v=R(!1),y=R(new fa),b=R();L(()=>{if(!b.current)return;let{element:e,position:t}=b.current;e.setSelectionRange(t,t),b.current=void 0});let x=`${_.current}-hint`,S=!!f&&!t.length,C=a&&!!i,w=()=>{!o&&!a&&t.trim()&&r(t.trim())};return z(`form`,{class:`rv-ai-prompt`,"aria-busy":a||void 0,onSubmit:e=>{e.preventDefault(),w()},children:[z(`label`,{for:_.current,class:`rv-ai-prompt-label rv-visually-hidden`,children:g(s)}),z(`div`,{class:`rv-ai-prompt-composer`,children:[z(Pi,{rows:1,...h,id:_.current,"aria-describedby":S?x:void 0,value:t,onValueChange:e=>{y.current.reset(),b.current=void 0,n(e)},placeholder:g(c),disabled:o||a,maxLength:4e3,onCompositionStart:()=>{v.current=!0},onCompositionEnd:()=>{v.current=!1},onKeyDown:e=>{let r=e.currentTarget;if(d&&!a&&!o&&!v.current&&!e.isComposing&&e.keyCode!==229&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&r.selectionStart===r.selectionEnd&&(e.key===`ArrowUp`&&!t.slice(0,r.selectionStart).includes(`
46
+ `)||e.key===`ArrowDown`&&!t.slice(r.selectionEnd).includes(`
47
+ `))){let i=y.current.move(t,e.key===`ArrowUp`?`up`:`down`,da(d));if(i!==void 0){if(e.preventDefault(),i===t)return;b.current={element:r,position:i.length},n(i);return}}e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&!v.current&&e.keyCode!==229&&(e.preventDefault(),w())}}),m&&z(`div`,{class:`rv-ai-prompt-footer`,children:m}),z(`div`,{class:`rv-ai-prompt-toolbar`,children:[z(`div`,{class:`rv-ai-prompt-tools`,children:[p,S&&z(`span`,{id:x,class:`rv-ai-prompt-hint`,children:g(f)})]}),z(Ei,{className:`rv-ai-prompt-submit`,type:C?`button`:`submit`,label:g(C?u:l),icon:C?ma:pa,onClick:C?e=>{e.preventDefault(),i?.()}:void 0,disabled:o||!C&&!t.trim(),busy:a&&!C,variant:`solid`,size:`compact`})]})]})]})}function ga({translations:e,items:t,onSelect:n,disabled:r,label:i=`Suggested requests`,maxVisible:a=2}){let o=ct(e);if(!t.length)return null;let s=Number.isFinite(a)?Math.max(0,Math.floor(a)):2,c=t.map(e=>typeof e==`string`?{label:e,prompt:e}:e);return z(`div`,{class:`rv-ai-suggestions`,role:`group`,"aria-label":o(i),children:[c.slice(0,s).map((e,t)=>z(B,{className:`rv-ai-suggestion`,size:`compact`,disabled:r,onClick:()=>n(e.prompt),children:e.label},`${t}:${e.prompt}`)),c.length>s&&z(Gn,{className:`rv-ai-examples`,source:c.slice(s).map(e=>({value:e.prompt,label:e.label})),disabled:r,placeholder:o(`More`),renderSelectedValue:()=>z(Kt,{svg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M0 256a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm168 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm224-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"/></svg>`,size:14}),config:{ariaLabel:o(`More`),search:!0,searchPlaceholder:o(`Search requests`),searchAriaLabel:o(`Search requests`),popupClassName:`rv-ai-examples-menu`,maxHeight:480},onChange:e=>{typeof e==`string`&&n(e)}})]})}function _a({translations:e,phase:t,message:n}){let r=ct(e);return z(`div`,{class:`rv-ai-status`,"data-state":t,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[(t===`understanding`||t===`applying`)&&z(`span`,{"aria-hidden":`true`,children:z(Xi,{label:``})}),z(`span`,{children:r(n)})]})}function va({translations:e,summary:t,matchedRows:n,countLabel:r,actions:i,children:a}){let o=ct(e);return z(`div`,{class:`rv-ai-result`,role:`status`,"aria-live":`polite`,children:[z(`p`,{class:`rv-ai-result-summary`,children:t}),n!==void 0&&z(`p`,{class:`rv-ai-result-count`,children:r?r(n):o(`{count} matching rows`,{count:n.toLocaleString()})}),a,i&&z(`div`,{class:`rv-ai-result-actions`,children:i})]})}function ya({layout:e=`flow`,translations:t={},label:n=`AI view assistant`,children:r,footer:i,busy:a}){return z(st,{translations:t,children:z(`section`,{class:`rv-ai-assistant${e===`fill`?` rv-ai-assistant--fill`:``}`,"aria-label":(e=>it(e,t))(n),"aria-busy":a||void 0,onKeyDown:e=>e.stopPropagation(),onKeyUp:e=>e.stopPropagation(),children:[r,i&&z(`div`,{class:`rv-ai-assistant-footer`,children:i})]})})}function ba({translations:e,summary:t,details:n,changes:r,notice:i,disabled:a,onApply:o,onCancel:s}){let c=ct(e),l=R(null);return Ke(()=>{l.current?.focus()},[]),z(`section`,{class:`rv-ai-change-preview`,"aria-label":c(`Review changes`),onKeyDown:e=>{e.key===`Escape`&&!a&&(e.preventDefault(),s())},children:z(va,{summary:t,actions:z(F,{children:[z(B,{ref:l,disabled:a,onClick:o,children:c(`Apply changes`)}),z(B,{disabled:a,variant:`ghost`,onClick:s,children:c(`Cancel changes`)})]}),children:[i&&z(`p`,{class:`rv-ai-preview-notice`,children:i}),r?.length?z(`div`,{class:`rv-ai-preview-changes`,role:`region`,"aria-label":c(`Proposed changes`),tabIndex:0,children:z(`table`,{children:[z(`thead`,{children:z(`tr`,{children:[z(`th`,{scope:`col`,children:c(`Change`)}),z(`th`,{scope:`col`,children:c(`Current`)}),z(`th`,{scope:`col`,children:c(`Proposed`)})]})}),z(`tbody`,{children:r.map((e,t)=>z(`tr`,{children:[z(`th`,{scope:`row`,children:[e.item&&z(`span`,{class:`rv-ai-preview-item`,children:e.item}),e.label]}),z(`td`,{children:e.before??`—`}),z(`td`,{children:e.after??`—`})]},t))})]})}):n&&z(`pre`,{class:`rv-ai-result-details`,children:n})]})})}function xa({children:e,className:t=``,label:n=`AI chat`,style:r,translations:i}){let a=ct(i);return z(`section`,{class:`rv-ai-chat ${t}`,"aria-label":a(n),style:r,children:e})}function Sa({children:e,className:t=``,autoScroll:n=!0,busy:r=!1,label:i=`Conversation messages`,jumpLabel:a=`Jump to latest`,translations:o}){let s=ct(o),c=R(null),l=R(null),u=R(n),[d,f]=I(!1),p=()=>{let e=c.current;if(!e)return;let t=e.scrollHeight-e.clientHeight-e.scrollTop<=40;u.current=t,f(!t)},m=()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight,u.current=!0,f(!1))},h=()=>{if(n&&u.current)m();else{let e=c.current;e&&f(e.scrollHeight-e.clientHeight-e.scrollTop>40)}};return L(h,[e,n]),Ke(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(h);return c.current&&e.observe(c.current),l.current&&e.observe(l.current),()=>e.disconnect()},[n]),z(`div`,{class:`rv-ai-chat-scroll ${t}`,children:[z(`div`,{ref:c,class:`rv-ai-chat-viewport`,role:`log`,"aria-label":s(i),"aria-live":`polite`,"aria-relevant":`additions text`,"aria-busy":r||void 0,tabIndex:0,onScroll:p,children:z(`div`,{ref:l,class:`rv-ai-chat-content`,children:e})}),d&&z(Ei,{className:`rv-ai-chat-jump`,label:s(a),icon:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M169.4 502.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 402.7 224 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 370.7-105.4-105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"/></svg>`,variant:`default`,size:`compact`,onClick:m})]})}function Ca({title:e=`Start a conversation`,description:t=`Ask a question to get started.`,children:n,className:r=``,translations:i,renderContent:a}){let o=ct(i),s=R(null);return L(()=>{let e=s.current;if(!e||!a)return;let t=a(e);return()=>{t?.(),e.replaceChildren()}},[a]),z(`div`,{class:`rv-ai-chat-empty ${r}`,children:[e&&z(`strong`,{children:o(e)}),t&&z(`p`,{children:o(t)}),n,a&&z(`div`,{ref:s,class:`rv-ai-chat-empty-slot`})]})}function wa(e){return z(`div`,{class:`rv-ai-chat-composer`,children:z(ha,{label:`Message`,placeholder:`Type a message…`,...e})})}function Ta({from:e,label:t,isStreaming:n=!1,children:r,className:i=``,translations:a}){let o=ct(a);return z(`article`,{class:`rv-ai-message rv-ai-message--${e} ${i}`,"aria-label":o(t??{user:`You`,assistant:`Assistant`,system:`System`}[e]),"aria-busy":n||void 0,"data-streaming":n||void 0,children:r})}function Ea({children:e,className:t=``}){return z(`div`,{class:`rv-ai-message-content ${t}`,children:e})}function Da({children:e,className:t=``,label:n=`Message actions`,translations:r}){let i=ct(r);return z(`div`,{class:`rv-ai-message-actions ${t}`,role:`group`,"aria-label":i(n),children:e})}var Oa={pending:`Pending`,running:`Running`,completed:`Completed`,error:`Failed`,cancelled:`Cancelled`};function ka({status:e}){return z(`span`,{class:`rv-ai-task-icon`,"data-status":e,"aria-hidden":`true`,children:e===`running`?z(Xi,{label:``}):z(Kt,{svg:e===`completed`?sa:e===`error`?ca:e===`cancelled`?ua:la})})}function Aa({title:e,status:t=`completed`,open:n,defaultOpen:r,onOpenChange:i,children:a,className:o=``,translations:s}){let c=ct(s),[l,u]=I(r),d=n??l??t===`running`,f=R({expanded:d,open:n,onOpenChange:i});f.current={expanded:d,open:n,onOpenChange:i};let p=me(a).some(e=>typeof e!=`string`||e.trim().length>0),m=z(`span`,{class:`rv-ai-trace-heading`,children:[z(ka,{status:t}),z(`span`,{children:e}),z(`span`,{class:`rv-visually-hidden`,children:c(Oa[t])}),p&&z(`span`,{class:`rv-ai-trace-chevron`,"aria-hidden":`true`,children:z(Kt,{svg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/></svg>`,size:8})})]});return p?z(Wi,{className:`rv-ai-trace ${o}`,open:d,onToggle:e=>{let t=e.currentTarget.open,n=f.current;t!==n.expanded&&(n.open===void 0?u(t):e.currentTarget.open=n.expanded,n.onOpenChange?.(t))},summary:m,children:z(`div`,{class:`rv-ai-trace-content`,children:a})}):z(`div`,{class:`rv-ai-trace rv-ai-trace-line ${o}`,children:m})}function ja(e){return z(Aa,{...e})}function Ma({status:e=`completed`,children:t,className:n=``,translations:r}){let i=ct(r);return z(`div`,{class:`rv-ai-task-item ${n}`,children:[z(ka,{status:e}),z(`span`,{class:`rv-visually-hidden`,children:[i(Oa[e]),`: `]}),z(`div`,{children:t})]})}function Na({title:e,isStreaming:t=!1,duration:n,children:r,translations:i,...a}){let o=ct(i),s=typeof n==`number`&&Number.isFinite(n)&&n>=0?` · ${o(`{seconds}s`,{seconds:Math.round(n)})}`:``;return z(Aa,{...a,translations:i,status:t?`running`:`completed`,title:`${o(e??(t?`Working…`:`Reasoning summary`))}${s}`,children:r})}var Pa=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M488 192l-144 0c-9.7 0-18.5-5.8-22.2-14.8s-1.7-19.3 5.2-26.2l46.7-46.7c-75.3-58.6-184.3-53.3-253.5 15.9-75 75-75 196.5 0 271.5s196.5 75 271.5 0c8.2-8.2 15.5-16.9 21.9-26.1 10.1-14.5 30.1-18 44.6-7.9s18 30.1 7.9 44.6c-8.5 12.2-18.2 23.8-29.1 34.7-100 100-262.1 100-362 0S-25 175 75 75c94.3-94.3 243.7-99.6 344.3-16.2L471 7c6.9-6.9 17.2-8.9 26.2-5.2S512 14.3 512 24l0 144c0 13.3-10.7 24-24 24z"/></svg>`;function Fa({onUndo:e,onRedo:t,canUndo:n,canRedo:r,undoLabel:i=`Undo`,redoLabel:a=`Redo`,label:o=`History`,undoCount:s,redoCount:c}){return z(`div`,{class:`rv-history-controls`,role:`group`,"aria-label":o,children:[e&&z(Mr,{icon:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M24 192l144 0c9.7 0 18.5-5.8 22.2-14.8s1.7-19.3-5.2-26.2l-46.7-46.7c75.3-58.6 184.3-53.3 253.5 15.9 75 75 75 196.5 0 271.5s-196.5 75-271.5 0c-10.2-10.2-19-21.3-26.4-33-9.5-14.9-29.3-19.3-44.2-9.8s-19.3 29.3-9.8 44.2C49.7 408.7 61.4 423.5 75 437 175 537 337 537 437 437S537 175 437 75C342.8-19.3 193.3-24.7 92.7 58.8L41 7C34.1 .2 23.8-1.9 14.8 1.8S0 14.3 0 24L0 168c0 13.3 10.7 24 24 24z"/></svg>`,label:i,badge:s,disabled:!n,onClick:e}),t&&z(Mr,{icon:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M488 192l-144 0c-9.7 0-18.5-5.8-22.2-14.8s-1.7-19.3 5.2-26.2l46.7-46.7c-75.3-58.6-184.3-53.3-253.5 15.9-75 75-75 196.5 0 271.5s196.5 75 271.5 0c8.2-8.2 15.5-16.9 21.9-26.1 10.1-14.5 30.1-18 44.6-7.9s18 30.1 7.9 44.6c-8.5 12.2-18.2 23.8-29.1 34.7-100 100-262.1 100-362 0S-25 175 75 75c94.3-94.3 243.7-99.6 344.3-16.2L471 7c6.9-6.9 17.2-8.9 26.2-5.2S512 14.3 512 24l0 144c0 13.3-10.7 24-24 24z"/></svg>`,label:a,badge:c,disabled:!r,onClick:t})]})}var Ia=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M201.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L224 173.3 54.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"/></svg>`,La=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"/></svg>`,Ra=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-464a208 208 0 1 0 0 416 208 208 0 1 0 0-416zm70.7 121.9c7.8-10.7 22.8-13.1 33.5-5.3 10.7 7.8 13.1 22.8 5.3 33.5L243.4 366.1c-4.1 5.7-10.5 9.3-17.5 9.8-7 .5-13.9-2-18.8-6.9l-55.9-55.9c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l36 36 105.6-145.2z"/></svg>`,za=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M222.7 32.1c5 16.9-4.6 34.8-21.5 39.8-79.3 23.6-137.1 97.1-137.1 184.1 0 106 86 192 192 192s192-86 192-192c0-86.9-57.8-160.4-137.1-184.1-16.9-5-26.6-22.9-21.5-39.8s22.9-26.6 39.8-21.5C434.9 42.1 512 140 512 256 512 397.4 397.4 512 256 512S0 397.4 0 256c0-116 77.1-213.9 182.9-245.4 16.9-5 34.8 4.6 39.8 21.5z"/></svg>`;function Ba(e,t,n){let r=n?za:t===`success`?Ra:t===`warning`||t===`danger`?La:void 0;return r?e(`span`,{class:`rv-status-feedback__icon${n?` rv-status-feedback__icon--busy`:``}`,"aria-hidden":`true`,"data-tone":t,innerHTML:r}):null}function Va(e){let t=e.some(e=>e.tone===`danger`)?`danger`:e.some(e=>e.tone===`warning`)?`warning`:`neutral`;return{tone:t,busy:t===`neutral`&&e.some(e=>e.busy)}}function Ha(e,t,n,r,i){let{title:a,items:o,localeText:s,popover:c}=t,l=n?t.expandLabel??s?.expand??`Expand activity`:t.collapseLabel??s?.collapse??`Collapse activity`,u=Va(o);return e(`div`,{class:`rv-status-feedback__header`,"aria-live":n?`polite`:void 0,"aria-atomic":n?`true`:void 0},[n?Ba(e,u.tone,u.busy):null,e(`h3`,{class:`rv-status-feedback__heading`},a),e(`span`,{class:`rv-count rv-status-feedback__count`,"aria-label":s?.countLabel?.(o.length),"aria-hidden":!n&&!s?.countLabel?`true`:void 0},s?.formatCount?.(o.length)??String(o.length)),r?e(`button`,{type:`button`,class:`rv-btn-ghost rv-status-feedback__toggle`,"aria-label":l,title:l,"aria-expanded":String(!n),"aria-controls":c?`${c.id}-items`:void 0,onClick:e=>{e.stopPropagation(),i(!n,e)}},e(`span`,{class:`rv-status-feedback__icon`,"aria-hidden":`true`,innerHTML:n?Ia:Bn})):null,t.onClose?e(`button`,{type:`button`,class:`rv-btn-ghost rv-status-feedback__close`,"aria-label":t.closeLabel??`Close activity`,title:t.closeLabel??`Close activity`,onClick:e=>{e.stopPropagation(),t.onClose?.()}},e(`span`,{class:`rv-status-feedback__icon`,"aria-hidden":`true`,innerHTML:Wr})):null])}function Ua(e,t){let n=t.tone??`neutral`,r=t.actions??[];return e(`div`,{...t.data,key:t.id,class:[`rv-status-feedback__item`,r.length>1?`rv-status-feedback__item--multiple-actions`:``,t.className].filter(Boolean).join(` `),"data-tone":n,role:n===`warning`||n===`danger`?`alert`:`status`,"aria-atomic":`true`},[Ba(e,n,!!t.busy),e(`div`,{class:`rv-status-feedback__copy`},[e(`div`,{class:`rv-status-feedback__title`},t.title),t.description?e(`div`,{class:`rv-status-feedback__description`},t.description):null,t.detail?e(`div`,{class:`rv-status-feedback__detail`},t.detail):null]),r.length?e(`div`,{class:`rv-status-feedback__actions`},r.map(t=>e(`button`,{key:t.id,type:`button`,disabled:t.disabled,class:`${t.appearance===`primary`?`rv-btn-solid`:t.appearance===`ghost`?`rv-btn-ghost`:`rv-btn`} rv-status-feedback__action`,"aria-label":t.ariaLabel,onClick:e=>{e.stopPropagation(),t.disabled||t.onClick(e)}},t.label))):null])}function Wa(e,{label:t,tone:n=`neutral`,busy:r=!1,className:i}){return e(`span`,{class:[`rv-status-badge`,i].filter(Boolean).join(` `),"data-tone":n},[Ba(e,n,r),e(`span`,{},t)])}function Ga(e,t=0,n){let[r,i]=I(new Set),a=R(n);a.current=n;let o=R(new Map);return Ke(()=>{for(let[r,a]of o.current)(!n||t<=0||!e.includes(a.item)||a.duration!==t)&&(clearTimeout(a.timer),o.current.delete(r),i(e=>new Set([...e].filter(e=>e!==r))));if(!(!n||t<=0))for(let n of e){if(n.busy||n.tone===`warning`||n.tone===`danger`||o.current.has(n.id))continue;let e={item:n,duration:t,timer:setTimeout(()=>{i(e=>new Set([...e,n.id])),e.timer=setTimeout(()=>a.current?.(n.id),160)},t)};o.current.set(n.id,e)}},[e,t,!!n]),Ke(()=>()=>{for(let e of o.current.values())clearTimeout(e.timer);o.current.clear()},[]),e.map(e=>r.has(e.id)?{...e,data:{...e.data,"data-exiting":`true`}}:e)}function Ka(e,t){let{title:n,items:r,ariaLabel:i,className:a,popover:o,onCollapsedChange:s}=t;if(!r.length)return o?.hide(!0),null;let c=o?.collapsed??t.collapsed??!1,l=!!(o||s),u=(e,t)=>{if(e&&!o){let e=t.currentTarget.closest(`.rv-status-feedback`),n=e?.ownerDocument.activeElement;n&&e?.contains(n)&&e.querySelector(`.rv-status-feedback__toggle`)?.focus({preventScroll:!0})}o?.setCollapsed(e),s?.(e)};return o?.refresh(),e(`section`,{onKeyDown:e=>{e.key===`Escape`&&l&&!c&&(e.preventDefault(),e.stopPropagation(),u(!0,e))},ref:o?.panelRef,id:o?.id,class:[`rv-status-feedback`,a,t.compact?`rv-status-feedback--compact`:``,o?`rv-status-feedback--popover`:``,c?`rv-status-feedback--collapsed`:``].filter(Boolean).join(` `),"aria-label":i??n,"data-collapsed":String(c)},[Ha(e,t,c,l,u),e(`div`,{id:o?`${o.id}-items`:void 0,class:`rv-status-feedback__items`,hidden:c},r.map(t=>Ua(e,t)))])}function qa(e){let t=Ga(e.items,e.autoDismissMs,e.onDismissItem);return Ka(P,{...e,items:t})}function Ja(e){return Wa(P,e)}var Ya=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M288 64c106 0 192 86 192 192S394 448 288 448c-65.2 0-122.9-32.5-157.6-82.3-10.1-14.5-30.1-18-44.6-7.9s-18 30.1-7.9 44.6C124.1 468.6 201 512 288 512 429.4 512 544 397.4 544 256S429.4 0 288 0C202.3 0 126.5 42.1 80 106.7L80 80c0-17.7-14.3-32-32-32S16 62.3 16 80l0 112c0 17.7 14.3 32 32 32l24.6 0c.5 0 1 0 1.5 0l86 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-38.3 0C154.9 102.6 217 64 288 64zm24 88c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 104c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65 0-94.1z"/></svg>`;function Xa({translations:e,items:t,onRemove:n,onClear:r,onEmpty:i,footer:a,showClear:o=!0,disabled:s,removalsDisabled:c,label:l=`Request history`,triggerLabel:u,clearLabel:d=`Clear all`,clearDescription:f,removeLabel:p,countLabel:m,changedMessage:h}){let g=ct(e),_=m??(e=>g(e===1?`{count} applied request`:`{count} applied requests`,{count:e})),v=p??(e=>g(`Remove request: {label}`,{label:e.label})),y=R(null),b=R(null),x=R(null),[S]=I(()=>Rt(`rv-ai-steps`)),[C,w]=I(!1),T=t.length>0;L(()=>{if(T||w(!1),!C||!T||!y.current||!b.current||!x.current)return;let e=x.current,t=new Bt,n=!0;return t.open({anchor:b.current,content:e,appendTo:y.current,onClose:()=>{n&&w(!1)}}),e.focus({preventScroll:!0}),()=>{n=!1,t.destroy(),e.hidden=!0}},[C,T]);let E=R();if(L(()=>{let e=E.current;if(!e)return;if(s){e.sawBusy=!0;return}if(e.id?t.some(t=>t.id===e.id):t.length>0){(e.sawBusy||e.id&&c)&&(E.current=void 0);return}E.current=void 0;let n=e.button.ownerDocument.activeElement;if(n!==e.button&&n!==e.button.ownerDocument.body)return;let r=y.current?.querySelectorAll(`.rv-remove-button`);r?.length&&C?r[Math.min(e.index,r.length-1)]?.focus():t.length?C&&b.current?.focus():i?.()},[t,i,s,c,C]),!T)return null;let D=0,O=t.reduce((e,t)=>e+(t.count??1),0);return z(`div`,{class:`rv-ai-request-trail`,role:`group`,"aria-label":g(l),ref:y,onFocusOut:e=>{e.relatedTarget instanceof Node&&!e.currentTarget.contains(e.relatedTarget)&&w(!1)},children:[z(B,{ref:b,className:`rv-ai-trail-trigger rv-btn-icon`,variant:`ghost`,size:`compact`,disabled:s,"aria-label":g(l),title:g(l),"aria-haspopup":`dialog`,"aria-expanded":C,"aria-controls":S,onClick:()=>w(e=>!e),children:u?u(O):z(Kt,{svg:Ya,size:16})}),z(`div`,{ref:x,id:S,class:`rv-popover rv-ai-trail-popover`,role:`dialog`,"aria-label":g(l),tabIndex:-1,hidden:!C,children:[z(`div`,{class:`rv-ai-trail-header`,children:z(`span`,{class:`rv-ai-trail-label`,children:g(l)})}),z(`ol`,{class:`rv-ai-trail-steps`,"aria-label":_(O),children:t.map((e,r)=>{let i=D+1;return D+=e.count??1,z(`li`,{class:`rv-ai-step`,"data-current":r===t.length-1||void 0,onFocusCapture:e=>e.currentTarget.scrollIntoView({block:`nearest`,inline:`nearest`}),children:z(`span`,{class:`rv-ai-step-chip`,children:[z(`span`,{class:`rv-ai-step-number`,"aria-hidden":`true`,children:i===D?i:`${i}–${D}`}),z(pi,{class:`rv-ai-step-label`,title:e.label,children:e.label}),e.removable!==!1&&z(zn,{compact:!0,disabled:s||c,locale:{title:v(e),ariaLabel:v(e)},onClick:t=>{t.preventDefault(),E.current={button:t.currentTarget,index:r,id:e.id},n(e.id)}})]})},e.id)})}),h&&z(`p`,{class:`rv-ai-trail-message`,children:g(h)}),z(`div`,{class:`rv-ai-trail-footer`,children:[a,o&&r&&z(B,{variant:`ghost`,size:`compact`,disabled:s,title:f?g(f):void 0,onClick:e=>{e.preventDefault(),E.current={button:e.currentTarget,index:0},r?.()},children:g(d)})]})]})]})}function Za(e,t){let n=e=>it(e,t.translations),r=!1,i=t.suggestions??[],a,o=da(t.promptHistory?.items??[]),s=new h,c=t.mode===`chat`,l=[],u=0,d=!1,f=``;function p(e){if(e.phase===`idle`||!e.message||e.pendingAction)return;let r=e.phase===`understanding`||e.phase===`applying`,i=JSON.stringify([e.phase,e.message,e.matchedRows,e.resultDetails]);if(i===f)return;let a=l.at(-1),o={id:d&&a?a.id:String(++u),title:e.message,busy:r,tone:e.phase===`error`?`danger`:e.phase===`completed`?`success`:`neutral`,description:e.phase===`completed`&&e.matchedRows!==void 0?t.countLabel?.(e.matchedRows)??n(`{count} matching rows`).replace(`{count}`,e.matchedRows.toLocaleString()):void 0,detail:e.phase===`completed`&&!e.result?e.resultDetails:void 0};l=[...d&&a?l.slice(0,-1):l,o].slice(-50),d=r,f=i}function m({state:r}){let[a,u]=I(``),[d,f]=I(o),[p,m]=I(!1),h=R();L(()=>{u(``),h.current=void 0},[r.chatKey]);let _=r.phase===`understanding`||r.phase===`applying`,v=!!r.pendingAction,y=r.steps??[],b=t.showRequestHistory??!c,x=R(!1);Ke(()=>{x.current&&!v&&!_&&e.querySelector(`textarea`)?.focus(),x.current=v||_&&x.current},[v,_]),Ke(()=>{if(_||v||r.phase===`idle`||h.current===void 0)return;let e=h.current;h.current=void 0,r.phase===`completed`&&u(t=>t.trim()===e?``:t)},[r]);let S=e=>{h.current=e.trim(),t.promptHistory&&(o=da([...o,e]),f(o),t.promptHistory.onChange?.([...o])),t.onSubmit(e)},C=z(ga,{maxVisible:t.maxVisibleSuggestions,items:r.choices?.length?r.choices:r.suggestions?.length?r.suggestions:i,onSelect:e=>{_||v||(u(e),S(e))},disabled:_||v}),w=(!!a||!!r.request||!!r.message||y.length>0||s.messages.length>0||l.length>0)&&(t.showNewConversation??t.showClearChat??!0)&&t.onClearChat&&z(Ei,{label:n(`New conversation`),icon:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L368 46.1 465.9 144 490.3 119.6c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L432 177.9 334.1 80 172.4 241.7zM96 64C43 64 0 107 0 160L0 416c0 53 43 96 96 96l256 0c53 0 96-43 96-96l0-96c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7-14.3 32-32 32L96 448c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L96 64z"/></svg>`,size:`compact`,disabled:_||v,onClick:()=>{t.onClearChat?.(),e.querySelector(`textarea`)?.focus()}}),T=c&&r.canClearChart&&t.onClearChart&&z(B,{size:`compact`,variant:`ghost`,disabled:_||v||r.viewSwitching,onClick:()=>{t.onClearChart?.(),e.querySelector(`textarea`)?.focus()},children:n(`Clear chart`)}),E=z(F,{children:[T,w]}),D=z(wa,{label:t.prompt?.label??`Ask AI to change this view`,...t.prompt,value:a,onValueChange:u,onSubmit:S,onStop:t.onStop,busy:_,promptHistory:t.promptHistory?d:void 0,disabled:v,hint:b&&y.length?``:t.prompt?.hint,footer:C,actions:b?z(Xa,{...t.trail,items:y,showClear:!1,onRemove:e=>t.onRemoveStep?.(e),onEmpty:()=>e.querySelector(`textarea`)?.focus(),disabled:_||v,removalsDisabled:!t.onRemoveStep||r.canEditSteps===!1,changedMessage:!_&&y.some(e=>e.removable!==!1)&&r.canEditSteps===!1?t.trail?.changedMessage??`The view changed manually. Start a new request to continue.`:void 0}):void 0}),O=r.pendingAction&&z(ba,{...r.pendingAction,disabled:_||!t.onApplyAction,onApply:()=>t.onApplyAction?.(),onCancel:()=>t.onCancelAction?.()}),k=z(`div`,{class:`rv-ai-result-actions`,children:(t.onUndoData||t.onRedoData)&&z(Fa,{onUndo:t.onUndoData,onRedo:t.onRedoData,canUndo:!_&&!v&&!!r.canUndoData,canRedo:!_&&!v&&!!r.canRedoData,undoLabel:n(`Undo data change`),redoLabel:n(`Redo data change`),label:n(`Data history`)})}),A=t.showHistoryControls===!1||!t.onUndoData&&!t.onRedoData?null:t.controlsMountTo?mn(k,t.controlsMountTo):k;return z(ya,{layout:t.layout,translations:t.translations,label:t.label,busy:_,footer:t.footer,children:c?z(xa,{className:`rv-ai-mounted-chat`,children:[(T||w)&&z(`div`,{class:`rv-ai-chat-actions`,children:E}),z(Sa,{busy:_,children:[!s.messages.length&&t.emptyState&&z(Ca,{...t.emptyState}),s.messages.map(e=>z(Ta,{from:e.from,isStreaming:e.phase===`understanding`||e.phase===`applying`,children:[e.from===`user`?z(Ea,{children:e.text}):e.phase===`preview`&&e.pending&&e.id===s.messages.at(-1)?.id&&r.pendingAction?null:z(Ea,{children:e.phase===`understanding`||e.phase===`applying`||e.phase===`error`||e.phase===`cancelled`?z(ja,{title:e.text,status:e.phase===`understanding`||e.phase===`applying`?`running`:e.phase===`error`?`error`:`cancelled`}):e.text}),e.result?z(pt,{result:e.result,renderTable:t.renderTable}):e.details&&z(`pre`,{class:`rv-ai-chat-result`,children:e.details}),e.id===s.messages.at(-1)?.id&&e.pending&&O]},e.id))]}),D,A]}):z(F,{children:[(T||w)&&z(`div`,{class:`rv-ai-chat-actions`,children:E}),D,O,r.phase===`completed`&&r.result&&z(pt,{result:r.result,renderTable:t.renderTable}),!!l.length&&z(qa,{className:`rv-ai-activity`,title:n(`Activity`),compact:!0,autoDismissMs:t.activityDurationMs,onDismissItem:e=>{l=l.filter(t=>t.id!==e),g()},collapsed:p,onCollapsedChange:m,collapseLabel:n(`Collapse activity`),expandLabel:n(`Expand activity`),items:l}),A]})})}let g=()=>{!r&&a&&De(z(m,{state:a}),e)};return{update(e){a&&a.chatKey!==e.chatKey&&(l=[],f=``,d=!1),c?s.update(e):p(e),a=e,g()},setSuggestions(e){i=[...e],g()},destroy(){r||(r=!0,o=[],s.clear(),De(null,e))}}}function Qa(e,t){return ht(e,z(`label`,{class:[`rv-field`,t.className].filter(Boolean).join(` `),children:[z(`span`,{class:`rv-field__label`,children:t.label}),z(`span`,{style:{display:`contents`},ref:e=>{e&&e.append(t.control)}}),t.hint&&z(`span`,{class:`rv-field__hint`,children:t.hint})]}))}function $a(e,t){return ht(e,z(cr,{type:`text`,placeholder:t}))}var V={black:`#000000`,hex0003:`#0003`,white:`#ffffff`,transparent:`transparent`,blue600:`#2563eb`,green600:`#16a34a`,red600:`#dc2626`,purple600:`#9333ea`,orange600:`#ea580c`,cyan600:`#0891b2`,rose700:`#be123c`,indigo600:`#4f46e5`,watermarkForeground:`white`,watermarkBackground:`rgba(166, 0, 0, 0.9)`,hex6647f0:`#6647f0`,hexfc6d2d:`#fc6d2d`,hex0091ff:`#0091ff`,hexff02f0:`#ff02f0`,hex00b8a6:`#00b8a6`,hexf5b700:`#f5b700`,hexe14b8d:`#e14b8d`,hex6c78f4:`#6c78f4`,hex171717:`#171717`,hex666666:`#666666`,hexe0e0e0:`#e0e0e0`,hex1b1b1f:`#1b1b1f`,hexf5f5f5:`#f5f5f5`,hexa3a3a3:`#a3a3a3`,hex404040:`#404040`,hex4285d4:`#4285d4`,hex60a5fa:`#60a5fa`,hexe8590c:`#e8590c`,hexfb923c:`#fb923c`,hex3f8f7d:`#3f8f7d`,hex475569:`#475569`,hex047857:`#047857`,hexb91c1c:`#b91c1c`,hexf8fafc:`#f8fafc`,hexcbd5e1:`#cbd5e1`,hexeff6ff:`#eff6ff`,hexbfdbfe:`#bfdbfe`,hexecfdf5:`#ecfdf5`,hexa7f3d0:`#a7f3d0`,hexfef2f2:`#fef2f2`,hexfecaca:`#fecaca`,rgba_148_163_184_0_14:`rgba(148, 163, 184, 0.14)`,rgba_148_163_184_0_36:`rgba(148, 163, 184, 0.36)`,rgba_37_99_235_0_18:`rgba(37, 99, 235, 0.18)`,rgba_96_165_250_0_42:`rgba(96, 165, 250, 0.42)`,hex93c5fd:`#93c5fd`,rgba_4_120_87_0_2:`rgba(4, 120, 87, 0.2)`,rgba_52_211_153_0_44:`rgba(52, 211, 153, 0.44)`,hex6ee7b7:`#6ee7b7`,rgba_185_28_28_0_2:`rgba(185, 28, 28, 0.2)`,rgba_248_113_113_0_44:`rgba(248, 113, 113, 0.44)`,hexfca5a5:`#fca5a5`,hex3b82f6:`#3b82f6`,rgba_255_255_255_0_75:`rgba(255, 255, 255, 0.75)`,rgba_255_255_255_0_88:`rgba(255, 255, 255, 0.88)`,rgba_15_23_42_0_16:`rgba(15, 23, 42, 0.16)`,rgba_15_23_42_0_42:`rgba(15, 23, 42, 0.42)`,rgba_15_23_42_0_72:`rgba(15, 23, 42, 0.72)`,hexfacc15:`#facc15`,hex0f172a:`#0f172a`,rgb_255_255_255:`rgb(255, 255, 255)`,blackKeyword:`black`,rgba_255_255_255_0_45:`rgba(255, 255, 255, 0.45)`,rgba_42_95_134_0_92:`rgba(42, 95, 134, 0.92)`,rgba_255_255_255_0_98:`rgba(255, 255, 255, 0.98)`,rgba_132_204_22_0_42:`rgba(132, 204, 22, 0.42)`,rgba_255_255_255_0_6:`rgba(255, 255, 255, 0.6)`,hexfff:`#fff`,hex17120a:`#17120a`,hex5be16b:`#5be16b`,rgba_0_0_0_0_1:`rgba(0, 0, 0, 0.1)`,hex329e16:`#329e16`,hex1f2d05:`#1f2d05`,hexff77d2:`#ff77d2`,hexdb3fa9:`#db3fa9`,hexf43f9e:`#f43f9e`,hexa87800:`#a87800`,rgba_250_204_21_0_18:`rgba(250, 204, 21, 0.18)`,hex525866:`#525866`,rgba_167_179_196_0_72:`rgba(167, 179, 196, 0.72)`,hexff4d4f:`#ff4d4f`,hexa78bfa:`#a78bfa`,hexf59e0b:`#f59e0b`,rgba_190_242_100_0_14:`rgba(190, 242, 100, 0.14)`,rgba_17_24_39_0_032:`rgba(17, 24, 39, 0.032)`,hexf5a623:`#f5a623`,rgba_22_204_22_0_90:`rgba(22, 204, 22, 0.90)`,rgba_212_36_36_0_90:`rgba(212, 36, 36, 0.90)`,hexb9dcfb:`#b9dcfb`,hex2b91df:`#2b91df`,rgba_0_0_0_0_02:`rgba(0, 0, 0, 0.02)`,hexbef264:`#bef264`,hexd83aa5:`#d83aa5`,hex9a7200:`#9a7200`,hex74ff17:`#74ff17`,rgba_109_114_125_0_78:`rgba(109, 114, 125, 0.78)`,rgba_255_255_255_0_035:`rgba(255, 255, 255, 0.035)`,rgba_190_242_100_0_9:`rgba(190, 242, 100, 0.9)`,rgba_251_113_133_0_78:`rgba(251, 113, 133, 0.78)`,rgba_248_250_252_0_42:`rgba(248, 250, 252, 0.42)`,rgba_96_165_250_0_32:`rgba(96, 165, 250, 0.32)`,hex94a3b8:`#94a3b8`,hex22d3ee:`#22d3ee`,hex34d399:`#34d399`,hexfb7185:`#fb7185`,hexf97316:`#f97316`,hex2dd4bf:`#2dd4bf`,hexfff3a3:`#fff3a3`,hex111111:`#111111`,hex64748b:`#64748b`,hex64748B:`#64748B`,hexF3F4F6:`#F3F4F6`,hexD1D5DB:`#D1D5DB`,hex9ca3af:`#9ca3af`,hexd97706:`#d97706`,rgba_255_255_255_0_18:`rgba(255, 255, 255, 0.18)`,rgba_255_255_255_0_72:`rgba(255, 255, 255, 0.72)`,rgba_22_22_26_0_9:`rgba(22, 22, 26, 0.9)`,rgba_255_238_0_0_58:`rgba(255, 238, 0, 0.58)`,rgba_255_238_0_0_20:`rgba(255, 238, 0, 0.20)`,hex15803d:`#15803d`,rgba_250_204_21_0_34:`rgba(250, 204, 21, 0.34)`,rgba_250_204_21_0_16:`rgba(250, 204, 21, 0.16)`,hex4ade80:`#4ade80`,hexf87171:`#f87171`,hex00ca72:`#00ca72`,hex0b63f6:`#0b63f6`,hex24b7f3:`#24b7f3`,hexf43f5e:`#f43f5e`,hexfdab3d:`#fdab3d`,hexffcb00:`#ffcb00`,hex3b3f4a:`#3b3f4a`,hex784bd1:`#784bd1`,hexff158a:`#ff158a`,hex676879:`#676879`,hex315fdc:`#315fdc`,hex0f766e:`#0f766e`,hexa14b08:`#a14b08`,hex7c3aed:`#7c3aed`,hex9f1239:`#9f1239`,hex8fb0ff:`#8fb0ff`,hexfdba74:`#fdba74`,hexc4b5fd:`#c4b5fd`,rgba_255_255_255_0_68:`rgba(255, 255, 255, 0.68)`,hexfda4af:`#fda4af`,hex059669:`#059669`,hex667085:`#667085`,hexc2410c:`#c2410c`,hex666:`#666`,hex97a6ba:`#97a6ba`,hex3f3f46:`#3f3f46`,hex22c55e:`#22c55e`,rgb_14_79_229:`rgb(14, 79, 229)`,lightgrayKeyword:`lightgray`,hex0000ff:`#0000ff`,hex00ffff:`#00ffff`,hex008000:`#008000`,hexff00ff:`#ff00ff`,hexff0000:`#ff0000`,hexffff00:`#ffff00`,hex00ff00:`#00ff00`,hex800000:`#800000`,hex000080:`#000080`,hex808000:`#808000`,hex800080:`#800080`,hex008080:`#008080`,hexc0c0c0:`#c0c0c0`,hex808080:`#808080`,hex9999ff:`#9999ff`,hex993366:`#993366`,hexffffcc:`#ffffcc`,hexccffff:`#ccffff`,hex660066:`#660066`,hexff8080:`#ff8080`,hex0066cc:`#0066cc`,hexccccff:`#ccccff`,hex00ccff:`#00ccff`,hexccffcc:`#ccffcc`,hexffff99:`#ffff99`,hex99ccff:`#99ccff`,hexff99cc:`#ff99cc`,hexcc99ff:`#cc99ff`,hexffcc99:`#ffcc99`,hex3366ff:`#3366ff`,hex33cccc:`#33cccc`,hex99cc00:`#99cc00`,hexffcc00:`#ffcc00`,hexff9900:`#ff9900`,hexff6600:`#ff6600`,hex666699:`#666699`,hex969696:`#969696`,hex003366:`#003366`,hex339966:`#339966`,hex003300:`#003300`,hex333300:`#333300`,hex993300:`#993300`,hex333399:`#333399`,hex333333:`#333333`,hex4573de:`#4573de`,hexf3f4f6:`#f3f4f6`,hex111827:`#111827`,hex4b5563:`#4b5563`,hexd1d5db:`#d1d5db`,hex166534:`#166534`,hex1f2937:`#1f2937`,hex374151:`#374151`,hexe5e7eb:`#e5e7eb`,hexfef3c7:`#fef3c7`,rgb_82_94_227:`rgb(82, 94, 227)`,hexe5a000:`#e5a000`,hex6b7280:`#6b7280`,rgba_255_255_255_0_32:`rgba(255, 255, 255, 0.32)`,rgb_69_115_222:`rgb(69, 115, 222)`,rgb_190_91_0:`rgb(190, 91, 0)`,rgb_0_144_184:`rgb(0, 144, 184)`,rgb_230_43_52:`rgb(230, 43, 52)`,rgb_202_68_91:`rgb(202, 68, 91)`,rgb_139_93_206:`rgb(139, 93, 206)`,rgba_31_157_114_0_045:`rgba(31, 157, 114, 0.045)`,rgba_116_126_148_0_085:`rgba(116, 126, 148, 0.085)`,rgba_116_126_148_0_14:`rgba(116, 126, 148, 0.14)`,rgba_214_69_69_0_12:`rgba(214, 69, 69, 0.12)`,rgba_201_138_20_0_12:`rgba(201, 138, 20, 0.12)`,rgba_79_91_213_0_12:`rgba(79, 91, 213, 0.12)`,rgba_214_69_69_0_1:`rgba(214, 69, 69, 0.1)`,rgba_214_69_69_0_38:`rgba(214, 69, 69, 0.38)`,rgba_31_157_114_0_07:`rgba(31, 157, 114, 0.07)`,rgba_31_157_114_0_2:`rgba(31, 157, 114, 0.2)`,rgba_201_138_20_0_1:`rgba(201, 138, 20, 0.1)`,rgba_201_138_20_0_34:`rgba(201, 138, 20, 0.34)`,rgba_201_138_20_0_08:`rgba(201, 138, 20, 0.08)`,rgba_201_138_20_0_42:`rgba(201, 138, 20, 0.42)`,hex8a5d05:`#8a5d05`,rgba_31_157_114_0_06:`rgba(31, 157, 114, 0.06)`,rgba_31_157_114_0_32:`rgba(31, 157, 114, 0.32)`,hex0d6b4d:`#0d6b4d`,rgba_214_69_69_0_09:`rgba(214, 69, 69, 0.09)`,rgba_214_69_69_0_42:`rgba(214, 69, 69, 0.42)`,hex9c2a2a:`#9c2a2a`,rgba_79_91_213_0_06:`rgba(79, 91, 213, 0.06)`,rgba_79_91_213_0_34:`rgba(79, 91, 213, 0.34)`,hex343b9d:`#343b9d`,rgba_79_91_213_0_035:`rgba(79, 91, 213, 0.035)`,rgba_79_91_213_0_26:`rgba(79, 91, 213, 0.26)`,rgba_255_255_255_0_22:`rgba(255, 255, 255, 0.22)`,rgba_255_255_255_0_2:`rgba(255, 255, 255, 0.2)`,rgba_37_99_235_0_24:`rgba(37, 99, 235, 0.24)`,rgba_255_255_255_0_9:`rgba(255, 255, 255, 0.9)`,rgba_255_255_255_0_85:`rgba(255, 255, 255, 0.85)`,rgb_80_128_235:`rgb(80, 128, 235)`,rgb_203_104_0:`rgb(203, 104, 0)`,rgb_0_156_197:`rgb(0, 156, 197)`,rgb_255_119_99:`rgb(255, 119, 99)`,rgb_216_81_102:`rgb(216, 81, 102)`,rgb_120_139_255:`rgb(120, 139, 255)`,rgb_151_105_220:`rgb(151, 105, 220)`,rgba_15_17_23_0_92:`rgba(15, 17, 23, 0.92)`,rgba_15_17_23_0_88:`rgba(15, 17, 23, 0.88)`,rgba_52_211_153_0_075:`rgba(52, 211, 153, 0.075)`,rgba_148_163_184_0_07:`rgba(148, 163, 184, 0.07)`,rgba_148_163_184_0_11:`rgba(148, 163, 184, 0.11)`,rgba_248_113_113_0_13:`rgba(248, 113, 113, 0.13)`,rgba_251_191_36_0_12:`rgba(251, 191, 36, 0.12)`,rgba_165_180_252_0_12:`rgba(165, 180, 252, 0.12)`,rgba_248_113_113_0_5:`rgba(248, 113, 113, 0.5)`,rgba_52_211_153_0_09:`rgba(52, 211, 153, 0.09)`,rgba_52_211_153_0_34:`rgba(52, 211, 153, 0.34)`,rgba_251_191_36_0_13:`rgba(251, 191, 36, 0.13)`,rgba_251_191_36_0_48:`rgba(251, 191, 36, 0.48)`,rgba_52_211_153_0_1:`rgba(52, 211, 153, 0.1)`,rgba_52_211_153_0_42:`rgba(52, 211, 153, 0.42)`,hexd1fae5:`#d1fae5`,rgba_248_113_113_0_48:`rgba(248, 113, 113, 0.48)`,hexfee2e2:`#fee2e2`,rgba_165_180_252_0_11:`rgba(165, 180, 252, 0.11)`,rgba_165_180_252_0_42:`rgba(165, 180, 252, 0.42)`,hexe0e7ff:`#e0e7ff`,rgba_165_180_252_0_07:`rgba(165, 180, 252, 0.07)`,rgba_165_180_252_0_16:`rgba(165, 180, 252, 0.16)`,rgba_165_180_252_0_32:`rgba(165, 180, 252, 0.32)`,rgba_148_163_184_0_075:`rgba(148, 163, 184, 0.075)`,rgba_255_255_255_0_16:`rgba(255, 255, 255, 0.16)`,rgba_255_255_255_0_14:`rgba(255, 255, 255, 0.14)`,hexe53935:`#e53935`,hexd81b60:`#d81b60`,hexc000c0:`#c000c0`,hex8e24aa:`#8e24aa`,hex5e35b1:`#5e35b1`,hex4527a0:`#4527a0`,hex3949ab:`#3949ab`,hex03a9f4:`#03a9f4`,hex26c6da:`#26c6da`,hex00897b:`#00897b`,hex43a047:`#43a047`,hex8bc34a:`#8bc34a`,hexc0ca33:`#c0ca33`,hexfdd835:`#fdd835`,hexffb300:`#ffb300`,hexfb8c00:`#fb8c00`,hexf4511e:`#f4511e`,hex6d4c41:`#6d4c41`,hexbdbdbd:`#bdbdbd`,hex757575:`#757575`,hex7dd3fc:`#7dd3fc`,hexb45309:`#b45309`,hexf9a8d4:`#f9a8d4`,hexbe185d:`#be185d`,hexa5b4fc:`#a5b4fc`,hex86efac:`#86efac`,hexf6f6f6:`#f6f6f6`,hex202020:`#202020`,hexf8f8f8:`#f8f8f8`,hexf1f1f1:`#f1f1f1`,hexcccccc:`#cccccc`,hex737373:`#737373`,hexeeeeee:`#eeeeee`,hex1d4ed8:`#1d4ed8`,hex262626:`#262626`,rgba_220_38_38_0_08:`rgba(220, 38, 38, 0.08)`,rgba_0_0_0_0_06:`rgba(0, 0, 0, 0.06)`,rgba_0_0_0_0_10:`rgba(0, 0, 0, 0.10)`,hexa1a1aa:`#a1a1aa`,hexb0b0b0:`#b0b0b0`,hex0a0a0a:`#0a0a0a`,hex1f1f1f:`#1f1f1f`,hex2f2f2f:`#2f2f2f`,hex3a3a3a:`#3a3a3a`,hex525252:`#525252`,hex2b2b2b:`#2b2b2b`,hexfcd34d:`#fcd34d`,rgba_252_165_165_0_10:`rgba(252, 165, 165, 0.10)`,rgba_255_255_255_0_08:`rgba(255, 255, 255, 0.08)`,hex52525b:`#52525b`,hexe4e4e7:`#e4e4e7`,hex007bff:`#007bff`,hex0d63e8:`#0d63e8`,hex000:`#000`,hex999:`#999`,hexf6f6f7:`#f6f6f7`,hexebebef:`#ebebef`,hexe4e4e9:`#e4e4e9`,hexf0f0f0:`#f0f0f0`,hex2d2d2d:`#2d2d2d`,hexd4d4d4:`#d4d4d4`,rgba_0_0_0_0_15:`rgba(0, 0, 0, 0.15)`,hex1c1c1c:`#1c1c1c`,hex686868:`#686868`,rgba_0_0_0_0_5:`rgba(0, 0, 0, 0.5)`,hex2c2c2c:`#2c2c2c`,hexfa2057:`#fa2057`,hexf7c605:`#f7c605`,hex01c26e:`#01c26e`,hexa8183c:`#a8183c`,hex5555fc:`#5555fc`,hex161a42:`#161a42`,hex252525:`#252525`},eo=[`linear-gradient(135deg, ${V.hex7dd3fc}, ${V.blue600})`,`linear-gradient(135deg, ${V.hexfacc15}, ${V.hexb45309})`,`linear-gradient(135deg, ${V.hexf9a8d4}, ${V.hexbe185d})`,`linear-gradient(135deg, ${V.hexa5b4fc}, ${V.indigo600})`,`linear-gradient(135deg, ${V.hex86efac}, ${V.hex15803d})`,`linear-gradient(135deg, ${V.hexfda4af}, ${V.rose700})`,`linear-gradient(135deg, ${V.hexc4b5fd}, ${V.hex7c3aed})`,`linear-gradient(135deg, ${V.hexfdba74}, ${V.hexc2410c})`];Object.fromEntries(eo.map((e,t)=>[String(t),e]));function to({options:e={}}){let[t,n]=I(!1),{index:r=0,initials:i,rectangular:a=!1,size:o,value:s}=e;return z(pi,{class:[`avatar-cell`,`avatar-cell--${Math.max(r,0)%eo.length}`,a?`avatar-cell--rectangular rectangular`:``,so(o),e.className].filter(Boolean).join(` `),title:e.label||String(s??``),role:`img`,"aria-label":e.ariaLabel||e.label||void 0,style:e.style,children:ao(s)&&!t?z(`img`,{class:`avatar-cell__image`,src:String(s),alt:e.label||``,onError:()=>n(!0)}):i??io(s)})}function no(e,t={}){return ht(e,z(to,{options:t}))}function ro(e=0){return eo[Math.max(e,0)%eo.length]}function io(e){return String(e??``).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()??``).join(``)}function ao(e){return typeof e==`string`&&/^(https?:|data:image\/|blob:|\/|\.\.?\/)/.test(e)}function oo(e){let t=Number(e);return Number.isFinite(t)?Math.max(t-1,0):0}function so(e){if(e)return e<=16?`avatar-cell--size-16`:e<=20?`avatar-cell--size-20`:e<=32?`avatar-cell--size-32`:e<=40?`avatar-cell--size-40`:`avatar-cell--size-48`}function co(e,t={}){let{index:n=0,initials:r,rectangular:i=!1,size:a,value:o}=t,s=ao(o),c=so(a),l={class:[`avatar-cell`,`avatar-cell--${Math.max(n,0)%eo.length}`,i?`avatar-cell--rectangular rectangular`:``,c,t.className].filter(Boolean).join(` `),title:t.label||String(o??``)};return t.key!==void 0&&(l.key=t.key),t.style!==void 0&&(l.style=t.style),t.ariaLabel!==void 0&&(l[`aria-label`]=t.ariaLabel),s?e(`span`,l,[e(`img`,{class:`avatar-cell__image`,src:String(o),alt:t.label||``})]):e(`span`,l,r??io(o))}function lo(e,t={}){return e(`span`,{class:`avatar-cell-with-text`},[co(e,t),e(`span`,{class:`avatar-cell-with-text__label`},String(t.label??t.value??``))])}function uo(e){return typeof e==`string`?`rv-progress-bar__fill ${e}`:[`rv-progress-bar__fill`,...Object.entries(e??{}).filter(([,e])=>e).map(([e])=>e)].join(` `)}function fo(e,{value:t,min:n=0,max:r=100,ariaLabel:i,className:a,fillClass:o}){let s=bi(t,n,r),c=Number(s.percent.toFixed(8));return e(`div`,{class:[`rv-progress-bar`,a].filter(Boolean).join(` `),role:`progressbar`,"aria-valuemin":s.min,"aria-valuemax":s.max,"aria-valuenow":Math.min(s.max,Math.max(s.min,t)),"aria-label":i},[e(`span`,{class:`rv-progress-bar__track`},[e(`span`,{class:uo(o),style:{width:`${c}%`}})])])}function po(e,t=100){return Math.round(Number(e)*t)}function mo(e,t=100){return Number(e)/t}function ho({min:e,max:t,fromValue:n,toValue:r,scaleFactor:i=100}){let a=Math.min(po(e,i),po(t,i)),o=Math.max(po(e,i),po(t,i)),s=go(po(n,i),a,o),c=go(po(r,i),a,o);return{minInt:a,maxInt:o,fromValueInt:Math.min(s,c),toValueInt:Math.max(s,c)}}function go(e,t,n){return Math.min(Math.max(e,t),n)}function _o(e,t){return Math.min(e,t)}function vo(e,t){return Math.max(t,e)}function yo(e,t,n,r=100){return Math.min(go(po(e,r),n.minInt,n.maxInt),t)}function bo(e,t,n,r=100){return Math.max(go(po(e,r),n.minInt,n.maxInt),t)}function xo(e,t,n=100){return{fromValue:mo(e,n),toValue:mo(t,n)}}function So(e){return String(e)}function Co(e){return e===void 0?``:e%1==0?e.toString():e.toFixed(2)}function wo(e){let t=e.trim().replace(`,`,`.`);return t?Number(t):NaN}function To(e){return xo(Number(e.refs.fromSlider?.value??e.state.fromValueInt),Number(e.refs.toSlider?.value??e.state.toValueInt),e.scaleFactor)}function Eo(e){let{fromValue:t,toValue:n}=To(e),r=e.formatFromValue(t),i=e.formatToValue(n);e.refs.fromLabel&&(e.refs.fromLabel.textContent=r),e.refs.toLabel&&(e.refs.toLabel.textContent=i),e.refs.fromInput&&(e.refs.fromInput.value=e.formatInputValue(t)),e.refs.toInput&&(e.refs.toInput.value=e.formatInputValue(n)),e.refs.fromSlider?.setAttribute(`aria-valuetext`,r),e.refs.toSlider?.setAttribute(`aria-valuetext`,i)}var Do=new WeakMap;function Oo(e,t,n,r,i=100){if(t.textContent=r(mo(Number(e.value),i)),xt(t),!Do.has(t)){t.id||=Rt(`rv-tooltip`);let n=e.getAttribute(`aria-describedby`);e.setAttribute(`aria-describedby`,[n,t.id].filter(Boolean).join(` `)),t.hidden=!1,Object.assign(t.style,{position:`fixed`,inset:`auto`,margin:`0`,transform:`none`});let r=kt(t,`block`),i=e.ownerDocument.defaultView?.MutationObserver,a=i?new i(()=>{e.isConnected||Ao(t)}):void 0;a?.observe(e.ownerDocument,{childList:!0,subtree:!0}),Do.set(t,{mode:r,slider:e,original:n,disconnect:()=>a?.disconnect()}),Tt(e.ownerDocument,t,()=>Ao(t))}let a=n.maxInt-n.minInt||1,o=(Number(e.value)-n.minInt)/a*100,s=t.parentElement?.getBoundingClientRect(),c=t.getBoundingClientRect();s&&c?(t.style.left=`${s.left+ko(o,s.width,c.width)-c.width/2}px`,t.style.top=`${Math.max(8,s.top-c.height-8)}px`):t.style.left=`${o}%`,t.style.opacity=`1`}function ko(e,t,n,r=8){let i=n/2,a=r+i,o=t-r-i;if(a>o)return t/2;let s=Math.min(Math.max(e,0),100)/100*t;return Math.min(Math.max(s,a),o)}function Ao(e){e.style.opacity=`0`;let t=Do.get(e);t&&(t.disconnect?.(),At(e,t.mode),e.hidden=!0,t.original===null?t.slider.removeAttribute(`aria-describedby`):t.slider.setAttribute(`aria-describedby`,t.original),Do.delete(e),Et(e.ownerDocument,e))}function jo(e,t,n){let r=getComputedStyle(n),i=r.getPropertyValue(`--slider-color`).trim()||r.getPropertyValue(`--rv-ui-border`).trim()||`var(--rv-ui-border)`,a=r.getPropertyValue(`--range-color`).trim()||r.getPropertyValue(`--rv-ui-accent`).trim()||`var(--rv-ui-accent)`,o=parseInt(t.max,10)-parseInt(t.min,10)||1,s=parseInt(e.value,10)-parseInt(e.min,10),c=parseInt(t.value,10)-parseInt(t.min,10),l=s/o*100,u=c/o*100;n.style.background=`linear-gradient(
48
+ to right,
49
+ ${i} 0%,
50
+ ${i} ${l}%,
51
+ ${a} ${l}%,
52
+ ${a} ${u}%,
53
+ ${i} ${u}%,
54
+ ${i} 100%) center / 100% 4px no-repeat`}function Mo(e){let{fromSlider:t,toSlider:n}=e.refs;t&&n&&(jo(t,n,n),Eo(e))}function No(e){e.refs.toSlider&&(e.refs.toSlider.style.zIndex=Number(e.refs.toSlider.value)<=e.state.minInt?`2`:`0`)}function Po(e){e.onRangeChange(To(e))}function Fo(e){e.onRangeCommit?.(To(e))}function Io(e){e.metaKey||e.ctrlKey||[`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`Backspace`,`Delete`,`End`,`Enter`,`Home`,`Tab`].includes(e.key)||/^[\d.,-]$/.test(e.key)||e.preventDefault()}var Lo=new WeakMap;function Ro(e,t){let n=Lo.get(e);n&&e.removeEventListener(`change`,n);let r=()=>Fo(t);Lo.set(e,r),e.addEventListener(`change`,r)}function zo(e,t){let n=[],{minInt:r,maxInt:i,fromValueInt:a,toValueInt:o}=t.state;return t.showTooltips&&n.push(e(`div`,{className:`slider-tooltip`,hidden:!0,ref:e=>t.refs.fromTooltip=e})),n.push(e(`input`,{ref:e=>{t.refs.fromSlider=e,e&&(e.value=String(a),Ro(e,t),t.scheduleSyncVisuals())},className:`fromSlider${t.fromClassName?` ${t.fromClassName}`:``}`,type:`range`,value:String(a),min:r,max:i,step:t.nativeStep,disabled:t.disabled,"aria-label":t.fromAriaLabel,"aria-valuetext":t.formatFromValue(t.state.fromValueInt/t.scaleFactor),onInput:()=>{t.refs.fromSlider&&t.refs.toSlider&&(t.refs.fromSlider.value=String(_o(Number(t.refs.fromSlider.value),Number(t.refs.toSlider.value))),t.syncVisuals(),t.showTooltips&&t.refs.fromTooltip&&Oo(t.refs.fromSlider,t.refs.fromTooltip,t.state,t.formatFromValue,t.scaleFactor),Po(t))},onMouseOver:()=>t.showTooltips&&t.refs.fromSlider&&t.refs.fromTooltip&&Oo(t.refs.fromSlider,t.refs.fromTooltip,t.state,t.formatFromValue,t.scaleFactor),onMouseOut:()=>t.showTooltips&&t.refs.fromTooltip&&Ao(t.refs.fromTooltip)})),t.showTooltips&&n.push(e(`div`,{className:`slider-tooltip`,hidden:!0,ref:e=>t.refs.toTooltip=e})),n.push(e(`input`,{ref:e=>{t.refs.toSlider=e,e&&(e.value=String(o),Ro(e,t),t.scheduleSyncVisuals())},className:`toSlider${t.toClassName?` ${t.toClassName}`:``}`,type:`range`,value:String(o),min:r,max:i,step:t.nativeStep,disabled:t.disabled,"aria-label":t.toAriaLabel,"aria-valuetext":t.formatToValue(t.state.toValueInt/t.scaleFactor),onInput:()=>{t.refs.fromSlider&&t.refs.toSlider&&(t.refs.toSlider.value=String(vo(Number(t.refs.fromSlider.value),Number(t.refs.toSlider.value))),t.syncVisuals(),No(t),t.showTooltips&&t.refs.toTooltip&&Oo(t.refs.toSlider,t.refs.toTooltip,t.state,t.formatToValue,t.scaleFactor),Po(t))},onMouseOver:()=>t.showTooltips&&t.refs.toSlider&&t.refs.toTooltip&&Oo(t.refs.toSlider,t.refs.toTooltip,t.state,t.formatToValue,t.scaleFactor),onMouseOut:()=>t.showTooltips&&t.refs.toTooltip&&Ao(t.refs.toTooltip)})),e(`div`,{className:`sliders_control range-slider-control${t.controlClassName?` ${t.controlClassName}`:``}`},n)}function Bo(e,t){let{fromValueInt:n,toValueInt:r}=t.state,i={type:`text`,inputMode:`decimal`,disabled:t.disabled,onKeyDown:Io};return e(`div`,{className:`range-inputs`},[$n(e,`input`,{...i,ref:e=>{t.refs.fromInput=e,e&&(e.value=t.formatInputValue(mo(n,t.scaleFactor)))},"aria-label":t.fromAriaLabel??`Minimum value`,className:`range-input from-range-input`,value:t.formatInputValue(mo(n,t.scaleFactor)),onInput:e=>{if(!t.refs.fromSlider||!t.refs.toSlider)return;let n=t.parseInputValue(e.target.value);Number.isFinite(n)&&(t.refs.fromSlider.value=String(yo(n,Number(t.refs.toSlider.value),t.state)),t.syncVisuals(),Po(t))}}),e(`span`,{className:`range-input-separator`},`-`),$n(e,`input`,{...i,ref:e=>{t.refs.toInput=e,e&&(e.value=t.formatInputValue(mo(r,t.scaleFactor)))},"aria-label":t.toAriaLabel??`Maximum value`,className:`range-input to-range-input`,value:t.formatInputValue(mo(r,t.scaleFactor)),onInput:e=>{if(!t.refs.fromSlider||!t.refs.toSlider)return;let n=t.parseInputValue(e.target.value);Number.isFinite(n)&&(t.refs.toSlider.value=String(bo(n,Number(t.refs.fromSlider.value),t.state)),t.syncVisuals(),Po(t))}})])}function Vo(e,t){let{fromValueInt:n,toValueInt:r}=t.state,{scaleFactor:i}=t;return e(`div`,{className:`range-values`},e(`span`,{ref:e=>{t.refs.fromLabel=e,e&&(e.textContent=t.formatFromValue(mo(n,i)))}},t.formatFromValue(mo(n,i))),e(`span`,{ref:e=>{t.refs.toLabel=e,e&&(e.textContent=t.formatToValue(mo(r,i)))}},t.formatToValue(mo(r,i))))}function Ho(e,t){let{min:n,max:r,fromValue:i,toValue:a,showTooltips:o=!1,showRangeDisplay:s=!1,showRangeInputs:c=!1,disabled:l=!1,scaleFactor:u,step:d,className:f,controlClassName:p,fromClassName:m,toClassName:h,fromAriaLabel:g,toAriaLabel:_,onRangeChange:v,onRangeCommit:y,formatValue:b=Co,formatFromValue:x=b,formatToValue:S=b,formatInputValue:C=So,parseInputValue:w}=t,T=Number.isFinite(u)&&Number(u)>0?Number(u):100,E={},D=ho({min:n,max:r,fromValue:i,toValue:a,scaleFactor:T}),O=Number.isFinite(d)&&Number(d)>0?Math.max(1,po(Number(d),T)):1,k=(D.maxInt-D.minInt)%O===0?O:1,A=0,j={refs:E,state:D,scaleFactor:T,nativeStep:k,formatValue:b,formatFromValue:x,formatToValue:S,formatInputValue:C,parseInputValue:w??wo,showTooltips:o,onRangeChange:v,onRangeCommit:y,disabled:l,controlClassName:p,fromClassName:m,toClassName:h,fromAriaLabel:g,toAriaLabel:_,syncVisuals:()=>Mo(j),scheduleSyncVisuals:()=>{A&&cancelAnimationFrame(A),A=requestAnimationFrame(()=>{A=0,j.syncVisuals()})}};return e(`div`,{className:`range_container${f?` ${f}`:``}`},s?Vo(e,j):null,zo(e,j),c?Bo(e,j):null)}function Uo(e,t){return e(`div`,{class:`circular-progress-container`},[e(`div`,{class:`circular-progress`},[e(`svg`,{class:`circular-progress-svg`,viewBox:`0 0 36 36`},[e(`path`,{class:`circular-progress-bg`,d:`M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831`}),e(`path`,{class:Zn(`circular-progress-path`,t.thresholdClasses),d:`M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831`,style:{"stroke-dasharray":`${t.percent}, 100`}})]),t.showValue&&e(`div`,{class:`circular-progress-value`},t.formattedValue)])])}var Wo=`button,input,select,textarea,summary`,Go=[`rv-btn`,`rv-control`,`rv-checkbox`,`rv-radio`,`rv-native-slider`,`rv-disclosure-summary`];function Ko(e){let t=Array.from(e.querySelectorAll(Wo));`matches`in e&&typeof e.matches==`function`&&e.matches(Wo)&&t.unshift(e);for(let e of t){let t=e.localName,n=Qn(t,{class:[...e.classList].filter(e=>!Go.includes(e)).join(` `),...t===`input`?{type:e.type}:{},...t===`button`&&e.hasAttribute(`type`)?{type:e.getAttribute(`type`)}:{}});e.className=n.class,t===`button`&&!e.hasAttribute(`type`)&&e.setAttribute(`type`,n.type)}}function qo(e,t){let{shortcut:n,hideIcon:r,inputAttributes:i={}}=t;return e(`div`,{class:Zn(`rv-search-input`,r&&`rv-search-input--no-icon`,n===void 0&&`rv-search-input--no-shortcut`,t.rootClassName),"data-testid":t.testId},!r&&e(`span`,{class:Zn(`rv-search-input-icon`,t.iconClassName),"aria-hidden":`true`},t.icon),t.leading,$n(e,`input`,{type:`search`,...i,class:Zn(t.inputClassName,i.class)}),n!==void 0&&e(`span`,{class:Zn(`rv-search-input-shortcut`,t.shortcutClassName)},n),t.trailing)}function Jo(e,t){let n=ht(e,qo(P,{...t,icon:z(`span`,{dangerouslySetInnerHTML:{__html:t.iconSvg}})}));return{root:n,input:n.querySelector(`input`)}}var Yo={link:`M10 13a5 5 0 0 0 7 .5l3-3a5 5 0 0 0-7-7l-2 2 M14 11a5 5 0 0 0-7-.5l-3 3a5 5 0 0 0 7 7l2-2`,select:`M5 3 19 12 12 13 9 20Z M12 13l5 7`,rectangle:`M4 5h16v14H4Z`,line:`M5 19 19 5 M4 18l2 2 M18 4l2 2`,arrow:`M5 19 19 5 M9 5h10v10`,note:`M5 3h14v14l-4 4H5Z M15 21v-4h4 M8 8h8 M8 12h6`};function Xo(e,t){return e(`div`,{class:`progress-line-container`},[fo(e,{value:t.percent,className:`progress-line-background`,fillClass:{"progress-line-bar":!0,...t.classes},ariaLabel:t.label}),e(`span`,{class:`progress-line-label`},t.label)])}function Zo(e,t){return e(`div`,{class:Zn(`progress-line-cell`,t.classes)},[e(`div`,{class:`cell-value`,dir:`auto`},t.label),e(`div`,{class:`progress-line-bar`,style:{width:`${t.percent}%`}}),e(`div`,{class:`progress-line-bar-shadow`,style:{width:`${t.percent}%`}}),e(`div`,{class:`progress-line-background`})])}function Qo(e,t){let{value:n}=t;return n==null||typeof n==`string`&&!n.trim()?``:e(`div`,{class:Zn(`badge-cell`,{default:t.isDefault??!t.backgroundColor,rectangular:t.rectangular},t.classes),style:{"--badge-cell-value-background-color":t.backgroundColor??`#475569`,"--badge-cell-value-color":t.color??`#ffffff`}},String(n))}function $o(e,t){let{value:n,label:r}=t,i=n>0?`positive`:n<0?`negative`:`neutral`;return e(`div`,{class:Zn(`change-cell`,t.classes)},[e(`div`,{class:`change-${i}`},[e(`span`,{class:`change-value`},n<0?`(${r})`:String(r)),...n===0?[]:[e(`span`,{class:`change-icon`},n>0?`▲`:`▼`)]])])}function es(e,t,n={true:`True`,false:`False`}){return e(`div`,{class:`thumb-cell`},[e(`div`,{class:`thumb thumb-${t?`up`:`down`}`,title:t?n.true:n.false},t?`👍`:`👎`)])}function ts(e,t){return e(`span`,{class:`column-icon ${t.className}`,title:t.title,innerHTML:t.icon})}function ns(e,t){return e(`div`,{class:`column-type-container`},[t.icon,e(`span`,{class:`column-label`},t.label)])}function rs(e,t){return e(`ul`,{class:`summary-percentage-content`},t.map(t=>e(`li`,{class:`summary-percentage-item${t.other?` summary-percentage-others`:``}`},`${t.label} (${t.count}) ${t.percentage}%`)))}function is(e,t){return e(`div`,{class:`summary-aggregate-content`},t.map(t=>e(`div`,{class:`summary-aggregate-item`},t)))}function as(e,t){let{value:n}=t,r=Array.isArray(n)?Array.from(n).filter(e=>e==null||typeof e==`number`&&Number.isFinite(e)).map(e=>e??null):[],i=r.filter(e=>e!==null);if(i.length===0)return e(`div`,{class:`sparkline-container`},``);let a=typeof t.ariaLabel==`function`?t.ariaLabel(i):t.ariaLabel??r.join(`, `),o=t.maxValue??Math.max(...i),s=t.minValue??Math.min(...i),c=o-s||1,l=r.map(e=>e===null?null:20-(e-s)/c*20),u=[];for(let n=0;n<l.length-1;n++){if(l[n]===null||l[n+1]===null)continue;let i=n/(r.length-1)*100,a=l[n],o=(n+1)/(r.length-1)*100,s=l[n+1],c=t.classesForValue?.(r[n])??{};u.push(e(`line`,{class:Zn(`sparkline-segment`,c),x1:i.toString(),y1:a.toString(),x2:o.toString(),y2:s.toString()}))}return e(`div`,{class:`sparkline-container`,role:`img`,"aria-label":a},[e(`svg`,{class:`sparkline`,viewBox:`0 0 100 20`,xmlns:`http://www.w3.org/2000/svg`},u)])}function os(e,t){let{value:n}=t,r=Array.isArray(n)?n:[];if(r.length===0)return e(`div`,{class:`bar-chart-container`},``);let i=t.maxValue??Math.max(...r),a=t.minValue??Math.min(...r),o=r.map(e=>(e-a)/(i-a||1)*100);return e(`div`,{class:`bar-chart-container`},[e(`div`,{class:`bar-chart ${t.barPosition||`bottom`}`},[...o.map((n,i)=>e(`div`,{class:Zn(`bar-chart-bar`,t.classesForValue?.(n)??{}),style:{width:`${100/r.length}%`,height:`${n}%`}}))])])}function ss(e){let t=/^#([\da-f]{6}|[\da-f]{3})$/i.exec(e.trim());if(!t)return;let n=t[1].length===3?[...t[1]].map(e=>e.repeat(2)).join(``):t[1];return[Number.parseInt(n.slice(0,2),16),Number.parseInt(n.slice(2,4),16),Number.parseInt(n.slice(4,6),16)]}function cs(e,t,n,r=.5){if(t===n)return e===t?r:+(e>n);if(e<=t)return 0;if(e>=n)return 1;let i=n-t,a=Math.max(Math.abs(t),Math.abs(n)),o=Number.isFinite(i)?(e-t)/i:(e/a-t/a)/(n/a-t/a);return Math.min(1,Math.max(0,o))}function ls(e,t,n){let r=Math.min(1,Math.max(0,n));return`rgb(${e.map((e,n)=>Math.round(e+(t[n]-e)*r)).join(`, `)})`}function us(e){return e<=.5?`rgb(255, ${Math.round(e/.5*255)}, 0)`:`rgb(${Math.round(255*((1-e)/.5))}, ${Math.round(150+105*((1-e)/.5))}, 0)`}function ds(e){return`rgb(0, ${Math.round(150*e)}, ${Math.round(255*e)})`}function fs(e,t,n,r,i){let a=i.map(ss);if(a.some(e=>!e))return;let[o,s,c]=a;return e<=n?ls(o,s,cs(e,t,n,1)):ls(s,c,cs(e,n,r,1))}function ps(e){let t=e.match(/\d+/g)?.map(Number);if(!t||t.length!==3)return`#000`;let[n,r,i]=t;return(.2126*n+.7152*r+.0722*i)/255>.5?`#000`:`#fff`}function ms(e,t){let{value:n}=t,r=t.minValue??0,i=t.maxValue??100,a=i-r||1,o=t.colorMap??`heatmap`,s=Number(n),c=Math.min(r,i),l=Math.max(r,i),u=Math.min(l,Math.max(c,t.midValue??c+(l-c)/2)),d=Math.min(1,Math.max(0,(s-r)/a)),f=(t.lowColor&&t.midColor&&t.highColor?fs(s,c,u,l,[t.lowColor,t.midColor,t.highColor]):void 0)??(o===`coldmap`?ds(d):us(d));return e(`div`,{class:`heatmap-cell`,style:{backgroundColor:f,color:ps(f)}},String(n))}function hs(e){let t=`${e.start}–${e.end}`;return e.label?`${e.label}: ${t}`:t}function gs(e,t=`, `){return ys(e).map(hs).join(t)}function _s(e,t,n){let r=vs(n),i=r.end-r.start;return t.flatMap((t,n)=>{if(t.end<r.start||t.start>r.end)return[];let a=Math.max(r.start,t.start),o=Math.min(r.end,t.end),s=(a-r.start)/i*100,c=(o-a)/i*100;return[e(`div`,{class:`rv-timeline-event-bar`,style:{left:`${s}%`,width:`${c}%`,position:`absolute`},"data-tooltip":hs(t),"tooltip-position":`top`,role:`img`,"aria-label":hs(t),key:n})]})}function vs(e){let t=e?.start,n=e?.end;return Number.isFinite(t)&&Number.isFinite(n)&&n>t?{start:t,end:n}:{start:0,end:100}}function ys(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&Number.isFinite(e.start)&&Number.isFinite(e.end)&&e.end>=e.start&&(e.label===void 0||typeof e.label==`string`)):[]}function bs(e,t){return typeof t==`function`?t(e):t||gs(e)}function xs(e,t){let{value:n}=t,r=ys(n);return e(`div`,{class:`rv-timeline-container`,role:`img`,"aria-label":bs(r,t.ariaLabel)||void 0},[e(`div`,{class:`rv-timeline-track`},[e(`div`,{class:`rv-timeline-bar`},[]),..._s(e,r,t.range)])])}function Ss(e,t){return`hsl(${e/t*360}, 70%, 50%)`}function Cs(e){return Array.isArray(e)&&typeof e[0]==`number`?e.map((t,n)=>({value:t,color:Ss(n,e.length),name:`Slice ${n+1}`})):Array.isArray(e)&&typeof e[0]==`object`?e:[]}function ws(e=[],t,n){if(!t)return;let r=Cs(e),i=r.reduce((e,t)=>e+t.value,0),a=0,o=Math.min(t.width,t.height)/2,s=t.getContext(`2d`);s&&(s.clearRect(0,0,t.width,t.height),s.font=n??`12px system-ui`,s.textAlign=`center`,s.textBaseline=`middle`,r.forEach((e,n)=>{let c=e.value/i*2*Math.PI;if(s.beginPath(),s.moveTo(t.width/2,t.height/2),s.arc(t.width/2,t.height/2,o,a,a+c),s.fillStyle=e.color||Ss(n,r.length),s.fill(),e.name){s.fillStyle=`#ffffff`;let n=t.width/2+Math.cos(a+c/2)*(o/2),r=t.height/2+Math.sin(a+c/2)*(o/2);s.fillText(e.name,n,r,o*.8)}a+=c}))}function Ts(e,t=[],n={}){return e(`canvas`,{class:`pie-chart-canvas`,width:n.size??64,height:n.size??64,role:`img`,"aria-label":n.ariaLabel??Cs(t).map(e=>`${e.name??`Slice`}: ${e.value}`).join(`, `),ref:e=>ws(t,e,n.labelFont)})}function Es(e){if(!e)return;let t=e.trim().toLowerCase(),n=/^#([\da-f])([\da-f])([\da-f])$/i.exec(t);return n?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:/^#[\da-f]{6}$/i.test(t)?t:void 0}function Ds(e){if(![`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=e.target,n=t.closest(`.rv-color-palette`),r=Array.from(n?.querySelectorAll(`button:not(:disabled)`)??[]);if(!r.length)return;let i=Math.max(0,r.indexOf(t)),a=e.key===`Home`?0:e.key===`End`?r.length-1:(i+(e.key===`ArrowRight`||e.key===`ArrowDown`?1:-1)+r.length)%r.length;e.preventDefault(),r[a]?.focus()}var Os=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z"/></svg>`,ks=[{value:V.hexe53935,label:`Red`},{value:V.hexd81b60,label:`Pink`},{value:V.hexc000c0,label:`Magenta`},{value:V.hex8e24aa,label:`Purple`},{value:V.hex5e35b1,label:`Deep purple`},{value:V.hex4527a0,label:`Violet`},{value:V.hex3949ab,label:`Indigo`},{value:V.blue600,label:`Blue`},{value:V.hex03a9f4,label:`Light blue`},{value:V.hex26c6da,label:`Cyan`},{value:V.hex00897b,label:`Teal`},{value:V.hex43a047,label:`Green`},{value:V.hex8bc34a,label:`Light green`},{value:V.hexc0ca33,label:`Lime`},{value:V.hexfdd835,label:`Yellow`},{value:V.hexffb300,label:`Amber`},{value:V.hexfb8c00,label:`Orange`},{value:V.hexf4511e,label:`Vermilion`},{value:V.hex6d4c41,label:`Brown`},{value:V.hexe0e0e0,label:`Light gray`},{value:V.hexbdbdbd,label:`Silver`},{value:V.hex757575,label:`Gray`},{value:V.black,label:`Black`}];function As({value:e,options:t=ks,ariaLabel:n,defaultLabel:r,colorAriaLabel:i,disabled:a=!1,includeDefault:o=!0,defaultDisabled:s=!1,onChange:c}){let l=t.findIndex(t=>t.value===e&&!t.disabled),u=t.findIndex(e=>!e.disabled),d=o&&!s,f=Ds;return z(`div`,{class:`rv-color-palette`,role:`radiogroup`,"aria-label":n,children:[z(`div`,{class:`rv-color-palette__swatches`,children:t.map((t,n)=>{let r=t.value===e,o=i(t);return z(js,{type:`button`,role:`radio`,class:`rv-color-palette__swatch`,"data-rv-color-palette-value":t.value,label:o,"aria-checked":r?`true`:`false`,disabled:a||t.disabled,tabIndex:!a&&(n===l||l<0&&(!d||e!==null)&&n===u)?0:-1,style:{"--rv-color-palette-color":t.value},onKeyDown:f,onClick:()=>c(t.value),children:r?z(`span`,{class:`rv-color-palette__check`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:Os}}):null},t.value)})}),o?z(js,{type:`button`,role:`radio`,class:`rv-color-palette__default`,"data-rv-color-palette-default":``,"aria-checked":e===null?`true`:`false`,label:r,disabled:a||s,tabIndex:!a&&!s&&(e===null||u<0)?0:-1,onKeyDown:f,onClick:()=>c(null),children:[e===null?z(`span`,{class:`rv-color-palette__default-check`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:Os}}):null,z(`span`,{class:`rv-color-palette__default-label`,children:r})]}):null]})}function js({label:e,children:t,onKeyDown:n,disabled:r,...i}){let a=kr(e,!0);return z(`button`,{...i,disabled:r,"aria-label":e,...r?{}:a.triggerProps,onKeyDown:e=>{a.triggerProps.onKeyDown(e),e.defaultPrevented||n(e)},children:[t,a.tooltip]})}var Ms=V.blue600,Ns=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M367.2 412.5L99.5 144.8c-22.4 31.4-35.5 69.8-35.5 111.2 0 106 86 192 192 192 41.5 0 79.9-13.1 111.2-35.5zm45.3-45.3c22.4-31.4 35.5-69.8 35.5-111.2 0-106-86-192-192-192-41.5 0-79.9 13.1-111.2 35.5L412.5 367.2zM0 256a256 256 0 1 1 512 0 256 256 0 1 1 -512 0z"/></svg>`,Ps=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M512 256c0 .9 0 1.8 0 2.7-.4 36.5-33.6 61.3-70.1 61.3L344 320c-26.5 0-48 21.5-48 48 0 3.4 .4 6.7 1 9.9 2.1 10.2 6.5 20 10.8 29.9 6.1 13.8 12.1 27.5 12.1 42 0 31.8-21.6 60.7-53.4 62-3.5 .1-7 .2-10.6 .2-141.4 0-256-114.6-256-256S114.6 0 256 0 512 114.6 512 256zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm0-96a32 32 0 1 0 0-64 32 32 0 1 0 0 64zM288 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm96 96a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"/></svg>`;function Fs({icon:e,className:t=`rv-format-icon rv-format-color-picker__icon`}){return z(`span`,{class:t,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:e}})}function Is({label:e,value:t,defaultLabel:n,customLabel:r,customHexLabel:i,invalidColor:a,colorLabels:o,optional:s=!0,allowHexInput:c=!0,disabled:l=!1,onChange:u}){let[d]=I(Rt),f=kr(e,!0,{className:`rv-control-tooltip`,placement:`above`}),p=`rv-format-color-popover-${d}`,m=`rv-format-color-custom-${d}`,h=`rv-format-color-error-${d}`,g=`--rv-format-color-anchor-${d}`,_=R(null),[v,y]=I(!1),[b,x]=I(!1),[S,C]=I(t??Ms),[w,T]=I(!1);Ke(()=>{C(t??Ms),T(!1)},[t]);let E=e=>{let t=Es(e);t?(T(!1),C(t),l||u(t)):T(!0)},D=()=>_.current?.hidePopover?.();return Ke(()=>{l&&(D(),y(!1))},[l]),z(`div`,{class:`rv-format-color-picker`,onKeyDownCapture:e=>{e.key===`Escape`&&_.current?.matches(`:popover-open`)&&(e.preventDefault(),e.stopPropagation(),D())},children:[z(ur,{unstyled:!0,type:`button`,class:`rv-format-color-picker__trigger`,"aria-label":`${e}: ${t?.toUpperCase()??n}`,"aria-haspopup":`dialog`,"aria-expanded":v,"aria-controls":p,...f.triggerProps,disabled:l,popovertarget:p,style:`anchor-name: ${g}`,children:[z(`span`,{class:`rv-format-color-picker__trigger-swatch${t?``:` rv-format-color-picker__trigger-swatch--empty`}`,style:t?{backgroundColor:t}:void 0,children:t?null:z(Fs,{icon:Ns,className:`rv-format-color-picker__empty-icon`})}),z(`span`,{class:`rv-format-color-picker__trigger-value`,children:t?.toUpperCase()??n}),z(Fs,{icon:Bn}),f.tooltip]}),z(`div`,{id:p,ref:_,class:`rv-format-color-picker__popover`,role:`dialog`,"aria-label":e,popover:`auto`,style:`position-anchor: ${g}`,onToggle:e=>y(e.currentTarget.matches(`:popover-open`)),children:[z(As,{value:Es(t)??t??null,ariaLabel:e,defaultLabel:n,colorAriaLabel:e=>o[e.value]??e.label,includeDefault:s,disabled:l,onChange:e=>{l||(u(e??void 0),D())}}),z(`div`,{id:m,class:`rv-format-color-picker__custom-controls`,"data-selection-only":!c||void 0,hidden:!b,children:[z(cr,{type:`color`,disabled:l,class:`rv-format-color-picker__native`,"aria-label":r,title:r,value:Es(S)??Ms,onInput:e=>E(e.currentTarget.value)}),c?z(cr,{type:`text`,disabled:l,class:`rv-control rv-format-color-picker__hex`,inputMode:`text`,maxLength:7,"aria-label":i,"aria-invalid":w,"aria-describedby":w?h:void 0,title:i,value:S.toUpperCase(),onInput:e=>{C(e.currentTarget.value),w&&T(!1)},onChange:e=>E(e.currentTarget.value)}):null,c&&w?z(`span`,{id:h,class:`rv-format-color-picker__error`,role:`alert`,children:a}):null]}),z(ur,{unstyled:!0,type:`button`,class:`rv-format-color-picker__custom-action`,disabled:l,"aria-expanded":b,"aria-controls":m,title:r,onClick:()=>x(e=>!e),children:[z(Fs,{icon:Ps}),r]})]})]})}function Ls(e){let[t,n]=I(e.value);return z(Is,{...e,value:t,customHexLabel:e.customLabel,onChange:t=>{n(t),e.onChange(t)}})}function Rs(e,t){let n=ht(e.ownerDocument,z(Ls,{...t}));return e.append(n),{destroy(){gt(n)}}}function zs(e,{content:t,...n}){_t(e,z(Ti,{...n,children:t===void 0?n.children:typeof t==`string`?t:z(`span`,{ref:e=>{e&&e.replaceChildren(t)}})}))}function Bs(e,t){let n=ht(e,z(`div`,{}));return zs(n,t),n}function Vs(e){_t(e,null),gt(e)}var Hs={apply:`Apply`,cancel:`Cancel`,clear:`Clear`};function Us({apply:e,cancel:t,clear:n,disabled:r,text:i=Hs,showConfirm:a=!0}){if(!a&&!n)return null;let o={apply:i.apply??Hs.apply,cancel:i.cancel??Hs.cancel,clear:i.clear??Hs.clear};return z(`div`,{class:`rv-editor-actions`,children:[n&&z(B,{variant:`ghost`,className:`rv-editor-actions__clear`,onClick:n,children:o.clear}),a&&z(F,{children:[z(B,{onClick:t,children:o.cancel}),z(B,{variant:`primary`,disabled:r,onClick:e,children:o.apply})]})]})}var Ws=Ae(void 0);function Gs(e,t=!0){let n=Ye(Ws),r=R(e);r.current=e,L(()=>{if(t)return n?.(()=>r.current())},[n,t])}function Ks({initial:e,options:t,context:n,apply:r,cancel:i}){let[a,o]=I(e),[s,c]=I(!1),l=t.autoApply!==!1,u=R(!1),d=R(e),f=a===null||Array.isArray(a)&&!a.length;return Gs(()=>{if(!u.current)return!0;let e=d.current;return t.required&&(e===null||Array.isArray(e)&&!e.length)?!1:(u.current&&(u.current=!1,r(e)),!0)},l),z(`div`,{class:`rv-lookup-editor`,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&!(t.required&&f)&&(e.preventDefault(),r(a))},children:[z(Gn,{className:`rv-select`,source:t.source??[],dataSource:t.dataSource,dataContext:n,remoteText:t.text,value:a===null?void 0:a,onChange:e=>{u.current=!0,c(!0),d.current=e,o(e);let n=e===null||Array.isArray(e)&&!e.length;l&&!t.multiple&&!(t.required&&n)&&(u.current=!1,r(e))},placeholder:t.placeholder??t.text?.placeholder,renderOption:t.renderOption,renderValue:t.renderValue,config:{search:!0,multiSelect:t.multiple,topLayer:!0,autoFocus:!0,ariaLabel:t.text?.label??`Linked records`,searchPlaceholder:t.text?.searchPlaceholder,searchAriaLabel:t.text?.searchLabel,removeLabel:t.text?.removeLabel}}),t.required&&f&&s&&z(`span`,{role:`alert`,class:`rv-editor-error`,children:t.text?.requiredValue??`Select at least one record.`}),z(Us,{showConfirm:t.showActions??!l,text:t.actions,disabled:t.required&&f,cancel:i,apply:()=>r(a),clear:t.required?void 0:()=>{let e=t.multiple?[]:null;l?r(e):(d.current=e,o(e))}})]})}var qs=`rv-checkbox`;function Js(e,t={}){let{class:n,className:r,...i}=t,a=[qs,n,r].filter(Boolean).join(` `);return $n(e,`input`,{...i,class:a,type:`checkbox`})}function Ys({checked:e,indeterminate:t=!1,label:n,description:r,ariaLabel:i,controlClassName:a=``,inputRef:o,onChange:s,...c}){let l=Js(P,{...c,checked:e,"aria-label":i,"aria-checked":t?`mixed`:!!e,ref:e=>{e&&(e.indeterminate=t),o?.(e)},onChange:e=>{s?.(e.currentTarget.checked,e)}});return n===void 0&&r===void 0?l:P(`label`,{class:`rv-checkbox-control ${a}`.trim()},[l,P(`span`,{class:`rv-checkbox-control__copy`},[n===void 0?null:P(`span`,{class:`rv-checkbox-control__label`},n),r===void 0?null:P(`span`,{class:`rv-checkbox-control__description`},r)])])}function Xs({checked:e,onChange:t,label:n,ariaLabel:r,className:i=``,disabled:a=!1,labelPosition:o=`before`,title:s,testId:c}){let l=z(`span`,{class:`rv-switch-label`,children:n}),u=z(`span`,{class:`rv-switch-track`,"aria-hidden":`true`,children:z(`span`,{class:`rv-switch-thumb`})});return z(ur,{type:`button`,class:`rv-switch ${i}`.trim(),role:`switch`,"aria-checked":e,"aria-label":r??(typeof n==`string`?n:void 0),disabled:a,title:s,"data-testid":c,onClick:()=>t(!e),children:[o===`before`?l:u,o===`before`?u:l]})}var Zs=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM224 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm-8 64l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24z"/></svg>`;function Qs({value:e,options:t,onChange:n,ariaLabel:r,appearance:i=`soft`,scrollable:a=!1,size:o=`medium`,className:s=``,itemClassName:c=``,disabled:l=!1,testId:u}){let d=R(null),[f,p]=I(``),m=()=>{let e=d.current;if(!a||!e)return;let t=e.scrollLeft>1,n=e.scrollWidth-e.clientWidth-e.scrollLeft>1;p(`${t?`left`:``} ${n?`right`:``}`.trim())};L(()=>{if(!a||!d.current||(m(),typeof ResizeObserver>`u`))return;let e=new ResizeObserver(m);e.observe(d.current);for(let t of d.current.children)e.observe(t);return()=>e.disconnect()},[a,t]);let h=Array.isArray(e)?e:e===void 0?[]:[e];return z(`div`,{ref:d,onScroll:a?m:void 0,"data-scroll-edges":a?f:void 0,class:`rv-choice-chips rv-choice-chips--${i} rv-choice-chips--${o}${a?` rv-choice-chips--scrollable`:``} ${s}`.trim(),role:`group`,"aria-label":r,"data-testid":u,children:t.map(e=>{let t=h.includes(e.value),r=l||!!e.disabled;return z(ec,{className:`${c} ${e.className??``}`.trim(),style:e.style,color:e.color,selected:t,"aria-label":e.ariaLabel,title:e.title,disabled:r,"data-value":String(e.value),"data-testid":e.testId,onSelect:()=>{r||n(e.value,e)},info:e.info,onRemove:e.onRemove,removeLabel:e.removeLabel,children:e.label},String(e.value))})})}function $s({"data-tooltip":e,title:t,ref:n,...r}){let i=R(null),a=e??(typeof t==`object`?t.value:t);return L(()=>{if(!i.current||!a)return;let e=new Ht;return e.bind(i.current,a,{trigger:`click`}),()=>e.destroy()},[a]),z(ur,{...r,type:`button`,ref:e=>{i.current=e,typeof n==`function`?n(e):n&&(n.current=e)},class:`rv-choice-chip-info ${r.className??r.class??``}`.trim(),children:z(Kt,{svg:Zs,size:12})})}function ec({children:e,color:t,selected:n,onSelect:r,info:i,onRemove:a,removeLabel:o,removeClassName:s=``,className:c=``,disabled:l,...u}){let d=t?typeof u.style==`string`?`${u.style};--rv-choice-chip-color:${t}`:{...u.style,"--rv-choice-chip-color":t}:u.style;return!i&&!a&&r?z(`button`,{...u,style:d,"data-color":t?`true`:void 0,type:`button`,class:`rv-choice-chip ${c}`.trim(),"aria-pressed":n,disabled:l,onClick:r,children:e}):z(`span`,{class:`rv-choice-chip rv-choice-chip--composite ${c}`.trim(),role:u.role,style:d,"data-color":t?`true`:void 0,"data-selected":n?`true`:void 0,"aria-disabled":l||void 0,children:[r?z(`button`,{...u,type:`button`,class:`rv-choice-chip-label`,"aria-pressed":n,disabled:l,onClick:r,children:e}):z(`span`,{class:`rv-choice-chip-label`,children:e}),i,a&&z(zn,{compact:!0,className:s,disabled:typeof l==`object`?l.value:l,locale:{title:o??`Remove`,ariaLabel:o??`Remove`},onClick:a})]})}function tc(){return z(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,children:[z(`circle`,{cx:`11`,cy:`11`,r:`8`}),z(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]})}function nc({value:e=``,inputRef:t,rootClassName:n=``,inputClassName:r=``,iconClassName:i=``,shortcutClassName:a=``,shortcut:o,icon:s,leading:c,hideIcon:l=!1,trailing:u,testId:d,onValueChange:f,onInput:p,type:m=`search`,...h}){let g=e=>{p?.(e),f?.(e.currentTarget.value,e)};return qo(P,{rootClassName:n,inputClassName:r,iconClassName:i,shortcutClassName:a,shortcut:o,icon:s??z(tc,{}),hideIcon:l,leading:c,trailing:u,testId:d,inputAttributes:{...h,ref:t,type:m,value:e,onInput:g}})}function rc({children:e,removeLabel:t,onRemove:n,className:r=``,removeClassName:i=``,role:a}){return z(`span`,{class:`rv-btn-pill ${r}`.trim(),role:a,children:[e,n&&z(`button`,{type:`button`,class:`rv-chip-remove ${i}`.trim(),"aria-label":t,onClick:n,children:`×`})]})}function ic({label:e,children:t,hint:n,hintId:r,labelId:i=r?`${r}-label`:void 0}){let a=n!=null&&n!==!1;return[z(`span`,{class:`rv-field__label`,id:i,children:e}),a&&r?oc(t,r,i):t,a?z(`span`,{class:`rv-field__hint`,id:r,children:n}):null]}function ac({label:e,children:t,hint:n,hintId:r,labelId:i,controlId:a,className:o=``,class:s,...c}){let[l]=I(()=>Rt(`rv-field`)),u=Ye(qt),d=r??`rv-field-hint-${l}`,f=i??`${d}-label`;return z(qt.Provider,{value:{disabled:u.disabled,labelId:f,hintId:n==null||n===!1?void 0:d},children:z(`label`,{...c,htmlFor:a??c.htmlFor,class:[`rv-field`,o,s].filter(Boolean).join(` `),children:ic({label:e,children:t,hint:n,labelId:f,hintId:d})})})}function oc(e,t,n){if(Array.isArray(e))return e.map(e=>oc(e,t,n));if(!y(e))return e;if(e.type===F)return ke(e,{children:oc(e.props.children,t,n)});let r=rr(e.type);if(!r)return e;let i=e;return[`input`,`select`,`textarea`].includes(r)?ke(i,{"aria-describedby":[...new Set(`${i.props[`aria-describedby`]??``} ${t}`.trim().split(/\s+/))].join(` `),"aria-labelledby":i.props[`aria-labelledby`]??(i.props[`aria-label`]?void 0:n)}):ke(i,{children:oc(i.props.children,t,n)})}function sc({children:e,icon:t,iconClassName:n=``,iconPosition:r=`before`,className:i=``,class:a,...o}){let s=t==null?null:z(`span`,{class:[`rv-disclosure-summary__icon`,n].filter(Boolean).join(` `),"aria-hidden":`true`,children:t});return z(`summary`,{...o,class:[`rv-disclosure-summary`,i,a].filter(Boolean).join(` `),children:[r===`before`&&s,z(`span`,{class:`rv-disclosure-summary__label`,children:e}),r===`after`&&s]})}var cc=Object.freeze({previousMonth:`Previous month`,nextMonth:`Next month`,previousYear:`Previous year`,nextYear:`Next year`,chooseMonth:`Choose month`,chooseYear:`Choose year`,weekNumber:`Week number`,calendar:`Calendar`,today:`Today`,invalidSelection:`This date cannot be selected.`}),lc=/^\d{4}-\d{2}-\d{2}$/,uc=/^\d{4}-\d{2}-\d{2}T/;function dc(e){return lc.test(e)?new Date(`${e}T00:00:00Z`):new Date(e)}function fc(e){return uc.test(e)}function pc(e){return(typeof e==`string`?dc(e):e).getUTCDay()}function mc(e){return e.toISOString().slice(0,10)}var hc=new Map;function gc(e,t){let n=hc.get(t);n||(n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}),hc.set(t,n));let r=new Map(n.formatToParts(e).map(e=>[e.type,e.value]));return`${r.get(`year`).padStart(4,`0`)}-${r.get(`month`)}-${r.get(`day`)}`}function _c(e){let t=new Date(0);return t.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t.setUTCHours(0,0,0,0),mc(t)}function vc(e){return e.toISOString()}function yc(e){if(!e||!lc.test(e))return!1;let t=dc(e);return Number.isFinite(t.getTime())&&mc(t)===e}var bc=/^(\d{4})-(\d{2})-(\d{2})$/,xc=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/,Sc=/^(\d{2}):(\d{2})(?::(\d{2}))?$/;function Cc(e,t,n=`minute`){if(Number.isNaN(t.getTime()))return``;let r=`${Tc(t.getHours())}:${Tc(t.getMinutes())}${n===`second`?`:${Tc(t.getSeconds())}`:``}`;if(e===`time`)return r;let i=_c(t);return e===`date`?i:`${i}T${r}`}function wc(e,t,n=new Date){if(e===`time`){let e=Sc.exec(t);if(!e)return;let r=Number(e[1]),i=Number(e[2]),a=Number(e[3]??0);if(r>23||i>59||a>59||Number.isNaN(n.getTime()))return;let o=new Date(n.getTime());return o.setHours(r,i,a,0),o}let r=e===`date`?bc.exec(t):xc.exec(t);if(!r)return;let i=Number(r[1]),a=Number(r[2]),o=Number(r[3]),s=Number(r[4]??0),c=Number(r[5]??0),l=Number(r[6]??0),u=Number((r[7]??``).padEnd(3,`0`)),d=new Date(0);if(d.setFullYear(i,a-1,o),d.setHours(s,c,l,u),!(a<1||a>12||o<1||d.getFullYear()!==i||d.getMonth()!==a-1||d.getDate()!==o||d.getHours()!==s||d.getMinutes()!==c||d.getSeconds()!==l||d.getMilliseconds()!==u))return d}function Tc(e){return String(e).padStart(2,`0`)}var Ec=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/;function Dc(e){let t=new Date(0);return t.setUTCFullYear(e.year,e.month-1,e.day),t.setUTCHours(e.hour,e.minute,e.second,0),t.getTime()}function Oc(e){let t=Ec.exec(e);if(!t)return;let n={year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]),minute:Number(t[5]),second:Number(t[6]??0)},r=new Date(Dc(n)),i={year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds()};return Object.keys(n).every(e=>n[e]===i[e])?n:void 0}var kc=864e5;function Ac(e,t){let n=dc(e);return n.setTime(n.getTime()+t*kc),fc(e)?vc(n):mc(n)}function jc(e,t){return Math.round((dc(t).getTime()-dc(e).getTime())/kc)}function Mc(e,t){return dc(e).getTime()-dc(t).getTime()}function Nc(){return mc(new Date)}var Pc={m:`minute`,min:`minute`,mins:`minute`,minute:`minute`,minutes:`minute`,h:`hour`,hr:`hour`,hrs:`hour`,hour:`hour`,hours:`hour`,d:`day`,day:`day`,days:`day`,w:`week`,wk:`week`,wks:`week`,week:`week`,weeks:`week`,mo:`month`,mon:`month`,mons:`month`,month:`month`,months:`month`,q:`quarter`,qr:`quarter`,qtr:`quarter`,qtrs:`quarter`,quarter:`quarter`,quarters:`quarter`,y:`year`,yr:`year`,yrs:`year`,year:`year`,years:`year`},Fc={minute:[`minute`,`minutes`],hour:[`hour`,`hours`],day:[`day`,`days`],week:[`week`,`weeks`],month:[`month`,`months`],quarter:[`quarter`,`quarters`],year:[`year`,`years`]};function Ic(e){return typeof e==`number`&&Number.isFinite(e)?Math.min(20,Math.max(0,Math.floor(e))):1}function Lc(e,t){let n=t?.defaultUnit??`day`;if(typeof e==`number`)return Number.isFinite(e)&&e>=0?{value:e,unit:n,elapsed:!1}:null;if(typeof e!=`string`)return null;let r=e.trim().toLowerCase();if(!r)return null;let i=r.match(/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(.*)$/);if(!i)return null;let a=Number(i[1]);if(!Number.isFinite(a)||a<0)return null;let o=i[2].trim().replace(/\s+/g,` `),s=!1;if(o.startsWith(`elapsed `)?(s=!0,o=o.slice(8).trim()):o.startsWith(`e`)&&o.length>1&&Pc[o.slice(1)]&&(s=!0,o=o.slice(1)),s&&t?.allowElapsed===!1)return null;let c=o?Pc[o]:n;return c?{value:a,unit:c,elapsed:s}:null}function Rc(e,t){return Number(e.toFixed(Ic(t)))}function zc(e,t,n){let r=Rc(e,n?.maximumFractionDigits??1),i=Fc[t],a=Math.abs(Math.abs(r)-1)<1e-9?i[0]:i[1];return`${r} ${n?.elapsed?`elapsed `:``}${a}`}var Bc=new Map;function Vc(e,t,n){let r=JSON.stringify([e,t,n]),i=Bc.get(r);if(!i){if(i=new Intl.DateTimeFormat(e,{...n,calendar:t,timeZone:`UTC`}),i.resolvedOptions().calendar!==t)throw RangeError(`Unsupported calendar: ${t}`);Bc.set(r,i)}return i}function Hc(e,t,n,r=`gregory`){return Vc(t,r,n).format(dc(e))}function Uc(e,t=`gregory`){if(t===`gregory`){let t=dc(e);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate()}}let n=Vc(`en-US-u-nu-latn`,t,{year:`numeric`,month:`numeric`,day:`numeric`}).formatToParts(dc(e)),r=e=>Number(n.find(t=>t.type===e)?.value);return{year:r(`year`),month:r(`month`),day:r(`day`)}}function H(e,t=`gregory`){return Ac(e,1-Uc(e,t).day)}function Wc(e,t,n=`gregory`,r=!1){if(!Number.isInteger(t)||Math.abs(t)>12e3)throw RangeError(`Month offset must be an integer within 12000 months.`);let i=H(e,n);for(let e=0;e<Math.abs(t);e++)i=H(Ac(i,t>0?32:-1),n);if(!r)return i;let a=jc(i,H(Ac(i,32),n));return Ac(i,Math.min(Uc(e,n).day,a)-1)}function Gc(e,t=`gregory`){return Ac(Wc(e,1,t),-1)}function Kc(e,t=`gregory`){let n=Wc(e,1-Uc(e,t).month,t);return Array.from({length:12},(e,r)=>Wc(n,r,t))}function qc(e,t=1,n=4,r=`gregory`){let i=e=>{let r=Ac(e,n-1);return Ac(r,-((pc(r)-t+7)%7))},a=Kc(e,r)[0];return e<i(a)?a=Wc(a,-12,r):e>=i(Wc(a,12,r))&&(a=Wc(a,12,r)),Math.floor(jc(i(a),e)/7)+1}function Jc(e){return e.split(`T`)[0]}function Yc(e){return e.includes(`T`)?e.split(`T`)[1]:e}function Xc(e,t,n){return n===`datetime`?`${e}T${t.includes(`T`)?Yc(t):`00:00`}`:e}function Zc(e,t,n){return n===`datetime`?`${Jc(e)}T${t}`:t}function Qc(e,t){return e===`date`?yc(t):e===`datetime`?!!Oc(t.replace(/(\d{2}:\d{2}:\d{2})\.\d{1,3}$/,`$1`)):!!wc(e,t)}function $c(e){let t=wc(`time`,e);return t?t.getHours()*3600+t.getMinutes()*60+t.getSeconds():void 0}function el(e,t){let n=$c(e);if(n===void 0)return!1;let r=t.min?$c(t.min):void 0,i=t.max?$c(t.max):void 0;return(r===void 0||n>=r)&&(i===void 0||n<=i)&&(t.step===void 0||t.step>0&&(n-(r??0))%t.step===0)}function tl(e,t,n=`minute`,r){let i=wc(`time`,e);return i?new Intl.DateTimeFormat(r??(t===`12h`?`en-US`:`en-GB`),{hour:`2-digit`,minute:`2-digit`,...n===`second`?{second:`2-digit`}:{},hourCycle:t===`12h`?`h12`:`h23`}).format(i):e}function nl(e,t=`minute`,n){if(e=e.replace(/[\u200e\u200f\u061c]/g,``).trim(),n){let t=new Intl.NumberFormat(n,{useGrouping:!1});for(let n=0;n<10;n++)e=e.split(t.format(n)).join(String(n));let r=new Intl.DateTimeFormat(n,{hour:`numeric`,hourCycle:`h12`});for(let[t,n]of[[1,`AM`],[13,`PM`]]){let i=r.formatToParts(new Date(2e3,0,1,t)).find(e=>e.type===`dayPeriod`)?.value;i&&(e=e.replace(i,n))}let i=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(new Date(2e3,0,1,13,45,20));for(let t of i)t.type===`literal`&&t.value.trim()&&(e=e.split(t.value).join(`:`));e=e.replace(/^\s*(AM|PM)\s*(.*)$/i,`$2 $1`)}let r=wc(`time`,e.trim());if(r)return Cc(`time`,r,t);let i=/^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*([ap])\.?m\.?$/i.exec(e.trim());if(!i)return;let a=Number(i[1]);if(a<1||a>12)return;let o=wc(`time`,`${String(a%12+(i[4].toLowerCase()===`p`?12:0)).padStart(2,`0`)}:${i[2]}:${i[3]??`00`}`);return o?Cc(`time`,o,t):void 0}function rl(e,t){if(e==null||typeof e==`string`&&!e.trim())return{valid:!t.required,value:null};let n=Lc(typeof e==`object`&&e&&`unit`in e&&`value`in e?`${String(e.value)}${`elapsed`in e&&e.elapsed?` elapsed `:` `}${String(e.unit)}`:e,{...t,allowElapsed:t.allowElapsed??!1}),r=!!n&&(!t.allowedUnits||t.allowedUnits.includes(n.unit))&&(t.min===void 0||n.value>=t.min)&&(t.max===void 0||n.value<=t.max);return{valid:r,value:r?n:null}}function il(e){return e.format===`eu`?`en-GB`:e.format===`us`?`en-US`:e.locale}function al(e){return new Intl.DateTimeFormat(il(e),{calendar:`gregory`,timeZone:`UTC`,day:`2-digit`,month:`2-digit`,year:`numeric`}).formatToParts(new Date(`2006-11-22T00:00:00Z`))}function ol(e={}){return!e.format||e.format===`iso`?`YYYY-MM-DD`:al(e).map(e=>e.type===`year`?`YYYY`:e.type===`month`?`MM`:e.type===`day`?`DD`:e.value).join(``)}function sl(e,t={}){return yc(e)?t.formatValue?t.formatValue(e):!t.format||t.format===`iso`?e:Hc(e,il(t)??new Intl.DateTimeFormat().resolvedOptions().locale,{day:`2-digit`,month:`2-digit`,year:`numeric`}):e}function cl(e,t={}){let n=e.trim();if(yc(n))return n;if(t.parse){let e=t.parse(n);return yc(e)?e:void 0}if(!t.format||t.format===`iso`)return;let r=n.normalize(`NFKC`).replace(/[\u200e\u200f\u061c]/g,``),i=new Intl.NumberFormat(il(t),{useGrouping:!1});for(let e=0;e<10;e++)r=r.split(i.format(e)).join(String(e));let a=r.split(/[./\-\s]+/),o=al(t).filter(e=>[`year`,`month`,`day`].includes(e.type));if(a.length!==3||a.some(e=>!/^\d{1,4}$/.test(e)))return;let s=Object.fromEntries(o.map((e,t)=>[e.type,a[t]]));if(s.year.length!==4)return;let c=`${s.year}-${s.month.padStart(2,`0`)}-${s.day.padStart(2,`0`)}`;return yc(c)?c:void 0}function ll(e){let t=e.min?$c(e.min):void 0,n=e.max?$c(e.max):void 0,r=e.step??(e.precision===`second`?1:60);if(!Number.isFinite(r)||r<=0)return[];let i=e.precision===`second`?1:60,a=[];for(let e=0;e<86400;e+=i)(t===void 0||e>=t)&&(n===void 0||e<=n)&&(e-(t??0))%r===0&&a.push(e);return a}function ul(e,t=`minute`){let n=e=>String(e).padStart(2,`0`);return`${n(Math.floor(e/3600))}:${n(Math.floor(e/60)%60)}${t===`second`?`:${n(e%60)}`:``}`}function dl(e,t){return e===`12h`||e===`locale`&&!!new Intl.DateTimeFormat(t,{hour:`numeric`}).resolvedOptions().hour12}function fl(e,t){return new Intl.DateTimeFormat(t,{hour:`numeric`,hourCycle:`h12`}).formatToParts(new Date(2e3,0,1,e?13:1)).find(e=>e.type===`dayPeriod`)?.value??(e?`PM`:`AM`)}function pl(e,t,n){let r=$c(t),i=r??e[0]??0,a=Math.floor(i/3600),o=Math.floor(i/60)%60,s=i%60,c={hour:new Map,minute:new Map,second:new Map,period:new Map},l=(e,t,n,r)=>{let i=c[e].get(t);(i===void 0||Math.abs(n-r)<Math.abs(i-r))&&c[e].set(t,n)};for(let t of e){let e=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;(!n||Math.floor(e/12)===Math.floor(a/12))&&l(`hour`,e,t,e*3600+o*60+s),e===a&&l(`minute`,r,t,a*3600+r*60+s),e===a&&r===o&&l(`second`,i,t,a*3600+o*60+i);let c=Math.floor(e/12);l(`period`,c,t,(a%12+c*12)*3600+o*60+s)}return{columns:c,hour:a,minute:o,second:s,period:Math.floor(a/12),hasValue:r!==void 0}}function ml(e,t,n=!0,r=`gregory`){let i=H(e,r),a=Ac(i,-((pc(i)-t+7)%7)),o=Gc(i,r),s=[];for(let e=a;e<=o||s.length%7;e=Ac(e,1))s.push(e);if(!n||s.length>=42)return s;let c=[...s];for(;c.length<42;)c.push(Ac(c[c.length-1],1));return c}function hl(e,t){return Mc(e,t)<=0?{from:e,to:t}:{from:t,to:e}}function gl(e,t){return!!t&&Mc(e,t.from)>=0&&Mc(e,t.to)<=0}function _l(e,t){return!!(t.minDate&&Mc(e,t.minDate)<0||t.maxDate&&Mc(e,t.maxDate)>0||t.isDisabled?.(e))}function vl(e,t){let n=H(e,t.calendarSystem);return!!(t.minDate&&Mc(Gc(n,t.calendarSystem),t.minDate)<0||t.maxDate&&Mc(n,t.maxDate)>0||t.isMonthDisabled?.(n))}function yl(e){let{date:t,key:n,shiftKey:r,weekStartsOn:i}=e,a=(pc(t)-i+7)%7,o,s=0;if(n===`ArrowLeft`&&([o,s]=e.dir===`rtl`?[Ac(t,1),1]:[Ac(t,-1),-1]),n===`ArrowRight`&&([o,s]=e.dir===`rtl`?[Ac(t,-1),-1]:[Ac(t,1),1]),n===`ArrowUp`&&([o,s]=[Ac(t,-7),-7]),n===`ArrowDown`&&([o,s]=[Ac(t,7),7]),n===`Home`&&([o,s]=[Ac(t,-a),1]),n===`End`&&([o,s]=[Ac(t,6-a),-1]),n===`PageUp`&&([o,s]=[Wc(t,r?-12:-1,e.calendarSystem,!0),-1]),n===`PageDown`&&([o,s]=[Wc(t,r?12:1,e.calendarSystem,!0),1]),o){for(let t=0;t<3660&&_l(o,e);t++)o=Ac(o,s);return _l(o,e)?void 0:o}}function bl({label:e,previousLabel:t,nextLabel:n,labelAction:r,caption:i,showLabel:a=!0,showPrevious:o=!0,showNext:s=!0,previousDisabled:c=!1,nextDisabled:l=!1,onPrevious:u,onNext:d}){return z(`header`,{class:`revo-calendar__header`,children:[o?z(`button`,{type:`button`,"aria-label":t,disabled:c,onClick:u,children:z(`span`,{"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:br}})}):z(`span`,{"aria-hidden":`true`}),a&&i?i:a&&r?z(`button`,{type:`button`,class:`revo-calendar__month-label revo-calendar__month-label-button`,"aria-label":r.ariaLabel,onClick:r.onClick,children:z(`span`,{"aria-live":`polite`,children:e})}):a?z(`strong`,{class:`revo-calendar__month-label`,"aria-live":`polite`,children:e}):z(`span`,{"aria-hidden":`true`}),s?z(`button`,{type:`button`,"aria-label":n,disabled:l,onClick:d,children:z(`span`,{"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:xr}})}):z(`span`,{"aria-hidden":`true`})]})}function xl({dates:e,locale:t,format:n,weekNumberLabel:r}){return z(`div`,{class:`revo-calendar__weekdays`,role:`row`,children:[r&&z(`span`,{role:`columnheader`,"aria-label":r,children:`#`}),e.map(e=>z(`span`,{role:`columnheader`,children:n(e,t)},e))]})}function Sl({month:e,system:t,locale:n,layout:r,start:i,end:a,disabled:o,labels:s,onChange:c}){let l=Kc(e,t),u=Uc(e,t),d=qe(()=>{let n=Kc(e,t)[0],r=i?Kc(i,t)[0]:Wc(n,-600,t),o=a?Kc(a,t)[0]:Wc(n,120,t),s=[];for(let e=r;e<=o;e=Wc(e,12,t))s.push(e);return s.includes(n)||s.push(n),s.sort()},[e,t,i,a]);return z(`div`,{class:`revo-calendar__caption`,children:[r===`dropdown-years`?z(`span`,{children:Hc(e,n,{month:`long`},t)}):z(Gn,{className:`rv-select`,config:{ariaLabel:s.chooseMonth,topLayer:!0,nativeTabNavigation:!0},disabled:o,value:String(u.month),source:l.map((e,r)=>({value:String(r+1),label:Hc(e,n,{month:`short`},t),disabled:!!(i&&e<H(i,t)||a&&e>H(a,t))})),onChange:e=>c(l[Number(e)-1])}),r===`dropdown-months`?z(`span`,{children:Hc(e,n,{year:`numeric`},t)}):z(Gn,{className:`rv-select`,config:{ariaLabel:s.chooseYear,topLayer:!0,nativeTabNavigation:!0},disabled:o,value:l[0],source:d.map(e=>({value:e,label:Hc(e,n,{year:`numeric`},t)})),onChange:e=>{let n=Wc(e,u.month-1,t);i&&n<H(i,t)&&(n=H(i,t)),a&&n>H(a,t)&&(n=H(a,t)),c(n)}})]})}function Cl(e){let t=[`revo-calendar__day`,e.className,e.outside&&`outside`,e.disabled&&`disabled`,e.selected&&`in-range`,e.previewed&&`in-preview`,e.previewInvalid&&`in-invalid-preview`,e.rangeStart&&`range-start`,e.rangeEnd&&`range-end`,e.previewStart&&`preview-start`,e.previewEnd&&`preview-end`].filter(Boolean).join(` `);return z(`button`,{ref:t=>e.setRef(e.date,t),type:`button`,role:`gridcell`,"data-calendar-date":e.date,class:t,disabled:e.disabled||e.hidden,tabIndex:!e.hidden&&e.focused?0:-1,"aria-hidden":e.hidden||void 0,"aria-selected":e.selected||void 0,"aria-invalid":e.previewInvalid||void 0,"aria-describedby":e.previewInvalid?e.previewDescriptionId:void 0,"aria-current":e.today?`date`:void 0,"aria-label":e.label,onFocus:()=>{e.onFocus(e.date),e.onPreview(e.date)},onMouseEnter:()=>e.onPreview(e.date),onMouseLeave:()=>e.onPreview(),onKeyDown:t=>e.onKeyDown(t,e.date),onClick:()=>e.onSelect(e.date),children:e.content??dc(e.date).getUTCDate()})}function wl({dates:e,system:t=`gregory`,selectedDates:n,visibleMonths:r,weekNumber:i,weekNumberLabel:a=`Week number`,month:o,focusedDate:s,referenceDate:c,selection:l,preview:u,previewInvalid:d,previewDescriptionId:f,showOutsideDays:p,allowOutsideMonthSelection:m,dayClassName:h,renderDay:g,isDisabled:_,formatDayLabel:v,setDayRef:y,onFocus:b,onPreview:x,onKeyDown:S,onSelect:C}){return z(`div`,{class:`revo-calendar__month-grid`,children:Array.from({length:e.length/7},(w,T)=>z(`div`,{class:`revo-calendar__week`,role:`row`,"aria-hidden":!i&&e.slice(T*7,T*7+7).every(e=>H(e,t)!==o&&(!p||r?.includes(H(e,t))))||void 0,children:[i&&z(`span`,{class:`revo-calendar__week-number`,role:`rowheader`,"aria-label":`${a} ${i(e[T*7])}`,children:i(e[T*7])}),e.slice(T*7,T*7+7).map(e=>{let i=H(e,t)!==o,a=i&&(!p||!!r?.includes(H(e,t))),w=_(e)||i&&!m,T={outside:i,disabled:w,selected:!!n?.includes(e)||gl(e,l),previewed:gl(e,u),today:e===c};return z(Cl,{date:e,label:v(e),className:typeof h==`function`?h(e,T):h,outside:i,hidden:a,disabled:w,focused:e===s,selected:T.selected,previewed:T.previewed,previewInvalid:T.previewed&&d,previewDescriptionId:f,rangeStart:n?.includes(e)||l?.from===e,rangeEnd:n?.includes(e)||l?.to===e,previewStart:u?.from===e,previewEnd:u?.to===e,today:T.today,content:g?.(e,T),setRef:(e,t)=>{i||y(e,t)},onFocus:b,onPreview:x,onKeyDown:S,onSelect:C},e)})]},T))})}function Tl({month:e,system:t=`gregory`,referenceDate:n,minDate:r,maxDate:i,isMonthDisabled:a,locale:o,ariaLabel:s,onSelect:c,onEscape:l}){return z(`div`,{class:`revo-calendar__year-grid`,role:`group`,"aria-label":s,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),l())},children:Kc(e,t).map(s=>{let l=vl(s,{minDate:r,maxDate:i,isMonthDisabled:a,calendarSystem:t}),u=s===e,d=n?H(n,t)===s:!1;return z(`button`,{type:`button`,class:`revo-calendar__month${u?` active`:``}${d?` current`:``}`,"data-calendar-month":s,"aria-pressed":u?`true`:`false`,disabled:l,onClick:()=>c(s),children:Hc(s,o,{month:`long`},t)},s)})})}var El=`2026-08-02`;function Dl({locale:e=`en-US`,weekStartsOn:t=1,showOutsideDays:n=!1,allowOutsideMonthSelection:r=!1,fixedWeeks:i=!0,showTodayButton:a=!1,showHeader:o=!0,showNavigation:s=!0,showPreviousButton:c=s,showNextButton:l=s,showMonthLabel:u=!0,showWeekdays:d=!0,enableYearView:f=!0,translations:p={},...m}){let[h]=I(()=>Rt(`rv-calendar-feedback`)),g=m.calendarSystem??`gregory`,_=Math.max(1,Math.min(12,Math.trunc(m.numberOfMonths||1))),v=qe(()=>{let e=m.views?[...new Set(m.views.filter(e=>e===`month`||e===`year`))]:f?[`month`,`year`]:[`month`];return e.length?e:[`month`]},[m.views,f]),[y,b]=I(m.defaultView&&v.includes(m.defaultView)?m.defaultView:v[0]),x=v.includes(y)?y:v[0],S=H(m.month,g),C=qe(()=>Array.from({length:_},(e,t)=>Wc(S,t,g)),[S,_,g]),w=m.reverseMonths?[...C].reverse():C,T=qe(()=>Array.from({length:7},(e,n)=>Ac(El,(t+n)%7)),[t]),E=m.referenceDate??(m.referenceInstant?gc(m.referenceInstant,m.timeZone??`UTC`):void 0),D=R(new Map),O=R(!1),k={...cc,...p},A=e=>vl(e,{minDate:m.minDate,maxDate:m.maxDate,isMonthDisabled:m.isMonthDisabled,calendarSystem:g}),j=[m.startMonth,m.minDate].filter(e=>!!e).map(e=>H(e,g)).sort().at(-1),M=[m.endMonth,m.maxDate].filter(e=>!!e).map(e=>H(e,g)).sort().at(0),ee=e=>!!(m.disableNavigation||A(e)||j&&e<j||M&&e>M),te=(e,t=_)=>{let n=M?Wc(M,1-t,g):void 0;return n&&j&&n<j&&(n=j),n&&e>n&&(e=n),j&&e<j&&(e=j),e},ne=new Map,N=e=>{let t=ne.get(e);if(t!==void 0)return t;let n=A(H(e,g))||_l(e,{minDate:m.minDate,maxDate:m.maxDate,isDisabled:m.isDateDisabled});return ne.set(e,n),n},re=C.includes(H(m.focusedDate,g))&&!N(m.focusedDate)?m.focusedDate:C.flatMap(e=>ml(e,t,!1,g)).find(e=>C.includes(H(e,g))&&!N(e))??m.focusedDate,P=e=>{e!==x&&v.includes(e)&&(b(e),m.onViewChange?.(e))},ie=(e,t=m.onSelect)=>{if(N(e))return m.onInvalidSelection?.(k.invalidSelection,e),!1;let n=m.validateSelection?.(e,{month:S,view:x,selection:m.selection,preview:m.preview,referenceDate:E});return n===!1||typeof n==`string`?(m.onInvalidSelection?.(typeof n==`string`?n:k.invalidSelection,e),!1):(t(e),!0)},F=(e,t)=>{t?D.current.set(e,t):D.current.delete(e),t&&O.current&&e===m.focusedDate&&(O.current=!1,queueMicrotask(()=>t.focus()))},ae=(e,n)=>{let r=m.dir??(e.currentTarget.ownerDocument.defaultView?.getComputedStyle(e.currentTarget).direction===`rtl`?`rtl`:`ltr`),i=yl({date:n,key:e.key,shiftKey:e.shiftKey,weekStartsOn:t,minDate:m.minDate,maxDate:m.maxDate,isDisabled:N,dir:r,calendarSystem:g});if(!i)return;e.preventDefault();let a=H(i,g);(C.includes(a)||!ee(a))&&(O.current=!0,C.includes(a)||m.onMonthChange(te(a)),m.onFocusedDateChange(i),queueMicrotask(()=>{let e=D.current.get(i);e&&(O.current=!1,e.focus())}))},oe=t=>m.formatMonth?.(t,e)??Hc(t,e,{month:`long`,year:`numeric`},g),se=x===`year`,ce=se?12:m.pagedNavigation?_:1,le=te(Wc(S,-ce,g),se?1:_),ue=te(Wc(S,ce,g),se?1:_),de=(e,t=se?1:_)=>{let n=te(e,t);ee(n)||m.onMonthChange(n)},fe=e=>{ie(e,m.onPresetSelect??m.onSelect)&&(m.onMonthChange(te(H(e,g))),m.onFocusedDateChange(e),P(`month`))};return z(`div`,{class:`revo-calendar${m.showWeekNumber?` revo-calendar--week-numbers`:``}${m.className?` ${m.className}`:``}`,dir:m.dir,style:m.cellSize?{"--revo-calendar-cell-size":`${Math.max(24,m.cellSize)}px`}:void 0,children:[z(`div`,{class:`revo-calendar__months`,children:(se?[S]:w).map((a,s)=>z(`section`,{class:`revo-calendar__month-panel`,children:[o&&z(bl,{label:se?Hc(a,e,{year:`numeric`},g):oe(a),previousLabel:se?k.previousYear:k.previousMonth,nextLabel:se?k.nextYear:k.nextMonth,caption:!se&&m.captionLayout&&m.captionLayout!==`label`?z(Sl,{month:a,system:g,locale:e,layout:m.captionLayout,start:j,end:M,disabled:m.disableNavigation,labels:k,onChange:e=>de(Wc(e,-C.indexOf(a),g))}):void 0,labelAction:!m.disableNavigation&&!se&&v.includes(`year`)?{ariaLabel:`${k.chooseMonth}: ${oe(a)}`,onClick:()=>P(`year`)}:void 0,showLabel:u,showPrevious:c&&s===0,showNext:l&&s===(se?0:_-1),previousDisabled:le>=S||ee(le),nextDisabled:ue<=S||ee(ue),onPrevious:()=>de(le),onNext:()=>de(ue)}),se?z(Tl,{month:S,system:g,referenceDate:E,minDate:m.minDate,maxDate:m.maxDate,isMonthDisabled:m.isMonthDisabled,locale:e,ariaLabel:`${k.chooseMonth} ${Hc(S,e,{year:`numeric`},g)}`,onEscape:()=>P(`month`),onSelect:e=>{de(e,_),P(`month`)}}):z(`div`,{class:`revo-calendar__calendar`,role:`grid`,"aria-label":`${oe(a)} ${k.calendar}`,children:[d&&z(xl,{dates:T,locale:e,format:m.formatWeekday??((e,t)=>Hc(e,t,{weekday:/^(fa|ar)(-|$)/.test(t)?`narrow`:`short`},g)),weekNumberLabel:m.showWeekNumber?k.weekNumber:void 0}),z(wl,{dates:ml(a,t,i,g),month:a,system:g,visibleMonths:C,focusedDate:re,referenceDate:E,selection:m.selection,selectedDates:m.selectedDates,preview:m.preview,previewInvalid:m.previewInvalid,previewDescriptionId:m.previewDescription?h:void 0,showOutsideDays:n,allowOutsideMonthSelection:r,dayClassName:m.dayClassName,renderDay:m.renderDay??(t=>Hc(t,e,{day:`numeric`},g)),isDisabled:N,formatDayLabel:t=>m.formatDayLabel?.(t,e)??Hc(t,e,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`},g),weekNumber:m.showWeekNumber?n=>{let r=qc(m.weekNumbering===`local`?n:Ac(n,(4-pc(n)+7)%7),m.weekNumbering===`local`?t:1,m.weekNumbering===`local`?1:4,m.weekNumbering===`local`?g:`gregory`);return m.formatWeekNumber?.(r)??new Intl.NumberFormat(e).format(r)}:void 0,weekNumberLabel:k.weekNumber,setDayRef:F,onFocus:m.onFocusedDateChange,onPreview:e=>m.onPreviewDateChange?.(e),onKeyDown:ae,onSelect:ie})]})]},a))}),m.presets?.length?z(`div`,{class:`revo-calendar__presets`,children:m.presets.map(e=>z(ur,{disabled:N(e.date),onClick:()=>fe(e.date),children:e.label},e.label))}):null,a&&E&&z(`button`,{type:`button`,class:`revo-calendar__today`,disabled:N(E),onClick:()=>fe(E),children:k.today}),m.previewDescription!==void 0&&z(`p`,{id:h,class:`revo-calendar__feedback`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:m.previewDescription}),m.footer&&z(`div`,{class:`revo-calendar__footer`,children:m.footer})]})}function Ol(e){let{selected:t,onSelectionChange:n,presets:r,mode:i=`single`,min:a=0,max:o=1/0,required:s=!1,excludeDisabled:c=!1,month:l,defaultMonth:u,onMonthChange:d,...f}=e,p=typeof t==`string`?t:Array.isArray(t)?t[0]:t?.from,[m,h]=I(u??p??e.referenceDate??Nc()),[g,_]=I(p??m),[v,y]=I(),[b,x]=I(),S=e=>{y(e),x(void 0)},C=l??m,w=e.views?.filter(e=>e===`month`||e===`year`),T=w?.length?w:e.views||e.enableYearView===!1?[`month`]:[`month`,`year`],[E,D]=I(e.defaultView&&T.includes(e.defaultView)?e.defaultView:T[0]),O=T.includes(E)?E:T[0],k=e=>{h(e),S(),d?.(e)},A=e.translations?.invalidSelection??cc.invalidSelection,j=(t,n=A)=>{y(t),x(n),e.onInvalidSelection?.(n,t)},M=t=>!!(e.minDate&&t<e.minDate||e.maxDate&&t>e.maxDate||e.isDateDisabled?.(t)||e.isMonthDisabled?.(H(t,e.calendarSystem))),ee=e=>{if(!e.to)return!M(e.from);let t=jc(e.from,e.to);if(t<a||t>o||t<0||M(e.from)||M(e.to))return!1;if(c){if(t>366e3)return!1;for(let t=e.from;t<=e.to;t=Ac(t,1))if(M(t))return!1}return!0},te=t=>{if(e.mode===`multiple`){let n=e.selected??[],r=n.includes(t),i=r?n.filter(e=>e!==t):[...n,t];if(r&&i.length<Math.max(a,+!!s)||i.length>o){j(t);return}e.onSelectionChange(i)}else if(e.mode===`range`){let n=e.selected;if(!n||n.to){e.onSelectionChange({from:t}),S();return}let r=hl(n.from,t);if(!ee(r)){c&&jc(r.from,r.to)>=a&&jc(r.from,r.to)<=o&&e.onSelectionChange({from:t}),j(t);return}e.onSelectionChange(r),S()}else e.onSelectionChange(e.selected===t&&!s?void 0:t)},ne=e.mode===`range`?e.selected:void 0,N=typeof t==`string`?{from:t,to:t}:ne?{from:ne.from,to:ne.to??ne.from}:void 0,re=ne&&!ne.to&&v?hl(ne.from,v):void 0,P=t=>{let n=e.validateSelection?.(t,{month:H(C,e.calendarSystem),view:O,selection:N,preview:re,referenceDate:e.referenceDate??(e.referenceInstant?gc(e.referenceInstant,e.timeZone??`UTC`):void 0)});if(n===!1||typeof n==`string`)return typeof n==`string`?n:A},ie=re&&!ee(re)?A:void 0,ae=b??ie,oe=e=>{let t=P(e);return!t||(j(e,t),!1)},se=t=>{let n=t.selection,r;if(e.mode===`multiple`){if(!Array.isArray(n)||n.length<Math.max(a,+!!s)||n.length>o||n.some(M))return;let t=[...new Set(n)];if(t.length<Math.max(a,+!!s)||!t.every(oe))return;e.onSelectionChange(t),r=t[0]??C}else if(e.mode===`range`){if(!n?.from||!ee(n)||!oe(n.from)||n.to&&!oe(n.to))return;e.onSelectionChange(n),r=n.from}else{if(typeof n!=`string`||M(n)||!oe(n))return;e.onSelectionChange(n),r=n}_(r),k(H(r,e.calendarSystem)),S()};return z(Dl,{...f,onViewChange:t=>{D(t),S(),e.onViewChange?.(t)},month:C,focusedDate:g,onFocusedDateChange:_,onMonthChange:k,selection:N,selectedDates:e.mode===`multiple`?e.selected:void 0,preview:re,previewInvalid:!!(re&&ae),previewDescription:i===`range`?ae??``:void 0,onInvalidSelection:(e,t)=>j(t,e),fixedWeeks:e.fixedWeeks??!1,showOutsideDays:e.showOutsideDays??!0,allowOutsideMonthSelection:e.allowOutsideMonthSelection??!0,onPresetSelect:t=>{if(e.mode===`multiple`){let n=e.selected??[];if(n.includes(t))return;if(n.length>=o){j(t);return}e.onSelectionChange([...n,t])}else e.mode===`range`?e.onSelectionChange({from:t}):e.onSelectionChange(t)},onSelect:te,onPreviewDateChange:S,footer:r?.length||e.footer?z(F,{children:[r?.length?z(`div`,{class:`revo-calendar__presets`,children:r.map(e=>z(ur,{onClick:()=>se(e),children:e.label},e.label))}):null,e.footer]}):void 0})}function kl(e){return String(e)}function Al(e){return[...new Map(e.map(e=>[kl(e),e])).values()]}function jl(e,t){return e?{[e]:t}:{}}function Ml(...e){return e.filter(Boolean).join(` `)}var Nl=[`#22d3ee`,`#34d399`,`#facc15`,`#fb7185`,`#a78bfa`,`#60a5fa`,`#f97316`,`#2dd4bf`];function Pl(e){return io(e)||`?`}function Fl(e){return Nl[[...String(e)].reduce((e,t)=>e+t.charCodeAt(0),0)%Nl.length]}function Il(e){let t=e.trim().match(/^#([\da-f]{3}|[\da-f]{6})$/i)?.[1];if(!t)return`#0f172a`;let n=t.length===3?[...t].map(e=>e.repeat(2)).join(``):t,r=[0,2,4].map(e=>Number.parseInt(n.slice(e,e+2),16)/255).map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,n)=>e+t*([.2126,.7152,.0722][n]??0),0);return r<=.179?`#fff`:r<.25?`#000`:`#0f172a`}function Ll({resource:e,className:t,color:n}){let[r,i]=I(),a=e.name.trim()||`Unnamed resource`,o=!!e.avatarUrl&&r===e.avatarUrl,s=n??e.color??Fl(e.id);return z(`span`,{class:Ml(`avatar-cell rv-resource-picker__avatar`,t),style:{"--avatar-cell-background":s,"--avatar-cell-size":`30px`,"--rv-resource-picker-avatar-color":Il(s)},role:`img`,"aria-label":a,children:e.avatarUrl&&!o?z(`img`,{class:`avatar-cell__image`,src:e.avatarUrl,alt:a,onError:()=>i(e.avatarUrl)}):Pl(e.name)})}function Rl({resource:e,selected:t,selectedResourceIds:n,disabled:r,readOnly:i=!1,multiple:a,resourceDataAttribute:o,classNames:s,isResourceDisabled:c,getAvatarColor:l,optionId:u,focused:d=!1,onFocus:f,onChange:p}){let m=c?.(e)===!0;return z(`label`,{class:Ml(`rv-resource-picker__option`,i?`rv-resource-picker__option--readonly`:void 0,d?`rv-resource-picker__option--focused`:void 0,s?.option),id:i?u:void 0,role:i&&u?`option`:void 0,"aria-selected":i&&u?t:void 0,"data-selected":t?`true`:`false`,onMouseEnter:f,children:[!i&&z(`input`,{type:`checkbox`,id:u,role:u?`option`:void 0,"aria-selected":u?t:void 0,checked:t,disabled:r||m&&!t,...jl(o,String(e.id)),onChange:t=>{let r=t.currentTarget;p(r.checked?a?Al([...n,e.id]):[e.id]:n.filter(t=>kl(t)!==kl(e.id)))}}),z(Ll,{resource:e,className:s?.avatar,color:l?.(e)}),z(`span`,{class:Ml(`rv-resource-picker__details`,s?.details),children:[z(`strong`,{children:e.name}),e.role?z(`em`,{children:e.role}):null]})]})}function zl({triggerRef:e,portalTarget:t,popupId:n,children:r}){return z(kn,{triggerRef:e,portalTarget:t,dropdownMenuId:n,popupClassName:`rv-resource-picker__portal`,matchTriggerWidth:!0,onPointerRelease:e=>{e.type===`mouseup`?e.preventDefault():e.stopPropagation()},children:r})}function Bl({resources:e,selectedResourceIds:t,text:n,onChange:r,classNames:i,disabled:a=!1,readOnly:o=!1,presentation:s=`inline`,multiple:c=!0,preserveOrder:l=!1,unassigned:u,resourceDataAttribute:d,isResourceDisabled:f,getAvatarColor:p}){let m=R(null),h=R(null),g=R(null),_=R(null),v=An(`.rv-resource-picker__option`),y=R(!1),[b]=I(()=>Rt(`rv-resource-list`)),x=`${b}-popup`,S=s===`dropdown`,[C,w]=I(!1),[T,E]=I(``),[D,O]=I(0),k=Je(()=>{w(!1),E(``)},[]),A=new Set(t.map(kl)),j=qe(()=>l?[...e]:[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:`base`})),[l,e]),M=qe(()=>{let e=T.trim().toLocaleLowerCase();return e?j.filter(t=>`${t.name} ${t.role??``}`.toLocaleLowerCase().includes(e)):j},[T,j]),ee=qe(()=>{let n=new Map(e.map(e=>[kl(e.id),e]));return t.map(e=>n.get(kl(e))).filter(e=>!!e)},[e,t]),te=S&&D>=0&&D<M.length?`${b}-option-${D}`:void 0;Ke(()=>{if(!S||!C)return;let e=e=>{let t=e.target,n=m.current?.ownerDocument.getElementById(x);!m.current?.contains(t)&&!n?.contains(t)&&k()},t=e=>{let t=m.current?.ownerDocument.getElementById(x),n=e.target;n instanceof Node&&t?.contains(n)||k()},n=()=>k();document.addEventListener(`pointerdown`,e),document.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,n);let r=window.requestAnimationFrame(()=>g.current?.focus());return()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,n),window.cancelAnimationFrame(r)}},[k,S,C,x]),Ke(()=>{O(M.length>0?0:-1)},[M]),Ke(()=>{if(!C||!te||!_.current||!y.current)return;let e=_.current.ownerDocument.getElementById(te);e&&_.current.contains(e)&&e.closest(`.rv-resource-picker__option`)?.scrollIntoView?.({block:`nearest`})},[te,C]);let ne=e=>{o||(r(e),!c&&S&&k())},N=()=>{let e=M[D];if(!e)return;let n=kl(e.id);(!f?.(e)||A.has(n))&&ne(A.has(n)?t.filter(e=>kl(e)!==n):c?Vl([...t,e.id]):[e.id])},re=e=>{if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),k(),h.current?.focus();else if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),e.stopPropagation(),!M.length)return;y.current=!0,O(t=>e.key===`ArrowDown`?t>=M.length-1?0:t+1:t<=0?M.length-1:t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),N())},P=typeof document>`u`?null:m.current?.closest(`dialog, .rv-dialog-overlay`)??document.body,ie=z(`div`,{ref:v,class:`rv-resource-picker__popover`,onKeyDown:S?re:void 0,children:[z(nc,{inputRef:g,rootClassName:`rv-resource-picker__search-control`,inputClassName:Ml(`rv-resource-picker__search`,i?.search),value:T,disabled:a,placeholder:n.searchPlaceholder,"aria-label":n.searchAriaLabel,onValueChange:E}),z(`div`,{ref:_,class:Ml(`rv-resource-picker__list`,i?.list),role:S?`listbox`:`group`,id:S?b:void 0,"aria-multiselectable":S?c:void 0,"aria-activedescendant":te,"aria-label":n.groupAriaLabel,children:[u&&!o?z(`label`,{class:Ml(`rv-resource-picker__option rv-resource-picker__option--unassigned`,i?.option),children:[z(`input`,{type:`checkbox`,checked:t.length===0,disabled:a,...jl(u.dataAttribute,``),onChange:()=>r([])}),z(`span`,{class:`rv-resource-picker__avatar-spacer`,"aria-hidden":`true`}),z(`span`,{class:Ml(`rv-resource-picker__details`,i?.details),children:z(`strong`,{children:u.label})})]}):null,e.length===0?z(Hl,{className:i?.muted,text:n.emptyResources}):M.length===0?z(Hl,{className:i?.muted,text:n.emptySearch}):M.map((e,n)=>z(Rl,{resource:e,selected:A.has(kl(e.id)),selectedResourceIds:t,disabled:a,readOnly:o,multiple:c,resourceDataAttribute:d,classNames:i,isResourceDisabled:f,getAvatarColor:p,optionId:S?`${b}-option-${n}`:void 0,focused:S&&D===n,onFocus:()=>{y.current=!1,O(n)},onChange:ne},kl(e.id)))]})]});return z(`div`,{ref:m,class:Ml(`rv-resource-picker`,S?`rv-resource-picker--dropdown`:void 0,C?`rv-resource-picker--open`:void 0,i?.root),children:[S?z(`div`,{ref:h,class:`rv-resource-picker__control`,role:`combobox`,"aria-expanded":C,"aria-controls":b,"aria-haspopup":`listbox`,"aria-label":n.groupAriaLabel,tabIndex:a?-1:0,onClick:e=>{a||(e.preventDefault(),C?k():w(!0))},onKeyDown:e=>{a||e.target!==e.currentTarget||(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),w(!0))},children:[z(`div`,{class:`rv-resource-picker__chips`,children:ee.length?ee.map(e=>z(`span`,{class:`rv-resource-picker__chip`,children:[z(Ll,{resource:e,className:i?.avatar,color:p?.(e)}),z(`span`,{class:`rv-resource-picker__chip-label`,children:e.name}),!a&&!o?z(`button`,{type:`button`,class:`rv-resource-picker__chip-remove`,"aria-label":`Remove ${e.name}`,onClick:n=>{n.stopPropagation(),r(t.filter(t=>kl(t)!==kl(e.id)))},children:z(`span`,{"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:Wr}})}):null]},kl(e.id))):z(`span`,{class:`rv-resource-picker__placeholder`,children:n.searchPlaceholder})}),z(`span`,{class:`rv-resource-picker__chevron`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:Bn}})]}):null,S?C&&P?z(zl,{triggerRef:h,portalTarget:P,popupId:x,children:ie}):null:ie]})}function Vl(e){return[...new Map(e.map(e=>[kl(e),e])).values()]}function Hl({className:e,text:t}){return z(`span`,{class:Ml(`rv-resource-picker__empty`,e),children:t})}function Ul(e){return Ho(P,e)}function Wl({min:e,max:t,value:n,step:r=1,disabled:i=!1,id:a,className:o=``,ariaLabel:s,ariaValueText:c,ariaDescribedBy:l,onChange:u,onCommit:d,onKeyDown:f}){let p=t-e,m=p>0?Math.max(0,Math.min(100,(n-e)/p*100)):0;return z(cr,{class:`rv-single-slider ${o}`.trim(),id:a,type:`range`,min:e,max:t,step:r,value:n,disabled:i,style:{"--rv-single-slider-value":`${m}%`},"aria-label":s,"aria-valuetext":c,"aria-describedby":l,onKeyDown:f,onInput:e=>u(Number(e.currentTarget.value),e),onChange:e=>d?.(Number(e.currentTarget.value),e)})}function Gl({label:e,layout:t=`inline`,valuePlacement:n=`end`,formatValue:r=String,ticks:i,accentColor:a,...o}){let s=r(o.value),c=o.max>o.min?Math.max(0,Math.min(100,(o.value-o.min)/(o.max-o.min)*100)):0,l=i&&Number.isFinite(i)?Math.max(2,Math.min(101,Math.floor(i))):0;return z(`label`,{class:`rv-slider-field rv-slider-field--${t} rv-slider-field--${n}${o.disabled?` is-disabled`:``}`,style:a?{"--rv-slider-field-accent":a}:void 0,children:[z(`span`,{class:`rv-slider-field__label`,children:e}),z(`span`,{class:`rv-slider-field__track`,style:{"--rv-slider-field-position":`${c/100}`},children:[z(Wl,{...o,ariaValueText:o.ariaValueText??s}),l>0&&z(`span`,{class:`rv-slider-field__ticks`,"aria-hidden":`true`,children:Array.from({length:l},(e,t)=>z(`i`,{},t))}),n===`thumb`&&z(`span`,{class:`rv-slider-field__thumb-value`,"aria-hidden":`true`,children:s})]}),n===`end`&&z(`span`,{class:`rv-slider-field__value rv-badge rv-badge--inline`,"aria-hidden":`true`,children:s})]})}var Kl=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M120 0c13.3 0 24 10.7 24 24l0 40 160 0 0-40c0-13.3 10.7-24 24-24s24 10.7 24 24l0 40 32 0c35.3 0 64 28.7 64 64l0 288c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 128C0 92.7 28.7 64 64 64l32 0 0-40c0-13.3 10.7-24 24-24zm0 112l-56 0c-8.8 0-16 7.2-16 16l0 48 352 0 0-48c0-8.8-7.2-16-16-16l-264 0zM48 224l0 192c0 8.8 7.2 16 16 16l320 0c8.8 0 16-7.2 16-16l0-192-352 0z"/></svg>`;function ql({value:e,label:t,options:n={},multiple:r,invalid:i,errorId:a,disabled:o,readOnly:s,minDate:c,maxDate:l,onChange:u,onFocus:d}){let[f,p]=I(!1),[m,h]=I(``),g=n.multipleSeparator?.trim()||`;`,_=Array.isArray(e)?e.map(e=>sl(e,n)).join(`${g} `):sl(e,n),v=f?m:_,y=(r?v.split(g):[v]).some(e=>{if(!e.trim())return!1;let t=cl(e,n);return!t||!!(c&&t<c)||!!(l&&t>l)});return z(cr,{type:`text`,disabled:o,readOnly:s,autoComplete:`off`,spellcheck:!1,"aria-label":t,"aria-invalid":i||y,"aria-describedby":i?a:void 0,placeholder:n.placeholder??ol(n),value:f?m:_,onFocus:()=>{p(!0),h(_),d?.()},onBlur:()=>p(!1),onInput:e=>{if(o||s)return;let t=e.currentTarget.value;h(t);let i=e=>cl(e,n)??e.trim();u(r?t.trim()?t.split(g).map(i):[]:i(t))}})}function Jl(e){return z(Gn,{...e,className:`rv-combobox ${e.className??``}`,config:{...e.config,search:!0,multiSelect:!1}})}function Yl(e){return z(Gn,{...e,className:`rv-multi-select ${e.className??``}`,config:{...e.config,multiSelect:!0}})}function Xl(e){return co(P,e)}function Zl(e){return fo(P,e)}function Ql({open:e,anchor:t,appendTo:n,closeOnOutside:r,closeOnEscape:i,onClose:a,children:o,label:s,className:c=``,role:l=`dialog`}){let u=R(null),d=R(a);d.current=a;let f=R({closeOnOutside:r,closeOnEscape:i}).current;return f.closeOnOutside=r,f.closeOnEscape=i,L(()=>{if(!e||!t||!u.current)return;let r=u.current,i=new Bt,a=!0;i.open({anchor:t,appendTo:n,get closeOnOutside(){return f.closeOnOutside},get closeOnEscape(){return f.closeOnEscape},content:u.current,display:l===`menu`?`grid`:void 0,onClose:()=>{a&&d.current()}});let o=l===`menu`?vi(r,()=>i.close(),f):void 0;return()=>{a=!1,o?.(),i.destroy(),r.hidden=!0}},[e,t,l,n]),z(`div`,{ref:u,class:`rv-popover ${l===`menu`?`rv-menu `:``}${c}`,role:l,"aria-label":s,hidden:!e,children:e?o:null})}function $l(e){let t=R(null),n=R(e);n.current=e;let[r]=I(()=>new Ht),i=R(!1),a=R(!1),o=()=>{let e=n.current;r.update(e),r.setContent(e.content??e.text??``),e.open===void 0?i.current||(i.current=!0,e.defaultOpen&&r.setOpen(!0)):r.setOpen(e.open)};return L(()=>{let e=t.current;if(!e)return;let i,s=()=>{let t=n.current,s=t.anchor??(t.filter?e:e.querySelector(`button, input, textarea, select, a[href], summary, [contenteditable]:not([contenteditable="false"]), [tabindex]`)??e);if(s===i)return;let c=r.isOpen||a.current;a.current=!1,r.bind(s,t.content??t.text??``,t),i=s,o(),c&&t.open===void 0&&r.setOpen(!0)};s();let c=new e.ownerDocument.defaultView.MutationObserver(s);return c.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`href`,`tabindex`,`contenteditable`]}),e.addEventListener(`focus`,s,!0),e.addEventListener(`pointerenter`,s,!0),()=>{c.disconnect(),e.removeEventListener(`focus`,s,!0),e.removeEventListener(`pointerenter`,s,!0),a.current=r.isOpen,r.destroy()}},[r,e.anchor,e.filter]),L(o),z(`span`,{ref:t,class:`rv-tooltip-anchor`,children:e.children})}function eu({open:e,title:t,closeLabel:n,onClose:r,children:i,footer:a,draggable:o,returnFocus:s}){let c=R(null),l=R(r);l.current=r;let[u,d]=I();return L(()=>{if(!e||!c.current){d(void 0);return}let r=new _i(c.current.ownerDocument),i=!0,a=r.open({title:t,closeLabel:n,draggable:o,returnFocus:s,surfaceClass:`rv-ui-dialog`,onClose:()=>{d(void 0),i&&l.current()}});return d({body:a.body,footer:a.footer}),()=>{i=!1,r.destroy()}},[e,t,n,o,s]),z(F,{children:[z(`span`,{ref:c,hidden:!0}),u&&mn(i,u.body),u&&a&&mn(a,u.footer)]})}function tu({onConfirm:e,confirmLabel:t,cancelLabel:n,pending:r,...i}){return z(eu,{...i,footer:z(F,{children:[z(B,{disabled:r,onClick:i.onClose,children:n}),z(B,{variant:`primary`,disabled:r,onClick:e,children:t})]})})}function nu({value:e,onChange:t,label:n,openLabel:r,disabled:i,readOnly:a,...o}){let[s,c]=I(!1),[l,u]=I(null),[d,f]=I(e&&yc(e)?e:Nc()),[p,m]=I(H(d,o.calendarSystem)),[h]=I(()=>Rt(`rv-date-picker`));return L(()=>{(i||a)&&c(!1)},[i,a]),z(`div`,{class:`rv-date-picker`,children:[z(ql,{label:n,value:e??``,minDate:o.minDate,maxDate:o.maxDate,disabled:i,readOnly:a,onChange:e=>{typeof e!=`string`||i||a||e&&(o.minDate&&e<o.minDate||o.maxDate&&e>o.maxDate)||(!e||yc(e))&&t(e||void 0)}}),z(B,{ref:u,"aria-label":r,"aria-haspopup":`dialog`,"aria-expanded":s,"aria-controls":h,disabled:i||a,onClick:()=>{e&&yc(e)&&(f(e),m(H(e,o.calendarSystem))),c(!s)},children:z(Kt,{svg:Kl})}),z(Ql,{open:s,anchor:l,onClose:()=>c(!1),label:n,children:z(`div`,{id:h,children:z(Dl,{...o,month:p,focusedDate:d,selection:e?{from:e,to:e}:void 0,onMonthChange:m,onFocusedDateChange:f,onSelect:e=>{t(e),c(!1),l?.focus()}})})})]})}function ru({value:e,onChange:t,label:n,fromLabel:r,toLabel:i,openLabel:a,disabled:o,readOnly:s,...c}){let[l,u]=I(!1),[d,f]=I(null),[p,m]=I(),[h,g]=I(e?.from??Nc()),[_,v]=I(H(h,c.calendarSystem)),[y]=I(()=>Rt(`rv-date-picker`));L(()=>{(o||s)&&(u(!1),m(void 0))},[o,s]);let b=(n,r)=>{if(o||s||!yc(r)||c.minDate&&r<c.minDate||c.maxDate&&r>c.maxDate)return;let i=r;t(hl(n===`from`?i:e?.from??i,n===`to`?i:e?.to??i))};return z(`div`,{class:`rv-date-range-picker`,role:`group`,"aria-label":n,children:[z(ql,{label:r,value:e?.from??``,disabled:o,readOnly:s,minDate:c.minDate,maxDate:c.maxDate,onChange:e=>{typeof e==`string`&&b(`from`,e)}}),z(ql,{label:i,value:e?.to??``,disabled:o,readOnly:s,minDate:c.minDate,maxDate:c.maxDate,onChange:e=>{typeof e==`string`&&b(`to`,e)}}),z(B,{ref:f,disabled:o||s,"aria-label":a,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":y,onClick:()=>{m(void 0),e&&(g(e.from),v(H(e.from,c.calendarSystem))),u(!l)},children:z(Kt,{svg:Kl})}),z(Ql,{open:l,anchor:d,onClose:()=>{u(!1),m(void 0)},label:n,children:z(`div`,{id:y,children:z(Dl,{...c,month:_,focusedDate:h,selection:p?hl(p,h):e,onMonthChange:v,onFocusedDateChange:g,onSelect:e=>{p?(t(hl(p,e)),m(void 0),u(!1),d?.focus()):m(e)}})})})]})}function iu(e){let t=e.map(({value:e})=>Number.isFinite(e)?Math.max(0,e):0),n=Math.max(1,...t);return{values:t,max:n,points:t.map((t,r)=>({x:e.length<=1?50:r/(e.length-1)*100,y:96-t/n*88}))}}function au(e,t){return t===`step`?`H ${e.x} V ${e.y}`:`L ${e.x} ${e.y}`}function ou(e,t,n=`linear`){return`M ${e.x} ${e.y} ${au(t,n)}`}function su({title:e,details:t=[]}){return[e,...t].filter(Boolean).join(`. `)}function cu({title:e,details:t=[]}){return z(F,{children:[z(`strong`,{children:e}),t.map(e=>z(`span`,{children:e},e))]})}function lu({data:e,ariaLabel:t,variant:n,height:r=72,className:i=``,showGrid:a=!1,showLabels:o=!1,showValues:s=!1,legend:c,formatValue:l=String,tooltip:u=!0,tooltipIndicator:d=`none`,renderTooltip:f,positions:p,datumColors:m,renderDatum:h,children:g}){let{values:_,max:v}=iu(e),[y,b]=I(0),x=R([]),S=Math.min(y,Math.max(0,e.length-1)),C=t=>{if(!e.length)return;let n=Math.max(0,Math.min(t,e.length-1));b(n),x.current[n]?.focus()};return z(`div`,{class:`rv-distribution-chart rv-distribution-chart--${n} ${i}`.trim(),role:`group`,"aria-label":t,"data-empty":e.length?void 0:`true`,children:[z(`div`,{class:`rv-distribution-chart__region`,style:{height:`${Math.max(40,Math.min(240,r))}px`},children:[a&&z(`div`,{class:`rv-distribution-chart__grid`,"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>z(`span`,{},e))}),g,z(`div`,{class:`rv-distribution-chart__data`,role:`list`,children:e.map((t,n)=>{let r=p?.[n],i=!r;return z(du,{indicator:d,tooltipText:u?su(t.tooltip):void 0,tooltipContent:f?f(t,n):cu(t.tooltip),datumRef:e=>{x.current[n]=e},class:`rv-distribution-chart__datum${t.selected?` is-selected`:``}${i?` is-bar`:` is-point`}`,role:`listitem`,tabIndex:n===S?0:-1,"aria-label":su(t.tooltip),style:{"--rv-distribution-accent":m?.[n],...i?{}:{left:`${r.x}%`,top:`${r.y}%`}},onFocus:()=>b(n),onKeyDown:t=>{t.key===`ArrowRight`||t.key===`ArrowDown`?(t.preventDefault(),C(n+1)):t.key===`ArrowLeft`||t.key===`ArrowUp`?(t.preventDefault(),C(n-1)):t.key===`Home`?(t.preventDefault(),C(0)):t.key===`End`&&(t.preventDefault(),C(e.length-1))},children:[h(t,n),s&&z(`span`,{class:`rv-distribution-chart__value`,style:i?{top:`${100-Math.max(3,_[n]/v*100)}%`,transform:`translate(-50%, -100%)`}:void 0,"aria-hidden":`true`,children:l(t.value)})]},t.key)})})]}),o&&z(`div`,{class:`rv-distribution-chart__labels${n===`bar`?` is-bar`:``}`,"aria-hidden":`true`,children:e.map(e=>z(pi,{title:e.tooltip.title,children:e.tooltip.title},e.key))}),c&&z(`div`,{class:`rv-distribution-chart__legend`,children:[z(`i`,{"aria-hidden":`true`}),c]})]})}function uu({children:e}){return z(`svg`,{class:`rv-distribution-chart__plot`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,focusable:`false`,children:e})}function du({tooltipText:e,tooltipContent:t,indicator:n,children:r,onFocus:i,onKeyDown:a,datumRef:o,...s}){let c=jr(e??``,!0,{className:`rv-distribution-chart__tooltip rv-distribution-chart__tooltip--${n}`,content:z(F,{children:[n!==`none`&&z(`i`,{"aria-hidden":`true`}),t]})});return z(`span`,{ref:o,...s,...e?c.triggerProps:{},onKeyDown:e=>{c.triggerProps.onKeyDown(e),e.defaultPrevented||a?.(e)},onFocus:t=>{i?.(t),e&&c.triggerProps.onFocus(t)},children:[r,e&&c.tooltip]})}function fu(e){let{values:t,max:n}=iu(e.data),r=e.data.map((t,n)=>typeof e.barColor==`function`?e.barColor(t,n):e.barColor);return z(lu,{...e,datumColors:r,variant:`bar`,renderDatum:(e,i)=>z(`span`,{class:`rv-distribution-chart__bar`,style:{backgroundColor:r[i],height:`${Math.max(3,t[i]/n*100)}%`},"aria-hidden":`true`})})}function pu(e){let{points:t}=iu(e.data);return z(lu,{...e,variant:`line`,positions:t,renderDatum:()=>e.showPoints===!1?null:z(`span`,{class:`rv-distribution-chart__point`,"aria-hidden":`true`}),children:t.length>0&&z(uu,{children:t.slice(1).map((n,r)=>z(`path`,{class:`rv-distribution-chart__series rv-distribution-chart__segment${e.data[r].selected&&e.data[r+1].selected?` is-selected`:``}`,d:ou(t[r],n,e.interpolation),"vector-effect":`non-scaling-stroke`},e.data[r].key))})})}function mu(e){let t=`rv-area-${Xe().replace(/[^a-zA-Z0-9_-]/g,``)}`,{points:n}=iu(e.data),r=e.data.some(e=>e.selected!==void 0),i=n.slice(1).map((t,i)=>{let a=n[i],o=ou(a,t,e.interpolation);return{key:e.data[i].key,selected:!r||!!(e.data[i].selected&&e.data[i+1].selected),line:o,area:`${o} L ${t.x} 100 L ${a.x} 100 Z`}});return z(lu,{...e,variant:`area`,positions:n,renderDatum:()=>e.showPoints===!1?null:z(`span`,{class:`rv-distribution-chart__point`,"aria-hidden":`true`}),children:n.length>0&&z(uu,{children:[e.areaFill===`gradient`&&z(`defs`,{children:[!0,!1].map(e=>{let n=e?`var(--rv-distribution-accent, var(--rv-ui-accent))`:`var(--rv-distribution-muted, var(--rv-ui-border))`;return z(`linearGradient`,{id:`${t}${e?``:`-muted`}`,gradientUnits:`userSpaceOnUse`,x1:`0`,y1:`8`,x2:`0`,y2:`100`,children:[z(`stop`,{offset:`0%`,"stop-color":n,"stop-opacity":`0.4`}),z(`stop`,{offset:`100%`,"stop-color":n,"stop-opacity":`0.02`})]},String(e))})}),i.map(n=>z(`g`,{children:[z(`path`,{class:`rv-distribution-chart__area${n.selected?` is-selected`:``}`,d:n.area,style:e.areaFill===`gradient`?{fill:`url(#${t}${n.selected?``:`-muted`})`}:void 0}),z(`path`,{class:`rv-distribution-chart__series rv-distribution-chart__segment${n.selected?` is-selected`:``}`,d:n.line,"vector-effect":`non-scaling-stroke`})]},n.key))]})})}function hu({type:e=`bar`,...t}){return z(e===`line`?pu:e===`area`?mu:fu,{...t})}function gu(...e){return e.filter(Boolean).join(` `)}function _u(e){return typeof e==`string`||typeof e==`number`?String(e):void 0}function vu({chart:e,slider:t,startLabel:n,selectionLabel:r,endLabel:i}){return z(`div`,{class:`brush-range`,children:[e?z(hu,{...e,className:gu(`brush-range__chart`,e.className)}):null,z(Ul,{...t,className:gu(`brush-range__range`,t.className),controlClassName:gu(`brush-range__controls`,t.controlClassName),fromClassName:t.fromClassName,toClassName:t.toClassName}),z(`div`,{class:`brush-range__labels`,children:[z(pi,{class:`brush-range__label brush-range__label--start`,title:_u(n),children:n}),z(pi,{class:gu(`brush-range__label`,`brush-range__selection`),role:`status`,title:_u(r),children:r}),z(pi,{class:`brush-range__label brush-range__label--end`,title:_u(i),children:i})]})]})}function yu({label:e,detail:t,selected:n,className:r=``,detailClassName:i=``,...a}){return z(ur,{...a,class:`rv-option-button ${r}`,"aria-pressed":n,children:[z(`strong`,{children:e}),z(`span`,{class:`rv-option-button__detail ${i}`,children:t})]})}function bu({highlight:e,className:t=``,inputClassName:n=``,highlightClassName:r=``,...i}){let a=R(null);return z(`div`,{class:`rv-highlighted-input ${t}`,"data-invalid":i[`aria-invalid`]||void 0,children:[z(`pre`,{class:`rv-highlighted-input__highlight ${r}`,"aria-hidden":`true`,ref:a,children:e}),z(lr,{...i,class:`rv-highlighted-input__input ${n}`,spellcheck:i.spellcheck??!1,onScroll:e=>{a.current&&(a.current.scrollTop=e.currentTarget.scrollTop,a.current.scrollLeft=e.currentTarget.scrollLeft),i.onScroll?.(e)}})]})}function xu({children:e,className:t=``,label:n}){return z(`div`,{role:`group`,"aria-label":n,class:`rv-inline-field-group ${t}`,children:e})}var Su=(e,t)=>`${e}:${t}`;function Cu(e){return[`rv-time-grid__cell`,e.weekend&&`is-weekend`,e.outsideWorkHours&&`is-outside-work-hours`].filter(Boolean).join(` `)}function wu(e){let t=e=>`rv-time-grid__${e}`,n=Array.from({length:12},(e,t)=>t*2);return z(`div`,{class:t(`schedule`),children:[z(`div`,{class:t(`hours`),"aria-hidden":`true`,children:[z(`span`,{}),n.map(n=>z(`span`,{class:t(`hour`),children:e.hourLabel(n)},n))]}),z(`div`,{ref:e.matrixRef,class:t(`matrix`),role:`grid`,"aria-label":e.gridLabel,"aria-rowcount":e.days.length,"aria-colcount":12,children:e.days.map(r=>{let{weekday:i,short:a,long:o}=r,s=e.weekendDays.includes(i);return z(`div`,{class:`${t(`row`)}${s?` is-weekend`:``}`,role:`row`,children:[z(pi,{class:t(`weekday`),role:`rowheader`,title:o,children:a}),n.map(t=>{let n=Su(i,t),a=e.cells.has(n)||e.cells.has(Su(i,t+1)),o=e.workingHours?t<e.workingHours.startHour||t+2>e.workingHours.endHour:!1;return z(ur,{type:`button`,disabled:e.disabled,role:`gridcell`,"data-time-cell":n,class:Cu({weekend:s,outsideWorkHours:o}),"aria-selected":a,"aria-label":e.cellLabel(r,e.hourLabel(t),e.hourLabel(t+2),a),tabIndex:e.focused===n?0:-1,onFocus:()=>e.onFocus(n),onKeyDown:n=>e.onKeyDown(n,i,t),onClick:n=>e.onClick(n,i,t,a),onPointerDown:n=>e.onPointerDown(n,i,t,a),onPointerEnter:()=>e.onPointerEnter(i,t)},n)})]},i)})})]})}function Tu(e,t,n,r,i=null,a=4){let o=t+n/2;return Math.abs(e-o)<=a&&(i===r||i===r+1)?i:e<=o?r:r+1}function Eu(e,t,n=null,r=t.length){for(let r=0;r<t.length;r++){let i=t[r];if(e<=i.top+i.height)return Tu(e,i.top,i.height,r,n)}return r}function Du({svg:e,className:t=``}){return z(Kt,{svg:e,className:`rv-configurator-icon ${t}`})}function Ou({children:e,className:t=``,...n}){return z(sc,{...n,className:`rv-configurator-summary ${t}`,iconPosition:`after`,icon:z(Du,{svg:xr}),children:e})}function ku({title:e,id:t,count:n,children:r,className:i=``}){return z(`details`,{id:t,tabIndex:t?-1:void 0,class:`rv-configurator-available-fields ${i}`,open:!0,children:[z(Ou,{children:[e,n!=null&&z(`span`,{class:`rv-configurator-field-count`,children:n})]}),z(`div`,{class:`rv-configurator-library-content`,children:r})]})}function Au({children:e,actions:t,className:n=``}){return z(`div`,{class:`rv-configurator-zone-heading ${n}`,children:[z(`span`,{class:`rv-configurator-zone-label`,children:e}),t&&z(`span`,{class:`rv-configurator-zone-actions`,children:t})]})}function ju({heading:e,actions:t,headingClassName:n,className:r=``,children:i,...a}){return z(`section`,{...a,className:`rv-configurator-zone ${r}`,children:[z(Au,{className:n,actions:t,children:e}),i]})}function Mu({empty:e,placeholder:t,className:n=``,children:r,...i}){return z(`ul`,{...i,className:`rv-configurator-field-list ${e?`empty`:``} ${n}`,children:e?z(`li`,{className:`rv-configurator-empty-zone empty`,children:t}):r})}function Nu({className:e=``,children:t,indicator:n,dropPosition:r,...i}){return z(`li`,{...i,className:`rv-configurator-field rv-configurator-field-row ${e}`,children:[n??(r&&z(Hu,{position:r})),z(`span`,{className:`rv-configurator-drag-handle`,"aria-hidden":`true`}),t]})}function Pu({icon:e,children:t,className:n=``}){return z(`span`,{class:`rv-configurator-field-content ${n}`,children:[e,z(`span`,{class:`rv-configurator-field-caption`,children:t})]})}function Fu({as:e=`div`,children:t,className:n=``,...r}){return P(e,{...r,class:`rv-configurator-field ${n}`},t)}function Iu({children:e,...t}){return z(`div`,{...t,className:`rv-configurator-library-list ${t.className??``}`,children:e})}function Lu({label:e,icon:t,actions:n,contentClassName:r,...i}){return z(Nu,{...i,children:[z(Pu,{className:r,icon:t,children:e}),n]})}function Ru({children:e,className:t=``,...n}){return z(`div`,{...n,className:`rv-configurator-field-actions ${t}`,children:e})}function zu({children:e,active:t=!1,label:n,className:r=``}){return z(pi,{className:`rv-configurator-status-badge ${r}`,role:`img`,"data-active":t?`true`:void 0,title:n,"aria-label":n,children:e})}function Bu(e){return z(zn,{...e,className:`rv-configurator-remove-button ${e.className??``}`})}function Vu(){return z(Kt,{svg:Ln})}function Hu({position:e,index:t,className:n=``}){return z(`span`,{className:`rv-configurator-drop-indicator ${n}`,"data-position":e,"data-drop-index":t,"aria-hidden":`true`})}function Uu({title:e,description:t,defaultOpen:n=!1,children:r,className:i=``,summaryClassName:a=``,contentClassName:o=``,descriptionClassName:s=``,renderRoot:c}){let l=R(n),u={class:`rv-collapsible-section rv-configurator-section ${i}`.trim(),open:l.current,children:[z(Ou,{className:a,children:e}),z(`div`,{class:`rv-collapsible-section__content ${o}`.trim(),children:[t&&z(`p`,{class:`rv-collapsible-section__description ${s}`.trim(),children:t}),r]})]};return c?c(u):z(`details`,{...u})}var Wu=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 160-160 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l160 0 0 160c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160 160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-160 0 0-160z"/></svg>`,Gu=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376C296.3 401.1 253.9 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>`;function Ku({title:e,icon:t,expandLabel:n,collapseLabel:r,open:i=!1,children:a}){let[o,s]=I(i),c=o?r:n,l=kr(c,!0);return z(`details`,{class:`rv-format-inspector-section`,open:o,onToggle:e=>s(e.currentTarget.open),children:[z(dr,{class:`rv-format-inspector-section__summary`,"aria-label":c,"aria-expanded":o,...l.triggerProps,children:[z(`span`,{class:`rv-format-inspector-section__title`,children:[z(Kt,{svg:t,className:`rv-format-icon`}),e]}),z(Kt,{svg:Bn,className:`rv-format-icon rv-format-inspector-section__chevron`}),l.tooltip]}),z(`div`,{class:`rv-format-inspector-section__content`,children:a})]})}var qu=({icon:e})=>z(Kt,{svg:e,className:`rv-format-icon`});function Ju({value:e,options:t,ariaLabel:n,onChange:r}){return z(`div`,{class:`rv-format-segmented`,role:`group`,"aria-label":n,children:t.map(t=>z(Xu,{selected:t.value===e,label:t.label,icon:t.icon,onClick:()=>r(t.value)},t.value))})}function Yu({value:e,label:t,icon:n,onChange:r}){return z(Xu,{selected:e,label:t,icon:n,onClick:()=>r(!e)})}function Xu({selected:e,label:t,icon:n,onClick:r}){let i=kr(t,!0);return z(ur,{type:`button`,class:`rv-format-segmented__button${e?` rv-format-segmented__button--selected`:``}`,"aria-label":t,"aria-pressed":e,onClick:r,...i.triggerProps,children:[z(qu,{icon:n}),i.tooltip]})}var Zu=[`Inter`,`Arial`,`Helvetica`,`Georgia`,`Times New Roman`,`Courier New`];function Qu({value:e,fonts:t=Zu,labels:n,icons:r,onChange:i}){return z(F,{children:[z(`div`,{class:`rv-form-grid`,children:[z(`label`,{class:`rv-field`,children:[z(`span`,{class:`rv-field__label`,children:n.fontFamily}),z(Gn,{className:`rv-select`,value:e.fontFamily??``,source:[{value:``,label:n.defaultFont},...t.map(e=>({value:e,label:e}))],config:{ariaLabel:n.fontFamily,topLayer:!0},onChange:e=>i({fontFamily:String(e)||void 0})})]}),z(`label`,{class:`rv-field`,children:[z(`span`,{class:`rv-field__label`,children:n.fontSize}),z(cr,{type:`number`,class:`rv-control`,min:8,max:72,value:e.fontSize??``,onInput:e=>i({fontSize:Number.isFinite(e.currentTarget.valueAsNumber)?e.currentTarget.valueAsNumber:void 0})})]})]}),z(`div`,{class:`rv-format-segmented rv-format-typography-toolbar`,role:`group`,"aria-label":n.typographySection,children:[z(Yu,{value:e.bold??!1,label:n.bold,icon:r.bold,onChange:e=>i({bold:e})}),z(Yu,{value:e.italic??!1,label:n.italic,icon:r.italic,onChange:e=>i({italic:e})}),z(Yu,{value:e.underline??!1,label:n.underline,icon:r.underline,onChange:e=>i({underline:e})}),z(Yu,{value:e.strike??!1,label:n.strike,icon:r.strike,onChange:e=>i({strike:e})})]})]})}function $u({originalValue:e,formatted:t,formattedStyle:n,visual:r=!1,formattedClassName:i=``,labels:a}){return z(`section`,{class:`rv-format-preview${r?` rv-format-preview--visual`:``}`,children:[z(`h3`,{class:`rv-format-pane-title`,children:a.title}),z(`div`,{class:`rv-format-preview__grid`,role:`table`,"aria-label":a.title,children:[z(`div`,{class:`rv-format-preview__row`,role:`row`,children:[z(`span`,{class:`rv-format-preview__corner`,role:`cell`}),z(`span`,{class:`rv-format-preview__columnheader`,role:`columnheader`,children:a.original}),z(`span`,{class:`rv-format-preview__columnheader`,role:`columnheader`,children:a.formatted})]}),z(`div`,{class:`rv-format-preview__row`,role:`row`,children:[z(`span`,{class:`rv-format-preview__rowheader`,role:`rowheader`,children:`1`}),z(pi,{class:`rv-format-preview__gridcell`,role:`cell`,title:e,children:z(`span`,{class:`rv-format-preview__original-value`,children:e})}),z(`span`,{class:`rv-format-preview__gridcell rv-format-preview__formatted ${i}`,role:`cell`,style:n,children:z(`span`,{role:`status`,"aria-live":`polite`,children:t})})]})]}),z(`p`,{class:`rv-format-preview__hint`,children:a.hint})]})}function ed(e){return z($s,{...e,type:`button`,class:`rv-filter-badge-info ${e.className??e.class??``}`.trim()})}function td({label:e,details:t,detailsLabel:n,descriptionId:r,className:i=``,...a}){let o=Xe(),s=r??`rv-filter-badge-${o}`;return z(ec,{...a,selected:!0,className:`rv-filter-badge ${i}`.trim(),info:t?z(F,{children:[z(ed,{"aria-label":n,"aria-describedby":s,"data-tooltip":t,"tooltip-position":`bottom`}),z(`span`,{class:`rv-filter-badge-description`,id:s,children:t})]}):void 0,children:z(`span`,{class:`rv-filter-badge-label`,children:e})})}var nd=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M128 40c0-22.1-17.9-40-40-40L40 0C17.9 0 0 17.9 0 40L0 88c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48zm0 192c0-22.1-17.9-40-40-40l-48 0c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48zM0 424l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40l-48 0c-22.1 0-40 17.9-40 40zM320 40c0-22.1-17.9-40-40-40L232 0c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48zM192 232l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40l-48 0c-22.1 0-40 17.9-40 40zM320 424c0-22.1-17.9-40-40-40l-48 0c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48z"/></svg>`;function rd({items:e,itemKey:t,renderItem:n,renderHandle:r,itemAttributes:i,className:a=``,rowClassName:o=``,endClassName:s=``,draggedKey:c,dropIndex:l,empty:u,onDragOver:d,onDrop:f}){let p=(e,t)=>{let n=e.currentTarget.getBoundingClientRect();return Tu(e.clientY,n.top,n.height,t,l??null)},m=t=>{let n=t.currentTarget;if(t.target.closest(`.rv-reorder-drop-end`)?.parentElement===n)return e.length;let r=Array.from(n.querySelectorAll(`:scope > .rv-reorder-row`));return Eu(t.clientY,r.map(e=>e.getBoundingClientRect()),l??null,e.length)};return z(`div`,{class:`rv-reorder-list ${a}${l===e.length?` drop-at-end`:``}`,onDragOver:e=>{e.target.closest(`.rv-reorder-row`)?.parentElement!==e.currentTarget&&(e.stopPropagation(),d(e,m(e)))},onDrop:e=>{e.target.closest(`.rv-reorder-row`)?.parentElement!==e.currentTarget&&(e.stopPropagation(),f(e,m(e)))},children:[!e.length&&u,e.map((e,a)=>P(`div`,{...i?.(e,a),key:t(e),class:`rv-reorder-row ${typeof o==`function`?o(e,a):o}${c===t(e)?` dragging`:``}${l===a?` drop-before`:``}`,onDragOver:e=>{e.stopPropagation(),d(e,p(e,a))},onDrop:e=>{e.stopPropagation(),f(e,p(e,a))}},r?.(e,a),n(e,a))),z(`div`,{class:`rv-reorder-drop-end ${s}`,"aria-hidden":`true`})]})}function id({className:e=``,children:t,...n}){return z(ur,{type:`button`,...n,class:`rv-btn-ghost rv-reorder-handle ${e}`,children:[z(`span`,{"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:nd}}),t]})}function ad(e,t){return e.start<t.start||e.end>t.end}function od(e,t){let n=t.end-t.start,r=Math.max(t.start,Math.min(t.end,e.start)),i=Math.max(t.start,Math.min(t.end,e.end)),a=(r-t.start)/n*100,o=(i-r)/n*100;return{left:Math.min(99,a),width:Math.max(e.start===e.end?.8:0,o)}}function sd(e){let t=Math.abs(e.end-e.start)/24;if(!Number.isFinite(t)||t<=0)return 1;let n=10**Math.floor(Math.log10(t)),r=t/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function cd(e,t,n){let r=e.end-e.start;if(r>n.end-n.start)return{...e};let i=e.start+t;return i=Math.max(n.start,Math.min(n.end-r,i)),{...e,start:i,end:i+r}}function ld(e,t,n,r){return t===`start`?{...e,start:Math.max(r.start,Math.min(e.end,e.start+n))}:{...e,end:Math.min(r.end,Math.max(e.start,e.end+n))}}function ud(e){let t=e.segments?.filter(e=>Number.isFinite(e.weight)&&e.weight>0);if(!t?.length)return e.color;let n=t.reduce((e,t)=>e+t.weight,0),r=0;return`linear-gradient(to right, ${t.map(e=>{let t=r/n*100;return r+=e.weight,`${e.color} ${t}% ${r/n*100}%`}).join(`, `)})`}var dd={preview:`Timeline preview`,editEvents:`Edit timeline events`,moveEarlier:`Move earlier`,moveLater:`Move later`,startEarlier:`Start earlier`,startLater:`Start later`,endEarlier:`End earlier`,endLater:`End later`,moveEvent:e=>`Move event ${e}`,resizeStart:e=>`Resize start of ${e}`,resizeEnd:e=>`Resize end of ${e}`};function fd({rows:e,tooltip:t=!0,showActions:n=!0,formatValue:r=String,getTooltip:i,selected:a,range:o,labels:s,onSelect:c,onEventChange:l}){let u={...dd,...s},d=R(),f=(e,t,n)=>{let r=e.currentTarget.closest(`.rv-timeline-control__track`);r&&(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),d.current={id:t.id,mode:n,clientX:e.clientX,event:t.event,width:r.getBoundingClientRect().width},c(t.id))},p=e=>{let t=d.current;if(!t)return;let n=sd(o),r=(e.clientX-t.clientX)/Math.max(1,t.width)*(o.end-o.start),i=Math.round(r/n)*n,a=t.mode===`move`?cd(t.event,i,o):ld(t.event,t.mode,i,o);l(t.id,a)},m=()=>{d.current=void 0},h=(e,t,n)=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let r=sd(o)*(e.key===`ArrowLeft`?-1:1);l(t.id,n===`move`?cd(t.event,r,o):ld(t.event,n,r,o))};return z(F,{children:[z(`div`,{class:`rv-timeline-editor__track rv-timeline-control__track`,role:`group`,"aria-label":u.preview,style:{height:`max(112px, calc(70px + ${e.length} * var(--rv-timeline-lane-size)))`},children:[z(`span`,{class:`rv-timeline-editor__range rv-timeline-editor__range--start rv-timeline-control__range rv-timeline-control__range--start`,children:o.start}),z(`span`,{class:`rv-timeline-editor__range rv-timeline-editor__range--end rv-timeline-control__range rv-timeline-control__range--end`,children:o.end}),e.map((e,t)=>({row:e,index:t})).filter(({row:e})=>Number.isFinite(e.event.start)&&Number.isFinite(e.event.end)&&e.event.end>=e.event.start).map(({row:e,index:n})=>{let s=od(e.event,o),l=`clamp(56px, ${s.width}%, calc(100% - 24px))`,d=ad(e.event,o),g=e.event.label||u.moveEvent(n+1);return z(pd,{tooltipText:t?i?.(e.event)??`${g}: ${r(e.event.start)} – ${r(e.event.end)}`:void 0,class:[`rv-timeline-editor__bar rv-timeline-control__bar`,a===e.id?`rv-timeline-editor__bar--selected rv-timeline-control__bar--selected`:``,e.event.start===e.event.end?`rv-timeline-editor__bar--milestone rv-timeline-control__bar--milestone`:``,d?`rv-timeline-editor__bar--outside rv-timeline-control__bar--outside`:``].filter(Boolean).join(` `),style:{top:`calc(39px + ${n} * var(--rv-timeline-lane-size))`,left:`clamp(12px, ${s.left}%, calc(100% - ${l} - 12px))`,width:l,background:ud(e.event),color:e.event.textColor,"--timeline-event-color":e.event.color,"--timeline-event-color-end":e.event.color},role:`group`,"aria-label":g,children:[z(ur,{unstyled:!0,type:`button`,class:`rv-timeline-editor__bar-move rv-timeline-control__bar-move`,"data-autofocus":n===0?``:void 0,"aria-label":e.event.label?`${u.moveEvent(n+1)}: ${e.event.label}`:u.moveEvent(n+1),"aria-keyshortcuts":`ArrowLeft ArrowRight`,onFocus:()=>c(e.id),onPointerDown:t=>f(t,e,`move`),onPointerMove:p,onPointerUp:m,onPointerCancel:m,onKeyDown:t=>h(t,e,`move`),children:z(`span`,{class:`rv-timeline-editor__bar-label rv-timeline-control__bar-label`,children:e.event.label})}),z(ur,{unstyled:!0,type:`button`,class:`rv-timeline-editor__handle rv-timeline-editor__handle--start rv-timeline-control__handle rv-timeline-control__handle--start`,role:`slider`,"aria-orientation":`horizontal`,"aria-label":u.resizeStart(g),"aria-valuemin":Math.min(o.start,e.event.start),"aria-valuemax":e.event.end,"aria-valuenow":e.event.start,"aria-keyshortcuts":`ArrowLeft ArrowRight`,onFocus:()=>c(e.id),onPointerDown:t=>{t.stopPropagation(),f(t,e,`start`)},onPointerMove:p,onPointerUp:m,onPointerCancel:m,onKeyDown:t=>{t.stopPropagation(),h(t,e,`start`)}}),z(ur,{unstyled:!0,type:`button`,class:`rv-timeline-editor__handle rv-timeline-editor__handle--end rv-timeline-control__handle rv-timeline-control__handle--end`,role:`slider`,"aria-orientation":`horizontal`,"aria-label":u.resizeEnd(g),"aria-valuemin":e.event.start,"aria-valuemax":Math.max(o.end,e.event.end),"aria-valuenow":e.event.end,"aria-keyshortcuts":`ArrowLeft ArrowRight`,onFocus:()=>c(e.id),onPointerDown:t=>{t.stopPropagation(),f(t,e,`end`)},onPointerMove:p,onPointerUp:m,onPointerCancel:m,onKeyDown:t=>{t.stopPropagation(),h(t,e,`end`)}})]},e.id)})]}),n&&z(`details`,{class:`rv-timeline-control__actions`,children:[z(`summary`,{children:u.editEvents}),e.filter(({event:e})=>Number.isFinite(e.start)&&Number.isFinite(e.end)&&e.end>=e.start).map((e,t)=>z(`fieldset`,{children:[z(`legend`,{children:e.event.label||u.moveEvent(t+1)}),z(`output`,{children:[r(e.event.start),` – `,r(e.event.end)]}),z(`div`,{class:`rv-timeline-control__commands`,children:[[`move`,-1,u.moveEarlier],[`move`,1,u.moveLater],[`start`,-1,u.startEarlier],[`start`,1,u.startLater],[`end`,-1,u.endEarlier],[`end`,1,u.endLater]].map(([t,n,r])=>z(ur,{type:`button`,onClick:()=>{let r=sd(o)*n;c(e.id),l(e.id,t===`move`?cd(e.event,r,o):ld(e.event,t,r,o))},children:r}))})]},e.id))]})]})}function pd({tooltipText:e,children:t,...n}){let r=kr(e??``,!0,{className:`rv-control-tooltip`,placement:`above`});return z(`div`,{...n,...e?r.triggerProps:{},children:[t,e&&r.tooltip]})}function md({className:e=``,avatar:t,timestamp:n,header:r,children:i,actions:a,details:o}){return z(`article`,{class:`rv-activity-message ${e}`,children:[z(`div`,{class:`rv-activity-message-avatar`,children:t}),z(`div`,{class:`rv-activity-message-card`,children:[r&&z(`div`,{class:`rv-activity-message-header`,children:r}),z(`div`,{class:`rv-activity-message-content${r?` rv-activity-message-content--full`:``}`,children:i}),z(`div`,{class:`rv-activity-message-time`,children:n}),a&&z(`div`,{class:`rv-activity-message-actions`,children:a})]}),o&&z(`div`,{class:`rv-activity-message-details`,children:o})]})}var hd=l({AbortException:()=>Op,AnnotationEditorLayer:()=>S_,AnnotationEditorParamsType:()=>q,AnnotationEditorType:()=>K,AnnotationEditorUIManager:()=>im,AnnotationLayer:()=>Xg,AnnotationMode:()=>lp,AnnotationType:()=>hp,CSSConstants:()=>qp,ColorPicker:()=>pg,DOMSVGFactory:()=>_g,DrawLayer:()=>C_,FeatureTest:()=>J,GlobalWorkerOptions:()=>Wh,ImageKind:()=>mp,InvalidPDFException:()=>Tp,MathClamp:()=>Ad,OPS:()=>vp,OutputScale:()=>Wp,PDFDataRangeTransport:()=>ig,PDFDateString:()=>Up,PDFWorker:()=>sg,PasswordException:()=>Cp,PasswordResponses:()=>bp,PermissionFlag:()=>fp,PixelsPerInch:()=>Bp,RenderingCancelledException:()=>Vp,ResponseException:()=>Ep,SignatureExtractor:()=>__,SupportedImageMimeTypes:()=>Gp,TextLayer:()=>tg,TextLayerImages:()=>w_,TouchManager:()=>cm,Util:()=>Y,VerbosityLevel:()=>_p,XfaLayer:()=>zp,applyOpacity:()=>Gd,build:()=>fg,createValidAbsoluteUrl:()=>xd,fetchData:()=>jd,findContrastColor:()=>Xd,getDocument:()=>qf,getFilenameFromUrl:()=>Pd,getPdfFilenameFromUrl:()=>Fd,getRGB:()=>Bd,getRGBA:()=>zd,getUuid:()=>Od,isDataScheme:()=>Md,isPdfFile:()=>Nd,isValidExplicitDest:()=>Wm,makeArr:()=>jp,makeMap:()=>Mp,makeObj:()=>Np,makeSet:()=>Pp,noContextMenu:()=>Ld,normalizeUnicode:()=>Dd,renderRichText:()=>Zd,setLayerDimensions:()=>Wd,shadow:()=>G,stopEvent:()=>Rd,updateUrlHash:()=>Sd,version:()=>dg});function gd(e){Number.isInteger(e)&&(xp=e)}function _d(){return xp}function vd(e){xp>=_p.INFOS&&console.info(`Info: ${e}`)}function U(e){xp>=_p.WARNINGS&&console.warn(`Warning: ${e}`)}function W(e){throw Error(e)}function yd(e,t){e||W(t)}function bd(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function xd(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=Ed(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return bd(r)?r:null}function Sd(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&xd(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function Cd(e){return e.substring(e.lastIndexOf(`/`)+1)}function G(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}function wd(e){(typeof e!=`object`||e?.length===void 0)&&W(`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 Td(e){typeof e!=`string`&&W(`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}function Ed(e){return decodeURIComponent(escape(e))}function Dd(e){return kp||(kp=/([\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,Ap=new Map([[`ſt`,`ſt`]])),e.replaceAll(kp,(e,t,n)=>t?t.normalize(`NFKC`):Ap.get(n))}function Od(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),wd(e)}function kd(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}function Ad(e,t,n){return Math.min(Math.max(e,t),n)}async function jd(e,t=`text`){if(Id(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)}else r(Error(i.statusText))}},i.send(null)})}function Md(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function Nd(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function Pd(e){return[e]=e.split(/[#?]/,1),Cd(e)}function Fd(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(Md(e))return U(`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=Cd(t),t.length===4&&i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=Cd(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}function Id(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test(n?.protocol??``)}function Ld(e){e.preventDefault()}function Rd(e){e.preventDefault(),e.stopPropagation()}function zd(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 Bd(e){let t=zd(e);return t?t.slice(0,3):(U(`Not a valid color format: "${e}"`),[0,0,0])}function Vd(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,Bd(r))}t.remove()}function Hd(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function Ud(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 Wd(e,t,n=!1,r=!0){if(t instanceof Fp){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)}function Gd(e,t){t=Ad(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function Kd(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 qd(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 Jd(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function Yd(e,t,n){qd(e,n),n.map(Jd);let r=.2126*n[0]+.7152*n[1]+.0722*n[2];qd(t,n),n.map(Jd);let i=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)}function Xd(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=Jp.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);Kd(e,o);let s=i.subarray(6,9);Kd(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]),Yd(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===Yd(o,s,a)<l?e=n:t=n}o[2]=c?t:e}return qd(o,a),r=Y.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),Jp.set(n,r),r}function Zd({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 zp.render({xfaHtml:e,div:i,intent:`richText`});i.firstElementChild.classList.add(`richText`,n),r.append(i)}function Qd(e){let t=new Path2D;if(!e)return t;for(let n=0,r=e.length;n<r;)switch(e[n++]){case yp.moveTo:t.moveTo(e[n++],e[n++]);break;case yp.lineTo:t.lineTo(e[n++],e[n++]);break;case yp.curveTo:t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);break;case yp.quadraticCurveTo:t.quadraticCurveTo(e[n++],e[n++],e[n++],e[n++]);break;case yp.closePath:t.closePath();break;default:U(`Unrecognized drawing path operator: ${e[n-1]}`)}return t}function $d(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}function ef(e){e.preventDefault()}function tf(e){return e.cancelable?(Rd(e),!0):(e.stopPropagation(),!1)}function nf(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 rf(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}function af(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||km.test(i)||i===`\\`&&(++r>=n||km.test(e[r])))return!1}return!0}function of(e){return af(e)?e:`"${e.replaceAll(/["\\\p{Cc}]/gu,e=>e===`"`||e===`\\`?`\\${e}`:`\\${e.codePointAt(0).toString(16)} `)}"`}function sf(e,t,n,r=0){let{decoder:i}=Im;for(let e=0;e<n;e++)r+=t.getUint32(r)+4;let a=t.getUint32(r);return i.decode(new Uint8Array(e,r+4,a))}function cf(e){if(e instanceof URL)return e;if(typeof e==`string`){if(rp){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 lf(e){if(rp&&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 Td(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 uf(e){if(typeof e!=`string`)return null;if(e.endsWith(`/`))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}function df(){}function ff(e){if(e instanceof Op||e instanceof Tp||e instanceof Cp||e instanceof Ep||e instanceof wp)return e;switch(e instanceof Error||typeof e==`object`&&e||W(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new Op(e.message);case`InvalidPDFException`:return new Tp(e.message);case`PasswordException`:return new Cp(e.message,e.code);case`ResponseException`:return new Ep(e.message,e.status,e.missing);case`UnknownErrorException`:return new wp(e.message,e.details)}return new wp(e.message,e.toString())}function pf(e,t,n){return Math.round(n*e+(1-n)*t)}async function mf(e){let t=await process.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(t)}function hf({src:e,srcPos:t=0,dest:n,width:r,height:i,nonBlackColor:a=4294967295,inverseDecode:o=!1}){let s=J.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 gf({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=J.isLittleEndian?4278190080:255;if(J.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=t+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=t+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}}function _f(){return oh.init()}function vf(){return oh.isReady}function yf(){oh.loadMeshShader()}function bf(e,t,n,r,i,a,o,s){return oh.draw(e,t,n,r,i,a,o,s)}function xf(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)}function Sf(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,ee,te,ne,N,re;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,ee=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,ee=w-(w-D)*t}let t;t=e<m?0:e>v?1:(m-e)/(m-v),te=p-(p-_)*t,ne=y-(y-T)*t,N=b-(b-E)*t,re=x-(x-D)*t;let n=Math.round(Math.min(A,te)),r=Math.round(Math.max(A,te)),i=d*e+n*4;for(let e=n;e<=r;e++)t=(A-e)/(A-te),t<0?t=0:t>1&&(t=1),u[i++]=j-(j-ne)*t|0,u[i++]=M-(M-N)*t|0,u[i++]=ee-(ee-re)*t|0,u[i++]=255}}function Cf(e){switch(e[0]){case`RadialAxial`:return new lh(e);case`Mesh`:return new uh(e);case`Dummy`:return new dh}throw Error(`Unknown IR type: ${e[0]}`)}function wf(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 Tf(e,t,n,r,i,a,o,s,c,l){let[u,d,f,p,m,h]=Hd(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]}function Ef(e,t){let{width:n,height:r,kind:i}=t,a=r%vh,o=(r-a)/vh,s=a===0?o:o+1,c=e.createImageData(n,vh),l=0,u=t.data,d=c.data,f;if(i===mp.GRAYSCALE_1BPP)for(f=0;f<s;f++)({srcPos:l}=hf({src:u,srcPos:l,dest:d,width:n,height:f<o?vh:a})),e.putImageData(c,0,f*vh);else if(i===mp.RGBA_32BPP){let t=0,r=n*vh*4;for(f=0;f<o;f++)d.set(u.subarray(l,l+r)),l+=r,e.putImageData(c,0,t),t+=vh;f<s&&(r=n*a*4,d.set(u.subarray(l,l+r)),e.putImageData(c,0,t))}else if(i===mp.RGB_24BPP)for(f=0;f<s;f++)({srcPos:l}=gf({src:u,srcPos:l,dest:new Uint32Array(d.buffer),width:n,height:f<o?vh:a})),e.putImageData(c,0,f*vh);else throw Error(`bad image kind: ${i}`)}function Df(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let{width:n,height:r}=t,i=r%vh,a=(r-i)/vh,o=i===0?a:a+1,s=e.createImageData(n,vh),c=0,l=t.data,u=s.data;for(let t=0;t<o;t++)({srcPos:c}=hf({src:l,srcPos:c,dest:u,width:n,height:t<a?vh:i,nonBlackColor:0})),e.putImageData(s,0,t*vh)}function Of(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 kf(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 Af(e,t){if(t)return!0;Y.singularValueDecompose2dScale(e,yh);let n=Math.fround(Wp.pixelRatio*Bp.PDF_TO_CSS_UNITS);return yh[0]<=n&&yh[1]<=n}function jf(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=Td(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}else 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(`_`,` `).replaceAll(/=([0-9a-f]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),i(t,r);try{r=atob(r)}catch{}return i(t,r)})}return``}function Mf(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 Nf(e){let t=e.length;for(;t>0&&e[t-1]!==` `&&/\s/.test(e[t-1]);)t--;return e.slice(0,t)}function Pf(e){return URL.parse(e)?.origin??null}function Ff({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 If(e){let t=e.get(`Content-Disposition`);if(t){let e=jf(t);if(e.includes(`%`))try{e=decodeURIComponent(e)}catch{}if(Nd(e))return e}return null}function Lf(e,t){return new Ep(`Unexpected server response (${e}) while retrieving PDF "${t.href}".`,e,e===404||e===0&&t.protocol===`file:`)}function Rf(e,t){if(e!==t)throw Error(`Expected range response-origin "${e}" to match "${t}".`)}function zf(e,t,n,r){return fetch(e,{method:`GET`,headers:t,signal:r.signal,mode:`cors`,credentials:n?`include`:`same-origin`,redirect:`follow`})}function Bf(e,t){if(e!==200&&e!==206)throw Lf(e,t)}function Vf(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw Error(`getArrayBuffer - unexpected data: ${e}`)}function Hf(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function Uf(){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}function Wf(e){return typeof e==`string`?Td(e).buffer:e}function Gf(e,t=null){let n=process.getBuiltinModule(`fs`),{Readable:r}=process.getBuiltinModule(`stream`),i=n.createReadStream(e,t);return r.toWeb(i)}function Kf(e){return Id(e)?Ah:rp?Vh:Rh}function qf(e={}){let t=new rg,{docId:n}=t,r=e.url?cf(e.url):null,i=e.data?lf(e.data):null,a=e.httpHeaders||null,o=e.withCredentials===!0,s=e.password??null,c=e.range instanceof ig?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:2**16,u=e.worker instanceof sg?e.worker:null,d=e.verbosity,f=typeof e.docBaseUrl==`string`&&!Md(e.docBaseUrl)?e.docBaseUrl:null,p=uf(e.cMapUrl),m=e.cMapPacked!==!1,h=uf(e.iccUrl),g=uf(e.standardFontDataUrl),_=uf(e.wasmUrl),v=e.stopAtErrors!==!0,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=typeof e.isOffscreenCanvasSupported==`boolean`?e.isOffscreenCanvasSupported:!rp,x=typeof e.isImageDecoderSupported==`boolean`?e.isImageDecoderSupported:!rp,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,C=typeof e.disableFontFace==`boolean`?e.disableFontFace:rp,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||(rp?nh:Qm),M=e.FilterFactory||(rp?th:eh),ee=e.BinaryDataFactory||(rp?rh:Xm),te=e.enableHWA===!0,ne=e.enableWebGPU===!0?_f():Promise.resolve(!1),N=e.useWasm!==!1,re=e.pagesMapper||new Yh,P=typeof e.useSystemFonts==`boolean`?e.useSystemFonts:!rp&&!C,ie=typeof e.useWorkerFetch==`boolean`?e.useWorkerFetch:!!(ee===Xm&&p&&m&&g&&_&&Id(p,document.baseURI)&&Id(g,document.baseURI)&&Id(_,document.baseURI));gd(d);let F={canvasFactory:new j({ownerDocument:E,enableHWA:te}),filterFactory:new M({docId:n,ownerDocument:E}),binaryDataFactory:ie?null:new ee({cMapUrl:p,standardFontDataUrl:g,wasmUrl:_})};u||(u=sg.create({verbosity:d,port:Wh.workerPort}),t._worker=u);let ae={docId:n,apiVersion:`6.4.299`,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:P,useWasm:N,useWorkerFetch:ie,cMapUrl:p,cMapPacked:m,iccUrl:h,standardFontDataUrl:g,wasmUrl:_,hasGPU:!1}},oe={ownerDocument:E,pdfBug:A,styleElement:null,enableHWA:te,loadingParams:{disableAutoFetch:k,enableXfa:T}};return Promise.all([u.promise,ne]).then(function([,e]){if(u.destroyed)throw Error(`Worker was destroyed`);ae.evaluatorOptions.hasGPU=e;let s=u.messageHandler.sendWithPromise(`GetDocRequest`,ae,i?[i.buffer]:null),d;if(!i){if(c)d=new Nh({pdfDataRangeTransport:c,disableRange:D,disableStream:O});else if(r)d=new(Kf(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 Jm(n,e,u.port),i=new cg(r,t,d,oe,F,re);if(t._transport=i,t.destroyed)throw Error(`Loading aborted`);r.send(`Ready`,null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}function Jf(e){return Math.floor(Ad(e,0,1)*255).toString(16).padStart(2,`0`)}function Yf(e){return Ad(e,0,1)*255}function Xf(e){return{bbox:e.box,root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function Zf(e,t){let{focusOutline:n}=e;return{bbox:X._rotateBox(n.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:n.toSVGPath()}}}function Qf(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function $f(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(`.textLayer`):e.parentElement?.closest(`.textLayer`)||null:null}function ep(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 tp(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}}function np(e){return`${(e*100).toFixed(2)}%`}var rp,ip,ap,op,sp,cp,lp,up,dp,K,q,fp,pp,mp,hp,gp,_p,vp,yp,bp,xp,Sp,Cp,wp,Tp,Ep,Dp,Op,J,Y,kp,Ap,jp,Mp,Np,Pp,Fp,Ip,Lp,Rp,zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp,$p,em,tm,nm,rm,im,am,om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm,Em,Dm,Om,km,Am,jm,Mm,Nm,Pm,Fm,Im,Lm,Rm,zm,Bm,Vm,Hm,Um,Wm,Gm,Km,qm,Jm,Ym,Xm,Zm,Qm,$m,eh,th,nh,rh,ih,ah,oh,sh,ch,lh,uh,dh,fh,ph,mh,hh,gh,_h,vh,yh,bh,xh,Sh,Ch,wh,Th,Eh,Dh,Oh,kh,Ah,jh,Mh,Nh,Ph,Fh,Ih,Lh,Rh,zh,Bh,Vh,Hh,Uh,Wh,Gh,Kh,qh,Jh,Yh,Xh,Zh,Qh,$h,eg,tg,ng,rg,ig,ag,og,sg,cg,lg,ug,dg,fg,pg,mg,hg,gg,_g,vg,yg,bg,xg,Sg,Cg,wg,Tg,Eg,Dg,Og,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig,Lg,Rg,zg,Bg,Vg,Hg,Ug,Wg,Gg,Kg,qg,Jg,Yg,Xg,Zg,Qg,$g,e_,X,t_,n_,r_,i_,a_,o_,s_,c_,l_,u_,d_,f_,p_,m_,h_,g_,__,v_,y_,b_,x_,S_,C_,w_,T_=s((()=>{rp=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),ip=[1/0,1/0,-1/0,-1/0],ap=new Float32Array(ip),op=[.001,0,0,.001,0,0],sp=`http://www.w3.org/2000/svg`,cp={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},lp={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},up=`pdfjs_internal_id_`,dp=`pdfjs_internal_editor_`,K={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},q={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},fp={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},pp={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},mp={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},hp={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},gp={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},_p={ERRORS:0,WARNINGS:1,INFOS:5},vp={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},yp={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},bp={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},xp=_p.WARNINGS,Sp=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),Cp=class extends Sp{constructor(e,t){super(e,`PasswordException`),this.code=t}},wp=class extends Sp{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},Tp=class extends Sp{constructor(e){super(e,`InvalidPDFException`)}},Ep=class extends Sp{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},Dp=class extends Sp{constructor(e){super(e,`FormatError`)}},Op=class extends Sp{constructor(e){super(e,`AbortException`)}},J=class{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let t=new Uint32Array(e.buffer,0,1);return G(this,`isLittleEndian`,t[0]===1)}static get isOffscreenCanvasSupported(){return G(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return G(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return G(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return G(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return G(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`)),G(this,`isCanvasFilterSupported`,e?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>`u`)return G(this,`isAlphaColorInputSupported`,!1);let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,G(this,`isAlphaColorInputSupported`,e.value!==`#ff0000`)}static get isBackdropFilterSupported(){return G(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},Y=class{static get hexNums(){return G(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)}},kp=null,Ap=null,jp=()=>[],Mp=()=>new Map,Np=()=>Object.create(null),Pp=()=>new Set,typeof Iterator.prototype.join!=`function`&&(Iterator.prototype.join=function(e){return[...this].join(e)}),Fp=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 G(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 Y.applyTransform(n,this.transform),n}convertToPdfPoint(e,t){let n=[e,t];return Y.applyInverseTransform(n,this.transform),n}},Ip=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`}},Lp=/url\(|image-set\(/i,Rp=/^on/i,zp=class{static get _allowedHtmlElements(){return G(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 G(this,`_allowedSvgElements`,new Set([`ellipse`,`line`,`path`,`rect`,`svg`]))}static get _allowedRichTextElements(){return G(this,`_allowedRichTextElements`,new Set([`a`,`b`,`br`,`div`,`i`,`li`,`ol`,`p`,`span`,`sub`,`sup`,`ul`]))}static get _allowedRichTextAttributes(){return G(this,`_allowedRichTextAttributes`,new Set([`class`,`dir`,`style`]))}static get _allowedRichTextStyles(){return G(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||Rp.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)&&!Lp.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===sp&&this._allowedSvgElements.has(e)?document.createElementNS(sp,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&&Ip.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&&Ip.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 Fp({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}},Bp=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF},Vp=class extends Sp{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}},Hp=class{#e=new Map;times=[];time(e){this.#e.has(e)&&U(`Timer is already running for ${e}`),this.#e.set(e,Date.now())}timeEnd(e){this.#e.has(e)||U(`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(``)}},Up=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))}},Wp=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}},Gp=new Set([`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`]),Kp=class{static get isDarkMode(){return G(this,`isDarkMode`,!!window?.matchMedia?.(`(prefers-color-scheme: dark)`).matches)}},qp=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(),G(this,`commentForegroundColor`,Bd(n))}},Jp=new Map,Yp=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`,Ld,{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,Rd(e)}#d(e){this.#n._focusEventsAllowed=!0,Rd(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`,Ld,{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);t&&(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}},Xp=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`,Ld,{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);e>n?(r=a,n=e):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`,Ld,{signal:o}),i.addEventListener(`click`,r,{signal:o})),this.#e.append(i)}},Zp=Object.freeze({internal:`2837668c-d334-48d1-ba74-aa7deba483da`}),Qp=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}},$p=class{#e=0;get id(){return`${dp}${this.#e++}`}},em=class e{#e=Od();#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="${sp}"><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 G(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 jd(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){U(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}_`)}},tm=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}},nm=class e{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:n}=J.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,jp).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;else{if(n!==null){U(`KeyboardManager: multiple keys in shortcut "${t}"`);break}n=a===`SPACE`?` `:i}}return n===null&&U(`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||Rd(n))}},rm=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 Vd(e),G(this,`_colors`,e)}convert(t){let n=Bd(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?Y.makeHexColor(...t):e}},im=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 tm;#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 $p;#k=!1;#A=!1;#j=!1;#M=null;#N=null;#P=null;#F=null;#I=null;#L=K.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 G(this,`_keyboardManager`,new nm([[[`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,...Zp};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:Bp.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 G(this,`hcmFilter`,this.#V?this.#S.addHCMFilter(this.#V.foreground,this.#V.background):`none`)}get direction(){return G(this,`direction`,getComputedStyle(this.#q).direction)}get _highlightColors(){return G(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 G(this,`highlightColors`,null);let t=new Map,n=!!this.#V;for(let[r,i]of e){let e=r.endsWith(`_HCM`);n&&e?t.set(r.replace(`_HCM`,``),i):!n&&!e&&t.set(r,i)}return G(this,`highlightColors`,t)}get highlightColorNames(){return G(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,Zp),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,...Zp}),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*Bp.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===K.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()};d?this.switchToMode(K.HIGHLIGHT,f):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 Xp(this),this.#D.show(t,n,this.direction===`ltr`))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#c)return null;let t=`${dp}${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}));else if(this.#D?.hide(),this.#z=t,this.#ue({hasSelectedText:!0}),(this.#L===K.HIGHLIGHT||this.#L===K.NONE)&&(this.#L===K.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),this.#E=this.isShiftKeyDown,!this.isShiftKeyDown)){let e=this.#L===K.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===K.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){U(`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){U(`paste: "${e.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key===`Shift`&&(this.isShiftKeyDown=!0),this.#L!==K.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,jp).push(t)};for(let e of this.#r.values())t(e);for(let[e,n]of this.#c)e.startsWith(dp)&&!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!==K.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===K.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#de([[q.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!==K.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===K.POPUP&&this.#d?.hideSidebar(),this.#d?.destroyPopup(),this.#L=e,e===K.NONE){this.setEditingState(!1),this.#pe();for(let e of this.#r.values())e.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#X.resolve()}else{for(let e of this.#r.values())e.addStandaloneCommentButton();e===K.SIGNATURE&&await this.#B?.loadSignatures(),n&&Qp.clearPointerType(),this.setEditingState(!0),await this.#fe(),this.unselectAll();for(let t of this.#i.values())t.updateMode(e);if(e===K.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();else{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 q.CREATE:this.currentLayer.addNewEditor(t);return;case q.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(q.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#de([[q.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){this.#R.has(e)?(this.#R.delete(e),e.unselect(),this.#ue({hasSelectedEditor:this.hasSelection})):(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!==K.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!==K.NONE}get imageManager(){return G(this,`imageManager`,new em)}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!==K.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)}},am=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`,Ld,{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;else{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)}},om=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`,Ld,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{this.#r._focusEventsAllowed=!1,Rd(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{this.#r._focusEventsAllowed=!0,Rd(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){e!==this.#o&&(this.#a=null),e===null?(this.#o=``,this.#c=!0):(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}},sm=1e-4,cm=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/Wp.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/Wp.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.#_();else{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`,Rd,n),t.addEventListener(`pointermove`,Rd,n),t.addEventListener(`pointercancel`,ef,n),t.addEventListener(`pointerup`,ef,n),this.#i?.()}this.#c=tf(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`&&(Rd(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=tf(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<sm||O<sm||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);else{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&&tf(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}},lm=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 rm;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=e.prototype._resizeWithKeyboard,n=im.TRANSLATE_SMALL,r=im.TRANSLATE_BIG;return G(this,`_resizerKeyboardManager`,new nm([[[`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 G(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new um({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){W(`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=Ad(i,0,n-o),a=Ad(a,0,r-s);break;case 90:i=Ad(i,0,n-s),a=Ad(a,o,r);break;case 180:i=Ad(i,o,n),a=Ad(a,s,r);break;case 270:i=Ad(i,s,n),a=Ad(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`,Ld,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#c)}#A(e,t){t.preventDefault();let{isMac:n}=J.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`,Rd,{passive:!1,signal:a}),window.addEventListener(`contextmenu`,Ld,{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=Ad(Math.abs(b[0]-y[0]-E),l,1)/s:T=Ad(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 Yp(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||(am.initialize(e._l10n),this.#n=new am(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 om(this):null}addStandaloneCommentButton(){this._uiManager.hasCommentManager()&&(this.#i?this._uiManager.isEditingMode()&&this.#i.classList.remove(`hidden`):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 om(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 om(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 om(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),$d(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}=J.platform;e.button!==0||e.ctrlKey&&t?e.preventDefault():(this.#m=!0,this._isDraggable?this.#R(e):this.#L(e))}#L(e){let{isMac:t}=J.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){Rd(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`,Rd,a),window.addEventListener(`pointerdown`,e=>{e.pointerType===this.#s&&(this.#C||e.isPrimary)&&o(e),Rd(e)},a));let s=e=>{!this.#o||this.#o===e.pointerId?o(e):Rd(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 cm({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(){this.isSelected&&this._editToolbar?this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),this.div?.classList.add(`selectedEditor`),this._editToolbar?(this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{this.div?.classList.contains(`selectedEditor`)&&this._editToolbar?.show()}))}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)}else 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){!this.#d&&!this.deleted?this.#d=e.addFakeAnnotation(this):this.deleted?(this.#d.remove(),this.#d=null):(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()}},um=class extends lm{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},dm=3285377520,fm=4294901760,pm=65535,mm=class{constructor(e){this.h1=e?e|0:dm,this.h2=e?e|0:dm}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&fm|o*f&pm,o=o<<15|o>>>17,o=o*d&fm|o*p&pm,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&fm|s*f&pm,s=s<<15|s>>>17,s=s*d&fm|s*p&pm,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&fm|o*f&pm,o=o<<15|o>>>17,o=o*d&fm|o*p&pm,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&fm|e*36045&pm,t=t*4283543511&fm|((t<<16|e>>>16)*2950163797&fm)>>>16,e^=t>>>1,e=e*444984403&fm|e*60499&pm,t=t*3301882366&fm|((t<<16|e>>>16)*3120437893&fm)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},hm=Object.freeze({map:null,hash:``,transfer:void 0}),gm=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 lm&&this.#n.delete(t.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),!this.#r.values().some(e=>e instanceof lm)&&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 lm&&((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 _m(this)}get serializable(){if(this.#r.size===0)return hm;let e=new Map,t=new mm,n=[],r=Object.create(null),i=!1;for(let[n,a]of this.#r){let o=a instanceof lm?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}:hm}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let i of this.#r.values()){if(!(i instanceof lm)){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,Mp);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 mm;n.update(e.join(`,`)),t=n.hexdigest()}return this.#t={ids:new Set(e),hash:t}}[Symbol.iterator](){return this.#r.entries()}},_m=class extends gm{#e=hm;constructor(e){super();let{serializable:t}=e;if(t===hm)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(){W(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}get modifiedIds(){return G(this,`modifiedIds`,{ids:new Set,hash:``})}},vm=`__forcedDependency`,{floor:ym,ceil:bm}=Math,xm=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Sm=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===xm}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}},Cm=(e,t)=>e?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),wm=class{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(ip);_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(xm,t.length)):this.#o.fill(xm)}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(Y.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(ip,0)),this}recordClipBox(e,t,n,r,i,a){let o=Y.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform()),s=ip.slice();Y.axialAlignedBoundingBox([n,i,r,a],o,s);let c=Y.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=Y.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform());if(o[0]===-1/0)return Y.axialAlignedBoundingBox([n,i,r,a],s,this.#n),this;let c=ip.slice();return Y.axialAlignedBoundingBox([n,i,r,a],s,c),this.#n[0]=Ad(c[0],o[0],this.#n[0]),this.#n[1]=Ad(c[1],o[1],this.#n[1]),this.#n[2]=Ad(c[2],this.#n[2],o[2]),this.#n[3]=Ad(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=ym(this.#n[0]*256/this.#r),i=ym(this.#n[1]*256/this.#i),a=bm(this.#n[2]*256/this.#r),o=bm(this.#n[3]*256/this.#i);if(nf(this.#a,e,r,i,a,o),n)for(let t of n)for(let n of t)n!==e&&nf(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 Sm(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}},Tm=class{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[vm]:[]};#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)=>{Cm(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},[vm]:{__proto__:this.#t[vm]}},this.#s.save(e),this}restore(e){this.#s.restore(e,this.#o);let t=Object.getPrototypeOf(this.#e);return t===null||(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(vm,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(vm,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],Y.axialAlignedBoundingBox(s,n.fontMatrix,l),(r!==1||i!==0||a!==0)&&rf(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,[vm]),this.#a){let t=Cm(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}},Em=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`)}},Dm={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`,`filter`,`fillColor`]},Om=class e{#e;#t;#n=4;#r=0;#i=new e.#a(this.#n*6);static#a=J.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=Hd(t),o;if(i[0]!==1/0){let e=ip.slice();Y.axialAlignedBoundingBox([0,-r,n,0],a,e);let t=Y.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],Y.applyTransform(o,a,0),Y.applyTransform(o,a,2),Y.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)}},km=/\p{Cc}/u,Am=class{#e=new Set;#t=new Set;#n=null;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.#e.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.#e.delete(e),this._document.fonts.delete(e)}insertRule(e){let t=this.#r();t.insertRule(e,t.cssRules.length)}#r(){if(this.#n)return this.#n;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.#n=n}}return this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement)),this.#n=this.styleElement.sheet}clear(){for(let e of this.#e)this._document.fonts.delete(e);if(this.#e.clear(),this.#t.clear(),this.#n){let{adoptedStyleSheets:e}=this._document;e?.includes(this.#n)&&(this._document.adoptedStyleSheets=e.filter(e=>e!==this.#n)),this.#n=null}this.styleElement?.remove(),this.styleElement=null}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(e&&!this.#t.has(e.loadedName)){if(yd(!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.#t.add(t),n?.(e)}catch{U(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}}else W(`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 U(`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 this.#i(e)}}get isFontLoadingAPISupported(){return G(this,`isFontLoadingAPISupported`,!!this._document?.fonts)}get isSyncFontLoadingSupported(){return G(this,`isSyncFontLoadingSupported`,rp||J.platform.isFirefox)}#i(e){function t(){for(yd(!a.done,`completeRequest() cannot be called twice.`),a.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.resolve,0)}}let{loadingRequests:n}=this,{promise:r,resolve:i}=Promise.withResolvers(),a={done:!1,resolve:i};n.push(a),this._loadTestFont??=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);function o(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function s(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function c(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let l,u,d=this._document.createElement(`canvas`);d.width=1,d.height=1;let f=d.getContext(`2d`),p=0;function m(e,t){++p>30?(U(`Load test font never loaded.`),t()):(f.font=`30px `+e,f.fillText(`.`,0,20),f.getImageData(0,0,1,1).data[3]>0?t():setTimeout(m.bind(null,e,t)))}let h=`lt${Date.now()}${this.loadTestFontId++}`,g=this._loadTestFont;g=c(g,976,h.length,h);let _=1482184792,v=o(g,16);for(l=0,u=h.length-3;l<u;l+=4)v=v-_+o(h,l)|0;l<h.length&&(v=v-_+o(h+`XXX`,l)|0),g=c(g,16,4,s(v));let y=`@font-face {font-family:"${h}";src:${`url(data:font/opentype;base64,${btoa(g)});`}}`;this.insertRule(y);let b=this._document.createElement(`div`);b.style.visibility=`hidden`,b.style.width=b.style.height=`10px`,b.style.position=`absolute`,b.style.top=b.style.left=`0px`;for(let t of[e.loadedName,h]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,b.append(e)}return this._document.body.append(b),m(h,()=>{b.remove(),t()}),r}},jm=class{#e=new Map;#t;constructor(e,t=null,n,r){this.#t=e,this._inspectFont=t,n&&(this.charProcOperatorList=n),r&&Object.assign(this,r)}createNativeFontFace(){let{data:e}=this;if(!e||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,e,{});else{let n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(of(this.cssFontInfo.fontFamily),e,n)}return this._inspectFont?.(this),t}createFontFaceRule(){let{data:e}=this;if(!e||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${e.toBase64()});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:${of(this.cssFontInfo.fontFamily)};${e}src:${t}}`}return this._inspectFont?.(this,t),n}getPathGenerator(e,t){let n=this.#e.get(t);if(n)return n;let r=`${this.loadedName}_path_${t}`,i;try{i=e.get(r)}catch(e){U(`getPathGenerator - ignoring character: "${e}".`)}return n=Qd(i?.path),this.fontExtraProperties||e.delete(r),this.#e.set(t,n),n}get black(){return this.#t.black}get bold(){return this.#t.bold}get disableFontFace(){return this.#t.disableFontFace}set disableFontFace(e){G(this,`disableFontFace`,!!e)}get fontExtraProperties(){return this.#t.fontExtraProperties}get isInvalidPDFjsFont(){return this.#t.isInvalidPDFjsFont}get isType3Font(){return this.#t.isType3Font}get italic(){return this.#t.italic}get missingFile(){return this.#t.missingFile}get remeasure(){return this.#t.remeasure}get vertical(){return this.#t.vertical}get bbox(){return this.#t.bbox}get fontMatrix(){return this.#t.fontMatrix}get fallbackName(){return this.#t.fallbackName}get loadedName(){return this.#t.loadedName}get mimetype(){return this.missingFile?null:`font/opentype`}get data(){return this.#t.data}clearData(){this.#t.clearData()}get cssFontInfo(){return this.#t.cssFontInfo}get systemFontInfo(){return this.#t.systemFontInfo}},Mm=class{static strings=[`fontFamily`,`fontWeight`,`italicAngle`]},Nm=class{static strings=[`css`,`loadedName`,`baseFontName`,`src`]},Pm=class{static bools=[`black`,`bold`,`disableFontFace`,`fontExtraProperties`,`isInvalidPDFjsFont`,`isType3Font`,`italic`,`missingFile`,`remeasure`,`vertical`];static strings=[`fallbackName`,`loadedName`];static OFFSET_BBOX=Math.ceil(this.bools.length*2/8);static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_STRINGS=this.OFFSET_FONT_MATRIX+1+48},Fm=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},Im=class{static get decoder(){return G(this,`decoder`,new TextDecoder)}static get encoder(){return G(this,`encoder`,new TextEncoder)}},Lm=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){return yd(e<Mm.strings.length,`Invalid string index`),sf(this.#e,this.#t,e)}get fontFamily(){return G(this,`fontFamily`,this.#n(0))}get fontWeight(){return G(this,`fontWeight`,this.#n(1))}get italicAngle(){return G(this,`italicAngle`,this.#n(2))}},Rm=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){return yd(e<Nm.strings.length,`Invalid string index`),sf(this.#e,this.#t,e,4)}get css(){return G(this,`css`,this.#n(0))}get loadedName(){return G(this,`loadedName`,this.#n(1))}get baseFontName(){return G(this,`baseFontName`,this.#n(2))}get src(){return G(this,`src`,this.#n(3))}get style(){let e=0;e+=4+this.#t.getUint32(e);let t=sf(this.#e,this.#t,0,e),n=sf(this.#e,this.#t,1,e);return G(this,`style`,{style:t,weight:n})}},zm=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){yd(e<Pm.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 G(this,`black`,this.#n(0))}get bold(){return G(this,`bold`,this.#n(1))}get disableFontFace(){return G(this,`disableFontFace`,this.#n(2))}get fontExtraProperties(){return G(this,`fontExtraProperties`,this.#n(3))}get isInvalidPDFjsFont(){return G(this,`isInvalidPDFjsFont`,this.#n(4))}get isType3Font(){return G(this,`isType3Font`,this.#n(5))}get italic(){return G(this,`italic`,this.#n(6))}get missingFile(){return G(this,`missingFile`,this.#n(7))}get remeasure(){return G(this,`remeasure`,this.#n(8))}get vertical(){return G(this,`vertical`,this.#n(9))}#r(e,t,n,r){let i=this.#t.getUint8(e++);if(i===0)return;yd(i===t,`Invalid array length.`);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 G(this,`bbox`,this.#r(Pm.OFFSET_BBOX,4,`getInt16`,2))}get fontMatrix(){return G(this,`fontMatrix`,this.#r(Pm.OFFSET_FONT_MATRIX,6,`getFloat64`,8))}#i(e){return yd(e<Pm.strings.length,`Invalid string index`),sf(this.#e,this.#t,e,Pm.OFFSET_STRINGS+4)}get fallbackName(){return G(this,`fallbackName`,this.#i(0))}get loadedName(){return G(this,`loadedName`,this.#i(1))}#a(e){let t=Pm.OFFSET_STRINGS;for(let n=0;n<=e;n++)t+=4+this.#t.getUint32(t);let n=this.#t.getUint32(t);return{offset:t,length:n}}get data(){let{offset:e,length:t}=this.#a(2);return t?new Uint8Array(this.#e,e+4,t):void 0}clearData(){let{offset:e,length:t}=this.#a(2);t&&(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{offset:e,length:t}=this.#a(1),n=null;if(t){let r=new Uint8Array(this.#e,e+4,t).slice();n=new Lm(r.buffer)}return G(this,`cssFontInfo`,n)}get systemFontInfo(){let{offset:e,length:t}=this.#a(0),n=null;if(t){let r=new Uint8Array(this.#e,e+4,t).slice();n=new Rm(r.buffer)}return G(this,`systemFontInfo`,n)}},Bm=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,t=this.data[Fm.KIND],n=!!this.data[Fm.HAS_BBOX],r=!!this.data[Fm.HAS_BACKGROUND],i=e.getUint32(Fm.N_COORD,!0),a=e.getUint32(Fm.N_COLOR,!0),o=e.getUint32(Fm.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,[c[0],c[1]],[c[2],c[3]],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[Fm.SHADING_TYPE],t=null;if(c.length>0){t=ip.slice();for(let e=0,n=c.length;e<n;e+=2)Y.pointBoundingBox(c[e],c[e+1],t)}return[`Mesh`,e,c,l,i,t,d,f]}throw Error(`Unsupported pattern kind: ${t}`)}},Vm=class{#e;constructor(e){this.#e=e}get path(){return J.isFloat16ArraySupported?new Float16Array(this.#e):new Float32Array(this.#e)}},Hm=e=>typeof e==`object`&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,Um=e=>typeof e==`object`&&typeof e?.name==`string`,Wm=kd.bind(null,Hm,Um),Gm=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){U("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()}},Km={DATA:1,ERROR:2},qm={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8},Jm=class{#e=new Map;#t=new Map;#n=1;#r;#i=new AbortController;#a;#o=new Map;#s=1;#c=new Map;#l;constructor(e,t,n){this.#a=e,this.#l=t,this.#r=n,n.addEventListener(`message`,this.#u.bind(this),{signal:this.#i.signal})}#u({data:e}){if(e.targetName!==this.#a)return;if(e.stream){this.#f(e);return}if(e.callback){let{callbackId:t,callback:n}=e,r=this.#t.get(t);if(!r)throw Error(`Cannot resolve callback ${t}`);if(this.#t.delete(t),n===Km.DATA)r.resolve(e.data);else if(n===Km.ERROR)r.reject(ff(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.#e.get(e.action);if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.#a,r=e.sourceName,i=this.#r;Promise.try(t,e.data).then(t=>{i.postMessage({sourceName:n,targetName:r,callback:Km.DATA,callbackId:e.callbackId,data:t})},t=>{i.postMessage({sourceName:n,targetName:r,callback:Km.ERROR,callbackId:e.callbackId,reason:ff(t)})})}else e.streamId?this.#d(e):t(e.data)}on(e,t){let n=this.#e;if(n.has(e))throw Error(`There is already a "${e}" handler.`);n.set(e,t)}send(e,t,n){this.#r.postMessage({sourceName:this.#a,targetName:this.#l,action:e,data:t},n)}sendWithPromise(e,t,n){let r=this.#n++,i=Promise.withResolvers();this.#t.set(r,i);try{this.#r.postMessage({sourceName:this.#a,targetName:this.#l,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.#s++,a=this.#a,o=this.#l,s=this.#r;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.#o.set(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.#o.get(i).pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:qm.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{yd(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.#o.get(i).cancelCall=t,this.#o.get(i).isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:qm.CANCEL,streamId:i,reason:ff(e)}),t.promise}},n)}#d(e){let t=e.streamId,n=this.#a,r=e.sourceName,i=this.#r,a=this.#c,o=this.#e.get(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:qm.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:qm.CLOSE,streamId:t}),a.delete(t))},error(e){yd(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:qm.ERROR,streamId:t,reason:ff(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,a.set(t,s),Promise.try(o,e.data,s).then(()=>{i.postMessage({sourceName:n,targetName:r,stream:qm.START_COMPLETE,streamId:t,success:!0})},e=>{i.postMessage({sourceName:n,targetName:r,stream:qm.START_COMPLETE,streamId:t,reason:ff(e)})})}#f(e){let t=e.streamId,n=this.#a,r=e.sourceName,i=this.#r,a=this.#o.get(t),o=this.#c.get(t);switch(e.stream){case qm.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(ff(e.reason));break;case qm.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(ff(e.reason));break;case qm.PULL:if(!o){i.postMessage({sourceName:n,targetName:r,stream:qm.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||df).then(()=>{i.postMessage({sourceName:n,targetName:r,stream:qm.PULL_COMPLETE,streamId:t,success:!0})},e=>{i.postMessage({sourceName:n,targetName:r,stream:qm.PULL_COMPLETE,streamId:t,reason:ff(e)})});break;case qm.ENQUEUE:if(yd(a,`enqueue should have stream controller`),a.isClosed)break;a.controller.enqueue(e.chunk);break;case qm.CLOSE:if(yd(a,`close should have stream controller`),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#p(a,t);break;case qm.ERROR:yd(a,`error should have stream controller`),a.controller.error(ff(e.reason)),this.#p(a,t);break;case qm.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(ff(e.reason)),this.#p(a,t);break;case qm.CANCEL:if(!o)break;let s=ff(e.reason);Promise.try(o.onCancel||df,s).then(()=>{i.postMessage({sourceName:n,targetName:r,stream:qm.CANCEL_COMPLETE,streamId:t,success:!0})},e=>{i.postMessage({sourceName:n,targetName:r,stream:qm.CANCEL_COMPLETE,streamId:t,reason:ff(e)})}),o.sinkCapability.reject(s),o.isCancelled=!0,this.#c.delete(t);break;default:throw Error(`Unexpected stream case`)}}async#p(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),this.#o.delete(t)}destroy(){this.#i?.abort(),this.#i=null}},Ym=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:W(`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){W("Abstract method `_fetch` called.")}},Xm=class extends Ym{async _fetch(e,t){let n=await jd(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:Td(n)}},Zm=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){W("Abstract method `_createCanvas` called.")}},Qm=class extends Zm{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}},$m=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){}},eh=class extends $m{#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(sp,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(sp,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){let t=e=>e&&Array.from(e,e=>e/255).join(`,`);if(e.length===1){let n=t(e[0]);return[n,n,n]}let[n,r,i]=e;return[t(n),t(r),t(i)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(Md(e)?U(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=Sd(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=Y.makeHexColor(...a);let o=this.#v(t);if(t=Y.makeHexColor(...o),this.#b(),e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array.from({length:256},(e,t)=>Jd(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`||!J.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(sp,`feComponentTransfer`);o.append(s);let c=this.#i.createElementNS(sp,`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(sp,`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(sp,`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(sp,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#l.append(t),t}#h(e,t,n){if(!n)return;let r=this.#i.createElementNS(sp,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#i.createElementNS(sp,`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(sp,`feComponentTransfer`);t.append(n),this.#h(n,`feFuncA`,e)}#v(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,Bd(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#y(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,zd(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[pf(t,a,i),pf(n,o,i),pf(r,s,i)]}},rp&&U("Please use the `legacy` build in Node.js environments."),th=class extends $m{},nh=class extends Zm{_createCanvas(e,t){return process.getBuiltinModule(`module`).createRequire({}.url)(`@napi-rs/canvas`).createCanvas(e,t)}},rh=class extends Ym{async _fetch(e,t){return mf(e)}},ih=`
55
+ struct Uniforms {
56
+ offsetX : f32,
57
+ offsetY : f32,
58
+ scaleX : f32,
59
+ scaleY : f32,
60
+ paddedWidth : f32,
61
+ paddedHeight : f32,
62
+ borderSize : f32,
63
+ _pad : f32,
64
+ };
65
+
66
+ @group(0) @binding(0) var<uniform> u : Uniforms;
67
+
68
+ struct VertexInput {
69
+ @location(0) position : vec2<f32>,
70
+ @location(1) color : vec4<f32>,
71
+ };
72
+
73
+ struct VertexOutput {
74
+ @builtin(position) position : vec4<f32>,
75
+ @location(0) color : vec3<f32>,
76
+ };
77
+
78
+ @vertex
79
+ fn vs_main(in : VertexInput) -> VertexOutput {
80
+ var out : VertexOutput;
81
+ let cx = (in.position.x + u.offsetX) * u.scaleX;
82
+ let cy = (in.position.y + u.offsetY) * u.scaleY;
83
+ out.position = vec4<f32>(
84
+ ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
85
+ 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
86
+ 0.0,
87
+ 1.0
88
+ );
89
+ out.color = in.color.rgb;
90
+ return out;
91
+ }
92
+
93
+ @fragment
94
+ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
95
+ return vec4<f32>(in.color, 1.0);
96
+ }
97
+ `,ah=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:ih});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()}},oh=new ah,sh={FILL:`Fill`,STROKE:`Stroke`,SHADING:`Shading`},ch=class{matrix=null;isModifyingCurrentTransform(){return!1}getPattern(){W("Abstract method `getPattern` called.")}},lh=class extends ch{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(),Y.applyTransform(r,t),Y.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);Y.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(),Y.applyTransform(n,t),Y.applyTransform(r,t));let i=this._r1,a=this._r0;if(t){let e=new Float32Array(2);Y.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}_createRasterPattern(e,t,n,r,i,a){let o=Math.ceil(r[2]-r[0])||1,s=Math.ceil(r[3]-r[1])||1,c=t.canvasFactory.create(o,s),l=c.context;l.clearRect(0,0,o,s),l.beginPath(),l.rect(0,0,o,s),l.translate(-r[0],-r[1]),n=Y.transform(n,[1,0,0,1,r[0],r[1]]),l.transform(...i),xf(l,this._bbox),this.areConic()&&(l.fillStyle=this._createReversedGradient(l),l.fill()),l.fillStyle=this._createGradient(l),l.fill(),a?.applyToCanvas(l);let u=e.createPattern(c.canvas,`no-repeat`);return t.canvasFactory.destroy(c),u.setTransform(new DOMMatrix(n)),u}getPattern(e,t,n,r){let i=t.current.transferMapsFallback;if(r===sh.STROKE||r===sh.FILL){if(this.isOriginBased()&&!i){let r=Y.transform(n,t.baseTransform);this.matrix&&(r=Y.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,Hd(e))||[0,0,0,0],o=this.matrix?Y.transform(t.baseTransform,this.matrix):t.baseTransform;return this._createRasterPattern(e,t,n,a,o,i)}return i&&n?this._createRasterPattern(e,t,n,t.current.clipBox,Hd(e),i):(this.areConic()&&(e.save(),xf(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-1e10,-1e10,2e10,2e10),e.restore()),xf(e,this._bbox),this._createGradient(e))}},uh=class extends ch{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],yf()}_createMeshCanvas(e,t,n,r=null){let i=1.1,a=3e3,o=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,l=Math.ceil(this._bounds[3])-s,u=Math.min(Math.ceil(Math.abs(c*e[0]*i)),a)||1,d=Math.min(Math.ceil(Math.abs(l*e[1]*i)),a)||1,f=c?c/u:1,p=l?l/d:1,m={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-s,scaleX:1/f,scaleY:1/p},h=u+4,g=d+4,_=n.create(h,g);if(vf()&&this._vertexCount>48)_.context.drawImage(bf(this._posData,this._colData,this._vertexCount,m,t,h,g,2),0,0);else{let e=_.context.createImageData(u,d);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)Sf(e,m,t,t+1,t+2,t,t+1,t+2);_.context.putImageData(e,2,2)}return r?.applyToCanvas(_.context),{canvas:_.canvas,offsetX:o-2*f,offsetY:s-2*p,scaleX:f,scaleY:p}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,r){xf(e,this._bbox);let i=new Float32Array(2);if(r===sh.SHADING)Y.singularValueDecompose2dScale(Hd(e),i);else if(this.matrix){Y.singularValueDecompose2dScale(this.matrix,i);let[e,n]=i;Y.singularValueDecompose2dScale(t.baseTransform,i),i[0]*=e,i[1]*=n}else Y.singularValueDecompose2dScale(t.baseTransform,i);let a=this._createMeshCanvas(i,r===sh.SHADING?null:this._background,t.canvasFactory,t.current.transferMapsFallback);r!==sh.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}},dh=class extends ch{getPattern(){return`hotpink`}},fh={COLORED:1,UNCOLORED:2},ph=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?Y.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=ip.slice();Y.axialAlignedBoundingBox(e,Y.inverseTransform(this.patternBaseMatrix),n),t[0]=n[2]-n[0],t[1]=n[3]-n[1],t[2]=n[0],t[3]=n[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,u.current.transferMapsFallback=e.current.transferMapsFallback,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=Hd(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),u.dependencyTracker?.restore(),l.restore(),c}_getCombinedScales(){let e=new Float32Array(2);Y.singularValueDecompose2dScale(this.matrix,e);let[t,n]=e;return Y.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 Em(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=Hd(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),vd(`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.min(Math.floor(o/c),Math.ceil(t.width/g)):0,S=h?Math.min(Math.floor(s/l),Math.ceil(t.height/_)):0,C=t,w=null;if(h){w=e.canvasFactory.create(t.width,_);let n=w.context;for(let e=S;e>=0;e--)n.drawImage(t,0,_*e,t.width,_,0,0,t.width,_);C=w.canvas}for(let e=x;e>=0;e--)b.drawImage(C,g*e,0,g,_,0,0,g,_);return w&&e.canvasFactory.destroy(w),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),Y.axialAlignedBoundingBox([t,n,r,i],Hd(e.ctx),e.current.minMax),e.ctx.clip(s),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,n){switch(t){case fh.COLORED:n=`#000000`;break;case fh.UNCOLORED:break;default:throw new Dp(`Unsupported paint type: ${t}`)}let{ctx:r,current:i}=e;i.patternFill=i.patternStroke=!1,r.fillStyle=r.strokeStyle=i.transferMapsFallback?.applyToColor(n)??n,i.fillColor=i.strokeColor=n}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,r,i){let a=r===sh.SHADING?n:Y.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}},mh=16,hh=100,gh=15,_h=10,vh=16,yh=new Float32Array(2),bh=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=op;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=pp.FILL;textRise=0;fillColor=`#000000`;strokeColor=`#000000`;tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps=`none`;transferMapsFallback=null;minMax=ap.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=sh.FILL,t=null){let n=this.minMax.slice();if(e===sh.STROKE){t||W(`Stroke bounding box must include transform.`),Y.singularValueDecompose2dScale(t,yh);let e=yh[0]*this.lineWidth/2,r=yh[1]*this.lineWidth/2;n[0]-=e,n[1]-=r,n[2]+=e,n[3]+=r}return n}updateClipFromPath(){let e=Y.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(ap,0)}getClippedPathBoundingBox(e=sh.FILL,t=null){return Y.intersect(this.clipBox,this.getPathBoundingBox(e,t))}},xh=class e{#e;constructor(t){let[n,r=n,i=n]=t,{identityMap:a}=e;this.#e=[n||a,r||a,i||a]}static get identityMap(){return G(this,`identityMap`,Uint8Array.from({length:256},(e,t)=>t))}applyToColor(e){if(typeof e!=`string`||!e.startsWith(`#`))return e;let[t,n,r]=zd(e),[i,a,o]=this.#e;return Y.makeHexColor(i[t],a[n],o[r])}applyToImageData({data:e}){let[t,n,r]=this.#e;for(let i=0,a=e.length;i<a;i+=4)e[i]=t[e[i]],e[i+1]=n[e[i+1]],e[i+2]=r[e[i+2]]}applyToCanvas(e){let{width:t,height:n}=e.canvas,r=e.getImageData(0,0,t,n);this.applyToImageData(r),e.putImageData(r,0,0)}},Sh=[`butt`,`round`,`square`],Ch=[`miter`,`round`,`bevel`],wh={},Th={},Eh=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 bh(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._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(...Hd(this.compositeCtx))}this.ctx.save(),kf(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=Hd(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>_h&&typeof n==`function`,u=l?Date.now()+gh: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,e)){if(m=o[s],h=a[s]??null,m!==vp.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>_h){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.#x(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.patternFill,o=a?this.current.fillColor:n.fillStyle,s=Hd(n),c,l,u,d;if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;l=JSON.stringify(a?s:[s.slice(0,4),o]),c=this._cachedBitmapsMap.getOrInsertComputed(n,Mp);let r=c.get(l);if(r&&!a){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,Dm.transformAndFill),{canvas:r,offsetX:t,offsetY:n}}u=r}u||(d=this.canvasFactory.create(r,i),Df(d.context,t));let f=Y.transform(s,[1/r,0,0,-1/i,0,0]);f=Y.transform(f,[1,0,0,1,0,-i]);let p=ap.slice();Y.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,Ud(x));u=e.img,w=e.tmpCanvas,u!==d.canvas&&(this.canvasFactory.destroy(d),d=null),c&&a&&(c.set(l,u),w=null,d=null)}x.imageSmoothingEnabled=Af(Hd(x),t.interpolate),Tf(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=Y.transform(Ud(x),[1,0,0,1,-S,-C]);return x.fillStyle=a?o.getPattern(n,this,T,sh.FILL,e):o,x.fillRect(0,0,r,i),c&&!a&&c.set(l,b.canvas),this.dependencyTracker?.recordDependencies(e,Dm.transformAndFill),{canvas:b.canvas,canvasEntry:c&&!a?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=Sh[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData(`lineJoin`,e),this.ctx.lineJoin=Ch[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);let t=this.filterFactory.addFilter(r);this.ctx.filter=t;let n=null;r&&(t===`none`||!J.isCanvasFilterSupported||this.ctx.filter===`none`||this.ctx.filter===``)&&(this.ctx.filter=t=`none`,n=new xh(r)),this.current.transferMaps=t,(n||this.current.transferMapsFallback)&&(this.current.transferMapsFallback=n,this.current.patternFill||(this.ctx.fillStyle=this.#y(this.current.fillColor)),this.current.patternStroke||(this.ctx.strokeStyle=this.#y(this.current.strokeColor)));break}}}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]=zd(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&&W(`_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=J.isCanvasFilterSupported&&u.filter!==`none`&&u.filter!==``;if(u.drawImage(s.canvas,0,0),J.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()),Of(this.suspendedCtx,i),wf(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(),Of(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=J.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,J.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,J.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()),Of(this.ctx,i),this.#o=i.globalCompositeOperation,i.globalCompositeOperation=`source-over`,wf(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,Of(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&&Of(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){this.dependencyTracker?.restore(e),this.stateStack.length===0?this.inSMaskMode&&this.endSMaskMode():(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(Of(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1)}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}constructPath(e,t,n,r){let[i]=n;if(!r){i||=n[0]=new Path2D,t!==vp.stroke&&t!==vp.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,i);return}if(this.dependencyTracker!==null){let n=t===vp.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]=Qd(i)),Y.axialAlignedBoundingBox(r,Hd(this.ctx),this.current.minMax);let a=this.current.tilingPatternDims;if(a&&t!==vp.stroke&&t!==vp.closeStroke&&this.current.fillColor instanceof ph){let e=Y.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,Ud(i),sh.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,Dm.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(sh.STROKE,Hd(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,Dm.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,Ud(i),sh.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,Dm.rawFillPath).recordOperation(e),this.#_(n)}clip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=wh}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=Th}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||op,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&U(`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=Ad(n,mh,hh);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&pp.FILL_STROKE_MASK,f=!!(l&pp.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===pp.FILL||d===pp.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===pp.STROKE||d===pp.FILL_STROKE){if(a){t||=o.getTransform(),o.setTransform(...a);let{a:e,b:n,c:r,d:i}=t,s=Y.inverseTransform(a),c=Y.transform([e,n,r,i,0,0],s);Y.singularValueDecompose2dScale(c,yh),o.lineWidth*=Math.max(yh[0],yh[1])/u,o.stroke(this.#v(h,t,a))}else o.lineWidth/=u,o.stroke(h)}o.restore()}else(d===pp.FILL||d===pp.FILL_STROKE)&&(o.fillText(t,n,r),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t))),(d===pp.STROKE||d===pp.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t)).recordDependencies(e,Dm.stroke),o.strokeText(t,n,r));f&&((this.pendingTextPaths||=[]).push({transform:Hd(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 G(this,`isFontSubpixelAAEnabled`,r)}showText(e,t){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,Dm.showText).resetBBox(e),this.current.textRenderingMode&pp.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=i*n.fontMatrix[0],g=n.textRenderingMode===pp.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=n.textRenderingMode&pp.FILL_STROKE_MASK,b=y===pp.FILL||y===pp.FILL_STROKE,x=y===pp.STROKE||y===pp.FILL_STROKE,S=n.lineWidth,C=n.textMatrixScale;if(C===0||S===0?x&&(S=this.getSinglePixelWidth()):S/=C,s!==1&&(o.scale(s,s),S/=s),o.lineWidth=S,b&&n.patternFill){o.save();let t=n.fillColor.getPattern(o,this,Ud(o),sh.FILL,e);_=Hd(o),o.restore(),o.fillStyle=t}if(x&&n.patternStroke){o.save();let t=n.strokeColor.getPattern(o,this,Ud(o),sh.STROKE,e);v=Hd(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*h*d,o.restore(),this.compose(),this.#_(a);return}let w=0,T=0;for(;T<f;++T){let n=t[T];if(typeof n==`number`){w+=m*n*i/1e3;continue}let a=!1,d=(n.isSpace?l:0)+c,f=n.fontChar,y=n.accent,b,x,S=n.width;if(p){let e=n.vmetric,t=-e[1]*h,r=e[2]*h;S=-e[0],b=t/s,x=(w+r)/s}else b=w/s,x=0;let C;if(r.remeasure&&S>0){C=o.measureText(f);let e=C.width*1e3/i*s;if(S<e&&this.isFontSubpixelAAEnabled){let t=S/e;a=!0,o.save(),o.scale(t,1),b/=t}else S!==e&&(b+=(S-e)/2e3*i/s)}if(this.contentVisible&&(n.isInFont||r.missingFile)){if(g&&!y)o.fillText(f,b,x),this.dependencyTracker?.recordCharacterBBox(e,o,C?{bbox:null}:r,i/s,b,x,()=>C??o.measureText(f));else if(this.paintChar(e,f,b,x,_,v),y){let t=b+i*y.offset.x/s,n=x-i*y.offset.y/s;this.paintChar(e,y.fontChar,t,n,_,v)}}let E=p?S*h-d*u:S*h+d*u;w+=E,a&&o.restore()}p?n.y-=w:n.x+=w*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||op,f=t.length,p=r.textRenderingMode===pp.INVISIBLE,m,h,g,_;if(p||a===0)return;this._cachedScaleForStroking[0]=-1,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 Em(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]===vp.setCharWidth&&(r.fillAlpha=r.strokeAlpha=1,n.globalAlpha=1),n.scale(a,a),n.transform(...d),this.executeOperatorList(o),this.restore()):U(`Type3 character "${h.operatorListId}" is not available.`);let f=[h.width,0];Y.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||Hd(this.ctx);r=new ph(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 Em(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 ph?[0,0,0,0]:null}#y(e){return this.current.transferMapsFallback?.applyToColor(e)??e}setStrokeRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.current.strokeColor=t,this.ctx.strokeStyle=this.#y(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.current.fillColor=t,this.ctx.fillStyle=this.#y(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,()=>Cf(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,Ud(r),sh.SHADING,e);let i=Ud(r);if(i){let{width:e,height:t}=r.canvas,n=ap.slice();Y.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,Dm.transform).recordDependencies(e,Dm.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),this.#_(n)}beginInlineImage(){W(`Should not call beginInlineImage`)}beginImageData(){W(`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=Hd(this.ctx),n)){Y.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&&vd(`TODO: Fully support non-isolated non-knockout groups.`);let i=Hd(r);t.matrix&&r.transform(...t.matrix);let a=[0,0,r.canvas.width,r.canvas.height],o;t.bbox?(o=ap.slice(),Y.axialAlignedBoundingBox(t.bbox,Hd(r),o),o=Y.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`&&!this.current.transferMapsFallback;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()),Of(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);else if(t.isGray&&this.#b(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.#x(i);else{this.ctx.restore();let t=Hd(this.ctx);this.restore(e),this.current.transferMapsFallback?.applyToCanvas(n),this.ctx.save(),this.ctx.setTransform(...t);let a=ap.slice();Y.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,J.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,J.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.#x(i),this.compose(a)}}#b(e){let{canvas:t}=e,{width:n,height:r}=t;if(J.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)}#x(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(),kf(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],Y.singularValueDecompose2dScale(Hd(this.ctx),yh);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,jp);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(yh[0],0,0,-yh[1],0,s*yh[1]),kf(this.ctx)}else{kf(this.ctx),this.endPath(e);let t=new Path2D;t.rect(n[0],n[1],i,s),this.ctx.clip(t)}}this.current=new bh(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...r),this.transform(e,...i),this.baseTransform=Hd(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=Hd(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=Y.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.patternFill,a=i?this.current.fillColor:r.fillStyle;this.dependencyTracker?.resetBBox(e).recordDependencies(e,Dm.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(),Df(u,this.getObject(e,t,n)),u.globalCompositeOperation=`source-in`,u.fillStyle=i?a.getPattern(u,this,Ud(r),sh.FILL,e):a,u.fillRect(0,0,o,s),u.restore(),r.save(),r.transform(...c),r.scale(1,-1),Tf(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);n?this.paintInlineImageXObject(e,n):U(`Dependent image isn't ready yet`)}paintImageXObjectRepeat(e,t,n,r,i){if(!this.contentVisible)return;let a=this.getObject(e,t);if(!a){U(`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`?this.current.transferMapsFallback?.applyToCanvas(e):(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter=`none`),e.canvas}applyTransferMapsToBitmap(e){let{transferMaps:t,transferMapsFallback:n}=this.current;if(t===`none`&&!n)return{img:e.bitmap,canvasEntry:null};let{bitmap:r,width:i,height:a}=e,o=this.canvasFactory.create(i,a),s=o.context;return s.filter=t,s.drawImage(r,0,0),s.filter=`none`,n?.applyToCanvas(s),{img:o.canvas,canvasEntry:o}}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);Ef(e.context,t),s=this.applyTransferMapsToCanvas(e.context),c=e}let l=this._scaleImage(s,Ud(a));a.imageSmoothingEnabled=Af(Hd(a),t.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(e).recordBBox(e,a,0,n,-r,0).recordDependencies(e,Dm.imageXObject).recordOperation(e),this.imagesTracker?.record(a,n,r,this.dependencyTracker.clipBox)),Tf(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&&!this.current.transferMapsFallback)a=t.bitmap;else if(t.bitmap)({img:a,canvasEntry:o}=this.applyTransferMapsToBitmap(t));else{let e=t.width,n=t.height,r=this.canvasFactory.create(e,n);Ef(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),Tf(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,Dm.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===Th?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(){let e=Hd(this.ctx);if(e[1]===0&&e[2]===0)return 1/Math.min(Math.abs(e[0]),Math.abs(e[3]));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]);return Math.max(n,r)/t}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 vp)Eh.prototype[e]!==void 0&&(Eh.prototype[vp[e]]=Eh.prototype[e]);Dh=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 yd(!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)}},Oh=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(){W("Abstract method `read` called")}cancel(e){W("Abstract method `cancel` called")}},kh=class{_stream=null;constructor(e,t,n){this._stream=e}async read(){W("Abstract method `read` called")}cancel(e){W("Abstract method `cancel` called")}},Ah=class extends Dh{_responseOrigin=null;constructor(e){super(e,jh,Mh);let{httpHeaders:t,url:n}=e;yd(/https?:/.test(n.protocol),`PDFFetchStream only supports http(s):// URLs.`),this.headers=Mf(!0,t)}},jh=class extends Oh{_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,zf(i,new Headers(e.headers),a,this._abortController).then(n=>{e._responseOrigin=Pf(n.url),Bf(n.status,i),this._reader=n.body.getReader();let a=n.headers,{contentLength:o,isRangeSupported:s}=Ff({responseHeaders:a,isHttp:!0,rangeChunkSize:r,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=If(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Op(`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:Vf(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},Mh=class extends kh{_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}`),zf(r,a,i,this._abortController).then(t=>{Rf(Pf(t.url),e._responseOrigin),Bf(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:Vf(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},Nh=class extends Dh{_progressiveDone=!1;_queuedChunks=[];constructor(e){super(e,Ph,Fh);let{pdfDataRangeTransport:t}=e,{initialData:n,progressiveDone:r}=t;if(n?.length>0){let e=Hf(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=Hf(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);yd(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()}},Ph=class extends Oh{#e=Uf.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,Nd(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()}},Fh=class extends kh{#e=Uf.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?.()}},Ih=200,Lh=206,Rh=class extends Dh{#e=new WeakMap;_responseOrigin=null;constructor(e){super(e,zh,Bh);let{httpHeaders:t,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=Mf(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===Lh||e===Ih):n.validateStatus=e=>e===Ih,t.responseType=`arraybuffer`,yd(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||Ih;if(!n.validateStatus(r)){n.onError(e.status);return}let i=Wf(e.response);if(r===Lh){let t=e.getResponseHeader(`Content-Range`);/bytes \d+-\d+\/\d+/.test(t)?n.onDone(i):(U(`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}},zh=class extends Oh{#e=Uf.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=Pf(r.responseURL);let i=r.getAllResponseHeaders(),a=new Headers(i?Nf(i.trimStart()).split(/[\r\n]+/).map(e=>{let[t,...n]=e.split(`: `);return[t,n.join(`: `)]}):[]),{contentLength:o,isRangeSupported:s}=Ff({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:n,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=If(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=Lf(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}},Bh=class extends kh{#e=Uf.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=Pf(this._requestXhr?.responseURL);try{Rf(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??=Lf(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?.()}},Vh=class extends Dh{constructor(e){super(e,Hh,Uh);let{url:t}=e;yd(t.protocol===`file:`,`PDFNodeStream only supports file:// URLs.`)}},Hh=class extends Oh{_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=Gf(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 Op(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(e=>{e.code===`ENOENT`&&(e=Lf(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:Vf(e),done:!1})}cancel(e){this._reader?.cancel(e)}},Uh=class extends kh{_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r}=e._source;try{let e=Gf(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:Vf(e),done:!1}}cancel(e){this._reader?.cancel(e)}},Wh=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}},Gh=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()}},Kh=Symbol(`INTERNAL`),qh=class{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:t,intent:n,usage:r,rbGroups:i}){this.#e=!!(e&cp.DISPLAY),this.#t=!!(e&cp.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!==Kh&&W("Internal method `_setVisible` called."),this.#n=n,this.#r=t}get serializable(){return{userSet:this.#n,visible:this.#r}}},Jh=class e{#e=null;#t=new Map;#n=null;#r=null;#i;creator=null;name=null;constructor(e,t=cp.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 qh(t,n));if(n){n.size!==this.#t.size&&W(`Incorrect serialized groupState.`);for(let[e,t]of n)this.#t.get(e)._setVisible(Kh,t.visible,t.userSet)}else{if(e.baseState===`OFF`)for(let e of this.#t.values())e._setVisible(Kh,!1);for(let t of e.on)this.#t.get(t)._setVisible(Kh,!0);for(let t of e.off)this.#t.get(t)._setVisible(Kh,!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 U(`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 vd(`Optional content group not defined.`),!0;if(e.type===`OCG`)return this.#t.has(e.id)?this.#t.get(e.id).visible:(U(`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 U(`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 U(`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 U(`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 U(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return U(`Unknown optional content policy ${e.policy}.`),!0}return U(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){let r=this.#t.get(e);if(!r)U(`Optional content group not found: ${e}`);else{if(n&&t&&r.rbGroups.length)for(let t of r.rbGroups)for(let n of t)n!==e&&this.#t.get(n)?._setVisible(Kh,!1,!0);r._setVisible(Kh,!!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 mm;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)}},Yh=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=Ad(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,jp).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)}},Xh=Symbol(`INITIAL_DATA`),Zh=()=>({...Promise.withResolvers(),data:Xh}),Qh=class{#e=new Map;get(e,t=null){if(t){let n=this.#e.getOrInsertComputed(e,Zh);return n.promise.then(()=>t(n.data)),null}let n=this.#e.get(e);if(!n||n.data===Xh)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!==Xh}delete(e){let t=this.#e.get(e);return!t||t.data===Xh?!1:(this.#e.delete(e),!0)}resolve(e,t=null){let n=this.#e.getOrInsertComputed(e,Zh);if(n.data!==Xh)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!==Xh&&(yield[e,t])}},$h=1e5,eg=30,tg=class e{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#i=null;#a=null;#o=null;#s=0;#c=0;#l=Wp.pixelRatio;#u=null;#d=null;#f=0;#p=0;#m=Object.create(null);#h=[];#g=null;#_=[];#v=new WeakMap;#y=null;static#b=new Map;static#x=new Map;static#S=new WeakMap;static#C=null;static#w=new Set;constructor({textContentSource:t,images:n,container:r,viewport:i}){if(t instanceof ReadableStream)this.#g=t;else if(typeof t==`object`)this.#g=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error(`No "textContentSource" parameter specified.`);this.#t=this.#d=r,this.#i=n,this.#p=i.scale*this.#l,this.#f=i.rotation,this.#o={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:o,pageX:s,pageY:c}=i.rawDims;this.#y=[1,0,0,-1,-s,c+o],this.#c=a,this.#s=o,e.#j(),r.style.setProperty(`--min-font-size`,e.#C),Wd(r,i),this.#e.promise.finally(()=>{e.#w.delete(this),this.#o=null,this.#m=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:t}=J.platform;return G(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.#u.read().then(({value:e,done:n})=>{n?this.#e.resolve():(this.#a??=e.lang,Object.assign(this.#m,e.styles),this.#T(e.items),t())},this.#e.reject)};return this.#u=this.#g.getReader(),e.#w.add(this),t(),this.#e.promise}update({viewport:t,onBefore:n=null}){let r=t.scale*Wp.pixelRatio,i=t.rotation;if(i!==this.#f&&(n?.(),this.#f=i,Wd(this.#d,{rotation:i})),r!==this.#p){n?.(),this.#p=r,this.#l=Wp.pixelRatio;let t={div:null,properties:null,ctx:e.#O(this.#a)};for(let e of this.#_)t.properties=this.#v.get(e),t.div=e,this.#D(t)}}cancel(){let e=new Op(`TextLayer task cancelled.`);this.#u?.cancel(e).catch(()=>{}),this.#u=null,this.#e.reject(e)}get textDivs(){return this.#_}get textContentItemsStr(){return this.#h}#T(t){if(this.#n)return;this.#o.ctx??=e.#O(this.#a);let n=this.#_,r=this.#h;for(let e of t){if(n.length>$h){U(`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)}else r.push(e.str),this.#E(e)}}#E(t){let n=document.createElement(`span`),r={angle:0,canvasWidth:0,hasText:t.str!==``,hasEOL:t.hasEOL,fontSize:0};this.#_.push(n);let i=Y.transform(this.#y,t.transform),a=Math.atan2(i[1],i[0]),o=this.#m[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.#M(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)}%`;let p=Math.round(c*100)/100;f.setProperty(`--font-height`,`${p}px`),f.fontFamily=s,r.fontSize=p,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 m=!1;if(t.str.length>1)m=!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&&(m=!0)}if(m&&(r.canvasWidth=o.vertical?t.height:t.width),this.#v.set(n,r),this.#o.div=n,this.#o.properties=r,this.#D(this.#o),r.hasText&&this.#t.append(n),r.hasEOL){let e=document.createElement(`br`);e.setAttribute(`role`,`presentation`),this.#t.append(e)}}#D(t){let{div:n,properties:r,ctx:i}=t,{style:a}=n,{canvasWidth:o,fontSize:s}=r;if(o!==0&&s!==0&&r.hasText){let{fontFamily:t}=a,r=this.#l,c=e.#k(s*this.#p/r)*r;e.#A(i,c,t);let{width:l}=i.measureText(n.textContent);l>0&&a.setProperty(`--scale-x`,o*c/(l*s))}r.angle!==0&&a.setProperty(`--rotate`,`${r.angle}deg`)}static cleanup(){if(!(this.#w.size>0)){this.#b.clear();for(let{canvas:e}of this.#x.values())e.remove();this.#x.clear()}}static#O(e=null){let t=this.#x.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.#x.set(e,t),this.#S.set(t,{size:0,family:``})}return t}static#k(e){e=Math.fround(e);let t=Math.fround(e*131073);return Math.fround(t-Math.fround(t-e))}static#A(e,t,n){let r=this.#S.get(e);(t!==r.size||n!==r.family)&&(e.font=`${t}px ${n}`,r.size=t,r.family=n)}static#j(){if(this.#C!==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.#C=e.getBoundingClientRect().height,e.remove()}static#M(e,t,n){let r=this.#b.get(e);if(r)return r;let i=this.#O(n);this.#A(i,eg,e);let a=i.measureText(``),o=a.fontBoundingBoxAscent,s=Math.abs(a.fontBoundingBoxDescent),c=.8;return o?c=o/(o+s):(J.platform.isFirefox&&U("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.#b.set(e,c),c}},ng=100,rg=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()}},ig=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){W(`Abstract method PDFDataRangeTransport.requestDataRange`)}abort(){}},ag=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 G(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(e){return this._transport.saveDocument(e)}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()}},og=class e{#e=!1;#t=null;static#n=0;constructor(t,n,r,i,a=!1){this._pageIndex=t,this._id=e.#n++,this._pageInfo=n,this._transport=r,this._stats=a?new Hp:null,this._pdfBug=a,this.commonObjs=r.commonObjs,this.objs=new Qh,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#t=i,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 Fp({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 G(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=lp.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(_,Np);v.streamReaderCancelTimeout&&=(clearTimeout(v.streamReaderCancelTimeout),null);let y=!!(g&cp.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.#r(),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 wm(t,v.operatorList.length)),x&&(w=new Tm(T,b));let E=new ug({callback:C,params:{canvas:t,canvasContext:e,dependencyTracker:w??T,imagesTracker:S?new Om(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();else{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=lp.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,Np),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=>e.items.length})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(e=>Ip.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.#r();return e&&t&&(this._stats&&=new Hp),t}#r(){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.#r()}_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,pageProxyId:this._id,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})=>{t?s.streamReader=null: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.#r()}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 Vp){let n=ng;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 Op(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}},sg=class e{#e=Promise.withResolvers();#t=null;#n=null;#r=null;static#i=0;static#a=!1;static#o=new WeakMap;static{rp&&(this.#a=!0,Wh.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=_d()}={}){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 Jm(`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 Jm(`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(`ready`,e=>{a.abort(),this.destroyed||!(e instanceof Uint8Array)?i():(this.#t=r,this.#n=n,this.#r=n,this.#s())})}catch{vd(`The worker has been disabled.`),this.#u()}}#u(){e.#a||=(U(`Setting up fake worker.`),!0),e._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#e.reject(Error(`Worker was destroyed`));return}let n=new Gm;this.#n=n;let r=`fake${e.#i++}`,i=new Jm(r+`_worker`,r,n);t.setup(i,n),this.#t=new Jm(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(Wh.workerSrc)return Wh.workerSrc;throw Error(`No "GlobalWorkerOptions.workerSrc" specified.`)}static get#d(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return G(this,`_setupFakeWorkerGlobal`,(async()=>this.#d?this.#d:(await import(this.workerSrc)).WorkerMessageHandler)())}},cg=class{downloadInfoCapability=Promise.withResolvers();#e=null;#t=new Map;#n=null;#r=new Map;#i=new Map;#a=new Map;#o=null;#s=null;constructor(e,t,n,r,i,a){this.messageHandler=e,this.loadingTask=t,this.#n=n,this.commonObjs=new Qh,this.fontLoader=new Am({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){this.#r.set(e._id,e),this.#i.set(e._pageIndex,Promise.resolve(e))}#c(e,t=null){return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))}#l({loaded:e,total:t}){this.loadingTask.onProgress?.({loaded:e,total:t,percent:t?Ad(Math.round(e/t*100),0,100):NaN})}get annotationStorage(){return G(this,`annotationStorage`,new gm)}getRenderingIntent(e,t=lp.ENABLE,n=null,r=!1,i=!1){let a=cp.DISPLAY,o=hm;switch(e){case`any`:a=cp.ANY;break;case`display`:break;case`print`:a=cp.PRINT;break;default:U(`getRenderingIntent - invalid intent: ${e}`)}let s=a&cp.PRINT&&n instanceof _m?n:this.annotationStorage;switch(t){case lp.DISABLE:a+=cp.ANNOTATIONS_DISABLE;break;case lp.ENABLE:break;case lp.ENABLE_FORMS:a+=cp.ANNOTATIONS_FORMS;break;case lp.ENABLE_STORAGE:a+=cp.ANNOTATIONS_STORAGE,o=s.serializable;break;default:U(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(a+=cp.IS_EDITING),i&&(a+=cp.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(),tg.cleanup(),this.#n?.cancelAllRequests(new Op(`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)=>{yd(this.#n,"GetReader - no `BasePDFStream` instance available."),this.#e=this.#n.getFullReader(),this.#e.onProgress=e=>this.#l(e),t.onPull=()=>{this.#e.read().then(function({value:e,done:n}){n?t.close():(yd(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)=>{yd(this.#n,"GetRangeReader - no `BasePDFStream` instance available.");let n=this.#n.getRangeReader(e.begin,e.end);n?(t.onPull=()=>{n.read().then(function({value:e,done:n}){n?t.close():(yd(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})}):t.close()}),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 ag(e,this))}),e.on(`DocException`,e=>{t._capability.reject(ff(e))}),e.on(`PasswordRequest`,e=>{this.#o=Promise.withResolvers();try{if(!t.onPassword)throw ff(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.#l({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on(`StartRenderPage`,e=>{this.destroyed||this.#r.get(e.pageProxyId)._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;U(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let i=new zm(r.buffer),a=this._params.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,o=new jm(i,a,r.charProcOperatorList,r.extra);this.fontLoader.bind(o).catch(()=>e.sendWithPromise(`FontFallback`,{id:t})).finally(()=>{o.fontExtraProperties||o.clearData(),this.commonObjs.resolve(t,o)});break;case`CopyLocalImage`:let{imageRef:s}=r;yd(s,`The imageRef must be defined.`);for(let e of this.#r.values())for(let[,n]of e.objs){if(n?.ref!==s)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 Vm(r));break;case`Image`:this.commonObjs.resolve(t,r);break;case`Pattern`:let c=new Bm(r);this.commonObjs.resolve(t,c.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();else 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.#l(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(e=null){this.annotationStorage.size<=0&&U("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise(`SaveDocument`,{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,supportsPrintToPDF:this.#s!==null,filename:this.#e?.filename??null},n).finally(()=>{this.#s=null,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 og(t,e,this,this.pagesMapper,this._params.pdfBug);return this.#r.set(r._id,r),r});return this.#i.set(t,i),i}async getPageIndex(e){if(!Hm(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.#c(`GetFieldObjects`)}getSignatures(){return this.#c(`GetSignatures`)}getSignatureData(e){return this.messageHandler.sendWithPromise(`GetSignatureData`,e)}hasJSActions(){return this.#c(`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.#c(`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.#c(`GetOptionalContentConfig`).then(t=>new Jh(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 Gh(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),tg.cleanup()}}cachedPageNumber(e){if(!Hm(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}},lg=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}},ug=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 lg(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(()=>{})}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 Eh(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 Vp(`Rendering cancelled, page ${this._pageIndex+1}`,n),this.callback(t),this.task.onError?.(t)}operatorListChanged(){this.graphicsReady?(this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()):this.graphicsReadyCallback||=this._continueBound}_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())))}},dg=`6.4.299`,fg=`d0991a0d5`,pg=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 G(this,`_keyboardManager`,new nm([[[`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`,Ld,{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:q.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){this.#g?e.target===this.#e?this.#r.firstElementChild?.focus():e.target.nextSibling?.focus():this.#m(e)}_moveToPrevious(e){e.target===this.#r?.firstElementChild||e.target===this.#e?this.#g&&this._hideDropdownFromKeyboard():(this.#g||this.#m(e),e.target.previousSibling?.focus())}_moveToBeginning(e){this.#g?this.#r.firstElementChild?.focus():this.#m(e)}_moveToEnd(e){this.#g?this.#r.lastElementChild?.focus():this.#m(e)}#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(){this.#a||(this.#g?(this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#i})):this.#o?.unselect())}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}},mg=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=J.isAlphaColorInputSupported&&i!==void 0,c=this.#e=document.createElement(`input`);if(c.type=`color`,s){c.setAttribute(`alpha`,``);let e=Y.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=zd(c.value);if(!e)return;let[t,a,o,s]=e,l=Y.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=Y.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=Y.hexNums[Math.round(e*255)];this.#e.value=this.#n.color+t}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}},hg=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=Yf(e),[e,e,e]}static G_HTML([e]){let t=Jf(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(Yf)}static RGB_HTML(e){return`#${e.map(Jf).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[Yf(1-Math.min(1,e+r)),Yf(1-Math.min(1,n+r)),Yf(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)]}},gg=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){W("Abstract method `_createSVG` called.")}},_g=class extends gg{_createSVG(e){return document.createElementNS(sp,e)}},vg=9,yg=new WeakSet,bg=new Date().getTimezoneOffset()*60*1e3,xg=class{static create(e){switch(e.data.annotationType){case hp.LINK:return new wg(e);case hp.TEXT:return new Tg(e);case hp.WIDGET:switch(e.data.fieldType){case`Tx`:return new Dg(e);case`Btn`:return e.data.radioButton?new Ag(e):e.data.checkBox?new kg(e):new jg(e);case`Ch`:return new Mg(e);case`Sig`:return new Og(e)}return new Eg(e);case hp.POPUP:return new Ng(e);case hp.FREETEXT:return new Fg(e);case hp.LINE:return new Ig(e);case hp.SQUARE:return new Lg(e);case hp.CIRCLE:return new Rg(e);case hp.POLYLINE:return new zg(e);case hp.CARET:return new Vg(e);case hp.INK:return new Hg(e);case hp.POLYGON:return new Bg(e);case hp.HIGHLIGHT:return new Ug(e);case hp.UNDERLINE:return new Wg(e);case hp.SQUIGGLY:return new Gg(e);case hp.STRIKEOUT:return new Kg(e);case hp.STAMP:return new qg(e);case hp.FILEATTACHMENT:return new Jg(e);case hp.RICHMEDIA:case hp.SCREEN:case hp.SOUND:return new Yg(e);default:return new Sg(e)}}},Sg=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(`${dp}${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(`${dp}${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 Eg)&&!(this instanceof wg)&&!(this instanceof Yg)&&(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 Ng){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 gp.SOLID:a.borderStyle=`solid`;break;case gp.DASHED:a.borderStyle=`dashed`;break;case gp.BEVELED:U(`Unimplemented border style: beveled`);break;case gp.INSET:U(`Unimplemented border style: inset`);break;case gp.UNDERLINE:a.borderBottomStyle=`solid`}let r=t.borderColor||null;r?(this.#t=!0,a.borderColor=Y.makeHexColor(...r)):a.borderWidth=0}let c=Y.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]=hg[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:hg[`${i}_rgb`](a)})};return G(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="${sp}" 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 Ng({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(){W("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}"]`);o&&!yg.has(o)?U(`_getElementsByName - element not allowed: ${i}`):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&&yg.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`:Y.makeHexColor(...t)}},Cg=class extends Sg{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()}},wg=class extends Sg{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;n||(e.href=this.linkService.getAnchorUrl(``)),this.#e(),this._fieldObjects?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)}let n=new Map;for(let e of this._fieldObjects.values())for(let{id:t,kidIds:r}of e)r&&n.set(t,r);for(let e of t)for(let r of n.get(e)||[])t.add(r);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}"]`);n&&(yg.has(n)?n.dispatchEvent(new Event(`resetform`)):U(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:`app`,ids:s,name:`ResetForm`}}),!1}:(U('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1))}},Tg=class extends Sg{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}},Eg=class extends Sg{render(){return this.container}_getKeyModifier(e){return J.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||vg,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=Y.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)}},Dg=class extends Eg{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(`
98
+ `)||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`)),yg.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-bg).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}},Og=class extends Eg{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}},kg=class extends Eg{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 yg.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}},Ag=class extends Eg{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(yg.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}},jg=class extends wg{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}},Mg=class extends Eg{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`);yg.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}},Ng=class extends Sg{constructor(e){let{data:t,elements:n,parent:r}=e,i=!!r._commentManager;if(super(e,{isRenderable:!i&&Sg._hasPopupData(t)}),this.elements=n,i&&Sg._hasPopupData(t)){let e=this.popup=this.#e();for(let t of n)t.popup=e}else this.popup=null}#e(){return new Pg({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=>`${up}${e}`).join(`,`)),this.container}},Pg=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=Up.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=Y.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)}Zd({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(`
99
+ `))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}){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())):n||t?.deleted?this.remove():(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=Up.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||Y.intersect(e.data.rect,o)!==null){o=e.data.rect,a=!0;break}let s=Y.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(){this.#e?this.#e.toggleCommentPopup(this,!1):(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}},Fg=class extends Sg{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=K.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}},Ig=class extends Sg{#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`)}},Lg=class extends Sg{#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`)}},Rg=class extends Sg{#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`)}},zg=class extends Sg{#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`)}},Bg=class extends zg{constructor(e){super(e),this.containerClassName=`polygonAnnotation`,this.svgElementName=`svg:polygon`}},Vg=class extends Sg{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}},Hg=class extends Sg{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`inkAnnotation`,this.svgElementName=`svg:polyline`,this.annotationEditorType=this.data.it===`InkHighlight`?K.HIGHLIGHT:K.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`)}},Ug=class extends Sg{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=K.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}},Wg=class extends Sg{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}},Gg=class extends Sg{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}},Kg=class extends Sg{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}},qg=class extends Sg{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=K.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}},Jg=class extends Sg{#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}=J.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)}},Yg=class extends Sg{#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=new Blob([i],{type:r});if(!/^(?:video|audio)\//.test(o.type))return;let s=URL.createObjectURL(o);this.#t=s;let c=o.type.startsWith(`audio/`),l=document.createElement(c?`audio`:`video`);if(this.#n=l,l.className=`mediaContent`,this._setBackgroundColor(l),l.src=s,l.title=n,l.controls=!0,l.autoplay=!0,l.tabIndex=0,c){let e=!1,t=!1,n=()=>{l.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})}l.addEventListener(`emptied`,()=>this.#i(s),{once:!0,signal:a}),e.replaceWith(l),l.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()}},Xg=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 gm,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;Wd(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 _g,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===hp.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=xg.create(o);if(!r.isRenderable)continue;t||(this.#o.push(r),e.popupRef&&i.getOrInsertComputed(e.popupRef,jp).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=xg.create(o);if(!n.isRenderable)continue;let r=n.render();n.contentElement.id=`${up}${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=`${up}${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 _g,parent:this};for(let r of t){r.borderStyle||=e._defaultBorderStyle,n.data=r;let t=xg.create(n);t.isRenderable&&(t.render(),t.contentElement.id=`${up}${r.id}`,this.#o.push(t))}await this.#c()}update({viewport:e,optionalContentConfig:t}){let n=this.div;this.viewport=e,Wd(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 Cg({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=`${up}${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 G(this,`_defaultBorderStyle`,Object.freeze({width:1,rawWidth:1,style:gp.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Zg=/\r\n?|\n/g,Qg=class e extends lm{#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=im.TRANSLATE_SMALL,i=im.TRANSLATE_BIG;return G(this,`_keyboardManager`,new nm([[[`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=K.FREETEXT;constructor(t){super({...t,name:`freeTextEditor`}),this.color=t.color||e._defaultColor||lm._defaultLineColor,this.#r=t.fontSize||e._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert(lm._l10nAlert.freetext),this.canAddComment=!1}static initialize(e,t){lm.initialize(e,t);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue(`--freetext-padding`))}static updateDefaultParams(t,n){switch(t){case q.FREETEXT_SIZE:e._defaultFontSize=n;break;case q.FREETEXT_COLOR:e._defaultColor=n}}updateParams(e,t){switch(e){case q.FREETEXT_SIZE:this.#i(t);break;case q.FREETEXT_COLOR:this.#a(t)}}static get defaultPropertiesToUpdate(){return[[q.FREETEXT_SIZE,e._defaultFontSize],[q.FREETEXT_COLOR,e._defaultColor||lm._defaultLineColor]]}get propertiesToUpdate(){return[[q.FREETEXT_SIZE,this.#r],[q.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new mg(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return q.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:q.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:q.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(`
100
+ `)}#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=>{this.#e=e,e?(this.#l(),this._uiManager.rebuild(this),this.#s()):this.remove()};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(Zg,``)}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(Zg,`
101
+ `);if(!i)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let o=a.getRangeAt(0);if(!i.includes(`
102
+ `)){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(Zg,``)),t!==this.editorDiv){let n=l;for(let r of this.editorDiv.childNodes)r===t?n=u:n.push(e.#c(r))}l.push(s.nodeValue.slice(0,c).replaceAll(Zg,``))}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(`
103
+ `)}${i}${u.join(`
104
+ `)}`,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(`
105
+ `)){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 Fg){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:K.FREETEXT,color:Array.from(n),fontSize:e,value:f.join(`
106
+ `),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=Y.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=lm._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(`
107
+ `)){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()}},$g=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(){W(`Not implemented`)}},e_=class e extends lm{#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(lm._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){W(`Not implemented`)}static get typesMap(){W(`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)}else 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),$d(this,r,[`pointerover`,`pointerleave`]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e){W(`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(Qp.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(Qp.setPointer(o,a),window.addEventListener(`pointerup`,e=>{Qp.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:g}),window.addEventListener(`pointercancel`,e=>{Qp.isSamePointerIdOrRemove(e.pointerId)&&this._endDrawingSession()},{signal:g}),window.addEventListener(`pointerdown`,t=>{Qp.isSamePointerType(t.pointerType)&&(Qp.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`,Ld,{signal:g}),s.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:g}),s.addEventListener(`touchmove`,e=>{Qp.isSameTimeStamp(e.timeStamp)&&Rd(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(Qp.isSameTimeStamp(t.timeStamp),!e.#n||!Qp.isSamePointerId(t.pointerId))return;if(Qp.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),Qp.setTimeStamp(t.timeStamp),Rd(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#n=null,e.#i=null,e.#a=null,Qp.clearTimeStamp()),e.#r&&(e.#r.abort(),e.#r=null,Qp.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:q.DRAW_STEP})}else this.endDrawing(!1)}}static endDrawing(t){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(q.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){W(`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}},X=class{static PRECISION=1e-4;focusOutline=null;toSVGPath(){W("Abstract method `toSVGPath` must be implemented.")}get box(){W("Abstract getter `box` must be implemented.")}serialize(e,t){W("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){W("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]}},t_=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 n_(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)isNaN(e[t])?c[t]=c[t+1]=NaN:(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)isNaN(t[e+n])?(c[l]=c[l+1]=NaN,l+=2):(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}},n_=class extends X{#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)isNaN(this.#o[t])?e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`):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=X._rescale(this.#o,e,r,a,-o),c=X._rescale(this.#i,e,r,a,-o);break;case 90:s=X._rescaleAndSwap(this.#o,e,t,a,o),c=X._rescaleAndSwap(this.#i,e,t,a,o);break;case 180:s=X._rescale(this.#o,n,t,-a,o),c=X._rescale(this.#i,n,t,-a,o);break;case 270:s=X._rescaleAndSwap(this.#o,n,r,-a,-o),c=X._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])?(Y.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(ip,0),Y.bezierBoundingBox(n,r,...t.slice(e,e+6),u),Y.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 t_(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()}},r_=class{#e;#t;#n;#r=[];#i=[];constructor(e,t=0,n=0,r=!0){let i=ip.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),Y.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=[];for(;n.size>0;){let e=n.values().next().value,[t,i,a,o,s]=e;n.delete(e);let c=t,l=i,u=[t,a];for(r.push(u);;){let e;if(n.has(o))e=o;else if(n.has(s))e=s;else break;n.delete(e),[t,i,a,o,s]=e,c!==t&&(u.push(c,l,t,l===i?i:a),c=t),l=l===i?a:i}u.push(c,l)}return new i_(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--}}else i[e][2]=n,s>r&&i.push([t,r,s])}}}return i}},i_=class extends X{#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 r_(e,.001).getOutlines();return n.#t=e,n.focusOutline=new r_(e,.0025,.001,t).getOutlines(),n}get isFree(){return!1}get defaultSVGProperties(){return Xf(this)}getFocusSVGProperties(e){return Zf(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}},a_=class extends t_{newFreeDrawOutline(e,t,n,r,i,a){return new s_(e,t,n,r,i,a)}},o_=class{#e;#t;constructor(e,t,n,r,i,a,o){this.#e=new a_(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()}}}},s_=class e extends n_{static#e=1.5;newOutliner(e,t,n,r,i,a,o=0){return new a_(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 Xf(this)}getFocusSVGProperties(e){return Zf(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()}}}},c_=class e extends $g{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}},l_=class e extends e_{#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=K.HIGHLIGHT;static get _keyboardManager(){let t=e.prototype;return G(this,`_keyboardManager`,new nm([[[`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){lm.initialize(t,n),this._defaultDrawingOptions||=new c_({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 G(this,`typesMap`,new Map([[q.HIGHLIGHT_COLOR,`fill`],[q.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:i_.build(n,this._uiManager.direction===`ltr`)}),super._addOutlines(t))}get colorType(){return q.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 q.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,e._DEFAULT_OPACITY,t),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(n)},!0);break;case q.HIGHLIGHT_THICKNESS:super.updateParams(t,n),this._reportTelemetry({action:`thickness_changed`,thickness:n},!0)}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([q.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new pg({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 o_(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`,Rd,{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:Y.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 i_.build(i,o.direction===`ltr`)}let c=a.thickness||this._defaultDrawingOptions.thickness,l=(a.inkLists||a.outlines.points)[0],u=new a_(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 Ug){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:K.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 Hg){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:K.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:lm._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)}},u_=class{#e=new Float64Array(6);#t=new Float64Array(2);#n;#r;#i;#a;#o;#s=``;#c=0;#l=new d_;#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 X._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(...X.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=X.svgRound(this.#t[0]),t=X.svgRound(this.#t[1]);if(this.#o.length===2){let n=X.svgRound(this.#n[4]),r=X.svgRound(this.#n[5]);return`${this.#s} M ${n} ${r} L ${e} ${t}`}return`${this.#s} L ${e} ${t}`}toSVGPath(){let e=X.svgRound(this.#n[4]),t=X.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=X.svgRound(this.#n[10]),t=X.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(X.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]}}},d_=class extends X{#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${X.svgRound(t[4])} ${X.svgRound(t[5])}`),t.length===6)e.push(`Z`);else if(t.length===12&&isNaN(t[6]))e.push(`L${X.svgRound(t[10])} ${X.svgRound(t[11])}`);else for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map(X.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=X._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=X._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=X._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=X._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=X._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=X._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=X._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=X._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(X.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=ap.slice();for(let{line:t}of this.#r){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)Y.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);Y.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,n]=this.#l();e[0]=Ad(e[0]-t,0,1),e[1]=Ad(e[1]-n,0,1),e[2]=Ad(e[2]+t,0,1),e[3]=Ad(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(X.svgRound).join(` `)}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${X.svgRound(e)} ${X.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} ${X.svgRound(o)} ${X.svgRound(s)})`}getPathResizingSVGProperties([e,t,n,r]){let[i,a]=this.#l(),[o,s,c,l]=this.#e;if(Math.abs(c-i)<=X.PRECISION||Math.abs(l-a)<=X.PRECISION){let i=e+n/2-(o+c/2),a=t+r/2-(s+l/2);return{path:{"transform-origin":`${X.svgRound(e)} ${X.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":`${X.svgRound(o)} ${X.svgRound(s)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${X.svgRound(i)} ${X.svgRound(a)}) scale(${u} ${d}) translate(${X.svgRound(-i)} ${X.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)<=X.PRECISION||Math.abs(u-a)<=X.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)X._translate(e,i,a,e),X._translate(t,i,a,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${X.svgRound(e)} ${X.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)X._rescale(e,p,m,d,f,e),X._rescale(t,p,m,d,f,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${X.svgRound(e)} ${X.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)X._translate(e,o,s,e),X._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)X._rescale(n,o,s,e,t,n),X._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":`${X.svgRound(e)} ${X.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${X.svgRound(e[0])} ${X.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},f_=class e extends $g{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:lm._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}},p_=class e extends e_{static _type=`ink`;static _editorType=K.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:`inkEditor`}),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){lm.initialize(e,t),this._defaultDrawingOptions=new f_(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return G(this,`typesMap`,new Map([[q.INK_THICKNESS,`stroke-width`],[q.INK_COLOR,`stroke`],[q.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance({x:e,y:t,box:[,,n,r],rotation:i}){return new u_(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return d_.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof Hg){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:K.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 mg(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return q.INK_COLOR}get colorAndOpacityType(){return q.INK_COLOR_AND_OPACITY}get opacityType(){return q.INK_OPACITY}updateParams(e,t){e===q.INK_COLOR_AND_OPACITY?this._updateColorAndOpacity(t.color,t.opacity):super.updateParams(e,t)}static updateDefaultParams(e,t){e===q.INK_COLOR_AND_OPACITY?(super.updateDefaultParams(q.INK_COLOR,t.color),super.updateDefaultParams(q.INK_OPACITY,t.opacity)):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:Y.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:lm._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}},m_=class extends d_{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}},h_=8,g_=3,__=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(X.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 m_:new d_;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=h_+g_*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=(h_+g_*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[g_*e+h_],n=new Float32Array(t+2);h.push(n);for(let t=0;t<2;t++)n[t]=s[g_*e+h_+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 U(`decompressSignature: ${e}`),null}}},v_=class e extends $g{constructor(){super(),super.updateProperties({fill:lm._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},y_=class e extends f_{constructor(e){super(e),super.updateProperties({stroke:lm._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},b_=class e extends e_{#e=!1;#t=null;#n=null;#r=null;static _type=`signature`;static _editorType=K.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){lm.initialize(e,t),this._defaultDrawingOptions=new v_,this._defaultDrawnSignatureOptions=new y_(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return G(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=__.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:__.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 m_,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 __.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return __.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return __.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?m_.deserialize(e,t,n,r,i,a):d_.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}},x_=class extends lm{#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=K.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){lm.initialize(e,t)}static isHandlingMimeForPasting(e){return Gp.has(e)}static paste(e,t){t.pasteEditor({mode:K.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){e?(this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()):this.remove()}#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)});else{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=Gp.keys().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(){this.parent?(super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))):this.#t&&this.#p()}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(lm._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new Wp,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`?Kp.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 Wp,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*Bp.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*Bp.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 qg){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(`${up}${s}`))?.get(`aria-label`)||``;r=e={annotationType:K.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)}},S_=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([Qg,p_,x_,l_,b_].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()===K.NONE}updateToolbar(e){this.#h.updateToolbar(e)}updateMode(t=this.#h.getMode()){switch(this.#S(),t){case K.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case K.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case K.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===K.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(`^${dp}[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&&(Rd(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.#_)t.disableEditing(),t.annotationElementId?t.serialize()===null?(r.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()):e.set(t.annotationElementId,t):n.push(t);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);i?(i.resetAnnotationElement(n),i.show(!1),n.show()):(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}=J.platform;if(e.button!==0||e.ctrlKey&&t)return;this.#h.showAllEditors(`highlight`,!0,!0),l_.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),lm.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}=J.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();n===K.STAMP||n===K.POPUP||n===K.SIGNATURE?this.#h.unselectAll():this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#h.getMode()===K.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:t}=J.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)}else 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,Wd(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,Wd(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}},C_=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.#_();else 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(Qf)}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=$f(a),u=$f(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=$f(e),f=$f(r),p=ep(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=tp(s,c,u);if(!e)continue;s=e.container,c=e.offset}}if(a.nodeType===Node.ELEMENT_NODE){let e=tp(a,o,l);if(!e)continue;a=e.container,o=e.offset}if(l===u&&!m&&p.includes(l))i.push([n,l]);else 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 G(this,`_svgFactory`,new _g)}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)}},w_=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=Y.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:np(e),top:np(t),width:np(o/this.#i),height:np(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:r_},globalThis.pdfjsLib={AbortException:Op,AnnotationEditorLayer:S_,AnnotationEditorParamsType:q,AnnotationEditorType:K,AnnotationEditorUIManager:im,AnnotationLayer:Xg,AnnotationMode:lp,AnnotationType:hp,applyOpacity:Gd,build:fg,ColorPicker:pg,createValidAbsoluteUrl:xd,CSSConstants:qp,DOMSVGFactory:_g,DrawLayer:C_,FeatureTest:J,fetchData:jd,findContrastColor:Xd,getDocument:qf,getFilenameFromUrl:Pd,getPdfFilenameFromUrl:Fd,getRGB:Bd,getRGBA:zd,getUuid:Od,GlobalWorkerOptions:Wh,ImageKind:mp,InvalidPDFException:Tp,isDataScheme:Md,isPdfFile:Nd,isValidExplicitDest:Wm,makeArr:jp,makeMap:Mp,makeObj:Np,makeSet:Pp,MathClamp:Ad,noContextMenu:Ld,normalizeUnicode:Dd,OPS:vp,OutputScale:Wp,PasswordException:Cp,PasswordResponses:bp,PDFDataRangeTransport:ig,PDFDateString:Up,PDFWorker:sg,PermissionFlag:fp,PixelsPerInch:Bp,RenderingCancelledException:Vp,renderRichText:Zd,ResponseException:Ep,setLayerDimensions:Wd,shadow:G,SignatureExtractor:__,stopEvent:Rd,SupportedImageMimeTypes:Gp,TextLayer:tg,TextLayerImages:w_,TouchManager:cm,updateUrlHash:Sd,Util:Y,VerbosityLevel:_p,version:dg,XfaLayer:zp}})),E_=l({AnnotationLayerBuilder:()=>gb,DownloadManager:()=>vb,EventBus:()=>bb,FindState:()=>$y,GenericL10n:()=>gx,LinkTarget:()=>pb,PDFFindController:()=>db,PDFHistory:()=>bx,PDFLinkService:()=>mb,PDFPageView:()=>Wx,PDFScriptingManager:()=>qx,PDFSinglePageViewer:()=>eS,PDFViewer:()=>$x,ProgressBar:()=>Yy,RenderingStates:()=>$,ScrollMode:()=>Z,SimpleLinkService:()=>hb,SpreadMode:()=>Ky,StructTreeLayerBuilder:()=>Lx,TextLayerBuilder:()=>Bx,XfaLayerBuilder:()=>Vx,parseQueryString:()=>M_});function D_(e,t){Hy||=new Intl.Segmenter(void 0,{granularity:`grapheme`});let n=Hy.segment(e),r=n.containing(t);if(r.index!==t)return!1;Vy||=new Intl.Segmenter(void 0,{granularity:`word`});let i=n.containing(t-1).segment;return Vy.segment(i+r.segment).containing(i.length).index===i.length}function O_(e,t,n){let r=t+n;return(t===0||D_(e,t))&&(r===e.length||D_(e,r))}function k_(){if(!Uy){let e=[],t=[],n=/^\p{M}$/u;for(let r=0;r<65536;r++){if(r>=55296&&r<=57343)continue;let i=String.fromCharCode(r);if(i.normalize(`NFKC`)!==i&&!n.test(i)){if(t.length!==2){t[0]=t[1]=r;continue}t[1]+1===r?t[1]=r:(t[0]===t[1]?e.push(String.fromCharCode(t[0])):e.push(`${String.fromCharCode(t[0])}-${String.fromCharCode(t[1])}`),t[0]=t[1]=r)}}let r=e.join(``);if(!Uy)Uy=r;else if(r!==Uy){for(let e=1;e<r.length;e++)if(r[e]!==Uy[e]){console.log(`Difference at index ${e}: U+${r.charCodeAt(e).toString(16).toUpperCase().padStart(4,`0`)}!== U+${Uy.charCodeAt(e).toString(16).toUpperCase().padStart(4,`0`)}`);break}throw Error("getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.")}}return Uy}function A_(e,t){let n=e.offsetParent;if(!n){console.error(`offsetParent is not set -- cannot scroll`);return}let r=e.offsetTop+e.clientTop,i=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth;)if(r+=n.offsetTop,i+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(t.top!==void 0&&(r+=t.top),t.left!==void 0&&(i+=t.left,n.scrollLeft=i)),n.scrollTop=r}function j_(e,t,n=void 0){function r(){a=null;let n=e.scrollLeft,r=i.lastX;n!==r&&(i.right=n>r),i.lastX=n;let o=e.scrollTop,s=i.lastY;o!==s&&(i.down=o>s),i.lastY=o,t(i)}let i={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop},a=null;return e.addEventListener(`scroll`,()=>{a??=window.requestAnimationFrame(r)},{useCapture:!0,signal:n}),n?.addEventListener(`abort`,()=>window.cancelAnimationFrame(a),{once:!0}),i}function M_(e){let t=new Map;for(let[n,r]of new URLSearchParams(e))t.set(n.toLowerCase(),r);return t}function N_(e,t=!1){return qy.test(e)?t?e.replaceAll(qy,e=>e===`\0`?``:` `):e.replaceAll(`\0`,``):e}function P_(e,t,n=0){let r=n,i=e.length-1;if(i<0||!t(e[i]))return e.length;if(t(e[r]))return r;for(;r<i;){let n=r+i>>1,a=e[n];t(a)?i=n:r=n+1}return r}function F_(e){if(Math.floor(e)===e)return[e,1];let t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];let n=e>1?t:e,r=0,i=1,a=1,o=1;for(;;){let e=r+a,t=i+o;if(t>8)break;n<=e/t?(a=e,o=t):(r=e,i=t)}return n-r/i<a/o-n?n===e?[r,i]:[i,r]:n===e?[a,o]:[o,a]}function I_(e,t){return e-e%t}function L_(e,t,n){if(e<2)return e;let r=t[e].div,i=r.offsetTop+r.clientTop;i>=n&&(r=t[e-1].div,i=r.offsetTop+r.clientTop);for(let n=e-2;n>=0&&(r=t[n].div,!(r.offsetTop+r.clientTop+r.clientHeight<=i));--n)e=n;return e}function R_(e,t){let n=e.percent-t.percent;return Math.abs(n)>.001?-n:e.id-t.id}function z_({scrollEl:e,views:t,sortByVisibility:n=!1,horizontal:r=!1,rtl:i=!1}){let a=e.scrollTop,o=a+e.clientHeight,s=e.scrollLeft,c=s+e.clientWidth;function l(e){let t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>a}function u(e){let t=e.div,n=t.offsetLeft+t.clientLeft,r=n+t.clientWidth;return i?n<c:r>s}let d=[],f=new Set,p=t.length,m=P_(t,r?u:l);m>0&&m<p&&!r&&(m=L_(m,t,a));let h=r?c:-1;for(let e=m;e<p;e++){let n=t[e],i=n.div,l=i.offsetLeft+i.clientLeft,u=i.offsetTop+i.clientTop,p=i.clientWidth,m=i.clientHeight,g=l+p,_=u+m;if(h===-1)_>=o&&(h=_);else if((r?l:u)>h)break;if(_<=a||u>=o||g<=s||l>=c)continue;let v=Math.max(0,a-u),y=Math.max(0,s-l),b=v+Math.max(0,_-o),x=y+Math.max(0,g-c),S=(m-b)/m,C=(p-x)/p,w=S*C*100|0;d.push({id:n.id,x:l,y:u,visibleArea:w===100?null:{minX:y,minY:v,maxX:Math.min(g,c)-l,maxY:Math.min(_,o)-u},view:n,percent:w,widthPercent:C*100|0}),f.add(n.id)}let g=d[0],_=d.at(-1);return n&&d.sort(R_),{first:g,last:_,views:d,ids:f}}function B_(e){return Number.isInteger(e)&&e%90==0}function V_(e){return Number.isInteger(e)&&Object.values(Z).includes(e)&&e!==Z.UNKNOWN}function H_(e){return Number.isInteger(e)&&Object.values(Ky).includes(e)&&e!==Ky.UNKNOWN}function U_(e){return e.width<=e.height}function W_(e){let t=Z.VERTICAL,n=Ky.NONE;switch(e){case`SinglePage`:t=Z.PAGE;break;case`OneColumn`:break;case`TwoPageLeft`:t=Z.PAGE;case`TwoColumnLeft`:n=Ky.ODD;break;case`TwoPageRight`:t=Z.PAGE;case`TwoColumnRight`:n=Ky.EVEN}return{scrollMode:t,spreadMode:n}}function G_(e,t={}){let n=[],r;for(;(r=ab.exec(e))!==null;){let{index:e}=r;for(let t of r[0]){let r=ob.get(t);r||(r=t.normalize(`NFD`).length,ob.set(t,r)),n.push([r,e++])}}let i=n.length>0,a=t.ignoreDashEOL??!1,o;if(!i&&lb)o=lb;else if(i&&ub)o=ub;else{let e=eb.keys().join(``),t=k_(),n=[`[${e}]`,`[${t}]`,`(?:゙|゚)\\n`,`\\p{M}+(?:-\\n)?`,`\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})`,`\\S-\\n`,`(?:\\p{Ideographic}|[぀-ヿ])\\n`,`\\n`,i?sb:`\\u0000`];o=new RegExp(n.map(e=>`(${e})`).join(`|`),`gmu`),i?ub=o:lb=o}let s=[];for(;(r=rb.exec(e))!==null;)s.push([r[0].length,r.index]);let c=e.normalize(`NFD`),l=[0,0],u=0,d=0,f=0,p=0,m=0,h=!1;c=c.replace(o,(e,t,r,i,o,c,g,_,v,y,b)=>{if(b-=p,t){let e=eb.get(t),n=e.length;for(let e=1;e<n;e++)l.push(b-f+e,f-e);return f-=n-1,e}if(r){let e=cb.getOrInsertComputed(r,()=>r.normalize(`NFKC`)),t=e.length;for(let e=1;e<t;e++)l.push(b-f+e,f-e);return f-=t-1,e}if(i)return h=!0,b+m===s[u]?.[1]?++u:(l.push(b-1-f+1,f-1),--f,p+=1),l.push(b-f+1,f),p+=1,m+=1,i.charAt(0);if(o){let e=o.endsWith(`
108
+ `),t=e?o.length-2:o.length;h=!0;let n=t;b+m===s[u]?.[1]&&(n-=s[u][0],++u);for(let e=1;e<=n;e++)l.push(b-1-f+e,f-e);return f-=n,p+=n,e?(b+=t-1,l.push(b-f+1,1+f),f+=1,p+=1,m+=1,o.slice(0,t)):o}if(c){if(a)return p+=1,m+=1,c.slice(0,-1);let e=c.length-2;return l.push(b-f+e,1+f),f+=1,p+=1,m+=1,c.slice(0,-2)}if(g)return p+=1,m+=1,g.slice(0,-1);if(_){let e=_.length-1;return l.push(b-f+e,f),p+=1,m+=1,_.slice(0,-1)}if(v)return l.push(b-f+1,f-1),--f,p+=1,m+=1,` `;if(b+m===n[d]?.[1]){let e=n[d][0]-1;++d;for(let t=1;t<=e;t++)l.push(b-(f-t),f-t);f-=e,p+=e}return y}),l.push(c.length,f);let g=new Uint32Array(l.length>>1),_=new Int32Array(l.length>>1);for(let e=0,t=l.length;e<t;e+=2)g[e>>1]=l[e],_[e>>1]=l[e+1];return[c,[g,_],h]}function K_(e,t,n){if(!e)return[t,n];let[r,i]=e,a=t,o=t+n-1,s=P_(r,e=>e>=a);r[s]>a&&--s;let c=P_(r,e=>e>=o,s);r[c]>o&&--c;let l=a+i[s];return[l,o+i[c]+1-l]}async function q_({target:e,name:t,delay:n=0}){if(typeof e!=`object`||!(t&&typeof t==`string`)||!(Number.isInteger(n)&&n>=0))throw Error(`waitOnEventOrTimeout - invalid parameters.`);let{promise:r,resolve:i}=Promise.withResolvers(),a=new AbortController;function o(e){a.abort(),clearTimeout(l),i(e)}let s=e instanceof bb?`on`:`addEventListener`,c=e instanceof bb?{signal:a.signal,...Qy}:{signal:a.signal};e[s](t,o.bind(null,yb.EVENT),c);let l=setTimeout(o.bind(null,yb.TIMEOUT),n);return r}function J_(e,t,n){return n===t||n instanceof Cb&&t instanceof Cb&&n.value===t.value||t instanceof Cb&&typeof n==`string`&&n===e.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value)}function Y_(e,t,n){return t[n]?iv(e,t[n].value):(e.reportError(RangeError(`No default`)),new Sb)}function X_(e,t){let n=[],r=Object.create(null);for(let i of t)i.type===`narg`?r[i.name]=Z_(e,i.value):n.push(Z_(e,i));return{positional:n,named:r}}function Z_(e,t){switch(t.type){case`str`:return t.value;case`num`:return new Cb(t.value,{minimumFractionDigits:t.precision});case`var`:return Q_(e,t);case`mesg`:return $_(e,t);case`term`:return ev(e,t);case`func`:return tv(e,t);case`select`:return nv(e,t);default:return new Sb}}function Q_(e,{name:t}){let n;if(e.params){if(Object.prototype.hasOwnProperty.call(e.params,t))n=e.params[t];else return new Sb(`$${t}`)}else if(e.args&&Object.prototype.hasOwnProperty.call(e.args,t))n=e.args[t];else return e.reportError(ReferenceError(`Unknown variable: $${t}`)),new Sb(`$${t}`);if(n instanceof xb)return n;switch(typeof n){case`string`:return n;case`number`:return new Cb(n);case`object`:if(wb.supportsValue(n))return new wb(n);default:return e.reportError(TypeError(`Variable type not supported: $${t}, ${typeof n}`)),new Sb(`$${t}`)}}function $_(e,{name:t,attr:n}){let r=e.bundle._messages.get(t);if(!r)return e.reportError(ReferenceError(`Unknown message: ${t}`)),new Sb(t);if(n){let i=r.attributes[n];return i?iv(e,i):(e.reportError(ReferenceError(`Unknown attribute: ${n}`)),new Sb(`${t}.${n}`))}return r.value?iv(e,r.value):(e.reportError(ReferenceError(`No value: ${t}`)),new Sb(t))}function ev(e,{name:t,attr:n,args:r}){let i=`-${t}`,a=e.bundle._terms.get(i);if(!a)return e.reportError(ReferenceError(`Unknown term: ${i}`)),new Sb(i);if(n){let t=a.attributes[n];if(t){e.params=X_(e,r).named;let n=iv(e,t);return e.params=null,n}return e.reportError(ReferenceError(`Unknown attribute: ${n}`)),new Sb(`${i}.${n}`)}e.params=X_(e,r).named;let o=iv(e,a.value);return e.params=null,o}function tv(e,{name:t,args:n}){let r=e.bundle._functions[t];if(!r)return e.reportError(ReferenceError(`Unknown function: ${t}()`)),new Sb(`${t}()`);if(typeof r!=`function`)return e.reportError(TypeError(`Function ${t}() is not callable`)),new Sb(`${t}()`);try{let t=X_(e,n);return r(t.positional,t.named)}catch(n){return e.reportError(n),new Sb(`${t}()`)}}function nv(e,{selector:t,variants:n,star:r}){let i=Z_(e,t);if(i instanceof Sb)return Y_(e,n,r);for(let t of n)if(J_(e,i,Z_(e,t.key)))return iv(e,t.value);return Y_(e,n,r)}function rv(e,t){if(e.dirty.has(t))return e.reportError(RangeError(`Cyclic reference`)),new Sb;e.dirty.add(t);let n=[],r=e.bundle._useIsolating&&t.length>1;for(let i of t)if(typeof i==`string`)n.push(e.bundle._transform(i));else{if(e.placeables++,e.placeables>Tb)throw e.dirty.delete(t),RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is ${Tb}`);r&&n.push(Eb),n.push(Z_(e,i).toString(e)),r&&n.push(Db)}return e.dirty.delete(t),n.join(``)}function iv(e,t){return typeof t==`string`?e.bundle._transform(t):rv(e,t)}function av(e,t){let n=Object.create(null);for(let[r,i]of Object.entries(e))t.includes(r)&&(n[r]=i.valueOf());return n}function ov(e,t){let n=e[0];if(n instanceof Sb)return new Sb(`NUMBER(${n.valueOf()})`);if(n instanceof Cb)return new Cb(n.valueOf(),{...n.opts,...av(t,kb)});if(n instanceof wb)return new Cb(n.toNumber(),{...av(t,kb)});throw TypeError(`Invalid argument to NUMBER`)}function sv(e,t){let n=e[0];if(n instanceof Sb)return new Sb(`DATETIME(${n.valueOf()})`);if(n instanceof wb||n instanceof Cb)return new wb(n,av(t,Ab));throw TypeError(`Invalid argument to DATETIME`)}function cv(e){let t=Array.isArray(e)?e.join(` `):e,n=jb.get(t);return n===void 0&&(n=new Map,jb.set(t,n)),n}function lv(e,t){let{value:n}=t;if(typeof n==`string`){if(e.localName===`title`&&e.namespaceURI===`http://www.w3.org/1999/xhtml`)e.textContent=n;else if(!ax.test(n))e.textContent=n;else{let t=e.ownerDocument.createElementNS(`http://www.w3.org/1999/xhtml`,`template`);t.innerHTML=n,uv(t.content,e)}}fv(t,e)}function uv(e,t){for(let n of e.childNodes)if(n.nodeType!==n.TEXT_NODE){if(n.hasAttribute(`data-l10n-name`)){let r=pv(t,n);e.replaceChild(r,n)}else if(gv(n)){let t=mv(n);e.replaceChild(t,n)}else console.warn(`An element of forbidden type "${n.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),e.replaceChild(hv(n),n)}t.textContent=``,t.appendChild(e)}function dv(e,t){if(!e)return!1;for(let n of e)if(n.name===t)return!0;return!1}function fv(e,t){let n=t.hasAttribute(`data-l10n-attrs`)?t.getAttribute(`data-l10n-attrs`).split(`,`).map(e=>e.trim()):null;for(let r of Array.from(t.attributes))_v(r.name,t,n)&&!dv(e.attributes,r.name)&&t.removeAttribute(r.name);if(e.attributes)for(let r of Array.from(e.attributes))_v(r.name,t,n)&&t.getAttribute(r.name)!==r.value&&t.setAttribute(r.name,r.value)}function pv(e,t){let n=t.getAttribute(`data-l10n-name`),r=e.querySelector(`[data-l10n-name="${n}"]`);return r?r.localName===t.localName?(e.removeChild(r),vv(t,r.cloneNode(!1))):(console.warn(`An element named "${n}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${r.localName}).`),hv(t)):(console.warn(`An element named "${n}" wasn't found in the source.`),hv(t))}function mv(e){return vv(e,e.ownerDocument.createElement(e.localName))}function hv(e){return e.ownerDocument.createTextNode(e.textContent)}function gv(e){let t=ox[e.namespaceURI];return t&&t.includes(e.localName)}function _v(e,t,n=null){if(n&&n.includes(e))return!0;let r=sx[t.namespaceURI];if(!r)return!1;let i=e.toLowerCase(),a=t.localName;if(r.global.includes(i))return!0;if(!r[a])return!1;if(r[a].includes(i))return!0;if(t.namespaceURI===`http://www.w3.org/1999/xhtml`&&a===`input`&&i===`value`){let e=t.type.toLowerCase();if(e===`submit`||e===`button`||e===`reset`)return!0}return!1}function vv(e,t){return t.textContent=e.textContent,fv(e,t),t}function yv(e,t,n,r){return n.value?e.formatPattern(n.value,r,t):null}function bv(e,t,n,r){let i={value:null,attributes:null};n.value&&(i.value=e.formatPattern(n.value,r,t));let a=Object.keys(n.attributes);if(a.length>0){i.attributes=Array(a.length);for(let[o,s]of a.entries()){let a=e.formatPattern(n.attributes[s],r,t);i.attributes[o]={name:s,value:a}}}return i}function xv(e,t,n,r){let i=[],a=new Set;return n.forEach(({id:n,args:o},s)=>{if(r[s]!==void 0)return;let c=t.getMessage(n);if(c){if(i.length=0,r[s]=e(t,i,c,o),i.length>0&&typeof console<`u`){let e=t.locales[0],r=i.join(`, `);console.warn(`[fluent][resolver] errors in ${e}/${n}: ${r}.`)}}else a.add(n)}),a}function Sv(){let{isAndroid:e,isLinux:t,isMac:n,isWindows:r}=Jv.platform;return t?`linux`:r?`windows`:n?`macos`:e?`android`:`other`}function Cv(e,t){let n=new rx(t),r=new Mb(e,{functions:{PLATFORM:Sv}}),i=r.addResource(n);return i.length&&console.error(`L10n errors`,i),r}function wv(){return document.location.hash}function Tv(e,t){return typeof e!=`string`||typeof t!=`string`?!1:e===t||M_(e).get(`nameddest`)===t}function Ev(e,t){function n(e,t){if(typeof e!=typeof t||Array.isArray(e)||Array.isArray(t))return!1;if(typeof e==`object`&&e&&t!==null){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!n(e[r],t[r]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!(Array.isArray(e)&&Array.isArray(t))||e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!n(e[r],t[r]))return!1;return!0}function Dv({width:e,height:t,left:n,top:r},i){if(e===0||t===0)return null;let a=i.textLayer.div.getBoundingClientRect(),o=i.getPagePoint(n-a.left,r-a.top),s=i.getPagePoint(n-a.left+e,r-a.top+t);return Ly.normalizeRect([o[0],o[1],s[0],s[1]])}function Ov(e,t){let n=e.getClientRects();if(n.length===1)return{rect:Dv(n[0],t)};let r=[1/0,1/0,-1/0,-1/0],i=[],a=0;for(let e of n){let n=Dv(e,t);n!==null&&(i[a]=i[a+4]=n[0],i[a+1]=i[a+3]=n[3],i[a+2]=i[a+6]=n[2],i[a+5]=i[a+7]=n[1],Ly.rectBoundingBox(...n,r),a+=8)}return{quadPoints:i,rect:r}}function kv(e,t){let n=e;do{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent.length;if(t<=e)return[n,t];t-=e}else if(n.firstChild){n=n.firstChild;continue}for(;!n.nextSibling&&n!==e;)n=n.parentNode;n!==e&&(n=n.nextSibling)}while(n!==e);throw Error(`Offset is bigger than container's contents length.`)}function Av({url:e,index:t,length:n},r,i){let a=r._textHighlighter,[{begin:o,end:s}]=a._convertMatches([t],[n]),c=new Range;return c.setStart(...kv(a.textDivs[o.divIdx],o.offset)),c.setEnd(...kv(a.textDivs[s.divIdx],s.offset)),{id:`inferred_link_${i}`,unsafeUrl:e,url:e,annotationType:Bv.LINK,rotation:0,...Ov(c,r),borderStyle:null}}async function jv(e){let{info:t,metadata:n,contentDispositionFilename:r,contentLength:i}=await e.getMetadata();return{...t,baseURL:``,filesize:i||(await e.getDownloadInfo()).length,filename:r||$v(``),metadata:n?.getRaw(),authors:n?.get(`dc:creator`),numPages:e.numPages,URL:``}}function Mv(e){return Object.values(Iv).includes(e)&&e!==Iv.DISABLE}var Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry,zy,By,Vy,Hy,Uy,Wy,Gy,Z,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb,ub,db,fb,pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Q,Cx,wx,Tx,Ex,$,Dx,Ox,kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx,$x,eS,tS=s((()=>{({AbortException:Nv,AnnotationEditorLayer:Pv,AnnotationEditorParamsType:Fv,AnnotationEditorType:Iv,AnnotationEditorUIManager:Lv,AnnotationLayer:Rv,AnnotationMode:zv,AnnotationType:Bv,applyOpacity:Vv,build:Hv,ColorPicker:Uv,createValidAbsoluteUrl:Wv,CSSConstants:Gv,DOMSVGFactory:Kv,DrawLayer:qv,FeatureTest:Jv,fetchData:Yv,findContrastColor:Xv,getDocument:Zv,getFilenameFromUrl:Qv,getPdfFilenameFromUrl:$v,getRGB:ey,getRGBA:ty,getUuid:ny,GlobalWorkerOptions:ry,ImageKind:iy,InvalidPDFException:ay,isDataScheme:oy,isPdfFile:sy,isValidExplicitDest:cy,makeArr:ly,makeMap:uy,makeObj:dy,makeSet:fy,MathClamp:py,noContextMenu:my,normalizeUnicode:hy,OPS:gy,OutputScale:_y,PasswordException:vy,PasswordResponses:yy,PDFDataRangeTransport:by,PDFDateString:xy,PDFWorker:Sy,PermissionFlag:Cy,PixelsPerInch:wy,RenderingCancelledException:Ty,renderRichText:Ey,ResponseException:Dy,setLayerDimensions:Oy,shadow:ky,SignatureExtractor:Ay,stopEvent:jy,SupportedImageMimeTypes:My,TextLayer:Ny,TextLayerImages:Py,TouchManager:Fy,updateUrlHash:Iy,Util:Ly,VerbosityLevel:Ry,version:zy,XfaLayer:By}=globalThis.pdfjsLib),Vy=null,Hy=null,Wy={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},Gy={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},Z={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Ky={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},qy=/[\x00-\x1F]/g,new Promise(function(e){window.requestAnimationFrame(e)}),Jy=document.documentElement.style,Yy=class{#e=null;#t=null;#n=0;#r=null;#i=!0;constructor(e){this.#e=e.classList,this.#r=e.style}get percent(){return this.#n}set percent(e){this.#n=e,isNaN(e)?this.#e.add(`indeterminate`):(this.#e.remove(`indeterminate`),this.#r.setProperty(`--progressBar-percent`,`${this.#n}%`))}setWidth(e){if(!e)return;let t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#r.setProperty(`--progressBar-end-offset`,`${t}px`)}setDisableAutoFetch(e=5e3){this.#n===100||isNaN(this.#n)||(this.#t&&clearTimeout(this.#t),this.show(),this.#t=setTimeout(()=>{this.#t=null,this.hide()},e))}hide(){this.#i&&(this.#i=!1,this.#e.add(`hidden`))}show(){this.#i||(this.#i=!0,this.#e.remove(`hidden`))}},Xy=function(){let e=document.createElement(`div`);return e.style.width=`round(down, calc(1.6666666666666665 * 792px), 1px)`,e.style.width===`calc(1320px)`?Math.fround:e=>e}(),Zy=`2837668c-d334-48d1-ba74-aa7deba483da`,Qy=Object.freeze({internal:Zy}),$y={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},eb=new Map([[`‐`,`-`],[`‘`,`'`],[`’`,`'`],[`‚`,`'`],[`‛`,`'`],[`“`,`"`],[`”`,`"`],[`„`,`"`],[`‟`,`"`],[`¼`,`1/4`],[`½`,`1/2`],[`¾`,`3/4`]]),tb=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]),rb=/\p{M}+/gu,ib=/([+^$|])|(\p{P}+)|(\s+)|(\p{M})|(\p{L})/gu,ab=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,ob=new Map,sb=`[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]`,cb=new Map,lb=null,ub=null,db=class{#e=null;#t=!0;#n=0;#r=0;#i=null;#a=null;constructor({linkService:e,eventBus:t,delay:n=250,updateMatchesCountOnProgress:r=!0}){this._linkService=e,this._eventBus=t,this.#t=r,this.#n=n,this.onIsPageVisible=null,this.#s(),t.on(`find`,this.#o.bind(this),Qy),t.on(`findbarclose`,this.#x.bind(this),Qy),t.on(`pagesedited`,this.#b.bind(this),Qy)}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#e}setDocument(e){this._pdfDocument&&this.#s(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#o(e){if(!e)return;let t=this._pdfDocument,{type:n}=e;(this.#e===null||this.#l(e))&&(this._dirtyMatch=!0),this.#e=e,n!==`highlightallchange`&&this.#w($y.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#f();let e=!this._highlightMatches,r=!!this._findTimeout;this._findTimeout&&=(clearTimeout(this._findTimeout),null),n?this._dirtyMatch?this.#h():n===`again`?(this.#h(),e&&this.#e.highlightAll&&this.#m()):n===`highlightallchange`?(r?this.#h():this._highlightMatches=!0,this.#m()):this.#h():this._findTimeout=setTimeout(()=>{this.#h(),this._findTimeout=null},this.#n)})}scrollMatchIntoView({element:e=null,pageIndex:t=-1,matchIndex:n=-1}){this._scrollMatches&&e&&n!==-1&&n===this._selected.matchIdx&&t!==-1&&t===this._selected.pageIdx&&(this._scrollMatches=!1,e.scrollIntoView({block:`start`,inline:`center`}))}#s(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#r=0,this.#e=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this.#i=null,this._firstPageCapability=Promise.withResolvers()}get#c(){let{query:e}=this.#e;return typeof e==`string`?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=G_(e)),this._normalizedQuery):(e||[]).filter(Boolean).map(e=>G_(e)[0])}#l(e){let t=e.query,n=this.#e.query,r=typeof t;if(r!==typeof n)return!0;if(r===`string`){if(t!==n)return!0}else if(JSON.stringify(t)!==JSON.stringify(n))return!0;switch(e.type){case`again`:let e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!(this.onIsPageVisible?.(e)??!0);case`highlightallchange`:return!1}return!0}#u(e,t){let{matchDiacritics:n}=this.#e,r=!1,i=(t,n)=>t===e?n:e.startsWith(t)?`${n}[ ]*`:e.endsWith(t)?`[ ]*${n}`:`[ ]*${n}[ ]*`;return e=e.replaceAll(ib,(e,a,o,s,c,l)=>a?i(a,RegExp.escape(a)):o?i(o,RegExp.escape(o)):s?`[ ]+`:n?c||l:c?tb.has(c.charCodeAt(0))?c:``:t?(r=!0,`${l}\\p{M}*`):l),e.endsWith(`[ ]*`)&&(e=e.slice(0,e.length-4)),n&&t&&(nb||=String.fromCharCode(...tb),r=!0,e=`${e}(?=[${nb}]|[^\\p{M}]|$)`),[r,e]}#d(e){if(!this.#e)return;let t=this.#c;if(t.length===0)return;let n=this._pageContents[e],r=this.match(t,n,e),i=this._pageMatches[e]=[],a=this._pageMatchesLength[e]=[],o=this._pageDiffs[e];r?.forEach(({index:e,length:t})=>{let[n,r]=K_(o,e,t);r&&(i.push(n),a.push(r))}),this.#e.highlightAll&&this.#p(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#_());let s=i.length;this._matchesCountTotal+=s,this.#t?s>0&&this.#C():++this.#r===this._linkService.pagesCount&&this.#C()}match(e,t,n){let r=this._hasDiacritics[n],i=!1;if(typeof e==`string`?[i,e]=this.#u(e,r):e=e.sort().reverse().map(e=>{let[t,n]=this.#u(e,r);return i||=t,`(${n})`}).join(`|`),!e)return;let{caseSensitive:a,entireWord:o}=this.#e;e=new RegExp(e,`g${i?`u`:``}${a?``:`i`}`);let s=[],c;for(;(c=e.exec(t))!==null;)(!o||O_(t,c.index,c[0].length))&&s.push({index:c.index,length:c[0].length});return s}#f(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve(),t={disableNormalization:!0},n=this._pdfDocument;for(let r=0,i=this._linkService.pagesCount;r<i;r++){let{promise:i,resolve:a}=Promise.withResolvers();this._extractTextPromises[r]=i,e=e.then(async()=>{if(n!==this._pdfDocument)a();else{try{let e=await(await n.getPage(r+1)).getTextContent(t);if(n!==this._pdfDocument){a();return}let i=[];for(let t of e.items)i.push(t.str),t.hasEOL&&i.push(`
109
+ `);[this._pageContents[r],this._pageDiffs[r],this._hasDiacritics[r]]=G_(i.join(``))}catch(e){if(n!==this._pdfDocument){a();return}console.error(`Unable to get text content for page ${r+1}`,e),[this._pageContents[r],this._pageDiffs[r],this._hasDiacritics[r]]=[``,null,!1]}a()}})}}#p(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch(`updatetextlayermatches`,{source:this,pageIndex:e})}#m(){this._eventBus.dispatch(`updatetextlayermatches`,{source:this,pageIndex:-1})}#h(){let e=this.#e.findPrevious,t=this._linkService.page-1,n=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#r=0,this._matchesCountTotal=0,this.#m();for(let e=0;e<n;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then(()=>{this._pendingFindMatches.delete(e),this.#d(e)}))}if(this.#c.length===0){this.#w($y.FOUND);return}if(this._resumePageIdx)return;let r=this._offset;if(this._pagesToSearch=n,r.matchIdx!==null){let t=this._pageMatches[r.pageIdx].length;if(!e&&r.matchIdx+1<t||e&&r.matchIdx>0){r.matchIdx=e?r.matchIdx-1:r.matchIdx+1,this.#y(!0);return}this.#v(e)}this.#_()}#g(e){let t=this._offset,n=e.length,r=this.#e.findPrevious;return n?(t.matchIdx=r?n-1:0,this.#y(!0),!0):(this.#v(r),t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0)?(this.#y(!1),!0):!1)}#_(){this._resumePageIdx!==null&&console.error(`There can only be one pending page.`);let e=null;do{let t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#g(e))}#v(e){let t=this._offset,n=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=n||t.pageIdx<0)&&(t.pageIdx=e?n-1:0,t.wrapped=!0)}#y(e=!1){let t=$y.NOT_FOUND,n=this._offset.wrapped;if(this._offset.wrapped=!1,e){let e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=n?$y.WRAPPED:$y.FOUND,e!==-1&&e!==this._selected.pageIdx&&this.#p(e)}this.#w(t,this.#e.findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,this.#p(this._selected.pageIdx))}#b({pagesMapper:e,type:t,pageNumbers:n}){if(this._extractTextPromises.length===0)return;if(t===`copy`){let e=new Map,t=new Map,r=new Map,i=new Map;for(let a of n)e.set(a,this._extractTextPromises[a-1]),t.set(a,this._pageContents[a-1]),r.set(a,this._pageDiffs[a-1]),i.set(a,this._hasDiacritics[a-1]);this.#i={promises:e,contents:t,diffs:r,diacritics:i};return}if(t===`cancelCopy`){this.#i=null;return}if(t===`delete`&&(this.#a={promises:this._extractTextPromises,contents:this._pageContents,diffs:this._pageDiffs,diacritics:this._hasDiacritics}),t===`cancelDelete`){this._extractTextPromises=this.#a.promises,this._pageContents=this.#a.contents,this._pageDiffs=this.#a.diffs,this._hasDiacritics=this.#a.diacritics;return}if(t===`cleanSavedData`){this.#a=null;return}this._findTimeout&&=(clearTimeout(this._findTimeout),null),this._resumePageIdx=null,this._dirtyMatch=!0;let r=this._extractTextPromises,i=this._pageContents,a=this._pageDiffs,o=this._hasDiacritics,s=this._extractTextPromises=[],c=this._pageContents=[],l=this._pageDiffs=[],u=this._hasDiacritics=[];for(let t=1,n=e.pagesNumber;t<=n;t++){let n=e.getPrevPageNumber(t);if(n<0){let e=-n;s.push(this.#i?.promises.get(e)||Promise.resolve()),c.push(this.#i?.contents.get(e)??``),l.push(this.#i?.diffs.get(e)??null),u.push(this.#i?.diacritics.get(e)??!1)}else s.push(r[n-1]||Promise.resolve()),c.push(i[n-1]??``),l.push(a[n-1]??null),u.push(o[n-1]??!1)}this.#e&&this.#h()}#x(e){let t=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&=(clearTimeout(this._findTimeout),null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#w($y.FOUND),this._highlightMatches=!1,this.#m())})}#S(){let{pageIdx:e,matchIdx:t}=this._selected,n=0,r=this._matchesCountTotal;if(t!==-1){for(let t=0;t<e;t++)n+=this._pageMatches[t]?.length||0;n+=t+1}return(n<1||n>r)&&(n=r=0),{current:n,total:r}}#C(){this._eventBus.dispatch(`updatefindmatchescount`,{source:this,matchesCount:this.#S()})}#w(e,t=!1){(this.#t||this.#r===this._linkService.pagesCount&&e!==$y.PENDING)&&this._eventBus.dispatch(`updatefindcontrolstate`,{source:this,state:e,previous:t,entireWord:this.#e?.entireWord??null,matchesCount:this.#S(),rawQuery:this.#e?.query??null})}},fb=`noopener noreferrer nofollow`,pb={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4},mb=class{externalLinkEnabled=!0;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:n=null,ignoreDestinationZoom:r=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=n,this._ignoreDestinationZoom=r,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?.pagesMapper.pagesNumber||0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(e){this.pdfDocument&&(this.pdfViewer.currentPageNumber=e)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(e){this.pdfDocument&&(this.pdfViewer.pagesRotation=e)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(e){if(!this.pdfDocument)return;let t,n,r;if(typeof e==`string`?(t=e,n=await this.pdfDocument.getDestination(e)):(t=null,n=await e),!Array.isArray(n)){console.error(`goToDestination: "${n}" is not a valid destination array, for dest="${e}".`);return}let[i]=n;if(i&&typeof i==`object`){if(r=this.pdfDocument.cachedPageNumber(i),!r)try{r=await this.pdfDocument.getPageIndex(i)+1}catch{console.error(`goToDestination: "${i}" is not a valid page reference, for dest="${e}".`);return}}else Number.isInteger(i)&&(r=i+1);if(!r||r<1||r>this.pagesCount){console.error(`goToDestination: "${r}" is not a valid page number, for dest="${e}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:n,pageNumber:r})),this.pdfViewer.scrollPageIntoView({pageNumber:r,destArray:n,ignoreDestinationZoom:this._ignoreDestinationZoom});let a=new AbortController;this.eventBus.on(`textlayerrendered`,e=>{e.pageNumber===r&&(e.source.textLayer.div.focus(),a.abort())},{signal:a.signal,...Qy})}goToPage(e){if(!this.pdfDocument)return;let t=typeof e==`string`&&this.pdfViewer.pageLabelToPageNumber(e)||e|0;Number.isInteger(t)&&t>0&&t<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})):console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}goToXY(e,t,n,r={}){this.pdfViewer.scrollPageIntoView({pageNumber:e,destArray:[null,{name:`XYZ`},t,n],ignoreDestinationZoom:!0,...r})}async getAttachmentContent(e){try{return await this.pdfDocument?.getAttachmentContent(e)}catch(e){e instanceof vy||console.warn(`Unable to load attachment content: ${e}`)}return null}addLinkAttributes(e,t,n=!1){if(!t||typeof t!=`string`)throw Error(`A valid "url" parameter must provided.`);let r=n?pb.BLANK:this.externalLinkTarget,i=this.externalLinkRel,a=t,o=URL.parse(t);(o?.username||o?.password)&&(o.username=o.password=``,a=o.href),this.externalLinkEnabled?(e.href=t,e.title=a):(e.href=``,e.title=`Disabled: ${a}`,e.onclick=()=>!1);let s=``;switch(r){case pb.NONE:break;case pb.SELF:s=`_self`;break;case pb.BLANK:s=`_blank`;break;case pb.PARENT:s=`_parent`;break;case pb.TOP:s=`_top`}e.target=s,e.rel=typeof i==`string`?i:fb}getDestinationHash(e){if(typeof e==`string`){if(e.length>0)return this.getAnchorUrl(`#`+escape(e))}else if(Array.isArray(e)){let t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl(`#`+escape(t))}return this.getAnchorUrl(``)}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,n;if(e.includes(`=`)){let r=M_(e);if(r.has(`search`)){let e=r.get(`search`).replaceAll(`"`,``),t=r.get(`phrase`)===`true`;this.eventBus.dispatch(`findfromurlhash`,{source:this,query:t?e:e.match(/\S+/g)})}if(r.has(`page`)&&(t=r.get(`page`)|0||1),r.has(`zoom`)){let e=r.get(`zoom`).split(`,`),t=e[0],i=parseFloat(t);t.includes(`Fit`)?t===`Fit`||t===`FitB`?n=[null,{name:t}]:t===`FitH`||t===`FitBH`||t===`FitV`||t===`FitBV`?n=[null,{name:t},e.length>1?e[1]|0:null]:t===`FitR`?e.length===5?n=[null,{name:t},e[1]|0,e[2]|0,e[3]|0,e[4]|0]:console.error(`PDFLinkService.setHash: Not enough parameters for "FitR".`):console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):n=[null,{name:`XYZ`},e.length>1?e[1]|0:null,e.length>2?e[2]|0:null,i?i/100:t]}n?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:n,allowNegativeOffset:!0}):t&&(this.page=t),r.has(`pagemode`)&&this.eventBus.dispatch(`pagemode`,{source:this,mode:r.get(`pagemode`)}),r.has(`nameddest`)&&this.goToDestination(r.get(`nameddest`))}else{n=unescape(e);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch{}typeof n==`string`||cy(n)?this.goToDestination(n):console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){if(this.pdfDocument){switch(e){case`GoBack`:this.pdfHistory?.back();break;case`GoForward`:this.pdfHistory?.forward();break;case`NextPage`:this.pdfViewer.nextPage();break;case`PrevPage`:this.pdfViewer.previousPage();break;case`LastPage`:this.page=this.pagesCount;break;case`FirstPage`:this.page=1}this.eventBus.dispatch(`namedaction`,{source:this,action:e})}}async executeSetOCGState(e){if(!this.pdfDocument)return;let t=this.pdfDocument,n=await this.pdfViewer.optionalContentConfigPromise;t===this.pdfDocument&&(n.setOCGState(e),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(n))}},hb=class extends mb{setDocument(e,t=null){}},gb=class{#e=null;#t=null;#n=null;#r=null;#i=!1;constructor({pdfPage:e,linkService:t,downloadManager:n,annotationStorage:r=null,imageResourcesPath:i=``,renderForms:a=!0,enableComment:o=!1,commentManager:s=null,enableScripting:c=!1,hasJSActionsPromise:l=null,fieldObjectsPromise:u=null,annotationCanvasMap:d=null,accessibilityManager:f=null,annotationEditorUIManager:p=null,onAppend:m=null}){this.pdfPage=e,this.linkService=t,this.downloadManager=n,this.imageResourcesPath=i,this.renderForms=a,this.annotationStorage=r,this.enableComment=o,this.#t=s,this.enableScripting=c,this._hasJSActionsPromise=l||Promise.resolve(!1),this._fieldObjectsPromise=u||Promise.resolve(null),this._annotationCanvasMap=d,this._accessibilityManager=f,this._annotationEditorUIManager=p,this.#n=m,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=t.eventBus}async render({viewport:e,intent:t=`display`,structTreeLayer:n=null,optionalContentConfigPromise:r=null}){if(this.div){let t=await r;if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:e.clone({dontFlip:!0}),optionalContentConfig:t});return}let[i,a,o,s]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise,r]);if(this._cancelled)return;let c=this.div=document.createElement(`div`);c.className=`annotationLayer`,this.#n?.(c),this.#a(e,n),i.length===0?(this.#e=i,Oy(this.div,e)):(await this.annotationLayer.render({annotations:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:a,fieldObjects:o,optionalContentConfig:s}),this.#e=i,this.linkService.isInPresentationMode&&this.#o(Wy.FULLSCREEN),this.#r||(this.#r=new AbortController,this._eventBus?.on(`presentationmodechanged`,e=>{this.#o(e.state)},{signal:this.#r.signal,...Qy})))}#a(e,t){this.annotationLayer=new Rv({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:e.clone({dontFlip:!0}),structTreeLayer:t,commentManager:this.#t,linkService:this.linkService})}cancel(){this._cancelled=!0,this.#r?.abort(),this.#r=null,this.annotationLayer?.destroy()}refreshCanvases(){this.annotationLayer?.refreshCanvases()}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}async injectLinkAnnotations(e){if(this.#e===null)throw Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||this.#i)return;this.#i=!0;let t=this.#e.length?this.#s(e):e;t.length&&await this.annotationLayer.addLinkAnnotations(t)}#o(e){if(!this.div)return;let t=!1;switch(e){case Wy.FULLSCREEN:t=!0;break;case Wy.NORMAL:break;default:return}for(let e of this.div.childNodes)e.hasAttribute(`data-internal-link`)||e.classList.contains(`mediaAnnotation`)||(e.inert=t)}#s(e){function t(e){if(!e.quadPoints)return[e.rect];let t=[];for(let n=2,r=e.quadPoints.length;n<r;n+=8){let r=e.quadPoints[n],i=e.quadPoints[n+1],a=e.quadPoints[n+2],o=e.quadPoints[n+3];t.push([a,o,r,i])}return t}function n(e,n){let r=[],i=t(e),a=t(n);for(let e of i)for(let t of a){let n=Ly.intersect(e,t);n&&r.push(n)}return r}function r(e){let t=0;for(let n of e)t+=Math.abs((n[2]-n[0])*(n[3]-n[1]));return t}return e.filter(e=>{let i;for(let a of this.#e){if(a.annotationType!==Bv.LINK)continue;let o=n(a,e);if(o.length!==0&&(i??=r(t(e)),r(o)/i>.5))return!1}return!0})}},_b=class{#e=new WeakMap;_triggerDownload(e,t,n,r=!1){throw Error(`Not implemented: _triggerDownload`)}_getOpenDataUrl(e,t,n=null){throw Error(`Not implemented: _getOpenDataUrl`)}downloadData(e,t,n){let r=URL.createObjectURL(new Blob([e],{type:n}));this._triggerDownload(r,r,t,!0)}openOrDownloadData(e,t,n=null){let r=sy(t),i=r?`application/pdf`:``;if(r){let r=this.#e.getOrInsertComputed(e,()=>URL.createObjectURL(new Blob([e],{type:i})));try{let e=this._getOpenDataUrl(r,t,n);return window.open(e),!0}catch(t){console.error(`openOrDownloadData:`,t),URL.revokeObjectURL(r),this.#e.delete(e)}}return this.downloadData(e,t,i),!1}download(e,t,n){let r=e?URL.createObjectURL(new Blob([e],{type:`application/pdf`})):null;this._triggerDownload(r,t,n)}},vb=class extends _b{_triggerDownload(e,t,n,r=!1){if(!e&&!r){if(!Wv(t,`http://example.com`))throw Error(`_triggerDownload - not a valid URL: ${t}`);e=t+`#pdfjs.action=download`}let i=document.createElement(`a`);i.href=e,i.target=`_parent`,`download`in i&&(i.download=n),(document.body||document.documentElement).append(i),i.click(),i.remove()}_getOpenDataUrl(e,t,n=null){throw Error("Opening data is not supported in `COMPONENTS` builds.")}},yb={EVENT:`event`,TIMEOUT:`timeout`},bb=class{#e=new Map;constructor(){Object.seal(this)}on(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){let{signal:i}=n;if(i.aborted){console.error("Cannot use an `aborted` signal.");return}let a=()=>this.off(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}this.#e.getOrInsertComputed(e,fy).add({listener:t,internal:n?.internal===Zy,once:n?.once===!0,rmAbort:r})}off(e,t,n=null){let r=this.#e.get(e),i=r?.keys().find(e=>e.listener===t);i&&(i.rmAbort?.(),r.delete(i))}dispatch(e,t){let n=this.#e.get(e);if(!n?.size)return;let r;for(let{listener:i,internal:a,once:o}of new Set(n))o&&this.off(e,i),a?i(t):(r??=[]).push(i);if(r)for(let e of r)e(t)}},xb=class{constructor(e){this.value=e}valueOf(){return this.value}},Sb=class extends xb{constructor(e=`???`){super(e)}toString(e){return`{${this.value}}`}},Cb=class extends xb{constructor(e,t={}){super(e),this.opts=t}toString(e){if(e)try{return e.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return this.value.toString(10)}},wb=class e extends xb{static supportsValue(t){if(typeof t==`number`||t instanceof Date)return!0;if(t instanceof xb)return e.supportsValue(t.valueOf());if(`Temporal`in globalThis){let e=globalThis.Temporal;if(t instanceof e.Instant||t instanceof e.PlainDateTime||t instanceof e.PlainDate||t instanceof e.PlainMonthDay||t instanceof e.PlainTime||t instanceof e.PlainYearMonth)return!0}return!1}constructor(t,n={}){t instanceof e?(n={...t.opts,...n},t=t.value):t instanceof xb&&(t=t.valueOf()),typeof t==`object`&&`calendarId`in t&&n.calendar===void 0&&(n={...n,calendar:t.calendarId}),super(t),this.opts=n}[Symbol.toPrimitive](e){return e===`string`?this.toString():this.toNumber()}toNumber(){let e=this.value;if(typeof e==`number`)return e;if(e instanceof Date)return e.getTime();if(`epochMilliseconds`in e)return e.epochMilliseconds;if(`toZonedDateTime`in e)return e.toZonedDateTime(`UTC`).epochMilliseconds;throw TypeError(`Unwrapping a non-number value as a number`)}toString(e){if(e)try{return e.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return typeof this.value==`number`||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}},Tb=100,Eb=`⁨`,Db=`⁩`,Ob=class{constructor(e,t,n){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=e,this.errors=t,this.args=n}reportError(e){if(!this.errors||!(e instanceof Error))throw e;this.errors.push(e)}memoizeIntlObject(e,t){let n=this.bundle._intls.get(e);n||(n={},this.bundle._intls.set(e,n));let r=JSON.stringify(t);return n[r]||(n[r]=new e(this.bundle.locales,t)),n[r]}},kb=[`unitDisplay`,`currencyDisplay`,`useGrouping`,`minimumIntegerDigits`,`minimumFractionDigits`,`maximumFractionDigits`,`minimumSignificantDigits`,`maximumSignificantDigits`],Ab=[`dateStyle`,`timeStyle`,`fractionalSecondDigits`,`dayPeriod`,`hour12`,`weekday`,`era`,`year`,`month`,`day`,`hour`,`minute`,`second`,`timeZoneName`],jb=new Map,Mb=class{constructor(e,{functions:t,useIsolating:n=!0,transform:r=e=>e}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(e)?e:[e],this._functions={NUMBER:ov,DATETIME:sv,...t},this._useIsolating=n,this._transform=r,this._intls=cv(e)}hasMessage(e){return this._messages.has(e)}getMessage(e){return this._messages.get(e)}addResource(e,{allowOverrides:t=!1}={}){let n=[];for(let r=0;r<e.body.length;r++){let i=e.body[r];if(i.id.startsWith(`-`)){if(t===!1&&this._terms.has(i.id)){n.push(Error(`Attempt to override an existing term: "${i.id}"`));continue}this._terms.set(i.id,i)}else{if(t===!1&&this._messages.has(i.id)){n.push(Error(`Attempt to override an existing message: "${i.id}"`));continue}this._messages.set(i.id,i)}}return n}formatPattern(e,t=null,n=null){if(typeof e==`string`)return this._transform(e);let r=new Ob(this,n,t);try{return rv(r,e).toString(r)}catch(e){if(r.errors&&e instanceof Error)return r.errors.push(e),new Sb().toString(r);throw e}}},Nb=/^(-?[a-zA-Z][\w-]*) *= */gm,Pb=/\.([a-zA-Z][\w-]*) *= */y,Fb=/\*?\[/y,Ib=/(-?[0-9]+(?:\.([0-9]+))?)/y,Lb=/([a-zA-Z][\w-]*)/y,Rb=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,zb=/^[A-Z][A-Z0-9_-]*$/,Bb=/([^{}\n\r]+)/y,Vb=/([^\\"\n\r]*)/y,Hb=/\\([\\"])/y,Ub=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,Wb=/^\n+/,Gb=/ +$/,Kb=/ *\r?\n/g,qb=/( *)$/,Jb=/{\s*/y,Yb=/\s*}/y,Xb=/\[\s*/y,Zb=/\s*] */y,Qb=/\s*\(\s*/y,$b=/\s*->\s*/y,ex=/\s*:\s*/y,tx=/\s*,?\s*/y,nx=/\s+/y,rx=class{constructor(e){this.body=[],Nb.lastIndex=0;let t=0;for(;;){let n=Nb.exec(e);if(n===null)break;t=Nb.lastIndex;try{this.body.push(s(n[1]))}catch(e){if(e instanceof SyntaxError)continue;throw e}}function n(n){return n.lastIndex=t,n.test(e)}function r(n,r){if(e[t]===n)return t++,!0;if(r)throw new r(`Expected ${n}`);return!1}function i(e,r){if(n(e))return t=e.lastIndex,!0;if(r)throw new r(`Expected ${e.toString()}`);return!1}function a(n){n.lastIndex=t;let r=n.exec(e);if(r===null)throw SyntaxError(`Expected ${n.toString()}`);return t=n.lastIndex,r}function o(e){return a(e)[1]}function s(e){let t=l(),n=c();if(t===null&&Object.keys(n).length===0)throw SyntaxError(`Expected message value or attributes`);return{id:e,value:t,attributes:n}}function c(){let e=Object.create(null);for(;n(Pb);){let t=o(Pb),n=l();if(n===null)throw SyntaxError(`Expected attribute value`);e[t]=n}return e}function l(){let r;if(n(Bb)&&(r=o(Bb)),e[t]===`{`||e[t]===`}`)return u(r?[r]:[],1/0);let i=x();return i?r?u([r,i],i.length):(i.value=S(i.value,Wb),u([i],i.length)):r?S(r,Gb):null}function u(r=[],i){for(;;){if(n(Bb)){r.push(o(Bb));continue}if(e[t]===`{`){r.push(d());continue}if(e[t]===`}`)throw SyntaxError(`Unbalanced closing brace`);let a=x();if(a)r.push(a),i=Math.min(i,a.length);else break}let a=r.length-1,s=r[a];typeof s==`string`&&(r[a]=S(s,Gb));let c=[];for(let e of r)e instanceof ix&&(e=e.value.slice(0,e.value.length-i)),e&&c.push(e);return c}function d(){i(Jb,SyntaxError);let e=f();if(i(Yb))return e;if(i($b)){let t=h();return i(Yb,SyntaxError),{type:`select`,selector:e,...t}}throw SyntaxError(`Unclosed placeable`)}function f(){if(e[t]===`{`)return d();if(n(Rb)){let[,e,t,n=null]=a(Rb);if(e===`$`)return{type:`var`,name:t};if(i(Qb)){let r=p();if(e===`-`)return{type:`term`,name:t,attr:n,args:r};if(zb.test(t))return{type:`func`,name:t,args:r};throw SyntaxError(`Function names must be all upper-case`)}return e===`-`?{type:`term`,name:t,attr:n,args:[]}:{type:`mesg`,name:t,attr:n}}return _()}function p(){let n=[];for(;;){switch(e[t]){case`)`:return t++,n;case void 0:throw SyntaxError(`Unclosed argument list`)}n.push(m()),i(tx)}}function m(){let e=f();return e.type===`mesg`&&i(ex)?{type:`narg`,name:e.name,value:_()}:e}function h(){let e=[],t=0,i;for(;n(Fb);){r(`*`)&&(i=t);let n=g(),a=l();if(a===null)throw SyntaxError(`Expected variant value`);e[t++]={key:n,value:a}}if(t===0)return null;if(i===void 0)throw SyntaxError(`Expected default variant`);return{variants:e,star:i}}function g(){i(Xb,SyntaxError);let e;return e=n(Ib)?v():{type:`str`,value:o(Lb)},i(Zb,SyntaxError),e}function _(){if(n(Ib))return v();if(e[t]===`"`)return y();throw SyntaxError(`Invalid expression`)}function v(){let[,e,t=``]=a(Ib),n=t.length;return{type:`num`,value:parseFloat(e),precision:n}}function y(){r(`"`,SyntaxError);let n=``;for(;;)if(n+=o(Vb),e[t]===`\\`)n+=b();else{if(r(`"`))return{type:`str`,value:n};throw SyntaxError(`Unclosed string literal`)}}function b(){if(n(Hb))return o(Hb);if(n(Ub)){let[,e,t]=a(Ub),n=parseInt(e||t,16);return n<=55295||57344<=n?String.fromCodePoint(n):`�`}throw SyntaxError(`Unknown escape sequence`)}function x(){let n=t;switch(i(nx),e[t]){case`.`:case`[`:case`*`:case`}`:case void 0:return!1;case`{`:return C(e.slice(n,t))}return e[t-1]===` `&&C(e.slice(n,t))}function S(e,t){return e.replace(t,``)}function C(e){let t=e.replace(Kb,`
110
+ `),n=qb.exec(e)[1].length;return new ix(t,n)}}},ix=class{constructor(e,t){this.value=e,this.length=t}},ax=/<|&#?\w+;/,ox={"http://www.w3.org/1999/xhtml":[`em`,`strong`,`small`,`s`,`cite`,`q`,`dfn`,`abbr`,`data`,`time`,`code`,`var`,`samp`,`kbd`,`sub`,`sup`,`i`,`b`,`u`,`mark`,`bdi`,`bdo`,`span`,`br`,`wbr`]},sx={"http://www.w3.org/1999/xhtml":{global:[`title`,`aria-description`,`aria-label`,`aria-valuetext`],a:[`download`],area:[`download`,`alt`],input:[`alt`,`placeholder`],menuitem:[`label`],menu:[`label`],optgroup:[`label`],option:[`label`],track:[`label`],img:[`alt`],textarea:[`placeholder`],th:[`abbr`]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:[`accesskey`,`aria-label`,`aria-valuetext`,`label`,`title`,`tooltiptext`],description:[`value`],key:[`key`,`keycode`],label:[`value`],textbox:[`placeholder`,`value`]}},cx=class extends Array{static from(e){return e instanceof this?e:new this(e)}},lx=class extends cx{constructor(e){if(super(),Symbol.asyncIterator in Object(e))this.iterator=e[Symbol.asyncIterator]();else if(Symbol.iterator in Object(e))this.iterator=e[Symbol.iterator]();else throw TypeError(`Argument must implement the iteration protocol.`)}[Symbol.asyncIterator](){let e=this,t=0;return{async next(){return e.length<=t&&e.push(e.iterator.next()),e[t++]}}}async touchNext(e=1){let t=0;for(;t++<e;){let e=this[this.length-1];if(e&&(await e).done)break;this.push(this.iterator.next())}return this[this.length-1]}},ux=class{constructor(e=[],t){this.resourceIds=e,this.generateBundles=t,this.onChange(!0)}addResourceIds(e,t=!1){return this.resourceIds.push(...e),this.onChange(t),this.resourceIds.length}removeResourceIds(e){return this.resourceIds=this.resourceIds.filter(t=>!e.includes(t)),this.onChange(),this.resourceIds.length}async formatWithFallback(e,t){let n=[],r=!1;for await(let i of this.bundles){r=!0;let a=xv(t,i,e,n);if(a.size===0)break;if(typeof console<`u`){let e=i.locales[0],t=Array.from(a).join(`, `);console.warn(`[fluent] Missing translations in ${e}: ${t}`)}}return!r&&typeof console<`u`&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated.
111
+ keys: ${JSON.stringify(e)}.
112
+ resourceIds: ${JSON.stringify(this.resourceIds)}.`),n}formatMessages(e){return this.formatWithFallback(e,bv)}formatValues(e){return this.formatWithFallback(e,yv)}async formatValue(e,t){let[n]=await this.formatValues([{id:e,args:t}]);return n}handleEvent(){this.onChange()}onChange(e=!1){this.bundles=lx.from(this.generateBundles(this.resourceIds)),e&&this.bundles.touchNext(2)}},dx=`data-l10n-id`,fx=`data-l10n-args`,px=`[${dx}]`,mx=class extends ux{constructor(e,t){super(e,t),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[dx,fx]}}onChange(e=!1){super.onChange(e),this.roots&&this.translateRoots()}setAttributes(e,t,n){return e.setAttribute(dx,t),n?e.setAttribute(fx,JSON.stringify(n)):e.removeAttribute(fx),e}getAttributes(e){return{id:e.getAttribute(dx),args:JSON.parse(e.getAttribute(fx)||null)}}connectRoot(e){for(let t of this.roots)if(t===e||t.contains(e)||e.contains(t))throw Error(`Cannot add a root that overlaps with existing root.`);if(this.windowElement){if(this.windowElement!==e.ownerDocument.defaultView)throw Error(`Cannot connect a root:
113
+ DOMLocalization already has a root from a different window.`)}else this.windowElement=e.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e));this.roots.add(e),this.mutationObserver.observe(e,this.observerConfig)}disconnectRoot(e){return this.roots.delete(e),this.pauseObserving(),this.roots.size===0?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){let e=Array.from(this.roots);return Promise.all(e.map(e=>this.translateFragment(e)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(let e of this.roots)this.mutationObserver.observe(e,this.observerConfig)}translateMutations(e){for(let t of e)switch(t.type){case`attributes`:t.target.hasAttribute(`data-l10n-id`)&&this.pendingElements.add(t.target);break;case`childList`:for(let e of t.addedNodes)if(e.nodeType===e.ELEMENT_NODE){if(e.childElementCount)for(let t of this.getTranslatables(e))this.pendingElements.add(t);else e.hasAttribute(dx)&&this.pendingElements.add(e)}}this.pendingElements.size>0&&this.pendingrAF===null&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(e){return this.translateElements(this.getTranslatables(e))}async translateElements(e){if(!e.length)return;let t=e.map(this.getKeysForElement),n=await this.formatMessages(t);return this.applyTranslations(e,n)}applyTranslations(e,t){this.pauseObserving();for(let n=0;n<e.length;n++)t[n]!==void 0&&lv(e[n],t[n]);this.resumeObserving()}getTranslatables(e){let t=Array.from(e.querySelectorAll(px));return typeof e.hasAttribute==`function`&&e.hasAttribute(dx)&&t.push(e),t}getKeysForElement(e){return{id:e.getAttribute(dx),args:JSON.parse(e.getAttribute(fx)||null)}}},hx=class e{#e;#t;#n;#r;constructor({lang:t,isRTL:n},r=null){this.#n=e.#i(t),this.#r=r,this.#e=n??e.#a(this.#n)?`rtl`:`ltr`}_setL10n(e){this.#r=e}getLanguage(){return this.#n}getDirection(){return this.#e}async get(e,t=null){return Array.isArray(e)?(e=e.map(e=>({id:e})),(await this.#r.formatMessages(e)).map(e=>e.value)):(await this.#r.formatMessages([{id:e,args:t}]))[0]?.value}async translate(e){(this.#t||=new Set).add(e);try{this.#r.connectRoot(e),await this.#r.translateRoots()}catch{}}async translateOnce(e){try{await this.#r.translateElements([e])}catch(e){console.error(`translateOnce:`,e)}}async destroy(){if(this.#t){for(let e of this.#t)this.#r.disconnectRoot(e);this.#t.clear(),this.#t=null}this.#r.pauseObserving()}pause(){this.#r.pauseObserving()}resume(){this.#r.resumeObserving()}static#i(e){return e=e?.toLowerCase()||`en-us`,{en:`en-us`,es:`es-es`,fy:`fy-nl`,ga:`ga-ie`,gu:`gu-in`,hi:`hi-in`,hy:`hy-am`,nb:`nb-no`,ne:`ne-np`,nn:`nn-no`,pa:`pa-in`,pt:`pt-pt`,sv:`sv-se`,zh:`zh-cn`}[e]||e}static#a(e){let t=e.split(`-`,1)[0];return[`ar`,`he`,`fa`,`ps`,`ur`].includes(t)}},gx=class e extends hx{constructor(t){super({lang:t});let n=t?e.#e.bind(e,`en-us`,this.getLanguage()):e.#r.bind(e,this.getLanguage());this._setL10n(new mx([],n))}static async*#e(e,t){let{baseURL:n,paths:r}=await this.#n(),i=[t];if(e!==t){let n=t.split(`-`,1)[0];n!==t&&i.push(n),i.push(e)}let a=i.map(e=>[e,this.#t(e,n,r)]);for(let[e,t]of a){let n=await t;n?yield n:e===`en-us`&&(yield this.#i(e))}}static async#t(e,t,n){let r=n[e];if(!r)return null;let i=new URL(r,t);return Cv(e,await Yv(i,`text`))}static async#n(){try{let{href:e}=document.querySelector(`link[type="application/l10n"]`),t=await Yv(e,`json`);return{baseURL:e.substring(0,e.lastIndexOf(`/`)+1)||`./`,paths:t}}catch{}return{baseURL:`./`,paths:Object.create(null)}}static async*#r(e){yield this.#i(e)}static async#i(e){return Cv(e,`pdfjs-previous-button =
114
+ .title = Previous Page
115
+ pdfjs-previous-button-label = Previous
116
+ pdfjs-next-button =
117
+ .title = Next Page
118
+ pdfjs-next-button-label = Next
119
+ pdfjs-page-input =
120
+ .title = Page
121
+ pdfjs-of-pages = of { $pagesCount }
122
+ pdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })
123
+ pdfjs-zoom-out-button =
124
+ .title = Zoom Out
125
+ pdfjs-zoom-out-button-label = Zoom Out
126
+ pdfjs-zoom-in-button =
127
+ .title = Zoom In
128
+ pdfjs-zoom-in-button-label = Zoom In
129
+ pdfjs-zoom-select =
130
+ .title = Zoom
131
+ pdfjs-presentation-mode-button =
132
+ .title = Switch to Presentation Mode
133
+ pdfjs-presentation-mode-button-label = Presentation Mode
134
+ pdfjs-open-file-button =
135
+ .title = Open File
136
+ pdfjs-open-file-button-label = Open
137
+ pdfjs-print-button =
138
+ .title = Print
139
+ pdfjs-print-button-label = Print
140
+ pdfjs-save-button =
141
+ .title = Save
142
+ pdfjs-save-button-label = Save
143
+ pdfjs-download-button =
144
+ .title = Download
145
+ pdfjs-download-button-label = Download
146
+ pdfjs-bookmark-button =
147
+ .title = Current Page (View URL from Current Page)
148
+ pdfjs-bookmark-button-label = Current Page
149
+ pdfjs-tools-button =
150
+ .title = Tools
151
+ pdfjs-tools-button-label = Tools
152
+ pdfjs-first-page-button =
153
+ .title = Go to First Page
154
+ pdfjs-first-page-button-label = Go to First Page
155
+ pdfjs-last-page-button =
156
+ .title = Go to Last Page
157
+ pdfjs-last-page-button-label = Go to Last Page
158
+ pdfjs-page-rotate-cw-button =
159
+ .title = Rotate Clockwise
160
+ pdfjs-page-rotate-cw-button-label = Rotate Clockwise
161
+ pdfjs-page-rotate-ccw-button =
162
+ .title = Rotate Counterclockwise
163
+ pdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise
164
+ pdfjs-cursor-text-select-tool-button =
165
+ .title = Enable Text Selection Tool
166
+ pdfjs-cursor-text-select-tool-button-label = Text Selection Tool
167
+ pdfjs-cursor-hand-tool-button =
168
+ .title = Enable Hand Tool
169
+ pdfjs-cursor-hand-tool-button-label = Hand Tool
170
+ pdfjs-scroll-page-button =
171
+ .title = Use Page Scrolling
172
+ pdfjs-scroll-page-button-label = Page Scrolling
173
+ pdfjs-scroll-vertical-button =
174
+ .title = Use Vertical Scrolling
175
+ pdfjs-scroll-vertical-button-label = Vertical Scrolling
176
+ pdfjs-scroll-horizontal-button =
177
+ .title = Use Horizontal Scrolling
178
+ pdfjs-scroll-horizontal-button-label = Horizontal Scrolling
179
+ pdfjs-scroll-wrapped-button =
180
+ .title = Use Wrapped Scrolling
181
+ pdfjs-scroll-wrapped-button-label = Wrapped Scrolling
182
+ pdfjs-spread-none-button =
183
+ .title = Do not join page spreads
184
+ pdfjs-spread-none-button-label = No Spreads
185
+ pdfjs-spread-odd-button =
186
+ .title = Join page spreads starting with odd-numbered pages
187
+ pdfjs-spread-odd-button-label = Odd Spreads
188
+ pdfjs-spread-even-button =
189
+ .title = Join page spreads starting with even-numbered pages
190
+ pdfjs-spread-even-button-label = Even Spreads
191
+ pdfjs-document-properties-button =
192
+ .title = Document Properties…
193
+ pdfjs-document-properties-button-label = Document Properties…
194
+ pdfjs-document-properties-file-name = File name:
195
+ pdfjs-document-properties-file-size = File size:
196
+ pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)
197
+ pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)
198
+ pdfjs-document-properties-title = Title:
199
+ pdfjs-document-properties-author = Author:
200
+ pdfjs-document-properties-subject = Subject:
201
+ pdfjs-document-properties-keywords = Keywords:
202
+ pdfjs-document-properties-creation-date = Creation Date:
203
+ pdfjs-document-properties-modification-date = Modification Date:
204
+ pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
205
+ pdfjs-document-properties-creator = Creator:
206
+ pdfjs-document-properties-producer = PDF Producer:
207
+ pdfjs-document-properties-version = PDF Version:
208
+ pdfjs-document-properties-page-count = Page Count:
209
+ pdfjs-document-properties-page-size = Page Size:
210
+ pdfjs-document-properties-page-size-unit-inches = in
211
+ pdfjs-document-properties-page-size-unit-millimeters = mm
212
+ pdfjs-document-properties-page-size-orientation-portrait = portrait
213
+ pdfjs-document-properties-page-size-orientation-landscape = landscape
214
+ pdfjs-document-properties-page-size-name-a-three = A3
215
+ pdfjs-document-properties-page-size-name-a-four = A4
216
+ pdfjs-document-properties-page-size-name-letter = Letter
217
+ pdfjs-document-properties-page-size-name-legal = Legal
218
+ pdfjs-document-properties-page-size-dimension-string = { $width } × { $height } { $unit } ({ $orientation })
219
+ pdfjs-document-properties-page-size-dimension-name-string = { $width } × { $height } { $unit } ({ $name }, { $orientation })
220
+ pdfjs-document-properties-linearized = Fast Web View:
221
+ pdfjs-document-properties-linearized-yes = Yes
222
+ pdfjs-document-properties-linearized-no = No
223
+ pdfjs-document-properties-close-button = Close
224
+ pdfjs-print-progress-message = Preparing document for printing…
225
+ pdfjs-print-progress-percent = { $progress }%
226
+ pdfjs-print-progress-close-button = Cancel
227
+ pdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.
228
+ pdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.
229
+ pdfjs-current-outline-item-button =
230
+ .title = Find Current Outline Item
231
+ pdfjs-current-outline-item-button-label = Current Outline Item
232
+ pdfjs-findbar-button =
233
+ .title = Find in Document
234
+ pdfjs-findbar-button-label = Find
235
+ pdfjs-additional-layers = Additional Layers
236
+ pdfjs-thumb-page-title1 =
237
+ .title = Page { $page } of { $total }
238
+ pdfjs-thumb-page-canvas =
239
+ .aria-label = Thumbnail of Page { $page }
240
+ pdfjs-thumb-page-checkbox1 =
241
+ .title = Select page { $page }
242
+ pdfjs-find-input =
243
+ .title = Find
244
+ .placeholder = Find in document…
245
+ pdfjs-find-previous-button =
246
+ .title = Find the previous occurrence of the phrase
247
+ pdfjs-find-previous-button-label = Previous
248
+ pdfjs-find-next-button =
249
+ .title = Find the next occurrence of the phrase
250
+ pdfjs-find-next-button-label = Next
251
+ pdfjs-find-highlight-checkbox = Highlight All
252
+ pdfjs-find-match-case-checkbox-label = Match Case
253
+ pdfjs-find-match-diacritics-checkbox-label = Match Diacritics
254
+ pdfjs-find-entire-word-checkbox-label = Whole Words
255
+ pdfjs-find-reached-top = Reached top of document, continued from bottom
256
+ pdfjs-find-reached-bottom = Reached end of document, continued from top
257
+ pdfjs-find-match-count =
258
+ { $total ->
259
+ [one] { $current } of { $total } match
260
+ *[other] { $current } of { $total } matches
261
+ }
262
+ pdfjs-find-match-count-limit =
263
+ { $limit ->
264
+ [one] More than { $limit } match
265
+ *[other] More than { $limit } matches
266
+ }
267
+ pdfjs-find-not-found = Phrase not found
268
+ pdfjs-page-scale-width = Page Width
269
+ pdfjs-page-scale-fit = Page Fit
270
+ pdfjs-page-scale-auto = Automatic Zoom
271
+ pdfjs-page-scale-actual = Actual Size
272
+ pdfjs-page-scale-percent = { $scale }%
273
+ pdfjs-page-landmark =
274
+ .aria-label = Page { $page }
275
+ pdfjs-loading-error = An error occurred while loading the PDF.
276
+ pdfjs-invalid-file-error = Invalid or corrupted PDF file.
277
+ pdfjs-missing-file-error = Missing PDF file.
278
+ pdfjs-unexpected-response-error = Unexpected server response.
279
+ pdfjs-rendering-error = An error occurred while rendering the page.
280
+ pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
281
+ pdfjs-text-annotation-type =
282
+ .alt = [{ $type } Annotation]
283
+ pdfjs-password-label = Enter the password to open this PDF file.
284
+ pdfjs-password-invalid = Invalid password. Please try again.
285
+ pdfjs-password-ok-button = OK
286
+ pdfjs-password-cancel-button = Cancel
287
+ pdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.
288
+ pdfjs-editor-free-text-button =
289
+ .title = Text
290
+ pdfjs-editor-color-picker-free-text-input =
291
+ .title = Change text color
292
+ pdfjs-editor-free-text-button-label = Text
293
+ pdfjs-editor-ink-button =
294
+ .title = Draw
295
+ pdfjs-editor-color-picker-ink-input =
296
+ .title = Change drawing color
297
+ pdfjs-editor-ink-button-label = Draw
298
+ pdfjs-editor-stamp-button =
299
+ .title = Add or edit images
300
+ pdfjs-editor-stamp-button-label = Add or edit images
301
+ pdfjs-editor-highlight-button =
302
+ .title = Highlight
303
+ pdfjs-editor-highlight-button-label = Highlight
304
+ pdfjs-highlight-floating-button1 =
305
+ .title = Highlight
306
+ .aria-label = Highlight
307
+ pdfjs-highlight-floating-button-label = Highlight
308
+ pdfjs-comment-floating-button =
309
+ .title = Comment
310
+ .aria-label = Comment
311
+ pdfjs-comment-floating-button-label = Comment
312
+ pdfjs-editor-comment-button =
313
+ .title = Comment
314
+ .aria-label = Comment
315
+ pdfjs-editor-comment-button-label = Comment
316
+ pdfjs-editor-signature-button =
317
+ .title = Add signature
318
+ pdfjs-editor-signature-button-label = Add signature
319
+ pdfjs-editor-highlight-editor =
320
+ .aria-label = Highlight editor
321
+ pdfjs-editor-ink-editor =
322
+ .aria-label = Drawing editor
323
+ pdfjs-editor-signature-editor1 =
324
+ .aria-description = Signature editor: { $description }
325
+ pdfjs-editor-stamp-editor =
326
+ .aria-label = Image editor
327
+ pdfjs-editor-remove-ink-button =
328
+ .title = Remove drawing
329
+ pdfjs-editor-remove-freetext-button =
330
+ .title = Remove text
331
+ pdfjs-editor-remove-stamp-button =
332
+ .title = Remove image
333
+ pdfjs-editor-remove-highlight-button =
334
+ .title = Remove highlight
335
+ pdfjs-editor-remove-signature-button =
336
+ .title = Remove signature
337
+ pdfjs-editor-free-text-color-input = Color
338
+ pdfjs-editor-free-text-size-input = Size
339
+ pdfjs-editor-ink-color-input = Color
340
+ pdfjs-editor-ink-thickness-input = Thickness
341
+ pdfjs-editor-ink-opacity-input = Opacity
342
+ pdfjs-editor-stamp-add-image-button =
343
+ .title = Add image
344
+ pdfjs-editor-stamp-add-image-button-label = Add image
345
+ pdfjs-editor-free-highlight-thickness-input = Thickness
346
+ pdfjs-editor-free-highlight-thickness-title =
347
+ .title = Change thickness when highlighting items other than text
348
+ pdfjs-editor-add-signature-container =
349
+ .aria-label = Signature controls and saved signatures
350
+ pdfjs-editor-signature-add-signature-button =
351
+ .title = Add new signature
352
+ pdfjs-editor-signature-add-signature-button-label = Add new signature
353
+ pdfjs-editor-add-saved-signature-button =
354
+ .title = Saved signature: { $description }
355
+ pdfjs-free-text2 =
356
+ .aria-label = Text Editor
357
+ .default-content = Start typing…
358
+ pdfjs-editor-comments-sidebar-title =
359
+ { $count ->
360
+ [one] Comment
361
+ *[other] Comments
362
+ }
363
+ pdfjs-editor-comments-sidebar-close-button =
364
+ .title = Close the sidebar
365
+ .aria-label = Close the sidebar
366
+ pdfjs-editor-comments-sidebar-close-button-label = Close the sidebar
367
+ pdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment.
368
+ pdfjs-editor-comments-sidebar-no-comments-link = Learn more
369
+ pdfjs-editor-alt-text-button =
370
+ .aria-label = Alt text
371
+ pdfjs-editor-alt-text-button-label = Alt text
372
+ pdfjs-editor-alt-text-edit-button =
373
+ .aria-label = Edit alt text
374
+ pdfjs-editor-alt-text-dialog-label = Choose an option
375
+ pdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can’t see the image or when it doesn’t load.
376
+ pdfjs-editor-alt-text-add-description-label = Add a description
377
+ pdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.
378
+ pdfjs-editor-alt-text-mark-decorative-label = Mark as decorative
379
+ pdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.
380
+ pdfjs-editor-alt-text-cancel-button = Cancel
381
+ pdfjs-editor-alt-text-save-button = Save
382
+ pdfjs-editor-alt-text-decorative-tooltip = Marked as decorative
383
+ pdfjs-editor-alt-text-textarea =
384
+ .placeholder = For example, “A young man sits down at a table to eat a meal”
385
+ pdfjs-editor-resizer-top-left =
386
+ .aria-label = Top left corner — resize
387
+ pdfjs-editor-resizer-top-middle =
388
+ .aria-label = Top middle — resize
389
+ pdfjs-editor-resizer-top-right =
390
+ .aria-label = Top right corner — resize
391
+ pdfjs-editor-resizer-middle-right =
392
+ .aria-label = Middle right — resize
393
+ pdfjs-editor-resizer-bottom-right =
394
+ .aria-label = Bottom right corner — resize
395
+ pdfjs-editor-resizer-bottom-middle =
396
+ .aria-label = Bottom middle — resize
397
+ pdfjs-editor-resizer-bottom-left =
398
+ .aria-label = Bottom left corner — resize
399
+ pdfjs-editor-resizer-middle-left =
400
+ .aria-label = Middle left — resize
401
+ pdfjs-editor-highlight-colorpicker-label = Highlight color
402
+ pdfjs-editor-colorpicker-button =
403
+ .title = Change color
404
+ pdfjs-editor-colorpicker-dropdown =
405
+ .aria-label = Color choices
406
+ pdfjs-editor-colorpicker-yellow =
407
+ .title = Yellow
408
+ pdfjs-editor-colorpicker-green =
409
+ .title = Green
410
+ pdfjs-editor-colorpicker-blue =
411
+ .title = Blue
412
+ pdfjs-editor-colorpicker-pink =
413
+ .title = Pink
414
+ pdfjs-editor-colorpicker-red =
415
+ .title = Red
416
+ pdfjs-editor-highlight-show-all-button-label = Show all
417
+ pdfjs-editor-highlight-show-all-button =
418
+ .title = Show all
419
+ pdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)
420
+ pdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)
421
+ pdfjs-editor-new-alt-text-textarea =
422
+ .placeholder = Write your description here…
423
+ pdfjs-editor-new-alt-text-description = Short description for people who can’t see the image or when the image doesn’t load.
424
+ pdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.
425
+ pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more
426
+ pdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically
427
+ pdfjs-editor-new-alt-text-not-now-button = Not now
428
+ pdfjs-editor-new-alt-text-error-title = Couldn’t create alt text automatically
429
+ pdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.
430
+ pdfjs-editor-new-alt-text-error-close-button = Close
431
+ pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
432
+ .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
433
+ pdfjs-editor-new-alt-text-added-button =
434
+ .aria-label = Alt text added
435
+ pdfjs-editor-new-alt-text-added-button-label = Alt text added
436
+ pdfjs-editor-new-alt-text-missing-button =
437
+ .aria-label = Missing alt text
438
+ pdfjs-editor-new-alt-text-missing-button-label = Missing alt text
439
+ pdfjs-editor-new-alt-text-to-review-button =
440
+ .aria-label = Review alt text
441
+ pdfjs-editor-new-alt-text-to-review-button-label = Review alt text
442
+ pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }
443
+ pdfjs-image-alt-text-settings-button =
444
+ .title = Image alt text settings
445
+ pdfjs-image-alt-text-settings-button-label = Image alt text settings
446
+ pdfjs-editor-alt-text-settings-dialog-label = Image alt text settings
447
+ pdfjs-editor-alt-text-settings-automatic-title = Automatic alt text
448
+ pdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically
449
+ pdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can’t see the image or when the image doesn’t load.
450
+ pdfjs-editor-alt-text-settings-editor-title = Alt text editor
451
+ pdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image
452
+ pdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.
453
+ pdfjs-editor-alt-text-settings-close-button = Close
454
+ pdfjs-editor-highlight-added-alert = Highlight added
455
+ pdfjs-editor-freetext-added-alert = Text added
456
+ pdfjs-editor-ink-added-alert = Drawing added
457
+ pdfjs-editor-stamp-added-alert = Image added
458
+ pdfjs-editor-signature-added-alert = Signature added
459
+ pdfjs-editor-undo-bar-message-highlight = Highlight removed
460
+ pdfjs-editor-undo-bar-message-freetext = Text removed
461
+ pdfjs-editor-undo-bar-message-ink = Drawing removed
462
+ pdfjs-editor-undo-bar-message-stamp = Image removed
463
+ pdfjs-editor-undo-bar-message-signature = Signature removed
464
+ pdfjs-editor-undo-bar-message-comment = Comment removed
465
+ pdfjs-editor-undo-bar-message-multiple =
466
+ { $count ->
467
+ [one] { $count } annotation removed
468
+ *[other] { $count } annotations removed
469
+ }
470
+ pdfjs-editor-undo-bar-undo-button =
471
+ .title = Undo
472
+ pdfjs-editor-undo-bar-undo-button-label = Undo
473
+ pdfjs-editor-undo-bar-close-button =
474
+ .title = Close
475
+ pdfjs-editor-undo-bar-close-button-label = Close
476
+ pdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.
477
+ pdfjs-editor-add-signature-dialog-title = Add a signature
478
+ pdfjs-editor-add-signature-type-button = Type
479
+ .title = Type
480
+ pdfjs-editor-add-signature-draw-button = Draw
481
+ .title = Draw
482
+ pdfjs-editor-add-signature-image-button = Image
483
+ .title = Image
484
+ pdfjs-editor-add-signature-type-input =
485
+ .aria-label = Type your signature
486
+ .placeholder = Type your signature
487
+ pdfjs-editor-add-signature-draw-placeholder = Draw your signature
488
+ pdfjs-editor-add-signature-draw-thickness-range-label = Thickness
489
+ pdfjs-editor-add-signature-draw-thickness-range =
490
+ .title = Drawing thickness: { $thickness }
491
+ pdfjs-editor-add-signature-image-placeholder = Drag a file here to upload
492
+ pdfjs-editor-add-signature-image-browse-link =
493
+ { PLATFORM() ->
494
+ [macos] Or choose image files
495
+ *[other] Or browse image files
496
+ }
497
+ pdfjs-editor-add-signature-description-label = Description (alt text)
498
+ pdfjs-editor-add-signature-description-input =
499
+ .title = Description (alt text)
500
+ pdfjs-editor-add-signature-description-default-when-drawing = Signature
501
+ pdfjs-editor-add-signature-clear-button-label = Clear signature
502
+ pdfjs-editor-add-signature-clear-button =
503
+ .title = Clear signature
504
+ pdfjs-editor-add-signature-save-checkbox = Save signature
505
+ pdfjs-editor-add-signature-save-warning-message = You’ve reached the limit of 5 saved signatures. Remove one to save more.
506
+ pdfjs-editor-add-signature-image-upload-error-title = Couldn’t upload image
507
+ pdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.
508
+ pdfjs-editor-add-signature-image-no-data-error-title = Can’t convert this image into a signature
509
+ pdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.
510
+ pdfjs-editor-add-signature-error-close-button = Close
511
+ pdfjs-editor-add-signature-cancel-button = Cancel
512
+ pdfjs-editor-add-signature-add-button = Add
513
+ pdfjs-editor-delete-signature-button1 =
514
+ .title = Remove saved signature
515
+ pdfjs-editor-delete-signature-button-label1 = Remove saved signature
516
+ pdfjs-editor-add-signature-edit-button-label = Edit description
517
+ pdfjs-editor-edit-signature-dialog-title = Edit description
518
+ pdfjs-editor-edit-signature-update-button = Update
519
+ pdfjs-show-comment-button =
520
+ .title = Show comment
521
+ pdfjs-editor-edit-comment-popup-button-label = Edit comment
522
+ pdfjs-editor-edit-comment-popup-button =
523
+ .title = Edit comment
524
+ pdfjs-editor-delete-comment-popup-button-label = Remove comment
525
+ pdfjs-editor-delete-comment-popup-button =
526
+ .title = Remove comment
527
+ pdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment
528
+ pdfjs-editor-edit-comment-dialog-save-button-when-editing = Update
529
+ pdfjs-editor-edit-comment-dialog-title-when-adding = Add comment
530
+ pdfjs-editor-edit-comment-dialog-save-button-when-adding = Add
531
+ pdfjs-editor-edit-comment-dialog-text-input =
532
+ .placeholder = Start typing…
533
+ pdfjs-editor-edit-comment-dialog-cancel-button = Cancel
534
+ pdfjs-editor-add-comment-button =
535
+ .title = Add comment
536
+ pdfjs-toggle-views-manager-button1 =
537
+ .title = Manage pages
538
+ pdfjs-toggle-views-manager-notification-button =
539
+ .title = Toggle Sidebar (document contains thumbnails/outline/attachments/layers)
540
+ pdfjs-toggle-views-manager-button1-label = Manage pages
541
+ pdfjs-views-manager-sidebar =
542
+ .aria-label = Sidebar
543
+ pdfjs-views-manager-sidebar-resizer =
544
+ .aria-label = Sidebar resizer
545
+ pdfjs-views-manager-view-selector-button =
546
+ .title = Views
547
+ pdfjs-views-manager-view-selector-button-label = Views
548
+ pdfjs-views-manager-pages-title = Pages
549
+ pdfjs-views-manager-outlines-title1 = Document outline
550
+ .title = Document outline (double-click to expand/collapse all items)
551
+ pdfjs-views-manager-attachments-title = Attachments
552
+ pdfjs-views-manager-layers-title1 = Layers
553
+ .title = Layers (double-click to reset all layers to the default state)
554
+ pdfjs-views-manager-pages-option-label = Pages
555
+ pdfjs-views-manager-outlines-option-label = Document outline
556
+ pdfjs-views-manager-attachments-option-label = Attachments
557
+ pdfjs-views-manager-layers-option-label = Layers
558
+ pdfjs-views-manager-add-file-button =
559
+ .title = Add file
560
+ pdfjs-views-manager-add-file-button-label = Add file
561
+ pdfjs-views-manager-pages-status-action-label =
562
+ { $count ->
563
+ [one] { $count } selected
564
+ *[other] { $count } selected
565
+ }
566
+ pdfjs-views-manager-pages-status-none-action-label = Select pages
567
+ pdfjs-views-manager-pages-status-action-button-label = Manage
568
+ pdfjs-views-manager-pages-status-copy-button-label = Copy
569
+ pdfjs-views-manager-pages-status-cut-button-label = Cut
570
+ pdfjs-views-manager-pages-status-delete-button-label = Delete
571
+ pdfjs-views-manager-pages-status-export-selected-button-label = Export selected…
572
+ pdfjs-views-manager-status-undo-cut-label =
573
+ { $count ->
574
+ [one] 1 page cut
575
+ *[other] { $count } pages cut
576
+ }
577
+ pdfjs-views-manager-pages-status-undo-copy-label =
578
+ { $count ->
579
+ [one] 1 page copied
580
+ *[other] { $count } pages copied
581
+ }
582
+ pdfjs-views-manager-pages-status-undo-delete-label =
583
+ { $count ->
584
+ [one] 1 page deleted
585
+ *[other] { $count } pages deleted
586
+ }
587
+ pdfjs-views-manager-status-undo-button-label = Undo
588
+ pdfjs-views-manager-status-done-button-label = Done
589
+ pdfjs-views-manager-status-close-button =
590
+ .title = Close
591
+ pdfjs-views-manager-status-close-button-label = Close
592
+ pdfjs-views-manager-paste-button-label = Paste
593
+ pdfjs-views-manager-paste-button-before =
594
+ .title = Paste before the first page
595
+ pdfjs-views-manager-paste-button-after =
596
+ .title = Paste after page { $page }
597
+ pdfjs-new-badge-content = NEW
598
+ pdfjs-views-manager-waiting-for-file = Uploading file…
599
+ pdfjs-digital-signature-properties-button =
600
+ .title = Digital signature properties
601
+ .aria-label = Digital signature properties
602
+ pdfjs-digital-signature-properties-button-label = Digital signature properties
603
+ pdfjs-digital-signature-properties-banner-verified = Document was signed with a valid digital signature
604
+ pdfjs-digital-signature-properties-banner-unknown =
605
+ { $count ->
606
+ [one] Document signed but { $count } digital signature could not be verified
607
+ *[other] Document signed but { $count } digital signatures could not be verified
608
+ }
609
+ pdfjs-digital-signature-properties-banner-untrusted =
610
+ { $count ->
611
+ [one] Document signed with { $count } certificate that is not trusted
612
+ *[other] Document signed with { $count } certificates that are not trusted
613
+ }
614
+ pdfjs-digital-signature-properties-banner-expired =
615
+ { $count ->
616
+ [one] Document signed with { $count } expired certificate
617
+ *[other] Document signed with { $count } expired certificates
618
+ }
619
+ pdfjs-digital-signature-properties-banner-invalid =
620
+ { $count ->
621
+ [one] Document has { $count } invalid digital signature
622
+ *[other] Document has { $count } invalid digital signatures
623
+ }
624
+ pdfjs-digital-signature-properties-banner-revoked =
625
+ { $count ->
626
+ [one] Document signed with { $count } revoked certificate
627
+ *[other] Document signed with { $count } revoked certificates
628
+ }
629
+ pdfjs-digital-signature-properties-status-verified = Status: Signature verified
630
+ pdfjs-digital-signature-properties-status-invalid = Status: Signature invalid
631
+ pdfjs-digital-signature-properties-status-unknown = Status: Unable to verify (unsupported)
632
+ pdfjs-digital-signature-properties-certificate-trusted = Certificate: Trusted ({ $issuer })
633
+ pdfjs-digital-signature-properties-certificate-unknown = Certificate: Unavailable
634
+ pdfjs-digital-signature-properties-certificate-untrusted = Certificate: Untrusted
635
+ pdfjs-digital-signature-properties-certificate-untrusted-unknown-issuer = Certificate: Unknown issuer ({ $issuer })
636
+ pdfjs-digital-signature-properties-certificate-untrusted-self-signed = Certificate: Self-signed ({ $issuer })
637
+ pdfjs-digital-signature-properties-certificate-untrusted-untrusted-issuer = Certificate: Untrusted issuer ({ $issuer })
638
+ pdfjs-digital-signature-properties-certificate-expired = Certificate: Expired
639
+ pdfjs-digital-signature-properties-certificate-expired-with-date = Certificate: Expired ({ DATETIME($dateObj, dateStyle: "medium") })
640
+ pdfjs-digital-signature-properties-certificate-revoked = Certificate: Revoked
641
+ pdfjs-digital-signature-properties-view-certificate = View certificate
642
+ pdfjs-digital-signature-properties-reason = Reason: { $reason }
643
+ pdfjs-digital-signature-properties-timestamp = Timestamp: { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
644
+ pdfjs-digital-signature-properties-sub-signatures =
645
+ { $count ->
646
+ [one] Sub-signature ({ $count })
647
+ *[other] Sub-signatures ({ $count })
648
+ }`)}},_x=1e3,vx=50,yx=1e3,bx=class{#e=null;constructor({linkService:e,eventBus:t}){this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint=``,this.reset(),this.eventBus.on(`pagesinit`,()=>{this._isPagesLoaded=!1,this.eventBus.on(`pagesloaded`,e=>{this._isPagesLoaded=!!e.pagesCount},{once:!0,...Qy})},Qy)}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:n=!1}){if(!e||typeof e!=`string`){console.error(`PDFHistory.initialize: The "fingerprint" must be a non-empty string.`);return}this._initialized&&this.reset();let r=this._fingerprint!==``&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=n===!0,this._initialized=!0,this.#u();let i=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=wv(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this.#i(i,!0)||t){let{hash:e,page:n,rotation:i}=this.#o(!0);if(!e||r||t){this.#t(null,!0);return}this.#t({hash:e,page:n,rotation:i},!0);return}let a=i.destination;this.#a(a,i.uid,!0),a.rotation!==void 0&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this.#l(),this._initialized=!1,this.#d()),this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:n}){if(!this._initialized)return;if(e&&typeof e!=`string`){console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}if(!Array.isArray(t)){console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}if(!this.#r(n)&&(n!==null||this._destination)){console.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);return}let r=e||JSON.stringify(t);if(!r)return;let i=!1;if(this._destination&&(Tv(this._destination.hash,r)||Ev(this._destination.dest,t))){if(this._destination.page)return;i=!0}(!this._popStateInProgress||i)&&(this.#t({dest:t,hash:r,page:n,rotation:this.linkService.rotation},i),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(e){this._initialized&&(this.#r(e)?this._destination?.page!==e&&(this._popStateInProgress||(this.#t({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))):console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this.#n()}back(){if(!this._initialized||this._popStateInProgress)return;let e=window.history.state;this.#i(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;let e=window.history.state;this.#i(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}#t(e,t=!1){let n=t||!this._destination,r={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};this.#a(e,r.uid);let i;if(this._updateUrl&&e?.hash){let{href:t,protocol:n}=document.location;n!==`file:`&&(i=Iy(t,e.hash))}n?window.history.replaceState(r,``,i):window.history.pushState(r,``,i)}#n(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination){this.#t(t);return}if(this._destination.temporary){this.#t(t,!0);return}if(this._destination.hash===t.hash||!this._destination.page&&this._numPositionUpdates<=vx)return;let n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(this._destination.dest!==void 0||!this._destination.first)return;n=!0}this.#t(t,n)}#r(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}#i(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(t){if(typeof e.fingerprint!=`string`||e.fingerprint.length!==this._fingerprint.length)return!1;let[t]=performance.getEntriesByType(`navigation`);if(t?.type!==`reload`)return!1}else return!1}return!(!Number.isInteger(e.uid)||e.uid<0||e.destination===null||typeof e.destination!=`object`)}#a(e,t,n=!1){this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),n&&e?.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0}#o(e=!1){let t=unescape(wv()).substring(1),n=M_(t),r=n.get(`nameddest`)||``,i=n.get(`page`)|0;return(!this.#r(i)||e&&r.length>0)&&(i=null),{hash:t,page:i,rotation:this.linkService.rotation}}#s({location:e}){this._updateViewareaTimeout&&=(clearTimeout(this._updateViewareaTimeout),null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||this.#n(!0),this._updateViewareaTimeout=null},yx))}#c({state:e}){let t=wv(),n=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;let{hash:e,page:t,rotation:n}=this.#o();this.#t({hash:e,page:t,rotation:n},!0);return}if(!this.#i(e))return;this._popStateInProgress=!0,n&&(this._blockHashChange++,q_({target:window,name:`hashchange`,delay:_x}).then(()=>{this._blockHashChange--}));let r=e.destination;this.#a(r,e.uid,!0),B_(r.rotation)&&(this.linkService.rotation=r.rotation),r.dest?this.linkService.goToDestination(r.dest):r.hash?this.linkService.setHash(r.hash):r.page&&(this.linkService.page=r.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})}#l(){(!this._destination||this._destination.temporary)&&this.#n()}#u(){if(this.#e)return;this.#e=new AbortController;let{signal:e}=this.#e;this.eventBus.on(`updateviewarea`,this.#s.bind(this),{signal:e,...Qy}),window.addEventListener(`popstate`,this.#c.bind(this),{signal:e}),window.addEventListener(`pagehide`,this.#l.bind(this),{signal:e})}#d(){this.#e?.abort(),this.#e=null}},xx=class{#e=null;#t=null;#n=null;#r=null;#i=null;#a;constructor(e){this.pageIndex=e.pageIndex,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n,this.l10n||=new gx,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#a=e.uiManager,this.#e=e.annotationLayer||null,this.#i=e.textLayer||null,this.#t=e.drawLayer||null,this.#n=e.onAppend||null,this.#r=e.structTreeLayer||null}updatePageIndex(e){this.pageIndex=e,this.annotationEditorLayer?.updatePageIndex(e)}async render({viewport:e,intent:t=`display`}){if(t!==`display`||this._cancelled)return;let n=e.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:n}),this.show();return}let r=this.div=document.createElement(`div`);r.className=`annotationEditorLayer`,r.hidden=!0,r.dir=this.#a.direction,this.#n?.(r),this.annotationEditorLayer=new Pv({uiManager:this.#a,div:r,structTreeLayer:this.#r,accessibilityManager:this.accessibilityManager,pageIndex:this.pageIndex,l10n:this.l10n,viewport:n,annotationLayer:this.#e,textLayer:this.#i,drawLayer:this.#t});let i={viewport:n,div:r,annotations:null,intent:t};await this.annotationEditorLayer.render(i),this.show()}update(e){this.div&&this.annotationEditorLayer.update({viewport:e.clone({dontFlip:!0})})}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isInvisible&&(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}};{Sx=new Map;let{maxTouchPoints:e,platform:t,userAgent:n}=navigator,r=/Android/.test(n);(/\b(?:iPad|iPhone|iPod)(?=;)/.test(n)||t===`MacIntel`&&e>1||r)&&Sx.set(`maxCanvasPixels`,5242880),r&&Sx.set(`useSystemFonts`,!1)}Q={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},Cx={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},wx=new Map([[`allowedGlobalEvents`,{value:null,kind:Q.BROWSER}],[`canvasMaxAreaInBytes`,{value:-1,kind:Q.BROWSER+Q.API}],[`isInAutomation`,{value:!1,kind:Q.BROWSER}],[`localeProperties`,{value:{lang:navigator.language||`en-US`},kind:Q.BROWSER}],[`maxCanvasDim`,{value:32767,kind:Q.BROWSER+Q.VIEWER}],[`nimbusDataStr`,{value:``,kind:Q.BROWSER}],[`supportsCaretBrowsingMode`,{value:!1,kind:Q.BROWSER}],[`supportsDocumentFonts`,{value:!0,kind:Q.BROWSER}],[`supportsDownloading`,{value:!0,kind:Q.BROWSER}],[`supportsIntegratedFind`,{value:!1,kind:Q.BROWSER}],[`supportsMouseWheelZoomCtrlKey`,{value:!0,kind:Q.BROWSER}],[`supportsMouseWheelZoomMetaKey`,{value:!0,kind:Q.BROWSER}],[`supportsPinchToZoom`,{value:!0,kind:Q.BROWSER}],[`supportsPrinting`,{value:!0,kind:Q.BROWSER}],[`toolbarDensity`,{value:0,kind:Q.BROWSER+Q.EVENT_DISPATCH}],[`altTextLearnMoreUrl`,{value:``,kind:Q.VIEWER+Q.PREFERENCE}],[`annotationEditorMode`,{value:0,kind:Q.VIEWER+Q.PREFERENCE}],[`annotationMode`,{value:2,kind:Q.VIEWER+Q.PREFERENCE}],[`capCanvasAreaFactor`,{value:200,kind:Q.VIEWER+Q.PREFERENCE}],[`commentLearnMoreUrl`,{value:``,kind:Q.VIEWER+Q.PREFERENCE}],[`cursorToolOnLoad`,{value:0,kind:Q.VIEWER+Q.PREFERENCE}],[`debuggerSrc`,{value:`./debugger.mjs`,kind:Q.VIEWER}],[`defaultUrl`,{value:`compressed.tracemonkey-pldi-09.pdf`,kind:Q.VIEWER}],[`defaultZoomDelay`,{value:400,kind:Q.VIEWER+Q.PREFERENCE}],[`defaultZoomValue`,{value:``,kind:Q.VIEWER+Q.PREFERENCE}],[`disableHistory`,{value:!1,kind:Q.VIEWER}],[`disablePageLabels`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`disablePreferences`,{value:!1,kind:Q.VIEWER}],[`enableAltText`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableAltTextModelDownload`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE+Q.EVENT_DISPATCH}],[`enableAutoLinking`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE}],[`enableComment`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableDetailCanvas`,{value:!0,kind:Q.VIEWER}],[`enableGuessAltText`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE+Q.EVENT_DISPATCH}],[`enableHighlightFloatingButton`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableMerge`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableNewAltTextWhenAddingImage`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE}],[`enableNewBadge`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableNova`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE}],[`enableOptimizedPartialRendering`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enablePermissions`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enablePrintAutoRotate`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE}],[`enableScripting`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE}],[`enableSelectionRendering`,{value:!0,kind:Q.VIEWER+Q.PREFERENCE}],[`enableSignatureEditor`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableSignatureVerification`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableSplitMerge`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`enableUpdatedAddImage`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`externalLinkRel`,{value:`noopener noreferrer nofollow`,kind:Q.VIEWER}],[`externalLinkTarget`,{value:0,kind:Q.VIEWER+Q.PREFERENCE}],[`highlightEditorColors`,{value:`yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043`,kind:Q.VIEWER+Q.PREFERENCE}],[`historyUpdateUrl`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`ignoreDestinationZoom`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`imageResourcesPath`,{value:`./images/`,kind:Q.VIEWER}],[`imagesRightClickMinSize`,{value:-1,kind:Q.VIEWER+Q.PREFERENCE}],[`maxCanvasPixels`,{value:2**25,kind:Q.VIEWER}],[`minDurationToUpdateCanvas`,{value:500,kind:Q.VIEWER}],[`forcePageColors`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`pageColorsBackground`,{value:`Canvas`,kind:Q.VIEWER+Q.PREFERENCE}],[`pageColorsForeground`,{value:`CanvasText`,kind:Q.VIEWER+Q.PREFERENCE}],[`pdfBugEnabled`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`postMessageAfterPrintCallback`,{value:!1,kind:Q.VIEWER+Q.PREFERENCE}],[`printResolution`,{value:150,kind:Q.VIEWER}],[`sandboxBundleSrc`,{value:`../build/pdf.sandbox.mjs`,kind:Q.VIEWER}],[`sidebarViewOnLoad`,{value:-1,kind:Q.VIEWER+Q.PREFERENCE}],[`scrollModeOnLoad`,{value:-1,kind:Q.VIEWER+Q.PREFERENCE}],[`spreadModeOnLoad`,{value:-1,kind:Q.VIEWER+Q.PREFERENCE}],[`textLayerMode`,{value:1,kind:Q.VIEWER+Q.PREFERENCE}],[`viewerCssTheme`,{value:0,kind:Q.VIEWER+Q.PREFERENCE}],[`viewOnLoad`,{value:0,kind:Q.VIEWER+Q.PREFERENCE}],[`cMapPacked`,{value:!0,kind:Q.API}],[`cMapUrl`,{value:`../web/cmaps/`,kind:Q.API}],[`disableAutoFetch`,{value:!1,kind:Q.API+Q.PREFERENCE}],[`disableFontFace`,{value:!1,kind:Q.API+Q.PREFERENCE}],[`disableRange`,{value:!1,kind:Q.API+Q.PREFERENCE}],[`disableStream`,{value:!1,kind:Q.API+Q.PREFERENCE}],[`docBaseUrl`,{value:``,kind:Q.API}],[`enableHWA`,{value:!0,kind:Q.API+Q.PREFERENCE}],[`enableWebGPU`,{value:!0,kind:Q.API+Q.PREFERENCE}],[`enableXfa`,{value:!0,kind:Q.API+Q.PREFERENCE}],[`fontExtraProperties`,{value:!1,kind:Q.API}],[`iccUrl`,{value:`../web/iccs/`,kind:Q.API}],[`isOffscreenCanvasSupported`,{value:!0,kind:Q.API}],[`maxImageSize`,{value:-1,kind:Q.API}],[`pdfBug`,{value:!1,kind:Q.API}],[`standardFontDataUrl`,{value:`../web/standard_fonts/`,kind:Q.API}],[`useSystemFonts`,{value:void 0,kind:Q.API,type:Cx.BOOLEAN+Cx.UNDEFINED}],[`verbosity`,{value:1,kind:Q.API}],[`wasmUrl`,{value:`../web/wasm/`,kind:Q.API}],[`workerPort`,{value:null,kind:Q.WORKER}],[`workerSrc`,{value:`../build/pdf.worker.mjs`,kind:Q.WORKER}]]),Tx=class{static eventBus;static#e=new Map;static{for(let[e,t]of wx)this.#e.set(e,t.value);for(let[e,t]of Sx)this.#e.set(e,t);this._hasInvokedSet=!1,this._checkDisablePreferences=()=>this.get(`disablePreferences`)?!0:(this._hasInvokedSet&&console.warn(`The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.`),!1)}static get(e){return this.#e.get(e)}static getAll(e=null,t=!1){let n=Object.create(null);for(let[r,i]of wx)(!e||e&i.kind)&&(n[r]=t?i.value:this.#e.get(r));return n}static set(e,t){this.setAll({[e]:t})}static setAll(e,t=!1){this._hasInvokedSet||=!0;let n;for(let r in e){let i=wx.get(r),a=e[r];if(!i||!(typeof a==typeof i.value||Cx[(typeof a).toUpperCase()]&i.type))continue;let{kind:o}=i;(!t||o&Q.BROWSER||o&Q.PREFERENCE)&&(this.eventBus&&o&Q.EVENT_DISPATCH&&(n??=new Map).set(r,a),this.#e.set(r,a))}n?.forEach((e,t)=>{this.eventBus.dispatch(t.toLowerCase(),{source:this,value:e})})}},Ex=class{static#e=0;static#t;static#n;static findLinks(e){this.#t??=/\b(?:https?:\/\/|mailto:|www\.)(?:[\S--[\p{P}<>]]|\/|[\S--[\[\]]]+[\S--[\p{P}<>]])+|(?=\p{L})[\S--[@\p{Ps}\p{Pe}<>]]{1,64}@([\S--[[\p{P}--\-]<>]]{1,63}(?:\.[\S--[[\p{P}--\-]<>]]{1,63})+)/gv;let[t,n]=G_(e,{ignoreDashEOL:!0}),r=t.matchAll(this.#t),i=[];for(let e of r){let[t,r]=e,a;if(t.startsWith(`www.`)||t.startsWith(`http://`)||t.startsWith(`https://`))a=t;else if(r){let e=URL.parse(`http://${r}`)?.hostname;if(!e||(this.#n??=/\.\d+$/,this.#n.test(e)))continue}a??=t.startsWith(`mailto:`)?t:`mailto:${t}`;let o=Wv(a,null,{addDefaultProtocol:!0});if(o){let[r,a]=K_(n,e.index,t.length);i.push({url:o.href,index:r,length:a})}}return i}static processLinks(e){return this.findLinks(e._textHighlighter.textContentItemsStr.join(`
649
+ `)).map(t=>Av(t,e,this.#e++))}},$={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},Dx=class{renderingId=``;renderTask=null;resume=null;get renderingState(){throw Error("Abstract getter `renderingState` accessed")}set renderingState(e){throw Error("Abstract setter `renderingState` accessed")}async draw(){throw Error(`Not implemented: draw`)}},Ox=class extends Dx{#e=null;#t=null;#n=$.INITIAL;#r=null;#i=0;#a=null;canvas=null;div=null;enableOptimizedPartialRendering=!1;enableSelectionRendering=!0;imagesRightClickMinSize=-1;eventBus=null;id=null;imageCoordinates=null;pageColors=null;recordedBBoxes=null;renderingQueue=null;constructor(e){super(),this.eventBus=e.eventBus,this.id=e.id,this.pageColors=e.pageColors||null,this.renderingQueue=e.renderingQueue,this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=e.enableSelectionRendering!==!1&&Jv.isBackdropFilterSupported,this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1,this.minDurationToUpdateCanvas=e.minDurationToUpdateCanvas??500}get renderingState(){return this.#n}set renderingState(e){if(e!==this.#n)switch(this.#n=e,this.#e&&=(clearTimeout(this.#e),null),e){case $.PAUSED:this.div.classList.remove(`loading`),this.#i=0,this.#r?.(!1);break;case $.RUNNING:this.div.classList.add(`loadingIcon`),this.#e=setTimeout(()=>{this.div.classList.add(`loading`),this.#e=null},0),this.#i=Date.now();break;case $.INITIAL:case $.FINISHED:this.div.classList.remove(`loadingIcon`,`loading`),this.#i=0}}_createCanvas(e,t=!1){let{pageColors:n}=this,r=!!(n?.background&&n?.foreground),i=this.canvas,a=!i&&!r&&!t,o=this.canvas=document.createElement(`canvas`);return this.#r=t=>{if(a){let n=this.#a;if(!t&&this.minDurationToUpdateCanvas>0){if(Date.now()-this.#i<this.minDurationToUpdateCanvas)return;n||(n=this.#a=o,o=this.canvas=o.cloneNode(!1),e(o))}if(n){o.getContext(`2d`,{alpha:!1}).drawImage(n,0,0),t?this.#s():this.#i=Date.now();return}e(o),this.#r=null}else t&&(i?(i.replaceWith(o),i.width=i.height=0):e(o))},{canvas:o,prevCanvas:i}}#o=e=>{this.#r?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)?(this.renderingState=$.PAUSED,this.resume=()=>{this.renderingState=$.RUNNING,e()}):e()};_resetCanvas(){let{canvas:e}=this;e&&(e.remove(),e.width=e.height=0,this.canvas=null,this.#s())}#s(){this.#a&&=(this.#a.width=this.#a.height=0,null)}async _drawCanvas(e,t,n){let r=this.renderTask=this.pdfPage.render(e);r.onContinue=this.#o,r.onError=e=>{e instanceof Ty&&(t(),this.#t=null)};let i=null;try{await r.promise,this.#r?.(!0)}catch(e){if(e instanceof Ty)return;i=e,this.#r?.(!0)}finally{this.#t=i,r===this.renderTask&&(this.renderTask=null,this.enableOptimizedPartialRendering&&(this.recordedBBoxes??=r.recordedBBoxes),this.imagesRightClickMinSize!==-1&&(this.imageCoordinates??=this.pdfPage.imageCoordinates))}if(this.renderingState=$.FINISHED,n(r),i)throw i}cancelRendering({cancelExtraDelay:e=0}={}){this.renderTask&&=(this.renderTask.cancel(e),null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch(`pagerender`,{source:this,pageNumber:this.id})}dispatchPageRendered(e,t){this.eventBus.dispatch(`pagerendered`,{source:this,pageNumber:this.id,cssTransform:e,isDetailView:t,timestamp:performance.now(),error:this.#t})}},kx=class{#e=null;constructor(e){this.pageIndex=e.pageIndex,this.textLayer=e.textLayer||null,this.filterFactory=e.filterFactory||null,this.pageColors=e.pageColors||null}async render({intent:e=`display`}){e!==`display`||this.#e||this._cancelled||(this.#e=new qv({pageIndex:this.pageIndex,textLayer:this.textLayer,filterFactory:this.filterFactory,pageColors:this.pageColors}))}cancel(){this._cancelled=!0,this.#e?.destroy(),this.#e=null}setParent(e){this.#e?.setParent(e)}getDrawLayer(){return this.#e}},Ax=class extends Ox{#e=null;renderingCancelled=!1;constructor({pageView:e}){super(e),this.pageView=e,this.renderingId=`detail`+this.id,this.div=e.div}setPdfPage(e){this.pageView.setPdfPage(e)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(e){this.renderingCancelled=!1,super.renderingState=e}reset({keepCanvas:e=!1}={}){let t=this.renderingCancelled||this.renderingState===$.RUNNING||this.renderingState===$.PAUSED;this.cancelRendering(),this.renderingState=$.INITIAL,this.renderingCancelled=t,e||this._resetCanvas()}#t(e){if(!this.#e)return!0;let t=this.#e.minX,n=this.#e.minY,r=this.#e.width+t,i=this.#e.height+n;if(e.minX<t||e.minY<n||e.maxX>r||e.maxY>i)return!0;let{width:a,height:o,scale:s}=this.pageView.viewport;if(this.#e.scale!==s)return!0;let c=e.minX-t,l=r-e.maxX,u=e.minY-n,d=i-e.maxY;return t>0&&l/c>3||r<a&&c/l>3||n>0&&d/u>3||i<o&&u/d>3}update({visibleArea:e=null,underlyingViewUpdated:t=!1}={}){if(t){this.cancelRendering(),this.renderingState=$.INITIAL;return}if(!this.#t(e))return;let{viewport:n,maxCanvasPixels:r,capCanvasAreaFactor:i}=this.pageView,a=e.maxX-e.minX,o=e.maxY-e.minY,s=a*o*_y.pixelRatio**2,c=(Math.sqrt(_y.capPixels(r,i)/s)-1)/2,l=Math.min(1,c);l<0&&(l=0);let u=a*l,d=o*l,f=Math.max(0,e.minX-u),p=Math.min(n.width,e.maxX+u),m=Math.max(0,e.minY-d),h=Math.min(n.height,e.maxY+d),g=p-f,_=h-m;this.#e={minX:f,minY:m,width:g,height:_,scale:n.scale},this.reset({keepCanvas:!0})}_getRenderingContext(e,t){let n=this.pageView._getRenderingContext(e,t,!1),r=this.pdfPage.recordedBBoxes;if(!r||!this.enableOptimizedPartialRendering)return n;let{viewport:{width:i,height:a}}=this.pageView,{width:o,height:s,minX:c,minY:l}=this.#e,u=c/i,d=l/a,f=(c+o)/i,p=(l+s)/a;return{...n,operationsFilter(e){return!r.isEmpty(e)&&r.minX(e)<=f&&r.maxX(e)>=u&&r.minY(e)<=p&&r.maxY(e)>=d}}}async draw(){if(this.pageView.detailView!==this)return;let e=this.pageView.renderingState===$.FINISHED||this.renderingState===$.FINISHED;this.renderingState!==$.INITIAL&&(console.error(`Must be in new state before drawing`),this.reset());let{div:t,pdfPage:n,viewport:r}=this.pageView;if(!n)throw this.renderingState=$.FINISHED,Error(`pdfPage is not loaded`);this.renderingState=$.RUNNING;let i=this.pageView._ensureCanvasWrapper(),{canvas:a,prevCanvas:o}=this._createCanvas(e=>{i.firstElementChild?.tagName===`CANVAS`?i.firstElementChild.after(e):i.prepend(e)},e);a.ariaHidden=!0,this.enableOptimizedPartialRendering&&(a.className=`detailView`);let{width:s,height:c}=r,l=this.#e,{pixelRatio:u}=_y,d=[u,0,0,u,-l.minX*u,-l.minY*u];a.width=l.width*u,a.height=l.height*u;let{style:f}=a;f.width=`${l.width*100/s}%`,f.height=`${l.height*100/c}%`,f.top=`${l.minY*100/c}%`,f.left=`${l.minX*100/s}%`;let p=this._drawCanvas(this._getRenderingContext(a,d),()=>{this.canvas?.remove(),this.canvas=o},()=>{this.pageView._refreshAnnotationLayer(),this.dispatchPageRendered(!1,!0)});return t.setAttribute(`data-loaded`,!0),this.dispatchPageRender(),p}},jx={Document:null,DocumentFragment:null,Part:`group`,Art:`article`,Sect:`group`,Div:`group`,BlockQuote:`blockquote`,Aside:`note`,NonStruct:`none`,P:`paragraph`,H:`heading`,Title:null,FENote:`note`,Sub:`group`,Lbl:null,Span:null,Em:`emphasis`,Strong:`strong`,Note:`note`,Code:`code`,Link:`link`,Annot:`note`,Form:`form`,Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:`list`,LI:`listitem`,LBody:null,Table:`table`,TR:`row`,TH:`columnheader`,TD:`cell`,THead:`rowgroup`,TBody:`rowgroup`,TFoot:`rowgroup`,Caption:`caption`,Figure:`figure`,Formula:null,Artifact:null},Mx=new Set([`caption`,`code`,`emphasis`,`generic`,`none`,`paragraph`,`strong`]),Nx=new Set(`math.merror.mfrac.mi.mmultiscripts.mn.mo.mover.mpadded.mprescripts.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msubsup.msup.mtable.mtd.mtext.mtr.munder.munderover.semantics`.split(`.`)),Px=`http://www.w3.org/1998/Math/MathML`,Fx=class{static get sanitizer(){return ky(this,`sanitizer`,Jv.isSanitizerSupported?new Sanitizer({elements:Array.from(Nx.keys(),e=>({name:e,namespace:Px})),replaceWithChildrenElements:[{name:`maction`,namespace:Px}],attributes:`dir.displaystyle.mathbackground.mathcolor.mathsize.scriptlevel.encoding.display.linethickness.intent.arg.form.fence.separator.lspace.rspace.stretchy.symmetric.maxsize.minsize.largeop.movablelimits.width.height.depth.voffset.accent.accentunder.columnspan.rowspan`.split(`.`),comments:!1}):null)}},Ix=/^H(\d+)$/,Lx=class{#e;#t=null;#n;#r=new Set;#i=new Map;#a=new Map;#o=0;#s=`pdfjs_internal_struct_${ny()}_`;#c=new Map;#l=new Map;#u;#d=null;#f=null;#p=null;constructor(e,t){this.#e=e.getStructTree(),this.#u=t}async render(){if(this.#n)return this.#n;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.#n=e;try{let e=await this.#e;this.#m(e),this.#h(e),this.#t=this.#x(e)}catch(e){n(e)}return this.#e=null,this.#t?.classList.add(`structTree`),t(this.#t),e}async getAriaAttributes(e,{enableLinkOwnership:t=!1}={}){try{await this.render();let n=this.#a.get(e);if(n&&t){let{element:t,ids:r}=n;t.removeAttribute(`role`),r.length>0&&this.#i.getOrInsertComputed(e,uy).set(`aria-owns`,r.join(` `)),this.#a.delete(e)}return this.#i.get(e)}catch{}return null}async getAnnotationIds(){try{return await this.render(),this.#r}catch{}return null}hide(){this.#t&&!this.#t.hidden&&(this.#t.hidden=!0)}show(){this.#t?.hidden&&(this.#t.hidden=!1)}#m(e){if(e){e.structId&&this.#l.getOrInsert(e.structId,e);for(let t of e.children||[])this.#m(t)}}#h(e){if(e){if(e.type===`annotation`)this.#r.add(e.id);else for(let t of e.children||[])this.#h(t)}}#g(e){return this.#c.getOrInsertComputed(e,()=>`${this.#s}${this.#c.size}`)}#_(e){let t=[],n=new Set,r=e.toReversed();for(;r.length>0;){let e=r.pop();if(n.has(e))continue;n.add(e);let i=this.#l.get(e);if(i?.role===`TH`&&(t.push(this.#g(e)),i.headers))for(let e=i.headers.length-1;e>=0;e--)r.push(i.headers[e])}return t}#v(e,t){let{alt:n,colSpan:r,headers:i,id:a,lang:o,rowSpan:s,short:c,structId:l,summary:u}=e;if(n!==void 0){let r=!1,i=N_(n);for(let t of e.children)t.type===`annotation`&&(this.#i.getOrInsertComputed(t.id,uy).set(`aria-label`,i),r=!0);let a=t.getAttribute(`role`)||(t.localName===`span`?`generic`:null);!r&&a!==`none`&&t.setAttribute(Mx.has(a)?`aria-description`:`aria-label`,i)}if(a!==void 0&&t.setAttribute(`aria-owns`,a),l!==void 0&&this.#l.get(l)===e){let e=this.#g(l);if(c!==void 0){let n=document.createElement(`span`);n.setAttribute(`id`,e),n.setAttribute(`aria-hidden`,`true`),n.textContent=N_(c),t.append(n)}else t.setAttribute(`id`,e)}if(o!==void 0&&t.setAttribute(`lang`,N_(o,!0)),s!==void 0&&t.setAttribute(`aria-rowspan`,s),r!==void 0&&t.setAttribute(`aria-colspan`,r),i?.length>0){let e=this.#_(i);e.length>0&&t.setAttribute(`aria-describedby`,e.join(` `))}u!==void 0&&t.setAttribute(`aria-description`,N_(u))}#y(e,t){let{alt:n,bbox:r,children:i}=e,a=i?.[0];if(!this.#u||!n||!r||a?.type!==`content`)return!1;let{id:o}=a;if(!o)return!1;t.setAttribute(`aria-owns`,o);let s=document.createElement(`span`);(this.#d||=new Map).set(o,s),s.setAttribute(`role`,`img`),s.setAttribute(`aria-label`,N_(n));let{pageHeight:c,pageX:l,pageY:u}=this.#u,d=`calc(var(--total-scale-factor) *`,{style:f}=s;return f.width=`${d}${r[2]-r[0]}px)`,f.height=`${d}${r[3]-r[1]}px)`,f.left=`${d}${r[0]-l}px)`,f.top=`${d}${c-r[3]+u}px)`,!0}updateTextLayer(){if(this.#d){for(let[e,t]of this.#d)document.getElementById(e)?.append(t);this.#d.clear(),this.#d=null}if(this.#f){for(let e of this.#f){let t=document.getElementById(e);t&&(t.ariaHidden=!0)}this.#f.length=0,this.#f=null}if(this.#p){for(let e=0,t=this.#p.length;e<t;e+=2){let t=this.#p[e],n=this.#p[e+1],r=``;for(let e of n){let t=document.getElementById(e);t&&(r+=t.textContent.trim()||``,t.ariaHidden=`true`)}r&&(t.textContent=r)}this.#p.length=0,this.#p=null}}#b(e,t){if(e){`id`in e&&t.push(e.id);for(let n of e.children||[])this.#b(n,t)}}#x(e,t=[]){if(!e)return null;let n,r=!0;if(`role`in e){let{role:i}=e;if(Nx.has(i)){n=document.createElementNS(Px,i);let t=[];(this.#p||=[]).push(n,t);for(let{type:n,id:r}of e.children||[])n===`content`&&r&&t.push(r)}else n=document.createElement(`span`);let a=i.match(Ix);if(a)n.setAttribute(`role`,`heading`),n.setAttribute(`aria-level`,a[1]);else if(jx[i]){let r=jx[i];if(i===`TH`)e.scope===`Row`?r=`rowheader`:e.scope===`Column`?r=`columnheader`:t.at(-1)?.role===`TR`&&t.at(-2)?.role===`TBody`&&(r=`rowheader`);else if(i===`Caption`){let e=t.at(-1)?.role;e!==`Table`&&e!==`Figure`&&(r=null)}r&&n.setAttribute(`role`,r)}if(i===`Figure`&&this.#y(e,n))return n;i===`Formula`&&(e.mathML&&Fx.sanitizer&&(r=!1,n.setHTML(e.mathML,{sanitizer:Fx.sanitizer}),this.#b(e,this.#f||=[]),delete e.alt),!e.mathML&&e.children.length===1&&e.children[0].role!==`math`&&(n=document.createElementNS(Px,`math`),delete e.alt))}if(n||=document.createElement(`span`),this.#v(e,n),e.children){if(e.children.length===1&&!(`role`in e.children[0])&&`id`in e.children[0]&&n.getAttribute(`role`)!==`none`)this.#v(e.children[0],n);else if(r){t.push(e);for(let r of e.children)n.append(this.#x(r,t));t.pop()}}if(e.role===`Link`){let t=e.children?.filter(e=>e.type===`annotation`);if(t?.length===1){let e=t[0],r=[];for(let t of n.children)t.getAttribute(`aria-owns`)!==e.id&&(t.id||=`${this.#s}link_${this.#o++}`,r.push(t.id));this.#a.set(e.id,{element:n,ids:r})}}return n}},Rx=class e{#e=!1;#t=null;#n=new Map;#r=new Map;setTextMapping(e){this.#t=e}static#i(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(n.width===0&&n.height===0)return 1;if(r.width===0&&r.height===0)return-1;let i=n.y,a=n.y+n.height,o=n.y+n.height/2,s=r.y,c=r.y+r.height,l=r.y+r.height/2;return o<=s&&l>=a?-1:l<=i&&o>=c?1:n.x+n.width/2-(r.x+r.width/2)}enable(){if(this.#e)throw Error(`TextAccessibilityManager is already enabled.`);if(!this.#t)throw Error(`Text divs and strings have not been set.`);if(this.#e=!0,this.#t=this.#t.slice(),this.#t.sort(e.#i),this.#n.size>0){let e=this.#t;for(let[t,n]of this.#n)document.getElementById(t)?this.#a(t,e[n]):this.#n.delete(t)}for(let[e,t]of this.#r)this.addPointerInTextLayer(e,t);this.#r.clear()}disable(){this.#e&&=(this.#r.clear(),this.#t=null,!1)}removePointerInTextLayer(e){if(!this.#e){this.#r.delete(e);return}let t=this.#t;if(!t?.length)return;let{id:n}=e,r=this.#n.get(n);if(r===void 0)return;let i=t[r];this.#n.delete(n);let a=i.getAttribute(`aria-owns`);a?.includes(n)&&(a=a.split(` `).filter(e=>e!==n).join(` `),a?i.setAttribute(`aria-owns`,a):(i.removeAttribute(`aria-owns`),i.setAttribute(`role`,`presentation`)))}#a(e,t){let n=t.getAttribute(`aria-owns`);n?.includes(e)||t.setAttribute(`aria-owns`,n?`${n} ${e}`:e),t.removeAttribute(`role`)}addPointerInTextLayer(t,n){let{id:r}=t;if(!r)return null;if(!this.#e)return this.#r.set(t,n),null;n&&this.removePointerInTextLayer(t);let i=this.#t;if(!i?.length)return null;let a=P_(i,n=>e.#i(t,n)<0),o=Math.max(0,a-1),s=i[o];this.#a(r,s),this.#n.set(r,o);let c=s.parentNode;return c?.classList.contains(`markedContent`)?c.id:null}moveElementInDOM(t,n,r,i){let a=this.addPointerInTextLayer(r,i);if(!t.hasChildNodes())return t.append(n),a;let o=Array.from(t.childNodes).filter(e=>e!==n);if(o.length===0)return a;let s=P_(o,t=>e.#i(n,t)<0);return s===0?o[0].before(n):o[s-1].after(n),a}},zx=class{#e=null;constructor({findController:e,eventBus:t,pageIndex:n}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=n,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw Error(`Text divs and strings have not been set.`);if(this.enabled)throw Error(`TextHighlighter is already enabled.`);this.enabled=!0,this.#e||(this.#e=new AbortController,this.eventBus.on(`updatetextlayermatches`,e=>{(e.pageIndex===this.pageIdx||e.pageIndex===-1)&&this._updateMatches()},{signal:this.#e.signal,...Qy})),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this.#e?.abort(),this.#e=null,this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];let{textContentItemsStr:n}=this,r=0,i=0,a=n.length-1,o=[];for(let s=0,c=e.length;s<c;s++){let c=e[s];for(;r!==a&&c>=i+n[r].length;)i+=n[r].length,r++;r===n.length&&console.error(`Could not find a matching mapping`);let l={begin:{divIdx:r,offset:c-i}};for(c+=t[s];r!==a&&c>i+n[r].length;)i+=n[r].length,r++;l.end={divIdx:r,offset:c-i},o.push(l)}return o}_renderMatches(e){if(e.length===0)return;let{findController:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this,a=n===t.selected.pageIdx,o=t.selected.matchIdx,s=t.state.highlightAll,c=null,l={divIdx:-1,offset:void 0};function u(e,t){let n=e.divIdx;return i[n].textContent=``,d(n,0,e.offset,t)}function d(e,t,n,a){let o=i[e];if(o.nodeType===Node.TEXT_NODE){let t=document.createElement(`span`);o.before(t),t.append(o),i[e]=t,o=t}let s=r[e].substring(t,n),c=document.createTextNode(s);if(a){let e=document.createElement(`span`);return e.className=`${a} appended`,e.append(c),o.append(e),a.includes(`selected`)?e:null}return o.append(c),0}let f=o,p=f+1;if(s)f=0,p=e.length;else if(!a)return;let m=-1,h=-1;for(let r=f;r<p;r++){let s=e[r],f=s.begin;if(f.divIdx===m&&f.offset===h)continue;m=f.divIdx,h=f.offset;let p=s.end,g=a&&r===o,_=g?` selected`:``,v=null;if(!c||f.divIdx!==c.divIdx?(c!==null&&d(c.divIdx,c.offset,l.offset),u(f)):d(c.divIdx,c.offset,f.offset),f.divIdx===p.divIdx)v=d(f.divIdx,f.offset,p.offset,`highlight`+_);else{v=d(f.divIdx,f.offset,l.offset,`highlight begin`+_);for(let e=f.divIdx+1,t=p.divIdx;e<t;e++)i[e].className=`highlight middle`+_;u(p,`highlight end`+_)}c=p,g&&t.scrollMatchIntoView({element:v,pageIndex:n,matchIndex:o})}c&&d(c.divIdx,c.offset,l.offset)}_updateMatches(e=!1){if(!this.enabled&&!e)return;let{findController:t,matches:n,pageIdx:r}=this,{textContentItemsStr:i,textDivs:a}=this,o=-1;for(let e of n){let t=Math.max(o,e.begin.divIdx);for(let n=t,r=e.end.divIdx;n<=r;n++){let e=a[n];e.textContent=i[n],e.className=``}o=e.end.divIdx+1}if(!t?.highlightMatches||e)return;let s=t.pageMatches[r]||null,c=t.pageMatchesLength[r]||null;this.matches=this._convertMatches(s,c),this._renderMatches(this.matches)}},Bx=class e{#e=null;#t=!1;#n=null;#r=!1;#i=null;static#a=new Map;static#o=null;constructor({pdfPage:e,highlighter:t=null,accessibilityManager:n=null,enablePermissions:r=!1,onAppend:i=null,abortSignal:a=null}){this.pdfPage=e,this.highlighter=t,this.accessibilityManager=n,this.#t=r===!0,this.#n=i,this.#e=a,this.div=document.createElement(`div`),this.div.tabIndex=0,this.div.className=`textLayer`}async render({viewport:e,images:t,textContentParams:n=null}){if(this.#r&&this.#i){this.#i.update({viewport:e,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),this.#i=new Ny({textContentSource:this.pdfPage.streamTextContent(n||{includeMarkedContent:!0,disableNormalization:!0}),images:t,container:this.div,viewport:e});let{textDivs:r,textContentItemsStr:i}=this.#i;this.highlighter?.setTextMapping(r,i),this.accessibilityManager?.setTextMapping(r),await this.#i.render(),this.#r=!0;let a=document.createElement(`div`);a.className=`endOfContent`,this.div.append(a),this.#s(a),this.#n?.(this.div),this.highlighter?.enable(),this.accessibilityManager?.enable()}hide(){!this.div.hidden&&this.#r&&(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.#r&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.#i?.cancel(),this.#i=null,this.#r=!1,this.div.replaceChildren(),this.highlighter?.disable(),this.accessibilityManager?.disable(),e.#c(this.div)}#s(t){let{div:n}=this,r=this.#e,i=r?{signal:r}:null;n.addEventListener(`mousedown`,()=>{n.classList.add(`selecting`)},i),n.addEventListener(`copy`,e=>{if(!this.#t){let t=document.getSelection();e.clipboardData.setData(`text/plain`,N_(hy(t.toString())))}jy(e)},i),e.#a.set(n,t),e.#l(r)}static#c(e){this.#a.delete(e),this.#a.size===0&&(this.#o?.abort(),this.#o=null)}static#l(e){if(this.#o)return;this.#o=new AbortController;let t=e?AbortSignal.any([this.#o.signal,e]):this.#o.signal,n=(e,t)=>{t.append(e),e.style.width=``,e.style.height=``,t.classList.remove(`selecting`)},r=!1;document.addEventListener(`pointerdown`,()=>{r=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{r=!1,this.#a.forEach(n)},{signal:t}),window.addEventListener(`blur`,()=>{r=!1,this.#a.forEach(n)},{signal:t}),document.addEventListener(`keyup`,()=>{r||this.#a.forEach(n)},{signal:t});var i,a;document.addEventListener(`selectionchange`,()=>{let e=document.getSelection();if(e.rangeCount===0){this.#a.forEach(n);return}let t=new Set;for(let n=0;n<e.rangeCount;n++){let r=e.getRangeAt(n);for(let e of this.#a.keys())!t.has(e)&&r.intersectsNode(e)&&t.add(e)}for(let[e,r]of this.#a)t.has(e)?e.classList.add(`selecting`):n(r,e);if(i===void 0&&(i=getComputedStyle(this.#a.values().next().value).getPropertyValue(`-moz-user-select`)===`none`,!i)){let e=navigator.userAgentData?navigator.userAgentData.brands.find(({brand:e})=>e===`Chromium`)?.version:/\bChrome\/(\d+)\b/.exec(navigator.userAgent)?.[1];i=!!e&&parseInt(e,10)>=148}if(i)return;let r=e.getRangeAt(0),o=a&&(r.compareBoundaryPoints(Range.END_TO_END,a)===0||r.compareBoundaryPoints(Range.START_TO_END,a)===0),s=o?r.startContainer:r.endContainer;if(s.nodeType===Node.TEXT_NODE&&(s=s.parentNode),s.classList?.contains(`highlight`)&&(s=s.parentNode),!o&&r.endOffset===0)do{for(;!s.previousSibling;)s=s.parentNode;s=s.previousSibling}while(!s.childNodes.length);let c=s.parentElement?.closest(`.textLayer`),l=this.#a.get(c);l&&(l.style.width=c.style.width,l.style.height=c.style.height,l.style.userSelect=`text`,s.parentElement.insertBefore(l,o?s:s.nextSibling)),a=r.cloneRange()},{signal:t})}},Vx=class{#e=!1;div=null;constructor({pdfPage:e,annotationStorage:t=null,linkService:n,xfaHtml:r=null}){this.pdfPage=e,this.annotationStorage=t,this.linkService=n,this.xfaHtml=r}async render({viewport:e,intent:t=`display`}){let n;if(t===`print`)n=this.xfaHtml;else if(n=await this.pdfPage.getXfa(),this.#e||!n)return{textDivs:[]};let r=!!this.div,i={viewport:e.clone({dontFlip:!0}),div:this.div??=document.createElement(`div`),xfaHtml:n,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return r?By.update(i):By.render(i)}cancel(){this.#e=!0}hide(){this.div&&(this.div.hidden=!0)}},Hx={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new hb}},Ux=new Map([[`canvasWrapper`,0],[`textLayer`,1],[`annotationLayer`,2],[`annotationEditorLayer`,3],[`xfaLayer`,3]]),Wx=class e extends Ox{#e=null;#t=zv.ENABLE_FORMS;#n=null;#r=null;#i=!0;#a=!1;#o=!1;#s=null;#c=!1;#l=null;#u=null;#d=1;#f=1;#p=Gy.ENABLE;#m=1;#h={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#g=[null,null,null,null];constructor(e){super(e);let{container:t,defaultViewport:n}=e;this.renderingId=`page`+this.id,this.#s=e.layerProperties||Hx,this.#e=e.abortSignal||null,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||1,this.viewport=n,this.pdfPageRotate=n.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.#p=e.textLayerMode??Gy.ENABLE,this.#t=e.annotationMode??zv.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||``,this.enableDetailCanvas=e.enableDetailCanvas??!0,this.maxCanvasPixels=e.maxCanvasPixels??Tx.get(`maxCanvasPixels`),this.maxCanvasDim=e.maxCanvasDim||Tx.get(`maxCanvasDim`),this.capCanvasAreaFactor=e.capCanvasAreaFactor??Tx.get(`capCanvasAreaFactor`),this.#i=e.enableAutoLinking!==!1,this.#r=e.commentManager||null,this.l10n=e.l10n,this.l10n||=new gx,this._isStandalone=!this.renderingQueue?.hasViewer(),this._container=t,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null,this.detailView=null;let r=document.createElement(`div`);if(r.className=`page`,r.setAttribute(`data-page-number`,this.id),r.setAttribute(`role`,`region`),r.setAttribute(`data-l10n-id`,`pdfjs-page-landmark`),r.setAttribute(`data-l10n-args`,JSON.stringify({page:this.id})),this.div=r,this.#v(),t?.append(r),this._isStandalone){t?.style.setProperty(`--scale-factor`,this.scale*wy.PDF_TO_CSS_UNITS),this.pageColors?.background&&t?.style.setProperty(`--page-bg-color`,this.pageColors.background);let{optionalContentConfigPromise:n}=e;n&&n.then(e=>{n===this._optionalContentConfigPromise&&(this.#h.initialOptionalContent=e.hasInitialVisibility)}),e.l10n||this.l10n.translate(this.div)}}clone(t){let n=new e({container:null,eventBus:this.eventBus,pagesColors:this.pageColors,renderingQueue:this.renderingQueue,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,minDurationToUpdateCanvas:this.minDurationToUpdateCanvas,defaultViewport:this.viewport,id:t,layerProperties:this.#s,abortSignal:this.#e,scale:this.scale,optionalContentConfigPromise:this._optionalContentConfigPromise,textLayerMode:this.#p,annotationMode:this.#t,imageResourcesPath:this.imageResourcesPath,enableDetailCanvas:this.enableDetailCanvas,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableAutoLinking:this.#i,commentManager:this.#r,l10n:this.l10n});return n.setPdfPage(this.pdfPage.clone(t-1)),n}#_(e,t){let n=Ux.get(t),r=this.#g[n];if(this.#g[n]=e,r)r.replaceWith(e);else{for(let t=n-1;t>=0;t--){let n=this.#g[t];if(n){n.after(e);return}}this.div.prepend(e)}}#v(){let{div:e,viewport:t}=this;if(t.userUnit!==this.#m&&(t.userUnit===1?e.style.removeProperty(`--user-unit`):e.style.setProperty(`--user-unit`,t.userUnit),this.#m=t.userUnit),this.pdfPage){if(this.#u===t.rotation)return;this.#u=t.rotation}Oy(e,t,!0,!1)}updatePageNumber(e){let t=this.id;if(t!==e){this.id=e,this.renderingId=`page${e}`,this.pdfPage&&(this.pdfPage.pageNumber=e),this.setPageLabel(this.pageLabel);let{div:t}=this;t.setAttribute(`data-page-number`,e),t.setAttribute(`data-l10n-args`,JSON.stringify({page:e})),this._textHighlighter.pageIdx=e-1}this.#s.annotationEditorUIManager?.updatePageIndex(t-1,e-1)}setPdfPage(e){this._isStandalone&&(this.pageColors?.foreground===`CanvasText`||this.pageColors?.background===`Canvas`)&&(this._container?.style.setProperty(`--hcm-highlight-filter`,e.filterFactory.addHighlightHCMFilter(`highlight`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`)),this._container?.style.setProperty(`--hcm-highlight-selected-filter`,e.filterFactory.addHighlightHCMFilter(`highlight_selected`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`))),this.pdfPage=e,this.pdfPageRotate=e.rotate;let t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*wy.PDF_TO_CSS_UNITS,rotation:t}),this.#v(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}deleteMe(e){e?this.div.remove():(this.destroy(),this.#s.annotationEditorUIManager?.deletePage(this.id))}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return ky(this,`_textHighlighter`,new zx({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#s.findController}))}#y(e,t){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:t})}async#b(e=null){let{annotationLayer:t,textLayer:n}=this,r=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:`display`,structTreeLayer:this.structTreeLayer,optionalContentConfigPromise:this._optionalContentConfigPromise})}catch(e){console.error(`#renderAnnotationLayer:`,e),r=e}finally{this.#y(`annotationlayerrendered`,r)}this.#i&&e&&this.#D(e,t,n)}_refreshAnnotationLayer(){this._annotationCanvasMap?.size&&this.annotationLayer?.refreshCanvases()}async#x(){let e=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:`display`})}catch(t){console.error(`#renderAnnotationEditorLayer:`,t),e=t}finally{this.#y(`annotationeditorlayerrendered`,e)}}async#S(){try{await this.drawLayer.render({intent:`display`})}catch(e){console.error(`#renderDrawLayer:`,e)}}async#C(){let e=null;try{let e=await this.xfaLayer.render({viewport:this.viewport,intent:`display`});e?.textDivs&&this._textHighlighter&&this.#E(e.textDivs)}catch(t){console.error(`#renderXfaLayer:`,t),e=t}finally{this.xfaLayer?.div&&(this.l10n.pause(),this.#_(this.xfaLayer.div,`xfaLayer`),this.l10n.resume()),this.#y(`xfalayerrendered`,e)}}async#w(){let e=null;try{await this.textLayer.render({viewport:this.viewport,images:this.imageCoordinates?new Py(this.imagesRightClickMinSize,this.imageCoordinates,this.viewport,()=>this.canvas):null})}catch(t){if(t instanceof Nv)return;console.error(`#renderTextLayer:`,t),e=t}this.#y(`textlayerrendered`,e),this.#T()}async#T(){let e=await this.structTreeLayer?.render();e&&(this.l10n.pause(),this.structTreeLayer?.updateTextLayer(),this.canvas&&e.parentNode!==this.canvas&&this.canvas.append(e),this.l10n.resume()),this.structTreeLayer?.show()}async#E(e){let t=await this.pdfPage.getTextContent(),n=[];for(let e of t.items)n.push(e.str);this._textHighlighter.setTextMapping(e,n),this._textHighlighter.enable()}async#D(e,t,n){let r=null;try{if(await e,t!==this.annotationLayer||n!==this.textLayer)return;await t.injectLinkAnnotations(Ex.processLinks(this))}catch(e){console.error(`#injectLinkAnnotations:`,e),r=e}this.#y(`linkannotationsadded`,r)}_resetCanvas(){super._resetCanvas(),this.#l=null}reset({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1,keepCanvasWrapper:i=!1,preserveDetailViewState:a=!1}={}){let o=this.pdfPage?._pdfBug??!1;this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:t,keepXfaLayer:n,keepTextLayer:r}),this.renderingState=$.INITIAL;let s=this.div,c=s.childNodes,l=e&&this.annotationLayer?.div||null,u=t&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null,f=r&&this.textLayer?.div||null,p=i&&this.#n||null;for(let e=c.length-1;e>=0;e--){let t=c[e];switch(t){case l:case u:case d:case f:case p:continue}if(o&&t.classList.contains(`pdfBugGroupsLayer`))continue;t.remove();let n=this.#g.indexOf(t);n>=0&&(this.#g[n]=null)}s.removeAttribute(`data-loaded`),l&&this.annotationLayer.hide(),u&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),f&&this.textLayer.hide(),this.structTreeLayer?.hide(),!i&&this.#n&&(this.#n=null,this._resetCanvas()),a||(this.detailView?.reset({keepCanvas:i}),i||(this.detailView=null))}toggleEditingMode(e){this.#o=e,this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(e){this.enableDetailCanvas&&(this.#c&&this.maxCanvasPixels>0&&e?(this.detailView??=new Ax({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:-1}),this.detailView.update({visibleArea:e})):this.detailView&&=(this.detailView.reset(),null))}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:n=null,drawingDelay:r=-1}){this.scale=e||this.scale,typeof t==`number`&&(this.rotation=t),n instanceof Promise&&(this._optionalContentConfigPromise=n,n.then(e=>{n===this._optionalContentConfigPromise&&(this.#h.initialOptionalContent=e.hasInitialVisibility)})),this.#h.directDrawing=!0;let i=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*wy.PDF_TO_CSS_UNITS,rotation:i}),this.#v(),this._isStandalone&&this._container?.style.setProperty(`--scale-factor`,this.viewport.scale),this.#O(),this.canvas){let e=this.#a&&this.#c,t=r>=0&&r<1e3;if(t||e){t&&!e&&this.renderingState!==$.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r}),this.renderingState=$.FINISHED,this.#h.directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t}),t||(this.detailView?.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1));return}}this.cssTransform({}),this.annotationEditorLayer?.update(this.viewport),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),this.detailView?.update({underlyingViewUpdated:!0})}#O(){let{width:e,height:t}=this.viewport,n=this.outputScale=new _y;if(this.maxCanvasPixels===0){let e=1/this.scale;n.sx*=e,n.sy*=e,this.#c=!0}else if(this.#c=n.limitCanvas(e,t,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor),this.#c&&this.enableDetailCanvas){let e=this.enableOptimizedPartialRendering?4:2;n.sx/=e,n.sy/=e}}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1,cancelExtraDelay:i=0}={}){super.cancelRendering({cancelExtraDelay:i}),this.textLayer&&(!r||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!e||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div||!this.textLayer)&&(this.drawLayer&&=(this.drawLayer.cancel(),null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.drawLayer&&!this.textLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.xfaLayer&&(!n||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:t=!1,redrawXfaLayer:n=!1,redrawTextLayer:r=!1,hideTextLayer:i=!1}){let{canvas:a}=this;if(!a)return;let o=this.#l;if(this.viewport!==o){let e=(360+this.viewport.rotation-o.rotation)%360;if(e===90||e===270){let{width:t,height:n}=this.viewport,r=n/t,i=t/n;a.style.transform=`rotate(${e}deg) scale(${r},${i})`}else a.style.transform=e===0?``:`rotate(${e}deg)`}e&&this.annotationLayer&&this.#b(),t&&this.annotationEditorLayer&&(this.drawLayer&&this.#S(),this.#x()),n&&this.xfaLayer&&this.#C(),this.textLayer&&(i?(this.textLayer.hide(),this.structTreeLayer?.hide()):r&&this.#w())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}_ensureCanvasWrapper(){let e=this.#n;return e||(e=this.#n=document.createElement(`div`),e.classList.add(`canvasWrapper`),this.#_(e,`canvasWrapper`)),e}_getRenderingContext(e,t,n,r){return{canvas:e,transform:t,viewport:this.viewport,annotationMode:this.#t,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:this.#o,recordOperations:n,recordImages:r}}async draw(){this.renderingState!==$.INITIAL&&(console.error(`Must be in new state before drawing`),this.reset());let{div:e,l10n:t,pdfPage:n,viewport:r}=this;if(!n)throw this.renderingState=$.FINISHED,Error(`pdfPage is not loaded`);this.renderingState=$.RUNNING;let i=this._ensureCanvasWrapper();if(!this.textLayer&&this.#p!==Gy.DISABLE&&!n.isPureXfa&&(this._accessibilityManager||=new Rx,this.textLayer=new Bx({pdfPage:n,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:this.#p===Gy.ENABLE_PERMISSIONS,onAppend:e=>{this.l10n.pause(),this.#_(e,`textLayer`),this.l10n.resume()},abortSignal:this.#e}),this.enableSelectionRendering&&this.textLayer.div.classList.add(`selectionRendering`)),!this.annotationLayer&&this.#t!==zv.DISABLE){let{annotationStorage:e,annotationEditorUIManager:t,downloadManager:r,enableComment:i,enableScripting:a,fieldObjectsPromise:o,hasJSActionsPromise:s,linkService:c}=this.#s;this._annotationCanvasMap||=new Map,this.annotationLayer=new gb({pdfPage:n,annotationStorage:e,imageResourcesPath:this.imageResourcesPath,renderForms:this.#t===zv.ENABLE_FORMS,linkService:c,downloadManager:r,enableComment:i,enableScripting:a,hasJSActionsPromise:s,fieldObjectsPromise:o,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:t,commentManager:this.#r,onAppend:e=>{this.#_(e,`annotationLayer`)}})}let{width:a,height:o}=r;this.#l=r;let{canvas:s,prevCanvas:c}=this._createCanvas(e=>{i.prepend(e)});s.setAttribute(`role`,`presentation`),this.outputScale||this.#O();let{outputScale:l}=this;this.#a=this.#c;let u=F_(l.sx),d=F_(l.sy),f=s.width=I_(Xy(a*l.sx),u[0]),p=s.height=I_(Xy(o*l.sy),d[0]),m=I_(Xy(a),u[1]),h=I_(Xy(o),d[1]);l.sx=f/m,l.sy=p/h,this.#d!==u[1]&&(e.style.setProperty(`--scale-round-x`,`${u[1]}px`),this.#d=u[1]),this.#f!==d[1]&&(e.style.setProperty(`--scale-round-y`,`${d[1]}px`),this.#f=d[1]);let g=this.enableOptimizedPartialRendering&&this.#a&&!this.recordedBBoxes,_=this.imagesRightClickMinSize!==-1&&!this.imageCoordinates,v=l.scaled?[l.sx,0,0,l.sy,0,0]:null,y=this._drawCanvas(this._getRenderingContext(s,v,g,_),()=>{c?.remove(),this._resetCanvas()},e=>{this.#h.regularAnnotations=!e.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{if(this.renderingState!==$.FINISHED)return;this.structTreeLayer||=new Lx(n,r.rawDims);let e=this.textLayer?this.#w():null;this.annotationLayer&&await this.#b(e),this.drawLayer||=new kx({pageIndex:this.id,textLayer:this.enableSelectionRendering?this.textLayer?.div:null,filterFactory:this.pdfPage?.filterFactory,pageColors:this.pageColors}),await this.#S(),this.drawLayer.setParent(i);let{annotationEditorUIManager:a}=this.#s;a&&(this.annotationLayer||this.#t===zv.DISABLE)&&(this.annotationEditorLayer||=new xx({uiManager:a,pageIndex:this.id-1,l10n:t,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:e=>{this.#_(e,`annotationEditorLayer`)}}),this.#x())});if(n.isPureXfa){if(!this.xfaLayer){let{annotationStorage:e,linkService:t}=this.#s;this.xfaLayer=new Vx({pdfPage:n,annotationStorage:e,linkService:t})}this.#C()}return e.setAttribute(`data-loaded`,!0),this.dispatchPageRender(),y}setPageLabel(e){this.pageLabel=typeof e==`string`?e:null,this.div.setAttribute(`data-l10n-args`,JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel===null?this.div.removeAttribute(`data-page-label`):this.div.setAttribute(`data-page-label`,this.pageLabel)}get thumbnailCanvas(){let{directDrawing:e,initialOptionalContent:t,regularAnnotations:n}=this.#h;return e&&t&&n?this.canvas:null}},Gx=class{constructor(e,t){this._ready=new Promise((n,r)=>{import(e).then(e=>{n(e.QuickJSSandbox(new URL(t,location.href).href))}).catch(r)})}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){let t=await this._ready;setTimeout(()=>t.dispatchEvent(e),0)}async destroySandbox(){(await this._ready).nukeSandbox()}},Kx=class{#e=null;#t=null;#n=null;#r=null;#i=null;#a=null;#o=null;#s=null;#c=null;#l=!1;#u=null;#d=null;constructor({eventBus:e,externalServices:t=null,docProperties:n=null}){this.#i=e,this.#a=t,this.#n=n}setViewer(e){this.#c=e}async setDocument(e){if(this.#s&&await this.#g(),this.#s=e,!e)return;let[t,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!r){await this.#g();return}if(e!==this.#s)return;if(t){this.#o=new Set;for(let e of t.values())for(let{id:t}of e)this.#o.add(t)}try{this.#u=this.#h()}catch(e){console.error(`setDocument:`,e),await this.#g();return}let i=this.#i;this.#r=new AbortController;let a={signal:this.#r.signal,...Qy};i.on(`updatefromsandbox`,e=>{e?.source===window&&this.#f(e.detail)},a),i.on(`dispatcheventinsandbox`,e=>{this.#u?.dispatchEventInSandbox(e.detail)},a),i.on(`pagechanging`,({pageNumber:e,previous:t})=>{e!==t&&(this.#m(t),this.#p(e))},a),i.on(`pagerendered`,({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this.#c.currentPageNumber&&this.#p(e)},a),i.on(`pagesdestroy`,async()=>{await this.#m(this.#c.currentPageNumber),await this.#u?.dispatchEventInSandbox({id:`doc`,name:`WillClose`}),this.#e?.resolve()},a);try{let a=await this.#n(e);if(e!==this.#s)return;await this.#u.createSandbox({objects:t,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...a,actions:r}}),i.dispatch(`sandboxcreated`,{source:this})}catch(e){console.error(`setDocument:`,e),await this.#g();return}await this.#u?.dispatchEventInSandbox({id:`doc`,name:`Open`}),await this.#p(this.#c.currentPageNumber,!0),Promise.resolve().then(()=>{e===this.#s&&(this.#l=!0)})}async dispatchWillSave(){return this.#u?.dispatchEventInSandbox({id:`doc`,name:`WillSave`})}async dispatchDidSave(){return this.#u?.dispatchEventInSandbox({id:`doc`,name:`DidSave`})}async dispatchWillPrint(){if(this.#u){await this.#d?.promise,this.#d=Promise.withResolvers();try{await this.#u.dispatchEventInSandbox({id:`doc`,name:`WillPrint`})}catch(e){throw this.#d.resolve(),this.#d=null,e}await this.#d.promise}}async dispatchDidPrint(){return this.#u?.dispatchEventInSandbox({id:`doc`,name:`DidPrint`})}get destroyPromise(){return this.#t?.promise||null}get ready(){return this.#l}get _pageOpenPending(){return ky(this,`_pageOpenPending`,new Set)}get _visitedPages(){return ky(this,`_visitedPages`,new Map)}async#f(e){let t=this.#c,n=t.isInPresentationMode||t.isChangingPresentationMode,{id:r,siblings:i,command:a,value:o}=e;if(!r){switch(a){case`clear`:console.clear();break;case`error`:console.error(o);break;case`layout`:n||(t.spreadMode=W_(o).spreadMode);break;case`page-num`:t.currentPageNumber=o+1;break;case`print`:await t.pagesPromise,this.#i.dispatch(`print`,{source:this});break;case`println`:console.log(o);break;case`zoom`:n||(t.currentScaleValue=o);break;case`SaveAs`:this.#i.dispatch(`download`,{source:this});break;case`FirstPage`:t.currentPageNumber=1;break;case`LastPage`:t.currentPageNumber=t.pagesCount;break;case`NextPage`:t.nextPage();break;case`PrevPage`:t.previousPage();break;case`ZoomViewIn`:n||t.increaseScale();break;case`ZoomViewOut`:n||t.decreaseScale();break;case`WillPrintFinished`:this.#d?.resolve(),this.#d=null}return}if(n&&e.focus)return;delete e.id,delete e.siblings;let s=i?[r,...i]:[r];for(let t of s){if(!this.#o?.has(t))continue;let n=document.querySelector(`[data-element-id="${t}"]`);n?n.dispatchEvent(new CustomEvent(`updatefromsandbox`,{detail:e})):this.#s?.annotationStorage.setValue(t,e)}}async#p(e,t=!1){let n=this.#s,r=this._visitedPages;if(t&&(this.#e=Promise.withResolvers()),!this.#e)return;let i=this.#c.getPageView(e-1);if(i?.renderingState!==$.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);let a=(async()=>{let t=await(r.has(e)?null:i.pdfPage?.getJSActions());n===this.#s&&await this.#u?.dispatchEventInSandbox({id:`page`,name:`PageOpen`,pageNumber:e,actions:t})})();r.set(e,a)}async#m(e){let t=this.#s,n=this._visitedPages;if(!this.#e||this._pageOpenPending.has(e))return;let r=n.get(e);r&&(n.set(e,null),await r,t===this.#s&&await this.#u?.dispatchEventInSandbox({id:`page`,name:`PageClose`,pageNumber:e}))}#h(){if(this.#t=Promise.withResolvers(),this.#u)throw Error(`#initScripting: Scripting already exists.`);return this.#a.createScripting()}async#g(){if(this.#o=null,!this.#u)this.#s=null,this.#t?.resolve();else{this.#e&&=(await Promise.race([this.#e.promise,new Promise(e=>{setTimeout(e,1e3)})]).catch(()=>{}),null),this.#s=null;try{await this.#u.destroySandbox()}catch{}this.#d?.reject(Error(`Scripting destroyed.`)),this.#d=null,this.#r?.abort(),this.#r=null,this._pageOpenPending.clear(),this._visitedPages.clear(),this.#u=null,this.#l=!1,this.#t?.resolve()}}},qx=class extends Kx{constructor(e){e.externalServices||window.addEventListener(`updatefromsandbox`,t=>{e.eventBus.dispatch(`updatefromsandbox`,{source:window,detail:t.detail})}),e.externalServices||={createScripting:()=>new Gx(e.sandboxBundleSrc,e.wasmUrl)},e.docProperties||=e=>jv(e),super(e)}},Jx=3e4,Yx=class{#e=null;#t=null;#n=null;#r=null;isThumbnailViewEnabled=!1;onIdle=null;printing=!1;constructor(){Object.defineProperty(this,"hasViewer",{value:()=>!!this.#r})}setViewer(e){this.#r=e}setThumbnailViewer(e){this.#n=e}isHighestPriority(e){return this.#e===e.renderingId}renderHighestPriority(e){this.#t&&=(clearTimeout(this.#t),null),!this.#r.forceRendering(e)&&(this.isThumbnailViewEnabled&&this.#n?.forceRendering()||this.printing||this.onIdle&&(this.#t=setTimeout(this.onIdle.bind(this),Jx)))}getHighestPriority(e,t,n,r=!1,i=!1){let a=e.views,o=a.length;if(o===0)return null;for(let e=0;e<o;e++){let t=a[e].view;if(!this.isViewFinished(t))return t}if(!i)for(let e=0;e<o;e++){let{detailView:t}=a[e].view;if(t&&!this.isViewFinished(t))return t}let s=e.first.id,c=e.last.id;if(c-s+1>o){let r=e.ids;for(let e=1,i=c-s;e<i;e++){let i=n?s+e:c-e;if(r.has(i))continue;let a=t[i-1];if(!this.isViewFinished(a))return a}}let l=n?c:s-2,u=t[l];return u&&!this.isViewFinished(u)||r&&(l+=n?1:-1,u=t[l],u&&!this.isViewFinished(u))?u:null}isViewFinished(e){return e.renderingState===$.FINISHED}renderView(e){switch(e.renderingState){case $.FINISHED:return!1;case $.PAUSED:this.#e=e.renderingId,e.resume();break;case $.RUNNING:this.#e=e.renderingId;break;case $.INITIAL:this.#e=e.renderingId,e.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof Ty||console.error(`renderView:`,e)})}return!0}},Xx=10,Zx={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250},Qx=class{#e=new Set;#t=0;constructor(e){this.#t=e}push(e){let t=this.#e;t.has(e)&&t.delete(e),t.add(e),t.size>this.#t&&this.#n()}resize(e,t=null){this.#t=e;let n=this.#e;if(t){let e=n.size,r=1;for(let i of n)if(t.has(i.id)&&(n.delete(i),n.add(i)),++r>e)break}for(;n.size>this.#t;)this.#n()}has(e){return this.#e.has(e)}[Symbol.iterator](){return this.#e.keys()}#n(){let e=this.#e.keys().next().value;e?.destroy(),this.#e.delete(e)}},$x=class{#e=null;#t=null;#n=null;#r=Iv.NONE;#i=null;#a=zv.ENABLE_FORMS;#o=null;#s=null;#c=null;#l=!1;#u=!1;#d=!1;#f=!1;#p=!0;#m=null;#h=null;#g=0;#_=null;#v=[NaN,NaN];#y=!0;#b=null;#x=!1;#S=null;#C=null;#w=!1;#T=null;#E=0;#D=new ResizeObserver(this.#ee.bind(this));#O=null;#k=null;#A=null;#j=!0;#M=Gy.ENABLE;#N=null;#P=null;#F=null;#I=null;constructor(e){let t=`6.4.299`;if(zy!==t)throw Error(`The API version "${zy}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,this.#N=e.viewerAlert||null,this.container?.tagName!==`DIV`||this.viewer?.tagName!==`DIV`)throw Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!==`absolute`)throw Error("The `container` must be absolutely positioned.");this.#D.observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new hb,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this.#t=e.altTextManager||null,this.#o=e.commentManager||null,this.#A=e.signatureManager||null,this.#c=e.editorUndoBar||null,this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e)),this._scriptingManager=e.scriptingManager||null,this.#M=e.textLayerMode??Gy.ENABLE,this.#a=e.annotationMode??zv.ENABLE_FORMS,this.#r=e.annotationEditorMode??Iv.NONE,this.#n=e.annotationEditorHighlightColors||null,this.#l=e.enableHighlightFloatingButton===!0,this.#d=e.enableUpdatedAddImage===!0,this.#f=e.enableNewAltTextWhenAddingImage===!0,this.imageResourcesPath=e.imageResourcesPath||``,this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,this.maxCanvasPixels=e.maxCanvasPixels,this.maxCanvasDim=e.maxCanvasDim,this.capCanvasAreaFactor=e.capCanvasAreaFactor,this.enableDetailCanvas=e.enableDetailCanvas??!0,this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=e.enableSelectionRendering!==!1,this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1,this.l10n=e.l10n,this.l10n||=new gx,this.#u=e.enablePermissions||!1,this.pageColors=e.pageColors||null,this.#_=e.mlManager||null,this.#j=e.supportsPinchToZoom!==!1,this.#p=e.enableAutoLinking!==!1,this.#g=e.minDurationToUpdateCanvas??500,this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new Yx,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue;let{abortSignal:n}=e;this.#m=n||null,n?.addEventListener(`abort`,()=>{this.#D.disconnect(),this.#D=null},{once:!0}),this.scroll=j_(this.container,this._scrollUpdate.bind(this),n),this.presentationModeState=Wy.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add(`removePageBorders`),this.#$(),this.eventBus.on(`thumbnailrendered`,({pageNumber:e,pdfPage:t})=>{let n=this._pages[e-1];this.#e.has(n)||t?.cleanup()},Qy),e.l10n||this.l10n.translate(this.container)}get printingAllowed(){return this.#y}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(this.#e)}get pageViewsReady(){return this._pages.every(e=>e?.pdfPage)}clearSelection(){let e=document.getSelection();if(e&&!e.isCollapsed){for(let t=0,n=e.rangeCount;t<n;t++)if(e.getRangeAt(t).intersectsNode(this.viewer)){e.removeAllRanges?.(),e.empty?.();return}}}get renderForms(){return this.#a===zv.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw Error(`Invalid page number.`);this.pdfDocument&&(this._currentPageNumber!==e&&this.clearSelection(),this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#J(),!0;if(!(0<e&&e<=this.pagesCount))return!1;let n=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch(`pagechanging`,{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:n}),t&&this.#J(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=e|0;if(this._pageLabels){let n=this._pageLabels.indexOf(e);n>=0&&(t=n+1)}this._currentPageNumber!==t&&this.clearSelection(),this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale===0?1:this._currentScale}set currentScale(e){if(isNaN(e))throw Error(`Invalid numeric scale.`);this.pdfDocument&&this.#q(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#q(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!B_(e))throw Error(`Invalid pages rotation angle.`);if(!this.pdfDocument||(e%=360,e<0&&(e+=360),this._pagesRotation===e))return;this.clearSelection(),this._pagesRotation=e;let t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&this.#q(this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch(`rotationchanging`,{source:this,pagesRotation:e,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){let e=this;return ky(this,`_layerProperties`,{get annotationEditorUIManager(){return e.#i},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableComment(){return!!e.#o},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}})}#L(e){this.#y=e,this.eventBus.dispatch(`printingallowed`,{source:this,isAllowed:e})}#R(e){let t={annotationEditorMode:this.#r,annotationMode:this.#a,textLayerMode:this.#M};return e?(this.#L(e.has(Cy.PRINT_HIGH_QUALITY)||e.has(Cy.PRINT)),!e.has(Cy.COPY)&&this.#M===Gy.ENABLE&&(t.textLayerMode=Gy.ENABLE_PERMISSIONS),e.has(Cy.MODIFY_CONTENTS)||(t.annotationEditorMode=Iv.DISABLE),!e.has(Cy.MODIFY_ANNOTATIONS)&&!e.has(Cy.FILL_INTERACTIVE_FORMS)&&this.#a===zv.ENABLE_FORMS&&(t.annotationMode=zv.ENABLE),t):(this.#L(!0),t)}async#z(e){if(document.visibilityState===`hidden`||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;let t=Promise.withResolvers(),n=new AbortController;document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&t.resolve()},{signal:AbortSignal.any([e,n.signal])}),await Promise.race([this._onePageRenderedCapability.promise,t.promise]),n.abort()}async getAllText(e=null){let t=[],n=[];for(let r=1,i=this.pdfDocument.numPages;r<=i;++r){if(e?.aborted)return null;n.length=0;let{items:i}=await(await this.pdfDocument.getPage(r)).getTextContent();for(let e of i)e.str&&n.push(e.str),e.hasEOL&&n.push(`
650
+ `);t.push(N_(n.join(``)))}return t.join(`
651
+ `)}#B(e,t){let n=document.getSelection(),{focusNode:r,anchorNode:i}=n;if(i&&r&&n.containsNode(this.#T)){if(this.#w||e===Gy.ENABLE_PERMISSIONS){jy(t);return}this.#w=!0;let{classList:n}=this.viewer;n.add(`copyAll`);let r=new AbortController,i=new AbortController;window.addEventListener(`keydown`,e=>{e.key===`Escape`&&i.abort()},{signal:r.signal}),this.getAllText(i.signal).then(async e=>{e!==null&&await navigator.clipboard.writeText(e)}).catch(e=>{console.warn(`Something goes wrong when extracting the text: ${e.message}`)}).finally(()=>{this.#w=!1,r.abort(),n.remove(`copyAll`)}),jy(t)}}setDocument(e){if(this.pdfDocument&&(this.eventBus.dispatch(`pagesdestroy`,{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#i?.destroy(),this.#i=null,this.#r!==Iv.DISABLE&&(this.#r=Iv.NONE),this.#y=!0),this.pdfDocument=e,!e)return;let t=e.numPages,n=e.getPage(1),r=e.getOptionalContentConfig({intent:`display`}),i=this.#u?e.getPermissions():Promise.resolve(),{eventBus:a,pageColors:o,viewer:s}=this;this.#h=new AbortController;let{signal:c}=this.#h,l={signal:c,...Qy};if(t>Zx.FORCE_SCROLL_MODE_PAGE){console.warn(`Forcing PAGE-scrolling for performance reasons, given the length of the document.`);let e=this._scrollMode=Z.PAGE;a.dispatch(`scrollmodechanged`,{source:this,mode:e})}this._pagesCapability.promise.then(()=>{a.dispatch(`pagesloaded`,{source:this,pagesCount:t})},()=>{}),a.on(`pagerender`,e=>{let t=this._pages[e.pageNumber-1];t&&this.#e.push(t)},l);let u=e=>{e.cssTransform||e.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),a.off(`pagerendered`,u))};a.on(`pagerendered`,u,l),Promise.all([n,i]).then(([n,i])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(n),this._optionalContentConfigPromise=r;let{annotationEditorMode:l,annotationMode:u,textLayerMode:d}=this.#R(i);if(d!==Gy.DISABLE){let e=this.#T=document.createElement(`div`);e.id=`hiddenCopyElement`,e.style.cssText=`position:absolute;top:0;left:0;width:0;height:0;display:none`,s.before(e)}if(l!==Iv.DISABLE){let t=l;e.isPureXfa?console.warn(`Warning: XFA-editing is not implemented.`):Mv(t)?(this.#i=new Lv(this.container,s,this.#N,this.#t,this.#o,this.#A,a,e,o,this.#n,this.#l,this.#d,this.#f,this.#_,this.#c,this.#j),a.dispatch(`annotationeditoruimanager`,{source:this,uiManager:this.#i}),t!==Iv.NONE&&(this.#re(t),this.#i.updateMode(t))):console.error(`Invalid AnnotationEditor mode: ${t}`)}let f=this._scrollMode===Z.PAGE?null:s,p=this.currentScale,m=n.getViewport({scale:p*wy.PDF_TO_CSS_UNITS});s.style.setProperty(`--scale-factor`,m.scale),o?.background&&s.style.setProperty(`--page-bg-color`,o.background),(o?.foreground===`CanvasText`||o?.background===`Canvas`)&&(s.style.setProperty(`--hcm-highlight-filter`,e.filterFactory.addHighlightHCMFilter(`highlight`,`CanvasText`,`Canvas`,`HighlightText`,`Highlight`)),s.style.setProperty(`--hcm-highlight-selected-filter`,e.filterFactory.addHighlightHCMFilter(`highlight_selected`,`CanvasText`,`Canvas`,`HighlightText`,`ButtonText`)));for(let e=1;e<=t;++e){let t=new Wx({container:f,eventBus:a,id:e,scale:p,defaultViewport:m.clone(),optionalContentConfigPromise:r,renderingQueue:this.renderingQueue,textLayerMode:d,annotationMode:u,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,enableSelectionRendering:this.enableSelectionRendering,imagesRightClickMinSize:this.imagesRightClickMinSize,pageColors:o,l10n:this.l10n,layerProperties:this._layerProperties,enableAutoLinking:this.#p,minDurationToUpdateCanvas:this.#g,commentManager:this.#o,abortSignal:this.#m});this._pages.push(t)}this._pages[0]?.setPdfPage(n),this._scrollMode===Z.PAGE?this.#V():this._spreadMode!==Ky.NONE&&this._updateSpreadMode(),a.on(`annotationeditorlayerrendered`,e=>{this.#i&&a.dispatch(`annotationeditormodechanged`,{source:this,mode:this.#r})},{once:!0,signal:c,...Qy}),this.#z(c).then(async()=>{if(e!==this.pdfDocument)return;if(this.findController?.setDocument(e),this._scriptingManager?.setDocument(e),this.#T&&document.addEventListener(`copy`,this.#B.bind(this,d),{signal:c}),e.loadingParams.disableAutoFetch||t>Zx.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let n=t-1;if(n<=0)this._pagesCapability.resolve();else for(let r=2;r<=t;++r){let t=e.getPage(r).then(e=>{let t=this._pages[r-1];t.pdfPage||t.setPdfPage(e),--n===0&&this._pagesCapability.resolve()},e=>{console.error(`Unable to get page ${r} to initialize viewer`,e),--n===0&&this._pagesCapability.resolve()});r%Zx.PAUSE_EAGER_PAGE_INIT===0&&await t}}),a.dispatch(`pagesinit`,{source:this}),e.getMetadata().then(({info:t})=>{e===this.pdfDocument&&t.Language&&(s.lang=t.Language)}),this.defaultRenderingQueue&&this.update()}).catch(e=>{console.error(`Unable to initialize viewer`,e),this._pagesCapability.reject(e)})}onPagesEdited({pagesMapper:e,type:t,hasBeenCut:n,pageNumbers:r}){if(t===`copy`){this.#P=new Map;for(let e of r)this.#P.set(e,this._pages[e-1]);return}if(t===`cancelCopy`){this.#P=null;return}if((t===`cut`||t===`delete`)&&(this.#F=this._pages,this.#I=r),t===`cancelDelete`){if(this.#I=null,!this.#F)return;let e=this._scrollMode===Z.PAGE?null:this.viewer;if(e){this.#i?.startUpdatePages();let t=document.createDocumentFragment();for(let e=0,n=this.#F.length;e<n;e++){let n=this.#F[e];n.updatePageNumber(e+1),t.append(n.div)}e.replaceChildren(t),this.#i?.endUpdatePages()}this._pages=this.#F,this.#F=null;return}if(t===`cleanSavedData`){if(this.#I){if(this.#F){for(let e of this.#I)this.#F[e-1].deleteMe();this.#F=null}this.#I=null}return}this._currentPageNumber=0;let i=this._pages,a=this._pages=[];this.#i?.startUpdatePages();for(let t=1,r=e.pagesNumber;t<=r;t++){let r=e.getPrevPageNumber(t);if(r<0){let e=this.#P.get(-r);n?e.updatePageNumber(t):(this.#i?.clonePage(-r-1,t-1),e=e.clone(t)),a.push(e);continue}let o=i[r-1];a.push(o),o.updatePageNumber(t)}this.#i?.endUpdatePages(),t===`paste`&&(this.#P=null);let o=this._scrollMode===Z.PAGE?null:this.viewer;if(o){let e=document.createDocumentFragment();for(let{div:t}of a)e.append(t);o.replaceChildren(e)}setTimeout(()=>{this.forceRendering()})}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error(`setPageLabels: Invalid page labels.`)):this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=0,this._currentScaleValue=null,this._pageLabels=null,this.#e=new Qx(Xx),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=Z.VERTICAL,this._previousScrollMode=Z.UNKNOWN,this._spreadMode=Ky.NONE,this.#O={previousPageNumber:1,scrollDown:!0,pages:[]},this.#h?.abort(),this.#h=null,this.viewer.textContent=``,this._updateScrollMode(),this.viewer.removeAttribute(`lang`),this.#T?.remove(),this.#T=null,this.#te(),this.#ne()}#V(){if(this._scrollMode!==Z.PAGE)throw Error(`#ensurePageViewVisible: Invalid scrollMode value.`);let e=this._currentPageNumber,t=this.#O,n=this.viewer;if(n.textContent=``,t.pages.length=0,this._spreadMode===Ky.NONE&&!this.isInPresentationMode){let r=this._pages[e-1];n.append(r.div),t.pages.push(r)}else{let r=new Set,i=this._spreadMode-1;i===-1?r.add(e-1):e%2===i?(r.add(e-2),r.add(e-1)):(r.add(e-1),r.add(e));let a=document.createElement(`div`);if(a.className=`spread`,this.isInPresentationMode){let e=document.createElement(`div`);e.className=`dummyPage`,a.append(e)}for(let e of r){let n=this._pages[e];n&&(a.append(n.div),t.pages.push(n))}n.append(a)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){this.pagesCount!==0&&(this.#b&&clearTimeout(this.#b),this.#b=setTimeout(()=>{this.#b=null,this.update()},100),this.update())}#H(e,t=null){let{div:n,id:r}=e;if(this._currentPageNumber!==r&&this._setCurrentPageNumber(r),this._scrollMode===Z.PAGE&&(this.#V(),this.update()),!t&&!this.isInPresentationMode){let e=n.offsetLeft+n.clientLeft,r=e+n.clientWidth,{scrollLeft:i,clientWidth:a}=this.container;(this._scrollMode===Z.HORIZONTAL||e<i||r>i+a)&&(t={left:0,top:0})}A_(n,t),!this._currentScaleValue&&this._location&&(this._location=null)}#U(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}panBy(e,t){let{container:n}=this,r=this.#v,{scrollLeft:i,scrollTop:a}=n,o=(Math.abs(i-r[0])<1?r[0]:i)-e,s=(Math.abs(a-r[1])<1?r[1]:a)-t;r[0]=o,r[1]=s,n.scrollLeft=o,n.scrollTop=s,this.#x=!0}#W(){if(!this.#x)return;let{first:e}=this._getVisiblePages();e&&this._updateLocation(e)}#G(e,t,{noScroll:n=!1,preset:r=!1,drawingDelay:i=-1,origin:a=null,pan:o=null}){if(this._currentScaleValue=t.toString(),this.#U(e)){o&&!n&&this.panBy(o[0],o[1]),r&&this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:t});return}this.clearSelection(),this.viewer.style.setProperty(`--scale-factor`,e*wy.PDF_TO_CSS_UNITS);let s=i>=0&&i<1e3;this.refresh(!0,{scale:e,drawingDelay:s?i:-1}),s&&(this.#k=setTimeout(()=>{this.#k=null,this.refresh()},i));let c=this._currentScale;if(this._currentScale=e,!n){this.#W();let t=this._currentPageNumber,n;this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(t=this._location.pageNumber,n=[null,{name:`XYZ`},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:t,destArray:n,allowNegativeOffset:!0});let r=o?.[0]??0,i=o?.[1]??0;if(Array.isArray(a)){let t=e/c-1,[n,o]=this.containerTopLeft;r-=(a[0]-o)*t,i-=(a[1]-n)*t}(r||i)&&this.panBy(r,i)}this.eventBus.dispatch(`scalechanging`,{source:this,scale:e,presetValue:r?t:void 0}),this.defaultRenderingQueue&&this.update()}get#K(){return this._spreadMode!==Ky.NONE&&this._scrollMode!==Z.HORIZONTAL?2:1}#q(e,t){let n=parseFloat(e);if(n>0)t.preset=!1,this.#G(n,e,t);else{let r=this._pages[this._currentPageNumber-1];if(!r)return;let i=40,a=5;this.isInPresentationMode?(i=a=4,this._spreadMode!==Ky.NONE&&(i*=2)):this.removePageBorders?i=a=0:this._scrollMode===Z.HORIZONTAL&&([i,a]=[a,i]);let o=(this.container.clientWidth-i)/r.width*r.scale/this.#K,s=(this.container.clientHeight-a)/r.height*r.scale;switch(e){case`page-actual`:n=1;break;case`page-width`:n=o;break;case`page-height`:n=s;break;case`page-fit`:n=Math.min(o,s);break;case`auto`:let t=U_(r)?o:Math.min(s,o);n=Math.min(1.25,t);break;default:console.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0,this.#G(n,e,t)}}#J(){let e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#q(this._currentScaleValue,{noScroll:!0}),this.#H(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;let t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:n=!1,ignoreDestinationZoom:r=!1,center:i=null}){if(!this.pdfDocument)return;let a=Number.isInteger(e)&&this._pages[e-1];if(!a){console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(e,!0);return}let o=0,s=0,c=0,l=0,u,d,f=a.rotation%180!=0,p=(f?a.height:a.width)/a.scale/wy.PDF_TO_CSS_UNITS,m=(f?a.width:a.height)/a.scale/wy.PDF_TO_CSS_UNITS,h=0;switch(t[1].name){case`XYZ`:o=t[2],s=t[3],h=t[4],o=o===null?0:o,s=s===null?m:s;break;case`Fit`:case`FitB`:h=`page-fit`;break;case`FitH`:case`FitBH`:s=t[2],h=`page-width`,s===null&&this._location?(o=this._location.left,s=this._location.top):(typeof s!=`number`||s<0)&&(s=m);break;case`FitV`:case`FitBV`:o=t[2],c=p,l=m,h=`page-height`;break;case`FitR`:o=t[2],s=t[3],c=t[4]-o,l=t[5]-s;let e=40,n=5;this.removePageBorders&&(e=n=0),u=(this.container.clientWidth-e)/c/wy.PDF_TO_CSS_UNITS,d=(this.container.clientHeight-n)/l/wy.PDF_TO_CSS_UNITS,h=Math.min(Math.abs(u),Math.abs(d));break;default:console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}if(r||(h&&h!==this._currentScale?this.currentScaleValue=h:this._currentScale===0&&(this.currentScaleValue=`auto`)),h===`page-fit`&&!t[4]){this.#H(a);return}let g=[a.viewport.convertToViewportPoint(o,s),a.viewport.convertToViewportPoint(o+c,s+l)],_=Math.min(g[0][0],g[1][0]),v=Math.min(g[0][1],g[1][1]);i?((i===`both`||i===`vertical`)&&(v-=(this.container.clientHeight-Math.abs(g[1][1]-g[0][1]))/2),(i===`both`||i===`horizontal`)&&(_-=(this.container.clientWidth-Math.abs(g[1][0]-g[0][0]))/2)):n||(_=Math.max(_,0),v=Math.max(v,0)),this.#H(a,{left:_,top:v})}_updateLocation(e){this.#x=!1;let t=this._currentScale,n=this._currentScaleValue,r=parseFloat(n)===t?Math.round(t*1e4)/100:n,i=e.id,a=this._pages[i-1],o=this.container,[s,c]=a.getPagePoint(o.scrollLeft-e.x,o.scrollTop-e.y),l=`#page=${i}`;this.isInPresentationMode||(l+=`&zoom=${r},${Math.round(s)},${Math.round(c)}`),this._location={pageNumber:i,scale:r,top:c,left:s,rotation:this._pagesRotation,pdfOpenParams:l}}update(){let e=this._getVisiblePages(),t=e.views,n=t.length;if(n===0)return;let r=Math.max(Xx,2*n+1);this.#e.resize(r,e.ids);for(let{view:e,visibleArea:n}of t)e.updateVisibleArea(n);for(let t of this.#e)e.ids.has(t.id)||t.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(e);let i=this._spreadMode===Ky.NONE&&(this._scrollMode===Z.PAGE||this._scrollMode===Z.VERTICAL),a=this._currentPageNumber,o=!1;for(let e of t){if(e.percent<100)break;if(e.id===a&&i){o=!0;break}}this._setCurrentPageNumber(o?this._currentPageNumber:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch(`updateviewarea`,{source:this,location:this._location})}#Y(){let e=this._getVisiblePages(),t=[],{ids:n,views:r}=e;for(let e of r){let{view:r}=e;r.hasEditableAnnotations()?t.push(e):n.delete(r.id)}return t.length===0?null:(this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:n}),n)}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction===`rtl`}get isInPresentationMode(){return this.presentationModeState===Wy.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===Wy.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){let e=this._scrollMode===Z.PAGE?this.#O.pages:this._pages,t=this._scrollMode===Z.HORIZONTAL,n=t&&this._isContainerRtl;return z_({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:n})}cleanup(){for(let e of this._pages)e.renderingState!==$.FINISHED&&e.reset()}_cancelRendering(){for(let e of this._pages)e.cancelRendering()}async#X(e){if(e.pdfPage)return e.pdfPage;try{let t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),t}catch(e){return console.error(`Unable to get page for page view`,e),null}}#Z(e){if(e.first?.id===1)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case Z.PAGE:return this.#O.scrollDown;case Z.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){let t=e||this._getVisiblePages(),n=this.#Z(t),r=this._spreadMode!==Ky.NONE&&this._scrollMode!==Z.HORIZONTAL,i=this.#k!==null||this.#b!==null&&t.views.some(e=>e.detailView?.renderingCancelled),a=this.renderingQueue.getHighestPriority(t,this._pages,n,r,i);return a?(this.#X(a).then(()=>{this.renderingQueue.renderView(a)}),!0):!1}get hasEqualPageSizes(){let e=this._pages[0];for(let t=1,n=this._pages.length;t<n;++t){let n=this._pages[t];if(n.width!==e.width||n.height!==e.height)return!1}return!0}getPagesOverview(){let e;return this._pages.map(t=>{let n=t.pdfPage.getViewport({scale:1}),r=U_(n);if(e===void 0)e=r;else if(this.enablePrintAutoRotate&&r!==e)return{width:n.height,height:n.width,rotation:(n.rotation-90)%360};return{width:n.width,height:n.height,rotation:n.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error(`optionalContentConfigPromise: Not initialized yet.`),this.pdfDocument.getOptionalContentConfig({intent:`display`})):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch(`optionalcontentconfigchanged`,{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!V_(e))throw Error(`Invalid scroll mode: ${e}`);this.pagesCount>Zx.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this.clearSelection(),this._scrollMode=e,this.eventBus.dispatch(`scrollmodechanged`,{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){let t=this._scrollMode,n=this.viewer;n.classList.toggle(`scrollHorizontal`,t===Z.HORIZONTAL),n.classList.toggle(`scrollWrapped`,t===Z.WRAPPED),this.pdfDocument&&e&&(t===Z.PAGE?this.#V():this._previousScrollMode===Z.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#q(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!H_(e))throw Error(`Invalid spread mode: ${e}`);this.clearSelection(),this._spreadMode=e,this.eventBus.dispatch(`spreadmodechanged`,{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;let t=this.viewer,n=this._pages;if(this._scrollMode===Z.PAGE)this.#V();else if(t.textContent=``,this._spreadMode===Ky.NONE)for(let e of this._pages)t.append(e.div);else{let e=this._spreadMode-1,r=null;for(let i=0,a=n.length;i<a;++i)r===null?(r=document.createElement(`div`),r.className=`spread`,t.append(r)):i%2===e&&(r=r.cloneNode(!1),t.append(r)),r.append(n[i].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#q(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}#Q(e,t=!1){switch(this._scrollMode){case Z.WRAPPED:{let{views:n}=this._getVisiblePages(),r=new Map;for(let{id:e,y:t,percent:i,widthPercent:a}of n)i===0||a<100||r.getOrInsertComputed(t,ly).push(e);for(let n of r.values()){let r=n.indexOf(e);if(r===-1)continue;let i=n.length;if(i===1)break;if(t)for(let t=r-1,i=0;t>=0;t--){let r=n[t],i=n[t+1]-1;if(r<i)return e-i}else for(let t=r+1;t<i;t++){let r=n[t],i=n[t-1]+1;if(r>i)return i-e}if(t){let t=n[0];if(t<e)return e-t+1}else{let t=n[i-1];if(t>e)return t-e+1}break}break}case Z.HORIZONTAL:break;case Z.PAGE:case Z.VERTICAL:{if(this._spreadMode===Ky.NONE)break;let n=this._spreadMode-1;if(t&&e%2!==n||!t&&e%2===n)break;let{views:r}=this._getVisiblePages(),i=t?e-1:e+1;for(let{id:e,percent:t,widthPercent:n}of r)if(e===i){if(t>0&&n===100)return 2;break}break}}return 1}nextPage(){let e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;let n=this.#Q(e,!1)||1;return this.currentPageNumber=Math.min(e+n,t),!0}previousPage(){let e=this._currentPageNumber;if(e<=1)return!1;let t=this.#Q(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}updateScale({drawingDelay:e,scaleFactor:t=null,steps:n=null,origin:r,pan:i=null}){if(n===null&&t===null)throw Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let a=this._currentScale;if(t>0&&t!==1)a=Math.round(a*t*100)/100;else if(n){let e=n>0?1.1:1/1.1,t=n>0?Math.ceil:Math.floor;n=Math.abs(n);do a=t((a*e).toFixed(2)*10)/10;while(--n>0)}a=py(a,.1,25),this.#q(a,{noScroll:!1,drawingDelay:e,origin:r,pan:i})}increaseScale(e={}){this.updateScale({...e,steps:e.steps??1})}decreaseScale(e={}){this.updateScale({...e,steps:-(e.steps??1)})}#$(e=this.container.clientHeight){e!==this.#E&&(this.#E=e,Jy.setProperty(`--viewer-container-height`,`${e}px`))}#ee(e){for(let t of e)if(t.target===this.container){this.#$(Math.floor(t.borderBoxSize[0].blockSize)),this.#s=null;break}}get containerTopLeft(){return this.#s||=[this.container.offsetTop,this.container.offsetLeft]}#te(){this.#k!==null&&(clearTimeout(this.#k),this.#k=null),this.#b!==null&&(clearTimeout(this.#b),this.#b=null)}#ne(){this.#S?.abort(),this.#S=null,this.#C!==null&&(clearTimeout(this.#C),this.#C=null)}#re(e){switch(e){case Iv.STAMP:this.#_?.loadModel(`altText`);break;case Iv.SIGNATURE:this.#A?.loadSignatures()}}get annotationEditorMode(){return this.#i?this.#r:Iv.DISABLE}set annotationEditorMode({mode:e,editId:t=null,isFromKeyboard:n=!1,mustEnterInEditMode:r=!1,editComment:i=!1}){if(!this.#i)throw Error(`The AnnotationEditor is not enabled.`);if(this.#r===e)return;if(!Mv(e))throw Error(`Invalid AnnotationEditor mode: ${e}`);if(!this.pdfDocument)return;this.#re(e);let{eventBus:a,pdfDocument:o}=this,s=async()=>{this.#ne(),this.#r=e,await this.#i.updateMode(e,t,!0,n,r,i),e===this.#r&&o===this.pdfDocument&&a.dispatch(`annotationeditormodechanged`,{source:this,mode:e})};if(e===Iv.NONE||this.#r===Iv.NONE){let t=e!==Iv.NONE;t||this.pdfDocument.annotationStorage.resetModifiedIds(),this.cleanup();for(let e of this._pages)e.toggleEditingMode(t);let n=this.#Y();if(t&&n){this.#ne(),this.#S=new AbortController;let e=AbortSignal.any([this.#h.signal,this.#S.signal]);a.on(`pagerendered`,({pageNumber:e})=>{n.delete(e),n.size===0&&(this.#C=setTimeout(s,0))},{signal:e,...Qy});return}}s()}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(let e of this._pages)e.update(t);this.#te(),e||this.update()}}},eS=class extends $x{_resetView(){super._resetView(),this._scrollMode=Z.PAGE,this._spreadMode=Ky.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}},globalThis.pdfjsViewer={AnnotationLayerBuilder:gb,DownloadManager:vb,EventBus:bb,FindState:$y,GenericL10n:gx,LinkTarget:pb,parseQueryString:M_,PDFFindController:db,PDFHistory:bx,PDFLinkService:mb,PDFPageView:Wx,PDFScriptingManager:qx,PDFSinglePageViewer:eS,PDFViewer:$x,ProgressBar:Yy,RenderingStates:$,ScrollMode:Z,SimpleLinkService:hb,SpreadMode:Ky,StructTreeLayerBuilder:Lx,TextLayerBuilder:Bx,XfaLayerBuilder:Vx}})),nS=c((()=>{}));async function rS(){let e=await Promise.resolve().then(()=>(T_(),hd)),t=await Promise.resolve().then(()=>(tS(),E_));return await Promise.resolve().then(()=>d(nS(),1)),{...e,...t}}function iS(e){return e===`page-fit`||e===`page-width`?e:Number.isFinite(e)?Math.min(5,Math.max(.25,e)):1}function aS(e,t){return Math.min(Math.max(1,t),Math.max(1,Math.trunc(e)||1))}function oS(e,t){let n=t||(typeof File<`u`&&e instanceof File?e.name:``)||(typeof e==`string`?e.split(/[?#]/)[0].split(`/`).pop():``)||`document.pdf`,r;try{r=decodeURIComponent(n)}catch{r=n}let i=r.replace(/[\\/\x00-\x1f]/g,`_`);return/\.pdf$/i.test(i)?i:`${i}.pdf`}async function sS(e){if(typeof e==`string`)return{url:e};let t=e instanceof Blob?await e.arrayBuffer():e;return{data:t instanceof Uint8Array?t.slice():new Uint8Array(t.slice(0))}}var cS=e=>ht(e,z(`div`,{class:`pdfViewer`})),lS=(e,t,n)=>ht(e,z(`a`,{href:t,download:n})),uS=(e,t)=>ht(e,z(`iframe`,{title:t,style:`position:fixed;left:-10000px;top:0;width:800px;height:600px;border:0`})),dS=e=>ht(e,z(`style`,{children:`@page{margin:0}body{margin:0}canvas{display:block;width:100%;height:auto;break-after:page}canvas:last-child{break-after:auto}`})),fS=(e,t,n)=>ht(e,z(`canvas`,{width:t,height:n}));async function pS(e,t,n,r=`PDF print document`){n.throwIfAborted();let i=uS(t,r),a=[],o,s=!1;t.body.append(i);let c=()=>{if(s)return;s=!0,n.removeEventListener(`abort`,c);let e=i.contentDocument;a.forEach(e=>{e.width=0,e.height=0,gt(e)}),o&&gt(o),e?.body.replaceChildren(),gt(i)};n.addEventListener(`abort`,c,{once:!0});let l,u=()=>l?.cancel();n.addEventListener(`abort`,u,{once:!0});try{let t=i.contentDocument;if(!t)throw Error(`Unable to prepare the print document`);o=dS(t),t.head.append(o);for(let r=1;r<=e.numPages;r++){n.throwIfAborted();let i=await e.getPage(r);n.throwIfAborted();let o=i.getViewport({scale:1}),s=Math.min(2,Math.sqrt(16e6/(o.width*o.height))),c=i.getViewport({scale:s}),u=fS(t,Math.ceil(c.width),Math.ceil(c.height));a.push(u),t.body.append(u),l=i.render({canvas:u,viewport:c,intent:`print`}),await l.promise}n.throwIfAborted(),i.contentWindow.addEventListener(`afterprint`,c,{once:!0}),i.contentWindow.focus(),i.contentWindow.print()}catch(e){throw c(),e}finally{n.removeEventListener(`abort`,u)}return c}var mS=class{state;listeners=new Set;container;content;runtime;viewer;bus;links;initializing;initializationFailed=!1;lifetime=new AbortController;generation=0;loadAbort;disposed=!1;task;document;worker;port;printAbort;printCleanup;pendingPage=1;lastSource=null;lastFileName;downloadUrls=new Set;options;printTitle=`PDF print document`;setPrintTitle(e){this.printTitle=e}constructor(e){this.options=e,this.state={status:`empty`,fileName:oS(e.source,e.fileName),page:0,pageCount:0,zoom:iS(e.initialZoom??`page-width`),scale:1,rotation:0,query:``,match:0,matchCount:0,searching:!1,printing:!1,error:null}}get snapshot(){return this.state}get canRetry(){return this.lastSource!==null}retry(){return this.initializationFailed&&this.container&&!this.disposed&&(this.lifetime.abort(),this.lifetime=new AbortController,this.content&&gt(this.content),this.content=void 0,this.viewer=void 0,this.links=void 0,this.bus=void 0,this.startInitialization(this.container)),this.load(this.lastSource,this.lastFileName)}setCallbacks(e){let{onLoad:t,onError:n,onPageChange:r,onZoomChange:i}=e;this.options={...this.options,onLoad:t,onError:n,onPageChange:r,onZoomChange:i}}subscribe(e){return this.listeners.add(e),e(this.state),()=>{this.listeners.delete(e)}}update(e){this.disposed||(this.state=Object.freeze({...this.state,...e}),this.listeners.forEach(e=>e(this.state)))}report(e){if(this.disposed)return;let t=e instanceof Error?e:Error(String(e));this.update({error:t}),this.options.onError?.(t)}attach(e){if(this.disposed)return Promise.reject(Error(`PDF viewer is destroyed`));if(this.container)throw Error(`PDF viewer is already attached`);return this.container=e,this.startInitialization(e),this.initializing}startInitialization(e){this.initializationFailed=!1,this.initializing=this.initialize(e),this.initializing.catch(e=>{this.initializationFailed=!0,!this.disposed&&this.state.status!==`loading`&&(this.update({status:`error`}),this.report(e))})}async initialize(e){let t=await rS();if(this.disposed)return;this.runtime=t;let n=this.bus=new t.EventBus;this.links=new t.PDFLinkService({eventBus:n,externalLinkTarget:2,externalLinkRel:`noopener noreferrer nofollow`});let r=new t.PDFFindController({eventBus:n,linkService:this.links}),i=this.content=cS(e.ownerDocument);e.append(i);let a={container:e,viewer:i,eventBus:n,linkService:this.links,findController:r,l10n:this.options.l10n,annotationMode:t.AnnotationMode.ENABLE,abortSignal:this.lifetime.signal};this.viewer=new t.PDFViewer(a),this.links.setViewer(this.viewer),n.on(`pagesinit`,()=>{this.document&&this.viewer?.pdfDocument===this.document&&(this.viewer.currentScaleValue=String(this.state.zoom),this.viewer.currentPageNumber=aS(this.pendingPage,this.document.numPages),this.update({status:`ready`,pageCount:this.document.numPages,page:this.viewer.currentPageNumber,scale:this.viewer.currentScale}),this.options.onLoad?.({pageCount:this.document.numPages,fileName:this.state.fileName}))}),n.on(`pagechanging`,({pageNumber:e})=>{!this.disposed&&this.document&&(this.update({page:e}),this.options.onPageChange?.(e))}),n.on(`scalechanging`,({scale:e,presetValue:t})=>{if(this.disposed||!this.document)return;let n=t===`page-width`||t===`page-fit`?t:e;this.update({zoom:n,scale:e}),this.options.onZoomChange?.(n,e)}),n.on(`updatefindmatchescount`,({matchesCount:e})=>{this.state.status===`ready`&&this.state.query&&this.update({match:e.current,matchCount:e.total})}),n.on(`updatefindcontrolstate`,({state:e,matchesCount:n,rawQuery:r})=>{this.state.status!==`ready`||!this.state.query||r!==void 0&&r!==this.state.query||this.update({searching:e===t.FindState.PENDING,match:n.current,matchCount:n.total})}),n.on(`pagerendered`,({error:e,source:t,pageNumber:n})=>{e&&!this.disposed&&this.document&&(!t||n!==void 0&&this.viewer?.getPageView(n-1)===t)&&this.report(e)});let o=new ResizeObserver(()=>{this.state.status===`ready`&&typeof this.state.zoom==`string`&&(this.viewer.currentScaleValue=this.state.zoom)});o.observe(e),this.lifetime.signal.addEventListener(`abort`,()=>o.disconnect(),{once:!0})}async load(e,t){if(this.disposed)return;this.lastSource=e,this.lastFileName=t;let n=++this.generation;if(this.releaseDocument(),this.disposed||n!==this.generation)return;let r=new AbortController;if(e!==null&&(this.loadAbort=r),this.pendingPage=aS(this.options.initialPage??1,2**53-1),this.update({status:e===null?`empty`:`loading`,fileName:oS(e,t),page:0,pageCount:0,error:null,rotation:0,query:``,match:0,matchCount:0,searching:!1,printing:!1}),e===null||this.disposed||n!==this.generation)return;let i=new Promise((e,t)=>{r.signal.addEventListener(`abort`,()=>t(new DOMException(`PDF loading canceled`,`AbortError`)),{once:!0})}),a=e=>Promise.race([e,i]);try{if(!this.initializing)throw Error(`Attach the PDF viewer before loading a document`);let t=await a(sS(e));if(await a(this.initializing),this.disposed||n!==this.generation)return;if(!this.options.workerSrc)throw Error(`PDF viewer requires a matching PDF.js workerSrc`);this.port=new Worker(this.options.workerSrc,{type:`module`});let i=e=>{e.preventDefault(),this.failLoad(n,Error(`PDF worker failed to load or stopped unexpectedly. Check the worker URL and browser permissions.`),!0)};this.port.addEventListener(`error`,i,{signal:r.signal}),this.port.addEventListener(`messageerror`,i,{signal:r.signal}),this.worker=this.runtime.PDFWorker.create({port:this.port});let o=await a((this.task=this.runtime.getDocument({...this.options.documentOptions,...t,worker:this.worker})).promise);if(this.disposed||n!==this.generation)return;this.document=o,this.links.setDocument(o),this.viewer.setDocument(o);let s=this.viewer.pagesPromise.catch(e=>this.failLoad(n,e));await a(Promise.race([this.viewer.firstPagePromise,s]))}catch(e){this.failLoad(n,e)}}failLoad(e,t,n=!1){this.disposed||e!==this.generation||this.state.status===`error`||(this.releaseDocument(n),!(this.disposed||e!==this.generation)&&(this.update({status:`error`,pageCount:0,page:0,query:``,match:0,matchCount:0,searching:!1}),this.report(t)))}goToPage(e){this.state.status===`ready`&&(this.viewer.currentPageNumber=aS(e,this.state.pageCount))}setZoom(e){this.state.status===`ready`&&(this.viewer.currentScaleValue=String(iS(e)))}rotate(){if(this.state.status!==`ready`)return;let e=(this.state.rotation+90)%360;this.viewer.pagesRotation=e,this.update({rotation:e})}search(e,t=!1,n=!1){this.state.status===`ready`&&(this.update({query:e,searching:!!e,...n?{}:{match:0,matchCount:0}}),this.bus.dispatch(`find`,{source:this,type:n?`again`:``,query:e,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:t,matchDiacritics:!1}))}clearSearch(){this.bus?.dispatch(`findbarclose`,{source:this}),this.update({query:``,match:0,matchCount:0,searching:!1})}async download(){let e=this.document;if(e&&this.container)try{let t=await e.getData();if(this.disposed||e!==this.document)return;let n=URL.createObjectURL(new Blob([new Uint8Array(t)],{type:`application/pdf`}));this.downloadUrls.add(n);let r=lS(this.container.ownerDocument,n,this.state.fileName);try{r.click()}finally{gt(r)}setTimeout(()=>{URL.revokeObjectURL(n),this.downloadUrls.delete(n)},1e3)}catch(t){!this.disposed&&e===this.document&&this.report(t)}}async print(){let e=this.document;if(!e||!this.container||this.state.printing)return;this.printCleanup?.(),this.printAbort?.abort();let t=this.printAbort=new AbortController;this.update({printing:!0});try{let n=await pS(e,this.container.ownerDocument,t.signal,this.printTitle);t.signal.aborted||t!==this.printAbort?n():this.printCleanup=n}catch(e){t.signal.aborted||this.report(e)}finally{t===this.printAbort&&this.update({printing:!1})}}cancelPrint(){this.printAbort?.abort(),this.printAbort=void 0,this.printCleanup?.(),this.printCleanup=void 0,this.state.printing&&this.update({printing:!1})}releaseDocument(e=!1){let t=this.task,n=this.worker,r=this.port,i=this.loadAbort;this.task=void 0,this.worker=void 0,this.port=void 0,this.loadAbort=void 0,this.document=void 0,i?.abort(),this.viewer?.setDocument(null),this.links?.setDocument(null);let a=()=>{n?.destroy(),r?.terminate()};if(t){let n=t.destroy().catch(()=>{});e?a():n.finally(a)}else a();this.cancelPrint()}destroy(){this.disposed||(this.disposed=!0,this.generation++,this.releaseDocument(),this.lastSource=null,this.lifetime.abort(),this.downloadUrls.forEach(e=>URL.revokeObjectURL(e)),this.downloadUrls.clear(),this.listeners.clear(),this.content&&gt(this.content),this.content=void 0,this.container?.replaceChildren(),this.bus=void 0,this.viewer=void 0,this.links=void 0,this.container=void 0)}},hS={viewer:`PDF document`,pages:`Document pages`,toolbar:`PDF tools`,first:`First page`,last:`Last page`,open:`Open PDF`,previous:`Previous page`,next:`Next page`,zoomPercentage:`{percent}%`,page:`Page`,of:`of`,zoom:`Zoom`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,fitWidth:`Fit width`,fitPage:`Fit page`,rotate:`Rotate clockwise`,search:`Find in document`,previousMatch:`Previous match`,nextMatch:`Next match`,closeSearch:`Close search`,matches:`matches`,noMatches:`No matches`,searching:`Searching…`,download:`Download PDF`,print:`Print PDF`,printing:`Preparing print…`,loading:`Loading PDF…`,empty:`Open a PDF to get started`,emptyHint:`View, search, print and download your document.`,errorDescription:`Check the document and try again.`,operationError:`Unable to complete the PDF operation. Try again.`,printDocument:`PDF print document`,pageCount:`{of} {pages}`,pageSummary:`{page} {of} {pages}`,matchSummary:`{match} / {total} {matches}`,error:`Unable to display this PDF`,retry:`Retry`,more:`More PDF tools`,cancelPrint:`Cancel printing`};function gS(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function _S(e){return{...hS,...Object.fromEntries(Object.entries(e??{}).filter(([,e])=>typeof e==`string`))}}function vS(e){return e===!1?{tools:[]}:Array.isArray(e)?{tools:e}:e??{}}function yS(e,t){let n=vS(e);return t===`navigation`&&(!n.boundaryButtons||n.buttons?.first===!1&&n.buttons?.last===!1)&&n.buttons?.previous===!1&&n.buttons?.next===!1&&n.showPageInput===!1&&n.showPageCount===!1||t===`zoom`&&n.buttons?.zoomOut===!1&&n.buttons?.zoomIn===!1&&n.showZoomSelect===!1?!1:(!n.tools||n.tools.includes(t))&&(![`open`,`search`,`rotate`,`download`,`print`].includes(t)||n.buttons?.[t]!==!1)}var bS={previous:br,next:xr,document:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M96 0C60.7 0 32 28.7 32 64l0 384c0 35.3 28.7 64 64 64l80 0 0-112c0-35.3 28.7-64 64-64l176 0 0-165.5c0-17-6.7-33.3-18.7-45.3L290.7 18.7C278.7 6.7 262.5 0 245.5 0L96 0zM357.5 176L264 176c-13.3 0-24-10.7-24-24L240 58.5 357.5 176zM240 380c-11 0-20 9-20 20l0 128c0 11 9 20 20 20s20-9 20-20l0-28 12 0c33.1 0 60-26.9 60-60s-26.9-60-60-60l-32 0zm32 80l-12 0 0-40 12 0c11 0 20 9 20 20s-9 20-20 20zm96-80c-11 0-20 9-20 20l0 128c0 11 9 20 20 20l32 0c28.7 0 52-23.3 52-52l0-64c0-28.7-23.3-52-52-52l-32 0zm20 128l0-88 12 0c6.6 0 12 5.4 12 12l0 64c0 6.6-5.4 12-12 12l-12 0zm88-108l0 128c0 11 9 20 20 20s20-9 20-20l0-44 28 0c11 0 20-9 20-20s-9-20-20-20l-28 0 0-24 28 0c11 0 20-9 20-20s-9-20-20-20l-48 0c-11 0-20 9-20 20z"/></svg>`,open:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M56 225.6L32.4 296.2 32.4 96c0-35.3 28.7-64 64-64l138.7 0c13.8 0 27.3 4.5 38.4 12.8l38.4 28.8c5.5 4.2 12.3 6.4 19.2 6.4l117.3 0c35.3 0 64 28.7 64 64l0 16-365.4 0c-41.3 0-78 26.4-91.1 65.6zM477.8 448L99 448c-32.8 0-55.9-32.1-45.5-63.2l48-144C108 221.2 126.4 208 147 208l378.8 0c32.8 0 55.9 32.1 45.5 63.2l-48 144c-6.5 19.6-24.9 32.8-45.5 32.8z"/></svg>`,search:Gu,minus:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32z"/></svg>`,plus:Wu,rotate:Pa,download:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M256 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 210.7-41.4-41.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 242.7 256 32zM64 320c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-46.9 0-56.6 56.6c-31.2 31.2-81.9 31.2-113.1 0L110.9 320 64 320zm304 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"/></svg>`,print:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M64 64C64 28.7 92.7 0 128 0L341.5 0c17 0 33.3 6.7 45.3 18.7l42.5 42.5c12 12 18.7 28.3 18.7 45.3l0 37.5-384 0 0-80zM0 256c0-35.3 28.7-64 64-64l384 0c35.3 0 64 28.7 64 64l0 96c0 17.7-14.3 32-32 32l-32 0 0 64c0 35.3-28.7 64-64 64l-256 0c-35.3 0-64-28.7-64-64l0-64-32 0c-17.7 0-32-14.3-32-32l0-96zM128 416l0 32 256 0 0-96-256 0 0 64zM456 272a24 24 0 1 0 -48 0 24 24 0 1 0 48 0z"/></svg>`,close:Wr,up:Ia,down:Bn,more:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M64 144a56 56 0 1 1 0-112 56 56 0 1 1 0 112zm0 224c30.9 0 56 25.1 56 56s-25.1 56-56 56-56-25.1-56-56 25.1-56 56-56zm56-112c0 30.9-25.1 56-56 56s-56-25.1-56-56 25.1-56 56-56 56 25.1 56 56z"/></svg>`};function xS(e){let{controller:t,state:n}=e,r=_S(e.text),i=vS(e.config),a=n.status===`ready`,o=e=>i.buttons?.[e]!==!1,s=e=>{let t=i.buttons?.[e];return t===!1?{}:t??{}},c=t=>yS(e.config,t),[l,u]=I(!1),d=R(null),f=R(null),[p,m]=I(String(n.page||``)),h=Number.isFinite(i.zoomStep)&&i.zoomStep>1?i.zoomStep:1.25,g=[...new Set((i.zoomLevels??[`page-width`,`page-fit`,.5,.75,1,1.25,1.5,2,3,5]).filter(e=>e===`page-width`||e===`page-fit`||typeof e==`number`&&Number.isFinite(e)&&e>=.25&&e<=5))];g.includes(n.zoom)||g.push(n.zoom),L(()=>{m(String(n.page||``))},[n.page,t]),L(()=>{u(!1)},[e.config,a,t]),L(()=>{if(!l)return;f.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus();let e=d.current,t=new ResizeObserver(()=>{e&&!e.getClientRects().length&&u(!1)});return e&&t.observe(e),()=>t.disconnect()},[l]);let _=()=>{u(!1),d.current?.focus({preventScroll:!0})},v=()=>{p.trim()&&Number.isFinite(Number(p))&&t.goToPage(Number(p)),m(String(t.snapshot.page))};return[`open`,`navigation`,`zoom`,`search`,`rotate`,`download`,`print`].some(c)?z(F,{children:[z(Ki,{label:r.toolbar,className:`rv-pdf-viewer__toolbar rv-toolbar--surface ${i.className??``}`,children:[c(`open`)&&z(qi,{children:z(B,{variant:`ghost`,size:`compact`,...s(`open`),title:s(`open`).title??r.open,"aria-label":r.open,onClick:()=>e.onOpen(),children:[z(Kt,{svg:bS.open}),z(`span`,{class:`rv-pdf-viewer__open-label`,children:r.open})]})}),c(`navigation`)&&(i.boundaryButtons||o(`previous`)||o(`next`)||i.showPageInput!==!1||i.showPageCount!==!1)&&z(qi,{label:r.page,children:z(ia,{page:n.page-1,pageCount:n.pageCount,onChange:e=>t.goToPage(e+1),label:r.page,previousLabel:r.previous,nextLabel:r.next,firstLabel:r.first,lastLabel:r.last,variant:`icons`,disabled:!a,boundaryButtons:i.boundaryButtons,buttons:{first:i.buttons?.first,previous:i.buttons?.previous,next:i.buttons?.next,last:i.buttons?.last},children:[i.showPageInput!==!1&&z(cr,{class:`rv-pdf-viewer__page-input`,type:`number`,min:1,max:n.pageCount||1,disabled:!a,"aria-label":r.page,value:p,onInput:e=>m(e.currentTarget.value),onChange:v,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),v()),e.key===`Escape`&&(e.preventDefault(),m(String(n.page)))}}),i.showPageCount!==!1&&z(`span`,{class:`rv-pdf-viewer__page-count`,children:gS(r.pageCount,{of:r.of,pages:n.pageCount})})]})}),c(`zoom`)&&(o(`zoomOut`)||o(`zoomIn`)||i.showZoomSelect!==!1)&&z(qi,{label:r.zoom,children:[o(`zoomOut`)&&z(Ei,{...s(`zoomOut`),label:r.zoomOut,icon:bS.minus,size:`compact`,disabled:!a||n.scale<=.25||!!s(`zoomOut`).disabled,onClick:()=>t.setZoom(n.scale/h)}),i.showZoomSelect!==!1&&z(`div`,{class:`rv-pdf-viewer__zoom-select`,children:z(Gn,{className:`rv-select`,config:{ariaLabel:r.zoom,portalTarget:e.appendTo},disabled:!a,value:String(n.zoom),source:g.map(e=>({value:String(e),label:e===`page-width`?r.fitWidth:e===`page-fit`?r.fitPage:gS(r.zoomPercentage,{percent:Math.round(e*100)})})),onChange:e=>{let n=String(e);t.setZoom(n===`page-fit`||n===`page-width`?n:Number(n))}})}),o(`zoomIn`)&&z(Ei,{...s(`zoomIn`),label:r.zoomIn,icon:bS.plus,size:`compact`,disabled:!a||n.scale>=5||!!s(`zoomIn`).disabled,onClick:()=>t.setZoom(n.scale*h)})]}),c(`search`)&&z(qi,{children:o(`search`)&&z(Ei,{...s(`search`),label:r.search,icon:bS.search,size:`compact`,disabled:!a||!!s(`search`).disabled,"aria-expanded":e.searchOpen,"aria-controls":e.searchId,"aria-keyshortcuts":`Control+f Meta+f`,onClick:t=>e.onToggleSearch(t.currentTarget)})}),(c(`rotate`)||c(`download`)||c(`print`))&&z(qi,{className:`rv-pdf-viewer__actions rv-pdf-viewer__desktop-actions`,children:[c(`rotate`)&&z(Ei,{...s(`rotate`),label:r.rotate,icon:bS.rotate,size:`compact`,disabled:!a||!!s(`rotate`).disabled,onClick:()=>t.rotate()}),c(`download`)&&z(Ei,{...s(`download`),label:r.download,icon:bS.download,size:`compact`,disabled:!a||!!s(`download`).disabled,onClick:()=>void t.download()}),c(`print`)&&z(Ei,{...s(`print`),label:r.print,icon:bS.print,size:`compact`,disabled:!a||n.printing||!!s(`print`).disabled,busy:n.printing,onClick:()=>void t.print()})]}),(c(`rotate`)||c(`download`)||c(`print`))&&z(qi,{className:`rv-pdf-viewer__more`,children:z(B,{ref:d,variant:`ghost`,size:`compact`,className:`rv-btn-icon`,title:r.more,"aria-label":r.more,"aria-haspopup":`menu`,"aria-expanded":l,disabled:!a,onClick:()=>u(!l),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),u(!0))},children:z(Kt,{svg:bS.more})})})]}),z(Ql,{open:l,anchor:d.current,appendTo:e.appendTo,onClose:()=>u(!1),role:`menu`,label:r.more,children:z(`div`,{ref:f,class:`rv-pdf-viewer__menu`,children:[c(`rotate`)&&z(ea,{className:s(`rotate`).className,disabled:!!s(`rotate`).disabled,onClick:()=>{t.rotate(),_()},children:[z(Kt,{svg:bS.rotate}),r.rotate]}),c(`download`)&&z(ea,{className:s(`download`).className,disabled:!!s(`download`).disabled,onClick:()=>{t.download(),_()},children:[z(Kt,{svg:bS.download}),r.download]}),c(`print`)&&z(ea,{className:s(`print`).className,disabled:n.printing||!!s(`print`).disabled,onClick:()=>{t.print(),_()},children:[z(Kt,{svg:bS.print}),r.print]})]})})]}):null}function SS({id:e,controller:t,state:n,text:r,onClose:i,inputRef:a}){let o=n.status===`ready`;return L(()=>{a.current?.focus()},[]),z(`div`,{id:e,class:`rv-pdf-viewer__search`,role:`search`,"aria-label":r.search,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i())},children:[z(nc,{icon:z(Kt,{svg:bS.search}),inputRef:a,"aria-label":r.search,placeholder:r.search,value:n.query,disabled:!o,onValueChange:e=>t.search(e),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t.search(n.query,e.shiftKey,!0))}}),z(`div`,{class:`rv-pdf-viewer__find-controls`,children:[z(`span`,{role:`status`,class:`rv-pdf-viewer__matches`,children:n.query?n.searching?r.searching:n.matchCount?gS(r.matchSummary,{match:n.match,total:n.matchCount,matches:r.matches}):r.noMatches:``}),z(Ei,{label:r.previousMatch,icon:bS.up,size:`compact`,disabled:!o||!n.matchCount,onClick:()=>t.search(n.query,!0,!0)}),z(Ei,{label:r.nextMatch,icon:bS.down,size:`compact`,disabled:!o||!n.matchCount,onClick:()=>t.search(n.query,!1,!0)}),z(Ei,{label:r.closeSearch,icon:bS.close,size:`compact`,onClick:i})]})]})}function CS({state:e,text:t,onCancelPrint:n,showDetails:r=!0}){let i=e.status===`ready`;return z(`header`,{class:`rv-pdf-viewer__header`,children:[r&&z(F,{children:[z(Kt,{svg:bS.document,className:`rv-svg-icon rv-pdf-viewer__document-icon`}),z(pi,{class:`rv-pdf-viewer__filename`,title:e.fileName,children:e.fileName})]}),z(`span`,{class:`rv-pdf-viewer__summary`,"aria-live":`polite`,children:e.printing?t.printing:i?gS(t.pageSummary,{page:e.page,of:t.of,pages:e.pageCount}):``}),e.printing&&z(B,{variant:`ghost`,size:`compact`,onClick:()=>n(),children:t.cancelPrint})]})}function wS({state:e,text:t,controller:n,canOpen:r,onOpen:i}){return e.status===`loading`?z(F,{children:[z(Xi,{label:t.loading}),z(`span`,{children:t.loading})]}):e.status===`error`?z(Ti,{tone:`danger`,title:t.error,description:t.errorDescription,actions:z(F,{children:[n.canRetry&&z(B,{size:`compact`,onClick:()=>void n.retry(),children:t.retry}),r&&z(B,{size:`compact`,onClick:()=>i(),children:t.open})]})}):z(Qi,{title:t.empty,description:t.emptyHint,children:r&&z(B,{variant:`primary`,onClick:()=>i(),children:t.open})})}function TS(e){let t=qe(()=>new mS(e),[e.workerSrc,e.documentOptions,e.initialPage,e.initialZoom,e.l10n]);return z(ES,{...e,controller:t})}function ES(e){let{controller:t}=e,[n,r]=I(t.snapshot),[i,a]=I(!1),[o]=I(()=>Rt(`rv-pdf-search`)),s=R(null),c=R(null),l=R(null),u=R(null),d=R(null),f=_S(e.text),p=n.status===`ready`,m=vS(e.toolbar).buttons,h=e=>{let t=m?.[e];return t!==!1&&!t?.disabled},g=yS(e.toolbar,`search`)&&h(`search`),_=yS(e.toolbar,`open`)&&h(`open`);t.setCallbacks(e),t.setPrintTitle(f.printDocument),L(()=>{let n=t.subscribe(r);return t.attach(l.current).catch(()=>{}),e.onReady?.(t),()=>{n(),t.destroy()}},[t]),L(()=>{t.load(e.source??null,e.fileName)},[t,e.source,e.fileName]);let v=()=>{t.clearSearch(),a(!1);let e=s.current;e?.isConnected&&!e.hasAttribute(`disabled`)?e.focus({preventScroll:!0}):l.current?.focus({preventScroll:!0})},y=e=>{i||(s.current=e),a(!0),d.current?.focus()};L(()=>{g||(t.clearSearch(),a(!1),i&&l.current?.focus({preventScroll:!0}))},[g,t]);let b={controller:t,state:n,text:f,config:e.toolbar,searchOpen:i,searchId:o,appendTo:c.current??void 0,onOpen:()=>u.current?.click(),onToggleSearch:e=>i?v():y(e)};return z(`section`,{ref:c,class:`rv-pdf-viewer ${e.className??``}`,style:{height:e.height??640},"aria-label":f.viewer,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`f`&&p&&g&&(e.preventDefault(),y(e.target))},children:[(e.showHeader!==!1||n.printing)&&z(CS,{showDetails:e.showHeader!==!1,state:n,text:f,onCancelPrint:()=>t.cancelPrint()}),e.toolbar!==!1&&(e.renderToolbar?e.renderToolbar(t,n,b):z(xS,{...b})),z(cr,{ref:u,type:`file`,accept:`application/pdf,.pdf`,hidden:!0,"aria-label":f.open,onChange:e=>{let n=e.currentTarget.files?.[0];e.currentTarget.value=``,n&&t.load(n)}}),i&&g&&z(SS,{inputRef:d,id:o,controller:t,state:n,text:f,onClose:v}),z(`div`,{class:`rv-pdf-viewer__body`,"aria-busy":n.status===`loading`,children:[z(`div`,{ref:l,class:`rv-pdf-viewer__viewport`,tabIndex:0,role:`region`,"aria-label":f.pages}),!p&&z(`div`,{class:`rv-pdf-viewer__status`,children:e.renderStatus?e.renderStatus(n):z(wS,{state:n,text:f,controller:t,canOpen:_,onOpen:b.onOpen})})]}),p&&n.error&&z(Ti,{className:`rv-pdf-viewer__error`,tone:`danger`,description:f.operationError})]})}var DS=`
652
+ .rv-svg-toolbar-button { cursor: pointer; }
653
+ .rv-svg-toolbar-button[aria-pressed="true"] > rect { fill: currentColor; fill-opacity: .14; }
654
+ .rv-svg-toolbar-button[aria-disabled="true"] { opacity: .4; cursor: default; }
655
+ .rv-svg-toolbar-button:not([aria-disabled="true"]):hover > rect { fill: currentColor; fill-opacity: .1; }
656
+ .rv-svg-toolbar-button:focus-visible { outline: none; }
657
+ .rv-svg-toolbar-button:focus-visible > rect { stroke: currentColor; stroke-width: 2; }
658
+ `;function OS(e){let t=Ut(e.title??e.label,e.onEscape);return z(kS,{...e,buttonRef:t})}function kS(e){return z(`g`,{ref:e.buttonRef,...e.attributes,class:`rv-svg-toolbar-button`,role:`button`,tabindex:e.enabled?0:-1,"aria-label":e.label,"aria-disabled":!e.enabled,"aria-pressed":e.pressed,"data-rv-svg-toolbar-button":e.action,onClick:e.onActivate?()=>{e.enabled&&e.onActivate?.(e.action)}:void 0,onKeyDown:e.onActivate?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),e.enabled&&e.onActivate?.(e.action))}:void 0,children:[z(`rect`,{ref:t=>{t&&e.onRectangle?.(t)},x:e.x,y:e.y,width:28,height:28,rx:6,fill:`transparent`,stroke:`transparent`}),e.icon&&z(`svg`,{"data-rv-toolbar-icon":``,x:e.x+(e.suffixIcon?5:8),y:e.y+8,width:12,height:12,visibility:e.showText?`hidden`:void 0,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,style:{color:e.foreground??(e.pressed?`var(--rv-ui-accent-text, Highlight)`:`var(--rv-ui-text, CanvasText)`)},dangerouslySetInnerHTML:{__html:e.icon}}),e.suffixIcon&&z(`svg`,{x:e.x+18,y:e.y+12,width:6,height:8,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,style:{color:e.foreground??(e.pressed?`var(--rv-ui-accent-text, Highlight)`:`var(--rv-ui-text, CanvasText)`)},dangerouslySetInnerHTML:{__html:e.suffixIcon}}),z(`text`,{visibility:e.icon&&!e.showText?`hidden`:void 0,ref:t=>{t&&e.onText?.(t)},x:e.x+14,y:e.y+19,fill:e.foreground??`var(--rv-ui-text, currentColor)`,"font-size":16,"text-anchor":`middle`,"aria-hidden":`true`,children:e.text})]})}function AS({actions:e,label:t=`Actions`,onAction:n,onEscape:r}){let i=Math.max(10,e.length*33+5);return z(`svg`,{class:`rv-icon-toolbar`,role:`group`,"aria-label":t,width:i,height:38,viewBox:`0 0 ${i} 38`,style:{color:`var(--rv-ui-accent, Highlight)`,maxWidth:`100%`},children:[z(`style`,{children:DS}),z(`rect`,{width:i,height:38,rx:12,fill:`var(--rv-ui-surface-sunken, transparent)`}),e.map((e,t)=>z(OS,{action:e.id,label:e.label,title:e.title,text:e.text,icon:e.icon,suffixIcon:e.suffixIcon,pressed:e.pressed,enabled:!e.disabled,x:5+t*33,y:5,onActivate:n,onEscape:r},e.id))]})}function jS({label:e,items:t,className:n=``,itemClassName:r=``}){return z(`div`,{class:`rv-legend ${n}`,role:`list`,"aria-label":e,children:t.map(e=>z(`span`,{role:`listitem`,class:`rv-legend__item ${r} ${e.className??``}`,"data-tone":e.tone??`muted`,style:e.color?{"--rv-legend-marker-color":e.color}:void 0,children:[z(`i`,{"aria-hidden":`true`,"data-marker":e.marker??`solid`}),z(`span`,{class:`rv-legend__label`,children:e.label})]},e.id))})}var MS={invalid:`Enter a valid number in the configured locale.`,configuration:`The number input configuration is unsupported or invalid.`,required:`Enter a value.`,precision:`Too many decimal places for this field.`,minimum:`The value is below the minimum.`,maximum:`The value is above the maximum.`,increase:`Increase`,decrease:`Decrease`},NS=/[\u061c\u200e\u200f]/g,PS=e=>e.replace(NS,``).trim(),FS=e=>typeof e==`number`&&Number.isFinite(e);function IS(e){let t=e.kind??`number`,n=e.precision??2;if(![`number`,`currency`,`percent`].includes(t)||!Number.isInteger(n)||n<0||n>20||e.min!==void 0&&!FS(e.min)||e.max!==void 0&&!FS(e.max)||e.step!==void 0&&(!FS(e.step)||e.step<=0)||e.min!==void 0&&e.max!==void 0&&e.min>e.max||e.useGrouping!==void 0&&typeof e.useGrouping!=`boolean`||e.required!==void 0&&typeof e.required!=`boolean`||e.locale!==void 0&&(typeof e.locale!=`string`||!e.locale.trim()||!Intl.NumberFormat.supportedLocalesOf(e.locale).length))throw RangeError();let r=e.currency??`USD`;if(t===`currency`&&(typeof r!=`string`||!/^[A-Z]{3}$/.test(r)))throw RangeError();if(e.step!==void 0){let[r,i=`0`]=String(e.step).split(`e`);if((r.split(`.`)[1]?.length??0)-Number(i)-(t===`percent`?2:0)>n)throw RangeError()}let i=t===`number`?`decimal`:t,a=new Intl.NumberFormat(e.locale,{style:i,...t===`currency`?{currency:r}:{},minimumFractionDigits:n,maximumFractionDigits:n,useGrouping:e.useGrouping??!0}),o=e.locale?new Intl.Locale(e.locale).numberingSystem:void 0;if(o&&a.resolvedOptions().numberingSystem!==o)throw RangeError();return{kind:t,precision:n,currency:r,formatter:a}}function LS(e,t){let{kind:n,currency:r}=IS(t);if(e==null)return``;if(!FS(e))return String(e);let i=new Intl.NumberFormat(t.locale,{style:n===`number`?`decimal`:n,...n===`currency`?{currency:r}:{},useGrouping:t.useGrouping??!0,minimumFractionDigits:0,maximumFractionDigits:20}).format(e),a=RS(i,{...t,precision:20,min:void 0,max:void 0,step:void 0});return a.error===void 0&&Object.is(a.value,e)?i:e.toExponential()}function RS(e,t={}){let n={...MS,...t.text};try{let{kind:r,precision:i,currency:a}=IS(t),o=PS(e);if(!o)return t.required?{error:n.required}:{value:null};let s=new Intl.NumberFormat(t.locale,{useGrouping:!1,minimumFractionDigits:1}).formatToParts(1.1).find(e=>e.type===`decimal`).value,c=new Intl.NumberFormat(t.locale,{useGrouping:!1}),l=new Map(Array.from({length:10},(e,t)=>[PS(c.format(t)),String(t)])),u=e=>[...e].map(e=>l.get(e)??e).join(``),d=new Intl.NumberFormat(t.locale,{useGrouping:!0,maximumFractionDigits:0}),f=d.formatToParts(123456789).find(e=>e.type===`group`)?.value,p=c.formatToParts(-1).find(e=>e.type===`minusSign`)?.value??`-`,m=!1,h=!1;r===`currency`&&o.startsWith(`(`)&&o.endsWith(`)`)&&(m=!0,h=!0,o=PS(o.slice(1,-1)));let g=()=>{let e=[p,`-`,`+`].find(e=>o.startsWith(e));return!e||!h&&(h=!0,m=e!==`+`,o=PS(o.slice(e.length)),!0)};if(!g())return{error:n.invalid};if(r===`currency`){let e=new Set([a]);for(let n of[`symbol`,`narrowSymbol`])for(let r of new Intl.NumberFormat(t.locale,{style:`currency`,currency:a,currencyDisplay:n}).formatToParts(1))r.type===`currency`&&e.add(r.value);for(let t of[...e].sort((e,t)=>t.length-e.length)){if(o.startsWith(t)){o=PS(o.slice(t.length));break}if(o.endsWith(t)){o=PS(o.slice(0,-t.length));break}}if(!g())return{error:n.invalid}}else if(r===`percent`){let e=new Intl.NumberFormat(t.locale,{style:`percent`}).formatToParts(1).find(e=>e.type===`percentSign`).value;o.endsWith(e)?o=PS(o.slice(0,-e.length)):o.startsWith(e)&&(o=PS(o.slice(e.length)))}o=u(o);let _=o.split(s);if(_.length>2)return{error:n.invalid};let v=_[0],y=_[1]??``;if(!/^\d*$/.test(y)||_.length===2&&!y)return{error:n.invalid};if(f&&v.includes(f)){let e=v.split(f).join(``);if(!/^\d+$/.test(e)||u(PS(d.format(BigInt(e))))!==v)return{error:n.invalid};v=e}if(!/^\d*$/.test(v)||!v&&!y)return{error:n.invalid};if(y.length>i)return{error:n.precision};let b=`${m?`-`:``}${v||`0`}${y?`.${y}`:``}`,x=Number(r===`percent`?`${b}e-2`:b);return!Number.isFinite(x)||Math.abs(x)>2**53-1||x===0&&/[1-9]/.test(b)?{error:n.invalid}:t.min!==void 0&&x<t.min?{error:n.minimum}:t.max!==void 0&&x>t.max?{error:n.maximum}:{value:x}}catch{return{error:n.configuration}}}function zS(e,t){let n=e=>{let[t,n=`0`]=String(e).split(`e`),r=t.split(`.`)[1]?.length??0;return{integer:BigInt(t.replace(`.`,``)),scale:r-Number(n)}},r=n(e),i=n(t),a=Math.max(r.scale,i.scale,0),o=r.integer*10n**BigInt(a-r.scale)+i.integer*10n**BigInt(a-i.scale);return Number(`${o}e-${a}`)}function BS(e,t,n={}){let r=RS(e,n);if(r.error!==void 0)return r;let{kind:i,precision:a}=IS(n),o=n.step??10**-(a+(i===`percent`?2:0)),s=r.value??Math.max(n.min??-1/0,Math.min(n.max??1/0,0)),c=Math.max(n.min??-1/0,Math.min(n.max??1/0,zS(s,t*o)));return!Number.isFinite(c)||Math.abs(c)>2**53-1?{error:n.text?.invalid??MS.invalid}:RS(LS(c,n),n)}function VS({value:e,options:t,apply:n,cancel:r,initialSelection:i=`all`}){let[a,o]=I(()=>{try{return LS(e,t)}catch{return String(e??``)}}),[s,c]=I(``),[l]=I(()=>Rt(`rv-number`)),u=R(null),d=R(!1),f={...MS,...t.text},p=RS(a,t),m=p.error??s,h=p.error!==void 0||!!s,g=()=>{if(d.current)return;let e=RS(a,t);e.error===void 0&&!s&&n(e.value)},_=e=>{c(``),o(e)},v=e=>{if(d.current)return;let n=BS(a,e,t);n.error===void 0?(c(``),o(LS(n.value,t))):c(n.error||f.invalid)};return Ke(()=>{if(u.current?.focus(),i===`end`){let e=u.current?.value.length??0;u.current?.setSelectionRange(e,e)}else u.current?.select()},[]),z(`div`,{class:`rv-number-draft`,onKeyDown:e=>{e.isComposing||d.current||(e.key===`Enter`&&(e.target===u.current||e.ctrlKey||e.metaKey)?(e.preventDefault(),g()):e.target===u.current&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&(e.preventDefault(),v(e.key===`ArrowUp`?1:-1)))},children:[z(`label`,{htmlFor:l,children:t.label??(t.kind===`currency`?`Currency amount`:t.kind===`percent`?`Percentage`:`Number`)}),z(`div`,{class:`rv-number-draft__entry`,children:[z(cr,{ref:u,id:l,class:`rv-control`,type:`text`,inputMode:`decimal`,value:a,"aria-invalid":h,"aria-describedby":h?`${l}-error`:void 0,required:t.required,onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},onInput:e=>_(e.currentTarget.value)}),z(B,{"aria-label":f.decrease,disabled:p.error!==void 0,onClick:()=>v(-1),children:`−`}),z(B,{"aria-label":f.increase,disabled:p.error!==void 0,onClick:()=>v(1),children:`+`})]}),h&&z(`p`,{class:`rv-editor-error`,id:`${l}-error`,role:`alert`,children:m||f.invalid||MS.invalid}),z(Us,{text:t.actions,apply:g,cancel:r,disabled:h,clear:t.required?void 0:()=>_(``)})]})}function HS(e){if(typeof e!=`string`)return;let t=[],n=Array.from(e);for(let e=0;e<n.length;e++){let r=n[e];if(r===`\\`){if(++e===n.length)return;t.push({literal:n[e]})}else r===`0`||r===`A`||r===`*`?t.push({token:r}):t.push({literal:r})}return t.some(e=>`token`in e)?t:void 0}function US(e,t){return e===`0`?/^[0-9]$/.test(t):e===`A`?/^[A-Za-z]$/.test(t):/^[A-Za-z0-9]$/.test(t)}function WS(e,t){let n=``;for(let r=0;r<e.length;r++){let i=t[r];if(!i||(`literal`in i?e[r]!==i.literal:!US(i.token,e[r])))return{complete:!1,prefix:!1,raw:n};`token`in i&&(n+=e[r])}return{complete:e.length===t.length,prefix:!0,raw:n}}function GS(e,t){let n=e=>({valid:!1,value:null,raw:null,formatted:null,error:e}),r=HS(t.mask);if(!r||t.store!==void 0&&t.store!==`raw`&&t.store!==`formatted`)return n(`configuration`);if(e==null||e===``)return t.required?n(`required`):{valid:!0,value:null,raw:null,formatted:null};if(typeof e!=`string`)return n(`invalid`);let i=Array.from(e),a=WS(i,r.filter(e=>`token`in e)),o=WS(i,r),s=a.complete?a:o.complete?o:void 0;if(!s)return n(a.prefix||o.prefix?`incomplete`:`invalid`);let c=s.raw,l=Array.from(c),u=0,d=r.map(e=>`literal`in e?e.literal:l[u++]).join(``);return{valid:!0,raw:c,formatted:d,value:t.store===`formatted`?d:c}}var KS=`_`;function qS(e,t){let n=t.filter(e=>`token`in e),r=Array.from(e),i=n.map(()=>``);if(!r.length)return i;if(r.length===t.length){let e=0;if(t.every((t,n)=>{let a=r[n];return`literal`in t?a===t.literal:a!==KS&&!US(t.token,a)?!1:(i[e++]=a===KS?``:a,!0)}))return i}if(r.length<=n.length&&r.every((e,t)=>`token`in n[t]&&US(n[t].token,e)))return i.map((e,t)=>r[t]??``);let a=0;for(let e=0;e<r.length;e++){let n=t[e],o=r[e];if(!n)return;if(`literal`in n){if(o!==n.literal)return}else{if(o!==KS&&!US(n.token,o))return;i[a++]=o===KS?``:o}}return i}function JS(e,t){let n=``,r=0,i=[],a=[];for(let o of t)`literal`in o?n+=o.literal:(i.push(n.length),n+=e[r++]||KS,a.push(n.length));return{value:n,starts:i,ends:a}}function YS(e,t){let n=HS(t.mask);if(!n)return e;let r=qS(e,n);return r?JS(r,n).value:e}function XS(e,t){let n=GS(``,t);if(n.error===`configuration`)return n;let r=HS(t.mask),i=qS(e,r);return i?i.every(e=>!e)?n:i.some(e=>!e)?{valid:!1,value:null,raw:null,formatted:null,error:`incomplete`}:GS(JS(i,r).value,t):GS(e,t)}function ZS(e,t,n,r,i,a){let o={value:e,caret:t,accepted:!1},s=HS(a.mask);if(!s)return o;let c=qS(e,s);if(!c){if(t!==0||n!==e.length)return o;c=s.filter(e=>`token`in e).map(()=>``)}let l=JS(c,s),u=l.ends.filter(e=>e<=t).length,d=l.starts.filter(e=>e<n).length,f=[...c];for(let e=u;e<d;e++)f[e]=``;let p=u;if([`deleteContentBackward`,`deleteContentForward`,`deleteByCut`].includes(r))t===n&&r!==`deleteByCut`&&(p=r===`deleteContentBackward`?Math.max(0,u-1):u,p<f.length&&(f[p]=``));else if(r.startsWith(`insert`)&&i!==null){let e=s.flatMap((e,t)=>`token`in e?[t]:[]),r=e[u]??s.length,a=s.slice(u===0?0:r),c=a.filter(e=>`token`in e),d=Array.from(i),m;if(d.length<=c.length&&d.every((e,t)=>`token`in c[t]&&US(c[t].token,e)))m=d;else{let o=s.slice(u?e[u-1]+1:0,r).map(e=>`literal`in e?e.literal:``).join(``);if(t===n&&i&&o.includes(i))return{value:l.value,caret:l.starts[u]??l.value.length,accepted:!0};let c=qS(i,a);if(c){let e=c.findLastIndex(Boolean)+1;c.slice(0,e).every(Boolean)&&(m=c.slice(0,e))}}if(!m||u+m.length>f.length)return o;m.forEach((e,t)=>{f[u+t]=e}),p=u+m.length}else return o;let m=JS(f,s);return{value:m.value,caret:m.starts[p]??m.value.length,accepted:!0}}var QS=new WeakMap,$S=e=>({value:e.value,start:e.selectionStart??0,end:e.selectionEnd??0});function eC(e,t,n,r){let i=ZS(e.value,e.selectionStart??0,e.selectionEnd??e.value.length,t,n,r);if(i.accepted){if(i.value!==e.value){let t=QS.get(e);(!t||t.current!==e.value)&&(t={current:e.value,past:[],future:[]},QS.set(e,t)),t.past.push($S(e)),t.past.length>100&&t.past.shift(),t.future=[],t.current=i.value}e.value=i.value,e.setSelectionRange(i.caret,i.caret)}return i.accepted}function tC(e,t){let n=YS(e.value,t);if(n===e.value)return;let r=HS(t.mask),i=qS(e.value,r);if(!i)return;let a=JS(i,r),o=t=>{let i=qS(e.value.slice(0,t),r)?.filter(Boolean).length??0;return a.starts[i]??n.length},s=o(e.selectionStart??e.value.length),c=o(e.selectionEnd??e.value.length);e.value=n,e.setSelectionRange(s,c)}function nC(e,t,n){return t.isComposing||!t.cancelable||![`insertText`,`insertReplacementText`,`insertFromPaste`,`deleteContentBackward`,`deleteContentForward`,`deleteByCut`].includes(t.inputType)||t.inputType.startsWith(`insert`)&&t.data===null?!1:(t.preventDefault(),eC(e,t.inputType,t.data,n),!0)}function rC(e,t,n){return t.clipboardData?(t.preventDefault(),eC(e,`insertFromPaste`,t.clipboardData.getData(`text/plain`),n),!0):!1}function iC(e,t){if(t.isComposing||!(t.ctrlKey||t.metaKey)||t.altKey)return!1;let n=t.key.toLowerCase();if(n!==`z`&&n!==`y`)return!1;t.preventDefault(),t.stopPropagation();let r=QS.get(e);if(!r||r.current!==e.value)return!0;let i=n===`y`||t.shiftKey,a=(i?r.future:r.past).pop();return a&&((i?r.past:r.future).push($S(e)),r.current=e.value=a.value,e.setSelectionRange(a.start,a.end)),!0}var aC={required:`Enter a value.`,invalid:`Use only the characters and separators specified by the mask.`,incomplete:`Complete every position in the mask.`,configuration:`Configure a mask with 0, A, or * positions and valid escapes.`,preview:`Formatted value`};function oC({value:e,options:t,apply:n,cancel:r}){let[i,a]=I(()=>YS(String(e??``),t)),[o,s]=I(!1),[c,l]=I(!1),u=R(!1),d=Xe(),f={...aC,...t.text},p=XS(i,t),m=o||p.error===`invalid`||p.error===`configuration`,h=()=>{s(!0),!u.current&&p.valid&&n(p.value)};return z(`div`,{class:`rv-masked-draft`,onKeyDown:e=>{!u.current&&e.target instanceof HTMLInputElement&&iC(e.target,e)?a(e.target.value):e.key===`Enter`&&(e.ctrlKey||e.metaKey||e.target instanceof HTMLInputElement)&&!e.isComposing&&!u.current&&(e.preventDefault(),h())},children:[z(cr,{type:`text`,value:i,"aria-label":t.label??`Masked identifier`,"aria-invalid":m&&!p.valid,"aria-describedby":`${d}-hint${m&&p.error?` ${d}-error`:``}`,required:t.required,placeholder:t.placeholder??t.mask,onBeforeInput:e=>{!u.current&&nC(e.currentTarget,e,t)&&a(e.currentTarget.value)},onPaste:e=>{!u.current&&rC(e.currentTarget,e,t)&&a(e.currentTarget.value)},onInput:e=>{u.current||tC(e.currentTarget,t),a(e.currentTarget.value)},onCompositionStart:()=>{u.current=!0,l(!0)},onCompositionEnd:e=>{u.current=!1,l(!1),tC(e.currentTarget,t),a(e.currentTarget.value)}}),z(`span`,{id:`${d}-hint`,class:`rv-masked-draft__preview`,children:[f.preview,`: `,z(`output`,{children:p.formatted??t.mask})]}),m&&p.error&&z(`span`,{id:`${d}-error`,role:`alert`,class:`rv-editor-error`,children:f[p.error]}),z(Us,{text:t.actions,disabled:!p.valid||c,apply:h,cancel:r,clear:t.required?void 0:()=>a(YS(``,t))})]})}var sC={minute:`min`,hour:`hour`,day:`day`,week:`week`,month:`month`,quarter:`qtr`,year:`year`};function cC(e){let{unit:t,amount:n}=e,r=e.onCommit??e.onChange,i=[...new Set(e.allowedUnits??Object.keys(sC))],a=typeof e.slider==`object`?e.slider:{},o=Number.isFinite(e.min)?Math.max(0,e.min):0,s=Math.max(o+100,n),c=Number.isFinite(e.max)?e.max:Number.isFinite(a.max)?a.max:s,l=Number.isFinite(a.step)&&a.step>0?a.step:1;return z(F,{children:[e.slider&&z(`span`,{class:`rv-duration-field__slider`,children:[z(Wl,{min:o,max:c,step:l,value:e.amount,disabled:e.disabled||c<=o,ariaLabel:e.label??`Duration`,ariaValueText:e.draft,onChange:t=>e.onChange(t),onCommit:e.onCommit?t=>e.onCommit?.(t):void 0}),z(`span`,{class:`rv-duration-field__bounds`,"aria-hidden":`true`,children:[z(`span`,{children:o}),z(`span`,{children:[c,` `,e.unitLabels?.[t]??sC[t]]})]})]}),e.unitButtons&&z(`span`,{class:`rv-duration-field__modes`,children:[i.length===0?null:i.length>5?z(Gn,{className:`rv-select`,config:{ariaLabel:e.unitLabel??`Duration unit`,topLayer:!0},source:i.map(t=>({value:t,label:e.unitLabels?.[t]??sC[t]})),value:t,disabled:e.disabled,onChange:e=>r(n,e)}):z(Pr,{role:`radiogroup`,ariaLabel:e.unitLabel??`Duration unit`,value:t,options:i.map(t=>({value:t,label:e.unitLabels?.[t]??sC[t],ariaLabel:e.unitLabels?.[t]??t})),disabled:e.disabled,onChange:e=>r(n,e)}),e.allowElapsed&&z(Pr,{role:`radiogroup`,ariaLabel:e.modeLabel??`Duration mode`,value:e.elapsed?`elapsed`:`working`,options:[{value:`working`,label:e.workingLabel??`Working`},{value:`elapsed`,label:e.elapsedLabel??`Elapsed`}],disabled:e.disabled,onChange:e=>r(n,t,e===`elapsed`)})]})]})}function lC(e){let t=t=>t&&typeof t==`object`?zc(t.value,t.unit,{elapsed:t.elapsed,maximumFractionDigits:e.maximumFractionDigits??10}):t===null?``:String(t),[n,r]=I(()=>rl(e.value,e).value?.unit??e.defaultUnit),[i,a]=I(()=>t(e.value)),o=R(e.value);Ke(()=>{e.value!==o.current&&(o.current=e.value,a(t(e.value)),r(rl(e.value,e).value?.unit??e.defaultUnit))},[e.value]);let s={...e,defaultUnit:e.unitButtons?n:e.defaultUnit},c=rl(i,s);Ke(()=>e.onValidityChange?.(c.valid),[c.valid]);let l=e.disabled||e.readOnly,u=c.value,d=u?.unit??n,f=u?.value??0,p=t=>{a(t),e.onDraftChange?.(t);let n=rl(t,s);n.valid&&(n.value&&r(n.value.unit),o.current=n.value,e.onChange(n.value))},m=(t,n=d,r=u?.elapsed??!1,i=!1)=>{if(l)return;let a=zc(t,n,{elapsed:r,maximumFractionDigits:e.maximumFractionDigits??10});p(a);let o=rl(a,s);i&&o.valid&&e.onCommit?.(o.value)};return z(`span`,{class:`rv-duration-field ${e.className??``}`,children:[z(cr,{type:`text`,"aria-label":e.label??`Duration`,"aria-invalid":!c.valid,value:i,disabled:e.disabled,readOnly:e.readOnly,placeholder:e.placeholder??`2 ${e.unitLabels?.[e.defaultUnit]??e.defaultUnit}`,onInput:e=>p(e.currentTarget.value)}),z(cC,{...e,unit:d,amount:f,draft:i,elapsed:u?.elapsed??!1,disabled:l||!c.valid&&!!i.trim(),onChange:m,onCommit:(e,t,n)=>m(e,t,n,!0)}),!c.valid&&z(`span`,{role:`alert`,class:`rv-editor-error`,children:e.invalidText??`Enter a valid duration within the allowed units and bounds.`})]})}function uC({value:e,options:t,apply:n,cancel:r}){let[i,a]=I(!1),[o,s]=I(e),[c,l]=I(0),u=t.autoApply!==!1,d=R(!1),f=R(e),p=(e=!1)=>{let r=rl(f.current,t);return r.valid?((e||!u||d.current)&&(d.current=!1,n(r.value)),!0):!1};return Gs(p,u),z(`div`,{onKeyDown:e=>{let t=e.target instanceof HTMLInputElement&&e.target.type===`text`;!e.isComposing&&e.key===`Enter`&&(u&&t||e.ctrlKey||e.metaKey)&&(e.preventDefault(),p(!0))},children:[z(lC,{...t,value:o,onChange:e=>{d.current=!0,s(e)},onDraftChange:e=>{d.current=!0,f.current=e},onValidityChange:a},c),z(Us,{showConfirm:t.showActions??!u,text:t.actions,disabled:!i,apply:()=>p(!0),cancel:r,clear:t.required?void 0:()=>{u?n(null):(f.current=null,s(null),l(e=>e+1))}})]})}function dC({code:e}){let t=[],n=/<!--[\s\S]*?(?:-->|$)|<\/?[A-Za-z][\w:-]*(?:[^"'<>]|"[^"]*"|'[^']*')*>?/g,r=0;for(let i of e.matchAll(n)){t.push({text:e.slice(r,i.index)});let n=i[0];if(n.startsWith(`<!--`))t.push({text:n,kind:`comment`});else for(let e of n.split(/("[^"]*"|'[^']*'|^<\/?[\w:-]+|\/?>$|[\w:-]+(?=\s*=))/g))t.push({text:e,kind:/^["']/.test(e)?`string`:/^<|^\/?>$/.test(e)?`tag`:/^[\w:-]+$/.test(e)?`attribute`:void 0});r=i.index+n.length}return t.push({text:e.slice(r)}),z(`code`,{class:`rv-html-syntax`,children:t.map((e,t)=>z(`span`,{class:e.kind?`rv-html-syntax__${e.kind}`:void 0,children:e.text},t))})}var fC=new Set([`p`,`br`,`strong`,`em`,`s`,`code`,`pre`,`blockquote`,`ul`,`ol`,`li`,`a`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]),pC=new Set([`script`,`style`,`iframe`,`object`,`embed`,`svg`,`math`,`template`,`noscript`,`head`,`link`,`meta`,`base`,`input`,`button`,`textarea`,`select`]),mC={b:`strong`,i:`em`,strike:`s`,del:`s`,div:`p`},hC=new Set([`p`,`pre`,`blockquote`,`ul`,`ol`,`li`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]);function gC(e){if(!e||/[\u0000-\u0020\u007f]/.test(e))return!1;try{return[`http:`,`https:`,`mailto:`].includes(new URL(e,`https://editor.invalid/`).protocol)}catch{return!1}}function _C(e){for(let t of[...e.children])t.localName===`br`?t.replaceWith(t.hasAttribute(`data-rv-placeholder`)?``:`
659
+ `):(_C(t),hC.has(t.localName)&&t.nextSibling&&t.after(`
660
+ `),t.replaceWith(...t.childNodes))}function vC(e,t=document){let n=t.createElement(`template`);n.innerHTML=e;let r=t.createDocumentFragment(),i=(e,n)=>{if(e.nodeType===3){if(!e.textContent?.trim()&&[`ul`,`ol`,`blockquote`].includes(e.parentElement?.localName??``))return;e.textContent&&n.appendChild(t.createTextNode(e.textContent));return}if(e.nodeType!==1)return;let r=e,a=r.localName.toLowerCase();if(a===`br`&&r.hasAttribute(`data-rv-placeholder`)||r.namespaceURI!==`http://www.w3.org/1999/xhtml`||pC.has(a))return;let o=mC[a]??a;if(!fC.has(o)||o===`a`&&!gC(r.getAttribute(`href`)??``)||o===`p`&&[...r.children].some(e=>hC.has(mC[e.localName]??e.localName))){for(let e of r.childNodes)i(e,n);return}let s=t.createElement(o);o===`a`&&(s.setAttribute(`href`,r.getAttribute(`href`)),s.setAttribute(`rel`,`noopener noreferrer`)),o===`ol`&&/^\d{1,9}$/.test(r.getAttribute(`start`)??``)&&s.setAttribute(`start`,r.getAttribute(`start`));for(let e of r.childNodes)i(e,s);if(o===`pre`&&_C(s),!hC.has(o)&&o!==`br`&&!s.textContent&&!s.querySelector(`br`))return;let c=n.lastChild;if([`strong`,`em`,`s`,`code`,`a`].includes(o)&&c?.nodeType===1&&c.cloneNode(!1).isEqualNode(s.cloneNode(!1)))for(;s.firstChild;)c.appendChild(s.firstChild);else n.appendChild(s)};for(let e of n.content.childNodes)i(e,r);let a,o=[...r.children].some(e=>hC.has(e.localName));for(let e of[...r.childNodes])o&&!a&&e.nodeType===3&&!e.textContent?.trim()?e.remove():e.nodeType===1&&hC.has(e.localName)?a=void 0:(a||(a=t.createElement(`p`),r.insertBefore(a,e)),a.appendChild(e));return r}function yC(e,t=document){let n=t.createElement(`div`);return n.appendChild(vC(e,t)),n.textContent?.replace(/\u00a0/g,` `).trim()?n.innerHTML:``}var bC={formats:[],block:null,link:!1},xC={bold:`strong`,italic:`em`,strikethrough:`s`,code:`code`},SC=`p,h1,h2,h3,h4,h5,h6,li,pre`;function CC(e,t,n,r=()=>{}){let i=e.ownerDocument,a,o,s=!1,c=[],l=-1,u=0,d=e=>e.nodeType===1?e:e.parentElement,f=e=>{let t=d(e)?.closest(SC);return t?.localName===`p`?t.closest(`li`)??t:t},p=t=>e.contains(t.startContainer)&&e.contains(t.endContainer),m=()=>{let t=i.getSelection();if(t?.rangeCount&&p(t.getRangeAt(0)))return t.getRangeAt(0).cloneRange();if(a&&p(a))return a.cloneRange();let n=i.createRange();return n.selectNodeContents(e),n.collapse(!1),n},h=t=>{e.focus({preventScroll:!0});let n=i.getSelection();n?.removeAllRanges(),n?.addRange(t),a=t.cloneRange()},g=t=>{let n=[];for(;t!==e&&t.parentNode;)n.unshift([...t.parentNode.childNodes].indexOf(t)),t=t.parentNode;return n},_=()=>{let e=m();return{start:{path:g(e.startContainer),offset:e.startOffset},end:{path:g(e.endContainer),offset:e.endOffset}}},v=t=>{let n=t=>{let n=e;for(let e of t.path){if(!n.childNodes[e])break;n=n.childNodes[e]}return{node:n,offset:Math.min(t.offset,n.nodeType===3?n.textContent?.length??0:n.childNodes.length)}},r=i.createRange();if(t){let e=n(t.start),i=n(t.end);r.setStart(e.node,e.offset),r.setEnd(i.node,i.offset)}else r.selectNodeContents(e),r.collapse(!1);h(r)},y=()=>({html:e.innerHTML,selection:_()}),b=()=>{let t=m(),n=d(t.startContainer),i=n?.closest(`pre,li,h1,h2,h3,h4,h5,h6,blockquote`),a=i?.localName,s=a===`pre`?`code`:a===`li`?i.parentElement?.localName===`ol`?`ordered`:`bullet`:a===`h1`?`h1`:a?.startsWith(`h`)?`h2`:a===`blockquote`||n?.closest(`blockquote`)?`quote`:`paragraph`;r({formats:a===`pre`?[]:o?[...o]:Object.keys(xC).filter(r=>{let i=n?.closest(xC[r]);return!!i&&e.contains(i)&&(t.collapsed||i.contains(t.endContainer))}),block:s,link:!!n?.closest(`a`)&&e.contains(n.closest(`a`))})},x=(t=!1)=>{let r=y(),a=Date.now();c[l]?.html===r.html?c[l]&&(c[l].selection=r.selection):(c=c.slice(0,l+1),t&&a-u<500&&l>0?c[l]=r:(c.push(r),c.length>100&&c.shift(),l=c.length-1)),u=t?a:0,n(yC(e.innerHTML,i)),b()},S=()=>{c[l]?.html===e.innerHTML&&(c[l].selection=_())},C=()=>{if(!e.firstChild){let t=i.createElement(`p`);t.appendChild(i.createElement(`br`)),e.appendChild(t)}},w=t=>{e.replaceChildren(vC(t,i)),C(),a=void 0,o=void 0,c=[{html:e.innerHTML}],l=0,u=0,b()},T=t=>{let r=l+t;if(r<0||r>=c.length)return;l=r;let a=c[r];e.replaceChildren(vC(a.html,i)),C(),o=void 0,v(a.selection),u=0,n(yC(e.innerHTML,i)),b()},E=t=>{for(;t.parentElement&&t.parentElement!==e&&!t.parentElement.matches(SC+`,blockquote,ul,ol`);){let e=t.parentElement,n=e.cloneNode(!1);for(;t.nextSibling;)n.appendChild(t.nextSibling);e.after(t,n),e.hasChildNodes()||e.remove(),n.hasChildNodes()||n.parentNode?.removeChild(n)}},D=(e,t)=>{let n=i.createComment(`end`),r=i.createComment(`start`),a=e.cloneRange();a.collapse(!1),a.insertNode(n),e.collapse(!0),e.insertNode(r),E(r),E(n);let o=i.createRange();o.setStartAfter(r),o.setEndBefore(n),t(o);let s=i.createRange();s.setStartAfter(r),s.setEndBefore(n),r.remove(),n.remove(),h(s)},O=e=>e.replaceWith(...e.childNodes),k=e=>{let t=e.parentElement,n=t.cloneNode(!1);for(;e.nextSibling;)n.appendChild(e.nextSibling);t.after(e,n),t.hasChildNodes()||t.remove(),n.hasChildNodes()||n.parentNode?.removeChild(n)},A=(t,n,r,a)=>{D(t,t=>{for(let r of[...e.querySelectorAll(n)])t.intersectsNode(r)&&!r.closest(`pre`)&&O(r);if(!r){let r=i.createTreeWalker(e,NodeFilter.SHOW_TEXT),o=[],s;for(;s=r.nextNode();)s.textContent&&t.intersectsNode(s)&&!s.parentElement?.closest(`pre`)&&o.push(s);for(let e of o){let t=i.createElement(n);for(let[e,n]of Object.entries(a??{}))t.setAttribute(e,n);e.replaceWith(t),t.appendChild(e)}}})},j=t=>{if(!(t in xC)||d(m().startContainer)?.closest(`pre`))return;S(),u=0;let n=m();if(n.collapsed){o||=new Set(Object.keys(xC).filter(e=>d(n.startContainer)?.closest(xC[e]))),o.has(t)?o.delete(t):o.add(t),a=n.cloneRange(),e.focus({preventScroll:!0}),b();return}let r=!!d(n.startContainer)?.closest(xC[t])&&!!d(n.endContainer)?.closest(xC[t]);o=void 0,A(n,xC[t],r),x()},M=t=>{S(),o=void 0;let n=m(),r=n.collapsed,a=[...e.querySelectorAll(SC)].filter(e=>n.intersectsNode(e)),s=a.filter(e=>!a.some(t=>t!==e&&(e.contains(t)&&t.contains(n.startContainer)&&t.contains(n.endContainer)||t.contains(e)&&!(e.contains(n.startContainer)&&e.contains(n.endContainer)))));if(n.collapsed){let t=f(n.startContainer);s=t&&e.contains(t)?[t]:[]}if(!s.length){let e=i.createElement(`p`);e.appendChild(i.createElement(`br`)),n.insertNode(e),s=[e]}let c=i.createComment(`block-start`),l=i.createComment(`block-end`),u=n.cloneRange();u.collapse(!1),u.insertNode(l),n.collapse(!0),n.insertNode(c);let d,p;for(let e of s)if(e.isConnected){if(t===`bullet`||t===`ordered`){let n=t===`bullet`?`ul`:`ol`;if(e.localName===`li`){let t=e.parentElement;if(t.localName!==n){let e=i.createElement(n);e.append(...t.childNodes),t.replaceWith(e),d=e}else d=t}else{d?.nextSibling!==e&&(d=i.createElement(n),e.before(d));let t=i.createElement(`li`);t.append(...e.childNodes),d.appendChild(t),e.remove()}}else{let n=i.createElement(t===`h1`||t===`h2`?t:t===`code`?`pre`:`p`);if(n.append(...e.childNodes),t===`code`)_C(n);else for(let e of[...n.children])e.localName===`p`&&(e.nextSibling&&e.after(i.createElement(`br`)),O(e));if(e.localName===`li`&&k(e),e.replaceWith(n),t===`quote`){let e=i.createElement(`blockquote`);n.replaceWith(e),e.appendChild(n)}else n.parentElement?.localName===`blockquote`&&k(n);t===`code`&&(p?.nextSibling===n?(p.append(`
661
+ `,...n.childNodes),n.remove()):p=n)}}let g=i.createRange();g.setStartBefore(c),g.setEndBefore(l),c.remove(),l.remove(),r&&g.collapse(!0),h(g),x()},ee=(t,n=!1)=>{S();let r=m();r.deleteContents();let a=o?d(r.startContainer)?.closest(`a`):void 0,s=a&&e.contains(a)?a.cloneNode(!1):void 0,c=i.createComment(`caret`);r.insertNode(c),o&&E(c);let l=i.createDocumentFragment(),u=!!d(c)?.closest(`pre`),f=u?[t.replace(/\r\n?/g,`
662
+ `)]:t.replace(/\r\n?/g,`
663
+ `).split(`
664
+ `),p;for(let e=0;e<f.length;e++){if(e&&(p=i.createElement(`br`),l.appendChild(p)),!f[e])continue;let t=i.createTextNode(f[e]),n=t;for(let e of o??[]){let t=i.createElement(xC[e]);t.appendChild(n),n=t}if(s){let e=s.cloneNode(!1);e.appendChild(n),n=e}l.appendChild(n),p=t}c.before(l);let g=c.nextSibling;for(;g?.nodeType===3&&!g.textContent;)g=g.nextSibling;if((p?.nodeName===`BR`||u&&t.endsWith(`
665
+ `))&&!g){let e=i.createElement(`br`);e.setAttribute(`data-rv-placeholder`,``),c.after(e)}let _=i.createRange();p?(_.setStartAfter(p),_.collapse(!0)):(_.setStartBefore(c),_.collapse(!0)),c.remove(),h(_),x(n)},te=(e,t,n=!1)=>{let r=n?t?e.previousElementSibling:e.nextElementSibling:null;r||(r=i.createElement(`p`),r.appendChild(i.createElement(`br`)),t?e.before(r):e.after(r));let a=i.createRange();a.selectNodeContents(r),a.collapse(!t),h(a)},ne=(e,t,n)=>{if(!e.collapsed)return!1;let r=e.cloneRange();return r.selectNodeContents(t),n?r.setEnd(e.startContainer,e.startOffset):r.setStart(e.endContainer,e.endOffset),!r.toString()},N=e=>{S();let t=m();t.deleteContents();let n=f(t.startContainer);if(n?.localName===`pre`){let r=t.cloneRange();r.selectNodeContents(n),r.setEnd(t.startContainer,t.startOffset);let i=t.cloneRange();if(i.setEnd(n,n.childNodes.length),!e&&!i.toString()&&r.toString().endsWith(`
666
+
667
+ `)){let e=r.toString().length;n.textContent=r.toString().slice(0,e-2),o=void 0,te(n,!1),x();return}o=void 0,ee(`
668
+ `);return}if(e){ee(`
669
+ `);return}if(!n){let e=i.createElement(`p`);e.appendChild(i.createElement(`br`)),t.insertNode(e),t.selectNodeContents(e),t.collapse(!0),h(t),x();return}if(!n.textContent?.trim()){if(n.localName===`li`){re(!0);return}if(n.closest(`blockquote`)){M(`paragraph`);return}}o=void 0;let r=t.cloneRange();r.setEnd(n,n.childNodes.length);let a=/^h[1-6]$/.test(n.localName)&&!r.toString()?`p`:n.localName,s=i.createElement(a);s.appendChild(r.extractContents()),!n.textContent&&!n.querySelector(`br`)&&n.appendChild(i.createElement(`br`)),!s.textContent&&!s.querySelector(`br`)&&s.appendChild(i.createElement(`br`)),n.after(s);let c=i.createRange();c.selectNodeContents(s),c.collapse(!0),h(c),x()},re=t=>{let n=m(),r=d(n.startContainer)?.closest(`li`);if(!r||!e.contains(r))return!1;S();let a=r.parentElement,o={node:n.startContainer,offset:n.startOffset},s={node:n.endContainer,offset:n.endOffset};if(t){let e=a.parentElement;if(e?.localName!==`li`)return M(`paragraph`),!0;let t=a.cloneNode(!1);for(;r.nextSibling;)t.appendChild(r.nextSibling);t.hasChildNodes()&&r.appendChild(t),e.after(r),a.children.length||a.remove()}else{let e=r.previousElementSibling;if(!e)return!1;let t=e.lastElementChild;t?.localName!==a.localName&&(t=i.createElement(a.localName),e.appendChild(t)),t.appendChild(r)}let c=i.createRange();return c.setStart(o.node,o.offset),c.setEnd(s.node,s.offset),h(c),x(),!0},P=e=>{if(e.isComposing||s)return;let t=e.ctrlKey||e.metaKey;if(t&&!e.altKey){let t=e.key.toLowerCase();if(t===`z`||t===`y`){e.preventDefault(),e.stopPropagation(),T(t===`y`||e.shiftKey?1:-1);return}let n=t===`b`?`bold`:t===`i`?`italic`:t==="`"?`code`:t===`x`&&e.shiftKey?`strikethrough`:void 0;if(n){e.preventDefault(),e.stopPropagation(),j(n);return}}let n=m(),r=d(n.startContainer),i=r?.closest(`pre`);if(!t&&!e.altKey&&!e.shiftKey&&i&&(e.key===`ArrowDown`&&ne(n,i,!1)||e.key===`ArrowUp`&&ne(n,i,!0)))e.preventDefault(),e.stopPropagation(),S(),o=void 0,te(i,e.key===`ArrowUp`,!0),x();else{if(!t&&!e.altKey&&!e.shiftKey&&e.key===`ArrowRight`&&!i){let t=r?.closest(`a,code`);if(t&&ne(n,t,!1)){e.preventDefault(),e.stopPropagation(),n.setStartAfter(t),n.collapse(!0),h(n),o=new Set(Object.keys(xC).filter(e=>e!==`code`&&d(n.startContainer)?.closest(xC[e]))),b();return}}if(!t&&!e.altKey&&e.key===`Backspace`){let t=f(n.startContainer);if(t&&ne(n,t,!0)&&(t.matches(`pre,li,h1,h2,h3,h4,h5,h6`)||t.closest(`blockquote`))){e.preventDefault(),e.stopPropagation(),t.localName===`li`?re(!0):M(`paragraph`);return}}e.key===`Enter`&&!t&&!e.altKey&&(e.preventDefault(),e.stopPropagation(),N(e.shiftKey)),e.key===`Tab`&&!t&&!e.altKey&&re(e.shiftKey)&&(e.preventDefault(),e.stopPropagation()),/^(Arrow|Home|End)/.test(e.key)&&(o=void 0,u=0)}},ie=e=>{if(!(s||e.isComposing)){if(S(),e.inputType===`historyUndo`||e.inputType===`historyRedo`)e.preventDefault(),T(e.inputType===`historyUndo`?-1:1);else if(e.inputType.startsWith(`format`)){e.preventDefault();let t={formatBold:`bold`,formatItalic:`italic`,formatStrikeThrough:`strikethrough`}[e.inputType];t&&j(t)}else e.inputType===`insertParagraph`||e.inputType===`insertLineBreak`?(e.preventDefault(),N(e.inputType===`insertLineBreak`)):e.inputType===`insertText`&&o&&e.data&&(e.preventDefault(),ee(e.data,!0))}},F=()=>{s||(C(),x(!0))},ae=()=>{let t=i.getSelection();t?.rangeCount&&p(t.getRangeAt(0))&&(a=t.getRangeAt(0).cloneRange(),c[l]?.html===e.innerHTML&&(c[l].selection=_()),b())},oe={keydown:P,beforeinput:ie,input:F,pointerdown:()=>{o=void 0,u=0},paste:e=>{e.preventDefault(),e.stopPropagation(),o=void 0;let t=e.clipboardData?.getData(`text/plain`);t&&ee(t)},drop:e=>{e.preventDefault(),o=void 0;let t=e.dataTransfer?.getData(`text/plain`);t&&ee(t)},compositionstart:()=>{S(),s=!0},compositionend:()=>{s=!1,C(),x()}};for(let[t,n]of Object.entries(oe))e.addEventListener(t,n);return i.addEventListener(`selectionchange`,ae),w(t),{setHtml:w,format:j,block:M,focus:()=>h(m()),captureSelection:()=>{a=m()},link:t=>{if(!gC(t)||d(m().startContainer)?.closest(`pre`))return!1;S();let n=m();if(o=void 0,n.collapsed){let r=d(n.startContainer)?.closest(`a`);if(r&&e.contains(r))r.setAttribute(`href`,t);else{let e=i.createElement(`a`);e.setAttribute(`href`,t),e.setAttribute(`rel`,`noopener noreferrer`),e.textContent=t,n.insertNode(e),n.selectNodeContents(e),n.collapse(!1),h(n)}}else A(n,`a`,!1,{href:t,rel:`noopener noreferrer`});return x(),!0},destroy:()=>{for(let[t,n]of Object.entries(oe))e.removeEventListener(t,n);i.removeEventListener(`selectionchange`,ae),a=void 0,c=[]}}}var wC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l32 0 0 320-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l224 0c70.7 0 128-57.3 128-128 0-46.5-24.8-87.3-62-109.7 18.7-22.3 30-51 30-82.3 0-70.7-57.3-128-128-128L32 32zM288 160c0 35.3-28.7 64-64 64l-96 0 0-128 96 0c35.3 0 64 28.7 64 64zM128 416l0-128 128 0c35.3 0 64 28.7 64 64s-28.7 64-64 64l-128 0z"/></svg>`,TC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0-133.3 320 64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0 133.3-320-64 0c-17.7 0-32-14.3-32-32z"/></svg>`,EC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M96 157.5C96 88.2 152.2 32 221.5 32L368 32c17.7 0 32 14.3 32 32s-14.3 32-32 32L221.5 96c-34 0-61.5 27.5-61.5 61.5 0 31 23.1 57.2 53.9 61l44.1 5.5 222 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l83.1 0C103 204.6 96 181.8 96 157.5zM349.2 336l65.5 0c.9 6.1 1.4 12.2 1.4 18.5 0 69.3-56.2 125.5-125.5 125.5L144 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l146.5 0c34 0 61.5-27.5 61.5-61.5 0-6.4-1-12.7-2.8-18.5z"/></svg>`,DC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M360.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm64.6 136.1c-12.5 12.5-12.5 32.8 0 45.3l73.4 73.4-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0zm-274.7 0c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 150.6 182.6c12.5-12.5 12.5-32.8 0-45.3z"/></svg>`,OC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M0 64C0 46.3 14.3 32 32 32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 112 224 0 0-112-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 320 16 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-144-224 0 0 144 16 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-320-16 0C14.3 96 0 81.7 0 64z"/></svg>`,kC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l64 0 0 320-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-352c0-17.7-14.3-32-32-32L32 32z"/></svg>`,AC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M48 64c0-17.7 14.3-32 32-32l171 0c60.2 0 109 48.8 109 109 0 43.8-26.2 83.3-66.4 100.4l-139.1 59C119 315.4 96 350.2 96 388.7l0 27.3 224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L64 480c-17.7 0-32-14.3-32-32l0-59.3c0-64.2 38.4-122.2 97.5-147.3l139.1-59c16.6-7.1 27.4-23.4 27.4-41.4 0-24.9-20.2-45-45-45L80 96C62.3 96 48 81.7 48 64z"/></svg>`,jC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M48 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM48 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM96 256a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"/></svg>`,MC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M0 72C0 58.8 10.7 48 24 48l48 0c13.3 0 24 10.7 24 24l0 104 24 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-80-24 0C10.7 96 0 85.3 0 72zM30.4 301.2C41.8 292.6 55.7 288 70 288l4.9 0c33.7 0 61.1 27.4 61.1 61.1 0 19.6-9.4 37.9-25.2 49.4l-24 17.5 33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-90.7 0C13.1 464 0 450.9 0 434.7 0 425.3 4.5 416.5 12.1 411l70.5-51.3c3.4-2.5 5.4-6.4 5.4-10.6 0-7.2-5.9-13.1-13.1-13.1L70 336c-3.9 0-7.7 1.3-10.8 3.6L38.4 355.2c-10.6 8-25.6 5.8-33.6-4.8S-1 324.8 9.6 316.8l20.8-15.6zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>`,NC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M0 216C0 149.7 53.7 96 120 96l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64L0 216zm256 0c0-66.3 53.7-120 120-120l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64l0-136z"/></svg>`,PC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M0 64C0 28.7 28.7 0 64 0L213.5 0c17 0 33.3 6.7 45.3 18.7L365.3 125.3c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm208-5.5l0 93.5c0 13.3 10.7 24 24 24L325.5 176 208 58.5zM154.2 295.6c8.6-10.1 7.5-25.2-2.6-33.8s-25.2-7.5-33.8 2.6l-48 56c-7.7 9-7.7 22.2 0 31.2l48 56c8.6 10.1 23.8 11.2 33.8 2.6s11.2-23.8 2.6-33.8l-34.6-40.4 34.6-40.4zm112-31.2c-8.6-10.1-23.8-11.2-33.8-2.6s-11.2 23.8-2.6 33.8l34.6 40.4-34.6 40.4c-8.6 10.1-7.5 25.2 2.6 33.8s25.2 7.5 33.8-2.6l48-56c7.7-9 7.7-22.2 0-31.2l-48-56z"/></svg>`,FC=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z"/></svg>`;function IC({engine:e,selection:t,text:n,showLink:r,onLink:i}){let a=R(null),o=R(null),s=()=>[...a.current?.querySelectorAll(`[role="button"]:not([aria-disabled="true"])`)??[]],c=e=>{o.current=e.getAttribute(`aria-label`);for(let t of s())t.setAttribute(`tabindex`,t===e?`0`:`-1`)};L(()=>{let e=s(),t=e.find(e=>e.getAttribute(`aria-label`)===o.current)??e[0];t&&c(t)});let l=(n,r,i)=>({id:n,label:r,icon:i,pressed:t.formats.includes(n),disabled:t.block===`code`,run:()=>e()?.format(n)}),u=(n,r,i,a)=>({id:n,label:r,icon:i,suffixIcon:a,pressed:t.block===n,run:()=>e()?.block(t.block===n?`paragraph`:n)}),d=[{label:n.inlineFormatting,actions:[l(`bold`,n.bold,wC),l(`italic`,n.italic,TC),l(`strikethrough`,n.strike,EC),l(`code`,n.code,DC)]},{label:n.headings,actions:[u(`h1`,n.heading1,OC,kC),u(`h2`,n.heading2,OC,AC)]},{label:n.structure,actions:[u(`bullet`,n.bullets,jC),u(`ordered`,n.numberedList,MC),u(`quote`,n.quote,NC),u(`code`,n.codeBlock,PC)]},{label:n.links,actions:[{id:`link`,label:n.link,icon:FC,pressed:r||t.link,disabled:t.block===`code`,run:i}]}];return z(`div`,{ref:a,class:`rv-rich-text-editor__toolbar`,role:`toolbar`,"aria-label":n.formatting,onMouseDown:e=>{e.target.closest(`[role="button"]`)&&e.preventDefault()},onFocusCapture:e=>{e.target instanceof SVGElement&&e.target.matches(`[role="button"]`)&&c(e.target)},onKeyDown:t=>{if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),e()?.focus();return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key)||t.altKey||t.ctrlKey||t.metaKey)return;let n=s(),r=n.indexOf(t.target);if(r<0||!n.length)return;t.preventDefault(),t.stopPropagation();let i=getComputedStyle(a.current).direction===`rtl`,o=t.key===`ArrowRight`===i?-1:1;(t.key===`Home`?n[0]:t.key===`End`?n.at(-1):n[(r+o+n.length)%n.length]).focus()},children:d.map(t=>z(AS,{label:t.label,actions:t.actions,onEscape:()=>e()?.focus(),onAction:e=>t.actions.find(t=>t.id===e)?.run()},t.label))})}function LC(e,t=document){if(!e)return``;let n=t.createElement(`template`);n.innerHTML=e;let r=new Set([`p`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`blockquote`,`ul`,`ol`,`li`,`pre`]),i=e=>{let n=t.createElement(`div`);return n.append(e.cloneNode(!0)),n.innerHTML},a=(e,t)=>{let n=[],o=` `.repeat(t),s=``,c=()=>{s.trim()&&n.push(o+s),s=``};for(let l of e){if(l.nodeType!==1||!r.has(l.localName)){s+=i(l);continue}c();let e=l,u=[...e.childNodes].every(e=>e.nodeType===1?r.has(e.localName):e.nodeType===3&&!e.textContent?.trim());if(e.localName!==`pre`&&e.children.length&&u){let r=e.cloneNode(!1),i=r.outerHTML.slice(0,r.outerHTML.indexOf(`>`)+1);n.push(o+i,...a([...e.childNodes],t+1),`${o}</${e.localName}>`)}else n.push(o+e.outerHTML)}return c(),n};return a([...n.content.childNodes],0).join(`
670
+ `)}var RC={keyboardHelp:`Shift+Enter for a line break. Alt+F10 for formatting; Esc returns to text.`,codeHelp:`Code: Enter for a new line. Press Enter three times or ↓ at the end to continue outside.`,visual:`Visual`,source:`HTML`,label:`Rich text`,unsafeLink:`Use an HTTP, HTTPS, mailto or relative link.`,requiredValue:`Enter a value.`,tooLong:`The value exceeds the maximum length.`,link:`Add link`,linkUrl:`Link URL`,popupLabel:`Edit rich text`,formatting:`Text formatting`,inlineFormatting:`Inline formatting`,headings:`Headings`,structure:`Lists and blocks`,links:`Links`,bold:`Bold`,italic:`Italic`,strike:`Strike`,code:`Code`,heading1:`H1`,heading2:`H2`,bullets:`Bullets`,numberedList:`Numbered list`,quote:`Quote`,codeBlock:`Code block`};function zC(e){let[t]=I(()=>Rt(`rv-rich-text-help`)),n=R(e.value),r={...RC,...e.text},i=qe(()=>yC(e.value),[e.value]),[a,o]=I(i),s=qe(()=>yC(a),[a]),[c,l]=I(`visual`),[u,d]=I(``),[f,p]=I(bC),[m,h]=I(``),[g,_]=I(!1),v=R(!1),y=R(null),b=R(),x=R(a);x.current=a,Ke(()=>{if(y.current)return b.current=CC(y.current,x.current,e=>{v.current=!0,x.current=e,o(e),d(``)},p),()=>{b.current?.destroy(),b.current=void 0}},[]),Ke(()=>{n.current!==e.value&&(n.current=e.value,v.current=!1,x.current=c===`source`?(e.formatSource??LC)(i):i,o(x.current),d(``),_(!1),b.current?.setHtml(i))},[e.value,i]);let S=t=>e.required&&!t?`requiredValue`:e.maxLength!==void 0&&t.length>e.maxLength?`tooLong`:void 0,C=()=>{let t=yC(x.current),n=S(t);return n?(d(r[n]),!1):(e.onApply(t),!0)};Gs(()=>!v.current||x.current===i||C(),e.autoApply!==!1);let w=!!S(s);return z(`div`,{class:`rv-rich-text-editor`,onKeyDown:e=>{e.altKey&&e.key===`F10`&&c===`visual`&&(e.preventDefault(),e.stopPropagation(),b.current?.captureSelection(),e.currentTarget.querySelector(`[role="toolbar"] [role="button"][tabindex="0"]`)?.focus()),(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&!e.isComposing&&(e.preventDefault(),e.stopPropagation(),C())},children:[z(Pr,{value:c,ariaLabel:r.label,options:[{value:`visual`,label:r.visual},{value:`source`,label:r.source}],onChange:t=>{if(t===`visual`){let e=yC(x.current);x.current=e,o(e),b.current?.setHtml(e)}else{b.current?.captureSelection();let t=(e.formatSource??LC)(x.current);x.current=t,o(t)}l(t),d(``)}}),c===`visual`&&z(IC,{engine:()=>b.current,selection:f,text:r,showLink:g,onLink:()=>{b.current?.captureSelection(),_(!g)}}),g&&c===`visual`&&z(`div`,{class:`rv-rich-text-editor__link`,children:[z(cr,{"aria-label":r.linkUrl,value:m,onInput:e=>h(e.currentTarget.value)}),z(B,{onMouseDown:e=>e.preventDefault(),onClick:()=>{b.current?.link(m)?(_(!1),d(``)):d(r.unsafeLink)},children:r.link})]}),z(`div`,{ref:y,hidden:c!==`visual`,class:`rv-rich-text-editor__visual`,role:`textbox`,"aria-label":r.label,"aria-multiline":`true`,"aria-describedby":t,"aria-invalid":w||void 0,contentEditable:!0,onClick:e=>{e.target.closest(`a`)&&e.preventDefault()}}),c===`visual`&&z(`p`,{id:t,class:`rv-rich-text-editor__help`,children:f.block===`code`?r.codeHelp:r.keyboardHelp}),c===`source`&&z(bu,{className:`rv-rich-text-editor__source`,"aria-label":r.source,"aria-invalid":w||void 0,value:a,wrap:`off`,highlight:z(F,{children:[z(dC,{code:a}),a.endsWith(`
671
+ `)?` `:``]}),onInput:e=>{v.current=!0,x.current=e.currentTarget.value,o(e.currentTarget.value),d(``)}}),u&&z(`p`,{class:`rv-editor-error`,role:`alert`,children:u}),z(Us,{showConfirm:e.showActions??e.autoApply===!1,text:e.actions,disabled:w,cancel:e.onCancel,apply:C,clear:e.required?void 0:()=>{v.current=!0,x.current=``,o(``),b.current?.setHtml(``),d(``),e.autoApply!==!1&&C()}})]})}var BC={date:`Date`,dates:`Dates`,invalidDate:`Enter a valid date in the indicated format.`,outOfRange:`The date is outside the allowed range.`,disabledDate:`This date is unavailable.`,invalidRange:`Enter a complete range with the start before or equal to the end.`,selectionCount:`The selection does not meet the allowed count or length.`,requiredValue:`A value is required.`,startDate:`Start date`,endDate:`End date`,startTime:`Start time`,endTime:`End time`,time:`Time`,hours:`Hour`,minutes:`Minute`,seconds:`Second`,dayPeriod:`Period`,noTimes:`No available times.`,invalid:`Enter a valid value within the allowed range.`,chooseDate:`Choose date`,chooseTime:`Choose time`};function VC(e,t){return(e===`time`?t?.chooseTime:t?.chooseDate)??(e===`time`?BC.chooseTime:BC.chooseDate)}function HC(e,t,n=``){let{kind:r=`date`,selection:i=`single`,value:a,calendar:o={}}=e,s={...BC,...e.text},c=a&&!Array.isArray(a)&&typeof a==`object`?a:void 0,l=typeof a==`string`?a:``,u=c?.from??``,d=c?.to??``,f=e.required??o.required??!1,p=c?[u,d]:Array.isArray(a)?a:l?[l]:[],m=e=>yc(e)&&(!o.minDate||e>=o.minDate)&&(!o.maxDate||e<=o.maxDate)&&!o.isDateDisabled?.(e)&&!o.isMonthDisabled?.(H(e,o.calendarSystem)),h=t=>Qc(r,t)&&(r===`time`||m(Jc(t)))&&(r===`date`||el(Yc(t),{min:e.minTime,max:e.maxTime,step:e.timeStep})),g=c&&d?jc(Jc(u),Jc(d)):0,_=i===`multiple`?p.length:g,v=!p.length&&!f||i===`single`||(!o.min||_>=o.min)&&(o.max===void 0||_<=o.max),y=(()=>{if(r===`time`||!c?.to||!o.excludeDisabled||!p.every(h))return!0;if(g>366e3)return!1;for(let e=Jc(u);e<=Jc(d);e=Ac(e,1))if(!m(e))return!1;return!0})(),b=``,x=r===`time`||p.every(e=>{let n=Jc(e);if(!yc(n))return!1;let r=o.validateSelection?.(n,{month:o.month??t,view:o.defaultView??`month`,referenceDate:o.referenceDate,selection:c?{from:Jc(u),to:Jc(d||u)}:{from:n,to:n}});return typeof r==`string`&&(b=r),r!==!1&&typeof r!=`string`}),S=!n&&v&&x&&y&&(!f||p.length>0)&&p.every(h)&&(i!==`multiple`||new Set(p).size===p.length)&&(!c||!!d&&u<=d)&&(i!==`multiple`||r===`date`),C=t=>e.text?.[t]??e.text?.invalid??s[t]??s.invalid,w=r===`time`?[]:p.map(Jc);return{valid:S,errorMessage:n||b||(!p.length&&f?C(`requiredValue`):c&&(!u||!d)?C(`invalidRange`):w.some(e=>!yc(e))?C(`invalidDate`):w.some(e=>o.minDate&&e<o.minDate||o.maxDate&&e>o.maxDate)?C(`outOfRange`):w.some(e=>!m(e))||!y?C(`disabledDate`):c&&(!d||u>d)?C(`invalidRange`):!v||i===`multiple`&&new Set(p).size!==p.length?C(`selectionCount`):s.invalid),validDate:m}}function UC({value:e,label:t,format:n=`locale`,precision:r=`minute`,locale:i,min:a,max:o,step:s,onChange:c}){let[l,u]=I(!1),[d,f]=I(``);if(n===`locale`)return z(cr,{type:`time`,"aria-label":t,value:e,min:a,max:o,step:s??(r===`second`?1:60),onInput:e=>c(e.currentTarget.value)});let p=tl(e,n,r,i);return z(cr,{type:`text`,"aria-label":t,value:l?d:p,"aria-invalid":!!e&&!el(e,{min:a,max:o,step:s}),placeholder:n===`12h`?`09:00 AM`:`09:00`,onFocus:()=>{u(!0),f(p)},onBlur:()=>u(!1),onInput:e=>{let t=e.currentTarget.value;f(t),c(t?nl(t,r,i)??t:``)}})}function WC({label:e,accessibleLabel:t,values:n,selected:r,choices:i,display:a,onSelect:o}){let s=R(null),c=r!==void 0&&i.has(r),l=c?r:n.find(e=>i.has(e));L(()=>{let e=s.current;if(!e)return;let t=()=>{let t=e.querySelector(`[aria-selected="true"], [tabindex="0"]`);t&&e.clientHeight&&(e.scrollTop=t.offsetTop-(e.clientHeight-t.clientHeight)/2)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r,l]);let u=e=>{let t=i.get(Number(e));t!==void 0&&o(t)};return z(`div`,{class:`rv-time-selection__column`,children:[e&&z(`span`,{class:`rv-time-selection__label`,children:e}),z(Rr,{label:t,listRef:s,variant:`plain`,className:`rv-time-selection__list`,onSelect:u,children:n.map(e=>z(zr,{value:String(e),selected:r===e&&c,disabled:!i.has(e),tabIndex:e===l?0:-1,onClick:()=>u(String(e)),children:a(e)},e))})]})}function GC({value:e,label:t,text:n,onChange:r,format:i=`locale`,precision:a=`minute`,locale:o,min:s,max:c,step:l,collapsible:u=!1}){let[d,f]=I(!1),p=Xe(),m=dl(i,o),h=qe(()=>ll({min:s,max:c,step:l,precision:a}),[s,c,l,a]),g=qe(()=>pl(h,e,m),[h,e,m]),_=qe(()=>new Intl.NumberFormat(o,{minimumIntegerDigits:2,useGrouping:!1}),[o]),v=e=>r(ul(e,a)),y=(e,n,r,i=e=>_.format(e))=>z(WC,{label:e===`period`?void 0:n,accessibleLabel:`${t}: ${n}`,values:r,selected:g.hasValue?g[e]:void 0,choices:g.columns[e],display:i,onSelect:v}),b=(e,t=0)=>Array.from({length:e},(e,n)=>t+n);return z(`section`,{class:`rv-time-selection`,children:[z(`div`,{class:`rv-time-selection__entry-row`,children:[z(`label`,{class:`rv-time-selection__entry`,children:[z(`span`,{children:t}),z(UC,{value:e,label:t,format:i,precision:a,locale:o,min:s,max:c,step:l,onChange:r})]}),u&&z(B,{variant:`ghost`,className:`rv-time-selection__toggle`,"aria-label":n.chooseTime??n.time,"aria-expanded":d,"aria-controls":d?p:void 0,onClick:()=>f(!d),children:z(Kt,{svg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/></svg>`})})]}),(!u||d)&&z(`div`,{id:p,class:`rv-time-selection__clock`,children:[z(`div`,{class:`rv-time-selection__columns${a===`second`?` rv-time-selection__columns--seconds`:``}`,children:[y(`hour`,n.hours,b(m?12:24,m?g.period*12:0),e=>_.format(m?e%12||12:e)),y(`minute`,n.minutes,b(60)),a===`second`&&y(`second`,n.seconds,b(60))]}),m&&z(`div`,{class:`rv-time-selection__period`,children:y(`period`,n.dayPeriod,[0,1],e=>fl(e,o))}),!h.length&&z(`p`,{class:`rv-time-selection__empty`,role:`status`,children:n.noTimes})]})]})}function KC(e){let{kind:t=`date`,selection:n=`single`,value:r,onChange:i,calendar:a={}}=e,o=(a.numberOfMonths??1)>=2,s={...BC,...e.text},[c]=I(()=>Rt(`rv-date-error`)),l=e=>t===`date`?e:Jc(e),u={locale:a.locale,...typeof e.dateInput==`object`?e.dateInput:{}},[d,f]=I(e.endpoint===`to`?`to`:void 0),[p,m]=I(``),h=r&&!Array.isArray(r)&&typeof r==`object`?r:void 0,g=typeof r==`string`?r:``,_=Array.isArray(r)?r:[],v=h?.from??``,y=h?.to??``,b=Jc(t===`time`?Nc():e.endpoint===`to`?y:v||g||_[0]||``),[x,S]=I(()=>a.defaultMonth??H(yc(b)?b:Nc(),a.calendarSystem)),C=e.required??a.required??!1,{valid:w,errorMessage:T,validDate:E}=HC(e,x,p);L(()=>e.onValidityChange?.(!!w),[w]);let D=(t,n=!1)=>{m(``),i(t),(e.onValidChange||n)&&HC({...e,value:t},x).valid&&(e.onValidChange?.(t),n&&e.onSelectionComplete?.(t))},O=e=>{D(e,t===`date`&&n!==`multiple`)},k=e=>{if(!E(e))return;let t=H(e,a.calendarSystem);t!==(a.month??x)&&(S(t),a.onMonthChange?.(t))},A=(e,n)=>{if(typeof n!=`string`)return;k(n);let r={from:v,to:y,[e]:n?Xc(n,e===`from`?v:y,t):``};D(!r.from&&!r.to?null:r)},j=(t,n,r,i=!0)=>z(`label`,{class:`rv-temporal-picker__time${i?``:` rv-temporal-picker__time--single`}`,children:[i&&z(`span`,{children:n}),z(UC,{label:n,value:t?Yc(t):``,min:e.minTime,max:e.maxTime,step:e.timeStep,precision:e.precision,format:e.timeFormat,locale:a.locale,onChange:r})]}),M={...a,month:a.month??x,onMonthChange:e=>{S(e),a.onMonthChange?.(e)},required:C,onInvalidSelection:(e,t)=>{m(e||s.invalid),a.onInvalidSelection?.(e,t)}},ee;if(n===`multiple`)ee={...M,mode:`multiple`,selected:_.filter(yc),onSelectionChange:e=>O([...e])};else if(n===`range`&&!d)ee={...M,mode:`range`,selected:v&&yc(Jc(v))?{from:Jc(v),...y&&yc(Jc(y))?{to:Jc(y)}:{}}:void 0,onSelectionChange:e=>O(e?{from:Xc(e.from,v,t),...e.to?{to:Xc(e.to,y,t)}:{}}:null)};else{let e=n===`range`?d===`to`?y:v:g;ee={...M,mode:`single`,selected:e&&yc(Jc(e))?Jc(e):void 0,onSelectionChange:r=>{O(n===`range`?r?{from:v,to:y,[d??`from`]:Xc(r,e,t)}:null:r?Xc(r,g,t):null)}}}return z(`div`,{class:`rv-temporal-picker rv-temporal-picker--${t}${o?` rv-temporal-picker--multi-month`:``}`,children:[e.dateInput===!1&&n===`range`&&t!==`time`&&z(`div`,{class:`rv-temporal-picker__endpoints ${e.classNames?.endpoints??``}`,children:[z(B,{"aria-label":`${s.startDate}: ${v}`,"aria-pressed":d!==`to`,onClick:()=>{f(void 0),v&&S(H(Jc(v),a.calendarSystem)),m(``)},children:v?Jc(v):`—`}),z(B,{"aria-label":`${s.endDate}: ${y}`,"aria-pressed":d===`to`,onClick:()=>{f(`to`),y&&S(H(Jc(y),a.calendarSystem)),m(``)},children:y?Jc(y):`—`})]}),z(`div`,{class:`rv-temporal-picker__header`,children:t!==`time`&&e.dateInput!==!1&&z(`div`,{class:`rv-temporal-picker__dates ${n===`range`?`rv-temporal-picker__endpoints ${e.classNames?.endpoints??``}`:``}`,children:n===`range`?z(F,{children:[z(`div`,{class:`rv-temporal-picker__endpoint`,role:`group`,"aria-label":s.startDate,children:[z(ql,{label:s.startDate,value:l(v),options:u,invalid:!w,errorId:c,onFocus:()=>f(void 0),onChange:e=>A(`from`,e)}),t===`datetime`&&j(v,s.startTime,e=>D({from:Zc(v,e,t),...y?{to:y}:{}}),!1)]}),z(`div`,{class:`rv-temporal-picker__endpoint`,role:`group`,"aria-label":s.endDate,children:[z(ql,{label:s.endDate,value:l(y),options:u,invalid:!w,errorId:c,onFocus:()=>f(`to`),onChange:e=>A(`to`,e)}),t===`datetime`&&j(y,s.endTime,e=>D({from:v,to:Zc(y,e,t)}),!1)]})]}):z(ql,{label:n===`multiple`?s.dates:s.date,value:n===`multiple`?_:l(g),multiple:n===`multiple`,options:u,invalid:!w,errorId:c,onChange:e=>{typeof e==`string`&&k(e),D(Array.isArray(e)?e:e?Xc(e,g,t):null)}})})}),z(`div`,{class:`rv-temporal-picker__body`,children:[t!==`time`&&z(Ol,{...ee}),t!==`date`&&n!==`range`&&z(GC,{collapsible:t===`datetime`&&o,value:Yc(g),label:s.time,text:s,format:e.timeFormat,precision:e.precision,locale:a.locale,min:e.minTime,max:e.maxTime,step:e.timeStep,onChange:e=>D(Zc(g,e,t))})]}),t!==`date`&&n===`range`&&(t===`time`||e.dateInput===!1)&&z(`div`,{class:`rv-temporal-picker__times`,children:[t===`time`?z(GC,{value:Yc(v),label:s.startTime,text:s,format:e.timeFormat,precision:e.precision,locale:a.locale,min:e.minTime,max:e.maxTime,step:e.timeStep,onChange:e=>D({from:e,...y?{to:y}:{}})}):j(v,s.startTime,e=>D({from:Zc(v,e,t),...y?{to:y}:{}})),t===`time`?z(GC,{value:Yc(y),label:s.endTime,text:s,format:e.timeFormat,precision:e.precision,locale:a.locale,min:e.minTime,max:e.maxTime,step:e.timeStep,onChange:e=>D({from:v,to:e})}):j(y,s.endTime,e=>D({from:v,to:Zc(y,e,t)}))]}),!w&&z(Ti,{tone:`danger`,children:z(`span`,{id:c,children:T})})]})}function qC(e,t,n,{gap:r=4,inset:i=8,fitViewport:a=!1}={}){let o=Math.max(0,n.height-i-e.bottom-r),s=Math.max(0,e.top-i-r),c=t.height<=o||o>=s?`below`:`above`,l=c===`below`?o:s,u=a&&t.height>l?Math.max(l,n.height-2*i):l,d=Math.min(t.height,u),p=c===`below`?e.bottom+r:e.top-d-r;return{...f(e,t,n,r,i),placementY:c,maxHeight:u,top:u>l?Math.max(i,Math.min(p,n.height-i-d)):p}}var JC=new WeakMap;function YC(e,t,n){let r=e.ownerDocument,i=r.defaultView;JC.get(r)?.close();let a=!1,o,s=e=>(o=e,()=>{o===e&&(o=void 0)}),c=()=>{a||(a=!0,_.disconnect(),g?.disconnect(),r.removeEventListener(`pointerdown`,u,!0),r.removeEventListener(`keydown`,d,!0),r.removeEventListener(`scroll`,f,!0),i.removeEventListener(`resize`,c),At(p,m),gt(p),p.remove(),JC.get(r)?.element===p&&JC.delete(r),n.onClose?.(),e.isConnected&&e.focus({preventScroll:!0}))},l=e=>e?Dt(p,e):!1,u=t=>{let r=t.target;l(r)||e.contains(r)||n.trigger?.contains(r)||(n.isAvailable&&!n.isAvailable()?c():o?.()===!1?(t.preventDefault(),t.stopPropagation()):c())},d=e=>{if(e.key===`Escape`){if(p.querySelector(`[aria-expanded="true"]`))return;e.preventDefault(),e.stopPropagation(),c()}if(e.key===`Tab`&&p.contains(e.target)){let t=[...p.querySelectorAll(`button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[contenteditable="true"],[tabindex="0"]`)].filter(e=>e.tabIndex>=0&&e.getClientRects().length),n=t[0],i=t.at(-1);e.shiftKey&&r.activeElement===n?(e.preventDefault(),i?.focus()):!e.shiftKey&&r.activeElement===i&&(e.preventDefault(),n?.focus())}},f=t=>{let n=t.target;l(n)||n&&(n.contains(e)||v?.contains(n))&&h()},p=ht(r,z(`div`,{class:`rv-editor-popup ${n.className??``}`,role:`dialog`,"aria-label":n.label,onKeyDown:e=>e.stopPropagation(),onKeyUp:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:z(Ws.Provider,{value:s,children:t(c)})}));p.style.direction=i.getComputedStyle(e).direction,(e.closest(`dialog, [role="dialog"], [role="menu"]`)??e.closest(`revo-grid`)??r.body).append(p);let m=kt(p,`block`),h=()=>{p.style.maxHeight=``;let t=qC(e.getBoundingClientRect(),p.getBoundingClientRect(),{width:i.innerWidth,height:i.innerHeight},{fitViewport:n.fitViewport});p.style.maxHeight=`${t.maxHeight}px`,p.style.left=`${t.left}px`,p.style.top=`${t.top}px`,p.dataset.placement=t.placementY};h();let g=typeof i.ResizeObserver==`function`?new i.ResizeObserver(h):void 0;g?.observe(p),g?.observe(e);let _=new MutationObserver(()=>{(!e.isConnected||!p.isConnected||n.isAvailable&&!n.isAvailable())&&c()});_.observe(r.body,{childList:!0,subtree:!0});let v=e.closest(`revo-grid`);v&&n.isAvailable&&_.observe(v,{attributes:!0}),r.addEventListener(`pointerdown`,u,!0),r.addEventListener(`keydown`,d,!0),r.addEventListener(`scroll`,f,!0),i.addEventListener(`resize`,c);let y={element:p,close:c};return JC.set(r,y),p.querySelector(`[autofocus],input,textarea,button,[tabindex="0"]`)?.focus({preventScroll:!0}),y}function XC({value:e,options:t,apply:n,cancel:r,onValidChange:i,clearable:a=!0}){let[o,s]=I(e),[c,l]=I(!1),[u,d]=I(``),f=e=>{s(e),d(``)},p=t.autoApply!==!1,m=JSON.stringify(o)!==JSON.stringify(e),h=e=>{let t=n(e)||``;return d(t),!t},g=()=>c?h(o):!1;return Gs(()=>!m||g(),p),z(`div`,{class:`rv-temporal-draft${t.kind===`time`?` rv-temporal-draft--time`:``}`,onKeyDown:e=>{e.key===`Enter`&&!e.isComposing&&(e.ctrlKey||e.metaKey||p&&e.target instanceof HTMLInputElement)&&(e.preventDefault(),g())},children:[z(KC,{...t,value:o,onChange:f,onValidChange:i,onValidityChange:l,onSelectionComplete:p?h:void 0}),u&&z(Ti,{tone:`danger`,children:u}),z(Us,{text:t.actions,showConfirm:t.showActions??!p,disabled:!c,apply:g,cancel:r,clear:!a||(t.required??t.calendar?.required)?void 0:()=>{let e=t.selection===`multiple`?[]:null;f(e),p&&h(e)}})]})}function ZC({value:e,kind:t=`date`,picker:n,livePickerUpdates:r,onValueChange:i,onInput:a,formatValue:o,parseValue:s,...c}){let l=R(null),u=R(),d=R({value:e,kind:t,picker:n,onValueChange:i,input:c});return d.current={value:e,kind:t,picker:n,onValueChange:i,input:c},L(()=>()=>u.current?.close(),[]),L(()=>{(c.disabled||c.readOnly)&&u.current?.close()},[c.disabled,c.readOnly]),z(`span`,{class:`rv-date-time-field`,children:[z(cr,{...c,type:`text`,value:o?.(e)??e,placeholder:c.placeholder??(t===`date`?`YYYY-MM-DD`:t===`time`?`HH:mm`:`YYYY-MM-DDTHH:mm`),onInput:e=>{a?.(e);let t=s?s(e.currentTarget.value):e.currentTarget.value;t!==void 0&&i?.(t)}}),z(B,{ref:l,variant:`ghost`,"aria-label":VC(t,n?.text),disabled:c.disabled||c.readOnly,onClick:()=>{if(!l.current)return;if(u.current){u.current.close();return}let i,a=e=>{let t=typeof e==`string`?e:``;t===i||d.current.input.disabled||d.current.input.readOnly||(i=t,d.current.onValueChange?.(t))};u.current=YC(l.current,i=>z(XC,{value:e||null,options:{...n,calendar:{fixedWeeks:!0,...n?.calendar},required:n?.required??c.required,kind:t,selection:`single`},cancel:i,onValidChange:r&&n?.autoApply!==!1?a:void 0,apply:e=>{a(e),i()}}),{label:VC(t,n?.text),fitViewport:t===`datetime`,className:t===`time`?`rv-editor-popup--time`:t===`datetime`?`rv-editor-popup--datetime`:void 0,onClose:()=>{u.current=void 0}})},children:z(Kt,{svg:t===`time`?la:Kl})})]})}function QC(e){let t=new Map;if(Array.isArray(e))for(let n of e)n&&(typeof n.value==`string`||typeof n.value==`number`)&&t.set(n.value,{value:n.value,units:n.units});return[...t.values()]}function $C(e){return Number.isFinite(e)&&e>=0}function ew(e,t,n,r){let i=new Map(t.map(e=>[e.value,e])),a=new Set(e.map(e=>e.value)),o=e.filter(e=>!i.has(e.value)||i.get(e.value)?.disabled||n.has(e.value));for(let e of t)n.has(e.value)&&!a.has(e.value)&&!e.disabled&&o.push({value:e.value,units:r});return o}function tw(e,t){return t===0?String(e):`${e} ${t}%`}function nw(e){let t=e.text,n=e.value.every(e=>$C(e.units));return z(`div`,{id:e.id,class:`rv-assignee-picker`,role:`dialog`,"aria-label":t?.dialogLabel??`Assign people`,onKeyDown:t=>{(t.ctrlKey||t.metaKey)&&t.key===`Enter`&&(t.preventDefault(),t.stopPropagation(),e.value.every(e=>$C(e.units))&&e.apply()),t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e.cancel())},children:[z(Bl,{resources:e.options.map(e=>({...e,id:e.value,name:e.name??e.label})),selectedResourceIds:e.value.map(e=>e.value),classNames:{avatar:e.showAvatars===!1?`rv-assignee-avatar--hidden`:void 0},preserveOrder:!0,isResourceDisabled:e=>!!e.disabled,text:{groupAriaLabel:t?.label??`Assignees`,searchAriaLabel:t?.searchLabel??`Search assignees`,searchPlaceholder:t?.searchPlaceholder??`Search name or role…`,emptySearch:t?.empty??`No assignees found`,emptyResources:t?.empty??`No assignees found`},onChange:t=>e.change(ew(e.value,e.options,new Set(t),e.defaultUnits))}),z(`div`,{class:`rv-assignee-picker__allocations`,children:e.value.map(n=>{let r=e.options.find(e=>e.value===n.value),i=r?.name??r?.label??String(n.value);return z(`label`,{children:[z(`span`,{children:i}),z(cr,{type:`number`,min:0,step:`any`,disabled:r?.disabled,"aria-label":t?.unitsLabel?.(i)??`Units for ${i}`,value:Number.isFinite(n.units)?String(n.units):``,onInput:t=>e.change(e.value.map(e=>e.value===n.value?{...e,units:t.currentTarget.valueAsNumber}:e))})]},`${typeof n.value}:${n.value}`)})}),z(`div`,{class:`rv-assignee-picker__footer`,children:[z(`span`,{"aria-live":`polite`,children:t?.selected?.(e.value.length)??`${e.value.length} selected`}),z(Us,{showConfirm:e.showActions??e.autoApply===!1,apply:e.apply,cancel:e.cancel,disabled:!n,text:{apply:t?.apply??`Save`,cancel:t?.cancel??`Cancel`}})]}),!n&&z(`p`,{role:`alert`,children:t?.invalidUnits??`Units must be a non-negative number.`})]})}function rw({value:e,options:t,theme:n,renderPicker:r,renderValue:i,save:a,cancel:o}){let[s,c]=I(()=>QC(e)),l=R(s),u=R(!1),d=e=>{l.current=e,c(e)},f=()=>l.current.every(e=>$C(e.units))?(u.current=!0,a(l.current),!0):!1,p=t.autoApply!==!1,m=new Map(t.source.map(e=>[e.value,e])),h=[...t.source,...s.filter(e=>!m.has(e.value)).map(e=>({value:e.value,label:String(e.value)}))],g=$C(t.defaultUnits??100)?t.defaultUnits??100:100;return z(Gn,{source:h,value:s.map(e=>e.value),className:`rv-assignee-editor`,placeholder:t.text?.placeholder??`Assign people…`,config:{multiSelect:!0,autoOpen:!0,autoFocus:!0,topLayer:!0,ariaLabel:t.text?.label??`Assignees`,removeLabel:t.text?.removeLabel,popupClassName:`rv-assignee-picker-menu edit-input-wrapper`,theme:n},renderValue:(e,t)=>{let n=s.find(e=>e.value===t.value)?.units??0;return i?i(e,t,n):tw(t.name??t.label,n)},onChange:e=>{let t=new Set(Array.isArray(e)?e:[e]);d(l.current.filter(e=>t.has(e.value)))},beforeOutsideClose:p?()=>l.current.every(e=>$C(e.units))?JSON.stringify(l.current)===JSON.stringify(QC(e))||f():!1:void 0,onClose:()=>{u.current||o()},renderContent:({id:e,close:i})=>{let a={id:e,options:t.source,value:s,change:d,autoApply:p,showActions:t.showActions,theme:n,defaultUnits:g,showAvatars:t.showAvatars,text:t.text,apply:f,cancel:()=>i(!1)};return r?r(a):z(nw,{...a})}})}function iw({query:e,onQueryChange:t,searchRef:n,children:r,...i}){return z(`div`,{id:i.id,class:`rv-assignee-picker`,role:`dialog`,"aria-label":i.text?.dialogLabel??`Assign people`,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),i.value.every(e=>$C(e.units))&&i.apply()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i.cancel())},children:[z(`div`,{class:`rv-assignee-picker__search`,children:z(nc,{inputRef:n,autoFocus:!0,"aria-label":i.text?.searchLabel??`Search assignees`,placeholder:i.text?.searchPlaceholder??`Search name or role…`,value:e,onValueChange:t})}),r,!i.options.some(t=>`${t.name??``} ${t.label} ${t.role??``}`.toLocaleLowerCase().includes(e.trim().toLocaleLowerCase()))&&z(`p`,{role:`status`,children:i.text?.empty??`No assignees found`}),z(`div`,{class:`rv-assignee-picker__footer`,children:[z(`span`,{"aria-live":`polite`,children:i.text?.selected?.(i.value.length)??`${i.value.length} selected`}),z(Us,{showConfirm:i.showActions??i.autoApply===!1,apply:i.apply,cancel:i.cancel,disabled:i.value.some(e=>!$C(e.units)),text:{apply:i.text?.apply??`Save`,cancel:i.text?.cancel??`Cancel`}})]}),i.value.some(e=>!$C(e.units))&&z(Ti,{tone:`danger`,children:i.text?.invalidUnits??`Units must be a non-negative number.`})]})}var aw={AiChat:xa,AiChatContent:Sa,AiChatComposer:wa,AiChatEmptyState:Ca,AiMessage:Ta,AiMessageContent:Ea,AiMessageActions:Da,AiReasoning:Na,AiTask:ja,AiTaskItem:Ma,AiPromptInput:ha,AiSuggestions:ga,AiActionStatus:_a,AiResult:va,AiResultView:pt,AiResultTable:ut,AiResultMetrics:dt,AiResultText:ft,AiChangePreview:ba,AiAssistant:ya,AiRequestTrail:Xa,Input:cr,SvgIcon:Kt,SvgButton:Mr,DeleteButton:Rn,RemoveButton:zn,Checkbox:Ys,Switch:Xs,SegmentedSwitch:Pr,ChoiceChips:Qs,ChoiceChipInfoButton:$s,ChoiceChip:ec,SearchInput:nc,FilterChip:rc,FormField:ac,DisclosureSummary:sc,EditorSplitLayout:Ir,EditorPane:Lr,EditorList:Rr,EditorListItem:zr,EditorListItemContent:Br,EditorListGroup:Vr,Calendar:Dl,CalendarHeader:bl,CalendarWeekdays:xl,CalendarDay:Cl,CalendarMonthGrid:wl,CalendarYearGrid:Tl,CalendarPicker:Ol,SharedResourcePicker:Bl,ResourcePickerAvatar:Ll,ColorPalette:As,ColorPicker:Is,Dropdown:Gn,DropdownPopup:kn,DropdownPopupContent:Fn,PreactRangeSlider:Ul,SingleValueSlider:Wl,SliderField:Gl,IconButton:Ei,ToggleButton:Di,ButtonGroup:Oi,SegmentedControl:ki,Tabs:Ai,TabPanel:ji,RadioGroup:Mi,TextInput:Ni,Textarea:Pi,NumberInput:Fi,NumberStepper:Ii,DateInput:Li,TimeInput:Ri,DateTimeInput:zi,Chip:Bi,FieldHint:Vi,FieldError:Hi,FormSection:Ui,Disclosure:Wi,CollapsibleSection:Uu,LookupField:Ks,Panel:Gi,Toolbar:Ki,ToolbarGroup:qi,ToolbarSeparator:Ji,Badge:Ci,CountBadge:Yi,Spinner:Xi,LoadingOverlay:Zi,EmptyState:Qi,Menu:$i,MenuItem:ea,MenuSeparator:ta,Submenu:na,ResizeHandle:ra,Pagination:ia,CircularProgress:aa,Rating:oa,Button:B,Pane:Lr,SplitLayout:Ir,Alert:Ti,Listbox:Rr,ListboxOption:zr,ListboxGroup:Vr,ListboxOptionContent:Br,StatusFeedbackPanel:qa,StatusBadge:Ja,Combobox:Jl,MultiSelect:Yl,Avatar:Xl,ProgressBar:Zl,Popover:Ql,Tooltip:$l,Dialog:eu,ConfirmDialog:tu,DatePicker:nu,DateRangePicker:ru,DialogHeader:Gr,DialogBody:qr,DialogFooter:Jr,DistributionChart:hu,BarChart:fu,LineChart:pu,AreaChart:mu,BrushRange:vu,OptionButton:yu,HighlightedTextInput:bu,InlineFieldGroup:xu,Legend:jS,TimeGrid:wu,FieldIcon:Du,FieldSummary:Ou,FieldLibrary:ku,FieldGroupHeading:Au,FieldGroup:ju,FieldList:Mu,FieldRow:Nu,FieldContent:Pu,FieldItem:Fu,FieldLibraryList:Iu,SelectedField:Lu,FieldActions:Ru,FieldStatusBadge:zu,FieldRemoveButton:Bu,FieldRemoveIcon:Vu,FieldDropIndicator:Hu,DialogForm:Kr,DialogCloseButton:Xr,DialogActionFooter:$r,DialogActions:Yr,DialogTitleInput:Zr,EditableDialogHeader:Qr,ControlTooltip:Ar,InspectorSection:Ku,IconChoiceGroup:Ju,IconToggleButton:Yu,TypographyControls:Qu,ComparisonPreview:$u,FilterBadgeInfoButton:ed,FilterBadge:td,RatingStar:fr,RatingChoice:pr,ReorderList:rd,ReorderHandle:id,TimelineTrack:fd,IconToolbar:AS,ActivityMessage:md,PdfViewer:TS,PdfViewerToolbar:xS,NumberDraft:VS,MaskedDraft:oC,DurationField:lC,DurationDraft:uC,HtmlEditor:zC,TemporalPicker:KC,TemporalDraft:XC,DateTimeField:ZC,AssigneePicker:nw,AssigneeField:rw,AssigneePickerLayout:iw},ow={option:{prop:`renderOption`,args:[`option`,`selected`],skipFactory:!0},value:{prop:`renderValue`,args:[`option`],skipFactory:!0},placeholder:{prop:`renderPlaceholder`,args:[`placeholder`],skipFactory:!0},selectedValue:{prop:`renderSelectedValue`,args:[`selectedOptions`],skipFactory:!0},content:{prop:`renderContent`,args:[`content`]},noResults:{prop:`renderNoResults`,args:[],skipFactory:!0}},sw={toolbar:{prop:`renderToolbar`,args:[`controller`,`state`,`toolbarProps`]},status:{prop:`renderStatus`,args:[`state`]}};function cw(e){return[`Dropdown`,`Combobox`,`MultiSelect`,`DropdownPopupContent`].includes(e)?ow:e===`PdfViewer`?sw:e===`Tooltip`?{content:{prop:`renderContent`,args:[`context`]}}:e===`ReorderList`?{item:{prop:`renderItem`,args:[`item`,`index`]},handle:{prop:`renderHandle`,args:[`item`,`index`]}}:{}}var lw={AiPromptInput:{prop:`value`,callback:`onValueChange`},SearchInput:{prop:`value`,callback:`onValueChange`},SharedResourcePicker:{prop:`selectedResourceIds`,callback:`onChange`},CalendarPicker:{prop:`selected`,callback:`onSelectionChange`},ColorPalette:{prop:`value`,callback:`onChange`},DurationField:{prop:`value`,callback:`onChange`},TemporalPicker:{prop:`value`,callback:`onChange`},DateTimeField:{prop:`value`,callback:`onValueChange`},Checkbox:{prop:`checked`,callback:`onChange`},Switch:{prop:`checked`,callback:`onChange`},SegmentedSwitch:{prop:`value`,callback:`onChange`},ChoiceChips:{prop:`value`,callback:`onChange`},ColorPicker:{prop:`value`,callback:`onChange`},Dropdown:{prop:`value`,callback:`onChange`},SingleValueSlider:{prop:`value`,callback:`onChange`},ToggleButton:{prop:`pressed`,callback:`onPressedChange`},SegmentedControl:{prop:`value`,callback:`onChange`},Tabs:{prop:`value`,callback:`onChange`},RadioGroup:{prop:`value`,callback:`onChange`},TextInput:{prop:`value`,callback:`onValueChange`},Textarea:{prop:`value`,callback:`onValueChange`},NumberInput:{prop:`value`,callback:`onValueChange`},NumberStepper:{prop:`value`,callback:`onChange`},DateInput:{prop:`value`,callback:`onValueChange`},TimeInput:{prop:`value`,callback:`onValueChange`},DateTimeInput:{prop:`value`,callback:`onValueChange`},Rating:{prop:`value`,callback:`onChange`},Combobox:{prop:`value`,callback:`onChange`},MultiSelect:{prop:`value`,callback:`onChange`},DatePicker:{prop:`value`,callback:`onChange`},DateRangePicker:{prop:`value`,callback:`onChange`}};function uw(e,t){let n=new Map,r=!1,i=0;function a({content:e,scope:a}){let o=R(null);return L(()=>{let s=o.current;if(!s||r)return;let c=n.get(s)?.id??i++;n.set(s,{id:c,element:s,content:e,scope:a}),t([...n.values()])},[e,a]),L(()=>{let e=o.current;return()=>{e&&n.delete(e),r||t([...n.values()])}},[]),P(`span`,{ref:o,style:{display:`contents`},"data-rv-framework-content":``})}let o=(e,t={})=>P(a,{content:e,scope:t});return{render(t,n,i){if(r)throw Error(`Cannot update a destroyed UI mount`);De(P(t,i?i(n,o):n),e)},destroy(){r||(r=!0,De(null,e),n.clear())}}}function dw(e,t,n,r){let i={...t},a=cw(e);for(let[e,t]of Object.entries(n)){if(t==null)continue;let n=a[e];n?i[n.prop]=(...e)=>(n.skipFactory&&(e=e.slice(1)),r(t,Object.fromEntries(n.args.map((t,n)=>[t,e[n]])))):i[e==="default"?`children`:e]=r(t)}return i}return e.AVATAR_CELL_BACKGROUNDS=eo,e.ActionFooterView=Hr,e.AvatarElement=to,e.ControlTooltip=Ar,e.DRAWING_TOOL_PATHS=Yo,e.DialogController=_i,e.PaginationPanel=vr,e.PopoverController=Bt,e.TOOLTIP_STYLES=yt,e.TooltipController=Ht,e.TooltipGroup=mi,e.TooltipText=pi,e.applyControlPresentation=Ko,e.attachDialogDrag=ci,e.attachMenuKeyboard=vi,e.attachResizeHandle=yi,e.avatarTemplate=co,e.avatarWithTextTemplate=lo,e.badgeClassName=Si,e.calculateAnchoredPopoverPosition=f,e.componentModels=lw,e.componentRenderSlots=cw,e.controlAttributes=Qn,e.controlClassName=Zn,e.createAlertElement=Bs,e.createAvatarElement=no,e.createButtonElement=wr,e.createControl=er,e.createControlId=Rt,e.createDialogButton=ni,e.createDialogCloseButton=ti,e.createDialogElements=ei,e.createDropdownControl=hr,e.createFormField=Qa,e.createFrameworkMount=uw,e.createSearchInput=Jo,e.createTextControl=$a,e.createTooltipElement=Vt,e.createTooltipGroup=hi,e.decorateIconAction=ar,e.dropdownRenderSlots=ow,e.ensureTooltipStyles=bt,e.formatTimelineEvents=gs,e.getAvatarCellBackground=ro,e.getAvatarIndex=oo,e.getAvatarInitials=io,e.getDialogFocusableElements=oi,e.getUiMotionDuration=Pt,e.hideTopLayerPopup=At,e.inheritUiMotion=It,e.isUiMotionEnabled=Nt,e.mountAiAssistant=Za,e.mountColorPicker=Rs,e.mountDialogActionFooter=Ur,e.nativeControlTag=rr,e.normalizeProgressRange=bi,e.ownsPopupTarget=Dt,e.paginationItems=gr,e.pdfViewerRenderSlots=sw,e.popupOwnsTarget=jt,e.prepareTooltipSurface=xt,e.registerControl=nr,e.releaseAlertElement=Vs,e.renderAggregateSummary=is,e.renderAlert=wi,e.renderAlertInto=zs,e.renderBadgeValue=Qo,e.renderChange=$o,e.renderCircularProgress=Uo,e.renderControl=$n,e.renderCounter=Or,e.renderHeatmap=ms,e.renderLabelledIcon=ns,e.renderLoadingIndicator=Cr,e.renderMenuItem=Tr,e.renderMiniBarChart=os,e.renderPaginationButton=_r,e.renderPercentageSummary=rs,e.renderPie=Ts,e.renderProgressBar=fo,e.renderProgressLine=Xo,e.renderProgressLineValue=Zo,e.renderRangeSlider=Ho,e.renderRatingStars=Er,e.renderScalarSlider=Dr,e.renderSearchInput=qo,e.renderSparkline=as,e.renderThumbs=es,e.renderTimeline=xs,e.renderTypeIcon=ts,e.showTopLayerPopup=kt,e.trapDialogFocus=ai,e.uiComponents=aw,e.useTooltip=jr,e.withFrameworkContent=dw,e})({});