!function(){"use strict";var e="undefined"!=typeof document?document.currentScript:null;const t={},i=e=>null===e||Array.isArray(e)&&0===e.length,n=e=>Array.isArray(e)&&e.length>0,s=e=>"string"==typeof e||"number"==typeof e,a=e=>1===e?.vtype,r=e=>2===e?.vtype,o=e=>4===e?.vtype;function A(e,i,...n){return i=i??t,function(e,t,i){if(i!=i)throw new Error("Invalid NaN key");const n="string"==typeof e?1:(e=>"function"==typeof e?.mount)(e)?4:"function"==typeof e?2:void 0;if(void 0===n)throw new Error("Invalid VNode type");return{vtype:n,type:e,key:i,props:t}}(e,i=n.length>1?Object.assign({},i,{children:n}):1===n.length?Object.assign({},i,{children:n[0]}):i,i.key)}function c(e){return{mount(t,i){t[e]=i},patch(t,i,n){i!==n&&(t[e]=i)},unmount(t,i){t[e]=null}}}const l={selected:c("selected"),checked:c("checked"),value:c("value"),innerHTML:c("innerHTML")},g="http://www.w3.org/1999/xlink",h={show:g,actuate:g,href:g};function d(e){if(1===e.type)return e.node;if(4===e.type)return d(e.children[0]);if(8===e.type)return d(e.childRef);throw new Error("Unkown ref type "+JSON.stringify(e))}function u(e){if(1===e.type)return e.node.parentNode;if(4===e.type)return u(e.children[0]);if(8===e.type)return u(e.childRef);throw new Error("Unkown ref type "+e)}function I(e){if(1===e.type)return e.node.nextSibling;if(4===e.type)return I(e.children[e.children.length-1]);if(8===e.type)return I(e.childRef);throw new Error("Unkown ref type "+JSON.stringify(e))}function f(e,t,i){if(1===t.type)e.insertBefore(t.node,i);else if(4===t.type)t.children.forEach((t=>{f(e,t,i)}));else{if(8!==t.type)throw new Error("Unkown ref type "+JSON.stringify(t));f(e,t.childRef,i)}}function C(e,t){if(1===t.type)e.removeChild(t.node);else if(4===t.type)t.children.forEach((t=>{C(e,t)}));else{if(8!==t.type)throw new Error("Unkown ref type "+t);C(e,t.childRef)}}function p(e,t,i,n){if(!0===i)e.setAttribute(t,"");else if(!1===i)e.removeAttribute(t);else{var s=n?h[t]:void 0;void 0!==s?e.setAttributeNS(s,t,i):e.setAttribute(t,i)}}const m={isSvg:!1,directives:l};let B=class{constructor(e,t){this.props=e,this._STATE_={env:t,vnode:null,parentDomNode:null,ref:Q(null)},this.render=this.render.bind(this)}setProps(e){this.oldProps=this.props,this.props=e}render(e){const t=this._STATE_,i=t.vnode;if(t.vnode=e,null==t.parentDomNode){let i=u(t.ref);if(null==i)return void(t.ref=Q(e,t.env));t.parentDomNode=i}t.ref=y(t.parentDomNode,e,i,t.ref,t.env)}};function Q(e,t=m){if(i(e))return{type:1,node:document.createComment("NULL")};if(s(e))return{type:1,node:document.createTextNode(e)};if(a(e)){let i,{type:n,props:s}=e;"svg"!==n||t.isSvg||(t=Object.assign({},t,{isSVG:!0})),i=t.isSVG?document.createElementNS("http://www.w3.org/2000/svg",n):document.createElement(n),function(e,t,i){for(var n in t)"key"===n||"children"===n||n in i.directives||(n.startsWith("on")?e[n.toLowerCase()]=t[n]:p(e,n,t[n],i.isSVG))}(i,s,t);let a=null==s.children?s.children:Q(s.children,t);return null!=a&&f(i,a),function(e,t,i){for(let n in t)n in i.directives&&i.directives[n].mount(e,t[n])}(i,s,t),{type:1,node:i,children:a}}if(n(e))return{type:4,children:e.map((e=>Q(e,t)))};if(r(e)){let i=e.type(e.props);return{type:8,childRef:Q(i,t),childState:i}}if(o(e)){let i=new B(e.props,t);return e.type.mount(i),{type:8,childRef:i._STATE_.ref,childState:i}}if(e instanceof Node)return{type:1,node:e};if(void 0===e)throw new Error("mount: vnode is undefined!");throw new Error("mount: Invalid Vnode!")}function E(e,t,A,c,l=m){if(A===t)return c;if(i(t)&&i(A))return c;if(s(t)&&s(A))return c.node.nodeValue=t,c;if(a(t)&&a(A)&&t.type===A.type){"svg"!==t.type||l.isSvg||(l=Object.assign({},l,{isSVG:!0})),function(e,t,i,n){for(var s in t)if("key"!==s&&"children"!==s&&!(s in n.directives)){var a=i[s],r=t[s];a!==r&&(s.startsWith("on")?e[s.toLowerCase()]=r:p(e,s,r,n.isSVG))}for(s in i)"key"===s||"children"===s||s in n.directives||s in t||(s.startsWith("on")?e[s.toLowerCase()]=null:e.removeAttribute(s))}(c.node,t.props,A.props,l);let e=A.props.children,i=t.props.children;return null==e?null!=i&&(c.children=Q(i,l),f(c.node,c.children)):null==i?(c.node.textContent="",b(e,c.children,l),c.children=null):c.children=y(c.node,i,e,c.children,l),function(e,t,i,n){for(let s in t)s in n.directives&&n.directives[s].patch(e,t[s],i[s]);for(let s in i)s in n.directives&&!(s in t)&&n.directives[s].unmount(e,i[s])}(c.node,t.props,A.props,l),c}if(n(t)&&n(A))return function(e,t,i,n,s){const a=I(n),r=Array(t.length);let o,A,c,l,g,h=n.children,u=0,p=0,m=t.length-1,B=i.length-1;for(;u<=m&&p<=B;){if(null===h[p]){p++;continue}if(null===h[B]){B--;continue}if(o=i[p],A=t[u],A?.key===o?.key){c=h[p],l=r[u]=y(e,A,o,c,s),u++,p++;continue}if(o=i[B],A=t[m],A?.key===o?.key){c=h[B],l=r[m]=y(e,A,o,c,s),m--,B--;continue}if(null==g){g={};for(let e=p;e<=B;e++)o=i[e],null!=o?.key&&(g[o.key]=e)}A=t[u];const n=null!=A?.key?g[A.key]:null;null!=n?(o=i[n],c=h[n],l=r[u]=E(e,A,o,c,s),f(e,l,d(h[p])),l!==c&&(C(e,c),b(o,c,s)),h[n]=null):(l=r[u]=Q(A,s),f(e,l,d(h[p]))),u++}const w=mb(e,t.children[n],i))):r(e)?b(t.childState,t.childRef,i):o(e)&&e.type.unmount(t.childState)}function y(e,t,i,n,s){const a=E(e,t,i,n,s);return a!==n&&(function(e,t,i){f(e,t,d(i)),C(e,i)}(e,a,n),b(i,n,s)),a}const w={};function k(e){if(void 0!==w[e])return w[e];if(e.includes("-")){const t=e.split("-");return w[e]=t[0]+t.splice(1).map((e=>e[0].toUpperCase()+e.substr(1))).join(""),w[e]}return e}let S=class extends HTMLElement{constructor(){super(),this.useShadowDOM=!0,this.__isConnected=!1,this.__state={},this.__stores=[],this.init&&this.init(),this.watchProps=Object.keys(this.__state),this.__attributesToState(),this.document=this.useShadowDOM?this.attachShadow({mode:"open"}):this,this.__debounceRender=null,this.afterInit&&this.afterInit()}__attributesToState(){Object.assign(this.state,Array.from(this.attributes).reduce(((e,t)=>Object.assign(e,{[k(t.name)]:t.value})),{}))}get vdom(){return({state:e})=>""}get vstyle(){return({state:e})=>""}setAttribute(e,t){-1===e.indexOf("-")&&super.setAttribute(e,t);const i=k(e);this.watchProps.includes(i)&&this.render({[i]:t})}removeAttribute(e){super.removeAttribute(e);const t=k(e);this.watchProps.includes(t)&&t in this.state&&(this.render({[t]:null}),delete this.state[t])}debounce(e,t=300,...i){clearTimeout(e.debounceTimer),e.debounceTimer=setTimeout((()=>{e.apply(this,i)}),t)}async connectedCallback(){this.__isConnected=!0,this.render({},!1),this.connected&&this.connected()}disconnectedCallback(){this.__isConnected=!1,this.setState({}),this.__stores.forEach((e=>e.unsubscribe(this))),this.disconnected&&this.disconnected()}setState(e={}){const t=Object.keys(e).reduce(((e,t)=>Object.assign(e,{[t]:this.__state[t]})),{});Object.assign(this.__state,e),this.changed&&this.__isConnected&&this.changed(e,t)}set state(e){this.setState(e)}get state(){return this.__state}render(e,t=!0){if(this.setState(e),this.__isConnected){if(!1===t)return this.renderDebounce();clearTimeout(this.__debounceRender),this.__debounceRender=setTimeout((()=>{this.renderDebounce()}),0)}}renderDebounce(){return function(e,t,i={}){let n=t.$$PETIT_DOM_REF,s=Object.assign({},m);if(Object.assign(s.directives,i.directives),null==n){const i=Q(e,s);t.$$PETIT_DOM_REF={ref:i,vnode:e},t.textContent="",f(t,i,null)}else n.ref=y(t,e,n.vnode,n.ref,s),n.vnode=e}([this.vdom({state:this.__state}),this.vstyle({state:this.__state})],this.document)}};const v=function({state:e}){return[1===F[e.fileExtension]?A("i",{class:`cico cico-file-${e.fileExtension} ${e.iconClass}`},""):"",!F[e.fileExtension]&&e.showTextIfNoIcon?A("div",{},`\n ${e.fileExtension?.toUpperCase()}\n `):""]},D=function({state:e}){return A("style",{},"\n \n \n \n \n ")};let x=class extends S{init(){this.useShadowDOM=!0}get vdom(){return v}get vstyle(){return D}};const F={docx:1,pptx:1,xlsx:1,html:1,md:1,odf:1,odp:1,ods:1,odt:1,pdf:1,xml:1,jpg:1,png:1,txt:1,csv:1,svg:1,md:1};const R={gobalCounter:0,getUID:()=>R.gobalCounter++},M=function({state:e}){return[A("div",{class:`field prefix round border ${e.classNames}`},[null!==e.iconFn?A("i",{class:"front cico-text-icon"},`${e.iconFn(e.selectedItem)}`):"",null===e.iconFn?A("i",{class:`cico cico-${e.defaultIcon}`},""):"",A("input",{id:`firstInput${this._uid}`,onblur:("function"==typeof onLeave?onLeave.bind(this):this.onLeave).bind(this),onkeyup:("function"==typeof onKeyUp?onKeyUp.bind(this):this.onKeyUp).bind(this),onkeydown:("function"==typeof onKeyDown?onKeyDown.bind(this):this.onKeyDown).bind(this),onfocus:("function"==typeof onInputFocus?onInputFocus.bind(this):this.onInputFocus).bind(this),placeholder:`${e.valueFn(e.selectedItem)}`,value:`${e.valueFn(e.selectedItem)}`,autocomplete:"off",type:"search"},""),A("i",{class:"cico cico-arrow-drop-down"},""),A("menu",{class:"min"},[A("header",{class:"fixed"},[A("div",{class:`field prefix suffix no-margin ${e.classNames}`},[A("i",{onclick:("function"==typeof onLeave?onLeave.bind(this):this.onLeave).bind(this),class:"front cico cico-arrow-back"},""),A("input",{id:`secondInput${this._uid}`,onkeyup:("function"==typeof onKeyUp?onKeyUp.bind(this):this.onKeyUp).bind(this),onkeydown:("function"==typeof onKeyDown?onKeyDown.bind(this):this.onKeyDown).bind(this),onfocus:("function"==typeof onInputFocus?onInputFocus.bind(this):this.onInputFocus).bind(this),placeholder:"Search text",tabindex:"-1",autocomplete:"off",type:"search"},""),A("i",{class:"front cico cico-close"},"")])]),e._items.map(((t,i)=>A("a",{onclick:("function"==typeof onSelect?onSelect.bind(this):this.onSelect).bind(this),onblur:("function"==typeof onLeave?onLeave.bind(this):this.onLeave).bind(this),"data-i":i,class:"row "+(i===e._currentFocus?"fill":"")},[null!==e.iconFn?A("i",{class:"front"},`${e.iconFn(t)}`):"",A("div",{},`${e.valueFn(t)}`)])))])])]},N=function({state:e}){return A("style",{},"\n \n \n ")};let G=class extends S{init(){this.useShadowDOM=!0}get vdom(){return M}get vstyle(){return N}};const U=function({state:e}){return[A("div",{class:"surface-dim",onmousedown:("function"==typeof onMouseEvent?onMouseEvent.bind(this):this.onMouseEvent).bind(this)},"")]},L=function({state:e}){return A("style",{},"\n \n \n ")};let T=class extends S{init(){this.useShadowDOM=!0}get vdom(){return U}get vstyle(){return L}};const H=function({state:e}){return[A("i",{},[A("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",space:"preserve","xmlns:serif":"http://www.serif.com/",style:"fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"},[A("path",{d:"M9.517,20.789c0,0.092 -0.043,0.178 -0.117,0.233c-0.074,0.054 -0.17,0.07 -0.257,0.042c-0.281,-0.091 -0.558,-0.195 -0.83,-0.313c-1.156,-0.499 -2.164,-1.179 -3.024,-2.04c-0.861,-0.86 -1.541,-1.868 -2.04,-3.024c-0.499,-1.155 -0.749,-2.385 -0.749,-3.687c0,-1.313 0.25,-2.545 0.749,-3.695c0.499,-1.151 1.179,-2.156 2.04,-3.017c0.86,-0.86 1.868,-1.54 3.024,-2.039c1.155,-0.499 2.385,-0.749 3.687,-0.749c1.313,-0 2.545,0.25 3.695,0.749c1.151,0.499 2.156,1.179 3.016,2.039c0.861,0.861 1.541,1.866 2.04,3.017c0.499,1.15 0.749,2.382 0.749,3.695c0,0.051 -0,0.102 -0.001,0.153c-0.004,0.247 -0.205,0.445 -0.451,0.445c-0.188,0 -0.407,0 -0.598,0c-0.121,0 -0.236,-0.048 -0.321,-0.134c-0.085,-0.087 -0.131,-0.203 -0.13,-0.324c0.001,-0.047 0.001,-0.093 0.001,-0.14c0,-0.376 -0.026,-0.747 -0.077,-1.114c-0.051,-0.366 -0.125,-0.719 -0.221,-1.059l-3.717,-0c0.062,0.372 0.108,0.736 0.136,1.093c0.028,0.357 0.043,0.717 0.043,1.08c-0,0.084 -0.001,0.167 -0.003,0.25c-0.003,0.194 -0.161,0.348 -0.354,0.348l-0.791,0c-0.095,0 -0.186,-0.038 -0.253,-0.105c-0.066,-0.068 -0.103,-0.16 -0.101,-0.254c0.001,-0.079 0.002,-0.159 0.002,-0.239c-0,-0.376 -0.015,-0.739 -0.043,-1.09c-0.028,-0.35 -0.074,-0.711 -0.136,-1.083l-4.97,-0c-0.062,0.372 -0.108,0.733 -0.136,1.083c-0.028,0.351 -0.042,0.714 -0.042,1.09c-0,0.376 0.014,0.739 0.042,1.089c0.028,0.351 0.074,0.712 0.136,1.083c0,0.001 0.001,0.001 0.001,0.001c0.001,-0 0.001,-0 0.001,-0l0,3.557c0.001,0.12 -0.083,0.224 -0.201,0.249c-0.117,0.024 -0.236,-0.037 -0.284,-0.147c-0,-0.001 -0.001,-0.003 -0.001,-0.004c-0.305,-0.701 -0.543,-1.419 -0.712,-2.155l-3.392,-0c0.528,1.038 1.237,1.911 2.125,2.617c0.686,0.546 1.441,0.951 2.264,1.216c0.12,0.038 0.201,0.148 0.201,0.273c0,0.257 0,0.694 0,1.01Zm6.164,-12.462l3.392,-0c-0.534,-1.051 -1.238,-1.924 -2.11,-2.618c-0.873,-0.693 -1.882,-1.167 -3.026,-1.423c0.383,0.582 0.724,1.219 1.023,1.91c0.298,0.691 0.539,1.401 0.721,2.131Zm-5.821,-0l4.281,-0c-0.233,-0.836 -0.525,-1.606 -0.876,-2.311c-0.352,-0.704 -0.774,-1.369 -1.265,-1.995c-0.491,0.626 -0.912,1.291 -1.264,1.995c-0.352,0.705 -0.644,1.475 -0.876,2.311Zm-4.933,-0l3.392,-0c0.182,-0.73 0.423,-1.44 0.722,-2.131c0.298,-0.691 0.639,-1.328 1.023,-1.91c-1.152,0.256 -2.162,0.732 -3.031,1.428c-0.87,0.697 -1.571,1.568 -2.106,2.613Zm-0.629,5.846l3.718,-0c-0.063,-0.372 -0.109,-0.736 -0.137,-1.093c-0.028,-0.357 -0.042,-0.717 -0.042,-1.08c-0,-0.363 0.014,-0.723 0.042,-1.08c0.028,-0.357 0.074,-0.721 0.137,-1.093l-3.718,-0c-0.096,0.34 -0.17,0.693 -0.221,1.059c-0.051,0.367 -0.077,0.738 -0.077,1.114c0,0.376 0.026,0.747 0.077,1.113c0.051,0.367 0.125,0.72 0.221,1.06Z"},""),A("g",{transform:"matrix(7,0,0,7,20.7705,20.0913)"},""),A("text",{x:"11.439px",y:"20.091px",style:"font-family:monospace;font-size:7px; letter-spacing:1.07px;"},`${this.formatLocaleStringTwoLetter(e.localeString)}`)])])]},O=function({state:e}){return A("style",{},"\n \n \n \n \n ")};let q=class extends S{init(){this.useShadowDOM=!0}get vdom(){return H}get vstyle(){return O}};const J=function({state:e}){return[A("div",{class:`template-anim-stack middle-align sync-${""!==e.animationMode?"demo":"off"} sync-${e.animationMode}`},[A("div",{},[A("article",{onmouseenter:("function"==typeof onThumbnailOver?onThumbnailOver.bind(this):this.onThumbnailOver).bind(this),onmouseleave:("function"==typeof onThumbnailLeave?onThumbnailLeave.bind(this):this.onThumbnailLeave).bind(this),onclick:("function"==typeof thumbnailClickFn?thumbnailClickFn.bind(this):this.thumbnailClickFn).bind(this),class:"template-preview white no-padding"},[e.templateThumbnailUrl?A("img",{class:"responsive",src:`${e.templateThumbnailUrl}`},""):"",e.templateThumbnailUrl?"":A("div",{class:"responsive center-align middle-align"},[e.templateExtension?"":A("i",{class:"cico cico-note-add"},""),e.templateExtension?A("c-file-icon",{"file-extension":`${e.templateExtension}`},""):""])])]),A("div",{class:"template-flux-container"},[A("div",{class:"flux-text tertiary-text animate-display-y"},[A("span",{},[A("i",{class:"cico cico-sync"+("on"===e.autoUploadEnable?"":"-problem")},"")," Auto-upload on save"]),"off"===e.autoUploadEnable?A("div",{class:"auto-upload-error error-text"},["Works with ",A("i",{class:"cico cico-browser-chrome tiny",style:"margin-right: 2px;"},""),A("i",{class:"cico cico-browser-edge tiny",style:"margin-right: 2px;"},""),A("i",{class:"cico cico-browser-opera tiny"},""),A("i",{class:"cico cico-browser-brave tiny"},""),A("br",{},""),"Others: drag and drop files here."]):""]),A("div",{class:"template-flux"},"")]),A("div",{class:"medium-padding"},[A("svg",{id:"svg-computer-edit",xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24","shape-rendering":"geometricPrecision","text-rendering":"geometricPrecision"},[A("g",{"clip-path":"url(#eZfP7i3oBxX6_mask)"},[A("g",{id:"svg-mini-file",transform:"translate(0,-10)"},[A("g",{transform:"translate(3,0)"},[A("path",{d:"M9.792,14.391c-.195,0-.36-.068-.495-.203s-.203-.3-.203-.495v-5.967c0-.195.068-.36.203-.495.135-.136.3-.203.495-.203h2.791c.093,0,.182.018.268.054s.16.086.224.149l1.627,1.628c.064.063.114.138.15.224s.054.175.054.268v4.342c0,.195-.068.36-.203.495s-.3.203-.495.203h-4.416Z",fill:"#fff"},""),A("path",{style:"fill:#a7a7a7",d:"M9.729,14.5c-.202,0-.372-.07-.512-.209-.14-.14-.21-.311-.21-.512v-6.139c0-.201.07-.372.21-.512.14-.139.31-.209.512-.209h2.87c.096,0,.189.019.278.056.088.037.166.089.231.154l1.674,1.674c.066.066.117.143.154.232.038.089.057.181.057.277v4.467c0,.201-.07.372-.21.512-.14.139-.31.209-.512.209h-4.542Zm2.87-5.548v-1.435h-2.87c-.031,0-.059.013-.085.039-.025.025-.038.053-.038.084v6.139c0,.03.013.059.038.084.026.026.054.038.085.038h4.542c.031,0,.059-.012.085-.038.025-.025.038-.054.038-.084v-4.466h-1.435c-.103,0-.188-.034-.257-.103s-.103-.155-.103-.258ZM9.606,7.517v1.796-1.796v6.384-6.384Z"},"")])]),A("clipPath",{id:"eZfP7i3oBxX6_mask"},[A("path",{d:"M4,15.923L4,5.538c0-.077.032-.147.096-.211s.135-.096.212-.096h15.384c.077,0,.148.032.212.096s.096.134.096.211v10.385c0,.077-.032.148-.096.212s-.135.096-.212.096h-15.384c-.077,0-.148-.032-.212-.096s-.096-.135-.096-.212Z"},"")])]),A("path",{style:"fill:#a7a7a7",d:"M2.135,20.231c-.213,0-.391-.072-.535-.216-.143-.143-.215-.321-.215-.534s.072-.391.215-.535c.144-.143.322-.215.535-.215h19.73c.213,0,.391.072.535.215.143.144.215.322.215.535s-.072.391-.215.534c-.144.144-.322.216-.535.216h-19.73Zm2.173-2.5c-.505,0-.933-.175-1.283-.525s-.525-.778-.525-1.283v-10.385c0-.505.175-.932.525-1.282s.778-.525,1.283-.525h15.384c.505,0,.933.175,1.283.525s.525.777.525,1.282v10.385c0,.505-.175.933-.525,1.283s-.778.525-1.283.525h-15.384Zm0-1.5h15.384c.077,0,.148-.032.212-.096s.096-.135.096-.212v-10.385c0-.077-.032-.147-.096-.211s-.135-.096-.212-.096h-15.384c-.077,0-.148.032-.212.096s-.096.134-.096.211v10.385c0,.077.032.148.096.212s.135.096.212.096Zm-.308,0v-11v11Z"},""),A("g",{id:"svg-mini-pen",transform:"translate(13.18858,12.704)"},[A("g",{id:"svg-mini-pen_r",transform:"rotate(-4.720965)"},[A("path",{style:"fill:#a7a7a7",id:"svg-mini-pen-opacity",d:"M11.808,12.935v-.387c0-.034.006-.067.018-.098.013-.031.032-.06.059-.086l1.467-1.46c.035-.034.073-.058.114-.073.042-.016.083-.023.124-.023.044,0,.087.008.129.025.043.017.08.042.114.075l.263.266c.031.036.054.074.071.115s.025.082.025.124c0,.041-.007.083-.023.125-.015.043-.039.082-.073.117l-1.46,1.46c-.026.027-.055.046-.086.059-.031.012-.064.018-.098.018h-.387c-.074,0-.135-.024-.184-.073s-.073-.111-.073-.184Zm2.045-1.522l-.263-.266.263.266Zm-1.706,1.44h.27l.923-.927-.263-.269-.93.926v.27Zm1.065-1.065l-.135-.131.263.269-.128-.138Z",transform:"translate(-11.808,-13.192)",opacity:"0"},"")])]),A("g",{id:"svg-computer-save",transform:"translate(0.5,0.5)"},[A("path",{style:"fill:#a7a7a7",d:"M6.057,10.919c-0.127,0 -0.234,-0.043 -0.321,-0.131c-0.088,-0.087 -0.131,-0.194 -0.131,-0.321l-0,-3.346c-0,-0.126 0.043,-0.233 0.131,-0.32c0.087,-0.088 0.194,-0.132 0.321,-0.132l2.683,0c0.06,0 0.118,0.012 0.174,0.036c0.055,0.023 0.104,0.055 0.145,0.096l0.664,0.665c0.041,0.041 0.073,0.089 0.097,0.145c0.023,0.055 0.035,0.113 0.035,0.173l-0,2.683c-0,0.127 -0.044,0.234 -0.132,0.321c-0.087,0.088 -0.194,0.131 -0.32,0.131l-3.346,0Zm3.423,-3.162l-0.713,-0.713l-2.71,0c-0.023,0 -0.041,0.008 -0.056,0.022c-0.014,0.014 -0.021,0.033 -0.021,0.055l-0,3.346c-0,0.023 0.007,0.041 0.021,0.056c0.015,0.014 0.033,0.021 0.056,0.021l3.346,0c0.022,0 0.041,-0.007 0.055,-0.021c0.015,-0.015 0.022,-0.033 0.022,-0.056l-0,-2.71Zm-1.75,2.355c0.173,-0 0.32,-0.061 0.442,-0.183c0.122,-0.122 0.183,-0.269 0.183,-0.442c-0,-0.173 -0.061,-0.321 -0.183,-0.443c-0.122,-0.121 -0.269,-0.182 -0.442,-0.182c-0.173,-0 -0.321,0.061 -0.443,0.182c-0.121,0.122 -0.182,0.27 -0.182,0.443c-0,0.173 0.061,0.32 0.182,0.442c0.122,0.122 0.27,0.183 0.443,0.183Zm-1.178,-1.846l1.601,-0c0.064,-0 0.118,-0.022 0.161,-0.065c0.043,-0.043 0.065,-0.097 0.065,-0.161l-0,-0.423c-0,-0.065 -0.022,-0.119 -0.065,-0.162c-0.043,-0.043 -0.097,-0.064 -0.161,-0.064l-1.601,-0c-0.065,-0 -0.118,0.021 -0.161,0.064c-0.044,0.043 -0.065,0.097 -0.065,0.162l-0,0.423c-0,0.064 0.021,0.118 0.065,0.161c0.043,0.043 0.096,0.065 0.161,0.065Zm-0.572,-1.222l-0,3.5l-0,-3.5Z"},"")])])])])]},P=function({state:e}){return A("style",{},"\n \n \n \n c-template-edit-animation-icon {\n display: flex;\n flex-grow: 1;\n --flux-show-duration: 0.4s;\n --flux-on-delay: 0s;\n --flux-on-duration: 4s;\n --computer-show-delay: 0.4s;\n --computer-show-duration: 0.5s;\n --computer-edit-pen-delay: 0.9s;\n --computer-edit-duration: 4s;\n }\n \n .template-anim-stack {\n display: flex;\n flex-grow: 1;\n }\n article.template-preview {\n cursor: pointer;\n box-shadow: var(--elevateArticle);\n transition: transform 0.5s, box-shadow 0.5s;\n }\n article.template-preview > img {\n max-height: 300px; /* mandatory for safari */\n }\n /* when there is no image template preview */\n article.template-preview > div {\n --example-width: 150px;\n width: var(--example-width);\n height: calc(var(--example-width) * 1.41);\n background-color: white;\n }\n article.template-preview > div i {\n font-size: 3rem;\n }\n \n .sync-demo article.template-preview {\n transform: scale(1.06);\n box-shadow: 0 0 1.5rem 0 rgb(0 0 0 / 0.2);\n }\n \n .template-flux-container {\n /*padding: 20px 0;*/\n flex-grow: 1; \n display: flex;\n position: relative;\n }\n .template-flux {\n height: 15px;\n /*flex-grow: 1;*/ /* mandatory for safari with display flex on parent */\n width: 0%;\n transition: width var(--flux-show-duration) cubic-bezier(0.42,0,0.58,1);\n filter: blur(15px);\n -webkit-backdrop-filter: blur(15px); /* fix blur on animation on safari */\n will-change: transform;\n background: linear-gradient(to left, #00baff, #485cff, #823dff, #ce23fc, #823dff, #485cff, #00baff);\n background-size: 200% 200%;\n z-index: -1;\n }\n .flux-text {\n display: none;\n position: absolute;\n left: 1.4rem;\n top: 3.2rem;\n margin-right: -125px; /* add extra space below the computer icon */\n }\n .sync-demo .flux-text {\n display: block;\n }\n .sync-up .template-flux {\n margin-left: auto; /* the flux goes up, instead of going down */\n }\n .sync-demo .template-flux {\n width: 100%; \n animation: var(--flux-on-duration) flux-anim var(--flux-on-delay) linear infinite;\n }\n \n @keyframes flux-anim {\n 0% { background-position: -200% 0% ; }\n 40% { background-position: -200% 0% ; }\n 60% { background-position: 0% 0% ; }\n 60.1% { background-position: -200% 0% ; }\n 80% { background-position: 0% 0% ; }\n 80.1% { background-position: -200% 0% ; }\n 99.9% { background-position: 0% 0% ; }\n 100% { background-position: -200% 0% ; }\n }\n \n /* computer icon */ \n #svg-computer-edit {\n transition: opacity 0.1s linear;\n opacity: 0;\n width: 100px;\n }\n .sync-demo #svg-computer-edit {\n opacity: 1;\n }\n \n #svg-mini-file {\n transition: transform var(--computer-show-duration);\n transition-timing-function: cubic-bezier(0.39,0.575,0.565,1);\n transform: translateY(-10px);\n }\n .sync-demo #svg-mini-file {\n transition-delay: var(--computer-show-delay);\n transition-timing-function: cubic-bezier(0.39,0.575,0.565,1);\n transform: translateY(0);\n }\n \n #svg-mini-pen {\n transition: opacity 0.1s linear, transform var(--computer-edit-duration) cubic-bezier(0.42,0,0.58,1);\n }\n .sync-demo #svg-mini-pen-opacity {\n transition-delay: var(--computer-edit-pen-delay);\n opacity: 1;\n }\n .sync-demo #svg-mini-pen {\n animation: var(--computer-edit-duration) pen-anim-move 0s linear infinite;\n }\n #svg-computer-save {\n opacity: 0;\n }\n .sync-demo #svg-computer-save {\n animation: var(--computer-edit-duration) save-icon-anim 0s linear infinite;\n }\n @keyframes save-icon-anim {\n 0% { opacity: 0 } \n 35% { opacity: 0 } \n 40.1% { opacity: 1 } \n 95% { opacity: 1 } \n 100% { opacity: 0 } \n }\n @keyframes pen-anim-move {\n 0% {transform: translate(13.18858px,12.704px)} \n 10% {transform: translate(14.569163px,12.704px)}\n 20% {transform: translate(13.18858px,12.704px)} \n 30% {transform: translate(14.569163px,12.704px)}\n 40% {transform: translate(13.18858px,12.704px)} \n 100% {transform: translate(13.18858px,12.704px)} \n }\n \n \n ")};let Y=class extends S{init(){this.useShadowDOM=!0}get vdom(){return J}get vstyle(){return P}};var K,V={exports:{}};let W=[],j=[];function _(e){if(e<768)return!1;for(let t=0,i=W.length;;){let n=t+i>>1;if(e=j[n]))return!0;t=n+1}if(t==i)return!1}}function X(e){return e>=127462&&e<=127487}function Z(e,t,i=!0,n=!0){return(i?z:$)(e,t,n)}function z(e,t,i){if(t==e.length)return t;t&&te(e.charCodeAt(t))&&ie(e.charCodeAt(t-1))&&t--;let n=ee(e,t);for(t+=ne(n);t=0&&X(ee(e,n));)i++,n-=2;if(i%2==0)break;t+=2}}}return t}function $(e,t,i){for(;t>0;){let n=z(e,t-2,i);if(n=56320&&e<57344}function ie(e){return e>=55296&&e<56320}function ne(e){return e<65536?1:2}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let t=0,i=0;tthis.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=de(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),re.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=de(this,e,t);let i=[];return this.decompose(e,t,i,0),re.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new ce(this),s=new ce(e);for(let e=t,a=t;;){if(n.next(e),s.next(e),e=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(a+=n.value.length,n.done||a>=i)return!0}}iter(e=1){return new ce(this,e)}iterRange(e,t=this.length){return new le(this,e,t)}iterLines(e,t){let i;if(null==e)i=this.iter();else{null==t&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ge(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new ae(t):re.from(ae.split(t,[])):e.empty}},ae=class e extends se{constructor(e,t=function(e){let t=-1;for(let i of e)t+=i.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let a=this.text[s],r=n+a.length;if((t?i:r)>=e)return new he(n,r,i,a);n=r+1,i++}}decompose(t,i,n,s){let a=t<=0&&i>=this.length?this:new e(Ae(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&s){let t=n.pop(),i=oe(a.text,t.text.slice(),0,a.length);if(i.length<=32)n.push(new e(i,t.length+a.length));else{let t=i.length>>1;n.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else n.push(a)}replace(t,i,n){if(!(n instanceof e))return super.replace(t,i,n);[t,i]=de(this,t,i);let s=oe(this.text,oe(n.text,Ae(this.text,0,t)),i),a=this.length+n.length-(i-t);return s.length<=32?new e(s,a):re.from(e.split(s,[]),a)}sliceString(e,t=this.length,i="\n"){[e,t]=de(this,e,t);let n="";for(let s=0,a=0;s<=t&&ae&&a&&(n+=i),es&&(n+=r.slice(Math.max(0,e-s),t-s)),s=o+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,i){let n=[],s=-1;for(let a of t)n.push(a),s+=a.length+1,32==n.length&&(i.push(new e(n,s)),n=[],s=-1);return s>-1&&i.push(new e(n,s)),i}},re=class e extends se{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,i,n){for(let s=0;;s++){let a=this.children[s],r=n+a.length,o=i+a.lines-1;if((t?o:r)>=e)return a.lineInner(e,t,i,n);n=r+1,i=o+1}}decompose(e,t,i,n){for(let s=0,a=0;a<=t&&s=a){let s=n&((a<=e?1:0)|(o>=t?2:0));a>=e&&o<=t&&!s?i.push(r):r.decompose(e-a,t-a,i,s)}a=o+1}}replace(t,i,n){if([t,i]=de(this,t,i),n.lines=a&&i<=o){let A=r.replace(t-a,i-a,n),c=this.lines-r.lines+A.lines;if(A.lines>4&&A.lines>c>>6){let a=this.children.slice();return a[s]=A,new e(a,this.length-(i-t)+n.length)}return super.replace(a,o,A)}a=o+1}return super.replace(t,i,n)}sliceString(e,t=this.length,i="\n"){[e,t]=de(this,e,t);let n="";for(let s=0,a=0;se&&s&&(n+=i),ea&&(n+=r.sliceString(e-a,t-a,i)),a=o+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,i){if(!(t instanceof e))return 0;let n=0,[s,a,r,o]=i>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=i,a+=i){if(s==r||a==o)return n;let e=this.children[s],A=t.children[a];if(e!=A)return n+e.scanIdentical(A,i);n+=e.length+1}}static from(t,i=t.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let e of t)n+=e.lines;if(n<32){let e=[];for(let i of t)i.flatten(e);return new ae(e,i)}let s=Math.max(32,n>>5),a=s<<1,r=s>>1,o=[],A=0,c=-1,l=[];function g(t){let i;if(t.lines>a&&t instanceof e)for(let e of t.children)g(e);else t.lines>r&&(A>r||!A)?(h(),o.push(t)):t instanceof ae&&A&&(i=l[l.length-1])instanceof ae&&t.lines+i.lines<=32?(A+=t.lines,c+=t.length+1,l[l.length-1]=new ae(i.text.concat(t.text),i.length+1+t.length)):(A+t.lines>s&&h(),A+=t.lines,c+=t.length+1,l.push(t))}function h(){0!=A&&(o.push(1==l.length?l[0]:e.from(l,c)),c=-1,A=l.length=0)}for(let e of t)g(e);return h(),1==o.length?o[0]:new e(o,i)}};function oe(e,t,i=0,n=1e9){for(let s=0,a=0,r=!0;a=i&&(A>n&&(o=o.slice(0,n-s)),s0?1:(e instanceof ae?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],a=s>>1,r=n instanceof ae?n.text.length:n.children.length;if(a==(t>0?r:0)){if(0==i)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(t>0?0:1)){if(this.offsets[i]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(n instanceof ae){let s=n.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,s.length>Math.max(0,e))return this.value=0==e?s:t>0?s.slice(e):s.slice(0,s.length-e),this;e-=s.length}else{let s=n.children[a+(t<0?-1:0)];e>s.length?(e-=s.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(s),this.offsets.push(t>0?1:(s instanceof ae?s.text.length:s.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},le=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new ce(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}},ge=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};"undefined"!=typeof Symbol&&(se.prototype[Symbol.iterator]=function(){return this.iter()},ce.prototype[Symbol.iterator]=le.prototype[Symbol.iterator]=ge.prototype[Symbol.iterator]=function(){return this});let he=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function de(e,t,i){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,i))]}function ue(e,t,i=!0,n=!0){return Z(e,t,i,n)}function Ie(e,t){let i=e.charCodeAt(t);if(!((n=i)>=55296&&n<56320&&t+1!=e.length))return i;var n;let s=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(s)?s-56320+(i-55296<<10)+65536:i}function fe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function Ce(e){return e<65536?1:2}const pe=/\r\n?|\n/;var me=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(me||(me={}));let Be=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-n);s+=r}else{if(i!=me.Simple&&A>=e&&(i==me.TrackDel&&ne||i==me.TrackBefore&&ne))return null;if(A>e||A==e&&t<0&&!r)return e==n||t<0?s:s+o;s+=o}n=A}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i=0&&n<=t&&s>=e)return!(nt)||"cover";n=s}return!1}toString(){let e="";for(let t=0;t=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new e(t)}static create(t){return new e(t)}},Qe=class e extends Be{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return ye(this,((t,i,n,s,a)=>e=e.replace(n,n+(i-t),a)),!1),e}mapDesc(e,t=!1){return we(this,e,t,!0)}invert(t){let i=this.sections.slice(),n=[];for(let e=0,s=0;e=0){i[e]=r,i[e+1]=a;let o=e>>1;for(;n.length0&&be(n,i,a.text),a.forward(e),r+=e}let A=t[e++];for(;r>1].toJSON()))}return e}static of(t,i,n){let s=[],a=[],r=0,o=null;function A(t=!1){if(!t&&!s.length)return;rt||e<0||t>i)throw new RangeError(`Invalid change range ${e} to ${t} (in doc of length ${i})`);let l=o?"string"==typeof o?se.of(o.split(n||pe)):o:se.empty,g=l.length;if(e==t&&0==g)return;er&&Ee(s,e-r,-1),Ee(s,t-e,g),be(a,s,l),r=t}}(t),A(!o),o}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let e=0;et&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)i.push(s[0],0);else{for(;n.length=0&&i<=0&&i==e[s+1]?e[s]+=t:s>=0&&0==t&&0==e[s]?e[s+1]+=i:n?(e[s]+=t,e[s+1]+=i):e.push(t,i)}function be(e,t,i){if(0==i.length)return;let n=t.length-2>>1;if(n>1])),!(i||r==e.sections.length||e.sections[r+1]<0);)o=e.sections[r++],A=e.sections[r++];t(s,c,a,l,g),s=c,a=l}}}function we(e,t,i,n=!1){let s=[],a=n?[]:null,r=new Se(e),o=new Se(t);for(let e=-1;;){if(r.done&&o.len||o.done&&r.len)throw new Error("Mismatched change set lengths");if(-1==r.ins&&-1==o.ins){let e=Math.min(r.len,o.len);Ee(s,e,-1),r.forward(e),o.forward(e)}else if(o.ins>=0&&(r.ins<0||e==r.i||0==r.off&&(o.len=0&&e=0)){if(r.done&&o.done)return a?Qe.createSet(s,a):Be.create(s);throw new Error("Mismatched change set lengths")}{let t=0,i=r.len;for(;i;)if(-1==o.ins){let e=Math.min(i,o.len);t+=e,i-=e,o.forward(e)}else{if(!(0==o.ins&&o.lent||r.ins>=0&&r.len>t)&&(e||n.length>i),a.forward2(t),r.forward(t)}}else Ee(n,0,r.ins,e),s&&be(s,n,r.text),r.next()}}let Se=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?se.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?se.empty:t[i].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},ve=class e{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(t,i=-1){let n,s;return this.empty?n=s=t.mapPos(this.from,i):(n=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new e(n,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return De.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return De.range(this.anchor,i)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return De.range(e.anchor,e.head)}static create(t,i,n){return new e(t,i,n)}},De=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,i=-1){return t.empty?this:e.create(this.ranges.map((e=>e.map(t,i))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new e(t.ranges.map((e=>ve.fromJSON(e))),t.main)}static single(t,i=t){return new e([e.range(t,i)],0)}static create(t,i=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;se?8:0)|s)}static normalized(t,i=0){let n=t[i];t.sort(((e,t)=>e.from-t.from)),i=t.indexOf(n);for(let n=1;ns.head?e.range(o,r):e.range(r,o))}}return new e(t,i)}};function xe(e,t){for(let i of e.ranges)if(i.to>t)throw new RangeError("Selection points outside of document")}let Fe=0,Re=class e{constructor(e,t,i,n,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=Fe++,this.default=e([]),this.extensions="function"==typeof s?s(this):s}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Me),!!t.static,t.enables)}of(e){return new Ne([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ne(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ne(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(i=>t(i.field(e))))}};function Me(e,t){return e==t||e.length==t.length&&e.every(((e,i)=>e===t[i]))}let Ne=class{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=Fe++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,s=this.id,a=e[s]>>1,r=2==this.type,o=!1,A=!1,c=[];for(let i of this.dependencies)"doc"==i?o=!0:"selection"==i?A=!0:1&(null!==(t=e[i.id])&&void 0!==t?t:1)||c.push(e[i.id]);return{create:e=>(e.values[a]=i(e),1),update(e,t){if(o&&t.docChanged||A&&(t.docChanged||t.selection)||Ue(e,c)){let t=i(e);if(r?!Ge(t,e.values[a],n):!n(t,e.values[a]))return e.values[a]=t,1}return 0},reconfigure:(e,t)=>{let o,A=t.config.address[s];if(null!=A){let s=We(t,A);if(this.dependencies.every((i=>i instanceof Re?t.facet(i)===e.facet(i):!(i instanceof He)||t.field(i,!1)==e.field(i,!1)))||(r?Ge(o=i(e),s,n):n(o=i(e),s)))return e.values[a]=s,0}else o=i(e);return e.values[a]=o,1}}}};function Ge(e,t,i){if(e.length!=t.length)return!1;for(let n=0;ne[t.id])),s=i.map((e=>e.type)),a=n.filter((e=>!(1&e))),r=e[t.id]>>1;function o(e){let i=[];for(let t=0;te===t),t);return t.provide&&(i.provides=t.provide(i)),i}create(e){let t=e.facet(Te).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,i)=>{let n=e.values[t],s=this.updateF(n,i);return this.compareF(n,s)?0:(e.values[t]=s,1)},reconfigure:(e,i)=>null!=i.config.address[this.id]?(e.values[t]=i.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,Te.of({field:this,create:e})]}get extension(){return this}};function Oe(e){return t=>new Je(t,e)}const qe={highest:Oe(0),high:Oe(1),default:Oe(2),low:Oe(3),lowest:Oe(4)};let Je=class{constructor(e,t){this.inner=e,this.prec=t}},Pe=class e{of(e){return new Ye(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Ye=class{constructor(e,t){this.compartment=e,this.inner=t}},Ke=class e{constructor(e,t,i,n,s,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,i,n){let s=[],a=Object.create(null),r=new Map;for(let e of function(e,t,i){let n=[[],[],[],[],[]],s=new Map;return function e(a,r){let o=s.get(a);if(null!=o){if(o<=r)return;let e=n[o].indexOf(a);e>-1&&n[o].splice(e,1),a instanceof Ye&&i.delete(a.compartment)}if(s.set(a,r),Array.isArray(a))for(let t of a)e(t,r);else if(a instanceof Ye){if(i.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=t.get(a.compartment)||a.inner;i.set(a.compartment,n),e(n,r)}else if(a instanceof Je)e(a.inner,a.prec);else if(a instanceof He)n[r].push(a),a.provides&&e(a.provides,r);else if(a instanceof Ne)n[r].push(a),a.facet.extensions&&e(a.facet.extensions,2);else{let t=a.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,r)}}(e,2),n.reduce(((e,t)=>e.concat(t)))}(t,i,r))e instanceof He?s.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let o=Object.create(null),A=[],c=[];for(let e of s)o[e.id]=c.length<<1,c.push((t=>e.slot(t)));let l=null==n?void 0:n.config.facets;for(let e in a){let t=a[e],i=t[0].facet,s=l&&l[e]||[];if(t.every((e=>0==e.type)))if(o[i.id]=A.length<<1|1,Me(s,t))A.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));A.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=A.length<<1|1,A.push(e.value)):(o[e.id]=c.length<<1,c.push((t=>e.dynamicSlot(t))));o[i.id]=c.length<<1,c.push((e=>Le(e,i,t)))}}let g=c.map((e=>e(o)));return new e(t,r,g,o,A,a)}};function Ve(e,t){if(1&t)return 2;let i=t>>1,n=e.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;e.status[i]=4;let s=e.computeSlot(e,e.config.dynamicSlots[i]);return e.status[i]=2|s}function We(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const je=Re.define(),_e=Re.define({combine:e=>e.some((e=>e)),static:!0}),Xe=Re.define({combine:e=>e.length?e[0]:void 0,static:!0}),Ze=Re.define(),ze=Re.define(),$e=Re.define(),et=Re.define({combine:e=>!!e.length&&e[0]});let tt=class{constructor(e,t){this.type=e,this.value=t}static define(){return new it}},it=class{of(e){return new tt(this,e)}},nt=class{constructor(e){this.map=e}of(e){return new st(this,e)}},st=class e{constructor(e,t){this.type=e,this.value=t}map(t){let i=this.type.map(this.value,t);return void 0===i?void 0:i==this.value?this:new e(this.type,i)}is(e){return this.type==e}static define(e={}){return new nt(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let e=n.map(t);e&&i.push(e)}return i}};st.reconfigure=st.define(),st.appendConfig=st.define();let at=class e{constructor(t,i,n,s,a,r){this.startState=t,this.changes=i,this.selection=n,this.effects=s,this.annotations=a,this.scrollIntoView=r,this._doc=null,this._state=null,n&&xe(n,i.newLength),a.some((t=>t.type==e.time))||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,i,n,s,a,r){return new e(t,i,n,s,a,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let i=this.annotation(e.userEvent);return!(!i||!(i==t||i.length>t.length&&i.slice(0,t.length)==t&&"."==i[t.length]))}};function rt(e,t){let i=[];for(let n=0,s=0;;){let a,r;if(n=e[n]))a=e[n++],r=e[n++];else{if(!(s=0;s--){let a=i[s](e);a&&Object.keys(a).length&&(n=ot(n,At(t,a,e.changes.newLength),!0))}return n==e?e:at.create(t,e.changes,e.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(e){let t=e.startState,i=!0;for(let n of t.facet(Ze)){let t=n(e);if(!1===t){i=!1;break}Array.isArray(t)&&(i=!0===i?t:rt(i,t))}if(!0!==i){let n,s;if(!1===i)s=e.changes.invertedDesc,n=Qe.empty(t.doc.length);else{let t=e.changes.filter(i);n=t.changes,s=t.filtered.mapDesc(t.changes).invertedDesc}e=at.create(t,n,e.selection&&e.selection.map(s),st.mapEffects(e.effects,s),e.annotations,e.scrollIntoView)}let n=t.facet(ze);for(let i=n.length-1;i>=0;i--){let s=n[i](e);e=s instanceof at?s:Array.isArray(s)&&1==s.length&&s[0]instanceof at?s[0]:ct(t,gt(s),!1)}return e}(s):s)}at.time=tt.define(),at.userEvent=tt.define(),at.addToHistory=tt.define(),at.remote=tt.define();const lt=[];function gt(e){return null==e?lt:Array.isArray(e)?e:[e]}var ht=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ht||(ht={}));const dt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ut;try{ut=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(LI){}let It=class e{constructor(e,t,i,n,s,a){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let e=0;ea.set(t,e))),n=null),a.set(e.value.compartment,e.value.extension)):e.is(st.reconfigure)?(n=null,s=e.value):e.is(st.appendConfig)&&(n=null,s=gt(s).concat(e.value));n?i=t.startState.values.slice():(n=Ke.resolve(s,a,this),i=new e(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values);let r=t.startState.facet(_e)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,r,i,((e,i)=>i.update(e,t)),t)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:De.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),s=[i.range],a=gt(i.effects);for(let i=1;ii.spec.fromJSON(a,e))))}return e.create({doc:t.doc,selection:De.fromJSON(t.selection),extensions:i.extensions?s.concat([i.extensions]):s})}static create(t={}){let i=Ke.resolve(t.extensions||[],new Map),n=t.doc instanceof se?t.doc:se.of((t.doc||"").split(i.staticFacet(e.lineSeparator)||pe)),s=t.selection?t.selection instanceof De?t.selection:De.single(t.selection.anchor,t.selection.head):De.single(0);return xe(s,n.length),i.staticFacet(_e)||(s=s.asSingle()),new e(i,n,s,i.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||"\n"}get readOnly(){return this.facet(et)}phrase(t,...i){for(let i of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return i.length&&(t=t.replace(/\$(\$|\d*)/g,((e,t)=>{if("$"==t)return"$";let n=+(t||1);return!n||n>i.length?e:i[n-1]}))),t}languageDataAt(e,t,i=-1){let n=[];for(let s of this.facet(je))for(let a of s(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&n.push(a[e]);return n}charCategorizer(e){return function(e){return t=>{if(!/\S/.test(t))return ht.Space;if(function(e){if(ut)return ut.test(e);for(let t=0;t"€"&&(i.toUpperCase()!=i.toLowerCase()||dt.test(i)))return!0}return!1}(t))return ht.Word;for(let i=0;i-1)return ht.Word;return ht.Other}}(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),a=e-i,r=e-i;for(;a>0;){let e=ue(t,a,!1);if(s(t.slice(e,a))!=ht.Word)break;a=e}for(;re.length?e[0]:4}),It.lineSeparator=Xe,It.readOnly=et,It.phrases=Re.define({compare(e,t){let i=Object.keys(e),n=Object.keys(t);return i.length==n.length&&i.every((i=>e[i]==t[i]))}}),It.languageData=je,It.changeFilter=Ze,It.transactionFilter=ze,It.transactionExtender=$e,Pe.reconfigure=st.define();let Ct=class{eq(e){return this==e}range(e,t=e){return pt.create(e,t,this)}};Ct.prototype.startSide=Ct.prototype.endSide=0,Ct.prototype.point=!1,Ct.prototype.mapMode=me.TrackDel;let pt=class e{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(t,i,n){return new e(t,i,n)}};function mt(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}let Bt=class e{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let s=i?this.to:this.from;for(let a=n,r=s.length;;){if(a==r)return a;let n=a+r>>1,o=s[n]-e||(i?this.value[n].endSide:this.value[n].startSide)-t;if(n==a)return o>=0?a:r;o>=0?r=n:a=n+1}}between(e,t,i,n){for(let s=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,s);sc||A==c&&l.startSide>0&&l.endSide<=0)continue;(c-A||l.endSide-l.startSide)<0||(r<0&&(r=A),l.point&&(o=Math.max(o,c-A)),n.push(l),s.push(A-r),a.push(c-r))}return{mapped:n.length?new e(s,a,n,o):null,pos:r}}},Qt=class e{constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(t,i,n,s){return new e(t,i,n,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:i=[],sort:n=!1,filterFrom:s=0,filterTo:a=this.length}=t,r=t.filter;if(0==i.length&&!r)return this;if(n&&(i=i.slice().sort(mt)),this.isEmpty)return i.length?e.of(i):this;let o=new yt(this,null,-1).goto(0),A=0,c=[],l=new Et;for(;o.value||A=0){let e=i[A++];l.addInner(e.from,e.to,e.value)||c.push(e)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||ao.to||a=s&&e<=s+a.length&&!1===a.between(s,e-s,t-s,i))return}this.nextLayer.between(e,t,i)}}iter(e=0){return wt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return wt.from(e).goto(t)}static compare(e,t,i,n,s=-1){let a=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=s)),r=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=s)),o=bt(a,r,i),A=new St(a,o,s),c=new St(r,o,s);i.iterGaps(((e,t,i)=>vt(A,e,c,t,i,n))),i.empty&&0==i.length&&vt(A,0,c,0,0,n)}static eq(e,t,i=0,n){null==n&&(n=999999999);let s=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),a=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(s.length!=a.length)return!1;if(!s.length)return!0;let r=bt(s,a),o=new St(s,r,0).goto(i),A=new St(a,r,0).goto(i);for(;;){if(o.to!=A.to||!Dt(o.active,A.active)||o.point&&(!A.point||!o.point.eq(A.point)))return!1;if(o.to>n)return!0;o.next(),A.next()}}static spans(e,t,i,n,s=-1){let a=new St(e,null,s).goto(t),r=t,o=a.openStart;for(;;){let e=Math.min(a.to,i);if(a.point){let i=a.activeForPoint(a.to),s=a.pointFromr&&(n.span(r,e,a.active,o),o=a.openEnd(e));if(a.to>i)return o+(a.point&&a.to>i?1:0);r=a.to,a.next()}}static of(e,t=!1){let i=new Et;for(let n of e instanceof pt?[e]:t?function(e){if(e.length>1)for(let t=e[0],i=1;i0)return e.slice().sort(mt);t=n}return e}(e):e)i.add(n.from,n.to,n.value);return i.finish()}static join(t){if(!t.length)return e.empty;let i=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let s=t[n];s!=e.empty;s=s.nextLayer)i=new e(s.chunkPos,s.chunk,i,Math.max(s.maxPoint,i.maxPoint));return i}};Qt.empty=new Qt([],[],null,-1),Qt.empty.nextLayer=Qt.empty;let Et=class e{finishChunk(e){this.chunks.push(new Bt(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,i,n){this.addInner(t,i,n)||(this.nextLayer||(this.nextLayer=new e)).add(t,i,n)}addInner(e,t,i){let n=e-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(Qt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Qt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function bt(e,t,i){let n=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&s.push(new yt(a,i,n,e));return 1==s.length?s[0]:new e(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)kt(this.heap,e);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)kt(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),kt(this.heap,0)}}};function kt(e,t){for(let i=e[t];;){let n=1+(t<<1);if(n>=e.length)break;let s=e[n];if(n+1=0&&(s=e[n+1],n++),i.compare(s)<0)break;e[n]=i,e[t]=s,t=n}}let St=class{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=wt.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){xt(this.active,e),xt(this.activeTo,e),xt(this.activeRank,e),this.minActive=Rt(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:n,rank:s}=this.cursor;for(;t0;)t++;Ft(this.active,t,i),Ft(this.activeTo,t,n),Ft(this.activeRank,t,s),e&&Ft(e,t,this.cursor.from),this.minActive=Rt(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&xt(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[t]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}};function vt(e,t,i,n,s,a){e.goto(t),i.goto(n);let r=n+s,o=n,A=n-t;for(;;){let t=e.to+A-i.to,n=t||e.endSide-i.endSide,s=n<0?e.to+A:i.to,c=Math.min(s,r);if(e.point||i.point?e.point&&i.point&&(e.point==i.point||e.point.eq(i.point))&&Dt(e.activeForPoint(e.to),i.activeForPoint(i.to))||a.comparePoint(o,c,e.point,i.point):c>o&&!Dt(e.active,i.active)&&a.compareRange(o,c,e.active,i.active),s>r)break;(t||e.openEnd!=i.openEnd)&&a.boundChange&&a.boundChange(s),o=s,n<=0&&e.next(),n>=0&&i.next()}}function Dt(e,t){if(e.length!=t.length)return!1;for(let i=0;i=t;i--)e[i+1]=e[i];e[t]=i}function Rt(e,t){let i=-1,n=1e9;for(let s=0;s=t)return n;if(n==e.length)break;s+=9==e.charCodeAt(n)?i-s%i:1,n=ue(e,n)}return!0===n?-1:e.length}const Gt="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Ut="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Lt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};let Tt=class{constructor(e,t){this.rules=[];let{finish:i}=t||{};function n(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function s(e,t,a,r){let o=[],A=/^@(\w+)\b/.exec(e[0]),c=A&&"keyframes"==A[1];if(A&&null==t)return a.push(e[0]+";");for(let i in t){let r=t[i];if(/&/.test(i))s(i.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),r,a);else if(r&&"object"==typeof r){if(!A)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),r,o,c)}else null!=r&&o.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+r+";")}(o.length||c)&&a.push((!i||A||r?e:e.map(i)).join(", ")+" {"+o.join(" ")+"}")}for(let t in e)s(n(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Lt[Gt]||1;return Lt[Gt]=e+1,"ͼ"+e.toString(36)}static mount(e,t,i){let n=e[Ut],s=i&&i.nonce;n?s&&n.setNonce(s):n=new Ot(e,s),n.mount(Array.isArray(t)?t:[t],e)}},Ht=new Map,Ot=class{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let t=Ht.get(i);if(t)return e[Ut]=t;this.sheet=new n.CSSStyleSheet,Ht.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Ut]=this}mount(e,t){let i=this.sheet,n=0,s=0;for(let t=0;t-1&&(this.modules.splice(r,1),s--,r=-1),-1==r){if(this.modules.splice(s++,0,a),i)for(let e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Pt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Yt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=0;Kt<10;Kt++)qt[48+Kt]=qt[96+Kt]=String(Kt);for(Kt=1;Kt<=24;Kt++)qt[Kt+111]="F"+Kt;for(Kt=65;Kt<=90;Kt++)qt[Kt]=String.fromCharCode(Kt+32),Jt[Kt]=String.fromCharCode(Kt);for(var Vt in qt)Jt.hasOwnProperty(Vt)||(Jt[Vt]=qt[Vt]);function Wt(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function jt(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function _t(e,t){if(!t.anchorNode)return!1;try{return jt(e,t.anchorNode)}catch(e){return!1}}function Xt(e){return 3==e.nodeType?ci(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Zt(e,t,i,n){return!!i&&(ei(e,t,i,n,-1)||ei(e,t,i,n,1))}function zt(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function $t(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function ei(e,t,i,n,s){for(;;){if(e==i&&t==n)return!0;if(t==(s<0?0:ti(e))){if("DIV"==e.nodeName)return!1;let i=e.parentNode;if(!i||1!=i.nodeType)return!1;t=zt(e)+(s<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(s<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=s<0?ti(e):0}}}function ti(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ii(e,t){let i=t?e.left:e.right;return{left:i,right:i,top:e.top,bottom:e.bottom}}function ni(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function si(e,t){let i=t.width/e.offsetWidth,n=t.height/e.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.width-e.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.height-e.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}let ai,ri=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?ti(t):0),i,Math.min(e.focusOffset,i?ti(i):0))}set(e,t,i,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=n}},oi=null;function Ai(e){if(e.setActive)return e.setActive();if(oi)return e.focus(oi);let t=[];for(let i=e;i&&(t.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(e.focus(null==oi?{get preventScroll(){return oi={preventScroll:!0},!0}}:void 0),!oi){oi=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}function di(e,t){for(let i=e,n=t;;){if(3==i.nodeType&&n>0)return{node:i,offset:n};if(1==i.nodeType&&n>0){if("false"==i.contentEditable)return null;i=i.childNodes[n-1],n=ti(i)}else{if(!i.parentNode||$t(i))return null;n=zt(i),i=i.parentNode}}}function ui(e,t){for(let i=e,n=t;;){if(3==i.nodeType&&nt)return i.domBoundsAround(e,t,A);if(l>=e&&-1==n&&(n=o,s=A),A>t&&i.dom.parentNode==this.dom){a=o,r=c;break}c=l,A=l+i.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=fi){this.markDirty();for(let n=e;nthis.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}};function Bi(e,t,i,n,s,a,r,o,A){let{children:c}=e,l=c.length?c[t]:null,g=a.length?a[a.length-1]:null,h=g?g.breakAfter:r;if(!(t==n&&l&&!r&&!h&&a.length<2&&l.merge(i,s,a.length?g:null,0==i,o,A))){if(n0&&(!r&&a.length&&l.merge(i,l.length,a[0],!1,o,0)?l.breakAfter=a.shift().breakAfter:(i2);var Mi={mac:Ri||/Mac/.test(Ei.platform),windows:/Win/.test(Ei.platform),linux:/Linux|X11/.test(Ei.platform),ie:Si,ie_version:wi?bi.documentMode||6:ki?+ki[1]:yi?+yi[1]:0,gecko:vi,gecko_version:vi?+(/Firefox\/(\d+)/.exec(Ei.userAgent)||[0,0])[1]:0,chrome:!!Di,chrome_version:Di?+Di[1]:0,ios:Ri,android:/Android\b/.test(Ei.userAgent),webkit:xi,safari:Fi,webkit_version:xi?+(/\bAppleWebKit\/(\d+)/.exec(Ei.userAgent)||[0,0])[1]:0,tabSize:null!=bi.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};let Ni=class e extends Ci{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(t,i,n){return!(8&this.flags||n&&(!(n instanceof e)||this.length-(i-t)+n.length>256||8&n.flags)||(this.text=this.text.slice(0,t)+(n?n.text:"")+this.text.slice(i),this.markDirty(),0))}split(t){let i=new e(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),i.flags|=8&this.flags,i}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ii(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,i){let n=e.nodeValue.length;t>n&&(t=n);let s=t,a=t,r=0;0==t&&i<0||t==n&&i>=0?Mi.chrome||Mi.gecko||(t?(s--,r=1):a=0)?0:o.length-1];return Mi.safari&&!r&&0==A.width&&(A=Array.prototype.find.call(o,(e=>e.width))||A),r?ii(A,r<0):A||null}(this.dom,e,t)}},Gi=class e extends Ci{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let e of t)e.setParent(this)}setAttrs(e){if(gi(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(t,i,n,s,a,r){return!(n&&(!(n instanceof e&&n.mark.eq(this.mark))||t&&a<=0||it&&i.push(n=t&&(s=a),n=r,a++}let r=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new e(this.mark,i,r)}domAtPos(e){return Ti(this,e)}coordsAt(e,t){return Oi(this,e,t)}},Ui=class e extends Ci{static create(t,i,n){return new e(t,i,n)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(t){let i=e.create(this.widget,this.length-t,this.side);return this.length-=t,i}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,i,n,s,a,r){return!(n&&(!(n instanceof e&&this.widget.compare(n.widget))||t>0&&a<=0||i0)?Ii.before(this.dom):Ii.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let a=this.side?this.side<0:e>0;for(let t=a?n.length-1:0;s=n[t],!(e>0?0==t:t==n.length-1||s.top0?Ii.before(this.dom):Ii.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return se.empty}get isHidden(){return!0}};function Ti(e,t){let i=e.dom,{children:n}=e,s=0;for(let e=0;se&&t0;e--){let t=n[e-1];if(t.dom.parentNode==i)return t.domAtPos(t.length)}for(let e=s;e0&&t instanceof Gi&&s.length&&(n=s[s.length-1])instanceof Gi&&n.mark.eq(t.mark)?Hi(n,t.children[0],i-1):(s.push(t),t.setParent(e)),e.length+=t.length}function Oi(e,t,i){let n=null,s=-1,a=null,r=-1;!function e(t,o){for(let A=0,c=0;A=o&&(l.children.length?e(l,o-c):(!a||a.isHidden&&i>0)&&(g>o||c==g&&l.getSide()>0)?(a=l,r=o-c):(c-1?1:0)!=s.length-(i&&s.indexOf(i)>-1?1:0))return!1;for(let a of n)if(a!=i&&(-1==s.indexOf(a)||e[a]!==t[a]))return!1;return!0}function Yi(e,t,i){let n=!1;if(t)for(let s in t)i&&s in i||(n=!0,"style"==s?e.style.cssText="":e.removeAttribute(s));if(i)for(let s in i)t&&t[s]==i[s]||(n=!0,"style"==s?e.style.cssText=i[s]:e.setAttribute(s,i[s]));return n}function Ki(e){let t=Object.create(null);for(let i=0;i0?3e8:-4e8:t>0?1e8:-1e8,new Zi(e,t,t,i,e.widget||null,!1)}static replace(e){let t,i,n=!!e.block;if(e.isBlockGap)t=-5e8,i=4e8;else{let{start:s,end:a}=zi(e,n);t=(s?n?-3e8:-1:5e8)-1,i=1+(a?n?2e8:1:-6e8)}return new Zi(e,t,i,n,e.widget||null,!0)}static line(e){return new Xi(e)}static set(e,t=!1){return Qt.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ji.none=Qt.empty;class _i extends ji{constructor(e){let{start:t,end:i}=zi(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof _i&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(i=e.attrs)||void 0===i?void 0:i.class))&&Pi(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}_i.prototype.point=!1;class Xi extends ji{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Xi&&this.spec.class==e.spec.class&&Pi(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Xi.prototype.mapMode=me.TrackBefore,Xi.prototype.point=!0;class Zi extends ji{constructor(e,t,i,n,s,a){super(t,i,s,e),this.block=n,this.isReplace=a,this.mapMode=n?t<=0?me.TrackBefore:me.TrackAfter:me.TrackDel}get type(){return this.startSide!=this.endSide?Wi.WidgetRange:this.startSide<=0?Wi.WidgetBefore:Wi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Zi&&((t=this.widget)==(i=e.widget)||!!(t&&i&&t.compare(i)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,i}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function zi(e,t=!1){let{inclusiveStart:i,inclusiveEnd:n}=e;return null==i&&(i=e.inclusive),null==n&&(n=e.inclusive),{start:null!=i?i:t,end:null!=n?n:t}}function $i(e,t,i,n=0){let s=i.length-1;s>=0&&i[s]+n>=e?i[s]=Math.max(i[s],t):i.push(e,t)}Zi.prototype.point=!0;class en extends Ci{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,n,s,a){if(i){if(!(i instanceof en))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),Qi(this,e,t,i?i.children.slice():[],s,a),!0}split(e){let t=new en;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:i,off:n}=this.childPos(e);n&&(t.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let e=i;e0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Pi(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Hi(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=qi(t,this.attrs||{})),i&&(this.attrs=qi({class:i},this.attrs||{}))}domAtPos(e){return Ti(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?4&this.flags&&(gi(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Yi(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&Ci.get(n)instanceof Gi;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Ci.get(n))||void 0===i?void 0:i.isEditable)||Mi.ios&&this.children.some((e=>e instanceof Ni))))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let i of this.children){if(!(i instanceof Ni)||/[^ -~]/.test(i.text))return null;let n=Xt(i.dom);if(1!=n.length)return null;t+=n[0].width,e=n[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let i=Oi(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=i.bottom-i.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight=t){if(s instanceof en)return s;if(a>t)break}n=a+s.breakAfter}return null}}class tn extends Ci{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,n,s,a){return!(i&&(!(i instanceof tn&&this.widget.compare(i.widget))||e>0&&s<=0||t0)}}class nn extends Vi{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class sn{constructor(e,t,i,n){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof tn&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new en),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(an(new Li(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof tn||this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(an(new Ni(this.text.slice(this.textOff,this.textOff+n)),t),i),this.atCursorPos=!0,this.textOff+=n,e-=n,i=0}}span(e,t,i,n){this.buildText(t-e,i,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,i,n,s,a){if(this.disallowBlockEffectsFor[a]&&i instanceof Zi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=t-e;if(i instanceof Zi)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new tn(i.widget||rn.block,r,i));else{let a=Ui.create(i.widget||rn.inline,r,r?0:i.startSide),o=this.atCursorPos&&!a.isEditable&&s<=n.length&&(e0),A=!a.isEditable&&(en.length||i.startSide<=0),c=this.getLine();2!=this.pendingBuffer||o||a.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),o&&(c.append(an(new Li(1),n),s),s=n.length+Math.max(0,s-n.length)),c.append(an(a,n),s),this.atCursorPos=A,this.pendingBuffer=A?en.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,i,n,s){let a=new sn(e,t,i,s);return a.openEnd=Qt.spans(n,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function an(e,t){for(let i of t)e=new Gi(i,[e],e.length);return e}class rn extends Vi{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}rn.inline=new rn("span"),rn.block=new rn("div");var on=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(on||(on={}));const An=on.LTR,cn=on.RTL;function ln(e){let t=[];for(let i=0;i=t){if(r.level==i)return a;(s<0||(0!=n?n<0?r.fromt:e[s].level>r.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function pn(e,t){if(e.length!=t.length)return!1;for(let i=0;iA&&r.push(new Cn(A,u.from,h)),Qn(e,u.direction==An!=!(h%2)?n+1:n,s,u.inner,u.from,u.to,r),A=u.to),d=u.to}else{if(d==i||(t?mn[d]!=o:mn[d]==o))break;d++}g?Bn(e,A,d,n+1,s,g,r):At;){let i=!0,l=!1;if(!c||A>a[c-1].to){let e=mn[A-1];e!=o&&(i=!1,l=16==e)}let g=i||1!=o?null:[],h=i?n:n+1,d=A;e:for(;;)if(c&&d==a[c-1].to){if(l)break e;let u=a[--c];if(!i)for(let e=u.from,i=c;;){if(e==t)break e;if(!i||a[i-1].to!=e){if(mn[e-1]==o)break e;break}e=a[--i].from}g?g.push(u):(u.to=0;e-=3)if(un[e+1]==-i){let t=un[e+2],i=2&t?s:4&t?1&t?a:s:0;i&&(mn[r]=mn[un[e]]=i),o=e;break}}else{if(189==un.length)break;un[o++]=r,un[o++]=t,un[o++]=A}else if(2==(n=mn[r])||1==n){let e=n==s;A=e?0:1;for(let t=o-3;t>=0;t-=3){let i=un[t+2];if(2&i)break;if(e)un[t+2]|=2;else{if(4&i)break;un[t+2]|=4}}}}}(e,s,a,n,o),function(e,t,i,n){for(let s=0,a=n;s<=i.length;s++){let r=s?i[s-1].to:e,o=sA;)t==a&&(t=i[--n].from,a=n?i[n-1].to:e),mn[--t]=l;A=r}else a=r,A++}}}(s,a,n,o),Bn(e,s,a,t,i,n,r)}function En(e){return[new Cn(0,e,0)]}let bn="";function yn(e,t,i,n,s){var a;let r=n.head-e.from,o=Cn.find(t,r,null!==(a=n.bidiLevel)&&void 0!==a?a:-1,n.assoc),A=t[o],c=A.side(s,i);if(r==c){let e=o+=s?1:-1;if(e<0||e>=t.length)return null;A=t[o=e],r=A.side(!s,i),c=A.side(s,i)}let l=ue(e.text,r,A.forward(s,i));(lA.to)&&(l=c),bn=e.text.slice(Math.min(r,l),Math.max(r,l));let g=o==(s?t.length-1:0)?null:t[o+(s?1:-1)];return g&&l==c&&g.level+(s?0:1)e.some((e=>e))}),Un=Re.define({combine:e=>e.some((e=>e))}),Ln=Re.define();class Tn{constructor(e,t="nearest",i="nearest",n=5,s=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=n,this.xMargin=s,this.isSnapshot=a}map(e){return e.empty?this:new Tn(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Tn(De.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Hn=st.define({map:(e,t)=>e.map(t)}),On=st.define();function qn(e,t,i){let n=e.facet(Dn);n.length?n[0](t):window.onerror?window.onerror(String(t),i,void 0,void 0,t):i?console.error(i+":",t):console.error(t)}const Jn=Re.define({combine:e=>!e.length||e[0]});let Pn=0;const Yn=Re.define();class Kn{constructor(e,t,i,n,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=n,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:n,provide:s,decorations:a}=t||{};return new Kn(Pn++,e,i,n,(e=>{let t=[Yn.of(e)];return a&&t.push(_n.of((t=>{let i=t.plugin(e);return i?a(i):ji.none}))),s&&t.push(s(e)),t}))}static fromClass(e,t){return Kn.define((t=>new e(t)),t)}}class Vn{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(qn(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){qn(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){qn(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Wn=Re.define(),jn=Re.define(),_n=Re.define(),Xn=Re.define(),Zn=Re.define(),zn=Re.define();function $n(e,t){let i=e.state.facet(zn);if(!i.length)return i;let n=i.map((t=>t instanceof Function?t(e):t)),s=[];return Qt.spans(n,t.from,t.to,{point(){},span(e,i,n,a){let r=e-t.from,o=i-t.from,A=s;for(let e=n.length-1;e>=0;e--,a--){let i,s=n[e].spec.bidiIsolate;if(null==s&&(s=wn(t.text,r,o)),a>0&&A.length&&(i=A[A.length-1]).to==r&&i.direction==s)i.to=o,A=i.inner;else{let e={from:r,to:o,direction:s,inner:[]};A.push(e),A=e.inner}}}}),s}const es=Re.define();function ts(e){let t=0,i=0,n=0,s=0;for(let a of e.state.facet(es)){let r=a(e);r&&(null!=r.left&&(t=Math.max(t,r.left)),null!=r.right&&(i=Math.max(i,r.right)),null!=r.top&&(n=Math.max(n,r.top)),null!=r.bottom&&(s=Math.max(s,r.bottom)))}return{left:t,right:i,top:n,bottom:s}}const is=Re.define();class ns{constructor(e,t,i,n){this.fromA=e,this.toA=t,this.fromB=i,this.toB=n}join(e){return new ns(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>i.toA)){if(n.toAc)break;s+=2}if(!o)return i;new ns(o.fromA,o.toA,o.fromB,o.toB).addToSet(i),a=o.toA,r=o.toB}}}class ss{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Qe.empty(this.startState.doc.length);for(let e of i)this.changes=this.changes.compose(e.changes);let n=[];this.changes.iterChangedRanges(((e,t,i,s)=>n.push(new ns(e,t,i,s)))),this.changedRanges=n}static create(e,t,i){return new ss(e,t,i)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}class as extends Ci{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ji.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new en],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ns(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every((({fromA:e,toA:t})=>tthis.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?n=this.domChanged.newSel.head:function(e,t){let i=!1;return t&&e.iterChangedRanges(((e,n)=>{et.from&&(i=!0)})),i}(e.changes,this.hasComposition)||e.selectionSet||(n=e.state.selection.main.head));let s=n>-1?function(e,t,i){let n=rs(e,i);if(!n)return null;let{node:s,from:a,to:r}=n,o=s.nodeValue;if(/[\n\r]/.test(o))return null;if(e.state.doc.sliceString(n.from,n.to)!=o)return null;let A=t.invertedDesc,c=new ns(A.mapPos(a),A.mapPos(r),a,r),l=[];for(let t=s.parentNode;;t=t.parentNode){let i=Ci.get(t);if(i instanceof Gi)l.push({node:t,deco:i.mark});else{if(i instanceof en||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:s,marks:l,line:t};if(t==e.contentDOM)return null;l.push({node:t,deco:new _i({inclusive:!0,attributes:Ki(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:n}=this.hasComposition;i=new ns(t,n,e.changes.mapPos(t,-1),e.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Mi.ie||Mi.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=function(e,t,i){let n=new os;return Qt.compare(e,t,i,n),n.changes}(this.decorations,this.updateDeco(),e.changes);return i=ns.extendWithRanges(i,a),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:n}=this.view;n.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=Mi.chrome||Mi.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||n.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((e=>e.flags&=-9));let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[e]:null;if(!t)break;let a,r,o,A,{fromA:c,toA:l,fromB:g,toB:h}=t;if(i&&i.range.fromBg){let e=sn.build(this.view.state.doc,g,i.range.fromB,this.decorations,this.dynamicDecorationMap),t=sn.build(this.view.state.doc,i.range.toB,h,this.decorations,this.dynamicDecorationMap);r=e.breakAtStart,o=e.openStart,A=t.openEnd;let n=this.compositionView(i);t.breakAtStart?n.breakAfter=1:t.content.length&&n.merge(n.length,n.length,t.content[0],!1,t.openStart,0)&&(n.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&n.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),a=e.content.concat(n).concat(t.content)}else({content:a,breakAtStart:r,openStart:o,openEnd:A}=sn.build(this.view.state.doc,g,h,this.decorations,this.dynamicDecorationMap));let{i:d,off:u}=s.findPos(l,1),{i:I,off:f}=s.findPos(c,-1);Bi(this,I,f,d,u,a,r,o,A)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(On)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new Ni(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new Gi(i,[t],t.length);let i=new en;return i.append(t,0),i}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some((e=>7&e.flags))?1:0),this.markedForComposition.add(t);let i=Ci.get(e);i&&i!=t&&(i.dom=null),t.setDOM(e)},i=this.childPos(e.range.fromB,1),n=this.children[i.i];t(e.line,n);for(let s=e.marks.length-1;s>=-1;s--)i=n.childPos(i.off,1),n=n.children[i.i],t(s>=0?e.marks[s].node:e.text,n)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,s=!n&&!(this.view.state.facet(Jn)||this.dom.tabIndex>-1)&&_t(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||t||s))return;let a=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,o=this.moveToLine(this.domAtPos(r.anchor)),A=r.empty?o:this.moveToLine(this.domAtPos(r.head));if(Mi.gecko&&r.empty&&!this.hasComposition&&1==(c=o).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore((()=>o.node.insertBefore(e,o.node.childNodes[o.offset]||null))),o=A=new Ii(e,0),a=!0}var c;let l=this.view.observer.selectionRange;!a&&l.focusNode&&(Zt(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Zt(A.node,A.offset,l.focusNode,l.focusOffset)||this.suppressWidgetCursorChange(l,r))||(this.view.observer.ignore((()=>{Mi.android&&Mi.chrome&&this.dom.contains(l.focusNode)&&function(e,t){for(let i=e;i&&i!=t;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=Wt(this.view.root);if(e)if(r.empty){if(Mi.gecko){let e=(t=o.node,n=o.offset,1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(nr.head&&([o,A]=[A,o]),t.setEnd(A.node,A.offset),t.setStart(o.node,o.offset),e.removeAllRanges(),e.addRange(t)}var t,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(o,A)),this.impreciseAnchor=o.precise?null:new Ii(l.anchorNode,l.anchorOffset),this.impreciseHead=A.precise?null:new Ii(l.focusNode,l.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Zt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Wt(e.root),{anchorNode:n,anchorOffset:s}=e.observer.selectionRange;if(!(i&&t.empty&&t.assoc&&i.modify))return;let a=en.find(this,t.head);if(!a)return;let r=a.posAtStart;if(t.head==r||t.head==r+a.length)return;let o=this.coordsAt(t.head,-1),A=this.coordsAt(t.head,1);if(!o||!A||o.bottom>A.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let l=e.observer.selectionRange;e.docView.posFromDOM(l.anchorNode,l.anchorOffset)!=t.from&&i.collapse(n,s)}moveToLine(e){let t,i=this.dom;if(e.node!=i)return e;for(let n=e.offset;!t&&n=0;n--){let e=Ci.get(i.childNodes[n]);e instanceof en&&(t=e.domAtPos(e.length))}return t?new Ii(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=Ci.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t=0;a--){let r=this.children[a],o=s-r.breakAfter,A=o-r.length;if(oe||r.covers(1))&&(!i||r instanceof en&&!(i instanceof en&&t>=0)))i=r,n=A;else if(i&&A==e&&o==e&&r instanceof tn&&Math.abs(t)<2){if(r.deco.startSide<0)break;a&&(i=null)}s=A}return i?i.coordsAt(e-n,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),n=this.children[t];if(!(n instanceof en))return null;for(;n.children.length;){let{i:e,off:t}=n.childPos(i,1);for(;;e++){if(e==n.children.length)return null;if((n=n.children[e]).length)break}i=t}if(!(n instanceof Ni))return null;let s=ue(n.text,i);if(s==i)return null;let a=ci(n.dom,i,s).getClientRects();for(let e=0;eMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,o=this.view.textDirection==on.LTR;for(let e=0,A=0;An)break;if(e>=i){let i=c.dom.getBoundingClientRect();if(t.push(i.height),a){let t=c.dom.lastChild,n=t?Xt(t):[];if(n.length){let t=n[n.length-1],a=o?t.right-i.left:i.right-t.left;a>r&&(r=a,this.minWidth=s,this.minWidthFrom=e,this.minWidthTo=l)}}}e=l+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?on.RTL:on.LTR}measureTextSize(){for(let e of this.children)if(e instanceof en){let t=e.measureTextSize();if(t)return t}let e,t,i,n=document.createElement("div");return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=Xt(n.firstChild)[0];e=n.getBoundingClientRect().height,t=s?s.width/27:7,i=s?s.height:e,n.remove()})),{lineHeight:e,charWidth:t,textHeight:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new mi(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,n=0;;n++){let s=n==t.viewports.length?null:t.viewports[n],a=s?s.from-1:this.length;if(a>i){let n=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(ji.replace({widget:new nn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!s)break;i=s.to+1}return ji.set(e)}updateDeco(){let e=1,t=this.view.state.facet(_n).map((t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t)),i=!1,n=this.view.state.facet(Xn).map(((e,t)=>{let n="function"==typeof e;return n&&(i=!0),n?e(this.view):e}));for(n.length&&(this.dynamicDecorationMap[e++]=i,t.push(Qt.join(n))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];ei.anchor?-1:1);if(!n)return;!i.empty&&(t=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,t.left),top:Math.min(n.top,t.top),right:Math.max(n.right,t.right),bottom:Math.max(n.bottom,t.bottom)});let s=ts(this.view),a={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:r,offsetHeight:o}=this.view.scrollDOM;!function(e,t,i,n,s,a,r,o){let A=e.ownerDocument,c=A.defaultView||window;for(let l=e,g=!1;l&&!g;)if(1==l.nodeType){let e,h=l==A.body,d=1,u=1;if(h)e=ni(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(l).position)&&(g=!0),l.scrollHeight<=l.clientHeight&&l.scrollWidth<=l.clientWidth){l=l.assignedSlot||l.parentNode;continue}let t=l.getBoundingClientRect();({scaleX:d,scaleY:u}=si(l,t)),e={left:t.left,right:t.left+l.clientWidth*d,top:t.top,bottom:t.top+l.clientHeight*u}}let I=0,f=0;if("nearest"==s)t.top0&&t.bottom>e.bottom+f&&(f=t.bottom-e.bottom+f+r)):t.bottom>e.bottom&&(f=t.bottom-e.bottom+r,i<0&&t.top-f0&&t.right>e.right+I&&(I=t.right-e.right+I+a)):t.right>e.right&&(I=t.right-e.right+a,i<0&&t.lefte?t.left-e:Math.max(0,e-t.right)}function cs(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function ls(e,t){return e.topt.top+1}function gs(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function ds(e,t,i){let n,s,a,r,o,A,c,l,g=!1;for(let h=e.firstChild;h;h=h.nextSibling){let e=Xt(h);for(let d=0;df||r==f&&a>I){n=h,s=u,a=I,r=f;let o=f?i0?d0)}0==I?i>u.bottom&&(!c||c.bottomu.top)&&(A=h,l=u):c&&ls(c,u)?c=hs(c,u.bottom):l&&ls(l,u)&&(l=gs(l,u.top))}}if(c&&c.bottom>=i?(n=o,s=c):l&&l.top<=i&&(n=A,s=l),!n)return{node:e,offset:0};let h=Math.max(s.left,Math.min(s.right,t));return 3==n.nodeType?us(n,h,i):g&&"false"!=n.contentEditable?ds(n,h,i):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,n)+(t>=(s.left+s.right)/2?1:0)}}function us(e,t,i){let n=e.nodeValue.length,s=-1,a=1e9,r=0;for(let o=0;oi?c.top-i:i-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&l=(c.left+c.right)/2,n=i;if((Mi.chrome||Mi.gecko)&&ci(e,o).getBoundingClientRect().left==c.right&&(n=!i),l<=0)return{node:e,offset:o+(n?1:0)};s=o+(n?1:0),a=l}}}return{node:e,offset:s>-1?s:r>0?e.nodeValue.length:0}}function Is(e,t,i,n=-1){var s,a;let r,o=e.contentDOM.getBoundingClientRect(),A=o.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:l,y:g}=t,h=g-A;if(h<0)return 0;if(h>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,s=!1;r=e.elementAtHeight(h),r.type!=Wi.Text;)for(;h=n>0?r.bottom+t:r.top-t,!(h>=0&&h<=c);){if(s)return i?null:0;s=!0,n=-n}g=A+h;let d=r.from;if(de.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:i?null:fs(e,o,r,l,g);let u=e.dom.ownerDocument,I=e.root.elementFromPoint?e.root:u,f=I.elementFromPoint(l,g);f&&!e.contentDOM.contains(f)&&(f=null),f||(l=Math.max(o.left+1,Math.min(o.right-1,l)),f=I.elementFromPoint(l,g),f&&!e.contentDOM.contains(f)&&(f=null));let C,p=-1;if(f&&0!=(null===(s=e.docView.nearest(f))||void 0===s?void 0:s.isEditable)){if(u.caretPositionFromPoint){let e=u.caretPositionFromPoint(l,g);e&&({offsetNode:C,offset:p}=e)}else if(u.caretRangeFromPoint){let t=u.caretRangeFromPoint(l,g);t&&(({startContainer:C,startOffset:p}=t),(!e.contentDOM.contains(C)||Mi.safari&&function(e,t,i){let n;if(3!=e.nodeType||t!=(n=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return ci(e,n-1,n).getBoundingClientRect().left>i}(C,p,l)||Mi.chrome&&function(e,t,i){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}return i-(1==e.nodeType?e.getBoundingClientRect():ci(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}(C,p,l))&&(C=void 0))}C&&(p=Math.min(ti(C),p))}if(!C||!e.docView.dom.contains(C)){let t=en.find(e.docView,d);if(!t)return h>r.top+r.height/2?r.to:r.from;({node:C,offset:p}=ds(t.dom,l,g))}let m=e.docView.nearest(C);if(!m)return null;if(m.isWidget&&1==(null===(a=m.dom)||void 0===a?void 0:a.nodeType)){let e=m.dom.getBoundingClientRect();return t.y1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;a+=Math.floor((s-i.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let r=e.state.sliceDoc(i.from,i.to);return i.from+Nt(r,a,e.state.tabSize)}function Cs(e,t){let i=e.lineBlockAt(t);if(Array.isArray(i.type))for(let e of i.type)if(e.to>t||e.to==t&&(e.to==i.to||e.type==Wi.Text))return e;return i}function ps(e,t,i,n){let s=e.state.doc.lineAt(t.head),a=e.bidiSpans(s),r=e.textDirectionAt(s.from);for(let o=t,A=null;;){let t=yn(s,a,r,o,i),c=bn;if(!t){if(s.number==(i?e.state.doc.lines:1))return o;c="\n",s=e.state.doc.line(s.number+(i?1:-1)),a=e.bidiSpans(s),t=e.visualLineSide(s,!i)}if(A){if(!A(c))return o}else{if(!n)return t;A=n(c)}o=t}}function ms(e,t,i){for(;;){let n=0;for(let s of e)s.between(t-1,t+1,((e,s,a)=>{if(t>e&&tt(e))),i.from,t.head>i.from?-1:1);return n==i.from?i:De.cursor(n,ne)&&this.lineBreak(),n=s}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s,a=-1,r=1;if(this.lineSeparator?(a=t.indexOf(this.lineSeparator,i),r=this.lineSeparator.length):(s=n.exec(t))&&(a=s.index,r=s[0].length),this.append(t.slice(i,a<0?t.length:a)),a<0)break;if(this.lineBreak(),r>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=r-1);i=a+r}}readNode(e){if(e.cmIgnore)return;let t=Ci.get(e),i=t&&t.overrideDOMText;if(null!=i){this.findPointInside(e,i.length);for(let e=i.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(3==e.nodeType?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(bs(e,i.node,i.offset)?t:0))}}function bs(e,t,i){for(;;){if(!t||i-1;let{impreciseHead:s,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let t=s||a?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:a}=e.observer.selectionRange;return i&&(t.push(new ys(i,n)),s==i&&a==n||t.push(new ys(s,a))),t}(e),i=new Es(t,e.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(e,t){if(0==e.length)return null;let i=e[0].pos,n=2==e.length?e[1].pos:i;return i>-1&&n>-1?De.single(i+t,n+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,i=s&&s.node==t.focusNode&&s.offset==t.focusOffset||!jt(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),n=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!jt(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),r=e.viewport;if((Mi.ios||Mi.chrome)&&e.state.selection.main.empty&&i!=n&&(r.from>0||r.toDate.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:n,to:r}=t.bounds,o=s.from,A=null;(8===a||Mi.android&&t.text.length0&&o>0&&e.charCodeAt(r-1)==t.charCodeAt(o-1);)r--,o--;return"end"==n&&(i-=r+Math.max(0,a-Math.min(r,o))-a),r=r?a-i:0,o=a+(o-r),r=a):o=o?a-i:0,r=a+(r-o),o=a),{from:a,toA:r,toB:o}}(e.state.doc.sliceString(n,r,Qs),t.text,o-n,A);c&&(Mi.chrome&&13==a&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Qs+Qs&&c.toB--,i={from:n+c.from,to:n+c.toA,insert:se.of(t.text.slice(c.from,c.toB).split(Qs))})}else n&&(!e.hasFocus&&e.state.facet(Jn)||n.main.eq(s))&&(n=null);if(!i&&!n)return!1;if(!i&&t.typeOver&&!s.empty&&n&&n.main.empty?i={from:s.from,to:s.to,insert:e.state.doc.slice(s.from,s.to)}:(Mi.mac||Mi.android)&&i&&i.from==i.to&&i.from==s.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(n&&2==i.insert.length&&(n=De.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:se.of([i.insert.toString().replace("."," ")])}):i&&i.from>=s.from&&i.to<=s.to&&(i.from!=s.from||i.to!=s.to)&&s.to-s.from-(i.to-i.from)<=4?i={from:s.from,to:s.to,insert:e.state.doc.slice(s.from,i.from).append(i.insert).append(e.state.doc.slice(i.to,s.to))}:Mi.chrome&&i&&i.from==i.to&&i.from==s.head&&"\n "==i.insert.toString()&&e.lineWrapping&&(n&&(n=De.single(n.main.anchor-1,n.main.head-1)),i={from:s.from,to:s.to,insert:se.of([" "])}),i)return Ss(e,i,n,a);if(n&&!n.main.eq(s)){let t=!1,i="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:n,scrollIntoView:t,userEvent:i}),!0}return!1}function Ss(e,t,i,n=-1){if(Mi.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(Mi.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&" "==e.state.sliceDoc(t.from,s.from))&&1==t.insert.length&&2==t.insert.lines&&li(e.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&0==t.insert.length||8==n&&t.insert.lengths.head)&&li(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&0==t.insert.length&&li(e.contentDOM,"Delete",46)))return!0;let a,r=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o=()=>a||(a=function(e,t,i){let n,s=e.state,a=s.selection.main;if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!i||i.main.empty&&i.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let i=a.fromt.to?s.sliceDoc(t.to,a.to):"";n=s.replaceSelection(e.state.toText(i+t.insert.sliceString(0,void 0,e.state.lineBreak)+r))}else{let r=s.changes(t),o=i&&i.main.to<=r.newLength?i.main:void 0;if(s.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=a.to&&t.to>=a.to-10){let A,c=e.state.sliceDoc(t.from,t.to),l=i&&rs(e,i.main.head);if(l){let e=t.insert.length-(t.to-t.from);A={from:l.from,to:l.to-e}}else A=e.state.doc.lineAt(a.head);let g=a.to-t.to,h=a.to-a.from;n=s.changeByRange((i=>{if(i.from==a.from&&i.to==a.to)return{changes:r,range:o||i.map(r)};let n=i.to-g,l=n-c.length;if(i.to-i.from!=h||e.state.sliceDoc(l,n)!=c||i.to>=A.from&&i.from<=A.to)return{range:i};let d=s.changes({from:l,to:n,insert:t.insert}),u=i.to-a.to;return{changes:d,range:o?De.range(Math.max(0,o.anchor+u),Math.max(0,o.head+u)):i.map(d)}}))}else n={changes:r,selection:o&&s.selection.replaceRange(o)}}let r="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,r+=".compose",e.inputState.compositionFirstChange&&(r+=".start",e.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:r,scrollIntoView:!0})}(e,t,i));return e.state.facet(Fn).some((i=>i(e,t.from,t.to,r,o)))||e.dispatch(o()),!0}class vs{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Mi.safari&&e.contentDOM.addEventListener("input",(()=>null)),Mi.gecko&&function(e){ea.has(e)||(ea.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let i,n=t.target;n!=e.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=Ci.get(n))&&i.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let e of i.observers)e(this.view,t);for(let e of i.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function i(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let n in e.domEventHandlers){let s=e.domEventHandlers[n];s&&i(n).handlers.push(Ds(t.value,s))}if(e&&e.domEventObservers)for(let n in e.domEventObservers){let s=e.domEventObservers[n];s&&i(n).observers.push(Ds(t.value,s))}}for(let e in Gs)i(e).handlers.push(Gs[e]);for(let e in Us)i(e).observers.push(Us[e]);return t}(e),i=this.handlers,n=this.view.contentDOM;for(let e in t)if("scroll"!=e){let s=!t[e].handlers.length,a=i[e];a&&s!=!a.handlers.length&&(n.removeEventListener(e,this.handleEvent),a=null),a||n.addEventListener(e,this.handleEvent,{passive:s})}for(let e in i)"scroll"==e||t[e]||n.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Rs.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Mi.android&&Mi.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!Mi.ios||e.synthetic||e.altKey||e.metaKey||!((t=xs.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||Fs.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from0||!!(Mi.safari&&!Mi.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Ds(e,t){return(i,n)=>{try{return t.call(e,n,i)}catch(e){qn(i.state,e)}}}const xs=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Fs="dthko",Rs=[16,17,18,20,91,92,224,225];function Ms(e){return.7*Math.max(0,e)+8}class Ns{constructor(e,t,i,n){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,i,n=e.ownerDocument;for(let s=e.parentNode;s&&!(s==n.body||t&&i);)if(1==s.nodeType)!i&&s.scrollHeight>s.clientHeight&&(i=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else{if(11!=s.nodeType)break;s=s.host}return{x:t,y:i}}(e.contentDOM),this.atoms=e.state.facet(Zn).map((t=>t(e)));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(It.allowMultipleSelections)&&function(e,t){let i=e.state.facet(kn);return i.length?i[0](t):Mi.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:i}=e.state.selection;if(i.empty)return!1;let n=Wt(e.root);if(!n||0==n.rangeCount)return!0;let s=n.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&i.top<=t.clientY&&i.bottom>=t.clientY)return!0}return!1}(e,t)||1!=js(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,i=e,Math.max(Math.abs(t.clientX-i.clientX),Math.abs(t.clientY-i.clientY))<10))return;var t,i;this.select(this.lastEvent=e);let n=0,s=0,a=0,r=0,o=this.view.win.innerWidth,A=this.view.win.innerHeight;this.scrollParents.x&&({left:a,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:A}=this.scrollParents.y.getBoundingClientRect());let c=ts(this.view);e.clientX-c.left<=a+6?n=-Ms(a-e.clientX):e.clientX+c.right>=o-6&&(n=Ms(e.clientX-o)),e.clientY-c.top<=r+6?s=-Ms(r-e.clientY):e.clientY+c.bottom>=A-6&&(s=Ms(e.clientY-A)),this.setScrollSpeed(n,s)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;ie.isUserEvent("input.type")))?this.destroy():this.style.update(e)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const Gs=Object.create(null),Us=Object.create(null),Ls=Mi.ie&&Mi.ie_version<15||Mi.ios&&Mi.webkit_version<604;function Ts(e,t,i){for(let n of e.facet(t))i=n(i,e);return i}function Hs(e,t){t=Ts(e.state,Mn,t);let i,{state:n}=e,s=1,a=n.toText(t),r=a.lines==n.selection.ranges.length;if(null!=Xs&&n.selection.ranges.every((e=>e.empty))&&Xs==a.toString()){let e=-1;i=n.changeByRange((i=>{let o=n.doc.lineAt(i.from);if(o.from==e)return{range:i};e=o.from;let A=n.toText((r?a.line(s++).text:t)+n.lineBreak);return{changes:{from:o.from,insert:A},range:De.cursor(i.from+A.length)}}))}else i=r?n.changeByRange((e=>{let t=a.line(s++);return{changes:{from:e.from,to:e.to,insert:t.text},range:De.cursor(e.from+t.length)}})):n.replaceSelection(a);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Os(e,t,i,n){if(1==n)return De.cursor(t,i);if(2==n)return function(e,t,i=1){let n=e.charCategorizer(t),s=e.doc.lineAt(t),a=t-s.from;if(0==s.length)return De.cursor(t);0==a?i=1:a==s.length&&(i=-1);let r=a,o=a;i<0?r=ue(s.text,a,!1):o=ue(s.text,a);let A=n(s.text.slice(r,o));for(;r>0;){let e=ue(s.text,r,!1);if(n(s.text.slice(e,r))!=A)break;r=e}for(;o{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Gs.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),Us.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},Us.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Gs.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of e.state.facet(vn))if(i=n(e,t),i)break;if(i||0!=t.button||(i=function(e,t){let i=Ps(e,t),n=js(t),s=e.state.selection;return{update(e){e.docChanged&&(i.pos=e.changes.mapPos(i.pos),s=s.map(e.changes))},get(t,a,r){let o,A=Ps(e,t),c=Os(e,A.pos,A.bias,n);if(i.pos!=A.pos&&!a){let t=Os(e,i.pos,i.bias,n),s=Math.min(t.from,c.from),a=Math.max(t.to,c.to);c=s1&&(o=function(e,t){for(let i=0;i=t)return De.create(e.ranges.slice(0,i).concat(e.ranges.slice(i+1)),e.mainIndex==i?0:e.mainIndex-(e.mainIndex>i?1:0))}return null}(s,A.pos))?o:r?s.addRange(c):De.create([c])}}}(e,t)),i){let n=!e.hasFocus;e.inputState.startMouseSelection(new Ns(e,t,i,n)),n&&e.observer.ignore((()=>{Ai(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()}));let s=e.inputState.mouseSelection;if(s)return s.start(t),!1===s.dragging}return!1};let qs=(e,t,i)=>t>=i.top&&t<=i.bottom&&e>=i.left&&e<=i.right;function Js(e,t,i,n){let s=en.find(e.docView,t);if(!s)return 1;let a=t-s.posAtStart;if(0==a)return 1;if(a==s.length)return-1;let r=s.coordsAt(a,-1);if(r&&qs(i,n,r))return-1;let o=s.coordsAt(a,1);return o&&qs(i,n,o)?1:r&&r.bottom>=n?-1:1}function Ps(e,t){let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:i,bias:Js(e,i,t.clientX,t.clientY)}}const Ys=Mi.ie&&Mi.ie_version<=11;let Ks=null,Vs=0,Ws=0;function js(e){if(!Ys)return e.detail;let t=Ks,i=Ws;return Ks=e,Ws=Date.now(),Vs=!t||i>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Vs+1)%3:1}function _s(e,t,i,n){if(!(i=Ts(e.state,Mn,i)))return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,r=n&&a&&function(e,t){let i=e.state.facet(Sn);return i.length?i[0](t):Mi.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:a.from,to:a.to}:null,o={from:s,insert:i},A=e.state.changes(r?[r,o]:o);e.focus(),e.dispatch({changes:A,selection:{anchor:A.mapPos(s,-1),head:A.mapPos(s,1)},userEvent:r?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Gs.dragstart=(e,t)=>{let{selection:{main:i}}=e.state;if(t.target.draggable){let n=e.docView.nearest(t.target);if(n&&n.isWidget){let e=n.posAtStart,t=e+n.length;(e>=i.to||t<=i.from)&&(i=De.range(e,t))}}let{inputState:n}=e;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,t.dataTransfer&&(t.dataTransfer.setData("Text",Ts(e.state,Nn,e.state.sliceDoc(i.from,i.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Gs.dragend=e=>(e.inputState.draggedContent=null,!1),Gs.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let i=t.dataTransfer.files;if(i&&i.length){let n=Array(i.length),s=0,a=()=>{++s==i.length&&_s(e,t,n.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(n[e]=t.result),a()},t.readAsText(i[e])}return!0}{let i=t.dataTransfer.getData("Text");if(i)return _s(e,t,i,!0),!0}return!1},Gs.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let i=Ls?null:t.clipboardData;return i?(Hs(e,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{e.focus(),i.remove(),Hs(e,i.value)}),50)}(e),!1)};let Xs=null;Gs.copy=Gs.cut=(e,t)=>{let{text:i,ranges:n,linewise:s}=function(e){let t=[],i=[],n=!1;for(let n of e.selection.ranges)n.empty||(t.push(e.sliceDoc(n.from,n.to)),i.push(n));if(!t.length){let s=-1;for(let{from:n}of e.selection.ranges){let a=e.doc.lineAt(n);a.number>s&&(t.push(a.text),i.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),s=a.number}n=!0}return{text:Ts(e,Nn,t.join(e.lineBreak)),ranges:i,linewise:n}}(e.state);if(!i&&!s)return!1;Xs=s?i:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let a=Ls?null:t.clipboardData;return a?(a.clearData(),a.setData("text/plain",i),!0):(function(e,t){let i=e.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=t,n.focus(),n.selectionEnd=t.length,n.selectionStart=0,setTimeout((()=>{n.remove(),e.focus()}),50)}(e,i),!1)};const Zs=tt.define();function zs(e,t){let i=[];for(let n of e.facet(Rn)){let s=n(e,t);s&&i.push(s)}return i?e.update({effects:i,annotations:Zs.of(!0)}):null}function $s(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let i=zs(e.state,t);i?e.dispatch(i):e.update([])}}),10)}Us.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),$s(e)},Us.blur=e=>{e.observer.clearSelectionRange(),$s(e)},Us.compositionstart=Us.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},Us.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Mi.chrome&&Mi.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50))},Us.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Gs.beforeinput=(e,t)=>{var i,n;if("insertReplacementText"==t.inputType&&e.observer.editContext){let n=null===(i=t.dataTransfer)||void 0===i?void 0:i.getData("text/plain"),s=t.getTargetRanges();if(n&&s.length){let t=s[0],i=e.posAtDOM(t.startContainer,t.startOffset),a=e.posAtDOM(t.endContainer,t.endOffset);return Ss(e,{from:i,to:a,insert:e.state.toText(n)},null),!0}}let s;if(Mi.chrome&&Mi.android&&(s=xs.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){let t=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return Mi.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),Mi.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout((()=>Us.compositionend(e,t)),20),!1};const ea=new Set,ta=["pre-wrap","normal","pre-line","break-spaces"];let ia=!1;function na(){ia=!1}class sa{constructor(e){this.lineWrapping=e,this.doc=se.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ta.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,o=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=i,this.textHeight=n,this.lineLength=s,o){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Aa&&(ia=!0),this.height=e)}replace(e,t,i){return ca.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,n){let s=this,a=i.doc;for(let r=n.length-1;r>=0;r--){let{fromA:o,toA:A,fromB:c,toB:l}=n[r],g=s.lineAt(o,oa.ByPosNoHeight,i.setDoc(t),0,0),h=g.to>=A?g:s.lineAt(A,oa.ByPosNoHeight,i,0,0);for(l+=h.to-A,A=h.to;r>0&&g.from<=n[r-1].toA;)o=n[r-1].fromA,c=n[r-1].fromB,r--,o2*s){let s=e[t-1];s.break?e.splice(--t,1,s.left,null,s.right):e.splice(--t,1,s.left,s.right),i+=1+s.break,n-=s.size}else{if(!(s>2*n))break;{let t=e[i];t.break?e.splice(i,1,t.left,null,t.right):e.splice(i,1,t.left,t.right),i+=2+t.break,s-=t.size}}else if(n=s&&a(this.blockAt(0,i,n,s))}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ha extends ga{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,n){return new ra(n,this.length,i,this.height,this.breaks)}replace(e,t,i){let n=i[0];return 1==i.length&&(n instanceof ha||n instanceof da&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof da?n=new ha(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):ca.of(i)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more?this.setHeight(n.heights[n.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class da extends ca{constructor(e){super(e,0)}heightMetrics(e,t){let i,n=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,a=s-n+1,r=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*a);i=t/a,this.length>a+1&&(r=(this.height-t)/(this.length-a-1))}else i=this.height/a;return{firstLine:n,lastLine:s,perLine:i,perChar:r}}blockAt(e,t,i,n){let{firstLine:s,lastLine:a,perLine:r,perChar:o}=this.heightMetrics(t,n);if(t.lineWrapping){let s=n+(e0){let e=i[i.length-1];e instanceof da?i[i.length-1]=new da(e.length+n):i.push(null,new da(n-1))}if(e>0){let t=i[0];t instanceof da?i[0]=new da(e+t.length):i.unshift(new da(e-1),null)}return ca.of(i)}decomposeLeft(e,t){t.push(new da(e-1),null)}decomposeRight(e,t){t.push(null,new da(this.length-e-1))}updateHeight(e,t=0,i=!1,n){let s=t+this.length;if(n&&n.from<=t+this.length&&n.more){let i=[],a=Math.max(t,n.from),r=-1;for(n.from>t&&i.push(new da(n.from-t-1).updateHeight(e,t));a<=s&&n.more;){let t=e.doc.lineAt(a).length;i.length&&i.push(null);let s=n.heights[n.index++];-1==r?r=s:Math.abs(s-r)>=Aa&&(r=-2);let o=new ha(t,s);o.outdated=!1,i.push(o),a+=t+1}a<=s&&i.push(null,new da(s-a).updateHeight(e,a));let o=ca.of(i);return(r<0||Math.abs(o.height-this.height)>=Aa||Math.abs(r-this.heightMetrics(e,t).perLine)>=Aa)&&(ia=!0),la(this,o)}return(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ua extends ca{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return 1&this.flags}blockAt(e,t,i,n){let s=i+this.left.height;return er))return A;let c=t==oa.ByPosNoHeight?oa.ByPosNoHeight:oa.ByPos;return o?A.join(this.right.lineAt(r,c,i,a,r)):this.left.lineAt(r,c,i,n,s).join(A)}forEachLine(e,t,i,n,s,a){let r=n+this.left.height,o=s+this.left.length+this.break;if(this.break)e=o&&this.right.forEachLine(e,t,i,r,o,a);else{let A=this.lineAt(o,oa.ByPos,i,n,s);e=e&&A.from<=t&&a(A),t>A.to&&this.right.forEachLine(A.to+1,t,i,r,o,a)}}replace(e,t,i){let n=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,i));let s=[];e>0&&this.decomposeLeft(e,s);let a=s.length;for(let e of i)s.push(e);if(e>0&&Ia(s,a-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,n=i+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e2*t.size||t.size>2*e.size?ca.of(this.break?[e,null,t]:[e,t]):(this.left=la(this.left,e),this.right=la(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,n){let{left:s,right:a}=this,r=t+s.length+this.break,o=null;return n&&n.from<=t+s.length&&n.more?o=s=s.updateHeight(e,t,i,n):s.updateHeight(e,t,i),n&&n.from<=r+a.length&&n.more?o=a=a.updateHeight(e,r,i,n):a.updateHeight(e,r,i),o?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ia(e,t){let i,n;null==e[t]&&(i=e[t-1])instanceof da&&(n=e[t+1])instanceof da&&e.splice(t-1,3,new da(i.length+1+n.length))}class fa{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof ha?i.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new ha(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=5)&&this.addLineDeco(n,s,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new ha(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new da(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ha)return e;let t=new ha(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof ha||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();a=Math.max(a,n.left),r=Math.min(r,n.right),o=Math.max(o,n.top),A=Math.min(t==e.parentNode?s.innerHeight:A,n.bottom)}t="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:a-i.left,right:Math.max(a,r)-i.left,top:o-(i.top+t),bottom:Math.max(o,A)-(i.top+t)}}function ma(e,t){let i=e.getBoundingClientRect();return{left:0,right:i.right-i.left,top:t,bottom:i.bottom-(i.top+t)}}class Ba{constructor(e,t,i,n){this.from=e,this.to=t,this.size=i,this.displaySize=n}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new sa(t),this.stateDeco=e.facet(_n).filter((e=>"function"!=typeof e)),this.heightMap=ca.empty().applyChanges(this.stateDeco,se.empty,this.heightOracle.setDoc(e.doc),[new ns(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ji.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let n=i?t.head:t.anchor;if(!e.some((({from:e,to:t})=>n>=e&&n<=t))){let{from:t,to:i}=this.lineBlockAt(n);e.push(new ba(t,i))}}return this.viewports=e.sort(((e,t)=>e.from-t.from)),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ka:new Sa(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(va(e,this.scaler))}))}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(_n).filter((e=>"function"!=typeof e));let n=e.changedRanges,s=ns.extendWithRanges(n,function(e,t,i){let n=new Ca;return Qt.compare(e,t,i,n,0),n.changes}(i,this.stateDeco,e?e.changes:Qe.empty(this.state.doc.length))),a=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);na(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||ia)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let o=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,t));let A=o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,e.flags|=this.updateForViewport(),(A||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Un)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),n=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?on.RTL:on.LTR;let a=this.heightOracle.mustRefreshForWrapping(s),r=t.getBoundingClientRect(),o=a||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let A=0,c=0;if(r.width&&r.height){let{scaleX:e,scaleY:i}=si(t,r);(e>.005&&Math.abs(this.scaleX-e)>.005||i>.005&&Math.abs(this.scaleY-i)>.005)&&(this.scaleX=e,this.scaleY=i,A|=16,a=o=!0)}let l=(parseInt(i.paddingTop)||0)*this.scaleY,g=(parseInt(i.paddingBottom)||0)*this.scaleY;this.paddingTop==l&&this.paddingBottom==g||(this.paddingTop=l,this.paddingBottom=g,A|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(o=!0),this.editorWidth=e.scrollDOM.clientWidth,A|=16);let h=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=h&&(this.scrollAnchorHeight=-1,this.scrollTop=h),this.scrolledToBottom=hi(e.scrollDOM);let d=(this.printing?ma:pa)(t,this.paddingTop),u=d.top-this.pixelViewport.top,I=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let f=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(f!=this.inView&&(this.inView=f,f&&(o=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),i=e.ownerDocument.defaultView||window;return t.left0&&t.top0}(e.dom))return 0;let C=r.width;if(this.contentDOMWidth==C&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,A|=16),o){let t=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(t)&&(a=!0),a||n.lineWrapping&&Math.abs(C-this.contentDOMWidth)>n.charWidth){let{lineHeight:i,charWidth:r,textHeight:o}=e.docView.measureTextSize();a=i>0&&n.refresh(s,i,r,o,C/r,t),a&&(e.docView.minWidth=0,A|=16)}u>0&&I>0?c=Math.max(u,I):u<0&&I<0&&(c=Math.min(u,I)),na();for(let i of this.viewports){let s=i.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(i);this.heightMap=(a?ca.empty().applyChanges(this.stateDeco,se.empty,this.heightOracle,[new ns(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,a,new aa(i.from,s))}ia&&(A|=2)}let p=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return p&&(2&A&&(A|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),A|=this.updateForViewport()),(2&A||p)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),A|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),A}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:r}=this,o=new ba(n.lineAt(a-1e3*i,oa.ByHeight,s,0,0).from,n.lineAt(r+1e3*(1-i),oa.ByHeight,s,0,0).to);if(t){let{head:e}=t.range;if(eo.to){let i,a=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),r=n.lineAt(e,oa.ByPos,s,0,0);i="center"==t.y?(r.top+r.bottom)/2-a/2:"start"==t.y||"nearest"==t.y&&e=r+Math.max(10,Math.min(i,250)))&&n>a-2e3&&s>1,a=n<<1;if(this.defaultTextDirection!=on.LTR&&!i)return[];let r=[],o=(n,a,A,c)=>{if(a-nn&&ee.from>=A.from&&e.to<=A.to&&Math.abs(e.from-n)e.fromt))));if(!h){if(ae.from<=a&&e.to>=a))){let e=t.moveToLineBoundary(De.cursor(a),!1,!0).head;e>n&&(a=e)}let e=this.gapSize(A,n,a,c);h=new Ba(n,a,e,i||e<2e6?e:2e6)}r.push(h)},A=t=>{if(t.lengths&&(n.push({from:s,to:e}),a+=e-s),s=t}},20),s2e6)for(let i of e)i.from>=t.from&&i.fromt.from&&o(t.from,r,t,s),Ae.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];Qt.spans(t,this.viewport.from,this.viewport.to,{span(e,t){i.push({from:e,to:t})},point(){}},20);let n=0;if(i.length!=this.visibleRanges.length)n=12;else for(let t=0;t=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||va(this.heightMap.lineAt(e,oa.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((t=>t.top<=e&&t.bottom>=e))||va(this.heightMap.lineAt(this.scaler.fromDOM(e),oa.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return va(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class ba{constructor(e,t){this.from=e,this.to=t}}function ya({total:e,ranges:t},i){if(i<=0)return t[0].from;if(i>=1)return t[t.length-1].to;let n=Math.floor(e*i);for(let e=0;;e++){let{from:i,to:s}=t[e],a=s-i;if(n<=a)return i+n;n-=a}}function wa(e,t){let i=0;for(let{from:n,to:s}of e.ranges){if(t<=s){i+=t-n;break}i+=s-n}return i/e.total}const ka={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class Sa{constructor(e,t,i){let n=0,s=0,a=0;this.viewports=i.map((({from:i,to:s})=>{let a=t.lineAt(i,oa.ByPos,e,0,0).top,r=t.lineAt(s,oa.ByPos,e,0,0).bottom;return n+=r-a,{from:i,to:s,top:a,bottom:r,domTop:0,domBottom:0}})),this.scale=(7e6-n)/(t.height-n);for(let e of this.viewports)e.domTop=a+(e.top-s)*this.scale,a=e.domBottom=e.domTop+(e.bottom-e.top),s=e.bottom}toDOM(e){for(let t=0,i=0,n=0;;t++){let s=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to))}}function va(e,t){if(1==t.scale)return e;let i=t.toDOM(e.top),n=t.toDOM(e.bottom);return new ra(e.from,e.length,i,n-i,Array.isArray(e._content)?e._content.map((e=>va(e,t))):e._content)}const Da=Re.define({combine:e=>e.join(" ")}),xa=Re.define({combine:e=>e.indexOf(!0)>-1}),Fa=Tt.newName(),Ra=Tt.newName(),Ma=Tt.newName(),Na={"&light":"."+Ra,"&dark":"."+Ma};function Ga(e,t,i){return new Tt(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!i||!i[t])throw new RangeError(`Unsupported selector: ${t}`);return i[t]})):e+" "+t})}const Ua=Ga("."+Fa,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Na),La={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ta=Mi.ie&&Mi.ie_version<=11;class Ha{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ri,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(Mi.ie&&Mi.ie_version<=11||Mi.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!1===e.constructor.EDIT_CONTEXT||Mi.chrome&&Mi.chrome_version<126||(this.editContext=new Ja(e),e.state.facet(Jn)&&(e.contentDOM.editContext=this.editContext.editContext)),Ta&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,i)=>t!=e[i])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(Jn)?i.root.activeElement!=this.dom:!_t(this.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(e)?t||(this.selectionChanged=!1):(Mi.ie&&Mi.ie_version<=11||Mi.android&&Mi.chrome)&&!i.state.selection.main.empty&&n.focusNode&&Zt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Wt(e.root);if(!t)return!1;let i=Mi.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return qa(e,i)}let i=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),i=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),i?qa(e,i):null}(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let n=_t(this.dom,i);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&li(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,n=!1;for(let s of e){let e=this.readMutation(s);e&&(e.typeOver&&(n=!0),-1==t?({from:t,to:i}=e):(t=Math.min(e.from,t),i=Math.max(e.to,i)))}return{from:t,to:i,typeOver:n}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),n=this.selectionChanged&&_t(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ws(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,n=ks(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let i=Oa(t,e.previousSibling||e.target.previousSibling,-1),n=Oa(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Jn)!=e.state.facet(Jn)&&(e.view.contentDOM.editContext=e.state.facet(Jn)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Oa(e,t,i){for(;t;){let n=Ci.get(t);if(n&&n.parent==e)return n;let s=t.parentNode;t=s!=e.dom?s:i>0?t.nextSibling:t.previousSibling}return null}function qa(e,t){let i=t.startContainer,n=t.startOffset,s=t.endContainer,a=t.endOffset,r=e.docView.domAtPos(e.state.selection.main.anchor);return Zt(r.node,r.offset,s,a)&&([i,n,s,a]=[s,a,i,n]),{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:a}}class Ja{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=t=>{let i=e.state.selection.main,{anchor:n,head:s}=i,a=this.toEditorPos(t.updateRangeStart),r=this.toEditorPos(t.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:t.updateRangeStart,editorBase:a,drifted:!1});let o={from:a,to:r,insert:se.of(t.text.split("\n"))};if(o.from==this.from&&nthis.to&&(o.to=n),o.from!=o.to||o.insert.length){if((Mi.mac||Mi.android)&&o.from==s-1&&/^\. ?$/.test(t.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(o={from:a,to:r,insert:se.of([t.text.replace("."," ")])}),this.pendingContextChange=o,!e.state.readOnly){let i=this.to-this.from+(o.to-o.from+o.insert.length);Ss(e,o,De.single(this.toEditorPos(t.selectionStart,i),this.toEditorPos(t.selectionEnd,i)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))}else{let n=De.single(this.toEditorPos(t.selectionStart),this.toEditorPos(t.selectionEnd));n.main.eq(i)||e.dispatch({selection:n,userEvent:"select"})}},this.handlers.characterboundsupdate=i=>{let n=[],s=null;for(let t=this.toEditorPos(i.rangeStart),a=this.toEditorPos(i.rangeEnd);t{let i=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,n=e.underlineThickness;if("None"!=t&&"None"!=n){let s=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(s{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=Wt(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,n=this.pendingContextChange;return e.changes.iterChanges(((s,a,r,o,A)=>{if(i)return;let c=A.length-(a-s);if(n&&a>=n.to){if(n.from==s&&n.to==a&&n.insert.eq(A))return n=this.pendingContextChange=null,t+=c,void(this.to+=c);n=null,this.revertPending(e.state)}if(s+=t,(a+=t)<=this.from)this.from+=c,this.to+=c;else if(sthis.to||this.to-this.from+A.length>3e4)return void(i=!0);this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),A.toString()),this.to+=c}t+=c})),n&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;this.composing&&(this.composing.drifted||e.transactions.some((e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to))))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);this.editContext.selectionStart==i&&this.editContext.selectionEnd==n||this.editContext.updateSelection(i,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Pa{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(e=>e.forEach((e=>i(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Ea(e.state||It.create(e)),e.scrollTo&&e.scrollTo.is(Hn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Yn).map((e=>new Vn(e)));for(let e of this.plugins)e.update(this);this.observer=new Ha(this),this.inputState=new vs(this),this.inputState.ensureHandlers(this.plugins),this.docView=new as(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then((()=>this.requestMeasure()))}dispatch(...e){let t=1==e.length&&e[0]instanceof at?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,i=!1,n=!1,s=this.state;for(let t of e){if(t.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=t.state}if(this.destroyed)return void(this.viewState.state=s);let a=this.hasFocus,r=0,o=null;e.some((e=>e.annotation(Zs)))?(this.inputState.notifiedFocused=a,r=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,o=zs(s,a),o||(r=1));let A=this.observer.delayedAndroidKey,c=null;if(A?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(It.phrases)!=this.state.facet(It.phrases))return this.setState(s);t=ss.create(this,s,e),t.flags|=r;let l=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(l&&(l=l.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;l=new Tn(e.empty?e:De.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Hn)&&(l=e.value.clip(this.state))}this.viewState.update(t,l),this.bidiCache=Va.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),i=this.docView.update(t),this.state.facet(is)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(Da)!=t.state.facet(Da)&&(this.viewState.mustMeasureContent=!0),(i||n||l||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!t.empty)for(let i of this.state.facet(xn))try{i(t)}catch(e){qn(this.state,e,"update listener")}(o||c)&&Promise.resolve().then((()=>{o&&this.state==o.startState&&this.dispatch(o),c&&!ks(this,c)&&A.force&&li(this.contentDOM,A.key,A.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Ea(e),this.plugins=e.facet(Yn).map((e=>new Vn(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new as(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Yn),i=e.state.facet(Yn);if(t!=i){let n=[];for(let s of i){let i=t.indexOf(s);if(i<0)n.push(new Vn(s));else{let t=this.plugins[i];t.mustUpdate=e,n.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(a<0)if(hi(i))s=-1,a=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(n);s=e.from,a=e.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let A=[];4&o||([this.measureRequests,A]=[A,this.measureRequests]);let c=A.map((e=>{try{return e.read(this)}catch(e){return qn(this.state,e),Ka}})),l=ss.create(this,this.state,[]),g=!1;l.flags|=o,t?t.flags|=o:t=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),g=this.docView.update(l),g&&this.docViewUpdate());for(let t=0;t1||e<-1){n+=e,i.scrollTop=n/this.scaleY,a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(xn))e(t)}get themeClasses(){return Fa+" "+(this.state.facet(xa)?Ma:Ra)+" "+this.state.facet(Da)}updateAttrs(){let e=Wa(this,Wn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Jn)?"true":"false",class:"cm-content",style:`${Mi.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Wa(this,jn,t);let i=this.observer.ignore((()=>{let i=Yi(this.contentDOM,this.contentAttrs,t),n=Yi(this.dom,this.editorAttrs,e);return i||n}));return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let e of i.effects)e.is(Pa.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(is);let e=this.state.facet(Pa.cspNonce);Tt.mount(this.root,this.styleModules.concat(Ua).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;tt.spec==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Bs(this,e,ps(this,e,t,i))}moveByGroup(e,t){return Bs(this,e,ps(this,e,t,(t=>function(e,t,i){let n=e.state.charCategorizer(t),s=n(i);return e=>{let t=n(e);return s==ht.Space&&(s=t),s==t}}(this,e.head,t))))}visualLineSide(e,t){let i=this.bidiSpans(e),n=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return De.cursor(s.side(t,n)+e.from,s.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,i=!0){return function(e,t,i,n){let s=Cs(e,t.head),a=n&&s.type==Wi.Text&&(e.lineWrapping||s.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head):null;if(a){let t=e.dom.getBoundingClientRect(),n=e.textDirectionAt(s.from),r=e.posAtCoords({x:i==(n==on.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(null!=r)return De.cursor(r,i?-1:1)}return De.cursor(i?s.to:s.from,i?-1:1)}(this,e,t,i)}moveVertically(e,t,i){return Bs(this,e,function(e,t,i,n){let s=t.head,a=i?1:-1;if(s==(i?e.state.doc.length:0))return De.cursor(s,t.assoc);let r,o=t.goalColumn,A=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(s,t.assoc||-1),l=e.documentTop;if(c)null==o&&(o=c.left-A.left),r=a<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(s);null==o&&(o=Math.min(A.right-A.left,e.defaultCharacterWidth*(s-t.from))),r=(a<0?t.top:t.bottom)+l}let g=A.left+o,h=null!=n?n:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let i=r+(h+t)*a,n=Is(e,{x:g,y:i},!1,a);if(iA.bottom||(a<0?ns)){let t=e.docView.coordsForChar(n),s=!t||i0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Gn)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Ya)return En(e.length);let t,i=this.textDirectionAt(e.from);for(let n of this.bidiCache)if(n.from==e.from&&n.dir==i&&(n.fresh||pn(n.isolates,t=$n(this,e))))return n.order;t||(t=$n(this,e));let n=function(e,t,i){if(!e)return[new Cn(0,0,t==cn?1:0)];if(t==An&&!i.length&&!fn.test(e))return En(e.length);if(i.length)for(;e.length>mn.length;)mn[mn.length]=256;let n=[],s=t==An?0:1;return Qn(e,s,s,i,0,e.length,n),n}(e.text,i,t);return this.bidiCache.push(new Va(e.from,e.to,i,t,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Mi.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{Ai(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Hn.of(new Tn("number"==typeof e?De.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Hn.of(new Tn(De.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Kn.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return Kn.define((()=>({})),{eventObservers:e})}static theme(e,t){let i=Tt.newName(),n=[Da.of(i),is.of(Ga(`.${i}`,e))];return t&&t.dark&&n.push(xa.of(!0)),n}static baseTheme(e){return qe.lowest(is.of(Ga("."+Fa,e,Na)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),n=i&&Ci.get(i)||Ci.get(e);return(null===(t=null==n?void 0:n.rootView)||void 0===t?void 0:t.view)||null}}Pa.styleModule=is,Pa.inputHandler=Fn,Pa.clipboardInputFilter=Mn,Pa.clipboardOutputFilter=Nn,Pa.scrollHandler=Ln,Pa.focusChangeEffect=Rn,Pa.perLineTextDirection=Gn,Pa.exceptionSink=Dn,Pa.updateListener=xn,Pa.editable=Jn,Pa.mouseSelectionStyle=vn,Pa.dragMovesSelection=Sn,Pa.clickAddsSelectionRange=kn,Pa.decorations=_n,Pa.outerDecorations=Xn,Pa.atomicRanges=Zn,Pa.bidiIsolatedRanges=zn,Pa.scrollMargins=es,Pa.darkTheme=xa,Pa.cspNonce=Re.define({combine:e=>e.length?e[0]:""}),Pa.contentAttributes=jn,Pa.editorAttributes=Wn,Pa.lineWrapping=Pa.contentAttributes.of({class:"cm-lineWrapping"}),Pa.announce=st.define();const Ya=4096,Ka={};class Va{constructor(e,t,i,n,s,a){this.from=e,this.to=t,this.dir=i,this.isolates=n,this.fresh=s,this.order=a}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let i=[],n=e.length?e[e.length-1].dir:on.LTR;for(let s=Math.max(0,e.length-10);s=0;s--){let t=n[s],a="function"==typeof t?t(e):t;a&&qi(a,i)}return i}const ja=Mi.mac?"mac":Mi.windows?"win":Mi.linux?"linux":"key";function _a(e,t,i){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==i&&t.shiftKey&&(e="Shift-"+e),e}const Xa=qe.default(Pa.domEventHandlers({keydown:(e,t)=>nr($a(t.state),e,t,"editor")})),Za=Re.define({enables:Xa}),za=new WeakMap;function $a(e){let t=e.facet(Za),i=za.get(t);return i||za.set(t,i=function(e,t=ja){let i=Object.create(null),n=Object.create(null),s=(e,t)=>{let i=n[e];if(null==i)n[e]=t;else if(i!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},a=(e,n,a,r,o)=>{var A,c;let l=i[e]||(i[e]=Object.create(null)),g=n.split(/ (?!$)/).map((e=>function(e,t){const i=e.split(/-(?!$)/);let n,s,a,r,o=i[i.length-1];"Space"==o&&(o=" ");for(let e=0;e{let n=er={view:t,prefix:i,scope:e};return setTimeout((()=>{er==n&&(er=null)}),tr),!0}]})}let h=g.join(" ");s(h,!1);let d=l[h]||(l[h]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(A=l._any)||void 0===A?void 0:A.run)||void 0===c?void 0:c.slice())||[]});a&&d.run.push(a),r&&(d.preventDefault=!0),o&&(d.stopPropagation=!0)};for(let n of e){let e=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let t of e){let e=i[t]||(i[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:s}=n;for(let t in e)e[t].run.push((e=>s(e,ir)))}let s=n[t]||n.key;if(s)for(let t of e)a(t,s,n.run,n.preventDefault,n.stopPropagation),n.shift&&a(t,"Shift-"+s,n.shift,n.preventDefault,n.stopPropagation)}return i}(t.reduce(((e,t)=>e.concat(t)),[]))),i}let er=null;const tr=4e3;let ir=null;function nr(e,t,i,n){ir=t;let s=function(e){var t=!(Pt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Yt&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Jt:qt)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),a=Ce(Ie(s,0))==s.length&&" "!=s,r="",o=!1,A=!1,c=!1;er&&er.view==i&&er.scope==n&&(r=er.prefix+" ",Rs.indexOf(t.keyCode)<0&&(A=!0,er=null));let l,g,h=new Set,d=e=>{if(e){for(let t of e.run)if(!h.has(t)&&(h.add(t),t(i)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),A=!0)}return!1},u=e[n];return u&&(d(u[r+_a(s,t,!a)])?o=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Mi.windows&&t.ctrlKey&&t.altKey)&&(l=qt[t.keyCode])&&l!=s?(d(u[r+_a(l,t,!0)])||t.shiftKey&&(g=Jt[t.keyCode])!=s&&g!=l&&d(u[r+_a(g,t,!1)]))&&(o=!0):a&&t.shiftKey&&d(u[r+_a(s,t,!0)])&&(o=!0),!o&&d(u._any)&&(o=!0)),A&&(o=!0),o&&c&&t.stopPropagation(),ir=null,o}class sr{constructor(e,t,i,n,s){this.className=e,this.left=t,this.top=i,this.width=n,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let n=e.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=ar(e);return[new sr(t,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(e,t,i){if(i.to<=e.viewport.from||i.from>=e.viewport.to)return[];let n=Math.max(i.from,e.viewport.from),s=Math.min(i.to,e.viewport.to),a=e.textDirection==on.LTR,r=e.contentDOM,o=r.getBoundingClientRect(),A=ar(e),c=r.querySelector(".cm-line"),l=c&&window.getComputedStyle(c),g=o.left+(l?parseInt(l.paddingLeft)+Math.min(0,parseInt(l.textIndent)):0),h=o.right-(l?parseInt(l.paddingRight):0),d=Cs(e,n),u=Cs(e,s),I=d.type==Wi.Text?d:null,f=u.type==Wi.Text?u:null;if(I&&(e.lineWrapping||d.widgetLineBreaks)&&(I=rr(e,n,1,I)),f&&(e.lineWrapping||u.widgetLineBreaks)&&(f=rr(e,s,-1,f)),I&&f&&I.from==f.from&&I.to==f.to)return p(m(i.from,i.to,I));{let t=I?m(i.from,null,I):B(d,!1),n=f?m(null,i.to,f):B(u,!0),s=[];return(I||d).to<(f||u).from-(I&&f?1:0)||d.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2c&&n.from=a)break;o>s&&A(Math.max(e,s),null==t&&e<=c,Math.min(o,a),null==i&&o>=l,r.dir)}if(s=n.to+1,s>=a)break}return 0==o.length&&A(c,null==t,l,null==i,e.textDirection),{top:s,bottom:r,horizontal:o}}function B(e,t){let i=o.top+(t?e.top:e.bottom);return{top:i,bottom:i,horizontal:[]}}}(e,t,i)}}function ar(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==on.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function rr(e,t,i,n){let s=e.coordsAtPos(t,2*i);if(!s)return n;let a=e.dom.getBoundingClientRect(),r=(s.top+s.bottom)/2,o=e.posAtCoords({x:a.left+1,y:r}),A=e.posAtCoords({x:a.right-1,y:r});return null==o||null==A?n:{from:Math.max(n.from,Math.min(o,A)),to:Math.min(n.to,Math.max(o,A))}}class or{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Ar)!=e.state.facet(Ar)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(Ar);for(;t{return i=e,n=this.drawn[t],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let t=this.dom.firstChild,i=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[i].constructor&&n.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(n.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ar=Re.define();function cr(e){return[Kn.define((t=>new or(t,e))),Ar.of(e)]}const lr=!(Mi.ios&&Mi.webkit&&Mi.webkit_version<534),gr=Re.define({combine:e=>ft(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function hr(e={}){return[gr.of(e),ur,fr,pr,Un.of(!0)]}function dr(e){return e.startState.facet(gr)!=e.state.facet(gr)}const ur=cr({above:!0,markers(e){let{state:t}=e,i=t.facet(gr),n=[];for(let s of t.selection.ranges){let a=s==t.selection.main;if(s.empty?!a||lr:i.drawRangeCursor){let t=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:De.cursor(s.head,s.head>s.anchor?-1:1);for(let s of sr.forRange(e,t,i))n.push(s)}}return n},update(e,t){e.transactions.some((e=>e.selection))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let i=dr(e);return i&&Ir(e.state,t),e.docChanged||e.selectionSet||i},mount(e,t){Ir(t.state,e)},class:"cm-cursorLayer"});function Ir(e,t){t.style.animationDuration=e.facet(gr).cursorBlinkRate+"ms"}const fr=cr({above:!1,markers:e=>e.state.selection.ranges.map((t=>t.empty?[]:sr.forRange(e,"cm-selectionBackground",t))).reduce(((e,t)=>e.concat(t))),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||dr(e),class:"cm-selectionLayer"}),Cr={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};lr&&(Cr[".cm-line"].caretColor=Cr[".cm-content"].caretColor="transparent !important");const pr=qe.highest(Pa.theme(Cr));function mr(e,t,i,n,s){t.lastIndex=0;for(let a,r=e.iterRange(i,n),o=i;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;a=t.exec(r.value);)s(o+a.index,a)}class Br{constructor(e){const{regexp:t,decoration:i,decorate:n,boundary:s,maxLength:a=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,n)this.addMatch=(e,t,i,s)=>n(s,i,i+e[0].length,e,t);else if("function"==typeof i)this.addMatch=(e,t,n,s)=>{let a=i(e,t,n);a&&s(n,n+e[0].length,a)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,n,s)=>s(n,n+e[0].length,i)}this.boundary=s,this.maxLength=a}createDeco(e){let t=new Et,i=t.add.bind(t);for(let{from:t,to:n}of function(e,t){let i=e.visibleRanges;if(1==i.length&&i[0].from==e.viewport.from&&i[0].to==e.viewport.to)return i;let n=[];for(let{from:s,to:a}of i)s=Math.max(e.state.doc.lineAt(s).from,s-t),a=Math.min(e.state.doc.lineAt(a).to,a+t),n.length&&n[n.length-1].to>=s?n[n.length-1].to=a:n.push({from:s,to:a});return n}(e,this.maxLength))mr(e.state.doc,this.regexp,t,n,((t,n)=>this.addMatch(n,e,t,i)));return t.finish()}updateDeco(e,t){let i=1e9,n=-1;return e.docChanged&&e.changes.iterChanges(((t,s,a,r)=>{r>=e.view.viewport.from&&a<=e.view.viewport.to&&(i=Math.min(a,i),n=Math.max(r,n))})),e.viewportMoved||n-i>1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),i,n):t}updateRange(e,t,i,n){for(let s of e.visibleRanges){let a=Math.max(s.from,i),r=Math.min(s.to,n);if(r>a){let i=e.state.doc.lineAt(a),n=i.toi.from;a--)if(this.boundary.test(i.text[a-1-i.from])){o=a;break}for(;rl.push(i.range(e,t));if(i==n)for(this.regexp.lastIndex=o-i.from;(c=this.regexp.exec(i.text))&&c.indexthis.addMatch(i,e,t,g)));t=t.update({filterFrom:o,filterTo:A,filter:(e,t)=>eA,add:l})}}return t}}const Qr=null!=/x/.unicode?"gu":"g",Er=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Qr),br={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let yr=null;const wr=Re.define({combine(e){let t=ft(e,{render:null,specialChars:Er,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==yr&&"undefined"!=typeof document&&document.body){let t=document.body.style;yr=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return yr||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,Qr)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Qr)),t}});function kr(e={}){return[wr.of(e),Sr||(Sr=Kn.fromClass(class{constructor(e){this.view=e,this.decorations=ji.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(wr)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Br({regexp:e.specialChars,decoration:(t,i,n)=>{let{doc:s}=i.state,a=Ie(t[0],0);if(9==a){let e=s.lineAt(n),t=i.state.tabSize,a=Mt(e.text,t,n-e.from);return ji.replace({widget:new Dr((t-a%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=ji.replace({widget:new vr(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(wr);e.startState.facet(wr)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let Sr=null;class vr extends Vi{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),i=e.state.phrase("Control character")+" "+(br[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Dr extends Vi{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const xr=ji.line({class:"cm-activeLine"}),Fr=Kn.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,i=[];for(let n of e.state.selection.ranges){let s=e.lineBlockAt(n.head);s.from>t&&(i.push(xr.range(s.from)),t=s.from)}return ji.set(i)}},{decorations:e=>e.decorations}),Rr=2e3;function Mr(e,t){let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),n=e.state.doc.lineAt(i),s=i-n.from,a=s>Rr?-1:s==n.length?function(e,t){let i=e.coordsAtPos(e.viewport.from);return i?Math.round(Math.abs((i.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):Mt(n.text,e.state.tabSize,i-n.from);return{line:n.number,col:a,off:s}}function Nr(e){return Pa.mouseSelectionStyle.of(((e,t)=>(e=>e.altKey&&0==e.button)(t)?function(e,t){let i=Mr(e,t),n=e.state.selection;return i?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(i.line).from),s=e.state.doc.lineAt(t);i={line:s.number,col:i.col,off:Math.min(i.off,s.length)},n=n.map(e.changes)}},get(t,s,a){let r=Mr(e,t);if(!r)return n;let o=function(e,t,i){let n=Math.min(t.line,i.line),s=Math.max(t.line,i.line),a=[];if(t.off>Rr||i.off>Rr||t.col<0||i.col<0){let r=Math.min(t.off,i.off),o=Math.max(t.off,i.off);for(let t=n;t<=s;t++){let i=e.doc.line(t);i.length<=o&&a.push(De.range(i.from+r,i.to+o))}}else{let r=Math.min(t.col,i.col),o=Math.max(t.col,i.col);for(let t=n;t<=s;t++){let i=e.doc.line(t),n=Nt(i.text,r,e.tabSize,!0);if(n<0)a.push(De.cursor(i.to));else{let t=Nt(i.text,o,e.tabSize);a.push(De.range(i.from+n,i.from+t))}}}return a}(e.state,i,r);return o.length?a?De.create(o.concat(n.ranges)):De.create(o):n}}:null}(e,t):null))}const Gr="-10000px";class Ur{constructor(e,t,i,n){this.facet=t,this.createTooltipView=i,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e));let s=null;this.tooltipViews=this.tooltips.map((e=>s=i(e,s)))}update(e,t){var i;let n=e.state.facet(this.facet),s=n.filter((e=>e));if(n===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],r=t?[]:null;for(let i=0;it[i]=e)),t.length=r.length),this.input=n,this.tooltips=s,this.tooltipViews=a,!0}}function Lr(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const Tr=Re.define({combine:e=>{var t,i,n;return{position:Mi.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(i=e.find((e=>e.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=e.find((e=>e.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Lr}}}),Hr=new WeakMap,Or=Kn.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Tr);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new Ur(e,Yr,((e,t)=>this.createTooltip(e,t)),(e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()})),this.above=this.manager.tooltips.map((e=>!!e.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let i=t||e.geometryChanged,n=e.state.facet(Tr);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(e,t){let i=e.create(this.view),n=t?t.dom:null;if(i.dom.classList.add("cm-tooltip"),e.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",i.dom.appendChild(e)}return i.dom.style.position=this.position,i.dom.style.top=Gr,i.dom.style.left="0px",this.container.insertBefore(i.dom,n),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var e,t,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Mi.gecko)i=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==Gr&&"0px"==e.style.left){let t=e.getBoundingClientRect();i=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}}if(i||"absolute"==this.position)if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),s=ts(this.view);return{visible:{left:n.left+s.left,top:n.top+s.top,right:n.right-s.right,bottom:n.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map(((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(Tr).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:i}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:i,space:n,scaleX:s,scaleY:a}=e,r=[];for(let o=0;o=Math.min(i.bottom,n.bottom)||g.rightMath.min(i.right,n.right)+.1)){l.style.top=Gr;continue}let d=A.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,u=d?7:0,I=h.right-h.left,f=null!==(t=Hr.get(c))&&void 0!==t?t:h.bottom-h.top,C=c.offset||Pr,p=this.view.textDirection==on.LTR,m=h.width>n.right-n.left?p?n.left:n.right-h.width:p?Math.max(n.left,Math.min(g.left-(d?14:0)+C.x,n.right-I)):Math.min(Math.max(n.left,g.left-I+(d?14:0)-C.x),n.right-I),B=this.above[o];!A.strictSide&&(B?g.top-f-u-C.yn.bottom)&&B==n.bottom-g.bottom>g.top-n.top&&(B=this.above[o]=!B);let Q=(B?g.top-n.top:n.bottom-g.bottom)-u;if(Qm&&e.topE&&(E=B?e.top-f-2-u:e.bottom+u+2);if("absolute"==this.position?(l.style.top=(E-e.parent.top)/a+"px",qr(l,(m-e.parent.left)/s)):(l.style.top=E/a+"px",qr(l,m/s)),d){let e=g.left+(p?C.x:-C.x)-(m+14-7);d.style.left=e/s+"px"}!0!==c.overlap&&r.push({left:m,top:E,right:b,bottom:E+f}),l.classList.toggle("cm-tooltip-above",B),l.classList.toggle("cm-tooltip-below",!B),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=Gr}},{eventObservers:{scroll(){this.maybeMeasure()}}});function qr(e,t){let i=parseInt(e.style.left,10);(isNaN(i)||Math.abs(t-i)>1)&&(e.style.left=t+"px")}const Jr=Pa.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Pr={x:0,y:0},Yr=Re.define({enables:[Or,Jr]}),Kr=Re.define({combine:e=>e.reduce(((e,t)=>e.concat(t)),[])});class Vr{static create(e){return new Vr(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ur(e,Kr,((e,t)=>this.createHostedView(e,t)),(e=>e.dom.remove()))}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let n=i[e];if(void 0!==n)if(void 0===t)t=n;else if(t!==n)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Wr=Yr.compute([Kr],(e=>{let t=e.facet(Kr);return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.map((e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos}))),create:Vr.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class jr{constructor(e,t,i,n,s){this.view=e,this.source=t,this.field=i,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ei.bottom||t.xi.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(n)).find((e=>e.from<=n&&e.to>=n)),r=a&&a.dir==on.RTL?-1:1;s=t.x{this.pending==t&&(this.pending=null,!i||Array.isArray(i)&&!i.length||e.dispatch({effects:this.setHover.of(Array.isArray(i)?i:[i])}))}),(t=>qn(e.state,t,"hover tooltip")))}else!a||Array.isArray(a)&&!a.length||e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(Or),t=e?e.manager.tooltips.findIndex((e=>e.create==Vr.create)):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!function(e,t){let i,{left:n,right:s,top:a,bottom:r}=e.getBoundingClientRect();if(i=e.querySelector(".cm-tooltip-arrow")){let e=i.getBoundingClientRect();a=Math.min(e.top,a),r=Math.max(e.bottom,r)}return t.clientX>=n-_r&&t.clientX<=s+_r&&t.clientY>=a-_r&&t.clientY<=r+_r}(s.dom,e)||this.pending){let{pos:s}=n[0]||this.pending,a=null!==(i=null===(t=n[0])||void 0===t?void 0:t.end)&&void 0!==i?i:s;(s==a?this.view.posAtCoords(this.lastMove)==s:function(e,t,i,n,s){let a=e.scrollDOM.getBoundingClientRect(),r=e.documentTop+e.documentPadding.top+e.contentHeight;if(a.left>n||a.rights||Math.min(a.bottom,r)=t&&o<=i}(this.view,s,a,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const _r=4;function Xr(e,t){let i=e.plugin(Or);if(!i)return null;let n=i.manager.tooltips.indexOf(t);return n<0?null:i.manager.tooltipViews[n]}const Zr=st.define(),zr=Re.define({combine(e){let t,i;for(let n of e)t=t||n.topContainer,i=i||n.bottomContainer;return{topContainer:t,bottomContainer:i}}});function $r(e,t){let i=e.plugin(eo),n=i?i.specs.indexOf(t):-1;return n>-1?i.panels[n]:null}const eo=Kn.fromClass(class{constructor(e){this.input=e.state.facet(no),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(zr);this.top=new to(e,!0,t.topContainer),this.bottom=new to(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(zr);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new to(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new to(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=e.state.facet(no);if(i!=this.input){let t=i.filter((e=>e)),n=[],s=[],a=[],r=[];for(let i of t){let t,o=this.specs.indexOf(i);o<0?(t=i(e.view),r.push(t)):(t=this.panels[o],t.update&&t.update(e)),n.push(t),(t.top?s:a).push(t)}this.specs=t,this.panels=n,this.top.sync(s),this.bottom.sync(a);for(let e of r)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Pa.scrollMargins.of((t=>{let i=t.plugin(e);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class to{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=io(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=io(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function io(e){let t=e.nextSibling;return e.remove(),t}const no=Re.define({enables:eo});class so extends Ct{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}so.prototype.elementClass="",so.prototype.toDOM=void 0,so.prototype.mapMode=me.TrackBefore,so.prototype.startSide=so.prototype.endSide=-1,so.prototype.point=!0;const ao=Re.define(),ro=Re.define(),oo={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Qt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Ao=Re.define();function co(e){return[go(),Ao.of(Object.assign(Object.assign({},oo),e))]}const lo=Re.define({combine:e=>e.some((e=>e))});function go(e){return[ho]}const ho=Kn.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Ao).map((t=>new Co(e,t)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!e.state.facet(lo),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,i=e.view.viewport,n=Math.min(t.to,i.to)-Math.max(t.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(lo)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let i=Qt.iter(this.view.state.facet(ao),this.view.viewport.from),n=[],s=this.gutters.map((e=>new fo(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(e.type)){let t=!0;for(let a of e.type)if(a.type==Wi.Text&&t){Io(i,n,a.from);for(let e of s)e.line(this.view,a,n);t=!1}else if(a.widget)for(let e of s)e.widget(this.view,a)}else if(e.type==Wi.Text){Io(i,n,e.from);for(let t of s)t.line(this.view,e,n)}else if(e.widget)for(let t of s)t.widget(this.view,e);for(let e of s)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(Ao),i=e.state.facet(Ao),n=e.docChanged||e.heightChanged||e.viewportChanged||!Qt.eq(e.startState.facet(ao),e.state.facet(ao),e.view.viewport.from,e.view.viewport.to);if(t==i)for(let t of this.gutters)t.update(e)&&(n=!0);else{n=!0;let s=[];for(let n of i){let i=t.indexOf(n);i<0?s.push(new Co(this.view,n)):(this.gutters[i].update(e),s.push(this.gutters[i]))}for(let e of this.gutters)e.dom.remove(),s.indexOf(e)<0&&e.destroy();for(let e of s)this.dom.appendChild(e.dom);this.gutters=s}return n}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>Pa.scrollMargins.of((t=>{let i=t.plugin(e);return i&&0!=i.gutters.length&&i.fixed?t.textDirection==on.LTR?{left:i.dom.offsetWidth*t.scaleX}:{right:i.dom.offsetWidth*t.scaleX}:null}))});function uo(e){return Array.isArray(e)?e:[e]}function Io(e,t,i){for(;e.value&&e.from<=i;)e.from==i&&t.push(e.value),e.next()}class fo{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=Qt.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:n}=this,s=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==n.elements.length){let t=new po(e,a,s,i);n.elements.push(t),n.dom.appendChild(t.dom)}else n.elements[this.i].update(e,a,s,i);this.height=t.bottom,this.i++}line(e,t,i){let n=[];Io(this.cursor,n,t.from),i.length&&(n=n.concat(i));let s=this.gutter.config.lineMarker(e,t,n);s&&n.unshift(s);let a=this.gutter;(0!=n.length||a.config.renderEmptyElements)&&this.addElement(e,t,n)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),n=i?[i]:null;for(let i of e.state.facet(ro)){let s=i(e,t.widget,t);s&&(n||(n=[])).push(s)}n&&this.addElement(e,t,n)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Co{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,(n=>{let s,a=n.target;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let e=a.getBoundingClientRect();s=(e.top+e.bottom)/2}else s=n.clientY;let r=e.lineBlockAtHeight(s-e.documentTop);t.domEventHandlers[i](e,r,n)&&n.preventDefault()}));this.markers=uo(t.markers(e)),t.initialSpacer&&(this.spacer=new po(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=uo(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let i=e.view.viewport;return!Qt.eq(this.markers,t,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class po{constructor(e,t,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,n)}update(e,t,i,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let i=0;ift(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let e in t){let n=i[e],s=t[e];i[e]=n?(e,t,i)=>n(e,t,i)||s(e,t,i):s}return i}})});class Eo extends so{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function bo(e,t){return e.state.facet(Qo).formatNumber(t,e.state)}const yo=Ao.compute([Qo],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(mo),lineMarker:(e,t,i)=>i.some((e=>e.toDOM))?null:new Eo(bo(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,i)=>{for(let n of e.state.facet(Bo)){let s=n(e,t,i);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Qo)!=e.state.facet(Qo),initialSpacer:e=>new Eo(bo(e,ko(e.state.doc.lines))),updateSpacer(e,t){let i=bo(t.view,ko(t.view.state.doc.lines));return i==e.number?e:new Eo(i)},domEventHandlers:e.facet(Qo).domEventHandlers})));function wo(e={}){return[Qo.of(e),go(),yo]}function ko(e){let t=9;for(;t{let t=[],i=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.head).from;s>i&&(i=s,t.push(So.range(s)))}return Qt.of(t)}));function Do(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var s=i[n];"string"==typeof s?e.setAttribute(n,s):null!=s&&(e[n]=s)}t++}for(;te.normalize("NFKD"):e=>e;class Ro{constructor(e,t,i=0,n=e.length,s,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,n),this.bufferStart=i,this.normalize=s?e=>s(Fo(e)):Fo,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ie(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fe(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Ce(e);let n=this.normalize(t);if(n.length)for(let e=0,s=i;;e++){let a=n.charCodeAt(e),r=this.match(a,s,this.bufferPos+this.bufferStart);if(e==n.length-1){if(r)return this.value=r,this;break}s==i&&ethis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,n=i+t[0].length;if(this.matchPos=Ho(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,t)))return this.value={from:i,to:n,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||n.to<=t){let n=new Lo(t,e.sliceString(t,i));return Uo.set(e,n),n}if(n.from==t&&n.to==i)return n;let{text:s,from:a}=n;return a>t&&(s=e.sliceString(t,a)+s,a=t),n.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,i=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,i,t)))return this.value={from:e,to:i,match:t},this.matchPos=Ho(this.text,i+(e==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Lo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Ho(e,t){if(t>=e.length)return t;let i,n=e.lineAt(t);for(;t=56320&&i<57344;)t++;return t}function Oo(e){let t=Do("input",{class:"cm-textfield",name:"line",value:String(e.state.doc.lineAt(e.state.selection.main.head).number)});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!i)return;let{state:n}=e,s=n.doc.lineAt(n.selection.main.head),[,a,r,o,A]=i,c=o?+o.slice(1):0,l=r?+r:s.number;if(r&&A){let e=l/100;a&&(e=e*("-"==a?-1:1)+s.number/n.doc.lines),l=Math.round(n.doc.lines*e)}else r&&a&&(l=l*("-"==a?-1:1)+s.number);let g=n.doc.line(Math.max(1,Math.min(n.doc.lines,l))),h=De.cursor(g.from+Math.max(0,Math.min(c,g.length)));e.dispatch({effects:[qo.of(!1),Pa.scrollIntoView(h.from,{y:"center"})],selection:h}),e.focus()}return{dom:Do("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:qo.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),i())},onsubmit:e=>{e.preventDefault(),i()}},Do("label",e.state.phrase("Go to line"),": ",t)," ",Do("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Go.prototype[Symbol.iterator]=To.prototype[Symbol.iterator]=function(){return this});const qo=st.define(),Jo=He.define({create:()=>!0,update(e,t){for(let i of t.effects)i.is(qo)&&(e=i.value);return e},provide:e=>no.from(e,(e=>e?Oo:null))}),Po=Pa.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Yo={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ko=Re.define({combine:e=>ft(e,Yo,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),Vo=ji.mark({class:"cm-selectionMatch"}),Wo=ji.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function jo(e,t,i,n){return!(0!=i&&e(t.sliceDoc(i-1,i))==ht.Word||n!=t.doc.length&&e(t.sliceDoc(n,n+1))==ht.Word)}Kn.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Ko),{state:i}=e,n=i.selection;if(n.ranges.length>1)return ji.none;let s,a=n.main,r=null;if(a.empty){if(!t.highlightWordAroundCursor)return ji.none;let e=i.wordAt(a.head);if(!e)return ji.none;r=i.charCategorizer(a.head),s=i.sliceDoc(e.from,e.to)}else{let e=a.to-a.from;if(e200)return ji.none;if(t.wholeWords){if(s=i.sliceDoc(a.from,a.to),r=i.charCategorizer(a.head),!jo(r,i,a.from,a.to)||!function(e,t,i,n){return e(t.sliceDoc(i,i+1))==ht.Word&&e(t.sliceDoc(n-1,n))==ht.Word}(r,i,a.from,a.to))return ji.none}else if(s=i.sliceDoc(a.from,a.to),!s)return ji.none}let o=[];for(let n of e.visibleRanges){let e=new Ro(i.doc,s,n.from,n.to);for(;!e.next().done;){let{from:n,to:s}=e.value;if((!r||jo(r,i,n,s))&&(a.empty&&n<=a.from&&s>=a.to?o.push(Wo.range(n,s)):(n>=a.to||s<=a.from)&&o.push(Vo.range(n,s)),o.length>t.maxMatches))return ji.none}}return ji.set(o)}},{decorations:e=>e.decorations}),Pa.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const _o=Re.define({combine:e=>ft(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new yA(e),scrollToMatch:e=>Pa.scrollIntoView(e)})});class Xo{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,No),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new nA(this):new $o(this)}getCursor(e,t=0,i){let n=e.doc?e:It.create({doc:e});return null==i&&(i=n.doc.length),this.regexp?eA(this,n,t,i):zo(this,n,t,i)}}class Zo{constructor(e){this.spec=e}}function zo(e,t,i,n){return new Ro(t.doc,e.unquoted,i,n,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?function(e,t){return(i,n,s,a)=>((a>i||a+s.length=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let s=zo(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}function eA(e,t,i,n){return new Go(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(s=t.charCategorizer(t.selection.main.head),(e,t,i)=>!i[0].length||(s(tA(i.input,i.index))!=ht.Word||s(iA(i.input,i.index))!=ht.Word)&&(s(iA(i.input,i.index+i[0].length))!=ht.Word||s(tA(i.input,i.index+i[0].length))!=ht.Word)):void 0},i,n);var s}function tA(e,t){return e.slice(ue(e,t,!1),t)}function iA(e,t){return e.slice(t,ue(e,t))}class nA extends Zo{nextMatch(e,t,i){let n=eA(this.spec,e,i,e.doc.length).next();return n.done&&(n=eA(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,i){for(let n=1;;n++){let s=Math.max(t,i-1e4*n),a=eA(this.spec,e,s,i),r=null;for(;!a.next().done;)r=a.value;if(r&&(s==t||r.from>s+10))return r;if(s==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,((t,i)=>"$"==i?"$":"&"==i?e.match[0]:"0"!=i&&+i=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let s=eA(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}const sA=st.define(),aA=st.define(),rA=He.define({create:e=>new oA(pA(e).create(),null),update(e,t){for(let i of t.effects)i.is(sA)?e=new oA(i.value.create(),e.panel):i.is(aA)&&(e=new oA(e.query,i.value?CA:null));return e},provide:e=>no.from(e,(e=>e.panel))});class oA{constructor(e,t){this.query=e,this.panel=t}}const AA=ji.mark({class:"cm-searchMatch"}),cA=ji.mark({class:"cm-searchMatch cm-searchMatch-selected"}),lA=Kn.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(rA))}update(e){let t=e.state.field(rA);(t!=e.startState.field(rA)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return ji.none;let{view:i}=this,n=new Et;for(let t=0,s=i.visibleRanges,a=s.length;ts[t+1].from-500;)o=s[++t].to;e.highlight(i.state,r,o,((e,t)=>{let s=i.state.selection.ranges.some((i=>i.from==e&&i.to==t));n.add(e,t,s?cA:AA)}))}return n.finish()}},{decorations:e=>e.decorations});function gA(e){return t=>{let i=t.state.field(rA,!1);return i&&i.query.spec.valid?e(t,i):QA(t)}}const hA=gA(((e,{query:t})=>{let{to:i}=e.state.selection.main,n=t.nextMatch(e.state,i,i);if(!n)return!1;let s=De.single(n.from,n.to),a=e.state.facet(_o);return e.dispatch({selection:s,effects:[vA(e,n),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),BA(e),!0})),dA=gA(((e,{query:t})=>{let{state:i}=e,{from:n}=i.selection.main,s=t.prevMatch(i,n,n);if(!s)return!1;let a=De.single(s.from,s.to),r=e.state.facet(_o);return e.dispatch({selection:a,effects:[vA(e,s),r.scrollToMatch(a.main,e)],userEvent:"select.search"}),BA(e),!0})),uA=gA(((e,{query:t})=>{let i=t.matchAll(e.state,1e3);return!(!i||!i.length||(e.dispatch({selection:De.create(i.map((e=>De.range(e.from,e.to)))),userEvent:"select.search.matches"}),0))})),IA=gA(((e,{query:t})=>{let{state:i}=e,{from:n,to:s}=i.selection.main;if(i.readOnly)return!1;let a=t.nextMatch(i,n,n);if(!a)return!1;let r,o,A=a,c=[],l=[];if(A.from==n&&A.to==s&&(o=i.toText(t.getReplacement(A)),c.push({from:A.from,to:A.to,insert:o}),A=t.nextMatch(i,A.from,A.to),l.push(Pa.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),A){let t=0==c.length||c[0].from>=a.to?0:a.to-a.from-o.length;r=De.single(A.from-t,A.to-t),l.push(vA(e,A)),l.push(i.facet(_o).scrollToMatch(r.main,e))}return e.dispatch({changes:c,selection:r,effects:l,userEvent:"input.replace"}),!0})),fA=gA(((e,{query:t})=>{if(e.state.readOnly)return!1;let i=t.matchAll(e.state,1e9).map((e=>{let{from:i,to:n}=e;return{from:i,to:n,insert:t.getReplacement(e)}}));if(!i.length)return!1;let n=e.state.phrase("replaced $ matches",i.length)+".";return e.dispatch({changes:i,effects:Pa.announce.of(n),userEvent:"input.replace.all"}),!0}));function CA(e){return e.state.facet(_o).createPanel(e)}function pA(e,t){var i,n,s,a,r;let o=e.selection.main,A=o.empty||o.to>o.from+100?"":e.sliceDoc(o.from,o.to);if(t&&!A)return t;let c=e.facet(_o);return new Xo({search:(null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:c.literal)?A:A.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==t?void 0:t.caseSensitive)&&void 0!==n?n:c.caseSensitive,literal:null!==(s=null==t?void 0:t.literal)&&void 0!==s?s:c.literal,regexp:null!==(a=null==t?void 0:t.regexp)&&void 0!==a?a:c.regexp,wholeWord:null!==(r=null==t?void 0:t.wholeWord)&&void 0!==r?r:c.wholeWord})}function mA(e){let t=$r(e,CA);return t&&t.dom.querySelector("[main-field]")}function BA(e){let t=mA(e);t&&t==e.root.activeElement&&t.select()}const QA=e=>{let t=e.state.field(rA,!1);if(t&&t.panel){let i=mA(e);if(i&&i!=e.root.activeElement){let n=pA(e.state,t.query.spec);n.valid&&e.dispatch({effects:sA.of(n)}),i.focus(),i.select()}}else e.dispatch({effects:[aA.of(!0),t?sA.of(pA(e.state,t.query.spec)):st.appendConfig.of(xA)]});return!0},EA=e=>{let t=e.state.field(rA,!1);if(!t||!t.panel)return!1;let i=$r(e,CA);return i&&i.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:aA.of(!1)}),!0},bA=[{key:"Mod-f",run:QA,scope:"editor search-panel"},{key:"F3",run:hA,shift:dA,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:hA,shift:dA,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:EA,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let i=e.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:s}=i.main,a=[],r=0;for(let t=new Ro(e.doc,e.sliceDoc(n,s));!t.next().done;){if(a.length>1e3)return!1;t.value.from==n&&(r=a.length),a.push(De.range(t.value.from,t.value.to))}return t(e.update({selection:De.create(a,r),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=$r(e,Oo);if(!t){let i=[qo.of(!0)];null==e.state.field(Jo,!1)&&i.push(st.appendConfig.of([Jo,Po])),e.dispatch({effects:i}),t=$r(e,Oo)}return t&&t.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:i}=e.selection;if(i.some((e=>e.from===e.to)))return(({state:e,dispatch:t})=>{let{selection:i}=e,n=De.create(i.ranges.map((t=>e.wordAt(t.head)||De.cursor(t.head))),i.mainIndex);return!n.eq(i)&&(t(e.update({selection:n})),!0)})({state:e,dispatch:t});let n=e.sliceDoc(i[0].from,i[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=n)))return!1;let s=function(e,t){let{main:i,ranges:n}=e.selection,s=e.wordAt(i.head),a=s&&s.from==i.from&&s.to==i.to;for(let i=!1,s=new Ro(e.doc,t,n[n.length-1].to);;){if(s.next(),!s.done){if(i&&n.some((e=>e.from==s.value.from)))continue;if(a){let t=e.wordAt(s.value.from);if(!t||t.from!=s.value.from||t.to!=s.value.to)continue}return s.value}if(i)return null;s=new Ro(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),i=!0}}(e,n);return!!s&&(t(e.update({selection:e.selection.addRange(De.range(s.from,s.to),!1),effects:Pa.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class yA{constructor(e){this.view=e;let t=this.query=e.state.field(rA).query.spec;function i(e,t,i){return Do("button",{class:"cm-button",name:e,onclick:t,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Do("input",{value:t.search,placeholder:wA(e,"Find"),"aria-label":wA(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Do("input",{value:t.replace,placeholder:wA(e,"Replace"),"aria-label":wA(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Do("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Do("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Do("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=Do("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,i("next",(()=>hA(e)),[wA(e,"next")]),i("prev",(()=>dA(e)),[wA(e,"previous")]),i("select",(()=>uA(e)),[wA(e,"all")]),Do("label",null,[this.caseField,wA(e,"match case")]),Do("label",null,[this.reField,wA(e,"regexp")]),Do("label",null,[this.wordField,wA(e,"by word")]),...e.state.readOnly?[]:[Do("br"),this.replaceField,i("replace",(()=>IA(e)),[wA(e,"replace")]),i("replaceAll",(()=>fA(e)),[wA(e,"replace all")])],Do("button",{name:"close",onclick:()=>EA(e),"aria-label":wA(e,"close"),type:"button"},["×"])])}commit(){let e=new Xo({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:sA.of(e)}))}keydown(e){var t,i;i=e,nr($a((t=this.view).state),i,t,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?dA:hA)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),IA(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(sA)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(_o).top}}function wA(e,t){return e.state.phrase(t)}const kA=30,SA=/[\s\.,:;?!]/;function vA(e,{from:t,to:i}){let n=e.state.doc.lineAt(t),s=e.state.doc.lineAt(i).to,a=Math.max(n.from,t-kA),r=Math.min(s,i+kA),o=e.state.sliceDoc(a,r);if(a!=n.from)for(let e=0;eo.length-kA;e--)if(!SA.test(o[e-1])&&SA.test(o[e])){o=o.slice(0,e);break}return Pa.announce.of(`${e.state.phrase("current match")}. ${o} ${e.state.phrase("on line")} ${n.number}.`)}const DA=Pa.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),xA=[rA,qe.low(lA),DA],FA=1024;let RA=0;class MA{constructor(e,t){this.from=e,this.to=t}}class NA{constructor(e={}){this.id=RA++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=LA.match(e)),t=>{let i=e(t);return void 0===i?null:[this,i]}}}NA.closedBy=new NA({deserialize:e=>e.split(" ")}),NA.openedBy=new NA({deserialize:e=>e.split(" ")}),NA.group=new NA({deserialize:e=>e.split(" ")}),NA.isolate=new NA({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),NA.contextHash=new NA({perNode:!0}),NA.lookAhead=new NA({perNode:!0}),NA.mounted=new NA({perNode:!0});class GA{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[NA.mounted.id]}}const UA=Object.create(null);class LA{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):UA,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new LA(e.name||"",t,e.id,i);if(e.props)for(let i of e.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[i[0].id]=i[1]}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(NA.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return e=>{for(let i=e.prop(NA.group),n=-1;n<(i?i.length:0);n++){let s=t[n<0?e.name:i[n]];if(s)return s}}}}LA.none=new LA("",Object.create(null),0,8);class TA{constructor(e){this.types=e;for(let t=0;t=t){let r=new jA(a.tree,a.overlay[0].from+e.from,-1,e);(s||(s=[n])).push(VA(r,t,i,!1))}}return s?$A(s):n}(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:s=this.length}=e,a=e.mode||0,r=(a&qA.IncludeAnonymous)>0;for(let e=this.cursor(a|qA.IncludeAnonymous);;){let a=!1;if(e.from<=s&&e.to>=n&&(!r&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;a=!0}for(;a&&i&&(r||!e.type.isAnonymous)&&i(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:ac(LA.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,i)=>new JA(this.type,e,t,i,this.propValues)),e.makeTree||((e,t,i)=>new JA(LA.none,e,t,i)))}static build(e){return function(e){var t;let{buffer:i,nodeSet:n,maxBufferLength:s=FA,reused:a=[],minRepeatType:r=n.types.length}=e,o=Array.isArray(i)?new PA(i,i.length):i,A=n.types,c=0,l=0;function g(e,t,i,f,C,p){let{id:m,start:B,end:Q,size:E}=o,b=l,y=c;for(;E<0;){if(o.next(),-1==E){let t=a[m];return i.push(t),void f.push(B-e)}if(-3==E)return void(c=m);if(-4==E)return void(l=m);throw new RangeError(`Unrecognized record size: ${E}`)}let w,k,S=A[m],v=B-e;if(Q-B<=s&&(k=function(e,t){let i=o.fork(),n=0,a=0,A=0,c=i.end-s,l={size:0,start:0,skip:0};e:for(let s=i.pos-e;i.pos>s;){let e=i.size;if(i.id==t&&e>=0){l.size=n,l.start=a,l.skip=A,A+=4,n+=4,i.next();continue}let o=i.pos-e;if(e<0||o=r?4:0,h=i.start;for(i.next();i.pos>o;){if(i.size<0){if(-3!=i.size)break e;g+=4}else i.id>=r&&(g+=4);i.next()}a=h,n+=e,A+=g}return(t<0||n==e)&&(l.size=n,l.start=a,l.skip=A),l.size>4?l:void 0}(o.pos-t,C))){let t=new Uint16Array(k.size-k.skip),i=o.pos-k.size,s=t.length;for(;o.pos>i;)s=I(k.start,t,s);w=new YA(t,Q-k.start,n),v=k.start-e}else{let e=o.pos-E;o.next();let t=[],i=[],n=m>=r?m:-1,a=0,A=Q;for(;o.pos>e;)n>=0&&o.id==n&&o.size>=0?(o.end<=A-s&&(d(t,i,B,a,o.end,A,n,b,y),a=t.length,A=o.end),o.next()):p>2500?h(B,e,t,i):g(B,e,t,i,n,p+1);if(n>=0&&a>0&&a-1&&a>0){let e=function(e,t){return(i,n,s)=>{let a,r,o=0,A=i.length-1;if(A>=0&&(a=i[A])instanceof JA){if(!A&&a.type==e&&a.length==s)return a;(r=a.prop(NA.lookAhead))&&(o=n[A]+a.length+r)}return u(e,i,n,s,o,t)}}(S,y);w=ac(S,t,i,0,t.length,0,Q-B,e,e)}else w=u(S,t,i,Q-B,b-Q,y)}i.push(w),f.push(v)}function h(e,t,i,a){let r=[],A=0,c=-1;for(;o.pos>t;){let{id:e,start:t,end:i,size:n}=o;if(n>4)o.next();else{if(c>-1&&t=0;e-=3)t[i++]=r[e],t[i++]=r[e+1]-s,t[i++]=r[e+2]-s,t[i++]=i;i.push(new YA(t,r[2]-s,n)),a.push(s-e)}}function d(e,t,i,s,a,r,o,A,c){let l=[],g=[];for(;e.length>s;)l.push(e.pop()),g.push(t.pop()+i-a);e.push(u(n.types[o],l,g,r-a,A-r,c)),t.push(a-i)}function u(e,t,i,n,s,a,r){if(a){let e=[NA.contextHash,a];r=r?[e].concat(r):[e]}if(s>25){let e=[NA.lookAhead,s];r=r?[e].concat(r):[e]}return new JA(e,t,i,n,r)}function I(e,t,i){let{id:n,start:s,end:a,size:A}=o;if(o.next(),A>=0&&n4){let n=o.pos-(A-4);for(;o.pos>n;)i=I(e,t,i)}t[--i]=r,t[--i]=a-e,t[--i]=s-e,t[--i]=n}else-3==A?c=n:-4==A&&(l=n);return i}let f=[],C=[];for(;o.pos>0;)g(e.start||0,e.bufferStart||0,f,C,-1,0);let p=null!==(t=e.length)&&void 0!==t?t:f.length?C[0]+f[0].length:0;return new JA(A[e.topID],f.reverse(),C.reverse(),p)}(e)}}JA.empty=new JA(LA.none,[],[],0);class PA{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new PA(this.buffer,this.index)}}class YA{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return LA.none}toString(){let e=[];for(let t=0;t0));o=a[o+3]);return r}slice(e,t,i){let n=this.buffer,s=new Uint16Array(t-e),a=0;for(let r=e,o=0;r=t&&it;case 1:return i<=t&&n>t;case 2:return n>t;case 4:return!0}}function VA(e,t,i,n){for(var s;e.from==e.to||(i<1?e.from>=t:e.from>t)||(i>-1?e.to<=t:e.to0?r.length:-1;e!=A;e+=t){let A=r[e],c=o[e]+a.from;if(KA(n,i,c,c+A.length))if(A instanceof YA){if(s&qA.ExcludeBuffers)continue;let r=A.findChild(0,A.buffer.length,t,i-c,n);if(r>-1)return new zA(new ZA(a,A,e,c),null,r)}else if(s&qA.IncludeAnonymous||!A.type.isAnonymous||ic(A)){let r;if(!(s&qA.IgnoreMounts)&&(r=GA.get(A))&&!r.overlay)return new jA(r.tree,c,e,a);let o=new jA(A,c,e,a);return s&qA.IncludeAnonymous||!o.type.isAnonymous?o:o.nextChild(t<0?A.children.length-1:0,t,i,n)}}if(s&qA.IncludeAnonymous||!a.type.isAnonymous)return null;if(e=a.index>=0?a.index+t:t<0?-1:a._parent._tree.children.length,a=a._parent,!a)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let n;if(!(i&qA.IgnoreOverlays)&&(n=GA.get(this._tree))&&n.overlay){let i=e-this.from;for(let{from:e,to:s}of n.overlay)if((t>0?e<=i:e=i:s>i))return new jA(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function _A(e,t,i,n){let s=e.cursor(),a=[];if(!s.firstChild())return a;if(null!=i)for(let e=!1;!e;)if(e=s.type.is(i),!s.nextSibling())return a;for(;;){if(null!=n&&s.type.is(n))return a;if(s.type.is(t)&&a.push(s.node),!s.nextSibling())return null==n?a:[]}}function XA(e,t,i=t.length-1){for(let n=e;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[i]&&t[i]!=n.name)return!1;i--}}return!0}class ZA{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class zA extends WA{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new zA(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&qA.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new zA(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new zA(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new zA(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let a=i.buffer[this.index+1];e.push(i.slice(n,s,a)),t.push(0)}return new JA(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function $A(e){if(!e.length)return null;let t=0,i=e[0];for(let n=1;ni.from||s.to0){if(this.index-1)for(let n=t+e,s=e<0?-1:i._tree.children.length;n!=s;n+=e){let e=i._tree.children[n];if(this.mode&qA.IncludeAnonymous||e instanceof YA||!e.type.isAnonymous||ic(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==n){if(n==this.index)return a;t=a,i=s+1;break e}n=this.stack[--s]}for(let e=i;e=0;s--){if(s<0)return XA(this._tree,e,n);let a=i[t.buffer[this.stack[s]]];if(!a.isAnonymous){if(e[n]&&e[n]!=a.name)return!1;n--}}return!0}}function ic(e){return e.children.some((e=>e instanceof YA||!e.type.isAnonymous||ic(e)))}const nc=new WeakMap;function sc(e,t){if(!e.isAnonymous||t instanceof YA||t.type!=e)return 1;let i=nc.get(t);if(null==i){i=1;for(let n of t.children){if(n.type!=e||!(n instanceof JA)){i=1;break}i+=sc(e,n)}nc.set(t,i)}return i}function ac(e,t,i,n,s,a,r,o,A){let c=0;for(let i=n;i=l)break;u+=t}if(c==s+1){if(u>l){let e=i[s];t(e.children,e.positions,0,e.children.length,n[s]+o);continue}g.push(i[s])}else{let t=n[c-1]+i[c-1].length-d;g.push(ac(e,i,n,s,c,d,t,null,A))}h.push(d+o-a)}}(t,i,n,s,0),(o||A)(g,h,r)}class rc{constructor(e,t,i,n,s=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(s?1:0)|(a?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],i=!1){let n=[new rc(0,e.length,e,0,!1,i)];for(let i of t)i.to>e.length&&n.push(i);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],s=1,a=e.length?e[0]:null;for(let r=0,o=0,A=0;;r++){let c=r=i)for(;a&&a.from=t.from||l<=t.to||A){let e=Math.max(t.from,o)-A,i=Math.min(t.to,l)-A;t=e>=i?null:new rc(e,i,t.tree,t.offset+A,r>0,!!c)}if(t&&n.push(t),a.to>l)break;a=snew MA(e.from,e.to))):[new MA(0,0)]:[new MA(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let e=n.advance();if(e)return e}}}class Ac{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new NA({perNode:!0});let cc=0;class lc{constructor(e,t,i,n){this.name=e,this.set=t,this.base=i,this.modified=n,this.id=cc++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i="string"==typeof e?e:"?";if(e instanceof lc&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let n=new lc(i,[],null,[]);if(n.set.push(n),t)for(let e of t.set)n.set.push(e);return n}static defineModifier(e){let t=new hc(e);return e=>e.modified.indexOf(t)>-1?e:hc.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let gc=0;class hc{constructor(e){this.name=e,this.instances=[],this.id=gc++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find((i=>{return i.base==e&&(n=t,s=i.modified,n.length==s.length&&n.every(((e,t)=>e==s[t])));var n,s}));if(i)return i;let n=[],s=new lc(e.name,n,e,t);for(let e of t)e.instances.push(s);let a=function(e){let t=[[]];for(let i=0;it.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of a)n.push(hc.get(t,e));return s}}function dc(e){let t=Object.create(null);for(let i in e){let n=e[i];Array.isArray(n)||(n=[n]);for(let e of i.split(" "))if(e){let i=[],s=2,a=e;for(let t=0;;){if("..."==a&&t>0&&t+3==e.length){s=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!n)throw new RangeError("Invalid path: "+e);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),t+=n[0].length,t==e.length)break;let r=e[t++];if(t==e.length&&"!"==r){s=0;break}if("/"!=r)throw new RangeError("Invalid path: "+e);a=e.slice(t)}let r=i.length-1,o=i[r];if(!o)throw new RangeError("Invalid path: "+e);let A=new Ic(n,s,r>0?i.slice(0,r):null);t[o]=A.sort(t[o])}}return uc.add(t)}const uc=new NA;class Ic{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=s;for(let n of e)for(let e of n.set){let n=i[e.id];if(n){t=t?t+" "+n:n;break}}return t},scope:n}}function Cc(e,t,i,n=0,s=e.length){let a=new pc(n,Array.isArray(t)?t:[t],i);a.highlightRange(e.cursor(),n,s,"",a.highlighters),a.flush(s)}Ic.empty=new Ic([],2,null);class pc{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,n,s){let{type:a,from:r,to:o}=e;if(r>=i||o<=t)return;a.isTop&&(s=this.highlighters.filter((e=>!e.scope||e.scope(a))));let A=n,c=function(e){let t=e.type.prop(uc);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||Ic.empty,l=function(e,t){let i=null;for(let n of e){let e=n.style(t);e&&(i=i?i+" "+e:e)}return i}(s,c.tags);if(l&&(A&&(A+=" "),A+=l,1==c.mode&&(n+=(n?" ":"")+l)),this.startSpan(Math.max(t,r),A),c.opaque)return;let g=e.tree&&e.tree.prop(NA.mounted);if(g&&g.overlay){let a=e.node.enter(g.overlay[0].from+r,1),c=this.highlighters.filter((e=>!e.scope||e.scope(g.tree.type))),l=e.firstChild();for(let h=0,d=r;;h++){let u=h=I)&&e.nextSibling()););if(!u||I>i)break;d=u.to+r,d>t&&(this.highlightRange(a.cursor(),Math.max(t,u.from+r),Math.min(i,d),"",c),this.startSpan(Math.min(i,d),A))}l&&e.parent()}else if(e.firstChild()){g&&(n="");do{if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,s),this.startSpan(Math.min(i,e.to),A)}}while(e.nextSibling());e.parent()}}}const mc=lc.define,Bc=mc(),Qc=mc(),Ec=mc(Qc),bc=mc(Qc),yc=mc(),wc=mc(yc),kc=mc(yc),Sc=mc(),vc=mc(Sc),Dc=mc(),xc=mc(),Fc=mc(),Rc=mc(Fc),Mc=mc(),Nc={comment:Bc,lineComment:mc(Bc),blockComment:mc(Bc),docComment:mc(Bc),name:Qc,variableName:mc(Qc),typeName:Ec,tagName:mc(Ec),propertyName:bc,attributeName:mc(bc),className:mc(Qc),labelName:mc(Qc),namespace:mc(Qc),macroName:mc(Qc),literal:yc,string:wc,docString:mc(wc),character:mc(wc),attributeValue:mc(wc),number:kc,integer:mc(kc),float:mc(kc),bool:mc(yc),regexp:mc(yc),escape:mc(yc),color:mc(yc),url:mc(yc),keyword:Dc,self:mc(Dc),null:mc(Dc),atom:mc(Dc),unit:mc(Dc),modifier:mc(Dc),operatorKeyword:mc(Dc),controlKeyword:mc(Dc),definitionKeyword:mc(Dc),moduleKeyword:mc(Dc),operator:xc,derefOperator:mc(xc),arithmeticOperator:mc(xc),logicOperator:mc(xc),bitwiseOperator:mc(xc),compareOperator:mc(xc),updateOperator:mc(xc),definitionOperator:mc(xc),typeOperator:mc(xc),controlOperator:mc(xc),punctuation:Fc,separator:mc(Fc),bracket:Rc,angleBracket:mc(Rc),squareBracket:mc(Rc),paren:mc(Rc),brace:mc(Rc),content:Sc,heading:vc,heading1:mc(vc),heading2:mc(vc),heading3:mc(vc),heading4:mc(vc),heading5:mc(vc),heading6:mc(vc),contentSeparator:mc(Sc),list:mc(Sc),quote:mc(Sc),emphasis:mc(Sc),strong:mc(Sc),link:mc(Sc),monospace:mc(Sc),strikethrough:mc(Sc),inserted:mc(),deleted:mc(),changed:mc(),invalid:mc(),meta:Mc,documentMeta:mc(Mc),annotation:mc(Mc),processingInstruction:mc(Mc),definition:lc.defineModifier("definition"),constant:lc.defineModifier("constant"),function:lc.defineModifier("function"),standard:lc.defineModifier("standard"),local:lc.defineModifier("local"),special:lc.defineModifier("special")};for(let e in Nc){let t=Nc[e];t instanceof lc&&(t.name=e)}var Gc;fc([{tag:Nc.link,class:"tok-link"},{tag:Nc.heading,class:"tok-heading"},{tag:Nc.emphasis,class:"tok-emphasis"},{tag:Nc.strong,class:"tok-strong"},{tag:Nc.keyword,class:"tok-keyword"},{tag:Nc.atom,class:"tok-atom"},{tag:Nc.bool,class:"tok-bool"},{tag:Nc.url,class:"tok-url"},{tag:Nc.labelName,class:"tok-labelName"},{tag:Nc.inserted,class:"tok-inserted"},{tag:Nc.deleted,class:"tok-deleted"},{tag:Nc.literal,class:"tok-literal"},{tag:Nc.string,class:"tok-string"},{tag:Nc.number,class:"tok-number"},{tag:[Nc.regexp,Nc.escape,Nc.special(Nc.string)],class:"tok-string2"},{tag:Nc.variableName,class:"tok-variableName"},{tag:Nc.local(Nc.variableName),class:"tok-variableName tok-local"},{tag:Nc.definition(Nc.variableName),class:"tok-variableName tok-definition"},{tag:Nc.special(Nc.variableName),class:"tok-variableName2"},{tag:Nc.definition(Nc.propertyName),class:"tok-propertyName tok-definition"},{tag:Nc.typeName,class:"tok-typeName"},{tag:Nc.namespace,class:"tok-namespace"},{tag:Nc.className,class:"tok-className"},{tag:Nc.macroName,class:"tok-macroName"},{tag:Nc.propertyName,class:"tok-propertyName"},{tag:Nc.operator,class:"tok-operator"},{tag:Nc.comment,class:"tok-comment"},{tag:Nc.meta,class:"tok-meta"},{tag:Nc.invalid,class:"tok-invalid"},{tag:Nc.punctuation,class:"tok-punctuation"}]);const Uc=new NA,Lc=new NA;class Tc{constructor(e,t,i=[],n=""){this.data=e,this.name=n,It.prototype.hasOwnProperty("tree")||Object.defineProperty(It.prototype,"tree",{get(){return qc(this)}}),this.parser=t,this.extension=[Xc.of(this),It.languageData.of(((e,t,i)=>{let n=Hc(e,t,i),s=n.type.prop(Uc);if(!s)return[];let a=e.facet(s),r=n.type.prop(Lc);if(r){let s=n.resolve(t-n.from,i);for(let t of r)if(t.test(s,e)){let i=e.facet(t.facet);return"replace"==t.type?i:i.concat(a)}}return a}))].concat(i)}isActiveAt(e,t,i=-1){return Hc(e,t,i).type.prop(Uc)==this.data}findRegions(e){let t=e.facet(Xc);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],n=(e,t)=>{if(e.prop(Uc)==this.data)return void i.push({from:t,to:t+e.length});let s=e.prop(NA.mounted);if(s){if(s.tree.prop(Uc)==this.data){if(s.overlay)for(let e of s.overlay)i.push({from:e.from+t,to:e.to+t});else i.push({from:t,to:t+e.length});return}if(s.overlay){let e=i.length;if(n(s.tree,s.overlay[0].from+t),i.length>e)return}}for(let i=0;ie.concat(i):void 0}));var i;return new Oc(t,e.parser.configure({props:[Uc.add((e=>e.isTop?t:void 0))]}),e.name)}configure(e,t){return new Oc(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function qc(e){let t=e.field(Tc.state,!1);return t?t.tree:JA.empty}class Jc{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Pc=null;class Yc{constructor(e,t,i=[],n,s,a,r,o){this.parser=e,this.state=t,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=a,this.skipped=r,this.scheduleOn=o,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Yc(e,t,[],JA.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Jc(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=JA.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var i;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(rc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Pc;Pc=this;try{return e()}finally{Pc=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Kc(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:n,treeLen:s,viewport:a,skipped:r}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,i,n,s)=>t.push({fromA:e,toA:i,fromB:n,toB:s}))),i=rc.applyChanges(i,t),n=JA.empty,s=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){r=[];for(let t of this.skipped){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);ie.from&&(this.fragments=Kc(this.fragments,i,n),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends oc{createParse(t,i,n){let s=n[0].from,a=n[n.length-1].to;return{parsedPos:s,advance(){let t=Pc;if(t){for(let e of n)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new JA(LA.none,[],[],a-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Pc}}function Kc(e,t,i){return rc.applyChanges(e,[{fromA:t,toA:i,fromB:t,toB:i}])}class Vc{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Vc(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Yc.create(e.facet(Xc).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Vc(i)}}Tc.state=He.define({create:Vc.init,update(e,t){for(let e of t.effects)if(e.is(Tc.setState))return e.value;return t.startState.facet(Xc)!=t.state.facet(Xc)?Vc.init(t.state):e.apply(t)}});let Wc=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(Wc=e=>{let t=-1,i=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(i):cancelIdleCallback(t)});const jc="undefined"!=typeof navigator&&(null===(Gc=navigator.scheduling)||void 0===Gc?void 0:Gc.isInputPending)?()=>navigator.scheduling.isInputPending():null,_c=Kn.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Tc.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Tc.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Wc(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndn+1e3,o=s.context.work((()=>jc&&jc()||Date.now()>a),n+(r?0:1e5));this.chunkBudget-=Date.now()-t,(o||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Tc.setState.of(new Vc(s.context))})),this.chunkBudget>0&&(!o||r)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>qn(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Xc=Re.define({combine:e=>e.length?e[0]:null,enables:e=>[Tc.state,_c,Pa.contentAttributes.compute([e],(t=>{let i=t.facet(e);return i&&i.name?{"data-language":i.name}:{}}))]});class Zc{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const zc=Re.define(),$c=Re.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function el(e){let t=e.facet($c);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function tl(e,t){let i="",n=e.tabSize,s=e.facet($c)[0];if("\t"==s){for(;t>=n;)i+="\t",t-=n;s=" "}for(let e=0;e=t?function(e,t,i){let n=t.resolveStack(i),s=t.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(s!=n.node){let e=[];for(let t=s;t&&(t.from!=n.node.from||t.type!=n.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)n={node:e[t],next:n}}return al(n,e,i)}(e,i,t):null}class nl{constructor(e,t={}){this.state=e,this.options=t,this.unit=el(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return null!=n&&n>=i.from&&n<=i.to?s&&n==e?{text:"",from:e}:(t<0?n-1&&(s+=a-this.countColumn(i,i.search(/\S|$/))),s}countColumn(e,t=e.length){return Mt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:n}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let e=s(n);if(e>-1)return e}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const sl=new NA;function al(e,t,i){for(let n=e;n;n=n.next){let e=rl(n.node);if(e)return e(Al.create(t,i,n))}return 0}function rl(e){let t=e.type.prop(sl);if(t)return t;let i,n=e.firstChild;if(n&&(i=n.type.prop(NA.closedBy))){let t=e.lastChild,n=t&&i.indexOf(t.name)>-1;return e=>function(e,t,i,n,s){let a=e.textAfter.match(/^\s*/)[0].length,r=s==e.pos+a,o=function(e){let t=e.node,i=t.childAfter(t.from),n=t.lastChild;if(!i)return null;let s=e.options.simulateBreak,a=e.state.doc.lineAt(i.from),r=null==s||s<=a.from?a.to:Math.min(a.to,s);for(let e=i.to;;){let s=t.childAfter(e);if(!s||s==n)return null;if(!s.type.isSkipped){if(s.from>=r)return null;let e=/^ */.exec(a.text.slice(i.to-a.from))[0].length;return{from:i.from,to:i.to+e}}e=s.to}}(e);return o?r?e.column(o.from):e.column(o.to):e.baseIndent+(r?0:1*e.unit)}(e,0,0,0,n&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?ol:null}function ol(){return 0}class Al extends nl{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Al(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(cl(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return al(this.context.next,this.base,this.pos)}}function cl(e,t){for(let i=t;i;i=i.parent)if(e==i)return!0;return!1}function ll({except:e,units:t=1}={}){return i=>{let n=e&&e.test(i.textAfter);return i.baseIndent+(n?0:t*i.unit)}}function gl(){return It.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let i=e.newDoc,{head:n}=e.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return e;let a=i.sliceString(s.from,n);if(!t.some((e=>e.test(a))))return e;let{state:r}=e,o=-1,A=[];for(let{head:e}of r.selection.ranges){let t=r.doc.lineAt(e);if(t.from==o)continue;o=t.from;let i=il(r,t.from);if(null==i)continue;let n=/^\s*/.exec(t.text)[0],s=tl(r,i);n!=s&&A.push({from:t.from,to:t.from+n.length,insert:s})}return A.length?[e,{changes:A,sequential:!0}]:e}))}const hl=Re.define(),dl=new NA;function ul(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function Il(e,t,i){for(let n of e.facet(hl)){let s=n(e,t,i);if(s)return s}return function(e,t,i){let n=qc(e);if(n.lengthi)continue;if(s&&r.from=t&&n.to>i&&(s=n)}}return s}(e,t,i)}function fl(e,t){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);return i>=n?void 0:{from:i,to:n}}const Cl=st.define({map:fl}),pl=st.define({map:fl}),ml=He.define({create:()=>ji.none,update(e,t){e=e.map(t.changes);for(let i of t.effects)if(i.is(Cl)&&!Ql(e,i.value.from,i.value.to)){let{preparePlaceholder:n}=t.state.facet(bl),s=n?ji.replace({widget:new kl(n(t.state,i.value))}):wl;e=e.update({add:[s.range(i.value.from,i.value.to)]})}else i.is(pl)&&(e=e.update({filter:(e,t)=>i.value.from!=e||i.value.to!=t,filterFrom:i.value.from,filterTo:i.value.to}));if(t.selection){let i=!1,{head:n}=t.selection.main;e.between(n,n,((e,t)=>{en&&(i=!0)})),i&&(e=e.update({filterFrom:n,filterTo:n,filter:(e,t)=>t<=n||e>=n}))}return e},provide:e=>Pa.decorations.from(e),toJSON(e,t){let i=[];return e.between(0,t.doc.length,((e,t)=>{i.push(e,t)})),i},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let i=0;i{(!s||s.from>e)&&(s={from:e,to:t})})),s}function Ql(e,t,i){let n=!1;return e.between(t,t,((e,s)=>{e==t&&s==i&&(n=!0)})),n}const El={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bl=Re.define({combine:e=>ft(e,El)});function yl(e,t){let{state:i}=e,n=i.facet(bl),s=t=>{let i=e.lineBlockAt(e.posAtDOM(t.target)),n=Bl(e.state,i.from,i.to);n&&e.dispatch({effects:pl.of(n)}),t.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(e,s,t);let a=document.createElement("span");return a.textContent=n.placeholderText,a.setAttribute("aria-label",i.phrase("folded code")),a.title=i.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=s,a}const wl=ji.replace({widget:new class extends Vi{toDOM(e){return yl(e,null)}}});class kl extends Vi{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return yl(e,this.value)}}const Sl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends so{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Dl(e={}){let t=Object.assign(Object.assign({},Sl),e),i=new vl(t,!0),n=new vl(t,!1),s=Kn.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(Xc)!=e.state.facet(Xc)||e.startState.field(ml,!1)!=e.state.field(ml,!1)||qc(e.startState)!=qc(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new Et;for(let s of e.viewportLineBlocks){let a=Bl(e.state,s.from,s.to)?n:Il(e.state,s.from,s.to)?i:null;a&&t.add(s.from,s.from,a)}return t.finish()}}),{domEventHandlers:a}=t;return[s,co({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(s))||void 0===t?void 0:t.markers)||Qt.empty},initialSpacer:()=>new vl(t,!1),domEventHandlers:Object.assign(Object.assign({},a),{click:(e,t,i)=>{if(a.click&&a.click(e,t,i))return!0;let n=Bl(e.state,t.from,t.to);if(n)return e.dispatch({effects:pl.of(n)}),!0;let s=Il(e.state,t.from,t.to);return!!s&&(e.dispatch({effects:Cl.of(s)}),!0)}})}),[ml,xl]]}const xl=Pa.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Fl{constructor(e,t){let i;function n(e){let t=Tt.newName();return(i||(i=Object.create(null)))["."+t]=e,t}this.specs=e;const s="string"==typeof t.all?t.all:t.all?n(t.all):void 0,a=t.scope;this.scope=a instanceof Tc?e=>e.prop(Uc)==a.data:a?e=>e==a:void 0,this.style=fc(e.map((e=>({tag:e.tag,class:e.class||n(Object.assign({},e,{tag:null}))}))),{all:s}).style,this.module=i?new Tt(i):null,this.themeType=t.themeType}static define(e,t){return new Fl(e,t||{})}}const Rl=Re.define(),Ml=Re.define({combine:e=>e.length?[e[0]]:null});function Nl(e){let t=e.facet(Rl);return t.length?t:e.facet(Ml)}function Gl(e,t){let i,n=[Ul];return e instanceof Fl&&(e.module&&n.push(Pa.styleModule.of(e.module)),i=e.themeType),(null==t?void 0:t.fallback)?n.push(Ml.of(e)):i?n.push(Rl.computeN([Pa.darkTheme],(t=>t.facet(Pa.darkTheme)==("dark"==i)?[e]:[]))):n.push(Rl.of(e)),n}const Ul=qe.high(Kn.fromClass(class{constructor(e){this.markCache=Object.create(null),this.tree=qc(e.state),this.decorations=this.buildDeco(e,Nl(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=qc(e.state),i=Nl(e.state),n=i!=Nl(e.startState),{viewport:s}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return ji.none;let i=new Et;for(let{from:n,to:s}of e.visibleRanges)Cc(this.tree,t,((e,t,n)=>{i.add(e,t,this.markCache[n]||(this.markCache[n]=ji.mark({class:n})))}),n,s);return i.finish()}},{decorations:e=>e.decorations})),Ll=Fl.define([{tag:Nc.meta,color:"#404740"},{tag:Nc.link,textDecoration:"underline"},{tag:Nc.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Nc.emphasis,fontStyle:"italic"},{tag:Nc.strong,fontWeight:"bold"},{tag:Nc.strikethrough,textDecoration:"line-through"},{tag:Nc.keyword,color:"#708"},{tag:[Nc.atom,Nc.bool,Nc.url,Nc.contentSeparator,Nc.labelName],color:"#219"},{tag:[Nc.literal,Nc.inserted],color:"#164"},{tag:[Nc.string,Nc.deleted],color:"#a11"},{tag:[Nc.regexp,Nc.escape,Nc.special(Nc.string)],color:"#e40"},{tag:Nc.definition(Nc.variableName),color:"#00f"},{tag:Nc.local(Nc.variableName),color:"#30a"},{tag:[Nc.typeName,Nc.namespace],color:"#085"},{tag:Nc.className,color:"#167"},{tag:[Nc.special(Nc.variableName),Nc.macroName],color:"#256"},{tag:Nc.definition(Nc.propertyName),color:"#00c"},{tag:Nc.comment,color:"#940"},{tag:Nc.invalid,color:"#f00"}]),Tl=Pa.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Hl="()[]{}",Ol=Re.define({combine:e=>ft(e,{afterCursor:!0,brackets:Hl,maxScanDistance:1e4,renderMatch:Pl})}),ql=ji.mark({class:"cm-matchingBracket"}),Jl=ji.mark({class:"cm-nonmatchingBracket"});function Pl(e){let t=[],i=e.matched?ql:Jl;return t.push(i.range(e.start.from,e.start.to)),e.end&&t.push(i.range(e.end.from,e.end.to)),t}const Yl=He.define({create:()=>ji.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let i=[],n=t.state.facet(Ol);for(let e of t.state.selection.ranges){if(!e.empty)continue;let s=Xl(t.state,e.head,-1,n)||e.head>0&&Xl(t.state,e.head-1,1,n)||n.afterCursor&&(Xl(t.state,e.head,1,n)||e.headPa.decorations.from(e)}),Kl=[Yl,Tl];function Vl(e={}){return[Ol.of(e),Kl]}const Wl=new NA;function jl(e,t,i){let n=e.prop(t<0?NA.openedBy:NA.closedBy);if(n)return n;if(1==e.name.length){let n=i.indexOf(e.name);if(n>-1&&n%2==(t<0?1:0))return[i[n+t]]}return null}function _l(e){let t=e.type.prop(Wl);return t?t(e.node):e}function Xl(e,t,i,n={}){let s=n.maxScanDistance||1e4,a=n.brackets||Hl,r=qc(e),o=r.resolveInner(t,i);for(let n=o;n;n=n.parent){let s=jl(n.type,i,a);if(s&&n.from0?t>=r.from&&tr.from&&t<=r.to))return Zl(e,t,i,n,r,s,a)}}return function(e,t,i,n,s,a,r){let o=i<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),A=r.indexOf(o);if(A<0||A%2==0!=i>0)return null;let c={from:i<0?t-1:t,to:i>0?t+1:t},l=e.doc.iterRange(t,i>0?e.doc.length:0),g=0;for(let e=0;!l.next().done&&e<=a;){let a=l.value;i<0&&(e+=a.length);let o=t+e*i;for(let e=i>0?0:a.length-1,t=i>0?a.length:-1;e!=t;e+=i){let t=r.indexOf(a[e]);if(!(t<0||n.resolveInner(o+e,1).type!=s))if(t%2==0==i>0)g++;else{if(1==g)return{start:c,end:{from:o+e,to:o+e+1},matched:t>>1==A>>1};g--}}i>0&&(e+=a.length)}return l.done?{start:c,matched:!1}:null}(e,t,i,r,o.type,s,a)}function Zl(e,t,i,n,s,a,r){let o=n.parent,A={from:s.from,to:s.to},c=0,l=null==o?void 0:o.cursor();if(l&&(i<0?l.childBefore(n.from):l.childAfter(n.to)))do{if(i<0?l.to<=n.from:l.from>=n.to){if(0==c&&a.indexOf(l.type.name)>-1&&l.from-1||(eg.push(e),console.warn(t))}function sg(e,t){let i=[];for(let n of t.split(" ")){let t=[];for(let i of n.split(".")){let n=e[i]||Nc[i];n?"function"==typeof n?t.length?t=t.map(n):ng(i,`Modifier ${i} used at start of tag`):t.length?ng(i,`Tag ${i} used as modifier`):t=Array.isArray(n)?n:[n]:ng(i,`Unknown highlighting tag ${i}`)}for(let e of t)i.push(e)}if(!i.length)return 0;let n=t.replace(/ /g,"_"),s=n+" "+i.map((e=>e.id)),a=tg[s];if(a)return a.id;let r=tg[s]=LA.define({id:$l.length,name:n,props:[dc({[n]:i})]});return $l.push(r),r.id}function ag(e,t){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=e(t,i);return!!s&&(n(i.update(s)),!0)}}on.RTL,on.LTR;const rg=ag((function(e,t,i=t.selection.ranges){let n=[],s=-1;for(let{from:e,to:a}of i){let i=n.length,r=1e9,o=cg(t,e).line;if(o){for(let i=e;i<=a;){let A=t.doc.lineAt(i);if(A.from>s&&(e==a||a>A.from)){s=A.from;let e=/^\s*/.exec(A.text)[0].length,t=e==A.length,i=A.text.slice(e,e+o.length)==o?e:-1;ee.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:i,indent:s,empty:a,single:r}of n)!r&&a||e.push({from:t.from+s,insert:i+" "});let i=t.changes(e);return{changes:i,selection:t.selection.map(i,1)}}if(1!=e&&n.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:i,token:s}of n)if(i>=0){let n=t.from+i,a=n+s.length;" "==t.text[a-t.from]&&a++,e.push({from:n,to:a})}return{changes:e}}return null}),0),og=ag(gg,0),Ag=ag(((e,t)=>gg(e,t,function(e){let t=[];for(let i of e.selection.ranges){let n=e.doc.lineAt(i.from),s=i.to<=n.to?n:e.doc.lineAt(i.to);s.from>n.from&&s.from==i.to&&(s=i.to==n.to+1?n:e.doc.lineAt(i.to-1));let a=t.length-1;a>=0&&t[a].to>n.from?t[a].to=s.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return t}(t))),0);function cg(e,t){let i=e.languageDataAt("commentTokens",t);return i.length?i[0]:{}}const lg=50;function gg(e,t,i=t.selection.ranges){let n=i.map((e=>cg(t,e.from).block));if(!n.every((e=>e)))return null;let s=i.map(((e,i)=>function(e,{open:t,close:i},n,s){let a,r,o=e.sliceDoc(n-lg,n),A=e.sliceDoc(s,s+lg),c=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(A)[0].length,g=o.length-c;if(o.slice(g-t.length,g)==t&&A.slice(l,l+i.length)==i)return{open:{pos:n-c,margin:c&&1},close:{pos:s+l,margin:l&&1}};s-n<=2*lg?a=r=e.sliceDoc(n,s):(a=e.sliceDoc(n,n+lg),r=e.sliceDoc(s-lg,s));let h=/^\s*/.exec(a)[0].length,d=/\s*$/.exec(r)[0].length,u=r.length-d-i.length;return a.slice(h,h+t.length)==t&&r.slice(u,u+i.length)==i?{open:{pos:n+h+t.length,margin:/\s/.test(a.charAt(h+t.length))?1:0},close:{pos:s-d-i.length,margin:/\s/.test(r.charAt(u-1))?1:0}}:null}(t,n[i],e.from,e.to)));if(2!=e&&!s.every((e=>e)))return{changes:t.changes(i.map(((e,t)=>s[t]?[]:[{from:e.from,insert:n[t].open+" "},{from:e.to,insert:" "+n[t].close}])))};if(1!=e&&s.some((e=>e))){let e=[];for(let t,i=0;ift(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,n)=>e(i,n)||t(i,n)})}),fg=He.define({create:()=>Mg.empty,update(e,t){let i=t.state.facet(Ig),n=t.annotation(hg);if(n){let s=bg.fromTransaction(t,n.selection),a=n.side,r=0==a?e.undone:e.done;return r=s?yg(r,r.length,i.minDepth,s):vg(r,t.startState.selection),new Mg(0==a?n.rest:r,0==a?r:n.rest)}let s=t.annotation(dg);if("full"!=s&&"before"!=s||(e=e.isolate()),!1===t.annotation(at.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let a=bg.fromTransaction(t),r=t.annotation(at.time),o=t.annotation(at.userEvent);return a?e=e.addChanges(a,r,o,i,t):t.selection&&(e=e.addSelection(t.startState.selection,r,o,i.newGroupDelay)),"full"!=s&&"after"!=s||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new Mg(e.done.map(bg.fromJSON),e.undone.map(bg.fromJSON))});function Cg(e={}){return[fg,Ig.of(e),Pa.domEventHandlers({beforeinput(e,t){let i="historyUndo"==e.inputType?mg:"historyRedo"==e.inputType?Bg:null;return!!i&&(e.preventDefault(),i(t))}})]}function pg(e,t){return function({state:i,dispatch:n}){if(!t&&i.readOnly)return!1;let s=i.field(fg,!1);if(!s)return!1;let a=s.pop(e,i,t);return!!a&&(n(a),!0)}}const mg=pg(0,!1),Bg=pg(1,!1),Qg=pg(0,!0),Eg=pg(1,!0);class bg{constructor(e,t,i,n,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(e){return new bg(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new bg(e.changes&&Qe.fromJSON(e.changes),[],e.mapped&&Be.fromJSON(e.mapped),e.startSelection&&De.fromJSON(e.startSelection),e.selectionsAfter.map(De.fromJSON))}static fromTransaction(e,t){let i=kg;for(let t of e.startState.facet(ug)){let n=t(e);n.length&&(i=i.concat(n))}return!i.length&&e.changes.empty?null:new bg(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,kg)}static selection(e){return new bg(void 0,kg,void 0,void 0,e)}}function yg(e,t,i,n){let s=t+1>i+20?t-i-1:0,a=e.slice(s,t);return a.push(n),a}function wg(e,t){return e.length?t.length?e.concat(t):e:t}const kg=[],Sg=200;function vg(e,t){if(e.length){let i=e[e.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Sg));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),yg(e,e.length-1,1e9,i.setSelAfter(n)))}return[bg.selection([t])]}function Dg(e){let t=e[e.length-1],i=e.slice();return i[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),i}function xg(e,t){if(!e.length)return e;let i=e.length,n=kg;for(;i;){let s=Fg(e[i-1],t,n);if(s.changes&&!s.changes.empty||s.effects.length){let t=e.slice(0,i);return t[i-1]=s,t}t=s.mapped,i--,n=s.selectionsAfter}return n.length?[bg.selection(n)]:kg}function Fg(e,t,i){let n=wg(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):kg,i);if(!e.changes)return bg.selection(n);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),r=e.mapped?e.mapped.composeDesc(a):a;return new bg(s,st.mapEffects(e.effects,t),r,e.startSelection.map(a),n)}const Rg=/^(input\.type|delete)($|\.)/;class Mg{constructor(e,t,i=0,n=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new Mg(this.done,this.undone):this}addChanges(e,t,i,n,s){let a=this.done,r=a[a.length-1];return a=r&&r.changes&&!r.changes.empty&&e.changes&&(!i||Rg.test(i))&&(!r.selectionsAfter.length&&t-this.prevTimei.push(e,t))),t.iterChangedRanges(((e,t,s,a)=>{for(let e=0;e=t&&s<=r&&(n=!0)}})),n}(r.changes,e.changes))||"input.type.compose"==i)?yg(a,a.length-1,n.minDepth,new bg(e.changes.compose(r.changes),wg(st.mapEffects(e.effects,r.changes),r.effects),r.mapped,r.startSelection,kg)):yg(a,a.length,n.minDepth,e),new Mg(a,kg,t,i)}addSelection(e,t,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:kg;return s.length>0&&t-this.prevTimee.empty!=r.ranges[t].empty)).length)?this:new Mg(vg(this.done,e),this.undone,t,i);var a,r}addMapping(e){return new Mg(xg(this.done,e),xg(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let n=0==e?this.done:this.undone;if(0==n.length)return null;let s=n[n.length-1],a=s.selectionsAfter[0]||t.selection;if(i&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:hg.of({side:e,rest:Dg(n),selection:a}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?kg:n.slice(0,n.length-1);return s.mapped&&(i=xg(i,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:hg.of({side:e,rest:i,selection:a}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}Mg.empty=new Mg(kg,kg);const Ng=[{key:"Mod-z",run:mg,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Bg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Bg,preventDefault:!0},{key:"Mod-u",run:Qg,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Eg,preventDefault:!0}];function Gg(e,t){return De.create(e.ranges.map(t),e.mainIndex)}function Ug(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Lg({state:e,dispatch:t},i){let n=Gg(e.selection,i);return!n.eq(e.selection,!0)&&(t(Ug(e,n)),!0)}function Tg(e,t){return De.cursor(t?e.to:e.from)}function Hg(e,t){return Lg(e,(i=>i.empty?e.moveByChar(i,t):Tg(i,t)))}function Og(e){return e.textDirectionAt(e.state.selection.main.head)==on.LTR}const qg=e=>Hg(e,!Og(e)),Jg=e=>Hg(e,Og(e));function Pg(e,t){return Lg(e,(i=>i.empty?e.moveByGroup(i,t):Tg(i,t)))}function Yg(e,t,i){if(t.type.prop(i))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Kg(e,t,i){let n,s,a=qc(e).resolveInner(t.head),r=i?NA.closedBy:NA.openedBy;for(let n=t.head;;){let t=i?a.childAfter(n):a.childBefore(n);if(!t)break;Yg(e,t,r)?a=t:n=i?t.to:t.from}return s=a.type.prop(r)&&(n=i?Xl(e,a.from,1):Xl(e,a.to,-1))&&n.matched?i?n.end.to:n.end.from:i?a.to:a.from,De.cursor(s,i?-1:1)}function Vg(e,t){return Lg(e,(i=>{if(!i.empty)return Tg(i,t);let n=e.moveVertically(i,t);return n.head!=i.head?n:e.moveToLineBoundary(i,t)}))}const Wg=e=>Vg(e,!1),jg=e=>Vg(e,!0);function _g(e){let t,i=e.scrollDOM.clientHeighti.empty?e.moveVertically(i,t,n.height):Tg(i,t)));if(a.eq(s.selection))return!1;if(n.selfScroll){let t=e.coordsAtPos(s.selection.main.head),r=e.scrollDOM.getBoundingClientRect(),o=r.top+n.marginTop,A=r.bottom-n.marginBottom;t&&t.top>o&&t.bottomXg(e,!1),zg=e=>Xg(e,!0);function $g(e,t,i){let n=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,i);if(s.head==t.head&&s.head!=(i?n.to:n.from)&&(s=e.moveToLineBoundary(t,i,!1)),!i&&s.head==n.from&&n.length){let i=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&t.head!=n.from+i&&(s=De.cursor(n.from+i))}return s}function eh(e,t){let i=Gg(e.state.selection,(e=>{let i=t(e);return De.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(e.state.selection)&&(e.dispatch(Ug(e.state,i)),!0)}function th(e,t){return eh(e,(i=>e.moveByChar(i,t)))}const ih=e=>th(e,!Og(e)),nh=e=>th(e,Og(e));function sh(e,t){return eh(e,(i=>e.moveByGroup(i,t)))}function ah(e,t){return eh(e,(i=>e.moveVertically(i,t)))}const rh=e=>ah(e,!1),oh=e=>ah(e,!0);function Ah(e,t){return eh(e,(i=>e.moveVertically(i,t,_g(e).height)))}const ch=e=>Ah(e,!1),lh=e=>Ah(e,!0),gh=({state:e,dispatch:t})=>(t(Ug(e,{anchor:0})),!0),hh=({state:e,dispatch:t})=>(t(Ug(e,{anchor:e.doc.length})),!0),dh=({state:e,dispatch:t})=>(t(Ug(e,{anchor:e.selection.main.anchor,head:0})),!0),uh=({state:e,dispatch:t})=>(t(Ug(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function Ih(e,t){if(e.state.readOnly)return!1;let i="delete.selection",{state:n}=e,s=n.changeByRange((n=>{let{from:s,to:a}=n;if(s==a){let r=t(n);rs&&(i="delete.forward",r=fh(e,r,!0)),s=Math.min(s,r),a=Math.max(a,r)}else s=fh(e,s,!1),a=fh(e,a,!0);return s==a?{range:n}:{changes:{from:s,to:a},range:De.cursor(s,st(e))))n.between(t,t,((e,n)=>{et&&(t=i?n:e)}));return t}const Ch=(e,t,i)=>Ih(e,(n=>{let s,a,r=n.from,{state:o}=e,A=o.doc.lineAt(r);if(i&&!t&&r>A.from&&rCh(e,!1,!0),mh=e=>Ch(e,!0,!1),Bh=(e,t)=>Ih(e,(i=>{let n=i.head,{state:s}=e,a=s.doc.lineAt(n),r=s.charCategorizer(n);for(let e=null;;){if(n==(t?a.to:a.from)){n==i.head&&a.number!=(t?s.doc.lines:1)&&(n+=t?1:-1);break}let o=ue(a.text,n-a.from,t)+a.from,A=a.text.slice(Math.min(n,o)-a.from,Math.max(n,o)-a.from),c=r(A);if(null!=e&&c!=e)break;" "==A&&n==i.head||(e=c),n=o}return n})),Qh=e=>Bh(e,!1);function Eh(e){let t=[],i=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),a=e.doc.lineAt(n.to);if(n.empty||n.to!=a.from||(a=e.doc.lineAt(n.to-1)),i>=s.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(n)}else t.push({from:s.from,to:a.to,ranges:[n]});i=a.number+1}return t}function bh(e,t,i){if(e.readOnly)return!1;let n=[],s=[];for(let t of Eh(e)){if(i?t.to==e.doc.length:0==t.from)continue;let a=e.doc.lineAt(i?t.to+1:t.from-1),r=a.length+1;if(i){n.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let i of t.ranges)s.push(De.range(Math.min(e.doc.length,i.anchor+r),Math.min(e.doc.length,i.head+r)))}else{n.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)s.push(De.range(e.anchor-r,e.head-r))}}return!!n.length&&(t(e.update({changes:n,scrollIntoView:!0,selection:De.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0)}function yh(e,t,i){if(e.readOnly)return!1;let n=[];for(let t of Eh(e))i?n.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):n.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const wh=kh(!1);function kh(e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let n=t.changeByRange((i=>{let{from:n,to:s}=i,a=t.doc.lineAt(n),r=!e&&n==s&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let i,n=qc(e).resolveInner(t),s=n.childBefore(t),a=n.childAfter(t);return s&&a&&s.to<=t&&a.from>=t&&(i=s.type.prop(NA.closedBy))&&i.indexOf(a.name)>-1&&e.doc.lineAt(s.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(s.to,a.from))?{from:s.to,to:a.from}:null}(t,n);e&&(n=s=(s<=a.to?a:t.doc.lineAt(s)).to);let o=new nl(t,{simulateBreak:n,simulateDoubleBreak:!!r}),A=il(o,n);for(null==A&&(A=Mt(/^\s*/.exec(t.doc.lineAt(n).text)[0],t.tabSize));sa.from&&n{let s=[];for(let a=n.from;a<=n.to;){let r=e.doc.lineAt(a);r.number>i&&(n.empty||n.to>r.from)&&(t(r,s,n),i=r.number),a=r.to+1}let a=e.changes(s);return{changes:s,range:De.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}}))}const vh=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Sh(e,((t,i)=>{i.push({from:t.from,insert:e.facet($c)})})),{userEvent:"input.indent"})),!0),Dh=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Sh(e,((t,i)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let s=Mt(n,e.tabSize),a=0,r=tl(e,Math.max(0,s-el(e)));for(;aLg(e,(t=>Kg(e.state,t,!Og(e)))),shift:e=>eh(e,(t=>Kg(e.state,t,!Og(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>Lg(e,(t=>Kg(e.state,t,Og(e)))),shift:e=>eh(e,(t=>Kg(e.state,t,Og(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>bh(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>yh(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>bh(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>yh(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let i=e.selection,n=null;return i.ranges.length>1?n=De.create([i.main]):i.main.empty||(n=De.create([De.cursor(i.main.head)])),!!n&&(t(Ug(e,n)),!0)}},{key:"Mod-Enter",run:kh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let i=Eh(e).map((({from:t,to:i})=>De.range(t,Math.min(i+1,e.doc.length))));return t(e.update({selection:De.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let i=Gg(e.selection,(t=>{let i=qc(e),n=i.resolveStack(t.from,1);if(t.empty){let e=i.resolveStack(t.from,-1);e.node.from>=n.node.from&&e.node.to<=n.node.to&&(n=e)}for(let e=n;e;e=e.next){let{node:i}=e;if((i.from=t.to||i.to>t.to&&i.from<=t.from)&&e.next)return De.range(i.to,i.from)}return t}));return!i.eq(e.selection)&&(t(Ug(e,i)),!0)},preventDefault:!0},{key:"Mod-[",run:Dh},{key:"Mod-]",run:vh},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=Object.create(null),n=new nl(e,{overrideIndentation:e=>{let t=i[e];return null==t?-1:t}}),s=Sh(e,((t,s,a)=>{let r=il(n,t.from);if(null==r)return;/\S/.test(t.text)||(r=0);let o=/^\s*/.exec(t.text)[0],A=tl(e,r);(o!=A||a.from{if(e.state.readOnly)return!1;let{state:t}=e,i=t.changes(Eh(t).map((({from:e,to:i})=>(e>0?e--:i{let i;if(e.lineWrapping){let n=e.lineBlockAt(t.head),s=e.coordsAtPos(t.head,t.assoc||1);s&&(i=n.bottom+e.documentTop-s.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,i)})).map(i);return e.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t){let i=!1,n=Gg(e.selection,(t=>{let n=Xl(e,t.head,-1)||Xl(e,t.head,1)||t.head>0&&Xl(e,t.head-1,1)||t.head{let{state:t}=e,i=t.doc.lineAt(t.selection.main.from),n=cg(e.state,i.from);return n.line?rg(e):!!n.block&&Ag(e)}},{key:"Alt-A",run:og},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:qg,shift:ih,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>Pg(e,!Og(e)),shift:e=>sh(e,!Og(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>Lg(e,(t=>$g(e,t,!Og(e)))),shift:e=>eh(e,(t=>$g(e,t,!Og(e)))),preventDefault:!0},{key:"ArrowRight",run:Jg,shift:nh,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>Pg(e,Og(e)),shift:e=>sh(e,Og(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>Lg(e,(t=>$g(e,t,Og(e)))),shift:e=>eh(e,(t=>$g(e,t,Og(e)))),preventDefault:!0},{key:"ArrowUp",run:Wg,shift:rh,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gh,shift:dh},{mac:"Ctrl-ArrowUp",run:Zg,shift:ch},{key:"ArrowDown",run:jg,shift:oh,preventDefault:!0},{mac:"Cmd-ArrowDown",run:hh,shift:uh},{mac:"Ctrl-ArrowDown",run:zg,shift:lh},{key:"PageUp",run:Zg,shift:ch},{key:"PageDown",run:zg,shift:lh},{key:"Home",run:e=>Lg(e,(t=>$g(e,t,!1))),shift:e=>eh(e,(t=>$g(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:gh,shift:dh},{key:"End",run:e=>Lg(e,(t=>$g(e,t,!0))),shift:e=>eh(e,(t=>$g(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:hh,shift:uh},{key:"Enter",run:wh,shift:wh},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:ph,shift:ph},{key:"Delete",run:mh},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Qh},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>Bh(e,!0)},{mac:"Mod-Backspace",run:e=>Ih(e,(t=>{let i=e.moveToLineBoundary(t,!1).head;return t.head>i?i:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>Ih(e,(t=>{let i=e.moveToLineBoundary(t,!0).head;return t.headLg(e,(t=>De.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>eh(e,(t=>De.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>Lg(e,(t=>De.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>eh(e,(t=>De.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:mh},{key:"Ctrl-h",run:ph},{key:"Ctrl-k",run:e=>Ih(e,(t=>{let i=e.lineBlockAt(t.head).to;return t.head{if(e.readOnly)return!1;let i=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:se.of(["",""])},range:De.cursor(e.from)})));return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let i=t.from,n=e.doc.lineAt(i),s=i==n.from?i-1:ue(n.text,i-n.from,!1)+n.from,a=i==n.to?i+1:ue(n.text,i-n.from,!0)+n.from;return{changes:{from:s,to:a,insert:e.doc.slice(i,a).append(e.doc.slice(s,i))},range:De.cursor(a)}}));return!i.changes.empty&&(t(e.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:zg}].map((e=>({mac:e.key,run:e.run,shift:e.shift}))))),Fh={key:"Tab",run:vh,shift:Dh};class Rh{constructor(e,t,i,n){this.state=e,this.pos=t,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=qc(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),n=t.text.slice(i-t.from,this.pos-t.from),s=n.search(Uh(e,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,i){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Mh(e){let t=Object.keys(e).join(""),i=/\w/.test(t);return i&&(t=t.replace(/\w/g,"")),`[${i?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class Nh{constructor(e,t,i,n){this.completion=e,this.source=t,this.match=i,this.score=n}}function Gh(e){return e.selection.main.from}function Uh(e,t){var i;let{source:n}=e,s=t&&"^"!=n[0],a="$"!=n[n.length-1];return s||a?new RegExp(`${s?"^":""}(?:${n})${a?"$":""}`,null!==(i=e.flags)&&void 0!==i?i:e.ignoreCase?"i":""):e}const Lh=tt.define(),Th=new WeakMap;function Hh(e){if(!Array.isArray(e))return e;let t=Th.get(e);return t||Th.set(e,t=function(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[i,n]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),i=Object.create(null);for(let{label:n}of e){t[n[0]]=!0;for(let e=1;e{let s=e.matchBefore(n);return s||e.explicit?{from:s?s.from:e.pos,options:t,validFor:i}:null}}(e)),t}const Oh=st.define(),qh=st.define();class Jh{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(p=fe(A))!=p.toLowerCase()?1:p!=p.toUpperCase()?2:0;(!n||1==m&&I||0==C&&0!=m)&&(t[l]==A||i[l]==A&&(g=!0)?a[l++]=n:a.length&&(f=!1)),C=m,n+=Ce(A)}return l==o&&0==a[0]&&f?this.result((g?-200:0)-100,a,e):h==o&&0==d?this.ret(-200-e.length+(u==e.length?0:-100),[0,u]):r>-1?this.ret(-700-e.length,[r,r+this.pattern.length]):h==o?this.ret(-900-e.length,[d,u]):l==o?this.result((g?-200:0)-100-700+(f?0:-1100),a,e):2==t.length?null:this.result((n[0]?-700:0)-200-1100,n,e)}result(e,t,i){let n=[],s=0;for(let e of t){let t=e+(this.astral?Ce(Ie(i,e)):1);s&&n[s-1]==e?n[s-1]=t:(n[s++]=e,n[s++]=t)}return this.ret(e-i.length,n)}}class Ph{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.lengthft(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Vh,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Kh(e(i),t(i)),optionClass:(e,t)=>i=>Kh(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function Kh(e,t){return e?t?e+" "+t:e:t}function Vh(e,t,i,n,s,a){let r,o,A=e.textDirection==on.RTL,c=A,l=!1,g="top",h=t.left-s.left,d=s.right-t.right,u=n.right-n.left,I=n.bottom-n.top;if(c&&h=I||e>t.top?r=i.bottom-t.top:(g="bottom",r=t.bottom-i.top)}return{style:`${g}: ${r/((t.bottom-t.top)/a.offsetHeight)}px; max-width: ${o/((t.right-t.left)/a.offsetWidth)}px`,class:"cm-completionInfo-"+(l?A?"left-narrow":"right-narrow":c?"left":"right")}}function Wh(e,t,i){if(e<=i)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/i);return{from:e*i,to:(e+1)*i}}let n=Math.floor((e-t)/i);return{from:e-(n+1)*i,to:e-n*i}}class jh{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:s,selected:a}=n.open,r=e.state.facet(Yh);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,i,n){let s=document.createElement("span");s.className="cm-completionLabel";let a=e.displayLabel||e.label,r=0;for(let e=0;er&&s.appendChild(document.createTextNode(a.slice(r,t)));let o=s.appendChild(document.createElement("span"));o.appendChild(document.createTextNode(a.slice(t,i))),o.className="cm-completionMatchedText",r=i}return re.position-t.position)).map((e=>e.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=Wh(s.length,a,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(i=>{let{options:n}=e.state.field(t).open;for(let t,s=i.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(t=/-(\d+)$/.exec(s.id))&&+t[1]{let i=e.state.field(this.stateField,!1);i&&i.tooltip&&e.state.facet(Yh).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:qh.of(null)})})),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let i=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=n){let{options:s,selected:a,disabled:r}=i.open;n.open&&n.open.options==s||(this.range=Wh(s.length,a,e.state.facet(Yh).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),r!=(null===(t=n.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!r)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=Wh(t.options.length,t.selected,this.view.state.facet(Yh).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:n}=i;if(!n)return;let s="string"==typeof n?document.createTextNode(n):n(i);if(!s)return;"then"in s?s.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)})).catch((e=>qn(this.view.state,e,"completion info"))):this.addInfoPane(s,i)}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",null!=e.nodeType)i.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:n}=e;i.appendChild(t),this.infoDestroy=n||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return t&&function(e,t){let i=e.getBoundingClientRect(),n=t.getBoundingClientRect(),s=i.height/e.offsetHeight;n.topi.bottom&&(e.scrollTop+=(n.bottom-i.bottom)/s)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),s=this.space;if(!s){let e=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return n.top>Math.min(s.bottom,t.bottom)-10||n.bottomi.from||0==i.from)&&(s=e,"string"!=typeof A&&A.header?n.appendChild(A.header(A)):n.appendChild(document.createElement("completion-section")).textContent=e)}const c=n.appendChild(document.createElement("li"));c.id=t+"-"+a,c.setAttribute("role","option");let l=this.optionClass(r);l&&(c.className=l);for(let e of this.optionContent){let t=e(r,this.view.state,this.view,o);t&&c.appendChild(t)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new Xh(this.options,ed(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,n,s,a){if(n&&!a&&e.some((e=>e.isPending)))return n.setDisabled();let r=function(e,t){let i=[],n=null,s=e=>{i.push(e);let{section:t}=e.completion;if(t){n||(n=[]);let e="string"==typeof t?t:t.name;n.some((t=>t.name==e))||n.push("string"==typeof t?{name:e}:t)}},a=t.facet(Yh);for(let n of e)if(n.hasResult()){let e=n.result.getMatch;if(!1===n.result.filter)for(let t of n.result.options)s(new Nh(t,n.source,e?e(t):[],1e9-i.length));else{let i,r=t.sliceDoc(n.from,n.to),o=a.filterStrict?new Ph(r):new Jh(r);for(let t of n.result.options)if(i=o.match(t.label)){let a=t.displayLabel?e?e(t,i.matched):[]:i.matched;s(new Nh(t,n.source,a,i.score+(t.boost||0)))}}}if(n){let e=Object.create(null),t=0,s=(e,t)=>{var i,n;return(null!==(i=e.rank)&&void 0!==i?i:1e9)-(null!==(n=t.rank)&&void 0!==n?n:1e9)||(e.namet.score-e.score||A(e.completion,t.completion)))){let t=e.completion;!o||o.label!=t.label||o.detail!=t.detail||null!=o.type&&null!=t.type&&o.type!=t.type||o.apply!=t.apply||o.boost!=t.boost?r.push(e):_h(e.completion)>_h(o)&&(r[r.length-1]=e),o=e.completion}return r}(e,t);if(!r.length)return n&&e.some((e=>e.isPending))?n.setDisabled():null;let o=t.facet(Yh).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let e=n.options[n.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e),1e8),create:cd,above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1)}map(e){return new Xh(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new Xh(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Zh{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Zh(td,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,i=t.facet(Yh),n=(i.override||t.languageDataAt("autocomplete",Gh(t)).map(Hh)).map((t=>(this.active.find((e=>e.source==t))||new nd(t,this.active.some((e=>0!=e.state))?1:0)).update(e,i)));n.length==this.active.length&&n.every(((e,t)=>e==this.active[t]))&&(n=this.active);let s=this.open,a=e.effects.some((e=>e.is(ad)));s&&e.docChanged&&(s=s.map(e.changes)),e.selection||n.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let i=0,n=0;;){for(;ie.isPending))&&(s=null),!s&&n.every((e=>!e.isPending))&&n.some((e=>e.hasResult()))&&(n=n.map((e=>e.hasResult()?new nd(e.source,0):e)));for(let t of e.effects)t.is(rd)&&(s=s&&s.setSelected(t.value,this.id));return n==this.active&&s==this.open?this:new Zh(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?zh:$h}}const zh={"aria-autocomplete":"list"},$h={};function ed(e,t){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(i["aria-activedescendant"]=e+"-"+t),i}const td=[];function id(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(Lh);if(i&&t.activateOnCompletion(i))return 12}let i=e.isUserEvent("input.type");return i&&t.activateOnTyping?5:i?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class nd{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let i=id(e,t),n=this;(8&i||16&i&&this.touches(e))&&(n=new nd(n.source,0)),4&i&&0==n.state&&(n=new nd(this.source,1)),n=n.updateFor(e,i);for(let t of e.effects)if(t.is(Oh))n=new nd(n.source,1,t.value);else if(t.is(qh))n=new nd(n.source,0);else if(t.is(ad))for(let e of t.value)e.source==n.source&&(n=e);return n}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Gh(e.state))}}class sd extends nd{constructor(e,t,i,n,s,a){super(e,3,t),this.limit=i,this.result=n,this.from=s,this.to=a}hasResult(){return!0}updateFor(e,t){var i;if(!(3&t))return this.map(e.changes);let n=this.result;n.map&&!e.changes.empty&&(n=n.map(n,e.changes));let s=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),r=Gh(e.state);if(r>a||!n||2&t&&(Gh(e.startState)==this.from||re.map((e=>e.map(t)))}),rd=st.define(),od=He.define({create:()=>Zh.start(),update:(e,t)=>e.update(t),provide:e=>[Yr.from(e,(e=>e.tooltip)),Pa.contentAttributes.from(e,(e=>e.attrs))]});function Ad(e,t){const i=t.completion.apply||t.completion.label;let n=e.state.field(od).active.find((e=>e.source==t.source));return n instanceof sd&&("string"==typeof i?e.dispatch(Object.assign(Object.assign({},function(e,t,i,n){let{main:s}=e.selection,a=i-s.from,r=n-s.from;return Object.assign(Object.assign({},e.changeByRange((o=>{if(o!=s&&i!=n&&e.sliceDoc(o.from+a,o.from+r)!=e.sliceDoc(i,n))return{range:o};let A=e.toText(t);return{changes:{from:o.from+a,to:n==s.from?o.to:o.from+r,insert:A},range:De.cursor(o.from+a+A.length)}}))),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,i,n.from,n.to)),{annotations:Lh.of(t.completion)})):i(e,t.completion,n.from,n.to),!0)}const cd=function(e,t){return i=>new jh(i,e,t)}(od,Ad);function ld(e,t="option"){return i=>{let n=i.state.field(od,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+a*(e?1:-1):e?0:r-1;return o<0?o="page"==t?0:r-1:o>=r&&(o="page"==t?r-1:0),i.dispatch({effects:rd.of(o)}),!0}}const gd=e=>!!e.state.field(od,!1)&&(e.dispatch({effects:Oh.of(!0)}),!0);class hd{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const dd=Kn.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(od).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(od),i=e.state.facet(Yh);if(!e.selectionSet&&!e.docChanged&&e.startState.field(od)==t)return;let n=e.transactions.some((e=>{let t=id(e,i);return 8&t||(e.selection||e.docChanged)&&!(3&t)}));for(let t=0;t50&&Date.now()-i.time>1e3){for(let t of i.context.abortListeners)try{t()}catch(e){qn(this.view.state,e)}i.context.abortListeners=null,this.running.splice(t--,1)}else i.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some((e=>e.effects.some((e=>e.is(Oh)))))&&(this.pendingStart=!0);let s=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((e=>e.isPending&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),s):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(od);for(let e of t.active)e.isPending&&!this.running.some((t=>t.active.source==e.source))&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(Yh).updateSyncTime))}startQuery(e){let{state:t}=this.view,i=Gh(t),n=new Rh(t,i,e.explicit,this.view),s=new hd(e,n);this.running.push(s),Promise.resolve(e.source(n)).then((e=>{s.context.aborted||(s.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:qh.of(null)}),qn(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(Yh).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],i=this.view.state.facet(Yh),n=this.view.state.field(od);for(let s=0;se.source==a.active.source));if(r&&r.isPending)if(null==a.done){let e=new nd(a.active.source,0);for(let t of a.updates)e=e.update(t,i);e.isPending||t.push(e)}else this.startQuery(r)}(t.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:ad.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(od,!1);if(t&&t.tooltip&&this.view.state.facet(Yh).closeOnBlur){let i=t.open&&Xr(this.view,t.open.tooltip);i&&i.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:qh.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Oh.of(!1)})),20),this.composing=0}}}),ud="object"==typeof navigator&&/Win/.test(navigator.platform),Id=qe.highest(Pa.domEventHandlers({keydown(e,t){let i=t.state.field(od,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||e.key.length>1||e.ctrlKey&&(!ud||!e.altKey)||e.metaKey)return!1;let n=i.open.options[i.open.selected],s=i.active.find((e=>e.source==n.source)),a=n.completion.commitCharacters||s.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&Ad(t,n),!1}})),fd=Pa.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Cd={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},pd=st.define({map(e,t){let i=t.mapPos(e,-1,me.TrackAfter);return null==i?void 0:i}}),md=new class extends Ct{};md.startSide=1,md.endSide=-1;const Bd=He.define({create:()=>Qt.empty,update(e,t){if(e=e.map(t.changes),t.selection){let i=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=i.from&&e<=i.to})}for(let i of t.effects)i.is(pd)&&(e=e.update({add:[md.range(i.value,i.value+1)]}));return e}});function Qd(){return[kd,Bd]}const Ed="()[]{}<>";function bd(e){for(let t=0;t<8;t+=2)if(Ed.charCodeAt(t)==e)return Ed.charAt(t+1);return fe(e<128?e:e+1)}function yd(e,t){return e.languageDataAt("closeBrackets",t)[0]||Cd}const wd="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),kd=Pa.inputHandler.of(((e,t,i,n)=>{if((wd?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let s=e.state.selection.main;if(n.length>2||2==n.length&&1==Ce(Ie(n,0))||t!=s.from||i!=s.to)return!1;let a=function(e,t){let i=yd(e,e.selection.main.head),n=i.brackets||Cd.brackets;for(let s of n){let a=bd(Ie(s,0));if(t==s)return a==s?Rd(e,s,n.indexOf(s+s+s)>-1,i):xd(e,s,a,i.before||Cd.before);if(t==a&&vd(e,e.selection.main.from))return Fd(e,s,a)}return null}(e.state,n);return!!a&&(e.dispatch(a),!0)})),Sd=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=yd(e,e.selection.main.head).brackets||Cd.brackets,n=null,s=e.changeByRange((t=>{if(t.empty){let n=function(e,t){let i=e.sliceString(t-2,t);return Ce(Ie(i,0))==i.length?i:i.slice(1)}(e.doc,t.head);for(let s of i)if(s==n&&Dd(e.doc,t.head)==bd(Ie(s,0)))return{changes:{from:t.head-s.length,to:t.head+s.length},range:De.cursor(t.head-s.length)}}return{range:n=t}}));return n||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!n}}];function vd(e,t){let i=!1;return e.field(Bd).between(0,e.doc.length,(e=>{e==t&&(i=!0)})),i}function Dd(e,t){let i=e.sliceString(t,t+2);return i.slice(0,Ce(Ie(i,0)))}function xd(e,t,i,n){let s=null,a=e.changeByRange((a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:i,from:a.to}],effects:pd.of(a.to+t.length),range:De.range(a.anchor+t.length,a.head+t.length)};let r=Dd(e.doc,a.head);return!r||/\s/.test(r)||n.indexOf(r)>-1?{changes:{insert:t+i,from:a.head},effects:pd.of(a.head+t.length),range:De.cursor(a.head+t.length)}:{range:s=a}}));return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function Fd(e,t,i){let n=null,s=e.changeByRange((t=>t.empty&&Dd(e.doc,t.head)==i?{changes:{from:t.head,to:t.head+i.length,insert:i},range:De.cursor(t.head+i.length)}:n={range:t}));return n?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Rd(e,t,i,n){let s=n.stringPrefixes||Cd.stringPrefixes,a=null,r=e.changeByRange((n=>{if(!n.empty)return{changes:[{insert:t,from:n.from},{insert:t,from:n.to}],effects:pd.of(n.to+t.length),range:De.range(n.anchor+t.length,n.head+t.length)};let r,o=n.head,A=Dd(e.doc,o);if(A==t){if(Md(e,o))return{changes:{insert:t+t,from:o},effects:pd.of(o+t.length),range:De.cursor(o+t.length)};if(vd(e,o)){let n=i&&e.sliceDoc(o,o+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+n.length,insert:n},range:De.cursor(o+n.length)}}}else{if(i&&e.sliceDoc(o-2*t.length,o)==t+t&&(r=Nd(e,o-2*t.length,s))>-1&&Md(e,r))return{changes:{insert:t+t+t+t,from:o},effects:pd.of(o+t.length),range:De.cursor(o+t.length)};if(e.charCategorizer(o)(A)!=ht.Word&&Nd(e,o,s)>-1&&!function(e,t,i,n){let s=qc(e).resolveInner(t,-1),a=n.reduce(((e,t)=>Math.max(e,t.length)),0);for(let r=0;r<5;r++){let r=e.sliceDoc(s.from,Math.min(s.to,s.from+i.length+a)),o=r.indexOf(i);if(!o||o>-1&&n.indexOf(r.slice(0,o))>-1){let t=s.firstChild;for(;t&&t.from==s.from&&t.to-t.from>i.length+o;){if(e.sliceDoc(t.to-i.length,t.to)==i)return!1;t=t.firstChild}return!0}let A=s.to==t&&s.parent;if(!A)break;s=A}return!1}(e,o,t,s))return{changes:{insert:t+t,from:o},effects:pd.of(o+t.length),range:De.cursor(o+t.length)}}return{range:a=n}}));return a?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Md(e,t){let i=qc(e).resolveInner(t+1);return i.parent&&i.from==t}function Nd(e,t,i){let n=e.charCategorizer(t);if(n(e.sliceDoc(t-1,t))!=ht.Word)return t;for(let s of i){let i=t-s.length;if(e.sliceDoc(i,t)==s&&n(e.sliceDoc(i-1,i))!=ht.Word)return i}return-1}function Gd(e={}){return[Id,od,Yh.of(e),dd,Ld,fd]}const Ud=[{key:"Ctrl-Space",run:gd},{mac:"Alt-`",run:gd},{key:"Escape",run:e=>{let t=e.state.field(od,!1);return!(!t||!t.active.some((e=>0!=e.state))||(e.dispatch({effects:qh.of(null)}),0))}},{key:"ArrowDown",run:ld(!0)},{key:"ArrowUp",run:ld(!1)},{key:"PageDown",run:ld(!0,"page")},{key:"PageUp",run:ld(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(od,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.facet(Yh).defaultKeymap?[Ud]:[])));class Td{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Hd{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let n=e,s=i.facet(Zd).markerFilter;s&&(n=s(n,i));let a=e.slice().sort(((e,t)=>e.from-t.from||e.to-t.to)),r=new Et,o=[],A=0;for(let e=0;;){let t,n,s=e==a.length?null:a[e];if(!s&&!o.length)break;for(o.length?(t=A,n=o.reduce(((e,t)=>Math.min(e,t.to)),s&&s.from>t?s.from:1e8)):(t=s.from,n=s.to,o.push(s),e++);ei.from||i.to==t)){n=Math.min(i.from,n);break}o.push(i),e++,n=Math.min(i.to,n)}let c=Au(o);if(o.some((e=>e.from==e.to||e.from==e.to-1&&i.doc.lineAt(e.from).to==e.from)))r.add(t,t,ji.widget({widget:new tu(c),diagnostics:o.slice()}));else{let e=o.reduce(((e,t)=>t.markClass?e+" "+t.markClass:e),"");r.add(t,n,ji.mark({class:"cm-lintRange cm-lintRange-"+c+e,diagnostics:o.slice(),inclusiveEnd:o.some((e=>e.to>n))}))}A=n;for(let e=0;e{if(!(t&&s.diagnostics.indexOf(t)<0))if(n){if(s.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Td(n.from,i,n.diagnostic)}else n=new Td(e,i,t||s.diagnostics[0])})),n}function qd(e,t){let i=t.pos,n=t.end||i,s=e.state.facet(Zd).hideOn(e,i,n);if(null!=s)return s;let a=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(Pd)))&&!e.changes.touchesRange(a.from,Math.max(a.to,n)))}function Jd(e,t){return e.field(Vd,!1)?t:t.concat(st.appendConfig.of(fu))}const Pd=st.define(),Yd=st.define(),Kd=st.define(),Vd=He.define({create:()=>new Hd(ji.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let i=e.diagnostics.map(t.changes),n=null,s=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);n=Od(i,e.selected.diagnostic,s)||Od(i,null,s)}!i.size&&s&&t.state.facet(Zd).autoPanel&&(s=null),e=new Hd(i,s,n)}for(let i of t.effects)if(i.is(Pd)){let n=t.state.facet(Zd).autoPanel?i.value.length?nu.open:null:e.panel;e=Hd.init(i.value,n,t.state)}else i.is(Yd)?e=new Hd(e.diagnostics,i.value?nu.open:null,e.selected):i.is(Kd)&&(e=new Hd(e.diagnostics,e.panel,i.value));return e},provide:e=>[no.from(e,(e=>e.panel)),Pa.decorations.from(e,(e=>e.diagnostics))]}),Wd=ji.mark({class:"cm-lintRange cm-lintRange-active"});function jd(e,t){return Do("ul",{class:"cm-tooltip-lint"},t.map((t=>eu(e,t,!1))))}const _d=e=>{let t=e.state.field(Vd,!1);return!(!t||!t.panel||(e.dispatch({effects:Yd.of(!1)}),0))},Xd=Kn.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(Zd);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e{n.push(i),clearTimeout(s),n.length==e.length?t(n):s=setTimeout((()=>t(n)),200)}),i)}(t.map((e=>Promise.resolve(e(this.view)))),(t=>{this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:Jd(e,[Pd.of(t)])}}(this.view.state,t.reduce(((e,t)=>e.concat(t)))))}),(e=>{qn(this.view.state,e)}))}}update(e){let t=e.state.facet(Zd);(e.docChanged||t!=e.startState.facet(Zd)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),Zd=Re.define({combine:e=>Object.assign({sources:e.map((e=>e.source)).filter((e=>null!=e))},ft(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t}))});function zd(e,t={}){return[Zd.of({source:e,config:t}),Xd,fu]}function $d(e){let t=[];if(e)e:for(let{name:i}of e){for(let e=0;ee.toLowerCase()==n.toLowerCase()))){t.push(n);continue e}}t.push("")}return t}function eu(e,t,i){var n;let s=i?$d(t.actions):[];return Do("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Do("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(n=t.actions)||void 0===n?void 0:n.map(((i,n)=>{let a=!1,r=n=>{if(n.preventDefault(),a)return;a=!0;let s=Od(e.state.field(Vd).diagnostics,t);s&&i.apply(e,s.from,s.to)},{name:o}=i,A=s[n]?o.indexOf(s[n]):-1,c=A<0?o:[o.slice(0,A),Do("u",o.slice(A,A+1)),o.slice(A+1)];return Do("button",{type:"button",class:"cm-diagnosticAction",onclick:r,onmousedown:r,"aria-label":` Action: ${o}${A<0?"":` (access key "${s[n]})"`}.`},c)})),t.source&&Do("div",{class:"cm-diagnosticSource"},t.source))}class tu extends Vi{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Do("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class iu{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=eu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class nu{constructor(e){this.view=e,this.items=[],this.list=Do("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)_d(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:i}=this.items[this.selectedIndex],n=$d(i.actions);for(let s=0;s{for(let t=0;t_d(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Vd).selected;if(!e)return-1;for(let t=0;t{for(let e of o.diagnostics){if(a.has(e))continue;a.add(e);let r,o=-1;for(let t=i;ti&&(this.items.splice(i,o-i),n=!0)),t&&r.diagnostic==t.diagnostic?r.dom.hasAttribute("aria-selected")||(r.dom.setAttribute("aria-selected","true"),s=r):r.dom.hasAttribute("aria-selected")&&r.dom.removeAttribute("aria-selected"),i++}}));i({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let i=t.height/this.list.offsetHeight;e.topt.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/i)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Od(this.view.state.field(Vd).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Kd.of(t)})}static open(e){return new nu(e)}}function su(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function au(e){return su(``,'width="6" height="3"')}const ru=Pa.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:au("#d11")},".cm-lintRange-warning":{backgroundImage:au("orange")},".cm-lintRange-info":{backgroundImage:au("#999")},".cm-lintRange-hint":{backgroundImage:au("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function ou(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function Au(e){let t="hint",i=1;for(let n of e){let e=ou(n.severity);e>i&&(i=e,t=n.severity)}return t}class cu extends so{constructor(e){super(),this.diagnostics=e,this.severity=Au(e)}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let i=this.diagnostics,n=e.state.facet(Cu).tooltipFilter;return n&&(i=n(i,e.state)),i.length&&(t.onmouseover=()=>function(e,t,i){function n(){let n=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(n.from)&&e.dispatch({effects:du.of({pos:n.from,above:!1,clip:!1,create:()=>({dom:jd(e,i),getCoords:()=>t.getBoundingClientRect()})})}),t.onmouseout=t.onmousemove=null,function(e,t){let i=n=>{let s=t.getBoundingClientRect();if(!(n.clientX>s.left-10&&n.clientXs.top-10&&n.clientY{clearTimeout(a),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(a),a=setTimeout(n,s)}}(e,t,i)),t}}function lu(e,t){let i=Object.create(null);for(let n of t){let t=e.lineAt(n.from);(i[t.from]||(i[t.from]=[])).push(n)}let n=[];for(let e in i)n.push(new cu(i[e]).range(+e));return Qt.of(n,!0)}const gu=co({class:"cm-gutter-lint",markers:e=>e.state.field(hu),widgetMarker:(e,t,i)=>{let n=[];return e.state.field(hu).between(i.from,i.to,((e,t,s)=>{e>i.from&&eQt.empty,update(e,t){e=e.map(t.changes);let i=t.state.facet(Cu).markerFilter;for(let n of t.effects)if(n.is(Pd)){let s=n.value;i&&(s=i(s||[],t.state)),e=lu(t.state.doc,s.slice(0))}return e}}),du=st.define(),uu=He.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=qd(t,e)?null:Object.assign(Object.assign({},e),{pos:t.changes.mapPos(e.pos)})),t.effects.reduce(((e,t)=>t.is(du)?t.value:e),e)),provide:e=>Yr.from(e)}),Iu=Pa.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:su('')},".cm-lint-marker-warning":{content:su('')},".cm-lint-marker-error":{content:su('')}}),fu=[Vd,Pa.decorations.compute([Vd],(e=>{let{selected:t,panel:i}=e.field(Vd);return t&&i&&t.from!=t.to?ji.set([Wd.range(t.from,t.to)]):ji.none})),function(e,t={}){let i=st.define(),n=He.define({create:()=>[],update(e,n){if(e.length&&(t.hideOnChange&&(n.docChanged||n.selection)?e=[]:t.hideOn&&(e=e.filter((e=>!t.hideOn(n,e)))),n.docChanged)){let t=[];for(let i of e){let e=n.changes.mapPos(i.pos,-1,me.TrackDel);if(null!=e){let s=Object.assign(Object.create(null),i);s.pos=e,null!=s.end&&(s.end=n.changes.mapPos(s.end)),t.push(s)}}e=t}for(let t of n.effects)t.is(i)&&(e=t.value),t.is(Zr)&&(e=[]);return e},provide:e=>Kr.from(e)});return{active:n,extension:[n,Kn.define((s=>new jr(s,e,n,i,t.hoverTime||300))),Wr]}}((function(e,t,i){let n,{diagnostics:s}=e.state.field(Vd),a=-1,r=-1;s.between(t-(i<0?1:0),t+(i>0?1:0),((e,s,{spec:o})=>{if(t>=e&&t<=s&&(e==s||(t>e||i>0)&&(t({dom:jd(e,n)})}:null}),{hideOn:qd}),ru],Cu=Re.define({combine:e=>ft(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});function pu(e={}){return[Cu.of(e),hu,gu,Iu,uu]}class mu{constructor(e,t,i,n,s,a,r,o,A,c=0,l){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=s,this.score=a,this.buffer=r,this.bufferBase=o,this.curContext=A,this.lookAhead=c,this.parent=l}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new mu(e,[],t,i,i,0,[],0,n?new Bu(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=65535&e,{parser:s}=this.p,a=this.reducePos=2e3&&!(null===(t=this.p.parser.nodeSet.types[n])||void 0===t?void 0:t.isAnonymous)&&(A==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,A)}storeNode(e,t,i,n=4,s=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[n-4]&&e.buffer[n-1]>-1){if(t==i)return;if(e.buffer[n-2]>=t)return void(e.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4]){let e=!1;for(let t=s;t>0&&this.buffer[t-2]>i;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4)}this.buffer[s]=e,this.buffer[s+1]=t,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(e,t,i,n)}shift(e,t,i,n){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4);else{let s=e,{parser:a}=this.p;(n>this.pos||t<=a.maxNode)&&(this.pos=n,a.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,i),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,n,4)}}apply(e,t,i,n){65536&e?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new mu(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Qu(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==i)return!1;if(!(65536&i))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&t&&e==n))||i.push(t[e],n)}t=i}let i=[];for(let e=0;e>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,(t=>{if(393216&t);else if(65536&t){let i=(t>>19)-s;if(i>1){let n=65535&t,s=this.stack.length-3*i;if(s>=0&&e.getGoto(this.stack[s],n,!1)>=0)return i<<19|65536|n}}else{let e=i(t,s+1);if(null!=e)return e}}))};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bu{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Qu{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,i=e>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class Eu{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Eu(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Eu(this.stack,this.pos,this.index)}}function bu(e,t=Uint16Array){if("string"!=typeof e)return e;let i=null;for(let n=0,s=0;n=92&&t--,t>=34&&t--;let s=t-32;if(s>=46&&(s-=46,i=!0),a+=s,i)break;a*=46}i?i[s++]=a:i=new t(a)}return i}class yu{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const wu=new yu;class ku{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=wu,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,s=this.pos+e;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let e=this.ranges[++n];s+=e.from-i.to,i=e}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,i,n=this.chunkOff+e;if(n>=0&&n=this.chunk2Pos&&tn.to&&(this.chunk2=this.chunk2.slice(0,n.to-t)),i=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),i}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=wu,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}}class Su{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;!function(e,t,i,n,s,a){let r=0,o=1<0){let i=e[n];if(A.allows(i)&&(-1==t.token.value||t.token.value==i||Du(i,t.token.value,s,a))){t.acceptToken(i);break}}let n=t.next,c=0,l=e[r+2];if(!(t.next<0&&l>c&&65535==e[i+3*l-3])){for(;c>1,a=i+s+(s<<1),o=e[a],A=e[a+1]||65536;if(n=A)){r=e[a+2],t.advance();continue e}c=s+1}}break}r=e[i+3*l-1]}}(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}function vu(e,t,i){for(let n,s=t;65535!=(n=e[s]);s++)if(n==i)return s-t;return-1}function Du(e,t,i,n){let s=vu(i,n,t);return s<0||vu(i,n,e)t)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(e.length,Math.max(n.from+1,t+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:e.length}}class Mu{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ru(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ru(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(s instanceof JA){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+s.length}}}class Nu{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new yu))}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:s}=n,a=n.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,o=0;for(let n=0;nc.end+25&&(o=Math.max(c.lookAhead,o)),0!=c.value)){let n=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!A.extend&&(i=c,t>n))break}}for(;this.actions.length>t;)this.actions.pop();return o&&e.setLookAhead(o),i||e.pos!=this.stream.end||(i=new yu,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new yu,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:t}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){1&s?e.extended=s>>1:e.value=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let t=0;t4*e.bufferLength?new Mu(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[e]=i;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)s.push(r);else{if(this.advanceStack(r,s,i))continue;{e||(e=[],t=[]),e.push(r);let i=this.tokens.getMainToken(r);t.push(i.value,i.end)}}break}}if(!s.length){let t=e&&function(e){let t=null;for(let i of e){let e=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=e&&i.pos>e)&&i.p.parser.stateFlag(i.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,s);if(i)return xu&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(s.length>e)for(s.sort(((e,t)=>t.score-e.score));s.length>e;)s.pop();s.some((e=>e.reducePos>n))&&this.recovering--}else if(s.length>1){e:for(let e=0;e500&&n.buffer.length>500){if(!((t.score-n.score||t.buffer.length-n.buffer.length)>0)){s.splice(e--,1);continue e}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,i=t?e.curContext.hash:0;for(let r=this.fragments.nodeAt(n);r;){let n=this.parser.nodeSet.types[r.type.id]==r.type?s.getGoto(e.state,r.type.id):-1;if(n>-1&&r.length&&(!t||(r.prop(NA.contextHash)||0)==i))return e.useNode(r,n),xu&&console.log(a+this.stackID(e)+` (via reuse of ${s.getName(r.type.id)})`),!0;if(!(r instanceof JA)||0==r.children.length||r.positions[0]>0)break;let o=r.children[0];if(!(o instanceof JA&&0==r.positions[0]))break;r=o}}let r=s.stateSlot(e.state,4);if(r>0)return e.reduce(r),xu&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(65535&r)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let o=this.tokens.getActions(e);for(let r=0;rn?t.push(h):i.push(h)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Uu(e,t),!0}}runRecovery(e,t,i){let n=null,s=!1;for(let a=0;a ":"";if(r.deadEnd){if(s)continue;if(s=!0,r.restart(),xu&&console.log(c+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))continue}let l=r.split(),g=c;for(let e=0;l.forceReduce()&&e<10&&(xu&&console.log(g+this.stackID(l)+" (via force-reduce)"),!this.advanceFully(l,i));e++)xu&&(g=this.stackID(l)+" -> ");for(let e of r.recoverByInsert(o))xu&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,i);this.stream.end>r.pos?(A==r.pos&&(A++,o=0),r.recoverByDelete(o,A),xu&&console.log(c+this.stackID(r)+` (via recover-delete ${this.parser.getName(o)})`),Uu(r,i)):(!n||n.scoree.topRules[t][1])),n=[];for(let e=0;e=0)s(n,e,t[i++]);else{let a=t[i+-n];for(let r=-n;r>0;r--)s(t[i++],e,a);i++}}}this.nodeSet=new TA(t.map(((t,s)=>LA.define({name:s>=this.minRepeatTerm?void 0:t,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:e.skippedNodes&&e.skippedNodes.indexOf(s)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=FA;let a=bu(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new Su(a,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new Gu(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let t=n[s++],a=1&t,r=n[s++];if(a&&i)return r;for(let i=s+(t>>1);s0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let i=this.stateSlot(e,1);null==n;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=Hu(this.data,i+2)}n=t(Hu(this.data,i+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=Hu(this.data,i+2)}if(!(1&this.data[i+2])){let e=this.data[i+1];t.some(((t,i)=>1&i&&t==e))||t.push(this.data[i],e)}}return t}configure(e){let t=Object.assign(Object.create(Tu.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let i=e.tokenizers.find((e=>e.from==t));return i?i.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=e.specializers.find((e=>e.from==i.external));if(!s)return i;let a=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[n]=Ou(a),a}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map((()=>!1));if(e)for(let n of e.split(" ")){let e=t.indexOf(n);e>=0&&(i[e]=!0)}let n=null;for(let e=0;ee.external(i,n)<<1|t}return e.get}const qu=dc({String:Nc.string,Number:Nc.number,"True False":Nc.bool,PropertyName:Nc.propertyName,Null:Nc.null,", :":Nc.separator,"[ ]":Nc.squareBracket,"{ }":Nc.brace}),Ju=Tu.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[qu],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Pu=Oc.define({name:"json",parser:Ju.configure({props:[sl.add({Object:ll({except:/^\s*\}/}),Array:ll({except:/^\s*\]/})}),dl.add({"Object Array":function(e){let t=e.firstChild,i=e.lastChild;return t&&t.to=g&&e<=h}function F(e){return R.test(e)}let R=/^[,:[\]/{}()\n+]$/;function M(e){return N.test(e)||e&&U(e.charCodeAt(0))}let N=/^[[{\w-]$/;function G(e){return e===n||e===s||e===a||e===r}function U(e){return L(e)||H(e)}function L(e){return e===c||e===y||e===w}function T(e){return e===c}function H(e){return e===l||e===k||e===S||e===v||e===D}function O(e){return e===l}function q(e,t,i){return i=2=e.length)return l;throw new t("Unexpected character ".concat(JSON.stringify(e[n])),n);function w(){k();var s=function(){if(123!==e.charCodeAt(n))return!1;{l+="{",n++,k(),D(d)&&k();let r=!0;for(;n=e.length;s||(M(e[n])||a?l=J(l,":"):Z()),w()||(s||a?l+="null":Z())}return e.charCodeAt(n)===i?(l+="}",n++):l=J(l,"}"),!0}}()||function(){if(91!==e.charCodeAt(n))return!1;{l+="[",n++,k(),D(d)&&k();let t=!0;for(;ns)return t=e.slice(s,n),i=/^0\d/.test(t),l+=i?'"'.concat(t,'"'):t,!0}else n=s;return!1}()||V("true","true")||V("false","false")||V("null","null")||V("True","true")||V("False","false")||V("None","null")||W();return k(),s}function k(){for(S();function(){if(47===e.charCodeAt(n)&&42===e.charCodeAt(n+1)){for(;n=m&&s<=B||s===Q||s===E||s===b;)t+=i?e[n]:" ",n++;return 0=e.length)return y=j(n-1),!m&&F(e.charAt(y))?(n=E,l=l.substring(0,b),N(!0)):(i=J(i,'"'),l+=i,!0);if(Q(e.charCodeAt(n))){var y=n,w=i.length;if(i+='"',n++,l+=i,k(),m||n>=e.length||F(e.charAt(n))||U(e.charCodeAt(n))||x(e.charCodeAt(n)))return K(),!0;if(F(e.charAt(j(y-1))))return n=E,l=l.substring(0,b),N(!0);l=l.substring(0,b),n=y+1,i="".concat(i.substring(0,w),"\\").concat(i.substring(w))}else{if(m&&F(e[n]))return i=J(i,'"'),l+=i,K(),!0;if(92===e.charCodeAt(n))if(w=e.charAt(n+1),void 0!==Y[w])i+=e.slice(n,n+2),n+=2;else if("u"===w){let s=2;for(;s<6&&((p=e.charCodeAt(n+s))>=g&&p<=h||p>=u&&p<=f||p>=I&&p<=C);)s++;if(6===s)i+=e.slice(n,n+6),n+=6;else{if(!(n+s>=e.length))throw S=void 0,S=e.slice(n,n+6),new t('Invalid unicode character "'.concat(S,'"'),n);n=e.length}}else i+=w,n+=2;else{var S=e.charAt(n),v=e.charCodeAt(n);if(v===c&&92!==e.charCodeAt(n-1))i+="\\".concat(S);else if((d=v)===s||d===r||d===a||d===o||d===A)i+=P[S];else{if(!(32<=(d=v)&&d<=1114111))throw v=void 0,v=S,new t("Invalid character ".concat(JSON.stringify(v)),n);i+=S}n++}}B&&D(92)}}return!1}function K(){for(k();43===e.charCodeAt(n);){n++,k();var t=(l=q(l,'"',!0)).length,i=N();l=i?(s=1,(i=l).substring(0,t)+i.substring(t+s)):J(l,'"')}var s}function V(t,i){return e.slice(n,n+t.length)===t&&(l+=i,n+=t.length,!0)}function W(){for(var t,i=n;ni){if(40===e.charCodeAt(n)&&/^\w+$/.test(e.slice(i,n).trim()))n++,w(),41===e.charCodeAt(n)&&(n++,59===e.charCodeAt(n))&&n++;else{for(;G(e.charCodeAt(n-1))&&0=e.length||F(e[n])||G(e.charCodeAt(n))}function X(t){l+="".concat(e.slice(t,n),"0")}function Z(){throw new t("Colon expected",n)}}}(V.exports)),V.exports);const ju=function({state:e}){return[A("div",{class:"middle-align center-align",style:"height: 100%; width: 100%;"},[A("div",{class:"center-align white-text"},["false"===e.isRunning?A("div",{class:"secondary-text"},[A("svg",{style:"width: 100px;",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",width:"24px"},[A("path",{d:"m620.15-434.39-34.77-34.76q21.39-67.54-28.53-111.47-49.93-43.92-107.7-24.76l-34.76-34.77q13.53-7.93 30.3-11.77 16.77-3.85 35.31-3.85 65.23 0 110.5 45.27 45.27 45.27 45.27 110.5 0 18.54-4.16 36-4.15 17.46-11.46 29.61ZM748-307.69l-31.15-30q45.92-34.08 80.69-75.89 34.77-41.8 52.92-86.42-50-108.31-148.46-171.46-98.46-63.15-214.69-63.15-38.54 0-78.12 7.03-39.57 7.04-65.34 16.89L309-746.15q33.46-14.46 81.42-24.16 47.97-9.69 93.43-9.69 134.53 0 248.03 76.12Q845.38-627.77 898.46-500 874-442.54 836.27-394.35q-37.73 48.19-88.27 86.66Zm59.92 216.76L646.08-250.92q-30.77 13.61-74.39 22.26Q528.08-220 480-220q-137.54 0-250.77-76.12Q116-372.23 61.54-500q21.54-52.38 59.15-101.12 37.62-48.73 87.08-89.11L85.23-812.38l32-32.62 720.46 720.46-29.77 33.61Zm-569.15-567.3q-37.38 26.23-74.96 71-37.58 44.77-54.89 87.23 50.62 108.31 150.81 171.46 100.19 63.15 225.96 63.15 37.23 0 73.66-5.73 36.42-5.73 52.42-14.11l-70.92-70.93q-10.62 5.39-28.35 8.66-17.73 3.27-32.5 3.27-64.61 0-110.19-44.96T324.23-500q0-15 3.27-31.92 3.27-16.93 8.66-28.93l-97.39-97.38ZM531.46-517Zm-106 53.38Z"},"")]),A("br",{},""),A("p",{},`\n ${e.messageSuccess?e.messageSuccess:e.messageOff}\n `)]):"","true"===e.isRunning?A("svg",{style:"width: 150px;",viewBox:"0 0 200 200",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",space:"preserve"},[A("defs",{},[A("linearGradient",{id:"_Linear254896",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(5.94298e-15,76.3044,-97.0563,4.6723e-15,263,93.6956)"},[A("stop",{offset:"0",style:"stop-color:#cb5cff;stop-opacity:0.49"},""),A("stop",{offset:"0.5",style:"stop-color:#9243ff;stop-opacity:0.49"},""),A("stop",{offset:"1",style:"stop-color:#cb5cff;stop-opacity:0.49"},"")]),A("linearGradient",{id:"_Linear36461",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(5.07171e-15,76.2668,-82.8272,4.66999e-15,220,93.6956)"},[A("stop",{offset:"0",style:"stop-color:#cf5bff;stop-opacity:0.53"},""),A("stop",{offset:"1",style:"stop-color:#8735f8;stop-opacity:0.53"},"")])]),A("path",{d:"M55.417,175.25C51.482,175.25 48.172,173.889 45.474,171.192C42.778,168.495 41.417,165.184 41.417,161.25L41.417,38.75C41.417,34.816 42.778,31.505 45.474,28.807C48.172,26.111 51.482,24.75 55.417,24.75L118.75,24.75C120.753,24.75 122.609,25.151 124.321,25.939C125.921,26.675 127.376,27.618 128.686,28.763C128.732,28.804 128.776,28.845 128.82,28.888L154.445,54.513C154.488,54.557 154.529,54.601 154.57,54.647C155.715,55.957 156.658,57.412 157.394,59.012C158.182,60.724 158.583,62.58 158.583,64.583L158.583,161.25C158.583,165.184 157.222,168.495 154.526,171.192C151.828,173.889 148.518,175.25 144.583,175.25L55.417,175.25ZM48.75,161.25C48.75,162.917 49.444,164.444 50.833,165.833C52.222,167.222 53.75,167.917 55.417,167.917L144.583,167.917C146.25,167.917 147.778,167.222 149.167,165.833C150.556,164.444 151.25,162.917 151.25,161.25L151.25,62.083L126.667,62.083C125.174,62.083 123.863,61.52 122.734,60.391C121.605,59.262 121.042,57.951 121.042,56.458L121.042,32.083L55.417,32.083C53.75,32.083 52.222,32.778 50.833,34.167C49.444,35.556 48.75,37.083 48.75,38.75L48.75,161.25Z",style:"fill: #525659;"},""),A("path",{d:"M48.75,161.25L48.75,38.75C48.75,37.083 49.444,35.556 50.833,34.167C52.222,32.778 53.75,32.083 55.417,32.083L121.042,32.083L121.042,56.458C121.042,57.951 121.606,59.262 122.734,60.391C123.863,61.519 125.174,62.083 126.667,62.083L151.25,62.083L151.25,161.25C151.25,162.917 150.556,164.444 149.167,165.833C147.778,167.222 146.25,167.917 144.583,167.917L55.417,167.917C53.75,167.917 52.222,167.222 50.833,165.833C49.444,164.444 48.75,162.917 48.75,161.25Z",style:"fill: white;"},""),A("g",{},[A("clipPath",{id:"_clip1454852"},[A("path",{d:"M48.75,161.25L48.75,38.75C48.75,37.083 49.444,35.556 50.833,34.167C52.222,32.778 53.75,32.083 55.417,32.083L121.042,32.083L121.042,56.458C121.042,57.951 121.606,59.262 122.734,60.391C123.863,61.519 125.174,62.083 126.667,62.083L151.25,62.083L151.25,161.25C151.25,162.917 150.556,164.444 149.167,165.833C147.778,167.222 146.25,167.917 144.583,167.917L55.417,167.917C53.75,167.917 52.222,167.222 50.833,165.833C49.444,164.444 48.75,162.917 48.75,161.25Z"},"")]),A("g",{"clip-path":"url(#_clip1454852)"},[A("g",{id:"evy5a43jrSw3_to"},[A("path",{d:"M18,169.911L18,114.438C45.856,114.438 72.498,94.311 97.038,94.004C123.03,93.679 156.832,114.438 181.5,114.438L181.5,169.911L18,169.911ZM181.5,169.911L181.5,114.438C209.356,114.438 235.998,94.311 260.538,94.004C286.53,93.679 320.332,114.438 345,114.438L345,169.911L181.5,169.911Z",style:"fill:#5cccff;fill-opacity:0.48;fill-rule:nonzero;"},"")]),A("g",{id:"evy5a43jrSw4_to"},[A("path",{d:"M-7,170L-7,114.239C39.001,114.239 82.996,94.008 123.522,93.699C166.444,93.373 222.264,114.239 263,114.239L263,170L-7,170ZM263,170L263,114.239C309.001,114.239 352.996,94.008 393.522,93.699C436.444,93.373 492.264,114.239 533,114.239L533,170L263,170Z",style:"fill:url(#_Linear254896);fill-rule:nonzero;"},"")]),A("g",{id:"evy5a43jrSw5_to"},[A("path",{d:"M44,169.962L44,114.229C73.986,114.229 102.664,94.008 129.081,93.699C157.06,93.373 193.446,114.229 220,114.229L220,169.962L44,169.962ZM220,169.962L220,114.229C249.986,114.229 278.664,94.008 305.081,93.699C333.06,93.373 369.446,114.229 396,114.229L396,169.962L220,169.962Z",style:"fill:url(#_Linear36461);fill-rule:nonzero;"},"")])])])]):"",e.messageSuccess?A("p",{class:"secondary-text"},`\n ${e.messageSuccess}\n `):""])])]},_u=function({state:e}){return A("style",{},"\n \n \n c-loading-animation-icon {\n height:100%;\n width:100%;\n }\n #evy5a43jrSw3_to {\n animation: evy5a43jrSw3_to__to 2000ms linear infinite normal forwards\n }\n @keyframes evy5a43jrSw3_to__to { \n 0% {transform: translateX(0)} \n 100% {transform: translateX(-163.5px)}\n } \n #evy5a43jrSw4_to {\n animation: evy5a43jrSw4_to__to 2000ms linear infinite normal forwards\n }\n @keyframes evy5a43jrSw4_to__to { \n 0% {transform: translateX(0)} \n 100% {transform: translateX(-270px)}\n }\n #evy5a43jrSw5_to {\n animation: evy5a43jrSw5_to__to 2000ms linear infinite normal forwards\n }\n @keyframes evy5a43jrSw5_to__to { \n 0% {transform: translateX(0)} \n 100% {transform: translateX(-176px)}\n }\n \n ")};let Xu=class extends S{init(){this.useShadowDOM=!0}get vdom(){return ju}get vstyle(){return _u}};const Zu=function({state:e}){return[A("svg",{id:"e4UgR2IF1yo1",xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",viewBox:"0 -960 960 960","shape-rendering":"geometricPrecision","text-rendering":"geometricPrecision"},[A("g",{id:"e4UgR2IF1yo2_ts",class:"edit-download-anim",transform:"translate(480.304997,-666.865829) scale(1,0.065743)"},[A("path",{id:"e4UgR2IF1yo2",class:"edit-download-anim",d:"M480,-337c-5.33333,0-10.33333-.83333-15-2.5s-9-4.5-13-8.5l-12-12v-400c0-11.33333,3.83333-20.83333,11.5-28.5s17.16667-11.5,28.5-11.5s20.83333,3.83333,28.5,11.5s11.5,17.16667,11.5,28.5v400l-12,12c-4,4-8.33333,6.83333-13,8.5s-9.66667,2.5-15,2.5Z",transform:"translate(-480.304997,666.865829)",opacity:"0"},"")]),A("g",{id:"e4UgR2IF1yo3_tr",class:"edit-download-anim",transform:"translate(440,-359.999999) rotate(45)"},[A("path",{id:"e4UgR2IF1yo3",class:"edit-download-anim",d:"M308,-492c-8-8-11.83333-17.33333-11.5-28s4.16667-20,11.5-28c8-8,17.5-12.16667,28.5-12.5s20.5,3.5,28.5,11.5l81.852892,81.852892L440,-360L308,-492Z",transform:"translate(-440,360.000003)",opacity:"0"},"")]),A("g",{id:"e4UgR2IF1yo4_tr",class:"edit-download-anim",transform:"translate(520,-359.273026) rotate(-45)"},[A("path",{id:"e4UgR2IF1yo4",class:"edit-download-anim",d:"M595,-549c8-8,17.5-11.83333,28.5-11.5s20.5,4.5,28.5,12.5c7.33333,8,11.16667,17.33333,11.5,28s-3.5,20-11.5,28L520,-360l-7.734591-106.265407L595,-549Z",transform:"translate(-520,359.273029)",opacity:"0"},"")]),A("g",{id:"e4UgR2IF1yo5_to",class:"edit-download-anim",transform:"translate(480,-291.999446)"},[A("path",{id:"e4UgR2IF1yo5",class:"edit-download-anim",d:"M720,-160c22,0,40.83333-7.83333,56.5-23.5s23.5-34.5,23.5-56.5v-80c0-11.33333-3.83333-20.83333-11.5-28.5s-17.16667-11.5-28.5-11.5-20.83333,3.83333-28.5,11.5-11.5,17.16667-11.5,28.5v80h-480v-80c0-11.33333-3.83333-20.83333-11.5-28.5s-17.16667-11.5-28.5-11.5-20.83333,3.83333-28.5,11.5-11.5,17.16667-11.5,28.5v80c0,22,7.83333,40.83333,23.5,56.5s34.5,23.5,56.5,23.5h480Z",transform:"translate(-480,260)",opacity:"0"},"")]),A("g",{id:"e4UgR2IF1yo6_to",class:"edit-download-anim",transform:"translate(480.000015,-479.999969)"},[A("g",{id:"e4UgR2IF1yo6_tr",class:"edit-download-anim",transform:"rotate(0)"},[A("g",{id:"e4UgR2IF1yo6_ts",class:"edit-download-anim",transform:"scale(1,1)"},[A("path",{d:"M200,-200h50.46l409.46-409.46-50.46-50.46L200,-250.46v50.46Zm-23.84,60q-15.37,0-25.76-10.4-10.4-10.39-10.4-25.76v-69.3q0-14.63,5.62-27.89q5.61-13.26,15.46-23.11l506.54-506.31q9.07-8.24,20.03-12.73q10.97-4.5,23-4.5t23.3,4.27q11.28,4.27,19.97,13.58l48.85,49.46q9.31,8.69,13.27,20t3.96,22.62q0,12.07-4.12,23.03-4.12,10.97-13.11,20.04L296.46,-161.08q-9.85,9.85-23.11,15.46-13.26,5.62-27.89,5.62h-69.3Zm584.22-570.15l-50.23-50.23l50.23,50.23ZM659.92,-609.46l-25.67-24.79",transform:"translate(-480.000015,479.999969)"},"")])])])])]},zu=function({state:e}){return A("style",{},"\n \n \n c-edit-download-icon {\n height:100%;\n width:100%;\n }\n .edit-download-anim {\n animation-play-state: paused;\n animation-duration: 1170ms;\n animation-timing-function: linear;\n animation-iteration-count: infinite;\n animation-direction: normal;\n animation-fill-mode: forwards;\n }\n .edit-download-anim:hover {\n animation-play-state: running;\n }\n #e4UgR2IF1yo2_ts {\n animation-name: e4UgR2IF1yo2_ts__ts;\n }\n @keyframes e4UgR2IF1yo2_ts__ts {\n 0% {\n transform: translate(480.304997px,-666.865829px) scale(1,0.065743)\n }\n 35.042735% {\n transform: translate(480.304997px,-666.865829px) scale(1,0.065743);\n animation-timing-function: cubic-bezier(0.42,0,0.58,1)\n }\n 56.410256% {\n transform: translate(480.304997px,-666.865829px) scale(1,1)\n }\n 100% {\n transform: translate(480.304997px,-666.865829px) scale(1,1)\n }\n }\n #e4UgR2IF1yo2 {\n animation-name: e4UgR2IF1yo2_c_o;\n }\n @keyframes e4UgR2IF1yo2_c_o {\n 0% {\n opacity: 0\n }\n 35.042735% {\n opacity: 0\n }\n 37.606838% {\n opacity: 1\n }\n 100% {\n opacity: 1\n }\n }\n #e4UgR2IF1yo3_tr {\n animation-name: e4UgR2IF1yo3_tr__tr;\n }\n @keyframes e4UgR2IF1yo3_tr__tr {\n 0% {\n transform: translate(440px,-359.999999px) rotate(45deg)\n }\n 56.410256% {\n transform: translate(440px,-359.999999px) rotate(45deg);\n animation-timing-function: cubic-bezier(0.42,0,0.58,1)\n }\n 76.923077% {\n transform: translate(440px,-359.999999px) rotate(0deg)\n }\n 100% {\n transform: translate(440px,-359.999999px) rotate(0deg)\n }\n }\n #e4UgR2IF1yo3 {\n animation-name: e4UgR2IF1yo3_c_o;\n }\n @keyframes e4UgR2IF1yo3_c_o {\n 0% {\n opacity: 0\n }\n 56.410256% {\n opacity: 0\n }\n 59.82906% {\n opacity: 1\n }\n 100% {\n opacity: 1\n }\n }\n #e4UgR2IF1yo4_tr {\n animation-name: e4UgR2IF1yo4_tr__tr;\n }\n @keyframes e4UgR2IF1yo4_tr__tr {\n 0% {\n transform: translate(520px,-359.273026px) rotate(-45deg)\n }\n 56.410256% {\n transform: translate(520px,-359.273026px) rotate(-45deg);\n animation-timing-function: cubic-bezier(0.42,0,0.58,1)\n }\n 76.923077% {\n transform: translate(520px,-359.273026px) rotate(0deg)\n }\n 100% {\n transform: translate(520px,-359.273026px) rotate(0deg)\n }\n }\n #e4UgR2IF1yo4 {\n animation-name: e4UgR2IF1yo4_c_o;\n }\n @keyframes e4UgR2IF1yo4_c_o {\n 0% {\n opacity: 0\n }\n 56.410256% {\n opacity: 0\n }\n 59.82906% {\n opacity: 1\n }\n 100% {\n opacity: 1\n }\n }\n #e4UgR2IF1yo5_to {\n animation-name: e4UgR2IF1yo5_to__to;\n }\n @keyframes e4UgR2IF1yo5_to__to {\n 0% {\n transform: translate(480px,-291.999446px)\n }\n 70.940171% {\n transform: translate(480px,-291.999446px);\n animation-timing-function: cubic-bezier(0.42,0,0.58,1)\n }\n 100% {\n transform: translate(480px,-260px)\n }\n }\n #e4UgR2IF1yo5 {\n animation-name: e4UgR2IF1yo5_c_o;\n }\n @keyframes e4UgR2IF1yo5_c_o {\n 0% {\n opacity: 0\n }\n 76.923077% {\n opacity: 0;\n animation-timing-function: cubic-bezier(0.42,0,0.58,1)\n }\n 88.034188% {\n opacity: 1\n }\n 100% {\n opacity: 1\n }\n }\n #e4UgR2IF1yo6_to {\n animation-name: e4UgR2IF1yo6_to__to;\n }\n @keyframes e4UgR2IF1yo6_to__to {\n 0% {\n transform: translate(480.000015px,-479.999969px);\n animation-timing-function: cubic-bezier(0,0,0.58,1)\n }\n 17.094017% {\n transform: translate(480.000015px,-537.379818px)\n }\n 100% {\n transform: translate(480.000015px,-537.379818px)\n }\n }\n #e4UgR2IF1yo6_tr {\n animation-name: e4UgR2IF1yo6_tr__tr;\n }\n @keyframes e4UgR2IF1yo6_tr__tr {\n 0% {\n transform: rotate(0deg)\n }\n 17.094017% {\n transform: rotate(0deg);\n animation-timing-function: cubic-bezier(0.42,0,0.58,1)\n }\n 35.042735% {\n transform: rotate(-45deg)\n }\n 100% {\n transform: rotate(-45deg)\n }\n }\n #e4UgR2IF1yo6_ts {\n animation-name: e4UgR2IF1yo6_ts__ts;\n }\n @keyframes e4UgR2IF1yo6_ts__ts {\n 0% {\n transform: scale(1,1);\n animation-timing-function: cubic-bezier(0,0,0.58,1)\n }\n 17.094017% {\n transform: scale(0.414278,0.414276)\n }\n 100% {\n transform: scale(0.414278,0.414276)\n }\n }\n \n ")};let $u=class extends S{init(){this.useShadowDOM=!0}get vdom(){return Zu}get vstyle(){return zu}};const eI=function({state:e}){return[A("nav",{class:"vertical"},[e.itemsArr.map(((t,i)=>A("label",{class:"radio"},[A("input",{type:"radio",name:e.groupName,value:i,onclick:("function"==typeof onSelect?onSelect.bind(this):this.onSelect).bind(this),disabled:!0===t?.disabled,checked:i===e.selectedItem},""),A("span",{},`${t.text}`)])))])]},tI=function({state:e}){return A("style",{},"\n \n \n ")};let iI=class extends S{init(){this.useShadowDOM=!0}get vdom(){return eI}get vstyle(){return tI}};const nI=function({state:e}){return[e.shortcutModifier?A("kbd",{},`${rI[e.shortcutModifier]}`):"",`\n ${e.shortcutModifier?"+":""}\n `,A("kbd",{},`${e.shortcutLetter}`)]},sI=function({state:e}){return A("style",{},"\n \n \n ")};let aI=class extends S{init(){this.useShadowDOM=!0}get vdom(){return nI}get vstyle(){return sI}};const rI=navigator?.userAgent?.indexOf("Mac")>-1?{ctrl:"⌘ Cmd"}:{ctrl:"^ Ctrl"};const oI=function({state:e}){return[]},AI=function({state:e}){return A("style",{},"\n \n \n c-json-viewer {\n width: 100%;\n }\n /*\n Only custom marker for summary/details\n For cross browser compatible styling hide Firefox's marker by setting summary { display: block }\n and Chrome and Safari's marker by setting ::-webkit-details-marker {display: none;}\n */\n main summary {\n display: block;\n cursor: pointer;\n outline: 0; \n --title-height: 1.5rem;\n }\n main summary::-webkit-details-marker {\n display: none;\n }\n \n .treenav {\n display: block;\n white-space: nowrap;\n color: #666;\n position: relative;\n /* big Performance boost when big JSON structure is used.\n It reduces virtually the number of DOM node. So restyle is faster when the fireworks is executed.\n TODO: Should we use fastdom?: https://web.dev/articles/avoid-large-complex-layouts-and-layout-thrashing */\n content-visibility: auto;\n /* contain-intrinsic-size: auto 16px; should we use this to define defualt content height?*/ \n }\n \n .treenav .row{\n gap: 0.2rem;\n }\n /* vertical lignes */\n .treenav.is-expandable::before {\n border-left: 1px dotted var(--outline);\n content: \"\";\n height: 100%;\n left: 0.3rem;\n position: absolute;\n top: 2rem;\n height: calc(100% - 2.4rem);\n }\n .treenav .treenav {\n margin-left: 1.6rem;\n }\n .treenav.is-expandable[open] > .treenav-title::after {\n transform: rotate(90deg);\n }\n .treenav .treenav.is-expandable {\n margin-left: 1.6rem; \n }\n .treenav.is-expandable > .treenav-title {\n /*padding-left: 1.8rem;*/\n padding-left: 0.2rem;\n }\n /* TODO use real icon */\n .treenav.is-expandable > .treenav-title::after {\n --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M504-480 348-636q-11-11-11-28t11-28q11-11 28-11t28 11l184 184q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L404-268q-11 11-28 11t-28-11q-11-11-11-28t11-28l156-156Z'/%3e%3c/svg%3e\");\n position: absolute;\n will-change: transform;\n transition: transform 300ms ease;\n color: #000;\n content: \" \";\n text-align: center;\n background-color: currentColor;\n mask-position: center;\n mask-size: 1em;\n mask-repeat: no-repeat;\n mask-image: var(--cicon);\n -webkit-mask-position: center;\n -webkit-mask-size: 1rem;\n -webkit-mask-repeat: no-repeat;\n -webkit-mask-image: var(--cicon);\n display: inline-block;\n height: var(--title-height);\n width: 1.6rem;\n }\n \n .treenav-title {\n cursor: pointer;\n display: block;\n outline: 0;\n color: #000;\n font-size: 1rem;\n line-height: var(--title-height);\n }\n \n .treenav-title::-webkit-details-marker {\n display: none;\n }\n \n .treenav .value {\n font-size: 0.8rem;\n }\n .treenav .code {\n /*padding: 0;*/\n font-size: 0.8rem;\n font-family: monospace; /* to have input size equals number of char */\n font-style: italic;\n }\n .field.verysmall {\n height: 1rem;\n }\n \n /* hover surlignage */ \n .autoselect::before { \n transform: scaleX(0);\n transform-origin: bottom right;\n }\n .autoselect:hover::before {\n transform: scaleX(1);\n transform-origin: bottom left;\n }\n .autoselect::before {\n content: \" \";\n display: block;\n position: absolute;\n top: 0; right: 0; bottom: 0; left: 0;\n inset: 0 0 0 0;\n background: var(--surface-variant);\n z-index: -1;\n transition: transform .3s ease;\n box-sizing: border-box;\n block-size: 100%;\n inline-size: 100%;\n }\n .autoselect {\n position: relative;\n cursor: pointer;\n }\n \n .autoselect {\n animation: comeback 1s linear forwards; /* forward to avoid deleting animation when finished, and have the ability to start it again */\n animation-play-state: paused;\n }\n @keyframes comeback {\n 0% {\n box-shadow: none;\n background: none;\n }\n 1% {\n opacity: 0;\n box-shadow: inset 2px 2px 3px 1px rgb(0, 0, 0, 0.2);\n background: rgba(0,0,0,0.05);\n transform: translate(2px, 2px);\n }\n 100% {\n box-shadow: none;\n background: none;\n transform: none;\n }\n }\n \n ")};let cI=class extends S{init(){this.useShadowDOM=!0}get vdom(){return oI}get vstyle(){return AI}};let lI=class{constructor(e={}){this.__state=e,this.subscribers=[]}subscribe(e,t=[]){const i=Array.isArray(t)?t:Object.keys(t);e.setState(this.getSelectedState(i)),this.subscribers.push({target:e,props:i}),e.__stores.push(this)}unsubscribe(e){const t=[];for(let i=0;i(t in this.state&&(e[t]=this.state[t]),e)),{})}updateSelectedState(e,t){const i={};let n=0;for(var s=0;s{const n=this.updateSelectedState(e,i);null!==n&&t.render(n)}))}};class gI extends lI{constructor(){super({hideDebuggerIfNoError:!0,useEmbeddedPDFViewer:!0,makeSoundOnError:!1,previewFormat:"pdf",locale:gI.getBrowserLang(),timezone:gI.getBrowserTimezone(),isBetaFeatureActive:!1})}static getBrowserLang(){return(navigator.language||navigator.userLanguage||"").toLowerCase()}static getBrowserTimezone(){return Intl.DateTimeFormat().resolvedOptions().timeZone}isSafari(){return/apple/i.test(navigator.vendor)}}var hI=new gI;var dI=new class extends lI{constructor(){super({data:{},complement:{},enum:{},translations:{},convertTo:hI.state.previewFormat,converter:"L",lang:hI.state.locale,timezone:hI.state.timezone,reportName:null,variableStr:"",currencySource:"EUR",currencyTarget:null,isDebugActive:!0})}reset(){this.setState({data:{},complement:{},enum:{},translations:{}})}};var uI=new class extends lI{constructor(){super({token:"",free:!0,testToken:"",prodToken:"",origin:"",version:"5",nbRequestRunning:0})}buildHeaders(){return{"carbone-version":this.state.version,...this.state?.token?{Authorization:this.state.token}:{}}}getFullURL(e){return`${this.state.origin}${e}`}async postJSON(e,t,i){return this.fetchRequest(this.getFullURL(e),{method:"post",body:JSON.stringify(t),headers:{"Content-type":"application/json",...this.buildHeaders()},signal:i?.controller?.signal})}async post(e,t){return this.fetchRequest(this.getFullURL(e),{method:"post",body:t,headers:{...this.buildHeaders()}})}async getJSON(e,t,i){return this.fetchRequest(this.getFullURL(e),{method:"get",headers:{"Content-type":"application/json",...this.buildHeaders()},signal:i?.controller?.signal})}async fetchRequest(e,t){this.setState({nbRequestRunning:++this.state.nbRequestRunning});const i=fetch(e,t);return i.finally((()=>{this.setState({nbRequestRunning:--this.state.nbRequestRunning})})),i}};var II=new class extends lI{constructor(){super({logs:[]})}info(e){e&&(this.clean(),this.state.logs.push({type:"info",message:this.addTime(e)}),this.notify())}warn(e){e&&(this.clean(),this.state.logs.push({type:"warn",message:this.addTime(e)}),this.notify())}error(e){e&&(this.clean(),this.state.logs.push({type:"error",message:this.addTime(e)}),this.notify())}addTime(e){const t=new Date;return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"numeric",second:"numeric"}).format(t)+" "+e}clean(){this.state.logs.length>10&&(this.state.logs=this.state.logs.slice(-5))}};var fI=new class extends lI{constructor(){super({isUploadingTemplate:!1,idTemplateOpened:"",templateExtension:"",editMode:"L"})}reset(){this.setState({idTemplateOpened:"",templateExtension:""})}switchToEditionMode(e){this.setState({editMode:e})}getDownloadURL(){return this.state.idTemplateOpened?uI.state.origin+"/template/"+this.state.idTemplateOpened:""}getFilename(){return this.state.idTemplateOpened?!0===this.state.idTemplateOpened?.endsWith(this.state.templateExtension)?this.state.idTemplateOpened:this.state.idTemplateOpened+"."+this.state.templateExtension:""}getThumbnailURL(){return""}async open(e,t="docx"){await uI.getJSON(`template/${e}.json`).then((e=>e.json())).then((e=>{if(e&&!1===e.success)throw Error(e.error);dI.setState({data:e})})).catch((e=>{console.log(e)})),this.setState({idTemplateOpened:e,templateExtension:t})}async add(e){const t=new FormData;if(!e)throw new Error("The file argument is not valid");II.info("Uploading new template"),this.setState({isUploadingTemplate:!0}),t.append("template",e);const i=uI.post("/template",t).then((e=>e.json())).then((e=>{if(!e.success)throw e.error;this.state.idTemplateOpened=e.data.templateId,this.state.templateExtension=e?.data?.templateExtension??""}));return await i.catch((e=>{this.reset(),II.error(e+"")})).finally((()=>{this.state.isUploadingTemplate=!1,this.notify()})),i}async generate(e,t){const i={data:e,extension:t};if(II.info("Generate a template with AI"),!0===this.state.isUploadingTemplate)return new Promise(((e,t)=>t("Template generation busy")));this.setState({isUploadingTemplate:!0});const n=uI.postJSON("/template/generate",i).then((e=>e.json())).then((e=>{if(!e.success)throw e.error;II.info("Template generated"),this.state.idTemplateOpened=e.data.templateId,this.state.templateExtension=e.data.templateExtension}));return await n.catch((e=>{this.reset(),II.error(e+"")})).finally((()=>{this.state.isUploadingTemplate=!1,this.notify()})),n}};var CI=new class extends lI{constructor(){super({isDraftUserDataSavedFn:null})}};var pI=new class extends lI{constructor(){super({isRunning:!1,lastRenderUrl:"",errorPageNumber:-1,debug:{},_abortController:null})}reset(){this.state._abortController&&this.state._abortController.abort(),this.setState({lastRenderUrl:"",debug:{},_abortController:null})}async updatePreview(e=!1,t="pdf"){if(CI.state?.isDraftUserDataSavedFn?.())return;if(this.state._abortController)return II.info("Abort pending preview"),this.state._abortController.signal.onabort=setTimeout(this.updatePreview.bind(this),1),void this.state._abortController.abort();const i=dI.state,n=fI.state.idTemplateOpened;n&&(!1===e?(II.info("Rendering preview"),this.state.isRunning=!0,this.state.lastRenderUrl="",this.state.errorPageNumber=-1):(II.info("Export to "+t),i.convertTo=t),this.state._abortController=new AbortController,this.notify(),await uI.postJSON(`/render/${n}`,i,{controller:this.state._abortController}).then((e=>e.json())).then((t=>{const i=uI.getFullURL(`/render/${t?.data?.renderId}`);if(!t.success)throw t.data?.renderId&&(this.state.lastRenderUrl=i,this.state.errorPageNumber=t?.data?.debug?.error?.page??-1),t.error;if(!1===e){let e="";if(t.data.debug?.metrics){const i=t.data.debug.metrics,n=0===i.fetchImageBytes+i.fetchImageBytes?"":` + files/images download (${parseInt((i.fetchImageTime+i.fetchFileTime)/1e3,10)}ms, ${i.fetchImageBytes+i.fetchImageBytes>>20}MB)`;e=`in ${parseInt(i.renderTime/1e3,10)}ms = Carbone (${parseInt((i.renderTime-i.convertTime-i.fetchImageTime-i.fetchFileTime)/1e3,10)}ms)${n} + conversion (${parseInt(i.convertTime/1e3,10)}ms).`}II.info(`Preview successully generated ${e}`),this.state.lastRenderUrl=i,this.state.debug=t.data.debug}else II.info("Report successully generated"),this.downloadFile(i,t.data.renderId)})).catch((e=>"AbortError"===e.name?II.info(e+""):!0===e.toString().includes("test key")?II.error(e+". To generate all formats of documents without Watermark, toggle the Switch above ☝️ Please note that this will use document credits from your subscription quota."):void II.error(e+""))).finally((()=>{dI.state.convertTo=hI.state.previewFormat,this.state.isRunning=!1,this.state._abortController=null,this.notify()})))}async exportTo(e){this.updatePreview(!0,e)}async downloadFile(e,t){const i=e+"?download=true",n=document.createElement("a");n.href=i,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}};var mI=new class extends lI{constructor(){super({clipboardMode:"T",clipboardText:"",clipboardImage:""})}reset(){this.setState({clipboardMode:"T",clipboardText:"",clipboardImage:""})}setState(e){super.setState(e),this.writeTextOrImage()}insertSmartClipboard(e,t){let i=`{${e}}`;"string"!=typeof t||!0!==t.startsWith("https://")&&!0!==t.startsWith("data:image")?-1!==e.indexOf("barcode")?(i=`{${e}:barcode(ean13)}`,this.switchTo("B",i)):this.switchTo("T",i):this.switchTo("I",i)}update(e){this.setState({clipboardText:e})}updateSilently(e){this.state.clipboardText=e,this.writeTextOrImage()}switchTo(e,t){let i="";switch(e){case"T":break;case"I":i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqkAAAIQCAQAAAAI6j/xAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfmBRMPCyfLJw6jAAANIUlEQVR42u3d23YTyQGG0V+WbWQDFqeByeT9HyX3eQsYDgZjsI1tpFyETJI1wxoYSt112JtrTFHd+lx91OKf2wBQwj/2zAFAKZIKIKkAkgogqQBIKoCkAkgqgKQCIKkAkgogqQBIKoCkAkgqgKQCIKkAkgogqQBIKoCkAkgqgKQCIKkAkgogqQBIKoCkAkgqgKQCIKkAkgogqQBIKoCkAkgqgKQCIKkAkgogqQBIKoCkAkgqgKQCIKkAkgogqQBIKoCkAkgqgKQCIKkAkgogqQCSagoAJBVAUgEkFQBJBZBUAEkFkFQAJBVAUgEkFQBJBZBUAEkFkFQAJBVAUgEkFQBJBZBUAEkFkFQAJBVAUgEkFQBJBZBUAEkFkFQAJBVAUgEkFQBJBZBUAEkFkFQAJBVAUgEkFQBJBZBUAEkFkFQAJBVAUgEkFQBJBZBUAEkFkFQAJBVAUgEkFUBSAZBUAEkFkFQAJBVAUtud0IVJgGHtm4Ifm76DL3+W2fufnG6yySY3X/5cmyiQVL5umVVWWeXgq2vVvSSHvwX2Kle5klaQVP7fIse5m6PvOrzfy3GOk9zmY85zaxJBUkkOc5LjHzj9vJ911rnKeT6aTJDUsXO6zt0iP2mVVR7kfT5ka1pBUsdzkEc5KvwTH2ed01yYXJDUkSyyznonN0bt52kuc5obkwySOoajPN7pFB3ll7zLmYkGSe3fgzyYYBX8MEd5lc+mGzrg6amvWObZBEH9t1V+KXyuFpDUihxOHLllnuXEtIOk9miVn7Oc/F99lEemHhrnXOrvHOenmV59cpJF3tgAYJUqqGXczxObACS1F3fyZOaX893LQ5sBJLUHh3lWwYSsXagCSe1hKp5WMh2P3FIFktq6JxVdq3viuiFIasvWOa5oNMtZL5IBkvpD7kz2pNS3j2hts4CktulxhWvC9W9ftAJIakNOqozXwtNUIKntWVZ30P8fq0LfIwBI6mQeVDwJD12kAkltyX7uGR0gqWWcVL4OXFungqS2Yln9KnDf+VSQ1Fbca2ACPPEPktpMUut36P5UkNQW3MlBE+N06A+Sao0qqSCpIzluZJz7WdlTQVLrdjjDV/b9VZIKkipTkgqSKqn1ueOGf5DU2jPVjkVTowVJHc6yoTOpSRq53QskdVAHxgtIqqQCklqd1r6BVFJBUiu2NF5AUkf9jy/cRgXKUnOijBiQ1GH/474mDHxOrfmsUkFS+7dtbsQbeytIqkCN+0sAJNUq1S8BQFJ7D5SggqRW7LPxApJayo3xApIqqYCkSpSkgqT2a5NbSQUktZSrpn4BXNtXQVIltdRY3egPkiqpA44VJHVItw2dn5RUkNTqXTQyzhtnUkFS6/fBOAFJLbf6+9TEOD/aT0FSrf/KuGrsDlqQ1IGTWv/rSM7spSCpbdjmfeUjvM6lvRQktRXnlb+J9J19FCS1HZuq16nXzdzoBUhqkuSs4ss/pzYPSGpbttWG64OnpkBS23NR5eH1Jm9tGpDUFp1WeJHqre+bAklt023eVDaijzm3WUBSW1VXwm6qSzwgqd958F/LE/+bvKr8bllAUv/ENi+reIPqNq+9zA8ktX2f82sFl4TeuL0fJLUPt/l15kPut96OCpLaj+u8mHGl+tZ7p0BSe4vq81nOqW7zWlBBUns8/H8x+QWiTV465AdJ7dPnPJ/0DVU3ee69qNCBfVPwtcPw01zlySS/cz7kTbamHKxS+3aR5zt/F9RtXua1oIJV6ghu8iLHebSjadrmPO88JwWSOtZa9SoPcq/4gv4ybz0lBZI6nk1O8y4nOSmW1YucVfNGAUBSZ8jqu7zP/dzLwQ/+nI85tzoFSWWTs5zlTu7mbpbf/be3ucyHXLoUBZLKf33Kp5xmP0dZ5egbTgVsc51P+ZRLF6JAUvljtznPeZL9HOQgB1lmL4vsZS+bbLPNJp9zk9vc5Ma6FCSVb03rreeegC/c6g8gqQCSCiCpAEgqgKQCSCqApAIgqQCSCiCpAEgqgKQCSCqApAIgqQCSCiCpAEgqgKQCSCqApAIgqQCSCiCpAEgqgKQCSCqApAIgqQCSCiCpAEgqgKQCSCqApAIgqQCSCiCpAEgqgKQCSCqApAIgqQCSCiCpAEgqgKQCSCr4YGDPgdGs8vccmwYkFUoE9WmW+UlUkVQoEdS9JAtRRVKhTFAjqkgqlAuqqCKpUDCoooqkQsGgiiqSCgWDKqpIKhQMqqgiqVAwqKKKpELBoIoqkgoFgyqqSCoUDKqoIqlQMKiiiqRCwaCKKpIKBYMqqkgqFAyqqCKpUDCoooqkQsGgiiqSCgWDKqpIKoJaMKiiiqQiqIV/pqgiqQiqqCKpUF9QRRVJRVBFFUmFOoMqqkgqgiqqSCrUGVRRRVIRVFFFUqHOoIoqkoqgiiqSCnUGVVQlFQRVVJFUqDOooiqpIKiiiqRCnUEVVUkFQRVVJBXqDKqoSioIqqgiqQjq02p3ZlGVVBBUUUVSEVRRRVKh66CKqqSCoIoqkoqgiiqSCt0HVVQlFQRVVJFUBFVUkVToPqiiKqkgqKKKpCKoooqkQvdBFVVJBUEVVSQVQRVVJBW6D6qoSioIqqgiqQiqqCKp0H1QRVVSQVBFFUlFUEUVSUVQRRVJBUEVVUkFQRVVJBVBFVUkFQRVVCUVBFVUkVQEVVSRVARVVJFUfuAjJaiiKqqSShHL/C33BVVURVVSKRHUZznM44GiKqiiKqnsNKhJhomqoIqqpLLzoI4SVUEVVUllkqCOEFVBFVVJZbKg9h5VQRVVSWXSoPYcVUEVVUll8qD2GlVBFVVJZZag9hhVQRVVSWW2oPYWVUEVVUll1qD2FFVBFVVJZfag9hJVQRVVSaWKoPYQVUEVVUmlmqC2HlVBFVVJpaqgthxVQRVVSaW6oLYaVUEVVUmlyqC2GFVBFVVJpdqgthZVQRVVSaXqoLYUVUEVVUml+qC2ElVBFVVJpYmgthBVQRVVSaWZoNYeVUEVVUmlqaDWHFVBFVVJpbmg1hpVQRVVSaXJoNYYVUEVVUml2aDWFlVBFVVJpemg1hRVQRVVSaX5oNYSVUEVVUmli6DWEFVBFVVJpZugzh1VQRVVSaWroM4ZVUEVVUmlu6DOFVVBFVVJpcugzhFVQRVVfAK6DerUURVUUUVSuw7qlFEVVFFFUrsP6lRRFVRRRVKHCOoUURVUUUVShwnqrqMqqKKKpA4V1F1GVVBFFUkdLqi7iqqgiiqSOmRQdxFVQRVVJHXYoJaOqqCKKpI6dFBLRlVQRRVJHT6opaIqqKKKpApqoagKqqgiqYJaKKqCKqpIqqAWiqqgiiqSKqiFoiqoooqkCmqhqAqqqCKpglooqoIqqkiqoBaKqqCKKpIqqIWiKqiiiqQKaqGoCqqoIqmCWiiqgiqqSKqgFoqqoIoqkiqohaIqqKKKpApqoagKqqgiqYJaKKqCKqpIqqAWiqqgiiqSKqiFoiqooiqqf82+KRDU30d1m4UNP3xUX+XCRFilCmqZDxSiaqUqqYIKoiqpggqiKqmCCqKKpAoqiKqkCiqIqqQKKoiqpAoqIKqSKqggqpIqqCCqkiqoIKpIqqCCqEqqoIKoSqqggqhKqqACoiqpggqiKqmCCqIqqYIKosroSRVUEFVJFVQQVUkVVBBVSRVUQFQlVVBBVCVVUEFUJVVQQVQZLKmCCqIqqYIKoiqpggqiKqmCCoiqpAoqiKqkCiqIqqQKKiCqgyVVUEFUJVVQQVQlVVCBkaPacVIFFURVUgUVRFVSBRUQ1S6TKqggqpIqqCCqkiqogKh2mVRBBVGVVEEFUZVUQQVEtcukCiqIqqQKKoiqpAoqIKpdJlVQQVQlVVBBVCVVUAFR7TKpggqiKqmCCnQa1WaTKqggqpIqqEDHUW0yqYIKoiqpggp0HtXmkiqoIKqSKqjAAFFtKqmCCqIqqYIKDBLVZpIqqCCqkiqowEBRbSKpggqiKqmCCgwW1eqTKqggqpIqqMCAUa06qYIKoiqpggoMGtVqkyqoQHtRrTSpggq0GNUqkyqoQJtRrTCpggq0GtXqkiqoQLtRrSypggq0HNWqkiqoQNtRrSipggq0HtVqkiqoQPtRrSSpggr0ENUqkiqoQB9RrSCpggr0EtXZkyqoQD9RnTmpggr0FNVZkyqoQF9RnTGpggr0FtXZkiqoQH9RnSmpggr0GNVZkiqoQJ9RnSGpggr0GtXJkyqoQL9RnTipggr0HNVJkyqoQN9RnTCpggr0HtXJkiqoQP9RnSipggqMENVJkiqowBhRnSCpggqMEtWdJ1VQgXGiur/7pJ7ZusAgdp7U61ybZWAQe6YAQFIBJBVAUgGQVABJBZBUAEkFQFIBJBVAUgGQVABJBZBUAEkFQFIBJBVAUgGQVABJBZBUAEkFQFIBJBVAUgGQVABJBZBUAEkFQFIBJBVAUgGQVABJBZBUAEkFQFIBJBVAUgGQVABJBZBUAEkFQFIBJBVAUgFI8i8sUzUKOvjUBwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNS0xOVQxNToxMTozOSswMDowMPPgQ/4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDUtMTlUMTU6MTE6MzkrMDA6MDCCvftCAAAAAElFTkSuQmCC";break;case"B":i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADRCAIAAAD5ZBhRAAABgWlDQ1BzUkdCIElFQzYxOTY2LTIuMQAAKJF1kd8rQ2EYxz8bIqYpLly4WBqlRn7U4kbZEmpJM2W42c7O2dTOdjpnktwqtytK3Ph1wV/ArXKtFJGSa9fEDTqeY6tJ9rw97/N5v+/7PL3v84I7llV0q7Yf9FzBjE6EfPPxBV/9M3V4aaWJnoRiGWMzMxGq2vsdLife9Dq1qp/715pSqqWAq0F4VDHMgvCkcGS1YDi8LdymZBIp4VPhgCkXFL519GSJnx1Ol/jTYTMWDYO7RdiX/sXJX6xkTF1YXo5fz64o5fs4L/GoublZiZ3iHVhEmSCEjynGCRNkgBGZg/QySJ+sqJLf/5M/TV5yFZkN1jBZJk2GAgFRV6S6KlETXZWRZc3p/9++WtrQYKm6JwR1T7b92gX1W/BVtO2PQ9v+OoKaR7jIVfLzBzD8Jnqxovn3wbsBZ5cVLbkD55vQ/mAkzMSPVCPu1jR4OYHmOLReQ+NiqWflfY7vIbYuX3UFu3vQLee9S99Ea2fW0Bl/jQAAAAlwSFlzAAAuIwAALiMBeKU/dgAAA0dJREFUeJzt1kFKI1EUQNEkJioZZKID97+iLMNBMhGEkCqx501XgdWRK3jO9PE/r364kPXxeFwBnU29APx2IoSYCCEmQoiJEGIihJgIISZCiIkQYiKEmAghJkKIiRBiIoSYCCEmQoiJEGIihJgIISZCiIkQYiKEmAghJkKIiRBiIoSYCCEmQoiJEGIihJgIISZCiIkQYiKEmAghJkKIiRBiIoSYCCEmQoiJEGLbeoG/bbfb5+fnBQfP5/MwDP8cHQ6H/X7/1QvHcTydTlPTl5eXBZvM2O/3h8Phq6dWq9Xr6+vU6OnpabfbLbhzyjAM5/N5avpz3mTG6XQax/G2d/6nHxfhZrN5fHxcdnBqtNvtFtx5vV5npjMXzmwy4+7ubtmHz3h4eLi/v7/hhev1emY6s//8wSnf8SbLfp1v9eMWgt9GhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEEBMhxEQIMRFCTIQQEyHERAgxEUJMhBATIcRECDERQkyEENvWC/zt4+Pj7e1t2cGp0eVy+fz8vOGFq9VqZsn5g1Ou1+uyD5/x/v5+uVxueOE4jjPTm7/JMAw3f5Nlm3yr9fF4rHeAX83fUYiJEGIihJgIISZCiIkQYiKEmAghJkKIiRBiIoSYCCEmQoiJEGIihJgIISZCiIkQYiKEmAghJkKIiRBiIoSYCCEmQoiJEGIihJgIISZCiIkQYiKEmAghJkKIiRBiIoSYCCEmQoj9AR3UZeJSxlvaAAAAAElFTkSuQmCC";break;default:throw Error("Unknown mode "+e)}void 0===t?this.setState({clipboardMode:e,clipboardImage:i}):this.setState({clipboardMode:e,clipboardImage:i,clipboardText:t})}writeTextOrImage(){this.state.clipboardImage?this.writeImage():this.writeText()}writeText(){navigator.clipboard.writeText(this.state.clipboardText)}async writeImage(){try{const e=`${this.state.clipboardText}`;await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"})})]),console.log("Image with alt text copied to clipboard")}catch(e){console.error("Failed to copy:",e)}}};let BI=null,QI=null;var EI=new class extends lI{constructor(){super({hasBrowserFilePicker:"showOpenFilePicker"in window,file:null,handle:null,watchInterval:null})}pauseWatching(){clearInterval(this.state.watchInterval),this.setState({watchInterval:null})}stopWatching(){clearInterval(this.state.watchInterval),this.setState({file:null,handle:null,watchInterval:null})}startWatching(){clearInterval(this.state.watchInterval);let e=setInterval((async()=>{if(!this.state.handle)return e=null,this.stopWatching();let t=null;if(t=this.state.handle.file instanceof Function?await this.getFileEntryPromise().catch(this.catchFileReaderError):await this.state.handle.getFile().catch(this.catchFileReaderError),!t)return e=null,this.stopWatching();t.lastModified!==this.state.file.lastModified&&this.setState({file:t})}),500);e&&this.setState({watchInterval:e})}async onUploadFile(e){if(this.stopWatching(),e.stopPropagation(),"click"!==e.type||!0!==this.state.hasBrowserFilePicker)console.log("Else on OLD brower new file loaded");else{e.preventDefault();try{const[e]=await window.showOpenFilePicker(),t=await e.getFile();this.setState({file:t,handle:e}),this.startWatching()}catch(e){II.error("Cannot upload file. File synchronization lost"),this.stopWatching()}}}async onDownloadFile(e,t){this.stopWatching();const i=await fetch(t,{method:"GET",headers:uI.buildHeaders()}).then((function(e){return e.blob()}));if(!0===this.state.hasBrowserFilePicker)try{const t=await this.getSavingFileHandle(e),n=await t.getFile();this.setState({file:n,handle:t});const s=await t.createWritable();await s.write(i),await s.close(),this.startWatching()}catch(e){II.error("Cannot download file. File synchronization lost "+e.toString()),this.stopWatching()}else{const t=window.URL.createObjectURL(i),n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),n.remove()}}async onDropFile(e){this.stopWatching(),e.preventDefault();const t=e.dataTransfer.items[0].webkitGetAsEntry();t.isFile&&t.file((async e=>{BI=await new Response(e).arrayBuffer(),QI=e.lastModified,this.setState({file:e,handle:t}),this.startWatching()}))}getFileEntryPromise(){return new Promise(((e,t)=>{this.state.handle?.file((async t=>{const i=await new Response(t).arrayBuffer(),n=!0===this.isSameArrayBuffer(i,BI)?QI:Date.now();QI!==n&&(QI=n,BI=i);const s=new File([i],t.name,{lastModified:n,type:t.type});e(s)}),(e=>t(e)))}))}catchFileReaderError(e){II.error("Stopping auto-save. File synchronization lost. Please download or upload your template to restart the synchronization")}async getSavingFileHandle(e){const t={suggestedName:e,types:[{description:"Document"}]};return await window.showSaveFilePicker(t)}async writeURLToFile(e,t){const i=await e.createWritable(),n=await fetch(t);await n.body.pipeTo(i)}isSameArrayBuffer(e,t){if(e.byteLength!==t.byteLength)return!1;const i=new Uint8Array(e),n=new Uint8Array(t),s=!0===(80===i[0]&&75===i[1]&&3===i[2]&&4===i[3])?30:i.length;for(let e=0;et.bind(i)(e.detail);bI.map.set(t,n),bI.node.addEventListener(e,n)},send(e,t){bI.node.dispatchEvent(new CustomEvent(e,{detail:t}))},off(e,t){const i=bI.map.get(t);bI.node.removeEventListener(e,i)}};var yI={VERSION:"5.0.0-beta.6",LOCALES:["fr-fr","en-us","en-be","en-gb","nl-nl","nl-be","af","sq","am","ar","ar-dz","ar-bh","ar-eg","ar-iq","ar-jo","ar-kw","ar-lb","ar-ly","ar-ma","ar-om","ar-qa","ar-sa","ar-sy","ar-tn","ar-ae","ar-ye","hy","az-az","be","bn","bs","bg","my","zh-cn","zh-hk","zh-mo","zh-sg","zh-tw","hr","cs","da","en-au","en-bz","en-ca","en-cb","en-in","en-ie","en-jm","en-nz","en-ph","en-za","en-tt","et","mk","fo","fa","fi","fr-be","fr-ca","fr-lu","fr-ch","rm-ch","gd-ie","de-at","de-de","de-li","de-lu","de-ch","el","gn","he","hi","hu","is","id","it-it","it-ch","ja","kn","kk","km","ko","lo","lv","lt","ms-bn","ms-my","ml","mt","mi","mr","mn","ne","no-no","or","pl","pt-br","pt-pt","ro-mo","ro","ru","ru-mo","sa","sr-sp","si","sk","sl","so","es-ar","es-bo","es-cl","es-co","es-cr","es-do","es-ec","es-sv","es-gt","es-hn","es-mx","es-ni","es-pa","es-py","es-pe","es-pr","es-es","es-uy","es-ve","sw","sv-fi","sv-se","tg","ta","te","th","bo","ts","tr","tk","uk","ur","uz-uz","vi","cy","xh","yi","zu","az","de","es","it","fr","nl","en"],CURRENCIES:[["EUR","Euros"],["USD","US Dollar"],["GBP","British Pound"],["CAD","Canadian Dollar"],["CHF","Swiss Franc"],["AED","Emirati Dirham"],["AFN","Afghan Afghani"],["ALL","Albanian lek"],["AMD","Armenian dram"],["ANG","Dutch Guilder"],["AOA","Angolan Kwanza"],["ARS","Argentine peso"],["AUD","Australian Dollar"],["AWG","Arubin florin"],["AZN","Azerbaijani manat"],["BAM","Bosnian Convertible Marka"],["BBD","Barbadian dollar"],["BDT","Bangladeshi Taka"],["BGN","Bulgarian lev"],["BHD","Bahraini Dinar"],["BIF","Burundian Franc"],["BMD","Bermudian dollar"],["BND","Bruneian Dollar"],["BOB","Bolivian Boliviano"],["BRL","Brazilian real"],["BSD","Bahamian dollar"],["BTN","Bhutanese Ngultrum"],["BWP","Botswana Pula"],["BYN","Belarusian ruble"],["BZD","Belize dollar"],["CLP","Chilean Peso"],["CNY","Yuan or chinese renminbi"],["COP","Colombian peso"],["CRC","Costa Rican colón"],["CUC","Cuban convertible peso"],["CUP","Cuban peso"],["CVE","Cape Verdean Escudo"],["CZK","Czech koruna"],["DJF","Djiboutian Franc"],["DKK","Danish krone"],["DOP","Dominican peso"],["DZD","Algerian Dinar"],["EGP","Egyptian Pound"],["ERN","Eritrean nakfa"],["ETB","Ethiopian Birr"],["FJD","Fijian dollar"],["FKP","Falkland Island Pound"],["GEL","Georgian lari"],["GHS","Ghanaian Cedi"],["GIP","Gibraltar pound"],["GMD","Gambian dalasi"],["GNF","Guinean Franc"],["GTQ","Guatemalan Quetzal"],["GYD","Guyanese dollar"],["HKD","Hong Kong dollar"],["HNL","Honduran lempira"],["HRK","Croatian kuna"],["HTG","Haitian gourde"],["HUF","Hungarian forint"],["IDR","Indonesian Rupiah"],["ILS","Israeli Shekel"],["INR","Indian Rupee"],["IQD","Iraqi Dinar"],["IRR","Iranian Rial"],["ISK","Icelandic Krona"],["JMD","Jamaican dollar"],["JOD","Jordanian Dinar"],["JPY","Japanese yen"],["KES","Kenyan Shilling"],["KGS","Kyrgyzstani som"],["KHR","Cambodian Riel"],["KMF","Comoran Franc"],["KPW","North Korean won"],["KRW","South Korean won"],["KWD","Kuwaiti Dinar"],["KYD","Caymanian Dollar"],["KZT","Kazakhstani tenge"],["LAK","Lao or Laotian Kip"],["LBP","Lebanese Pound"],["LKR","Sri Lankan Rupee"],["LRD","Liberian Dollar"],["LSL","Lesotho loti"],["LTL","Lithuanian litas"],["LYD","Libyan Dinar"],["MAD","Moroccan Dirham"],["MDL","Moldovan Leu"],["MGA","Malagasy Ariary"],["MKD","Macedonian Denar"],["MMK","Burmese Kyat"],["MNT","Mongolian Tughrik"],["MOP","Macau Pataca"],["MRO","Mauritanian Ouguiya"],["MUR","Mauritian rupee"],["MVR","Maldivian Rufiyaa"],["MWK","Malawian Kwacha"],["MXN","Mexico Peso"],["MYR","Malaysian Ringgit"],["MZN","Mozambican Metical"],["NAD","Namibian Dollar"],["NGN","Nigerian Naira"],["NIO","Nicaraguan córdoba"],["NOK","Norwegian krone"],["NPR","Nepalese Rupee"],["NZD","New Zealand Dollar"],["OMR","Omani Rial"],["PAB","Balboa panamérn"],["PEN","Peruvian nuevo sol"],["PGK","Papua New Guinean Kina"],["PHP","Philippine Peso"],["PKR","Pakistani Rupee"],["PLN","Polish złoty"],["PYG","Paraguayan guarani"],["QAR","Qatari Riyal"],["RON","Romanian leu"],["RSD","Serbian Dinar"],["RUB","Russian Rouble"],["RWF","Rwandan franc"],["SAR","Saudi Arabian Riyal"],["SBD","Solomon Islander Dollar"],["SCR","Seychellois Rupee"],["SDG","Sudanese Pound"],["SEK","Swedish krona"],["SGD","Singapore Dollar"],["SLL","Sierra Leonean Leone"],["SOS","Somali Shilling"],["SRD","Surinamese dollar"],["SSP","South Sudanese pound"],["SYP","Syrian Pound"],["SZL","Swazi Lilangeni"],["THB","Thai Baht"],["TJS","Tajikistani somoni"],["TMT","Turkmenistan manat"],["TND","Tunisian Dinar"],["TOP","Tongan Pa'anga"],["TRY","Turkish Lira"],["TTD","Trinidadian dollar"],["TWD","Taiwan New Dollar"],["TZS","Tanzanian Shilling"],["UAH","Ukrainian Hryvnia"],["UGX","Ugandan Shilling"],["UYU","Uruguayan peso"],["UZS","Uzbekistani som"],["VEF","Venezuelan bolivar"],["VND","Vietnamese Dong"],["VUV","Ni-Vanuatu Vatu"],["WST","Samoan Tālā"],["XCD","East Caribbean dollar"],["XOF","CFA Franc"],["XPF","CFP Franc"],["YER","Yemeni Rial"],["ZAR","South African Rand"],["ZMW","Zambian Kwacha"],["ZWD","Zimbabwean Dollar"],["BTC","Bitcoin"],["ETH","Ether"],["XRP","Ripple"],["BCH","Bitcoin Cash"],["BSV","Bitcoin SV"],["LTC","Litecoin"],["USDT","Tether"],["EOS","EOS"],["BNB","Binance Coin"],["XTZ","Tezos"],["ADA","Cardano"],["LINK","ChainLink"],["XMR","Monero"],["XLM","Stellar"],["TRX","Tron"],["HT","Huobi Token"],["ETC","Ethereum Classic"],["NEO","Neo"],["DASH","Dash"],["LEO","UNUS SED LEO"],["ATOM","Cosmos"],["CRO","crypto.com"],["HEDG","Hedge Trade"],["MIOTA","IOTA"],["MKR","MAKER"],["ZEC","Zcash"],["ONT","Ontology"],["XEM","NEM"],["USDC","USD Coin"],["VET","VeChain"],["BAT","Basic Attention Token"],["OKB","OKB"]],INPUT_OUTPUT:{docx:["pdf","docx","odt","txt","jpg"],xlsx:["pdf","xlsx","csv","ods"],pptx:["pdf","pptx","txt","jpg"],odt:["pdf","docx","odt","txt","jpg"],fodt:["pdf","docx","odt","txt","jpg"],ods:["pdf","xlsx","csv","ods"],odp:["pdf","pptx","jpg"],odg:["pdf","vsdx","jpg"],vsdx:["pdf","odg","jpg"],md:["pdf","html"],html:["pdf","html"]},TEMPLATE_TYPES:[{name:"Microsoft Word",blankName:"demo-0fr.docx",format:"docx",icon:"cico-file-docx"},{name:"Microsoft Excel",blankName:"demo-0fr.xlsx",format:"xlsx",icon:"cico-file-xlsx"},{name:"Microsoft Powerpoint",blankName:"demo-0fr.pptx",format:"pptx",icon:"cico-file-pptx"},{name:"Microsoft Visio",blankName:"demo-0fr.odg",format:"vsdx",icon:"cico-file-odf"},{name:"LibreOffice Writer",blankName:"demo-0fr.odt",format:"odt",icon:"cico-file-odt"},{name:"LibreOffice Calc",blankName:"demo-0fr.ods",format:"ods",icon:"cico-file-ods"},{name:"LibreOffice Impress",blankName:"demo-0fr.odp",format:"odp",icon:"cico-file-odp"},{name:"LibreOffice Draw",blankName:"demo-0fr.odg",format:"odg",icon:"cico-file-odf"},{name:"Markdown",blankName:"demo-0fr.md",format:"md",icon:"cico-file-md"},{name:"Simple HTML",blankName:"demo-0fr.html",format:"html",icon:"cico-file-html"},{name:"Advanced HTML",blankName:"demo-0fr.html",format:"html",icon:"cico-file-html"}],FORMATTERS:{aggSum:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"total SUM"},aggStr:{params:[{name:"separator",desc:"[optional] by default ', '",types:["String"],optional:!1},{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"Aggregate string"},aggStrD:{params:[{name:"separator",desc:"[optional] by default ', '",types:["String"],optional:!1},{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"Aggregate distinct strings"},cumSum:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"Cumulative SUM"},aggAvg:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"AVG aggregator"},cumAvg:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"Cumulative AVG"},aggMin:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"min aggregator"},aggMax:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"max aggregator"},aggCount:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"count aggregator"},cumCount:{params:[{name:"partitionBy",desc:"[optional] group by",types:["Mixed"],optional:!1}],summary:"Cumulative COUNT
\nTODO : manage partitionBy"},aggCountD:{params:[],summary:"Count the total number of distinct values"},cumCountD:{params:[],summary:"Cumulative count of distinct values"},arrayJoin:{params:[{name:"separator",desc:"[optional] item separator (, by default)",types:["String"],optional:!1},{name:"index",desc:"[optional] select items from this array index.",types:["Number"],optional:!1},{name:"count",desc:"[optional] number of items to select from index. count can be a negative number to select N items from the end of the array.",types:["Number"],optional:!1}],summary:"Flatten an array of String or Number"},arrayMap:{params:[{name:"objSeparator",desc:"[optional] object separator (, by default)",types:["String"],optional:!1},{name:"attSeparator",desc:"[optional] attribute separator (: by default)",types:["String"],optional:!1},{name:"attributes",desc:"[optional] list of object's attributes to print",types:["String"],optional:!1}],summary:"Flatten an array of objects"},count:{params:[{name:"start",desc:"Number to start with (default: 1)",types:["String"],optional:!1}],summary:"Count and print row number of any array"},barcode:{params:[{name:"type",desc:"Barcode type: ean13, ean8, code128, code39, gs1-128, qrcode, swissqrcode, and more...",types:["String"],optional:!1}],summary:"Generate a barcode as an image or as a font."},chart:{params:[],summary:'Generate advanced charts using Apache ECharts object descriptors'},color:{params:[{name:"scope",desc:"Specifies the element to be color-changed
- p : the current paragraph where the tag is (by default)
- cell : the current cell of a table
- row : the current row of a table
- shape : the current shape
- part : for text section (the color is applied within the same styled of the element)",types:["String"],optional:!1},{name:"type",desc:"Sefines the property to be modified and supports - text for the text color (by default)
- highlight to highlight the text
- background for cells, rows and shapes
- border for shapes only",types:["String"],optional:!1}],summary:"Apply the color on the text, paragraph, table row or table cell"},shadeColor:{params:[{name:"shadeFactor",desc:"The shading factor (positive to lighten, negative to darken).",types:["number"],optional:!1}],summary:"Creates a shade of a given hex color."},and:{params:[{name:"value",desc:"[optional] new value to test",types:["Mixed"],optional:!1}],summary:"Change the default operator between conditional formatters."},or:{params:[{name:"value",desc:"[optional] new value to test",types:["Mixed"],optional:!1}],summary:"OR is the default operator between conditional formatters."},ifEM:{params:[],summary:"Matches empty values, string, arrays or objects (null, undefined, [], {}, ...), it replaces ifEmpty."},ifNEM:{params:[],summary:"Matches not empty values, string, arrays or objects."},ifEQ:{params:[{name:"value",desc:"value to test",types:["String","Integer"],optional:!1}],summary:"Matches all values that are equal to a specified value. It can be combined with other formatters to create conditional content. It returns the initial marker. The state of the condition is not returned."},ifNE:{params:[{name:"value",desc:"value to test",types:["String","Integer"],optional:!1}],summary:"Matches all values that are not equal to a specified value. It can be combined with other formatters to create conditional content. It returns the initial marker. The state of the condition is not returned."},ifGT:{params:[{name:"value",desc:"value to test",types:["Integer"],optional:!1}],summary:"Matches values that are greater than a specified value."},ifGTE:{params:[{name:"value",desc:"value to test",types:["Integer"],optional:!1}],summary:"Matches values that are greater than or equal to a specified value."},ifLT:{params:[{name:"value",desc:"value to test",types:["Integer"],optional:!1}],summary:"Matches values that are less than a specified value."},ifLTE:{params:[{name:"value",desc:"value to test",types:["Integer"],optional:!1}],summary:"Matches values that are less than or equal to a specified value."},ifIN:{params:[{name:"value",desc:"value to test",types:["Integer"],optional:!1}],summary:"Matches any of the values specified in an array or string, it replaces ifContain."},ifNIN:{params:[{name:"value",desc:"value to test",types:["Integer"],optional:!1}],summary:"Matches none of the values specified in an array or string."},ifTE:{params:[{name:"type",desc:"can be "string", "number", "integer", "boolean", "binary", "object", "array"",types:["String"],optional:!1}],summary:"Tests the type of the operand's value."},show:{params:[{name:"message",desc:"message to print",types:"[object Object]",optional:!1}],summary:"Print a message if the condition is true. It should be used with other formatters to print conditional content."},elseShow:{params:[{name:"message",desc:"message to print",types:"[object Object]",optional:!1}],summary:"Print a message if the condition is false. It should be used with other formatters to print conditional content."},ifEmpty:{params:[{name:"textIfTrue",desc:"textIfTrue to print if JSON data is empty",types:["String"],optional:!1},{name:"continueOnSuccess",desc:"[optional], if true, next formatter will be called even if the condition is true",types:["Boolean"],optional:!1}],summary:"Test if data is empty (null, undefined, [], {}, ...)."},ifEqual:{params:[{name:"value",desc:"value to test",types:["String","Integer","Boolean"],optional:!1},{name:"textIfTrue",desc:"message to print if the value equals JSON data",types:["String"],optional:!1},{name:"continueOnSuccess",desc:"[optional], if true, next formatter will be called even if the condition is true",types:["Boolean"],optional:!1}],summary:"Test if a value equals a variable."},ifContain:{params:[{name:"value",desc:"value to search",types:["String","Integer","Boolean"],optional:!1},{name:"textIfTrue",desc:"message to print if JSON data contains the value",types:["String"],optional:!1},{name:"continueOnSuccess",desc:"[optional], if true, next formatter will be called even if the condition is true",types:["Boolean"],optional:!1}],summary:"Test if a string or an array contains a value."},formatD:{params:[{name:"patternOut",desc:"output format",types:["String"],optional:!1},{name:"patternIn",desc:"input format, "ISO 8601" by default",types:["String"],optional:!0}],summary:"Format dates."},formatI:{params:[{name:"patternOut",desc:"output format: human, human+, milliseconds, seconds, ...",types:["String"],optional:!1},{name:"patternIn",desc:"[optional] input unit: milliseconds, seconds, ...",types:["String"],optional:!1}],summary:"Format intervals and duration. List of format name :\n
    \n
  • human+
  • \n
  • human
  • \n
  • millisecond(s) or ms
  • \n
  • second(s) or s
  • \n
  • minute(s) or m
  • \n
  • hour(s) or h
  • \n
  • year(s) or y
  • \n
  • month(s) or M
  • \n
  • week(s) or w
  • \n
  • day(s) or d
  • \n
"},addD:{params:[{name:"amount",desc:"The amount",types:["Number"],optional:!1},{name:"unit",desc:"The unit",types:["String"],optional:!1},{name:"patternIn",desc:"[optional] input format, ISO8601 by default",types:["String"],optional:!1}],summary:"Add a time to a date. Available units: day, week,\tmonth, quarter, year, hour, minute, second and millisecond.
\nUnits are case insensitive, and support plural and short forms."},subD:{params:[{name:"amount",desc:"The amount",types:["Number"],optional:!1},{name:"unit",desc:"The unit",types:["String"],optional:!1},{name:"patternIn",desc:"[optional] input format, ISO8601 by default",types:["String"],optional:!1}],summary:"Subtract a time to a date. Available units: day, week,\tmonth, quarter, year, hour, minute, second and millisecond.
\nUnits are case insensitive, and support plural and short forms."},startOfD:{params:[{name:"unit",desc:"The unit",types:["String"],optional:!1},{name:"patternIn",desc:"[optional] input format, ISO8601 by default",types:["String"],optional:!1}],summary:"Create a date and set it to the start of a unit of time."},endOfD:{params:[{name:"unit",desc:"The unit",types:["String"],optional:!1},{name:"patternIn",desc:"[optional] input format, ISO8601 by default",types:["String"],optional:!1}],summary:"Create a date and set it to the end of a unit of time."},diffD:{params:[{name:"toDate",desc:"to date",types:["String","Number"],optional:!1},{name:"unit",desc:"The output unit: day, week, ... see the list above. Milliseconds by default.",types:["String"],optional:!1},{name:"patternFromDate",desc:"[optional] The pattern of fromDate, ISO8601 by default",types:["String"],optional:!1},{name:"patternToDate",desc:"[optional] The pattern of toDate, ISO8601 by default",types:["String"],optional:!1}],summary:"Compute the difference between two dates and get an interval. List of available output units for the interval:\n
    \n
  • day(s) or d Day of Week (Sunday as 0, Saturday as 6)
  • \n
  • week(s) or w Week of Year
  • \n
  • quarter(s) or Q Quarter
  • \n
  • month(s) or M Month (January as 0, December as 11)
  • \n
  • year(s) or y Year
  • \n
  • hour(s) or h Hour
  • \n
  • minute(s) or m Minute
  • \n
  • second(s) or s Second
  • \n
  • millisecond(s) or ms Millisecond
  • \n
"},convDate:{params:[{name:"patternIn",desc:"input format",types:["String"],optional:!1},{name:"patternOut",desc:"output format",types:["String"],optional:!1}],summary:"Format dates"},appendFile:{params:[],summary:"Append an external file inside the generated the document"},attachFile:{params:[{name:"name",desc:"file name",types:["String"],optional:!1},{name:"type",desc:"attachment type AFRelationship. Can be "Source", "Data" (by default), "Alternative", "Supplement", "Unspecified", "FormData", "Schema".",types:["String"],optional:!1}],summary:"Attach an external file inside the generated the document"},formatN:{params:[{name:"precision",desc:"Number of decimals",types:["Number"],optional:!0}],summary:"Format number according to the locale.
\nApplying a number of decimals depends on the report type:\n
    \n
  • For ODS/XLSX, the number of decimals has to be formatted based on the text editor.
  • \n
  • For the other type of files, the number of decimals depends on the precision parameter passed to the formatter.
  • \n
"},formatC:{params:[{name:"precisionOrFormat",desc:"[optional] Number of decimal, or specific format
- Integer : change default precision of the currency
- M : print Major currency name without the number
- L : prints number with currency symbol (by default)
- LL : prints number with Major currency name",types:["Number"],optional:!1},{name:"targetCurrency",desc:"[optional] target currency code (upper case). Ex: USD, EUR, ... It overwrites the global option options.currencyTarget",types:["String"],optional:!1}],summary:""},convCurr:{params:[{name:"target",desc:"[optional] convert to this currency ('EUR'). By default it equals options.currencyTarget",types:["String"],optional:!1},{name:"source",desc:"[optional] currency of source data ('USD'). By default it equals options.currencySource",types:["String"],optional:!1}],summary:"Convert from one currency to another"},round:{params:[{name:"precision",desc:"number of decimal",types:["Number"],optional:!1}],summary:"Round a number"},add:{params:[{name:"value",desc:"Value to add",types:["Number"],optional:!1}],summary:"Add two numbers"},sub:{params:[{name:"value",desc:"Value to substract",types:["Number"],optional:!1}],summary:"Substract two numbers"},mul:{params:[{name:"value",desc:"Value to multiply",types:["Number"],optional:!1}],summary:"Multiply two numbers"},div:{params:[{name:"value",desc:"Value to divide",types:["Number"],optional:!1}],summary:"Divide two numbers"},mod:{params:[{name:"value",desc:"Y",types:["Number"],optional:!1}],summary:"Compute modulo"},abs:{params:[],summary:"Get absolute value"},ceil:{params:[],summary:"Rounds towards closest higher integer number"},floor:{params:[],summary:"Rounds towards closest lower integer number."},int:{params:[],summary:"Converts a number to an INT"},toEN:{params:[],summary:"Converts a number with English specifications (decimal separator is '.')"},toFixed:{params:[],summary:"Converts a number into string, keeping only decimals"},toFR:{params:[],summary:"Converts a number with French specifications (decimal separator is ',')"},set:{params:[{name:"param",desc:"destination variable in data. Ex. d.myNewVariable",types:["String"],optional:!1}],summary:"Store result into data object {d. for later use. Current limits\n
    \n
  • accepts only to store values at the root level of d, and only in d.
  • \n
  • cannot be used in aliases
  • \n
"},lowerCase:{params:[],summary:"Lower case all letters"},upperCase:{params:[],summary:"Upper case all letters"},ucFirst:{params:[],summary:"Upper case first letter"},ucWords:{params:[],summary:"Upper case the first letter of all words"},print:{params:[{name:"message",desc:"text to print",types:["String"],optional:!1}],summary:"Always return the same message if called (sort of "catch all" formatter)"},printJSON:{params:[],summary:"Stringify the object/array"},convEnum:{params:[{name:"type",desc:"enum name passed in options of carbone.render(data, options)",types:["String"],optional:!1}],summary:"Convert user-defined enums to human readable values"},unaccent:{params:[],summary:"Removes accents from text"},convCRLF:{params:[],summary:"It renders carriage return \\\\r\\\\n and line feed \\\\n into documents instead of printing them as a string.
\nImportante notes:\n
    \n
  • Feature supported for DOCX, PPTX, ODT, ODP, and ODS files.
  • \n
  • ODS supports is experimental for now, contact the support if you find issues.
  • \n
  • Since v3.5.3, using the :convCRLF formatter before :html converts \\\\n to <br> tags. Usage example: {d.content:convCRLF:html}
  • \n
"},substr:{params:[{name:"begin",desc:"Zero-based Index at which to begin extraction.",types:["Integer"],optional:!1},{name:"end",desc:"[optional] Zero-based index before which to end extraction",types:["Integer"],optional:!1},{name:"wordMode",desc:"[optional] If true, it never cuts words. In such a case:
- end must be greater than begin and negative values cannot be used. end - begin = maximum number of characters per line of text
- A word can only be truncated only if it does not fit in the line.
In this case, the word always starts at the beginning of a new line, just like in Word or LibreOffice
- The same line width (end - begin) must be used between successive calls of substr to print all the words of the text (no gaps). Ex:
{d.text(0 , 50 , true)} -> line 1 of 50 characters
{d.text(50 , 100, true)} -> line 2 of 50 characters
{d.text(100, 150, true)} -> line 3 of 50 characters
{d.text(150, 200, last)} -> line 4 of infinite characters
- last can be used instead of true to print the rest of the text, even if it is longer than the defined line width",types:["Mixed"],optional:!1}],summary:"Slice a string with a begin and an end."},split:{params:[{name:"delimiter",desc:"The delimiter",types:["String"],optional:!1}],summary:"Split a string using a delimiter"},padl:{params:[{name:"targetLength",desc:"The length of the resulting string once the string has been padded. If the value is less than string length, then string is returned as-is.",types:["number"],optional:!1},{name:"padString",desc:"The string to pad the current str with. If padString is too long to stay within the targetLength, it will be truncated from the end. The default value is " "",types:["String"],optional:!1}],summary:"Pad the string from the start with another string"},padr:{params:[{name:"targetLength",desc:"The length of the resulting string once the string has been padded. If the value is less than string length, then string is returned as-is.",types:["number"],optional:!1},{name:"padString",desc:"The string to pad the current str with. If padString is too long to stay within the targetLength, it will be truncated from the end. The default value is " "",types:["String"],optional:!1}],summary:"Pad the string from the end with another string"},ellipsis:{params:[{name:"maximum",desc:"number of characters to print.",types:["Integer"],optional:!1}],summary:"Add "..." if the text is too long"},prepend:{params:[{name:"textToPrepend",desc:"text to prepend",types:["string"],optional:!1}],summary:"add a prefix to a text"},append:{params:[{name:"textToAppend",desc:"text to append",types:["string"],optional:!1}],summary:"Add a suffix to a text"},replace:{params:[{name:"oldText",desc:"old text to replace",types:["string"],optional:!1},{name:"newText",desc:"new text",types:["string"],optional:!1}],summary:"Replace a text based on a pattern"},len:{params:[],summary:"Returns the length of a string or array."},t:{params:[],summary:"Translate the text using the translation dictionnary"},preserveCharRef:{params:[],summary:"Preserve character reference"},transform:{params:[{name:"axis",desc:"The axis: xor y",types:["String"],optional:!1},{name:"unit",desc:"The unit: cm, mm, inch, or pt",types:["String"],optional:!1}],summary:"Move a shape or an image on the X or Y axis"},sign:{params:[],summary:"Place a signature mark"}}};var wI=new class extends lI{constructor(){super({panelMode:"templateIntro",templateIntro:{design:.6,preview:1},templateGenerator:{design:2,preview:1},templateOnlineEdit:{design:1,preview:1},templateLocalEdit:{design:"none",preview:1},panelTemplateHoverAnimation:""})}switchTo(e,t=!0,i=0){if(!0===t)return clearTimeout(this.debouncePanelModeChange),void(this.debouncePanelModeChange=setTimeout((()=>{this.setState({panelMode:e})}),i));this.state.panelMode=e}getFlexSize(e){return this.state?.[this.state.panelMode]?.[e]??1}};const kI=function({state:e}){return[A("main",{onkeydown:("function"==typeof onKeyDown?onKeyDown.bind(this):this.onKeyDown).bind(this),style:"height:inherit;display: flex; flex-direction: column;"},[window.isSecureContext?"":A("div",{class:"dialog-code"},[A("div",{class:"overlay active"},""),A("dialog",{class:"modal active",id:"dialog-modal",open:""},[A("p",{},A("strong",{},"⚠️ Error: Human intervention required!")),A("p",{},["Carbone Studio must run in a ",A("strong",{},"Secure Context"),"."]),A("p",{},A("strong",{},"Solutions:")),A("ul",{},[A("li",{},"Use the Studio only over HTTPS or from http://localhost"),A("li",{},["Add the Studio's URL to this setting in your browser:",A("br",{},""),"\n chrome://flags/#unsafely-treat-insecure-origin-as-secure",A("br",{},""),"\n edge://flags/#unsafely-treat-insecure-origin-as-secure\n "]),A("li",{},"Developers: Load the JavaScript module over HTTPS or from http://localhost")]),A("p",{},["Why? Because the Studio requires these technologies:",A("br",{},""),"Web Workers, File System API, and Clipboard API"]),A("p",{},["What is a Secure Context? \n ",A("a",{href:"https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts",target:"_blank"},"Learn more here")])])]),"alpha"!==e.carboneMode?A("header",{class:"surface"},[A("nav",{},[A("i",{class:"cico cico-app-icon"},""),"welcome"!==e.carboneMode&&"dev"===window?.build?A("button",{onclick:("function"==typeof exitToWelcome?exitToWelcome.bind(this):this.exitToWelcome).bind(this),class:"circle transparent"},[A("i",{class:"cico cico-arrow-back"},"")]):"",A("div",{class:"max"},""),"welcome"!==e.carboneMode&&fI?.state?.idTemplateOpened?A("button",{class:"round transparent",onclick:("function"==typeof copyTemplateID?copyTemplateID.bind(this):this.copyTemplateID).bind(this)},[A("span",{},`ID: ${fI?.state?.idTemplateOpened.slice(0,10)}...`),A("div",{class:"tooltip bottom"},""+(!0===e.templateIdCopied?"Copied!":"Copy Template ID"))]):"",A("slot",{name:"menu"},"")])]):"","welcome"===e.carboneMode?A("c-flex",{class:"h animate height-minus-header",style:"flex: 1; overflow: hidden;"},[A("c-home-index",{},""),A("div",{class:e.loadingClass},"")]):"","welcome"!==e.carboneMode?A("c-flex",{class:"h animate height-minus-header",style:"flex: 1; overflow: hidden;"},[A("c-flex-panel",{class:"",style:"flex: 1"},[A("c-data-editor",{},""),A("div",{class:e.loadingClassPan},"")]),A("c-flex-resizer",{},""),A("c-flex",{class:"v animate",style:"flex: 1; overflow: hidden;"},[A("c-flex-panel",{class:"",style:`flex: ${wI.getFlexSize("design")}; flex-basis: 48px; /* keep header height to improve animation */`},[A("c-template-panel",{class:""+("templateLocalEdit"===wI.state.panelMode?"minimized":"")},""),A("div",{class:e.loadingClassPan,style:"animation-delay: 200ms;"},"")]),"templateLocalEdit"!==wI.state.panelMode?A("c-flex-resizer",{},""):"",A("c-flex-panel",{class:"",style:`flex: ${wI.getFlexSize("preview")};`},[A("c-preview",{},""),A("div",{class:e.loadingClassPan,style:"animation-delay: 400ms;"},"")])])]):""])]},SI=function({state:e}){return A("style",{},"\n \n \n \n \n \n ")};let vI=class extends S{init(){this.useShadowDOM=!0}get vdom(){return kI}get vstyle(){return SI}};const DI=function({state:e}){return[A("main",{class:"white welcome"},[A("nav",{class:"wnav surface medium-padding"},[A("button",{onclick:("function"==typeof goToHome?goToHome.bind(this):this.goToHome).bind(this),class:"small-round transparent vertical "+("home"===e.view?"fill":"")},[A("i",{class:"cico cico-home"},""),A("span",{},"Home")]),A("button",{onclick:("function"==typeof goToTemplate?goToTemplate.bind(this):this.goToTemplate).bind(this),class:"small-round transparent vertical ' + (state.view === 'templates' ? 'fill' : '')"},[A("i",{class:"cico cico-list"},""),A("span",{},"Templates")]),A("button",{onclick:("function"==typeof goToBookmark?goToBookmark.bind(this):this.goToBookmark).bind(this),class:"small-round transparent vertical ' + (state.view === 'bookmark' ? 'fill' : '')"},[A("i",{class:"cico cico-bookmark"},""),A("span",{},"Tags")])]),A("div",{class:"wmain"},["templates"===e.view?A("div",{class:"medium-padding center-align"}," Imagine here a list of templates"):"","bookmark"===e.view?A("div",{class:"medium-padding center-align"}," Imagine here a list of bookmarks"):"","home"===e.view?A("div",{},[A("div",{class:"center-align"},[A("button",{onclick:("function"==typeof onSelectTool?onSelectTool.bind(this):this.onSelectTool).bind(this),class:"vertical small-round"},[A("i",{class:"cico cico-add-circle"},""),A("span",{},"Create a template")])]),A("div",{class:"space"},""),A("div",{class:"large-text"},"Recent"),A("div",{class:"small-divider grey-border"},""),A("div",{class:"space"},""),A("div",{class:"files-container"},[A("img",{onclick:("function"==typeof onOpenTemplate?onOpenTemplate.bind(this):this.onOpenTemplate).bind(this),"data-id":"demo-1.docx",src:`${uI.state.origin}/template/demo-1-thumbnail.png`},"")]),A("div",{class:"space"},""),A("div",{class:"space"},""),A("div",{class:"large-text"},"Examples"),A("div",{class:"small-divider grey-border"},""),A("div",{class:"space"},""),A("div",{class:"files-container"},[A("img",{onclick:("function"==typeof onOpenTemplate?onOpenTemplate.bind(this):this.onOpenTemplate).bind(this),"data-id":"demo-1.docx",src:`${uI.state.origin}/template/demo-1-thumbnail.png`},""),A("img",{onclick:("function"==typeof onOpenTemplate?onOpenTemplate.bind(this):this.onOpenTemplate).bind(this),"data-id":"demo-7.docx",src:`${uI.state.origin}/template/demo-7-thumbnail.jpg`},""),A("img",{onclick:("function"==typeof onOpenTemplate?onOpenTemplate.bind(this):this.onOpenTemplate).bind(this),"data-id":"demo-9.docx",src:`${uI.state.origin}/template/demo-9-thumbnail.jpg`},""),A("img",{onclick:("function"==typeof onOpenTemplate?onOpenTemplate.bind(this):this.onOpenTemplate).bind(this),"data-id":"demo-6.docx",src:`${uI.state.origin}/template/demo-6-thumbnail.jpg`},""),A("img",{onclick:("function"==typeof onOpenTemplate?onOpenTemplate.bind(this):this.onOpenTemplate).bind(this),"data-id":"demo-8.docx",src:`${uI.state.origin}/template/demo-8-thumbnail.jpg`},"")])]):""])])]},xI=function({state:e}){return A("style",{},'\n \n \n \n c-home-index {\n width:100%;\n height:100%;\n /* ----------- */\n display: flex; /* displays flex-items (children) inline */\n flex-direction: column; /* stacks them vertically */\n }\n main {\n flex: 1; /* takes the remaining height of the "container" div */\n overflow: auto; /* to scroll just the "main" div */\n }\n \n \n ')};let FI=class extends S{init(){this.useShadowDOM=!0}get vdom(){return DI}get vstyle(){return xI}};const RI=function({state:e}){return[A("div",{class:"editor"},"")]},MI=function({state:e}){return A("style",{},'\n \n \n c-template-online {\n flex: 1; /* takes the remaining height of the "container" div */\n display: flex;\n overflow: auto; /* to scroll just the "main" div */\n }\n .editor {\n display: flex; /* force codemirror tu use all height */\n height: 100%;\n width: 100%;\n }\n .cm-editor {\n /* it forces the editor to add horizontal scroll, even if the parent flex container \n has overlfow:visible */\n width: 0;\n flex-grow: 1;\n }\n \n \n ')};let NI=class extends S{init(){this.useShadowDOM=!0}get vdom(){return RI}get vstyle(){return MI}}; /** * @licstart The following is the entire license notice for the * JavaScript code in this page * * Copyright 2024 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @licend The above is the entire license notice for the * JavaScript code in this page */ var GI={d:(e,t)=>{for(var i in t)GI.o(t,i)&&!GI.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},UI={};GI.d(UI,{PDFViewerApplication:()=>fQ,PDFViewerApplicationConstants:()=>SQ,PDFViewerApplicationOptions:()=>rf});const LI="auto",TI={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},HI={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},OI={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function qI(e,t,i=!1){let n=e.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let s=e.offsetTop+e.clientTop,a=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(s+=n.offsetTop,a+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(void 0!==t.top&&(s+=t.top),void 0!==t.left&&(a+=t.left,n.scrollLeft=a)),n.scrollTop=s}const JI=/[\x00-\x1F]/g;function PI(e,t=!1){return JI.test(e)?t?e.replaceAll(JI,(e=>"\0"===e?"":" ")):e.replaceAll("\0",""):e}function YI(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n>1;t(e[i])?s=i:n=i+1}return n}function KI(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,a=1,r=1,o=1;for(;;){const e=s+r,t=a+o;if(t>8)break;i<=e/t?(r=e,o=t):(s=e,a=t)}return n=i-s/ae}();{var tf=new Map;const e=navigator.userAgent||"",t=navigator.platform||"",i=navigator.maxTouchPoints||1,n=/Android/.test(e);(/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&i>1||n)&&tf.set("maxCanvasPixels",5242880),n&&tf.set("useSystemFonts",!1)}const nf=128,sf={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},af={allowedGlobalEvents:{value:null,kind:1},canvasMaxAreaInBytes:{value:-1,kind:5},isInAutomation:{value:!1,kind:1},localeProperties:{value:{lang:navigator.language||"en-US"},kind:1},nimbusDataStr:{value:"",kind:1},supportsCaretBrowsingMode:{value:!1,kind:1},supportsDocumentFonts:{value:!0,kind:1},supportsIntegratedFind:{value:!1,kind:1},supportsMouseWheelZoomCtrlKey:{value:!0,kind:1},supportsMouseWheelZoomMetaKey:{value:!0,kind:1},supportsPinchToZoom:{value:!0,kind:1},toolbarDensity:{value:0,kind:17},altTextLearnMoreUrl:{value:"",kind:130},cursorToolOnLoad:{value:0,kind:130},debuggerSrc:{value:"./debugger.mjs",kind:2},defaultZoomDelay:{value:400,kind:130},defaultZoomValue:{value:"",kind:130},disableHistory:{value:!1,kind:2},disablePageLabels:{value:!1,kind:130},enableHighlightFloatingButton:{value:!1,kind:130},enableNewAltTextWhenAddingImage:{value:!0,kind:130},enablePermissions:{value:!1,kind:130},enablePrintAutoRotate:{value:!0,kind:130},enableScripting:{value:!0,kind:130},enableUpdatedAddImage:{value:!1,kind:130},externalLinkRel:{value:"noopener noreferrer nofollow",kind:2},externalLinkTarget:{value:0,kind:130},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",kind:130},historyUpdateUrl:{value:!1,kind:130},ignoreDestinationZoom:{value:!1,kind:130},imageResourcesPath:{value:"./images/",kind:2},maxCanvasPixels:{value:2**25,kind:2},forcePageColors:{value:!1,kind:130},pageColorsBackground:{value:"Canvas",kind:130},pageColorsForeground:{value:"CanvasText",kind:130},pdfBugEnabled:{value:!1,kind:130},printResolution:{value:150,kind:2},sidebarViewOnLoad:{value:-1,kind:130},scrollModeOnLoad:{value:-1,kind:130},spreadModeOnLoad:{value:-1,kind:130},textLayerMode:{value:1,kind:130},viewOnLoad:{value:0,kind:130},cMapPacked:{value:!0,kind:4},cMapUrl:{value:"../web/cmaps/",kind:4},disableAutoFetch:{value:!1,kind:132},disableFontFace:{value:!1,kind:132},disableRange:{value:!1,kind:132},disableStream:{value:!1,kind:132},docBaseUrl:{value:"",kind:4},enableHWA:{value:!0,kind:134},enableXfa:{value:!0,kind:132},fontExtraProperties:{value:!1,kind:4},isEvalSupported:{value:!1,kind:4},isOffscreenCanvasSupported:{value:!0,kind:4},maxImageSize:{value:-1,kind:4},pdfBug:{value:!1,kind:4},standardFontDataUrl:{value:"../web/standard_fonts/",kind:4},useSystemFonts:{value:void 0,kind:4,type:sf.BOOLEAN+sf.UNDEFINED},verbosity:{value:1,kind:4},workerPort:{value:null,kind:8},workerSrc:{value:"../build/pdf.worker.mjs",kind:8},defaultUrl:{value:"compressed.tracemonkey-pldi-09.pdf",kind:2},sandboxBundleSrc:{value:"../build/pdf.sandbox.mjs",kind:2},viewerCssTheme:{value:0,kind:130},enableFakeMLManager:{value:!0,kind:2},disablePreferences:{value:!1,kind:2}};class rf{static eventBus;static#e=new Map;static{for(const e in af)this.#e.set(e,af[e].value);for(const[e,t]of tf)this.#e.set(e,t);this._hasInvokedSet=!1,this._checkDisablePreferences=()=>!!this.get("disablePreferences")||(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){const i=Object.create(null);for(const n in af){const s=af[n];(!e||e&s.kind)&&(i[n]=t?s.value:this.#e.get(n))}return i}static set(e,t){this.setAll({[e]:t})}static setAll(e,t=!1){let i;this._hasInvokedSet||=!0;for(const n in e){const s=af[n],a=e[n];if(!s||!(typeof a==typeof s.value||sf[(typeof a).toUpperCase()]&s.type))continue;const{kind:r}=s;(!t||1&r||r&nf)&&(this.eventBus&&16&r&&(i||=new Map).set(n,a),this.#e.set(n,a))}if(i)for(const[e,t]of i)this.eventBus.dispatch(e.toLowerCase(),{source:this,value:t})}}const of={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class Af{externalLinkEnabled=!0;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=i,this._ignoreDestinationZoom=n,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?this.pdfDocument.numPages: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}async goToDestination(e){if(!this.pdfDocument)return;let t,i,n;if("string"==typeof e?(t=e,i=await this.pdfDocument.getDestination(e)):(t=null,i=await e),!Array.isArray(i))return void console.error(`goToDestination: "${i}" is not a valid destination array, for dest="${e}".`);const[s]=i;if(s&&"object"==typeof s){if(n=this.pdfDocument.cachedPageNumber(s),!n)try{n=await this.pdfDocument.getPageIndex(s)+1}catch{return void console.error(`goToDestination: "${s}" is not a valid page reference, for dest="${e}".`)}}else Number.isInteger(s)&&(n=s+1);!n||n<1||n>this.pagesCount?console.error(`goToDestination: "${n}" is not a valid page number, for dest="${e}".`):(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:n})),this.pdfViewer.scrollPageIntoView({pageNumber:n,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom}))}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;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.`)}addLinkAttributes(e,t,i=!1){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const n=i?of.BLANK:this.externalLinkTarget,s=this.externalLinkRel;this.externalLinkEnabled?e.href=e.title=t:(e.href="",e.title=`Disabled: ${t}`,e.onclick=()=>!1);let a="";switch(n){case of.NONE:break;case of.SELF:a="_self";break;case of.BLANK:a="_blank";break;case of.PARENT:a="_parent";break;case of.TOP:a="_top"}e.target=a,e.rel="string"==typeof s?s:"noopener noreferrer nofollow"}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const 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,i;if(e.includes("=")){const n=function(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t}(e);if(n.has("search")){const e=n.get("search").replaceAll('"',""),t="true"===n.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:t?e:e.match(/\S+/g)})}if(n.has("page")&&(t=0|n.get("page")||1),n.has("zoom")){const e=n.get("zoom").split(","),t=e[0],s=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,s?s/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t),n.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:n.get("pagemode")}),n.has("nameddest")&&this.goToDestination(n.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}"string"==typeof i||Af.#t(i)?this.goToDestination(i):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;const t=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;t===this.pdfDocument&&(i.setOCGState(e),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i))}static#t(e){if(!Array.isArray(e)||e.length<2)return!1;const[t,i,...n]=e;if(!("object"==typeof t&&Number.isInteger(t?.num)&&Number.isInteger(t?.gen)||Number.isInteger(t)))return!1;if("object"!=typeof i||"string"!=typeof i?.name)return!1;const s=n.length;let a=!0;switch(i.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return 0===s;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(4!==s)return!1;a=!1;break;default:return!1}for(const e of n)if(!("number"==typeof e||a&&null===e))return!1;return!0}}class cf extends Af{setDocument(e,t=null){}}const lf=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),gf=[1,0,0,1,0,0],hf=[.001,0,0,.001,0,0],df=1.35,uf={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};let If=1;function ff(){return If}function Cf(e){If>=5&&console.log(`Info: ${e}`)}function pf(e){If>=1&&console.log(`Warning: ${e}`)}function mf(e){throw new Error(e)}function Bf(e,t){e||mf(t)}function Qf(e,t,i,n=!1){return Object.defineProperty(e,t,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const Ef=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=new Error,e.constructor=e,e}();class bf extends Ef{constructor(e,t){super(e,"PasswordException"),this.code=t}}class yf extends Ef{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class wf extends Ef{constructor(e){super(e,"InvalidPDFException")}}class kf extends Ef{constructor(e){super(e,"MissingPDFException")}}class Sf extends Ef{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class vf extends Ef{constructor(e){super(e,"FormatError")}}class Df extends Ef{constructor(e){super(e,"AbortException")}}function xf(e){"string"!=typeof e&&mf("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let n=0;ne.toString(16).padStart(2,"0")));class Nf{static makeHexColor(e,t,i){return`#${Mf[e]}${Mf[t]}${Mf[i]}`}static scaleMinMax(e,t){let i;e[0]?(e[0]<0&&(i=t[0],t[0]=t[2],t[2]=i),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(i=t[1],t[1]=t[3],t[3]=i),t[1]*=e[3],t[3]*=e[3]):(i=t[0],t[0]=t[1],t[1]=i,i=t[2],t[2]=t[3],t[3]=i,e[1]<0&&(i=t[1],t[1]=t[3],t[3]=i),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(i=t[0],t[0]=t[2],t[2]=i),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}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 applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=this.applyTransform(e,t),n=this.applyTransform(e.slice(2,4),t),s=this.applyTransform([e[0],e[3]],t),a=this.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],a[0]),Math.min(i[1],n[1],s[1],a[1]),Math.max(i[0],n[0],s[0],a[0]),Math.max(i[1],n[1],s[1],a[1])]}static inverseTransform(e){const 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){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],r=(i+a)/2,o=Math.sqrt((i+a)**2-4*(i*a-s*n))/2,A=r+o||1,c=r-o||1;return[Math.sqrt(A),Math.sqrt(c)]}static normalizeRect(e){const 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){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>n)return null;const s=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 s>a?null:[i,s,n,a]}static#i(e,t,i,n,s,a,r,o,A,c){if(A<=0||A>=1)return;const l=1-A,g=A*A,h=g*A,d=l*(l*(l*e+3*A*t)+3*g*i)+h*n,u=l*(l*(l*s+3*A*a)+3*g*r)+h*o;c[0]=Math.min(c[0],d),c[1]=Math.min(c[1],u),c[2]=Math.max(c[2],d),c[3]=Math.max(c[3],u)}static#n(e,t,i,n,s,a,r,o,A,c,l,g){if(Math.abs(A)<1e-12)return void(Math.abs(c)>=1e-12&&this.#i(e,t,i,n,s,a,r,o,-l/c,g));const h=c**2-4*l*A;if(h<0)return;const d=Math.sqrt(h),u=2*A;this.#i(e,t,i,n,s,a,r,o,(-c+d)/u,g),this.#i(e,t,i,n,s,a,r,o,(-c-d)/u,g)}static bezierBoundingBox(e,t,i,n,s,a,r,o,A){return A?(A[0]=Math.min(A[0],e,r),A[1]=Math.min(A[1],t,o),A[2]=Math.max(A[2],e,r),A[3]=Math.max(A[3],t,o)):A=[Math.min(e,r),Math.min(t,o),Math.max(e,r),Math.max(t,o)],this.#n(e,i,s,r,t,n,a,o,3*(3*(i-s)-e+r),6*(e-2*i+s),3*(i-e),A),this.#n(e,i,s,r,t,n,a,o,3*(3*(n-a)-t+o),6*(t-2*n+a),3*(n-t),A),A}}let Gf=null,Uf=null;const Lf="pdfjs_internal_id_";"function"!=typeof Promise.try&&(Promise.try=function(e,...t){return new Promise((i=>{i(e(...t))}))});class Tf{static#s=document.body;static get node(){return this.#s}static set node(e){this.#s=e}}class Hf{#a=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#a.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}){if(e&&!this.#a.has(e.loadedName))if(Bf(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:s}=e,a=new FontFace(i,n,s);this.addNativeFontFace(a);try{await a.load(),this.#a.add(i),t?.(e)}catch{pf(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}}else mf("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)return void await this.loadSystemFont(e);if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){throw pf(`Failed to load font '${t.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const i=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,i)}))}}get isFontLoadingAPISupported(){return Qf(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let e=!1;return(lf||"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Qf(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,i={done:!1,complete:function(){for(Bf(!i.done,"completeRequest() cannot be called twice."),i.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(i),i}get _loadTestFont(){return Qf(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t){function i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function n(e,t,i,n){return e.substring(0,t)+n+e.substring(t+i)}let s,a;const r=this._document.createElement("canvas");r.width=1,r.height=1;const o=r.getContext("2d");let A=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let l=this._loadTestFont;l=n(l,976,c.length,c);const g=1482184792;let h=i(l,16);for(s=0,a=c.length-3;s>24&255,e>>16&255,e>>8&255,255&e)}(h));const d=`@font-face {font-family:"${c}";src:url(data:font/opentype;base64,${btoa(l)});}`;this.insertRule(d);const u=this._document.createElement("div");u.style.visibility="hidden",u.style.width=u.style.height="10px",u.style.position="absolute",u.style.top=u.style.left="0px";for(const t of[e.loadedName,c]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,u.append(e)}Tf.node.append(u),function e(t,i){if(++A>30)return pf("Load test font never loaded."),void i();o.font="30px "+t,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(e.bind(null,t,i))}(c,(()=>{u.remove(),t.complete()}))}}class Of{constructor(e,{disableFontFace:t=!1,fontExtraProperties:i=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.disableFontFace=!0===t,this.fontExtraProperties=!0===i,this._inspectFont=n}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${function(e){return Uint8Array.prototype.toBase64?e.toBase64():btoa(function(e){"object"==typeof e&&void 0!==e?.length||mf("Invalid argument for bytesToString");const t=e.length,i=8192;if(t{const s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType=t,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(200!==s.status&&0!==s.status)n(new Error(s.statusText));else{switch(t){case"arraybuffer":case"blob":case"json":return void i(s.response)}i(s.responseText)}},s.send(null)}))}class Yf{constructor({viewBox:e,userUnit:t,scale:i,rotation:n,offsetX:s=0,offsetY:a=0,dontFlip:r=!1}){this.viewBox=e,this.userUnit=t,this.scale=i,this.rotation=n,this.offsetX=s,this.offsetY=a,i*=t;const o=(e[2]+e[0])/2,A=(e[3]+e[1])/2;let c,l,g,h,d,u,I,f;switch((n%=360)<0&&(n+=360),n){case 180:c=-1,l=0,g=0,h=1;break;case 90:c=0,l=1,g=1,h=0;break;case 270:c=0,l=-1,g=-1,h=0;break;case 0:c=1,l=0,g=0,h=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(g=-g,h=-h),0===c?(d=Math.abs(A-e[1])*i+s,u=Math.abs(o-e[0])*i+a,I=(e[3]-e[1])*i,f=(e[2]-e[0])*i):(d=Math.abs(o-e[0])*i+s,u=Math.abs(A-e[1])*i+a,I=(e[2]-e[0])*i,f=(e[3]-e[1])*i),this.transform=[c*i,l*i,g*i,h*i,d-c*i*o-g*i*A,u-l*i*o-h*i*A],this.width=I,this.height=f}get rawDims(){const{userUnit:e,viewBox:t}=this,i=t.map((t=>t*e));return Qf(this,"rawDims",{pageWidth:i[2]-i[0],pageHeight:i[3]-i[1],pageX:i[0],pageY:i[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new Yf({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){return Nf.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=Nf.applyTransform([e[0],e[1]],this.transform),i=Nf.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){return Nf.applyInverseTransform([e,t],this.transform)}}class Kf extends Ef{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function Vf(e){const t=e.length;let i=0;for(;i=1&&n<=12?n-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let r=parseInt(t[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const A=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let l=parseInt(t[9],10)||0;return l=l>=0&&l<=59?l:0,"-"===A?(a+=c,r+=l):"+"===A&&(a-=c,r-=l),new Date(Date.UTC(i,n,s,a,r,o))}}function zf(e){const{a:t,b:i,c:n,d:s,e:a,f:r}=e.getTransform();return[t,i,n,s,a,r]}function $f(e){const{a:t,b:i,c:n,d:s,e:a,f:r}=e.getTransform().invertSelf();return[t,i,n,s,a,r]}function eC(e,t,i=!1,n=!0){if(t instanceof Yf){const{pageWidth:n,pageHeight:s}=t.rawDims,{style:a}=e,r=Rf.isCSSRoundSupported,o=`var(--scale-factor) * ${n}px`,A=`var(--scale-factor) * ${s}px`,c=r?`round(down, ${o}, var(--scale-round-x, 1px))`:`calc(${o})`,l=r?`round(down, ${A}, var(--scale-round-y, 1px))`:`calc(${A})`;i&&t.rotation%180!=0?(a.width=l,a.height=c):(a.width=c,a.height=l)}n&&e.setAttribute("data-main-rotation",t.rotation)}class tC{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}function iC(){}function nC(e){if(e instanceof Df||e instanceof wf||e instanceof kf||e instanceof bf||e instanceof Sf||e instanceof yf)return e;switch(e instanceof Error||"object"==typeof e&&null!==e||mf('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new Df(e.message);case"InvalidPDFException":return new wf(e.message);case"MissingPDFException":return new kf(e.message);case"PasswordException":return new bf(e.message,e.code);case"UnexpectedResponseException":return new Sf(e.message,e.status);case"UnknownErrorException":return new yf(e.message,e.details)}return new yf(e.message,e.toString())}class sC{#o=new AbortController;constructor(e,t,i){this.sourceName=e,this.targetName=t,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#A.bind(this),{signal:this.#o.signal})}#A({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#c(e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],1===e.callback)i.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");i.reject(nC(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const i=this.sourceName,n=e.sourceName,s=this.comObj;Promise.try(t,e.data).then((function(t){s.postMessage({sourceName:i,targetName:n,callback:1,callbackId:e.callbackId,data:t})}),(function(t){s.postMessage({sourceName:i,targetName:n,callback:2,callbackId:e.callbackId,reason:nC(t)})}))}else e.streamId?this.#l(e):t(e.data)}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t},i)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,i,n){const s=this.streamId++,a=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const A=Promise.withResolvers();return this.streamControllers[s]={controller:i,startCall:A,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:a,targetName:r,action:e,streamId:s,data:t,desiredSize:i.desiredSize},n),A.promise},pull:e=>{const t=Promise.withResolvers();return this.streamControllers[s].pullCall=t,o.postMessage({sourceName:a,targetName:r,stream:6,streamId:s,desiredSize:e.desiredSize}),t.promise},cancel:e=>{Bf(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();return this.streamControllers[s].cancelCall=t,this.streamControllers[s].isClosed=!0,o.postMessage({sourceName:a,targetName:r,stream:1,streamId:s,reason:nC(e)}),t.promise}},i)}#l(e){const t=e.streamId,i=this.sourceName,n=e.sourceName,s=this.comObj,a=this,r=this.actionHandler[e.action],o={enqueue(e,a=1,r){if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=a,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:n,stream:4,streamId:t,chunk:e},r)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:3,streamId:t}),delete a.streamSinks[t])},error(e){Bf(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:5,streamId:t,reason:nC(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[t]=o,Promise.try(r,e.data,o).then((function(){s.postMessage({sourceName:i,targetName:n,stream:8,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:n,stream:8,streamId:t,reason:nC(e)})}))}#c(e){const t=e.streamId,i=this.sourceName,n=e.sourceName,s=this.comObj,a=this.streamControllers[t],r=this.streamSinks[t];switch(e.stream){case 8:e.success?a.startCall.resolve():a.startCall.reject(nC(e.reason));break;case 7:e.success?a.pullCall.resolve():a.pullCall.reject(nC(e.reason));break;case 6:if(!r){s.postMessage({sourceName:i,targetName:n,stream:7,streamId:t,success:!0});break}r.desiredSize<=0&&e.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=e.desiredSize,Promise.try(r.onPull||iC).then((function(){s.postMessage({sourceName:i,targetName:n,stream:7,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:n,stream:7,streamId:t,reason:nC(e)})}));break;case 4:if(Bf(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case 3:if(Bf(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#g(a,t);break;case 5:Bf(a,"error should have stream controller"),a.controller.error(nC(e.reason)),this.#g(a,t);break;case 2:e.success?a.cancelCall.resolve():a.cancelCall.reject(nC(e.reason)),this.#g(a,t);break;case 1:if(!r)break;const o=nC(e.reason);Promise.try(r.onCancel||iC,o).then((function(){s.postMessage({sourceName:i,targetName:n,stream:2,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:n,stream:2,streamId:t,reason:nC(e)})})),r.sinkCapability.reject(o),r.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#g(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#o?.abort(),this.#o=null}}class aC{#h=!1;constructor({enableHWA:e=!1}){this.#h=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(e,t);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#h})}}reset(e,t,i){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||i<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=i}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){mf("Abstract method `_createCanvas` called.")}}class rC{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then((e=>({cMapData:e,isCompressed:this.isCompressed}))).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}async _fetch(e){mf("Abstract method `_fetch` called.")}}class oC extends rC{async _fetch(e){const t=await Pf(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):xf(t)}}class AC{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,i,n,s){return"none"}destroy(e=!1){}}class cC{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}async _fetch(e){mf("Abstract method `_fetch` called.")}}class lC extends cC{async _fetch(e){const t=await Pf(e,"arraybuffer");return new Uint8Array(t)}}async function gC(e){const t=process.getBuiltinModule("fs"),i=await t.promises.readFile(e);return new Uint8Array(i)}lf&&pf("Please use the `legacy` build in Node.js environments.");const hC="Fill",dC="Stroke",uC="Shading";function IC(e,t){if(!t)return;const i=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],i,n),e.clip(s)}class fC{getPattern(){mf("Abstract method `getPattern` called.")}}class CC extends fC{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],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,i,n){let s;if(n===dC||n===hC){const a=t.current.getClippedPathBoundingBox(n,zf(e))||[0,0,0,0],r=Math.ceil(a[2]-a[0])||1,o=Math.ceil(a[3]-a[1])||1,A=t.cachedCanvases.getCanvas("pattern",r,o),c=A.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),i=Nf.transform(i,[1,0,0,1,a[0],a[1]]),c.transform(...t.baseTransform),this.matrix&&c.transform(...this.matrix),IC(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),s=e.createPattern(A.canvas,"no-repeat");const l=new DOMMatrix(i);s.setTransform(l)}else IC(e,this._bbox),s=this._createGradient(e);return s}}function pC(e,t,i,n,s,a,r,o){const A=t.coords,c=t.colors,l=e.data,g=4*e.width;let h;A[i+1]>A[n+1]&&(h=i,i=n,n=h,h=a,a=r,r=h),A[n+1]>A[s+1]&&(h=n,n=s,s=h,h=r,r=o,o=h),A[i+1]>A[n+1]&&(h=i,i=n,n=h,h=a,a=r,r=h);const d=(A[i]+t.offsetX)*t.scaleX,u=(A[i+1]+t.offsetY)*t.scaleY,I=(A[n]+t.offsetX)*t.scaleX,f=(A[n+1]+t.offsetY)*t.scaleY,C=(A[s]+t.offsetX)*t.scaleX,p=(A[s+1]+t.offsetY)*t.scaleY;if(u>=p)return;const m=c[a],B=c[a+1],Q=c[a+2],E=c[r],b=c[r+1],y=c[r+2],w=c[o],k=c[o+1],S=c[o+2],v=Math.round(u),D=Math.round(p);let x,F,R,M,N,G,U,L;for(let e=v;e<=D;e++){if(ep?1:f===p?0:(f-e)/(f-p),x=I-(I-C)*t,F=E-(E-w)*t,R=b-(b-k)*t,M=y-(y-S)*t}let t;t=ep?1:(u-e)/(u-p),N=d-(d-C)*t,G=m-(m-w)*t,U=B-(B-k)*t,L=Q-(Q-S)*t;const i=Math.round(Math.min(x,N)),n=Math.round(Math.max(x,N));let s=g*e+4*i;for(let e=i;e<=n;e++)t=(x-e)/(x-N),t<0?t=0:t>1&&(t=1),l[s++]=F-(F-G)*t|0,l[s++]=R-(R-U)*t|0,l[s++]=M-(M-L)*t|0,l[s++]=255}}function mC(e,t,i){const n=t.coords,s=t.colors;let a,r;switch(t.type){case"lattice":const o=t.verticesPerRow,A=Math.floor(n.length/o)-1,c=o-1;for(a=0;a=Math.ceil(d*C)?m=o:Q=!0,y>=Math.ceil(u*p)?B=A:E=!0;const w=this.getSizeAndScale(m,this.ctx.canvas.width,C),k=this.getSizeAndScale(B,this.ctx.canvas.height,p),S=e.cachedCanvases.getCanvas("pattern",w.size,k.size),v=S.context,D=r.createCanvasGraphics(v);if(D.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(D,n,a),v.translate(-w.scale*c,-k.scale*l),D.transform(w.scale,0,0,k.scale,0,0),v.save(),this.clipBbox(D,c,l,g,h),D.baseTransform=zf(D.ctx),D.executeOperatorList(i),D.endDrawing(),v.restore(),Q||E){const t=S.canvas;Q&&(m=o),E&&(B=A);const i=this.getSizeAndScale(m,this.ctx.canvas.width,C),n=this.getSizeAndScale(B,this.ctx.canvas.height,p),s=i.size,a=n.size,r=e.cachedCanvases.getCanvas("pattern-workaround",s,a),g=r.context,h=Q?Math.floor(d/o):0,I=E?Math.floor(u/A):0;for(let e=0;e<=h;e++)for(let i=0;i<=I;i++)g.drawImage(t,s*e,a*i,s,a,0,0,s,a);return{canvas:r.canvas,scaleX:i.scale,scaleY:n.scale,offsetX:c,offsetY:l}}return{canvas:S.canvas,scaleX:w.scale,scaleY:k.scale,offsetX:c,offsetY:l}}getSizeAndScale(e,t,i){const n=Math.max(EC.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*i);return s>=n?s=n:i=s/e,{scale:i,size:s}}clipBbox(e,t,i,n,s){const a=n-t,r=s-i;e.ctx.rect(t,i,a,r),e.current.updateRectMinMax(zf(e.ctx),[t,i,n,s]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const n=e.ctx,s=e.current;switch(t){case 1:const e=this.ctx;n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle,s.fillColor=e.fillStyle,s.strokeColor=e.strokeStyle;break;case 2:const a=Nf.makeHexColor(i[0],i[1],i[2]);n.fillStyle=a,n.strokeStyle=a,s.fillColor=a,s.strokeColor=a;break;default:throw new vf(`Unsupported paint type: ${t}`)}}getPattern(e,t,i,n){let s=i;n!==uC&&(s=Nf.transform(s,t.baseTransform),this.matrix&&(s=Nf.transform(s,this.matrix)));const a=this.createPatternCanvas(t);let r=new DOMMatrix(s);r=r.translate(a.offsetX,a.offsetY),r=r.scale(1/a.scaleX,1/a.scaleY);const o=e.createPattern(a.canvas,"repeat");return o.setTransform(r),o}}function bC({src:e,srcPos:t=0,dest:i,width:n,height:s,nonBlackColor:a=4294967295,inverseDecode:r=!1}){const o=Rf.isLittleEndian?4278190080:255,[A,c]=r?[a,o]:[o,a],l=n>>3,g=7&n,h=e.length;i=new Uint32Array(i.buffer);let d=0;for(let n=0;n>2),I=i.length,f=n+7>>3,C=4294967295,p=Rf.isLittleEndian?4278190080:255;for(h=0;hf?n:8*e-7,r=-8&a;let o=0,g=0;for(;s>=1}for(;A=a&&(u=s,I=n*u),A=0,d=I;d--;)g[A++]=l[c++],g[A++]=l[c++],g[A++]=l[c++],g[A++]=255;e.putImageData(o,0,h*yC)}}}function DC(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const i=t.height,n=t.width,s=i%yC,a=(i-s)/yC,r=0===s?a:a+1,o=e.createImageData(n,yC);let A=0;const c=t.data,l=o.data;for(let t=0;t10&&"function"==typeof i,c=A?Date.now()+15:0;let l=0;const g=this.commonObjs,h=this.objs;let d;for(;;){if(void 0!==n&&r===n.nextBreakPoint)return n.breakIt(r,i),r;if(d=a[r],d!==uf.dependency)this[d].apply(this,s[r]);else for(const e of s[r]){const t=e.startsWith("g_")?g:h;if(!t.has(e))return t.get(e,i),r}if(r++,r===o)return r;if(A&&++l>10){if(Date.now()>c)return i(),r;l=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.transparentCanvas=null)}endDrawing(){this.#d(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#u()}#u(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){const i=e.width??e.displayWidth,n=e.height??e.displayHeight;let s,a,r=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),A=i,c=n,l="prescale1";for(;r>2&&A>1||o>2&&c>1;){let t=A,i=c;r>2&&A>1&&(t=A>=16384?Math.floor(A/2)-1||1:Math.ceil(A/2),r/=A/t),o>2&&c>1&&(i=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/i),s=this.cachedCanvases.getCanvas(l,t,i),a=s.context,a.clearRect(0,0,t,i),a.drawImage(e,0,0,A,c,0,0,t,i),e=s.canvas,A=t,c=i,l="prescale1"===l?"prescale2":"prescale1"}return{img:e,paintWidth:A,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:i,height:n}=e,s=this.current.fillColor,a=this.current.patternFill,r=zf(t);let o,A,c,l;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;A=JSON.stringify(a?r:[r.slice(0,4),s]),o=this._cachedBitmapsMap.get(t),o||(o=new Map,this._cachedBitmapsMap.set(t,o));const i=o.get(A);if(i&&!a)return{canvas:i,offsetX:Math.round(Math.min(r[0],r[2])+r[4]),offsetY:Math.round(Math.min(r[1],r[3])+r[5])};c=i}c||(l=this.cachedCanvases.getCanvas("maskCanvas",i,n),DC(l.context,e));let g=Nf.transform(r,[1/i,0,0,-1/n,0,0]);g=Nf.transform(g,[1,0,0,1,0,-n]);const[h,d,u,I]=Nf.getAxialAlignedBoundingBox([0,0,i,n],g),f=Math.round(u-h)||1,C=Math.round(I-d)||1,p=this.cachedCanvases.getCanvas("fillCanvas",f,C),m=p.context,B=h,Q=d;m.translate(-B,-Q),m.transform(...g),c||(c=this._scaleImage(l.canvas,$f(m)),c=c.img,o&&a&&o.set(A,c)),m.imageSmoothingEnabled=RC(zf(m),e.interpolate),kC(m,c,0,0,c.width,c.height,0,0,i,n),m.globalCompositeOperation="source-in";const E=Nf.transform($f(m),[1,0,0,1,-B,-Q]);return m.fillStyle=a?s.getPattern(t,this,E,hC):s,m.fillRect(0,0,i,n),o&&!a&&(this.cachedCanvases.delete("fillCanvas"),o.set(A,p.canvas)),{canvas:p.canvas,offsetX:Math.round(B),offsetY:Math.round(Q)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=MC[e]}setLineJoin(e){this.ctx.lineJoin=NC[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(e),i.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,i]of e)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(i,e,t);this.suspendedCtx=this.ctx,this.ctx=n.context;const s=this.ctx;s.setTransform(...zf(this.suspendedCtx)),xC(this.suspendedCtx,s),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,i){t.translate(e,i),this.__originalTranslate(e,i)},e.scale=function(e,i){t.scale(e,i),this.__originalScale(e,i)},e.transform=function(e,i,n,s,a,r){t.transform(e,i,n,s,a,r),this.__originalTransform(e,i,n,s,a,r)},e.setTransform=function(e,i,n,s,a,r){t.setTransform(e,i,n,s,a,r),this.__originalSetTransform(e,i,n,s,a,r)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},e.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},e.bezierCurveTo=function(e,i,n,s,a,r){t.bezierCurveTo(e,i,n,s,a,r),this.__originalBezierCurveTo(e,i,n,s,a,r)},e.rect=function(e,i,n,s){t.rect(e,i,n,s),this.__originalRect(e,i,n,s)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(s,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),xC(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,t,this.ctx,e),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,i,n){const s=n[0],a=n[1],r=n[2]-s,o=n[3]-a;0!==r&&0!==o&&(this.genericComposeSMask(t.context,i,r,o,t.subtype,t.backdrop,t.transferMap,s,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(i.canvas,0,0),e.restore())}genericComposeSMask(e,t,i,n,s,a,r,o,A,c,l){let g=e.canvas,h=o-c,d=A-l;if(a){const t=Nf.makeHexColor(...a);if(h<0||d<0||h+i>g.width||d+n>g.height){const e=this.cachedCanvases.getCanvas("maskExtension",i,n),s=e.context;s.drawImage(g,-h,-d),s.globalCompositeOperation="destination-atop",s.fillStyle=t,s.fillRect(0,0,i,n),s.globalCompositeOperation="source-over",g=e.canvas,h=d=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const s=new Path2D;s.rect(h,d,i,n),e.clip(s),e.globalCompositeOperation="destination-atop",e.fillStyle=t,e.fillRect(h,d,i,n),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),"Alpha"===s&&r?t.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===s&&(t.filter=this.filterFactory.addLuminosityFilter(r));const u=new Path2D;u.rect(o,A,i,n),t.clip(u),t.globalCompositeOperation="destination-in",t.drawImage(g,h,d,i,n,o,A,i,n),t.restore()}save(){this.inSMaskMode?(xC(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),xC(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,i,n,s,a){this.ctx.transform(e,t,i,n,s,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,i){const n=this.ctx,s=this.current;let a,r,o=s.x,A=s.y;const c=zf(n),l=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],g=l?i.slice(0):null;for(let i=0,h=0,d=e.length;i100&&(A=100),this.current.fontSizeScale=t/A,this.ctx.font=`${o} ${r} ${A}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,i,n,s,a){this.current.textMatrix=[e,t,i,n,s,a],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}#I(e,t,i){const n=new Path2D;return n.addPath(e,new DOMMatrix(i).invertSelf().multiplySelf(t)),n}paintChar(e,t,i,n,s){const a=this.ctx,r=this.current,o=r.font,A=r.textRenderingMode,c=r.fontSize/r.fontSizeScale,l=3&A,g=!!(4&A),h=r.patternFill&&!o.missingFile,d=r.patternStroke&&!o.missingFile;let u;if((o.disableFontFace||g||h||d)&&(u=o.getPathGenerator(this.commonObjs,e)),o.disableFontFace||h||d){if(a.save(),a.translate(t,i),a.scale(c,-c),0===l||2===l)if(n){const e=a.getTransform();a.setTransform(...n),a.fill(this.#I(u,e,n))}else a.fill(u);if(1===l||2===l)if(s){const e=a.getTransform();a.setTransform(...s),a.stroke(this.#I(u,e,s))}else a.lineWidth/=c,a.stroke(u);a.restore()}else 0!==l&&2!==l||a.fillText(e,t,i),1!==l&&2!==l||a.strokeText(e,t,i);g&&(this.pendingTextPaths||=[]).push({transform:zf(a),x:t,y:i,fontSize:c,path:u})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let i=!1;for(let e=3;e0&&t[e]<255){i=!0;break}return Qf(this,"isFontSubpixelAAEnabled",i)}showText(e){const t=this.current,i=t.font;if(i.isType3Font)return this.showType3Text(e);const n=t.fontSize;if(0===n)return;const s=this.ctx,a=t.fontSizeScale,r=t.charSpacing,o=t.wordSpacing,A=t.fontDirection,c=t.textHScale*A,l=e.length,g=i.vertical,h=g?1:-1,d=i.defaultVMetrics,u=n*t.fontMatrix[0],I=0===t.textRenderingMode&&!i.disableFontFace&&!t.patternFill;let f,C;if(s.save(),s.transform(...t.textMatrix),s.translate(t.x,t.y+t.textRise),A>0?s.scale(c,-1):s.scale(c,1),t.patternFill){s.save();const e=t.fillColor.getPattern(s,this,$f(s),hC);f=zf(s),s.restore(),s.fillStyle=e}if(t.patternStroke){s.save();const e=t.strokeColor.getPattern(s,this,$f(s),dC);C=zf(s),s.restore(),s.strokeStyle=e}let p=t.lineWidth;const m=t.textMatrixScale;if(0===m||0===p){const e=3&t.textRenderingMode;1!==e&&2!==e||(p=this.getSinglePixelWidth())}else p/=m;if(1!==a&&(s.scale(a,a),p/=a),s.lineWidth=p,i.isInvalidPDFjsFont){const i=[];let n=0;for(const t of e)i.push(t.unicode),n+=t.width;return s.fillText(i.join(""),0,0),t.x+=n*u*c,s.restore(),void this.compose()}let B,Q=0;for(B=0;B0){const e=1e3*s.measureText(p).width/n*a;if(ynew LC(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new EC(e,i,this.ctx,s,n)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,i){this.ctx.strokeStyle=this.current.strokeColor=Nf.makeHexColor(e,t,i),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t,i){this.ctx.fillStyle=this.current.fillColor=Nf.makeHexColor(e,t,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=function(e){switch(e[0]){case"RadialAxial":return new CC(e);case"Mesh":return new BC(e);case"Dummy":return new QC}throw new Error(`Unknown IR type: ${e[0]}`)}(this.getObject(e)),this.cachedPatterns.set(e,i)),t&&(i.matrix=t),i}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(e);t.fillStyle=i.getPattern(t,this,$f(t),uC);const n=$f(t);if(n){const{width:e,height:i}=t.canvas,[s,a,r,o]=Nf.getAxialAlignedBoundingBox([0,0,e,i],n);this.ctx.fillRect(s,a,r-s,o-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){mf("Should not call beginInlineImage")}beginImageData(){mf("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=zf(this.ctx),t)){const e=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],e,i),this.current.updateRectMinMax(zf(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||Cf("TODO: Support non-isolated groups."),e.knockout&&pf("Knockout groups not supported.");const i=zf(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let n=Nf.getAxialAlignedBoundingBox(e.bbox,zf(t));const s=[0,0,t.canvas.width,t.canvas.height];n=Nf.intersect(n,s)||[0,0,0,0];const a=Math.floor(n[0]),r=Math.floor(n[1]),o=Math.max(Math.ceil(n[2])-a,1),A=Math.max(Math.ceil(n[3])-r,1);this.current.startNewPathAndClipBox([0,0,o,A]);let c="groupAt"+this.groupLevel;e.smask&&(c+="_smask_"+this.smaskCounter++%2);const l=this.cachedCanvases.getCanvas(c,o,A),g=l.context;g.translate(-a,-r),g.transform(...i),e.smask?this.smaskStack.push({canvas:l.canvas,context:g,offsetX:a,offsetY:r,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(a,r),t.save()),xC(t,g),this.ctx=g,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=zf(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const i=Nf.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,t,i,n,s){if(this.#d(),FC(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const n=t[2]-t[0],a=t[3]-t[1];if(s&&this.annotationCanvasMap){(i=i.slice())[4]-=t[0],i[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=n,t[3]=a;const[s,r]=Nf.singularValueDecompose2dScale(zf(this.ctx)),{viewportScale:o}=this,A=Math.ceil(n*this.outputScaleX*o),c=Math.ceil(a*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(A,c);const{canvas:l,context:g}=this.annotationCanvas;this.annotationCanvasMap.set(e,l),this.annotationCanvas.savedCtx=this.ctx,this.ctx=g,this.ctx.save(),this.ctx.setTransform(s,0,0,-r,0,a*r),FC(this.ctx)}else FC(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],n,a),this.ctx.clip(),this.ctx.beginPath()}this.current=new SC(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#u(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const i=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function(e){const{width:t,height:i}=e;if(t>1e3||i>1e3)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=t+1;let a,r,o,A=new Uint8Array(s*(i+1));const c=t+7&-8;let l=new Uint8Array(c*i),g=0;for(const t of e.data){let e=128;for(;e>0;)l[g++]=t&e?0:255,e>>=1}let h=0;for(g=0,0!==l[g]&&(A[0]=1,++h),r=1;r>2)+(l[g+1]?4:0)+(l[g-c+1]?8:0),n[e]&&(A[o+r]=n[e],++h),g++;if(l[g-c]!==l[g]&&(A[o+r]=l[g]?2:4,++h),h>1e3)return null}for(g=c*(i-1),o=a*s,0!==l[g]&&(A[o]=8,++h),r=1;r1e3)return null;const d=new Int32Array([0,s,-1,0,-s,0,0,0,1]),u=new Path2D;for(a=0;h&&a<=i;a++){let e=a*s;const i=e+t;for(;e>4,A[e]&=r>>2|r<<2),u.lineTo(e%s,e/s|0),A[e]||--h}while(n!==e);--a}return l=null,A=null,function(e){e.save(),e.scale(1/t,-1/i),e.translate(0,-i),e.fill(u),e.beginPath(),e.restore()}}(e)),n.compiled))return void n.compiled(i);const s=this._createMaskCanvas(e),a=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,i=0,n=0,s,a){if(!this.contentVisible)return;e=this.getObject(e.data,e);const r=this.ctx;r.save();const o=zf(r);r.transform(t,i,n,s,0,0);const A=this._createMaskCanvas(e);r.setTransform(1,0,0,1,A.offsetX-o[4],A.offsetY-o[5]);for(let e=0,c=a.length;et?c/t:1,r=A>t?A/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:i}=this.current,[n,s]=this.getScaleForStroking();if(t.lineWidth=i||1,1===n&&1===s)return void t.stroke();const a=t.getLineDash();if(e&&t.save(),t.scale(n,s),a.length>0){const e=Math.max(n,s);t.setLineDash(a.map((t=>t/e))),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const e in uf)void 0!==LC.prototype[e]&&(LC.prototype[uf[e]]=LC.prototype[e]);class TC{static#f=null;static#C="";static get workerPort(){return this.#f}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw new Error("Invalid `workerPort` type.");this.#f=e}static get workerSrc(){return this.#C}static set workerSrc(e){if("string"!=typeof e)throw new Error("Invalid `workerSrc` type.");this.#C=e}}class HC{#p;#m;constructor({parsedData:e,rawData:t}){this.#p=e,this.#m=t}getRaw(){return this.#m}get(e){return this.#p.get(e)??null}getAll(){return Ff(this.#p)}has(e){return this.#p.has(e)}}const OC=3285377520,qC=4294901760,JC=65535;class PC{constructor(e){this.h1=e?4294967295&e:OC,this.h2=e?4294967295&e:OC}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length),i=0;for(let n=0,s=e.length;n>>8,t[i++]=255&s)}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice(),i=t.byteLength}const n=i>>2,s=i-4*n,a=new Uint32Array(t.buffer,0,n);let r=0,o=0,A=this.h1,c=this.h2;const l=3432918353,g=461845907,h=11601,d=13715;for(let e=0;e>>17,r=r*g&qC|r*d&JC,A^=r,A=A<<13|A>>>19,A=5*A+3864292196):(o=a[e],o=o*l&qC|o*h&JC,o=o<<15|o>>>17,o=o*g&qC|o*d&JC,c^=o,c=c<<13|c>>>19,c=5*c+3864292196);switch(r=0,s){case 3:r^=t[4*n+2]<<16;case 2:r^=t[4*n+1]<<8;case 1:r^=t[4*n],r=r*l&qC|r*h&JC,r=r<<15|r>>>17,r=r*g&qC|r*d&JC,1&n?A^=r:c^=r}this.h1=A,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&qC|36045*e&JC,t=4283543511*t&qC|(2950163797*(t<<16|e>>>16)&qC)>>>16,e^=t>>>1,e=444984403*e&qC|60499*e&JC,t=3301882366*t&qC|(3120437893*(t<<16|e>>>16)&qC)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const YC=Symbol("INTERNAL");class KC{#B=!1;#Q=!1;#E=!1;#b=!0;constructor(e,{name:t,intent:i,usage:n,rbGroups:s}){this.#B=!!(2&e),this.#Q=!!(4&e),this.name=t,this.intent=i,this.usage=n,this.rbGroups=s}get visible(){if(this.#E)return this.#b;if(!this.#b)return!1;const{print:e,view:t}=this.usage;return this.#B?"OFF"!==t?.viewState:!this.#Q||"OFF"!==e?.printState}_setVisible(e,t,i=!1){e!==YC&&mf("Internal method `_setVisible` called."),this.#E=i,this.#b=t}}class VC{#y=null;#w=new Map;#k=null;#S=null;constructor(e,t=2){if(this.renderingIntent=t,this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#S=e.order;for(const i of e.groups)this.#w.set(i.id,new KC(t,i));if("OFF"===e.baseState)for(const e of this.#w.values())e._setVisible(YC,!1);for(const t of e.on)this.#w.get(t)._setVisible(YC,!0);for(const t of e.off)this.#w.get(t)._setVisible(YC,!1);this.#k=this.getHash()}}#v(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let n=1;n0?Ff(this.#w):null}getGroup(e){return this.#w.get(e)||null}getHash(){if(null!==this.#y)return this.#y;const e=new PC;for(const[t,i]of this.#w)e.update(`${t}:${i.visible}`);return this.#y=e.hexdigest()}}class WC{constructor(e,{disableRange:t=!1,disableStream:i=!1}){Bf(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:s,progressiveDone:a,contentDispositionFilename:r}=e;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=r,s?.length>0){const e=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!i,this._isRangeSupported=!t,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),e.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),e.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),e.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const i=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;void 0===e?this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i):Bf(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(i),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){Bf(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new jC(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new _C(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}class jC{constructor(e,t,i=!1,n=null){this._stream=e,this._done=i||!1,this._filename=Wf(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class _C{constructor(e,t,i){this._stream=e,this._begin=t,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function XC(e,t){const i=new Headers;if(!e||!t||"object"!=typeof t)return i;for(const e in t){const n=t[e];void 0!==n&&i.append(e,n)}return i}function ZC(e){try{return new URL(e).origin}catch{}return null}function zC({responseHeaders:e,isHttp:t,rangeChunkSize:i,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e.get("Content-Length"),10);return Number.isInteger(a)?(s.suggestedLength=a,a<=2*i||n||!t||"bytes"!==e.get("Accept-Ranges")||"identity"!==(e.get("Content-Encoding")||"identity")||(s.allowRangeRequests=!0),s):s}function $C(e){const t=e.get("Content-Disposition");if(t){let e=function(e){let t=!0,i=n("filename\\*","i").exec(e);if(i){i=i[1];let e=r(i);return e=unescape(e),e=o(e),e=A(e),a(e)}if(i=function(e){const t=[];let i;const s=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=s.exec(e));){let[,e,n,s]=i;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[n,s]}const a=[];for(let e=0;e{if(e._responseOrigin=ZC(t.url),!tp(t.status))throw ep(t.status,n);this._reader=t.body.getReader(),this._headersCapability.resolve();const i=t.headers,{allowRangeRequests:s,suggestedLength:a}=zC({responseHeaders:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=a||this._contentLength,this._filename=$C(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Df("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}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(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:np(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class rp{constructor(e,t,i){this._stream=e,this._reader=null,this._loaded=0;const n=e.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const s=new Headers(e.headers);s.append("Range",`bytes=${t}-${i-1}`);const a=n.url;fetch(a,ip(s,this._withCredentials,this._abortController)).then((t=>{const i=ZC(t.url);if(i!==e._responseOrigin)throw new Error(`Expected range response-origin "${i}" to match "${e._responseOrigin}".`);if(!tp(t.status))throw ep(t.status,a);this._readCapability.resolve(),this._reader=t.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:np(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class op{_responseOrigin=null;constructor({url:e,httpHeaders:t,withCredentials:i}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=XC(this.isHttp,t),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const t=new XMLHttpRequest,i=this.currXhrId++,n=this.pendingRequests[i]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[e,i]of this.headers)t.setRequestHeader(e,i);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=206):n.expectedStatus=200,t.responseType="arraybuffer",Bf(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,i),t.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,t.send(null),i}onProgress(e,t){const i=this.pendingRequests[e];i&&i.onProgress?.(t)}onStateChange(e,t){const i=this.pendingRequests[e];if(!i)return;const n=i.xhr;if(n.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==n.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===n.status&&this.isHttp)return void i.onError(n.status);const s=n.status||200;if((200!==s||206!==i.expectedStatus)&&s!==i.expectedStatus)return void i.onError(n.status);const a=function(e){const t=e.response;return"string"!=typeof t?t:xf(t).buffer}(n);if(206===s){const e=n.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t?i.onDone({begin:parseInt(t[1],10),chunk:a}):(pf('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone({begin:0,chunk:a}):i.onError(n.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class Ap{constructor(e){this._source=e,this._manager=new op(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return Bf(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new cp(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const i=new lp(this._manager,e,t);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class cp{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=ZC(t.responseURL);const i=t.getAllResponseHeaders(),n=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map((e=>{const[t,...i]=e.split(": ");return[t,i.join(": ")]})):[]),{allowRangeRequests:s,suggestedLength:a}=zC({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=$C(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=ep(e,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}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};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class lp{constructor(e,t,i){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){const e=ZC(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??=ep(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const gp=/^[a-z][a-z0-9\-+.]+:/i;class hp{constructor(e){this.source=e,this.url=function(e){if(gp.test(e))return new URL(e);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(e))}(e.url),Bf("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Bf(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new dp(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new up(this,e,t);return this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class dp{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then((e=>{this._contentLength=e.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()}),(e=>{"ENOENT"===e.code&&(e=new kf(`Missing PDF "${this._url}".`)),this._storedError=e,this._headersCapability.reject(e)}))}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Df("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class up{constructor(e,t,i){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=e.source;this._isStreamingSupported=!n.disableStream;const s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:t,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}const Ip=30;class fp{#D=Promise.withResolvers();#x=null;#F=!1;#R=!!globalThis.FontInspector?.enabled;#M=null;#N=null;#G=0;#U=0;#L=null;#T=null;#H=0;#O=0;#q=Object.create(null);#J=[];#P=null;#Y=[];#K=new WeakMap;#V=null;static#W=new Map;static#j=new Map;static#_=new WeakMap;static#X=null;static#Z=new Set;constructor({textContentSource:e,container:t,viewport:i}){if(e instanceof ReadableStream)this.#P=e;else{if("object"!=typeof e)throw new Error('No "textContentSource" parameter specified.');this.#P=new ReadableStream({start(t){t.enqueue(e),t.close()}})}this.#x=this.#T=t,this.#O=i.scale*(globalThis.devicePixelRatio||1),this.#H=i.rotation,this.#N={div:null,properties:null,ctx:null};const{pageWidth:n,pageHeight:s,pageX:a,pageY:r}=i.rawDims;this.#V=[1,0,0,-1,-a,r+s],this.#U=n,this.#G=s,fp.#z(),eC(t,i),this.#D.promise.finally((()=>{fp.#Z.delete(this),this.#N=null,this.#q=null})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Rf.platform;return Qf(this,"fontFamilyMap",new Map([["sans-serif",(e&&t?"Calibri, ":"")+"sans-serif"],["monospace",(e&&t?"Lucida Console, ":"")+"monospace"]]))}render(){const e=()=>{this.#L.read().then((({value:t,done:i})=>{i?this.#D.resolve():(this.#M??=t.lang,Object.assign(this.#q,t.styles),this.#$(t.items),e())}),this.#D.reject)};return this.#L=this.#P.getReader(),fp.#Z.add(this),e(),this.#D.promise}update({viewport:e,onBefore:t=null}){const i=e.scale*(globalThis.devicePixelRatio||1),n=e.rotation;if(n!==this.#H&&(t?.(),this.#H=n,eC(this.#T,{rotation:n})),i!==this.#O){t?.(),this.#O=i;const e={div:null,properties:null,ctx:fp.#ee(this.#M)};for(const t of this.#Y)e.properties=this.#K.get(t),e.div=t,this.#te(e)}}cancel(){const e=new Df("TextLayer task cancelled.");this.#L?.cancel(e).catch((()=>{})),this.#L=null,this.#D.reject(e)}get textDivs(){return this.#Y}get textContentItemsStr(){return this.#J}#$(e){if(this.#F)return;this.#N.ctx??=fp.#ee(this.#M);const t=this.#Y,i=this.#J;for(const n of e){if(t.length>1e5)return pf("Ignoring additional textDivs for performance reasons."),void(this.#F=!0);if(void 0!==n.str)i.push(n.str),this.#ie(n);else if("beginMarkedContentProps"===n.type||"beginMarkedContent"===n.type){const e=this.#x;this.#x=document.createElement("span"),this.#x.classList.add("markedContent"),null!==n.id&&this.#x.setAttribute("id",`${n.id}`),e.append(this.#x)}else"endMarkedContent"===n.type&&(this.#x=this.#x.parentNode)}}#ie(e){const t=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};this.#Y.push(t);const n=Nf.transform(this.#V,e.transform);let s=Math.atan2(n[1],n[0]);const a=this.#q[e.fontName];a.vertical&&(s+=Math.PI/2);let r=this.#R&&a.fontSubstitution||a.fontFamily;r=fp.fontFamilyMap.get(r)||r;const o=Math.hypot(n[2],n[3]),A=o*fp.#ne(r,this.#M);let c,l;0===s?(c=n[4],l=n[5]-A):(c=n[4]+A*Math.sin(s),l=n[5]-A*Math.cos(s));const g="calc(var(--scale-factor)*",h=t.style;this.#x===this.#T?(h.left=`${(100*c/this.#U).toFixed(2)}%`,h.top=`${(100*l/this.#G).toFixed(2)}%`):(h.left=`${g}${c.toFixed(2)}px)`,h.top=`${g}${l.toFixed(2)}px)`),h.fontSize=`${g}${(fp.#X*o).toFixed(2)}px)`,h.fontFamily=r,i.fontSize=o,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,this.#R&&(t.dataset.fontName=a.fontSubstitutionLoadedName||e.fontName),0!==s&&(i.angle=s*(180/Math.PI));let d=!1;if(e.str.length>1)d=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),i=Math.abs(e.transform[3]);t!==i&&Math.max(t,i)/Math.min(t,i)>1.5&&(d=!0)}if(d&&(i.canvasWidth=a.vertical?e.height:e.width),this.#K.set(t,i),this.#N.div=t,this.#N.properties=i,this.#te(this.#N),i.hasText&&this.#x.append(t),i.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this.#x.append(e)}}#te(e){const{div:t,properties:i,ctx:n}=e,{style:s}=t;let a="";if(fp.#X>1&&(a=`scale(${1/fp.#X})`),0!==i.canvasWidth&&i.hasText){const{fontFamily:e}=s,{canvasWidth:r,fontSize:o}=i;fp.#se(n,o*this.#O,e);const{width:A}=n.measureText(t.textContent);A>0&&(a=`scaleX(${r*this.#O/A}) ${a}`)}0!==i.angle&&(a=`rotate(${i.angle}deg) ${a}`),a.length>0&&(s.transform=a)}static cleanup(){if(!(this.#Z.size>0)){this.#W.clear();for(const{canvas:e}of this.#j.values())e.remove();this.#j.clear()}}static#ee(e=null){let t=this.#j.get(e||="");if(!t){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=e,Tf.node.append(i),t=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#j.set(e,t),this.#_.set(t,{size:0,family:""})}return t}static#se(e,t,i){const n=this.#_.get(e);t===n.size&&i===n.family||(e.font=`${t}px ${i}`,n.size=t,n.family=i)}static#z(){if(null!==this.#X)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",Tf.node.append(e),this.#X=e.getBoundingClientRect().height,e.remove()}static#ne(e,t){const i=this.#W.get(e);if(i)return i;const n=this.#ee(t);n.canvas.width=n.canvas.height=Ip,this.#se(n,Ip,e);const s=n.measureText("");let a=s.fontBoundingBoxAscent,r=Math.abs(s.fontBoundingBoxDescent);if(a){const t=a/(a+r);return this.#W.set(e,t),n.canvas.width=n.canvas.height=0,t}n.strokeStyle="red",n.clearRect(0,0,Ip,Ip),n.strokeText("g",0,0);let o=n.getImageData(0,0,Ip,Ip).data;r=0;for(let e=o.length-1-3;e>=0;e-=4)if(o[e]>0){r=Math.ceil(e/4/Ip);break}n.clearRect(0,0,Ip,Ip),n.strokeText("A",0,Ip),o=n.getImageData(0,0,Ip,Ip).data,a=0;for(let e=0,t=o.length;e0){a=Ip-Math.floor(e/4/Ip);break}n.canvas.width=n.canvas.height=0;const A=a?a/(a+r):.8;return this.#W.set(e,A),A}}class Cp{static textContent(e){const t=[],i={items:t,styles:Object.create(null)};return function e(i){if(!i)return;let n=null;const s=i.name;if("#text"===s)n=i.value;else{if(!Cp.shouldBuildText(s))return;i?.attributes?.textContent?n=i.attributes.textContent:i.value&&(n=i.value)}if(null!==n&&t.push({str:n}),i.children)for(const t of i.children)e(t)}(e),i}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}const pp=lf?class extends aC{_createCanvas(t,i){return process.getBuiltinModule("module").createRequire(e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("carbone-studio.min.js",document.baseURI).href)("@napi-rs/canvas").createCanvas(t,i)}}:class extends aC{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const i=this._document.createElement("canvas");return i.width=e,i.height=t,i}},mp=lf?class extends rC{async _fetch(e){return gC(e)}}:oC,Bp=lf?class extends AC{}:class extends AC{#ae;#re;#oe;#Ae;#ce;#le;#ge=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#Ae=e,this.#ce=t}get#he(){return this.#re||=new Map}get#de(){return this.#le||=new Map}get#ue(){if(!this.#oe){const e=this.#ce.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const i=this.#ce.createElementNS(qf,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#oe=this.#ce.createElementNS(qf,"defs"),e.append(i),i.append(this.#oe),Tf.node.append(e)}return this.#oe}#Ie(e){if(1===e.length){const t=e[0],i=new Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255;const n=i.join(",");return[n,n,n]}const[t,i,n]=e,s=new Array(256),a=new Array(256),r=new Array(256);for(let e=0;e<256;e++)s[e]=t[e]/255,a[e]=i[e]/255,r[e]=n[e]/255;return[s.join(","),a.join(","),r.join(",")]}#fe(e){if(void 0===this.#ae){this.#ae="";const e=this.#ce.URL;e!==this.#ce.baseURI&&(Vf(e)?pf('#createUrl: ignore "data:"-URL for performance reasons.'):this.#ae=e.split("#",1)[0])}return`url(${this.#ae}#${e})`}addFilter(e){if(!e)return"none";let t=this.#he.get(e);if(t)return t;const[i,n,s]=this.#Ie(e),a=1===e.length?i:`${i}${n}${s}`;if(t=this.#he.get(a),t)return this.#he.set(e,t),t;const r=`g_${this.#Ae}_transfer_map_${this.#ge++}`,o=this.#fe(r);this.#he.set(e,o),this.#he.set(a,o);const A=this.#Ce(r);return this.#pe(i,n,s,A),o}addHCMFilter(e,t){const i=`${e}-${t}`,n="base";let s=this.#de.get(n);if(s?.key===i)return s.url;if(s?(s.filter?.remove(),s.key=i,s.url="none",s.filter=null):(s={key:i,url:"none",filter:null},this.#de.set(n,s)),!e||!t)return s.url;const a=this.#me(e);e=Nf.makeHexColor(...a);const r=this.#me(t);if(t=Nf.makeHexColor(...r),this.#ue.style.color="","#000000"===e&&"#ffffff"===t||e===t)return s.url;const o=new Array(256);for(let e=0;e<=255;e++){const t=e/255;o[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const A=o.join(","),c=`g_${this.#Ae}_hcm_filter`,l=s.filter=this.#Ce(c);this.#pe(A,A,A,l),this.#Be(l);const g=(e,t)=>{const i=a[e]/255,n=r[e]/255,s=new Array(t+1);for(let e=0;e<=t;e++)s[e]=i+e/t*(n-i);return s.join(",")};return this.#pe(g(0,5),g(1,5),g(2,5),l),s.url=this.#fe(c),s.url}addAlphaFilter(e){let t=this.#he.get(e);if(t)return t;const[i]=this.#Ie([e]),n=`alpha_${i}`;if(t=this.#he.get(n),t)return this.#he.set(e,t),t;const s=`g_${this.#Ae}_alpha_map_${this.#ge++}`,a=this.#fe(s);this.#he.set(e,a),this.#he.set(n,a);const r=this.#Ce(s);return this.#Qe(i,r),a}addLuminosityFilter(e){let t,i,n=this.#he.get(e||"luminosity");if(n)return n;if(e?([t]=this.#Ie([e]),i=`luminosity_${t}`):i="luminosity",n=this.#he.get(i),n)return this.#he.set(e,n),n;const s=`g_${this.#Ae}_luminosity_map_${this.#ge++}`,a=this.#fe(s);this.#he.set(e,a),this.#he.set(i,a);const r=this.#Ce(s);return this.#Ee(r),e&&this.#Qe(t,r),a}addHighlightHCMFilter(e,t,i,n,s){const a=`${t}-${i}-${n}-${s}`;let r=this.#de.get(e);if(r?.key===a)return r.url;if(r?(r.filter?.remove(),r.key=a,r.url="none",r.filter=null):(r={key:a,url:"none",filter:null},this.#de.set(e,r)),!t||!i)return r.url;const[o,A]=[t,i].map(this.#me.bind(this));let c=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),l=Math.round(.2126*A[0]+.7152*A[1]+.0722*A[2]),[g,h]=[n,s].map(this.#me.bind(this));l{const n=new Array(256),s=(l-c)/i,a=e/255,r=(t-e)/(255*i);let o=0;for(let e=0;e<=i;e++){const t=Math.round(c+e*s),i=a+e*r;for(let e=o;e<=t;e++)n[e]=i;o=t+1}for(let e=o;e<256;e++)n[e]=n[o-1];return n.join(",")},u=`g_${this.#Ae}_hcm_${e}_filter`,I=r.filter=this.#Ce(u);return this.#Be(I),this.#pe(d(g[0],h[0],5),d(g[1],h[1],5),d(g[2],h[2],5),I),r.url=this.#fe(u),r.url}destroy(e=!1){e&&this.#le?.size||(this.#oe?.parentNode.parentNode.remove(),this.#oe=null,this.#re?.clear(),this.#re=null,this.#le?.clear(),this.#le=null,this.#ge=0)}#Ee(e){const t=this.#ce.createElementNS(qf,"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)}#Be(e){const t=this.#ce.createElementNS(qf,"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)}#Ce(e){const t=this.#ce.createElementNS(qf,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#ue.append(t),t}#be(e,t,i){const n=this.#ce.createElementNS(qf,t);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)}#pe(e,t,i,n){const s=this.#ce.createElementNS(qf,"feComponentTransfer");n.append(s),this.#be(s,"feFuncR",e),this.#be(s,"feFuncG",t),this.#be(s,"feFuncB",i)}#Qe(e,t){const i=this.#ce.createElementNS(qf,"feComponentTransfer");t.append(i),this.#be(i,"feFuncA",e)}#me(e){return this.#ue.style.color=e,function(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):(pf(`Not a valid color format: "${e}"`),[0,0,0])}(getComputedStyle(this.#ue).getPropertyValue("color"))}},Qp=lf?class extends cC{async _fetch(e){return gC(e)}}:lC;function Ep(e={}){"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new yp,{docId:i}=t,n=e.url?function(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(lf&&"string"==typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(e.url):null,s=e.data?function(e){if(lf&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return xf(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(e.data):null,a=e.httpHeaders||null,r=!0===e.withCredentials,o=e.password??null,A=e.range instanceof wp?e.range:null,c=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:65536;let l=e.worker instanceof Dp?e.worker:null;const g=e.verbosity,h="string"!=typeof e.docBaseUrl||Vf(e.docBaseUrl)?null:e.docBaseUrl,d="string"==typeof e.cMapUrl?e.cMapUrl:null,u=!1!==e.cMapPacked,I=e.CMapReaderFactory||mp,f="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,C=e.StandardFontDataFactory||Qp,p=!0!==e.stopAtErrors,m=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,B=!1!==e.isEvalSupported,Q="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!lf,E="boolean"==typeof e.isImageDecoderSupported?e.isImageDecoderSupported:!lf&&(Rf.platform.isFirefox||!globalThis.chrome),b=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,y="boolean"==typeof e.disableFontFace?e.disableFontFace:lf,w=!0===e.fontExtraProperties,k=!0===e.enableXfa,S=e.ownerDocument||globalThis.document,v=!0===e.disableRange,D=!0===e.disableStream,x=!0===e.disableAutoFetch,F=!0===e.pdfBug,R=e.CanvasFactory||pp,M=e.FilterFactory||Bp,N=!0===e.enableHWA,G=A?A.length:e.length??NaN,U="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!lf&&!y,L="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:I===oC&&C===lC&&d&&f&&_f(d,document.baseURI)&&_f(f,document.baseURI);!function(e){Number.isInteger(e)&&(If=e)}(g);const T={canvasFactory:new R({ownerDocument:S,enableHWA:N}),filterFactory:new M({docId:i,ownerDocument:S}),cMapReaderFactory:L?null:new I({baseUrl:d,isCompressed:u}),standardFontDataFactory:L?null:new C({baseUrl:f})};if(!l){const e={verbosity:g,port:TC.workerPort};l=e.port?Dp.fromPort(e):new Dp(e),t._worker=l}const H={docId:i,apiVersion:"4.10.45",data:s,password:o,disableAutoFetch:x,rangeChunkSize:c,length:G,docBaseUrl:h,enableXfa:k,evaluatorOptions:{maxImageSize:m,disableFontFace:y,ignoreErrors:p,isEvalSupported:B,isOffscreenCanvasSupported:Q,isImageDecoderSupported:E,canvasMaxAreaInBytes:b,fontExtraProperties:w,useSystemFonts:U,cMapUrl:L?d:null,standardFontDataUrl:L?f:null}},O={disableFontFace:y,fontExtraProperties:w,ownerDocument:S,pdfBug:F,styleElement:null,loadingParams:{disableAutoFetch:x,enableXfa:k}};return l.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");if(l.destroyed)throw new Error("Worker was destroyed");const e=l.messageHandler.sendWithPromise("GetDocRequest",H,s?[s.buffer]:null);let o;if(A)o=new WC(A,{disableRange:v,disableStream:D});else if(!s){if(!n)throw new Error("getDocument - no `url` parameter provided.");let e;if(lf)if(_f(n)){if("undefined"==typeof fetch||"undefined"==typeof Response||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");e=sp}else e=hp;else e=_f(n)?sp:Ap;o=new e({url:n,length:G,httpHeaders:a,withCredentials:r,rangeChunkSize:c,disableRange:v,disableStream:D})}return e.then((e=>{if(t.destroyed)throw new Error("Loading aborted");if(l.destroyed)throw new Error("Worker was destroyed");const n=new sC(i,e,l.port),s=new xp(n,t,o,O,T);t._transport=s,n.send("Ready",null)}))})).catch(t._capability.reject),t}function bp(e){return"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class yp{static#Ae=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+yp.#Ae++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}}class wp{constructor(e,t,i=!1,n=null){this.length=e,this.initialData=t,this.progressiveDone=i,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const i of this._rangeListeners)i(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){mf("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class kp{constructor(e,t){this._pdfInfo=e,this._transport=t}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 Qf(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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class Sp{#ye=null;#we=!1;constructor(e,t,i,n=!1){this._pageIndex=e,this._pageInfo=t,this._transport=i,this._stats=n?new jf:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new Rp,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}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:i=0,offsetY:n=0,dontFlip:s=!1}={}){return new Yf({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations({intent:e="display"}={}){const{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 Qf(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:i="display",annotationMode:n=1,transform:s=null,background:a=null,optionalContentConfigPromise:r=null,annotationCanvasMap:o=null,pageColors:A=null,printAnnotationStorage:c=null,isEditing:l=!1}){this._stats?.time("Overall");const g=this._transport.getRenderingIntent(i,n,c,l),{renderingIntent:h,cacheKey:d}=g;this.#we=!1,this.#ke(),r||=this._transport.getOptionalContentConfig(h);let u=this._intentStates.get(d);u||(u=Object.create(null),this._intentStates.set(d,u)),u.streamReaderCancelTimeout&&(clearTimeout(u.streamReaderCancelTimeout),u.streamReaderCancelTimeout=null);const I=!!(4&h);u.displayReadyCapability||(u.displayReadyCapability=Promise.withResolvers(),u.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(g));const f=e=>{u.renderTasks.delete(C),(this._maybeCleanupAfterRender||I)&&(this.#we=!0),this.#Se(!I),e?(C.capability.reject(e),this._abortOperatorList({intentState:u,reason:e instanceof Error?e:new Error(e)})):C.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},C=new Np({callback:f,params:{canvasContext:e,viewport:t,transform:s,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:o,operatorList:u.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!I,pdfBug:this._pdfBug,pageColors:A});(u.renderTasks||=new Set).add(C);const p=C.task;return Promise.all([u.displayReadyCapability.promise,r]).then((([e,t])=>{if(this.destroyed)f();else{if(this._stats?.time("Rendering"),!(t.renderingIntent&h))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");C.initializeGraphics({transparency:e,optionalContentConfig:t}),C.operatorListChanged()}})).catch(f),p}getOperatorList({intent:e="display",annotationMode:t=1,printAnnotationStorage:i=null,isEditing:n=!1}={}){const s=this._transport.getRenderingIntent(e,t,i,n,!0);let a,r=this._intentStates.get(s.cacheKey);return r||(r=Object.create(null),this._intentStates.set(s.cacheKey,r)),r.opListReadCapability||(a=Object.create(null),a.operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(a))},r.opListReadCapability=Promise.withResolvers(),(r.renderTasks||=new Set).add(a),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),r.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>Cp.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,i){const n=t.getReader(),s={items:[],styles:Object.create(null),lang:null};!function t(){n.read().then((function({value:i,done:n}){n?e(s):(s.lang??=i.lang,Object.assign(s.styles,i.styles),s.items.push(...i.items),t())}),i)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const i of t.renderTasks)e.push(i.completed),i.cancel();return this.objs.clear(),this.#we=!1,this.#ke(),Promise.all(e)}cleanup(e=!1){this.#we=!0;const t=this.#Se(!1);return e&&t&&(this._stats&&=new jf),t}#Se(e=!1){if(this.#ke(),!this.#we||this.destroyed)return!1;if(e)return this.#ye=setTimeout((()=>{this.#ye=null,this.#Se(!1)}),5e3),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#we=!1,!0}#ke(){this.#ye&&(clearTimeout(this.#ye),this.#ye=null)}_startRenderPage(e,t){const i=this._intentStates.get(t);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let i=0,n=e.length;i{r.read().then((({value:e,done:t})=>{t?o.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,o),A())}),(e=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(const e of o.renderTasks)e.operatorListChanged();this.#Se(!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(e);else{if(!o.opListReadCapability)throw e;o.opListReadCapability.reject(e)}}}))};A()}_abortOperatorList({intentState:e,reason:t,force:i=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!i){if(e.renderTasks.size>0)return;if(t instanceof Kf){let i=100;return t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),i))}}if(e.streamReader.cancel(new Df(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}class vp{#ve=new Map;#De=Promise.resolve();postMessage(e,t){const i={data:structuredClone(e,t?{transfer:t}:null)};this.#De.then((()=>{for(const[e]of this.#ve)e.call(this,i)}))}addEventListener(e,t,i=null){let n=null;if(i?.signal instanceof AbortSignal){const{signal:s}=i;if(s.aborted)return void pf("LoopbackPort - cannot use an `aborted` signal.");const a=()=>this.removeEventListener(e,t);n=()=>s.removeEventListener("abort",a),s.addEventListener("abort",a)}this.#ve.set(t,n)}removeEventListener(e,t){const i=this.#ve.get(t);i?.(),this.#ve.delete(t)}terminate(){for(const[,e]of this.#ve)e?.();this.#ve.clear()}}class Dp{static#xe=0;static#Fe=!1;static#Re;static{lf&&(this.#Fe=!0,TC.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(e,t)=>{let i;try{if(i=new URL(e),!i.origin||"null"===i.origin)return!1}catch{return!1}const n=new URL(t,i);return i.origin===n.origin},this._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))}}constructor({name:e=null,port:t=null,verbosity:i=ff()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if(Dp.#Re?.has(t))throw new Error("Cannot use more than one PDFWorker per port.");(Dp.#Re||=new WeakMap).set(t,this),this._initializeFromPort(t)}else this._initialize()}get promise(){return this._readyCapability.promise}#Me(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new sC("main","worker",e),this._messageHandler.on("ready",(function(){})),this.#Me()}_initialize(){try{const e=new Blob(['/**\n * @licstart The following is the entire license notice for the\n * JavaScript code in this page\n *\n * Copyright 2024 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @licend The above is the entire license notice for the\n * JavaScript code in this page\n */var e={d:(t,i)=>{for(var a in i)e.o(i,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:i[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},__webpack_exports__ = globalThis.pdfjsWorker = {};e.d(__webpack_exports__,{WorkerMessageHandler:()=>WorkerMessageHandler});const t=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],s=1.35,r=.35,n=.25925925925925924,g=1,o=2,c=4,C=8,h=16,l=64,Q=128,E=256,u="pdfjs_internal_editor_",d=3,f=9,p=13,m=15,y={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},w=0,D=4,b=1,F=2,S=3,k=1,R=2,N=3,G=4,M=5,U=6,x=7,L=8,H=9,J=10,Y=11,v=12,K=13,T=14,q=15,O=16,W=17,j=20,X="Group",Z="R",V=1,z=2,_=4,$=16,AA=32,eA=128,tA=512,iA=1,aA=2,sA=4096,rA=8192,nA=32768,gA=65536,oA=131072,IA=1048576,cA=2097152,CA=8388608,hA=16777216,lA=1,BA=2,QA=3,EA=4,uA=5,dA={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},fA={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},pA={O:"PageOpen",C:"PageClose"},mA=1,yA=5,wA=1,DA=2,bA=3,FA=4,SA=5,kA=6,RA=7,NA=8,GA=9,MA=10,UA=11,xA=12,LA=13,HA=14,JA=15,YA=16,vA=17,KA=18,TA=19,qA=20,OA=21,PA=22,WA=23,jA=24,XA=25,ZA=26,VA=27,zA=28,_A=29,$A=30,Ae=31,ee=32,te=33,ie=34,ae=35,se=36,re=37,ne=38,ge=39,oe=40,Ie=41,ce=42,Ce=43,he=44,le=45,Be=46,Qe=47,Ee=48,ue=49,de=50,fe=51,pe=52,me=53,ye=54,we=55,De=56,be=57,Fe=58,Se=59,ke=60,Re=61,Ne=62,Ge=63,Me=64,Ue=65,xe=66,Le=67,He=68,Je=69,Ye=70,ve=71,Ke=72,Te=73,qe=74,Oe=75,Pe=76,We=77,je=80,Xe=81,Ze=83,Ve=84,ze=85,_e=86,$e=87,At=88,et=89,tt=90,it=91,at=92,st=93,rt=1,nt=2;let gt=mA;function getVerbosityLevel(){return gt}function info(e){gt>=yA&&console.log(`Info: ${e}`)}function warn(e){gt>=mA&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\\./g);t?.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch{}}const a=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch{}return null}function shadow(e,t,i,a=!1){Object.defineProperty(e,t,{value:i,enumerable:!a,configurable:!0,writable:!1});return i}const ot=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class PasswordException extends ot{constructor(e,t){super(e,"PasswordException");this.code=t}}class UnknownErrorException extends ot{constructor(e,t){super(e,"UnknownErrorException");this.details=t}}class InvalidPDFException extends ot{constructor(e){super(e,"InvalidPDFException")}}class MissingPDFException extends ot{constructor(e){super(e,"MissingPDFException")}}class UnexpectedResponseException extends ot{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}}class FormatError extends ot{constructor(e){super(e,"FormatError")}}class AbortException extends ot{constructor(e){super(e,"AbortException")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t>24&255,e>>16&255,e>>8&255,255&e)}function objectSize(e){return Object.keys(e).length}class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?shadow(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):shadow(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const It=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${It[e]}${It[t]}${It[i]}`}static scaleMinMax(e,t){let i;if(e[0]){if(e[0]<0){i=t[0];t[0]=t[2];t[2]=i}t[0]*=e[0];t[2]*=e[0];if(e[3]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[3];t[3]*=e[3]}else{i=t[0];t[0]=t[1];t[1]=i;i=t[2];t[2]=t[3];t[3]=i;if(e[1]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[1];t[3]*=e[1];if(e[2]<0){i=t[0];t[0]=t[2];t[2]=i}t[0]*=e[2];t[2]*=e[2]}t[0]+=e[4];t[1]+=e[5];t[2]+=e[4];t[3]+=e[5]}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 applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=this.applyTransform(e,t),a=this.applyTransform(e.slice(2,4),t),s=this.applyTransform([e[0],e[3]],t),r=this.applyTransform([e[2],e[1]],t);return[Math.min(i[0],a[0],s[0],r[0]),Math.min(i[1],a[1],s[1],r[1]),Math.max(i[0],a[0],s[0],r[0]),Math.max(i[1],a[1],s[1],r[1])]}static inverseTransform(e){const 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){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],a=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],n=(i+r)/2,g=Math.sqrt((i+r)**2-4*(i*r-s*a))/2,o=n+g||1,c=n-g||1;return[Math.sqrt(o),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>a)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,a,r]}static#A(e,t,i,a,s,r,n,g,o,c){if(o<=0||o>=1)return;const C=1-o,h=o*o,l=h*o,Q=C*(C*(C*e+3*o*t)+3*h*i)+l*a,E=C*(C*(C*s+3*o*r)+3*h*n)+l*g;c[0]=Math.min(c[0],Q);c[1]=Math.min(c[1],E);c[2]=Math.max(c[2],Q);c[3]=Math.max(c[3],E)}static#e(e,t,i,a,s,r,n,g,o,c,C,h){if(Math.abs(o)<1e-12){Math.abs(c)>=1e-12&&this.#A(e,t,i,a,s,r,n,g,-C/c,h);return}const l=c**2-4*C*o;if(l<0)return;const Q=Math.sqrt(l),E=2*o;this.#A(e,t,i,a,s,r,n,g,(-c+Q)/E,h);this.#A(e,t,i,a,s,r,n,g,(-c-Q)/E,h)}static bezierBoundingBox(e,t,i,a,s,r,n,g,o){if(o){o[0]=Math.min(o[0],e,n);o[1]=Math.min(o[1],t,g);o[2]=Math.max(o[2],e,n);o[3]=Math.max(o[3],t,g)}else o=[Math.min(e,n),Math.min(t,g),Math.max(e,n),Math.max(t,g)];this.#e(e,i,s,n,t,a,r,g,3*(3*(i-s)-e+n),6*(e-2*i+s),3*(i-e),o);this.#e(e,i,s,n,t,a,r,g,3*(3*(a-r)-t+g),6*(t-2*a+r),3*(a-t),o);return o}}const ct=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToPDFString(e){if(e[0]>="ï"){let t;if("þ"===e[0]&&"ÿ"===e[1]){t="utf-16be";e.length%2==1&&(e=e.slice(0,-1))}else if("ÿ"===e[0]&&"þ"===e[1]){t="utf-16le";e.length%2==1&&(e=e.slice(0,-1))}else"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8");if(t)try{const i=new TextDecoder(t,{fatal:!0}),a=stringToBytes(e),s=i.decode(a);return s.includes("")?s.replaceAll(/\\x1b[^\\x1b]*(?:\\x1b|$)/g,""):s}catch(e){warn(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,a=e.length;iIt[e])).join("")}"function"!=typeof Promise.try&&(Promise.try=function(e,...t){return new Promise((i=>{i(e(...t))}))});const lt=Symbol("CIRCULAR_REF"),Bt=Symbol("EOF");let Qt=Object.create(null),Et=Object.create(null),ut=Object.create(null);class Name{constructor(e){this.name=e}static get(e){return Et[e]||=new Name(e)}}class Cmd{constructor(e){this.cmd=e}static get(e){return Qt[e]||=new Cmd(e)}}const dt=function nonSerializableClosure(){return dt};class Dict{constructor(e=null){this._map=new Map;this.xref=e;this.objId=null;this.suppressEncryption=!1;this.__nonSerializable__=dt}assignXref(e){this.xref=e}get size(){return this._map.size}get(e,t,i){let a=this._map.get(e);if(void 0===a&&void 0!==t){a=this._map.get(t);void 0===a&&void 0!==i&&(a=this._map.get(i))}return a instanceof Ref&&this.xref?this.xref.fetch(a,this.suppressEncryption):a}async getAsync(e,t,i){let a=this._map.get(e);if(void 0===a&&void 0!==t){a=this._map.get(t);void 0===a&&void 0!==i&&(a=this._map.get(i))}return a instanceof Ref&&this.xref?this.xref.fetchAsync(a,this.suppressEncryption):a}getArray(e,t,i){let a=this._map.get(e);if(void 0===a&&void 0!==t){a=this._map.get(t);void 0===a&&void 0!==i&&(a=this._map.get(i))}a instanceof Ref&&this.xref&&(a=this.xref.fetch(a,this.suppressEncryption));if(Array.isArray(a)){a=a.slice();for(let e=0,t=a.length;e{unreachable("Should not call `set` on the empty dictionary.")};return shadow(this,"empty",e)}static merge({xref:e,dictArray:t,mergeSubDicts:i=!1}){const a=new Dict(e),s=new Map;for(const e of t)if(e instanceof Dict)for(const[t,a]of e._map){let e=s.get(t);if(void 0===e){e=[];s.set(t,e)}else if(!(i&&a instanceof Dict))continue;e.push(a)}for(const[t,i]of s){if(1===i.length||!(i[0]instanceof Dict)){a._map.set(t,i[0]);continue}const s=new Dict(e);for(const e of i)for(const[t,i]of e._map)s._map.has(t)||s._map.set(t,i);s.size>0&&a._map.set(t,s)}s.clear();return a.size>0?a:Dict.empty}clone(){const e=new Dict(this.xref);for(const t of this.getKeys())e.set(t,this.getRaw(t));return e}delete(e){delete this._map[e]}}class Ref{constructor(e,t){this.num=e;this.gen=t}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(e){const t=ut[e];if(t)return t;const i=/^(\\d+)R(\\d*)$/.exec(e);return i&&"0"!==i[1]?ut[e]=new Ref(parseInt(i[1]),i[2]?parseInt(i[2]):0):null}static get(e,t){const i=0===t?`${e}R`:`${e}R${t}`;return ut[i]||=new Ref(e,t)}}class RefSet{constructor(e=null){this._set=new Set(e?._set)}has(e){return this._set.has(e.toString())}put(e){this._set.add(e.toString())}remove(e){this._set.delete(e.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}class RefSetCache{constructor(){this._map=new Map}get size(){return this._map.size}get(e){return this._map.get(e.toString())}has(e){return this._map.has(e.toString())}put(e,t){this._map.set(e.toString(),t)}putAlias(e,t){this._map.set(e.toString(),this.get(t))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*values(){yield*this._map.values()}*items(){for(const[e,t]of this._map)yield[Ref.fromString(e),t]}}function isName(e,t){return e instanceof Name&&(void 0===t||e.name===t)}function isCmd(e,t){return e instanceof Cmd&&(void 0===t||e.cmd===t)}function isDict(e,t){return e instanceof Dict&&(void 0===t||isName(e.get("Type"),t))}function isRefsEqual(e,t){return e.num===t.num&&e.gen===t.gen}class BaseStream{get length(){unreachable("Abstract getter `length` accessed")}get isEmpty(){unreachable("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return shadow(this,"isDataLoaded",!0)}getByte(){unreachable("Abstract method `getByte` called")}getBytes(e){unreachable("Abstract method `getBytes` called")}async getImageData(e,t){return this.getBytes(e,t)}async asyncGetBytes(){unreachable("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}async getTransferableImage(){return null}peekByte(){const e=this.getByte();-1!==e&&this.pos--;return e}peekBytes(e){const t=this.getBytes(e);this.pos-=t.length;return t}getUint16(){const e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(e,t){unreachable("Abstract method `getByteRange` called")}getString(e){return bytesToString(this.getBytes(e))}skip(e){this.pos+=e||1}reset(){unreachable("Abstract method `reset` called")}moveStart(){unreachable("Abstract method `moveStart` called")}makeSubStream(e,t,i=null){unreachable("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}const ft=/^[1-9]\\.\\d$/,pt=2**31-1;function getLookupTableFactory(e){let t;return function(){if(e){t=Object.create(null);e(t);e=null}return t}}class MissingDataException extends ot{constructor(e,t){super(`Missing data [${e}, ${t})`,"MissingDataException");this.begin=e;this.end=t}}class ParserEOFException extends ot{constructor(e){super(e,"ParserEOFException")}}class XRefEntryException extends ot{constructor(e){super(e,"XRefEntryException")}}class XRefParseException extends ot{constructor(e){super(e,"XRefParseException")}}function arrayBuffersToBytes(e){const t=e.length;if(0===t)return new Uint8Array(0);if(1===t)return new Uint8Array(e[0]);let i=0;for(let a=0;a0,"The number should be a positive integer.");const i="M".repeat(e/1e3|0)+mt[e%1e3/100|0]+mt[10+(e%100/10|0)]+mt[20+e%10];return t?i.toLowerCase():i}function log2(e){return e>0?Math.ceil(Math.log2(e)):0}function readInt8(e,t){return e[t]<<24>>24}function readUint16(e,t){return e[t]<<8|e[t+1]}function readUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function isWhiteSpace(e){return 32===e||9===e||13===e||10===e}function isNumberArray(e,t){return Array.isArray(e)?(null===t||e.length===t)&&e.every((e=>"number"==typeof e)):ArrayBuffer.isView(e)&&(0===e.length||"number"==typeof e[0])&&(null===t||e.length===t)}function lookupMatrix(e,t){return isNumberArray(e,6)?e:t}function lookupRect(e,t){return isNumberArray(e,4)?e:t}function lookupNormalRect(e,t){return isNumberArray(e,4)?Util.normalizeRect(e):t}function parseXFAPath(e){const t=/(.+)\\[(\\d+)\\]$/;return e.split(".").map((e=>{const i=e.match(t);return i?{name:i[1],pos:parseInt(i[2],10)}:{name:e,pos:0}}))}function escapePDFName(e){const t=[];let i=0;for(let a=0,s=e.length;a126||35===s||40===s||41===s||60===s||62===s||91===s||93===s||123===s||125===s||47===s||37===s){i"\\n"===e?"\\\\n":"\\r"===e?"\\\\r":`\\\\${e}`))}function _collectJS(e,t,i,a){if(!e)return;let s=null;if(e instanceof Ref){if(a.has(e))return;s=e;a.put(s);e=t.fetch(e)}if(Array.isArray(e))for(const s of e)_collectJS(s,t,i,a);else if(e instanceof Dict){if(isName(e.get("S"),"JavaScript")){const t=e.get("JS");let a;t instanceof BaseStream?a=t.getString():"string"==typeof t&&(a=t);a&&=stringToPDFString(a).replaceAll("\\0","");a&&i.push(a)}_collectJS(e.getRaw("Next"),t,i,a)}s&&a.remove(s)}function collectActions(e,t,i){const a=Object.create(null),s=getInheritableProperty({dict:t,key:"AA",stopWhenFound:!1});if(s)for(let t=s.length-1;t>=0;t--){const r=s[t];if(r instanceof Dict)for(const t of r.getKeys()){const s=i[t];if(!s)continue;const n=[];_collectJS(r.getRaw(t),e,n,new RefSet);n.length>0&&(a[s]=n)}}if(t.has("A")){const i=[];_collectJS(t.get("A"),e,i,new RefSet);i.length>0&&(a.Action=i)}return objectSize(a)>0?a:null}const yt={60:"<",62:">",38:"&",34:""",39:"'"};function*codePointIter(e){for(let t=0,i=e.length;t55295&&(i<57344||i>65533)&&t++;yield i}}function encodeToXmlString(e){const t=[];let i=0;for(let a=0,s=e.length;a55295&&(s<57344||s>65533)&&a++;i=a+1}}if(0===t.length)return e;i: ${e}.`);return!1}return!0}function validateCSSFont(e){const t=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:i,fontWeight:a,italicAngle:s}=e;if(!validateFontName(i,!0))return!1;const r=a?a.toString():"";e.fontWeight=t.has(r)?r:"400";const n=parseFloat(s);e.italicAngle=isNaN(n)||n<-90||n>90?"14":s.toString();return!0}function recoverJsURL(e){const t=new RegExp("^\\\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\\\.")+")\\\\((?:\'|\\")([^\'\\"]*)(?:\'|\\")(?:,\\\\s*(\\\\w+)\\\\)|\\\\))","i").exec(e);return t?.[2]?{url:t[2],newWindow:"app.launchURL"===t[1]&&"true"===t[3]}:null}function numberToString(e){if(Number.isInteger(e))return e.toString();const t=Math.round(100*e);return t%100==0?(t/100).toString():t%10==0?e.toFixed(1):e.toFixed(2)}function getNewAnnotationsMap(e){if(!e)return null;const t=new Map;for(const[i,a]of e){if(!i.startsWith(u))continue;let e=t.get(a.pageIndex);if(!e){e=[];t.set(a.pageIndex,e)}e.push(a)}return t.size>0?t:null}function stringToAsciiOrUTF16BE(e){return function isAscii(e){return/^[\\x00-\\x7F]*$/.test(e)}(e)?e:stringToUTF16String(e,!0)}function stringToUTF16HexString(e){const t=[];for(let i=0,a=e.length;i>8&255],It[255&a])}return t.join("")}function stringToUTF16String(e,t=!1){const i=[];t&&i.push("þÿ");for(let t=0,a=e.length;t>8&255),String.fromCharCode(255&a))}return i.join("")}function getRotationMatrix(e,t,i){switch(e){case 90:return[0,1,-1,0,t,0];case 180:return[-1,0,0,-1,t,i];case 270:return[0,-1,1,0,0,i];default:throw new Error("Invalid rotation")}}function getSizeInBytes(e){return Math.ceil(Math.ceil(Math.log2(1+e))/8)}class Stream extends BaseStream{constructor(e,t,i,a){super();this.bytes=e instanceof Uint8Array?e:new Uint8Array(e);this.start=t||0;this.pos=this.start;this.end=t+i||this.bytes.length;this.dict=a}get length(){return this.end-this.start}get isEmpty(){return 0===this.length}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(e){const t=this.bytes,i=this.pos,a=this.end;if(!e)return t.subarray(i,a);let s=i+e;s>a&&(s=a);this.pos=s;return t.subarray(i,s)}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);return this.bytes.subarray(e,t)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(e,t,i=null){return new Stream(this.bytes.buffer,e,t,i)}}class StringStream extends Stream{constructor(e){super(stringToBytes(e))}}class NullStream extends Stream{constructor(){super(new Uint8Array(0))}}class ChunkedStream extends Stream{constructor(e,t,i){super(new Uint8Array(e),0,e,null);this.chunkSize=t;this._loadedChunks=new Set;this.numChunks=Math.ceil(e/t);this.manager=i;this.progressiveDataLength=0;this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const e=[];for(let t=0,i=this.numChunks;t=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(let e=i;ethis.numChunks)&&t!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(t))throw new MissingDataException(e,e+1);this.lastSuccessfulEnsureByteChunk=t}}ensureRange(e,t){if(e>=t)return;if(t<=this.progressiveDataLength)return;const i=Math.floor(e/this.chunkSize);if(i>this.numChunks)return;const a=Math.min(Math.floor((t-1)/this.chunkSize)+1,this.numChunks);for(let s=i;s=this.end)return-1;e>=this.progressiveDataLength&&this.ensureByte(e);return this.bytes[this.pos++]}getBytes(e){const t=this.bytes,i=this.pos,a=this.end;if(!e){a>this.progressiveDataLength&&this.ensureRange(i,a);return t.subarray(i,a)}let s=i+e;s>a&&(s=a);s>this.progressiveDataLength&&this.ensureRange(i,s);this.pos=s;return t.subarray(i,s)}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);t>this.progressiveDataLength&&this.ensureRange(e,t);return this.bytes.subarray(e,t)}makeSubStream(e,t,i=null){t?e+t>this.progressiveDataLength&&this.ensureRange(e,e+t):e>=this.progressiveDataLength&&this.ensureByte(e);function ChunkedStreamSubstream(){}ChunkedStreamSubstream.prototype=Object.create(this);ChunkedStreamSubstream.prototype.getMissingChunks=function(){const e=this.chunkSize,t=Math.floor(this.start/e),i=Math.floor((this.end-1)/e)+1,a=[];for(let e=t;e{const readChunk=({value:r,done:n})=>{try{if(n){const t=arrayBuffersToBytes(a);a=null;e(t);return}s+=r.byteLength;i.isStreamingSupported&&this.onProgress({loaded:s});a.push(r);i.read().then(readChunk,t)}catch(e){t(e)}};i.read().then(readChunk,t)})).then((t=>{this.aborted||this.onReceiveData({chunk:t,begin:e})}))}requestAllChunks(e=!1){if(!e){const e=this.stream.getMissingChunks();this._requestChunks(e)}return this._loadedStreamCapability.promise}_requestChunks(e){const t=this.currRequestId++,i=new Set;this._chunksNeededByRequest.set(t,i);for(const t of e)this.stream.hasChunk(t)||i.add(t);if(0===i.size)return Promise.resolve();const a=Promise.withResolvers();this._promisesByRequest.set(t,a);const s=[];for(const e of i){let i=this._requestsByChunk.get(e);if(!i){i=[];this._requestsByChunk.set(e,i);s.push(e)}i.push(t)}if(s.length>0){const e=this.groupChunks(s);for(const t of e){const e=t.beginChunk*this.chunkSize,i=Math.min(t.endChunk*this.chunkSize,this.length);this.sendRequest(e,i).catch(a.reject)}}return a.promise.catch((e=>{if(!this.aborted)throw e}))}getStream(){return this.stream}requestRange(e,t){t=Math.min(t,this.length);const i=this.getBeginChunk(e),a=this.getEndChunk(t),s=[];for(let e=i;e=0&&a+1!==r){t.push({beginChunk:i,endChunk:a+1});i=r}s+1===e.length&&t.push({beginChunk:i,endChunk:r+1});a=r}return t}onProgress(e){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+e.loaded,total:this.length})}onReceiveData(e){const t=e.chunk,i=void 0===e.begin,a=i?this.progressiveDataLength:e.begin,s=a+t.byteLength,r=Math.floor(a/this.chunkSize),n=s0||g.push(i)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let e;if(1===this.stream.numChunksLoaded){const t=this.stream.numChunks-1;this.stream.hasChunk(t)||(e=t)}else e=this.stream.nextEmptyChunk(n);Number.isInteger(e)&&this._requestChunks([e])}for(const e of g){const t=this._promisesByRequest.get(e);this._promisesByRequest.delete(e);t.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(e){this._loadedStreamCapability.reject(e)}getBeginChunk(e){return Math.floor(e/this.chunkSize)}getEndChunk(e){return Math.floor((e-1)/this.chunkSize)+1}abort(e){this.aborted=!0;this.pdfNetworkStream?.cancelAllRequests(e);for(const t of this._promisesByRequest.values())t.reject(e)}}class ColorSpace{constructor(e,t){this.name=e;this.numComps=t}getRgb(e,t){const i=new Uint8ClampedArray(3);this.getRgbItem(e,t,i,0);return i}getRgbItem(e,t,i,a){unreachable("Should not call ColorSpace.getRgbItem")}getRgbBuffer(e,t,i,a,s,r,n){unreachable("Should not call ColorSpace.getRgbBuffer")}getOutputLength(e,t){unreachable("Should not call ColorSpace.getOutputLength")}isPassthrough(e){return!1}isDefaultDecode(e,t){return ColorSpace.isDefaultDecode(e,this.numComps)}fillRgb(e,t,i,a,s,r,n,g,o){const c=t*i;let C=null;const h=1<h&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const t=n<=8?new Uint8Array(h):new Uint16Array(h);for(let e=0;e=.99554525?1:this.#B(0,1,1.055*e**(1/2.4)-.055)}#B(e,t,i){return Math.max(e,Math.min(t,i))}#Q(e){return e<0?-this.#Q(-e):e>8?((e+16)/116)**3:e*CalRGBCS.#I}#E(e,t,i){if(0===e[0]&&0===e[1]&&0===e[2]){i[0]=t[0];i[1]=t[1];i[2]=t[2];return}const a=this.#Q(0),s=(1-a)/(1-this.#Q(e[0])),r=1-s,n=(1-a)/(1-this.#Q(e[1])),g=1-n,o=(1-a)/(1-this.#Q(e[2])),c=1-o;i[0]=t[0]*s+r;i[1]=t[1]*n+g;i[2]=t[2]*o+c}#u(e,t,i){if(1===e[0]&&1===e[2]){i[0]=t[0];i[1]=t[1];i[2]=t[2];return}const a=i;this.#c(CalRGBCS.#i,t,a);const s=CalRGBCS.#n;this.#C(e,a,s);this.#c(CalRGBCS.#a,s,i)}#d(e,t,i){const a=i;this.#c(CalRGBCS.#i,t,a);const s=CalRGBCS.#n;this.#h(e,a,s);this.#c(CalRGBCS.#a,s,i)}#t(e,t,i,a,s){const r=this.#B(0,1,e[t]*s),n=this.#B(0,1,e[t+1]*s),g=this.#B(0,1,e[t+2]*s),o=1===r?1:r**this.GR,c=1===n?1:n**this.GG,C=1===g?1:g**this.GB,h=this.MXA*o+this.MXB*c+this.MXC*C,l=this.MYA*o+this.MYB*c+this.MYC*C,Q=this.MZA*o+this.MZB*c+this.MZC*C,E=CalRGBCS.#g;E[0]=h;E[1]=l;E[2]=Q;const u=CalRGBCS.#o;this.#u(this.whitePoint,E,u);const d=CalRGBCS.#g;this.#E(this.blackPoint,u,d);const f=CalRGBCS.#o;this.#d(CalRGBCS.#r,d,f);const p=CalRGBCS.#g;this.#c(CalRGBCS.#s,f,p);i[a]=255*this.#l(p[0]);i[a+1]=255*this.#l(p[1]);i[a+2]=255*this.#l(p[2])}getRgbItem(e,t,i,a){this.#t(e,t,i,a,1)}getRgbBuffer(e,t,i,a,s,r,n){const g=1/((1<this.amax||this.bmin>this.bmax){info("Invalid Range, falling back to defaults");this.amin=-100;this.amax=100;this.bmin=-100;this.bmax=100}}#f(e){return e>=6/29?e**3:108/841*(e-4/29)}#p(e,t,i,a){return i+e*(a-i)/t}#t(e,t,i,a,s){let r=e[t],n=e[t+1],g=e[t+2];if(!1!==i){r=this.#p(r,i,0,100);n=this.#p(n,i,this.amin,this.amax);g=this.#p(g,i,this.bmin,this.bmax)}n>this.amax?n=this.amax:nthis.bmax?g=this.bmax:g>>0}function hexToStr(e,t){return 1===t?String.fromCharCode(e[0],e[1]):3===t?String.fromCharCode(e[0],e[1],e[2],e[3]):String.fromCharCode(...e.subarray(0,t+1))}function addHex(e,t,i){let a=0;for(let s=i;s>=0;s--){a+=e[s]+t[s];e[s]=255&a;a>>=8}}function incHex(e,t){let i=1;for(let a=t;a>=0&&i>0;a--){i+=e[a];e[a]=255&i;i>>=8}}const wt=16;class BinaryCMapStream{constructor(e){this.buffer=e;this.pos=0;this.end=e.length;this.tmpBuf=new Uint8Array(19)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let e,t=0;do{const i=this.readByte();if(i<0)throw new FormatError("unexpected EOF in bcmap");e=!(128&i);t=t<<7|127&i}while(!e);return t}readSigned(){const e=this.readNumber();return 1&e?~(e>>>1):e>>>1}readHex(e,t){e.set(this.buffer.subarray(this.pos,this.pos+t+1));this.pos+=t+1}readHexNumber(e,t){let i;const a=this.tmpBuf;let s=0;do{const e=this.readByte();if(e<0)throw new FormatError("unexpected EOF in bcmap");i=!(128&e);a[s++]=127&e}while(!i);let r=t,n=0,g=0;for(;r>=0;){for(;g<8&&a.length>0;){n|=a[--s]<>=8;g-=8}}readHexSigned(e,t){this.readHexNumber(e,t);const i=1&e[t]?255:0;let a=0;for(let s=0;s<=t;s++){a=(1&a)<<8|e[s];e[s]=a>>1^i}}readString(){const e=this.readNumber(),t=new Array(e);for(let i=0;i=0;){const e=l>>5;if(7===e){switch(31&l){case 0:a.readString();break;case 1:r=a.readString()}continue}const i=!!(16&l),s=15&l;if(s+1>wt)throw new Error("BinaryCMapReader.process: Invalid dataSize.");const Q=1,E=a.readNumber();switch(e){case 0:a.readHex(n,s);a.readHexNumber(g,s);addHex(g,n,s);t.addCodespaceRange(s+1,hexToInt(n,s),hexToInt(g,s));for(let e=1;es&&(a=s)}else{for(;!this.eof;)this.readBlock(t);a=this.bufferLength}this.pos=a;return this.buffer.subarray(i,a)}async getImageData(e,t=null){if(!this.canAsyncDecodeImageFromBuffer)return this.getBytes(e,t);const i=await this.stream.asyncGetBytes();return this.decodeImage(i,t)}reset(){this.pos=0}makeSubStream(e,t,i=null){if(void 0===t)for(;!this.eof;)this.readBlock();else{const i=e+t;for(;this.bufferLength<=i&&!this.eof;)this.readBlock()}return new Stream(this.buffer,e,t,i)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}}class StreamsSequenceStream extends DecodeStream{constructor(e,t=null){e=e.filter((e=>e instanceof BaseStream));let i=0;for(const t of e)i+=t instanceof DecodeStream?t._rawMinBufferLength:t.length;super(i);this.streams=e;this._onError=t}readBlock(){const e=this.streams;if(0===e.length){this.eof=!0;return}const t=e.shift();let i;try{i=t.getBytes()}catch(e){if(this._onError){this._onError(e,t.dict?.objId);return}throw e}const a=this.bufferLength,s=a+i.length;this.ensureBuffer(s).set(i,a);this.bufferLength=s}getBaseStreams(){const e=[];for(const t of this.streams){const i=t.getBaseStreams();i&&e.push(...i)}return e.length>0?e:null}}class Ascii85Stream extends DecodeStream{constructor(e,t){t&&(t*=.8);super(t);this.str=e;this.dict=e.dict;this.input=new Uint8Array(5)}readBlock(){const e=this.str;let t=e.getByte();for(;isWhiteSpace(t);)t=e.getByte();if(-1===t||126===t){this.eof=!0;return}const i=this.bufferLength;let a,s;if(122===t){a=this.ensureBuffer(i+4);for(s=0;s<4;++s)a[i+s]=0;this.bufferLength+=4}else{const r=this.input;r[0]=t;for(s=1;s<5;++s){t=e.getByte();for(;isWhiteSpace(t);)t=e.getByte();r[s]=t;if(-1===t||126===t)break}a=this.ensureBuffer(i+s-1);this.bufferLength+=s-1;if(s<5){for(;s<5;++s)r[s]=117;this.eof=!0}let n=0;for(s=0;s<5;++s)n=85*n+(r[s]-33);for(s=3;s>=0;--s){a[i+s]=255&n;n>>=8}}}}class AsciiHexStream extends DecodeStream{constructor(e,t){t&&(t*=.5);super(t);this.str=e;this.dict=e.dict;this.firstDigit=-1}readBlock(){const e=this.str.getBytes(8e3);if(!e.length){this.eof=!0;return}const t=e.length+1>>1,i=this.ensureBuffer(this.bufferLength+t);let a=this.bufferLength,s=this.firstDigit;for(const t of e){let e;if(t>=48&&t<=57)e=15&t;else{if(!(t>=65&&t<=70||t>=97&&t<=102)){if(62===t){this.eof=!0;break}continue}e=9+(15&t)}if(s<0)s=e;else{i[a++]=s<<4|e;s=-1}}if(s>=0&&this.eof){i[a++]=s<<4;s=-1}this.firstDigit=s;this.bufferLength=a}}const bt=-1,Ft=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],St=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],kt=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],Rt=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],Nt=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],Gt=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];class CCITTFaxDecoder{constructor(e,t={}){if("function"!=typeof e?.next)throw new Error(\'CCITTFaxDecoder - invalid "source" parameter.\');this.source=e;this.eof=!1;this.encoding=t.K||0;this.eoline=t.EndOfLine||!1;this.byteAlign=t.EncodedByteAlign||!1;this.columns=t.Columns||1728;this.rows=t.Rows||0;this.eoblock=t.EndOfBlock??!0;this.black=t.BlackIs1||!1;this.codingLine=new Uint32Array(this.columns+1);this.refLine=new Uint32Array(this.columns+2);this.codingLine[0]=this.columns;this.codingPos=0;this.row=0;this.nextLine2D=this.encoding<0;this.inputBits=0;this.inputBuf=0;this.outputBits=0;this.rowsDone=!1;let i;for(;0===(i=this._lookBits(12));)this._eatBits(1);1===i&&this._eatBits(12);if(this.encoding>0){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}}readNextChar(){if(this.eof)return-1;const e=this.refLine,t=this.codingLine,i=this.columns;let a,s,r,n,g;if(0===this.outputBits){this.rowsDone&&(this.eof=!0);if(this.eof)return-1;this.err=!1;let r,g,o;if(this.nextLine2D){for(n=0;t[n]=64);do{g+=o=this._getWhiteCode()}while(o>=64)}else{do{r+=o=this._getWhiteCode()}while(o>=64);do{g+=o=this._getBlackCode()}while(o>=64)}this._addPixels(t[this.codingPos]+r,s);t[this.codingPos]0?--a:++a;for(;e[a]<=t[this.codingPos]&&e[a]0?--a:++a;for(;e[a]<=t[this.codingPos]&&e[a]0?--a:++a;for(;e[a]<=t[this.codingPos]&&e[a]=64);else do{r+=o=this._getWhiteCode()}while(o>=64);this._addPixels(t[this.codingPos]+r,s);s^=1}}let c=!1;this.byteAlign&&(this.inputBits&=-8);if(this.eoblock||this.row!==this.rows-1){r=this._lookBits(12);if(this.eoline)for(;r!==bt&&1!==r;){this._eatBits(1);r=this._lookBits(12)}else for(;0===r;){this._eatBits(1);r=this._lookBits(12)}if(1===r){this._eatBits(12);c=!0}else r===bt&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}if(this.eoblock&&c&&this.byteAlign){r=this._lookBits(12);if(1===r){this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}if(this.encoding>=0)for(n=0;n<4;++n){r=this._lookBits(12);1!==r&&info("bad rtc code: "+r);this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}}this.eof=!0}}else if(this.err&&this.eoline){for(;;){r=this._lookBits(13);if(r===bt){this.eof=!0;return-1}if(r>>1==1)break;this._eatBits(1)}this._eatBits(12);if(this.encoding>0){this._eatBits(1);this.nextLine2D=!(1&r)}}this.outputBits=t[0]>0?t[this.codingPos=0]:t[this.codingPos=1];this.row++}if(this.outputBits>=8){g=1&this.codingPos?0:255;this.outputBits-=8;if(0===this.outputBits&&t[this.codingPos]r){g<<=r;1&this.codingPos||(g|=255>>8-r);this.outputBits-=r;r=0}else{g<<=this.outputBits;1&this.codingPos||(g|=255>>8-this.outputBits);r-=this.outputBits;this.outputBits=0;if(t[this.codingPos]0){g<<=r;r=0}}}while(r)}this.black&&(g^=255);return g}_addPixels(e,t){const i=this.codingLine;let a=this.codingPos;if(e>i[a]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&a^t&&++a;i[a]=e}this.codingPos=a}_addPixelsNeg(e,t){const i=this.codingLine;let a=this.codingPos;if(e>i[a]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&a^t&&++a;i[a]=e}else if(e0&&e=s){const t=i[e-s];if(t[0]===a){this._eatBits(a);return[!0,t[1],!0]}}}return[!1,0,!1]}_getTwoDimCode(){let e,t=0;if(this.eoblock){t=this._lookBits(7);e=Ft[t];if(e?.[0]>0){this._eatBits(e[0]);return e[1]}}else{const e=this._findTableCode(1,7,Ft);if(e[0]&&e[2])return e[1]}info("Bad two dim code");return bt}_getWhiteCode(){let e,t=0;if(this.eoblock){t=this._lookBits(12);if(t===bt)return 1;e=t>>5?kt[t>>3]:St[t];if(e[0]>0){this._eatBits(e[0]);return e[1]}}else{let e=this._findTableCode(1,9,kt);if(e[0])return e[1];e=this._findTableCode(11,12,St);if(e[0])return e[1]}info("bad white code");this._eatBits(1);return 1}_getBlackCode(){let e,t;if(this.eoblock){e=this._lookBits(13);if(e===bt)return 1;t=e>>7?!(e>>9)&&e>>7?Nt[(e>>1)-64]:Gt[e>>7]:Rt[e];if(t[0]>0){this._eatBits(t[0]);return t[1]}}else{let e=this._findTableCode(2,6,Gt);if(e[0])return e[1];e=this._findTableCode(7,12,Nt,64);if(e[0])return e[1];e=this._findTableCode(10,13,Rt);if(e[0])return e[1]}info("bad black code");this._eatBits(1);return 1}_lookBits(e){let t;for(;this.inputBits>16-e;this.inputBuf=this.inputBuf<<8|t;this.inputBits+=8}return this.inputBuf>>this.inputBits-e&65535>>16-e}_eatBits(e){(this.inputBits-=e)<0&&(this.inputBits=0)}}class CCITTFaxStream extends DecodeStream{constructor(e,t,i){super(t);this.str=e;this.dict=e.dict;i instanceof Dict||(i=Dict.empty);const a={next:()=>e.getByte()};this.ccittFaxDecoder=new CCITTFaxDecoder(a,{K:i.get("K"),EndOfLine:i.get("EndOfLine"),EncodedByteAlign:i.get("EncodedByteAlign"),Columns:i.get("Columns"),Rows:i.get("Rows"),EndOfBlock:i.get("EndOfBlock"),BlackIs1:i.get("BlackIs1")})}readBlock(){for(;!this.eof;){const e=this.ccittFaxDecoder.readNextChar();if(-1===e){this.eof=!0;return}this.ensureBuffer(this.bufferLength+1);this.buffer[this.bufferLength++]=e}}}const Mt=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ut=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),xt=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Lt=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Ht=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class FlateStream extends DecodeStream{constructor(e,t){super(t);this.str=e;this.dict=e.dict;const i=e.getByte(),a=e.getByte();if(-1===i||-1===a)throw new FormatError(`Invalid header in flate stream: ${i}, ${a}`);if(8!=(15&i))throw new FormatError(`Unknown compression method in flate stream: ${i}, ${a}`);if(((i<<8)+a)%31!=0)throw new FormatError(`Bad FCHECK in flate stream: ${i}, ${a}`);if(32&a)throw new FormatError(`FDICT bit set in flate stream: ${i}, ${a}`);this.codeSize=0;this.codeBuf=0}async getImageData(e,t){const i=await this.asyncGetBytes();return i?.subarray(0,e)||this.getBytes(e)}async asyncGetBytes(){this.str.reset();const e=this.str.getBytes();try{const{readable:t,writable:i}=new DecompressionStream("deflate"),a=i.getWriter();await a.ready;a.write(e).then((async()=>{await a.ready;await a.close()})).catch((()=>{}));const s=[];let r=0;for await(const e of t){s.push(e);r+=e.byteLength}const n=new Uint8Array(r);let g=0;for(const e of s){n.set(e,g);g+=e.byteLength}return n}catch{this.str=new Stream(e,2,e.length,this.str.dict);this.reset();return null}}get isAsync(){return!0}getBits(e){const t=this.str;let i,a=this.codeSize,s=this.codeBuf;for(;a>e;this.codeSize=a-=e;return i}getCode(e){const t=this.str,i=e[0],a=e[1];let s,r=this.codeSize,n=this.codeBuf;for(;r>16,c=65535&g;if(o<1||r>o;this.codeSize=r-o;return c}generateHuffmanTable(e){const t=e.length;let i,a=0;for(i=0;ia&&(a=e[i]);const s=1<>=1}for(i=e;i>=1;if(0===t){let t;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}let i=t;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}i|=t<<8;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}let s=t;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}s|=t<<8;if(s!==(65535&~i)&&(0!==i||0!==s))throw new FormatError("Bad uncompressed block length in flate stream");this.codeBuf=0;this.codeSize=0;const r=this.bufferLength,n=r+i;e=this.ensureBuffer(n);this.bufferLength=n;if(0===i)-1===a.peekByte()&&(this.eof=!0);else{const t=a.getBytes(i);e.set(t,r);t.length0;)C[g++]=Q}s=this.generateHuffmanTable(C.subarray(0,e));r=this.generateHuffmanTable(C.subarray(e,c))}}e=this.buffer;let n=e?e.length:0,g=this.bufferLength;for(;;){let t=this.getCode(s);if(t<256){if(g+1>=n){e=this.ensureBuffer(g+1);n=e.length}e[g++]=t;continue}if(256===t){this.bufferLength=g;return}t-=257;t=Ut[t];let a=t>>16;a>0&&(a=this.getBits(a));i=(65535&t)+a;t=this.getCode(r);t=xt[t];a=t>>16;a>0&&(a=this.getBits(a));const o=(65535&t)+a;if(g+i>=n){e=this.ensureBuffer(g+i);n=e.length}for(let t=0;t>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=32768}byteIn(){const e=this.data;let t=this.bp;if(255===e[t])if(e[t+1]>143){this.clow+=65280;this.ct=8}else{t++;this.clow+=e[t]<<9;this.ct=7;this.bp=t}else{t++;this.clow+=t65535){this.chigh+=this.clow>>16;this.clow&=65535}}readBit(e,t){let i=e[t]>>1,a=1&e[t];const s=Jt[i],r=s.qe;let n,g=this.a-r;if(this.chigh>15&1;this.clow=this.clow<<1&65535;this.ct--}while(!(32768&g));this.a=g;e[t]=i<<1|a;return n}}class Jbig2Error extends ot{constructor(e){super(e,"Jbig2Error")}}class ContextCache{getContexts(e){return e in this?this[e]:this[e]=new Int8Array(65536)}}class DecodingContext{constructor(e,t,i){this.data=e;this.start=t;this.end=i}get decoder(){return shadow(this,"decoder",new ArithmeticDecoder(this.data,this.start,this.end))}get contextCache(){return shadow(this,"contextCache",new ContextCache)}}function decodeInteger(e,t,i){const a=e.getContexts(t);let s=1;function readBits(e){let t=0;for(let r=0;r>>0}const r=readBits(1),n=readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(32)+4436:readBits(12)+340:readBits(8)+84:readBits(6)+20:readBits(4)+4:readBits(2);let g;0===r?g=n:n>0&&(g=-n);return g>=-2147483648&&g<=pt?g:null}function decodeIAID(e,t,i){const a=e.getContexts("IAID");let s=1;for(let e=0;e=F&&x=S){K=K<<1&d;for(u=0;u=0&&H=0){J=G[L][H];J&&(K|=J<=e?c<<=1:c=c<<1|w[g][o]}for(Q=0;Q=m||o<0||o>=p?c<<=1:c=c<<1|a[g][o]}const E=D.readBit(b,c);t[n]=E}}return w}function decodeTextRegion(e,t,i,a,s,r,n,g,o,c,C,h,l,Q,E,u,d,f,p){if(e&&t)throw new Jbig2Error("refinement with Huffman is not supported");const m=[];let y,w;for(y=0;y1&&(s=e?p.readBits(f):decodeInteger(b,"IAIT",D));const r=n*F+s,S=e?Q.symbolIDTable.decode(p):decodeIAID(b,D,o),k=t&&(e?p.readBit():decodeInteger(b,"IARI",D));let R=g[S],N=R[0].length,G=R.length;if(k){const e=decodeInteger(b,"IARDW",D),t=decodeInteger(b,"IARDH",D);N+=e;G+=t;R=decodeRefinement(N,G,E,R,(e>>1)+decodeInteger(b,"IARDX",D),(t>>1)+decodeInteger(b,"IARDY",D),!1,u,d)}let M=0;c?1&h?M=G-1:a+=G-1:h>1?a+=N-1:M=N-1;const U=r-(1&h?0:G-1),x=a-(2&h?N-1:0);let L,H,J;if(c)for(L=0;L>5&7;const o=[31&n];let c=t+6;if(7===n){g=536870911&readUint32(e,c-1);c+=3;let t=g+7>>3;o[0]=e[c++];for(;--t>0;)o.push(e[c++])}else if(5===n||6===n)throw new Jbig2Error("invalid referred-to flags");i.retainBits=o;let C=4;i.number<=256?C=1:i.number<=65536&&(C=2);const h=[];let l,Q;for(l=0;l>>24&255;r[3]=t.height>>16&255;r[4]=t.height>>8&255;r[5]=255&t.height;for(l=c,Q=e.length;l>2&3;e.huffmanDWSelector=t>>4&3;e.bitmapSizeSelector=t>>6&1;e.aggregationInstancesSelector=t>>7&1;e.bitmapCodingContextUsed=!!(256&t);e.bitmapCodingContextRetained=!!(512&t);e.template=t>>10&3;e.refinementTemplate=t>>12&1;c+=2;if(!e.huffman){o=0===e.template?4:1;n=[];for(g=0;g>2&3;C.stripSize=1<>4&3;C.transposed=!!(64&h);C.combinationOperator=h>>7&3;C.defaultPixelValue=h>>9&1;C.dsOffset=h<<17>>27;C.refinementTemplate=h>>15&1;if(C.huffman){const e=readUint16(a,c);c+=2;C.huffmanFS=3&e;C.huffmanDS=e>>2&3;C.huffmanDT=e>>4&3;C.huffmanRefinementDW=e>>6&3;C.huffmanRefinementDH=e>>8&3;C.huffmanRefinementDX=e>>10&3;C.huffmanRefinementDY=e>>12&3;C.huffmanRefinementSizeSelector=!!(16384&e)}if(C.refinement&&!C.refinementTemplate){n=[];for(g=0;g<2;g++){n.push({x:readInt8(a,c),y:readInt8(a,c+1)});c+=2}C.refinementAt=n}C.numberOfSymbolInstances=readUint32(a,c);c+=4;r=[C,i.referredTo,a,c,s];break;case 16:const l={},Q=a[c++];l.mmr=!!(1&Q);l.template=Q>>1&3;l.patternWidth=a[c++];l.patternHeight=a[c++];l.maxPatternIndex=readUint32(a,c);c+=4;r=[l,i.number,a,c,s];break;case 22:case 23:const E={};E.info=readRegionSegmentInformation(a,c);c+=Ot;const u=a[c++];E.mmr=!!(1&u);E.template=u>>1&3;E.enableSkip=!!(8&u);E.combinationOperator=u>>4&7;E.defaultPixelValue=u>>7&1;E.gridWidth=readUint32(a,c);c+=4;E.gridHeight=readUint32(a,c);c+=4;E.gridOffsetX=4294967295&readUint32(a,c);c+=4;E.gridOffsetY=4294967295&readUint32(a,c);c+=4;E.gridVectorX=readUint16(a,c);c+=2;E.gridVectorY=readUint16(a,c);c+=2;r=[E,i.referredTo,a,c,s];break;case 38:case 39:const d={};d.info=readRegionSegmentInformation(a,c);c+=Ot;const f=a[c++];d.mmr=!!(1&f);d.template=f>>1&3;d.prediction=!!(8&f);if(!d.mmr){o=0===d.template?4:1;n=[];for(g=0;g>2&1;p.combinationOperator=m>>3&3;p.requiresBuffer=!!(32&m);p.combinationOperatorOverride=!!(64&m);r=[p];break;case 49:case 50:case 51:case 62:break;case 53:r=[i.number,a,c,s];break;default:throw new Jbig2Error(`segment type ${i.typeName}(${i.type}) is not implemented`)}const C="on"+i.typeName;C in t&&t[C].apply(t,r)}function processSegments(e,t){for(let i=0,a=e.length;i>3,i=new Uint8ClampedArray(t*e.height);e.defaultPixelValue&&i.fill(255);this.buffer=i}drawBitmap(e,t){const i=this.currentPageInfo,a=e.width,s=e.height,r=i.width+7>>3,n=i.combinationOperatorOverride?e.combinationOperator:i.combinationOperator,g=this.buffer,o=128>>(7&e.x);let c,C,h,l,Q=e.y*r+(e.x>>3);switch(n){case 0:for(c=0;c>=1;if(!h){h=128;l++}}Q+=r}break;case 2:for(c=0;c>=1;if(!h){h=128;l++}}Q+=r}break;default:throw new Jbig2Error(`operator ${n} is not supported`)}}onImmediateGenericRegion(e,t,i,a){const s=e.info,r=new DecodingContext(t,i,a),n=decodeBitmap(e.mmr,s.width,s.height,e.template,e.prediction,null,e.at,r);this.drawBitmap(s,n)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(e,t,i,a,s,r){let n,g;if(e.huffman){n=function getSymbolDictionaryHuffmanTables(e,t,i){let a,s,r,n,g=0;switch(e.huffmanDHSelector){case 0:case 1:a=getStandardTable(e.huffmanDHSelector+4);break;case 3:a=getCustomHuffmanTable(g,t,i);g++;break;default:throw new Jbig2Error("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:s=getStandardTable(e.huffmanDWSelector+2);break;case 3:s=getCustomHuffmanTable(g,t,i);g++;break;default:throw new Jbig2Error("invalid Huffman DW selector")}if(e.bitmapSizeSelector){r=getCustomHuffmanTable(g,t,i);g++}else r=getStandardTable(1);n=e.aggregationInstancesSelector?getCustomHuffmanTable(g,t,i):getStandardTable(1);return{tableDeltaHeight:a,tableDeltaWidth:s,tableBitmapSize:r,tableAggregateInstances:n}}(e,i,this.customTables);g=new Reader(a,s,r)}let o=this.symbols;o||(this.symbols=o={});const c=[];for(const e of i){const t=o[e];t&&c.push(...t)}const C=new DecodingContext(a,s,r);o[t]=function decodeSymbolDictionary(e,t,i,a,s,r,n,g,o,c,C,h){if(e&&t)throw new Jbig2Error("symbol refinement with Huffman is not supported");const l=[];let Q=0,E=log2(i.length+a);const u=C.decoder,d=C.contextCache;let f,p;if(e){f=getStandardTable(1);p=[];E=Math.max(E,1)}for(;l.length1)m=decodeTextRegion(e,t,a,Q,0,s,1,i.concat(l),E,0,0,1,0,r,o,c,C,0,h);else{const e=decodeIAID(d,u,E),t=decodeInteger(d,"IARDX",u),s=decodeInteger(d,"IARDY",u);m=decodeRefinement(a,Q,o,e=32){let i,a,n;switch(t){case 32:if(0===e)throw new Jbig2Error("no previous value in symbol ID table");a=s.readBits(2)+3;i=r[e-1].prefixLength;break;case 33:a=s.readBits(3)+3;i=0;break;case 34:a=s.readBits(7)+11;i=0;break;default:throw new Jbig2Error("invalid code length in symbol ID table")}for(n=0;n=0;d--){R=e?decodeMMRBitmap(k,o,c,!0):decodeBitmap(!1,o,c,i,!1,null,F,E);S[d]=R}for(N=0;N=0;f--){M^=S[f][N][G];U|=M<>8;H=h+N*l-G*Q>>8;if(L>=0&&L+w<=a&&H>=0&&H+D<=s)for(d=0;d=s)){Y=u[t];J=x[d];for(f=0;f=0&&e>1&7),o=1+(a>>4&7),c=[];let C,h,l=s;do{C=n.readBits(g);h=n.readBits(o);c.push(new HuffmanLine([l,C,h,0]));l+=1<>t&1;if(t<=0)this.children[i]=new HuffmanTreeNode(e);else{let a=this.children[i];a||(this.children[i]=a=new HuffmanTreeNode(null));a.buildTree(e,t-1)}}decodeNode(e){if(this.isLeaf){if(this.isOOB)return null;const t=e.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-t:t)}const t=this.children[e.readBit()];if(!t)throw new Jbig2Error("invalid Huffman data");return t.decodeNode(e)}}class HuffmanTable{constructor(e,t){t||this.assignPrefixCodes(e);this.rootNode=new HuffmanTreeNode(null);for(let t=0,i=e.length;t0&&this.rootNode.buildTree(i,i.prefixLength-1)}}decode(e){return this.rootNode.decodeNode(e)}assignPrefixCodes(e){const t=e.length;let i=0;for(let a=0;a=this.end)throw new Jbig2Error("end of data while reading bit");this.currentByte=this.data[this.position++];this.shift=7}const e=this.currentByte>>this.shift&1;this.shift--;return e}readBits(e){let t,i=0;for(t=e-1;t>=0;t--)i|=this.readBit()<=this.end?-1:this.data[this.position++]}}function getCustomHuffmanTable(e,t,i){let a=0;for(let s=0,r=t.length;s>i&1;i--}}if(a&&!g){const e=5;for(let t=0;t>2,c=new Uint32Array(e.buffer,t,o);if(FeatureTest.isLittleEndian){for(;n>>24|t<<8|4278190080;i[a+2]=t>>>16|s<<16|4278190080;i[a+3]=s>>>8|4278190080}for(let s=4*n,r=t+g;s>>8|255;i[a+2]=t<<16|s>>>16|255;i[a+3]=s<<8|255}for(let s=4*n,r=t+g;s>3,h=7&a,l=e.length;i=new Uint32Array(i.buffer);let Q=0;for(let a=0;a0&&!e[r-1];)r--;const n=[{children:[],index:0}];let g,o=n[0];for(i=0;i0;)o=n.pop();o.index++;n.push(o);for(;n.length<=i;){n.push(g={children:[],index:0});o.children[o.index]=g.children;o=g}s++}if(i+10){E--;return Q>>E&1}Q=e[t++];if(255===Q){const a=e[t++];if(a){if(220===a&&c){const a=readUint16(e,t+=2);t+=2;if(a>0&&a!==i.scanLines)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",a)}else if(217===a){if(c){const e=p*(8===i.precision?8:0);if(e>0&&Math.round(i.scanLines/e)>=5)throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",e)}throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data")}throw new JpegError(`unexpected marker ${(Q<<8|a).toString(16)}`)}}E=7;return Q>>>7}function decodeHuffman(e){let t=e;for(;;){t=t[readBit()];switch(typeof t){case"number":return t;case"object":continue}throw new JpegError("invalid huffman sequence")}}function receive(e){let t=0;for(;e>0;){t=t<<1|readBit();e--}return t}function receiveAndExtend(e){if(1===e)return 1===readBit()?1:-1;const t=receive(e);return t>=1<0){u--;return}let i=r;const a=n;for(;i<=a;){const a=decodeHuffman(e.huffmanTableAC),s=15&a,r=a>>4;if(0===s){if(r<15){u=receive(r)+(1<>4;if(0===s)if(c<15){u=receive(c)+(1<>4;if(0===a){if(r<15)break;s+=16;continue}s+=r;const n=Wt[s];e.blockData[t+n]=receiveAndExtend(a);s++}};let k,R=0;const N=1===m?a[0].blocksPerLine*a[0].blocksPerColumn:C*i.mcusPerColumn;let G,M;for(;R<=N;){const i=s?Math.min(N-R,s):N;if(i>0){for(w=0;w0?"unexpected":"excessive"} MCU data, current marker is: ${k.invalid}`);t=k.offset}if(!(k.marker>=65488&&k.marker<=65495))break;t+=2}return t-l}function quantizeAndInverse(e,t,i){const a=e.quantizationTable,s=e.blockData;let r,n,g,o,c,C,h,l,Q,E,u,d,f,p,m,y,w;if(!a)throw new JpegError("missing required Quantization Table.");for(let e=0;e<64;e+=8){Q=s[t+e];E=s[t+e+1];u=s[t+e+2];d=s[t+e+3];f=s[t+e+4];p=s[t+e+5];m=s[t+e+6];y=s[t+e+7];Q*=a[e];if(E|u|d|f|p|m|y){E*=a[e+1];u*=a[e+2];d*=a[e+3];f*=a[e+4];p*=a[e+5];m*=a[e+6];y*=a[e+7];r=$t*Q+128>>8;n=$t*f+128>>8;g=u;o=m;c=Ai*(E-y)+128>>8;l=Ai*(E+y)+128>>8;C=d<<4;h=p<<4;r=r+n+1>>1;n=r-n;w=g*_t+o*zt+128>>8;g=g*zt-o*_t+128>>8;o=w;c=c+h+1>>1;h=c-h;l=l+C+1>>1;C=l-C;r=r+o+1>>1;o=r-o;n=n+g+1>>1;g=n-g;w=c*Vt+l*Zt+2048>>12;c=c*Zt-l*Vt+2048>>12;l=w;w=C*Xt+h*jt+2048>>12;C=C*jt-h*Xt+2048>>12;h=w;i[e]=r+l;i[e+7]=r-l;i[e+1]=n+h;i[e+6]=n-h;i[e+2]=g+C;i[e+5]=g-C;i[e+3]=o+c;i[e+4]=o-c}else{w=$t*Q+512>>10;i[e]=w;i[e+1]=w;i[e+2]=w;i[e+3]=w;i[e+4]=w;i[e+5]=w;i[e+6]=w;i[e+7]=w}}for(let e=0;e<8;++e){Q=i[e];E=i[e+8];u=i[e+16];d=i[e+24];f=i[e+32];p=i[e+40];m=i[e+48];y=i[e+56];if(E|u|d|f|p|m|y){r=$t*Q+2048>>12;n=$t*f+2048>>12;g=u;o=m;c=Ai*(E-y)+2048>>12;l=Ai*(E+y)+2048>>12;C=d;h=p;r=4112+(r+n+1>>1);n=r-n;w=g*_t+o*zt+2048>>12;g=g*zt-o*_t+2048>>12;o=w;c=c+h+1>>1;h=c-h;l=l+C+1>>1;C=l-C;r=r+o+1>>1;o=r-o;n=n+g+1>>1;g=n-g;w=c*Vt+l*Zt+2048>>12;c=c*Zt-l*Vt+2048>>12;l=w;w=C*Xt+h*jt+2048>>12;C=C*jt-h*Xt+2048>>12;h=w;Q=r+l;y=r-l;E=n+h;m=n-h;u=g+C;p=g-C;d=o+c;f=o-c;Q<16?Q=0:Q>=4080?Q=255:Q>>=4;E<16?E=0:E>=4080?E=255:E>>=4;u<16?u=0:u>=4080?u=255:u>>=4;d<16?d=0:d>=4080?d=255:d>>=4;f<16?f=0:f>=4080?f=255:f>>=4;p<16?p=0:p>=4080?p=255:p>>=4;m<16?m=0:m>=4080?m=255:m>>=4;y<16?y=0:y>=4080?y=255:y>>=4;s[t+e]=Q;s[t+e+8]=E;s[t+e+16]=u;s[t+e+24]=d;s[t+e+32]=f;s[t+e+40]=p;s[t+e+48]=m;s[t+e+56]=y}else{w=$t*Q+8192>>14;w=w<-2040?0:w>=2024?255:w+2056>>4;s[t+e]=w;s[t+e+8]=w;s[t+e+16]=w;s[t+e+24]=w;s[t+e+32]=w;s[t+e+40]=w;s[t+e+48]=w;s[t+e+56]=w}}}function buildComponentData(e,t){const i=t.blocksPerLine,a=t.blocksPerColumn,s=new Int16Array(64);for(let e=0;e=a)return null;const r=readUint16(e,t);if(r>=65472&&r<=65534)return{invalid:null,marker:r,offset:t};let n=readUint16(e,s);for(;!(n>=65472&&n<=65534);){if(++s>=a)return null;n=readUint16(e,s)}return{invalid:r.toString(16),marker:n,offset:s}}function prepareComponents(e){const t=Math.ceil(e.samplesPerLine/8/e.maxH),i=Math.ceil(e.scanLines/8/e.maxV);for(const a of e.components){const s=Math.ceil(Math.ceil(e.samplesPerLine/8)*a.h/e.maxH),r=Math.ceil(Math.ceil(e.scanLines/8)*a.v/e.maxV),n=t*a.h,g=64*(i*a.v)*(n+1);a.blockData=new Int16Array(g);a.blocksPerLine=s;a.blocksPerColumn=r}e.mcusPerLine=t;e.mcusPerColumn=i}function readDataBlock(e,t){const i=readUint16(e,t);let a=(t+=2)+i-2;const s=findNextFileMarker(e,a,t);if(s?.invalid){warn("readDataBlock - incorrect length, current marker is: "+s.invalid);a=s.offset}const r=e.subarray(t,a);return{appData:r,newOffset:t+=r.length}}function skipData(e,t){const i=readUint16(e,t),a=(t+=2)+i-2,s=findNextFileMarker(e,a,t);return s?.invalid?s.offset:a}class JpegImage{constructor({decodeTransform:e=null,colorTransform:t=-1}={}){this._decodeTransform=e;this._colorTransform=t}static canUseImageDecoder(e,t=-1){let i=0,a=null,s=readUint16(e,i);i+=2;if(65496!==s)throw new JpegError("SOI not found");s=readUint16(e,i);i+=2;A:for(;65497!==s;){switch(s){case 65472:case 65473:case 65474:a=e[i+7];break A;case 65535:255!==e[i]&&i--}i=skipData(e,i);s=readUint16(e,i);i+=2}return 4!==a&&(3!==a||0!==t)}parse(e,{dnlScanLines:t=null}={}){let i,a,s=0,r=null,n=null,g=0;const o=[],c=[],C=[];let h=readUint16(e,s);s+=2;if(65496!==h)throw new JpegError("SOI not found");h=readUint16(e,s);s+=2;A:for(;65497!==h;){let l,Q,E;switch(h){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const{appData:u,newOffset:d}=readDataBlock(e,s);s=d;65504===h&&74===u[0]&&70===u[1]&&73===u[2]&&70===u[3]&&0===u[4]&&(r={version:{major:u[5],minor:u[6]},densityUnits:u[7],xDensity:u[8]<<8|u[9],yDensity:u[10]<<8|u[11],thumbWidth:u[12],thumbHeight:u[13],thumbData:u.subarray(14,14+3*u[12]*u[13])});65518===h&&65===u[0]&&100===u[1]&&111===u[2]&&98===u[3]&&101===u[4]&&(n={version:u[5]<<8|u[6],flags0:u[7]<<8|u[8],flags1:u[9]<<8|u[10],transformCode:u[11]});break;case 65499:const f=readUint16(e,s);s+=2;const p=f+s-2;let m;for(;s>4){if(t>>4!=1)throw new JpegError("DQT - invalid table spec");for(Q=0;Q<64;Q++){m=Wt[Q];i[m]=readUint16(e,s);s+=2}}else for(Q=0;Q<64;Q++){m=Wt[Q];i[m]=e[s++]}o[15&t]=i}break;case 65472:case 65473:case 65474:if(i)throw new JpegError("Only single frame JPEGs supported");s+=2;i={};i.extended=65473===h;i.progressive=65474===h;i.precision=e[s++];const y=readUint16(e,s);s+=2;i.scanLines=t||y;i.samplesPerLine=readUint16(e,s);s+=2;i.components=[];i.componentIds={};const w=e[s++];let D=0,b=0;for(l=0;l>4,r=15&e[s+1];D>4?c:C)[15&t]=buildHuffmanTable(i,r)}break;case 65501:s+=2;a=readUint16(e,s);s+=2;break;case 65498:const S=1==++g&&!t;s+=2;const k=e[s++],R=[];for(l=0;l>4];r.huffmanTableAC=c[15&n];R.push(r)}const N=e[s++],G=e[s++],M=e[s++];try{s+=decodeScan(e,s,i,R,a,N,G,M>>4,15&M,S)}catch(t){if(t instanceof DNLMarkerError){warn(`${t.message} -- attempting to re-parse the JPEG image.`);return this.parse(e,{dnlScanLines:t.scanLines})}if(t instanceof EOIMarkerError){warn(`${t.message} -- ignoring the rest of the image data.`);break A}throw t}break;case 65500:s+=4;break;case 65535:255!==e[s]&&s--;break;default:const U=findNextFileMarker(e,s-2,s-3);if(U?.invalid){warn("JpegImage.parse - unexpected data, current marker is: "+U.invalid);s=U.offset;break}if(!U||s>=e.length-1){warn("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break A}throw new JpegError("JpegImage.parse - unknown marker: "+h.toString(16))}h=readUint16(e,s);s+=2}if(!i)throw new JpegError("JpegImage.parse - no frame data found.");this.width=i.samplesPerLine;this.height=i.scanLines;this.jfif=r;this.adobe=n;this.components=[];for(const e of i.components){const t=o[e.quantizationId];t&&(e.quantizationTable=t);this.components.push({index:e.index,output:buildComponentData(0,e),scaleX:e.h/i.maxH,scaleY:e.v/i.maxV,blocksPerLine:e.blocksPerLine,blocksPerColumn:e.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(e,t,i=!1){const a=this.width/e,s=this.height/t;let r,n,g,o,c,C,h,l,Q,E,u,d=0;const f=this.components.length,p=e*t*f,m=new Uint8ClampedArray(p),y=new Uint32Array(e),w=4294967288;let D;for(h=0;h>8)+b[Q+1];return m}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(e){let t,i,a;for(let s=0,r=e.length;s4)throw new JpegError("Unsupported color mode");const r=this._getLinearizedBlockData(e,t,s);if(1===this.numComponents&&(i||a)){const e=r.length*(i?4:3),t=new Uint8ClampedArray(e);let a=0;if(i)!function grayToRGBA(e,t){if(FeatureTest.isLittleEndian)for(let i=0,a=e.length;i0&&(e=e.subarray(t));break}return e}decodeImage(e){if(this.eof)return this.buffer;e=this.#w(e||this.bytes);const t=new JpegImage(this.jpegOptions);t.parse(e);const i=t.getData({width:this.drawWidth,height:this.drawHeight,forceRGBA:this.forceRGBA,forceRGB:this.forceRGB,isSourcePDF:!0});this.buffer=i;this.bufferLength=i.length;this.eof=!0;return this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}async getTransferableImage(){if(!await JpegStream.canUseImageDecoder)return null;const e=this.jpegOptions;if(e.decodeTransform)return null;let t;try{const i=this.canAsyncDecodeImageFromBuffer&&await this.stream.asyncGetBytes()||this.bytes;if(!i)return null;const a=this.#w(i);if(!JpegImage.canUseImageDecoder(a,e.colorTransform))return null;t=new ImageDecoder({data:a,type:"image/jpeg",preferAnimation:!1});return(await t.decode()).image}catch(e){warn(`getTransferableImage - failed: "${e}".`);return null}finally{t?.close()}}}var ei,ti=(ei="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var t,i,a=e;new Promise(((e,a)=>{t=e;i=a}));a.decode=function(e,{numComponents:t=4,isIndexedColormap:i=!1,smaskInData:s=!1}){const r=e.length,n=a._malloc(r);a.HEAPU8.set(e,n);const g=a._jp2_decode(n,r,t>0?t:0,!!i,!!s);a._free(n);if(g){const{errorMessages:e}=a;if(e){delete a.errorMessages;return e}return"Unknown error"}const{imageData:o}=a;a.imageData=null;return o};var s=Object.assign({},a),r="./this.program",quit_=(e,t)=>{throw t},n="";"undefined"!=typeof document&&document.currentScript&&(n=document.currentScript.src);ei&&(n=ei);n=n.startsWith("blob:")?"":n.substr(0,n.replace(/[?#].*/,"").lastIndexOf("/")+1);var g=a.print||console.log.bind(console),o=a.printErr||console.error.bind(console);Object.assign(a,s);s=null;a.arguments&&a.arguments;a.thisProgram&&(r=a.thisProgram);var c,C=a.wasmBinary;function tryParseAsDataURI(e){if(isDataURI(e))return function intArrayFromBase64(e){for(var t=atob(e),i=new Uint8Array(t.length),a=0;ae.startsWith(b);function instantiateSync(e,t){var i,a=function getBinarySync(e){if(e==d&&C)return new Uint8Array(C);var t=tryParseAsDataURI(e);if(t)return t;throw\'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)\'}(e);i=new WebAssembly.Module(a);return[new WebAssembly.Instance(i,t),i]}class ExitStatus{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`;this.status=e}}var F,callRuntimeCallbacks=e=>{for(;e.length>0;)e.shift()(a)},S=a.noExitRuntime||!0,k=0,R={},handleException=e=>{if(e instanceof ExitStatus||"unwind"==e)return h;quit_(0,e)},keepRuntimeAlive=()=>S||k>0,_proc_exit=e=>{h=e;if(!keepRuntimeAlive()){a.onExit?.(e);u=!0}quit_(0,new ExitStatus(e))},_exit=(e,t)=>{h=e;_proc_exit(e)},callUserCallback=e=>{if(!u)try{e();(()=>{if(!keepRuntimeAlive())try{_exit(h)}catch(e){handleException(e)}})()}catch(e){handleException(e)}},growMemory=e=>{var t=(e-c.buffer.byteLength+65535)/65536|0;try{c.grow(t);updateMemoryViews();return 1}catch(e){}},N={},getEnvStrings=()=>{if(!getEnvStrings.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:r||"./this.program"};for(var t in N)void 0===N[t]?delete e[t]:e[t]=N[t];var i=[];for(var t in e)i.push(`${t}=${e[t]}`);getEnvStrings.strings=i}return getEnvStrings.strings},G=[null,[],[]],M="undefined"!=typeof TextDecoder?new TextDecoder:void 0,UTF8ArrayToString=(e,t=0,i=NaN)=>{for(var a=t+i,s=t;e[s]&&!(s>=a);)++s;if(s-t>16&&e.buffer&&M)return M.decode(e.subarray(t,s));for(var r="";t>10,56320|1023&c)}}else r+=String.fromCharCode((31&n)<<6|g)}else r+=String.fromCharCode(n)}return r},printChar=(e,t)=>{var i=G[e];if(0===t||10===t){(1===e?g:o)(UTF8ArrayToString(i));i.length=0}else i.push(t)},UTF8ToString=(e,t)=>e?UTF8ArrayToString(Q,e,t):"",U={m:()=>function abort(e){a.onAbort?.(e);o(e="Aborted("+e+")");u=!0;e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);i(t);throw t}(""),c:(e,t,i)=>Q.copyWithin(e,t,t+i),l:()=>{S=!1;k=0},n:(e,t)=>{if(R[e]){clearTimeout(R[e].id);delete R[e]}if(!t)return 0;var i=setTimeout((()=>{delete R[e];callUserCallback((()=>L(e,performance.now())))}),t);R[e]={id:i,timeout_ms:t};return 0},g:function _copy_pixels_1(e,t){e>>=2;const i=a.imageData=new Uint8ClampedArray(t),s=a.HEAP32.subarray(e,e+t);i.set(s)},f:function _copy_pixels_3(e,t,i,s){e>>=2;t>>=2;i>>=2;const r=a.imageData=new Uint8ClampedArray(3*s),n=a.HEAP32.subarray(e,e+s),g=a.HEAP32.subarray(t,t+s),o=a.HEAP32.subarray(i,i+s);for(let e=0;e>=2;t>>=2;i>>=2;s>>=2;const n=a.imageData=new Uint8ClampedArray(4*r),g=a.HEAP32.subarray(e,e+r),o=a.HEAP32.subarray(t,t+r),c=a.HEAP32.subarray(i,i+r),C=a.HEAP32.subarray(s,s+r);for(let e=0;e{var t,i,a=Q.length,s=2147483648;if((e>>>=0)>s)return!1;for(var r=1;r<=4;r*=2){var n=a*(1+.2/r);n=Math.min(n,e+100663296);var g=Math.min(s,(t=Math.max(e,n),i=65536,Math.ceil(t/i)*i));if(growMemory(g))return!0}return!1},p:(e,t)=>{var i=0;getEnvStrings().forEach(((a,s)=>{var r=t+i;E[e+4*s>>2]=r;((e,t)=>{for(var i=0;i{var i=getEnvStrings();E[e>>2]=i.length;var a=0;i.forEach((e=>a+=e.length+1));E[t>>2]=a;return 0},r:e=>52,j:function _fd_seek(e,t,i,a,s){return 70},b:(e,t,i,a)=>{for(var s=0,r=0;r>2],g=E[t+4>>2];t+=8;for(var o=0;o>2]=s;return 0},s:function _gray_to_rgba(e,t){e>>=2;const i=a.imageData=new Uint8ClampedArray(4*t),s=a.HEAP32.subarray(e,e+t);for(let e=0;e>=2;t>>=2;const s=a.imageData=new Uint8ClampedArray(4*i),r=a.HEAP32.subarray(e,e+i),n=a.HEAP32.subarray(t,t+i);for(let e=0;e>=2;t>>=2;i>>=2;const r=a.imageData=new Uint8ClampedArray(4*s),n=a.HEAP32.subarray(e,e+s),g=a.HEAP32.subarray(t,t+s),o=a.HEAP32.subarray(i,i+s);for(let e=0;e0)){!function preRun(){if(a.preRun){"function"==typeof a.preRun&&(a.preRun=[a.preRun]);for(;a.preRun.length;)e=a.preRun.shift(),f.unshift(e)}var e;callRuntimeCallbacks(f)}();if(!(y>0))if(a.setStatus){a.setStatus("Running...");setTimeout((()=>{setTimeout((()=>a.setStatus("")),1);doRun()}),1)}else doRun()}function doRun(){if(!F){F=!0;a.calledRun=!0;if(!u){!function initRuntime(){callRuntimeCallbacks(p)}();t(a);a.onRuntimeInitialized?.();!function postRun(){if(a.postRun){"function"==typeof a.postRun&&(a.postRun=[a.postRun]);for(;a.postRun.length;)e=a.postRun.shift(),m.unshift(e)}var e;callRuntimeCallbacks(m)}()}}}}if(a.preInit){"function"==typeof a.preInit&&(a.preInit=[a.preInit]);for(;a.preInit.length>0;)a.preInit.pop()()}run();return a});const ii=ti;class JpxError extends ot{constructor(e){super(e,"JpxError")}}class JpxImage{static#D=null;static decode(e,t){t||={};this.#D||=ii({warn});const i=this.#D.decode(e,t);if("string"==typeof i)throw new JpxError(i);return i}static cleanup(){this.#D=null}static parseImageProperties(e){let t=e.getByte();for(;t>=0;){const i=t;t=e.getByte();if(65361===(i<<8|t)){e.skip(4);const t=e.getInt32()>>>0,i=e.getInt32()>>>0,a=e.getInt32()>>>0,s=e.getInt32()>>>0;e.skip(16);return{width:t-a,height:i-s,bitsPerComponent:8,componentsCount:e.getUint16()}}}throw new JpxError("No size marker found in JPX stream")}}class JpxStream extends DecodeStream{constructor(e,t,i){super(t);this.stream=e;this.dict=e.dict;this.maybeLength=t;this.params=i}get bytes(){return shadow(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(e){}readBlock(e){this.decodeImage(null,e)}decodeImage(e,t){if(this.eof)return this.buffer;e||=this.bytes;this.buffer=JpxImage.decode(e,t);this.bufferLength=this.buffer.length;this.eof=!0;return this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}}class LZWStream extends DecodeStream{constructor(e,t,i){super(t);this.str=e;this.dict=e.dict;this.cachedData=0;this.bitsCached=0;const a=4096,s={earlyChange:i,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(a),dictionaryLengths:new Uint16Array(a),dictionaryPrevCodes:new Uint16Array(a),currentSequence:new Uint8Array(a),currentSequenceLength:0};for(let e=0;e<256;++e){s.dictionaryValues[e]=e;s.dictionaryLengths[e]=1}this.lzwState=s}readBits(e){let t=this.bitsCached,i=this.cachedData;for(;t>>t&(1<0;if(e<256){l[0]=e;Q=1}else{if(!(e>=258)){if(256===e){C=9;n=258;Q=0;continue}this.eof=!0;delete this.lzwState;break}if(e=0;t--){l[t]=g[i];i=c[i]}}else l[Q++]=l[0]}if(s){c[n]=h;o[n]=o[h]+1;g[n]=l[0];n++;C=n+r&n+r-1?C:0|Math.min(Math.log(n+r)/.6931471805599453+1,12)}h=e;E+=Q;if(a15))throw new FormatError(`Unsupported predictor: ${a}`);this.readBlock=2===a?this.readBlockTiff:this.readBlockPng;this.str=e;this.dict=e.dict;const s=this.colors=i.get("Colors")||1,r=this.bits=i.get("BPC","BitsPerComponent")||8,n=this.columns=i.get("Columns")||1;this.pixBytes=s*r+7>>3;this.rowBytes=n*s*r+7>>3;return this}readBlockTiff(){const e=this.rowBytes,t=this.bufferLength,i=this.ensureBuffer(t+e),a=this.bits,s=this.colors,r=this.str.getBytes(e);this.eof=!r.length;if(this.eof)return;let n,g=0,o=0,c=0,C=0,h=t;if(1===a&&1===s)for(n=0;n>1;e^=e>>2;e^=e>>4;g=(1&e)<<7;i[h++]=e}else if(8===a){for(n=0;n>8&255;i[h++]=255&e}}else{const e=new Uint8Array(s+1),h=(1<>c-a)&h;c-=a;o=o<=8){i[Q++]=o>>C-8&255;C-=8}}C>0&&(i[Q++]=(o<<8-C)+(g&(1<<8-C)-1))}this.bufferLength+=e}readBlockPng(){const e=this.rowBytes,t=this.pixBytes,i=this.str.getByte(),a=this.str.getBytes(e);this.eof=!a.length;if(this.eof)return;const s=this.bufferLength,r=this.ensureBuffer(s+e);let n=r.subarray(s-e,s);0===n.length&&(n=new Uint8Array(e));let g,o,c,C=s;switch(i){case 0:for(g=0;g>1)+a[g];for(;g>1)+a[g]&255;C++}break;case 4:for(g=0;g0){const e=this.str.getBytes(a);t.set(e,i);i+=a}}else{a=257-a;const s=e[1];t=this.ensureBuffer(i+a+1);for(let e=0;e>")&&this.buf1!==Bt;){if(!(this.buf1 instanceof Name)){info("Malformed dictionary: key must be a name object");this.shift();continue}const t=this.buf1.name;this.shift();if(this.buf1===Bt)break;a.set(t,this.getObj(e))}if(this.buf1===Bt){if(this.recoveryMode)return a;throw new ParserEOFException("End of file inside dictionary.")}if(isCmd(this.buf2,"stream"))return this.allowStreams?this.makeStream(a,e):a;this.shift();return a;default:return t}if(Number.isInteger(t)){if(Number.isInteger(this.buf1)&&isCmd(this.buf2,"R")){const e=Ref.get(t,this.buf1);this.shift();this.shift();return e}return t}return"string"==typeof t&&e?e.decryptString(t):t}findDefaultInlineStreamEnd(e){const{knownCommands:t}=this.lexer,i=e.pos;let a,s,r=0;for(;-1!==(a=e.getByte());)if(0===r)r=69===a?1:0;else if(1===r)r=73===a?2:0;else if(32===a||10===a||13===a){s=e.pos;const i=e.peekBytes(15),n=i.length;if(0===n)break;for(let e=0;e127))){r=0;break}}if(2!==r)continue;if(!t){warn("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}const g=new Lexer(new Stream(i.slice()),t);g._hexStringWarn=()=>{};let o=0;for(;;){const e=g.getObj();if(e===Bt){r=0;break}if(e instanceof Cmd){const i=t[e.cmd];if(!i){r=0;break}if(i.variableArgs?o<=i.numArgs:o===i.numArgs)break;o=0}else o++}if(2===r)break}else r=0;if(-1===a){warn("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker");if(s){warn(\'... trying to recover by using the last "EI" occurrence.\');e.skip(-(e.pos-s))}}let n=4;e.skip(-n);a=e.peekByte();e.skip(n);isWhiteSpace(a)||n--;return e.pos-n-i}findDCTDecodeInlineStreamEnd(e){const t=e.pos;let i,a,s=!1;for(;-1!==(i=e.getByte());)if(255===i){switch(e.getByte()){case 0:break;case 255:e.skip(-1);break;case 217:s=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:a=e.getUint16();a>2?e.skip(a-2):e.skip(-2)}if(s)break}const r=e.pos-t;if(-1===i){warn("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r}findASCII85DecodeInlineStreamEnd(e){const t=e.pos;let i;for(;-1!==(i=e.getByte());)if(126===i){const t=e.pos;i=e.peekByte();for(;isWhiteSpace(i);){e.skip();i=e.peekByte()}if(62===i){e.skip();break}if(e.pos>t){const t=e.peekBytes(2);if(69===t[0]&&73===t[1])break}}const a=e.pos-t;if(-1===i){warn("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-a);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return a}findASCIIHexDecodeInlineStreamEnd(e){const t=e.pos;let i;for(;-1!==(i=e.getByte())&&62!==i;);const a=e.pos-t;if(-1===i){warn("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-a);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return a}inlineStreamSkipEI(e){let t,i=0;for(;-1!==(t=e.getByte());)if(0===i)i=69===t?1:0;else if(1===i)i=73===t?2:0;else if(2===i)break}makeInlineImage(e){const t=this.lexer,i=t.stream,a=Object.create(null);let s;for(;!isCmd(this.buf1,"ID")&&this.buf1!==Bt;){if(!(this.buf1 instanceof Name))throw new FormatError("Dictionary key must be a name object");const t=this.buf1.name;this.shift();if(this.buf1===Bt)break;a[t]=this.getObj(e)}-1!==t.beginInlineImagePos&&(s=i.pos-t.beginInlineImagePos);const r=this.xref.fetchIfRef(a.F||a.Filter);let n;if(r instanceof Name)n=r.name;else if(Array.isArray(r)){const e=this.xref.fetchIfRef(r[0]);e instanceof Name&&(n=e.name)}const g=i.pos;let o,c;switch(n){case"DCT":case"DCTDecode":o=this.findDCTDecodeInlineStreamEnd(i);break;case"A85":case"ASCII85Decode":o=this.findASCII85DecodeInlineStreamEnd(i);break;case"AHx":case"ASCIIHexDecode":o=this.findASCIIHexDecodeInlineStreamEnd(i);break;default:o=this.findDefaultInlineStreamEnd(i)}if(o<1e3&&s>0){const e=i.pos;i.pos=t.beginInlineImagePos;c=function getInlineImageCacheKey(e){const t=[],i=e.length;let a=0;for(;a=a){let a=!1;for(const e of s){const t=e.length;let s=0;for(;s=r){a=!0;break}if(s>=t){if(isWhiteSpace(n[o+g+s])){info(`Found "${bytesToString([...i,...e])}" when searching for endstream command.`);a=!0}break}}if(a){t.pos+=o;return t.pos-e}}o++}t.pos+=g}return-1}makeStream(e,t){const i=this.lexer;let a=i.stream;i.skipToNextLine();const s=a.pos-1;let r=e.get("Length");if(!Number.isInteger(r)){info(`Bad length "${r&&r.toString()}" in stream.`);r=0}a.pos=s+r;i.nextChar();if(this.tryShift()&&isCmd(this.buf2,"endstream"))this.shift();else{r=this.#b(s);if(r<0)throw new FormatError("Missing endstream command.");i.nextChar();this.shift();this.shift()}this.shift();a=a.makeSubStream(s,r,e);t&&(a=t.createStream(a,r));a=this.filter(a,e,r);a.dict=e;return a}filter(e,t,i){let a=t.get("F","Filter"),s=t.get("DP","DecodeParms");if(a instanceof Name){Array.isArray(s)&&warn("/DecodeParms should not be an Array, when /Filter is a Name.");return this.makeFilter(e,a.name,i,s)}let r=i;if(Array.isArray(a)){const t=a,i=s;for(let n=0,g=t.length;n=48&&e<=57?15&e:e>=65&&e<=70||e>=97&&e<=102?9+(15&e):-1}class Lexer{constructor(e,t=null){this.stream=e;this.nextChar();this.strBuf=[];this.knownCommands=t;this._hexStringNumWarn=0;this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let e=this.currentChar,t=!1,i=0,a=1;if(45===e){a=-1;e=this.nextChar();45===e&&(e=this.nextChar())}else 43===e&&(e=this.nextChar());if(10===e||13===e)do{e=this.nextChar()}while(10===e||13===e);if(46===e){i=10;e=this.nextChar()}if(e<48||e>57){const t=`Invalid number: ${String.fromCharCode(e)} (charCode ${e})`;if(isWhiteSpace(e)||-1===e){info(`Lexer.getNumber - "${t}".`);return 0}throw new FormatError(t)}let s=e-48,r=0,n=1;for(;(e=this.nextChar())>=0;)if(e>=48&&e<=57){const a=e-48;if(t)r=10*r+a;else{0!==i&&(i*=10);s=10*s+a}}else if(46===e){if(0!==i)break;i=1}else if(45===e)warn("Badly formatted number: minus sign in the middle");else{if(69!==e&&101!==e)break;e=this.peekChar();if(43===e||45===e){n=45===e?-1:1;this.nextChar()}else if(e<48||e>57)break;t=!0}0!==i&&(s/=i);t&&(s*=10**(n*r));return a*s}getString(){let e=1,t=!1;const i=this.strBuf;i.length=0;let a=this.nextChar();for(;;){let s=!1;switch(0|a){case-1:warn("Unterminated string");t=!0;break;case 40:++e;i.push("(");break;case 41:if(0==--e){this.nextChar();t=!0}else i.push(")");break;case 92:a=this.nextChar();switch(a){case-1:warn("Unterminated string");t=!0;break;case 110:i.push("\\n");break;case 114:i.push("\\r");break;case 116:i.push("\\t");break;case 98:i.push("\\b");break;case 102:i.push("\\f");break;case 92:case 40:case 41:i.push(String.fromCharCode(a));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let e=15&a;a=this.nextChar();s=!0;if(a>=48&&a<=55){e=(e<<3)+(15&a);a=this.nextChar();if(a>=48&&a<=55){s=!1;e=(e<<3)+(15&a)}}i.push(String.fromCharCode(e));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:i.push(String.fromCharCode(a))}break;default:i.push(String.fromCharCode(a))}if(t)break;s||(a=this.nextChar())}return i.join("")}getName(){let e,t;const i=this.strBuf;i.length=0;for(;(e=this.nextChar())>=0&&!ai[e];)if(35===e){e=this.nextChar();if(ai[e]){warn("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number.");i.push("#");break}const a=toHexDigit(e);if(-1!==a){t=e;e=this.nextChar();const s=toHexDigit(e);if(-1===s){warn(`Lexer_getName: Illegal digit (${String.fromCharCode(e)}) in hexadecimal number.`);i.push("#",String.fromCharCode(t));if(ai[e])break;i.push(String.fromCharCode(e));continue}i.push(String.fromCharCode(a<<4|s))}else i.push("#",String.fromCharCode(e))}else i.push(String.fromCharCode(e));i.length>127&&warn(`Name token is longer than allowed by the spec: ${i.length}`);return Name.get(i.join(""))}_hexStringWarn(e){5!=this._hexStringNumWarn++?this._hexStringNumWarn>5||warn(`getHexString - ignoring invalid character: ${e}`):warn("getHexString - ignoring additional invalid characters.")}getHexString(){const e=this.strBuf;e.length=0;let t=this.currentChar,i=-1,a=-1;this._hexStringNumWarn=0;for(;;){if(t<0){warn("Unterminated hex string");break}if(62===t){this.nextChar();break}if(1!==ai[t]){a=toHexDigit(t);if(-1===a)this._hexStringWarn(t);else if(-1===i)i=a;else{e.push(String.fromCharCode(i<<4|a));i=-1}t=this.nextChar()}else t=this.nextChar()}-1!==i&&e.push(String.fromCharCode(i<<4));return e.join("")}getObj(){let e=!1,t=this.currentChar;for(;;){if(t<0)return Bt;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(1!==ai[t])break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:this.nextChar();return Cmd.get("[");case 93:this.nextChar();return Cmd.get("]");case 60:t=this.nextChar();if(60===t){this.nextChar();return Cmd.get("<<")}return this.getHexString();case 62:t=this.nextChar();if(62===t){this.nextChar();return Cmd.get(">>")}return Cmd.get(">");case 123:this.nextChar();return Cmd.get("{");case 125:this.nextChar();return Cmd.get("}");case 41:this.nextChar();throw new FormatError(`Illegal character: ${t}`)}let i=String.fromCharCode(t);if(t<32||t>127){const e=this.peekChar();if(e>=32&&e<=127){this.nextChar();return Cmd.get(i)}}const a=this.knownCommands;let s=void 0!==a?.[i];for(;(t=this.nextChar())>=0&&!ai[t];){const e=i+String.fromCharCode(t);if(s&&void 0===a[e])break;if(128===i.length)throw new FormatError(`Command token too long: ${i.length}`);i=e;s=void 0!==a?.[i]}if("true"===i)return!0;if("false"===i)return!1;if("null"===i)return null;"BI"===i&&(this.beginInlineImagePos=this.stream.pos);return Cmd.get(i)}skipToNextLine(){let e=this.currentChar;for(;e>=0;){if(13===e){e=this.nextChar();10===e&&this.nextChar();break}if(10===e){this.nextChar();break}e=this.nextChar()}}}class Linearization{static create(e){function getInt(e,t,i=!1){const a=e.get(t);if(Number.isInteger(a)&&(i?a>=0:a>0))return a;throw new Error(`The "${t}" parameter in the linearization dictionary is invalid.`)}const t=new Parser({lexer:new Lexer(e),xref:null}),i=t.getObj(),a=t.getObj(),s=t.getObj(),r=t.getObj();let n,g;if(!(Number.isInteger(i)&&Number.isInteger(a)&&isCmd(s,"obj")&&r instanceof Dict&&"number"==typeof(n=r.get("Linearized"))&&n>0))return null;if((g=getInt(r,"L"))!==e.length)throw new Error(\'The "L" parameter in the linearization dictionary does not equal the stream length.\');return{length:g,hints:function getHints(e){const t=e.get("H");let i;if(Array.isArray(t)&&(2===(i=t.length)||4===i)){for(let e=0;e0))throw new Error(`Hint (${e}) in the linearization dictionary is invalid.`)}return t}throw new Error("Hint array in the linearization dictionary is invalid.")}(r),objectNumberFirst:getInt(r,"O"),endFirst:getInt(r,"E"),numPages:getInt(r,"N"),mainXRefEntriesOffset:getInt(r,"T"),pageFirst:r.has("P")?getInt(r,"P",!0):0}}}const si=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],ri=2**24-1;class CMap{constructor(e=!1){this.codespaceRanges=[[],[],[],[]];this.numCodespaceRanges=0;this._map=[];this.name="";this.vertical=!1;this.useCMap=null;this.builtInCMap=e}addCodespaceRange(e,t,i){this.codespaceRanges[e-1].push(t,i);this.numCodespaceRanges++}mapCidRange(e,t,i){if(t-e>ri)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;e<=t;)this._map[e++]=i++}mapBfRange(e,t,i){if(t-e>ri)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");const a=i.length-1;for(;e<=t;){this._map[e++]=i;const t=i.charCodeAt(a)+1;t>255?i=i.substring(0,a-1)+String.fromCharCode(i.charCodeAt(a-1)+1)+"\\0":i=i.substring(0,a)+String.fromCharCode(t)}}mapBfRangeToArray(e,t,i){if(t-e>ri)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const a=i.length;let s=0;for(;e<=t&&s>>0;const n=s[r];for(let e=0,t=n.length;e=t&&a<=s){i.charcode=a;i.length=r+1;return}}}i.charcode=0;i.length=1}getCharCodeLength(e){const t=this.codespaceRanges;for(let i=0,a=t.length;i=s&&e<=r)return i+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let e=0;e<65536;e++)if(this._map[e]!==e)return!1;return!0}}class IdentityCMap extends CMap{constructor(e,t){super();this.vertical=e;this.addCodespaceRange(t,0,65535)}mapCidRange(e,t,i){unreachable("should not call mapCidRange")}mapBfRange(e,t,i){unreachable("should not call mapBfRange")}mapBfRangeToArray(e,t,i){unreachable("should not call mapBfRangeToArray")}mapOne(e,t){unreachable("should not call mapCidOne")}lookup(e){return Number.isInteger(e)&&e<=65535?e:void 0}contains(e){return Number.isInteger(e)&&e<=65535}forEach(e){for(let t=0;t<=65535;t++)e(t,t)}charCodeOf(e){return Number.isInteger(e)&&e<=65535?e:-1}getMap(){const e=new Array(65536);for(let t=0;t<=65535;t++)e[t]=t;return e}get length(){return 65536}get isIdentityCMap(){unreachable("should not access .isIdentityCMap")}}function strToInt(e){let t=0;for(let i=0;i>>0}function expectString(e){if("string"!=typeof e)throw new FormatError("Malformed CMap: expected string.")}function expectInt(e){if(!Number.isInteger(e))throw new FormatError("Malformed CMap: expected int.")}function parseBfChar(e,t){for(;;){let i=t.getObj();if(i===Bt)break;if(isCmd(i,"endbfchar"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectString(i);const s=i;e.mapOne(a,s)}}function parseBfRange(e,t){for(;;){let i=t.getObj();if(i===Bt)break;if(isCmd(i,"endbfrange"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectString(i);const s=strToInt(i);i=t.getObj();if(Number.isInteger(i)||"string"==typeof i){const t=Number.isInteger(i)?String.fromCharCode(i):i;e.mapBfRange(a,s,t)}else{if(!isCmd(i,"["))break;{i=t.getObj();const r=[];for(;!isCmd(i,"]")&&i!==Bt;){r.push(i);i=t.getObj()}e.mapBfRangeToArray(a,s,r)}}}throw new FormatError("Invalid bf range.")}function parseCidChar(e,t){for(;;){let i=t.getObj();if(i===Bt)break;if(isCmd(i,"endcidchar"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectInt(i);const s=i;e.mapOne(a,s)}}function parseCidRange(e,t){for(;;){let i=t.getObj();if(i===Bt)break;if(isCmd(i,"endcidrange"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectString(i);const s=strToInt(i);i=t.getObj();expectInt(i);const r=i;e.mapCidRange(a,s,r)}}function parseCodespaceRange(e,t){for(;;){let i=t.getObj();if(i===Bt)break;if(isCmd(i,"endcodespacerange"))return;if("string"!=typeof i)break;const a=strToInt(i);i=t.getObj();if("string"!=typeof i)break;const s=strToInt(i);e.addCodespaceRange(i.length,a,s)}throw new FormatError("Invalid codespace range.")}function parseWMode(e,t){const i=t.getObj();Number.isInteger(i)&&(e.vertical=!!i)}function parseCMapName(e,t){const i=t.getObj();i instanceof Name&&(e.name=i.name)}async function parseCMap(e,t,i,a){let s,r;A:for(;;)try{const i=t.getObj();if(i===Bt)break;if(i instanceof Name){"WMode"===i.name?parseWMode(e,t):"CMapName"===i.name&&parseCMapName(e,t);s=i}else if(i instanceof Cmd)switch(i.cmd){case"endcmap":break A;case"usecmap":s instanceof Name&&(r=s.name);break;case"begincodespacerange":parseCodespaceRange(e,t);break;case"beginbfchar":parseBfChar(e,t);break;case"begincidchar":parseCidChar(e,t);break;case"beginbfrange":parseBfRange(e,t);break;case"begincidrange":parseCidRange(e,t)}}catch(e){if(e instanceof MissingDataException)throw e;warn("Invalid cMap data: "+e);continue}!a&&r&&(a=r);return a?extendCMap(e,i,a):e}async function extendCMap(e,t,i){e.useCMap=await createBuiltInCMap(i,t);if(0===e.numCodespaceRanges){const t=e.useCMap.codespaceRanges;for(let i=0;iextendCMap(s,t,e)));const r=new Lexer(new Stream(i));return parseCMap(s,r,t,null)}class CMapFactory{static async create({encoding:e,fetchBuiltInCMap:t,useCMap:i}){if(e instanceof Name)return createBuiltInCMap(e.name,t);if(e instanceof BaseStream){const a=await parseCMap(new CMap,new Lexer(e),t,i);return a.isIdentityCMap?createBuiltInCMap(a.name,t):a}throw new Error("Encoding required.")}}const ni=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],gi=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],oi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Ii=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ci=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],Ci=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],hi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],li=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],Bi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],Qi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function getEncoding(e){switch(e){case"WinAnsiEncoding":return li;case"StandardEncoding":return hi;case"MacRomanEncoding":return Ci;case"SymbolSetEncoding":return Bi;case"ZapfDingbatsEncoding":return Qi;case"ExpertEncoding":return Ii;case"MacExpertEncoding":return ci;default:return null}}const Ei=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ui=391,di=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],fi=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]+e[t-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]-e[t-1]}},{id:"div",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]/e[t-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(e,t){e[t-1]=-e[t-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]*e[t-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];class CFFParser{constructor(e,t,i){this.bytes=e.getBytes();this.properties=t;this.seacAnalysisEnabled=!!i}parse(){const e=this.properties,t=new CFF;this.cff=t;const i=this.parseHeader(),a=this.parseIndex(i.endPos),s=this.parseIndex(a.endPos),r=this.parseIndex(s.endPos),n=this.parseIndex(r.endPos),g=this.parseDict(s.obj.get(0)),o=this.createDict(CFFTopDict,g,t.strings);t.header=i.obj;t.names=this.parseNameIndex(a.obj);t.strings=this.parseStringIndex(r.obj);t.topDict=o;t.globalSubrIndex=n.obj;this.parsePrivateDict(t.topDict);t.isCIDFont=o.hasName("ROS");const c=o.getByName("CharStrings"),C=this.parseIndex(c).obj,h=o.getByName("FontMatrix");h&&(e.fontMatrix=h);const l=o.getByName("FontBBox");if(l){e.ascent=Math.max(l[3],l[1]);e.descent=Math.min(l[1],l[3]);e.ascentScaled=!0}let Q,E;if(t.isCIDFont){const e=this.parseIndex(o.getByName("FDArray")).obj;for(let i=0,a=e.count;i=t)throw new FormatError("Invalid CFF header");if(0!==i){info("cff data is shifted");e=e.subarray(i);this.bytes=e}const a=e[0],s=e[1],r=e[2],n=e[3];return{obj:new CFFHeader(a,s,r,n),endPos:r}}parseDict(e){let t=0;function parseOperand(){let i=e[t++];if(30===i)return function parseFloatOperand(){let i="";const a=15,s=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],r=e.length;for(;t>4,g=15&r;if(n===a)break;i+=s[n];if(g===a)break;i+=s[g]}return parseFloat(i)}();if(28===i){i=e[t++];i=(i<<24|e[t++]<<16)>>16;return i}if(29===i){i=e[t++];i=i<<8|e[t++];i=i<<8|e[t++];i=i<<8|e[t++];return i}if(i>=32&&i<=246)return i-139;if(i>=247&&i<=250)return 256*(i-247)+e[t++]+108;if(i>=251&&i<=254)return-256*(i-251)-e[t++]-108;warn(\'CFFParser_parseDict: "\'+i+\'" is a reserved command.\');return NaN}let i=[];const a=[];t=0;const s=e.length;for(;t10)return!1;let s=e.stackSize;const r=e.stack;let n=t.length;for(let g=0;g>16;g+=2;s++}else if(14===o){if(s>=4){s-=4;if(this.seacAnalysisEnabled){e.seac=r.slice(s,s+4);return!1}}c=di[o]}else if(o>=32&&o<=246){r[s]=o-139;s++}else if(o>=247&&o<=254){r[s]=o<251?(o-247<<8)+t[g]+108:-(o-251<<8)-t[g]-108;g++;s++}else if(255===o){r[s]=(t[g]<<24|t[g+1]<<16|t[g+2]<<8|t[g+3])/65536;g+=4;s++}else if(19===o||20===o){e.hints+=s>>1;if(0===e.hints){t.copyWithin(g-1,g,-1);g-=1;n-=1;continue}g+=e.hints+7>>3;s%=2;c=di[o]}else{if(10===o||29===o){const t=10===o?i:a;if(!t){c=di[o];warn("Missing subrsIndex for "+c.id);return!1}let n=32768;t.count<1240?n=107:t.count<33900&&(n=1131);const g=r[--s]+n;if(g<0||g>=t.count||isNaN(g)){c=di[o];warn("Out of bounds subrIndex for "+c.id);return!1}e.stackSize=s;e.callDepth++;if(!this.parseCharString(e,t.get(g),i,a))return!1;e.callDepth--;s=e.stackSize;continue}if(11===o){e.stackSize=s;return!0}if(0===o&&g===t.length){t[g-1]=14;c=di[14]}else{if(9===o){t.copyWithin(g-1,g,-1);g-=1;n-=1;continue}c=di[o]}}if(c){if(c.stem){e.hints+=s>>1;if(3===o||23===o)e.hasVStems=!0;else if(e.hasVStems&&(1===o||18===o)){warn("CFF stem hints are in wrong order");t[g-1]=1===o?3:23}}if("min"in c&&!e.undefStack&&s=2&&c.stem?s%=2:s>1&&warn("Found too many parameters for stack-clearing command");s>0&&(e.width=r[s-1])}if("stackDelta"in c){"stackFn"in c&&c.stackFn(r,s);s+=c.stackDelta}else if(c.stackClearing)s=0;else if(c.resetStack){s=0;e.undefStack=!1}else if(c.undefStack){s=0;e.undefStack=!0;e.firstStackClearing=!1}}}n=s.length){warn("Invalid fd index for glyph index.");h=!1}if(h){Q=s[e].privateDict;l=Q.subrsIndex}}else t&&(l=t);h&&(h=this.parseCharString(C,o,l,i));if(null!==C.width){const e=Q.getByName("nominalWidthX");g[c]=e+C.width}else{const e=Q.getByName("defaultWidthX");g[c]=e}null!==C.seac&&(n[c]=C.seac);h||e.set(c,new Uint8Array([14]))}return{charStrings:e,seacs:n,widths:g}}emptyPrivateDictionary(e){const t=this.createDict(CFFPrivateDict,[],e.strings);e.setByKey(18,[0,0]);e.privateDict=t}parsePrivateDict(e){if(!e.hasName("Private")){this.emptyPrivateDictionary(e);return}const t=e.getByName("Private");if(!Array.isArray(t)||2!==t.length){e.removeByName("Private");return}const i=t[0],a=t[1];if(0===i||a>=this.bytes.length){this.emptyPrivateDictionary(e);return}const s=a+i,r=this.bytes.subarray(a,s),n=this.parseDict(r),g=this.createDict(CFFPrivateDict,n,e.strings);e.privateDict=g;0===g.getByName("ExpansionFactor")&&g.setByName("ExpansionFactor",.06);if(!g.getByName("Subrs"))return;const o=g.getByName("Subrs"),c=a+o;if(0===o||c>=this.bytes.length){this.emptyPrivateDictionary(e);return}const C=this.parseIndex(c);g.subrsIndex=C.obj}parseCharsets(e,t,i,a){if(0===e)return new CFFCharset(!0,yi.ISO_ADOBE,ni);if(1===e)return new CFFCharset(!0,yi.EXPERT,gi);if(2===e)return new CFFCharset(!0,yi.EXPERT_SUBSET,oi);const s=this.bytes,r=e,n=s[e++],g=[a?0:".notdef"];let o,c,C;t-=1;switch(n){case 0:for(C=0;C=65535){warn("Not enough space in charstrings to duplicate first glyph.");return}const e=this.charStrings.get(0);this.charStrings.add(e);this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(e){if(e<0||e>=this.charStrings.count)return!1;return this.charStrings.get(e).length>0}}class CFFHeader{constructor(e,t,i,a){this.major=e;this.minor=t;this.hdrSize=i;this.offSize=a}}class CFFStrings{constructor(){this.strings=[]}get(e){return e>=0&&e<=390?Ei[e]:e-ui<=this.strings.length?this.strings[e-ui]:Ei[0]}getSID(e){let t=Ei.indexOf(e);if(-1!==t)return t;t=this.strings.indexOf(e);return-1!==t?t+ui:-1}add(e){this.strings.push(e)}get count(){return this.strings.length}}class CFFIndex{constructor(){this.objects=[];this.length=0}add(e){this.length+=e.length;this.objects.push(e)}set(e,t){this.length+=t.length-this.objects[e].length;this.objects[e]=t}get(e){return this.objects[e]}get count(){return this.objects.length}}class CFFDict{constructor(e,t){this.keyToNameMap=e.keyToNameMap;this.nameToKeyMap=e.nameToKeyMap;this.defaults=e.defaults;this.types=e.types;this.opcodes=e.opcodes;this.order=e.order;this.strings=t;this.values=Object.create(null)}setByKey(e,t){if(!(e in this.keyToNameMap))return!1;if(0===t.length)return!0;for(const i of t)if(isNaN(i)){warn(`Invalid CFFDict value: "${t}" for key "${e}".`);return!0}const i=this.types[e];"num"!==i&&"sid"!==i&&"offset"!==i||(t=t[0]);this.values[e]=t;return!0}setByName(e,t){if(!(e in this.nameToKeyMap))throw new FormatError(`Invalid dictionary name "${e}"`);this.values[this.nameToKeyMap[e]]=t}hasName(e){return this.nameToKeyMap[e]in this.values}getByName(e){if(!(e in this.nameToKeyMap))throw new FormatError(`Invalid dictionary name ${e}"`);const t=this.nameToKeyMap[e];return t in this.values?this.values[t]:this.defaults[t]}removeByName(e){delete this.values[this.nameToKeyMap[e]]}static createTables(e){const t={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(const i of e){const e=Array.isArray(i[0])?(i[0][0]<<8)+i[0][1]:i[0];t.keyToNameMap[e]=i[1];t.nameToKeyMap[i[1]]=e;t.types[e]=i[2];t.defaults[e]=i[3];t.opcodes[e]=Array.isArray(i[0])?i[0]:[i[0]];t.order.push(e)}return t}}const pi=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]];class CFFTopDict extends CFFDict{static get tables(){return shadow(this,"tables",this.createTables(pi))}constructor(e){super(CFFTopDict.tables,e);this.privateDict=null}}const mi=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]];class CFFPrivateDict extends CFFDict{static get tables(){return shadow(this,"tables",this.createTables(mi))}constructor(e){super(CFFPrivateDict.tables,e);this.subrsIndex=null}}const yi={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2};class CFFCharset{constructor(e,t,i,a){this.predefined=e;this.format=t;this.charset=i;this.raw=a}}class CFFEncoding{constructor(e,t,i,a){this.predefined=e;this.format=t;this.encoding=i;this.raw=a}}class CFFFDSelect{constructor(e,t){this.format=e;this.fdSelect=t}getFDIndex(e){return e<0||e>=this.fdSelect.length?-1:this.fdSelect[e]}}class CFFOffsetTracker{constructor(){this.offsets=Object.create(null)}isTracking(e){return e in this.offsets}track(e,t){if(e in this.offsets)throw new FormatError(`Already tracking location of ${e}`);this.offsets[e]=t}offset(e){for(const t in this.offsets)this.offsets[t]+=e}setEntryLocation(e,t,i){if(!(e in this.offsets))throw new FormatError(`Not tracking location of ${e}`);const a=i.data,s=this.offsets[e];for(let e=0,i=t.length;e>24&255;a[n]=c>>16&255;a[g]=c>>8&255;a[o]=255&c}}}class CFFCompiler{constructor(e){this.cff=e}compile(){const e=this.cff,t={data:[],length:0,add(e){try{this.data.push(...e)}catch{this.data=this.data.concat(e)}this.length=this.data.length}},i=this.compileHeader(e.header);t.add(i);const a=this.compileNameIndex(e.names);t.add(a);if(e.isCIDFont&&e.topDict.hasName("FontMatrix")){const t=e.topDict.getByName("FontMatrix");e.topDict.removeByName("FontMatrix");for(const i of e.fdArray){let e=t.slice(0);i.hasName("FontMatrix")&&(e=Util.transform(e,i.getByName("FontMatrix")));i.setByName("FontMatrix",e)}}const s=e.topDict.getByName("XUID");s?.length>16&&e.topDict.removeByName("XUID");e.topDict.setByName("charset",0);let r=this.compileTopDicts([e.topDict],t.length,e.isCIDFont);t.add(r.output);const n=r.trackers[0],g=this.compileStringIndex(e.strings.strings);t.add(g);const o=this.compileIndex(e.globalSubrIndex);t.add(o);if(e.encoding&&e.topDict.hasName("Encoding"))if(e.encoding.predefined)n.setEntryLocation("Encoding",[e.encoding.format],t);else{const i=this.compileEncoding(e.encoding);n.setEntryLocation("Encoding",[t.length],t);t.add(i)}const c=this.compileCharset(e.charset,e.charStrings.count,e.strings,e.isCIDFont);n.setEntryLocation("charset",[t.length],t);t.add(c);const C=this.compileCharStrings(e.charStrings);n.setEntryLocation("CharStrings",[t.length],t);t.add(C);if(e.isCIDFont){n.setEntryLocation("FDSelect",[t.length],t);const i=this.compileFDSelect(e.fdSelect);t.add(i);r=this.compileTopDicts(e.fdArray,t.length,!0);n.setEntryLocation("FDArray",[t.length],t);t.add(r.output);const a=r.trackers;this.compilePrivateDicts(e.fdArray,a,t)}this.compilePrivateDicts([e.topDict],[n],t);t.add([0]);return t.data}encodeNumber(e){return Number.isInteger(e)?this.encodeInteger(e):this.encodeFloat(e)}static get EncodeFloatRegExp(){return shadow(this,"EncodeFloatRegExp",/\\.(\\d*?)(?:9{5,20}|0{5,20})\\d{0,2}(?:e(.+)|$)/)}encodeFloat(e){let t=e.toString();const i=CFFCompiler.EncodeFloatRegExp.exec(t);if(i){const a=parseFloat("1e"+((i[2]?+i[2]:0)+i[1].length));t=(Math.round(e*a)/a).toString()}let a,s,r="";for(a=0,s=t.length;a=-107&&e<=107?[e+139]:e>=108&&e<=1131?[247+((e-=108)>>8),255&e]:e>=-1131&&e<=-108?[251+((e=-e-108)>>8),255&e]:e>=-32768&&e<=32767?[28,e>>8&255,255&e]:[29,e>>24&255,e>>16&255,e>>8&255,255&e];return t}compileHeader(e){return[e.major,e.minor,4,e.offSize]}compileNameIndex(e){const t=new CFFIndex;for(const i of e){const e=Math.min(i.length,127);let a=new Array(e);for(let t=0;t"~"||"["===e||"]"===e||"("===e||")"===e||"{"===e||"}"===e||"<"===e||">"===e||"/"===e||"%"===e)&&(e="_");a[t]=e}a=a.join("");""===a&&(a="Bad_Font_Name");t.add(stringToBytes(a))}return this.compileIndex(t)}compileTopDicts(e,t,i){const a=[];let s=new CFFIndex;for(const r of e){if(i){r.removeByName("CIDFontVersion");r.removeByName("CIDFontRevision");r.removeByName("CIDFontType");r.removeByName("CIDCount");r.removeByName("UIDBase")}const e=new CFFOffsetTracker,n=this.compileDict(r,e);a.push(e);s.add(n);e.offset(t)}s=this.compileIndex(s,a);return{trackers:a,output:s}}compilePrivateDicts(e,t,i){for(let a=0,s=e.length;a>8&255,255&r]);else{s=new Uint8Array(1+2*r);s[0]=0;let t=0;const a=e.charset.length;let n=!1;for(let r=1;r>8&255;s[r+1]=255&g}}return this.compileTypedArray(s)}compileEncoding(e){return this.compileTypedArray(e.raw)}compileFDSelect(e){const t=e.format;let i,a;switch(t){case 0:i=new Uint8Array(1+e.fdSelect.length);i[0]=t;for(a=0;a>8&255,255&s,r];for(a=1;a>8&255,255&a,t);r=t}}const g=(n.length-3)/3;n[1]=g>>8&255;n[2]=255&g;n.push(a>>8&255,255&a);i=new Uint8Array(n)}return this.compileTypedArray(i)}compileTypedArray(e){return Array.from(e)}compileIndex(e,t=[]){const i=e.objects,a=i.length;if(0===a)return[0,0];const s=[a>>8&255,255&a];let r,n,g=1;for(r=0;r>8&255,255&o):3===n?s.push(o>>16&255,o>>8&255,255&o):s.push(o>>>24&255,o>>16&255,o>>8&255,255&o);i[r]&&(o+=i[r].length)}for(r=0;r=5&&t<=7))return-1;a=e.substring(1)}if(a===a.toUpperCase()){i=parseInt(a,16);if(i>=0)return i}}return-1}const Fi=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function getUnicodeRangeFor(e,t=-1){if(-1!==t){const i=Fi[t];for(let a=0,s=i.length;a=i[a]&&e<=i[a+1])return t}for(let t=0,i=Fi.length;t=i[a]&&e<=i[a+1])return t}return-1}const Si=new RegExp("^(\\\\s)|(\\\\p{Mn})|(\\\\p{Cf})$","u"),ki=new Map;const Ri=!0,Ni=1,Gi=2,Mi=4,xi=32,Hi=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function recoverGlyphName(e,t){if(void 0!==t[e])return e;const i=getUnicodeForGlyph(e,t);if(-1!==i)for(const e in t)if(t[e]===i)return e;info("Unable to recover a standard glyph name for: "+e);return e}function type1FontGlyphMapping(e,t,i){const a=Object.create(null);let s,r,n;const g=!!(e.flags&Mi);if(e.isInternalFont){n=t;for(r=0;r=0?s:0}}else if(e.baseEncodingName){n=getEncoding(e.baseEncodingName);for(r=0;r=0?s:0}}else if(g)for(r in t)a[r]=t[r];else{n=hi;for(r=0;r=0?s:0}}const o=e.differences;let c;if(o)for(r in o){const e=o[r];s=i.indexOf(e);if(-1===s){c||(c=wi());const t=recoverGlyphName(e,c);t!==e&&(s=i.indexOf(t))}a[r]=s>=0?s:0}return a}function normalizeFontName(e){return e.replaceAll(/[,_]/g,"-").replaceAll(/\\s/g,"")}const Ji=getLookupTableFactory((e=>{e[8211]=65074;e[8212]=65073;e[8229]=65072;e[8230]=65049;e[12289]=65041;e[12290]=65042;e[12296]=65087;e[12297]=65088;e[12298]=65085;e[12299]=65086;e[12300]=65089;e[12301]=65090;e[12302]=65091;e[12303]=65092;e[12304]=65083;e[12305]=65084;e[12308]=65081;e[12309]=65082;e[12310]=65047;e[12311]=65048;e[65103]=65076;e[65281]=65045;e[65288]=65077;e[65289]=65078;e[65292]=65040;e[65306]=65043;e[65307]=65044;e[65311]=65046;e[65339]=65095;e[65341]=65096;e[65343]=65075;e[65371]=65079;e[65373]=65080})),Yi=getLookupTableFactory((function(e){e["Times-Roman"]="Times-Roman";e.Helvetica="Helvetica";e.Courier="Courier";e.Symbol="Symbol";e["Times-Bold"]="Times-Bold";e["Helvetica-Bold"]="Helvetica-Bold";e["Courier-Bold"]="Courier-Bold";e.ZapfDingbats="ZapfDingbats";e["Times-Italic"]="Times-Italic";e["Helvetica-Oblique"]="Helvetica-Oblique";e["Courier-Oblique"]="Courier-Oblique";e["Times-BoldItalic"]="Times-BoldItalic";e["Helvetica-BoldOblique"]="Helvetica-BoldOblique";e["Courier-BoldOblique"]="Courier-BoldOblique";e.ArialNarrow="Helvetica";e["ArialNarrow-Bold"]="Helvetica-Bold";e["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique";e["ArialNarrow-Italic"]="Helvetica-Oblique";e.ArialBlack="Helvetica";e["ArialBlack-Bold"]="Helvetica-Bold";e["ArialBlack-BoldItalic"]="Helvetica-BoldOblique";e["ArialBlack-Italic"]="Helvetica-Oblique";e["Arial-Black"]="Helvetica";e["Arial-Black-Bold"]="Helvetica-Bold";e["Arial-Black-BoldItalic"]="Helvetica-BoldOblique";e["Arial-Black-Italic"]="Helvetica-Oblique";e.Arial="Helvetica";e["Arial-Bold"]="Helvetica-Bold";e["Arial-BoldItalic"]="Helvetica-BoldOblique";e["Arial-Italic"]="Helvetica-Oblique";e.ArialMT="Helvetica";e["Arial-BoldItalicMT"]="Helvetica-BoldOblique";e["Arial-BoldMT"]="Helvetica-Bold";e["Arial-ItalicMT"]="Helvetica-Oblique";e["Arial-BoldItalicMT-BoldItalic"]="Helvetica-BoldOblique";e["Arial-BoldMT-Bold"]="Helvetica-Bold";e["Arial-ItalicMT-Italic"]="Helvetica-Oblique";e.ArialUnicodeMS="Helvetica";e["ArialUnicodeMS-Bold"]="Helvetica-Bold";e["ArialUnicodeMS-BoldItalic"]="Helvetica-BoldOblique";e["ArialUnicodeMS-Italic"]="Helvetica-Oblique";e["Courier-BoldItalic"]="Courier-BoldOblique";e["Courier-Italic"]="Courier-Oblique";e.CourierNew="Courier";e["CourierNew-Bold"]="Courier-Bold";e["CourierNew-BoldItalic"]="Courier-BoldOblique";e["CourierNew-Italic"]="Courier-Oblique";e["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique";e["CourierNewPS-BoldMT"]="Courier-Bold";e["CourierNewPS-ItalicMT"]="Courier-Oblique";e.CourierNewPSMT="Courier";e["Helvetica-BoldItalic"]="Helvetica-BoldOblique";e["Helvetica-Italic"]="Helvetica-Oblique";e["HelveticaLTStd-Bold"]="Helvetica-Bold";e["Symbol-Bold"]="Symbol";e["Symbol-BoldItalic"]="Symbol";e["Symbol-Italic"]="Symbol";e.TimesNewRoman="Times-Roman";e["TimesNewRoman-Bold"]="Times-Bold";e["TimesNewRoman-BoldItalic"]="Times-BoldItalic";e["TimesNewRoman-Italic"]="Times-Italic";e.TimesNewRomanPS="Times-Roman";e["TimesNewRomanPS-Bold"]="Times-Bold";e["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic";e["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic";e["TimesNewRomanPS-BoldMT"]="Times-Bold";e["TimesNewRomanPS-Italic"]="Times-Italic";e["TimesNewRomanPS-ItalicMT"]="Times-Italic";e.TimesNewRomanPSMT="Times-Roman";e["TimesNewRomanPSMT-Bold"]="Times-Bold";e["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic";e["TimesNewRomanPSMT-Italic"]="Times-Italic"})),vi=getLookupTableFactory((function(e){e.Courier="FoxitFixed.pfb";e["Courier-Bold"]="FoxitFixedBold.pfb";e["Courier-BoldOblique"]="FoxitFixedBoldItalic.pfb";e["Courier-Oblique"]="FoxitFixedItalic.pfb";e.Helvetica="LiberationSans-Regular.ttf";e["Helvetica-Bold"]="LiberationSans-Bold.ttf";e["Helvetica-BoldOblique"]="LiberationSans-BoldItalic.ttf";e["Helvetica-Oblique"]="LiberationSans-Italic.ttf";e["Times-Roman"]="FoxitSerif.pfb";e["Times-Bold"]="FoxitSerifBold.pfb";e["Times-BoldItalic"]="FoxitSerifBoldItalic.pfb";e["Times-Italic"]="FoxitSerifItalic.pfb";e.Symbol="FoxitSymbol.pfb";e.ZapfDingbats="FoxitDingbats.pfb";e["LiberationSans-Regular"]="LiberationSans-Regular.ttf";e["LiberationSans-Bold"]="LiberationSans-Bold.ttf";e["LiberationSans-Italic"]="LiberationSans-Italic.ttf";e["LiberationSans-BoldItalic"]="LiberationSans-BoldItalic.ttf"})),Ki=getLookupTableFactory((function(e){e.Calibri="Helvetica";e["Calibri-Bold"]="Helvetica-Bold";e["Calibri-BoldItalic"]="Helvetica-BoldOblique";e["Calibri-Italic"]="Helvetica-Oblique";e.CenturyGothic="Helvetica";e["CenturyGothic-Bold"]="Helvetica-Bold";e["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique";e["CenturyGothic-Italic"]="Helvetica-Oblique";e.ComicSansMS="Comic Sans MS";e["ComicSansMS-Bold"]="Comic Sans MS-Bold";e["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic";e["ComicSansMS-Italic"]="Comic Sans MS-Italic";e.GillSansMT="Helvetica";e["GillSansMT-Bold"]="Helvetica-Bold";e["GillSansMT-BoldItalic"]="Helvetica-BoldOblique";e["GillSansMT-Italic"]="Helvetica-Oblique";e.Impact="Helvetica";e["ItcSymbol-Bold"]="Helvetica-Bold";e["ItcSymbol-BoldItalic"]="Helvetica-BoldOblique";e["ItcSymbol-Book"]="Helvetica";e["ItcSymbol-BookItalic"]="Helvetica-Oblique";e["ItcSymbol-Medium"]="Helvetica";e["ItcSymbol-MediumItalic"]="Helvetica-Oblique";e.LucidaConsole="Courier";e["LucidaConsole-Bold"]="Courier-Bold";e["LucidaConsole-BoldItalic"]="Courier-BoldOblique";e["LucidaConsole-Italic"]="Courier-Oblique";e["LucidaSans-Demi"]="Helvetica-Bold";e["MS-Gothic"]="MS Gothic";e["MS-Gothic-Bold"]="MS Gothic-Bold";e["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic";e["MS-Gothic-Italic"]="MS Gothic-Italic";e["MS-Mincho"]="MS Mincho";e["MS-Mincho-Bold"]="MS Mincho-Bold";e["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic";e["MS-Mincho-Italic"]="MS Mincho-Italic";e["MS-PGothic"]="MS PGothic";e["MS-PGothic-Bold"]="MS PGothic-Bold";e["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic";e["MS-PGothic-Italic"]="MS PGothic-Italic";e["MS-PMincho"]="MS PMincho";e["MS-PMincho-Bold"]="MS PMincho-Bold";e["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic";e["MS-PMincho-Italic"]="MS PMincho-Italic";e.NuptialScript="Times-Italic";e.SegoeUISymbol="Helvetica"})),Ti=getLookupTableFactory((function(e){e["Adobe Jenson"]=!0;e["Adobe Text"]=!0;e.Albertus=!0;e.Aldus=!0;e.Alexandria=!0;e.Algerian=!0;e["American Typewriter"]=!0;e.Antiqua=!0;e.Apex=!0;e.Arno=!0;e.Aster=!0;e.Aurora=!0;e.Baskerville=!0;e.Bell=!0;e.Bembo=!0;e["Bembo Schoolbook"]=!0;e.Benguiat=!0;e["Berkeley Old Style"]=!0;e["Bernhard Modern"]=!0;e["Berthold City"]=!0;e.Bodoni=!0;e["Bauer Bodoni"]=!0;e["Book Antiqua"]=!0;e.Bookman=!0;e["Bordeaux Roman"]=!0;e["Californian FB"]=!0;e.Calisto=!0;e.Calvert=!0;e.Capitals=!0;e.Cambria=!0;e.Cartier=!0;e.Caslon=!0;e.Catull=!0;e.Centaur=!0;e["Century Old Style"]=!0;e["Century Schoolbook"]=!0;e.Chaparral=!0;e["Charis SIL"]=!0;e.Cheltenham=!0;e["Cholla Slab"]=!0;e.Clarendon=!0;e.Clearface=!0;e.Cochin=!0;e.Colonna=!0;e["Computer Modern"]=!0;e["Concrete Roman"]=!0;e.Constantia=!0;e["Cooper Black"]=!0;e.Corona=!0;e.Ecotype=!0;e.Egyptienne=!0;e.Elephant=!0;e.Excelsior=!0;e.Fairfield=!0;e["FF Scala"]=!0;e.Folkard=!0;e.Footlight=!0;e.FreeSerif=!0;e["Friz Quadrata"]=!0;e.Garamond=!0;e.Gentium=!0;e.Georgia=!0;e.Gloucester=!0;e["Goudy Old Style"]=!0;e["Goudy Schoolbook"]=!0;e["Goudy Pro Font"]=!0;e.Granjon=!0;e["Guardian Egyptian"]=!0;e.Heather=!0;e.Hercules=!0;e["High Tower Text"]=!0;e.Hiroshige=!0;e["Hoefler Text"]=!0;e["Humana Serif"]=!0;e.Imprint=!0;e["Ionic No. 5"]=!0;e.Janson=!0;e.Joanna=!0;e.Korinna=!0;e.Lexicon=!0;e.LiberationSerif=!0;e["Liberation Serif"]=!0;e["Linux Libertine"]=!0;e.Literaturnaya=!0;e.Lucida=!0;e["Lucida Bright"]=!0;e.Melior=!0;e.Memphis=!0;e.Miller=!0;e.Minion=!0;e.Modern=!0;e["Mona Lisa"]=!0;e["Mrs Eaves"]=!0;e["MS Serif"]=!0;e["Museo Slab"]=!0;e["New York"]=!0;e["Nimbus Roman"]=!0;e["NPS Rawlinson Roadway"]=!0;e.NuptialScript=!0;e.Palatino=!0;e.Perpetua=!0;e.Plantin=!0;e["Plantin Schoolbook"]=!0;e.Playbill=!0;e["Poor Richard"]=!0;e["Rawlinson Roadway"]=!0;e.Renault=!0;e.Requiem=!0;e.Rockwell=!0;e.Roman=!0;e["Rotis Serif"]=!0;e.Sabon=!0;e.Scala=!0;e.Seagull=!0;e.Sistina=!0;e.Souvenir=!0;e.STIX=!0;e["Stone Informal"]=!0;e["Stone Serif"]=!0;e.Sylfaen=!0;e.Times=!0;e.Trajan=!0;e["Trinité"]=!0;e["Trump Mediaeval"]=!0;e.Utopia=!0;e["Vale Type"]=!0;e["Bitstream Vera"]=!0;e["Vera Serif"]=!0;e.Versailles=!0;e.Wanted=!0;e.Weiss=!0;e["Wide Latin"]=!0;e.Windsor=!0;e.XITS=!0})),qi=getLookupTableFactory((function(e){e.Dingbats=!0;e.Symbol=!0;e.ZapfDingbats=!0;e.Wingdings=!0;e["Wingdings-Bold"]=!0;e["Wingdings-Regular"]=!0})),Oi=getLookupTableFactory((function(e){e[2]=10;e[3]=32;e[4]=33;e[5]=34;e[6]=35;e[7]=36;e[8]=37;e[9]=38;e[10]=39;e[11]=40;e[12]=41;e[13]=42;e[14]=43;e[15]=44;e[16]=45;e[17]=46;e[18]=47;e[19]=48;e[20]=49;e[21]=50;e[22]=51;e[23]=52;e[24]=53;e[25]=54;e[26]=55;e[27]=56;e[28]=57;e[29]=58;e[30]=894;e[31]=60;e[32]=61;e[33]=62;e[34]=63;e[35]=64;e[36]=65;e[37]=66;e[38]=67;e[39]=68;e[40]=69;e[41]=70;e[42]=71;e[43]=72;e[44]=73;e[45]=74;e[46]=75;e[47]=76;e[48]=77;e[49]=78;e[50]=79;e[51]=80;e[52]=81;e[53]=82;e[54]=83;e[55]=84;e[56]=85;e[57]=86;e[58]=87;e[59]=88;e[60]=89;e[61]=90;e[62]=91;e[63]=92;e[64]=93;e[65]=94;e[66]=95;e[67]=96;e[68]=97;e[69]=98;e[70]=99;e[71]=100;e[72]=101;e[73]=102;e[74]=103;e[75]=104;e[76]=105;e[77]=106;e[78]=107;e[79]=108;e[80]=109;e[81]=110;e[82]=111;e[83]=112;e[84]=113;e[85]=114;e[86]=115;e[87]=116;e[88]=117;e[89]=118;e[90]=119;e[91]=120;e[92]=121;e[93]=122;e[94]=123;e[95]=124;e[96]=125;e[97]=126;e[98]=196;e[99]=197;e[100]=199;e[101]=201;e[102]=209;e[103]=214;e[104]=220;e[105]=225;e[106]=224;e[107]=226;e[108]=228;e[109]=227;e[110]=229;e[111]=231;e[112]=233;e[113]=232;e[114]=234;e[115]=235;e[116]=237;e[117]=236;e[118]=238;e[119]=239;e[120]=241;e[121]=243;e[122]=242;e[123]=244;e[124]=246;e[125]=245;e[126]=250;e[127]=249;e[128]=251;e[129]=252;e[130]=8224;e[131]=176;e[132]=162;e[133]=163;e[134]=167;e[135]=8226;e[136]=182;e[137]=223;e[138]=174;e[139]=169;e[140]=8482;e[141]=180;e[142]=168;e[143]=8800;e[144]=198;e[145]=216;e[146]=8734;e[147]=177;e[148]=8804;e[149]=8805;e[150]=165;e[151]=181;e[152]=8706;e[153]=8721;e[154]=8719;e[156]=8747;e[157]=170;e[158]=186;e[159]=8486;e[160]=230;e[161]=248;e[162]=191;e[163]=161;e[164]=172;e[165]=8730;e[166]=402;e[167]=8776;e[168]=8710;e[169]=171;e[170]=187;e[171]=8230;e[179]=8220;e[180]=8221;e[181]=8216;e[182]=8217;e[200]=193;e[203]=205;e[207]=211;e[210]=218;e[223]=711;e[224]=321;e[225]=322;e[226]=352;e[227]=353;e[228]=381;e[229]=382;e[233]=221;e[234]=253;e[252]=263;e[253]=268;e[254]=269;e[258]=258;e[260]=260;e[261]=261;e[265]=280;e[266]=281;e[267]=282;e[268]=283;e[269]=313;e[275]=323;e[276]=324;e[278]=328;e[283]=344;e[284]=345;e[285]=346;e[286]=347;e[292]=367;e[295]=377;e[296]=378;e[298]=380;e[305]=963;e[306]=964;e[307]=966;e[308]=8215;e[309]=8252;e[310]=8319;e[311]=8359;e[312]=8592;e[313]=8593;e[337]=9552;e[493]=1039;e[494]=1040;e[672]=1488;e[673]=1489;e[674]=1490;e[675]=1491;e[676]=1492;e[677]=1493;e[678]=1494;e[679]=1495;e[680]=1496;e[681]=1497;e[682]=1498;e[683]=1499;e[684]=1500;e[685]=1501;e[686]=1502;e[687]=1503;e[688]=1504;e[689]=1505;e[690]=1506;e[691]=1507;e[692]=1508;e[693]=1509;e[694]=1510;e[695]=1511;e[696]=1512;e[697]=1513;e[698]=1514;e[705]=1524;e[706]=8362;e[710]=64288;e[711]=64298;e[759]=1617;e[761]=1776;e[763]=1778;e[775]=1652;e[777]=1764;e[778]=1780;e[779]=1781;e[780]=1782;e[782]=771;e[783]=64726;e[786]=8363;e[788]=8532;e[790]=768;e[791]=769;e[792]=768;e[795]=803;e[797]=64336;e[798]=64337;e[799]=64342;e[800]=64343;e[801]=64344;e[802]=64345;e[803]=64362;e[804]=64363;e[805]=64364;e[2424]=7821;e[2425]=7822;e[2426]=7823;e[2427]=7824;e[2428]=7825;e[2429]=7826;e[2430]=7827;e[2433]=7682;e[2678]=8045;e[2679]=8046;e[2830]=1552;e[2838]=686;e[2840]=751;e[2842]=753;e[2843]=754;e[2844]=755;e[2846]=757;e[2856]=767;e[2857]=848;e[2858]=849;e[2862]=853;e[2863]=854;e[2864]=855;e[2865]=861;e[2866]=862;e[2906]=7460;e[2908]=7462;e[2909]=7463;e[2910]=7464;e[2912]=7466;e[2913]=7467;e[2914]=7468;e[2916]=7470;e[2917]=7471;e[2918]=7472;e[2920]=7474;e[2921]=7475;e[2922]=7476;e[2924]=7478;e[2925]=7479;e[2926]=7480;e[2928]=7482;e[2929]=7483;e[2930]=7484;e[2932]=7486;e[2933]=7487;e[2934]=7488;e[2936]=7490;e[2937]=7491;e[2938]=7492;e[2940]=7494;e[2941]=7495;e[2942]=7496;e[2944]=7498;e[2946]=7500;e[2948]=7502;e[2950]=7504;e[2951]=7505;e[2952]=7506;e[2954]=7508;e[2955]=7509;e[2956]=7510;e[2958]=7512;e[2959]=7513;e[2960]=7514;e[2962]=7516;e[2963]=7517;e[2964]=7518;e[2966]=7520;e[2967]=7521;e[2968]=7522;e[2970]=7524;e[2971]=7525;e[2972]=7526;e[2974]=7528;e[2975]=7529;e[2976]=7530;e[2978]=1537;e[2979]=1538;e[2980]=1539;e[2982]=1549;e[2983]=1551;e[2984]=1552;e[2986]=1554;e[2987]=1555;e[2988]=1556;e[2990]=1623;e[2991]=1624;e[2995]=1775;e[2999]=1791;e[3002]=64290;e[3003]=64291;e[3004]=64292;e[3006]=64294;e[3007]=64295;e[3008]=64296;e[3011]=1900;e[3014]=8223;e[3015]=8244;e[3017]=7532;e[3018]=7533;e[3019]=7534;e[3075]=7590;e[3076]=7591;e[3079]=7594;e[3080]=7595;e[3083]=7598;e[3084]=7599;e[3087]=7602;e[3088]=7603;e[3091]=7606;e[3092]=7607;e[3095]=7610;e[3096]=7611;e[3099]=7614;e[3100]=7615;e[3103]=7618;e[3104]=7619;e[3107]=8337;e[3108]=8338;e[3116]=1884;e[3119]=1885;e[3120]=1885;e[3123]=1886;e[3124]=1886;e[3127]=1887;e[3128]=1887;e[3131]=1888;e[3132]=1888;e[3135]=1889;e[3136]=1889;e[3139]=1890;e[3140]=1890;e[3143]=1891;e[3144]=1891;e[3147]=1892;e[3148]=1892;e[3153]=580;e[3154]=581;e[3157]=584;e[3158]=585;e[3161]=588;e[3162]=589;e[3165]=891;e[3166]=892;e[3169]=1274;e[3170]=1275;e[3173]=1278;e[3174]=1279;e[3181]=7622;e[3182]=7623;e[3282]=11799;e[3316]=578;e[3379]=42785;e[3393]=1159;e[3416]=8377})),Pi=getLookupTableFactory((function(e){e[227]=322;e[264]=261;e[291]=346})),Wi=getLookupTableFactory((function(e){e[1]=32;e[4]=65;e[5]=192;e[6]=193;e[9]=196;e[17]=66;e[18]=67;e[21]=268;e[24]=68;e[28]=69;e[29]=200;e[30]=201;e[32]=282;e[38]=70;e[39]=71;e[44]=72;e[47]=73;e[48]=204;e[49]=205;e[58]=74;e[60]=75;e[62]=76;e[68]=77;e[69]=78;e[75]=79;e[76]=210;e[80]=214;e[87]=80;e[89]=81;e[90]=82;e[92]=344;e[94]=83;e[97]=352;e[100]=84;e[104]=85;e[109]=220;e[115]=86;e[116]=87;e[121]=88;e[122]=89;e[124]=221;e[127]=90;e[129]=381;e[258]=97;e[259]=224;e[260]=225;e[263]=228;e[268]=261;e[271]=98;e[272]=99;e[273]=263;e[275]=269;e[282]=100;e[286]=101;e[287]=232;e[288]=233;e[290]=283;e[295]=281;e[296]=102;e[336]=103;e[346]=104;e[349]=105;e[350]=236;e[351]=237;e[361]=106;e[364]=107;e[367]=108;e[371]=322;e[373]=109;e[374]=110;e[381]=111;e[382]=242;e[383]=243;e[386]=246;e[393]=112;e[395]=113;e[396]=114;e[398]=345;e[400]=115;e[401]=347;e[403]=353;e[410]=116;e[437]=117;e[442]=252;e[448]=118;e[449]=119;e[454]=120;e[455]=121;e[457]=253;e[460]=122;e[462]=382;e[463]=380;e[853]=44;e[855]=58;e[856]=46;e[876]=47;e[878]=45;e[882]=45;e[894]=40;e[895]=41;e[896]=91;e[897]=93;e[923]=64;e[1004]=48;e[1005]=49;e[1006]=50;e[1007]=51;e[1008]=52;e[1009]=53;e[1010]=54;e[1011]=55;e[1012]=56;e[1013]=57;e[1081]=37;e[1085]=43;e[1086]=45}));function getStandardFontName(e){const t=normalizeFontName(e);return Yi()[t]}function isKnownFontName(e){const t=normalizeFontName(e);return!!(Yi()[t]||Ki()[t]||Ti()[t]||qi()[t])}class ToUnicodeMap{constructor(e=[]){this._map=e}get length(){return this._map.length}forEach(e){for(const t in this._map)e(t,this._map[t].codePointAt(0))}has(e){return void 0!==this._map[e]}get(e){return this._map[e]}charCodeOf(e){const t=this._map;if(t.length<=65536)return t.indexOf(e);for(const i in t)if(t[i]===e)return 0|i;return-1}amend(e){for(const t in e)this._map[t]=e[t]}}class IdentityToUnicodeMap{constructor(e,t){this.firstChar=e;this.lastChar=t}get length(){return this.lastChar+1-this.firstChar}forEach(e){for(let t=this.firstChar,i=this.lastChar;t<=i;t++)e(t,t)}has(e){return this.firstChar<=e&&e<=this.lastChar}get(e){if(this.firstChar<=e&&e<=this.lastChar)return String.fromCharCode(e)}charCodeOf(e){return Number.isInteger(e)&&e>=this.firstChar&&e<=this.lastChar?e:-1}amend(e){unreachable("Should not call amend()")}}class CFFFont{constructor(e,t){this.properties=t;const i=new CFFParser(e,t,Ri);this.cff=i.parse();this.cff.duplicateFirstGlyph();const a=new CFFCompiler(this.cff);this.seacs=this.cff.seacs;try{this.data=a.compile()}catch{warn("Failed to compile font "+t.loadedName);this.data=e}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){const e=this.cff,t=this.properties,{cidToGidMap:i,cMap:a}=t,s=e.charset.charset;let r,n;if(t.composite){let t,g;if(i?.length>0){t=Object.create(null);for(let e=0,a=i.length;e=0){const a=i[t];a&&(s[e]=a)}}s.length>0&&(this.properties.builtInEncoding=s)}}function getUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function getUint16(e,t){return e[t]<<8|e[t+1]}function getInt16(e,t){return(e[t]<<24|e[t+1]<<16)>>16}function getInt8(e,t){return e[t]<<24>>24}function getFloat214(e,t){return getInt16(e,t)/16384}function getSubroutineBias(e){const t=e.length;let i=32768;t<1240?i=107:t<33900&&(i=1131);return i}function parseCmap(e,t,i){const a=1===getUint16(e,t+2)?getUint32(e,t+8):getUint32(e,t+16),s=getUint16(e,t+a);let r,n,g;if(4===s){getUint16(e,t+a+2);const i=getUint16(e,t+a+6)>>1;n=t+a+14;r=[];for(g=0;g>1;i0;)C.push({flags:r})}for(i=0;i>1;p=!0;break;case 4:n+=s.pop();moveTo(r,n);p=!0;break;case 5:for(;s.length>0;){r+=s.shift();n+=s.shift();lineTo(r,n)}break;case 6:for(;s.length>0;){r+=s.shift();lineTo(r,n);if(0===s.length)break;n+=s.shift();lineTo(r,n)}break;case 7:for(;s.length>0;){n+=s.shift();lineTo(r,n);if(0===s.length)break;r+=s.shift();lineTo(r,n)}break;case 8:for(;s.length>0;){c=r+s.shift();h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+s.shift();bezierCurveTo(c,h,C,l,r,n)}break;case 10:d=s.pop();f=null;if(i.isCFFCIDFont){const e=i.fdSelect.getFDIndex(a);if(e>=0&&eMath.abs(n-t)?r+=s.shift():n+=s.shift();bezierCurveTo(c,h,C,l,r,n);break;default:throw new FormatError(`unknown operator: 12 ${m}`)}break;case 14:if(s.length>=4){const e=s.pop(),a=s.pop();n=s.pop();r=s.pop();t.save();t.translate(r,n);let g=lookupCmap(i.cmap,String.fromCharCode(i.glyphNameMap[hi[e]]));compileCharString(i.glyphs[g.glyphId],t,i,g.glyphId);t.restore();g=lookupCmap(i.cmap,String.fromCharCode(i.glyphNameMap[hi[a]]));compileCharString(i.glyphs[g.glyphId],t,i,g.glyphId)}return;case 19:case 20:g+=s.length>>1;o+=g+7>>3;p=!0;break;case 21:n+=s.pop();r+=s.pop();moveTo(r,n);p=!0;break;case 22:r+=s.pop();moveTo(r,n);p=!0;break;case 24:for(;s.length>2;){c=r+s.shift();h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+s.shift();bezierCurveTo(c,h,C,l,r,n)}r+=s.shift();n+=s.shift();lineTo(r,n);break;case 25:for(;s.length>6;){r+=s.shift();n+=s.shift();lineTo(r,n)}c=r+s.shift();h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+s.shift();bezierCurveTo(c,h,C,l,r,n);break;case 26:s.length%2&&(r+=s.shift());for(;s.length>0;){c=r;h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C;n=l+s.shift();bezierCurveTo(c,h,C,l,r,n)}break;case 27:s.length%2&&(n+=s.shift());for(;s.length>0;){c=r+s.shift();h=n;C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l;bezierCurveTo(c,h,C,l,r,n)}break;case 28:s.push((e[o]<<24|e[o+1]<<16)>>16);o+=2;break;case 29:d=s.pop()+i.gsubrsBias;f=i.gsubrs[d];f&&parse(f);break;case 30:for(;s.length>0;){c=r;h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n);if(0===s.length)break;c=r+s.shift();h=n;C=c+s.shift();l=h+s.shift();n=l+s.shift();r=C+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n)}break;case 31:for(;s.length>0;){c=r+s.shift();h=n;C=c+s.shift();l=h+s.shift();n=l+s.shift();r=C+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n);if(0===s.length)break;c=r;h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n)}break;default:if(m<32)throw new FormatError(`unknown operator: ${m}`);if(m<247)s.push(m-139);else if(m<251)s.push(256*(m-247)+e[o++]+108);else if(m<255)s.push(256*-(m-251)-e[o++]-108);else{s.push((e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])/65536);o+=4}}p&&(s.length=0)}}(e)}class Commands{cmds=[];transformStack=[];currentTransform=[1,0,0,1,0,0];add(e,t){if(t){const[i,a,s,r,n,g]=this.currentTransform;for(let e=0,o=t.length;e=0&&e2*getUint16(e,t)}const r=[];let n=s(t,0);for(let i=a;ie+(t.getSize()+3&-4)),0)}write(){const e=this.getSize(),t=new DataView(new ArrayBuffer(e)),i=e>131070,a=i?4:2,s=new DataView(new ArrayBuffer((this.glyphs.length+1)*a));i?s.setUint32(0,0):s.setUint16(0,0);let r=0,n=0;for(const e of this.glyphs){r+=e.write(r,t);r=r+3&-4;n+=a;i?s.setUint32(n,r):s.setUint16(n,r>>1)}return{isLocationLong:i,loca:new Uint8Array(s.buffer),glyf:new Uint8Array(t.buffer)}}scale(e){for(let t=0,i=this.glyphs.length;te+t.getSize()),0);return this.header.getSize()+e}write(e,t){if(!this.header)return 0;const i=e;e+=this.header.write(e,t);if(this.simple)e+=this.simple.write(e,t);else for(const i of this.composites)e+=i.write(e,t);return e-i}scale(e){if(!this.header)return;const t=(this.header.xMin+this.header.xMax)/2;this.header.scale(t,e);if(this.simple)this.simple.scale(t,e);else for(const i of this.composites)i.scale(t,e)}}class GlyphHeader{constructor({numberOfContours:e,xMin:t,yMin:i,xMax:a,yMax:s}){this.numberOfContours=e;this.xMin=t;this.yMin=i;this.xMax=a;this.yMax=s}static parse(e,t){return[10,new GlyphHeader({numberOfContours:t.getInt16(e),xMin:t.getInt16(e+2),yMin:t.getInt16(e+4),xMax:t.getInt16(e+6),yMax:t.getInt16(e+8)})]}getSize(){return 10}write(e,t){t.setInt16(e,this.numberOfContours);t.setInt16(e+2,this.xMin);t.setInt16(e+4,this.yMin);t.setInt16(e+6,this.xMax);t.setInt16(e+8,this.yMax);return 10}scale(e,t){this.xMin=Math.round(e+(this.xMin-e)*t);this.xMax=Math.round(e+(this.xMax-e)*t)}}class Contour{constructor({flags:e,xCoordinates:t,yCoordinates:i}){this.xCoordinates=t;this.yCoordinates=i;this.flags=e}}class SimpleGlyph{constructor({contours:e,instructions:t}){this.contours=e;this.instructions=t}static parse(e,t,i){const a=[];for(let s=0;s255?e+=2:g>0&&(e+=1);t=r;g=Math.abs(n-i);g>255?e+=2:g>0&&(e+=1);i=n}}return e}write(e,t){const i=e,a=[],s=[],r=[];let n=0,g=0;for(const i of this.contours){for(let e=0,t=i.xCoordinates.length;e=0?18:2;a.push(e)}else a.push(c)}n=o;const C=i.yCoordinates[e];c=C-g;if(0===c){t|=32;s.push(0)}else{const e=Math.abs(c);if(e<=255){t|=c>=0?36:4;s.push(e)}else s.push(c)}g=C;r.push(t)}t.setUint16(e,a.length-1);e+=2}t.setUint16(e,this.instructions.length);e+=2;if(this.instructions.length){new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,e);e+=this.instructions.length}for(const i of r)t.setUint8(e++,i);for(let i=0,s=a.length;i=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(e+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(e+=2);return e}write(e,t){const i=e;2&this.flags?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=1):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=1);t.setUint16(e,this.flags);t.setUint16(e+2,this.glyphIndex);e+=4;if(1&this.flags){if(2&this.flags){t.setInt16(e,this.argument1);t.setInt16(e+2,this.argument2)}else{t.setUint16(e,this.argument1);t.setUint16(e+2,this.argument2)}e+=4}else{t.setUint8(e,this.argument1);t.setUint8(e+1,this.argument2);e+=2}if(256&this.flags){t.setUint16(e,this.instructions.length);e+=2;if(this.instructions.length){new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,e);e+=this.instructions.length}}return e-i}scale(e,t){}}function writeInt16(e,t,i){e[t]=i>>8&255;e[t+1]=255&i}function writeInt32(e,t,i){e[t]=i>>24&255;e[t+1]=i>>16&255;e[t+2]=i>>8&255;e[t+3]=255&i}function writeData(e,t,i){if(i instanceof Uint8Array)e.set(i,t);else if("string"==typeof i)for(let a=0,s=i.length;ai;){i<<=1;a++}const s=i*t;return{range:s,entry:a,rangeShift:t*e-s}}toArray(){let e=this.sfnt;const t=this.tables,i=Object.keys(t);i.sort();const a=i.length;let s,r,n,g,o,c=12+16*a;const C=[c];for(s=0;s>>0;C.push(c)}const h=new Uint8Array(c);for(s=0;s>>0}writeInt32(h,c+4,e);writeInt32(h,c+8,C[s]);writeInt32(h,c+12,t[o].length);c+=16}return h}addTable(e,t){if(e in this.tables)throw new Error("Table "+e+" already exists");this.tables[e]=t}}const Zi=[4],Vi=[5],zi=[6],_i=[7],$i=[8],Aa=[12,35],ea=[14],ta=[21],ia=[22],aa=[30],sa=[31];class Type1CharString{constructor(){this.width=0;this.lsb=0;this.flexing=!1;this.output=[];this.stack=[]}convert(e,t,i){const a=e.length;let s,r,n,g=!1;for(let o=0;oa)return!0;const s=a-e;for(let e=s;e>8&255,255&t);else{t=65536*t|0;this.output.push(255,t>>24&255,t>>16&255,t>>8&255,255&t)}}this.output.push(...t);i?this.stack.splice(s,e):this.stack.length=0;return!1}}function isHexDigit(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function decrypt(e,t,i){if(i>=e.length)return new Uint8Array(0);let a,s,r=0|t;for(a=0;a>8;r=52845*(t+r)+22719&65535}return g}function isSpecial(e){return 47===e||91===e||93===e||123===e||125===e||40===e||41===e}class Type1Parser{constructor(e,t,i){if(t){const t=e.getBytes(),i=!((isHexDigit(t[0])||isWhiteSpace(t[0]))&&isHexDigit(t[1])&&isHexDigit(t[2])&&isHexDigit(t[3])&&isHexDigit(t[4])&&isHexDigit(t[5])&&isHexDigit(t[6])&&isHexDigit(t[7]));e=new Stream(i?decrypt(t,55665,4):function decryptAscii(e,t,i){let a=0|t;const s=e.length,r=new Uint8Array(s>>>1);let n,g;for(n=0,g=0;n>8;a=52845*(e+a)+22719&65535}}return r.slice(i,g)}(t,55665,4))}this.seacAnalysisEnabled=!!i;this.stream=e;this.nextChar()}readNumberArray(){this.getToken();const e=[];for(;;){const t=this.getToken();if(null===t||"]"===t||"}"===t)break;e.push(parseFloat(t||0))}return e}readNumber(){const e=this.getToken();return parseFloat(e||0)}readInt(){const e=this.getToken();return 0|parseInt(e||0,10)}readBoolean(){return"true"===this.getToken()?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){this.stream.skip(-2);return this.currentChar=this.stream.getByte()}getToken(){let e=!1,t=this.currentChar;for(;;){if(-1===t)return null;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!isWhiteSpace(t))break;t=this.nextChar()}if(isSpecial(t)){this.nextChar();return String.fromCharCode(t)}let i="";do{i+=String.fromCharCode(t);t=this.nextChar()}while(t>=0&&!isWhiteSpace(t)&&!isSpecial(t));return i}readCharStrings(e,t){return-1===t?e:decrypt(e,4330,t)}extractFontProgram(e){const t=this.stream,i=[],a=[],s=Object.create(null);s.lenIV=4;const r={subrs:[],charstrings:[],properties:{privateData:s}};let n,g,o,c;for(;null!==(n=this.getToken());)if("/"===n){n=this.getToken();switch(n){case"CharStrings":this.getToken();this.getToken();this.getToken();this.getToken();for(;;){n=this.getToken();if(null===n||"end"===n)break;if("/"!==n)continue;const e=this.getToken();g=this.readInt();this.getToken();o=g>0?t.getBytes(g):new Uint8Array(0);c=r.properties.privateData.lenIV;const i=this.readCharStrings(o,c);this.nextChar();n=this.getToken();"noaccess"===n?this.getToken():"/"===n&&this.prevChar();a.push({glyph:e,encoded:i})}break;case"Subrs":this.readInt();this.getToken();for(;"dup"===this.getToken();){const e=this.readInt();g=this.readInt();this.getToken();o=g>0?t.getBytes(g):new Uint8Array(0);c=r.properties.privateData.lenIV;const a=this.readCharStrings(o,c);this.nextChar();n=this.getToken();"noaccess"===n&&this.getToken();i[e]=a}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":const e=this.readNumberArray();e.length>0&&e.length,0;break;case"StemSnapH":case"StemSnapV":r.properties.privateData[n]=this.readNumberArray();break;case"StdHW":case"StdVW":r.properties.privateData[n]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":r.properties.privateData[n]=this.readNumber();break;case"ExpansionFactor":r.properties.privateData[n]=this.readNumber()||.06;break;case"ForceBold":r.properties.privateData[n]=this.readBoolean()}}for(const{encoded:t,glyph:s}of a){const a=new Type1CharString,n=a.convert(t,i,this.seacAnalysisEnabled);let g=a.output;n&&(g=[14]);const o={glyphName:s,charstring:g,width:a.width,lsb:a.lsb,seac:a.seac};".notdef"===s?r.charstrings.unshift(o):r.charstrings.push(o);if(e.builtInEncoding){const t=e.builtInEncoding.indexOf(s);t>-1&&void 0===e.widths[t]&&t>=e.firstChar&&t<=e.lastChar&&(e.widths[t]=a.width)}}return r}extractFontHeader(e){let t;for(;null!==(t=this.getToken());)if("/"===t){t=this.getToken();switch(t){case"FontMatrix":const i=this.readNumberArray();e.fontMatrix=i;break;case"Encoding":const a=this.getToken();let s;if(/^\\d+$/.test(a)){s=[];const e=0|parseInt(a,10);this.getToken();for(let i=0;i=s){n+=i;for(;n=0&&(a[e]=s)}}return type1FontGlyphMapping(e,a,i)}hasGlyphId(e){if(e<0||e>=this.numGlyphs)return!1;if(0===e)return!0;return this.charstrings[e-1].charstring.length>0}getSeacs(e){const t=[];for(let i=0,a=e.length;i0;e--)t[e]-=t[e-1];Q.setByName(e,t)}r.topDict.privateDict=Q;const u=new CFFIndex;for(C=0,h=a.length;C0&&e.toUnicode.amend(t)}class fonts_Glyph{constructor(e,t,i,a,s,r,n,g,o){this.originalCharCode=e;this.fontChar=t;this.unicode=i;this.accent=a;this.width=s;this.vmetric=r;this.operatorListId=n;this.isSpace=g;this.isInFont=o}get category(){return shadow(this,"category",function getCharUnicodeCategory(e){const t=ki.get(e);if(t)return t;const i=e.match(Si),a={isWhitespace:!!i?.[1],isZeroWidthDiacritic:!!i?.[2],isInvisibleFormatMark:!!i?.[3]};ki.set(e,a);return a}(this.unicode),!0)}}function int16(e,t){return(e<<8)+t}function writeSignedInt16(e,t,i){e[t+1]=i;e[t]=i>>>8}function signedInt16(e,t){const i=(e<<8)+t;return 32768&i?i-65536:i}function string16(e){return String.fromCharCode(e>>8&255,255&e)}function safeString16(e){e>32767?e=32767:e<-32768&&(e=-32768);return String.fromCharCode(e>>8&255,255&e)}function isTrueTypeCollectionFile(e){return"ttcf"===bytesToString(e.peekBytes(4))}function getFontFileType(e,{type:t,subtype:i,composite:a}){let s,r;if(function isTrueTypeFile(e){const t=e.peekBytes(4);return 65536===readUint32(t,0)||"true"===bytesToString(t)}(e)||isTrueTypeCollectionFile(e))s=a?"CIDFontType2":"TrueType";else if(function isOpenTypeFile(e){return"OTTO"===bytesToString(e.peekBytes(4))}(e))s=a?"CIDFontType2":"OpenType";else if(function isType1File(e){const t=e.peekBytes(2);return 37===t[0]&&33===t[1]||128===t[0]&&1===t[1]}(e))s=a?"CIDFontType0":"MMType1"===t?"MMType1":"Type1";else if(function isCFFFile(e){const t=e.peekBytes(4);return t[0]>=1&&t[3]>=1&&t[3]<=4}(e))if(a){s="CIDFontType0";r="CIDFontType0C"}else{s="MMType1"===t?"MMType1":"Type1";r="Type1C"}else{warn("getFontFileType: Unable to detect correct font file Type/Subtype.");s=t;r=i}return[s,r]}function applyStandardFontGlyphMap(e,t){for(const i in t)e[+i]=t[i]}function buildToFontChar(e,t,i){const a=[];let s;for(let i=0,r=e.length;iC){o++;if(o>=ra.length){warn("Ran out of space in font private use area.");break}c=ra[o][0];C=ra[o][1]}const E=c++;0===Q&&(Q=i);let u=a.get(l);"string"==typeof u&&(u=u.codePointAt(0));if(u&&!(h=u,ra[0][0]<=h&&h<=ra[0][1]||ra[1][0]<=h&&h<=ra[1][1])&&!g.has(Q)){r.set(u,Q);g.add(Q)}s[E]=Q;n[l]=E}var h;return{toFontChar:n,charCodeToGlyphId:s,toUnicodeExtraMap:r,nextAvailableFontCharCode:c}}function createCmapTable(e,t,i){const a=function getRanges(e,t,i){const a=[];for(const t in e)e[t]>=i||a.push({fontCharCode:0|t,glyphId:e[t]});if(t)for(const[e,s]of t)s>=i||a.push({fontCharCode:e,glyphId:s});0===a.length&&a.push({fontCharCode:0,glyphId:0});a.sort((function fontGetRangesSort(e,t){return e.fontCharCode-t.fontCharCode}));const s=[],r=a.length;for(let e=0;e65535?2:1;let r,n,g,o,c="\\0\\0"+string16(s)+"\\0\\0"+string32(4+8*s);for(r=a.length-1;r>=0&&!(a[r][0]<=65535);--r);const C=r+1;a[r][0]<65535&&65535===a[r][1]&&(a[r][1]=65534);const h=a[r][1]<65535?1:0,l=C+h,Q=OpenTypeFileBuilder.getSearchParams(l,2);let E,u,d,f,p="",m="",y="",w="",D="",b=0;for(r=0,n=C;r0){m+="ÿÿ";p+="ÿÿ";y+="\\0";w+="\\0\\0"}const F="\\0\\0"+string16(2*l)+string16(Q.range)+string16(Q.entry)+string16(Q.rangeShift)+m+"\\0\\0"+p+y+w+D;let S="",k="";if(s>1){c+="\\0\\0\\n"+string32(4+8*s+4+F.length);S="";for(r=0,n=a.length;re||!g)&&(g=e);o 123 are reserved for internal usage");n|=1<65535&&(o=65535)}else{g=0;o=255}const C=e.bbox||[0,0,0,0],h=i.unitsPerEm||(e.fontMatrix?1/Math.max(...e.fontMatrix.slice(0,4).map(Math.abs)):1e3),l=e.ascentScaled?1:h/na,Q=i.ascent||Math.round(l*(e.ascent||C[3]));let E=i.descent||Math.round(l*(e.descent||C[1]));E>0&&e.descent>0&&C[1]<0&&(E=-E);const u=i.yMax||Q,d=-i.yMin||-E;return"\\0$ô\\0\\0\\0Š»\\0\\0\\0ŒŠ»\\0\\0ß\\x001\\0\\0\\0\\0"+String.fromCharCode(e.fixedPitch?9:0)+"\\0\\0\\0\\0\\0\\0"+string32(a)+string32(s)+string32(r)+string32(n)+"*21*"+string16(e.italicAngle?1:0)+string16(g||e.firstChar)+string16(o||e.lastChar)+string16(Q)+string16(E)+"\\0d"+string16(u)+string16(d)+"\\0\\0\\0\\0\\0\\0\\0\\0"+string16(e.xHeight)+string16(e.capHeight)+string16(0)+string16(g||e.firstChar)+"\\0"}function createPostTable(e){return"\\0\\0\\0"+string32(Math.floor(65536*e.italicAngle))+"\\0\\0\\0\\0"+string32(e.fixedPitch?1:0)+"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"}function createPostscriptName(e){return e.replaceAll(/[^\\x21-\\x7E]|[[\\](){}<>/%]/g,"").slice(0,63)}function createNameTable(e,t){t||(t=[[],[]]);const i=[t[0][0]||"Original licence",t[0][1]||e,t[0][2]||"Unknown",t[0][3]||"uniqueID",t[0][4]||e,t[0][5]||"Version 0.11",t[0][6]||createPostscriptName(e),t[0][7]||"Unknown",t[0][8]||"Unknown",t[0][9]||"Unknown"],a=[];let s,r,n,g,o;for(s=0,r=i.length;s0;if((n||g)&&"CIDFontType2"===i&&this.cidEncoding.startsWith("Identity-")){const i=e.cidToGidMap,a=[];applyStandardFontGlyphMap(a,Oi());/Arial-?Black/i.test(t)?applyStandardFontGlyphMap(a,Pi()):/Calibri/i.test(t)&&applyStandardFontGlyphMap(a,Wi());if(i){for(const e in a){const t=a[e];void 0!==i[t]&&(a[+e]=i[t])}i.length!==this.toUnicode.length&&e.hasIncludedToUnicodeMap&&this.toUnicode instanceof IdentityToUnicodeMap&&this.toUnicode.forEach((function(e,t){const s=a[e];void 0===i[s]&&(a[+e]=t)}))}this.toUnicode instanceof IdentityToUnicodeMap||this.toUnicode.forEach((function(e,t){a[+e]=t}));this.toFontChar=a;this.toUnicode=new ToUnicodeMap(a)}else if(/Symbol/i.test(a))this.toFontChar=buildToFontChar(Bi,wi(),this.differences);else if(/Dingbats/i.test(a))this.toFontChar=buildToFontChar(Qi,Di(),this.differences);else if(n||g){const e=buildToFontChar(this.defaultEncoding,wi(),this.differences);"CIDFontType2"!==i||this.cidEncoding.startsWith("Identity-")||this.toUnicode instanceof IdentityToUnicodeMap||this.toUnicode.forEach((function(t,i){e[+t]=i}));this.toFontChar=e}else{const e=wi(),i=[];this.toUnicode.forEach(((t,a)=>{if(!this.composite){const i=getUnicodeForGlyph(this.differences[t]||this.defaultEncoding[t],e);-1!==i&&(a=i)}i[+t]=a}));this.composite&&this.toUnicode instanceof IdentityToUnicodeMap&&/Tahoma|Verdana/i.test(t)&&applyStandardFontGlyphMap(i,Oi());this.toFontChar=i}amendFallbackToUnicode(e);this.loadedName=a.split("-",1)[0]}checkAndRepair(e,t,i){const a=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function readTables(e,t){const i=Object.create(null);i["OS/2"]=null;i.cmap=null;i.head=null;i.hhea=null;i.hmtx=null;i.maxp=null;i.name=null;i.post=null;for(let s=0;s>>0,a=e.getInt32()>>>0,s=e.getInt32()>>>0,r=e.pos;e.pos=e.start||0;e.skip(a);const n=e.getBytes(s);e.pos=r;if("head"===t){n[8]=n[9]=n[10]=n[11]=0;n[17]|=32}return{tag:t,checksum:i,length:s,offset:a,data:n}}function readOpenTypeHeader(e){return{version:e.getString(4),numTables:e.getUint16(),searchRange:e.getUint16(),entrySelector:e.getUint16(),rangeShift:e.getUint16()}}function sanitizeGlyph(e,t,i,a,s,r){const n={length:0,sizeOfInstructions:0};if(t<0||t>=e.length||i>e.length||i-t<=12)return n;const g=e.subarray(t,i),o=signedInt16(g[2],g[3]),c=signedInt16(g[4],g[5]),C=signedInt16(g[6],g[7]),h=signedInt16(g[8],g[9]);if(o>C){writeSignedInt16(g,2,C);writeSignedInt16(g,6,o)}if(c>h){writeSignedInt16(g,4,h);writeSignedInt16(g,8,c)}const l=signedInt16(g[0],g[1]);if(l<0){if(l<-1)return n;a.set(g,s);n.length=g.length;return n}let Q,E=10,u=0;for(Q=0;Qg.length)return n;if(!r&&f>0){a.set(g.subarray(0,d),s);a.set([0,0],s+d);a.set(g.subarray(p,y),s+d+2);y-=f;g.length-y>3&&(y=y+3&-4);n.length=y;return n}if(g.length-y>3){y=y+3&-4;a.set(g.subarray(0,y),s);n.length=y;return n}a.set(g,s);n.length=g.length;return n}function readNameTable(e){const i=(t.start||0)+e.offset;t.pos=i;const a=[[],[]],s=[],r=e.length,n=i+r;if(0!==t.getUint16()||r<6)return[a,s];const g=t.getUint16(),o=t.getUint16();let c,C;for(c=0;cn)continue;t.pos=r;const g=e.name;if(e.encoding){let i="";for(let a=0,s=e.length;a0&&(c+=e-1)}}else{if(d||p){warn("TT: nested FDEFs not allowed");u=!0}d=!0;h=c;n=l.pop();t.functionsDefined[n]={data:o,i:c}}else if(!d&&!p){n=l.at(-1);if(isNaN(n))info("TT: CALL empty stack (or invalid entry).");else{t.functionsUsed[n]=!0;if(n in t.functionsStackDeltas){const e=l.length+t.functionsStackDeltas[n];if(e<0){warn("TT: CALL invalid functions stack delta.");t.hintsValid=!1;return}l.length=e}else if(n in t.functionsDefined&&!E.includes(n)){Q.push({data:o,i:c,stackTop:l.length-1});E.push(n);g=t.functionsDefined[n];if(!g){warn("TT: CALL non-existent function");t.hintsValid=!1;return}o=g.data;c=g.i}}}if(!d&&!p){let t=0;e<=142?t=s[e]:e>=192&&e<=223?t=-1:e>=224&&(t=-2);if(e>=113&&e<=117){a=l.pop();isNaN(a)||(t=2*-a)}for(;t<0&&l.length>0;){l.pop();t++}for(;t>0;){l.push(NaN);t--}}}t.tooComplexToFollowFunctions=u;const m=[o];c>o.length&&m.push(new Uint8Array(c-o.length));if(h>C){warn("TT: complementing a missing function tail");m.push(new Uint8Array([34,45]))}!function foldTTTable(e,t){if(t.length>1){let i,a,s=0;for(i=0,a=t.length;i>>0,r=[];for(let t=0;t>>0);const n={ttcTag:t,majorVersion:i,minorVersion:a,numFonts:s,offsetTable:r};switch(i){case 1:return n;case 2:n.dsigTag=e.getInt32()>>>0;n.dsigLength=e.getInt32()>>>0;n.dsigOffset=e.getInt32()>>>0;return n}throw new FormatError(`Invalid TrueType Collection majorVersion: ${i}.`)}(e),s=t.split("+");let r;for(let n=0;n0||!(i.cMap instanceof IdentityCMap));if("OTTO"===r.version&&!t||!n.head||!n.hhea||!n.maxp||!n.post){o=new Stream(n["CFF "].data);g=new CFFFont(o,i);adjustWidths(i);return this.convert(e,g,i)}delete n.glyf;delete n.loca;delete n.fpgm;delete n.prep;delete n["cvt "];this.isOpenType=!0}if(!n.maxp)throw new FormatError(\'Required "maxp" table is not found\');t.pos=(t.start||0)+n.maxp.offset;let C=t.getInt32();const h=t.getUint16();if(65536!==C&&20480!==C){if(6===n.maxp.length)C=20480;else{if(!(n.maxp.length>=32))throw new FormatError(\'"maxp" table has a wrong version number\');C=65536}!function writeUint32(e,t,i){e[t+3]=255&i;e[t+2]=i>>>8;e[t+1]=i>>>16;e[t]=i>>>24}(n.maxp.data,0,C)}if(i.scaleFactors?.length===h&&c){const{scaleFactors:e}=i,t=int16(n.head.data[50],n.head.data[51]),a=new GlyfTable({glyfTable:n.glyf.data,isGlyphLocationsLong:t,locaTable:n.loca.data,numGlyphs:h});a.scale(e);const{glyf:s,loca:r,isLocationLong:g}=a.write();n.glyf.data=s;n.loca.data=r;if(g!==!!t){n.head.data[50]=0;n.head.data[51]=g?1:0}const o=n.hmtx.data;for(let t=0;t>8&255;o[i+1]=255&a;writeSignedInt16(o,i+2,Math.round(e[t]*signedInt16(o[i+2],o[i+3])))}}let l=h+1,Q=!0;if(l>65535){Q=!1;l=h;warn("Not enough space in glyfs to duplicate first glyph.")}let E=0,u=0;if(C>=65536&&n.maxp.length>=32){t.pos+=8;if(t.getUint16()>2){n.maxp.data[14]=0;n.maxp.data[15]=2}t.pos+=4;E=t.getUint16();t.pos+=4;u=t.getUint16()}n.maxp.data[4]=l>>8;n.maxp.data[5]=255&l;const d=function sanitizeTTPrograms(e,t,i,a){const s={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};e&&sanitizeTTProgram(e,s);t&&sanitizeTTProgram(t,s);e&&function checkInvalidFunctions(e,t){if(!e.tooComplexToFollowFunctions)if(e.functionsDefined.length>t){warn("TT: more functions defined than expected");e.hintsValid=!1}else for(let i=0,a=e.functionsUsed.length;it){warn("TT: invalid function id: "+i);e.hintsValid=!1;return}if(e.functionsUsed[i]&&!e.functionsDefined[i]){warn("TT: undefined function: "+i);e.hintsValid=!1;return}}}(s,a);if(i&&1&i.length){const e=new Uint8Array(i.length+1);e.set(i.data);i.data=e}return s.hintsValid}(n.fpgm,n.prep,n["cvt "],E);if(!d){delete n.fpgm;delete n.prep;delete n["cvt "]}!function sanitizeMetrics(e,t,i,a,s,r){if(!t){i&&(i.data=null);return}e.pos=(e.start||0)+t.offset;e.pos+=4;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;const n=e.getUint16();e.pos+=8;e.pos+=2;let g=e.getUint16();if(0!==n){if(!(2&int16(a.data[44],a.data[45]))){t.data[22]=0;t.data[23]=0}}if(g>s){info(`The numOfMetrics (${g}) should not be greater than the numGlyphs (${s}).`);g=s;t.data[34]=(65280&g)>>8;t.data[35]=255&g}const o=s-g-(i.length-4*g>>1);if(o>0){const e=new Uint8Array(i.length+2*o);e.set(i.data);if(r){e[i.length]=i.data[2];e[i.length+1]=i.data[3]}i.data=e}}(t,n.hhea,n.hmtx,n.head,l,Q);if(!n.head)throw new FormatError(\'Required "head" table is not found\');!function sanitizeHead(e,t,i){const a=e.data,s=function int32(e,t,i,a){return(e<<24)+(t<<16)+(i<<8)+a}(a[0],a[1],a[2],a[3]);if(s>>16!=1){info("Attempting to fix invalid version in head table: "+s);a[0]=0;a[1]=1;a[2]=0;a[3]=0}const r=int16(a[50],a[51]);if(r<0||r>1){info("Attempting to fix invalid indexToLocFormat in head table: "+r);const e=t+1;if(i===e<<1){a[50]=0;a[51]=0}else{if(i!==e<<2)throw new FormatError("Could not fix indexToLocFormat: "+r);a[50]=0;a[51]=1}}}(n.head,h,c?n.loca.length:0);let f=Object.create(null);if(c){const e=int16(n.head.data[50],n.head.data[51]),t=function sanitizeGlyphLocations(e,t,i,a,s,r,n){let g,o,c;if(a){g=4;o=function fontItemDecodeLong(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};c=function fontItemEncodeLong(e,t,i){e[t]=i>>>24&255;e[t+1]=i>>16&255;e[t+2]=i>>8&255;e[t+3]=255&i}}else{g=2;o=function fontItemDecode(e,t){return e[t]<<9|e[t+1]<<1};c=function fontItemEncode(e,t,i){e[t]=i>>9&255;e[t+1]=i>>1&255}}const C=r?i+1:i,h=g*(1+C),l=new Uint8Array(h);l.set(e.data.subarray(0,h));e.data=l;const Q=t.data,E=Q.length,u=new Uint8Array(E);let d,f;const p=[];for(d=0,f=0;dE&&(e=E);p.push({index:d,offset:e,endOffset:0})}p.sort(((e,t)=>e.offset-t.offset));for(d=0;de.index-t.index));for(d=0;dn&&(n=e.sizeOfInstructions);w+=t;c(l,f,w)}if(0===w){const e=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(d=0,f=g;di+w)t.data=u.subarray(0,i+w);else{t.data=new Uint8Array(i+w);t.data.set(u.subarray(0,w))}t.data.set(u.subarray(0,i),w);c(e.data,l.length-g,w+i)}else t.data=u.subarray(0,w);return{missingGlyphs:y,maxSizeOfInstructions:n}}(n.loca,n.glyf,h,e,d,Q,u);f=t.missingGlyphs;if(C>=65536&&n.maxp.length>=32){n.maxp.data[26]=t.maxSizeOfInstructions>>8;n.maxp.data[27]=255&t.maxSizeOfInstructions}}if(!n.hhea)throw new FormatError(\'Required "hhea" table is not found\');if(0===n.hhea.data[10]&&0===n.hhea.data[11]){n.hhea.data[10]=255;n.hhea.data[11]=255}const p={unitsPerEm:int16(n.head.data[18],n.head.data[19]),yMax:signedInt16(n.head.data[42],n.head.data[43]),yMin:signedInt16(n.head.data[38],n.head.data[39]),ascent:signedInt16(n.hhea.data[4],n.hhea.data[5]),descent:signedInt16(n.hhea.data[6],n.hhea.data[7]),lineGap:signedInt16(n.hhea.data[8],n.hhea.data[9])};this.ascent=p.ascent/p.unitsPerEm;this.descent=p.descent/p.unitsPerEm;this.lineGap=p.lineGap/p.unitsPerEm;if(this.cssFontInfo?.lineHeight){this.lineHeight=this.cssFontInfo.metrics.lineHeight;this.lineGap=this.cssFontInfo.metrics.lineGap}else this.lineHeight=this.ascent-this.descent+this.lineGap;n.post&&function readPostScriptTable(e,i,a){const s=(t.start||0)+e.offset;t.pos=s;const r=s+e.length,n=t.getInt32();t.skip(28);let g,o,c=!0;switch(n){case 65536:g=Hi;break;case 131072:const e=t.getUint16();if(e!==a){c=!1;break}const s=[];for(o=0;o=32768){c=!1;break}s.push(e)}if(!c)break;const C=[],h=[];for(;t.pos65535)throw new FormatError("Max size of CID is 65,535");let s=-1;t?s=a:void 0!==e[a]&&(s=e[a]);s>=0&&s>>0;let C=!1;if(g?.platformId!==s||g?.encodingId!==r){if(0!==s||0!==r&&1!==r&&3!==r)if(1===s&&0===r)C=!0;else if(3!==s||1!==r||!a&&g){if(i&&3===s&&0===r){C=!0;let i=!0;if(e>3;e.push(a);i=Math.max(a,i)}const a=[];for(let e=0;e<=i;e++)a.push({firstCode:t.getUint16(),entryCount:t.getUint16(),idDelta:signedInt16(t.getByte(),t.getByte()),idRangePos:t.pos+t.getUint16()});for(let i=0;i<256;i++)if(0===e[i]){t.pos=a[0].idRangePos+2*i;Q=t.getUint16();h.push({charCode:i,glyphId:Q})}else{const s=a[e[i]];for(l=0;l>1;t.skip(6);const i=[];let a;for(a=0;a>1)-(e-a);s.offsetIndex=n;g=Math.max(g,n+s.end-s.start+1)}else s.offsetIndex=-1}const o=[];for(l=0;l>>0;for(l=0;l>>0,i=t.getInt32()>>>0;let a=t.getInt32()>>>0;for(let t=e;t<=i;t++)h.push({charCode:t,glyphId:a++})}}}h.sort((function(e,t){return e.charCode-t.charCode}));for(let e=1;e=61440&&t<=61695&&(t&=255);m[t]=e.glyphId}else for(const e of r)m[e.charCode]=e.glyphId;if(i.glyphNames&&(g.length||this.differences.length))for(let e=0;e<256;++e){if(!o&&void 0!==m[e])continue;const t=this.differences[e]||g[e];if(!t)continue;const a=i.glyphNames.indexOf(t);a>0&&hasGlyph(a)&&(m[e]=a)}}0===m.length&&(m[0]=0);let y=l-1;Q||(y=0);if(!i.cssFontInfo){const e=adjustMapping(m,hasGlyph,y,this.toUnicode);this.toFontChar=e.toFontChar;n.cmap={tag:"cmap",data:createCmapTable(e.charCodeToGlyphId,e.toUnicodeExtraMap,l)};n["OS/2"]&&function validateOS2Table(e,t){t.pos=(t.start||0)+e.offset;const i=t.getUint16();t.skip(60);const a=t.getUint16();if(i<4&&768&a)return!1;if(t.getUint16()>t.getUint16())return!1;t.skip(6);if(0===t.getUint16())return!1;e.data[8]=e.data[9]=0;return!0}(n["OS/2"],t)||(n["OS/2"]={tag:"OS/2",data:createOS2Table(i,e.charCodeToGlyphId,p)})}if(!c)try{o=new Stream(n["CFF "].data);g=new CFFParser(o,i,Ri).parse();g.duplicateFirstGlyph();const e=new CFFCompiler(g);n["CFF "].data=e.compile()}catch{warn("Failed to compile font "+i.loadedName)}if(n.name){const[t,a]=readNameTable(n.name);n.name.data=createNameTable(e,t);this.psName=t[0][6]||null;i.composite||function adjustTrueTypeToUnicode(e,t,i){if(e.isInternalFont)return;if(e.hasIncludedToUnicodeMap)return;if(e.hasEncoding)return;if(e.toUnicode instanceof IdentityToUnicodeMap)return;if(!t)return;if(0===i.length)return;if(e.defaultEncoding===li)return;for(const e of i)if(!isWinNameRecord(e))return;const a=li,s=[],r=wi();for(const e in a){const t=a[e];if(""===t)continue;const i=r[t];void 0!==i&&(s[e]=String.fromCharCode(i))}s.length>0&&e.toUnicode.amend(s)}(i,this.isSymbolicFont,a)}else n.name={tag:"name",data:createNameTable(this.name)};const w=new OpenTypeFileBuilder(r.version);for(const e in n)w.addTable(e,n[e].data);return w.toArray()}convert(e,t,i){i.fixedPitch=!1;i.builtInEncoding&&function adjustType1ToUnicode(e,t){if(e.isInternalFont)return;if(e.hasIncludedToUnicodeMap)return;if(t===e.defaultEncoding)return;if(e.toUnicode instanceof IdentityToUnicodeMap)return;const i=[],a=wi();for(const s in t){if(e.hasEncoding&&(e.baseEncodingName||void 0!==e.differences[s]))continue;const r=getUnicodeForGlyph(t[s],a);-1!==r&&(i[s]=String.fromCharCode(r))}i.length>0&&e.toUnicode.amend(i)}(i,i.builtInEncoding);let s=1;t instanceof CFFFont&&(s=t.numGlyphs-1);const r=t.getGlyphMapping(i);let n=null,g=r,o=null;if(!i.cssFontInfo){n=adjustMapping(r,t.hasGlyphId.bind(t),s,this.toUnicode);this.toFontChar=n.toFontChar;g=n.charCodeToGlyphId;o=n.toUnicodeExtraMap}const c=t.numGlyphs;function getCharCodes(e,t){let i=null;for(const a in e)t===e[a]&&(i||=[]).push(0|a);return i}function createCharCode(e,t){for(const i in e)if(t===e[i])return 0|i;n.charCodeToGlyphId[n.nextAvailableFontCharCode]=t;return n.nextAvailableFontCharCode++}const C=t.seacs;if(n&&C?.length){const e=i.fontMatrix||a,s=t.getCharset(),g=Object.create(null);for(let t in C){t|=0;const i=C[t],a=hi[i[2]],o=hi[i[3]],c=s.indexOf(a),h=s.indexOf(o);if(c<0||h<0)continue;const l={x:i[0]*e[0]+i[1]*e[2]+e[4],y:i[0]*e[1]+i[1]*e[3]+e[5]},Q=getCharCodes(r,t);if(Q)for(const e of Q){const t=n.charCodeToGlyphId,i=createCharCode(t,c),a=createCharCode(t,h);g[e]={baseFontCharCode:i,accentFontCharCode:a,accentOffset:l}}}i.seacMap=g}const h=i.fontMatrix?1/Math.max(...i.fontMatrix.slice(0,4).map(Math.abs)):1e3,l=new OpenTypeFileBuilder("OTTO");l.addTable("CFF ",t.data);l.addTable("OS/2",createOS2Table(i,g));l.addTable("cmap",createCmapTable(g,o,c));l.addTable("head","\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0_<õ\\0\\0"+safeString16(h)+"\\0\\0\\0\\0ž\\v~\'\\0\\0\\0\\0ž\\v~\'\\0\\0"+safeString16(i.descent)+"ÿ"+safeString16(i.ascent)+string16(i.italicAngle?2:0)+"\\0\\0\\0\\0\\0\\0\\0");l.addTable("hhea","\\0\\0\\0"+safeString16(i.ascent)+safeString16(i.descent)+"\\0\\0ÿÿ\\0\\0\\0\\0\\0\\0"+safeString16(i.capHeight)+safeString16(Math.tan(i.italicAngle)*i.xHeight)+"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"+string16(c));l.addTable("hmtx",function fontFieldsHmtx(){const e=t.charstrings,i=t.cff?t.cff.widths:null;let a="\\0\\0\\0\\0";for(let t=1,s=c;t=65520&&e<=65535?0:e>=62976&&e<=63743?bi()[e]||e:173===e?45:e}(i)}this.isType3Font&&(s=i);let C=null;if(this.seacMap?.[e]){c=!0;const t=this.seacMap[e];i=t.baseFontCharCode;C={fontChar:String.fromCodePoint(t.accentFontCharCode),offset:t.accentOffset}}let h="";"number"==typeof i&&(i<=1114111?h=String.fromCodePoint(i):warn(`charToGlyph - invalid fontCharCode: ${i}`));if(this.missingFile&&this.vertical&&1===h.length){const e=Ji()[h.charCodeAt(0)];e&&(h=o=String.fromCharCode(e))}r=new fonts_Glyph(e,h,o,C,a,g,s,t,c);return this._glyphCache[e]=r}charsToGlyphs(e){let t=this._charsCache[e];if(t)return t;t=[];if(this.cMap){const i=Object.create(null),a=e.length;let s=0;for(;st.length%2==1,a=this.toUnicode instanceof IdentityToUnicodeMap?e=>this.toUnicode.charCodeOf(e):e=>this.toUnicode.charCodeOf(String.fromCodePoint(e));for(let s=0,r=e.length;s55295&&(r<57344||r>65533)&&s++;if(this.toUnicode){const e=a(r);if(-1!==e){if(hasCurrentBufErrors()){t.push(i.join(""));i.length=0}for(let t=(this.cMap?this.cMap.getCharCodeLength(e):1)-1;t>=0;t--)i.push(String.fromCharCode(e>>8*t&255));continue}}if(!hasCurrentBufErrors()){t.push(i.join(""));i.length=0}i.push(String.fromCodePoint(r))}t.push(i.join(""));return t}}class ErrorFont{constructor(e){this.error=e;this.loadedName="g_font_error";this.missingFile=!0}charsToGlyphs(){return[]}encodeString(e){return[e]}exportData(e=!1){return{error:this.error}}}const Ia=2,ca=3,Ca=4,ha=5,la=6,Ba=7;class Pattern{constructor(){unreachable("Cannot initialize Pattern.")}static parseShading(e,t,i,a,s){const r=e instanceof BaseStream?e.dict:e,n=r.get("ShadingType");try{switch(n){case Ia:case ca:return new RadialAxialShading(r,t,i,a,s);case Ca:case ha:case la:case Ba:return new MeshShading(e,t,i,a,s);default:throw new FormatError("Unsupported ShadingType: "+n)}}catch(e){if(e instanceof MissingDataException)throw e;warn(e);return new DummyShading}}}class BaseShading{static SMALL_NUMBER=1e-6;getIR(){unreachable("Abstract method `getIR` called.")}}class RadialAxialShading extends BaseShading{constructor(e,t,i,a,s){super();this.shadingType=e.get("ShadingType");let r=0;this.shadingType===Ia?r=4:this.shadingType===ca&&(r=6);this.coordsArr=e.getArray("Coords");if(!isNumberArray(this.coordsArr,r))throw new FormatError("RadialAxialShading: Invalid /Coords array.");const n=ColorSpace.parse({cs:e.getRaw("CS")||e.getRaw("ColorSpace"),xref:t,resources:i,pdfFunctionFactory:a,localColorSpaceCache:s});this.bbox=lookupNormalRect(e.getArray("BBox"),null);let g=0,o=1;const c=e.getArray("Domain");isNumberArray(c,2)&&([g,o]=c);let C=!1,h=!1;const l=e.getArray("Extend");(function isBooleanArray(e,t){return Array.isArray(e)&&(null===t||e.length===t)&&e.every((e=>"boolean"==typeof e))})(l,2)&&([C,h]=l);if(!(this.shadingType!==ca||C&&h)){const[e,t,i,a,s,r]=this.coordsArr,n=Math.hypot(e-a,t-s);i<=r+n&&r<=i+n&&warn("Unsupported radial gradient.")}this.extendStart=C;this.extendEnd=h;const Q=e.getRaw("Function"),E=a.createFromArray(Q),u=(o-g)/840,d=this.colorStops=[];if(g>=o||u<=0){info("Bad shading domain.");return}const f=new Float32Array(n.numComps),p=new Float32Array(1);let m,y=0;p[0]=g;E(p,0,f,0);let w=n.getRgb(f,0);const D=Util.makeHexColor(w[0],w[1],w[2]);d.push([0,D]);let b=1;p[0]=g+u;E(p,0,f,0);let F=n.getRgb(f,0),S=F[0]-w[0]+1,k=F[1]-w[1]+1,R=F[2]-w[2]+1,N=F[0]-w[0]-1,G=F[1]-w[1]-1,M=F[2]-w[2]-1;for(let e=2;e<840;e++){p[0]=g+e*u;E(p,0,f,0);m=n.getRgb(f,0);const t=e-y;S=Math.min(S,(m[0]-w[0]+1)/t);k=Math.min(k,(m[1]-w[1]+1)/t);R=Math.min(R,(m[2]-w[2]+1)/t);N=Math.max(N,(m[0]-w[0]-1)/t);G=Math.max(G,(m[1]-w[1]-1)/t);M=Math.max(M,(m[2]-w[2]-1)/t);if(!(N<=S&&G<=k&&M<=R)){const e=Util.makeHexColor(F[0],F[1],F[2]);d.push([b/840,e]);S=m[0]-F[0]+1;k=m[1]-F[1]+1;R=m[2]-F[2]+1;N=m[0]-F[0]-1;G=m[1]-F[1]-1;M=m[2]-F[2]-1;y=b;w=F}b=e;F=m}const U=Util.makeHexColor(F[0],F[1],F[2]);d.push([1,U]);let x="transparent";if(e.has("Background")){m=n.getRgb(e.get("Background"),0);x=Util.makeHexColor(m[0],m[1],m[2])}if(!C){d.unshift([0,x]);d[1][0]+=BaseShading.SMALL_NUMBER}if(!h){d.at(-1)[0]-=BaseShading.SMALL_NUMBER;d.push([1,x])}this.colorStops=d}getIR(){const{coordsArr:e,shadingType:t}=this;let i,a,s,r,n;if(t===Ia){a=[e[0],e[1]];s=[e[2],e[3]];r=null;n=null;i="axial"}else if(t===ca){a=[e[0],e[1]];s=[e[3],e[4]];r=e[2];n=e[5];i="radial"}else unreachable(`getPattern type unknown: ${t}`);return["RadialAxial",i,this.bbox,this.colorStops,a,s,r,n]}}class MeshStreamReader{constructor(e,t){this.stream=e;this.context=t;this.buffer=0;this.bufferLength=0;const i=t.numComps;this.tmpCompsBuf=new Float32Array(i);const a=t.colorSpace.numComps;this.tmpCsCompsBuf=t.colorFn?new Float32Array(a):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos0)return!0;const e=this.stream.getByte();if(e<0)return!1;this.buffer=e;this.bufferLength=8;return!0}readBits(e){let t=this.buffer,i=this.bufferLength;if(32===e){if(0===i)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;t=t<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();const e=this.stream.getByte();this.buffer=e&(1<>i)>>>0}if(8===e&&0===i)return this.stream.getByte();for(;i>i}align(){this.buffer=0;this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){const e=this.context.bitsPerCoordinate,t=this.readBits(e),i=this.readBits(e),a=this.context.decode,s=e<32?1/((1<r?r:e;t=t>n?n:t;i=ie*s[t])):i;let n,g=-2;const o=[];for(const[e,t]of a.map(((e,t)=>[e,t])).sort((([e],[t])=>e-t)))if(-1!==e)if(e===g+1){n.push(r[t]);g+=1}else{g=e;n=[r[t]];o.push(e,n)}return o}(e),i=new Dict(null);i.set("BaseFont",Name.get(e));i.set("Type",Name.get("Font"));i.set("Subtype",Name.get("CIDFontType2"));i.set("Encoding",Name.get("Identity-H"));i.set("CIDToGIDMap",Name.get("Identity"));i.set("W",t);i.set("FirstChar",t[0]);i.set("LastChar",t.at(-2)+t.at(-1).length-1);const a=new Dict(null);i.set("FontDescriptor",a);const s=new Dict(null);s.set("Ordering","Identity");s.set("Registry","Adobe");s.set("Supplement",0);i.set("CIDSystemInfo",s);return i}class PostScriptParser{constructor(e){this.lexer=e;this.operators=[];this.token=null;this.prev=null}nextToken(){this.prev=this.token;this.token=this.lexer.getToken()}accept(e){if(this.token.type===e){this.nextToken();return!0}return!1}expect(e){if(this.accept(e))return!0;throw new FormatError(`Unexpected symbol: found ${this.token.type} expected ${e}.`)}parse(){this.nextToken();this.expect(as.LBRACE);this.parseBlock();this.expect(as.RBRACE);return this.operators}parseBlock(){for(;;)if(this.accept(as.NUMBER))this.operators.push(this.prev.value);else if(this.accept(as.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(as.LBRACE))return;this.parseCondition()}}parseCondition(){const e=this.operators.length;this.operators.push(null,null);this.parseBlock();this.expect(as.RBRACE);if(this.accept(as.IF)){this.operators[e]=this.operators.length;this.operators[e+1]="jz"}else{if(!this.accept(as.LBRACE))throw new FormatError("PS Function: error parsing conditional.");{const t=this.operators.length;this.operators.push(null,null);const i=this.operators.length;this.parseBlock();this.expect(as.RBRACE);this.expect(as.IFELSE);this.operators[t]=this.operators.length;this.operators[t+1]="j";this.operators[e]=i;this.operators[e+1]="jz"}}}}const as={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5};class PostScriptToken{static get opCache(){return shadow(this,"opCache",Object.create(null))}constructor(e,t){this.type=e;this.value=t}static getOperator(e){return PostScriptToken.opCache[e]||=new PostScriptToken(as.OPERATOR,e)}static get LBRACE(){return shadow(this,"LBRACE",new PostScriptToken(as.LBRACE,"{"))}static get RBRACE(){return shadow(this,"RBRACE",new PostScriptToken(as.RBRACE,"}"))}static get IF(){return shadow(this,"IF",new PostScriptToken(as.IF,"IF"))}static get IFELSE(){return shadow(this,"IFELSE",new PostScriptToken(as.IFELSE,"IFELSE"))}}class PostScriptLexer{constructor(e){this.stream=e;this.nextChar();this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let e=!1,t=this.currentChar;for(;;){if(t<0)return Bt;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!isWhiteSpace(t))break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new PostScriptToken(as.NUMBER,this.getNumber());case 123:this.nextChar();return PostScriptToken.LBRACE;case 125:this.nextChar();return PostScriptToken.RBRACE}const i=this.strBuf;i.length=0;i[0]=String.fromCharCode(t);for(;(t=this.nextChar())>=0&&(t>=65&&t<=90||t>=97&&t<=122);)i.push(String.fromCharCode(t));const a=i.join("");switch(a.toLowerCase()){case"if":return PostScriptToken.IF;case"ifelse":return PostScriptToken.IFELSE;default:return PostScriptToken.getOperator(a)}}getNumber(){let e=this.currentChar;const t=this.strBuf;t.length=0;t[0]=String.fromCharCode(e);for(;(e=this.nextChar())>=0&&(e>=48&&e<=57||45===e||46===e);)t.push(String.fromCharCode(e));const i=parseFloat(t.join(""));if(isNaN(i))throw new FormatError(`Invalid floating point number: ${i}`);return i}}class BaseLocalCache{constructor(e){this._onlyRefs=!0===e?.onlyRefs;if(!this._onlyRefs){this._nameRefMap=new Map;this._imageMap=new Map}this._imageCache=new RefSetCache}getByName(e){this._onlyRefs&&unreachable("Should not call `getByName` method.");const t=this._nameRefMap.get(e);return t?this.getByRef(t):this._imageMap.get(e)||null}getByRef(e){return this._imageCache.get(e)||null}set(e,t,i){unreachable("Abstract method `set` called.")}}class LocalImageCache extends BaseLocalCache{set(e,t=null,i){if("string"!=typeof e)throw new Error(\'LocalImageCache.set - expected "name" argument.\');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(e,t);this._imageCache.put(t,i)}else this._imageMap.has(e)||this._imageMap.set(e,i)}}class LocalColorSpaceCache extends BaseLocalCache{set(e=null,t=null,i){if("string"!=typeof e&&!t)throw new Error(\'LocalColorSpaceCache.set - expected "name" and/or "ref" argument.\');if(t){if(this._imageCache.has(t))return;null!==e&&this._nameRefMap.set(e,t);this._imageCache.put(t,i)}else this._imageMap.has(e)||this._imageMap.set(e,i)}}class LocalFunctionCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,i){if(!t)throw new Error(\'LocalFunctionCache.set - expected "ref" argument.\');this._imageCache.has(t)||this._imageCache.put(t,i)}}class LocalGStateCache extends BaseLocalCache{set(e,t=null,i){if("string"!=typeof e)throw new Error(\'LocalGStateCache.set - expected "name" argument.\');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(e,t);this._imageCache.put(t,i)}else this._imageMap.has(e)||this._imageMap.set(e,i)}}class LocalTilingPatternCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,i){if(!t)throw new Error(\'LocalTilingPatternCache.set - expected "ref" argument.\');this._imageCache.has(t)||this._imageCache.put(t,i)}}class RegionalImageCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,i){if(!t)throw new Error(\'RegionalImageCache.set - expected "ref" argument.\');this._imageCache.has(t)||this._imageCache.put(t,i)}}class GlobalImageCache{static NUM_PAGES_THRESHOLD=2;static MIN_IMAGES_TO_CACHE=10;static MAX_BYTE_SIZE=5e7;#F=new RefSet;constructor(){this._refCache=new RefSetCache;this._imageCache=new RefSetCache}get#S(){let e=0;for(const t of this._imageCache)e+=t.byteSize;return e}get#k(){return!(this._imageCache.size+e)):null}class PDFFunction{static getSampleArray(e,t,i,a){let s,r,n=1;for(s=0,r=e.length;s>o)*C;c&=(1<i?e=i:e0&&(l=r[h-1]);let Q=a[1];h>1,c=s.length>>1,C=new PostScriptEvaluator(g),h=Object.create(null);let l=8192;const Q=new Float32Array(c);return function constructPostScriptFn(e,t,i,a){let s,n,g="";const E=Q;for(s=0;se&&(n=e)}d[s]=n}if(l>0){l--;h[g]=d}i.set(d,a)}}}function isPDFFunction(e){let t;if(e instanceof Dict)t=e;else{if(!(e instanceof BaseStream))return!1;t=e.dict}return t.has("FunctionType")}class PostScriptStack{static MAX_STACK_SIZE=100;constructor(e){this.stack=e?Array.from(e):[]}push(e){if(this.stack.length>=PostScriptStack.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(e)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(e){if(this.stack.length+e>=PostScriptStack.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");const t=this.stack;for(let i=t.length-e,a=e-1;a>=0;a--,i++)t.push(t[i])}index(e){this.push(this.stack[this.stack.length-e-1])}roll(e,t){const i=this.stack,a=i.length-e,s=i.length-1,r=a+(t-Math.floor(t/e)*e);for(let e=a,t=s;e0?t.push(n<>g);break;case"ceiling":n=t.pop();t.push(Math.ceil(n));break;case"copy":n=t.pop();t.copy(n);break;case"cos":n=t.pop();t.push(Math.cos(n%360/180*Math.PI));break;case"cvi":n=0|t.pop();t.push(n);break;case"cvr":break;case"div":g=t.pop();n=t.pop();t.push(n/g);break;case"dup":t.copy(1);break;case"eq":g=t.pop();n=t.pop();t.push(n===g);break;case"exch":t.roll(2,1);break;case"exp":g=t.pop();n=t.pop();t.push(n**g);break;case"false":t.push(!1);break;case"floor":n=t.pop();t.push(Math.floor(n));break;case"ge":g=t.pop();n=t.pop();t.push(n>=g);break;case"gt":g=t.pop();n=t.pop();t.push(n>g);break;case"idiv":g=t.pop();n=t.pop();t.push(n/g|0);break;case"index":n=t.pop();t.index(n);break;case"le":g=t.pop();n=t.pop();t.push(n<=g);break;case"ln":n=t.pop();t.push(Math.log(n));break;case"log":n=t.pop();t.push(Math.log10(n));break;case"lt":g=t.pop();n=t.pop();t.push(n=t?new AstLiteral(t):e.max<=t?e:new AstMin(e,t)}class PostScriptCompiler{compile(e,t,i){const a=[],s=[],r=t.length>>1,n=i.length>>1;let g,o,c,C,h,l,Q,E,u=0;for(let e=0;et.min){g.unshift("Math.max(",r,", ");g.push(")")}if(n4){a=!0;t=0}else{a=!1;t=1}const o=[];for(r=0;r=0&&"ET"===gs[e];--e)gs[e]="EN";for(let e=r+1;e0&&(t=gs[r-1]);let i=h;e+1E&&isOdd(E)&&(d=E)}for(E=u;E>=d;--E){let e=-1;for(r=0,n=o.length;r=0){reverseValues(ns,e,r);e=-1}}else e<0&&(e=r);e>=0&&reverseValues(ns,e,o.length)}for(r=0,n=ns.length;r"!==e||(ns[r]="")}return createBidiText(ns.join(""),a)}const os={style:"normal",weight:"normal"},Is={style:"normal",weight:"bold"},cs={style:"italic",weight:"normal"},Cs={style:"italic",weight:"bold"},hs=new Map([["Times-Roman",{local:["Times New Roman","Times-Roman","Times","Liberation Serif","Nimbus Roman","Nimbus Roman L","Tinos","Thorndale","TeX Gyre Termes","FreeSerif","Linux Libertine O","Libertinus Serif","DejaVu Serif","Bitstream Vera Serif","Ubuntu"],style:os,ultimate:"serif"}],["Times-Bold",{alias:"Times-Roman",style:Is,ultimate:"serif"}],["Times-Italic",{alias:"Times-Roman",style:cs,ultimate:"serif"}],["Times-BoldItalic",{alias:"Times-Roman",style:Cs,ultimate:"serif"}],["Helvetica",{local:["Helvetica","Helvetica Neue","Arial","Arial Nova","Liberation Sans","Arimo","Nimbus Sans","Nimbus Sans L","A030","TeX Gyre Heros","FreeSans","DejaVu Sans","Albany","Bitstream Vera Sans","Arial Unicode MS","Microsoft Sans Serif","Apple Symbols","Cantarell"],path:"LiberationSans-Regular.ttf",style:os,ultimate:"sans-serif"}],["Helvetica-Bold",{alias:"Helvetica",path:"LiberationSans-Bold.ttf",style:Is,ultimate:"sans-serif"}],["Helvetica-Oblique",{alias:"Helvetica",path:"LiberationSans-Italic.ttf",style:cs,ultimate:"sans-serif"}],["Helvetica-BoldOblique",{alias:"Helvetica",path:"LiberationSans-BoldItalic.ttf",style:Cs,ultimate:"sans-serif"}],["Courier",{local:["Courier","Courier New","Liberation Mono","Nimbus Mono","Nimbus Mono L","Cousine","Cumberland","TeX Gyre Cursor","FreeMono","Linux Libertine Mono O","Libertinus Mono"],style:os,ultimate:"monospace"}],["Courier-Bold",{alias:"Courier",style:Is,ultimate:"monospace"}],["Courier-Oblique",{alias:"Courier",style:cs,ultimate:"monospace"}],["Courier-BoldOblique",{alias:"Courier",style:Cs,ultimate:"monospace"}],["ArialBlack",{local:["Arial Black"],style:{style:"normal",weight:"900"},fallback:"Helvetica-Bold"}],["ArialBlack-Bold",{alias:"ArialBlack"}],["ArialBlack-Italic",{alias:"ArialBlack",style:{style:"italic",weight:"900"},fallback:"Helvetica-BoldOblique"}],["ArialBlack-BoldItalic",{alias:"ArialBlack-Italic"}],["ArialNarrow",{local:["Arial Narrow","Liberation Sans Narrow","Helvetica Condensed","Nimbus Sans Narrow","TeX Gyre Heros Cn"],style:os,fallback:"Helvetica"}],["ArialNarrow-Bold",{alias:"ArialNarrow",style:Is,fallback:"Helvetica-Bold"}],["ArialNarrow-Italic",{alias:"ArialNarrow",style:cs,fallback:"Helvetica-Oblique"}],["ArialNarrow-BoldItalic",{alias:"ArialNarrow",style:Cs,fallback:"Helvetica-BoldOblique"}],["Calibri",{local:["Calibri","Carlito"],style:os,fallback:"Helvetica"}],["Calibri-Bold",{alias:"Calibri",style:Is,fallback:"Helvetica-Bold"}],["Calibri-Italic",{alias:"Calibri",style:cs,fallback:"Helvetica-Oblique"}],["Calibri-BoldItalic",{alias:"Calibri",style:Cs,fallback:"Helvetica-BoldOblique"}],["Wingdings",{local:["Wingdings","URW Dingbats"],style:os}],["Wingdings-Regular",{alias:"Wingdings"}],["Wingdings-Bold",{alias:"Wingdings"}]]),ls=new Map([["Arial-Black","ArialBlack"]]);function getFamilyName(e){const t=new Set(["thin","extralight","ultralight","demilight","semilight","light","book","regular","normal","medium","demibold","semibold","bold","extrabold","ultrabold","black","heavy","extrablack","ultrablack","roman","italic","oblique","ultracondensed","extracondensed","condensed","semicondensed","normal","semiexpanded","expanded","extraexpanded","ultraexpanded","bolditalic"]);return e.split(/[- ,+]+/g).filter((e=>!t.has(e.toLowerCase()))).join(" ")}function generateFont({alias:e,local:t,path:i,fallback:a,style:s,ultimate:r},n,g,o=!0,c=!0,C=""){const h={style:null,ultimate:null};if(t){const e=C?` ${C}`:"";for(const i of t)n.push(`local(${i}${e})`)}if(e){const t=hs.get(e),r=C||function getStyleToAppend(e){switch(e){case Is:return"Bold";case cs:return"Italic";case Cs:return"Bold Italic";default:if("bold"===e?.weight)return"Bold";if("italic"===e?.style)return"Italic"}return""}(s);Object.assign(h,generateFont(t,n,g,o&&!a,c&&!i,r))}s&&(h.style=s);r&&(h.ultimate=r);if(o&&a){const e=hs.get(a),{ultimate:t}=generateFont(e,n,g,o,c&&!i,C);h.ultimate||=t}c&&i&&g&&n.push(`url(${g}${i})`);return h}function getFontSubstitution(e,t,i,a,s,r){if(a.startsWith("InvalidPDFjsFont_"))return null;"TrueType"!==r&&"Type1"!==r||!/^[A-Z]{6}\\+/.test(a)||(a=a.slice(7));const n=a=normalizeFontName(a);let g=e.get(n);if(g)return g;let o=hs.get(a);if(!o)for(const[e,t]of ls)if(a.startsWith(e)){a=`${t}${a.substring(e.length)}`;o=hs.get(a);break}let c=!1;if(!o){o=hs.get(s);c=!0}const C=`${t.getDocId()}_s${t.createFontId()}`;if(!o){if(!validateFontName(a)){warn(`Cannot substitute the font because of its name: ${a}`);e.set(n,null);return null}const t=/bold/gi.test(a),i=/oblique|italic/gi.test(a),s=t&&i&&Cs||t&&Is||i&&cs||os;g={css:`"${getFamilyName(a)}",${C}`,guessFallback:!0,loadedName:C,baseFontName:a,src:`local(${a})`,style:s};e.set(n,g);return g}const h=[];c&&validateFontName(a)&&h.push(`local(${a})`);const{style:l,ultimate:Q}=generateFont(o,h,i),E=null===Q,u=E?"":`,${Q}`;g={css:`"${getFamilyName(a)}",${C}${u}`,guessFallback:E,loadedName:C,baseFontName:a,src:h.join(","),style:l};e.set(n,g);return g}class ImageResizer{static#R=2048;static#y=FeatureTest.isImageDecoderSupported;constructor(e,t){this._imgData=e;this._isMask=t}static get canUseImageDecoder(){return shadow(this,"canUseImageDecoder",this.#y?ImageDecoder.isTypeSupported("image/bmp"):Promise.resolve(!1))}static needsToBeResized(e,t){if(e<=this.#R&&t<=this.#R)return!1;const{MAX_DIM:i}=this;if(e>i||t>i)return!0;const a=e*t;if(this._hasMaxArea)return a>this.MAX_AREA;if(a(this.MAX_AREA=this.#R**2)}static get MAX_DIM(){return shadow(this,"MAX_DIM",this._guessMax(2048,65537,0,1))}static get MAX_AREA(){this._hasMaxArea=!0;return shadow(this,"MAX_AREA",this._guessMax(this.#R,this.MAX_DIM,128,0)**2)}static set MAX_AREA(e){if(e>=0){this._hasMaxArea=!0;shadow(this,"MAX_AREA",e)}}static setOptions({canvasMaxAreaInBytes:e=-1,isImageDecoderSupported:t=!1}){this._hasMaxArea||(this.MAX_AREA=e>>2);this.#y=t}static _areGoodDims(e,t){try{const i=new OffscreenCanvas(e,t),a=i.getContext("2d");a.fillRect(0,0,1,1);const s=a.getImageData(0,0,1,1).data[3];i.width=i.height=1;return 0!==s}catch{return!1}}static _guessMax(e,t,i,a){for(;e+i+1pt){const e=this.#N();if(e)return e}const a=this._encodeBMP();let s,r;if(await ImageResizer.canUseImageDecoder){s=new ImageDecoder({data:a,type:"image/bmp",preferAnimation:!1,transfer:[a.buffer]});r=s.decode().catch((e=>{warn(`BMP image decoding failed: ${e}`);return createImageBitmap(new Blob([this._encodeBMP().buffer],{type:"image/bmp"}))})).finally((()=>{s.close()}))}else r=createImageBitmap(new Blob([a.buffer],{type:"image/bmp"}));const{MAX_AREA:n,MAX_DIM:g}=ImageResizer,o=Math.max(t/g,i/g,Math.sqrt(t*i/n)),c=Math.max(o,2),C=Math.round(10*(o+1.25))/10/c,h=Math.floor(Math.log2(C)),l=new Array(h+2).fill(2);l[0]=c;l.splice(-1,1,C/(1<>n,o=a>>n;let c,C=a;try{c=new Uint8Array(r)}catch{let e=Math.floor(Math.log2(r+1));for(;;)try{c=new Uint8Array(2**e-1);break}catch{e-=1}C=Math.floor((2**e-1)/(4*i));const t=i*C*4;t>n;e>3,n=i+3&-4;if(i!==n){const e=new Uint8Array(n*t);let a=0;for(let r=0,g=t*i;r>>8;t[i++]=255&s}}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice();i=t.byteLength}const a=i>>2,s=i-4*a,r=new Uint32Array(t.buffer,0,a);let n=0,g=0,o=this.h1,c=this.h2;const C=3432918353,h=461845907,l=11601,Q=13715;for(let e=0;e>>17;n=n*h&Qs|n*Q&Es;o^=n;o=o<<13|o>>>19;o=5*o+3864292196}else{g=r[e];g=g*C&Qs|g*l&Es;g=g<<15|g>>>17;g=g*h&Qs|g*Q&Es;c^=g;c=c<<13|c>>>19;c=5*c+3864292196}n=0;switch(s){case 3:n^=t[4*a+2]<<16;case 2:n^=t[4*a+1]<<8;case 1:n^=t[4*a];n=n*C&Qs|n*l&Es;n=n<<15|n>>>17;n=n*h&Qs|n*Q&Es;1&a?o^=n:c^=n}this.h1=o;this.h2=c}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&Qs|36045*e&Es;t=4283543511*t&Qs|(2950163797*(t<<16|e>>>16)&Qs)>>>16;e^=t>>>1;e=444984403*e&Qs|60499*e&Es;t=3301882366*t&Qs|(3120437893*(t<<16|e>>>16)&Qs)>>>16;e^=t>>>1;return(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}function addState(e,t,i,a,s){let r=e;for(let e=0,i=t.length-1;e1e3){c=Math.max(c,l);Q+=h+2;l=0;h=0}C.push({transform:t,x:l,y:Q,w:i.width,h:i.height});l+=i.width+2;h=Math.max(h,i.height)}const E=Math.max(c,l)+1,u=Q+h+1,d=new Uint8Array(E*u*4),f=E<<2;for(let e=0;e=0;){t[r-4]=t[r];t[r-3]=t[r+1];t[r-2]=t[r+2];t[r-1]=t[r+3];t[r+i]=t[r+i-4];t[r+i+1]=t[r+i-3];t[r+i+2]=t[r+i-2];t[r+i+3]=t[r+i-1];r-=f}}const p={width:E,height:u};if(e.isOffscreenCanvasSupported){const e=new OffscreenCanvas(E,u);e.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(d.buffer),E,u),0,0);p.bitmap=e.transferToImageBitmap();p.data=null}else{p.kind=S;p.data=d}i.splice(r,4*o,$e);a.splice(r,4*o,[p,C]);return r+1}));addState(us,[MA,xA,Ze,UA],null,(function iterateImageMaskGroup(e,t){const i=e.fnArray,a=(t-(e.iCurr-3))%4;switch(a){case 0:return i[t]===MA;case 1:return i[t]===xA;case 2:return i[t]===Ze;case 3:return i[t]===UA}throw new Error(`iterateImageMaskGroup - invalid pos: ${a}`)}),(function foundImageMaskGroup(e,t){const i=e.fnArray,a=e.argsArray,s=e.iCurr,r=s-3,n=s-2,g=s-1;let o=Math.floor((t-r)/4);if(o<10)return t-(t-r)%4;let c,C,h=!1;const l=a[g][0],Q=a[n][0],E=a[n][1],u=a[n][2],d=a[n][3];if(E===u){h=!0;c=n+4;let e=g+4;for(let t=1;t=4&&i[r-4]===i[n]&&i[r-3]===i[g]&&i[r-2]===i[o]&&i[r-1]===i[c]&&a[r-4][0]===C&&a[r-4][1]===h){l++;Q-=5}let E=Q+4;for(let e=1;e=i)break}a=(a||us)[e[t]];if(a&&!Array.isArray(a)){r.iCurr=t;t++;if(!a.checkFn||(0,a.checkFn)(r)){s=a;a=null}else a=null}else t++}this.state=a;this.match=s;this.lastProcessed=t}flush(){for(;this.match;){const e=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,e);this.match=null;this.state=null;this._optimize()}}reset(){this.state=null;this.match=null;this.lastProcessed=0}}class OperatorList{static CHUNK_SIZE=1e3;static CHUNK_SIZE_ABOUT=this.CHUNK_SIZE-5;constructor(e=0,t){this._streamSink=t;this.fnArray=[];this.argsArray=[];this.optimizer=!t||e&E?new NullOptimizer(this):new QueueOptimizer(this);this.dependencies=new Set;this._totalLength=0;this.weight=0;this._resolved=t?null:Promise.resolve()}set isOffscreenCanvasSupported(e){this.optimizer.isOffscreenCanvasSupported=e}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(e,t){this.optimizer.push(e,t);this.weight++;this._streamSink&&(this.weight>=OperatorList.CHUNK_SIZE||this.weight>=OperatorList.CHUNK_SIZE_ABOUT&&(e===UA||e===ee))&&this.flush()}addImageOps(e,t,i,a=!1){if(a){this.addOp(MA);this.addOp(GA,[[["SMask",!1]]])}void 0!==i&&this.addOp(Ye,["OC",i]);this.addOp(e,t);void 0!==i&&this.addOp(ve,[]);a&&this.addOp(UA)}addDependency(e){if(!this.dependencies.has(e)){this.dependencies.add(e);this.addOp(wA,[e])}}addDependencies(e){for(const t of e)this.addDependency(t)}addOpList(e){if(e instanceof OperatorList){for(const t of e.dependencies)this.dependencies.add(t);for(let t=0,i=e.length;ta&&(e=a);return e}function resizeImageMask(e,t,i,a,s,r){const n=s*r;let g;g=t<=8?new Uint8Array(n):t<=16?new Uint16Array(n):new Uint32Array(n);const o=i/s,c=a/r;let C,h,l,Q,E=0;const u=new Uint16Array(s),d=i;for(C=0;C0&&Number.isInteger(i.height)&&i.height>0&&(i.width!==l||i.height!==Q)){warn("PDFImage - using the Width/Height of the image data, rather than the image dictionary.");l=i.width;Q=i.height}if(l<1||Q<1)throw new FormatError(`Invalid image width: ${l} or height: ${Q}`);this.width=l;this.height=Q;this.interpolate=c.get("I","Interpolate");this.imageMask=c.get("IM","ImageMask")||!1;this.matte=c.get("Matte")||!1;let E=i.bitsPerComponent;if(!E){E=c.get("BPC","BitsPerComponent");if(!E){if(!this.imageMask)throw new FormatError(`Bits per component missing in image: ${this.imageMask}`);E=1}}this.bpc=E;if(!this.imageMask){let s=c.getRaw("CS")||c.getRaw("ColorSpace");const r=!!s;if(r)this.jpxDecoderOptions?.smaskInData&&(s=Name.get("DeviceRGBA"));else if(this.jpxDecoderOptions)s=Name.get("DeviceRGBA");else switch(i.numComps){case 1:s=Name.get("DeviceGray");break;case 3:s=Name.get("DeviceRGB");break;case 4:s=Name.get("DeviceCMYK");break;default:throw new Error(`Images with ${i.numComps} color components not supported.`)}this.colorSpace=ColorSpace.parse({cs:s,xref:e,resources:a?t:null,pdfFunctionFactory:g,localColorSpaceCache:o});this.numComps=this.colorSpace.numComps;if(this.jpxDecoderOptions){this.jpxDecoderOptions.numComponents=r?this.numComp:0;this.jpxDecoderOptions.isIndexedColormap="Indexed"===this.colorSpace.name}}this.decode=c.getArray("D","Decode");this.needsDecode=!1;if(this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,E)||n&&!ColorSpace.isDefaultDecode(this.decode,1))){this.needsDecode=!0;const e=(1<>3)*i,g=e.byteLength;let o,c;if(!a||s&&!(n===g))if(s){o=new Uint8Array(n);o.set(e);o.fill(255,g)}else o=new Uint8Array(e);else o=e;if(s)for(c=0;c>7&1;n[l+1]=h>>6&1;n[l+2]=h>>5&1;n[l+3]=h>>4&1;n[l+4]=h>>3&1;n[l+5]=h>>2&1;n[l+6]=h>>1&1;n[l+7]=1&h;l+=8}if(l>=1}}}}else{let i=0;h=0;for(l=0,C=r;l>a;s<0?s=0:s>c&&(s=c);n[l]=s;h&=(1<n[a+1]){t=255;break}}g[C]=t}}}if(g)for(C=0,l=3,h=t*a;C>3,C=t&&ImageResizer.needsToBeResized(i,a);if(!this.smask&&!this.mask&&"DeviceRGBA"===this.colorSpace.name){s.kind=S;const e=s.data=await this.getImageBytes(g*n*4,{});return t?C?ImageResizer.createImage(s,!1):this.createBitmap(S,i,a,e):s}if(!e){let e;"DeviceGray"===this.colorSpace.name&&1===o?e=b:"DeviceRGB"!==this.colorSpace.name||8!==o||this.needsDecode||(e=F);if(e&&!this.smask&&!this.mask&&i===n&&a===g){const r=await this.#G(n,g);if(r)return r;const o=await this.getImageBytes(g*c,{});if(t)return C?ImageResizer.createImage({data:o,kind:e,width:i,height:a,interpolate:this.interpolate},this.needsDecode):this.createBitmap(e,n,g,o);s.kind=e;s.data=o;if(this.needsDecode){assert(e===b,"PDFImage.createImageData: The image must be grayscale.");const t=s.data;for(let e=0,i=t.length;e>3,n=await this.getImageBytes(a*r,{internal:!0}),g=this.getComponents(n);let o,c;if(1===s){c=i*a;if(this.needsDecode)for(o=0;o0&&t.args[0].count++}class TimeSlotManager{static TIME_SLOT_DURATION_MS=20;static CHECK_TIME_EVERY=100;constructor(){this.reset()}check(){if(++this.checkedh){const e="Image exceeded maximum allowed size and was removed.";if(this.options.ignoreErrors){warn(e);return}throw new Error(e)}let l;g.has("OC")&&(l=await this.parseMarkedContentProps(g.get("OC"),e));let Q,E;if(g.get("IM","ImageMask")||!1){const e=g.get("I","Interpolate"),i=c+7>>3,n=t.getBytes(i*C),h=g.getArray("D","Decode");if(this.parsingType3Font){Q=PDFImage.createRawMask({imgArray:n,width:c,height:C,imageIsFromDecodeStream:t instanceof DecodeStream,inverseDecode:h?.[0]>0,interpolate:e});Q.cached=!!s;E=[Q];a.addImageOps(Ze,E,l);if(s){const e={fn:Ze,args:E,optionalContent:l};r.set(s,o,e);o&&this._regionalImageCache.set(null,o,e)}return}Q=await PDFImage.createMask({imgArray:n,width:c,height:C,imageIsFromDecodeStream:t instanceof DecodeStream,inverseDecode:h?.[0]>0,interpolate:e,isOffscreenCanvasSupported:this.options.isOffscreenCanvasSupported});if(Q.isSingleOpaquePixel){a.addImageOps(tt,[],l);if(s){const e={fn:tt,args:[],optionalContent:l};r.set(s,o,e);o&&this._regionalImageCache.set(null,o,e)}return}const u=`mask_${this.idFactory.createObjId()}`;a.addDependency(u);Q.dataLen=Q.bitmap?Q.width*Q.height*4:Q.data.length;this._sendImgData(u,Q);E=[{data:u,width:Q.width,height:Q.height,interpolate:Q.interpolate,count:1}];a.addImageOps(Ze,E,l);if(s){const e={objId:u,fn:Ze,args:E,optionalContent:l};r.set(s,o,e);o&&this._regionalImageCache.set(null,o,e)}return}const u=g.has("SMask")||g.has("Mask");if(i&&c+C<200&&!u){try{const s=new PDFImage({xref:this.xref,res:e,image:t,isInline:i,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n});Q=await s.createImageData(!0,!1);a.isOffscreenCanvasSupported=this.options.isOffscreenCanvasSupported;a.addImageOps(_e,[Q],l)}catch(e){const t=`Unable to decode inline image: "${e}".`;if(!this.options.ignoreErrors)throw new Error(t);warn(t)}return}let d=`img_${this.idFactory.createObjId()}`,f=!1;if(this.parsingType3Font)d=`${this.idFactory.getDocId()}_type3_${d}`;else if(s&&o){f=this.globalImageCache.shouldCache(o,this.pageIndex);if(f){assert(!i,"Cannot cache an inline image globally.");d=`${this.idFactory.getDocId()}_${d}`}}a.addDependency(d);E=[d,c,C];a.addImageOps(ze,E,l,u);if(f){if(this.globalImageCache.hasDecodeFailed(o)){this.globalImageCache.setData(o,{objId:d,fn:ze,args:E,optionalContent:l,hasMask:u,byteSize:0});this._sendImgData(d,null,f);return}if(c*C>25e4||u){const e=await this.handler.sendWithPromise("commonobj",[d,"CopyLocalImage",{imageRef:o}]);if(e){this.globalImageCache.setData(o,{objId:d,fn:ze,args:E,optionalContent:l,hasMask:u,byteSize:0});this.globalImageCache.addByteSize(o,e);return}}}PDFImage.buildImage({xref:this.xref,res:e,image:t,isInline:i,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n}).then((async e=>{Q=await e.createImageData(!1,this.options.isOffscreenCanvasSupported);Q.dataLen=Q.bitmap?Q.width*Q.height*4:Q.data.length;Q.ref=o;f&&this.globalImageCache.addByteSize(o,Q.dataLen);return this._sendImgData(d,Q,f)})).catch((e=>{warn(`Unable to decode image "${d}": "${e}".`);o&&this.globalImageCache.addDecodeFailed(o);return this._sendImgData(d,null,f)}));if(s){const e={objId:d,fn:ze,args:E,optionalContent:l,hasMask:u};r.set(s,o,e);if(o){this._regionalImageCache.set(null,o,e);f&&this.globalImageCache.setData(o,{objId:d,fn:ze,args:E,optionalContent:l,hasMask:u,byteSize:0})}}}handleSMask(e,t,i,a,s,r){const n=e.get("G"),g={subtype:e.get("S").name,backdrop:e.get("BC")},o=e.get("TR");if(isPDFFunction(o)){const e=this._pdfFunctionFactory.create(o),t=new Uint8Array(256),i=new Float32Array(1);for(let a=0;a<256;a++){i[0]=a/255;e(i,0,i,0);t[a]=255*i[0]|0}g.transferMap=t}return this.buildFormXObject(t,n,g,i,a,s.state.clone(),r)}handleTransferFunction(e){let t;if(Array.isArray(e))t=e;else{if(!isPDFFunction(e))return null;t=[e]}const i=[];let a=0,s=0;for(const e of t){const t=this.xref.fetchIfRef(e);a++;if(isName(t,"Identity")){i.push(null);continue}if(!isPDFFunction(t))return null;const r=this._pdfFunctionFactory.create(t),n=new Uint8Array(256),g=new Float32Array(1);for(let e=0;e<256;e++){g[0]=e/255;r(g,0,g,0);n[e]=255*g[0]|0}i.push(n);s++}return 1!==a&&4!==a||0===s?null:i}handleTilingType(e,t,i,a,s,r,n,g){const o=new OperatorList,c=Dict.merge({xref:this.xref,dictArray:[s.get("Resources"),i]});return this.getOperatorList({stream:a,task:n,resources:c,operatorList:o}).then((function(){const i=o.getIR(),a=getTilingPatternIR(i,s,t);r.addDependencies(o.dependencies);r.addOp(e,a);s.objId&&g.set(null,s.objId,{operatorListIR:i,dict:s})})).catch((e=>{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`handleTilingType - ignoring pattern: "${e}".`)}}))}async handleSetFont(e,t,i,a,s,r,n=null,g=null){const o=t?.[0]instanceof Name?t[0].name:null;let c=await this.loadFont(o,i,e,n,g);if(c.font.isType3Font)try{await c.loadType3Data(this,e,s);a.addDependencies(c.type3Dependencies)}catch(e){c=new TranslatedFont({loadedName:"g_font_error",font:new ErrorFont(`Type3 font load error: ${e}`),dict:c.font,evaluatorOptions:this.options})}r.font=c.font;c.send(this.handler);return c.loadedName}handleText(e,t){const i=t.font,a=i.charsToGlyphs(e);if(i.data){(!!(t.textRenderingMode&D)||"Pattern"===t.fillColorSpace.name||i.disableFontFace||this.options.disableFontFace)&&PartialEvaluator.buildFontPaths(i,a,this.handler,this.options)}return a}ensureStateFont(e){if(e.font)return;const t=new FormatError("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw t;warn(`ensureStateFont: "${t}".`)}async setGState({resources:e,gState:t,operatorList:i,cacheKey:a,task:s,stateManager:r,localGStateCache:n,localColorSpaceCache:g}){const o=t.objId;let c=!0;const C=[];let h=Promise.resolve();for(const a of t.getKeys()){const n=t.get(a);switch(a){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":C.push([a,n]);break;case"Font":c=!1;h=h.then((()=>this.handleSetFont(e,null,n[0],i,s,r.state).then((function(e){i.addDependency(e);C.push([a,[e,n[1]]])}))));break;case"BM":C.push([a,normalizeBlendMode(n)]);break;case"SMask":if(isName(n,"None")){C.push([a,!1]);break}if(n instanceof Dict){c=!1;h=h.then((()=>this.handleSMask(n,e,i,s,r,g)));C.push([a,!0])}else warn("Unsupported SMask type");break;case"TR":const t=this.handleTransferFunction(n);C.push([a,t]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":info("graphic state operator "+a);break;default:info("Unknown graphic state operator "+a)}}await h;C.length>0&&i.addOp(GA,[C]);c&&n.set(a,o,C)}loadFont(e,t,i,a=null,s=null){const errorFont=async()=>new TranslatedFont({loadedName:"g_font_error",font:new ErrorFont(`Font "${e}" is not available.`),dict:t,evaluatorOptions:this.options});let r;if(t)t instanceof Ref&&(r=t);else{const t=i.get("Font");t&&(r=t.getRaw(e))}if(r){if(this.type3FontRefs?.has(r))return errorFont();if(this.fontCache.has(r))return this.fontCache.get(r);try{t=this.xref.fetchIfRef(r)}catch(e){warn(`loadFont - lookup failed: "${e}".`)}}if(!(t instanceof Dict)){if(!this.options.ignoreErrors&&!this.parsingType3Font){warn(`Font "${e}" is not available.`);return errorFont()}warn(`Font "${e}" is not available -- attempting to fallback to a default font.`);t=a||PartialEvaluator.fallbackFontDict}if(t.cacheKey&&this.fontCache.has(t.cacheKey))return this.fontCache.get(t.cacheKey);const{promise:n,resolve:g}=Promise.withResolvers();let o;try{o=this.preEvaluateFont(t);o.cssFontInfo=s}catch(e){warn(`loadFont - preEvaluateFont failed: "${e}".`);return errorFont()}const{descriptor:c,hash:C}=o,h=r instanceof Ref;let l;if(C&&c instanceof Dict){const e=c.fontAliases||=Object.create(null);if(e[C]){const t=e[C].aliasRef;if(h&&t&&this.fontCache.has(t)){this.fontCache.putAlias(r,t);return this.fontCache.get(r)}}else e[C]={fontID:this.idFactory.createFontId()};h&&(e[C].aliasRef=r);l=e[C].fontID}else l=this.idFactory.createFontId();assert(l?.startsWith("f"),\'The "fontID" must be (correctly) defined.\');if(h)this.fontCache.put(r,n);else{t.cacheKey=`cacheKey_${l}`;this.fontCache.put(t.cacheKey,n)}t.loadedName=`${this.idFactory.getDocId()}_${l}`;this.translateFont(o).then((e=>{g(new TranslatedFont({loadedName:t.loadedName,font:e,dict:t,evaluatorOptions:this.options}))})).catch((e=>{warn(`loadFont - translateFont failed: "${e}".`);g(new TranslatedFont({loadedName:t.loadedName,font:new ErrorFont(e instanceof Error?e.message:e),dict:t,evaluatorOptions:this.options}))}));return n}buildPath(e,t,i,a=!1){const s=e.length-1;i||(i=[]);if(s<0||e.fnArray[s]!==it){if(a){warn(`Encountered path operator "${t}" inside of a text object.`);e.addOp(MA,null)}let s;switch(t){case TA:const e=i[0]+i[2],t=i[1]+i[3];s=[Math.min(i[0],e),Math.min(i[1],t),Math.max(i[0],e),Math.max(i[1],t)];break;case LA:case HA:s=[i[0],i[1],i[0],i[1]];break;default:s=[1/0,1/0,-1/0,-1/0]}e.addOp(it,[[t],i,s]);a&&e.addOp(UA,null)}else{const a=e.argsArray[s];a[0].push(t);a[1].push(...i);const r=a[2];switch(t){case TA:const e=i[0]+i[2],t=i[1]+i[3];r[0]=Math.min(r[0],i[0],e);r[1]=Math.min(r[1],i[1],t);r[2]=Math.max(r[2],i[0],e);r[3]=Math.max(r[3],i[1],t);break;case LA:case HA:r[0]=Math.min(r[0],i[0]);r[1]=Math.min(r[1],i[1]);r[2]=Math.max(r[2],i[0]);r[3]=Math.max(r[3],i[1])}}}parseColorSpace({cs:e,resources:t,localColorSpaceCache:i}){return ColorSpace.parseAsync({cs:e,xref:this.xref,resources:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:i}).catch((e=>{if(e instanceof AbortException)return null;if(this.options.ignoreErrors){warn(`parseColorSpace - ignoring ColorSpace: "${e}".`);return null}throw e}))}parseShading({shading:e,resources:t,localColorSpaceCache:i,localShadingPatternCache:a}){let s,r=a.get(e);if(r)return r;try{s=Pattern.parseShading(e,this.xref,t,this._pdfFunctionFactory,i).getIR()}catch(t){if(t instanceof AbortException)return null;if(this.options.ignoreErrors){warn(`parseShading - ignoring shading: "${t}".`);a.set(e,null);return null}throw t}r=`pattern_${this.idFactory.createObjId()}`;this.parsingType3Font&&(r=`${this.idFactory.getDocId()}_type3_${r}`);a.set(e,r);this.parsingType3Font?this.handler.send("commonobj",[r,"Pattern",s]):this.handler.send("obj",[r,this.pageIndex,"Pattern",s]);return r}handleColorN(e,t,i,a,s,r,n,g,o,c){const C=i.pop();if(C instanceof Name){const h=s.getRaw(C.name),l=h instanceof Ref&&o.getByRef(h);if(l)try{const s=a.base?a.base.getRgb(i,0):null,r=getTilingPatternIR(l.operatorListIR,l.dict,s);e.addOp(t,r);return}catch{}const Q=this.xref.fetchIfRef(h);if(Q){const s=Q instanceof BaseStream?Q.dict:Q,C=s.get("PatternType");if(C===fs){const g=a.base?a.base.getRgb(i,0):null;return this.handleTilingType(t,g,r,Q,s,e,n,o)}if(C===ps){const i=s.get("Shading"),a=this.parseShading({shading:i,resources:r,localColorSpaceCache:g,localShadingPatternCache:c});if(a){const i=lookupMatrix(s.getArray("Matrix"),null);e.addOp(t,["Shading",a,i])}return}throw new FormatError(`Unknown PatternType: ${C}`)}}throw new FormatError(`Unknown PatternName: ${C}`)}_parseVisibilityExpression(e,t,i){if(++t>10){warn("Visibility expression is too deeply nested");return}const a=e.length,s=this.xref.fetchIfRef(e[0]);if(!(a<2)&&s instanceof Name){switch(s.name){case"And":case"Or":case"Not":i.push(s.name);break;default:warn(`Invalid operator ${s.name} in visibility expression`);return}for(let s=1;s0)return{type:"OCMD",expression:t}}const t=i.get("OCGs");if(Array.isArray(t)||t instanceof Dict){const e=[];if(Array.isArray(t))for(const i of t)e.push(i.toString());else e.push(t.objId);return{type:a,ids:e,policy:i.get("P")instanceof Name?i.get("P").name:null,expression:null}}if(t instanceof Ref)return{type:a,id:t.toString()}}return null}getOperatorList({stream:e,task:t,resources:i,operatorList:a,initialState:s=null,fallbackFontDict:r=null}){i||=Dict.empty;s||=new EvalState;if(!a)throw new Error(\'getOperatorList: missing "operatorList" parameter\');const n=this,g=this.xref;let o=!1;const c=new LocalImageCache,C=new LocalColorSpaceCache,h=new LocalGStateCache,l=new LocalTilingPatternCache,Q=new Map,E=i.get("XObject")||Dict.empty,u=i.get("Pattern")||Dict.empty,d=new StateManager(s),f=new EvaluatorPreprocessor(e,g,d),p=new TimeSlotManager;function closePendingRestoreOPS(e){for(let e=0,t=f.savedStatesDepth;e0&&a.addOp(GA,[t]);e=null;continue}}next(new Promise((function(e,s){if(!S)throw new FormatError("GState must be referred to by name.");const r=i.get("ExtGState");if(!(r instanceof Dict))throw new FormatError("ExtGState should be a dictionary.");const g=r.get(F);if(!(g instanceof Dict))throw new FormatError("GState should be a dictionary.");n.setGState({resources:i,gState:g,operatorList:a,cacheKey:F,task:t,stateManager:d,localGStateCache:h,localColorSpaceCache:C}).then(e,s)})).catch((function(e){if(!(e instanceof AbortException)){if(!n.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring ExtGState: "${e}".`)}})));return;case LA:case HA:case JA:case YA:case vA:case KA:case TA:n.buildPath(a,s,e,o);continue;case Le:case He:case Ke:case Te:continue;case Ye:if(!(e[0]instanceof Name)){warn(`Expected name for beginMarkedContentProps arg0=${e[0]}`);a.addOp(Ye,["OC",null]);continue}if("OC"===e[0].name){next(n.parseMarkedContentProps(e[1],i).then((e=>{a.addOp(Ye,["OC",e])})).catch((e=>{if(!(e instanceof AbortException)){if(!n.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring beginMarkedContentProps: "${e}".`);a.addOp(Ye,["OC",null])}})));return}e=[e[0].name,e[1]instanceof Dict?e[1].get("MCID"):null];break;default:if(null!==e){for(w=0,D=e.length;w{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring errors during "${t.name}" task: "${e}".`);closePendingRestoreOPS()}}))}getTextContent({stream:e,task:t,resources:s,stateManager:r=null,includeMarkedContent:n=!1,sink:g,seenStyles:o=new Set,viewBox:c,lang:C=null,markedContentData:h=null,disableNormalization:l=!1,keepWhiteSpace:Q=!1}){s||=Dict.empty;r||=new StateManager(new TextState);n&&(h||={level:0});const E={items:[],styles:Object.create(null),lang:C},u={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},d=[" "," "];let f=0;function saveLastChar(e){const t=(f+1)%2,i=" "!==d[f]&&" "===d[t];d[f]=e;f=t;return!Q&&i}function shouldAddWhitepsace(){return!Q&&" "!==d[f]&&" "===d[(f+1)%2]}function resetLastChars(){d[0]=d[1]=" ";f=0}const p=this,m=this.xref,y=[];let w=null;const D=new LocalImageCache,b=new LocalGStateCache,F=new EvaluatorPreprocessor(e,m,r);let S;function pushWhitespace({width:e=0,height:t=0,transform:i=u.prevTransform,fontName:a=u.fontName}){E.items.push({str:" ",dir:"ltr",width:e,height:t,transform:i,fontName:a,hasEOL:!1})}function getCurrentTextTransform(){const e=S.font,t=[S.fontSize*S.textHScale,0,0,S.fontSize,0,S.textRise];if(e.isType3Font&&(S.fontSize<=1||e.isCharBBox)&&!isArrayEqual(S.fontMatrix,a)){const i=e.bbox[3]-e.bbox[1];i>0&&(t[3]*=i*S.fontMatrix[3])}return Util.transform(S.ctm,Util.transform(S.textMatrix,t))}function ensureTextContentItem(){if(u.initialized)return u;const{font:e,loadedName:t}=S;if(!o.has(t)){o.add(t);E.styles[t]={fontFamily:e.fallbackName,ascent:e.ascent,descent:e.descent,vertical:e.vertical};if(p.options.fontExtraProperties&&e.systemFontInfo){const i=E.styles[t];i.fontSubstitution=e.systemFontInfo.css;i.fontSubstitutionLoadedName=e.systemFontInfo.loadedName}}u.fontName=t;const i=u.transform=getCurrentTextTransform();if(e.vertical){u.width=u.totalWidth=Math.hypot(i[0],i[1]);u.height=u.totalHeight=0;u.vertical=!0}else{u.width=u.totalWidth=0;u.height=u.totalHeight=Math.hypot(i[2],i[3]);u.vertical=!1}const a=Math.hypot(S.textLineMatrix[0],S.textLineMatrix[1]),s=Math.hypot(S.ctm[0],S.ctm[1]);u.textAdvanceScale=s*a;const{fontSize:r}=S;u.trackingSpaceMin=.102*r;u.notASpace=.03*r;u.negativeSpaceMax=-.2*r;u.spaceInFlowMin=.102*r;u.spaceInFlowMax=.6*r;u.hasEOL=!1;u.initialized=!0;return u}function updateAdvanceScale(){if(!u.initialized)return;const e=Math.hypot(S.textLineMatrix[0],S.textLineMatrix[1]),t=Math.hypot(S.ctm[0],S.ctm[1])*e;if(t!==u.textAdvanceScale){if(u.vertical){u.totalHeight+=u.height*u.textAdvanceScale;u.height=0}else{u.totalWidth+=u.width*u.textAdvanceScale;u.width=0}u.textAdvanceScale=t}}function runBidiTransform(e){let t=e.str.join("");l||(t=function normalizeUnicode(e){if(!Ct){Ct=/([\\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;ht=new Map([["ſt","ſt"]])}return e.replaceAll(Ct,((e,t,i)=>t?t.normalize("NFKC"):ht.get(i)))}(t));const i=bidi(t,-1,e.vertical);return{str:i.str,dir:i.dir,width:Math.abs(e.totalWidth),height:Math.abs(e.totalHeight),transform:e.transform,fontName:e.fontName,hasEOL:e.hasEOL}}async function handleSetFont(e,i){const r=await p.loadFont(e,i,s);if(r.font.isType3Font)try{await r.loadType3Data(p,s,t)}catch{}S.loadedName=r.loadedName;S.font=r.font;S.fontMatrix=r.font.fontMatrix||a}function applyInverseRotation(e,t,i){const a=Math.hypot(i[0],i[1]);return[(i[0]*e+i[1]*t)/a,(i[2]*e+i[3]*t)/a]}function compareWithLastPosition(e){const t=getCurrentTextTransform();let i=t[4],a=t[5];if(S.font?.vertical){if(ic[2]||a+ec[3])return!1}else if(i+ec[2]||ac[3])return!1;if(!S.font||!u.prevTransform)return!0;let s=u.prevTransform[4],r=u.prevTransform[5];if(s===i&&r===a)return!0;let n=-1;t[0]&&0===t[1]&&0===t[2]?n=t[0]>0?0:180:t[1]&&0===t[0]&&0===t[3]&&(n=t[1]>0?90:270);switch(n){case 0:break;case 90:[i,a]=[a,i];[s,r]=[r,s];break;case 180:[i,a,s,r]=[-i,-a,-s,-r];break;case 270:[i,a]=[-a,-i];[s,r]=[-r,-s];break;default:[i,a]=applyInverseRotation(i,a,t);[s,r]=applyInverseRotation(s,r,u.prevTransform)}if(S.font.vertical){const e=(r-a)/u.textAdvanceScale,t=i-s,n=Math.sign(u.height);if(e.5*u.width){appendEOL();return!0}resetLastChars();flushTextContentItem();return!0}if(Math.abs(t)>u.width){appendEOL();return!0}e<=n*u.notASpace&&resetLastChars();if(e<=n*u.trackingSpaceMin)if(shouldAddWhitepsace()){resetLastChars();flushTextContentItem();pushWhitespace({height:Math.abs(e)})}else u.height+=e;else if(!addFakeSpaces(e,u.prevTransform,n))if(0===u.str.length){resetLastChars();pushWhitespace({height:Math.abs(e)})}else u.height+=e;Math.abs(t)>.25*u.width&&flushTextContentItem();return!0}const g=(i-s)/u.textAdvanceScale,o=a-r,C=Math.sign(u.width);if(g.5*u.height){appendEOL();return!0}resetLastChars();flushTextContentItem();return!0}if(Math.abs(o)>u.height){appendEOL();return!0}g<=C*u.notASpace&&resetLastChars();if(g<=C*u.trackingSpaceMin)if(shouldAddWhitepsace()){resetLastChars();flushTextContentItem();pushWhitespace({width:Math.abs(g)})}else u.width+=g;else if(!addFakeSpaces(g,u.prevTransform,C))if(0===u.str.length){resetLastChars();pushWhitespace({width:Math.abs(g)})}else u.width+=g;Math.abs(o)>.25*u.height&&flushTextContentItem();return!0}function buildTextContentItem({chars:e,extraSpacing:t}){const i=S.font;if(!e){const e=S.charSpacing+t;e&&(i.vertical?S.translateTextMatrix(0,-e):S.translateTextMatrix(e*S.textHScale,0));Q&&compareWithLastPosition(0);return}const a=i.charsToGlyphs(e),s=S.fontMatrix[0]*S.fontSize;for(let e=0,r=a.length;e0){const e=y.join("");y.length=0;buildTextContentItem({chars:e,extraSpacing:0})}break;case he:if(!r.state.font){p.ensureStateFont(r.state);continue}buildTextContentItem({chars:N[0],extraSpacing:0});break;case Be:if(!r.state.font){p.ensureStateFont(r.state);continue}S.carriageReturn();buildTextContentItem({chars:N[0],extraSpacing:0});break;case Qe:if(!r.state.font){p.ensureStateFont(r.state);continue}S.wordSpacing=N[0];S.charSpacing=N[1];S.carriageReturn();buildTextContentItem({chars:N[2],extraSpacing:0});break;case xe:flushTextContentItem();w??=s.get("XObject")||Dict.empty;R=N[0]instanceof Name;f=N[0].name;if(R&&D.getByName(f))break;next(new Promise((function(e,i){if(!R)throw new FormatError("XObject must be referred to by name.");let a=w.getRaw(f);if(a instanceof Ref){if(D.getByRef(a)){e();return}if(p.globalImageCache.getData(a,p.pageIndex)){e();return}a=m.fetch(a)}if(!(a instanceof BaseStream))throw new FormatError("XObject should be a stream");const E=a.dict.get("Subtype");if(!(E instanceof Name))throw new FormatError("XObject should have a Name subtype");if("Form"!==E.name){D.set(f,a.dict.objId,!0);e();return}const u=r.state.clone(),d=new StateManager(u),y=lookupMatrix(a.dict.getArray("Matrix"),null);y&&d.transform(y);enqueueChunk();const b={enqueueInvoked:!1,enqueue(e,t){this.enqueueInvoked=!0;g.enqueue(e,t)},get desiredSize(){return g.desiredSize},get ready(){return g.ready}};p.getTextContent({stream:a,task:t,resources:a.dict.get("Resources")||s,stateManager:d,includeMarkedContent:n,sink:b,seenStyles:o,viewBox:c,lang:C,markedContentData:h,disableNormalization:l,keepWhiteSpace:Q}).then((function(){b.enqueueInvoked||D.set(f,a.dict.objId,!0);e()}),i)})).catch((function(e){if(!(e instanceof AbortException)){if(!p.options.ignoreErrors)throw e;warn(`getTextContent - ignoring XObject: "${e}".`)}})));return;case GA:R=N[0]instanceof Name;f=N[0].name;if(R&&b.getByName(f))break;next(new Promise((function(e,t){if(!R)throw new FormatError("GState must be referred to by name.");const i=s.get("ExtGState");if(!(i instanceof Dict))throw new FormatError("ExtGState should be a dictionary.");const a=i.get(f);if(!(a instanceof Dict))throw new FormatError("GState should be a dictionary.");const r=a.get("Font");if(r){flushTextContentItem();S.fontName=null;S.fontSize=r[1];handleSetFont(null,r[0]).then(e,t)}else{b.set(f,a.objId,!0);e()}})).catch((function(e){if(!(e instanceof AbortException)){if(!p.options.ignoreErrors)throw e;warn(`getTextContent - ignoring ExtGState: "${e}".`)}})));return;case Je:flushTextContentItem();if(n){h.level++;E.items.push({type:"beginMarkedContent",tag:N[0]instanceof Name?N[0].name:null})}break;case Ye:flushTextContentItem();if(n){h.level++;let e=null;N[1]instanceof Dict&&(e=N[1].get("MCID"));E.items.push({type:"beginMarkedContentProps",id:Number.isInteger(e)?`${p.idFactory.getPageObjId()}_mc${e}`:null,tag:N[0]instanceof Name?N[0].name:null})}break;case ve:flushTextContentItem();if(n){if(0===h.level)break;h.level--;E.items.push({type:"endMarkedContent"})}break;case UA:!e||e.font===S.font&&e.fontSize===S.fontSize&&e.fontName===S.fontName||flushTextContentItem()}if(E.items.length>=g.desiredSize){d=!0;break}}if(d)next(ms);else{flushTextContentItem();enqueueChunk();e()}})).catch((e=>{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`getTextContent - ignoring errors during "${t.name}" task: "${e}".`);flushTextContentItem();enqueueChunk()}}))}async extractDataStructures(e,t){const i=this.xref;let a;const s=this.readToUnicode(t.toUnicode);if(t.composite){const i=e.get("CIDSystemInfo");i instanceof Dict&&(t.cidSystemInfo={registry:stringToPDFString(i.get("Registry")),ordering:stringToPDFString(i.get("Ordering")),supplement:i.get("Supplement")});try{const t=e.get("CIDToGIDMap");t instanceof BaseStream&&(a=t.getBytes())}catch(e){if(!this.options.ignoreErrors)throw e;warn(`extractDataStructures - ignoring CIDToGIDMap data: "${e}".`)}}const r=[];let n,g=null;if(e.has("Encoding")){n=e.get("Encoding");if(n instanceof Dict){g=n.get("BaseEncoding");g=g instanceof Name?g.name:null;if(n.has("Differences")){const e=n.get("Differences");let t=0;for(const a of e){const e=i.fetchIfRef(a);if("number"==typeof e)t=e;else{if(!(e instanceof Name))throw new FormatError(`Invalid entry in \'Differences\' array: ${e}`);r[t++]=e.name}}}}else if(n instanceof Name)g=n.name;else{const e="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new FormatError(e);warn(e)}"MacRomanEncoding"!==g&&"MacExpertEncoding"!==g&&"WinAnsiEncoding"!==g&&(g=null)}const o=!t.file||t.isInternalFont,c=qi()[t.name];g&&o&&c&&(g=null);if(g)t.defaultEncoding=getEncoding(g);else{const e=!!(t.flags&Mi),i=!!(t.flags&xi);n=hi;"TrueType"!==t.type||i||(n=li);if(e||c){n=Ci;o&&(/Symbol/i.test(t.name)?n=Bi:/Dingbats/i.test(t.name)?n=Qi:/Wingdings/i.test(t.name)&&(n=li))}t.defaultEncoding=n}t.differences=r;t.baseEncodingName=g;t.hasEncoding=!!g||r.length>0;t.dict=e;t.toUnicode=await s;const C=await this.buildToUnicode(t);t.toUnicode=C;a&&(t.cidToGidMap=this.readCidToGidMap(a,C));return t}_simpleFontToUnicode(e,t=!1){assert(!e.composite,"Must be a simple font.");const i=[],a=e.defaultEncoding.slice(),s=e.baseEncodingName,r=e.differences;for(const e in r){const t=r[e];".notdef"!==t&&(a[e]=t)}const n=wi();for(const r in a){let g=a[r];if(""===g)continue;let o=n[g];if(void 0!==o){i[r]=String.fromCharCode(o);continue}let c=0;switch(g[0]){case"G":3===g.length&&(c=parseInt(g.substring(1),16));break;case"g":5===g.length&&(c=parseInt(g.substring(1),16));break;case"C":case"c":if(g.length>=3&&g.length<=4){const i=g.substring(1);if(t){c=parseInt(i,16);break}c=+i;if(Number.isNaN(c)&&Number.isInteger(parseInt(i,16)))return this._simpleFontToUnicode(e,!0)}break;case"u":o=getUnicodeForGlyph(g,n);-1!==o&&(c=o);break;default:switch(g){case"f_h":case"f_t":case"T_h":i[r]=g.replaceAll("_","");continue}}if(c>0&&c<=1114111&&Number.isInteger(c)){if(s&&c===+r){const e=getEncoding(s);if(e&&(g=e[r])){i[r]=String.fromCharCode(n[g]);continue}}i[r]=String.fromCodePoint(c)}}return i}async buildToUnicode(e){e.hasIncludedToUnicodeMap=e.toUnicode?.length>0;if(e.hasIncludedToUnicodeMap){!e.composite&&e.hasEncoding&&(e.fallbackToUnicode=this._simpleFontToUnicode(e));return e.toUnicode}if(!e.composite)return new ToUnicodeMap(this._simpleFontToUnicode(e));if(e.composite&&(e.cMap.builtInCMap&&!(e.cMap instanceof IdentityCMap)||"Adobe"===e.cidSystemInfo?.registry&&("GB1"===e.cidSystemInfo.ordering||"CNS1"===e.cidSystemInfo.ordering||"Japan1"===e.cidSystemInfo.ordering||"Korea1"===e.cidSystemInfo.ordering))){const{registry:t,ordering:i}=e.cidSystemInfo,a=Name.get(`${t}-${i}-UCS2`),s=await CMapFactory.create({encoding:a,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),r=[],n=[];e.cMap.forEach((function(e,t){if(t>65535)throw new FormatError("Max size of CID is 65,535");const i=s.lookup(t);if(i){n.length=0;for(let e=0,t=i.length;e>1;(0!==s||t.has(r))&&(i[r]=s)}return i}extractWidths(e,t,i){const a=this.xref;let s=[],r=0;const n=[];let g;if(i.composite){const t=e.get("DW");r="number"==typeof t?Math.ceil(t):1e3;const o=e.get("W");if(Array.isArray(o))for(let e=0,t=o.length;e{const t=o.get(e),s=new OperatorList;return a.getOperatorList({stream:t,task:i,resources:c,operatorList:s}).then((()=>{s.fnArray[0]===ue&&this._removeType3ColorOperators(s,E);C[e]=s.getIR();for(const e of s.dependencies)n.add(e)})).catch((function(t){warn(`Type3 font resource "${e}" is not available.`);const i=new OperatorList;C[e]=i.getIR()}))}));this.type3Loaded=g.then((()=>{r.charProcOperatorList=C;if(this._bbox){r.isCharBBox=!0;r.bbox=this._bbox}}));return this.type3Loaded}_removeType3ColorOperators(e,t=NaN){const i=Util.normalizeRect(e.argsArray[0].slice(2)),a=i[2]-i[0],s=i[3]-i[1],r=Math.hypot(a,s);if(0===a||0===s){e.fnArray.splice(0,1);e.argsArray.splice(0,1)}else if(0===t||Math.round(r/t)>=10){this._bbox||(this._bbox=[1/0,1/0,-1/0,-1/0]);this._bbox[0]=Math.min(this._bbox[0],i[0]);this._bbox[1]=Math.min(this._bbox[1],i[1]);this._bbox[2]=Math.max(this._bbox[2],i[2]);this._bbox[3]=Math.max(this._bbox[3],i[3])}let n=0,g=e.length;for(;n=LA&&r<=zA;if(s.variableArgs)g>n&&info(`Command ${a}: expected [0, ${n}] args, but received ${g} args.`);else{if(g!==n){const e=this.nonProcessedArgs;for(;g>n;){e.push(t.shift());g--}for(;gEvaluatorPreprocessor.MAX_INVALID_PATH_OPS)throw new FormatError(`Invalid ${e}`);warn(`Skipping ${e}`);null!==t&&(t.length=0);continue}}this.preprocessCommand(r,t);e.fn=r;e.args=t;return!0}if(i===Bt)return!1;if(null!==i){null===t&&(t=[]);t.push(i);if(t.length>33)throw new FormatError("Too many arguments")}}}preprocessCommand(e,t){switch(0|e){case MA:this.stateManager.save();break;case UA:this.stateManager.restore();break;case xA:this.stateManager.transform(t)}}}class DefaultAppearanceEvaluator extends EvaluatorPreprocessor{constructor(e){super(new StringStream(e))}parse(){const e={fn:0,args:[]},t={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;;){e.args.length=0;if(!this.read(e))break;if(0!==this.savedStatesDepth)continue;const{fn:i,args:a}=e;switch(0|i){case re:const[e,i]=a;e instanceof Name&&(t.fontName=e.name);"number"==typeof i&&i>0&&(t.fontSize=i);break;case Se:ColorSpace.singletons.rgb.getRgbItem(a,0,t.fontColor,0);break;case be:ColorSpace.singletons.gray.getRgbItem(a,0,t.fontColor,0);break;case Re:ColorSpace.singletons.cmyk.getRgbItem(a,0,t.fontColor,0)}}}catch(e){warn(`parseDefaultAppearance - ignoring errors: "${e}".`)}return t}}function parseDefaultAppearance(e){return new DefaultAppearanceEvaluator(e).parse()}class AppearanceStreamEvaluator extends EvaluatorPreprocessor{constructor(e,t,i){super(e);this.stream=e;this.evaluatorOptions=t;this.xref=i;this.resources=e.dict?.get("Resources")}parse(){const e={fn:0,args:[]};let t={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:ColorSpace.singletons.gray},i=!1;const a=[];try{for(;;){e.args.length=0;if(i||!this.read(e))break;const{fn:s,args:r}=e;switch(0|s){case MA:a.push({scaleFactor:t.scaleFactor,fontSize:t.fontSize,fontName:t.fontName,fontColor:t.fontColor.slice(),fillColorSpace:t.fillColorSpace});break;case UA:t=a.pop()||t;break;case ce:t.scaleFactor*=Math.hypot(r[0],r[1]);break;case re:const[e,s]=r;e instanceof Name&&(t.fontName=e.name);"number"==typeof s&&s>0&&(t.fontSize=s*t.scaleFactor);break;case fe:t.fillColorSpace=ColorSpace.parse({cs:r[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:this._localColorSpaceCache});break;case ye:t.fillColorSpace.getRgbItem(r,0,t.fontColor,0);break;case Se:ColorSpace.singletons.rgb.getRgbItem(r,0,t.fontColor,0);break;case be:ColorSpace.singletons.gray.getRgbItem(r,0,t.fontColor,0);break;case Re:ColorSpace.singletons.cmyk.getRgbItem(r,0,t.fontColor,0);break;case he:case le:case Be:case Qe:i=!0}}}catch(e){warn(`parseAppearanceStream - ignoring errors: "${e}".`)}this.stream.reset();delete t.scaleFactor;delete t.fillColorSpace;return t}get _localColorSpaceCache(){return shadow(this,"_localColorSpaceCache",new LocalColorSpaceCache)}get _pdfFunctionFactory(){return shadow(this,"_pdfFunctionFactory",new PDFFunctionFactory({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported}))}}function getPdfColor(e,t){if(e[0]===e[1]&&e[1]===e[2]){return`${numberToString(e[0]/255)} ${t?"g":"G"}`}return Array.from(e,(e=>numberToString(e/255))).join(" ")+" "+(t?"rg":"RG")}class FakeUnicodeFont{constructor(e,t){this.xref=e;this.widths=null;this.firstChar=1/0;this.lastChar=-1/0;this.fontFamily=t;const i=new OffscreenCanvas(1,1);this.ctxMeasure=i.getContext("2d",{willReadFrequently:!0});FakeUnicodeFont._fontNameId||(FakeUnicodeFont._fontNameId=1);this.fontName=Name.get(`InvalidPDFjsFont_${t}_${FakeUnicodeFont._fontNameId++}`)}get fontDescriptorRef(){if(!FakeUnicodeFont._fontDescriptorRef){const e=new Dict(this.xref);e.set("Type",Name.get("FontDescriptor"));e.set("FontName",this.fontName);e.set("FontFamily","MyriadPro Regular");e.set("FontBBox",[0,0,0,0]);e.set("FontStretch",Name.get("Normal"));e.set("FontWeight",400);e.set("ItalicAngle",0);FakeUnicodeFont._fontDescriptorRef=this.xref.getNewPersistentRef(e)}return FakeUnicodeFont._fontDescriptorRef}get descendantFontRef(){const e=new Dict(this.xref);e.set("BaseFont",this.fontName);e.set("Type",Name.get("Font"));e.set("Subtype",Name.get("CIDFontType0"));e.set("CIDToGIDMap",Name.get("Identity"));e.set("FirstChar",this.firstChar);e.set("LastChar",this.lastChar);e.set("FontDescriptor",this.fontDescriptorRef);e.set("DW",1e3);const t=[],i=[...this.widths.entries()].sort();let a=null,s=null;for(const[e,r]of i)if(a)if(e===a+s.length)s.push(r);else{t.push(a,s);a=e;s=[r]}else{a=e;s=[r]}a&&t.push(a,s);e.set("W",t);const r=new Dict(this.xref);r.set("Ordering","Identity");r.set("Registry","Adobe");r.set("Supplement",0);e.set("CIDSystemInfo",r);return this.xref.getNewPersistentRef(e)}get baseFontRef(){const e=new Dict(this.xref);e.set("BaseFont",this.fontName);e.set("Type",Name.get("Font"));e.set("Subtype",Name.get("Type0"));e.set("Encoding",Name.get("Identity-H"));e.set("DescendantFonts",[this.descendantFontRef]);e.set("ToUnicode",Name.get("Identity-H"));return this.xref.getNewPersistentRef(e)}get resources(){const e=new Dict(this.xref),t=new Dict(this.xref);t.set(this.fontName.name,this.baseFontRef);e.set("Font",t);return e}_createContext(){this.widths=new Map;this.ctxMeasure.font=`1000px ${this.fontFamily}`;return this.ctxMeasure}createFontResources(e){const t=this._createContext();for(const i of e.split(/\\r\\n?|\\n/))for(const e of i.split("")){const i=e.charCodeAt(0);if(this.widths.has(i))continue;const a=t.measureText(e),s=Math.ceil(a.width);this.widths.set(i,s);this.firstChar=Math.min(i,this.firstChar);this.lastChar=Math.max(i,this.lastChar)}return this.resources}static getFirstPositionInfo(e,t,i){const[a,n,g,o]=e;let c=g-a,C=o-n;t%180!=0&&([c,C]=[C,c]);const h=s*i;return{coords:[0,C+r*i-h],bbox:[0,0,c,C],matrix:0!==t?getRotationMatrix(t,C,h):void 0}}createAppearance(e,t,i,a,n,g){const o=this._createContext(),c=[];let C=-1/0;for(const t of e.split(/\\r\\n?|\\n/)){c.push(t);const e=o.measureText(t).width;C=Math.max(C,e);for(const e of codePointIter(t)){const t=String.fromCodePoint(e);let i=this.widths.get(e);if(void 0===i){const a=o.measureText(t);i=Math.ceil(a.width);this.widths.set(e,i);this.firstChar=Math.min(e,this.firstChar);this.lastChar=Math.max(e,this.lastChar)}}}C*=a/1e3;const[h,l,Q,E]=t;let u=Q-h,d=E-l;i%180!=0&&([u,d]=[d,u]);let f=1;C>u&&(f=u/C);let p=1;const m=s*a,y=r*a,w=m*c.length;w>d&&(p=d/w);const D=a*Math.min(f,p),b=["q",`0 0 ${numberToString(u)} ${numberToString(d)} re W n`,"BT",`1 0 0 1 0 ${numberToString(d+y)} Tm 0 Tc ${getPdfColor(n,!0)}`,`/${this.fontName.name} ${numberToString(D)} Tf`],{resources:F}=this;if(1!==(g="number"==typeof g&&g>=0&&g<=1?g:1)){b.push("/R0 gs");const e=new Dict(this.xref),t=new Dict(this.xref);t.set("ca",g);t.set("CA",g);t.set("Type",Name.get("ExtGState"));e.set("R0",t);F.set("ExtGState",e)}const S=numberToString(m);for(const e of c)b.push(`0 -${S} Td <${stringToUTF16HexString(e)}> Tj`);b.push("ET","Q");const k=b.join("\\n"),R=new Dict(this.xref);R.set("Subtype",Name.get("Form"));R.set("Type",Name.get("XObject"));R.set("BBox",[0,0,u,d]);R.set("Length",k.length);R.set("Resources",F);if(i){const e=getRotationMatrix(i,u,d);R.set("Matrix",e)}const N=new StringStream(k);N.dict=R;return N}}class NameOrNumberTree{constructor(e,t,i){this.root=e;this.xref=t;this._type=i}getAll(){const e=new Map;if(!this.root)return e;const t=this.xref,i=new RefSet;i.put(this.root);const a=[this.root];for(;a.length>0;){const s=t.fetchIfRef(a.shift());if(!(s instanceof Dict))continue;if(s.has("Kids")){const e=s.get("Kids");if(!Array.isArray(e))continue;for(const t of e){if(i.has(t))throw new FormatError(`Duplicate entry in "${this._type}" tree.`);a.push(t);i.put(t)}continue}const r=s.get(this._type);if(Array.isArray(r))for(let i=0,a=r.length;i10){warn(`Search depth limit reached for "${this._type}" tree.`);return null}const s=i.get("Kids");if(!Array.isArray(s))return null;let r=0,n=s.length-1;for(;r<=n;){const a=r+n>>1,g=t.fetchIfRef(s[a]),o=g.get("Limits");if(et.fetchIfRef(o[1]))){i=g;break}r=a+1}}if(r>n)return null}const s=i.get(this._type);if(Array.isArray(s)){let i=0,a=s.length-2;for(;i<=a;){const r=i+a>>1,n=r+(1&r),g=t.fetchIfRef(s[n]);if(eg))return s[n+1];i=n+2}}}return null}get(e){return this.xref.fetchIfRef(this.getRaw(e))}}class NameTree extends NameOrNumberTree{constructor(e,t){super(e,t,"Names")}}class NumberTree extends NameOrNumberTree{constructor(e,t){super(e,t,"Nums")}}function clearGlobalCaches(){!function clearPatternCaches(){Qa=Object.create(null)}();!function clearPrimitiveCaches(){Qt=Object.create(null);Et=Object.create(null);ut=Object.create(null)}();!function clearUnicodeCaches(){ki.clear()}();JpxImage.cleanup()}function pickPlatformItem(e){return e instanceof Dict?e.has("UF")?e.get("UF"):e.has("F")?e.get("F"):e.has("Unix")?e.get("Unix"):e.has("Mac")?e.get("Mac"):e.has("DOS")?e.get("DOS"):null:null}class FileSpec{#U=!1;constructor(e,t,i=!1){if(e instanceof Dict){this.xref=t;this.root=e;e.has("FS")&&(this.fs=e.get("FS"));e.has("RF")&&warn("Related file specifications are not supported");i||(e.has("EF")?this.#U=!0:warn("Non-embedded file specifications are not supported"))}}get filename(){let e="";const t=pickPlatformItem(this.root);t&&"string"==typeof t&&(e=stringToPDFString(t).replaceAll("\\\\\\\\","\\\\").replaceAll("\\\\/","/").replaceAll("\\\\","/"));return shadow(this,"filename",e||"unnamed")}get content(){if(!this.#U)return null;this._contentRef||=pickPlatformItem(this.root?.get("EF"));let e=null;if(this._contentRef){const t=this.xref.fetchIfRef(this._contentRef);t instanceof BaseStream?e=t.getBytes():warn("Embedded file specification points to non-existing/invalid content")}else warn("Embedded file specification does not have any content");return e}get description(){let e="";const t=this.root?.get("Desc");t&&"string"==typeof t&&(e=stringToPDFString(t));return shadow(this,"description",e)}get serializable(){return{rawFilename:this.filename,filename:(e=this.filename,e.substring(e.lastIndexOf("/")+1)),content:this.content,description:this.description};var e}}const ys=0,ws=-2,Ds=-3,bs=-4,Fs=-5,Ss=-6,ks=-9;function isWhitespace(e,t){const i=e[t];return" "===i||"\\n"===i||"\\r"===i||"\\t"===i}class XMLParserBase{_resolveEntities(e){return e.replaceAll(/&([^;]+);/g,((e,t)=>{if("#x"===t.substring(0,2))return String.fromCodePoint(parseInt(t.substring(2),16));if("#"===t.substring(0,1))return String.fromCodePoint(parseInt(t.substring(1),10));switch(t){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return\'"\';case"apos":return"\'"}return this.onResolveEntity(t)}))}_parseContent(e,t){const i=[];let a=t;function skipWs(){for(;a"!==e[a]&&"/"!==e[a];)++a;const s=e.substring(t,a);skipWs();for(;a"!==e[a]&&"/"!==e[a]&&"?"!==e[a];){skipWs();let t="",s="";for(;a"!==e[i]&&"?"!==e[i]&&"/"!==e[i];)++i;const a=e.substring(t,i);!function skipWs(){for(;i"!==e[i+1]);)++i;return{name:a,value:e.substring(s,i),parsed:i-t}}parseXml(e){let t=0;for(;t",i);if(t<0){this.onError(ks);return}this.onEndElement(e.substring(i,t));i=t+1;break;case"?":++i;const a=this._parseProcessingInstruction(e,i);if("?>"!==e.substring(i+a.parsed,i+a.parsed+2)){this.onError(Ds);return}this.onPi(a.name,a.value);i+=a.parsed+2;break;case"!":if("--"===e.substring(i+1,i+3)){t=e.indexOf("--\\x3e",i+3);if(t<0){this.onError(Fs);return}this.onComment(e.substring(i+3,t));i=t+3}else if("[CDATA["===e.substring(i+1,i+8)){t=e.indexOf("]]>",i+8);if(t<0){this.onError(ws);return}this.onCdata(e.substring(i+8,t));i=t+3}else{if("DOCTYPE"!==e.substring(i+1,i+8)){this.onError(Ss);return}{const a=e.indexOf("[",i+8);let s=!1;t=e.indexOf(">",i+8);if(t<0){this.onError(bs);return}if(a>0&&t>a){t=e.indexOf("]>",i+8);if(t<0){this.onError(bs);return}s=!0}const r=e.substring(i+8,t+(s?1:0));this.onDoctype(r);i=t+(s?2:1)}}break;default:const s=this._parseContent(e,i);if(null===s){this.onError(Ss);return}let r=!1;if("/>"===e.substring(i+s.parsed,i+s.parsed+2))r=!0;else if(">"!==e.substring(i+s.parsed,i+s.parsed+1)){this.onError(ks);return}this.onBeginElement(s.name,s.attributes,r);i+=s.parsed+(r?2:1)}}else{for(;i0}searchNode(e,t){if(t>=e.length)return this;const i=e[t];if(i.name.startsWith("#")&&t0){a.push([s,0]);s=s.childNodes[0]}else{if(0===a.length)return null;for(;0!==a.length;){const[e,t]=a.pop(),i=t+1;if(i");for(const t of this.childNodes)t.dump(e);e.push(``)}else this.nodeValue?e.push(`>${encodeToXmlString(this.nodeValue)}`):e.push("/>")}else e.push(encodeToXmlString(this.nodeValue))}}class SimpleXMLParser extends XMLParserBase{constructor({hasAttributes:e=!1,lowerCaseName:t=!1}){super();this._currentFragment=null;this._stack=null;this._errorCode=ys;this._hasAttributes=e;this._lowerCaseName=t}parseFromString(e){this._currentFragment=[];this._stack=[];this._errorCode=ys;this.parseXml(e);if(this._errorCode!==ys)return;const[t]=this._currentFragment;return t?{documentElement:t}:void 0}onText(e){if(function isWhitespaceString(e){for(let t=0,i=e.length;t\\\\376\\\\377([^<]+)/g,(function(e,t){const i=t.replaceAll(/\\\\([0-3])([0-7])([0-7])/g,(function(e,t,i,a){return String.fromCharCode(64*t+8*i+1*a)})).replaceAll(/&(amp|apos|gt|lt|quot);/g,(function(e,t){switch(t){case"amp":return"&";case"apos":return"\'";case"gt":return">";case"lt":return"<";case"quot":return\'"\'}throw new Error(`_repair: ${t} isn\'t defined.`)})),a=[">"];for(let e=0,t=i.length;e=32&&t<127&&60!==t&&62!==t&&38!==t?a.push(String.fromCharCode(t)):a.push("&#x"+(65536+t).toString(16).substring(1)+";")}return a.join("")}))}_getSequence(e){const t=e.nodeName;return"rdf:bag"!==t&&"rdf:seq"!==t&&"rdf:alt"!==t?null:e.childNodes.filter((e=>"rdf:li"===e.nodeName))}_parseArray(e){if(!e.hasChildNodes())return;const[t]=e.childNodes,i=this._getSequence(t)||[];this._metadataMap.set(e.nodeName,i.map((e=>e.textContent.trim())))}_parse(e){let t=e.documentElement;if("rdf:rdf"!==t.nodeName){t=t.firstChild;for(;t&&"rdf:rdf"!==t.nodeName;)t=t.nextSibling}if(t&&"rdf:rdf"===t.nodeName&&t.hasChildNodes())for(const e of t.childNodes)if("rdf:description"===e.nodeName)for(const t of e.childNodes){const e=t.nodeName;switch(e){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(t);continue}this._metadataMap.set(e,t.textContent.trim())}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}}const Rs=1,Ns=2,Gs=3,Ms=4,Us=5;class StructTreeRoot{constructor(e,t){this.dict=e;this.ref=t instanceof Ref?t:null;this.roleMap=new Map;this.structParentIds=null}init(){this.readRoleMap()}#x(e,t,i){if(!(e instanceof Ref)||t<0)return;this.structParentIds||=new RefSetCache;let a=this.structParentIds.get(e);if(!a){a=[];this.structParentIds.put(e,a)}a.push([t,i])}addAnnotationIdToPage(e,t){this.#x(e,t,Ms)}readRoleMap(){const e=this.dict.get("RoleMap");if(e instanceof Dict)for(const[t,i]of e)i instanceof Name&&this.roleMap.set(t,i.name)}static async canCreateStructureTree({catalogRef:e,pdfManager:t,newAnnotationsByPage:i}){if(!(e instanceof Ref)){warn("Cannot save the struct tree: no catalog reference.");return!1}let a=0,s=!0;for(const[e,r]of i){const{ref:i}=await t.getPage(e);if(!(i instanceof Ref)){warn(`Cannot save the struct tree: page ${e} has no ref.`);s=!0;break}for(const e of r)if(e.accessibilityData?.type){e.parentTreeId=a++;s=!1}}if(s){for(const e of i.values())for(const t of e)delete t.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:e,xref:t,catalogRef:i,pdfManager:a,changes:s}){const r=a.catalog.cloneDict(),n=new RefSetCache;n.put(i,r);const g=t.getNewTemporaryRef();r.set("StructTreeRoot",g);const o=new Dict(t);o.set("Type",Name.get("StructTreeRoot"));const c=t.getNewTemporaryRef();o.set("ParentTree",c);const C=[];o.set("K",C);n.put(g,o);const h=new Dict(t),l=[];h.set("Nums",l);const Q=await this.#L({newAnnotationsByPage:e,structTreeRootRef:g,structTreeRoot:null,kids:C,nums:l,xref:t,pdfManager:a,changes:s,cache:n});o.set("ParentTreeNextKey",Q);n.put(c,h);for(const[e,t]of n.items())s.put(e,{data:t})}async canUpdateStructTree({pdfManager:e,xref:t,newAnnotationsByPage:i}){if(!this.ref){warn("Cannot update the struct tree: no root reference.");return!1}let a=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(a)||a<0){warn("Cannot update the struct tree: invalid next key.");return!1}const s=this.dict.get("ParentTree");if(!(s instanceof Dict)){warn("Cannot update the struct tree: ParentTree isn\'t a dict.");return!1}const r=s.get("Nums");if(!Array.isArray(r)){warn("Cannot update the struct tree: nums isn\'t an array.");return!1}const n=new NumberTree(s,t);for(const t of i.keys()){const{pageDict:i}=await e.getPage(t);if(!i.has("StructParents"))continue;const a=i.get("StructParents");if(!Number.isInteger(a)||!Array.isArray(n.get(a))){warn(`Cannot save the struct tree: page ${t} has a wrong id.`);return!1}}let g=!0;for(const[t,s]of i){const{pageDict:i}=await e.getPage(t);StructTreeRoot.#H({elements:s,xref:this.dict.xref,pageDict:i,numberTree:n});for(const e of s)if(e.accessibilityData?.type){e.accessibilityData.structParent>=0||(e.parentTreeId=a++);g=!1}}if(g){for(const e of i.values())for(const t of e){delete t.parentTreeId;delete t.structTreeParent}return!1}return!0}async updateStructureTree({newAnnotationsByPage:e,pdfManager:t,changes:i}){const a=this.dict.xref,s=this.dict.clone(),r=this.ref,n=new RefSetCache;n.put(r,s);let g,o=s.getRaw("ParentTree");if(o instanceof Ref)g=a.fetch(o);else{g=o;o=a.getNewTemporaryRef();s.set("ParentTree",o)}g=g.clone();n.put(o,g);let c=g.getRaw("Nums"),C=null;if(c instanceof Ref){C=c;c=a.fetch(C)}c=c.slice();C||g.set("Nums",c);const h=await StructTreeRoot.#L({newAnnotationsByPage:e,structTreeRootRef:r,structTreeRoot:this,kids:null,nums:c,xref:a,pdfManager:t,changes:i,cache:n});if(-1!==h){s.set("ParentTreeNextKey",h);C&&n.put(C,c);for(const[e,t]of n.items())i.put(e,{data:t})}}static async#L({newAnnotationsByPage:e,structTreeRootRef:t,structTreeRoot:i,kids:a,nums:s,xref:r,pdfManager:n,changes:g,cache:o}){const c=Name.get("OBJR");let C,h=-1;for(const[l,Q]of e){const e=await n.getPage(l),{ref:E}=e,u=E instanceof Ref;for(const{accessibilityData:n,ref:d,parentTreeId:f,structTreeParent:p}of Q){if(!n?.type)continue;const{structParent:Q}=n;if(i&&Number.isInteger(Q)&&Q>=0){let t=(C||=new Map).get(l);if(void 0===t){t=new StructTreePage(i,e.pageDict).collectObjects(E);C.set(l,t)}const a=t?.get(Q);if(a){const e=r.fetch(a).clone();StructTreeRoot.#J(e,n);g.put(a,{data:e});continue}}h=Math.max(h,f);const m=r.getNewTemporaryRef(),y=new Dict(r);StructTreeRoot.#J(y,n);await this.#Y({structTreeParent:p,tagDict:y,newTagRef:m,structTreeRootRef:t,fallbackKids:a,xref:r,cache:o});const w=new Dict(r);y.set("K",w);w.set("Type",c);u&&w.set("Pg",E);w.set("Obj",d);o.put(m,y);s.push(f,m)}}return h+1}static#J(e,{type:t,title:i,lang:a,alt:s,expanded:r,actualText:n}){e.set("S",Name.get(t));i&&e.set("T",stringToAsciiOrUTF16BE(i));a&&e.set("Lang",stringToAsciiOrUTF16BE(a));s&&e.set("Alt",stringToAsciiOrUTF16BE(s));r&&e.set("E",stringToAsciiOrUTF16BE(r));n&&e.set("ActualText",stringToAsciiOrUTF16BE(n))}static#H({elements:e,xref:t,pageDict:i,numberTree:a}){const s=new Map;for(const t of e)if(t.structTreeParentId){const e=parseInt(t.structTreeParentId.split("_mc")[1],10);let i=s.get(e);if(!i){i=[];s.set(e,i)}i.push(t)}const r=i.get("StructParents");if(!Number.isInteger(r))return;const n=a.get(r),updateElement=(e,i,a)=>{const r=s.get(e);if(r){const e=i.getRaw("P"),s=t.fetchIfRef(e);if(e instanceof Ref&&s instanceof Dict){const e={ref:a,dict:i};for(const t of r)t.structTreeParent=e}return!0}return!1};for(const e of n){if(!(e instanceof Ref))continue;const i=t.fetch(e),a=i.get("K");if(Number.isInteger(a))updateElement(a,i,e);else if(Array.isArray(a))for(let s of a){s=t.fetchIfRef(s);if(Number.isInteger(s)&&updateElement(s,i,e))break;if(!(s instanceof Dict))continue;if(!isName(s.get("Type"),"MCR"))break;const a=s.get("MCID");if(Number.isInteger(a)&&updateElement(a,i,e))break}}}static async#Y({structTreeParent:e,tagDict:t,newTagRef:i,structTreeRootRef:a,fallbackKids:s,xref:r,cache:n}){let g,o=null;if(e){({ref:o}=e);g=e.dict.getRaw("P")||a}else g=a;t.set("P",g);const c=r.fetchIfRef(g);if(!c){s.push(i);return}let C=n.get(g);if(!C){C=c.clone();n.put(g,C)}const h=C.getRaw("K");let l=h instanceof Ref?n.get(h):null;if(!l){l=r.fetchIfRef(h);l=Array.isArray(l)?l.slice():[h];const e=r.getNewTemporaryRef();C.set("K",e);n.put(e,l)}const Q=l.indexOf(o);l.splice(Q>=0?Q+1:l.length,0,i)}}class StructElementNode{constructor(e,t){this.tree=e;this.dict=t;this.kids=[];this.parseKids()}get role(){const e=this.dict.get("S"),t=e instanceof Name?e.name:"",{root:i}=this.tree;return i.roleMap.has(t)?i.roleMap.get(t):t}parseKids(){let e=null;const t=this.dict.getRaw("Pg");t instanceof Ref&&(e=t.toString());const i=this.dict.get("K");if(Array.isArray(i))for(const t of i){const i=this.parseKid(e,t);i&&this.kids.push(i)}else{const t=this.parseKid(e,i);t&&this.kids.push(t)}}parseKid(e,t){if(Number.isInteger(t))return this.tree.pageDict.objId!==e?null:new StructElement({type:Rs,mcid:t,pageObjId:e});let i=null;t instanceof Ref?i=this.dict.xref.fetch(t):t instanceof Dict&&(i=t);if(!i)return null;const a=i.getRaw("Pg");a instanceof Ref&&(e=a.toString());const s=i.get("Type")instanceof Name?i.get("Type").name:null;if("MCR"===s){if(this.tree.pageDict.objId!==e)return null;const t=i.getRaw("Stm");return new StructElement({type:Ns,refObjId:t instanceof Ref?t.toString():null,pageObjId:e,mcid:i.get("MCID")})}if("OBJR"===s){if(this.tree.pageDict.objId!==e)return null;const t=i.getRaw("Obj");return new StructElement({type:Gs,refObjId:t instanceof Ref?t.toString():null,pageObjId:e})}return new StructElement({type:Us,dict:i})}}class StructElement{constructor({type:e,dict:t=null,mcid:i=null,pageObjId:a=null,refObjId:s=null}){this.type=e;this.dict=t;this.mcid=i;this.pageObjId=a;this.refObjId=s;this.parentNode=null}}class StructTreePage{constructor(e,t){this.root=e;this.rootDict=e?e.dict:null;this.pageDict=t;this.nodes=[]}collectObjects(e){if(!(this.root&&this.rootDict&&e instanceof Ref))return null;const t=this.rootDict.get("ParentTree");if(!t)return null;const i=this.root.structParentIds?.get(e);if(!i)return null;const a=new Map,s=new NumberTree(t,this.rootDict.xref);for(const[e]of i){const t=s.getRaw(e);t instanceof Ref&&a.set(e,t)}return a}parse(e){if(!(this.root&&this.rootDict&&e instanceof Ref))return;const t=this.rootDict.get("ParentTree");if(!t)return;const i=this.pageDict.get("StructParents"),a=this.root.structParentIds?.get(e);if(!Number.isInteger(i)&&!a)return;const s=new Map,r=new NumberTree(t,this.rootDict.xref);if(Number.isInteger(i)){const e=r.get(i);if(Array.isArray(e))for(const t of e)t instanceof Ref&&this.addNode(this.rootDict.xref.fetch(t),s)}if(a)for(const[e,t]of a){const i=r.get(e);if(i){const e=this.addNode(this.rootDict.xref.fetchIfRef(i),s);1===e?.kids?.length&&e.kids[0].type===Gs&&(e.kids[0].type=t)}}}addNode(e,t,i=0){if(i>40){warn("StructTree MAX_DEPTH reached.");return null}if(!(e instanceof Dict))return null;if(t.has(e))return t.get(e);const a=new StructElementNode(this,e);t.set(e,a);const s=e.get("P");if(!s||isName(s.get("Type"),"StructTreeRoot")){this.addTopLevelNode(e,a)||t.delete(e);return a}const r=this.addNode(s,t,i+1);if(!r)return a;let n=!1;for(const t of r.kids)if(t.type===Us&&t.dict===e){t.parentNode=a;n=!0}n||t.delete(e);return a}addTopLevelNode(e,t){const i=this.rootDict.get("K");if(!i)return!1;if(i instanceof Dict){if(i.objId!==e.objId)return!1;this.nodes[0]=t;return!0}if(!Array.isArray(i))return!0;let a=!1;for(let s=0;s40){warn("StructTree too deep to be fully serialized.");return}const a=Object.create(null);a.role=e.role;a.children=[];t.children.push(a);let s=e.dict.get("Alt");"string"!=typeof s&&(s=e.dict.get("ActualText"));"string"==typeof s&&(a.alt=stringToPDFString(s));const r=e.dict.get("A");if(r instanceof Dict){const e=lookupNormalRect(r.getArray("BBox"),null);if(e)a.bbox=e;else{const e=r.get("Width"),t=r.get("Height");"number"==typeof e&&e>0&&"number"==typeof t&&t>0&&(a.bbox=[0,0,e,t])}}const n=e.dict.get("Lang");"string"==typeof n&&(a.lang=stringToPDFString(n));for(const t of e.kids){const e=t.type===Us?t.parentNode:null;e?nodeToSerializable(e,a,i+1):t.type===Rs||t.type===Ns?a.children.push({type:"content",id:`p${t.pageObjId}_mc${t.mcid}`}):t.type===Gs?a.children.push({type:"object",id:t.refObjId}):t.type===Ms&&a.children.push({type:"annotation",id:`pdfjs_internal_id_${t.refObjId}`})}}const e=Object.create(null);e.children=[];e.role="Root";for(const t of this.nodes)t&&nodeToSerializable(t,e);return e}}function isValidExplicitDest(e){if(!Array.isArray(e)||e.length<2)return!1;const[t,i,...a]=e;if(!(t instanceof Ref||Number.isInteger(t)))return!1;if(!(i instanceof Name))return!1;const s=a.length;let r=!0;switch(i.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return 0===s;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(4!==s)return!1;r=!1;break;default:return!1}for(const e of a)if(!("number"==typeof e||r&&null===e))return!1;return!0}function fetchDest(e){e instanceof Dict&&(e=e.get("D"));return isValidExplicitDest(e)?e:null}function fetchRemoteDest(e){let t=e.get("D");if(t){t instanceof Name&&(t=t.name);if("string"==typeof t)return stringToPDFString(t);if(isValidExplicitDest(t))return JSON.stringify(t)}return null}class Catalog{constructor(e,t){this.pdfManager=e;this.xref=t;this._catDict=t.getCatalogObj();if(!(this._catDict instanceof Dict))throw new FormatError("Catalog object is not a dictionary.");this.toplevelPagesDict;this._actualNumPages=null;this.fontCache=new RefSetCache;this.builtInCMapCache=new Map;this.standardFontDataCache=new Map;this.globalImageCache=new GlobalImageCache;this.pageKidsCountCache=new RefSetCache;this.pageIndexCache=new RefSetCache;this.pageDictCache=new RefSetCache;this.nonBlendModesSet=new RefSet;this.systemFontCache=new Map}cloneDict(){return this._catDict.clone()}get version(){const e=this._catDict.get("Version");if(e instanceof Name){if(ft.test(e.name))return shadow(this,"version",e.name);warn(`Invalid PDF catalog version: ${e.name}`)}return shadow(this,"version",null)}get lang(){const e=this._catDict.get("Lang");return shadow(this,"lang",e&&"string"==typeof e?stringToPDFString(e):null)}get needsRendering(){const e=this._catDict.get("NeedsRendering");return shadow(this,"needsRendering","boolean"==typeof e&&e)}get collection(){let e=null;try{const t=this._catDict.get("Collection");t instanceof Dict&&t.size>0&&(e=t)}catch(e){if(e instanceof MissingDataException)throw e;info("Cannot fetch Collection entry; assuming no collection is present.")}return shadow(this,"collection",e)}get acroForm(){let e=null;try{const t=this._catDict.get("AcroForm");t instanceof Dict&&t.size>0&&(e=t)}catch(e){if(e instanceof MissingDataException)throw e;info("Cannot fetch AcroForm entry; assuming no forms are present.")}return shadow(this,"acroForm",e)}get acroFormRef(){const e=this._catDict.getRaw("AcroForm");return shadow(this,"acroFormRef",e instanceof Ref?e:null)}get metadata(){const e=this._catDict.getRaw("Metadata");if(!(e instanceof Ref))return shadow(this,"metadata",null);let t=null;try{const i=this.xref.fetch(e,!this.xref.encrypt?.encryptMetadata);if(i instanceof BaseStream&&i.dict instanceof Dict){const e=i.dict.get("Type"),a=i.dict.get("Subtype");if(isName(e,"Metadata")&&isName(a,"XML")){const e=stringToUTF8String(i.getString());e&&(t=new MetadataParser(e).serializable)}}}catch(e){if(e instanceof MissingDataException)throw e;info(`Skipping invalid Metadata: "${e}".`)}return shadow(this,"metadata",t)}get markInfo(){let e=null;try{e=this._readMarkInfo()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read mark info.")}return shadow(this,"markInfo",e)}_readMarkInfo(){const e=this._catDict.get("MarkInfo");if(!(e instanceof Dict))return null;const t={Marked:!1,UserProperties:!1,Suspects:!1};for(const i in t){const a=e.get(i);"boolean"==typeof a&&(t[i]=a)}return t}get structTreeRoot(){let e=null;try{e=this._readStructTreeRoot()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable read to structTreeRoot info.")}return shadow(this,"structTreeRoot",e)}_readStructTreeRoot(){const e=this._catDict.getRaw("StructTreeRoot"),t=this.xref.fetchIfRef(e);if(!(t instanceof Dict))return null;const i=new StructTreeRoot(t,e);i.init();return i}get toplevelPagesDict(){const e=this._catDict.get("Pages");if(!(e instanceof Dict))throw new FormatError("Invalid top-level pages dictionary.");return shadow(this,"toplevelPagesDict",e)}get documentOutline(){let e=null;try{e=this._readDocumentOutline()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read document outline.")}return shadow(this,"documentOutline",e)}_readDocumentOutline(){let e=this._catDict.get("Outlines");if(!(e instanceof Dict))return null;e=e.getRaw("First");if(!(e instanceof Ref))return null;const t={items:[]},i=[{obj:e,parent:t}],a=new RefSet;a.put(e);const s=this.xref,r=new Uint8ClampedArray(3);for(;i.length>0;){const t=i.shift(),n=s.fetchIfRef(t.obj);if(null===n)continue;n.has("Title")||warn("Invalid outline item encountered.");const g={url:null,dest:null,action:null};Catalog.parseDestDictionary({destDict:n,resultObj:g,docBaseUrl:this.baseUrl,docAttachments:this.attachments});const o=n.get("Title"),c=n.get("F")||0,C=n.getArray("C"),h=n.get("Count");let l=r;!isNumberArray(C,3)||0===C[0]&&0===C[1]&&0===C[2]||(l=ColorSpace.singletons.rgb.getRgb(C,0));const Q={action:g.action,attachment:g.attachment,dest:g.dest,url:g.url,unsafeUrl:g.unsafeUrl,newWindow:g.newWindow,setOCGState:g.setOCGState,title:"string"==typeof o?stringToPDFString(o):"",color:l,count:Number.isInteger(h)?h:void 0,bold:!!(2&c),italic:!!(1&c),items:[]};t.parent.items.push(Q);e=n.getRaw("First");if(e instanceof Ref&&!a.has(e)){i.push({obj:e,parent:Q});a.put(e)}e=n.getRaw("Next");if(e instanceof Ref&&!a.has(e)){i.push({obj:e,parent:t.parent});a.put(e)}}return t.items.length>0?t.items:null}get permissions(){let e=null;try{e=this._readPermissions()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read permissions.")}return shadow(this,"permissions",e)}_readPermissions(){const e=this.xref.trailer.get("Encrypt");if(!(e instanceof Dict))return null;let t=e.get("P");if("number"!=typeof t)return null;t+=2**32;const i=[];for(const e in y){const a=y[e];t&a&&i.push(a)}return i}get optionalContentConfig(){let e=null;try{const t=this._catDict.get("OCProperties");if(!t)return shadow(this,"optionalContentConfig",null);const i=t.get("D");if(!i)return shadow(this,"optionalContentConfig",null);const a=t.get("OCGs");if(!Array.isArray(a))return shadow(this,"optionalContentConfig",null);const s=new RefSetCache;for(const e of a)e instanceof Ref&&!s.has(e)&&s.put(e,this.#v(e));e=this.#K(i,s)}catch(e){if(e instanceof MissingDataException)throw e;warn(`Unable to read optional content config: ${e}`)}return shadow(this,"optionalContentConfig",e)}#v(e){const t=this.xref.fetch(e),i={id:e.toString(),name:null,intent:null,usage:{print:null,view:null},rbGroups:[]},a=t.get("Name");"string"==typeof a&&(i.name=stringToPDFString(a));let s=t.getArray("Intent");Array.isArray(s)||(s=[s]);s.every((e=>e instanceof Name))&&(i.intent=s.map((e=>e.name)));const r=t.get("Usage");if(!(r instanceof Dict))return i;const n=i.usage,g=r.get("Print");if(g instanceof Dict){const e=g.get("PrintState");if(e instanceof Name)switch(e.name){case"ON":case"OFF":n.print={printState:e.name}}}const o=r.get("View");if(o instanceof Dict){const e=o.get("ViewState");if(e instanceof Name)switch(e.name){case"ON":case"OFF":n.view={viewState:e.name}}}return i}#K(e,t){function parseOnOff(e){const i=[];if(Array.isArray(e))for(const a of e)a instanceof Ref&&t.has(a)&&i.push(a.toString());return i}function parseOrder(e,i=0){if(!Array.isArray(e))return null;const s=[];for(const r of e){if(r instanceof Ref&&t.has(r)){a.put(r);s.push(r.toString());continue}const e=parseNestedOrder(r,i);e&&s.push(e)}if(i>0)return s;const r=[];for(const[e]of t.items())a.has(e)||r.push(e.toString());r.length&&s.push({name:null,order:r});return s}function parseNestedOrder(e,t){if(++t>s){warn("parseNestedOrder - reached MAX_NESTED_LEVELS.");return null}const a=i.fetchIfRef(e);if(!Array.isArray(a))return null;const r=i.fetchIfRef(a[0]);if("string"!=typeof r)return null;const n=parseOrder(a.slice(1),t);return n?.length?{name:stringToPDFString(r),order:n}:null}const i=this.xref,a=new RefSet,s=10;!function parseRBGroups(e){if(Array.isArray(e))for(const a of e){const e=i.fetchIfRef(a);if(!Array.isArray(e)||!e.length)continue;const s=new Set;for(const i of e)if(i instanceof Ref&&t.has(i)&&!s.has(i.toString())){s.add(i.toString());t.get(i).rbGroups.push(s)}}}(e.get("RBGroups"));return{name:"string"==typeof e.get("Name")?stringToPDFString(e.get("Name")):null,creator:"string"==typeof e.get("Creator")?stringToPDFString(e.get("Creator")):null,baseState:e.get("BaseState")instanceof Name?e.get("BaseState").name:null,on:parseOnOff(e.get("ON")),off:parseOnOff(e.get("OFF")),order:parseOrder(e.get("Order")),groups:[...t]}}setActualNumPages(e=null){this._actualNumPages=e}get hasActualNumPages(){return null!==this._actualNumPages}get _pagesCount(){const e=this.toplevelPagesDict.get("Count");if(!Number.isInteger(e))throw new FormatError("Page count in top-level pages dictionary is not an integer.");return shadow(this,"_pagesCount",e)}get numPages(){return this.hasActualNumPages?this._actualNumPages:this._pagesCount}get destinations(){const e=this._readDests(),t=Object.create(null);if(e instanceof NameTree)for(const[i,a]of e.getAll()){const e=fetchDest(a);e&&(t[stringToPDFString(i)]=e)}else if(e instanceof Dict)for(const[i,a]of e){const e=fetchDest(a);e&&(t[i]=e)}return shadow(this,"destinations",t)}getDestination(e){const t=this._readDests();if(t instanceof NameTree){const i=fetchDest(t.get(e));if(i)return i;const a=this.destinations[e];if(a){warn(`Found "${e}" at an incorrect position in the NameTree.`);return a}}else if(t instanceof Dict){const i=fetchDest(t.get(e));if(i)return i}return null}_readDests(){const e=this._catDict.get("Names");return e?.has("Dests")?new NameTree(e.getRaw("Dests"),this.xref):this._catDict.has("Dests")?this._catDict.get("Dests"):void 0}get pageLabels(){let e=null;try{e=this._readPageLabels()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read page labels.")}return shadow(this,"pageLabels",e)}_readPageLabels(){const e=this._catDict.getRaw("PageLabels");if(!e)return null;const t=new Array(this.numPages);let i=null,a="";const s=new NumberTree(e,this.xref).getAll();let r="",n=1;for(let e=0,g=this.numPages;e=1))throw new FormatError("Invalid start in PageLabel dictionary.");n=e}else n=1}switch(i){case"D":r=n;break;case"R":case"r":r=toRomanNumerals(n,"r"===i);break;case"A":case"a":const e=26,t="a"===i?97:65,a=n-1;r=String.fromCharCode(t+a%e).repeat(Math.floor(a/e)+1);break;default:if(i)throw new FormatError(`Invalid style "${i}" in PageLabel dictionary.`);r=""}t[e]=a+r;n++}return t}get pageLayout(){const e=this._catDict.get("PageLayout");let t="";if(e instanceof Name)switch(e.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":t=e.name}return shadow(this,"pageLayout",t)}get pageMode(){const e=this._catDict.get("PageMode");let t="UseNone";if(e instanceof Name)switch(e.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":t=e.name}return shadow(this,"pageMode",t)}get viewerPreferences(){const e=this._catDict.get("ViewerPreferences");if(!(e instanceof Dict))return shadow(this,"viewerPreferences",null);let t=null;for(const i of e.getKeys()){const a=e.get(i);let s;switch(i){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":"boolean"==typeof a&&(s=a);break;case"NonFullScreenPageMode":if(a instanceof Name)switch(a.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":s=a.name;break;default:s="UseNone"}break;case"Direction":if(a instanceof Name)switch(a.name){case"L2R":case"R2L":s=a.name;break;default:s="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(a instanceof Name)switch(a.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":s=a.name;break;default:s="CropBox"}break;case"PrintScaling":if(a instanceof Name)switch(a.name){case"None":case"AppDefault":s=a.name;break;default:s="AppDefault"}break;case"Duplex":if(a instanceof Name)switch(a.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":s=a.name;break;default:s="None"}break;case"PrintPageRange":if(Array.isArray(a)&&a.length%2==0){a.every(((e,t,i)=>Number.isInteger(e)&&e>0&&(0===t||e>=i[t-1])&&e<=this.numPages))&&(s=a)}break;case"NumCopies":Number.isInteger(a)&&a>0&&(s=a);break;default:warn(`Ignoring non-standard key in ViewerPreferences: ${i}.`);continue}if(void 0!==s){t||(t=Object.create(null));t[i]=s}else warn(`Bad value, for key "${i}", in ViewerPreferences: ${a}.`)}return shadow(this,"viewerPreferences",t)}get openAction(){const e=this._catDict.get("OpenAction"),t=Object.create(null);if(e instanceof Dict){const i=new Dict(this.xref);i.set("A",e);const a={url:null,dest:null,action:null};Catalog.parseDestDictionary({destDict:i,resultObj:a});Array.isArray(a.dest)?t.dest=a.dest:a.action&&(t.action=a.action)}else Array.isArray(e)&&(t.dest=e);return shadow(this,"openAction",objectSize(t)>0?t:null)}get attachments(){const e=this._catDict.get("Names");let t=null;if(e instanceof Dict&&e.has("EmbeddedFiles")){const i=new NameTree(e.getRaw("EmbeddedFiles"),this.xref);for(const[e,a]of i.getAll()){const i=new FileSpec(a,this.xref);t||(t=Object.create(null));t[stringToPDFString(e)]=i.serializable}}return shadow(this,"attachments",t)}get xfaImages(){const e=this._catDict.get("Names");let t=null;if(e instanceof Dict&&e.has("XFAImages")){const i=new NameTree(e.getRaw("XFAImages"),this.xref);for(const[e,a]of i.getAll()){t||(t=new Dict(this.xref));t.set(stringToPDFString(e),a)}}return shadow(this,"xfaImages",t)}_collectJavaScript(){const e=this._catDict.get("Names");let t=null;function appendIfJavaScriptDict(e,i){if(!(i instanceof Dict))return;if(!isName(i.get("S"),"JavaScript"))return;let a=i.get("JS");if(a instanceof BaseStream)a=a.getString();else if("string"!=typeof a)return;a=stringToPDFString(a).replaceAll("\\0","");a&&(t||=new Map).set(e,a)}if(e instanceof Dict&&e.has("JavaScript")){const t=new NameTree(e.getRaw("JavaScript"),this.xref);for(const[e,i]of t.getAll())appendIfJavaScriptDict(stringToPDFString(e),i)}const i=this._catDict.get("OpenAction");i&&appendIfJavaScriptDict("OpenAction",i);return t}get jsActions(){const e=this._collectJavaScript();let t=collectActions(this.xref,this._catDict,fA);if(e){t||=Object.create(null);for(const[i,a]of e)i in t?t[i].push(a):t[i]=[a]}return shadow(this,"jsActions",t)}async fontFallback(e,t){const i=await Promise.all(this.fontCache);for(const a of i)if(a.loadedName===e){a.fallback(t);return}}async cleanup(e=!1){clearGlobalCaches();this.globalImageCache.clear(e);this.pageKidsCountCache.clear();this.pageIndexCache.clear();this.pageDictCache.clear();this.nonBlendModesSet.clear();const t=await Promise.all(this.fontCache);for(const{dict:e}of t)delete e.cacheKey;this.fontCache.clear();this.builtInCMapCache.clear();this.standardFontDataCache.clear();this.systemFontCache.clear()}async getPageDict(e){const t=[this.toplevelPagesDict],i=new RefSet,a=this._catDict.getRaw("Pages");a instanceof Ref&&i.put(a);const s=this.xref,r=this.pageKidsCountCache,n=this.pageIndexCache,g=this.pageDictCache;let o=0;for(;t.length;){const a=t.pop();if(a instanceof Ref){const c=r.get(a);if(c>=0&&o+c<=e){o+=c;continue}if(i.has(a))throw new FormatError("Pages tree contains circular reference.");i.put(a);const C=await(g.get(a)||s.fetchAsync(a));if(C instanceof Dict){let t=C.getRaw("Type");t instanceof Ref&&(t=await s.fetchAsync(t));if(isName(t,"Page")||!C.has("Kids")){r.has(a)||r.put(a,1);n.has(a)||n.put(a,o);if(o===e)return[C,a];o++;continue}}t.push(C);continue}if(!(a instanceof Dict))throw new FormatError("Page dictionary kid reference points to wrong type of object.");const{objId:c}=a;let C=a.getRaw("Count");C instanceof Ref&&(C=await s.fetchAsync(C));if(Number.isInteger(C)&&C>=0){c&&!r.has(c)&&r.put(c,C);if(o+C<=e){o+=C;continue}}let h=a.getRaw("Kids");h instanceof Ref&&(h=await s.fetchAsync(h));if(!Array.isArray(h)){let t=a.getRaw("Type");t instanceof Ref&&(t=await s.fetchAsync(t));if(isName(t,"Page")||!a.has("Kids")){if(o===e)return[a,null];o++;continue}throw new FormatError("Page dictionary kids object is not an array.")}for(let e=h.length-1;e>=0;e--){const i=h[e];t.push(i);a===this.toplevelPagesDict&&i instanceof Ref&&!g.has(i)&&g.put(i,s.fetchAsync(i))}}throw new Error(`Page index ${e} not found.`)}async getAllPageDicts(e=!1){const{ignoreErrors:t}=this.pdfManager.evaluatorOptions,i=[{currentNode:this.toplevelPagesDict,posInKids:0}],a=new RefSet,s=this._catDict.getRaw("Pages");s instanceof Ref&&a.put(s);const r=new Map,n=this.xref,g=this.pageIndexCache;let o=0;function addPageDict(e,t){t&&!g.has(t)&&g.put(t,o);r.set(o++,[e,t])}function addPageError(i){if(i instanceof XRefEntryException&&!e)throw i;if(e&&t&&0===o){warn(`getAllPageDicts - Skipping invalid first page: "${i}".`);i=Dict.empty}r.set(o++,[i,null])}for(;i.length>0;){const e=i.at(-1),{currentNode:t,posInKids:s}=e;let r=t.getRaw("Kids");if(r instanceof Ref)try{r=await n.fetchAsync(r)}catch(e){addPageError(e);break}if(!Array.isArray(r)){addPageError(new FormatError("Page dictionary kids object is not an array."));break}if(s>=r.length){i.pop();continue}const g=r[s];let o;if(g instanceof Ref){if(a.has(g)){addPageError(new FormatError("Pages tree contains circular reference."));break}a.put(g);try{o=await n.fetchAsync(g)}catch(e){addPageError(e);break}}else o=g;if(!(o instanceof Dict)){addPageError(new FormatError("Page dictionary kid reference points to wrong type of object."));break}let c=o.getRaw("Type");if(c instanceof Ref)try{c=await n.fetchAsync(c)}catch(e){addPageError(e);break}isName(c,"Page")||!o.has("Kids")?addPageDict(o,g instanceof Ref?g:null):i.push({currentNode:o,posInKids:0});e.posInKids++}return r}getPageIndex(e){const t=this.pageIndexCache.get(e);if(void 0!==t)return Promise.resolve(t);const i=this.xref;let a=0;const next=t=>function pagesBeforeRef(t){let a,s=0;return i.fetchAsync(t).then((function(i){if(isRefsEqual(t,e)&&!isDict(i,"Page")&&!(i instanceof Dict&&!i.has("Type")&&i.has("Contents")))throw new FormatError("The reference does not point to a /Page dictionary.");if(!i)return null;if(!(i instanceof Dict))throw new FormatError("Node must be a dictionary.");a=i.getRaw("Parent");return i.getAsync("Parent")})).then((function(e){if(!e)return null;if(!(e instanceof Dict))throw new FormatError("Parent must be a dictionary.");return e.getAsync("Kids")})).then((function(e){if(!e)return null;const r=[];let n=!1;for(const a of e){if(!(a instanceof Ref))throw new FormatError("Kid must be a reference.");if(isRefsEqual(a,t)){n=!0;break}r.push(i.fetchAsync(a).then((function(e){if(!(e instanceof Dict))throw new FormatError("Kid node must be a dictionary.");e.has("Count")?s+=e.get("Count"):s++})))}if(!n)throw new FormatError("Kid reference not found in parent\'s kids.");return Promise.all(r).then((function(){return[s,a]}))}))}(t).then((t=>{if(!t){this.pageIndexCache.put(e,a);return a}const[i,s]=t;a+=i;return next(s)}));return next(e)}get baseUrl(){const e=this._catDict.get("URI");if(e instanceof Dict){const t=e.get("Base");if("string"==typeof t){const e=createValidAbsoluteUrl(t,null,{tryConvertEncoding:!0});if(e)return shadow(this,"baseUrl",e.href)}}return shadow(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:e,resultObj:t,docBaseUrl:i=null,docAttachments:a=null}){if(!(e instanceof Dict)){warn("parseDestDictionary: `destDict` must be a dictionary.");return}let s,r,n=e.get("A");if(!(n instanceof Dict))if(e.has("Dest"))n=e.get("Dest");else{n=e.get("AA");n instanceof Dict&&(n.has("D")?n=n.get("D"):n.has("U")&&(n=n.get("U")))}if(n instanceof Dict){const e=n.get("S");if(!(e instanceof Name)){warn("parseDestDictionary: Invalid type in Action dictionary.");return}const i=e.name;switch(i){case"ResetForm":const e=n.get("Flags"),g=!(1&("number"==typeof e?e:0)),o=[],c=[];for(const e of n.get("Fields")||[])e instanceof Ref?c.push(e.toString()):"string"==typeof e&&o.push(stringToPDFString(e));t.resetForm={fields:o,refs:c,include:g};break;case"URI":s=n.get("URI");s instanceof Name&&(s="/"+s.name);break;case"GoTo":r=n.get("D");break;case"Launch":case"GoToR":const C=n.get("F");if(C instanceof Dict){const e=new FileSpec(C,null,!0),{rawFilename:t}=e.serializable;s=t}else"string"==typeof C&&(s=C);const h=fetchRemoteDest(n);h&&"string"==typeof s&&(s=s.split("#",1)[0]+"#"+h);const l=n.get("NewWindow");"boolean"==typeof l&&(t.newWindow=l);break;case"GoToE":const Q=n.get("T");let E;if(a&&Q instanceof Dict){const e=Q.get("R"),t=Q.get("N");isName(e,"C")&&"string"==typeof t&&(E=a[stringToPDFString(t)])}if(E){t.attachment=E;const e=fetchRemoteDest(n);e&&(t.attachmentDest=e)}else warn(\'parseDestDictionary - unimplemented "GoToE" action.\');break;case"Named":const u=n.get("N");u instanceof Name&&(t.action=u.name);break;case"SetOCGState":const d=n.get("State"),f=n.get("PreserveRB");if(!Array.isArray(d)||0===d.length)break;const p=[];for(const e of d)if(e instanceof Name)switch(e.name){case"ON":case"OFF":case"Toggle":p.push(e.name)}else e instanceof Ref&&p.push(e.toString());if(p.length!==d.length)break;t.setOCGState={state:p,preserveRB:"boolean"!=typeof f||f};break;case"JavaScript":const m=n.get("JS");let y;m instanceof BaseStream?y=m.getString():"string"==typeof m&&(y=m);const w=y&&recoverJsURL(stringToPDFString(y));if(w){s=w.url;t.newWindow=w.newWindow;break}default:if("JavaScript"===i||"SubmitForm"===i)break;warn(`parseDestDictionary - unsupported action: "${i}".`)}}else e.has("Dest")&&(r=e.get("Dest"));if("string"==typeof s){const e=createValidAbsoluteUrl(s,i,{addDefaultProtocol:!0,tryConvertEncoding:!0});e&&(t.url=e.href);t.unsafeUrl=s}if(r){r instanceof Name&&(r=r.name);"string"==typeof r?t.dest=stringToPDFString(r):isValidExplicitDest(r)&&(t.dest=r)}}}function addChildren(e,t){if(e instanceof Dict)e=e.getRawValues();else if(e instanceof BaseStream)e=e.dict.getRawValues();else if(!Array.isArray(e))return;for(const a of e)((i=a)instanceof Ref||i instanceof Dict||i instanceof BaseStream||Array.isArray(i))&&t.push(a);var i}class ObjectLoader{constructor(e,t,i){this.dict=e;this.keys=t;this.xref=i;this.refSet=null}async load(){if(this.xref.stream.isDataLoaded)return;const{keys:e,dict:t}=this;this.refSet=new RefSet;const i=[];for(const a of e){const e=t.getRaw(a);void 0!==e&&i.push(e)}return this._walk(i)}async _walk(e){const t=[],i=[];for(;e.length;){let a=e.pop();if(a instanceof Ref){if(this.refSet.has(a))continue;try{this.refSet.put(a);a=this.xref.fetch(a)}catch(e){if(!(e instanceof MissingDataException)){warn(`ObjectLoader._walk - requesting all data: "${e}".`);this.refSet=null;const{manager:t}=this.xref.stream;return t.requestAllChunks()}t.push(a);i.push({begin:e.begin,end:e.end})}}if(a instanceof BaseStream){const e=a.getBaseStreams();if(e){let s=!1;for(const t of e)if(!t.isDataLoaded){s=!0;i.push({begin:t.start,end:t.end})}s&&t.push(a)}}addChildren(a,e)}if(i.length){await this.xref.stream.manager.requestRanges(i);for(const e of t)e instanceof Ref&&this.refSet.remove(e);return this._walk(t)}this.refSet=null}}const xs=Symbol(),Ls=Symbol(),Hs=Symbol(),Js=Symbol(),Ys=Symbol(),vs=Symbol(),Ks=Symbol(),Ts=Symbol(),qs=Symbol(),Os=Symbol("content"),Ws=Symbol("data"),js=Symbol(),Xs=Symbol("extra"),Zs=Symbol(),Vs=Symbol(),zs=Symbol(),_s=Symbol(),$s=Symbol(),Ar=Symbol(),er=Symbol(),tr=Symbol(),ir=Symbol(),ar=Symbol(),sr=Symbol(),rr=Symbol(),nr=Symbol(),gr=Symbol(),or=Symbol(),Ir=Symbol(),cr=Symbol(),Cr=Symbol(),hr=Symbol(),lr=Symbol(),Qr=Symbol(),Er=Symbol(),ur=Symbol(),dr=Symbol(),fr=Symbol(),pr=Symbol(),mr=Symbol(),yr=Symbol(),wr=Symbol(),Dr=Symbol(),br=Symbol(),Fr=Symbol(),Sr=Symbol("namespaceId"),kr=Symbol("nodeName"),Rr=Symbol(),Nr=Symbol(),Gr=Symbol(),Mr=Symbol(),Ur=Symbol(),xr=Symbol(),Lr=Symbol(),Hr=Symbol(),Jr=Symbol("root"),Yr=Symbol(),vr=Symbol(),Kr=Symbol(),Tr=Symbol(),qr=Symbol(),Or=Symbol(),Pr=Symbol(),Wr=Symbol(),jr=Symbol(),Xr=Symbol(),Zr=Symbol(),Vr=Symbol("uid"),zr=Symbol(),_r={config:{id:0,check:e=>e.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:e=>"http://ns.adobe.com/xdp/pdf/"===e},signature:{id:6,check:e=>"http://www.w3.org/2000/09/xmldsig#"===e},sourceSet:{id:7,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:e=>"http://www.w3.org/1999/XSL/Transform"===e},template:{id:9,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:e=>e.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:e=>"http://ns.adobe.com/xdp/"===e},xfdf:{id:12,check:e=>"http://ns.adobe.com/xfdf/"===e},xhtml:{id:13,check:e=>"http://www.w3.org/1999/xhtml"===e},xmpmeta:{id:14,check:e=>"http://ns.adobe.com/xmpmeta/"===e}},$r={pt:e=>e,cm:e=>e/2.54*72,mm:e=>e/25.4*72,in:e=>72*e,px:e=>e},An=/([+-]?\\d+\\.?\\d*)(.*)/;function stripQuotes(e){return e.startsWith("\'")||e.startsWith(\'"\')?e.slice(1,-1):e}function getInteger({data:e,defaultValue:t,validate:i}){if(!e)return t;e=e.trim();const a=parseInt(e,10);return!isNaN(a)&&i(a)?a:t}function getFloat({data:e,defaultValue:t,validate:i}){if(!e)return t;e=e.trim();const a=parseFloat(e);return!isNaN(a)&&i(a)?a:t}function getKeyword({data:e,defaultValue:t,validate:i}){return e&&i(e=e.trim())?e:t}function getStringOption(e,t){return getKeyword({data:e,defaultValue:t[0],validate:e=>t.includes(e)})}function getMeasurement(e,t="0"){t||="0";if(!e)return getMeasurement(t);const i=e.trim().match(An);if(!i)return getMeasurement(t);const[,a,s]=i,r=parseFloat(a);if(isNaN(r))return getMeasurement(t);if(0===r)return 0;const n=$r[s];return n?n(r):r}function getRatio(e){if(!e)return{num:1,den:1};const t=e.trim().split(/\\s*:\\s*/).map((e=>parseFloat(e))).filter((e=>!isNaN(e)));1===t.length&&t.push(1);if(0===t.length)return{num:1,den:1};const[i,a]=t;return{num:i,den:a}}function getRelevant(e){return e?e.trim().split(/\\s+/).map((e=>({excluded:"-"===e[0],viewname:e.substring(1)}))):[]}class HTMLResult{static get FAILURE(){return shadow(this,"FAILURE",new HTMLResult(!1,null,null,null))}static get EMPTY(){return shadow(this,"EMPTY",new HTMLResult(!0,null,null,null))}constructor(e,t,i,a){this.success=e;this.html=t;this.bbox=i;this.breakNode=a}isBreak(){return!!this.breakNode}static breakNode(e){return new HTMLResult(!1,null,null,e)}static success(e,t=null){return new HTMLResult(!0,e,t,null)}}class FontFinder{constructor(e){this.fonts=new Map;this.cache=new Map;this.warned=new Set;this.defaultFont=null;this.add(e)}add(e,t=null){for(const t of e)this.addPdfFont(t);for(const e of this.fonts.values())e.regular||(e.regular=e.italic||e.bold||e.bolditalic);if(!t||0===t.size)return;const i=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(const e of t)this.fonts.set(e,i)}addPdfFont(e){const t=e.cssFontInfo,i=t.fontFamily;let a=this.fonts.get(i);if(!a){a=Object.create(null);this.fonts.set(i,a);this.defaultFont||(this.defaultFont=a)}let s="";const r=parseFloat(t.fontWeight);0!==parseFloat(t.italicAngle)?s=r>=700?"bolditalic":"italic":r>=700&&(s="bold");if(!s){(e.name.includes("Bold")||e.psName?.includes("Bold"))&&(s="bold");(e.name.includes("Italic")||e.name.endsWith("It")||e.psName?.includes("Italic")||e.psName?.endsWith("It"))&&(s+="italic")}s||(s="regular");a[s]=e}getDefault(){return this.defaultFont}find(e,t=!0){let i=this.fonts.get(e)||this.cache.get(e);if(i)return i;const a=/,|-|_| |bolditalic|bold|italic|regular|it/gi;let s=e.replaceAll(a,"");i=this.fonts.get(s);if(i){this.cache.set(e,i);return i}s=s.toLowerCase();const r=[];for(const[e,t]of this.fonts.entries())e.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(t);if(0===r.length)for(const[,e]of this.fonts.entries())e.regular.name?.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(e);if(0===r.length){s=s.replaceAll(/psmt|mt/gi,"");for(const[e,t]of this.fonts.entries())e.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(t)}if(0===r.length)for(const e of this.fonts.values())e.regular.name?.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(e);if(r.length>=1){1!==r.length&&t&&warn(`XFA - Too many choices to guess the correct font: ${e}`);this.cache.set(e,r[0]);return r[0]}if(t&&!this.warned.has(e)){this.warned.add(e);warn(`XFA - Cannot find the font: ${e}`)}return null}}function selectFont(e,t){return"italic"===e.posture?"bold"===e.weight?t.bolditalic:t.italic:"bold"===e.weight?t.bold:t.regular}class FontInfo{constructor(e,t,i,a){this.lineHeight=i;this.paraMargin=t||{top:0,bottom:0,left:0,right:0};if(!e){[this.pdfFont,this.xfaFont]=this.defaultFont(a);return}this.xfaFont={typeface:e.typeface,posture:e.posture,weight:e.weight,size:e.size,letterSpacing:e.letterSpacing};const s=a.find(e.typeface);if(s){this.pdfFont=selectFont(e,s);this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(a))}else[this.pdfFont,this.xfaFont]=this.defaultFont(a)}defaultFont(e){const t=e.find("Helvetica",!1)||e.find("Myriad Pro",!1)||e.find("Arial",!1)||e.getDefault();if(t?.regular){const e=t.regular;return[e,{typeface:e.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0}]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}}class FontSelector{constructor(e,t,i,a){this.fontFinder=a;this.stack=[new FontInfo(e,t,i,a)]}pushData(e,t,i){const a=this.stack.at(-1);for(const t of["typeface","posture","weight","size","letterSpacing"])e[t]||(e[t]=a.xfaFont[t]);for(const e of["top","bottom","left","right"])isNaN(t[e])&&(t[e]=a.paraMargin[e]);const s=new FontInfo(e,t,i||a.lineHeight,this.fontFinder);s.pdfFont||(s.pdfFont=a.pdfFont);this.stack.push(s)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}}class TextMeasure{constructor(e,t,i,a){this.glyphs=[];this.fontSelector=new FontSelector(e,t,i,a);this.extraHeight=0}pushData(e,t,i){this.fontSelector.pushData(e,t,i)}popFont(e){return this.fontSelector.popFont()}addPara(){const e=this.fontSelector.topFont();this.extraHeight+=e.paraMargin.top+e.paraMargin.bottom}addString(e){if(!e)return;const t=this.fontSelector.topFont(),i=t.xfaFont.size;if(t.pdfFont){const a=t.xfaFont.letterSpacing,s=t.pdfFont,r=s.lineHeight||1.2,n=t.lineHeight||Math.max(1.2,r)*i,g=r-(void 0===s.lineGap?.2:s.lineGap),o=Math.max(1,g)*i,c=i/1e3,C=s.defaultWidth||s.charsToGlyphs(" ")[0].width;for(const t of e.split(/[\\u2029\\n]/)){const e=s.encodeString(t).join(""),i=s.charsToGlyphs(e);for(const e of i){const t=e.width||C;this.glyphs.push([t*c+a,n,o,e.unicode,!1])}this.glyphs.push([0,0,0,"\\n",!0])}this.glyphs.pop()}else{for(const t of e.split(/[\\u2029\\n]/)){for(const e of t.split(""))this.glyphs.push([i,1.2*i,i,e,!1]);this.glyphs.push([0,0,0,"\\n",!0])}this.glyphs.pop()}}compute(e){let t=-1,i=0,a=0,s=0,r=0,n=0,g=!1,o=!0;for(let c=0,C=this.glyphs.length;ce){a=Math.max(a,r);r=0;s+=n;n=d;t=-1;i=0;g=!0;o=!1}else{n=Math.max(d,n);i=r;r+=C;t=c}else if(r+C>e){s+=n;n=d;if(-1!==t){c=t;a=Math.max(a,i);r=0;t=-1;i=0}else{a=Math.max(a,r);r=C}g=!0;o=!1}else{r+=C;n=Math.max(d,n)}}a=Math.max(a,r);s+=n+this.extraHeight;return{width:1.02*a,height:s,isBroken:g}}}const en=/^[^.[]+/,tn=/^[^\\]]+/,an=0,sn=1,rn=2,nn=3,gn=4,on=new Map([["$data",(e,t)=>e.datasets?e.datasets.data:e],["$record",(e,t)=>(e.datasets?e.datasets.data:e)[rr]()[0]],["$template",(e,t)=>e.template],["$connectionSet",(e,t)=>e.connectionSet],["$form",(e,t)=>e.form],["$layout",(e,t)=>e.layout],["$host",(e,t)=>e.host],["$dataWindow",(e,t)=>e.dataWindow],["$event",(e,t)=>e.event],["!",(e,t)=>e.datasets],["$xfa",(e,t)=>e],["xfa",(e,t)=>e],["$",(e,t)=>t]]),In=new WeakMap;function parseExpression(e,t,i=!0){let a=e.match(en);if(!a)return null;let[s]=a;const r=[{name:s,cacheName:"."+s,index:0,js:null,formCalc:null,operator:an}];let n=s.length;for(;n0&&C.push(e)}if(0!==C.length||g||0!==o)e=isFinite(c)?C.filter((e=>ce[c])):C.flat();else{const i=t[Ir]();if(!(t=i))return null;o=-1;e=[t]}}return 0===e.length?null:e}function createDataNode(e,t,i){const a=parseExpression(i);if(!a)return null;if(a.some((e=>e.operator===sn)))return null;const s=on.get(a[0].name);let r=0;if(s){e=s(e,t);r=1}else e=t||e;for(let t=a.length;re[Pr]())).join("")}get[hn](){const e=Object.getPrototypeOf(this);if(!e._attributes){const t=e._attributes=new Set;for(const e of Object.getOwnPropertyNames(this)){if(null===this[e]||this[e]instanceof XFAObject||this[e]instanceof XFAObjectArray)break;t.add(e)}}return shadow(this,hn,e._attributes)}[pr](e){let t=this;for(;t;){if(t===e)return!0;t=t[Ir]()}return!1}[Ir](){return this[wn]}[or](){return this[Ir]()}[rr](e=null){return e?this[e]:this[ln]}[js](){const e=Object.create(null);this[Os]&&(e.$content=this[Os]);for(const t of Object.getOwnPropertyNames(this)){const i=this[t];null!==i&&(i instanceof XFAObject?e[t]=i[js]():i instanceof XFAObjectArray?i.isEmpty()||(e[t]=i.dump()):e[t]=i)}return e}[Zr](){return null}[jr](){return HTMLResult.EMPTY}*[nr](){for(const e of this[rr]())yield e}*[un](e,t){for(const i of this[nr]())if(!e||t===e.has(i[kr])){const e=this[$s](),t=i[jr](e);t.success||(this[Xs].failingNode=i);yield t}}[Vs](){return null}[Ls](e,t){this[Xs].children.push(e)}[$s](){}[Js]({filter:e=null,include:t=!0}){if(this[Xs].generator){const e=this[$s](),t=this[Xs].failingNode[jr](e);if(!t.success)return t;t.html&&this[Ls](t.html,t.bbox);delete this[Xs].failingNode}else this[Xs].generator=this[un](e,t);for(;;){const e=this[Xs].generator.next();if(e.done)break;const t=e.value;if(!t.success)return t;t.html&&this[Ls](t.html,t.bbox)}this[Xs].generator=null;return HTMLResult.EMPTY}[Tr](e){this[bn]=new Set(Object.keys(e))}[fn](e){const t=this[hn],i=this[bn];return[...e].filter((e=>t.has(e)&&!i.has(e)))}[Yr](e,t=new Set){for(const i of this[ln])i[Dn](e,t)}[Dn](e,t){const i=this[dn](e,t);i?this[cn](i,e,t):this[Yr](e,t)}[dn](e,t){const{use:i,usehref:a}=this;if(!i&&!a)return null;let s=null,r=null,n=null,g=i;if(a){g=a;a.startsWith("#som(")&&a.endsWith(")")?r=a.slice(5,-1):a.startsWith(".#som(")&&a.endsWith(")")?r=a.slice(6,-1):a.startsWith("#")?n=a.slice(1):a.startsWith(".#")&&(n=a.slice(2))}else i.startsWith("#")?n=i.slice(1):r=i;this.use=this.usehref="";if(n)s=e.get(n);else{s=searchNode(e.get(Jr),this,r,!0,!1);s&&(s=s[0])}if(!s){warn(`XFA - Invalid prototype reference: ${g}.`);return null}if(s[kr]!==this[kr]){warn(`XFA - Incompatible prototype: ${s[kr]} !== ${this[kr]}.`);return null}if(t.has(s)){warn("XFA - Cycle detected in prototypes use.");return null}t.add(s);const o=s[dn](e,t);o&&s[cn](o,e,t);s[Yr](e,t);t.delete(s);return s}[cn](e,t,i){if(i.has(e)){warn("XFA - Cycle detected in prototypes use.");return}!this[Os]&&e[Os]&&(this[Os]=e[Os]);new Set(i).add(e);for(const t of this[fn](e[bn])){this[t]=e[t];this[bn]&&this[bn].add(t)}for(const a of Object.getOwnPropertyNames(this)){if(this[hn].has(a))continue;const s=this[a],r=e[a];if(s instanceof XFAObjectArray){for(const e of s[ln])e[Dn](t,i);for(let a=s[ln].length,n=r[ln].length;aXFAObject[Bn](e))):"object"==typeof e&&null!==e?Object.assign({},e):e}[Ts](){const e=Object.create(Object.getPrototypeOf(this));for(const t of Object.getOwnPropertySymbols(this))try{e[t]=this[t]}catch{shadow(e,t,this[t])}e[Vr]=`${e[kr]}${Sn++}`;e[ln]=[];for(const t of Object.getOwnPropertyNames(this)){if(this[hn].has(t)){e[t]=XFAObject[Bn](this[t]);continue}const i=this[t];e[t]=i instanceof XFAObjectArray?new XFAObjectArray(i[mn]):null}for(const t of this[ln]){const i=t[kr],a=t[Ts]();e[ln].push(a);a[wn]=e;null===e[i]?e[i]=a:e[i][ln].push(a)}return e}[rr](e=null){return e?this[ln].filter((t=>t[kr]===e)):this[ln]}[Ar](e){return this[e]}[er](e,t,i=!0){return Array.from(this[tr](e,t,i))}*[tr](e,t,i=!0){if("parent"!==e){for(const i of this[ln]){i[kr]===e&&(yield i);i.name===e&&(yield i);(t||i[Dr]())&&(yield*i[tr](e,t,!1))}i&&this[hn].has(e)&&(yield new XFAAttribute(this,e,this[e]))}else yield this[wn]}}class XFAObjectArray{constructor(e=1/0){this[mn]=e;this[ln]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(e){if(this[ln].length<=this[mn]){this[ln].push(e);return!0}warn(`XFA - node "${e[kr]}" accepts no more than ${this[mn]} children`);return!1}isEmpty(){return 0===this[ln].length}dump(){return 1===this[ln].length?this[ln][0][js]():this[ln].map((e=>e[js]()))}[Ts](){const e=new XFAObjectArray(this[mn]);e[ln]=this[ln].map((e=>e[Ts]()));return e}get children(){return this[ln]}clear(){this[ln].length=0}}class XFAAttribute{constructor(e,t,i){this[wn]=e;this[kr]=t;this[Os]=i;this[qs]=!1;this[Vr]="attribute"+Sn++}[Ir](){return this[wn]}[fr](){return!0}[ir](){return this[Os].trim()}[qr](e){e=e.value||"";this[Os]=e.toString()}[Pr](){return this[Os]}[pr](e){return this[wn]===e||this[wn][pr](e)}}class XmlObject extends XFAObject{constructor(e,t,i={}){super(e,t);this[Os]="";this[Qn]=null;if("#text"!==t){const e=new Map;this[Cn]=e;for(const[t,a]of Object.entries(i))e.set(t,new XFAAttribute(this,t,a));if(i.hasOwnProperty(Rr)){const e=i[Rr].xfa.dataNode;void 0!==e&&("dataGroup"===e?this[Qn]=!1:"dataValue"===e&&(this[Qn]=!0))}}this[qs]=!1}[Xr](e){const t=this[kr];if("#text"===t){e.push(encodeToXmlString(this[Os]));return}const i=utf8StringToString(t),a=this[Sr]===kn?"xfa:":"";e.push(`<${a}${i}`);for(const[t,i]of this[Cn].entries()){const a=utf8StringToString(t);e.push(` ${a}="${encodeToXmlString(i[Os])}"`)}null!==this[Qn]&&(this[Qn]?e.push(\' xfa:dataNode="dataValue"\'):e.push(\' xfa:dataNode="dataGroup"\'));if(this[Os]||0!==this[ln].length){e.push(">");if(this[Os])"string"==typeof this[Os]?e.push(encodeToXmlString(this[Os])):this[Os][Xr](e);else for(const t of this[ln])t[Xr](e);e.push(``)}else e.push("/>")}[Nr](e){if(this[Os]){const e=new XmlObject(this[Sr],"#text");this[Hs](e);e[Os]=this[Os];this[Os]=""}this[Hs](e);return!0}[Mr](e){this[Os]+=e}[Zs](){if(this[Os]&&this[ln].length>0){const e=new XmlObject(this[Sr],"#text");this[Hs](e);e[Os]=this[Os];delete this[Os]}}[jr](){return"#text"===this[kr]?HTMLResult.success({name:"#text",value:this[Os]}):HTMLResult.EMPTY}[rr](e=null){return e?this[ln].filter((t=>t[kr]===e)):this[ln]}[_s](){return this[Cn]}[Ar](e){const t=this[Cn].get(e);return void 0!==t?t:this[rr](e)}*[tr](e,t){const i=this[Cn].get(e);i&&(yield i);for(const i of this[ln]){i[kr]===e&&(yield i);t&&(yield*i[tr](e,t))}}*[zs](e,t){const i=this[Cn].get(e);!i||t&&i[qs]||(yield i);for(const i of this[ln])yield*i[zs](e,t)}*[sr](e,t,i){for(const a of this[ln]){a[kr]!==e||i&&a[qs]||(yield a);t&&(yield*a[sr](e,t,i))}}[fr](){return null===this[Qn]?0===this[ln].length||this[ln][0][Sr]===_r.xhtml.id:this[Qn]}[ir](){return null===this[Qn]?0===this[ln].length?this[Os].trim():this[ln][0][Sr]===_r.xhtml.id?this[ln][0][Pr]().trim():null:this[Os].trim()}[qr](e){e=e.value||"";this[Os]=e.toString()}[js](e=!1){const t=Object.create(null);e&&(t.$ns=this[Sr]);this[Os]&&(t.$content=this[Os]);t.$name=this[kr];t.children=[];for(const i of this[ln])t.children.push(i[js](e));t.attributes=Object.create(null);for(const[e,i]of this[Cn])t.attributes[e]=i[Os];return t}}class ContentObject extends XFAObject{constructor(e,t){super(e,t);this[Os]=""}[Mr](e){this[Os]+=e}[Zs](){}}class OptionObject extends ContentObject{constructor(e,t,i){super(e,t);this[yn]=i}[Zs](){this[Os]=getKeyword({data:this[Os],defaultValue:this[yn][0],validate:e=>this[yn].includes(e)})}[Ys](e){super[Ys](e);delete this[yn]}}class StringObject extends ContentObject{[Zs](){this[Os]=this[Os].trim()}}class IntegerObject extends ContentObject{constructor(e,t,i,a){super(e,t);this[En]=i;this[Fn]=a}[Zs](){this[Os]=getInteger({data:this[Os],defaultValue:this[En],validate:this[Fn]})}[Ys](e){super[Ys](e);delete this[En];delete this[Fn]}}class Option01 extends IntegerObject{constructor(e,t){super(e,t,0,(e=>1===e))}}class Option10 extends IntegerObject{constructor(e,t){super(e,t,1,(e=>0===e))}}function measureToString(e){return"string"==typeof e?"0px":Number.isInteger(e)?`${e}px`:`${e.toFixed(2)}px`}const Rn={anchorType(e,t){const i=e[or]();if(i&&(!i.layout||"position"===i.layout)){"transform"in t||(t.transform="");switch(e.anchorType){case"bottomCenter":t.transform+="translate(-50%, -100%)";break;case"bottomLeft":t.transform+="translate(0,-100%)";break;case"bottomRight":t.transform+="translate(-100%,-100%)";break;case"middleCenter":t.transform+="translate(-50%,-50%)";break;case"middleLeft":t.transform+="translate(0,-50%)";break;case"middleRight":t.transform+="translate(-100%,-50%)";break;case"topCenter":t.transform+="translate(-50%,0)";break;case"topRight":t.transform+="translate(-100%,0)"}}},dimensions(e,t){const i=e[or]();let a=e.w;const s=e.h;if(i.layout?.includes("row")){const t=i[Xs],s=e.colSpan;let r;if(-1===s){r=t.columnWidths.slice(t.currentColumn).reduce(((e,t)=>e+t),0);t.currentColumn=0}else{r=t.columnWidths.slice(t.currentColumn,t.currentColumn+s).reduce(((e,t)=>e+t),0);t.currentColumn=(t.currentColumn+e.colSpan)%t.columnWidths.length}isNaN(r)||(a=e.w=r)}t.width=""!==a?measureToString(a):"auto";t.height=""!==s?measureToString(s):"auto"},position(e,t){const i=e[or]();if(!i?.layout||"position"===i.layout){t.position="absolute";t.left=measureToString(e.x);t.top=measureToString(e.y)}},rotate(e,t){if(e.rotate){"transform"in t||(t.transform="");t.transform+=`rotate(-${e.rotate}deg)`;t.transformOrigin="top left"}},presence(e,t){switch(e.presence){case"invisible":t.visibility="hidden";break;case"hidden":case"inactive":t.display="none"}},hAlign(e,t){if("para"===e[kr])switch(e.hAlign){case"justifyAll":t.textAlign="justify-all";break;case"radix":t.textAlign="left";break;default:t.textAlign=e.hAlign}else switch(e.hAlign){case"left":t.alignSelf="start";break;case"center":t.alignSelf="center";break;case"right":t.alignSelf="end"}},margin(e,t){e.margin&&(t.margin=e.margin[Zr]().margin)}};function setMinMaxDimensions(e,t){if("position"===e[or]().layout){e.minW>0&&(t.minWidth=measureToString(e.minW));e.maxW>0&&(t.maxWidth=measureToString(e.maxW));e.minH>0&&(t.minHeight=measureToString(e.minH));e.maxH>0&&(t.maxHeight=measureToString(e.maxH))}}function layoutText(e,t,i,a,s,r){const n=new TextMeasure(t,i,a,s);"string"==typeof e?n.addString(e):e[Ur](n);return n.compute(r)}function layoutNode(e,t){let i=null,a=null,s=!1;if((!e.w||!e.h)&&e.value){let r=0,n=0;if(e.margin){r=e.margin.leftInset+e.margin.rightInset;n=e.margin.topInset+e.margin.bottomInset}let g=null,o=null;if(e.para){o=Object.create(null);g=""===e.para.lineHeight?null:e.para.lineHeight;o.top=""===e.para.spaceAbove?0:e.para.spaceAbove;o.bottom=""===e.para.spaceBelow?0:e.para.spaceBelow;o.left=""===e.para.marginLeft?0:e.para.marginLeft;o.right=""===e.para.marginRight?0:e.para.marginRight}let c=e.font;if(!c){const t=e[cr]();let i=e[Ir]();for(;i&&i!==t;){if(i.font){c=i.font;break}i=i[Ir]()}}const C=(e.w||t.width)-r,h=e[Cr].fontFinder;if(e.value.exData&&e.value.exData[Os]&&"text/html"===e.value.exData.contentType){const t=layoutText(e.value.exData[Os],c,o,g,h,C);a=t.width;i=t.height;s=t.isBroken}else{const t=e.value[Pr]();if(t){const e=layoutText(t,c,o,g,h,C);a=e.width;i=e.height;s=e.isBroken}}null===a||e.w||(a+=r);null===i||e.h||(i+=n)}return{w:a,h:i,isBroken:s}}function computeBbox(e,t,i){let a;if(""!==e.w&&""!==e.h)a=[e.x,e.y,e.w,e.h];else{if(!i)return null;let s=e.w;if(""===s){if(0===e.maxW){const t=e[or]();s="position"===t.layout&&""!==t.w?0:e.minW}else s=Math.min(e.maxW,i.width);t.attributes.style.width=measureToString(s)}let r=e.h;if(""===r){if(0===e.maxH){const t=e[or]();r="position"===t.layout&&""!==t.h?0:e.minH}else r=Math.min(e.maxH,i.height);t.attributes.style.height=measureToString(r)}a=[e.x,e.y,s,r]}return a}function fixDimensions(e){const t=e[or]();if(t.layout?.includes("row")){const i=t[Xs],a=e.colSpan;let s;s=-1===a?i.columnWidths.slice(i.currentColumn).reduce(((e,t)=>e+t),0):i.columnWidths.slice(i.currentColumn,i.currentColumn+a).reduce(((e,t)=>e+t),0);isNaN(s)||(e.w=s)}t.layout&&"position"!==t.layout&&(e.x=e.y=0);"table"===e.layout&&""===e.w&&Array.isArray(e.columnWidths)&&(e.w=e.columnWidths.reduce(((e,t)=>e+t),0))}function layoutClass(e){switch(e.layout){case"position":default:return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb"}}function toStyle(e,...t){const i=Object.create(null);for(const a of t){const t=e[a];if(null!==t)if(Rn.hasOwnProperty(a))Rn[a](e,i);else if(t instanceof XFAObject){const e=t[Zr]();e?Object.assign(i,e):warn(`(DEBUG) - XFA - style for ${a} not implemented yet`)}}return i}function createWrapper(e,t){const{attributes:i}=t,{style:a}=i,s={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};i.class.push("xfaWrapped");if(e.border){const{widths:i,insets:r}=e.border[Xs];let n,g,o=r[0],c=r[3];const C=r[0]+r[2],h=r[1]+r[3];switch(e.border.hand){case"even":o-=i[0]/2;c-=i[3]/2;n=`calc(100% + ${(i[1]+i[3])/2-h}px)`;g=`calc(100% + ${(i[0]+i[2])/2-C}px)`;break;case"left":o-=i[0];c-=i[3];n=`calc(100% + ${i[1]+i[3]-h}px)`;g=`calc(100% + ${i[0]+i[2]-C}px)`;break;case"right":n=h?`calc(100% - ${h}px)`:"100%";g=C?`calc(100% - ${C}px)`:"100%"}const l=["xfaBorder"];isPrintOnly(e.border)&&l.push("xfaPrintOnly");const Q={name:"div",attributes:{class:l,style:{top:`${o}px`,left:`${c}px`,width:n,height:g}},children:[]};for(const e of["border","borderWidth","borderColor","borderRadius","borderStyle"])if(void 0!==a[e]){Q.attributes.style[e]=a[e];delete a[e]}s.children.push(Q,t)}else s.children.push(t);for(const e of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])if(void 0!==a[e]){s.attributes.style[e]=a[e];delete a[e]}s.attributes.style.position="absolute"===a.position?"absolute":"relative";delete a.position;if(a.alignSelf){s.attributes.style.alignSelf=a.alignSelf;delete a.alignSelf}return s}function fixTextIndent(e){const t=getMeasurement(e.textIndent,"0px");if(t>=0)return;const i="padding"+("left"===("right"===e.textAlign?"right":"left")?"Left":"Right"),a=getMeasurement(e[i],"0px");e[i]=a-t+"px"}function setAccess(e,t){switch(e.access){case"nonInteractive":t.push("xfaNonInteractive");break;case"readOnly":t.push("xfaReadOnly");break;case"protected":t.push("xfaDisabled")}}function isPrintOnly(e){return e.relevant.length>0&&!e.relevant[0].excluded&&"print"===e.relevant[0].viewname}function getCurrentPara(e){const t=e[cr]()[Xs].paraStack;return t.length?t.at(-1):null}function setPara(e,t,i){if(i.attributes.class?.includes("xfaRich")){if(t){""===e.h&&(t.height="auto");""===e.w&&(t.width="auto")}const a=getCurrentPara(e);if(a){const e=i.attributes.style;e.display="flex";e.flexDirection="column";switch(a.vAlign){case"top":e.justifyContent="start";break;case"bottom":e.justifyContent="end";break;case"middle":e.justifyContent="center"}const t=a[Zr]();for(const[i,a]of Object.entries(t))i in e||(e[i]=a)}}}function setFontFamily(e,t,i,a){if(!i){delete a.fontFamily;return}const s=stripQuotes(e.typeface);a.fontFamily=`"${s}"`;const r=i.find(s);if(r){const{fontFamily:i}=r.regular.cssFontInfo;i!==s&&(a.fontFamily=`"${i}"`);const n=getCurrentPara(t);if(n&&""!==n.lineHeight)return;if(a.lineHeight)return;const g=selectFont(e,r);g&&(a.lineHeight=Math.max(1.2,g.lineHeight))}}function fixURL(e){const t=createValidAbsoluteUrl(e,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return t?t.href:null}function createLine(e,t){return{name:"div",attributes:{class:["lr-tb"===e.layout?"xfaLr":"xfaRl"]},children:t}}function flushHTML(e){if(!e[Xs])return null;const t={name:"div",attributes:e[Xs].attributes,children:e[Xs].children};if(e[Xs].failingNode){const i=e[Xs].failingNode[Vs]();i&&(e.layout.endsWith("-tb")?t.children.push(createLine(e,[i])):t.children.push(i))}return 0===t.children.length?null:t}function addHTML(e,t,i){const a=e[Xs],s=a.availableSpace,[r,n,g,o]=i;switch(e.layout){case"position":a.width=Math.max(a.width,r+g);a.height=Math.max(a.height,n+o);a.children.push(t);break;case"lr-tb":case"rl-tb":if(!a.line||1===a.attempt){a.line=createLine(e,[]);a.children.push(a.line);a.numberInLine=0}a.numberInLine+=1;a.line.children.push(t);if(0===a.attempt){a.currentWidth+=g;a.height=Math.max(a.height,a.prevHeight+o)}else{a.currentWidth=g;a.prevHeight=a.height;a.height+=o;a.attempt=0}a.width=Math.max(a.width,a.currentWidth);break;case"rl-row":case"row":{a.children.push(t);a.width+=g;a.height=Math.max(a.height,o);const e=measureToString(a.height);for(const t of a.children)t.attributes.style.height=e;break}case"table":case"tb":a.width=Math.min(s.width,Math.max(a.width,g));a.height+=o;a.children.push(t)}}function getAvailableSpace(e){const t=e[Xs].availableSpace,i=e.margin?e.margin.topInset+e.margin.bottomInset:0,a=e.margin?e.margin.leftInset+e.margin.rightInset:0;switch(e.layout){case"lr-tb":case"rl-tb":return 0===e[Xs].attempt?{width:t.width-a-e[Xs].currentWidth,height:t.height-i-e[Xs].prevHeight}:{width:t.width-a,height:t.height-i-e[Xs].height};case"rl-row":case"row":return{width:e[Xs].columnWidths.slice(e[Xs].currentColumn).reduce(((e,t)=>e+t)),height:t.height-a};case"table":case"tb":return{width:t.width-a,height:t.height-i-e[Xs].height};default:return t}}function checkDimensions(e,t){if(null===e[cr]()[Xs].firstUnsplittable)return!0;if(0===e.w||0===e.h)return!0;const i=e[or](),a=i[Xs]?.attempt||0,[,s,r,n]=function getTransformedBBox(e){let t,i,a=""===e.w?NaN:e.w,s=""===e.h?NaN:e.h,[r,n]=[0,0];switch(e.anchorType||""){case"bottomCenter":[r,n]=[a/2,s];break;case"bottomLeft":[r,n]=[0,s];break;case"bottomRight":[r,n]=[a,s];break;case"middleCenter":[r,n]=[a/2,s/2];break;case"middleLeft":[r,n]=[0,s/2];break;case"middleRight":[r,n]=[a,s/2];break;case"topCenter":[r,n]=[a/2,0];break;case"topRight":[r,n]=[a,0]}switch(e.rotate||0){case 0:[t,i]=[-r,-n];break;case 90:[t,i]=[-n,r];[a,s]=[s,-a];break;case 180:[t,i]=[r,n];[a,s]=[-a,-s];break;case 270:[t,i]=[n,-r];[a,s]=[-s,a]}return[e.x+t+Math.min(0,a),e.y+i+Math.min(0,s),Math.abs(a),Math.abs(s)]}(e);switch(i.layout){case"lr-tb":case"rl-tb":return 0===a?e[cr]()[Xs].noLayoutFailure?""!==e.w?Math.round(r-t.width)<=2:t.width>2:!(""!==e.h&&Math.round(n-t.height)>2)&&(""!==e.w?Math.round(r-t.width)<=2||0===i[Xs].numberInLine&&t.height>2:t.width>2):!!e[cr]()[Xs].noLayoutFailure||!(""!==e.h&&Math.round(n-t.height)>2)&&((""===e.w||Math.round(r-t.width)<=2||!i[wr]())&&t.height>2);case"table":case"tb":return!!e[cr]()[Xs].noLayoutFailure||(""===e.h||e[yr]()?(""===e.w||Math.round(r-t.width)<=2||!i[wr]())&&t.height>2:Math.round(n-t.height)<=2);case"position":if(e[cr]()[Xs].noLayoutFailure)return!0;if(""===e.h||Math.round(n+s-t.height)<=2)return!0;return n+s>e[cr]()[Xs].currentContentArea.h;case"rl-row":case"row":return!!e[cr]()[Xs].noLayoutFailure||(""===e.h||Math.round(n-t.height)<=2);default:return!0}}const Nn=_r.template.id,Gn="http://www.w3.org/2000/svg",Mn=/^H(\\d+)$/,Un=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),xn=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function getBorderDims(e){if(!e||!e.border)return{w:0,h:0};const t=e.border[ar]();return t?{w:t.widths[0]+t.widths[2]+t.insets[0]+t.insets[2],h:t.widths[1]+t.widths[3]+t.insets[1]+t.insets[3]}:{w:0,h:0}}function hasMargin(e){return e.margin&&(e.margin.topInset||e.margin.rightInset||e.margin.bottomInset||e.margin.leftInset)}function _setValue(e,t){if(!e.value){const t=new Value({});e[Hs](t);e.value=t}e.value[qr](t)}function*getContainedChildren(e){for(const t of e[rr]())t instanceof SubformSet?yield*t[nr]():yield t}function isRequired(e){return"error"===e.validate?.nullTest}function setTabIndex(e){for(;e;){if(!e.traversal){e[Or]=e[Ir]()[Or];return}if(e[Or])return;let t=null;for(const i of e.traversal[rr]())if("next"===i.operation){t=i;break}if(!t||!t.ref){e[Or]=e[Ir]()[Or];return}const i=e[cr]();e[Or]=++i[Or];const a=i[vr](t.ref,e);if(!a)return;e=a[0]}}function applyAssist(e,t){const i=e.assist;if(i){const e=i[jr]();e&&(t.title=e);const a=i.role.match(Mn);if(a){const e="heading",i=a[1];t.role=e;t["aria-level"]=i}}if("table"===e.layout)t.role="table";else if("row"===e.layout)t.role="row";else{const i=e[Ir]();"row"===i.layout&&(t.role="TH"===i.assist?.role?"columnheader":"cell")}}function ariaLabel(e){if(!e.assist)return null;const t=e.assist;return t.speak&&""!==t.speak[Os]?t.speak[Os]:t.toolTip?t.toolTip[Os]:null}function valueToHtml(e){return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:e}]})}function setFirstUnsplittable(e){const t=e[cr]();if(null===t[Xs].firstUnsplittable){t[Xs].firstUnsplittable=e;t[Xs].noLayoutFailure=!0}}function unsetFirstUnsplittable(e){const t=e[cr]();t[Xs].firstUnsplittable===e&&(t[Xs].noLayoutFailure=!1)}function handleBreak(e){if(e[Xs])return!1;e[Xs]=Object.create(null);if("auto"===e.targetType)return!1;const t=e[cr]();let i=null;if(e.target){i=t[vr](e.target,e[Ir]());if(!i)return!1;i=i[0]}const{currentPageArea:a,currentContentArea:s}=t[Xs];if("pageArea"===e.targetType){i instanceof PageArea||(i=null);if(e.startNew){e[Xs].target=i||a;return!0}if(i&&i!==a){e[Xs].target=i;return!0}return!1}i instanceof ContentArea||(i=null);const r=i&&i[Ir]();let n,g=r;if(e.startNew)if(i){const e=r.contentArea.children,t=e.indexOf(s),a=e.indexOf(i);-1!==t&&te;a[Xs].noLayoutFailure=!0;const n=t[jr](i);e[Ls](n.html,n.bbox);a[Xs].noLayoutFailure=s;t[or]=r}class AppearanceFilter extends StringObject{constructor(e){super(Nn,"appearanceFilter");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Arc extends XFAObject{constructor(e){super(Nn,"arc",!0);this.circular=getInteger({data:e.circular,defaultValue:0,validate:e=>1===e});this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.startAngle=getFloat({data:e.startAngle,defaultValue:0,validate:e=>!0});this.sweepAngle=getFloat({data:e.sweepAngle,defaultValue:360,validate:e=>!0});this.use=e.use||"";this.usehref=e.usehref||"";this.edge=null;this.fill=null}[jr](){const e=this.edge||new Edge({}),t=e[Zr](),i=Object.create(null);"visible"===this.fill?.presence?Object.assign(i,this.fill[Zr]()):i.fill="transparent";i.strokeWidth=measureToString("visible"===e.presence?e.thickness:0);i.stroke=t.color;let a;const s={xmlns:Gn,style:{width:"100%",height:"100%",overflow:"visible"}};if(360===this.sweepAngle)a={name:"ellipse",attributes:{xmlns:Gn,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:i}};else{const e=this.startAngle*Math.PI/180,t=this.sweepAngle*Math.PI/180,r=this.sweepAngle>180?1:0,[n,g,o,c]=[50*(1+Math.cos(e)),50*(1-Math.sin(e)),50*(1+Math.cos(e+t)),50*(1-Math.sin(e+t))];a={name:"path",attributes:{xmlns:Gn,d:`M ${n} ${g} A 50 50 0 ${r} 0 ${o} ${c}`,vectorEffect:"non-scaling-stroke",style:i}};Object.assign(s,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}const r={name:"svg",children:[a],attributes:s};if(hasMargin(this[Ir]()[Ir]()))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[r]});r.attributes.style.position="absolute";return HTMLResult.success(r)}}class Area extends XFAObject{constructor(e){super(Nn,"area",!0);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.id=e.id||"";this.name=e.name||"";this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.desc=null;this.extras=null;this.area=new XFAObjectArray;this.draw=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}*[nr](){yield*getContainedChildren(this)}[Dr](){return!0}[dr](){return!0}[Ls](e,t){const[i,a,s,r]=t;this[Xs].width=Math.max(this[Xs].width,i+s);this[Xs].height=Math.max(this[Xs].height,a+r);this[Xs].children.push(e)}[$s](){return this[Xs].availableSpace}[jr](e){const t=toStyle(this,"position"),i={style:t,id:this[Vr],class:["xfaArea"]};isPrintOnly(this)&&i.class.push("xfaPrintOnly");this.name&&(i.xfaName=this.name);const a=[];this[Xs]={children:a,width:0,height:0,availableSpace:e};const s=this[Js]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!s.success){if(s.isBreak())return s;delete this[Xs];return HTMLResult.FAILURE}t.width=measureToString(this[Xs].width);t.height=measureToString(this[Xs].height);const r={name:"div",attributes:i,children:a},n=[this.x,this.y,this[Xs].width,this[Xs].height];delete this[Xs];return HTMLResult.success(r,n)}}class Assist extends XFAObject{constructor(e){super(Nn,"assist",!0);this.id=e.id||"";this.role=e.role||"";this.use=e.use||"";this.usehref=e.usehref||"";this.speak=null;this.toolTip=null}[jr](){return this.toolTip?.[Os]||null}}class Barcode extends XFAObject{constructor(e){super(Nn,"barcode",!0);this.charEncoding=getKeyword({data:e.charEncoding?e.charEncoding.toLowerCase():"",defaultValue:"",validate:e=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(e)||e.match(/iso-8859-\\d{2}/)});this.checksum=getStringOption(e.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]);this.dataColumnCount=getInteger({data:e.dataColumnCount,defaultValue:-1,validate:e=>e>=0});this.dataLength=getInteger({data:e.dataLength,defaultValue:-1,validate:e=>e>=0});this.dataPrep=getStringOption(e.dataPrep,["none","flateCompress"]);this.dataRowCount=getInteger({data:e.dataRowCount,defaultValue:-1,validate:e=>e>=0});this.endChar=e.endChar||"";this.errorCorrectionLevel=getInteger({data:e.errorCorrectionLevel,defaultValue:-1,validate:e=>e>=0&&e<=8});this.id=e.id||"";this.moduleHeight=getMeasurement(e.moduleHeight,"5mm");this.moduleWidth=getMeasurement(e.moduleWidth,"0.25mm");this.printCheckDigit=getInteger({data:e.printCheckDigit,defaultValue:0,validate:e=>1===e});this.rowColumnRatio=getRatio(e.rowColumnRatio);this.startChar=e.startChar||"";this.textLocation=getStringOption(e.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]);this.truncate=getInteger({data:e.truncate,defaultValue:0,validate:e=>1===e});this.type=getStringOption(e.type?e.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]);this.upsMode=getStringOption(e.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]);this.use=e.use||"";this.usehref=e.usehref||"";this.wideNarrowRatio=getRatio(e.wideNarrowRatio);this.encrypt=null;this.extras=null}}class Bind extends XFAObject{constructor(e){super(Nn,"bind",!0);this.match=getStringOption(e.match,["once","dataRef","global","none"]);this.ref=e.ref||"";this.picture=null}}class BindItems extends XFAObject{constructor(e){super(Nn,"bindItems");this.connection=e.connection||"";this.labelRef=e.labelRef||"";this.ref=e.ref||"";this.valueRef=e.valueRef||""}}class Bookend extends XFAObject{constructor(e){super(Nn,"bookend");this.id=e.id||"";this.leader=e.leader||"";this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||""}}class BooleanElement extends Option01{constructor(e){super(Nn,"boolean");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[jr](e){return valueToHtml(1===this[Os]?"1":"0")}}class Border extends XFAObject{constructor(e){super(Nn,"border",!0);this.break=getStringOption(e.break,["close","open"]);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.corner=new XFAObjectArray(4);this.edge=new XFAObjectArray(4);this.extras=null;this.fill=null;this.margin=null}[ar](){if(!this[Xs]){const e=this.edge.children.slice();if(e.length<4){const t=e.at(-1)||new Edge({});for(let i=e.length;i<4;i++)e.push(t)}const t=e.map((e=>e.thickness)),i=[0,0,0,0];if(this.margin){i[0]=this.margin.topInset;i[1]=this.margin.rightInset;i[2]=this.margin.bottomInset;i[3]=this.margin.leftInset}this[Xs]={widths:t,insets:i,edges:e}}return this[Xs]}[Zr](){const{edges:e}=this[ar](),t=e.map((e=>{const t=e[Zr]();t.color||="#000000";return t})),i=Object.create(null);this.margin&&Object.assign(i,this.margin[Zr]());"visible"===this.fill?.presence&&Object.assign(i,this.fill[Zr]());if(this.corner.children.some((e=>0!==e.radius))){const e=this.corner.children.map((e=>e[Zr]()));if(2===e.length||3===e.length){const t=e.at(-1);for(let i=e.length;i<4;i++)e.push(t)}i.borderRadius=e.map((e=>e.radius)).join(" ")}switch(this.presence){case"invisible":case"hidden":i.borderStyle="";break;case"inactive":i.borderStyle="none";break;default:i.borderStyle=t.map((e=>e.style)).join(" ")}i.borderWidth=t.map((e=>e.width)).join(" ");i.borderColor=t.map((e=>e.color)).join(" ");return i}}class Break extends XFAObject{constructor(e){super(Nn,"break",!0);this.after=getStringOption(e.after,["auto","contentArea","pageArea","pageEven","pageOdd"]);this.afterTarget=e.afterTarget||"";this.before=getStringOption(e.before,["auto","contentArea","pageArea","pageEven","pageOdd"]);this.beforeTarget=e.beforeTarget||"";this.bookendLeader=e.bookendLeader||"";this.bookendTrailer=e.bookendTrailer||"";this.id=e.id||"";this.overflowLeader=e.overflowLeader||"";this.overflowTarget=e.overflowTarget||"";this.overflowTrailer=e.overflowTrailer||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class BreakAfter extends XFAObject{constructor(e){super(Nn,"breakAfter",!0);this.id=e.id||"";this.leader=e.leader||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.target=e.target||"";this.targetType=getStringOption(e.targetType,["auto","contentArea","pageArea"]);this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||"";this.script=null}}class BreakBefore extends XFAObject{constructor(e){super(Nn,"breakBefore",!0);this.id=e.id||"";this.leader=e.leader||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.target=e.target||"";this.targetType=getStringOption(e.targetType,["auto","contentArea","pageArea"]);this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||"";this.script=null}[jr](e){this[Xs]={};return HTMLResult.FAILURE}}class Button extends XFAObject{constructor(e){super(Nn,"button",!0);this.highlight=getStringOption(e.highlight,["inverted","none","outline","push"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[jr](e){const t=this[Ir]()[Ir](),i={name:"button",attributes:{id:this[Vr],class:["xfaButton"],style:{}},children:[]};for(const e of t.event.children){if("click"!==e.activity||!e.script)continue;const t=recoverJsURL(e.script[Os]);if(!t)continue;const a=fixURL(t.url);a&&i.children.push({name:"a",attributes:{id:"link"+this[Vr],href:a,newWindow:t.newWindow,class:["xfaLink"],style:{}},children:[]})}return HTMLResult.success(i)}}class Calculate extends XFAObject{constructor(e){super(Nn,"calculate",!0);this.id=e.id||"";this.override=getStringOption(e.override,["disabled","error","ignore","warning"]);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.message=null;this.script=null}}class Caption extends XFAObject{constructor(e){super(Nn,"caption",!0);this.id=e.id||"";this.placement=getStringOption(e.placement,["left","bottom","inline","right","top"]);this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.reserve=Math.ceil(getMeasurement(e.reserve));this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.font=null;this.margin=null;this.para=null;this.value=null}[qr](e){_setValue(this,e)}[ar](e){if(!this[Xs]){let{width:t,height:i}=e;switch(this.placement){case"left":case"right":case"inline":t=this.reserve<=0?t:this.reserve;break;case"top":case"bottom":i=this.reserve<=0?i:this.reserve}this[Xs]=layoutNode(this,{width:t,height:i})}return this[Xs]}[jr](e){if(!this.value)return HTMLResult.EMPTY;this[Lr]();const t=this.value[jr](e).html;if(!t){this[xr]();return HTMLResult.EMPTY}const i=this.reserve;if(this.reserve<=0){const{w:t,h:i}=this[ar](e);switch(this.placement){case"left":case"right":case"inline":this.reserve=t;break;case"top":case"bottom":this.reserve=i}}const a=[];"string"==typeof t?a.push({name:"#text",value:t}):a.push(t);const s=toStyle(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(s.width=measureToString(this.reserve));break;case"top":case"bottom":this.reserve>0&&(s.height=measureToString(this.reserve))}setPara(this,null,t);this[xr]();this.reserve=i;return HTMLResult.success({name:"div",attributes:{style:s,class:["xfaCaption"]},children:a})}}class Certificate extends StringObject{constructor(e){super(Nn,"certificate");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Certificates extends XFAObject{constructor(e){super(Nn,"certificates",!0);this.credentialServerPolicy=getStringOption(e.credentialServerPolicy,["optional","required"]);this.id=e.id||"";this.url=e.url||"";this.urlPolicy=e.urlPolicy||"";this.use=e.use||"";this.usehref=e.usehref||"";this.encryption=null;this.issuers=null;this.keyUsage=null;this.oids=null;this.signing=null;this.subjectDNs=null}}class CheckButton extends XFAObject{constructor(e){super(Nn,"checkButton",!0);this.id=e.id||"";this.mark=getStringOption(e.mark,["default","check","circle","cross","diamond","square","star"]);this.shape=getStringOption(e.shape,["square","round"]);this.size=getMeasurement(e.size,"10pt");this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[jr](e){const t=toStyle("margin"),i=measureToString(this.size);t.width=t.height=i;let a,s,r;const n=this[Ir]()[Ir](),g=n.items.children.length&&n.items.children[0][jr]().html||[],o={on:(void 0!==g[0]?g[0]:"on").toString(),off:(void 0!==g[1]?g[1]:"off").toString()},c=(n.value?.[Pr]()||"off")===o.on||void 0,C=n[or](),h=n[Vr];let l;if(C instanceof ExclGroup){r=C[Vr];a="radio";s="xfaRadio";l=C[Ws]?.[Vr]||C[Vr]}else{a="checkbox";s="xfaCheckbox";l=n[Ws]?.[Vr]||n[Vr]}const Q={name:"input",attributes:{class:[s],style:t,fieldId:h,dataId:l,type:a,checked:c,xfaOn:o.on,xfaOff:o.off,"aria-label":ariaLabel(n),"aria-required":!1}};r&&(Q.attributes.name=r);if(isRequired(n)){Q.attributes["aria-required"]=!0;Q.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[Q]})}}class ChoiceList extends XFAObject{constructor(e){super(Nn,"choiceList",!0);this.commitOn=getStringOption(e.commitOn,["select","exit"]);this.id=e.id||"";this.open=getStringOption(e.open,["userControl","always","multiSelect","onEntry"]);this.textEntry=getInteger({data:e.textEntry,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[jr](e){const t=toStyle(this,"border","margin"),i=this[Ir]()[Ir](),a={fontSize:`calc(${i.font?.size||10}px * var(--scale-factor))`},s=[];if(i.items.children.length>0){const e=i.items;let t=0,r=0;if(2===e.children.length){t=e.children[0].save;r=1-t}const n=e.children[t][jr]().html,g=e.children[r][jr]().html;let o=!1;const c=i.value?.[Pr]()||"";for(let e=0,t=n.length;eMath.min(Math.max(0,parseInt(e.trim(),10)),255))).map((e=>isNaN(e)?0:e));if(r.length<3)return{r:i,g:a,b:s};[i,a,s]=r;return{r:i,g:a,b:s}}(e.value):"";this.extras=null}[hr](){return!1}[Zr](){return this.value?Util.makeHexColor(this.value.r,this.value.g,this.value.b):null}}class Comb extends XFAObject{constructor(e){super(Nn,"comb");this.id=e.id||"";this.numberOfCells=getInteger({data:e.numberOfCells,defaultValue:0,validate:e=>e>=0});this.use=e.use||"";this.usehref=e.usehref||""}}class Connect extends XFAObject{constructor(e){super(Nn,"connect",!0);this.connection=e.connection||"";this.id=e.id||"";this.ref=e.ref||"";this.usage=getStringOption(e.usage,["exportAndImport","exportOnly","importOnly"]);this.use=e.use||"";this.usehref=e.usehref||"";this.picture=null}}class ContentArea extends XFAObject{constructor(e){super(Nn,"contentArea",!0);this.h=getMeasurement(e.h);this.id=e.id||"";this.name=e.name||"";this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.w=getMeasurement(e.w);this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.desc=null;this.extras=null}[jr](e){const t={left:measureToString(this.x),top:measureToString(this.y),width:measureToString(this.w),height:measureToString(this.h)},i=["xfaContentarea"];isPrintOnly(this)&&i.push("xfaPrintOnly");return HTMLResult.success({name:"div",children:[],attributes:{style:t,class:i,id:this[Vr]}})}}class Corner extends XFAObject{constructor(e){super(Nn,"corner",!0);this.id=e.id||"";this.inverted=getInteger({data:e.inverted,defaultValue:0,validate:e=>1===e});this.join=getStringOption(e.join,["square","round"]);this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.radius=getMeasurement(e.radius);this.stroke=getStringOption(e.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]);this.thickness=getMeasurement(e.thickness,"0.5pt");this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Zr](){const e=toStyle(this,"visibility");e.radius=measureToString("square"===this.join?0:this.radius);return e}}class DateElement extends ContentObject{constructor(e){super(Nn,"date");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){const e=this[Os].trim();this[Os]=e?new Date(e):null}[jr](e){return valueToHtml(this[Os]?this[Os].toString():"")}}class DateTime extends ContentObject{constructor(e){super(Nn,"dateTime");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){const e=this[Os].trim();this[Os]=e?new Date(e):null}[jr](e){return valueToHtml(this[Os]?this[Os].toString():"")}}class DateTimeEdit extends XFAObject{constructor(e){super(Nn,"dateTimeEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.picker=getStringOption(e.picker,["host","none"]);this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.comb=null;this.extras=null;this.margin=null}[jr](e){const t=toStyle(this,"border","font","margin"),i=this[Ir]()[Ir](),a={name:"input",attributes:{type:"text",fieldId:i[Vr],dataId:i[Ws]?.[Vr]||i[Vr],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(i),"aria-required":!1}};if(isRequired(i)){a.attributes["aria-required"]=!0;a.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[a]})}}class Decimal extends ContentObject{constructor(e){super(Nn,"decimal");this.fracDigits=getInteger({data:e.fracDigits,defaultValue:2,validate:e=>!0});this.id=e.id||"";this.leadDigits=getInteger({data:e.leadDigits,defaultValue:-1,validate:e=>!0});this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){const e=parseFloat(this[Os].trim());this[Os]=isNaN(e)?null:e}[jr](e){return valueToHtml(null!==this[Os]?this[Os].toString():"")}}class DefaultUi extends XFAObject{constructor(e){super(Nn,"defaultUi",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class Desc extends XFAObject{constructor(e){super(Nn,"desc",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}}class DigestMethod extends OptionObject{constructor(e){super(Nn,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class DigestMethods extends XFAObject{constructor(e){super(Nn,"digestMethods",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.digestMethod=new XFAObjectArray}}class Draw extends XFAObject{constructor(e){super(Nn,"draw",!0);this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.rotate=getInteger({data:e.rotate,defaultValue:0,validate:e=>e%90==0});this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.border=null;this.caption=null;this.desc=null;this.extras=null;this.font=null;this.keep=null;this.margin=null;this.para=null;this.traversal=null;this.ui=null;this.value=null;this.setProperty=new XFAObjectArray}[qr](e){_setValue(this,e)}[jr](e){setTabIndex(this);if("hidden"===this.presence||"inactive"===this.presence)return HTMLResult.EMPTY;fixDimensions(this);this[Lr]();const t=this.w,i=this.h,{w:a,h:s,isBroken:r}=layoutNode(this,e);if(a&&""===this.w){if(r&&this[or]()[wr]()){this[xr]();return HTMLResult.FAILURE}this.w=a}s&&""===this.h&&(this.h=s);setFirstUnsplittable(this);if(!checkDimensions(this,e)){this.w=t;this.h=i;this[xr]();return HTMLResult.FAILURE}unsetFirstUnsplittable(this);const n=toStyle(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");setMinMaxDimensions(this,n);if(n.margin){n.padding=n.margin;delete n.margin}const g=["xfaDraw"];this.font&&g.push("xfaFont");isPrintOnly(this)&&g.push("xfaPrintOnly");const o={style:n,id:this[Vr],class:g};this.name&&(o.xfaName=this.name);const c={name:"div",attributes:o,children:[]};applyAssist(this,o);const C=computeBbox(this,c,e),h=this.value?this.value[jr](e).html:null;if(null===h){this.w=t;this.h=i;this[xr]();return HTMLResult.success(createWrapper(this,c),C)}c.children.push(h);setPara(this,n,h);this.w=t;this.h=i;this[xr]();return HTMLResult.success(createWrapper(this,c),C)}}class Edge extends XFAObject{constructor(e){super(Nn,"edge",!0);this.cap=getStringOption(e.cap,["square","butt","round"]);this.id=e.id||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.stroke=getStringOption(e.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]);this.thickness=getMeasurement(e.thickness,"0.5pt");this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Zr](){const e=toStyle(this,"visibility");Object.assign(e,{linecap:this.cap,width:measureToString(this.thickness),color:this.color?this.color[Zr]():"#000000",style:""});if("visible"!==this.presence)e.style="none";else switch(this.stroke){case"solid":e.style="solid";break;case"dashDot":case"dashDotDot":case"dashed":e.style="dashed";break;case"dotted":e.style="dotted";break;case"embossed":e.style="ridge";break;case"etched":e.style="groove";break;case"lowered":e.style="inset";break;case"raised":e.style="outset"}return e}}class Encoding extends OptionObject{constructor(e){super(Nn,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Encodings extends XFAObject{constructor(e){super(Nn,"encodings",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.encoding=new XFAObjectArray}}class Encrypt extends XFAObject{constructor(e){super(Nn,"encrypt",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=null}}class EncryptData extends XFAObject{constructor(e){super(Nn,"encryptData",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["encrypt","decrypt"]);this.target=e.target||"";this.use=e.use||"";this.usehref=e.usehref||"";this.filter=null;this.manifest=null}}class Encryption extends XFAObject{constructor(e){super(Nn,"encryption",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class EncryptionMethod extends OptionObject{constructor(e){super(Nn,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class EncryptionMethods extends XFAObject{constructor(e){super(Nn,"encryptionMethods",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.encryptionMethod=new XFAObjectArray}}class Event extends XFAObject{constructor(e){super(Nn,"event",!0);this.activity=getStringOption(e.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]);this.id=e.id||"";this.listen=getStringOption(e.listen,["refOnly","refAndDescendents"]);this.name=e.name||"";this.ref=e.ref||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.encryptData=null;this.execute=null;this.script=null;this.signData=null;this.submit=null}}class ExData extends ContentObject{constructor(e){super(Nn,"exData");this.contentType=e.contentType||"";this.href=e.href||"";this.id=e.id||"";this.maxLength=getInteger({data:e.maxLength,defaultValue:-1,validate:e=>e>=-1});this.name=e.name||"";this.rid=e.rid||"";this.transferEncoding=getStringOption(e.transferEncoding,["none","base64","package"]);this.use=e.use||"";this.usehref=e.usehref||""}[ur](){return"text/html"===this.contentType}[Nr](e){if("text/html"===this.contentType&&e[Sr]===_r.xhtml.id){this[Os]=e;return!0}if("text/xml"===this.contentType){this[Os]=e;return!0}return!1}[jr](e){return"text/html"===this.contentType&&this[Os]?this[Os][jr](e):HTMLResult.EMPTY}}class ExObject extends XFAObject{constructor(e){super(Nn,"exObject",!0);this.archive=e.archive||"";this.classId=e.classId||"";this.codeBase=e.codeBase||"";this.codeType=e.codeType||"";this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.exObject=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}}class ExclGroup extends XFAObject{constructor(e){super(Nn,"exclGroup",!0);this.access=getStringOption(e.access,["open","nonInteractive","protected","readOnly"]);this.accessKey=e.accessKey||"";this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.layout=getStringOption(e.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]);this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.border=null;this.calculate=null;this.caption=null;this.desc=null;this.extras=null;this.margin=null;this.para=null;this.traversal=null;this.validate=null;this.connect=new XFAObjectArray;this.event=new XFAObjectArray;this.field=new XFAObjectArray;this.setProperty=new XFAObjectArray}[dr](){return!0}[hr](){return!0}[qr](e){for(const t of this.field.children){if(!t.value){const e=new Value({});t[Hs](e);t.value=e}t.value[qr](e)}}[wr](){return this.layout.endsWith("-tb")&&0===this[Xs].attempt&&this[Xs].numberInLine>0||this[Ir]()[wr]()}[yr](){const e=this[or]();if(!e[yr]())return!1;if(void 0!==this[Xs]._isSplittable)return this[Xs]._isSplittable;if("position"===this.layout||this.layout.includes("row")){this[Xs]._isSplittable=!1;return!1}if(e.layout?.endsWith("-tb")&&0!==e[Xs].numberInLine)return!1;this[Xs]._isSplittable=!0;return!0}[Vs](){return flushHTML(this)}[Ls](e,t){addHTML(this,e,t)}[$s](){return getAvailableSpace(this)}[jr](e){setTabIndex(this);if("hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return HTMLResult.EMPTY;fixDimensions(this);const t=[],i={id:this[Vr],class:[]};setAccess(this,i.class);this[Xs]||(this[Xs]=Object.create(null));Object.assign(this[Xs],{children:t,attributes:i,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,e.width),height:Math.min(this.h||1/0,e.height)},width:0,height:0,prevHeight:0,currentWidth:0});const a=this[yr]();a||setFirstUnsplittable(this);if(!checkDimensions(this,e))return HTMLResult.FAILURE;const s=new Set(["field"]);if(this.layout.includes("row")){const e=this[or]().columnWidths;if(Array.isArray(e)&&e.length>0){this[Xs].columnWidths=e;this[Xs].currentColumn=0}}const r=toStyle(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),n=["xfaExclgroup"],g=layoutClass(this);g&&n.push(g);isPrintOnly(this)&&n.push("xfaPrintOnly");i.style=r;i.class=n;this.name&&(i.xfaName=this.name);this[Lr]();const o="lr-tb"===this.layout||"rl-tb"===this.layout,c=o?2:1;for(;this[Xs].attempte>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.rotate=getInteger({data:e.rotate,defaultValue:0,validate:e=>e%90==0});this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.border=null;this.calculate=null;this.caption=null;this.desc=null;this.extras=null;this.font=null;this.format=null;this.items=new XFAObjectArray(2);this.keep=null;this.margin=null;this.para=null;this.traversal=null;this.ui=null;this.validate=null;this.value=null;this.bindItems=new XFAObjectArray;this.connect=new XFAObjectArray;this.event=new XFAObjectArray;this.setProperty=new XFAObjectArray}[dr](){return!0}[qr](e){_setValue(this,e)}[jr](e){setTabIndex(this);if(!this.ui){this.ui=new Ui({});this.ui[Cr]=this[Cr];this[Hs](this.ui);let e;switch(this.items.children.length){case 0:e=new TextEdit({});this.ui.textEdit=e;break;case 1:e=new CheckButton({});this.ui.checkButton=e;break;case 2:e=new ChoiceList({});this.ui.choiceList=e}this.ui[Hs](e)}if(!this.ui||"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return HTMLResult.EMPTY;this.caption&&delete this.caption[Xs];this[Lr]();const t=this.caption?this.caption[jr](e).html:null,i=this.w,a=this.h;let s=0,r=0;if(this.margin){s=this.margin.leftInset+this.margin.rightInset;r=this.margin.topInset+this.margin.bottomInset}let n=null;if(""===this.w||""===this.h){let t=null,i=null,a=0,g=0;if(this.ui.checkButton)a=g=this.ui.checkButton.size;else{const{w:t,h:i}=layoutNode(this,e);if(null!==t){a=t;g=i}else g=function fonts_getMetrics(e,t=!1){let i=null;if(e){const t=stripQuotes(e.typeface),a=e[Cr].fontFinder.find(t);i=selectFont(e,a)}if(!i)return{lineHeight:12,lineGap:2,lineNoGap:10};const a=e.size||10,s=i.lineHeight?Math.max(t?0:1.2,i.lineHeight):1.2,r=void 0===i.lineGap?.2:i.lineGap;return{lineHeight:s*a,lineGap:r*a,lineNoGap:Math.max(1,s-r)*a}}(this.font,!0).lineNoGap}n=getBorderDims(this.ui[ar]());a+=n.w;g+=n.h;if(this.caption){const{w:s,h:r,isBroken:n}=this.caption[ar](e);if(n&&this[or]()[wr]()){this[xr]();return HTMLResult.FAILURE}t=s;i=r;switch(this.caption.placement){case"left":case"right":case"inline":t+=a;break;case"top":case"bottom":i+=g}}else{t=a;i=g}if(t&&""===this.w){t+=s;this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1e>=1&&e<=5});this.appearanceFilter=null;this.certificates=null;this.digestMethods=null;this.encodings=null;this.encryptionMethods=null;this.handler=null;this.lockDocument=null;this.mdp=null;this.reasons=null;this.timeStamp=null}}class Float extends ContentObject{constructor(e){super(Nn,"float");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){const e=parseFloat(this[Os].trim());this[Os]=isNaN(e)?null:e}[jr](e){return valueToHtml(null!==this[Os]?this[Os].toString():"")}}class template_Font extends XFAObject{constructor(e){super(Nn,"font",!0);this.baselineShift=getMeasurement(e.baselineShift);this.fontHorizontalScale=getFloat({data:e.fontHorizontalScale,defaultValue:100,validate:e=>e>=0});this.fontVerticalScale=getFloat({data:e.fontVerticalScale,defaultValue:100,validate:e=>e>=0});this.id=e.id||"";this.kerningMode=getStringOption(e.kerningMode,["none","pair"]);this.letterSpacing=getMeasurement(e.letterSpacing,"0");this.lineThrough=getInteger({data:e.lineThrough,defaultValue:0,validate:e=>1===e||2===e});this.lineThroughPeriod=getStringOption(e.lineThroughPeriod,["all","word"]);this.overline=getInteger({data:e.overline,defaultValue:0,validate:e=>1===e||2===e});this.overlinePeriod=getStringOption(e.overlinePeriod,["all","word"]);this.posture=getStringOption(e.posture,["normal","italic"]);this.size=getMeasurement(e.size,"10pt");this.typeface=e.typeface||"Courier";this.underline=getInteger({data:e.underline,defaultValue:0,validate:e=>1===e||2===e});this.underlinePeriod=getStringOption(e.underlinePeriod,["all","word"]);this.use=e.use||"";this.usehref=e.usehref||"";this.weight=getStringOption(e.weight,["normal","bold"]);this.extras=null;this.fill=null}[Ys](e){super[Ys](e);this[Cr].usedTypefaces.add(this.typeface)}[Zr](){const e=toStyle(this,"fill"),t=e.color;if(t)if("#000000"===t)delete e.color;else if(!t.startsWith("#")){e.background=t;e.backgroundClip="text";e.color="transparent"}this.baselineShift&&(e.verticalAlign=measureToString(this.baselineShift));e.fontKerning="none"===this.kerningMode?"none":"normal";e.letterSpacing=measureToString(this.letterSpacing);if(0!==this.lineThrough){e.textDecoration="line-through";2===this.lineThrough&&(e.textDecorationStyle="double")}if(0!==this.overline){e.textDecoration="overline";2===this.overline&&(e.textDecorationStyle="double")}e.fontStyle=this.posture;e.fontSize=measureToString(.99*this.size);setFontFamily(this,this,this[Cr].fontFinder,e);if(0!==this.underline){e.textDecoration="underline";2===this.underline&&(e.textDecorationStyle="double")}e.fontWeight=this.weight;return e}}class Format extends XFAObject{constructor(e){super(Nn,"format",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.picture=null}}class Handler extends StringObject{constructor(e){super(Nn,"handler");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Hyphenation extends XFAObject{constructor(e){super(Nn,"hyphenation");this.excludeAllCaps=getInteger({data:e.excludeAllCaps,defaultValue:0,validate:e=>1===e});this.excludeInitialCap=getInteger({data:e.excludeInitialCap,defaultValue:0,validate:e=>1===e});this.hyphenate=getInteger({data:e.hyphenate,defaultValue:0,validate:e=>1===e});this.id=e.id||"";this.pushCharacterCount=getInteger({data:e.pushCharacterCount,defaultValue:3,validate:e=>e>=0});this.remainCharacterCount=getInteger({data:e.remainCharacterCount,defaultValue:3,validate:e=>e>=0});this.use=e.use||"";this.usehref=e.usehref||"";this.wordCharacterCount=getInteger({data:e.wordCharacterCount,defaultValue:7,validate:e=>e>=0})}}class Image extends StringObject{constructor(e){super(Nn,"image");this.aspect=getStringOption(e.aspect,["fit","actual","height","none","width"]);this.contentType=e.contentType||"";this.href=e.href||"";this.id=e.id||"";this.name=e.name||"";this.transferEncoding=getStringOption(e.transferEncoding,["base64","none","package"]);this.use=e.use||"";this.usehref=e.usehref||""}[jr](){if(this.contentType&&!Un.has(this.contentType.toLowerCase()))return HTMLResult.EMPTY;let e=this[Cr].images&&this[Cr].images.get(this.href);if(!e&&(this.href||!this[Os]))return HTMLResult.EMPTY;e||"base64"!==this.transferEncoding||(e=function fromBase64Util(e){return Uint8Array.fromBase64?Uint8Array.fromBase64(e):stringToBytes(atob(e))}(this[Os]));if(!e)return HTMLResult.EMPTY;if(!this.contentType){for(const[t,i]of xn)if(e.length>t.length&&t.every(((t,i)=>t===e[i]))){this.contentType=i;break}if(!this.contentType)return HTMLResult.EMPTY}const t=new Blob([e],{type:this.contentType});let i;switch(this.aspect){case"fit":case"actual":break;case"height":i={height:"100%",objectFit:"fill"};break;case"none":i={width:"100%",height:"100%",objectFit:"fill"};break;case"width":i={width:"100%",objectFit:"fill"}}const a=this[Ir]();return HTMLResult.success({name:"img",attributes:{class:["xfaImage"],style:i,src:URL.createObjectURL(t),alt:a?ariaLabel(a[Ir]()):null}})}}class ImageEdit extends XFAObject{constructor(e){super(Nn,"imageEdit",!0);this.data=getStringOption(e.data,["link","embed"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[jr](e){return"embed"===this.data?HTMLResult.success({name:"div",children:[],attributes:{}}):HTMLResult.EMPTY}}class Integer extends ContentObject{constructor(e){super(Nn,"integer");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){const e=parseInt(this[Os].trim(),10);this[Os]=isNaN(e)?null:e}[jr](e){return valueToHtml(null!==this[Os]?this[Os].toString():"")}}class Issuers extends XFAObject{constructor(e){super(Nn,"issuers",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class Items extends XFAObject{constructor(e){super(Nn,"items",!0);this.id=e.id||"";this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.ref=e.ref||"";this.save=getInteger({data:e.save,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}[jr](){const e=[];for(const t of this[rr]())e.push(t[Pr]());return HTMLResult.success(e)}}class Keep extends XFAObject{constructor(e){super(Nn,"keep",!0);this.id=e.id||"";const t=["none","contentArea","pageArea"];this.intact=getStringOption(e.intact,t);this.next=getStringOption(e.next,t);this.previous=getStringOption(e.previous,t);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class KeyUsage extends XFAObject{constructor(e){super(Nn,"keyUsage");const t=["","yes","no"];this.crlSign=getStringOption(e.crlSign,t);this.dataEncipherment=getStringOption(e.dataEncipherment,t);this.decipherOnly=getStringOption(e.decipherOnly,t);this.digitalSignature=getStringOption(e.digitalSignature,t);this.encipherOnly=getStringOption(e.encipherOnly,t);this.id=e.id||"";this.keyAgreement=getStringOption(e.keyAgreement,t);this.keyCertSign=getStringOption(e.keyCertSign,t);this.keyEncipherment=getStringOption(e.keyEncipherment,t);this.nonRepudiation=getStringOption(e.nonRepudiation,t);this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Line extends XFAObject{constructor(e){super(Nn,"line",!0);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.slope=getStringOption(e.slope,["\\\\","/"]);this.use=e.use||"";this.usehref=e.usehref||"";this.edge=null}[jr](){const e=this[Ir]()[Ir](),t=this.edge||new Edge({}),i=t[Zr](),a=Object.create(null),s="visible"===t.presence?t.thickness:0;a.strokeWidth=measureToString(s);a.stroke=i.color;let r,n,g,o,c="100%",C="100%";if(e.w<=s){[r,n,g,o]=["50%",0,"50%","100%"];c=a.strokeWidth}else if(e.h<=s){[r,n,g,o]=[0,"50%","100%","50%"];C=a.strokeWidth}else"\\\\"===this.slope?[r,n,g,o]=[0,0,"100%","100%"]:[r,n,g,o]=[0,"100%","100%",0];const h={name:"svg",children:[{name:"line",attributes:{xmlns:Gn,x1:r,y1:n,x2:g,y2:o,style:a}}],attributes:{xmlns:Gn,width:c,height:C,style:{overflow:"visible"}}};if(hasMargin(e))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[h]});h.attributes.style.position="absolute";return HTMLResult.success(h)}}class Linear extends XFAObject{constructor(e){super(Nn,"linear",!0);this.id=e.id||"";this.type=getStringOption(e.type,["toRight","toBottom","toLeft","toTop"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Zr](e){e=e?e[Zr]():"#FFFFFF";return`linear-gradient(${this.type.replace(/([RBLT])/," $1").toLowerCase()}, ${e}, ${this.color?this.color[Zr]():"#000000"})`}}class LockDocument extends ContentObject{constructor(e){super(Nn,"lockDocument");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){this[Os]=getStringOption(this[Os],["auto","0","1"])}}class Manifest extends XFAObject{constructor(e){super(Nn,"manifest",!0);this.action=getStringOption(e.action,["include","all","exclude"]);this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.ref=new XFAObjectArray}}class Margin extends XFAObject{constructor(e){super(Nn,"margin",!0);this.bottomInset=getMeasurement(e.bottomInset,"0");this.id=e.id||"";this.leftInset=getMeasurement(e.leftInset,"0");this.rightInset=getMeasurement(e.rightInset,"0");this.topInset=getMeasurement(e.topInset,"0");this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[Zr](){return{margin:measureToString(this.topInset)+" "+measureToString(this.rightInset)+" "+measureToString(this.bottomInset)+" "+measureToString(this.leftInset)}}}class Mdp extends XFAObject{constructor(e){super(Nn,"mdp");this.id=e.id||"";this.permissions=getInteger({data:e.permissions,defaultValue:2,validate:e=>1===e||3===e});this.signatureType=getStringOption(e.signatureType,["filler","author"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Medium extends XFAObject{constructor(e){super(Nn,"medium");this.id=e.id||"";this.imagingBBox=function getBBox(e){const t=-1;if(!e)return{x:t,y:t,width:t,height:t};const i=e.trim().split(/\\s*,\\s*/).map((e=>getMeasurement(e,"-1")));if(i.length<4||i[2]<0||i[3]<0)return{x:t,y:t,width:t,height:t};const[a,s,r,n]=i;return{x:a,y:s,width:r,height:n}}(e.imagingBBox);this.long=getMeasurement(e.long);this.orientation=getStringOption(e.orientation,["portrait","landscape"]);this.short=getMeasurement(e.short);this.stock=e.stock||"";this.trayIn=getStringOption(e.trayIn,["auto","delegate","pageFront"]);this.trayOut=getStringOption(e.trayOut,["auto","delegate"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Message extends XFAObject{constructor(e){super(Nn,"message",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.text=new XFAObjectArray}}class NumericEdit extends XFAObject{constructor(e){super(Nn,"numericEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.comb=null;this.extras=null;this.margin=null}[jr](e){const t=toStyle(this,"border","font","margin"),i=this[Ir]()[Ir](),a={name:"input",attributes:{type:"text",fieldId:i[Vr],dataId:i[Ws]?.[Vr]||i[Vr],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(i),"aria-required":!1}};if(isRequired(i)){a.attributes["aria-required"]=!0;a.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[a]})}}class Occur extends XFAObject{constructor(e){super(Nn,"occur",!0);this.id=e.id||"";this.initial=""!==e.initial?getInteger({data:e.initial,defaultValue:"",validate:e=>!0}):"";this.max=""!==e.max?getInteger({data:e.max,defaultValue:1,validate:e=>!0}):"";this.min=""!==e.min?getInteger({data:e.min,defaultValue:1,validate:e=>!0}):"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[Ys](){const e=this[Ir](),t=this.min;""===this.min&&(this.min=e instanceof PageArea||e instanceof PageSet?0:1);""===this.max&&(this.max=""===t?e instanceof PageArea||e instanceof PageSet?-1:1:this.min);-1!==this.max&&this.max!0});this.name=e.name||"";this.numbered=getInteger({data:e.numbered,defaultValue:1,validate:e=>!0});this.oddOrEven=getStringOption(e.oddOrEven,["any","even","odd"]);this.pagePosition=getStringOption(e.pagePosition,["any","first","last","only","rest"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.desc=null;this.extras=null;this.medium=null;this.occur=null;this.area=new XFAObjectArray;this.contentArea=new XFAObjectArray;this.draw=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.subform=new XFAObjectArray}[br](){if(!this[Xs]){this[Xs]={numberOfUse:0};return!0}return!this.occur||-1===this.occur.max||this[Xs].numberOfUsee.oddOrEven===t&&e.pagePosition===i));if(a)return a;a=this.pageArea.children.find((e=>"any"===e.oddOrEven&&e.pagePosition===i));if(a)return a;a=this.pageArea.children.find((e=>"any"===e.oddOrEven&&"any"===e.pagePosition));return a||this.pageArea.children[0]}}class Para extends XFAObject{constructor(e){super(Nn,"para",!0);this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.lineHeight=e.lineHeight?getMeasurement(e.lineHeight,"0pt"):"";this.marginLeft=e.marginLeft?getMeasurement(e.marginLeft,"0pt"):"";this.marginRight=e.marginRight?getMeasurement(e.marginRight,"0pt"):"";this.orphans=getInteger({data:e.orphans,defaultValue:0,validate:e=>e>=0});this.preserve=e.preserve||"";this.radixOffset=e.radixOffset?getMeasurement(e.radixOffset,"0pt"):"";this.spaceAbove=e.spaceAbove?getMeasurement(e.spaceAbove,"0pt"):"";this.spaceBelow=e.spaceBelow?getMeasurement(e.spaceBelow,"0pt"):"";this.tabDefault=e.tabDefault?getMeasurement(this.tabDefault):"";this.tabStops=(e.tabStops||"").trim().split(/\\s+/).map(((e,t)=>t%2==1?getMeasurement(e):e));this.textIndent=e.textIndent?getMeasurement(e.textIndent,"0pt"):"";this.use=e.use||"";this.usehref=e.usehref||"";this.vAlign=getStringOption(e.vAlign,["top","bottom","middle"]);this.widows=getInteger({data:e.widows,defaultValue:0,validate:e=>e>=0});this.hyphenation=null}[Zr](){const e=toStyle(this,"hAlign");""!==this.marginLeft&&(e.paddingLeft=measureToString(this.marginLeft));""!==this.marginRight&&(e.paddingRight=measureToString(this.marginRight));""!==this.spaceAbove&&(e.paddingTop=measureToString(this.spaceAbove));""!==this.spaceBelow&&(e.paddingBottom=measureToString(this.spaceBelow));if(""!==this.textIndent){e.textIndent=measureToString(this.textIndent);fixTextIndent(e)}this.lineHeight>0&&(e.lineHeight=measureToString(this.lineHeight));""!==this.tabDefault&&(e.tabSize=measureToString(this.tabDefault));this.tabStops.length;this.hyphenatation&&Object.assign(e,this.hyphenatation[Zr]());return e}}class PasswordEdit extends XFAObject{constructor(e){super(Nn,"passwordEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.passwordChar=e.passwordChar||"*";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}}class template_Pattern extends XFAObject{constructor(e){super(Nn,"pattern",!0);this.id=e.id||"";this.type=getStringOption(e.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Zr](e){e=e?e[Zr]():"#FFFFFF";const t=this.color?this.color[Zr]():"#000000",i="repeating-linear-gradient",a=`${e},${e} 5px,${t} 5px,${t} 10px`;switch(this.type){case"crossHatch":return`${i}(to top,${a}) ${i}(to right,${a})`;case"crossDiagonal":return`${i}(45deg,${a}) ${i}(-45deg,${a})`;case"diagonalLeft":return`${i}(45deg,${a})`;case"diagonalRight":return`${i}(-45deg,${a})`;case"horizontal":return`${i}(to top,${a})`;case"vertical":return`${i}(to right,${a})`}return""}}class Picture extends StringObject{constructor(e){super(Nn,"picture");this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Proto extends XFAObject{constructor(e){super(Nn,"proto",!0);this.appearanceFilter=new XFAObjectArray;this.arc=new XFAObjectArray;this.area=new XFAObjectArray;this.assist=new XFAObjectArray;this.barcode=new XFAObjectArray;this.bindItems=new XFAObjectArray;this.bookend=new XFAObjectArray;this.boolean=new XFAObjectArray;this.border=new XFAObjectArray;this.break=new XFAObjectArray;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.button=new XFAObjectArray;this.calculate=new XFAObjectArray;this.caption=new XFAObjectArray;this.certificate=new XFAObjectArray;this.certificates=new XFAObjectArray;this.checkButton=new XFAObjectArray;this.choiceList=new XFAObjectArray;this.color=new XFAObjectArray;this.comb=new XFAObjectArray;this.connect=new XFAObjectArray;this.contentArea=new XFAObjectArray;this.corner=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.dateTimeEdit=new XFAObjectArray;this.decimal=new XFAObjectArray;this.defaultUi=new XFAObjectArray;this.desc=new XFAObjectArray;this.digestMethod=new XFAObjectArray;this.digestMethods=new XFAObjectArray;this.draw=new XFAObjectArray;this.edge=new XFAObjectArray;this.encoding=new XFAObjectArray;this.encodings=new XFAObjectArray;this.encrypt=new XFAObjectArray;this.encryptData=new XFAObjectArray;this.encryption=new XFAObjectArray;this.encryptionMethod=new XFAObjectArray;this.encryptionMethods=new XFAObjectArray;this.event=new XFAObjectArray;this.exData=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.execute=new XFAObjectArray;this.extras=new XFAObjectArray;this.field=new XFAObjectArray;this.fill=new XFAObjectArray;this.filter=new XFAObjectArray;this.float=new XFAObjectArray;this.font=new XFAObjectArray;this.format=new XFAObjectArray;this.handler=new XFAObjectArray;this.hyphenation=new XFAObjectArray;this.image=new XFAObjectArray;this.imageEdit=new XFAObjectArray;this.integer=new XFAObjectArray;this.issuers=new XFAObjectArray;this.items=new XFAObjectArray;this.keep=new XFAObjectArray;this.keyUsage=new XFAObjectArray;this.line=new XFAObjectArray;this.linear=new XFAObjectArray;this.lockDocument=new XFAObjectArray;this.manifest=new XFAObjectArray;this.margin=new XFAObjectArray;this.mdp=new XFAObjectArray;this.medium=new XFAObjectArray;this.message=new XFAObjectArray;this.numericEdit=new XFAObjectArray;this.occur=new XFAObjectArray;this.oid=new XFAObjectArray;this.oids=new XFAObjectArray;this.overflow=new XFAObjectArray;this.pageArea=new XFAObjectArray;this.pageSet=new XFAObjectArray;this.para=new XFAObjectArray;this.passwordEdit=new XFAObjectArray;this.pattern=new XFAObjectArray;this.picture=new XFAObjectArray;this.radial=new XFAObjectArray;this.reason=new XFAObjectArray;this.reasons=new XFAObjectArray;this.rectangle=new XFAObjectArray;this.ref=new XFAObjectArray;this.script=new XFAObjectArray;this.setProperty=new XFAObjectArray;this.signData=new XFAObjectArray;this.signature=new XFAObjectArray;this.signing=new XFAObjectArray;this.solid=new XFAObjectArray;this.speak=new XFAObjectArray;this.stipple=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray;this.subjectDN=new XFAObjectArray;this.subjectDNs=new XFAObjectArray;this.submit=new XFAObjectArray;this.text=new XFAObjectArray;this.textEdit=new XFAObjectArray;this.time=new XFAObjectArray;this.timeStamp=new XFAObjectArray;this.toolTip=new XFAObjectArray;this.traversal=new XFAObjectArray;this.traverse=new XFAObjectArray;this.ui=new XFAObjectArray;this.validate=new XFAObjectArray;this.value=new XFAObjectArray;this.variables=new XFAObjectArray}}class Radial extends XFAObject{constructor(e){super(Nn,"radial",!0);this.id=e.id||"";this.type=getStringOption(e.type,["toEdge","toCenter"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Zr](e){e=e?e[Zr]():"#FFFFFF";const t=this.color?this.color[Zr]():"#000000";return`radial-gradient(circle at center, ${"toEdge"===this.type?`${e},${t}`:`${t},${e}`})`}}class Reason extends StringObject{constructor(e){super(Nn,"reason");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Reasons extends XFAObject{constructor(e){super(Nn,"reasons",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.reason=new XFAObjectArray}}class Rectangle extends XFAObject{constructor(e){super(Nn,"rectangle",!0);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.corner=new XFAObjectArray(4);this.edge=new XFAObjectArray(4);this.fill=null}[jr](){const e=this.edge.children.length?this.edge.children[0]:new Edge({}),t=e[Zr](),i=Object.create(null);"visible"===this.fill?.presence?Object.assign(i,this.fill[Zr]()):i.fill="transparent";i.strokeWidth=measureToString("visible"===e.presence?e.thickness:0);i.stroke=t.color;const a=(this.corner.children.length?this.corner.children[0]:new Corner({}))[Zr](),s={name:"svg",children:[{name:"rect",attributes:{xmlns:Gn,width:"100%",height:"100%",x:0,y:0,rx:a.radius,ry:a.radius,style:i}}],attributes:{xmlns:Gn,style:{overflow:"visible"},width:"100%",height:"100%"}};if(hasMargin(this[Ir]()[Ir]()))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[s]});s.attributes.style.position="absolute";return HTMLResult.success(s)}}class RefElement extends StringObject{constructor(e){super(Nn,"ref");this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Script extends StringObject{constructor(e){super(Nn,"script");this.binding=e.binding||"";this.contentType=e.contentType||"";this.id=e.id||"";this.name=e.name||"";this.runAt=getStringOption(e.runAt,["client","both","server"]);this.use=e.use||"";this.usehref=e.usehref||""}}class SetProperty extends XFAObject{constructor(e){super(Nn,"setProperty");this.connection=e.connection||"";this.ref=e.ref||"";this.target=e.target||""}}class SignData extends XFAObject{constructor(e){super(Nn,"signData",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["sign","clear","verify"]);this.ref=e.ref||"";this.target=e.target||"";this.use=e.use||"";this.usehref=e.usehref||"";this.filter=null;this.manifest=null}}class Signature extends XFAObject{constructor(e){super(Nn,"signature",!0);this.id=e.id||"";this.type=getStringOption(e.type,["PDF1.3","PDF1.6"]);this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.filter=null;this.manifest=null;this.margin=null}}class Signing extends XFAObject{constructor(e){super(Nn,"signing",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class Solid extends XFAObject{constructor(e){super(Nn,"solid",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[Zr](e){return e?e[Zr]():"#FFFFFF"}}class Speak extends StringObject{constructor(e){super(Nn,"speak");this.disable=getInteger({data:e.disable,defaultValue:0,validate:e=>1===e});this.id=e.id||"";this.priority=getStringOption(e.priority,["custom","caption","name","toolTip"]);this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Stipple extends XFAObject{constructor(e){super(Nn,"stipple",!0);this.id=e.id||"";this.rate=getInteger({data:e.rate,defaultValue:50,validate:e=>e>=0&&e<=100});this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Zr](e){const t=this.rate/100;return Util.makeHexColor(Math.round(e.value.r*(1-t)+this.value.r*t),Math.round(e.value.g*(1-t)+this.value.g*t),Math.round(e.value.b*(1-t)+this.value.b*t))}}class Subform extends XFAObject{constructor(e){super(Nn,"subform",!0);this.access=getStringOption(e.access,["open","nonInteractive","protected","readOnly"]);this.allowMacro=getInteger({data:e.allowMacro,defaultValue:0,validate:e=>1===e});this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.columnWidths=(e.columnWidths||"").trim().split(/\\s+/).map((e=>"-1"===e?-1:getMeasurement(e)));this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.layout=getStringOption(e.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]);this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.mergeMode=getStringOption(e.mergeMode,["consumeData","matchTemplate"]);this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.restoreState=getStringOption(e.restoreState,["manual","auto"]);this.scope=getStringOption(e.scope,["name","none"]);this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.bookend=null;this.border=null;this.break=null;this.calculate=null;this.desc=null;this.extras=null;this.keep=null;this.margin=null;this.occur=null;this.overflow=null;this.pageSet=null;this.para=null;this.traversal=null;this.validate=null;this.variables=null;this.area=new XFAObjectArray;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.connect=new XFAObjectArray;this.draw=new XFAObjectArray;this.event=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.proto=new XFAObjectArray;this.setProperty=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}[or](){const e=this[Ir]();return e instanceof SubformSet?e[or]():e}[dr](){return!0}[wr](){return this.layout.endsWith("-tb")&&0===this[Xs].attempt&&this[Xs].numberInLine>0||this[Ir]()[wr]()}*[nr](){yield*getContainedChildren(this)}[Vs](){return flushHTML(this)}[Ls](e,t){addHTML(this,e,t)}[$s](){return getAvailableSpace(this)}[yr](){const e=this[or]();if(!e[yr]())return!1;if(void 0!==this[Xs]._isSplittable)return this[Xs]._isSplittable;if("position"===this.layout||this.layout.includes("row")){this[Xs]._isSplittable=!1;return!1}if(this.keep&&"none"!==this.keep.intact){this[Xs]._isSplittable=!1;return!1}if(e.layout?.endsWith("-tb")&&0!==e[Xs].numberInLine)return!1;this[Xs]._isSplittable=!0;return!0}[jr](e){setTabIndex(this);if(this.break){if("auto"!==this.break.after||""!==this.break.afterTarget){const e=new BreakAfter({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});e[Cr]=this[Cr];this[Hs](e);this.breakAfter.push(e)}if("auto"!==this.break.before||""!==this.break.beforeTarget){const e=new BreakBefore({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});e[Cr]=this[Cr];this[Hs](e);this.breakBefore.push(e)}if(""!==this.break.overflowTarget){const e=new Overflow({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});e[Cr]=this[Cr];this[Hs](e);this.overflow.push(e)}this[Hr](this.break);this.break=null}if("hidden"===this.presence||"inactive"===this.presence)return HTMLResult.EMPTY;(this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&warn("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");if(this.breakBefore.children.length>=1){const e=this.breakBefore.children[0];if(handleBreak(e))return HTMLResult.breakNode(e)}if(this[Xs]?.afterBreakAfter)return HTMLResult.EMPTY;fixDimensions(this);const t=[],i={id:this[Vr],class:[]};setAccess(this,i.class);this[Xs]||(this[Xs]=Object.create(null));Object.assign(this[Xs],{children:t,line:null,attributes:i,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,e.width),height:Math.min(this.h||1/0,e.height)},width:0,height:0,prevHeight:0,currentWidth:0});const a=this[cr](),s=a[Xs].noLayoutFailure,r=this[yr]();r||setFirstUnsplittable(this);if(!checkDimensions(this,e))return HTMLResult.FAILURE;const n=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){const e=this[or]().columnWidths;if(Array.isArray(e)&&e.length>0){this[Xs].columnWidths=e;this[Xs].currentColumn=0}}const g=toStyle(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),o=["xfaSubform"],c=layoutClass(this);c&&o.push(c);i.style=g;i.class=o;this.name&&(i.xfaName=this.name);if(this.overflow){const t=this.overflow[ar]();if(t.addLeader){t.addLeader=!1;handleOverflow(this,t.leader,e)}}this[Lr]();const C="lr-tb"===this.layout||"rl-tb"===this.layout,h=C?2:1;for(;this[Xs].attempt=1){const e=this.breakAfter.children[0];if(handleBreak(e)){this[Xs].afterBreakAfter=p;return HTMLResult.breakNode(e)}}delete this[Xs];return p}}class SubformSet extends XFAObject{constructor(e){super(Nn,"subformSet",!0);this.id=e.id||"";this.name=e.name||"";this.relation=getStringOption(e.relation,["ordered","choice","unordered"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.bookend=null;this.break=null;this.desc=null;this.extras=null;this.occur=null;this.overflow=null;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}*[nr](){yield*getContainedChildren(this)}[or](){let e=this[Ir]();for(;!(e instanceof Subform);)e=e[Ir]();return e}[dr](){return!0}}class SubjectDN extends ContentObject{constructor(e){super(Nn,"subjectDN");this.delimiter=e.delimiter||",";this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){this[Os]=new Map(this[Os].split(this.delimiter).map((e=>{(e=e.split("=",2))[0]=e[0].trim();return e})))}}class SubjectDNs extends XFAObject{constructor(e){super(Nn,"subjectDNs",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.subjectDN=new XFAObjectArray}}class Submit extends XFAObject{constructor(e){super(Nn,"submit",!0);this.embedPDF=getInteger({data:e.embedPDF,defaultValue:0,validate:e=>1===e});this.format=getStringOption(e.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]);this.id=e.id||"";this.target=e.target||"";this.textEncoding=getKeyword({data:e.textEncoding?e.textEncoding.toLowerCase():"",defaultValue:"",validate:e=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(e)||e.match(/iso-8859-\\d{2}/)});this.use=e.use||"";this.usehref=e.usehref||"";this.xdpContent=e.xdpContent||"";this.encrypt=null;this.encryptData=new XFAObjectArray;this.signData=new XFAObjectArray}}class Template extends XFAObject{constructor(e){super(Nn,"template",!0);this.baseProfile=getStringOption(e.baseProfile,["full","interactiveForms"]);this.extras=null;this.subform=new XFAObjectArray}[Zs](){0===this.subform.children.length&&warn("XFA - No subforms in template node.");this.subform.children.length>=2&&warn("XFA - Several subforms in template node: please file a bug.");this[Or]=5e3}[yr](){return!0}[vr](e,t){return e.startsWith("#")?[this[lr].get(e.slice(1))]:searchNode(this,t,e,!0,!0)}*[Wr](){if(!this.subform.children.length)return HTMLResult.success({name:"div",children:[]});this[Xs]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};const e=this.subform.children[0];e.pageSet[vs]();const t=e.pageSet.pageArea.children,i={name:"div",children:[]};let a=null,s=null,r=null;if(e.breakBefore.children.length>=1){s=e.breakBefore.children[0];r=s.target}else if(e.subform.children.length>=1&&e.subform.children[0].breakBefore.children.length>=1){s=e.subform.children[0].breakBefore.children[0];r=s.target}else if(e.break?.beforeTarget){s=e.break;r=s.beforeTarget}else if(e.subform.children.length>=1&&e.subform.children[0].break?.beforeTarget){s=e.subform.children[0].break;r=s.beforeTarget}if(s){const e=this[vr](r,s[Ir]());if(e instanceof PageArea){a=e;s[Xs]={}}}a||(a=t[0]);a[Xs]={numberOfUse:1};const n=a[Ir]();n[Xs]={numberOfUse:1,pageIndex:n.pageArea.children.indexOf(a),pageSetIndex:0};let g,o=null,c=null,C=!0,h=0,l=0;for(;;){if(C)h=0;else{i.children.pop();if(3==++h){warn("XFA - Something goes wrong: please file a bug.");return i}}g=null;this[Xs].currentPageArea=a;const t=a[jr]().html;i.children.push(t);if(o){this[Xs].noLayoutFailure=!0;t.children.push(o[jr](a[Xs].space).html);o=null}if(c){this[Xs].noLayoutFailure=!0;t.children.push(c[jr](a[Xs].space).html);c=null}const s=a.contentArea.children,r=t.children.filter((e=>e.attributes.class.includes("xfaContentarea")));C=!1;this[Xs].firstUnsplittable=null;this[Xs].noLayoutFailure=!1;const flush=t=>{const i=e[Vs]();if(i){C||=i.children?.length>0;r[t].children.push(i)}};for(let t=l,a=s.length;t0;r[t].children.push(h.html)}else!C&&i.children.length>1&&i.children.pop();return i}if(h.isBreak()){const e=h.breakNode;flush(t);if("auto"===e.targetType)continue;if(e.leader){o=this[vr](e.leader,e[Ir]());o=o?o[0]:null}if(e.trailer){c=this[vr](e.trailer,e[Ir]());c=c?c[0]:null}if("pageArea"===e.targetType){g=e[Xs].target;t=1/0}else if(e[Xs].target){g=e[Xs].target;l=e[Xs].index+1;t=1/0}else t=e[Xs].index}else if(this[Xs].overflowNode){const e=this[Xs].overflowNode;this[Xs].overflowNode=null;const i=e[ar](),a=i.target;i.addLeader=null!==i.leader;i.addTrailer=null!==i.trailer;flush(t);const r=t;t=1/0;if(a instanceof PageArea)g=a;else if(a instanceof ContentArea){const e=s.indexOf(a);if(-1!==e)e>r?t=e-1:l=e;else{g=a[Ir]();l=g.contentArea.children.indexOf(a)}}}else flush(t)}this[Xs].pageNumber+=1;g&&(g[br]()?g[Xs].numberOfUse+=1:g=null);a=g||a[gr]();yield null}}}class Text extends ContentObject{constructor(e){super(Nn,"text");this.id=e.id||"";this.maxChars=getInteger({data:e.maxChars,defaultValue:0,validate:e=>e>=0});this.name=e.name||"";this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}[xs](){return!0}[Nr](e){if(e[Sr]===_r.xhtml.id){this[Os]=e;return!0}warn(`XFA - Invalid content in Text: ${e[kr]}.`);return!1}[Mr](e){this[Os]instanceof XFAObject||super[Mr](e)}[Zs](){"string"==typeof this[Os]&&(this[Os]=this[Os].replaceAll("\\r\\n","\\n"))}[ar](){return"string"==typeof this[Os]?this[Os].split(/[\\u2029\\u2028\\n]/).reduce(((e,t)=>{t&&e.push(t);return e}),[]).join("\\n"):this[Os][Pr]()}[jr](e){if("string"==typeof this[Os]){const e=valueToHtml(this[Os]).html;if(this[Os].includes("\\u2029")){e.name="div";e.children=[];this[Os].split("\\u2029").map((e=>e.split(/[\\u2028\\n]/).reduce(((e,t)=>{e.push({name:"span",value:t},{name:"br"});return e}),[]))).forEach((t=>{e.children.push({name:"p",children:t})}))}else if(/[\\u2028\\n]/.test(this[Os])){e.name="div";e.children=[];this[Os].split(/[\\u2028\\n]/).forEach((t=>{e.children.push({name:"span",value:t},{name:"br"})}))}return HTMLResult.success(e)}return this[Os][jr](e)}}class TextEdit extends XFAObject{constructor(e){super(Nn,"textEdit",!0);this.allowRichText=getInteger({data:e.allowRichText,defaultValue:0,validate:e=>1===e});this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.multiLine=getInteger({data:e.multiLine,defaultValue:"",validate:e=>0===e||1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.vScrollPolicy=getStringOption(e.vScrollPolicy,["auto","off","on"]);this.border=null;this.comb=null;this.extras=null;this.margin=null}[jr](e){const t=toStyle(this,"border","font","margin");let i;const a=this[Ir]()[Ir]();""===this.multiLine&&(this.multiLine=a instanceof Draw?1:0);i=1===this.multiLine?{name:"textarea",attributes:{dataId:a[Ws]?.[Vr]||a[Vr],fieldId:a[Vr],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(a),"aria-required":!1}}:{name:"input",attributes:{type:"text",dataId:a[Ws]?.[Vr]||a[Vr],fieldId:a[Vr],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(a),"aria-required":!1}};if(isRequired(a)){i.attributes["aria-required"]=!0;i.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class Time extends StringObject{constructor(e){super(Nn,"time");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){const e=this[Os].trim();this[Os]=e?new Date(e):null}[jr](e){return valueToHtml(this[Os]?this[Os].toString():"")}}class TimeStamp extends XFAObject{constructor(e){super(Nn,"timeStamp");this.id=e.id||"";this.server=e.server||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class ToolTip extends StringObject{constructor(e){super(Nn,"toolTip");this.id=e.id||"";this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Traversal extends XFAObject{constructor(e){super(Nn,"traversal",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.traverse=new XFAObjectArray}}class Traverse extends XFAObject{constructor(e){super(Nn,"traverse",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["next","back","down","first","left","right","up"]);this.ref=e.ref||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.script=null}get name(){return this.operation}[Dr](){return!1}}class Ui extends XFAObject{constructor(e){super(Nn,"ui",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.picture=null;this.barcode=null;this.button=null;this.checkButton=null;this.choiceList=null;this.dateTimeEdit=null;this.defaultUi=null;this.imageEdit=null;this.numericEdit=null;this.passwordEdit=null;this.signature=null;this.textEdit=null}[ar](){if(void 0===this[Xs]){for(const e of Object.getOwnPropertyNames(this)){if("extras"===e||"picture"===e)continue;const t=this[e];if(t instanceof XFAObject){this[Xs]=t;return t}}this[Xs]=null}return this[Xs]}[jr](e){const t=this[ar]();return t?t[jr](e):HTMLResult.EMPTY}}class Validate extends XFAObject{constructor(e){super(Nn,"validate",!0);this.formatTest=getStringOption(e.formatTest,["warning","disabled","error"]);this.id=e.id||"";this.nullTest=getStringOption(e.nullTest,["disabled","error","warning"]);this.scriptTest=getStringOption(e.scriptTest,["error","disabled","warning"]);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.message=null;this.picture=null;this.script=null}}class Value extends XFAObject{constructor(e){super(Nn,"value",!0);this.id=e.id||"";this.override=getInteger({data:e.override,defaultValue:0,validate:e=>1===e});this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.arc=null;this.boolean=null;this.date=null;this.dateTime=null;this.decimal=null;this.exData=null;this.float=null;this.image=null;this.integer=null;this.line=null;this.rectangle=null;this.text=null;this.time=null}[qr](e){const t=this[Ir]();if(t instanceof Field&&t.ui?.imageEdit){if(!this.image){this.image=new Image({});this[Hs](this.image)}this.image[Os]=e[Os];return}const i=e[kr];if(null===this[i]){for(const e of Object.getOwnPropertyNames(this)){const t=this[e];if(t instanceof XFAObject){this[e]=null;this[Hr](t)}}this[e[kr]]=e;this[Hs](e)}else this[i][Os]=e[Os]}[Pr](){if(this.exData)return"string"==typeof this.exData[Os]?this.exData[Os].trim():this.exData[Os][Pr]().trim();for(const e of Object.getOwnPropertyNames(this)){if("image"===e)continue;const t=this[e];if(t instanceof XFAObject)return(t[Os]||"").toString().trim()}return null}[jr](e){for(const t of Object.getOwnPropertyNames(this)){const i=this[t];if(i instanceof XFAObject)return i[jr](e)}return HTMLResult.EMPTY}}class Variables extends XFAObject{constructor(e){super(Nn,"variables",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.manifest=new XFAObjectArray;this.script=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}[Dr](){return!0}}class TemplateNamespace{static[zr](e,t){if(TemplateNamespace.hasOwnProperty(e)){const i=TemplateNamespace[e](t);i[Tr](t);return i}}static appearanceFilter(e){return new AppearanceFilter(e)}static arc(e){return new Arc(e)}static area(e){return new Area(e)}static assist(e){return new Assist(e)}static barcode(e){return new Barcode(e)}static bind(e){return new Bind(e)}static bindItems(e){return new BindItems(e)}static bookend(e){return new Bookend(e)}static boolean(e){return new BooleanElement(e)}static border(e){return new Border(e)}static break(e){return new Break(e)}static breakAfter(e){return new BreakAfter(e)}static breakBefore(e){return new BreakBefore(e)}static button(e){return new Button(e)}static calculate(e){return new Calculate(e)}static caption(e){return new Caption(e)}static certificate(e){return new Certificate(e)}static certificates(e){return new Certificates(e)}static checkButton(e){return new CheckButton(e)}static choiceList(e){return new ChoiceList(e)}static color(e){return new Color(e)}static comb(e){return new Comb(e)}static connect(e){return new Connect(e)}static contentArea(e){return new ContentArea(e)}static corner(e){return new Corner(e)}static date(e){return new DateElement(e)}static dateTime(e){return new DateTime(e)}static dateTimeEdit(e){return new DateTimeEdit(e)}static decimal(e){return new Decimal(e)}static defaultUi(e){return new DefaultUi(e)}static desc(e){return new Desc(e)}static digestMethod(e){return new DigestMethod(e)}static digestMethods(e){return new DigestMethods(e)}static draw(e){return new Draw(e)}static edge(e){return new Edge(e)}static encoding(e){return new Encoding(e)}static encodings(e){return new Encodings(e)}static encrypt(e){return new Encrypt(e)}static encryptData(e){return new EncryptData(e)}static encryption(e){return new Encryption(e)}static encryptionMethod(e){return new EncryptionMethod(e)}static encryptionMethods(e){return new EncryptionMethods(e)}static event(e){return new Event(e)}static exData(e){return new ExData(e)}static exObject(e){return new ExObject(e)}static exclGroup(e){return new ExclGroup(e)}static execute(e){return new Execute(e)}static extras(e){return new Extras(e)}static field(e){return new Field(e)}static fill(e){return new Fill(e)}static filter(e){return new Filter(e)}static float(e){return new Float(e)}static font(e){return new template_Font(e)}static format(e){return new Format(e)}static handler(e){return new Handler(e)}static hyphenation(e){return new Hyphenation(e)}static image(e){return new Image(e)}static imageEdit(e){return new ImageEdit(e)}static integer(e){return new Integer(e)}static issuers(e){return new Issuers(e)}static items(e){return new Items(e)}static keep(e){return new Keep(e)}static keyUsage(e){return new KeyUsage(e)}static line(e){return new Line(e)}static linear(e){return new Linear(e)}static lockDocument(e){return new LockDocument(e)}static manifest(e){return new Manifest(e)}static margin(e){return new Margin(e)}static mdp(e){return new Mdp(e)}static medium(e){return new Medium(e)}static message(e){return new Message(e)}static numericEdit(e){return new NumericEdit(e)}static occur(e){return new Occur(e)}static oid(e){return new Oid(e)}static oids(e){return new Oids(e)}static overflow(e){return new Overflow(e)}static pageArea(e){return new PageArea(e)}static pageSet(e){return new PageSet(e)}static para(e){return new Para(e)}static passwordEdit(e){return new PasswordEdit(e)}static pattern(e){return new template_Pattern(e)}static picture(e){return new Picture(e)}static proto(e){return new Proto(e)}static radial(e){return new Radial(e)}static reason(e){return new Reason(e)}static reasons(e){return new Reasons(e)}static rectangle(e){return new Rectangle(e)}static ref(e){return new RefElement(e)}static script(e){return new Script(e)}static setProperty(e){return new SetProperty(e)}static signData(e){return new SignData(e)}static signature(e){return new Signature(e)}static signing(e){return new Signing(e)}static solid(e){return new Solid(e)}static speak(e){return new Speak(e)}static stipple(e){return new Stipple(e)}static subform(e){return new Subform(e)}static subformSet(e){return new SubformSet(e)}static subjectDN(e){return new SubjectDN(e)}static subjectDNs(e){return new SubjectDNs(e)}static submit(e){return new Submit(e)}static template(e){return new Template(e)}static text(e){return new Text(e)}static textEdit(e){return new TextEdit(e)}static time(e){return new Time(e)}static timeStamp(e){return new TimeStamp(e)}static toolTip(e){return new ToolTip(e)}static traversal(e){return new Traversal(e)}static traverse(e){return new Traverse(e)}static ui(e){return new Ui(e)}static validate(e){return new Validate(e)}static value(e){return new Value(e)}static variables(e){return new Variables(e)}}const Ln=_r.datasets.id;function createText(e){const t=new Text({});t[Os]=e;return t}class Binder{constructor(e){this.root=e;this.datasets=e.datasets;this.data=e.datasets?.data||new XmlObject(_r.datasets.id,"data");this.emptyMerge=0===this.data[rr]().length;this.root.form=this.form=e.template[Ts]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){this._bindElement(this.form,this.data);return this.form}getData(){return this.data}_bindValue(e,t,i){e[Ws]=t;if(e[hr]())if(t[fr]()){const i=t[ir]();e[qr](createText(i))}else if(e instanceof Field&&"multiSelect"===e.ui?.choiceList?.open){const i=t[rr]().map((e=>e[Os].trim())).join("\\n");e[qr](createText(i))}else this._isConsumeData()&&warn("XFA - Nodes haven\'t the same type.");else!t[fr]()||this._isMatchTemplate()?this._bindElement(e,t):warn("XFA - Nodes haven\'t the same type.")}_findDataByNameToConsume(e,t,i,a){if(!e)return null;let s,r;for(let a=0;a<3;a++){s=i[sr](e,!1,!0);for(;;){r=s.next().value;if(!r)break;if(t===r[fr]())return r}if(i[Sr]===_r.datasets.id&&"data"===i[kr])break;i=i[Ir]()}if(!a)return null;s=this.data[sr](e,!0,!1);r=s.next().value;if(r)return r;s=this.data[zs](e,!0);r=s.next().value;return r?.[fr]()?r:null}_setProperties(e,t){if(e.hasOwnProperty("setProperty"))for(const{ref:i,target:a,connection:s}of e.setProperty.children){if(s)continue;if(!i)continue;const r=searchNode(this.root,t,i,!1,!1);if(!r){warn(`XFA - Invalid reference: ${i}.`);continue}const[n]=r;if(!n[pr](this.data)){warn("XFA - Invalid node: must be a data node.");continue}const g=searchNode(this.root,e,a,!1,!1);if(!g){warn(`XFA - Invalid target: ${a}.`);continue}const[o]=g;if(!o[pr](e)){warn("XFA - Invalid target: must be a property or subproperty.");continue}const c=o[Ir]();if(o instanceof SetProperty||c instanceof SetProperty){warn("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(o instanceof BindItems||c instanceof BindItems){warn("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}const C=n[Pr](),h=o[kr];if(o instanceof XFAAttribute){const e=Object.create(null);e[h]=C;const t=Reflect.construct(Object.getPrototypeOf(c).constructor,[e]);c[h]=t[h]}else if(o.hasOwnProperty(Os)){o[Ws]=n;o[Os]=C;o[Zs]()}else warn("XFA - Invalid node to use in setProperty")}}_bindItems(e,t){if(!e.hasOwnProperty("items")||!e.hasOwnProperty("bindItems")||e.bindItems.isEmpty())return;for(const t of e.items.children)e[Hr](t);e.items.clear();const i=new Items({}),a=new Items({});e[Hs](i);e.items.push(i);e[Hs](a);e.items.push(a);for(const{ref:s,labelRef:r,valueRef:n,connection:g}of e.bindItems.children){if(g)continue;if(!s)continue;const e=searchNode(this.root,t,s,!1,!1);if(e)for(const t of e){if(!t[pr](this.datasets)){warn(`XFA - Invalid ref (${s}): must be a datasets child.`);continue}const e=searchNode(this.root,t,r,!0,!1);if(!e){warn(`XFA - Invalid label: ${r}.`);continue}const[g]=e;if(!g[pr](this.datasets)){warn("XFA - Invalid label: must be a datasets child.");continue}const o=searchNode(this.root,t,n,!0,!1);if(!o){warn(`XFA - Invalid value: ${n}.`);continue}const[c]=o;if(!c[pr](this.datasets)){warn("XFA - Invalid value: must be a datasets child.");continue}const C=createText(g[Pr]()),h=createText(c[Pr]());i[Hs](C);i.text.push(C);a[Hs](h);a.text.push(h)}else warn(`XFA - Invalid reference: ${s}.`)}}_bindOccurrences(e,t,i){let a;if(t.length>1){a=e[Ts]();a[Hr](a.occur);a.occur=null}this._bindValue(e,t[0],i);this._setProperties(e,t[0]);this._bindItems(e,t[0]);if(1===t.length)return;const s=e[Ir](),r=e[kr],n=s[Qr](e);for(let e=1,g=t.length;et.name===e.name)).length:i[a].children.length;const r=i[Qr](e)+1,n=t.initial-s;if(n){const t=e[Ts]();t[Hr](t.occur);t.occur=null;i[a].push(t);i[Er](r,t);for(let e=1;e0)this._bindOccurrences(a,[e[0]],null);else if(this.emptyMerge){const e=t[Sr]===Ln?-1:t[Sr],i=a[Ws]=new XmlObject(e,a.name||"root");t[Hs](i);this._bindElement(a,i)}continue}if(!a[dr]())continue;let e=!1,s=null,r=null,n=null;if(a.bind){switch(a.bind.match){case"none":this._setAndBind(a,t);continue;case"global":e=!0;break;case"dataRef":if(!a.bind.ref){warn(`XFA - ref is empty in node ${a[kr]}.`);this._setAndBind(a,t);continue}r=a.bind.ref}a.bind.picture&&(s=a.bind.picture[Os])}const[g,o]=this._getOccurInfo(a);if(r){n=searchNode(this.root,t,r,!0,!1);if(null===n){n=createDataNode(this.data,t,r);if(!n)continue;this._isConsumeData()&&(n[qs]=!0);this._setAndBind(a,n);continue}this._isConsumeData()&&(n=n.filter((e=>!e[qs])));n.length>o?n=n.slice(0,o):0===n.length&&(n=null);n&&this._isConsumeData()&&n.forEach((e=>{e[qs]=!0}))}else{if(!a.name){this._setAndBind(a,t);continue}if(this._isConsumeData()){const i=[];for(;i.length0?i:null}else{n=t[sr](a.name,!1,this.emptyMerge).next().value;if(!n){if(0===g){i.push(a);continue}const e=t[Sr]===Ln?-1:t[Sr];n=a[Ws]=new XmlObject(e,a.name);this.emptyMerge&&(n[qs]=!0);t[Hs](n);this._setAndBind(a,n);continue}this.emptyMerge&&(n[qs]=!0);n=[n]}}n?this._bindOccurrences(a,n,s):g>0?this._setAndBind(a,t):i.push(a)}i.forEach((e=>e[Ir]()[Hr](e)))}}class DataHandler{constructor(e,t){this.data=t;this.dataset=e.datasets||null}serialize(e){const t=[[-1,this.data[rr]()]];for(;t.length>0;){const i=t.at(-1),[a,s]=i;if(a+1===s.length){t.pop();continue}const r=s[++i[0]],n=e.get(r[Vr]);if(n)r[qr](n);else{const t=r[_s]();for(const i of t.values()){const t=e.get(i[Vr]);if(t){i[qr](t);break}}}const g=r[rr]();g.length>0&&t.push([-1,g])}const i=[\'\'];if(this.dataset)for(const e of this.dataset[rr]())"data"!==e[kr]&&e[Xr](i);this.data[Xr](i);i.push("");return i.join("")}}const Hn=_r.config.id;class Acrobat extends XFAObject{constructor(e){super(Hn,"acrobat",!0);this.acrobat7=null;this.autoSave=null;this.common=null;this.validate=null;this.validateApprovalSignatures=null;this.submitUrl=new XFAObjectArray}}class Acrobat7 extends XFAObject{constructor(e){super(Hn,"acrobat7",!0);this.dynamicRender=null}}class ADBE_JSConsole extends OptionObject{constructor(e){super(Hn,"ADBE_JSConsole",["delegate","Enable","Disable"])}}class ADBE_JSDebugger extends OptionObject{constructor(e){super(Hn,"ADBE_JSDebugger",["delegate","Enable","Disable"])}}class AddSilentPrint extends Option01{constructor(e){super(Hn,"addSilentPrint")}}class AddViewerPreferences extends Option01{constructor(e){super(Hn,"addViewerPreferences")}}class AdjustData extends Option10{constructor(e){super(Hn,"adjustData")}}class AdobeExtensionLevel extends IntegerObject{constructor(e){super(Hn,"adobeExtensionLevel",0,(e=>e>=1&&e<=8))}}class Agent extends XFAObject{constructor(e){super(Hn,"agent",!0);this.name=e.name?e.name.trim():"";this.common=new XFAObjectArray}}class AlwaysEmbed extends ContentObject{constructor(e){super(Hn,"alwaysEmbed")}}class Amd extends StringObject{constructor(e){super(Hn,"amd")}}class config_Area extends XFAObject{constructor(e){super(Hn,"area");this.level=getInteger({data:e.level,defaultValue:0,validate:e=>e>=1&&e<=3});this.name=getStringOption(e.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}}class Attributes extends OptionObject{constructor(e){super(Hn,"attributes",["preserve","delegate","ignore"])}}class AutoSave extends OptionObject{constructor(e){super(Hn,"autoSave",["disabled","enabled"])}}class Base extends StringObject{constructor(e){super(Hn,"base")}}class BatchOutput extends XFAObject{constructor(e){super(Hn,"batchOutput");this.format=getStringOption(e.format,["none","concat","zip","zipCompress"])}}class BehaviorOverride extends ContentObject{constructor(e){super(Hn,"behaviorOverride")}[Zs](){this[Os]=new Map(this[Os].trim().split(/\\s+/).filter((e=>e.includes(":"))).map((e=>e.split(":",2))))}}class Cache extends XFAObject{constructor(e){super(Hn,"cache",!0);this.templateCache=null}}class Change extends Option01{constructor(e){super(Hn,"change")}}class Common extends XFAObject{constructor(e){super(Hn,"common",!0);this.data=null;this.locale=null;this.localeSet=null;this.messaging=null;this.suppressBanner=null;this.template=null;this.validationMessaging=null;this.versionControl=null;this.log=new XFAObjectArray}}class Compress extends XFAObject{constructor(e){super(Hn,"compress");this.scope=getStringOption(e.scope,["imageOnly","document"])}}class CompressLogicalStructure extends Option01{constructor(e){super(Hn,"compressLogicalStructure")}}class CompressObjectStream extends Option10{constructor(e){super(Hn,"compressObjectStream")}}class Compression extends XFAObject{constructor(e){super(Hn,"compression",!0);this.compressLogicalStructure=null;this.compressObjectStream=null;this.level=null;this.type=null}}class Config extends XFAObject{constructor(e){super(Hn,"config",!0);this.acrobat=null;this.present=null;this.trace=null;this.agent=new XFAObjectArray}}class Conformance extends OptionObject{constructor(e){super(Hn,"conformance",["A","B"])}}class ContentCopy extends Option01{constructor(e){super(Hn,"contentCopy")}}class Copies extends IntegerObject{constructor(e){super(Hn,"copies",1,(e=>e>=1))}}class Creator extends StringObject{constructor(e){super(Hn,"creator")}}class CurrentPage extends IntegerObject{constructor(e){super(Hn,"currentPage",0,(e=>e>=0))}}class Data extends XFAObject{constructor(e){super(Hn,"data",!0);this.adjustData=null;this.attributes=null;this.incrementalLoad=null;this.outputXSL=null;this.range=null;this.record=null;this.startNode=null;this.uri=null;this.window=null;this.xsl=null;this.excludeNS=new XFAObjectArray;this.transform=new XFAObjectArray}}class Debug extends XFAObject{constructor(e){super(Hn,"debug",!0);this.uri=null}}class DefaultTypeface extends ContentObject{constructor(e){super(Hn,"defaultTypeface");this.writingScript=getStringOption(e.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}}class Destination extends OptionObject{constructor(e){super(Hn,"destination",["pdf","pcl","ps","webClient","zpl"])}}class DocumentAssembly extends Option01{constructor(e){super(Hn,"documentAssembly")}}class Driver extends XFAObject{constructor(e){super(Hn,"driver",!0);this.name=e.name?e.name.trim():"";this.fontInfo=null;this.xdc=null}}class DuplexOption extends OptionObject{constructor(e){super(Hn,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}}class DynamicRender extends OptionObject{constructor(e){super(Hn,"dynamicRender",["forbidden","required"])}}class Embed extends Option01{constructor(e){super(Hn,"embed")}}class config_Encrypt extends Option01{constructor(e){super(Hn,"encrypt")}}class config_Encryption extends XFAObject{constructor(e){super(Hn,"encryption",!0);this.encrypt=null;this.encryptionLevel=null;this.permissions=null}}class EncryptionLevel extends OptionObject{constructor(e){super(Hn,"encryptionLevel",["40bit","128bit"])}}class Enforce extends StringObject{constructor(e){super(Hn,"enforce")}}class Equate extends XFAObject{constructor(e){super(Hn,"equate");this.force=getInteger({data:e.force,defaultValue:1,validate:e=>0===e});this.from=e.from||"";this.to=e.to||""}}class EquateRange extends XFAObject{constructor(e){super(Hn,"equateRange");this.from=e.from||"";this.to=e.to||"";this._unicodeRange=e.unicodeRange||""}get unicodeRange(){const e=[],t=/U\\+([0-9a-fA-F]+)/,i=this._unicodeRange;for(let a of i.split(",").map((e=>e.trim())).filter((e=>!!e))){a=a.split("-",2).map((e=>{const i=e.match(t);return i?parseInt(i[1],16):0}));1===a.length&&a.push(a[0]);e.push(a)}return shadow(this,"unicodeRange",e)}}class Exclude extends ContentObject{constructor(e){super(Hn,"exclude")}[Zs](){this[Os]=this[Os].trim().split(/\\s+/).filter((e=>e&&["calculate","close","enter","exit","initialize","ready","validate"].includes(e)))}}class ExcludeNS extends StringObject{constructor(e){super(Hn,"excludeNS")}}class FlipLabel extends OptionObject{constructor(e){super(Hn,"flipLabel",["usePrinterSetting","on","off"])}}class config_FontInfo extends XFAObject{constructor(e){super(Hn,"fontInfo",!0);this.embed=null;this.map=null;this.subsetBelow=null;this.alwaysEmbed=new XFAObjectArray;this.defaultTypeface=new XFAObjectArray;this.neverEmbed=new XFAObjectArray}}class FormFieldFilling extends Option01{constructor(e){super(Hn,"formFieldFilling")}}class GroupParent extends StringObject{constructor(e){super(Hn,"groupParent")}}class IfEmpty extends OptionObject{constructor(e){super(Hn,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}}class IncludeXDPContent extends StringObject{constructor(e){super(Hn,"includeXDPContent")}}class IncrementalLoad extends OptionObject{constructor(e){super(Hn,"incrementalLoad",["none","forwardOnly"])}}class IncrementalMerge extends Option01{constructor(e){super(Hn,"incrementalMerge")}}class Interactive extends Option01{constructor(e){super(Hn,"interactive")}}class Jog extends OptionObject{constructor(e){super(Hn,"jog",["usePrinterSetting","none","pageSet"])}}class LabelPrinter extends XFAObject{constructor(e){super(Hn,"labelPrinter",!0);this.name=getStringOption(e.name,["zpl","dpl","ipl","tcpl"]);this.batchOutput=null;this.flipLabel=null;this.fontInfo=null;this.xdc=null}}class Layout extends OptionObject{constructor(e){super(Hn,"layout",["paginate","panel"])}}class Level extends IntegerObject{constructor(e){super(Hn,"level",0,(e=>e>0))}}class Linearized extends Option01{constructor(e){super(Hn,"linearized")}}class Locale extends StringObject{constructor(e){super(Hn,"locale")}}class LocaleSet extends StringObject{constructor(e){super(Hn,"localeSet")}}class Log extends XFAObject{constructor(e){super(Hn,"log",!0);this.mode=null;this.threshold=null;this.to=null;this.uri=null}}class MapElement extends XFAObject{constructor(e){super(Hn,"map",!0);this.equate=new XFAObjectArray;this.equateRange=new XFAObjectArray}}class MediumInfo extends XFAObject{constructor(e){super(Hn,"mediumInfo",!0);this.map=null}}class config_Message extends XFAObject{constructor(e){super(Hn,"message",!0);this.msgId=null;this.severity=null}}class Messaging extends XFAObject{constructor(e){super(Hn,"messaging",!0);this.message=new XFAObjectArray}}class Mode extends OptionObject{constructor(e){super(Hn,"mode",["append","overwrite"])}}class ModifyAnnots extends Option01{constructor(e){super(Hn,"modifyAnnots")}}class MsgId extends IntegerObject{constructor(e){super(Hn,"msgId",1,(e=>e>=1))}}class NameAttr extends StringObject{constructor(e){super(Hn,"nameAttr")}}class NeverEmbed extends ContentObject{constructor(e){super(Hn,"neverEmbed")}}class NumberOfCopies extends IntegerObject{constructor(e){super(Hn,"numberOfCopies",null,(e=>e>=2&&e<=5))}}class OpenAction extends XFAObject{constructor(e){super(Hn,"openAction",!0);this.destination=null}}class Output extends XFAObject{constructor(e){super(Hn,"output",!0);this.to=null;this.type=null;this.uri=null}}class OutputBin extends StringObject{constructor(e){super(Hn,"outputBin")}}class OutputXSL extends XFAObject{constructor(e){super(Hn,"outputXSL",!0);this.uri=null}}class Overprint extends OptionObject{constructor(e){super(Hn,"overprint",["none","both","draw","field"])}}class Packets extends StringObject{constructor(e){super(Hn,"packets")}[Zs](){"*"!==this[Os]&&(this[Os]=this[Os].trim().split(/\\s+/).filter((e=>["config","datasets","template","xfdf","xslt"].includes(e))))}}class PageOffset extends XFAObject{constructor(e){super(Hn,"pageOffset");this.x=getInteger({data:e.x,defaultValue:"useXDCSetting",validate:e=>!0});this.y=getInteger({data:e.y,defaultValue:"useXDCSetting",validate:e=>!0})}}class PageRange extends StringObject{constructor(e){super(Hn,"pageRange")}[Zs](){const e=this[Os].trim().split(/\\s+/).map((e=>parseInt(e,10))),t=[];for(let i=0,a=e.length;i!1))}}class Pcl extends XFAObject{constructor(e){super(Hn,"pcl",!0);this.name=e.name||"";this.batchOutput=null;this.fontInfo=null;this.jog=null;this.mediumInfo=null;this.outputBin=null;this.pageOffset=null;this.staple=null;this.xdc=null}}class Pdf extends XFAObject{constructor(e){super(Hn,"pdf",!0);this.name=e.name||"";this.adobeExtensionLevel=null;this.batchOutput=null;this.compression=null;this.creator=null;this.encryption=null;this.fontInfo=null;this.interactive=null;this.linearized=null;this.openAction=null;this.pdfa=null;this.producer=null;this.renderPolicy=null;this.scriptModel=null;this.silentPrint=null;this.submitFormat=null;this.tagged=null;this.version=null;this.viewerPreferences=null;this.xdc=null}}class Pdfa extends XFAObject{constructor(e){super(Hn,"pdfa",!0);this.amd=null;this.conformance=null;this.includeXDPContent=null;this.part=null}}class Permissions extends XFAObject{constructor(e){super(Hn,"permissions",!0);this.accessibleContent=null;this.change=null;this.contentCopy=null;this.documentAssembly=null;this.formFieldFilling=null;this.modifyAnnots=null;this.plaintextMetadata=null;this.print=null;this.printHighQuality=null}}class PickTrayByPDFSize extends Option01{constructor(e){super(Hn,"pickTrayByPDFSize")}}class config_Picture extends StringObject{constructor(e){super(Hn,"picture")}}class PlaintextMetadata extends Option01{constructor(e){super(Hn,"plaintextMetadata")}}class Presence extends OptionObject{constructor(e){super(Hn,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}}class Present extends XFAObject{constructor(e){super(Hn,"present",!0);this.behaviorOverride=null;this.cache=null;this.common=null;this.copies=null;this.destination=null;this.incrementalMerge=null;this.layout=null;this.output=null;this.overprint=null;this.pagination=null;this.paginationOverride=null;this.script=null;this.validate=null;this.xdp=null;this.driver=new XFAObjectArray;this.labelPrinter=new XFAObjectArray;this.pcl=new XFAObjectArray;this.pdf=new XFAObjectArray;this.ps=new XFAObjectArray;this.submitUrl=new XFAObjectArray;this.webClient=new XFAObjectArray;this.zpl=new XFAObjectArray}}class Print extends Option01{constructor(e){super(Hn,"print")}}class PrintHighQuality extends Option01{constructor(e){super(Hn,"printHighQuality")}}class PrintScaling extends OptionObject{constructor(e){super(Hn,"printScaling",["appdefault","noScaling"])}}class PrinterName extends StringObject{constructor(e){super(Hn,"printerName")}}class Producer extends StringObject{constructor(e){super(Hn,"producer")}}class Ps extends XFAObject{constructor(e){super(Hn,"ps",!0);this.name=e.name||"";this.batchOutput=null;this.fontInfo=null;this.jog=null;this.mediumInfo=null;this.outputBin=null;this.staple=null;this.xdc=null}}class Range extends ContentObject{constructor(e){super(Hn,"range")}[Zs](){this[Os]=this[Os].trim().split(/\\s*,\\s*/,2).map((e=>e.split("-").map((e=>parseInt(e.trim(),10))))).filter((e=>e.every((e=>!isNaN(e))))).map((e=>{1===e.length&&e.push(e[0]);return e}))}}class Record extends ContentObject{constructor(e){super(Hn,"record")}[Zs](){this[Os]=this[Os].trim();const e=parseInt(this[Os],10);!isNaN(e)&&e>=0&&(this[Os]=e)}}class Relevant extends ContentObject{constructor(e){super(Hn,"relevant")}[Zs](){this[Os]=this[Os].trim().split(/\\s+/)}}class Rename extends ContentObject{constructor(e){super(Hn,"rename")}[Zs](){this[Os]=this[Os].trim();(this[Os].toLowerCase().startsWith("xml")||new RegExp("[\\\\p{L}_][\\\\p{L}\\\\d._\\\\p{M}-]*","u").test(this[Os]))&&warn("XFA - Rename: invalid XFA name")}}class RenderPolicy extends OptionObject{constructor(e){super(Hn,"renderPolicy",["server","client"])}}class RunScripts extends OptionObject{constructor(e){super(Hn,"runScripts",["both","client","none","server"])}}class config_Script extends XFAObject{constructor(e){super(Hn,"script",!0);this.currentPage=null;this.exclude=null;this.runScripts=null}}class ScriptModel extends OptionObject{constructor(e){super(Hn,"scriptModel",["XFA","none"])}}class Severity extends OptionObject{constructor(e){super(Hn,"severity",["ignore","error","information","trace","warning"])}}class SilentPrint extends XFAObject{constructor(e){super(Hn,"silentPrint",!0);this.addSilentPrint=null;this.printerName=null}}class Staple extends XFAObject{constructor(e){super(Hn,"staple");this.mode=getStringOption(e.mode,["usePrinterSetting","on","off"])}}class StartNode extends StringObject{constructor(e){super(Hn,"startNode")}}class StartPage extends IntegerObject{constructor(e){super(Hn,"startPage",0,(e=>!0))}}class SubmitFormat extends OptionObject{constructor(e){super(Hn,"submitFormat",["html","delegate","fdf","xml","pdf"])}}class SubmitUrl extends StringObject{constructor(e){super(Hn,"submitUrl")}}class SubsetBelow extends IntegerObject{constructor(e){super(Hn,"subsetBelow",100,(e=>e>=0&&e<=100))}}class SuppressBanner extends Option01{constructor(e){super(Hn,"suppressBanner")}}class Tagged extends Option01{constructor(e){super(Hn,"tagged")}}class config_Template extends XFAObject{constructor(e){super(Hn,"template",!0);this.base=null;this.relevant=null;this.startPage=null;this.uri=null;this.xsl=null}}class Threshold extends OptionObject{constructor(e){super(Hn,"threshold",["trace","error","information","warning"])}}class To extends OptionObject{constructor(e){super(Hn,"to",["null","memory","stderr","stdout","system","uri"])}}class TemplateCache extends XFAObject{constructor(e){super(Hn,"templateCache");this.maxEntries=getInteger({data:e.maxEntries,defaultValue:5,validate:e=>e>=0})}}class Trace extends XFAObject{constructor(e){super(Hn,"trace",!0);this.area=new XFAObjectArray}}class Transform extends XFAObject{constructor(e){super(Hn,"transform",!0);this.groupParent=null;this.ifEmpty=null;this.nameAttr=null;this.picture=null;this.presence=null;this.rename=null;this.whitespace=null}}class Type extends OptionObject{constructor(e){super(Hn,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}}class Uri extends StringObject{constructor(e){super(Hn,"uri")}}class config_Validate extends OptionObject{constructor(e){super(Hn,"validate",["preSubmit","prePrint","preExecute","preSave"])}}class ValidateApprovalSignatures extends ContentObject{constructor(e){super(Hn,"validateApprovalSignatures")}[Zs](){this[Os]=this[Os].trim().split(/\\s+/).filter((e=>["docReady","postSign"].includes(e)))}}class ValidationMessaging extends OptionObject{constructor(e){super(Hn,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}}class Version extends OptionObject{constructor(e){super(Hn,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}}class VersionControl extends XFAObject{constructor(e){super(Hn,"VersionControl");this.outputBelow=getStringOption(e.outputBelow,["warn","error","update"]);this.sourceAbove=getStringOption(e.sourceAbove,["warn","error"]);this.sourceBelow=getStringOption(e.sourceBelow,["update","maintain"])}}class ViewerPreferences extends XFAObject{constructor(e){super(Hn,"viewerPreferences",!0);this.ADBE_JSConsole=null;this.ADBE_JSDebugger=null;this.addViewerPreferences=null;this.duplexOption=null;this.enforce=null;this.numberOfCopies=null;this.pageRange=null;this.pickTrayByPDFSize=null;this.printScaling=null}}class WebClient extends XFAObject{constructor(e){super(Hn,"webClient",!0);this.name=e.name?e.name.trim():"";this.fontInfo=null;this.xdc=null}}class Whitespace extends OptionObject{constructor(e){super(Hn,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}}class Window extends ContentObject{constructor(e){super(Hn,"window")}[Zs](){const e=this[Os].trim().split(/\\s*,\\s*/,2).map((e=>parseInt(e,10)));if(e.some((e=>isNaN(e))))this[Os]=[0,0];else{1===e.length&&e.push(e[0]);this[Os]=e}}}class Xdc extends XFAObject{constructor(e){super(Hn,"xdc",!0);this.uri=new XFAObjectArray;this.xsl=new XFAObjectArray}}class Xdp extends XFAObject{constructor(e){super(Hn,"xdp",!0);this.packets=null}}class Xsl extends XFAObject{constructor(e){super(Hn,"xsl",!0);this.debug=null;this.uri=null}}class Zpl extends XFAObject{constructor(e){super(Hn,"zpl",!0);this.name=e.name?e.name.trim():"";this.batchOutput=null;this.flipLabel=null;this.fontInfo=null;this.xdc=null}}class ConfigNamespace{static[zr](e,t){if(ConfigNamespace.hasOwnProperty(e))return ConfigNamespace[e](t)}static acrobat(e){return new Acrobat(e)}static acrobat7(e){return new Acrobat7(e)}static ADBE_JSConsole(e){return new ADBE_JSConsole(e)}static ADBE_JSDebugger(e){return new ADBE_JSDebugger(e)}static addSilentPrint(e){return new AddSilentPrint(e)}static addViewerPreferences(e){return new AddViewerPreferences(e)}static adjustData(e){return new AdjustData(e)}static adobeExtensionLevel(e){return new AdobeExtensionLevel(e)}static agent(e){return new Agent(e)}static alwaysEmbed(e){return new AlwaysEmbed(e)}static amd(e){return new Amd(e)}static area(e){return new config_Area(e)}static attributes(e){return new Attributes(e)}static autoSave(e){return new AutoSave(e)}static base(e){return new Base(e)}static batchOutput(e){return new BatchOutput(e)}static behaviorOverride(e){return new BehaviorOverride(e)}static cache(e){return new Cache(e)}static change(e){return new Change(e)}static common(e){return new Common(e)}static compress(e){return new Compress(e)}static compressLogicalStructure(e){return new CompressLogicalStructure(e)}static compressObjectStream(e){return new CompressObjectStream(e)}static compression(e){return new Compression(e)}static config(e){return new Config(e)}static conformance(e){return new Conformance(e)}static contentCopy(e){return new ContentCopy(e)}static copies(e){return new Copies(e)}static creator(e){return new Creator(e)}static currentPage(e){return new CurrentPage(e)}static data(e){return new Data(e)}static debug(e){return new Debug(e)}static defaultTypeface(e){return new DefaultTypeface(e)}static destination(e){return new Destination(e)}static documentAssembly(e){return new DocumentAssembly(e)}static driver(e){return new Driver(e)}static duplexOption(e){return new DuplexOption(e)}static dynamicRender(e){return new DynamicRender(e)}static embed(e){return new Embed(e)}static encrypt(e){return new config_Encrypt(e)}static encryption(e){return new config_Encryption(e)}static encryptionLevel(e){return new EncryptionLevel(e)}static enforce(e){return new Enforce(e)}static equate(e){return new Equate(e)}static equateRange(e){return new EquateRange(e)}static exclude(e){return new Exclude(e)}static excludeNS(e){return new ExcludeNS(e)}static flipLabel(e){return new FlipLabel(e)}static fontInfo(e){return new config_FontInfo(e)}static formFieldFilling(e){return new FormFieldFilling(e)}static groupParent(e){return new GroupParent(e)}static ifEmpty(e){return new IfEmpty(e)}static includeXDPContent(e){return new IncludeXDPContent(e)}static incrementalLoad(e){return new IncrementalLoad(e)}static incrementalMerge(e){return new IncrementalMerge(e)}static interactive(e){return new Interactive(e)}static jog(e){return new Jog(e)}static labelPrinter(e){return new LabelPrinter(e)}static layout(e){return new Layout(e)}static level(e){return new Level(e)}static linearized(e){return new Linearized(e)}static locale(e){return new Locale(e)}static localeSet(e){return new LocaleSet(e)}static log(e){return new Log(e)}static map(e){return new MapElement(e)}static mediumInfo(e){return new MediumInfo(e)}static message(e){return new config_Message(e)}static messaging(e){return new Messaging(e)}static mode(e){return new Mode(e)}static modifyAnnots(e){return new ModifyAnnots(e)}static msgId(e){return new MsgId(e)}static nameAttr(e){return new NameAttr(e)}static neverEmbed(e){return new NeverEmbed(e)}static numberOfCopies(e){return new NumberOfCopies(e)}static openAction(e){return new OpenAction(e)}static output(e){return new Output(e)}static outputBin(e){return new OutputBin(e)}static outputXSL(e){return new OutputXSL(e)}static overprint(e){return new Overprint(e)}static packets(e){return new Packets(e)}static pageOffset(e){return new PageOffset(e)}static pageRange(e){return new PageRange(e)}static pagination(e){return new Pagination(e)}static paginationOverride(e){return new PaginationOverride(e)}static part(e){return new Part(e)}static pcl(e){return new Pcl(e)}static pdf(e){return new Pdf(e)}static pdfa(e){return new Pdfa(e)}static permissions(e){return new Permissions(e)}static pickTrayByPDFSize(e){return new PickTrayByPDFSize(e)}static picture(e){return new config_Picture(e)}static plaintextMetadata(e){return new PlaintextMetadata(e)}static presence(e){return new Presence(e)}static present(e){return new Present(e)}static print(e){return new Print(e)}static printHighQuality(e){return new PrintHighQuality(e)}static printScaling(e){return new PrintScaling(e)}static printerName(e){return new PrinterName(e)}static producer(e){return new Producer(e)}static ps(e){return new Ps(e)}static range(e){return new Range(e)}static record(e){return new Record(e)}static relevant(e){return new Relevant(e)}static rename(e){return new Rename(e)}static renderPolicy(e){return new RenderPolicy(e)}static runScripts(e){return new RunScripts(e)}static script(e){return new config_Script(e)}static scriptModel(e){return new ScriptModel(e)}static severity(e){return new Severity(e)}static silentPrint(e){return new SilentPrint(e)}static staple(e){return new Staple(e)}static startNode(e){return new StartNode(e)}static startPage(e){return new StartPage(e)}static submitFormat(e){return new SubmitFormat(e)}static submitUrl(e){return new SubmitUrl(e)}static subsetBelow(e){return new SubsetBelow(e)}static suppressBanner(e){return new SuppressBanner(e)}static tagged(e){return new Tagged(e)}static template(e){return new config_Template(e)}static templateCache(e){return new TemplateCache(e)}static threshold(e){return new Threshold(e)}static to(e){return new To(e)}static trace(e){return new Trace(e)}static transform(e){return new Transform(e)}static type(e){return new Type(e)}static uri(e){return new Uri(e)}static validate(e){return new config_Validate(e)}static validateApprovalSignatures(e){return new ValidateApprovalSignatures(e)}static validationMessaging(e){return new ValidationMessaging(e)}static version(e){return new Version(e)}static versionControl(e){return new VersionControl(e)}static viewerPreferences(e){return new ViewerPreferences(e)}static webClient(e){return new WebClient(e)}static whitespace(e){return new Whitespace(e)}static window(e){return new Window(e)}static xdc(e){return new Xdc(e)}static xdp(e){return new Xdp(e)}static xsl(e){return new Xsl(e)}static zpl(e){return new Zpl(e)}}const Jn=_r.connectionSet.id;class ConnectionSet extends XFAObject{constructor(e){super(Jn,"connectionSet",!0);this.wsdlConnection=new XFAObjectArray;this.xmlConnection=new XFAObjectArray;this.xsdConnection=new XFAObjectArray}}class EffectiveInputPolicy extends XFAObject{constructor(e){super(Jn,"effectiveInputPolicy");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class EffectiveOutputPolicy extends XFAObject{constructor(e){super(Jn,"effectiveOutputPolicy");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Operation extends StringObject{constructor(e){super(Jn,"operation");this.id=e.id||"";this.input=e.input||"";this.name=e.name||"";this.output=e.output||"";this.use=e.use||"";this.usehref=e.usehref||""}}class RootElement extends StringObject{constructor(e){super(Jn,"rootElement");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class SoapAction extends StringObject{constructor(e){super(Jn,"soapAction");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class SoapAddress extends StringObject{constructor(e){super(Jn,"soapAddress");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class connection_set_Uri extends StringObject{constructor(e){super(Jn,"uri");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class WsdlAddress extends StringObject{constructor(e){super(Jn,"wsdlAddress");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class WsdlConnection extends XFAObject{constructor(e){super(Jn,"wsdlConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.effectiveInputPolicy=null;this.effectiveOutputPolicy=null;this.operation=null;this.soapAction=null;this.soapAddress=null;this.wsdlAddress=null}}class XmlConnection extends XFAObject{constructor(e){super(Jn,"xmlConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.uri=null}}class XsdConnection extends XFAObject{constructor(e){super(Jn,"xsdConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.rootElement=null;this.uri=null}}class ConnectionSetNamespace{static[zr](e,t){if(ConnectionSetNamespace.hasOwnProperty(e))return ConnectionSetNamespace[e](t)}static connectionSet(e){return new ConnectionSet(e)}static effectiveInputPolicy(e){return new EffectiveInputPolicy(e)}static effectiveOutputPolicy(e){return new EffectiveOutputPolicy(e)}static operation(e){return new Operation(e)}static rootElement(e){return new RootElement(e)}static soapAction(e){return new SoapAction(e)}static soapAddress(e){return new SoapAddress(e)}static uri(e){return new connection_set_Uri(e)}static wsdlAddress(e){return new WsdlAddress(e)}static wsdlConnection(e){return new WsdlConnection(e)}static xmlConnection(e){return new XmlConnection(e)}static xsdConnection(e){return new XsdConnection(e)}}const Yn=_r.datasets.id;class datasets_Data extends XmlObject{constructor(e){super(Yn,"data",e)}[mr](){return!0}}class Datasets extends XFAObject{constructor(e){super(Yn,"datasets",!0);this.data=null;this.Signature=null}[Nr](e){const t=e[kr];("data"===t&&e[Sr]===Yn||"Signature"===t&&e[Sr]===_r.signature.id)&&(this[t]=e);this[Hs](e)}}class DatasetsNamespace{static[zr](e,t){if(DatasetsNamespace.hasOwnProperty(e))return DatasetsNamespace[e](t)}static datasets(e){return new Datasets(e)}static data(e){return new datasets_Data(e)}}const vn=_r.localeSet.id;class CalendarSymbols extends XFAObject{constructor(e){super(vn,"calendarSymbols",!0);this.name="gregorian";this.dayNames=new XFAObjectArray(2);this.eraNames=null;this.meridiemNames=null;this.monthNames=new XFAObjectArray(2)}}class CurrencySymbol extends StringObject{constructor(e){super(vn,"currencySymbol");this.name=getStringOption(e.name,["symbol","isoname","decimal"])}}class CurrencySymbols extends XFAObject{constructor(e){super(vn,"currencySymbols",!0);this.currencySymbol=new XFAObjectArray(3)}}class DatePattern extends StringObject{constructor(e){super(vn,"datePattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class DatePatterns extends XFAObject{constructor(e){super(vn,"datePatterns",!0);this.datePattern=new XFAObjectArray(4)}}class DateTimeSymbols extends ContentObject{constructor(e){super(vn,"dateTimeSymbols")}}class Day extends StringObject{constructor(e){super(vn,"day")}}class DayNames extends XFAObject{constructor(e){super(vn,"dayNames",!0);this.abbr=getInteger({data:e.abbr,defaultValue:0,validate:e=>1===e});this.day=new XFAObjectArray(7)}}class Era extends StringObject{constructor(e){super(vn,"era")}}class EraNames extends XFAObject{constructor(e){super(vn,"eraNames",!0);this.era=new XFAObjectArray(2)}}class locale_set_Locale extends XFAObject{constructor(e){super(vn,"locale",!0);this.desc=e.desc||"";this.name="isoname";this.calendarSymbols=null;this.currencySymbols=null;this.datePatterns=null;this.dateTimeSymbols=null;this.numberPatterns=null;this.numberSymbols=null;this.timePatterns=null;this.typeFaces=null}}class locale_set_LocaleSet extends XFAObject{constructor(e){super(vn,"localeSet",!0);this.locale=new XFAObjectArray}}class Meridiem extends StringObject{constructor(e){super(vn,"meridiem")}}class MeridiemNames extends XFAObject{constructor(e){super(vn,"meridiemNames",!0);this.meridiem=new XFAObjectArray(2)}}class Month extends StringObject{constructor(e){super(vn,"month")}}class MonthNames extends XFAObject{constructor(e){super(vn,"monthNames",!0);this.abbr=getInteger({data:e.abbr,defaultValue:0,validate:e=>1===e});this.month=new XFAObjectArray(12)}}class NumberPattern extends StringObject{constructor(e){super(vn,"numberPattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class NumberPatterns extends XFAObject{constructor(e){super(vn,"numberPatterns",!0);this.numberPattern=new XFAObjectArray(4)}}class NumberSymbol extends StringObject{constructor(e){super(vn,"numberSymbol");this.name=getStringOption(e.name,["decimal","grouping","percent","minus","zero"])}}class NumberSymbols extends XFAObject{constructor(e){super(vn,"numberSymbols",!0);this.numberSymbol=new XFAObjectArray(5)}}class TimePattern extends StringObject{constructor(e){super(vn,"timePattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class TimePatterns extends XFAObject{constructor(e){super(vn,"timePatterns",!0);this.timePattern=new XFAObjectArray(4)}}class TypeFace extends XFAObject{constructor(e){super(vn,"typeFace",!0);this.name=""|e.name}}class TypeFaces extends XFAObject{constructor(e){super(vn,"typeFaces",!0);this.typeFace=new XFAObjectArray}}class LocaleSetNamespace{static[zr](e,t){if(LocaleSetNamespace.hasOwnProperty(e))return LocaleSetNamespace[e](t)}static calendarSymbols(e){return new CalendarSymbols(e)}static currencySymbol(e){return new CurrencySymbol(e)}static currencySymbols(e){return new CurrencySymbols(e)}static datePattern(e){return new DatePattern(e)}static datePatterns(e){return new DatePatterns(e)}static dateTimeSymbols(e){return new DateTimeSymbols(e)}static day(e){return new Day(e)}static dayNames(e){return new DayNames(e)}static era(e){return new Era(e)}static eraNames(e){return new EraNames(e)}static locale(e){return new locale_set_Locale(e)}static localeSet(e){return new locale_set_LocaleSet(e)}static meridiem(e){return new Meridiem(e)}static meridiemNames(e){return new MeridiemNames(e)}static month(e){return new Month(e)}static monthNames(e){return new MonthNames(e)}static numberPattern(e){return new NumberPattern(e)}static numberPatterns(e){return new NumberPatterns(e)}static numberSymbol(e){return new NumberSymbol(e)}static numberSymbols(e){return new NumberSymbols(e)}static timePattern(e){return new TimePattern(e)}static timePatterns(e){return new TimePatterns(e)}static typeFace(e){return new TypeFace(e)}static typeFaces(e){return new TypeFaces(e)}}const Kn=_r.signature.id;class signature_Signature extends XFAObject{constructor(e){super(Kn,"signature",!0)}}class SignatureNamespace{static[zr](e,t){if(SignatureNamespace.hasOwnProperty(e))return SignatureNamespace[e](t)}static signature(e){return new signature_Signature(e)}}const Tn=_r.stylesheet.id;class Stylesheet extends XFAObject{constructor(e){super(Tn,"stylesheet",!0)}}class StylesheetNamespace{static[zr](e,t){if(StylesheetNamespace.hasOwnProperty(e))return StylesheetNamespace[e](t)}static stylesheet(e){return new Stylesheet(e)}}const qn=_r.xdp.id;class xdp_Xdp extends XFAObject{constructor(e){super(qn,"xdp",!0);this.uuid=e.uuid||"";this.timeStamp=e.timeStamp||"";this.config=null;this.connectionSet=null;this.datasets=null;this.localeSet=null;this.stylesheet=new XFAObjectArray;this.template=null}[Gr](e){const t=_r[e[kr]];return t&&e[Sr]===t.id}}class XdpNamespace{static[zr](e,t){if(XdpNamespace.hasOwnProperty(e))return XdpNamespace[e](t)}static xdp(e){return new xdp_Xdp(e)}}const On=_r.xhtml.id,Pn=Symbol(),Wn=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),jn=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",e=>"none"===e?"none":"normal"],["xfa-font-horizontal-scale",e=>`scaleX(${Math.max(0,Math.min(parseInt(e)/100)).toFixed(2)})`],["xfa-font-vertical-scale",e=>`scaleY(${Math.max(0,Math.min(parseInt(e)/100)).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(e,t)=>measureToString(.99*(e=t.fontSize=Math.abs(getMeasurement(e))))],["letter-spacing",e=>measureToString(getMeasurement(e))],["line-height",e=>measureToString(getMeasurement(e))],["margin",e=>measureToString(getMeasurement(e))],["margin-bottom",e=>measureToString(getMeasurement(e))],["margin-left",e=>measureToString(getMeasurement(e))],["margin-right",e=>measureToString(getMeasurement(e))],["margin-top",e=>measureToString(getMeasurement(e))],["text-indent",e=>measureToString(getMeasurement(e))],["font-family",e=>e],["vertical-align",e=>measureToString(getMeasurement(e))]]),Xn=/\\s+/g,Zn=/[\\r\\n]+/g,Vn=/\\r\\n?/g;function mapStyle(e,t,i){const a=Object.create(null);if(!e)return a;const s=Object.create(null);for(const[t,i]of e.split(";").map((e=>e.split(":",2)))){const e=jn.get(t);if(""===e)continue;let r=i;e&&(r="string"==typeof e?e:e(i,s));t.endsWith("scale")?a.transform=a.transform?`${a[t]} ${r}`:r:a[t.replaceAll(/-([a-zA-Z])/g,((e,t)=>t.toUpperCase()))]=r}a.fontFamily&&setFontFamily({typeface:a.fontFamily,weight:a.fontWeight||"normal",posture:a.fontStyle||"normal",size:s.fontSize||0},t,t[Cr].fontFinder,a);if(i&&a.verticalAlign&&"0px"!==a.verticalAlign&&a.fontSize){const e=.583,t=.333,i=getMeasurement(a.fontSize);a.fontSize=measureToString(i*e);a.verticalAlign=measureToString(Math.sign(getMeasurement(a.verticalAlign))*i*t)}i&&a.fontSize&&(a.fontSize=`calc(${a.fontSize} * var(--scale-factor))`);fixTextIndent(a);return a}const zn=new Set(["body","html"]);class XhtmlObject extends XmlObject{constructor(e,t){super(On,t);this[Pn]=!1;this.style=e.style||""}[Ys](e){super[Ys](e);this.style=function checkStyle(e){return e.style?e.style.trim().split(/\\s*;\\s*/).filter((e=>!!e)).map((e=>e.split(/\\s*:\\s*/,2))).filter((([t,i])=>{"font-family"===t&&e[Cr].usedTypefaces.add(i);return Wn.has(t)})).map((e=>e.join(":"))).join(";"):""}(this)}[xs](){return!zn.has(this[kr])}[Mr](e,t=!1){if(t)this[Pn]=!0;else{e=e.replaceAll(Zn,"");this.style.includes("xfa-spacerun:yes")||(e=e.replaceAll(Xn," "))}e&&(this[Os]+=e)}[Ur](e,t=!0){const i=Object.create(null),a={top:NaN,bottom:NaN,left:NaN,right:NaN};let s=null;for(const[e,t]of this.style.split(";").map((e=>e.split(":",2))))switch(e){case"font-family":i.typeface=stripQuotes(t);break;case"font-size":i.size=getMeasurement(t);break;case"font-weight":i.weight=t;break;case"font-style":i.posture=t;break;case"letter-spacing":i.letterSpacing=getMeasurement(t);break;case"margin":const e=t.split(/ \\t/).map((e=>getMeasurement(e)));switch(e.length){case 1:a.top=a.bottom=a.left=a.right=e[0];break;case 2:a.top=a.bottom=e[0];a.left=a.right=e[1];break;case 3:a.top=e[0];a.bottom=e[2];a.left=a.right=e[1];break;case 4:a.top=e[0];a.left=e[1];a.bottom=e[2];a.right=e[3]}break;case"margin-top":a.top=getMeasurement(t);break;case"margin-bottom":a.bottom=getMeasurement(t);break;case"margin-left":a.left=getMeasurement(t);break;case"margin-right":a.right=getMeasurement(t);break;case"line-height":s=getMeasurement(t)}e.pushData(i,a,s);if(this[Os])e.addString(this[Os]);else for(const t of this[rr]())"#text"!==t[kr]?t[Ur](e):e.addString(t[Os]);t&&e.popFont()}[jr](e){const t=[];this[Xs]={children:t};this[Js]({});if(0===t.length&&!this[Os])return HTMLResult.EMPTY;let i;i=this[Pn]?this[Os]?this[Os].replaceAll(Vn,"\\n"):void 0:this[Os]||void 0;return HTMLResult.success({name:this[kr],attributes:{href:this.href,style:mapStyle(this.style,this,this[Pn])},children:t,value:i})}}class A extends XhtmlObject{constructor(e){super(e,"a");this.href=fixURL(e.href)||""}}class B extends XhtmlObject{constructor(e){super(e,"b")}[Ur](e){e.pushFont({weight:"bold"});super[Ur](e);e.popFont()}}class Body extends XhtmlObject{constructor(e){super(e,"body")}[jr](e){const t=super[jr](e),{html:i}=t;if(!i)return HTMLResult.EMPTY;i.name="div";i.attributes.class=["xfaRich"];return t}}class Br extends XhtmlObject{constructor(e){super(e,"br")}[Pr](){return"\\n"}[Ur](e){e.addString("\\n")}[jr](e){return HTMLResult.success({name:"br"})}}class Html extends XhtmlObject{constructor(e){super(e,"html")}[jr](e){const t=[];this[Xs]={children:t};this[Js]({});if(0===t.length)return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[Os]||""});if(1===t.length){const e=t[0];if(e.attributes?.class.includes("xfaRich"))return HTMLResult.success(e)}return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:t})}}class I extends XhtmlObject{constructor(e){super(e,"i")}[Ur](e){e.pushFont({posture:"italic"});super[Ur](e);e.popFont()}}class Li extends XhtmlObject{constructor(e){super(e,"li")}}class Ol extends XhtmlObject{constructor(e){super(e,"ol")}}class P extends XhtmlObject{constructor(e){super(e,"p")}[Ur](e){super[Ur](e,!1);e.addString("\\n");e.addPara();e.popFont()}[Pr](){return this[Ir]()[rr]().at(-1)===this?super[Pr]():super[Pr]()+"\\n"}}class Span extends XhtmlObject{constructor(e){super(e,"span")}}class Sub extends XhtmlObject{constructor(e){super(e,"sub")}}class Sup extends XhtmlObject{constructor(e){super(e,"sup")}}class Ul extends XhtmlObject{constructor(e){super(e,"ul")}}class XhtmlNamespace{static[zr](e,t){if(XhtmlNamespace.hasOwnProperty(e))return XhtmlNamespace[e](t)}static a(e){return new A(e)}static b(e){return new B(e)}static body(e){return new Body(e)}static br(e){return new Br(e)}static html(e){return new Html(e)}static i(e){return new I(e)}static li(e){return new Li(e)}static ol(e){return new Ol(e)}static p(e){return new P(e)}static span(e){return new Span(e)}static sub(e){return new Sub(e)}static sup(e){return new Sup(e)}static ul(e){return new Ul(e)}}const _n={config:ConfigNamespace,connection:ConnectionSetNamespace,datasets:DatasetsNamespace,localeSet:LocaleSetNamespace,signature:SignatureNamespace,stylesheet:StylesheetNamespace,template:TemplateNamespace,xdp:XdpNamespace,xhtml:XhtmlNamespace};class UnknownNamespace{constructor(e){this.namespaceId=e}[zr](e,t){return new XmlObject(this.namespaceId,e,t)}}class Root extends XFAObject{constructor(e){super(-1,"root",Object.create(null));this.element=null;this[lr]=e}[Nr](e){this.element=e;return!0}[Zs](){super[Zs]();if(this.element.template instanceof Template){this[lr].set(Jr,this.element);this.element.template[Yr](this[lr]);this.element.template[lr]=this[lr]}}}class Empty extends XFAObject{constructor(){super(-1,"",Object.create(null))}[Nr](e){return!1}}class Builder{constructor(e=null){this._namespaceStack=[];this._nsAgnosticLevel=0;this._namespacePrefixes=new Map;this._namespaces=new Map;this._nextNsId=Math.max(...Object.values(_r).map((({id:e})=>e)));this._currentNamespace=e||new UnknownNamespace(++this._nextNsId)}buildRoot(e){return new Root(e)}build({nsPrefix:e,name:t,attributes:i,namespace:a,prefixes:s}){const r=null!==a;if(r){this._namespaceStack.push(this._currentNamespace);this._currentNamespace=this._searchNamespace(a)}s&&this._addNamespacePrefix(s);if(i.hasOwnProperty(Rr)){const e=_n.datasets,t=i[Rr];let a=null;for(const[i,s]of Object.entries(t)){if(this._getNamespaceToUse(i)===e){a={xfa:s};break}}a?i[Rr]=a:delete i[Rr]}const n=this._getNamespaceToUse(e),g=n?.[zr](t,i)||new Empty;g[mr]()&&this._nsAgnosticLevel++;(r||s||g[mr]())&&(g[Ks]={hasNamespace:r,prefixes:s,nsAgnostic:g[mr]()});return g}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(e){let t=this._namespaces.get(e);if(t)return t;for(const[i,{check:a}]of Object.entries(_r))if(a(e)){t=_n[i];if(t){this._namespaces.set(e,t);return t}break}t=new UnknownNamespace(++this._nextNsId);this._namespaces.set(e,t);return t}_addNamespacePrefix(e){for(const{prefix:t,value:i}of e){const e=this._searchNamespace(i);let a=this._namespacePrefixes.get(t);if(!a){a=[];this._namespacePrefixes.set(t,a)}a.push(e)}}_getNamespaceToUse(e){if(!e)return this._currentNamespace;const t=this._namespacePrefixes.get(e);if(t?.length>0)return t.at(-1);warn(`Unknown namespace prefix: ${e}.`);return null}clean(e){const{hasNamespace:t,prefixes:i,nsAgnostic:a}=e;t&&(this._currentNamespace=this._namespaceStack.pop());i&&i.forEach((({prefix:e})=>{this._namespacePrefixes.get(e).pop()}));a&&this._nsAgnosticLevel--}}class XFAParser extends XMLParserBase{constructor(e=null,t=!1){super();this._builder=new Builder(e);this._stack=[];this._globalData={usedTypefaces:new Set};this._ids=new Map;this._current=this._builder.buildRoot(this._ids);this._errorCode=ys;this._whiteRegex=/^\\s+$/;this._nbsps=/\\xa0+/g;this._richText=t}parse(e){this.parseXml(e);if(this._errorCode===ys){this._current[Zs]();return this._current.element}}onText(e){e=e.replace(this._nbsps,(e=>e.slice(1)+" "));this._richText||this._current[xs]()?this._current[Mr](e,this._richText):this._whiteRegex.test(e)||this._current[Mr](e.trim())}onCdata(e){this._current[Mr](e)}_mkAttributes(e,t){let i=null,a=null;const s=Object.create({});for(const{name:r,value:n}of e)if("xmlns"===r)i?warn(`XFA - multiple namespace definition in <${t}>`):i=n;else if(r.startsWith("xmlns:")){const e=r.substring(6);a||(a=[]);a.push({prefix:e,value:n})}else{const e=r.indexOf(":");if(-1===e)s[r]=n;else{let t=s[Rr];t||(t=s[Rr]=Object.create(null));const[i,a]=[r.slice(0,e),r.slice(e+1)];(t[i]||=Object.create(null))[a]=n}}return[i,a,s]}_getNameAndPrefix(e,t){const i=e.indexOf(":");return-1===i?[e,null]:[e.substring(i+1),t?"":e.substring(0,i)]}onBeginElement(e,t,i){const[a,s,r]=this._mkAttributes(t,e),[n,g]=this._getNameAndPrefix(e,this._builder.isNsAgnostic()),o=this._builder.build({nsPrefix:g,name:n,attributes:r,namespace:a,prefixes:s});o[Cr]=this._globalData;if(i){o[Zs]();this._current[Nr](o)&&o[Kr](this._ids);o[Ys](this._builder)}else{this._stack.push(this._current);this._current=o}}onEndElement(e){const t=this._current;if(t[ur]()&&"string"==typeof t[Os]){const e=new XFAParser;e._globalData=this._globalData;const i=e.parse(t[Os]);t[Os]=null;t[Nr](i)}t[Zs]();this._current=this._stack.pop();this._current[Nr](t)&&t[Kr](this._ids);t[Ys](this._builder)}onError(e){this._errorCode=e}}class XFAFactory{constructor(e){try{this.root=(new XFAParser).parse(XFAFactory._createDocument(e));const t=new Binder(this.root);this.form=t.bind();this.dataHandler=new DataHandler(this.root,t.getData());this.form[Cr].template=this.form}catch(e){warn(`XFA - an error occurred during parsing and binding: ${e}`)}}isValid(){return this.root&&this.form}_createPagesHelper(){const e=this.form[Wr]();return new Promise(((t,i)=>{const nextIteration=()=>{try{const i=e.next();i.done?t(i.value):setTimeout(nextIteration,0)}catch(e){i(e)}};setTimeout(nextIteration,0)}))}async _createPages(){try{this.pages=await this._createPagesHelper();this.dims=this.pages.children.map((e=>{const{width:t,height:i}=e.attributes.style;return[0,0,parseInt(t),parseInt(i)]}))}catch(e){warn(`XFA - an error occurred during layout: ${e}`)}}getBoundingBox(e){return this.dims[e]}async getNumPages(){this.pages||await this._createPages();return this.dims.length}setImages(e){this.form[Cr].images=e}setFonts(e){this.form[Cr].fontFinder=new FontFinder(e);const t=[];for(let e of this.form[Cr].usedTypefaces){e=stripQuotes(e);this.form[Cr].fontFinder.find(e)||t.push(e)}return t.length>0?t:null}appendFonts(e,t){this.form[Cr].fontFinder.add(e,t)}async getPages(){this.pages||await this._createPages();const e=this.pages;this.pages=null;return e}serializeData(e){return this.dataHandler.serialize(e)}static _createDocument(e){return e["/xdp:xdp"]?Object.values(e).join(""):e["xdp:xdp"]}static getRichTextAsHtml(e){if(!e||"string"!=typeof e)return null;try{let t=new XFAParser(XhtmlNamespace,!0).parse(e);if(!["body","xhtml"].includes(t[kr])){const e=XhtmlNamespace.body({});e[Hs](t);t=e}const i=t[jr]();if(!i.success)return null;const{html:a}=i,{attributes:s}=a;if(s){s.class&&(s.class=s.class.filter((e=>!e.startsWith("xfa"))));s.dir="auto"}return{html:a,str:t[Pr]()}}catch(e){warn(`XFA - an error occurred during parsing of rich text: ${e}`)}return null}}class AnnotationFactory{static createGlobals(e){return Promise.all([e.ensureCatalog("acroForm"),e.ensureDoc("xfaDatasets"),e.ensureCatalog("structTreeRoot"),e.ensureCatalog("baseUrl"),e.ensureCatalog("attachments")]).then((([t,i,a,s,r])=>({pdfManager:e,acroForm:t instanceof Dict?t:Dict.empty,xfaDatasets:i,structTreeRoot:a,baseUrl:s,attachments:r})),(e=>{warn(`createGlobals: "${e}".`);return null}))}static async create(e,t,i,a,s,r,n){const g=s?await this._getPageIndex(e,t,i.pdfManager):null;return i.pdfManager.ensure(this,"_create",[e,t,i,a,s,r,g,n])}static _create(e,t,i,a,s=!1,r=null,n=null,g=null){const o=e.fetchIfRef(t);if(!(o instanceof Dict))return;const{acroForm:c,pdfManager:C}=i,h=t instanceof Ref?t.toString():`annot_${a.createObjId()}`;let l=o.get("Subtype");l=l instanceof Name?l.name:null;const Q={xref:e,ref:t,dict:o,subtype:l,id:h,annotationGlobals:i,collectFields:s,orphanFields:r,needAppearances:!s&&!0===c.get("NeedAppearances"),pageIndex:n,evaluatorOptions:C.evaluatorOptions,pageRef:g};switch(l){case"Link":return new LinkAnnotation(Q);case"Text":return new TextAnnotation(Q);case"Widget":let e=getInheritableProperty({dict:o,key:"FT"});e=e instanceof Name?e.name:null;switch(e){case"Tx":return new TextWidgetAnnotation(Q);case"Btn":return new ButtonWidgetAnnotation(Q);case"Ch":return new ChoiceWidgetAnnotation(Q);case"Sig":return new SignatureWidgetAnnotation(Q)}warn(`Unimplemented widget field type "${e}", falling back to base field type.`);return new WidgetAnnotation(Q);case"Popup":return new PopupAnnotation(Q);case"FreeText":return new FreeTextAnnotation(Q);case"Line":return new LineAnnotation(Q);case"Square":return new SquareAnnotation(Q);case"Circle":return new CircleAnnotation(Q);case"PolyLine":return new PolylineAnnotation(Q);case"Polygon":return new PolygonAnnotation(Q);case"Caret":return new CaretAnnotation(Q);case"Ink":return new InkAnnotation(Q);case"Highlight":return new HighlightAnnotation(Q);case"Underline":return new UnderlineAnnotation(Q);case"Squiggly":return new SquigglyAnnotation(Q);case"StrikeOut":return new StrikeOutAnnotation(Q);case"Stamp":return new StampAnnotation(Q);case"FileAttachment":return new FileAttachmentAnnotation(Q);default:s||warn(l?`Unimplemented annotation type "${l}", falling back to base annotation.`:"Annotation is missing the required /Subtype.");return new Annotation(Q)}}static async _getPageIndex(e,t,i){try{const a=await e.fetchIfRefAsync(t);if(!(a instanceof Dict))return-1;const s=a.getRaw("P");if(s instanceof Ref)try{return await i.ensureCatalog("getPageIndex",[s])}catch(e){info(`_getPageIndex -- not a valid page reference: "${e}".`)}if(a.has("Kids"))return-1;const r=await i.ensureDoc("numPages");for(let e=0;ee/255))}function getQuadPoints(e,t){const i=e.getArray("QuadPoints");if(!isNumberArray(i,null)||0===i.length||i.length%8>0)return null;const a=new Float32Array(i.length);for(let e=0,s=i.length;et[2]||Et[3]))return null;a.set([l,u,Q,u,l,E,Q,E],e)}return a}function getTransformMatrix(e,t,i){const[a,s,r,n]=Util.getAxialAlignedBoundingBox(t,i);if(a===r||s===n)return[1,0,0,1,e[0],e[1]];const g=(e[2]-e[0])/(r-a),o=(e[3]-e[1])/(n-s);return[g,0,0,o,e[0]-a*g,e[1]-s*o]}class Annotation{constructor(e){const{dict:t,xref:i,annotationGlobals:a,ref:s,orphanFields:r}=e,n=r?.get(s);n&&t.set("Parent",n);this.setTitle(t.get("T"));this.setContents(t.get("Contents"));this.setModificationDate(t.get("M"));this.setFlags(t.get("F"));this.setRectangle(t.getArray("Rect"));this.setColor(t.getArray("C"));this.setBorderStyle(t);this.setAppearance(t);this.setOptionalContent(t);const g=t.get("MK");this.setBorderAndBackgroundColors(g);this.setRotation(g,t);this.ref=e.ref instanceof Ref?e.ref:null;this._streams=[];this.appearance&&this._streams.push(this.appearance);const o=!!(this.flags&eA),c=!!(this.flags&tA);this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:e.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:e.subtype,hasOwnCanvas:!1,noRotate:!!(this.flags&$),noHTML:o&&c,isEditable:!1,structParent:-1};if(a.structTreeRoot){let i=t.get("StructParent");this.data.structParent=i=Number.isInteger(i)&&i>=0?i:-1;a.structTreeRoot.addAnnotationIdToPage(e.pageRef,i)}if(e.collectFields){const a=t.get("Kids");if(Array.isArray(a)){const e=[];for(const t of a)t instanceof Ref&&e.push(t.toString());0!==e.length&&(this.data.kidIds=e)}this.data.actions=collectActions(i,t,dA);this.data.fieldName=this._constructFieldName(t);this.data.pageIndex=e.pageIndex}const C=t.get("IT");C instanceof Name&&(this.data.it=C.name);this._isOffscreenCanvasSupported=e.evaluatorOptions.isOffscreenCanvasSupported;this._fallbackFontDict=null;this._needAppearances=!1}_hasFlag(e,t){return!!(e&t)}_buildFlags(e,t){let{flags:i}=this;if(void 0===e){if(void 0===t)return;return t?i&~_:i&~z|_}if(e){i|=_;return t?i&~AA|z:i&~z|AA}i&=~(z|AA);return t?i&~_:i|_}_isViewable(e){return!this._hasFlag(e,V)&&!this._hasFlag(e,AA)}_isPrintable(e){return this._hasFlag(e,_)&&!this._hasFlag(e,z)&&!this._hasFlag(e,V)}mustBeViewed(e,t){const i=e?.get(this.data.id)?.noView;return void 0!==i?!i:this.viewable&&!this._hasFlag(this.flags,z)}mustBePrinted(e){const t=e?.get(this.data.id)?.noPrint;return void 0!==t?!t:this.printable}mustBeViewedWhenEditing(e,t=null){return e?!this.data.isEditable:!t?.has(this.data.id)}get viewable(){return null!==this.data.quadPoints&&(0===this.flags||this._isViewable(this.flags))}get printable(){return null!==this.data.quadPoints&&(0!==this.flags&&this._isPrintable(this.flags))}_parseStringHelper(e){const t="string"==typeof e?stringToPDFString(e):"";return{str:t,dir:t&&"rtl"===bidi(t).dir?"rtl":"ltr"}}setDefaultAppearance(e){const{dict:t,annotationGlobals:i}=e,a=getInheritableProperty({dict:t,key:"DA"})||i.acroForm.get("DA");this._defaultAppearance="string"==typeof a?a:"";this.data.defaultAppearanceData=parseDefaultAppearance(this._defaultAppearance)}setTitle(e){this._title=this._parseStringHelper(e)}setContents(e){this._contents=this._parseStringHelper(e)}setModificationDate(e){this.modificationDate="string"==typeof e?e:null}setFlags(e){this.flags=Number.isInteger(e)&&e>0?e:0;this.flags&V&&"Annotation"!==this.constructor.name&&(this.flags^=V)}hasFlag(e){return this._hasFlag(this.flags,e)}setRectangle(e){this.rectangle=lookupNormalRect(e,[0,0,0,0])}setColor(e){this.color=getRgbColor(e)}setLineEndings(e){this.lineEndings=["None","None"];if(Array.isArray(e)&&2===e.length)for(let t=0;t<2;t++){const i=e[t];if(i instanceof Name)switch(i.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[t]=i.name;continue}warn(`Ignoring invalid lineEnding: ${i}`)}}setRotation(e,t){this.rotation=0;let i=e instanceof Dict?e.get("R")||0:t.get("Rotate")||0;if(Number.isInteger(i)&&0!==i){i%=360;i<0&&(i+=360);i%90==0&&(this.rotation=i)}}setBorderAndBackgroundColors(e){if(e instanceof Dict){this.borderColor=getRgbColor(e.getArray("BC"),null);this.backgroundColor=getRgbColor(e.getArray("BG"),null)}else this.borderColor=this.backgroundColor=null}setBorderStyle(e){this.borderStyle=new AnnotationBorderStyle;if(e instanceof Dict)if(e.has("BS")){const t=e.get("BS");if(t instanceof Dict){const e=t.get("Type");if(!e||isName(e,"Border")){this.borderStyle.setWidth(t.get("W"),this.rectangle);this.borderStyle.setStyle(t.get("S"));this.borderStyle.setDashArray(t.getArray("D"))}}}else if(e.has("Border")){const t=e.getArray("Border");if(Array.isArray(t)&&t.length>=3){this.borderStyle.setHorizontalCornerRadius(t[0]);this.borderStyle.setVerticalCornerRadius(t[1]);this.borderStyle.setWidth(t[2],this.rectangle);4===t.length&&this.borderStyle.setDashArray(t[3],!0)}}else this.borderStyle.setWidth(0)}setAppearance(e){this.appearance=null;const t=e.get("AP");if(!(t instanceof Dict))return;const i=t.get("N");if(i instanceof BaseStream){this.appearance=i;return}if(!(i instanceof Dict))return;const a=e.get("AS");if(!(a instanceof Name&&i.has(a.name)))return;const s=i.get(a.name);s instanceof BaseStream&&(this.appearance=s)}setOptionalContent(e){this.oc=null;const t=e.get("OC");t instanceof Name?warn("setOptionalContent: Support for /Name-entry is not implemented."):t instanceof Dict&&(this.oc=t)}loadResources(e,t){return t.dict.getAsync("Resources").then((t=>{if(!t)return;return new ObjectLoader(t,e,t.xref).load().then((function(){return t}))}))}async getOperatorList(e,t,a,s){const{hasOwnCanvas:r,id:n,rect:g}=this.data;let c=this.appearance;const C=!!(r&&a&o);if(C&&(g[0]===g[2]||g[1]===g[3])){this.data.hasOwnCanvas=!1;return{opList:new OperatorList,separateForm:!1,separateCanvas:!1}}if(!c){if(!C)return{opList:new OperatorList,separateForm:!1,separateCanvas:!1};c=new StringStream("");c.dict=new Dict}const h=c.dict,l=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],c),Q=lookupRect(h.getArray("BBox"),[0,0,1,1]),E=lookupMatrix(h.getArray("Matrix"),i),u=getTransformMatrix(g,Q,E),d=new OperatorList;let f;this.oc&&(f=await e.parseMarkedContentProps(this.oc,null));void 0!==f&&d.addOp(Ye,["OC",f]);d.addOp(je,[n,g,u,E,C]);await e.getOperatorList({stream:c,task:t,resources:l,operatorList:d,fallbackFontDict:this._fallbackFontDict});d.addOp(Xe,[]);void 0!==f&&d.addOp(ve,[]);this.reset();return{opList:d,separateForm:!1,separateCanvas:C}}async save(e,t,i,a){return null}get hasTextContent(){return!1}async extractTextContent(e,t,i){if(!this.appearance)return;const a=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),s=[],r=[];let n=null;const g={desiredSize:Math.Infinity,ready:!0,enqueue(e,t){for(const t of e.items)if(void 0!==t.str){n||=t.transform.slice(-2);r.push(t.str);if(t.hasEOL){s.push(r.join("").trimEnd());r.length=0}}}};await e.getTextContent({stream:this.appearance,task:t,resources:a,includeMarkedContent:!0,keepWhiteSpace:!0,sink:g,viewBox:i});this.reset();r.length&&s.push(r.join("").trimEnd());if(s.length>1||s[0]){const e=this.appearance.dict,t=lookupRect(e.getArray("BBox"),null),i=lookupMatrix(e.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(n,t,i);this.data.textContent=s}}_transformPoint(e,t,i){const{rect:a}=this.data;t||=[0,0,1,1];i||=[1,0,0,1,0,0];const s=getTransformMatrix(a,t,i);s[4]-=a[0];s[5]-=a[1];e=Util.applyTransform(e,s);return Util.applyTransform(e,i)}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const e of this._streams)e.reset()}_constructFieldName(e){if(!e.has("T")&&!e.has("Parent")){warn("Unknown field name, falling back to empty field name.");return""}if(!e.has("Parent"))return stringToPDFString(e.get("T"));const t=[];e.has("T")&&t.unshift(stringToPDFString(e.get("T")));let i=e;const a=new RefSet;e.objId&&a.put(e.objId);for(;i.has("Parent");){i=i.get("Parent");if(!(i instanceof Dict)||i.objId&&a.has(i.objId))break;i.objId&&a.put(i.objId);i.has("T")&&t.unshift(stringToPDFString(i.get("T")))}return t.join(".")}}class AnnotationBorderStyle{constructor(){this.width=1;this.rawWidth=1;this.style=lA;this.dashArray=[3];this.horizontalCornerRadius=0;this.verticalCornerRadius=0}setWidth(e,t=[0,0,0,0]){if(e instanceof Name)this.width=0;else if("number"==typeof e){if(e>0){this.rawWidth=e;const i=(t[2]-t[0])/2,a=(t[3]-t[1])/2;if(i>0&&a>0&&(e>i||e>a)){warn(`AnnotationBorderStyle.setWidth - ignoring width: ${e}`);e=1}}this.width=e}}setStyle(e){if(e instanceof Name)switch(e.name){case"S":this.style=lA;break;case"D":this.style=BA;break;case"B":this.style=QA;break;case"I":this.style=EA;break;case"U":this.style=uA}}setDashArray(e,t=!1){if(Array.isArray(e)){let i=!0,a=!0;for(const t of e){if(!(+t>=0)){i=!1;break}t>0&&(a=!1)}if(0===e.length||i&&!a){this.dashArray=e;t&&this.setStyle(Name.get("D"))}else this.width=0}else e&&(this.width=0)}setHorizontalCornerRadius(e){Number.isInteger(e)&&(this.horizontalCornerRadius=e)}setVerticalCornerRadius(e){Number.isInteger(e)&&(this.verticalCornerRadius=e)}}class MarkupAnnotation extends Annotation{constructor(e){super(e);const{dict:t}=e;if(t.has("IRT")){const e=t.getRaw("IRT");this.data.inReplyTo=e instanceof Ref?e.toString():null;const i=t.get("RT");this.data.replyType=i instanceof Name?i.name:Z}let i=null;if(this.data.replyType===X){const e=t.get("IRT");this.setTitle(e.get("T"));this.data.titleObj=this._title;this.setContents(e.get("Contents"));this.data.contentsObj=this._contents;if(e.has("CreationDate")){this.setCreationDate(e.get("CreationDate"));this.data.creationDate=this.creationDate}else this.data.creationDate=null;if(e.has("M")){this.setModificationDate(e.get("M"));this.data.modificationDate=this.modificationDate}else this.data.modificationDate=null;i=e.getRaw("Popup");if(e.has("C")){this.setColor(e.getArray("C"));this.data.color=this.color}else this.data.color=null}else{this.data.titleObj=this._title;this.setCreationDate(t.get("CreationDate"));this.data.creationDate=this.creationDate;i=t.getRaw("Popup");t.has("C")||(this.data.color=null)}this.data.popupRef=i instanceof Ref?i.toString():null;t.has("RC")&&(this.data.richText=XFAFactory.getRichTextAsHtml(t.get("RC")))}setCreationDate(e){this.creationDate="string"==typeof e?e:null}_setDefaultAppearance({xref:e,extra:t,strokeColor:i,fillColor:a,blendMode:s,strokeAlpha:r,fillAlpha:n,pointsCallback:g}){let o=Number.MAX_VALUE,c=Number.MAX_VALUE,C=Number.MIN_VALUE,h=Number.MIN_VALUE;const l=["q"];t&&l.push(t);i&&l.push(`${i[0]} ${i[1]} ${i[2]} RG`);a&&l.push(`${a[0]} ${a[1]} ${a[2]} rg`);const Q=this.data.quadPoints||Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]);for(let e=0,t=Q.length;e"string"==typeof e)).map((e=>stringToPDFString(e))):e instanceof Name?stringToPDFString(e.name):"string"==typeof e?stringToPDFString(e):null}hasFieldFlag(e){return!!(this.data.fieldFlags&e)}_isViewable(e){return!0}mustBeViewed(e,t){return t?this.viewable:super.mustBeViewed(e,t)&&!this._hasFlag(this.flags,AA)}getRotationMatrix(e){let t=e?.get(this.data.id)?.rotation;void 0===t&&(t=this.rotation);if(0===t)return i;return getRotationMatrix(t,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1])}getBorderAndBackgroundAppearances(e){let t=e?.get(this.data.id)?.rotation;void 0===t&&(t=this.rotation);if(!this.backgroundColor&&!this.borderColor)return"";const i=this.data.rect[2]-this.data.rect[0],a=this.data.rect[3]-this.data.rect[1],s=0===t||180===t?`0 0 ${i} ${a} re`:`0 0 ${a} ${i} re`;let r="";this.backgroundColor&&(r=`${getPdfColor(this.backgroundColor,!0)} ${s} f `);if(this.borderColor){r+=`${this.borderStyle.width||1} w ${getPdfColor(this.borderColor,!1)} ${s} S `}return r}async getOperatorList(e,t,i,a){if(i&h&&!(this instanceof SignatureWidgetAnnotation)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new OperatorList,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(e,t,i,a);const s=await this._getAppearance(e,t,i,a);if(this.appearance&&null===s)return super.getOperatorList(e,t,i,a);const r=new OperatorList;if(!this._defaultAppearance||null===s)return{opList:r,separateForm:!1,separateCanvas:!1};const n=!!(this.data.hasOwnCanvas&&i&o),g=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],c=getTransformMatrix(this.data.rect,g,[1,0,0,1,0,0]);let C;this.oc&&(C=await e.parseMarkedContentProps(this.oc,null));void 0!==C&&r.addOp(Ye,["OC",C]);r.addOp(je,[this.data.id,this.data.rect,c,this.getRotationMatrix(a),n]);const l=new StringStream(s);await e.getOperatorList({stream:l,task:t,resources:this._fieldResources.mergedResources,operatorList:r});r.addOp(Xe,[]);void 0!==C&&r.addOp(ve,[]);return{opList:r,separateForm:!1,separateCanvas:n}}_getMKDict(e){const t=new Dict(null);e&&t.set("R",e);this.borderColor&&t.set("BC",getPdfColorArray(this.borderColor));this.backgroundColor&&t.set("BG",getPdfColorArray(this.backgroundColor));return t.size>0?t:null}amendSavedDict(e,t){}setValue(e,t,i,a){const{dict:s,ref:r}=function getParentToUpdate(e,t,i){const a=new RefSet,s=e,r={dict:null,ref:null};for(;e instanceof Dict&&!a.has(t);){a.put(t);if(e.has("T"))break;if(!((t=e.getRaw("Parent"))instanceof Ref))return r;e=i.fetch(t)}if(e instanceof Dict&&e!==s){r.dict=e;r.ref=t}return r}(e,this.ref,i);if(s){if(!a.has(r)){const e=s.clone();e.set("V",t);a.put(r,{data:e});return e}}else e.set("V",t);return null}async save(e,t,a,s){const r=a?.get(this.data.id),n=this._buildFlags(r?.noView,r?.noPrint);let g=r?.value,o=r?.rotation;if(g===this.data.fieldValue||void 0===g){if(!this._hasValueFromXFA&&void 0===o&&void 0===n)return;g||=this.data.fieldValue}if(void 0===o&&!this._hasValueFromXFA&&Array.isArray(g)&&Array.isArray(this.data.fieldValue)&&isArrayEqual(g,this.data.fieldValue)&&void 0===n)return;void 0===o&&(o=this.rotation);let c=null;if(!this._needAppearances){c=await this._getAppearance(e,t,C,a);if(null===c&&void 0===n)return}let h=!1;if(c?.needAppearances){h=!0;c=null}const{xref:l}=e,Q=l.fetchIfRef(this.ref);if(!(Q instanceof Dict))return;const E=new Dict(l);for(const e of Q.getKeys())"AP"!==e&&E.set(e,Q.getRaw(e));if(void 0!==n){E.set("F",n);if(null===c&&!h){const e=Q.getRaw("AP");e&&E.set("AP",e)}}const u={path:this.data.fieldName,value:g},d=this.setValue(E,Array.isArray(g)?g.map(stringToAsciiOrUTF16BE):stringToAsciiOrUTF16BE(g),l,s);this.amendSavedDict(a,d||E);const f=this._getMKDict(o);f&&E.set("MK",f);s.put(this.ref,{data:E,xfa:u,needAppearances:h});if(null!==c){const e=l.getNewTemporaryRef(),t=new Dict(l);E.set("AP",t);t.set("N",e);const r=this._getSaveFieldResources(l),n=new StringStream(c),g=n.dict=new Dict(l);g.set("Subtype",Name.get("Form"));g.set("Resources",r);g.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);const o=this.getRotationMatrix(a);o!==i&&g.set("Matrix",o);s.put(e,{data:n,xfa:null,needAppearances:!1})}E.set("M",`D:${getModificationDate()}`)}async _getAppearance(e,t,i,a){if(this.hasFieldFlag(rA))return null;const s=a?.get(this.data.id);let r,g;if(s){r=s.formattedValue||s.value;g=s.rotation}if(void 0===g&&void 0===r&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const o=this.getBorderAndBackgroundAppearances(a);if(void 0===r){r=this.data.fieldValue;if(!r)return`/Tx BMC q ${o}Q EMC`}Array.isArray(r)&&1===r.length&&(r=r[0]);assert("string"==typeof r,"Expected `value` to be a string.");r=r.trimEnd();if(this.data.combo){const e=this.data.options.find((({exportValue:e})=>r===e));r=e?.displayValue||r}if(""===r)return`/Tx BMC q ${o}Q EMC`;void 0===g&&(g=this.rotation);let c,h=-1;if(this.data.multiLine){c=r.split(/\\r\\n?|\\n/).map((e=>e.normalize("NFC")));h=c.length}else c=[r.replace(/\\r\\n?|\\n/,"").normalize("NFC")];let l=this.data.rect[3]-this.data.rect[1],Q=this.data.rect[2]-this.data.rect[0];90!==g&&270!==g||([Q,l]=[l,Q]);this._defaultAppearance||(this.data.defaultAppearanceData=parseDefaultAppearance(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let E,u,d,f=await WidgetAnnotation._getFontData(e,t,this.data.defaultAppearanceData,this._fieldResources.mergedResources);const p=[];let m=!1;for(const e of c){const t=f.encodeString(e);t.length>1&&(m=!0);p.push(t.join(""))}if(m&&i&C)return{needAppearances:!0};if(m&&this._isOffscreenCanvasSupported){const i=this.data.comb?"monospace":"sans-serif",a=new FakeUnicodeFont(e.xref,i),s=a.createFontResources(c.join("")),n=s.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const e=this._fieldResources.mergedResources.get("Font");for(const t of n.getKeys())e.set(t,n.getRaw(t))}else this._fieldResources.mergedResources.set("Font",n);const g=a.fontName.name;f=await WidgetAnnotation._getFontData(e,t,{fontName:g,fontSize:0},s);for(let e=0,t=p.length;e2)return`/Tx BMC q ${o}BT `+E+` 1 0 0 1 ${numberToString(2)} ${numberToString(b)} Tm (${escapeString(p[0])}) Tj ET Q EMC`;return`/Tx BMC q ${o}BT `+E+` 1 0 0 1 0 0 Tm ${this._renderText(p[0],f,u,Q,D,{shift:0},2,b)} ET Q EMC`}static async _getFontData(e,t,i,a){const s=new OperatorList,r={font:null,clone(){return this}},{fontName:n,fontSize:g}=i;await e.handleSetFont(a,[n&&Name.get(n),g],null,s,t,r,null);return r.font}_getTextWidth(e,t){return t.charsToGlyphs(e).reduce(((e,t)=>e+t.width),0)/1e3}_computeFontSize(e,t,i,a,r){let{fontSize:n}=this.data.defaultAppearanceData,g=(n||12)*s,o=Math.round(e/g);if(!n){const roundWithTwoDigits=e=>Math.floor(100*e)/100;if(-1===r){const r=this._getTextWidth(i,a);n=roundWithTwoDigits(Math.min(e/s,t/r));o=1}else{const c=i.split(/\\r\\n?|\\n/),C=[];for(const e of c){const t=a.encodeString(e).join(""),i=a.charsToGlyphs(t),s=a.getCharPositions(t);C.push({line:t,glyphs:i,positions:s})}const isTooBig=i=>{let s=0;for(const r of C){s+=this._splitLine(null,a,i,t,r).length*i;if(s>e)return!0}return!1};o=Math.max(o,r);for(;;){g=e/o;n=roundWithTwoDigits(g/s);if(!isTooBig(n))break;o++}}const{fontName:c,fontColor:C}=this.data.defaultAppearanceData;this._defaultAppearance=function createDefaultAppearance({fontSize:e,fontName:t,fontColor:i}){return`/${escapePDFName(t)} ${e} Tf ${getPdfColor(i,!0)}`}({fontSize:n,fontName:c,fontColor:C})}return[this._defaultAppearance,n,e/o]}_renderText(e,t,i,a,s,r,n,g){let o;if(1===s){o=(a-this._getTextWidth(e,t)*i)/2}else if(2===s){o=a-this._getTextWidth(e,t)*i-n}else o=n;const c=numberToString(o-r.shift);r.shift=o;return`${c} ${g=numberToString(g)} Td (${escapeString(e)}) Tj`}_getSaveFieldResources(e){const{localResources:t,appearanceResources:i,acroFormResources:a}=this._fieldResources,s=this.data.defaultAppearanceData?.fontName;if(!s)return t||Dict.empty;for(const e of[t,i])if(e instanceof Dict){const t=e.get("Font");if(t instanceof Dict&&t.has(s))return e}if(a instanceof Dict){const i=a.get("Font");if(i instanceof Dict&&i.has(s)){const a=new Dict(e);a.set(s,i.getRaw(s));const r=new Dict(e);r.set("Font",a);return Dict.merge({xref:e,dictArray:[r,t],mergeSubDicts:!0})}}return t||Dict.empty}getFieldObject(){return null}}class TextWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);const{dict:t}=e;if(t.has("PMD")){this.flags|=z;this.data.hidden=!0;warn("Barcodes are not supported")}this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML;this._hasText=!0;"string"!=typeof this.data.fieldValue&&(this.data.fieldValue="");let i=getInheritableProperty({dict:t,key:"Q"});(!Number.isInteger(i)||i<0||i>2)&&(i=null);this.data.textAlignment=i;let a=getInheritableProperty({dict:t,key:"MaxLen"});(!Number.isInteger(a)||a<0)&&(a=0);this.data.maxLen=a;this.data.multiLine=this.hasFieldFlag(sA);this.data.comb=this.hasFieldFlag(hA)&&!this.hasFieldFlag(sA)&&!this.hasFieldFlag(rA)&&!this.hasFieldFlag(IA)&&0!==this.data.maxLen;this.data.doNotScroll=this.hasFieldFlag(CA)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(e,t,i,a,s,r,n,g,o,c,C){const h=s/this.data.maxLen,l=this.getBorderAndBackgroundAppearances(C),Q=[],E=t.getCharPositions(i);for(const[e,t]of E)Q.push(`(${escapeString(i.substring(e,t))}) Tj`);const u=Q.join(` ${numberToString(h)} 0 Td `);return`/Tx BMC q ${l}BT `+e+` 1 0 0 1 ${numberToString(n)} ${numberToString(g+o)} Tm ${u} ET Q EMC`}_getMultilineAppearance(e,t,i,a,s,r,n,g,o,c,C,h){const l=[],Q=s-2*g,E={shift:0};for(let e=0,r=t.length;ea){o.push(e.substring(l,i));l=i;Q=u;c=-1;h=-1}else{Q+=u;c=i;C=s;h=t}else if(Q+u>a)if(-1!==c){o.push(e.substring(l,C));l=C;t=h+1;c=-1;Q=0}else{o.push(e.substring(l,i));l=i;Q=u}else Q+=u}lt?`\\\\${t}`:"\\\\s+"));new RegExp(`^\\\\s*${r}\\\\s*$`).test(this.data.fieldValue)&&(this.data.textContent=this.data.fieldValue.split("\\n"))}getFieldObject(){return{id:this.data.id,value:this.data.fieldValue,defaultValue:this.data.defaultFieldValue||"",multiline:this.data.multiLine,password:this.hasFieldFlag(rA),charLimit:this.data.maxLen,comb:this.data.comb,editable:!this.data.readOnly,hidden:this.data.hidden,name:this.data.fieldName,rect:this.data.rect,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:"text"}}}class ButtonWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);this.checkedAppearance=null;this.uncheckedAppearance=null;this.data.checkBox=!this.hasFieldFlag(nA)&&!this.hasFieldFlag(gA);this.data.radioButton=this.hasFieldFlag(nA)&&!this.hasFieldFlag(gA);this.data.pushButton=this.hasFieldFlag(gA);this.data.isTooltipOnly=!1;if(this.data.checkBox)this._processCheckBox(e);else if(this.data.radioButton)this._processRadioButton(e);else if(this.data.pushButton){this.data.hasOwnCanvas=!0;this.data.noHTML=!1;this._processPushButton(e)}else warn("Invalid field flags for button widget annotation")}async getOperatorList(e,t,a,s){if(this.data.pushButton)return super.getOperatorList(e,t,a,!1,s);let r=null,n=null;if(s){const e=s.get(this.data.id);r=e?e.value:null;n=e?e.rotation:null}if(null===r&&this.appearance)return super.getOperatorList(e,t,a,s);null==r&&(r=this.data.checkBox?this.data.fieldValue===this.data.exportValue:this.data.fieldValue===this.data.buttonValue);const g=r?this.checkedAppearance:this.uncheckedAppearance;if(g){const r=this.appearance,o=lookupMatrix(g.dict.getArray("Matrix"),i);n&&g.dict.set("Matrix",this.getRotationMatrix(s));this.appearance=g;const c=super.getOperatorList(e,t,a,s);this.appearance=r;g.dict.set("Matrix",o);return c}return{opList:new OperatorList,separateForm:!1,separateCanvas:!1}}async save(e,t,i,a){this.data.checkBox?this._saveCheckbox(e,t,i,a):this.data.radioButton&&this._saveRadioButton(e,t,i,a)}async _saveCheckbox(e,t,i,a){if(!i)return;const s=i.get(this.data.id),r=this._buildFlags(s?.noView,s?.noPrint);let n=s?.rotation,g=s?.value;if(void 0===n&&void 0===r){if(void 0===g)return;if(this.data.fieldValue===this.data.exportValue===g)return}let o=e.xref.fetchIfRef(this.ref);if(!(o instanceof Dict))return;o=o.clone();void 0===n&&(n=this.rotation);void 0===g&&(g=this.data.fieldValue===this.data.exportValue);const c={path:this.data.fieldName,value:g?this.data.exportValue:""},C=Name.get(g?this.data.exportValue:"Off");this.setValue(o,C,e.xref,a);o.set("AS",C);o.set("M",`D:${getModificationDate()}`);void 0!==r&&o.set("F",r);const h=this._getMKDict(n);h&&o.set("MK",h);a.put(this.ref,{data:o,xfa:c,needAppearances:!1})}async _saveRadioButton(e,t,i,a){if(!i)return;const s=i.get(this.data.id),r=this._buildFlags(s?.noView,s?.noPrint);let n=s?.rotation,g=s?.value;if(void 0===n&&void 0===r){if(void 0===g)return;if(this.data.fieldValue===this.data.buttonValue===g)return}let o=e.xref.fetchIfRef(this.ref);if(!(o instanceof Dict))return;o=o.clone();void 0===g&&(g=this.data.fieldValue===this.data.buttonValue);void 0===n&&(n=this.rotation);const c={path:this.data.fieldName,value:g?this.data.buttonValue:""},C=Name.get(g?this.data.buttonValue:"Off");g&&this.setValue(o,C,e.xref,a);o.set("AS",C);o.set("M",`D:${getModificationDate()}`);void 0!==r&&o.set("F",r);const h=this._getMKDict(n);h&&o.set("MK",h);a.put(this.ref,{data:o,xfa:c,needAppearances:!1})}_getDefaultCheckedAppearance(e,t){const i=this.data.rect[2]-this.data.rect[0],a=this.data.rect[3]-this.data.rect[1],s=[0,0,i,a],r=.8*Math.min(i,a);let n,g;if("check"===t){n={width:.755*r,height:.705*r};g="3"}else if("disc"===t){n={width:.791*r,height:.705*r};g="l"}else unreachable(`_getDefaultCheckedAppearance - unsupported type: ${t}`);const o=`q BT /PdfJsZaDb ${r} Tf 0 g ${numberToString((i-n.width)/2)} ${numberToString((a-n.height)/2)} Td (${g}) Tj ET Q`,c=new Dict(e.xref);c.set("FormType",1);c.set("Subtype",Name.get("Form"));c.set("Type",Name.get("XObject"));c.set("BBox",s);c.set("Matrix",[1,0,0,1,0,0]);c.set("Length",o.length);const C=new Dict(e.xref),h=new Dict(e.xref);h.set("PdfJsZaDb",this.fallbackFontDict);C.set("Font",h);c.set("Resources",C);this.checkedAppearance=new StringStream(o);this.checkedAppearance.dict=c;this._streams.push(this.checkedAppearance)}_processCheckBox(e){const t=e.dict.get("AP");if(!(t instanceof Dict))return;const i=t.get("N");if(!(i instanceof Dict))return;const a=this._decodeFormValue(e.dict.get("AS"));"string"==typeof a&&(this.data.fieldValue=a);const s=null!==this.data.fieldValue&&"Off"!==this.data.fieldValue?this.data.fieldValue:"Yes",r=i.getKeys();if(0===r.length)r.push("Off",s);else if(1===r.length)"Off"===r[0]?r.push(s):r.unshift("Off");else if(r.includes(s)){r.length=0;r.push("Off",s)}else{const e=r.find((e=>"Off"!==e));r.length=0;r.push("Off",e)}r.includes(this.data.fieldValue)||(this.data.fieldValue="Off");this.data.exportValue=r[1];const n=i.get(this.data.exportValue);this.checkedAppearance=n instanceof BaseStream?n:null;const g=i.get("Off");this.uncheckedAppearance=g instanceof BaseStream?g:null;this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(e,"check");this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance);this._fallbackFontDict=this.fallbackFontDict;null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processRadioButton(e){this.data.buttonValue=null;const t=e.dict.get("Parent");if(t instanceof Dict){this.parent=e.dict.getRaw("Parent");const i=t.get("V");i instanceof Name&&(this.data.fieldValue=this._decodeFormValue(i))}const i=e.dict.get("AP");if(!(i instanceof Dict))return;const a=i.get("N");if(!(a instanceof Dict))return;for(const e of a.getKeys())if("Off"!==e){this.data.buttonValue=this._decodeFormValue(e);break}const s=a.get(this.data.buttonValue);this.checkedAppearance=s instanceof BaseStream?s:null;const r=a.get("Off");this.uncheckedAppearance=r instanceof BaseStream?r:null;this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(e,"disc");this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance);this._fallbackFontDict=this.fallbackFontDict;null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processPushButton(e){const{dict:t,annotationGlobals:i}=e;if(t.has("A")||t.has("AA")||this.data.alternativeText){this.data.isTooltipOnly=!t.has("A")&&!t.has("AA");Catalog.parseDestDictionary({destDict:t,resultObj:this.data,docBaseUrl:i.baseUrl,docAttachments:i.attachments})}else warn("Push buttons without action dictionaries are not supported")}getFieldObject(){let e,t="button";if(this.data.checkBox){t="checkbox";e=this.data.exportValue}else if(this.data.radioButton){t="radiobutton";e=this.data.buttonValue}return{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:e,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:t}}get fallbackFontDict(){const e=new Dict;e.set("BaseFont",Name.get("ZapfDingbats"));e.set("Type",Name.get("FallbackType"));e.set("Subtype",Name.get("FallbackType"));e.set("Encoding",Name.get("ZapfDingbatsEncoding"));return shadow(this,"fallbackFontDict",e)}}class ChoiceWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.indices=t.getArray("I");this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0;this.data.options=[];const a=getInheritableProperty({dict:t,key:"Opt"});if(Array.isArray(a))for(let e=0,t=a.length;e=0&&t0&&(this.data.options=this.data.fieldValue.map((e=>({exportValue:e,displayValue:e}))));this.data.combo=this.hasFieldFlag(oA);this.data.multiSelect=this.hasFieldFlag(cA);this._hasText=!0}getFieldObject(){const e=this.data.combo?"combobox":"listbox",t=this.data.fieldValue.length>0?this.data.fieldValue[0]:null;return{id:this.data.id,value:t,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:e}}amendSavedDict(e,t){if(!this.hasIndices)return;let i=e?.get(this.data.id)?.value;Array.isArray(i)||(i=[i]);const a=[],{options:s}=this.data;for(let e=0,t=0,r=s.length;ei){i=a;t=e}}[Q,E]=this._computeFontSize(e,c-4,t,l,-1)}const u=E*s,d=(u-E)/2,f=Math.floor(o/u);let p=0;if(h.length>0){const e=Math.min(...h),t=Math.max(...h);p=Math.max(0,t-f+1);p>e&&(p=e)}const m=Math.min(p+f+1,C),y=["/Tx BMC q",`1 1 ${c} ${o} re W n`];if(h.length){y.push("0.600006 0.756866 0.854904 rg");for(const e of h)p<=e&&ee.trimEnd()));const{coords:e,bbox:t,matrix:i}=FakeUnicodeFont.getFirstPositionInfo(this.rectangle,this.rotation,a);this.data.textPosition=this._transformPoint(e,t,i)}if(this._isOffscreenCanvasSupported){const s=e.dict.get("CA"),r=new FakeUnicodeFont(i,"sans-serif");this.appearance=r.createAppearance(this._contents.str,this.rectangle,this.rotation,a,t,s);this._streams.push(this.appearance)}else warn("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(e,t,{apRef:i,ap:a}){const{color:s,fontSize:r,oldAnnotation:n,rect:g,rotation:o,user:c,value:C}=e,h=n||new Dict(t);h.set("Type",Name.get("Annot"));h.set("Subtype",Name.get("FreeText"));if(n){h.set("M",`D:${getModificationDate()}`);h.delete("RC")}else h.set("CreationDate",`D:${getModificationDate()}`);h.set("Rect",g);const l=`/Helv ${r} Tf ${getPdfColor(s,!0)}`;h.set("DA",l);h.set("Contents",stringToAsciiOrUTF16BE(C));h.set("F",4);h.set("Border",[0,0,0]);h.set("Rotate",o);c&&h.set("T",stringToAsciiOrUTF16BE(c));if(i||a){const e=new Dict(t);h.set("AP",e);i?e.set("N",i):e.set("N",a)}return h}static async createNewAppearanceStream(e,t,i){const{baseFontRef:a,evaluator:r,task:n}=i,{color:g,fontSize:o,rect:c,rotation:C,value:h}=e,l=new Dict(t),Q=new Dict(t);if(a)Q.set("Helv",a);else{const e=new Dict(t);e.set("BaseFont",Name.get("Helvetica"));e.set("Type",Name.get("Font"));e.set("Subtype",Name.get("Type1"));e.set("Encoding",Name.get("WinAnsiEncoding"));Q.set("Helv",e)}l.set("Font",Q);const E=await WidgetAnnotation._getFontData(r,n,{fontName:"Helv",fontSize:o},l),[u,d,f,p]=c;let m=f-u,y=p-d;C%180!=0&&([m,y]=[y,m]);const w=h.split("\\n"),D=o/1e3;let b=-1/0;const F=[];for(let e of w){const t=E.encodeString(e);if(t.length>1)return null;e=t.join("");F.push(e);let i=0;const a=E.charsToGlyphs(e);for(const e of a)i+=e.width*D;b=Math.max(b,i)}let S=1;b>m&&(S=m/b);let k=1;const R=s*o,N=1*o,G=R*w.length;G>y&&(k=y/G);const M=o*Math.min(S,k);let U,x,L;switch(C){case 0:L=[1,0,0,1];x=[c[0],c[1],m,y];U=[c[0],c[3]-N];break;case 90:L=[0,1,-1,0];x=[c[1],-c[2],m,y];U=[c[1],-c[0]-N];break;case 180:L=[-1,0,0,-1];x=[-c[2],-c[3],m,y];U=[-c[2],-c[1]-N];break;case 270:L=[0,-1,1,0];x=[-c[3],c[0],m,y];U=[-c[3],c[2]-N]}const H=["q",`${L.join(" ")} 0 0 cm`,`${x.join(" ")} re W n`,"BT",`${getPdfColor(g,!0)}`,`0 Tc /Helv ${numberToString(M)} Tf`];H.push(`${U.join(" ")} Td (${escapeString(F[0])}) Tj`);const J=numberToString(R);for(let e=1,t=F.length;e{e.push(`${a[0]} ${a[1]} m`,`${a[2]} ${a[3]} l`,"S");return[t[0]-o,t[2]+o,t[7]-o,t[3]+o]}})}}}class SquareAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=M;this.data.hasOwnCanvas=this.data.noRotate;this.data.noHTML=!1;if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA"),s=getRgbColor(t.getArray("IC"),null),r=s?getPdfColorArray(s):null,n=r?a:null;if(0===this.borderStyle.width&&!r)return;this._setDefaultAppearance({xref:i,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:r,strokeAlpha:a,fillAlpha:n,pointsCallback:(e,t)=>{const i=t[4]+this.borderStyle.width/2,a=t[5]+this.borderStyle.width/2,s=t[6]-t[4]-this.borderStyle.width,n=t[3]-t[7]-this.borderStyle.width;e.push(`${i} ${a} ${s} ${n} re`);r?e.push("B"):e.push("S");return[t[0],t[2],t[7],t[3]]}})}}}class CircleAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=U;if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA"),s=getRgbColor(t.getArray("IC"),null),r=s?getPdfColorArray(s):null,n=r?a:null;if(0===this.borderStyle.width&&!r)return;const g=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:i,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:r,strokeAlpha:a,fillAlpha:n,pointsCallback:(e,t)=>{const i=t[0]+this.borderStyle.width/2,a=t[1]-this.borderStyle.width/2,s=t[6]-this.borderStyle.width/2,n=t[7]+this.borderStyle.width/2,o=i+(s-i)/2,c=a+(n-a)/2,C=(s-i)/2*g,h=(n-a)/2*g;e.push(`${o} ${n} m`,`${o+C} ${n} ${s} ${c+h} ${s} ${c} c`,`${s} ${c-h} ${o+C} ${a} ${o} ${a} c`,`${o-C} ${a} ${i} ${c-h} ${i} ${c} c`,`${i} ${c+h} ${o-C} ${n} ${o} ${n} c`,"h");r?e.push("B"):e.push("S");return[t[0],t[2],t[7],t[3]]}})}}}class PolylineAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=L;this.data.hasOwnCanvas=this.data.noRotate;this.data.noHTML=!1;this.data.vertices=null;if(!(this instanceof PolygonAnnotation)){this.setLineEndings(t.getArray("LE"));this.data.lineEndings=this.lineEndings}const a=t.getArray("Vertices");if(!isNumberArray(a,null))return;const s=this.data.vertices=Float32Array.from(a);if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA"),r=this.borderStyle.width||1,n=2*r,g=[1/0,1/0,-1/0,-1/0];for(let e=0,t=s.length;e{for(let t=0,i=s.length;t{for(const t of this.data.inkLists){for(let i=0,a=t.length;ie/255)));Q.set("CA",n);const u=new Dict(t);Q.set("AP",u);i?u.set("N",i):u.set("N",a);return Q}static async createNewAppearanceStream(e,t,i){if(e.outlines)return this.createNewAppearanceStreamForHighlight(e,t,i);const{color:a,rect:s,paths:r,thickness:n,opacity:g}=e,o=[`${n} w 1 J 1 j`,`${getPdfColor(a,!1)}`];1!==g&&o.push("/R0 gs");for(const e of r.lines){o.push(`${numberToString(e[4])} ${numberToString(e[5])} m`);for(let t=6,i=e.length;t{e.push(`${t[0]} ${t[1]} m`,`${t[2]} ${t[3]} l`,`${t[6]} ${t[7]} l`,`${t[4]} ${t[5]} l`,"f");return[t[0],t[2],t[7],t[3]]}})}}else this.data.popupRef=null}static createNewDict(e,t,{apRef:i,ap:a}){const{color:s,oldAnnotation:r,opacity:n,rect:g,rotation:o,user:c,quadPoints:C}=e,h=r||new Dict(t);h.set("Type",Name.get("Annot"));h.set("Subtype",Name.get("Highlight"));h.set(r?"M":"CreationDate",`D:${getModificationDate()}`);h.set("CreationDate",`D:${getModificationDate()}`);h.set("Rect",g);h.set("F",4);h.set("Border",[0,0,0]);h.set("Rotate",o);h.set("QuadPoints",C);h.set("C",Array.from(s,(e=>e/255)));h.set("CA",n);c&&h.set("T",stringToAsciiOrUTF16BE(c));if(i||a){const e=new Dict(t);h.set("AP",e);e.set("N",i||a)}return h}static async createNewAppearanceStream(e,t,i){const{color:a,rect:s,outlines:r,opacity:n}=e,g=[`${getPdfColor(a,!0)}`,"/R0 gs"],o=[];for(const e of r){o.length=0;o.push(`${numberToString(e[0])} ${numberToString(e[1])} m`);for(let t=2,i=e.length;t{e.push(`${t[4]} ${t[5]+1.3} m`,`${t[6]} ${t[7]+1.3} l`,"S");return[t[0],t[2],t[7],t[3]]}})}}else this.data.popupRef=null}}class SquigglyAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=Y;if(this.data.quadPoints=getQuadPoints(t,null)){if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA");this._setDefaultAppearance({xref:i,extra:"[] 0 d 1 w",strokeColor:e,strokeAlpha:a,pointsCallback:(e,t)=>{const i=(t[1]-t[5])/6;let a=i,s=t[4];const r=t[5],n=t[6];e.push(`${s} ${r+a} m`);do{s+=2;a=0===a?i:0;e.push(`${s} ${r+a} l`)}while(s{e.push((t[0]+t[4])/2+" "+(t[1]+t[5])/2+" m",(t[2]+t[6])/2+" "+(t[3]+t[7])/2+" l","S");return[t[0],t[2],t[7],t[3]]}})}}else this.data.popupRef=null}}class StampAnnotation extends MarkupAnnotation{#T;constructor(e){super(e);this.data.annotationType=K;this.#T=this.data.hasOwnCanvas=this.data.noRotate;this.data.isEditable=!this.data.noHTML;this.data.noHTML=!1}mustBeViewedWhenEditing(e,t=null){if(e){if(!this.data.isEditable)return!1;this.#T=this.data.hasOwnCanvas;this.data.hasOwnCanvas=!0;return!0}this.data.hasOwnCanvas=this.#T;return!t?.has(this.data.id)}static async createImage(e,t){const{width:i,height:a}=e,s=new OffscreenCanvas(i,a),r=s.getContext("2d",{alpha:!0});r.drawImage(e,0,0);const n=r.getImageData(0,0,i,a).data,g=new Uint32Array(n.buffer),o=g.some(FeatureTest.isLittleEndian?e=>e>>>24!=255:e=>!!(255&~e));if(o){r.fillStyle="white";r.fillRect(0,0,i,a);r.drawImage(e,0,0)}const c=s.convertToBlob({type:"image/jpeg",quality:1}).then((e=>e.arrayBuffer())),C=Name.get("XObject"),h=Name.get("Image"),l=new Dict(t);l.set("Type",C);l.set("Subtype",h);l.set("BitsPerComponent",8);l.set("ColorSpace",Name.get("DeviceRGB"));l.set("Filter",Name.get("DCTDecode"));l.set("BBox",[0,0,i,a]);l.set("Width",i);l.set("Height",a);let Q=null;if(o){const e=new Uint8Array(g.length);if(FeatureTest.isLittleEndian)for(let t=0,i=g.length;t>>24;else for(let t=0,i=g.length;t=0&&r<=1?r:null}}class DecryptStream extends DecodeStream{constructor(e,t,i){super(t);this.str=e;this.dict=e.dict;this.decrypt=i;this.nextChunk=null;this.initialized=!1}readBlock(){let e;if(this.initialized)e=this.nextChunk;else{e=this.str.getBytes(512);this.initialized=!0}if(!e?.length){this.eof=!0;return}this.nextChunk=this.str.getBytes(512);const t=this.nextChunk?.length>0;e=(0,this.decrypt)(e,!t);const i=this.bufferLength,a=i+e.length;this.ensureBuffer(a).set(e,i);this.bufferLength=a}}class ARCFourCipher{constructor(e){this.a=0;this.b=0;const t=new Uint8Array(256),i=e.length;for(let e=0;e<256;++e)t[e]=e;for(let a=0,s=0;a<256;++a){const r=t[a];s=s+r+e[a%i]&255;t[a]=t[s];t[s]=r}this.s=t}encryptBlock(e){let t=this.a,i=this.b;const a=this.s,s=e.length,r=new Uint8Array(s);for(let n=0;n>5&255;C[h++]=s>>13&255;C[h++]=s>>21&255;C[h++]=s>>>29&255;C[h++]=0;C[h++]=0;C[h++]=0;const E=new Int32Array(16);for(h=0;h>>32-g)|0;s=r}r=r+s|0;n=n+c|0;g=g+Q|0;o=o+u|0}return new Uint8Array([255&r,r>>8&255,r>>16&255,r>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&g,g>>8&255,g>>16&255,g>>>24&255,255&o,o>>8&255,o>>16&255,o>>>24&255])}}();class Word64{constructor(e,t){this.high=0|e;this.low=0|t}and(e){this.high&=e.high;this.low&=e.low}xor(e){this.high^=e.high;this.low^=e.low}or(e){this.high|=e.high;this.low|=e.low}shiftRight(e){if(e>=32){this.low=this.high>>>e-32|0;this.high=0}else{this.low=this.low>>>e|this.high<<32-e;this.high=this.high>>>e|0}}shiftLeft(e){if(e>=32){this.high=this.low<>>32-e;this.low<<=e}}rotateRight(e){let t,i;if(32&e){i=this.low;t=this.high}else{t=this.low;i=this.high}e&=31;this.low=t>>>e|i<<32-e;this.high=i>>>e|t<<32-e}not(){this.high=~this.high;this.low=~this.low}add(e){const t=(this.low>>>0)+(e.low>>>0);let i=(this.high>>>0)+(e.high>>>0);t>4294967295&&(i+=1);this.low=0|t;this.high=0|i}copyTo(e,t){e[t]=this.high>>>24&255;e[t+1]=this.high>>16&255;e[t+2]=this.high>>8&255;e[t+3]=255&this.high;e[t+4]=this.low>>>24&255;e[t+5]=this.low>>16&255;e[t+6]=this.low>>8&255;e[t+7]=255&this.low}assign(e){this.high=e.high;this.low=e.low}}const Ag=function calculateSHA256Closure(){function rotr(e,t){return e>>>t|e<<32-t}function ch(e,t,i){return e&t^~e&i}function maj(e,t,i){return e&t^e&i^t&i}function sigma(e){return rotr(e,2)^rotr(e,13)^rotr(e,22)}function sigmaPrime(e){return rotr(e,6)^rotr(e,11)^rotr(e,25)}function littleSigma(e){return rotr(e,7)^rotr(e,18)^e>>>3}const e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function hash(t,i,a){let s=1779033703,r=3144134277,n=1013904242,g=2773480762,o=1359893119,c=2600822924,C=528734635,h=1541459225;const l=64*Math.ceil((a+9)/64),Q=new Uint8Array(l);let E,u;for(E=0;E>>29&255;Q[E++]=a>>21&255;Q[E++]=a>>13&255;Q[E++]=a>>5&255;Q[E++]=a<<3&255;const f=new Uint32Array(64);for(E=0;E>>10)+f[u-7]+littleSigma(f[u-15])+f[u-16]|0;let t,i,a=s,l=r,d=n,m=g,y=o,w=c,D=C,b=h;for(u=0;u<64;++u){t=b+sigmaPrime(y)+ch(y,w,D)+e[u]+f[u];i=sigma(a)+maj(a,l,d);b=D;D=w;w=y;y=m+t|0;m=d;d=l;l=a;a=t+i|0}s=s+a|0;r=r+l|0;n=n+d|0;g=g+m|0;o=o+y|0;c=c+w|0;C=C+D|0;h=h+b|0}var p;return new Uint8Array([s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,g>>24&255,g>>16&255,g>>8&255,255&g,o>>24&255,o>>16&255,o>>8&255,255&o,c>>24&255,c>>16&255,c>>8&255,255&c,C>>24&255,C>>16&255,C>>8&255,255&C,h>>24&255,h>>16&255,h>>8&255,255&h])}}(),eg=function calculateSHA512Closure(){function ch(e,t,i,a,s){e.assign(t);e.and(i);s.assign(t);s.not();s.and(a);e.xor(s)}function maj(e,t,i,a,s){e.assign(t);e.and(i);s.assign(t);s.and(a);e.xor(s);s.assign(i);s.and(a);e.xor(s)}function sigma(e,t,i){e.assign(t);e.rotateRight(28);i.assign(t);i.rotateRight(34);e.xor(i);i.assign(t);i.rotateRight(39);e.xor(i)}function sigmaPrime(e,t,i){e.assign(t);e.rotateRight(14);i.assign(t);i.rotateRight(18);e.xor(i);i.assign(t);i.rotateRight(41);e.xor(i)}function littleSigma(e,t,i){e.assign(t);e.rotateRight(1);i.assign(t);i.rotateRight(8);e.xor(i);i.assign(t);i.shiftRight(7);e.xor(i)}function littleSigmaPrime(e,t,i){e.assign(t);e.rotateRight(19);i.assign(t);i.rotateRight(61);e.xor(i);i.assign(t);i.shiftRight(6);e.xor(i)}const e=[new Word64(1116352408,3609767458),new Word64(1899447441,602891725),new Word64(3049323471,3964484399),new Word64(3921009573,2173295548),new Word64(961987163,4081628472),new Word64(1508970993,3053834265),new Word64(2453635748,2937671579),new Word64(2870763221,3664609560),new Word64(3624381080,2734883394),new Word64(310598401,1164996542),new Word64(607225278,1323610764),new Word64(1426881987,3590304994),new Word64(1925078388,4068182383),new Word64(2162078206,991336113),new Word64(2614888103,633803317),new Word64(3248222580,3479774868),new Word64(3835390401,2666613458),new Word64(4022224774,944711139),new Word64(264347078,2341262773),new Word64(604807628,2007800933),new Word64(770255983,1495990901),new Word64(1249150122,1856431235),new Word64(1555081692,3175218132),new Word64(1996064986,2198950837),new Word64(2554220882,3999719339),new Word64(2821834349,766784016),new Word64(2952996808,2566594879),new Word64(3210313671,3203337956),new Word64(3336571891,1034457026),new Word64(3584528711,2466948901),new Word64(113926993,3758326383),new Word64(338241895,168717936),new Word64(666307205,1188179964),new Word64(773529912,1546045734),new Word64(1294757372,1522805485),new Word64(1396182291,2643833823),new Word64(1695183700,2343527390),new Word64(1986661051,1014477480),new Word64(2177026350,1206759142),new Word64(2456956037,344077627),new Word64(2730485921,1290863460),new Word64(2820302411,3158454273),new Word64(3259730800,3505952657),new Word64(3345764771,106217008),new Word64(3516065817,3606008344),new Word64(3600352804,1432725776),new Word64(4094571909,1467031594),new Word64(275423344,851169720),new Word64(430227734,3100823752),new Word64(506948616,1363258195),new Word64(659060556,3750685593),new Word64(883997877,3785050280),new Word64(958139571,3318307427),new Word64(1322822218,3812723403),new Word64(1537002063,2003034995),new Word64(1747873779,3602036899),new Word64(1955562222,1575990012),new Word64(2024104815,1125592928),new Word64(2227730452,2716904306),new Word64(2361852424,442776044),new Word64(2428436474,593698344),new Word64(2756734187,3733110249),new Word64(3204031479,2999351573),new Word64(3329325298,3815920427),new Word64(3391569614,3928383900),new Word64(3515267271,566280711),new Word64(3940187606,3454069534),new Word64(4118630271,4000239992),new Word64(116418474,1914138554),new Word64(174292421,2731055270),new Word64(289380356,3203993006),new Word64(460393269,320620315),new Word64(685471733,587496836),new Word64(852142971,1086792851),new Word64(1017036298,365543100),new Word64(1126000580,2618297676),new Word64(1288033470,3409855158),new Word64(1501505948,4234509866),new Word64(1607167915,987167468),new Word64(1816402316,1246189591)];return function hash(t,i,a,s=!1){let r,n,g,o,c,C,h,l;if(s){r=new Word64(3418070365,3238371032);n=new Word64(1654270250,914150663);g=new Word64(2438529370,812702999);o=new Word64(355462360,4144912697);c=new Word64(1731405415,4290775857);C=new Word64(2394180231,1750603025);h=new Word64(3675008525,1694076839);l=new Word64(1203062813,3204075428)}else{r=new Word64(1779033703,4089235720);n=new Word64(3144134277,2227873595);g=new Word64(1013904242,4271175723);o=new Word64(2773480762,1595750129);c=new Word64(1359893119,2917565137);C=new Word64(2600822924,725511199);h=new Word64(528734635,4215389547);l=new Word64(1541459225,327033209)}const Q=128*Math.ceil((a+17)/128),E=new Uint8Array(Q);let u,d;for(u=0;u>>29&255;E[u++]=a>>21&255;E[u++]=a>>13&255;E[u++]=a>>5&255;E[u++]=a<<3&255;const p=new Array(80);for(u=0;u<80;u++)p[u]=new Word64(0,0);let m=new Word64(0,0),y=new Word64(0,0),w=new Word64(0,0),D=new Word64(0,0),b=new Word64(0,0),F=new Word64(0,0),S=new Word64(0,0),k=new Word64(0,0);const R=new Word64(0,0),N=new Word64(0,0),G=new Word64(0,0),M=new Word64(0,0);let U,x;for(u=0;u=1;--e){i=r[13];r[13]=r[9];r[9]=r[5];r[5]=r[1];r[1]=i;i=r[14];a=r[10];r[14]=r[6];r[10]=r[2];r[6]=i;r[2]=a;i=r[15];a=r[11];s=r[7];r[15]=r[3];r[11]=i;r[7]=a;r[3]=s;for(let e=0;e<16;++e)r[e]=this._inv_s[r[e]];for(let i=0,a=16*e;i<16;++i,++a)r[i]^=t[a];for(let e=0;e<16;e+=4){const t=this._mix[r[e]],a=this._mix[r[e+1]],s=this._mix[r[e+2]],n=this._mix[r[e+3]];i=t^a>>>8^a<<24^s>>>16^s<<16^n>>>24^n<<8;r[e]=i>>>24&255;r[e+1]=i>>16&255;r[e+2]=i>>8&255;r[e+3]=255&i}}i=r[13];r[13]=r[9];r[9]=r[5];r[5]=r[1];r[1]=i;i=r[14];a=r[10];r[14]=r[6];r[10]=r[2];r[6]=i;r[2]=a;i=r[15];a=r[11];s=r[7];r[15]=r[3];r[11]=i;r[7]=a;r[3]=s;for(let e=0;e<16;++e){r[e]=this._inv_s[r[e]];r[e]^=t[e]}return r}_encrypt(e,t){const i=this._s;let a,s,r;const n=new Uint8Array(16);n.set(e);for(let e=0;e<16;++e)n[e]^=t[e];for(let e=1;e=a;--i)if(e[i]!==t){t=0;break}g-=t;r[r.length-1]=e.subarray(0,16-t)}}const o=new Uint8Array(g);for(let e=0,t=0,i=r.length;e=256&&(g=255&(27^g))}for(let t=0;t<4;++t){i[e]=a^=i[e-32];e++;i[e]=s^=i[e-32];e++;i[e]=r^=i[e-32];e++;i[e]=n^=i[e-32];e++}}return i}}class PDF17{checkOwnerPassword(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);return isArrayEqual(Ag(s,0,s.length),a)}checkUserPassword(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);return isArrayEqual(Ag(a,0,a.length),i)}getOwnerKey(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);const r=Ag(s,0,s.length);return new AES256Cipher(r).decryptBlock(a,!1,new Uint8Array(16))}getUserKey(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);const s=Ag(a,0,a.length);return new AES256Cipher(s).decryptBlock(i,!1,new Uint8Array(16))}}class PDF20{_hash(e,t,i){let a=Ag(t,0,t.length).subarray(0,32),s=[0],r=0;for(;r<64||s.at(-1)>r-32;){const t=e.length+a.length+i.length,c=new Uint8Array(t);let C=0;c.set(e,C);C+=e.length;c.set(a,C);C+=a.length;c.set(i,C);const h=new Uint8Array(64*t);for(let e=0,i=0;e<64;e++,i+=t)h.set(c,i);s=new AES128Cipher(a.subarray(0,16)).encrypt(h,a.subarray(16,32));const l=s.slice(0,16).reduce(((e,t)=>e+t),0)%3;0===l?a=Ag(s,0,s.length):1===l?a=(n=s,g=0,o=s.length,eg(n,g,o,!0)):2===l&&(a=eg(s,0,s.length));r++}var n,g,o;return a.subarray(0,32)}checkOwnerPassword(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);return isArrayEqual(this._hash(e,s,i),a)}checkUserPassword(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);return isArrayEqual(this._hash(e,a,[]),i)}getOwnerKey(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);const r=this._hash(e,s,i);return new AES256Cipher(r).decryptBlock(a,!1,new Uint8Array(16))}getUserKey(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);const s=this._hash(e,a,[]);return new AES256Cipher(s).decryptBlock(i,!1,new Uint8Array(16))}}class CipherTransform{constructor(e,t){this.StringCipherConstructor=e;this.StreamCipherConstructor=t}createStream(e,t){const i=new this.StreamCipherConstructor;return new DecryptStream(e,t,(function cipherTransformDecryptStream(e,t){return i.decryptBlock(e,t)}))}decryptString(e){const t=new this.StringCipherConstructor;let i=stringToBytes(e);i=t.decryptBlock(i,!0);return bytesToString(i)}encryptString(e){const t=new this.StringCipherConstructor;if(t instanceof AESBaseCipher){const i=16-e.length%16;e+=String.fromCharCode(i).repeat(i);const a=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(a);else for(let e=0;e<16;e++)a[e]=Math.floor(256*Math.random());let s=stringToBytes(e);s=t.encrypt(s,a);const r=new Uint8Array(16+s.length);r.set(a);r.set(s,16);return bytesToString(r)}let i=stringToBytes(e);i=t.encrypt(i);return bytesToString(i)}}class CipherTransformFactory{static#q=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);#O(e,t,i,a,s,r,n,g,o,c,C,h){if(t){const e=Math.min(127,t.length);t=t.subarray(0,e)}else t=[];const l=6===e?new PDF20:new PDF17;return l.checkUserPassword(t,g,n)?l.getUserKey(t,o,C):t.length&&l.checkOwnerPassword(t,a,r,i)?l.getOwnerKey(t,s,r,c):null}#P(e,t,i,a,s,r,n,g){const o=40+i.length+e.length,c=new Uint8Array(o);let C,h,l=0;if(t){h=Math.min(32,t.length);for(;l>8&255;c[l++]=s>>16&255;c[l++]=s>>>24&255;for(C=0,h=e.length;C=4&&!g){c[l++]=255;c[l++]=255;c[l++]=255;c[l++]=255}let Q=$n(c,0,l);const E=n>>3;if(r>=3)for(C=0;C<50;++C)Q=$n(Q,0,E);const u=Q.subarray(0,E);let d,f;if(r>=3){for(l=0;l<32;++l)c[l]=CipherTransformFactory.#q[l];for(C=0,h=e.length;C>3;if(i>=3)for(g=0;g<50;++g)o=$n(o,0,o.length);let C,h;if(i>=3){h=t;const e=new Uint8Array(c);for(g=19;g>=0;g--){for(let t=0;t>8&255;s[n++]=e>>16&255;s[n++]=255&t;s[n++]=t>>8&255;if(a){s[n++]=115;s[n++]=65;s[n++]=108;s[n++]=84}return $n(s,0,n).subarray(0,Math.min(i.length+5,16))}#X(e,t,i,a,s){if(!(t instanceof Name))throw new FormatError("Invalid crypt filter name.");const r=this,n=e.get(t.name),g=n?.get("CFM");if(!g||"None"===g.name)return function(){return new NullCipher};if("V2"===g.name)return function(){return new ARCFourCipher(r.#j(i,a,s,!1))};if("AESV2"===g.name)return function(){return new AES128Cipher(r.#j(i,a,s,!0))};if("AESV3"===g.name)return function(){return new AES256Cipher(s)};throw new FormatError("Unknown crypto method")}constructor(e,t,i){const a=e.get("Filter");if(!isName(a,"Standard"))throw new FormatError("unknown encryption method");this.filterName=a.name;this.dict=e;const s=e.get("V");if(!Number.isInteger(s)||1!==s&&2!==s&&4!==s&&5!==s)throw new FormatError("unsupported encryption algorithm");this.algorithm=s;let r=e.get("Length");if(!r)if(s<=3)r=40;else{const t=e.get("CF"),i=e.get("StmF");if(t instanceof Dict&&i instanceof Name){t.suppressEncryption=!0;const e=t.get(i.name);r=e?.get("Length")||128;r<40&&(r<<=3)}}if(!Number.isInteger(r)||r<40||r%8!=0)throw new FormatError("invalid key length");const n=stringToBytes(e.get("O")),g=stringToBytes(e.get("U")),o=n.subarray(0,32),c=g.subarray(0,32),C=e.get("P"),h=e.get("R"),l=(4===s||5===s)&&!1!==e.get("EncryptMetadata");this.encryptMetadata=l;const Q=stringToBytes(t);let E,u;if(i){if(6===h)try{i=utf8StringToString(i)}catch{warn("CipherTransformFactory: Unable to convert UTF8 encoded password.")}E=stringToBytes(i)}if(5!==s)u=this.#P(Q,E,o,c,C,h,r,l);else{const t=n.subarray(32,40),i=n.subarray(40,48),a=g.subarray(0,48),s=g.subarray(32,40),r=g.subarray(40,48),C=stringToBytes(e.get("OE")),l=stringToBytes(e.get("UE")),Q=stringToBytes(e.get("Perms"));u=this.#O(h,E,o,t,i,a,c,s,r,C,l,Q)}if(!u&&!i)throw new PasswordException("No password given",rt);if(!u&&i){const e=this.#W(E,o,h,r);u=this.#P(Q,e,o,c,C,h,r,l)}if(!u)throw new PasswordException("Incorrect Password",nt);this.encryptionKey=u;if(s>=4){const t=e.get("CF");t instanceof Dict&&(t.suppressEncryption=!0);this.cf=t;this.stmf=e.get("StmF")||Name.get("Identity");this.strf=e.get("StrF")||Name.get("Identity");this.eff=e.get("EFF")||this.stmf}}createCipherTransform(e,t){if(4===this.algorithm||5===this.algorithm)return new CipherTransform(this.#X(this.cf,this.strf,e,t,this.encryptionKey),this.#X(this.cf,this.stmf,e,t,this.encryptionKey));const i=this.#j(e,t,this.encryptionKey,!1),cipherConstructor=function(){return new ARCFourCipher(i)};return new CipherTransform(cipherConstructor,cipherConstructor)}}function decodeString(e){try{return stringToUTF8String(e)}catch(t){warn(`UTF-8 decoding failed: "${t}".`);return e}}class DatasetXMLParser extends SimpleXMLParser{constructor(e){super(e);this.node=null}onEndElement(e){const t=super.onEndElement(e);if(t&&"xfa:datasets"===e){this.node=t;throw new Error("Aborting DatasetXMLParser.")}}}class DatasetReader{constructor(e){if(e.datasets)this.node=new SimpleXMLParser({hasAttributes:!0}).parseFromString(e.datasets).documentElement;else{const t=new DatasetXMLParser({hasAttributes:!0});try{t.parseFromString(e["xdp:xdp"])}catch{}this.node=t.node}}getValue(e){if(!this.node||!e)return"";const t=this.node.searchNode(parseXFAPath(e),0);if(!t)return"";const i=t.firstChild;return"value"===i?.nodeName?t.children.map((e=>decodeString(e.textContent))):decodeString(t.textContent)}}class XRef{#Z=null;constructor(e,t){this.stream=e;this.pdfManager=t;this.entries=[];this._xrefStms=new Set;this._cacheMap=new Map;this._pendingRefs=new RefSet;this._newPersistentRefNum=null;this._newTemporaryRefNum=null;this._persistentRefsCache=null}getNewPersistentRef(e){null===this._newPersistentRefNum&&(this._newPersistentRefNum=this.entries.length||1);const t=this._newPersistentRefNum++;this._cacheMap.set(t,e);return Ref.get(t,0)}getNewTemporaryRef(){if(null===this._newTemporaryRefNum){this._newTemporaryRefNum=this.entries.length||1;if(this._newPersistentRefNum){this._persistentRefsCache=new Map;for(let e=this._newTemporaryRefNum;e0;){const[n,g]=r;if(!Number.isInteger(n)||!Number.isInteger(g))throw new FormatError(`Invalid XRef range fields: ${n}, ${g}`);if(!Number.isInteger(i)||!Number.isInteger(a)||!Number.isInteger(s))throw new FormatError(`Invalid XRef entry fields length: ${n}, ${g}`);for(let r=t.entryNum;r=e.length);){i+=String.fromCharCode(a);a=e[t]}return i}function skipUntil(e,t,i){const a=i.length,s=e.length;let r=0;for(;t=a)break;t++;r++}return r}const e=/\\b(endobj|\\d+\\s+\\d+\\s+obj|xref|trailer\\s*<<)\\b/g,t=/\\b(startxref|\\d+\\s+\\d+\\s+obj)\\b/g,i=/^(\\d+)\\s+(\\d+)\\s+obj\\b/,a=new Uint8Array([116,114,97,105,108,101,114]),s=new Uint8Array([115,116,97,114,116,120,114,101,102]),r=new Uint8Array([47,88,82,101,102]);this.entries.length=0;this._cacheMap.clear();const n=this.stream;n.pos=0;const g=n.getBytes(),o=bytesToString(g),c=g.length;let C=n.start;const h=[],l=[];for(;C=c)break;Q=g[C]}while(10!==Q&&13!==Q);continue}const E=readToken(g,C);let u;if(E.startsWith("xref")&&(4===E.length||/\\s/.test(E[4]))){C+=skipUntil(g,C,a);h.push(C);C+=skipUntil(g,C,s)}else if(u=i.exec(E)){const t=0|u[1],i=0|u[2],a=C+E.length;let s,h=!1;if(this.entries[t]){if(this.entries[t].gen===i)try{new Parser({lexer:new Lexer(n.makeSubStream(a))}).getObj();h=!0}catch(e){e instanceof ParserEOFException?warn(`indexObjects -- checking object (${E}): "${e}".`):h=!0}}else h=!0;h&&(this.entries[t]={offset:C-n.start,gen:i,uncompressed:!0});e.lastIndex=a;const Q=e.exec(o);if(Q){s=e.lastIndex+1-C;if("endobj"!==Q[1]){warn(`indexObjects: Found "${Q[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`);s-=Q[1].length+1}}else s=c-C;const d=g.subarray(C,C+s),f=skipUntil(d,0,r);if(f0?Math.max(...this._xrefStms):null)}getEntry(e){const t=this.entries[e];return t&&!t.free&&t.offset?t:null}fetchIfRef(e,t=!1){return e instanceof Ref?this.fetch(e,t):e}fetch(e,t=!1){if(!(e instanceof Ref))throw new Error("ref object is not a reference");const i=e.num,a=this._cacheMap.get(i);if(void 0!==a){a instanceof Dict&&!a.objId&&(a.objId=e.toString());return a}let s=this.getEntry(i);if(null===s){this._cacheMap.set(i,s);return s}if(this._pendingRefs.has(e)){this._pendingRefs.remove(e);warn(`Ignoring circular reference: ${e}.`);return lt}this._pendingRefs.put(e);try{s=s.uncompressed?this.fetchUncompressed(e,s,t):this.fetchCompressed(e,s,t);this._pendingRefs.remove(e)}catch(t){this._pendingRefs.remove(e);throw t}s instanceof Dict?s.objId=e.toString():s instanceof BaseStream&&(s.dict.objId=e.toString());return s}fetchUncompressed(e,t,i=!1){const a=e.gen;let s=e.num;if(t.gen!==a){const r=`Inconsistent generation in XRef: ${e}`;if(this._generationFallback&&t.gen0&&t[3]-t[1]>0)return t;warn(`Empty, or invalid, /${e} entry.`)}return null}get mediaBox(){return shadow(this,"mediaBox",this._getBoundingBox("MediaBox")||tg)}get cropBox(){return shadow(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){const e=this.pageDict.get("UserUnit");return shadow(this,"userUnit","number"==typeof e&&e>0?e:1)}get view(){const{cropBox:e,mediaBox:t}=this;if(e!==t&&!isArrayEqual(e,t)){const i=Util.intersect(e,t);if(i&&i[2]-i[0]>0&&i[3]-i[1]>0)return shadow(this,"view",i);warn("Empty /CropBox and /MediaBox intersection.")}return shadow(this,"view",t)}get rotate(){let e=this._getInheritableProperty("Rotate")||0;e%90!=0?e=0:e>=360?e%=360:e<0&&(e=(e%360+360)%360);return shadow(this,"rotate",e)}_onSubStreamError(e,t){if(!this.evaluatorOptions.ignoreErrors)throw e;warn(`getContentStream - ignoring sub-stream (${t}): "${e}".`)}getContentStream(){return this.pdfManager.ensure(this,"content").then((e=>e instanceof BaseStream?e:Array.isArray(e)?new StreamsSequenceStream(e,this._onSubStreamError.bind(this)):new NullStream))}get xfaData(){return shadow(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async#V(e,t,i){const a=[];for(const s of e)if(s.id){const e=Ref.fromString(s.id);if(!e){warn(`A non-linked annotation cannot be modified: ${s.id}`);continue}if(s.deleted){t.put(e,e);if(s.popupRef){const e=Ref.fromString(s.popupRef);e&&t.put(e,e)}continue}i?.put(e);s.ref=e;a.push(this.xref.fetchAsync(e).then((e=>{e instanceof Dict&&(s.oldAnnotation=e.clone())}),(()=>{warn(`Cannot fetch \\`oldAnnotation\\` for: ${e}.`)})));delete s.id}await Promise.all(a)}async saveNewAnnotations(e,t,i,a,s){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const r=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),n=new RefSetCache,g=new RefSet;await this.#V(i,n,g);const o=this.pageDict,c=this.annotations.filter((e=>!(e instanceof Ref&&n.has(e)))),C=await AnnotationFactory.saveNewAnnotations(r,t,i,a,s);for(const{ref:e}of C.annotations)e instanceof Ref&&!g.has(e)&&c.push(e);const h=o.clone();h.set("Annots",c);s.put(this.ref,{data:h});for(const e of n)s.put(e,{data:null})}save(e,t,i,a){const s=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then((function(e){const r=[];for(const n of e)r.push(n.save(s,t,i,a).catch((function(e){warn(`save - ignoring annotation data during "${t.name}" task: "${e}".`);return null})));return Promise.all(r)}))}loadResources(e){this.resourcesPromise||=this.pdfManager.ensure(this,"resources");return this.resourcesPromise.then((()=>new ObjectLoader(this.resources,e,this.xref).load()))}getOperatorList({handler:e,sink:t,task:i,intent:a,cacheKey:s,annotationStorage:r=null,modifiedIds:n=null}){const C=this.getContentStream(),E=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),d=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),f=this.xfaFactory?null:getNewAnnotationsMap(r),p=f?.get(this.pageIndex);let m=Promise.resolve(null),y=null;if(p){const e=this.pdfManager.ensureDoc("annotationGlobals");let t;const a=new Set;for(const{bitmapId:e,bitmap:t}of p)!e||t||a.has(e)||a.add(e);const{isOffscreenCanvasSupported:s}=this.evaluatorOptions;if(a.size>0){const e=p.slice();for(const[t,i]of r)t.startsWith(u)&&i.bitmap&&a.has(i.bitmapId)&&e.push(i);t=AnnotationFactory.generateImages(e,this.xref,s)}else t=AnnotationFactory.generateImages(p,this.xref,s);y=new RefSet;m=Promise.all([e,this.#V(p,y,null)]).then((([e])=>e?AnnotationFactory.printNewAnnotations(e,d,i,p,t):null))}const w=Promise.all([C,E]).then((([r])=>{const n=new OperatorList(a,t);e.send("StartRenderPage",{transparency:d.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:s});return d.getOperatorList({stream:r,task:i,resources:this.resources,operatorList:n}).then((function(){return n}))}));return Promise.all([w,this._parsedAnnotations,m]).then((function([e,t,s]){if(s){t=t.filter((e=>!(e.ref&&y.has(e.ref))));for(let e=0,i=s.length;ee.ref&&isRefsEqual(e.ref,a.refToReplace)));if(r>=0){t.splice(r,1,a);s.splice(e--,1);i--}}}t=t.concat(s)}if(0===t.length||a&l){e.flush(!0);return{length:e.totalLength}}const C=!!(a&h),E=!!(a&Q),u=!!(a&g),f=!!(a&o),p=!!(a&c),m=[];for(const e of t)(u||f&&e.mustBeViewed(r,C)&&e.mustBeViewedWhenEditing(E,n)||p&&e.mustBePrinted(r))&&m.push(e.getOperatorList(d,i,a,r).catch((function(e){warn(`getOperatorList - ignoring annotation data during "${i.name}" task: "${e}".`);return{opList:null,separateForm:!1,separateCanvas:!1}})));return Promise.all(m).then((function(t){let i=!1,a=!1;for(const{opList:s,separateForm:r,separateCanvas:n}of t){e.addOpList(s);i||=r;a||=n}e.flush(!0,{form:i,canvas:a});return{length:e.totalLength}}))}))}async extractTextContent({handler:e,task:t,includeMarkedContent:i,disableNormalization:a,sink:s}){const r=this.getContentStream(),n=this.loadResources(["ExtGState","Font","Properties","XObject"]),g=this.pdfManager.ensureCatalog("lang"),[o,,c]=await Promise.all([r,n,g]);return new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:o,task:t,resources:this.resources,includeMarkedContent:i,disableNormalization:a,sink:s,viewBox:this.view,lang:c})}async getStructTree(){const e=await this.pdfManager.ensureCatalog("structTreeRoot");if(!e)return null;await this._parsedAnnotations;const t=await this.pdfManager.ensure(this,"_parseStructTree",[e]);return this.pdfManager.ensure(t,"serializable")}_parseStructTree(e){const t=new StructTreePage(e,this.pageDict);t.parse(this.ref);return t}async getAnnotationsData(e,t,i){const a=await this._parsedAnnotations;if(0===a.length)return a;const s=[],r=[];let n;const C=!!(i&g),h=!!(i&o),l=!!(i&c);for(const i of a){const a=C||h&&i.viewable;(a||l&&i.printable)&&s.push(i.data);if(i.hasTextContent&&a){n||=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});r.push(i.extractTextContent(n,t,[-1/0,-1/0,1/0,1/0]).catch((function(e){warn(`getAnnotationsData - ignoring textContent during "${t.name}" task: "${e}".`)})))}}await Promise.all(r);return s}get annotations(){const e=this._getInheritableProperty("Annots");return shadow(this,"annotations",Array.isArray(e)?e:[])}get _parsedAnnotations(){return shadow(this,"_parsedAnnotations",this.pdfManager.ensure(this,"annotations").then((async e=>{if(0===e.length)return e;const[t,i]=await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureDoc("fieldObjects")]);if(!t)return[];const a=i?.orphanFields,s=[];for(const i of e)s.push(AnnotationFactory.create(this.xref,i,t,this._localIdFactory,!1,a,this.ref).catch((function(e){warn(`_parsedAnnotations: "${e}".`);return null})));const r=[];let n,g;for(const e of await Promise.all(s))e&&(e instanceof WidgetAnnotation?(g||=[]).push(e):e instanceof PopupAnnotation?(n||=[]).push(e):r.push(e));g&&r.push(...g);n&&r.push(...n);return r})))}get jsActions(){return shadow(this,"jsActions",collectActions(this.xref,this.pageDict,pA))}}const ig=new Uint8Array([37,80,68,70,45]),ag=new Uint8Array([115,116,97,114,116,120,114,101,102]),sg=new Uint8Array([101,110,100,111,98,106]);function find(e,t,i=1024,a=!1){const s=t.length,r=e.peekBytes(i),n=r.length-s;if(n<=0)return!1;if(a){const i=s-1;let a=r.length-1;for(;a>=i;){let n=0;for(;n=s){e.pos+=a-i;return!0}a--}}else{let i=0;for(;i<=n;){let a=0;for(;a=s){e.pos+=i;return!0}i++}}return!1}class PDFDocument{constructor(e,t){if(t.length<=0)throw new InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=e;this.stream=t;this.xref=new XRef(t,e);this._pagePromises=new Map;this._version=null;const i={font:0};this._globalIdFactory=class{static getDocId(){return`g_${e.docId}`}static createFontId(){return"f"+ ++i.font}static createObjId(){unreachable("Abstract method `createObjId` called.")}static getPageObjId(){unreachable("Abstract method `getPageObjId` called.")}}}parse(e){this.xref.parse(e);this.catalog=new Catalog(this.pdfManager,this.xref)}get linearization(){let e=null;try{e=Linearization.create(this.stream)}catch(e){if(e instanceof MissingDataException)throw e;info(e)}return shadow(this,"linearization",e)}get startXRef(){const e=this.stream;let t=0;if(this.linearization){e.reset();if(find(e,sg)){e.skip(6);let i=e.peekByte();for(;isWhiteSpace(i);){e.pos++;i=e.peekByte()}t=e.pos-e.start}}else{const i=1024,a=ag.length;let s=!1,r=e.end;for(;!s&&r>0;){r-=i-a;r<0&&(r=0);e.pos=r;s=find(e,ag,i,!0)}if(s){e.skip(9);let i;do{i=e.getByte()}while(isWhiteSpace(i));let a="";for(;i>=32&&i<=57;){a+=String.fromCharCode(i);i=e.getByte()}t=parseInt(a,10);isNaN(t)&&(t=0)}}return shadow(this,"startXRef",t)}checkHeader(){const e=this.stream;e.reset();if(!find(e,ig))return;e.moveStart();e.skip(ig.length);let t,i="";for(;(t=e.getByte())>32&&i.length<7;)i+=String.fromCharCode(t);ft.test(i)?this._version=i:warn(`Invalid PDF header version: ${i}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let e=0;e=this.catalog.hasActualNumPages?this.catalog.numPages:this.xfaFactory?this.xfaFactory.getNumPages():this.linearization?this.linearization.numPages:this.catalog.numPages;return shadow(this,"numPages",e)}_hasOnlyDocumentSignatures(e,t=0){return!!Array.isArray(e)&&e.every((e=>{if(!((e=this.xref.fetchIfRef(e))instanceof Dict))return!1;if(e.has("Kids")){if(++t>10){warn("_hasOnlyDocumentSignatures: maximum recursion depth reached");return!1}return this._hasOnlyDocumentSignatures(e.get("Kids"),t)}const i=isName(e.get("FT"),"Sig"),a=e.get("Rect"),s=Array.isArray(a)&&a.every((e=>0===e));return i&&s}))}get _xfaStreams(){const e=this.catalog.acroForm;if(!e)return null;const t=e.get("XFA"),i={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(t instanceof BaseStream&&!t.isEmpty){i["xdp:xdp"]=t;return i}if(!Array.isArray(t)||0===t.length)return null;for(let e=0,a=t.length;e0;e.hasFields=a;const s=t.get("XFA");e.hasXfa=Array.isArray(s)&&s.length>0||s instanceof BaseStream&&!s.isEmpty;const r=!!(1&t.get("SigFlags")),n=r&&this._hasOnlyDocumentSignatures(i);e.hasAcroForm=a&&!n;e.hasSignatures=r}catch(e){if(e instanceof MissingDataException)throw e;warn(`Cannot fetch form information: "${e}".`)}return shadow(this,"formInfo",e)}get documentInfo(){const e={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let t;try{t=this.xref.trailer.get("Info")}catch(e){if(e instanceof MissingDataException)throw e;info("The document information dictionary is invalid.")}if(!(t instanceof Dict))return shadow(this,"documentInfo",e);for(const i of t.getKeys()){const a=t.get(i);switch(i){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if("string"==typeof a){e[i]=stringToPDFString(a);continue}break;case"Trapped":if(a instanceof Name){e[i]=a;continue}break;default:let t;switch(typeof a){case"string":t=stringToPDFString(a);break;case"number":case"boolean":t=a;break;default:a instanceof Name&&(t=a)}if(void 0===t){warn(`Bad value, for custom key "${i}", in Info: ${a}.`);continue}e.Custom||(e.Custom=Object.create(null));e.Custom[i]=t;continue}warn(`Bad value, for key "${i}", in Info: ${a}.`)}return shadow(this,"documentInfo",e)}get fingerprints(){const e="\\0".repeat(16);function validate(t){return"string"==typeof t&&16===t.length&&t!==e}const t=this.xref.trailer.get("ID");let i,a;if(Array.isArray(t)&&validate(t[0])){i=stringToBytes(t[0]);t[1]!==t[0]&&validate(t[1])&&(a=stringToBytes(t[1]))}else i=$n(this.stream.getByteRange(0,1024),0,1024);return shadow(this,"fingerprints",[toHexUtil(i),a?toHexUtil(a):null])}async _getLinearizationPage(e){const{catalog:t,linearization:i,xref:a}=this,s=Ref.get(i.objectNumberFirst,0);try{const e=await a.fetchAsync(s);if(e instanceof Dict){let i=e.getRaw("Type");i instanceof Ref&&(i=await a.fetchAsync(i));if(isName(i,"Page")||!e.has("Type")&&!e.has("Kids")&&e.has("Contents")){t.pageKidsCountCache.has(s)||t.pageKidsCountCache.put(s,1);t.pageIndexCache.has(s)||t.pageIndexCache.put(s,0);return[e,s]}}throw new FormatError("The Linearization dictionary doesn\'t point to a valid Page dictionary.")}catch(i){warn(`_getLinearizationPage: "${i.message}".`);return t.getPageDict(e)}}getPage(e){const t=this._pagePromises.get(e);if(t)return t;const{catalog:i,linearization:a,xfaFactory:s}=this;let r;r=s?Promise.resolve([Dict.empty,null]):a?.pageFirst===e?this._getLinearizationPage(e):i.getPageDict(e);r=r.then((([t,a])=>new Page({pdfManager:this.pdfManager,xref:this.xref,pageIndex:e,pageDict:t,ref:a,globalIdFactory:this._globalIdFactory,fontCache:i.fontCache,builtInCMapCache:i.builtInCMapCache,standardFontDataCache:i.standardFontDataCache,globalImageCache:i.globalImageCache,systemFontCache:i.systemFontCache,nonBlendModesSet:i.nonBlendModesSet,xfaFactory:s})));this._pagePromises.set(e,r);return r}async checkFirstPage(e=!1){if(!e)try{await this.getPage(0)}catch(e){if(e instanceof XRefEntryException){this._pagePromises.delete(0);await this.cleanup();throw new XRefParseException}}}async checkLastPage(e=!1){const{catalog:t,pdfManager:i}=this;t.setActualNumPages();let a;try{await Promise.all([i.ensureDoc("xfaFactory"),i.ensureDoc("linearization"),i.ensureCatalog("numPages")]);if(this.xfaFactory)return;a=this.linearization?this.linearization.numPages:t.numPages;if(!Number.isInteger(a))throw new FormatError("Page count is not an integer.");if(a<=1)return;await this.getPage(a-1)}catch(s){this._pagePromises.delete(a-1);await this.cleanup();if(s instanceof XRefEntryException&&!e)throw new XRefParseException;warn(`checkLastPage - invalid /Pages tree /Count: ${a}.`);let r;try{r=await t.getAllPageDicts(e)}catch(i){if(i instanceof XRefEntryException&&!e)throw new XRefParseException;t.setActualNumPages(1);return}for(const[e,[a,s]]of r){let r;if(a instanceof Error){r=Promise.reject(a);r.catch((()=>{}))}else r=Promise.resolve(new Page({pdfManager:i,xref:this.xref,pageIndex:e,pageDict:a,ref:s,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:null}));this._pagePromises.set(e,r)}t.setActualNumPages(r.size)}}fontFallback(e,t){return this.catalog.fontFallback(e,t)}async cleanup(e=!1){return this.catalog?this.catalog.cleanup(e):clearGlobalCaches()}async#z(e,t,i,a,s,r,n){const{xref:g}=this;if(!(i instanceof Ref)||r.has(i))return;r.put(i);const o=await g.fetchAsync(i);if(!(o instanceof Dict))return;if(o.has("T")){const t=stringToPDFString(await o.getAsync("T"));e=""===e?t:`${e}.${t}`}else{let i=o;for(;;){i=i.getRaw("Parent")||t;if(i instanceof Ref){if(r.has(i))break;i=await g.fetchAsync(i)}if(!(i instanceof Dict))break;if(i.has("T")){const t=stringToPDFString(await i.getAsync("T"));e=""===e?t:`${e}.${t}`;break}}}t&&!o.has("Parent")&&isName(o.get("Subtype"),"Widget")&&n.put(i,t);a.has(e)||a.set(e,[]);a.get(e).push(AnnotationFactory.create(g,i,s,null,!0,n,null).then((e=>e?.getFieldObject())).catch((function(e){warn(`#collectFieldObjects: "${e}".`);return null})));if(!o.has("Kids"))return;const c=await o.getAsync("Kids");if(Array.isArray(c))for(const t of c)await this.#z(e,i,t,a,s,r,n)}get fieldObjects(){return shadow(this,"fieldObjects",this.pdfManager.ensureDoc("formInfo").then((async e=>{if(!e.hasFields)return null;const[t,i]=await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]);if(!t)return null;const a=new RefSet,s=Object.create(null),r=new Map,n=new RefSetCache;for(const e of await i.getAsync("Fields"))await this.#z("",null,e,r,t,a,n);const g=[];for(const[e,t]of r)g.push(Promise.all(t).then((t=>{(t=t.filter((e=>!!e))).length>0&&(s[e]=t)})));await Promise.all(g);return{allFields:s,orphanFields:n}})))}get hasJSActions(){return shadow(this,"hasJSActions",this.pdfManager.ensureDoc("_parseHasJSActions"))}async _parseHasJSActions(){const[e,t]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return!!e||!!t&&Object.values(t.allFields).some((e=>e.some((e=>null!==e.actions))))}get calculationOrderIds(){const e=this.catalog.acroForm?.get("CO");if(!Array.isArray(e)||0===e.length)return shadow(this,"calculationOrderIds",null);const t=[];for(const i of e)i instanceof Ref&&t.push(i.toString());return shadow(this,"calculationOrderIds",t.length?t:null)}get annotationGlobals(){return shadow(this,"annotationGlobals",AnnotationFactory.createGlobals(this.pdfManager))}}class BasePdfManager{constructor(e){this._docBaseUrl=function parseDocBaseUrl(e){if(e){const t=createValidAbsoluteUrl(e);if(t)return t.href;warn(`Invalid absolute docBaseUrl: "${e}".`)}return null}(e.docBaseUrl);this._docId=e.docId;this._password=e.password;this.enableXfa=e.enableXfa;e.evaluatorOptions.isOffscreenCanvasSupported&&=FeatureTest.isOffscreenCanvasSupported;e.evaluatorOptions.isImageDecoderSupported&&=FeatureTest.isImageDecoderSupported;this.evaluatorOptions=Object.freeze(e.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(e,t){return this.ensure(this.pdfDocument,e,t)}ensureXRef(e,t){return this.ensure(this.pdfDocument.xref,e,t)}ensureCatalog(e,t){return this.ensure(this.pdfDocument.catalog,e,t)}getPage(e){return this.pdfDocument.getPage(e)}fontFallback(e,t){return this.pdfDocument.fontFallback(e,t)}loadXfaFonts(e,t){return this.pdfDocument.loadXfaFonts(e,t)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(e){return this.pdfDocument.serializeXfaData(e)}cleanup(e=!1){return this.pdfDocument.cleanup(e)}async ensure(e,t,i){unreachable("Abstract method `ensure` called")}requestRange(e,t){unreachable("Abstract method `requestRange` called")}requestLoadedStream(e=!1){unreachable("Abstract method `requestLoadedStream` called")}sendProgressiveData(e){unreachable("Abstract method `sendProgressiveData` called")}updatePassword(e){this._password=e}terminate(e){unreachable("Abstract method `terminate` called")}}class LocalPdfManager extends BasePdfManager{constructor(e){super(e);const t=new Stream(e.source);this.pdfDocument=new PDFDocument(this,t);this._loadedStreamPromise=Promise.resolve(t)}async ensure(e,t,i){const a=e[t];return"function"==typeof a?a.apply(e,i):a}requestRange(e,t){return Promise.resolve()}requestLoadedStream(e=!1){return this._loadedStreamPromise}terminate(e){}}class NetworkPdfManager extends BasePdfManager{constructor(e){super(e);this.streamManager=new ChunkedStreamManager(e.source,{msgHandler:e.handler,length:e.length,disableAutoFetch:e.disableAutoFetch,rangeChunkSize:e.rangeChunkSize});this.pdfDocument=new PDFDocument(this,this.streamManager.getStream())}async ensure(e,t,i){try{const a=e[t];return"function"==typeof a?a.apply(e,i):a}catch(a){if(!(a instanceof MissingDataException))throw a;await this.requestRange(a.begin,a.end);return this.ensure(e,t,i)}}requestRange(e,t){return this.streamManager.requestRange(e,t)}requestLoadedStream(e=!1){return this.streamManager.requestAllChunks(e)}sendProgressiveData(e){this.streamManager.onReceiveData({chunk:e})}terminate(e){this.streamManager.abort(e)}}const rg=1,ng=2,gg=1,og=2,Ig=3,cg=4,Cg=5,hg=6,lg=7,Bg=8;function onFn(){}function wrapReason(e){if(e instanceof AbortException||e instanceof InvalidPDFException||e instanceof MissingPDFException||e instanceof PasswordException||e instanceof UnexpectedResponseException||e instanceof UnknownErrorException)return e;e instanceof Error||"object"==typeof e&&null!==e||unreachable(\'wrapReason: Expected "reason" to be a (possibly cloned) Error.\');switch(e.name){case"AbortException":return new AbortException(e.message);case"InvalidPDFException":return new InvalidPDFException(e.message);case"MissingPDFException":return new MissingPDFException(e.message);case"PasswordException":return new PasswordException(e.message,e.code);case"UnexpectedResponseException":return new UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new UnknownErrorException(e.message,e.details)}return new UnknownErrorException(e.message,e.toString())}class MessageHandler{#_=new AbortController;constructor(e,t,i){this.sourceName=e;this.targetName=t;this.comObj=i;this.callbackId=1;this.streamId=1;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);i.addEventListener("message",this.#$.bind(this),{signal:this.#_.signal})}#$({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#AA(e);return}if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error(`Cannot resolve callback ${t}`);delete this.callbackCapabilities[t];if(e.callback===rg)i.resolve(e.data);else{if(e.callback!==ng)throw new Error("Unexpected callback case");i.reject(wrapReason(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const i=this.sourceName,a=e.sourceName,s=this.comObj;Promise.try(t,e.data).then((function(t){s.postMessage({sourceName:i,targetName:a,callback:rg,callbackId:e.callbackId,data:t})}),(function(t){s.postMessage({sourceName:i,targetName:a,callback:ng,callbackId:e.callbackId,reason:wrapReason(t)})}))}else e.streamId?this.#eA(e):t(e.data)}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const a=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[a]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:a,data:t},i)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,i,a){const s=this.streamId++,r=this.sourceName,n=this.targetName,g=this.comObj;return new ReadableStream({start:i=>{const o=Promise.withResolvers();this.streamControllers[s]={controller:i,startCall:o,pullCall:null,cancelCall:null,isClosed:!1};g.postMessage({sourceName:r,targetName:n,action:e,streamId:s,data:t,desiredSize:i.desiredSize},a);return o.promise},pull:e=>{const t=Promise.withResolvers();this.streamControllers[s].pullCall=t;g.postMessage({sourceName:r,targetName:n,stream:hg,streamId:s,desiredSize:e.desiredSize});return t.promise},cancel:e=>{assert(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();this.streamControllers[s].cancelCall=t;this.streamControllers[s].isClosed=!0;g.postMessage({sourceName:r,targetName:n,stream:gg,streamId:s,reason:wrapReason(e)});return t.promise}},i)}#eA(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,r=this,n=this.actionHandler[e.action],g={enqueue(e,r=1,n){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=r;if(g>0&&this.desiredSize<=0){this.sinkCapability=Promise.withResolvers();this.ready=this.sinkCapability.promise}s.postMessage({sourceName:i,targetName:a,stream:cg,streamId:t,chunk:e},n)},close(){if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:Ig,streamId:t});delete r.streamSinks[t]}},error(e){assert(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:Cg,streamId:t,reason:wrapReason(e)})}},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};g.sinkCapability.resolve();g.ready=g.sinkCapability.promise;this.streamSinks[t]=g;Promise.try(n,e.data,g).then((function(){s.postMessage({sourceName:i,targetName:a,stream:Bg,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:Bg,streamId:t,reason:wrapReason(e)})}))}#AA(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,r=this.streamControllers[t],n=this.streamSinks[t];switch(e.stream){case Bg:e.success?r.startCall.resolve():r.startCall.reject(wrapReason(e.reason));break;case lg:e.success?r.pullCall.resolve():r.pullCall.reject(wrapReason(e.reason));break;case hg:if(!n){s.postMessage({sourceName:i,targetName:a,stream:lg,streamId:t,success:!0});break}n.desiredSize<=0&&e.desiredSize>0&&n.sinkCapability.resolve();n.desiredSize=e.desiredSize;Promise.try(n.onPull||onFn).then((function(){s.postMessage({sourceName:i,targetName:a,stream:lg,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:lg,streamId:t,reason:wrapReason(e)})}));break;case cg:assert(r,"enqueue should have stream controller");if(r.isClosed)break;r.controller.enqueue(e.chunk);break;case Ig:assert(r,"close should have stream controller");if(r.isClosed)break;r.isClosed=!0;r.controller.close();this.#tA(r,t);break;case Cg:assert(r,"error should have stream controller");r.controller.error(wrapReason(e.reason));this.#tA(r,t);break;case og:e.success?r.cancelCall.resolve():r.cancelCall.reject(wrapReason(e.reason));this.#tA(r,t);break;case gg:if(!n)break;const g=wrapReason(e.reason);Promise.try(n.onCancel||onFn,g).then((function(){s.postMessage({sourceName:i,targetName:a,stream:og,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:og,streamId:t,reason:wrapReason(e)})}));n.sinkCapability.reject(g);n.isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#tA(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]);delete this.streamControllers[t]}destroy(){this.#_?.abort();this.#_=null}}async function writeObject(e,t,i,{encrypt:a=null}){const s=a?.createCipherTransform(e.num,e.gen);i.push(`${e.num} ${e.gen} obj\\n`);t instanceof Dict?await writeDict(t,i,s):t instanceof BaseStream?await writeStream(t,i,s):(Array.isArray(t)||ArrayBuffer.isView(t))&&await writeArray(t,i,s);i.push("\\nendobj\\n")}async function writeDict(e,t,i){t.push("<<");for(const a of e.getKeys()){t.push(` /${escapePDFName(a)} `);await writeValue(e.getRaw(a),t,i)}t.push(">>")}async function writeStream(e,t,i){let a=e.getBytes();const{dict:s}=e,[r,n]=await Promise.all([s.getAsync("Filter"),s.getAsync("DecodeParms")]),g=isName(Array.isArray(r)?await s.xref.fetchIfRefAsync(r[0]):r,"FlateDecode");if(a.length>=256||g)try{const e=new CompressionStream("deflate"),t=e.writable.getWriter();await t.ready;t.write(a).then((async()=>{await t.ready;await t.close()})).catch((()=>{}));const i=await new Response(e.readable).arrayBuffer();a=new Uint8Array(i);let o,c;if(r){if(!g){o=Array.isArray(r)?[Name.get("FlateDecode"),...r]:[Name.get("FlateDecode"),r];n&&(c=Array.isArray(n)?[null,...n]:[null,n])}}else o=Name.get("FlateDecode");o&&s.set("Filter",o);c&&s.set("DecodeParms",c)}catch(e){info(`writeStream - cannot compress data: "${e}".`)}let o=bytesToString(a);i&&(o=i.encryptString(o));s.set("Length",o.length);await writeDict(s,t,i);t.push(" stream\\n",o,"\\nendstream")}async function writeArray(e,t,i){t.push("[");let a=!0;for(const s of e){a?a=!1:t.push(" ");await writeValue(s,t,i)}t.push("]")}async function writeValue(e,t,i){if(e instanceof Name)t.push(`/${escapePDFName(e.name)}`);else if(e instanceof Ref)t.push(`${e.num} ${e.gen} R`);else if(Array.isArray(e)||ArrayBuffer.isView(e))await writeArray(e,t,i);else if("string"==typeof e){i&&(e=i.encryptString(e));t.push(`(${escapeString(e)})`)}else"number"==typeof e?t.push(numberToString(e)):"boolean"==typeof e?t.push(e.toString()):e instanceof Dict?await writeDict(e,t,i):e instanceof BaseStream?await writeStream(e,t,i):null===e?t.push("null"):warn(`Unhandled value in writer: ${typeof e}, please file a bug.`)}function writeInt(e,t,i,a){for(let s=t+i-1;s>i-1;s--){a[s]=255&e;e>>=8}return i+t}function writeString(e,t,i){for(let a=0,s=e.length;a1&&(r=i.documentElement.searchNode([s.at(-1)],0));r?r.childNodes=Array.isArray(a)?a.map((e=>new SimpleDOMNode("value",e))):[new SimpleDOMNode("#text",a)]:warn(`Node not found for path: ${t}`)}const a=[];i.documentElement.dump(a);return a.join("")}(a.fetchIfRef(t).getString(),i)}const s=new StringStream(e);s.dict=new Dict(a);s.dict.set("Type",Name.get("EmbeddedFile"));i.put(t,{data:s})}function getIndexes(e){const t=[];for(const{ref:i}of e)i.num===t.at(-2)+t.at(-1)?t[t.length-1]+=1:t.push(i.num,1);return t}function computeIDs(e,t,i){if(Array.isArray(t.fileIds)&&t.fileIds.length>0){const a=function computeMD5(e,t){const i=Math.floor(Date.now()/1e3),a=t.filename||"",s=[i.toString(),a,e.toString()];let r=s.reduce(((e,t)=>e+t.length),0);for(const e of Object.values(t.info)){s.push(e);r+=e.length}const n=new Uint8Array(r);let g=0;for(const e of s){writeString(e,g,n);g+=e.length}return bytesToString($n(n))}(e,t);i.set("ID",[t.fileIds[0],a])}}async function incrementalUpdate({originalData:e,xrefInfo:t,changes:i,xref:a=null,hasXfa:s=!1,xfaDatasetsRef:r=null,hasXfaDatasetsEntry:n=!1,needAppearances:g,acroFormRef:o=null,acroForm:c=null,xfaData:C=null,useXrefStream:h=!1}){await async function updateAcroform({xref:e,acroForm:t,acroFormRef:i,hasXfa:a,hasXfaDatasetsEntry:s,xfaDatasetsRef:r,needAppearances:n,changes:g}){!a||s||r||warn("XFA - Cannot save it");if(!n&&(!a||!r||s))return;const o=t.clone();if(a&&!s){const e=t.get("XFA").slice();e.splice(2,0,"datasets");e.splice(3,0,r);o.set("XFA",e)}n&&o.set("NeedAppearances",!0);g.put(i,{data:o})}({xref:a,acroForm:c,acroFormRef:o,hasXfa:s,hasXfaDatasetsEntry:n,xfaDatasetsRef:r,needAppearances:g,changes:i});s&&updateXFA({xfaData:C,xfaDatasetsRef:r,changes:i,xref:a});const l=function getTrailerDict(e,t,i){const a=new Dict(null);a.set("Prev",e.startXRef);const s=e.newRef;if(i){t.put(s,{data:""});a.set("Size",s.num+1);a.set("Type",Name.get("XRef"))}else a.set("Size",s.num);null!==e.rootRef&&a.set("Root",e.rootRef);null!==e.infoRef&&a.set("Info",e.infoRef);null!==e.encryptRef&&a.set("Encrypt",e.encryptRef);return a}(t,i,h),Q=[],E=await async function writeChanges(e,t,i=[]){const a=[];for(const[s,{data:r}]of e.items())if(null!==r&&"string"!=typeof r){await writeObject(s,r,i,t);a.push({ref:s,data:i.join("")});i.length=0}else a.push({ref:s,data:r});return a.sort(((e,t)=>e.ref.num-t.ref.num))}(i,a,Q);let u=e.length;const d=e.at(-1);if(10!==d&&13!==d){Q.push("\\n");u+=1}for(const{data:e}of E)null!==e&&Q.push(e);await(h?async function getXRefStreamTable(e,t,i,a,s){const r=[];let n=0,g=0;for(const{ref:e,data:a}of i){let i;n=Math.max(n,t);if(null!==a){i=Math.min(e.gen,65535);r.push([1,t,i]);t+=a.length}else{i=Math.min(e.gen+1,65535);r.push([0,0,i])}g=Math.max(g,i)}a.set("Index",getIndexes(i));const o=[1,getSizeInBytes(n),getSizeInBytes(g)];a.set("W",o);computeIDs(t,e,a);const c=o.reduce(((e,t)=>e+t),0),C=new Uint8Array(c*r.length),h=new Stream(C);h.dict=a;let l=0;for(const[e,t,i]of r){l=writeInt(e,o[0],l,C);l=writeInt(t,o[1],l,C);l=writeInt(i,o[2],l,C)}await writeObject(e.newRef,h,s,{});s.push("startxref\\n",t.toString(),"\\n%%EOF\\n")}(t,u,E,l,Q):async function getXRefTable(e,t,i,a,s){s.push("xref\\n");const r=getIndexes(i);let n=0;for(const{ref:e,data:a}of i){if(e.num===r[n]){s.push(`${r[n]} ${r[n+1]}\\n`);n+=2}if(null!==a){s.push(`${t.toString().padStart(10,"0")} ${Math.min(e.gen,65535).toString().padStart(5,"0")} n\\r\\n`);t+=a.length}else s.push(`0000000000 ${Math.min(e.gen+1,65535).toString().padStart(5,"0")} f\\r\\n`)}computeIDs(t,e,a);s.push("trailer\\n");await writeDict(a,s);s.push("\\nstartxref\\n",t.toString(),"\\n%%EOF\\n")}(t,u,E,l,Q));const f=Q.reduce(((e,t)=>e+t.length),e.length),p=new Uint8Array(f);p.set(e);let m=e.length;for(const e of Q){writeString(e,m,p);m+=e.length}return p}class PDFWorkerStream{constructor(e){this._msgHandler=e;this._contentLength=null;this._fullRequestReader=null;this._rangeRequestReaders=[]}getFullReader(){assert(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once.");this._fullRequestReader=new PDFWorkerStreamReader(this._msgHandler);return this._fullRequestReader}getRangeReader(e,t){const i=new PDFWorkerStreamRangeReader(e,t,this._msgHandler);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class PDFWorkerStreamReader{constructor(e){this._msgHandler=e;this.onProgress=null;this._contentLength=null;this._isRangeSupported=!1;this._isStreamingSupported=!1;const t=this._msgHandler.sendWithStream("GetReader");this._reader=t.getReader();this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then((e=>{this._isStreamingSupported=e.isStreamingSupported;this._isRangeSupported=e.isRangeSupported;this._contentLength=e.contentLength}))}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class PDFWorkerStreamRangeReader{constructor(e,t,i){this._msgHandler=i;this.onProgress=null;const a=this._msgHandler.sendWithStream("GetRangeReader",{begin:e,end:t});this._reader=a.getReader()}get isStreamingSupported(){return!1}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class WorkerTask{constructor(e){this.name=e;this.terminated=!1;this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class WorkerMessageHandler{static{"undefined"==typeof window&&!t&&"undefined"!=typeof self&&"function"==typeof self.postMessage&&"onmessage"in self&&this.initializeFromPort(self)}static setup(e,t){let i=!1;e.on("test",(t=>{if(!i){i=!0;e.send("test",t instanceof Uint8Array)}}));e.on("configure",(e=>{!function setVerbosityLevel(e){Number.isInteger(e)&&(gt=e)}(e.verbosity)}));e.on("GetDocRequest",(e=>this.createDocumentHandler(e,t)))}static createDocumentHandler(e,t){let i,a=!1,s=null;const r=new Set,n=getVerbosityLevel(),{docId:g,apiVersion:o}=e,c="4.10.45";if(o!==c)throw new Error(`The API version "${o}" does not match the Worker version "${c}".`);const C=[];for(const e in[])C.push(e);if(C.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+C.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const h=g+"_worker";let l=new MessageHandler(h,g,t);function ensureNotTerminated(){if(a)throw new Error("Worker was terminated")}function startWorkerTask(e){r.add(e)}function finishWorkerTask(e){e.finish();r.delete(e)}async function loadDocument(e){await i.ensureDoc("checkHeader");await i.ensureDoc("parseStartXRef");await i.ensureDoc("parse",[e]);await i.ensureDoc("checkFirstPage",[e]);await i.ensureDoc("checkLastPage",[e]);const t=await i.ensureDoc("isPureXfa");if(t){const e=new WorkerTask("loadXfaFonts");startWorkerTask(e);await Promise.all([i.loadXfaFonts(l,e).catch((e=>{})).then((()=>finishWorkerTask(e))),i.loadXfaImages()])}const[a,s]=await Promise.all([i.ensureDoc("numPages"),i.ensureDoc("fingerprints")]);return{numPages:a,fingerprints:s,htmlForXfa:t?await i.ensureDoc("htmlForXfa"):null}}function setupDoc(e){function onSuccess(e){ensureNotTerminated();l.send("GetDoc",{pdfInfo:e})}function onFailure(e){ensureNotTerminated();if(e instanceof PasswordException){const t=new WorkerTask(`PasswordException: response ${e.code}`);startWorkerTask(t);l.sendWithPromise("PasswordRequest",e).then((function({password:e}){finishWorkerTask(t);i.updatePassword(e);pdfManagerReady()})).catch((function(){finishWorkerTask(t);l.send("DocException",e)}))}else l.send("DocException",wrapReason(e))}function pdfManagerReady(){ensureNotTerminated();loadDocument(!1).then(onSuccess,(function(e){ensureNotTerminated();e instanceof XRefParseException?i.requestLoadedStream().then((function(){ensureNotTerminated();loadDocument(!0).then(onSuccess,onFailure)})):onFailure(e)}))}ensureNotTerminated();(async function getPdfManager({data:e,password:t,disableAutoFetch:i,rangeChunkSize:a,length:r,docBaseUrl:n,enableXfa:o,evaluatorOptions:c}){const C={source:null,disableAutoFetch:i,docBaseUrl:n,docId:g,enableXfa:o,evaluatorOptions:c,handler:l,length:r,password:t,rangeChunkSize:a};if(e){C.source=e;return new LocalPdfManager(C)}const h=new PDFWorkerStream(l),Q=h.getFullReader(),E=Promise.withResolvers();let u,d=[],f=0;Q.headersReady.then((function(){if(Q.isRangeSupported){C.source=h;C.length=Q.contentLength;C.disableAutoFetch||=Q.isStreamingSupported;u=new NetworkPdfManager(C);for(const e of d)u.sendProgressiveData(e);d=[];E.resolve(u);s=null}})).catch((function(e){E.reject(e);s=null}));new Promise((function(e,t){const readChunk=function({value:e,done:i}){try{ensureNotTerminated();if(i){if(!u){const e=arrayBuffersToBytes(d);d=[];r&&e.length!==r&&warn("reported HTTP length is different from actual");C.source=e;u=new LocalPdfManager(C);E.resolve(u)}s=null;return}f+=e.byteLength;Q.isStreamingSupported||l.send("DocProgress",{loaded:f,total:Math.max(f,Q.contentLength||0)});u?u.sendProgressiveData(e):d.push(e);Q.read().then(readChunk,t)}catch(e){t(e)}};Q.read().then(readChunk,t)})).catch((function(e){E.reject(e);s=null}));s=e=>{h.cancelAllRequests(e)};return E.promise})(e).then((function(e){if(a){e.terminate(new AbortException("Worker was terminated."));throw new Error("Worker was terminated")}i=e;i.requestLoadedStream(!0).then((e=>{l.send("DataLoaded",{length:e.bytes.byteLength})}))})).then(pdfManagerReady,onFailure)}l.on("GetPage",(function(e){return i.getPage(e.pageIndex).then((function(e){return Promise.all([i.ensure(e,"rotate"),i.ensure(e,"ref"),i.ensure(e,"userUnit"),i.ensure(e,"view")]).then((function([e,t,i,a]){return{rotate:e,ref:t,refStr:t?.toString()??null,userUnit:i,view:a}}))}))}));l.on("GetPageIndex",(function(e){const t=Ref.get(e.num,e.gen);return i.ensureCatalog("getPageIndex",[t])}));l.on("GetDestinations",(function(e){return i.ensureCatalog("destinations")}));l.on("GetDestination",(function(e){return i.ensureCatalog("getDestination",[e.id])}));l.on("GetPageLabels",(function(e){return i.ensureCatalog("pageLabels")}));l.on("GetPageLayout",(function(e){return i.ensureCatalog("pageLayout")}));l.on("GetPageMode",(function(e){return i.ensureCatalog("pageMode")}));l.on("GetViewerPreferences",(function(e){return i.ensureCatalog("viewerPreferences")}));l.on("GetOpenAction",(function(e){return i.ensureCatalog("openAction")}));l.on("GetAttachments",(function(e){return i.ensureCatalog("attachments")}));l.on("GetDocJSActions",(function(e){return i.ensureCatalog("jsActions")}));l.on("GetPageJSActions",(function({pageIndex:e}){return i.getPage(e).then((function(e){return i.ensure(e,"jsActions")}))}));l.on("GetOutline",(function(e){return i.ensureCatalog("documentOutline")}));l.on("GetOptionalContentConfig",(function(e){return i.ensureCatalog("optionalContentConfig")}));l.on("GetPermissions",(function(e){return i.ensureCatalog("permissions")}));l.on("GetMetadata",(function(e){return Promise.all([i.ensureDoc("documentInfo"),i.ensureCatalog("metadata")])}));l.on("GetMarkInfo",(function(e){return i.ensureCatalog("markInfo")}));l.on("GetData",(function(e){return i.requestLoadedStream().then((function(e){return e.bytes}))}));l.on("GetAnnotations",(function({pageIndex:e,intent:t}){return i.getPage(e).then((function(i){const a=new WorkerTask(`GetAnnotations: page ${e}`);startWorkerTask(a);return i.getAnnotationsData(l,a,t).then((e=>{finishWorkerTask(a);return e}),(e=>{finishWorkerTask(a);throw e}))}))}));l.on("GetFieldObjects",(function(e){return i.ensureDoc("fieldObjects").then((e=>e?.allFields||null))}));l.on("HasJSActions",(function(e){return i.ensureDoc("hasJSActions")}));l.on("GetCalculationOrderIds",(function(e){return i.ensureDoc("calculationOrderIds")}));l.on("SaveDocument",(async function({isPureXfa:e,numPages:t,annotationStorage:a,filename:s}){const r=[i.requestLoadedStream(),i.ensureCatalog("acroForm"),i.ensureCatalog("acroFormRef"),i.ensureDoc("startXRef"),i.ensureDoc("xref"),i.ensureDoc("linearization"),i.ensureCatalog("structTreeRoot")],n=new RefSetCache,g=[],o=e?null:getNewAnnotationsMap(a),[c,C,h,Q,E,u,d]=await Promise.all(r),f=E.trailer.getRaw("Root")||null;let p;if(o){d?await d.canUpdateStructTree({pdfManager:i,xref:E,newAnnotationsByPage:o})&&(p=d):await StructTreeRoot.canCreateStructureTree({catalogRef:f,pdfManager:i,newAnnotationsByPage:o})&&(p=null);const e=AnnotationFactory.generateImages(a.values(),E,i.evaluatorOptions.isOffscreenCanvasSupported),t=void 0===p?g:[];for(const[a,s]of o)t.push(i.getPage(a).then((t=>{const i=new WorkerTask(`Save (editor): page ${a}`);startWorkerTask(i);return t.saveNewAnnotations(l,i,s,e,n).finally((function(){finishWorkerTask(i)}))})));null===p?g.push(Promise.all(t).then((async()=>{await StructTreeRoot.createStructureTree({newAnnotationsByPage:o,xref:E,catalogRef:f,pdfManager:i,changes:n})}))):p&&g.push(Promise.all(t).then((async()=>{await p.updateStructureTree({newAnnotationsByPage:o,pdfManager:i,changes:n})})))}if(e)g.push(i.serializeXfaData(a));else for(let e=0;ee.needAppearances)),D=C instanceof Dict&&C.get("XFA")||null;let b=null,F=!1;if(Array.isArray(D)){for(let e=0,t=D.length;e{E.resetNewTemporaryRef()}))}));l.on("GetOperatorList",(function(e,t){const a=e.pageIndex;i.getPage(a).then((function(i){const s=new WorkerTask(`GetOperatorList: page ${a}`);startWorkerTask(s);const r=n>=yA?Date.now():0;i.getOperatorList({handler:l,sink:t,task:s,intent:e.intent,cacheKey:e.cacheKey,annotationStorage:e.annotationStorage,modifiedIds:e.modifiedIds}).then((function(e){finishWorkerTask(s);r&&info(`page=${a+1} - getOperatorList: time=${Date.now()-r}ms, len=${e.length}`);t.close()}),(function(e){finishWorkerTask(s);s.terminated||t.error(e)}))}))}));l.on("GetTextContent",(function(e,t){const{pageIndex:a,includeMarkedContent:s,disableNormalization:r}=e;i.getPage(a).then((function(e){const i=new WorkerTask("GetTextContent: page "+a);startWorkerTask(i);const g=n>=yA?Date.now():0;e.extractTextContent({handler:l,task:i,sink:t,includeMarkedContent:s,disableNormalization:r}).then((function(){finishWorkerTask(i);g&&info(`page=${a+1} - getTextContent: time=`+(Date.now()-g)+"ms");t.close()}),(function(e){finishWorkerTask(i);i.terminated||t.error(e)}))}))}));l.on("GetStructTree",(function(e){return i.getPage(e.pageIndex).then((function(e){return i.ensure(e,"getStructTree")}))}));l.on("FontFallback",(function(e){return i.fontFallback(e.id,l)}));l.on("Cleanup",(function(e){return i.cleanup(!0)}));l.on("Terminate",(function(e){a=!0;const t=[];if(i){i.terminate(new AbortException("Worker was terminated."));const e=i.cleanup();t.push(e);i=null}else clearGlobalCaches();s?.(new AbortException("Worker was terminated."));for(const e of r){t.push(e.finished);e.terminate()}return Promise.all(t).then((function(){l.destroy();l=null}))}));l.on("Ready",(function(t){setupDoc(e);e=null}));return h}static initializeFromPort(e){const t=new MessageHandler("worker","main",e);this.setup(t,e);t.send("ready",null)}}var Qg=__webpack_exports__.WorkerMessageHandler;export{Qg as WorkerMessageHandler};'],{type:"text/javascript"}),t=new Worker(URL.createObjectURL(e),{type:"module"}),i=new sC("main","worker",t),n=()=>{s.abort(),i.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=new AbortController;t.addEventListener("error",(()=>{this._webWorker||n()}),{signal:s.signal}),i.on("test",(e=>{s.abort(),!this.destroyed&&e?(this._messageHandler=i,this._port=t,this._webWorker=t,this.#Me()):n()})),i.on("ready",(e=>{if(s.abort(),this.destroyed)n();else try{a()}catch{this._setupFakeWorker()}}));const a=()=>{const e=new Uint8Array;i.send("test",e,[e.buffer])};return void a()}catch{Cf("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){Dp.#Fe||(pf("Setting up fake worker."),Dp.#Fe=!0),Dp._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new vp;this._port=t;const i="fake"+Dp.#xe++,n=new sC(i+"_worker",i,t);e.setup(n,t),this._messageHandler=new sC(i,i+"_worker",t),this.#Me()})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker?.terminate(),this._webWorker=null,Dp.#Re?.delete(this._port),this._port=null,this._messageHandler?.destroy(),this._messageHandler=null}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const t=this.#Re?.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Dp(e)}static get workerSrc(){if(TC.workerSrc)return TC.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#Ne(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return Qf(this,"_setupFakeWorkerGlobal",(async()=>this.#Ne?this.#Ne:(await import(this.workerSrc)).WorkerMessageHandler)())}}class xp{#Ge=new Map;#Ue=new Map;#Le=new Map;#Te=new Map;#He=null;constructor(e,t,i,n,s){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Rp,this.fontLoader=new Hf({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#Oe(e,t=null){const i=this.#Ge.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise(e,t);return this.#Ge.set(e,n),n}get annotationStorage(){return Qf(this,"annotationStorage",{})}getRenderingIntent(e,t=1,i=null,n=!1,s=!1){let a=2,r={};switch(e){case"any":a=1;break;case"display":break;case"print":a=4;break;default:pf(`getRenderingIntent - invalid intent: ${e}`)}const o={};switch(t){case 0:a+=64;break;case 1:break;case 2:a+=16;break;case 3:a+=32,r=o.serializable;break;default:pf(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(a+=128),s&&(a+=256);const{ids:A,hash:c}={modifiedIds:0,modifiedIdsHash:0};return{renderingIntent:a,cacheKey:[a,r.hash,c].join("_"),annotationStorageSerializable:r,modifiedIds:A}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#He?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#Ue.values())e.push(t._destroy());this.#Ue.clear(),this.#Le.clear(),this.#Te.clear();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#Ge.clear(),this.filterFactory.destroy(),fp.cleanup(),this._networkStream?.cancelAllRequests(new Df("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{Bf(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:i}){i?t.close():(Bf(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(async e=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:s}=this._fullReader;return i&&n||(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:s}})),e.on("GetRangeReader",((e,t)=>{Bf(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(e.begin,e.end);i?(t.onPull=()=>{i.read().then((function({value:e,done:i}){i?t.close():(Bf(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{i.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new kp(e,this))})),e.on("DocException",(e=>{t._capability.reject(nC(e))})),e.on("PasswordRequest",(e=>{this.#He=Promise.withResolvers();try{if(!t.onPassword)throw nC(e);const i=e=>{e instanceof Error?this.#He.reject(e):this.#He.resolve({password:e})};t.onPassword(i,e.code)}catch(e){this.#He.reject(e)}return this.#He.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#Ue.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,i,n])=>{if(this.destroyed)return null;if(this.commonObjs.has(t))return null;switch(i){case"Font":const{disableFontFace:s,fontExtraProperties:a,pdfBug:r}=this._params;if("error"in n){const e=n.error;pf(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const o=r&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,A=new Of(n,{disableFontFace:s,fontExtraProperties:a,inspectFont:o});this.fontLoader.bind(A).catch((()=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!a&&A.data&&(A.data=null),this.commonObjs.resolve(t,A)}));break;case"CopyLocalImage":const{imageRef:c}=n;Bf(c,"The imageRef must be defined.");for(const e of this.#Ue.values())for(const[,i]of e.objs)if(i?.ref===c)return i.dataLen?(this.commonObjs.resolve(t,structuredClone(i)),i.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null})),e.on("obj",(([e,t,i,n])=>{if(this.destroyed)return;const s=this.#Ue.get(t);if(!s.objs.has(e))if(0!==s._intentStates.size)switch(i){case"Image":s.objs.resolve(e,n),n?.dataLen>1e7&&(s._maybeCleanupAfterRender=!0);break;case"Pattern":s.objs.resolve(e,n);break;default:throw new Error(`Got unknown object type ${i}`)}else n?.bitmap?.close()})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("FetchBuiltInCMap",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(e)})),e.on("FetchStandardFontData",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(e)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&pf("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,i=this.#Le.get(t);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&this.#Te.set(i.refStr,e);const n=new Sp(t,i,this,this._params.pdfBug);return this.#Ue.set(t,n),n}));return this.#Le.set(t,n),n}getPageIndex(e){return bp(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#Oe("GetFieldObjects")}hasJSActions(){return this.#Oe("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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)}getDocJSActions(){return this.#Oe("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#Oe("GetOptionalContentConfig").then((t=>new VC(t,e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=this.#Ge.get(e);if(t)return t;const i=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new HC(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#Ge.set(e,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#Ue.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#Ge.clear(),this.filterFactory.destroy(!0),fp.cleanup()}}cachedPageNumber(e){if(!bp(e))return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#Te.get(t)??null}}const Fp=Symbol("INITIAL_DATA");class Rp{#qe=Object.create(null);#Je(e){return this.#qe[e]||={...Promise.withResolvers(),data:Fp}}get(e,t=null){if(t){const i=this.#Je(e);return i.promise.then((()=>t(i.data))),null}const i=this.#qe[e];if(!i||i.data===Fp)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){const t=this.#qe[e];return!!t&&t.data!==Fp}delete(e){const t=this.#qe[e];return!(!t||t.data===Fp)&&(delete this.#qe[e],!0)}resolve(e,t=null){const i=this.#Je(e);i.data=t,i.resolve()}clear(){for(const e in this.#qe){const{data:t}=this.#qe[e];t?.bitmap?.close()}this.#qe=Object.create(null)}*[Symbol.iterator](){for(const e in this.#qe){const{data:t}=this.#qe[e];t!==Fp&&(yield[e,t])}}}class Mp{#Pe=null;constructor(e){this.#Pe=e,this.onContinue=null}get promise(){return this.#Pe.capability.promise}cancel(e=0){this.#Pe.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#Pe.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#Pe;return e.form||e.canvas&&t?.size>0}}class Np{#Ye=null;static#Ke=new WeakSet;constructor({callback:e,params:t,objs:i,commonObjs:n,annotationCanvasMap:s,operatorList:a,pageIndex:r,canvasFactory:o,filterFactory:A,useRequestAnimationFrame:c=!1,pdfBug:l=!1,pageColors:g=null}){this.callback=e,this.params=t,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=r,this.canvasFactory=o,this.filterFactory=A,this._pdfBug=l,this.pageColors=g,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Mp(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.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(Np.#Ke.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Np.#Ke.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());const{canvasContext:i,viewport:n,transform:s,background:a}=this.params;this.gfx=new LC(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#Ye&&(window.cancelAnimationFrame(this.#Ye),this.#Ye=null),Np.#Ke.delete(this._canvas),this.callback(e||new Kf(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){this.graphicsReady?(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.#Ye=window.requestAnimationFrame((()=>{this.#Ye=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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),Np.#Ke.delete(this._canvas),this.callback())))}}function Gp(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function Up(e){return Math.max(0,Math.min(255,255*e))}class Lp{static CMYK_G([e,t,i,n]){return["G",1-Math.min(1,.3*e+.59*i+.11*t+n)]}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=Up(e),e,e]}static G_HTML([e]){const t=Gp(e);return`#${t}${t}${t}`}static RGB_G([e,t,i]){return["G",.3*e+.59*t+.11*i]}static RGB_rgb(e){return e.map(Up)}static RGB_HTML(e){return`#${e.map(Gp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,i,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,i+n),1-Math.min(1,t+n)]}static CMYK_rgb([e,t,i,n]){return[Up(1-Math.min(1,e+n)),Up(1-Math.min(1,i+n)),Up(1-Math.min(1,t+n))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,i]){const n=1-e,s=1-t,a=1-i;return["CMYK",n,s,a,Math.min(n,s,a)]}}class Tp{create(e,t,i=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),n}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){mf("Abstract method `_createSVG` called.")}}class Hp extends Tp{_createSVG(e){return document.createElementNS(qf,e)}}class Op{static setupStorage(e,t,i,n,s){const a=n.getValue(t,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(e.textContent=a.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(a.value===i.attributes.xfaOn?e.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&e.removeAttribute("checked"),"print"===s)break;e.addEventListener("change",(e=>{n.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==a.value&&e.setAttribute("value",a.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==a.value){e.setAttribute("value",a.value);for(const e of i.children)e.attributes.value===a.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(e=>{const i=e.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(t,{value:s})}))}}static setAttributes({html:e,element:t,storage:i=null,intent:n,linkService:s}){const{attributes:a}=t,r=e instanceof HTMLAnchorElement;"radio"===a.type&&(a.name=`${a.name}-${n}`);for(const[t,i]of Object.entries(a))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!r||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}r&&s.addLinkAttributes(e,a.href,a.newWindow),i&&a.dataId&&this.setupStorage(e,a.dataId,t,i)}static render(e){const t=e.annotationStorage,i=e.linkService,n=e.xfaHtml,s=e.intent||"display",a=document.createElement(n.name);n.attributes&&this.setAttributes({html:a,element:n,intent:s,linkService:i});const r="richText"!==s,o=e.div;if(o.append(a),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;o.style.transform=t}r&&o.setAttribute("class","xfaLayer xfaFont");const A=[];if(0===n.children.length){if(n.value){const e=document.createTextNode(n.value);a.append(e),r&&Cp.shouldBuildText(n.name)&&A.push(e)}return{textDivs:A}}const c=[[n,-1,a]];for(;c.length>0;){const[e,n,a]=c.at(-1);if(n+1===e.children.length){c.pop();continue}const o=e.children[++c.at(-1)[1]];if(null===o)continue;const{name:l}=o;if("#text"===l){const e=document.createTextNode(o.value);A.push(e),a.append(e);continue}const g=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,l):document.createElement(l);if(a.append(g),o.attributes&&this.setAttributes({html:g,element:o,storage:t,intent:s,linkService:i}),o.children?.length>0)c.push([o,-1,g]);else if(o.value){const e=document.createTextNode(o.value);r&&Cp.shouldBuildText(l)&&A.push(e),g.append(e)}}for(const e of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:A}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const qp=1e3,Jp=new WeakSet;function Pp(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class Yp{static create(e){switch(e.data.annotationType){case 2:return new Vp(e);case 1:return new Wp(e);case 20:switch(e.data.fieldType){case"Tx":return new _p(e);case"Btn":return e.data.radioButton?new zp(e):e.data.checkBox?new Zp(e):new $p(e);case"Ch":return new em(e);case"Sig":return new Xp(e)}return new jp(e);case 16:return new tm(e);case 3:return new nm(e);case 4:return new sm(e);case 5:return new am(e);case 6:return new rm(e);case 8:return new om(e);case 14:return new cm(e);case 15:return new lm(e);case 7:return new Am(e);case 9:return new gm(e);case 10:return new hm(e);case 11:return new dm(e);case 12:return new um(e);case 13:return new Im(e);case 17:return new fm(e);default:return new Kp(e)}}}class Kp{#Ve=null;#We=!1;#je=null;constructor(e,{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!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.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:i}){return!!(e?.str||t?.str||i?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Kp._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;this.#Ve||={rect:this.data.rect.slice(0)};const{rect:t}=e;t&&this.#_e(t),this.#je?.popup.updateEdited(e)}resetEdited(){this.#Ve&&(this.#_e(this.#Ve.rect),this.#je?.popup.resetEdited(),this.#Ve=null)}#_e(e){const{container:{style:t},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:r,pageY:o}}}}=this;i?.splice(0,4,...e);const{width:A,height:c}=Pp(e);t.left=100*(e[0]-r)/s+"%",t.top=100*(a-e[3]+o)/a+"%",0===n?(t.width=100*A/s+"%",t.height=100*c/a+"%"):this.setRotation(n)}_createContainer(e){const{data:t,parent:{page:i,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",t.id),this instanceof jp||(s.tabIndex=qp);const{style:a}=s;if(a.zIndex=this.parent.zIndex++,t.alternativeText&&(s.title=t.alternativeText),t.noRotate&&s.classList.add("norotate"),!t.rect||this instanceof tm){const{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,s),s}const{width:r,height:o}=Pp(t.rect);if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;a.borderRadius=t}else if(this instanceof zp){const e=`calc(${r}px * var(--scale-factor)) / calc(${o}px * var(--scale-factor))`;a.borderRadius=e}switch(t.borderStyle.style){case 1:a.borderStyle="solid";break;case 2:a.borderStyle="dashed";break;case 3:pf("Unimplemented border style: beveled");break;case 4:pf("Unimplemented border style: inset");break;case 5:a.borderBottomStyle="solid"}const n=t.borderColor||null;n?(this.#We=!0,a.borderColor=Nf.makeHexColor(0|n[0],0|n[1],0|n[2])):a.borderWidth=0}const A=Nf.normalizeRect([t.rect[0],i.view[3]-t.rect[1]+i.view[1],t.rect[2],i.view[3]-t.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:l,pageX:g,pageY:h}=n.rawDims;a.left=100*(A[0]-g)/c+"%",a.top=100*(A[1]-h)/l+"%";const{rotation:d}=t;return t.hasOwnCanvas||0===d?(a.width=100*r/c+"%",a.height=100*o/l+"%"):this.setRotation(d,s),s}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims,{width:s,height:a}=Pp(this.data.rect);let r,o;e%180==0?(r=100*s/i,o=100*a/n):(r=100*a/i,o=100*s/n),t.style.width=`${r}%`,t.style.height=`${o}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,i)=>{const n=i.detail[e],s=n[0],a=n.slice(1);i.target.style[t]=Lp[`${s}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:Lp[`${s}_rgb`](a)})};return Qf(this,"_commonActions",{display:e=>{const{display:t}=e.detail,i=t%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{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=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const i=this._commonActions;for(const n of Object.keys(t.detail)){const s=e[n]||i[n];s?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const i=this._commonActions;for(const[n,s]of Object.entries(t)){const a=i[n];a&&(a({detail:{[n]:s},target:e}),delete t[n])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,i,n,s]=this.data.rect.map((e=>Math.fround(e)));if(8===e.length){const[a,r,o,A]=e.subarray(2,6);if(n===a&&s===r&&t===o&&i===A)return}const{style:a}=this.container;let r;if(this.#We){const{borderColor:e,borderWidth:t}=a;a.borderWidth=0,r=["url('data:image/svg+xml;utf8,",'',``],this.container.classList.add("hasBorder")}const o=n-t,A=s-i,{svgFactory:c}=this,l=c.createElement("svg");l.classList.add("quadrilateralsContainer"),l.setAttribute("width",0),l.setAttribute("height",0);const g=c.createElement("defs");l.append(g);const h=c.createElement("clipPath"),d=`clippath_${this.data.id}`;h.setAttribute("id",d),h.setAttribute("clipPathUnits","objectBoundingBox"),g.append(h);for(let i=2,n=e.length;i`)}this.#We&&(r.push("')"),a.backgroundImage=r.join("")),this.container.append(l),this.container.style.clipPath=`url(#${d})`}_createPopup(){const{data:e}=this,t=this.#je=new tm({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(t.render())}render(){mf("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const i=[];if(this._fieldObjects){const n=this._fieldObjects[e];if(n)for(const{page:e,id:s,exportValues:a}of n){if(-1===e)continue;if(s===t)continue;const n="string"==typeof a?a:null,r=document.querySelector(`[data-element-id="${s}"]`);!r||Jp.has(r)?i.push({id:s,exportValue:n,domElement:r}):pf(`_getElementsByName - element not allowed: ${s}`)}return i}for(const n of document.getElementsByName(e)){const{exportValue:e}=n,s=n.getAttribute("data-element-id");s!==t&&Jp.has(n)&&i.push({id:s,exportValue:e,domElement:n})}return i}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(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})}))}}class Vp extends Kp{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(t.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(this.#Xe(i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(this.#Ze(i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}#ze(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#ze()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#ze()}#Xe(e,t,i=null){e.href=this.linkService.getAnchorUrl(""),t.description&&(e.title=t.description),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,i),!1),this.#ze()}#Ze(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#ze()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const s=i.get(n);s&&(e[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1))}e.onclick||(e.onclick=()=>!1),this.#ze()}_bindResetFormAction(e,t){const i=e.onclick;i||(e.href=this.linkService.getAnchorUrl("")),this.#ze(),this._fieldObjects?e.onclick=()=>{i?.();const{fields:e,refs:n,include:s}=t,a=[];if(0!==e.length||0!==n.length){const t=new Set(n);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===s&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const r=this.annotationStorage,o=[];for(const e of a){const{id:t}=e;switch(o.push(t),e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(Jp.has(i)?i.dispatchEvent(new Event("resetform")):pf(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}:(pf('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1))}}class Wp extends Kp{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const 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._createPopup(),this.container.append(e),this.container}}class jp extends Kp{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&("CANVAS"===e.previousSibling?.nodeName&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Rf.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,i,n,s){i.includes("mouse")?e.addEventListener(i,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(i,(e=>{if("blur"===i){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===i){if(t.focused)return;t.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(e)}})}))}_setEventListeners(e,t,i,n){for(const[s,a]of i)("Action"===a||this.data.actions?.[a])&&("Focus"!==a&&"Blur"!==a||(t||={focused:!1}),this._setEventListener(e,t,s,a,n),"Focus"!==a||this.data.actions?.Blur?"Blur"!==a||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":Nf.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const{fontColor:t}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,n=e.style;let s;const a=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(df*i))||1);s=Math.min(i,a(t/df))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);s=Math.min(i,a(e/df))}n.fontSize=`calc(${s}px * var(--scale-factor))`,n.color=Nf.makeHexColor(t[0],t[1],t[2]),null!==this.data.textAlignment&&(n.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class _p extends jp{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,i,n){const s=this.annotationStorage;for(const a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=i),s.setValue(a.id,{[n]:i})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const n=e.getValue(t,{value:this.data.fieldValue});let s=n.value||"";const a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&s.length>a&&(s=s.slice(0,a));let r=n.formattedValue||this.data.textContent?.join("\n")||null;r&&this.data.comb&&(r=r.replaceAll(/\s+/g,""));const o={userValue:s,formattedValue:r,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=r??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",r??s),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),Jp.add(i),i.setAttribute("data-element-id",t),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=qp,this._setRequired(i,this.data.required),a&&(i.maxLength=a),i.addEventListener("input",(n=>{e.setValue(t,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),o.formattedValue=null})),i.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";i.value=o.userValue=t,o.formattedValue=null}));let A=e=>{const{formattedValue:t}=o;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{if(o.focused)return;const{target:t}=e;o.userValue&&(t.value=o.userValue),o.lastCommittedValue=t.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)})),i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const n={value(i){o.userValue=i.detail.value??"",e.setValue(t,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){const{formattedValue:n}=i.detail;o.formattedValue=n,null!=n&&i.target!==document.activeElement&&(i.target.value=n),e.setValue(t,{formattedValue:n})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{const{charLimit:n}=i.detail,{target:s}=i;if(0===n)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",n);let a=o.userValue;!a||a.length<=n||(a=a.slice(0,n),s.value=o.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:s.selectionStart,selEnd:s.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)})),i.addEventListener("keydown",(e=>{o.commitKey=1;let i=-1;if("Escape"===e.key?i=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(o.commitKey=3):i=2,-1===i)return;const{value:n}=e.target;o.lastCommittedValue!==n&&(o.lastCommittedValue=n,o.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const n=A;A=null,i.addEventListener("blur",(e=>{if(!o.focused||!e.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);const{value:i}=e.target;o.userValue=i,o.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,willCommit:!0,commitKey:o.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),n(e)})),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",(e=>{o.lastCommittedValue=null;const{data:i,target:n}=e,{value:s,selectionStart:a,selectionEnd:r}=n;let A=a,c=r;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,a).match(/\w*[^\w]*$/);e&&(A-=e[0].length);break}case"deleteWordForward":{const e=s.substring(a).match(/^[^\w]*\w*/);e&&(c+=e[0].length);break}case"deleteContentBackward":a===r&&(A-=1);break;case"deleteContentForward":a===r&&(c+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:A,selEnd:c}})})),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(A&&i.addEventListener("blur",A),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/a;i.classList.add("comb"),i.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Xp extends jp{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class Zp extends jp{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,{value:t.exportValue===t.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,e.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return Jp.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",t.exportValue),s.tabIndex=qp,s.addEventListener("change",(n=>{const{name:s,checked:a}=n.target;for(const n of this._getElementsByName(s,i)){const i=a&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=i),e.setValue(n.id,{value:i})}e.setValue(i,{value:a})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue})),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",(t=>{const n={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(i,{value:t.target.checked})}};this._dispatchEventFromSandbox(n,t)})),this._setEventListeners(s,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._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class zp extends jp{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,{value:t.fieldValue===t.buttonValue}).value;if("string"==typeof n&&(n=n!==t.buttonValue,e.setValue(i,{value:n})),n)for(const n of this._getElementsByName(t.fieldName,i))e.setValue(n.id,{value:!1});const s=document.createElement("input");if(Jp.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=qp,s.addEventListener("change",(t=>{const{name:n,checked:s}=t.target;for(const t of this._getElementsByName(n,i))e.setValue(t.id,{value:!1});e.setValue(i,{value:s})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue})),this.enableScripting&&this.hasJSActions){const n=t.buttonValue;s.addEventListener("updatefromsandbox",(t=>{const s={value:t=>{const s=n===t.detail.value;for(const n of this._getElementsByName(t.target.name)){const t=s&&n.id===i;n.domElement&&(n.domElement.checked=t),e.setValue(n.id,{value:t})}}};this._dispatchEventFromSandbox(s,t)})),this._setEventListeners(s,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._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class $p extends Vp{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class em extends jp{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,i=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");Jp.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=qp;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,i.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let a=null;if(s){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),n.prepend(e),a=()=>{e.remove(),n.removeEventListener("input",a),a=null},n.addEventListener("input",a)}const r=e=>{const t=e?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,(e=>e.selected)).map((e=>e[t])):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let o=r(!1);const A=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(i=>{const s={value(i){a?.();const s=i.detail.value,A=new Set(Array.isArray(s)?s:[s]);for(const e of n.options)e.selected=A.has(e.value);e.setValue(t,{value:r(!0)}),o=r(!1)},multipleSelection(e){n.multiple=!0},remove(i){const s=n.options,a=i.detail.remove;s[a].selected=!1,n.remove(a),s.length>0&&-1===Array.prototype.findIndex.call(s,(e=>e.selected))&&(s[0].selected=!0),e.setValue(t,{value:r(!0),items:A(i)}),o=r(!1)},clear(i){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]}),o=r(!1)},insert(i){const{index:s,displayValue:a,exportValue:c}=i.detail.insert,l=n.children[s],g=document.createElement("option");g.textContent=a,g.value=c,l?l.before(g):n.append(g),e.setValue(t,{value:r(!0),items:A(i)}),o=r(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const e of s){const{displayValue:t,exportValue:i}=e,s=document.createElement("option");s.textContent=t,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:r(!0),items:A(i)}),o=r(!1)},indices(i){const n=new Set(i.detail.indices);for(const e of i.target.options)e.selected=n.has(e.index);e.setValue(t,{value:r(!0)}),o=r(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(s,i)})),n.addEventListener("input",(i=>{const n=r(!0),s=r(!1);e.setValue(t,{value:n}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:o,change:s,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,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))):n.addEventListener("input",(function(i){e.setValue(t,{value:r(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class tm extends Kp{constructor(e){const{data:t,elements:i}=e;super(e,{isRenderable:Kp._hasPopupData(t)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new im({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,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}),t=[];for(const i of this.elements)i.popup=e,i.container.ariaHasPopup="dialog",t.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",t.map((e=>`${Lf}${e}`)).join(",")),this.container}}class im{#$e=this.#et.bind(this);#tt=this.#it.bind(this);#nt=this.#st.bind(this);#at=this.#rt.bind(this);#ot=null;#x=null;#At=null;#ct=null;#lt=null;#gt=null;#ht=null;#dt=!1;#ut=null;#It=null;#ft=null;#Ct=null;#pt=null;#Ve=null;#mt=!1;constructor({container:e,color:t,elements:i,titleObj:n,modificationDate:s,contentsObj:a,richText:r,parent:o,rect:A,parentRect:c,open:l}){this.#x=e,this.#pt=n,this.#At=a,this.#Ct=r,this.#gt=o,this.#ot=t,this.#ft=A,this.#ht=c,this.#lt=i,this.#ct=Zf.toDateObject(s),this.trigger=i.flatMap((e=>e.getElementsToTriggerPopup()));for(const e of this.trigger)e.addEventListener("click",this.#at),e.addEventListener("mouseenter",this.#nt),e.addEventListener("mouseleave",this.#tt),e.classList.add("popupTriggerArea");for(const e of i)e.container?.addEventListener("keydown",this.#$e);this.#x.hidden=!0,l&&this.#rt()}render(){if(this.#ut)return;const e=this.#ut=document.createElement("div");if(e.className="popup",this.#ot){const t=e.style.outlineColor=Nf.makeHexColor(...this.#ot);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`;else{const t=.7;e.style.backgroundColor=Nf.makeHexColor(...this.#ot.map((e=>Math.floor(t*(255-e)+e))))}}const t=document.createElement("span");t.className="header";const i=document.createElement("h1");if(t.append(i),({dir:i.dir,str:i.textContent}=this.#pt),e.append(t),this.#ct){const e=document.createElement("span");e.classList.add("popupDate"),e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),e.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#ct.valueOf()})),t.append(e)}const n=this.#Bt;if(n)Op.render({xfaHtml:n,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const t=this._formatContents(this.#At);e.append(t)}this.#x.append(e)}get#Bt(){const e=this.#Ct,t=this.#At;return!e?.str||t?.str&&t.str!==e.str?null:this.#Ct.html||null}get#Qt(){return this.#Bt?.attributes?.style?.fontSize||0}get#Et(){return this.#Bt?.attributes?.style?.color||null}#bt(e){const t=[],i={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},n={style:{color:this.#Et,fontSize:this.#Qt?`calc(${this.#Qt}px * var(--scale-factor))`:""}};for(const i of e.split("\n"))t.push({name:"span",value:i,attributes:n});return i}_formatContents({str:e,dir:t}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let e=0,t=n.length;e=0&&s.setAttribute("stroke-width",t||1),i)for(let e=0,t=this.#xt.length;e{"Enter"===e.key&&(n?e.metaKey:e.ctrlKey)&&this.#Mt()})),!t.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return this.#Rt}addHighlightArea(){this.container.classList.add("highlightArea")}#Mt(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class Cm{#Nt=null;#Gt=null;#Ut=new Map;#Lt=null;constructor({div:e,accessibilityManager:t,annotationCanvasMap:i,annotationEditorUIManager:n,page:s,viewport:a,structTreeLayer:r}){this.div=e,this.#Nt=t,this.#Gt=i,this.#Lt=r||null,this.page=s,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return this.#Ut.size>0}async#Tt(e,t){const i=e.firstChild||e,n=i.id=`${Lf}${t}`,s=await(this.#Lt?.getAriaAttributes(n));if(s)for(const[e,t]of s)i.setAttribute(e,t);this.div.append(e),this.#Nt?.moveElementInDOM(this.div,e,i,!1)}async render(e){const{annotations:t}=e,i=this.div;eC(i,this.viewport);const n=new Map,s={data:null,layer:i,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new Hp,annotationStorage:e.annotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=16===e.annotationType;if(t){const t=n.get(e.id);if(!t)continue;s.elements=t}else{const{width:t,height:i}=Pp(e.rect);if(t<=0||i<=0)continue}s.data=e;const i=Yp.create(s);if(!i.isRenderable)continue;if(!t&&e.popupRef){const t=n.get(e.popupRef);t?t.push(i):n.set(e.popupRef,[i])}const a=i.render();e.hidden&&(a.style.visibility="hidden"),await this.#Tt(a,e.id),i._isEditable&&(this.#Ut.set(i.data.id,i),this._annotationEditorUIManager?.renderAnnotationElement(i))}this.#Ht()}update({viewport:e}){const t=this.div;this.viewport=e,eC(t,{rotation:e.rotation}),this.#Ht(),t.hidden=!1}#Ht(){if(!this.#Gt)return;const e=this.div;for(const[t,i]of this.#Gt){const n=e.querySelector(`[data-annotation-id="${t}"]`);if(!n)continue;i.className="annotationContent";const{firstChild:s}=n;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):n.append(i)}this.#Gt.clear()}getEditableAnnotations(){return Array.from(this.#Ut.values())}getEditableAnnotation(e){return this.#Ut.get(e)}}class pm{#gt=null;#ge=0;#Ot=new Map;#qt=new Map;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(this.#gt){if(this.#gt!==e){if(this.#Ot.size>0)for(const t of this.#Ot.values())t.remove(),e.append(t);this.#gt=e}}else this.#gt=e}static get _svgFactory(){return Qf(this,"_svgFactory",new Hp)}static#Jt(e,[t,i,n,s]){const{style:a}=e;a.top=100*i+"%",a.left=100*t+"%",a.width=100*n+"%",a.height=100*s+"%"}#Pt(){const e=pm._svgFactory.create(1,1,!0);return this.#gt.append(e),e.setAttribute("aria-hidden",!0),e}#Yt(e,t){const i=pm._svgFactory.createElement("clipPath");e.append(i);const n=`clip_${t}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const s=pm._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${t}`),s.classList.add("clip"),n}#Kt(e,t){for(const[i,n]of Object.entries(t))null===n?e.removeAttribute(i):e.setAttribute(i,n)}draw(e,t=!1,i=!1){const n=this.#ge++,s=this.#Pt(),a=pm._svgFactory.createElement("defs");s.append(a);const r=pm._svgFactory.createElement("path");a.append(r);const o=`path_p${this.pageIndex}_${n}`;r.setAttribute("id",o),r.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#qt.set(n,r);const A=i?this.#Yt(a,o):null,c=pm._svgFactory.createElement("use");return s.append(c),c.setAttribute("href",`#${o}`),this.updateProperties(s,e),this.#Ot.set(n,s),{id:n,clipPathId:`url(#${A})`}}drawOutline(e,t){const i=this.#ge++,n=this.#Pt(),s=pm._svgFactory.createElement("defs");n.append(s);const a=pm._svgFactory.createElement("path");s.append(a);const r=`path_p${this.pageIndex}_${i}`;let o;if(a.setAttribute("id",r),a.setAttribute("vector-effect","non-scaling-stroke"),t){const e=pm._svgFactory.createElement("mask");s.append(e),o=`mask_p${this.pageIndex}_${i}`,e.setAttribute("id",o),e.setAttribute("maskUnits","objectBoundingBox");const t=pm._svgFactory.createElement("rect");e.append(t),t.setAttribute("width","1"),t.setAttribute("height","1"),t.setAttribute("fill","white");const n=pm._svgFactory.createElement("use");e.append(n),n.setAttribute("href",`#${r}`),n.setAttribute("stroke","none"),n.setAttribute("fill","black"),n.setAttribute("fill-rule","nonzero"),n.classList.add("mask")}const A=pm._svgFactory.createElement("use");n.append(A),A.setAttribute("href",`#${r}`),o&&A.setAttribute("mask",`url(#${o})`);const c=A.cloneNode();return n.append(c),A.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(n,e),this.#Ot.set(i,n),i}finalizeDraw(e,t){this.#qt.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:i,bbox:n,rootClass:s,path:a}=t,r="number"==typeof e?this.#Ot.get(e):e;if(r){if(i&&this.#Kt(r,i),n&&pm.#Jt(r,n),s){const{classList:e}=r;for(const[t,i]of Object.entries(s))e.toggle(t,i)}if(a){const e=r.firstChild.firstChild;this.#Kt(e,a)}}}updateParent(e,t){if(t===this)return;const i=this.#Ot.get(e);i&&(t.#gt.append(i),this.#Ot.delete(e),t.#Ot.set(e,i))}remove(e){this.#qt.delete(e),null!==this.#gt&&(this.#Ot.get(e).remove(),this.#Ot.delete(e))}destroy(){this.#gt=null;for(const e of this.#Ot.values())e.remove();this.#Ot.clear(),this.#qt.clear()}}class mm{#x;#Vt=!1;#Wt=null;#jt;#_t;#Xt;#Zt;#zt;#$t=null;#ei;#ti=null;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:a=null,signal:r}){this.#x=e,this.#Wt=i,this.#jt=t,this.#_t=n,this.#Xt=s,this.#Zt=a,this.#ei=new AbortController,this.#zt=AbortSignal.any([r,this.#ei.signal]),e.addEventListener("touchstart",this.#ii.bind(this),{passive:!1,signal:this.#zt})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return Qf(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}#ii(e){if(this.#jt?.()||e.touches.length<2)return;if(!this.#ti){this.#ti=new AbortController;const e=AbortSignal.any([this.#zt,this.#ti.signal]),t=this.#x,i={signal:e,passive:!1};t.addEventListener("touchmove",this.#ni.bind(this),i),t.addEventListener("touchend",this.#si.bind(this),i),t.addEventListener("touchcancel",this.#si.bind(this),i),this.#_t?.()}if(Xf(e),2!==e.touches.length||this.#Wt?.())return void(this.#$t=null);let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]),this.#$t={touch0X:t.screenX,touch0Y:t.screenY,touch1X:i.screenX,touch1Y:i.screenY}}#ni(e){if(!this.#$t||2!==e.touches.length)return;let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]);const{screenX:n,screenY:s}=t,{screenX:a,screenY:r}=i,o=this.#$t,{touch0X:A,touch0Y:c,touch1X:l,touch1Y:g}=o,h=l-A,d=g-c,u=a-n,I=r-s,f=Math.hypot(u,I)||1,C=Math.hypot(h,d)||1;if(!this.#Vt&&Math.abs(C-f)<=mm.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(o.touch0X=n,o.touch0Y=s,o.touch1X=a,o.touch1Y=r,e.preventDefault(),!this.#Vt)return void(this.#Vt=!0);const p=[(n+a)/2,(s+r)/2];this.#Xt?.(p,C,f)}#si(e){this.#ti.abort(),this.#ti=null,this.#Zt?.(),this.#$t&&(e.preventDefault(),this.#$t=null,this.#Vt=!1)}destroy(){this.#ei?.abort(),this.#ei=null}}const Bm=.1;class Qm{#ai;#ri=0;#oi;constructor(e,t,i,n){if(this.#ai=t,this.#oi=i,!n)return;this.#ri=n.getBoundingClientRect().height;const s=new ResizeObserver((e=>{for(const t of e)if(t.target===n){this.#ri=Math.floor(t.borderBoxSize[0].blockSize);break}}));s.observe(n),e.addEventListener("abort",(()=>s.disconnect()),{once:!0})}#Ai(e,t){const i=e.y,n=e.bottom,s=e.y+e.height/2,a=t.y,r=t.bottom,o=t.y+t.height/2;return i<=o&&o<=n||a<=s&&s<=r}#ci(e,t,i,n){const s=e.y+e.height/2;return(n?i>=s:i<=s)&&e.x-Bm<=t&&t<=e.right+Bm}#li(e){return e.top>=this.#ri&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}#gi(e,t){const{focusNode:i,focusOffset:n}=e,s=document.createRange();s.setStart(i,n),s.setEnd(i,n);const a=s.getBoundingClientRect();return[a.x,t?a.top:a.bottom]}static#hi(e,t){if(!document.caretPositionFromPoint){const{startContainer:i,startOffset:n}=document.caretRangeFromPoint(e,t);return{offsetNode:i,offset:n}}return document.caretPositionFromPoint(e,t)}#di(e,t,i,n,s){if(s||=n.getBoundingClientRect(),t<=s.x+Bm)return void(i?e.extend(n.firstChild,0):e.setPosition(n.firstChild,0));if(s.right-Bm<=t){const{lastChild:t}=n;return void(i?e.extend(t,t.length):e.setPosition(t,t.length))}const a=s.y+s.height/2;let r=Qm.#hi(t,a),o=r.offsetNode?.parentElement;if(o&&o!==n){const e=document.elementsFromPoint(t,a),i=[];for(const t of e){if(t===n)break;const{style:e}=t;i.push([t,e.visibility]),e.visibility="hidden"}r=Qm.#hi(t,a),o=r.offsetNode?.parentElement;for(const[e,t]of i)e.style.visibility=t}o===n?i?e.extend(r.offsetNode,r.offset):e.setPosition(r.offsetNode,r.offset):i?e.extend(n.firstChild,0):e.setPosition(n.firstChild,0)}#ui(e,t,i,n,s){this.#li(n)?this.#di(t,s,e,i,n):(this.#ai.addEventListener("scrollend",this.#di.bind(this,t,s,e,i,null),{once:!0}),i.scrollIntoView())}#Ii(e,t){for(;;){const i=e.closest(".page"),n=parseInt(i.getAttribute("data-page-number")),s=t?n-1:n+1;if(!(e=this.#oi.querySelector(`.page[data-page-number="${s}"] .textLayer`)))return null;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=t?a.lastChild():a.firstChild();if(r)return r}}moveCaret(e,t){const i=document.getSelection();if(0===i.rangeCount)return;const{focusNode:n}=i,s=n.nodeType!==Node.ELEMENT_NODE?n.parentElement:n,a=s.closest(".textLayer");if(!a)return;const r=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);r.currentNode=n;const o=s.getBoundingClientRect();let A=null;const c=(e?r.previousSibling:r.nextSibling).bind(r);for(;c();){const e=r.currentNode.parentElement;if(!this.#Ai(o,e.getBoundingClientRect())){A=e;break}}if(!A){const s=this.#Ii(a,e);if(!s)return;if(t){const t=(e?r.firstChild():r.lastChild())||n;i.extend(t,e?0:t.length);const a=document.createRange();return a.setStart(s,e?s.length:0),a.setEnd(s,e?s.length:0),void i.addRange(a)}const[o]=this.#gi(i,e),{parentElement:A}=s;return void this.#ui(t,i,A,A.getBoundingClientRect(),o)}const[l,g]=this.#gi(i,e),h=A.getBoundingClientRect();if(this.#ci(h,l,g,e))this.#ui(t,i,A,h,l);else{for(;c();){const n=r.currentNode.parentElement,s=n.getBoundingClientRect();if(!this.#Ai(h,s))break;if(this.#ci(s,l,g,e))return void this.#ui(t,i,n,s,l)}this.#ui(t,i,A,h,l)}}}class Em{#ve=Object.create(null);on(e,t,i=null){this._on(e,t,{external:!0,once:i?.once,signal:i?.signal})}off(e,t,i=null){this._off(e,t)}dispatch(e,t){const i=this.#ve[e];if(!i||0===i.length)return;let n;for(const{listener:s,external:a,once:r}of i.slice(0))r&&this._off(e,s),a?(n||=[]).push(s):s(t);if(n){for(const e of n)e(t);n=null}}_on(e,t,i=null){let n=null;if(i?.signal instanceof AbortSignal){const{signal:s}=i;if(s.aborted)return void console.error("Cannot use an `aborted` signal.");const a=()=>this._off(e,t);n=()=>s.removeEventListener("abort",a),s.addEventListener("abort",a)}(this.#ve[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once,rmAbort:n})}_off(e,t,i=null){const n=this.#ve[e];if(n)for(let e=0,i=n.length;e{this.#Ci=null}))}async open(e){if(!this.#fi.has(e))throw new Error("The overlay does not exist.");if(this.#Ci){if(this.#Ci===e)throw new Error("The overlay is already active.");if(!this.#fi.get(e).canForceClose)throw new Error("Another overlay is currently active.");await this.close()}this.#Ci=e,e.showModal()}async close(e=this.#Ci){if(!this.#fi.has(e))throw new Error("The overlay does not exist.");if(!this.#Ci)throw new Error("The overlay is currently not active.");if(this.#Ci!==e)throw new Error("Another overlay is currently active.");e.close(),this.#Ci=null}}function ym(e){return function(e){return e<11904}(e)?function(e){return!(65408&e)}(e)?function(e){return 32===e||9===e||13===e||10===e}(e)?0:function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function(e){return e>=48&&e<=57}(e)||95===e?1:2:function(e){return 3584==(65408&e)}(e)?7:160===e?0:1:function(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?3:function(e){return e>=12448&&e<=12543}(e)?4:function(e){return e>=12352&&e<=12447}(e)?5:function(e){return e>=65376&&e<=65439}(e)?6:1}let wm;const km={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},Sm=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]);let vm;const Dm=/\p{M}+/gu,xm=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,Fm=/([^\p{M}])\p{M}*$/u,Rm=/^\p{M}*([^\p{M}])/u,Mm=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,Nm=new Map,Gm=new Map;let Um=null,Lm=null;function Tm(e){const t=[];let i,n;for(;null!==(i=Mm.exec(e));){let{index:e}=i;for(const n of i[0]){let i=Nm.get(n);i||(i=n.normalize("NFD").length,Nm.set(n,i)),t.push([i,e++])}}if(0===t.length&&Um)n=Um;else if(t.length>0&&Lm)n=Lm;else{const e=`([${Object.keys(km).join("")}])|([${wm||=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩",wm}])|((?:゙|゚)\\n)|(\\p{M}+(?:-\\n)?)|(\\p{Ll}-\\n\\p{Lu})|(\\S-\\n)|((?:\\p{Ideographic}|[぀-ヿ])\\n)|(\\n)`;n=0===t.length?Um=new RegExp(e+"|(\\u0000)","gum"):Lm=new RegExp(e+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum")}const s=[];for(;null!==(i=Dm.exec(e));)s.push([i[0].length,i.index]);let a=e.normalize("NFD");const r=[0,0];let o=0,A=0,c=0,l=0,g=0,h=!1;a=a.replace(n,((e,i,n,a,d,u,I,f,C,p,m)=>{if(m-=l,i){const e=km[i],t=e.length;for(let e=1;e>1),u=new Int32Array(r.length>>1);for(let e=0,t=r.length;e>1]=r[e],u[e>>1]=r[e+1];return[a,[d,u],h]}class Hm{#pi=null;#mi=!0;#Bi=0;constructor({linkService:e,eventBus:t,updateMatchesCountOnProgress:i=!0}){this._linkService=e,this._eventBus=t,this.#mi=i,this.onIsPageVisible=null,this.#Qi(),t._on("find",this.#Ei.bind(this)),t._on("findbarclose",this.#bi.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#pi}setDocument(e){this._pdfDocument&&this.#Qi(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#Ei(e){if(!e)return;const t=this._pdfDocument,{type:i}=e;(null===this.#pi||this.#yi(e))&&(this._dirtyMatch=!0),this.#pi=e,"highlightallchange"!==i&&this.#wi(3),this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#ki();const e=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#Si():"again"===i?(this.#Si(),e&&this.#pi.highlightAll&&this.#vi()):"highlightallchange"===i?(n?this.#Si():this._highlightMatches=!0,this.#vi()):this.#Si():this._findTimeout=setTimeout((()=>{this.#Si(),this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:n=-1}){this._scrollMatches&&e&&-1!==n&&n===this._selected.matchIdx&&-1!==i&&i===this._selected.pageIdx&&(this._scrollMatches=!1,qI(e,{top:-50,left:t+-400},!0))}#Qi(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#Bi=0,this.#pi=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._firstPageCapability=Promise.withResolvers()}get#Di(){const{query:e}=this.#pi;return"string"==typeof e?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=Tm(e)),this._normalizedQuery):(e||[]).filter((e=>!!e)).map((e=>Tm(e)[0]))}#yi(e){const t=e.query,i=this.#pi.query,n=typeof t;if(n!==typeof i)return!0;if("string"===n){if(t!==i)return!0}else if(JSON.stringify(t)!==JSON.stringify(i))return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!(this.onIsPageVisible?.(e)??1);case"highlightallchange":return!1}return!0}#xi(e,t,i){let n=e.slice(0,t).match(Fm);if(n){const i=e.charCodeAt(t),s=n[1].charCodeAt(0);if(ym(i)===ym(s))return!1}if(n=e.slice(t+i).match(Rm),n){const s=e.charCodeAt(t+i-1),a=n[1].charCodeAt(0);if(ym(s)===ym(a))return!1}return!0}#Fi(e,t){const{matchDiacritics:i}=this.#pi;let n=!1;return(e=e.replaceAll(xm,((e,s,a,r,o,A)=>s?`[ ]*\\${s}[ ]*`:a?`[ ]*${a}[ ]*`:r?"[ ]+":i?o||A:o?Sm.has(o.charCodeAt(0))?o:"":t?(n=!0,`${A}\\p{M}*`):A))).endsWith("[ ]*")&&(e=e.slice(0,e.length-4)),i&&t&&(vm||=String.fromCharCode(...Sm),n=!0,e=`${e}(?=[${vm}]|[^\\p{M}]|$)`),[n,e]}#Ri(e){const t=this.#Di;if(0===t.length)return;const i=this._pageContents[e],n=this.match(t,i,e),s=this._pageMatches[e]=[],a=this._pageMatchesLength[e]=[],r=this._pageDiffs[e];n?.forEach((({index:e,length:t})=>{const[i,n]=function(e,t,i){if(!e)return[t,i];const[n,s]=e,a=t,r=t+i-1;let o=YI(n,(e=>e>=a));n[o]>a&&--o;let A=YI(n,(e=>e>=r),o);n[A]>r&&--A;const c=a+s[o];return[c,r+s[A]+1-c]}(r,e,t);n&&(s.push(i),a.push(n))})),this.#pi.highlightAll&&this.#Mi(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#Ni());const o=s.length;this._matchesCountTotal+=o,this.#mi?o>0&&this.#Gi():++this.#Bi===this._linkService.pagesCount&&this.#Gi()}match(e,t,i){const n=this._hasDiacritics[i];let s=!1;if("string"==typeof e?[s,e]=this.#Fi(e,n):e=e.sort().reverse().map((e=>{const[t,i]=this.#Fi(e,n);return s||=t,`(${i})`})).join("|"),!e)return;const{caseSensitive:a,entireWord:r}=this.#pi;e=new RegExp(e,`g${s?"u":""}${a?"":"i"}`);const o=[];let A;for(;null!==(A=e.exec(t));)r&&!this.#xi(t,A.index,A[0].length)||o.push({index:A.index,length:A[0].length});return o}#ki(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const t={disableNormalization:!0};for(let i=0,n=this._linkService.pagesCount;ithis._pdfDocument.getPage(i+1).then((e=>e.getTextContent(t))).then((e=>{const t=[];for(const i of e.items)t.push(i.str),i.hasEOL&&t.push("\n");[this._pageContents[i],this._pageDiffs[i],this._hasDiacritics[i]]=Tm(t.join("")),s()}),(e=>{console.error(`Unable to get text content for page ${i+1}`,e),this._pageContents[i]="",this._pageDiffs[i]=null,this._hasDiacritics[i]=!1,s()}))))}}#Mi(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}#vi(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#Si(){const e=this.#pi.findPrevious,t=this._linkService.page-1,i=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.#Bi=0,this._matchesCountTotal=0,this.#vi();for(let e=0;e{this._pendingFindMatches.delete(e),this.#Ri(e)})))}if(0===this.#Di.length)return void this.#wi(0);if(this._resumePageIdx)return;const n=this._offset;if(this._pagesToSearch=i,null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+10)return n.matchIdx=e?n.matchIdx-1:n.matchIdx+1,void this.#Ui(!0);this.#Li(e)}this.#Ni()}#Ti(e){const t=this._offset,i=e.length,n=this.#pi.findPrevious;return i?(t.matchIdx=n?i-1:0,this.#Ui(!0),!0):(this.#Li(n),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this.#Ui(!1),!0))}#Ni(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#Ti(e))}#Li(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=i||t.pageIdx<0)&&(t.pageIdx=e?i-1:0,t.wrapped=!0)}#Ui(e=!1){let t=1;const i=this._offset.wrapped;if(this._offset.wrapped=!1,e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=i?2:0,-1!==e&&e!==this._selected.pageIdx&&this.#Mi(e)}this.#wi(t,this.#pi.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#Mi(this._selected.pageIdx))}#bi(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#wi(0),this._highlightMatches=!1,this.#vi())}))}#Hi(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;tn)&&(i=n=0),{current:i,total:n}}#Gi(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#Hi()})}#wi(e,t=!1){(this.#mi||this.#Bi===this._linkService.pagesCount&&3!==e)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,entireWord:this.#pi?.entireWord??null,matchesCount:this.#Hi(),rawQuery:this.#pi?.query??null})}}class Om{#ai;#Oi=new ResizeObserver(this.#qi.bind(this));constructor(e,t,i){this.opened=!1,this.bar=e.bar,this.toggleButton=e.toggleButton,this.findField=e.findField,this.highlightAll=e.highlightAllCheckbox,this.caseSensitive=e.caseSensitiveCheckbox,this.matchDiacritics=e.matchDiacriticsCheckbox,this.entireWord=e.entireWordCheckbox,this.findMsg=e.findMsg,this.findResultsCount=e.findResultsCount,this.findPreviousButton=e.findPreviousButton,this.findNextButton=e.findNextButton,this.eventBus=i,this.#ai=t;const n=new Map([[this.highlightAll,"highlightallchange"],[this.caseSensitive,"casesensitivitychange"],[this.entireWord,"entirewordchange"],[this.matchDiacritics,"diacriticmatchingchange"]]);this.toggleButton.addEventListener("click",(()=>{this.toggle()})),this.findField.addEventListener("input",(()=>{this.dispatchEvent("")})),this.bar.addEventListener("keydown",(({keyCode:e,shiftKey:t,target:i})=>{switch(e){case 13:i===this.findField?this.dispatchEvent("again",t):n.has(i)&&(i.checked=!i.checked,this.dispatchEvent(n.get(i)));break;case 27:this.close()}})),this.findPreviousButton.addEventListener("click",(()=>{this.dispatchEvent("again",!0)})),this.findNextButton.addEventListener("click",(()=>{this.dispatchEvent("again",!1)}));for(const[e,t]of n)e.addEventListener("click",(()=>{this.dispatchEvent(t)}))}reset(){this.updateUIState()}dispatchEvent(e,t=!1){this.eventBus.dispatch("find",{source:this,type:e,query:this.findField.value,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,highlightAll:this.highlightAll.checked,findPrevious:t,matchDiacritics:this.matchDiacritics.checked})}updateUIState(e,t,i){const{findField:n,findMsg:s}=this;let a="",r="";switch(e){case 0:break;case 3:r="pending";break;case 1:a="pdfjs-find-not-found",r="notFound";break;case 2:a=t?"pdfjs-find-reached-top":"pdfjs-find-reached-bottom"}n.setAttribute("data-status",r),n.setAttribute("aria-invalid",1===e),s.setAttribute("data-status",r),a?s.setAttribute("data-l10n-id",a):(s.removeAttribute("data-l10n-id"),s.textContent=""),this.updateResultsCount(i)}updateResultsCount({current:e=0,total:t=0}={}){const{findResultsCount:i}=this;if(t>0){const n=1e3;i.setAttribute("data-l10n-id",t>n?"pdfjs-find-match-count-limit":"pdfjs-find-match-count"),i.setAttribute("data-l10n-args",JSON.stringify({limit:n,current:e,total:t}))}else i.removeAttribute("data-l10n-id"),i.textContent=""}open(){this.opened||(this.#Oi.observe(this.#ai),this.#Oi.observe(this.bar),this.opened=!0,$I(this.toggleButton,!0,this.bar)),this.findField.select(),this.findField.focus()}close(){this.opened&&(this.#Oi.disconnect(),this.opened=!1,$I(this.toggleButton,!1,this.bar),this.eventBus.dispatch("findbarclose",{source:this}))}toggle(){this.opened?this.close():this.open()}#qi(){const{bar:e}=this;e.classList.remove("wrapContainers"),e.clientHeight>e.firstElementChild.clientHeight&&e.classList.add("wrapContainers")}}class qm{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}renderHighestPriority(e){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i,n=!1){const s=e.views,a=s.length;if(0===a)return null;for(let e=0;ea){const n=e.ids;for(let e=1,s=o-r;e{this.renderHighestPriority()})).catch((e=>{e instanceof Kf||console.error("renderView:",e)}))}return!0}}class Jm{constructor(e){this.value=e}valueOf(){return this.value}}class Pm extends Jm{constructor(e="???"){super(e)}toString(e){return`{${this.value}}`}}class Ym extends Jm{constructor(e,t={}){super(e),this.opts=t}toString(e){try{return e.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){return e.reportError(t),this.value.toString(10)}}}class Km extends Jm{constructor(e,t={}){super(e),this.opts=t}toString(e){try{return e.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){return e.reportError(t),new Date(this.value).toISOString()}}}function Vm(e,t,i){return i===t||(i instanceof Ym&&t instanceof Ym&&i.value===t.value||t instanceof Ym&&"string"==typeof i&&i===e.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value))}function Wm(e,t,i){return t[i]?Zm(e,t[i].value):(e.reportError(new RangeError("No default")),new Pm)}function jm(e,t){const i=[],n=Object.create(null);for(const s of t)"narg"===s.type?n[s.name]=_m(e,s.value):i.push(_m(e,s));return{positional:i,named:n}}function _m(e,t){switch(t.type){case"str":return t.value;case"num":return new Ym(t.value,{minimumFractionDigits:t.precision});case"var":return function(e,{name:t}){let i;if(e.params){if(!Object.prototype.hasOwnProperty.call(e.params,t))return new Pm(`$${t}`);i=e.params[t]}else{if(!e.args||!Object.prototype.hasOwnProperty.call(e.args,t))return e.reportError(new ReferenceError(`Unknown variable: $${t}`)),new Pm(`$${t}`);i=e.args[t]}if(i instanceof Jm)return i;switch(typeof i){case"string":return i;case"number":return new Ym(i);case"object":if(i instanceof Date)return new Km(i.getTime());default:return e.reportError(new TypeError(`Variable type not supported: $${t}, ${typeof i}`)),new Pm(`$${t}`)}}(e,t);case"mesg":return function(e,{name:t,attr:i}){const n=e.bundle._messages.get(t);if(!n)return e.reportError(new ReferenceError(`Unknown message: ${t}`)),new Pm(t);if(i){const s=n.attributes[i];return s?Zm(e,s):(e.reportError(new ReferenceError(`Unknown attribute: ${i}`)),new Pm(`${t}.${i}`))}return n.value?Zm(e,n.value):(e.reportError(new ReferenceError(`No value: ${t}`)),new Pm(t))}(e,t);case"term":return function(e,{name:t,attr:i,args:n}){const s=`-${t}`,a=e.bundle._terms.get(s);if(!a)return e.reportError(new ReferenceError(`Unknown term: ${s}`)),new Pm(s);if(i){const t=a.attributes[i];if(t){e.params=jm(e,n).named;const i=Zm(e,t);return e.params=null,i}return e.reportError(new ReferenceError(`Unknown attribute: ${i}`)),new Pm(`${s}.${i}`)}e.params=jm(e,n).named;const r=Zm(e,a.value);return e.params=null,r}(e,t);case"func":return function(e,{name:t,args:i}){let n=e.bundle._functions[t];if(!n)return e.reportError(new ReferenceError(`Unknown function: ${t}()`)),new Pm(`${t}()`);if("function"!=typeof n)return e.reportError(new TypeError(`Function ${t}() is not callable`)),new Pm(`${t}()`);try{let t=jm(e,i);return n(t.positional,t.named)}catch(i){return e.reportError(i),new Pm(`${t}()`)}}(e,t);case"select":return function(e,{selector:t,variants:i,star:n}){let s=_m(e,t);if(s instanceof Pm)return Wm(e,i,n);for(const t of i)if(Vm(e,s,_m(e,t.key)))return Zm(e,t.value);return Wm(e,i,n)}(e,t);default:return new Pm}}function Xm(e,t){if(e.dirty.has(t))return e.reportError(new RangeError("Cyclic reference")),new Pm;e.dirty.add(t);const i=[],n=e.bundle._useIsolating&&t.length>1;for(const s of t)if("string"!=typeof s){if(e.placeables++,e.placeables>100)throw e.dirty.delete(t),new RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is 100`);n&&i.push("⁨"),i.push(_m(e,s).toString(e)),n&&i.push("⁩")}else i.push(e.bundle._transform(s));return e.dirty.delete(t),i.join("")}function Zm(e,t){return"string"==typeof t?e.bundle._transform(t):Xm(e,t)}class zm{constructor(e,t,i){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=e,this.errors=t,this.args=i}reportError(e){if(!(this.errors&&e instanceof Error))throw e;this.errors.push(e)}memoizeIntlObject(e,t){let i=this.bundle._intls.get(e);i||(i={},this.bundle._intls.set(e,i));let n=JSON.stringify(t);return i[n]||(i[n]=new e(this.bundle.locales,t)),i[n]}}function $m(e,t){const i=Object.create(null);for(const[n,s]of Object.entries(e))t.includes(n)&&(i[n]=s.valueOf());return i}const eB=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function tB(e,t){let i=e[0];if(i instanceof Pm)return new Pm(`NUMBER(${i.valueOf()})`);if(i instanceof Ym)return new Ym(i.valueOf(),{...i.opts,...$m(t,eB)});if(i instanceof Km)return new Ym(i.valueOf(),{...$m(t,eB)});throw new TypeError("Invalid argument to NUMBER")}const iB=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function nB(e,t){let i=e[0];if(i instanceof Pm)return new Pm(`DATETIME(${i.valueOf()})`);if(i instanceof Km)return new Km(i.valueOf(),{...i.opts,...$m(t,iB)});if(i instanceof Ym)return new Km(i.valueOf(),{...$m(t,iB)});throw new TypeError("Invalid argument to DATETIME")}const sB=new Map;class aB{constructor(e,{functions:t,useIsolating:i=!0,transform:n=e=>e}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(e)?e:[e],this._functions={NUMBER:tB,DATETIME:nB,...t},this._useIsolating=i,this._transform=n,this._intls=function(e){const t=Array.isArray(e)?e.join(" "):e;let i=sB.get(t);return void 0===i&&(i=new Map,sB.set(t,i)),i}(e)}hasMessage(e){return this._messages.has(e)}getMessage(e){return this._messages.get(e)}addResource(e,{allowOverrides:t=!1}={}){const i=[];for(let n=0;n\s*/y,SB=/\s*:\s*/y,vB=/\s*,?\s*/y,DB=/\s+/y;class xB{constructor(e){this.body=[],rB.lastIndex=0;let t=0;for(;;){let i=rB.exec(e);if(null===i)break;t=rB.lastIndex;try{this.body.push(o(i[1]))}catch(e){if(e instanceof SyntaxError)continue;throw e}}function i(i){return i.lastIndex=t,i.test(e)}function n(i,n){if(e[t]===i)return t++,!0;if(n)throw new n(`Expected ${i}`);return!1}function s(e,n){if(i(e))return t=e.lastIndex,!0;if(n)throw new n(`Expected ${e.toString()}`);return!1}function a(i){i.lastIndex=t;let n=i.exec(e);if(null===n)throw new SyntaxError(`Expected ${i.toString()}`);return t=i.lastIndex,n}function r(e){return a(e)[1]}function o(e){let t=A(),n=function(){let e=Object.create(null);for(;i(oB);){let t=r(oB),i=A();if(null===i)throw new SyntaxError("Expected attribute value");e[t]=i}return e}();if(null===t&&0===Object.keys(n).length)throw new SyntaxError("Expected message value or attributes");return{id:e,value:t,attributes:n}}function A(){let n;if(i(dB)&&(n=r(dB)),"{"===e[t]||"}"===e[t])return c(n?[n]:[],1/0);let s=C();return s?n?c([n,s],s.length):(s.value=p(s.value,CB),c([s],s.length)):n?p(n,pB):null}function c(n=[],s){for(;;){if(i(dB)){n.push(r(dB));continue}if("{"===e[t]){n.push(l());continue}if("}"===e[t])throw new SyntaxError("Unbalanced closing brace");let a=C();if(!a)break;n.push(a),s=Math.min(s,a.length)}let a=n.length-1,o=n[a];"string"==typeof o&&(n[a]=p(o,pB));let A=[];for(let e of n)e instanceof FB&&(e=e.value.slice(0,e.value.length-s)),e&&A.push(e);return A}function l(){s(QB,SyntaxError);let e=g();if(s(EB))return e;if(s(kB)){let t=function(){let e,t=[],s=0;for(;i(AB);){n("*")&&(e=s);let i=d(),a=A();if(null===a)throw new SyntaxError("Expected variant value");t[s++]={key:i,value:a}}if(0===s)return null;if(void 0===e)throw new SyntaxError("Expected default variant");return{variants:t,star:e}}();return s(EB,SyntaxError),{type:"select",selector:e,...t}}throw new SyntaxError("Unclosed placeable")}function g(){if("{"===e[t])return l();if(i(gB)){let[,i,n,r=null]=a(gB);if("$"===i)return{type:"var",name:n};if(s(wB)){let a=function(){let i=[];for(;;){switch(e[t]){case")":return t++,i;case void 0:throw new SyntaxError("Unclosed argument list")}i.push(h()),s(vB)}}();if("-"===i)return{type:"term",name:n,attr:r,args:a};if(hB.test(n))return{type:"func",name:n,args:a};throw new SyntaxError("Function names must be all upper-case")}return"-"===i?{type:"term",name:n,attr:r,args:[]}:{type:"mesg",name:n,attr:r}}return u()}function h(){let e=g();return"mesg"!==e.type?e:s(SB)?{type:"narg",name:e.name,value:u()}:e}function d(){let e;return s(bB,SyntaxError),e=i(cB)?I():{type:"str",value:r(lB)},s(yB,SyntaxError),e}function u(){if(i(cB))return I();if('"'===e[t])return function(){n('"',SyntaxError);let i="";for(;;){if(i+=r(uB),"\\"!==e[t]){if(n('"'))return{type:"str",value:i};throw new SyntaxError("Unclosed string literal")}i+=f()}}();throw new SyntaxError("Invalid expression")}function I(){let[,e,t=""]=a(cB),i=t.length;return{type:"num",value:parseFloat(e),precision:i}}function f(){if(i(IB))return r(IB);if(i(fB)){let[,e,t]=a(fB),i=parseInt(e||t,16);return i<=55295||57344<=i?String.fromCodePoint(i):"�"}throw new SyntaxError("Unknown escape sequence")}function C(){let i=t;switch(s(DB),e[t]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return m(e.slice(i,t))}return" "===e[t-1]&&m(e.slice(i,t))}function p(e,t){return e.replace(t,"")}function m(e){let t=e.replace(mB,"\n"),i=BB.exec(e)[1].length;return new FB(t,i)}}}class FB{constructor(e,t){this.value=e,this.length=t}}const RB=/<|&#?\w+;/,MB={"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"]},NB={"http://www.w3.org/1999/xhtml":{global:["title","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"]}};function GB(e,t){const{value:i}=t;if("string"==typeof i)if("title"===e.localName&&"http://www.w3.org/1999/xhtml"===e.namespaceURI)e.textContent=i;else if(RB.test(i)){const t=e.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");t.innerHTML=i,function(e,t){for(const i of e.childNodes)if(i.nodeType!==i.TEXT_NODE)if(i.hasAttribute("data-l10n-name")){const n=TB(t,i);e.replaceChild(n,i)}else if(qB(i)){const t=HB(i);e.replaceChild(t,i)}else console.warn(`An element of forbidden type "${i.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),e.replaceChild(OB(i),i);t.textContent="",t.appendChild(e)}(t.content,e)}else e.textContent=i;LB(t,e)}function UB(e,t){if(!e)return!1;for(let i of e)if(i.name===t)return!0;return!1}function LB(e,t){const i=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map((e=>e.trim())):null;for(const n of Array.from(t.attributes))JB(n.name,t,i)&&!UB(e.attributes,n.name)&&t.removeAttribute(n.name);if(e.attributes)for(const n of Array.from(e.attributes))JB(n.name,t,i)&&t.getAttribute(n.name)!==n.value&&t.setAttribute(n.name,n.value)}function TB(e,t){const i=t.getAttribute("data-l10n-name"),n=e.querySelector(`[data-l10n-name="${i}"]`);return n?n.localName!==t.localName?(console.warn(`An element named "${i}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${n.localName}).`),OB(t)):(e.removeChild(n),PB(t,n.cloneNode(!1))):(console.warn(`An element named "${i}" wasn't found in the source.`),OB(t))}function HB(e){const t=e.ownerDocument.createElement(e.localName);return PB(e,t)}function OB(e){return e.ownerDocument.createTextNode(e.textContent)}function qB(e){const t=MB[e.namespaceURI];return t&&t.includes(e.localName)}function JB(e,t,i=null){if(i&&i.includes(e))return!0;const n=NB[t.namespaceURI];if(!n)return!1;const s=e.toLowerCase(),a=t.localName;if(n.global.includes(s))return!0;if(!n[a])return!1;if(n[a].includes(s))return!0;if("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"input"===a&&"value"===s){const e=t.type.toLowerCase();if("submit"===e||"button"===e||"reset"===e)return!0}return!1}function PB(e,t){return t.textContent=e.textContent,LB(e,t),t}class YB extends Array{static from(e){return e instanceof this?e:new this(e)}}class KB extends YB{constructor(e){if(super(),Symbol.asyncIterator in Object(e))this.iterator=e[Symbol.asyncIterator]();else{if(!(Symbol.iterator in Object(e)))throw new TypeError("Argument must implement the iteration protocol.");this.iterator=e[Symbol.iterator]()}}[Symbol.asyncIterator](){const e=this;let t=0;return{next:async()=>(e.length<=t&&e.push(e.iterator.next()),e[t++])}}async touchNext(e=1){let t=0;for(;t++!e.includes(t))),this.onChange(),this.resourceIds.length}async formatWithFallback(e,t){const i=[];let n=!1;for await(const s of this.bundles){n=!0;const a=_B(t,s,e,i);if(0===a.size)break;if("undefined"!=typeof console){const e=s.locales[0],t=Array.from(a).join(", ");console.warn(`[fluent] Missing translations in ${e}: ${t}`)}}return n||"undefined"==typeof console||console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n keys: ${JSON.stringify(e)}.\n resourceIds: ${JSON.stringify(this.resourceIds)}.`),i}formatMessages(e){return this.formatWithFallback(e,jB)}formatValues(e){return this.formatWithFallback(e,WB)}async formatValue(e,t){const[i]=await this.formatValues([{id:e,args:t}]);return i}handleEvent(){this.onChange()}onChange(e=!1){this.bundles=KB.from(this.generateBundles(this.resourceIds)),e&&this.bundles.touchNext(2)}}function WB(e,t,i,n){return i.value?e.formatPattern(i.value,n,t):null}function jB(e,t,i,n){const s={value:null,attributes:null};i.value&&(s.value=e.formatPattern(i.value,n,t));let a=Object.keys(i.attributes);if(a.length>0){s.attributes=new Array(a.length);for(let[r,o]of a.entries()){let a=e.formatPattern(i.attributes[o],n,t);s.attributes[r]={name:o,value:a}}}return s}function _B(e,t,i,n){const s=[],a=new Set;return i.forEach((({id:i,args:r},o)=>{if(void 0!==n[o])return;let A=t.getMessage(i);if(A){if(s.length=0,n[o]=e(t,s,A,r),s.length>0&&"undefined"!=typeof console){const e=t.locales[0],n=s.join(", ");console.warn(`[fluent][resolver] errors in ${e}/${i}: ${n}.`)}}else a.add(i)})),a}const XB="data-l10n-id",ZB="data-l10n-args",zB=`[${XB}]`;class $B extends VB{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:[XB,ZB]}}onChange(e=!1){super.onChange(e),this.roots&&this.translateRoots()}setAttributes(e,t,i){return e.setAttribute(XB,t),i?e.setAttribute(ZB,JSON.stringify(i)):e.removeAttribute(ZB),e}getAttributes(e){return{id:e.getAttribute(XB),args:JSON.parse(e.getAttribute(ZB)||null)}}connectRoot(e){for(const t of this.roots)if(t===e||t.contains(e)||e.contains(t))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==e.ownerDocument.defaultView)throw new Error("Cannot connect a root:\n 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(),0===this.roots.size?(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(){const 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(const e of this.roots)this.mutationObserver.observe(e,this.observerConfig)}translateMutations(e){for(const t of e)switch(t.type){case"attributes":t.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(t.target);break;case"childList":for(const e of t.addedNodes)if(e.nodeType===e.ELEMENT_NODE)if(e.childElementCount)for(const t of this.getTranslatables(e))this.pendingElements.add(t);else e.hasAttribute(XB)&&this.pendingElements.add(e)}this.pendingElements.size>0&&null===this.pendingrAF&&(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;const t=e.map(this.getKeysForElement),i=await this.formatMessages(t);return this.applyTranslations(e,i)}applyTranslations(e,t){this.pauseObserving();for(let i=0;i({id:e}))),(await this.#Pi.formatMessages(e)).map((e=>e.value));const n=await this.#Pi.formatMessages([{id:e,args:t}]);return n[0]?.value||i}async translate(e){(this.#lt||=new Set).add(e);try{this.#Pi.connectRoot(e),await this.#Pi.translateRoots()}catch{}}async translateOnce(e){try{await this.#Pi.translateElements([e])}catch(e){console.error("translateOnce:",e)}}async destroy(){if(this.#lt){for(const e of this.#lt)this.#Pi.disconnectRoot(e);this.#lt.clear(),this.#lt=null}this.#Pi.pauseObserving()}pause(){this.#Pi.pauseObserving()}resume(){this.#Pi.resumeObserving()}static#Yi(e){return{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?.toLowerCase()||"en-us"]||e}static#Ki(e){const t=e.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(t)}}function tQ(e,t){const i=new xB(t),n=new aB(e),s=n.addResource(i);return s.length&&console.error("L10n errors",s),n}class iQ extends eQ{constructor(e){super({lang:e});const t=e?iQ.#Vi.bind(iQ,"en-us",this.getLanguage()):iQ.#Wi.bind(iQ,this.getLanguage());this._setL10n(new $B([],t))}static async*#Vi(e,t){const{baseURL:i,paths:n}=await this.#ji(),s=[t];if(e!==t){const i=t.split("-",1)[0];i!==t&&s.push(i),s.push(e)}for(const e of s){const t=await this.#_i(e,i,n);t?yield t:"en-us"===e&&(yield this.#Xi(e))}}static async#_i(e,t,i){const n=i[e];if(!n)return null;const s=new URL(n,t);return tQ(e,await Pf(s,"text"))}static async#ji(){try{const{href:e}=document.querySelector('link[type="application/l10n"]'),t=await Pf(e,"json");return{baseURL:e.replace(/[^/]*$/,"")||"./",paths:t}}catch{}return{baseURL:"./",paths:Object.create(null)}}static async*#Wi(e){yield this.#Xi(e)}static async#Xi(e){return tQ(e,'pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties…\npdfjs-document-properties-button-label = Document Properties…\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } × { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } × { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing…\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document…\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing…\npdfjs-ink =\n .aria-label = Draw Editor\npdfjs-ink-canvas =\n .aria-label = User-created image\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can’t see the image or when it doesn’t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, “A young man sits down at a table to eat a meal”\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner — resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle — resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner — resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right — resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner — resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle — resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner — resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left — resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here…\npdfjs-editor-new-alt-text-description = Short description for people who can’t see the image or when the image doesn’t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn’t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-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.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading…\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close')}}class nQ{#Zi=null;#zi=null;constructor({pdfPage:e,linkService:t,downloadManager:i,annotationStorage:n=null,imageResourcesPath:s="",renderForms:a=!0,enableScripting:r=!1,hasJSActionsPromise:o=null,fieldObjectsPromise:A=null,annotationCanvasMap:c=null,accessibilityManager:l=null,annotationEditorUIManager:g=null,onAppend:h=null}){this.pdfPage=e,this.linkService=t,this.downloadManager=i,this.imageResourcesPath=s,this.renderForms=a,this.annotationStorage=n,this.enableScripting=r,this._hasJSActionsPromise=o||Promise.resolve(!1),this._fieldObjectsPromise=A||Promise.resolve(null),this._annotationCanvasMap=c,this._accessibilityManager=l,this._annotationEditorUIManager=g,this.#Zi=h,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=t.eventBus}async render(e,t,i="display"){if(this.div){if(this._cancelled||!this.annotationLayer)return;return void this.annotationLayer.update({viewport:e.clone({dontFlip:!0})})}const[n,s,a]=await Promise.all([this.pdfPage.getAnnotations({intent:i}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const r=this.div=document.createElement("div");r.className="annotationLayer",this.#Zi?.(r),0!==n.length?(this.annotationLayer=new Cm({div:r,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,page:this.pdfPage,viewport:e.clone({dontFlip:!0}),structTreeLayer:t?.structTreeLayer||null}),await this.annotationLayer.render({annotations:n,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:a}),this.linkService.isInPresentationMode&&this.#$i(3),this.#zi||(this.#zi=new AbortController,this._eventBus?._on("presentationmodechanged",(e=>{this.#$i(e.state)}),{signal:this.#zi.signal}))):this.hide()}cancel(){this._cancelled=!0,this.#zi?.abort(),this.#zi=null}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}#$i(e){if(!this.div)return;let t=!1;switch(e){case 3:t=!0;break;case 1:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}}class sQ{#en=null;constructor(e){this.pageIndex=e.pageIndex}async render(e="display"){"display"!==e||this.#en||this._cancelled||(this.#en=new pm({pageIndex:this.pageIndex}))}cancel(){this._cancelled=!0,this.#en&&(this.#en.destroy(),this.#en=null)}setParent(e){this.#en?.setParent(e)}getDrawLayer(){return this.#en}}const aQ={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,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:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},rQ=/^H(\d+)$/;class oQ{#tn;#in=null;#nn;#sn=new Map;#an;#rn=null;constructor(e,t){this.#tn=e.getStructTree(),this.#an=t}async render(){if(this.#nn)return this.#nn;const{promise:e,resolve:t,reject:i}=Promise.withResolvers();this.#nn=e;try{this.#in=this.#on(await this.#tn)}catch(e){i(e)}return this.#tn=null,this.#in?.classList.add("structTree"),t(this.#in),e}async getAriaAttributes(e){try{return await this.render(),this.#sn.get(e)}catch{}return null}hide(){this.#in&&!this.#in.hidden&&(this.#in.hidden=!0)}show(){this.#in?.hidden&&(this.#in.hidden=!1)}#An(e,t){const{alt:i,id:n,lang:s}=e;if(void 0!==i){let n=!1;const s=PI(i);for(const t of e.children)if("annotation"===t.type){let e=this.#sn.get(t.id);e||(e=new Map,this.#sn.set(t.id,e)),e.set("aria-label",s),n=!0}n||t.setAttribute("aria-label",s)}void 0!==n&&t.setAttribute("aria-owns",n),void 0!==s&&t.setAttribute("lang",PI(s,!0))}#cn(e,t){const{alt:i,bbox:n,children:s}=e,a=s?.[0];if(!this.#an||!i||!n||"content"!==a?.type)return!1;const{id:r}=a;if(!r)return!1;t.setAttribute("aria-owns",r);const o=document.createElement("span");(this.#rn||=new Map).set(r,o),o.setAttribute("role","img"),o.setAttribute("aria-label",PI(i));const{pageHeight:A,pageX:c,pageY:l}=this.#an,g="calc(var(--scale-factor)*",{style:h}=o;return h.width=`${g}${n[2]-n[0]}px)`,h.height=`${g}${n[3]-n[1]}px)`,h.left=`${g}${n[0]-c}px)`,h.top=`${g}${A-n[3]+l}px)`,!0}addElementsToTextLayer(){if(this.#rn){for(const[e,t]of this.#rn)document.getElementById(e)?.append(t);this.#rn.clear(),this.#rn=null}}#on(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:i}=e,n=i.match(rQ);if(n?(t.setAttribute("role","heading"),t.setAttribute("aria-level",n[1])):aQ[i]&&t.setAttribute("role",aQ[i]),"Figure"===i&&this.#cn(e,t))return t}if(this.#An(e,t),e.children)if(1===e.children.length&&"id"in e.children[0])this.#An(e.children[0],t);else for(const i of e.children)t.append(this.#on(i));return t}}class AQ{#ln=!1;#gn=null;#hn=new Map;#dn=new Map;setTextMapping(e){this.#gn=e}static#un(e,t){const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const s=i.y,a=i.y+i.height,r=i.y+i.height/2,o=n.y,A=n.y+n.height,c=n.y+n.height/2;return r<=o&&c>=a?-1:c<=s&&r>=A?1:i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#ln)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#gn)throw new Error("Text divs and strings have not been set.");if(this.#ln=!0,this.#gn=this.#gn.slice(),this.#gn.sort(AQ.#un),this.#hn.size>0){const e=this.#gn;for(const[t,i]of this.#hn)document.getElementById(t)?this.#In(t,e[i]):this.#hn.delete(t)}for(const[e,t]of this.#dn)this.addPointerInTextLayer(e,t);this.#dn.clear()}disable(){this.#ln&&(this.#dn.clear(),this.#gn=null,this.#ln=!1)}removePointerInTextLayer(e){if(!this.#ln)return void this.#dn.delete(e);const t=this.#gn;if(!t||0===t.length)return;const{id:i}=e,n=this.#hn.get(i);if(void 0===n)return;const s=t[n];this.#hn.delete(i);let a=s.getAttribute("aria-owns");a?.includes(i)&&(a=a.split(" ").filter((e=>e!==i)).join(" "),a?s.setAttribute("aria-owns",a):(s.removeAttribute("aria-owns"),s.setAttribute("role","presentation")))}#In(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e),t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return null;if(!this.#ln)return this.#dn.set(e,t),null;t&&this.removePointerInTextLayer(e);const n=this.#gn;if(!n||0===n.length)return null;const s=YI(n,(t=>AQ.#un(e,t)<0)),a=Math.max(0,s-1),r=n[a];this.#In(i,r),this.#hn.set(i,a);const o=r.parentNode;return o?.classList.contains("markedContent")?o.id:null}moveElementInDOM(e,t,i,n){const s=this.addPointerInTextLayer(i,n);if(!e.hasChildNodes())return e.append(t),s;const a=Array.from(e.childNodes).filter((e=>e!==t));if(0===a.length)return s;const r=i||t,o=YI(a,(e=>AQ.#un(r,e)<0));return 0===o?a[0].before(t):a[o-1].after(t),s}}class cQ{#zi=null;constructor({findController:e,eventBus:t,pageIndex:i}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=i,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 new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this.#zi||(this.#zi=new AbortController,this.eventBus._on("updatetextlayermatches",(e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()}),{signal:this.#zi.signal})),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this.#zi?.abort(),this.#zi=null,this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:i}=this;let n=0,s=0;const a=i.length-1,r=[];for(let o=0,A=e.length;o=s+i[n].length;)s+=i[n].length,n++;n===i.length&&console.error("Could not find a matching mapping");const c={begin:{divIdx:n,offset:A-s}};for(A+=t[o];n!==a&&A>s+i[n].length;)s+=i[n].length,n++;c.end={divIdx:n,offset:A-s},r.push(c)}return r}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,a=i===t.selected.pageIdx,r=t.selected.matchIdx;let o=null;const A=void 0;function c(e,t){const i=e.divIdx;return s[i].textContent="",l(i,0,e.offset,t)}function l(e,t,i,a){let r=s[e];if(r.nodeType===Node.TEXT_NODE){const t=document.createElement("span");r.before(t),t.append(r),s[e]=t,r=t}const o=n[e].substring(t,i),A=document.createTextNode(o);if(a){const e=document.createElement("span");if(e.className=`${a} appended`,e.append(A),r.append(e),a.includes("selected")){const{left:t}=e.getClientRects()[0];return t-r.getBoundingClientRect().left}return 0}return r.append(A),0}let g=r,h=g+1;if(t.state.highlightAll)g=0,h=e.length;else if(!a)return;let d=-1,u=-1;for(let n=g;n{t.classList.add("selecting")})),t.addEventListener("copy",(e=>{if(!this.#fn){const t=document.getSelection();e.clipboardData.setData("text/plain",PI(function(e){return Gf||(Gf=/([\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,Uf=new Map([["ſt","ſt"]])),e.replaceAll(Gf,((e,t,i)=>t?t.normalize("NFKC"):Uf.get(i)))}(t.toString())))}Xf(e)})),lQ.#mn.set(t,e),lQ.#bn()}static#En(e){this.#mn.delete(e),0===this.#mn.size&&(this.#Bn?.abort(),this.#Bn=null)}static#bn(){if(this.#Bn)return;this.#Bn=new AbortController;const{signal:e}=this.#Bn,t=(e,t)=>{t.append(e),e.style.width="",e.style.height="",t.classList.remove("selecting")};let i=!1;var n,s;document.addEventListener("pointerdown",(()=>{i=!0}),{signal:e}),document.addEventListener("pointerup",(()=>{i=!1,this.#mn.forEach(t)}),{signal:e}),window.addEventListener("blur",(()=>{i=!1,this.#mn.forEach(t)}),{signal:e}),document.addEventListener("keyup",(()=>{i||this.#mn.forEach(t)}),{signal:e}),document.addEventListener("selectionchange",(()=>{const e=document.getSelection();if(0===e.rangeCount)return void this.#mn.forEach(t);const i=new Set;for(let t=0;t{i===this._optionalContentConfigPromise&&(this.#Ln.initialOptionalContent=e.hasInitialVisibility)})),e.l10n||this.l10n.translate(this.div)}}#On(e,t){const i=hQ.get(t),n=this.#Tn[i];if(this.#Tn[i]=e,n)n.replaceWith(e);else{for(let t=i-1;t>=0;t--){const i=this.#Tn[t];if(i)return void i.after(e)}this.div.prepend(e)}}get renderingState(){return this.#Gn}set renderingState(e){if(e!==this.#Gn)switch(this.#Gn=e,this.#Dn&&(clearTimeout(this.#Dn),this.#Dn=null),e){case TI.PAUSED:this.div.classList.remove("loading");break;case TI.RUNNING:this.div.classList.add("loadingIcon"),this.#Dn=setTimeout((()=>{this.div.classList.add("loading"),this.#Dn=null}),0);break;case TI.INITIAL:case TI.FINISHED:this.div.classList.remove("loadingIcon","loading")}}#Hn(){const{viewport:e}=this;if(this.pdfPage){if(this.#Fn===e.rotation)return;this.#Fn=e.rotation}eC(this.div,e,!0,!1)}setPdfPage(e){!this._isStandalone||"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||(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;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*Jf.PDF_TO_CSS_UNITS,rotation:t}),this.#Hn(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return Qf(this,"_textHighlighter",new cQ({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#vn.findController}))}#qn(e,t){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:t})}async#Jn(){let e=null;try{await this.annotationLayer.render(this.viewport,{structTreeLayer:this.structTreeLayer},"display")}catch(t){console.error("#renderAnnotationLayer:",t),e=t}finally{this.#qn("annotationlayerrendered",e)}}async#Pn(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(t){console.error("#renderAnnotationEditorLayer:",t),e=t}finally{this.#qn("annotationeditorlayerrendered",e)}}async#Yn(){try{await this.drawLayer.render("display")}catch(e){console.error("#renderDrawLayer:",e)}}async#Kn(){let e=null;try{const e=await this.xfaLayer.render(this.viewport,"display");e?.textDivs&&this._textHighlighter&&this.#Vn(e.textDivs)}catch(t){console.error("#renderXfaLayer:",t),e=t}finally{this.xfaLayer?.div&&(this.l10n.pause(),this.#On(this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),this.#qn("xfalayerrendered",e)}}async#Wn(){if(!this.textLayer)return;let e=null;try{await this.textLayer.render(this.viewport)}catch(t){if(t instanceof Df)return;console.error("#renderTextLayer:",t),e=t}this.#qn("textlayerrendered",e),this.#jn()}async#jn(){if(!this.textLayer)return;const e=await(this.structTreeLayer?.render());e&&(this.l10n.pause(),this.structTreeLayer?.addElementsToTextLayer(),this.canvas&&e.parentNode!==this.canvas&&this.canvas.append(e),this.l10n.resume()),this.structTreeLayer?.show()}async#Vn(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i),this._textHighlighter.enable()}#_n(){const{canvas:e}=this;e&&(e.remove(),e.width=e.height=0,this.canvas=null,this.#xn=null)}reset({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,keepCanvasWrapper:s=!1}={}){this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:t,keepXfaLayer:i,keepTextLayer:n}),this.renderingState=TI.INITIAL;const a=this.div,r=a.childNodes,o=e&&this.annotationLayer?.div||null,A=t&&this.annotationEditorLayer?.div||null,c=i&&this.xfaLayer?.div||null,l=n&&this.textLayer?.div||null,g=s&&this.#wn||null;for(let e=r.length-1;e>=0;e--){const t=r[e];switch(t){case o:case A:case c:case l:case g:continue}t.remove();const i=this.#Tn.indexOf(t);i>=0&&(this.#Tn[i]=null)}a.removeAttribute("data-loaded"),o&&this.annotationLayer.hide(),A&&this.annotationEditorLayer.hide(),c&&this.xfaLayer.hide(),l&&this.textLayer.hide(),this.structTreeLayer?.hide(),!s&&this.#wn&&(this.#wn=null,this.#_n())}toggleEditingMode(e){this.hasEditableAnnotations()&&(this.#Sn=e,this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0}))}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null,drawingDelay:n=-1}){this.scale=e||this.scale,"number"==typeof t&&(this.rotation=t),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then((e=>{i===this._optionalContentConfigPromise&&(this.#Ln.initialOptionalContent=e.hasInitialVisibility)}))),this.#Ln.directDrawing=!0;const s=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*Jf.PDF_TO_CSS_UNITS,rotation:s}),this.#Hn(),this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale),this.canvas){let e=!1;if(this.#kn)if(0===this.maxCanvasPixels)e=!0;else if(this.maxCanvasPixels>0){const{width:t,height:i}=this.viewport,{sx:n,sy:s}=this.outputScale;e=(Math.floor(t)*n|0)*(Math.floor(i)*s|0)>this.maxCanvasPixels}const t=n>=0&&n<1e3;if(t||e){if(t&&!e&&this.renderingState!==TI.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=TI.FINISHED,this.#Ln.directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t}),t)return;return void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this.#Nn})}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){this.renderTask&&(this.renderTask.cancel(s),this.renderTask=null),this.resume=null,!this.textLayer||n&&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.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||i&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:t=!1,redrawXfaLayer:i=!1,redrawTextLayer:n=!1,hideTextLayer:s=!1}){const{canvas:a}=this;if(!a)return;const r=this.#xn;if(this.viewport!==r){const e=(360+this.viewport.rotation-r.rotation)%360;if(90===e||270===e){const{width:t,height:i}=this.viewport,n=i/t,s=t/i;a.style.transform=`rotate(${e}deg) scale(${n},${s})`}else a.style.transform=0===e?"":`rotate(${e}deg)`}e&&this.annotationLayer&&this.#Jn(),t&&this.annotationEditorLayer&&(this.drawLayer&&this.#Yn(),this.#Pn()),i&&this.xfaLayer&&this.#Kn(),this.textLayer&&(s?(this.textLayer.hide(),this.structTreeLayer?.hide()):n&&this.#Wn())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}async#Xn(e,t=null){if(e===this.renderTask&&(this.renderTask=null),t instanceof Kf)this.#Nn=null;else if(this.#Nn=t,this.renderingState=TI.FINISHED,this.#Ln.regularAnnotations=!e.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this.#Nn}),t)throw t}async draw(){this.renderingState!==TI.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,l10n:t,pageColors:i,pdfPage:n,viewport:s}=this;if(!n)throw this.renderingState=TI.FINISHED,new Error("pdfPage is not loaded");this.renderingState=TI.RUNNING;let a=this.#wn;if(a||(a=this.#wn=document.createElement("div"),a.classList.add("canvasWrapper"),this.#On(a,"canvasWrapper")),this.textLayer||0===this.#Un||n.isPureXfa||(this._accessibilityManager||=new AQ,this.textLayer=new lQ({pdfPage:n,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:2===this.#Un,onAppend:e=>{this.l10n.pause(),this.#On(e,"textLayer"),this.l10n.resume()}})),!this.annotationLayer&&0!==this.#yn){const{annotationStorage:e,annotationEditorUIManager:t,downloadManager:i,enableScripting:s,fieldObjectsPromise:a,hasJSActionsPromise:r,linkService:o}=this.#vn;this._annotationCanvasMap||=new Map,this.annotationLayer=new nQ({pdfPage:n,annotationStorage:e,imageResourcesPath:this.imageResourcesPath,renderForms:2===this.#yn,linkService:o,downloadManager:i,enableScripting:s,hasJSActionsPromise:r,fieldObjectsPromise:a,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:t,onAppend:e=>{this.#On(e,"annotationLayer")}})}const{width:r,height:o}=s,A=document.createElement("canvas");A.setAttribute("role","presentation");const c=!(!i?.background||!i?.foreground),l=this.canvas,g=!l&&!c;this.canvas=A,this.#xn=s;let h=e=>{g?(a.prepend(A),h=null):e&&(l?(l.replaceWith(A),l.width=l.height=0):a.prepend(A),h=null)};const d=A.getContext("2d",{alpha:!1,willReadFrequently:!this.#h}),u=this.outputScale=new tC;if(0===this.maxCanvasPixels){const e=1/this.scale;u.sx*=e,u.sy*=e,this.#kn=!0}else if(this.maxCanvasPixels>0){const e=r*o,t=Math.sqrt(this.maxCanvasPixels/e);u.sx>t||u.sy>t?(u.sx=t,u.sy=t,this.#kn=!0):this.#kn=!1}const I=KI(u.sx),f=KI(u.sy),C=A.width=VI(ef(r*u.sx),I[0]),p=A.height=VI(ef(o*u.sy),f[0]),m=VI(ef(r),I[1]),B=VI(ef(o),f[1]);u.sx=C/m,u.sy=p/B,this.#Rn!==I[1]&&(e.style.setProperty("--scale-round-x",`${I[1]}px`),this.#Rn=I[1]),this.#Mn!==f[1]&&(e.style.setProperty("--scale-round-y",`${f[1]}px`),this.#Mn=f[1]);const Q={canvasContext:d,transform:u.scaled?[u.sx,0,0,u.sy,0,0]:null,viewport:s,annotationMode:this.#yn,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:i,isEditing:this.#Sn},E=this.renderTask=n.render(Q);E.onContinue=e=>{h?.(!1),!this.renderingQueue||this.renderingQueue.isHighestPriority(this)?e():(this.renderingState=TI.PAUSED,this.resume=()=>{this.renderingState=TI.RUNNING,e()})};const b=E.promise.then((async()=>{h?.(!0),await this.#Xn(E),this.structTreeLayer||=new oQ(n,s.rawDims),this.#Wn(),this.annotationLayer&&await this.#Jn();const{annotationEditorUIManager:e}=this.#vn;e&&(this.drawLayer||=new sQ({pageIndex:this.id}),await this.#Yn(),this.drawLayer.setParent(a))}),(e=>(e instanceof Kf?(l?.remove(),this.#_n()):h?.(!0),this.#Xn(E,e))));if(n.isPureXfa){if(!this.xfaLayer){const{annotationStorage:e,linkService:t}=this.#vn;this.xfaLayer=new gQ({pdfPage:n,annotationStorage:e,linkService:t})}this.#Kn()}return e.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),b}setPageLabel(e){this.pageLabel="string"==typeof e?e:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:t,regularAnnotations:i}=this.#Ln;return e&&t&&i?this.canvas:null}}class uQ{#Zn=new Set;#zn=0;constructor(e){this.#zn=e}push(e){const t=this.#Zn;t.has(e)&&t.delete(e),t.add(e),t.size>this.#zn&&this.#$n()}resize(e,t=null){this.#zn=e;const i=this.#Zn;if(t){const e=i.size;let n=1;for(const s of i)if(t.has(s.id)&&(i.delete(s),i.add(s)),++n>e)break}for(;i.size>this.#zn;)this.#$n()}has(e){return this.#Zn.has(e)}[Symbol.iterator](){return this.#Zn.keys()}#$n(){const e=this.#Zn.keys().next().value;e?.destroy(),this.#Zn.delete(e)}}class IQ{#es=null;#ts=null;#yn=2;#is=null;#ns=null;#h=!1;#ss=!1;#fn=!1;#as=!1;#rs=!1;#zi=null;#os=null;#As=null;#cs=null;#ls=!1;#gs=null;#hs=!1;#ds=0;#Oi=new ResizeObserver(this.#qi.bind(this));#us=null;#Is=null;#fs=!0;#Un=1;constructor(e){if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,"DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#Oi.observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new cf,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this.#ts=e.altTextManager||null,this.#ns=e.editorUndoBar||null,this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e)),this._scriptingManager=e.scriptingManager||null,this.#Un=e.textLayerMode??1,this.#yn=e.annotationMode??2,this.#ss=!0===e.enableHighlightFloatingButton,this.#as=!0===e.enableUpdatedAddImage,this.#rs=!0===e.enableNewAltTextWhenAddingImage,this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n,this.l10n||=new iQ,this.#fn=e.enablePermissions||!1,this.pageColors=e.pageColors||null,this.#os=e.mlManager||null,this.#h=e.enableHWA||!1,this.#fs=!1!==e.supportsPinchToZoom,this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new qm,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue;const{abortSignal:t}=e;t?.addEventListener("abort",(()=>{this.#Oi.disconnect(),this.#Oi=null}),{once:!0}),this.scroll=function(e,t,i){const n=function(i){a||(a=window.requestAnimationFrame((function(){a=null;const i=e.scrollLeft,n=s.lastX;i!==n&&(s.right=i>n),s.lastX=i;const r=e.scrollTop,o=s.lastY;r!==o&&(s.down=r>o),s.lastY=r,t(s)})))},s={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:n};let a=null;return e.addEventListener("scroll",n,{useCapture:!0,signal:i}),i?.addEventListener("abort",(()=>window.cancelAnimationFrame(a)),{once:!0}),s}(this.container,this._scrollUpdate.bind(this),t),this.presentationModeState=0,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#Cs(),this.eventBus._on("thumbnailrendered",(({pageNumber:e,pdfPage:t})=>{const i=this._pages[e-1];this.#es.has(i)||t?.cleanup()})),e.l10n||this.l10n.translate(this.container)}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(this.#es)}get pageViewsReady(){return this._pages.every((e=>e?.pdfPage))}get renderForms(){return 2===this.#yn}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#ps(),!0;if(!(0=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return 0!==this._currentScale?this._currentScale:1}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#ms(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#ms(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!WI(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if((e%=360)<0&&(e+=360),this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&this.#ms(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(){const e=this;return Qf(this,"_layerProperties",{get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},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}})}#Bs(e){const t={annotationEditorMode:{},annotationMode:this.#yn,textLayerMode:this.#Un};return e?(e.includes(16)||1!==this.#Un||(t.textLayerMode=2),e.includes(32)||e.includes(256)||2!==this.#yn||(t.annotationMode=1),t):t}async#Qs(e){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return;const t=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&t.resolve()}),{signal:"function"==typeof AbortSignal.any?AbortSignal.any([e,i.signal]):e}),await Promise.race([this._onePageRenderedCapability.promise,t.promise]),i.abort()}async getAllText(){const e=[],t=[];for(let i=1,n=this.pdfDocument.numPages;i<=n;++i){if(this.#hs)return null;t.length=0;const n=await this.pdfDocument.getPage(i),{items:s}=await n.getTextContent();for(const e of s)e.str&&t.push(e.str),e.hasEOL&&t.push("\n");e.push(PI(t.join("")))}return e.join("\n")}#Es(e,t){const i=document.getSelection(),{focusNode:n,anchorNode:s}=i;if(s&&n&&i.containsNode(this.#gs)){if(this.#ls||2===e)return void Xf(t);this.#ls=!0;const{classList:i}=this.viewer;i.add("copyAll");const n=new AbortController;window.addEventListener("keydown",(e=>this.#hs="Escape"===e.key),{signal:n.signal}),this.getAllText().then((async e=>{null!==e&&await navigator.clipboard.writeText(e)})).catch((e=>{console.warn(`Something goes wrong when extracting the text: ${e.message}`)})).finally((()=>{this.#ls=!1,this.#hs=!1,n.abort(),i.remove("copyAll")})),Xf(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.pdfDocument=e,!e)return;const t=e.numPages,i=e.getPage(1),n=e.getOptionalContentConfig({intent:"display"}),s=this.#fn?e.getPermissions():Promise.resolve(),{eventBus:a,pageColors:r,viewer:o}=this;this.#zi=new AbortController;const{signal:A}=this.#zi;if(t>1e4){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=HI.PAGE;a.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{a.dispatch("pagesloaded",{source:this,pagesCount:t})}),(()=>{})),a._on("pagerender",(e=>{const t=this._pages[e.pageNumber-1];t&&this.#es.push(t)}),{signal:A});const c=e=>{e.cssTransform||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),a._off("pagerendered",c))};a._on("pagerendered",c,{signal:A}),Promise.all([i,s]).then((([i,s])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(i),this._optionalContentConfigPromise=n;const{annotationEditorMode:c,annotationMode:l,textLayerMode:g}=this.#Bs(s);if(0!==g){const e=this.#gs=document.createElement("div");e.id="hiddenCopyElement",o.before(e)}const h=this._scrollMode===HI.PAGE?null:o,d=this.currentScale,u=i.getViewport({scale:d*Jf.PDF_TO_CSS_UNITS});o.style.setProperty("--scale-factor",u.scale),r?.background&&o.style.setProperty("--page-bg-color",r.background),"CanvasText"!==r?.foreground&&"Canvas"!==r?.background||(o.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),o.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let e=1;e<=t;++e){const t=new dQ({container:h,eventBus:a,id:e,scale:d,defaultViewport:u.clone(),optionalContentConfigPromise:n,renderingQueue:this.renderingQueue,textLayerMode:g,annotationMode:l,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,pageColors:r,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:this.#h});this._pages.push(t)}this._pages[0]?.setPdfPage(i),this._scrollMode===HI.PAGE?this.#bs():this._spreadMode!==OI.NONE&&this._updateSpreadMode(),this.#Qs(A).then((async()=>{if(e!==this.pdfDocument)return;if(this.findController?.setDocument(e),this._scriptingManager?.setDocument(e),this.#gs&&document.addEventListener("copy",this.#Es.bind(this,g),{signal:A}),e.loadingParams.disableAutoFetch||t>5e3)return void this._pagesCapability.resolve();let i=t-1;if(i<=0)this._pagesCapability.resolve();else for(let n=2;n<=t;++n){const t=e.getPage(n).then((e=>{const t=this._pages[n-1];t.pdfPage||t.setPdfPage(e),0==--i&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${n} to initialize viewer`,e),0==--i&&this._pagesCapability.resolve()}));n%250==0&&await t}})),a.dispatch("pagesinit",{source:this}),e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(o.lang=t.Language)})),this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e),this._pagesCapability.reject(e)}))}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.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}#ys(e,t=null){const{div:i,id:n}=e;if(this._currentPageNumber!==n&&this._setCurrentPageNumber(n),this._scrollMode===HI.PAGE&&(this.#bs(),this.update()),!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:s,clientWidth:a}=this.container;(this._scrollMode===HI.HORIZONTAL||es+a)&&(t={left:0,top:0})}qI(i,t),!this._currentScaleValue&&this._location&&(this._location=null)}#ws(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#ks(e,t,{noScroll:i=!1,preset:n=!1,drawingDelay:s=-1,origin:a=null}){if(this._currentScaleValue=t.toString(),this.#ws(e))return void(n&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t}));this.viewer.style.setProperty("--scale-factor",e*Jf.PDF_TO_CSS_UNITS);const r=s>=0&&s<1e3;this.refresh(!0,{scale:e,drawingDelay:r?s:-1}),r&&(this.#Is=setTimeout((()=>{this.#Is=null,this.refresh()}),s));const o=this._currentScale;if(this._currentScale=e,!i){let t,i=this._currentPageNumber;if(!this._location||this.isInPresentationMode||this.isChangingPresentationMode||(i=this._location.pageNumber,t=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:i,destArray:t,allowNegativeOffset:!0}),Array.isArray(a)){const t=e/o-1,[i,n]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-n)*t,this.container.scrollTop+=(a[1]-i)*t}}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:n?t:void 0}),this.defaultRenderingQueue&&this.update()}get#Ss(){return this._spreadMode!==OI.NONE&&this._scrollMode!==HI.HORIZONTAL?2:1}#ms(e,t){let i=parseFloat(e);if(i>0)t.preset=!1,this.#ks(i,e,t);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let s=40,a=5;this.isInPresentationMode?(s=a=4,this._spreadMode!==OI.NONE&&(s*=2)):this.removePageBorders?s=a=0:this._scrollMode===HI.HORIZONTAL&&([s,a]=[a,s]);const r=(this.container.clientWidth-s)/n.width*n.scale/this.#Ss,o=(this.container.clientHeight-a)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=r;break;case"page-height":i=o;break;case"page-fit":i=Math.min(r,o);break;case"auto":const t=XI(n)?r:Math.min(o,r);i=Math.min(1.25,t);break;default:return void console.error(`#setScale: "${e}" is an unknown zoom value.`)}t.preset=!0,this.#ks(i,e,t)}}#ps(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#ms(this._currentScaleValue,{noScroll:!0}),this.#ys(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:n=!1}){if(!this.pdfDocument)return;const s=Number.isInteger(e)&&this._pages[e-1];if(!s)return void console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!t)return void this._setCurrentPageNumber(e,!0);let a,r,o=0,A=0,c=0,l=0;const g=s.rotation%180!=0,h=(g?s.height:s.width)/s.scale/Jf.PDF_TO_CSS_UNITS,d=(g?s.width:s.height)/s.scale/Jf.PDF_TO_CSS_UNITS;let u=0;switch(t[1].name){case"XYZ":o=t[2],A=t[3],u=t[4],o=null!==o?o:0,A=null!==A?A:d;break;case"Fit":case"FitB":u="page-fit";break;case"FitH":case"FitBH":A=t[2],u="page-width",null===A&&this._location?(o=this._location.left,A=this._location.top):("number"!=typeof A||A<0)&&(A=d);break;case"FitV":case"FitBV":o=t[2],c=h,l=d,u="page-height";break;case"FitR":o=t[2],A=t[3],c=t[4]-o,l=t[5]-A;let e=40,i=5;this.removePageBorders&&(e=i=0),a=(this.container.clientWidth-e)/c/Jf.PDF_TO_CSS_UNITS,r=(this.container.clientHeight-i)/l/Jf.PDF_TO_CSS_UNITS,u=Math.min(Math.abs(a),Math.abs(r));break;default:return void console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`)}if(n||(u&&u!==this._currentScale?this.currentScaleValue=u:0===this._currentScale&&(this.currentScaleValue=LI)),"page-fit"===u&&!t[4])return void this.#ys(s);const I=[s.viewport.convertToViewportPoint(o,A),s.viewport.convertToViewportPoint(o+c,A+l)];let f=Math.min(I[0][0],I[1][0]),C=Math.min(I[0][1],I[1][1]);i||(f=Math.max(f,0),C=Math.max(C,0)),this.#ys(s,{left:f,top:C})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,a=this._pages[s-1],r=this.container,o=a.getPagePoint(r.scrollLeft-e.x,r.scrollTop-e.y),A=Math.round(o[0]),c=Math.round(o[1]);let l=`#page=${s}`;this.isInPresentationMode||(l+=`&zoom=${n},${A},${c}`),this._location={pageNumber:s,scale:n,top:c,left:A,rotation:this._pagesRotation,pdfOpenParams:l}}update(){const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Math.max(10,2*i+1);this.#es.resize(n,e.ids),this.renderingQueue.renderHighestPriority(e);const s=this._spreadMode===OI.NONE&&(this._scrollMode===HI.PAGE||this._scrollMode===HI.VERTICAL),a=this._currentPageNumber;let r=!1;for(const e of t){if(e.percent<100)break;if(e.id===a&&s){r=!0;break}}this._setCurrentPageNumber(r?a:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}#vs(){const e=this._getVisiblePages(),t=[],{ids:i,views:n}=e;for(const e of n){const{view:n}=e;n.hasEditableAnnotations()?t.push(e):i.delete(n.id)}return 0===t.length?null:(this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:i}),i)}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return 3===this.presentationModeState}get isChangingPresentationMode(){return 2===this.presentationModeState}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===HI.PAGE?this.#us.pages:this._pages,t=this._scrollMode===HI.HORIZONTAL,i=t&&this._isContainerRtl;return function({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const a=e.scrollTop,r=a+e.clientHeight,o=e.scrollLeft,A=o+e.clientWidth,c=[],l=new Set,g=t.length;let h=YI(t,n?function(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?io}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>a});h>0&&h=i&&(n=t[e-1].div,s=n.offsetTop+n.clientTop);for(let i=e-2;i>=0&&(n=t[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=s));--i)e=i;return e}(h,t,a));let d=n?A:-1;for(let e=h;e=r&&(d=C);else if((n?g:h)>d)break;if(C<=a||h>=r||f<=o||g>=A)continue;const p=Math.max(0,a-h)+Math.max(0,C-r),m=(u-(Math.max(0,o-g)+Math.max(0,f-A)))/u,B=(I-p)/I*m*100|0;c.push({id:i.id,x:g,y:h,view:i,percent:B,widthPercent:100*m|0}),l.add(i.id)}const u=c[0],I=c.at(-1);return i&&c.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id})),{first:u,last:I,views:c,ids:l}}({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}cleanup(){for(const e of this._pages)e.renderingState!==TI.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#Ds(e){if(e.pdfPage)return e.pdfPage;try{const 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}}#xs(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case HI.PAGE:return this.#us.scrollDown;case HI.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#xs(t),n=this._spreadMode!==OI.NONE&&this._scrollMode!==HI.HORIZONTAL,s=this.renderingQueue.getHighestPriority(t,this._pages,i,n);return!!s&&(this.#Ds(s).then((()=>{this.renderingQueue.renderView(s)})),!0)}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t{const i=t.pdfPage.getViewport({scale:1}),n=XI(i);if(void 0===e)e=n;else if(this.enablePrintAutoRotate&&n!==e)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.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 new 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(!jI(e))throw new Error(`Invalid scroll mode: ${e}`);this.pagesCount>1e4||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===HI.HORIZONTAL),i.classList.toggle("scrollWrapped",t===HI.WRAPPED),this.pdfDocument&&e&&(t===HI.PAGE?this.#bs():this._previousScrollMode===HI.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#ms(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!_I(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===HI.PAGE)this.#bs();else if(t.textContent="",this._spreadMode===OI.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let s=0,a=i.length;s=s;t--){const n=i[t],s=i[t+1]-1;if(ns)return s-e}if(t){const t=i[0];if(te)return t-e+1}break}break}case HI.HORIZONTAL:break;case HI.PAGE:case HI.VERTICAL:{if(this._spreadMode===OI.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),s=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===s){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+i,t),!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}updateScale({drawingDelay:e,scaleFactor:t=null,steps:i=null,origin:n}){if(null===i&&null===t)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let s=this._currentScale;if(t>0&&1!==t)s=Math.round(s*t*100)/100;else if(i){const e=i>0?1.1:1/1.1,t=i>0?Math.ceil:Math.floor;i=Math.abs(i);do{s=t(10*(s*e).toFixed(2))/10}while(--i>0)}s=Math.max(.1,Math.min(10,s)),this.#ms(s,{noScroll:!1,drawingDelay:e,origin:n})}increaseScale(e={}){this.updateScale({...e,steps:e.steps??1})}decreaseScale(e={}){this.updateScale({...e,steps:-(e.steps??1)})}#Cs(e=this.container.clientHeight){e!==this.#ds&&(this.#ds=e,zI.setProperty("--viewer-container-height",`${e}px`))}#qi(e){for(const t of e)if(t.target===this.container){this.#Cs(Math.floor(t.borderBoxSize[0].blockSize)),this.#is=null;break}}get containerTopLeft(){return this.#is||=[this.container.offsetTop,this.container.offsetLeft]}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const e of this._pages)e.update(t);null!==this.#Is&&(clearTimeout(this.#Is),this.#Is=null),e||this.update()}}}const fQ={initialBookmark:document.location.hash.substring(1),_initializedCapability:{...Promise.withResolvers(),settled:!1},appConfig:null,pdfDocument:null,pdfLoadingTask:null,pdfViewer:null,pdfRenderingQueue:null,pdfLinkService:null,overlayManager:null,eventBus:null,isInitialViewSet:!1,url:"",baseUrl:"",_eventBusAbortController:null,_windowAbortController:null,_globalAbortController:null,documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_wheelUnusedTicks:0,_wheelUnusedFactor:1,_touchManager:null,_touchUnusedTicks:0,_touchUnusedFactor:1,_PDFBug:null,_isCtrlKeyDown:!1,_caretBrowsing:null,_isScrolling:!1,async initialize(e){this.appConfig=e,Tf.node=e.rootNode||document.body,rf.set("externalLinkTarget",of.BLANK),await this._initializeViewerComponents(),this.bindEvents(),this.bindWindowEvents(),this._initializedCapability.settled=!0,this._initializedCapability.resolve()},async _initializeViewerComponents(){const{appConfig:e}=this,t=new Em;this.eventBus=rf.eventBus=t,this.overlayManager=new bm;const i=new qm;i.onIdle=this._cleanup.bind(this),this.pdfRenderingQueue=i;const n=new Af({eventBus:t,externalLinkTarget:rf.get("externalLinkTarget"),externalLinkRel:rf.get("externalLinkRel"),ignoreDestinationZoom:rf.get("ignoreDestinationZoom")});this.pdfLinkService=n;const s=new Hm({linkService:n,eventBus:t,updateMatchesCountOnProgress:!0});this.findController=s;const a=e.mainContainer,r=e.viewerContainer,o=rf.get("enableHWA"),A=new IQ({container:a,viewer:r,eventBus:t,renderingQueue:i,linkService:n,findController:s,textLayerMode:rf.get("textLayerMode"),enableHighlightFloatingButton:rf.get("enableHighlightFloatingButton"),imageResourcesPath:rf.get("imageResourcesPath"),maxCanvasPixels:rf.get("maxCanvasPixels"),abortSignal:this._globalAbortController.signal,enableHWA:o,supportsPinchToZoom:this.supportsPinchToZoom});this.pdfViewer=A,i.setViewer(A),n.setViewer(A),!this.supportsIntegratedFind&&e.findBar&&(this.findBar=new Om(e.findBar,e.principalContainer,t))},async run(e){this._globalAbortController=new AbortController,await this.initialize(e)},async stop(){this.unbindEvents(),this.unbindWindowEvents(),this._globalAbortController?.abort(),this._globalAbortController=null},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},updateZoom(e,t,i){this.pdfViewer.updateScale({drawingDelay:rf.get("defaultZoomDelay"),steps:e,scaleFactor:t,origin:i})},zoomIn(){this.updateZoom(1)},zoomOut(){this.updateZoom(-1)},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=LI)},touchPinchCallback(e,t,i){if(this.supportsPinchToZoom){const n=this._accumulateFactor(this.pdfViewer.currentScale,i/t,"_touchUnusedFactor");this.updateZoom(null,n,e)}else{const n=30,s=this._accumulateTicks((i-t)/n,"_touchUnusedTicks");this.updateZoom(s,null,e)}},touchPinchEndCallback(){this._touchUnusedTicks=0,this._touchUnusedFactor=1},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get supportsPinchToZoom(){return Qf(this,"supportsPinchToZoom",rf.get("supportsPinchToZoom"))},get supportsIntegratedFind(){return Qf(this,"supportsIntegratedFind",rf.get("supportsIntegratedFind"))},get supportsMouseWheelZoomCtrlKey(){return Qf(this,"supportsMouseWheelZoomCtrlKey",rf.get("supportsMouseWheelZoomCtrlKey"))},get supportsMouseWheelZoomMetaKey(){return Qf(this,"supportsMouseWheelZoomMetaKey",rf.get("supportsMouseWheelZoomMetaKey"))},get supportsCaretBrowsingMode(){return rf.get("supportsCaretBrowsingMode")},moveCaret(e,t){this._caretBrowsing||=new Qm(this._globalAbortController.signal,this.appConfig.mainContainer,this.appConfig.viewerContainer),this._caretBrowsing.moveCaret(e,t)},get _docFilename(){return this._contentDispositionFilename||function(e,t="document.pdf"){if("string"!=typeof e)return t;if(Vf(e))return pf('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let s=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(s&&(s=s[0],s.includes("%")))try{s=i.exec(decodeURIComponent(s))[0]}catch{}return s||t}(this.url)},async close(){if(this._unblockDocumentLoadEvent(),!this.pdfLoadingTask)return;const e=[];e.push(this.pdfLoadingTask.destroy()),this.pdfLoadingTask=null,this.pdfDocument&&(this.pdfDocument=null,this.pdfViewer.setDocument(null),this.pdfLinkService.setDocument(null)),this.pdfLinkService.externalLinkEnabled=!0,this.isInitialViewSet=!1,this.url="",this.baseUrl="",this.documentInfo=null,this.metadata=null,this._contentDispositionFilename=null,this._contentLength=null,this._PDFBug?.cleanup(),await Promise.all(e)},async open(e){this.pdfLoadingTask&&await this.close();const t=rf.getAll(8);Object.assign(TC,t);const i=Ep({...rf.getAll(4),...e});return this.pdfLoadingTask=i,i.promise.then((t=>{this.load(t,e.initHashView)}),(e=>{if(i!==this.pdfLoadingTask)return;let t="pdfjs-loading-error";return e instanceof wf?t="pdfjs-invalid-file-error":e instanceof kf?t="pdfjs-missing-file-error":e instanceof Sf&&(t="pdfjs-unexpected-response-error"),this._documentError(t,{message:e.message}).then((()=>{throw e}))}))},async _documentError(e,t=null){this._unblockDocumentLoadEvent();const i=await this._otherError(e||"pdfjs-loading-error",t);this.eventBus.dispatch("documenterror",{source:this,message:i,reason:t?.message??null})},async _otherError(e,t=null){const i=["PDF.js v4.10.45 (build: 562386909)"];return t&&(i.push(`Message: ${t.message}`),t.stack?i.push(`Stack: ${t.stack}`):(t.filename&&i.push(`File: ${t.filename}`),t.lineNumber&&i.push(`Line: ${t.lineNumber}`))),console.error(`${e}\n\n${i.join("\n")}`),e},load(e,t){this.pdfDocument=e,e.getDownloadInfo().then((({length:e})=>{this._contentLength=e,r.then((()=>{this.eventBus.dispatch("documentloaded",{source:this})}))}));const i=e.getPageLayout().catch((()=>{})),n=e.getPageMode().catch((()=>{})),s=e.getOpenAction().catch((()=>{}));this.pdfLinkService.setDocument(e);const a=this.pdfViewer;a.setDocument(e);const{firstPagePromise:r,onePageRendered:o,pagesPromise:A}=a;r.then((e=>{Promise.all([ZI,i,n,s]).then((async([e,i,n,s])=>{const r=this.initialBookmark,o=t??null,c=rf.get("scrollModeOnLoad");let l=rf.get("spreadModeOnLoad");if(i&&c===HI.UNKNOWN&&l===OI.UNKNOWN){const e=function(e){let t=HI.VERTICAL,i=OI.NONE;switch(e){case"SinglePage":t=HI.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=HI.PAGE;case"TwoColumnLeft":i=OI.ODD;break;case"TwoPageRight":t=HI.PAGE;case"TwoColumnRight":i=OI.EVEN}return{scrollMode:t,spreadMode:i}}(i);l=e.spreadMode}this.setInitialView(o,{rotation:null,scrollMode:c,spreadMode:l}),this.eventBus.dispatch("documentinit",{source:this}),await Promise.race([A,new Promise((e=>{setTimeout(e,1e4)}))]),!r&&!o||a.hasEqualPageSizes||(this.initialBookmark=r,a.currentScaleValue=a.currentScaleValue,this.setInitialView(o))})).catch((()=>{this.setInitialView()})).then((function(){a.update()}))})),A.then((()=>{this._unblockDocumentLoadEvent()}),(e=>{this._documentError("pdfjs-loading-error",{message:e.message})})),this._initializeMetadata(e)},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:n,contentLength:s}=await e.getMetadata();e===this.pdfDocument&&(this.documentInfo=t,this.metadata=i,this._contentDispositionFilename??=n,this._contentLength??=s,!t.IsXFAPresent||t.IsAcroFormPresent||e.isPureXfa?!t.IsAcroFormPresent&&!t.IsXFAPresent||this.pdfViewer.renderForms||console.warn("Warning: Interactive form support is not enabled"):e.loadingParams.enableXfa?console.warn("Warning: XFA Foreground documents are not supported"):console.warn("Warning: XFA support is not enabled"),t.IsSignaturesPresent&&console.warn("Warning: Digital signatures validation is not supported"),this.eventBus.dispatch("metadataloaded",{source:this}))},setInitialView(e,{rotation:t,sidebarView:i,scrollMode:n,spreadMode:s}={}){const a=e=>{WI(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0,((e,t)=>{jI(e)&&(this.pdfViewer.scrollMode=e),_I(t)&&(this.pdfViewer.spreadMode=t)})(n,s),e&&(a(t),this.pdfLinkService.setHash(e)),this.pdfViewer.currentScaleValue||(this.pdfViewer.currentScaleValue=LI)},_cleanup(){this.pdfDocument&&(this.pdfViewer.cleanup(),this.pdfDocument.cleanup(rf.get("fontExtraProperties")))},rotatePages(e){this.pdfViewer.pagesRotation+=e},bindEvents(){if(this._eventBusAbortController)return;const e={signal:(this._eventBusAbortController=new AbortController).signal},{eventBus:t,pdfViewer:i,preferences:n}=this;t._on("resize",pQ.bind(this),e),t._on("pagerendered",CQ.bind(this),e),t._on("scalechanging",EQ.bind(this),e),t._on("rotationchanging",bQ.bind(this),e),t._on("scalechanged",(e=>i.currentScaleValue=e.value),e),t._on("switchscrollmode",(e=>i.scrollMode=e.mode),e),t._on("switchspreadmode",(e=>i.spreadMode=e.mode),e),t._on("findfromurlhash",mQ.bind(this),e),t._on("updatefindmatchescount",BQ.bind(this),e),t._on("updatefindcontrolstate",QQ.bind(this),e)},bindWindowEvents(){if(this._windowAbortController)return;this._windowAbortController=new AbortController;const{eventBus:e,appConfig:{mainContainer:t},pdfViewer:i,_windowAbortController:{signal:n}}=this;"function"==typeof AbortSignal.any&&(this._touchManager=new mm({container:window,isPinchingDisabled:()=>i.isInPresentationMode,isPinchingStopped:()=>this.overlayManager?.active,onPinching:this.touchPinchCallback.bind(this),onPinchEnd:this.touchPinchEndCallback.bind(this),signal:n})),function e(t=null){t&&i.refresh(),window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`).addEventListener("change",e,{once:!0,signal:n})}(),window.addEventListener("wheel",yQ.bind(this),{passive:!1,signal:n}),window.addEventListener("keydown",kQ.bind(this),{signal:n}),window.addEventListener("keyup",wQ.bind(this),{signal:n}),window.addEventListener("resize",(()=>e.dispatch("resize",{source:window})),{signal:n}),window.addEventListener("updatefromsandbox",(t=>{e.dispatch("updatefromsandbox",{source:window,detail:t.detail})}),{signal:n}),({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t);const s=()=>{({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t),this._isScrolling=!1,t.addEventListener("scroll",a,{passive:!0,signal:n}),t.removeEventListener("scrollend",s),t.removeEventListener("blur",s)},a=()=>{this._isCtrlKeyDown||this._lastScrollTop===t.scrollTop&&this._lastScrollLeft===t.scrollLeft||(t.removeEventListener("scroll",a),this._isScrolling=!0,t.addEventListener("scrollend",s,{signal:n}),t.addEventListener("blur",s,{signal:n}))};t.addEventListener("scroll",a,{passive:!0,signal:n})},unbindEvents(){this._eventBusAbortController?.abort(),this._eventBusAbortController=null},unbindWindowEvents(){this._windowAbortController?.abort(),this._windowAbortController=null,this._touchManager=null},_accumulateTicks(e,t){(this[t]>0&&e<0||this[t]<0&&e>0)&&(this[t]=0),this[t]+=e;const i=Math.trunc(this[t]);return this[t]-=i,i},_accumulateFactor(e,t,i){if(1===t)return 1;(this[i]>1&&t<1||this[i]<1&&t>1)&&(this[i]=1);const n=Math.floor(e*t*this[i]*100)/(100*e);return this[i]=t/n,n},_unblockDocumentLoadEvent(){document.blockUnblockOnload?.(!1),this._unblockDocumentLoadEvent=()=>{}}};function CQ({pageNumber:e,error:t}){t&&this._otherError("pdfjs-rendering-error",t)}function pQ(){const{pdfDocument:e,pdfViewer:t,pdfRenderingQueue:i}=this;if(i.printing&&window.matchMedia("print").matches)return;if(!e)return;const n=t.currentScaleValue;"auto"!==n&&"page-fit"!==n&&"page-width"!==n||(t.currentScaleValue=n),t.update()}function mQ(e){this.eventBus.dispatch("find",{source:e.source,type:"",query:e.query,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function BQ({matchesCount:e}){this.findBar?.updateResultsCount(e)}function QQ({state:e,previous:t,entireWord:i,matchesCount:n,rawQuery:s}){this.findBar?.updateUIState(e,t,n)}function EQ(e){this.pdfViewer.update()}function bQ(e){this.pdfViewer.currentPageNumber=e.pageNumber}function yQ(e){const{pdfViewer:t,supportsMouseWheelZoomCtrlKey:i,supportsMouseWheelZoomMetaKey:n,supportsPinchToZoom:s}=this;if(t.isInPresentationMode)return;const a=e.deltaMode;let r=Math.exp(-e.deltaY/100);const o=e.ctrlKey&&!this._isCtrlKeyDown&&a===WheelEvent.DOM_DELTA_PIXEL&&0===e.deltaX&&(Math.abs(r-1)<.05||!1)&&0===e.deltaZ,A=[e.clientX,e.clientY];if(o||e.ctrlKey&&i||e.metaKey&&n){if(e.preventDefault(),this._isScrolling||"hidden"===document.visibilityState||this.overlayManager.active)return;if(o&&s)r=this._accumulateFactor(t.currentScale,r,"_wheelUnusedFactor"),this.updateZoom(null,r,A);else{const t=function(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI=1?Math.sign(t):this._accumulateTicks(t,"_wheelUnusedTicks");else{const e=30;i=this._accumulateTicks(t/e,"_wheelUnusedTicks")}this.updateZoom(i,null,A)}}}function wQ(e){"Control"===e.key&&(this._isCtrlKeyDown=!1)}function kQ(e){if(this._isCtrlKeyDown="Control"===e.key,this.overlayManager.active)return;const{eventBus:t,pdfViewer:i}=this,n=i.isInPresentationMode;let s=!1,a=!1;const r=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(1===r||8===r||5===r||12===r)switch(e.keyCode){case 70:this.supportsIntegratedFind||e.shiftKey||(this.findBar?.open(),s=!0);break;case 71:if(!this.supportsIntegratedFind){const{state:e}=this.findController;if(e){const i={source:window,type:"again",findPrevious:5===r||12===r};t.dispatch("find",{...e,...i})}s=!0}break;case 61:case 107:case 187:case 171:this.zoomIn(),s=!0;break;case 173:case 109:case 189:this.zoomOut(),s=!0;break;case 48:case 96:n||(setTimeout((()=>{this.zoomReset()})),s=!1);break;case 38:(n||this.page>1)&&(this.page=1,s=!0,a=!0);break;case 40:(n||this.page1)&&(this.page=1,s=!0,a=!0);break;case 35:(n||this.page0?i.nextPage():i.previousPage(),s=!0)}if(4===r)switch(e.keyCode){case 13:case 32:if(!n&&"page-fit"!==i.currentScaleValue)break;i.previousPage(),s=!0;break;case 38:this.moveCaret(!0,!0),s=!0;break;case 40:this.moveCaret(!1,!0),s=!0;break;case 82:this.rotatePages(-90)}s||n||(e.keyCode>=33&&e.keyCode<=40||32===e.keyCode&&"BUTTON"!==A)&&(a=!0),a&&!i.containsElement(o)&&i.focus(),s&&e.preventDefault()}}const SQ={LinkTarget:of,RenderingStates:TI,ScrollMode:HI,SpreadMode:OI};var vQ=UI.PDFViewerApplication,DQ=UI.PDFViewerApplicationOptions;const xQ=function({state:e}){return[A("div",{id:"viewerRootNode"},[A("div",{id:"viewerContainer",tabindex:"0"},[A("div",{id:"viewer",class:"pdfViewer"},"")])])]},FQ=function({state:e}){return A("style",{},'\n \n \n \n #viewerRootNode {\n width: 100%;\n height: 100%;\n }\n \n #viewerContainer{\n --viewer-container-height:0;\n --pdfViewer-padding-bottom:0;\n --page-margin:1px auto -8px;\n --page-border:9px solid transparent;\n --spreadHorizontalWrapped-margin-LR:-3.5px;\n --loading-icon-delay:400ms;\n \n --chrome-pdf-viewer-background-light: #525659;\n \n position:absolute;\n outline:none;\n z-index:0;\n width: 100%;\n height: 100%;\n overflow: auto; /* important, the scroll must be on this div to make PDF.js work */\n }\n \n /* ******************************* source: text_layer_builder.css ****************************************/ \n \n .textLayer{\n position:absolute;\n text-align:initial;\n inset:0;\n overflow:clip;\n opacity:1;\n line-height:1;\n -webkit-text-size-adjust:none;\n -moz-text-size-adjust:none;\n text-size-adjust:none;\n forced-color-adjust:none;\n transform-origin:0 0;\n caret-color:CanvasText;\n z-index:0;\n }\n \n .textLayer.highlighting{\n touch-action:none;\n }\n \n .textLayer :is(span,br){\n color:transparent;\n position:absolute;\n white-space:pre;\n cursor:text;\n transform-origin:0% 0%;\n }\n \n .textLayer > :not(.markedContent),.textLayer .markedContent span:not(.markedContent){\n z-index:1;\n }\n \n .textLayer span.markedContent{\n top:0;\n height:0;\n }\n \n .textLayer span[role="img"]{\n -webkit-user-select:none;\n -moz-user-select:none;\n user-select:none;\n cursor:default;\n }\n \n .textLayer .highlight{\n /*--highlight-bg-color:rgb(180 0 170 / 0.25);\n --highlight-selected-bg-color:rgb(0 100 0 / 0.25);*/\n --highlight-bg-color:rgb(180 0 23 / 0.25); /* always red for error */\n --highlight-selected-bg-color:rgb(180 0 23 / 0.25); /* always red for error */\n --highlight-backdrop-filter:none;\n --highlight-selected-backdrop-filter:none;\n }\n \n .textLayer .highlight{\n margin:-1px;\n padding:1px;\n background-color:var(--highlight-bg-color);\n -webkit-backdrop-filter:var(--highlight-backdrop-filter);\n backdrop-filter:var(--highlight-backdrop-filter);\n border-radius:4px;\n }\n \n .appended:is(.textLayer .highlight){\n position:initial;\n }\n \n .begin:is(.textLayer .highlight){\n border-radius:4px 0 0 4px;\n }\n \n .end:is(.textLayer .highlight){\n border-radius:0 4px 4px 0;\n }\n \n .middle:is(.textLayer .highlight){\n border-radius:0;\n }\n \n .selected:is(.textLayer .highlight){\n background-color:var(--highlight-selected-bg-color);\n -webkit-backdrop-filter:var(--highlight-selected-backdrop-filter);\n backdrop-filter:var(--highlight-selected-backdrop-filter);\n }\n \n .textLayer ::-moz-selection{\n background:rgba(0 0 255 / 0.25);\n background:color-mix(in srgb, AccentColor, transparent 75%);\n }\n \n .textLayer ::selection{\n background:rgba(0 0 255 / 0.25);\n /* red: rgb(255 0 0 / 28%); */\n background:color-mix(in srgb, AccentColor, transparent 75%);\n }\n \n .textLayer br::-moz-selection{\n background:transparent;\n }\n \n .textLayer br::selection{\n background:transparent;\n }\n \n .textLayer .endOfContent{\n display:block;\n position:absolute;\n inset:100% 0 0;\n z-index:0;\n cursor:default;\n -webkit-user-select:none;\n -moz-user-select:none;\n user-select:none;\n }\n \n .textLayer.selecting .endOfContent{\n top:0;\n }\n \n \n /* ******************************* source: pdf_viewer.css ****************************************/ \n \n [data-main-rotation="90"]{\n transform:rotate(90deg) translateY(-100%);\n }\n [data-main-rotation="180"]{\n transform:rotate(180deg) translate(-100%, -100%);\n }\n [data-main-rotation="270"]{\n transform:rotate(270deg) translateX(-100%);\n }\n \n /* Used by PDF viewer when Ctrl+A to select all is used */\n #hiddenCopyElement, .hiddenCanvasElement{\n position:absolute;\n top:0;\n left:0;\n width:0;\n height:0;\n display:none;\n }\n \n .pdfViewer{\n --scale-factor:1;\n --page-bg-color:unset;\n \n padding-bottom:var(--pdfViewer-padding-bottom);\n \n --hcm-highlight-filter:none;\n --hcm-highlight-selected-filter:none;\n }\n \n .pdfViewer.copyAll{\n cursor:wait;\n }\n \n .pdfViewer .canvasWrapper{\n overflow:hidden;\n width:100%;\n height:100%;\n }\n \n :is(.pdfViewer .canvasWrapper) canvas{\n margin:0;\n display:block;\n width:100%;\n height:100%;\n }\n \n [hidden]:is(:is(.pdfViewer .canvasWrapper) canvas){\n display:none;\n }\n \n [zooming]:is(:is(.pdfViewer .canvasWrapper) canvas){\n width:100%;\n height:100%;\n }\n \n :is(:is(.pdfViewer .canvasWrapper) canvas) .structTree{\n contain:strict;\n }\n \n .pdfViewer .page{\n --scale-round-x:1px;\n --scale-round-y:1px;\n \n direction:ltr;\n width:816px;\n height:1056px;\n margin:var(--page-margin);\n position:relative;\n overflow:visible;\n border:var(--page-border);\n background-clip:content-box;\n background-color:var(--page-bg-color, rgb(255 255 255));\n }\n \n .pdfViewer .dummyPage{\n position:relative;\n width:0;\n height:var(--viewer-container-height);\n }\n \n .pdfViewer.noUserSelect{\n -webkit-user-select:none;\n -moz-user-select:none;\n user-select:none;\n }\n \n .pdfViewer.removePageBorders .page{\n margin:0 auto 10px;\n border:none;\n }\n \n .pdfViewer:is(.scrollHorizontal, .scrollWrapped),\n .spread{\n margin-inline:3.5px;\n text-align:center;\n }\n \n .pdfViewer.scrollHorizontal,\n .spread{\n white-space:nowrap;\n }\n \n .pdfViewer.removePageBorders,\n .pdfViewer:is(.scrollHorizontal, .scrollWrapped) .spread{\n margin-inline:0;\n }\n \n .spread :is(.page, .dummyPage),\n .pdfViewer:is(.scrollHorizontal, .scrollWrapped) :is(.page, .spread){\n display:inline-block;\n vertical-align:middle;\n }\n \n .spread .page,\n .pdfViewer:is(.scrollHorizontal, .scrollWrapped) .page{\n margin-inline:var(--spreadHorizontalWrapped-margin-LR);\n }\n \n .pdfViewer.removePageBorders .spread .page,\n .pdfViewer.removePageBorders:is(.scrollHorizontal, .scrollWrapped) .page{\n margin-inline:5px;\n }\n \n .pdfViewer .page.loadingIcon::after{\n /* to debug and see it, add "loadingIcon loading" on page div, and remove the canvas */\n position:absolute;\n top:0;\n left:0;\n content:"";\n width:100%;\n height:100%;\n display:none;\n z-index:5;\n /* specific loading icon of beer-css */\n inline-size: 1.5rem;\n block-size: 1.5rem;\n border-width: 0.2rem;\n border-radius: 50%;\n border-style: solid;\n border-color: var(--chrome-pdf-viewer-background-light);\n animation: 1.6s to-circular linear infinite;\n background: none;\n flex: none;\n }\n \n .pdfViewer .page.loading::after{\n display:block;\n }\n \n .pdfViewer .page:not(.loading)::after{\n transition-property:none;\n display:none;\n }\n \n .hidden,\n [hidden]{\n display:none !important;\n }\n \n /* TODO Could we avoid duplicating beercss anim here (shadowom DOM), make this animation simpler */\n @keyframes to-circular {\n 0% {\n transform: rotate(0deg);\n clip-path: polygon(50% 50%, 0% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%);\n }\n \n 20% {\n clip-path: polygon(50% 50%, 0% 0%, 50% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%);\n }\n \n 30% {\n clip-path: polygon(50% 50%, 0% 0%, 50% 0%, 100% 0%, 100% 50%, 100% 50%, 100% 50%, 100% 50%, 100% 50%);\n }\n \n 40% {\n clip-path: polygon(50% 50%, 0% 0%, 50% 0%, 100% 0%, 100% 50%, 100% 100%, 100% 100%, 100% 100%, 100% 100%);\n }\n \n 50% {\n clip-path: polygon(50% 50%, 50% 0%, 50% 0%, 100% 0%, 100% 50%, 100% 100%, 50% 100%, 50% 100%, 50% 100%);\n }\n \n 60% {\n clip-path: polygon(50% 50%, 100% 50%, 100% 50%, 100% 50%, 100% 50%, 100% 100%, 50% 100%, 0% 100%, 0% 100%);\n }\n \n 70% {\n clip-path: polygon(50% 50%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 0% 100%, 0% 50%);\n }\n \n 80% {\n clip-path: polygon(50% 50%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 50%);\n }\n \n 90% {\n transform: rotate(360deg);\n clip-path: polygon(50% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%);\n }\n \n 100% {\n clip-path: polygon(50% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%);\n }\n }\n \n \n \n ')};let RQ=class extends S{init(){this.useShadowDOM=!0}get vdom(){return xQ}get vstyle(){return FQ}};var MQ,NQ;const GQ=function({state:e}){return[A("div",{class:"row",style:"flex: 1; gap:0; align-items: flex-start;"},[A("div",{class:"editor max"},""),A("div",{class:"small-padding"},[e.clipboardImage?A("img",{class:"image-editor",src:`${mI.state.clipboardImage}`,alt:""},""):""])])]},UQ=function({state:e}){return A("style",{},'\n \n \n c-data-clipboard-input {\n /*width: 100%;*/ /* force codemirror to use full width */\n display: flex; /* horizonral */\n flex: 1; /* use all width */\n }\n \n .editor {\n display: flex; /* force codemirror tu use all height */\n min-height: 80px;\n /*height: 100%;*/\n /*width: 100*/\n }\n .image-editor {\n width: 100px;\n }\n .cm-editor {\n /* it forces the editor to add horizontal scroll, even if the parent flex container \n has overlfow:visible */\n width: 0;\n flex-grow: 1;\n }\n .cm-focused {\n border: none;\n /*border-color: var(--primary); */\n }\n \n /* Customize codemirror autocomplete */\n .autocomplete {\n background-color: white !important;\n border: none !important;\n box-shadow: 0 0 4px rgba(0,0,0,0.4);\n }\n .autocomplete ul li[aria-selected] {\n background: var(--primary) !important;\n }\n .autocomplete > ul > li, .autocomplete > ul > completion-section {\n padding: 4px 4px !important;\n }\n .autocomplete .cm-completionIcon-keyword::after {\n content: ">" !important;\n }\n .autocomplete .cm-completionDetail {\n font-size: 0.8rem !important;\n color: #AAA;\n }\n .autocomplete > ul > li[aria-selected] .cm-completionDetail {\n color: #e490ff;\n }\n .autocomplete > ul {\n max-width: 400px !important;\n }\n \n \n ')};let LQ=class extends S{init(){this.useShadowDOM=!0}get vdom(){return GQ}get vstyle(){return UQ}};const TQ=function(){if(NQ)return MQ;NQ=1;const e="fun",t="par",i="str";function n(e,t,i){return Q(t,i)}function s(e,t){return Q(t,e.formatters)}function a(e){return t=>(t.mainPath=[t[e]],!0)}function r(e,t,i){const n=[],s=e.parts[e.parts.length-1];let a={};!0===s?.valid||"string"==typeof s?a=""===i?.token?{...t,...e.lastExpectedTokens}:t:""===i?.token&&(a=e.lastExpectedTokens);for(const t in a){const s=a[t];s.if&&!1===s.if(e)||"***"===t&&null!==i.bestFn||n.push({token:t,mark:[],info:s})}return n}function o(e,t){const i=e.mainPath[e.mainPath.length-1],s=i?.[t];return e.mainPath.push(s),{token:t,valid:void 0!==s,optional:!0,message:void 0===s?`"${t}" is undefined`:"",bestFn:n,choices:i}}function A(e){return(t,i)=>{t.relPath=e?[t[e]]:t.mainPath.slice(0,-t.relPathFrom);const s=t.relPath[t.relPath.length-1],a=s?.[i];return t.relPath.push(a),t.relPathFrom=1,{token:i,valid:void 0!==a,optional:!0,message:void 0===a?`"${i}" is undefined`:"",bestFn:n,choices:s}}}function c(e){const t=e.mainPath[e.mainPath.length-1];return e.mainPath[e.mainPath.length-1]=t?.[0],!0}function l(){return(e,t)=>{const i=e.mainPath.length-e.relPathFrom+1;e.relPath=0===i?[]:e.mainPath.slice(0,e.mainPath.length-e.relPathFrom+1);const s=e.relPath[e.relPath.length-1],a=s?.[t];return e.relPath.push(a),e.relPathFrom=1,{token:t,valid:void 0!==a,optional:!0,message:0===i?"Maximum parent reached":void 0===a?`"${t}" is undefined`:"",bestFn:n,choices:s}}}function g(e,t){const i=e.relPath[e.relPath.length-1],s=i?.[t];return e.relPath.push(s),{token:t,valid:void 0!==s,optional:!0,message:void 0===s?`"${t}" is undefined`:"",bestFn:n,choices:i}}function h(e){e.relPathFrom++}function d(e,t,i,n,s,a,r){return{token:e,type:t,valid:i,optional:n,parent:null,message:s,bestFn:a,info:r}}function u(e,t){return d(t,i,!0,!0,"",null,"")}function I(e){const t=e.parent;return t.nbParamParsed":{to:"arrayFilterRightOperand",desc:""},"<":{to:"arrayFilterRightOperand",desc:""},"!=":{to:"arrayFilterRightOperand",desc:""},...p},grandParentPathInArray:{".":{trigger:h,to:"grandParentPathInArray",desc:"Relative n-grandparent object/array"},"***":{capture:l(),to:"relativePathInArray"}},relativePathInArray:{".":{capture:g,to:"relativePathInArray"},...p},arrayFilterRightOperand:{"'":{capture:u,to:"endOfStringRightOperandInArray",desc:"Constant string (keep whitespaces)"},"..":{trigger:h,to:"grandParentPathInArray",desc:"Variable - Relative path to a parent object/array"},".":{capture:l(),to:"relativePathInArray",desc:"Variable - Relative path to a sibling attribute"},"***":{capture:u,to:"nextArrayFilterOrIteratorOrArrayEnd",desc:"Any other constant string"}},endOfStringRightOperandInArray:{"',":{to:"arrayFilterOrIterator"},"']":{to:"secondLevelAndHigher",exit:"insideArray"}}};function B(e,t,i,n,s){let a=n+1;s.isFound=!1,s.index=a,s.token="",s.nextStep=e["***"];for(const r in e)if("***"!==r){const o=t.indexOf(r,i);if(o>-1&&o0)i.push({token:n,sort:Number.MIN_SAFE_INTEGER+Number.MAX_SAFE_INTEGER/2+r,mark:[r,r+e.length]});else{const r=E(a,s);if(r<3)i.push({token:n,sort:r,mark:[]});else{const s=t[n],r=s?.desc?.toLowerCase()?.indexOf(a);r>-1&&i.push({token:n,sort:Number.MAX_SAFE_INTEGER/2+r,markDesc:[r,r+e.length]})}}}return i.sort(((e,t)=>e.sort-t.sort))}function E(e,t){var i=0,n=0,s=0,a=0,r=0;if(null===e||0===e.length)return null===t||0===t.length?0:t.length;if(null===t||0===t.length)return e.length;for(;i+s0;){const t=o.step;if(i=null,n=m[t.to],t.exit&&(o.parents.pop(),o.parent=o.parents[o.parents.length-1]??null),t.capture?(B(n,e,o.pos,e.length,a),i=t.capture?.(o,e.slice(o.pos,a.index)),t.enter?(o.parents.push(i),o.parent=i):(i.parent=o.parent,i.parentParam=o.parent?.nbParamParsed),o.parts.push(i)):B(n,e,o.pos,o.pos,a),!a.nextStep)break;!0===a.isFound?(o.parts.push(a.token),a.nextStep.trigger?.(o),o.pos=a.index+a.token.length,o.lastExpectedTokens=null):o.lastExpectedTokens=n,o.step=a.nextStep}const A=i?i.token:a.token,c=i?.choices??n,l=i?.bestFn?.(o,A,c)??[],g=[...r(o,n,i),...l];return{lastToken:A,parts:o.parts,best:g}},search:Q}}(),HQ={data:{},complement:{},formatters:yI.FORMATTERS};const OQ=function({state:e}){return[A("div",{class:"autoscroll-wrapper"},[A("div",{class:"autoscroll"},[A("div",{class:"medium-padding small-text"},[e.logs.map(((t,i)=>A("div",{class:`autoscroll-line animate-display-y row top-align ${this.isLast(i,e.logs)?"":"secondary-text"} ${"error"===t.type?"error-text":""}`},[A("div",{},[A("i",{class:`cico ${this.isLast(i,e.logs)&&"info"===t.type&&0===e.nbRequestRunning?PQ.lastInfo:PQ[t.type]} tiny`},"")]),A("div",{class:"max"},`\n ${t.message}\n `)]))),e.nbRequestRunning>0?A("div",{class:"autoscroll-line row top-align"},[A("div",{},[A("progress",{class:"circle tiny secondary-text"},"")])]):""])])])]},qQ=function({state:e}){return A("style",{},"\n \n \n c-preview-debugger {\n font-family: monospace;\n width:100%;\n }\n \n \n ")};let JQ=class extends S{init(){this.useShadowDOM=!0}get vdom(){return OQ}get vstyle(){return qQ}};const PQ={info:"cico-chevron-right",warn:"cico-orange-circle",error:"cico-red-circle",lastInfo:"cico-green-circle"};var YQ=new class extends lI{constructor(){super({chatMessages:[{isBot:!0,val:"Hello, how can I help you?"}],isWaitingResponse:!1,isChatOpen:!1})}rotatePush(e){this.state.chatMessages.push(e),this.state.chatMessages.length>30&&(this.state.chatMessages=this.state.chatMessages.slice(0,20))}send(e){this.rotatePush({isBot:!1,val:e}),this.ask(e),this.notify()}toggle(){!0===this.state.isChatOpen?this.state.isChatOpen=!1:this.state.isChatOpen=!0,this.notify()}async ask(e){const t={clipboard:mI.state,message:e};await uI.postJSON("/help",t).then((e=>e.json())).then((e=>{if(!e.success)throw e.error;e.data.clipboardText&&mI.update(e.data.clipboardText),this.rotatePush({isBot:!0,val:e.data.message})})).catch((e=>{II.error(e+""),this.rotatePush({isBot:!0,val:"An error occured. Please retry."})})).finally((()=>{this.notify()}))}};const KQ=function({state:e}){return[e.isChatOpen?A("div",{class:"chat-window"},[A("div",{class:"autoscroll-wrapper"},[A("div",{class:"autoscroll"},[A("div",{class:"small-text"},[e.chatMessages.map(((e,t)=>A("div",{class:"autoscroll-line animate-display-y row top-align secondary-text"},[A("div",{},[A("i",{class:"cico "+(!0===e.isBot?"cico-robot":"cico-person")},"")]),A("div",{class:"max"},[A("b",{},""+(!0===e.isBot?"Carbone IA":"You")),A("br",{},""),`\n ${e.val}\n `])]))),e.isWaitingResponse?A("div",{class:"autoscroll-line row top-align"},[A("div",{},[A("progress",{class:"circle tiny secondary-text"},"")])]):""])])]),A("div",{class:"row"},[A("div",{class:"field textarea border small large max suffix"},[A("textarea",{onkeyup:("function"==typeof onKeyUpChat?onKeyUpChat.bind(this):this.onKeyUpChat).bind(this),style:"overflow-wrap: anywhere; font-size: 0.8rem;"},""),A("i",{class:"cico cico-arrow-upward"},"")])])]):""]},VQ=function({state:e}){return A("style",{},"\n \n \n .chat-window {\n width: 350px;\n \n position: absolute;\n background: white;\n \n bottom: 0px;\n left: 0px;\n \n z-index: 10000;\n \n border-radius: .5rem;\n padding: 1rem;\n box-shadow: var(--elevate2);\n }\n \n .chat-window .autoscroll-wrapper {\n max-height: 320px;\n overflow-y: auto;\n overflow-x: hidden;\n display: flex; /* for autoscroll */\n }\n \n \n ")};let WQ=class extends S{init(){this.useShadowDOM=!0}get vdom(){return KQ}get vstyle(){return VQ}};const jQ=function({state:e}){return[A("header",{},[A("nav",{class:"surface-dim "},[e.file?"":A("div",{class:"tab"},"Template"),A("div",{class:"max"},""),"L"===e.editMode?A("nav",{},[e.file?A("div",{class:"secondary-text limit-filename",title:e?.file?.name??null},[A("i",{class:"cico cico-draft"},""),` ${e.file?.name??""}\n `,A("div",{class:"tooltip top"},"Local Filename")]):"",e.file?A("div",{class:"secondary-text"},[A("i",{class:"cico cico-sync"},""),` modified at ${this.getLastModifiedDate()}\n `]):"",e.file?A("button",{onclick:("function"==typeof onStopAutoUpload?onStopAutoUpload.bind(this):this.onStopAutoUpload).bind(this),class:"small border no-border secondary-text white"},[A("i",{class:"cico cico-stop"},""),A("span",{},"Stop auto-upload")]):"",e.file?"":A("a",{disabled:""===fI.state.idTemplateOpened,onmouseenter:("function"==typeof onTemplateDownloadHoverEnter?onTemplateDownloadHoverEnter.bind(this):this.onTemplateDownloadHoverEnter).bind(this),onmouseleave:("function"==typeof onTemplateDownloadHoverLeave?onTemplateDownloadHoverLeave.bind(this):this.onTemplateDownloadHoverLeave).bind(this),onclick:("function"==typeof onTemplateDownload?onTemplateDownload.bind(this):this.onTemplateDownload).bind(this),class:"button small "+(fI.state.idTemplateOpened?"":"transparent")},[A("i",{class:"cico cico-cloud-download"},""),A("span",{},"Download")]),e.file?"":A("button",{onmouseenter:("function"==typeof onTemplateUploadHoverEnter?onTemplateUploadHoverEnter.bind(this):this.onTemplateUploadHoverEnter).bind(this),onmouseleave:("function"==typeof onTemplateUploadHoverLeave?onTemplateUploadHoverLeave.bind(this):this.onTemplateUploadHoverLeave).bind(this),onclick:("function"==typeof onTemplateUpload?onTemplateUpload.bind(this):this.onTemplateUpload).bind(this),class:"small "+(fI.state.idTemplateOpened?"transparent":"")},[A("i",{class:"cico cico-cloud-upload"},""),A("span",{},"Upload")])]):"",e.file?"":A("button",{class:"visible-on-hover circle transparent"},[A("i",{class:`cico cico-${ZQ[e.editMode]}`},""),A("menu",{class:"visible-on-hover no-wrap leftbottom "},[A("a",{onclick:("function"==typeof onClickPanelChange?onClickPanelChange.bind(this):this.onClickPanelChange).bind(this),class:"row "+("L"===e.editMode?"active":""),"data-mode":"L"},[A("i",{class:"cico cico-computer"},""),A("span",{},"Local designer")]),A("a",{onclick:("function"==typeof onClickPanelChange?onClickPanelChange.bind(this):this.onClickPanelChange).bind(this),class:"row "+("G"===e.editMode?"active":""),"data-mode":"G"},[A("i",{class:"cico cico-magic"},""),A("span",{},"Template Generator")])])]),A("div",{},"")])]),"L"===e.editMode?A("c-template-local",{},""):"","O"===e.editMode?A("c-template-online",{},""):"","G"===e.editMode?A("c-template-generator",{},""):""]},_Q=function({state:e}){return A("style",{},"\n \n \n c-template-panel {\n display: flex; /* displays flex-items (children) inline */\n flex-direction: column; /* stacks them vertically */\n flex-grow: 1;\n }\n c-template-panel:not(.minimized) {\n position: absolute; /* disconnect the div -> allow overflow of tooltip even if the window is resized*/\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n }\n \n c-template-panel.minimized > c-template-local > main {\n display: none; /* avoid flickering, even if the main is removed with js */\n }\n \n .limit-filename {\n max-width: 200px;\n flex-shrink: revert !important;\n white-space: nowrap !important;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n \n \n ")};let XQ=class extends S{init(){this.useShadowDOM=!0}get vdom(){return jQ}get vstyle(){return _Q}};const ZQ={L:"computer",O:"cloud",G:"magic"},zQ={L:"templateIntro",O:"templateOnlineEdit",G:"templateGenerator"};const $Q=function({state:e}){return[A("main",{class:"large-padding center-align"},[A("div",{class:"grid animate-display-x",style:"width: 450px;"},[A("div",{class:"s12"},[A("div",{class:"large-space"},""),A("div",{},[A("h4",{class:"center-align"},"\n Template generation\n ")]),A("div",{class:"small-space"},""),A("nav",{class:"scroll"},[A("div",{class:"center-align"},[A("button",{class:"circle small",disabled:""},"1")]),A("div",{class:"max divider"},""),A("div",{class:"center-align"},[A("button",{class:"circle small "+(e.step>1?"":"secondary"),disabled:""},"2")]),A("div",{class:"max divider"},""),A("div",{class:"center-align"},[A("button",{class:"circle small "+(e.step>2?"":"secondary"),disabled:""},"3")])]),A("div",{class:"large-space"},""),1===e.step?A("div",{class:"left-align animate-display-x"},[A("div",{class:"tiny-space"},""),A("div",{},["Import a JSON data sample in the left panel",A("a",{href:""},"Show me ")]),A("div",{class:"tiny-space"},""),A("div",{},"And let our reverse-engineering AI generate the Carbone template for you!")]):"",2===e.step?A("div",{class:"left-align animate-display-x"},[A("div",{class:"field",style:"width: 250px;"},[A("c-search-select",{"selected-item":"DOCX","class-names":"small","id-dzzd":"","default-icon":"note-add","items-arr":e.outputFileTypes,"selected-fn":this.onSelectedOutputFiletype.bind(this)},""),A("span",{class:"helper"},"File type")]),A("div",{class:"field"},[A("nav",{class:"no-space no-padding"},[A("button",{class:"border left-round fill"},[A("span",{},"Neutral")]),A("button",{class:"border no-round secondary-text"},[A("span",{},"Influenced")]),A("button",{class:"border right-round secondary-text"},[A("span",{},"Constrained")])]),A("span",{class:"helper"},'Only "Neutral" style is available')])]):"",3===e.step?A("div",{class:"left-align animate-display-x"},[A("c-loading-animation-icon",{"message-success":""+(e.isGenerationInProgress&&!e.isUploadingTemplate?"Template successfully generated. Opening...":""),"message-off":"Template generation aborted. Please try again.","is-running":`${e.isGenerationInProgress}`})]):"",A("div",{class:"small-space"},""),A("div",{class:"row"},[e.step>1&&e.step<3?A("button",{onclick:("function"==typeof onBackButton?onBackButton.bind(this):this.onBackButton).bind(this),class:"transparent"},[A("i",{class:"cico cico-arrow-back"},""),A("span",{},"Back")]):"",A("div",{class:"max"},""),e.step<2?A("button",{onclick:("function"==typeof onNextButton?onNextButton.bind(this):this.onNextButton).bind(this)},[A("span",{},"Next"),A("i",{class:"cico cico-arrow-forward"},"")]):"",e.step>=2&&!e.isGenerationInProgress?A("button",{onclick:("function"==typeof onGenerateTemplate?onGenerateTemplate.bind(this):this.onGenerateTemplate).bind(this)},[A("i",{class:"cico cico-magic"},""),A("span",{},"Generate")]):"",e.isGenerationInProgress?A("progress",{value:`${e.progressBar}`,max:`${iE}`},""):""])])])])]},eE=function({state:e}){return A("style",{},'\n \n \n \n c-template-generator {\n width:100%;\n overflow: auto;\n flex: 1; /* force height 100% */\n display: flex; /* displays flex-items (children) inline */\n /*flex-direction: column; */ /* stacks them vertically */\n }\n main {\n flex: 1; /* takes the remaining height of the "container" div */\n display: flex;\n }\n \n progress[value]::-webkit-progress-value {\n transition: width 0.5s;\n }\n \n \n \n ')};let tE=class extends S{init(){this.useShadowDOM=!0}get vdom(){return $Q}get vstyle(){return eE}};const iE=6e4,nE=1e3;const sE=function({state:e}){return[A("object",{type:e.objectType,data:e.lastRenderUrl+`#toolbar=${e.showBrowserToolbar}&page=`+(e.errorPageNumber>0?e.errorPageNumber:e.defaultPageNumber),style:"height: 100%; width: 100%; "},"")]},aE=function({state:e}){return A("style",{},"\n \n \n c-preview-native-pdf-viewer {\n width: 100%;\n height: 100%;\n }\n /* deactivate pointer event on object when user is resizing the panel to avoid a bug */\n .resizing object {\n pointer-events:none;\n }\n \n ")};let rE=class extends S{init(){this.useShadowDOM=!0}get vdom(){return sE}get vstyle(){return aE}};const oE=function({state:e}){return[A("header",{class:"preview-pdf-viewer-background-light inverse-surface"},[A("nav",{},[A("div",{class:"tab preview-pdf-viewer-background",style:"border-color:var(--tab-preview-border-color)"},["Preview ",A("span",{class:"small-text"},`${dE[e.viewerSelected].text}`)]),A("progress",{class:`circle small inverse-surface ${e.nbRequestRunning>0?"":"hide"} `},""),A("div",{class:"max"},[A("div",{class:"center-align small-gap"},[e.viewerSelected===gE&&!0===e.useEmbeddedPDFViewer?A("div",{class:"row center-align small-gap"},[A("div",{class:"field border tiny",style:"width: 36px;"},[A("input",{onclick:("function"==typeof onSetPageNumberClick?onSetPageNumberClick.bind(this):this.onSetPageNumberClick).bind(this),onchange:("function"==typeof onSetPageNumberChange?onSetPageNumberChange.bind(this):this.onSetPageNumberChange).bind(this),value:e.currentPageNumber,id:"pdfPageNumber",class:"no-padding",type:"number",style:"text-align: right; font-size: var(--global-font-size); border:none; background: var(--chrome-pdf-viewer-background); padding-right: 0.25rem !important;"},"")])," / \n ",A("div",{id:"pdfPageCount"},"0"),A("div",{class:"medium-space"},""),A("button",{onclick:("function"==typeof onZoomOut?onZoomOut.bind(this):this.onZoomOut).bind(this),class:"visible-on-hover circle transparent"},[A("i",{class:"cico cico-zoom-out"},"")]),A("button",{onclick:("function"==typeof onZoomIn?onZoomIn.bind(this):this.onZoomIn).bind(this),class:"visible-on-hover circle transparent"},[A("i",{class:"cico cico-zoom-in"},"")])]):""])]),""!==uI.state?.testToken?A("label",{class:"switch",onclick:("function"==typeof switchUpdateApiKey?switchUpdateApiKey.bind(this):this.switchUpdateApiKey).bind(this)},[A("input",{type:"checkbox",checked:!0===e.free?null:"true",disabled:""===uI.state.prodToken},""),A("span",{},""),A("div",{class:"tooltip bottom max small-space"},[!0===e.free?A("span",{},[A("b",{},"Free Preview with Watermark"),A("p",{},["You can create PDFs with watermarks without using any document credits from your Carbone Cloud subscription.",A("br",{},""),A("br",{},""),""===uI.state.prodToken?A("span",{},"To generate documents in all formats without watermarks, you must subscribe to a Carbone Cloud plan:"):"",""!==uI.state.prodToken?A("span",{},"To generate documents in all formats without watermarks, simply toggle the switch. Please note that this will use document credits from your subscription quota."):""]),""===uI.state.prodToken?A("nav",{},[A("a",{class:"inverse-link",href:"https://account.carbone.io/plans?st=0&idp=355329978948510477"},"Enable Free Carbone Cloud Plan")]):""]):"",!1===e.free?A("span",{},[A("b",{},"Paid Preview without watermarks"),A("p",{},["You can create all types of documents without watermarks, which will use document credits from your Carbone Cloud subscription.",A("br",{},""),A("br",{},""),"To generate free PDFs without watermarks and avoid using credits, simply toggle the switch."])]):""])]):"",e.templateExtension?A("button",{class:"visible-on-hover circle transparent"},[A("i",{class:"cico cico-download"},""),A("div",{class:"tooltip max bottom leftbottom surface large-padding"},[A("h4",{class:"small"},[A("i",{class:"cico cico-download right-margin"},"")," Download"]),A("div",{class:"medium-space"},""),A("div",{class:"output-file-grid"},[(yI.INPUT_OUTPUT[e.templateExtension]??[]).map((e=>A("a",{onclick:("function"==typeof onDownloadFile?onDownloadFile.bind(this):this.onDownloadFile).bind(this),class:"chip round large left-align no-margin","data-extension":`${e}`},[A("c-file-icon",{style:"border-radius: initial","file-extension":`${e}`,"icon-class":"extra","show-text-if-no-icon":"false"},""),A("span",{},`${e.toUpperCase()}`)])))])])]):"",A("button",{class:"visible-on-hover circle transparent"},[A("i",{style:"font-family:monospace; font-size: 1rem;"},`${uE[e.apiSelected].icon}`),A("div",{class:"tooltip max bottom leftbottom surface large-padding"},[A("h4",{class:"small"},"Rendering options"),A("fieldset",{},[A("legend",{},"Carbone API Version"),A("c-radio-button",{"group-name":"api","items-arr":e.apiList,"selected-fn":this.onSelectedApi.bind(this),"selected-item":e.apiSelected},"")]),A("fieldset",{},[A("legend",{},"Document Converter"),A("c-radio-button",{"group-name":"conv","items-arr":e.converterList,"selected-fn":this.onSelectedConverter.bind(this),"selected-item":e.converterSelected},"")])])]),A("button",{class:"visible-on-hover circle transparent"},[A("c-lang-icon",{"locale-string":e.lang},""),A("div",{class:"tooltip max bottom leftbottom surface large-padding"},[A("h4",{class:"small"},"Localization"),A("div",{class:"medium-space"},""),A("c-search-select",{"selected-item":`${e.lang}`,"default-icon":"language","items-arr":e.locales,"selected-fn":this.onSelectedLocale.bind(this)},""),A("c-search-select",{"selected-item":[e.currencySource,e.currencySourceLabel],"value-fn":this.formatCurrency.bind(this),"items-arr":e.currencies,"selected-fn":this.onSelectedCurrency.bind(this),"default-icon":"currency-exchange"},""),A("c-search-select",{"selected-item":`${e.timezone}`,"items-arr":e.timezones,"selected-fn":this.onSelectedTimezone.bind(this),"default-icon":"schedule"},"")])]),A("button",{class:"visible-on-hover circle transparent"},[A("i",{class:"cico cico-visibility-setting"},""),A("div",{class:"tooltip max bottom leftbottom surface large-padding"},[A("h4",{class:"small"},"Preview options"),A("fieldset",{},[A("legend",{},"Preview as"),A("c-radio-button",{"group-name":"pr","items-arr":e.viewerList,"selected-fn":this.onSelectedViewer.bind(this),"selected-item":e.viewerSelected},"")]),A("nav",{class:"no-padding"},[A("label",{class:"switch icon"},[A("input",{onchange:("function"==typeof onChangeHideDebuggerIfNoError?onChangeHideDebuggerIfNoError.bind(this):this.onChangeHideDebuggerIfNoError).bind(this),type:"checkbox",checked:e.hideDebuggerIfNoError},""),A("span",{},[A("i",{},""),A("i",{},"")])]),A("div",{class:"max"},[A("div",{},"Automatically hide debugger if no errors")])]),A("nav",{class:"no-padding"},[A("label",{class:"switch icon"},[A("input",{onchange:("function"==typeof onChangeUseEmbeddedPDFViewer?onChangeUseEmbeddedPDFViewer.bind(this):this.onChangeUseEmbeddedPDFViewer).bind(this),type:"checkbox",checked:e.useEmbeddedPDFViewer},""),A("span",{},[A("i",{},""),A("i",{},"")])]),A("div",{class:"max"},[A("div",{},["Use embedded PDF viewer",A("br",{},""),"Best user experience"])])]),A("nav",{class:"no-padding"},[A("label",{class:"switch icon"},[A("input",{onchange:("function"==typeof onChangeMakeSoundOnError?onChangeMakeSoundOnError.bind(this):this.onChangeMakeSoundOnError).bind(this),type:"checkbox",checked:e.makeSoundOnError},""),A("span",{},[A("i",{},""),A("i",{},"")])]),A("div",{class:"max"},[A("div",{},"Make errors less serious with a random fart sound")])])])]),A("div",{},"")])]),A("main",{class:"preview-pdf-viewer-background",style:"width:100%;height: 100%;"},[A("c-flex",{class:"v",style:"width:100%;"},[this.hideDebugger()?"":A("c-flex-panel",{class:"debugger inverse-surface",style:""},[A("c-preview-debugger",{},"")]),this.hideDebugger()?"":A("c-flex-resizer",{},""),A("c-flex-panel",{style:"flex: 4"},[e.viewerSelected===hE&&!e.isRunning&&e.lastRenderUrl?A("c-preview-html-viewer",{class:"padding"},""):"",e.viewerSelected===gE&&!1===e.useEmbeddedPDFViewer&&!e.isRunning&&e.lastRenderUrl?A("c-preview-native-pdf-viewer",{},""):"",e.viewerSelected===gE&&!0===e.useEmbeddedPDFViewer?A("c-preview-embedded-pdf-viewer",{"load-fn":this.onPDFLoaded.bind(this),"page-change-fn":this.onPageNumber.bind(this)},""):"",e.isRunning||!e.lastRenderUrl?A("c-loading-animation-icon",{"is-running":`${e.isRunning}`,style:"position: absolute;"},""):"",!1===e.isPreviewUpToDate&&e.idTemplateOpened&&!e.isRunning?A("div",{class:"refresh-overlay",style:"position:absolute;width:100%; height:100%;"},[A("div",{class:"middle-align center-align",style:"height: 100%; width: 100%;"},[A("div",{class:"center-align white-text animate-display-y"},[A("button",{onclick:("function"==typeof onClickRefreshPreview?onClickRefreshPreview.bind(this):this.onClickRefreshPreview).bind(this),class:"no-border secondary-text white"},[A("i",{class:"cico cico-refresh"},""),A("span",{},["Refresh ",A("c-shortcut",{"shortcut-modifier":"ctrl","shortcut-letter":"s"},"")])])])])]):""])])])]},AE=function({state:e}){return A("style",{},"\n \n \n c-preview {\n width:100%;\n /*height:100%;*/\n display: flex;\n flex-direction: column;\n }\n /* deactivate pointer event on object when user is resizing the panel to avoid a bug */\n .resizing object {\n pointer-events:none;\n }\n c-flex-panel.debugger {\n animation: show 300ms 1ms ease-out forwards;\n flex: 0.5;\n overflow: hidden; /* to avoid dynamic resizing of the panel when new logs are added */\n }\n @keyframes show {\n 100% {\n flex: 1;\n opacity: 1;\n }\n }\n .refresh-overlay {\n position: absolute;\n width: 100%;\n height: 100%;\n background: #323639bd;\n }\n .output-file-grid {\n display: grid;\n grid-column-gap: var(---padding);\n grid-row-gap: var(---padding);\n grid-template-columns: repeat(2, 1fr);\n justify-content: space-between;\n }\n \n .pdf-viewer-control {\n display: contents;\n }\n \n /* Defined in the parent div because it cannot be set inside the shadow dom */\n c-preview-embedded-pdf-viewer {\n width: 100%;\n height: 100%;\n overflow: hidden; /* Important! we must scroll with the inner div \"viewerContainer\" for PDF.js */\n }\n \n progress.hide {\n /* stop and make the progress invisible\n to keep centered icon (for PDF viewer) in the center */\n border-style: none !important;\n animation: none !important;\n }\n \n .switch>input:checked+span:before {\n content: '' !important;\n }\n \n ")};let cE=class extends S{init(){this.useShadowDOM=!0}get vdom(){return oE}get vstyle(){return AE}},lE=0;const gE=0,hE=2,dE=[{text:"PDF",disabled:!1,convertTo:"pdf"},{text:"XML/TXT",disabled:!0,convertTo:""},{text:"HTML",disabled:!1,convertTo:"html"}],uE=[{text:"v5+",value:"5",icon:"V5"},{text:"v4+",value:"4",icon:"V4"},{text:"v3+",value:"3",icon:"V3"},{text:"staging (dev)",value:"staging",icon:"VS"}],IE=["L","O","C"],fE=[{text:"LibreOffice",disabled:!1,icon:"L"},{text:"OnlyOffice",disabled:!1,icon:"O"},{text:"Chromium",disabled:!1,icon:"C"}];const CE=function({state:e}){return[A("iframe",{id:"result",title:"Carbone preview",src:e.lastRenderUrl,sandbox:"",allow:"",scrolling:"auto",loading:"lazy"})]},pE=function({state:e}){return A("style",{},"\n \n \n c-preview-html-viewer {\n width: 100%;\n height: 100%;\n }\n iframe {\n width: 100%;\n height: 100%;\n background: white;\n border: none;\n }\n \n ")};let mE=class extends S{init(){this.useShadowDOM=!0}get vdom(){return CE}get vstyle(){return pE}};const BE=function({state:e}){return[A("header",{},[A("nav",{class:"surface-dim"},[A("div",{class:"tab",style:"text-transform: capitalize;"},`${e.target}`),A("div",{class:"max"},""),0!==Object.keys(e.data).length&&0!==e.data?.length||!e.debug?.sample?.data||e.isDataUpdatedByUser?"":A("button",{onclick:("function"==typeof onGenerateJson?onGenerateJson.bind(this):this.onGenerateJson).bind(this),class:"small active secondary"},[A("i",{class:"cico cico-place-item"},""),A("span",{},"Generate JSON")]),!0===e.expertMode?A("button",{id:"buttonTextSearch",class:"circle transparent"},[A("i",{class:"cico secondary-text cico-search"},""),A("div",{class:"tooltip max bottom leftbottom surface"},[A("div",{class:"field border small no-margin"},[A("input",{id:"inputTextSearch",value:e.searchedText,onblur:("function"==typeof onBlurSearchInput?onBlurSearchInput.bind(this):this.onBlurSearchInput).bind(this),onkeyup:("function"==typeof onChangeSearchInput?onChangeSearchInput.bind(this):this.onChangeSearchInput).bind(this),onkeydown:("function"==typeof onKeyDownSearchInput?onKeyDownSearchInput.bind(this):this.onKeyDownSearchInput).bind(this),type:"text",placeholder:"Type to search + press Enter"},""),A("a",{onclick:("function"==typeof onClickResetSearchInput?onClickResetSearchInput.bind(this):this.onClickResetSearchInput).bind(this)},A("i",{class:"cico cico-close"},""))])])]):"",A("button",{class:"visible-on-hover circle transparent secondary-text cico-text-icon"},[`\n ${bE[e.target]}\n `,A("menu",{class:"visible-on-hover no-wrap leftbottom "},[A("a",{onclick:("function"==typeof onClickDataTargetChange?onClickDataTargetChange.bind(this):this.onClickDataTargetChange).bind(this),class:"row "+("data"===e.target?"active":""),"data-mode":"data"},[A("span",{},["Data ",A("code",{class:"transparent tertiary-text"},"{d.")])]),A("a",{onclick:("function"==typeof onClickDataTargetChange?onClickDataTargetChange.bind(this):this.onClickDataTargetChange).bind(this),class:"row "+("complement"===e.target?"active":""),"data-mode":"complement"},[A("span",{},["Complement ",A("code",{class:"transparent tertiary-text"},"{c.")])]),A("a",{onclick:("function"==typeof onClickDataTargetChange?onClickDataTargetChange.bind(this):this.onClickDataTargetChange).bind(this),class:"row "+("enum"===e.target?"active":""),"data-mode":"enum"},[A("span",{},["Enum ",A("code",{class:"transparent tertiary-text"},":convEnum")])]),A("a",{onclick:("function"==typeof onClickDataTargetChange?onClickDataTargetChange.bind(this):this.onClickDataTargetChange).bind(this),class:"row "+("translations"===e.target?"active":""),"data-mode":"translations"},[A("span",{},["Translations ",A("code",{class:"transparent tertiary-text"},"{t()}")])])])]),A("nav",{class:"no-space"},[A("button",{onclick:("function"==typeof onExpertMode?onExpertMode.bind(this):this.onExpertMode).bind(this),class:"border secondary-text left-round small "+(e.expertMode?"white no-wave":"transparent"),style:"border-color:white;"},[A("i",{class:"cico cico-edit"},""),A("div",{class:"tooltip bottom"},"Data Editor")]),A("button",{onclick:("function"==typeof onSimpleMode?onSimpleMode.bind(this):this.onSimpleMode).bind(this),class:"border secondary-text right-round small "+(e.expertMode?"transparent ":"white no-wave"),style:"border-color:white;"},[A("i",{class:"cico cico-format-paint"},""),A("div",{class:"tooltip bottom"},"Data Viewer")])]),A("div",{},"")])]),A("main",{style:"width:100%; background-color:#FFF;"},[!0===e.expertMode?A("c-json-editor",{"json-source":e.target,"json-hash":e.jsonHash,"get-fn":this.getDataStringified.bind(this),"update-fn":this.onDataUpdatedByUser.bind(this),"loaded-fn":this.onEditorLoaded.bind(this),"scroll-pos":yE[e.expertMode][e.target]},""):"",!1===e.expertMode?A("c-json-viewer",{"json-source":e.target,"json-hash":e.jsonHash,"get-fn":this.getDataReference.bind(this),"update-fn":this.onDataUpdatedByUser.bind(this),"loaded-fn":this.onEditorLoaded.bind(this),"scroll-pos":yE[e.expertMode][e.target],"selected-path-fn":this.onCopiedTag.bind(this)},""):""]),!1===e.expertMode?A("footer",{class:"surface-dim no-padding"},[A("c-data-clipboard",{},""),A("div",{class:"tiny-space"},"")]):""]},QE=function({state:e}){return A("style",{},'\n \n \n c-data-editor {\n width:100%;\n height:100%;\n /* ----------- */\n display: flex; /* displays flex-items (children) inline */\n flex-direction: column; /* stacks them vertically */\n }\n main {\n flex: 1; /* takes the remaining height of the "container" div */\n overflow: auto; /* to scroll just the "main" div */\n }\n .userchat {\n margin-left: 50%;\n }\n .verysmall {\n height: 7rem;\n }\n .field.verysmall {\n height: 1.5rem;\n }\n .zero-height {\n height: 0rem;\n }\n \n \n \n ')};let EE=class extends S{init(){this.useShadowDOM=!0}get vdom(){return BE}get vstyle(){return QE}};const bE={data:"{d}",complement:"{c}",enum:"{e}",translations:"{t}"},yE={true:{},false:{}};const wE=function({state:e}){return[A("header",{},[A("nav",{class:"surface-dim "},[A("div",{class:"tab"},"Clipboard"),A("div",{class:"max"},""),A("button",{class:"visible-on-hover transparent circle"},[A("i",{class:`cico cico-${vE[e.clipboardMode]}`},""),A("menu",{class:"visible-on-hover no-wrap",style:"transform: scale(1) translate(-10px, -45px);"},[A("a",{onclick:("function"==typeof onModeSwitch?onModeSwitch.bind(this):this.onModeSwitch).bind(this),class:"row "+("T"===e.clipboardMode?"active":""),"data-mode":"T"},[A("i",{class:`cico cico-${vE.T}`},""),A("span",{},"Text")]),A("a",{onclick:("function"==typeof onModeSwitch?onModeSwitch.bind(this):this.onModeSwitch).bind(this),class:"row "+("I"===e.clipboardMode?"active":""),"data-mode":"I"},[A("i",{class:`cico cico-${vE.I}`},""),A("span",{},"Image")]),A("a",{onclick:("function"==typeof onModeSwitch?onModeSwitch.bind(this):this.onModeSwitch).bind(this),class:"row "+("B"===e.clipboardMode?"active":""),"data-mode":"B"},[A("i",{class:`cico cico-${vE.B}`},""),A("span",{},"Barcode")])])])])]),A("main",{class:"white"},[A("c-data-clipboard-input",{},"")])]},kE=function({state:e}){return A("style",{},"\n \n \n c-data-clipboard-input {\n /*width: 100%;*/\n height: 100px;\n }\n \n /*.opacity-transition {\n transition: opacity 0.2s linear;\n }*/\n \n \n ")};let SE=class extends S{init(){this.useShadowDOM=!0}get vdom(){return wE}get vstyle(){return kE}};const vE={T:"text-fields",I:"image",B:"barcode"};const DE=function({state:e}){return[e.file?"":A("main",{ondragenter:("function"==typeof onDragEnterTemplate?onDragEnterTemplate.bind(this):this.onDragEnterTemplate).bind(this)},[A("div",{ondragleave:("function"==typeof onDragLeaveOverlay?onDragLeaveOverlay.bind(this):this.onDragLeaveOverlay).bind(this),ondragover:("function"==typeof onDragOverOverlay?onDragOverOverlay.bind(this):this.onDragOverOverlay).bind(this),ondrop:("function"==typeof onDropOverlay?onDropOverlay.bind(this):this.onDropOverlay).bind(this),class:"drag-overlay"},""),A("div",{class:"grid large-view medium-padding no-margin"},[A("div",{class:"s5 right-align"},[A("div",{class:"middle-align small-padding tertiary-text"},[""===e.animationMode&&e.idTemplateOpened?A("span",{class:"animate-display-x"},["Download the template",A("br",{},""),"to customize the design"]):"",""!==e.animationMode||e.idTemplateOpened?"":A("span",{class:"animate-display-x"},["Upload",A("br",{},""),"or drag and drop",A("br",{},""),"a new template"]),""!==e.animationMode?A("span",{class:"animate-display-x"},["Edit and save",A("br",{},""),"The preview updates automatically"]):""])]),A("div",{class:"s7"},[A("div",{class:"template-anim-container"},[A("c-template-edit-animation-icon",{"animation-mode":`${e.animationMode}`,"auto-upload-enable":e.hasBrowserFilePicker?"on":"off","thumbnail-click-fn":e.idTemplateOpened?this.onTemplateDownload.bind(this):this.onTemplateUpload.bind(this),"thumbnail-over-fn":e.idTemplateOpened?this.onTemplateDownloadHoverEnter.bind(this):this.onTemplateUploadHoverEnter.bind(this),"thumbnail-leave-fn":e.idTemplateOpened?this.onTemplateDownloadHoverLeave.bind(this):this.onTemplateUploadHoverLeave.bind(this),"template-thumbnail-url":e.idTemplateOpened?fI.getThumbnailURL():"","template-extension":e.idTemplateOpened?e.templateExtension:""})])])])])]},xE=function({state:e}){return A("style",{},'\n \n \n c-template-local {\n width:100%;\n flex: 1; /* force height 100% */\n display: flex; /* displays flex-items (children) inline */\n flex-direction: column; /* stacks them vertically */\n \n overflow: auto;\n }\n main {\n flex-grow: 1; /* takes the remaining height of the "container" div */\n display: flex;\n overflow: auto; /* to scroll just the "main" div */\n position: relative;\n }\n c-template-local > main > .large-view {\n flex-grow: 1; /* use all height */\n justify-content: center;\n }\n c-template-local > main > .large-view > div {\n display: flex; \n height: 100%;\n }\n .switch .auto-upload-switch:checked+span:after {\n border: none;\n background: linear-gradient(to left, #d64dfa, #a5e9ff);\n }\n .large-view {\n padding: 5%; \n }\n .template-anim-container {\n margin-right: auto; /* left align */\n display: flex; /* center vertically */\n width: 100%;\n }\n .drag-overlay {\n display:none;\n }\n .dragover > .drag-overlay {\n display: block;\n content:"";\n position: absolute;\n z-index: 100;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.05);\n margin: 20px;\n border-radius: 20px;\n }\n .dragover .auto-upload-error {\n display: none;\n }\n \n \n ')};class FE extends S{init(){this.useShadowDOM=!0}get vdom(){return DE}get vstyle(){return xE}}customElements.define("c-file-icon",class extends x{init(){this.useShadowDOM=!1,this.state={fileExtension:"docx",iconClass:"",showTextIfNoIcon:!0}}}),customElements.define("c-search-select",class extends G{init(){this.useShadowDOM=!1,this.state={selectedItem:"",itemsArr:[],defaultIcon:"currency-exchange",selectedFn:e=>{},valueFn:e=>e,iconFn:null,classNames:"large",_searchText:"",_items:[],_currentFocus:0},this._secondInputNode=null,this._firstInputNode=null,this._uid=R.getUID()}connected(){this._firstInputNode=this.document.querySelector("#firstInput"+this._uid),this._secondInputNode=this.document.querySelector("#secondInput"+this._uid)}onInputFocus(e){e.stopPropagation(),e.currentTarget.value="",this.state._items=this.state.itemsArr,this.render(this.state)}onLeave(e){e.stopPropagation(),this._firstInputNode.value=this.state.valueFn(this.state.selectedItem),this._secondInputNode.value=""}scrollToItem(e){const t=this.document.querySelector(`[data-i="${e}"]`);t?.scrollIntoView({behavior:"instant",block:"nearest"})}onKeyDown(e){switch(e.stopPropagation(),e.key){case"ArrowDown":e.preventDefault(),this.state._currentFocus=Math.min(this.state._items.length-1,this.state._currentFocus+1),this.debounce(this.scrollToItem,5,this.state._currentFocus),this.render(this.state);break;case"ArrowUp":e.preventDefault(),this.state._currentFocus=Math.max(0,this.state._currentFocus-1),this.debounce(this.scrollToItem,5,this.state._currentFocus),this.render(this.state);break;case"Enter":return e.preventDefault(),this.selectItem(this.state._currentFocus)}}onKeyUp(e){if("Enter"===e.key)return e.stopPropagation(),void e.preventDefault();const t=e.target.value;if(e.target!==this._secondInputNode&&(this._secondInputNode.value=t),t.length>0){const e=t.toLowerCase();this.state._items=this.state.itemsArr.filter((t=>-1!==this.state.valueFn(t).toLowerCase().indexOf(e))),this.render(this.state)}}onSelect(e){e.stopPropagation(),this.selectItem(e.currentTarget.dataset.i)}selectItem(e){this._firstInputNode.blur(),this._secondInputNode.blur(),this.state.selectedItem=this.state._items[e],this.state.selectedFn(this.state.selectedItem),this.render(this.state)}}),customElements.define("c-flex-resizer",class extends T{init(){this.useShadowDOM=!1}onMouseEvent(e){var t=e.currentTarget.parentNode.parentNode,i=t.classList.contains("h"),n=t.classList.contains("v");i&&n||(i?this.manageResize(e,"offsetWidth","pageX"):n&&this.manageResize(e,"offsetHeight","pageY"))}manageResize(e,t,i){const n=e.currentTarget.parentNode,s=n.parentNode,a=n.previousElementSibling,r=n.nextElementSibling;if(!a||!r)return;e.preventDefault();var o=a[t],A=r[t];const c=o+A,l=Number(a.style.flexGrow)+Number(r.style.flexGrow);var g=e[i];function h(e){var t=e[i];const n=t-g;A-=n,(o+=n)<0&&(A+=o,t-=o,o=0),A<0&&(o+=A,t+=A,A=0);const s=l*(o/c),h=l*(A/c);a.style.flexGrow=s,r.style.flexGrow=h,g=t}window.addEventListener("mousemove",h),window.addEventListener("mouseup",(function e(t){window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",e),s.classList.add("animate"),s.classList.remove("resizing")})),s.classList.remove("animate"),s.classList.add("resizing")}}),customElements.define("c-lang-icon",class extends q{init(){this.useShadowDOM=!1,this.state={localeString:"fr-FR"}}formatLocaleStringTwoLetter(e){return e.slice(0,2).toUpperCase()}}),customElements.define("c-template-edit-animation-icon",class extends Y{init(){this.useShadowDOM=!1,this.state={templateThumbnailUrl:"",templateExtension:"",animationMode:"",thumbnailClickFn:()=>{},thumbnailOverFn:()=>{},thumbnailLeaveFn:()=>{},autoUploadEnable:"on"}}onThumbnailOver(e){this.state?.thumbnailOverFn(e)}onThumbnailLeave(e){this.state?.thumbnailLeaveFn(e)}thumbnailClickFn(e){this.state?.thumbnailClickFn(e)}}),customElements.define("c-json-editor",class extends Vu{init(){this.useShadowDOM=!1,this.editorView=null,this.state={updateFn:()=>{},getFn:e=>{},loadedFn:e=>{},jsonString:"",jsonSource:"",jsonHash:"",scrollPos:{}}}connected(){let e=Pa.theme({".cm-activeLine":{backgroundColor:"var(--json-editor-active-line)"},"&.cm-focused > .cm-scroller .cm-matchingBracket":{backgroundColor:"var(--json-editor-active-bracket)"},".cm-searchMatch":{backgroundColor:"var(--json-editor-search-match)"},".cm-searchMatch-selected":{backgroundColor:"var(--json-editor-search-match-selected)"}});const t=function(e){return e?[_o.of(e),xA]:xA}({caseSensitive:!1,scrollToMatch:e=>Pa.scrollIntoView(e),createPanel:e=>({dom:document.createElement("div")})}),i=[wo(),vo,kr(),Cg(),Dl(),hr(),$c.of(" "),It.allowMultipleSelections.of(!0),gl(),Vl(),Qd(),Nr(),Fr,Za.of([Fh,...Sd,...xh,...Ng,...bA]),new Zc(Pu),zd((e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;const i=function(e,t){let i;return(i=e.message.match(/at position (\d+)/))?Math.min(+i[1],t.length):(i=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+i[1]).from+ +i[2]-1,t.length):0}(t,e.state.doc);return[{from:i,message:t.message,severity:"error",to:i}]}return[]})),pu(),Gl(Ll,{fallback:!0}),Pa.updateListener.of(this.onEditorUserChange.bind(this)),t,e],n=It.create({doc:this.state.getFn(this.state.jsonSource),extensions:i});this.editorView=new Pa({state:n,parent:this.firstChild,scrollTo:this.state.scrollPos}),this.state.loadedFn(this.onGetScroll.bind(this),this.searchText.bind(this),this.findNext.bind(this),this.findPrevious.bind(this))}disconnected(){this.editorView.destroy()}changed(e,t){e.jsonSource===t.jsonSource&&e.jsonHash===t.jsonHash||this.editorView.dispatch({changes:{from:0,to:this.editorView.state.doc.length,insert:this.state.getFn(e.jsonSource)}}),e.scrollPos&&e.scrollPos!==t.scrollPos&&this.editorView.dispatch({effects:e.scrollPos})}onGetScroll(){return this.editorView.scrollSnapshot()}onEditorUserChange(e){if(!0===e.docChanged){const t=e.transactions[0];t.isUserEvent(t.annotations[0].value)&&this.state.updateFn(this.getAndCleanJSON.bind(this))}}searchText(e){QA(this.editorView);const t=new Xo({search:e,caseSensitive:!1,regexp:!1,wholeWord:!1});this.editorView.dispatch({effects:sA.of(t)})}findNext(){hA(this.editorView)}findPrevious(){findPrevious(this.editorView)}getAndCleanJSON(){let e=this.editorView.state.doc.toString(),t=null;""===e&&(e="{}");try{t=JSON.parse(e)}catch(i){try{const i=Wu(e);t=JSON.parse(i)}catch(e){return{err:e}}}const i=JSON.stringify(t,null,2);this.state.jsonString=i;const n=this.editorView.state.selection;return this.editorView.dispatch({changes:{from:0,to:this.editorView.state.doc.length,insert:i}}),n?.ranges?.[0]?.to>=i.length&&(n.ranges[0].from=n.ranges[0].to=i.length),this.editorView.dispatch({selection:n}),{err:null,jsonParsed:t}}}),customElements.define("c-loading-animation-icon",class extends Xu{init(){this.useShadowDOM=!1,this.state={isRunning:"false",messageOff:"No preview available.",messageSuccess:""}}}),customElements.define("c-edit-download-icon",class extends $u{init(){this.useShadowDOM=!1,this.state={isRunning:"false"}}}),customElements.define("c-radio-button",class extends iI{init(){this.useShadowDOM=!1,this.state={selectedItem:0,itemsArr:[],selectedFn:e=>{},groupName:""}}onSelect(e){e.stopPropagation(),this.state.selectedItem=parseInt(e.currentTarget.value,10),this.state.selectedFn(this.state.selectedItem)}}),customElements.define("c-shortcut",class extends aI{init(){this.useShadowDOM=!1,this.state={shortcutModifier:"ctrl",shortcutLetter:"s"}}}),customElements.define("c-json-viewer",class extends cI{init(){this.useShadowDOM=!1,this.state={updateFn:e=>{},selectedPathFn:e=>{},getFn:e=>{},loadedFn:e=>{},jsonSource:"",_jsonParsed:{},jsonHash:"",scrollPos:0},this.mousePosition={x:0,y:0},this.boundMouseEventHandler=this.onMouseMove.bind(this),this.rootNode=null}connected(){window.addEventListener("mousemove",this.boundMouseEventHandler),this.rootNode=this.getRootNode(),this.state._jsonParsed=this.state.getFn(this.state.jsonSource),this.state.loadedFn(this.onGetScroll.bind(this)),this.render(this.state),this.state.scrollPos&&setTimeout((()=>{this.firstChild.parentNode.parentNode.scrollTop=this.state.scrollPos}),80)}disconnected(){window.removeEventListener("mousemove",this.boundMouseEventHandler)}changed(e,t){e.jsonSource===t.jsonSource&&e.jsonHash===t.jsonHash||(this.state._jsonParsed=this.state.getFn(e.jsonSource))}get vdom(){return function({state:e}){const t=[],i=this.state.jsonSource.slice(0,1);return this.renderJsonNode(this.state._jsonParsed,[i],i,t),[A("div",{class:"no-code-data overflow small-padding"},t)]}}onGetScroll(){return this.firstChild.parentNode.parentNode.scrollTop}renderJsonNode(e,t=["d"],i="d",n,s){const a=[];if(e instanceof Array){n.push(A("details",{class:"treenav is-expandable",open:""},a)),a.push(A("summary",{class:"treenav-title"},i)),this.renderJsonNode(e[0],[...t,"[i]"],"[i]",a);let s=1===e.length?0:1;this.renderJsonNode(e[s],[...t,"[i+1]"],"[i+1]",a)}else if("object"==typeof e&&null!==e){t.slice(-2).join(),n.push(A("details",{class:"treenav is-expandable",open:""},a)),a.push(A("summary",{class:"treenav-title"},i));for(let i in e)this.renderJsonNode(e[i],[...t,`.${i}`],i,a,e)}else n.push(A("div",{class:"treenav"},[A("div",{class:"row"},[A("div",{class:"tiny-padding autoselect code primary-text",onclick:this.onClickToValue.bind(this,t.join(""),e)},`${i} : `),A("div",{class:"field verysmall max grey-text"},[A("input",{class:"no-border no-padding value",value:e,oninput:this.onValueChange.bind(this,s,i)},"")])])]))}onMouseMove(e){this.mousePosition.x=e.clientX,this.mousePosition.y=e.clientY}onValueChange(e,t,i){e[t]!==i.currentTarget.value&&(e[t]=i.currentTarget.value,this.state.updateFn(this.getJSON.bind(this)))}getJSON(e){return{err:null,jsonParsed:this.state._jsonParsed}}onClickToValue(e,t,i){i.preventDefault(),i.target.classList.add("copy"),i.target.getAnimations()[0].play(),this.state.selectedPathFn(e,t),this.launchFireworks(i)}launchFireworks(e){const t=e.target.getBoundingClientRect(),i=t.height/3,n=parseInt(t.width/i,10),s=t.width/n,a=t.left,r=t.top,o=document.createDocumentFragment(),A=this.rootNode.children[0].getBoundingClientRect();for(let t=0;t{o.animate([{transform:`translate(${A}px, ${c}px) rotate(${l}deg)`,opacity:.3},{left:`${r.x+100}px`,top:r.height-100+"px",transform:`translate(0, 0) rotate(${l}deg)`,opacity:0}],{duration:10*Math.random()+200,easing:"ease-in",delay:0}).onfinish=this.removeParticle}}removeParticle(e){e.srcElement.effect.target.remove()}}),customElements.define("carbone-studio",class extends vI{init(){console.log("Started WN-Layout Studio v"+yI.VERSION),this.state={carboneMode:"alpha",loadingClass:"shutter",loadingClassPan:"shutter",origin:"",carboneTheme:""},wI.subscribe(this,["panelMode"])}connected(){bI.on("carbone:mode",this.onModeChange,this),bI.on("carbone:c-panel-design:open_file",this.onOpenTemplateFile,this),""!==this.state.origin&&uI.setState({origin:this.state.origin}),this.dispatchEvent(new CustomEvent("connected",{bubbles:!0,composed:!0}))}disconnected(){bI.off("carbone:mode",this.onModeChange),bI.off("carbone:c-panel-design:open_file",this.onOpenTemplateFile),this.dispatchEvent(new CustomEvent("disconnected"),{bubbles:!0,composed:!0}),this.reset()}afterInit(){bI.init(this.getRootNode());const e=new CSSStyleSheet;e.replace("\nmain {\n\n --background2: #cec7d5;\n --chrome-pdf-viewer-background: #323639;\n --chrome-pdf-viewer-background-light: #525659;\n\n --json-editor-active-line: rgb(235 204 255 / 27%);\n --json-editor-active-bracket: rgb(193 96 255 / 27%);\n --json-editor-search-match-selected: rgb(237 178 255 / 51%);\n --json-editor-search-match: rgb(255 211 0 / 35%);\n\n \n --template-border-color: #7a41ea;\n --primary:#a544c5;\n --on-primary:#ffffff;\n --primary-container:#ffd5ff;\n --on-primary-container:#350040;\n --secondary:#6b586b;\n --on-secondary:#ffffff;\n /*--on-secondary:#6b586b;*/\n /*--secondary-container:#f5dbf2;*/\n --secondary-container:#ccc;\n --on-secondary-container:#251626;\n --tertiary:#9e9e9e;\n --on-tertiary:#ffffff;\n --tertiary-container:#ffdad2;\n --on-tertiary-container:#32110c;\n --error:#ba1b1b;\n --error-container:#ffdad4;\n --on-error:#ffffff;\n --on-error-container:#410001;\n --background:#fcfcfc;\n --on-background:#1e1a1d;\n --surface:#f5f5f5;\n --on-surface:#1e1a1d;\n /*--surface-variant:#ecdee8;\n --on-surface-variant:#4d444c;*/\n --surface-variant:#eaeaea;\n --on-surface-variant:#1e1a1d;\n /*--outline:#7e747c;*/\n --outline:#a7a7a7;\n --inverse-on-surface:#f7eef3;\n --inverse-surface:#323639; /*#332f32;*/\n --inverse-primary:#fbaaff;\n\n /* color of smal-divider */\n --outline-variant: var(--outline);\n\n --inverse-on-primary: #371E73;\n --active: rgba(0,0,0,.1);\n --overlay: rgba(0,0,0,.5);\n --elevate1: 0 0.125rem 0.125rem 0 rgb(0 0 0 / 0.32);\n --elevate2: 0 0.25rem 0.5rem 0 rgb(0 0 0 / 0.2);\n --elevate3: 0 0.375rem 0.75rem 0 rgb(0 0 0 / 0.48);\n --elevateArticle: 0 0 0.4rem 0 rgb(0 0 0 / 0.2);\n --size: 16px;\n --font: Inter, Roboto, \"Helvetica Neue\", \"Arial Nova\", \"Nimbus Sans\", Arial, sans-serif;\n --speed1: .1s;\n --speed2: .2s;\n --speed3: .3s;\n --speed4: .4s;\n\n --global-font-size: 0.875rem;\n font-family: var(--font);\n font-size: var(--global-font-size);\n line-height: 1.25;\n\n --surface-dim: #ddd8dd;\n --surface-bright: #fdf8fd;\n --surface-container-lowest: #ffffff;\n --surface-container-low: #f7f2f7;\n --surface-container: #fff;\n --surface-container-high: #ece7eb;\n --surface-container-highest: #e6e1e6;\n\n --flex-resize-width: 4px;\n\n --tab-preview-border-color: #999;\n --tab-border-color: #999;\n --tab-text-color: #999;\n}\n\n\n\n\nparticle {\n display: block;\n position: absolute;\n}\n\n/******************************************\n flex panel \n alternative: https://codepen.io/thomas-eilermann/pen/grjEjE\n******************************************/\nmain > c-flex {\n height: 100%;\n}\nc-flex {\n display: flex;\n}\nc-flex-panel > c-flex {\n position: absolute;\n width: 100%;\n height: 100%;\n}\nc-flex.h {\n -ms-flex-direction: row;\n flex-direction: row;\n}\nc-flex.v {\n -ms-flex-direction: column;\n flex-direction: column;\n}\nc-flex-panel {\n display: flex;\n position: relative;\n /*overflow: hidden;*/\n overflow: visible; /* make all pop over visible above flex box */\n}\n.animate > c-flex-panel {\n transition: flex-grow 500ms ease-in-out;\n}\nc-flex > c-flex-resizer {\n -ms-flex: 0 0 var(--flex-resize-width);\n flex: 0 0 var(--flex-resize-width);\n background-color: var(--background2);\n}\nc-flex.h > c-flex-resizer {\n cursor: ew-resize;\n}\nc-flex.v > c-flex-resizer {\n cursor: ns-resize;\n height: var(--flex-resize-width); /* fix bug on safari */\n}\nc-flex > c-flex-resizer > div {\n width: 100%;\n height: 100%;\n}\n\n/** TODO improve animation transition */\nc-flex .reveal {\n display: none;\n z-index: 1000;\n background-color: var(--surface);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n\nc-flex .shutter {\n display: none;\n z-index: 1000;\n background-color: var(--surface);\n position: absolute;\n left: 0;\n right: 0;\n}\nc-flex .hide-forward {\n top: 0;\n bottom: 100%;\n display: block;\n animation: hide-forward ease 0.3s forwards;\n}\nc-flex .reveal-forward{\n top: 0;\n bottom: 0;\n display: block;\n animation: reveal-forward ease 0.3s forwards;\n}\n@keyframes hide-forward {\n from { bottom: 100%; }\n to { bottom: 0; }\n}\n@keyframes reveal-forward {\n from { top: 0; }\n to { top: 100%; }\n}\nc-flex .hide-backward {\n top: 100%;\n bottom: 0;\n display: block;\n animation: hide-backward ease 0.3s forwards;\n}\nc-flex .reveal-backward{\n top: 0;\n bottom: 0;\n display: block;\n animation: reveal-backward ease 0.3s forwards;\n}\n@keyframes hide-backward {\n from { top: 100%; }\n to { top: 0; }\n}\n@keyframes reveal-backward {\n from { bottom: 0; }\n to { bottom: 100%; }\n}\n\n@keyframes fade-in {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes fade-out {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-100%);\n }\n}\nc-flex .loading {\n display: block;\n animation: fade-in ease 3.4s forwards;\n}\nc-flex .revealing {\n display: block;\n animation: fade-out ease 3.4s forwards;\n}\n/* ANIMATion */\n\nc-flex-panel header {\n /*background-color: var(--background2);*/\n min-block-size: 0; /* remove default padding of beercss */\n padding: 0;\n}\n/*.background2 {\n background-color: var(--background2);\n}*/\nc-flex-panel header > nav {\n min-height: 3rem !important;\n}\nc-flex-panel header > nav .tab {\n background-color: #fff;\n /* padding: 20px; */\n /* margin-left: -1em; */\n /*height: 3rem;*/\n color: var(--tab-text-color);\n line-height: 2.85rem;\n padding-left: 1.6rem;\n padding-right: 1.6rem;\n font-size: 15px;\n border-top: 3px solid var(--tab-border-color);\n border-radius: 3px 10px 0 0;\n /*box-shadow: 1px 1px 10px rgba(0,0,0,0.1);*/\n}\n.height-minus-header {\n height: calc(100% - 4rem);\n}\n.no-overflow {\n /* fix nav bar overflow. Why does it overflow and generate an horizontal scroll ? **/\n /*overflow: hidden;*/\n}\n\ni.huge {\n ---size: 3rem;\n}\n.preview-pdf-viewer-background {\n background-color: var(--chrome-pdf-viewer-background)!important;\n}\n.preview-pdf-viewer-background-light {\n background-color: var(--chrome-pdf-viewer-background-light)!important;\n}\n\n/***********************************************\nFiles thumbnails\n***********************************************/\narticle.a4v {\n --example-width: 150px;\n width: var(--example-width);\n height: calc(var(--example-width) * 1.41);\n}\n.files-container{\n display: flex;\n flex-wrap: wrap;\n justify-content: start;\n}\n/*\n.files-container article{\n cursor: pointer;\n box-shadow: var(--elevateArticle);\n margin: 10px;\n transition: all 200ms;\n}\n.files-container article:hover{\n transform: scale(1.06)\n}*/\n\n.files-container img {\n --example-max: 170px;\n\n max-width: var(--example-max);\n height:auto;\n width:auto;\n\n cursor: pointer;\n box-shadow: var(--elevateArticle);\n margin: 10px;\n transition: all 200ms;\n border-radius: .75rem;\n\n object-fit: cover;\n object-position: center;\n inline-size: 100%;\n block-size: 100%;\n}\n.files-container img:hover{\n transform: scale(1.06)\n}\n\n\n /*margin: 0 auto;*/\n\n\n/*****************************************\n shortcut usage: Ctrl+S\n*****************************************/\nc-shortcut {\n vertical-align: baseline;\n margin-left: 4px;\n}\n\nkbd {\n color: var(--tertiary);\n user-select: none;\n border: 1px solid var(--tertiary);\n border-radius: 5px;\n padding: 2px 6px;\n}\n\n.animate-display-y {\n animation: animate-display 400ms 10ms cubic-bezier(0.38, 0.97, 0.56, 0.76) forwards;\n opacity: 0;\n transform: translateY(-5px);\n transform-origin: top center;\n}\n\n.animate-display-x {\n animation: animate-display 600ms 10ms cubic-bezier(0.38, 0.97, 0.56, 0.76) forwards;\n opacity: 0;\n transform: translateX(-5px);\n transform-origin: top center;\n} \n\n@keyframes animate-display {\n 100% {\n opacity: 1;\n transform: none;\n }\n}\n\n.wordbreak {\n overflow-wrap: anywhere;\n word-break: break-all;\n}\n\n/* Chat and Debugger logs */ \n\n.autoscroll-wrapper {\n height: 100%;\n}\n.autoscroll {\n overflow: auto;\n width: 100%; /* to avoid scroll bug when mouse not over an element */\n max-height: 100%;\n display: flex;\n flex-direction: column-reverse;\n}\n\n.autoscroll-line.row {\n margin-top: 10px;\n}\n\n\n.text-gradient {\n white-space: nowrap;\n background: linear-gradient(45deg, #a100ff, #4500ff 50%);\n background-clip: text;\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n animation: gradient 15s ease infinite;\n background-size: 200% auto;\n}\n/* \n * THIS FILE IS CONVERTED TO build/icons_optimized.css by the rollup (see script/studio-prebuild-steps.js)\n *\n * Source of icons:\n *\n * - Emojis:\n * - https://cdn.jsdelivr.net/gh/SebastianAigner/twemoji-amazing/twemoji-amazing.css\n * - manually imported like this: https://github.com/SebastianAigner/twemoji-amazing/blob/master/twemoji-amazing.css\n * \n * - 90% of UI icons come from Google Font icons\n * - source: https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded\n * - Material Symbols - Rounded\n * - weight 300, grade:0, optical size: 24\n * - filename must ends with \"-mask\" to inherit the color of the parent div\n * - add \"-hover\" to have a different icon on hover\n *\n * - Files icons (word, powerpoint, ...):\n * - source: https://icons8.com/icons/set/word\n * - SVG are saved manually in icons/*.svg\n * - And automatically compressed and added by rollup prebuild step in INJECT_HERE_COMPRESSED_SVG_ICONS\n * - filename.svg = .cico-filename\n *\n * How to use in the code?\n *\n * \n * \n * Why cico? \"carbone icons\"\n * \n */ \n.cico {\n display: inline-block;\n height: 1em;\n width: 1em;\n background-repeat: no-repeat;\n background-position: center center;\n background-size: 1em 1em;\n /* For Google Font icons, use mask instead of background-image to make the icon color dynamic according to the parent div */\n mask-position: center;\n mask-size: 1em;\n mask-repeat: no-repeat;\n -webkit-mask-position: center;\n -webkit-mask-size: 1em;\n -webkit-mask-repeat: no-repeat;\n}\n\n.cico-2x {\n height: 2em;\n width: 2em;\n background-size: 2em 2em;\n}\n\n.cico-green-circle {\n /* background-image: url(\"https://cdn.jsdelivr.net/gh/twitter/twemoji@master/assets/svg/1f7e2.svg\") */\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNiAzNiI+PGNpcmNsZSBmaWxsPSIjNzhCMTU5IiBjeD0iMTgiIGN5PSIxOCIgcj0iMTgiLz48L3N2Zz4=\")\n}\n.cico-red-circle {\n /* background-image: url(\"https://cdn.jsdelivr.net/gh/twitter/twemoji@master/assets/svg/1f534.svg\")*/\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNiAzNiI+PGNpcmNsZSBmaWxsPSIjREQyRTQ0IiBjeD0iMTgiIGN5PSIxOCIgcj0iMTgiLz48L3N2Zz4=\")\n}\n.cico-orange-circle {\n /* background-image: url(\"https://cdn.jsdelivr.net/gh/twitter/twemoji@master/assets/svg/1f7e0.svg\") */\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNiAzNiI+PGNpcmNsZSBmaWxsPSIjRjQ5MDBDIiBjeD0iMTgiIGN5PSIxOCIgcj0iMTgiLz48L3N2Zz4=\")\n}\n\n.cico-text-icon {\n /* set the size of the font so it looks like an icon */\n font-size: 1.2rem;\n font-weight: 400;\n line-height: 1.2rem;\n}\n\n/* all SVG of icons/*.svg are injected here by the builder */\n\na:is(:hover,:focus)>i.cico-add-circle, button:is(:hover, :focus) > i.cico-add-circle { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M440-440v120q0 17 11.5 28.5T480-280q17 0 28.5-11.5T520-320v-120h120q17 0 28.5-11.5T680-480q0-17-11.5-28.5T640-520H520v-120q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v120H320q-17 0-28.5 11.5T280-480q0 17 11.5 28.5T320-440h120Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-add-circle { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M440-440v120q0 17 11.5 28.5T480-280q17 0 28.5-11.5T520-320v-120h120q17 0 28.5-11.5T680-480q0-17-11.5-28.5T640-520H520v-120q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v120H320q-17 0-28.5 11.5T280-480q0 17 11.5 28.5T320-440h120Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-add { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M450-450H250q-12.75 0-21.37-8.63-8.63-8.63-8.63-21.38 0-12.76 8.63-21.37Q237.25-510 250-510h200v-200q0-12.75 8.63-21.37 8.63-8.63 21.38-8.63 12.76 0 21.37 8.63Q510-722.75 510-710v200h200q12.75 0 21.37 8.63 8.63 8.63 8.63 21.38 0 12.76-8.63 21.37Q722.75-450 710-450H510v200q0 12.75-8.63 21.37-8.63 8.63-21.38 8.63-12.76 0-21.37-8.63Q450-237.25 450-250v-200Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-app-icon { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg width='100%25' height='100%25' viewBox='0 0 43 48' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd%3bclip-rule:evenodd%3bstroke-linejoin:round%3bstroke-miterlimit:2%3b'%3e %3cpath d='M35.015%2c0l-32.18%2c0c-1.566%2c0 -2.835%2c1.269 -2.835%2c2.835l-0%2c42.132c-0%2c1.566 1.269%2c2.835 2.835%2c2.835c7.732%2c0 29.127%2c0 36.859%2c0c0.752%2c0 1.473%2c-0.299 2.004%2c-0.83c0.532%2c-0.532 0.831%2c-1.253 0.831%2c-2.005c-0%2c-9.176 -0%2c-37.478 -0%2c-37.478l-7.514%2c-7.489Z' style='fill:%23a544c5%3b'/%3e %3cpath d='M23.852%2c15.915c-2.224%2c0 -4.089%2c0.743 -5.596%2c2.23c-1.506%2c1.487 -2.259%2c3.631 -2.259%2c6.432c0%2c2.776 0.727%2c4.898 2.18%2c6.364c1.453%2c1.467 3.34%2c2.201 5.66%2c2.201c1.366%2c-0 2.521%2c-0.184 3.466%2c-0.55c0.944%2c-0.367 1.776%2c-0.78 2.493%2c-1.241c0.469%2c0.29 0.839%2c0.63 1.111%2c1.017c0.271%2c0.387 0.407%2c0.86 0.407%2c1.418c0%2c1.109 -0.723%2c2.03 -2.169%2c2.763c-1.447%2c0.734 -3.32%2c1.1 -5.619%2c1.1c-2.577%2c0 -4.862%2c-0.48 -6.857%2c-1.442c-1.995%2c-0.961 -3.553%2c-2.413 -4.673%2c-4.355c-1.12%2c-1.943 -1.68%2c-4.367 -1.68%2c-7.275c-0%2c-2.931 0.59%2c-5.375 1.77%2c-7.33c1.18%2c-1.955 2.766%2c-3.423 4.756%2c-4.405c1.99%2c-0.982 4.167%2c-1.472 6.533%2c-1.472c2.28%2c-0 4.13%2c0.395 5.551%2c1.187c1.422%2c0.791 2.132%2c1.733 2.132%2c2.826c0%2c0.493 -0.133%2c0.936 -0.4%2c1.328c-0.268%2c0.392 -0.6%2c0.711 -0.999%2c0.957c-0.728%2c-0.461 -1.547%2c-0.868 -2.459%2c-1.222c-0.912%2c-0.354 -2.028%2c-0.531 -3.348%2c-0.531Z' style='fill:white%3bfill-rule:nonzero%3b'/%3e %3cpath d='M35.015%2c6.638c-0%2c0.226 0.089%2c0.442 0.249%2c0.602c0.159%2c0.159 0.375%2c0.249 0.601%2c0.249c1.967%2c-0 6.664%2c-0 6.664%2c-0l-7.514%2c-7.489l-0%2c6.638Z' style='fill:%23e8a4ff%3bfill-rule:nonzero%3b'/%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-arrow-back { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='m294.92-450 206.77 206.77q8.92 8.92 8.81 20.88-.12 11.96-9.42 21.27-9.31 8.69-21.08 9-11.77.31-21.08-9L205.31-454.69q-5.62-5.62-7.92-11.85-2.31-6.23-2.31-13.46t2.31-13.46q2.3-6.23 7.92-11.85l253.61-253.61q8.31-8.31 20.58-8.5 12.27-.19 21.58 8.5 9.3 9.31 9.3 21.38 0 12.08-9.3 21.39L294.92-510H750q12.77 0 21.38 8.62Q780-492.77 780-480t-8.62 21.38Q762.77-450 750-450H294.92Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-arrow-drop-down { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M459-381 314-526q-3-3-4.5-6.5T308-540q0-8 5.5-14t14.5-6h304q9 0 14.5 6t5.5 14q0 2-6 14L501-381q-5 5-10 7t-11 2q-6 0-11-2t-10-7Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-arrow-forward { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M665.08-450H210q-12.77 0-21.38-8.62Q180-467.23 180-480t8.62-21.38Q197.23-510 210-510h455.08L458.31-716.77q-8.92-8.92-8.81-20.88.12-11.96 9.42-21.27 9.31-8.69 21.08-9 11.77-.31 21.08 9l253.61 253.61q5.62 5.62 7.92 11.85 2.31 6.23 2.31 13.46t-2.31 13.46q-2.3 6.23-7.92 11.85L501.08-201.08q-8.31 8.31-20.58 8.5-12.27.19-21.58-8.5-9.3-9.31-9.3-21.38 0-12.08 9.3-21.39L665.08-450Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-arrow-upward { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M450-665.08 243.23-458.31q-8.92 8.92-20.88 8.81-11.96-.12-21.27-9.42-8.69-9.31-9-21.08-.31-11.77 9-21.08l253.61-253.61q5.62-5.62 11.85-7.92 6.23-2.31 13.46-2.31t13.46 2.31q6.23 2.3 11.85 7.92l253.61 253.61q8.31 8.31 8.5 20.58.19 12.27-8.5 21.58-9.31 9.3-21.38 9.3-12.08 0-21.39-9.3L510-665.08V-210q0 12.77-8.62 21.38Q492.77-180 480-180t-21.38-8.62Q450-197.23 450-210v-455.08Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-attach-file { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M706.92-334.23q0 97.44-67.81 165.83-67.8 68.4-165.07 68.4t-165.27-68.4q-68-68.39-68-165.83v-359.62q0-69.23 48.08-117.69Q336.92-860 406.15-860q69.23 0 117.31 48.46t48.08 117.69v340.39q0 40.61-28.29 69.34-28.3 28.73-68.96 28.73-40.67 0-69.4-28.53-28.73-28.53-28.73-69.54v-321.15q0-12.75 8.62-21.38 8.63-8.62 21.39-8.62 12.75 0 21.37 8.62 8.61 8.63 8.61 21.38v321.15q0 16.08 10.81 27.08t26.89 11q16.07 0 26.88-11 10.81-11 10.81-27.08v-340.77q-.62-44.31-30.78-75.04Q450.6-800 406.15-800q-44.26 0-74.82 30.92-30.56 30.93-30.56 75.23v359.62q-.62 72.54 50.15 123.38Q401.69-160 474.18-160q71.46 0 121.49-50.85 50.02-50.84 51.25-123.38v-340.38q0-12.75 8.63-21.38 8.63-8.62 21.39-8.62 12.75 0 21.37 8.62 8.61 8.63 8.61 21.38v340.38Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-barcode { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M73.85-213.85v-516.92h73.84v516.92H73.85Zm110.77 0v-516.92h73.84v516.92h-73.84Zm110.77 0v-516.92h36.92v516.92h-36.92Zm110.76 0v-516.92H480v516.92h-73.85Zm110.77 0v-516.92h110.77v516.92H516.92Zm147.69 0v-516.92h36.93v516.92h-36.93Zm110.77 0v-516.92h110.77v516.92H775.38Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-bolt { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M383.08-380H261.39q-20.16 0-29.54-17.85-9.39-17.84 2.31-34.38L496.23-810.3q8.08-11.31 20.62-15.47 12.53-4.15 26.07.7 13.54 4.84 19.81 16.57t4.65 25.27L537.31-540h149.23q21.38 0 30.15 19.16 8.77 19.15-5.15 35.69L421.77-138.08q-8.69 10.31-21.23 13.35-12.54 3.03-24.46-2.43-11.92-5.46-18.5-16.69t-4.96-24.77L383.08-380Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-bookmark, button:is(:hover, :focus) > i.cico-bookmark { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='m480-240-168 72q-40 17-76-6.5T200-241v-519q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v519q0 43-36 66.5t-76 6.5l-168-72Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-bookmark { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='m480-240-168 72q-40 17-76-6.5T200-241v-519q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v519q0 43-36 66.5t-76 6.5l-168-72Zm0-88 200 86v-518H280v518l200-86Zm0-432H280h400-200Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-browser-brave { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg width='100%25' height='100%25' viewBox='0 0 48 48' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd%3bclip-rule:evenodd%3bstroke-linejoin:round%3bstroke-miterlimit:2%3b'%3e%3cg id='Branding'%3e%3cg id='Build-Icons-Release' serif:id='Build-Icons/Release'%3e%3cg id='Logo'%3e%3cpath id='Head' d='M41.631%2c12.218l1.043%2c-2.608c-0%2c0 -1.327%2c-1.448 -2.939%2c-3.09c-1.611%2c-1.642 -5.024%2c-0.676 -5.024%2c-0.676l-3.886%2c-4.492l-13.65%2c0l-3.886%2c4.492c-0%2c0 -3.413%2c-0.966 -5.024%2c0.676c-1.612%2c1.642 -2.939%2c3.09 -2.939%2c3.09l1.043%2c2.608l-1.327%2c3.863c0%2c-0 3.903%2c15.061 4.36%2c16.9c0.901%2c3.622 1.517%2c5.022 4.076%2c6.857c2.56%2c1.835 7.204%2c5.022 7.963%2c5.505c0.758%2c0.482 1.706%2c1.305 2.559%2c1.305c0.853%2c-0 1.801%2c-0.823 2.559%2c-1.305c0.759%2c-0.483 5.403%2c-3.67 7.963%2c-5.505c2.559%2c-1.835 3.175%2c-3.235 4.076%2c-6.857c0.457%2c-1.839 4.36%2c-16.9 4.36%2c-16.9l-1.327%2c-3.863Z' style='fill:url(%23_Linear1)%3b'/%3e%3cpath id='Face' d='M24%2c29.54c0.26%2c0 1.924%2c0.599 3.26%2c1.303c1.336%2c0.705 2.304%2c1.203 2.614%2c1.4c0.309%2c0.197 0.12%2c0.57 -0.161%2c0.773c-0.282%2c0.203 -4.07%2c3.191 -4.438%2c3.521c-0.368%2c0.331 -0.908%2c0.876 -1.275%2c0.876c-0.367%2c0 -0.908%2c-0.545 -1.275%2c-0.876c-0.368%2c-0.33 -4.156%2c-3.318 -4.438%2c-3.521c-0.282%2c-0.203 -0.47%2c-0.576 -0.161%2c-0.773c0.31%2c-0.197 1.278%2c-0.695 2.614%2c-1.4c1.335%2c-0.704 3%2c-1.303 3.26%2c-1.303Zm0.02%2c-21.284c0.128%2c0.004 0.847%2c0.039 1.876%2c0.389c1.137%2c0.386 2.37%2c0.869 2.938%2c0.869c0.569%2c-0 4.787%2c-0.821 4.787%2c-0.821c0%2c0 4.999%2c6.157 4.999%2c7.472c-0%2c1.316 -0.629%2c1.663 -1.261%2c2.348c-0.632%2c0.684 -3.394%2c3.671 -3.748%2c4.055c-0.355%2c0.383 -1.093%2c0.965 -0.659%2c2.012c0.434%2c1.047 1.075%2c2.379 0.363%2c3.73c-0.713%2c1.352 -1.933%2c2.253 -2.715%2c2.104c-0.782%2c-0.149 -2.619%2c-1.127 -3.294%2c-1.573c-0.676%2c-0.447 -2.816%2c-2.246 -2.816%2c-2.934c-0%2c-0.688 2.213%2c-1.923 2.621%2c-2.204c0.409%2c-0.281 2.274%2c-1.367 2.312%2c-1.794c0.038%2c-0.426 0.024%2c-0.551 -0.527%2c-1.605c-0.55%2c-1.054 -1.541%2c-2.46 -1.376%2c-3.396c0.165%2c-0.936 1.763%2c-1.422 2.904%2c-1.861c1.14%2c-0.439 3.336%2c-1.268 3.61%2c-1.396c0.274%2c-0.129 0.203%2c-0.252 -0.628%2c-0.332c-0.83%2c-0.081 -3.188%2c-0.399 -4.251%2c-0.098c-1.063%2c0.302 -2.88%2c0.762 -3.027%2c1.005c-0.147%2c0.244 -0.277%2c0.252 -0.126%2c1.092c0.151%2c0.84 0.929%2c4.872 1.005%2c5.588c0.075%2c0.716 0.223%2c1.189 -0.535%2c1.366c-0.758%2c0.177 -2.034%2c0.483 -2.472%2c0.483c-0.438%2c0 -1.714%2c-0.306 -2.472%2c-0.483c-0.758%2c-0.177 -0.61%2c-0.65 -0.535%2c-1.366c0.076%2c-0.716 0.853%2c-4.748 1.005%2c-5.588c0.151%2c-0.84 0.021%2c-0.848 -0.126%2c-1.092c-0.147%2c-0.243 -1.964%2c-0.703 -3.027%2c-1.005c-1.063%2c-0.301 -3.421%2c0.017 -4.252%2c0.098c-0.83%2c0.08 -0.901%2c0.203 -0.627%2c0.332c0.274%2c0.128 2.47%2c0.957 3.61%2c1.396c1.141%2c0.439 2.739%2c0.925 2.904%2c1.861c0.165%2c0.936 -0.826%2c2.342 -1.376%2c3.396c-0.551%2c1.054 -0.565%2c1.179 -0.527%2c1.605c0.038%2c0.427 1.903%2c1.513 2.312%2c1.794c0.408%2c0.281 2.621%2c1.516 2.621%2c2.204c0%2c0.688 -2.14%2c2.487 -2.816%2c2.934c-0.675%2c0.446 -2.512%2c1.424 -3.294%2c1.573c-0.782%2c0.149 -2.002%2c-0.752 -2.715%2c-2.104c-0.712%2c-1.351 -0.071%2c-2.683 0.363%2c-3.73c0.434%2c-1.047 -0.304%2c-1.629 -0.659%2c-2.012c-0.354%2c-0.384 -3.116%2c-3.371 -3.748%2c-4.055c-0.632%2c-0.685 -1.261%2c-1.032 -1.261%2c-2.348c0%2c-1.315 4.999%2c-7.472 4.999%2c-7.472c-0%2c0 4.218%2c0.821 4.787%2c0.821c0.568%2c-0 1.801%2c-0.483 2.938%2c-0.869c1.029%2c-0.35 1.748%2c-0.385 1.876%2c-0.389l0.04%2c0Z' style='fill:white%3b'/%3e%3cpath id='Top-Head' d='M34.711%2c5.844l-3.886%2c-4.492l-13.65%2c0l-3.886%2c4.492c-0%2c0 -3.413%2c-0.966 -5.024%2c0.676c-0%2c0 4.55%2c-0.418 6.114%2c2.173c-0%2c0 4.218%2c0.821 4.787%2c0.821c0.568%2c-0 1.801%2c-0.483 2.938%2c-0.869c1.138%2c-0.387 1.896%2c-0.389 1.896%2c-0.389c-0%2c-0 0.758%2c0.002 1.896%2c0.389c1.137%2c0.386 2.37%2c0.869 2.938%2c0.869c0.569%2c-0 4.787%2c-0.821 4.787%2c-0.821c1.564%2c-2.591 6.114%2c-2.173 6.114%2c-2.173c-1.611%2c-1.642 -5.024%2c-0.676 -5.024%2c-0.676' style='fill:url(%23_Linear2)%3b'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3clinearGradient id='_Linear1' x1='0' y1='0' x2='1' y2='0' gradientUnits='userSpaceOnUse' gradientTransform='matrix(37.9159%2c0%2c0%2c37.9159%2c5.04207%2c24.3196)'%3e%3cstop offset='0' style='stop-color:%23f50%3bstop-opacity:1'/%3e%3cstop offset='0.41' style='stop-color:%23f50%3bstop-opacity:1'/%3e%3cstop offset='0.58' style='stop-color:%23ff2000%3bstop-opacity:1'/%3e%3cstop offset='1' style='stop-color:%23ff2000%3bstop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient id='_Linear2' x1='0' y1='0' x2='1' y2='0' gradientUnits='userSpaceOnUse' gradientTransform='matrix(30.7941%2c0%2c0%2c30.7941%2c8.94103%2c5.49053)'%3e%3cstop offset='0' style='stop-color:%23ff452a%3bstop-opacity:1'/%3e%3cstop offset='1' style='stop-color:%23ff2000%3bstop-opacity:1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e\"); background-image: var(--cicon); }\n.cico-browser-chrome { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 48 48' height='48' width='48'%3e%3cdefs%3e%3clinearGradient id='a' x1='3.2173' y1='15' x2='44.7812' y2='15' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0' stop-color='%23d93025'/%3e%3cstop offset='1' stop-color='%23ea4335'/%3e%3c/linearGradient%3e%3clinearGradient id='b' x1='20.7219' y1='47.6791' x2='41.5039' y2='11.6837' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0' stop-color='%23fcc934'/%3e%3cstop offset='1' stop-color='%23fbbc04'/%3e%3c/linearGradient%3e%3clinearGradient id='c' x1='26.5981' y1='46.5015' x2='5.8161' y2='10.506' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0' stop-color='%231e8e3e'/%3e%3cstop offset='1' stop-color='%2334a853'/%3e%3c/linearGradient%3e%3c/defs%3e%3ccircle cx='24' cy='23.9947' r='12' style='fill:white'/%3e%3cpath d='M3.2154%2c36A24%2c24%2c0%2c1%2c0%2c12%2c3.2154%2c24%2c24%2c0%2c0%2c0%2c3.2154%2c36ZM34.3923%2c18A12%2c12%2c0%2c1%2c1%2c18%2c13.6077%2c12%2c12%2c0%2c0%2c1%2c34.3923%2c18Z' style='fill:none'/%3e%3cpath d='M24%2c12H44.7812a23.9939%2c23.9939%2c0%2c0%2c0-41.5639.0029L13.6079%2c30l.0093-.0024A11.9852%2c11.9852%2c0%2c0%2c1%2c24%2c12Z' style='fill:url(%23a)'/%3e%3ccircle cx='24' cy='24' r='9.5' style='fill:%231a73e8'/%3e%3cpath d='M34.3913%2c30.0029%2c24.0007%2c48A23.994%2c23.994%2c0%2c0%2c0%2c44.78%2c12.0031H23.9989l-.0025.0093A11.985%2c11.985%2c0%2c0%2c1%2c34.3913%2c30.0029Z' style='fill:url(%23b)'/%3e%3cpath d='M13.6086%2c30.0031%2c3.218%2c12.006A23.994%2c23.994%2c0%2c0%2c0%2c24.0025%2c48L34.3931%2c30.0029l-.0067-.0068a11.9852%2c11.9852%2c0%2c0%2c1-20.7778.007Z' style='fill:url(%23c)'/%3e%3c/svg%3e\"); background-image: var(--cicon); }\n.cico-browser-edge { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3e%3cdefs%3e%3cradialGradient id='b' cx='161.8' cy='68.9' r='95.4' gradientTransform='matrix(1 0 0 -.95 0 248.8)' gradientUnits='userSpaceOnUse'%3e%3cstop offset='.7' stop-opacity='0'/%3e%3cstop offset='.9' stop-opacity='.5'/%3e%3cstop offset='1'/%3e%3c/radialGradient%3e%3cradialGradient id='d' cx='-340.3' cy='63' r='143.2' gradientTransform='matrix(.15 -.99 -.8 -.12 176.6 -125.4)' gradientUnits='userSpaceOnUse'%3e%3cstop offset='.8' stop-opacity='0'/%3e%3cstop offset='.9' stop-opacity='.5'/%3e%3cstop offset='1'/%3e%3c/radialGradient%3e%3cradialGradient id='e' cx='113.4' cy='570.2' r='202.4' gradientTransform='matrix(-.04 1 2.13 .08 -1179.5 -106.7)' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0' stop-color='%2335c1f1'/%3e%3cstop offset='.1' stop-color='%2334c1ed'/%3e%3cstop offset='.2' stop-color='%232fc2df'/%3e%3cstop offset='.3' stop-color='%232bc3d2'/%3e%3cstop offset='.7' stop-color='%2336c752'/%3e%3c/radialGradient%3e%3cradialGradient id='f' cx='376.5' cy='568' r='97.3' gradientTransform='matrix(.28 .96 .78 -.23 -303.8 -148.5)' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0' stop-color='%2366eb6e'/%3e%3cstop offset='1' stop-color='%2366eb6e' stop-opacity='0'/%3e%3c/radialGradient%3e%3clinearGradient id='a' x1='63.3' y1='84' x2='241.7' y2='84' gradientTransform='matrix(1 0 0 -1 0 266)' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0' stop-color='%230c59a4'/%3e%3cstop offset='1' stop-color='%23114a8b'/%3e%3c/linearGradient%3e%3clinearGradient id='c' x1='157.3' y1='161.4' x2='46' y2='40.1' gradientTransform='matrix(1 0 0 -1 0 266)' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0' stop-color='%231b9de2'/%3e%3cstop offset='.2' stop-color='%231595df'/%3e%3cstop offset='.7' stop-color='%230680d7'/%3e%3cstop offset='1' stop-color='%230078d4'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath d='M235.7 195.5a93.7 93.7 0 0 1-10.6 4.7 101.9 101.9 0 0 1-35.9 6.4c-47.3 0-88.5-32.5-88.5-74.3a31.5 31.5 0 0 1 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5 0 74 68.1 81.4 82.8 81.4 7.9 0 19.8-2.3 27-4.6l1.3-.4a128.3 128.3 0 0 0 66.6-52.8 4 4 0 0 0-5.3-5.6Z' transform='translate(-4.6 -5)' style='fill:url(%23a)'/%3e%3cpath d='M235.7 195.5a93.7 93.7 0 0 1-10.6 4.7 101.9 101.9 0 0 1-35.9 6.4c-47.3 0-88.5-32.5-88.5-74.3a31.5 31.5 0 0 1 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5 0 74 68.1 81.4 82.8 81.4 7.9 0 19.8-2.3 27-4.6l1.3-.4a128.3 128.3 0 0 0 66.6-52.8 4 4 0 0 0-5.3-5.6Z' transform='translate(-4.6 -5)' style='isolation:isolate%3bopacity:.35%3bfill:url(%23b)'/%3e%3cpath d='M110.3 246.3A79.2 79.2 0 0 1 87.6 225a80.7 80.7 0 0 1 29.5-120c3.2-1.5 8.5-4.1 15.6-4a32.4 32.4 0 0 1 25.7 13 31.9 31.9 0 0 1 6.3 18.7c0-.2 24.5-79.6-80-79.6-43.9 0-80 41.6-80 78.2a130.2 130.2 0 0 0 12.1 56 128 128 0 0 0 156.4 67 75.5 75.5 0 0 1-62.8-8Z' transform='translate(-4.6 -5)' style='fill:url(%23c)'/%3e%3cpath d='M110.3 246.3A79.2 79.2 0 0 1 87.6 225a80.7 80.7 0 0 1 29.5-120c3.2-1.5 8.5-4.1 15.6-4a32.4 32.4 0 0 1 25.7 13 31.9 31.9 0 0 1 6.3 18.7c0-.2 24.5-79.6-80-79.6-43.9 0-80 41.6-80 78.2a130.2 130.2 0 0 0 12.1 56 128 128 0 0 0 156.4 67 75.5 75.5 0 0 1-62.8-8Z' transform='translate(-4.6 -5)' style='opacity:.41%3bfill:url(%23d)%3bisolation:isolate'/%3e%3cpath d='M157 153.8c-.9 1-3.4 2.5-3.4 5.6 0 2.6 1.7 5.2 4.8 7.3 14.3 10 41.4 8.6 41.5 8.6a59.6 59.6 0 0 0 30.3-8.3 61.4 61.4 0 0 0 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C228 28.8 182.3 5 132.6 5a128 128 0 0 0-128 126.2c.5-36.5 36.8-66 80-66 3.5 0 23.5.3 42 10a72.6 72.6 0 0 1 30.9 29.3c6.1 10.6 7.2 24.1 7.2 29.5s-2.7 13.3-7.8 19.9Z' transform='translate(-4.6 -5)' style='fill:url(%23e)'/%3e%3cpath d='M157 153.8c-.9 1-3.4 2.5-3.4 5.6 0 2.6 1.7 5.2 4.8 7.3 14.3 10 41.4 8.6 41.5 8.6a59.6 59.6 0 0 0 30.3-8.3 61.4 61.4 0 0 0 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C228 28.8 182.3 5 132.6 5a128 128 0 0 0-128 126.2c.5-36.5 36.8-66 80-66 3.5 0 23.5.3 42 10a72.6 72.6 0 0 1 30.9 29.3c6.1 10.6 7.2 24.1 7.2 29.5s-2.7 13.3-7.8 19.9Z' transform='translate(-4.6 -5)' style='fill:url(%23f)'/%3e%3c/svg%3e\"); background-image: var(--cicon); }\n.cico-browser-opera { --cicon: url(\"data:image/svg+xml,%3csvg viewBox='0 0 75.591 75.591' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e %3clinearGradient id='a' gradientTransform='matrix(0 -54.944 -54.944 0 23.62 79.474)' gradientUnits='userSpaceOnUse' x2='1'%3e %3cstop offset='0' stop-color='%23ff1b2d'/%3e %3cstop offset='.3' stop-color='%23ff1b2d'/%3e %3cstop offset='.614' stop-color='%23ff1b2d'/%3e %3cstop offset='1' stop-color='%23a70014'/%3e %3c/linearGradient%3e %3clinearGradient id='b' gradientTransform='matrix(0 -48.595 -48.595 0 37.854 76.235)' gradientUnits='userSpaceOnUse' x2='1'%3e %3cstop offset='0' stop-color='%239c0000'/%3e %3cstop offset='.7' stop-color='%23ff4b4b'/%3e %3cstop offset='1' stop-color='%23ff4b4b'/%3e %3c/linearGradient%3e %3cg transform='matrix(1.3333 0 0 -1.3333 0 107.2)'%3e %3cpath d='m28.346 80.398c-15.655 0-28.346-12.691-28.346-28.346 0-15.202 11.968-27.609 26.996-28.313.44848-.02115.89766-.03314 1.3504-.03314 7.2574 0 13.876 2.7289 18.891 7.2137-3.3227-2.2036-7.2074-3.4715-11.359-3.4715-6.7504 0-12.796 3.3488-16.862 8.6297-3.1344 3.6999-5.1645 9.1691-5.3028 15.307v1.3349c.13821 6.1377 2.1683 11.608 5.302 15.307 4.0666 5.2809 10.112 8.6297 16.862 8.6297 4.1526 0 8.038-1.2679 11.361-3.4729-4.9904 4.4643-11.569 7.1876-18.786 7.2144-.03596 0-.07122.0014-.10718.0014z' fill='url(%23a)'/%3e %3cpath d='m19.016 68.025c2.6013 3.0709 5.9607 4.9227 9.631 4.9227 8.2524 0 14.941-9.356 14.941-20.897s-6.6891-20.897-14.941-20.897c-3.6703 0-7.0297 1.851-9.6303 4.922 4.0659-5.2809 10.111-8.6297 16.862-8.6297 4.1519 0 8.0366 1.2679 11.359 3.4715 5.802 5.1906 9.4554 12.735 9.4554 21.133 0 8.397-3.6527 15.941-9.4533 21.131-3.3234 2.205-7.2088 3.4729-11.361 3.4729-6.7504 0-12.796-3.3488-16.862-8.6297' fill='url(%23b)'/%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-chevron-right { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M517.85-480 354.92-642.92q-8.3-8.31-8.5-20.89-.19-12.57 8.5-21.27 8.7-8.69 21.08-8.69 12.38 0 21.08 8.69l179.77 179.77q5.61 5.62 7.92 11.85 2.31 6.23 2.31 13.46t-2.31 13.46q-2.31 6.23-7.92 11.85L397.08-274.92q-8.31 8.3-20.89 8.5-12.57.19-21.27-8.5-8.69-8.7-8.69-21.08 0-12.38 8.69-21.08L517.85-480Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-close { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M480-437.85 277.08-234.92q-8.31 8.3-20.89 8.5-12.57.19-21.27-8.5-8.69-8.7-8.69-21.08 0-12.38 8.69-21.08L437.85-480 234.92-682.92q-8.3-8.31-8.5-20.89-.19-12.57 8.5-21.27 8.7-8.69 21.08-8.69 12.38 0 21.08 8.69L480-522.15l202.92-202.93q8.31-8.3 20.89-8.5 12.57-.19 21.27 8.5 8.69 8.7 8.69 21.08 0 12.38-8.69 21.08L522.15-480l202.93 202.92q8.3 8.31 8.5 20.89.19 12.57-8.5 21.27-8.7 8.69-21.08 8.69-12.38 0-21.08-8.69L480-437.85Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-cloud-download { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M450-450.15v-266.62q-75.61 8.62-122.81 69.46Q280-586.46 280-520h-20q-58 0-99 41t-41 99q0 58 41 99t99 41h480q42 0 71-29t29-71q0-42-29-71t-71-29h-60v-80q0-48.77-22-90.27-22-41.5-58-69.73v-70.31q65.15 33.08 102.58 95.23Q740-592.92 740-520v20h12.31q63.23 4.92 105.46 50.85Q900-403.23 900-340q0 66.92-46.54 113.46Q806.92-180 740-180H260q-82.92 0-141.46-57.62Q60-295.23 60-378.15q0-73.39 47-130.54 47-57.16 119.92-67.62 13.54-73.15 79.81-136.8Q373-776.77 450-776.77q24.54 0 42.27 17.73Q510-741.31 510-716.77v266.62l52.15-51.54q8.31-8.31 20.58-8.5 12.27-.19 21.58 9.11Q613-492.38 613-480q0 12.38-8.69 21.08l-99 99q-10.85 10.84-25.31 10.84-14.46 0-25.31-10.84l-99-99q-8.3-8.31-8.8-20.58-.5-12.27 8.8-21.58 8.7-8.69 20.77-9 12.08-.3 21.39 8.39L450-450.15Zm30-58.23Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-cloud { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M260-180q-82.92 0-141.46-57.62Q60-295.23 60-378.15q0-73.39 47-130.54 47-57.16 119.92-67.62Q246.15-666 317.12-723q70.96-57 162.88-57 108.54 0 184.27 75.73T740-520v20h12.31q63.23 4.92 105.46 50.85Q900-403.23 900-340q0 66.92-46.54 113.46Q806.92-180 740-180H260Zm0-60h480q42 0 71-29t29-71q0-42-29-71t-71-29h-60v-80q0-83-58.5-141.5T480-720q-83 0-141.5 58.5T280-520h-20q-58 0-99 41t-41 99q0 58 41 99t99 41Zm220-240Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-cloud-sync, button:is(:hover, :focus) > i.cico-cloud-sync { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M240-480q0 54 21.5 99.5T320-302v-58q0-17 11.5-28.5T360-400q17 0 28.5 11.5T400-360v160q0 17-11.5 28.5T360-160H200q-17 0-28.5-11.5T160-200q0-17 11.5-28.5T200-240h69q-51-44-80-106t-29-134q0-95 49.5-171T338-767q14-8 29-.5t20 23.5q5 16-1.5 31T365-690q-56 31-90.5 86.5T240-480Zm360 320q-50 0-85-35t-35-85q0-48 33-82.5t81-36.5q17-36 50.5-58.5T720-480q53 0 91.5 34.5T858-360q42 0 72 29t30 70q0 42-29 71.5T860-160H600Zm116-360q-7-41-27-76t-49-62v58q0 17-11.5 28.5T600-560q-17 0-28.5-11.5T560-600v-160q0-17 11.5-28.5T600-800h160q17 0 28.5 11.5T800-760q0 17-11.5 28.5T760-720h-69q43 38 70.5 89T797-520h-81Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-cloud-sync { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M240-480q0 54 21.5 99.5T320-302v-58q0-17 11.5-28.5T360-400q17 0 28.5 11.5T400-360v160q0 17-11.5 28.5T360-160H200q-17 0-28.5-11.5T160-200q0-17 11.5-28.5T200-240h69q-51-44-80-106t-29-134q0-95 49.5-171T338-767q14-8 29-.5t20 23.5q5 16-1.5 31T365-690q-56 31-90.5 86.5T240-480Zm360 320q-50 0-85-35t-35-85q0-48 33-82.5t81-36.5q17-36 50.5-58.5T720-480q53 0 91.5 34.5T858-360q42 0 72 29t30 70q0 42-29 71.5T860-160H600Zm116-360q-7-41-27-76t-49-62v58q0 17-11.5 28.5T600-560q-17 0-28.5-11.5T560-600v-160q0-17 11.5-28.5T600-800h160q17 0 28.5 11.5T800-760q0 17-11.5 28.5T760-720h-69q43 38 70.5 89T797-520h-81ZM600-240h260q8 0 14-6t6-14q0-8-6-14t-14-6h-70v-50q0-29-20.5-49.5T720-400q-29 0-49.5 20.5T650-330v10h-50q-17 0-28.5 11.5T560-280q0 17 11.5 28.5T600-240Zm120-80Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-cloud-upload { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='m450-471.39-53.31 52.7q-8.21 8.3-20.53 8.3-12.31 0-21.24-8.92-8.69-8.31-8.5-21.07.2-12.77 8.5-21.08l99.77-99.77q10.85-10.85 25.31-10.85 14.46 0 25.31 10.85l99.77 99.77q8.3 8.31 8.8 20.73t-8.8 21.45q-8.31 8.28-20.77 8.39-12.46.12-21.39-8.19L510-471.39v219.08q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85H740q42 0 71-29t29-71q0-42-29-71t-71-29h-60v-80q0-83-58.5-141.5T480-720q-83 0-141.5 58.5T280-520h-20.77q-56.85 0-98.04 41Q120-438 120-380t41 99q41 41 99 41h70q12.75 0 21.38 8.63 8.62 8.63 8.62 21.38 0 12.76-8.62 21.37Q342.75-180 330-180h-70q-82.92 0-141.46-57.53Q60-295.06 60-378.15q0-74.54 47.96-131.12t118.96-67.04Q246.15-666 317.12-723q70.96-57 162.88-57 108.64 0 184.32 75.68Q740-628.64 740-520v20h12.31q63.23 4.92 105.46 50.85Q900-403.23 900-340q0 66.92-46.15 113.46Q807.69-180 740.77-180H522.31Q492-180 471-201q-21-21-21-51.31v-219.08ZM480-450Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-computer { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M85.39-150.77q-12.77 0-21.39-8.62-8.61-8.61-8.61-21.38T64-202.15q8.62-8.62 21.39-8.62h789.22q12.77 0 21.39 8.62 8.61 8.61 8.61 21.38T896-159.39q-8.62 8.62-21.39 8.62H85.39Zm86.92-100q-30.31 0-51.31-21-21-21-21-51.31v-415.38q0-30.31 21-51.31 21-21 51.31-21h615.38q30.31 0 51.31 21 21 21 21 51.31v415.38q0 30.31-21 51.31-21 21-51.31 21H172.31Zm0-60h615.38q4.62 0 8.46-3.84 3.85-3.85 3.85-8.47v-415.38q0-4.62-3.85-8.46-3.84-3.85-8.46-3.85H172.31q-4.62 0-8.46 3.85-3.85 3.84-3.85 8.46v415.38q0 4.62 3.85 8.47 3.84 3.84 8.46 3.84Zm-12.31 0v-440 440Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-content-copy, button:is(:hover, :focus) > i.cico-content-copy { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360ZM200-80q-33 0-56.5-23.5T120-160v-520q0-17 11.5-28.5T160-720q17 0 28.5 11.5T200-680v520h400q17 0 28.5 11.5T640-120q0 17-11.5 28.5T600-80H200Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-content-copy { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-520q0-17 11.5-28.5T160-720q17 0 28.5 11.5T200-680v520h400q17 0 28.5 11.5T640-120q0 17-11.5 28.5T600-80H200Zm160-240v-480 480Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-currency-exchange { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M486-314q33 0 56.5-15.5T566-378q0-29-24.5-47T454-466q-59-21-86.5-50T340-592q0-41 28.5-74.5T446-710v-15q0-14 10.5-24.5T481-760q14 0 24.5 10.5T516-725v15q29 2 53.5 19.5T609-648q7 11 1 23.5T590-607q-13 5-26 1t-21-15q-10-12-25-19.5t-36-7.5q-35 0-53.5 15T410-592q0 26 23 41t83 35q72 26 96 61t24 77q0 29-10 51t-26.5 37.5Q583-274 561-264.5T514-250v15q0 14-10.5 24.5T479-200q-14 0-24.5-10.5T444-235v-17q-38-8-65-30t-43-56q-6-14 .5-27t20.5-18q13-5 26 .5t20 17.5q14 26 35.5 38.5T486-314Zm-6 274q-112 0-206-51T120-227v67q0 17-11.5 28.5T80-120q-17 0-28.5-11.5T40-160v-160q0-17 11.5-28.5T80-360h160q17 0 28.5 11.5T280-320q0 17-11.5 28.5T240-280h-59q48 72 126.5 116T480-120q141 0 242.5-94T838-445q2-16 14-25.5t28-9.5q17 0 29 10.5t10 25.5q-7 85-44 158.5t-96 128q-59 54.5-135.5 86T480-40Zm0-800q-141 0-242.5 94T122-515q-2 16-14 25.5T80-480q-17 0-29-10.5T41-516q7-85 44-158.5t96-128q59-54.5 135.5-86T480-920q112 0 206 51t154 136v-67q0-17 11.5-28.5T880-840q17 0 28.5 11.5T920-800v160q0 17-11.5 28.5T880-600H720q-17 0-28.5-11.5T680-640q0-17 11.5-28.5T720-680h59q-48-72-126.5-116T480-840Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-data-object { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M600-160q-17 0-28.5-11.5T560-200q0-17 11.5-28.5T600-240h80q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720h-80q-17 0-28.5-11.5T560-760q0-17 11.5-28.5T600-800h80q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560t28.5 11.5Q880-537 880-520v80q0 17-11.5 28.5T840-400t-28.5 11.5Q800-377 800-360v80q0 50-35 85t-85 35h-80Zm-320 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400t-28.5-11.5Q80-423 80-440v-80q0-17 11.5-28.5T120-560t28.5-11.5Q160-583 160-600v-80q0-50 35-85t85-35h80q17 0 28.5 11.5T400-760q0 17-11.5 28.5T360-720h-80q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h80q17 0 28.5 11.5T400-200q0 17-11.5 28.5T360-160h-80Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-download { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M480-337q-8 0-15-2.5t-13-8.5L308-492q-12-12-11.5-28t11.5-28q12-12 28.5-12.5T365-549l75 75v-286q0-17 11.5-28.5T480-800q17 0 28.5 11.5T520-760v286l75-75q12-12 28.5-11.5T652-548q11 12 11.5 28T652-492L508-348q-6 6-13 8.5t-15 2.5ZM240-160q-33 0-56.5-23.5T160-240v-80q0-17 11.5-28.5T200-360q17 0 28.5 11.5T240-320v80h480v-80q0-17 11.5-28.5T760-360q17 0 28.5 11.5T800-320v80q0 33-23.5 56.5T720-160H240Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-draft { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M252.31-100Q222-100 201-121q-21-21-21-51.31v-615.38Q180-818 201-839q21-21 51.31-21h287.77q14.46 0 27.81 5.62 13.34 5.61 23.19 15.46l167.84 167.84q9.85 9.85 15.46 23.19 5.62 13.35 5.62 27.81v447.77Q780-142 759-121q-21 21-51.31 21H252.31ZM540-656.16V-800H252.31q-4.62 0-8.46 3.85-3.85 3.84-3.85 8.46v615.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85h455.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46V-620H576.16q-15.47 0-25.81-10.35Q540-640.69 540-656.16ZM240-800v180-180V-160v-640Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-edit { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M200-200h57l391-391-57-57-391 391v57Zm-40 80q-17 0-28.5-11.5T120-160v-97q0-16 6-30.5t17-25.5l505-504q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L313-143q-11 11-25.5 17t-30.5 6h-97Zm600-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-file-csv { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3cpath style='fill:%23F36FA0%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cg%3e %3cpath style='fill:white%3b' d='M21.58%2c51.975c-0.374%2c0.364-0.798%2c0.638-1.271%2c0.82c-0.474%2c0.183-0.984%2c0.273-1.531%2c0.273 c-0.602%2c0-1.155-0.109-1.661-0.328s-0.948-0.542-1.326-0.971c-0.378-0.429-0.675-0.966-0.889-1.613 c-0.214-0.647-0.321-1.395-0.321-2.242s0.107-1.593%2c0.321-2.235c0.214-0.643%2c0.51-1.178%2c0.889-1.606 c0.378-0.429%2c0.822-0.754%2c1.333-0.978c0.51-0.224%2c1.062-0.335%2c1.654-0.335c0.547%2c0%2c1.057%2c0.091%2c1.531%2c0.273 c0.474%2c0.183%2c0.897%2c0.456%2c1.271%2c0.82l-1.135%2c1.012c-0.228-0.265-0.481-0.456-0.759-0.574c-0.278-0.118-0.567-0.178-0.868-0.178 c-0.337%2c0-0.659%2c0.063-0.964%2c0.191c-0.306%2c0.128-0.579%2c0.344-0.82%2c0.649c-0.242%2c0.306-0.431%2c0.699-0.567%2c1.183 s-0.21%2c1.075-0.219%2c1.777c0.009%2c0.684%2c0.08%2c1.267%2c0.212%2c1.75c0.132%2c0.483%2c0.314%2c0.877%2c0.547%2c1.183s0.497%2c0.528%2c0.793%2c0.67 c0.296%2c0.142%2c0.608%2c0.212%2c0.937%2c0.212s0.636-0.06%2c0.923-0.178s0.549-0.31%2c0.786-0.574L21.58%2c51.975z'/%3e %3cpath style='fill:white%3b' d='M29.633%2c50.238c0%2c0.364-0.075%2c0.718-0.226%2c1.06s-0.362%2c0.643-0.636%2c0.902s-0.611%2c0.467-1.012%2c0.622 c-0.401%2c0.155-0.857%2c0.232-1.367%2c0.232c-0.219%2c0-0.444-0.012-0.677-0.034s-0.467-0.062-0.704-0.116 c-0.237-0.055-0.463-0.13-0.677-0.226c-0.214-0.096-0.399-0.212-0.554-0.349l0.287-1.176c0.127%2c0.073%2c0.289%2c0.144%2c0.485%2c0.212 c0.196%2c0.068%2c0.398%2c0.132%2c0.608%2c0.191c0.209%2c0.06%2c0.419%2c0.107%2c0.629%2c0.144c0.209%2c0.036%2c0.405%2c0.055%2c0.588%2c0.055 c0.556%2c0%2c0.982-0.13%2c1.278-0.39c0.296-0.26%2c0.444-0.645%2c0.444-1.155c0-0.31-0.105-0.574-0.314-0.793 c-0.21-0.219-0.472-0.417-0.786-0.595s-0.654-0.355-1.019-0.533c-0.365-0.178-0.707-0.388-1.025-0.629 c-0.319-0.241-0.583-0.526-0.793-0.854c-0.21-0.328-0.314-0.738-0.314-1.23c0-0.446%2c0.082-0.843%2c0.246-1.189 s0.385-0.641%2c0.663-0.882c0.278-0.241%2c0.602-0.426%2c0.971-0.554s0.759-0.191%2c1.169-0.191c0.419%2c0%2c0.843%2c0.039%2c1.271%2c0.116 c0.428%2c0.077%2c0.774%2c0.203%2c1.039%2c0.376c-0.055%2c0.118-0.119%2c0.248-0.191%2c0.39c-0.073%2c0.142-0.142%2c0.273-0.205%2c0.396 c-0.064%2c0.123-0.119%2c0.226-0.164%2c0.308c-0.046%2c0.082-0.073%2c0.128-0.082%2c0.137c-0.055-0.027-0.116-0.063-0.185-0.109 s-0.167-0.091-0.294-0.137c-0.128-0.046-0.296-0.077-0.506-0.096c-0.21-0.019-0.479-0.014-0.807%2c0.014 c-0.183%2c0.019-0.355%2c0.07-0.52%2c0.157s-0.31%2c0.193-0.438%2c0.321c-0.128%2c0.128-0.228%2c0.271-0.301%2c0.431 c-0.073%2c0.159-0.109%2c0.313-0.109%2c0.458c0%2c0.364%2c0.104%2c0.658%2c0.314%2c0.882c0.209%2c0.224%2c0.469%2c0.419%2c0.779%2c0.588 c0.31%2c0.169%2c0.647%2c0.333%2c1.012%2c0.492c0.364%2c0.159%2c0.704%2c0.354%2c1.019%2c0.581s0.576%2c0.513%2c0.786%2c0.854 C29.528%2c49.261%2c29.633%2c49.7%2c29.633%2c50.238z'/%3e %3cpath style='fill:white%3b' d='M34.035%2c53.055l-3.131-10.131h1.873l2.338%2c8.695l2.475-8.695h1.859l-3.281%2c10.131H34.035z'/%3e %3c/g%3e %3cpath style='fill:%23C8BDB8%3b' d='M23.5%2c16v-4h-12v4v2v2v2v2v2v2v2v4h10h2h21v-4v-2v-2v-2v-2v-2v-4H23.5z M13.5%2c14h8v2h-8V14z M13.5%2c18h8v2h-8V18z M13.5%2c22h8v2h-8V22z M13.5%2c26h8v2h-8V26z M21.5%2c32h-8v-2h8V32z M42.5%2c32h-19v-2h19V32z M42.5%2c28h-19v-2h19V28 z M42.5%2c24h-19v-2h19V24z M23.5%2c20v-2h19v2H23.5z'/%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-docx { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' %3e %3cpath fill='%232d92d4' d='M42.256%2c6H15.744C14.781%2c6%2c14%2c6.781%2c14%2c7.744v7.259h30V7.744C44%2c6.781%2c43.219%2c6%2c42.256%2c6z'/%3e %3cpath fill='%232150a9' d='M14 33.054v7.202c0 .963.781 1.744 1.743 1.744h26.513c.963 0 1.744-.781 1.744-1.744v-7.202H14z'/%3e %3cpath fill='%232d83d4' d='M14 15.003h30v9.002H14z'/%3e %3cpath fill='%232e70c9' d='M14 24.005h30v9.05H14z'/%3e %3cpath fill='%2300488d' d='M22.319 34H5.681A1.68 1.68 0 0 1 4 32.319V15.681A1.68 1.68 0 0 1 5.681 14h16.638A1.68 1.68 0 0 1 24 15.681v16.638A1.68 1.68 0 0 1 22.319 34z'/%3e %3cpath fill='white' d='M18.403 19l-1.546 7.264L15.144 19h-2.187l-1.767 7.489L9.597 19H7.641l2.344 10h2.352l1.713-7.689L15.764 29h2.251l2.344-10z'/%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-html { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3cpath style='fill:%23EC6630%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cg%3e %3cpath style='fill:white%3b' d='M17.455%2c42.924V53h-1.641v-4.539h-4.361V53H9.785V42.924h1.668v4.416h4.361v-4.416H17.455z'/%3e %3cpath style='fill:white%3b' d='M27.107%2c42.924v1.121H24.1V53h-1.654v-8.955h-3.008v-1.121H27.107z'/%3e %3cpath style='fill:white%3b' d='M36.705%2c42.924h1.668V53h-1.668v-6.932l-2.256%2c5.605H33l-2.27-5.605V53h-1.668V42.924h1.668 l2.994%2c6.891L36.705%2c42.924z'/%3e %3cpath style='fill:white%3b' d='M42.57%2c42.924v8.832h4.635V53h-6.303V42.924H42.57z'/%3e %3c/g%3e %3cg%3e %3cpath style='fill:%23EC6630%3b' d='M23.207%2c16.293c-0.391-0.391-1.023-0.391-1.414%2c0l-6%2c6c-0.391%2c0.391-0.391%2c1.023%2c0%2c1.414l6%2c6 C21.988%2c29.902%2c22.244%2c30%2c22.5%2c30s0.512-0.098%2c0.707-0.293c0.391-0.391%2c0.391-1.023%2c0-1.414L17.914%2c23l5.293-5.293 C23.598%2c17.316%2c23.598%2c16.684%2c23.207%2c16.293z'/%3e %3cpath style='fill:%23EC6630%3b' d='M41.207%2c22.293l-6-6c-0.391-0.391-1.023-0.391-1.414%2c0s-0.391%2c1.023%2c0%2c1.414L39.086%2c23 l-5.293%2c5.293c-0.391%2c0.391-0.391%2c1.023%2c0%2c1.414C33.988%2c29.902%2c34.244%2c30%2c34.5%2c30s0.512-0.098%2c0.707-0.293l6-6 C41.598%2c23.316%2c41.598%2c22.684%2c41.207%2c22.293z'/%3e %3c/g%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-jpg { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3ccircle style='fill:%23F3D55B%3b' cx='18.931' cy='14.431' r='4.569'/%3e %3cpolygon style='fill:%2326B99A%3b' points='6.5%2c39 17.5%2c39 49.5%2c39 49.5%2c28 39.5%2c18.5 29%2c30 23.517%2c24.517 '/%3e %3cpath style='fill:%2314A085%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cg%3e %3cpath style='fill:white%3b' d='M21.426%2c42.65v7.848c0%2c0.474-0.087%2c0.873-0.26%2c1.196c-0.173%2c0.323-0.406%2c0.583-0.697%2c0.779 c-0.292%2c0.196-0.627%2c0.333-1.005%2c0.41C19.085%2c52.961%2c18.696%2c53%2c18.295%2c53c-0.201%2c0-0.436-0.021-0.704-0.062 c-0.269-0.041-0.547-0.104-0.834-0.191s-0.563-0.185-0.827-0.294c-0.265-0.109-0.488-0.232-0.67-0.369l0.697-1.107 c0.091%2c0.063%2c0.221%2c0.13%2c0.39%2c0.198c0.168%2c0.068%2c0.353%2c0.132%2c0.554%2c0.191c0.2%2c0.06%2c0.41%2c0.111%2c0.629%2c0.157 s0.424%2c0.068%2c0.615%2c0.068c0.483%2c0%2c0.868-0.094%2c1.155-0.28s0.439-0.504%2c0.458-0.95V42.65H21.426z'/%3e %3cpath style='fill:white%3b' d='M25.514%2c52.932h-1.641V42.855h2.898c0.428%2c0%2c0.852%2c0.068%2c1.271%2c0.205 c0.419%2c0.137%2c0.795%2c0.342%2c1.128%2c0.615c0.333%2c0.273%2c0.602%2c0.604%2c0.807%2c0.991s0.308%2c0.822%2c0.308%2c1.306 c0%2c0.511-0.087%2c0.973-0.26%2c1.388c-0.173%2c0.415-0.415%2c0.764-0.725%2c1.046c-0.31%2c0.282-0.684%2c0.501-1.121%2c0.656 s-0.921%2c0.232-1.449%2c0.232h-1.217V52.932z M25.514%2c44.1v3.992h1.504c0.2%2c0%2c0.398-0.034%2c0.595-0.103 c0.196-0.068%2c0.376-0.18%2c0.54-0.335s0.296-0.371%2c0.396-0.649c0.1-0.278%2c0.15-0.622%2c0.15-1.032c0-0.164-0.023-0.354-0.068-0.567 c-0.046-0.214-0.139-0.419-0.28-0.615c-0.142-0.196-0.34-0.36-0.595-0.492C27.5%2c44.166%2c27.163%2c44.1%2c26.744%2c44.1H25.514z'/%3e %3cpath style='fill:white%3b' d='M39.5%2c47.736v3.896c-0.21%2c0.265-0.444%2c0.48-0.704%2c0.649s-0.533%2c0.308-0.82%2c0.417 s-0.583%2c0.187-0.889%2c0.232C36.781%2c52.978%2c36.479%2c53%2c36.178%2c53c-0.602%2c0-1.155-0.109-1.661-0.328s-0.948-0.542-1.326-0.971 c-0.378-0.429-0.675-0.966-0.889-1.613c-0.214-0.647-0.321-1.395-0.321-2.242s0.107-1.593%2c0.321-2.235 c0.214-0.643%2c0.51-1.178%2c0.889-1.606c0.378-0.429%2c0.822-0.754%2c1.333-0.978c0.51-0.224%2c1.062-0.335%2c1.654-0.335 c0.547%2c0%2c1.057%2c0.091%2c1.531%2c0.273c0.474%2c0.183%2c0.897%2c0.456%2c1.271%2c0.82l-1.135%2c1.012c-0.219-0.265-0.47-0.456-0.752-0.574 c-0.283-0.118-0.574-0.178-0.875-0.178c-0.337%2c0-0.659%2c0.063-0.964%2c0.191c-0.306%2c0.128-0.579%2c0.344-0.82%2c0.649 c-0.242%2c0.306-0.431%2c0.699-0.567%2c1.183s-0.21%2c1.075-0.219%2c1.777c0.009%2c0.684%2c0.08%2c1.276%2c0.212%2c1.777 c0.132%2c0.501%2c0.314%2c0.911%2c0.547%2c1.23s0.497%2c0.556%2c0.793%2c0.711c0.296%2c0.155%2c0.608%2c0.232%2c0.937%2c0.232c0.1%2c0%2c0.234-0.007%2c0.403-0.021 c0.168-0.014%2c0.337-0.036%2c0.506-0.068c0.168-0.032%2c0.33-0.075%2c0.485-0.13c0.155-0.055%2c0.269-0.132%2c0.342-0.232v-2.488h-1.709 v-1.121H39.5z'/%3e %3c/g%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-md { --cicon: url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg' style='fill-rule:evenodd%3bclip-rule:evenodd%3b'%3e %3crect x='26' y='66' width='198' height='118' style='fill:none%3bstroke:black%3bstroke-width:10px%3b'/%3e %3cpath d='M51%2c159l0%2c-68l20%2c0l20%2c25l20%2c-25l20%2c0l0%2c68l-20%2c0l0%2c-39l-20%2c25l-20%2c-25l0%2c39l-20%2c0Zm125%2c0l-30%2c-33l20%2c0l0%2c-35l20%2c0l0%2c35l20%2c0l-30%2c33Z' style='fill-rule:nonzero%3b'/%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-odf { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='48' height='48' %3e %3clinearGradient id='A' x1='24' x2='24' y1='4.938' y2='34.519' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23ffd747'/%3e %3cstop offset='.21' stop-color='%23ffd645'/%3e %3cstop offset='.44' stop-color='%23fed43e'/%3e %3cstop offset='.651' stop-color='%23fccf33'/%3e %3cstop offset='.766' stop-color='%23fac922'/%3e %3cstop offset='.897' stop-color='%23f7c10c'/%3e %3cstop offset='1' stop-color='%23f5bc00'/%3e %3c/linearGradient%3e %3cpath fill='url(%23A)' d='M39 44H9a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h30a2 2 0 0 1 2 2v36a2 2 0 0 1-2 2z'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-1H10c-1.103 0-2 .897-2 2v34c0 1.103.897 2 2 2h28c1.103 0 2-.897 2-2V15.828a2.98 2.98 0 0 0-.879-2.121l-7.828-7.828A2.98 2.98 0 0 0 29.172 5h0z' opacity='.05'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-.5H10A1.5 1.5 0 0 0 8.5 7v34a1.5 1.5 0 0 0 1.5 1.5h28a1.5 1.5 0 0 0 1.5-1.5V15.828c0-.668-.26-1.296-.732-1.768L30.94 6.232c-.473-.472-1.101-.732-1.768-.732h0z' opacity='.07'/%3e %3clinearGradient id='B' x1='24' x2='24' y1='18.333' y2='61.003' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23f9f9f9'/%3e %3cstop offset='.26' stop-color='%23f0f1f2'/%3e %3cstop offset='.678' stop-color='%23d9dcdf'/%3e %3cstop offset='1' stop-color='%23c2c8cc'/%3e %3c/linearGradient%3e %3cpath fill='url(%23B)' d='M10 6a1 1 0 0 0-1 1v34a1 1 0 0 0 1 1h28a1 1 0 0 0 1-1V15.828a2 2 0 0 0-.586-1.414l-7.828-7.828A2 2 0 0 0 29.172 6H10z'/%3e %3clinearGradient id='C' x1='15.854' x2='22.091' y1='22.854' y2='29.091' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23d43a02'/%3e %3cstop offset='.815' stop-color='%23b9360c'/%3e %3cstop offset='.992' stop-color='%23a33611'/%3e %3c/linearGradient%3e %3ccircle cx='19.5' cy='26.5' r='6.5' fill='url(%23C)'/%3e %3clinearGradient id='D' x1='32.113' x2='24.988' y1='27.666' y2='32.666' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%232aa4f4'/%3e %3cstop offset='.887' stop-color='%23007ad9'/%3e %3cstop offset='.992' stop-color='%230067d7'/%3e %3c/linearGradient%3e %3cpath fill='url(%23D)' d='M34.5 35h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 .5.5v10a.5.5 0 0 1-.5.5z'/%3e %3clinearGradient id='E' x1='22.5' x2='22.5' y1='27.375' y2='37.373' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23ffd747'/%3e %3cstop offset='.21' stop-color='%23ffd645'/%3e %3cstop offset='.44' stop-color='%23fed43e'/%3e %3cstop offset='.651' stop-color='%23fccf33'/%3e %3cstop offset='.766' stop-color='%23fac922'/%3e %3cstop offset='.897' stop-color='%23f7c10c'/%3e %3cstop offset='1' stop-color='%23f5bc00'/%3e %3c/linearGradient%3e %3cpath fill='url(%23E)' d='M16 38l6-11 7 11z'/%3e %3cg fill='%234caf50'%3e %3cuse xlink:href='%23G'/%3e %3cuse xlink:href='%23G' x='-6' y='11'/%3e %3cuse xlink:href='%23G' x='7' y='11'/%3e %3c/g%3e %3cdefs %3e %3cpath id='G' d='M22.5 28h-1a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5z'/%3e %3c/defs%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-odp { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' %3e %3clinearGradient id='A' x1='24' x2='24' y1='10.167' y2='41.667' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23d43a02'/%3e %3cstop offset='1' stop-color='%23b9360c'/%3e %3c/linearGradient%3e %3cpath fill='url(%23A)' d='M39 44H9a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h30a2 2 0 0 1 2 2v36a2 2 0 0 1-2 2z'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-1H10c-1.103 0-2 .897-2 2v34c0 1.103.897 2 2 2h28c1.103 0 2-.897 2-2V15.828a2.98 2.98 0 0 0-.879-2.121l-7.828-7.828A2.98 2.98 0 0 0 29.172 5h0z' opacity='.05'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-.5H10A1.5 1.5 0 0 0 8.5 7v34a1.5 1.5 0 0 0 1.5 1.5h28a1.5 1.5 0 0 0 1.5-1.5V15.828c0-.668-.26-1.296-.732-1.768L30.94 6.232c-.473-.472-1.101-.732-1.768-.732h0z' opacity='.07'/%3e %3clinearGradient id='B' x1='24' x2='24' y1='18.333' y2='61.003' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23f9f9f9'/%3e %3cstop offset='.26' stop-color='%23f0f1f2'/%3e %3cstop offset='.678' stop-color='%23d9dcdf'/%3e %3cstop offset='1' stop-color='%23c2c8cc'/%3e %3c/linearGradient%3e %3cpath fill='url(%23B)' d='M10 6a1 1 0 0 0-1 1v34a1 1 0 0 0 1 1h28a1 1 0 0 0 1-1V15.828a2 2 0 0 0-.586-1.414l-7.828-7.828A2 2 0 0 0 29.172 6H10z'/%3e %3cpath d='M20 39.25c-.103 0-.206-.021-.305-.064a.75.75 0 0 1-.381-.99l2-4.5c.168-.379.616-.547.99-.381a.75.75 0 0 1 .381.99l-2 4.5a.75.75 0 0 1-.685.445zm8 0a.75.75 0 0 1-.686-.445l-2-4.5a.75.75 0 0 1 .381-.99c.374-.167.822.002.99.381l2 4.5a.75.75 0 0 1-.381.99c-.098.043-.201.064-.304.064zM24 20.5a.5.5 0 0 1-.5-.5v-1.5a.5.5 0 1 1 1 0V20a.5.5 0 0 1-.5.5z' fill='%2318518a'/%3e %3cradialGradient id='C' cx='29.5' cy='30.125' r='15.052' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23d43a02'/%3e %3cstop offset='1' stop-color='%23b9360c'/%3e %3c/radialGradient%3e %3cpath fill='url(%23C)' d='M34 35H14a1 1 0 0 1-1-1V20a1 1 0 0 1 1-1h20a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1z'/%3e %3cpath d='M32.5 23h-17a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h17a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5zm-10 5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5zm-6 0h-1a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5zm0 4h-1a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5zm6 0h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5zm3.499 1c-.15 0-.303-.034-.446-.105a1 1 0 0 1-.447-1.342l2-4a1 1 0 0 1 .734-.54c.321-.05.641.054.867.28l1.019 1.019 1.38-2.759a1 1 0 1 1 1.789.895l-2 4a1 1 0 0 1-1.601.26l-1.019-1.019-1.38 2.759a1 1 0 0 1-.896.552z' fill='white'/%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-ods { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='48' height='48' %3e %3clinearGradient id='A' x1='24' x2='24' y1='6' y2='45.172' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%234caf50'/%3e %3cstop offset='.489' stop-color='%234aaf50'/%3e %3cstop offset='.665' stop-color='%2343ad50'/%3e %3cstop offset='.79' stop-color='%2338aa50'/%3e %3cstop offset='.892' stop-color='%2327a550'/%3e %3cstop offset='.978' stop-color='%2311a050'/%3e %3cstop offset='1' stop-color='%230a9e50'/%3e %3c/linearGradient%3e %3cpath fill='url(%23A)' d='M39 44H9a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h30a2 2 0 0 1 2 2v36a2 2 0 0 1-2 2z'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-1H10c-1.103 0-2 .897-2 2v34c0 1.103.897 2 2 2h28c1.103 0 2-.897 2-2V15.828a2.98 2.98 0 0 0-.879-2.121l-7.828-7.828A2.98 2.98 0 0 0 29.172 5h0z' opacity='.05'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-.5H10A1.5 1.5 0 0 0 8.5 7v34a1.5 1.5 0 0 0 1.5 1.5h28a1.5 1.5 0 0 0 1.5-1.5V15.828c0-.668-.26-1.296-.732-1.768L30.94 6.232c-.473-.472-1.101-.732-1.768-.732h0z' opacity='.07'/%3e %3clinearGradient id='B' x1='24' x2='24' y1='18.333' y2='61.003' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23f9f9f9'/%3e %3cstop offset='.26' stop-color='%23f0f1f2'/%3e %3cstop offset='.678' stop-color='%23d9dcdf'/%3e %3cstop offset='1' stop-color='%23c2c8cc'/%3e %3c/linearGradient%3e %3cpath fill='url(%23B)' d='M10 6a1 1 0 0 0-1 1v34a1 1 0 0 0 1 1h28a1 1 0 0 0 1-1V15.828a2 2 0 0 0-.586-1.414l-7.828-7.828A2 2 0 0 0 29.172 6H10z'/%3e %3cg fill='%23c0edc0'%3e %3cuse xlink:href='%23H'/%3e %3cuse xlink:href='%23H' x='8'/%3e %3cuse xlink:href='%23H' x='16'/%3e %3cuse xlink:href='%23H' y='-3'/%3e %3cuse xlink:href='%23H' x='8' y='-3'/%3e %3cuse xlink:href='%23H' x='16' y='-3'/%3e %3cuse xlink:href='%23H' y='-6'/%3e %3cuse xlink:href='%23H' x='8' y='-6'/%3e %3cuse xlink:href='%23H' x='16' y='-6'/%3e %3c/g%3e %3cg fill='%239fdd9f'%3e %3cuse xlink:href='%23H' y='-9'/%3e %3cuse xlink:href='%23H' x='8' y='-9'/%3e %3cuse xlink:href='%23H' x='16' y='-9'/%3e %3c/g%3e %3cg fill='%23c0edc0'%3e %3cuse xlink:href='%23H' y='3'/%3e %3cuse xlink:href='%23H' x='8' y='3'/%3e %3cuse xlink:href='%23H' x='16' y='3'/%3e %3c/g%3e %3clinearGradient id='C' x1='25.5' x2='25.5' y1='31.963' y2='40.207' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%232aa4f4'/%3e %3cstop offset='1' stop-color='%23007ad9'/%3e %3c/linearGradient%3e %3cpath fill='url(%23C)' d='M27 39h-3v-6.563c0-.241.224-.437.5-.437h2c.276 0 .5.196.5.438V39z'/%3e %3clinearGradient id='D' x1='28.5' x2='28.5' y1='30.958' y2='40.38' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23d43a02'/%3e %3cstop offset='1' stop-color='%23b9360c'/%3e %3c/linearGradient%3e %3cpath fill='url(%23D)' d='M29.979 39h-2.958c-.012 0-.021-.009-.021-.021V30.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v8.479c0 .012-.009.021-.021.021z'/%3e %3clinearGradient id='E' x1='31.5' x2='31.5' y1='32.567' y2='40.104' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23ffd747'/%3e %3cstop offset='.21' stop-color='%23ffd645'/%3e %3cstop offset='.44' stop-color='%23fed43e'/%3e %3cstop offset='.651' stop-color='%23fccf33'/%3e %3cstop offset='.766' stop-color='%23fac922'/%3e %3cstop offset='.897' stop-color='%23f7c10c'/%3e %3cstop offset='1' stop-color='%23f5bc00'/%3e %3c/linearGradient%3e %3cpath fill='url(%23E)' d='M33 39h-3v-3.6c0-.221.224-.4.5-.4h2c.276 0 .5.179.5.4V39z'/%3e %3clinearGradient id='F' x1='34.5' x2='34.5' y1='30.958' y2='40.38' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%234caf50'/%3e %3cstop offset='.489' stop-color='%234aaf50'/%3e %3cstop offset='.665' stop-color='%2343ad50'/%3e %3cstop offset='.79' stop-color='%2338aa50'/%3e %3cstop offset='.892' stop-color='%2327a550'/%3e %3cstop offset='.978' stop-color='%2311a050'/%3e %3cstop offset='1' stop-color='%230a9e50'/%3e %3c/linearGradient%3e %3cpath fill='url(%23F)' d='M36 39h-3v-5.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V39z'/%3e %3cdefs %3e %3cpath id='H' d='M17.5 34h-5a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5z'/%3e %3c/defs%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-odt { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='48' height='48' %3e %3clinearGradient id='A' x1='24' x2='24' y1='5.417' y2='45.921' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%232aa4f4'/%3e %3cstop offset='1' stop-color='%23007ad9'/%3e %3c/linearGradient%3e %3cpath fill='url(%23A)' d='M39 44H9a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h30a2 2 0 0 1 2 2v36a2 2 0 0 1-2 2z'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-1H10c-1.103 0-2 .897-2 2v34c0 1.103.897 2 2 2h28c1.103 0 2-.897 2-2V15.828a2.98 2.98 0 0 0-.879-2.121l-7.828-7.828A2.98 2.98 0 0 0 29.172 5h0z' opacity='.05'/%3e %3cpath d='M29.172 6a2 2 0 0 1 1.414.586l7.828 7.828A2 2 0 0 1 39 15.828V41a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h19.172m0-.5H10A1.5 1.5 0 0 0 8.5 7v34a1.5 1.5 0 0 0 1.5 1.5h28a1.5 1.5 0 0 0 1.5-1.5V15.828c0-.668-.26-1.296-.732-1.768L30.94 6.232c-.473-.472-1.101-.732-1.768-.732h0z' opacity='.07'/%3e %3clinearGradient id='B' x1='24' x2='24' y1='18.333' y2='61.003' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23f9f9f9'/%3e %3cstop offset='.26' stop-color='%23f0f1f2'/%3e %3cstop offset='.678' stop-color='%23d9dcdf'/%3e %3cstop offset='1' stop-color='%23c2c8cc'/%3e %3c/linearGradient%3e %3cpath fill='url(%23B)' d='M10 6a1 1 0 0 0-1 1v34a1 1 0 0 0 1 1h28a1 1 0 0 0 1-1V15.828a2 2 0 0 0-.586-1.414l-7.828-7.828A2 2 0 0 0 29.172 6H10z'/%3e %3cradialGradient id='C' cx='38.149' cy='542.534' r='7.481' gradientTransform='matrix(1.0111 0 0 -1 -.233 572)' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23bd8af5'/%3e %3cstop offset='.137' stop-color='%23b88bf5'/%3e %3cstop offset='.309' stop-color='%23a88ff3'/%3e %3cstop offset='.499' stop-color='%238f96f2'/%3e %3cstop offset='.702' stop-color='%236b9eef'/%3e %3cstop offset='.913' stop-color='%233eaaec'/%3e %3cstop offset='1' stop-color='%2329afea'/%3e %3c/radialGradient%3e %3cpath fill='url(%23C)' d='M34.556 21H24.444c-.798 0-1.444.639-1.444 1.429v6.429c0 1.183.97 2.142 2.167 2.142h9.062c.978 0 1.771-.784 1.771-1.751v-6.82c0-.79-.646-1.429-1.444-1.429z'/%3e %3cpath fill='%23436dcd' d='M36 29.206l-3.733-3.89a1.1 1.1 0 0 0-1.52-.02l-3.414 3.102V31h7.222c.799 0 1.445-.639 1.445-1.429v-.365z'/%3e %3clinearGradient id='D' x1='28.778' x2='28.778' y1='23.984' y2='31.122' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23124787'/%3e %3cstop offset='.923' stop-color='%23173b75'/%3e %3cstop offset='1' stop-color='%23173a73'/%3e %3c/linearGradient%3e %3cpath fill='url(%23D)' d='M34.556 31l-6.632-6.615a1.34 1.34 0 0 0-1.854-.025L23 27.159v2.413c0 .789.646 1.428 1.444 1.428h10.112z'/%3e %3cellipse cx='33' cy='22.989' fill='white' rx='1' ry='.989'/%3e %3cg fill='%2329afea'%3e %3cuse xlink:href='%23F'/%3e %3cuse xlink:href='%23F' y='4'/%3e %3cuse xlink:href='%23F' y='8'/%3e %3cpath d='M35.5 35h-23a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h23a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5zm0 4h-23a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h23a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5z'/%3e %3c/g%3e %3cdefs %3e %3cpath id='F' d='M20.5 23h-8a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5z'/%3e %3c/defs%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-pdf { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3cpath style='fill:%23CC4B4C%3b' d='M19.514%2c33.324L19.514%2c33.324c-0.348%2c0-0.682-0.113-0.967-0.326 c-1.041-0.781-1.181-1.65-1.115-2.242c0.182-1.628%2c2.195-3.332%2c5.985-5.068c1.504-3.296%2c2.935-7.357%2c3.788-10.75 c-0.998-2.172-1.968-4.99-1.261-6.643c0.248-0.579%2c0.557-1.023%2c1.134-1.215c0.228-0.076%2c0.804-0.172%2c1.016-0.172 c0.504%2c0%2c0.947%2c0.649%2c1.261%2c1.049c0.295%2c0.376%2c0.964%2c1.173-0.373%2c6.802c1.348%2c2.784%2c3.258%2c5.62%2c5.088%2c7.562 c1.311-0.237%2c2.439-0.358%2c3.358-0.358c1.566%2c0%2c2.515%2c0.365%2c2.902%2c1.117c0.32%2c0.622%2c0.189%2c1.349-0.39%2c2.16 c-0.557%2c0.779-1.325%2c1.191-2.22%2c1.191c-1.216%2c0-2.632-0.768-4.211-2.285c-2.837%2c0.593-6.15%2c1.651-8.828%2c2.822 c-0.836%2c1.774-1.637%2c3.203-2.383%2c4.251C21.273%2c32.654%2c20.389%2c33.324%2c19.514%2c33.324z M22.176%2c28.198 c-2.137%2c1.201-3.008%2c2.188-3.071%2c2.744c-0.01%2c0.092-0.037%2c0.334%2c0.431%2c0.692C19.685%2c31.587%2c20.555%2c31.19%2c22.176%2c28.198z M35.813%2c23.756c0.815%2c0.627%2c1.014%2c0.944%2c1.547%2c0.944c0.234%2c0%2c0.901-0.01%2c1.21-0.441c0.149-0.209%2c0.207-0.343%2c0.23-0.415 c-0.123-0.065-0.286-0.197-1.175-0.197C37.12%2c23.648%2c36.485%2c23.67%2c35.813%2c23.756z M28.343%2c17.174 c-0.715%2c2.474-1.659%2c5.145-2.674%2c7.564c2.09-0.811%2c4.362-1.519%2c6.496-2.02C30.815%2c21.15%2c29.466%2c19.192%2c28.343%2c17.174z M27.736%2c8.712c-0.098%2c0.033-1.33%2c1.757%2c0.096%2c3.216C28.781%2c9.813%2c27.779%2c8.698%2c27.736%2c8.712z'/%3e %3cpath style='fill:%23CC4B4C%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cg%3e %3cpath style='fill:white%3b' d='M17.385%2c53h-1.641V42.924h2.898c0.428%2c0%2c0.852%2c0.068%2c1.271%2c0.205 c0.419%2c0.137%2c0.795%2c0.342%2c1.128%2c0.615c0.333%2c0.273%2c0.602%2c0.604%2c0.807%2c0.991s0.308%2c0.822%2c0.308%2c1.306 c0%2c0.511-0.087%2c0.973-0.26%2c1.388c-0.173%2c0.415-0.415%2c0.764-0.725%2c1.046c-0.31%2c0.282-0.684%2c0.501-1.121%2c0.656 s-0.921%2c0.232-1.449%2c0.232h-1.217V53z M17.385%2c44.168v3.992h1.504c0.2%2c0%2c0.398-0.034%2c0.595-0.103 c0.196-0.068%2c0.376-0.18%2c0.54-0.335c0.164-0.155%2c0.296-0.371%2c0.396-0.649c0.1-0.278%2c0.15-0.622%2c0.15-1.032 c0-0.164-0.023-0.354-0.068-0.567c-0.046-0.214-0.139-0.419-0.28-0.615c-0.142-0.196-0.34-0.36-0.595-0.492 c-0.255-0.132-0.593-0.198-1.012-0.198H17.385z'/%3e %3cpath style='fill:white%3b' d='M32.219%2c47.682c0%2c0.829-0.089%2c1.538-0.267%2c2.126s-0.403%2c1.08-0.677%2c1.477s-0.581%2c0.709-0.923%2c0.937 s-0.672%2c0.398-0.991%2c0.513c-0.319%2c0.114-0.611%2c0.187-0.875%2c0.219C28.222%2c52.984%2c28.026%2c53%2c27.898%2c53h-3.814V42.924h3.035 c0.848%2c0%2c1.593%2c0.135%2c2.235%2c0.403s1.176%2c0.627%2c1.6%2c1.073s0.74%2c0.955%2c0.95%2c1.524C32.114%2c46.494%2c32.219%2c47.08%2c32.219%2c47.682z M27.352%2c51.797c1.112%2c0%2c1.914-0.355%2c2.406-1.066s0.738-1.741%2c0.738-3.09c0-0.419-0.05-0.834-0.15-1.244 c-0.101-0.41-0.294-0.781-0.581-1.114s-0.677-0.602-1.169-0.807s-1.13-0.308-1.914-0.308h-0.957v7.629H27.352z'/%3e %3cpath style='fill:white%3b' d='M36.266%2c44.168v3.172h4.211v1.121h-4.211V53h-1.668V42.924H40.9v1.244H36.266z'/%3e %3c/g%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-png { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpath style='fill:%23659C35%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3cg%3e %3cpath style='fill:white%3b' d='M17.385%2c53h-1.641V42.924h2.898c0.428%2c0%2c0.852%2c0.068%2c1.271%2c0.205 c0.419%2c0.137%2c0.795%2c0.342%2c1.128%2c0.615c0.333%2c0.273%2c0.602%2c0.604%2c0.807%2c0.991s0.308%2c0.822%2c0.308%2c1.306 c0%2c0.511-0.087%2c0.973-0.26%2c1.388c-0.173%2c0.415-0.415%2c0.764-0.725%2c1.046c-0.31%2c0.282-0.684%2c0.501-1.121%2c0.656 s-0.921%2c0.232-1.449%2c0.232h-1.217V53z M17.385%2c44.168v3.992h1.504c0.2%2c0%2c0.398-0.034%2c0.595-0.103 c0.196-0.068%2c0.376-0.18%2c0.54-0.335c0.164-0.155%2c0.296-0.371%2c0.396-0.649c0.1-0.278%2c0.15-0.622%2c0.15-1.032 c0-0.164-0.023-0.354-0.068-0.567c-0.046-0.214-0.139-0.419-0.28-0.615c-0.142-0.196-0.34-0.36-0.595-0.492 c-0.255-0.132-0.593-0.198-1.012-0.198H17.385z'/%3e %3cpath style='fill:white%3b' d='M31.316%2c42.924V53h-1.668l-3.951-6.945V53h-1.668V42.924h1.668l3.951%2c6.945v-6.945H31.316z'/%3e %3cpath style='fill:white%3b' d='M41.16%2c47.805v3.896c-0.21%2c0.265-0.444%2c0.48-0.704%2c0.649s-0.533%2c0.308-0.82%2c0.417 S39.052%2c52.954%2c38.747%2c53c-0.306%2c0.046-0.608%2c0.068-0.909%2c0.068c-0.602%2c0-1.155-0.109-1.661-0.328s-0.948-0.542-1.326-0.971 c-0.378-0.429-0.675-0.966-0.889-1.613c-0.214-0.647-0.321-1.395-0.321-2.242s0.107-1.593%2c0.321-2.235 c0.214-0.643%2c0.51-1.178%2c0.889-1.606c0.378-0.429%2c0.822-0.754%2c1.333-0.978c0.51-0.224%2c1.062-0.335%2c1.654-0.335 c0.547%2c0%2c1.057%2c0.091%2c1.531%2c0.273c0.474%2c0.183%2c0.897%2c0.456%2c1.271%2c0.82l-1.135%2c1.012c-0.219-0.265-0.47-0.456-0.752-0.574 c-0.283-0.118-0.574-0.178-0.875-0.178c-0.337%2c0-0.659%2c0.063-0.964%2c0.191c-0.306%2c0.128-0.579%2c0.344-0.82%2c0.649 c-0.242%2c0.306-0.431%2c0.699-0.567%2c1.183s-0.21%2c1.075-0.219%2c1.777c0.009%2c0.684%2c0.08%2c1.276%2c0.212%2c1.777 c0.132%2c0.501%2c0.314%2c0.911%2c0.547%2c1.23s0.497%2c0.556%2c0.793%2c0.711c0.296%2c0.155%2c0.608%2c0.232%2c0.937%2c0.232c0.1%2c0%2c0.234-0.007%2c0.403-0.021 c0.168-0.014%2c0.337-0.036%2c0.506-0.068c0.168-0.032%2c0.33-0.075%2c0.485-0.13c0.155-0.055%2c0.269-0.132%2c0.342-0.232v-2.488h-1.709 v-1.121H41.16z'/%3e %3c/g%3e %3ccircle style='fill:%23F3D55B%3b' cx='18.931' cy='14.431' r='4.569'/%3e %3cpolygon style='fill:%2388C057%3b' points='6.5%2c39 17.5%2c39 49.5%2c39 49.5%2c28 39.5%2c18.5 29%2c30 23.517%2c24.517 '/%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-pptx { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' %3e %3cpath fill='%23d35230' d='M8%2c24c0%2c9.941%2c8.059%2c18%2c18%2c18s18-8.059%2c18-18H26H8z'/%3e %3cpath fill='%23ff8f6b' d='M26 6v18h18c0-9.941-8.059-18-18-18z'/%3e %3cpath fill='%23ed6c47' d='M26%2c6C16.059%2c6%2c8%2c14.059%2c8%2c24h18V6z'/%3e %3cpath d='M26 16.681A3.68 3.68 0 0 0 22.319 13H11.774A17.9 17.9 0 0 0 8 24c0 5.116 2.145 9.723 5.571 13h8.747A3.68 3.68 0 0 0 26 33.319V16.681z' opacity='.05'/%3e %3cpath d='M22.213 13.333H11.525C9.32 16.321 8 20.002 8 24c0 4.617 1.753 8.814 4.611 12h9.602a3.12 3.12 0 0 0 3.121-3.121V16.454c-.001-1.723-1.398-3.121-3.121-3.121z' opacity='.07'/%3e %3cpath d='M22.106 13.667h-10.83C9.218 16.593 8 20.151 8 24a17.9 17.9 0 0 0 3.774 11h10.332a2.56 2.56 0 0 0 2.56-2.56V16.227a2.56 2.56 0 0 0-2.56-2.56z' opacity='.09'/%3e %3clinearGradient id='A' x1='4.586' x2='22.77' y1='14.586' y2='32.77' gradientUnits='userSpaceOnUse'%3e %3cstop offset='0' stop-color='%23ca4e2a'/%3e %3cstop offset='1' stop-color='%23b63016'/%3e %3c/linearGradient%3e %3cpath fill='url(%23A)' d='M22 34H6a2 2 0 0 1-2-2V16a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2z'/%3e %3cpath fill='white' d='M14.673 19.012H10v10h2.024v-3.521H14.3a3.4 3.4 0 0 0 3.397-3.397v-.058c0-1.67-1.354-3.024-3.024-3.024zm.897 3.346c0 .859-.697 1.556-1.556 1.556h-1.99v-3.325h1.99c.859 0 1.556.697 1.556 1.556v.213z'/%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-svg { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3cpath style='fill:%23E57E25%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cg%3e %3cpath style='fill:white%3b' d='M21.459%2c50.238c0%2c0.364-0.075%2c0.718-0.226%2c1.06s-0.362%2c0.643-0.636%2c0.902s-0.61%2c0.467-1.012%2c0.622 s-0.856%2c0.232-1.367%2c0.232c-0.219%2c0-0.444-0.012-0.677-0.034s-0.467-0.062-0.704-0.116s-0.463-0.13-0.677-0.226 s-0.398-0.212-0.554-0.349l0.287-1.176c0.128%2c0.073%2c0.289%2c0.144%2c0.485%2c0.212s0.398%2c0.132%2c0.608%2c0.191s0.419%2c0.107%2c0.629%2c0.144 s0.405%2c0.055%2c0.588%2c0.055c0.556%2c0%2c0.982-0.13%2c1.278-0.39c0.296-0.26%2c0.444-0.645%2c0.444-1.155c0-0.31-0.104-0.574-0.314-0.793 s-0.472-0.417-0.786-0.595s-0.654-0.355-1.019-0.533s-0.706-0.388-1.025-0.629s-0.583-0.526-0.793-0.854s-0.314-0.738-0.314-1.23 c0-0.446%2c0.082-0.843%2c0.246-1.189s0.385-0.641%2c0.663-0.882s0.602-0.426%2c0.971-0.554s0.759-0.191%2c1.169-0.191 c0.419%2c0%2c0.843%2c0.039%2c1.271%2c0.116s0.774%2c0.203%2c1.039%2c0.376c-0.055%2c0.118-0.118%2c0.248-0.191%2c0.39s-0.142%2c0.273-0.205%2c0.396 s-0.118%2c0.226-0.164%2c0.308s-0.073%2c0.128-0.082%2c0.137c-0.055-0.027-0.116-0.063-0.185-0.109s-0.166-0.091-0.294-0.137 s-0.296-0.077-0.506-0.096s-0.479-0.014-0.807%2c0.014c-0.183%2c0.019-0.355%2c0.07-0.52%2c0.157s-0.31%2c0.193-0.438%2c0.321 s-0.228%2c0.271-0.301%2c0.431s-0.109%2c0.313-0.109%2c0.458c0%2c0.364%2c0.104%2c0.658%2c0.314%2c0.882s0.47%2c0.419%2c0.779%2c0.588 s0.647%2c0.333%2c1.012%2c0.492s0.704%2c0.354%2c1.019%2c0.581s0.576%2c0.513%2c0.786%2c0.854S21.459%2c49.7%2c21.459%2c50.238z'/%3e %3cpath style='fill:white%3b' d='M25.861%2c53.055L22.73%2c42.924h1.873l2.338%2c8.695l2.475-8.695h1.859l-3.281%2c10.131H25.861z'/%3e %3cpath style='fill:white%3b' d='M40.668%2c47.805v3.896c-0.21%2c0.265-0.444%2c0.48-0.704%2c0.649s-0.533%2c0.308-0.82%2c0.417 S38.561%2c52.954%2c38.255%2c53s-0.608%2c0.068-0.909%2c0.068c-0.602%2c0-1.155-0.109-1.661-0.328s-0.948-0.542-1.326-0.971 s-0.675-0.966-0.889-1.613s-0.321-1.395-0.321-2.242s0.107-1.593%2c0.321-2.235s0.511-1.178%2c0.889-1.606s0.822-0.754%2c1.333-0.978 s1.062-0.335%2c1.654-0.335c0.547%2c0%2c1.058%2c0.091%2c1.531%2c0.273s0.897%2c0.456%2c1.271%2c0.82l-1.135%2c1.012 c-0.219-0.265-0.47-0.456-0.752-0.574s-0.574-0.178-0.875-0.178c-0.337%2c0-0.658%2c0.063-0.964%2c0.191s-0.579%2c0.344-0.82%2c0.649 s-0.431%2c0.699-0.567%2c1.183s-0.21%2c1.075-0.219%2c1.777c0.009%2c0.684%2c0.08%2c1.276%2c0.212%2c1.777s0.314%2c0.911%2c0.547%2c1.23 s0.497%2c0.556%2c0.793%2c0.711s0.608%2c0.232%2c0.937%2c0.232c0.101%2c0%2c0.234-0.007%2c0.403-0.021s0.337-0.036%2c0.506-0.068 s0.33-0.075%2c0.485-0.13s0.269-0.132%2c0.342-0.232v-2.488h-1.709v-1.121H40.668z'/%3e %3c/g%3e %3cpath style='fill:%23C8BDB8%3b' d='M45.5%2c22v-6h-6v2h-6v-4h-10v4h-6v-2h-6v6h6v-2h3.548c-4.566%2c2.636-7.548%2c7.588-7.548%2c13 c0%2c0.552%2c0.447%2c1%2c1%2c1s1-0.448%2c1-1c0-5.246%2c3.229-9.999%2c8-11.995V24h10v-2.995c4.771%2c1.997%2c8%2c6.75%2c8%2c11.995c0%2c0.552%2c0.447%2c1%2c1%2c1 s1-0.448%2c1-1c0-5.412-2.982-10.364-7.548-13H39.5v2H45.5z M15.5%2c20h-2v-2h2V20z M31.5%2c22h-6v-3.754V16h6v2.246V22z M41.5%2c18h2v2h-2 V18z'/%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-txt { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3cpath style='fill:%2395A5A5%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cg%3e %3cpath style='fill:white%3b' d='M21.867%2c42.924v1.121h-3.008V53h-1.654v-8.955h-3.008v-1.121H21.867z'/%3e %3cpath style='fill:white%3b' d='M28.443%2c48.105L31%2c53h-1.9l-1.6-3.801h-0.137L25.641%2c53h-1.9l2.557-4.895l-2.721-5.182h1.873 l1.777%2c4.102h0.137l1.928-4.102h1.873L28.443%2c48.105z'/%3e %3cpath style='fill:white%3b' d='M40.529%2c42.924v1.121h-3.008V53h-1.654v-8.955h-3.008v-1.121H40.529z'/%3e %3c/g%3e %3cpath style='fill:%23C8BDB8%3b' d='M18.5%2c13h-6c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h6c0.553%2c0%2c1%2c0.448%2c1%2c1S19.053%2c13%2c18.5%2c13z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M21.5%2c18h-9c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h9c0.553%2c0%2c1%2c0.448%2c1%2c1S22.053%2c18%2c21.5%2c18z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M25.5%2c18c-0.26%2c0-0.521-0.11-0.71-0.29c-0.181-0.19-0.29-0.44-0.29-0.71s0.109-0.52%2c0.3-0.71 c0.36-0.37%2c1.04-0.37%2c1.41%2c0c0.18%2c0.19%2c0.29%2c0.45%2c0.29%2c0.71c0%2c0.26-0.11%2c0.52-0.29%2c0.71C26.02%2c17.89%2c25.76%2c18%2c25.5%2c18z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M37.5%2c18h-8c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h8c0.553%2c0%2c1%2c0.448%2c1%2c1S38.053%2c18%2c37.5%2c18z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M12.5%2c33c-0.26%2c0-0.521-0.11-0.71-0.29c-0.181-0.19-0.29-0.45-0.29-0.71 c0-0.26%2c0.109-0.52%2c0.29-0.71c0.37-0.37%2c1.05-0.37%2c1.42%2c0.01c0.18%2c0.18%2c0.29%2c0.44%2c0.29%2c0.7c0%2c0.26-0.11%2c0.52-0.29%2c0.71 C13.02%2c32.89%2c12.76%2c33%2c12.5%2c33z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M24.5%2c33h-8c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h8c0.553%2c0%2c1%2c0.448%2c1%2c1S25.053%2c33%2c24.5%2c33z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M43.5%2c18h-2c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h2c0.553%2c0%2c1%2c0.448%2c1%2c1S44.053%2c18%2c43.5%2c18z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M34.5%2c23h-22c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h22c0.553%2c0%2c1%2c0.448%2c1%2c1S35.053%2c23%2c34.5%2c23z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M43.5%2c23h-6c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h6c0.553%2c0%2c1%2c0.448%2c1%2c1S44.053%2c23%2c43.5%2c23z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M16.5%2c28h-4c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h4c0.553%2c0%2c1%2c0.448%2c1%2c1S17.053%2c28%2c16.5%2c28z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M30.5%2c28h-10c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h10c0.553%2c0%2c1%2c0.448%2c1%2c1S31.053%2c28%2c30.5%2c28z'/%3e %3cpath style='fill:%23C8BDB8%3b' d='M43.5%2c28h-9c-0.553%2c0-1-0.448-1-1s0.447-1%2c1-1h9c0.553%2c0%2c1%2c0.448%2c1%2c1S44.053%2c28%2c43.5%2c28z'/%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-xlsx { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' %3e %3cpath fill='%23169154' d='M29%2c6H15.744C14.781%2c6%2c14%2c6.781%2c14%2c7.744v7.259h15V6z'/%3e %3cpath fill='%2318482a' d='M14 33.054v7.202c0 .963.781 1.744 1.743 1.744H29v-8.946H14z'/%3e %3cpath fill='%230c8045' d='M14 15.003h15v9.002H14z'/%3e %3cpath fill='%2317472a' d='M14 24.005h15v9.05H14z'/%3e %3cpath fill='%2329c27f' d='M42.256%2c6H29v9.003h15V7.744C44%2c6.781%2c43.219%2c6%2c42.256%2c6z'/%3e %3cpath fill='%2327663f' d='M29%2c33.054V42h13.257C43.219%2c42%2c44%2c41.219%2c44%2c40.257v-7.202H29z'/%3e %3cpath fill='%2319ac65' d='M29 15.003h15v9.002H29z'/%3e %3cpath fill='%23129652' d='M29 24.005h15v9.05H29z'/%3e %3cpath fill='%230c7238' d='M22.319 34H5.681A1.68 1.68 0 0 1 4 32.319V15.681A1.68 1.68 0 0 1 5.681 14h16.638A1.68 1.68 0 0 1 24 15.681v16.638A1.68 1.68 0 0 1 22.319 34z'/%3e %3cpath fill='white' d='M9.807 19h2.386l1.936 3.754L16.175 19h2.229l-3.071 5 3.141 5h-2.351l-2.11-3.93L11.912 29H9.526l3.193-5.018z'/%3e %3c/svg%3e\"); background-image: var(--cicon); }\n.cico-file-xml { --cicon: url(\"data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e %3c!-- Uploaded to: SVG Repo%2c www.svgrepo.com%2c Generator: SVG Repo Mixer Tools --%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg height='800px' width='800px' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 56 56' xml:space='preserve'%3e %3cg%3e %3cpath style='fill:%23E9E9E0%3b' d='M36.985%2c0H7.963C7.155%2c0%2c6.5%2c0.655%2c6.5%2c1.926V55c0%2c0.345%2c0.655%2c1%2c1.463%2c1h40.074 c0.808%2c0%2c1.463-0.655%2c1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607%2c0.257C37.442%2c0.093%2c37.218%2c0%2c36.985%2c0z'/%3e %3cpolygon style='fill:%23D9D7CA%3b' points='37.5%2c0.151 37.5%2c12 49.349%2c12 '/%3e %3cpath style='fill:%23F29C1F%3b' d='M48.037%2c56H7.963C7.155%2c56%2c6.5%2c55.345%2c6.5%2c54.537V39h43v15.537C49.5%2c55.345%2c48.845%2c56%2c48.037%2c56z'/%3e %3cg%3e %3cpath style='fill:white%3b' d='M19.379%2c48.105L21.936%2c53h-1.9l-1.6-3.801h-0.137L16.576%2c53h-1.9l2.557-4.895l-2.721-5.182h1.873 l1.777%2c4.102h0.137l1.928-4.102H22.1L19.379%2c48.105z'/%3e %3cpath style='fill:white%3b' d='M31.998%2c42.924h1.668V53h-1.668v-6.932l-2.256%2c5.605h-1.449l-2.27-5.605V53h-1.668V42.924h1.668 l2.994%2c6.891L31.998%2c42.924z'/%3e %3cpath style='fill:white%3b' d='M37.863%2c42.924v8.832h4.635V53h-6.303V42.924H37.863z'/%3e %3c/g%3e %3cpath style='fill:%23F29C1F%3b' d='M15.5%2c24c-0.256%2c0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023%2c0-1.414l6-6 c0.391-0.391%2c1.023-0.391%2c1.414%2c0s0.391%2c1.023%2c0%2c1.414l-6%2c6C16.012%2c23.902%2c15.756%2c24%2c15.5%2c24z'/%3e %3cpath style='fill:%23F29C1F%3b' d='M21.5%2c30c-0.256%2c0-0.512-0.098-0.707-0.293l-6-6c-0.391-0.391-0.391-1.023%2c0-1.414 s1.023-0.391%2c1.414%2c0l6%2c6c0.391%2c0.391%2c0.391%2c1.023%2c0%2c1.414C22.012%2c29.902%2c21.756%2c30%2c21.5%2c30z'/%3e %3cpath style='fill:%23F29C1F%3b' d='M33.5%2c30c-0.256%2c0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023%2c0-1.414l6-6 c0.391-0.391%2c1.023-0.391%2c1.414%2c0s0.391%2c1.023%2c0%2c1.414l-6%2c6C34.012%2c29.902%2c33.756%2c30%2c33.5%2c30z'/%3e %3cpath style='fill:%23F29C1F%3b' d='M39.5%2c24c-0.256%2c0-0.512-0.098-0.707-0.293l-6-6c-0.391-0.391-0.391-1.023%2c0-1.414 s1.023-0.391%2c1.414%2c0l6%2c6c0.391%2c0.391%2c0.391%2c1.023%2c0%2c1.414C40.012%2c23.902%2c39.756%2c24%2c39.5%2c24z'/%3e %3cpath style='fill:%23F29C1F%3b' d='M24.5%2c32c-0.11%2c0-0.223-0.019-0.333-0.058c-0.521-0.184-0.794-0.755-0.61-1.276l6-17 c0.185-0.521%2c0.753-0.795%2c1.276-0.61c0.521%2c0.184%2c0.794%2c0.755%2c0.61%2c1.276l-6%2c17C25.298%2c31.744%2c24.912%2c32%2c24.5%2c32z'/%3e %3c/g%3e %3c/svg%3e\"); background-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-format-paint, button:is(:hover, :focus) > i.cico-format-paint { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h440q17 0 28.5 11.5T800-800v400q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v120q0 17-11.5 28.5T640-600q-17 0-28.5-11.5T600-640v-120h-40v40q0 17-11.5 28.5T520-680q-17 0-28.5-11.5T480-720v-40H320q-33 0-56.5 23.5T240-680v120Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-format-paint { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h440q17 0 28.5 11.5T800-800v400q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v120q0 17-11.5 28.5T640-600q-17 0-28.5-11.5T600-640v-120h-40v40q0 17-11.5 28.5T520-680q-17 0-28.5-11.5T480-720v-40H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-history { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M480-120q-126 0-223-76.5T131-392q-4-15 6-27.5t27-14.5q16-2 29 6t18 24q24 90 99 147t170 57q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h70q17 0 28.5 11.5T360-600q0 17-11.5 28.5T320-560H160q-17 0-28.5-11.5T120-600v-160q0-17 11.5-28.5T160-800q17 0 28.5 11.5T200-760v54q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm40-376 100 100q11 11 11 28t-11 28q-11 11-28 11t-28-11L452-452q-6-6-9-13.5t-3-15.5v-159q0-17 11.5-28.5T480-680q17 0 28.5 11.5T520-640v144Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-home, button:is(:hover, :focus) > i.cico-home { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M160-200v-360q0-19 8.5-36t23.5-28l240-180q21-16 48-16t48 16l240 180q15 11 23.5 28t8.5 36v360q0 33-23.5 56.5T720-120H600q-17 0-28.5-11.5T560-160v-200q0-17-11.5-28.5T520-400h-80q-17 0-28.5 11.5T400-360v200q0 17-11.5 28.5T360-120H240q-33 0-56.5-23.5T160-200Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-home { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M240-200h120v-200q0-17 11.5-28.5T400-440h160q17 0 28.5 11.5T600-400v200h120v-360L480-740 240-560v360Zm-80 0v-360q0-19 8.5-36t23.5-28l240-180q21-16 48-16t48 16l240 180q15 11 23.5 28t8.5 36v360q0 33-23.5 56.5T720-120H560q-17 0-28.5-11.5T520-160v-200h-80v200q0 17-11.5 28.5T400-120H240q-33 0-56.5-23.5T160-200Zm320-270Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-image { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M212.31-140Q182-140 161-161q-21-21-21-51.31v-535.38Q140-778 161-799q21-21 51.31-21h535.38Q778-820 799-799q21 21 21 51.31v535.38Q820-182 799-161q-21 21-51.31 21H212.31Zm0-60h535.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46v-535.38q0-4.62-3.85-8.46-3.84-3.85-8.46-3.85H212.31q-4.62 0-8.46 3.85-3.85 3.84-3.85 8.46v535.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85ZM200-200v-560 560Zm106.16-90h350.76q10.85 0 16.08-9.85 5.23-9.84-1.62-19.07L576-446.69q-5.62-7.23-14.46-7.23-8.85 0-14.46 7.23l-97.85 127.46-65.54-84q-5.61-6.85-14.27-6.85-8.65 0-14.27 7.24l-63.07 83.92q-7.23 9.23-2 19.07 5.23 9.85 16.08 9.85Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-language { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M480-100q-78.15 0-147.5-29.96t-120.96-81.58q-51.62-51.61-81.58-120.96T100-480q0-78.77 29.96-147.81t81.58-120.65q51.61-51.62 120.96-81.58T480-860q78.77 0 147.81 29.96t120.65 81.58q51.62 51.61 81.58 120.65T860-480q0 78.15-29.96 147.5t-81.58 120.96q-51.61 51.62-120.65 81.58T480-100Zm0-60.85q30.62-40.61 51.54-81.92 20.92-41.31 34.08-90.31H394.38q13.93 50.54 34.47 91.85 20.53 41.31 51.15 80.38Zm-77.46-11q-23-33-41.31-75.03-18.31-42.04-28.46-86.2H197.08q31.69 62.31 85 104.7 53.31 42.38 120.46 56.53Zm154.92 0q67.15-14.15 120.46-56.53 53.31-42.39 85-104.7H627.23q-12.08 44.54-30.39 86.58-18.3 42.04-39.38 74.65ZM171.92-393.08h148.7q-3.77-22.3-5.47-43.73-1.69-21.42-1.69-43.19 0-21.77 1.69-43.19 1.7-21.43 5.47-43.73h-148.7q-5.77 20.38-8.84 42.38-3.08 22-3.08 44.54t3.08 44.54q3.07 22 8.84 42.38Zm208.69 0h198.78q3.76-22.3 5.46-43.34 1.69-21.04 1.69-43.58t-1.69-43.58q-1.7-21.04-5.46-43.34H380.61q-3.76 22.3-5.46 43.34-1.69 21.04-1.69 43.58t1.69 43.58q1.7 21.04 5.46 43.34Zm258.77 0h148.7q5.77-20.38 8.84-42.38 3.08-22 3.08-44.54t-3.08-44.54q-3.07-22-8.84-42.38h-148.7q3.77 22.3 5.47 43.73 1.69 21.42 1.69 43.19 0 21.77-1.69 43.19-1.7 21.43-5.47 43.73Zm-12.15-233.84h135.69Q730.85-690 678.5-731.62q-52.35-41.61-121.04-56.92 23 34.92 40.92 76.39 17.93 41.46 28.85 85.23Zm-232.85 0h171.24q-13.93-50.16-35.04-92.43-21.12-42.27-50.58-79.8-29.46 37.53-50.58 79.8-21.11 42.27-35.04 92.43Zm-197.3 0h135.69q10.92-43.77 28.85-85.23 17.92-41.47 40.92-76.39-69.08 15.31-121.23 57.12-52.16 41.8-84.23 104.5Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-list { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M320-600q-17 0-28.5-11.5T280-640q0-17 11.5-28.5T320-680h480q17 0 28.5 11.5T840-640q0 17-11.5 28.5T800-600H320Zm0 160q-17 0-28.5-11.5T280-480q0-17 11.5-28.5T320-520h480q17 0 28.5 11.5T840-480q0 17-11.5 28.5T800-440H320Zm0 160q-17 0-28.5-11.5T280-320q0-17 11.5-28.5T320-360h480q17 0 28.5 11.5T840-320q0 17-11.5 28.5T800-280H320ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-magic { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3e %3cpath d='M15.701%2c9.449l3.148%2c-3.148l-1.15%2c-1.15l-3.148%2c3.148l1.15%2c1.15Zm4.802%2c-3.148c0%2c0.193 -0.064%2c0.354 -0.193%2c0.483l-13.816%2c13.816c-0.129%2c0.129 -0.29%2c0.193 -0.483%2c0.193c-0.194%2c0 -0.355%2c-0.064 -0.484%2c-0.193l-2.127%2c-2.127c-0.129%2c-0.129 -0.193%2c-0.29 -0.193%2c-0.484c-0%2c-0.193 0.064%2c-0.354 0.193%2c-0.483l13.816%2c-13.816c0.129%2c-0.129 0.29%2c-0.193 0.483%2c-0.193c0.193%2c-0 0.355%2c0.064 0.484%2c0.193l2.127%2c2.127c0.129%2c0.129 0.193%2c0.291 0.193%2c0.484Zm-14.514%2c-2.041l1.053%2c0.322l-1.053%2c0.322l-0.322%2c1.053l-0.322%2c-1.053l-1.053%2c-0.322l1.053%2c-0.322l0.322%2c-1.053l0.322%2c1.053Zm3.76%2c1.74l2.106%2c0.645l-2.106%2c0.644l-0.644%2c2.106l-0.645%2c-2.106l-2.105%2c-0.644l2.105%2c-0.645l0.645%2c-2.106l0.644%2c2.106Zm9.991%2c5.135l1.053%2c0.322l-1.053%2c0.323l-0.322%2c1.053l-0.322%2c-1.053l-1.053%2c-0.323l1.053%2c-0.322l0.322%2c-1.053l0.322%2c1.053Zm-6.875%2c-6.875l1.053%2c0.322l-1.053%2c0.322l-0.322%2c1.053l-0.323%2c-1.053l-1.053%2c-0.322l1.053%2c-0.322l0.323%2c-1.053l0.322%2c1.053Z'/%3e %3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-note-add { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M450-370v90q0 12.75 8.63 21.37 8.63 8.63 21.38 8.63 12.76 0 21.37-8.63Q510-267.25 510-280v-90h90q12.75 0 21.37-8.63 8.63-8.63 8.63-21.38 0-12.76-8.63-21.37Q612.75-430 600-430h-90v-90q0-12.75-8.63-21.37-8.63-8.63-21.38-8.63-12.76 0-21.37 8.63Q450-532.75 450-520v90h-90q-12.75 0-21.37 8.63-8.63 8.63-8.63 21.38 0 12.76 8.63 21.37Q347.25-370 360-370h90ZM252.31-100Q222-100 201-121q-21-21-21-51.31v-615.38Q180-818 201-839q21-21 51.31-21h287.77q14.63 0 27.89 5.62 13.26 5.61 23.11 15.46l167.84 167.84q9.85 9.85 15.46 23.11 5.62 13.26 5.62 27.89v447.77Q780-142 759-121q-21 21-51.31 21H252.31ZM540-656v-144H252.31q-4.62 0-8.46 3.85-3.85 3.84-3.85 8.46v615.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85h455.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46V-620H575.99q-15.3 0-25.64-10.35Q540-640.7 540-656ZM240-800v180-180V-160v-640Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-person { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M480-492.31q-57.75 0-98.87-41.12Q340-574.56 340-632.31q0-57.75 41.13-98.87 41.12-41.13 98.87-41.13 57.75 0 98.87 41.13Q620-690.06 620-632.31q0 57.75-41.13 98.88-41.12 41.12-98.87 41.12ZM180-248.46v-28.16q0-29.38 15.96-54.42 15.96-25.04 42.66-38.5 59.3-29.07 119.65-43.61 60.35-14.54 121.73-14.54t121.73 14.54q60.35 14.54 119.65 43.61 26.7 13.46 42.66 38.5Q780-306 780-276.62v28.16q0 25.3-17.73 43.04-17.73 17.73-43.04 17.73H240.77q-25.31 0-43.04-17.73Q180-223.16 180-248.46Zm60 .77h480v-28.93q0-12.15-7.04-22.5-7.04-10.34-19.11-16.88-51.7-25.46-105.42-38.58Q534.7-367.69 480-367.69q-54.7 0-108.43 13.11-53.72 13.12-105.42 38.58-12.07 6.54-19.11 16.88-7.04 10.35-7.04 22.5v28.93Zm240-304.62q33 0 56.5-23.5t23.5-56.5q0-33-23.5-56.5t-56.5-23.5q-33 0-56.5 23.5t-23.5 56.5q0 33 23.5 56.5t56.5 23.5Zm0-80Zm0 384.62Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-place-item { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M212.31-140q-29.92 0-51.12-21.19Q140-182.39 140-212.31v-375.38q0-29.92 21.19-51.12Q182.39-660 212.31-660h112.31q12.76 0 21.38 8.62 8.61 8.61 8.61 21.38T346-608.62q-8.62 8.62-21.38 8.62H212.31q-5.39 0-8.85 3.46t-3.46 8.85v375.38q0 5.39 3.46 8.85t8.85 3.46h535.38q5.39 0 8.85-3.46t3.46-8.85v-375.38q0-5.39-3.46-8.85t-8.85-3.46H635.38q-12.76 0-21.38-8.62-8.61-8.61-8.61-21.38t8.61-21.38q8.62-8.62 21.38-8.62h112.31q29.92 0 51.12 21.19Q820-617.61 820-587.69v375.38q0 29.92-21.19 51.12Q777.61-140 747.69-140H212.31ZM510-448.77l52.92-52.92q8.31-8.31 20.58-8.5 12.27-.19 21.58 9.11 8.69 8.7 8.69 21.08 0 12.38-8.69 21.08l-99.77 99.77q-10.85 10.84-25.31 10.84-14.46 0-25.31-10.84l-99.77-99.77q-8.3-8.31-8.8-20.58-.5-12.27 8.8-21.58 8.7-8.69 21.08-8.69 12.38 0 21.08 8.69L450-448.77V-900q0-12.77 8.62-21.38Q467.23-930 480-930t21.38 8.62Q510-912.77 510-900v451.23Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-refresh { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M481.54-180q-125.63 0-212.81-87.17-87.19-87.17-87.19-212.77 0-125.6 87.19-212.83Q355.91-780 481.54-780q70.15 0 132.77 31.19 62.61 31.2 104.15 88.04V-750q0-12.75 8.63-21.37 8.63-8.63 21.38-8.63 12.76 0 21.37 8.63 8.62 8.62 8.62 21.37v178.46q0 15.37-10.39 25.76-10.4 10.39-25.76 10.39H563.85q-12.75 0-21.38-8.62-8.62-8.63-8.62-21.39 0-12.75 8.62-21.37 8.63-8.61 21.38-8.61h128q-31.62-57.93-87.7-91.27Q548.08-720 481.54-720q-100 0-170 70t-70 170q0 100 70 170t170 70q69.73 0 127.67-36.62 57.94-36.61 87.79-97.69 5.69-10.92 16.73-15.27 11.04-4.34 22.5-.5 12.23 3.85 17.12 16 4.88 12.16-.81 23.08-37.16 77.69-109.7 124.34Q570.3-180 481.54-180Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-robot { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M216.16-140q-15.37 0-25.76-10.4-10.4-10.4-10.4-25.77v-144.68q0-29.84 21.24-51.03 21.24-21.2 51.07-21.2h455.38q29.83 0 51.07 21.25Q780-350.58 780-320.74v144.67q0 15.38-10.4 25.72Q759.21-140 743.84-140H216.16Zm149.61-308.46q-77.09 0-131.43-54.34T180-634.23q0-77.09 54.34-131.43T365.77-820h228.46q77.09 0 131.43 54.34T780-634.23q0 77.09-54.34 131.43t-131.43 54.34H365.77ZM240-200h480v-120.77q0-5.38-3.46-8.85-3.46-3.46-8.85-3.46H252.31q-5.39 0-8.85 3.46-3.46 3.47-3.46 8.85V-200Zm125.77-308.46h228.46q52.69 0 89.23-36.54Q720-581.54 720-634.23q0-52.69-36.54-89.23Q646.92-760 594.23-760H365.77q-52.69 0-89.23 36.54Q240-686.92 240-634.23q0 52.69 36.54 89.23 36.54 36.54 89.23 36.54Zm-.01-91.16q14.7 0 24.66-9.94 9.96-9.95 9.96-24.66 0-14.7-9.94-24.66-9.95-9.97-24.66-9.97-14.7 0-24.66 9.95-9.97 9.95-9.97 24.66 0 14.7 9.95 24.66t24.66 9.96Zm228.46 0q14.7 0 24.66-9.94 9.97-9.95 9.97-24.66 0-14.7-9.95-24.66-9.95-9.97-24.66-9.97-14.7 0-24.66 9.95t-9.96 24.66q0 14.7 9.94 24.66 9.95 9.96 24.66 9.96ZM480-200Zm0-434.23Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-rocket, button:is(:hover, :focus) > i.cico-rocket { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M261.54-463.61q25.62-61.39 60.19-117.58 34.58-56.19 77.12-106.73l-54.31-11.39q-18.08-3.61-35.15 1.62-17.08 5.23-29.93 18.08L160.77-560.92q-13.46 13.46-10.15 32.54 3.3 19.07 21.38 26.3l89.54 38.47Zm544.53-371.93q-99.07-1.53-187.65 41Q529.85-752 459.85-682q-44.93 44.92-79.31 97.46-34.39 52.54-60.62 110.31-5 11.85-5 24.19 0 12.35 9.23 21.58L438-315q9.23 9.23 21.38 9.42 12.16.19 24-4.81 57.77-25.84 110.31-60.61 52.54-34.77 97.46-79.69 70-70 112.54-158.58 42.54-88.57 41-187.65 0-7.23-3.23-14.08-3.23-6.84-8.85-12.46-5.61-5.61-12.46-8.85-6.84-3.23-14.08-3.23ZM569.38-560.23q-20.3-20.31-20.3-49.58t20.3-49.57q20.31-20.31 49.58-20.31t49.58 20.31q20.3 20.3 20.3 49.57t-20.3 49.58q-20.31 20.31-49.58 20.31t-49.58-20.31Zm-97 307.84 38.46 89.54q7.24 18.08 26.31 21.69 19.08 3.62 32.54-9.84l118.69-118.69q12.85-12.85 18.08-30.43 5.23-17.57 1.61-35.65l-10.76-53.92q-51.16 42.53-107.04 77.11-55.89 34.58-117.89 60.19Zm-288.46-63.69q29.24-29.23 70.97-29.34 41.73-.12 70.96 29.11 29.23 29.23 29.23 70.96 0 41.73-29.23 70.96-40.7 40.7-96 49.5-55.31 8.81-111.31 15.5 6.69-56.38 16-111.5 9.31-55.11 49.38-95.19Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-rocket { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M292.08-486q16.31-32.61 34.77-62.85 18.46-30.23 40.69-59.69l-58.69-11.77q-3.08-.77-5.96.19-2.89.97-5.2 3.27l-90.54 90.54q-1.15 1.16-.77 2.7.39 1.53 1.93 2.3L292.08-486Zm470.07-286.92q-81.15 4.31-156.04 40.81-74.88 36.5-138.34 99.96Q424.61-589 391.61-541q-33 48-51.69 92.69l113.62 113Q498.23-354 546.42-387t91.35-76.15q63.46-63.46 99.96-137.85 36.5-74.38 40.81-155.54 0-3.23-.93-6.27-.92-3.04-3.53-5.65-2.62-2.62-5.66-3.54-3.04-.92-6.27-.92ZM545.23-540.23q-20.31-20.31-20.31-49.38 0-29.08 20.31-49.39 20.31-20.31 49.69-20.31 29.39 0 49.69 20.31 20.31 20.31 20.31 49.39 0 29.07-20.31 49.38-20.3 20.31-49.69 20.31-29.38 0-49.69-20.31Zm-54 253.15 35.31 84.39q.77 1.54 2.3 1.73 1.54.19 2.7-.96l90.54-90.16q2.3-2.31 3.27-5.19.96-2.89.19-5.96l-11.77-58.69q-29.46 22.23-59.69 40.38-30.24 18.15-62.85 34.46Zm344.46-504.76q3.77 105-36.96 199.49-40.73 94.5-125.35 179.12-1.92 1.92-3.65 3.46t-3.65 3.46l18.46 90.92q3.61 18.08-1.81 35.16-5.42 17.07-18.27 29.92L545.77-131.62q-13.46 13.46-32.54 10.16-19.08-3.31-26.31-21.39l-54.46-128-156.38-156.77-128-54.46q-18.08-7.23-21.5-26.3-3.42-19.08 10.04-32.54l118.69-118.69q12.85-12.85 30.23-18.08 17.38-5.23 35.46-1.62l90.92 18.47q1.93-1.93 3.27-3.47 1.35-1.53 3.27-3.46 84.62-84.61 179.12-125.54 94.5-40.92 199.5-37.15 7.23.62 14.26 3.54 7.04 2.92 12.66 8.54 5.61 5.61 8.34 12.46 2.73 6.84 3.35 14.08ZM180.85-317.15q29.23-29.23 71.27-29.35 42.03-.11 71.26 29.12 29.23 29.23 28.93 71.26-.31 42.04-29.54 71.27-40.69 40.69-96 49.5-55.31 8.81-111.31 15.5 6.7-56.38 15.7-111.5 9-55.11 49.69-95.8Zm42.77 42.53q-17.39 17.39-24.08 41.39-6.69 24-10.31 49.38 25.39-3.61 49.39-10.19T280-218q12-12 12.62-28.81.61-16.81-11.39-28.81t-28.81-11.5q-16.8.5-28.8 12.5Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-rule-settings { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='m259.23-233.08-29.07-27.84q-49.31-45.62-70.12-102.12-20.81-56.5-20.81-114.19 0-90.54 45.96-164.73 45.97-74.19 124.27-114.42 10.93-6.08 23.27-1.58 12.35 4.5 16.19 16.65 3.85 11.16-.5 22.69-4.34 11.54-14.88 17.62-61.46 33.15-97.89 92.73-36.42 59.58-36.42 131.04 0 46.92 17.77 91.15 17.77 44.23 55.31 81.77l25.38 25.39v-79.54q0-12.77 8.62-21.39 8.61-8.61 21.38-8.61t21.39 8.61q8.61 8.62 8.61 21.39v149.23q0 15.46-10.34 25.81-10.35 10.34-25.81 10.34H172.31q-12.77 0-21.39-8.61-8.61-8.62-8.61-21.39 0-12.77 8.61-21.38 8.62-8.62 21.39-8.62h86.92Zm403.08-448v79.54q0 12.77-8.62 21.39-8.61 8.61-21.38 8.61t-21.39-8.61q-8.61-8.62-8.61-21.39v-149.23q0-15.46 10.34-25.81 10.35-10.34 25.81-10.34h149.23q12.77 0 21.39 8.61 8.61 8.62 8.61 21.39 0 12.77-8.61 21.38-8.62 8.62-21.39 8.62h-86.92l29.07 27.84q37.93 38.93 58.97 82.46 21.03 43.54 27.8 90.08H756q-6.15-35-23.04-67.58-16.88-32.57-45.27-61.57l-25.38-25.39Zm32.92 597.23q-7.23 0-11.54-4.31-4.31-4.3-5.92-10.92l-5.92-32.08q-17.39-5-30-12.23-12.62-7.23-24.77-17.92l-31.46 10.69q-6.23 2.39-12.04.46-5.81-1.92-9.43-7.54L549-183.08q-4-5.61-2.38-12.23 1.61-6.61 6.61-11.23l24.54-21.31q-4.69-17.84-4.69-33.69 0-15.85 4.69-33.69l-24.54-21.31q-5-4.62-6.61-11.23Q545-334.39 549-340l15.15-25.39q3.62-5.61 9.43-7.53 5.81-1.93 12.04.46l31.46 10.69q12.15-10.69 24.77-17.92 12.61-7.23 30-12.23l5.92-32.08q1.61-6.62 5.92-10.92 4.31-4.31 11.54-4.31h29.54q7.23 0 11.54 4.31 4.3 4.3 5.92 10.92l5.92 32.08q17.39 5 30 12.53 12.62 7.54 24.77 18.85l30.85-11.92q6.23-2.39 12.34-.46 6.12 1.92 9.73 7.53L871-338.77q4 5.61 2.69 12.23t-6.31 11.23L842.23-294q4.69 16.61 4.69 33.08 0 16.46-4.69 33.07l24.54 21.31q5 4.62 6.61 11.23 1.62 6.62-2.38 12.23l-15.16 25.38q-3.61 5.62-9.42 7.54-5.81 1.93-12.04-.46l-31.46-10.69q-12.15 10.69-24.77 17.92-12.61 7.23-30 12.23l-5.92 32.08q-1.62 6.62-5.92 10.92-4.31 4.31-11.54 4.31h-29.54ZM710-178.46q34.15 0 58.61-24.46 24.47-24.47 24.47-58.62t-24.47-58.62q-24.46-24.46-58.61-24.46t-58.62 24.46q-24.46 24.47-24.46 58.62t24.46 58.62q24.47 24.46 58.62 24.46Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-save, button:is(:hover, :focus) > i.cico-save { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h447q16 0 30.5 6t25.5 17l114 114q11 11 17 25.5t6 30.5v447q0 33-23.5 56.5T760-120H200Zm280-120q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM280-560h280q17 0 28.5-11.5T600-600v-80q0-17-11.5-28.5T560-720H280q-17 0-28.5 11.5T240-680v80q0 17 11.5 28.5T280-560Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-save { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h447q16 0 30.5 6t25.5 17l114 114q11 11 17 25.5t6 30.5v447q0 33-23.5 56.5T760-120H200Zm560-526L646-760H200v560h560v-446ZM480-240q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM280-560h280q17 0 28.5-11.5T600-600v-80q0-17-11.5-28.5T560-720H280q-17 0-28.5 11.5T240-680v80q0 17 11.5 28.5T280-560Zm-80-86v446-560 114Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-schedule { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M520-496v-144q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v159q0 8 3 15.5t9 13.5l132 132q11 11 28 11t28-11q11-11 11-28t-11-28L520-496ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-search { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M380.77-335.39q-102.46 0-173.54-71.07-71.07-71.08-71.07-173.54t71.07-173.54q71.08-71.07 173.54-71.07t173.54 71.07q71.07 71.08 71.07 173.54 0 42.85-14.38 81.85-14.39 39-38.39 67.84l230.16 230.16q8.31 8.3 8.5 20.88.19 12.58-8.5 21.27t-21.08 8.69q-12.38 0-21.07-8.69L530.46-388.16q-30 24.77-69 38.77-39 14-80.69 14Zm0-59.99q77.31 0 130.96-53.66 53.66-53.65 53.66-130.96t-53.66-130.96q-53.65-53.66-130.96-53.66t-130.96 53.66Q196.15-657.31 196.15-580t53.66 130.96q53.65 53.66 130.96 53.66Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-stop { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M366.15-330h227.7q15.36 0 25.76-10.39Q630-350.79 630-366.15v-227.7q0-15.36-10.39-25.76Q609.21-630 593.85-630h-227.7q-15.36 0-25.76 10.39Q330-609.21 330-593.85v227.7q0 15.36 10.39 25.76Q350.79-330 366.15-330Zm113.92 230q-78.84 0-148.21-29.92t-120.68-81.21q-51.31-51.29-81.25-120.63Q100-401.1 100-479.93q0-78.84 29.92-148.21t81.21-120.68q51.29-51.31 120.63-81.25Q401.1-860 479.93-860q78.84 0 148.21 29.92t120.68 81.21q51.31 51.29 81.25 120.63Q860-558.9 860-480.07q0 78.84-29.92 148.21t-81.21 120.68q-51.29 51.31-120.63 81.25Q558.9-100 480.07-100Zm-.07-60q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-sync { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M240-478q0 45 17 87.5t53 78.5l10 10v-58q0-17 11.5-28.5T360-400q17 0 28.5 11.5T400-360v160q0 17-11.5 28.5T360-160H200q-17 0-28.5-11.5T160-200q0-17 11.5-28.5T200-240h70l-16-14q-52-46-73-105t-21-119q0-94 48-170.5T337-766q14-8 29.5-1t20.5 23q5 15-.5 30T367-691q-58 32-92.5 88.5T240-478Zm480-4q0-45-17-87.5T650-648l-10-10v58q0 17-11.5 28.5T600-560q-17 0-28.5-11.5T560-600v-160q0-17 11.5-28.5T600-800h160q17 0 28.5 11.5T800-760q0 17-11.5 28.5T760-720h-70l16 14q49 49 71.5 106.5T800-482q0 94-48 170.5T623-194q-14 8-29.5 1T573-216q-5-15 .5-30t19.5-23q58-32 92.5-88.5T720-482Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-sync-problem { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M480-280q-17 0-28.5-11.5T440-320q0-17 11.5-28.5T480-360q17 0 28.5 11.5T520-320q0 17-11.5 28.5T480-280Zm0-160q-17 0-28.5-11.5T440-480v-160q0-17 11.5-28.5T480-680q17 0 28.5 11.5T520-640v160q0 17-11.5 28.5T480-440Zm-280-40q0 54 21.5 99.5T280-302v-58q0-17 11.5-28.5T320-400q17 0 28.5 11.5T360-360v160q0 17-11.5 28.5T320-160H160q-17 0-28.5-11.5T120-200q0-17 11.5-28.5T160-240h69q-51-44-80-106t-29-134q0-94 49-170t128-116q14-8 29.5-1t20.5 23q5 16-1.5 31T325-690q-56 31-90.5 86.5T200-480Zm560 0q0-54-21.5-99.5T680-658v58q0 17-11.5 28.5T640-560q-17 0-28.5-11.5T600-600v-160q0-17 11.5-28.5T640-800h160q17 0 28.5 11.5T840-760q0 17-11.5 28.5T800-720h-69q51 44 80 106t29 134q0 94-49 170.5T663-193q-14 8-29.5.5T613-216q-5-16 1.5-31t20.5-23q56-31 90.5-86.5T760-480Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-tag { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M361.92-338.46 327-199.77q-2.23 9.92-9.54 15.61-7.31 5.7-17.84 5.7-14 0-22.93-11.16-8.92-11.15-5.07-24.53l31.07-124.31h-114q-15 0-24.11-11.46-9.12-11.47-5.27-25.85 2.62-10.54 10.73-16.61 8.12-6.08 18.65-6.08h129l40.77-163.08h-114q-15 0-24.11-11.46-9.12-11.46-5.27-25.85 2.61-10.53 10.73-16.61 8.11-6.08 18.65-6.08h129l34.93-138.69q2.23-9.92 9.53-15.61 7.31-5.7 17.85-5.7 14 0 22.92 11.16 8.92 11.15 5.08 24.53l-31.08 124.31h165.39L633-760.23q2.23-9.92 9.54-15.61 7.31-5.7 17.84-5.7 14 0 22.93 11.16 8.92 11.15 5.07 24.53l-31.07 124.31h114q15 0 24.11 11.46 9.12 11.47 5.27 25.85-2.62 10.54-10.73 16.61-8.12 6.08-18.65 6.08h-129l-40.77 163.08h114q15 0 24.11 11.46 9.12 11.46 5.27 25.85-2.61 10.53-10.73 16.61-8.11 6.08-18.65 6.08h-129l-34.93 138.69q-2.23 9.92-9.53 15.61-7.31 5.7-17.85 5.7-14 0-22.92-11.16-8.92-11.15-5.08-24.53l31.08-124.31H361.92Zm15-60h165.39l40.77-163.08H417.69l-40.77 163.08Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-text-fields { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='black'%3e%3cpath d='M341.11-180q-17.65 0-30.15-12.34t-12.5-29.97V-695H142.69q-17.79 0-30.24-12.43T100-737.62q0-17.76 12.34-30.07Q124.68-780 142.31-780h396.92q17.79 0 30.24 12.35 12.45 12.36 12.45 30 0 17.65-12.34 30.15T539.62-695H383.46v472.31q0 17.79-12.35 30.24t-30 12.45Zm357.31 0q-17.65 0-29.96-12.34-12.3-12.34-12.3-29.97v-274.61h-76.54q-17.79 0-30.24-12.44-12.46-12.43-12.46-30.19t12.34-30.06q12.34-12.31 29.97-12.31h238.08q17.79 0 30.24 12.35t12.45 30q0 17.65-12.34 30.15t-29.97 12.5h-76.92v274.61q0 17.63-12.35 29.97-12.36 12.34-30 12.34Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\na:is(:hover,:focus)>i.cico-upload-file, button:is(:hover, :focus) > i.cico-upload-file { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M440-367v127q0 17 11.5 28.5T480-200q17 0 28.5-11.5T520-240v-127l36 36q6 6 13.5 9t15 2.5q7.5-.5 14.5-3.5t13-9q11-12 11.5-28T612-388L508-492q-6-6-13-8.5t-15-2.5q-8 0-15 2.5t-13 8.5L348-388q-12 12-11.5 28t12.5 28q12 11 28 11.5t28-11.5l35-35ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h287q16 0 30.5 6t25.5 17l194 194q11 11 17 25.5t6 30.5v447q0 33-23.5 56.5T720-80H240Zm280-560q0 17 11.5 28.5T560-600h160L520-800v160Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-upload-file { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3e%3cpath d='M440-367v127q0 17 11.5 28.5T480-200q17 0 28.5-11.5T520-240v-127l36 36q6 6 13.5 9t15 2.5q7.5-.5 14.5-3.5t13-9q11-12 11.5-28T612-388L508-492q-6-6-13-8.5t-15-2.5q-8 0-15 2.5t-13 8.5L348-388q-12 12-11.5 28t12.5 28q12 11 28 11.5t28-11.5l35-35ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h287q16 0 30.5 6t25.5 17l194 194q11 11 17 25.5t6 30.5v447q0 33-23.5 56.5T720-80H240Zm280-560v-160H240v640h480v-440H560q-17 0-28.5-11.5T520-640ZM240-800v200-200 640-640Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-visibility-off { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M630.92-441.08 586-486q9-49.69-28.35-89.35Q520.31-615 466-606l-44.92-44.92q13.54-6.08 27.77-9.12 14.23-3.04 31.15-3.04 68.08 0 115.58 47.5T643.08-500q0 16.92-3.04 31.54-3.04 14.61-9.12 27.38Zm127.23 124.46L714-358q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-46.61-46.61q37.92-15.08 77.46-22.23Q438.39-780 480-780q140.61 0 253.61 77.54T898.46-500q-22.23 53.61-57.42 100.08-35.2 46.46-82.89 83.3Zm32.31 231.39L628.62-245.85q-30.77 11.39-68.2 18.62Q523-220 480-220q-141 0-253.61-77.54Q113.77-375.08 61.54-500q22.15-53 57.23-98.88 35.08-45.89 77.23-79.58l-110.77-112 42.16-42.15 705.22 705.22-42.15 42.16Zm-552.3-551.08q-31.7 25.23-61.66 60.66Q146.54-540.23 128-500q50 101 143.5 160.5T480-280q27.31 0 54.39-4.62 27.07-4.61 45.92-9.53L529.69-346q-10.23 4.15-23.69 6.61-13.46 2.47-26 2.47-68.08 0-115.58-47.5T316.92-500q0-12.15 2.47-25.42 2.46-13.27 6.61-24.27l-87.84-86.62ZM541-531Zm-131.77 65.77Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-visibility-setting { --cicon: url(\"data:image/svg+xml,%3csvg width='24px' height='24px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' fill='%2300000'%3e %3cpath d='M17.381%2c21.904C17.26%2c21.904 17.164%2c21.868 17.092%2c21.796C17.02%2c21.724 16.971%2c21.633 16.944%2c21.523L16.796%2c20.721C16.506%2c20.638 16.256%2c20.536 16.046%2c20.415C15.836%2c20.295 15.63%2c20.145 15.427%2c19.967L14.641%2c20.235C14.537%2c20.274 14.436%2c20.278 14.34%2c20.246C14.243%2c20.214 14.164%2c20.151 14.104%2c20.058L13.725%2c19.423C13.658%2c19.33 13.639%2c19.228 13.666%2c19.117C13.692%2c19.007 13.747%2c18.914 13.831%2c18.837L14.444%2c18.304C14.366%2c18.006 14.327%2c17.726 14.327%2c17.462C14.327%2c17.197 14.366%2c16.917 14.444%2c16.619L13.831%2c16.087C13.747%2c16.01 13.692%2c15.916 13.666%2c15.806C13.639%2c15.695 13.658%2c15.594 13.725%2c15.5L14.104%2c14.865C14.164%2c14.772 14.243%2c14.709 14.339%2c14.677C14.436%2c14.645 14.537%2c14.649 14.64%2c14.689L15.427%2c14.956C15.63%2c14.778 15.836%2c14.628 16.046%2c14.508C16.256%2c14.387 16.506%2c14.285 16.796%2c14.202L16.944%2c13.4C16.971%2c13.29 17.02%2c13.199 17.092%2c13.127C17.164%2c13.055 17.26%2c13.019 17.381%2c13.019L18.119%2c13.019C18.24%2c13.019 18.336%2c13.055 18.408%2c13.127C18.479%2c13.199 18.529%2c13.29 18.556%2c13.4L18.704%2c14.202C18.994%2c14.285 19.244%2c14.39 19.454%2c14.515C19.664%2c14.641 19.87%2c14.798 20.073%2c14.987L20.844%2c14.689C20.948%2c14.649 21.051%2c14.645 21.153%2c14.677C21.255%2c14.709 21.336%2c14.772 21.396%2c14.865L21.775%2c15.531C21.842%2c15.624 21.864%2c15.726 21.842%2c15.837C21.82%2c15.947 21.768%2c16.04 21.685%2c16.117L21.056%2c16.65C21.134%2c16.927 21.173%2c17.203 21.173%2c17.477C21.173%2c17.751 21.134%2c18.027 21.056%2c18.304L21.669%2c18.837C21.753%2c18.914 21.808%2c19.007 21.835%2c19.117C21.862%2c19.228 21.842%2c19.33 21.775%2c19.423L21.396%2c20.057C21.336%2c20.151 21.257%2c20.214 21.161%2c20.246C21.064%2c20.278 20.963%2c20.274 20.86%2c20.234L20.073%2c19.967C19.871%2c20.145 19.664%2c20.295 19.454%2c20.415C19.244%2c20.536 18.994%2c20.638 18.704%2c20.721L18.556%2c21.523C18.529%2c21.633 18.479%2c21.724 18.408%2c21.796C18.336%2c21.868 18.24%2c21.904 18.119%2c21.904L17.381%2c21.904ZM17.75%2c19.539C18.319%2c19.539 18.808%2c19.335 19.215%2c18.927C19.623%2c18.519 19.827%2c18.031 19.827%2c17.462C19.827%2c16.892 19.623%2c16.404 19.215%2c15.996C18.808%2c15.588 18.319%2c15.384 17.75%2c15.384C17.181%2c15.384 16.692%2c15.588 16.285%2c15.996C15.877%2c16.404 15.673%2c16.892 15.673%2c17.462C15.673%2c18.031 15.877%2c18.519 16.285%2c18.927C16.692%2c19.335 17.181%2c19.539 17.75%2c19.539Z' style='fill-rule:nonzero%3b'/%3e %3cpath d='M10.752%2c19.435C9.002%2c19.251 7.38%2c18.673 5.887%2c17.7C4.046%2c16.5 2.592%2c14.917 1.525%2c12.95C1.442%2c12.8 1.379%2c12.646 1.337%2c12.487C1.296%2c12.329 1.275%2c12.167 1.275%2c12C1.275%2c11.833 1.296%2c11.671 1.337%2c11.512C1.379%2c11.354 1.442%2c11.2 1.525%2c11.05C2.592%2c9.083 4.046%2c7.5 5.887%2c6.3C7.729%2c5.1 9.767%2c4.5 12%2c4.5C14.233%2c4.5 16.271%2c5.1 18.112%2c6.3C19.939%2c7.49 21.384%2c9.056 22.448%2c11L20.235%2c11C19.453%2c9.778 18.437%2c8.774 17.188%2c7.988C15.612%2c6.996 13.883%2c6.5 12%2c6.5C10.117%2c6.5 8.388%2c6.996 6.812%2c7.988C5.237%2c8.979 4.033%2c10.317 3.2%2c12C4.033%2c13.683 5.237%2c15.021 6.812%2c16.012C8.033%2c16.781 9.346%2c17.252 10.752%2c17.425L10.752%2c19.435ZM10.752%2c16.338C10.027%2c16.139 9.38%2c15.755 8.812%2c15.188C7.937%2c14.313 7.5%2c13.25 7.5%2c12C7.5%2c10.75 7.937%2c9.688 8.812%2c8.813C9.687%2c7.938 10.75%2c7.5 12%2c7.5C13.25%2c7.5 14.312%2c7.938 15.187%2c8.813C15.819%2c9.444 16.223%2c10.173 16.398%2c11L14.519%2c11C14.388%2c10.665 14.186%2c10.361 13.913%2c10.087C13.387%2c9.563 12.75%2c9.3 12%2c9.3C11.25%2c9.3 10.612%2c9.563 10.087%2c10.087C9.562%2c10.612 9.3%2c11.25 9.3%2c12C9.3%2c12.75 9.562%2c13.387 10.087%2c13.913C10.292%2c14.117 10.513%2c14.282 10.752%2c14.406L10.752%2c16.338Z'/%3e %3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-zoom-in { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M350.77-550h-47.69q-12.75 0-21.38-8.63-8.62-8.63-8.62-21.38 0-12.76 8.62-21.37 8.63-8.62 21.38-8.62h47.69v-47.69q0-12.75 8.63-21.38 8.63-8.62 21.38-8.62 12.76 0 21.37 8.62 8.62 8.63 8.62 21.38V-610h47.69q12.75 0 21.38 8.63 8.62 8.63 8.62 21.38 0 12.76-8.62 21.37-8.63 8.62-21.38 8.62h-47.69v47.69q0 12.75-8.63 21.38-8.63 8.62-21.38 8.62-12.76 0-21.37-8.62-8.62-8.63-8.62-21.38V-550Zm30 214.61q-102.55 0-173.58-71.01-71.03-71.01-71.03-173.54 0-102.52 71.01-173.6 71.01-71.07 173.54-71.07 102.52 0 173.6 71.03 71.07 71.03 71.07 173.58 0 42.85-14.38 81.85-14.39 39-38.39 67.84l230.16 230.16q8.31 8.3 8.5 20.88.19 12.58-8.5 21.27t-21.08 8.69q-12.38 0-21.07-8.69L530.46-388.16q-30 24.77-69 38.77-39 14-80.69 14Zm0-59.99q77.31 0 130.96-53.66 53.66-53.65 53.66-130.96t-53.66-130.96q-53.65-53.66-130.96-53.66t-130.96 53.66Q196.15-657.31 196.15-580t53.66 130.96q53.65 53.66 130.96 53.66Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }\n.cico-zoom-out { --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M315.38-550q-12.75 0-21.37-8.63-8.62-8.63-8.62-21.38 0-12.76 8.62-21.37 8.62-8.62 21.37-8.62h130.77q12.75 0 21.38 8.63 8.62 8.63 8.62 21.38 0 12.76-8.62 21.37-8.63 8.62-21.38 8.62H315.38Zm65.39 214.61q-102.55 0-173.58-71.01-71.03-71.01-71.03-173.54 0-102.52 71.01-173.6 71.01-71.07 173.54-71.07 102.52 0 173.6 71.03 71.07 71.03 71.07 173.58 0 42.85-14.38 81.85-14.39 39-38.39 67.84l230.16 230.16q8.31 8.3 8.5 20.88.19 12.58-8.5 21.27t-21.08 8.69q-12.38 0-21.07-8.69L530.46-388.16q-30 24.77-69 38.77-39 14-80.69 14Zm0-59.99q77.31 0 130.96-53.66 53.66-53.65 53.66-130.96t-53.66-130.96q-53.65-53.66-130.96-53.66t-130.96 53.66Q196.15-657.31 196.15-580t53.66 130.96q53.65 53.66 130.96 53.66Z'/%3e%3c/svg%3e\"); background-color: currentColor; mask-image: var(--cicon); -webkit-mask-image: var(--cicon); }:root{--size: 16px;--font: Inter, Roboto, \"Helvetica Neue\", \"Arial Nova\", \"Nimbus Sans\", Noto Sans, Arial, sans-serif;--font-icon: \"Material Symbols Outlined\";--speed1: .1s;--speed2: .2s;--speed3: .3s;--speed4: .4s;--active: rgb(128 128 128 / .192);--overlay: rgb(0 0 0 / .5);--elevate1: 0 .125rem .125rem 0 rgb(0 0 0 / .32);--elevate2: 0 .25rem .5rem 0 rgb(0 0 0 / .4);--elevate3: 0 .375rem .75rem 0 rgb(0 0 0 / .48);--top: env(safe-area-inset-top);--bottom: env(safe-area-inset-bottom);--left: env(safe-area-inset-left);--right: env(safe-area-inset-right)}:root,body.light{--primary: #6750a4;--on-primary: #ffffff;--primary-container: #e9ddff;--on-primary-container: #22005d;--secondary: #625b71;--on-secondary: #ffffff;--secondary-container: #e8def8;--on-secondary-container: #1e192b;--tertiary: #7e5260;--on-tertiary: #ffffff;--tertiary-container: #ffd9e3;--on-tertiary-container: #31101d;--error: #ba1a1a;--on-error: #ffffff;--error-container: #ffdad6;--on-error-container: #410002;--background: #fffbff;--on-background: #1c1b1e;--surface: #fdf8fd;--on-surface: #1c1b1e;--surface-variant: #e7e0eb;--on-surface-variant: #49454e;--outline: #7a757f;--outline-variant: #cac4cf;--shadow: #000000;--scrim: #000000;--inverse-surface: #313033;--inverse-on-surface: #f4eff4;--inverse-primary: #cfbcff;--surface-dim: #ddd8dd;--surface-bright: #fdf8fd;--surface-container-lowest: #ffffff;--surface-container-low: #f7f2f7;--surface-container: #f2ecf1;--surface-container-high: #ece7eb;--surface-container-highest: #e6e1e6}body.dark{--primary: #cfbcff;--on-primary: #381e72;--primary-container: #4f378a;--on-primary-container: #e9ddff;--secondary: #cbc2db;--on-secondary: #332d41;--secondary-container: #4a4458;--on-secondary-container: #e8def8;--tertiary: #efb8c8;--on-tertiary: #4a2532;--tertiary-container: #633b48;--on-tertiary-container: #ffd9e3;--error: #ffb4ab;--on-error: #690005;--error-container: #93000a;--on-error-container: #ffb4ab;--background: #1c1b1e;--on-background: #e6e1e6;--surface: #141316;--on-surface: #e6e1e6;--surface-variant: #49454e;--on-surface-variant: #cac4cf;--outline: #948f99;--outline-variant: #49454e;--shadow: #000000;--scrim: #000000;--inverse-surface: #e6e1e6;--inverse-on-surface: #313033;--inverse-primary: #6750a4;--surface-dim: #141316;--surface-bright: #3a383c;--surface-container-lowest: #0f0e11;--surface-container-low: #1c1b1e;--surface-container: #201f22;--surface-container-high: #2b292d;--surface-container-highest: #363438}@font-face{font-family:Material Symbols Outlined;font-style:normal;font-weight:400;font-display:block;src:url(material-symbols-outlined.woff2) format(\"woff2\"),url(https://cdn.jsdelivr.net/npm/beercss@3.7.10/dist/cdn/material-symbols-outlined.woff2) format(\"woff2\")}@font-face{font-family:Material Symbols Rounded;font-style:normal;font-weight:400;font-display:block;src:url(material-symbols-rounded.woff2) format(\"woff2\"),url(https://cdn.jsdelivr.net/npm/beercss@3.7.10/dist/cdn/material-symbols-rounded.woff2) format(\"woff2\")}@font-face{font-family:Material Symbols Sharp;font-style:normal;font-weight:400;font-display:block;src:url(material-symbols-sharp.woff2) format(\"woff2\"),url(https://cdn.jsdelivr.net/npm/beercss@3.7.10/dist/cdn/material-symbols-sharp.woff2) format(\"woff2\")}*{-webkit-tap-highlight-color:transparent;position:relative;vertical-align:middle;color:inherit;margin:0;padding:0;border-radius:inherit;box-sizing:border-box}body{color:var(--on-surface);background-color:var(--surface);overflow-x:hidden}label{font-size:.75rem;vertical-align:baseline}a,b,i,span,strong,em,code{vertical-align:baseline}a,button,.button{cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;border:none;font-family:inherit;outline:inherit;justify-content:center}a,button,.button,i,label{-webkit-user-select:none;user-select:none}body ::-webkit-scrollbar,body ::-webkit-scrollbar-thumb,body ::-webkit-scrollbar-button{background:none;inline-size:.4rem;block-size:.4rem}body :is(:hover,:focus)::-webkit-scrollbar-thumb{background:var(--outline);border-radius:1rem}*+:is(address,article,blockquote,code,.field,fieldset,form,.grid,h1,h2,h3,h4,h5,h6,nav,ol,p,pre,.row,section,aside,table,.tabs,ul){margin-block-start:1rem}:is(a,button,.button,.chip):focus-visible{outline:.125rem solid var(--primary);outline-offset:.25rem}.transparent{background-color:transparent!important;box-shadow:none!important;color:inherit!important}.primary{background-color:var(--primary)!important;color:var(--on-primary)!important}.primary-text{color:var(--primary)!important}.primary-border{border-color:var(--primary)!important}.primary-container{background-color:var(--primary-container)!important;color:var(--on-primary-container)!important}.secondary{background-color:var(--secondary)!important;color:var(--on-secondary)!important}.secondary-text{color:var(--secondary)!important}.secondary-border{border-color:var(--secondary)!important}.secondary-container{background-color:var(--secondary-container)!important;color:var(--on-secondary-container)!important}.tertiary{background-color:var(--tertiary)!important;color:var(--on-tertiary)!important}.tertiary-text{color:var(--tertiary)!important}.tertiary-border{border-color:var(--tertiary)!important}.tertiary-container{background-color:var(--tertiary-container)!important;color:var(--on-tertiary-container)!important}.error{background-color:var(--error)!important;color:var(--on-error)!important}.error-text{color:var(--error)!important}.error-border{border-color:var(--error)!important}.error-container{background-color:var(--error-container)!important;color:var(--on-error-container)!important}.background{background-color:var(--background)!important;color:var(--on-background)!important}.surface,.surface-dim,.surface-bright,.surface-container-lowest,.surface-container-low,.surface-container,.surface-container-high,.surface-container-highest{background-color:var(--surface)!important;color:var(--on-surface)!important}.surface-variant{background-color:var(--surface-variant)!important;color:var(--on-surface-variant)!important}.inverse-surface{background-color:var(--inverse-surface);color:var(--inverse-on-surface)}.inverse-primary{background-color:var(--inverse-primary);color:var(--primary)}.inverse-primary-text{color:var(--inverse-primary)!important}.inverse-primary-border{border-color:var(--inverse-primary)!important}.surface-dim{background-color:var(--surface-dim)!important}.surface-bright{background-color:var(--surface-bright)!important}.surface-container-lowest{background-color:var(--surface-container-lowest)!important}.surface-container{background-color:var(--surface-container)!important}.surface-container-high{background-color:var(--surface-container-high)!important}.surface-container-highest{background-color:var(--surface-container-highest)!important}.surface-container-low{background-color:var(--surface-container-low)!important}.black{background-color:#000!important}.black-border{border-color:#000!important}.black-text{color:#000!important}.white{background-color:#fff!important}.white-border{border-color:#fff!important}.white-text{color:#fff!important}.transparent-border{border-color:transparent!important}.transparent-text{color:transparent!important}.fill:not(i){background-color:var(--surface-variant)!important;color:var(--on-surface-variant)!important}.middle-align{display:flex;align-items:center!important}.bottom-align{display:flex;align-items:flex-end!important}.top-align{display:flex;align-items:flex-start!important}.left-align{text-align:start;justify-content:flex-start!important}.right-align{text-align:end;justify-content:flex-end!important}.center-align{text-align:center;justify-content:center!important}.red,.red6{background-color:#f44336!important}.red-border{border-color:#f44336!important}.red-text{color:#f44336!important}.red1{background-color:#ffebee!important}.red2{background-color:#ffcdd2!important}.red3{background-color:#ef9a9a!important}.red4{background-color:#e57373!important}.red5{background-color:#ef5350!important}.red7{background-color:#e53935!important}.red8{background-color:#d32f2f!important}.red9{background-color:#c62828!important}.red10{background-color:#b71c1c!important}.pink,.pink6{background-color:#e91e63!important}.pink-border{border-color:#e91e63!important}.pink-text{color:#e91e63!important}.pink1{background-color:#fce4ec!important}.pink2{background-color:#f8bbd0!important}.pink3{background-color:#f48fb1!important}.pink4{background-color:#f06292!important}.pink5{background-color:#ec407a!important}.pink7{background-color:#d81b60!important}.pink8{background-color:#c2185b!important}.pink9{background-color:#ad1457!important}.pink10{background-color:#880e4f!important}.purple,.purple6{background-color:#9c27b0!important}.purple-border{border-color:#9c27b0!important}.purple-text{color:#9c27b0!important}.purple1{background-color:#f3e5f5!important}.purple2{background-color:#e1bee7!important}.purple3{background-color:#ce93d8!important}.purple4{background-color:#ba68c8!important}.purple5{background-color:#ab47bc!important}.purple7{background-color:#8e24aa!important}.purple8{background-color:#7b1fa2!important}.purple9{background-color:#6a1b9a!important}.purple10{background-color:#4a148c!important}.deep-purple,.deep-purple6{background-color:#673ab7!important}.deep-purple-border{border-color:#673ab7!important}.deep-purple-text{color:#673ab7!important}.deep-purple1{background-color:#ede7f6!important}.deep-purple2{background-color:#d1c4e9!important}.deep-purple3{background-color:#b39ddb!important}.deep-purple4{background-color:#9575cd!important}.deep-purple5{background-color:#7e57c2!important}.deep-purple7{background-color:#5e35b1!important}.deep-purple8{background-color:#512da8!important}.deep-purple9{background-color:#4527a0!important}.deep-purple10{background-color:#311b92!important}.indigo,.indigo6{background-color:#3f51b5!important}.indigo-border{border-color:#3f51b5!important}.indigo-text{color:#3f51b5!important}.indigo1{background-color:#e8eaf6!important}.indigo2{background-color:#c5cae9!important}.indigo3{background-color:#9fa8da!important}.indigo4{background-color:#7986cb!important}.indigo5{background-color:#5c6bc0!important}.indigo7{background-color:#3949ab!important}.indigo8{background-color:#303f9f!important}.indigo9{background-color:#283593!important}.indigo10{background-color:#1a237e!important}.blue,.blue6{background-color:#2196f3!important}.blue-border{border-color:#2196f3!important}.blue-text{color:#2196f3!important}.blue1{background-color:#e3f2fd!important}.blue2{background-color:#bbdefb!important}.blue3{background-color:#90caf9!important}.blue4{background-color:#64b5f6!important}.blue5{background-color:#42a5f5!important}.blue7{background-color:#1e88e5!important}.blue8{background-color:#1976d2!important}.blue9{background-color:#1565c0!important}.blue10{background-color:#0d47a1!important}.light-blue,.light-blue6{background-color:#03a9f4!important}.light-blue-border{border-color:#03a9f4!important}.light-blue-text{color:#03a9f4!important}.light-blue1{background-color:#e1f5fe!important}.light-blue2{background-color:#b3e5fc!important}.light-blue3{background-color:#81d4fa!important}.light-blue4{background-color:#4fc3f7!important}.light-blue5{background-color:#29b6f6!important}.light-blue7{background-color:#039be5!important}.light-blue8{background-color:#0288d1!important}.light-blue9{background-color:#0277bd!important}.light-blue10{background-color:#01579b!important}.cyan,.cyan6{background-color:#00bcd4!important}.cyan-border{border-color:#00bcd4!important}.cyan-text{color:#00bcd4!important}.cyan1{background-color:#e0f7fa!important}.cyan2{background-color:#b2ebf2!important}.cyan3{background-color:#80deea!important}.cyan4{background-color:#4dd0e1!important}.cyan5{background-color:#26c6da!important}.cyan7{background-color:#00acc1!important}.cyan8{background-color:#0097a7!important}.cyan9{background-color:#00838f!important}.cyan10{background-color:#006064!important}.teal,.teal6{background-color:#009688!important}.teal-border{border-color:#009688!important}.teal-text{color:#009688!important}.teal1{background-color:#e0f2f1!important}.teal2{background-color:#b2dfdb!important}.teal3{background-color:#80cbc4!important}.teal4{background-color:#4db6ac!important}.teal5{background-color:#26a69a!important}.teal7{background-color:#00897b!important}.teal8{background-color:#00796b!important}.teal9{background-color:#00695c!important}.teal10{background-color:#004d40!important}.green,.green6{background-color:#4caf50!important}.green-border{border-color:#4caf50!important}.green-text{color:#4caf50!important}.green1{background-color:#e8f5e9!important}.green2{background-color:#c8e6c9!important}.green3{background-color:#a5d6a7!important}.green4{background-color:#81c784!important}.green5{background-color:#66bb6a!important}.green7{background-color:#43a047!important}.green8{background-color:#388e3c!important}.green9{background-color:#2e7d32!important}.green10{background-color:#1b5e20!important}.light-green,.light-green6{background-color:#8bc34a!important}.light-green-border{border-color:#8bc34a!important}.light-green-text{color:#8bc34a!important}.light-green1{background-color:#f1f8e9!important}.light-green2{background-color:#dcedc8!important}.light-green3{background-color:#c5e1a5!important}.light-green4{background-color:#aed581!important}.light-green5{background-color:#9ccc65!important}.light-green7{background-color:#7cb342!important}.light-green8{background-color:#689f38!important}.light-green9{background-color:#558b2f!important}.light-green10{background-color:#33691e!important}.lime,.lime6{background-color:#cddc39!important}.lime-border{border-color:#cddc39!important}.lime-text{color:#cddc39!important}.lime1{background-color:#f9fbe7!important}.lime2{background-color:#f0f4c3!important}.lime3{background-color:#e6ee9c!important}.lime4{background-color:#dce775!important}.lime5{background-color:#d4e157!important}.lime7{background-color:#c0ca33!important}.lime8{background-color:#afb42b!important}.lime9{background-color:#9e9d24!important}.lime10{background-color:#827717!important}.yellow,.yellow6{background-color:#ffeb3b!important}.yellow-border{border-color:#ffeb3b!important}.yellow-text{color:#ffeb3b!important}.yellow1{background-color:#fffde7!important}.yellow2{background-color:#fff9c4!important}.yellow3{background-color:#fff59d!important}.yellow4{background-color:#fff176!important}.yellow5{background-color:#ffee58!important}.yellow7{background-color:#fdd835!important}.yellow8{background-color:#fbc02d!important}.yellow9{background-color:#f9a825!important}.yellow10{background-color:#f57f17!important}.amber,.amber6{background-color:#ffc107!important}.amber-border{border-color:#ffc107!important}.amber-text{color:#ffc107!important}.amber1{background-color:#fff8e1!important}.amber2{background-color:#ffecb3!important}.amber3{background-color:#ffe082!important}.amber4{background-color:#ffd54f!important}.amber5{background-color:#ffca28!important}.amber7{background-color:#ffb300!important}.amber8{background-color:#ffa000!important}.amber9{background-color:#ff8f00!important}.amber10{background-color:#ff6f00!important}.orange,.orange6{background-color:#ff9800!important}.orange-border{border-color:#ff9800!important}.orange-text{color:#ff9800!important}.orange1{background-color:#fff3e0!important}.orange2{background-color:#ffe0b2!important}.orange3{background-color:#ffcc80!important}.orange4{background-color:#ffb74d!important}.orange5{background-color:#ffa726!important}.orange7{background-color:#fb8c00!important}.orange8{background-color:#f57c00!important}.orange9{background-color:#ef6c00!important}.orange10{background-color:#e65100!important}.deep-orange,.deep-orange6{background-color:#ff5722!important}.deep-orange-border{border-color:#ff5722!important}.deep-orange-text{color:#ff5722!important}.deep-orange1{background-color:#fbe9e7!important}.deep-orange2{background-color:#ffccbc!important}.deep-orange3{background-color:#ffab91!important}.deep-orange4{background-color:#ff8a65!important}.deep-orange5{background-color:#ff7043!important}.deep-orange7{background-color:#f4511e!important}.deep-orange8{background-color:#e64a19!important}.deep-orange9{background-color:#d84315!important}.deep-orange10{background-color:#bf360c!important}.brown,.brown6{background-color:#795548!important}.brown-border{border-color:#795548!important}.brown-text{color:#795548!important}.brown1{background-color:#efebe9!important}.brown2{background-color:#d7ccc8!important}.brown3{background-color:#bcaaa4!important}.brown4{background-color:#a1887f!important}.brown5{background-color:#8d6e63!important}.brown7{background-color:#6d4c41!important}.brown8{background-color:#5d4037!important}.brown9{background-color:#4e342e!important}.brown10{background-color:#3e2723!important}.blue-grey,.blue-grey6{background-color:#607d8b!important}.blue-grey-border{border-color:#607d8b!important}.blue-grey-text{color:#607d8b!important}.blue-grey1{background-color:#eceff1!important}.blue-grey2{background-color:#cfd8dc!important}.blue-grey3{background-color:#b0bec5!important}.blue-grey4{background-color:#90a4ae!important}.blue-grey5{background-color:#78909c!important}.blue-grey7{background-color:#546e7a!important}.blue-grey8{background-color:#455a64!important}.blue-grey9{background-color:#37474f!important}.blue-grey10{background-color:#263238!important}.grey,.grey6{background-color:#9e9e9e!important}.grey-border{border-color:#9e9e9e!important}.grey-text{color:#9e9e9e!important}.grey1{background-color:#fafafa!important}.grey2{background-color:#f5f5f5!important}.grey3{background-color:#eee!important}.grey4{background-color:#e0e0e0!important}.grey5{background-color:#bdbdbd!important}.grey7{background-color:#757575!important}.grey8{background-color:#616161!important}.grey9{background-color:#424242!important}.grey10{background-color:#212121!important}.horizontal{display:inline-flex;flex-direction:row!important;gap:1rem;inline-size:auto!important;max-inline-size:none!important}.horizontal>*{margin-block:0!important}.vertical{display:flex;flex-direction:column!important}:is(a,button,.button,.chip).vertical{display:inline-flex;gap:.25rem;block-size:auto!important;max-block-size:none!important;padding-block:.5rem}.vertical>*{margin-inline:0!important}.no-elevate{box-shadow:none!important}.small-elevate,.elevate{box-shadow:var(--elevate1)!important}.medium-elevate{box-shadow:var(--elevate2)!important}.large-elevate{box-shadow:var(--elevate3)!important}.round{border-radius:var(---round)}.small-round,.medium-round,.large-round{border-radius:var(---round)!important}.top-round,.bottom-round,.left-round,.right-round,.medium-round,.round{---round: 2rem}.small-round{---round: .5rem}.large-round{---round: 3.5rem}.no-round,.square,.top-round,.bottom-round,.left-round,.right-round{border-radius:0!important}.top-round{border-start-start-radius:var(---round)!important;border-start-end-radius:var(---round)!important}.bottom-round{border-end-end-radius:var(---round)!important;border-end-start-radius:var(---round)!important}.left-round{border-start-start-radius:var(---round)!important;border-end-start-radius:var(---round)!important}.right-round{border-start-end-radius:var(---round)!important;border-end-end-radius:var(---round)!important}.circle{border-radius:50%}:is(button,.button,.chip).circle{border-radius:2.5rem}:is(.circle,.square):not(i,img,video,svg),:is(.circle,.square).chip.medium{block-size:2.5rem;inline-size:2.5rem;padding:0}:is(.circle,.square)>span{display:none}:is(.circle,.square).small:not(i,img,video,svg),:is(.circle,.square).chip{block-size:2rem;inline-size:2rem}:is(.circle,.square).large:not(i,img,video,svg){block-size:3rem;inline-size:3rem}:is(.circle,.square).extra:not(i,img,video,svg){block-size:3.5rem;inline-size:3.5rem}:is(.circle,.square).round{border-radius:1rem!important}.border:not(table,.field){box-sizing:border-box;border:.0625rem solid var(--outline);background-color:transparent;box-shadow:none}.no-border{border-color:transparent!important}:is(nav,.row,dialog.max,header.fixed,footer.fixed,menu>a,menu.max,table,.tabs):not(.round){border-radius:0}[class*=margin]:not(.left-margin,.right-margin,.top-margin,.bottom-margin,.horizontal-margin,.vertical-margin){margin:var(---margin)!important}[class*=margin]{---margin: 1rem}.no-margin{---margin: 0}.auto-margin{---margin: auto}.tiny-margin{---margin: .25rem}.small-margin{---margin: .5rem}.large-margin{---margin: 1.5rem}.left-margin,.horizontal-margin{margin-inline-start:var(---margin)!important}.right-margin,.horizontal-margin{margin-inline-end:var(---margin)!important}.top-margin,.vertical-margin{margin-block-start:var(---margin)!important}.bottom-margin,.vertical-margin{margin-block-end:var(---margin)!important}.no-opacity{opacity:1!important}.opacity{opacity:0!important}.small-opacity{opacity:.75!important}.medium-opacity{opacity:.5!important}.large-opacity{opacity:.25!important}[class*=padding]:not(.left-padding,.right-padding,.top-padding,.bottom-padding,.horizontal-padding,.vertical-padding){padding:var(---padding)!important}[class*=padding]{---padding: 1rem}.no-padding{---padding: 0}.tiny-padding{---padding: .25rem}.small-padding{---padding: .5rem}.large-padding{---padding: 1.5rem}.left-padding,.horizontal-padding{padding-inline-start:var(---padding)!important}.right-padding,.horizontal-padding{padding-inline-end:var(---padding)!important}.top-padding,.vertical-padding{padding-block-start:var(---padding)!important}.bottom-padding,.vertical-padding{padding-block-end:var(---padding)!important}.front{z-index:10!important}.back{z-index:-10!important}.left{inset-inline-start:0}.right{inset-inline-end:0}.top{inset-block-start:0}.bottom{inset-block-end:0}.center{inset-inline-start:50%;transform:translate(-50%)}[dir=rtl] .center{transform:translate(50%)}.middle{inset-block-start:50%;transform:translateY(-50%)}.middle.center{transform:translate(-50%,-50%)}[dir=rtl] .middle.center{transform:translate(50%,-50%)}.scroll{overflow:auto}.no-scroll{overflow:hidden}[class*=width]{max-inline-size:100%}.auto-width{inline-size:auto}.small-width{inline-size:12rem!important}.medium-width{inline-size:24rem!important}.large-width{inline-size:36rem!important}.auto-height{block-size:auto}.small-height{block-size:12rem!important}.medium-height{block-size:24rem!important}.large-height{block-size:36rem!important}.wrap{display:block;white-space:normal}.no-wrap:not(menu){display:flex;white-space:nowrap}.tiny-space:not(nav,ol,ul,.row,.grid,table,.tooltip){block-size:.5rem}:is(.space,.small-space):not(nav,ol,ul,.row,.grid,table,.tooltip){block-size:1rem}.medium-space:not(nav,ol,ul,.row,.grid,table,.tooltip){block-size:2rem}.large-space:not(nav,ol,ul,.row,.grid,table,.tooltip){block-size:3rem}.responsive{inline-size:-webkit-fill-available;inline-size:-moz-available}@media only screen and (max-width: 600px){.m:not(.s),.l:not(.s),.m.l:not(.s){display:none}}@media only screen and (min-width: 601px) and (max-width: 992px){.s:not(.m),.l:not(.m),.s.l:not(.m){display:none}}@media only screen and (min-width: 993px){.m:not(.l),.s:not(.l),.m.s:not(.l){display:none}}html{font-size:var(--size)}body{font-family:var(--font);font-size:.875rem;line-height:1.5rem;letter-spacing:.0313rem}h1,h2,h3,h4,h5,h6{font-weight:400;display:block;align-items:center;line-height:normal}h1{font-size:3.5625rem}h2{font-size:2.8125rem}h3{font-size:2.25rem}h4{font-size:2rem}h5{font-size:1.75rem}h6{font-size:1.5rem}h1.small{font-size:3.0625rem}h2.small{font-size:2.3125rem}h3.small{font-size:1.75rem}h4.small{font-size:1.5rem}h5.small{font-size:1.25rem}h6.small{font-size:1rem}h1.large{font-size:4.0625rem}h2.large{font-size:3.3125rem}h3.large{font-size:2.75rem}h4.large{font-size:2.5rem}h5.large{font-size:2.25rem}h6.large{font-size:2rem}.link{color:var(--primary)!important}.inverse-link{color:var(--inverse-primary)!important}.truncate{overflow:hidden;white-space:nowrap!important;text-overflow:ellipsis;flex:inherit}.truncate>*{white-space:nowrap!important}.small-text{font-size:.75rem}.medium-text{font-size:.875rem}.large-text{font-size:1rem}.upper{text-transform:uppercase}.lower{text-transform:lowercase}.capitalize{text-transform:capitalize}.bold{font-weight:700}.overline{text-decoration:line-through}.underline{text-decoration:underline}.italic{font-style:italic}p{margin:.5rem 0}.no-line{line-height:normal}.tiny-line{line-height:1.25rem}.small-line{line-height:1.5rem}.medium-line{line-height:1.75rem}.large-line{line-height:2rem}.extra-line{line-height:2.25rem}pre{border-radius:0;background-color:var(--surface-container);white-space:pre-wrap;padding:1rem;border-inline-start:.25rem solid var(--primary);font-family:inherit}blockquote{border-radius:0;padding:1rem;border-inline-start:.25rem solid var(--primary);font-family:inherit}code{border-radius:0;background-color:var(--surface-container);white-space:pre-wrap;padding:.25rem}pre>code,blockquote>code{padding:0}.scroll>code{white-space:pre}pre:has(>code){direction:ltr;text-align:start}.wave:after,.chip:after,:is(.button,button):after,:is(nav.tabbed,.tabs)>a:after{content:\"\";position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;border-radius:inherit;inline-size:100%;block-size:100%;background-position:center;background-image:radial-gradient(circle,currentColor 1%,transparent 1%);opacity:0;transition:none}:is(.wave,.chip,.button,button,nav.tabbed>a,.tabs>a):is(:focus-visible,:hover):after{background-size:15000%;opacity:.1;transition:background-size var(--speed2) linear}:is(.wave,.chip,.button,button,nav.tabbed>a,.tabs>a):active:after{background-size:5000%;opacity:0;transition:none}.no-wave:after,.no-wave:is(:hover,:active):after{display:none}.badge{display:inline-flex;align-items:center;justify-content:center;position:absolute;font-size:.6875rem;text-transform:none;z-index:2;padding:0 .25rem;min-block-size:1rem;min-inline-size:1rem;background-color:var(--error);color:var(--on-error);line-height:normal;border-radius:1rem;inset:50% auto auto 50%;transform:translateY(-100%);font-family:var(--font)}.badge.top{transform:translate(-50%,-100%)}.badge.bottom{transform:translate(-50%)}.badge.left{transform:translate(-100%,-50%)}.badge.right{transform:translateY(-50%)}.badge.top.left{transform:translate(-100%,-100%)}.badge.bottom.left{transform:translate(-100%)}.badge.top.right{transform:translateY(-100%)}.badge.bottom.right{transform:translate(0)}.badge.border{border-color:var(--error);color:var(--error);background-color:var(--surface)}.badge:is(.circle,.square){text-align:center;inline-size:auto;block-size:auto;padding:0 .25rem;border-radius:1rem}.badge.square{border-radius:0}.badge.min>*{display:none}.badge.min{clip-path:circle(18.75% at 50% 50%)}nav:is(.left,.right,.top,.bottom)>a>.badge,nav:is(.left,.right,.top,.bottom)>:is(ol,ul)>li>a>.badge{inset:1rem auto auto 50%}.badge.none{inset:auto!important;transform:none;position:relative;margin:0 .125rem}:is(button,.button,.chip)>.badge.none{margin:0 -.5rem}.button,button{box-sizing:content-box;display:inline-flex;align-items:center;justify-content:center;block-size:2.5rem;min-inline-size:2.5rem;font-size:.875rem;font-weight:500;color:var(--on-primary);padding:0 1.5rem;background-color:var(--primary);margin:0 .5rem;border-radius:1.25rem;transition:transform var(--speed3),border-radius var(--speed3),padding var(--speed3);-webkit-user-select:none;user-select:none;gap:1rem;line-height:normal}:is(button,.button).small{block-size:2rem;min-inline-size:2rem;border-radius:1rem}:is(button,.button).large{block-size:3rem;min-inline-size:3rem;border-radius:1.5rem}:is(.button,button):is(.extra,.extend){block-size:3.5rem;min-inline-size:3.5rem;font-size:1rem;border-radius:1.75rem}:is(button,.button).border{border-color:var(--outline);color:var(--primary)}:is(button,.button):not(.border,.chip):hover{box-shadow:var(--elevate1)}.extend>span{display:none}.extend:is(:hover,.active){inline-size:auto;padding:0 1.5rem}.extend:is(:hover,.active)>i+span{display:inherit;margin-inline-start:1.5rem}.extend:is(:hover,.active)>:is(img,svg)+span{display:inherit;margin-inline-start:2.5rem}:is(.button,button)[disabled]{opacity:.5;cursor:not-allowed}.button[disabled]{pointer-events:none}:is(.button,button)[disabled]:before,:is(.button,button)[disabled]:after{display:none}:is(.button,button).fill{background-color:var(--secondary-container)!important;color:var(--on-secondary-container)!important}:is(.button,button).vertical{border-radius:2rem}article{box-shadow:var(--elevate1);background-color:var(--surface-container-low);color:var(--on-surface);padding:1rem;border-radius:.75rem;display:block;transition:transform var(--speed3),border-radius var(--speed3),padding var(--speed3)}article.small{block-size:12rem}article.medium{block-size:20rem}article.large{block-size:32rem}.chip{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;block-size:2rem;min-inline-size:2rem;font-size:.875rem;font-weight:500;background-color:transparent;border:.0625rem solid var(--outline-variant);color:var(--on-surface-variant);padding:0 1rem;margin:0 .5rem;text-transform:none;border-radius:.5rem;transition:transform var(--speed3),border-radius var(--speed3),padding var(--speed3);-webkit-user-select:none;user-select:none;gap:1rem;line-height:normal;letter-spacing:normal}.chip.fill:hover{box-shadow:var(--elevate1)}.chip.medium{block-size:2.5rem;min-inline-size:2.5rem;border-radius:.5rem}.chip.large{block-size:3rem;min-inline-size:3rem;border-radius:.5rem}.chip.fill{background-color:var(--secondary-container)!important;border:none}.chip.round.small{border-radius:1rem}.chip.round{border-radius:1.25rem}.chip.round.large{border-radius:1.5rem}main.responsive{flex:1;padding:.5rem;overflow-x:hidden}:is(main,header,footer,section).responsive{max-inline-size:75rem;margin:0 auto}:is(main,header,footer,section).responsive.max{max-inline-size:100%}*:has(>main.responsive){display:flex;flex-direction:column;min-block-size:100vh}*:has(>nav.bottom:not(.s,.m,.l)){padding-block-end:calc(var(--bottom) + 5rem)}*:has(>nav.top:not(.s,.m,.l)){padding-block-start:calc(var(--top) + 5rem)}*:has(>nav.left:not(.s,.m,.l)){padding-inline-start:calc(var(--left) + 5rem)}*:has(>nav.right:not(.s,.m,.l)){padding-inline-end:calc(var(--right) + 5rem)}*:has(>nav.drawer.left:not(.s,.m,.l)){padding-inline-start:calc(var(--left) + 20rem)}*:has(>nav.drawer.right:not(.s,.m,.l)){padding-inline-end:calc(var(--right) + 20rem)}nav.top:not(.s,.m,.l)~header.fixed{inset-block-start:5rem}nav.bottom:not(.s,.m,.l)~footer.fixed{inset-block-end:5rem}:not(main):has(>aside){overflow:auto}aside{z-index:1}aside:not(.fixed,.absolute).right{float:right}aside:not(.fixed,.absolute).left{float:left}@media only screen and (max-width: 600px){*:has(>nav.s.bottom){padding-block-end:calc(var(--bottom) + 5rem)}*:has(>nav.s.top){padding-block-start:calc(var(--top) + 5rem)}*:has(>nav.s.left){padding-inline-start:calc(var(--left) + 5rem)}*:has(>nav.s.right){padding-inline-end:calc(var(--right) + 5rem)}*:has(>nav.s.drawer.left){padding-inline-start:calc(var(--left) + 20rem)}*:has(>nav.s.drawer.right){padding-inline-end:calc(var(--right) + 20rem)}nav.s.top~header.fixed{inset-block-start:5rem}nav.s.bottom~footer.fixed{inset-block-end:5rem}}@media only screen and (min-width: 601px) and (max-width: 992px){*:has(>nav.m.bottom){padding-block-end:calc(var(--bottom) + 5rem)}*:has(>nav.m.top){padding-block-start:calc(var(--top) + 5rem)}*:has(>nav.m.left){padding-inline-start:calc(var(--left) + 5rem)}*:has(>nav.m.right){padding-inline-end:calc(var(--right) + 5rem)}*:has(>nav.m.drawer.left){padding-inline-start:calc(var(--left) + 20rem)}*:has(>nav.m.drawer.right){padding-inline-end:calc(var(--right) + 20rem)}nav.m.top~header.fixed{inset-block-start:5rem}nav.m.bottom~footer.fixed{inset-block-end:5rem}}@media only screen and (min-width: 993px){*:has(>nav.l.bottom){padding-block-end:calc(var(--bottom) + 5rem)}*:has(>nav.l.top){padding-block-start:calc(var(--top) + 5rem)}*:has(>nav.l.left){padding-inline-start:calc(var(--left) + 5rem)}*:has(>nav.l.right){padding-inline-end:calc(var(--right) + 5rem)}*:has(>nav.l.drawer.left){padding-inline-start:calc(var(--left) + 20rem)}*:has(>nav.l.drawer.right){padding-inline-end:calc(var(--right) + 20rem)}nav.l.top~header.fixed{inset-block-start:5rem}nav.l.bottom~footer.fixed{inset-block-end:5rem}}@media only screen and (max-width: 600px){main.responsive{padding-inline:calc(var(--left) + .5rem) calc(var(--right) + .5rem)}}dialog{display:block;border:none;opacity:0;visibility:hidden;position:fixed;box-shadow:var(--elevate2);color:var(--on-surface);background-color:var(--surface-container-high);padding:1.5rem;z-index:100;inset:10% auto auto 50%;min-inline-size:20rem;max-inline-size:100%;max-block-size:80%;overflow-x:hidden;overflow-y:auto;transition:all var(--speed3),0s background-color;border-radius:1.75rem;transform:translate(-50%,-4rem);outline:none}dialog::backdrop{display:none}dialog.small{inline-size:25%;block-size:25%}dialog.medium{inline-size:50%;block-size:50%}dialog.large{inline-size:75%;block-size:75%}dialog:is(.active,[open]){opacity:1;visibility:visible;transform:translate(-50%)}dialog.top{opacity:1;padding:1rem;inset:0 auto auto 0;block-size:auto;inline-size:100%;min-inline-size:auto;max-block-size:100%;transform:translateY(-100%);border-radius:0 0 1rem 1rem}[dir=rtl] dialog.right,dialog.left{opacity:1;padding:1rem;inset:0 auto auto 0;inline-size:auto;block-size:100%;max-block-size:100%;border-radius:0 1rem 1rem 0;background-color:var(--surface);transform:translate(-100%)}[dir=rtl] dialog.left,dialog.right{opacity:1;padding:1rem;inset:0 0 auto auto;inline-size:auto;block-size:100%;max-block-size:100%;border-radius:1rem 0 0 1rem;background-color:var(--surface);transform:translate(100%)}dialog.bottom{opacity:1;padding:1rem;inset:auto auto 0 0;block-size:auto;inline-size:100%;min-inline-size:auto;max-block-size:100%;transform:translateY(100%);border-radius:1rem 1rem 0 0}dialog.max{inset:0 auto auto 0;inline-size:100%;block-size:100%;max-inline-size:100%;max-block-size:100%;transform:translateY(4rem);background-color:var(--surface)}dialog:is(.active,[open]):is(.left,.right,.top,.bottom,.max){transform:translate(0)}dialog.small:is(.left,.right){inline-size:20rem}dialog.medium:is(.left,.right){inline-size:32rem}dialog.large:is(.left,.right){inline-size:44rem}dialog.small:is(.top,.bottom){block-size:16rem}dialog.medium:is(.top,.bottom){block-size:24rem}dialog.large:is(.top,.bottom){block-size:32rem}hr,[class*=divider]{all:unset;min-inline-size:1.5rem;min-block-size:auto;block-size:.0625rem;background-color:var(--outline-variant);display:block}hr+*,[class*=divider]+*{margin:0!important}hr.medium,.medium-divider{margin:1rem 0!important}hr.large,.large-divider{margin:1.5rem 0!important}hr.small,.small-divider{margin:.5rem 0!important}hr.vertical,.divider.vertical{min-inline-size:auto;min-block-size:1.5rem;inline-size:.0625rem}summary.none{list-style-type:none}summary.none::-webkit-details-marker{display:none}summary{cursor:pointer}summary:focus{outline:none}.field{---size: 3rem;---start: 1.2rem;block-size:var(---size);margin-block-end:2rem;border-radius:.25rem .25rem 0 0}.grid>*>.field{margin-block-end:1rem}.grid>*>.field+.field{margin-block-start:2rem}.grid.no-space>*>.field+.field{margin-block-start:1rem}.grid.medium-space>*>.field+.field{margin-block-start:2.5rem}.grid.large-space>*>.field+.field{margin-block-start:3rem}.field.small{---size: 2.5rem;---start: 1rem}.field.large{---size: 3.5rem;---start: 1.4rem}.field.extra{---size: 4rem;---start: 1.6rem}.field.border{border-radius:.25rem}.field.round.small{border-radius:1.25rem}.field.round{border-radius:1.5rem}.field.round.large{border-radius:1.75rem}.field.round.extra{border-radius:2rem}.field>:is(i,img,svg,progress,a:not(.helper,.error)){position:absolute;inset:50% auto auto auto;transform:translateY(-50%);cursor:pointer;z-index:0;inline-size:1.5rem;block-size:1.5rem}.field>:is(i,img,svg,progress,a:not(.helper,.error)),[dir=rtl] .field>:is(i,img,svg,progress,a:not(.helper,.error)):first-child{inset:50% 1rem auto auto}.field>:is(i,img,svg,progress,a:not(.helper,.error)):first-child,[dir=rtl] .field>:is(i,img,svg,progress,a:not(.helper,.error)){inset:50% auto auto 1rem}.field.invalid>i{color:var(--error)}.field>progress.circle{inset-block-start:calc(50% - .75rem)!important;border-width:.1875rem}.field>a:not(.helper,.error){z-index:10}.field>a>:is(i,img,svg,progress,a:not(.helper,.error)){inline-size:1.5rem;block-size:1.5rem}.field>:is(input,textarea,select){all:unset;position:relative;display:flex;align-items:center;box-sizing:border-box;border-radius:inherit;border:.0625rem solid transparent;padding:0 .9375rem;font-family:inherit;font-size:1rem;inline-size:100%;block-size:100%;outline:none;z-index:1;background:none;resize:none;text-align:start;cursor:text}input::-webkit-date-and-time-value{text-align:start}:is(input,select,textarea):-webkit-autofill{-webkit-background-clip:text;-webkit-text-fill-color:var(--on-surface)}.field>:is(input,textarea,select):focus{border:.125rem solid transparent;padding:0 .875rem}.field.min>textarea{overflow:hidden;position:absolute;top:0;right:0;bottom:0;left:0;max-block-size:12rem}input[type=file],input[type=color],:not(.field)>input[type^=date],:not(.field)>input[type^=time],input::-webkit-calendar-picker-indicator{opacity:0;position:absolute;top:0;right:0;bottom:0;left:0;inline-size:100%;block-size:100%;margin:0;padding:0;border:0;outline:0;z-index:2!important}input::-webkit-search-decoration,input::-webkit-search-cancel-button,input::-webkit-search-results-button,input::-webkit-search-results-decoration,input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{display:none}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.field.border>:is(input,textarea,select){border-color:var(--outline)}.field.border>:is(input,textarea,select):focus{border-color:var(--primary)}.field.round>:is(input,textarea,select){padding-inline:1.4376rem}.field.round>:is(input,textarea,select):focus{padding-inline:1.375rem}.field.prefix>:is(input,textarea,select){padding-inline-start:2.9375rem}.field.prefix>.slider{margin-inline-start:3.5rem}.field.prefix>:is(input,textarea,select):focus{padding-inline-start:2.875rem}.field.suffix>:is(input,textarea,select){padding-inline-end:2.9375rem}.field.suffix>.slider{margin-inline-end:3.5rem}.field.suffix>:is(input,textarea,select):focus{padding-inline-end:2.875rem}.field:not(.border,.round)>:is(input,textarea,select){border-block-end-color:var(--outline)}.field:not(.border,.round)>:is(input,textarea,select):focus{border-block-end-color:var(--primary)}.field.round:not(.border,.fill)>:is(input,textarea,select),.field.round:not(.border)>:is(input,textarea,select):focus{box-shadow:var(--elevate1)}.field.round:not(.border,.fill)>:is(input,textarea,select):focus{box-shadow:var(--elevate2)}.field.invalid:not(.border,.round)>:is(input,textarea,select),.field.invalid:not(.border,.round)>:is(input,textarea,select):focus{border-block-end-color:var(--error)}.field.invalid.border>:is(input,textarea,select),.field.invalid.border>:is(input,textarea,select):focus{border-color:var(--error)}.field:has(>:disabled){opacity:.5;cursor:not-allowed}.field>:disabled{cursor:not-allowed}.field.textarea.small:not(.min){---size: 4.5rem}.field.textarea:not(.min){---size: 5.5rem}.field.textarea.large:not(.min){---size: 6.5rem}.field.textarea.extra:not(.min){---size: 7.5rem}.field>select{-webkit-user-select:none;user-select:none}.field>select>option{background-color:var(--surface-container);color:var(--on-surface)}.field.label>:is(input,select){padding-block-start:1rem}.field.label.border:not(.fill)>:is(input,select){padding-block-start:0}.field>textarea{padding-block-start:var(---start);white-space:pre-wrap}.field>textarea:focus{padding-block-start:calc(var(---start) - .06rem)}.field:not(.label)>textarea,.field.border.label:not(.fill)>textarea{padding-block-start:calc(var(---start) - .5rem)}.field:not(.label)>textarea:focus,.field.border.label:not(.fill)>textarea:focus{padding-block-start:calc(var(---start) - .56rem)}.field.label>label{position:absolute;inset:-.5rem auto auto 1rem;display:flex;inline-size:calc(100% - 5rem);block-size:4rem;line-height:4rem;font-size:1rem;transition:all .2s;gap:.25rem;white-space:nowrap}[dir=rtl] .field.label>label{inset:-.5rem 1rem auto auto}.field.label.small>label{block-size:3.5rem;line-height:3.5rem}.field.label.large>label{block-size:4.5rem;line-height:4.5rem}.field.label.extra>label{block-size:5rem;line-height:5rem}.field.label.border.prefix:not(.fill)>:is(label.active,:focus+label,[placeholder]:not(:placeholder-shown)+label,select+label){inset-inline-start:1rem}.field.label.round>label,.field.label.border.prefix.round:not(.fill)>:is(label.active,:focus+label,[placeholder]:not(:placeholder-shown)+label,select+label){inset-inline-start:1.5rem}.field.label.prefix>label{inset-inline-start:3rem}.field.label>:is(label.active,:focus+label,[placeholder]:not(:placeholder-shown)+label,select+label){block-size:2.5rem;line-height:2.5rem;font-size:.75rem}.field.label.border:not(.fill)>:is(label.active,:focus+label,[placeholder]:not(:placeholder-shown)+label,select+label){block-size:1rem;line-height:1rem}.field.label.border:not(.fill)>label:after{content:\"\";display:block;margin-block-start:.5rem;border-block-start:.0625rem solid var(--outline);block-size:1rem;transition:none;flex:auto}.field.label.border:not(.fill)>:focus+label:after{border-block-start:.125rem solid var(--primary)}.field.label.border:not(.fill)>:is(input,textarea):is(:focus,[placeholder]:not(:placeholder-shown),.active),.field.label.border:not(.fill)>select{clip-path:polygon(-2% -2%,.75rem -2%,.75rem .5rem,calc(100% - 5rem) .5rem,calc(100% - 5rem) -2%,102% -2%,102% 102%,-2% 102%)}[dir=rtl] .field.label.border:not(.fill)>:is(input,textarea):is(:focus,[placeholder]:not(:placeholder-shown),.active),[dir=rtl] .field.label.border:not(.fill)>select{clip-path:polygon(-2% -2%,5rem -2%,5rem .5rem,calc(100% - .75rem) .5rem,calc(100% - .75rem) -2%,102% -2%,102% 102%,-2% 102%)}.field.label.border.round:not(.fill)>:is(input,textarea):is(:focus,[placeholder]:not(:placeholder-shown),.active),.field.label.border.round:not(.fill)>select{clip-path:polygon(-2% -2%,1.25rem -2%,1.25rem .5rem,calc(100% - 5rem) .5rem,calc(100% - 5rem) -2%,102% -2%,102% 102%,-2% 102%)}[dir=rtl] .field.label.border.round:not(.fill)>:is(input,textarea):is(:focus,[placeholder]:not(:placeholder-shown),.active),[dir=rtl] .field.label.border.round:not(.fill)>select{clip-path:polygon(-2% -2%,5rem -2%,5rem .5rem,calc(100% - 1.25rem) .5rem,calc(100% - 1.25rem) -2%,102% -2%,102% 102%,-2% 102%)}.field.label>:focus+label{color:var(--primary)}.field.label.invalid>label,.field.label.invalid>label:after{color:var(--error)!important;border-color:var(--error)!important}.field.label>label>a{block-size:inherit;line-height:inherit;inline-size:1rem}.field.label>label>a>:is(i,img,svg){block-size:1rem;line-height:1rem;inline-size:1rem;font-size:1rem}.field>:is(.helper,.error){position:absolute;inset:auto auto 0 1rem;transform:translateY(100%);font-size:.75rem;background:none!important;padding-block-start:.125rem}[dir=rtl] .field>:is(.helper,.error){inset:auto 1rem 0 auto}a.helper{color:var(--primary)}.field>.error{color:var(--error)!important}.field.round>:is(.helper,.error){inset-inline-start:1.5rem}.field.invalid>.helper{display:none}table td>.field{margin:0}fieldset{border-radius:.25rem;padding:1rem;border:.0625rem solid var(--outline-variant)}fieldset>legend{margin:0 -.25rem;padding:0 .25rem}fieldset>legend+*{margin-block-start:0!important}.grid{---gap: 1rem;display:grid;grid-template-columns:repeat(12,calc(8.33% - var(---gap) + (var(---gap) / 12)));gap:var(---gap)}.grid.no-space{---gap: 0rem}.grid.medium-space{---gap: 1.5rem}.grid.large-space{---gap: 2rem}.grid>*{margin:0}.s1{grid-area:auto/span 1}.s2{grid-area:auto/span 2}.s3{grid-area:auto/span 3}.s4{grid-area:auto/span 4}.s5{grid-area:auto/span 5}.s6{grid-area:auto/span 6}.s7{grid-area:auto/span 7}.s8{grid-area:auto/span 8}.s9{grid-area:auto/span 9}.s10{grid-area:auto/span 10}.s11{grid-area:auto/span 11}.s12{grid-area:auto/span 12}@media only screen and (min-width: 601px){.m1{grid-area:auto/span 1}.m2{grid-area:auto/span 2}.m3{grid-area:auto/span 3}.m4{grid-area:auto/span 4}.m5{grid-area:auto/span 5}.m6{grid-area:auto/span 6}.m7{grid-area:auto/span 7}.m8{grid-area:auto/span 8}.m9{grid-area:auto/span 9}.m10{grid-area:auto/span 10}.m11{grid-area:auto/span 11}.m12{grid-area:auto/span 12}}@media only screen and (min-width: 993px){.l1{grid-area:auto/span 1}.l2{grid-area:auto/span 2}.l3{grid-area:auto/span 3}.l4{grid-area:auto/span 4}.l5{grid-area:auto/span 5}.l6{grid-area:auto/span 6}.l7{grid-area:auto/span 7}.l8{grid-area:auto/span 8}.l9{grid-area:auto/span 9}.l10{grid-area:auto/span 10}.l11{grid-area:auto/span 11}.l12{grid-area:auto/span 12}}i,:is(.checkbox,.radio,.switch)>span:before,.icon>span>i{---size: 1.5rem;font-family:var(--font-icon);font-weight:400;font-style:normal;font-size:var(---size);letter-spacing:normal;text-transform:none;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;word-wrap:normal;direction:ltr;font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased;vertical-align:middle;text-align:center;overflow:hidden;inline-size:var(---size);min-inline-size:var(---size);block-size:var(---size);min-block-size:var(---size);box-sizing:content-box;line-height:normal}i.tiny{---size: 1rem}.chip>i,i.small{---size: 1.25rem}i.medium{---size: 1.5rem}i.large{---size: 1.75rem}i.extra{---size: 2rem}i.fill,a.row:is(:hover,:focus)>i,.transparent:is(:hover,:focus)>i{font-variation-settings:\"FILL\" 1}i>:is(img,svg){inline-size:100%;block-size:100%;background-size:100%;border-radius:inherit;position:absolute;inset:0 auto auto 0;padding:inherit}i[class*=fa-]{font-size:calc(var(---size) * .85);line-height:normal;block-size:auto;min-block-size:auto}.absolute{position:absolute}.fixed{position:fixed}:is(.absolute,.fixed).left.right{inline-size:auto}:is(.absolute,.fixed).left.right.small{block-size:20rem}:is(.absolute,.fixed).left.right.medium{block-size:28rem}:is(.absolute,.fixed).left.right.large{block-size:44rem}:is(.absolute,.fixed).top.bottom.small{inline-size:20rem}:is(.absolute,.fixed).top.bottom.medium{inline-size:28rem}:is(.absolute,.fixed).top.bottom.large{inline-size:44rem}header,footer{display:flex;justify-content:center;flex-direction:column;min-block-size:4rem;padding:0 1rem;background-color:var(--surface-container)}main~footer{min-block-size:5rem}:is(header,footer).fixed.responsive{z-index:12}:is(header,footer,menu>*).fixed{position:sticky;top:0;right:0;bottom:0;left:0;z-index:11;background-color:inherit}:is(dialog,menu,nav,article)>:is(header,footer){background-color:inherit;padding:0}:is(dialog,article,[class*=padding])>:is(header,footer).fixed{---translateY: 1rem;transform:translateY(var(---translateY))}:is(dialog,article,[class*=padding])>header.fixed{transform:translateY(calc(-1 * var(---translateY)))}.no-padding>:is(header,footer).fixed{transform:none}.small-padding>:is(header,footer).fixed{---translateY: .5rem}:is(.large-padding,dialog:not(.left,.right,.top,.bottom))>:is(header,footer).fixed{---translateY: 1.5rem}svg{fill:currentcolor}:is(img,svg,video):is(.small,.medium,.large,.tiny,.extra,.round,.circle,.responsive){object-fit:cover;object-position:center;transition:transform var(--speed3),border-radius var(--speed3),padding var(--speed3);block-size:3rem;inline-size:3rem}:is(img,svg,video).round{border-radius:.5rem}:is(img,svg,video).tiny{block-size:2rem;inline-size:2rem}:is(img,svg,video).small{block-size:2.5rem;inline-size:2.5rem}:is(img,svg,video).large{block-size:3.5rem;inline-size:3.5rem}:is(img,svg,video).extra{block-size:4rem;inline-size:4rem}:is(img,svg,video).responsive{inline-size:100%;block-size:100%;margin:0 auto}:is(button,.button,.chip):not(.transparent)>.responsive{border:.25rem solid transparent}:is(button,.button,.chip.medium)>.responsive{inline-size:2.5rem}:is(button.small,.button.small,.chip:not(.medium))>.responsive{inline-size:2rem}:is(button,.button,.chip).large>.responsive{inline-size:3rem}:is(button,.button,.chip).extra>.responsive{inline-size:3.5rem}:is(img,svg,video).responsive.tiny{inline-size:100%;block-size:4rem}:is(img,svg,video).responsive.small{inline-size:100%;block-size:8rem}:is(img,svg,video).responsive.medium{inline-size:100%;block-size:12rem}:is(img,svg,video).responsive.large{inline-size:100%;block-size:16rem}:is(img,svg,video).responsive.extra{inline-size:100%;block-size:20rem}:is(img,svg,video).responsive.round{border-radius:2rem}:is(img,svg,video).empty-state{max-inline-size:100%;inline-size:24rem}:is(button,.button,.chip,.field)>:is(img,svg):not(.responsive,.tiny,.small,.medium,.large,.extra),.tabs :is(img,svg):not(.responsive,.tiny,.small,.medium,.large,.extra){min-inline-size:1.5rem;max-inline-size:1.5rem;min-block-size:1.5rem;max-block-size:1.5rem}:is(button,.button,.chip)>:is(i,img,svg),:is(button,.button,.chip)>.responsive{margin:0 -.5rem}:is(button,.button)>.responsive{margin-inline-start:-1.5rem}:is(button,.button)>span+.responsive{margin-inline-start:-.5rem;margin-inline-end:-1.5rem}.chip>.responsive{margin-inline-start:-1rem}.chip>span+.responsive{margin-inline-start:-.5rem;margin-inline-end:-1rem}:is(.circle,.square)>.responsive{margin:0}.extend>:is(.responsive,i){margin:0;position:absolute;inset-inline:1rem;z-index:1}.extend>.responsive{inset-inline:0;inline-size:3.5rem}.extend.border>.responsive{inline-size:3.375rem}menu>li{all:unset}menu{opacity:0;visibility:hidden;position:absolute;box-shadow:var(--elevate2);background-color:var(--surface-container);z-index:11;inset:auto auto 0 0;inline-size:100%;max-block-size:50vh;max-inline-size:none!important;overflow-x:hidden;overflow-y:auto;font-size:.875rem;font-weight:400;text-transform:none;color:var(--on-surface);line-height:normal;text-align:start;border-radius:.25rem;transform:scale(.8) translateY(120%);transition:all var(--speed2),0s background-color}[dir=rtl] menu{inset:auto 0 0 auto}menu.no-wrap{inline-size:max-content;white-space:nowrap!important}menu.active,menu:not([data-ui]):active,:not(menu,[data-ui]):focus-within>menu,menu>:is(a,li):hover+menu,menu>menu:hover{opacity:1;visibility:visible;transform:scale(1) translateY(100%)}menu *{white-space:inherit!important}menu>a,menu>li>a{padding:.5rem 1rem;min-block-size:3rem;flex:1}menu>a:not(.row),menu>li>a:not(.row){display:flex;flex-direction:column;align-items:flex-start}menu>a:is(:hover,:focus,.active),menu>li>a:is(:hover,:focus,.active){background-color:var(--active)}menu.min{inset:0 0 auto 0;transform:none!important;border-radius:inherit}[dir=rtl] menu.min.right,menu.min.left{inset:0 0 auto auto}[dir=rtl] menu.min.left,menu.min.right{inset:0 auto auto 0}menu.max{position:fixed;top:0;right:0;bottom:0;left:0;block-size:100%;max-block-size:none;min-block-size:auto;z-index:100;transform:none!important}menu.no-wrap:is(.min,.max){min-inline-size:16rem}[dir=rtl] menu.right,menu.left{inset:auto 0 0 auto}[dir=rtl] menu.left,menu.right{inset:auto auto 0 0}menu:has(>menu),menu>menu{---child: 1;---type: 0;overflow:unset;white-space:nowrap;inline-size:auto;min-inline-size:12rem;max-block-size:none}menu>menu,menu>menu.right,[dir=rtl] menu>menu.left{inset:auto auto calc(3rem * (var(---child) - var(---type))) 100%}[dir=rtl] menu>menu,[dir=rtl] menu>menu.right,menu>menu.left{inset:auto 100% calc(3rem * (var(---child) - var(---type))) auto}menu>:nth-last-child(2){---child: 2}menu>:nth-last-child(3){---child: 3}menu>:nth-last-child(4){---child: 4}menu>:nth-last-child(5){---child: 5}menu>:nth-last-child(6){---child: 6}menu>:nth-last-child(7){---child: 7}menu>:nth-last-child(8){---child: 8}menu>:nth-last-child(9){---child: 9}menu>:nth-last-child(10){---child: 10}menu>:nth-last-child(11){---child: 11}menu>:nth-last-of-type(2){---type: 1}menu>:nth-last-of-type(3){---type: 2}menu>:nth-last-of-type(4){---type: 3}menu>:nth-last-of-type(5){---type: 4}menu>:nth-last-of-type(6){---type: 5}menu>:nth-last-of-type(7){---type: 6}menu>:nth-last-of-type(8){---type: 7}menu>:nth-last-of-type(9){---type: 8}menu>:nth-last-of-type(10){---type: 9}menu>:nth-last-of-type(11){---type: 10}nav>:is(ol,ul),nav>:is(ol,ul)>li{all:unset}nav,.row,a.row,nav.drawer>:is(a,label),nav.drawer>:is(ol,ul)>li>:is(a,label){display:flex;align-items:center;align-self:normal;text-align:start;justify-content:flex-start;white-space:nowrap;gap:1rem}a.row{min-block-size:3rem;margin:0}:is(nav,.row,.max)>:only-child,nav>:is(ol,ul)>li>:only-child{margin:0}:is(nav,.row)>*{margin:0;white-space:normal;flex:none}:is(nav,.row).no-space{gap:0}:is(nav,.row).no-space>.border+.border{border-inline-start:0}:is(nav,.row).medium-space{gap:1.5rem}:is(nav,.row).large-space{gap:2rem}:is(nav,.row)>.max,:is(nav,.row)>:is(ol,ul)>.max,nav.drawer>:is(a,label)>.max,nav.drawer>:is(ol,ul)>li>:is(a,label)>.max{flex:1}:is(nav,.row).wrap{display:flex;flex-wrap:wrap}:is(header,footer)>:is(nav,.row){min-block-size:inherit}:is(nav,.row)>.border.no-margin+.border.no-margin{border-inline-start:0}nav:is(.left,.right,.top,.bottom){border:0;position:fixed;color:var(--on-surface);transform:none;z-index:100;block-size:auto;inline-size:auto;text-align:center;padding:.5rem 1rem;inset:var(--top) var(--right) var(--bottom) var(--left);margin:0}nav:is(.left,.right){inline-size:5rem;justify-content:flex-start;flex-direction:column;background-color:var(--surface)}nav:is(.top,.bottom){block-size:5rem;justify-content:center;flex-direction:row;background-color:var(--surface-container)}nav.top{inset-block-end:auto}nav.left{inset-inline-end:auto}nav.right{inset-inline-start:auto}nav.bottom{inset-block-start:auto}nav.drawer{flex-direction:column;align-items:normal;inline-size:20rem;gap:0;padding:.5rem 1rem}nav.drawer:is(.min,.max){inline-size:auto}nav.drawer.max{inline-size:100%}:is(nav,.row)>header{background-color:inherit}nav:is(.left,.right)>header{transform:translateY(-.5rem)}nav.drawer>header{transform:translateY(-.75rem);min-block-size:4.5rem;align-self:stretch}nav.drawer>:is(a,label),nav.drawer>:is(ol,ul)>li>:is(a,label),a.row.wave{padding:.75rem;font-size:inherit}nav.drawer>a,nav.drawer>:is(ol,ul)>li>a{border-radius:2rem}nav.drawer>a:is(:hover,.active),nav.drawer>:is(ol,ul)>li>a:is(:hover,.active){background-color:var(--secondary-container)}nav.drawer>a:is(:hover,:focus,.active)>i,nav.drawer>:is(ol,ul)>li>a:is(:hover,:focus,.active)>i{font-variation-settings:\"FILL\" 1}nav>:is(ol,ul){all:inherit;flex:auto}nav:not(.left,.right,.bottom,.top)>:is(ol,ul){padding:0}nav:is(.left,.right,.top,.bottom):not(.drawer)>a:not(.button,.chip),nav:is(.left,.right,.top,.bottom):not(.drawer)>:is(ol,ul)>li>a:not(.button,.chip){align-self:center;display:flex;flex-direction:column;gap:.25rem;line-height:normal}nav:is(.top,.bottom):not(.drawer)>a:not(.button,.chip),nav:is(.top,.bottom):not(.drawer)>:is(ol,ul)>li>a:not(.button,.chip){inline-size:3.5rem}nav:is(.left,.right,.top,.bottom):not(.drawer)>a:not(.button,.chip)>i,nav:is(.left,.right,.top,.bottom):not(.drawer)>:is(ol,ul)>li>a:not(.button,.chip)>i{padding:.25rem;border-radius:2rem;transition:padding var(--speed1) linear;margin:0 auto}nav:is(.left,.right,.top,.bottom):not(.drawer)>a:not(.button,.chip):is(:hover,:focus,.active)>i,nav:is(.left,.right,.top,.bottom):not(.drawer)>:is(ol,ul)>li>a:not(.button,.chip):is(:hover,:focus,.active)>i{background-color:var(--secondary-container);color:var(--on-secondary-container);padding:.25rem 1rem;font-variation-settings:\"FILL\" 1}:is(nav,.row):is(.left-align,.top-align,.vertical){justify-content:flex-start}:is(nav,.row):is(.right-align,.bottom-align){justify-content:flex-end}:is(nav,.row):is(.center-align,.middle-align){justify-content:center}:is(nav,.row):is(.left-align,.top-align,.vertical).vertical{align-items:flex-start}:is(nav,.row):is(.right-align,.bottom-align).vertical{align-items:flex-end}:is(nav,.row):is(.center-align,.middle-align).vertical{align-items:center}:is(.drawer,.vertical)>:is(li,[class*=divider],hr):not(.vertical),:is(.drawer,.vertical)>:is(ol,ul)>li:not(.vertical){align-self:stretch}nav:not(.left,.right)>.space{inline-size:.5rem}nav:not(.left,.right)>.medium-space{inline-size:1rem}nav:not(.left,.right)>.large-space{inline-size:1.5rem}nav.tabbed{background-color:var(--surface-container);border-radius:4rem!important;gap:0rem;block-size:4rem}nav.tabbed.small{block-size:3rem}nav.tabbed.large{block-size:5rem}nav.tabbed>a{border-radius:inherit;block-size:inherit;display:inline-flex;align-items:center;padding-inline:1rem;gap:.5rem;font-size:1rem;flex:1}nav.tabbed>a.active{background-color:var(--primary-container)}:not(nav)>:is(ul,ol){all:revert}:is(.scroll,.no-scroll,.no-space,.tabs,.tabbed)>:focus-visible{outline:.125rem solid var(--primary);outline-offset:-.125rem}@media only screen and (max-width: 600px){nav.top,nav.bottom{justify-content:space-around}}.overlay{opacity:0;visibility:hidden;position:fixed;top:0;right:0;bottom:0;left:0;color:var(--on-surface);background-color:var(--overlay);z-index:100;transition:all var(--speed3),0s background-color}.overlay.active{opacity:1;visibility:visible}.page{---transform: translate(0, 0);opacity:0;position:absolute;display:none}.page.active{opacity:1;position:inherit;display:inherit;animation:var(--speed4) to-page ease}.page.active.top{---transform: translate(0, -4rem)}.page.active.bottom{---transform: translate(0, 4rem)}.page.active.left{---transform: translate(-4rem, 0)}.page.active.right{---transform: translate(4rem, 0)}@keyframes to-page{0%{opacity:0;transform:var(---transform)}to{opacity:1;transform:translate(0)}}progress{position:relative;inline-size:100%;block-size:.5rem;color:var(--primary);background:var(--primary-container);border-radius:1rem;flex:none;border:none;overflow:hidden;writing-mode:horizontal-tb;direction:ltr;-webkit-appearance:none}progress.small{inline-size:4rem}progress.medium{inline-size:8rem}progress.large{inline-size:12rem}progress:not(.circle,[value]):after{content:\"\";position:absolute;top:0;right:0;bottom:0;left:0;inline-size:100%;block-size:100%;clip-path:none;background:currentcolor;animation:1.6s to-linear ease infinite}progress:not(.circle,[value])::-moz-progress-bar{animation:1.6s to-linear ease infinite}progress:not(.circle,[value])::-webkit-progress-value{animation:1.6s to-linear ease infinite}progress::-webkit-progress-bar{background:none}progress::-webkit-progress-value{background:currentcolor}progress::-moz-progress-bar{background:currentcolor}progress.circle{display:inline-block;inline-size:2.5rem;block-size:2.5rem;border-radius:50%;border-width:.3rem;border-style:solid;border-color:currentcolor;animation:1.6s to-circular linear infinite;background:none;flex:none}progress.circle::-moz-progress-bar{background:none}progress.circle.small{inline-size:1.5rem;block-size:1.5rem;border-width:.2rem}progress.circle.large{inline-size:3.5rem;block-size:3.5rem;border-width:.4rem}:is(nav,.row,.field)>progress:not(.circle,.small,.medium,.large){flex:auto}progress.max{display:unset;position:absolute;inline-size:100%!important;block-size:100%!important;color:var(--active);background:none;top:0;right:0;bottom:0;left:0;border-radius:inherit;animation:none;writing-mode:horizontal-tb}progress:is(.horizontal,.vertical,.max){display:unset;inline-size:100%!important}progress.vertical{writing-mode:vertical-lr}progress.max.vertical{transform:rotate(-180deg)}:has(>progress)>:not(progress){z-index:1}:is(.button,button,.chip)>progress.circle{color:inherit}@supports (-moz-appearance:none){progress.max.vertical{transform:none}}@keyframes to-linear{0%{margin-inline-start:0%;inline-size:0%}50%{margin-inline-start:0%;inline-size:100%}to{margin-inline-start:100%;inline-size:0%}}@keyframes to-circular{0%{transform:rotate(0);clip-path:polygon(50% 50%,0% 0%,50% 0%,50% 0%,50% 0%,50% 0%,50% 0%,50% 0%,50% 0%)}20%{clip-path:polygon(50% 50%,0% 0%,50% 0%,100% 0%,100% 0%,100% 0%,100% 0%,100% 0%,100% 0%)}30%{clip-path:polygon(50% 50%,0% 0%,50% 0%,100% 0%,100% 50%,100% 50%,100% 50%,100% 50%,100% 50%)}40%{clip-path:polygon(50% 50%,0% 0%,50% 0%,100% 0%,100% 50%,100% 100%,100% 100%,100% 100%,100% 100%)}50%{clip-path:polygon(50% 50%,50% 0%,50% 0%,100% 0%,100% 50%,100% 100%,50% 100%,50% 100%,50% 100%)}60%{clip-path:polygon(50% 50%,100% 50%,100% 50%,100% 50%,100% 50%,100% 100%,50% 100%,0% 100%,0% 100%)}70%{clip-path:polygon(50% 50%,50% 100%,50% 100%,50% 100%,50% 100%,50% 100%,50% 100%,0% 100%,0% 50%)}80%{clip-path:polygon(50% 50%,0% 100%,0% 100%,0% 100%,0% 100%,0% 100%,0% 100%,0% 100%,0% 50%)}90%{transform:rotate(360deg);clip-path:polygon(50% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%)}to{clip-path:polygon(50% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%,0% 50%)}}.checkbox,.radio,.switch{direction:ltr;inline-size:auto;block-size:auto;line-height:normal;white-space:nowrap;cursor:pointer;display:inline-flex;align-items:center}:is(.checkbox,.radio)>input{inline-size:1.5rem;block-size:1.5rem;opacity:0}.switch>input{inline-size:3.25rem;block-size:2rem;opacity:0}:is(.checkbox,.radio,.switch)>span{display:inline-flex;align-items:center;color:var(--on-surface);font-size:.875rem}:is(.checkbox,.radio)>span:not(:empty){padding-inline-start:.25rem}:is(.checkbox,.radio,.switch)>span:before,.icon>span>i,:is(.checkbox,.radio)>span:after{content:\"\";inline-size:1.5rem;block-size:1.5rem;box-sizing:border-box;margin:0 auto;outline:none;color:var(--primary);position:absolute;inset:auto auto auto -1.5rem;border-radius:50%;-webkit-user-select:none;user-select:none;z-index:1}.switch>span:before,.switch.icon>span>i{position:absolute;inset:50% auto auto 0;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;transition:all var(--speed2);font-size:1rem;-webkit-user-select:none;user-select:none;min-inline-size:auto;content:\"\";color:var(--surface-variant);background-color:var(--outline)}.switch>span:before,.switch.icon>span>i{transform:translate(-3rem,-50%) scale(.6)}.switch.icon>span>i{transform:translate(-3rem,-50%) scale(1)}.checkbox>span:before{content:\"check_box_outline_blank\"}.checkbox>input:checked+span:before{content:\"check_box\";font-variation-settings:\"FILL\" 1}.checkbox>input:indeterminate+span:before{content:\"indeterminate_check_box\"}.radio>span:before{content:\"radio_button_unchecked\"}.radio>input:checked+span:before{content:\"radio_button_checked\"}:is(.radio,.checkbox,.switch).icon>span:before{content:\"\"!important;font-variation-settings:unset!important}:is(.checkbox,.radio)>span:after{transition:all var(--speed1);background-color:currentColor;box-shadow:0 0 0 0 currentColor;opacity:0}:is(.checkbox,.radio):is(:hover)>input:not(:disabled)+span:after,:is(.checkbox,.radio)>input:not(:disabled):is(:focus)+span:after{box-shadow:0 0 0 .5rem currentColor;opacity:.1}.switch>input:not(:disabled):is(:focus,:hover)+span:before,.switch.icon>input:not(:disabled):is(:focus,:hover)+span>i{box-shadow:0 0 0 .5rem var(--active)}:is(.checkbox,.radio)>input:checked+span:before,:is(.checkbox,.radio).icon>input:checked+span>i{color:var(--primary)}.icon>input:checked+span>i:first-child,.icon>span>i:last-child{opacity:0}.icon>input:checked+span>i:last-child,.icon>span>i:first-child{opacity:1}.switch>input:checked+span:after{border:none;background-color:var(--primary)}.switch>input:checked+span:before,.switch.icon>input:checked+span>i{content:\"check\";color:var(--primary);background-color:var(--on-primary)}.switch>input:checked+span:before,.switch.icon>input:checked+span>i{transform:translate(-1.75rem,-50%) scale(1)}:is(.checkbox,.radio,.switch)>input:disabled+span{opacity:.5;cursor:not-allowed}.switch>span:after{content:\"\";position:absolute;inset:50% auto auto 0;background-color:var(--active);border:.125rem solid var(--outline);box-sizing:border-box;inline-size:3.25rem;block-size:2rem;border-radius:2rem}.switch>span:after{transform:translate(-3.25rem,-50%)}.field>:is(nav,.row){flex-grow:1;padding:0 1rem}.field.round>:is(nav,.row){flex-grow:1;padding:0 1.5rem}[dir=rtl] .switch{transform:scale(-1)}[dir=rtl] .switch>span:before,[dir=rtl] .switch.icon>span>i{transform:translate(-3rem,-50%) scale(-.6)}[dir=rtl] .switch.icon>span>i{transform:translate(-3rem,-50%) scale(-1)}[dir=rtl] .switch>input:checked+span:before,[dir=rtl] .switch.icon>input:checked+span>i{transform:translate(-1.75rem,-50%) scale(-1)}.switch>:focus-visible+span:after{outline:.125rem solid var(--primary);outline-offset:.25rem}:is(.checkbox,.radio)>:focus-visible+span:before{outline:.125rem solid var(--primary);outline-offset:.375rem}.slider{---start: 0%;---end: 0%;---value1: \"\";---value2: \"\";display:flex;align-items:center!important;inline-size:auto;block-size:1.25rem;margin:1.125rem;flex:none;direction:ltr}[dir=rtl] .slider{transform:scaleX(-1)}.slider.vertical{flex-direction:row!important;margin:.5rem auto!important;padding:50% 0;transform:rotate(-90deg);inline-size:100%}.slider.small{inline-size:4rem}.slider.medium{inline-size:8rem}.slider.large{inline-size:12rem}.slider>input{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:none;border:none;outline:none;pointer-events:none;inline-size:100%;block-size:1rem;background:none;z-index:1;padding:0;margin:0;transform:rotate(0)}.slider>input:only-of-type{pointer-events:all}.slider>input+input{position:absolute}.slider>input::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:none;border:none;outline:none;pointer-events:all;block-size:2.75rem;inline-size:.25rem;border-radius:.25rem;background:var(--primary);cursor:grab;margin:0}.slider>input::-webkit-slider-thumb:active{cursor:grabbing}.slider>input::-moz-range-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:none;border:none;outline:none;pointer-events:all;block-size:2.75rem;inline-size:.25rem;border-radius:.25rem;background:var(--primary);cursor:grab;margin:0}.slider>input::-moz-range-thumb:active{cursor:grabbing}.slider>input:not(:disabled):is(:focus)::-webkit-slider-thumb{transform:scaleX(.6)}.slider>input:not(:disabled):is(:focus)::-moz-range-thumb{transform:scaleX(.6)}.slider>input:disabled{cursor:not-allowed;opacity:1}.slider>input:disabled::-webkit-slider-thumb{background:#9e9e9e;cursor:not-allowed}.slider>input:disabled::-moz-range-thumb{background:#9e9e9e;cursor:not-allowed}.slider>input:disabled~span{background:#9e9e9e}.slider>span{position:absolute;block-size:1rem;border-radius:1rem 0 0 1rem;background:var(--primary);z-index:0;inset:calc(50% - .5rem) var(---end) auto var(---start);clip-path:polygon(0 0,calc(100% - .5rem) 0,calc(100% - .5rem) 100%,0 100%)}.slider>input+input~span{border-radius:0;clip-path:polygon(.5rem 0,max(.5rem,calc(100% - .5rem)) 0,max(.5rem,calc(100% - .5rem)) 100%,.5rem 100%)}.field>.slider{inline-size:100%}.slider:before{content:\"\";position:absolute;inline-size:100%;block-size:1rem;border-radius:1rem;background:var(--primary-container);clip-path:polygon(calc(var(---start) - .5rem) 0,0 0,0 100%,calc(var(---start) - .5rem) 100%,calc(var(---start) - .5rem) 0,calc(100% - var(---end) + .5rem) 0,100% 0,100% 100%,calc(100% - var(---end) + .5rem) 100%,calc(100% - var(---end) + .5rem) 0)}.slider:has(>[disabled]):before{background:var(--active)}.slider>.tooltip{visibility:hidden!important;opacity:0!important;inset:0 auto auto calc(100% - var(---end));border-radius:2rem;transition:top var(--speed2) ease,opacity var(--speed2) ease;transform:translate(-50%,-50%)!important;padding:.75rem 1rem}[dir=rtl] .slider>.tooltip{transform:translate(-50%,-50%) scaleX(-1)!important}.slider>.tooltip+.tooltip{inset:.25rem calc(100% - var(---start)) auto auto;transform:translate(50%,-50%)!important}[dir=rtl] .slider>.tooltip+.tooltip{transform:translate(50%,-50%) scaleX(-1)!important}.slider>.tooltip:before{content:var(---value1)}.slider>.tooltip+.tooltip:before{content:var(---value2)}.slider>:focus~.tooltip{inset-block-start:-1rem!important;opacity:1!important;visibility:visible!important}.slider.vertical>.tooltip{display:none}:is(nav,.row,.field)>.slider:not(.circle,.small,.medium,.large){flex:auto}.slider.max,.slider.max.vertical,.slider.max>input,.slider.max.vertical>input{all:unset;margin:0!important;position:absolute;color:var(--primary);top:0;right:0;bottom:0;left:0;border-radius:inherit;overflow:hidden;z-index:2;cursor:grab;inline-size:100%;block-size:100%}.slider.max:before{display:none}.slider.max.vertical>input{writing-mode:vertical-lr;transform:rotate(-180deg)}.slider.max>input::-webkit-slider-thumb{opacity:0;inline-size:1rem;block-size:100vh;transform:none!important}.slider.max>input::-moz-range-thumb{opacity:0;inline-size:1rem;block-size:100vh;transform:none!important}.slider.max>span{block-size:auto!important;inset:0 var(---end) 0 var(---start);clip-path:none;background:currentcolor;border-radius:0}.slider.max.vertical>span{inset:var(---end) 0 var(---start) 0}.slider>input:focus-visible::-webkit-slider-thumb{outline:.1875rem solid var(--primary);outline-offset:.25rem}.slider>input:focus-visible::-moz-range-thumb{outline:.1875rem solid var(--primary);outline-offset:.25rem}.slider.max>input:focus-visible{outline:.1875rem solid var(--primary);outline-offset:-.125rem}@media (pointer: coarse){.slider>:hover~.tooltip{inset-block-start:-1rem!important;opacity:1!important;visibility:visible!important}}.snackbar{position:fixed;inset:auto auto 6rem 50%;inline-size:80%;block-size:auto;z-index:200;visibility:hidden;display:flex;box-shadow:var(--elevate2);color:var(--inverse-on-surface);background-color:var(--inverse-surface);padding:1rem;opacity:1;cursor:pointer;text-align:start;align-items:center;border-radius:.25rem;gap:.5rem;transition:all var(--speed2);transform:translate(-50%,1rem);opacity:0}.snackbar.top{inset:6rem auto auto 50%}.snackbar.active{visibility:visible;transform:translate(-50%);opacity:1}.snackbar>.max{flex:auto}@media only screen and (min-width: 993px){.snackbar{inline-size:40%}}table{inline-size:100%;border-spacing:0;font-size:.875rem;text-align:start}.scroll>table,table :is(thead,tbody,tfoot,tr,th,td){background-color:inherit;color:inherit}:is(th,td){inline-size:auto;text-align:inherit;padding:.5rem}:is(th,td)>*{vertical-align:middle}table.border>tbody>tr:not(:last-child)>td,thead>tr>th{border-block-end:.0625rem solid var(--outline)}tfoot>tr>th{border-block-start:.0625rem solid var(--outline)}table.stripes>tbody>tr:nth-child(odd){background-color:var(--active)}table.no-space :is(th,td){padding:0}table.medium-space :is(th,td){padding:.75rem}table.large-space :is(th,td){padding:1rem}table>.fixed,th.fixed{position:sticky;z-index:1;inset-block-start:0}tfoot.fixed,tfoot th.fixed{inset-block-end:0}:is(td,th).min{inline-size:.1%;white-space:nowrap}.tabs{display:flex;white-space:nowrap;border-block-end:.0625rem solid var(--surface-variant)}.tabs:not(.left-align,.right-align,.center-align){justify-content:space-around}.tabs>a{display:flex;font-size:.875rem;font-weight:500;color:var(--on-surface-variant);padding:.5rem 1rem;text-align:center;min-block-size:3rem;inline-size:100%;gap:.25rem}.tabs.small>a{min-block-size:2rem}.tabs.large>a{min-block-size:4rem}.tabs>a.active,.tabs>a.active>i{color:var(--primary)}.tabs>a.active:before{content:\"\";position:absolute;inset:auto 0 0 0;block-size:.125rem;background-color:var(--primary)}.tabs.min>a.active:before{margin:0 auto;max-inline-size:min(100%,4rem)}.tabs:is(.left-align,.center-align,.right-align)>a{inline-size:auto}.tooltip{---space: -.5rem;visibility:hidden;display:flex;align-items:center;justify-content:center;gap:.5rem;background-color:var(--inverse-surface);color:var(--inverse-on-surface);font-size:.75rem;text-align:center;border-radius:.25rem;padding:.5rem;position:absolute;z-index:3;inset:0 auto auto 50%;inline-size:auto;white-space:nowrap;font-weight:500;opacity:0;transition:all var(--speed2);line-height:normal;transform:translate(-50%,-100%) scale(.9)}.tooltip.left{inset:50% auto auto 0;transform:translate(-100%,-50%) scale(.9)}.tooltip.right{inset:50% 0 auto auto;transform:translate(100%,-50%) scale(.9)}.tooltip.bottom{inset:auto auto 0 50%;transform:translate(-50%,100%) scale(.9)}.tooltip.small{inline-size:8rem;white-space:normal}.tooltip.medium{inline-size:12rem;white-space:normal}.tooltip.large{inline-size:16rem;white-space:normal}:hover>.tooltip{visibility:visible;opacity:1;transform:translate(-50%,-100%) scale(1)}:hover>.tooltip.left{transform:translate(-100%,-50%) scale(1)}:hover>.tooltip.right{transform:translate(100%,-50%) scale(1)}:hover>.tooltip.bottom{transform:translate(-50%,100%) scale(1)}.tooltip.no-space{---space: 0}.tooltip.medium-space{---space: -1rem}.tooltip.large-space{---space: -1.5rem}.tooltip:not(.left,.right,.bottom){margin-block-start:var(---space)!important}.tooltip.left,.tooltip.right{margin-inline:var(---space)!important}.tooltip.bottom{margin-block-end:var(---space)!important}menu:active~.tooltip,:is(button,.button):focus>menu~.tooltip,.field>:focus~menu~.tooltip{visibility:hidden}.slider>.tooltip{---space: -1.25rem}.slider.vertical>.tooltip{---space: -.75rem}.slider.vertical>.tooltip:is(.left,.right){---space: -.5rem}.tooltip.max{display:block;font-size:inherit;white-space:normal;text-align:start;inline-size:20rem;border-radius:.5rem;padding:1rem;box-shadow:var(--elevate2)}[class*=blur],[class*=blur].light{---blur: 1rem;-webkit-backdrop-filter:blur(var(---blur));backdrop-filter:blur(var(---blur));color:var(--on-surface);background-color:#ffffff80}.dark [class*=blur],[class*=blur].dark{background-color:#00000080}.small-blur{---blur: .5rem}.large-blur{---blur: 1.5rem}.shadow{background-color:#00000050}:is(.left-shadow,.right-shadow,.top-shadow,.bottom-shadow){background-color:transparent!important}.left-shadow{background-image:linear-gradient(to right,black,transparent)}.right-shadow{background-image:linear-gradient(to left,black,transparent)}.bottom-shadow{background-image:linear-gradient(to top,black,transparent)}.top-shadow{background-image:linear-gradient(to bottom,black,transparent)}\n\n/* Reduce gap between item. 1rem by default in beercss */\nnav, .row, a.row, nav.drawer>:is(a,label), nav.drawer>:is(ol,ul)>li>:is(a,label) {\n gap: 0.5rem;\n}\n\n/* fix textarea on focus with small class */\n.field.small>textarea, .field.small>textarea:focus {\n padding-top: 0.625rem;\n}\n\n/* for page number input of embedded PDF viewer */\n.field.tiny {\n ---size: 1.5rem;\n}\n/* to reduce horizontal space between button of embedded PDF viewer */\n.small-gap {\n gap: 0.5rem;\n}\n/* BeerCSS fix for popover */\n.visible-on-hover:hover > .tooltip {\n visibility: visible;\n opacity: 1;\n}\n\n.visible-on-hover:hover > menu {\n opacity: 1;\n visibility: visible;\n transform: scale(1) translateY(100%);\n}\n\n.tooltip {\n cursor: normal;\n}\n/* if fill is added on a button, it make the tooltip visible. Used for search box in JSON editor */\n.fill > .tooltip {\n visibility: visible;\n opacity: 1;\n transform: translate(-50%, -100%) scale(1);\n}\n/* remove too big border when the focus is on a button */\n:is(a,button,.button,.chip):focus-visible {\n outline-offset: unset;\n}\n/*.tooltip.leftbottom {\n transform: translate(-80%,100%) scale(.9) !important;\n}*/\n.tooltip.leftbottom {\n transform: translate(-90%, 93%) scale(0.9) !important;\n}\n.tooltip .menu.min {\n inset: 0px auto -200px;\n}\nmenu.leftbottom {\n transform: scale(1) translate(-50%, 100%) !important;\n}\n.circle > menu.leftbottom {\n transform: scale(1) translate(-80%, 100%) !important;\n}\n/*menu.topright {\n transform: scale(1) translate(0%, -100%) !important;\n}*/\n\n/*\n fix visibily over header of search popover header for localization \n:is(header, footer, menu > *).fixed {\n inset: -1px;\n}*/\n\n.secondary-border {\n /* make border lighter */\n border-color: var(--outline)!important;\n}\n/* same as \"extend\" but it works on normal button with normal height */\n.ext > i {\n position: absolute;\n left: 0.95rem;\n z-index: 1;\n}\n.ext:is(:hover,.active) {\n width: auto;\n padding: 0 1rem;\n}\n.ext:is(:hover,.active)>i+span {\n display: inherit;\n margin-left: 1.5rem;\n}\n:is(.ext)>span {\n display: none;\n}\n.ext {\n padding: 0;\n}\n\n.welcome {\n display: grid;\n grid-template-rows: 1fr;\n grid-template-columns: auto 1fr;\n grid-template-areas: \"wnav wmain\"\n \"wnav wmain\";\n /*column-gap: 3rem;\n row-gap: 3rem;*/\n}\n\n.welcome .wnav{\n grid-area: wnav;\n overflow-y: auto;\n height: 100%;\n right: auto;\n justify-content: flex-start;\n flex-direction: column;\n}\n.welcome .wmain{\n grid-area: wmain;\n overflow-y: auto;\n padding: 3rem;\n}\n\n/* on black surface, error must be lighter (inspector) */\n.inverse-surface .error-text {\n color: #ffa2a2 !important;\n}\n\n/* add missing \"tiny\" loader */ \nprogress.circle.tiny {\n inline-size: 1rem;\n block-size: 1rem;\n border-width: .2rem;\n}\n\n/* addon */\n\n/* Fake hover for Downlaod template button */\n:is(.button.hover,button.hover):after {\n background-size: 15000%;\n opacity: 1;\n transition: background-size var(--speed2) linear;\n}\n\n/* \n BeerCSS depends on an external font icon, here we replace this depencies by our CSS icons \n SVG icons come from the same source (see icons.css)\n */\n\n.radio > input:checked + span:before {\n --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M480-280q83 0 141.5-58.5T680-480q0-83-58.5-141.5T480-680q-83 0-141.5 58.5T280-480q0 83 58.5 141.5T480-280Zm0 200q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z'/%3e%3c/svg%3e\");\n background-color: currentColor; \n mask-image: var(--cicon); \n -webkit-mask-image: var(--cicon);\n content: \"\"; /* does not need for \"radio_button_unchecked\" anymore */\n}\n\n.radio > span:before {\n --cicon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='%23e8eaed'%3e%3cpath d='M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z'/%3e%3c/svg%3e\");\n background-color: currentColor; \n mask-image: var(--cicon); \n -webkit-mask-image: var(--cicon);\n content: \"\";\n}\n"+this.state.carboneTheme),this.document.adoptedStyleSheets=[e]}setConfig(e){const t={origin:e?.origin,token:e?.token??e?.testToken,testToken:e?.testToken,prodToken:e?.prodToken};uI.setState(t)}openTemplate(e,t){EI.stopWatching(),dI.setState(t),fI.setState({idTemplateOpened:e?.templateId??e,templateExtension:e?.extension??""})}closeTemplate(){}reset(){EI.stopWatching(),fI.reset(),mI.reset(),dI.reset(),pI.reset()}onOpenTemplateFile(){"welcome"===this.state.carboneMode&&this.onModeChange.call(this,"local",(()=>{pI.updatePreview()}))}onModeChange(e,t){"welcome"===e&&this.reset();const i=this;"welcome"===e?this.state.loadingClassPan="shutter hide-backward":this.state.loadingClass="shutter hide-forward",this.render(this.state),setTimeout((function(){i.state.carboneMode=e,"welcome"===e?i.state.loadingClass="shutter reveal-backward":i.state.loadingClassPan="shutter reveal-forward",i.render(i.state),t&&t()}),400)}onKeyDown(e){if(e.metaKey||e.ctrlKey)switch(e.key){case"s":e.preventDefault(),bI.send(bI.type.KEYBOARD_SAVE);break;case"f":e.preventDefault(),bI.send(bI.type.KEYBOARD_SEARCH)}}exitToWelcome(e){e.stopPropagation(),bI.send("carbone:mode","welcome")}backToEdition(e){e.stopPropagation(),bI.send("carbone:mode","local")}copyTemplateID(e){e.stopPropagation(),navigator.clipboard.writeText(fI.state.idTemplateOpened).then((()=>{this.state.templateIdCopied=!0,this.render(this.state),setTimeout((()=>{this.state.templateIdCopied=!1,this.render(this.state)}),3e3)}),(function(e){console.error("Async: Could not copy text: ",e)}))}}),customElements.define("c-home-index",class extends FI{init(){this.useShadowDOM=!1,this.state={view:"home"}}async onSelectTool(e){e.stopPropagation(),bI.send("carbone:c-panel-design:open_file")}async onOpenTemplate(e){e.stopPropagation();const t=e.currentTarget.dataset.id;t&&(fI.open(t,"docx"),bI.send("carbone:c-panel-design:open_file"))}goToHome(){this.state.view="home",this.render(this.state)}goToTemplate(){this.state.view="templates",this.render(this.state)}goToBookmark(){this.state.view="bookmark",this.render(this.state)}}),customElements.define("c-template-online",class extends NI{init(){this.useShadowDOM=!1,this.editorView=null,this.state={templateText:""}}connected(){Pa.theme({".cm-activeLine":{backgroundColor:"var(--json-editor-active-line)"},"&.cm-focused > .cm-scroller .cm-matchingBracket":{backgroundColor:"var(--json-editor-active-bracket)"},"&.cm-focused":{outline:"var(--primary) solid 2px"}});const e=[kr(),Cg(),hr(),$c.of(" "),It.allowMultipleSelections.of(!0),gl(),Vl(),Qd(),Za.of([Fh,...Sd,...xh,...Ng]),Gl(Ll,{fallback:!0}),Pa.updateListener.of(this.onUserChange.bind(this)),Pa.lineWrapping],t=It.create({doc:this.state.templateText,extensions:e});this.editorView=new Pa({state:t,parent:this.firstChild,lineWrapping:!0})}disconnected(){}onUserChange(e){if(!0===e.docChanged){const t=e.transactions[0];t.isUserEvent(t.annotations[0].value)}}}),customElements.define("c-preview-embedded-pdf-viewer",class extends RQ{init(){this.useShadowDOM=!0,this._location=null,this._onDocumentLoaded=this.onDocumentLoaded.bind(this),this._onPageChanging=this.onPageChanging.bind(this),this._onUpdateViewArea=this.onUpdateViewArea.bind(this),this.state={lastRenderUrl:"",errorPageNumber:-1,loadFn:e=>{},pageChangeFn:e=>{}},pI.subscribe(this,["lastRenderUrl","errorPageNumber"])}async changed(e,t){if(e.lastRenderUrl!==t.lastRenderUrl&&(await vQ.close(),""!==e.lastRenderUrl)){let t=null;this._location&&(t=`page=${this._location.pageNumber}&zoom=${this._location.scale},${this._location.left},${this._location.top}`),e.errorPageNumber>-1&&(t="search=C_ERROR"),await vQ.open({url:e.lastRenderUrl,initHashView:t})}}connected(){const e={rootNode:this.document.firstChild,mainContainer:this.document.getElementById("viewerContainer"),viewerContainer:this.document.getElementById("viewer")};vQ.run(e),DQ.eventBus.on("documentloaded",this._onDocumentLoaded),DQ.eventBus.on("pagechanging",this._onPageChanging),DQ.eventBus.on("updateviewarea",this._onUpdateViewArea)}disconnected(){DQ.eventBus.off("documentloaded",this._onDocumentLoaded),DQ.eventBus.off("pagechanging",this._onPageChanging),DQ.eventBus.off("updateviewarea",this._onUpdateViewArea),vQ.close(),vQ.stop()}onUpdateViewArea({location:e}){this._location=e}onDocumentLoaded(e){this.state.loadFn(e.source),this.state.pageChangeFn(e.source.page)}onPageChanging({pageNumber:e}){this.state.pageChangeFn(e)}}),customElements.define("c-data-clipboard-input",class extends LQ{init(){this.useShadowDOM=!1,this.editorView=null,this.textAnimationTimeout=null,this.state={clipboardText:"",clipboardMode:"",clipboardImage:""},mI.subscribe(this,["clipboardText","clipboardMode","clipboardImage"])}connected(){let e=Pa.theme({".cm-activeLine":{backgroundColor:"var(--json-editor-active-line)"},"&.cm-focused > .cm-scroller .cm-matchingBracket":{backgroundColor:"var(--json-editor-active-bracket)"},"&.cm-focused":{outline:"none"},".cm-line":{padding:"0 10px"},".cm-content":{padding:"10px 0"}});const t=[kr(),Cg(),hr(),$c.of(" "),It.allowMultipleSelections.of(!0),gl(),Vl(),Qd(),Gd({override:[function(e){let t=e.matchBefore(/\{[^}]+?/);if(!t||t.from===t.to&&!e.explicit)return null;HQ.data=dI.state.data,HQ.complement=dI.state.complement;let i=null;try{i=TQ.whatsNext(t.text,HQ)}catch(e){}if(!i)return null;i.parts[i.parts.length-1];const n=i.best.map((e=>({label:e.token,type:"keyword",detail:yI.FORMATTERS?.[e.token]?.summary??""})));return{from:e.pos-i.lastToken.length,options:n}}],tooltipClass:()=>"autocomplete"}),Za.of([Fh,...Sd,...xh,...Ng]),Gl(Ll,{fallback:!0}),Pa.updateListener.of(this.onUserEditText.bind(this)),Pa.lineWrapping,e],i=It.create({doc:this.state.clipboardText,extensions:t});this.editorView=new Pa({state:i,parent:this.firstChild.children[0],lineWrapping:!0})}disconnected(){this.editorView.destroy()}changed(e,t){e.clipboardText!==t.clipboardText&&this.animateVisibleText(e.clipboardText)}updateClipboard(){const e=this.editorView.state.doc.toString();mI.updateSilently(e)}onUserEditText(e){if(!0===e.docChanged){const t=e.transactions[0],i=t.annotations[0].value,n=t.annotations?.[1]?.value;(t.isUserEvent(i)||t.isUserEvent(n))&&this.debounce(this.updateClipboard,300)}}animateVisibleText(e){clearTimeout(this.textAnimationTimeout),this.editorView.dispatch({changes:{from:0,to:this.editorView.state.doc.length,insert:""}}),this.animateText(e,0,parseInt(400/e.length,10))}animateText(e,t,i){if(t{this.animateText(e,t,i)}),i)}}}),customElements.define("c-preview-debugger",class extends JQ{init(){this.useShadowDOM=!1,this.state={nbRequestRunning:0,logs:[]},II.subscribe(this,["logs"]),uI.subscribe(this,["nbRequestRunning"])}isLast(e,t){return e===t.length-1}}),customElements.define("c-chat",class extends WQ{init(){this.useShadowDOM=!1,this.state={chatMessages:[]},YQ.subscribe(this,["chatMessages","isChatOpen","isWaitingResponse"])}onKeyUpChat(e){13===e.keyCode&&!1===e.shiftKey&&(YQ.send(e.target.value),e.target.value="")}}),customElements.define("c-template-panel",class extends XQ{init(){this.useShadowDOM=!1,this.state={editMode:"L"},fI.subscribe(this,["editMode"]),EI.subscribe(this,["file"])}connected(){}disconnected(){}changed(e,t){e.editMode!==t.editMode&&(EI.stopWatching(),pI.reset())}onClickPanelChange(e){e.stopPropagation(),e.preventDefault(),fI.switchToEditionMode(e.currentTarget.dataset.mode),wI.switchTo(zQ[e.currentTarget.dataset.mode],!0)}onTemplateUpload(e){EI.onUploadFile(e)}onTemplateDownload(e){e.stopPropagation(),e.preventDefault(),EI.onDownloadFile(fI.getFilename(),fI.getDownloadURL())}onTemplateUploadHoverEnter(){wI.setState({panelTemplateHoverAnimation:"up"})}onTemplateUploadHoverLeave(){wI.setState({panelTemplateHoverAnimation:""})}onTemplateDownloadHoverEnter(){wI.setState({panelTemplateHoverAnimation:"down"})}onTemplateDownloadHoverLeave(){wI.setState({panelTemplateHoverAnimation:""})}onStopAutoUpload(){EI.stopWatching()}getLastModifiedDate(){return new Date(this.state.file.lastModified).toLocaleTimeString()}}),customElements.define("c-template-generator",class extends tE{init(){this.useShadowDOM=!1,this.progressBarInterval=null,this.state={step:1,progressBar:0,outputFileType:"docx",outputFileTypes:["docx"],isGenerationInProgress:!1},fI.subscribe(this,["idTemplateOpened","isUploadingTemplate"])}connected(){}disconnected(){}changed(e,t){e.idTemplateOpened&&e.idTemplateOpened!==t.idTemplateOpened&&(this.state.progressBar=iE,setTimeout(this.switchToEditionModeOnSuccess.bind(this),3e3)),e.isUploadingTemplate!==t.isUploadingTemplate&&(!0===e.isUploadingTemplate?(this.state.isGenerationInProgress=!0,this.progressBarInterval=setInterval(this.updateProgressBar.bind(this),nE)):(e.idTemplateOpened||(this.state.isGenerationInProgress=!1,this.state.progressBar=0),clearInterval(this.progressBarInterval)))}switchToEditionModeOnSuccess(){this.render({isGenerationInProgress:!1}),fI.switchToEditionMode("L"),wI.switchTo("templateIntro",!0,0),pI.updatePreview()}updateProgressBar(){return this.state.progressBar>=iE?clearInterval(this.progressBarInterval):0===this.state.progressBar?this.render({progressBar:iE/2+500}):void this.render({progressBar:this.state.progressBar+500})}onNextButton(e){e.preventDefault();const t=this.state.step+1;this.render({step:t})}onBackButton(e){e.preventDefault();const t=this.state.step-1;this.render({step:t})}onSelectedOutputFiletype(e){this.render({outputFileType:e})}onGenerateTemplate(){this.render({step:3}),fI.generate(dI.state.data,this.state.outputFileType)}}),customElements.define("c-preview-native-pdf-viewer",class extends rE{init(){this.useShadowDOM=!1,this.state={objectType:!hI.isSafari()&&"application/pdf",showBrowserToolbar:1,lastRenderUrl:"",errorPageNumber:-1,defaultPageNumber:1},pI.subscribe(this,["lastRenderUrl","errorPageNumber"])}}),customElements.define("c-preview",class extends cE{init(){this.useShadowDOM=!1,this.state={hideDebugger:!0,objectType:!hI.isSafari()&&"application/pdf",hideDebuggerIfNoError:hI.state.hideDebuggerIfNoError,useEmbeddedPDFViewer:hI.state.useEmbeddedPDFViewer,makeSoundOnError:hI.state.makeSoundOnError,viewerSelected:gE,viewerList:dE,converterSelected:0,converterList:fE,apiSelected:0,apiList:uE,locales:yI.LOCALES,currencies:yI.CURRENCIES,timezones:Intl.supportedValuesOf("timeZone"),isPreviewUpToDate:!0,isDraftUserDataSavedFn:null,isRunning:!1,lastRenderUrl:"",errorPageNumber:-1,nbRequestRunning:0,lang:"",timezone:"",converter:"",currencySource:"",currencySourceLabel:"Euros",currentPageNumber:0},pI.subscribe(this,["lastRenderUrl","isRunning","errorPageNumber"]),dI.subscribe(this,["lang","converter","timezone","currencySource"]),fI.subscribe(this,["templateExtension","idTemplateOpened"]),II.subscribe(this,["logs"]),uI.subscribe(this,["nbRequestRunning","free"]),CI.subscribe(this,["isDraftUserDataSavedFn"])}connected(){bI.on(bI.type.KEYBOARD_SAVE,this.onClickRefreshPreview,this),this._pageCountNode=this.document.querySelector("#pdfPageCount"),this._pageNumberNode=this.document.querySelector("#pdfPageNumber"),this._embeddedPDFViewerApp=null}disconnected(){bI.off(bI.type.KEYBOARD_SAVE,this.onClickRefreshPreview)}changed(e,t){if(!0===this.state.makeSoundOnError&&e.errorPageNumber>0&&e.errorPageNumber!==t.errorPageNumber)try{new Audio(`https://carbone.io/studio/fart${1+lE++%4}.mp3`).play()}catch(e){}e.lastRenderUrl!==t.lastRenderUrl&&(this.state.isPreviewUpToDate=!0),e.isDraftUserDataSavedFn&&e.isDraftUserDataSavedFn!==t.isDraftUserDataSavedFn&&(this.state.isPreviewUpToDate=!1)}onClickRefreshPreview(e){e?.stopPropagation(),null===e&&!0===this.state.isPreviewUpToDate||pI.updatePreview()}hideDebugger(){if(!1===this.state.hideDebuggerIfNoError)return this.state.hideDebugger=!1,!1;if(this.state.nbRequestRunning>0)return this.state.hideDebugger;const e=II.state.logs[II.state.logs.length-1];return this.state.hideDebugger="error"!==e?.type,this.state.hideDebugger}formatCurrency(e){return e[0]+" "+e[1]}onSelectedLocale(e){this.state.lang=e,dI.setState({lang:e}),pI.updatePreview()}onSelectedCurrency(e){this.state.currencySource=e[0],this.state.currencySourceLabel=e[1],dI.setState({currencySource:this.state.currencySource}),pI.updatePreview()}onSelectedTimezone(e){this.state.timezone=e,dI.setState({timezone:this.state.timezone}),pI.updatePreview()}onSelectedApi(e){this.setState({apiSelected:e}),uI.setState({version:uE[e].value}),this.render(this.state),pI.updatePreview()}onSelectedConverter(e){this.state.converterSelected=e,dI.setState({converter:IE[e]}),this.render(this.state),pI.updatePreview()}onChangeHideDebuggerIfNoError(e){e.stopPropagation(),this.state.hideDebuggerIfNoError=e.target.checked,this.render(this.state)}onChangeUseEmbeddedPDFViewer(e){e.stopPropagation(),this.state.useEmbeddedPDFViewer=e.target.checked}onChangeMakeSoundOnError(e){e.stopPropagation(),this.state.makeSoundOnError=e.target.checked}onSelectedViewer(e){this.state.viewerSelected=e,hI.setState({previewFormat:dE[e].convertTo}),dI.setState({convertTo:dE[e].convertTo}),this.render(this.state),pI.updatePreview()}onDownloadFile(e){e.stopPropagation();const t=e.currentTarget.dataset.extension;pI.exportTo(t)}onPDFLoaded(e){this._pageCountNode.textContent=e.pagesCount,this._embeddedPDFViewerApp=e}onPageNumber(e){this._pageNumberNode.value=e,this.state.currentPageNumber=e}onSetPageNumberChange(e){const t=e.target.value;this._embeddedPDFViewerApp.pdfLinkService.goToPage(t)}onSetPageNumberClick(e){e.target?.select()}onZoomIn(){this._embeddedPDFViewerApp.pdfViewer.updateScale({drawingDelay:400,steps:1})}onZoomOut(){this._embeddedPDFViewerApp.pdfViewer.updateScale({drawingDelay:400,steps:-1})}switchUpdateApiKey(e){""!==uI.state.prodToken&&(e.preventDefault(),e.stopPropagation(),uI.setState({free:!uI.state.free,token:!0==!uI.state.free?uI.state.testToken:uI.state.prodToken}),pI.updatePreview())}}),customElements.define("c-preview-html-viewer",class extends mE{init(){this.useShadowDOM=!1,this.state={lastRenderUrl:""},pI.subscribe(this,["lastRenderUrl","errorPageNumber"])}}),customElements.define("c-data-editor",class extends EE{init(){this.useShadowDOM=!1,this.state={expertMode:0===Object.keys(dI.state.data).length,isDataUpdatedByUser:!1,searchedText:"",target:"data",jsonHash:0},this.getAndCleanJsonFn=null,this.getEditorScrollFn=null,dI.subscribe(this,["data","complement","enum","translations"]),pI.subscribe(this,["debug"])}connected(){bI.on(bI.type.KEYBOARD_SEARCH,this.onOpenSearchPanel,this),yE[!0]={},yE[!1]={},this.setState({jsonHash:++this.state.jsonHash})}disconnected(){bI.off(bI.type.KEYBOARD_SEARCH,this.onOpenSearchPanel)}getDataStringified(e="data"){return JSON.stringify(this.state[e],null,2)}getDataReference(e="data"){return this.state[e]}onCopiedTag(e,t){mI.insertSmartClipboard(e,t)}onExpertMode(e){e.stopPropagation(),yE[this.state.expertMode][this.state.target]=this.getEditorScrollFn();this.readDataFromEditor()||(this.state.expertMode=!0,this.render(this.state))}onSimpleMode(e){e.stopPropagation(),yE[this.state.expertMode][this.state.target]=this.getEditorScrollFn();this.readDataFromEditor()||(this.state.expertMode=!1,this.render(this.state))}onDataUpdatedByUser(e){this.getAndCleanJsonFn=e,CI.state.isDraftUserDataSavedFn||CI.setState({isDraftUserDataSavedFn:this.readDataFromEditor.bind(this)})}readDataFromEditor(){if(this.getAndCleanJsonFn){const{err:e,jsonParsed:t}=this.getAndCleanJsonFn();if(e)return II.error(`Please, fix the JSON "${this.state.target}"`),e;this.getAndCleanJsonFn=null,II.info("New JSON saved"),dI.setState({[this.state.target]:t}),CI.setState({isDraftUserDataSavedFn:null}),this.dispatchEvent(new CustomEvent("options:updated",{bubbles:!0,composed:!0,detail:{[this.state.target]:t}}))}return null}onGenerateJson(e){e?.stopPropagation(),this.state?.debug?.sample?.data&&(dI.setState({data:this.state.debug.sample.data}),this.render({jsonHash:++this.state.jsonHash}),pI.updatePreview())}onClickDataTargetChange(e){e?.stopPropagation(),yE[this.state.expertMode][this.state.target]=this.getEditorScrollFn();this.readDataFromEditor()||this.render({target:e.currentTarget.dataset.mode})}onEditorLoaded(e,t,i,n){this.getEditorScrollFn=e,this.searchTextFn=t,this.findNextFn=i,this.findPreviousFn=n,this.searchTextFn&&this.searchTextFn(this.state.searchedText)}onOpenSearchPanel(){const e=this.document.querySelector("#buttonTextSearch"),t=this.document.querySelector("#inputTextSearch");e.classList.add("fill"),setTimeout((()=>{t.focus(),t.select()}),100)}onChangeSearchInput(e){e.stopPropagation(),this.state.searchedText=e.target.value,this.searchTextFn&&this.searchTextFn(this.state.searchedText)}onKeyDownSearchInput(e){e.stopPropagation(),"Enter"===e.key&&this.findNextFn()}onBlurSearchInput(e){e.stopPropagation();this.document.querySelector("#buttonTextSearch").classList.remove("fill")}onClickResetSearchInput(e){if(e.stopPropagation(),this.searchTextFn){this.searchTextFn("");this.document.querySelector("#inputTextSearch").value=""}}}),customElements.define("c-data-clipboard",class extends SE{init(){this.useShadowDOM=!1,this.state={isCopied:!0,clipboardMode:"T",clipboardText:""},YQ.subscribe(this,["isChatOpen"]),mI.subscribe(this,["clipboardMode"])}onOpenChat(){YQ.toggle()}onModeSwitch(e){e.stopPropagation(),e.preventDefault(),mI.switchTo(e.currentTarget.dataset.mode)}}),customElements.define("c-template-local",class extends FE{init(){this.useShadowDOM=!1,this.resizeObserver=null,this.state={file:null,watchInterval:null,idTemplateOpened:"",isUploadingTemplate:!1,templateExtension:"",panelTemplateHoverAnimation:"",animationMode:"",isDropZoneActive:!1},EI.subscribe(this,["handle","file","watchInterval","hasBrowserFilePicker"]),fI.subscribe(this,["idTemplateOpened","isUploadingTemplate","templateExtension"]),wI.subscribe(this,["panelTemplateHoverAnimation"])}connected(){}disconnected(){}changed(e,t){e.file&&e.file!==t.file&&fI.add(e.file).catch((e=>{EI.stopWatching()})),e.idTemplateOpened&&e.idTemplateOpened!==t.idTemplateOpened&&(this.dispatchEvent(new CustomEvent("template:updated",{bubbles:!0,composed:!0,detail:{templateId:fI.state.idTemplateOpened,extension:fI.state.templateExtension}})),pI.updatePreview()),e.watchInterval!==t.watchInterval&&wI.switchTo(e.watchInterval?"templateLocalEdit":"templateIntro",!0,300),e.panelTemplateHoverAnimation!==t.panelTemplateHoverAnimation&&(this.state.animationMode=e.panelTemplateHoverAnimation)}onTemplateUploadHoverEnter(){wI.setState({panelTemplateHoverAnimation:"up"})}onTemplateUploadHoverLeave(){wI.setState({panelTemplateHoverAnimation:""})}onTemplateDownloadHoverEnter(){wI.setState({panelTemplateHoverAnimation:"down"})}onTemplateDownloadHoverLeave(){wI.setState({panelTemplateHoverAnimation:""})}onTemplateUpload(e){EI.onUploadFile(e)}onTemplateDownload(e){e.stopPropagation(),e.preventDefault(),EI.onDownloadFile(fI.getFilename(),fI.getDownloadURL())}onDragOverOverlay(e){return e.preventDefault(),!1}onDragEnterTemplate(e){return e.currentTarget.classList.add("dragover"),this.onTemplateUploadHoverEnter(),!1}onDragLeaveOverlay(e){return e.currentTarget.parentNode.classList.remove("dragover"),this.onTemplateUploadHoverLeave(),!1}onDropOverlay(e){EI.onDropFile(e),e.currentTarget.parentNode.classList.remove("dragover"),this.onTemplateUploadHoverLeave()}})}();