@mlightcad/cad-simple-viewer 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -204,7 +204,7 @@
204
204
  background: rgba(255, 255, 255, 0.2);
205
205
  border-radius: 6px;
206
206
  }
207
- `,document.head.appendChild(e)}createUI(){this.cliContainer=document.createElement("div"),this.cliContainer.className="ml-cli-container",this.wrapper=document.createElement("div"),this.wrapper.className="ml-cli-wrapper",this.cliContainer.appendChild(this.wrapper),this.bar=document.createElement("div"),this.bar.className="ml-cli-bar",this.wrapper.appendChild(this.bar),this.leftGroup=document.createElement("div"),this.leftGroup.className="ml-cli-left",this.bar.appendChild(this.leftGroup),this.closeBtn=document.createElement("div"),this.closeBtn.className="ml-cli-close-btn",this.closeBtn.title=this.localize("main.commandLine.close","Close"),this.closeBtn.innerHTML="&#10005;",this.leftGroup.appendChild(this.closeBtn),this.downBtn=document.createElement("button"),this.downBtn.className="ml-cli-down",this.downBtn.title=this.localize("main.commandLine.showHistory"),this.downBtn.innerHTML="&#9662;",this.leftGroup.appendChild(this.downBtn),this.input=document.createElement("div"),this.input.className="ml-cli-input",this.input.contentEditable="true",this.input.setAttribute("spellcheck","false"),this.input.setAttribute("data-placeholder",this.localize("main.commandLine.placeholder")),this.bar.appendChild(this.input);const e=document.createElement("div");e.className="ml-cli-right",this.bar.appendChild(e),this.upBtn=document.createElement("button"),this.upBtn.className="ml-cli-up",this.upBtn.title=this.localize("main.commandLine.showMessages"),this.upBtn.innerHTML="&#9662;",e.appendChild(this.upBtn),this.cmdPopup=document.createElement("div"),this.cmdPopup.className="ml-cli-cmd-popup hidden",this.wrapper.appendChild(this.cmdPopup),this.msgPanel=document.createElement("div"),this.msgPanel.className="ml-cli-msg-panel hidden",this.wrapper.appendChild(this.msgPanel),this.container.appendChild(this.cliContainer)}bindEvents(){this.closeBtn.addEventListener("click",e=>{e.stopPropagation(),this.visible=!1,je.instance.isShowCommandLine=!1}),this.downBtn.addEventListener("click",e=>{e.stopPropagation(),this.isCmdPopupOpen=!this.isCmdPopupOpen,this.updatePopups({showCmd:this.isCmdPopupOpen,showMsg:!1}),this.isCmdPopupOpen&&this.showCommandHistoryPopup()}),this.upBtn.addEventListener("click",e=>{e.stopPropagation(),this.isMsgPanelOpen=!this.isMsgPanelOpen,this.updatePopups({showCmd:!1,showMsg:this.isMsgPanelOpen}),this.isMsgPanelOpen&&this.showMessagePanel()}),document.addEventListener("click",e=>{this.cliContainer.contains(e.target)||this.updatePopups({showCmd:!1,showMsg:!1})}),this.input.addEventListener("keydown",e=>this.handleKeyDown(e)),this.input.addEventListener("keydown",e=>this.handleArrowKeys(e)),this.input.addEventListener("input",()=>this.handleInputChange()),this.input.addEventListener("focus",()=>this.updatePopups({showCmd:!1,showMsg:!1})),this.cmdPopup.addEventListener("click",e=>{const t=e.target.closest(".item");t&&(this.setInputText(t.dataset.value||""),this.input.focus(),this.updatePopups({showCmd:!1,showMsg:!1}))})}handleKeyDown(e){if(e.key==="Enter"){e.preventDefault();const t=this.getInputText();this.executeCommand(t),this.updatePopups({showCmd:!1,showMsg:!1})}else e.key==="Escape"&&(e.preventDefault(),this.setInputText(""),this.printMessage(this.localize("main.commandLine.canceled")),this.updatePopups({showCmd:!1,showMsg:!1}))}handleArrowKeys(e){e.key==="ArrowUp"&&(e.preventDefault(),this.isCmdPopupOpen?this.navigateAutoComplete(-1):this.navigateHistory(-1)),e.key==="ArrowDown"&&(e.preventDefault(),this.isCmdPopupOpen?this.navigateAutoComplete(1):this.navigateHistory(1))}handleInputChange(){const e=this.getInputText();if(!e){this.updatePopups({showCmd:!1});return}const t=K.instance.searchCommandsByPrefix(e);t.length?(this.autoCompleteIndex=-1,this.cmdPopup.innerHTML="",t.forEach((n,i)=>{const s=document.createElement("div");s.className="item",s.dataset.value=n.command.globalName;const a=ie.cmdDescription(n.commandGroup,n.command.globalName);s.innerHTML=`<strong>${n.command.globalName} - ${a}</strong>`,i===this.autoCompleteIndex&&s.classList.add("selected"),this.cmdPopup.appendChild(s)}),this.updatePopups({showCmd:!0})):this.updatePopups({showCmd:!1})}navigateAutoComplete(e){const t=Array.from(this.cmdPopup.querySelectorAll(".item"));if(!t.length)return;this.autoCompleteIndex+=e,this.autoCompleteIndex<0&&(this.autoCompleteIndex=0),this.autoCompleteIndex>=t.length&&(this.autoCompleteIndex=t.length-1),t.forEach((i,s)=>{i.classList.toggle("selected",s===this.autoCompleteIndex)});const n=t[this.autoCompleteIndex];n&&this.setInputText(n.dataset.value??"")}navigateHistory(e){this.history.length&&(this.historyIndex===-1&&(this.historyIndex=this.history.length),this.historyIndex+=e,this.historyIndex<0&&(this.historyIndex=0),this.historyIndex>this.history.length&&(this.historyIndex=this.history.length),this.historyIndex>=0&&this.historyIndex<this.history.length?this.setInputText(this.history[this.historyIndex]):this.setInputText(""))}getInputText(){const e=this.input.cloneNode(!0);return e.querySelectorAll(".ml-cli-option").forEach(t=>t.remove()),e.innerText.replace(/\u00A0/g," ").trim()}setInputText(e=""){this.input.innerHTML="",e&&this.input.appendChild(document.createTextNode(e+" ")),this.setCursorToEnd()}renderCommandLine(e,t=[]){this.input.innerHTML="",e&&this.input.appendChild(document.createTextNode(e+" ")),t.forEach(n=>{const i=document.createElement("span");i.className="ml-cli-option",i.textContent=n,i.addEventListener("click",s=>{s.stopPropagation(),this.insertOption(n)}),this.input.appendChild(i),this.input.appendChild(document.createTextNode(" "))}),this.setCursorToEnd(),this.input.focus()}insertOption(e){this.input.appendChild(document.createTextNode(e+" ")),this.setCursorToEnd(),this.input.focus()}setCursorToEnd(){const e=document.createRange();e.selectNodeContents(this.input),e.collapse(!1);const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e),this.input.scrollLeft=this.input.scrollWidth)}resolveCommand(e){const n=e.trim().split(/\s+/)[0].toUpperCase();return K.instance.lookupLocalCmd(n)}updatePopups({showCmd:e=!1,showMsg:t=!1}={}){this.isCmdPopupOpen=e,this.isMsgPanelOpen=t,this.cmdPopup.classList.toggle("hidden",!e),this.msgPanel.classList.toggle("hidden",!t),e&&this.positionCmdPopup(),t&&this.positionMsgPanel()}showCommandHistoryPopup(){if(this.cmdPopup.innerHTML="",this.history.length)for(let e=this.history.length-1;e>=0;e--){const t=document.createElement("div");t.className="item",t.dataset.value=this.history[e],t.textContent=this.history[e],this.cmdPopup.appendChild(t)}else{const e=document.createElement("div");e.className="item",e.textContent=this.localize("main.commandLine.noHistory"),this.cmdPopup.appendChild(e)}this.positionCmdPopup()}positionCmdPopup(){this.cmdPopup.style.left="0px",this.cmdPopup.style.width=this.bar.offsetWidth+"px"}showMessagePanel(){if(!this.msgPanel.children.length){const e=document.createElement("div");e.className="ml-cli-history-line",e.textContent=this.localize("main.commandLine.noHistory"),e.dataset.msgKey="main.commandLine.noHistory",this.msgPanel.appendChild(e)}this.msgPanel.scrollTop=this.msgPanel.scrollHeight,this.positionMsgPanel()}positionMsgPanel(){this.msgPanel.style.width=this.bar.offsetWidth+"px"}clearNoHistoryPlaceholder(){Array.from(this.msgPanel.children).forEach(e=>{const t=e;t.dataset.msgKey==="main.commandLine.noHistory"&&this.msgPanel.removeChild(t)})}printMessage(e,t){this.clearNoHistoryPlaceholder();const n=document.createElement("div");n.className="ml-cli-history-line",n.textContent=e,t&&(n.dataset.msgKey=t),this.msgPanel.appendChild(n),this.showMessagePanel()}printError(e,t){this.clearNoHistoryPlaceholder();const n=document.createElement("div");n.className="ml-cli-history-line ml-cli-msg-error",n.textContent=e,t&&(n.dataset.msgKey=t),this.msgPanel.appendChild(n),this.showMessagePanel()}printHistoryLine(e){this.clearNoHistoryPlaceholder();const t=document.createElement("div");t.className="ml-cli-history-line",t.textContent="> "+e,t.dataset.msgKey="main.commandLine.executed",this.msgPanel.appendChild(t),this.showMessagePanel()}resizeHandler(){let e=Math.max(this.minWidth,window.innerWidth*this.widthRatio);e=Math.min(e,window.innerWidth-20),this.bar.style.width=e+"px",this.positionMsgPanel(),this.positionCmdPopup()}}class yc{constructor(e){this.options=e}parse(e){const t=Number(e);return isNaN(t)||!this.options.allowNegative&&t<0||!this.options.allowZero&&t===0?null:t}}class lr{constructor(e){this.options=e}parse(e){const t=Number(e);return isNaN(t)||!this.options.allowNegative&&t<0||!this.options.allowZero&&t===0?null:t}}class Ri extends lr{}class bc extends lr{}class vc extends lr{constructor(e){super(e)}parse(e){const t=super.parse(e);return t==null?t:!Number.isInteger(t)||this.options.lowerLimit!==void 0&&t<this.options.lowerLimit||this.options.upperLimit!==void 0&&t>this.options.upperLimit?null:t}}class xc{constructor(e){this.options=e}parse(e,t){const n=Number(e),i=Number(t);return isNaN(n)||isNaN(i)?null:{x:n,y:i,z:0}}}class wc{constructor(e){this.options=e}parse(e){return!this.options.allowSpaces&&e.includes(" ")||!this.options.allowEmpty&&e.length===0||this.options.maxLength&&e.length>this.options.maxLength?null:e}}class Ui{constructor(e,t,n,i=!0,s=!1,a=!0){this._displayName=e,this._globalName=t??e,this._localName=n??this._globalName,this._enabled=i,this._isReadOnly=s,this._visible=a}get displayName(){return this._displayName}set displayName(e){this._isReadOnly||(this._displayName=e)}get enabled(){return this._enabled}set enabled(e){this._isReadOnly||(this._enabled=e)}get globalName(){return this._globalName}set globalName(e){this._isReadOnly||(this._globalName=e)}get isReadOnly(){return this._isReadOnly}get localName(){return this._localName}set localName(e){this._isReadOnly||(this._localName=e)}get visible(){return this._visible}set visible(e){this._isReadOnly||(this._visible=e)}}class Fi{constructor(){this._keywords=[]}add(e,t,n,i=!0,s=!0){let a,o,c;t===void 0?(a=e,o=e,c=e):n===void 0?(a=t,o=e,c=t):(a=e,o=t,c=n);const h=new Ui(a,o,c,i,!1,s);return this._keywords.push(h),h}clear(){this._keywords=[],this._defaultKeyword=void 0}toArray(){return this._keywords.slice()}get default(){return this._defaultKeyword}set default(e){if(e&&!this._keywords.includes(e))throw new Error("Default keyword must be one of the collection's keywords");this._defaultKeyword=e}getDisplayString(e=!1){return this._keywords.filter(n=>n.visible&&n.enabled).map(n=>(!e&&this._defaultKeyword===n,n.displayName)).join("/")}[Symbol.iterator](){let e=0;const t=this._keywords;return{next(){return e<t.length?{done:!1,value:t[e++]}:{done:!0,value:void 0}}}}findByDisplayName(e){return this._keywords.find(t=>t.displayName.toLowerCase()===e.toLowerCase())}findByGlobalName(e){return this._keywords.find(t=>t.globalName.toLowerCase()===e.toLowerCase())}get count(){return this._keywords.length}}class Gt{constructor(e){this._message=e,this._appendKeywordsToMessage=!0,this._isReadOnly=!1,this._keywords=new Fi}get jig(){return this._jig}set jig(e){this._isReadOnly||(this._jig=e)}get message(){return this._message}set message(e){this._isReadOnly||(this._message=e)}get appendKeywordsToMessage(){return this._appendKeywordsToMessage}set appendKeywordsToMessage(e){this._isReadOnly||(this._appendKeywordsToMessage=e)}get isReadOnly(){return this._isReadOnly}get keywords(){return this._keywords}setMessageAndKeywords(e,t){if(this._isReadOnly)return this;const n=e.match(/^(.*?)\s*(?:\[(.*)\])?$/);if(n){const[,i,s]=n;if(this._message=i.trim(),s!==void 0){const a=s.split("/").map(o=>o.trim()).filter(o=>o.length>0);this._keywords.clear();for(const o of a){let h=t.split(/\s+/).find(l=>l.toLowerCase()===o.toLowerCase());h||(h=o),this._keywords.add(o,h)}}}return this}}class Sc extends Gt{constructor(e){super(e),this._useBasePoint=!1,this._useDashedLine=!1,this._useAngleBase=!1,this._defaultValue=0,this._useDefaultValue=!1,this._allowZero=!0,this._allowNegative=!1}get basePoint(){return this._basePoint}set basePoint(e){this.isReadOnly||(e==null?this._basePoint=e:this._basePoint=this._basePoint?this._basePoint.copy(e):new I.AcGePoint3d(e))}get useBasePoint(){return this._useBasePoint}set useBasePoint(e){this.isReadOnly||(this._useBasePoint=e)}get useDashedLine(){return this._useDashedLine}set useDashedLine(e){this.isReadOnly||(this._useDashedLine=e)}get useAngleBase(){return this._useAngleBase}set useAngleBase(e){this.isReadOnly||(this._useAngleBase=e)}get defaultValue(){return this._defaultValue}set defaultValue(e){this.isReadOnly||(this._defaultValue=e)}get useDefaultValue(){return this._useDefaultValue}set useDefaultValue(e){this.isReadOnly||(this._useDefaultValue=e)}get allowZero(){return this._allowZero}set allowZero(e){this.isReadOnly||(this._allowZero=e)}get allowNegative(){return this._allowNegative}set allowNegative(e){this.isReadOnly||(this._allowNegative=e)}}class xn extends Gt{constructor(e){super(e),this._defaultValue=0,this._useDefaultValue=!1,this._allowNone=!1,this._allowArbitraryInput=!1,this._allowNegative=!1,this._allowZero=!0}get defaultValue(){return this._defaultValue}set defaultValue(e){this.isReadOnly||(this._defaultValue=e)}get useDefaultValue(){return this._useDefaultValue}set useDefaultValue(e){this.isReadOnly||(this._useDefaultValue=e)}get allowNone(){return this._allowNone}set allowNone(e){this.isReadOnly||(this._allowNone=e)}get allowArbitraryInput(){return this._allowArbitraryInput}set allowArbitraryInput(e){this.isReadOnly||(this._allowArbitraryInput=e)}get allowNegative(){return this._allowNegative}set allowNegative(e){this.isReadOnly||(this._allowNegative=e)}get allowZero(){return this._allowZero}set allowZero(e){this.isReadOnly||(this._allowZero=e)}}class Ni extends xn{constructor(e){super(e),this._useBasePoint=!1,this._useDashedLine=!1,this._only2d=!1,this.allowNegative=!1}get basePoint(){return this._basePoint}set basePoint(e){this.isReadOnly||(e==null?this._basePoint=e:this._basePoint=this._basePoint?this._basePoint.copy(e):new I.AcGePoint3d(e))}get useBasePoint(){return this._useBasePoint}set useBasePoint(e){this.isReadOnly||(this._useBasePoint=e)}get useDashedLine(){return this._useDashedLine}set useDashedLine(e){this.isReadOnly||(this._useDashedLine=e)}get only2d(){return this._only2d}set only2d(e){this.isReadOnly||(this._only2d=e)}}class _c extends xn{}class Cc extends xn{constructor(e,t,n){super(e),typeof t=="number"&&(this._lowerLimit=Math.floor(t)),typeof n=="number"&&(this._upperLimit=Math.ceil(n))}get lowerLimit(){return this._lowerLimit}set lowerLimit(e){this.isReadOnly||(this._lowerLimit=typeof e=="number"?Math.floor(e):void 0)}get upperLimit(){return this._upperLimit}set upperLimit(e){this.isReadOnly||(this._upperLimit=typeof e=="number"?Math.floor(e):void 0)}}class qe extends Gt{constructor(e){super(e),this._useBasePoint=!1,this._useDashedLine=!1,this._allowNone=!1}get basePoint(){return this._basePoint}set basePoint(e){this.isReadOnly||(e==null?this._basePoint=e:this._basePoint=this._basePoint?this._basePoint.copy(e):new I.AcGePoint3d(e))}get useBasePoint(){return this._useBasePoint}set useBasePoint(e){this.isReadOnly||(this._useBasePoint=e)}get useDashedLine(){return this._useDashedLine}set useDashedLine(e){this.isReadOnly||(this._useDashedLine=e)}get allowNone(){return this._allowNone}set allowNone(e){this.isReadOnly||(this._allowNone=e)}}class zi extends Gt{constructor(e){super(e),this._allowSpaces=!0,this._allowEmpty=!1,this._defaultValue="",this._useDefaultValue=!1}get allowSpaces(){return this._allowSpaces}set allowSpaces(e){this.isReadOnly||(this._allowSpaces=e)}get allowEmpty(){return this._allowEmpty}set allowEmpty(e){this.isReadOnly||(this._allowEmpty=e)}get maxLength(){return this._maxLength}set maxLength(e){this.isReadOnly||(this._maxLength=e)}get defaultValue(){return this._defaultValue}set defaultValue(e){this.isReadOnly||(this._defaultValue=e)}get useDefaultValue(){return this._useDefaultValue}set useDefaultValue(e){this.isReadOnly||(this._useDefaultValue=e)}}class wn{constructor(e="rect",t=8,n="green"){this._type=e,this._size=t,this._color=n,wn.injectCSS(),this._el=document.createElement("div"),this._el.classList.add("ml-marker"),this._el.style.color=n,this.applyShape(),document.body.appendChild(this._el)}get color(){return this._color}set color(e){this._color=e,this._el.style.color=e}get type(){return this._type}set type(e){this._type=e,this.applyShape()}static injectCSS(){if(document.getElementById("ml-marker-style"))return;const e=document.createElement("style");e.id="ml-marker-style",e.textContent=`
207
+ `,document.head.appendChild(e)}createUI(){this.cliContainer=document.createElement("div"),this.cliContainer.className="ml-cli-container",this.wrapper=document.createElement("div"),this.wrapper.className="ml-cli-wrapper",this.cliContainer.appendChild(this.wrapper),this.bar=document.createElement("div"),this.bar.className="ml-cli-bar",this.wrapper.appendChild(this.bar),this.leftGroup=document.createElement("div"),this.leftGroup.className="ml-cli-left",this.bar.appendChild(this.leftGroup),this.closeBtn=document.createElement("div"),this.closeBtn.className="ml-cli-close-btn",this.closeBtn.title=this.localize("main.commandLine.close","Close"),this.closeBtn.innerHTML="&#10005;",this.leftGroup.appendChild(this.closeBtn),this.downBtn=document.createElement("button"),this.downBtn.className="ml-cli-down",this.downBtn.title=this.localize("main.commandLine.showHistory"),this.downBtn.innerHTML="&#9662;",this.leftGroup.appendChild(this.downBtn),this.input=document.createElement("div"),this.input.className="ml-cli-input",this.input.contentEditable="true",this.input.setAttribute("spellcheck","false"),this.input.setAttribute("data-placeholder",this.localize("main.commandLine.placeholder")),this.bar.appendChild(this.input);const e=document.createElement("div");e.className="ml-cli-right",this.bar.appendChild(e),this.upBtn=document.createElement("button"),this.upBtn.className="ml-cli-up",this.upBtn.title=this.localize("main.commandLine.showMessages"),this.upBtn.innerHTML="&#9662;",e.appendChild(this.upBtn),this.cmdPopup=document.createElement("div"),this.cmdPopup.className="ml-cli-cmd-popup hidden",this.wrapper.appendChild(this.cmdPopup),this.msgPanel=document.createElement("div"),this.msgPanel.className="ml-cli-msg-panel hidden",this.wrapper.appendChild(this.msgPanel),this.container.appendChild(this.cliContainer)}bindEvents(){this.closeBtn.addEventListener("click",e=>{e.stopPropagation(),this.visible=!1,je.instance.isShowCommandLine=!1}),this.downBtn.addEventListener("click",e=>{e.stopPropagation(),this.isCmdPopupOpen=!this.isCmdPopupOpen,this.updatePopups({showCmd:this.isCmdPopupOpen,showMsg:!1}),this.isCmdPopupOpen&&this.showCommandHistoryPopup()}),this.upBtn.addEventListener("click",e=>{e.stopPropagation(),this.isMsgPanelOpen=!this.isMsgPanelOpen,this.updatePopups({showCmd:!1,showMsg:this.isMsgPanelOpen}),this.isMsgPanelOpen&&this.showMessagePanel()}),document.addEventListener("click",e=>{this.cliContainer.contains(e.target)||this.updatePopups({showCmd:!1,showMsg:!1})}),this.input.addEventListener("keydown",e=>this.handleKeyDown(e)),this.input.addEventListener("keydown",e=>this.handleArrowKeys(e)),this.input.addEventListener("input",()=>this.handleInputChange()),this.input.addEventListener("focus",()=>this.updatePopups({showCmd:!1,showMsg:!1})),this.cmdPopup.addEventListener("click",e=>{const t=e.target.closest(".item");t&&(this.setInputText(t.dataset.value||""),this.input.focus(),this.updatePopups({showCmd:!1,showMsg:!1}))})}handleKeyDown(e){if(e.key==="Enter"){e.preventDefault();const t=this.getInputText();this.executeCommand(t),this.updatePopups({showCmd:!1,showMsg:!1})}else e.key==="Escape"&&(e.preventDefault(),this.setInputText(""),this.printMessage(this.localize("main.commandLine.canceled")),this.updatePopups({showCmd:!1,showMsg:!1}))}handleArrowKeys(e){e.key==="ArrowUp"&&(e.preventDefault(),this.isCmdPopupOpen?this.navigateAutoComplete(-1):this.navigateHistory(-1)),e.key==="ArrowDown"&&(e.preventDefault(),this.isCmdPopupOpen?this.navigateAutoComplete(1):this.navigateHistory(1))}handleInputChange(){const e=this.getInputText();if(!e){this.updatePopups({showCmd:!1});return}const t=K.instance.searchCommandsByPrefix(e);t.length?(this.autoCompleteIndex=-1,this.cmdPopup.innerHTML="",t.forEach((n,i)=>{const s=document.createElement("div");s.className="item",s.dataset.value=n.command.globalName;const a=ie.cmdDescription(n.commandGroup,n.command.globalName);s.innerHTML=`<strong>${n.command.globalName} - ${a}</strong>`,i===this.autoCompleteIndex&&s.classList.add("selected"),this.cmdPopup.appendChild(s)}),this.updatePopups({showCmd:!0})):this.updatePopups({showCmd:!1})}navigateAutoComplete(e){const t=Array.from(this.cmdPopup.querySelectorAll(".item"));if(!t.length)return;this.autoCompleteIndex+=e,this.autoCompleteIndex<0&&(this.autoCompleteIndex=0),this.autoCompleteIndex>=t.length&&(this.autoCompleteIndex=t.length-1),t.forEach((i,s)=>{i.classList.toggle("selected",s===this.autoCompleteIndex)});const n=t[this.autoCompleteIndex];n&&this.setInputText(n.dataset.value??"")}navigateHistory(e){this.history.length&&(this.historyIndex===-1&&(this.historyIndex=this.history.length),this.historyIndex+=e,this.historyIndex<0&&(this.historyIndex=0),this.historyIndex>this.history.length&&(this.historyIndex=this.history.length),this.historyIndex>=0&&this.historyIndex<this.history.length?this.setInputText(this.history[this.historyIndex]):this.setInputText(""))}getInputText(){const e=this.input.cloneNode(!0);return e.querySelectorAll(".ml-cli-option").forEach(t=>t.remove()),e.innerText.replace(/\u00A0/g," ").trim()}setInputText(e=""){this.input.innerHTML="",e&&this.input.appendChild(document.createTextNode(e+" ")),this.setCursorToEnd()}renderCommandLine(e,t=[]){this.input.innerHTML="",e&&this.input.appendChild(document.createTextNode(e+" ")),t.forEach(n=>{const i=document.createElement("span");i.className="ml-cli-option",i.textContent=n,i.addEventListener("click",s=>{s.stopPropagation(),this.insertOption(n)}),this.input.appendChild(i),this.input.appendChild(document.createTextNode(" "))}),this.setCursorToEnd(),this.input.focus()}insertOption(e){this.input.appendChild(document.createTextNode(e+" ")),this.setCursorToEnd(),this.input.focus()}setCursorToEnd(){const e=document.createRange();e.selectNodeContents(this.input),e.collapse(!1);const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e),this.input.scrollLeft=this.input.scrollWidth)}resolveCommand(e){const n=e.trim().split(/\s+/)[0].toUpperCase();return K.instance.lookupLocalCmd(n)}updatePopups({showCmd:e=!1,showMsg:t=!1}={}){this.isCmdPopupOpen=e,this.isMsgPanelOpen=t,this.cmdPopup.classList.toggle("hidden",!e),this.msgPanel.classList.toggle("hidden",!t),e&&this.positionCmdPopup(),t&&this.positionMsgPanel()}showCommandHistoryPopup(){if(this.cmdPopup.innerHTML="",this.history.length)for(let e=this.history.length-1;e>=0;e--){const t=document.createElement("div");t.className="item",t.dataset.value=this.history[e],t.textContent=this.history[e],this.cmdPopup.appendChild(t)}else{const e=document.createElement("div");e.className="item",e.textContent=this.localize("main.commandLine.noHistory"),this.cmdPopup.appendChild(e)}this.positionCmdPopup()}positionCmdPopup(){this.cmdPopup.style.left="0px",this.cmdPopup.style.width=this.bar.offsetWidth+"px"}showMessagePanel(){if(!this.msgPanel.children.length){const e=document.createElement("div");e.className="ml-cli-history-line",e.textContent=this.localize("main.commandLine.noHistory"),e.dataset.msgKey="main.commandLine.noHistory",this.msgPanel.appendChild(e)}this.msgPanel.scrollTop=this.msgPanel.scrollHeight,this.positionMsgPanel()}positionMsgPanel(){this.msgPanel.style.width=this.bar.offsetWidth+"px"}clearNoHistoryPlaceholder(){Array.from(this.msgPanel.children).forEach(e=>{const t=e;t.dataset.msgKey==="main.commandLine.noHistory"&&this.msgPanel.removeChild(t)})}printMessage(e,t){this.clearNoHistoryPlaceholder();const n=document.createElement("div");n.className="ml-cli-history-line",n.textContent=e,t&&(n.dataset.msgKey=t),this.msgPanel.appendChild(n),this.showMessagePanel()}printError(e,t){this.clearNoHistoryPlaceholder();const n=document.createElement("div");n.className="ml-cli-history-line ml-cli-msg-error",n.textContent=e,t&&(n.dataset.msgKey=t),this.msgPanel.appendChild(n),this.showMessagePanel()}printHistoryLine(e){this.clearNoHistoryPlaceholder();const t=document.createElement("div");t.className="ml-cli-history-line",t.textContent="> "+e,t.dataset.msgKey="main.commandLine.executed",this.msgPanel.appendChild(t),this.showMessagePanel()}resizeHandler(){let e=Math.max(this.minWidth,window.innerWidth*this.widthRatio);e=Math.min(e,window.innerWidth-20),this.bar.style.width=e+"px",this.positionMsgPanel(),this.positionCmdPopup()}}class yc{constructor(e){this.options=e}parse(e){const t=Number(e);return isNaN(t)||!this.options.allowNegative&&t<0||!this.options.allowZero&&t===0?null:t}}class lr{constructor(e){this.options=e}parse(e){const t=Number(e);return isNaN(t)||!this.options.allowNegative&&t<0||!this.options.allowZero&&t===0?null:t}}class Ri extends lr{}class bc extends lr{}class vc extends lr{constructor(e){super(e)}parse(e){const t=super.parse(e);return t==null?t:!Number.isInteger(t)||this.options.lowerLimit!==void 0&&t<this.options.lowerLimit||this.options.upperLimit!==void 0&&t>this.options.upperLimit?null:t}}class xc{constructor(e){this.options=e}parse(e,t){const n=Number(e),i=Number(t);return isNaN(n)||isNaN(i)?null:{x:n,y:i,z:0}}}class wc{constructor(e){this.options=e}parse(e){return!this.options.allowSpaces&&e.includes(" ")||!this.options.allowEmpty&&e.length===0||this.options.maxLength&&e.length>this.options.maxLength?null:e}}class Ui{constructor(e,t,n,i=!0,s=!1,a=!0){this._displayName=e,this._globalName=t??e,this._localName=n??this._globalName,this._enabled=i,this._isReadOnly=s,this._visible=a}get displayName(){return this._displayName}set displayName(e){this._isReadOnly||(this._displayName=e)}get enabled(){return this._enabled}set enabled(e){this._isReadOnly||(this._enabled=e)}get globalName(){return this._globalName}set globalName(e){this._isReadOnly||(this._globalName=e)}get isReadOnly(){return this._isReadOnly}get localName(){return this._localName}set localName(e){this._isReadOnly||(this._localName=e)}get visible(){return this._visible}set visible(e){this._isReadOnly||(this._visible=e)}}class Fi{constructor(){this._keywords=[]}add(e,t,n,i=!0,s=!0){let a,o,c;t===void 0?(a=e,o=e,c=e):n===void 0?(a=t,o=e,c=t):(a=e,o=t,c=n);const h=new Ui(a,o,c,i,!1,s);return this._keywords.push(h),h}clear(){this._keywords=[],this._defaultKeyword=void 0}toArray(){return this._keywords.slice()}get default(){return this._defaultKeyword}set default(e){if(e&&!this._keywords.includes(e))throw new Error("Default keyword must be one of the collection's keywords");this._defaultKeyword=e}getDisplayString(e=!1){return this._keywords.filter(n=>n.visible&&n.enabled).map(n=>(!e&&this._defaultKeyword===n,n.displayName)).join("/")}[Symbol.iterator](){let e=0;const t=this._keywords;return{next(){return e<t.length?{done:!1,value:t[e++]}:{done:!0,value:void 0}}}}findByDisplayName(e){return this._keywords.find(t=>t.displayName.toLowerCase()===e.toLowerCase())}findByGlobalName(e){return this._keywords.find(t=>t.globalName.toLowerCase()===e.toLowerCase())}get count(){return this._keywords.length}}class Gt{constructor(e){this._message=e,this._appendKeywordsToMessage=!0,this._isReadOnly=!1,this._keywords=new Fi}get jig(){return this._jig}set jig(e){this._isReadOnly||(this._jig=e)}get message(){return this._message}set message(e){this._isReadOnly||(this._message=e)}get appendKeywordsToMessage(){return this._appendKeywordsToMessage}set appendKeywordsToMessage(e){this._isReadOnly||(this._appendKeywordsToMessage=e)}get isReadOnly(){return this._isReadOnly}get keywords(){return this._keywords}setMessageAndKeywords(e,t){if(this._isReadOnly)return this;const n=e.match(/^(.*?)\s*(?:\[(.*)\])?$/);if(n){const[,i,s]=n;if(this._message=i.trim(),s!==void 0){const a=s.split("/").map(o=>o.trim()).filter(o=>o.length>0);this._keywords.clear();for(const o of a){let h=t.split(/\s+/).find(l=>l.toLowerCase()===o.toLowerCase());h||(h=o),this._keywords.add(o,h)}}}return this}}class Sc extends Gt{constructor(e){super(e),this._useBasePoint=!0,this._useDashedLine=!0,this._useAngleBase=!1,this._defaultValue=0,this._useDefaultValue=!1,this._allowZero=!0,this._allowNegative=!1}get basePoint(){return this._basePoint}set basePoint(e){this.isReadOnly||(e==null?this._basePoint=e:this._basePoint=this._basePoint?this._basePoint.copy(e):new I.AcGePoint3d(e))}get useBasePoint(){return this._useBasePoint}set useBasePoint(e){this.isReadOnly||(this._useBasePoint=e)}get useDashedLine(){return this._useDashedLine}set useDashedLine(e){this.isReadOnly||(this._useDashedLine=e)}get useAngleBase(){return this._useAngleBase}set useAngleBase(e){this.isReadOnly||(this._useAngleBase=e)}get defaultValue(){return this._defaultValue}set defaultValue(e){this.isReadOnly||(this._defaultValue=e)}get useDefaultValue(){return this._useDefaultValue}set useDefaultValue(e){this.isReadOnly||(this._useDefaultValue=e)}get allowZero(){return this._allowZero}set allowZero(e){this.isReadOnly||(this._allowZero=e)}get allowNegative(){return this._allowNegative}set allowNegative(e){this.isReadOnly||(this._allowNegative=e)}}class xn extends Gt{constructor(e){super(e),this._defaultValue=0,this._useDefaultValue=!1,this._allowNone=!1,this._allowArbitraryInput=!1,this._allowNegative=!1,this._allowZero=!0}get defaultValue(){return this._defaultValue}set defaultValue(e){this.isReadOnly||(this._defaultValue=e)}get useDefaultValue(){return this._useDefaultValue}set useDefaultValue(e){this.isReadOnly||(this._useDefaultValue=e)}get allowNone(){return this._allowNone}set allowNone(e){this.isReadOnly||(this._allowNone=e)}get allowArbitraryInput(){return this._allowArbitraryInput}set allowArbitraryInput(e){this.isReadOnly||(this._allowArbitraryInput=e)}get allowNegative(){return this._allowNegative}set allowNegative(e){this.isReadOnly||(this._allowNegative=e)}get allowZero(){return this._allowZero}set allowZero(e){this.isReadOnly||(this._allowZero=e)}}class Ni extends xn{constructor(e){super(e),this._useBasePoint=!0,this._useDashedLine=!0,this._only2d=!0,this.allowNegative=!1}get basePoint(){return this._basePoint}set basePoint(e){this.isReadOnly||(e==null?this._basePoint=e:this._basePoint=this._basePoint?this._basePoint.copy(e):new I.AcGePoint3d(e))}get useBasePoint(){return this._useBasePoint}set useBasePoint(e){this.isReadOnly||(this._useBasePoint=e)}get useDashedLine(){return this._useDashedLine}set useDashedLine(e){this.isReadOnly||(this._useDashedLine=e)}get only2d(){return this._only2d}set only2d(e){this.isReadOnly||(this._only2d=e)}}class _c extends xn{}class Cc extends xn{constructor(e,t,n){super(e),typeof t=="number"&&(this._lowerLimit=Math.floor(t)),typeof n=="number"&&(this._upperLimit=Math.ceil(n))}get lowerLimit(){return this._lowerLimit}set lowerLimit(e){this.isReadOnly||(this._lowerLimit=typeof e=="number"?Math.floor(e):void 0)}get upperLimit(){return this._upperLimit}set upperLimit(e){this.isReadOnly||(this._upperLimit=typeof e=="number"?Math.floor(e):void 0)}}class qe extends Gt{constructor(e){super(e),this._useBasePoint=!1,this._useDashedLine=!1,this._allowNone=!1}get basePoint(){return this._basePoint}set basePoint(e){this.isReadOnly||(e==null?this._basePoint=e:this._basePoint=this._basePoint?this._basePoint.copy(e):new I.AcGePoint3d(e))}get useBasePoint(){return this._useBasePoint}set useBasePoint(e){this.isReadOnly||(this._useBasePoint=e)}get useDashedLine(){return this._useDashedLine}set useDashedLine(e){this.isReadOnly||(this._useDashedLine=e)}get allowNone(){return this._allowNone}set allowNone(e){this.isReadOnly||(this._allowNone=e)}}class zi extends Gt{constructor(e){super(e),this._allowSpaces=!0,this._allowEmpty=!1,this._defaultValue="",this._useDefaultValue=!1}get allowSpaces(){return this._allowSpaces}set allowSpaces(e){this.isReadOnly||(this._allowSpaces=e)}get allowEmpty(){return this._allowEmpty}set allowEmpty(e){this.isReadOnly||(this._allowEmpty=e)}get maxLength(){return this._maxLength}set maxLength(e){this.isReadOnly||(this._maxLength=e)}get defaultValue(){return this._defaultValue}set defaultValue(e){this.isReadOnly||(this._defaultValue=e)}get useDefaultValue(){return this._useDefaultValue}set useDefaultValue(e){this.isReadOnly||(this._useDefaultValue=e)}}class wn{constructor(e="rect",t=8,n="green"){this._type=e,this._size=t,this._color=n,wn.injectCSS(),this._el=document.createElement("div"),this._el.classList.add("ml-marker"),this._el.style.color=n,this.applyShape(),document.body.appendChild(this._el)}get color(){return this._color}set color(e){this._color=e,this._el.style.color=e}get type(){return this._type}set type(e){this._type=e,this.applyShape()}static injectCSS(){if(document.getElementById("ml-marker-style"))return;const e=document.createElement("style");e.id="ml-marker-style",e.textContent=`
208
208
  .ml-marker {
209
209
  position: absolute;
210
210
  pointer-events: none;
@@ -228,7 +228,7 @@
228
228
  border-bottom: 1em solid currentColor;
229
229
  transform: translate(-50%, -100%);
230
230
  }
231
- `,document.head.appendChild(e)}applyShape(){switch(this._type){case"circle":this._el.classList.add("ml-marker-circle"),this._el.style.width=`${this._size}px`,this._el.style.height=`${this._size}px`;break;case"rect":this._el.classList.add("ml-marker-rect"),this._el.style.width=`${this._size}px`,this._el.style.height=`${this._size}px`;break;case"triangle":this._el.classList.add("ml-marker-triangle"),this._el.style.fontSize=`${this._size}px`;break}}setPosition(e){this._el.style.left=`${e.x}px`,this._el.style.top=`${e.y}px`}destroy(){this._el.remove()}}class Gi{constructor(e){this.stack=[],this.view=e}showMarker(e,t,n,i){const s=this.view.wcs2Cwcs(e),a=new wn(t,n,i);return a.setPosition(s),this.stack.push(a),a}hideMarker(){const e=this.stack.pop();e&&e.destroy()}clear(){for(const e of this.stack)e.destroy();this.stack=[]}top(){return this.stack[this.stack.length-1]}}class ji{constructor(e){this.userTyped=!1,this.parent=e,this.input=document.createElement("input"),this.input.type="text",this.boundOnInput=()=>{this.userTyped=!0,this.resetValidation()},this.input.addEventListener("input",this.boundOnInput),this.parent.appendChild(this.input)}markInvalid(){this.input.classList.add("invalid")}markValid(){this.input.classList.remove("invalid")}resetValidation(){this.input.classList.remove("invalid")}get placeholder(){return this.input.placeholder}set placeholder(e){e&&(this.input.placeholder=e)}set value(e){e!==void 0&&(this.input.value=e)}get value(){return this.input.value}get focused(){return document.activeElement===this.input}focus(){this.input.focus()}select(){this.input.select()}remove(){this.input.remove()}isEventTarget(e){return e.target===this.input}dispose(){this.input.removeEventListener("input",this.boundOnInput),this.remove()}addEventListener(e,t,n){this.input.addEventListener(e,t,n)}removeEventListener(e,t,n){this.input.removeEventListener(e,t,n)}}class Tc{constructor(e){this.parent=e.parent,this.twoInputs=e.twoInputs??!0,this.boundOnInput=()=>this.handleInput(),this.boundOnKeyDown=t=>this.handleKeyDown(t),this.xInput=new ji(this.parent),this.xInput.addEventListener("input",this.boundOnInput),this.xInput.addEventListener("keydown",this.boundOnKeyDown),this.twoInputs&&(this.yInput=new ji(this.parent),this.yInput.addEventListener("input",this.boundOnInput),this.yInput.addEventListener("keydown",this.boundOnKeyDown)),this.validateFn=e.validate,this.onCommit=e.onCommit,this.onChange=e.onChange,this.onCancel=e.onCancel,setTimeout(()=>{this.yInput&&this.yInput.select(),this.xInput.focus(),this.xInput.select()},0)}get userTyped(){var e;return this.xInput.userTyped||!!((e=this.xInput)!=null&&e.userTyped)}get focused(){var e;return this.xInput.focused||((e=this.yInput)==null?void 0:e.focused)}focus(){this.xInput.focus()}setValue(e){this.xInput.userTyped||(this.xInput.value=e.x),this.twoInputs&&this.yInput&&!this.yInput.userTyped&&(this.yInput.value=e.y??"")}dispose(){var e;this.xInput.removeEventListener("input",this.boundOnInput),this.xInput.removeEventListener("keydown",this.boundOnKeyDown),this.xInput.dispose(),this.yInput&&(this.yInput.removeEventListener("input",this.boundOnInput),this.yInput.removeEventListener("keydown",this.boundOnKeyDown),(e=this.yInput)==null||e.dispose())}handleInput(){var t;const e=this.validate();(t=this.onChange)==null||t.call(this,e)}handleKeyDown(e){var i,s;let t=this.xInput,n=this.yInput;if(this.yInput&&this.yInput.isEventTarget(e)&&(t=this.yInput,n=this.xInput),e.key==="Enter"){const a=this.validate();a.isValid&&a.value!=null?((i=this.onCommit)==null||i.call(this,a.value),t.markValid()):t.markInvalid(),e.preventDefault(),e.stopPropagation()}else e.key==="Escape"?((s=this.onCancel)==null||s.call(this),e.preventDefault(),e.stopPropagation()):e.key==="Tab"&&(e.preventDefault(),n&&(n==null||n.focus(),n==null||n.select()))}validate(){const e=this.xInput.value.trim(),t=this.twoInputs&&this.yInput?this.yInput.value.trim():void 0;return this.validateFn({x:e,y:t})}}const fn=class fn{constructor(e,t){this.lastPoint=null,this.visible=!1,this.disposed=!1,this.view=e,t.disableOSnap||(this.osnapMarkerManager=new Gi(e)),this.parent=t.parent??document.body,this.validateFn=t.validate,this.getDynamicValue=t.getDynamicValue,this.drawPreview=t.drawPreview,this.onCommit=t.onCommit,this.onChange=t.onChange,this.onCancel=t.onCancel,this.container=document.createElement("div"),this.container.className="ml-floating-input";const n=document.createElement("span");n.className="ml-floating-input-label",n.textContent=t.message??"",this.container.appendChild(n),this.inputs=new Tc({parent:this.container,twoInputs:t.twoInputs,validate:this.validateFn,onCancel:this.onCancel,onCommit:this.onCommit,onChange:this.onChange}),document.body.appendChild(this.container),this.boundOnMouseEnter=i=>this.handleMouseEnter(i),this.boundOnMouseLeave=()=>this.handleMouseLeave(),this.boundOnMouseMove=i=>this.handleMouseMove(i),this.boundOnClick=i=>this.handleClick(i),this.parent.addEventListener("mouseenter",this.boundOnMouseEnter),this.parent.addEventListener("mouseleave",this.boundOnMouseLeave),this.injectCSS()}injectCSS(){if(fn.stylesInjected)return;fn.stylesInjected=!0;const e=document.createElement("style");e.textContent=`
231
+ `,document.head.appendChild(e)}applyShape(){switch(this._type){case"circle":this._el.classList.add("ml-marker-circle"),this._el.style.width=`${this._size}px`,this._el.style.height=`${this._size}px`;break;case"rect":this._el.classList.add("ml-marker-rect"),this._el.style.width=`${this._size}px`,this._el.style.height=`${this._size}px`;break;case"triangle":this._el.classList.add("ml-marker-triangle"),this._el.style.fontSize=`${this._size}px`;break}}setPosition(e){this._el.style.left=`${e.x}px`,this._el.style.top=`${e.y}px`}destroy(){this._el.remove()}}class Gi{constructor(e){this.stack=[],this.view=e}showMarker(e,t,n,i){const s=this.view.wcs2Cwcs(e),a=new wn(t,n,i);return a.setPosition(s),this.stack.push(a),a}hideMarker(){const e=this.stack.pop();e&&e.destroy()}clear(){for(const e of this.stack)e.destroy();this.stack=[]}top(){return this.stack[this.stack.length-1]}}class ji{constructor(e){this.userTyped=!1,this.parent=e,this.input=document.createElement("input"),this.input.type="text",this.boundOnInput=()=>{this.userTyped=!0,this.resetValidation()},this.input.addEventListener("input",this.boundOnInput),this.parent.appendChild(this.input)}markInvalid(){this.input.classList.add("invalid")}markValid(){this.input.classList.remove("invalid")}resetValidation(){this.input.classList.remove("invalid")}get placeholder(){return this.input.placeholder}set placeholder(e){e&&(this.input.placeholder=e)}set value(e){e!==void 0&&(this.input.value=e)}get value(){return this.input.value}get focused(){return document.activeElement===this.input}focus(){this.input.focus()}select(){this.input.select()}remove(){this.input.remove()}isEventTarget(e){return e.target===this.input}dispose(){this.input.removeEventListener("input",this.boundOnInput),this.remove()}addEventListener(e,t,n){this.input.addEventListener(e,t,n)}removeEventListener(e,t,n){this.input.removeEventListener(e,t,n)}}class Tc{constructor(e){this.parent=e.parent,this.twoInputs=e.twoInputs??!0,this.boundOnInput=()=>this.handleInput(),this.boundOnKeyDown=t=>this.handleKeyDown(t),this.xInput=new ji(this.parent),this.xInput.addEventListener("input",this.boundOnInput),this.xInput.addEventListener("keydown",this.boundOnKeyDown),this.twoInputs&&(this.yInput=new ji(this.parent),this.yInput.addEventListener("input",this.boundOnInput),this.yInput.addEventListener("keydown",this.boundOnKeyDown)),this.validateFn=e.validate,this.onCommit=e.onCommit,this.onChange=e.onChange,this.onCancel=e.onCancel,setTimeout(()=>{this.yInput&&this.yInput.select(),this.xInput.focus(),this.xInput.select()},0)}get userTyped(){var e;return this.xInput.userTyped||!!((e=this.xInput)!=null&&e.userTyped)}get focused(){var e;return this.xInput.focused||((e=this.yInput)==null?void 0:e.focused)}focus(){this.xInput.focus()}setValue(e){this.xInput.userTyped||(this.xInput.value=e.x),this.twoInputs&&this.yInput&&!this.yInput.userTyped&&(this.yInput.value=e.y??"")}dispose(){var e;this.xInput.removeEventListener("input",this.boundOnInput),this.xInput.removeEventListener("keydown",this.boundOnKeyDown),this.xInput.dispose(),this.yInput&&(this.yInput.removeEventListener("input",this.boundOnInput),this.yInput.removeEventListener("keydown",this.boundOnKeyDown),(e=this.yInput)==null||e.dispose())}handleInput(){var t;const e=this.validate();(t=this.onChange)==null||t.call(this,e)}handleKeyDown(e){var i,s;let t=this.xInput,n=this.yInput;if(this.yInput&&this.yInput.isEventTarget(e)&&(t=this.yInput,n=this.xInput),e.key==="Enter"){const a=this.validate();a.isValid&&a.value!=null?((i=this.onCommit)==null||i.call(this,a.value),t.markValid()):t.markInvalid(),e.preventDefault(),e.stopPropagation()}else e.key==="Escape"?((s=this.onCancel)==null||s.call(this),e.preventDefault(),e.stopPropagation()):e.key==="Tab"&&(e.preventDefault(),n&&(n==null||n.focus(),n==null||n.select()))}validate(){const e=this.xInput.value.trim(),t=this.twoInputs&&this.yInput?this.yInput.value.trim():void 0;return this.validateFn({x:e,y:t})}}class Ec{constructor(e){this.container=null,this.baseLine=null,this.perpLineAtBase=null,this.perpLineAtCursor=null,this.connectorLine=null,this.labelEl=null,this.angleLabelEl=null,this.xAxisLine=null,this.angleSvg=null,this.anglePath=null,this.options={},this.view=e}get element(){return this.container}start(e,t){this.basePoint=new I.AcGePoint3d(e),this.options=t||{};const n=this.options.color||"#0f0";this.container=document.createElement("div"),this.container.style.position="fixed",this.container.style.left="0",this.container.style.top="0",this.container.style.pointerEvents="none",this.container.style.zIndex="99999",document.body.appendChild(this.container),this.baseLine=document.createElement("div"),this.baseLine.style.position="fixed",this.baseLine.style.borderTop=`1px solid ${n}`,this.container.appendChild(this.baseLine);const i=()=>{const s=document.createElement("div");return s.style.position="fixed",s.style.borderTop=`1px dashed ${n}`,this.container.appendChild(s),s};this.options.showBaseLineOnly||(this.perpLineAtBase=i(),this.perpLineAtCursor=i(),this.connectorLine=i(),this.labelEl=document.createElement("div"),this.labelEl.style.position="fixed",this.labelEl.style.color=n,this.labelEl.style.fontSize="12px",this.labelEl.style.padding="2px 4px",this.labelEl.style.borderRadius="4px",this.container.appendChild(this.labelEl),this.xAxisLine=document.createElement("div"),this.xAxisLine.style.position="fixed",this.xAxisLine.style.borderTop=`1px solid ${n}`,this.container.appendChild(this.xAxisLine),this.angleSvg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.angleSvg.setAttribute("style","position:absolute; overflow:visible; pointer-events:none;"),this.anglePath=document.createElementNS("http://www.w3.org/2000/svg","path"),this.anglePath.setAttribute("fill","none"),this.anglePath.setAttribute("stroke",n),this.anglePath.setAttribute("stroke-width","1"),this.anglePath.setAttribute("stroke-dasharray","4 4"),this.angleSvg.appendChild(this.anglePath),this.container.appendChild(this.angleSvg),this.angleLabelEl=document.createElement("div"),this.angleLabelEl.style.position="fixed",this.angleLabelEl.style.color=n,this.angleLabelEl.style.fontSize="12px",this.angleLabelEl.style.padding="2px 4px",this.angleLabelEl.style.borderRadius="4px",this.container.appendChild(this.angleLabelEl))}update(e){if(!this.container||!this.basePoint||!this.baseLine)return;const t=this.view.canvas.getBoundingClientRect(),n=this.view.wcs2Cwcs(this.basePoint),i=this.view.wcs2Cwcs(e),s=t.left,a=t.top,o=(x,v,w)=>{const S=w.x-v.x,_=w.y-v.y,T=Math.sqrt(S*S+_*_),B=Math.atan2(_,S)*(180/Math.PI);x.style.width=`${T}px`,x.style.transformOrigin="0 0",x.style.transform=`translate(${v.x+s}px, ${v.y+a}px) rotate(${B}deg)`};if(o(this.baseLine,n,i),this.options.showBaseLineOnly||!this.perpLineAtBase||!this.perpLineAtCursor||!this.connectorLine)return;const c=i.x-n.x,h=i.y-n.y,l=Math.sqrt(c*c+h*h);if(l===0){this.perpLineAtBase&&(this.perpLineAtBase.style.width="0px"),this.perpLineAtCursor&&(this.perpLineAtCursor.style.width="0px"),this.connectorLine&&(this.connectorLine.style.width="0px"),this.xAxisLine&&(this.xAxisLine.style.width="0px"),this.anglePath&&this.anglePath.setAttribute("d",""),this.angleLabelEl&&(this.angleLabelEl.style.display="none");return}const d=this.options.perpendicularLength??50,u=-h/l,f=c/l,y={x:n.x+u*d,y:n.y+f*d},m={x:i.x+u*d,y:i.y+f*d};if(o(this.perpLineAtBase,n,y),o(this.perpLineAtCursor,i,m),o(this.connectorLine,y,m),this.labelEl){const x=(y.x+m.x)/2+s,v=(y.y+m.y)/2+a-24,w=Math.sqrt((e.x-this.basePoint.x)**2+(e.y-this.basePoint.y)**2);this.labelEl.textContent=w.toFixed(3),this.labelEl.style.left=`${x-20}px`,this.labelEl.style.top=`${v}px`,this.labelEl.style.display=""}if(this.xAxisLine){const x={x:n.x+l,y:n.y};o(this.xAxisLine,n,x)}if(this.angleSvg&&this.anglePath&&this.angleLabelEl){const x=l,v=n.x+s,w=n.y+a,S=Math.atan2(i.y-n.y,i.x-n.x),_=S*180/Math.PI,T=S/2,B=v-x,O=w-x,P=x*2;this.angleSvg.style.left=`${B}px`,this.angleSvg.style.top=`${O}px`,this.angleSvg.setAttribute("width",`${P}`),this.angleSvg.setAttribute("height",`${P}`),this.angleSvg.setAttribute("viewBox",`0 0 ${P} ${P}`);const V=x,H=x,J=V+x,pe=H,ae=V+x*Math.cos(S),$=H+x*Math.sin(S),X=Math.abs(S)>Math.PI?"1":"0",Y=S>=0?"1":"0",te=`M ${J} ${pe} A ${x} ${x} 0 ${X} ${Y} ${ae} ${$}`;this.anglePath.setAttribute("d",te);const re=`${Math.abs(_).toFixed(1)}°`,he=v+x*Math.cos(T),j=w+x*Math.sin(T);this.angleLabelEl.textContent=re;const W=40;this.angleLabelEl.style.left=`${he-W/2}px`,this.angleLabelEl.style.top=`${j-12}px`,this.angleLabelEl.style.display=""}}dispose(){this.container&&this.container.remove(),this.container=null,this.baseLine=null,this.perpLineAtBase=null,this.perpLineAtCursor=null,this.connectorLine=null,this.labelEl=null,this.angleLabelEl=null,this.xAxisLine=null,this.angleSvg=null,this.anglePath=null}}const fn=class fn{constructor(e,t){this.lastPoint=null,this.visible=!1,this.disposed=!1,this.view=e,t.disableOSnap||(this.osnapMarkerManager=new Gi(e)),t.basePoint&&(this.rubberBand=new Ec(this.view),this.rubberBand.start(t.basePoint,{color:"#0f0",showBaseLineOnly:t.showBaseLineOnly})),this.parent=t.parent??document.body,this.validateFn=t.validate,this.getDynamicValue=t.getDynamicValue,this.drawPreview=t.drawPreview,this.onCommit=t.onCommit,this.onChange=t.onChange,this.onCancel=t.onCancel,this.container=document.createElement("div"),this.container.className="ml-floating-input";const n=document.createElement("span");n.className="ml-floating-input-label",n.textContent=t.message??"",this.container.appendChild(n),this.inputs=new Tc({parent:this.container,twoInputs:t.twoInputs,validate:this.validateFn,onCancel:this.onCancel,onCommit:this.onCommit,onChange:this.onChange}),document.body.appendChild(this.container),this.boundOnMouseEnter=i=>this.handleMouseEnter(i),this.boundOnMouseLeave=()=>this.handleMouseLeave(),this.boundOnMouseMove=i=>this.handleMouseMove(i),this.boundOnClick=i=>this.handleClick(i),this.parent.addEventListener("mouseenter",this.boundOnMouseEnter),this.parent.addEventListener("mouseleave",this.boundOnMouseLeave),this.injectCSS()}injectCSS(){if(fn.stylesInjected)return;fn.stylesInjected=!0;const e=document.createElement("style");e.textContent=`
232
232
  .ml-floating-input {
233
233
  position: absolute;
234
234
  display: flex;
@@ -260,7 +260,7 @@
260
260
  white-space: nowrap;
261
261
  color: #fff; /* white label text */
262
262
  }
263
- `,document.head.appendChild(e)}get isVisible(){return this.visible}showAt(e){this.disposed||(this.container.style.display="flex",this.visible=!0,this.inputs.focus(),this.setPosition(e),this.parent.addEventListener("mousemove",this.boundOnMouseMove),this.parent.addEventListener("click",this.boundOnClick))}hide(){this.visible&&(this.container.style.display="none",this.visible=!1,this.removeListener())}dispose(){var e;this.disposed||(this.disposed=!0,(e=this.osnapMarkerManager)==null||e.clear(),this.inputs.dispose(),this.removeListener(!0),this.container.remove())}setPosition(e){const t=this.parent.getBoundingClientRect(),n=this.container.getBoundingClientRect(),i={x:e.x-t.left,y:e.y-t.top};let s=i.x+10,a=i.y+10;return s+n.width>t.right&&(s=t.right-n.width),a+n.height>t.bottom&&(a=t.bottom-n.height),s<t.left&&(s=t.left),a<t.top&&(a=t.top),this.container.style.left=`${s}px`,this.container.style.top=`${a}px`,i}removeListener(e=!1){this.parent.removeEventListener("mousemove",this.boundOnMouseMove),this.parent.removeEventListener("click",this.boundOnClick),e&&(this.parent.removeEventListener("mouseenter",this.boundOnMouseEnter),this.parent.removeEventListener("mouseleave",this.boundOnMouseLeave))}handleMouseEnter(e){this.showAt(e)}handleMouseLeave(){this.hide()}handleMouseMove(e){var i;if(!this.visible)return;const t=this.getPosition(e),n=this.getDynamicValue(t);this.inputs.setValue(n.raw),this.inputs.focused||this.inputs.focus(),(i=this.drawPreview)==null||i.call(this,t)}handleClick(e){var i;if(!this.visible)return;const t=this.getPosition(e),n=this.getDynamicValue(t);this.lastPoint=t,(i=this.onCommit)==null||i.call(this,n.value)}getPosition(e){const t=this.setPosition(e),n=this.view.cwcs2Wcs(t);return this.osnapMarkerManager&&(this.osnapMarkerManager.hideMarker(),this.lastOSnapPoint=this.getOSnapPoint(),this.lastOSnapPoint&&(n.x=this.lastOSnapPoint.x,n.y=this.lastOSnapPoint.y,this.osnapMarkerManager.showMarker(this.lastOSnapPoint))),n}getOSnapPoint(e,t=20){const n=this.view.pick(e,t);if(n.length>0){const s=I.acdbHostApplicationServices().workingDatabase.tables.blockTable.modelSpace.getIdAt(n[0]);if(s){const a=[];s.subGetOsnapPoints(I.AcDbOsnapMode.EndPoint,{...this.view.curPos,z:0},this.lastPoint,a);let o=Number.MAX_VALUE,c=-1;for(let h=0;h<a.length;++h){const l=this.view.curPos.distanceTo(a[h]);l<o&&(o=l,c=h)}if(c!=-1){const h=this.view.cwcs2Wcs({x:0,y:0}),l=this.view.cwcs2Wcs({x:t,y:0});if(o<l.x-h.x)return a[c]}}}}};fn.stylesInjected=!1;let ur=fn;class Ec{constructor(e){this.container=null,this.baseLine=null,this.perpLineAtBase=null,this.perpLineAtCursor=null,this.connectorLine=null,this.labelEl=null,this.angleLabelEl=null,this.xAxisLine=null,this.angleSvg=null,this.anglePath=null,this.options={},this.view=e}get element(){return this.container}start(e,t){this.basePoint=new I.AcGePoint3d(e),this.options=t||{};const n=this.options.color||"#0f0";this.container=document.createElement("div"),this.container.style.position="fixed",this.container.style.left="0",this.container.style.top="0",this.container.style.pointerEvents="none",this.container.style.zIndex="99999",document.body.appendChild(this.container),this.baseLine=document.createElement("div"),this.baseLine.style.position="fixed",this.baseLine.style.borderTop=`1px solid ${n}`,this.container.appendChild(this.baseLine);const i=()=>{const s=document.createElement("div");return s.style.position="fixed",s.style.borderTop=`1px dashed ${n}`,this.container.appendChild(s),s};this.options.showBaseLineOnly||(this.perpLineAtBase=i(),this.perpLineAtCursor=i(),this.connectorLine=i(),this.labelEl=document.createElement("div"),this.labelEl.style.position="fixed",this.labelEl.style.color=n,this.labelEl.style.fontSize="12px",this.labelEl.style.padding="2px 4px",this.labelEl.style.borderRadius="4px",this.container.appendChild(this.labelEl),this.xAxisLine=document.createElement("div"),this.xAxisLine.style.position="fixed",this.xAxisLine.style.borderTop=`1px solid ${n}`,this.container.appendChild(this.xAxisLine),this.angleSvg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.angleSvg.setAttribute("style","position:absolute; overflow:visible; pointer-events:none;"),this.anglePath=document.createElementNS("http://www.w3.org/2000/svg","path"),this.anglePath.setAttribute("fill","none"),this.anglePath.setAttribute("stroke",n),this.anglePath.setAttribute("stroke-width","1"),this.anglePath.setAttribute("stroke-dasharray","4 4"),this.angleSvg.appendChild(this.anglePath),this.container.appendChild(this.angleSvg),this.angleLabelEl=document.createElement("div"),this.angleLabelEl.style.position="fixed",this.angleLabelEl.style.color=n,this.angleLabelEl.style.fontSize="12px",this.angleLabelEl.style.padding="2px 4px",this.angleLabelEl.style.borderRadius="4px",this.container.appendChild(this.angleLabelEl))}update(e){if(!this.container||!this.basePoint||!this.baseLine)return;const t=this.view.canvas.getBoundingClientRect(),n=this.view.wcs2Cwcs(this.basePoint),i=this.view.wcs2Cwcs(e),s=t.left,a=t.top,o=(x,v,w)=>{const S=w.x-v.x,_=w.y-v.y,T=Math.sqrt(S*S+_*_),B=Math.atan2(_,S)*(180/Math.PI);x.style.width=`${T}px`,x.style.transformOrigin="0 0",x.style.transform=`translate(${v.x+s}px, ${v.y+a}px) rotate(${B}deg)`};if(o(this.baseLine,n,i),this.options.showBaseLineOnly||!this.perpLineAtBase||!this.perpLineAtCursor||!this.connectorLine)return;const c=i.x-n.x,h=i.y-n.y,l=Math.sqrt(c*c+h*h);if(l===0){this.perpLineAtBase&&(this.perpLineAtBase.style.width="0px"),this.perpLineAtCursor&&(this.perpLineAtCursor.style.width="0px"),this.connectorLine&&(this.connectorLine.style.width="0px"),this.xAxisLine&&(this.xAxisLine.style.width="0px"),this.anglePath&&this.anglePath.setAttribute("d",""),this.angleLabelEl&&(this.angleLabelEl.style.display="none");return}const d=this.options.perpendicularLength??50,u=-h/l,f=c/l,y={x:n.x+u*d,y:n.y+f*d},m={x:i.x+u*d,y:i.y+f*d};if(o(this.perpLineAtBase,n,y),o(this.perpLineAtCursor,i,m),o(this.connectorLine,y,m),this.labelEl){const x=(y.x+m.x)/2+s,v=(y.y+m.y)/2+a-24,w=Math.sqrt((e.x-this.basePoint.x)**2+(e.y-this.basePoint.y)**2);this.labelEl.textContent=w.toFixed(3),this.labelEl.style.left=`${x-20}px`,this.labelEl.style.top=`${v}px`,this.labelEl.style.display=""}if(this.xAxisLine){const x={x:n.x+l,y:n.y};o(this.xAxisLine,n,x)}if(this.angleSvg&&this.anglePath&&this.angleLabelEl){const x=l,v=n.x+s,w=n.y+a,S=Math.atan2(i.y-n.y,i.x-n.x),_=S*180/Math.PI,T=S/2,B=v-x,O=w-x,P=x*2;this.angleSvg.style.left=`${B}px`,this.angleSvg.style.top=`${O}px`,this.angleSvg.setAttribute("width",`${P}`),this.angleSvg.setAttribute("height",`${P}`),this.angleSvg.setAttribute("viewBox",`0 0 ${P} ${P}`);const V=x,H=x,J=V+x,pe=H,ae=V+x*Math.cos(S),$=H+x*Math.sin(S),X=Math.abs(S)>Math.PI?"1":"0",Y=S>=0?"1":"0",te=`M ${J} ${pe} A ${x} ${x} 0 ${X} ${Y} ${ae} ${$}`;this.anglePath.setAttribute("d",te);const re=`${Math.abs(_).toFixed(1)}°`,he=v+x*Math.cos(T),j=w+x*Math.sin(T);this.angleLabelEl.textContent=re;const W=40;this.angleLabelEl.style.left=`${he-W/2}px`,this.angleLabelEl.style.top=`${j-12}px`,this.angleLabelEl.style.display=""}}dispose(){this.container&&this.container.remove(),this.container=null,this.baseLine=null,this.perpLineAtBase=null,this.perpLineAtCursor=null,this.connectorLine=null,this.labelEl=null,this.angleLabelEl=null,this.xAxisLine=null,this.angleSvg=null,this.anglePath=null}}const gn=class gn{constructor(e){this.lastPoint=null,this.active=!1,this.view=e,this.injectCSS()}get isActive(){return this.active}injectCSS(){if(gn.stylesInjected)return;gn.stylesInjected=!0;const e=document.createElement("style");e.textContent=`
263
+ `,document.head.appendChild(e)}get isVisible(){return this.visible}showAt(e){this.disposed||(this.container.style.display="flex",this.visible=!0,this.inputs.focus(),this.setPosition(e),this.parent.addEventListener("mousemove",this.boundOnMouseMove),this.parent.addEventListener("click",this.boundOnClick))}hide(){this.visible&&(this.container.style.display="none",this.visible=!1,this.removeListener())}dispose(){var e,t;this.disposed||(this.disposed=!0,(e=this.osnapMarkerManager)==null||e.clear(),this.inputs.dispose(),(t=this.rubberBand)==null||t.dispose(),this.removeListener(!0),this.container.remove())}setPosition(e){const t=this.parent.getBoundingClientRect(),n=this.container.getBoundingClientRect(),i={x:e.x-t.left,y:e.y-t.top};let s=i.x+10,a=i.y+10;return s+n.width>t.right&&(s=t.right-n.width),a+n.height>t.bottom&&(a=t.bottom-n.height),s<t.left&&(s=t.left),a<t.top&&(a=t.top),this.container.style.left=`${s}px`,this.container.style.top=`${a}px`,i}removeListener(e=!1){this.parent.removeEventListener("mousemove",this.boundOnMouseMove),this.parent.removeEventListener("click",this.boundOnClick),e&&(this.parent.removeEventListener("mouseenter",this.boundOnMouseEnter),this.parent.removeEventListener("mouseleave",this.boundOnMouseLeave))}handleMouseEnter(e){this.showAt(e)}handleMouseLeave(){this.hide()}handleMouseMove(e){var i,s;if(!this.visible)return;const t=this.getPosition(e),n=this.getDynamicValue(t);this.inputs.setValue(n.raw),(i=this.rubberBand)==null||i.update(t),this.inputs.focused||this.inputs.focus(),(s=this.drawPreview)==null||s.call(this,t)}handleClick(e){var i;if(!this.visible)return;const t=this.getPosition(e),n=this.getDynamicValue(t);this.lastPoint=t,(i=this.onCommit)==null||i.call(this,n.value)}getPosition(e){const t=this.setPosition(e),n=this.view.cwcs2Wcs(t);return this.osnapMarkerManager&&(this.osnapMarkerManager.hideMarker(),this.lastOSnapPoint=this.getOSnapPoint(),this.lastOSnapPoint&&(n.x=this.lastOSnapPoint.x,n.y=this.lastOSnapPoint.y,this.osnapMarkerManager.showMarker(this.lastOSnapPoint))),n}getOSnapPoint(e,t=20){const n=this.view.pick(e,t);if(n.length>0){const s=I.acdbHostApplicationServices().workingDatabase.tables.blockTable.modelSpace.getIdAt(n[0]);if(s){const a=[];s.subGetOsnapPoints(I.AcDbOsnapMode.EndPoint,{...this.view.curPos,z:0},this.lastPoint,a);let o=Number.MAX_VALUE,c=-1;for(let h=0;h<a.length;++h){const l=this.view.curPos.distanceTo(a[h]);l<o&&(o=l,c=h)}if(c!=-1){const h=this.view.cwcs2Wcs({x:0,y:0}),l=this.view.cwcs2Wcs({x:t,y:0});if(o<l.x-h.x)return a[c]}}}}};fn.stylesInjected=!1;let ur=fn;const gn=class gn{constructor(e){this.lastPoint=null,this.active=!1,this.view=e,this.injectCSS()}get isActive(){return this.active}injectCSS(){if(gn.stylesInjected)return;gn.stylesInjected=!0;const e=document.createElement("style");e.textContent=`
264
264
  .ml-jig-preview-rect {
265
265
  position: absolute;
266
266
  border: 1px dashed var(--line-color, #0f0);
@@ -276,7 +276,7 @@
276
276
  pointer-events: none;
277
277
  z-index: 9999;
278
278
  }
279
- `,document.head.appendChild(e)}formatNumber(e,t){switch(t){case"angle":return e.toFixed(2);case"distance":case"point":default:return e.toFixed(3)}}getPoint(e){return this.getPointInternal(e)}getNumberTyped(e,t){const n=()=>({value:0,raw:{x:""}});return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!1,useBasePoint:!1,handler:t,getDynamicValue:n})}getDistance(e){if(!this.lastPoint)return this.getNumberTyped(e,new Ri(e));const t=i=>{const s=i.x-this.lastPoint.x,a=i.y-this.lastPoint.y,o=Math.sqrt(s*s+a*a);return{value:o,raw:{x:this.formatNumber(o,"distance")}}},n=new Ri(e);return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!1,useBasePoint:!0,handler:n,getDynamicValue:t})}getAngle(e){const t=i=>{const s=i.x-this.lastPoint.x,a=i.y-this.lastPoint.y,c=Math.atan2(a,s)*180/Math.PI;return{value:c,raw:{x:this.formatNumber(c,"angle")}}},n=new yc(e);return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!1,useBasePoint:!0,handler:n,getDynamicValue:t})}getDouble(e){return this.getNumberTyped(e,new bc(e))}getInteger(e){return this.getNumberTyped(e,new vc(e))}getString(e){const t=()=>({value:"",raw:{x:""}}),n=new wc(e);return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!1,useBasePoint:!1,handler:n,getDynamicValue:t})}async getBox(){const e=ie.t("main.inputManager.firstCorner"),t=new qe(e);t.useDashedLine=!1,t.useBasePoint=!1;const n=await this.getPoint(t),i=this.view.wcs2Cwcs(n),s=document.createElement("div");s.className="ml-jig-preview-rect",document.body.appendChild(s);const a=()=>{s.remove()},o=d=>{const u=this.view.wcs2Cwcs(d),f=Math.min(u.x,i.x),y=Math.min(u.y,i.y),m=Math.abs(u.x-i.x),x=Math.abs(u.y-i.y);Object.assign(s.style,{left:`${f}px`,top:`${y}px`,width:`${m}px`,height:`${x}px`})},c=ie.t("main.inputManager.secondCorner"),h=new qe(c);h.useDashedLine=!1,h.useBasePoint=!1;const l=await this.getPointInternal(h,a,o);return new I.AcGeBox2d().expandByPoint(n).expandByPoint(l)}getPointInternal(e,t,n){const i=a=>({value:{x:a.x,y:a.y,z:0},raw:{x:this.formatNumber(a.x,"point"),y:this.formatNumber(a.y,"point")}}),s=new xc(e);return this.makePromise({message:e.message,twoInputs:!0,jig:e.jig,showBaseLineOnly:!e.useDashedLine,useBasePoint:e.useBasePoint,cleanup:t,handler:s,getDynamicValue:i,drawPreview:n})}makePromise(e){return new Promise((t,n)=>{this.active=!0;const i=d=>{const u=e.handler.parse(d.x,d.y);return{isValid:u!=null,value:u??void 0}},s=new ur(this.view,{parent:this.view.canvas,twoInputs:e.twoInputs,message:e.message,disableOSnap:e.disableOSnap,validate:i,getDynamicValue:e.getDynamicValue,drawPreview:d=>{var u;if(e.jig){const f=e.getDynamicValue(d);e.jig.update(f.value),e.jig.render()}a&&(a==null||a.update(d)),(u=e.drawPreview)==null||u.call(e,d)},onCommit:d=>{c(d),s.lastPoint&&(this.lastPoint={x:s.lastPoint.x,y:s.lastPoint.y})},onCancel:()=>h()});let a;this.lastPoint&&e.useBasePoint&&(a=new Ec(this.view),a.start(this.lastPoint,{color:"#0f0",showBaseLineOnly:e.showBaseLineOnly}));const o=()=>{var d,u;this.active=!1,(d=e.cleanup)==null||d.call(e),(u=e.jig)==null||u.end(),document.removeEventListener("keydown",l),a==null||a.dispose(),s.dispose()},c=d=>{o(),t(d)},h=()=>{o(),n(new Error("cancelled"))},l=d=>{d.key==="Escape"&&h()};document.addEventListener("keydown",l),s.showAt(this.view.curMousePos)})}};gn.stylesInjected=!1;let Sn=gn;class Vi{constructor(e){this.events={sysVarChanged:new I.AcCmEventManager},this._view=e,this._cursorManager=new Mi(e),this._inputManager=new Sn(e)}get isActive(){return this._inputManager.isActive}get currentCursor(){return this._currentCursor}restoreCursor(){this._previousCursor!=null&&this.setCursor(this._previousCursor)}setCursor(e){this._cursorManager.setCursor(e),this._previousCursor=this._currentCursor,this._currentCursor=e}async getPoint(e){return await this._inputManager.getPoint(e)}async getAngle(e){return await this._inputManager.getAngle(e)}async getDistance(e){return await this._inputManager.getDistance(e)}async getString(e){return await this._inputManager.getString(e)}async getSelection(){return await this._inputManager.getBox()}}class _n{constructor(e){this.view=e}render(){this.entity&&this.view.addTransientEntity(this.entity)}end(){this.entity&&this.view.removeTransientEntity(this.entity.objectId)}}class Hi{constructor(e=[]){this.events={selectionAdded:new I.AcCmEventManager,selectionRemoved:new I.AcCmEventManager},this._ids=new Set(e)}get ids(){return Array.from(this._ids)}get count(){return this._ids.size}add(e){Array.isArray(e)?(e.forEach(t=>this._ids.add(t)),this.events.selectionAdded.dispatch({ids:e})):(this._ids.add(e),this.events.selectionAdded.dispatch({ids:[e]}))}delete(e){Array.isArray(e)?(e.forEach(t=>this._ids.delete(t)),this.events.selectionRemoved.dispatch({ids:e})):(this._ids.delete(e),this.events.selectionRemoved.dispatch({ids:[e]}))}has(e){return this._ids.has(e)}clear(){if(this._ids.size>0){const e=Array.from(this._ids);this._ids.clear(),this.events.selectionRemoved.dispatch({ids:e})}}}var Xe=(r=>(r[r.SELECTION=0]="SELECTION",r[r.PAN=1]="PAN",r))(Xe||{});class Wi{constructor(e){this.events={mouseMove:new I.AcCmEventManager,viewResize:new I.AcCmEventManager,hover:new I.AcCmEventManager,unhover:new I.AcCmEventManager},this._canvas=e;const t=e.getBoundingClientRect();this._bbox=new I.AcGeBox3d,this._width=t.width,this._height=t.height,this._curPos=new I.AcGePoint2d,this._curMousePos=new I.AcGePoint2d,this._selectionSet=new Hi,this._editor=new Vi(this),this._canvas.addEventListener("mousemove",n=>this.onMouseMove(n)),this._canvas.addEventListener("mousedown",n=>{n.button===1&&this._editor.setCursor(vt.Grab)}),this._canvas.addEventListener("mouseup",n=>{n.button===1&&this._editor.restoreCursor()}),window.addEventListener("resize",this.onWindowResize.bind(this)),this._selectionBoxSize=4,this._hoverTimer=null,this._pauseTimer=null,this._hoveredObjectId=null}get editor(){return this._editor}get selectionBoxSize(){return this._selectionBoxSize}set selectionBoxSize(e){this._selectionBoxSize=e}setCursor(e){this._editor.setCursor(e)}setCalculateSizeCallback(e){this._calculateSizeCallback=e}get width(){return this._width}set width(e){this._width=e}get height(){return this._height}set height(e){this._height=e}get bbox(){return this._bbox}get canvas(){return this._canvas}get aspect(){return this._width/this._height}get curPos(){return this._curPos}get curMousePos(){return this._curMousePos}get selectionSet(){return this._selectionSet}onWindowResize(){if(this._calculateSizeCallback){const{width:e,height:t}=this._calculateSizeCallback();this._width=e,this._height=t}else this._width=this._canvas.clientWidth,this._height=this._canvas.clientHeight;this.events.viewResize.dispatch({width:this._width,height:this._height})}onMouseMove(e){this._curMousePos=new I.AcGePoint2d(e.clientX,e.clientY);const t=this.cwcs2Wcs(this._curMousePos);this._curPos.copy(t),this.events.mouseMove.dispatch({x:t.x,y:t.y}),this.mode==0&&(this._editor.isActive||this.startHoverTimer(t.x,t.y))}setHoveredObjectId(e){this._hoveredObjectId&&(this.events.unhover.dispatch({id:this._hoveredObjectId,x:this.curMousePos.x,y:this.curMousePos.y}),this.onUnhover(this._hoveredObjectId)),this._hoveredObjectId=e,e&&(this.startPauseTimer(e),this.onHover(e))}hoverAt(e,t){const n=this.pick({x:e,y:t});n.length>0?this.setHoveredObjectId(n[0]):(this.setHoveredObjectId(null),this.clearPauseTimer())}clearHoverTimer(){this._hoverTimer&&clearTimeout(this._hoverTimer)}clearPauseTimer(){this._pauseTimer&&clearTimeout(this._pauseTimer)}startHoverTimer(e,t){this.clearHoverTimer(),this._hoverTimer=setTimeout(()=>{this.hoverAt(e,t)},50)}startPauseTimer(e){this._pauseTimer=setTimeout(()=>{this.events.hover.dispatch({id:e,x:this.curMousePos.x,y:this.curMousePos.y})},500)}}class $i{constructor(){this._fileName="",this._docTitle="",this._isReadOnly=!0,this._database=new I.AcDbDatabase,this.docTitle="Untitled"}async openUri(e,t){this._uri=e,this._isReadOnly=t&&t.readOnly||!1,this._fileName=this.getFileNameFromUri(e);let n=!0;try{await this._database.openUri(e,t),this.docTitle=this._fileName}catch{n=!1,$e.emit("failed-to-open-file",{fileName:e})}return n}async openDocument(e,t,n){var s;let i=!0;this._fileName=e;try{const a=(s=e.split(".").pop())==null?void 0:s.toLocaleLowerCase();await this._database.read(t,n,a=="dwg"?I.AcDbFileType.DWG:I.AcDbFileType.DXF),this.docTitle=this._fileName}catch(a){i=!1,$e.emit("failed-to-open-file",{fileName:e}),console.error(a)}return i}get uri(){return this._uri}get database(){return this._database}get docTitle(){return this._docTitle}set docTitle(e){this._docTitle=e,typeof document<"u"&&(document.title=e)}get isReadOnly(){return this._isReadOnly}getFileNameFromUri(e){try{const n=new URL(e).pathname.split("/");return n[n.length-1]||""}catch(t){return console.error("Invalid URI:",t),""}}}class qi{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const n of this.listeners)n.call(null,e,...t)}}class Ac{constructor(){this.cache=new Map}hasGeometry(e,t){const n=this.generateKey(e,t);return this.cache.has(n)}getGeometry(e,t){const n=this.generateKey(e,t);if(this.cache.has(n))return this.cache.get(n)}setGeometry(e,t,n){const i=this.generateKey(e,t);this.cache.set(i,n)}dispose(){for(const e of this.cache.values())e.dispose();this.cache.clear()}generateKey(e,t){return`${e}_${t}`}}class Xi{constructor(e){this.names=new Set,this.unsupportedChars={},this.encoding=e.encoding,e.alias.forEach(t=>this.names.add(t)),this.cache=new Ac}addUnsupportedChar(e){this.unsupportedChars[e]||(this.unsupportedChars[e]=0),this.unsupportedChars[e]++}}class Yi extends C.Shape{constructor(){super(...arguments),this.width=0}}const dr=(r,e)=>e.some(t=>r instanceof t);let Zi,Ki;function Ic(){return Zi||(Zi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Lc(){return Ki||(Ki=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const pr=new WeakMap,fr=new WeakMap,Cn=new WeakMap;function kc(r){const e=new Promise((t,n)=>{const i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",a)},s=()=>{t(ut(r.result)),i()},a=()=>{n(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",a)});return Cn.set(e,r),e}function Bc(r){if(pr.has(r))return;const e=new Promise((t,n)=>{const i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",a),r.removeEventListener("abort",a)},s=()=>{t(),i()},a=()=>{n(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",a),r.addEventListener("abort",a)});pr.set(r,e)}let gr={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return pr.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return ut(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Ji(r){gr=r(gr)}function Mc(r){return Lc().includes(r)?function(...e){return r.apply(mr(this),e),ut(this.request)}:function(...e){return ut(r.apply(mr(this),e))}}function Oc(r){return typeof r=="function"?Mc(r):(r instanceof IDBTransaction&&Bc(r),dr(r,Ic())?new Proxy(r,gr):r)}function ut(r){if(r instanceof IDBRequest)return kc(r);if(fr.has(r))return fr.get(r);const e=Oc(r);return e!==r&&(fr.set(r,e),Cn.set(e,r)),e}const mr=r=>Cn.get(r);function Pc(r,e,{blocked:t,upgrade:n,blocking:i,terminated:s}={}){const a=indexedDB.open(r,e),o=ut(a);return n&&a.addEventListener("upgradeneeded",c=>{n(ut(a.result),c.oldVersion,c.newVersion,ut(a.transaction),c)}),t&&a.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),o.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",h=>i(h.oldVersion,h.newVersion,h))}).catch(()=>{}),o}const Dc=["get","getKey","getAll","getAllKeys","count"],Rc=["put","add","delete","clear"],yr=new Map;function Qi(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yr.get(e))return yr.get(e);const t=e.replace(/FromIndex$/,""),n=e!==t,i=Rc.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(i||Dc.includes(t)))return;const s=async function(a,...o){const c=this.transaction(a,i?"readwrite":"readonly");let h=c.store;return n&&(h=h.index(o.shift())),(await Promise.all([h[t](...o),i&&c.done]))[0]};return yr.set(e,s),s}Ji(r=>({...r,get:(e,t,n)=>Qi(e,t)||r.get(e,t,n),has:(e,t)=>!!Qi(e,t)||r.has(e,t)}));const Uc=["continue","continuePrimaryKey","advance"],es={},br=new WeakMap,ts=new WeakMap,Fc={get(r,e){if(!Uc.includes(e))return r[e];let t=es[e];return t||(t=es[e]=function(...n){br.set(this,ts.get(this)[e](...n))}),t}};async function*Nc(...r){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...r)),!e)return;e=e;const t=new Proxy(e,Fc);for(ts.set(t,e),Cn.set(t,mr(e));e;)yield t,e=await(br.get(t)||e.continue()),br.delete(t)}function ns(r,e){return e===Symbol.asyncIterator&&dr(r,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&dr(r,[IDBIndex,IDBObjectStore])}Ji(r=>({...r,get(e,t,n){return ns(e,t)?Nc:r.get(e,t,n)},has(e,t){return ns(e,t)||r.has(e,t)}}));const dt={fonts:"fonts"},vr=[{version:1,stores:[{name:dt.fonts,keyPath:"name"}]},{version:2,stores:[{name:dt.fonts,keyPath:"name"}]}],xr=class We{constructor(){this.isClosing=!1,typeof window<"u"&&window.addEventListener("unload",()=>{this.close()})}static get instance(){return We._instance||(We._instance=new We),We._instance}async set(e,t){await(await this.getDatabase()).put(dt.fonts,{...t,name:e})}async get(e){return await(await this.getDatabase()).get(dt.fonts,e)}async delete(e){await(await this.getDatabase()).delete(dt.fonts,e)}async getAll(){return await(await this.getDatabase()).getAll(dt.fonts)}async clear(){await(await this.getDatabase()).clear(dt.fonts)}async has(e){return await this.get(e)!==void 0}close(){if(!this.isClosing){this.isClosing=!0;try{this.db&&(this.db.close(),this.db=void 0)}finally{this.isClosing=!1}}}async destroy(){this.close(),await indexedDB.deleteDatabase(We.DATABASE_NAME),We._instance=void 0}async getDatabase(){if(this.isClosing)throw new Error("Cannot perform operation while database is closing");return this.db?this.db:(this.db=await Pc(We.DATABASE_NAME,We.DATABASE_VERSION,{upgrade:(e,t,n)=>this.handleUpgrade(e,t,n),blocked(){console.warn("Database upgrade blocked - please close other tabs using the application")},blocking(){console.warn("Database blocking newer version - closing connection"),We.instance.close()}}),this.db)}handleUpgrade(e,t,n){const i=vr.filter(s=>s.version>t&&(!n||s.version<=n));for(const s of i)this.applySchemaVersion(e,s)}applySchemaVersion(e,t){for(const n of t.stores)e.objectStoreNames.contains(n.name)||e.createObjectStore(n.name,{keyPath:n.keyPath})}};xr.DATABASE_NAME="mlightcad",xr.DATABASE_VERSION=vr[vr.length-1].version;let wr=xr;const rs=r=>r.split("/").pop(),is=r=>{const e=rs(r);if(e){const t=e.lastIndexOf(".");return t===-1?e:e.substring(0,t)}return r},zc=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0],Gc=r=>zc[r];/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var r=function(){try{var t={},n=Object.defineProperty,i=n(t,t,t)&&n}catch{}return i}(),e=function(t){if(this==null)throw TypeError();var n=String(this),i=n.length,s=t?Number(t):0;if(s!=s&&(s=0),!(s<0||s>=i)){var a=n.charCodeAt(s),o;return a>=55296&&a<=56319&&i>s+1&&(o=n.charCodeAt(s+1),o>=56320&&o<=57343)?(a-55296)*1024+o-56320+65536:a}};r?r(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();var Sr=0,ss=-3;function jt(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function jc(r,e){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new jt,this.dtree=new jt}var as=new jt,os=new jt,_r=new Uint8Array(30),Cr=new Uint16Array(30),cs=new Uint8Array(30),hs=new Uint16Array(30),Vc=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ls=new jt,De=new Uint8Array(320);function us(r,e,t,n){var i,s;for(i=0;i<t;++i)r[i]=0;for(i=0;i<30-t;++i)r[i+t]=i/t|0;for(s=n,i=0;i<30;++i)e[i]=s,s+=1<<r[i]}function Hc(r,e){var t;for(t=0;t<7;++t)r.table[t]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,t=0;t<24;++t)r.trans[t]=256+t;for(t=0;t<144;++t)r.trans[24+t]=t;for(t=0;t<8;++t)r.trans[168+t]=280+t;for(t=0;t<112;++t)r.trans[176+t]=144+t;for(t=0;t<5;++t)e.table[t]=0;for(e.table[5]=32,t=0;t<32;++t)e.trans[t]=t}var ds=new Uint16Array(16);function Tr(r,e,t,n){var i,s;for(i=0;i<16;++i)r.table[i]=0;for(i=0;i<n;++i)r.table[e[t+i]]++;for(r.table[0]=0,s=0,i=0;i<16;++i)ds[i]=s,s+=r.table[i];for(i=0;i<n;++i)e[t+i]&&(r.trans[ds[e[t+i]]++]=i)}function Wc(r){r.bitcount--||(r.tag=r.source[r.sourceIndex++],r.bitcount=7);var e=r.tag&1;return r.tag>>>=1,e}function Re(r,e,t){if(!e)return t;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<<r.bitcount,r.bitcount+=8;var n=r.tag&65535>>>16-e;return r.tag>>>=e,r.bitcount-=e,n+t}function Er(r,e){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<<r.bitcount,r.bitcount+=8;var t=0,n=0,i=0,s=r.tag;do n=2*n+(s&1),s>>>=1,++i,t+=e.table[i],n-=e.table[i];while(n>=0);return r.tag=s,r.bitcount-=i,e.trans[t+n]}function $c(r,e,t){var n,i,s,a,o,c;for(n=Re(r,5,257),i=Re(r,5,1),s=Re(r,4,4),a=0;a<19;++a)De[a]=0;for(a=0;a<s;++a){var h=Re(r,3,0);De[Vc[a]]=h}for(Tr(ls,De,0,19),o=0;o<n+i;){var l=Er(r,ls);switch(l){case 16:var d=De[o-1];for(c=Re(r,2,3);c;--c)De[o++]=d;break;case 17:for(c=Re(r,3,3);c;--c)De[o++]=0;break;case 18:for(c=Re(r,7,11);c;--c)De[o++]=0;break;default:De[o++]=l;break}}Tr(e,De,0,n),Tr(t,De,n,i)}function ps(r,e,t){for(;;){var n=Er(r,e);if(n===256)return Sr;if(n<256)r.dest[r.destLen++]=n;else{var i,s,a,o;for(n-=257,i=Re(r,_r[n],Cr[n]),s=Er(r,t),a=r.destLen-Re(r,cs[s],hs[s]),o=a;o<a+i;++o)r.dest[r.destLen++]=r.dest[o]}}}function qc(r){for(var e,t,n;r.bitcount>8;)r.sourceIndex--,r.bitcount-=8;if(e=r.source[r.sourceIndex+1],e=256*e+r.source[r.sourceIndex],t=r.source[r.sourceIndex+3],t=256*t+r.source[r.sourceIndex+2],e!==(~t&65535))return ss;for(r.sourceIndex+=4,n=e;n;--n)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,Sr}function Xc(r,e){var t=new jc(r,e),n,i,s;do{switch(n=Wc(t),i=Re(t,2,0),i){case 0:s=qc(t);break;case 1:s=ps(t,as,os);break;case 2:$c(t,t.ltree,t.dtree),s=ps(t,t.ltree,t.dtree);break;default:s=ss}if(s!==Sr)throw new Error("Data error")}while(!n);return t.destLen<t.dest.length?typeof t.dest.slice=="function"?t.dest.slice(0,t.destLen):t.dest.subarray(0,t.destLen):t.dest}Hc(as,os),us(_r,Cr,4,3),us(cs,hs,2,1),_r[28]=0,Cr[28]=258;var Yc=Xc;function xt(r,e,t,n,i){return Math.pow(1-i,3)*r+3*Math.pow(1-i,2)*i*e+3*(1-i)*Math.pow(i,2)*t+Math.pow(i,3)*n}function et(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}et.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},et.prototype.addPoint=function(r,e){typeof r=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=r,this.x2=r),r<this.x1&&(this.x1=r),r>this.x2&&(this.x2=r)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},et.prototype.addX=function(r){this.addPoint(r,null)},et.prototype.addY=function(r){this.addPoint(null,r)},et.prototype.addBezier=function(r,e,t,n,i,s,a,o){var c=[r,e],h=[t,n],l=[i,s],d=[a,o];this.addPoint(r,e),this.addPoint(a,o);for(var u=0;u<=1;u++){var f=6*c[u]-12*h[u]+6*l[u],y=-3*c[u]+9*h[u]-9*l[u]+3*d[u],m=3*h[u]-3*c[u];if(y===0){if(f===0)continue;var x=-m/f;0<x&&x<1&&(u===0&&this.addX(xt(c[u],h[u],l[u],d[u],x)),u===1&&this.addY(xt(c[u],h[u],l[u],d[u],x)));continue}var v=Math.pow(f,2)-4*m*y;if(!(v<0)){var w=(-f+Math.sqrt(v))/(2*y);0<w&&w<1&&(u===0&&this.addX(xt(c[u],h[u],l[u],d[u],w)),u===1&&this.addY(xt(c[u],h[u],l[u],d[u],w)));var S=(-f-Math.sqrt(v))/(2*y);0<S&&S<1&&(u===0&&this.addX(xt(c[u],h[u],l[u],d[u],S)),u===1&&this.addY(xt(c[u],h[u],l[u],d[u],S)))}}},et.prototype.addQuad=function(r,e,t,n,i,s){var a=r+.6666666666666666*(t-r),o=e+2/3*(n-e),c=a+1/3*(i-r),h=o+1/3*(s-e);this.addBezier(r,e,a,o,c,h,i,s)};function ue(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}ue.prototype.moveTo=function(r,e){this.commands.push({type:"M",x:r,y:e})},ue.prototype.lineTo=function(r,e){this.commands.push({type:"L",x:r,y:e})},ue.prototype.curveTo=ue.prototype.bezierCurveTo=function(r,e,t,n,i,s){this.commands.push({type:"C",x1:r,y1:e,x2:t,y2:n,x:i,y:s})},ue.prototype.quadTo=ue.prototype.quadraticCurveTo=function(r,e,t,n){this.commands.push({type:"Q",x1:r,y1:e,x:t,y:n})},ue.prototype.close=ue.prototype.closePath=function(){this.commands.push({type:"Z"})},ue.prototype.extend=function(r){if(r.commands)r=r.commands;else if(r instanceof et){var e=r;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,r)},ue.prototype.getBoundingBox=function(){for(var r=new et,e=0,t=0,n=0,i=0,s=0;s<this.commands.length;s++){var a=this.commands[s];switch(a.type){case"M":r.addPoint(a.x,a.y),e=n=a.x,t=i=a.y;break;case"L":r.addPoint(a.x,a.y),n=a.x,i=a.y;break;case"Q":r.addQuad(n,i,a.x1,a.y1,a.x,a.y),n=a.x,i=a.y;break;case"C":r.addBezier(n,i,a.x1,a.y1,a.x2,a.y2,a.x,a.y),n=a.x,i=a.y;break;case"Z":n=e,i=t;break;default:throw new Error("Unexpected path command "+a.type)}}return r.isEmpty()&&r.addPoint(0,0),r},ue.prototype.draw=function(r){r.beginPath();for(var e=0;e<this.commands.length;e+=1){var t=this.commands[e];t.type==="M"?r.moveTo(t.x,t.y):t.type==="L"?r.lineTo(t.x,t.y):t.type==="C"?r.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y):t.type==="Q"?r.quadraticCurveTo(t.x1,t.y1,t.x,t.y):t.type==="Z"&&r.closePath()}this.fill&&(r.fillStyle=this.fill,r.fill()),this.stroke&&(r.strokeStyle=this.stroke,r.lineWidth=this.strokeWidth,r.stroke())},ue.prototype.toPathData=function(r){r=r!==void 0?r:2;function e(a){return Math.round(a)===a?""+Math.round(a):a.toFixed(r)}function t(){for(var a=arguments,o="",c=0;c<arguments.length;c+=1){var h=a[c];h>=0&&c>0&&(o+=" "),o+=e(h)}return o}for(var n="",i=0;i<this.commands.length;i+=1){var s=this.commands[i];s.type==="M"?n+="M"+t(s.x,s.y):s.type==="L"?n+="L"+t(s.x,s.y):s.type==="C"?n+="C"+t(s.x1,s.y1,s.x2,s.y2,s.x,s.y):s.type==="Q"?n+="Q"+t(s.x1,s.y1,s.x,s.y):s.type==="Z"&&(n+="Z")}return n},ue.prototype.toSVG=function(r){var e='<path d="';return e+=this.toPathData(r),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e},ue.prototype.toDOMElement=function(r){var e=this.toPathData(r),t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",e),t};function fs(r){throw new Error(r)}function gs(r,e){r||fs(e)}var z={fail:fs,argument:gs,assert:gs},ms=32768,ys=2147483648,wt={},D={},G={};function Le(r){return function(){return r}}D.BYTE=function(r){return z.argument(r>=0&&r<=255,"Byte value should be between 0 and 255."),[r]},G.BYTE=Le(1),D.CHAR=function(r){return[r.charCodeAt(0)]},G.CHAR=Le(1),D.CHARARRAY=function(r){typeof r>"u"&&(r="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],t=0;t<r.length;t+=1)e[t]=r.charCodeAt(t);return e},G.CHARARRAY=function(r){return typeof r>"u"?0:r.length},D.USHORT=function(r){return[r>>8&255,r&255]},G.USHORT=Le(2),D.SHORT=function(r){return r>=ms&&(r=-(2*ms-r)),[r>>8&255,r&255]},G.SHORT=Le(2),D.UINT24=function(r){return[r>>16&255,r>>8&255,r&255]},G.UINT24=Le(3),D.ULONG=function(r){return[r>>24&255,r>>16&255,r>>8&255,r&255]},G.ULONG=Le(4),D.LONG=function(r){return r>=ys&&(r=-(2*ys-r)),[r>>24&255,r>>16&255,r>>8&255,r&255]},G.LONG=Le(4),D.FIXED=D.ULONG,G.FIXED=G.ULONG,D.FWORD=D.SHORT,G.FWORD=G.SHORT,D.UFWORD=D.USHORT,G.UFWORD=G.USHORT,D.LONGDATETIME=function(r){return[0,0,0,0,r>>24&255,r>>16&255,r>>8&255,r&255]},G.LONGDATETIME=Le(8),D.TAG=function(r){return z.argument(r.length===4,"Tag should be exactly 4 ASCII characters."),[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3)]},G.TAG=Le(4),D.Card8=D.BYTE,G.Card8=G.BYTE,D.Card16=D.USHORT,G.Card16=G.USHORT,D.OffSize=D.BYTE,G.OffSize=G.BYTE,D.SID=D.USHORT,G.SID=G.USHORT,D.NUMBER=function(r){return r>=-107&&r<=107?[r+139]:r>=108&&r<=1131?(r=r-108,[(r>>8)+247,r&255]):r>=-1131&&r<=-108?(r=-r-108,[(r>>8)+251,r&255]):r>=-32768&&r<=32767?D.NUMBER16(r):D.NUMBER32(r)},G.NUMBER=function(r){return D.NUMBER(r).length},D.NUMBER16=function(r){return[28,r>>8&255,r&255]},G.NUMBER16=Le(3),D.NUMBER32=function(r){return[29,r>>24&255,r>>16&255,r>>8&255,r&255]},G.NUMBER32=Le(5),D.REAL=function(r){var e=r.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){var n=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(r*n)/n).toString()}for(var i="",s=0,a=e.length;s<a;s+=1){var o=e[s];o==="e"?i+=e[++s]==="-"?"c":"b":o==="."?i+="a":o==="-"?i+="e":i+=o}i+=i.length&1?"f":"ff";for(var c=[30],h=0,l=i.length;h<l;h+=2)c.push(parseInt(i.substr(h,2),16));return c},G.REAL=function(r){return D.REAL(r).length},D.NAME=D.CHARARRAY,G.NAME=G.CHARARRAY,D.STRING=D.CHARARRAY,G.STRING=G.CHARARRAY,wt.UTF8=function(r,e,t){for(var n=[],i=t,s=0;s<i;s++,e+=1)n[s]=r.getUint8(e);return String.fromCharCode.apply(null,n)},wt.UTF16=function(r,e,t){for(var n=[],i=t/2,s=0;s<i;s++,e+=2)n[s]=r.getUint16(e);return String.fromCharCode.apply(null,n)},D.UTF16=function(r){for(var e=[],t=0;t<r.length;t+=1){var n=r.charCodeAt(t);e[e.length]=n>>8&255,e[e.length]=n&255}return e},G.UTF16=function(r){return r.length*2};var Ar={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};wt.MACSTRING=function(r,e,t,n){var i=Ar[n];if(i!==void 0){for(var s="",a=0;a<t;a++){var o=r.getUint8(e+a);o<=127?s+=String.fromCharCode(o):s+=i[o&127]}return s}};var Tn=typeof WeakMap=="function"&&new WeakMap,En,Zc=function(r){if(!En){En={};for(var e in Ar)En[e]=new String(e)}var t=En[r];if(t!==void 0){if(Tn){var n=Tn.get(t);if(n!==void 0)return n}var i=Ar[r];if(i!==void 0){for(var s={},a=0;a<i.length;a++)s[i.charCodeAt(a)]=a+128;return Tn&&Tn.set(t,s),s}}};D.MACSTRING=function(r,e){var t=Zc(e);if(t!==void 0){for(var n=[],i=0;i<r.length;i++){var s=r.charCodeAt(i);if(s>=128&&(s=t[s],s===void 0))return;n[i]=s}return n}},G.MACSTRING=function(r,e){var t=D.MACSTRING(r,e);return t!==void 0?t.length:0};function Ir(r){return r>=-128&&r<=127}function Kc(r,e,t){for(var n=0,i=r.length;e<i&&n<64&&r[e]===0;)++e,++n;return t.push(128|n-1),e}function Jc(r,e,t){for(var n=0,i=r.length,s=e;s<i&&n<64;){var a=r[s];if(!Ir(a)||a===0&&s+1<i&&r[s+1]===0)break;++s,++n}t.push(n-1);for(var o=e;o<s;++o)t.push(r[o]+256&255);return s}function Qc(r,e,t){for(var n=0,i=r.length,s=e;s<i&&n<64;){var a=r[s];if(a===0||Ir(a)&&s+1<i&&Ir(r[s+1]))break;++s,++n}t.push(64|n-1);for(var o=e;o<s;++o){var c=r[o];t.push(c+65536>>8&255,c+256&255)}return s}D.VARDELTAS=function(r){for(var e=0,t=[];e<r.length;){var n=r[e];n===0?e=Kc(r,e,t):n>=-128&&n<=127?e=Jc(r,e,t):e=Qc(r,e,t)}return t},D.INDEX=function(r){for(var e=1,t=[e],n=[],i=0;i<r.length;i+=1){var s=D.OBJECT(r[i]);Array.prototype.push.apply(n,s),e+=s.length,t.push(e)}if(n.length===0)return[0,0];for(var a=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,c=[void 0,D.BYTE,D.USHORT,D.UINT24,D.ULONG][o],h=0;h<t.length;h+=1){var l=c(t[h]);Array.prototype.push.apply(a,l)}return Array.prototype.concat(D.Card16(r.length),D.OffSize(o),a,n)},G.INDEX=function(r){return D.INDEX(r).length},D.DICT=function(r){for(var e=[],t=Object.keys(r),n=t.length,i=0;i<n;i+=1){var s=parseInt(t[i],0),a=r[s];e=e.concat(D.OPERAND(a.value,a.type)),e=e.concat(D.OPERATOR(s))}return e},G.DICT=function(r){return D.DICT(r).length},D.OPERATOR=function(r){return r<1200?[r]:[12,r-1200]},D.OPERAND=function(r,e){var t=[];if(Array.isArray(e))for(var n=0;n<e.length;n+=1)z.argument(r.length===e.length,"Not enough arguments given for type"+e),t=t.concat(D.OPERAND(r[n],e[n]));else if(e==="SID")t=t.concat(D.NUMBER(r));else if(e==="offset")t=t.concat(D.NUMBER32(r));else if(e==="number")t=t.concat(D.NUMBER(r));else if(e==="real")t=t.concat(D.REAL(r));else throw new Error("Unknown operand type "+e);return t},D.OP=D.BYTE,G.OP=G.BYTE;var An=typeof WeakMap=="function"&&new WeakMap;D.CHARSTRING=function(r){if(An){var e=An.get(r);if(e!==void 0)return e}for(var t=[],n=r.length,i=0;i<n;i+=1){var s=r[i];t=t.concat(D[s.type](s.value))}return An&&An.set(r,t),t},G.CHARSTRING=function(r){return D.CHARSTRING(r).length},D.OBJECT=function(r){var e=D[r.type];return z.argument(e!==void 0,"No encoding function for type "+r.type),e(r.value)},G.OBJECT=function(r){var e=G[r.type];return z.argument(e!==void 0,"No sizeOf function for type "+r.type),e(r.value)},D.TABLE=function(r){for(var e=[],t=r.fields.length,n=[],i=[],s=0;s<t;s+=1){var a=r.fields[s],o=D[a.type];z.argument(o!==void 0,"No encoding function for field type "+a.type+" ("+a.name+")");var c=r[a.name];c===void 0&&(c=a.value);var h=o(c);a.type==="TABLE"?(i.push(e.length),e=e.concat([0,0]),n.push(h)):e=e.concat(h)}for(var l=0;l<n.length;l+=1){var d=i[l],u=e.length;z.argument(u<65536,"Table "+r.tableName+" too big."),e[d]=u>>8,e[d+1]=u&255,e=e.concat(n[l])}return e},G.TABLE=function(r){for(var e=0,t=r.fields.length,n=0;n<t;n+=1){var i=r.fields[n],s=G[i.type];z.argument(s!==void 0,"No sizeOf function for field type "+i.type+" ("+i.name+")");var a=r[i.name];a===void 0&&(a=i.value),e+=s(a),i.type==="TABLE"&&(e+=2)}return e},D.RECORD=D.TABLE,G.RECORD=G.TABLE,D.LITERAL=function(r){return r},G.LITERAL=function(r){return r.length};function de(r,e,t){if(e.length&&(e[0].name!=="coverageFormat"||e[0].value===1))for(var n=0;n<e.length;n+=1){var i=e[n];this[i.name]=i.value}if(this.tableName=r,this.fields=e,t)for(var s=Object.keys(t),a=0;a<s.length;a+=1){var o=s[a],c=t[o];this[o]!==void 0&&(this[o]=c)}}de.prototype.encode=function(){return D.TABLE(this)},de.prototype.sizeOf=function(){return G.TABLE(this)};function Vt(r,e,t){t===void 0&&(t=e.length);var n=new Array(e.length+1);n[0]={name:r+"Count",type:"USHORT",value:t};for(var i=0;i<e.length;i++)n[i+1]={name:r+i,type:"USHORT",value:e[i]};return n}function Lr(r,e,t){var n=e.length,i=new Array(n+1);i[0]={name:r+"Count",type:"USHORT",value:n};for(var s=0;s<n;s++)i[s+1]={name:r+s,type:"TABLE",value:t(e[s],s)};return i}function Ht(r,e,t){var n=e.length,i=[];i[0]={name:r+"Count",type:"USHORT",value:n};for(var s=0;s<n;s++)i=i.concat(t(e[s],s));return i}function In(r){r.format===1?de.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Vt("glyph",r.glyphs))):r.format===2?de.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Ht("rangeRecord",r.ranges,function(e){return[{name:"startGlyphID",type:"USHORT",value:e.start},{name:"endGlyphID",type:"USHORT",value:e.end},{name:"startCoverageIndex",type:"USHORT",value:e.index}]}))):z.assert(!1,"Coverage format must be 1 or 2.")}In.prototype=Object.create(de.prototype),In.prototype.constructor=In;function Ln(r){de.call(this,"scriptListTable",Ht("scriptRecord",r,function(e,t){var n=e.script,i=n.defaultLangSys;return z.assert(!!i,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new de("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new de("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:i.reqFeatureIndex}].concat(Vt("featureIndex",i.featureIndexes)))}].concat(Ht("langSys",n.langSysRecords,function(s,a){var o=s.langSys;return[{name:"langSysTag"+a,type:"TAG",value:s.tag},{name:"langSys"+a,type:"TABLE",value:new de("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:o.reqFeatureIndex}].concat(Vt("featureIndex",o.featureIndexes)))}]})))}]}))}Ln.prototype=Object.create(de.prototype),Ln.prototype.constructor=Ln;function kn(r){de.call(this,"featureListTable",Ht("featureRecord",r,function(e,t){var n=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new de("featureTable",[{name:"featureParams",type:"USHORT",value:n.featureParams}].concat(Vt("lookupListIndex",n.lookupListIndexes)))}]}))}kn.prototype=Object.create(de.prototype),kn.prototype.constructor=kn;function Bn(r,e){de.call(this,"lookupListTable",Lr("lookup",r,function(t){var n=e[t.lookupType];return z.assert(!!n,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new de("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(Lr("subtable",t.subtables,n)))}))}Bn.prototype=Object.create(de.prototype),Bn.prototype.constructor=Bn;var R={Table:de,Record:de,Coverage:In,ScriptList:Ln,FeatureList:kn,LookupList:Bn,ushortList:Vt,tableList:Lr,recordList:Ht};function bs(r,e){return r.getUint8(e)}function Mn(r,e){return r.getUint16(e,!1)}function eh(r,e){return r.getInt16(e,!1)}function kr(r,e){return r.getUint32(e,!1)}function vs(r,e){var t=r.getInt16(e,!1),n=r.getUint16(e+2,!1);return t+n/65535}function th(r,e){for(var t="",n=e;n<e+4;n+=1)t+=String.fromCharCode(r.getInt8(n));return t}function nh(r,e,t){for(var n=0,i=0;i<t;i+=1)n<<=8,n+=r.getUint8(e+i);return n}function rh(r,e,t){for(var n=[],i=e;i<t;i+=1)n.push(r.getUint8(i));return n}function ih(r){for(var e="",t=0;t<r.length;t+=1)e+=String.fromCharCode(r[t]);return e}var sh={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function L(r,e){this.data=r,this.offset=e,this.relativeOffset=0}L.prototype.parseByte=function(){var r=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,r},L.prototype.parseChar=function(){var r=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,r},L.prototype.parseCard8=L.prototype.parseByte,L.prototype.parseUShort=function(){var r=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,r},L.prototype.parseCard16=L.prototype.parseUShort,L.prototype.parseSID=L.prototype.parseUShort,L.prototype.parseOffset16=L.prototype.parseUShort,L.prototype.parseShort=function(){var r=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,r},L.prototype.parseF2Dot14=function(){var r=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,r},L.prototype.parseULong=function(){var r=kr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,r},L.prototype.parseOffset32=L.prototype.parseULong,L.prototype.parseFixed=function(){var r=vs(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,r},L.prototype.parseString=function(r){var e=this.data,t=this.offset+this.relativeOffset,n="";this.relativeOffset+=r;for(var i=0;i<r;i++)n+=String.fromCharCode(e.getUint8(t+i));return n},L.prototype.parseTag=function(){return this.parseString(4)},L.prototype.parseLongDateTime=function(){var r=kr(this.data,this.offset+this.relativeOffset+4);return r-=2082844800,this.relativeOffset+=8,r},L.prototype.parseVersion=function(r){var e=Mn(this.data,this.offset+this.relativeOffset),t=Mn(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,r===void 0&&(r=4096),e+t/r/10},L.prototype.skip=function(r,e){e===void 0&&(e=1),this.relativeOffset+=sh[r]*e},L.prototype.parseULongList=function(r){r===void 0&&(r=this.parseULong());for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getUint32(n),n+=4;return this.relativeOffset+=r*4,e},L.prototype.parseOffset16List=L.prototype.parseUShortList=function(r){r===void 0&&(r=this.parseUShort());for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getUint16(n),n+=2;return this.relativeOffset+=r*2,e},L.prototype.parseShortList=function(r){for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getInt16(n),n+=2;return this.relativeOffset+=r*2,e},L.prototype.parseByteList=function(r){for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getUint8(n++);return this.relativeOffset+=r,e},L.prototype.parseList=function(r,e){e||(e=r,r=this.parseUShort());for(var t=new Array(r),n=0;n<r;n++)t[n]=e.call(this);return t},L.prototype.parseList32=function(r,e){e||(e=r,r=this.parseULong());for(var t=new Array(r),n=0;n<r;n++)t[n]=e.call(this);return t},L.prototype.parseRecordList=function(r,e){e||(e=r,r=this.parseUShort());for(var t=new Array(r),n=Object.keys(e),i=0;i<r;i++){for(var s={},a=0;a<n.length;a++){var o=n[a],c=e[o];s[o]=c.call(this)}t[i]=s}return t},L.prototype.parseRecordList32=function(r,e){e||(e=r,r=this.parseULong());for(var t=new Array(r),n=Object.keys(e),i=0;i<r;i++){for(var s={},a=0;a<n.length;a++){var o=n[a],c=e[o];s[o]=c.call(this)}t[i]=s}return t},L.prototype.parseStruct=function(r){if(typeof r=="function")return r.call(this);for(var e=Object.keys(r),t={},n=0;n<e.length;n++){var i=e[n],s=r[i];t[i]=s.call(this)}return t},L.prototype.parseValueRecord=function(r){if(r===void 0&&(r=this.parseUShort()),r!==0){var e={};return r&1&&(e.xPlacement=this.parseShort()),r&2&&(e.yPlacement=this.parseShort()),r&4&&(e.xAdvance=this.parseShort()),r&8&&(e.yAdvance=this.parseShort()),r&16&&(e.xPlaDevice=void 0,this.parseShort()),r&32&&(e.yPlaDevice=void 0,this.parseShort()),r&64&&(e.xAdvDevice=void 0,this.parseShort()),r&128&&(e.yAdvDevice=void 0,this.parseShort()),e}},L.prototype.parseValueRecordList=function(){for(var r=this.parseUShort(),e=this.parseUShort(),t=new Array(e),n=0;n<e;n++)t[n]=this.parseValueRecord(r);return t},L.prototype.parsePointer=function(r){var e=this.parseOffset16();if(e>0)return new L(this.data,this.offset+e).parseStruct(r)},L.prototype.parsePointer32=function(r){var e=this.parseOffset32();if(e>0)return new L(this.data,this.offset+e).parseStruct(r)},L.prototype.parseListOfLists=function(r){for(var e=this.parseOffset16List(),t=e.length,n=this.relativeOffset,i=new Array(t),s=0;s<t;s++){var a=e[s];if(a===0){i[s]=void 0;continue}if(this.relativeOffset=a,r){for(var o=this.parseOffset16List(),c=new Array(o.length),h=0;h<o.length;h++)this.relativeOffset=a+o[h],c[h]=r.call(this);i[s]=c}else i[s]=this.parseUShortList()}return this.relativeOffset=n,i},L.prototype.parseCoverage=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort(),t=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(t)};if(e===2){for(var n=new Array(t),i=0;i<t;i++)n[i]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:n}}throw new Error("0x"+r.toString(16)+": Coverage format must be 1 or 2.")},L.prototype.parseClassDef=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:L.uShort,end:L.uShort,classId:L.uShort})};throw new Error("0x"+r.toString(16)+": ClassDef format must be 1 or 2.")},L.list=function(r,e){return function(){return this.parseList(r,e)}},L.list32=function(r,e){return function(){return this.parseList32(r,e)}},L.recordList=function(r,e){return function(){return this.parseRecordList(r,e)}},L.recordList32=function(r,e){return function(){return this.parseRecordList32(r,e)}},L.pointer=function(r){return function(){return this.parsePointer(r)}},L.pointer32=function(r){return function(){return this.parsePointer32(r)}},L.tag=L.prototype.parseTag,L.byte=L.prototype.parseByte,L.uShort=L.offset16=L.prototype.parseUShort,L.uShortList=L.prototype.parseUShortList,L.uLong=L.offset32=L.prototype.parseULong,L.uLongList=L.prototype.parseULongList,L.struct=L.prototype.parseStruct,L.coverage=L.prototype.parseCoverage,L.classDef=L.prototype.parseClassDef;var xs={reserved:L.uShort,reqFeatureIndex:L.uShort,featureIndexes:L.uShortList};L.prototype.parseScriptList=function(){return this.parsePointer(L.recordList({tag:L.tag,script:L.pointer({defaultLangSys:L.pointer(xs),langSysRecords:L.recordList({tag:L.tag,langSys:L.pointer(xs)})})}))||[]},L.prototype.parseFeatureList=function(){return this.parsePointer(L.recordList({tag:L.tag,feature:L.pointer({featureParams:L.offset16,lookupListIndexes:L.uShortList})}))||[]},L.prototype.parseLookupList=function(r){return this.parsePointer(L.list(L.pointer(function(){var e=this.parseUShort();z.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");var t=this.parseUShort(),n=t&16;return{lookupType:e,lookupFlag:t,subtables:this.parseList(L.pointer(r[e])),markFilteringSet:n?this.parseUShort():void 0}})))||[]},L.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var r=this.parseUShort(),e=this.parseUShort();z.argument(r===1&&e<1,"GPOS/GSUB feature variations table unknown.");var t=this.parseRecordList32({conditionSetOffset:L.offset32,featureTableSubstitutionOffset:L.offset32});return t})||[]};var F={getByte:bs,getCard8:bs,getUShort:Mn,getCard16:Mn,getShort:eh,getULong:kr,getFixed:vs,getTag:th,getOffset:nh,getBytes:rh,bytesToString:ih,Parser:L};function ah(r,e){e.parseUShort(),r.length=e.parseULong(),r.language=e.parseULong();var t;r.groupCount=t=e.parseULong(),r.glyphIndexMap={};for(var n=0;n<t;n+=1)for(var i=e.parseULong(),s=e.parseULong(),a=e.parseULong(),o=i;o<=s;o+=1)r.glyphIndexMap[o]=a,a++}function oh(r,e,t,n,i){r.length=e.parseUShort(),r.language=e.parseUShort();var s;r.segCount=s=e.parseUShort()>>1,e.skip("uShort",3),r.glyphIndexMap={};for(var a=new F.Parser(t,n+i+14),o=new F.Parser(t,n+i+16+s*2),c=new F.Parser(t,n+i+16+s*4),h=new F.Parser(t,n+i+16+s*6),l=n+i+16+s*8,d=0;d<s-1;d+=1)for(var u=void 0,f=a.parseUShort(),y=o.parseUShort(),m=c.parseShort(),x=h.parseUShort(),v=y;v<=f;v+=1)x!==0?(l=h.offset+h.relativeOffset-2,l+=x,l+=(v-y)*2,u=F.getUShort(t,l),u!==0&&(u=u+m&65535)):u=v+m&65535,r.glyphIndexMap[v]=u}function ch(r,e){var t={};t.version=F.getUShort(r,e),z.argument(t.version===0,"cmap table version should be 0."),t.numTables=F.getUShort(r,e+2);for(var n=-1,i=t.numTables-1;i>=0;i-=1){var s=F.getUShort(r,e+4+i*8),a=F.getUShort(r,e+4+i*8+2);if(s===3&&(a===0||a===1||a===10)||s===0&&(a===0||a===1||a===2||a===3||a===4)){n=F.getULong(r,e+4+i*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");var o=new F.Parser(r,e+n);if(t.format=o.parseUShort(),t.format===12)ah(t,o);else if(t.format===4)oh(t,o,r,e,n);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function hh(r,e,t){r.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function lh(r){r.segments.push({end:65535,start:65535,delta:1,offset:0})}function uh(r){var e=!0,t;for(t=r.length-1;t>0;t-=1){var n=r.get(t);if(n.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var i=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(i=i.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),i=i.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var s=new R.Table("cmap",i);for(s.segments=[],t=0;t<r.length;t+=1){for(var a=r.get(t),o=0;o<a.unicodes.length;o+=1)hh(s,a.unicodes[o],t);s.segments=s.segments.sort(function(w,S){return w.start-S.start})}lh(s);var c=s.segments.length,h=0,l=[],d=[],u=[],f=[],y=[],m=[];for(t=0;t<c;t+=1){var x=s.segments[t];x.end<=65535&&x.start<=65535?(l=l.concat({name:"end_"+t,type:"USHORT",value:x.end}),d=d.concat({name:"start_"+t,type:"USHORT",value:x.start}),u=u.concat({name:"idDelta_"+t,type:"SHORT",value:x.delta}),f=f.concat({name:"idRangeOffset_"+t,type:"USHORT",value:x.offset}),x.glyphId!==void 0&&(y=y.concat({name:"glyph_"+t,type:"USHORT",value:x.glyphId}))):h+=1,!e&&x.glyphIndex!==void 0&&(m=m.concat({name:"cmap12Start_"+t,type:"ULONG",value:x.start}),m=m.concat({name:"cmap12End_"+t,type:"ULONG",value:x.end}),m=m.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:x.glyphIndex}))}if(s.segCountX2=(c-h)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(c-h)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(l),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(d),s.fields=s.fields.concat(u),s.fields=s.fields.concat(f),s.fields=s.fields.concat(y),s.cmap4Length=14+l.length*2+2+d.length*2+u.length*2+f.length*2+y.length*2,!e){var v=16+m.length*4;s.cmap12Offset=12+2*2+4+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:v},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:m.length/3}]),s.fields=s.fields.concat(m)}return s}var ws={parse:ch,make:uh},On=[".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","266 ff","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"],dh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],ph=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],pt=[".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 Ss(r){this.font=r}Ss.prototype.charToGlyphIndex=function(r){var e=r.codePointAt(0),t=this.font.glyphs;if(t){for(var n=0;n<t.length;n+=1)for(var i=t.get(n),s=0;s<i.unicodes.length;s+=1)if(i.unicodes[s]===e)return n}return null};function _s(r){this.cmap=r}_s.prototype.charToGlyphIndex=function(r){return this.cmap.glyphIndexMap[r.codePointAt(0)]||0};function Pn(r,e){this.encoding=r,this.charset=e}Pn.prototype.charToGlyphIndex=function(r){var e=r.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function Br(r){switch(r.version){case 1:this.names=pt.slice();break;case 2:this.names=new Array(r.numberOfGlyphs);for(var e=0;e<r.numberOfGlyphs;e++)r.glyphNameIndex[e]<pt.length?this.names[e]=pt[r.glyphNameIndex[e]]:this.names[e]=r.names[r.glyphNameIndex[e]-pt.length];break;case 2.5:this.names=new Array(r.numberOfGlyphs);for(var t=0;t<r.numberOfGlyphs;t++)this.names[t]=pt[t+r.glyphNameIndex[t]];break;case 3:this.names=[];break;default:this.names=[];break}}Br.prototype.nameToGlyphIndex=function(r){return this.names.indexOf(r)},Br.prototype.glyphIndexToName=function(r){return this.names[r]};function fh(r){for(var e,t=r.tables.cmap.glyphIndexMap,n=Object.keys(t),i=0;i<n.length;i+=1){var s=n[i],a=t[s];e=r.glyphs.get(a),e.addUnicode(parseInt(s))}for(var o=0;o<r.glyphs.length;o+=1)e=r.glyphs.get(o),r.cffEncoding?r.isCIDFont?e.name="gid"+o:e.name=r.cffEncoding.charset[o]:r.glyphNames.names&&(e.name=r.glyphNames.glyphIndexToName(o))}function gh(r){r._IndexToUnicodeMap={};for(var e=r.tables.cmap.glyphIndexMap,t=Object.keys(e),n=0;n<t.length;n+=1){var i=t[n],s=e[i];r._IndexToUnicodeMap[s]===void 0?r._IndexToUnicodeMap[s]={unicodes:[parseInt(i)]}:r._IndexToUnicodeMap[s].unicodes.push(parseInt(i))}}function mh(r,e){e.lowMemory?gh(r):fh(r)}function yh(r,e,t,n,i){r.beginPath(),r.moveTo(e,t),r.lineTo(n,i),r.stroke()}var ft={line:yh};function bh(r,e){var t=e||new ue;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(n){t=n}}}function Ce(r){this.bindConstructorValues(r)}Ce.prototype.bindConstructorValues=function(r){this.index=r.index||0,this.name=r.name||null,this.unicode=r.unicode||void 0,this.unicodes=r.unicodes||r.unicode!==void 0?[r.unicode]:[],"xMin"in r&&(this.xMin=r.xMin),"yMin"in r&&(this.yMin=r.yMin),"xMax"in r&&(this.xMax=r.xMax),"yMax"in r&&(this.yMax=r.yMax),"advanceWidth"in r&&(this.advanceWidth=r.advanceWidth),Object.defineProperty(this,"path",bh(this,r.path))},Ce.prototype.addUnicode=function(r){this.unicodes.length===0&&(this.unicode=r),this.unicodes.push(r)},Ce.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Ce.prototype.getPath=function(r,e,t,n,i){r=r!==void 0?r:0,e=e!==void 0?e:0,t=t!==void 0?t:72;var s,a;n||(n={});var o=n.xScale,c=n.yScale;if(n.hinting&&i&&i.hinting&&(a=this.path&&i.hinting.exec(this,t)),a)s=i.hinting.getCommands(a),r=Math.round(r),e=Math.round(e),o=c=1;else{s=this.path.commands;var h=1/(this.path.unitsPerEm||1e3)*t;o===void 0&&(o=h),c===void 0&&(c=h)}for(var l=new ue,d=0;d<s.length;d+=1){var u=s[d];u.type==="M"?l.moveTo(r+u.x*o,e+-u.y*c):u.type==="L"?l.lineTo(r+u.x*o,e+-u.y*c):u.type==="Q"?l.quadraticCurveTo(r+u.x1*o,e+-u.y1*c,r+u.x*o,e+-u.y*c):u.type==="C"?l.curveTo(r+u.x1*o,e+-u.y1*c,r+u.x2*o,e+-u.y2*c,r+u.x*o,e+-u.y*c):u.type==="Z"&&l.closePath()}return l},Ce.prototype.getContours=function(){if(this.points===void 0)return[];for(var r=[],e=[],t=0;t<this.points.length;t+=1){var n=this.points[t];e.push(n),n.lastPointOfContour&&(r.push(e),e=[])}return z.argument(e.length===0,"There are still points left in the current contour."),r},Ce.prototype.getMetrics=function(){for(var r=this.path.commands,e=[],t=[],n=0;n<r.length;n+=1){var i=r[n];i.type!=="Z"&&(e.push(i.x),t.push(i.y)),(i.type==="Q"||i.type==="C")&&(e.push(i.x1),t.push(i.y1)),i.type==="C"&&(e.push(i.x2),t.push(i.y2))}var s={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,t),leftSideBearing:this.leftSideBearing};return isFinite(s.xMin)||(s.xMin=0),isFinite(s.xMax)||(s.xMax=this.advanceWidth),isFinite(s.yMin)||(s.yMin=0),isFinite(s.yMax)||(s.yMax=0),s.rightSideBearing=this.advanceWidth-s.leftSideBearing-(s.xMax-s.xMin),s},Ce.prototype.draw=function(r,e,t,n,i){this.getPath(e,t,n,i).draw(r)},Ce.prototype.drawPoints=function(r,e,t,n){function i(d,u,f,y){r.beginPath();for(var m=0;m<d.length;m+=1)r.moveTo(u+d[m].x*y,f+d[m].y*y),r.arc(u+d[m].x*y,f+d[m].y*y,2,0,Math.PI*2,!1);r.closePath(),r.fill()}e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:24;for(var s=1/this.path.unitsPerEm*n,a=[],o=[],c=this.path,h=0;h<c.commands.length;h+=1){var l=c.commands[h];l.x!==void 0&&a.push({x:l.x,y:-l.y}),l.x1!==void 0&&o.push({x:l.x1,y:-l.y1}),l.x2!==void 0&&o.push({x:l.x2,y:-l.y2})}r.fillStyle="blue",i(a,e,t,s),r.fillStyle="red",i(o,e,t,s)},Ce.prototype.drawMetrics=function(r,e,t,n){var i;e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:24,i=1/this.path.unitsPerEm*n,r.lineWidth=1,r.strokeStyle="black",ft.line(r,e,-1e4,e,1e4),ft.line(r,-1e4,t,1e4,t);var s=this.xMin||0,a=this.yMin||0,o=this.xMax||0,c=this.yMax||0,h=this.advanceWidth||0;r.strokeStyle="blue",ft.line(r,e+s*i,-1e4,e+s*i,1e4),ft.line(r,e+o*i,-1e4,e+o*i,1e4),ft.line(r,-1e4,t+-a*i,1e4,t+-a*i),ft.line(r,-1e4,t+-c*i,1e4,t+-c*i),r.strokeStyle="green",ft.line(r,e+h*i,-1e4,e+h*i,1e4)};function Dn(r,e,t){Object.defineProperty(r,e,{get:function(){return r.path,r[t]},set:function(n){r[t]=n},enumerable:!0,configurable:!0})}function Mr(r,e){if(this.font=r,this.glyphs={},Array.isArray(e))for(var t=0;t<e.length;t++){var n=e[t];n.path.unitsPerEm=r.unitsPerEm,this.glyphs[t]=n}this.length=e&&e.length||0}Mr.prototype.get=function(r){if(this.glyphs[r]===void 0){this.font._push(r),typeof this.glyphs[r]=="function"&&(this.glyphs[r]=this.glyphs[r]());var e=this.glyphs[r],t=this.font._IndexToUnicodeMap[r];if(t)for(var n=0;n<t.unicodes.length;n++)e.addUnicode(t.unicodes[n]);this.font.cffEncoding?this.font.isCIDFont?e.name="gid"+r:e.name=this.font.cffEncoding.charset[r]:this.font.glyphNames.names&&(e.name=this.font.glyphNames.glyphIndexToName(r)),this.glyphs[r].advanceWidth=this.font._hmtxTableData[r].advanceWidth,this.glyphs[r].leftSideBearing=this.font._hmtxTableData[r].leftSideBearing}else typeof this.glyphs[r]=="function"&&(this.glyphs[r]=this.glyphs[r]());return this.glyphs[r]},Mr.prototype.push=function(r,e){this.glyphs[r]=e,this.length++};function vh(r,e){return new Ce({index:e,font:r})}function xh(r,e,t,n,i,s){return function(){var a=new Ce({index:e,font:r});return a.path=function(){t(a,n,i);var o=s(r.glyphs,a);return o.unitsPerEm=r.unitsPerEm,o},Dn(a,"xMin","_xMin"),Dn(a,"xMax","_xMax"),Dn(a,"yMin","_yMin"),Dn(a,"yMax","_yMax"),a}}function wh(r,e,t,n){return function(){var i=new Ce({index:e,font:r});return i.path=function(){var s=t(r,i,n);return s.unitsPerEm=r.unitsPerEm,s},i}}var Ue={GlyphSet:Mr,glyphLoader:vh,ttfGlyphLoader:xh,cffGlyphLoader:wh};function Cs(r,e){if(r===e)return!0;if(Array.isArray(r)&&Array.isArray(e)){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t+=1)if(!Cs(r[t],e[t]))return!1;return!0}else return!1}function Or(r){var e;return r.length<1240?e=107:r.length<33900?e=1131:e=32768,e}function tt(r,e,t){var n=[],i=[],s=F.getCard16(r,e),a,o;if(s!==0){var c=F.getByte(r,e+2);a=e+(s+1)*c+2;for(var h=e+3,l=0;l<s+1;l+=1)n.push(F.getOffset(r,h,c)),h+=c;o=a+n[s]}else o=e+2;for(var d=0;d<n.length-1;d+=1){var u=F.getBytes(r,a+n[d],a+n[d+1]);t&&(u=t(u)),i.push(u)}return{objects:i,startOffset:e,endOffset:o}}function Sh(r,e){var t=[],n=F.getCard16(r,e),i,s;if(n!==0){var a=F.getByte(r,e+2);i=e+(n+1)*a+2;for(var o=e+3,c=0;c<n+1;c+=1)t.push(F.getOffset(r,o,a)),o+=a;s=i+t[n]}else s=e+2;return{offsets:t,startOffset:e,endOffset:s}}function _h(r,e,t,n,i){var s=F.getCard16(t,n),a=0;if(s!==0){var o=F.getByte(t,n+2);a=n+(s+1)*o+2}var c=F.getBytes(t,a+e[r],a+e[r+1]);return c}function Ch(r){for(var e="",t=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var i=r.parseByte(),s=i>>4,a=i&15;if(s===t||(e+=n[s],a===t))break;e+=n[a]}return parseFloat(e)}function Th(r,e){var t,n,i,s;if(e===28)return t=r.parseByte(),n=r.parseByte(),t<<8|n;if(e===29)return t=r.parseByte(),n=r.parseByte(),i=r.parseByte(),s=r.parseByte(),t<<24|n<<16|i<<8|s;if(e===30)return Ch(r);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=r.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=r.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function Eh(r){for(var e={},t=0;t<r.length;t+=1){var n=r[t][0],i=r[t][1],s=void 0;if(i.length===1?s=i[0]:s=i,e.hasOwnProperty(n)&&!isNaN(e[n]))throw new Error("Object "+e+" already has key "+n);e[n]=s}return e}function Ts(r,e,t){e=e!==void 0?e:0;var n=new F.Parser(r,e),i=[],s=[];for(t=t!==void 0?t:r.length;n.relativeOffset<t;){var a=n.parseByte();a<=21?(a===12&&(a=1200+n.parseByte()),i.push([a,s]),s=[]):s.push(Th(n,a))}return Eh(i)}function Wt(r,e){return e<=390?e=On[e]:e=r[e-391],e}function Es(r,e,t){for(var n={},i,s=0;s<e.length;s+=1){var a=e[s];if(Array.isArray(a.type)){var o=[];o.length=a.type.length;for(var c=0;c<a.type.length;c++)i=r[a.op]!==void 0?r[a.op][c]:void 0,i===void 0&&(i=a.value!==void 0&&a.value[c]!==void 0?a.value[c]:null),a.type[c]==="SID"&&(i=Wt(t,i)),o[c]=i;n[a.name]=o}else i=r[a.op],i===void 0&&(i=a.value!==void 0?a.value:null),a.type==="SID"&&(i=Wt(t,i)),n[a.name]=i}return n}function Ah(r,e){var t={};return t.formatMajor=F.getCard8(r,e),t.formatMinor=F.getCard8(r,e+1),t.size=F.getCard8(r,e+2),t.offsetSize=F.getCard8(r,e+3),t.startOffset=e,t.endOffset=e+4,t}var As=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],Is=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function Ih(r,e){var t=Ts(r,0,r.byteLength);return Es(t,As,e)}function Ls(r,e,t,n){var i=Ts(r,e,t);return Es(i,Is,n)}function ks(r,e,t,n){for(var i=[],s=0;s<t.length;s+=1){var a=new DataView(new Uint8Array(t[s]).buffer),o=Ih(a,n);o._subrs=[],o._subrsBias=0,o._defaultWidthX=0,o._nominalWidthX=0;var c=o.private[0],h=o.private[1];if(c!==0&&h!==0){var l=Ls(r,h+e,c,n);if(o._defaultWidthX=l.defaultWidthX,o._nominalWidthX=l.nominalWidthX,l.subrs!==0){var d=h+l.subrs,u=tt(r,d+e);o._subrs=u.objects,o._subrsBias=Or(o._subrs)}o._privateDict=l}i.push(o)}return i}function Lh(r,e,t,n){var i,s,a=new F.Parser(r,e);t-=1;var o=[".notdef"],c=a.parseCard8();if(c===0)for(var h=0;h<t;h+=1)i=a.parseSID(),o.push(Wt(n,i));else if(c===1)for(;o.length<=t;){i=a.parseSID(),s=a.parseCard8();for(var l=0;l<=s;l+=1)o.push(Wt(n,i)),i+=1}else if(c===2)for(;o.length<=t;){i=a.parseSID(),s=a.parseCard16();for(var d=0;d<=s;d+=1)o.push(Wt(n,i)),i+=1}else throw new Error("Unknown charset format "+c);return o}function kh(r,e,t){var n,i={},s=new F.Parser(r,e),a=s.parseCard8();if(a===0)for(var o=s.parseCard8(),c=0;c<o;c+=1)n=s.parseCard8(),i[n]=c;else if(a===1){var h=s.parseCard8();n=1;for(var l=0;l<h;l+=1)for(var d=s.parseCard8(),u=s.parseCard8(),f=d;f<=d+u;f+=1)i[f]=n,n+=1}else throw new Error("Unknown encoding format "+a);return new Pn(i,t)}function Bs(r,e,t){var n,i,s,a,o=new ue,c=[],h=0,l=!1,d=!1,u=0,f=0,y,m,x,v;if(r.isCIDFont){var w=r.tables.cff.topDict._fdSelect[e.index],S=r.tables.cff.topDict._fdArray[w];y=S._subrs,m=S._subrsBias,x=S._defaultWidthX,v=S._nominalWidthX}else y=r.tables.cff.topDict._subrs,m=r.tables.cff.topDict._subrsBias,x=r.tables.cff.topDict._defaultWidthX,v=r.tables.cff.topDict._nominalWidthX;var _=x;function T(P,V){d&&o.closePath(),o.moveTo(P,V),d=!0}function B(){var P;P=c.length%2!==0,P&&!l&&(_=c.shift()+v),h+=c.length>>1,c.length=0,l=!0}function O(P){for(var V,H,J,pe,ae,$,X,Y,te,ce,re,he,j=0;j<P.length;){var W=P[j];switch(j+=1,W){case 1:B();break;case 3:B();break;case 4:c.length>1&&!l&&(_=c.shift()+v,l=!0),f+=c.pop(),T(u,f);break;case 5:for(;c.length>0;)u+=c.shift(),f+=c.shift(),o.lineTo(u,f);break;case 6:for(;c.length>0&&(u+=c.shift(),o.lineTo(u,f),c.length!==0);)f+=c.shift(),o.lineTo(u,f);break;case 7:for(;c.length>0&&(f+=c.shift(),o.lineTo(u,f),c.length!==0);)u+=c.shift(),o.lineTo(u,f);break;case 8:for(;c.length>0;)n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+c.shift(),o.curveTo(n,i,s,a,u,f);break;case 10:ae=c.pop()+m,$=y[ae],$&&O($);break;case 11:return;case 12:switch(W=P[j],j+=1,W){case 35:n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a+c.shift(),te=X+c.shift(),ce=Y+c.shift(),re=te+c.shift(),he=ce+c.shift(),u=re+c.shift(),f=he+c.shift(),c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;case 34:n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a,te=X+c.shift(),ce=a,re=te+c.shift(),he=f,u=re+c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;case 36:n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a,te=X+c.shift(),ce=a,re=te+c.shift(),he=ce+c.shift(),u=re+c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;case 37:n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a+c.shift(),te=X+c.shift(),ce=Y+c.shift(),re=te+c.shift(),he=ce+c.shift(),Math.abs(re-u)>Math.abs(he-f)?u=re+c.shift():f=he+c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+W),c.length=0}break;case 14:c.length>0&&!l&&(_=c.shift()+v,l=!0),d&&(o.closePath(),d=!1);break;case 18:B();break;case 19:case 20:B(),j+=h+7>>3;break;case 21:c.length>2&&!l&&(_=c.shift()+v,l=!0),f+=c.pop(),u+=c.pop(),T(u,f);break;case 22:c.length>1&&!l&&(_=c.shift()+v,l=!0),u+=c.pop(),T(u,f);break;case 23:B();break;case 24:for(;c.length>2;)n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+c.shift(),o.curveTo(n,i,s,a,u,f);u+=c.shift(),f+=c.shift(),o.lineTo(u,f);break;case 25:for(;c.length>6;)u+=c.shift(),f+=c.shift(),o.lineTo(u,f);n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+c.shift(),o.curveTo(n,i,s,a,u,f);break;case 26:for(c.length%2&&(u+=c.shift());c.length>0;)n=u,i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s,f=a+c.shift(),o.curveTo(n,i,s,a,u,f);break;case 27:for(c.length%2&&(f+=c.shift());c.length>0;)n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a,o.curveTo(n,i,s,a,u,f);break;case 28:V=P[j],H=P[j+1],c.push((V<<24|H<<16)>>16),j+=2;break;case 29:ae=c.pop()+r.gsubrsBias,$=r.gsubrs[ae],$&&O($);break;case 30:for(;c.length>0&&(n=u,i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f),c.length!==0);)n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),f=a+c.shift(),u=s+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f);break;case 31:for(;c.length>0&&(n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),f=a+c.shift(),u=s+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f),c.length!==0);)n=u,i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f);break;default:W<32?console.log("Glyph "+e.index+": unknown operator "+W):W<247?c.push(W-139):W<251?(V=P[j],j+=1,c.push((W-247)*256+V+108)):W<255?(V=P[j],j+=1,c.push(-(W-251)*256-V-108)):(V=P[j],H=P[j+1],J=P[j+2],pe=P[j+3],j+=4,c.push((V<<24|H<<16|J<<8|pe)/65536))}}}return O(t),e.advanceWidth=_,o}function Bh(r,e,t,n){var i=[],s,a=new F.Parser(r,e),o=a.parseCard8();if(o===0)for(var c=0;c<t;c++){if(s=a.parseCard8(),s>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+n+")");i.push(s)}else if(o===3){var h=a.parseCard16(),l=a.parseCard16();if(l!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+l);for(var d,u=0;u<h;u++){if(s=a.parseCard8(),d=a.parseCard16(),s>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+n+")");if(d>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+d);for(;l<d;l++)i.push(s);l=d}if(d!==t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+d)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+o);return i}function Mh(r,e,t,n){t.tables.cff={};var i=Ah(r,e),s=tt(r,i.endOffset,F.bytesToString),a=tt(r,s.endOffset),o=tt(r,a.endOffset,F.bytesToString),c=tt(r,o.endOffset);t.gsubrs=c.objects,t.gsubrsBias=Or(t.gsubrs);var h=ks(r,e,a.objects,o.objects);if(h.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+h.length);var l=h[0];if(t.tables.cff.topDict=l,l._privateDict&&(t.defaultWidthX=l._privateDict.defaultWidthX,t.nominalWidthX=l._privateDict.nominalWidthX),l.ros[0]!==void 0&&l.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){var d=l.fdArray,u=l.fdSelect;if(d===0||u===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");d+=e;var f=tt(r,d),y=ks(r,e,f.objects,o.objects);l._fdArray=y,u+=e,l._fdSelect=Bh(r,u,t.numGlyphs,y.length)}var m=e+l.private[1],x=Ls(r,m,l.private[0],o.objects);if(t.defaultWidthX=x.defaultWidthX,t.nominalWidthX=x.nominalWidthX,x.subrs!==0){var v=m+x.subrs,w=tt(r,v);t.subrs=w.objects,t.subrsBias=Or(t.subrs)}else t.subrs=[],t.subrsBias=0;var S;n.lowMemory?(S=Sh(r,e+l.charStrings),t.nGlyphs=S.offsets.length):(S=tt(r,e+l.charStrings),t.nGlyphs=S.objects.length);var _=Lh(r,e+l.charset,t.nGlyphs,o.objects);if(l.encoding===0?t.cffEncoding=new Pn(dh,_):l.encoding===1?t.cffEncoding=new Pn(ph,_):t.cffEncoding=kh(r,e+l.encoding,_),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new Ue.GlyphSet(t),n.lowMemory)t._push=function(O){var P=_h(O,S.offsets,r,e+l.charStrings);t.glyphs.push(O,Ue.cffGlyphLoader(t,O,Bs,P))};else for(var T=0;T<t.nGlyphs;T+=1){var B=S.objects[T];t.glyphs.push(T,Ue.cffGlyphLoader(t,T,Bs,B))}}function Ms(r,e){var t,n=On.indexOf(r);return n>=0&&(t=n),n=e.indexOf(r),n>=0?t=n+On.length:(t=On.length+e.length,e.push(r)),t}function Oh(){return new R.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ph(r){var e=new R.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var t=0;t<r.length;t+=1)e.names.push({name:"name_"+t,type:"NAME",value:r[t]});return e}function Os(r,e,t){for(var n={},i=0;i<r.length;i+=1){var s=r[i],a=e[s.name];a!==void 0&&!Cs(a,s.value)&&(s.type==="SID"&&(a=Ms(a,t)),n[s.op]={name:s.name,type:s.type,value:a})}return n}function Ps(r,e){var t=new R.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=Os(As,r,e),t}function Ds(r){var e=new R.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:r}],e}function Dh(r){var e=new R.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(var t=0;t<r.length;t+=1)e.strings.push({name:"string_"+t,type:"STRING",value:r[t]});return e}function Rh(){return new R.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Uh(r,e){for(var t=new R.Record("Charsets",[{name:"format",type:"Card8",value:0}]),n=0;n<r.length;n+=1){var i=r[n],s=Ms(i,e);t.fields.push({name:"glyph_"+n,type:"SID",value:s})}return t}function Fh(r){var e=[],t=r.path;e.push({name:"width",type:"NUMBER",value:r.advanceWidth});for(var n=0,i=0,s=0;s<t.commands.length;s+=1){var a=void 0,o=void 0,c=t.commands[s];if(c.type==="Q"){var h=.3333333333333333,l=2/3;c={type:"C",x:c.x,y:c.y,x1:Math.round(h*n+l*c.x1),y1:Math.round(h*i+l*c.y1),x2:Math.round(h*c.x+l*c.x1),y2:Math.round(h*c.y+l*c.y1)}}if(c.type==="M")a=Math.round(c.x-n),o=Math.round(c.y-i),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rmoveto",type:"OP",value:21}),n=Math.round(c.x),i=Math.round(c.y);else if(c.type==="L")a=Math.round(c.x-n),o=Math.round(c.y-i),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rlineto",type:"OP",value:5}),n=Math.round(c.x),i=Math.round(c.y);else if(c.type==="C"){var d=Math.round(c.x1-n),u=Math.round(c.y1-i),f=Math.round(c.x2-c.x1),y=Math.round(c.y2-c.y1);a=Math.round(c.x-c.x2),o=Math.round(c.y-c.y2),e.push({name:"dx1",type:"NUMBER",value:d}),e.push({name:"dy1",type:"NUMBER",value:u}),e.push({name:"dx2",type:"NUMBER",value:f}),e.push({name:"dy2",type:"NUMBER",value:y}),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rrcurveto",type:"OP",value:8}),n=Math.round(c.x),i=Math.round(c.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function Nh(r){for(var e=new R.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),t=0;t<r.length;t+=1){var n=r.get(t),i=Fh(n);e.charStrings.push({name:n.name,type:"CHARSTRING",value:i})}return e}function zh(r,e){var t=new R.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=Os(Is,r,e),t}function Gh(r,e){for(var t=new R.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),n=1/e.unitsPerEm,i={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[n,0,0,n,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},s={},a=[],o,c=1;c<r.length;c+=1)o=r.get(c),a.push(o.name);var h=[];t.header=Oh(),t.nameIndex=Ph([e.postScriptName]);var l=Ps(i,h);t.topDictIndex=Ds(l),t.globalSubrIndex=Rh(),t.charsets=Uh(a,h),t.charStringsIndex=Nh(r),t.privateDict=zh(s,h),t.stringIndex=Dh(h);var d=t.header.sizeOf()+t.nameIndex.sizeOf()+t.topDictIndex.sizeOf()+t.stringIndex.sizeOf()+t.globalSubrIndex.sizeOf();return i.charset=d,i.encoding=0,i.charStrings=i.charset+t.charsets.sizeOf(),i.private[1]=i.charStrings+t.charStringsIndex.sizeOf(),l=Ps(i,h),t.topDictIndex=Ds(l),t}var Rs={parse:Mh,make:Gh};function jh(r,e){var t={},n=new F.Parser(r,e);return t.version=n.parseVersion(),t.fontRevision=Math.round(n.parseFixed()*1e3)/1e3,t.checkSumAdjustment=n.parseULong(),t.magicNumber=n.parseULong(),z.argument(t.magicNumber===1594834165,"Font header has wrong magic number."),t.flags=n.parseUShort(),t.unitsPerEm=n.parseUShort(),t.created=n.parseLongDateTime(),t.modified=n.parseLongDateTime(),t.xMin=n.parseShort(),t.yMin=n.parseShort(),t.xMax=n.parseShort(),t.yMax=n.parseShort(),t.macStyle=n.parseUShort(),t.lowestRecPPEM=n.parseUShort(),t.fontDirectionHint=n.parseShort(),t.indexToLocFormat=n.parseShort(),t.glyphDataFormat=n.parseShort(),t}function Vh(r){var e=Math.round(new Date().getTime()/1e3)+2082844800,t=e;return r.createdTimestamp&&(t=r.createdTimestamp+2082844800),new R.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:t},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],r)}var Us={parse:jh,make:Vh};function Hh(r,e){var t={},n=new F.Parser(r,e);return t.version=n.parseVersion(),t.ascender=n.parseShort(),t.descender=n.parseShort(),t.lineGap=n.parseShort(),t.advanceWidthMax=n.parseUShort(),t.minLeftSideBearing=n.parseShort(),t.minRightSideBearing=n.parseShort(),t.xMaxExtent=n.parseShort(),t.caretSlopeRise=n.parseShort(),t.caretSlopeRun=n.parseShort(),t.caretOffset=n.parseShort(),n.relativeOffset+=8,t.metricDataFormat=n.parseShort(),t.numberOfHMetrics=n.parseUShort(),t}function Wh(r){return new R.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],r)}var Fs={parse:Hh,make:Wh};function $h(r,e,t,n,i){for(var s,a,o=new F.Parser(r,e),c=0;c<n;c+=1){c<t&&(s=o.parseUShort(),a=o.parseShort());var h=i.get(c);h.advanceWidth=s,h.leftSideBearing=a}}function qh(r,e,t,n,i){r._hmtxTableData={};for(var s,a,o=new F.Parser(e,t),c=0;c<i;c+=1)c<n&&(s=o.parseUShort(),a=o.parseShort()),r._hmtxTableData[c]={advanceWidth:s,leftSideBearing:a}}function Xh(r,e,t,n,i,s,a){a.lowMemory?qh(r,e,t,n,i):$h(e,t,n,i,s)}function Yh(r){for(var e=new R.Table("hmtx",[]),t=0;t<r.length;t+=1){var n=r.get(t),i=n.advanceWidth||0,s=n.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+t,type:"USHORT",value:i}),e.fields.push({name:"leftSideBearing_"+t,type:"SHORT",value:s})}return e}var Ns={parse:Xh,make:Yh};function Zh(r){for(var e=new R.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:r.length}]),t="",n=12+r.length*4,i=0;i<r.length;++i){var s=t.indexOf(r[i]);s<0&&(s=t.length,t+=r[i]),e.fields.push({name:"offset "+i,type:"USHORT",value:n+s}),e.fields.push({name:"length "+i,type:"USHORT",value:r[i].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),e}function Kh(r,e){var t=new F.Parser(r,e),n=t.parseULong();z.argument(n===1,"Unsupported ltag table version."),t.skip("uLong",1);for(var i=t.parseULong(),s=[],a=0;a<i;a++){for(var o="",c=e+t.parseUShort(),h=t.parseUShort(),l=c;l<c+h;++l)o+=String.fromCharCode(r.getInt8(l));s.push(o)}return s}var zs={make:Zh,parse:Kh};function Jh(r,e){var t={},n=new F.Parser(r,e);return t.version=n.parseVersion(),t.numGlyphs=n.parseUShort(),t.version===1&&(t.maxPoints=n.parseUShort(),t.maxContours=n.parseUShort(),t.maxCompositePoints=n.parseUShort(),t.maxCompositeContours=n.parseUShort(),t.maxZones=n.parseUShort(),t.maxTwilightPoints=n.parseUShort(),t.maxStorage=n.parseUShort(),t.maxFunctionDefs=n.parseUShort(),t.maxInstructionDefs=n.parseUShort(),t.maxStackElements=n.parseUShort(),t.maxSizeOfInstructions=n.parseUShort(),t.maxComponentElements=n.parseUShort(),t.maxComponentDepth=n.parseUShort()),t}function Qh(r){return new R.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:r}])}var Gs={parse:Jh,make:Qh},js=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Vs={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},el={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Hs={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function tl(r,e,t){switch(r){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return Vs[e];case 3:return Hs[e]}}var Pr="utf-16",nl={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},rl={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Ws(r,e,t){switch(r){case 0:return Pr;case 1:return rl[t]||nl[e];case 3:if(e===1||e===10)return Pr;break}}function il(r,e,t){for(var n={},i=new F.Parser(r,e),s=i.parseUShort(),a=i.parseUShort(),o=i.offset+i.parseUShort(),c=0;c<a;c++){var h=i.parseUShort(),l=i.parseUShort(),d=i.parseUShort(),u=i.parseUShort(),f=js[u]||u,y=i.parseUShort(),m=i.parseUShort(),x=tl(h,d,t),v=Ws(h,l,d);if(v!==void 0&&x!==void 0){var w=void 0;if(v===Pr?w=wt.UTF16(r,o+m,y):w=wt.MACSTRING(r,o+m,y,v),w){var S=n[f];S===void 0&&(S=n[f]={}),S[x]=w}}}return s===1&&i.parseUShort(),n}function Dr(r){var e={};for(var t in r)e[r[t]]=parseInt(t);return e}function $s(r,e,t,n,i,s){return new R.Record("NameRecord",[{name:"platformID",type:"USHORT",value:r},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:t},{name:"nameID",type:"USHORT",value:n},{name:"length",type:"USHORT",value:i},{name:"offset",type:"USHORT",value:s}])}function sl(r,e){var t=r.length,n=e.length-t+1;e:for(var i=0;i<n;i++)for(;i<n;i++){for(var s=0;s<t;s++)if(e[i+s]!==r[s])continue e;return i}return-1}function qs(r,e){var t=sl(r,e);if(t<0){t=e.length;for(var n=0,i=r.length;n<i;++n)e.push(r[n])}return t}function al(r,e){var t,n=[],i={},s=Dr(js);for(var a in r){var o=s[a];if(o===void 0&&(o=a),t=parseInt(o),isNaN(t))throw new Error('Name table entry "'+a+'" does not exist, see nameTableNames for complete list.');i[t]=r[a],n.push(t)}for(var c=Dr(Vs),h=Dr(Hs),l=[],d=[],u=0;u<n.length;u++){t=n[u];var f=i[t];for(var y in f){var m=f[y],x=1,v=c[y],w=el[v],S=Ws(x,w,v),_=D.MACSTRING(m,S);_===void 0&&(x=0,v=e.indexOf(y),v<0&&(v=e.length,e.push(y)),w=4,_=D.UTF16(m));var T=qs(_,d);l.push($s(x,w,v,t,_.length,T));var B=h[y];if(B!==void 0){var O=D.UTF16(m),P=qs(O,d);l.push($s(3,1,B,t,O.length,P))}}}l.sort(function(J,pe){return J.platformID-pe.platformID||J.encodingID-pe.encodingID||J.languageID-pe.languageID||J.nameID-pe.nameID});for(var V=new R.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:l.length},{name:"stringOffset",type:"USHORT",value:6+l.length*12}]),H=0;H<l.length;H++)V.fields.push({name:"record_"+H,type:"RECORD",value:l[H]});return V.fields.push({name:"strings",type:"LITERAL",value:d}),V}var Xs={parse:il,make:al},Rr=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function ol(r){for(var e=0;e<Rr.length;e+=1){var t=Rr[e];if(r>=t.begin&&r<t.end)return e}return-1}function cl(r,e){var t={},n=new F.Parser(r,e);t.version=n.parseUShort(),t.xAvgCharWidth=n.parseShort(),t.usWeightClass=n.parseUShort(),t.usWidthClass=n.parseUShort(),t.fsType=n.parseUShort(),t.ySubscriptXSize=n.parseShort(),t.ySubscriptYSize=n.parseShort(),t.ySubscriptXOffset=n.parseShort(),t.ySubscriptYOffset=n.parseShort(),t.ySuperscriptXSize=n.parseShort(),t.ySuperscriptYSize=n.parseShort(),t.ySuperscriptXOffset=n.parseShort(),t.ySuperscriptYOffset=n.parseShort(),t.yStrikeoutSize=n.parseShort(),t.yStrikeoutPosition=n.parseShort(),t.sFamilyClass=n.parseShort(),t.panose=[];for(var i=0;i<10;i++)t.panose[i]=n.parseByte();return t.ulUnicodeRange1=n.parseULong(),t.ulUnicodeRange2=n.parseULong(),t.ulUnicodeRange3=n.parseULong(),t.ulUnicodeRange4=n.parseULong(),t.achVendID=String.fromCharCode(n.parseByte(),n.parseByte(),n.parseByte(),n.parseByte()),t.fsSelection=n.parseUShort(),t.usFirstCharIndex=n.parseUShort(),t.usLastCharIndex=n.parseUShort(),t.sTypoAscender=n.parseShort(),t.sTypoDescender=n.parseShort(),t.sTypoLineGap=n.parseShort(),t.usWinAscent=n.parseUShort(),t.usWinDescent=n.parseUShort(),t.version>=1&&(t.ulCodePageRange1=n.parseULong(),t.ulCodePageRange2=n.parseULong()),t.version>=2&&(t.sxHeight=n.parseShort(),t.sCapHeight=n.parseShort(),t.usDefaultChar=n.parseUShort(),t.usBreakChar=n.parseUShort(),t.usMaxContent=n.parseUShort()),t}function hl(r){return new R.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],r)}var Ur={parse:cl,make:hl,unicodeRanges:Rr,getUnicodeRange:ol};function ll(r,e){var t={},n=new F.Parser(r,e);switch(t.version=n.parseVersion(),t.italicAngle=n.parseFixed(),t.underlinePosition=n.parseShort(),t.underlineThickness=n.parseShort(),t.isFixedPitch=n.parseULong(),t.minMemType42=n.parseULong(),t.maxMemType42=n.parseULong(),t.minMemType1=n.parseULong(),t.maxMemType1=n.parseULong(),t.version){case 1:t.names=pt.slice();break;case 2:t.numberOfGlyphs=n.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(var i=0;i<t.numberOfGlyphs;i++)t.glyphNameIndex[i]=n.parseUShort();t.names=[];for(var s=0;s<t.numberOfGlyphs;s++)if(t.glyphNameIndex[s]>=pt.length){var a=n.parseChar();t.names.push(n.parseString(a))}break;case 2.5:t.numberOfGlyphs=n.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(var o=0;o<t.numberOfGlyphs;o++)t.offset[o]=n.parseChar();break}return t}function ul(){return new R.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}var Ys={parse:ll,make:ul},ke=new Array(9);ke[1]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(L.coverage),deltaGlyphId:this.parseUShort()};if(e===2)return{substFormat:2,coverage:this.parsePointer(L.coverage),substitute:this.parseOffset16List()};z.assert(!1,"0x"+r.toString(16)+": lookup type 1 format must be 1 or 2.")},ke[2]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),sequences:this.parseListOfLists()}},ke[3]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),alternateSets:this.parseListOfLists()}},ke[4]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB ligature table identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var St={sequenceIndex:L.uShort,lookupListIndex:L.uShort};ke[5]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:e,coverage:this.parsePointer(L.coverage),ruleSets:this.parseListOfLists(function(){var i=this.parseUShort(),s=this.parseUShort();return{input:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,St)}})};if(e===2)return{substFormat:e,coverage:this.parsePointer(L.coverage),classDef:this.parsePointer(L.classDef),classSets:this.parseListOfLists(function(){var i=this.parseUShort(),s=this.parseUShort();return{classes:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,St)}})};if(e===3){var t=this.parseUShort(),n=this.parseUShort();return{substFormat:e,coverages:this.parseList(t,L.pointer(L.coverage)),lookupRecords:this.parseRecordList(n,St)}}z.assert(!1,"0x"+r.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},ke[6]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(L.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(St)}})};if(e===2)return{substFormat:2,coverage:this.parsePointer(L.coverage),backtrackClassDef:this.parsePointer(L.classDef),inputClassDef:this.parsePointer(L.classDef),lookaheadClassDef:this.parsePointer(L.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(St)}})};if(e===3)return{substFormat:3,backtrackCoverage:this.parseList(L.pointer(L.coverage)),inputCoverage:this.parseList(L.pointer(L.coverage)),lookaheadCoverage:this.parseList(L.pointer(L.coverage)),lookupRecords:this.parseRecordList(St)};z.assert(!1,"0x"+r.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},ke[7]=function(){var r=this.parseUShort();z.argument(r===1,"GSUB Extension Substitution subtable identifier-format must be 1");var e=this.parseUShort(),t=new L(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:e,extension:ke[e].call(t)}},ke[8]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),backtrackCoverage:this.parseList(L.pointer(L.coverage)),lookaheadCoverage:this.parseList(L.pointer(L.coverage)),substitutes:this.parseUShortList()}};function dl(r,e){e=e||0;var t=new L(r,e),n=t.parseVersion(1);return z.argument(n===1||n===1.1,"Unsupported GSUB table version."),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(ke)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(ke),variations:t.parseFeatureVariationsList()}}var _t=new Array(9);_t[1]=function(r){return r.substFormat===1?new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)},{name:"deltaGlyphID",type:"USHORT",value:r.deltaGlyphId}]):new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.ushortList("substitute",r.substitute)))},_t[2]=function(r){return z.assert(r.substFormat===1,"Lookup type 2 substFormat must be 1."),new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("seqSet",r.sequences,function(e){return new R.Table("sequenceSetTable",R.ushortList("sequence",e))})))},_t[3]=function(r){return z.assert(r.substFormat===1,"Lookup type 3 substFormat must be 1."),new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("altSet",r.alternateSets,function(e){return new R.Table("alternateSetTable",R.ushortList("alternate",e))})))},_t[4]=function(r){return z.assert(r.substFormat===1,"Lookup type 4 substFormat must be 1."),new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("ligSet",r.ligatureSets,function(e){return new R.Table("ligatureSetTable",R.tableList("ligature",e,function(t){return new R.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:t.ligGlyph}].concat(R.ushortList("component",t.components,t.components.length+1)))}))})))},_t[6]=function(r){if(r.substFormat===1){var e=new R.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:r.substFormat},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("chainRuleSet",r.chainRuleSets,function(i){return new R.Table("chainRuleSetTable",R.tableList("chainRule",i,function(s){var a=R.ushortList("backtrackGlyph",s.backtrack,s.backtrack.length).concat(R.ushortList("inputGlyph",s.input,s.input.length+1)).concat(R.ushortList("lookaheadGlyph",s.lookahead,s.lookahead.length)).concat(R.ushortList("substitution",[],s.lookupRecords.length));return s.lookupRecords.forEach(function(o,c){a=a.concat({name:"sequenceIndex"+c,type:"USHORT",value:o.sequenceIndex}).concat({name:"lookupListIndex"+c,type:"USHORT",value:o.lookupListIndex})}),new R.Table("chainRuleTable",a)}))})));return e}else if(r.substFormat===2)z.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(r.substFormat===3){var t=[{name:"substFormat",type:"USHORT",value:r.substFormat}];t.push({name:"backtrackGlyphCount",type:"USHORT",value:r.backtrackCoverage.length}),r.backtrackCoverage.forEach(function(i,s){t.push({name:"backtrackCoverage"+s,type:"TABLE",value:new R.Coverage(i)})}),t.push({name:"inputGlyphCount",type:"USHORT",value:r.inputCoverage.length}),r.inputCoverage.forEach(function(i,s){t.push({name:"inputCoverage"+s,type:"TABLE",value:new R.Coverage(i)})}),t.push({name:"lookaheadGlyphCount",type:"USHORT",value:r.lookaheadCoverage.length}),r.lookaheadCoverage.forEach(function(i,s){t.push({name:"lookaheadCoverage"+s,type:"TABLE",value:new R.Coverage(i)})}),t.push({name:"substitutionCount",type:"USHORT",value:r.lookupRecords.length}),r.lookupRecords.forEach(function(i,s){t=t.concat({name:"sequenceIndex"+s,type:"USHORT",value:i.sequenceIndex}).concat({name:"lookupListIndex"+s,type:"USHORT",value:i.lookupListIndex})});var n=new R.Table("chainContextTable",t);return n}z.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function pl(r){return new R.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new R.ScriptList(r.scripts)},{name:"features",type:"TABLE",value:new R.FeatureList(r.features)},{name:"lookups",type:"TABLE",value:new R.LookupList(r.lookups,_t)}])}var Zs={parse:dl,make:pl};function fl(r,e){var t=new F.Parser(r,e),n=t.parseULong();z.argument(n===1,"Unsupported META table version."),t.parseULong(),t.parseULong();for(var i=t.parseULong(),s={},a=0;a<i;a++){var o=t.parseTag(),c=t.parseULong(),h=t.parseULong(),l=wt.UTF8(r,e+c,h);s[o]=l}return s}function gl(r){var e=Object.keys(r).length,t="",n=16+e*12,i=new R.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:n},{name:"numTags",type:"ULONG",value:e}]);for(var s in r){var a=t.length;t+=r[s],i.fields.push({name:"tag "+s,type:"TAG",value:s}),i.fields.push({name:"offset "+s,type:"ULONG",value:n+a}),i.fields.push({name:"length "+s,type:"ULONG",value:r[s].length})}return i.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),i}var Ks={parse:fl,make:gl};function Js(r){return Math.log(r)/Math.log(2)|0}function Fr(r){for(;r.length%4!==0;)r.push(0);for(var e=0,t=0;t<r.length;t+=4)e+=(r[t]<<24)+(r[t+1]<<16)+(r[t+2]<<8)+r[t+3];return e%=Math.pow(2,32),e}function Qs(r,e,t,n){return new R.Record("Table Record",[{name:"tag",type:"TAG",value:r!==void 0?r:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:t!==void 0?t:0},{name:"length",type:"ULONG",value:n!==void 0?n:0}])}function ea(r){var e=new R.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=r,e.numTables=r.length;var t=Math.pow(2,Js(e.numTables));e.searchRange=16*t,e.entrySelector=Js(t),e.rangeShift=e.numTables*16-e.searchRange;for(var n=[],i=[],s=e.sizeOf()+Qs().sizeOf()*e.numTables;s%4!==0;)s+=1,i.push({name:"padding",type:"BYTE",value:0});for(var a=0;a<r.length;a+=1){var o=r[a];z.argument(o.tableName.length===4,"Table name"+o.tableName+" is invalid.");var c=o.sizeOf(),h=Qs(o.tableName,Fr(o.encode()),s,c);for(n.push({name:h.tag+" Table Record",type:"RECORD",value:h}),i.push({name:o.tableName+" table",type:"RECORD",value:o}),s+=c,z.argument(!isNaN(s),"Something went wrong calculating the offset.");s%4!==0;)s+=1,i.push({name:"padding",type:"BYTE",value:0})}return n.sort(function(l,d){return l.value.tag>d.value.tag?1:-1}),e.fields=e.fields.concat(n),e.fields=e.fields.concat(i),e}function ta(r,e,t){for(var n=0;n<e.length;n+=1){var i=r.charToGlyphIndex(e[n]);if(i>0){var s=r.glyphs.get(i);return s.getMetrics()}}return t}function ml(r){for(var e=0,t=0;t<r.length;t+=1)e+=r[t];return e/r.length}function yl(r){for(var e=[],t=[],n=[],i=[],s=[],a=[],o=[],c,h=0,l=0,d=0,u=0,f=0,y=0;y<r.glyphs.length;y+=1){var m=r.glyphs.get(y),x=m.unicode|0;if(isNaN(m.advanceWidth))throw new Error("Glyph "+m.name+" ("+y+"): advanceWidth is not a number.");(c>x||c===void 0)&&x>0&&(c=x),h<x&&(h=x);var v=Ur.getUnicodeRange(x);if(v<32)l|=1<<v;else if(v<64)d|=1<<v-32;else if(v<96)u|=1<<v-64;else if(v<123)f|=1<<v-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(m.name!==".notdef"){var w=m.getMetrics();e.push(w.xMin),t.push(w.yMin),n.push(w.xMax),i.push(w.yMax),a.push(w.leftSideBearing),o.push(w.rightSideBearing),s.push(m.advanceWidth)}}var S={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,n),yMax:Math.max.apply(null,i),advanceWidthMax:Math.max.apply(null,s),advanceWidthAvg:ml(s),minLeftSideBearing:Math.min.apply(null,a),maxLeftSideBearing:Math.max.apply(null,a),minRightSideBearing:Math.min.apply(null,o)};S.ascender=r.ascender,S.descender=r.descender;var _=Us.make({flags:3,unitsPerEm:r.unitsPerEm,xMin:S.xMin,yMin:S.yMin,xMax:S.xMax,yMax:S.yMax,lowestRecPPEM:3,createdTimestamp:r.createdTimestamp}),T=Fs.make({ascender:S.ascender,descender:S.descender,advanceWidthMax:S.advanceWidthMax,minLeftSideBearing:S.minLeftSideBearing,minRightSideBearing:S.minRightSideBearing,xMaxExtent:S.maxLeftSideBearing+(S.xMax-S.xMin),numberOfHMetrics:r.glyphs.length}),B=Gs.make(r.glyphs.length),O=Ur.make(Object.assign({xAvgCharWidth:Math.round(S.advanceWidthAvg),usFirstCharIndex:c,usLastCharIndex:h,ulUnicodeRange1:l,ulUnicodeRange2:d,ulUnicodeRange3:u,ulUnicodeRange4:f,sTypoAscender:S.ascender,sTypoDescender:S.descender,sTypoLineGap:0,usWinAscent:S.yMax,usWinDescent:Math.abs(S.yMin),ulCodePageRange1:1,sxHeight:ta(r,"xyvw",{yMax:Math.round(S.ascender/2)}).yMax,sCapHeight:ta(r,"HIKLEFJMNTZBDPRAGOQSUVWXY",S).yMax,usDefaultChar:r.hasChar(" ")?32:0,usBreakChar:r.hasChar(" ")?32:0},r.tables.os2)),P=Ns.make(r.glyphs),V=ws.make(r.glyphs),H=r.getEnglishName("fontFamily"),J=r.getEnglishName("fontSubfamily"),pe=H+" "+J,ae=r.getEnglishName("postScriptName");ae||(ae=H.replace(/\s/g,"")+"-"+J);var $={};for(var X in r.names)$[X]=r.names[X];$.uniqueID||($.uniqueID={en:r.getEnglishName("manufacturer")+":"+pe}),$.postScriptName||($.postScriptName={en:ae}),$.preferredFamily||($.preferredFamily=r.names.fontFamily),$.preferredSubfamily||($.preferredSubfamily=r.names.fontSubfamily);var Y=[],te=Xs.make($,Y),ce=Y.length>0?zs.make(Y):void 0,re=Ys.make(),he=Rs.make(r.glyphs,{version:r.getEnglishName("version"),fullName:pe,familyName:H,weightName:J,postScriptName:ae,unitsPerEm:r.unitsPerEm,fontBBox:[0,S.yMin,S.ascender,S.advanceWidthMax]}),j=r.metas&&Object.keys(r.metas).length>0?Ks.make(r.metas):void 0,W=[_,T,B,O,te,V,re,he,P];ce&&W.push(ce),r.tables.gsub&&W.push(Zs.make(r.tables.gsub)),j&&W.push(j);for(var zt=ea(W),nr=zt.encode(),rr=Fr(nr),mn=zt.fields,ir=!1,lt=0;lt<mn.length;lt+=1)if(mn[lt].name==="head table"){mn[lt].value.checkSumAdjustment=2981146554-rr,ir=!0;break}if(!ir)throw new Error("Could not find head table with checkSum to adjust.");return zt}var bl={make:ea,fontToTable:yl,computeCheckSum:Fr};function Nr(r,e){for(var t=0,n=r.length-1;t<=n;){var i=t+n>>>1,s=r[i].tag;if(s===e)return i;s<e?t=i+1:n=i-1}return-t-1}function na(r,e){for(var t=0,n=r.length-1;t<=n;){var i=t+n>>>1,s=r[i];if(s===e)return i;s<e?t=i+1:n=i-1}return-t-1}function ra(r,e){for(var t,n=0,i=r.length-1;n<=i;){var s=n+i>>>1;t=r[s];var a=t.start;if(a===e)return t;a<e?n=s+1:i=s-1}if(n>0)return t=r[n-1],e>t.end?0:t}function $t(r,e){this.font=r,this.tableName=e}$t.prototype={searchTag:Nr,binSearch:na,getTable:function(r){var e=this.font.tables[this.tableName];return!e&&r&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var r=this.getTable();return r?r.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var r=this.getTable();if(r){for(var e=!1,t=0;t<r.scripts.length;t++){var n=r.scripts[t].tag;if(n==="DFLT")return n;n==="latn"&&(e=!0)}if(e)return"latn"}},getScriptTable:function(r,e){var t=this.getTable(e);if(t){r=r||"DFLT";var n=t.scripts,i=Nr(t.scripts,r);if(i>=0)return n[i].script;if(e){var s={tag:r,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return n.splice(-1-i,0,s),s.script}}},getLangSysTable:function(r,e,t){var n=this.getScriptTable(r,t);if(n){if(!e||e==="dflt"||e==="DFLT")return n.defaultLangSys;var i=Nr(n.langSysRecords,e);if(i>=0)return n.langSysRecords[i].langSys;if(t){var s={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return n.langSysRecords.splice(-1-i,0,s),s.langSys}}},getFeatureTable:function(r,e,t,n){var i=this.getLangSysTable(r,e,n);if(i){for(var s,a=i.featureIndexes,o=this.font.tables[this.tableName].features,c=0;c<a.length;c++)if(s=o[a[c]],s.tag===t)return s.feature;if(n){var h=o.length;return z.assert(h===0||t>=o[h-1].tag,"Features must be added in alphabetical order."),s={tag:t,feature:{params:0,lookupListIndexes:[]}},o.push(s),a.push(h),s.feature}}},getLookupTables:function(r,e,t,n,i){var s=this.getFeatureTable(r,e,t,i),a=[];if(s){for(var o,c=s.lookupListIndexes,h=this.font.tables[this.tableName].lookups,l=0;l<c.length;l++)o=h[c[l]],o.lookupType===n&&a.push(o);if(a.length===0&&i){o={lookupType:n,lookupFlag:0,subtables:[],markFilteringSet:void 0};var d=h.length;return h.push(o),c.push(d),[o]}}return a},getGlyphClass:function(r,e){switch(r.format){case 1:return r.startGlyph<=e&&e<r.startGlyph+r.classes.length?r.classes[e-r.startGlyph]:0;case 2:var t=ra(r.ranges,e);return t?t.classId:0}},getCoverageIndex:function(r,e){switch(r.format){case 1:var t=na(r.glyphs,e);return t>=0?t:-1;case 2:var n=ra(r.ranges,e);return n?n.index+e-n.start:-1}},expandCoverage:function(r){if(r.format===1)return r.glyphs;for(var e=[],t=r.ranges,n=0;n<t.length;n++)for(var i=t[n],s=i.start,a=i.end,o=s;o<=a;o++)e.push(o);return e}};function qt(r){$t.call(this,r,"gpos")}qt.prototype=$t.prototype,qt.prototype.init=function(){var r=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(r)},qt.prototype.getKerningValue=function(r,e,t){for(var n=0;n<r.length;n++)for(var i=r[n].subtables,s=0;s<i.length;s++){var a=i[s],o=this.getCoverageIndex(a.coverage,e);if(!(o<0))switch(a.posFormat){case 1:for(var c=a.pairSets[o],h=0;h<c.length;h++){var l=c[h];if(l.secondGlyph===t)return l.value1&&l.value1.xAdvance||0}break;case 2:var d=this.getGlyphClass(a.classDef1,e),u=this.getGlyphClass(a.classDef2,t),f=a.classRecords[d][u];return f.value1&&f.value1.xAdvance||0}}return 0},qt.prototype.getKerningTables=function(r,e){if(this.font.tables.gpos)return this.getLookupTables(r,e,"kern",2)};function Se(r){$t.call(this,r,"gsub")}function vl(r,e){var t=r.length;if(t!==e.length)return!1;for(var n=0;n<t;n++)if(r[n]!==e[n])return!1;return!0}function zr(r,e,t){for(var n=r.subtables,i=0;i<n.length;i++){var s=n[i];if(s.substFormat===e)return s}if(t)return n.push(t),t}Se.prototype=$t.prototype,Se.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Se.prototype.getSingle=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,1),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++){var c=a[o],h=this.expandCoverage(c.coverage),l=void 0;if(c.substFormat===1){var d=c.deltaGlyphId;for(l=0;l<h.length;l++){var u=h[l];n.push({sub:u,by:u+d})}}else{var f=c.substitute;for(l=0;l<h.length;l++)n.push({sub:h[l],by:f[l]})}}return n},Se.prototype.getMultiple=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,2),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++){var c=a[o],h=this.expandCoverage(c.coverage),l=void 0;for(l=0;l<h.length;l++){var d=h[l],u=c.sequences[l];n.push({sub:d,by:u})}}return n},Se.prototype.getAlternates=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,3),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++)for(var c=a[o],h=this.expandCoverage(c.coverage),l=c.alternateSets,d=0;d<h.length;d++)n.push({sub:h[d],by:l[d]});return n},Se.prototype.getLigatures=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,4),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++)for(var c=a[o],h=this.expandCoverage(c.coverage),l=c.ligatureSets,d=0;d<h.length;d++)for(var u=h[d],f=l[d],y=0;y<f.length;y++){var m=f[y];n.push({sub:[u].concat(m.components),by:m.ligGlyph})}return n},Se.prototype.addSingle=function(r,e,t,n){var i=this.getLookupTables(t,n,r,1,!0)[0],s=zr(i,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});z.assert(s.coverage.format===1,"Single: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.substitute.splice(o,0,0)),s.substitute[o]=e.by},Se.prototype.addMultiple=function(r,e,t,n){z.assert(e.by instanceof Array&&e.by.length>1,'Multiple: "by" must be an array of two or more ids');var i=this.getLookupTables(t,n,r,2,!0)[0],s=zr(i,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});z.assert(s.coverage.format===1,"Multiple: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.sequences.splice(o,0,0)),s.sequences[o]=e.by},Se.prototype.addAlternate=function(r,e,t,n){var i=this.getLookupTables(t,n,r,3,!0)[0],s=zr(i,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});z.assert(s.coverage.format===1,"Alternate: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.alternateSets.splice(o,0,0)),s.alternateSets[o]=e.by},Se.prototype.addLigature=function(r,e,t,n){var i=this.getLookupTables(t,n,r,4,!0)[0],s=i.subtables[0];s||(s={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},i.subtables[0]=s),z.assert(s.coverage.format===1,"Ligature: unable to modify coverage table format "+s.coverage.format);var a=e.sub[0],o=e.sub.slice(1),c={ligGlyph:e.by,components:o},h=this.binSearch(s.coverage.glyphs,a);if(h>=0){for(var l=s.ligatureSets[h],d=0;d<l.length;d++)if(vl(l[d].components,o))return;l.push(c)}else h=-1-h,s.coverage.glyphs.splice(h,0,a),s.ligatureSets.splice(h,0,[c])},Se.prototype.getFeature=function(r,e,t){if(/ss\d\d/.test(r))return this.getSingle(r,e,t);switch(r){case"aalt":case"salt":return this.getSingle(r,e,t).concat(this.getAlternates(r,e,t));case"dlig":case"liga":case"rlig":return this.getLigatures(r,e,t);case"ccmp":return this.getMultiple(r,e,t).concat(this.getLigatures(r,e,t));case"stch":return this.getMultiple(r,e,t)}},Se.prototype.add=function(r,e,t,n){if(/ss\d\d/.test(r))return this.addSingle(r,e,t,n);switch(r){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(r,e,t,n):this.addAlternate(r,e,t,n);case"dlig":case"liga":case"rlig":return this.addLigature(r,e,t,n);case"ccmp":return e.by instanceof Array?this.addMultiple(r,e,t,n):this.addLigature(r,e,t,n)}};function xl(){return typeof window<"u"}function wl(r){for(var e=new Buffer(r.byteLength),t=new Uint8Array(r),n=0;n<e.length;++n)e[n]=t[n];return e}function Xt(r,e){if(!r)throw e}function ia(r,e,t,n,i){var s;return(e&n)>0?(s=r.parseByte(),e&i||(s=-s),s=t+s):(e&i)>0?s=t:s=t+r.parseShort(),s}function sa(r,e,t){var n=new F.Parser(e,t);r.numberOfContours=n.parseShort(),r._xMin=n.parseShort(),r._yMin=n.parseShort(),r._xMax=n.parseShort(),r._yMax=n.parseShort();var i,s;if(r.numberOfContours>0){for(var a=r.endPointIndices=[],o=0;o<r.numberOfContours;o+=1)a.push(n.parseUShort());r.instructionLength=n.parseUShort(),r.instructions=[];for(var c=0;c<r.instructionLength;c+=1)r.instructions.push(n.parseByte());var h=a[a.length-1]+1;i=[];for(var l=0;l<h;l+=1)if(s=n.parseByte(),i.push(s),(s&8)>0)for(var d=n.parseByte(),u=0;u<d;u+=1)i.push(s),l+=1;if(z.argument(i.length===h,"Bad flags."),a.length>0){var f=[],y;if(h>0){for(var m=0;m<h;m+=1)s=i[m],y={},y.onCurve=!!(s&1),y.lastPointOfContour=a.indexOf(m)>=0,f.push(y);for(var x=0,v=0;v<h;v+=1)s=i[v],y=f[v],y.x=ia(n,s,x,2,16),x=y.x;for(var w=0,S=0;S<h;S+=1)s=i[S],y=f[S],y.y=ia(n,s,w,4,32),w=y.y}r.points=f}else r.points=[]}else if(r.numberOfContours===0)r.points=[];else{r.isComposite=!0,r.points=[],r.components=[];for(var _=!0;_;){i=n.parseUShort();var T={glyphIndex:n.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(i&1)>0?(i&2)>0?(T.dx=n.parseShort(),T.dy=n.parseShort()):T.matchedPoints=[n.parseUShort(),n.parseUShort()]:(i&2)>0?(T.dx=n.parseChar(),T.dy=n.parseChar()):T.matchedPoints=[n.parseByte(),n.parseByte()],(i&8)>0?T.xScale=T.yScale=n.parseF2Dot14():(i&64)>0?(T.xScale=n.parseF2Dot14(),T.yScale=n.parseF2Dot14()):(i&128)>0&&(T.xScale=n.parseF2Dot14(),T.scale01=n.parseF2Dot14(),T.scale10=n.parseF2Dot14(),T.yScale=n.parseF2Dot14()),r.components.push(T),_=!!(i&32)}if(i&256){r.instructionLength=n.parseUShort(),r.instructions=[];for(var B=0;B<r.instructionLength;B+=1)r.instructions.push(n.parseByte())}}}function Gr(r,e){for(var t=[],n=0;n<r.length;n+=1){var i=r[n],s={x:e.xScale*i.x+e.scale01*i.y+e.dx,y:e.scale10*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};t.push(s)}return t}function Sl(r){for(var e=[],t=[],n=0;n<r.length;n+=1){var i=r[n];t.push(i),i.lastPointOfContour&&(e.push(t),t=[])}return z.argument(t.length===0,"There are still points left in the current contour."),e}function aa(r){var e=new ue;if(!r)return e;for(var t=Sl(r),n=0;n<t.length;++n){var i=t[n],s=null,a=i[i.length-1],o=i[0];if(a.onCurve)e.moveTo(a.x,a.y);else if(o.onCurve)e.moveTo(o.x,o.y);else{var c={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5};e.moveTo(c.x,c.y)}for(var h=0;h<i.length;++h)if(s=a,a=o,o=i[(h+1)%i.length],a.onCurve)e.lineTo(a.x,a.y);else{var l=o;s.onCurve||((a.x+s.x)*.5,(a.y+s.y)*.5),o.onCurve||(l={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5}),e.quadraticCurveTo(a.x,a.y,l.x,l.y)}e.closePath()}return e}function oa(r,e){if(e.isComposite)for(var t=0;t<e.components.length;t+=1){var n=e.components[t],i=r.get(n.glyphIndex);if(i.getPath(),i.points){var s=void 0;if(n.matchedPoints===void 0)s=Gr(i.points,n);else{if(n.matchedPoints[0]>e.points.length-1||n.matchedPoints[1]>i.points.length-1)throw Error("Matched points out of range in "+e.name);var a=e.points[n.matchedPoints[0]],o=i.points[n.matchedPoints[1]],c={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};o=Gr([o],c)[0],c.dx=a.x-o.x,c.dy=a.y-o.y,s=Gr(i.points,c)}e.points=e.points.concat(s)}}return aa(e.points)}function _l(r,e,t,n){for(var i=new Ue.GlyphSet(n),s=0;s<t.length-1;s+=1){var a=t[s],o=t[s+1];a!==o?i.push(s,Ue.ttfGlyphLoader(n,s,sa,r,e+a,oa)):i.push(s,Ue.glyphLoader(n,s))}return i}function Cl(r,e,t,n){var i=new Ue.GlyphSet(n);return n._push=function(s){var a=t[s],o=t[s+1];a!==o?i.push(s,Ue.ttfGlyphLoader(n,s,sa,r,e+a,oa)):i.push(s,Ue.glyphLoader(n,s))},i}function Tl(r,e,t,n,i){return i.lowMemory?Cl(r,e,t,n):_l(r,e,t,n)}var ca={getPath:aa,parse:Tl},ha,gt,la,jr;function ua(r){this.font=r,this.getCommands=function(e){return ca.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function El(r){return r}function da(r){return Math.sign(r)*Math.round(Math.abs(r))}function Al(r){return Math.sign(r)*Math.round(Math.abs(r*2))/2}function Il(r){return Math.sign(r)*(Math.round(Math.abs(r)+.5)-.5)}function Ll(r){return Math.sign(r)*Math.ceil(Math.abs(r))}function kl(r){return Math.sign(r)*Math.floor(Math.abs(r))}var pa=function(r){var e=this.srPeriod,t=this.srPhase,n=this.srThreshold,i=1;return r<0&&(r=-r,i=-1),r+=n-t,r=Math.trunc(r/e)*e,r+=t,r<0?t*i:r*i},Fe={x:1,y:0,axis:"x",distance:function(r,e,t,n){return(t?r.xo:r.x)-(n?e.xo:e.x)},interpolate:function(r,e,t,n){var i,s,a,o,c,h,l;if(!n||n===this){if(i=r.xo-e.xo,s=r.xo-t.xo,c=e.x-e.xo,h=t.x-t.xo,a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){r.x=r.xo+(c+h)/2;return}r.x=r.xo+(c*o+h*a)/l;return}if(i=n.distance(r,e,!0,!0),s=n.distance(r,t,!0,!0),c=n.distance(e,e,!1,!0),h=n.distance(t,t,!1,!0),a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){Fe.setRelative(r,r,(c+h)/2,n,!0);return}Fe.setRelative(r,r,(c*o+h*a)/l,n,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(r,e,t,n,i){if(!n||n===this){r.x=(i?e.xo:e.x)+t;return}var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+t*n.x,c=a+t*n.y;r.x=o+(r.y-c)/n.normalSlope},slope:0,touch:function(r){r.xTouched=!0},touched:function(r){return r.xTouched},untouch:function(r){r.xTouched=!1}},Ye={x:0,y:1,axis:"y",distance:function(r,e,t,n){return(t?r.yo:r.y)-(n?e.yo:e.y)},interpolate:function(r,e,t,n){var i,s,a,o,c,h,l;if(!n||n===this){if(i=r.yo-e.yo,s=r.yo-t.yo,c=e.y-e.yo,h=t.y-t.yo,a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){r.y=r.yo+(c+h)/2;return}r.y=r.yo+(c*o+h*a)/l;return}if(i=n.distance(r,e,!0,!0),s=n.distance(r,t,!0,!0),c=n.distance(e,e,!1,!0),h=n.distance(t,t,!1,!0),a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){Ye.setRelative(r,r,(c+h)/2,n,!0);return}Ye.setRelative(r,r,(c*o+h*a)/l,n,!0)},normalSlope:0,setRelative:function(r,e,t,n,i){if(!n||n===this){r.y=(i?e.yo:e.y)+t;return}var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+t*n.x,c=a+t*n.y;r.y=c+n.normalSlope*(r.x-o)},slope:Number.POSITIVE_INFINITY,touch:function(r){r.yTouched=!0},touched:function(r){return r.yTouched},untouch:function(r){r.yTouched=!1}};Object.freeze(Fe),Object.freeze(Ye);function Yt(r,e){this.x=r,this.y=e,this.axis=void 0,this.slope=e/r,this.normalSlope=-r/e,Object.freeze(this)}Yt.prototype.distance=function(r,e,t,n){return this.x*Fe.distance(r,e,t,n)+this.y*Ye.distance(r,e,t,n)},Yt.prototype.interpolate=function(r,e,t,n){var i,s,a,o,c,h,l;if(a=n.distance(r,e,!0,!0),o=n.distance(r,t,!0,!0),i=n.distance(e,e,!1,!0),s=n.distance(t,t,!1,!0),c=Math.abs(a),h=Math.abs(o),l=c+h,l===0){this.setRelative(r,r,(i+s)/2,n,!0);return}this.setRelative(r,r,(i*h+s*c)/l,n,!0)},Yt.prototype.setRelative=function(r,e,t,n,i){n=n||this;var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+t*n.x,c=a+t*n.y,h=n.normalSlope,l=this.slope,d=r.x,u=r.y;r.x=(l*d-h*o+c-u)/(l-h),r.y=l*(r.x-d)+u},Yt.prototype.touch=function(r){r.xTouched=!0,r.yTouched=!0};function Zt(r,e){var t=Math.sqrt(r*r+e*e);return r/=t,e/=t,r===1&&e===0?Fe:r===0&&e===1?Ye:new Yt(r,e)}function Ze(r,e,t,n){this.x=this.xo=Math.round(r*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=t,this.onCurve=n,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Ze.prototype.nextTouched=function(r){for(var e=this.nextPointOnContour;!r.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},Ze.prototype.prevTouched=function(r){for(var e=this.prevPointOnContour;!r.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};var Kt=Object.freeze(new Ze(0,0)),Bl={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function nt(r,e){switch(this.env=r,this.stack=[],this.prog=e,r){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Fe,this.round=da}}ua.prototype.exec=function(r,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(!(this._errorState>2)){var t=this.font,n=this._prepState;if(!n||n.ppem!==e){var i=this._fpgmState;if(!i){nt.prototype=Bl,i=this._fpgmState=new nt("fpgm",t.tables.fpgm),i.funcs=[],i.font=t,A.DEBUG&&(console.log("---EXEC FPGM---"),i.step=-1);try{gt(i)}catch(h){console.log("Hinting error in FPGM:"+h),this._errorState=3;return}}nt.prototype=i,n=this._prepState=new nt("prep",t.tables.prep),n.ppem=e;var s=t.tables.cvt;if(s)for(var a=n.cvt=new Array(s.length),o=e/t.unitsPerEm,c=0;c<s.length;c++)a[c]=s[c]*o;else n.cvt=[];A.DEBUG&&(console.log("---EXEC PREP---"),n.step=-1);try{gt(n)}catch(h){this._errorState<2&&console.log("Hinting error in PREP:"+h),this._errorState=2}}if(!(this._errorState>1))try{return la(r,n)}catch(h){this._errorState<1&&(console.log("Hinting error:"+h),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}},la=function(r,e){var t=e.ppem/e.font.unitsPerEm,n=t,i=r.components,s,a,o;if(nt.prototype=e,!i)o=new nt("glyf",r.instructions),A.DEBUG&&(console.log("---EXEC GLYPH---"),o.step=-1),jr(r,o,t,n),a=o.gZone;else{var c=e.font;a=[],s=[];for(var h=0;h<i.length;h++){var l=i[h],d=c.glyphs.get(l.glyphIndex);o=new nt("glyf",d.instructions),A.DEBUG&&(console.log("---EXEC COMP "+h+"---"),o.step=-1),jr(d,o,t,n);for(var u=Math.round(l.dx*t),f=Math.round(l.dy*n),y=o.gZone,m=o.contours,x=0;x<y.length;x++){var v=y[x];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+u,v.yo=v.y=v.y+f}var w=a.length;a.push.apply(a,y);for(var S=0;S<m.length;S++)s.push(m[S]+w)}r.instructions&&!o.inhibitGridFit&&(o=new nt("glyf",r.instructions),o.gZone=o.z0=o.z1=o.z2=a,o.contours=s,a.push(new Ze(0,0),new Ze(Math.round(r.advanceWidth*t),0)),A.DEBUG&&(console.log("---EXEC COMPOSITE---"),o.step=-1),gt(o),a.length-=2)}return a},jr=function(r,e,t,n){for(var i=r.points||[],s=i.length,a=e.gZone=e.z0=e.z1=e.z2=[],o=e.contours=[],c,h=0;h<s;h++)c=i[h],a[h]=new Ze(c.x*t,c.y*n,c.lastPointOfContour,c.onCurve);for(var l,d,u=0;u<s;u++)c=a[u],l||(l=c,o.push(u)),c.lastPointOfContour?(c.nextPointOnContour=l,l.prevPointOnContour=c,l=void 0):(d=a[u+1],c.nextPointOnContour=d,d.prevPointOnContour=c);if(!e.inhibitGridFit){if(A.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(var f=0;f<s;f++)console.log(f,a[f].x,a[f].y)}if(a.push(new Ze(0,0),new Ze(Math.round(r.advanceWidth*t),0)),gt(e),a.length-=2,A.DEBUG){console.log("FINISHED GLYPH",e.stack);for(var y=0;y<s;y++)console.log(y,a[y].x,a[y].y)}}},gt=function(r){var e=r.prog;if(e){var t=e.length,n;for(r.ip=0;r.ip<t;r.ip++){if(A.DEBUG&&r.step++,n=ha[e[r.ip]],!n)throw new Error("unknown instruction: 0x"+Number(e[r.ip]).toString(16));n(r)}}};function Rn(r){for(var e=r.tZone=new Array(r.gZone.length),t=0;t<e.length;t++)e[t]=new Ze(0,0)}function fa(r,e){var t=r.prog,n=r.ip,i=1,s;do if(s=t[++n],s===88)i++;else if(s===89)i--;else if(s===64)n+=t[n+1]+1;else if(s===65)n+=2*t[n+1]+1;else if(s>=176&&s<=183)n+=s-176+1;else if(s>=184&&s<=191)n+=(s-184+1)*2;else if(e&&i===1&&s===27)break;while(i>0);r.ip=n}function ga(r,e){A.DEBUG&&console.log(e.step,"SVTCA["+r.axis+"]"),e.fv=e.pv=e.dpv=r}function ma(r,e){A.DEBUG&&console.log(e.step,"SPVTCA["+r.axis+"]"),e.pv=e.dpv=r}function ya(r,e){A.DEBUG&&console.log(e.step,"SFVTCA["+r.axis+"]"),e.fv=r}function ba(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z2[n],a=e.z1[i];A.DEBUG&&console.log("SPVTL["+r+"]",n,i);var o,c;r?(o=s.y-a.y,c=a.x-s.x):(o=a.x-s.x,c=a.y-s.y),e.pv=e.dpv=Zt(o,c)}function va(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z2[n],a=e.z1[i];A.DEBUG&&console.log("SFVTL["+r+"]",n,i);var o,c;r?(o=s.y-a.y,c=a.x-s.x):(o=a.x-s.x,c=a.y-s.y),e.fv=Zt(o,c)}function Ml(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SPVFS[]",t,n),r.pv=r.dpv=Zt(n,t)}function Ol(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SPVFS[]",t,n),r.fv=Zt(n,t)}function Pl(r){var e=r.stack,t=r.pv;A.DEBUG&&console.log(r.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function Dl(r){var e=r.stack,t=r.fv;A.DEBUG&&console.log(r.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function Rl(r){r.fv=r.pv,A.DEBUG&&console.log(r.step,"SFVTPV[]")}function Ul(r){var e=r.stack,t=e.pop(),n=e.pop(),i=e.pop(),s=e.pop(),a=e.pop(),o=r.z0,c=r.z1,h=o[t],l=o[n],d=c[i],u=c[s],f=r.z2[a];A.DEBUG&&console.log("ISECT[], ",t,n,i,s,a);var y=h.x,m=h.y,x=l.x,v=l.y,w=d.x,S=d.y,_=u.x,T=u.y,B=(y-x)*(S-T)-(m-v)*(w-_),O=y*v-m*x,P=w*T-S*_;f.x=(O*(w-_)-P*(y-x))/B,f.y=(O*(S-T)-P*(m-v))/B}function Fl(r){r.rp0=r.stack.pop(),A.DEBUG&&console.log(r.step,"SRP0[]",r.rp0)}function Nl(r){r.rp1=r.stack.pop(),A.DEBUG&&console.log(r.step,"SRP1[]",r.rp1)}function zl(r){r.rp2=r.stack.pop(),A.DEBUG&&console.log(r.step,"SRP2[]",r.rp2)}function Gl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZP0[]",e),r.zp0=e,e){case 0:r.tZone||Rn(r),r.z0=r.tZone;break;case 1:r.z0=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function jl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZP1[]",e),r.zp1=e,e){case 0:r.tZone||Rn(r),r.z1=r.tZone;break;case 1:r.z1=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function Vl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZP2[]",e),r.zp2=e,e){case 0:r.tZone||Rn(r),r.z2=r.tZone;break;case 1:r.z2=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function Hl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZPS[]",e),r.zp0=r.zp1=r.zp2=e,e){case 0:r.tZone||Rn(r),r.z0=r.z1=r.z2=r.tZone;break;case 1:r.z0=r.z1=r.z2=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function Wl(r){r.loop=r.stack.pop(),A.DEBUG&&console.log(r.step,"SLOOP[]",r.loop)}function $l(r){A.DEBUG&&console.log(r.step,"RTG[]"),r.round=da}function ql(r){A.DEBUG&&console.log(r.step,"RTHG[]"),r.round=Il}function Xl(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SMD[]",e),r.minDis=e/64}function Yl(r){A.DEBUG&&console.log(r.step,"ELSE[]"),fa(r,!1)}function Zl(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"JMPR[]",e),r.ip+=e-1}function Kl(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SCVTCI[]",e),r.cvCutIn=e/64}function Jl(r){var e=r.stack;A.DEBUG&&console.log(r.step,"DUP[]"),e.push(e[e.length-1])}function Vr(r){A.DEBUG&&console.log(r.step,"POP[]"),r.stack.pop()}function Ql(r){A.DEBUG&&console.log(r.step,"CLEAR[]"),r.stack.length=0}function eu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SWAP[]"),e.push(t),e.push(n)}function tu(r){var e=r.stack;A.DEBUG&&console.log(r.step,"DEPTH[]"),e.push(e.length)}function nu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"LOOPCALL[]",t,n);var i=r.ip,s=r.prog;r.prog=r.funcs[t];for(var a=0;a<n;a++)gt(r),A.DEBUG&&console.log(++r.step,a+1<n?"next loopcall":"done loopcall",a);r.ip=i,r.prog=s}function ru(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"CALL[]",e);var t=r.ip,n=r.prog;r.prog=r.funcs[e],gt(r),r.ip=t,r.prog=n,A.DEBUG&&console.log(++r.step,"returning from",e)}function iu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"CINDEX[]",t),e.push(e[e.length-t])}function su(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"MINDEX[]",t),e.push(e.splice(e.length-t,1)[0])}function au(r){if(r.env!=="fpgm")throw new Error("FDEF not allowed here");var e=r.stack,t=r.prog,n=r.ip,i=e.pop(),s=n;for(A.DEBUG&&console.log(r.step,"FDEF[]",i);t[++n]!==45;);r.ip=n,r.funcs[i]=t.slice(s+1,n)}function xa(r,e){var t=e.stack.pop(),n=e.z0[t],i=e.fv,s=e.pv;A.DEBUG&&console.log(e.step,"MDAP["+r+"]",t);var a=s.distance(n,Kt);r&&(a=e.round(a)),i.setRelative(n,Kt,a,s),i.touch(n),e.rp0=e.rp1=t}function wa(r,e){var t=e.z2,n=t.length-2,i,s,a;A.DEBUG&&console.log(e.step,"IUP["+r.axis+"]");for(var o=0;o<n;o++)i=t[o],!r.touched(i)&&(s=i.prevTouched(r),s!==i&&(a=i.nextTouched(r),s===a&&r.setRelative(i,i,r.distance(s,s,!1,!0),r,!0),r.interpolate(i,s,a,r)))}function Sa(r,e){for(var t=e.stack,n=r?e.rp1:e.rp2,i=(r?e.z0:e.z1)[n],s=e.fv,a=e.pv,o=e.loop,c=e.z2;o--;){var h=t.pop(),l=c[h],d=a.distance(i,i,!1,!0);s.setRelative(l,l,d,a),s.touch(l),A.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-o)+": ":"")+"SHP["+(r?"rp1":"rp2")+"]",h)}e.loop=1}function _a(r,e){var t=e.stack,n=r?e.rp1:e.rp2,i=(r?e.z0:e.z1)[n],s=e.fv,a=e.pv,o=t.pop(),c=e.z2[e.contours[o]],h=c;A.DEBUG&&console.log(e.step,"SHC["+r+"]",o);var l=a.distance(i,i,!1,!0);do h!==i&&s.setRelative(h,h,l,a),h=h.nextPointOnContour;while(h!==c)}function Ca(r,e){var t=e.stack,n=r?e.rp1:e.rp2,i=(r?e.z0:e.z1)[n],s=e.fv,a=e.pv,o=t.pop();A.DEBUG&&console.log(e.step,"SHZ["+r+"]",o);var c;switch(o){case 0:c=e.tZone;break;case 1:c=e.gZone;break;default:throw new Error("Invalid zone")}for(var h,l=a.distance(i,i,!1,!0),d=c.length-2,u=0;u<d;u++)h=c[u],s.setRelative(h,h,l,a)}function ou(r){for(var e=r.stack,t=r.loop,n=r.fv,i=e.pop()/64,s=r.z2;t--;){var a=e.pop(),o=s[a];A.DEBUG&&console.log(r.step,(r.loop>1?"loop "+(r.loop-t)+": ":"")+"SHPIX[]",a,i),n.setRelative(o,o,i),n.touch(o)}r.loop=1}function cu(r){for(var e=r.stack,t=r.rp1,n=r.rp2,i=r.loop,s=r.z0[t],a=r.z1[n],o=r.fv,c=r.dpv,h=r.z2;i--;){var l=e.pop(),d=h[l];A.DEBUG&&console.log(r.step,(r.loop>1?"loop "+(r.loop-i)+": ":"")+"IP[]",l,t,"<->",n),o.interpolate(d,s,a,c),o.touch(d)}r.loop=1}function Ta(r,e){var t=e.stack,n=t.pop()/64,i=t.pop(),s=e.z1[i],a=e.z0[e.rp0],o=e.fv,c=e.pv;o.setRelative(s,a,n,c),o.touch(s),A.DEBUG&&console.log(e.step,"MSIRP["+r+"]",n,i),e.rp1=e.rp0,e.rp2=i,r&&(e.rp0=i)}function hu(r){for(var e=r.stack,t=r.rp0,n=r.z0[t],i=r.loop,s=r.fv,a=r.pv,o=r.z1;i--;){var c=e.pop(),h=o[c];A.DEBUG&&console.log(r.step,(r.loop>1?"loop "+(r.loop-i)+": ":"")+"ALIGNRP[]",c),s.setRelative(h,n,0,a),s.touch(h)}r.loop=1}function lu(r){A.DEBUG&&console.log(r.step,"RTDG[]"),r.round=Al}function Ea(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z0[i],a=e.fv,o=e.pv,c=e.cvt[n];A.DEBUG&&console.log(e.step,"MIAP["+r+"]",n,"(",c,")",i);var h=o.distance(s,Kt);r&&(Math.abs(h-c)<e.cvCutIn&&(h=c),h=e.round(h)),a.setRelative(s,Kt,h,o),e.zp0===0&&(s.xo=s.x,s.yo=s.y),a.touch(s),e.rp0=e.rp1=i}function uu(r){var e=r.prog,t=r.ip,n=r.stack,i=e[++t];A.DEBUG&&console.log(r.step,"NPUSHB[]",i);for(var s=0;s<i;s++)n.push(e[++t]);r.ip=t}function du(r){var e=r.ip,t=r.prog,n=r.stack,i=t[++e];A.DEBUG&&console.log(r.step,"NPUSHW[]",i);for(var s=0;s<i;s++){var a=t[++e]<<8|t[++e];a&32768&&(a=-((a^65535)+1)),n.push(a)}r.ip=e}function pu(r){var e=r.stack,t=r.store;t||(t=r.store=[]);var n=e.pop(),i=e.pop();A.DEBUG&&console.log(r.step,"WS",n,i),t[i]=n}function fu(r){var e=r.stack,t=r.store,n=e.pop();A.DEBUG&&console.log(r.step,"RS",n);var i=t&&t[n]||0;e.push(i)}function gu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"WCVTP",t,n),r.cvt[n]=t/64}function mu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"RCVT",t),e.push(r.cvt[t]*64)}function Aa(r,e){var t=e.stack,n=t.pop(),i=e.z2[n];A.DEBUG&&console.log(e.step,"GC["+r+"]",n),t.push(e.dpv.distance(i,Kt,r,!1)*64)}function Ia(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z1[n],a=e.z0[i],o=e.dpv.distance(a,s,r,r);A.DEBUG&&console.log(e.step,"MD["+r+"]",n,i,"->",o),e.stack.push(Math.round(o*64))}function yu(r){A.DEBUG&&console.log(r.step,"MPPEM[]"),r.stack.push(r.ppem)}function bu(r){A.DEBUG&&console.log(r.step,"FLIPON[]"),r.autoFlip=!0}function vu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"LT[]",t,n),e.push(n<t?1:0)}function xu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"LTEQ[]",t,n),e.push(n<=t?1:0)}function wu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"GT[]",t,n),e.push(n>t?1:0)}function Su(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"GTEQ[]",t,n),e.push(n>=t?1:0)}function _u(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"EQ[]",t,n),e.push(t===n?1:0)}function Cu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"NEQ[]",t,n),e.push(t!==n?1:0)}function Tu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function Eu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function Au(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"IF[]",e),e||(fa(r,!0),A.DEBUG&&console.log(r.step,"EIF[]"))}function Iu(r){A.DEBUG&&console.log(r.step,"EIF[]")}function Lu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"AND[]",t,n),e.push(t&&n?1:0)}function ku(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"OR[]",t,n),e.push(t||n?1:0)}function Bu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"NOT[]",t),e.push(t?0:1)}function Hr(r,e){var t=e.stack,n=t.pop(),i=e.fv,s=e.pv,a=e.ppem,o=e.deltaBase+(r-1)*16,c=e.deltaShift,h=e.z0;A.DEBUG&&console.log(e.step,"DELTAP["+r+"]",n,t);for(var l=0;l<n;l++){var d=t.pop(),u=t.pop(),f=o+((u&240)>>4);if(f===a){var y=(u&15)-8;y>=0&&y++,A.DEBUG&&console.log(e.step,"DELTAPFIX",d,"by",y*c);var m=h[d];i.setRelative(m,m,y*c,s)}}}function Mu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"SDB[]",t),r.deltaBase=t}function Ou(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"SDS[]",t),r.deltaShift=Math.pow(.5,t)}function Pu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"ADD[]",t,n),e.push(n+t)}function Du(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SUB[]",t,n),e.push(n-t)}function Ru(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"DIV[]",t,n),e.push(n*64/t)}function Uu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"MUL[]",t,n),e.push(n*t/64)}function Fu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"ABS[]",t),e.push(Math.abs(t))}function Nu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"NEG[]",t),e.push(-t)}function zu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function Gu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function Un(r,e){var t=e.stack,n=t.pop();A.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(n/64)*64)}function ju(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"WCVTF[]",t,n),r.cvt[n]=t*r.ppem/r.font.unitsPerEm}function Wr(r,e){var t=e.stack,n=t.pop(),i=e.ppem,s=e.deltaBase+(r-1)*16,a=e.deltaShift;A.DEBUG&&console.log(e.step,"DELTAC["+r+"]",n,t);for(var o=0;o<n;o++){var c=t.pop(),h=t.pop(),l=s+((h&240)>>4);if(l===i){var d=(h&15)-8;d>=0&&d++;var u=d*a;A.DEBUG&&console.log(e.step,"DELTACFIX",c,"by",u),e.cvt[c]+=u}}}function Vu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SROUND[]",e),r.round=pa;var t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(r.srPeriod=t,e&48){case 0:r.srPhase=0;break;case 16:r.srPhase=.25*t;break;case 32:r.srPhase=.5*t;break;case 48:r.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?r.srThreshold=0:r.srThreshold=(e/8-.5)*t}function Hu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"S45ROUND[]",e),r.round=pa;var t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(r.srPeriod=t,e&48){case 0:r.srPhase=0;break;case 16:r.srPhase=.25*t;break;case 32:r.srPhase=.5*t;break;case 48:r.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?r.srThreshold=0:r.srThreshold=(e/8-.5)*t}function Wu(r){A.DEBUG&&console.log(r.step,"ROFF[]"),r.round=El}function $u(r){A.DEBUG&&console.log(r.step,"RUTG[]"),r.round=Ll}function qu(r){A.DEBUG&&console.log(r.step,"RDTG[]"),r.round=kl}function Xu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SCANCTRL[]",e)}function La(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z2[n],a=e.z1[i];A.DEBUG&&console.log(e.step,"SDPVTL["+r+"]",n,i);var o,c;r?(o=s.y-a.y,c=a.x-s.x):(o=a.x-s.x,c=a.y-s.y),e.dpv=Zt(o,c)}function Yu(r){var e=r.stack,t=e.pop(),n=0;A.DEBUG&&console.log(r.step,"GETINFO[]",t),t&1&&(n=35),t&32&&(n|=4096),e.push(n)}function Zu(r){var e=r.stack,t=e.pop(),n=e.pop(),i=e.pop();A.DEBUG&&console.log(r.step,"ROLL[]"),e.push(n),e.push(t),e.push(i)}function Ku(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"MAX[]",t,n),e.push(Math.max(n,t))}function Ju(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"MIN[]",t,n),e.push(Math.min(n,t))}function Qu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SCANTYPE[]",e)}function ed(r){var e=r.stack.pop(),t=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"INSTCTRL[]",e,t),e){case 1:r.inhibitGridFit=!!t;return;case 2:r.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function rt(r,e){var t=e.stack,n=e.prog,i=e.ip;A.DEBUG&&console.log(e.step,"PUSHB["+r+"]");for(var s=0;s<r;s++)t.push(n[++i]);e.ip=i}function it(r,e){var t=e.ip,n=e.prog,i=e.stack;A.DEBUG&&console.log(e.ip,"PUSHW["+r+"]");for(var s=0;s<r;s++){var a=n[++t]<<8|n[++t];a&32768&&(a=-((a^65535)+1)),i.push(a)}e.ip=t}function U(r,e,t,n,i,s){var a=s.stack,o=r&&a.pop(),c=a.pop(),h=s.rp0,l=s.z0[h],d=s.z1[c],u=s.minDis,f=s.fv,y=s.dpv,m,x,v,w;x=m=y.distance(d,l,!0,!0),v=x>=0?1:-1,x=Math.abs(x),r&&(w=s.cvt[o],n&&Math.abs(x-w)<s.cvCutIn&&(x=w)),t&&x<u&&(x=u),n&&(x=s.round(x)),f.setRelative(d,l,v*x,y),f.touch(d),A.DEBUG&&console.log(s.step,(r?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(n?"R":"_")+(i===0?"Gr":i===1?"Bl":i===2?"Wh":"")+"]",r?o+"("+s.cvt[o]+","+w+")":"",c,"(d =",m,"->",v*x,")"),s.rp1=s.rp0,s.rp2=c,e&&(s.rp0=c)}ha=[ga.bind(void 0,Ye),ga.bind(void 0,Fe),ma.bind(void 0,Ye),ma.bind(void 0,Fe),ya.bind(void 0,Ye),ya.bind(void 0,Fe),ba.bind(void 0,0),ba.bind(void 0,1),va.bind(void 0,0),va.bind(void 0,1),Ml,Ol,Pl,Dl,Rl,Ul,Fl,Nl,zl,Gl,jl,Vl,Hl,Wl,$l,ql,Xl,Yl,Zl,Kl,void 0,void 0,Jl,Vr,Ql,eu,tu,iu,su,void 0,void 0,void 0,nu,ru,au,void 0,xa.bind(void 0,0),xa.bind(void 0,1),wa.bind(void 0,Ye),wa.bind(void 0,Fe),Sa.bind(void 0,0),Sa.bind(void 0,1),_a.bind(void 0,0),_a.bind(void 0,1),Ca.bind(void 0,0),Ca.bind(void 0,1),ou,cu,Ta.bind(void 0,0),Ta.bind(void 0,1),hu,lu,Ea.bind(void 0,0),Ea.bind(void 0,1),uu,du,pu,fu,gu,mu,Aa.bind(void 0,0),Aa.bind(void 0,1),void 0,Ia.bind(void 0,0),Ia.bind(void 0,1),yu,void 0,bu,void 0,void 0,vu,xu,wu,Su,_u,Cu,Tu,Eu,Au,Iu,Lu,ku,Bu,Hr.bind(void 0,1),Mu,Ou,Pu,Du,Ru,Uu,Fu,Nu,zu,Gu,Un.bind(void 0,0),Un.bind(void 0,1),Un.bind(void 0,2),Un.bind(void 0,3),void 0,void 0,void 0,void 0,ju,Hr.bind(void 0,2),Hr.bind(void 0,3),Wr.bind(void 0,1),Wr.bind(void 0,2),Wr.bind(void 0,3),Vu,Hu,void 0,void 0,Wu,void 0,$u,qu,Vr,Vr,void 0,void 0,void 0,void 0,void 0,Xu,La.bind(void 0,0),La.bind(void 0,1),Yu,void 0,Zu,Ku,Ju,Qu,ed,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,rt.bind(void 0,1),rt.bind(void 0,2),rt.bind(void 0,3),rt.bind(void 0,4),rt.bind(void 0,5),rt.bind(void 0,6),rt.bind(void 0,7),rt.bind(void 0,8),it.bind(void 0,1),it.bind(void 0,2),it.bind(void 0,3),it.bind(void 0,4),it.bind(void 0,5),it.bind(void 0,6),it.bind(void 0,7),it.bind(void 0,8),U.bind(void 0,0,0,0,0,0),U.bind(void 0,0,0,0,0,1),U.bind(void 0,0,0,0,0,2),U.bind(void 0,0,0,0,0,3),U.bind(void 0,0,0,0,1,0),U.bind(void 0,0,0,0,1,1),U.bind(void 0,0,0,0,1,2),U.bind(void 0,0,0,0,1,3),U.bind(void 0,0,0,1,0,0),U.bind(void 0,0,0,1,0,1),U.bind(void 0,0,0,1,0,2),U.bind(void 0,0,0,1,0,3),U.bind(void 0,0,0,1,1,0),U.bind(void 0,0,0,1,1,1),U.bind(void 0,0,0,1,1,2),U.bind(void 0,0,0,1,1,3),U.bind(void 0,0,1,0,0,0),U.bind(void 0,0,1,0,0,1),U.bind(void 0,0,1,0,0,2),U.bind(void 0,0,1,0,0,3),U.bind(void 0,0,1,0,1,0),U.bind(void 0,0,1,0,1,1),U.bind(void 0,0,1,0,1,2),U.bind(void 0,0,1,0,1,3),U.bind(void 0,0,1,1,0,0),U.bind(void 0,0,1,1,0,1),U.bind(void 0,0,1,1,0,2),U.bind(void 0,0,1,1,0,3),U.bind(void 0,0,1,1,1,0),U.bind(void 0,0,1,1,1,1),U.bind(void 0,0,1,1,1,2),U.bind(void 0,0,1,1,1,3),U.bind(void 0,1,0,0,0,0),U.bind(void 0,1,0,0,0,1),U.bind(void 0,1,0,0,0,2),U.bind(void 0,1,0,0,0,3),U.bind(void 0,1,0,0,1,0),U.bind(void 0,1,0,0,1,1),U.bind(void 0,1,0,0,1,2),U.bind(void 0,1,0,0,1,3),U.bind(void 0,1,0,1,0,0),U.bind(void 0,1,0,1,0,1),U.bind(void 0,1,0,1,0,2),U.bind(void 0,1,0,1,0,3),U.bind(void 0,1,0,1,1,0),U.bind(void 0,1,0,1,1,1),U.bind(void 0,1,0,1,1,2),U.bind(void 0,1,0,1,1,3),U.bind(void 0,1,1,0,0,0),U.bind(void 0,1,1,0,0,1),U.bind(void 0,1,1,0,0,2),U.bind(void 0,1,1,0,0,3),U.bind(void 0,1,1,0,1,0),U.bind(void 0,1,1,0,1,1),U.bind(void 0,1,1,0,1,2),U.bind(void 0,1,1,0,1,3),U.bind(void 0,1,1,1,0,0),U.bind(void 0,1,1,1,0,1),U.bind(void 0,1,1,1,0,2),U.bind(void 0,1,1,1,0,3),U.bind(void 0,1,1,1,1,0),U.bind(void 0,1,1,1,1,1),U.bind(void 0,1,1,1,1,2),U.bind(void 0,1,1,1,1,3)];function Ct(r){this.char=r,this.state={},this.activeState=null}function $r(r,e,t){this.contextName=t,this.startIndex=r,this.endOffset=e}function td(r,e,t){this.contextName=r,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=t}function Be(r,e){this.context=r,this.index=e,this.length=r.length,this.current=r[e],this.backtrack=r.slice(0,e),this.lookahead=r.slice(e+1)}function Fn(r){this.eventId=r,this.subscribers=[]}function nd(r){var e=this,t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];t.forEach(function(i){Object.defineProperty(e.events,i,{value:new Fn(i)})}),r&&t.forEach(function(i){var s=r[i];typeof s=="function"&&e.events[i].subscribe(s)});var n=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];n.forEach(function(i){e.events[i].subscribe(e.updateContextsRanges)})}function ne(r){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],nd.call(this,r)}Ct.prototype.setState=function(r,e){return this.state[r]=e,this.activeState={key:r,value:this.state[r]},this.activeState},Ct.prototype.getState=function(r){return this.state[r]||null},ne.prototype.inboundIndex=function(r){return r>=0&&r<this.tokens.length},ne.prototype.composeRUD=function(r){var e=this,t=!0,n=r.map(function(s){return e[s[0]].apply(e,s.slice(1).concat(t))}),i=function(s){return typeof s=="object"&&s.hasOwnProperty("FAIL")};if(n.every(i))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:n.filter(i)};this.dispatch("composeRUD",[n.filter(function(s){return!i(s)})])},ne.prototype.replaceRange=function(r,e,t,n){e=e!==null?e:this.tokens.length;var i=t.every(function(a){return a instanceof Ct});if(!isNaN(r)&&this.inboundIndex(r)&&i){var s=this.tokens.splice.apply(this.tokens,[r,e].concat(t));return n||this.dispatch("replaceToken",[r,e,t]),[s,t]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ne.prototype.replaceToken=function(r,e,t){if(!isNaN(r)&&this.inboundIndex(r)&&e instanceof Ct){var n=this.tokens.splice(r,1,e);return t||this.dispatch("replaceToken",[r,e]),[n[0],e]}else return{FAIL:"replaceToken: invalid token or index."}},ne.prototype.removeRange=function(r,e,t){e=isNaN(e)?this.tokens.length:e;var n=this.tokens.splice(r,e);return t||this.dispatch("removeRange",[n,r,e]),n},ne.prototype.removeToken=function(r,e){if(!isNaN(r)&&this.inboundIndex(r)){var t=this.tokens.splice(r,1);return e||this.dispatch("removeToken",[t,r]),t}else return{FAIL:"removeToken: invalid token index."}},ne.prototype.insertToken=function(r,e,t){var n=r.every(function(i){return i instanceof Ct});return n?(this.tokens.splice.apply(this.tokens,[e,0].concat(r)),t||this.dispatch("insertToken",[r,e]),r):{FAIL:"insertToken: invalid token(s)."}},ne.prototype.registerModifier=function(r,e,t){this.events.newToken.subscribe(function(n,i){var s=[n,i],a=e===null||e.apply(this,s)===!0,o=[n,i];if(a){var c=t.apply(this,o);n.setState(r,c)}}),this.registeredModifiers.push(r)},Fn.prototype.subscribe=function(r){return typeof r=="function"?this.subscribers.push(r)-1:{FAIL:"invalid '"+this.eventId+"' event handler"}},Fn.prototype.unsubscribe=function(r){this.subscribers.splice(r,1)},Be.prototype.setCurrentIndex=function(r){this.index=r,this.current=this.context[r],this.backtrack=this.context.slice(0,r),this.lookahead=this.context.slice(r+1)},Be.prototype.get=function(r){switch(!0){case r===0:return this.current;case(r<0&&Math.abs(r)<=this.backtrack.length):return this.backtrack.slice(r)[0];case(r>0&&r<=this.lookahead.length):return this.lookahead[r-1];default:return null}},ne.prototype.rangeToText=function(r){if(r instanceof $r)return this.getRangeTokens(r).map(function(e){return e.char}).join("")},ne.prototype.getText=function(){return this.tokens.map(function(r){return r.char}).join("")},ne.prototype.getContext=function(r){var e=this.registeredContexts[r];return e||null},ne.prototype.on=function(r,e){var t=this.events[r];return t?t.subscribe(e):null},ne.prototype.dispatch=function(r,e){var t=this,n=this.events[r];n instanceof Fn&&n.subscribers.forEach(function(i){i.apply(t,e||[])})},ne.prototype.registerContextChecker=function(r,e,t){if(this.getContext(r))return{FAIL:"context name '"+r+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof t!="function")return{FAIL:"missing context end check."};var n=new td(r,e,t);return this.registeredContexts[r]=n,this.contextCheckers.push(n),n},ne.prototype.getRangeTokens=function(r){var e=r.startIndex+r.endOffset;return[].concat(this.tokens.slice(r.startIndex,e))},ne.prototype.getContextRanges=function(r){var e=this.getContext(r);return e?e.ranges:{FAIL:"context checker '"+r+"' is not registered."}},ne.prototype.resetContextsRanges=function(){var r=this.registeredContexts;for(var e in r)if(r.hasOwnProperty(e)){var t=r[e];t.ranges=[]}},ne.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var r=this.tokens.map(function(n){return n.char}),e=0;e<r.length;e++){var t=new Be(r,e);this.runContextCheck(t)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ne.prototype.setEndOffset=function(r,e){var t=this.getContext(e).openRange.startIndex,n=new $r(t,r,e),i=this.getContext(e).ranges;return n.rangeId=e+"."+i.length,i.push(n),this.getContext(e).openRange=null,n},ne.prototype.runContextCheck=function(r){var e=this,t=r.index;this.contextCheckers.forEach(function(n){var i=n.contextName,s=e.getContext(i).openRange;if(!s&&n.checkStart(r)&&(s=new $r(t,null,i),e.getContext(i).openRange=s,e.dispatch("contextStart",[i,t])),s&&n.checkEnd(r)){var a=t-s.startIndex+1,o=e.setEndOffset(a,i);e.dispatch("contextEnd",[i,o])}})},ne.prototype.tokenize=function(r){this.tokens=[],this.resetContextsRanges();var e=Array.from(r);this.dispatch("start");for(var t=0;t<e.length;t++){var n=e[t],i=new Be(e,t);this.dispatch("next",[i]),this.runContextCheck(i);var s=new Ct(n);this.tokens.push(s),this.dispatch("newToken",[s,i])}return this.dispatch("end",[this.tokens]),this.tokens};function st(r){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(r)}function ka(r){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(r)}function at(r){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(r)}function Nn(r){return/[A-z]/.test(r)}function rd(r){return/\s/.test(r)}function _e(r){this.font=r,this.features={}}function mt(r){this.id=r.id,this.tag=r.tag,this.substitution=r.substitution}function Jt(r,e){if(!r)return-1;switch(e.format){case 1:return e.glyphs.indexOf(r);case 2:for(var t=e.ranges,n=0;n<t.length;n++){var i=t[n];if(r>=i.start&&r<=i.end){var s=r-i.start;return i.index+s}}break;default:return-1}return-1}function id(r,e){var t=Jt(r,e.coverage);return t===-1?null:r+e.deltaGlyphId}function sd(r,e){var t=Jt(r,e.coverage);return t===-1?null:e.substitute[t]}function qr(r,e){for(var t=[],n=0;n<r.length;n++){var i=r[n],s=e.current;s=Array.isArray(s)?s[0]:s;var a=Jt(s,i);a!==-1&&t.push(a)}return t.length!==r.length?-1:t}function ad(r,e){var t=e.inputCoverage.length+e.lookaheadCoverage.length+e.backtrackCoverage.length;if(r.context.length<t)return[];var n=qr(e.inputCoverage,r);if(n===-1)return[];var i=e.inputCoverage.length-1;if(r.lookahead.length<e.lookaheadCoverage.length)return[];for(var s=r.lookahead.slice(i);s.length&&at(s[0].char);)s.shift();var a=new Be(s,0),o=qr(e.lookaheadCoverage,a),c=[].concat(r.backtrack);for(c.reverse();c.length&&at(c[0].char);)c.shift();if(c.length<e.backtrackCoverage.length)return[];var h=new Be(c,0),l=qr(e.backtrackCoverage,h),d=n.length===e.inputCoverage.length&&o.length===e.lookaheadCoverage.length&&l.length===e.backtrackCoverage.length,u=[];if(d)for(var f=0;f<e.lookupRecords.length;f++)for(var y=e.lookupRecords[f],m=y.lookupListIndex,x=this.getLookupByIndex(m),v=0;v<x.subtables.length;v++){var w=x.subtables[v],S=this.getLookupMethod(x,w),_=this.getSubstitutionType(x,w);if(_==="12")for(var T=0;T<n.length;T++){var B=r.get(T),O=S(B);O&&u.push(O)}}return u}function od(r,e){var t=r.current,n=Jt(t,e.coverage);if(n===-1)return null;for(var i,s=e.ligatureSets[n],a=0;a<s.length;a++){i=s[a];for(var o=0;o<i.components.length;o++){var c=r.lookahead[o],h=i.components[o];if(c!==h)break;if(o===i.components.length-1)return i}}return null}function cd(r,e){var t=Jt(r,e.coverage);return t===-1?null:e.sequences[t]}_e.prototype.getDefaultScriptFeaturesIndexes=function(){for(var r=this.font.tables.gsub.scripts,e=0;e<r.length;e++){var t=r[e];if(t.tag==="DFLT")return t.script.defaultLangSys.featureIndexes}return[]},_e.prototype.getScriptFeaturesIndexes=function(r){var e=this.font.tables;if(!e.gsub)return[];if(!r)return this.getDefaultScriptFeaturesIndexes();for(var t=this.font.tables.gsub.scripts,n=0;n<t.length;n++){var i=t[n];if(i.tag===r&&i.script.defaultLangSys)return i.script.defaultLangSys.featureIndexes;var s=i.langSysRecords;if(s)for(var a=0;a<s.length;a++){var o=s[a];if(o.tag===r){var c=o.langSys;return c.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},_e.prototype.mapTagsToFeatures=function(r,e){for(var t={},n=0;n<r.length;n++){var i=r[n].tag,s=r[n].feature;t[i]=s}this.features[e].tags=t},_e.prototype.getScriptFeatures=function(r){var e=this.features[r];if(this.features.hasOwnProperty(r))return e;var t=this.getScriptFeaturesIndexes(r);if(!t)return null;var n=this.font.tables.gsub;return e=t.map(function(i){return n.features[i]}),this.features[r]=e,this.mapTagsToFeatures(e,r),e},_e.prototype.getSubstitutionType=function(r,e){var t=r.lookupType.toString(),n=e.substFormat.toString();return t+n},_e.prototype.getLookupMethod=function(r,e){var t=this,n=this.getSubstitutionType(r,e);switch(n){case"11":return function(i){return id.apply(t,[i,e])};case"12":return function(i){return sd.apply(t,[i,e])};case"63":return function(i){return ad.apply(t,[i,e])};case"41":return function(i){return od.apply(t,[i,e])};case"21":return function(i){return cd.apply(t,[i,e])};default:throw new Error("lookupType: "+r.lookupType+" - substFormat: "+e.substFormat+" is not yet supported")}},_e.prototype.lookupFeature=function(r){var e=r.contextParams,t=e.index,n=this.getFeature({tag:r.tag,script:r.script});if(!n)return new Error("font '"+this.font.names.fullName.en+"' doesn't support feature '"+r.tag+"' for script '"+r.script+"'.");for(var i=this.getFeatureLookups(n),s=[].concat(e.context),a=0;a<i.length;a++)for(var o=i[a],c=this.getLookupSubtables(o),h=0;h<c.length;h++){var l=c[h],d=this.getSubstitutionType(o,l),u=this.getLookupMethod(o,l),f=void 0;switch(d){case"11":f=u(e.current),f&&s.splice(t,1,new mt({id:11,tag:r.tag,substitution:f}));break;case"12":f=u(e.current),f&&s.splice(t,1,new mt({id:12,tag:r.tag,substitution:f}));break;case"63":f=u(e),Array.isArray(f)&&f.length&&s.splice(t,1,new mt({id:63,tag:r.tag,substitution:f}));break;case"41":f=u(e),f&&s.splice(t,1,new mt({id:41,tag:r.tag,substitution:f}));break;case"21":f=u(e.current),f&&s.splice(t,1,new mt({id:21,tag:r.tag,substitution:f}));break}e=new Be(s,t),!(Array.isArray(f)&&!f.length)&&(f=null)}return s.length?s:null},_e.prototype.supports=function(r){if(!r.script)return!1;this.getScriptFeatures(r.script);var e=this.features.hasOwnProperty(r.script);if(!r.tag)return e;var t=this.features[r.script].some(function(n){return n.tag===r.tag});return e&&t},_e.prototype.getLookupSubtables=function(r){return r.subtables||null},_e.prototype.getLookupByIndex=function(r){var e=this.font.tables.gsub.lookups;return e[r]||null},_e.prototype.getFeatureLookups=function(r){return r.lookupListIndexes.map(this.getLookupByIndex.bind(this))},_e.prototype.getFeature=function(r){if(!this.font)return{FAIL:"No font was found"};this.features.hasOwnProperty(r.script)||this.getScriptFeatures(r.script);var e=this.features[r.script];return e?e.tags[r.tag]?this.features[r.script].tags[r.tag]:null:{FAIL:"No feature for script "+r.script}};function hd(r){var e=r.current,t=r.get(-1);return t===null&&st(e)||!st(t)&&st(e)}function ld(r){var e=r.get(1);return e===null||!st(e)}var ud={startCheck:hd,endCheck:ld};function dd(r){var e=r.current,t=r.get(-1);return(st(e)||at(e))&&!st(t)}function pd(r){var e=r.get(1);switch(!0){case e===null:return!0;case(!st(e)&&!at(e)):var t=rd(e);if(!t)return!0;if(t){var n=!1;if(n=r.lookahead.some(function(i){return st(i)||at(i)}),!n)return!0}break;default:return!1}}var fd={startCheck:dd,endCheck:pd};function gd(r,e,t){e[t].setState(r.tag,r.substitution)}function md(r,e,t){e[t].setState(r.tag,r.substitution)}function yd(r,e,t){r.substitution.forEach(function(n,i){var s=e[t+i];s.setState(r.tag,n)})}function bd(r,e,t){var n=e[t];n.setState(r.tag,r.substitution.ligGlyph);for(var i=r.substitution.components.length,s=0;s<i;s++)n=e[t+s+1],n.setState("deleted",!0)}var Ba={11:gd,12:md,63:yd,41:bd};function Xr(r,e,t){r instanceof mt&&Ba[r.id]&&Ba[r.id](r,e,t)}function vd(r){for(var e=[].concat(r.backtrack),t=e.length-1;t>=0;t--){var n=e[t],i=ka(n),s=at(n);if(!i&&!s)return!0;if(i)return!1}return!1}function xd(r){if(ka(r.current))return!1;for(var e=0;e<r.lookahead.length;e++){var t=r.lookahead[e],n=at(t);if(!n)return!0}return!1}function wd(r){var e=this,t="arab",n=this.featuresTags[t],i=this.tokenizer.getRangeTokens(r);if(i.length!==1){var s=new Be(i.map(function(o){return o.getState("glyphIndex")}),0),a=new Be(i.map(function(o){return o.char}),0);i.forEach(function(o,c){if(!at(o.char)){s.setCurrentIndex(c),a.setCurrentIndex(c);var h=0;vd(a)&&(h|=1),xd(a)&&(h|=2);var l;switch(h){case 1:l="fina";break;case 2:l="init";break;case 3:l="medi";break}if(n.indexOf(l)!==-1){var d=e.query.lookupFeature({tag:l,script:t,contextParams:s});if(d instanceof Error)return console.info(d.message);d.forEach(function(u,f){u instanceof mt&&(Xr(u,i,f),s.context[f]=u.substitution)})}}})}}function Ma(r,e){var t=r.map(function(n){return n.activeState.value});return new Be(t,0)}function Sd(r){var e=this,t="arab",n=this.tokenizer.getRangeTokens(r),i=Ma(n);i.context.forEach(function(s,a){i.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"rlig",script:t,contextParams:i});o.length&&(o.forEach(function(c){return Xr(c,n,a)}),i=Ma(n))})}function _d(r){var e=r.current,t=r.get(-1);return t===null&&Nn(e)||!Nn(t)&&Nn(e)}function Cd(r){var e=r.get(1);return e===null||!Nn(e)}var Td={startCheck:_d,endCheck:Cd};function Oa(r,e){var t=r.map(function(n){return n.activeState.value});return new Be(t,0)}function Ed(r){var e=this,t="latn",n=this.tokenizer.getRangeTokens(r),i=Oa(n);i.context.forEach(function(s,a){i.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"liga",script:t,contextParams:i});o.length&&(o.forEach(function(c){return Xr(c,n,a)}),i=Oa(n))})}function Me(r){this.baseDir=r||"ltr",this.tokenizer=new ne,this.featuresTags={}}Me.prototype.setText=function(r){this.text=r},Me.prototype.contextChecks={latinWordCheck:Td,arabicWordCheck:ud,arabicSentenceCheck:fd};function Yr(r){var e=this.contextChecks[r+"Check"];return this.tokenizer.registerContextChecker(r,e.startCheck,e.endCheck)}function Ad(){return Yr.call(this,"latinWord"),Yr.call(this,"arabicWord"),Yr.call(this,"arabicSentence"),this.tokenizer.tokenize(this.text)}function Id(){var r=this,e=this.tokenizer.getContextRanges("arabicSentence");e.forEach(function(t){var n=r.tokenizer.getRangeTokens(t);r.tokenizer.replaceRange(t.startIndex,t.endOffset,n.reverse())})}Me.prototype.registerFeatures=function(r,e){var t=this,n=e.filter(function(i){return t.query.supports({script:r,tag:i})});this.featuresTags.hasOwnProperty(r)?this.featuresTags[r]=this.featuresTags[r].concat(n):this.featuresTags[r]=n},Me.prototype.applyFeatures=function(r,e){if(!r)throw new Error("No valid font was provided to apply features");this.query||(this.query=new _e(r));for(var t=0;t<e.length;t++){var n=e[t];this.query.supports({script:n.script})&&this.registerFeatures(n.script,n.tags)}},Me.prototype.registerModifier=function(r,e,t){this.tokenizer.registerModifier(r,e,t)};function Zr(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Ld(){var r=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){Zr.call(this);var t=this.tokenizer.getContextRanges("arabicWord");t.forEach(function(n){wd.call(r,n)})}}function kd(){var r=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){var t=this.featuresTags[e];if(t.indexOf("rlig")!==-1){Zr.call(this);var n=this.tokenizer.getContextRanges("arabicWord");n.forEach(function(i){Sd.call(r,i)})}}}function Bd(){var r=this,e="latn";if(this.featuresTags.hasOwnProperty(e)){var t=this.featuresTags[e];if(t.indexOf("liga")!==-1){Zr.call(this);var n=this.tokenizer.getContextRanges("latinWord");n.forEach(function(i){Ed.call(r,i)})}}}Me.prototype.checkContextReady=function(r){return!!this.tokenizer.getContext(r)},Me.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(Ld.call(this),kd.call(this)),this.checkContextReady("latinWord")&&Bd.call(this),this.checkContextReady("arabicSentence")&&Id.call(this)},Me.prototype.processText=function(r){(!this.text||this.text!==r)&&(this.setText(r),Ad.call(this),this.applyFeaturesToContexts())},Me.prototype.getBidiText=function(r){return this.processText(r),this.tokenizer.getText()},Me.prototype.getTextGlyphs=function(r){this.processText(r);for(var e=[],t=0;t<this.tokenizer.tokens.length;t++){var n=this.tokenizer.tokens[t];if(!n.state.deleted){var i=n.activeState.value;e.push(Array.isArray(i)?i[0]:i)}}return e};function q(r){r=r||{},r.tables=r.tables||{},r.empty||(Xt(r.familyName,"When creating a new Font object, familyName is required."),Xt(r.styleName,"When creating a new Font object, styleName is required."),Xt(r.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Xt(r.ascender,"When creating a new Font object, ascender is required."),Xt(r.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={fontFamily:{en:r.familyName||" "},fontSubfamily:{en:r.styleName||" "},fullName:{en:r.fullName||r.familyName+" "+r.styleName},postScriptName:{en:r.postScriptName||(r.familyName+r.styleName).replace(/\s/g,"")},designer:{en:r.designer||" "},designerURL:{en:r.designerURL||" "},manufacturer:{en:r.manufacturer||" "},manufacturerURL:{en:r.manufacturerURL||" "},license:{en:r.license||" "},licenseURL:{en:r.licenseURL||" "},version:{en:r.version||"Version 0.1"},description:{en:r.description||" "},copyright:{en:r.copyright||" "},trademark:{en:r.trademark||" "}},this.unitsPerEm=r.unitsPerEm||1e3,this.ascender=r.ascender,this.descender=r.descender,this.createdTimestamp=r.createdTimestamp,this.tables=Object.assign(r.tables,{os2:Object.assign({usWeightClass:r.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:r.widthClass||this.usWidthClasses.MEDIUM,fsSelection:r.fsSelection||this.fsSelectionValues.REGULAR},r.tables.os2)})),this.supported=!0,this.glyphs=new Ue.GlyphSet(this,r.glyphs||[]),this.encoding=new Ss(this),this.position=new qt(this),this.substitution=new Se(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new ua(this)}})}q.prototype.hasChar=function(r){return this.encoding.charToGlyphIndex(r)!==null},q.prototype.charToGlyphIndex=function(r){return this.encoding.charToGlyphIndex(r)},q.prototype.charToGlyph=function(r){var e=this.charToGlyphIndex(r),t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},q.prototype.updateFeatures=function(r){return this.defaultRenderOptions.features.map(function(e){return e.script==="latn"?{script:"latn",tags:e.tags.filter(function(t){return r[t]})}:e})},q.prototype.stringToGlyphs=function(r,e){var t=this,n=new Me,i=function(d){return t.charToGlyphIndex(d.char)};n.registerModifier("glyphIndex",null,i);var s=e?this.updateFeatures(e.features):this.defaultRenderOptions.features;n.applyFeatures(this,s);for(var a=n.getTextGlyphs(r),o=a.length,c=new Array(o),h=this.glyphs.get(0),l=0;l<o;l+=1)c[l]=this.glyphs.get(a[l])||h;return c},q.prototype.nameToGlyphIndex=function(r){return this.glyphNames.nameToGlyphIndex(r)},q.prototype.nameToGlyph=function(r){var e=this.nameToGlyphIndex(r),t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},q.prototype.glyphIndexToName=function(r){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(r):""},q.prototype.getKerningValue=function(r,e){r=r.index||r,e=e.index||e;var t=this.position.defaultKerningTables;return t?this.position.getKerningValue(t,r,e):this.kerningPairs[r+","+e]||0},q.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]}]},q.prototype.forEachGlyph=function(r,e,t,n,i,s){e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:72,i=Object.assign({},this.defaultRenderOptions,i);var a=1/this.unitsPerEm*n,o=this.stringToGlyphs(r,i),c;if(i.kerning){var h=i.script||this.position.getDefaultScriptName();c=this.position.getKerningTables(h,i.language)}for(var l=0;l<o.length;l+=1){var d=o[l];if(s.call(this,d,e,t,n,i),d.advanceWidth&&(e+=d.advanceWidth*a),i.kerning&&l<o.length-1){var u=c?this.position.getKerningValue(c,d.index,o[l+1].index):this.getKerningValue(d,o[l+1]);e+=u*a}i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e},q.prototype.getPath=function(r,e,t,n,i){var s=new ue;return this.forEachGlyph(r,e,t,n,i,function(a,o,c,h){var l=a.getPath(o,c,h,i,this);s.extend(l)}),s},q.prototype.getPaths=function(r,e,t,n,i){var s=[];return this.forEachGlyph(r,e,t,n,i,function(a,o,c,h){var l=a.getPath(o,c,h,i,this);s.push(l)}),s},q.prototype.getAdvanceWidth=function(r,e,t){return this.forEachGlyph(r,0,0,e,t,function(){})},q.prototype.draw=function(r,e,t,n,i,s){this.getPath(e,t,n,i,s).draw(r)},q.prototype.drawPoints=function(r,e,t,n,i,s){this.forEachGlyph(e,t,n,i,s,function(a,o,c,h){a.drawPoints(r,o,c,h)})},q.prototype.drawMetrics=function(r,e,t,n,i,s){this.forEachGlyph(e,t,n,i,s,function(a,o,c,h){a.drawMetrics(r,o,c,h)})},q.prototype.getEnglishName=function(r){var e=this.names[r];if(e)return e.en},q.prototype.validate=function(){var r=this;function e(t){var n=r.getEnglishName(t);n&&n.trim().length>0}e("fontFamily"),e("weightName"),e("manufacturer"),e("copyright"),e("version"),this.unitsPerEm>0},q.prototype.toTables=function(){return bl.fontToTable(this)},q.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},q.prototype.toArrayBuffer=function(){for(var r=this.toTables(),e=r.encode(),t=new ArrayBuffer(e.length),n=new Uint8Array(t),i=0;i<e.length;i++)n[i]=e[i];return t},q.prototype.download=function(r){var e=this.getEnglishName("fontFamily"),t=this.getEnglishName("fontSubfamily");r=r||e.replace(/\s/g,"")+"-"+t+".otf";var n=this.toArrayBuffer();if(xl())if(window.URL=window.URL||window.webkitURL,window.URL){var i=new DataView(n),s=new Blob([i],{type:"font/opentype"}),a=document.createElement("a");a.href=window.URL.createObjectURL(s),a.download=r;var o=document.createEvent("MouseEvents");o.initEvent("click",!0,!1),a.dispatchEvent(o)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{var c=require("fs"),h=wl(n);c.writeFileSync(r,h)}},q.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},q.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},q.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function Pa(r,e){var t=JSON.stringify(r),n=256;for(var i in e){var s=parseInt(i);if(!(!s||s<256)){if(JSON.stringify(e[i])===t)return s;n<=s&&(n=s+1)}}return e[n]=r,n}function Md(r,e,t){var n=Pa(e.name,t);return[{name:"tag_"+r,type:"TAG",value:e.tag},{name:"minValue_"+r,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+r,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+r,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+r,type:"USHORT",value:0},{name:"nameID_"+r,type:"USHORT",value:n}]}function Od(r,e,t){var n={},i=new F.Parser(r,e);return n.tag=i.parseTag(),n.minValue=i.parseFixed(),n.defaultValue=i.parseFixed(),n.maxValue=i.parseFixed(),i.skip("uShort",1),n.name=t[i.parseUShort()]||{},n}function Pd(r,e,t,n){for(var i=Pa(e.name,n),s=[{name:"nameID_"+r,type:"USHORT",value:i},{name:"flags_"+r,type:"USHORT",value:0}],a=0;a<t.length;++a){var o=t[a].tag;s.push({name:"axis_"+r+" "+o,type:"FIXED",value:e.coordinates[o]<<16})}return s}function Dd(r,e,t,n){var i={},s=new F.Parser(r,e);i.name=n[s.parseUShort()]||{},s.skip("uShort",1),i.coordinates={};for(var a=0;a<t.length;++a)i.coordinates[t[a].tag]=s.parseFixed();return i}function Rd(r,e){var t=new R.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:r.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:r.instances.length},{name:"instanceSize",type:"USHORT",value:4+r.axes.length*4}]);t.offsetToData=t.sizeOf();for(var n=0;n<r.axes.length;n++)t.fields=t.fields.concat(Md(n,r.axes[n],e));for(var i=0;i<r.instances.length;i++)t.fields=t.fields.concat(Pd(i,r.instances[i],r.axes,e));return t}function Ud(r,e,t){var n=new F.Parser(r,e),i=n.parseULong();z.argument(i===65536,"Unsupported fvar table version.");var s=n.parseOffset16();n.skip("uShort",1);for(var a=n.parseUShort(),o=n.parseUShort(),c=n.parseUShort(),h=n.parseUShort(),l=[],d=0;d<a;d++)l.push(Od(r,e+s+d*o,t));for(var u=[],f=e+s+a*o,y=0;y<c;y++)u.push(Dd(r,f+y*h,l,t));return{axes:l,instances:u}}var Fd={make:Rd,parse:Ud},Nd=function(){return{coverage:this.parsePointer(L.coverage),attachPoints:this.parseList(L.pointer(L.uShortList))}},zd=function(){var r=this.parseUShort();if(z.argument(r===1||r===2||r===3,"Unsupported CaretValue table version."),r===1)return{coordinate:this.parseShort()};if(r===2)return{pointindex:this.parseShort()};if(r===3)return{coordinate:this.parseShort()}},Gd=function(){return this.parseList(L.pointer(zd))},jd=function(){return{coverage:this.parsePointer(L.coverage),ligGlyphs:this.parseList(L.pointer(Gd))}},Vd=function(){return this.parseUShort(),this.parseList(L.pointer(L.coverage))};function Hd(r,e){e=e||0;var t=new L(r,e),n=t.parseVersion(1);z.argument(n===1||n===1.2||n===1.3,"Unsupported GDEF table version.");var i={version:n,classDef:t.parsePointer(L.classDef),attachList:t.parsePointer(Nd),ligCaretList:t.parsePointer(jd),markAttachClassDef:t.parsePointer(L.classDef)};return n>=1.2&&(i.markGlyphSets=t.parsePointer(Vd)),i}var Wd={parse:Hd},Oe=new Array(10);Oe[1]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{posFormat:1,coverage:this.parsePointer(L.coverage),value:this.parseValueRecord()};if(e===2)return{posFormat:2,coverage:this.parsePointer(L.coverage),values:this.parseValueRecordList()};z.assert(!1,"0x"+r.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Oe[2]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();z.assert(e===1||e===2,"0x"+r.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var t=this.parsePointer(L.coverage),n=this.parseUShort(),i=this.parseUShort();if(e===1)return{posFormat:e,coverage:t,valueFormat1:n,valueFormat2:i,pairSets:this.parseList(L.pointer(L.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(n),value2:this.parseValueRecord(i)}})))};if(e===2){var s=this.parsePointer(L.classDef),a=this.parsePointer(L.classDef),o=this.parseUShort(),c=this.parseUShort();return{posFormat:e,coverage:t,valueFormat1:n,valueFormat2:i,classDef1:s,classDef2:a,class1Count:o,class2Count:c,classRecords:this.parseList(o,L.list(c,function(){return{value1:this.parseValueRecord(n),value2:this.parseValueRecord(i)}}))}}},Oe[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Oe[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Oe[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Oe[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Oe[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Oe[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Oe[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function $d(r,e){e=e||0;var t=new L(r,e),n=t.parseVersion(1);return z.argument(n===1||n===1.1,"Unsupported GPOS table version "+n),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Oe)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Oe),variations:t.parseFeatureVariationsList()}}var qd=new Array(10);function Xd(r){return new R.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new R.ScriptList(r.scripts)},{name:"features",type:"TABLE",value:new R.FeatureList(r.features)},{name:"lookups",type:"TABLE",value:new R.LookupList(r.lookups,qd)}])}var Yd={parse:$d,make:Xd};function Zd(r){var e={};r.skip("uShort");var t=r.parseUShort();z.argument(t===0,"Unsupported kern sub-table version."),r.skip("uShort",2);var n=r.parseUShort();r.skip("uShort",3);for(var i=0;i<n;i+=1){var s=r.parseUShort(),a=r.parseUShort(),o=r.parseShort();e[s+","+a]=o}return e}function Kd(r){var e={};r.skip("uShort");var t=r.parseULong();t>1&&console.warn("Only the first kern subtable is supported."),r.skip("uLong");var n=r.parseUShort(),i=n&255;if(r.skip("uShort"),i===0){var s=r.parseUShort();r.skip("uShort",3);for(var a=0;a<s;a+=1){var o=r.parseUShort(),c=r.parseUShort(),h=r.parseShort();e[o+","+c]=h}}return e}function Jd(r,e){var t=new F.Parser(r,e),n=t.parseUShort();if(n===0)return Zd(t);if(n===1)return Kd(t);throw new Error("Unsupported kern table version ("+n+").")}var Qd={parse:Jd};function ep(r,e,t,n){for(var i=new F.Parser(r,e),s=n?i.parseUShort:i.parseULong,a=[],o=0;o<t+1;o+=1){var c=s.call(i);n&&(c*=2),a.push(c)}return a}var tp={parse:ep};function Da(r,e){for(var t=[],n=12,i=0;i<e;i+=1){var s=F.getTag(r,n),a=F.getULong(r,n+4),o=F.getULong(r,n+8),c=F.getULong(r,n+12);t.push({tag:s,checksum:a,offset:o,length:c,compression:!1}),n+=16}return t}function np(r,e){for(var t=[],n=44,i=0;i<e;i+=1){var s=F.getTag(r,n),a=F.getULong(r,n+4),o=F.getULong(r,n+8),c=F.getULong(r,n+12),h=void 0;o<c?h="WOFF":h=!1,t.push({tag:s,offset:a,compression:h,compressedLength:o,length:c}),n+=20}return t}function se(r,e){if(e.compression==="WOFF"){var t=new Uint8Array(r.buffer,e.offset+2,e.compressedLength-2),n=new Uint8Array(e.length);if(Yc(t,n),n.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");var i=new DataView(n.buffer,0);return{data:i,offset:0}}else return{data:r,offset:e.offset}}function rp(r,e){e=e??{};var t,n,i=new q({empty:!0}),s=new DataView(r,0),a,o=[],c=F.getTag(s,0);if(c==="\0\0\0"||c==="true"||c==="typ1")i.outlinesFormat="truetype",a=F.getUShort(s,4),o=Da(s,a);else if(c==="OTTO")i.outlinesFormat="cff",a=F.getUShort(s,4),o=Da(s,a);else if(c==="wOFF"){var h=F.getTag(s,4);if(h==="\0\0\0")i.outlinesFormat="truetype";else if(h==="OTTO")i.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+c);a=F.getUShort(s,12),o=np(s,a)}else throw new Error("Unsupported OpenType signature "+c);for(var l,d,u,f,y,m,x,v,w,S,_,T,B=0;B<a;B+=1){var O=o[B],P=void 0;switch(O.tag){case"cmap":P=se(s,O),i.tables.cmap=ws.parse(P.data,P.offset),i.encoding=new _s(i.tables.cmap);break;case"cvt ":P=se(s,O),T=new F.Parser(P.data,P.offset),i.tables.cvt=T.parseShortList(O.length/2);break;case"fvar":d=O;break;case"fpgm":P=se(s,O),T=new F.Parser(P.data,P.offset),i.tables.fpgm=T.parseByteList(O.length);break;case"head":P=se(s,O),i.tables.head=Us.parse(P.data,P.offset),i.unitsPerEm=i.tables.head.unitsPerEm,t=i.tables.head.indexToLocFormat;break;case"hhea":P=se(s,O),i.tables.hhea=Fs.parse(P.data,P.offset),i.ascender=i.tables.hhea.ascender,i.descender=i.tables.hhea.descender,i.numberOfHMetrics=i.tables.hhea.numberOfHMetrics;break;case"hmtx":x=O;break;case"ltag":P=se(s,O),n=zs.parse(P.data,P.offset);break;case"maxp":P=se(s,O),i.tables.maxp=Gs.parse(P.data,P.offset),i.numGlyphs=i.tables.maxp.numGlyphs;break;case"name":S=O;break;case"OS/2":P=se(s,O),i.tables.os2=Ur.parse(P.data,P.offset);break;case"post":P=se(s,O),i.tables.post=Ys.parse(P.data,P.offset),i.glyphNames=new Br(i.tables.post);break;case"prep":P=se(s,O),T=new F.Parser(P.data,P.offset),i.tables.prep=T.parseByteList(O.length);break;case"glyf":u=O;break;case"loca":w=O;break;case"CFF ":l=O;break;case"kern":v=O;break;case"GDEF":f=O;break;case"GPOS":y=O;break;case"GSUB":m=O;break;case"meta":_=O;break}}var V=se(s,S);if(i.tables.name=Xs.parse(V.data,V.offset,n),i.names=i.tables.name,u&&w){var H=t===0,J=se(s,w),pe=tp.parse(J.data,J.offset,i.numGlyphs,H),ae=se(s,u);i.glyphs=ca.parse(ae.data,ae.offset,pe,i,e)}else if(l){var $=se(s,l);Rs.parse($.data,$.offset,i,e)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");var X=se(s,x);if(Ns.parse(i,X.data,X.offset,i.numberOfHMetrics,i.numGlyphs,i.glyphs,e),mh(i,e),v){var Y=se(s,v);i.kerningPairs=Qd.parse(Y.data,Y.offset)}else i.kerningPairs={};if(f){var te=se(s,f);i.tables.gdef=Wd.parse(te.data,te.offset)}if(y){var ce=se(s,y);i.tables.gpos=Yd.parse(ce.data,ce.offset),i.position.init()}if(m){var re=se(s,m);i.tables.gsub=Zs.parse(re.data,re.offset)}if(d){var he=se(s,d);i.tables.fvar=Fd.parse(he.data,he.offset,i.names)}if(_){var j=se(s,_);i.tables.meta=Ks.parse(j.data,j.offset),i.metas=i.tables.meta}return i}function Ra(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},a={},o=r[0].morphTargetsRelative,c=new fe.BufferGeometry;let h=0;for(let l=0;l<r.length;++l){const d=r[l];let u=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in d.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(d.attributes[f]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in d.morphAttributes){if(!i.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphAttributes must be consistent throughout all geometries."),null;a[f]===void 0&&(a[f]=[]),a[f].push(d.morphAttributes[f])}if(e){let f;if(t)f=d.index.count;else if(d.attributes.position!==void 0)f=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". The geometry must have either an index or a position attribute"),null;c.addGroup(h,f,l),h+=f}}if(t){let l=0;const d=[];for(let u=0;u<r.length;++u){const f=r[u].index;for(let y=0;y<f.count;++y)d.push(f.getX(y)+l);l+=r[u].attributes.position.count}c.setIndex(d)}for(const l in s){const d=Ua(s[l]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" attribute."),null;c.setAttribute(l,d)}for(const l in a){const d=a[l][0].length;if(d===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[l]=[];for(let u=0;u<d;++u){const f=[];for(let m=0;m<a[l].length;++m)f.push(a[l][m][u]);const y=Ua(f);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" morphAttribute."),null;c.morphAttributes[l].push(y)}}return c}function Ua(r){let e,t,n,i=-1,s=0;for(let h=0;h<r.length;++h){const l=r[h];if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=l.normalized),n!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=l.gpuType),i!==l.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=l.count*t}const a=new e(s),o=new fe.BufferAttribute(a,t,n);let c=0;for(let h=0;h<r.length;++h){const l=r[h];if(l.isInterleavedBufferAttribute){const d=c/t;for(let u=0,f=l.count;u<f;u++)for(let y=0;y<t;y++){const m=l.getComponent(u,y);o.setComponent(u+d,y,m)}}else a.set(l.array,c);c+=l.count*t}return i!==void 0&&(o.gpuType=i),o}function ip(r,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=r.getIndex(),i=r.getAttribute("position"),s=n?n.count:i.count;let a=0;const o=Object.keys(r.attributes),c={},h={},l=[],d=["getX","getY","getZ","getW"],u=["setX","setY","setZ","setW"];for(let w=0,S=o.length;w<S;w++){const _=o[w],T=r.attributes[_];c[_]=new T.constructor(new T.array.constructor(T.count*T.itemSize),T.itemSize,T.normalized);const B=r.morphAttributes[_];B&&(h[_]||(h[_]=[]),B.forEach((O,P)=>{const V=new O.array.constructor(O.count*O.itemSize);h[_][P]=new O.constructor(V,O.itemSize,O.normalized)}))}const f=e*.5,y=Math.log10(1/e),m=Math.pow(10,y),x=f*m;for(let w=0;w<s;w++){const S=n?n.getX(w):w;let _="";for(let T=0,B=o.length;T<B;T++){const O=o[T],P=r.getAttribute(O),V=P.itemSize;for(let H=0;H<V;H++)_+=`${~~(P[d[H]](S)*m+x)},`}if(_ in t)l.push(t[_]);else{for(let T=0,B=o.length;T<B;T++){const O=o[T],P=r.getAttribute(O),V=r.morphAttributes[O],H=P.itemSize,J=c[O],pe=h[O];for(let ae=0;ae<H;ae++){const $=d[ae],X=u[ae];if(J[X](a,P[$](S)),V)for(let Y=0,te=V.length;Y<te;Y++)pe[Y][X](a,V[Y][$](S))}}t[_]=a,l.push(a),a++}}const v=r.clone();for(const w in r.attributes){const S=c[w];if(v.setAttribute(w,new S.constructor(S.array.slice(0,a*S.itemSize),S.itemSize,S.normalized)),w in h)for(let _=0;_<h[w].length;_++){const T=h[w][_];v.morphAttributes[w][_]=new T.constructor(T.array.slice(0,a*T.itemSize),T.itemSize,T.normalized)}}return v.setIndex(l),v}new C.Vector2;class Fa extends Yi{constructor(e,t,n){super(),this.isFound=!1,this.char=e,this.fontSize=t,this.font=n,this.width=this.getCharWidth(e,t,n)}toGeometry(){let e=this.font.cache.getGeometry(this.char.charCodeAt(0),this.fontSize);if(e==null){const t=this.font.generateShapes(this.char,this.fontSize);return e=new C.ShapeGeometry(t,4),e.hasAttribute("uv")&&e.deleteAttribute("uv"),e.hasAttribute("normal")&&e.deleteAttribute("normal"),ip(e,1e-6)}return e}getCharWidth(e,t,n){const i=n.data.glyphs[e];return i?(this.isFound=!0,i.ha*t/n.data.resolution):(this.isFound=!1,0)}}class sp{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const n=[],i=ap(e,t,this.data);for(let s=0,a=i.length;s<a;s++)n.push(...i[s].toShapes());return n}}function ap(r,e,t){const n=Array.from(r),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,a=[];let o=0,c=0;for(let h=0;h<n.length;h++){const l=n[h];if(l===`
279
+ `,document.head.appendChild(e)}formatNumber(e,t){switch(t){case"angle":return e.toFixed(2);case"distance":case"point":default:return e.toFixed(3)}}getPoint(e){return this.getPointInternal(e)}getNumberTyped(e,t){const n=()=>({value:0,raw:{x:""}});return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!1,useBasePoint:!1,handler:t,getDynamicValue:n})}getDistance(e){if(!this.lastPoint)return this.getNumberTyped(e,new Ri(e));const t=i=>{const s=i.x-this.lastPoint.x,a=i.y-this.lastPoint.y,o=Math.sqrt(s*s+a*a);return{value:o,raw:{x:this.formatNumber(o,"distance")}}},n=new Ri(e);return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!e.useDashedLine,useBasePoint:!0,basePoint:e.basePoint,handler:n,getDynamicValue:t})}getAngle(e){const t=i=>{const s=i.x-this.lastPoint.x,a=i.y-this.lastPoint.y,c=Math.atan2(a,s)*180/Math.PI;return{value:c,raw:{x:this.formatNumber(c,"angle")}}},n=new yc(e);return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!e.useDashedLine,useBasePoint:!0,basePoint:e.basePoint,handler:n,getDynamicValue:t})}getDouble(e){return this.getNumberTyped(e,new bc(e))}getInteger(e){return this.getNumberTyped(e,new vc(e))}getString(e){const t=()=>({value:"",raw:{x:""}}),n=new wc(e);return this.makePromise({message:e.message,twoInputs:!1,jig:e.jig,showBaseLineOnly:!1,useBasePoint:!1,handler:n,getDynamicValue:t})}async getBox(){const e=ie.t("main.inputManager.firstCorner"),t=new qe(e);t.useDashedLine=!1,t.useBasePoint=!1;const n=await this.getPoint(t),i=this.view.wcs2Cwcs(n),s=document.createElement("div");s.className="ml-jig-preview-rect",document.body.appendChild(s);const a=()=>{s.remove()},o=d=>{const u=this.view.wcs2Cwcs(d),f=Math.min(u.x,i.x),y=Math.min(u.y,i.y),m=Math.abs(u.x-i.x),x=Math.abs(u.y-i.y);Object.assign(s.style,{left:`${f}px`,top:`${y}px`,width:`${m}px`,height:`${x}px`})},c=ie.t("main.inputManager.secondCorner"),h=new qe(c);h.useDashedLine=!1,h.useBasePoint=!1;const l=await this.getPointInternal(h,a,o);return new I.AcGeBox2d().expandByPoint(n).expandByPoint(l)}getPointInternal(e,t,n){const i=a=>({value:{x:a.x,y:a.y,z:0},raw:{x:this.formatNumber(a.x,"point"),y:this.formatNumber(a.y,"point")}}),s=new xc(e);return this.makePromise({message:e.message,twoInputs:!0,jig:e.jig,showBaseLineOnly:!e.useDashedLine,useBasePoint:e.useBasePoint,basePoint:e.basePoint,cleanup:t,handler:s,getDynamicValue:i,drawPreview:n})}makePromise(e){return new Promise((t,n)=>{this.active=!0;const i=d=>{const u=e.handler.parse(d.x,d.y);return{isValid:u!=null,value:u??void 0}};let s;e.useBasePoint&&(e.basePoint?s=e.basePoint:this.lastPoint&&(s={x:this.lastPoint.x,y:this.lastPoint.y}));const a=new ur(this.view,{parent:this.view.canvas,twoInputs:e.twoInputs,message:e.message,disableOSnap:e.disableOSnap,showBaseLineOnly:e.showBaseLineOnly,basePoint:s,validate:i,getDynamicValue:e.getDynamicValue,drawPreview:d=>{var u;if(e.jig){const f=e.getDynamicValue(d);e.jig.update(f.value),e.jig.render()}(u=e.drawPreview)==null||u.call(e,d)},onCommit:d=>{c(d),a.lastPoint&&(this.lastPoint={x:a.lastPoint.x,y:a.lastPoint.y})},onCancel:()=>h()}),o=()=>{var d,u;this.active=!1,(d=e.cleanup)==null||d.call(e),(u=e.jig)==null||u.end(),document.removeEventListener("keydown",l),a.dispose()},c=d=>{o(),t(d)},h=()=>{o(),n(new Error("cancelled"))},l=d=>{d.key==="Escape"&&h()};document.addEventListener("keydown",l),a.showAt(this.view.curMousePos)})}};gn.stylesInjected=!1;let Sn=gn;class Vi{constructor(e){this.events={sysVarChanged:new I.AcCmEventManager},this._view=e,this._cursorManager=new Mi(e),this._inputManager=new Sn(e)}get isActive(){return this._inputManager.isActive}get currentCursor(){return this._currentCursor}restoreCursor(){this._previousCursor!=null&&this.setCursor(this._previousCursor)}setCursor(e){this._cursorManager.setCursor(e),this._previousCursor=this._currentCursor,this._currentCursor=e}async getPoint(e){return await this._inputManager.getPoint(e)}async getAngle(e){return await this._inputManager.getAngle(e)}async getDistance(e){return await this._inputManager.getDistance(e)}async getString(e){return await this._inputManager.getString(e)}async getSelection(){return await this._inputManager.getBox()}}class _n{constructor(e){this.view=e}render(){this.entity&&this.view.addTransientEntity(this.entity)}end(){this.entity&&this.view.removeTransientEntity(this.entity.objectId)}}class Hi{constructor(e=[]){this.events={selectionAdded:new I.AcCmEventManager,selectionRemoved:new I.AcCmEventManager},this._ids=new Set(e)}get ids(){return Array.from(this._ids)}get count(){return this._ids.size}add(e){Array.isArray(e)?(e.forEach(t=>this._ids.add(t)),this.events.selectionAdded.dispatch({ids:e})):(this._ids.add(e),this.events.selectionAdded.dispatch({ids:[e]}))}delete(e){Array.isArray(e)?(e.forEach(t=>this._ids.delete(t)),this.events.selectionRemoved.dispatch({ids:e})):(this._ids.delete(e),this.events.selectionRemoved.dispatch({ids:[e]}))}has(e){return this._ids.has(e)}clear(){if(this._ids.size>0){const e=Array.from(this._ids);this._ids.clear(),this.events.selectionRemoved.dispatch({ids:e})}}}var Xe=(r=>(r[r.SELECTION=0]="SELECTION",r[r.PAN=1]="PAN",r))(Xe||{});class Wi{constructor(e){this.events={mouseMove:new I.AcCmEventManager,viewResize:new I.AcCmEventManager,hover:new I.AcCmEventManager,unhover:new I.AcCmEventManager},this._canvas=e;const t=e.getBoundingClientRect();this._bbox=new I.AcGeBox3d,this._width=t.width,this._height=t.height,this._curPos=new I.AcGePoint2d,this._curMousePos=new I.AcGePoint2d,this._selectionSet=new Hi,this._editor=new Vi(this),this._canvas.addEventListener("mousemove",n=>this.onMouseMove(n)),this._canvas.addEventListener("mousedown",n=>{n.button===1&&this._editor.setCursor(vt.Grab)}),this._canvas.addEventListener("mouseup",n=>{n.button===1&&this._editor.restoreCursor()}),window.addEventListener("resize",this.onWindowResize.bind(this)),this._selectionBoxSize=4,this._hoverTimer=null,this._pauseTimer=null,this._hoveredObjectId=null}get editor(){return this._editor}get selectionBoxSize(){return this._selectionBoxSize}set selectionBoxSize(e){this._selectionBoxSize=e}setCursor(e){this._editor.setCursor(e)}setCalculateSizeCallback(e){this._calculateSizeCallback=e}get width(){return this._width}set width(e){this._width=e}get height(){return this._height}set height(e){this._height=e}get bbox(){return this._bbox}get canvas(){return this._canvas}get aspect(){return this._width/this._height}get curPos(){return this._curPos}get curMousePos(){return this._curMousePos}get selectionSet(){return this._selectionSet}onWindowResize(){if(this._calculateSizeCallback){const{width:e,height:t}=this._calculateSizeCallback();this._width=e,this._height=t}else this._width=this._canvas.clientWidth,this._height=this._canvas.clientHeight;this.events.viewResize.dispatch({width:this._width,height:this._height})}onMouseMove(e){this._curMousePos=new I.AcGePoint2d(e.clientX,e.clientY);const t=this.cwcs2Wcs(this._curMousePos);this._curPos.copy(t),this.events.mouseMove.dispatch({x:t.x,y:t.y}),this.mode==0&&(this._editor.isActive||this.startHoverTimer(t.x,t.y))}setHoveredObjectId(e){this._hoveredObjectId&&(this.events.unhover.dispatch({id:this._hoveredObjectId,x:this.curMousePos.x,y:this.curMousePos.y}),this.onUnhover(this._hoveredObjectId)),this._hoveredObjectId=e,e&&(this.startPauseTimer(e),this.onHover(e))}hoverAt(e,t){const n=this.pick({x:e,y:t});n.length>0?this.setHoveredObjectId(n[0]):(this.setHoveredObjectId(null),this.clearPauseTimer())}clearHoverTimer(){this._hoverTimer&&clearTimeout(this._hoverTimer)}clearPauseTimer(){this._pauseTimer&&clearTimeout(this._pauseTimer)}startHoverTimer(e,t){this.clearHoverTimer(),this._hoverTimer=setTimeout(()=>{this.hoverAt(e,t)},50)}startPauseTimer(e){this._pauseTimer=setTimeout(()=>{this.events.hover.dispatch({id:e,x:this.curMousePos.x,y:this.curMousePos.y})},500)}}class $i{constructor(){this._fileName="",this._docTitle="",this._isReadOnly=!0,this._database=new I.AcDbDatabase,this.docTitle="Untitled"}async openUri(e,t){this._uri=e,this._isReadOnly=t&&t.readOnly||!1,this._fileName=this.getFileNameFromUri(e);let n=!0;try{await this._database.openUri(e,t),this.docTitle=this._fileName}catch{n=!1,$e.emit("failed-to-open-file",{fileName:e})}return n}async openDocument(e,t,n){var s;let i=!0;this._fileName=e;try{const a=(s=e.split(".").pop())==null?void 0:s.toLocaleLowerCase();await this._database.read(t,n,a=="dwg"?I.AcDbFileType.DWG:I.AcDbFileType.DXF),this.docTitle=this._fileName}catch(a){i=!1,$e.emit("failed-to-open-file",{fileName:e}),console.error(a)}return i}get uri(){return this._uri}get database(){return this._database}get docTitle(){return this._docTitle}set docTitle(e){this._docTitle=e,typeof document<"u"&&(document.title=e)}get isReadOnly(){return this._isReadOnly}getFileNameFromUri(e){try{const n=new URL(e).pathname.split("/");return n[n.length-1]||""}catch(t){return console.error("Invalid URI:",t),""}}}class qi{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const n of this.listeners)n.call(null,e,...t)}}class Ac{constructor(){this.cache=new Map}hasGeometry(e,t){const n=this.generateKey(e,t);return this.cache.has(n)}getGeometry(e,t){const n=this.generateKey(e,t);if(this.cache.has(n))return this.cache.get(n)}setGeometry(e,t,n){const i=this.generateKey(e,t);this.cache.set(i,n)}dispose(){for(const e of this.cache.values())e.dispose();this.cache.clear()}generateKey(e,t){return`${e}_${t}`}}class Xi{constructor(e){this.names=new Set,this.unsupportedChars={},this.encoding=e.encoding,e.alias.forEach(t=>this.names.add(t)),this.cache=new Ac}addUnsupportedChar(e){this.unsupportedChars[e]||(this.unsupportedChars[e]=0),this.unsupportedChars[e]++}}class Yi extends C.Shape{constructor(){super(...arguments),this.width=0}}const dr=(r,e)=>e.some(t=>r instanceof t);let Zi,Ki;function Ic(){return Zi||(Zi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Lc(){return Ki||(Ki=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const pr=new WeakMap,fr=new WeakMap,Cn=new WeakMap;function kc(r){const e=new Promise((t,n)=>{const i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",a)},s=()=>{t(ut(r.result)),i()},a=()=>{n(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",a)});return Cn.set(e,r),e}function Bc(r){if(pr.has(r))return;const e=new Promise((t,n)=>{const i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",a),r.removeEventListener("abort",a)},s=()=>{t(),i()},a=()=>{n(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",a),r.addEventListener("abort",a)});pr.set(r,e)}let gr={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return pr.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return ut(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function Ji(r){gr=r(gr)}function Mc(r){return Lc().includes(r)?function(...e){return r.apply(mr(this),e),ut(this.request)}:function(...e){return ut(r.apply(mr(this),e))}}function Oc(r){return typeof r=="function"?Mc(r):(r instanceof IDBTransaction&&Bc(r),dr(r,Ic())?new Proxy(r,gr):r)}function ut(r){if(r instanceof IDBRequest)return kc(r);if(fr.has(r))return fr.get(r);const e=Oc(r);return e!==r&&(fr.set(r,e),Cn.set(e,r)),e}const mr=r=>Cn.get(r);function Pc(r,e,{blocked:t,upgrade:n,blocking:i,terminated:s}={}){const a=indexedDB.open(r,e),o=ut(a);return n&&a.addEventListener("upgradeneeded",c=>{n(ut(a.result),c.oldVersion,c.newVersion,ut(a.transaction),c)}),t&&a.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),o.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",h=>i(h.oldVersion,h.newVersion,h))}).catch(()=>{}),o}const Dc=["get","getKey","getAll","getAllKeys","count"],Rc=["put","add","delete","clear"],yr=new Map;function Qi(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(yr.get(e))return yr.get(e);const t=e.replace(/FromIndex$/,""),n=e!==t,i=Rc.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(i||Dc.includes(t)))return;const s=async function(a,...o){const c=this.transaction(a,i?"readwrite":"readonly");let h=c.store;return n&&(h=h.index(o.shift())),(await Promise.all([h[t](...o),i&&c.done]))[0]};return yr.set(e,s),s}Ji(r=>({...r,get:(e,t,n)=>Qi(e,t)||r.get(e,t,n),has:(e,t)=>!!Qi(e,t)||r.has(e,t)}));const Uc=["continue","continuePrimaryKey","advance"],es={},br=new WeakMap,ts=new WeakMap,Fc={get(r,e){if(!Uc.includes(e))return r[e];let t=es[e];return t||(t=es[e]=function(...n){br.set(this,ts.get(this)[e](...n))}),t}};async function*Nc(...r){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...r)),!e)return;e=e;const t=new Proxy(e,Fc);for(ts.set(t,e),Cn.set(t,mr(e));e;)yield t,e=await(br.get(t)||e.continue()),br.delete(t)}function ns(r,e){return e===Symbol.asyncIterator&&dr(r,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&dr(r,[IDBIndex,IDBObjectStore])}Ji(r=>({...r,get(e,t,n){return ns(e,t)?Nc:r.get(e,t,n)},has(e,t){return ns(e,t)||r.has(e,t)}}));const dt={fonts:"fonts"},vr=[{version:1,stores:[{name:dt.fonts,keyPath:"name"}]},{version:2,stores:[{name:dt.fonts,keyPath:"name"}]}],xr=class We{constructor(){this.isClosing=!1,typeof window<"u"&&window.addEventListener("unload",()=>{this.close()})}static get instance(){return We._instance||(We._instance=new We),We._instance}async set(e,t){await(await this.getDatabase()).put(dt.fonts,{...t,name:e})}async get(e){return await(await this.getDatabase()).get(dt.fonts,e)}async delete(e){await(await this.getDatabase()).delete(dt.fonts,e)}async getAll(){return await(await this.getDatabase()).getAll(dt.fonts)}async clear(){await(await this.getDatabase()).clear(dt.fonts)}async has(e){return await this.get(e)!==void 0}close(){if(!this.isClosing){this.isClosing=!0;try{this.db&&(this.db.close(),this.db=void 0)}finally{this.isClosing=!1}}}async destroy(){this.close(),await indexedDB.deleteDatabase(We.DATABASE_NAME),We._instance=void 0}async getDatabase(){if(this.isClosing)throw new Error("Cannot perform operation while database is closing");return this.db?this.db:(this.db=await Pc(We.DATABASE_NAME,We.DATABASE_VERSION,{upgrade:(e,t,n)=>this.handleUpgrade(e,t,n),blocked(){console.warn("Database upgrade blocked - please close other tabs using the application")},blocking(){console.warn("Database blocking newer version - closing connection"),We.instance.close()}}),this.db)}handleUpgrade(e,t,n){const i=vr.filter(s=>s.version>t&&(!n||s.version<=n));for(const s of i)this.applySchemaVersion(e,s)}applySchemaVersion(e,t){for(const n of t.stores)e.objectStoreNames.contains(n.name)||e.createObjectStore(n.name,{keyPath:n.keyPath})}};xr.DATABASE_NAME="mlightcad",xr.DATABASE_VERSION=vr[vr.length-1].version;let wr=xr;const rs=r=>r.split("/").pop(),is=r=>{const e=rs(r);if(e){const t=e.lastIndexOf(".");return t===-1?e:e.substring(0,t)}return r},zc=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0],Gc=r=>zc[r];/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var r=function(){try{var t={},n=Object.defineProperty,i=n(t,t,t)&&n}catch{}return i}(),e=function(t){if(this==null)throw TypeError();var n=String(this),i=n.length,s=t?Number(t):0;if(s!=s&&(s=0),!(s<0||s>=i)){var a=n.charCodeAt(s),o;return a>=55296&&a<=56319&&i>s+1&&(o=n.charCodeAt(s+1),o>=56320&&o<=57343)?(a-55296)*1024+o-56320+65536:a}};r?r(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();var Sr=0,ss=-3;function jt(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function jc(r,e){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new jt,this.dtree=new jt}var as=new jt,os=new jt,_r=new Uint8Array(30),Cr=new Uint16Array(30),cs=new Uint8Array(30),hs=new Uint16Array(30),Vc=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ls=new jt,De=new Uint8Array(320);function us(r,e,t,n){var i,s;for(i=0;i<t;++i)r[i]=0;for(i=0;i<30-t;++i)r[i+t]=i/t|0;for(s=n,i=0;i<30;++i)e[i]=s,s+=1<<r[i]}function Hc(r,e){var t;for(t=0;t<7;++t)r.table[t]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,t=0;t<24;++t)r.trans[t]=256+t;for(t=0;t<144;++t)r.trans[24+t]=t;for(t=0;t<8;++t)r.trans[168+t]=280+t;for(t=0;t<112;++t)r.trans[176+t]=144+t;for(t=0;t<5;++t)e.table[t]=0;for(e.table[5]=32,t=0;t<32;++t)e.trans[t]=t}var ds=new Uint16Array(16);function Tr(r,e,t,n){var i,s;for(i=0;i<16;++i)r.table[i]=0;for(i=0;i<n;++i)r.table[e[t+i]]++;for(r.table[0]=0,s=0,i=0;i<16;++i)ds[i]=s,s+=r.table[i];for(i=0;i<n;++i)e[t+i]&&(r.trans[ds[e[t+i]]++]=i)}function Wc(r){r.bitcount--||(r.tag=r.source[r.sourceIndex++],r.bitcount=7);var e=r.tag&1;return r.tag>>>=1,e}function Re(r,e,t){if(!e)return t;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<<r.bitcount,r.bitcount+=8;var n=r.tag&65535>>>16-e;return r.tag>>>=e,r.bitcount-=e,n+t}function Er(r,e){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<<r.bitcount,r.bitcount+=8;var t=0,n=0,i=0,s=r.tag;do n=2*n+(s&1),s>>>=1,++i,t+=e.table[i],n-=e.table[i];while(n>=0);return r.tag=s,r.bitcount-=i,e.trans[t+n]}function $c(r,e,t){var n,i,s,a,o,c;for(n=Re(r,5,257),i=Re(r,5,1),s=Re(r,4,4),a=0;a<19;++a)De[a]=0;for(a=0;a<s;++a){var h=Re(r,3,0);De[Vc[a]]=h}for(Tr(ls,De,0,19),o=0;o<n+i;){var l=Er(r,ls);switch(l){case 16:var d=De[o-1];for(c=Re(r,2,3);c;--c)De[o++]=d;break;case 17:for(c=Re(r,3,3);c;--c)De[o++]=0;break;case 18:for(c=Re(r,7,11);c;--c)De[o++]=0;break;default:De[o++]=l;break}}Tr(e,De,0,n),Tr(t,De,n,i)}function ps(r,e,t){for(;;){var n=Er(r,e);if(n===256)return Sr;if(n<256)r.dest[r.destLen++]=n;else{var i,s,a,o;for(n-=257,i=Re(r,_r[n],Cr[n]),s=Er(r,t),a=r.destLen-Re(r,cs[s],hs[s]),o=a;o<a+i;++o)r.dest[r.destLen++]=r.dest[o]}}}function qc(r){for(var e,t,n;r.bitcount>8;)r.sourceIndex--,r.bitcount-=8;if(e=r.source[r.sourceIndex+1],e=256*e+r.source[r.sourceIndex],t=r.source[r.sourceIndex+3],t=256*t+r.source[r.sourceIndex+2],e!==(~t&65535))return ss;for(r.sourceIndex+=4,n=e;n;--n)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,Sr}function Xc(r,e){var t=new jc(r,e),n,i,s;do{switch(n=Wc(t),i=Re(t,2,0),i){case 0:s=qc(t);break;case 1:s=ps(t,as,os);break;case 2:$c(t,t.ltree,t.dtree),s=ps(t,t.ltree,t.dtree);break;default:s=ss}if(s!==Sr)throw new Error("Data error")}while(!n);return t.destLen<t.dest.length?typeof t.dest.slice=="function"?t.dest.slice(0,t.destLen):t.dest.subarray(0,t.destLen):t.dest}Hc(as,os),us(_r,Cr,4,3),us(cs,hs,2,1),_r[28]=0,Cr[28]=258;var Yc=Xc;function xt(r,e,t,n,i){return Math.pow(1-i,3)*r+3*Math.pow(1-i,2)*i*e+3*(1-i)*Math.pow(i,2)*t+Math.pow(i,3)*n}function et(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}et.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},et.prototype.addPoint=function(r,e){typeof r=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=r,this.x2=r),r<this.x1&&(this.x1=r),r>this.x2&&(this.x2=r)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},et.prototype.addX=function(r){this.addPoint(r,null)},et.prototype.addY=function(r){this.addPoint(null,r)},et.prototype.addBezier=function(r,e,t,n,i,s,a,o){var c=[r,e],h=[t,n],l=[i,s],d=[a,o];this.addPoint(r,e),this.addPoint(a,o);for(var u=0;u<=1;u++){var f=6*c[u]-12*h[u]+6*l[u],y=-3*c[u]+9*h[u]-9*l[u]+3*d[u],m=3*h[u]-3*c[u];if(y===0){if(f===0)continue;var x=-m/f;0<x&&x<1&&(u===0&&this.addX(xt(c[u],h[u],l[u],d[u],x)),u===1&&this.addY(xt(c[u],h[u],l[u],d[u],x)));continue}var v=Math.pow(f,2)-4*m*y;if(!(v<0)){var w=(-f+Math.sqrt(v))/(2*y);0<w&&w<1&&(u===0&&this.addX(xt(c[u],h[u],l[u],d[u],w)),u===1&&this.addY(xt(c[u],h[u],l[u],d[u],w)));var S=(-f-Math.sqrt(v))/(2*y);0<S&&S<1&&(u===0&&this.addX(xt(c[u],h[u],l[u],d[u],S)),u===1&&this.addY(xt(c[u],h[u],l[u],d[u],S)))}}},et.prototype.addQuad=function(r,e,t,n,i,s){var a=r+.6666666666666666*(t-r),o=e+2/3*(n-e),c=a+1/3*(i-r),h=o+1/3*(s-e);this.addBezier(r,e,a,o,c,h,i,s)};function ue(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}ue.prototype.moveTo=function(r,e){this.commands.push({type:"M",x:r,y:e})},ue.prototype.lineTo=function(r,e){this.commands.push({type:"L",x:r,y:e})},ue.prototype.curveTo=ue.prototype.bezierCurveTo=function(r,e,t,n,i,s){this.commands.push({type:"C",x1:r,y1:e,x2:t,y2:n,x:i,y:s})},ue.prototype.quadTo=ue.prototype.quadraticCurveTo=function(r,e,t,n){this.commands.push({type:"Q",x1:r,y1:e,x:t,y:n})},ue.prototype.close=ue.prototype.closePath=function(){this.commands.push({type:"Z"})},ue.prototype.extend=function(r){if(r.commands)r=r.commands;else if(r instanceof et){var e=r;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,r)},ue.prototype.getBoundingBox=function(){for(var r=new et,e=0,t=0,n=0,i=0,s=0;s<this.commands.length;s++){var a=this.commands[s];switch(a.type){case"M":r.addPoint(a.x,a.y),e=n=a.x,t=i=a.y;break;case"L":r.addPoint(a.x,a.y),n=a.x,i=a.y;break;case"Q":r.addQuad(n,i,a.x1,a.y1,a.x,a.y),n=a.x,i=a.y;break;case"C":r.addBezier(n,i,a.x1,a.y1,a.x2,a.y2,a.x,a.y),n=a.x,i=a.y;break;case"Z":n=e,i=t;break;default:throw new Error("Unexpected path command "+a.type)}}return r.isEmpty()&&r.addPoint(0,0),r},ue.prototype.draw=function(r){r.beginPath();for(var e=0;e<this.commands.length;e+=1){var t=this.commands[e];t.type==="M"?r.moveTo(t.x,t.y):t.type==="L"?r.lineTo(t.x,t.y):t.type==="C"?r.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y):t.type==="Q"?r.quadraticCurveTo(t.x1,t.y1,t.x,t.y):t.type==="Z"&&r.closePath()}this.fill&&(r.fillStyle=this.fill,r.fill()),this.stroke&&(r.strokeStyle=this.stroke,r.lineWidth=this.strokeWidth,r.stroke())},ue.prototype.toPathData=function(r){r=r!==void 0?r:2;function e(a){return Math.round(a)===a?""+Math.round(a):a.toFixed(r)}function t(){for(var a=arguments,o="",c=0;c<arguments.length;c+=1){var h=a[c];h>=0&&c>0&&(o+=" "),o+=e(h)}return o}for(var n="",i=0;i<this.commands.length;i+=1){var s=this.commands[i];s.type==="M"?n+="M"+t(s.x,s.y):s.type==="L"?n+="L"+t(s.x,s.y):s.type==="C"?n+="C"+t(s.x1,s.y1,s.x2,s.y2,s.x,s.y):s.type==="Q"?n+="Q"+t(s.x1,s.y1,s.x,s.y):s.type==="Z"&&(n+="Z")}return n},ue.prototype.toSVG=function(r){var e='<path d="';return e+=this.toPathData(r),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e},ue.prototype.toDOMElement=function(r){var e=this.toPathData(r),t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",e),t};function fs(r){throw new Error(r)}function gs(r,e){r||fs(e)}var z={fail:fs,argument:gs,assert:gs},ms=32768,ys=2147483648,wt={},D={},G={};function Le(r){return function(){return r}}D.BYTE=function(r){return z.argument(r>=0&&r<=255,"Byte value should be between 0 and 255."),[r]},G.BYTE=Le(1),D.CHAR=function(r){return[r.charCodeAt(0)]},G.CHAR=Le(1),D.CHARARRAY=function(r){typeof r>"u"&&(r="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],t=0;t<r.length;t+=1)e[t]=r.charCodeAt(t);return e},G.CHARARRAY=function(r){return typeof r>"u"?0:r.length},D.USHORT=function(r){return[r>>8&255,r&255]},G.USHORT=Le(2),D.SHORT=function(r){return r>=ms&&(r=-(2*ms-r)),[r>>8&255,r&255]},G.SHORT=Le(2),D.UINT24=function(r){return[r>>16&255,r>>8&255,r&255]},G.UINT24=Le(3),D.ULONG=function(r){return[r>>24&255,r>>16&255,r>>8&255,r&255]},G.ULONG=Le(4),D.LONG=function(r){return r>=ys&&(r=-(2*ys-r)),[r>>24&255,r>>16&255,r>>8&255,r&255]},G.LONG=Le(4),D.FIXED=D.ULONG,G.FIXED=G.ULONG,D.FWORD=D.SHORT,G.FWORD=G.SHORT,D.UFWORD=D.USHORT,G.UFWORD=G.USHORT,D.LONGDATETIME=function(r){return[0,0,0,0,r>>24&255,r>>16&255,r>>8&255,r&255]},G.LONGDATETIME=Le(8),D.TAG=function(r){return z.argument(r.length===4,"Tag should be exactly 4 ASCII characters."),[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3)]},G.TAG=Le(4),D.Card8=D.BYTE,G.Card8=G.BYTE,D.Card16=D.USHORT,G.Card16=G.USHORT,D.OffSize=D.BYTE,G.OffSize=G.BYTE,D.SID=D.USHORT,G.SID=G.USHORT,D.NUMBER=function(r){return r>=-107&&r<=107?[r+139]:r>=108&&r<=1131?(r=r-108,[(r>>8)+247,r&255]):r>=-1131&&r<=-108?(r=-r-108,[(r>>8)+251,r&255]):r>=-32768&&r<=32767?D.NUMBER16(r):D.NUMBER32(r)},G.NUMBER=function(r){return D.NUMBER(r).length},D.NUMBER16=function(r){return[28,r>>8&255,r&255]},G.NUMBER16=Le(3),D.NUMBER32=function(r){return[29,r>>24&255,r>>16&255,r>>8&255,r&255]},G.NUMBER32=Le(5),D.REAL=function(r){var e=r.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){var n=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(r*n)/n).toString()}for(var i="",s=0,a=e.length;s<a;s+=1){var o=e[s];o==="e"?i+=e[++s]==="-"?"c":"b":o==="."?i+="a":o==="-"?i+="e":i+=o}i+=i.length&1?"f":"ff";for(var c=[30],h=0,l=i.length;h<l;h+=2)c.push(parseInt(i.substr(h,2),16));return c},G.REAL=function(r){return D.REAL(r).length},D.NAME=D.CHARARRAY,G.NAME=G.CHARARRAY,D.STRING=D.CHARARRAY,G.STRING=G.CHARARRAY,wt.UTF8=function(r,e,t){for(var n=[],i=t,s=0;s<i;s++,e+=1)n[s]=r.getUint8(e);return String.fromCharCode.apply(null,n)},wt.UTF16=function(r,e,t){for(var n=[],i=t/2,s=0;s<i;s++,e+=2)n[s]=r.getUint16(e);return String.fromCharCode.apply(null,n)},D.UTF16=function(r){for(var e=[],t=0;t<r.length;t+=1){var n=r.charCodeAt(t);e[e.length]=n>>8&255,e[e.length]=n&255}return e},G.UTF16=function(r){return r.length*2};var Ar={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};wt.MACSTRING=function(r,e,t,n){var i=Ar[n];if(i!==void 0){for(var s="",a=0;a<t;a++){var o=r.getUint8(e+a);o<=127?s+=String.fromCharCode(o):s+=i[o&127]}return s}};var Tn=typeof WeakMap=="function"&&new WeakMap,En,Zc=function(r){if(!En){En={};for(var e in Ar)En[e]=new String(e)}var t=En[r];if(t!==void 0){if(Tn){var n=Tn.get(t);if(n!==void 0)return n}var i=Ar[r];if(i!==void 0){for(var s={},a=0;a<i.length;a++)s[i.charCodeAt(a)]=a+128;return Tn&&Tn.set(t,s),s}}};D.MACSTRING=function(r,e){var t=Zc(e);if(t!==void 0){for(var n=[],i=0;i<r.length;i++){var s=r.charCodeAt(i);if(s>=128&&(s=t[s],s===void 0))return;n[i]=s}return n}},G.MACSTRING=function(r,e){var t=D.MACSTRING(r,e);return t!==void 0?t.length:0};function Ir(r){return r>=-128&&r<=127}function Kc(r,e,t){for(var n=0,i=r.length;e<i&&n<64&&r[e]===0;)++e,++n;return t.push(128|n-1),e}function Jc(r,e,t){for(var n=0,i=r.length,s=e;s<i&&n<64;){var a=r[s];if(!Ir(a)||a===0&&s+1<i&&r[s+1]===0)break;++s,++n}t.push(n-1);for(var o=e;o<s;++o)t.push(r[o]+256&255);return s}function Qc(r,e,t){for(var n=0,i=r.length,s=e;s<i&&n<64;){var a=r[s];if(a===0||Ir(a)&&s+1<i&&Ir(r[s+1]))break;++s,++n}t.push(64|n-1);for(var o=e;o<s;++o){var c=r[o];t.push(c+65536>>8&255,c+256&255)}return s}D.VARDELTAS=function(r){for(var e=0,t=[];e<r.length;){var n=r[e];n===0?e=Kc(r,e,t):n>=-128&&n<=127?e=Jc(r,e,t):e=Qc(r,e,t)}return t},D.INDEX=function(r){for(var e=1,t=[e],n=[],i=0;i<r.length;i+=1){var s=D.OBJECT(r[i]);Array.prototype.push.apply(n,s),e+=s.length,t.push(e)}if(n.length===0)return[0,0];for(var a=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,c=[void 0,D.BYTE,D.USHORT,D.UINT24,D.ULONG][o],h=0;h<t.length;h+=1){var l=c(t[h]);Array.prototype.push.apply(a,l)}return Array.prototype.concat(D.Card16(r.length),D.OffSize(o),a,n)},G.INDEX=function(r){return D.INDEX(r).length},D.DICT=function(r){for(var e=[],t=Object.keys(r),n=t.length,i=0;i<n;i+=1){var s=parseInt(t[i],0),a=r[s];e=e.concat(D.OPERAND(a.value,a.type)),e=e.concat(D.OPERATOR(s))}return e},G.DICT=function(r){return D.DICT(r).length},D.OPERATOR=function(r){return r<1200?[r]:[12,r-1200]},D.OPERAND=function(r,e){var t=[];if(Array.isArray(e))for(var n=0;n<e.length;n+=1)z.argument(r.length===e.length,"Not enough arguments given for type"+e),t=t.concat(D.OPERAND(r[n],e[n]));else if(e==="SID")t=t.concat(D.NUMBER(r));else if(e==="offset")t=t.concat(D.NUMBER32(r));else if(e==="number")t=t.concat(D.NUMBER(r));else if(e==="real")t=t.concat(D.REAL(r));else throw new Error("Unknown operand type "+e);return t},D.OP=D.BYTE,G.OP=G.BYTE;var An=typeof WeakMap=="function"&&new WeakMap;D.CHARSTRING=function(r){if(An){var e=An.get(r);if(e!==void 0)return e}for(var t=[],n=r.length,i=0;i<n;i+=1){var s=r[i];t=t.concat(D[s.type](s.value))}return An&&An.set(r,t),t},G.CHARSTRING=function(r){return D.CHARSTRING(r).length},D.OBJECT=function(r){var e=D[r.type];return z.argument(e!==void 0,"No encoding function for type "+r.type),e(r.value)},G.OBJECT=function(r){var e=G[r.type];return z.argument(e!==void 0,"No sizeOf function for type "+r.type),e(r.value)},D.TABLE=function(r){for(var e=[],t=r.fields.length,n=[],i=[],s=0;s<t;s+=1){var a=r.fields[s],o=D[a.type];z.argument(o!==void 0,"No encoding function for field type "+a.type+" ("+a.name+")");var c=r[a.name];c===void 0&&(c=a.value);var h=o(c);a.type==="TABLE"?(i.push(e.length),e=e.concat([0,0]),n.push(h)):e=e.concat(h)}for(var l=0;l<n.length;l+=1){var d=i[l],u=e.length;z.argument(u<65536,"Table "+r.tableName+" too big."),e[d]=u>>8,e[d+1]=u&255,e=e.concat(n[l])}return e},G.TABLE=function(r){for(var e=0,t=r.fields.length,n=0;n<t;n+=1){var i=r.fields[n],s=G[i.type];z.argument(s!==void 0,"No sizeOf function for field type "+i.type+" ("+i.name+")");var a=r[i.name];a===void 0&&(a=i.value),e+=s(a),i.type==="TABLE"&&(e+=2)}return e},D.RECORD=D.TABLE,G.RECORD=G.TABLE,D.LITERAL=function(r){return r},G.LITERAL=function(r){return r.length};function de(r,e,t){if(e.length&&(e[0].name!=="coverageFormat"||e[0].value===1))for(var n=0;n<e.length;n+=1){var i=e[n];this[i.name]=i.value}if(this.tableName=r,this.fields=e,t)for(var s=Object.keys(t),a=0;a<s.length;a+=1){var o=s[a],c=t[o];this[o]!==void 0&&(this[o]=c)}}de.prototype.encode=function(){return D.TABLE(this)},de.prototype.sizeOf=function(){return G.TABLE(this)};function Vt(r,e,t){t===void 0&&(t=e.length);var n=new Array(e.length+1);n[0]={name:r+"Count",type:"USHORT",value:t};for(var i=0;i<e.length;i++)n[i+1]={name:r+i,type:"USHORT",value:e[i]};return n}function Lr(r,e,t){var n=e.length,i=new Array(n+1);i[0]={name:r+"Count",type:"USHORT",value:n};for(var s=0;s<n;s++)i[s+1]={name:r+s,type:"TABLE",value:t(e[s],s)};return i}function Ht(r,e,t){var n=e.length,i=[];i[0]={name:r+"Count",type:"USHORT",value:n};for(var s=0;s<n;s++)i=i.concat(t(e[s],s));return i}function In(r){r.format===1?de.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Vt("glyph",r.glyphs))):r.format===2?de.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Ht("rangeRecord",r.ranges,function(e){return[{name:"startGlyphID",type:"USHORT",value:e.start},{name:"endGlyphID",type:"USHORT",value:e.end},{name:"startCoverageIndex",type:"USHORT",value:e.index}]}))):z.assert(!1,"Coverage format must be 1 or 2.")}In.prototype=Object.create(de.prototype),In.prototype.constructor=In;function Ln(r){de.call(this,"scriptListTable",Ht("scriptRecord",r,function(e,t){var n=e.script,i=n.defaultLangSys;return z.assert(!!i,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new de("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new de("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:i.reqFeatureIndex}].concat(Vt("featureIndex",i.featureIndexes)))}].concat(Ht("langSys",n.langSysRecords,function(s,a){var o=s.langSys;return[{name:"langSysTag"+a,type:"TAG",value:s.tag},{name:"langSys"+a,type:"TABLE",value:new de("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:o.reqFeatureIndex}].concat(Vt("featureIndex",o.featureIndexes)))}]})))}]}))}Ln.prototype=Object.create(de.prototype),Ln.prototype.constructor=Ln;function kn(r){de.call(this,"featureListTable",Ht("featureRecord",r,function(e,t){var n=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new de("featureTable",[{name:"featureParams",type:"USHORT",value:n.featureParams}].concat(Vt("lookupListIndex",n.lookupListIndexes)))}]}))}kn.prototype=Object.create(de.prototype),kn.prototype.constructor=kn;function Bn(r,e){de.call(this,"lookupListTable",Lr("lookup",r,function(t){var n=e[t.lookupType];return z.assert(!!n,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new de("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(Lr("subtable",t.subtables,n)))}))}Bn.prototype=Object.create(de.prototype),Bn.prototype.constructor=Bn;var R={Table:de,Record:de,Coverage:In,ScriptList:Ln,FeatureList:kn,LookupList:Bn,ushortList:Vt,tableList:Lr,recordList:Ht};function bs(r,e){return r.getUint8(e)}function Mn(r,e){return r.getUint16(e,!1)}function eh(r,e){return r.getInt16(e,!1)}function kr(r,e){return r.getUint32(e,!1)}function vs(r,e){var t=r.getInt16(e,!1),n=r.getUint16(e+2,!1);return t+n/65535}function th(r,e){for(var t="",n=e;n<e+4;n+=1)t+=String.fromCharCode(r.getInt8(n));return t}function nh(r,e,t){for(var n=0,i=0;i<t;i+=1)n<<=8,n+=r.getUint8(e+i);return n}function rh(r,e,t){for(var n=[],i=e;i<t;i+=1)n.push(r.getUint8(i));return n}function ih(r){for(var e="",t=0;t<r.length;t+=1)e+=String.fromCharCode(r[t]);return e}var sh={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function L(r,e){this.data=r,this.offset=e,this.relativeOffset=0}L.prototype.parseByte=function(){var r=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,r},L.prototype.parseChar=function(){var r=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,r},L.prototype.parseCard8=L.prototype.parseByte,L.prototype.parseUShort=function(){var r=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,r},L.prototype.parseCard16=L.prototype.parseUShort,L.prototype.parseSID=L.prototype.parseUShort,L.prototype.parseOffset16=L.prototype.parseUShort,L.prototype.parseShort=function(){var r=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,r},L.prototype.parseF2Dot14=function(){var r=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,r},L.prototype.parseULong=function(){var r=kr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,r},L.prototype.parseOffset32=L.prototype.parseULong,L.prototype.parseFixed=function(){var r=vs(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,r},L.prototype.parseString=function(r){var e=this.data,t=this.offset+this.relativeOffset,n="";this.relativeOffset+=r;for(var i=0;i<r;i++)n+=String.fromCharCode(e.getUint8(t+i));return n},L.prototype.parseTag=function(){return this.parseString(4)},L.prototype.parseLongDateTime=function(){var r=kr(this.data,this.offset+this.relativeOffset+4);return r-=2082844800,this.relativeOffset+=8,r},L.prototype.parseVersion=function(r){var e=Mn(this.data,this.offset+this.relativeOffset),t=Mn(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,r===void 0&&(r=4096),e+t/r/10},L.prototype.skip=function(r,e){e===void 0&&(e=1),this.relativeOffset+=sh[r]*e},L.prototype.parseULongList=function(r){r===void 0&&(r=this.parseULong());for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getUint32(n),n+=4;return this.relativeOffset+=r*4,e},L.prototype.parseOffset16List=L.prototype.parseUShortList=function(r){r===void 0&&(r=this.parseUShort());for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getUint16(n),n+=2;return this.relativeOffset+=r*2,e},L.prototype.parseShortList=function(r){for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getInt16(n),n+=2;return this.relativeOffset+=r*2,e},L.prototype.parseByteList=function(r){for(var e=new Array(r),t=this.data,n=this.offset+this.relativeOffset,i=0;i<r;i++)e[i]=t.getUint8(n++);return this.relativeOffset+=r,e},L.prototype.parseList=function(r,e){e||(e=r,r=this.parseUShort());for(var t=new Array(r),n=0;n<r;n++)t[n]=e.call(this);return t},L.prototype.parseList32=function(r,e){e||(e=r,r=this.parseULong());for(var t=new Array(r),n=0;n<r;n++)t[n]=e.call(this);return t},L.prototype.parseRecordList=function(r,e){e||(e=r,r=this.parseUShort());for(var t=new Array(r),n=Object.keys(e),i=0;i<r;i++){for(var s={},a=0;a<n.length;a++){var o=n[a],c=e[o];s[o]=c.call(this)}t[i]=s}return t},L.prototype.parseRecordList32=function(r,e){e||(e=r,r=this.parseULong());for(var t=new Array(r),n=Object.keys(e),i=0;i<r;i++){for(var s={},a=0;a<n.length;a++){var o=n[a],c=e[o];s[o]=c.call(this)}t[i]=s}return t},L.prototype.parseStruct=function(r){if(typeof r=="function")return r.call(this);for(var e=Object.keys(r),t={},n=0;n<e.length;n++){var i=e[n],s=r[i];t[i]=s.call(this)}return t},L.prototype.parseValueRecord=function(r){if(r===void 0&&(r=this.parseUShort()),r!==0){var e={};return r&1&&(e.xPlacement=this.parseShort()),r&2&&(e.yPlacement=this.parseShort()),r&4&&(e.xAdvance=this.parseShort()),r&8&&(e.yAdvance=this.parseShort()),r&16&&(e.xPlaDevice=void 0,this.parseShort()),r&32&&(e.yPlaDevice=void 0,this.parseShort()),r&64&&(e.xAdvDevice=void 0,this.parseShort()),r&128&&(e.yAdvDevice=void 0,this.parseShort()),e}},L.prototype.parseValueRecordList=function(){for(var r=this.parseUShort(),e=this.parseUShort(),t=new Array(e),n=0;n<e;n++)t[n]=this.parseValueRecord(r);return t},L.prototype.parsePointer=function(r){var e=this.parseOffset16();if(e>0)return new L(this.data,this.offset+e).parseStruct(r)},L.prototype.parsePointer32=function(r){var e=this.parseOffset32();if(e>0)return new L(this.data,this.offset+e).parseStruct(r)},L.prototype.parseListOfLists=function(r){for(var e=this.parseOffset16List(),t=e.length,n=this.relativeOffset,i=new Array(t),s=0;s<t;s++){var a=e[s];if(a===0){i[s]=void 0;continue}if(this.relativeOffset=a,r){for(var o=this.parseOffset16List(),c=new Array(o.length),h=0;h<o.length;h++)this.relativeOffset=a+o[h],c[h]=r.call(this);i[s]=c}else i[s]=this.parseUShortList()}return this.relativeOffset=n,i},L.prototype.parseCoverage=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort(),t=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(t)};if(e===2){for(var n=new Array(t),i=0;i<t;i++)n[i]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:n}}throw new Error("0x"+r.toString(16)+": Coverage format must be 1 or 2.")},L.prototype.parseClassDef=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:L.uShort,end:L.uShort,classId:L.uShort})};throw new Error("0x"+r.toString(16)+": ClassDef format must be 1 or 2.")},L.list=function(r,e){return function(){return this.parseList(r,e)}},L.list32=function(r,e){return function(){return this.parseList32(r,e)}},L.recordList=function(r,e){return function(){return this.parseRecordList(r,e)}},L.recordList32=function(r,e){return function(){return this.parseRecordList32(r,e)}},L.pointer=function(r){return function(){return this.parsePointer(r)}},L.pointer32=function(r){return function(){return this.parsePointer32(r)}},L.tag=L.prototype.parseTag,L.byte=L.prototype.parseByte,L.uShort=L.offset16=L.prototype.parseUShort,L.uShortList=L.prototype.parseUShortList,L.uLong=L.offset32=L.prototype.parseULong,L.uLongList=L.prototype.parseULongList,L.struct=L.prototype.parseStruct,L.coverage=L.prototype.parseCoverage,L.classDef=L.prototype.parseClassDef;var xs={reserved:L.uShort,reqFeatureIndex:L.uShort,featureIndexes:L.uShortList};L.prototype.parseScriptList=function(){return this.parsePointer(L.recordList({tag:L.tag,script:L.pointer({defaultLangSys:L.pointer(xs),langSysRecords:L.recordList({tag:L.tag,langSys:L.pointer(xs)})})}))||[]},L.prototype.parseFeatureList=function(){return this.parsePointer(L.recordList({tag:L.tag,feature:L.pointer({featureParams:L.offset16,lookupListIndexes:L.uShortList})}))||[]},L.prototype.parseLookupList=function(r){return this.parsePointer(L.list(L.pointer(function(){var e=this.parseUShort();z.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");var t=this.parseUShort(),n=t&16;return{lookupType:e,lookupFlag:t,subtables:this.parseList(L.pointer(r[e])),markFilteringSet:n?this.parseUShort():void 0}})))||[]},L.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var r=this.parseUShort(),e=this.parseUShort();z.argument(r===1&&e<1,"GPOS/GSUB feature variations table unknown.");var t=this.parseRecordList32({conditionSetOffset:L.offset32,featureTableSubstitutionOffset:L.offset32});return t})||[]};var F={getByte:bs,getCard8:bs,getUShort:Mn,getCard16:Mn,getShort:eh,getULong:kr,getFixed:vs,getTag:th,getOffset:nh,getBytes:rh,bytesToString:ih,Parser:L};function ah(r,e){e.parseUShort(),r.length=e.parseULong(),r.language=e.parseULong();var t;r.groupCount=t=e.parseULong(),r.glyphIndexMap={};for(var n=0;n<t;n+=1)for(var i=e.parseULong(),s=e.parseULong(),a=e.parseULong(),o=i;o<=s;o+=1)r.glyphIndexMap[o]=a,a++}function oh(r,e,t,n,i){r.length=e.parseUShort(),r.language=e.parseUShort();var s;r.segCount=s=e.parseUShort()>>1,e.skip("uShort",3),r.glyphIndexMap={};for(var a=new F.Parser(t,n+i+14),o=new F.Parser(t,n+i+16+s*2),c=new F.Parser(t,n+i+16+s*4),h=new F.Parser(t,n+i+16+s*6),l=n+i+16+s*8,d=0;d<s-1;d+=1)for(var u=void 0,f=a.parseUShort(),y=o.parseUShort(),m=c.parseShort(),x=h.parseUShort(),v=y;v<=f;v+=1)x!==0?(l=h.offset+h.relativeOffset-2,l+=x,l+=(v-y)*2,u=F.getUShort(t,l),u!==0&&(u=u+m&65535)):u=v+m&65535,r.glyphIndexMap[v]=u}function ch(r,e){var t={};t.version=F.getUShort(r,e),z.argument(t.version===0,"cmap table version should be 0."),t.numTables=F.getUShort(r,e+2);for(var n=-1,i=t.numTables-1;i>=0;i-=1){var s=F.getUShort(r,e+4+i*8),a=F.getUShort(r,e+4+i*8+2);if(s===3&&(a===0||a===1||a===10)||s===0&&(a===0||a===1||a===2||a===3||a===4)){n=F.getULong(r,e+4+i*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");var o=new F.Parser(r,e+n);if(t.format=o.parseUShort(),t.format===12)ah(t,o);else if(t.format===4)oh(t,o,r,e,n);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function hh(r,e,t){r.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function lh(r){r.segments.push({end:65535,start:65535,delta:1,offset:0})}function uh(r){var e=!0,t;for(t=r.length-1;t>0;t-=1){var n=r.get(t);if(n.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var i=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(i=i.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),i=i.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var s=new R.Table("cmap",i);for(s.segments=[],t=0;t<r.length;t+=1){for(var a=r.get(t),o=0;o<a.unicodes.length;o+=1)hh(s,a.unicodes[o],t);s.segments=s.segments.sort(function(w,S){return w.start-S.start})}lh(s);var c=s.segments.length,h=0,l=[],d=[],u=[],f=[],y=[],m=[];for(t=0;t<c;t+=1){var x=s.segments[t];x.end<=65535&&x.start<=65535?(l=l.concat({name:"end_"+t,type:"USHORT",value:x.end}),d=d.concat({name:"start_"+t,type:"USHORT",value:x.start}),u=u.concat({name:"idDelta_"+t,type:"SHORT",value:x.delta}),f=f.concat({name:"idRangeOffset_"+t,type:"USHORT",value:x.offset}),x.glyphId!==void 0&&(y=y.concat({name:"glyph_"+t,type:"USHORT",value:x.glyphId}))):h+=1,!e&&x.glyphIndex!==void 0&&(m=m.concat({name:"cmap12Start_"+t,type:"ULONG",value:x.start}),m=m.concat({name:"cmap12End_"+t,type:"ULONG",value:x.end}),m=m.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:x.glyphIndex}))}if(s.segCountX2=(c-h)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(c-h)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(l),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(d),s.fields=s.fields.concat(u),s.fields=s.fields.concat(f),s.fields=s.fields.concat(y),s.cmap4Length=14+l.length*2+2+d.length*2+u.length*2+f.length*2+y.length*2,!e){var v=16+m.length*4;s.cmap12Offset=12+2*2+4+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:v},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:m.length/3}]),s.fields=s.fields.concat(m)}return s}var ws={parse:ch,make:uh},On=[".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","266 ff","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"],dh=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],ph=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],pt=[".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 Ss(r){this.font=r}Ss.prototype.charToGlyphIndex=function(r){var e=r.codePointAt(0),t=this.font.glyphs;if(t){for(var n=0;n<t.length;n+=1)for(var i=t.get(n),s=0;s<i.unicodes.length;s+=1)if(i.unicodes[s]===e)return n}return null};function _s(r){this.cmap=r}_s.prototype.charToGlyphIndex=function(r){return this.cmap.glyphIndexMap[r.codePointAt(0)]||0};function Pn(r,e){this.encoding=r,this.charset=e}Pn.prototype.charToGlyphIndex=function(r){var e=r.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function Br(r){switch(r.version){case 1:this.names=pt.slice();break;case 2:this.names=new Array(r.numberOfGlyphs);for(var e=0;e<r.numberOfGlyphs;e++)r.glyphNameIndex[e]<pt.length?this.names[e]=pt[r.glyphNameIndex[e]]:this.names[e]=r.names[r.glyphNameIndex[e]-pt.length];break;case 2.5:this.names=new Array(r.numberOfGlyphs);for(var t=0;t<r.numberOfGlyphs;t++)this.names[t]=pt[t+r.glyphNameIndex[t]];break;case 3:this.names=[];break;default:this.names=[];break}}Br.prototype.nameToGlyphIndex=function(r){return this.names.indexOf(r)},Br.prototype.glyphIndexToName=function(r){return this.names[r]};function fh(r){for(var e,t=r.tables.cmap.glyphIndexMap,n=Object.keys(t),i=0;i<n.length;i+=1){var s=n[i],a=t[s];e=r.glyphs.get(a),e.addUnicode(parseInt(s))}for(var o=0;o<r.glyphs.length;o+=1)e=r.glyphs.get(o),r.cffEncoding?r.isCIDFont?e.name="gid"+o:e.name=r.cffEncoding.charset[o]:r.glyphNames.names&&(e.name=r.glyphNames.glyphIndexToName(o))}function gh(r){r._IndexToUnicodeMap={};for(var e=r.tables.cmap.glyphIndexMap,t=Object.keys(e),n=0;n<t.length;n+=1){var i=t[n],s=e[i];r._IndexToUnicodeMap[s]===void 0?r._IndexToUnicodeMap[s]={unicodes:[parseInt(i)]}:r._IndexToUnicodeMap[s].unicodes.push(parseInt(i))}}function mh(r,e){e.lowMemory?gh(r):fh(r)}function yh(r,e,t,n,i){r.beginPath(),r.moveTo(e,t),r.lineTo(n,i),r.stroke()}var ft={line:yh};function bh(r,e){var t=e||new ue;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(n){t=n}}}function Ce(r){this.bindConstructorValues(r)}Ce.prototype.bindConstructorValues=function(r){this.index=r.index||0,this.name=r.name||null,this.unicode=r.unicode||void 0,this.unicodes=r.unicodes||r.unicode!==void 0?[r.unicode]:[],"xMin"in r&&(this.xMin=r.xMin),"yMin"in r&&(this.yMin=r.yMin),"xMax"in r&&(this.xMax=r.xMax),"yMax"in r&&(this.yMax=r.yMax),"advanceWidth"in r&&(this.advanceWidth=r.advanceWidth),Object.defineProperty(this,"path",bh(this,r.path))},Ce.prototype.addUnicode=function(r){this.unicodes.length===0&&(this.unicode=r),this.unicodes.push(r)},Ce.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Ce.prototype.getPath=function(r,e,t,n,i){r=r!==void 0?r:0,e=e!==void 0?e:0,t=t!==void 0?t:72;var s,a;n||(n={});var o=n.xScale,c=n.yScale;if(n.hinting&&i&&i.hinting&&(a=this.path&&i.hinting.exec(this,t)),a)s=i.hinting.getCommands(a),r=Math.round(r),e=Math.round(e),o=c=1;else{s=this.path.commands;var h=1/(this.path.unitsPerEm||1e3)*t;o===void 0&&(o=h),c===void 0&&(c=h)}for(var l=new ue,d=0;d<s.length;d+=1){var u=s[d];u.type==="M"?l.moveTo(r+u.x*o,e+-u.y*c):u.type==="L"?l.lineTo(r+u.x*o,e+-u.y*c):u.type==="Q"?l.quadraticCurveTo(r+u.x1*o,e+-u.y1*c,r+u.x*o,e+-u.y*c):u.type==="C"?l.curveTo(r+u.x1*o,e+-u.y1*c,r+u.x2*o,e+-u.y2*c,r+u.x*o,e+-u.y*c):u.type==="Z"&&l.closePath()}return l},Ce.prototype.getContours=function(){if(this.points===void 0)return[];for(var r=[],e=[],t=0;t<this.points.length;t+=1){var n=this.points[t];e.push(n),n.lastPointOfContour&&(r.push(e),e=[])}return z.argument(e.length===0,"There are still points left in the current contour."),r},Ce.prototype.getMetrics=function(){for(var r=this.path.commands,e=[],t=[],n=0;n<r.length;n+=1){var i=r[n];i.type!=="Z"&&(e.push(i.x),t.push(i.y)),(i.type==="Q"||i.type==="C")&&(e.push(i.x1),t.push(i.y1)),i.type==="C"&&(e.push(i.x2),t.push(i.y2))}var s={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,t),leftSideBearing:this.leftSideBearing};return isFinite(s.xMin)||(s.xMin=0),isFinite(s.xMax)||(s.xMax=this.advanceWidth),isFinite(s.yMin)||(s.yMin=0),isFinite(s.yMax)||(s.yMax=0),s.rightSideBearing=this.advanceWidth-s.leftSideBearing-(s.xMax-s.xMin),s},Ce.prototype.draw=function(r,e,t,n,i){this.getPath(e,t,n,i).draw(r)},Ce.prototype.drawPoints=function(r,e,t,n){function i(d,u,f,y){r.beginPath();for(var m=0;m<d.length;m+=1)r.moveTo(u+d[m].x*y,f+d[m].y*y),r.arc(u+d[m].x*y,f+d[m].y*y,2,0,Math.PI*2,!1);r.closePath(),r.fill()}e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:24;for(var s=1/this.path.unitsPerEm*n,a=[],o=[],c=this.path,h=0;h<c.commands.length;h+=1){var l=c.commands[h];l.x!==void 0&&a.push({x:l.x,y:-l.y}),l.x1!==void 0&&o.push({x:l.x1,y:-l.y1}),l.x2!==void 0&&o.push({x:l.x2,y:-l.y2})}r.fillStyle="blue",i(a,e,t,s),r.fillStyle="red",i(o,e,t,s)},Ce.prototype.drawMetrics=function(r,e,t,n){var i;e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:24,i=1/this.path.unitsPerEm*n,r.lineWidth=1,r.strokeStyle="black",ft.line(r,e,-1e4,e,1e4),ft.line(r,-1e4,t,1e4,t);var s=this.xMin||0,a=this.yMin||0,o=this.xMax||0,c=this.yMax||0,h=this.advanceWidth||0;r.strokeStyle="blue",ft.line(r,e+s*i,-1e4,e+s*i,1e4),ft.line(r,e+o*i,-1e4,e+o*i,1e4),ft.line(r,-1e4,t+-a*i,1e4,t+-a*i),ft.line(r,-1e4,t+-c*i,1e4,t+-c*i),r.strokeStyle="green",ft.line(r,e+h*i,-1e4,e+h*i,1e4)};function Dn(r,e,t){Object.defineProperty(r,e,{get:function(){return r.path,r[t]},set:function(n){r[t]=n},enumerable:!0,configurable:!0})}function Mr(r,e){if(this.font=r,this.glyphs={},Array.isArray(e))for(var t=0;t<e.length;t++){var n=e[t];n.path.unitsPerEm=r.unitsPerEm,this.glyphs[t]=n}this.length=e&&e.length||0}Mr.prototype.get=function(r){if(this.glyphs[r]===void 0){this.font._push(r),typeof this.glyphs[r]=="function"&&(this.glyphs[r]=this.glyphs[r]());var e=this.glyphs[r],t=this.font._IndexToUnicodeMap[r];if(t)for(var n=0;n<t.unicodes.length;n++)e.addUnicode(t.unicodes[n]);this.font.cffEncoding?this.font.isCIDFont?e.name="gid"+r:e.name=this.font.cffEncoding.charset[r]:this.font.glyphNames.names&&(e.name=this.font.glyphNames.glyphIndexToName(r)),this.glyphs[r].advanceWidth=this.font._hmtxTableData[r].advanceWidth,this.glyphs[r].leftSideBearing=this.font._hmtxTableData[r].leftSideBearing}else typeof this.glyphs[r]=="function"&&(this.glyphs[r]=this.glyphs[r]());return this.glyphs[r]},Mr.prototype.push=function(r,e){this.glyphs[r]=e,this.length++};function vh(r,e){return new Ce({index:e,font:r})}function xh(r,e,t,n,i,s){return function(){var a=new Ce({index:e,font:r});return a.path=function(){t(a,n,i);var o=s(r.glyphs,a);return o.unitsPerEm=r.unitsPerEm,o},Dn(a,"xMin","_xMin"),Dn(a,"xMax","_xMax"),Dn(a,"yMin","_yMin"),Dn(a,"yMax","_yMax"),a}}function wh(r,e,t,n){return function(){var i=new Ce({index:e,font:r});return i.path=function(){var s=t(r,i,n);return s.unitsPerEm=r.unitsPerEm,s},i}}var Ue={GlyphSet:Mr,glyphLoader:vh,ttfGlyphLoader:xh,cffGlyphLoader:wh};function Cs(r,e){if(r===e)return!0;if(Array.isArray(r)&&Array.isArray(e)){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t+=1)if(!Cs(r[t],e[t]))return!1;return!0}else return!1}function Or(r){var e;return r.length<1240?e=107:r.length<33900?e=1131:e=32768,e}function tt(r,e,t){var n=[],i=[],s=F.getCard16(r,e),a,o;if(s!==0){var c=F.getByte(r,e+2);a=e+(s+1)*c+2;for(var h=e+3,l=0;l<s+1;l+=1)n.push(F.getOffset(r,h,c)),h+=c;o=a+n[s]}else o=e+2;for(var d=0;d<n.length-1;d+=1){var u=F.getBytes(r,a+n[d],a+n[d+1]);t&&(u=t(u)),i.push(u)}return{objects:i,startOffset:e,endOffset:o}}function Sh(r,e){var t=[],n=F.getCard16(r,e),i,s;if(n!==0){var a=F.getByte(r,e+2);i=e+(n+1)*a+2;for(var o=e+3,c=0;c<n+1;c+=1)t.push(F.getOffset(r,o,a)),o+=a;s=i+t[n]}else s=e+2;return{offsets:t,startOffset:e,endOffset:s}}function _h(r,e,t,n,i){var s=F.getCard16(t,n),a=0;if(s!==0){var o=F.getByte(t,n+2);a=n+(s+1)*o+2}var c=F.getBytes(t,a+e[r],a+e[r+1]);return c}function Ch(r){for(var e="",t=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var i=r.parseByte(),s=i>>4,a=i&15;if(s===t||(e+=n[s],a===t))break;e+=n[a]}return parseFloat(e)}function Th(r,e){var t,n,i,s;if(e===28)return t=r.parseByte(),n=r.parseByte(),t<<8|n;if(e===29)return t=r.parseByte(),n=r.parseByte(),i=r.parseByte(),s=r.parseByte(),t<<24|n<<16|i<<8|s;if(e===30)return Ch(r);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=r.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=r.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function Eh(r){for(var e={},t=0;t<r.length;t+=1){var n=r[t][0],i=r[t][1],s=void 0;if(i.length===1?s=i[0]:s=i,e.hasOwnProperty(n)&&!isNaN(e[n]))throw new Error("Object "+e+" already has key "+n);e[n]=s}return e}function Ts(r,e,t){e=e!==void 0?e:0;var n=new F.Parser(r,e),i=[],s=[];for(t=t!==void 0?t:r.length;n.relativeOffset<t;){var a=n.parseByte();a<=21?(a===12&&(a=1200+n.parseByte()),i.push([a,s]),s=[]):s.push(Th(n,a))}return Eh(i)}function Wt(r,e){return e<=390?e=On[e]:e=r[e-391],e}function Es(r,e,t){for(var n={},i,s=0;s<e.length;s+=1){var a=e[s];if(Array.isArray(a.type)){var o=[];o.length=a.type.length;for(var c=0;c<a.type.length;c++)i=r[a.op]!==void 0?r[a.op][c]:void 0,i===void 0&&(i=a.value!==void 0&&a.value[c]!==void 0?a.value[c]:null),a.type[c]==="SID"&&(i=Wt(t,i)),o[c]=i;n[a.name]=o}else i=r[a.op],i===void 0&&(i=a.value!==void 0?a.value:null),a.type==="SID"&&(i=Wt(t,i)),n[a.name]=i}return n}function Ah(r,e){var t={};return t.formatMajor=F.getCard8(r,e),t.formatMinor=F.getCard8(r,e+1),t.size=F.getCard8(r,e+2),t.offsetSize=F.getCard8(r,e+3),t.startOffset=e,t.endOffset=e+4,t}var As=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],Is=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function Ih(r,e){var t=Ts(r,0,r.byteLength);return Es(t,As,e)}function Ls(r,e,t,n){var i=Ts(r,e,t);return Es(i,Is,n)}function ks(r,e,t,n){for(var i=[],s=0;s<t.length;s+=1){var a=new DataView(new Uint8Array(t[s]).buffer),o=Ih(a,n);o._subrs=[],o._subrsBias=0,o._defaultWidthX=0,o._nominalWidthX=0;var c=o.private[0],h=o.private[1];if(c!==0&&h!==0){var l=Ls(r,h+e,c,n);if(o._defaultWidthX=l.defaultWidthX,o._nominalWidthX=l.nominalWidthX,l.subrs!==0){var d=h+l.subrs,u=tt(r,d+e);o._subrs=u.objects,o._subrsBias=Or(o._subrs)}o._privateDict=l}i.push(o)}return i}function Lh(r,e,t,n){var i,s,a=new F.Parser(r,e);t-=1;var o=[".notdef"],c=a.parseCard8();if(c===0)for(var h=0;h<t;h+=1)i=a.parseSID(),o.push(Wt(n,i));else if(c===1)for(;o.length<=t;){i=a.parseSID(),s=a.parseCard8();for(var l=0;l<=s;l+=1)o.push(Wt(n,i)),i+=1}else if(c===2)for(;o.length<=t;){i=a.parseSID(),s=a.parseCard16();for(var d=0;d<=s;d+=1)o.push(Wt(n,i)),i+=1}else throw new Error("Unknown charset format "+c);return o}function kh(r,e,t){var n,i={},s=new F.Parser(r,e),a=s.parseCard8();if(a===0)for(var o=s.parseCard8(),c=0;c<o;c+=1)n=s.parseCard8(),i[n]=c;else if(a===1){var h=s.parseCard8();n=1;for(var l=0;l<h;l+=1)for(var d=s.parseCard8(),u=s.parseCard8(),f=d;f<=d+u;f+=1)i[f]=n,n+=1}else throw new Error("Unknown encoding format "+a);return new Pn(i,t)}function Bs(r,e,t){var n,i,s,a,o=new ue,c=[],h=0,l=!1,d=!1,u=0,f=0,y,m,x,v;if(r.isCIDFont){var w=r.tables.cff.topDict._fdSelect[e.index],S=r.tables.cff.topDict._fdArray[w];y=S._subrs,m=S._subrsBias,x=S._defaultWidthX,v=S._nominalWidthX}else y=r.tables.cff.topDict._subrs,m=r.tables.cff.topDict._subrsBias,x=r.tables.cff.topDict._defaultWidthX,v=r.tables.cff.topDict._nominalWidthX;var _=x;function T(P,V){d&&o.closePath(),o.moveTo(P,V),d=!0}function B(){var P;P=c.length%2!==0,P&&!l&&(_=c.shift()+v),h+=c.length>>1,c.length=0,l=!0}function O(P){for(var V,H,J,pe,ae,$,X,Y,te,ce,re,he,j=0;j<P.length;){var W=P[j];switch(j+=1,W){case 1:B();break;case 3:B();break;case 4:c.length>1&&!l&&(_=c.shift()+v,l=!0),f+=c.pop(),T(u,f);break;case 5:for(;c.length>0;)u+=c.shift(),f+=c.shift(),o.lineTo(u,f);break;case 6:for(;c.length>0&&(u+=c.shift(),o.lineTo(u,f),c.length!==0);)f+=c.shift(),o.lineTo(u,f);break;case 7:for(;c.length>0&&(f+=c.shift(),o.lineTo(u,f),c.length!==0);)u+=c.shift(),o.lineTo(u,f);break;case 8:for(;c.length>0;)n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+c.shift(),o.curveTo(n,i,s,a,u,f);break;case 10:ae=c.pop()+m,$=y[ae],$&&O($);break;case 11:return;case 12:switch(W=P[j],j+=1,W){case 35:n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a+c.shift(),te=X+c.shift(),ce=Y+c.shift(),re=te+c.shift(),he=ce+c.shift(),u=re+c.shift(),f=he+c.shift(),c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;case 34:n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a,te=X+c.shift(),ce=a,re=te+c.shift(),he=f,u=re+c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;case 36:n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a,te=X+c.shift(),ce=a,re=te+c.shift(),he=ce+c.shift(),u=re+c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;case 37:n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),X=s+c.shift(),Y=a+c.shift(),te=X+c.shift(),ce=Y+c.shift(),re=te+c.shift(),he=ce+c.shift(),Math.abs(re-u)>Math.abs(he-f)?u=re+c.shift():f=he+c.shift(),o.curveTo(n,i,s,a,X,Y),o.curveTo(te,ce,re,he,u,f);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+W),c.length=0}break;case 14:c.length>0&&!l&&(_=c.shift()+v,l=!0),d&&(o.closePath(),d=!1);break;case 18:B();break;case 19:case 20:B(),j+=h+7>>3;break;case 21:c.length>2&&!l&&(_=c.shift()+v,l=!0),f+=c.pop(),u+=c.pop(),T(u,f);break;case 22:c.length>1&&!l&&(_=c.shift()+v,l=!0),u+=c.pop(),T(u,f);break;case 23:B();break;case 24:for(;c.length>2;)n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+c.shift(),o.curveTo(n,i,s,a,u,f);u+=c.shift(),f+=c.shift(),o.lineTo(u,f);break;case 25:for(;c.length>6;)u+=c.shift(),f+=c.shift(),o.lineTo(u,f);n=u+c.shift(),i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+c.shift(),o.curveTo(n,i,s,a,u,f);break;case 26:for(c.length%2&&(u+=c.shift());c.length>0;)n=u,i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s,f=a+c.shift(),o.curveTo(n,i,s,a,u,f);break;case 27:for(c.length%2&&(f+=c.shift());c.length>0;)n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a,o.curveTo(n,i,s,a,u,f);break;case 28:V=P[j],H=P[j+1],c.push((V<<24|H<<16)>>16),j+=2;break;case 29:ae=c.pop()+r.gsubrsBias,$=r.gsubrs[ae],$&&O($);break;case 30:for(;c.length>0&&(n=u,i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f),c.length!==0);)n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),f=a+c.shift(),u=s+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f);break;case 31:for(;c.length>0&&(n=u+c.shift(),i=f,s=n+c.shift(),a=i+c.shift(),f=a+c.shift(),u=s+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f),c.length!==0);)n=u,i=f+c.shift(),s=n+c.shift(),a=i+c.shift(),u=s+c.shift(),f=a+(c.length===1?c.shift():0),o.curveTo(n,i,s,a,u,f);break;default:W<32?console.log("Glyph "+e.index+": unknown operator "+W):W<247?c.push(W-139):W<251?(V=P[j],j+=1,c.push((W-247)*256+V+108)):W<255?(V=P[j],j+=1,c.push(-(W-251)*256-V-108)):(V=P[j],H=P[j+1],J=P[j+2],pe=P[j+3],j+=4,c.push((V<<24|H<<16|J<<8|pe)/65536))}}}return O(t),e.advanceWidth=_,o}function Bh(r,e,t,n){var i=[],s,a=new F.Parser(r,e),o=a.parseCard8();if(o===0)for(var c=0;c<t;c++){if(s=a.parseCard8(),s>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+n+")");i.push(s)}else if(o===3){var h=a.parseCard16(),l=a.parseCard16();if(l!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+l);for(var d,u=0;u<h;u++){if(s=a.parseCard8(),d=a.parseCard16(),s>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+n+")");if(d>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+d);for(;l<d;l++)i.push(s);l=d}if(d!==t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+d)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+o);return i}function Mh(r,e,t,n){t.tables.cff={};var i=Ah(r,e),s=tt(r,i.endOffset,F.bytesToString),a=tt(r,s.endOffset),o=tt(r,a.endOffset,F.bytesToString),c=tt(r,o.endOffset);t.gsubrs=c.objects,t.gsubrsBias=Or(t.gsubrs);var h=ks(r,e,a.objects,o.objects);if(h.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+h.length);var l=h[0];if(t.tables.cff.topDict=l,l._privateDict&&(t.defaultWidthX=l._privateDict.defaultWidthX,t.nominalWidthX=l._privateDict.nominalWidthX),l.ros[0]!==void 0&&l.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){var d=l.fdArray,u=l.fdSelect;if(d===0||u===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");d+=e;var f=tt(r,d),y=ks(r,e,f.objects,o.objects);l._fdArray=y,u+=e,l._fdSelect=Bh(r,u,t.numGlyphs,y.length)}var m=e+l.private[1],x=Ls(r,m,l.private[0],o.objects);if(t.defaultWidthX=x.defaultWidthX,t.nominalWidthX=x.nominalWidthX,x.subrs!==0){var v=m+x.subrs,w=tt(r,v);t.subrs=w.objects,t.subrsBias=Or(t.subrs)}else t.subrs=[],t.subrsBias=0;var S;n.lowMemory?(S=Sh(r,e+l.charStrings),t.nGlyphs=S.offsets.length):(S=tt(r,e+l.charStrings),t.nGlyphs=S.objects.length);var _=Lh(r,e+l.charset,t.nGlyphs,o.objects);if(l.encoding===0?t.cffEncoding=new Pn(dh,_):l.encoding===1?t.cffEncoding=new Pn(ph,_):t.cffEncoding=kh(r,e+l.encoding,_),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new Ue.GlyphSet(t),n.lowMemory)t._push=function(O){var P=_h(O,S.offsets,r,e+l.charStrings);t.glyphs.push(O,Ue.cffGlyphLoader(t,O,Bs,P))};else for(var T=0;T<t.nGlyphs;T+=1){var B=S.objects[T];t.glyphs.push(T,Ue.cffGlyphLoader(t,T,Bs,B))}}function Ms(r,e){var t,n=On.indexOf(r);return n>=0&&(t=n),n=e.indexOf(r),n>=0?t=n+On.length:(t=On.length+e.length,e.push(r)),t}function Oh(){return new R.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ph(r){var e=new R.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var t=0;t<r.length;t+=1)e.names.push({name:"name_"+t,type:"NAME",value:r[t]});return e}function Os(r,e,t){for(var n={},i=0;i<r.length;i+=1){var s=r[i],a=e[s.name];a!==void 0&&!Cs(a,s.value)&&(s.type==="SID"&&(a=Ms(a,t)),n[s.op]={name:s.name,type:s.type,value:a})}return n}function Ps(r,e){var t=new R.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=Os(As,r,e),t}function Ds(r){var e=new R.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:r}],e}function Dh(r){var e=new R.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(var t=0;t<r.length;t+=1)e.strings.push({name:"string_"+t,type:"STRING",value:r[t]});return e}function Rh(){return new R.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Uh(r,e){for(var t=new R.Record("Charsets",[{name:"format",type:"Card8",value:0}]),n=0;n<r.length;n+=1){var i=r[n],s=Ms(i,e);t.fields.push({name:"glyph_"+n,type:"SID",value:s})}return t}function Fh(r){var e=[],t=r.path;e.push({name:"width",type:"NUMBER",value:r.advanceWidth});for(var n=0,i=0,s=0;s<t.commands.length;s+=1){var a=void 0,o=void 0,c=t.commands[s];if(c.type==="Q"){var h=.3333333333333333,l=2/3;c={type:"C",x:c.x,y:c.y,x1:Math.round(h*n+l*c.x1),y1:Math.round(h*i+l*c.y1),x2:Math.round(h*c.x+l*c.x1),y2:Math.round(h*c.y+l*c.y1)}}if(c.type==="M")a=Math.round(c.x-n),o=Math.round(c.y-i),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rmoveto",type:"OP",value:21}),n=Math.round(c.x),i=Math.round(c.y);else if(c.type==="L")a=Math.round(c.x-n),o=Math.round(c.y-i),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rlineto",type:"OP",value:5}),n=Math.round(c.x),i=Math.round(c.y);else if(c.type==="C"){var d=Math.round(c.x1-n),u=Math.round(c.y1-i),f=Math.round(c.x2-c.x1),y=Math.round(c.y2-c.y1);a=Math.round(c.x-c.x2),o=Math.round(c.y-c.y2),e.push({name:"dx1",type:"NUMBER",value:d}),e.push({name:"dy1",type:"NUMBER",value:u}),e.push({name:"dx2",type:"NUMBER",value:f}),e.push({name:"dy2",type:"NUMBER",value:y}),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rrcurveto",type:"OP",value:8}),n=Math.round(c.x),i=Math.round(c.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function Nh(r){for(var e=new R.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),t=0;t<r.length;t+=1){var n=r.get(t),i=Fh(n);e.charStrings.push({name:n.name,type:"CHARSTRING",value:i})}return e}function zh(r,e){var t=new R.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=Os(Is,r,e),t}function Gh(r,e){for(var t=new R.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),n=1/e.unitsPerEm,i={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[n,0,0,n,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},s={},a=[],o,c=1;c<r.length;c+=1)o=r.get(c),a.push(o.name);var h=[];t.header=Oh(),t.nameIndex=Ph([e.postScriptName]);var l=Ps(i,h);t.topDictIndex=Ds(l),t.globalSubrIndex=Rh(),t.charsets=Uh(a,h),t.charStringsIndex=Nh(r),t.privateDict=zh(s,h),t.stringIndex=Dh(h);var d=t.header.sizeOf()+t.nameIndex.sizeOf()+t.topDictIndex.sizeOf()+t.stringIndex.sizeOf()+t.globalSubrIndex.sizeOf();return i.charset=d,i.encoding=0,i.charStrings=i.charset+t.charsets.sizeOf(),i.private[1]=i.charStrings+t.charStringsIndex.sizeOf(),l=Ps(i,h),t.topDictIndex=Ds(l),t}var Rs={parse:Mh,make:Gh};function jh(r,e){var t={},n=new F.Parser(r,e);return t.version=n.parseVersion(),t.fontRevision=Math.round(n.parseFixed()*1e3)/1e3,t.checkSumAdjustment=n.parseULong(),t.magicNumber=n.parseULong(),z.argument(t.magicNumber===1594834165,"Font header has wrong magic number."),t.flags=n.parseUShort(),t.unitsPerEm=n.parseUShort(),t.created=n.parseLongDateTime(),t.modified=n.parseLongDateTime(),t.xMin=n.parseShort(),t.yMin=n.parseShort(),t.xMax=n.parseShort(),t.yMax=n.parseShort(),t.macStyle=n.parseUShort(),t.lowestRecPPEM=n.parseUShort(),t.fontDirectionHint=n.parseShort(),t.indexToLocFormat=n.parseShort(),t.glyphDataFormat=n.parseShort(),t}function Vh(r){var e=Math.round(new Date().getTime()/1e3)+2082844800,t=e;return r.createdTimestamp&&(t=r.createdTimestamp+2082844800),new R.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:t},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],r)}var Us={parse:jh,make:Vh};function Hh(r,e){var t={},n=new F.Parser(r,e);return t.version=n.parseVersion(),t.ascender=n.parseShort(),t.descender=n.parseShort(),t.lineGap=n.parseShort(),t.advanceWidthMax=n.parseUShort(),t.minLeftSideBearing=n.parseShort(),t.minRightSideBearing=n.parseShort(),t.xMaxExtent=n.parseShort(),t.caretSlopeRise=n.parseShort(),t.caretSlopeRun=n.parseShort(),t.caretOffset=n.parseShort(),n.relativeOffset+=8,t.metricDataFormat=n.parseShort(),t.numberOfHMetrics=n.parseUShort(),t}function Wh(r){return new R.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],r)}var Fs={parse:Hh,make:Wh};function $h(r,e,t,n,i){for(var s,a,o=new F.Parser(r,e),c=0;c<n;c+=1){c<t&&(s=o.parseUShort(),a=o.parseShort());var h=i.get(c);h.advanceWidth=s,h.leftSideBearing=a}}function qh(r,e,t,n,i){r._hmtxTableData={};for(var s,a,o=new F.Parser(e,t),c=0;c<i;c+=1)c<n&&(s=o.parseUShort(),a=o.parseShort()),r._hmtxTableData[c]={advanceWidth:s,leftSideBearing:a}}function Xh(r,e,t,n,i,s,a){a.lowMemory?qh(r,e,t,n,i):$h(e,t,n,i,s)}function Yh(r){for(var e=new R.Table("hmtx",[]),t=0;t<r.length;t+=1){var n=r.get(t),i=n.advanceWidth||0,s=n.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+t,type:"USHORT",value:i}),e.fields.push({name:"leftSideBearing_"+t,type:"SHORT",value:s})}return e}var Ns={parse:Xh,make:Yh};function Zh(r){for(var e=new R.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:r.length}]),t="",n=12+r.length*4,i=0;i<r.length;++i){var s=t.indexOf(r[i]);s<0&&(s=t.length,t+=r[i]),e.fields.push({name:"offset "+i,type:"USHORT",value:n+s}),e.fields.push({name:"length "+i,type:"USHORT",value:r[i].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),e}function Kh(r,e){var t=new F.Parser(r,e),n=t.parseULong();z.argument(n===1,"Unsupported ltag table version."),t.skip("uLong",1);for(var i=t.parseULong(),s=[],a=0;a<i;a++){for(var o="",c=e+t.parseUShort(),h=t.parseUShort(),l=c;l<c+h;++l)o+=String.fromCharCode(r.getInt8(l));s.push(o)}return s}var zs={make:Zh,parse:Kh};function Jh(r,e){var t={},n=new F.Parser(r,e);return t.version=n.parseVersion(),t.numGlyphs=n.parseUShort(),t.version===1&&(t.maxPoints=n.parseUShort(),t.maxContours=n.parseUShort(),t.maxCompositePoints=n.parseUShort(),t.maxCompositeContours=n.parseUShort(),t.maxZones=n.parseUShort(),t.maxTwilightPoints=n.parseUShort(),t.maxStorage=n.parseUShort(),t.maxFunctionDefs=n.parseUShort(),t.maxInstructionDefs=n.parseUShort(),t.maxStackElements=n.parseUShort(),t.maxSizeOfInstructions=n.parseUShort(),t.maxComponentElements=n.parseUShort(),t.maxComponentDepth=n.parseUShort()),t}function Qh(r){return new R.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:r}])}var Gs={parse:Jh,make:Qh},js=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Vs={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},el={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Hs={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function tl(r,e,t){switch(r){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return Vs[e];case 3:return Hs[e]}}var Pr="utf-16",nl={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},rl={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Ws(r,e,t){switch(r){case 0:return Pr;case 1:return rl[t]||nl[e];case 3:if(e===1||e===10)return Pr;break}}function il(r,e,t){for(var n={},i=new F.Parser(r,e),s=i.parseUShort(),a=i.parseUShort(),o=i.offset+i.parseUShort(),c=0;c<a;c++){var h=i.parseUShort(),l=i.parseUShort(),d=i.parseUShort(),u=i.parseUShort(),f=js[u]||u,y=i.parseUShort(),m=i.parseUShort(),x=tl(h,d,t),v=Ws(h,l,d);if(v!==void 0&&x!==void 0){var w=void 0;if(v===Pr?w=wt.UTF16(r,o+m,y):w=wt.MACSTRING(r,o+m,y,v),w){var S=n[f];S===void 0&&(S=n[f]={}),S[x]=w}}}return s===1&&i.parseUShort(),n}function Dr(r){var e={};for(var t in r)e[r[t]]=parseInt(t);return e}function $s(r,e,t,n,i,s){return new R.Record("NameRecord",[{name:"platformID",type:"USHORT",value:r},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:t},{name:"nameID",type:"USHORT",value:n},{name:"length",type:"USHORT",value:i},{name:"offset",type:"USHORT",value:s}])}function sl(r,e){var t=r.length,n=e.length-t+1;e:for(var i=0;i<n;i++)for(;i<n;i++){for(var s=0;s<t;s++)if(e[i+s]!==r[s])continue e;return i}return-1}function qs(r,e){var t=sl(r,e);if(t<0){t=e.length;for(var n=0,i=r.length;n<i;++n)e.push(r[n])}return t}function al(r,e){var t,n=[],i={},s=Dr(js);for(var a in r){var o=s[a];if(o===void 0&&(o=a),t=parseInt(o),isNaN(t))throw new Error('Name table entry "'+a+'" does not exist, see nameTableNames for complete list.');i[t]=r[a],n.push(t)}for(var c=Dr(Vs),h=Dr(Hs),l=[],d=[],u=0;u<n.length;u++){t=n[u];var f=i[t];for(var y in f){var m=f[y],x=1,v=c[y],w=el[v],S=Ws(x,w,v),_=D.MACSTRING(m,S);_===void 0&&(x=0,v=e.indexOf(y),v<0&&(v=e.length,e.push(y)),w=4,_=D.UTF16(m));var T=qs(_,d);l.push($s(x,w,v,t,_.length,T));var B=h[y];if(B!==void 0){var O=D.UTF16(m),P=qs(O,d);l.push($s(3,1,B,t,O.length,P))}}}l.sort(function(J,pe){return J.platformID-pe.platformID||J.encodingID-pe.encodingID||J.languageID-pe.languageID||J.nameID-pe.nameID});for(var V=new R.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:l.length},{name:"stringOffset",type:"USHORT",value:6+l.length*12}]),H=0;H<l.length;H++)V.fields.push({name:"record_"+H,type:"RECORD",value:l[H]});return V.fields.push({name:"strings",type:"LITERAL",value:d}),V}var Xs={parse:il,make:al},Rr=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function ol(r){for(var e=0;e<Rr.length;e+=1){var t=Rr[e];if(r>=t.begin&&r<t.end)return e}return-1}function cl(r,e){var t={},n=new F.Parser(r,e);t.version=n.parseUShort(),t.xAvgCharWidth=n.parseShort(),t.usWeightClass=n.parseUShort(),t.usWidthClass=n.parseUShort(),t.fsType=n.parseUShort(),t.ySubscriptXSize=n.parseShort(),t.ySubscriptYSize=n.parseShort(),t.ySubscriptXOffset=n.parseShort(),t.ySubscriptYOffset=n.parseShort(),t.ySuperscriptXSize=n.parseShort(),t.ySuperscriptYSize=n.parseShort(),t.ySuperscriptXOffset=n.parseShort(),t.ySuperscriptYOffset=n.parseShort(),t.yStrikeoutSize=n.parseShort(),t.yStrikeoutPosition=n.parseShort(),t.sFamilyClass=n.parseShort(),t.panose=[];for(var i=0;i<10;i++)t.panose[i]=n.parseByte();return t.ulUnicodeRange1=n.parseULong(),t.ulUnicodeRange2=n.parseULong(),t.ulUnicodeRange3=n.parseULong(),t.ulUnicodeRange4=n.parseULong(),t.achVendID=String.fromCharCode(n.parseByte(),n.parseByte(),n.parseByte(),n.parseByte()),t.fsSelection=n.parseUShort(),t.usFirstCharIndex=n.parseUShort(),t.usLastCharIndex=n.parseUShort(),t.sTypoAscender=n.parseShort(),t.sTypoDescender=n.parseShort(),t.sTypoLineGap=n.parseShort(),t.usWinAscent=n.parseUShort(),t.usWinDescent=n.parseUShort(),t.version>=1&&(t.ulCodePageRange1=n.parseULong(),t.ulCodePageRange2=n.parseULong()),t.version>=2&&(t.sxHeight=n.parseShort(),t.sCapHeight=n.parseShort(),t.usDefaultChar=n.parseUShort(),t.usBreakChar=n.parseUShort(),t.usMaxContent=n.parseUShort()),t}function hl(r){return new R.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],r)}var Ur={parse:cl,make:hl,unicodeRanges:Rr,getUnicodeRange:ol};function ll(r,e){var t={},n=new F.Parser(r,e);switch(t.version=n.parseVersion(),t.italicAngle=n.parseFixed(),t.underlinePosition=n.parseShort(),t.underlineThickness=n.parseShort(),t.isFixedPitch=n.parseULong(),t.minMemType42=n.parseULong(),t.maxMemType42=n.parseULong(),t.minMemType1=n.parseULong(),t.maxMemType1=n.parseULong(),t.version){case 1:t.names=pt.slice();break;case 2:t.numberOfGlyphs=n.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(var i=0;i<t.numberOfGlyphs;i++)t.glyphNameIndex[i]=n.parseUShort();t.names=[];for(var s=0;s<t.numberOfGlyphs;s++)if(t.glyphNameIndex[s]>=pt.length){var a=n.parseChar();t.names.push(n.parseString(a))}break;case 2.5:t.numberOfGlyphs=n.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(var o=0;o<t.numberOfGlyphs;o++)t.offset[o]=n.parseChar();break}return t}function ul(){return new R.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}var Ys={parse:ll,make:ul},ke=new Array(9);ke[1]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(L.coverage),deltaGlyphId:this.parseUShort()};if(e===2)return{substFormat:2,coverage:this.parsePointer(L.coverage),substitute:this.parseOffset16List()};z.assert(!1,"0x"+r.toString(16)+": lookup type 1 format must be 1 or 2.")},ke[2]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),sequences:this.parseListOfLists()}},ke[3]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),alternateSets:this.parseListOfLists()}},ke[4]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB ligature table identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var St={sequenceIndex:L.uShort,lookupListIndex:L.uShort};ke[5]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:e,coverage:this.parsePointer(L.coverage),ruleSets:this.parseListOfLists(function(){var i=this.parseUShort(),s=this.parseUShort();return{input:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,St)}})};if(e===2)return{substFormat:e,coverage:this.parsePointer(L.coverage),classDef:this.parsePointer(L.classDef),classSets:this.parseListOfLists(function(){var i=this.parseUShort(),s=this.parseUShort();return{classes:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,St)}})};if(e===3){var t=this.parseUShort(),n=this.parseUShort();return{substFormat:e,coverages:this.parseList(t,L.pointer(L.coverage)),lookupRecords:this.parseRecordList(n,St)}}z.assert(!1,"0x"+r.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},ke[6]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{substFormat:1,coverage:this.parsePointer(L.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(St)}})};if(e===2)return{substFormat:2,coverage:this.parsePointer(L.coverage),backtrackClassDef:this.parsePointer(L.classDef),inputClassDef:this.parsePointer(L.classDef),lookaheadClassDef:this.parsePointer(L.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(St)}})};if(e===3)return{substFormat:3,backtrackCoverage:this.parseList(L.pointer(L.coverage)),inputCoverage:this.parseList(L.pointer(L.coverage)),lookaheadCoverage:this.parseList(L.pointer(L.coverage)),lookupRecords:this.parseRecordList(St)};z.assert(!1,"0x"+r.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},ke[7]=function(){var r=this.parseUShort();z.argument(r===1,"GSUB Extension Substitution subtable identifier-format must be 1");var e=this.parseUShort(),t=new L(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:e,extension:ke[e].call(t)}},ke[8]=function(){var r=this.parseUShort();return z.argument(r===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:r,coverage:this.parsePointer(L.coverage),backtrackCoverage:this.parseList(L.pointer(L.coverage)),lookaheadCoverage:this.parseList(L.pointer(L.coverage)),substitutes:this.parseUShortList()}};function dl(r,e){e=e||0;var t=new L(r,e),n=t.parseVersion(1);return z.argument(n===1||n===1.1,"Unsupported GSUB table version."),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(ke)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(ke),variations:t.parseFeatureVariationsList()}}var _t=new Array(9);_t[1]=function(r){return r.substFormat===1?new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)},{name:"deltaGlyphID",type:"USHORT",value:r.deltaGlyphId}]):new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.ushortList("substitute",r.substitute)))},_t[2]=function(r){return z.assert(r.substFormat===1,"Lookup type 2 substFormat must be 1."),new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("seqSet",r.sequences,function(e){return new R.Table("sequenceSetTable",R.ushortList("sequence",e))})))},_t[3]=function(r){return z.assert(r.substFormat===1,"Lookup type 3 substFormat must be 1."),new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("altSet",r.alternateSets,function(e){return new R.Table("alternateSetTable",R.ushortList("alternate",e))})))},_t[4]=function(r){return z.assert(r.substFormat===1,"Lookup type 4 substFormat must be 1."),new R.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("ligSet",r.ligatureSets,function(e){return new R.Table("ligatureSetTable",R.tableList("ligature",e,function(t){return new R.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:t.ligGlyph}].concat(R.ushortList("component",t.components,t.components.length+1)))}))})))},_t[6]=function(r){if(r.substFormat===1){var e=new R.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:r.substFormat},{name:"coverage",type:"TABLE",value:new R.Coverage(r.coverage)}].concat(R.tableList("chainRuleSet",r.chainRuleSets,function(i){return new R.Table("chainRuleSetTable",R.tableList("chainRule",i,function(s){var a=R.ushortList("backtrackGlyph",s.backtrack,s.backtrack.length).concat(R.ushortList("inputGlyph",s.input,s.input.length+1)).concat(R.ushortList("lookaheadGlyph",s.lookahead,s.lookahead.length)).concat(R.ushortList("substitution",[],s.lookupRecords.length));return s.lookupRecords.forEach(function(o,c){a=a.concat({name:"sequenceIndex"+c,type:"USHORT",value:o.sequenceIndex}).concat({name:"lookupListIndex"+c,type:"USHORT",value:o.lookupListIndex})}),new R.Table("chainRuleTable",a)}))})));return e}else if(r.substFormat===2)z.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(r.substFormat===3){var t=[{name:"substFormat",type:"USHORT",value:r.substFormat}];t.push({name:"backtrackGlyphCount",type:"USHORT",value:r.backtrackCoverage.length}),r.backtrackCoverage.forEach(function(i,s){t.push({name:"backtrackCoverage"+s,type:"TABLE",value:new R.Coverage(i)})}),t.push({name:"inputGlyphCount",type:"USHORT",value:r.inputCoverage.length}),r.inputCoverage.forEach(function(i,s){t.push({name:"inputCoverage"+s,type:"TABLE",value:new R.Coverage(i)})}),t.push({name:"lookaheadGlyphCount",type:"USHORT",value:r.lookaheadCoverage.length}),r.lookaheadCoverage.forEach(function(i,s){t.push({name:"lookaheadCoverage"+s,type:"TABLE",value:new R.Coverage(i)})}),t.push({name:"substitutionCount",type:"USHORT",value:r.lookupRecords.length}),r.lookupRecords.forEach(function(i,s){t=t.concat({name:"sequenceIndex"+s,type:"USHORT",value:i.sequenceIndex}).concat({name:"lookupListIndex"+s,type:"USHORT",value:i.lookupListIndex})});var n=new R.Table("chainContextTable",t);return n}z.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function pl(r){return new R.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new R.ScriptList(r.scripts)},{name:"features",type:"TABLE",value:new R.FeatureList(r.features)},{name:"lookups",type:"TABLE",value:new R.LookupList(r.lookups,_t)}])}var Zs={parse:dl,make:pl};function fl(r,e){var t=new F.Parser(r,e),n=t.parseULong();z.argument(n===1,"Unsupported META table version."),t.parseULong(),t.parseULong();for(var i=t.parseULong(),s={},a=0;a<i;a++){var o=t.parseTag(),c=t.parseULong(),h=t.parseULong(),l=wt.UTF8(r,e+c,h);s[o]=l}return s}function gl(r){var e=Object.keys(r).length,t="",n=16+e*12,i=new R.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:n},{name:"numTags",type:"ULONG",value:e}]);for(var s in r){var a=t.length;t+=r[s],i.fields.push({name:"tag "+s,type:"TAG",value:s}),i.fields.push({name:"offset "+s,type:"ULONG",value:n+a}),i.fields.push({name:"length "+s,type:"ULONG",value:r[s].length})}return i.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),i}var Ks={parse:fl,make:gl};function Js(r){return Math.log(r)/Math.log(2)|0}function Fr(r){for(;r.length%4!==0;)r.push(0);for(var e=0,t=0;t<r.length;t+=4)e+=(r[t]<<24)+(r[t+1]<<16)+(r[t+2]<<8)+r[t+3];return e%=Math.pow(2,32),e}function Qs(r,e,t,n){return new R.Record("Table Record",[{name:"tag",type:"TAG",value:r!==void 0?r:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:t!==void 0?t:0},{name:"length",type:"ULONG",value:n!==void 0?n:0}])}function ea(r){var e=new R.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=r,e.numTables=r.length;var t=Math.pow(2,Js(e.numTables));e.searchRange=16*t,e.entrySelector=Js(t),e.rangeShift=e.numTables*16-e.searchRange;for(var n=[],i=[],s=e.sizeOf()+Qs().sizeOf()*e.numTables;s%4!==0;)s+=1,i.push({name:"padding",type:"BYTE",value:0});for(var a=0;a<r.length;a+=1){var o=r[a];z.argument(o.tableName.length===4,"Table name"+o.tableName+" is invalid.");var c=o.sizeOf(),h=Qs(o.tableName,Fr(o.encode()),s,c);for(n.push({name:h.tag+" Table Record",type:"RECORD",value:h}),i.push({name:o.tableName+" table",type:"RECORD",value:o}),s+=c,z.argument(!isNaN(s),"Something went wrong calculating the offset.");s%4!==0;)s+=1,i.push({name:"padding",type:"BYTE",value:0})}return n.sort(function(l,d){return l.value.tag>d.value.tag?1:-1}),e.fields=e.fields.concat(n),e.fields=e.fields.concat(i),e}function ta(r,e,t){for(var n=0;n<e.length;n+=1){var i=r.charToGlyphIndex(e[n]);if(i>0){var s=r.glyphs.get(i);return s.getMetrics()}}return t}function ml(r){for(var e=0,t=0;t<r.length;t+=1)e+=r[t];return e/r.length}function yl(r){for(var e=[],t=[],n=[],i=[],s=[],a=[],o=[],c,h=0,l=0,d=0,u=0,f=0,y=0;y<r.glyphs.length;y+=1){var m=r.glyphs.get(y),x=m.unicode|0;if(isNaN(m.advanceWidth))throw new Error("Glyph "+m.name+" ("+y+"): advanceWidth is not a number.");(c>x||c===void 0)&&x>0&&(c=x),h<x&&(h=x);var v=Ur.getUnicodeRange(x);if(v<32)l|=1<<v;else if(v<64)d|=1<<v-32;else if(v<96)u|=1<<v-64;else if(v<123)f|=1<<v-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(m.name!==".notdef"){var w=m.getMetrics();e.push(w.xMin),t.push(w.yMin),n.push(w.xMax),i.push(w.yMax),a.push(w.leftSideBearing),o.push(w.rightSideBearing),s.push(m.advanceWidth)}}var S={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,n),yMax:Math.max.apply(null,i),advanceWidthMax:Math.max.apply(null,s),advanceWidthAvg:ml(s),minLeftSideBearing:Math.min.apply(null,a),maxLeftSideBearing:Math.max.apply(null,a),minRightSideBearing:Math.min.apply(null,o)};S.ascender=r.ascender,S.descender=r.descender;var _=Us.make({flags:3,unitsPerEm:r.unitsPerEm,xMin:S.xMin,yMin:S.yMin,xMax:S.xMax,yMax:S.yMax,lowestRecPPEM:3,createdTimestamp:r.createdTimestamp}),T=Fs.make({ascender:S.ascender,descender:S.descender,advanceWidthMax:S.advanceWidthMax,minLeftSideBearing:S.minLeftSideBearing,minRightSideBearing:S.minRightSideBearing,xMaxExtent:S.maxLeftSideBearing+(S.xMax-S.xMin),numberOfHMetrics:r.glyphs.length}),B=Gs.make(r.glyphs.length),O=Ur.make(Object.assign({xAvgCharWidth:Math.round(S.advanceWidthAvg),usFirstCharIndex:c,usLastCharIndex:h,ulUnicodeRange1:l,ulUnicodeRange2:d,ulUnicodeRange3:u,ulUnicodeRange4:f,sTypoAscender:S.ascender,sTypoDescender:S.descender,sTypoLineGap:0,usWinAscent:S.yMax,usWinDescent:Math.abs(S.yMin),ulCodePageRange1:1,sxHeight:ta(r,"xyvw",{yMax:Math.round(S.ascender/2)}).yMax,sCapHeight:ta(r,"HIKLEFJMNTZBDPRAGOQSUVWXY",S).yMax,usDefaultChar:r.hasChar(" ")?32:0,usBreakChar:r.hasChar(" ")?32:0},r.tables.os2)),P=Ns.make(r.glyphs),V=ws.make(r.glyphs),H=r.getEnglishName("fontFamily"),J=r.getEnglishName("fontSubfamily"),pe=H+" "+J,ae=r.getEnglishName("postScriptName");ae||(ae=H.replace(/\s/g,"")+"-"+J);var $={};for(var X in r.names)$[X]=r.names[X];$.uniqueID||($.uniqueID={en:r.getEnglishName("manufacturer")+":"+pe}),$.postScriptName||($.postScriptName={en:ae}),$.preferredFamily||($.preferredFamily=r.names.fontFamily),$.preferredSubfamily||($.preferredSubfamily=r.names.fontSubfamily);var Y=[],te=Xs.make($,Y),ce=Y.length>0?zs.make(Y):void 0,re=Ys.make(),he=Rs.make(r.glyphs,{version:r.getEnglishName("version"),fullName:pe,familyName:H,weightName:J,postScriptName:ae,unitsPerEm:r.unitsPerEm,fontBBox:[0,S.yMin,S.ascender,S.advanceWidthMax]}),j=r.metas&&Object.keys(r.metas).length>0?Ks.make(r.metas):void 0,W=[_,T,B,O,te,V,re,he,P];ce&&W.push(ce),r.tables.gsub&&W.push(Zs.make(r.tables.gsub)),j&&W.push(j);for(var zt=ea(W),nr=zt.encode(),rr=Fr(nr),mn=zt.fields,ir=!1,lt=0;lt<mn.length;lt+=1)if(mn[lt].name==="head table"){mn[lt].value.checkSumAdjustment=2981146554-rr,ir=!0;break}if(!ir)throw new Error("Could not find head table with checkSum to adjust.");return zt}var bl={make:ea,fontToTable:yl,computeCheckSum:Fr};function Nr(r,e){for(var t=0,n=r.length-1;t<=n;){var i=t+n>>>1,s=r[i].tag;if(s===e)return i;s<e?t=i+1:n=i-1}return-t-1}function na(r,e){for(var t=0,n=r.length-1;t<=n;){var i=t+n>>>1,s=r[i];if(s===e)return i;s<e?t=i+1:n=i-1}return-t-1}function ra(r,e){for(var t,n=0,i=r.length-1;n<=i;){var s=n+i>>>1;t=r[s];var a=t.start;if(a===e)return t;a<e?n=s+1:i=s-1}if(n>0)return t=r[n-1],e>t.end?0:t}function $t(r,e){this.font=r,this.tableName=e}$t.prototype={searchTag:Nr,binSearch:na,getTable:function(r){var e=this.font.tables[this.tableName];return!e&&r&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var r=this.getTable();return r?r.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var r=this.getTable();if(r){for(var e=!1,t=0;t<r.scripts.length;t++){var n=r.scripts[t].tag;if(n==="DFLT")return n;n==="latn"&&(e=!0)}if(e)return"latn"}},getScriptTable:function(r,e){var t=this.getTable(e);if(t){r=r||"DFLT";var n=t.scripts,i=Nr(t.scripts,r);if(i>=0)return n[i].script;if(e){var s={tag:r,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return n.splice(-1-i,0,s),s.script}}},getLangSysTable:function(r,e,t){var n=this.getScriptTable(r,t);if(n){if(!e||e==="dflt"||e==="DFLT")return n.defaultLangSys;var i=Nr(n.langSysRecords,e);if(i>=0)return n.langSysRecords[i].langSys;if(t){var s={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return n.langSysRecords.splice(-1-i,0,s),s.langSys}}},getFeatureTable:function(r,e,t,n){var i=this.getLangSysTable(r,e,n);if(i){for(var s,a=i.featureIndexes,o=this.font.tables[this.tableName].features,c=0;c<a.length;c++)if(s=o[a[c]],s.tag===t)return s.feature;if(n){var h=o.length;return z.assert(h===0||t>=o[h-1].tag,"Features must be added in alphabetical order."),s={tag:t,feature:{params:0,lookupListIndexes:[]}},o.push(s),a.push(h),s.feature}}},getLookupTables:function(r,e,t,n,i){var s=this.getFeatureTable(r,e,t,i),a=[];if(s){for(var o,c=s.lookupListIndexes,h=this.font.tables[this.tableName].lookups,l=0;l<c.length;l++)o=h[c[l]],o.lookupType===n&&a.push(o);if(a.length===0&&i){o={lookupType:n,lookupFlag:0,subtables:[],markFilteringSet:void 0};var d=h.length;return h.push(o),c.push(d),[o]}}return a},getGlyphClass:function(r,e){switch(r.format){case 1:return r.startGlyph<=e&&e<r.startGlyph+r.classes.length?r.classes[e-r.startGlyph]:0;case 2:var t=ra(r.ranges,e);return t?t.classId:0}},getCoverageIndex:function(r,e){switch(r.format){case 1:var t=na(r.glyphs,e);return t>=0?t:-1;case 2:var n=ra(r.ranges,e);return n?n.index+e-n.start:-1}},expandCoverage:function(r){if(r.format===1)return r.glyphs;for(var e=[],t=r.ranges,n=0;n<t.length;n++)for(var i=t[n],s=i.start,a=i.end,o=s;o<=a;o++)e.push(o);return e}};function qt(r){$t.call(this,r,"gpos")}qt.prototype=$t.prototype,qt.prototype.init=function(){var r=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(r)},qt.prototype.getKerningValue=function(r,e,t){for(var n=0;n<r.length;n++)for(var i=r[n].subtables,s=0;s<i.length;s++){var a=i[s],o=this.getCoverageIndex(a.coverage,e);if(!(o<0))switch(a.posFormat){case 1:for(var c=a.pairSets[o],h=0;h<c.length;h++){var l=c[h];if(l.secondGlyph===t)return l.value1&&l.value1.xAdvance||0}break;case 2:var d=this.getGlyphClass(a.classDef1,e),u=this.getGlyphClass(a.classDef2,t),f=a.classRecords[d][u];return f.value1&&f.value1.xAdvance||0}}return 0},qt.prototype.getKerningTables=function(r,e){if(this.font.tables.gpos)return this.getLookupTables(r,e,"kern",2)};function Se(r){$t.call(this,r,"gsub")}function vl(r,e){var t=r.length;if(t!==e.length)return!1;for(var n=0;n<t;n++)if(r[n]!==e[n])return!1;return!0}function zr(r,e,t){for(var n=r.subtables,i=0;i<n.length;i++){var s=n[i];if(s.substFormat===e)return s}if(t)return n.push(t),t}Se.prototype=$t.prototype,Se.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Se.prototype.getSingle=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,1),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++){var c=a[o],h=this.expandCoverage(c.coverage),l=void 0;if(c.substFormat===1){var d=c.deltaGlyphId;for(l=0;l<h.length;l++){var u=h[l];n.push({sub:u,by:u+d})}}else{var f=c.substitute;for(l=0;l<h.length;l++)n.push({sub:h[l],by:f[l]})}}return n},Se.prototype.getMultiple=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,2),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++){var c=a[o],h=this.expandCoverage(c.coverage),l=void 0;for(l=0;l<h.length;l++){var d=h[l],u=c.sequences[l];n.push({sub:d,by:u})}}return n},Se.prototype.getAlternates=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,3),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++)for(var c=a[o],h=this.expandCoverage(c.coverage),l=c.alternateSets,d=0;d<h.length;d++)n.push({sub:h[d],by:l[d]});return n},Se.prototype.getLigatures=function(r,e,t){for(var n=[],i=this.getLookupTables(e,t,r,4),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++)for(var c=a[o],h=this.expandCoverage(c.coverage),l=c.ligatureSets,d=0;d<h.length;d++)for(var u=h[d],f=l[d],y=0;y<f.length;y++){var m=f[y];n.push({sub:[u].concat(m.components),by:m.ligGlyph})}return n},Se.prototype.addSingle=function(r,e,t,n){var i=this.getLookupTables(t,n,r,1,!0)[0],s=zr(i,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});z.assert(s.coverage.format===1,"Single: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.substitute.splice(o,0,0)),s.substitute[o]=e.by},Se.prototype.addMultiple=function(r,e,t,n){z.assert(e.by instanceof Array&&e.by.length>1,'Multiple: "by" must be an array of two or more ids');var i=this.getLookupTables(t,n,r,2,!0)[0],s=zr(i,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});z.assert(s.coverage.format===1,"Multiple: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.sequences.splice(o,0,0)),s.sequences[o]=e.by},Se.prototype.addAlternate=function(r,e,t,n){var i=this.getLookupTables(t,n,r,3,!0)[0],s=zr(i,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});z.assert(s.coverage.format===1,"Alternate: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.alternateSets.splice(o,0,0)),s.alternateSets[o]=e.by},Se.prototype.addLigature=function(r,e,t,n){var i=this.getLookupTables(t,n,r,4,!0)[0],s=i.subtables[0];s||(s={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},i.subtables[0]=s),z.assert(s.coverage.format===1,"Ligature: unable to modify coverage table format "+s.coverage.format);var a=e.sub[0],o=e.sub.slice(1),c={ligGlyph:e.by,components:o},h=this.binSearch(s.coverage.glyphs,a);if(h>=0){for(var l=s.ligatureSets[h],d=0;d<l.length;d++)if(vl(l[d].components,o))return;l.push(c)}else h=-1-h,s.coverage.glyphs.splice(h,0,a),s.ligatureSets.splice(h,0,[c])},Se.prototype.getFeature=function(r,e,t){if(/ss\d\d/.test(r))return this.getSingle(r,e,t);switch(r){case"aalt":case"salt":return this.getSingle(r,e,t).concat(this.getAlternates(r,e,t));case"dlig":case"liga":case"rlig":return this.getLigatures(r,e,t);case"ccmp":return this.getMultiple(r,e,t).concat(this.getLigatures(r,e,t));case"stch":return this.getMultiple(r,e,t)}},Se.prototype.add=function(r,e,t,n){if(/ss\d\d/.test(r))return this.addSingle(r,e,t,n);switch(r){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(r,e,t,n):this.addAlternate(r,e,t,n);case"dlig":case"liga":case"rlig":return this.addLigature(r,e,t,n);case"ccmp":return e.by instanceof Array?this.addMultiple(r,e,t,n):this.addLigature(r,e,t,n)}};function xl(){return typeof window<"u"}function wl(r){for(var e=new Buffer(r.byteLength),t=new Uint8Array(r),n=0;n<e.length;++n)e[n]=t[n];return e}function Xt(r,e){if(!r)throw e}function ia(r,e,t,n,i){var s;return(e&n)>0?(s=r.parseByte(),e&i||(s=-s),s=t+s):(e&i)>0?s=t:s=t+r.parseShort(),s}function sa(r,e,t){var n=new F.Parser(e,t);r.numberOfContours=n.parseShort(),r._xMin=n.parseShort(),r._yMin=n.parseShort(),r._xMax=n.parseShort(),r._yMax=n.parseShort();var i,s;if(r.numberOfContours>0){for(var a=r.endPointIndices=[],o=0;o<r.numberOfContours;o+=1)a.push(n.parseUShort());r.instructionLength=n.parseUShort(),r.instructions=[];for(var c=0;c<r.instructionLength;c+=1)r.instructions.push(n.parseByte());var h=a[a.length-1]+1;i=[];for(var l=0;l<h;l+=1)if(s=n.parseByte(),i.push(s),(s&8)>0)for(var d=n.parseByte(),u=0;u<d;u+=1)i.push(s),l+=1;if(z.argument(i.length===h,"Bad flags."),a.length>0){var f=[],y;if(h>0){for(var m=0;m<h;m+=1)s=i[m],y={},y.onCurve=!!(s&1),y.lastPointOfContour=a.indexOf(m)>=0,f.push(y);for(var x=0,v=0;v<h;v+=1)s=i[v],y=f[v],y.x=ia(n,s,x,2,16),x=y.x;for(var w=0,S=0;S<h;S+=1)s=i[S],y=f[S],y.y=ia(n,s,w,4,32),w=y.y}r.points=f}else r.points=[]}else if(r.numberOfContours===0)r.points=[];else{r.isComposite=!0,r.points=[],r.components=[];for(var _=!0;_;){i=n.parseUShort();var T={glyphIndex:n.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(i&1)>0?(i&2)>0?(T.dx=n.parseShort(),T.dy=n.parseShort()):T.matchedPoints=[n.parseUShort(),n.parseUShort()]:(i&2)>0?(T.dx=n.parseChar(),T.dy=n.parseChar()):T.matchedPoints=[n.parseByte(),n.parseByte()],(i&8)>0?T.xScale=T.yScale=n.parseF2Dot14():(i&64)>0?(T.xScale=n.parseF2Dot14(),T.yScale=n.parseF2Dot14()):(i&128)>0&&(T.xScale=n.parseF2Dot14(),T.scale01=n.parseF2Dot14(),T.scale10=n.parseF2Dot14(),T.yScale=n.parseF2Dot14()),r.components.push(T),_=!!(i&32)}if(i&256){r.instructionLength=n.parseUShort(),r.instructions=[];for(var B=0;B<r.instructionLength;B+=1)r.instructions.push(n.parseByte())}}}function Gr(r,e){for(var t=[],n=0;n<r.length;n+=1){var i=r[n],s={x:e.xScale*i.x+e.scale01*i.y+e.dx,y:e.scale10*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};t.push(s)}return t}function Sl(r){for(var e=[],t=[],n=0;n<r.length;n+=1){var i=r[n];t.push(i),i.lastPointOfContour&&(e.push(t),t=[])}return z.argument(t.length===0,"There are still points left in the current contour."),e}function aa(r){var e=new ue;if(!r)return e;for(var t=Sl(r),n=0;n<t.length;++n){var i=t[n],s=null,a=i[i.length-1],o=i[0];if(a.onCurve)e.moveTo(a.x,a.y);else if(o.onCurve)e.moveTo(o.x,o.y);else{var c={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5};e.moveTo(c.x,c.y)}for(var h=0;h<i.length;++h)if(s=a,a=o,o=i[(h+1)%i.length],a.onCurve)e.lineTo(a.x,a.y);else{var l=o;s.onCurve||((a.x+s.x)*.5,(a.y+s.y)*.5),o.onCurve||(l={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5}),e.quadraticCurveTo(a.x,a.y,l.x,l.y)}e.closePath()}return e}function oa(r,e){if(e.isComposite)for(var t=0;t<e.components.length;t+=1){var n=e.components[t],i=r.get(n.glyphIndex);if(i.getPath(),i.points){var s=void 0;if(n.matchedPoints===void 0)s=Gr(i.points,n);else{if(n.matchedPoints[0]>e.points.length-1||n.matchedPoints[1]>i.points.length-1)throw Error("Matched points out of range in "+e.name);var a=e.points[n.matchedPoints[0]],o=i.points[n.matchedPoints[1]],c={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};o=Gr([o],c)[0],c.dx=a.x-o.x,c.dy=a.y-o.y,s=Gr(i.points,c)}e.points=e.points.concat(s)}}return aa(e.points)}function _l(r,e,t,n){for(var i=new Ue.GlyphSet(n),s=0;s<t.length-1;s+=1){var a=t[s],o=t[s+1];a!==o?i.push(s,Ue.ttfGlyphLoader(n,s,sa,r,e+a,oa)):i.push(s,Ue.glyphLoader(n,s))}return i}function Cl(r,e,t,n){var i=new Ue.GlyphSet(n);return n._push=function(s){var a=t[s],o=t[s+1];a!==o?i.push(s,Ue.ttfGlyphLoader(n,s,sa,r,e+a,oa)):i.push(s,Ue.glyphLoader(n,s))},i}function Tl(r,e,t,n,i){return i.lowMemory?Cl(r,e,t,n):_l(r,e,t,n)}var ca={getPath:aa,parse:Tl},ha,gt,la,jr;function ua(r){this.font=r,this.getCommands=function(e){return ca.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function El(r){return r}function da(r){return Math.sign(r)*Math.round(Math.abs(r))}function Al(r){return Math.sign(r)*Math.round(Math.abs(r*2))/2}function Il(r){return Math.sign(r)*(Math.round(Math.abs(r)+.5)-.5)}function Ll(r){return Math.sign(r)*Math.ceil(Math.abs(r))}function kl(r){return Math.sign(r)*Math.floor(Math.abs(r))}var pa=function(r){var e=this.srPeriod,t=this.srPhase,n=this.srThreshold,i=1;return r<0&&(r=-r,i=-1),r+=n-t,r=Math.trunc(r/e)*e,r+=t,r<0?t*i:r*i},Fe={x:1,y:0,axis:"x",distance:function(r,e,t,n){return(t?r.xo:r.x)-(n?e.xo:e.x)},interpolate:function(r,e,t,n){var i,s,a,o,c,h,l;if(!n||n===this){if(i=r.xo-e.xo,s=r.xo-t.xo,c=e.x-e.xo,h=t.x-t.xo,a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){r.x=r.xo+(c+h)/2;return}r.x=r.xo+(c*o+h*a)/l;return}if(i=n.distance(r,e,!0,!0),s=n.distance(r,t,!0,!0),c=n.distance(e,e,!1,!0),h=n.distance(t,t,!1,!0),a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){Fe.setRelative(r,r,(c+h)/2,n,!0);return}Fe.setRelative(r,r,(c*o+h*a)/l,n,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(r,e,t,n,i){if(!n||n===this){r.x=(i?e.xo:e.x)+t;return}var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+t*n.x,c=a+t*n.y;r.x=o+(r.y-c)/n.normalSlope},slope:0,touch:function(r){r.xTouched=!0},touched:function(r){return r.xTouched},untouch:function(r){r.xTouched=!1}},Ye={x:0,y:1,axis:"y",distance:function(r,e,t,n){return(t?r.yo:r.y)-(n?e.yo:e.y)},interpolate:function(r,e,t,n){var i,s,a,o,c,h,l;if(!n||n===this){if(i=r.yo-e.yo,s=r.yo-t.yo,c=e.y-e.yo,h=t.y-t.yo,a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){r.y=r.yo+(c+h)/2;return}r.y=r.yo+(c*o+h*a)/l;return}if(i=n.distance(r,e,!0,!0),s=n.distance(r,t,!0,!0),c=n.distance(e,e,!1,!0),h=n.distance(t,t,!1,!0),a=Math.abs(i),o=Math.abs(s),l=a+o,l===0){Ye.setRelative(r,r,(c+h)/2,n,!0);return}Ye.setRelative(r,r,(c*o+h*a)/l,n,!0)},normalSlope:0,setRelative:function(r,e,t,n,i){if(!n||n===this){r.y=(i?e.yo:e.y)+t;return}var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+t*n.x,c=a+t*n.y;r.y=c+n.normalSlope*(r.x-o)},slope:Number.POSITIVE_INFINITY,touch:function(r){r.yTouched=!0},touched:function(r){return r.yTouched},untouch:function(r){r.yTouched=!1}};Object.freeze(Fe),Object.freeze(Ye);function Yt(r,e){this.x=r,this.y=e,this.axis=void 0,this.slope=e/r,this.normalSlope=-r/e,Object.freeze(this)}Yt.prototype.distance=function(r,e,t,n){return this.x*Fe.distance(r,e,t,n)+this.y*Ye.distance(r,e,t,n)},Yt.prototype.interpolate=function(r,e,t,n){var i,s,a,o,c,h,l;if(a=n.distance(r,e,!0,!0),o=n.distance(r,t,!0,!0),i=n.distance(e,e,!1,!0),s=n.distance(t,t,!1,!0),c=Math.abs(a),h=Math.abs(o),l=c+h,l===0){this.setRelative(r,r,(i+s)/2,n,!0);return}this.setRelative(r,r,(i*h+s*c)/l,n,!0)},Yt.prototype.setRelative=function(r,e,t,n,i){n=n||this;var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+t*n.x,c=a+t*n.y,h=n.normalSlope,l=this.slope,d=r.x,u=r.y;r.x=(l*d-h*o+c-u)/(l-h),r.y=l*(r.x-d)+u},Yt.prototype.touch=function(r){r.xTouched=!0,r.yTouched=!0};function Zt(r,e){var t=Math.sqrt(r*r+e*e);return r/=t,e/=t,r===1&&e===0?Fe:r===0&&e===1?Ye:new Yt(r,e)}function Ze(r,e,t,n){this.x=this.xo=Math.round(r*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=t,this.onCurve=n,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Ze.prototype.nextTouched=function(r){for(var e=this.nextPointOnContour;!r.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},Ze.prototype.prevTouched=function(r){for(var e=this.prevPointOnContour;!r.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};var Kt=Object.freeze(new Ze(0,0)),Bl={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function nt(r,e){switch(this.env=r,this.stack=[],this.prog=e,r){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Fe,this.round=da}}ua.prototype.exec=function(r,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(!(this._errorState>2)){var t=this.font,n=this._prepState;if(!n||n.ppem!==e){var i=this._fpgmState;if(!i){nt.prototype=Bl,i=this._fpgmState=new nt("fpgm",t.tables.fpgm),i.funcs=[],i.font=t,A.DEBUG&&(console.log("---EXEC FPGM---"),i.step=-1);try{gt(i)}catch(h){console.log("Hinting error in FPGM:"+h),this._errorState=3;return}}nt.prototype=i,n=this._prepState=new nt("prep",t.tables.prep),n.ppem=e;var s=t.tables.cvt;if(s)for(var a=n.cvt=new Array(s.length),o=e/t.unitsPerEm,c=0;c<s.length;c++)a[c]=s[c]*o;else n.cvt=[];A.DEBUG&&(console.log("---EXEC PREP---"),n.step=-1);try{gt(n)}catch(h){this._errorState<2&&console.log("Hinting error in PREP:"+h),this._errorState=2}}if(!(this._errorState>1))try{return la(r,n)}catch(h){this._errorState<1&&(console.log("Hinting error:"+h),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}},la=function(r,e){var t=e.ppem/e.font.unitsPerEm,n=t,i=r.components,s,a,o;if(nt.prototype=e,!i)o=new nt("glyf",r.instructions),A.DEBUG&&(console.log("---EXEC GLYPH---"),o.step=-1),jr(r,o,t,n),a=o.gZone;else{var c=e.font;a=[],s=[];for(var h=0;h<i.length;h++){var l=i[h],d=c.glyphs.get(l.glyphIndex);o=new nt("glyf",d.instructions),A.DEBUG&&(console.log("---EXEC COMP "+h+"---"),o.step=-1),jr(d,o,t,n);for(var u=Math.round(l.dx*t),f=Math.round(l.dy*n),y=o.gZone,m=o.contours,x=0;x<y.length;x++){var v=y[x];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+u,v.yo=v.y=v.y+f}var w=a.length;a.push.apply(a,y);for(var S=0;S<m.length;S++)s.push(m[S]+w)}r.instructions&&!o.inhibitGridFit&&(o=new nt("glyf",r.instructions),o.gZone=o.z0=o.z1=o.z2=a,o.contours=s,a.push(new Ze(0,0),new Ze(Math.round(r.advanceWidth*t),0)),A.DEBUG&&(console.log("---EXEC COMPOSITE---"),o.step=-1),gt(o),a.length-=2)}return a},jr=function(r,e,t,n){for(var i=r.points||[],s=i.length,a=e.gZone=e.z0=e.z1=e.z2=[],o=e.contours=[],c,h=0;h<s;h++)c=i[h],a[h]=new Ze(c.x*t,c.y*n,c.lastPointOfContour,c.onCurve);for(var l,d,u=0;u<s;u++)c=a[u],l||(l=c,o.push(u)),c.lastPointOfContour?(c.nextPointOnContour=l,l.prevPointOnContour=c,l=void 0):(d=a[u+1],c.nextPointOnContour=d,d.prevPointOnContour=c);if(!e.inhibitGridFit){if(A.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(var f=0;f<s;f++)console.log(f,a[f].x,a[f].y)}if(a.push(new Ze(0,0),new Ze(Math.round(r.advanceWidth*t),0)),gt(e),a.length-=2,A.DEBUG){console.log("FINISHED GLYPH",e.stack);for(var y=0;y<s;y++)console.log(y,a[y].x,a[y].y)}}},gt=function(r){var e=r.prog;if(e){var t=e.length,n;for(r.ip=0;r.ip<t;r.ip++){if(A.DEBUG&&r.step++,n=ha[e[r.ip]],!n)throw new Error("unknown instruction: 0x"+Number(e[r.ip]).toString(16));n(r)}}};function Rn(r){for(var e=r.tZone=new Array(r.gZone.length),t=0;t<e.length;t++)e[t]=new Ze(0,0)}function fa(r,e){var t=r.prog,n=r.ip,i=1,s;do if(s=t[++n],s===88)i++;else if(s===89)i--;else if(s===64)n+=t[n+1]+1;else if(s===65)n+=2*t[n+1]+1;else if(s>=176&&s<=183)n+=s-176+1;else if(s>=184&&s<=191)n+=(s-184+1)*2;else if(e&&i===1&&s===27)break;while(i>0);r.ip=n}function ga(r,e){A.DEBUG&&console.log(e.step,"SVTCA["+r.axis+"]"),e.fv=e.pv=e.dpv=r}function ma(r,e){A.DEBUG&&console.log(e.step,"SPVTCA["+r.axis+"]"),e.pv=e.dpv=r}function ya(r,e){A.DEBUG&&console.log(e.step,"SFVTCA["+r.axis+"]"),e.fv=r}function ba(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z2[n],a=e.z1[i];A.DEBUG&&console.log("SPVTL["+r+"]",n,i);var o,c;r?(o=s.y-a.y,c=a.x-s.x):(o=a.x-s.x,c=a.y-s.y),e.pv=e.dpv=Zt(o,c)}function va(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z2[n],a=e.z1[i];A.DEBUG&&console.log("SFVTL["+r+"]",n,i);var o,c;r?(o=s.y-a.y,c=a.x-s.x):(o=a.x-s.x,c=a.y-s.y),e.fv=Zt(o,c)}function Ml(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SPVFS[]",t,n),r.pv=r.dpv=Zt(n,t)}function Ol(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SPVFS[]",t,n),r.fv=Zt(n,t)}function Pl(r){var e=r.stack,t=r.pv;A.DEBUG&&console.log(r.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function Dl(r){var e=r.stack,t=r.fv;A.DEBUG&&console.log(r.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function Rl(r){r.fv=r.pv,A.DEBUG&&console.log(r.step,"SFVTPV[]")}function Ul(r){var e=r.stack,t=e.pop(),n=e.pop(),i=e.pop(),s=e.pop(),a=e.pop(),o=r.z0,c=r.z1,h=o[t],l=o[n],d=c[i],u=c[s],f=r.z2[a];A.DEBUG&&console.log("ISECT[], ",t,n,i,s,a);var y=h.x,m=h.y,x=l.x,v=l.y,w=d.x,S=d.y,_=u.x,T=u.y,B=(y-x)*(S-T)-(m-v)*(w-_),O=y*v-m*x,P=w*T-S*_;f.x=(O*(w-_)-P*(y-x))/B,f.y=(O*(S-T)-P*(m-v))/B}function Fl(r){r.rp0=r.stack.pop(),A.DEBUG&&console.log(r.step,"SRP0[]",r.rp0)}function Nl(r){r.rp1=r.stack.pop(),A.DEBUG&&console.log(r.step,"SRP1[]",r.rp1)}function zl(r){r.rp2=r.stack.pop(),A.DEBUG&&console.log(r.step,"SRP2[]",r.rp2)}function Gl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZP0[]",e),r.zp0=e,e){case 0:r.tZone||Rn(r),r.z0=r.tZone;break;case 1:r.z0=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function jl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZP1[]",e),r.zp1=e,e){case 0:r.tZone||Rn(r),r.z1=r.tZone;break;case 1:r.z1=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function Vl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZP2[]",e),r.zp2=e,e){case 0:r.tZone||Rn(r),r.z2=r.tZone;break;case 1:r.z2=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function Hl(r){var e=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"SZPS[]",e),r.zp0=r.zp1=r.zp2=e,e){case 0:r.tZone||Rn(r),r.z0=r.z1=r.z2=r.tZone;break;case 1:r.z0=r.z1=r.z2=r.gZone;break;default:throw new Error("Invalid zone pointer")}}function Wl(r){r.loop=r.stack.pop(),A.DEBUG&&console.log(r.step,"SLOOP[]",r.loop)}function $l(r){A.DEBUG&&console.log(r.step,"RTG[]"),r.round=da}function ql(r){A.DEBUG&&console.log(r.step,"RTHG[]"),r.round=Il}function Xl(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SMD[]",e),r.minDis=e/64}function Yl(r){A.DEBUG&&console.log(r.step,"ELSE[]"),fa(r,!1)}function Zl(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"JMPR[]",e),r.ip+=e-1}function Kl(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SCVTCI[]",e),r.cvCutIn=e/64}function Jl(r){var e=r.stack;A.DEBUG&&console.log(r.step,"DUP[]"),e.push(e[e.length-1])}function Vr(r){A.DEBUG&&console.log(r.step,"POP[]"),r.stack.pop()}function Ql(r){A.DEBUG&&console.log(r.step,"CLEAR[]"),r.stack.length=0}function eu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SWAP[]"),e.push(t),e.push(n)}function tu(r){var e=r.stack;A.DEBUG&&console.log(r.step,"DEPTH[]"),e.push(e.length)}function nu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"LOOPCALL[]",t,n);var i=r.ip,s=r.prog;r.prog=r.funcs[t];for(var a=0;a<n;a++)gt(r),A.DEBUG&&console.log(++r.step,a+1<n?"next loopcall":"done loopcall",a);r.ip=i,r.prog=s}function ru(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"CALL[]",e);var t=r.ip,n=r.prog;r.prog=r.funcs[e],gt(r),r.ip=t,r.prog=n,A.DEBUG&&console.log(++r.step,"returning from",e)}function iu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"CINDEX[]",t),e.push(e[e.length-t])}function su(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"MINDEX[]",t),e.push(e.splice(e.length-t,1)[0])}function au(r){if(r.env!=="fpgm")throw new Error("FDEF not allowed here");var e=r.stack,t=r.prog,n=r.ip,i=e.pop(),s=n;for(A.DEBUG&&console.log(r.step,"FDEF[]",i);t[++n]!==45;);r.ip=n,r.funcs[i]=t.slice(s+1,n)}function xa(r,e){var t=e.stack.pop(),n=e.z0[t],i=e.fv,s=e.pv;A.DEBUG&&console.log(e.step,"MDAP["+r+"]",t);var a=s.distance(n,Kt);r&&(a=e.round(a)),i.setRelative(n,Kt,a,s),i.touch(n),e.rp0=e.rp1=t}function wa(r,e){var t=e.z2,n=t.length-2,i,s,a;A.DEBUG&&console.log(e.step,"IUP["+r.axis+"]");for(var o=0;o<n;o++)i=t[o],!r.touched(i)&&(s=i.prevTouched(r),s!==i&&(a=i.nextTouched(r),s===a&&r.setRelative(i,i,r.distance(s,s,!1,!0),r,!0),r.interpolate(i,s,a,r)))}function Sa(r,e){for(var t=e.stack,n=r?e.rp1:e.rp2,i=(r?e.z0:e.z1)[n],s=e.fv,a=e.pv,o=e.loop,c=e.z2;o--;){var h=t.pop(),l=c[h],d=a.distance(i,i,!1,!0);s.setRelative(l,l,d,a),s.touch(l),A.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-o)+": ":"")+"SHP["+(r?"rp1":"rp2")+"]",h)}e.loop=1}function _a(r,e){var t=e.stack,n=r?e.rp1:e.rp2,i=(r?e.z0:e.z1)[n],s=e.fv,a=e.pv,o=t.pop(),c=e.z2[e.contours[o]],h=c;A.DEBUG&&console.log(e.step,"SHC["+r+"]",o);var l=a.distance(i,i,!1,!0);do h!==i&&s.setRelative(h,h,l,a),h=h.nextPointOnContour;while(h!==c)}function Ca(r,e){var t=e.stack,n=r?e.rp1:e.rp2,i=(r?e.z0:e.z1)[n],s=e.fv,a=e.pv,o=t.pop();A.DEBUG&&console.log(e.step,"SHZ["+r+"]",o);var c;switch(o){case 0:c=e.tZone;break;case 1:c=e.gZone;break;default:throw new Error("Invalid zone")}for(var h,l=a.distance(i,i,!1,!0),d=c.length-2,u=0;u<d;u++)h=c[u],s.setRelative(h,h,l,a)}function ou(r){for(var e=r.stack,t=r.loop,n=r.fv,i=e.pop()/64,s=r.z2;t--;){var a=e.pop(),o=s[a];A.DEBUG&&console.log(r.step,(r.loop>1?"loop "+(r.loop-t)+": ":"")+"SHPIX[]",a,i),n.setRelative(o,o,i),n.touch(o)}r.loop=1}function cu(r){for(var e=r.stack,t=r.rp1,n=r.rp2,i=r.loop,s=r.z0[t],a=r.z1[n],o=r.fv,c=r.dpv,h=r.z2;i--;){var l=e.pop(),d=h[l];A.DEBUG&&console.log(r.step,(r.loop>1?"loop "+(r.loop-i)+": ":"")+"IP[]",l,t,"<->",n),o.interpolate(d,s,a,c),o.touch(d)}r.loop=1}function Ta(r,e){var t=e.stack,n=t.pop()/64,i=t.pop(),s=e.z1[i],a=e.z0[e.rp0],o=e.fv,c=e.pv;o.setRelative(s,a,n,c),o.touch(s),A.DEBUG&&console.log(e.step,"MSIRP["+r+"]",n,i),e.rp1=e.rp0,e.rp2=i,r&&(e.rp0=i)}function hu(r){for(var e=r.stack,t=r.rp0,n=r.z0[t],i=r.loop,s=r.fv,a=r.pv,o=r.z1;i--;){var c=e.pop(),h=o[c];A.DEBUG&&console.log(r.step,(r.loop>1?"loop "+(r.loop-i)+": ":"")+"ALIGNRP[]",c),s.setRelative(h,n,0,a),s.touch(h)}r.loop=1}function lu(r){A.DEBUG&&console.log(r.step,"RTDG[]"),r.round=Al}function Ea(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z0[i],a=e.fv,o=e.pv,c=e.cvt[n];A.DEBUG&&console.log(e.step,"MIAP["+r+"]",n,"(",c,")",i);var h=o.distance(s,Kt);r&&(Math.abs(h-c)<e.cvCutIn&&(h=c),h=e.round(h)),a.setRelative(s,Kt,h,o),e.zp0===0&&(s.xo=s.x,s.yo=s.y),a.touch(s),e.rp0=e.rp1=i}function uu(r){var e=r.prog,t=r.ip,n=r.stack,i=e[++t];A.DEBUG&&console.log(r.step,"NPUSHB[]",i);for(var s=0;s<i;s++)n.push(e[++t]);r.ip=t}function du(r){var e=r.ip,t=r.prog,n=r.stack,i=t[++e];A.DEBUG&&console.log(r.step,"NPUSHW[]",i);for(var s=0;s<i;s++){var a=t[++e]<<8|t[++e];a&32768&&(a=-((a^65535)+1)),n.push(a)}r.ip=e}function pu(r){var e=r.stack,t=r.store;t||(t=r.store=[]);var n=e.pop(),i=e.pop();A.DEBUG&&console.log(r.step,"WS",n,i),t[i]=n}function fu(r){var e=r.stack,t=r.store,n=e.pop();A.DEBUG&&console.log(r.step,"RS",n);var i=t&&t[n]||0;e.push(i)}function gu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"WCVTP",t,n),r.cvt[n]=t/64}function mu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"RCVT",t),e.push(r.cvt[t]*64)}function Aa(r,e){var t=e.stack,n=t.pop(),i=e.z2[n];A.DEBUG&&console.log(e.step,"GC["+r+"]",n),t.push(e.dpv.distance(i,Kt,r,!1)*64)}function Ia(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z1[n],a=e.z0[i],o=e.dpv.distance(a,s,r,r);A.DEBUG&&console.log(e.step,"MD["+r+"]",n,i,"->",o),e.stack.push(Math.round(o*64))}function yu(r){A.DEBUG&&console.log(r.step,"MPPEM[]"),r.stack.push(r.ppem)}function bu(r){A.DEBUG&&console.log(r.step,"FLIPON[]"),r.autoFlip=!0}function vu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"LT[]",t,n),e.push(n<t?1:0)}function xu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"LTEQ[]",t,n),e.push(n<=t?1:0)}function wu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"GT[]",t,n),e.push(n>t?1:0)}function Su(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"GTEQ[]",t,n),e.push(n>=t?1:0)}function _u(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"EQ[]",t,n),e.push(t===n?1:0)}function Cu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"NEQ[]",t,n),e.push(t!==n?1:0)}function Tu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function Eu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function Au(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"IF[]",e),e||(fa(r,!0),A.DEBUG&&console.log(r.step,"EIF[]"))}function Iu(r){A.DEBUG&&console.log(r.step,"EIF[]")}function Lu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"AND[]",t,n),e.push(t&&n?1:0)}function ku(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"OR[]",t,n),e.push(t||n?1:0)}function Bu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"NOT[]",t),e.push(t?0:1)}function Hr(r,e){var t=e.stack,n=t.pop(),i=e.fv,s=e.pv,a=e.ppem,o=e.deltaBase+(r-1)*16,c=e.deltaShift,h=e.z0;A.DEBUG&&console.log(e.step,"DELTAP["+r+"]",n,t);for(var l=0;l<n;l++){var d=t.pop(),u=t.pop(),f=o+((u&240)>>4);if(f===a){var y=(u&15)-8;y>=0&&y++,A.DEBUG&&console.log(e.step,"DELTAPFIX",d,"by",y*c);var m=h[d];i.setRelative(m,m,y*c,s)}}}function Mu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"SDB[]",t),r.deltaBase=t}function Ou(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"SDS[]",t),r.deltaShift=Math.pow(.5,t)}function Pu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"ADD[]",t,n),e.push(n+t)}function Du(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"SUB[]",t,n),e.push(n-t)}function Ru(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"DIV[]",t,n),e.push(n*64/t)}function Uu(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"MUL[]",t,n),e.push(n*t/64)}function Fu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"ABS[]",t),e.push(Math.abs(t))}function Nu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"NEG[]",t),e.push(-t)}function zu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function Gu(r){var e=r.stack,t=e.pop();A.DEBUG&&console.log(r.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function Un(r,e){var t=e.stack,n=t.pop();A.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(n/64)*64)}function ju(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"WCVTF[]",t,n),r.cvt[n]=t*r.ppem/r.font.unitsPerEm}function Wr(r,e){var t=e.stack,n=t.pop(),i=e.ppem,s=e.deltaBase+(r-1)*16,a=e.deltaShift;A.DEBUG&&console.log(e.step,"DELTAC["+r+"]",n,t);for(var o=0;o<n;o++){var c=t.pop(),h=t.pop(),l=s+((h&240)>>4);if(l===i){var d=(h&15)-8;d>=0&&d++;var u=d*a;A.DEBUG&&console.log(e.step,"DELTACFIX",c,"by",u),e.cvt[c]+=u}}}function Vu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SROUND[]",e),r.round=pa;var t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(r.srPeriod=t,e&48){case 0:r.srPhase=0;break;case 16:r.srPhase=.25*t;break;case 32:r.srPhase=.5*t;break;case 48:r.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?r.srThreshold=0:r.srThreshold=(e/8-.5)*t}function Hu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"S45ROUND[]",e),r.round=pa;var t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(r.srPeriod=t,e&48){case 0:r.srPhase=0;break;case 16:r.srPhase=.25*t;break;case 32:r.srPhase=.5*t;break;case 48:r.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?r.srThreshold=0:r.srThreshold=(e/8-.5)*t}function Wu(r){A.DEBUG&&console.log(r.step,"ROFF[]"),r.round=El}function $u(r){A.DEBUG&&console.log(r.step,"RUTG[]"),r.round=Ll}function qu(r){A.DEBUG&&console.log(r.step,"RDTG[]"),r.round=kl}function Xu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SCANCTRL[]",e)}function La(r,e){var t=e.stack,n=t.pop(),i=t.pop(),s=e.z2[n],a=e.z1[i];A.DEBUG&&console.log(e.step,"SDPVTL["+r+"]",n,i);var o,c;r?(o=s.y-a.y,c=a.x-s.x):(o=a.x-s.x,c=a.y-s.y),e.dpv=Zt(o,c)}function Yu(r){var e=r.stack,t=e.pop(),n=0;A.DEBUG&&console.log(r.step,"GETINFO[]",t),t&1&&(n=35),t&32&&(n|=4096),e.push(n)}function Zu(r){var e=r.stack,t=e.pop(),n=e.pop(),i=e.pop();A.DEBUG&&console.log(r.step,"ROLL[]"),e.push(n),e.push(t),e.push(i)}function Ku(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"MAX[]",t,n),e.push(Math.max(n,t))}function Ju(r){var e=r.stack,t=e.pop(),n=e.pop();A.DEBUG&&console.log(r.step,"MIN[]",t,n),e.push(Math.min(n,t))}function Qu(r){var e=r.stack.pop();A.DEBUG&&console.log(r.step,"SCANTYPE[]",e)}function ed(r){var e=r.stack.pop(),t=r.stack.pop();switch(A.DEBUG&&console.log(r.step,"INSTCTRL[]",e,t),e){case 1:r.inhibitGridFit=!!t;return;case 2:r.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function rt(r,e){var t=e.stack,n=e.prog,i=e.ip;A.DEBUG&&console.log(e.step,"PUSHB["+r+"]");for(var s=0;s<r;s++)t.push(n[++i]);e.ip=i}function it(r,e){var t=e.ip,n=e.prog,i=e.stack;A.DEBUG&&console.log(e.ip,"PUSHW["+r+"]");for(var s=0;s<r;s++){var a=n[++t]<<8|n[++t];a&32768&&(a=-((a^65535)+1)),i.push(a)}e.ip=t}function U(r,e,t,n,i,s){var a=s.stack,o=r&&a.pop(),c=a.pop(),h=s.rp0,l=s.z0[h],d=s.z1[c],u=s.minDis,f=s.fv,y=s.dpv,m,x,v,w;x=m=y.distance(d,l,!0,!0),v=x>=0?1:-1,x=Math.abs(x),r&&(w=s.cvt[o],n&&Math.abs(x-w)<s.cvCutIn&&(x=w)),t&&x<u&&(x=u),n&&(x=s.round(x)),f.setRelative(d,l,v*x,y),f.touch(d),A.DEBUG&&console.log(s.step,(r?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(n?"R":"_")+(i===0?"Gr":i===1?"Bl":i===2?"Wh":"")+"]",r?o+"("+s.cvt[o]+","+w+")":"",c,"(d =",m,"->",v*x,")"),s.rp1=s.rp0,s.rp2=c,e&&(s.rp0=c)}ha=[ga.bind(void 0,Ye),ga.bind(void 0,Fe),ma.bind(void 0,Ye),ma.bind(void 0,Fe),ya.bind(void 0,Ye),ya.bind(void 0,Fe),ba.bind(void 0,0),ba.bind(void 0,1),va.bind(void 0,0),va.bind(void 0,1),Ml,Ol,Pl,Dl,Rl,Ul,Fl,Nl,zl,Gl,jl,Vl,Hl,Wl,$l,ql,Xl,Yl,Zl,Kl,void 0,void 0,Jl,Vr,Ql,eu,tu,iu,su,void 0,void 0,void 0,nu,ru,au,void 0,xa.bind(void 0,0),xa.bind(void 0,1),wa.bind(void 0,Ye),wa.bind(void 0,Fe),Sa.bind(void 0,0),Sa.bind(void 0,1),_a.bind(void 0,0),_a.bind(void 0,1),Ca.bind(void 0,0),Ca.bind(void 0,1),ou,cu,Ta.bind(void 0,0),Ta.bind(void 0,1),hu,lu,Ea.bind(void 0,0),Ea.bind(void 0,1),uu,du,pu,fu,gu,mu,Aa.bind(void 0,0),Aa.bind(void 0,1),void 0,Ia.bind(void 0,0),Ia.bind(void 0,1),yu,void 0,bu,void 0,void 0,vu,xu,wu,Su,_u,Cu,Tu,Eu,Au,Iu,Lu,ku,Bu,Hr.bind(void 0,1),Mu,Ou,Pu,Du,Ru,Uu,Fu,Nu,zu,Gu,Un.bind(void 0,0),Un.bind(void 0,1),Un.bind(void 0,2),Un.bind(void 0,3),void 0,void 0,void 0,void 0,ju,Hr.bind(void 0,2),Hr.bind(void 0,3),Wr.bind(void 0,1),Wr.bind(void 0,2),Wr.bind(void 0,3),Vu,Hu,void 0,void 0,Wu,void 0,$u,qu,Vr,Vr,void 0,void 0,void 0,void 0,void 0,Xu,La.bind(void 0,0),La.bind(void 0,1),Yu,void 0,Zu,Ku,Ju,Qu,ed,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,rt.bind(void 0,1),rt.bind(void 0,2),rt.bind(void 0,3),rt.bind(void 0,4),rt.bind(void 0,5),rt.bind(void 0,6),rt.bind(void 0,7),rt.bind(void 0,8),it.bind(void 0,1),it.bind(void 0,2),it.bind(void 0,3),it.bind(void 0,4),it.bind(void 0,5),it.bind(void 0,6),it.bind(void 0,7),it.bind(void 0,8),U.bind(void 0,0,0,0,0,0),U.bind(void 0,0,0,0,0,1),U.bind(void 0,0,0,0,0,2),U.bind(void 0,0,0,0,0,3),U.bind(void 0,0,0,0,1,0),U.bind(void 0,0,0,0,1,1),U.bind(void 0,0,0,0,1,2),U.bind(void 0,0,0,0,1,3),U.bind(void 0,0,0,1,0,0),U.bind(void 0,0,0,1,0,1),U.bind(void 0,0,0,1,0,2),U.bind(void 0,0,0,1,0,3),U.bind(void 0,0,0,1,1,0),U.bind(void 0,0,0,1,1,1),U.bind(void 0,0,0,1,1,2),U.bind(void 0,0,0,1,1,3),U.bind(void 0,0,1,0,0,0),U.bind(void 0,0,1,0,0,1),U.bind(void 0,0,1,0,0,2),U.bind(void 0,0,1,0,0,3),U.bind(void 0,0,1,0,1,0),U.bind(void 0,0,1,0,1,1),U.bind(void 0,0,1,0,1,2),U.bind(void 0,0,1,0,1,3),U.bind(void 0,0,1,1,0,0),U.bind(void 0,0,1,1,0,1),U.bind(void 0,0,1,1,0,2),U.bind(void 0,0,1,1,0,3),U.bind(void 0,0,1,1,1,0),U.bind(void 0,0,1,1,1,1),U.bind(void 0,0,1,1,1,2),U.bind(void 0,0,1,1,1,3),U.bind(void 0,1,0,0,0,0),U.bind(void 0,1,0,0,0,1),U.bind(void 0,1,0,0,0,2),U.bind(void 0,1,0,0,0,3),U.bind(void 0,1,0,0,1,0),U.bind(void 0,1,0,0,1,1),U.bind(void 0,1,0,0,1,2),U.bind(void 0,1,0,0,1,3),U.bind(void 0,1,0,1,0,0),U.bind(void 0,1,0,1,0,1),U.bind(void 0,1,0,1,0,2),U.bind(void 0,1,0,1,0,3),U.bind(void 0,1,0,1,1,0),U.bind(void 0,1,0,1,1,1),U.bind(void 0,1,0,1,1,2),U.bind(void 0,1,0,1,1,3),U.bind(void 0,1,1,0,0,0),U.bind(void 0,1,1,0,0,1),U.bind(void 0,1,1,0,0,2),U.bind(void 0,1,1,0,0,3),U.bind(void 0,1,1,0,1,0),U.bind(void 0,1,1,0,1,1),U.bind(void 0,1,1,0,1,2),U.bind(void 0,1,1,0,1,3),U.bind(void 0,1,1,1,0,0),U.bind(void 0,1,1,1,0,1),U.bind(void 0,1,1,1,0,2),U.bind(void 0,1,1,1,0,3),U.bind(void 0,1,1,1,1,0),U.bind(void 0,1,1,1,1,1),U.bind(void 0,1,1,1,1,2),U.bind(void 0,1,1,1,1,3)];function Ct(r){this.char=r,this.state={},this.activeState=null}function $r(r,e,t){this.contextName=t,this.startIndex=r,this.endOffset=e}function td(r,e,t){this.contextName=r,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=t}function Be(r,e){this.context=r,this.index=e,this.length=r.length,this.current=r[e],this.backtrack=r.slice(0,e),this.lookahead=r.slice(e+1)}function Fn(r){this.eventId=r,this.subscribers=[]}function nd(r){var e=this,t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];t.forEach(function(i){Object.defineProperty(e.events,i,{value:new Fn(i)})}),r&&t.forEach(function(i){var s=r[i];typeof s=="function"&&e.events[i].subscribe(s)});var n=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];n.forEach(function(i){e.events[i].subscribe(e.updateContextsRanges)})}function ne(r){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],nd.call(this,r)}Ct.prototype.setState=function(r,e){return this.state[r]=e,this.activeState={key:r,value:this.state[r]},this.activeState},Ct.prototype.getState=function(r){return this.state[r]||null},ne.prototype.inboundIndex=function(r){return r>=0&&r<this.tokens.length},ne.prototype.composeRUD=function(r){var e=this,t=!0,n=r.map(function(s){return e[s[0]].apply(e,s.slice(1).concat(t))}),i=function(s){return typeof s=="object"&&s.hasOwnProperty("FAIL")};if(n.every(i))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:n.filter(i)};this.dispatch("composeRUD",[n.filter(function(s){return!i(s)})])},ne.prototype.replaceRange=function(r,e,t,n){e=e!==null?e:this.tokens.length;var i=t.every(function(a){return a instanceof Ct});if(!isNaN(r)&&this.inboundIndex(r)&&i){var s=this.tokens.splice.apply(this.tokens,[r,e].concat(t));return n||this.dispatch("replaceToken",[r,e,t]),[s,t]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ne.prototype.replaceToken=function(r,e,t){if(!isNaN(r)&&this.inboundIndex(r)&&e instanceof Ct){var n=this.tokens.splice(r,1,e);return t||this.dispatch("replaceToken",[r,e]),[n[0],e]}else return{FAIL:"replaceToken: invalid token or index."}},ne.prototype.removeRange=function(r,e,t){e=isNaN(e)?this.tokens.length:e;var n=this.tokens.splice(r,e);return t||this.dispatch("removeRange",[n,r,e]),n},ne.prototype.removeToken=function(r,e){if(!isNaN(r)&&this.inboundIndex(r)){var t=this.tokens.splice(r,1);return e||this.dispatch("removeToken",[t,r]),t}else return{FAIL:"removeToken: invalid token index."}},ne.prototype.insertToken=function(r,e,t){var n=r.every(function(i){return i instanceof Ct});return n?(this.tokens.splice.apply(this.tokens,[e,0].concat(r)),t||this.dispatch("insertToken",[r,e]),r):{FAIL:"insertToken: invalid token(s)."}},ne.prototype.registerModifier=function(r,e,t){this.events.newToken.subscribe(function(n,i){var s=[n,i],a=e===null||e.apply(this,s)===!0,o=[n,i];if(a){var c=t.apply(this,o);n.setState(r,c)}}),this.registeredModifiers.push(r)},Fn.prototype.subscribe=function(r){return typeof r=="function"?this.subscribers.push(r)-1:{FAIL:"invalid '"+this.eventId+"' event handler"}},Fn.prototype.unsubscribe=function(r){this.subscribers.splice(r,1)},Be.prototype.setCurrentIndex=function(r){this.index=r,this.current=this.context[r],this.backtrack=this.context.slice(0,r),this.lookahead=this.context.slice(r+1)},Be.prototype.get=function(r){switch(!0){case r===0:return this.current;case(r<0&&Math.abs(r)<=this.backtrack.length):return this.backtrack.slice(r)[0];case(r>0&&r<=this.lookahead.length):return this.lookahead[r-1];default:return null}},ne.prototype.rangeToText=function(r){if(r instanceof $r)return this.getRangeTokens(r).map(function(e){return e.char}).join("")},ne.prototype.getText=function(){return this.tokens.map(function(r){return r.char}).join("")},ne.prototype.getContext=function(r){var e=this.registeredContexts[r];return e||null},ne.prototype.on=function(r,e){var t=this.events[r];return t?t.subscribe(e):null},ne.prototype.dispatch=function(r,e){var t=this,n=this.events[r];n instanceof Fn&&n.subscribers.forEach(function(i){i.apply(t,e||[])})},ne.prototype.registerContextChecker=function(r,e,t){if(this.getContext(r))return{FAIL:"context name '"+r+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof t!="function")return{FAIL:"missing context end check."};var n=new td(r,e,t);return this.registeredContexts[r]=n,this.contextCheckers.push(n),n},ne.prototype.getRangeTokens=function(r){var e=r.startIndex+r.endOffset;return[].concat(this.tokens.slice(r.startIndex,e))},ne.prototype.getContextRanges=function(r){var e=this.getContext(r);return e?e.ranges:{FAIL:"context checker '"+r+"' is not registered."}},ne.prototype.resetContextsRanges=function(){var r=this.registeredContexts;for(var e in r)if(r.hasOwnProperty(e)){var t=r[e];t.ranges=[]}},ne.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var r=this.tokens.map(function(n){return n.char}),e=0;e<r.length;e++){var t=new Be(r,e);this.runContextCheck(t)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ne.prototype.setEndOffset=function(r,e){var t=this.getContext(e).openRange.startIndex,n=new $r(t,r,e),i=this.getContext(e).ranges;return n.rangeId=e+"."+i.length,i.push(n),this.getContext(e).openRange=null,n},ne.prototype.runContextCheck=function(r){var e=this,t=r.index;this.contextCheckers.forEach(function(n){var i=n.contextName,s=e.getContext(i).openRange;if(!s&&n.checkStart(r)&&(s=new $r(t,null,i),e.getContext(i).openRange=s,e.dispatch("contextStart",[i,t])),s&&n.checkEnd(r)){var a=t-s.startIndex+1,o=e.setEndOffset(a,i);e.dispatch("contextEnd",[i,o])}})},ne.prototype.tokenize=function(r){this.tokens=[],this.resetContextsRanges();var e=Array.from(r);this.dispatch("start");for(var t=0;t<e.length;t++){var n=e[t],i=new Be(e,t);this.dispatch("next",[i]),this.runContextCheck(i);var s=new Ct(n);this.tokens.push(s),this.dispatch("newToken",[s,i])}return this.dispatch("end",[this.tokens]),this.tokens};function st(r){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(r)}function ka(r){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(r)}function at(r){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(r)}function Nn(r){return/[A-z]/.test(r)}function rd(r){return/\s/.test(r)}function _e(r){this.font=r,this.features={}}function mt(r){this.id=r.id,this.tag=r.tag,this.substitution=r.substitution}function Jt(r,e){if(!r)return-1;switch(e.format){case 1:return e.glyphs.indexOf(r);case 2:for(var t=e.ranges,n=0;n<t.length;n++){var i=t[n];if(r>=i.start&&r<=i.end){var s=r-i.start;return i.index+s}}break;default:return-1}return-1}function id(r,e){var t=Jt(r,e.coverage);return t===-1?null:r+e.deltaGlyphId}function sd(r,e){var t=Jt(r,e.coverage);return t===-1?null:e.substitute[t]}function qr(r,e){for(var t=[],n=0;n<r.length;n++){var i=r[n],s=e.current;s=Array.isArray(s)?s[0]:s;var a=Jt(s,i);a!==-1&&t.push(a)}return t.length!==r.length?-1:t}function ad(r,e){var t=e.inputCoverage.length+e.lookaheadCoverage.length+e.backtrackCoverage.length;if(r.context.length<t)return[];var n=qr(e.inputCoverage,r);if(n===-1)return[];var i=e.inputCoverage.length-1;if(r.lookahead.length<e.lookaheadCoverage.length)return[];for(var s=r.lookahead.slice(i);s.length&&at(s[0].char);)s.shift();var a=new Be(s,0),o=qr(e.lookaheadCoverage,a),c=[].concat(r.backtrack);for(c.reverse();c.length&&at(c[0].char);)c.shift();if(c.length<e.backtrackCoverage.length)return[];var h=new Be(c,0),l=qr(e.backtrackCoverage,h),d=n.length===e.inputCoverage.length&&o.length===e.lookaheadCoverage.length&&l.length===e.backtrackCoverage.length,u=[];if(d)for(var f=0;f<e.lookupRecords.length;f++)for(var y=e.lookupRecords[f],m=y.lookupListIndex,x=this.getLookupByIndex(m),v=0;v<x.subtables.length;v++){var w=x.subtables[v],S=this.getLookupMethod(x,w),_=this.getSubstitutionType(x,w);if(_==="12")for(var T=0;T<n.length;T++){var B=r.get(T),O=S(B);O&&u.push(O)}}return u}function od(r,e){var t=r.current,n=Jt(t,e.coverage);if(n===-1)return null;for(var i,s=e.ligatureSets[n],a=0;a<s.length;a++){i=s[a];for(var o=0;o<i.components.length;o++){var c=r.lookahead[o],h=i.components[o];if(c!==h)break;if(o===i.components.length-1)return i}}return null}function cd(r,e){var t=Jt(r,e.coverage);return t===-1?null:e.sequences[t]}_e.prototype.getDefaultScriptFeaturesIndexes=function(){for(var r=this.font.tables.gsub.scripts,e=0;e<r.length;e++){var t=r[e];if(t.tag==="DFLT")return t.script.defaultLangSys.featureIndexes}return[]},_e.prototype.getScriptFeaturesIndexes=function(r){var e=this.font.tables;if(!e.gsub)return[];if(!r)return this.getDefaultScriptFeaturesIndexes();for(var t=this.font.tables.gsub.scripts,n=0;n<t.length;n++){var i=t[n];if(i.tag===r&&i.script.defaultLangSys)return i.script.defaultLangSys.featureIndexes;var s=i.langSysRecords;if(s)for(var a=0;a<s.length;a++){var o=s[a];if(o.tag===r){var c=o.langSys;return c.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},_e.prototype.mapTagsToFeatures=function(r,e){for(var t={},n=0;n<r.length;n++){var i=r[n].tag,s=r[n].feature;t[i]=s}this.features[e].tags=t},_e.prototype.getScriptFeatures=function(r){var e=this.features[r];if(this.features.hasOwnProperty(r))return e;var t=this.getScriptFeaturesIndexes(r);if(!t)return null;var n=this.font.tables.gsub;return e=t.map(function(i){return n.features[i]}),this.features[r]=e,this.mapTagsToFeatures(e,r),e},_e.prototype.getSubstitutionType=function(r,e){var t=r.lookupType.toString(),n=e.substFormat.toString();return t+n},_e.prototype.getLookupMethod=function(r,e){var t=this,n=this.getSubstitutionType(r,e);switch(n){case"11":return function(i){return id.apply(t,[i,e])};case"12":return function(i){return sd.apply(t,[i,e])};case"63":return function(i){return ad.apply(t,[i,e])};case"41":return function(i){return od.apply(t,[i,e])};case"21":return function(i){return cd.apply(t,[i,e])};default:throw new Error("lookupType: "+r.lookupType+" - substFormat: "+e.substFormat+" is not yet supported")}},_e.prototype.lookupFeature=function(r){var e=r.contextParams,t=e.index,n=this.getFeature({tag:r.tag,script:r.script});if(!n)return new Error("font '"+this.font.names.fullName.en+"' doesn't support feature '"+r.tag+"' for script '"+r.script+"'.");for(var i=this.getFeatureLookups(n),s=[].concat(e.context),a=0;a<i.length;a++)for(var o=i[a],c=this.getLookupSubtables(o),h=0;h<c.length;h++){var l=c[h],d=this.getSubstitutionType(o,l),u=this.getLookupMethod(o,l),f=void 0;switch(d){case"11":f=u(e.current),f&&s.splice(t,1,new mt({id:11,tag:r.tag,substitution:f}));break;case"12":f=u(e.current),f&&s.splice(t,1,new mt({id:12,tag:r.tag,substitution:f}));break;case"63":f=u(e),Array.isArray(f)&&f.length&&s.splice(t,1,new mt({id:63,tag:r.tag,substitution:f}));break;case"41":f=u(e),f&&s.splice(t,1,new mt({id:41,tag:r.tag,substitution:f}));break;case"21":f=u(e.current),f&&s.splice(t,1,new mt({id:21,tag:r.tag,substitution:f}));break}e=new Be(s,t),!(Array.isArray(f)&&!f.length)&&(f=null)}return s.length?s:null},_e.prototype.supports=function(r){if(!r.script)return!1;this.getScriptFeatures(r.script);var e=this.features.hasOwnProperty(r.script);if(!r.tag)return e;var t=this.features[r.script].some(function(n){return n.tag===r.tag});return e&&t},_e.prototype.getLookupSubtables=function(r){return r.subtables||null},_e.prototype.getLookupByIndex=function(r){var e=this.font.tables.gsub.lookups;return e[r]||null},_e.prototype.getFeatureLookups=function(r){return r.lookupListIndexes.map(this.getLookupByIndex.bind(this))},_e.prototype.getFeature=function(r){if(!this.font)return{FAIL:"No font was found"};this.features.hasOwnProperty(r.script)||this.getScriptFeatures(r.script);var e=this.features[r.script];return e?e.tags[r.tag]?this.features[r.script].tags[r.tag]:null:{FAIL:"No feature for script "+r.script}};function hd(r){var e=r.current,t=r.get(-1);return t===null&&st(e)||!st(t)&&st(e)}function ld(r){var e=r.get(1);return e===null||!st(e)}var ud={startCheck:hd,endCheck:ld};function dd(r){var e=r.current,t=r.get(-1);return(st(e)||at(e))&&!st(t)}function pd(r){var e=r.get(1);switch(!0){case e===null:return!0;case(!st(e)&&!at(e)):var t=rd(e);if(!t)return!0;if(t){var n=!1;if(n=r.lookahead.some(function(i){return st(i)||at(i)}),!n)return!0}break;default:return!1}}var fd={startCheck:dd,endCheck:pd};function gd(r,e,t){e[t].setState(r.tag,r.substitution)}function md(r,e,t){e[t].setState(r.tag,r.substitution)}function yd(r,e,t){r.substitution.forEach(function(n,i){var s=e[t+i];s.setState(r.tag,n)})}function bd(r,e,t){var n=e[t];n.setState(r.tag,r.substitution.ligGlyph);for(var i=r.substitution.components.length,s=0;s<i;s++)n=e[t+s+1],n.setState("deleted",!0)}var Ba={11:gd,12:md,63:yd,41:bd};function Xr(r,e,t){r instanceof mt&&Ba[r.id]&&Ba[r.id](r,e,t)}function vd(r){for(var e=[].concat(r.backtrack),t=e.length-1;t>=0;t--){var n=e[t],i=ka(n),s=at(n);if(!i&&!s)return!0;if(i)return!1}return!1}function xd(r){if(ka(r.current))return!1;for(var e=0;e<r.lookahead.length;e++){var t=r.lookahead[e],n=at(t);if(!n)return!0}return!1}function wd(r){var e=this,t="arab",n=this.featuresTags[t],i=this.tokenizer.getRangeTokens(r);if(i.length!==1){var s=new Be(i.map(function(o){return o.getState("glyphIndex")}),0),a=new Be(i.map(function(o){return o.char}),0);i.forEach(function(o,c){if(!at(o.char)){s.setCurrentIndex(c),a.setCurrentIndex(c);var h=0;vd(a)&&(h|=1),xd(a)&&(h|=2);var l;switch(h){case 1:l="fina";break;case 2:l="init";break;case 3:l="medi";break}if(n.indexOf(l)!==-1){var d=e.query.lookupFeature({tag:l,script:t,contextParams:s});if(d instanceof Error)return console.info(d.message);d.forEach(function(u,f){u instanceof mt&&(Xr(u,i,f),s.context[f]=u.substitution)})}}})}}function Ma(r,e){var t=r.map(function(n){return n.activeState.value});return new Be(t,0)}function Sd(r){var e=this,t="arab",n=this.tokenizer.getRangeTokens(r),i=Ma(n);i.context.forEach(function(s,a){i.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"rlig",script:t,contextParams:i});o.length&&(o.forEach(function(c){return Xr(c,n,a)}),i=Ma(n))})}function _d(r){var e=r.current,t=r.get(-1);return t===null&&Nn(e)||!Nn(t)&&Nn(e)}function Cd(r){var e=r.get(1);return e===null||!Nn(e)}var Td={startCheck:_d,endCheck:Cd};function Oa(r,e){var t=r.map(function(n){return n.activeState.value});return new Be(t,0)}function Ed(r){var e=this,t="latn",n=this.tokenizer.getRangeTokens(r),i=Oa(n);i.context.forEach(function(s,a){i.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"liga",script:t,contextParams:i});o.length&&(o.forEach(function(c){return Xr(c,n,a)}),i=Oa(n))})}function Me(r){this.baseDir=r||"ltr",this.tokenizer=new ne,this.featuresTags={}}Me.prototype.setText=function(r){this.text=r},Me.prototype.contextChecks={latinWordCheck:Td,arabicWordCheck:ud,arabicSentenceCheck:fd};function Yr(r){var e=this.contextChecks[r+"Check"];return this.tokenizer.registerContextChecker(r,e.startCheck,e.endCheck)}function Ad(){return Yr.call(this,"latinWord"),Yr.call(this,"arabicWord"),Yr.call(this,"arabicSentence"),this.tokenizer.tokenize(this.text)}function Id(){var r=this,e=this.tokenizer.getContextRanges("arabicSentence");e.forEach(function(t){var n=r.tokenizer.getRangeTokens(t);r.tokenizer.replaceRange(t.startIndex,t.endOffset,n.reverse())})}Me.prototype.registerFeatures=function(r,e){var t=this,n=e.filter(function(i){return t.query.supports({script:r,tag:i})});this.featuresTags.hasOwnProperty(r)?this.featuresTags[r]=this.featuresTags[r].concat(n):this.featuresTags[r]=n},Me.prototype.applyFeatures=function(r,e){if(!r)throw new Error("No valid font was provided to apply features");this.query||(this.query=new _e(r));for(var t=0;t<e.length;t++){var n=e[t];this.query.supports({script:n.script})&&this.registerFeatures(n.script,n.tags)}},Me.prototype.registerModifier=function(r,e,t){this.tokenizer.registerModifier(r,e,t)};function Zr(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Ld(){var r=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){Zr.call(this);var t=this.tokenizer.getContextRanges("arabicWord");t.forEach(function(n){wd.call(r,n)})}}function kd(){var r=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){var t=this.featuresTags[e];if(t.indexOf("rlig")!==-1){Zr.call(this);var n=this.tokenizer.getContextRanges("arabicWord");n.forEach(function(i){Sd.call(r,i)})}}}function Bd(){var r=this,e="latn";if(this.featuresTags.hasOwnProperty(e)){var t=this.featuresTags[e];if(t.indexOf("liga")!==-1){Zr.call(this);var n=this.tokenizer.getContextRanges("latinWord");n.forEach(function(i){Ed.call(r,i)})}}}Me.prototype.checkContextReady=function(r){return!!this.tokenizer.getContext(r)},Me.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(Ld.call(this),kd.call(this)),this.checkContextReady("latinWord")&&Bd.call(this),this.checkContextReady("arabicSentence")&&Id.call(this)},Me.prototype.processText=function(r){(!this.text||this.text!==r)&&(this.setText(r),Ad.call(this),this.applyFeaturesToContexts())},Me.prototype.getBidiText=function(r){return this.processText(r),this.tokenizer.getText()},Me.prototype.getTextGlyphs=function(r){this.processText(r);for(var e=[],t=0;t<this.tokenizer.tokens.length;t++){var n=this.tokenizer.tokens[t];if(!n.state.deleted){var i=n.activeState.value;e.push(Array.isArray(i)?i[0]:i)}}return e};function q(r){r=r||{},r.tables=r.tables||{},r.empty||(Xt(r.familyName,"When creating a new Font object, familyName is required."),Xt(r.styleName,"When creating a new Font object, styleName is required."),Xt(r.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Xt(r.ascender,"When creating a new Font object, ascender is required."),Xt(r.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={fontFamily:{en:r.familyName||" "},fontSubfamily:{en:r.styleName||" "},fullName:{en:r.fullName||r.familyName+" "+r.styleName},postScriptName:{en:r.postScriptName||(r.familyName+r.styleName).replace(/\s/g,"")},designer:{en:r.designer||" "},designerURL:{en:r.designerURL||" "},manufacturer:{en:r.manufacturer||" "},manufacturerURL:{en:r.manufacturerURL||" "},license:{en:r.license||" "},licenseURL:{en:r.licenseURL||" "},version:{en:r.version||"Version 0.1"},description:{en:r.description||" "},copyright:{en:r.copyright||" "},trademark:{en:r.trademark||" "}},this.unitsPerEm=r.unitsPerEm||1e3,this.ascender=r.ascender,this.descender=r.descender,this.createdTimestamp=r.createdTimestamp,this.tables=Object.assign(r.tables,{os2:Object.assign({usWeightClass:r.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:r.widthClass||this.usWidthClasses.MEDIUM,fsSelection:r.fsSelection||this.fsSelectionValues.REGULAR},r.tables.os2)})),this.supported=!0,this.glyphs=new Ue.GlyphSet(this,r.glyphs||[]),this.encoding=new Ss(this),this.position=new qt(this),this.substitution=new Se(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new ua(this)}})}q.prototype.hasChar=function(r){return this.encoding.charToGlyphIndex(r)!==null},q.prototype.charToGlyphIndex=function(r){return this.encoding.charToGlyphIndex(r)},q.prototype.charToGlyph=function(r){var e=this.charToGlyphIndex(r),t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},q.prototype.updateFeatures=function(r){return this.defaultRenderOptions.features.map(function(e){return e.script==="latn"?{script:"latn",tags:e.tags.filter(function(t){return r[t]})}:e})},q.prototype.stringToGlyphs=function(r,e){var t=this,n=new Me,i=function(d){return t.charToGlyphIndex(d.char)};n.registerModifier("glyphIndex",null,i);var s=e?this.updateFeatures(e.features):this.defaultRenderOptions.features;n.applyFeatures(this,s);for(var a=n.getTextGlyphs(r),o=a.length,c=new Array(o),h=this.glyphs.get(0),l=0;l<o;l+=1)c[l]=this.glyphs.get(a[l])||h;return c},q.prototype.nameToGlyphIndex=function(r){return this.glyphNames.nameToGlyphIndex(r)},q.prototype.nameToGlyph=function(r){var e=this.nameToGlyphIndex(r),t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},q.prototype.glyphIndexToName=function(r){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(r):""},q.prototype.getKerningValue=function(r,e){r=r.index||r,e=e.index||e;var t=this.position.defaultKerningTables;return t?this.position.getKerningValue(t,r,e):this.kerningPairs[r+","+e]||0},q.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]}]},q.prototype.forEachGlyph=function(r,e,t,n,i,s){e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:72,i=Object.assign({},this.defaultRenderOptions,i);var a=1/this.unitsPerEm*n,o=this.stringToGlyphs(r,i),c;if(i.kerning){var h=i.script||this.position.getDefaultScriptName();c=this.position.getKerningTables(h,i.language)}for(var l=0;l<o.length;l+=1){var d=o[l];if(s.call(this,d,e,t,n,i),d.advanceWidth&&(e+=d.advanceWidth*a),i.kerning&&l<o.length-1){var u=c?this.position.getKerningValue(c,d.index,o[l+1].index):this.getKerningValue(d,o[l+1]);e+=u*a}i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e},q.prototype.getPath=function(r,e,t,n,i){var s=new ue;return this.forEachGlyph(r,e,t,n,i,function(a,o,c,h){var l=a.getPath(o,c,h,i,this);s.extend(l)}),s},q.prototype.getPaths=function(r,e,t,n,i){var s=[];return this.forEachGlyph(r,e,t,n,i,function(a,o,c,h){var l=a.getPath(o,c,h,i,this);s.push(l)}),s},q.prototype.getAdvanceWidth=function(r,e,t){return this.forEachGlyph(r,0,0,e,t,function(){})},q.prototype.draw=function(r,e,t,n,i,s){this.getPath(e,t,n,i,s).draw(r)},q.prototype.drawPoints=function(r,e,t,n,i,s){this.forEachGlyph(e,t,n,i,s,function(a,o,c,h){a.drawPoints(r,o,c,h)})},q.prototype.drawMetrics=function(r,e,t,n,i,s){this.forEachGlyph(e,t,n,i,s,function(a,o,c,h){a.drawMetrics(r,o,c,h)})},q.prototype.getEnglishName=function(r){var e=this.names[r];if(e)return e.en},q.prototype.validate=function(){var r=this;function e(t){var n=r.getEnglishName(t);n&&n.trim().length>0}e("fontFamily"),e("weightName"),e("manufacturer"),e("copyright"),e("version"),this.unitsPerEm>0},q.prototype.toTables=function(){return bl.fontToTable(this)},q.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},q.prototype.toArrayBuffer=function(){for(var r=this.toTables(),e=r.encode(),t=new ArrayBuffer(e.length),n=new Uint8Array(t),i=0;i<e.length;i++)n[i]=e[i];return t},q.prototype.download=function(r){var e=this.getEnglishName("fontFamily"),t=this.getEnglishName("fontSubfamily");r=r||e.replace(/\s/g,"")+"-"+t+".otf";var n=this.toArrayBuffer();if(xl())if(window.URL=window.URL||window.webkitURL,window.URL){var i=new DataView(n),s=new Blob([i],{type:"font/opentype"}),a=document.createElement("a");a.href=window.URL.createObjectURL(s),a.download=r;var o=document.createEvent("MouseEvents");o.initEvent("click",!0,!1),a.dispatchEvent(o)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{var c=require("fs"),h=wl(n);c.writeFileSync(r,h)}},q.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},q.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},q.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function Pa(r,e){var t=JSON.stringify(r),n=256;for(var i in e){var s=parseInt(i);if(!(!s||s<256)){if(JSON.stringify(e[i])===t)return s;n<=s&&(n=s+1)}}return e[n]=r,n}function Md(r,e,t){var n=Pa(e.name,t);return[{name:"tag_"+r,type:"TAG",value:e.tag},{name:"minValue_"+r,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+r,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+r,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+r,type:"USHORT",value:0},{name:"nameID_"+r,type:"USHORT",value:n}]}function Od(r,e,t){var n={},i=new F.Parser(r,e);return n.tag=i.parseTag(),n.minValue=i.parseFixed(),n.defaultValue=i.parseFixed(),n.maxValue=i.parseFixed(),i.skip("uShort",1),n.name=t[i.parseUShort()]||{},n}function Pd(r,e,t,n){for(var i=Pa(e.name,n),s=[{name:"nameID_"+r,type:"USHORT",value:i},{name:"flags_"+r,type:"USHORT",value:0}],a=0;a<t.length;++a){var o=t[a].tag;s.push({name:"axis_"+r+" "+o,type:"FIXED",value:e.coordinates[o]<<16})}return s}function Dd(r,e,t,n){var i={},s=new F.Parser(r,e);i.name=n[s.parseUShort()]||{},s.skip("uShort",1),i.coordinates={};for(var a=0;a<t.length;++a)i.coordinates[t[a].tag]=s.parseFixed();return i}function Rd(r,e){var t=new R.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:r.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:r.instances.length},{name:"instanceSize",type:"USHORT",value:4+r.axes.length*4}]);t.offsetToData=t.sizeOf();for(var n=0;n<r.axes.length;n++)t.fields=t.fields.concat(Md(n,r.axes[n],e));for(var i=0;i<r.instances.length;i++)t.fields=t.fields.concat(Pd(i,r.instances[i],r.axes,e));return t}function Ud(r,e,t){var n=new F.Parser(r,e),i=n.parseULong();z.argument(i===65536,"Unsupported fvar table version.");var s=n.parseOffset16();n.skip("uShort",1);for(var a=n.parseUShort(),o=n.parseUShort(),c=n.parseUShort(),h=n.parseUShort(),l=[],d=0;d<a;d++)l.push(Od(r,e+s+d*o,t));for(var u=[],f=e+s+a*o,y=0;y<c;y++)u.push(Dd(r,f+y*h,l,t));return{axes:l,instances:u}}var Fd={make:Rd,parse:Ud},Nd=function(){return{coverage:this.parsePointer(L.coverage),attachPoints:this.parseList(L.pointer(L.uShortList))}},zd=function(){var r=this.parseUShort();if(z.argument(r===1||r===2||r===3,"Unsupported CaretValue table version."),r===1)return{coordinate:this.parseShort()};if(r===2)return{pointindex:this.parseShort()};if(r===3)return{coordinate:this.parseShort()}},Gd=function(){return this.parseList(L.pointer(zd))},jd=function(){return{coverage:this.parsePointer(L.coverage),ligGlyphs:this.parseList(L.pointer(Gd))}},Vd=function(){return this.parseUShort(),this.parseList(L.pointer(L.coverage))};function Hd(r,e){e=e||0;var t=new L(r,e),n=t.parseVersion(1);z.argument(n===1||n===1.2||n===1.3,"Unsupported GDEF table version.");var i={version:n,classDef:t.parsePointer(L.classDef),attachList:t.parsePointer(Nd),ligCaretList:t.parsePointer(jd),markAttachClassDef:t.parsePointer(L.classDef)};return n>=1.2&&(i.markGlyphSets=t.parsePointer(Vd)),i}var Wd={parse:Hd},Oe=new Array(10);Oe[1]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{posFormat:1,coverage:this.parsePointer(L.coverage),value:this.parseValueRecord()};if(e===2)return{posFormat:2,coverage:this.parsePointer(L.coverage),values:this.parseValueRecordList()};z.assert(!1,"0x"+r.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Oe[2]=function(){var r=this.offset+this.relativeOffset,e=this.parseUShort();z.assert(e===1||e===2,"0x"+r.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var t=this.parsePointer(L.coverage),n=this.parseUShort(),i=this.parseUShort();if(e===1)return{posFormat:e,coverage:t,valueFormat1:n,valueFormat2:i,pairSets:this.parseList(L.pointer(L.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(n),value2:this.parseValueRecord(i)}})))};if(e===2){var s=this.parsePointer(L.classDef),a=this.parsePointer(L.classDef),o=this.parseUShort(),c=this.parseUShort();return{posFormat:e,coverage:t,valueFormat1:n,valueFormat2:i,classDef1:s,classDef2:a,class1Count:o,class2Count:c,classRecords:this.parseList(o,L.list(c,function(){return{value1:this.parseValueRecord(n),value2:this.parseValueRecord(i)}}))}}},Oe[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Oe[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Oe[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Oe[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Oe[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Oe[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Oe[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function $d(r,e){e=e||0;var t=new L(r,e),n=t.parseVersion(1);return z.argument(n===1||n===1.1,"Unsupported GPOS table version "+n),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Oe)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Oe),variations:t.parseFeatureVariationsList()}}var qd=new Array(10);function Xd(r){return new R.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new R.ScriptList(r.scripts)},{name:"features",type:"TABLE",value:new R.FeatureList(r.features)},{name:"lookups",type:"TABLE",value:new R.LookupList(r.lookups,qd)}])}var Yd={parse:$d,make:Xd};function Zd(r){var e={};r.skip("uShort");var t=r.parseUShort();z.argument(t===0,"Unsupported kern sub-table version."),r.skip("uShort",2);var n=r.parseUShort();r.skip("uShort",3);for(var i=0;i<n;i+=1){var s=r.parseUShort(),a=r.parseUShort(),o=r.parseShort();e[s+","+a]=o}return e}function Kd(r){var e={};r.skip("uShort");var t=r.parseULong();t>1&&console.warn("Only the first kern subtable is supported."),r.skip("uLong");var n=r.parseUShort(),i=n&255;if(r.skip("uShort"),i===0){var s=r.parseUShort();r.skip("uShort",3);for(var a=0;a<s;a+=1){var o=r.parseUShort(),c=r.parseUShort(),h=r.parseShort();e[o+","+c]=h}}return e}function Jd(r,e){var t=new F.Parser(r,e),n=t.parseUShort();if(n===0)return Zd(t);if(n===1)return Kd(t);throw new Error("Unsupported kern table version ("+n+").")}var Qd={parse:Jd};function ep(r,e,t,n){for(var i=new F.Parser(r,e),s=n?i.parseUShort:i.parseULong,a=[],o=0;o<t+1;o+=1){var c=s.call(i);n&&(c*=2),a.push(c)}return a}var tp={parse:ep};function Da(r,e){for(var t=[],n=12,i=0;i<e;i+=1){var s=F.getTag(r,n),a=F.getULong(r,n+4),o=F.getULong(r,n+8),c=F.getULong(r,n+12);t.push({tag:s,checksum:a,offset:o,length:c,compression:!1}),n+=16}return t}function np(r,e){for(var t=[],n=44,i=0;i<e;i+=1){var s=F.getTag(r,n),a=F.getULong(r,n+4),o=F.getULong(r,n+8),c=F.getULong(r,n+12),h=void 0;o<c?h="WOFF":h=!1,t.push({tag:s,offset:a,compression:h,compressedLength:o,length:c}),n+=20}return t}function se(r,e){if(e.compression==="WOFF"){var t=new Uint8Array(r.buffer,e.offset+2,e.compressedLength-2),n=new Uint8Array(e.length);if(Yc(t,n),n.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");var i=new DataView(n.buffer,0);return{data:i,offset:0}}else return{data:r,offset:e.offset}}function rp(r,e){e=e??{};var t,n,i=new q({empty:!0}),s=new DataView(r,0),a,o=[],c=F.getTag(s,0);if(c==="\0\0\0"||c==="true"||c==="typ1")i.outlinesFormat="truetype",a=F.getUShort(s,4),o=Da(s,a);else if(c==="OTTO")i.outlinesFormat="cff",a=F.getUShort(s,4),o=Da(s,a);else if(c==="wOFF"){var h=F.getTag(s,4);if(h==="\0\0\0")i.outlinesFormat="truetype";else if(h==="OTTO")i.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+c);a=F.getUShort(s,12),o=np(s,a)}else throw new Error("Unsupported OpenType signature "+c);for(var l,d,u,f,y,m,x,v,w,S,_,T,B=0;B<a;B+=1){var O=o[B],P=void 0;switch(O.tag){case"cmap":P=se(s,O),i.tables.cmap=ws.parse(P.data,P.offset),i.encoding=new _s(i.tables.cmap);break;case"cvt ":P=se(s,O),T=new F.Parser(P.data,P.offset),i.tables.cvt=T.parseShortList(O.length/2);break;case"fvar":d=O;break;case"fpgm":P=se(s,O),T=new F.Parser(P.data,P.offset),i.tables.fpgm=T.parseByteList(O.length);break;case"head":P=se(s,O),i.tables.head=Us.parse(P.data,P.offset),i.unitsPerEm=i.tables.head.unitsPerEm,t=i.tables.head.indexToLocFormat;break;case"hhea":P=se(s,O),i.tables.hhea=Fs.parse(P.data,P.offset),i.ascender=i.tables.hhea.ascender,i.descender=i.tables.hhea.descender,i.numberOfHMetrics=i.tables.hhea.numberOfHMetrics;break;case"hmtx":x=O;break;case"ltag":P=se(s,O),n=zs.parse(P.data,P.offset);break;case"maxp":P=se(s,O),i.tables.maxp=Gs.parse(P.data,P.offset),i.numGlyphs=i.tables.maxp.numGlyphs;break;case"name":S=O;break;case"OS/2":P=se(s,O),i.tables.os2=Ur.parse(P.data,P.offset);break;case"post":P=se(s,O),i.tables.post=Ys.parse(P.data,P.offset),i.glyphNames=new Br(i.tables.post);break;case"prep":P=se(s,O),T=new F.Parser(P.data,P.offset),i.tables.prep=T.parseByteList(O.length);break;case"glyf":u=O;break;case"loca":w=O;break;case"CFF ":l=O;break;case"kern":v=O;break;case"GDEF":f=O;break;case"GPOS":y=O;break;case"GSUB":m=O;break;case"meta":_=O;break}}var V=se(s,S);if(i.tables.name=Xs.parse(V.data,V.offset,n),i.names=i.tables.name,u&&w){var H=t===0,J=se(s,w),pe=tp.parse(J.data,J.offset,i.numGlyphs,H),ae=se(s,u);i.glyphs=ca.parse(ae.data,ae.offset,pe,i,e)}else if(l){var $=se(s,l);Rs.parse($.data,$.offset,i,e)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");var X=se(s,x);if(Ns.parse(i,X.data,X.offset,i.numberOfHMetrics,i.numGlyphs,i.glyphs,e),mh(i,e),v){var Y=se(s,v);i.kerningPairs=Qd.parse(Y.data,Y.offset)}else i.kerningPairs={};if(f){var te=se(s,f);i.tables.gdef=Wd.parse(te.data,te.offset)}if(y){var ce=se(s,y);i.tables.gpos=Yd.parse(ce.data,ce.offset),i.position.init()}if(m){var re=se(s,m);i.tables.gsub=Zs.parse(re.data,re.offset)}if(d){var he=se(s,d);i.tables.fvar=Fd.parse(he.data,he.offset,i.names)}if(_){var j=se(s,_);i.tables.meta=Ks.parse(j.data,j.offset),i.metas=i.tables.meta}return i}function Ra(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},a={},o=r[0].morphTargetsRelative,c=new fe.BufferGeometry;let h=0;for(let l=0;l<r.length;++l){const d=r[l];let u=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in d.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(d.attributes[f]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in d.morphAttributes){if(!i.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphAttributes must be consistent throughout all geometries."),null;a[f]===void 0&&(a[f]=[]),a[f].push(d.morphAttributes[f])}if(e){let f;if(t)f=d.index.count;else if(d.attributes.position!==void 0)f=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". The geometry must have either an index or a position attribute"),null;c.addGroup(h,f,l),h+=f}}if(t){let l=0;const d=[];for(let u=0;u<r.length;++u){const f=r[u].index;for(let y=0;y<f.count;++y)d.push(f.getX(y)+l);l+=r[u].attributes.position.count}c.setIndex(d)}for(const l in s){const d=Ua(s[l]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" attribute."),null;c.setAttribute(l,d)}for(const l in a){const d=a[l][0].length;if(d===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[l]=[];for(let u=0;u<d;++u){const f=[];for(let m=0;m<a[l].length;++m)f.push(a[l][m][u]);const y=Ua(f);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" morphAttribute."),null;c.morphAttributes[l].push(y)}}return c}function Ua(r){let e,t,n,i=-1,s=0;for(let h=0;h<r.length;++h){const l=r[h];if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=l.normalized),n!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=l.gpuType),i!==l.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=l.count*t}const a=new e(s),o=new fe.BufferAttribute(a,t,n);let c=0;for(let h=0;h<r.length;++h){const l=r[h];if(l.isInterleavedBufferAttribute){const d=c/t;for(let u=0,f=l.count;u<f;u++)for(let y=0;y<t;y++){const m=l.getComponent(u,y);o.setComponent(u+d,y,m)}}else a.set(l.array,c);c+=l.count*t}return i!==void 0&&(o.gpuType=i),o}function ip(r,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=r.getIndex(),i=r.getAttribute("position"),s=n?n.count:i.count;let a=0;const o=Object.keys(r.attributes),c={},h={},l=[],d=["getX","getY","getZ","getW"],u=["setX","setY","setZ","setW"];for(let w=0,S=o.length;w<S;w++){const _=o[w],T=r.attributes[_];c[_]=new T.constructor(new T.array.constructor(T.count*T.itemSize),T.itemSize,T.normalized);const B=r.morphAttributes[_];B&&(h[_]||(h[_]=[]),B.forEach((O,P)=>{const V=new O.array.constructor(O.count*O.itemSize);h[_][P]=new O.constructor(V,O.itemSize,O.normalized)}))}const f=e*.5,y=Math.log10(1/e),m=Math.pow(10,y),x=f*m;for(let w=0;w<s;w++){const S=n?n.getX(w):w;let _="";for(let T=0,B=o.length;T<B;T++){const O=o[T],P=r.getAttribute(O),V=P.itemSize;for(let H=0;H<V;H++)_+=`${~~(P[d[H]](S)*m+x)},`}if(_ in t)l.push(t[_]);else{for(let T=0,B=o.length;T<B;T++){const O=o[T],P=r.getAttribute(O),V=r.morphAttributes[O],H=P.itemSize,J=c[O],pe=h[O];for(let ae=0;ae<H;ae++){const $=d[ae],X=u[ae];if(J[X](a,P[$](S)),V)for(let Y=0,te=V.length;Y<te;Y++)pe[Y][X](a,V[Y][$](S))}}t[_]=a,l.push(a),a++}}const v=r.clone();for(const w in r.attributes){const S=c[w];if(v.setAttribute(w,new S.constructor(S.array.slice(0,a*S.itemSize),S.itemSize,S.normalized)),w in h)for(let _=0;_<h[w].length;_++){const T=h[w][_];v.morphAttributes[w][_]=new T.constructor(T.array.slice(0,a*T.itemSize),T.itemSize,T.normalized)}}return v.setIndex(l),v}new C.Vector2;class Fa extends Yi{constructor(e,t,n){super(),this.isFound=!1,this.char=e,this.fontSize=t,this.font=n,this.width=this.getCharWidth(e,t,n)}toGeometry(){let e=this.font.cache.getGeometry(this.char.charCodeAt(0),this.fontSize);if(e==null){const t=this.font.generateShapes(this.char,this.fontSize);return e=new C.ShapeGeometry(t,4),e.hasAttribute("uv")&&e.deleteAttribute("uv"),e.hasAttribute("normal")&&e.deleteAttribute("normal"),ip(e,1e-6)}return e}getCharWidth(e,t,n){const i=n.data.glyphs[e];return i?(this.isFound=!0,i.ha*t/n.data.resolution):(this.isFound=!1,0)}}class sp{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const n=[],i=ap(e,t,this.data);for(let s=0,a=i.length;s<a;s++)n.push(...i[s].toShapes());return n}}function ap(r,e,t){const n=Array.from(r),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,a=[];let o=0,c=0;for(let h=0;h<n.length;h++){const l=n[h];if(l===`
280
280
  `)o=0,c-=s;else{const d=op(l,i,o,c,t);o+=d.offsetX,a.push(d.path)}}return a}function op(r,e,t,n,i){const s=i.glyphs[r]||i.glyphs["?"];if(!s){console.error('THREE.Font: character "'+r+'" does not exists in font family '+i.familyName+".");return}const a=new fe.ShapePath;let o,c,h,l,d,u,f,y;if(s.o){const m=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let x=0,v=m.length;x<v;)switch(m[x++]){case"m":o=m[x++]*e+t,c=m[x++]*e+n,a.moveTo(o,c);break;case"l":o=m[x++]*e+t,c=m[x++]*e+n,a.lineTo(o,c);break;case"q":h=m[x++]*e+t,l=m[x++]*e+n,d=m[x++]*e+t,u=m[x++]*e+n,a.quadraticCurveTo(d,u,h,l);break;case"b":h=m[x++]*e+t,l=m[x++]*e+n,d=m[x++]*e+t,u=m[x++]*e+n,f=m[x++]*e+t,y=m[x++]*e+n,a.bezierCurveTo(d,u,f,y,h,l);break}}return{offsetX:s.ha*e,path:a}}class cp extends sp{generateShapes(e,t=100,n="ltr"){const i=[];return hp(e,t,this.data,n).forEach(s=>{i.push(...mp(s))}),i}}function hp(r,e,t,n="ltr"){const i=Array.from(r),s=e/t.resolution,a=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,o=[];let c=0,h=0;(n==="rtl"||n==="tb")&&i.reverse();for(const l of i)if(l===`
281
281
  `)c=0,h-=a;else{const d=lp(l,s,c,h,t);if(!d)continue;n==="tb"?(c=0,h+=t.ascender*s):c+=d.offsetX,o.push(d.path)}return o}function lp(r,e,t,n,i){const s=i.glyphs[r]||i.glyphs["?"];if(!s){console.error(`THREE.Font: character "${r}" does not exist in font family ${i.familyName}.`);return}const a=new fe.ShapePath;if(s.o){const o=s.o.split(" ");let c=0;for(;c<o.length;){const h=o[c++];let l,d,u,f,y,m,x,v;switch(h){case"m":l=parseFloat(o[c++])*e+t,d=parseFloat(o[c++])*e+n,a.moveTo(l,d);break;case"l":l=parseFloat(o[c++])*e+t,d=parseFloat(o[c++])*e+n,a.lineTo(l,d);break;case"q":u=parseFloat(o[c++])*e+t,f=parseFloat(o[c++])*e+n,y=parseFloat(o[c++])*e+t,m=parseFloat(o[c++])*e+n,a.quadraticCurveTo(y,m,u,f);break;case"b":u=parseFloat(o[c++])*e+t,f=parseFloat(o[c++])*e+n,y=parseFloat(o[c++])*e+t,m=parseFloat(o[c++])*e+n,x=parseFloat(o[c++])*e+t,v=parseFloat(o[c++])*e+n,a.bezierCurveTo(y,m,x,v,u,f);break}}}return{offsetX:s.ha*e,path:a}}function up(r,e){let t=!1;const{x:n,y:i}=r,s=e.length;for(let a=0,o=s-1;a<s;o=a++){const c=e[a].x,h=e[a].y,l=e[o].x,d=e[o].y;h>i!=d>i&&n<(l-c)*(i-h)/(d-h)+c&&(t=!t)}return t}function dp(r){const e=r.length,t=Array(e).fill(null);for(let n=0;n<e;n++){let i=null,s=1/0;for(let a=0;a<e;a++)if(n!==a&&r[n].every(o=>up(o,r[a]))){const o=Math.abs(fe.ShapeUtils.area(r[a]));o<s&&(s=o,i=a)}t[n]=i}return t}function pp(r){const e=r.length,t=Array.from({length:e},()=>[]);for(let n=0;n<e;n++){const i=r[n];i!==null&&t[i].push(n)}return t}function fp(r){return r.map((e,t)=>e===null?t:-1).filter(e=>e>=0)}function gp(r){const e=[];for(let t=r.length-1;t>=0;t--){const n=r[t];if(n instanceof fe.LineCurve)e.push(new fe.LineCurve(n.v2.clone(),n.v1.clone()));else if(n instanceof fe.QuadraticBezierCurve)e.push(new fe.QuadraticBezierCurve(n.v2.clone(),n.v1.clone(),n.v0.clone()));else if(n instanceof fe.CubicBezierCurve)e.push(new fe.CubicBezierCurve(n.v3.clone(),n.v2.clone(),n.v1.clone(),n.v0.clone()));else if(n instanceof fe.EllipseCurve)e.push(new fe.EllipseCurve(n.aX,n.aY,n.xRadius,n.yRadius,n.aEndAngle,n.aStartAngle,!n.aClockwise,n.aRotation));else if(typeof n.getPoints=="function"){const i=n.getPoints(8);for(let s=i.length-1;s>0;s--)e.push(new fe.LineCurve(i[s].clone(),i[s-1].clone()))}}return e}function Na(r,e){const t=fe.ShapeUtils.area(r.getPoints(32))>0,n=e===t?r.curves.slice():gp(r.curves),i=new fe.Shape;return i.curves.push(...n),i}function mp(r,e=32){const t=r.subPaths;if(!t||t.length===0)return[];const n=t.map(f=>f.getPoints(e)),i=dp(n),s=pp(i),a=fp(i),o=t.length,c=Array(o).fill(-1),h=Array(o).fill(-1);for(const f of a){const y=[{idx:f,d:0}];for(;y.length;){const m=y.pop();c[m.idx]=m.d,h[m.idx]=f;for(const x of s[m.idx])y.push({idx:x,d:m.d+1})}}const l=[],d=new Set;function u(f){const y=Na(t[f],!0);d.add(f);for(const m of s[f])if(!d.has(m)&&c[m]===c[f]+1){const x=Na(t[m],!1);y.holes.push(x),d.add(m)}l.push(y)}for(const f of a)u(f);for(let f=0;f<o;f++)d.has(f)||u(f);return l}class yp{constructor(e=512){this.maxSize=e,this.map=new Map}get(e){const t=this.map.get(e);return t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxSize){const n=this.map.keys().next().value;n!==void 0&&this.map.delete(n)}this.map.set(e,t)}has(e){return this.map.has(e)}clear(){this.map.clear()}}class bp extends Xi{constructor(e){super(e),this.type="mesh",this.glyphCache=new yp(512);const t=e.data;if(t instanceof ArrayBuffer){const n=this.parseMeshFont(t);this.data=n.data,this.opentypeFont=n.font}else throw new Error("Invalid font cache data. Please remove font cache database named 'mlightcad' in IndexedDB and try again!");this.font=new cp(this.data)}parseMeshFont(e){const t=rp(e),n=Math.round,i=t.charToGlyph("A"),s=i?t.unitsPerEm/(i.yMax||t.unitsPerEm):1,a={glyphs:{},familyName:t.getEnglishName("fullName"),ascender:n(t.ascender),descender:n(t.descender),underlinePosition:t.tables.post.underlinePosition,underlineThickness:t.tables.post.underlineThickness,boundingBox:{xMin:t.tables.head.xMin,xMax:t.tables.head.xMax,yMin:t.tables.head.yMin,yMax:t.tables.head.yMax},resolution:t.unitsPerEm||1e3,scaleFactor:s,original_font_information:t.tables.name};return{font:t,data:a}}hasChar(e){return this.opentypeFont.hasChar(e)}hasCode(e){return this.hasChar(String.fromCodePoint(e))}_loadGlyphIfNeeded(e){if(this.data.glyphs[e]||!this.opentypeFont)return;const t=this.glyphCache.get(e);if(t){this.data.glyphs[e]=t;return}const n=this.opentypeFont.charToGlyph(e);if(!n||!n.path)return;const i=Math.round,s={ha:i(n.advanceWidth??0),x_min:i(n.xMin??0),x_max:i(n.xMax??0),o:""};n.path.commands.forEach(a=>{let o=a.type.toLowerCase();o==="c"&&(o="b"),s.o+=o+" ",a.x!==void 0&&a.y!==void 0&&(s.o+=i(a.x)+" "+i(a.y)+" "),a.x1!==void 0&&a.y1!==void 0&&(s.o+=i(a.x1)+" "+i(a.y1)+" "),a.x2!==void 0&&a.y2!==void 0&&(s.o+=i(a.x2)+" "+i(a.y2)+" ")}),this.data.glyphs[e]=s,this.glyphCache.set(e,s)}generateShapes(e,t){for(const n of e)this._loadGlyphIfNeeded(n);return this.font.generateShapes(e,t)}getCharShape(e,t){if(this._loadGlyphIfNeeded(e),!this.data.glyphs[e]){this.addUnsupportedChar(e);return}return new Fa(e,t,this)}getCodeShape(e,t){return this.getCharShape(String.fromCodePoint(e),t)}getScaleFactor(){return this.scaleFactor==null?(this.scaleFactor=this.data.scaleFactor,this.scaleFactor):this.scaleFactor}getNotFoundTextShape(e){return new Fa("?",e,this)}}let me=class{static byteToSByte(e){return(e&127)-(e&128?128:0)}constructor(e){this.position=0,this.data=new DataView(e)}readBytes(e=1){this.data.byteLength<this.position+e&&this.throwOutOfRangeError(this.position+e);const t=new Uint8Array(this.data.buffer,this.position,e);return this.position+=e,t}skip(e){this.data.byteLength<this.position+e&&this.throwOutOfRangeError(this.position+e),this.position+=e}readUint8(){this.data.byteLength<this.position+1&&this.throwOutOfRangeError(this.position+1);const e=this.data.getUint8(this.position);return this.position+=1,e}readInt8(){this.data.byteLength<this.position+1&&this.throwOutOfRangeError(this.position+1);const e=this.data.getInt8(this.position);return this.position+=1,e}readUint16(e=!0){this.data.byteLength<this.position+2&&this.throwOutOfRangeError(this.position+2);const t=this.data.getUint16(this.position,e);return this.position+=2,t}readInt16(){this.data.byteLength<this.position+2&&this.throwOutOfRangeError(this.position+2);const e=this.data.getInt16(this.position,!0);return this.position+=2,e}readUint32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getUint32(this.position,!0);return this.position+=4,e}readInt32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getInt32(this.position,!0);return this.position+=4,e}readFloat32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getFloat32(this.position,!0);return this.position+=4,e}readFloat64(){this.data.byteLength<this.position+8&&this.throwOutOfRangeError(this.position+8);const e=this.data.getFloat64(this.position,!0);return this.position+=8,e}setPosition(e){this.data.byteLength<e&&this.throwOutOfRangeError(e),this.position=e}isEnd(){return this.position===this.data.byteLength-1}get currentPosition(){return this.position}get length(){return this.data.byteLength}throwOutOfRangeError(e){throw new Error(`Position ${e} is out of range for the data length ${this.data.byteLength}!`)}};var we=(r=>(r.SHAPES="shapes",r.BIGFONT="bigfont",r.UNIFONT="unifont",r))(we||{});class vp{parse(e){const t=this.parseHeader(e).split(" "),n=t[1].toLocaleLowerCase();if(!Object.values(we).includes(n))throw new Error(`Invalid font type: ${n}`);return{fileHeader:t[0],fontType:n,fileVersion:t[2]}}parseHeader(e){let t="",n=0;for(;e.currentPosition<e.length-2&&n<1024;){const i=e.readUint8();if(i===13){const s=e.currentPosition,a=e.readUint8(),o=e.readUint8();if(a===10&&o===26)break;e.setPosition(s),t+=String.fromCharCode(i)}else t+=String.fromCharCode(i);n++}return t.trim()}}const Te=10;class xp{parse(e){try{e.readBytes(4);const t=e.readInt16();if(t<=0)throw new Error("Invalid shape count in font file");const n=[];for(let a=0;a<t;a++){const o=e.readUint16(),c=e.readUint16();c>0&&n.push({code:o,length:c})}const i={};for(const a of n)try{const o=e.readBytes(a.length);if(o.length===a.length){const c=o.indexOf(0);let h=0;c>=0&&c<o.length&&(h=c+1),h<o.length&&(i[a.code]=o.subarray(h))}}catch{console.warn(`Failed to read shape data for code ${a.code}`)}const s={data:i,info:"",baseUp:8,baseDown:2,height:Te,width:Te,orientation:"horizontal",isExtended:!1};if(0 in i){const a=i[0];try{const o=new TextDecoder().decode(a);let c=o.indexOf("\0");c>=0&&(s.info=o.substring(0,c),c+3<a.length&&(s.baseUp=a[c+1],s.baseDown=a[c+2],s.height=s.baseDown+s.baseUp,s.width=s.height,s.orientation=a[c+3]===0?"horizontal":"vertical"))}catch{console.warn("Failed to parse font info block")}}return s}catch(t){return console.error("Error parsing shape font:",t),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:Te,width:Te,orientation:"horizontal",isExtended:!1}}}}class wp{parse(e){try{e.readInt16();const t=e.readInt16(),n=e.readInt16();if(t<=0)throw new Error("Invalid character count in font file");e.skip(n*4);const i=[];for(let o=0;o<t;o++){const c=e.readUint16(),h=e.readUint16(),l=e.readUint32();(c!==0||h!==0||l!==0)&&i.push({code:c,length:h,offset:l})}const s={};for(const o of i)try{e.setPosition(o.offset);const c=e.readBytes(o.length);c.length===o.length&&(s[o.code]=c)}catch{console.warn(`Failed to read bigfont data for code ${o.code}`)}const a={data:s,info:"",baseUp:8,baseDown:2,height:Te,width:Te,orientation:"horizontal",isExtended:!1};if(0 in s){const o=s[0];try{const c=this.utf8ArrayToStr(o);let h=c.pos;h>=0&&(a.info=c.text,h++,h+3<o.length&&(o.length-h>4?(a.height=o[h++],h++,a.orientation=o[h++]===0?"horizontal":"vertical",a.width=o[h++],a.baseUp=a.height,a.baseDown=0,a.isExtended=!0):(a.baseUp=o[h++],a.baseDown=o[h++],a.height=a.baseDown+a.baseUp,a.width=a.height,a.orientation=o[h]===0?"horizontal":"vertical")))}catch{console.warn("Failed to parse bigfont info block")}}return a}catch(t){return console.error("Error parsing big font:",t),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:Te,width:Te,orientation:"horizontal",isExtended:!1}}}utf8ArrayToStr(e){let t="",n=0;for(;n<e.length;){const i=e[n];switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(i);break;case 12:case 13:{const s=e[n++];t+=String.fromCharCode((i&31)<<6|s&63);break}case 14:{const s=e[n++],a=e[n++];t+=String.fromCharCode((i&15)<<12|(s&63)<<6|(a&63)<<0);break}}if(t.charCodeAt(t.length-1)===0)break;n++}return{text:t,pos:n}}}class Sp{parse(e){try{const t=e.readInt32();if(t<=0)throw new Error("Invalid character count in font file");const n=e.readInt16(),i=e.readBytes(n),s={data:{},info:"",baseUp:8,baseDown:2,height:Te,width:Te,orientation:"horizontal",isExtended:!1};try{const o=new TextDecoder().decode(i);let c=o.indexOf("\0");c>=0&&(s.info=o.substring(0,c),c+3<i.length&&(s.baseUp=i[c+1],s.baseDown=i[c+2],s.height=s.baseUp+s.baseDown,s.width=s.height,s.orientation=i[c+3]===0?"horizontal":"vertical"))}catch{console.warn("Failed to parse unifont info block")}const a={};for(let o=0;o<t-1;o++)try{const c=e.readUint16(),h=e.readUint16();if(h>0){const l=e.readBytes(h);if(l.length===h){const d=l.indexOf(0);let u=0;d>=0&&d<l.length&&(u=d+1),u<l.length&&(a[c]=l.subarray(u))}}}catch{console.warn("Failed to read unifont character data");break}return s.data=a,s}catch(t){return console.error("Error parsing unifont:",t),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:Te,width:Te,orientation:"horizontal",isExtended:!1}}}}let _p=class{static createParser(r){switch(r){case we.SHAPES:return new xp;case we.BIGFONT:return new wp;case we.UNIFONT:return new Sp;default:throw new Error(`Unsupported font type: ${r}`)}}},oe=class ec{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}clone(){return new ec(this.x,this.y)}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e,this.y*=e,this}divide(e){return e!==0&&(this.x/=e,this.y/=e),this}multiplyScalars(e,t){return this.x*=e,this.y*=t,this}divideScalars(e,t){return e!==0&&(this.x/=e),t!==0&&(this.y/=t),this}distanceTo(e){const t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)}};const za=Math.PI/4;class Qt{static fromBulge(e,t,n){const i=Math.max(-1,Math.min(1,n));return new Qt({start:e,end:t,bulge:i})}static fromOctant(e,t,n,i,s){return new Qt({center:e,radius:t,startOctant:n,octantCount:i,isClockwise:s})}constructor(e){if(e.start&&e.end&&e.bulge!==void 0){this.start=e.start.clone(),this.end=e.end.clone(),this.bulge=e.bulge,this.isClockwise=e.bulge<0;const t=this.end.clone().subtract(this.start),n=t.length();if(Math.abs(this.bulge)*n/2===0){this.radius=0,this.center=this.start.clone(),this.startAngle=Math.atan2(t.y,t.x),this.endAngle=this.startAngle;return}const i=4*Math.atan(Math.abs(this.bulge));this.radius=n/(2*Math.sin(i/2));const s=this.start.clone().add(t.clone().divide(2)),a=new oe(-t.y,t.x);a.normalize(),a.multiply(Math.abs(this.radius*Math.cos(i/2))),this.center=s.clone(),this.isClockwise?this.center.subtract(a):this.center.add(a),this.startAngle=Math.atan2(this.start.y-this.center.y,this.start.x-this.center.x),this.endAngle=Math.atan2(this.end.y-this.center.y,this.end.x-this.center.x),this.isClockwise?this.endAngle>=this.startAngle&&(this.endAngle-=2*Math.PI):this.endAngle<=this.startAngle&&(this.endAngle+=2*Math.PI)}else if(e.center&&e.radius!==void 0&&e.startOctant!==void 0&&e.octantCount!==void 0&&e.isClockwise!==void 0){this.center=e.center.clone(),this.radius=e.radius,this.isClockwise=e.isClockwise,this.startAngle=e.startOctant*za;const t=(e.octantCount===0?8:e.octantCount)*za;this.endAngle=this.startAngle+(this.isClockwise?-t:t),this.start=this.center.clone().add(new oe(this.radius*Math.cos(this.startAngle),this.radius*Math.sin(this.startAngle))),this.end=this.center.clone().add(new oe(this.radius*Math.cos(this.endAngle),this.radius*Math.sin(this.endAngle)))}else throw new Error("Invalid arc parameters")}tessellate(e=Math.PI/18){if(this.radius===0)return[this.start.clone(),this.end.clone()];const t=[this.start.clone()],n=Math.abs(this.endAngle-this.startAngle),i=Math.max(1,Math.floor(n/e));for(let s=1;s<i;s++){const a=s/i,o=this.isClockwise?this.startAngle-a*n:this.startAngle+a*n;t.push(this.center.clone().add(new oe(this.radius*Math.cos(o),this.radius*Math.sin(o))))}return t.push(this.end?this.end.clone():this.center.clone().add(new oe(this.radius*Math.cos(this.endAngle),this.radius*Math.sin(this.endAngle)))),t}}class en{constructor(e,t=[]){this.lastPoint=e,this.polylines=t}get bbox(){if(this._bbox)return this._bbox;let e=1/0,t=-1/0,n=1/0,i=-1/0;return this.polylines.forEach(s=>{s.forEach(a=>{e=Math.min(e,a.x),t=Math.max(t,a.x),n=Math.min(n,a.y),i=Math.max(i,a.y)})}),this._bbox={minX:e,minY:n,maxX:t,maxY:i},this._bbox}offset(e,t=!0){var n,i;return t?new en((n=this.lastPoint)==null?void 0:n.clone().add(e),this.polylines.map(s=>s.map(a=>a.clone().add(e)))):((i=this.lastPoint)==null||i.add(e),this.polylines.forEach(s=>s.forEach(a=>a.add(e))),this._bbox&&(this._bbox.maxX+=e.x,this._bbox.minX+=e.x,this._bbox.maxY+=e.y,this._bbox.minY+=e.y),this)}normalizeToOrigin(e=!1){const t=this.bbox;return this.offset(new oe(-t.minX,-t.minY),e)}toSVG(e={}){const{strokeWidth:t="0.5%",strokeColor:n="black",isAutoFit:i=!1}=e;let s,a;if(i){const o=this.bbox,c=.2,h=o.maxX-o.minX,l=o.maxY-o.minY,d=h===0?l:h,u=l===0?h:l,f=o.minX-d*c,y=o.maxX+d*c,m=o.minY-u*c,x=o.maxY+u*c;a=this.polylines.map(v=>{let w="";return v.forEach((S,_)=>{const T=S.x,B=-S.y;w+=_===0?`M ${T} ${B} `:`L ${T} ${B} `}),`<path d="${w}" stroke="${n}" stroke-width="${t}" fill="none"/>`}).join(""),s=`${f} ${-x} ${y-f} ${x-m}`}else s="0 0 20 20",a=this.polylines.map(o=>{let c="";return o.forEach((h,l)=>{const d=h.x+5,u=-h.y+15;c+=l===0?`M ${d} ${u} `:`L ${d} ${u} `}),`<path d="${c}" stroke="${n}" stroke-width="${t}" fill="none"/>`}).join("");return`<svg width="100%" height="100%" viewBox="${s}" preserveAspectRatio="xMidYMid meet">${a}</svg>`}}const Cp=Math.PI/18;class Tp{constructor(e){this.shapeCache=new Map,this.shapeData=new Map,this.fontData=e}release(){this.shapeCache.clear(),this.shapeData.clear()}getCharShape(e,t){const n=t/this.fontData.content.height;return this.parseAndScale(e,{factor:n})}parseAndScale(e,t){if(e===0)return;let n;if(this.shapeCache.has(e))n=this.shapeCache.get(e);else{const i=this.fontData.content.data;if(i[e]){const s=i[e];n=this.parseShape(s),this.shapeData.set(e,n),this.shapeCache.set(e,n)}}if(n){if(t.factor!==void 0)return this.scaleShapeByFactor(n,t.factor);if(t.height!==void 0){const i=t.width??t.height;return this.scaleShapeByHeightAndWidth(n,t.height,i)}else return n}}scaleShapeByFactor(e,t){var n;return new en((n=e.lastPoint)==null?void 0:n.clone().multiply(t),e.polylines.map(i=>i.map(s=>s.clone().multiply(t))))}scaleShapeByHeightAndWidth(e,t,n){var i;const s=e.bbox,a=s.maxY-s.minY,o=s.maxX-s.minX,c=a>0?t/a:1,h=o>0?n/o:1,l=(i=e.lastPoint)==null?void 0:i.clone();l&&(l.x*=h,l.y*=c);const d=e.polylines.map(u=>u.map(f=>{const y=f.clone();return y.x*=h,y.y*=c,y}));return new en(l,d)}parseShape(e){const t={currentPoint:new oe,polylines:[],currentPolyline:[],sp:[],isPenDown:!1,scale:1};for(let n=0;n<e.length;n++){const i=e[n];i<=15?n=this.handleSpecialCommand(i,e,n,t):this.handleVectorCommand(i,t)}return new en(t.currentPoint,t.polylines)}handleSpecialCommand(e,t,n,i){let s=n;switch(e){case 0:i.currentPolyline=[],i.isPenDown=!1;break;case 1:i.isPenDown=!0,i.currentPolyline.push(i.currentPoint.clone());break;case 2:i.isPenDown=!1,i.currentPolyline.length>1&&i.polylines.push(i.currentPolyline.slice()),i.currentPolyline=[];break;case 3:s++,i.scale/=t[s];break;case 4:s++,i.scale*=t[s];break;case 5:if(i.sp.length===4)throw new Error("The position stack is only four locations deep");i.sp.push(i.currentPoint.clone());break;case 6:i.currentPoint=i.sp.pop()??i.currentPoint;break;case 7:s=this.handleSubshapeCommand(t,s,i);break;case 8:s=this.handleXYDisplacement(t,s,i);break;case 9:s=this.handleMultipleXYDisplacements(t,s,i);break;case 10:s=this.handleOctantArc(t,s,i);break;case 11:s=this.handleFractionalArc(t,s,i);break;case 12:s=this.handleBulgeArc(t,s,i);break;case 13:s=this.handleMultipleBulgeArcs(t,s,i);break;case 14:s=this.skipCode(t,++s);break}return s}handleVectorCommand(e,t){const n=(e&240)>>4,i=e&15,s=this.getVectorForDirection(i);t.currentPoint.add(s.multiply(n*t.scale)),t.isPenDown&&t.currentPolyline.push(t.currentPoint.clone())}getVectorForDirection(e){const t=new oe;switch(e){case 0:t.x=1;break;case 1:t.x=1,t.y=.5;break;case 2:t.x=1,t.y=1;break;case 3:t.x=.5,t.y=1;break;case 4:t.y=1;break;case 5:t.x=-.5,t.y=1;break;case 6:t.x=-1,t.y=1;break;case 7:t.x=-1,t.y=.5;break;case 8:t.x=-1;break;case 9:t.x=-1,t.y=-.5;break;case 10:t.x=-1,t.y=-1;break;case 11:t.x=-.5,t.y=-1;break;case 12:t.y=-1;break;case 13:t.x=.5,t.y=-1;break;case 14:t.x=1,t.y=-1;break;case 15:t.x=1,t.y=-.5;break}return t}handleSubshapeCommand(e,t,n){let i=t,s=0,a,o=n.scale*this.fontData.content.height,c=o;const h=n.currentPoint.clone();switch(n.currentPolyline.length>1&&(n.polylines.push(n.currentPolyline.slice()),n.currentPolyline=[]),this.fontData.header.fontType){case we.SHAPES:i++,s=e[i];break;case we.BIGFONT:i++,s=e[i],s===0&&(i++,s=e[i++]<<8|e[i++],h.x=me.byteToSByte(e[i++])*n.scale,h.y=me.byteToSByte(e[i++])*n.scale,this.fontData.content.isExtended&&(c=e[i++]*n.scale),o=e[i]*n.scale);break;case we.UNIFONT:i++,s=e[i++]<<8|e[i++];break}return s!==0&&(a=this.getScaledSubshapeAtInsertPoint(s,c,o,h),a&&n.polylines.push(...a.polylines.slice())),n.currentPolyline=[],i}handleXYDisplacement(e,t,n){let i=t;const s=new oe;return s.x=me.byteToSByte(e[++i]),s.y=me.byteToSByte(e[++i]),n.currentPoint.add(s.multiply(n.scale)),n.isPenDown&&n.currentPolyline.push(n.currentPoint.clone()),i}handleMultipleXYDisplacements(e,t,n){let i=t;for(;;){const s=new oe;if(s.x=me.byteToSByte(e[++i]),s.y=me.byteToSByte(e[++i]),s.x===0&&s.y===0)break;n.currentPoint.add(s.multiply(n.scale)),n.isPenDown&&n.currentPolyline.push(n.currentPoint.clone())}return i}handleOctantArc(e,t,n){var i;let s=t;const a=e[++s]*n.scale,o=me.byteToSByte(e[++s]),c=(o&112)>>4;let h=o&7;const l=o<0,d=Math.PI/4*c,u=n.currentPoint.clone().subtract(new oe(Math.cos(d)*a,Math.sin(d)*a)),f=Qt.fromOctant(u,a,c,h,l);if(n.isPenDown){const y=f.tessellate();n.currentPolyline.pop(),n.currentPolyline.push(...y.slice())}return n.currentPoint=(i=f.tessellate().pop())==null?void 0:i.clone(),s}handleFractionalArc(e,t,n){let i=t;const s=e[++i],a=e[++i],o=e[++i],c=e[++i],h=(o*255+c)*n.scale,l=me.byteToSByte(e[++i]),d=(l&112)>>4;let u=l&7;u===0&&(u=8),a!==0&&u--;const f=Math.PI/4;let y=f*u,m=Cp,x=1;l<0&&(m=-m,y=-y,x=-1);let v=f*d,w=v+y;v+=f*s/256*x,w+=f*a/256*x;const S=n.currentPoint.clone().subtract(new oe(h*Math.cos(v),h*Math.sin(v)));if(n.currentPoint=S.clone().add(new oe(h*Math.cos(w),h*Math.sin(w))),n.isPenDown){let _=v;const T=[];if(T.push(S.clone().add(new oe(h*Math.cos(_),h*Math.sin(_)))),m>0)for(;_+m<w;)_+=m,T.push(S.clone().add(new oe(h*Math.cos(_),h*Math.sin(_))));else for(;_+m>w;)_+=m,T.push(S.clone().add(new oe(h*Math.cos(_),h*Math.sin(_))));T.push(S.clone().add(new oe(h*Math.cos(w),h*Math.sin(w)))),n.currentPolyline.push(...T)}return i}handleBulgeArc(e,t,n){let i=t;const s=new oe;s.x=me.byteToSByte(e[++i]),s.y=me.byteToSByte(e[++i]);const a=me.byteToSByte(e[++i]);return n.currentPoint=this.handleArcSegment(n.currentPoint,s,a,n.scale,n.isPenDown,n.currentPolyline),i}handleMultipleBulgeArcs(e,t,n){let i=t;for(;;){const s=new oe;if(s.x=me.byteToSByte(e[++i]),s.y=me.byteToSByte(e[++i]),s.x===0&&s.y===0)break;const a=me.byteToSByte(e[++i]);n.currentPoint=this.handleArcSegment(n.currentPoint,s,a,n.scale,n.isPenDown,n.currentPolyline)}return i}skipCode(e,t){switch(e[t]){case 0:break;case 1:break;case 2:break;case 3:case 4:t++;break;case 5:break;case 6:break;case 7:switch(this.fontData.header.fontType){case we.SHAPES:t++;break;case we.BIGFONT:t++,e[t]===0&&(t+=this.fontData.content.isExtended?6:5);break;case we.UNIFONT:t+=2;break}break;case 8:t+=2;break;case 9:for(;;){const n=e[++t],i=e[++t];if(n===0&&i===0)break}break;case 10:t+=2;break;case 11:t+=5;break;case 12:t+=3;break;case 13:for(;;){const n=e[++t],i=e[++t];if(n===0&&i===0)break;t++}break}return t}getScaledSubshapeAtInsertPoint(e,t,n,i){let s=this.shapeCache.get(e);if(!s){const o=this.fontData.content.data[e];if(!o)return;s=this.parseShape(o),this.shapeData.set(e,s),this.shapeCache.set(e,s)}const a=s.normalizeToOrigin(!0);return this.scaleShapeByHeightAndWidth(a,n,t).offset(i,!1)}handleArcSegment(e,t,n,i,s,a){t.x*=i,t.y*=i,n<-127&&(n=-127);const o=e.clone();if(s)if(n===0)a.push(o.clone().add(t));else{const c=o.clone().add(t),h=Qt.fromBulge(o,c,n/127).tessellate();a.push(...h.slice(1))}return o.add(t),o}}class Ep{constructor(e){if(e instanceof ArrayBuffer){const t=new me(e),n=new vp().parse(t),i=_p.createParser(n.fontType).parse(t);this.fontData={header:n,content:i}}else this.fontData=e;this.shapeParser=new Tp(this.fontData)}hasChar(e){return this.fontData.content.data[e]!==void 0}getCharShape(e,t){let n=this.shapeParser.getCharShape(e,t);return n&&this.fontData.header.fontType===we.BIGFONT&&(n=n.normalizeToOrigin()),n}release(){this.shapeParser.release()}}function Ap(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Ip(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var Ga={exports:{}},Kr={},zn={};zn.byteLength=Bp,zn.toByteArray=Op,zn.fromByteArray=Rp;for(var Ne=[],Ee=[],Lp=typeof Uint8Array<"u"?Uint8Array:Array,Jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tt=0,kp=Jr.length;Tt<kp;++Tt)Ne[Tt]=Jr[Tt],Ee[Jr.charCodeAt(Tt)]=Tt;Ee[45]=62,Ee[95]=63;function ja(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Bp(r){var e=ja(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Mp(r,e,t){return(e+t)*3/4-t}function Op(r){var e,t=ja(r),n=t[0],i=t[1],s=new Lp(Mp(r,n,i)),a=0,o=i>0?n-4:n,c;for(c=0;c<o;c+=4)e=Ee[r.charCodeAt(c)]<<18|Ee[r.charCodeAt(c+1)]<<12|Ee[r.charCodeAt(c+2)]<<6|Ee[r.charCodeAt(c+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return i===2&&(e=Ee[r.charCodeAt(c)]<<2|Ee[r.charCodeAt(c+1)]>>4,s[a++]=e&255),i===1&&(e=Ee[r.charCodeAt(c)]<<10|Ee[r.charCodeAt(c+1)]<<4|Ee[r.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function Pp(r){return Ne[r>>18&63]+Ne[r>>12&63]+Ne[r>>6&63]+Ne[r&63]}function Dp(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(Pp(n));return i.join("")}function Rp(r){for(var e,t=r.length,n=t%3,i=[],s=16383,a=0,o=t-n;a<o;a+=s)i.push(Dp(r,a,a+s>o?o:a+s));return n===1?(e=r[t-1],i.push(Ne[e>>2]+Ne[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Ne[e>>10]+Ne[e>>4&63]+Ne[e<<2&63]+"=")),i.join("")}var Qr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Qr.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,c=(1<<o)-1,h=c>>1,l=-7,d=t?i-1:0,u=t?-1:1,f=r[e+d];for(d+=u,s=f&(1<<-l)-1,f>>=-l,l+=o;l>0;s=s*256+r[e+d],d+=u,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=n;l>0;a=a*256+r[e+d],d+=u,l-=8);if(s===0)s=1-h;else{if(s===c)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-h}return(f?-1:1)*a*Math.pow(2,s-n)},Qr.write=function(r,e,t,n,i,s){var a,o,c,h=s*8-i-1,l=(1<<h)-1,d=l>>1,u=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,y=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+d>=1?e+=u/c:e+=u*Math.pow(2,1-d),e*c>=2&&(a++,c/=2),a+d>=l?(o=0,a=l):a+d>=1?(o=(e*c-1)*Math.pow(2,i),a=a+d):(o=e*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;r[t+f]=o&255,f+=y,o/=256,i-=8);for(a=a<<i|o,h+=i;h>0;r[t+f]=a&255,f+=y,a/=256,h-=8);r[t+f-y]|=m*128};/*!
282
282
  * The buffer module from node.js, for the browser.