diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json index 7556970..0d72e92 100644 --- a/.obsidian/community-plugins.json +++ b/.obsidian/community-plugins.json @@ -1,4 +1,6 @@ [ "obsidian-excalidraw-plugin", - "dataview" + "dataview", + "pdf-plus", + "omnisearch" ] \ No newline at end of file diff --git a/.obsidian/plugins/mehrmaid/main.js b/.obsidian/plugins/mehrmaid/main.js new file mode 100644 index 0000000..216908c --- /dev/null +++ b/.obsidian/plugins/mehrmaid/main.js @@ -0,0 +1,150 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/main.ts +var main_exports = {}; +__export(main_exports, { + default: () => Mehrmaid +}); +module.exports = __toCommonJS(main_exports); +var import_obsidian2 = require("obsidian"); + +// src/mermaid.ts +var import_obsidian = require("obsidian"); + +// src/themes.ts +var THEME_DARK = { + theme: "dark", + "themeVariables": { + "primaryColor": "#BB2528", + "primaryTextColor": "#fff", + "primaryBorderColor": "#7C0000", + "lineColor": "#dadada", + "secondaryColor": "#006100", + "tertiaryColor": "#fff", + "clusterBkg": "#242424", + "clusterBorder": "#2d2d2d", + "nodeBorder": "#dadada" + }, + securityLevel: "loose", + startOnLoad: true, + flowchart: { + htmlLabels: true + } +}; +var THEME_LIGHT = { + theme: "neutral", + "themeVariables": { + "primaryBorderColor": "#000", + "clusterBorder": "#2d2d2d", + "lineColor": "#000", + "nodeBorder": "#000" + }, + securityLevel: "loose", + startOnLoad: true, + flowchart: { + htmlLabels: true + } +}; + +// src/mermaid.ts +async function renderMarkdown(str, el, ctx, app) { + const markdownRenderChild = new import_obsidian.MarkdownRenderChild(el); + const markdownEl = el.createDiv(); + markdownEl.addClass("mehrmaid-markdown-container"); + if (ctx && !(typeof ctx == "string")) { + ctx.addChild(markdownRenderChild); + } + await import_obsidian.MarkdownRenderer.render(app, str, markdownEl, ctx.sourcePath, markdownRenderChild); + return markdownEl; +} +async function renderMehrmaid(source, el, ctx) { + var _a; + const mermaid = await (0, import_obsidian.loadMermaid)(); + let config = {}; + if (document.body.classList.contains("theme-dark")) { + config = THEME_DARK; + source += "\nclassDef primary fill:#8a5cf5"; + } else { + config = THEME_LIGHT; + source += "\nclassDef primary fill:#a68afa"; + } + mermaid.initialize(config); + mermaid.mermaidAPI.setConfig(config); + let matches = source.match(/"([^"]*?)"/g); + if (matches) { + const promises = []; + for (let match of matches) { + match = match.substring(1, match.length - 1); + promises.push(renderMarkdown(match, el, ctx, this.app)); + } + const markdownEls = await Promise.all(promises); + let widths = []; + let heights = []; + for (let markdownEl of markdownEls) { + widths.push(markdownEl.offsetWidth); + heights.push(markdownEl.offsetHeight); + } + el.empty(); + for (let i = 0; i < matches.length; i++) { + let match = matches[i]; + let markdownEl = markdownEls[i]; + let width = widths[i]; + width = Math.max(width, 10); + let height = heights[i]; + height = Math.max(height, 10); + let id = match.replace(/[^a-zA-Z0-9]/g, "") + i; + source = source.replace( + match, + `
` + ); + } + const graphId = "mehrmaid-" + ((_a = ctx.getSectionInfo(el)) == null ? void 0 : _a.lineStart) + "-" + Date.now(); + const { svg } = await mermaid.render(graphId, source); + el.insertAdjacentHTML("beforeend", svg); + for (let i = 0; i < markdownEls.length; i++) { + let id = matches[i].replace(/[^a-zA-Z0-9]/g, "") + i; + let markdownEl = markdownEls[i]; + let htmlEl = el.getElementsByClassName(id)[0]; + htmlEl.appendChild(markdownEl); + } + } +} + +// src/main.ts +var Mehrmaid = class extends import_obsidian2.Plugin { + async onload() { + this.app.workspace.onLayoutReady(() => { + this.registerMarkdownCodeBlockProcessor("mehrmaid", async (source, el, ctx) => { + try { + await renderMehrmaid(source, el, ctx); + } catch (e) { + console.error(e); + new import_obsidian2.Notice("Mehrmaid: Error rendering mermaid diagram"); + } + }); + }); + } +}; + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/mehrmaid/manifest.json b/.obsidian/plugins/mehrmaid/manifest.json new file mode 100644 index 0000000..48b46fa --- /dev/null +++ b/.obsidian/plugins/mehrmaid/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "mehrmaid", + "name": "Mehrmaid", + "version": "0.0.2", + "minAppVersion": "0.15.0", + "description": "Enables you to put Markdown inside of Mermaid diagrams.", + "author": "huterguier", + "authorUrl": "https://github.com/huterguier", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/mehrmaid/styles.css b/.obsidian/plugins/mehrmaid/styles.css new file mode 100644 index 0000000..9237f3a --- /dev/null +++ b/.obsidian/plugins/mehrmaid/styles.css @@ -0,0 +1,13 @@ +.block-language-mehrmaid p:first-child { + padding-top: 0; + margin-top: 0; +} + +.block-language-mehrmaid p:last-child { + padding-bottom: 0; + margin-bottom: 0; +} + +.mehrmaid-markdown-container { + display: inline-block; +} \ No newline at end of file diff --git a/.obsidian/plugins/omnisearch/data.json b/.obsidian/plugins/omnisearch/data.json new file mode 100644 index 0000000..241e8ec --- /dev/null +++ b/.obsidian/plugins/omnisearch/data.json @@ -0,0 +1,41 @@ +{ + "useCache": true, + "hideExcluded": false, + "downrankedFoldersFilters": [], + "ignoreDiacritics": true, + "ignoreArabicDiacritics": false, + "indexedFileTypes": [], + "displayTitle": "", + "PDFIndexing": false, + "officeIndexing": false, + "imagesIndexing": false, + "aiImageIndexing": false, + "unsupportedFilesIndexing": "default", + "splitCamelCase": false, + "openInNewPane": false, + "vimLikeNavigationShortcut": false, + "ribbonIcon": true, + "showExcerpt": true, + "maxEmbeds": 5, + "renderLineReturnInExcerpts": true, + "showCreateButton": false, + "highlight": true, + "showPreviousQueryResults": true, + "simpleSearch": false, + "tokenizeUrls": false, + "fuzziness": "1", + "weightBasename": 10, + "weightDirectory": 7, + "weightH1": 6, + "weightH2": 5, + "weightH3": 4, + "weightUnmarkedTags": 2, + "weightCustomProperties": [], + "httpApiEnabled": false, + "httpApiPort": "51361", + "httpApiNotice": true, + "welcomeMessage": "1.21.0", + "verboseLogging": false, + "DANGER_httpHost": null, + "DANGER_forceSaveCache": false +} \ No newline at end of file diff --git a/.obsidian/plugins/omnisearch/main.js b/.obsidian/plugins/omnisearch/main.js new file mode 100644 index 0000000..c5f52d1 --- /dev/null +++ b/.obsidian/plugins/omnisearch/main.js @@ -0,0 +1,109 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var ax=Object.create;var Xs=Object.defineProperty,ox=Object.defineProperties,ux=Object.getOwnPropertyDescriptor,cx=Object.getOwnPropertyDescriptors,lx=Object.getOwnPropertyNames,th=Object.getOwnPropertySymbols,fx=Object.getPrototypeOf,nh=Object.prototype.hasOwnProperty,dx=Object.prototype.propertyIsEnumerable;var Qu=(t,e,n)=>e in t?Xs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,B=(t,e)=>{for(var n in e||(e={}))nh.call(e,n)&&Qu(t,n,e[n]);if(th)for(var n of th(e))dx.call(e,n)&&Qu(t,n,e[n]);return t},ce=(t,e)=>ox(t,cx(e)),rh=t=>Xs(t,"__esModule",{value:!0});var x=(t,e)=>()=>(t&&(e=t(t=0)),e);var kn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),It=(t,e)=>{rh(t);for(var n in e)Xs(t,n,{get:e[n],enumerable:!0})},hx=(t,e,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of lx(e))!nh.call(t,r)&&r!=="default"&&Xs(t,r,{get:()=>e[r],enumerable:!(n=ux(e,r))||n.enumerable});return t},_e=t=>hx(rh(Xs(t!=null?ax(fx(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var sh=(t,e,n)=>(Qu(t,typeof e!="symbol"?e+"":e,n),n);function Se(){}function px(t,e){for(let n in e)t[n]=e[n];return t}function Xu(t){return t()}function ih(){return Object.create(null)}function jt(t){t.forEach(Xu)}function on(t){return typeof t=="function"}function qe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Zu(t,e){return wa||(wa=document.createElement("a")),wa.href=e,t===wa.href}function ah(t){return Object.keys(t).length===0}function oh(t,...e){if(t==null)return Se;let n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Na(t,e,n){t.$$.on_destroy.push(oh(e,n))}function Hr(t,e,n,r){if(t){let s=uh(t,e,n,r);return t[0](s)}}function uh(t,e,n,r){return t[1]&&r?px(n.ctx.slice(),t[1](r(e))):n.ctx}function Ur(t,e,n,r){if(t[2]&&r){let s=t[2](r(n));if(e.dirty===void 0)return s;if(typeof s=="object"){let i=[],a=Math.max(e.dirty.length,s.length);for(let o=0;o32){let e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function K(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function bx(t){return Array.from(t.childNodes)}function Xt(t,e){e=""+e,t.data!==e&&(t.data=e)}function Ju(t,e){t.value=e??""}function Et(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function ec(t,e,n){t.classList[n?"add":"remove"](e)}function _x(t,e,{bubbles:n=!1,cancelable:r=!1}={}){let s=document.createEvent("CustomEvent");return s.initCustomEvent(t,n,r,e),s}function ei(t){Js=t}function tc(){if(!Js)throw new Error("Function called outside component initialization");return Js}function fr(t){tc().$$.on_mount.push(t)}function ti(t){tc().$$.on_destroy.push(t)}function nc(){let t=tc();return(e,n,{cancelable:r=!1}={})=>{let s=t.$$.callbacks[e];if(s){let i=_x(e,n,{cancelable:r});return s.slice().forEach(a=>{a.call(t,i)}),!i.defaultPrevented}return!0}}function Tt(t,e){let n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}function hh(){rc||(rc=!0,dh.then(ph))}function Ln(){return hh(),dh}function sc(t){Kr.push(t)}function ph(){if(Yr!==0)return;let t=Js;do{try{for(;Yrt.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),Kr=e}function hr(){dr={r:0,c:[],p:dr}}function pr(){dr.r||jt(dr.c),dr=dr.p}function me(t,e){t&&t.i&&(Oa.delete(t),t.i(e))}function xe(t,e,n,r){if(t&&t.o){if(Oa.has(t))return;Oa.add(t),dr.c.push(()=>{Oa.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function pt(t){t&&t.c()}function ot(t,e,n,r){let{fragment:s,after_update:i}=t.$$;s&&s.m(e,n),r||sc(()=>{let a=t.$$.on_mount.map(Xu).filter(on);t.$$.on_destroy?t.$$.on_destroy.push(...a):jt(a),t.$$.on_mount=[]}),i.forEach(sc)}function Je(t,e){let n=t.$$;n.fragment!==null&&(Tx(n.after_update),jt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function yx(t,e){t.$$.dirty[0]===-1&&(qr.push(t),hh(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let E=p.length?p[0]:f;return l.ctx&&s(l.ctx[d],l.ctx[d]=E)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](E),h&&yx(t,d)),f}):[],l.update(),h=!0,jt(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){mx();let d=bx(e.target);l.fragment&&l.fragment.l(d),d.forEach(ne)}else l.fragment&&l.fragment.c();e.intro&&me(t.$$.fragment),ot(t,e.target,e.anchor,e.customElement),gx(),ph()}ei(c)}var wa,ch,va,lh,Js,qr,Rn,Kr,fh,dh,rc,ic,Yr,Oa,dr,xx,wO,Ax,$e,wt=x(()=>{ch=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,va=class{constructor(e){this.options=e,this._listeners="WeakMap"in ch?new WeakMap:void 0}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!==null&&e!==void 0?e:this._observer=new ResizeObserver(n=>{var r;for(let s of n)va.entries.set(s.target,s),(r=this._listeners.get(s.target))===null||r===void 0||r(s)})}};va.entries="WeakMap"in ch?new WeakMap:void 0;lh=!1;qr=[],Rn=[],Kr=[],fh=[],dh=Promise.resolve(),rc=!1;ic=new Set,Yr=0;Oa=new Set;xx=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],wO=new Set([...xx]);typeof HTMLElement=="function"&&(Ax=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(Xu).filter(on);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){jt(this.$$.on_disconnect)}$destroy(){Je(this,1),this.$destroy=Se}$on(t,e){if(!on(e))return Se;let n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{let r=n.indexOf(e);r!==-1&&n.splice(r,1)}}$set(t){this.$$set&&!ah(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});$e=class{$destroy(){Je(this,1),this.$destroy=Se}$on(e,n){if(!on(n))return Se;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{let s=r.indexOf(n);s!==-1&&r.splice(s,1)}}$set(e){this.$$set&&!ah(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}});var ni=x(()=>{wt()});var ac,mh=x(()=>{ac=class{constructor(){this.handlers=new Map;this.disabled=[]}on(e,n,r){if(e.includes("@")||n.includes("@"))throw new Error("Invalid context/event name - Cannot contain @");this.handlers.set(`${e}@${n}`,r)}off(e,n){if(n)this.handlers.delete(`${e}@${n}`);else for(let[r]of this.handlers.entries())r.startsWith(`${e}@`)&&this.handlers.delete(r)}disable(e){this.enable(e),this.disabled.push(e)}enable(e){this.disabled=this.disabled.filter(n=>n!==e)}emit(e,...n){let r=[...this.handlers.entries()].filter(([s,i])=>!this.disabled.includes(s.split("@")[0]));for(let[s,i]of r)s.endsWith(`@${e}`)&&i(...n)}}});function ka(t,e=Se){let n,r=new Set;function s(o){if(qe(t,o)&&(t=o,n)){let c=!Wr.length;for(let l of r)l[1](),Wr.push(l,t);if(c){for(let l=0;l{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:s,update:i,subscribe:a}}var Wr,oc=x(()=>{wt();wt();Wr=[]});function uc(t){_h=t}function cc(){return _h}var gh,bh,ri,si,ae,Ra,Nt,pe,Pn,_h,Cx,ii,Eh,Zt=x(()=>{mh();oc();gh=/[\u4e00-\u9fa5]/,bh=100,ri=300,si="omnisearch-disabled",ae=new ac,Ra={ToggleExcerpts:"toggle-excerpts"},Nt=(i=>(i[i.Done=0]="Done",i[i.LoadingCache=1]="LoadingCache",i[i.ReadingFiles=2]="ReadingFiles",i[i.IndexingFiles=3]="IndexingFiles",i[i.WritingCache=4]="WritingCache",i))(Nt||{}),pe=(d=>(d.Enter="enter",d.OpenInBackground="open-in-background",d.CreateNote="create-note",d.OpenInNewPane="open-in-new-pane",d.InsertLink="insert-link",d.Tab="tab",d.ArrowUp="arrow-up",d.ArrowDown="arrow-down",d.PrevSearchHistory="prev-search-history",d.NextSearchHistory="next-search-history",d.OpenInNewLeaf="open-in-new-leaf",d))(pe||{}),Pn=ka(0),_h=!1;Cx=/[|\t\n\r\^"= -#%-*,.`\/<>:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/.toString().slice(1,-1),ii=new RegExp(`${Cx}+`,"u"),Eh=/[|\[\]\(\)<>\{\} \t\n\r]/u});var Th=kn((ai,lc)=>{(function(t,e){if(typeof ai=="object"&&typeof lc=="object")lc.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var n=e();for(var r in n)(typeof ai=="object"?ai:t)[r]=n[r]}})(typeof self!="undefined"?self:ai,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(r,s,i){n.o(r,s)||Object.defineProperty(r,s,{enumerable:!0,get:i})},n.r=function(r){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,s){if(1&s&&(r=n(r)),8&s||4&s&&typeof r=="object"&&r&&r.__esModule)return r;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:r}),2&s&&typeof r!="string")for(var a in r)n.d(i,a,function(o){return r[o]}.bind(null,a));return i},n.n=function(r){var s=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(s,"a",s),s},n.o=function(r,s){return Object.prototype.hasOwnProperty.call(r,s)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"md5",function(){return T});var r="0123456789abcdef".split(""),s=function(w){for(var m="",I=0;I<4;I++)m+=r[w>>8*I+4&15]+r[w>>8*I&15];return m},i=function(w){for(var m=w.length,I=0;I>>32-O,L)}(m=function(N,O,L,z){return O=a(a(O,N),a(L,z))}(w,m,A,S),b,I)},c=function(w,m,I,A,b,S,C,N){return o(I&A|~I&b,m,I,S,C,N,w)},l=function(w,m,I,A,b,S,C,N){return o(I&b|A&~b,m,I,S,C,N,w)},h=function(w,m,I,A,b,S,C,N){return o(I^A^b,m,I,S,C,N,w)},d=function(w,m,I,A,b,S,C,N){return o(A^(I|~b),m,I,S,C,N,w)},f=function(w,m,I){I===void 0&&(I=a);var A=w[0],b=w[1],S=w[2],C=w[3],N=c.bind(null,I);A=N(A,b,S,C,m[0],7,-680876936),C=N(C,A,b,S,m[1],12,-389564586),S=N(S,C,A,b,m[2],17,606105819),b=N(b,S,C,A,m[3],22,-1044525330),A=N(A,b,S,C,m[4],7,-176418897),C=N(C,A,b,S,m[5],12,1200080426),S=N(S,C,A,b,m[6],17,-1473231341),b=N(b,S,C,A,m[7],22,-45705983),A=N(A,b,S,C,m[8],7,1770035416),C=N(C,A,b,S,m[9],12,-1958414417),S=N(S,C,A,b,m[10],17,-42063),b=N(b,S,C,A,m[11],22,-1990404162),A=N(A,b,S,C,m[12],7,1804603682),C=N(C,A,b,S,m[13],12,-40341101),S=N(S,C,A,b,m[14],17,-1502002290),b=N(b,S,C,A,m[15],22,1236535329);var O=l.bind(null,I);A=O(A,b,S,C,m[1],5,-165796510),C=O(C,A,b,S,m[6],9,-1069501632),S=O(S,C,A,b,m[11],14,643717713),b=O(b,S,C,A,m[0],20,-373897302),A=O(A,b,S,C,m[5],5,-701558691),C=O(C,A,b,S,m[10],9,38016083),S=O(S,C,A,b,m[15],14,-660478335),b=O(b,S,C,A,m[4],20,-405537848),A=O(A,b,S,C,m[9],5,568446438),C=O(C,A,b,S,m[14],9,-1019803690),S=O(S,C,A,b,m[3],14,-187363961),b=O(b,S,C,A,m[8],20,1163531501),A=O(A,b,S,C,m[13],5,-1444681467),C=O(C,A,b,S,m[2],9,-51403784),S=O(S,C,A,b,m[7],14,1735328473),b=O(b,S,C,A,m[12],20,-1926607734);var L=h.bind(null,I);A=L(A,b,S,C,m[5],4,-378558),C=L(C,A,b,S,m[8],11,-2022574463),S=L(S,C,A,b,m[11],16,1839030562),b=L(b,S,C,A,m[14],23,-35309556),A=L(A,b,S,C,m[1],4,-1530992060),C=L(C,A,b,S,m[4],11,1272893353),S=L(S,C,A,b,m[7],16,-155497632),b=L(b,S,C,A,m[10],23,-1094730640),A=L(A,b,S,C,m[13],4,681279174),C=L(C,A,b,S,m[0],11,-358537222),S=L(S,C,A,b,m[3],16,-722521979),b=L(b,S,C,A,m[6],23,76029189),A=L(A,b,S,C,m[9],4,-640364487),C=L(C,A,b,S,m[12],11,-421815835),S=L(S,C,A,b,m[15],16,530742520),b=L(b,S,C,A,m[2],23,-995338651);var z=d.bind(null,I);A=z(A,b,S,C,m[0],6,-198630844),C=z(C,A,b,S,m[7],10,1126891415),S=z(S,C,A,b,m[14],15,-1416354905),b=z(b,S,C,A,m[5],21,-57434055),A=z(A,b,S,C,m[12],6,1700485571),C=z(C,A,b,S,m[3],10,-1894986606),S=z(S,C,A,b,m[10],15,-1051523),b=z(b,S,C,A,m[1],21,-2054922799),A=z(A,b,S,C,m[8],6,1873313359),C=z(C,A,b,S,m[15],10,-30611744),S=z(S,C,A,b,m[6],15,-1560198380),b=z(b,S,C,A,m[13],21,1309151649),A=z(A,b,S,C,m[4],6,-145523070),C=z(C,A,b,S,m[11],10,-1120210379),S=z(S,C,A,b,m[2],15,718787259),b=z(b,S,C,A,m[9],21,-343485551),w[0]=I(A,w[0]),w[1]=I(b,w[1]),w[2]=I(S,w[2]),w[3]=I(C,w[3])},p=function(w){for(var m=[],I=0;I<64;I+=4)m[I>>2]=w.charCodeAt(I)+(w.charCodeAt(I+1)<<8)+(w.charCodeAt(I+2)<<16)+(w.charCodeAt(I+3)<<24);return m},E=function(w,m){var I,A=w.length,b=[1732584193,-271733879,-1732584194,271733878];for(I=64;I<=A;I+=64)f(b,p(w.substring(I-64,I)),m);var S=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C=(w=w.substring(I-64)).length;for(I=0;I>2]|=w.charCodeAt(I)<<(I%4<<3);if(S[I>>2]|=128<<(I%4<<3),I>55)for(f(b,S,m),I=16;I--;)S[I]=0;return S[14]=8*A,f(b,S,m),b};function T(w){var m;return i(E("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(m=function(I,A){var b=(65535&I)+(65535&A);return(I>>16)+(A>>16)+(b>>16)<<16|65535&b}),i(E(w,m))}}])})});function fc(t){let e=t.split("/");return e.pop(),e.join("/")}function dc(t){return new Promise(e=>{setTimeout(e,t)})}function La(t,e){return t.headings?.filter(n=>n.level===e).map(n=>n.heading)??[]}function Pa(t,e){return(t+e)%e}function xh(t){return t.replace(/(\*|_)+(.+?)(\*|_)+/g,(e,n,r)=>r)}function yh(t){return t?.frontmatter?(0,Gr.parseFrontMatterAliases)(t.frontmatter)??[]:[]}function Ah(t){let e=t?(0,Gr.getAllTags)(t)??[]:[];return e=[...new Set(e.reduce((n,r)=>[...n,...r.split("/").filter(s=>s).map(s=>s.startsWith("#")?s:`#${s}`),r],[]))],e}function un(t,e=!1){if(t==null)return"";let r=["\\u30FC","\\u309A","\\u3099"].join("|"),s=new RegExp(`(?!${r})\\p{Diacritic}`,"gu");if(e){t=t.replace(/([^\u0621-\u063A\u0641-\u064A\u0660-\u0669a-zA-Z 0-9])/g,"").replace(/(آ|إ|أ)/g,"\u0627").replace(/(ة)/g,"\u0647").replace(/(ئ|ؤ)/g,"\u0621").replace(/(ى)/g,"\u064A");for(let i=0;i<10;i++)t.replace(String.fromCharCode(1632+i),String.fromCharCode(48+i))}return t=t.replaceAll("`","[__omnisearch__backtick__]"),t=t.replaceAll("^","[__omnisearch__caret__]"),t=t.normalize("NFD").replace(s,"").normalize("NFC"),t=t.replaceAll("[__omnisearch__backtick__]","`"),t=t.replaceAll("[__omnisearch__caret__]","^"),t}function Mn(){return Gr.Platform.isMacOS?"\u2318":"ctrl"}function Jt(t){let e=Fn(t);return e==="png"||e==="jpg"||e==="jpeg"||e==="webp"||e==="gif"}function en(t){return Fn(t)==="pdf"}function Ch(t){let e=Fn(t);return e==="docx"||e==="xlsx"}function cn(t){return t.endsWith(".canvas")}function Ma(t){return t.endsWith(".excalidraw")}function oi(t){return t.endsWith(".loom")}function Fn(t){let e=t.split(".");return e[e.length-1]??""}function Sh(t,e){let n=[],r=0,s=t.length;for(;rn):[]}function pc(t){return t.includes("-")?t.split("-").filter(e=>e):[]}function le(...t){wh(console.debug,...t)}function ln(...t){wh(console.warn,...t)}function mc(t){Ih=t}function wh(t,...e){Ih&&t(...e)}var Gr,Sx,Ix,Ih,ut=x(()=>{Gr=_e(require("obsidian"));Zt();Sx=_e(require("crypto")),Ix=_e(Th());Ih=!1});function wx(t){let e,n,r,s,i,a,o,c,l=t[9].default,h=Hr(l,t,t[8],null);return{c(){e=V("div"),n=V("div"),r=V("input"),i=ie(),h&&h.c(),K(r,"class","prompt-input"),K(r,"placeholder",t[0]),K(r,"spellcheck","false"),K(r,"type","text"),K(n,"class","omnisearch-input-field"),K(e,"class","omnisearch-input-container")},m(d,f){re(d,e,f),j(e,n),j(n,r),t[10](r),Ju(r,t[1]),j(e,i),h&&h.m(e,null),a=!0,o||(c=[Ge(r,"input",t[11]),Ge(r,"compositionend",t[12]),Ge(r,"compositionstart",t[13]),Ge(r,"input",t[4]),Zs(s=t[3].call(null,r))],o=!0)},p(d,[f]){(!a||f&1)&&K(r,"placeholder",d[0]),f&2&&r.value!==d[1]&&Ju(r,d[1]),h&&h.p&&(!a||f&256)&&zr(h,l,d,d[8],a?Ur(l,d[8],f,null):Vr(d[8]),null)},i(d){a||(me(h,d),a=!0)},o(d){xe(h,d),a=!1},d(d){d&&ne(e),t[10](null),h&&h.d(d),o=!1,jt(c)}}}function Nx(t,e,n){let{$$slots:r={},$$scope:s}=e,{initialValue:i=""}=e,{placeholder:a=""}=e,{plugin:o}=e,c=!1,l="",h,d=nc();function f(b){n(1,l=b)}function p(b){b&&!c&&!l&&(c=!0,n(1,l=b),E())}function E(b){Ln().then(async()=>(ui.Platform.isMobileApp&&await dc(200),h.focus(),Ln())).then(async()=>{ui.Platform.isMobileApp&&await dc(200),h.select()})}let T=(0,ui.debounce)(()=>{o.searchHistory.addToHistory(""),d("input",l)},300);function w(b){Rn[b?"unshift":"push"](()=>{h=b,n(2,h)})}function m(){l=this.value,n(1,l)}let I=b=>uc(!1),A=b=>uc(!0);return t.$$set=b=>{"initialValue"in b&&n(5,i=b.initialValue),"placeholder"in b&&n(0,a=b.placeholder),"plugin"in b&&n(6,o=b.plugin),"$$scope"in b&&n(8,s=b.$$scope)},t.$$.update=()=>{if(t.$$.dirty&32){e:p(i)}},[a,l,h,E,T,i,o,f,s,r,w,m,I,A]}var ui,Nh,Fa,gc=x(()=>{wt();ui=_e(require("obsidian"));Zt();ni();ut();Nh=class extends $e{constructor(e){super();et(this,e,Nx,wx,qe,{initialValue:5,placeholder:0,plugin:6,setInputValue:7})}get setInputValue(){return this.$$.ctx[7]}},Fa=Nh});function vx(t){let e,n,r,s,i=t[1].default,a=Hr(i,t,t[0],null);return{c(){e=V("div"),a&&a.c(),K(e,"class","prompt-results")},m(o,c){re(o,e,c),a&&a.m(e,null),n=!0,r||(s=Ge(e,"mousedown",Dx),r=!0)},p(o,[c]){a&&a.p&&(!n||c&1)&&zr(a,i,o,o[0],n?Ur(i,o[0],c,null):Vr(o[0]),null)},i(o){n||(me(a,o),n=!0)},o(o){xe(a,o),n=!1},d(o){o&&ne(e),a&&a.d(o),r=!1,s()}}}function Ox(t,e,n){let{$$slots:r={},$$scope:s}=e;return t.$$set=i=>{"$$scope"in i&&n(0,s=i.$$scope)},[s,r]}var Dx,vh,Ba,bc=x(()=>{wt();Dx=t=>t.preventDefault();vh=class extends $e{constructor(e){super();et(this,e,Ox,vx,qe,{})}},Ba=vh});async function ja(t,e,n=0,r=!1,s=!1){let i=!1;t.workspace.iterateAllLeaves(c=>{c.view instanceof _c.MarkdownView&&!r&&c.getViewState().state?.file===e.path&&c.getViewState()?.pinned&&(t.workspace.setActiveLeaf(c,{focus:!0}),i=!0)}),i||await t.workspace.openLinkText(e.path,"",s?"split":r);let a=t.workspace.getActiveViewOfType(_c.MarkdownView);if(!a)return;let o=a.editor.offsetToPos(n);a.editor.setCursor(o),a.editor.scrollIntoView({from:{line:o.line-10,ch:0},to:{line:o.line+10,ch:0}})}async function Dh(t,e,n=!1){try{let r;switch(t.vault.getConfig("newFileLocation")){case"current":r=(t.workspace.getActiveFile()?.parent?.path??"")+"/";break;case"folder":r=t.vault.getConfig("newFileFolderPath")+"/";break;default:r="";break}await t.workspace.openLinkText(`${r}${e}.md`,"",n)}catch(r){throw r.message="OmniSearch - Could not create note: "+r.message,console.error(r),r}}function Oh(t,e,n){return(n.links??[]).map(r=>{let s=Ec(r.link);return t.metadataCache.getFirstLinkpathDest(s,e.path)?"":r.link}).filter(r=>!!r)}function Ec(t){return t.split(/[\^#]+/)[0]}var _c,ci=x(()=>{_c=_e(require("obsidian"))});var kx,Ha,Tc=x(()=>{kx=typeof global=="object"&&global&&global.Object===Object&&global,Ha=kx});var Rx,Lx,je,Ht=x(()=>{Tc();Rx=typeof self=="object"&&self&&self.Object===Object&&self,Lx=Ha||Rx||Function("return this")(),je=Lx});var Px,ct,$r=x(()=>{Ht();Px=je.Symbol,ct=Px});function Bx(t){var e=Mx.call(t,li),n=t[li];try{t[li]=void 0;var r=!0}catch{}var s=Fx.call(t);return r&&(e?t[li]=n:delete t[li]),s}var kh,Mx,Fx,li,Rh,Lh=x(()=>{$r();kh=Object.prototype,Mx=kh.hasOwnProperty,Fx=kh.toString,li=ct?ct.toStringTag:void 0;Rh=Bx});function Ux(t){return Hx.call(t)}var jx,Hx,Ph,Mh=x(()=>{jx=Object.prototype,Hx=jx.toString;Ph=Ux});function qx(t){return t==null?t===void 0?Vx:zx:Fh&&Fh in Object(t)?Rh(t):Ph(t)}var zx,Vx,Fh,Ut,Qr=x(()=>{$r();Lh();Mh();zx="[object Null]",Vx="[object Undefined]",Fh=ct?ct.toStringTag:void 0;Ut=qx});function Kx(t){return t!=null&&typeof t=="object"}var zt,Xr=x(()=>{zt=Kx});function Wx(t){return typeof t=="symbol"||zt(t)&&Ut(t)==Yx}var Yx,Vt,Zr=x(()=>{Qr();Xr();Yx="[object Symbol]";Vt=Wx});function Gx(t,e){for(var n=-1,r=t==null?0:t.length,s=Array(r);++n{Jr=Gx});var $x,Me,qt=x(()=>{$x=Array.isArray,Me=$x});function Hh(t){if(typeof t=="string")return t;if(Me(t))return Jr(t,Hh)+"";if(Vt(t))return jh?jh.call(t):"";var e=t+"";return e=="0"&&1/t==-Qx?"-0":e}var Qx,Bh,jh,Uh,zh=x(()=>{$r();xc();qt();Zr();Qx=1/0,Bh=ct?ct.prototype:void 0,jh=Bh?Bh.toString:void 0;Uh=Hh});function Zx(t){for(var e=t.length;e--&&Xx.test(t.charAt(e)););return e}var Xx,Vh,qh=x(()=>{Xx=/\s/;Vh=Zx});function ey(t){return t&&t.slice(0,Vh(t)+1).replace(Jx,"")}var Jx,Kh,Yh=x(()=>{qh();Jx=/^\s+/;Kh=ey});function ty(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var xt,mr=x(()=>{xt=ty});function ay(t){if(typeof t=="number")return t;if(Vt(t))return Wh;if(xt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=xt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Kh(t);var n=ry.test(t);return n||sy.test(t)?iy(t.slice(2),n?2:8):ny.test(t)?Wh:+t}var Wh,ny,ry,sy,iy,yc,Gh=x(()=>{Yh();mr();Zr();Wh=0/0,ny=/^[-+]0x[0-9a-f]+$/i,ry=/^0b[01]+$/i,sy=/^0o[0-7]+$/i,iy=parseInt;yc=ay});function oy(t){return t}var Bn,fi=x(()=>{Bn=oy});function dy(t){if(!xt(t))return!1;var e=Ut(t);return e==cy||e==ly||e==uy||e==fy}var uy,cy,ly,fy,Ua,Ac=x(()=>{Qr();mr();uy="[object AsyncFunction]",cy="[object Function]",ly="[object GeneratorFunction]",fy="[object Proxy]";Ua=dy});var hy,za,$h=x(()=>{Ht();hy=je["__core-js_shared__"],za=hy});function py(t){return!!Qh&&Qh in t}var Qh,Xh,Zh=x(()=>{$h();Qh=function(){var t=/[^.]+$/.exec(za&&za.keys&&za.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();Xh=py});function by(t){if(t!=null){try{return gy.call(t)}catch{}try{return t+""}catch{}}return""}var my,gy,fn,Cc=x(()=>{my=Function.prototype,gy=my.toString;fn=by});function Sy(t){if(!xt(t)||Xh(t))return!1;var e=Ua(t)?Cy:Ey;return e.test(fn(t))}var _y,Ey,Ty,xy,yy,Ay,Cy,Jh,e0=x(()=>{Ac();Zh();mr();Cc();_y=/[\\^$.*+?()[\]{}|]/g,Ey=/^\[object .+?Constructor\]$/,Ty=Function.prototype,xy=Object.prototype,yy=Ty.toString,Ay=xy.hasOwnProperty,Cy=RegExp("^"+yy.call(Ay).replace(_y,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");Jh=Sy});function Iy(t,e){return t==null?void 0:t[e]}var t0,n0=x(()=>{t0=Iy});function wy(t,e){var n=t0(t,e);return Jh(n)?n:void 0}var mt,jn=x(()=>{e0();n0();mt=wy});var Ny,Va,r0=x(()=>{jn();Ht();Ny=mt(je,"WeakMap"),Va=Ny});function vy(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var s0,i0=x(()=>{s0=vy});function Ry(t){var e=0,n=0;return function(){var r=ky(),s=Oy-(r-n);if(n=r,s>0){if(++e>=Dy)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Dy,Oy,ky,a0,o0=x(()=>{Dy=800,Oy=16,ky=Date.now;a0=Ry});function Ly(t){return function(){return t}}var u0,c0=x(()=>{u0=Ly});var Py,Sc,l0=x(()=>{jn();Py=function(){try{var t=mt(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Sc=Py});var My,f0,d0=x(()=>{c0();l0();fi();My=Sc?function(t,e){return Sc(t,"toString",{configurable:!0,enumerable:!1,value:u0(e),writable:!0})}:Bn,f0=My});var Fy,h0,p0=x(()=>{d0();o0();Fy=a0(f0),h0=Fy});function Hy(t,e){var n=typeof t;return e=e??By,!!e&&(n=="number"||n!="symbol"&&jy.test(t))&&t>-1&&t%1==0&&t{By=9007199254740991,jy=/^(?:0|[1-9]\d*)$/;es=Hy});function Uy(t,e){return t===e||t!==t&&e!==e}var ts,Ka=x(()=>{ts=Uy});function zy(t,e,n){return e=m0(e===void 0?t.length-1:e,0),function(){for(var r=arguments,s=-1,i=m0(r.length-e,0),a=Array(i);++s{i0();m0=Math.max;g0=zy});function Vy(t,e){return h0(g0(t,e,Bn),t+"")}var _0,E0=x(()=>{fi();b0();p0();_0=Vy});function Ky(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=qy}var qy,ns,Ya=x(()=>{qy=9007199254740991;ns=Ky});function Yy(t){return t!=null&&ns(t.length)&&!Ua(t)}var Hn,di=x(()=>{Ac();Ya();Hn=Yy});function Wy(t,e,n){if(!xt(n))return!1;var r=typeof e;return(r=="number"?Hn(n)&&es(e,n.length):r=="string"&&e in n)?ts(n[e],t):!1}var Ic,T0=x(()=>{Ka();di();qa();mr();Ic=Wy});function $y(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Gy;return t===n}var Gy,x0,y0=x(()=>{Gy=Object.prototype;x0=$y});function Qy(t,e){for(var n=-1,r=Array(t);++n{A0=Qy});function Zy(t){return zt(t)&&Ut(t)==Xy}var Xy,wc,S0=x(()=>{Qr();Xr();Xy="[object Arguments]";wc=Zy});var I0,Jy,eA,tA,rs,Wa=x(()=>{S0();Xr();I0=Object.prototype,Jy=I0.hasOwnProperty,eA=I0.propertyIsEnumerable,tA=wc(function(){return arguments}())?wc:function(t){return zt(t)&&Jy.call(t,"callee")&&!eA.call(t,"callee")},rs=tA});function nA(){return!1}var w0,N0=x(()=>{w0=nA});var v0,D0,rA,O0,sA,iA,hi,Nc=x(()=>{Ht();N0();v0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,D0=v0&&typeof module=="object"&&module&&!module.nodeType&&module,rA=D0&&D0.exports===v0,O0=rA?je.Buffer:void 0,sA=O0?O0.isBuffer:void 0,iA=sA||w0,hi=iA});function DA(t){return zt(t)&&ns(t.length)&&!!Ne[Ut(t)]}var aA,oA,uA,cA,lA,fA,dA,hA,pA,mA,gA,bA,_A,EA,TA,xA,yA,AA,CA,SA,IA,wA,NA,vA,Ne,k0,R0=x(()=>{Qr();Ya();Xr();aA="[object Arguments]",oA="[object Array]",uA="[object Boolean]",cA="[object Date]",lA="[object Error]",fA="[object Function]",dA="[object Map]",hA="[object Number]",pA="[object Object]",mA="[object RegExp]",gA="[object Set]",bA="[object String]",_A="[object WeakMap]",EA="[object ArrayBuffer]",TA="[object DataView]",xA="[object Float32Array]",yA="[object Float64Array]",AA="[object Int8Array]",CA="[object Int16Array]",SA="[object Int32Array]",IA="[object Uint8Array]",wA="[object Uint8ClampedArray]",NA="[object Uint16Array]",vA="[object Uint32Array]",Ne={};Ne[xA]=Ne[yA]=Ne[AA]=Ne[CA]=Ne[SA]=Ne[IA]=Ne[wA]=Ne[NA]=Ne[vA]=!0;Ne[aA]=Ne[oA]=Ne[EA]=Ne[uA]=Ne[TA]=Ne[cA]=Ne[lA]=Ne[fA]=Ne[dA]=Ne[hA]=Ne[pA]=Ne[mA]=Ne[gA]=Ne[bA]=Ne[_A]=!1;k0=DA});function OA(t){return function(e){return t(e)}}var Ga,vc=x(()=>{Ga=OA});var L0,pi,kA,Dc,RA,Oc,P0=x(()=>{Tc();L0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pi=L0&&typeof module=="object"&&module&&!module.nodeType&&module,kA=pi&&pi.exports===L0,Dc=kA&&Ha.process,RA=function(){try{var t=pi&&pi.require&&pi.require("util").types;return t||Dc&&Dc.binding&&Dc.binding("util")}catch{}}(),Oc=RA});var M0,LA,$a,kc=x(()=>{R0();vc();P0();M0=Oc&&Oc.isTypedArray,LA=M0?Ga(M0):k0,$a=LA});function FA(t,e){var n=Me(t),r=!n&&rs(t),s=!n&&!r&&hi(t),i=!n&&!r&&!s&&$a(t),a=n||r||s||i,o=a?A0(t.length,String):[],c=o.length;for(var l in t)(e||MA.call(t,l))&&!(a&&(l=="length"||s&&(l=="offset"||l=="parent")||i&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||es(l,c)))&&o.push(l);return o}var PA,MA,F0,B0=x(()=>{C0();Wa();qt();Nc();qa();kc();PA=Object.prototype,MA=PA.hasOwnProperty;F0=FA});function BA(t,e){return function(n){return t(e(n))}}var j0,H0=x(()=>{j0=BA});var jA,U0,z0=x(()=>{H0();jA=j0(Object.keys,Object),U0=jA});function zA(t){if(!x0(t))return U0(t);var e=[];for(var n in Object(t))UA.call(t,n)&&n!="constructor"&&e.push(n);return e}var HA,UA,V0,q0=x(()=>{y0();z0();HA=Object.prototype,UA=HA.hasOwnProperty;V0=zA});function VA(t){return Hn(t)?F0(t):V0(t)}var ss,Qa=x(()=>{B0();q0();di();ss=VA});function YA(t,e){if(Me(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Vt(t)?!0:KA.test(t)||!qA.test(t)||e!=null&&t in Object(e)}var qA,KA,is,Xa=x(()=>{qt();Zr();qA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,KA=/^\w*$/;is=YA});var WA,dn,mi=x(()=>{jn();WA=mt(Object,"create"),dn=WA});function GA(){this.__data__=dn?dn(null):{},this.size=0}var K0,Y0=x(()=>{mi();K0=GA});function $A(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var W0,G0=x(()=>{W0=$A});function JA(t){var e=this.__data__;if(dn){var n=e[t];return n===QA?void 0:n}return ZA.call(e,t)?e[t]:void 0}var QA,XA,ZA,$0,Q0=x(()=>{mi();QA="__lodash_hash_undefined__",XA=Object.prototype,ZA=XA.hasOwnProperty;$0=JA});function n2(t){var e=this.__data__;return dn?e[t]!==void 0:t2.call(e,t)}var e2,t2,X0,Z0=x(()=>{mi();e2=Object.prototype,t2=e2.hasOwnProperty;X0=n2});function s2(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=dn&&e===void 0?r2:e,this}var r2,J0,ep=x(()=>{mi();r2="__lodash_hash_undefined__";J0=s2});function as(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{Y0();G0();Q0();Z0();ep();as.prototype.clear=K0;as.prototype.delete=W0;as.prototype.get=$0;as.prototype.has=X0;as.prototype.set=J0;Rc=as});function i2(){this.__data__=[],this.size=0}var np,rp=x(()=>{np=i2});function a2(t,e){for(var n=t.length;n--;)if(ts(t[n][0],e))return n;return-1}var Un,gi=x(()=>{Ka();Un=a2});function c2(t){var e=this.__data__,n=Un(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():u2.call(e,n,1),--this.size,!0}var o2,u2,sp,ip=x(()=>{gi();o2=Array.prototype,u2=o2.splice;sp=c2});function l2(t){var e=this.__data__,n=Un(e,t);return n<0?void 0:e[n][1]}var ap,op=x(()=>{gi();ap=l2});function f2(t){return Un(this.__data__,t)>-1}var up,cp=x(()=>{gi();up=f2});function d2(t,e){var n=this.__data__,r=Un(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var lp,fp=x(()=>{gi();lp=d2});function os(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{rp();ip();op();cp();fp();os.prototype.clear=np;os.prototype.delete=sp;os.prototype.get=ap;os.prototype.has=up;os.prototype.set=lp;zn=os});var h2,Vn,Za=x(()=>{jn();Ht();h2=mt(je,"Map"),Vn=h2});function p2(){this.size=0,this.__data__={hash:new Rc,map:new(Vn||zn),string:new Rc}}var dp,hp=x(()=>{tp();bi();Za();dp=p2});function m2(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var pp,mp=x(()=>{pp=m2});function g2(t,e){var n=t.__data__;return pp(e)?n[typeof e=="string"?"string":"hash"]:n.map}var qn,_i=x(()=>{mp();qn=g2});function b2(t){var e=qn(this,t).delete(t);return this.size-=e?1:0,e}var gp,bp=x(()=>{_i();gp=b2});function _2(t){return qn(this,t).get(t)}var _p,Ep=x(()=>{_i();_p=_2});function E2(t){return qn(this,t).has(t)}var Tp,xp=x(()=>{_i();Tp=E2});function T2(t,e){var n=qn(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var yp,Ap=x(()=>{_i();yp=T2});function us(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{hp();bp();Ep();xp();Ap();us.prototype.clear=dp;us.prototype.delete=gp;us.prototype.get=_p;us.prototype.has=Tp;us.prototype.set=yp;gr=us});function Lc(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(x2);var n=function(){var r=arguments,s=e?e.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var a=t.apply(this,r);return n.cache=i.set(s,a)||i,a};return n.cache=new(Lc.Cache||gr),n}var x2,Cp,Sp=x(()=>{Ja();x2="Expected a function";Lc.Cache=gr;Cp=Lc});function A2(t){var e=Cp(t,function(r){return n.size===y2&&n.clear(),r}),n=e.cache;return e}var y2,Ip,wp=x(()=>{Sp();y2=500;Ip=A2});var C2,S2,I2,Np,vp=x(()=>{wp();C2=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,S2=/\\(\\)?/g,I2=Ip(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(C2,function(n,r,s,i){e.push(s?i.replace(S2,"$1"):r||n)}),e}),Np=I2});function w2(t){return t==null?"":Uh(t)}var eo,Pc=x(()=>{zh();eo=w2});function N2(t,e){return Me(t)?t:is(t,e)?[t]:Np(eo(t))}var to,Mc=x(()=>{qt();Xa();vp();Pc();to=N2});function D2(t){if(typeof t=="string"||Vt(t))return t;var e=t+"";return e=="0"&&1/t==-v2?"-0":e}var v2,Kn,Ei=x(()=>{Zr();v2=1/0;Kn=D2});function O2(t,e){e=to(e,t);for(var n=0,r=e.length;t!=null&&n{Mc();Ei();cs=O2});function k2(t,e,n){var r=t==null?void 0:cs(t,e);return r===void 0?n:r}var Dp,Op=x(()=>{no();Dp=k2});function R2(t,e){for(var n=-1,r=e.length,s=t.length;++n{ro=R2});function L2(t){return Me(t)||rs(t)||!!(kp&&t&&t[kp])}var kp,Rp,Lp=x(()=>{$r();Wa();qt();kp=ct?ct.isConcatSpreadable:void 0;Rp=L2});function Pp(t,e,n,r,s){var i=-1,a=t.length;for(n||(n=Rp),s||(s=[]);++i0&&n(o)?e>1?Pp(o,e-1,n,r,s):ro(s,o):r||(s[s.length]=o)}return s}var Mp,Fp=x(()=>{Fc();Lp();Mp=Pp});function P2(){this.__data__=new zn,this.size=0}var Bp,jp=x(()=>{bi();Bp=P2});function M2(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var Hp,Up=x(()=>{Hp=M2});function F2(t){return this.__data__.get(t)}var zp,Vp=x(()=>{zp=F2});function B2(t){return this.__data__.has(t)}var qp,Kp=x(()=>{qp=B2});function H2(t,e){var n=this.__data__;if(n instanceof zn){var r=n.__data__;if(!Vn||r.length{bi();Za();Ja();j2=200;Yp=H2});function ls(t){var e=this.__data__=new zn(t);this.size=e.size}var fs,Bc=x(()=>{bi();jp();Up();Vp();Kp();Wp();ls.prototype.clear=Bp;ls.prototype.delete=Hp;ls.prototype.get=zp;ls.prototype.has=qp;ls.prototype.set=Yp;fs=ls});function U2(t,e){for(var n=-1,r=t==null?0:t.length,s=0,i=[];++n{Gp=U2});function z2(){return[]}var Qp,Xp=x(()=>{Qp=z2});var V2,q2,Zp,K2,Jp,em=x(()=>{$p();Xp();V2=Object.prototype,q2=V2.propertyIsEnumerable,Zp=Object.getOwnPropertySymbols,K2=Zp?function(t){return t==null?[]:(t=Object(t),Gp(Zp(t),function(e){return q2.call(t,e)}))}:Qp,Jp=K2});function Y2(t,e,n){var r=e(t);return Me(t)?r:ro(r,n(t))}var tm,nm=x(()=>{Fc();qt();tm=Y2});function W2(t){return tm(t,ss,Jp)}var jc,rm=x(()=>{nm();em();Qa();jc=W2});var G2,so,sm=x(()=>{jn();Ht();G2=mt(je,"DataView"),so=G2});var $2,io,im=x(()=>{jn();Ht();$2=mt(je,"Promise"),io=$2});var Q2,ao,am=x(()=>{jn();Ht();Q2=mt(je,"Set"),ao=Q2});var om,X2,um,cm,lm,fm,Z2,J2,eC,tC,nC,br,Hc,dm=x(()=>{sm();Za();im();am();r0();Qr();Cc();om="[object Map]",X2="[object Object]",um="[object Promise]",cm="[object Set]",lm="[object WeakMap]",fm="[object DataView]",Z2=fn(so),J2=fn(Vn),eC=fn(io),tC=fn(ao),nC=fn(Va),br=Ut;(so&&br(new so(new ArrayBuffer(1)))!=fm||Vn&&br(new Vn)!=om||io&&br(io.resolve())!=um||ao&&br(new ao)!=cm||Va&&br(new Va)!=lm)&&(br=function(t){var e=Ut(t),n=e==X2?t.constructor:void 0,r=n?fn(n):"";if(r)switch(r){case Z2:return fm;case J2:return om;case eC:return um;case tC:return cm;case nC:return lm}return e});Hc=br});var rC,Uc,hm=x(()=>{Ht();rC=je.Uint8Array,Uc=rC});function iC(t){return this.__data__.set(t,sC),this}var sC,pm,mm=x(()=>{sC="__lodash_hash_undefined__";pm=iC});function aC(t){return this.__data__.has(t)}var gm,bm=x(()=>{gm=aC});function oo(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new gr;++e{Ja();mm();bm();oo.prototype.add=oo.prototype.push=pm;oo.prototype.has=gm;_m=oo});function oC(t,e){for(var n=-1,r=t==null?0:t.length;++n{Tm=oC});function uC(t,e){return t.has(e)}var ym,Am=x(()=>{ym=uC});function fC(t,e,n,r,s,i){var a=n&cC,o=t.length,c=e.length;if(o!=c&&!(a&&c>o))return!1;var l=i.get(t),h=i.get(e);if(l&&h)return l==e&&h==t;var d=-1,f=!0,p=n&lC?new _m:void 0;for(i.set(t,e),i.set(e,t);++d{Em();xm();Am();cC=1,lC=2;uo=fC});function dC(t){var e=-1,n=Array(t.size);return t.forEach(function(r,s){n[++e]=[s,r]}),n}var Cm,Sm=x(()=>{Cm=dC});function hC(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var Im,wm=x(()=>{Im=hC});function wC(t,e,n,r,s,i,a){switch(n){case IC:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case SC:return!(t.byteLength!=e.byteLength||!i(new Uc(t),new Uc(e)));case gC:case bC:case TC:return ts(+t,+e);case _C:return t.name==e.name&&t.message==e.message;case xC:case AC:return t==e+"";case EC:var o=Cm;case yC:var c=r&pC;if(o||(o=Im),t.size!=e.size&&!c)return!1;var l=a.get(t);if(l)return l==e;r|=mC,a.set(t,e);var h=uo(o(t),o(e),r,s,i,a);return a.delete(t),h;case CC:if(Vc)return Vc.call(t)==Vc.call(e)}return!1}var pC,mC,gC,bC,_C,EC,TC,xC,yC,AC,CC,SC,IC,Nm,Vc,vm,Dm=x(()=>{$r();hm();Ka();zc();Sm();wm();pC=1,mC=2,gC="[object Boolean]",bC="[object Date]",_C="[object Error]",EC="[object Map]",TC="[object Number]",xC="[object RegExp]",yC="[object Set]",AC="[object String]",CC="[object Symbol]",SC="[object ArrayBuffer]",IC="[object DataView]",Nm=ct?ct.prototype:void 0,Vc=Nm?Nm.valueOf:void 0;vm=wC});function OC(t,e,n,r,s,i){var a=n&NC,o=jc(t),c=o.length,l=jc(e),h=l.length;if(c!=h&&!a)return!1;for(var d=c;d--;){var f=o[d];if(!(a?f in e:DC.call(e,f)))return!1}var p=i.get(t),E=i.get(e);if(p&&E)return p==e&&E==t;var T=!0;i.set(t,e),i.set(e,t);for(var w=a;++d{rm();NC=1,vC=Object.prototype,DC=vC.hasOwnProperty;Om=OC});function LC(t,e,n,r,s,i){var a=Me(t),o=Me(e),c=a?Lm:Hc(t),l=o?Lm:Hc(e);c=c==Rm?co:c,l=l==Rm?co:l;var h=c==co,d=l==co,f=c==l;if(f&&hi(t)){if(!hi(e))return!1;a=!0,h=!1}if(f&&!h)return i||(i=new fs),a||$a(t)?uo(t,e,n,r,s,i):vm(t,e,c,n,r,s,i);if(!(n&kC)){var p=h&&Pm.call(t,"__wrapped__"),E=d&&Pm.call(e,"__wrapped__");if(p||E){var T=p?t.value():t,w=E?e.value():e;return i||(i=new fs),s(T,w,n,r,i)}}return f?(i||(i=new fs),Om(t,e,n,r,s,i)):!1}var kC,Rm,Lm,co,RC,Pm,Mm,Fm=x(()=>{Bc();zc();Dm();km();dm();qt();Nc();kc();kC=1,Rm="[object Arguments]",Lm="[object Array]",co="[object Object]",RC=Object.prototype,Pm=RC.hasOwnProperty;Mm=LC});function Bm(t,e,n,r,s){return t===e?!0:t==null||e==null||!zt(t)&&!zt(e)?t!==t&&e!==e:Mm(t,e,n,r,Bm,s)}var lo,qc=x(()=>{Fm();Xr();lo=Bm});function FC(t,e,n,r){var s=n.length,i=s,a=!r;if(t==null)return!i;for(t=Object(t);s--;){var o=n[s];if(a&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++s{Bc();qc();PC=1,MC=2;jm=FC});function BC(t){return t===t&&!xt(t)}var fo,Kc=x(()=>{mr();fo=BC});function jC(t){for(var e=ss(t),n=e.length;n--;){var r=e[n],s=t[r];e[n]=[r,s,fo(s)]}return e}var Um,zm=x(()=>{Kc();Qa();Um=jC});function HC(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}var ho,Yc=x(()=>{ho=HC});function UC(t){var e=Um(t);return e.length==1&&e[0][2]?ho(e[0][0],e[0][1]):function(n){return n===t||jm(n,t,e)}}var Vm,qm=x(()=>{Hm();zm();Yc();Vm=UC});function zC(t,e){return t!=null&&e in Object(t)}var Km,Ym=x(()=>{Km=zC});function VC(t,e,n){e=to(e,t);for(var r=-1,s=e.length,i=!1;++r{Mc();Wa();qt();qa();Ya();Ei();Wm=VC});function qC(t,e){return t!=null&&Wm(t,e,Km)}var $m,Qm=x(()=>{Ym();Gm();$m=qC});function WC(t,e){return is(t)&&fo(e)?ho(Kn(t),e):function(n){var r=Dp(n,t);return r===void 0&&r===e?$m(n,t):lo(e,r,KC|YC)}}var KC,YC,Xm,Zm=x(()=>{qc();Op();Qm();Xa();Kc();Yc();Ei();KC=1,YC=2;Xm=WC});function GC(t){return function(e){return e==null?void 0:e[t]}}var Jm,eg=x(()=>{Jm=GC});function $C(t){return function(e){return cs(e,t)}}var tg,ng=x(()=>{no();tg=$C});function QC(t){return is(t)?Jm(Kn(t)):tg(t)}var rg,sg=x(()=>{eg();ng();Xa();Ei();rg=QC});function XC(t){return typeof t=="function"?t:t==null?Bn:typeof t=="object"?Me(t)?Xm(t[0],t[1]):Vm(t):rg(t)}var ig,ag=x(()=>{qm();Zm();fi();qt();sg();ig=XC});function ZC(t){return function(e,n,r){for(var s=-1,i=Object(e),a=r(e),o=a.length;o--;){var c=a[t?o:++s];if(n(i[c],c,i)===!1)break}return e}}var og,ug=x(()=>{og=ZC});var JC,cg,lg=x(()=>{ug();JC=og(),cg=JC});function eS(t,e){return t&&cg(t,e,ss)}var fg,dg=x(()=>{lg();Qa();fg=eS});function tS(t,e){return function(n,r){if(n==null)return n;if(!Hn(n))return t(n,r);for(var s=n.length,i=e?s:-1,a=Object(n);(e?i--:++i{di();hg=tS});var nS,mg,gg=x(()=>{dg();pg();nS=hg(fg),mg=nS});var rS,po,bg=x(()=>{Ht();rS=function(){return je.Date.now()},po=rS});function oS(t,e,n){var r,s,i,a,o,c,l=0,h=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(sS);e=yc(e)||0,xt(n)&&(h=!!n.leading,d="maxWait"in n,i=d?iS(yc(n.maxWait)||0,e):i,f="trailing"in n?!!n.trailing:f);function p(C){var N=r,O=s;return r=s=void 0,l=C,a=t.apply(O,N),a}function E(C){return l=C,o=setTimeout(m,e),h?p(C):a}function T(C){var N=C-c,O=C-l,L=e-N;return d?aS(L,i-O):L}function w(C){var N=C-c,O=C-l;return c===void 0||N>=e||N<0||d&&O>=i}function m(){var C=po();if(w(C))return I(C);o=setTimeout(m,T(C))}function I(C){return o=void 0,f&&r?p(C):(r=s=void 0,a)}function A(){o!==void 0&&clearTimeout(o),l=0,r=c=s=o=void 0}function b(){return o===void 0?a:I(po())}function S(){var C=po(),N=w(C);if(r=arguments,s=this,c=C,N){if(o===void 0)return E(c);if(d)return clearTimeout(o),o=setTimeout(m,e),p(c)}return o===void 0&&(o=setTimeout(m,e)),a}return S.cancel=A,S.flush=b,S}var sS,iS,aS,Ti,_g=x(()=>{mr();bg();Gh();sS="Expected a function",iS=Math.max,aS=Math.min;Ti=oS});function cS(t){return t=eo(t),t&&uS.test(t)?t.replace(Eg,"\\$&"):t}var Eg,uS,Yn,Tg=x(()=>{Pc();Eg=/[\\^$.*+?()[\]{}|]/g,uS=RegExp(Eg.source);Yn=cS});function lS(t,e){var n=-1,r=Hn(t)?Array(t.length):[];return mg(t,function(s,i,a){r[++n]=e(s,i,a)}),r}var xg,yg=x(()=>{gg();di();xg=lS});function fS(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}var Ag,Cg=x(()=>{Ag=fS});function dS(t,e){if(t!==e){var n=t!==void 0,r=t===null,s=t===t,i=Vt(t),a=e!==void 0,o=e===null,c=e===e,l=Vt(e);if(!o&&!l&&!i&&t>e||i&&a&&c&&!o&&!l||r&&a&&c||!n&&c||!s)return 1;if(!r&&!i&&!l&&t{Zr();Sg=dS});function hS(t,e,n){for(var r=-1,s=t.criteria,i=e.criteria,a=s.length,o=n.length;++r=o)return c;var l=n[r];return c*(l=="desc"?-1:1)}}return t.index-e.index}var wg,Ng=x(()=>{Ig();wg=hS});function pS(t,e,n){e.length?e=Jr(e,function(i){return Me(i)?function(a){return cs(a,i.length===1?i[0]:i)}:i}):e=[Bn];var r=-1;e=Jr(e,Ga(ig));var s=xg(t,function(i,a,o){var c=Jr(e,function(l){return l(i)});return{criteria:c,index:++r,value:i}});return Ag(s,function(i,a){return wg(i,a,n)})}var vg,Dg=x(()=>{xc();no();ag();yg();Cg();vc();Ng();fi();qt();vg=pS});var mS,Wc,Og=x(()=>{Fp();Dg();E0();T0();mS=_0(function(t,e){if(t==null)return[];var n=e.length;return n>1&&Ic(t,e[0],e[1])?e=[]:n>2&&Ic(e[0],e[1],e[2])&&(e=[e[0]]),vg(t,Mp(e,1),[])}),Wc=mS});var xi=x(()=>{_g();Tg();Og();});function go(t){return{useCache:!0,hideExcluded:!1,downrankedFoldersFilters:[],ignoreDiacritics:!0,ignoreArabicDiacritics:!1,indexedFileTypes:[],displayTitle:"",PDFIndexing:!1,officeIndexing:!1,imagesIndexing:!1,aiImageIndexing:!1,unsupportedFilesIndexing:"default",splitCamelCase:!1,openInNewPane:!1,vimLikeNavigationShortcut:t.vault.getConfig("vimMode"),ribbonIcon:!0,showExcerpt:!0,maxEmbeds:5,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,tokenizeUrls:!1,fuzziness:"1",weightBasename:10,weightDirectory:7,weightH1:6,weightH2:5,weightH3:4,weightUnmarkedTags:2,weightCustomProperties:[],httpApiEnabled:!1,httpApiPort:"51361",httpApiNotice:!0,welcomeMessage:"",verboseLogging:!1,DANGER_httpHost:null,DANGER_forceSaveCache:!1}}function yt(t){let e=new DocumentFragment;return e.createSpan({},n=>{n.innerHTML=t}),e}async function kg(t){return U=Object.assign({},go(t.app),await t.loadData()),_r.set(U.showExcerpt),mc(U.verboseLogging),U}async function ue(t){await t.saveData(U)}function $c(t){return t.loadLocalStorage(si)==="1"}function Wn(){return!G.Platform.isIosApp&&U.useCache}var G,_r,mo,Gc,U,Qc=x(()=>{G=_e(require("obsidian"));oc();Zt();ut();xi();_r=ka(!1),mo='Needs a restart to fully take effect.',Gc=class extends G.PluginSettingTab{constructor(e){super(e.app,e);this.plugin=e,_r.subscribe(async n=>{U.showExcerpt=n,await ue(this.plugin)})}display(){let{containerEl:e}=this,n=this.plugin.database,r=this.plugin.getTextExtractor(),s=Ti(async()=>{await n.clearCache()},1e3),i=this.plugin.getAIImageAnalyzer();if(e.empty(),this.app.loadLocalStorage(si)=="1"){let d=e.createEl("span");d.innerHTML='\u26A0\uFE0F OMNISEARCH IS DISABLED \u26A0\uFE0F'}e.createEl("h1",{text:"Omnisearch"});let a=e.createDiv();a.innerHTML=` + + Buy Me a Coffee at ko-fi.com + `,new G.Setting(e).setName("Indexing").setHeading().setDesc(yt(`\u26A0\uFE0F Changing indexing settings will clear the cache, and requires a restart of Obsidian.

+ ${r?`\u{1F44D} You have installed Text Extractor, Omnisearch can use it to index PDFs and images contents. +
Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:'\u26A0\uFE0F Omnisearch requires Text Extractor to index PDFs and images.'} + ${i?'
\u{1F44D} You have installed AI Image Analyzer, Omnisearch can use it to index images contents with ai.':'
\u26A0\uFE0F Omnisearch requires AI Image Analyzer to index images with ai.'}`)),new G.Setting(e).setName(`PDFs content indexing ${r?"":"\u26A0\uFE0F Disabled"}`).setDesc(yt("Omnisearch will use Text Extractor to index the content of your PDFs.")).addToggle(d=>d.setValue(U.PDFIndexing).onChange(async f=>{await n.clearCache(),U.PDFIndexing=f,await ue(this.plugin)})).setDisabled(!r),new G.Setting(e).setName(`Images OCR indexing ${r?"":"\u26A0\uFE0F Disabled"}`).setDesc(yt("Omnisearch will use Text Extractor to OCR your images and index their content.")).addToggle(d=>d.setValue(U.imagesIndexing).onChange(async f=>{await n.clearCache(),U.imagesIndexing=f,await ue(this.plugin)})).setDisabled(!r);let o=new DocumentFragment;o.createSpan({},d=>{d.innerHTML='Omnisearch will use Text Extractor to index the content of your office documents (currently
.docx
and
.xlsx
).'}),new G.Setting(e).setName(`Documents content indexing ${r?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(d=>d.setValue(U.officeIndexing).onChange(async f=>{await n.clearCache(),U.officeIndexing=f,await ue(this.plugin)})).setDisabled(!r);let c=new DocumentFragment;c.createSpan({},d=>{d.innerHTML="Omnisearch will use AI Image Analyzer to index the content of your images with ai."}),new G.Setting(e).setName(`Images AI indexing ${i?"":"\u26A0\uFE0F Disabled"}`).setDesc(c).addToggle(d=>d.setValue(U.aiImageIndexing).onChange(async f=>{await n.clearCache(),U.aiImageIndexing=f,await ue(this.plugin)})).setDisabled(!i),new G.Setting(e).setName("Index paths of unsupported files").setDesc(yt(` + Omnisearch can index filenames of "unsupported" files, such as e.g.
.mp4
+ or non-extracted PDFs & images.
+ "Obsidian setting" will respect the value of "Files & Links > Detect all file extensions".`)).addDropdown(d=>{d.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(U.unsupportedFilesIndexing).onChange(async f=>{await s(),U.unsupportedFilesIndexing=f,await ue(this.plugin)})}),new G.Setting(e).setName("Set frontmatter property key as title").setDesc(yt(`If you have a custom property in your notes that you want to use as the title in search results.
+ Leave empty to disable.`)).addText(d=>{d.setValue(U.displayTitle).onChange(async f=>{await s(),U.displayTitle=f,await ue(this.plugin)})}),new G.Setting(e).setName("Additional TEXT files to index").setDesc(yt(`In addition to standard md files, Omnisearch can also index other PLAINTEXT files.
+ Add extensions separated by a space, without the dot. Example: "txt org csv".
+ \u26A0\uFE0F Using extensions of non-plaintext files (like .pptx) WILL cause crashes, + because Omnisearch will try to index their content.`)).addText(d=>{d.setValue(U.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async f=>{await n.clearCache(),U.indexedFileTypes=f.split(" "),await ue(this.plugin)})}),new G.Setting(e).setName("Behavior").setHeading(),new G.Setting(e).setName("Save index to cache").setDesc("Enable caching to speed up indexing time. In rare cases, the cache write may cause a crash in Obsidian. This option will disable itself if it happens.").addToggle(d=>d.setValue(U.useCache).onChange(async f=>{U.useCache=f,await ue(this.plugin)})),new G.Setting(e).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(d=>d.setValue(U.showPreviousQueryResults).onChange(async f=>{U.showPreviousQueryResults=f,await ue(this.plugin)})),new G.Setting(e).setName(`Respect Obsidian's "Excluded Files"`).setDesc(`By default, files that are in Obsidian's "Options > Files & Links > Excluded Files" list are downranked in results. + Enable this option to completely hide them.`).addToggle(d=>d.setValue(U.hideExcluded).onChange(async f=>{U.hideExcluded=f,await ue(this.plugin)})),new G.Setting(e).setName("Folders to downrank in search results").setDesc("Folders to downrank in search results. Files in these folders will be downranked in results. They will still be indexed for tags, unlike excluded files. Folders should be comma delimited.").addText(d=>{d.setValue(U.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async f=>{let p=f.split(",");p=p.map(E=>E.trim()),U.downrankedFoldersFilters=p,await ue(this.plugin)})}),new G.Setting(e).setName("Split CamelCaseWords").setDesc(yt(`Enable this if you want to be able to search for CamelCaseWords as separate words.
+ \u26A0\uFE0F Changing this setting will clear the cache.
+ ${mo}`)).addToggle(d=>d.setValue(U.splitCamelCase).onChange(async f=>{await n.clearCache(),U.splitCamelCase=f,await ue(this.plugin)})),new G.Setting(e).setName("Simpler search").setDesc(`Enable this if Obsidian often freezes while making searches. + Words shorter than 3 characters won't be used as prefixes; this can reduce search delay but will return fewer results.`).addToggle(d=>d.setValue(U.simpleSearch).onChange(async f=>{U.simpleSearch=f,await ue(this.plugin)})),G.Platform.isIosApp||new G.Setting(e).setName("Tokenize URLs").setDesc(`Enable this if you want to be able to search for URLs as separate words. + This setting has a strong impact on indexing performance, and can crash Obsidian under certain conditions.`).addToggle(d=>d.setValue(U.tokenizeUrls).onChange(async f=>{U.tokenizeUrls=f,await ue(this.plugin)})),new G.Setting(e).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(d=>d.setValue(U.openInNewPane).onChange(async f=>{U.openInNewPane=f,await ue(this.plugin)})),new G.Setting(e).setName("Set Vim like navigation keys").setDesc("Navigate down the results with Ctrl/\u2318 + J/N, or navigate up with Ctrl/\u2318 + K/P").addToggle(d=>d.setValue(U.vimLikeNavigationShortcut).onChange(async f=>{U.vimLikeNavigationShortcut=f,await ue(this.plugin)})),new G.Setting(e).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(d=>d.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(U.fuzziness).onChange(async f=>{["0","1","2"].includes(f)||(f="2"),U.fuzziness=f,await ue(this.plugin)})),new G.Setting(e).setName("User Interface").setHeading(),new G.Setting(e).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(d=>d.setValue(U.ribbonIcon).onChange(async f=>{U.ribbonIcon=f,await ue(this.plugin),f?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new G.Setting(e).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(d=>d.setValue(U.showExcerpt).onChange(async f=>{_r.set(f)})),new G.Setting(e).setName("Show embed references").setDesc(yt(`Some results are embedded in other notes.
+ This setting controls the maximum number of embeds to show in the search results. Set to 0 to disable.
+ Also works with Text Extractor for embedded images and documents.`)).addSlider(d=>{d.setLimits(0,10,1).setValue(U.maxEmbeds).setDynamicTooltip().onChange(async f=>{U.maxEmbeds=f,await ue(this.plugin)})}),new G.Setting(e).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(d=>d.setValue(U.renderLineReturnInExcerpts).onChange(async f=>{U.renderLineReturnInExcerpts=f,await ue(this.plugin)})),new G.Setting(e).setName('Show "Create note" button').setDesc(yt(`Shows a button next to the search input, to create a note. + Acts the same as the shift \u21B5 shortcut, can be useful for mobile device users.`)).addToggle(d=>d.setValue(U.showCreateButton).onChange(async f=>{U.showCreateButton=f,await ue(this.plugin)})),new G.Setting(e).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(d=>d.setValue(U.highlight).onChange(async f=>{U.highlight=f,await ue(this.plugin)}));let l=go(this.app);new G.Setting(e).setName("Results weighting").setHeading(),new G.Setting(e).setName(`File name & declared aliases (default: ${l.weightBasename})`).addSlider(d=>this.weightSlider(d,"weightBasename")),new G.Setting(e).setName(`File directory (default: ${l.weightDirectory})`).addSlider(d=>this.weightSlider(d,"weightDirectory")),new G.Setting(e).setName(`Headings level 1 (default: ${l.weightH1})`).addSlider(d=>this.weightSlider(d,"weightH1")),new G.Setting(e).setName(`Headings level 2 (default: ${l.weightH2})`).addSlider(d=>this.weightSlider(d,"weightH2")),new G.Setting(e).setName(`Headings level 3 (default: ${l.weightH3})`).addSlider(d=>this.weightSlider(d,"weightH3")),new G.Setting(e).setName(`Tags (default: ${l.weightUnmarkedTags})`).addSlider(d=>this.weightSlider(d,"weightUnmarkedTags")),new G.Setting(e).setName("Header properties fields").setDesc('You can set custom weights for values of header properties (e.g. "keywords"). Weights under 1.0 will downrank the results.');for(let d=0;d{p.setPlaceholder("Property name").setValue(f.name).onChange(async E=>{f.name=E,await ue(this.plugin)})}).addSlider(p=>{p.setLimits(.1,5,.1).setValue(f.weight).setDynamicTooltip().onChange(async E=>{f.weight=E,await ue(this.plugin)})}).addButton(p=>{p.setButtonText("Remove"),p.onClick(async()=>{U.weightCustomProperties.splice(d,1),await ue(this.plugin),this.display()})})}new G.Setting(e).addButton(d=>{d.setButtonText("Add a new property"),d.onClick(f=>{U.weightCustomProperties.push({name:"",weight:1}),this.display()})}),G.Platform.isMobile||(new G.Setting(e).setName("API Access Through HTTP").setHeading().setDesc(yt('Omnisearch can be used through a simple HTTP server (more information).')),new G.Setting(e).setName("Enable the HTTP server").addToggle(d=>d.setValue(U.httpApiEnabled).onChange(async f=>{U.httpApiEnabled=f,f?this.plugin.apiHttpServer.listen(U.httpApiPort):this.plugin.apiHttpServer.close(),await ue(this.plugin)})),new G.Setting(e).setName("HTTP Port").addText(d=>{d.setValue(U.httpApiPort).setPlaceholder("51361").onChange(async f=>{parseInt(f)>65535&&(f=U.httpApiPort,d.setValue(U.httpApiPort)),U.httpApiPort=f,U.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(U.httpApiPort)),await ue(this.plugin)})}),new G.Setting(e).setName("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").addToggle(d=>d.setValue(U.httpApiNotice).onChange(async f=>{U.httpApiNotice=f,await ue(this.plugin)}))),new G.Setting(e).setName("Debugging").setHeading(),new G.Setting(e).setName("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(d=>d.setValue(U.verboseLogging).onChange(async f=>{U.verboseLogging=f,mc(f),await ue(this.plugin)})),new G.Setting(e).setName("Danger Zone").setHeading(),new G.Setting(e).setName("Ignore diacritics").setDesc(yt(`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".
+ \u26A0\uFE0F You probably should NOT disable this.
+ \u26A0\uFE0F Changing this setting will clear the cache.
+ ${mo}`)).addToggle(d=>d.setValue(U.ignoreDiacritics).onChange(async f=>{await n.clearCache(),U.ignoreDiacritics=f,await ue(this.plugin)})),new G.Setting(e).setName("Ignore Arabic diacritics (beta)").addToggle(d=>d.setValue(U.ignoreArabicDiacritics).onChange(async f=>{await n.clearCache(),U.ignoreArabicDiacritics=f,await ue(this.plugin)}));let h=new DocumentFragment;h.createSpan({},d=>{d.innerHTML=`Disable Omnisearch on this device only.
+ ${mo}`}),new G.Setting(e).setName("Disable on this device").setDesc(h).addToggle(d=>d.setValue($c(this.app)).onChange(async f=>{f?(this.app.saveLocalStorage(si,"1"),new G.Notice("Omnisearch - Disabled. Please restart Obsidian.")):(this.app.saveLocalStorage(si),new G.Notice("Omnisearch - Enabled. Please restart Obsidian."))})),new G.Setting(e).setName("Force save the cache").setDesc(yt(`Omnisearch has a security feature that automatically disables cache writing if it cannot fully perform the operation.
+ Use this option to force the cache to be saved, even if it causes a crash.
+ \u26A0\uFE0F Enabling this setting could lead to crash loops`)).addToggle(d=>d.setValue(U.DANGER_forceSaveCache).onChange(async f=>{U.DANGER_forceSaveCache=f,await ue(this.plugin)})),Wn()&&new G.Setting(e).setName("Clear cache data").setDesc(yt(`Erase all Omnisearch cache data. + Use this if Omnisearch results are inconsistent, missing, or appear outdated.
+ ${mo}`)).addButton(d=>{d.setButtonText("Clear cache"),d.onClick(async()=>{await n.clearCache()})})}weightSlider(e,n){e.setLimits(1,10,.5).setValue(U[n]).setDynamicTooltip().onChange(async r=>{U[n]=r,await ue(this.plugin)})}}});function gS(t){let e;return{c(){e=V("span"),e.innerHTML='',K(e,"class","suggestion-flair"),K(e,"aria-label","Not created yet, select to create")},m(n,r){re(n,e,r)},p:Se,i:Se,o:Se,d(n){n&&ne(e)}}}function bS(t){"use strict";return[]}var Rg,Lg,Pg=x(()=>{wt();Rg=class extends $e{constructor(e){super();et(this,e,bS,gS,qe,{})}},Lg=Rg});function Mg(t){let e,n;return e=new Lg({}),{c(){pt(e.$$.fragment)},m(r,s){ot(e,r,s),n=!0},i(r){n||(me(e.$$.fragment,r),n=!0)},o(r){xe(e.$$.fragment,r),n=!1},d(r){Je(e,r)}}}function _S(t){let e,n,r,s,i,a,o=t[2]&&Mg(t),c=t[5].default,l=Hr(c,t,t[4],null);return{c(){e=V("div"),o&&o.c(),n=ie(),l&&l.c(),K(e,"data-result-id",t[0]),K(e,"class",r="suggestion-item omnisearch-result "+t[3]),ec(e,"is-selected",t[1])},m(h,d){re(h,e,d),o&&o.m(e,null),j(e,n),l&&l.m(e,null),s=!0,i||(a=[Ge(e,"mousemove",t[6]),Ge(e,"click",t[7]),Ge(e,"keypress",t[8]),Ge(e,"auxclick",t[9])],i=!0)},p(h,[d]){h[2]?o?d&4&&me(o,1):(o=Mg(h),o.c(),me(o,1),o.m(e,n)):o&&(hr(),xe(o,1,1,()=>{o=null}),pr()),l&&l.p&&(!s||d&16)&&zr(l,c,h,h[4],s?Ur(c,h[4],d,null):Vr(h[4]),null),(!s||d&1)&&K(e,"data-result-id",h[0]),(!s||d&8&&r!==(r="suggestion-item omnisearch-result "+h[3]))&&K(e,"class",r),(!s||d&10)&&ec(e,"is-selected",h[1])},i(h){s||(me(o),me(l,h),s=!0)},o(h){xe(o),xe(l,h),s=!1},d(h){h&&ne(e),o&&o.d(),l&&l.d(h),i=!1,jt(a)}}}function ES(t,e,n){let{$$slots:r={},$$scope:s}=e,{id:i}=e,{selected:a=!1}=e,{glyph:o=!1}=e,{cssClass:c=""}=e;function l(p){Tt.call(this,t,p)}function h(p){Tt.call(this,t,p)}function d(p){Tt.call(this,t,p)}function f(p){Tt.call(this,t,p)}return t.$$set=p=>{"id"in p&&n(0,i=p.id),"selected"in p&&n(1,a=p.selected),"glyph"in p&&n(2,o=p.glyph),"cssClass"in p&&n(3,c=p.cssClass),"$$scope"in p&&n(4,s=p.$$scope)},[i,a,o,c,s,r,l,h,d,f]}var Fg,bo,Xc=x(()=>{wt();Pg();Fg=class extends $e{constructor(e){super();et(this,e,ES,_S,qe,{id:0,selected:1,glyph:2,cssClass:3})}},bo=Fg});function Jc(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}var Bg,Zc,el=x(()=>{Zt();ut();Bg=_e(require("obsidian"));xi();Zc=class{constructor(e){this.plugin=e}highlightText(e,n){let r=`suggestion-highlight omnisearch-highlight ${this.plugin.settings.highlight?"omnisearch-default-highlight":""}`;if(!n.length)return e;try{let s=new RegExp(n.map(o=>{let c=Yn(o.match);return`\\b${c}\\b${/[a-zA-Z]/.test(o.match)?"":`|${c}`}`}).join("|"),"giu"),i=o=>n.find(l=>o.match(new RegExp(`\\b${Yn(l.match)}\\b${/[a-zA-Z]/.test(l.match)?"":`|${Yn(l.match)}`}`,"giu")))?`${o}`:o,a=e.replace(s,i);if(a===e){let o=new RegExp(n.map(c=>Yn(c.match)).join("|"),"giu");a=e.replace(o,i)}return a}catch(s){return console.error("Omnisearch - Error in highlightText()",s),e}}stringsToRegex(e){if(!e.length)return/^$/g;e.sort((r,s)=>s.length-r.length);let n=`(${e.map(r=>`\\b${Yn(r)}\\b|${Yn(r)}`).join("|")})`;return new RegExp(`${n}`,"gui")}getMatches(e,n,r){let s=this.stringsToRegex(n),i=e;this.plugin.settings.ignoreDiacritics&&(e=un(e,this.plugin.settings.ignoreArabicDiacritics));let a=new Date().getTime(),o=null,c=[],l=0;for(;(o=s.exec(e))!==null;){if(++l>=100||new Date().getTime()-a>50){ln("Stopped getMatches at",l,"results");break}let h=o.index,d=h+o[0].length,f=i.substring(h,d).trim();f&&o.index>=0&&c.push({match:f,offset:o.index})}if(r&&(r.query.text.length>1||r.getExactTerms().length>0)){let h=e.indexOf(r.getBestStringForExcerpt());h>-1&&c.find(d=>d.offset===h)&&c.unshift({offset:h,match:r.getBestStringForExcerpt()})}return c}makeExcerpt(e,n){let r=this.plugin.settings;try{let s=n??-1,i=Math.max(0,s-bh),a=Math.min(e.length,s+ri);if(s>-1?e=(i>0?"\u2026":"")+e.slice(i,a).trim()+(al).join(` +`);let c=e.lastIndexOf(` +`,s-i);c>0&&(e=e.slice(c))}return e=Jc(e),r.renderLineReturnInExcerpts&&(e=e.trim().replaceAll(` +`,"
")),e}catch(s){return new Bg.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(s),""}}}});async function jg(t){let e=t.app;if(!e.plugins.getPlugin("obsidian-icon-folder"))return{};let r=`${e.vault.configDir}/plugins/obsidian-icon-folder/data.json`;try{let s=await e.vault.adapter.read(r),i=JSON.parse(s),a={};for(let o in i){let c=(0,ds.normalizePath)(o);a[c]=i[o]}return a}catch(s){return ln("Failed to read data.json:",s),{}}}async function Hg(t){let e={Li:"lucide-icons"},n="icons",r=t.app,s=r.plugins.getPlugin("obsidian-icon-folder");if(s){n=s.settings?.iconPacksPath||"icons";let a=`${r.vault.configDir}/${n}`;try{let o=await r.vault.adapter.list(a);if(o.folders&&o.folders.length>0)for(let c of o.folders){let l=c.split("/"),h=l[l.length-1],d=TS(h);e[d]=h}}catch(o){ln("Failed to list icon packs:",o)}}return{prefixToIconPack:e,iconsPath:n}}function TS(t){if(t.includes("-")){let e=t.split("-"),n=e[0].charAt(0).toUpperCase();for(let r=1;r${Jc(a)}`;let o=r[i];if(!o)return ln(`No icon pack found for prefix: ${i}`),null;if(o==="lucide-icons"){let c=a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),l=(0,ds.getIcon)(c);return l?l.outerHTML:(ln(`Lucide icon not found: ${c}`),null)}else{if(!n)return ln("Icons path is not set. Cannot load icon SVG."),null;let c=`${e.app.vault.configDir}/${n}/${o}/${a}.svg`;try{return await e.app.vault.adapter.read(c)}catch(l){return ln(`Failed to load icon SVG for ${t} at ${c}:`,l),null}}}function rl(t,e){let n="file";Jt(t)?n="image":en(t)?n="file-text":(cn(t)||Ma(t))&&(n="layout-dashboard");let r=(0,ds.getIcon)(n);return r?r.outerHTML:""}var ds,Ug=x(()=>{ds=_e(require("obsidian"));ut();el()});function yS(t){let e,n=t[8]&&zg(t);return{c(){n&&n.c(),e=lr()},m(r,s){n&&n.m(r,s),re(r,e,s)},p(r,s){r[8]?n?n.p(r,s):(n=zg(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(r){n&&n.d(r),r&&ne(e)}}}function AS(t){let e;return{c(){e=V("span"),K(e,"title","The document above is embedded in this note")},m(n,r){re(n,e,r),t[15](e)},p:Se,d(n){n&&ne(e),t[15](null)}}}function zg(t){let e,n,r,s;return{c(){e=V("span"),K(e,"class","omnisearch-result__icon")},m(i,a){re(i,e,a),r||(s=Zs(n=$g.call(null,e,t[8])),r=!0)},p(i,a){n&&on(n.update)&&a&256&&n.update.call(null,i[8])},d(i){i&&ne(e),r=!1,s()}}}function Vg(t){let e,n=t[1].matches.length+"",r,s,i=(t[1].matches.length>1?"matches":"match")+"",a;return{c(){e=V("span"),r=We(n),s=We("\xA0"),a=We(i),K(e,"class","omnisearch-result__counter")},m(o,c){re(o,e,c),j(e,r),j(e,s),j(e,a)},p(o,c){c&2&&n!==(n=o[1].matches.length+"")&&Xt(r,n),c&2&&i!==(i=(o[1].matches.length>1?"matches":"match")+"")&&Xt(a,i)},d(o){o&&ne(e)}}}function qg(t){let e,n,r,s=t[2].textProcessor.highlightText(t[4],t[11])+"",i=t[7]&&Kg(t);return{c(){e=V("div"),i&&i.c(),n=ie(),r=V("span"),K(e,"class","omnisearch-result__folder-path")},m(a,o){re(a,e,o),i&&i.m(e,null),j(e,n),j(e,r),r.innerHTML=s},p(a,o){a[7]?i?i.p(a,o):(i=Kg(a),i.c(),i.m(e,n)):i&&(i.d(1),i=null),o&2068&&s!==(s=a[2].textProcessor.highlightText(a[4],a[11])+"")&&(r.innerHTML=s)},d(a){a&&ne(e),i&&i.d()}}}function Kg(t){let e,n,r,s;return{c(){e=V("span"),K(e,"class","omnisearch-result__icon")},m(i,a){re(i,e,a),r||(s=Zs(n=$g.call(null,e,t[7])),r=!0)},p(i,a){n&&on(n.update)&&a&128&&n.update.call(null,i[7])},d(i){i&&ne(e),r=!1,s()}}}function Yg(t){let e,n,r=t[13]&&Wg(t),s=t[6]&&Gg(t);return{c(){e=V("div"),r&&r.c(),n=ie(),s&&s.c(),Et(e,"display","flex"),Et(e,"flex-direction","row")},m(i,a){re(i,e,a),r&&r.m(e,null),j(e,n),s&&s.m(e,null)},p(i,a){i[13]?r?r.p(i,a):(r=Wg(i),r.c(),r.m(e,n)):r&&(r.d(1),r=null),i[6]?s?s.p(i,a):(s=Gg(i),s.c(),s.m(e,null)):s&&(s.d(1),s=null)},d(i){i&&ne(e),r&&r.d(),s&&s.d()}}}function Wg(t){let e,n=t[2].textProcessor.highlightText(t[10],t[1].matches)+"";return{c(){e=V("div"),K(e,"class","omnisearch-result__body")},m(r,s){re(r,e,s),e.innerHTML=n},p(r,s){s&1030&&n!==(n=r[2].textProcessor.highlightText(r[10],r[1].matches)+"")&&(e.innerHTML=n)},d(r){r&&ne(e)}}}function Gg(t){let e,n,r;return{c(){e=V("div"),n=V("img"),Et(n,"width","100px"),Zu(n.src,r=t[6])||K(n,"src",r),K(n,"alt",""),K(e,"class","omnisearch-result__image-container")},m(s,i){re(s,e,i),j(e,n)},p(s,i){i&64&&!Zu(n.src,r=s[6])&&K(n,"src",r)},d(s){s&&ne(e)}}}function CS(t){let e,n,r,s,i,a=t[2].textProcessor.highlightText(t[3],t[12])+"",o,c,l,h=Fn(t[1].path)+"",d,f,p,E;function T(S,C){return S[1].isEmbed?AS:yS}let w=T(t,-1),m=w(t),I=t[1].matches.length>0&&Vg(t),A=t[4]&&qg(t),b=!t[1].isEmbed&&Yg(t);return{c(){e=V("div"),n=V("div"),r=V("span"),m.c(),s=ie(),i=V("span"),o=ie(),c=V("span"),l=We("."),d=We(h),f=ie(),I&&I.c(),p=ie(),A&&A.c(),E=ie(),b&&b.c(),K(c,"class","omnisearch-result__extension"),K(r,"class","omnisearch-result__title"),K(n,"class","omnisearch-result__title-container")},m(S,C){re(S,e,C),j(e,n),j(n,r),m.m(r,null),j(r,s),j(r,i),i.innerHTML=a,j(r,o),j(r,c),j(c,l),j(c,d),j(r,f),I&&I.m(r,null),j(e,p),A&&A.m(e,null),j(e,E),b&&b.m(e,null)},p(S,C){w===(w=T(S,C))&&m?m.p(S,C):(m.d(1),m=w(S),m&&(m.c(),m.m(r,s))),C&4108&&a!==(a=S[2].textProcessor.highlightText(S[3],S[12])+"")&&(i.innerHTML=a),C&2&&h!==(h=Fn(S[1].path)+"")&&Xt(d,h),S[1].matches.length>0?I?I.p(S,C):(I=Vg(S),I.c(),I.m(r,null)):I&&(I.d(1),I=null),S[4]?A?A.p(S,C):(A=qg(S),A.c(),A.m(e,E)):A&&(A.d(1),A=null),S[1].isEmbed?b&&(b.d(1),b=null):b?b.p(S,C):(b=Yg(S),b.c(),b.m(e,null))},d(S){S&&ne(e),m.d(),I&&I.d(),A&&A.d(),b&&b.d()}}}function SS(t){let e,n;return e=new bo({props:{glyph:t[9],id:t[1].path,cssClass:" "+(t[1].isEmbed?"omnisearch-result__embed":""),selected:t[0],$$slots:{default:[CS]},$$scope:{ctx:t}}}),e.$on("auxclick",t[16]),e.$on("click",t[17]),e.$on("mousemove",t[18]),{c(){pt(e.$$.fragment)},m(r,s){ot(e,r,s),n=!0},p(r,[s]){let i={};s&512&&(i.glyph=r[9]),s&2&&(i.id=r[1].path),s&2&&(i.cssClass=" "+(r[1].isEmbed?"omnisearch-result__embed":"")),s&1&&(i.selected=r[0]),s&33570302&&(i.$$scope={dirty:s,ctx:r}),e.$set(i)},i(r){n||(me(e.$$.fragment,r),n=!0)},o(r){xe(e.$$.fragment,r),n=!1},d(r){Je(e,r)}}}function $g(t,e){return t.innerHTML=e,{update(n){t.innerHTML=n},destroy(){t.innerHTML=""}}}function IS(t,e,n){let r,s,i,a,o;Na(t,_r,te=>n(13,o=te));let{selected:c=!1}=e,{note:l}=e,{plugin:h}=e,d=null,f="",p="",E={},T=null,w=null,m={},I,A=!1;fr(async()=>{E=await jg(h);let te=await Hg(h);m=te.prefixToIconPack,I=te.iconsPath,n(14,A=!0)});async function b(){let te=tl(p,E);te?n(7,T=await nl(te,h,I,m)):n(7,T=rl("folder",h));let X=tl(l.path,E);X?n(8,w=await nl(X,h,I,m)):n(8,w=rl(l.path,h))}let S,C,N;function O(te){Rn[te?"unshift":"push"](()=>{N=te,n(5,N)})}function L(te){Tt.call(this,t,te)}function z(te){Tt.call(this,t,te)}function W(te){Tt.call(this,t,te)}t.$$set=te=>{"selected"in te&&n(0,c=te.selected),"note"in te&&n(1,l=te.note),"plugin"in te&&n(2,h=te.plugin)},t.$$.update=()=>{if(t.$$.dirty&16386){e:l&&l.path&&A&&(async()=>{n(3,f=l.displayTitle||l.basename),n(4,p=fc(l.path)),await b()})()}if(t.$$.dirty&6){e:if(n(6,d=null),Jt(l.path)){let te=h.app.vault.getAbstractFileByPath(l.path);te instanceof hn.TFile&&n(6,d=h.app.vault.getResourcePath(te))}}if(t.$$.dirty&34){e:n(3,f=l.displayTitle||l.basename),n(4,p=fc(l.path)),S&&(0,hn.setIcon)(S,"folder-open"),C&&(Jt(l.path)?(0,hn.setIcon)(C,"image"):en(l.path)?(0,hn.setIcon)(C,"file-text"):cn(l.path)||Ma(l.path)?(0,hn.setIcon)(C,"layout-dashboard"):(0,hn.setIcon)(C,"file")),N&&(0,hn.setIcon)(N,"corner-down-right")}if(t.$$.dirty&14){e:n(12,r=h.textProcessor.getMatches(f,l.foundWords))}if(t.$$.dirty&22){e:n(11,s=h.textProcessor.getMatches(p,l.foundWords))}if(t.$$.dirty&6){e:n(10,i=h.textProcessor.makeExcerpt(l.content,l.matches[0]?.offset??-1))}};e:n(9,a=!1);return[c,l,h,f,p,N,d,T,w,a,i,s,r,o,A,O,L,z,W]}var hn,Qg,Xg,Zg=x(()=>{wt();Qc();ut();Xc();hn=_e(require("obsidian"));ni();Ug();Qg=class extends $e{constructor(e){super();et(this,e,IS,SS,qe,{selected:0,note:1,plugin:2})}},Xg=Qg});var Jg=kn(_o=>{_o.parse=function(t,e){if(e?e.offsets=typeof e.offsets=="undefined"?!0:e.offsets:e={offsets:!0},t||(t=""),t.indexOf(":")===-1&&!e.tokenize)return t;if(!e.keywords&&!e.ranges&&!e.tokenize)return t;var n={text:[]};e.offsets&&(n.offsets=[]);for(var r={},s=[],i=/(\S+:'(?:[^'\\]|\\.)*')|(\S+:"(?:[^"\\]|\\.)*")|(-?"(?:[^"\\]|\\.)*")|(-?'(?:[^'\\]|\\.)*')|\S+|\S+:\S+/g,a;(a=i.exec(t))!==null;){var f=a[0],o=f.indexOf(":");if(o!==-1){var c=f.split(":"),l=f.slice(0,o),h=f.slice(o+1);h=h.replace(/^\"|\"$|^\'|\'$/g,""),h=(h+"").replace(/\\(.?)/g,function(C,N){switch(N){case"\\":return"\\";case"0":return"\0";case"":return"";default:return N}}),s.push({keyword:l,value:h,offsetStart:a.index,offsetEnd:a.index+f.length})}else{var d=!1;f[0]==="-"&&(d=!0,f=f.slice(1)),f=f.replace(/^\"|\"$|^\'|\'$/g,""),f=(f+"").replace(/\\(.?)/g,function(C,N){switch(N){case"\\":return"\\";case"0":return"\0";case"":return"";default:return N}}),d?r.text?(r.text instanceof Array||(r.text=[r.text]),r.text.push(f)):r.text=f:s.push({text:f,offsetStart:a.index,offsetEnd:a.index+f.length})}}s.reverse();for(var f;f=s.pop();)if(f.text)n.text.push(f.text),e.offsets&&n.offsets.push(f);else{var l=f.keyword;e.keywords=e.keywords||[];var p=!1,E=!1;if(!/^-/.test(l))p=e.keywords.indexOf(l)!==-1;else if(l[0]==="-"){var T=l.slice(1);p=e.keywords.indexOf(T)!==-1,p&&(l=T,E=!0)}e.ranges=e.ranges||[];var w=e.ranges.indexOf(l)!==-1;if(p){e.offsets&&n.offsets.push({keyword:l,value:f.value,offsetStart:E?f.offsetStart+1:f.offsetStart,offsetEnd:f.offsetEnd});var m=f.value;if(m.length){var I=m.split(",");E?r[l]?r[l]instanceof Array?I.length>1?r[l]=r[l].concat(I):r[l].push(m):(r[l]=[r[l]],r[l].push(m)):I.length>1?r[l]=I:e.alwaysArray?r[l]=[m]:r[l]=m:n[l]?n[l]instanceof Array?I.length>1?n[l]=n[l].concat(I):n[l].push(m):(n[l]=[n[l]],n[l].push(m)):I.length>1?n[l]=I:e.alwaysArray?n[l]=[m]:n[l]=m}}else if(w){e.offsets&&n.offsets.push(f);var m=f.value,A=m.split("-");n[l]={},A.length===2?(n[l].from=A[0],n[l].to=A[1]):!A.length%2||(n[l].from=m)}else{var b=f.keyword+":"+f.value;n.text.push(b),e.offsets&&n.offsets.push({text:b,offsetStart:f.offsetStart,offsetEnd:f.offsetEnd})}}return n.text.length?e.tokenize||(n.text=n.text.join(" ").trim()):delete n.text,n.exclude=r,n};_o.stringify=function(t,e,n){if(e||(e={offsets:!0}),!t)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.join(" ");if(!Object.keys(t).length)return"";if(Object.keys(t).length===3&&!!t.text&&!!t.offsets&&!!t.exclude&&typeof t.text=="string")return t.text;n||(n="");var r=function(o){return o.indexOf(" ")>-1?JSON.stringify(o):o},s=function(o){return n+o},i=[];if(t.text){var a=[];typeof t.text=="string"?a.push(t.text):a.push.apply(a,t.text),a.length>0&&i.push(a.map(r).map(s).join(" "))}return e.keywords&&e.keywords.forEach(function(o){if(!!t[o]){var c=[];typeof t[o]=="string"?c.push(t[o]):c.push.apply(c,t[o]),c.length>0&&i.push(s(o+":"+c.map(r).join(",")))}}),e.ranges&&e.ranges.forEach(function(o){if(!!t[o]){var c=t[o].from,l=t[o].to;l&&(c=c+"-"+l),c&&i.push(s(o+":"+c))}}),t.exclude&&Object.keys(t.exclude).length>0&&i.push(_o.stringify(t.exclude,e,"-")),i.join(" ")}});var tb=kn((jF,eb)=>{eb.exports=Jg()});var nb,sl,Er,Eo=x(()=>{ut();nb=_e(tb()),sl=["ext","path"],Er=class{#e;constructor(e="",n){n.ignoreDiacritics&&(e=un(e,n.ignoreArabicDiacritics));let r=(0,nb.parse)(e.toLowerCase(),{tokenize:!0,keywords:sl});r.text=r.text??[],r.exclude=r.exclude??{},r.exclude.text=r.exclude.text??[],Array.isArray(r.exclude.text)||(r.exclude.text=[r.exclude.text]),r.exclude.text=r.exclude.text.filter(i=>i.length);for(let i of sl){let a=r[i];a&&(r[i]=Array.isArray(a)?a:[a]);let o=r.exclude[i];o&&(r.exclude[i]=Array.isArray(o)?o:[o])}this.query=r;let s=this.query.text.filter(i=>i.startsWith(".")).map(i=>i.slice(1));this.query.ext=[...new Set([...s,...this.query.ext??[]])],this.query.text=this.query.text.filter(i=>!i.startsWith(".")),this.#e=e.match(/"([^"]+)"/g)?.map(i=>i.replace(/"/g,""))??[]}isEmpty(){for(let e of sl)if(this.query[e]?.length||this.query.text.length)return!1;return!0}segmentsToStr(){return this.query.text.join(" ")}getTags(){return this.query.text.filter(e=>e.startsWith("#"))}getTagsWithoutHashtag(){return this.getTags().map(e=>e.replace(/^#/,""))}getExactTerms(){return[...new Set([...this.query.text.filter(e=>e.split(" ").length>1),...this.#e].map(e=>e.toLowerCase()))]}getBestStringForExcerpt(){return this.#e.length?this.#e.sort((e,n)=>n.length-e.length)[0]??"":this.segmentsToStr()}}});var rb=kn(To=>{function il(t){return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},il(t)}(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof To!="undefined")e(To);else{var n={exports:{}};e(n.exports),t.CancelablePromise=n.exports}})(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:To,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancelablePromise=void 0,t.cancelable=te,t.default=void 0,t.isCancelablePromise=X;function e(k,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function");k.prototype=Object.create(P&&P.prototype,{constructor:{value:k,writable:!0,configurable:!0}}),Object.defineProperty(k,"prototype",{writable:!1}),P&&n(k,P)}function n(k,P){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Z,oe){return Z.__proto__=oe,Z},n(k,P)}function r(k){var P=a();return function(){var Z=o(k),oe;if(P){var Ce=o(this).constructor;oe=Reflect.construct(Z,arguments,Ce)}else oe=Z.apply(this,arguments);return s(this,oe)}}function s(k,P){if(P&&(il(P)==="object"||typeof P=="function"))return P;if(P!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i(k)}function i(k){if(k===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k}function a(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function o(k){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(H){return H.__proto__||Object.getPrototypeOf(H)},o(k)}function c(k,P){var H=typeof Symbol!="undefined"&&k[Symbol.iterator]||k["@@iterator"];if(!H){if(Array.isArray(k)||(H=l(k))||P&&k&&typeof k.length=="number"){H&&(k=H);var Z=0,oe=function(){};return{s:oe,n:function(){return Z>=k.length?{done:!0}:{done:!1,value:k[Z++]}},e:function(Y){throw Y},f:oe}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Ce=!0,Ue=!1,sn;return{s:function(){H=H.call(k)},n:function(){var Y=H.next();return Ce=Y.done,Y},e:function(Y){Ue=!0,sn=Y},f:function(){try{!Ce&&H.return!=null&&H.return()}finally{if(Ue)throw sn}}}}function l(k,P){if(!!k){if(typeof k=="string")return h(k,P);var H=Object.prototype.toString.call(k).slice(8,-1);if(H==="Object"&&k.constructor&&(H=k.constructor.name),H==="Map"||H==="Set")return Array.from(k);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return h(k,P)}}function h(k,P){(P==null||P>k.length)&&(P=k.length);for(var H=0,Z=new Array(P);Hxe(i[h],1,1,()=>{i[h]=null});function o(h,d){if(!h[3].length&&h[2]&&!h[5])return DS;if(h[5])return vS}let c=o(t,[-1,-1]),l=c&&c(t);return{c(){for(let h=0;h\u2191\u2193to navigate',c=ie(),l=V("div"),l.innerHTML=`alt \u2191\u2193 + to cycle history`,h=ie(),d=V("div"),f=V("span"),p=We(t[8]),E=ie(),T=V("span"),T.textContent="to open",w=ie(),m=V("div"),m.innerHTML=`tab + to switch to In-File Search`,I=ie(),A=V("div"),b=V("span"),S=We(t[7]),C=ie(),N=V("span"),N.textContent="to open in a new pane",O=ie(),L=V("div"),z=V("span"),z.textContent=`${t[11]}`,W=ie(),te=V("span"),te.textContent="to open in a new split",X=ie(),ke=V("div"),ke.innerHTML=`alt o + to open in the background`,Le=ie(),ge=V("div"),Re=V("span"),k=We(t[10]),P=ie(),H=V("span"),H.textContent="to create",Z=ie(),oe=V("div"),Ce=V("span"),Ue=We(t[9]),sn=ie(),Ze=V("span"),Ze.textContent="to create in a new pane",Y=ie(),Be=V("div"),Be.innerHTML=`alt \u21B5 + to insert a link`,an=ie(),Bt=V("div"),Bt.innerHTML=`ctrl g + to toggle excerpts`,cr=ie(),jr=V("div"),jr.innerHTML='escto close',K(o,"class","prompt-instruction"),K(l,"class","prompt-instruction"),K(f,"class","prompt-instruction-command"),K(d,"class","prompt-instruction"),K(m,"class","prompt-instruction"),K(b,"class","prompt-instruction-command"),K(A,"class","prompt-instruction"),K(z,"class","prompt-instruction-command"),K(L,"class","prompt-instruction"),K(ke,"class","prompt-instruction"),K(Re,"class","prompt-instruction-command"),K(ge,"class","prompt-instruction"),K(Ce,"class","prompt-instruction-command"),K(oe,"class","prompt-instruction"),K(Be,"class","prompt-instruction"),K(Bt,"class","prompt-instruction"),K(jr,"class","prompt-instruction"),K(a,"class","prompt-instructions")},m(he,Pe){ot(e,he,Pe),re(he,n,Pe),ht&&ht.m(he,Pe),re(he,r,Pe),ot(s,he,Pe),re(he,i,Pe),re(he,a,Pe),j(a,o),j(a,c),j(a,l),j(a,h),j(a,d),j(d,f),j(f,p),j(d,E),j(d,T),j(a,w),j(a,m),j(a,I),j(a,A),j(A,b),j(b,S),j(A,C),j(A,N),j(a,O),j(a,L),j(L,z),j(L,W),j(L,te),j(a,X),j(a,ke),j(a,Le),j(a,ge),j(ge,Re),j(Re,k),j(ge,P),j(ge,H),j(a,Z),j(a,oe),j(oe,Ce),j(Ce,Ue),j(oe,sn),j(oe,Ze),j(a,Y),j(a,Be),j(a,an),j(a,Bt),j(a,cr),j(a,jr),On=!0},p(he,Pe){let Ia={};Pe[0]&1&&(Ia.plugin=he[0]),Pe[0]&4&&(Ia.initialValue=he[2]),Pe[0]&1|Pe[1]&4096&&(Ia.$$scope={dirty:Pe,ctx:he}),e.$set(Ia),he[4]?ht?ht.p(he,Pe):(ht=ob(he),ht.c(),ht.m(r.parentNode,r)):ht&&(ht.d(1),ht=null);let eh={};Pe[0]&47|Pe[1]&4096&&(eh.$$scope={dirty:Pe,ctx:he}),s.$set(eh),(!On||Pe[0]&256)&&Xt(p,he[8]),(!On||Pe[0]&128)&&Xt(S,he[7]),(!On||Pe[0]&1024)&&Xt(k,he[10]),(!On||Pe[0]&512)&&Xt(Ue,he[9])},i(he){On||(me(e.$$.fragment,he),me(s.$$.fragment,he),On=!0)},o(he){xe(e.$$.fragment,he),xe(s.$$.fragment,he),On=!1},d(he){t[19](null),Je(e,he),he&&ne(n),ht&&ht.d(he),he&&ne(r),Je(s,he),he&&ne(i),he&&ne(a)}}}function RS(t,e,n){let r,s;Na(t,Pn,Y=>n(18,s=Y));let{modal:i}=e,{previousQuery:a}=e,{plugin:o}=e,c=0,l=0,h,d=[],f,p="",E=!0,T,w,m,I,A,b=Mn()+" alt \u21B5";fr(async()=>{ae.enable("vault"),ae.on("vault",pe.Enter,W),ae.on("vault",pe.OpenInBackground,te),ae.on("vault",pe.CreateNote,k),ae.on("vault",pe.OpenInNewPane,X),ae.on("vault",pe.InsertLink,P),ae.on("vault",pe.Tab,H),ae.on("vault",pe.ArrowUp,()=>Z(-1)),ae.on("vault",pe.ArrowDown,()=>Z(1)),ae.on("vault",pe.PrevSearchHistory,S),ae.on("vault",pe.NextSearchHistory,C),ae.on("vault",pe.OpenInNewLeaf,ke),await o.notesIndexer.refreshIndex(),await L()}),ti(()=>{ae.disable("vault")});async function S(){let Y=(await o.searchHistory.getHistory()).filter(Be=>Be);++l>=Y.length&&(l=0),n(2,h=Y[l]),T?.setInputValue(h??"")}async function C(){let Y=(await o.searchHistory.getHistory()).filter(Be=>Be);--l<0&&(l=Y.length?Y.length-1:0),n(2,h=Y[l]),T?.setInputValue(h??"")}let N=null;async function O(){n(5,E=!0),N&&(N.cancel(),N=null),f=new Er(h,{ignoreDiacritics:o.settings.ignoreDiacritics,ignoreArabicDiacritics:o.settings.ignoreArabicDiacritics}),N=(0,sb.cancelable)(new Promise(Y=>{Y(o.searchEngine.getSuggestions(f))})),n(3,d=await N),n(1,c=0),await oe(),n(5,E=!1)}let L=Ti(O,0);function z(Y){!r||(Y?.ctrlKey?X():W(),i.close())}function W(){!r||(ge(r),i.close())}function te(){!r||ge(r,!0)}function X(){!r||(ge(r,!0),i.close())}function ke(){!r||(ge(r,!0,!0),i.close())}function Le(){h&&o.searchHistory.addToHistory(h)}function ge(Y,Be=!1,an=!1){Le();let Bt=Y.matches?.[0]?.offset??0;ja(o.app,Y,Bt,Be,an)}async function Re(Y){await k()}async function k(Y){if(h){try{await Dh(o.app,h,Y?.newLeaf)}catch(Be){new Kt.Notice(Be.message);return}i.close()}}function P(){if(!r)return;let Y=o.app.vault.getMarkdownFiles().find(jr=>jr.path===r.path),Be=o.app.workspace.getActiveFile(),an=o.app.workspace.getActiveViewOfType(Kt.MarkdownView);if(!an?.editor){new Kt.Notice("Omnisearch - Error - No active editor",3e3);return}let Bt;Y&&Be?Bt=o.app.fileManager.generateMarkdownLink(Y,Be.path):Bt=`[[${r.basename}.${Fn(r.path)}]]`;let cr=an.editor.getCursor();an.editor.replaceRange(Bt,cr,cr),cr.ch+=Bt.length,an.editor.setCursor(cr),i.close()}function H(){if(!(r&&(en(r?.path)||!r?.matches.length)))if(Le(),i.close(),r){let Y=o.app.vault.getAbstractFileByPath(r.path);Y&&Y instanceof Kt.TFile&&new hs(o,Y,h).open()}else{let Y=o.app.workspace.getActiveViewOfType(Kt.MarkdownView);Y?.file&&new hs(o,Y.file,h).open()}}function Z(Y){n(1,c=Pa(c+Y,d.length)),oe()}async function oe(){await Ln(),r&&activeWindow.document.querySelector(`[data-result-id="${r.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}function Ce(Y){Rn[Y?"unshift":"push"](()=>{T=Y,n(6,T)})}let Ue=Y=>n(2,h=Y.detail),sn=(Y,Be)=>n(1,c=Y),Ze=Y=>{Y.button==1&&X()};return t.$$set=Y=>{"modal"in Y&&n(16,i=Y.modal),"previousQuery"in Y&&n(17,a=Y.previousQuery),"plugin"in Y&&n(0,o=Y.plugin)},t.$$.update=()=>{if(t.$$.dirty[0]&131076){e:n(2,h=h??a)}if(t.$$.dirty[0]&4){e:h?L():(n(5,E=!1),n(3,d=[]))}if(t.$$.dirty[0]&10){e:r=d[c]}if(t.$$.dirty[0]&1){e:o.settings.openInNewPane?(n(7,w="\u21B5"),n(8,m=Mn()+" \u21B5"),n(9,I="shift \u21B5"),n(10,A=Mn()+" shift \u21B5")):(n(7,w=Mn()+" \u21B5"),n(8,m="\u21B5"),n(9,I=Mn()+" shift \u21B5"),n(10,A="shift \u21B5"))}if(t.$$.dirty[0]&262144){e:switch(s){case Nt.LoadingCache:n(4,p="Loading cache...");break;case Nt.ReadingFiles:n(4,p="Reading files...");break;case Nt.IndexingFiles:n(4,p="Indexing files...");break;case Nt.WritingCache:L(),n(4,p="Updating cache...");break;default:L(),n(4,p="");break}}},[o,c,h,d,p,E,T,w,m,I,A,b,z,X,Re,H,i,a,s,Ce,Ue,sn,Ze]}var Kt,sb,lb,fb,db,hb=x(()=>{wt();Kt=_e(require("obsidian"));ni();gc();bc();Zt();ci();ut();yi();Zg();Eo();sb=_e(rb());xi();lb=t=>t.length<3;fb=class extends $e{constructor(e){super();et(this,e,RS,kS,qe,{modal:16,previousQuery:17,plugin:0},null,[-1,-1])}},db=fb});function LS(t){let e,n=t[0].textProcessor.highlightText(t[4],t[1].matches)+"";return{c(){e=V("div"),K(e,"class","omnisearch-result__body")},m(r,s){re(r,e,s),e.innerHTML=n},p(r,s){s&19&&n!==(n=r[0].textProcessor.highlightText(r[4],r[1].matches)+"")&&(e.innerHTML=n)},d(r){r&&ne(e)}}}function PS(t){let e,n;return e=new bo({props:{id:t[2].toString(),selected:t[3],$$slots:{default:[LS]},$$scope:{ctx:t}}}),e.$on("auxclick",t[6]),e.$on("click",t[7]),e.$on("mousemove",t[8]),{c(){pt(e.$$.fragment)},m(r,s){ot(e,r,s),n=!0},p(r,[s]){let i={};s&4&&(i.id=r[2].toString()),s&8&&(i.selected=r[3]),s&531&&(i.$$scope={dirty:s,ctx:r}),e.$set(i)},i(r){n||(me(e.$$.fragment,r),n=!0)},o(r){xe(e.$$.fragment,r),n=!1},d(r){Je(e,r)}}}function MS(t,e,n){let r,{plugin:s}=e,{offset:i}=e,{note:a}=e,{index:o=0}=e,{selected:c=!1}=e;function l(f){Tt.call(this,t,f)}function h(f){Tt.call(this,t,f)}function d(f){Tt.call(this,t,f)}return t.$$set=f=>{"plugin"in f&&n(0,s=f.plugin),"offset"in f&&n(5,i=f.offset),"note"in f&&n(1,a=f.note),"index"in f&&n(2,o=f.index),"selected"in f&&n(3,c=f.selected)},t.$$.update=()=>{if(t.$$.dirty&35){e:n(4,r=s.textProcessor.makeExcerpt(a?.content??"",i))}},[s,a,o,c,r,i,l,h,d]}var pb,mb,gb=x(()=>{wt();Xc();pb=class extends $e{constructor(e){super();et(this,e,MS,PS,qe,{plugin:0,offset:5,note:1,index:2,selected:3})}},mb=pb});function bb(t,e,n){let r=t.slice();return r[20]=e[n],r[22]=n,r}function FS(t){let e,n,r;return{c(){e=V("button"),e.textContent="Vault search"},m(s,i){re(s,e,i),n||(r=Ge(e,"click",t[8]),n=!0)},p:Se,d(s){s&&ne(e),n=!1,r()}}}function BS(t){let e,n=Ai.Platform.isMobile&&FS(t);return{c(){e=V("div"),n&&n.c(),K(e,"class","omnisearch-input-container__buttons")},m(r,s){re(r,e,s),n&&n.m(e,null)},p(r,s){Ai.Platform.isMobile&&n.p(r,s)},d(r){r&&ne(e),n&&n.d()}}}function jS(t){let e;return{c(){e=V("div"),e.textContent="We found 0 result for your search here.",Et(e,"text-align","center")},m(n,r){re(n,e,r)},p:Se,i:Se,o:Se,d(n){n&&ne(e)}}}function HS(t){let e,n,r=t[5],s=[];for(let a=0;axe(s[a],1,1,()=>{s[a]=null});return{c(){for(let a=0;a{a[h]=null}),pr(),n=a[e],n?n.p(c,l):(n=a[e]=i[e](c),n.c()),me(n,1),n.m(r.parentNode,r))},i(c){s||(me(n),s=!0)},o(c){xe(n),s=!1},d(c){a[e].d(c),c&&ne(r)}}}function zS(t){let e;return{c(){e=V("span"),e.textContent="to close"},m(n,r){re(n,e,r)},d(n){n&&ne(e)}}}function VS(t){let e;return{c(){e=V("span"),e.textContent="to go back to Vault Search"},m(n,r){re(n,e,r)},d(n){n&&ne(e)}}}function qS(t){let e,n,r,s,i,a,o,c,l,h,d,f,p,E,T,w,m,I,A,b;e=new Fa({props:{plugin:t[0],placeholder:"Omnisearch - File",initialValue:t[2],$$slots:{default:[BS]},$$scope:{ctx:t}}}),e.$on("input",t[12]),r=new Ba({props:{$$slots:{default:[US]},$$scope:{ctx:t}}});function S(O,L){return O[1]?VS:zS}let C=S(t,-1),N=C(t);return{c(){pt(e.$$.fragment),n=ie(),pt(r.$$.fragment),s=ie(),i=V("div"),a=V("div"),a.innerHTML='\u2191\u2193to navigate',o=ie(),c=V("div"),c.innerHTML='\u21B5to open',l=ie(),h=V("div"),h.innerHTML=`tab + to switch to Vault Search`,d=ie(),f=V("div"),p=V("span"),p.textContent="esc",E=ie(),N.c(),T=ie(),w=V("div"),m=V("span"),m.textContent=`${Mn()} \u21B5`,I=ie(),A=V("span"),A.textContent="to open in a new pane",K(a,"class","prompt-instruction"),K(c,"class","prompt-instruction"),K(h,"class","prompt-instruction"),K(p,"class","prompt-instruction-command"),K(f,"class","prompt-instruction"),K(m,"class","prompt-instruction-command"),K(w,"class","prompt-instruction"),K(i,"class","prompt-instructions")},m(O,L){ot(e,O,L),re(O,n,L),ot(r,O,L),re(O,s,L),re(O,i,L),j(i,a),j(i,o),j(i,c),j(i,l),j(i,h),j(i,d),j(i,f),j(f,p),j(f,E),N.m(f,null),j(i,T),j(i,w),j(w,m),j(w,I),j(w,A),b=!0},p(O,[L]){let z={};L&1&&(z.plugin=O[0]),L&4&&(z.initialValue=O[2]),L&8388608&&(z.$$scope={dirty:L,ctx:O}),e.$set(z);let W={};L&8388721&&(W.$$scope={dirty:L,ctx:O}),r.$set(W),C!==(C=S(O,L))&&(N.d(1),N=C(O),N&&(N.c(),N.m(f,null)))},i(O){b||(me(e.$$.fragment,O),me(r.$$.fragment,O),b=!0)},o(O){xe(e.$$.fragment,O),xe(r.$$.fragment,O),b=!1},d(O){Je(e,O),O&&ne(n),Je(r,O),O&&ne(s),O&&ne(i),N.d()}}}function KS(t,e,n){let r=t.find(s=>s.offset>e);return r?t.filter(s=>s.offset>e&&s.offset<=r.offset+n):[]}function YS(t,e,n){let{plugin:r}=e,{modal:s}=e,{parent:i=null}=e,{singleFilePath:a=""}=e,{previousQuery:o}=e,c,l=[],h=0,d,f;fr(()=>{ae.enable("infile"),ae.on("infile",pe.Enter,m),ae.on("infile",pe.OpenInNewPane,w),ae.on("infile",pe.ArrowUp,()=>E(-1)),ae.on("infile",pe.ArrowDown,()=>E(1)),ae.on("infile",pe.Tab,I)}),ti(()=>{ae.disable("infile")});function p(N){let O=[],L=-1,z=0;for(;++z<100;){let W=KS(N,L,ri);if(!W.length)break;L=W.last().offset,O.push(W)}return O}function E(N){n(6,h=Pa(h+N,l.length)),T()}async function T(){await Ln(),document.querySelector(`[data-result-id="${h}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function w(){return m(!0)}async function m(N=!1){if(d){s.close(),i&&i.close();let O=r.textProcessor.stringsToRegex(d.foundWords);O.exec(d.content),await ja(r.app,d,O.lastIndex,N);let L=r.app.workspace.getActiveViewOfType(Ai.MarkdownView);if(!L)return;let z=l[h]??0,W=L.editor.offsetToPos(z);W.ch=0,L.editor.setCursor(W),L.editor.scrollIntoView({from:{line:W.line-10,ch:0},to:{line:W.line+10,ch:0}})}}function I(){new Gn(r,c??o).open(),s.close()}let A=N=>n(3,c=N.detail),b=(N,O)=>n(6,h=N),S=N=>m(N.ctrlKey),C=N=>{N.button==1&&m(!0)};return t.$$set=N=>{"plugin"in N&&n(0,r=N.plugin),"modal"in N&&n(9,s=N.modal),"parent"in N&&n(1,i=N.parent),"singleFilePath"in N&&n(10,a=N.singleFilePath),"previousQuery"in N&&n(2,o=N.previousQuery)},t.$$.update=()=>{if(t.$$.dirty&4){e:n(3,c=o??"")}if(t.$$.dirty&3081){e:(async()=>{c&&(n(11,f=new Er(c,{ignoreDiacritics:r.settings.ignoreDiacritics,ignoreArabicDiacritics:r.settings.ignoreArabicDiacritics})),n(4,d=(await r.searchEngine.getSuggestions(f,{singleFilePath:a}))[0]??null)),n(6,h=0),await T()})()}if(t.$$.dirty&2064){e:if(d){let N=p(d.matches),O=f.getExactTerms();O.length&&(N=N.filter(L=>O.every(z=>L.some(W=>W.match.includes(z))))),n(5,l=N.map(L=>Math.round(L.first().offset)))}}},[r,i,o,c,d,l,h,m,I,s,a,f,A,b,S,C]}var Ai,Eb,Tb,xb=x(()=>{wt();gc();Zt();ut();ni();Ai=_e(require("obsidian"));bc();yi();gb();Eo();ci();Eb=class extends $e{constructor(e){super();et(this,e,YS,qS,qe,{plugin:0,modal:9,parent:1,singleFilePath:10,previousQuery:2})}},Tb=Eb});var xo,al,Gn,hs,yi=x(()=>{xo=_e(require("obsidian"));hb();xb();Zt();al=class extends xo.Modal{constructor(e){super(e.app);let n=e.settings;this.modalEl.replaceChildren(),this.modalEl.addClass("omnisearch-modal","prompt"),this.modalEl.removeClass("modal"),this.modalEl.tabIndex=-1,this.scope.register([],"ArrowDown",c=>{c.preventDefault(),ae.emit(pe.ArrowDown)}),this.scope.register([],"ArrowUp",c=>{c.preventDefault(),ae.emit(pe.ArrowUp)});for(let c of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let l of["Ctrl","Mod"])this.scope.register([l],c.k,h=>{n.vimLikeNavigationShortcut&&ae.emit("arrow-"+c.dir)});for(let c of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let l of["Ctrl","Mod"])this.scope.register([l],c.k,h=>{n.vimLikeNavigationShortcut&&ae.emit("arrow-"+c.dir)});let r,s,i,a,o=["Mod","Alt"];n.openInNewPane?(r=["Mod"],s=[],i=["Mod","Shift"],a=["Shift"]):(r=[],s=["Mod"],i=["Shift"],a=["Mod","Shift"]),this.scope.register(s,"Enter",c=>{c.preventDefault(),ae.emit(pe.OpenInNewPane)}),this.scope.register(o,"Enter",c=>{c.preventDefault(),ae.emit(pe.OpenInNewLeaf)}),this.scope.register(["Alt"],"Enter",c=>{c.preventDefault(),ae.emit(pe.InsertLink)}),this.scope.register(i,"Enter",c=>{c.preventDefault(),ae.emit(pe.CreateNote)}),this.scope.register(a,"Enter",c=>{c.preventDefault(),ae.emit(pe.CreateNote,{newLeaf:!0})}),this.scope.register(r,"Enter",c=>{cc()||(c.preventDefault(),ae.emit(pe.Enter))}),this.scope.register(["Ctrl"],"O",c=>{cc()||(c.preventDefault(),ae.emit(pe.OpenInBackground))}),this.scope.register([],"Tab",c=>{c.preventDefault(),ae.emit(pe.Tab)}),this.scope.register(["Alt"],"ArrowDown",c=>{c.preventDefault(),ae.emit(pe.NextSearchHistory)}),this.scope.register(["Alt"],"ArrowUp",c=>{c.preventDefault(),ae.emit(pe.PrevSearchHistory)}),this.scope.register(["Ctrl"],"G",c=>{ae.emit(Ra.ToggleExcerpts)})}},Gn=class extends al{constructor(e,n){super(e);let r=e.app.workspace.getActiveViewOfType(xo.MarkdownView)?.editor.getSelection();e.searchHistory.getHistory().then(s=>{let i=e.settings.showPreviousQueryResults?s[0]:null,a=new db({target:this.modalEl,props:{plugin:e,modal:this,previousQuery:n||r||i||""}});this.onClose=()=>{a.$destroy()}})}},hs=class extends al{constructor(e,n,r="",s){super(e);let i=new Tb({target:this.modalEl,props:{plugin:e,modal:this,singleFilePath:n.path,parent:s,previousQuery:r}});s&&s.containerEl.toggleVisibility(!1),this.onClose=()=>{s&&s.containerEl.toggleVisibility(!0),i.$destroy()}}}});function WS(t,e){return e.map(n=>{let{score:r,path:s,basename:i,foundWords:a,matches:o,content:c}=n,l=t.textProcessor.makeExcerpt(c,o[0]?.offset??-1);return{score:r,vault:t.app.vault.getName(),path:s,basename:i,foundWords:a,matches:o.map(d=>({match:d.match,offset:d.offset})),excerpt:l}})}function Ab(){yb=!0,yo.forEach(t=>t())}function Sb(t){if(Cb)return;Cb=!0,t.registerObsidianProtocolHandler("omnisearch",n=>{new Gn(t,n.query).open()});let e=ol(t);globalThis.omnisearch=e,t.app.plugins.plugins.omnisearch.api=e}function ol(t){return{async search(e){let n=new Er(e,{ignoreDiacritics:t.settings.ignoreDiacritics,ignoreArabicDiacritics:t.settings.ignoreArabicDiacritics}),r=await t.searchEngine.getSuggestions(n);return WS(t,r)},registerOnIndexed(e){yo.push(e),yb&&e()},unregisterOnIndexed(e){yo=yo.filter(n=>n!==e)},refreshIndex:t.notesIndexer.refreshIndex}}var yb,yo,Cb,ul=x(()=>{Eo();yi();yb=!1,yo=[];Cb=!1});var K1=kn(Ie=>{"use strict";function Xo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}Ie.defaults=Xo();function D1(t){Ie.defaults=t}var O1=/[&<>"']/,wI=new RegExp(O1.source,"g"),k1=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,NI=new RegExp(k1.source,"g"),vI={"&":"&","<":"<",">":">",'"':""","'":"'"},R1=t=>vI[t];function St(t,e){if(e){if(O1.test(t))return t.replace(wI,R1)}else if(k1.test(t))return t.replace(NI,R1);return t}var DI=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function OI(t){return t.replace(DI,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}var kI=/(^|[^\[])\^/g;function Ee(t,e){let n=typeof t=="string"?t:t.source;e=e||"";let r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(kI,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,e)};return r}function L1(t){try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}var qi={exec:()=>null};function P1(t,e){let n=t.replace(/\|/g,(i,a,o)=>{let c=!1,l=a;for(;--l>=0&&o[l]==="\\";)c=!c;return c?"|":" |"}),r=n.split(/ \|/),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length{let i=s.match(/^\s+/);if(i===null)return s;let[a]=i;return a.length>=r.length?s.slice(r.length):s}).join(` +`)}var Is=class{options;rules;lexer;constructor(e){this.options=e||Ie.defaults}space(e){let n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){let n=this.rules.block.code.exec(e);if(n){let r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Zo(r,` +`)}}}fences(e){let n=this.rules.block.fences.exec(e);if(n){let r=n[0],s=LI(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:s}}}heading(e){let n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(/#$/.test(r)){let s=Zo(r,"#");(this.options.pedantic||!s||/ $/.test(s))&&(r=s.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){let n=this.rules.block.blockquote.exec(e);if(n){let r=n[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,` + $1`);r=Zo(r.replace(/^ *>[ \t]?/gm,""),` +`);let s=this.lexer.state.top;this.lexer.state.top=!0;let i=this.lexer.blockTokens(r);return this.lexer.state.top=s,{type:"blockquote",raw:n[0],tokens:i,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r=n[1].trim(),s=r.length>1,i={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let a=new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),o="",c="",l=!1;for(;e;){let h=!1;if(!(n=a.exec(e))||this.rules.block.hr.test(e))break;o=n[0],e=e.substring(o.length);let d=n[2].split(` +`,1)[0].replace(/^\t+/,m=>" ".repeat(3*m.length)),f=e.split(` +`,1)[0],p=0;this.options.pedantic?(p=2,c=d.trimStart()):(p=n[2].search(/[^ ]/),p=p>4?1:p,c=d.slice(p),p+=n[1].length);let E=!1;if(!d&&/^ *$/.test(f)&&(o+=f+` +`,e=e.substring(f.length+1),h=!0),!h){let m=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),I=new RegExp(`^ {0,${Math.min(3,p-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),A=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:\`\`\`|~~~)`),b=new RegExp(`^ {0,${Math.min(3,p-1)}}#`);for(;e;){let S=e.split(` +`,1)[0];if(f=S,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),A.test(f)||b.test(f)||m.test(f)||I.test(e))break;if(f.search(/[^ ]/)>=p||!f.trim())c+=` +`+f.slice(p);else{if(E||d.search(/[^ ]/)>=4||A.test(d)||b.test(d)||I.test(d))break;c+=` +`+f}!E&&!f.trim()&&(E=!0),o+=S+` +`,e=e.substring(S.length+1),d=f.slice(p)}}i.loose||(l?i.loose=!0:/\n *\n *$/.test(o)&&(l=!0));let T=null,w;this.options.gfm&&(T=/^\[[ xX]\] /.exec(c),T&&(w=T[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:o,task:!!T,checked:w,loose:!1,text:c,tokens:[]}),i.raw+=o}i.items[i.items.length-1].raw=o.trimEnd(),i.items[i.items.length-1].text=c.trimEnd(),i.raw=i.raw.trimEnd();for(let h=0;hp.type==="space"),f=d.length>0&&d.some(p=>/\n.*\n/.test(p.raw));i.loose=f}if(i.loose)for(let h=0;h$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:s,title:i}}}table(e){let n=this.rules.block.table.exec(e);if(!n||!/[:|]/.test(n[2]))return;let r=P1(n[1]),s=n[2].replace(/^\||\| *$/g,"").split("|"),i=n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(` +`):[],a={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let o of s)/^ *-+: *$/.test(o)?a.align.push("right"):/^ *:-+: *$/.test(o)?a.align.push("center"):/^ *:-+ *$/.test(o)?a.align.push("left"):a.align.push(null);for(let o of r)a.header.push({text:o,tokens:this.lexer.inline(o)});for(let o of i)a.rows.push(P1(o,a.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return a}}lheading(e){let n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){let n=this.rules.block.paragraph.exec(e);if(n){let r=n[1].charAt(n[1].length-1)===` +`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){let n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:St(n[1])}}tag(e){let n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&/^/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){let n=this.rules.inline.link.exec(e);if(n){let r=n[2].trim();if(!this.options.pedantic&&/^$/.test(r))return;let a=Zo(r.slice(0,-1),"\\");if((r.length-a.length)%2==0)return}else{let a=RI(n[2],"()");if(a>-1){let c=(n[0].indexOf("!")===0?5:4)+n[1].length+a;n[2]=n[2].substring(0,a),n[0]=n[0].substring(0,c).trim(),n[3]=""}}let s=n[2],i="";if(this.options.pedantic){let a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);a&&(s=a[1],i=a[3])}else i=n[3]?n[3].slice(1,-1):"";return s=s.trim(),/^$/.test(r)?s=s.slice(1):s=s.slice(1,-1)),M1(n,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(/\s+/g," "),i=n[s.toLowerCase()];if(!i){let a=r[0].charAt(0);return{type:"text",raw:a,text:a}}return M1(r,i,r[0],this.lexer)}}emStrong(e,n,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let a=[...s[0]].length-1,o,c,l=a,h=0,d=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,n=n.slice(-1*e.length+a);(s=d.exec(n))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(c=[...o].length,s[3]||s[4]){l+=c;continue}else if((s[5]||s[6])&&a%3&&!((a+c)%3)){h+=c;continue}if(l-=c,l>0)continue;c=Math.min(c,c+l+h);let f=[...s[0]][0].length,p=e.slice(0,a+s.index+f+c);if(Math.min(a,c)%2){let T=p.slice(1,-1);return{type:"em",raw:p,text:T,tokens:this.lexer.inlineTokens(T)}}let E=p.slice(2,-2);return{type:"strong",raw:p,text:E,tokens:this.lexer.inlineTokens(E)}}}}codespan(e){let n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(/\n/g," "),s=/[^ ]/.test(r),i=/^ /.test(r)&&/ $/.test(r);return s&&i&&(r=r.substring(1,r.length-1)),r=St(r,!0),{type:"codespan",raw:n[0],text:r}}}br(e){let n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){let n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){let n=this.rules.inline.autolink.exec(e);if(n){let r,s;return n[2]==="@"?(r=St(n[1]),s="mailto:"+r):(r=St(n[1]),s=r),{type:"link",raw:n[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let r,s;if(n[2]==="@")r=St(n[0]),s="mailto:"+r;else{let i;do i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(i!==n[0]);r=St(n[0]),n[1]==="www."?s="http://"+n[0]:s=n[0]}return{type:"link",raw:n[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let n=this.rules.inline.text.exec(e);if(n){let r;return this.lexer.state.inRawBlock?r=n[0]:r=St(n[0]),{type:"text",raw:n[0],text:r}}}},PI=/^(?: *(?:\n|$))+/,MI=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,FI=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ki=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,BI=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,F1=/(?:[*+-]|\d{1,9}[.)])/,B1=Ee(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,F1).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),hf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,jI=/^[^\n]+/,pf=/(?!\s*\])(?:\\.|[^\[\]\\])+/,HI=Ee(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",pf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),UI=Ee(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,F1).getRegex(),Jo="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",mf=/|$))/,zI=Ee("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",mf).replace("tag",Jo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),j1=Ee(hf).replace("hr",Ki).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Jo).getRegex(),VI=Ee(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",j1).getRegex(),gf={blockquote:VI,code:MI,def:HI,fences:FI,heading:BI,hr:Ki,html:zI,lheading:B1,list:UI,newline:PI,paragraph:j1,table:qi,text:jI},H1=Ee("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ki).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Jo).getRegex(),qI=ce(B({},gf),{table:H1,paragraph:Ee(hf).replace("hr",Ki).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",H1).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Jo).getRegex()}),KI=ce(B({},gf),{html:Ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",mf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:qi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ee(hf).replace("hr",Ki).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",B1).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),U1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,YI=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,z1=/^( {2,}|\\)\n(?!\s*$)/,WI=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,QI=Ee(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Yi).getRegex(),XI=Ee("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Yi).getRegex(),ZI=Ee("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Yi).getRegex(),JI=Ee(/\\([punct])/,"gu").replace(/punct/g,Yi).getRegex(),ew=Ee(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),tw=Ee(mf).replace("(?:-->|$)","-->").getRegex(),nw=Ee("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",tw).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),eu=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,rw=Ee(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",eu).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),V1=Ee(/^!?\[(label)\]\[(ref)\]/).replace("label",eu).replace("ref",pf).getRegex(),q1=Ee(/^!?\[(ref)\](?:\[\])?/).replace("ref",pf).getRegex(),sw=Ee("reflink|nolink(?!\\()","g").replace("reflink",V1).replace("nolink",q1).getRegex(),bf={_backpedal:qi,anyPunctuation:JI,autolink:ew,blockSkip:$I,br:z1,code:YI,del:qi,emStrongLDelim:QI,emStrongRDelimAst:XI,emStrongRDelimUnd:ZI,escape:U1,link:rw,nolink:q1,punctuation:GI,reflink:V1,reflinkSearch:sw,tag:nw,text:WI,url:qi},iw=ce(B({},bf),{link:Ee(/^!?\[(label)\]\((.*?)\)/).replace("label",eu).getRegex(),reflink:Ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",eu).getRegex()}),_f=ce(B({},bf),{escape:Ee(U1).replace("])","~|])").getRegex(),url:Ee(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\c+" ".repeat(l.length));let r,s,i,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>(r=o.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length),r.raw.length===1&&n.length>0?n[n.length-1].raw+=` +`:n.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=` +`+r.raw,s.text+=` +`+r.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):n.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=` +`+r.raw,s.text+=` +`+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(i=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0,c=e.slice(1),l;this.options.extensions.startBlock.forEach(h=>{l=h.call({lexer:this},c),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(i=e.substring(0,o+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){s=n[n.length-1],a&&s.type==="paragraph"?(s.raw+=` +`+r.raw,s.text+=` +`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):n.push(r),a=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&s.type==="text"?(s.raw+=` +`+r.raw,s.text+=` +`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):n.push(r);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r,s,i,a=e,o,c,l;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)h.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(l=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(r=h.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&r.type==="text"&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length),s=n[n.length-1],s&&r.type==="text"&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(e,a,l)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),n.push(r);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0,d=e.slice(1),f;this.options.extensions.startInline.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(h=Math.min(h,f))}),h<1/0&&h>=0&&(i=e.substring(0,h+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(l=r.raw.slice(-1)),c=!0,s=n[n.length-1],s&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},ws=class{options;constructor(e){this.options=e||Ie.defaults}code(e,n,r){let s=(n||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+` +`,s?'
'+(r?e:St(e,!0))+`
+`:"
"+(r?e:St(e,!0))+`
+`}blockquote(e){return`
+${e}
+`}html(e,n){return e}heading(e,n,r){return`${e} +`}hr(){return`
+`}list(e,n,r){let s=n?"ol":"ul",i=n&&r!==1?' start="'+r+'"':"";return"<"+s+i+`> +`+e+" +`}listitem(e,n,r){return`
  • ${e}
  • +`}checkbox(e){return"'}paragraph(e){return`

    ${e}

    +`}table(e,n){return n&&(n=`${n}`),` + +`+e+` +`+n+`
    +`}tablerow(e){return` +${e} +`}tablecell(e,n){let r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+` +`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
    "}del(e){return`${e}`}link(e,n,r){let s=L1(e);if(s===null)return r;e=s;let i='
    ",i}image(e,n,r){let s=L1(e);if(s===null)return r;e=s;let i=`${r}0&&f.tokens[0].type==="paragraph"?(f.tokens[0].text=w+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&f.tokens[0].tokens[0].type==="text"&&(f.tokens[0].tokens[0].text=w+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:w+" "}):T+=w+" "}T+=this.parse(f.tokens,l),h+=this.renderer.listitem(T,E,!!p)}r+=this.renderer.list(h,o,c);continue}case"html":{let a=i;r+=this.renderer.html(a.text,a.block);continue}case"paragraph":{let a=i;r+=this.renderer.paragraph(this.parseInline(a.tokens));continue}case"text":{let a=i,o=a.tokens?this.parseInline(a.tokens):a.text;for(;s+1{let o=i[a].flat(1/0);r=r.concat(this.walkTokens(o,n))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,n)))}}return r}use(...e){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s=B({},r);if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=n.renderers[i.name];a?n.renderers[i.name]=function(...o){let c=i.renderer.apply(this,o);return c===!1&&(c=a.apply(this,o)),c}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=n[i.level];a?a.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),s.extensions=n),r.renderer){let i=this.defaults.renderer||new ws(this.defaults);for(let a in r.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(a==="options")continue;let o=a,c=r.renderer[o],l=i[o];i[o]=(...h)=>{let d=c.apply(i,h);return d===!1&&(d=l.apply(i,h)),d||""}}s.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new Is(this.defaults);for(let a in r.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,c=r.tokenizer[o],l=i[o];i[o]=(...h)=>{let d=c.apply(i,h);return d===!1&&(d=l.apply(i,h)),d}}s.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new wr;for(let a in r.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(a==="options")continue;let o=a,c=r.hooks[o],l=i[o];wr.passThroughHooks.has(a)?i[o]=h=>{if(this.defaults.async)return Promise.resolve(c.call(i,h)).then(f=>l.call(i,f));let d=c.call(i,h);return l.call(i,d)}:i[o]=(...h)=>{let d=c.apply(i,h);return d===!1&&(d=l.apply(i,h)),d}}s.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,a=r.walkTokens;s.walkTokens=function(o){let c=[];return c.push(a.call(this,o)),i&&(c=c.concat(i.call(this,o))),c}}this.defaults=B(B({},this.defaults),s)}),this}setOptions(e){return this.defaults=B(B({},this.defaults),e),this}lexer(e,n){return vt.lex(e,n??this.defaults)}parser(e,n){return Dt.parse(e,n??this.defaults)}#e(e,n){return(r,s)=>{let i=B({},s),a=B(B({},this.defaults),i);this.defaults.async===!0&&i.async===!1&&(a.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),a.async=!0);let o=this.#t(!!a.silent,!!a.async);if(typeof r=="undefined"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(r):r).then(c=>e(c,a)).then(c=>a.hooks?a.hooks.processAllTokens(c):c).then(c=>a.walkTokens?Promise.all(this.walkTokens(c,a.walkTokens)).then(()=>c):c).then(c=>n(c,a)).then(c=>a.hooks?a.hooks.postprocess(c):c).catch(o);try{a.hooks&&(r=a.hooks.preprocess(r));let c=e(r,a);a.hooks&&(c=a.hooks.processAllTokens(c)),a.walkTokens&&this.walkTokens(c,a.walkTokens);let l=n(c,a);return a.hooks&&(l=a.hooks.postprocess(l)),l}catch(c){return o(c)}}}#t(e,n){return r=>{if(r.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let s="

    An error occurred:

    "+St(r.message+"",!0)+"
    ";return n?Promise.resolve(s):s}if(n)return Promise.reject(r);throw r}}},Nr=new Ef;function be(t,e){return Nr.parse(t,e)}be.options=be.setOptions=function(t){return Nr.setOptions(t),be.defaults=Nr.defaults,D1(be.defaults),be};be.getDefaults=Xo;be.defaults=Ie.defaults;be.use=function(...t){return Nr.use(...t),be.defaults=Nr.defaults,D1(be.defaults),be};be.walkTokens=function(t,e){return Nr.walkTokens(t,e)};be.parseInline=Nr.parseInline;be.Parser=Dt;be.parser=Dt.parse;be.Renderer=ws;be.TextRenderer=Gi;be.Lexer=vt;be.lexer=vt.lex;be.Tokenizer=Is;be.Hooks=wr;be.parse=be;var ow=be.options,uw=be.setOptions,cw=be.use,lw=be.walkTokens,fw=be.parseInline,dw=be,hw=Dt.parse,pw=vt.lex;Ie.Hooks=wr;Ie.Lexer=vt;Ie.Marked=Ef;Ie.Parser=Dt;Ie.Renderer=ws;Ie.TextRenderer=Gi;Ie.Tokenizer=Is;Ie.getDefaults=Xo;Ie.lexer=pw;Ie.marked=be;Ie.options=ow;Ie.parse=dw;Ie.parseInline=fw;Ie.parser=hw;Ie.setOptions=uw;Ie.use=cw;Ie.walkTokens=lw});function Y1(t){return t.type===de.Tag||t.type===de.Script||t.type===de.Style}var de,W1,G1,$1,Q1,X1,Z1,J1,e_,t_,Ns=x(()=>{(function(t){t.Root="root",t.Text="text",t.Directive="directive",t.Comment="comment",t.Script="script",t.Style="style",t.Tag="tag",t.CDATA="cdata",t.Doctype="doctype"})(de||(de={}));W1=de.Root,G1=de.Text,$1=de.Directive,Q1=de.Comment,X1=de.Script,Z1=de.Style,J1=de.Tag,e_=de.CDATA,t_=de.Doctype});function $(t){return Y1(t)}function ks(t){return t.type===de.CDATA}function gt(t){return t.type===de.Text}function vr(t){return t.type===de.Comment}function iu(t){return t.type===de.Directive}function kt(t){return t.type===de.Root}function De(t){return Object.prototype.hasOwnProperty.call(t,"children")}function Rs(t,e=!1){let n;if(gt(t))n=new yn(t.data);else if(vr(t))n=new vs(t.data);else if($(t)){let r=e?xf(t.children):[],s=new Os(t.name,B({},t.attribs),r);r.forEach(i=>i.parent=s),t.namespace!=null&&(s.namespace=t.namespace),t["x-attribsNamespace"]&&(s["x-attribsNamespace"]=B({},t["x-attribsNamespace"])),t["x-attribsPrefix"]&&(s["x-attribsPrefix"]=B({},t["x-attribsPrefix"])),n=s}else if(ks(t)){let r=e?xf(t.children):[],s=new su(r);r.forEach(i=>i.parent=s),n=s}else if(kt(t)){let r=e?xf(t.children):[],s=new Ot(r);r.forEach(i=>i.parent=s),t["x-mode"]&&(s["x-mode"]=t["x-mode"]),n=s}else if(iu(t)){let r=new Ds(t.name,t.data);t["x-name"]!=null&&(r["x-name"]=t["x-name"],r["x-publicId"]=t["x-publicId"],r["x-systemId"]=t["x-systemId"]),n=r}else throw new Error(`Not implemented yet: ${t.type}`);return n.startIndex=t.startIndex,n.endIndex=t.endIndex,t.sourceCodeLocation!=null&&(n.sourceCodeLocation=t.sourceCodeLocation),n}function xf(t){let e=t.map(n=>Rs(n,!0));for(let n=1;n{Ns();Tf=class{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return Rs(this,e)}},nu=class extends Tf{constructor(e){super();this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},yn=class extends nu{constructor(){super(...arguments);this.type=de.Text}get nodeType(){return 3}},vs=class extends nu{constructor(){super(...arguments);this.type=de.Comment}get nodeType(){return 8}},Ds=class extends nu{constructor(e,n){super(n);this.name=e,this.type=de.Directive}get nodeType(){return 1}},ru=class extends Tf{constructor(e){super();this.children=e}get firstChild(){var e;return(e=this.children[0])!==null&&e!==void 0?e:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},su=class extends ru{constructor(){super(...arguments);this.type=de.CDATA}get nodeType(){return 4}},Ot=class extends ru{constructor(){super(...arguments);this.type=de.Root}get nodeType(){return 9}},Os=class extends ru{constructor(e,n,r=[],s=e==="script"?de.Script:e==="style"?de.Style:de.Tag){super(r);this.name=e,this.attribs=n,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>{var n,r;return{name:e,value:this.attribs[e],namespace:(n=this["x-attribsNamespace"])===null||n===void 0?void 0:n[e],prefix:(r=this["x-attribsPrefix"])===null||r===void 0?void 0:r[e]}})}}});var n_,$i,Qe=x(()=>{Ns();yf();yf();n_={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},$i=class{constructor(e,n,r){this.dom=[],this.root=new Ot(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof n=="function"&&(r=n,n=n_),typeof e=="object"&&(n=e,e=void 0),this.callback=e??null,this.options=n??n_,this.elementCB=r??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new Ot(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;let e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,n){let r=this.options.xmlMode?de.Tag:void 0,s=new Os(e,n,void 0,r);this.addNode(s),this.tagStack.push(s)}ontext(e){let{lastNode:n}=this;if(n&&n.type===de.Text)n.data+=e,this.options.withEndIndices&&(n.endIndex=this.parser.endIndex);else{let r=new yn(e);this.addNode(r),this.lastNode=r}}oncomment(e){if(this.lastNode&&this.lastNode.type===de.Comment){this.lastNode.data+=e;return}let n=new vs(e);this.addNode(n),this.lastNode=n}oncommentend(){this.lastNode=null}oncdatastart(){let e=new yn(""),n=new su([e]);this.addNode(n),e.parent=n,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,n){let r=new Ds(e,n);this.addNode(r)}handleCallback(e){if(typeof this.callback=="function")this.callback(e,this.dom);else if(e)throw e}addNode(e){let n=this.tagStack[this.tagStack.length-1],r=n.children[n.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),n.children.push(e),r&&(e.prev=r,r.next=e),e.parent=n,this.lastNode=null}}});var Ls,r_=x(()=>{Ls=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(t=>t.charCodeAt(0)))});var au,s_=x(()=>{au=new Uint16Array("\u0200aglq \u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(t=>t.charCodeAt(0)))});function Cf(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=gw.get(t))!==null&&e!==void 0?e:t}var Af,gw,Ps,Sf=x(()=>{gw=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Ps=(Af=String.fromCodePoint)!==null&&Af!==void 0?Af:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e}});function If(t){return t>=Ke.ZERO&&t<=Ke.NINE}function _w(t){return t>=Ke.UPPER_A&&t<=Ke.UPPER_F||t>=Ke.LOWER_A&&t<=Ke.LOWER_F}function Ew(t){return t>=Ke.UPPER_A&&t<=Ke.UPPER_Z||t>=Ke.LOWER_A&&t<=Ke.LOWER_Z||If(t)}function Tw(t){return t===Ke.EQUALS||Ew(t)}function i_(t){let e="",n=new Dr(t,r=>e+=Ps(r));return function(s,i){let a=0,o=0;for(;(o=s.indexOf("&",o))>=0;){e+=s.slice(a,o),n.startEntity(i);let l=n.write(s,o+1);if(l<0){a=o+n.end();break}a=o+l,o=l===0?a+1:a}let c=e+s.slice(a);return e="",c}}function xw(t,e,n,r){let s=(e&tr.BRANCH_LENGTH)>>7,i=e&tr.JUMP_TABLE;if(s===0)return i!==0&&r===i?n:-1;if(i){let c=r-i;return c<0||c>=s?-1:t[n+c]-1}let a=n,o=a+s-1;for(;a<=o;){let c=a+o>>>1,l=t[c];if(lr)o=c-1;else return t[c+s]}return-1}var Ke,bw,tr,Ye,rt,Dr,Q5,X5,Ms=x(()=>{r_();s_();Sf();Sf();(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Ke||(Ke={}));bw=32;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(tr||(tr={}));(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Ye||(Ye={}));(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(rt||(rt={}));Dr=class{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Ye.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=rt.Strict}startEntity(e){this.decodeMode=e,this.state=Ye.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Ye.EntityStart:return e.charCodeAt(n)===Ke.NUM?(this.state=Ye.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Ye.NamedEntity,this.stateNamedEntity(e,n));case Ye.NumericStart:return this.stateNumericStart(e,n);case Ye.NumericDecimal:return this.stateNumericDecimal(e,n);case Ye.NumericHex:return this.stateNumericHex(e,n);case Ye.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|bw)===Ke.LOWER_X?(this.state=Ye.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Ye.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,s){if(n!==r){let i=r-n;this.result=this.result*Math.pow(s,i)+parseInt(e.substr(n,i),s),this.consumed+=i}}stateNumericHex(e,n){let r=n;for(;n>14;for(;n>14,i!==0){if(a===Ke.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==rt.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:n,decodeTree:r}=this,s=(r[n]&tr.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){let{decodeTree:s}=this;return this.emitCodePoint(n===1?s[e]&~tr.VALUE_LENGTH:s[e+1],r),n===3&&this.emitCodePoint(s[e+2],r),r}end(){var e;switch(this.state){case Ye.NamedEntity:return this.result!==0&&(this.decodeMode!==rt.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ye.NumericDecimal:return this.emitNumericEntity(0,2);case Ye.NumericHex:return this.emitNumericEntity(0,3);case Ye.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ye.EntityStart:return 0}}};Q5=i_(Ls),X5=i_(au)});function ou(t){for(let e=1;e{yw=new Map(ou([[9," "],[0," "],[22,"!"],[0,"""],[0,"#"],[0,"$"],[0,"%"],[0,"&"],[0,"'"],[0,"("],[0,")"],[0,"*"],[0,"+"],[0,","],[1,"."],[0,"/"],[10,":"],[0,";"],[0,{v:"<",n:8402,o:"<⃒"}],[0,{v:"=",n:8421,o:"=⃥"}],[0,{v:">",n:8402,o:">⃒"}],[0,"?"],[0,"@"],[26,"["],[0,"\"],[0,"]"],[0,"^"],[0,"_"],[0,"`"],[5,{n:106,o:"fj"}],[20,"{"],[0,"|"],[0,"}"],[34," "],[0,"¡"],[0,"¢"],[0,"£"],[0,"¤"],[0,"¥"],[0,"¦"],[0,"§"],[0,"¨"],[0,"©"],[0,"ª"],[0,"«"],[0,"¬"],[0,"­"],[0,"®"],[0,"¯"],[0,"°"],[0,"±"],[0,"²"],[0,"³"],[0,"´"],[0,"µ"],[0,"¶"],[0,"·"],[0,"¸"],[0,"¹"],[0,"º"],[0,"»"],[0,"¼"],[0,"½"],[0,"¾"],[0,"¿"],[0,"À"],[0,"Á"],[0,"Â"],[0,"Ã"],[0,"Ä"],[0,"Å"],[0,"Æ"],[0,"Ç"],[0,"È"],[0,"É"],[0,"Ê"],[0,"Ë"],[0,"Ì"],[0,"Í"],[0,"Î"],[0,"Ï"],[0,"Ð"],[0,"Ñ"],[0,"Ò"],[0,"Ó"],[0,"Ô"],[0,"Õ"],[0,"Ö"],[0,"×"],[0,"Ø"],[0,"Ù"],[0,"Ú"],[0,"Û"],[0,"Ü"],[0,"Ý"],[0,"Þ"],[0,"ß"],[0,"à"],[0,"á"],[0,"â"],[0,"ã"],[0,"ä"],[0,"å"],[0,"æ"],[0,"ç"],[0,"è"],[0,"é"],[0,"ê"],[0,"ë"],[0,"ì"],[0,"í"],[0,"î"],[0,"ï"],[0,"ð"],[0,"ñ"],[0,"ò"],[0,"ó"],[0,"ô"],[0,"õ"],[0,"ö"],[0,"÷"],[0,"ø"],[0,"ù"],[0,"ú"],[0,"û"],[0,"ü"],[0,"ý"],[0,"þ"],[0,"ÿ"],[0,"Ā"],[0,"ā"],[0,"Ă"],[0,"ă"],[0,"Ą"],[0,"ą"],[0,"Ć"],[0,"ć"],[0,"Ĉ"],[0,"ĉ"],[0,"Ċ"],[0,"ċ"],[0,"Č"],[0,"č"],[0,"Ď"],[0,"ď"],[0,"Đ"],[0,"đ"],[0,"Ē"],[0,"ē"],[2,"Ė"],[0,"ė"],[0,"Ę"],[0,"ę"],[0,"Ě"],[0,"ě"],[0,"Ĝ"],[0,"ĝ"],[0,"Ğ"],[0,"ğ"],[0,"Ġ"],[0,"ġ"],[0,"Ģ"],[1,"Ĥ"],[0,"ĥ"],[0,"Ħ"],[0,"ħ"],[0,"Ĩ"],[0,"ĩ"],[0,"Ī"],[0,"ī"],[2,"Į"],[0,"į"],[0,"İ"],[0,"ı"],[0,"IJ"],[0,"ij"],[0,"Ĵ"],[0,"ĵ"],[0,"Ķ"],[0,"ķ"],[0,"ĸ"],[0,"Ĺ"],[0,"ĺ"],[0,"Ļ"],[0,"ļ"],[0,"Ľ"],[0,"ľ"],[0,"Ŀ"],[0,"ŀ"],[0,"Ł"],[0,"ł"],[0,"Ń"],[0,"ń"],[0,"Ņ"],[0,"ņ"],[0,"Ň"],[0,"ň"],[0,"ʼn"],[0,"Ŋ"],[0,"ŋ"],[0,"Ō"],[0,"ō"],[2,"Ő"],[0,"ő"],[0,"Œ"],[0,"œ"],[0,"Ŕ"],[0,"ŕ"],[0,"Ŗ"],[0,"ŗ"],[0,"Ř"],[0,"ř"],[0,"Ś"],[0,"ś"],[0,"Ŝ"],[0,"ŝ"],[0,"Ş"],[0,"ş"],[0,"Š"],[0,"š"],[0,"Ţ"],[0,"ţ"],[0,"Ť"],[0,"ť"],[0,"Ŧ"],[0,"ŧ"],[0,"Ũ"],[0,"ũ"],[0,"Ū"],[0,"ū"],[0,"Ŭ"],[0,"ŭ"],[0,"Ů"],[0,"ů"],[0,"Ű"],[0,"ű"],[0,"Ų"],[0,"ų"],[0,"Ŵ"],[0,"ŵ"],[0,"Ŷ"],[0,"ŷ"],[0,"Ÿ"],[0,"Ź"],[0,"ź"],[0,"Ż"],[0,"ż"],[0,"Ž"],[0,"ž"],[19,"ƒ"],[34,"Ƶ"],[63,"ǵ"],[65,"ȷ"],[142,"ˆ"],[0,"ˇ"],[16,"˘"],[0,"˙"],[0,"˚"],[0,"˛"],[0,"˜"],[0,"˝"],[51,"̑"],[127,"Α"],[0,"Β"],[0,"Γ"],[0,"Δ"],[0,"Ε"],[0,"Ζ"],[0,"Η"],[0,"Θ"],[0,"Ι"],[0,"Κ"],[0,"Λ"],[0,"Μ"],[0,"Ν"],[0,"Ξ"],[0,"Ο"],[0,"Π"],[0,"Ρ"],[1,"Σ"],[0,"Τ"],[0,"Υ"],[0,"Φ"],[0,"Χ"],[0,"Ψ"],[0,"Ω"],[7,"α"],[0,"β"],[0,"γ"],[0,"δ"],[0,"ε"],[0,"ζ"],[0,"η"],[0,"θ"],[0,"ι"],[0,"κ"],[0,"λ"],[0,"μ"],[0,"ν"],[0,"ξ"],[0,"ο"],[0,"π"],[0,"ρ"],[0,"ς"],[0,"σ"],[0,"τ"],[0,"υ"],[0,"φ"],[0,"χ"],[0,"ψ"],[0,"ω"],[7,"ϑ"],[0,"ϒ"],[2,"ϕ"],[0,"ϖ"],[5,"Ϝ"],[0,"ϝ"],[18,"ϰ"],[0,"ϱ"],[3,"ϵ"],[0,"϶"],[10,"Ё"],[0,"Ђ"],[0,"Ѓ"],[0,"Є"],[0,"Ѕ"],[0,"І"],[0,"Ї"],[0,"Ј"],[0,"Љ"],[0,"Њ"],[0,"Ћ"],[0,"Ќ"],[1,"Ў"],[0,"Џ"],[0,"А"],[0,"Б"],[0,"В"],[0,"Г"],[0,"Д"],[0,"Е"],[0,"Ж"],[0,"З"],[0,"И"],[0,"Й"],[0,"К"],[0,"Л"],[0,"М"],[0,"Н"],[0,"О"],[0,"П"],[0,"Р"],[0,"С"],[0,"Т"],[0,"У"],[0,"Ф"],[0,"Х"],[0,"Ц"],[0,"Ч"],[0,"Ш"],[0,"Щ"],[0,"Ъ"],[0,"Ы"],[0,"Ь"],[0,"Э"],[0,"Ю"],[0,"Я"],[0,"а"],[0,"б"],[0,"в"],[0,"г"],[0,"д"],[0,"е"],[0,"ж"],[0,"з"],[0,"и"],[0,"й"],[0,"к"],[0,"л"],[0,"м"],[0,"н"],[0,"о"],[0,"п"],[0,"р"],[0,"с"],[0,"т"],[0,"у"],[0,"ф"],[0,"х"],[0,"ц"],[0,"ч"],[0,"ш"],[0,"щ"],[0,"ъ"],[0,"ы"],[0,"ь"],[0,"э"],[0,"ю"],[0,"я"],[1,"ё"],[0,"ђ"],[0,"ѓ"],[0,"є"],[0,"ѕ"],[0,"і"],[0,"ї"],[0,"ј"],[0,"љ"],[0,"њ"],[0,"ћ"],[0,"ќ"],[1,"ў"],[0,"џ"],[7074," "],[0," "],[0," "],[0," "],[1," "],[0," "],[0," "],[0," "],[0,"​"],[0,"‌"],[0,"‍"],[0,"‎"],[0,"‏"],[0,"‐"],[2,"–"],[0,"—"],[0,"―"],[0,"‖"],[1,"‘"],[0,"’"],[0,"‚"],[1,"“"],[0,"”"],[0,"„"],[1,"†"],[0,"‡"],[0,"•"],[2,"‥"],[0,"…"],[9,"‰"],[0,"‱"],[0,"′"],[0,"″"],[0,"‴"],[0,"‵"],[3,"‹"],[0,"›"],[3,"‾"],[2,"⁁"],[1,"⁃"],[0,"⁄"],[10,"⁏"],[7,"⁗"],[7,{v:" ",n:8202,o:"  "}],[0,"⁠"],[0,"⁡"],[0,"⁢"],[0,"⁣"],[72,"€"],[46,"⃛"],[0,"⃜"],[37,"ℂ"],[2,"℅"],[4,"ℊ"],[0,"ℋ"],[0,"ℌ"],[0,"ℍ"],[0,"ℎ"],[0,"ℏ"],[0,"ℐ"],[0,"ℑ"],[0,"ℒ"],[0,"ℓ"],[1,"ℕ"],[0,"№"],[0,"℗"],[0,"℘"],[0,"ℙ"],[0,"ℚ"],[0,"ℛ"],[0,"ℜ"],[0,"ℝ"],[0,"℞"],[3,"™"],[1,"ℤ"],[2,"℧"],[0,"ℨ"],[0,"℩"],[2,"ℬ"],[0,"ℭ"],[1,"ℯ"],[0,"ℰ"],[0,"ℱ"],[1,"ℳ"],[0,"ℴ"],[0,"ℵ"],[0,"ℶ"],[0,"ℷ"],[0,"ℸ"],[12,"ⅅ"],[0,"ⅆ"],[0,"ⅇ"],[0,"ⅈ"],[10,"⅓"],[0,"⅔"],[0,"⅕"],[0,"⅖"],[0,"⅗"],[0,"⅘"],[0,"⅙"],[0,"⅚"],[0,"⅛"],[0,"⅜"],[0,"⅝"],[0,"⅞"],[49,"←"],[0,"↑"],[0,"→"],[0,"↓"],[0,"↔"],[0,"↕"],[0,"↖"],[0,"↗"],[0,"↘"],[0,"↙"],[0,"↚"],[0,"↛"],[1,{v:"↝",n:824,o:"↝̸"}],[0,"↞"],[0,"↟"],[0,"↠"],[0,"↡"],[0,"↢"],[0,"↣"],[0,"↤"],[0,"↥"],[0,"↦"],[0,"↧"],[1,"↩"],[0,"↪"],[0,"↫"],[0,"↬"],[0,"↭"],[0,"↮"],[1,"↰"],[0,"↱"],[0,"↲"],[0,"↳"],[1,"↵"],[0,"↶"],[0,"↷"],[2,"↺"],[0,"↻"],[0,"↼"],[0,"↽"],[0,"↾"],[0,"↿"],[0,"⇀"],[0,"⇁"],[0,"⇂"],[0,"⇃"],[0,"⇄"],[0,"⇅"],[0,"⇆"],[0,"⇇"],[0,"⇈"],[0,"⇉"],[0,"⇊"],[0,"⇋"],[0,"⇌"],[0,"⇍"],[0,"⇎"],[0,"⇏"],[0,"⇐"],[0,"⇑"],[0,"⇒"],[0,"⇓"],[0,"⇔"],[0,"⇕"],[0,"⇖"],[0,"⇗"],[0,"⇘"],[0,"⇙"],[0,"⇚"],[0,"⇛"],[1,"⇝"],[6,"⇤"],[0,"⇥"],[15,"⇵"],[7,"⇽"],[0,"⇾"],[0,"⇿"],[0,"∀"],[0,"∁"],[0,{v:"∂",n:824,o:"∂̸"}],[0,"∃"],[0,"∄"],[0,"∅"],[1,"∇"],[0,"∈"],[0,"∉"],[1,"∋"],[0,"∌"],[2,"∏"],[0,"∐"],[0,"∑"],[0,"−"],[0,"∓"],[0,"∔"],[1,"∖"],[0,"∗"],[0,"∘"],[1,"√"],[2,"∝"],[0,"∞"],[0,"∟"],[0,{v:"∠",n:8402,o:"∠⃒"}],[0,"∡"],[0,"∢"],[0,"∣"],[0,"∤"],[0,"∥"],[0,"∦"],[0,"∧"],[0,"∨"],[0,{v:"∩",n:65024,o:"∩︀"}],[0,{v:"∪",n:65024,o:"∪︀"}],[0,"∫"],[0,"∬"],[0,"∭"],[0,"∮"],[0,"∯"],[0,"∰"],[0,"∱"],[0,"∲"],[0,"∳"],[0,"∴"],[0,"∵"],[0,"∶"],[0,"∷"],[0,"∸"],[1,"∺"],[0,"∻"],[0,{v:"∼",n:8402,o:"∼⃒"}],[0,{v:"∽",n:817,o:"∽̱"}],[0,{v:"∾",n:819,o:"∾̳"}],[0,"∿"],[0,"≀"],[0,"≁"],[0,{v:"≂",n:824,o:"≂̸"}],[0,"≃"],[0,"≄"],[0,"≅"],[0,"≆"],[0,"≇"],[0,"≈"],[0,"≉"],[0,"≊"],[0,{v:"≋",n:824,o:"≋̸"}],[0,"≌"],[0,{v:"≍",n:8402,o:"≍⃒"}],[0,{v:"≎",n:824,o:"≎̸"}],[0,{v:"≏",n:824,o:"≏̸"}],[0,{v:"≐",n:824,o:"≐̸"}],[0,"≑"],[0,"≒"],[0,"≓"],[0,"≔"],[0,"≕"],[0,"≖"],[0,"≗"],[1,"≙"],[0,"≚"],[1,"≜"],[2,"≟"],[0,"≠"],[0,{v:"≡",n:8421,o:"≡⃥"}],[0,"≢"],[1,{v:"≤",n:8402,o:"≤⃒"}],[0,{v:"≥",n:8402,o:"≥⃒"}],[0,{v:"≦",n:824,o:"≦̸"}],[0,{v:"≧",n:824,o:"≧̸"}],[0,{v:"≨",n:65024,o:"≨︀"}],[0,{v:"≩",n:65024,o:"≩︀"}],[0,{v:"≪",n:new Map(ou([[824,"≪̸"],[7577,"≪⃒"]]))}],[0,{v:"≫",n:new Map(ou([[824,"≫̸"],[7577,"≫⃒"]]))}],[0,"≬"],[0,"≭"],[0,"≮"],[0,"≯"],[0,"≰"],[0,"≱"],[0,"≲"],[0,"≳"],[0,"≴"],[0,"≵"],[0,"≶"],[0,"≷"],[0,"≸"],[0,"≹"],[0,"≺"],[0,"≻"],[0,"≼"],[0,"≽"],[0,"≾"],[0,{v:"≿",n:824,o:"≿̸"}],[0,"⊀"],[0,"⊁"],[0,{v:"⊂",n:8402,o:"⊂⃒"}],[0,{v:"⊃",n:8402,o:"⊃⃒"}],[0,"⊄"],[0,"⊅"],[0,"⊆"],[0,"⊇"],[0,"⊈"],[0,"⊉"],[0,{v:"⊊",n:65024,o:"⊊︀"}],[0,{v:"⊋",n:65024,o:"⊋︀"}],[1,"⊍"],[0,"⊎"],[0,{v:"⊏",n:824,o:"⊏̸"}],[0,{v:"⊐",n:824,o:"⊐̸"}],[0,"⊑"],[0,"⊒"],[0,{v:"⊓",n:65024,o:"⊓︀"}],[0,{v:"⊔",n:65024,o:"⊔︀"}],[0,"⊕"],[0,"⊖"],[0,"⊗"],[0,"⊘"],[0,"⊙"],[0,"⊚"],[0,"⊛"],[1,"⊝"],[0,"⊞"],[0,"⊟"],[0,"⊠"],[0,"⊡"],[0,"⊢"],[0,"⊣"],[0,"⊤"],[0,"⊥"],[1,"⊧"],[0,"⊨"],[0,"⊩"],[0,"⊪"],[0,"⊫"],[0,"⊬"],[0,"⊭"],[0,"⊮"],[0,"⊯"],[0,"⊰"],[1,"⊲"],[0,"⊳"],[0,{v:"⊴",n:8402,o:"⊴⃒"}],[0,{v:"⊵",n:8402,o:"⊵⃒"}],[0,"⊶"],[0,"⊷"],[0,"⊸"],[0,"⊹"],[0,"⊺"],[0,"⊻"],[1,"⊽"],[0,"⊾"],[0,"⊿"],[0,"⋀"],[0,"⋁"],[0,"⋂"],[0,"⋃"],[0,"⋄"],[0,"⋅"],[0,"⋆"],[0,"⋇"],[0,"⋈"],[0,"⋉"],[0,"⋊"],[0,"⋋"],[0,"⋌"],[0,"⋍"],[0,"⋎"],[0,"⋏"],[0,"⋐"],[0,"⋑"],[0,"⋒"],[0,"⋓"],[0,"⋔"],[0,"⋕"],[0,"⋖"],[0,"⋗"],[0,{v:"⋘",n:824,o:"⋘̸"}],[0,{v:"⋙",n:824,o:"⋙̸"}],[0,{v:"⋚",n:65024,o:"⋚︀"}],[0,{v:"⋛",n:65024,o:"⋛︀"}],[2,"⋞"],[0,"⋟"],[0,"⋠"],[0,"⋡"],[0,"⋢"],[0,"⋣"],[2,"⋦"],[0,"⋧"],[0,"⋨"],[0,"⋩"],[0,"⋪"],[0,"⋫"],[0,"⋬"],[0,"⋭"],[0,"⋮"],[0,"⋯"],[0,"⋰"],[0,"⋱"],[0,"⋲"],[0,"⋳"],[0,"⋴"],[0,{v:"⋵",n:824,o:"⋵̸"}],[0,"⋶"],[0,"⋷"],[1,{v:"⋹",n:824,o:"⋹̸"}],[0,"⋺"],[0,"⋻"],[0,"⋼"],[0,"⋽"],[0,"⋾"],[6,"⌅"],[0,"⌆"],[1,"⌈"],[0,"⌉"],[0,"⌊"],[0,"⌋"],[0,"⌌"],[0,"⌍"],[0,"⌎"],[0,"⌏"],[0,"⌐"],[1,"⌒"],[0,"⌓"],[1,"⌕"],[0,"⌖"],[5,"⌜"],[0,"⌝"],[0,"⌞"],[0,"⌟"],[2,"⌢"],[0,"⌣"],[9,"⌭"],[0,"⌮"],[7,"⌶"],[6,"⌽"],[1,"⌿"],[60,"⍼"],[51,"⎰"],[0,"⎱"],[2,"⎴"],[0,"⎵"],[0,"⎶"],[37,"⏜"],[0,"⏝"],[0,"⏞"],[0,"⏟"],[2,"⏢"],[4,"⏧"],[59,"␣"],[164,"Ⓢ"],[55,"─"],[1,"│"],[9,"┌"],[3,"┐"],[3,"└"],[3,"┘"],[3,"├"],[7,"┤"],[7,"┬"],[7,"┴"],[7,"┼"],[19,"═"],[0,"║"],[0,"╒"],[0,"╓"],[0,"╔"],[0,"╕"],[0,"╖"],[0,"╗"],[0,"╘"],[0,"╙"],[0,"╚"],[0,"╛"],[0,"╜"],[0,"╝"],[0,"╞"],[0,"╟"],[0,"╠"],[0,"╡"],[0,"╢"],[0,"╣"],[0,"╤"],[0,"╥"],[0,"╦"],[0,"╧"],[0,"╨"],[0,"╩"],[0,"╪"],[0,"╫"],[0,"╬"],[19,"▀"],[3,"▄"],[3,"█"],[8,"░"],[0,"▒"],[0,"▓"],[13,"□"],[8,"▪"],[0,"▫"],[1,"▭"],[0,"▮"],[2,"▱"],[1,"△"],[0,"▴"],[0,"▵"],[2,"▸"],[0,"▹"],[3,"▽"],[0,"▾"],[0,"▿"],[2,"◂"],[0,"◃"],[6,"◊"],[0,"○"],[32,"◬"],[2,"◯"],[8,"◸"],[0,"◹"],[0,"◺"],[0,"◻"],[0,"◼"],[8,"★"],[0,"☆"],[7,"☎"],[49,"♀"],[1,"♂"],[29,"♠"],[2,"♣"],[1,"♥"],[0,"♦"],[3,"♪"],[2,"♭"],[0,"♮"],[0,"♯"],[163,"✓"],[3,"✗"],[8,"✠"],[21,"✶"],[33,"❘"],[25,"❲"],[0,"❳"],[84,"⟈"],[0,"⟉"],[28,"⟦"],[0,"⟧"],[0,"⟨"],[0,"⟩"],[0,"⟪"],[0,"⟫"],[0,"⟬"],[0,"⟭"],[7,"⟵"],[0,"⟶"],[0,"⟷"],[0,"⟸"],[0,"⟹"],[0,"⟺"],[1,"⟼"],[2,"⟿"],[258,"⤂"],[0,"⤃"],[0,"⤄"],[0,"⤅"],[6,"⤌"],[0,"⤍"],[0,"⤎"],[0,"⤏"],[0,"⤐"],[0,"⤑"],[0,"⤒"],[0,"⤓"],[2,"⤖"],[2,"⤙"],[0,"⤚"],[0,"⤛"],[0,"⤜"],[0,"⤝"],[0,"⤞"],[0,"⤟"],[0,"⤠"],[2,"⤣"],[0,"⤤"],[0,"⤥"],[0,"⤦"],[0,"⤧"],[0,"⤨"],[0,"⤩"],[0,"⤪"],[8,{v:"⤳",n:824,o:"⤳̸"}],[1,"⤵"],[0,"⤶"],[0,"⤷"],[0,"⤸"],[0,"⤹"],[2,"⤼"],[0,"⤽"],[7,"⥅"],[2,"⥈"],[0,"⥉"],[0,"⥊"],[0,"⥋"],[2,"⥎"],[0,"⥏"],[0,"⥐"],[0,"⥑"],[0,"⥒"],[0,"⥓"],[0,"⥔"],[0,"⥕"],[0,"⥖"],[0,"⥗"],[0,"⥘"],[0,"⥙"],[0,"⥚"],[0,"⥛"],[0,"⥜"],[0,"⥝"],[0,"⥞"],[0,"⥟"],[0,"⥠"],[0,"⥡"],[0,"⥢"],[0,"⥣"],[0,"⥤"],[0,"⥥"],[0,"⥦"],[0,"⥧"],[0,"⥨"],[0,"⥩"],[0,"⥪"],[0,"⥫"],[0,"⥬"],[0,"⥭"],[0,"⥮"],[0,"⥯"],[0,"⥰"],[0,"⥱"],[0,"⥲"],[0,"⥳"],[0,"⥴"],[0,"⥵"],[0,"⥶"],[1,"⥸"],[0,"⥹"],[1,"⥻"],[0,"⥼"],[0,"⥽"],[0,"⥾"],[0,"⥿"],[5,"⦅"],[0,"⦆"],[4,"⦋"],[0,"⦌"],[0,"⦍"],[0,"⦎"],[0,"⦏"],[0,"⦐"],[0,"⦑"],[0,"⦒"],[0,"⦓"],[0,"⦔"],[0,"⦕"],[0,"⦖"],[3,"⦚"],[1,"⦜"],[0,"⦝"],[6,"⦤"],[0,"⦥"],[0,"⦦"],[0,"⦧"],[0,"⦨"],[0,"⦩"],[0,"⦪"],[0,"⦫"],[0,"⦬"],[0,"⦭"],[0,"⦮"],[0,"⦯"],[0,"⦰"],[0,"⦱"],[0,"⦲"],[0,"⦳"],[0,"⦴"],[0,"⦵"],[0,"⦶"],[0,"⦷"],[1,"⦹"],[1,"⦻"],[0,"⦼"],[1,"⦾"],[0,"⦿"],[0,"⧀"],[0,"⧁"],[0,"⧂"],[0,"⧃"],[0,"⧄"],[0,"⧅"],[3,"⧉"],[3,"⧍"],[0,"⧎"],[0,{v:"⧏",n:824,o:"⧏̸"}],[0,{v:"⧐",n:824,o:"⧐̸"}],[11,"⧜"],[0,"⧝"],[0,"⧞"],[4,"⧣"],[0,"⧤"],[0,"⧥"],[5,"⧫"],[8,"⧴"],[1,"⧶"],[9,"⨀"],[0,"⨁"],[0,"⨂"],[1,"⨄"],[1,"⨆"],[5,"⨌"],[0,"⨍"],[2,"⨐"],[0,"⨑"],[0,"⨒"],[0,"⨓"],[0,"⨔"],[0,"⨕"],[0,"⨖"],[0,"⨗"],[10,"⨢"],[0,"⨣"],[0,"⨤"],[0,"⨥"],[0,"⨦"],[0,"⨧"],[1,"⨩"],[0,"⨪"],[2,"⨭"],[0,"⨮"],[0,"⨯"],[0,"⨰"],[0,"⨱"],[1,"⨳"],[0,"⨴"],[0,"⨵"],[0,"⨶"],[0,"⨷"],[0,"⨸"],[0,"⨹"],[0,"⨺"],[0,"⨻"],[0,"⨼"],[2,"⨿"],[0,"⩀"],[1,"⩂"],[0,"⩃"],[0,"⩄"],[0,"⩅"],[0,"⩆"],[0,"⩇"],[0,"⩈"],[0,"⩉"],[0,"⩊"],[0,"⩋"],[0,"⩌"],[0,"⩍"],[2,"⩐"],[2,"⩓"],[0,"⩔"],[0,"⩕"],[0,"⩖"],[0,"⩗"],[0,"⩘"],[1,"⩚"],[0,"⩛"],[0,"⩜"],[0,"⩝"],[1,"⩟"],[6,"⩦"],[3,"⩪"],[2,{v:"⩭",n:824,o:"⩭̸"}],[0,"⩮"],[0,"⩯"],[0,{v:"⩰",n:824,o:"⩰̸"}],[0,"⩱"],[0,"⩲"],[0,"⩳"],[0,"⩴"],[0,"⩵"],[1,"⩷"],[0,"⩸"],[0,"⩹"],[0,"⩺"],[0,"⩻"],[0,"⩼"],[0,{v:"⩽",n:824,o:"⩽̸"}],[0,{v:"⩾",n:824,o:"⩾̸"}],[0,"⩿"],[0,"⪀"],[0,"⪁"],[0,"⪂"],[0,"⪃"],[0,"⪄"],[0,"⪅"],[0,"⪆"],[0,"⪇"],[0,"⪈"],[0,"⪉"],[0,"⪊"],[0,"⪋"],[0,"⪌"],[0,"⪍"],[0,"⪎"],[0,"⪏"],[0,"⪐"],[0,"⪑"],[0,"⪒"],[0,"⪓"],[0,"⪔"],[0,"⪕"],[0,"⪖"],[0,"⪗"],[0,"⪘"],[0,"⪙"],[0,"⪚"],[2,"⪝"],[0,"⪞"],[0,"⪟"],[0,"⪠"],[0,{v:"⪡",n:824,o:"⪡̸"}],[0,{v:"⪢",n:824,o:"⪢̸"}],[1,"⪤"],[0,"⪥"],[0,"⪦"],[0,"⪧"],[0,"⪨"],[0,"⪩"],[0,"⪪"],[0,"⪫"],[0,{v:"⪬",n:65024,o:"⪬︀"}],[0,{v:"⪭",n:65024,o:"⪭︀"}],[0,"⪮"],[0,{v:"⪯",n:824,o:"⪯̸"}],[0,{v:"⪰",n:824,o:"⪰̸"}],[2,"⪳"],[0,"⪴"],[0,"⪵"],[0,"⪶"],[0,"⪷"],[0,"⪸"],[0,"⪹"],[0,"⪺"],[0,"⪻"],[0,"⪼"],[0,"⪽"],[0,"⪾"],[0,"⪿"],[0,"⫀"],[0,"⫁"],[0,"⫂"],[0,"⫃"],[0,"⫄"],[0,{v:"⫅",n:824,o:"⫅̸"}],[0,{v:"⫆",n:824,o:"⫆̸"}],[0,"⫇"],[0,"⫈"],[2,{v:"⫋",n:65024,o:"⫋︀"}],[0,{v:"⫌",n:65024,o:"⫌︀"}],[2,"⫏"],[0,"⫐"],[0,"⫑"],[0,"⫒"],[0,"⫓"],[0,"⫔"],[0,"⫕"],[0,"⫖"],[0,"⫗"],[0,"⫘"],[0,"⫙"],[0,"⫚"],[0,"⫛"],[8,"⫤"],[1,"⫦"],[0,"⫧"],[0,"⫨"],[0,"⫩"],[1,"⫫"],[0,"⫬"],[0,"⫭"],[0,"⫮"],[0,"⫯"],[0,"⫰"],[0,"⫱"],[0,"⫲"],[0,"⫳"],[9,{v:"⫽",n:8421,o:"⫽⃥"}],[44343,{n:new Map(ou([[56476,"𝒜"],[1,"𝒞"],[0,"𝒟"],[2,"𝒢"],[2,"𝒥"],[0,"𝒦"],[2,"𝒩"],[0,"𝒪"],[0,"𝒫"],[0,"𝒬"],[1,"𝒮"],[0,"𝒯"],[0,"𝒰"],[0,"𝒱"],[0,"𝒲"],[0,"𝒳"],[0,"𝒴"],[0,"𝒵"],[0,"𝒶"],[0,"𝒷"],[0,"𝒸"],[0,"𝒹"],[1,"𝒻"],[1,"𝒽"],[0,"𝒾"],[0,"𝒿"],[0,"𝓀"],[0,"𝓁"],[0,"𝓂"],[0,"𝓃"],[1,"𝓅"],[0,"𝓆"],[0,"𝓇"],[0,"𝓈"],[0,"𝓉"],[0,"𝓊"],[0,"𝓋"],[0,"𝓌"],[0,"𝓍"],[0,"𝓎"],[0,"𝓏"],[52,"𝔄"],[0,"𝔅"],[1,"𝔇"],[0,"𝔈"],[0,"𝔉"],[0,"𝔊"],[2,"𝔍"],[0,"𝔎"],[0,"𝔏"],[0,"𝔐"],[0,"𝔑"],[0,"𝔒"],[0,"𝔓"],[0,"𝔔"],[1,"𝔖"],[0,"𝔗"],[0,"𝔘"],[0,"𝔙"],[0,"𝔚"],[0,"𝔛"],[0,"𝔜"],[1,"𝔞"],[0,"𝔟"],[0,"𝔠"],[0,"𝔡"],[0,"𝔢"],[0,"𝔣"],[0,"𝔤"],[0,"𝔥"],[0,"𝔦"],[0,"𝔧"],[0,"𝔨"],[0,"𝔩"],[0,"𝔪"],[0,"𝔫"],[0,"𝔬"],[0,"𝔭"],[0,"𝔮"],[0,"𝔯"],[0,"𝔰"],[0,"𝔱"],[0,"𝔲"],[0,"𝔳"],[0,"𝔴"],[0,"𝔵"],[0,"𝔶"],[0,"𝔷"],[0,"𝔸"],[0,"𝔹"],[1,"𝔻"],[0,"𝔼"],[0,"𝔽"],[0,"𝔾"],[1,"𝕀"],[0,"𝕁"],[0,"𝕂"],[0,"𝕃"],[0,"𝕄"],[1,"𝕆"],[3,"𝕊"],[0,"𝕋"],[0,"𝕌"],[0,"𝕍"],[0,"𝕎"],[0,"𝕏"],[0,"𝕐"],[1,"𝕒"],[0,"𝕓"],[0,"𝕔"],[0,"𝕕"],[0,"𝕖"],[0,"𝕗"],[0,"𝕘"],[0,"𝕙"],[0,"𝕚"],[0,"𝕛"],[0,"𝕜"],[0,"𝕝"],[0,"𝕞"],[0,"𝕟"],[0,"𝕠"],[0,"𝕡"],[0,"𝕢"],[0,"𝕣"],[0,"𝕤"],[0,"𝕥"],[0,"𝕦"],[0,"𝕧"],[0,"𝕨"],[0,"𝕩"],[0,"𝕪"],[0,"𝕫"]]))}],[8906,"ff"],[0,"fi"],[0,"fl"],[0,"ffi"],[0,"ffl"]]))});function Qi(t){let e="",n=0,r;for(;(r=wf.exec(t))!==null;){let s=r.index,i=t.charCodeAt(s),a=o_.get(i);a!==void 0?(e+=t.substring(n,s)+a,n=s+1):(e+=`${t.substring(n,s)}&#x${u_(t,s).toString(16)};`,n=wf.lastIndex+=Number((i&64512)==55296))}return e+t.substr(n)}function Nf(t,e){return function(r){let s,i=0,a="";for(;s=t.exec(r);)i!==s.index&&(a+=r.substring(i,s.index)),a+=e.get(s[0].charCodeAt(0)),i=s.index+1;return a+r.substring(i)}}var wf,o_,u_,c_,Fs,Bs,Xi=x(()=>{wf=/["&'<>$\x80-\uFFFF]/g,o_=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]),u_=String.prototype.codePointAt!=null?(t,e)=>t.codePointAt(e):(t,e)=>(t.charCodeAt(e)&64512)==55296?(t.charCodeAt(e)-55296)*1024+t.charCodeAt(e+1)-56320+65536:t.charCodeAt(e);c_=Nf(/[&<>'"]/g,o_),Fs=Nf(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),Bs=Nf(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]))});var vf=x(()=>{a_();Xi()});var d_,h_,p_=x(()=>{Ms();vf();Xi();Xi();vf();Ms();(function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"})(d_||(d_={}));(function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"})(h_||(h_={}))});var m_,g_,b_=x(()=>{m_=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),g_=new Map(["definitionURL","attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t]))});function Sw(t){return t.replace(/"/g,""")}function Iw(t,e){var n;if(!t)return;let r=((n=e.encodeEntities)!==null&&n!==void 0?n:e.decodeEntities)===!1?Sw:e.xmlMode||e.encodeEntities!=="utf8"?Qi:Fs;return Object.keys(t).map(s=>{var i,a;let o=(i=t[s])!==null&&i!==void 0?i:"";return e.xmlMode==="foreign"&&(s=(a=g_.get(s))!==null&&a!==void 0?a:s),!e.emptyAttrs&&!e.xmlMode&&o===""?s:`${s}="${r(o)}"`}).join(" ")}function kf(t,e={}){let n="length"in t?t:[t],r="";for(let s=0;s0&&(r+=kf(t.children,e)),(e.xmlMode||!__.has(t.name))&&(r+=``)),r}function Ow(t){return`<${t.data}>`}function kw(t,e){var n;let r=t.data||"";return((n=e.encodeEntities)!==null&&n!==void 0?n:e.decodeEntities)!==!1&&!(!e.xmlMode&&t.parent&&Cw.has(t.parent.name))&&(r=e.xmlMode||e.encodeEntities!=="utf8"?Qi(r):Bs(r)),r}function Rw(t){return``}function Lw(t){return``}var Cw,__,uu,Nw,vw,Rf=x(()=>{Ns();p_();b_();Cw=new Set(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]);__=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]);uu=kf;Nw=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),vw=new Set(["svg","math"])});function E_(t,e){return uu(t,e)}function Pw(t,e){return De(t)?t.children.map(n=>E_(n,e)).join(""):""}function cu(t){return Array.isArray(t)?t.map(cu).join(""):$(t)?t.name==="br"?` +`:cu(t.children):ks(t)?cu(t.children):gt(t)?t.data:""}function An(t){return Array.isArray(t)?t.map(An).join(""):De(t)&&!vr(t)?An(t.children):gt(t)?t.data:""}function Zi(t){return Array.isArray(t)?t.map(Zi).join(""):De(t)&&(t.type===de.Tag||ks(t))?Zi(t.children):gt(t)?t.data:""}var Lf=x(()=>{Qe();Rf();Ns()});function Ji(t){return De(t)?t.children:[]}function T_(t){return t.parent||null}function Pf(t){let e=T_(t);if(e!=null)return Ji(e);let n=[t],{prev:r,next:s}=t;for(;r!=null;)n.unshift(r),{prev:r}=r;for(;s!=null;)n.push(s),{next:s}=s;return n}function Mw(t,e){var n;return(n=t.attribs)===null||n===void 0?void 0:n[e]}function Fw(t,e){return t.attribs!=null&&Object.prototype.hasOwnProperty.call(t.attribs,e)&&t.attribs[e]!=null}function Bw(t){return t.name}function lu(t){let{next:e}=t;for(;e!==null&&!$(e);)({next:e}=e);return e}function fu(t){let{prev:e}=t;for(;e!==null&&!$(e);)({prev:e}=e);return e}var x_=x(()=>{Qe()});function Cn(t){if(t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.parent){let e=t.parent.children,n=e.lastIndexOf(t);n>=0&&e.splice(n,1)}t.next=null,t.prev=null,t.parent=null}function jw(t,e){let n=e.prev=t.prev;n&&(n.next=e);let r=e.next=t.next;r&&(r.prev=e);let s=e.parent=t.parent;if(s){let i=s.children;i[i.lastIndexOf(t)]=e,t.parent=null}}function Hw(t,e){if(Cn(e),e.next=null,e.parent=t,t.children.push(e)>1){let n=t.children[t.children.length-2];n.next=e,e.prev=n}else e.prev=null}function Uw(t,e){Cn(e);let{parent:n}=t,r=t.next;if(e.next=r,e.prev=t,t.next=e,e.parent=n,r){if(r.prev=e,n){let s=n.children;s.splice(s.lastIndexOf(r),0,e)}}else n&&n.children.push(e)}function zw(t,e){if(Cn(e),e.parent=t,e.prev=null,t.children.unshift(e)!==1){let n=t.children[1];n.prev=e,e.next=n}else e.next=null}function Vw(t,e){Cn(e);let{parent:n}=t;if(n){let r=n.children;r.splice(r.indexOf(t),0,e)}t.prev&&(t.prev.next=e),e.parent=n,e.prev=t.prev,e.next=t,t.prev=e}var y_=x(()=>{});function ea(t,e,n=!0,r=1/0){return Mf(t,Array.isArray(e)?e:[e],n,r)}function Mf(t,e,n,r){let s=[],i=[e],a=[0];for(;;){if(a[0]>=i[0].length){if(a.length===1)return s;i.shift(),a.shift();continue}let o=i[0][a[0]++];if(t(o)&&(s.push(o),--r<=0))return s;n&&De(o)&&o.children.length>0&&(a.unshift(0),i.unshift(o.children))}}function qw(t,e){return e.find(t)}function du(t,e,n=!0){let r=null;for(let s=0;s0&&(r=du(t,i.children,!0));else continue}return r}function A_(t,e){return e.some(n=>$(n)&&(t(n)||A_(t,n.children)))}function Kw(t,e){let n=[],r=[e],s=[0];for(;;){if(s[0]>=r[0].length){if(r.length===1)return n;r.shift(),s.shift();continue}let i=r[0][s[0]++];!$(i)||(t(i)&&n.push(i),i.children.length>0&&(s.unshift(0),r.unshift(i.children)))}}var Ff=x(()=>{Qe()});function C_(t,e){return typeof e=="function"?n=>$(n)&&e(n.attribs[t]):n=>$(n)&&n.attribs[t]===e}function Yw(t,e){return n=>t(n)||e(n)}function S_(t){let e=Object.keys(t).map(n=>{let r=t[n];return Object.prototype.hasOwnProperty.call(hu,n)?hu[n](r):C_(n,r)});return e.length===0?null:e.reduce(Yw)}function Ww(t,e){let n=S_(t);return n?n(e):!0}function Gw(t,e,n,r=1/0){let s=S_(t);return s?ea(s,e,n,r):[]}function $w(t,e,n=!0){return Array.isArray(e)||(e=[e]),du(C_("id",t),e,n)}function Or(t,e,n=!0,r=1/0){return ea(hu.tag_name(t),e,n,r)}function Qw(t,e,n=!0,r=1/0){return ea(hu.tag_type(t),e,n,r)}var hu,Bf=x(()=>{Qe();Ff();hu={tag_name(t){return typeof t=="function"?e=>$(e)&&t(e.name):t==="*"?$:e=>$(e)&&e.name===t},tag_type(t){return typeof t=="function"?e=>t(e.type):e=>e.type===t},tag_contains(t){return typeof t=="function"?e=>gt(e)&&t(e.data):e=>gt(e)&&e.data===t}}});function Xw(t){let e=t.length;for(;--e>=0;){let n=t[e];if(e>0&&t.lastIndexOf(n,e-1)>=0){t.splice(e,1);continue}for(let r=n.parent;r;r=r.parent)if(t.includes(r)){t.splice(e,1);break}}return t}function I_(t,e){let n=[],r=[];if(t===e)return 0;let s=De(t)?t:t.parent;for(;s;)n.unshift(s),s=s.parent;for(s=De(e)?e:e.parent;s;)r.unshift(s),s=s.parent;let i=Math.min(n.length,r.length),a=0;for(;ac.indexOf(h)?o===e?Rt.FOLLOWING|Rt.CONTAINED_BY:Rt.FOLLOWING:o===t?Rt.PRECEDING|Rt.CONTAINS:Rt.PRECEDING}function kr(t){return t=t.filter((e,n,r)=>!r.includes(e,n+1)),t.sort((e,n)=>{let r=I_(e,n);return r&Rt.PRECEDING?-1:r&Rt.FOLLOWING?1:0}),t}var Rt,w_=x(()=>{Qe();(function(t){t[t.DISCONNECTED=1]="DISCONNECTED",t[t.PRECEDING=2]="PRECEDING",t[t.FOLLOWING=4]="FOLLOWING",t[t.CONTAINS=8]="CONTAINS",t[t.CONTAINED_BY=16]="CONTAINED_BY"})(Rt||(Rt={}))});function jf(t){let e=pu(nN,t);return e?e.name==="feed"?Zw(e):Jw(e):null}function Zw(t){var e;let n=t.children,r={type:"atom",items:Or("entry",n).map(a=>{var o;let{children:c}=a,l={media:N_(c)};bt(l,"id","id",c),bt(l,"title","title",c);let h=(o=pu("link",c))===null||o===void 0?void 0:o.attribs.href;h&&(l.link=h);let d=nr("summary",c)||nr("content",c);d&&(l.description=d);let f=nr("updated",c);return f&&(l.pubDate=new Date(f)),l})};bt(r,"id","id",n),bt(r,"title","title",n);let s=(e=pu("link",n))===null||e===void 0?void 0:e.attribs.href;s&&(r.link=s),bt(r,"description","subtitle",n);let i=nr("updated",n);return i&&(r.updated=new Date(i)),bt(r,"author","email",n,!0),r}function Jw(t){var e,n;let r=(n=(e=pu("channel",t.children))===null||e===void 0?void 0:e.children)!==null&&n!==void 0?n:[],s={type:t.name.substr(0,3),id:"",items:Or("item",t.children).map(a=>{let{children:o}=a,c={media:N_(o)};bt(c,"id","guid",o),bt(c,"title","title",o),bt(c,"link","link",o),bt(c,"description","description",o);let l=nr("pubDate",o)||nr("dc:date",o);return l&&(c.pubDate=new Date(l)),c})};bt(s,"title","title",r),bt(s,"link","link",r),bt(s,"description","description",r);let i=nr("lastBuildDate",r);return i&&(s.updated=new Date(i)),bt(s,"author","managingEditor",r,!0),s}function N_(t){return Or("media:content",t).map(e=>{let{attribs:n}=e,r={medium:n.medium,isDefault:!!n.isDefault};for(let s of eN)n[s]&&(r[s]=n[s]);for(let s of tN)n[s]&&(r[s]=parseInt(n[s],10));return n.expression&&(r.expression=n.expression),r})}function pu(t,e){return Or(t,e,!0,1)[0]}function nr(t,e,n=!1){return An(Or(t,e,n,1)).trim()}function bt(t,e,n,r,s=!1){let i=nr(n,r,s);i&&(t[e]=i)}function nN(t){return t==="rss"||t==="feed"||t==="rdf:RDF"}var eN,tN,v_=x(()=>{Lf();Bf();eN=["url","type","lang"],tN=["fileSize","bitrate","framerate","samplingrate","channels","duration","height","width"]});var rr={};It(rr,{DocumentPosition:()=>Rt,append:()=>Uw,appendChild:()=>Hw,compareDocumentPosition:()=>I_,existsOne:()=>A_,filter:()=>ea,find:()=>Mf,findAll:()=>Kw,findOne:()=>du,findOneChild:()=>qw,getAttributeValue:()=>Mw,getChildren:()=>Ji,getElementById:()=>$w,getElements:()=>Gw,getElementsByTagName:()=>Or,getElementsByTagType:()=>Qw,getFeed:()=>jf,getInnerHTML:()=>Pw,getName:()=>Bw,getOuterHTML:()=>E_,getParent:()=>T_,getSiblings:()=>Pf,getText:()=>cu,hasAttrib:()=>Fw,hasChildren:()=>De,innerText:()=>Zi,isCDATA:()=>ks,isComment:()=>vr,isDocument:()=>kt,isTag:()=>$,isText:()=>gt,nextElementSibling:()=>lu,prepend:()=>Vw,prependChild:()=>zw,prevElementSibling:()=>fu,removeElement:()=>Cn,removeSubsets:()=>Xw,replaceElement:()=>jw,testElement:()=>Ww,textContent:()=>An,uniqueSort:()=>kr});var Gt=x(()=>{Lf();x_();y_();Ff();Bf();w_();v_();Qe()});function ta(t,e){if(!t)return e??rN;let n=B(B({_useHtmlParser2:!!t.xmlMode},e),t);return t.xml?(n._useHtmlParser2=!0,n.xmlMode=!0,t.xml!==!0&&Object.assign(n,t.xml)):t.xmlMode&&(n._useHtmlParser2=!0),n}var rN,Hf=x(()=>{rN={_useHtmlParser2:!1}});var zf={};It(zf,{contains:()=>na,extract:()=>cN,html:()=>iN,merge:()=>Uf,parseHTML:()=>oN,root:()=>uN,text:()=>Rr,xml:()=>aN});function D_(t,e,n){return t?t(e??t._root.children,null,void 0,n).toString():""}function sN(t,e){return!e&&typeof t=="object"&&t!=null&&!("length"in t)&&!("type"in t)}function iN(t,e){let n=sN(t)?(e=t,void 0):t,r=B(B({},this===null||this===void 0?void 0:this._options),ta(e));return D_(this,n,r)}function aN(t){let e=ce(B({},this._options),{xmlMode:!0});return D_(this,t,e)}function Rr(t){let e=t??(this?this.root():[]),n="";for(let r=0;r{Gt();Hf()});function Lt(t){return t.cheerio!=null}function k_(t){return t.replace(/[._-](\w|$)/g,(e,n)=>n.toUpperCase())}function R_(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}function Ae(t,e){let n=t.length;for(let r=0;rt.length-3)return!1;let n=t.charCodeAt(e+1);return(n>=Lr.LowerA&&n<=Lr.LowerZ||n>=Lr.UpperA&&n<=Lr.UpperZ||n===Lr.Exclamation)&&t.includes(">",e+2)}var Lr,Hs=x(()=>{(function(t){t[t.LowerA=97]="LowerA",t[t.LowerZ=122]="LowerZ",t[t.UpperA=65]="UpperA",t[t.UpperZ=90]="UpperZ",t[t.Exclamation=33]="Exclamation"})(Lr||(Lr={}))});var Yf={};It(Yf,{addClass:()=>B_,attr:()=>fN,data:()=>mN,hasClass:()=>_N,prop:()=>dN,removeAttr:()=>bN,removeClass:()=>j_,toggleClass:()=>H_,val:()=>gN});function mu(t,e,n){var r;if(!(!t||!$(t))){if((r=t.attribs)!==null&&r!==void 0||(t.attribs={}),!e)return t.attribs;if(sa.call(t.attribs,e))return!n&&qf.test(e)?e:t.attribs[e];if(t.name==="option"&&e==="value")return Rr(t.children);if(t.name==="input"&&(t.attribs.type==="radio"||t.attribs.type==="checkbox")&&e==="value")return"on"}}function Us(t,e,n){n===null?F_(t,e):t.attribs[e]=`${n}`}function fN(t,e){if(typeof t=="object"||e!==void 0){if(typeof e=="function"){if(typeof t!="string")throw new Error("Bad combination of arguments.");return Ae(this,(n,r)=>{$(n)&&Us(n,t,e.call(n,r,n.attribs[t]))})}return Ae(this,n=>{if(!!$(n))if(typeof t=="object")for(let r of Object.keys(t)){let s=t[r];Us(n,r,s)}else Us(n,t,e)})}return arguments.length>1?this:mu(this[0],t,this.options.xmlMode)}function L_(t,e,n){return e in t?t[e]:!n&&qf.test(e)?mu(t,e,!1)!==void 0:mu(t,e,n)}function Kf(t,e,n,r){e in t?t[e]=n:Us(t,e,!r&&qf.test(e)?n?"":null:`${n}`)}function dN(t,e){var n;if(typeof t=="string"&&e===void 0){let r=this[0];if(!r||!$(r))return;switch(t){case"style":{let s=this.css(),i=Object.keys(s);for(let a=0;a").parent().html();case"innerHTML":return this.html();default:return L_(r,t,this.options.xmlMode)}}if(typeof t=="object"||e!==void 0){if(typeof e=="function"){if(typeof t=="object")throw new TypeError("Bad combination of arguments.");return Ae(this,(r,s)=>{$(r)&&Kf(r,t,e.call(r,s,L_(r,t,this.options.xmlMode)),this.options.xmlMode)})}return Ae(this,r=>{if(!!$(r))if(typeof t=="object")for(let s of Object.keys(t)){let i=t[s];Kf(r,s,i,this.options.xmlMode)}else Kf(r,t,e,this.options.xmlMode)})}}function P_(t,e,n){var r;(r=t.data)!==null&&r!==void 0||(t.data={}),typeof e=="object"?Object.assign(t.data,e):typeof e=="string"&&n!==void 0&&(t.data[e]=n)}function hN(t){for(let e of Object.keys(t.attribs)){if(!e.startsWith(Vf))continue;let n=k_(e.slice(Vf.length));sa.call(t.data,n)||(t.data[n]=M_(t.attribs[e]))}return t.data}function pN(t,e){let n=Vf+R_(e),r=t.data;if(sa.call(r,e))return r[e];if(sa.call(t.attribs,n))return r[e]=M_(t.attribs[n])}function M_(t){if(t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;let e=Number(t);if(t===String(e))return e;if(lN.test(t))try{return JSON.parse(t)}catch{}return t}function mN(t,e){var n;let r=this[0];if(!r||!$(r))return;let s=r;return(n=s.data)!==null&&n!==void 0||(s.data={}),t==null?hN(s):typeof t=="object"||e!==void 0?(Ae(this,i=>{$(i)&&(typeof t=="object"?P_(i,t):P_(i,t,e))}),this):pN(s,t)}function gN(t){let e=arguments.length===0,n=this[0];if(!n||!$(n))return e?void 0:this;switch(n.name){case"textarea":return this.text(t);case"select":{let r=this.find("option:selected");if(!e){if(this.attr("multiple")==null&&typeof t=="object")return this;this.find("option").removeAttr("selected");let s=typeof t=="object"?t:[t];for(let i of s)this.find(`option[value="${i}"]`).attr("selected","");return this}return this.attr("multiple")?r.toArray().map(s=>Rr(s.children)):r.attr("value")}case"input":case"option":return e?this.attr("value"):this.attr("value",t)}}function F_(t,e){!t.attribs||!sa.call(t.attribs,e)||delete t.attribs[e]}function gu(t){return t?t.trim().split(ia):[]}function bN(t){let e=gu(t);for(let n of e)Ae(this,r=>{$(r)&&F_(r,n)});return this}function _N(t){return this.toArray().some(e=>{let n=$(e)&&e.attribs.class,r=-1;if(n&&t.length>0)for(;(r=n.indexOf(t,r+1))>-1;){let s=r+t.length;if((r===0||ia.test(n[r-1]))&&(s===n.length||ia.test(n[s])))return!0}return!1})}function B_(t){if(typeof t=="function")return Ae(this,(r,s)=>{if($(r)){let i=r.attribs.class||"";B_.call([r],t.call(r,s,i))}});if(!t||typeof t!="string")return this;let e=t.split(ia),n=this.length;for(let r=0;r{$(s)&&j_.call([s],t.call(s,i,s.attribs.class||""))});let e=gu(t),n=e.length,r=arguments.length===0;return Ae(this,s=>{if(!!$(s))if(r)s.attribs.class="";else{let i=gu(s.attribs.class),a=!1;for(let o=0;o=0&&(i.splice(c,1),a=!0,o--)}a&&(s.attribs.class=i.join(" "))}})}function H_(t,e){if(typeof t=="function")return Ae(this,(a,o)=>{$(a)&&H_.call([a],t.call(a,o,a.attribs.class||"",e),e)});if(!t||typeof t!="string")return this;let n=t.split(ia),r=n.length,s=typeof e=="boolean"?e?1:-1:0,i=this.length;for(let a=0;a=0&&h<0?c.push(n[l]):s<=0&&h>=0&&c.splice(h,1)}o.attribs.class=c.join(" ")}return this}var sa,ia,Vf,qf,lN,U_=x(()=>{js();Hs();Qe();Gt();sa=Object.prototype.hasOwnProperty,ia=/\s+/,Vf="data-",qf=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,lN=/^{[^]*}$|^\[[^]*]$/});var Q,Fe,Wf=x(()=>{(function(t){t.Attribute="attribute",t.Pseudo="pseudo",t.PseudoElement="pseudo-element",t.Tag="tag",t.Universal="universal",t.Adjacent="adjacent",t.Child="child",t.Descendant="descendant",t.Parent="parent",t.Sibling="sibling",t.ColumnCombinator="column-combinator"})(Q||(Q={}));(function(t){t.Any="any",t.Element="element",t.End="end",t.Equals="equals",t.Exists="exists",t.Hyphen="hyphen",t.Not="not",t.Start="start"})(Fe||(Fe={}))});function Pr(t){switch(t.type){case Q.Adjacent:case Q.Child:case Q.Descendant:case Q.Parent:case Q.Sibling:case Q.ColumnCombinator:return!0;default:return!1}}function AN(t,e,n){let r=parseInt(e,16)-65536;return r!==r||n?e:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)}function aa(t){return t.replace(EN,AN)}function Gf(t){return t===39||t===34}function V_(t){return t===32||t===9||t===10||t===12||t===13}function Sn(t){let e=[],n=q_(e,`${t}`,0);if(n0&&n0&&Pr(r[r.length-1]))throw new Error("Did not expect successive traversals.")}function l(f){if(r.length>0&&r[r.length-1].type===Q.Descendant){r[r.length-1].type=f;return}c(),r.push({type:f})}function h(f,p){r.push({type:Q.Attribute,name:f,action:p,value:s(1),namespace:null,ignoreCase:"quirks"})}function d(){if(r.length&&r[r.length-1].type===Q.Descendant&&r.pop(),r.length===0)throw new Error("Empty sub-selector");t.push(r)}if(i(0),e.length===n)return n;e:for(;n{Wf();z_=/^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/,EN=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,TN=new Map([[126,Fe.Element],[94,Fe.Start],[36,Fe.End],[42,Fe.Any],[33,Fe.Not],[124,Fe.Hyphen]]),xN=new Set(["has","not","matches","is","where","host","host-context"]);yN=new Set(["contains","icontains"])});var zs=x(()=>{Wf();K_()});var sr=kn((s9,Y_)=>{Y_.exports={trueFunc:function(){return!0},falseFunc:function(){return!1}}});function oa(t){return!W_.has(t.type)}function $f(t){let e=t.map(G_);for(let n=1;n=0&&r>=1)):t.type===Q.Pseudo&&(t.data?t.name==="has"||t.name==="contains"?r=0:Array.isArray(t.data)?(r=Math.min(...t.data.map(s=>Math.min(...s.map(G_)))),r<0&&(r=0)):r=2:r=3),r}var W_,CN,Qf=x(()=>{zs();W_=new Map([[Q.Universal,50],[Q.Tag,30],[Q.Attribute,1],[Q.Pseudo,0]]);CN=new Map([[Fe.Exists,10],[Fe.Equals,8],[Fe.Not,7],[Fe.Start,6],[Fe.End,6],[Fe.Any,5]])});function $_(t){return t.replace(SN,"\\$&")}function Mr(t,e){return typeof t.ignoreCase=="boolean"?t.ignoreCase:t.ignoreCase==="quirks"?!!e.quirksMode:!e.xmlMode&&IN.has(t.name)}var ua,SN,IN,Q_,X_=x(()=>{ua=_e(sr()),SN=/[-[\]{}()*+?.,\\^$|#\s]/g;IN=new Set(["accept","accept-charset","align","alink","axis","bgcolor","charset","checked","clear","codetype","color","compact","declare","defer","dir","direction","disabled","enctype","face","frame","hreflang","http-equiv","lang","language","link","media","method","multiple","nohref","noresize","noshade","nowrap","readonly","rel","rev","rules","scope","scrolling","selected","shape","target","text","type","valign","valuetype","vlink"]);Q_={equals(t,e,n){let{adapter:r}=n,{name:s}=e,{value:i}=e;return Mr(e,n)?(i=i.toLowerCase(),a=>{let o=r.getAttributeValue(a,s);return o!=null&&o.length===i.length&&o.toLowerCase()===i&&t(a)}):a=>r.getAttributeValue(a,s)===i&&t(a)},hyphen(t,e,n){let{adapter:r}=n,{name:s}=e,{value:i}=e,a=i.length;return Mr(e,n)?(i=i.toLowerCase(),function(c){let l=r.getAttributeValue(c,s);return l!=null&&(l.length===a||l.charAt(a)==="-")&&l.substr(0,a).toLowerCase()===i&&t(c)}):function(c){let l=r.getAttributeValue(c,s);return l!=null&&(l.length===a||l.charAt(a)==="-")&&l.substr(0,a)===i&&t(c)}},element(t,e,n){let{adapter:r}=n,{name:s,value:i}=e;if(/\s/.test(i))return ua.default.falseFunc;let a=new RegExp(`(?:^|\\s)${$_(i)}(?:$|\\s)`,Mr(e,n)?"i":"");return function(c){let l=r.getAttributeValue(c,s);return l!=null&&l.length>=i.length&&a.test(l)&&t(c)}},exists(t,{name:e},{adapter:n}){return r=>n.hasAttrib(r,e)&&t(r)},start(t,e,n){let{adapter:r}=n,{name:s}=e,{value:i}=e,a=i.length;return a===0?ua.default.falseFunc:Mr(e,n)?(i=i.toLowerCase(),o=>{let c=r.getAttributeValue(o,s);return c!=null&&c.length>=a&&c.substr(0,a).toLowerCase()===i&&t(o)}):o=>{var c;return!!((c=r.getAttributeValue(o,s))===null||c===void 0?void 0:c.startsWith(i))&&t(o)}},end(t,e,n){let{adapter:r}=n,{name:s}=e,{value:i}=e,a=-i.length;return a===0?ua.default.falseFunc:Mr(e,n)?(i=i.toLowerCase(),o=>{var c;return((c=r.getAttributeValue(o,s))===null||c===void 0?void 0:c.substr(a).toLowerCase())===i&&t(o)}):o=>{var c;return!!((c=r.getAttributeValue(o,s))===null||c===void 0?void 0:c.endsWith(i))&&t(o)}},any(t,e,n){let{adapter:r}=n,{name:s,value:i}=e;if(i==="")return ua.default.falseFunc;if(Mr(e,n)){let a=new RegExp($_(i),"i");return function(c){let l=r.getAttributeValue(c,s);return l!=null&&l.length>=i.length&&a.test(l)&&t(c)}}return a=>{var o;return!!((o=r.getAttributeValue(a,s))===null||o===void 0?void 0:o.includes(i))&&t(a)}},not(t,e,n){let{adapter:r}=n,{name:s}=e,{value:i}=e;return i===""?a=>!!r.getAttributeValue(a,s)&&t(a):Mr(e,n)?(i=i.toLowerCase(),a=>{let o=r.getAttributeValue(a,s);return(o==null||o.length!==i.length||o.toLowerCase()!==i)&&t(a)}):a=>r.getAttributeValue(a,s)!==i&&t(a)}}});function J_(t){if(t=t.trim().toLowerCase(),t==="even")return[2,0];if(t==="odd")return[2,1];let e=0,n=0,r=i(),s=a();if(e=Z_&&t.charCodeAt(e)<=NN;)l=l*10+(t.charCodeAt(e)-Z_),e++;return e===c?null:l}function o(){for(;e{wN=new Set([9,10,12,13,32]),Z_="0".charCodeAt(0),NN="9".charCodeAt(0)});function tE(t){let e=t[0],n=t[1]-1;if(n<0&&e<=0)return Xf.default.falseFunc;if(e===-1)return i=>i<=n;if(e===0)return i=>i===n;if(e===1)return n<0?Xf.default.trueFunc:i=>i>=n;let r=Math.abs(e),s=(n%r+r)%r;return e>1?i=>i>=n&&i%r===s:i=>i<=n&&i%r===s}var Xf,nE=x(()=>{Xf=_e(sr())});function Vs(t){return tE(J_(t))}var rE=x(()=>{eE();nE()});function bu(t,e){return n=>{let r=e.getParent(n);return r!=null&&e.isTag(r)&&t(n)}}function Zf(t){return function(n,r,{adapter:s}){let i=s[t];return typeof i!="function"?_t.default.falseFunc:function(o){return i(o)&&n(o)}}}var _t,qs,sE=x(()=>{rE();_t=_e(sr());qs={contains(t,e,{adapter:n}){return function(s){return t(s)&&n.getText(s).includes(e)}},icontains(t,e,{adapter:n}){let r=e.toLowerCase();return function(i){return t(i)&&n.getText(i).toLowerCase().includes(r)}},"nth-child"(t,e,{adapter:n,equals:r}){let s=Vs(e);return s===_t.default.falseFunc?_t.default.falseFunc:s===_t.default.trueFunc?bu(t,n):function(a){let o=n.getSiblings(a),c=0;for(let l=0;l=0&&!r(a,o[l]);l--)n.isTag(o[l])&&c++;return s(c)&&t(a)}},"nth-of-type"(t,e,{adapter:n,equals:r}){let s=Vs(e);return s===_t.default.falseFunc?_t.default.falseFunc:s===_t.default.trueFunc?bu(t,n):function(a){let o=n.getSiblings(a),c=0;for(let l=0;l=0;l--){let h=o[l];if(r(a,h))break;n.isTag(h)&&n.getName(h)===n.getName(a)&&c++}return s(c)&&t(a)}},root(t,e,{adapter:n}){return r=>{let s=n.getParent(r);return(s==null||!n.isTag(s))&&t(r)}},scope(t,e,n,r){let{equals:s}=n;return!r||r.length===0?qs.root(t,e,n):r.length===1?i=>s(r[0],i)&&t(i):i=>r.includes(i)&&t(i)},hover:Zf("isHovered"),visited:Zf("isVisited"),active:Zf("isActive")}});function Jf(t,e,n,r){if(n===null){if(t.length>r)throw new Error(`Pseudo-class :${e} requires an argument`)}else if(t.length===r)throw new Error(`Pseudo-class :${e} doesn't have any arguments`)}var ca,iE=x(()=>{ca={empty(t,{adapter:e}){return!e.getChildren(t).some(n=>e.isTag(n)||e.getText(n)!=="")},"first-child"(t,{adapter:e,equals:n}){if(e.prevElementSibling)return e.prevElementSibling(t)==null;let r=e.getSiblings(t).find(s=>e.isTag(s));return r!=null&&n(t,r)},"last-child"(t,{adapter:e,equals:n}){let r=e.getSiblings(t);for(let s=r.length-1;s>=0;s--){if(n(t,r[s]))return!0;if(e.isTag(r[s]))break}return!1},"first-of-type"(t,{adapter:e,equals:n}){let r=e.getSiblings(t),s=e.getName(t);for(let i=0;i=0;i--){let a=r[i];if(n(t,a))return!0;if(e.isTag(a)&&e.getName(a)===s)break}return!1},"only-of-type"(t,{adapter:e,equals:n}){let r=e.getName(t);return e.getSiblings(t).every(s=>n(t,s)||!e.isTag(s)||e.getName(s)!==r)},"only-child"(t,{adapter:e,equals:n}){return e.getSiblings(t).every(r=>n(t,r)||!e.isTag(r))}}});var _u,aE=x(()=>{_u={"any-link":":is(a, area, link)[href]",link:":any-link:not(:visited)",disabled:`:is( + :is(button, input, select, textarea, optgroup, option)[disabled], + optgroup[disabled] > option, + fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *) + )`,enabled:":not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"}});function td(t,e){return t===Pt.default.falseFunc?Pt.default.falseFunc:n=>e.isTag(n)&&t(n)}function nd(t,e){let n=e.getSiblings(t);if(n.length<=1)return[];let r=n.indexOf(t);return r<0||r===n.length-1?[]:n.slice(r+1).filter(e.isTag)}function rd(t){return{xmlMode:!!t.xmlMode,lowerCaseAttributeNames:!!t.lowerCaseAttributeNames,lowerCaseTags:!!t.lowerCaseTags,quirksMode:!!t.quirksMode,cacheResults:!!t.cacheResults,pseudos:t.pseudos,adapter:t.adapter,equals:t.equals}}var Pt,ed,sd,Eu,Tu=x(()=>{Pt=_e(sr());Qf();ed={};sd=(t,e,n,r,s)=>{let i=s(e,rd(n),r);return i===Pt.default.trueFunc?t:i===Pt.default.falseFunc?Pt.default.falseFunc:a=>i(a)&&t(a)},Eu={is:sd,matches:sd,where:sd,not(t,e,n,r,s){let i=s(e,rd(n),r);return i===Pt.default.falseFunc?t:i===Pt.default.trueFunc?Pt.default.falseFunc:a=>!i(a)&&t(a)},has(t,e,n,r,s){let{adapter:i}=n,a=rd(n);a.relativeSelector=!0;let o=e.some(h=>h.some(oa))?[ed]:void 0,c=s(e,a,o);if(c===Pt.default.falseFunc)return Pt.default.falseFunc;let l=td(c,i);if(o&&c!==Pt.default.trueFunc){let{shouldTestNextSiblings:h=!1}=c;return d=>{if(!t(d))return!1;o[0]=d;let f=i.getChildren(d),p=h?[...f,...nd(d,i)]:f;return i.existsOne(l,p)}}return h=>t(h)&&i.existsOne(l,i.getChildren(h))}}});function oE(t,e,n,r,s){var i;let{name:a,data:o}=e;if(Array.isArray(o)){if(!(a in Eu))throw new Error(`Unknown pseudo-class :${a}(${o})`);return Eu[a](t,o,n,r,s)}let c=(i=n.pseudos)===null||i===void 0?void 0:i[a],l=typeof c=="string"?c:_u[a];if(typeof l=="string"){if(o!=null)throw new Error(`Pseudo ${a} doesn't have any arguments`);let h=Sn(l);return Eu.is(t,h,n,r,s)}if(typeof c=="function")return Jf(c,a,o,1),h=>c(h,o)&&t(h);if(a in qs)return qs[a](t,o,n,r);if(a in ca){let h=ca[a];return Jf(h,a,o,2),d=>h(d,n,o)&&t(d)}throw new Error(`Unknown pseudo-class :${a}`)}var id=x(()=>{zs();sE();iE();aE();Tu()});function ad(t,e){let n=e.getParent(t);return n&&e.isTag(n)?n:null}function uE(t,e,n,r,s){let{adapter:i,equals:a}=n;switch(e.type){case Q.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case Q.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case Q.Attribute:{if(e.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!n.xmlMode||n.lowerCaseAttributeNames)&&(e.name=e.name.toLowerCase()),Q_[e.action](t,e,n)}case Q.Pseudo:return oE(t,e,n,r,s);case Q.Tag:{if(e.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:o}=e;return(!n.xmlMode||n.lowerCaseTags)&&(o=o.toLowerCase()),function(l){return i.getName(l)===o&&t(l)}}case Q.Descendant:{if(n.cacheResults===!1||typeof WeakSet=="undefined")return function(l){let h=l;for(;h=ad(h,i);)if(t(h))return!0;return!1};let o=new WeakSet;return function(l){let h=l;for(;h=ad(h,i);)if(!o.has(h)){if(i.isTag(h)&&t(h))return!0;o.add(h)}return!1}}case"_flexibleDescendant":return function(c){let l=c;do if(t(l))return!0;while(l=ad(l,i));return!1};case Q.Parent:return function(c){return i.getChildren(c).some(l=>i.isTag(l)&&t(l))};case Q.Child:return function(c){let l=i.getParent(c);return l!=null&&i.isTag(l)&&t(l)};case Q.Sibling:return function(c){let l=i.getSiblings(c);for(let h=0;h{X_();id();zs()});function lE(t,e,n){let r=xu(t,e,n);return td(r,e.adapter)}function xu(t,e,n){let r=typeof t=="string"?Sn(t):t;return yu(r,e,n)}function fE(t){return t.type===Q.Pseudo&&(t.name==="scope"||Array.isArray(t.data)&&t.data.some(e=>e.some(fE)))}function kN(t,{adapter:e},n){let r=!!(n==null?void 0:n.every(s=>{let i=e.isTag(s)&&e.getParent(s);return s===ed||i&&e.isTag(i)}));for(let s of t){if(!(s.length>0&&oa(s[0])&&s[0].type!==Q.Descendant))if(r&&!s.some(fE))s.unshift(vN);else continue;s.unshift(ON)}}function yu(t,e,n){var r;t.forEach($f),n=(r=e.context)!==null&&r!==void 0?r:n;let s=Array.isArray(n),i=n&&(Array.isArray(n)?n:[n]);if(e.relativeSelector!==!1)kN(t,e,i);else if(t.some(c=>c.length>0&&oa(c[0])))throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let a=!1,o=t.map(c=>{if(c.length>=2){let[l,h]=c;l.type!==Q.Pseudo||l.name!=="scope"||(s&&h.type===Q.Descendant?c[1]=DN:(h.type===Q.Adjacent||h.type===Q.Sibling)&&(a=!0))}return RN(c,e,i)}).reduce(LN,In.default.falseFunc);return o.shouldTestNextSiblings=a,o}function RN(t,e,n){var r;return t.reduce((s,i)=>s===In.default.falseFunc?In.default.falseFunc:uE(s,i,e,n,yu),(r=e.rootFunc)!==null&&r!==void 0?r:In.default.trueFunc)}function LN(t,e){return e===In.default.falseFunc||t===In.default.trueFunc?t:t===In.default.falseFunc||e===In.default.trueFunc?e:function(r){return t(r)||e(r)}}var In,vN,DN,ON,dE=x(()=>{zs();In=_e(sr());Qf();cE();Tu();vN={type:Q.Descendant},DN={type:"_flexibleDescendant"},ON={type:Q.Pseudo,name:"scope",data:null}});function pE(t){var e,n,r,s;let i=t??PN;return(e=i.adapter)!==null&&e!==void 0||(i.adapter=rr),(n=i.equals)!==null&&n!==void 0||(i.equals=(s=(r=i.adapter)===null||r===void 0?void 0:r.equals)!==null&&s!==void 0?s:hE),i}function ud(t){return function(n,r,s){let i=pE(r);return t(n,i,s)}}function mE(t){return function(n,r,s){let i=pE(s);typeof n!="function"&&(n=xu(n,i,r));let a=Cu(r,i.adapter,n.shouldTestNextSiblings);return t(n,a,i)}}function Cu(t,e,n=!1){return n&&(t=MN(t,e)),Array.isArray(t)?e.removeSubsets(t):e.getChildren(t)}function MN(t,e){let n=Array.isArray(t)?t.slice(0):[t],r=n.length;for(let s=0;s{Gt();od=_e(sr());dE();Tu();id();hE=(t,e)=>t===e,PN={adapter:rr,equals:hE};F9=ud(lE),B9=ud(xu),Au=ud(yu);j9=mE((t,e,n)=>t===od.default.falseFunc||!e||e.length===0?[]:n.adapter.findAll(t,e)),H9=mE((t,e,n)=>t===od.default.falseFunc||!e||e.length===0?null:n.adapter.findOne(t,e))});function Ks(t){return t.type!=="pseudo"?!1:FN.has(t.name)?!0:t.name==="not"&&Array.isArray(t.data)?t.data.some(e=>e.some(Ks)):!1}function gE(t,e,n){let r=e!=null?parseInt(e,10):NaN;switch(t){case"first":return 1;case"nth":case"eq":return isFinite(r)?r>=0?r+1:1/0:0;case"lt":return isFinite(r)?r>=0?Math.min(r,n):1/0:0;case"gt":return isFinite(r)?1/0:0;case"odd":return 2*n;case"even":return 2*n-1;case"last":case"not":return 1/0}}var FN,ld=x(()=>{FN=new Set(["first","last","eq","gt","nth","lt","even","odd"])});function bE(t){for(;t.parent;)t=t.parent;return t}function Su(t){let e=[],n=[];for(let r of t)r.some(Ks)?e.push(r):n.push(r);return[n,e]}var _E=x(()=>{ld()});function fd(t,e,n={}){return dd([t],e,n)}function dd(t,e,n={}){if(typeof e=="function")return t.some(e);let[r,s]=Su(Sn(e));return r.length>0&&t.some(Au(r,n))||s.some(i=>TE(i,t,n).length>0)}function HN(t,e,n,r){let s=typeof n=="string"?parseInt(n,10):NaN;switch(t){case"first":case"lt":return e;case"last":return e.length>0?[e[e.length-1]]:e;case"nth":case"eq":return isFinite(s)&&Math.abs(s)a%2==0);case"odd":return e.filter((i,a)=>a%2==1);case"not":{let i=new Set(EE(n,e,r));return e.filter(a=>!i.has(a))}}}function hd(t,e,n={}){return EE(Sn(t),e,n)}function EE(t,e,n){if(e.length===0)return[];let[r,s]=Su(t),i;if(r.length){let a=md(e,r,n);if(s.length===0)return a;a.length&&(i=new Set(a))}for(let a=0;a$(h)&&!i.has(h)):e).length===0)break;let l=TE(o,e,n);if(l.length)if(i)l.forEach(h=>i.add(h));else{if(a===s.length-1)return l;i=new Set(l)}}return typeof i!="undefined"?i.size===e.length?e:e.filter(a=>i.has(a)):[]}function TE(t,e,n){var r;if(t.some(Pr)){let s=(r=n.root)!==null&&r!==void 0?r:bE(e[0]),i=ce(B({},n),{context:e,relativeSelector:!1});return t.push(jN),wu(s,t,i,!0,e.length)}return wu(e,t,n,!1,e.length)}function xE(t,e,n={},r=1/0){if(typeof t=="function")return yE(e,t);let[s,i]=Su(Sn(t)),a=i.map(o=>wu(e,o,n,!0,r));return s.length&&a.push(pd(e,s,n,r)),a.length===0?[]:a.length===1?a[0]:kr(a.reduce((o,c)=>[...o,...c]))}function wu(t,e,n,r,s){let i=e.findIndex(Ks),a=e.slice(0,i),o=e[i],c=e.length-1===i?s:1/0,l=gE(o.name,o.data,c);if(l===0)return[];let d=(a.length===0&&!Array.isArray(t)?Ji(t).filter($):a.length===0?(Array.isArray(t)?t:[t]).filter($):r||a.some(Pr)?pd(t,[a],n,l):md(t,[a],n)).slice(0,l),f=HN(o.name,d,o.data,n);if(f.length===0||e.length===i+1)return f;let p=e.slice(i+1),E=p.some(Pr);if(E){if(Pr(p[0])){let{type:T}=p[0];(T===Q.Sibling||T===Q.Adjacent)&&(f=Cu(f,rr,!0)),p.unshift(BN)}n=ce(B({},n),{relativeSelector:!1,rootFunc:T=>f.includes(T)})}else n.rootFunc&&n.rootFunc!==Iu.trueFunc&&(n=ce(B({},n),{rootFunc:Iu.trueFunc}));return p.some(Ks)?wu(f,p,n,!1,s):E?pd(f,[p],n,s):md(f,[p],n)}function pd(t,e,n,r){let s=Au(e,n,t);return yE(t,s,r)}function yE(t,e,n=1/0){let r=Cu(t,rr,e.shouldTestNextSiblings);return Mf(s=>$(s)&&e(s),r,!0,n)}function md(t,e,n){let r=(Array.isArray(t)?t:[t]).filter($);if(r.length===0)return r;let s=Au(e,n);return s===Iu.trueFunc?r:r.filter(s)}var Iu,BN,jN,AE=x(()=>{zs();cd();Gt();Iu=_e(sr());_E();ld();cd();BN={type:Q.Universal,namespace:null},jN={type:Q.Pseudo,name:"scope",data:null}});var Td={};It(Td,{_findBySelector:()=>VN,add:()=>bv,addBack:()=>_v,children:()=>tv,closest:()=>WN,contents:()=>nv,each:()=>rv,end:()=>gv,eq:()=>fv,filter:()=>iv,filterArray:()=>Ed,find:()=>zN,first:()=>cv,get:()=>dv,has:()=>uv,index:()=>pv,is:()=>av,last:()=>lv,map:()=>sv,next:()=>GN,nextAll:()=>$N,nextUntil:()=>QN,not:()=>ov,parent:()=>qN,parents:()=>KN,parentsUntil:()=>YN,prev:()=>XN,prevAll:()=>ZN,prevUntil:()=>JN,siblings:()=>ev,slice:()=>mv,toArray:()=>hv});function zN(t){if(!t)return this._make([]);if(typeof t!="string"){let e=Lt(t)?t.toArray():[t],n=this.toArray();return this._make(e.filter(r=>n.some(s=>na(s,r))))}return this._findBySelector(t,Number.POSITIVE_INFINITY)}function VN(t,e){var n;let r=this.toArray(),s=UN.test(t)?r:this.children().toArray(),i={context:r,root:(n=this._root)===null||n===void 0?void 0:n[0],xmlMode:this.options.xmlMode,lowerCaseTags:this.options.lowerCaseTags,lowerCaseAttributeNames:this.options.lowerCaseAttributeNames,pseudos:this.options.pseudos,quirksMode:this.options.quirksMode};return this._make(xE(t,s,i,e))}function gd(t){return function(e,...n){return function(r){var s;let i=t(e,this);return r&&(i=Ed(i,r,this.options.xmlMode,(s=this._root)===null||s===void 0?void 0:s[0])),this._make(this.length>1&&i.length>1?n.reduce((a,o)=>o(a),i):i)}}}function _d(t,...e){let n=null,r=gd((s,i)=>{let a=[];return Ae(i,o=>{for(let c;(c=s(o))&&!(n==null?void 0:n(c,a.length));o=c)a.push(c)}),a})(t,...e);return function(s,i){n=typeof s=="string"?o=>fd(o,s,this.options):s?fa(s):null;let a=r.call(this,i);return n=null,a}}function Ys(t){return t.length>1?Array.from(new Set(t)):t}function WN(t){var e;let n=[];if(!t)return this._make(n);let r={xmlMode:this.options.xmlMode,root:(e=this._root)===null||e===void 0?void 0:e[0]},s=typeof t=="string"?i=>fd(i,t,r):fa(t);return Ae(this,i=>{for(i&&!kt(i)&&!$(i)&&(i=i.parent);i&&$(i);){if(s(i,0)){n.includes(i)||n.push(i);break}i=i.parent}}),this._make(n)}function nv(){let t=this.toArray().reduce((e,n)=>De(n)?e.concat(n.children):e,[]);return this._make(t)}function rv(t){let e=0,n=this.length;for(;et.call(e,n,e):Lt(t)?e=>Array.prototype.includes.call(t,e):function(e){return t===e}}function iv(t){var e;return this._make(Ed(this.toArray(),t,this.options.xmlMode,(e=this._root)===null||e===void 0?void 0:e[0]))}function Ed(t,e,n,r){return typeof e=="string"?hd(e,t,{xmlMode:n,root:r}):t.filter(fa(e))}function av(t){let e=this.toArray();return typeof t=="string"?dd(e.filter($),t,this.options):t?e.some(fa(t)):!1}function ov(t){let e=this.toArray();if(typeof t=="string"){let n=new Set(hd(t,e,this.options));e=e.filter(r=>!n.has(r))}else{let n=fa(t);e=e.filter((r,s)=>!n(r,s))}return this._make(e)}function uv(t){return this.filter(typeof t=="string"?`:has(${t})`:(e,n)=>this._make(n).find(t).length>0)}function cv(){return this.length>1?this._make(this[0]):this}function lv(){return this.length>0?this._make(this[this.length-1]):this}function fv(t){var e;return t=+t,t===0&&this.length<=1?this:(t<0&&(t=this.length+t),this._make((e=this[t])!==null&&e!==void 0?e:[]))}function dv(t){return t==null?this.toArray():this[t<0?this.length+t:t]}function hv(){return Array.prototype.slice.call(this)}function pv(t){let e,n;return t==null?(e=this.parent().children(),n=this[0]):typeof t=="string"?(e=this._make(t),n=this[0]):(e=this,n=Lt(t)?t[0]:t),Array.prototype.indexOf.call(e,n)}function mv(t,e){return this._make(Array.prototype.slice.call(this,t,e))}function gv(){var t;return(t=this.prevObject)!==null&&t!==void 0?t:this._make([])}function bv(t,e){let n=this._make(t,e),r=kr([...this.get(),...n.get()]);return this._make(r)}function _v(t){return this.prevObject?this.add(t?this.prevObject.filter(t):this.prevObject):this}var UN,la,bd,qN,KN,YN,GN,$N,QN,XN,ZN,JN,ev,tv,CE=x(()=>{Qe();AE();Hs();js();Gt();UN=/^\s*[+~]/;la=gd((t,e)=>{let n=[];for(let r=0;r0&&(n=n.concat(s))}return n}),bd=gd((t,e)=>{let n=[];for(let r=0;rt&&!kt(t)?t:null,Ys),KN=la(t=>{let e=[];for(;t.parent&&!kt(t.parent);)e.push(t.parent),t=t.parent;return e},kr,t=>t.reverse()),YN=_d(({parent:t})=>t&&!kt(t)?t:null,kr,t=>t.reverse());GN=bd(t=>lu(t)),$N=la(t=>{let e=[];for(;t.next;)t=t.next,$(t)&&e.push(t);return e},Ys),QN=_d(t=>lu(t),Ys),XN=bd(t=>fu(t)),ZN=la(t=>{let e=[];for(;t.prev;)t=t.prev,$(t)&&e.push(t);return e},Ys),JN=_d(t=>fu(t),Ys),ev=la(t=>Pf(t).filter(e=>$(e)&&e!==t),kr),tv=la(t=>Ji(t).filter($),Ys)});function SE(t){return function(n,r,s,i){if(typeof Buffer!="undefined"&&Buffer.isBuffer(n)&&(n=n.toString()),typeof n=="string")return t(n,r,s,i);let a=n;if(!Array.isArray(a)&&kt(a))return a;let o=new Ot([]);return ir(a,o),o}}function ir(t,e){let n=Array.isArray(t)?t:[t];e?e.children=n:e=null;for(let r=0;r{Gt();Qe()});var yd={};It(yd,{_makeDomArray:()=>Ev,after:()=>Nv,append:()=>yv,appendTo:()=>Tv,before:()=>Dv,clone:()=>Bv,empty:()=>Lv,html:()=>Pv,insertAfter:()=>vv,insertBefore:()=>Ov,prepend:()=>Av,prependTo:()=>xv,remove:()=>kv,replaceWith:()=>Rv,text:()=>Fv,toString:()=>Mv,unwrap:()=>Iv,wrap:()=>Cv,wrapAll:()=>wv,wrapInner:()=>Sv});function Ev(t,e){if(t==null)return[];if(typeof t=="string")return this._parse(t,this.options,!1,null).children.slice(0);if("length"in t){if(t.length===1)return this._makeDomArray(t[0],e);let n=[];for(let r=0;r{if(!De(r))return;let i=typeof e[0]=="function"?e[0].call(r,s,this._render(r.children)):e,a=this._makeDomArray(i,s=t.length?null:t[e+n];for(let h=0;h-1&&(f.children.splice(E,1),s===f&&e>E&&o[0]--)}d.parent=s,d.prev&&(d.prev.next=(i=d.next)!==null&&i!==void 0?i:null),d.next&&(d.next.prev=(a=d.prev)!==null&&a!==void 0?a:null),d.prev=h===0?c:r[h-1],d.next=h===r.length-1?l:r[h+1]}return c&&(c.next=r[0]),l&&(l.prev=r[r.length-1]),t.splice(...o)}function Tv(t){return(Lt(t)?t:this._make(t)).append(this),this}function xv(t){return(Lt(t)?t:this._make(t)).prepend(this),this}function wE(t){return function(e){let n=this.length-1,r=this.parents().last();for(let s=0;s{this._make(n).replaceWith(n.children)}),this}function wv(t){let e=this[0];if(e){let n=this._make(typeof t=="function"?t.call(e,0,e):t).insertBefore(e),r;for(let i=0;i{if(!De(n)||!n.parent)return;let s=n.parent.children,i=s.indexOf(n);if(i<0)return;let a=typeof t[0]=="function"?t[0].call(n,r,this._render(n.children)):t,o=this._makeDomArray(a,r{if(!De(n)||!n.parent)return;let s=n.parent.children,i=s.indexOf(n);if(i<0)return;let a=typeof t[0]=="function"?t[0].call(n,r,this._render(n.children)):t,o=this._makeDomArray(a,r{let s=this.clone().toArray(),{parent:i}=r;if(!i)return;let a=i.children,o=a.indexOf(r);o<0||(ar(a,o,0,s,i),n.push(...s))}),this._make(n)}function kv(t){let e=t?this.filter(t):this;return Ae(e,n=>{Cn(n),n.prev=n.next=n.parent=null}),this}function Rv(t){return Ae(this,(e,n)=>{let{parent:r}=e;if(!r)return;let s=r.children,i=typeof t=="function"?t.call(e,n,e):t,a=this._makeDomArray(i);ir(a,null);let o=s.indexOf(e);ar(s,o,1,a,r),a.includes(e)||(e.parent=e.prev=e.next=null)})}function Lv(){return Ae(this,t=>{if(!!De(t)){for(let e of t.children)e.next=e.prev=e.parent=null;t.children.length=0}})}function Pv(t){if(t===void 0){let e=this[0];return!e||!De(e)?null:this._render(e.children)}return Ae(this,e=>{if(!De(e))return;for(let r of e.children)r.next=r.prev=r.parent=null;let n=Lt(t)?t.toArray():this._parse(`${t}`,this.options,!1,e).children;ir(n,e)})}function Mv(){return this._render(this)}function Fv(t){return t===void 0?Rr(this):typeof t=="function"?Ae(this,(e,n)=>this._make(e).text(t.call(e,n,Rr([e])))):Ae(this,e=>{if(!De(e))return;for(let r of e.children)r.next=r.prev=r.parent=null;let n=new yn(`${t}`);ir(n,e)})}function Bv(){let t=Array.prototype.map.call(this.get(),n=>Rs(n,!0)),e=new Ot(t);for(let n of t)n.parent=e;return this._make(t)}var yv,Av,Cv,Sv,NE=x(()=>{Qe();xd();js();Hs();Gt();yv=IE((t,e,n)=>{ar(e,e.length,0,t,n)}),Av=IE((t,e,n)=>{ar(e,0,0,t,n)});Cv=wE((t,e,n)=>{let{parent:r}=t;if(!r)return;let s=r.children,i=s.indexOf(t);ir([t],e),ar(s,i,0,n,r)}),Sv=wE((t,e,n)=>{!De(t)||(ir(t.children,e),ir(n,t))})});var Ad={};It(Ad,{css:()=>jv});function jv(t,e){if(t!=null&&e!=null||typeof t=="object"&&!Array.isArray(t))return Ae(this,(n,r)=>{$(n)&&vE(n,t,e,r)});if(this.length!==0)return DE(this[0],t)}function vE(t,e,n,r){if(typeof e=="string"){let s=DE(t),i=typeof n=="function"?n.call(t,r,s[e]):n;i===""?delete s[e]:i!=null&&(s[e]=i),t.attribs.style=Hv(s)}else if(typeof e=="object"){let s=Object.keys(e);for(let i=0;i`${e}${e?" ":""}${n}: ${t[n]};`,"")}function Uv(t){if(t=(t||"").trim(),!t)return{};let e={},n;for(let r of t.split(";")){let s=r.indexOf(":");if(s<1||s===r.length-1){let i=r.trimEnd();i.length>0&&n!==void 0&&(e[n]+=`;${i}`)}else n=r.slice(0,s).trim(),e[n]=r.slice(s+1).trim()}return e}var OE=x(()=>{Hs();Qe()});var Cd={};It(Cd,{serialize:()=>Vv,serializeArray:()=>qv});function Vv(){return this.serializeArray().map(n=>`${encodeURIComponent(n.name)}=${encodeURIComponent(n.value)}`).join("&").replace(zv,"+")}function qv(){return this.map((t,e)=>{let n=this._make(e);return $(e)&&e.name==="form"?n.find(kE).toArray():n.filter(kE).toArray()}).filter('[name!=""]:enabled:not(:submit, :button, :image, :reset, :file):matches([checked], :not(:checkbox, :radio))').map((t,e)=>{var n;let r=this._make(e),s=r.attr("name"),i=(n=r.val())!==null&&n!==void 0?n:"";return Array.isArray(i)?i.map(a=>({name:s,value:a.replace(RE,`\r +`)})):{name:s,value:i.replace(RE,`\r +`)}}).toArray()}var kE,zv,RE,LE=x(()=>{Qe();kE="input,select,textarea,keygen",zv=/%20/g,RE=/\r?\n/g});var Sd={};It(Sd,{extract:()=>Yv});function Kv(t){var e;return typeof t=="string"?{selector:t,value:"textContent"}:{selector:t.selector,value:(e=t.value)!==null&&e!==void 0?e:"textContent"}}function Yv(t){let e={};for(let n in t){let r=t[n],s=Array.isArray(r),{selector:i,value:a}=Kv(s?r[0]:r),o=typeof a=="function"?a:typeof a=="string"?c=>this._make(c).prop(a):c=>this._make(c).extract(a);if(s)e[n]=this._findBySelector(i,Number.POSITIVE_INFINITY).map((c,l)=>o(l,n,e)).get();else{let c=this._findBySelector(i,1);e[n]=c.length>0?o(c[0],n,e):void 0}}return e}var PE=x(()=>{});var Fr,ME=x(()=>{U_();CE();NE();OE();LE();PE();Fr=class{constructor(e,n,r){if(this.length=0,this.options=r,this._root=n,e){for(let s=0;s{Hf();js();ME();Hs()});function Nu(t){return t>=55296&&t<=57343}function jE(t){return t>=56320&&t<=57343}function HE(t,e){return(t-55296)*1024+9216+e}function vu(t){return t!==32&&t!==10&&t!==13&&t!==9&&t!==12&&t>=1&&t<=31||t>=127&&t<=159}function Du(t){return t>=64976&&t<=65007||Gv.has(t)}var Gv,we,g,dt,Ou=x(()=>{Gv=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),we="\uFFFD";(function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(g||(g={}));dt={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"}});var D,da=x(()=>{(function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(D||(D={}))});var $v,Id,UE=x(()=>{Ou();da();$v=1<<16,Id=class{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=$v,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,n){let{line:r,col:s,offset:i}=this,a=s+n,o=i+n;return{code:e,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let n=this.html.charCodeAt(this.pos+1);if(jE(n))return this.pos++,this._addGap(),HE(e,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,g.EOF;return this._err(D.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,n){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,n){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(e,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,g.EOF;let r=this.html.charCodeAt(n);return r===g.CARRIAGE_RETURN?g.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,g.EOF;let e=this.html.charCodeAt(this.pos);return e===g.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,g.LINE_FEED):e===g.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Nu(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===g.LINE_FEED||e===g.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){vu(e)?this._err(D.controlCharacterInInputStream):Du(e)&&this._err(D.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}var fe,Ru=x(()=>{(function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"})(fe||(fe={}))});var Lu={};It(Lu,{ATTRS:()=>rn,DOCUMENT_MODE:()=>st,NS:()=>R,NUMBERED_HEADERS:()=>Ws,SPECIAL_ELEMENTS:()=>wd,TAG_ID:()=>u,TAG_NAMES:()=>v,getTagID:()=>or,hasUnescapedText:()=>Nd});function or(t){var e;return(e=Xv.get(t))!==null&&e!==void 0?e:u.UNKNOWN}function Nd(t,e){return Zv.has(t)||e&&t===v.NOSCRIPT}var R,rn,st,v,u,Xv,F,wd,Ws,Zv,wn=x(()=>{(function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"})(R||(R={}));(function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"})(rn||(rn={}));(function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"})(st||(st={}));(function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"})(v||(v={}));(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"})(u||(u={}));Xv=new Map([[v.A,u.A],[v.ADDRESS,u.ADDRESS],[v.ANNOTATION_XML,u.ANNOTATION_XML],[v.APPLET,u.APPLET],[v.AREA,u.AREA],[v.ARTICLE,u.ARTICLE],[v.ASIDE,u.ASIDE],[v.B,u.B],[v.BASE,u.BASE],[v.BASEFONT,u.BASEFONT],[v.BGSOUND,u.BGSOUND],[v.BIG,u.BIG],[v.BLOCKQUOTE,u.BLOCKQUOTE],[v.BODY,u.BODY],[v.BR,u.BR],[v.BUTTON,u.BUTTON],[v.CAPTION,u.CAPTION],[v.CENTER,u.CENTER],[v.CODE,u.CODE],[v.COL,u.COL],[v.COLGROUP,u.COLGROUP],[v.DD,u.DD],[v.DESC,u.DESC],[v.DETAILS,u.DETAILS],[v.DIALOG,u.DIALOG],[v.DIR,u.DIR],[v.DIV,u.DIV],[v.DL,u.DL],[v.DT,u.DT],[v.EM,u.EM],[v.EMBED,u.EMBED],[v.FIELDSET,u.FIELDSET],[v.FIGCAPTION,u.FIGCAPTION],[v.FIGURE,u.FIGURE],[v.FONT,u.FONT],[v.FOOTER,u.FOOTER],[v.FOREIGN_OBJECT,u.FOREIGN_OBJECT],[v.FORM,u.FORM],[v.FRAME,u.FRAME],[v.FRAMESET,u.FRAMESET],[v.H1,u.H1],[v.H2,u.H2],[v.H3,u.H3],[v.H4,u.H4],[v.H5,u.H5],[v.H6,u.H6],[v.HEAD,u.HEAD],[v.HEADER,u.HEADER],[v.HGROUP,u.HGROUP],[v.HR,u.HR],[v.HTML,u.HTML],[v.I,u.I],[v.IMG,u.IMG],[v.IMAGE,u.IMAGE],[v.INPUT,u.INPUT],[v.IFRAME,u.IFRAME],[v.KEYGEN,u.KEYGEN],[v.LABEL,u.LABEL],[v.LI,u.LI],[v.LINK,u.LINK],[v.LISTING,u.LISTING],[v.MAIN,u.MAIN],[v.MALIGNMARK,u.MALIGNMARK],[v.MARQUEE,u.MARQUEE],[v.MATH,u.MATH],[v.MENU,u.MENU],[v.META,u.META],[v.MGLYPH,u.MGLYPH],[v.MI,u.MI],[v.MO,u.MO],[v.MN,u.MN],[v.MS,u.MS],[v.MTEXT,u.MTEXT],[v.NAV,u.NAV],[v.NOBR,u.NOBR],[v.NOFRAMES,u.NOFRAMES],[v.NOEMBED,u.NOEMBED],[v.NOSCRIPT,u.NOSCRIPT],[v.OBJECT,u.OBJECT],[v.OL,u.OL],[v.OPTGROUP,u.OPTGROUP],[v.OPTION,u.OPTION],[v.P,u.P],[v.PARAM,u.PARAM],[v.PLAINTEXT,u.PLAINTEXT],[v.PRE,u.PRE],[v.RB,u.RB],[v.RP,u.RP],[v.RT,u.RT],[v.RTC,u.RTC],[v.RUBY,u.RUBY],[v.S,u.S],[v.SCRIPT,u.SCRIPT],[v.SEARCH,u.SEARCH],[v.SECTION,u.SECTION],[v.SELECT,u.SELECT],[v.SOURCE,u.SOURCE],[v.SMALL,u.SMALL],[v.SPAN,u.SPAN],[v.STRIKE,u.STRIKE],[v.STRONG,u.STRONG],[v.STYLE,u.STYLE],[v.SUB,u.SUB],[v.SUMMARY,u.SUMMARY],[v.SUP,u.SUP],[v.TABLE,u.TABLE],[v.TBODY,u.TBODY],[v.TEMPLATE,u.TEMPLATE],[v.TEXTAREA,u.TEXTAREA],[v.TFOOT,u.TFOOT],[v.TD,u.TD],[v.TH,u.TH],[v.THEAD,u.THEAD],[v.TITLE,u.TITLE],[v.TR,u.TR],[v.TRACK,u.TRACK],[v.TT,u.TT],[v.U,u.U],[v.UL,u.UL],[v.SVG,u.SVG],[v.VAR,u.VAR],[v.WBR,u.WBR],[v.XMP,u.XMP]]);F=u,wd={[R.HTML]:new Set([F.ADDRESS,F.APPLET,F.AREA,F.ARTICLE,F.ASIDE,F.BASE,F.BASEFONT,F.BGSOUND,F.BLOCKQUOTE,F.BODY,F.BR,F.BUTTON,F.CAPTION,F.CENTER,F.COL,F.COLGROUP,F.DD,F.DETAILS,F.DIR,F.DIV,F.DL,F.DT,F.EMBED,F.FIELDSET,F.FIGCAPTION,F.FIGURE,F.FOOTER,F.FORM,F.FRAME,F.FRAMESET,F.H1,F.H2,F.H3,F.H4,F.H5,F.H6,F.HEAD,F.HEADER,F.HGROUP,F.HR,F.HTML,F.IFRAME,F.IMG,F.INPUT,F.LI,F.LINK,F.LISTING,F.MAIN,F.MARQUEE,F.MENU,F.META,F.NAV,F.NOEMBED,F.NOFRAMES,F.NOSCRIPT,F.OBJECT,F.OL,F.P,F.PARAM,F.PLAINTEXT,F.PRE,F.SCRIPT,F.SECTION,F.SELECT,F.SOURCE,F.STYLE,F.SUMMARY,F.TABLE,F.TBODY,F.TD,F.TEMPLATE,F.TEXTAREA,F.TFOOT,F.TH,F.THEAD,F.TITLE,F.TR,F.TRACK,F.UL,F.WBR,F.XMP]),[R.MATHML]:new Set([F.MI,F.MO,F.MN,F.MS,F.MTEXT,F.ANNOTATION_XML]),[R.SVG]:new Set([F.TITLE,F.FOREIGN_OBJECT,F.DESC]),[R.XLINK]:new Set,[R.XML]:new Set,[R.XMLNS]:new Set},Ws=new Set([F.H1,F.H2,F.H3,F.H4,F.H5,F.H6]),Zv=new Set([v.STYLE,v.SCRIPT,v.XMP,v.IFRAME,v.NOEMBED,v.NOFRAMES,v.PLAINTEXT])});function Jv(t){return t>=g.DIGIT_0&&t<=g.DIGIT_9}function ha(t){return t>=g.LATIN_CAPITAL_A&&t<=g.LATIN_CAPITAL_Z}function e6(t){return t>=g.LATIN_SMALL_A&&t<=g.LATIN_SMALL_Z}function ur(t){return e6(t)||ha(t)}function zE(t){return ur(t)||Jv(t)}function Pu(t){return t+32}function VE(t){return t===g.SPACE||t===g.LINE_FEED||t===g.TABULATION||t===g.FORM_FEED}function qE(t){return VE(t)||t===g.SOLIDUS||t===g.GREATER_THAN_SIGN}function t6(t){return t===g.NULL?D.nullCharacterReference:t>1114111?D.characterReferenceOutsideUnicodeRange:Nu(t)?D.surrogateCharacterReference:Du(t)?D.noncharacterCharacterReference:vu(t)||t===g.CARRIAGE_RETURN?D.controlCharacterReference:null}var _,it,Mu,vd=x(()=>{UE();Ou();Ru();Ms();da();wn();(function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(_||(_={}));it={DATA:_.DATA,RCDATA:_.RCDATA,RAWTEXT:_.RAWTEXT,SCRIPT_DATA:_.SCRIPT_DATA,PLAINTEXT:_.PLAINTEXT,CDATA_SECTION:_.CDATA_SECTION};Mu=class{constructor(e,n){this.options=e,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=_.DATA,this.returnState=_.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Id(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Dr(Ls,(r,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(D.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(D.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{let s=t6(r);s&&this._err(s,1)}}:void 0)}_err(e,n=0){var r,s;(s=(r=this.handler).onParseError)===null||s===void 0||s.call(r,this.preprocessor.getError(e,n))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e==null||e())}write(e,n,r){this.active=!0,this.preprocessor.write(e,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let n=0;n0&&this._err(D.endTagWithAttributes),e.selfClosing&&this._err(D.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case fe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case fe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case fe.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:fe.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,n)}_emitCodePoint(e){let n=VE(e)?fe.WHITESPACE_CHARACTER:e===g.NULL?fe.NULL_CHARACTER:fe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(fe.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=_.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?rt.Attribute:rt.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===_.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===_.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===_.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case _.DATA:{this._stateData(e);break}case _.RCDATA:{this._stateRcdata(e);break}case _.RAWTEXT:{this._stateRawtext(e);break}case _.SCRIPT_DATA:{this._stateScriptData(e);break}case _.PLAINTEXT:{this._statePlaintext(e);break}case _.TAG_OPEN:{this._stateTagOpen(e);break}case _.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case _.TAG_NAME:{this._stateTagName(e);break}case _.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case _.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case _.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case _.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case _.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case _.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case _.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case _.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case _.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case _.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case _.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case _.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case _.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case _.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case _.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case _.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case _.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case _.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case _.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case _.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case _.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case _.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case _.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case _.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case _.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case _.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case _.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case _.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case _.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case _.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case _.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case _.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case _.BOGUS_COMMENT:{this._stateBogusComment(e);break}case _.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case _.COMMENT_START:{this._stateCommentStart(e);break}case _.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case _.COMMENT:{this._stateComment(e);break}case _.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case _.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case _.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case _.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case _.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case _.COMMENT_END:{this._stateCommentEnd(e);break}case _.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case _.DOCTYPE:{this._stateDoctype(e);break}case _.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case _.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case _.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case _.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case _.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case _.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case _.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case _.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case _.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case _.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case _.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case _.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case _.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case _.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case _.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case _.CDATA_SECTION:{this._stateCdataSection(e);break}case _.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case _.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case _.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case _.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case g.LESS_THAN_SIGN:{this.state=_.TAG_OPEN;break}case g.AMPERSAND:{this._startCharacterReference();break}case g.NULL:{this._err(D.unexpectedNullCharacter),this._emitCodePoint(e);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case g.AMPERSAND:{this._startCharacterReference();break}case g.LESS_THAN_SIGN:{this.state=_.RCDATA_LESS_THAN_SIGN;break}case g.NULL:{this._err(D.unexpectedNullCharacter),this._emitChars(we);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case g.LESS_THAN_SIGN:{this.state=_.RAWTEXT_LESS_THAN_SIGN;break}case g.NULL:{this._err(D.unexpectedNullCharacter),this._emitChars(we);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case g.LESS_THAN_SIGN:{this.state=_.SCRIPT_DATA_LESS_THAN_SIGN;break}case g.NULL:{this._err(D.unexpectedNullCharacter),this._emitChars(we);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case g.NULL:{this._err(D.unexpectedNullCharacter),this._emitChars(we);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(ur(e))this._createStartTagToken(),this.state=_.TAG_NAME,this._stateTagName(e);else switch(e){case g.EXCLAMATION_MARK:{this.state=_.MARKUP_DECLARATION_OPEN;break}case g.SOLIDUS:{this.state=_.END_TAG_OPEN;break}case g.QUESTION_MARK:{this._err(D.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=_.BOGUS_COMMENT,this._stateBogusComment(e);break}case g.EOF:{this._err(D.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(D.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=_.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(ur(e))this._createEndTagToken(),this.state=_.TAG_NAME,this._stateTagName(e);else switch(e){case g.GREATER_THAN_SIGN:{this._err(D.missingEndTagName),this.state=_.DATA;break}case g.EOF:{this._err(D.eofBeforeTagName),this._emitChars("");break}case g.NULL:{this._err(D.unexpectedNullCharacter),this.state=_.SCRIPT_DATA_ESCAPED,this._emitChars(we);break}case g.EOF:{this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=_.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===g.SOLIDUS?this.state=_.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:ur(e)?(this._emitChars("<"),this.state=_.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=_.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){ur(e)?(this.state=_.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("");break}case g.NULL:{this._err(D.unexpectedNullCharacter),this.state=_.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(we);break}case g.EOF:{this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=_.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===g.SOLIDUS?(this.state=_.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=_.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(dt.SCRIPT,!1)&&qE(this.preprocessor.peek(dt.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n{wn();KE=new Set([u.DD,u.DT,u.LI,u.OPTGROUP,u.OPTION,u.P,u.RB,u.RP,u.RT,u.RTC]),YE=new Set([...KE,u.CAPTION,u.COLGROUP,u.TBODY,u.TD,u.TFOOT,u.TH,u.THEAD,u.TR]),Fu=new Set([u.APPLET,u.CAPTION,u.HTML,u.MARQUEE,u.OBJECT,u.TABLE,u.TD,u.TEMPLATE,u.TH]),n6=new Set([...Fu,u.OL,u.UL]),r6=new Set([...Fu,u.BUTTON]),WE=new Set([u.ANNOTATION_XML,u.MI,u.MN,u.MO,u.MS,u.MTEXT]),GE=new Set([u.DESC,u.FOREIGN_OBJECT,u.TITLE]),s6=new Set([u.TR,u.TEMPLATE,u.HTML]),i6=new Set([u.TBODY,u.TFOOT,u.THEAD,u.TEMPLATE,u.HTML]),a6=new Set([u.TABLE,u.TEMPLATE,u.HTML]),o6=new Set([u.TD,u.TH]),Dd=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=u.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===u.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===R.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,n){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,n,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,n){let r=this._indexOf(e);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(e,n,r){let s=this._indexOf(e)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,r),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(e){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(e,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==R.HTML);this.shortenToLength(n<0?0:n)}shortenToLength(e){for(;this.stackTop>=e;){let n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(e,n){let r=this._indexOfTagNames(e,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(a6,R.HTML)}clearBackToTableBodyContext(){this.clearBackTo(i6,R.HTML)}clearBackToTableRowContext(){this.clearBackTo(s6,R.HTML)}remove(e){let n=this._indexOf(e);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===u.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let n=this._indexOf(e)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===u.HTML}hasInDynamicScope(e,n){for(let r=this.stackTop;r>=0;r--){let s=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case R.HTML:{if(s===e)return!0;if(n.has(s))return!1;break}case R.SVG:{if(GE.has(s))return!1;break}case R.MATHML:{if(WE.has(s))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Fu)}hasInListItemScope(e){return this.hasInDynamicScope(e,n6)}hasInButtonScope(e){return this.hasInDynamicScope(e,r6)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let n=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case R.HTML:{if(Ws.has(n))return!0;if(Fu.has(n))return!1;break}case R.SVG:{if(GE.has(n))return!1;break}case R.MATHML:{if(WE.has(n))return!1;break}}}return!0}hasInTableScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===R.HTML)switch(this.tagIDs[n]){case e:return!0;case u.TABLE:case u.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===R.HTML)switch(this.tagIDs[e]){case u.TBODY:case u.THEAD:case u.TFOOT:return!0;case u.TABLE:case u.HTML:return!1}return!0}hasInSelectScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===R.HTML)switch(this.tagIDs[n]){case e:return!0;case u.OPTION:case u.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;KE.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;YE.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==e&&YE.has(this.currentTagId);)this.pop()}}});var Od,$t,QE,kd,XE=x(()=>{Od=3;(function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"})($t||($t={}));QE={type:$t.Marker},kd=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,n){let r=[],s=n.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let o=0;o[a.name,a.value])),i=0;for(let a=0;as.get(c.name)===c.value)&&(i+=1,i>=Od&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(QE)}pushElement(e,n){this._ensureNoahArkCondition(e),this.entries.unshift({type:$t.Element,element:e,token:n})}insertElementAfterBookmark(e,n){let r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:$t.Element,element:e,token:n})}removeEntry(e){let n=this.entries.indexOf(e);n>=0&&this.entries.splice(n,1)}clearToLastMarker(){let e=this.entries.indexOf(QE);e>=0?this.entries.splice(0,e+1):this.entries.length=0}getElementEntryInScopeWithTagName(e){let n=this.entries.find(r=>r.type===$t.Marker||this.treeAdapter.getTagName(r.element)===e);return n&&n.type===$t.Element?n:null}getElementEntry(e){return this.entries.find(n=>n.type===$t.Element&&n.element===e)}}});var Mt,Bu=x(()=>{wn();Mt={createDocument(){return{nodeName:"#document",mode:st.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(t,e,n){return{nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(t){return{nodeName:"#comment",data:t,parentNode:null}},createTextNode(t){return{nodeName:"#text",value:t,parentNode:null}},appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){let r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent(t){return t.content},setDocumentType(t,e,n,r){let s=t.childNodes.find(i=>i.nodeName==="#documentType");if(s)s.name=e,s.publicId=n,s.systemId=r;else{let i={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};Mt.appendChild(t,i)}},setDocumentMode(t,e){t.mode=e},getDocumentMode(t){return t.mode},detachNode(t){if(t.parentNode){let e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){let n=t.childNodes[t.childNodes.length-1];if(Mt.isTextNode(n)){n.value+=e;return}}Mt.appendChild(t,Mt.createTextNode(e))},insertTextBefore(t,e,n){let r=t.childNodes[t.childNodes.indexOf(n)-1];r&&Mt.isTextNode(r)?r.value+=e:Mt.insertBefore(t,Mt.createTextNode(e),n)},adoptAttributes(t,e){let n=new Set(t.attrs.map(r=>r.name));for(let r=0;rt.startsWith(n))}function nT(t){return t.name===ZE&&t.publicId===null&&(t.systemId===null||t.systemId===u6)}function rT(t){if(t.name!==ZE)return st.QUIRKS;let{systemId:e}=t;if(e&&e.toLowerCase()===c6)return st.QUIRKS;let{publicId:n}=t;if(n!==null){if(n=n.toLowerCase(),f6.has(n))return st.QUIRKS;let r=e===null?l6:JE;if(tT(n,r))return st.QUIRKS;if(r=e===null?eT:d6,tT(n,r))return st.LIMITED_QUIRKS}return st.NO_QUIRKS}var ZE,u6,c6,JE,l6,f6,eT,d6,sT=x(()=>{wn();ZE="html",u6="about:legacy-compat",c6="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",JE=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],l6=[...JE,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],f6=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),eT=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],d6=[...eT,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]});function aT(t){let e=t.tagID;return e===u.FONT&&t.attrs.some(({name:r})=>r===rn.COLOR||r===rn.SIZE||r===rn.FACE)||_6.has(e)}function Rd(t){for(let e=0;e{wn();iT={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},h6="definitionurl",p6="definitionURL",m6=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),g6=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:R.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:R.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:R.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:R.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:R.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:R.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:R.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:R.XML}],["xml:space",{prefix:"xml",name:"space",namespace:R.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:R.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:R.XMLNS}]]),b6=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),_6=new Set([u.B,u.BIG,u.BLOCKQUOTE,u.BODY,u.BR,u.CENTER,u.CODE,u.DD,u.DIV,u.DL,u.DT,u.EM,u.EMBED,u.H1,u.H2,u.H3,u.H4,u.H5,u.H6,u.HEAD,u.HR,u.I,u.IMG,u.LI,u.LISTING,u.MENU,u.META,u.NOBR,u.OL,u.P,u.PRE,u.RUBY,u.S,u.SMALL,u.SPAN,u.STRONG,u.STRIKE,u.SUB,u.SUP,u.TABLE,u.TT,u.U,u.UL,u.VAR])});function I6(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):bT(t,e),n}function w6(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){let s=t.openElements.items[r];if(s===e.element)break;t._isSpecialElement(s,t.openElements.tagIDs[r])&&(n=s)}return n||(t.openElements.shortenToLength(r<0?0:r),t.activeFormattingElements.removeEntry(e)),n}function N6(t,e,n){let r=e,s=t.openElements.getCommonAncestor(e);for(let i=0,a=s;a!==n;i++,a=s){s=t.openElements.getCommonAncestor(a);let o=t.activeFormattingElements.getElementEntry(a),c=o&&i>=C6;!o||c?(c&&t.activeFormattingElements.removeEntry(o),t.openElements.remove(a)):(a=v6(t,o),r===e&&(t.activeFormattingElements.bookmark=o),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(a,r),r=a)}return r}function v6(t,e){let n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function D6(t,e,n){let r=t.treeAdapter.getTagName(e),s=or(r);if(t._isElementCausesFosterParenting(s))t._fosterParentElement(n);else{let i=t.treeAdapter.getNamespaceURI(e);s===u.TEMPLATE&&i===R.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function O6(t,e,n){let r=t.treeAdapter.getNamespaceURI(n.element),{token:s}=n,i=t.treeAdapter.createElement(s.tagName,r,s.attrs);t._adoptNodes(e,i),t.treeAdapter.appendChild(e,i),t.activeFormattingElements.insertElementAfterBookmark(i,s),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,i,s.tagID)}function Md(t,e){for(let n=0;n=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){let r=t.openElements.items[0],s=t.treeAdapter.getNodeSourceCodeLocation(r);if(s&&!s.endTag&&(t._setEndLocation(r,e),t.openElements.stackTop>=1)){let i=t.openElements.items[1],a=t.treeAdapter.getNodeSourceCodeLocation(i);a&&!a.endTag&&t._setEndLocation(i,e)}}}}function L6(t,e){t._setDocumentType(e);let n=e.forceQuirks?st.QUIRKS:rT(e);nT(e)||t._err(e,D.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=y.BEFORE_HTML}function ma(t,e){t._err(e,D.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,st.QUIRKS),t.insertionMode=y.BEFORE_HTML,t._processToken(e)}function P6(t,e){e.tagID===u.HTML?(t._insertElement(e,R.HTML),t.insertionMode=y.BEFORE_HEAD):ga(t,e)}function M6(t,e){let n=e.tagID;(n===u.HTML||n===u.HEAD||n===u.BODY||n===u.BR)&&ga(t,e)}function ga(t,e){t._insertFakeRootElement(),t.insertionMode=y.BEFORE_HEAD,t._processToken(e)}function F6(t,e){switch(e.tagID){case u.HTML:{at(t,e);break}case u.HEAD:{t._insertElement(e,R.HTML),t.headElement=t.openElements.current,t.insertionMode=y.IN_HEAD;break}default:ba(t,e)}}function B6(t,e){let n=e.tagID;n===u.HEAD||n===u.BODY||n===u.HTML||n===u.BR?ba(t,e):t._err(e,D.endTagWithoutMatchingOpenElement)}function ba(t,e){t._insertFakeElement(v.HEAD,u.HEAD),t.headElement=t.openElements.current,t.insertionMode=y.IN_HEAD,t._processToken(e)}function Qt(t,e){switch(e.tagID){case u.HTML:{at(t,e);break}case u.BASE:case u.BASEFONT:case u.BGSOUND:case u.LINK:case u.META:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case u.TITLE:{t._switchToTextParsing(e,it.RCDATA);break}case u.NOSCRIPT:{t.options.scriptingEnabled?t._switchToTextParsing(e,it.RAWTEXT):(t._insertElement(e,R.HTML),t.insertionMode=y.IN_HEAD_NO_SCRIPT);break}case u.NOFRAMES:case u.STYLE:{t._switchToTextParsing(e,it.RAWTEXT);break}case u.SCRIPT:{t._switchToTextParsing(e,it.SCRIPT_DATA);break}case u.TEMPLATE:{t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=y.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(y.IN_TEMPLATE);break}case u.HEAD:{t._err(e,D.misplacedStartTagForHeadElement);break}default:_a(t,e)}}function j6(t,e){switch(e.tagID){case u.HEAD:{t.openElements.pop(),t.insertionMode=y.AFTER_HEAD;break}case u.BODY:case u.BR:case u.HTML:{_a(t,e);break}case u.TEMPLATE:{Br(t,e);break}default:t._err(e,D.endTagWithoutMatchingOpenElement)}}function Br(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==u.TEMPLATE&&t._err(e,D.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(u.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,D.endTagWithoutMatchingOpenElement)}function _a(t,e){t.openElements.pop(),t.insertionMode=y.AFTER_HEAD,t._processToken(e)}function H6(t,e){switch(e.tagID){case u.HTML:{at(t,e);break}case u.BASEFONT:case u.BGSOUND:case u.HEAD:case u.LINK:case u.META:case u.NOFRAMES:case u.STYLE:{Qt(t,e);break}case u.NOSCRIPT:{t._err(e,D.nestedNoscriptInHead);break}default:Ea(t,e)}}function U6(t,e){switch(e.tagID){case u.NOSCRIPT:{t.openElements.pop(),t.insertionMode=y.IN_HEAD;break}case u.BR:{Ea(t,e);break}default:t._err(e,D.endTagWithoutMatchingOpenElement)}}function Ea(t,e){let n=e.type===fe.EOF?D.openElementsLeftAfterEof:D.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=y.IN_HEAD,t._processToken(e)}function z6(t,e){switch(e.tagID){case u.HTML:{at(t,e);break}case u.BODY:{t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=y.IN_BODY;break}case u.FRAMESET:{t._insertElement(e,R.HTML),t.insertionMode=y.IN_FRAMESET;break}case u.BASE:case u.BASEFONT:case u.BGSOUND:case u.LINK:case u.META:case u.NOFRAMES:case u.SCRIPT:case u.STYLE:case u.TEMPLATE:case u.TITLE:{t._err(e,D.abandonedHeadElementChild),t.openElements.push(t.headElement,u.HEAD),Qt(t,e),t.openElements.remove(t.headElement);break}case u.HEAD:{t._err(e,D.misplacedStartTagForHeadElement);break}default:Ta(t,e)}}function V6(t,e){switch(e.tagID){case u.BODY:case u.HTML:case u.BR:{Ta(t,e);break}case u.TEMPLATE:{Br(t,e);break}default:t._err(e,D.endTagWithoutMatchingOpenElement)}}function Ta(t,e){t._insertFakeElement(v.BODY,u.BODY),t.insertionMode=y.IN_BODY,Hu(t,e)}function Hu(t,e){switch(e.type){case fe.CHARACTER:{dT(t,e);break}case fe.WHITESPACE_CHARACTER:{fT(t,e);break}case fe.COMMENT:{Fd(t,e);break}case fe.START_TAG:{at(t,e);break}case fe.END_TAG:{Uu(t,e);break}case fe.EOF:{_T(t,e);break}default:}}function fT(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function dT(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function q6(t,e){t.openElements.tmplCount===0&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}function K6(t,e){let n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t.openElements.tmplCount===0&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}function Y6(t,e){let n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,R.HTML),t.insertionMode=y.IN_FRAMESET)}function W6(t,e){t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._insertElement(e,R.HTML)}function G6(t,e){t.openElements.hasInButtonScope(u.P)&&t._closePElement(),Ws.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,R.HTML)}function $6(t,e){t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}function Q6(t,e){let n=t.openElements.tmplCount>0;(!t.formElement||n)&&(t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._insertElement(e,R.HTML),n||(t.formElement=t.openElements.current))}function X6(t,e){t.framesetOk=!1;let n=e.tagID;for(let r=t.openElements.stackTop;r>=0;r--){let s=t.openElements.tagIDs[r];if(n===u.LI&&s===u.LI||(n===u.DD||n===u.DT)&&(s===u.DD||s===u.DT)){t.openElements.generateImpliedEndTagsWithExclusion(s),t.openElements.popUntilTagNamePopped(s);break}if(s!==u.ADDRESS&&s!==u.DIV&&s!==u.P&&t._isSpecialElement(t.openElements.items[r],s))break}t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._insertElement(e,R.HTML)}function Z6(t,e){t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.tokenizer.state=it.PLAINTEXT}function J6(t,e){t.openElements.hasInScope(u.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(u.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.framesetOk=!1}function eD(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(v.A);n&&(Md(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function tD(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function nD(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(u.NOBR)&&(Md(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function rD(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}function sD(t,e){t.treeAdapter.getDocumentMode(t.document)!==st.QUIRKS&&t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=y.IN_TABLE}function hT(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,R.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function pT(t){let e=ku(t,rn.TYPE);return e!=null&&e.toLowerCase()===y6}function iD(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,R.HTML),pT(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}function aD(t,e){t._appendElement(e,R.HTML),e.ackSelfClosing=!0}function oD(t,e){t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._appendElement(e,R.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function uD(t,e){e.tagName=v.IMG,e.tagID=u.IMG,hT(t,e)}function cD(t,e){t._insertElement(e,R.HTML),t.skipNextNewLine=!0,t.tokenizer.state=it.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=y.TEXT}function lD(t,e){t.openElements.hasInButtonScope(u.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,it.RAWTEXT)}function fD(t,e){t.framesetOk=!1,t._switchToTextParsing(e,it.RAWTEXT)}function mT(t,e){t._switchToTextParsing(e,it.RAWTEXT)}function dD(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===y.IN_TABLE||t.insertionMode===y.IN_CAPTION||t.insertionMode===y.IN_TABLE_BODY||t.insertionMode===y.IN_ROW||t.insertionMode===y.IN_CELL?y.IN_SELECT_IN_TABLE:y.IN_SELECT}function hD(t,e){t.openElements.currentTagId===u.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML)}function pD(t,e){t.openElements.hasInScope(u.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,R.HTML)}function mD(t,e){t.openElements.hasInScope(u.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(u.RTC),t._insertElement(e,R.HTML)}function gD(t,e){t._reconstructActiveFormattingElements(),Rd(e),ju(e),e.selfClosing?t._appendElement(e,R.MATHML):t._insertElement(e,R.MATHML),e.ackSelfClosing=!0}function bD(t,e){t._reconstructActiveFormattingElements(),Ld(e),ju(e),e.selfClosing?t._appendElement(e,R.SVG):t._insertElement(e,R.SVG),e.ackSelfClosing=!0}function gT(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML)}function at(t,e){switch(e.tagID){case u.I:case u.S:case u.B:case u.U:case u.EM:case u.TT:case u.BIG:case u.CODE:case u.FONT:case u.SMALL:case u.STRIKE:case u.STRONG:{tD(t,e);break}case u.A:{eD(t,e);break}case u.H1:case u.H2:case u.H3:case u.H4:case u.H5:case u.H6:{G6(t,e);break}case u.P:case u.DL:case u.OL:case u.UL:case u.DIV:case u.DIR:case u.NAV:case u.MAIN:case u.MENU:case u.ASIDE:case u.CENTER:case u.FIGURE:case u.FOOTER:case u.HEADER:case u.HGROUP:case u.DIALOG:case u.DETAILS:case u.ADDRESS:case u.ARTICLE:case u.SEARCH:case u.SECTION:case u.SUMMARY:case u.FIELDSET:case u.BLOCKQUOTE:case u.FIGCAPTION:{W6(t,e);break}case u.LI:case u.DD:case u.DT:{X6(t,e);break}case u.BR:case u.IMG:case u.WBR:case u.AREA:case u.EMBED:case u.KEYGEN:{hT(t,e);break}case u.HR:{oD(t,e);break}case u.RB:case u.RTC:{pD(t,e);break}case u.RT:case u.RP:{mD(t,e);break}case u.PRE:case u.LISTING:{$6(t,e);break}case u.XMP:{lD(t,e);break}case u.SVG:{bD(t,e);break}case u.HTML:{q6(t,e);break}case u.BASE:case u.LINK:case u.META:case u.STYLE:case u.TITLE:case u.SCRIPT:case u.BGSOUND:case u.BASEFONT:case u.TEMPLATE:{Qt(t,e);break}case u.BODY:{K6(t,e);break}case u.FORM:{Q6(t,e);break}case u.NOBR:{nD(t,e);break}case u.MATH:{gD(t,e);break}case u.TABLE:{sD(t,e);break}case u.INPUT:{iD(t,e);break}case u.PARAM:case u.TRACK:case u.SOURCE:{aD(t,e);break}case u.IMAGE:{uD(t,e);break}case u.BUTTON:{J6(t,e);break}case u.APPLET:case u.OBJECT:case u.MARQUEE:{rD(t,e);break}case u.IFRAME:{fD(t,e);break}case u.SELECT:{dD(t,e);break}case u.OPTION:case u.OPTGROUP:{hD(t,e);break}case u.NOEMBED:case u.NOFRAMES:{mT(t,e);break}case u.FRAMESET:{Y6(t,e);break}case u.TEXTAREA:{cD(t,e);break}case u.NOSCRIPT:{t.options.scriptingEnabled?mT(t,e):gT(t,e);break}case u.PLAINTEXT:{Z6(t,e);break}case u.COL:case u.TH:case u.TD:case u.TR:case u.HEAD:case u.FRAME:case u.TBODY:case u.TFOOT:case u.THEAD:case u.CAPTION:case u.COLGROUP:break;default:gT(t,e)}}function _D(t,e){if(t.openElements.hasInScope(u.BODY)&&(t.insertionMode=y.AFTER_BODY,t.options.sourceCodeLocationInfo)){let n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}function ED(t,e){t.openElements.hasInScope(u.BODY)&&(t.insertionMode=y.AFTER_BODY,IT(t,e))}function TD(t,e){let n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}function xD(t){let e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(u.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(u.FORM):n&&t.openElements.remove(n))}function yD(t){t.openElements.hasInButtonScope(u.P)||t._insertFakeElement(v.P,u.P),t._closePElement()}function AD(t){t.openElements.hasInListItemScope(u.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(u.LI),t.openElements.popUntilTagNamePopped(u.LI))}function CD(t,e){let n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}function SD(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}function ID(t,e){let n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}function wD(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(v.BR,u.BR),t.openElements.pop(),t.framesetOk=!1}function bT(t,e){let n=e.tagName,r=e.tagID;for(let s=t.openElements.stackTop;s>0;s--){let i=t.openElements.items[s],a=t.openElements.tagIDs[s];if(r===a&&(r!==u.UNKNOWN||t.treeAdapter.getTagName(i)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=s&&t.openElements.shortenToLength(s);break}if(t._isSpecialElement(i,a))break}}function Uu(t,e){switch(e.tagID){case u.A:case u.B:case u.I:case u.S:case u.U:case u.EM:case u.TT:case u.BIG:case u.CODE:case u.FONT:case u.NOBR:case u.SMALL:case u.STRIKE:case u.STRONG:{Md(t,e);break}case u.P:{yD(t);break}case u.DL:case u.UL:case u.OL:case u.DIR:case u.DIV:case u.NAV:case u.PRE:case u.MAIN:case u.MENU:case u.ASIDE:case u.BUTTON:case u.CENTER:case u.FIGURE:case u.FOOTER:case u.HEADER:case u.HGROUP:case u.DIALOG:case u.ADDRESS:case u.ARTICLE:case u.DETAILS:case u.SEARCH:case u.SECTION:case u.SUMMARY:case u.LISTING:case u.FIELDSET:case u.BLOCKQUOTE:case u.FIGCAPTION:{TD(t,e);break}case u.LI:{AD(t);break}case u.DD:case u.DT:{CD(t,e);break}case u.H1:case u.H2:case u.H3:case u.H4:case u.H5:case u.H6:{SD(t);break}case u.BR:{wD(t);break}case u.BODY:{_D(t,e);break}case u.HTML:{ED(t,e);break}case u.FORM:{xD(t);break}case u.APPLET:case u.OBJECT:case u.MARQUEE:{ID(t,e);break}case u.TEMPLATE:{Br(t,e);break}default:bT(t,e)}}function _T(t,e){t.tmplInsertionModeStack.length>0?ST(t,e):Bd(t,e)}function ND(t,e){var n;e.tagID===u.SCRIPT&&((n=t.scriptHandler)===null||n===void 0||n.call(t,t.openElements.current)),t.openElements.pop(),t.insertionMode=t.originalInsertionMode}function vD(t,e){t._err(e,D.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}function jd(t,e){if(cT.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=y.IN_TABLE_TEXT,e.type){case fe.CHARACTER:{TT(t,e);break}case fe.WHITESPACE_CHARACTER:{ET(t,e);break}}else ya(t,e)}function DD(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,R.HTML),t.insertionMode=y.IN_CAPTION}function OD(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,R.HTML),t.insertionMode=y.IN_COLUMN_GROUP}function kD(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(v.COLGROUP,u.COLGROUP),t.insertionMode=y.IN_COLUMN_GROUP,Hd(t,e)}function RD(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,R.HTML),t.insertionMode=y.IN_TABLE_BODY}function LD(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(v.TBODY,u.TBODY),t.insertionMode=y.IN_TABLE_BODY,Vu(t,e)}function PD(t,e){t.openElements.hasInTableScope(u.TABLE)&&(t.openElements.popUntilTagNamePopped(u.TABLE),t._resetInsertionMode(),t._processStartTag(e))}function MD(t,e){pT(e)?t._appendElement(e,R.HTML):ya(t,e),e.ackSelfClosing=!0}function FD(t,e){!t.formElement&&t.openElements.tmplCount===0&&(t._insertElement(e,R.HTML),t.formElement=t.openElements.current,t.openElements.pop())}function Gs(t,e){switch(e.tagID){case u.TD:case u.TH:case u.TR:{LD(t,e);break}case u.STYLE:case u.SCRIPT:case u.TEMPLATE:{Qt(t,e);break}case u.COL:{kD(t,e);break}case u.FORM:{FD(t,e);break}case u.TABLE:{PD(t,e);break}case u.TBODY:case u.TFOOT:case u.THEAD:{RD(t,e);break}case u.INPUT:{MD(t,e);break}case u.CAPTION:{DD(t,e);break}case u.COLGROUP:{OD(t,e);break}default:ya(t,e)}}function xa(t,e){switch(e.tagID){case u.TABLE:{t.openElements.hasInTableScope(u.TABLE)&&(t.openElements.popUntilTagNamePopped(u.TABLE),t._resetInsertionMode());break}case u.TEMPLATE:{Br(t,e);break}case u.BODY:case u.CAPTION:case u.COL:case u.COLGROUP:case u.HTML:case u.TBODY:case u.TD:case u.TFOOT:case u.TH:case u.THEAD:case u.TR:break;default:ya(t,e)}}function ya(t,e){let n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,Hu(t,e),t.fosterParentingEnabled=n}function ET(t,e){t.pendingCharacterTokens.push(e)}function TT(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function Aa(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n0&&t.openElements.currentTagId===u.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===u.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===u.OPTGROUP&&t.openElements.pop();break}case u.OPTION:{t.openElements.currentTagId===u.OPTION&&t.openElements.pop();break}case u.SELECT:{t.openElements.hasInSelectScope(u.SELECT)&&(t.openElements.popUntilTagNamePopped(u.SELECT),t._resetInsertionMode());break}case u.TEMPLATE:{Br(t,e);break}default:}}function VD(t,e){let n=e.tagID;n===u.CAPTION||n===u.TABLE||n===u.TBODY||n===u.TFOOT||n===u.THEAD||n===u.TR||n===u.TD||n===u.TH?(t.openElements.popUntilTagNamePopped(u.SELECT),t._resetInsertionMode(),t._processStartTag(e)):AT(t,e)}function qD(t,e){let n=e.tagID;n===u.CAPTION||n===u.TABLE||n===u.TBODY||n===u.TFOOT||n===u.THEAD||n===u.TR||n===u.TD||n===u.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(u.SELECT),t._resetInsertionMode(),t.onEndTag(e)):CT(t,e)}function KD(t,e){switch(e.tagID){case u.BASE:case u.BASEFONT:case u.BGSOUND:case u.LINK:case u.META:case u.NOFRAMES:case u.SCRIPT:case u.STYLE:case u.TEMPLATE:case u.TITLE:{Qt(t,e);break}case u.CAPTION:case u.COLGROUP:case u.TBODY:case u.TFOOT:case u.THEAD:{t.tmplInsertionModeStack[0]=y.IN_TABLE,t.insertionMode=y.IN_TABLE,Gs(t,e);break}case u.COL:{t.tmplInsertionModeStack[0]=y.IN_COLUMN_GROUP,t.insertionMode=y.IN_COLUMN_GROUP,Hd(t,e);break}case u.TR:{t.tmplInsertionModeStack[0]=y.IN_TABLE_BODY,t.insertionMode=y.IN_TABLE_BODY,Vu(t,e);break}case u.TD:case u.TH:{t.tmplInsertionModeStack[0]=y.IN_ROW,t.insertionMode=y.IN_ROW,qu(t,e);break}default:t.tmplInsertionModeStack[0]=y.IN_BODY,t.insertionMode=y.IN_BODY,at(t,e)}}function YD(t,e){e.tagID===u.TEMPLATE&&Br(t,e)}function ST(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(u.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):Bd(t,e)}function WD(t,e){e.tagID===u.HTML?at(t,e):Ku(t,e)}function IT(t,e){var n;if(e.tagID===u.HTML){if(t.fragmentContext||(t.insertionMode=y.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===u.HTML){t._setEndLocation(t.openElements.items[0],e);let r=t.openElements.items[1];r&&!((n=t.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0?void 0:n.endTag)&&t._setEndLocation(r,e)}}else Ku(t,e)}function Ku(t,e){t.insertionMode=y.IN_BODY,Hu(t,e)}function GD(t,e){switch(e.tagID){case u.HTML:{at(t,e);break}case u.FRAMESET:{t._insertElement(e,R.HTML);break}case u.FRAME:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case u.NOFRAMES:{Qt(t,e);break}default:}}function $D(t,e){e.tagID===u.FRAMESET&&!t.openElements.isRootHtmlElementCurrent()&&(t.openElements.pop(),!t.fragmentContext&&t.openElements.currentTagId!==u.FRAMESET&&(t.insertionMode=y.AFTER_FRAMESET))}function QD(t,e){switch(e.tagID){case u.HTML:{at(t,e);break}case u.NOFRAMES:{Qt(t,e);break}default:}}function XD(t,e){e.tagID===u.HTML&&(t.insertionMode=y.AFTER_AFTER_FRAMESET)}function ZD(t,e){e.tagID===u.HTML?at(t,e):Yu(t,e)}function Yu(t,e){t.insertionMode=y.IN_BODY,Hu(t,e)}function JD(t,e){switch(e.tagID){case u.HTML:{at(t,e);break}case u.NOFRAMES:{Qt(t,e);break}default:}}function eO(t,e){e.chars=we,t._insertCharacters(e)}function tO(t,e){t._insertCharacters(e),t.framesetOk=!1}function wT(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==R.HTML&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}function nO(t,e){if(aT(e))wT(t),t._startTagOutsideForeignContent(e);else{let n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===R.MATHML?Rd(e):r===R.SVG&&(oT(e),Ld(e)),ju(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}function rO(t,e){if(e.tagID===u.P||e.tagID===u.BR){wT(t),t._endTagOutsideForeignContent(e);return}for(let n=t.openElements.stackTop;n>0;n--){let r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===R.HTML){t._endTagOutsideForeignContent(e);break}let s=t.treeAdapter.getTagName(r);if(s.toLowerCase()===e.tagName){e.tagName=s,t.openElements.shortenToLength(n);break}}}var y6,A6,C6,y,S6,cT,lT,pa,xT,zd=x(()=>{vd();$E();XE();Bu();sT();Pd();da();Ou();wn();Ru();y6="hidden",A6=8,C6=3;(function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(y||(y={}));S6={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},cT=new Set([u.TABLE,u.TBODY,u.TFOOT,u.THEAD,u.TR]),lT={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Mt,onParseError:null},pa=class{constructor(e,n,r=null,s=null){this.fragmentContext=r,this.scriptHandler=s,this.currentToken=null,this.stopped=!1,this.insertionMode=y.INITIAL,this.originalInsertionMode=y.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options=B(B({},lT),e),this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new Mu(this.options,this),this.activeFormattingElements=new kd(this.treeAdapter),this.fragmentContextID=r?or(this.treeAdapter.getTagName(r)):u.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new Dd(this.document,this.treeAdapter,this)}static parse(e,n){let r=new this(n);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,n){let r=B(B({},lT),n);e??(e=r.treeAdapter.createElement(v.TEMPLATE,R.HTML,[]));let s=r.treeAdapter.createElement("documentmock",R.HTML,[]),i=new this(r,s,e);return i.fragmentContextID===u.TEMPLATE&&i.tmplInsertionModeStack.unshift(y.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,n),n}_err(e,n,r){var s;if(!this.onParseError)return;let i=(s=e.location)!==null&&s!==void 0?s:S6,a={code:n,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:r?i.startLine:i.endLine,endCol:r?i.startCol:i.endCol,endOffset:r?i.startOffset:i.endOffset};this.onParseError(a)}onItemPush(e,n,r){var s,i;(i=(s=this.treeAdapter).onItemPush)===null||i===void 0||i.call(s,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,n)}onItemPop(e,n){var r,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(s=(r=this.treeAdapter).onItemPop)===null||s===void 0||s.call(r,e,this.openElements.current),n){let i,a;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,a=this.fragmentContextID):{current:i,currentTagId:a}=this.openElements,this._setContextModes(i,a)}}_setContextModes(e,n){let r=e===this.document||this.treeAdapter.getNamespaceURI(e)===R.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&!this._isIntegrationPoint(n,e)}_switchToTextParsing(e,n){this._insertElement(e,R.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=y.TEXT}switchToPlaintextParsing(){this.insertionMode=y.TEXT,this.originalInsertionMode=y.IN_BODY,this.tokenizer.state=it.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===v.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==R.HTML))switch(this.fragmentContextID){case u.TITLE:case u.TEXTAREA:{this.tokenizer.state=it.RCDATA;break}case u.STYLE:case u.XMP:case u.IFRAME:case u.NOEMBED:case u.NOFRAMES:case u.NOSCRIPT:{this.tokenizer.state=it.RAWTEXT;break}case u.SCRIPT:{this.tokenizer.state=it.SCRIPT_DATA;break}case u.PLAINTEXT:{this.tokenizer.state=it.PLAINTEXT;break}default:}}_setDocumentType(e){let n=e.name||"",r=e.publicId||"",s=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,s),e.location){let a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,e.location)}}_attachElementToTree(e,n){if(this.options.sourceCodeLocationInfo){let r=n&&ce(B({},n),{startTag:n});this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r,e)}}_appendElement(e,n){let r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,n){let r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,n){let r=this.treeAdapter.createElement(e,R.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(e){let n=this.treeAdapter.createElement(e.tagName,R.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(v.HTML,R.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,u.HTML)}_appendCommentNode(e,n){let r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,e.chars,r):this.treeAdapter.insertText(n,e.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,e.chars)),!e.location)return;let s=this.treeAdapter.getChildNodes(n),i=r?s.lastIndexOf(r):s.length,a=s[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){let{endLine:c,endCol:l,endOffset:h}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:l,endOffset:h})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,e.location)}_adoptNodes(e,n){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(e,n){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&n.location){let r=n.location,s=this.treeAdapter.getTagName(e),i=n.type===fe.END_TAG&&s===n.tagName?{endTag:B({},r),endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,e.tagID===u.SVG&&this.treeAdapter.getTagName(n)===v.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===R.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===u.MGLYPH||e.tagID===u.MALIGNMARK)&&!this._isIntegrationPoint(r,n,R.HTML)}_processToken(e){switch(e.type){case fe.CHARACTER:{this.onCharacter(e);break}case fe.NULL_CHARACTER:{this.onNullCharacter(e);break}case fe.COMMENT:{this.onComment(e);break}case fe.DOCTYPE:{this.onDoctype(e);break}case fe.START_TAG:{this._processStartTag(e);break}case fe.END_TAG:{this.onEndTag(e);break}case fe.EOF:{this.onEof(e);break}case fe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,n,r){let s=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return uT(e,s,i,r)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let n=this.activeFormattingElements.entries.findIndex(s=>s.type===$t.Marker||this.openElements.contains(s.element)),r=n<0?e-1:n-1;for(let s=r;s>=0;s--){let i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=y.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(u.P),this.openElements.popUntilTagNamePopped(u.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case u.TR:{this.insertionMode=y.IN_ROW;return}case u.TBODY:case u.THEAD:case u.TFOOT:{this.insertionMode=y.IN_TABLE_BODY;return}case u.CAPTION:{this.insertionMode=y.IN_CAPTION;return}case u.COLGROUP:{this.insertionMode=y.IN_COLUMN_GROUP;return}case u.TABLE:{this.insertionMode=y.IN_TABLE;return}case u.BODY:{this.insertionMode=y.IN_BODY;return}case u.FRAMESET:{this.insertionMode=y.IN_FRAMESET;return}case u.SELECT:{this._resetInsertionModeForSelect(e);return}case u.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case u.HTML:{this.insertionMode=this.headElement?y.AFTER_HEAD:y.BEFORE_HEAD;return}case u.TD:case u.TH:{if(e>0){this.insertionMode=y.IN_CELL;return}break}case u.HEAD:{if(e>0){this.insertionMode=y.IN_HEAD;return}break}}this.insertionMode=y.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let n=e-1;n>0;n--){let r=this.openElements.tagIDs[n];if(r===u.TEMPLATE)break;if(r===u.TABLE){this.insertionMode=y.IN_SELECT_IN_TABLE;return}}this.insertionMode=y.IN_SELECT}_isElementCausesFosterParenting(e){return cT.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let n=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case u.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===R.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case u.TABLE:{let r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,e,n.beforeElement):this.treeAdapter.appendChild(n.parent,e)}_isSpecialElement(e,n){let r=this.treeAdapter.getNamespaceURI(e);return wd[r].has(n)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){tO(this,e);return}switch(this.insertionMode){case y.INITIAL:{ma(this,e);break}case y.BEFORE_HTML:{ga(this,e);break}case y.BEFORE_HEAD:{ba(this,e);break}case y.IN_HEAD:{_a(this,e);break}case y.IN_HEAD_NO_SCRIPT:{Ea(this,e);break}case y.AFTER_HEAD:{Ta(this,e);break}case y.IN_BODY:case y.IN_CAPTION:case y.IN_CELL:case y.IN_TEMPLATE:{dT(this,e);break}case y.TEXT:case y.IN_SELECT:case y.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case y.IN_TABLE:case y.IN_TABLE_BODY:case y.IN_ROW:{jd(this,e);break}case y.IN_TABLE_TEXT:{TT(this,e);break}case y.IN_COLUMN_GROUP:{zu(this,e);break}case y.AFTER_BODY:{Ku(this,e);break}case y.AFTER_AFTER_BODY:{Yu(this,e);break}default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){eO(this,e);return}switch(this.insertionMode){case y.INITIAL:{ma(this,e);break}case y.BEFORE_HTML:{ga(this,e);break}case y.BEFORE_HEAD:{ba(this,e);break}case y.IN_HEAD:{_a(this,e);break}case y.IN_HEAD_NO_SCRIPT:{Ea(this,e);break}case y.AFTER_HEAD:{Ta(this,e);break}case y.TEXT:{this._insertCharacters(e);break}case y.IN_TABLE:case y.IN_TABLE_BODY:case y.IN_ROW:{jd(this,e);break}case y.IN_COLUMN_GROUP:{zu(this,e);break}case y.AFTER_BODY:{Ku(this,e);break}case y.AFTER_AFTER_BODY:{Yu(this,e);break}default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Fd(this,e);return}switch(this.insertionMode){case y.INITIAL:case y.BEFORE_HTML:case y.BEFORE_HEAD:case y.IN_HEAD:case y.IN_HEAD_NO_SCRIPT:case y.AFTER_HEAD:case y.IN_BODY:case y.IN_TABLE:case y.IN_CAPTION:case y.IN_COLUMN_GROUP:case y.IN_TABLE_BODY:case y.IN_ROW:case y.IN_CELL:case y.IN_SELECT:case y.IN_SELECT_IN_TABLE:case y.IN_TEMPLATE:case y.IN_FRAMESET:case y.AFTER_FRAMESET:{Fd(this,e);break}case y.IN_TABLE_TEXT:{Aa(this,e);break}case y.AFTER_BODY:{k6(this,e);break}case y.AFTER_AFTER_BODY:case y.AFTER_AFTER_FRAMESET:{R6(this,e);break}default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case y.INITIAL:{L6(this,e);break}case y.BEFORE_HEAD:case y.IN_HEAD:case y.IN_HEAD_NO_SCRIPT:case y.AFTER_HEAD:{this._err(e,D.misplacedDoctype);break}case y.IN_TABLE_TEXT:{Aa(this,e);break}default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,D.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?nO(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case y.INITIAL:{ma(this,e);break}case y.BEFORE_HTML:{P6(this,e);break}case y.BEFORE_HEAD:{F6(this,e);break}case y.IN_HEAD:{Qt(this,e);break}case y.IN_HEAD_NO_SCRIPT:{H6(this,e);break}case y.AFTER_HEAD:{z6(this,e);break}case y.IN_BODY:{at(this,e);break}case y.IN_TABLE:{Gs(this,e);break}case y.IN_TABLE_TEXT:{Aa(this,e);break}case y.IN_CAPTION:{BD(this,e);break}case y.IN_COLUMN_GROUP:{Hd(this,e);break}case y.IN_TABLE_BODY:{Vu(this,e);break}case y.IN_ROW:{qu(this,e);break}case y.IN_CELL:{UD(this,e);break}case y.IN_SELECT:{AT(this,e);break}case y.IN_SELECT_IN_TABLE:{VD(this,e);break}case y.IN_TEMPLATE:{KD(this,e);break}case y.AFTER_BODY:{WD(this,e);break}case y.IN_FRAMESET:{GD(this,e);break}case y.AFTER_FRAMESET:{QD(this,e);break}case y.AFTER_AFTER_BODY:{ZD(this,e);break}case y.AFTER_AFTER_FRAMESET:{JD(this,e);break}default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?rO(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case y.INITIAL:{ma(this,e);break}case y.BEFORE_HTML:{M6(this,e);break}case y.BEFORE_HEAD:{B6(this,e);break}case y.IN_HEAD:{j6(this,e);break}case y.IN_HEAD_NO_SCRIPT:{U6(this,e);break}case y.AFTER_HEAD:{V6(this,e);break}case y.IN_BODY:{Uu(this,e);break}case y.TEXT:{ND(this,e);break}case y.IN_TABLE:{xa(this,e);break}case y.IN_TABLE_TEXT:{Aa(this,e);break}case y.IN_CAPTION:{jD(this,e);break}case y.IN_COLUMN_GROUP:{HD(this,e);break}case y.IN_TABLE_BODY:{Ud(this,e);break}case y.IN_ROW:{yT(this,e);break}case y.IN_CELL:{zD(this,e);break}case y.IN_SELECT:{CT(this,e);break}case y.IN_SELECT_IN_TABLE:{qD(this,e);break}case y.IN_TEMPLATE:{YD(this,e);break}case y.AFTER_BODY:{IT(this,e);break}case y.IN_FRAMESET:{$D(this,e);break}case y.AFTER_FRAMESET:{XD(this,e);break}case y.AFTER_AFTER_BODY:{Yu(this,e);break}default:}}onEof(e){switch(this.insertionMode){case y.INITIAL:{ma(this,e);break}case y.BEFORE_HTML:{ga(this,e);break}case y.BEFORE_HEAD:{ba(this,e);break}case y.IN_HEAD:{_a(this,e);break}case y.IN_HEAD_NO_SCRIPT:{Ea(this,e);break}case y.AFTER_HEAD:{Ta(this,e);break}case y.IN_BODY:case y.IN_TABLE:case y.IN_CAPTION:case y.IN_COLUMN_GROUP:case y.IN_TABLE_BODY:case y.IN_ROW:case y.IN_CELL:case y.IN_SELECT:case y.IN_SELECT_IN_TABLE:{_T(this,e);break}case y.TEXT:{vD(this,e);break}case y.IN_TABLE_TEXT:{Aa(this,e);break}case y.IN_TEMPLATE:{ST(this,e);break}case y.AFTER_BODY:case y.IN_FRAMESET:case y.AFTER_FRAMESET:case y.AFTER_AFTER_BODY:case y.AFTER_AFTER_FRAMESET:{Bd(this,e);break}default:}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===g.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case y.IN_HEAD:case y.IN_HEAD_NO_SCRIPT:case y.AFTER_HEAD:case y.TEXT:case y.IN_COLUMN_GROUP:case y.IN_SELECT:case y.IN_SELECT_IN_TABLE:case y.IN_FRAMESET:case y.AFTER_FRAMESET:{this._insertCharacters(e);break}case y.IN_BODY:case y.IN_CAPTION:case y.IN_CELL:case y.IN_TEMPLATE:case y.AFTER_BODY:case y.AFTER_AFTER_BODY:case y.AFTER_AFTER_FRAMESET:{fT(this,e);break}case y.IN_TABLE:case y.IN_TABLE_BODY:case y.IN_ROW:{jd(this,e);break}case y.IN_TABLE_TEXT:{ET(this,e);break}default:}}};xT=new Set([u.CAPTION,u.COL,u.COLGROUP,u.TBODY,u.TD,u.TFOOT,u.TH,u.THEAD,u.TR])});function iO(t,e){return e.treeAdapter.isElementNode(t)&&e.treeAdapter.getNamespaceURI(t)===R.HTML&&sO.has(e.treeAdapter.getTagName(t))}function Vd(t,e){let n=B(B({},aO),e);return NT(t,n)}function oO(t,e){let n="",r=e.treeAdapter.isElementNode(t)&&e.treeAdapter.getTagName(t)===v.TEMPLATE&&e.treeAdapter.getNamespaceURI(t)===R.HTML?e.treeAdapter.getTemplateContent(t):t,s=e.treeAdapter.getChildNodes(r);if(s)for(let i of s)n+=NT(i,e);return n}function NT(t,e){return e.treeAdapter.isElementNode(t)?uO(t,e):e.treeAdapter.isTextNode(t)?lO(t,e):e.treeAdapter.isCommentNode(t)?fO(t,e):e.treeAdapter.isDocumentTypeNode(t)?dO(t,e):""}function uO(t,e){let n=e.treeAdapter.getTagName(t);return`<${n}${cO(t,e)}>${iO(t,e)?"":`${oO(t,e)}`}`}function cO(t,{treeAdapter:e}){let n="";for(let r of e.getAttrList(t)){if(n+=" ",r.namespace)switch(r.namespace){case R.XML:{n+=`xml:${r.name}`;break}case R.XMLNS:{r.name!=="xmlns"&&(n+="xmlns:"),n+=r.name;break}case R.XLINK:{n+=`xlink:${r.name}`;break}default:n+=`${r.prefix}:${r.name}`}else n+=r.name;n+=`="${Fs(r.value)}"`}return n}function lO(t,e){let{treeAdapter:n}=e,r=n.getTextNodeContent(t),s=n.getParentNode(t),i=s&&n.isElementNode(s)&&n.getTagName(s);return i&&n.getNamespaceURI(s)===R.HTML&&Nd(i,e.scriptingEnabled)?r:Bs(r)}function fO(t,{treeAdapter:e}){return``}function dO(t,{treeAdapter:e}){return``}var sO,aO,vT=x(()=>{wn();Xi();Bu();sO=new Set([v.AREA,v.BASE,v.BASEFONT,v.BGSOUND,v.BR,v.COL,v.EMBED,v.FRAME,v.HR,v.IMG,v.INPUT,v.KEYGEN,v.LINK,v.META,v.PARAM,v.SOURCE,v.TRACK,v.WBR]);aO={treeAdapter:Mt,scriptingEnabled:!0}});function DT(t,e){return pa.parse(t,e)}function OT(t,e,n){typeof t=="string"&&(n=e,e=t,t=null);let r=pa.getFragmentParser(t,n);return r.tokenizer.write(e,!0),r.getFragment()}var qd=x(()=>{zd();Bu();zd();vT();da();Pd();wn();Ru();vd()});function kT(t){let e=t.includes('"')?"'":'"';return e+t+e}function hO(t,e,n){let r="!DOCTYPE ";return t&&(r+=t),e?r+=` PUBLIC ${kT(e)}`:n&&(r+=" SYSTEM"),n&&(r+=` ${kT(n)}`),r}var Nn,RT=x(()=>{qd();Qe();Nn={isCommentNode:vr,isElementNode:$,isTextNode:gt,createDocument(){let t=new Ot([]);return t["x-mode"]=Lu.DOCUMENT_MODE.NO_QUIRKS,t},createDocumentFragment(){return new Ot([])},createElement(t,e,n){let r=Object.create(null),s=Object.create(null),i=Object.create(null);for(let o=0;oiu(a)&&a.name==="!doctype");i?i.data=s??null:(i=new Ds("!doctype",s),Nn.appendChild(t,i)),i["x-name"]=e,i["x-publicId"]=n,i["x-systemId"]=r},setDocumentMode(t,e){t["x-mode"]=e},getDocumentMode(t){return t["x-mode"]},detachNode(t){if(t.parent){let e=t.parent.children.indexOf(t),{prev:n,next:r}=t;t.prev=null,t.next=null,n&&(n.next=r),r&&(r.prev=n),t.parent.children.splice(e,1),t.parent=null}},insertText(t,e){let n=t.children[t.children.length-1];n&>(n)?n.data+=e:Nn.appendChild(t,Nn.createTextNode(e))},insertTextBefore(t,e,n){let r=t.children[t.children.indexOf(n)-1];r&>(r)?r.data+=e:Nn.insertBefore(t,Nn.createTextNode(e),n)},adoptAttributes(t,e){for(let n=0;n{Qe();qd();RT();pO={treeAdapter:Nn}});function vn(t){return t===ee.Space||t===ee.NewLine||t===ee.Tab||t===ee.FormFeed||t===ee.CarriageReturn}function Wu(t){return t===ee.Slash||t===ee.Gt||vn(t)}function mO(t){return t>=ee.LowerA&&t<=ee.LowerZ||t>=ee.UpperA&&t<=ee.UpperZ}var ee,M,Ft,Xe,Ca,Kd=x(()=>{Ms();(function(t){t[t.Tab=9]="Tab",t[t.NewLine=10]="NewLine",t[t.FormFeed=12]="FormFeed",t[t.CarriageReturn=13]="CarriageReturn",t[t.Space=32]="Space",t[t.ExclamationMark=33]="ExclamationMark",t[t.Number=35]="Number",t[t.Amp=38]="Amp",t[t.SingleQuote=39]="SingleQuote",t[t.DoubleQuote=34]="DoubleQuote",t[t.Dash=45]="Dash",t[t.Slash=47]="Slash",t[t.Zero=48]="Zero",t[t.Nine=57]="Nine",t[t.Semi=59]="Semi",t[t.Lt=60]="Lt",t[t.Eq=61]="Eq",t[t.Gt=62]="Gt",t[t.Questionmark=63]="Questionmark",t[t.UpperA=65]="UpperA",t[t.LowerA=97]="LowerA",t[t.UpperF=70]="UpperF",t[t.LowerF=102]="LowerF",t[t.UpperZ=90]="UpperZ",t[t.LowerZ=122]="LowerZ",t[t.LowerX=120]="LowerX",t[t.OpeningSquareBracket=91]="OpeningSquareBracket"})(ee||(ee={}));(function(t){t[t.Text=1]="Text",t[t.BeforeTagName=2]="BeforeTagName",t[t.InTagName=3]="InTagName",t[t.InSelfClosingTag=4]="InSelfClosingTag",t[t.BeforeClosingTagName=5]="BeforeClosingTagName",t[t.InClosingTagName=6]="InClosingTagName",t[t.AfterClosingTagName=7]="AfterClosingTagName",t[t.BeforeAttributeName=8]="BeforeAttributeName",t[t.InAttributeName=9]="InAttributeName",t[t.AfterAttributeName=10]="AfterAttributeName",t[t.BeforeAttributeValue=11]="BeforeAttributeValue",t[t.InAttributeValueDq=12]="InAttributeValueDq",t[t.InAttributeValueSq=13]="InAttributeValueSq",t[t.InAttributeValueNq=14]="InAttributeValueNq",t[t.BeforeDeclaration=15]="BeforeDeclaration",t[t.InDeclaration=16]="InDeclaration",t[t.InProcessingInstruction=17]="InProcessingInstruction",t[t.BeforeComment=18]="BeforeComment",t[t.CDATASequence=19]="CDATASequence",t[t.InSpecialComment=20]="InSpecialComment",t[t.InCommentLike=21]="InCommentLike",t[t.BeforeSpecialS=22]="BeforeSpecialS",t[t.BeforeSpecialT=23]="BeforeSpecialT",t[t.SpecialStartSequence=24]="SpecialStartSequence",t[t.InSpecialTag=25]="InSpecialTag",t[t.InEntity=26]="InEntity"})(M||(M={}));(function(t){t[t.NoValue=0]="NoValue",t[t.Unquoted=1]="Unquoted",t[t.Single=2]="Single",t[t.Double=3]="Double"})(Ft||(Ft={}));Xe={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])},Ca=class{constructor({xmlMode:e=!1,decodeEntities:n=!0},r){this.cbs=r,this.state=M.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=M.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=n,this.entityDecoder=new Dr(e?au:Ls,(s,i)=>this.emitCodePoint(s,i))}reset(){this.state=M.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=M.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.indexthis.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=M.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===ee.Amp&&this.startEntity()}stateSpecialStartSequence(e){let n=this.sequenceIndex===this.currentSequence.length;if(!(n?Wu(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!n){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=M.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===ee.Gt||vn(e)){let n=this.index-this.currentSequence.length;if(this.sectionStart=0?(this.state=this.baseState,e===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===M.Text||this.state===M.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===M.InAttributeValueDq||this.state===M.InAttributeValueSq||this.state===M.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index=e||(this.state===M.InCommentLike?this.currentSequence===Xe.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===M.InTagName||this.state===M.BeforeAttributeName||this.state===M.BeforeAttributeValue||this.state===M.AfterAttributeName||this.state===M.InAttributeName||this.state===M.InAttributeValueSq||this.state===M.InAttributeValueDq||this.state===M.InAttributeValueNq||this.state===M.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,n){this.baseState!==M.Text&&this.baseState!==M.InSpecialTag?(this.sectionStart{Kd();Ms();$s=new Set(["input","option","optgroup","select","button","datalist","textarea"]),Te=new Set(["p"]),FT=new Set(["thead","tbody"]),BT=new Set(["dd","dt"]),jT=new Set(["rt","rp"]),gO=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",Te],["h1",Te],["h2",Te],["h3",Te],["h4",Te],["h5",Te],["h6",Te],["select",$s],["input",$s],["output",$s],["button",$s],["datalist",$s],["textarea",$s],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",BT],["dt",BT],["address",Te],["article",Te],["aside",Te],["blockquote",Te],["details",Te],["div",Te],["dl",Te],["fieldset",Te],["figcaption",Te],["figure",Te],["footer",Te],["form",Te],["header",Te],["hr",Te],["main",Te],["nav",Te],["ol",Te],["pre",Te],["section",Te],["table",Te],["ul",Te],["rt",jT],["rp",jT],["tbody",FT],["tfoot",FT]]),bO=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),HT=new Set(["math","svg"]),UT=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),_O=/\s|\//,Gu=class{constructor(e,n={}){var r,s,i,a,o,c;this.options=n,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(r=n.lowerCaseTags)!==null&&r!==void 0?r:this.htmlMode,this.lowerCaseAttributeNames=(s=n.lowerCaseAttributeNames)!==null&&s!==void 0?s:this.htmlMode,this.recognizeSelfClosing=(i=n.recognizeSelfClosing)!==null&&i!==void 0?i:!this.htmlMode,this.tokenizer=new((a=n.Tokenizer)!==null&&a!==void 0?a:Ca)(this.options,this),this.foreignContext=[!this.htmlMode],(c=(o=this.cbs).onparserinit)===null||c===void 0||c.call(o,this)}ontext(e,n){var r,s;let i=this.getSlice(e,n);this.endIndex=n-1,(s=(r=this.cbs).ontext)===null||s===void 0||s.call(r,i),this.startIndex=n}ontextentity(e,n){var r,s;this.endIndex=n-1,(s=(r=this.cbs).ontext)===null||s===void 0||s.call(r,Ps(e)),this.startIndex=n}isVoidElement(e){return this.htmlMode&&bO.has(e)}onopentagname(e,n){this.endIndex=n;let r=this.getSlice(e,n);this.lowerCaseTagNames&&(r=r.toLowerCase()),this.emitOpenTag(r)}emitOpenTag(e){var n,r,s,i;this.openTagStart=this.startIndex,this.tagname=e;let a=this.htmlMode&&gO.get(e);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){let o=this.stack.shift();(r=(n=this.cbs).onclosetag)===null||r===void 0||r.call(n,o,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&(HT.has(e)?this.foreignContext.unshift(!0):UT.has(e)&&this.foreignContext.unshift(!1))),(i=(s=this.cbs).onopentagname)===null||i===void 0||i.call(s,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var n,r;this.startIndex=this.openTagStart,this.attribs&&((r=(n=this.cbs).onopentag)===null||r===void 0||r.call(n,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,n){var r,s,i,a,o,c,l,h;this.endIndex=n;let d=this.getSlice(e,n);if(this.lowerCaseTagNames&&(d=d.toLowerCase()),this.htmlMode&&(HT.has(d)||UT.has(d))&&this.foreignContext.shift(),this.isVoidElement(d))this.htmlMode&&d==="br"&&((a=(i=this.cbs).onopentagname)===null||a===void 0||a.call(i,"br"),(c=(o=this.cbs).onopentag)===null||c===void 0||c.call(o,"br",{},!0),(h=(l=this.cbs).onclosetag)===null||h===void 0||h.call(l,"br",!1));else{let f=this.stack.indexOf(d);if(f!==-1)for(let p=0;p<=f;p++){let E=this.stack.shift();(s=(r=this.cbs).onclosetag)===null||s===void 0||s.call(r,E,p!==f)}else this.htmlMode&&d==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=n+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var n,r;let s=this.tagname;this.endOpenTag(e),this.stack[0]===s&&((r=(n=this.cbs).onclosetag)===null||r===void 0||r.call(n,s,!e),this.stack.shift())}onattribname(e,n){this.startIndex=e;let r=this.getSlice(e,n);this.attribname=this.lowerCaseAttributeNames?r.toLowerCase():r}onattribdata(e,n){this.attribvalue+=this.getSlice(e,n)}onattribentity(e){this.attribvalue+=Ps(e)}onattribend(e,n){var r,s;this.endIndex=n,(s=(r=this.cbs).onattribute)===null||s===void 0||s.call(r,this.attribname,this.attribvalue,e===Ft.Double?'"':e===Ft.Single?"'":e===Ft.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(e){let n=e.search(_O),r=n<0?e:e.substr(0,n);return this.lowerCaseTagNames&&(r=r.toLowerCase()),r}ondeclaration(e,n){this.endIndex=n;let r=this.getSlice(e,n);if(this.cbs.onprocessinginstruction){let s=this.getInstructionName(r);this.cbs.onprocessinginstruction(`!${s}`,`!${r}`)}this.startIndex=n+1}onprocessinginstruction(e,n){this.endIndex=n;let r=this.getSlice(e,n);if(this.cbs.onprocessinginstruction){let s=this.getInstructionName(r);this.cbs.onprocessinginstruction(`?${s}`,`?${r}`)}this.startIndex=n+1}oncomment(e,n,r){var s,i,a,o;this.endIndex=n,(i=(s=this.cbs).oncomment)===null||i===void 0||i.call(s,this.getSlice(e,n-r)),(o=(a=this.cbs).oncommentend)===null||o===void 0||o.call(a),this.startIndex=n+1}oncdata(e,n,r){var s,i,a,o,c,l,h,d,f,p;this.endIndex=n;let E=this.getSlice(e,n-r);!this.htmlMode||this.options.recognizeCDATA?((i=(s=this.cbs).oncdatastart)===null||i===void 0||i.call(s),(o=(a=this.cbs).ontext)===null||o===void 0||o.call(a,E),(l=(c=this.cbs).oncdataend)===null||l===void 0||l.call(c)):((d=(h=this.cbs).oncomment)===null||d===void 0||d.call(h,`[CDATA[${E}]]`),(p=(f=this.cbs).oncommentend)===null||p===void 0||p.call(f)),this.startIndex=n+1}onend(){var e,n;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let r=0;r=this.buffers[0].length;)this.shiftBuffer();let r=this.buffers[0].slice(e-this.bufferOffset,n-this.bufferOffset);for(;n-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),r+=this.buffers[0].slice(0,n-this.bufferOffset);return r}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var n,r;if(this.ended){(r=(n=this.cbs).onerror)===null||r===void 0||r.call(n,new Error(".write() after done!"));return}this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++)}end(e){var n,r;if(this.ended){(r=(n=this.cbs).onerror)===null||r===void 0||r.call(n,new Error(".end() after done!"));return}e&&this.write(e),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex{Yd();Yd();Qe();Qe();Kd();Ns();Gt();Gt();Gt()});var EO,TO,qT=x(()=>{BE();xd();MT();Rf();VT();EO=SE((t,e,n,r)=>e._useHtmlParser2?zT(t,e):LT(t,e,n,r)),TO=FE(EO,(t,e)=>e._useHtmlParser2?uu(t,e):PT(t))});var KT={};It(KT,{contains:()=>na,load:()=>TO,merge:()=>Uf});var YT=x(()=>{js();qT()});var GT=kn((Mj,WT)=>{"use strict";var xO=(YT(),KT);function yO(t){let e=xO.load(t),n=[];return[{tagName:"a",attr:"href"},{tagName:"area",attr:"href"},{tagName:"link",attr:"href"},{tagName:"audio",attr:"src"},{tagName:"embed",attr:"src"},{tagName:"iframe",attr:"src"},{tagName:"input",attr:"src"},{tagName:"img",attr:"src"},{tagName:"javascript",attr:"src"},{tagName:"source",attr:"src"},{tagName:"track",attr:"src"},{tagName:"video",attr:"src"}].forEach(({tagName:r,attr:s})=>{e(r).each((i,a)=>{e(a).attr(s)&&n.push(e(a).attr(s))})}),n}WT.exports=yO});var XT=kn((Fj,QT)=>{"use strict";var{marked:$T}=K1(),AO=GT();QT.exports=function(e,n=!1){$T.setOptions({mangle:!1});let r=$T(e);return AO(r)}});var rx={};It(rx,{default:()=>CO,getServer:()=>nx});function nx(t){let e=ol(t),n=ex.createServer(async function(r,s){s.setHeader("Access-Control-Allow-Origin","*"),s.setHeader("Access-Control-Allow-Methods","GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE"),s.setHeader("Access-Control-Allow-Headers","Access-Control-Allow-Headers, Origin, Authorization,Accept,x-client-id, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, hypothesis-client-version"),s.setHeader("Access-Control-Allow-Credentials","true");try{if(r.url){let i=tx.parse(r.url,!0);if(i.pathname==="/search"){let a=i.query.q,o=await e.search(a);s.statusCode=200,s.setHeader("Content-Type","application/json"),s.end(JSON.stringify(o))}else s.end()}}catch(i){s.statusCode=500,s.end(i)}});return{listen(r){console.debug(`Omnisearch - Starting HTTP server on port ${r}`),n.listen({port:parseInt(r),host:t.settings.DANGER_httpHost??"localhost"},()=>{console.log(`Omnisearch - Started HTTP server on port ${r}`),t.settings.DANGER_httpHost&&t.settings.DANGER_httpHost!=="localhost"?new Sa.Notice(`Omnisearch - Started non-localhost HTTP server at ${t.settings.DANGER_httpHost}:${r}`,12e4):t.settings.httpApiNotice&&new Sa.Notice(`Omnisearch - Started HTTP server on port ${r}`)}),n.on("error",s=>{console.error(s),new Sa.Notice(`Omnisearch - Cannot start HTTP server on ${r}. See console for more details.`)})},close(){n.close(),console.log("Omnisearch - Terminated HTTP server"),t.settings.httpApiEnabled&&t.settings.httpApiNotice&&new Sa.Notice("Omnisearch - Terminated HTTP server")}}}var ex,tx,Sa,CO,sx=x(()=>{ex=_e(require("http")),tx=_e(require("url")),Sa=_e(require("obsidian"));ul();CO=nx});It(exports,{default:()=>Jd});var Dn=_e(require("obsidian"));yi();Qc();Zt();ul();var ve=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,He=Object.keys,tt=Array.isArray;typeof Promise!="undefined"&&!ve.Promise&&(ve.Promise=Promise);function lt(t,e){return typeof e!="object"||He(e).forEach(function(n){t[n]=e[n]}),t}var Ci=Object.getPrototypeOf,GS={}.hasOwnProperty;function At(t,e){return GS.call(t,e)}function ps(t,e){typeof e=="function"&&(e=e(Ci(t))),(typeof Reflect=="undefined"?He:Reflect.ownKeys)(e).forEach(n=>{pn(t,n,e[n])})}var Ib=Object.defineProperty;function pn(t,e,n,r){Ib(t,e,lt(n&&At(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function ms(t){return{from:function(e){return t.prototype=Object.create(e.prototype),pn(t.prototype,"constructor",t),{extend:ps.bind(null,t.prototype)}}}}var $S=Object.getOwnPropertyDescriptor;function cl(t,e){let n=$S(t,e),r;return n||(r=Ci(t))&&cl(r,e)}var QS=[].slice;function Ao(t,e,n){return QS.call(t,e,n)}function wb(t,e){return e(t)}function Si(t){if(!t)throw new Error("Assertion Failed")}function Nb(t){ve.setImmediate?setImmediate(t):setTimeout(t,0)}function vb(t,e){return t.reduce((n,r,s)=>{var i=e(r,s);return i&&(n[i[0]]=i[1]),n},{})}function XS(t,e,n){try{t.apply(null,n)}catch(r){e&&e(r)}}function mn(t,e){if(typeof e=="string"&&At(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var n=[],r=0,s=e.length;r["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>ve[t]),e3=kb.map(t=>ve[t]);vb(kb,t=>[t,!0]);var $n=null;function Ii(t){$n=typeof WeakMap!="undefined"&&new WeakMap;let e=ll(t);return $n=null,e}function ll(t){if(!t||typeof t!="object")return t;let e=$n&&$n.get(t);if(e)return e;if(tt(t)){e=[],$n&&$n.set(t,e);for(var n=0,r=t.length;n=0)e=t;else{let i=Ci(t);e=i===Object.prototype?{}:Object.create(i),$n&&$n.set(t,e);for(var s in t)At(t,s)&&(e[s]=ll(t[s]))}return e}var{toString:t3}={};function fl(t){return t3.call(t).slice(8,-1)}var dl=typeof Symbol!="undefined"?Symbol.iterator:"@@iterator",n3=typeof dl=="symbol"?function(t){var e;return t!=null&&(e=t[dl])&&e.apply(t)}:function(){return null},gs={};function gn(t){var e,n,r,s;if(arguments.length===1){if(tt(t))return t.slice();if(this===gs&&typeof t=="string")return[t];if(s=n3(t)){for(n=[];r=s.next(),!r.done;)n.push(r.value);return n}if(t==null)return[t];if(e=t.length,typeof e=="number"){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}var hl=typeof Symbol!="undefined"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1,tn=typeof location!="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Rb(t,e){tn=t,Lb=e}var Lb=()=>!0,r3=!new Error("").stack;function Tr(){if(r3)try{throw Tr.arguments,new Error}catch(t){return t}return new Error}function pl(t,e){var n=t.stack;return n?(e=e||0,n.indexOf(t.name)===0&&(e+=(t.name+t.message).split(` +`).length),n.split(` +`).slice(e).filter(Lb).map(r=>` +`+r).join("")):""}var s3=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Pb=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ml=s3.concat(Pb),i3={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function bs(t,e){this._e=Tr(),this.name=t,this.message=e}ms(bs).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+pl(this._e,2))}},toString:function(){return this.name+": "+this.message}});function Mb(t,e){return t+". Errors: "+Object.keys(e).map(n=>e[n].toString()).filter((n,r,s)=>s.indexOf(n)===r).join(` +`)}function Co(t,e,n,r){this._e=Tr(),this.failures=e,this.failedKeys=r,this.successCount=n,this.message=Mb(t,e)}ms(Co).from(bs);function wi(t,e){this._e=Tr(),this.name="BulkError",this.failures=Object.keys(e).map(n=>e[n]),this.failuresByPos=e,this.message=Mb(t,e)}ms(wi).from(bs);var gl=ml.reduce((t,e)=>(t[e]=e+"Error",t),{}),a3=bs,se=ml.reduce((t,e)=>{var n=e+"Error";function r(s,i){this._e=Tr(),this.name=n,s?typeof s=="string"?(this.message=`${s}${i?` + `+i:""}`,this.inner=i||null):typeof s=="object"&&(this.message=`${s.name} ${s.message}`,this.inner=s):(this.message=i3[e]||n,this.inner=null)}return ms(r).from(a3),t[e]=r,t},{});se.Syntax=SyntaxError;se.Type=TypeError;se.Range=RangeError;var Fb=Pb.reduce((t,e)=>(t[e+"Error"]=se[e],t),{});function o3(t,e){if(!t||t instanceof bs||t instanceof TypeError||t instanceof SyntaxError||!t.name||!Fb[t.name])return t;var n=new Fb[t.name](e||t.message,t);return"stack"in t&&pn(n,"stack",{get:function(){return this.inner.stack}}),n}var So=ml.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=se[e]),t),{});So.ModifyError=Co;So.DexieError=bs;So.BulkError=wi;function ye(){}function Ni(t){return t}function u3(t,e){return t==null||t===Ni?e:function(n){return e(t(n))}}function xr(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function c3(t,e){return t===ye?e:function(){var n=t.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=e.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?xr(r,this.onsuccess):r),s&&(this.onerror=this.onerror?xr(s,this.onerror):s),i!==void 0?i:n}}function l3(t,e){return t===ye?e:function(){t.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?xr(n,this.onsuccess):n),r&&(this.onerror=this.onerror?xr(r,this.onerror):r)}}function f3(t,e){return t===ye?e:function(n){var r=t.apply(this,arguments);lt(n,r);var s=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var a=e.apply(this,arguments);return s&&(this.onsuccess=this.onsuccess?xr(s,this.onsuccess):s),i&&(this.onerror=this.onerror?xr(i,this.onerror):i),r===void 0?a===void 0?void 0:a:lt(r,a)}}function d3(t,e){return t===ye?e:function(){return e.apply(this,arguments)===!1?!1:t.apply(this,arguments)}}function bl(t,e){return t===ye?e:function(){var n=t.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then(function(){return e.apply(r,i)})}return e.apply(this,arguments)}}var vi={},h3=100,p3=20,Bb=100,[_l,Io,El]=typeof Promise=="undefined"?[]:(()=>{let t=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[t,Ci(t),t];let e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Ci(e),t]})(),jb=Io&&Io.then,wo=_l&&_l.constructor,Tl=!!El,xl=!1,m3=El?()=>{El.then(Oo)}:ve.setImmediate?setImmediate.bind(null,Oo):ve.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{Oo(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Oo,0)},Di=function(t,e){Oi.push([t,e]),No&&(m3(),No=!1)},yl=!0,No=!0,yr=[],vo=[],Al=null,Cl=Ni,_s={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:$b,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{$b(t[0],t[1])}catch{}})}},J=_s,Oi=[],Ar=0,Do=[];function q(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ye,this._lib=!1;var e=this._PSD=J;if(tn&&(this._stackHolder=Tr(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==vi)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Il(this,this._value);return}this._state=null,this._value=null,++e.ref,Ub(this,t)}var Sl={get:function(){var t=J,e=Lo;function n(r,s){var i=!t.global&&(t!==J||e!==Lo);let a=i&&!bn();var o=new q((c,l)=>{wl(this,new Hb(Mo(r,t,i,a),Mo(s,t,i,a),c,l,t))});return tn&&qb(o,this),o}return n.prototype=vi,n},set:function(t){pn(this,"then",t&&t.prototype===vi?Sl:{get:function(){return t},set:Sl.set})}};ps(q.prototype,{then:Sl,_then:function(t,e){wl(this,new Hb(null,null,t,e,J))},catch:function(t){if(arguments.length===1)return this.then(null,t);var e=arguments[0],n=arguments[1];return typeof e=="function"?this.then(null,r=>r instanceof e?n(r):ko(r)):this.then(null,r=>r&&r.name===e?n(r):ko(r))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),ko(e)))},stack:{get:function(){if(this._stack)return this._stack;try{xl=!0;var t=Vb(this,[],p3),e=t.join(` +From previous: `);return this._state!==null&&(this._stack=e),e}finally{xl=!1}}},timeout:function(t,e){return t<1/0?new q((n,r)=>{var s=setTimeout(()=>r(new se.Timeout(e)),t);this.then(n,r).finally(clearTimeout.bind(null,s))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&pn(q.prototype,Symbol.toStringTag,"Dexie.Promise");_s.env=Kb();function Hb(t,e,n,r,s){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof e=="function"?e:null,this.resolve=n,this.reject=r,this.psd=s}ps(q,{all:function(){var t=gn.apply(null,arguments).map(Po);return new q(function(e,n){t.length===0&&e([]);var r=t.length;t.forEach((s,i)=>q.resolve(s).then(a=>{t[i]=a,--r||e(t)},n))})},resolve:t=>{if(t instanceof q)return t;if(t&&typeof t.then=="function")return new q((n,r)=>{t.then(n,r)});var e=new q(vi,!0,t);return qb(e,Al),e},reject:ko,race:function(){var t=gn.apply(null,arguments).map(Po);return new q((e,n)=>{t.map(r=>q.resolve(r).then(e,n))})},PSD:{get:()=>J,set:t=>J=t},totalEchoes:{get:()=>Lo},newPSD:Qn,usePSD:Ts,scheduler:{get:()=>Di,set:t=>{Di=t}},rejectionMapper:{get:()=>Cl,set:t=>{Cl=t}},follow:(t,e)=>new q((n,r)=>Qn((s,i)=>{var a=J;a.unhandleds=[],a.onunhandled=i,a.finalize=xr(function(){b3(()=>{this.unhandleds.length===0?s():i(this.unhandleds[0])})},a.finalize),t()},e,n,r))});wo&&(wo.allSettled&&pn(q,"allSettled",function(){let t=gn.apply(null,arguments).map(Po);return new q(e=>{t.length===0&&e([]);let n=t.length,r=new Array(n);t.forEach((s,i)=>q.resolve(s).then(a=>r[i]={status:"fulfilled",value:a},a=>r[i]={status:"rejected",reason:a}).then(()=>--n||e(r)))})}),wo.any&&typeof AggregateError!="undefined"&&pn(q,"any",function(){let t=gn.apply(null,arguments).map(Po);return new q((e,n)=>{t.length===0&&n(new AggregateError([]));let r=t.length,s=new Array(r);t.forEach((i,a)=>q.resolve(i).then(o=>e(o),o=>{s[a]=o,--r||n(new AggregateError(s))}))})}));function Ub(t,e){try{e(n=>{if(t._state===null){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&ki();n&&typeof n.then=="function"?Ub(t,(s,i)=>{n instanceof q?n._then(s,i):n.then(s,i)}):(t._state=!0,t._value=n,zb(t)),r&&Ri()}},Il.bind(null,t))}catch(n){Il(t,n)}}function Il(t,e){if(vo.push(e),t._state===null){var n=t._lib&&ki();e=Cl(e),t._state=!1,t._value=e,tn&&e!==null&&typeof e=="object"&&!e._promise&&XS(()=>{var r=cl(e,"stack");e._promise=t,pn(e,"stack",{get:()=>xl?r&&(r.get?r.get.apply(e):r.value):t.stack})}),_3(t),zb(t),n&&Ri()}}function zb(t){var e=t._listeners;t._listeners=[];for(var n=0,r=e.length;n{--Ar==0&&Nl()},[]))}function wl(t,e){if(t._state===null){t._listeners.push(e);return}var n=t._state?e.onFulfilled:e.onRejected;if(n===null)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++Ar,Di(g3,[n,t,e])}function g3(t,e,n){try{Al=e;var r,s=e._value;e._state?r=t(s):(vo.length&&(vo=[]),r=t(s),vo.indexOf(s)===-1&&E3(e)),n.resolve(r)}catch(i){n.reject(i)}finally{Al=null,--Ar==0&&Nl(),--n.psd.ref||n.psd.finalize()}}function Vb(t,e,n){if(e.length===n)return e;var r="";if(t._state===!1){var s=t._value,i,a;s!=null?(i=s.name||"Error",a=s.message||s,r=pl(s,0)):(i=s,a=""),e.push(i+(a?": "+a:"")+r)}return tn&&(r=pl(t._stackHolder,2),r&&e.indexOf(r)===-1&&e.push(r),t._prev&&Vb(t._prev,e,n)),e}function qb(t,e){var n=e?e._numPrev+1:0;n0;)for(t=Oi,Oi=[],n=t.length,e=0;e0);yl=!0,No=!0}function Nl(){var t=yr;yr=[],t.forEach(r=>{r._PSD.onunhandled.call(null,r._value,r)});for(var e=Do.slice(0),n=e.length;n;)e[--n]()}function b3(t){function e(){t(),Do.splice(Do.indexOf(e),1)}Do.push(e),++Ar,Di(()=>{--Ar==0&&Nl()},[])}function _3(t){yr.some(e=>e._value===t._value)||yr.push(t)}function E3(t){for(var e=yr.length;e;)if(yr[--e]._value===t._value){yr.splice(e,1);return}}function ko(t){return new q(vi,!1,t)}function Oe(t,e){var n=J;return function(){var r=ki(),s=J;try{return Xn(n,!0),t.apply(this,arguments)}catch(i){e&&e(i)}finally{Xn(s,!1),r&&Ri()}}}var nt={awaits:0,echoes:0,id:0},T3=0,Ro=[],vl=0,Lo=0,x3=0;function Qn(t,e,n,r){var s=J,i=Object.create(s);i.parent=s,i.ref=0,i.global=!1,i.id=++x3;var a=_s.env;i.env=Tl?{Promise:q,PromiseProp:{value:q,configurable:!0,writable:!0},all:q.all,race:q.race,allSettled:q.allSettled,any:q.any,resolve:q.resolve,reject:q.reject,nthen:Wb(a.nthen,i),gthen:Wb(a.gthen,i)}:{},e&<(i,e),++s.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var o=Ts(i,t,n,r);return i.ref===0&&i.finalize(),o}function Es(){return nt.id||(nt.id=++T3),++nt.awaits,nt.echoes+=Bb,nt.id}function bn(){return nt.awaits?(--nt.awaits==0&&(nt.id=0),nt.echoes=nt.awaits*Bb,!0):!1}(""+jb).indexOf("[native code]")===-1&&(Es=bn=ye);function Po(t){return nt.echoes&&t&&t.constructor===wo?(Es(),t.then(e=>(bn(),e),e=>(bn(),ze(e)))):t}function y3(t){++Lo,(!nt.echoes||--nt.echoes==0)&&(nt.echoes=nt.id=0),Ro.push(J),Xn(t,!0)}function A3(){var t=Ro[Ro.length-1];Ro.pop(),Xn(t,!1)}function Xn(t,e){var n=J;if((e?nt.echoes&&(!vl++||t!==J):vl&&(!--vl||t!==J))&&Yb(e?y3.bind(null,t):A3),t!==J&&(J=t,n===_s&&(_s.env=Kb()),Tl)){var r=_s.env.Promise,s=t.env;Io.then=s.nthen,r.prototype.then=s.gthen,(n.global||t.global)&&(Object.defineProperty(ve,"Promise",s.PromiseProp),r.all=s.all,r.race=s.race,r.resolve=s.resolve,r.reject=s.reject,s.allSettled&&(r.allSettled=s.allSettled),s.any&&(r.any=s.any))}}function Kb(){var t=ve.Promise;return Tl?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(ve,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:Io.then,gthen:t.prototype.then}:{}}function Ts(t,e,n,r,s){var i=J;try{return Xn(t,!0),e(n,r,s)}finally{Xn(i,!1)}}function Yb(t){jb.call(_l,t)}function Mo(t,e,n,r){return typeof t!="function"?t:function(){var s=J;n&&Es(),Xn(e,!0);try{return t.apply(this,arguments)}finally{Xn(s,!1),r&&Yb(bn)}}}function Wb(t,e){return function(n,r){return t.call(this,Mo(n,e),Mo(r,e))}}var Gb="unhandledrejection";function $b(t,e){var n;try{n=e.onuncatched(t)}catch{}if(n!==!1)try{var r,s={promise:e,reason:t};if(ve.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(Gb,!0,!0),lt(r,s)):ve.CustomEvent&&(r=new CustomEvent(Gb,{detail:s}),lt(r,s)),r&&ve.dispatchEvent&&(dispatchEvent(r),!ve.PromiseRejectionEvent&&ve.onunhandledrejection))try{ve.onunhandledrejection(r)}catch{}tn&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var ze=q.reject;function Dl(t,e,n,r){if(!t.idbdb||!t._state.openComplete&&!J.letThrough&&!t._vip){if(t._state.openComplete)return ze(new se.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return ze(new se.DatabaseClosed);t.open().catch(ye)}return t._state.dbReadyPromise.then(()=>Dl(t,e,n,r))}else{var s=t._createTransaction(e,n,t._dbSchema);try{s.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===gl.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Dl(t,e,n,r))):ze(i)}return s._promise(e,(i,a)=>Qn(()=>(J.trans=s,r(i,a,s)))).then(i=>s._completion.then(()=>i))}}var Qb="3.2.7",Cr=String.fromCharCode(65535),Ol=-1/0,_n="Invalid key provided. Keys must be of type string, number, Date or Array.",Xb="String expected.",Li=[],Fo=typeof navigator!="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),C3=Fo,S3=Fo,Zb=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Bo="__dbnames",kl="readonly",Rl="readwrite";function Sr(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}var Jb={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jo(t){return typeof t=="string"&&!/\./.test(t)?e=>(e[t]===void 0&&t in e&&(e=Ii(e),delete e[t]),e):e=>e}var e1=class{_trans(e,n,r){let s=this._tx||J.trans,i=this.name;function a(c,l,h){if(!h.schema[i])throw new se.NotFound("Table "+i+" not part of transaction");return n(h.idbtrans,h)}let o=ki();try{return s&&s.db===this.db?s===J.trans?s._promise(e,a,r):Qn(()=>s._promise(e,a,r),{trans:s,transless:J.transless||J}):Dl(this.db,e,[this.name],a)}finally{o&&Ri()}}get(e,n){return e&&e.constructor===Object?this.where(e).first(n):this._trans("readonly",r=>this.core.get({trans:r,key:e}).then(s=>this.hook.reading.fire(s))).then(n)}where(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(tt(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let n=He(e);if(n.length===1)return this.where(n[0]).equals(e[n[0]]);let r=this.schema.indexes.concat(this.schema.primKey).filter(l=>{if(l.compound&&n.every(h=>l.keyPath.indexOf(h)>=0)){for(let h=0;hl.keyPath.length-h.keyPath.length)[0];if(r&&this.db._maxKey!==Cr){let l=r.keyPath.slice(0,n.length);return this.where(l).equals(l.map(h=>e[h]))}!r&&tn&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);let{idxByName:s}=this.schema,i=this.db._deps.indexedDB;function a(l,h){try{return i.cmp(l,h)===0}catch{return!1}}let[o,c]=n.reduce(([l,h],d)=>{let f=s[d],p=e[d];return[l||f,l||!f?Sr(h,f&&f.multi?E=>{let T=mn(E,d);return tt(T)&&T.some(w=>a(p,w))}:E=>a(p,mn(E,d))):h]},[null,null]);return o?this.where(o.name).equals(e[o.keyPath]).filter(c):r?this.filter(c):this.where(n).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,tt(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let n=r=>{if(!r)return r;let s=Object.create(e.prototype);for(var i in r)if(At(r,i))try{s[i]=r[i]}catch{}return s};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),e}defineClass(){function e(n){lt(this,n)}return this.mapToClass(e)}add(e,n){let{auto:r,keyPath:s}=this.schema.primKey,i=e;return s&&r&&(i=jo(s)(e)),this._trans("readwrite",a=>this.core.mutate({trans:a,type:"add",keys:n!=null?[n]:null,values:[i]})).then(a=>a.numFailures?q.reject(a.failures[0]):a.lastResult).then(a=>{if(s)try{Yt(e,s,a)}catch{}return a})}update(e,n){if(typeof e=="object"&&!tt(e)){let r=mn(e,this.schema.primKey.keyPath);if(r===void 0)return ze(new se.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?He(n).forEach(s=>{Yt(e,s,n[s])}):n(e,{value:e,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}else return this.where(":id").equals(e).modify(n)}put(e,n){let{auto:r,keyPath:s}=this.schema.primKey,i=e;return s&&r&&(i=jo(s)(e)),this._trans("readwrite",a=>this.core.mutate({trans:a,type:"put",values:[i],keys:n!=null?[n]:null})).then(a=>a.numFailures?q.reject(a.failures[0]):a.lastResult).then(a=>{if(s)try{Yt(e,s,a)}catch{}return a})}delete(e){return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:[e]})).then(n=>n.numFailures?q.reject(n.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:Jb})).then(e=>e.numFailures?q.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",n=>this.core.getMany({keys:e,trans:n}).then(r=>r.map(s=>this.hook.reading.fire(s))))}bulkAdd(e,n,r){let s=Array.isArray(n)?n:void 0;r=r||(s?void 0:n);let i=r?r.allKeys:void 0;return this._trans("readwrite",a=>{let{auto:o,keyPath:c}=this.schema.primKey;if(c&&s)throw new se.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(s&&s.length!==e.length)throw new se.InvalidArgument("Arguments objects and keys must have the same length");let l=e.length,h=c&&o?e.map(jo(c)):e;return this.core.mutate({trans:a,type:"add",keys:s,values:h,wantResults:i}).then(({numFailures:d,results:f,lastResult:p,failures:E})=>{let T=i?f:p;if(d===0)return T;throw new wi(`${this.name}.bulkAdd(): ${d} of ${l} operations failed`,E)})})}bulkPut(e,n,r){let s=Array.isArray(n)?n:void 0;r=r||(s?void 0:n);let i=r?r.allKeys:void 0;return this._trans("readwrite",a=>{let{auto:o,keyPath:c}=this.schema.primKey;if(c&&s)throw new se.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(s&&s.length!==e.length)throw new se.InvalidArgument("Arguments objects and keys must have the same length");let l=e.length,h=c&&o?e.map(jo(c)):e;return this.core.mutate({trans:a,type:"put",keys:s,values:h,wantResults:i}).then(({numFailures:d,results:f,lastResult:p,failures:E})=>{let T=i?f:p;if(d===0)return T;throw new wi(`${this.name}.bulkPut(): ${d} of ${l} operations failed`,E)})})}bulkDelete(e){let n=e.length;return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:e})).then(({numFailures:r,lastResult:s,failures:i})=>{if(r===0)return s;throw new wi(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`,i)})}};function Pi(t){var e={},n=function(o,c){if(c){for(var l=arguments.length,h=new Array(l-1);--l;)h[l-1]=arguments[l];return e[o].subscribe.apply(null,h),t}else if(typeof o=="string")return e[o]};n.addEventType=i;for(var r=1,s=arguments.length;rSr(r(),e()):e,t.justLimit=n&&!r}function w3(t,e){t.isMatch=Sr(t.isMatch,e)}function Ho(t,e){if(t.isPrimKey)return e.primaryKey;let n=e.getIndexByKeyPath(t.index);if(!n)throw new se.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return n}function t1(t,e,n){let r=Ho(t,e.schema);return e.openCursor({trans:n,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:r,range:t.range}})}function Uo(t,e,n,r){let s=t.replayFilter?Sr(t.filter,t.replayFilter()):t.filter;if(t.or){let i={},a=(o,c,l)=>{if(!s||s(c,l,f=>c.stop(f),f=>c.fail(f))){var h=c.primaryKey,d=""+h;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(h)),At(i,d)||(i[d]=!0,e(o,c,l))}};return Promise.all([t.or._iterate(a,n),n1(t1(t,r,n),t.algorithm,a,!t.keysOnly&&t.valueMapper)])}else return n1(t1(t,r,n),Sr(t.algorithm,s),e,!t.keysOnly&&t.valueMapper)}function n1(t,e,n,r){var s=r?(a,o,c)=>n(r(a),o,c):n,i=Oe(s);return t.then(a=>{if(a)return a.start(()=>{var o=()=>a.continue();(!e||e(a,c=>o=c,c=>{a.stop(c),o=ye},c=>{a.fail(c),o=ye}))&&i(a.value,a,c=>o=c),o()})})}function ft(t,e){try{let n=r1(t),r=r1(e);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return t>e?1:tUo(n,e,r,n.table.core))}count(e){return this._read(n=>{let r=this._ctx,s=r.table.core;if(xs(r,!0))return s.count({trans:n,query:{index:Ho(r,s.schema),range:r.range}}).then(a=>Math.min(a,r.limit));var i=0;return Uo(r,()=>(++i,!1),n,s).then(()=>i)}).then(e)}sortBy(e,n){let r=e.split(".").reverse(),s=r[0],i=r.length-1;function a(l,h){return h?a(l[r[h]],h-1):l[s]}var o=this._ctx.dir==="next"?1:-1;function c(l,h){var d=a(l,i),f=a(h,i);return df?o:0}return this.toArray(function(l){return l.sort(c)}).then(n)}toArray(e){return this._read(n=>{var r=this._ctx;if(r.dir==="next"&&xs(r,!0)&&r.limit>0){let{valueMapper:s}=r,i=Ho(r,r.table.core.schema);return r.table.core.query({trans:n,limit:r.limit,values:!0,query:{index:i,range:r.range}}).then(({result:a})=>s?a.map(s):a)}else{let s=[];return Uo(r,i=>s.push(i),n,r.table.core).then(()=>s)}},e)}offset(e){var n=this._ctx;return e<=0?this:(n.offset+=e,xs(n)?Pl(n,()=>{var r=e;return(s,i)=>r===0?!0:r===1?(--r,!1):(i(()=>{s.advance(r),r=0}),!1)}):Pl(n,()=>{var r=e;return()=>--r<0}),this)}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Pl(this._ctx,()=>{var n=e;return function(r,s,i){return--n<=0&&s(i),n>=0}},!0),this}until(e,n){return Ll(this._ctx,function(r,s,i){return e(r.value)?(s(i),n):!0}),this}first(e){return this.limit(1).toArray(function(n){return n[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){return Ll(this._ctx,function(n){return e(n.value)}),w3(this._ctx,e),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,s){e(s.key,s)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,s){e(s.primaryKey,s)})}keys(e){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(s,i){r.push(i.key)}).then(function(){return r}).then(e)}primaryKeys(e){var n=this._ctx;if(n.dir==="next"&&xs(n,!0)&&n.limit>0)return this._read(s=>{var i=Ho(n,n.table.core.schema);return n.table.core.query({trans:s,values:!1,limit:n.limit,query:{index:i,range:n.range}})}).then(({result:s})=>s).then(e);n.keysOnly=!n.isMatch;var r=[];return this.each(function(s,i){r.push(i.primaryKey)}).then(function(){return r}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(n){return n[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var r={};return Ll(this._ctx,function(s){var i=s.primaryKey.toString(),a=At(r,i);return r[i]=!0,!a}),this}modify(e){var n=this._ctx;return this._write(r=>{var s;if(typeof e=="function")s=e;else{var i=He(e),a=i.length;s=function(T){for(var w=!1,m=0;m{let{failures:m,numFailures:I}=w;f+=T-I;for(let A of He(m))d.push(m[A])};return this.clone().primaryKeys().then(T=>{let w=m=>{let I=Math.min(h,T.length-m);return o.getMany({trans:r,keys:T.slice(m,m+I),cache:"immutable"}).then(A=>{let b=[],S=[],C=c?[]:null,N=[];for(let L=0;L0&&o.mutate({trans:r,type:"add",values:b}).then(L=>{for(let z in L.failures)N.splice(parseInt(z),1);E(b.length,L)})).then(()=>(S.length>0||O&&typeof e=="object")&&o.mutate({trans:r,type:"put",keys:C,values:S,criteria:O,changeSpec:typeof e!="function"&&e}).then(L=>E(S.length,L))).then(()=>(N.length>0||O&&e===Ml)&&o.mutate({trans:r,type:"delete",keys:N,criteria:O}).then(L=>E(N.length,L))).then(()=>T.length>m+I&&w(m+h))})};return w(0).then(()=>{if(d.length>0)throw new Co("Error modifying one or more objects",d,f,p);return T.length})})})}delete(){var e=this._ctx,n=e.range;return xs(e)&&(e.isPrimKey&&!S3||n.type===3)?this._write(r=>{let{primaryKey:s}=e.table.core.schema,i=n;return e.table.core.count({trans:r,query:{index:s,range:i}}).then(a=>e.table.core.mutate({trans:r,type:"deleteRange",range:i}).then(({failures:o,lastResult:c,results:l,numFailures:h})=>{if(h)throw new Co("Could not delete some values",Object.keys(o).map(d=>o[d]),a-h);return a-h}))}):this.modify(Ml)}},Ml=(t,e)=>e.value=null;function D3(t){return Mi(i1.prototype,function(n,r){this.db=t;let s=Jb,i=null;if(r)try{s=r()}catch(l){i=l}let a=n._ctx,o=a.table,c=o.hook.reading.fire;this._ctx={table:o,index:a.index,isPrimKey:!a.index||o.schema.primKey.keyPath&&a.index===o.schema.primKey.name,range:s,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:i,or:a.or,valueMapper:c!==Ni?c:null}})}function O3(t,e){return te?-1:t===e?0:1}function Ct(t,e,n){var r=t instanceof Fl?new t.Collection(t):t;return r._ctx.error=n?new n(e):new TypeError(e),r}function ys(t){return new t.Collection(t,()=>a1("")).limit(0)}function R3(t){return t==="next"?e=>e.toUpperCase():e=>e.toLowerCase()}function L3(t){return t==="next"?e=>e.toLowerCase():e=>e.toUpperCase()}function P3(t,e,n,r,s,i){for(var a=Math.min(t.length,r.length),o=-1,c=0;c=0?t.substr(0,o)+e[o]+n.substr(o+1):null;s(t[c],l)<0&&(o=c)}return atypeof T=="string"))return Ct(t,Xb);function f(T){s=R3(T),i=L3(T),a=T==="next"?O3:k3;var w=n.map(function(m){return{lower:i(m),upper:s(m)}}).sort(function(m,I){return a(m.lower,I.lower)});o=w.map(function(m){return m.upper}),c=w.map(function(m){return m.lower}),l=T,h=T==="next"?"":r}f("next");var p=new t.Collection(t,()=>Zn(o[0],c[d-1]+r));p._ondirectionchange=function(T){f(T)};var E=0;return p._addAlgorithm(function(T,w,m){var I=T.key;if(typeof I!="string")return!1;var A=i(I);if(e(A,c,E))return!0;for(var b=null,S=E;S0)&&(b=C)}return w(b!==null?function(){T.continue(b+h)}:m),!1}),p}function Zn(t,e,n,r){return{type:2,lower:t,upper:e,lowerOpen:n,upperOpen:r}}function a1(t){return{type:1,lower:t,upper:t}}var Fl=class{get Collection(){return this._ctx.table.db.Collection}between(e,n,r,s){r=r!==!1,s=s===!0;try{return this._cmp(e,n)>0||this._cmp(e,n)===0&&(r||s)&&!(r&&s)?ys(this):new this.Collection(this,()=>Zn(e,n,!r,!s))}catch{return Ct(this,_n)}}equals(e){return e==null?Ct(this,_n):new this.Collection(this,()=>a1(e))}above(e){return e==null?Ct(this,_n):new this.Collection(this,()=>Zn(e,void 0,!0))}aboveOrEqual(e){return e==null?Ct(this,_n):new this.Collection(this,()=>Zn(e,void 0,!1))}below(e){return e==null?Ct(this,_n):new this.Collection(this,()=>Zn(void 0,e,!1,!0))}belowOrEqual(e){return e==null?Ct(this,_n):new this.Collection(this,()=>Zn(void 0,e))}startsWith(e){return typeof e!="string"?Ct(this,Xb):this.between(e,e+Cr,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):zo(this,(n,r)=>n.indexOf(r[0])===0,[e],Cr)}equalsIgnoreCase(e){return zo(this,(n,r)=>n===r[0],[e],"")}anyOfIgnoreCase(){var e=gn.apply(gs,arguments);return e.length===0?ys(this):zo(this,(n,r)=>r.indexOf(n)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=gn.apply(gs,arguments);return e.length===0?ys(this):zo(this,(n,r)=>r.some(s=>n.indexOf(s)===0),e,Cr)}anyOf(){let e=gn.apply(gs,arguments),n=this._cmp;try{e.sort(n)}catch{return Ct(this,_n)}if(e.length===0)return ys(this);let r=new this.Collection(this,()=>Zn(e[0],e[e.length-1]));r._ondirectionchange=i=>{n=i==="next"?this._ascending:this._descending,e.sort(n)};let s=0;return r._addAlgorithm((i,a,o)=>{let c=i.key;for(;n(c,e[s])>0;)if(++s,s===e.length)return a(o),!1;return n(c,e[s])===0?!0:(a(()=>{i.continue(e[s])}),!1)}),r}notEqual(e){return this.inAnyRange([[Ol,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=gn.apply(gs,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return Ct(this,_n)}let n=e.reduce((r,s)=>r?r.concat([[r[r.length-1][1],s]]):[[Ol,s]],null);return n.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,n){let r=this._cmp,s=this._ascending,i=this._descending,a=this._min,o=this._max;if(e.length===0)return ys(this);if(!e.every(b=>b[0]!==void 0&&b[1]!==void 0&&s(b[0],b[1])<=0))return Ct(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",se.InvalidArgument);let c=!n||n.includeLowers!==!1,l=n&&n.includeUppers===!0;function h(b,S){let C=0,N=b.length;for(;C0){O[0]=a(O[0],S[0]),O[1]=o(O[1],S[1]);break}}return C===N&&b.push(S),b}let d=s;function f(b,S){return d(b[0],S[0])}let p;try{p=e.reduce(h,[]),p.sort(f)}catch{return Ct(this,_n)}let E=0,T=l?b=>s(b,p[E][1])>0:b=>s(b,p[E][1])>=0,w=c?b=>i(b,p[E][0])>0:b=>i(b,p[E][0])>=0;function m(b){return!T(b)&&!w(b)}let I=T,A=new this.Collection(this,()=>Zn(p[0][0],p[p.length-1][1],!c,!l));return A._ondirectionchange=b=>{b==="next"?(I=T,d=s):(I=w,d=i),p.sort(f)},A._addAlgorithm((b,S,C)=>{for(var N=b.key;I(N);)if(++E,E===p.length)return S(C),!1;return m(N)?!0:(this._cmp(N,p[E][1])===0||this._cmp(N,p[E][0])===0||S(()=>{d===s?b.continue(p[E][0]):b.continue(p[E][1])}),!1)}),A}startsWithAnyOf(){let e=gn.apply(gs,arguments);return e.every(n=>typeof n=="string")?e.length===0?ys(this):this.inAnyRange(e.map(n=>[n,n+Cr])):Ct(this,"startsWithAnyOf() only works with strings")}};function M3(t){return Mi(Fl.prototype,function(n,r,s){this.db=t,this._ctx={table:n,index:r===":id"?null:r,or:s};let i=t._deps.indexedDB;if(!i)throw new se.MissingAPI;this._cmp=this._ascending=i.cmp.bind(i),this._descending=(a,o)=>i.cmp(o,a),this._max=(a,o)=>i.cmp(a,o)>0?a:o,this._min=(a,o)=>i.cmp(a,o)<0?a:o,this._IDBKeyRange=t._deps.IDBKeyRange})}function nn(t){return Oe(function(e){return Fi(e),t(e.target.error),!1})}function Fi(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}var Bi="storagemutated",Jn="x-storagemutated-1",er=Pi(null,Bi),o1=class{_lock(){return Si(!J.global),++this._reculock,this._reculock===1&&!J.global&&(J.lockOwnerFor=this),this}_unlock(){if(Si(!J.global),--this._reculock==0)for(J.global||(J.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Ts(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&J.lockOwnerFor!==this}create(e){if(!this.mode)return this;let n=this.db.idbdb,r=this.db._state.dbOpenError;if(Si(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new se.DatabaseClosed(r);case"MissingAPIError":throw new se.MissingAPI(r.message,r);default:throw new se.OpenFailed(r)}if(!this.active)throw new se.TransactionInactive;return Si(this._completion._state===null),e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),e.onerror=Oe(s=>{Fi(s),this._reject(e.error)}),e.onabort=Oe(s=>{Fi(s),this.active&&this._reject(new se.Abort(e.error)),this.active=!1,this.on("abort").fire(s)}),e.oncomplete=Oe(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&er.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,r){if(e==="readwrite"&&this.mode!=="readwrite")return ze(new se.ReadOnly("Transaction is readonly"));if(!this.active)return ze(new se.TransactionInactive);if(this._locked())return new q((i,a)=>{this._blockedFuncs.push([()=>{this._promise(e,n,r).then(i,a)},J])});if(r)return Qn(()=>{var i=new q((a,o)=>{this._lock();let c=n(a,o,this);c&&c.then&&c.then(a,o)});return i.finally(()=>this._unlock()),i._lib=!0,i});var s=new q((i,a)=>{var o=n(i,a,this);o&&o.then&&o.then(i,a)});return s._lib=!0,s}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();let r=q.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>r);else{n._waitingFor=r,n._waitingQueue=[];var s=n.idbtrans.objectStore(n.storeNames[0]);(function a(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(s.get(-1/0).onsuccess=a)})()}var i=n._waitingFor;return new q((a,o)=>{r.then(c=>n._waitingQueue.push(Oe(a.bind(null,c))),c=>n._waitingQueue.push(Oe(o.bind(null,c)))).finally(()=>{n._waitingFor===i&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new se.Abort))}table(e){let n=this._memoizedTables||(this._memoizedTables={});if(At(n,e))return n[e];let r=this.schema[e];if(!r)throw new se.NotFound("Table "+e+" not part of transaction");let s=new this.db.Table(e,r,this);return s.core=this.db.core.table(e),n[e]=s,s}};function F3(t){return Mi(o1.prototype,function(n,r,s,i,a){this.db=t,this.mode=n,this.storeNames=r,this.schema=s,this.chromeTransactionDurability=i,this.idbtrans=null,this.on=Pi(this,"complete","error","abort"),this.parent=a||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new q((o,c)=>{this._resolve=o,this._reject=c}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},o=>{var c=this.active;return this.active=!1,this.on.error.fire(o),this.parent?this.parent._reject(o):c&&this.idbtrans&&this.idbtrans.abort(),ze(o)})})}function Bl(t,e,n,r,s,i,a){return{name:t,keyPath:e,unique:n,multi:r,auto:s,compound:i,src:(n&&!a?"&":"")+(r?"*":"")+(s?"++":"")+u1(e)}}function u1(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function c1(t,e,n){return{name:t,primKey:e,indexes:n,mappedClass:null,idxByName:vb(n,r=>[r.name,r])}}function B3(t){return t.length===1?t[0]:t}var ji=t=>{try{return t.only([[]]),ji=()=>[[]],[[]]}catch{return ji=()=>Cr,Cr}};function jl(t){return t==null?()=>{}:typeof t=="string"?j3(t):e=>mn(e,t)}function j3(t){return t.split(".").length===1?n=>n[t]:n=>mn(n,t)}function l1(t){return[].slice.call(t)}var H3=0;function Hi(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function U3(t,e,n){function r(h,d){let f=l1(h.objectStoreNames);return{schema:{name:h.name,tables:f.map(p=>d.objectStore(p)).map(p=>{let{keyPath:E,autoIncrement:T}=p,w=tt(E),m=E==null,I={},A={name:p.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:m,compound:w,keyPath:E,autoIncrement:T,unique:!0,extractKey:jl(E)},indexes:l1(p.indexNames).map(b=>p.index(b)).map(b=>{let{name:S,unique:C,multiEntry:N,keyPath:O}=b,L=tt(O),z={name:S,compound:L,keyPath:O,unique:C,multiEntry:N,extractKey:jl(O)};return I[Hi(O)]=z,z}),getIndexByKeyPath:b=>I[Hi(b)]};return I[":id"]=A.primaryKey,E!=null&&(I[Hi(E)]=A.primaryKey),A})},hasGetAll:f.length>0&&"getAll"in d.objectStore(f[0])&&!(typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function s(h){if(h.type===3)return null;if(h.type===4)throw new Error("Cannot convert never type to IDBKeyRange");let{lower:d,upper:f,lowerOpen:p,upperOpen:E}=h;return d===void 0?f===void 0?null:e.upperBound(f,!!E):f===void 0?e.lowerBound(d,!!p):e.bound(d,f,!!p,!!E)}function i(h){let d=h.name;function f({trans:T,type:w,keys:m,values:I,range:A}){return new Promise((b,S)=>{b=Oe(b);let C=T.objectStore(d),N=C.keyPath==null,O=w==="put"||w==="add";if(!O&&w!=="delete"&&w!=="deleteRange")throw new Error("Invalid operation type: "+w);let{length:L}=m||I||{length:1};if(m&&I&&m.length!==I.length)throw new Error("Given keys array must have same length as given values array.");if(L===0)return b({numFailures:0,failures:{},results:[],lastResult:void 0});let z,W=[],te=[],X=0,ke=ge=>{++X,Fi(ge)};if(w==="deleteRange"){if(A.type===4)return b({numFailures:X,failures:te,results:[],lastResult:void 0});A.type===3?W.push(z=C.clear()):W.push(z=C.delete(s(A)))}else{let[ge,Re]=O?N?[I,m]:[I,null]:[m,null];if(O)for(let k=0;k{let Re=ge.target.result;W.forEach((k,P)=>k.error!=null&&(te[P]=k.error)),b({numFailures:X,failures:te,results:w==="delete"?m:W.map(k=>k.result),lastResult:Re})};z.onerror=ge=>{ke(ge),Le(ge)},z.onsuccess=Le})}function p({trans:T,values:w,query:m,reverse:I,unique:A}){return new Promise((b,S)=>{b=Oe(b);let{index:C,range:N}=m,O=T.objectStore(d),L=C.isPrimaryKey?O:O.index(C.name),z=I?A?"prevunique":"prev":A?"nextunique":"next",W=w||!("openKeyCursor"in L)?L.openCursor(s(N),z):L.openKeyCursor(s(N),z);W.onerror=nn(S),W.onsuccess=Oe(te=>{let X=W.result;if(!X){b(null);return}X.___id=++H3,X.done=!1;let ke=X.continue.bind(X),Le=X.continuePrimaryKey;Le&&(Le=Le.bind(X));let ge=X.advance.bind(X),Re=()=>{throw new Error("Cursor not started")},k=()=>{throw new Error("Cursor not stopped")};X.trans=T,X.stop=X.continue=X.continuePrimaryKey=X.advance=Re,X.fail=Oe(S),X.next=function(){let P=1;return this.start(()=>P--?this.continue():this.stop()).then(()=>this)},X.start=P=>{let H=new Promise((oe,Ce)=>{oe=Oe(oe),W.onerror=nn(Ce),X.fail=Ce,X.stop=Ue=>{X.stop=X.continue=X.continuePrimaryKey=X.advance=k,oe(Ue)}}),Z=()=>{if(W.result)try{P()}catch(oe){X.fail(oe)}else X.done=!0,X.start=()=>{throw new Error("Cursor behind last entry")},X.stop()};return W.onsuccess=Oe(oe=>{W.onsuccess=Z,Z()}),X.continue=ke,X.continuePrimaryKey=Le,X.advance=ge,Z(),H},b(X)},S)})}function E(T){return w=>new Promise((m,I)=>{m=Oe(m);let{trans:A,values:b,limit:S,query:C}=w,N=S===1/0?void 0:S,{index:O,range:L}=C,z=A.objectStore(d),W=O.isPrimaryKey?z:z.index(O.name),te=s(L);if(S===0)return m({result:[]});if(T){let X=b?W.getAll(te,N):W.getAllKeys(te,N);X.onsuccess=ke=>m({result:ke.target.result}),X.onerror=nn(I)}else{let X=0,ke=b||!("openKeyCursor"in W)?W.openCursor(te):W.openKeyCursor(te),Le=[];ke.onsuccess=ge=>{let Re=ke.result;if(!Re)return m({result:Le});if(Le.push(b?Re.value:Re.primaryKey),++X===S)return m({result:Le});Re.continue()},ke.onerror=nn(I)}})}return{name:d,schema:h,mutate:f,getMany({trans:T,keys:w}){return new Promise((m,I)=>{m=Oe(m);let A=T.objectStore(d),b=w.length,S=new Array(b),C=0,N=0,O,L=W=>{let te=W.target;(S[te._pos]=te.result)!=null,++N===C&&m(S)},z=nn(I);for(let W=0;W{m=Oe(m);let b=T.objectStore(d).get(w);b.onsuccess=S=>m(S.target.result),b.onerror=nn(I)})},query:E(o),openCursor:p,count({query:T,trans:w}){let{index:m,range:I}=T;return new Promise((A,b)=>{let S=w.objectStore(d),C=m.isPrimaryKey?S:S.index(m.name),N=s(I),O=N?C.count(N):C.count();O.onsuccess=Oe(L=>A(L.target.result)),O.onerror=nn(b)})}}}let{schema:a,hasGetAll:o}=r(t,n),c=a.tables.map(h=>i(h)),l={};return c.forEach(h=>l[h.name]=h),{stack:"dbcore",transaction:t.transaction.bind(t),table(h){if(!l[h])throw new Error(`Table '${h}' not found`);return l[h]},MIN_KEY:-1/0,MAX_KEY:ji(e),schema:a}}function z3(t,e){return e.reduce((n,{create:r})=>B(B({},n),r(n)),t)}function V3(t,e,{IDBKeyRange:n,indexedDB:r},s){return{dbcore:z3(U3(e,n,s),t.dbcore)}}function Hl({_novip:t},e){let n=e.db,r=V3(t._middlewares,n,t._deps,e);t.core=r.dbcore,t.tables.forEach(s=>{let i=s.name;t.core.schema.tables.some(a=>a.name===i)&&(s.core=t.core.table(i),t[i]instanceof t.Table&&(t[i].core=s.core))})}function Vo({_novip:t},e,n,r){n.forEach(s=>{let i=r[s];e.forEach(a=>{let o=cl(a,s);(!o||"value"in o&&o.value===void 0)&&(a===t.Transaction.prototype||a instanceof t.Transaction?pn(a,s,{get(){return this.table(s)},set(c){Ib(this,s,{value:c,writable:!0,configurable:!0,enumerable:!0})}}):a[s]=new t.Table(s,i))})})}function Ul({_novip:t},e){e.forEach(n=>{for(let r in n)n[r]instanceof t.Table&&delete n[r]})}function q3(t,e){return t._cfg.version-e._cfg.version}function K3(t,e,n,r){let s=t._dbSchema,i=t._createTransaction("readwrite",t._storeNames,s);i.create(n),i._completion.catch(r);let a=i._reject.bind(i),o=J.transless||J;Qn(()=>{J.trans=i,J.transless=o,e===0?(He(s).forEach(c=>{zl(n,c,s[c].primKey,s[c].indexes)}),Hl(t,n),q.follow(()=>t.on.populate.fire(i)).catch(a)):Y3(t,e,i,n).catch(a)})}function Y3({_novip:t},e,n,r){let s=[],i=t._versions,a=t._dbSchema=ql(t,t.idbdb,r),o=!1;i.filter(h=>h._cfg.version>=e).forEach(h=>{s.push(()=>{let d=a,f=h._cfg.dbschema;Kl(t,d,r),Kl(t,f,r),a=t._dbSchema=f;let p=f1(d,f);p.add.forEach(T=>{zl(r,T[0],T[1].primKey,T[1].indexes)}),p.change.forEach(T=>{if(T.recreate)throw new se.Upgrade("Not yet support for changing primary key");{let w=r.objectStore(T.name);T.add.forEach(m=>Vl(w,m)),T.change.forEach(m=>{w.deleteIndex(m.name),Vl(w,m)}),T.del.forEach(m=>w.deleteIndex(m))}});let E=h._cfg.contentUpgrade;if(E&&h._cfg.version>e){Hl(t,r),n._memoizedTables={},o=!0;let T=Db(f);p.del.forEach(A=>{T[A]=d[A]}),Ul(t,[t.Transaction.prototype]),Vo(t,[t.Transaction.prototype],He(T),T),n.schema=T;let w=hl(E);w&&Es();let m,I=q.follow(()=>{if(m=E(n),m&&w){var A=bn.bind(null,null);m.then(A,A)}});return m&&typeof m.then=="function"?q.resolve(m):I.then(()=>m)}}),s.push(d=>{if(!o||!C3){let f=h._cfg.dbschema;G3(f,d)}Ul(t,[t.Transaction.prototype]),Vo(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),n.schema=t._dbSchema})});function l(){return s.length?q.resolve(s.shift()(n.idbtrans)).then(l):q.resolve()}return l().then(()=>{W3(a,r)})}function f1(t,e){let n={del:[],add:[],change:[]},r;for(r in t)e[r]||n.del.push(r);for(r in e){let s=t[r],i=e[r];if(!s)n.add.push([r,i]);else{let a={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!Fo)a.recreate=!0,n.change.push(a);else{let o=s.idxByName,c=i.idxByName,l;for(l in o)c[l]||a.del.push(l);for(l in c){let h=o[l],d=c[l];h?h.src!==d.src&&a.change.push(d):a.add.push(d)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function zl(t,e,n,r){let s=t.db.createObjectStore(e,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(i=>Vl(s,i)),s}function W3(t,e){He(t).forEach(n=>{e.db.objectStoreNames.contains(n)||zl(e,n,t[n].primKey,t[n].indexes)})}function G3(t,e){[].slice.call(e.db.objectStoreNames).forEach(n=>t[n]==null&&e.db.deleteObjectStore(n))}function Vl(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function ql(t,e,n){let r={};return Ao(e.objectStoreNames,0).forEach(i=>{let a=n.objectStore(i),o=a.keyPath,c=Bl(u1(o),o||"",!1,!1,!!a.autoIncrement,o&&typeof o!="string",!0),l=[];for(let d=0;ds.add.length||s.change.length))}function Kl({_novip:t},e,n){let r=n.db.objectStoreNames;for(let s=0;s{e=e.trim();let r=e.replace(/([&*]|\+\+)/g,""),s=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;return Bl(r,s||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),tt(s),n===0)})}var d1=class{_parseStoresSpec(e,n){He(e).forEach(r=>{if(e[r]!==null){var s=X3(e[r]),i=s.shift();if(i.multi)throw new se.Schema("Primary key cannot be multi-valued");s.forEach(a=>{if(a.auto)throw new se.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new se.Schema("Index must have a name and cannot be an empty string")}),n[r]=c1(r,i,s)}})}stores(e){let n=this.db;this._cfg.storesSource=this._cfg.storesSource?lt(this._cfg.storesSource,e):e;let r=n._versions,s={},i={};return r.forEach(a=>{lt(s,a._cfg.storesSource),i=a._cfg.dbschema={},a._parseStoresSpec(s,i)}),n._dbSchema=i,Ul(n,[n._allTables,n,n.Transaction.prototype]),Vo(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],He(i),i),n._storeNames=He(i),this}upgrade(e){return this._cfg.contentUpgrade=bl(this._cfg.contentUpgrade||ye,e),this}};function Z3(t){return Mi(d1.prototype,function(n){this.db=t,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Yl(t,e){let n=t._dbNamesDB;return n||(n=t._dbNamesDB=new Tn(Bo,{addons:[],indexedDB:t,IDBKeyRange:e}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Wl(t){return t&&typeof t.databases=="function"}function J3({indexedDB:t,IDBKeyRange:e}){return Wl(t)?Promise.resolve(t.databases()).then(n=>n.map(r=>r.name).filter(r=>r!==Bo)):Yl(t,e).toCollection().primaryKeys()}function eI({indexedDB:t,IDBKeyRange:e},n){!Wl(t)&&n!==Bo&&Yl(t,e).put({name:n}).catch(ye)}function tI({indexedDB:t,IDBKeyRange:e},n){!Wl(t)&&n!==Bo&&Yl(t,e).delete(n).catch(ye)}function Gl(t){return Qn(function(){return J.letThrough=!0,t()})}function nI(){var t=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!t||!indexedDB.databases)return Promise.resolve();var e;return new Promise(function(n){var r=function(){return indexedDB.databases().finally(n)};e=setInterval(r,100),r()}).finally(function(){return clearInterval(e)})}function rI(t){let e=t._state,{indexedDB:n}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?ze(e.dbOpenError):t);tn&&(e.openCanceller._stackHolder=Tr()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;let r=e.openCanceller;function s(){if(e.openCanceller!==r)throw new se.DatabaseClosed("db.open() was cancelled")}let i=e.dbReadyResolve,a=null,o=!1,c=()=>new q((l,h)=>{if(s(),!n)throw new se.MissingAPI;let d=t.name,f=e.autoSchema?n.open(d):n.open(d,Math.round(t.verno*10));if(!f)throw new se.MissingAPI;f.onerror=nn(h),f.onblocked=Oe(t._fireOnBlocked),f.onupgradeneeded=Oe(p=>{if(a=f.transaction,e.autoSchema&&!t._options.allowEmptyDB){f.onerror=Fi,a.abort(),f.result.close();let T=n.deleteDatabase(d);T.onsuccess=T.onerror=Oe(()=>{h(new se.NoSuchDatabase(`Database ${d} doesnt exist`))})}else{a.onerror=nn(h);var E=p.oldVersion>Math.pow(2,62)?0:p.oldVersion;o=E<1,t._novip.idbdb=f.result,K3(t,E/10,a,h)}},h),f.onsuccess=Oe(()=>{a=null;let p=t._novip.idbdb=f.result,E=Ao(p.objectStoreNames);if(E.length>0)try{let T=p.transaction(B3(E),"readonly");e.autoSchema?$3(t,p,T):(Kl(t,t._dbSchema,T),Q3(t,T)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Hl(t,T)}catch{}Li.push(t),p.onversionchange=Oe(T=>{e.vcFired=!0,t.on("versionchange").fire(T)}),p.onclose=Oe(T=>{t.on("close").fire(T)}),o&&eI(t._deps,d),l()},h)}).catch(l=>l&&l.name==="UnknownError"&&e.PR1398_maxLoop>0?(e.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),c()):q.reject(l));return q.race([r,(typeof navigator=="undefined"?q.resolve():nI()).then(c)]).then(()=>(s(),e.onReadyBeingFired=[],q.resolve(Gl(()=>t.on.ready.fire(t.vip))).then(function l(){if(e.onReadyBeingFired.length>0){let h=e.onReadyBeingFired.reduce(bl,ye);return e.onReadyBeingFired=[],q.resolve(Gl(()=>h(t.vip))).then(l)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(l=>{e.dbOpenError=l;try{a&&a.abort()}catch{}return r===e.openCanceller&&t._close(),ze(l)}).finally(()=>{e.openComplete=!0,i()})}function $l(t){var e=a=>t.next(a),n=a=>t.throw(a),r=i(e),s=i(n);function i(a){return o=>{var c=a(o),l=c.value;return c.done?l:!l||typeof l.then!="function"?tt(l)?Promise.all(l).then(r,s):r(l):l.then(r,s)}}return i(e)()}function sI(t,e,n){var r=arguments.length;if(r<2)throw new se.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];n=s.pop();var i=Ob(s);return[t,i,n]}function h1(t,e,n,r,s){return q.resolve().then(()=>{let i=J.transless||J,a=t._createTransaction(e,n,t._dbSchema,r),o={trans:a,transless:i};if(r)a.idbtrans=r.idbtrans;else try{a.create(),t._state.PR1398_maxLoop=3}catch(d){return d.name===gl.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>h1(t,e,n,null,s))):ze(d)}let c=hl(s);c&&Es();let l,h=q.follow(()=>{if(l=s.call(a,a),l)if(c){var d=bn.bind(null,null);l.then(d,d)}else typeof l.next=="function"&&typeof l.throw=="function"&&(l=$l(l))},o);return(l&&typeof l.then=="function"?q.resolve(l).then(d=>a.active?d:ze(new se.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):h.then(()=>l)).then(d=>(r&&a._resolve(),a._completion.then(()=>d))).catch(d=>(a._reject(d),ze(d)))})}function qo(t,e,n){let r=tt(t)?t.slice():[t];for(let s=0;s0,A=ce(B({},E),{isVirtual:I,keyTail:p,keyLength:m,extractKey:jl(f),unique:!I&&E.unique});if(w.push(A),A.isPrimaryKey||i.push(A),m>1){let b=m===2?f[0]:f.slice(0,m-1);a(b,p+1,E)}return w.sort((b,S)=>b.keyTail-S.keyTail),A}let o=a(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[o];for(let f of r.indexes)a(f.keyPath,0,f);function c(f){let p=s[Hi(f)];return p&&p[0]}function l(f,p){return{type:f.type===1?2:f.type,lower:qo(f.lower,f.lowerOpen?t.MAX_KEY:t.MIN_KEY,p),lowerOpen:!0,upper:qo(f.upper,f.upperOpen?t.MIN_KEY:t.MAX_KEY,p),upperOpen:!0}}function h(f){let p=f.query.index;return p.isVirtual?ce(B({},f),{query:{index:p,range:l(f.query.range,p.keyTail)}}):f}return ce(B({},n),{schema:ce(B({},r),{primaryKey:o,indexes:i,getIndexByKeyPath:c}),count(f){return n.count(h(f))},query(f){return n.query(h(f))},openCursor(f){let{keyTail:p,isVirtual:E,keyLength:T}=f.query.index;if(!E)return n.openCursor(f);function w(m){function I(b){b!=null?m.continue(qo(b,f.reverse?t.MAX_KEY:t.MIN_KEY,p)):f.unique?m.continue(m.key.slice(0,T).concat(f.reverse?t.MIN_KEY:t.MAX_KEY,p)):m.continue()}return Object.create(m,{continue:{value:I},continuePrimaryKey:{value(b,S){m.continuePrimaryKey(qo(b,t.MAX_KEY,p),S)}},primaryKey:{get(){return m.primaryKey}},key:{get(){let b=m.key;return T===1?b[0]:b.slice(0,T)}},value:{get(){return m.value}}})}return n.openCursor(h(f)).then(m=>m&&w(m))}})}})}var aI={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:iI};function Ql(t,e,n,r){return n=n||{},r=r||"",He(t).forEach(s=>{if(!At(e,s))n[r+s]=void 0;else{var i=t[s],a=e[s];if(typeof i=="object"&&typeof a=="object"&&i&&a){let o=fl(i),c=fl(a);o!==c?n[r+s]=e[s]:o==="Object"?Ql(i,a,n,r+s+"."):i!==a&&(n[r+s]=e[s])}else i!==a&&(n[r+s]=e[s])}}),He(e).forEach(s=>{At(t,s)||(n[r+s]=e[s])}),n}function oI(t,e){return e.type==="delete"?e.keys:e.keys||e.values.map(t.extractKey)}var uI={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>ce(B({},t),{table(e){let n=t.table(e),{primaryKey:r}=n.schema;return ce(B({},n),{mutate(i){let a=J.trans,{deleting:o,creating:c,updating:l}=a.table(e).hook;switch(i.type){case"add":if(c.fire===ye)break;return a._promise("readwrite",()=>h(i),!0);case"put":if(c.fire===ye&&l.fire===ye)break;return a._promise("readwrite",()=>h(i),!0);case"delete":if(o.fire===ye)break;return a._promise("readwrite",()=>h(i),!0);case"deleteRange":if(o.fire===ye)break;return a._promise("readwrite",()=>d(i),!0)}return n.mutate(i);function h(p){let E=J.trans,T=p.keys||oI(r,p);if(!T)throw new Error("Keys missing");return p=p.type==="add"||p.type==="put"?ce(B({},p),{keys:T}):B({},p),p.type!=="delete"&&(p.values=[...p.values]),p.keys&&(p.keys=[...p.keys]),cI(n,p,T).then(w=>{let m=T.map((I,A)=>{let b=w[A],S={onerror:null,onsuccess:null};if(p.type==="delete")o.fire.call(S,I,b,E);else if(p.type==="add"||b===void 0){let C=c.fire.call(S,I,p.values[A],E);I==null&&C!=null&&(I=C,p.keys[A]=I,r.outbound||Yt(p.values[A],r.keyPath,I))}else{let C=Ql(b,p.values[A]),N=l.fire.call(S,C,I,b,E);if(N){let O=p.values[A];Object.keys(N).forEach(L=>{At(O,L)?O[L]=N[L]:Yt(O,L,N[L])})}}return S});return n.mutate(p).then(({failures:I,results:A,numFailures:b,lastResult:S})=>{for(let C=0;C(m.forEach(A=>A.onerror&&A.onerror(I)),Promise.reject(I)))})}function d(p){return f(p.trans,p.range,1e4)}function f(p,E,T){return n.query({trans:p,values:!1,query:{index:r,range:E},limit:T}).then(({result:w})=>h({type:"delete",keys:w,trans:p}).then(m=>m.numFailures>0?Promise.reject(m.failures[0]):w.length({table:e=>{let n=t.table(e);return ce(B({},n),{getMany:r=>{if(!r.cache)return n.getMany(r);let s=p1(r.keys,r.trans._cache,r.cache==="clone");return s?q.resolve(s):n.getMany(r).then(i=>(r.trans._cache={keys:r.keys,values:r.cache==="clone"?Ii(i):i},i))},mutate:r=>(r.type!=="add"&&(r.trans._cache=null),n.mutate(r))})}})};function Xl(t){return!("from"in t)}var En=function(t,e){if(this)lt(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0});else{let n=new En;return t&&"d"in t&<(n,t),n}};ps(En.prototype,{add(t){return Ko(this,t),this},addKey(t){return Ui(this,t,t),this},addKeys(t){return t.forEach(e=>Ui(this,e,e)),this},[dl](){return Zl(this)}});function Ui(t,e,n){let r=ft(e,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Xl(t))return lt(t,{from:e,to:n,d:1});let s=t.l,i=t.r;if(ft(n,t.from)<0)return s?Ui(s,e,n):t.l={from:e,to:n,d:1,l:null,r:null},m1(t);if(ft(e,t.to)>0)return i?Ui(i,e,n):t.r={from:e,to:n,d:1,l:null,r:null},m1(t);ft(e,t.from)<0&&(t.from=e,t.l=null,t.d=i?i.d+1:1),ft(n,t.to)>0&&(t.to=n,t.r=null,t.d=t.l?t.l.d+1:1);let a=!t.r;s&&!t.l&&Ko(t,s),i&&a&&Ko(t,i)}function Ko(t,e){function n(r,{from:s,to:i,l:a,r:o}){Ui(r,s,i),a&&n(r,a),o&&n(r,o)}Xl(e)||n(t,e)}function fI(t,e){let n=Zl(e),r=n.next();if(r.done)return!1;let s=r.value,i=Zl(t),a=i.next(s.from),o=a.value;for(;!r.done&&!a.done;){if(ft(o.from,s.to)<=0&&ft(o.to,s.from)>=0)return!0;ft(s.from,o.from)<0?s=(r=n.next(o.from)).value:o=(a=i.next(s.from)).value}return!1}function Zl(t){let e=Xl(t)?null:{s:0,n:t};return{next(n){let r=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,r)for(;e.n.l&&ft(n,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!r||ft(n,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function m1(t){var e,n;let r=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((n=t.l)===null||n===void 0?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){let i=s==="r"?"l":"r",a=B({},t),o=t[s];t.from=o.from,t.to=o.to,t[s]=o[s],a[s]=o[i],t[i]=a,a.d=g1(a)}t.d=g1(t)}function g1({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}var dI={stack:"dbcore",level:0,create:t=>{let e=t.schema.name,n=new En(t.MIN_KEY,t.MAX_KEY);return ce(B({},t),{table:r=>{let s=t.table(r),{schema:i}=s,{primaryKey:a}=i,{extractKey:o,outbound:c}=a,l=ce(B({},s),{mutate:f=>{let p=f.trans,E=p.mutatedParts||(p.mutatedParts={}),T=C=>{let N=`idb://${e}/${r}/${C}`;return E[N]||(E[N]=new En)},w=T(""),m=T(":dels"),{type:I}=f,[A,b]=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[[],f.values]:[],S=f.trans._cache;return s.mutate(f).then(C=>{if(tt(A)){I!=="delete"&&(A=C.results),w.addKeys(A);let N=p1(A,S);!N&&I!=="add"&&m.addKeys(A),(N||b)&&hI(T,i,N,b)}else if(A){let N={from:A.lower,to:A.upper};m.add(N),w.add(N)}else w.add(n),m.add(n),i.indexes.forEach(N=>T(N.name).add(n));return C})}}),h=({query:{index:f,range:p}})=>{var E,T;return[f,new En((E=p.lower)!==null&&E!==void 0?E:t.MIN_KEY,(T=p.upper)!==null&&T!==void 0?T:t.MAX_KEY)]},d={get:f=>[a,new En(f.key)],getMany:f=>[a,new En().addKeys(f.keys)],count:h,query:h,openCursor:h};return He(d).forEach(f=>{l[f]=function(p){let{subscr:E}=J;if(E){let T=b=>{let S=`idb://${e}/${r}/${b}`;return E[S]||(E[S]=new En)},w=T(""),m=T(":dels"),[I,A]=d[f](p);if(T(I.name||"").add(A),!I.isPrimaryKey)if(f==="count")m.add(n);else{let b=f==="query"&&c&&p.values&&s.query(ce(B({},p),{values:!1}));return s[f].apply(this,arguments).then(S=>{if(f==="query"){if(c&&p.values)return b.then(({result:N})=>(w.addKeys(N),S));let C=p.values?S.result.map(o):S.result;p.values?w.addKeys(C):m.addKeys(C)}else if(f==="openCursor"){let C=S,N=p.values;return C&&Object.create(C,{key:{get(){return m.addKey(C.primaryKey),C.key}},primaryKey:{get(){let O=C.primaryKey;return m.addKey(O),O}},value:{get(){return N&&w.addKey(C.primaryKey),C.value}}})}return S})}}return s[f].apply(this,arguments)}}),l}})}};function hI(t,e,n,r){function s(i){let a=t(i.name||"");function o(l){return l!=null?i.extractKey(l):null}let c=l=>i.multiEntry&&tt(l)?l.forEach(h=>a.addKey(h)):a.addKey(l);(n||r).forEach((l,h)=>{let d=n&&o(n[h]),f=r&&o(r[h]);ft(d,f)!==0&&(d!=null&&c(d),f!=null&&c(f))})}e.indexes.forEach(s)}var Tn=class{constructor(e,n){this._middlewares={},this.verno=0;let r=Tn.dependencies;this._options=n=B({addons:Tn.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};let{addons:s}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;let i={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ye,dbReadyPromise:null,cancelOpen:ye,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};i.dbReadyPromise=new q(a=>{i.dbReadyResolve=a}),i.openCanceller=new q((a,o)=>{i.cancelOpen=o}),this._state=i,this.name=e,this.on=Pi(this,"populate","blocked","versionchange","close",{ready:[bl,ye]}),this.on.ready.subscribe=wb(this.on.ready.subscribe,a=>(o,c)=>{Tn.vip(()=>{let l=this._state;if(l.openComplete)l.dbOpenError||q.resolve().then(o),c&&a(o);else if(l.onReadyBeingFired)l.onReadyBeingFired.push(o),c&&a(o);else{a(o);let h=this;c||a(function d(){h.on.ready.unsubscribe(o),h.on.ready.unsubscribe(d)})}})}),this.Collection=D3(this),this.Table=I3(this),this.Transaction=F3(this),this.Version=Z3(this),this.WhereClause=M3(this),this.on("versionchange",a=>{a.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",a=>{!a.newVersion||a.newVersionnew this.Transaction(a,o,c,this._options.chromeTransactionDurability,l),this._fireOnBlocked=a=>{this.on("blocked").fire(a),Li.filter(o=>o.name===this.name&&o!==this&&!o._state.vcFired).map(o=>o.on("versionchange").fire(a))},this.use(aI),this.use(uI),this.use(dI),this.use(lI),this.vip=Object.create(this,{_vip:{value:!0}}),s.forEach(a=>a(this))}version(e){if(isNaN(e)||e<.1)throw new se.Type("Given version is not a positive number");if(e=Math.round(e*10)/10,this.idbdb||this._state.isBeingOpened)throw new se.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let n=this._versions;var r=n.filter(s=>s._cfg.version===e)[0];return r||(r=new this.Version(e),n.push(r),n.sort(q3),r.stores({}),this._state.autoSchema=!1,r)}_whenReady(e){return this.idbdb&&(this._state.openComplete||J.letThrough||this._vip)?e():new q((n,r)=>{if(this._state.openComplete)return r(new se.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen){r(new se.DatabaseClosed);return}this.open().catch(ye)}this._state.dbReadyPromise.then(n,r)}).then(e)}use({stack:e,create:n,level:r,name:s}){s&&this.unuse({stack:e,name:s});let i=this._middlewares[e]||(this._middlewares[e]=[]);return i.push({stack:e,create:n,level:r??10,name:s}),i.sort((a,o)=>a.level-o.level),this}unuse({stack:e,name:n,create:r}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(s=>r?s.create!==r:n?s.name!==n:!1)),this}open(){return rI(this)}_close(){let e=this._state,n=Li.indexOf(this);if(n>=0&&Li.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new q(r=>{e.dbReadyResolve=r}),e.openCanceller=new q((r,s)=>{e.cancelOpen=s})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new se.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,n=this._state;return new q((r,s)=>{let i=()=>{this.close();var a=this._deps.indexedDB.deleteDatabase(this.name);a.onsuccess=Oe(()=>{tI(this._deps,this.name),r()}),a.onerror=nn(s),a.onblocked=this._fireOnBlocked};if(e)throw new se.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(i):i()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){let e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return He(this._allTables).map(e=>this._allTables[e])}transaction(){let e=sI.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,r){let s=J.trans;(!s||s.db!==this||e.indexOf("!")!==-1)&&(s=null);let i=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");let a,o;try{if(o=n.map(l=>{var h=l instanceof this.Table?l.name:l;if(typeof h!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return h}),e=="r"||e===kl)a=kl;else if(e=="rw"||e==Rl)a=Rl;else throw new se.InvalidArgument("Invalid transaction mode: "+e);if(s){if(s.mode===kl&&a===Rl)if(i)s=null;else throw new se.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");s&&o.forEach(l=>{if(s&&s.storeNames.indexOf(l)===-1)if(i)s=null;else throw new se.SubTransaction("Table "+l+" not included in parent transaction.")}),i&&s&&!s.active&&(s=null)}}catch(l){return s?s._promise(null,(h,d)=>{d(l)}):ze(l)}let c=h1.bind(null,this,a,o,s,r);return s?s._promise(a,c,"lock"):J.trans?Ts(J.transless,()=>this._whenReady(c)):this._whenReady(c)}table(e){if(!At(this._allTables,e))throw new se.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}},pI=typeof Symbol!="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable",b1=class{constructor(e){this._subscribe=e}subscribe(e,n,r){return this._subscribe(!e||typeof e=="function"?{next:e,error:n,complete:r}:e)}[pI](){return this}};function _1(t,e){return He(e).forEach(n=>{let r=t[n]||(t[n]=new En);Ko(r,e[n])}),t}function mI(t){let e=!1,n,r=new b1(s=>{let i=hl(t);function a(w){i&&Es();let m=()=>Qn(t,{subscr:w,trans:null}),I=J.trans?Ts(J.transless,m):m();return i&&I.then(bn,bn),I}let o=!1,c={},l={},h={get closed(){return o},unsubscribe:()=>{o=!0,er.storagemutated.unsubscribe(E)}};s.start&&s.start(h);let d=!1,f=!1;function p(){return He(l).some(w=>c[w]&&fI(c[w],l[w]))}let E=w=>{_1(c,w),p()&&T()},T=()=>{if(d||o)return;c={};let w={},m=a(w);f||(er(Bi,E),f=!0),d=!0,Promise.resolve(m).then(I=>{e=!0,n=I,d=!1,!o&&(p()?T():(c={},l=w,s.next&&s.next(I)))},I=>{d=!1,e=!1,s.error&&s.error(I),h.unsubscribe()})};return T(),h});return r.hasValue=()=>e,r.getValue=()=>n,r}var Jl;try{Jl={indexedDB:ve.indexedDB||ve.mozIndexedDB||ve.webkitIndexedDB||ve.msIndexedDB,IDBKeyRange:ve.IDBKeyRange||ve.webkitIDBKeyRange}}catch{Jl={indexedDB:null,IDBKeyRange:null}}var Ir=Tn;ps(Ir,ce(B({},So),{delete(t){return new Ir(t,{addons:[]}).delete()},exists(t){return new Ir(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1)},getDatabaseNames(t){try{return J3(Ir.dependencies).then(t)}catch{return ze(new se.MissingAPI)}},defineClass(){function t(e){lt(this,e)}return t},ignoreTransaction(t){return J.trans?Ts(J.transless,t):t()},vip:Gl,async:function(t){return function(){try{var e=$l(t.apply(this,arguments));return!e||typeof e.then!="function"?q.resolve(e):e}catch(n){return ze(n)}}},spawn:function(t,e,n){try{var r=$l(t.apply(n,e||[]));return!r||typeof r.then!="function"?q.resolve(r):r}catch(s){return ze(s)}},currentTransaction:{get:()=>J.trans||null},waitFor:function(t,e){let n=q.resolve(typeof t=="function"?Ir.ignoreTransaction(t):t).timeout(e||6e4);return J.trans?J.trans.waitFor(n):n},Promise:q,debug:{get:()=>tn,set:t=>{Rb(t,t==="dexie"?()=>!0:Zb)}},derive:ms,extend:lt,props:ps,override:wb,Events:Pi,on:er,liveQuery:mI,extendObservabilitySet:_1,getByKeyPath:mn,setByKeyPath:Yt,delByKeyPath:ZS,shallowClone:Db,deepClone:Ii,getObjectDiff:Ql,cmp:ft,asap:Nb,minKey:Ol,addons:[],connections:Li,errnames:gl,dependencies:Jl,semVer:Qb,version:Qb.split(".").map(t=>parseInt(t)).reduce((t,e,n)=>t+e/Math.pow(10,n*2))}));Ir.maxKey=ji(Ir.dependencies.IDBKeyRange);typeof dispatchEvent!="undefined"&&typeof addEventListener!="undefined"&&(er(Bi,t=>{if(!xn){let e;Fo?(e=document.createEvent("CustomEvent"),e.initCustomEvent(Jn,!0,!0,t)):e=new CustomEvent(Jn,{detail:t}),xn=!0,dispatchEvent(e),xn=!1}}),addEventListener(Jn,({detail:t})=>{xn||Yo(t)}));function Yo(t){let e=xn;try{xn=!0,er.storagemutated.fire(t)}finally{xn=e}}var xn=!1;if(typeof BroadcastChannel!="undefined"){let t=new BroadcastChannel(Jn);typeof t.unref=="function"&&t.unref(),er(Bi,e=>{xn||t.postMessage(e)}),t.onmessage=e=>{e.data&&Yo(e.data)}}else if(typeof self!="undefined"&&typeof navigator!="undefined"){er(Bi,e=>{try{xn||(typeof localStorage!="undefined"&&localStorage.setItem(Jn,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:Jn,changedParts:e})))}catch{}}),typeof addEventListener!="undefined"&&addEventListener("storage",e=>{if(e.key===Jn){let n=JSON.parse(e.newValue);n&&Yo(n.changedParts)}});let t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",gI)}function gI({data:t}){t&&t.type===Jn&&Yo(t.changedParts)}q.rejectionMapper=o3;Rb(tn,Zb);var ef=_e(require("obsidian")),As=class extends Tn{constructor(e){super(As.getDbName(e.app.appId));this.plugin=e;this.version(As.dbVersion).stores({searchHistory:"++id",minisearch:"date",embeds:"embedded"})}static getDbName(e){return"omnisearch/cache/"+e}async getMinisearchCache(){try{return(await this.plugin.database.minisearch.toArray())[0]}catch(e){return new ef.Notice("Omnisearch - Cache missing or invalid. Some freezes may occur while Omnisearch indexes your vault."),console.error("Omnisearch - Error while loading Minisearch cache"),console.error(e),null}}async writeMinisearchCache(){let e=this.plugin.searchEngine.getSerializedMiniSearch(),n=this.plugin.searchEngine.getSerializedIndexedDocuments(),r=this.plugin.database;await r.minisearch.clear(),await r.minisearch.add({date:new Date().toISOString(),paths:n,data:e}),console.debug("Omnisearch - Search cache written")}async clearOldDatabases(){let e=(await indexedDB.databases()).filter(n=>n.name===As.getDbName(this.plugin.app.appId)&&n.version!==As.dbVersion*10);if(e.length){console.debug("Omnisearch - Those IndexedDb databases will be deleted:");for(let n of e)n.name&&indexedDB.deleteDatabase(n.name)}}async clearCache(){await this.minisearch.clear(),await this.embeds.clear(),new ef.Notice("Omnisearch - Cache cleared. Please restart Obsidian.")}},Wo=As;Wo.dbVersion=10;var E1="ENTRIES",tf="KEYS",nf="VALUES",Ve="",zi=class{constructor(e,n){let r=e._tree,s=Array.from(r.keys());this.set=e,this._type=n,this._path=s.length>0?[{node:r,keys:s}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:n}=Cs(this._path);if(Cs(n)===Ve)return{done:!1,value:this.result()};let r=e.get(Cs(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=Cs(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>Cs(e)).filter(e=>e!==Ve).join("")}value(){return Cs(this._path).node.get(Ve)}result(){switch(this._type){case nf:return this.value();case tf:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},Cs=t=>t[t.length-1];var bI=(t,e,n)=>{let r=new Map;if(e===void 0)return r;let s=e.length+1,i=s+n,a=new Uint8Array(i*s).fill(n+1);for(let o=0;o{let c=i*a;e:for(let l of t.keys())if(l===Ve){let h=s[c-1];h<=n&&r.set(o,[t.get(l),h])}else{let h=i;for(let d=0;dn)continue e}T1(t.get(l),e,n,r,s,h,a,o+l)}},x1=bI;var Wt=class{constructor(e=new Map,n=""){this._size=void 0;this._tree=e,this._prefix=n}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");let[n,r]=Go(this._tree,e.slice(this._prefix.length));if(n===void 0){let[s,i]=af(r);for(let a of s.keys())if(a!==Ve&&a.startsWith(i)){let o=new Map;return o.set(a.slice(i.length),s.get(a)),new Wt(o,e)}}return new Wt(n,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,_I(this._tree,e)}entries(){return new zi(this,E1)}forEach(e){for(let[n,r]of this)e(n,r,this)}fuzzyGet(e,n){return x1(this._tree,e,n)}get(e){let n=rf(this._tree,e);return n!==void 0?n.get(Ve):void 0}has(e){let n=rf(this._tree,e);return n!==void 0&&n.has(Ve)}keys(){return new zi(this,tf)}set(e,n){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,sf(this._tree,e).set(Ve,n),this}get size(){if(this._size)return this._size;this._size=0;let e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,n){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;let r=sf(this._tree,e);return r.set(Ve,n(r.get(Ve))),this}fetch(e,n){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;let r=sf(this._tree,e),s=r.get(Ve);return s===void 0&&r.set(Ve,s=n()),s}values(){return new zi(this,nf)}[Symbol.iterator](){return this.entries()}static from(e){let n=new Wt;for(let[r,s]of e)n.set(r,s);return n}static fromObject(e){return Wt.from(Object.entries(e))}},Go=(t,e,n=[])=>{if(e.length===0||t==null)return[t,n];for(let r of t.keys())if(r!==Ve&&e.startsWith(r))return n.push([t,r]),Go(t.get(r),e.slice(r.length),n);return n.push([t,e]),Go(void 0,"",n)},rf=(t,e)=>{if(e.length===0||t==null)return t;for(let n of t.keys())if(n!==Ve&&e.startsWith(n))return rf(t.get(n),e.slice(n.length))},sf=(t,e)=>{let n=e.length;e:for(let r=0;t&&r{let[n,r]=Go(t,e);if(n!==void 0){if(n.delete(Ve),n.size===0)y1(r);else if(n.size===1){let[s,i]=n.entries().next().value;A1(r,s,i)}}},y1=t=>{if(t.length===0)return;let[e,n]=af(t);if(e.delete(n),e.size===0)y1(t.slice(0,-1));else if(e.size===1){let[r,s]=e.entries().next().value;r!==Ve&&A1(t.slice(0,-1),r,s)}},A1=(t,e,n)=>{if(t.length===0)return;let[r,s]=af(t);r.set(s+e,n),r.delete(s)},af=t=>t[t.length-1];var of="or",C1="and",EI="and_not",Vi=class{constructor(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');let n=e.autoVacuum==null||e.autoVacuum===!0?df:e.autoVacuum;this._options=ce(B(B({},cf),e),{autoVacuum:n,searchOptions:B(B({},S1),e.searchOptions||{}),autoSuggestOptions:B(B({},CI),e.autoSuggestOptions||{})}),this._index=new Wt,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=ff,this.addFields(this._options.fields)}add(e){let{extractField:n,tokenize:r,processTerm:s,fields:i,idField:a}=this._options,o=n(e,a);if(o==null)throw new Error(`MiniSearch: document does not have ID field "${a}"`);if(this._idToShortId.has(o))throw new Error(`MiniSearch: duplicate ID ${o}`);let c=this.addDocumentId(o);this.saveStoredFields(c,e);for(let l of i){let h=n(e,l);if(h==null)continue;let d=r(h.toString(),l),f=this._fieldIds[l],p=new Set(d).size;this.addFieldLength(c,f,this._documentCount-1,p);for(let E of d){let T=s(E,l);if(Array.isArray(T))for(let w of T)this.addTerm(f,c,w);else T&&this.addTerm(f,c,T)}}}addAll(e){for(let n of e)this.add(n)}addAllAsync(e,n={}){let{chunkSize:r=10}=n,s={chunk:[],promise:Promise.resolve()},{chunk:i,promise:a}=e.reduce(({chunk:o,promise:c},l,h)=>(o.push(l),(h+1)%r==0?{chunk:[],promise:c.then(()=>new Promise(d=>setTimeout(d,0))).then(()=>this.addAll(o))}:{chunk:o,promise:c}),s);return a.then(()=>this.addAll(i))}remove(e){let{tokenize:n,processTerm:r,extractField:s,fields:i,idField:a}=this._options,o=s(e,a);if(o==null)throw new Error(`MiniSearch: document does not have ID field "${a}"`);let c=this._idToShortId.get(o);if(c==null)throw new Error(`MiniSearch: cannot remove document with ID ${o}: it is not in the index`);for(let l of i){let h=s(e,l);if(h==null)continue;let d=n(h.toString(),l),f=this._fieldIds[l],p=new Set(d).size;this.removeFieldLength(c,f,this._documentCount,p);for(let E of d){let T=r(E,l);if(Array.isArray(T))for(let w of T)this.removeTerm(f,c,w);else T&&this.removeTerm(f,c,T)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(o),this._fieldLength.delete(c),this._documentCount-=1}removeAll(e){if(e)for(let n of e)this.remove(n);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Wt,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(e){let n=this._idToShortId.get(e);if(n==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach((r,s)=>{this.removeFieldLength(n,s,this._documentCount,r)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:e,minDirtCount:n,batchSize:r,batchWait:s}=this._options.autoVacuum;this.conditionalVacuum({batchSize:r,batchWait:s},{minDirtCount:n,minDirtFactor:e})}discardAll(e){let n=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let r of e)this.discard(r)}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()}replace(e){let{idField:n,extractField:r}=this._options,s=r(e,n);this.discard(s),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,n){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{let r=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=ff,this.performVacuuming(e,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,n){let r=this._dirtCount;if(this.vacuumConditionsMet(n)){let s=e.batchSize||lf.batchSize,i=e.batchWait||lf.batchWait,a=1;for(let[o,c]of this._index){for(let[l,h]of c)for(let[d]of h)this._documentIds.has(d)||(h.size<=1?c.delete(l):h.delete(d));this._index.get(o).size===0&&this._index.delete(o),a%s==0&&await new Promise(l=>setTimeout(l,i)),a+=1}this._dirtCount-=r}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:n,minDirtFactor:r}=e;return n=n||df.minDirtCount,r=r||df.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){let n=this._idToShortId.get(e);if(n!=null)return this._storedFields.get(n)}search(e,n={}){let r=this.executeQuery(e,n),s=[];for(let[i,{score:a,terms:o,match:c}]of r){let l=o.length||1,h={id:this._documentIds.get(i),score:a*l,terms:Object.keys(c),queryTerms:o,match:c};Object.assign(h,this._storedFields.get(i)),(n.filter==null||n.filter(h))&&s.push(h)}return e===Vi.wildcard&&n.boostDocument==null&&this._options.searchOptions.boostDocument==null||s.sort(w1),s}autoSuggest(e,n={}){n=B(B({},this._options.autoSuggestOptions),n);let r=new Map;for(let{score:i,terms:a}of this.search(e,n)){let o=a.join(" "),c=r.get(o);c!=null?(c.score+=i,c.count+=1):r.set(o,{score:i,terms:a,count:1})}let s=[];for(let[i,{score:a,terms:o,count:c}]of r)s.push({suggestion:i,terms:o,score:a/c});return s.sort(w1),s}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),n)}static async loadJSONAsync(e,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),n)}static getDefault(e){if(cf.hasOwnProperty(e))return uf(cf,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,n){let{index:r,documentIds:s,fieldLength:i,storedFields:a,serializationVersion:o}=e,c=this.instantiateMiniSearch(e,n);c._documentIds=$o(s),c._fieldLength=$o(i),c._storedFields=$o(a);for(let[l,h]of c._documentIds)c._idToShortId.set(h,l);for(let[l,h]of r){let d=new Map;for(let f of Object.keys(h)){let p=h[f];o===1&&(p=p.ds),d.set(parseInt(f,10),$o(p))}c._index.set(l,d)}return c}static async loadJSAsync(e,n){let{index:r,documentIds:s,fieldLength:i,storedFields:a,serializationVersion:o}=e,c=this.instantiateMiniSearch(e,n);c._documentIds=await Qo(s),c._fieldLength=await Qo(i),c._storedFields=await Qo(a);for(let[h,d]of c._documentIds)c._idToShortId.set(d,h);let l=0;for(let[h,d]of r){let f=new Map;for(let p of Object.keys(d)){let E=d[p];o===1&&(E=E.ds),f.set(parseInt(p,10),await Qo(E))}++l%1e3==0&&await v1(0),c._index.set(h,f)}return c}static instantiateMiniSearch(e,n){let{documentCount:r,nextId:s,fieldIds:i,averageFieldLength:a,dirtCount:o,serializationVersion:c}=e;if(c!==1&&c!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");let l=new Vi(n);return l._documentCount=r,l._nextId=s,l._idToShortId=new Map,l._fieldIds=i,l._avgFieldLength=a,l._dirtCount=o||0,l._index=new Wt,l}executeQuery(e,n={}){if(e===Vi.wildcard)return this.executeWildcardQuery(n);if(typeof e!="string"){let f=ce(B(B({},n),e),{queries:void 0}),p=e.queries.map(E=>this.executeQuery(E,f));return this.combineResults(p,f.combineWith)}let{tokenize:r,processTerm:s,searchOptions:i}=this._options,a=B(B({tokenize:r,processTerm:s},i),n),{tokenize:o,processTerm:c}=a,d=o(e).flatMap(f=>c(f)).filter(f=>!!f).map(AI(a)).map(f=>this.executeQuerySpec(f,a));return this.combineResults(d,a.combineWith)}executeQuerySpec(e,n){let r=B(B({},this._options.searchOptions),n),s=(r.fields||this._options.fields).reduce((T,w)=>ce(B({},T),{[w]:uf(r.boost,w)||1}),{}),{boostDocument:i,weights:a,maxFuzzy:o,bm25:c}=r,{fuzzy:l,prefix:h}=B(B({},S1.weights),a),d=this._index.get(e.term),f=this.termResults(e.term,e.term,1,e.termBoost,d,s,i,c),p,E;if(e.prefix&&(p=this._index.atPrefix(e.term)),e.fuzzy){let T=e.fuzzy===!0?.2:e.fuzzy,w=T<1?Math.min(o,Math.round(e.term.length*T)):T;w&&(E=this._index.fuzzyGet(e.term,w))}if(p)for(let[T,w]of p){let m=T.length-e.term.length;if(!m)continue;E?.delete(T);let I=h*T.length/(T.length+.3*m);this.termResults(e.term,T,I,e.termBoost,w,s,i,c,f)}if(E)for(let T of E.keys()){let[w,m]=E.get(T);if(!m)continue;let I=l*T.length/(T.length+m);this.termResults(e.term,T,I,e.termBoost,w,s,i,c,f)}return f}executeWildcardQuery(e){let n=new Map,r=B(B({},this._options.searchOptions),e);for(let[s,i]of this._documentIds){let a=r.boostDocument?r.boostDocument(i,"",this._storedFields.get(s)):1;n.set(s,{score:a,terms:[],match:{}})}return n}combineResults(e,n=of){if(e.length===0)return new Map;let r=n.toLowerCase(),s=TI[r];if(!s)throw new Error(`Invalid combination operator: ${n}`);return e.reduce(s)||new Map}toJSON(){let e=[];for(let[n,r]of this._index){let s={};for(let[i,a]of r)s[i]=Object.fromEntries(a);e.push([n,s])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,n,r,s,i,a,o,c,l=new Map){if(i==null)return l;for(let h of Object.keys(a)){let d=a[h],f=this._fieldIds[h],p=i.get(f);if(p==null)continue;let E=p.size,T=this._avgFieldLength[f];for(let w of p.keys()){if(!this._documentIds.has(w)){this.removeTerm(f,w,n),E-=1;continue}let m=o?o(this._documentIds.get(w),n,this._storedFields.get(w)):1;if(!m)continue;let I=p.get(w),A=this._fieldLength.get(w)[f],b=yI(I,E,this._documentCount,A,T,c),S=r*s*d*m*b,C=l.get(w);if(C){C.score+=S,SI(C.terms,e);let N=uf(C.match,n);N?N.push(h):C.match[n]=[h]}else l.set(w,{score:S,terms:[e],match:{[n]:[h]}})}}return l}addTerm(e,n,r){let s=this._index.fetch(r,N1),i=s.get(e);if(i==null)i=new Map,i.set(n,1),s.set(e,i);else{let a=i.get(n);i.set(n,(a||0)+1)}}removeTerm(e,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,e,r);return}let s=this._index.fetch(r,N1),i=s.get(e);i==null||i.get(n)==null?this.warnDocumentChanged(n,e,r):i.get(n)<=1?i.size<=1?s.delete(e):i.delete(n):i.set(n,i.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)}warnDocumentChanged(e,n,r){for(let s of Object.keys(this._fieldIds))if(this._fieldIds[s]===n){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${r}" was not present in field "${s}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){let n=this._nextId;return this._idToShortId.set(e,n),this._documentIds.set(n,e),this._documentCount+=1,this._nextId+=1,n}addFields(e){for(let n=0;nObject.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,TI={[of]:(t,e)=>{for(let n of e.keys()){let r=t.get(n);if(r==null)t.set(n,e.get(n));else{let{score:s,terms:i,match:a}=e.get(n);r.score=r.score+s,r.match=Object.assign(r.match,a),I1(r.terms,i)}}return t},[C1]:(t,e)=>{let n=new Map;for(let r of e.keys()){let s=t.get(r);if(s==null)continue;let{score:i,terms:a,match:o}=e.get(r);I1(s.terms,a),n.set(r,{score:s.score+i,terms:s.terms,match:Object.assign(s.match,o)})}return n},[EI]:(t,e)=>{for(let n of e.keys())t.delete(n);return t}},xI={k:1.2,b:.7,d:.5},yI=(t,e,n,r,s,i)=>{let{k:a,b:o,d:c}=i;return Math.log(1+(n-e+.5)/(e+.5))*(c+t*(a+1)/(t+a*(1-o+o*r/s)))},AI=t=>(e,n,r)=>{let s=typeof t.fuzzy=="function"?t.fuzzy(e,n,r):t.fuzzy||!1,i=typeof t.prefix=="function"?t.prefix(e,n,r):t.prefix===!0,a=typeof t.boostTerm=="function"?t.boostTerm(e,n,r):1;return{term:e,fuzzy:s,prefix:i,termBoost:a}},cf={idField:"id",extractField:(t,e)=>t[e],tokenize:t=>t.split(II),processTerm:t=>t.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(t,e)=>{typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},S1={combineWith:of,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:xI},CI={combineWith:C1,prefix:(t,e,n)=>e===n.length-1},lf={batchSize:1e3,batchWait:10},ff={minDirtFactor:.1,minDirtCount:20},df=B(B({},lf),ff),SI=(t,e)=>{t.includes(e)||t.push(e)},I1=(t,e)=>{for(let n of e)t.includes(n)||t.push(n)},w1=({score:t},{score:e})=>e-t,N1=()=>new Map,$o=t=>{let e=new Map;for(let n of Object.keys(t))e.set(parseInt(n,10),t[n]);return e},Qo=async t=>{let e=new Map,n=0;for(let r of Object.keys(t))e.set(parseInt(r,10),t[r]),++n%1e3==0&&await v1(0);return e},v1=t=>new Promise(e=>setTimeout(e,t)),II=/[\n\r\p{Z}\p{P}]+/u;ut();var JT=_e(require("obsidian"));xi();Zt();ut();var ZT=XT(),Wd=class{constructor(e){this.plugin=e}tokenizeForIndexing(e){try{let n=this.tokenizeWords(e),r=[];if(this.plugin.settings.tokenizeUrls)try{r=ZT(e)}catch(i){le("Error extracting urls",i)}let s=this.tokenizeTokens(e,{skipChs:!0});return s=[...s,...s.flatMap(pc)],s=[...s,...s.flatMap(hc)],s=[...s,...n],r.length&&(s=[...s,...r]),s=[...new Set(s)],s}catch(n){return console.error("Error tokenizing text, skipping document",n),[]}}tokenizeForSearch(e){let n=ZT(e);e=n.reduce((s,i)=>s.replace(i,""),e);let r=[...this.tokenizeTokens(e),...n].filter(Boolean);return{combineWith:"OR",queries:[{combineWith:"AND",queries:r},{combineWith:"AND",queries:this.tokenizeWords(e).filter(Boolean)},{combineWith:"AND",queries:r.flatMap(pc)},{combineWith:"AND",queries:r.flatMap(hc)}]}}tokenizeWords(e,{skipChs:n=!1}={}){let r=e.split(Eh);return n?r:this.tokenizeChsWord(r)}tokenizeTokens(e,{skipChs:n=!1}={}){let r=e.split(ii);return n?r:this.tokenizeChsWord(r)}tokenizeChsWord(e){let n=this.plugin.getChsSegmenter();return n?e.flatMap(r=>gh.test(r)?n.cut(r,{search:!0}):[r]):e}};var Gd=class{constructor(e){this.plugin=e;this.indexedDocuments=new Map;this.tokenizer=new Wd(e),this.minisearch=new Ss(this.getOptions())}async loadCache(){await this.plugin.embedsRepository.loadFromCache();let e=await this.plugin.database.getMinisearchCache();return e?(this.minisearch=await Ss.loadJSAsync(e.data,this.getOptions()),this.indexedDocuments=new Map(e.paths.map(n=>[n.path,n.mtime])),!0):(console.log("Omnisearch - No cache found"),!1)}getDocumentsToReindex(e){let n=new Map(e.map(i=>[i.path,i.mtime])),r=e.filter(i=>!this.indexedDocuments.has(i.path)||this.indexedDocuments.get(i.path)!==i.mtime),s=[...this.indexedDocuments].filter(([i,a])=>!n.has(i)||n.get(i)!==a).map(i=>({path:i[0],mtime:i[1]}));return{toAdd:r,toRemove:s}}async addFromPaths(e){le("Adding files",e);let n=(await Promise.all(e.map(async s=>await this.plugin.documentsRepository.getDocument(s)))).filter(s=>!!s?.path);le("Sorting documents to first index markdown"),n=Wc(n,s=>s.path.endsWith(".md")?0:1),this.removeFromPaths(n.filter(s=>this.indexedDocuments.has(s.path)).map(s=>s.path));let r=Sh(n,500);for(let s of r){le("Indexing into search engine",s),s.forEach(a=>this.indexedDocuments.set(a.path,a.mtime));let i=s.filter(a=>this.minisearch.has(a.path));this.removeFromPaths(i.map(a=>a.path)),await this.minisearch.addAllAsync(s)}}removeFromPaths(e){e.forEach(r=>this.indexedDocuments.delete(r));let n=e.filter(r=>this.minisearch.has(r));this.minisearch.discardAll(n)}async search(e,n){let r=this.plugin.settings;if(e.isEmpty())return[];le("=== New search ==="),le("Starting search for",e);let s;switch(r.fuzziness){case"0":s=0;break;case"1":s=.1;break;default:s=.2;break}let i=this.tokenizer.tokenizeForSearch(e.segmentsToStr());le(JSON.stringify(i,null,1));let a=this.minisearch.search(i,{prefix:d=>d.length>=n.prefixLength,fuzzy:d=>d.length<=3?0:d.length<=5?s/2:s,boost:{basename:r.weightBasename,aliases:r.weightBasename,displayTitle:r.weightBasename,directory:r.weightDirectory,headings1:r.weightH1,headings2:r.weightH2,headings3:r.weightH3,tags:r.weightUnmarkedTags,unmarkedTags:r.weightUnmarkedTags},tokenize:d=>[d]});if(le(`Found ${a.length} results`,a),e.query.ext?.length&&(a=a.filter(d=>{let f="."+d.id.split(".").pop();return e.query.ext?.some(p=>f.startsWith(p.startsWith(".")?p:"."+p))})),e.query.path&&(a=a.filter(d=>e.query.path?.some(f=>d.id.toLowerCase().includes(f.toLowerCase())))),e.query.exclude.path&&(a=a.filter(d=>!e.query.exclude.path?.some(f=>d.id.toLowerCase().includes(f.toLowerCase())))),!a.length)return[];if(n.singleFilePath)return a.filter(d=>d.id===n.singleFilePath);le("searching with downranked folders",r.downrankedFoldersFilters),r.hideExcluded?a=a.filter(d=>!(this.plugin.app.metadataCache.isUserIgnored&&this.plugin.app.metadataCache.isUserIgnored(d.id))):a.forEach(d=>{this.plugin.app.metadataCache.isUserIgnored&&this.plugin.app.metadataCache.isUserIgnored(d.id)&&(d.score/=10)});let o=e.getTags();for(let d of a){let f=d.id;if(r.downrankedFoldersFilters.length>0){let E=!1;r.downrankedFoldersFilters.forEach(m=>{f.startsWith(m)&&(f===m||f.startsWith(m+"/"))&&(le("searching with downranked folders in path: ",f),E=!0)}),E&&(d.score/=10);let T=f.split("/"),w=T.length;for(let m=0;mw.includes(m))&&(le(`Boosting field "${E}" x${T} for ${f}`),d.score*=T)}for(let E of o)(d.tags??[]).includes(E)&&(d.score*=100)}le("Sorting and limiting results"),a=a.sort((d,f)=>f.score-d.score).slice(0,50),le("Filtered results:",a),a.length&&le("First result:",a[0]);let c=await Promise.all(a.map(async d=>await this.plugin.documentsRepository.getDocument(d.id))),l=e.getExactTerms();l.length&&(le("Filtering with quoted terms: ",l),a=a.filter(d=>{let f=c.find(T=>T.path===d.id),p=f?.path.toLowerCase()??"",E=(f?.cleanedContent??"").toLowerCase();return l.every(T=>E.includes(T)||un(p,this.plugin.settings.ignoreArabicDiacritics).includes(T))}));let h=e.query.exclude.text;return h.length&&(le("Filtering with exclusions"),a=a.filter(d=>{let f=(c.find(p=>p.path===d.id)?.content??"").toLowerCase();return h.every(p=>!f.includes(p))})),le("Deduping"),a=a.filter((d,f,p)=>p.findIndex(E=>E.id===d.id)===f),a}async getSuggestions(e,n){let r;this.plugin.settings.simpleSearch?r=await this.search(e,{prefixLength:3,singleFilePath:n?.singleFilePath}):r=await this.search(e,{prefixLength:1,singleFilePath:n?.singleFilePath});let s=await Promise.all(r.map(async o=>await this.plugin.documentsRepository.getDocument(o.id))),i=s.length;for(let o=0;o{le("Locating matches for",o.id);let c=s.find(f=>f.path===o.id);c||(console.warn(`Omnisearch - Note "${o.id}" not in the live cache`),c={content:"",basename:o.id,path:o.id});let l=[...o.terms,...e.getExactTerms(),...e.getTags()];le("Matching tokens:",l),le("Getting matches locations...");let h=this.plugin.textProcessor.getMatches(c.content,l,e);return le(`Matches for note "${c.path}"`,h),B({score:o.score,foundWords:l,matches:h,isEmbed:o.isEmbed},c)});return le("Suggestions:",a),a}getSerializedMiniSearch(){return this.minisearch.toJSON()}getSerializedIndexedDocuments(){return Array.from(this.indexedDocuments).map(([e,n])=>({path:e,mtime:n}))}getOptions(){return{tokenize:this.tokenizer.tokenizeForIndexing.bind(this.tokenizer),extractField:(e,n)=>{if(n==="directory"){let r=e.path.split("/");return r.pop(),r.join("/")}return e[n]},processTerm:e=>(this.plugin.settings.ignoreDiacritics?un(e,this.plugin.settings.ignoreArabicDiacritics):e).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags"],logger(e,n,r){r==="version_conflict"&&new JT.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}}}};var Qs=_e(require("obsidian"));ut();ci();var $d=class{constructor(e){this.plugin=e;this.documents=new Map;this.errorsCount=0;this.errorsWarned=!1;setInterval(()=>{this.errorsCount>0&&--this.errorsCount},1e3)}async addDocument(e){try{let n=await this.getAndMapIndexedDocument(e);if(!n.path){console.error(`Missing .path field in IndexedDocument "${n.basename}", skipping`);return}this.documents.set(e,n),this.plugin.embedsRepository.refreshEmbedsForNote(e)}catch(n){console.warn(`Omnisearch: Error while adding "${e}" to live cache`,n),this.removeDocument(e),this.countError()}}removeDocument(e){this.documents.delete(e)}async getDocument(e){return this.documents.has(e)?this.documents.get(e):(le("Generating IndexedDocument from",e),await this.addDocument(e),this.documents.get(e))}async getAndMapIndexedDocument(e){e=(0,Qs.normalizePath)(e);let n=this.plugin.app,r=n.vault.getAbstractFileByPath(e);if(!r)throw new Error(`Invalid file path: "${e}"`);if(!(r instanceof Qs.TFile))throw new Error(`Not a TFile: "${e}"`);let s=null,i=this.plugin.getTextExtractor(),a=this.plugin.getAIImageAnalyzer();if(this.plugin.notesIndexer.isFilePlaintext(e))s=await n.vault.cachedRead(r);else if(cn(e)){let h=await n.vault.cachedRead(r),d=h?JSON.parse(h):{},f=[];for(let p of d.nodes??[])p.type==="text"?f.push(p.text):p.type==="file"&&f.push(p.file);for(let p of(d.edges??[]).filter(E=>!!E.label))f.push(p.label);s=f.join(`\r +`)}else if(oi(e))try{let h=JSON.parse(await n.vault.cachedRead(r)),d=[],f=p=>{for(let E in p)typeof p[E]=="object"?f(p[E]):E==="content"&&d.push(p[E])};f(h),s=d.join(`\r +`)}catch(h){console.error("Omnisearch: Error while parsing Dataloom file",e),console.error(h)}else Jt(e)&&(this.plugin.settings.imagesIndexing&&i?.canFileBeExtracted(e)||this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(r))?(this.plugin.settings.imagesIndexing&&i?.canFileBeExtracted(e)&&(s=await i.extractText(r)),this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(r)&&(s=await a.analyzeImage(r)+(s??""))):en(e)&&this.plugin.settings.PDFIndexing&&i?.canFileBeExtracted(e)?s=await i.extractText(r):Ch(e)&&this.plugin.settings.officeIndexing&&i?.canFileBeExtracted(e)?s=await i.extractText(r):this.plugin.notesIndexer.isFilenameIndexable(e)&&(s=r.path);s==null&&(console.warn(`Omnisearch: ${s} content for file`,r.path),s="");let o=n.metadataCache.getFileCache(r);if(o){let h=Oh(this.plugin.app,r,o);for(let d of h.filter(f=>!this.documents.has(f))){let f=this.plugin.notesIndexer.generateIndexableNonexistingDocument(d,r.path)}if(o.frontmatter?.["excalidraw-plugin"]){let d=o.sections?.filter(f=>f.type==="comment")??[];for(let{start:f,end:p}of d.map(E=>E.position))s=s.substring(0,f.offset-1)+s.substring(p.offset)}}let c=o?.frontmatter?.[this.plugin.settings.displayTitle]??"",l=Ah(o);return{basename:r.basename,displayTitle:c,content:s,cleanedContent:xh(un(s)),path:r.path,mtime:r.stat.mtime,tags:l,unmarkedTags:l.map(h=>h.replace("#","")),aliases:yh(o).join(""),headings1:o?La(o,1).join(" "):"",headings2:o?La(o,2).join(" "):"",headings3:o?La(o,3).join(" "):""}}countError(){++this.errorsCount>5&&!this.errorsWarned&&(this.errorsWarned=!0,new Qs.Notice("Omnisearch \u26A0\uFE0F There might be an issue with your cache. You should clean it in Omnisearch settings and restart Obsidian."))}};ut();ci();ut();var Qd=class{constructor(e){this.plugin=e;this.notesToReindex=new Set}flagNoteForReindex(e){this.notesToReindex.add(e)}async refreshIndex(){for(let n of this.notesToReindex)le("Updating file",n.path),await this.plugin.documentsRepository.addDocument(n.path);let e=[...this.notesToReindex].map(n=>n.path);e.length&&(this.plugin.searchEngine.removeFromPaths(e),await this.plugin.searchEngine.addFromPaths(e),this.notesToReindex.clear())}isFileIndexable(e){return this.isFilenameIndexable(e)||this.isContentIndexable(e)}isContentIndexable(e){let n=this.plugin.settings,r=!!this.plugin.getTextExtractor(),s=!!this.plugin.getAIImageAnalyzer(),i=r&&n.PDFIndexing,a=r&&n.imagesIndexing,o=s&&n.aiImageIndexing;return this.isFilePlaintext(e)||cn(e)||oi(e)||i&&en(e)||a&&Jt(e)||o&&Jt(e)}isFilenameIndexable(e){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(e)||cn(e)||oi(e)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(e,n){return e=Ec(e),{path:e+(e.endsWith(".md")?"":".md"),basename:e,displayTitle:"",mtime:0,content:"",cleanedContent:"",tags:[],unmarkedTags:[],aliases:"",headings1:"",headings2:"",headings3:"",doesNotExist:!0,parent:n}}isFilePlaintext(e){return[...this.plugin.settings.indexedFileTypes,"md"].some(n=>e.endsWith(`.${n}`))}};el();var $u=_e(require("obsidian"));ut();var Xd=class{constructor(e){this.plugin=e;this.embeds=new Map}addEmbed(e,n){this.embeds.has(e)||this.embeds.set(e,new Set),this.embeds.get(e).add(n)}removeFile(e){this.embeds.delete(e),this.refreshEmbedsForNote(e)}renameFile(e,n){this.embeds.has(e)&&(this.embeds.set(n,this.embeds.get(e)),this.embeds.delete(e)),this.embeds.forEach((r,s)=>{r.has(e)&&(r.delete(e),r.add(n))})}refreshEmbedsForNote(e){this.embeds.forEach((n,r)=>{n.has(e)&&n.delete(e)}),this.addEmbedsForNote(e)}getEmbeds(e){return this.embeds.has(e)?[...this.embeds.get(e)]:[]}async writeToCache(){le("Writing embeds to cache");let e=this.plugin.database,n=[];for(let[r,s]of this.embeds)n.push({embedded:r,referencedBy:[...s]});await e.embeds.clear(),await e.embeds.bulkAdd(n)}async loadFromCache(){try{let e=this.plugin.database;if(!e.embeds){le("No embeds in cache");return}le("Loading embeds from cache");let n=await e.embeds.toArray();for(let{embedded:r,referencedBy:s}of n)for(let i of s)this.addEmbed(r,i)}catch{this.plugin.database.clearCache(),console.error("Omnisearch - Error while loading embeds cache"),new $u.Notice("Omnisearch - There was an error while loading the cache. Please restart Obsidian.")}}addEmbedsForNote(e){let n=(this.plugin.app.metadataCache.getCache(e)?.embeds??[]).map(r=>this.plugin.app.metadataCache.getFirstLinkpathDest((0,$u.getLinkpath)(r.link),e)).filter(r=>!!r);for(let r of n)this.addEmbed(r.path,e)}};var Zd=class{constructor(e){this.plugin=e;this.nextQueryIsEmpty=!1}async addToHistory(e){if(!e){this.nextQueryIsEmpty=!0;return}this.nextQueryIsEmpty=!1;let n=this.plugin.database,r=await n.searchHistory.toArray();r=r.filter(s=>s.query!==e).reverse(),r.unshift({query:e}),r=r.slice(0,10),await n.searchHistory.clear(),await n.searchHistory.bulkAdd(r)}async getHistory(){let e=(await this.plugin.database.searchHistory.toArray()).reverse().map(n=>n.query);return this.nextQueryIsEmpty&&e.unshift(""),e}};var Jd=class extends Dn.Plugin{constructor(e,n){super(e,n);this.apiHttpServer=null;this.settings=go(this.app);this.embedsRepository=new Xd(this);this.database=new Wo(this);this.notesIndexer=new Qd(this);this.textProcessor=new Zc(this);this.searchEngine=new Gd(this);this.searchHistory=new Zd(this);this.documentsRepository=new $d(this)}async onload(){if(this.settings=await kg(this),this.addSettingTab(new Gc(this)),Dn.Platform.isMobile||Promise.resolve().then(()=>(sx(),rx)).then(r=>this.apiHttpServer=r.getServer(this)),$c(this.app)){console.debug("Plugin disabled");return}await SO(this.app),await this.database.clearOldDatabases(),Sb(this);let e=this.settings;e.ribbonIcon&&this.addRibbonButton(),ae.disable("vault"),ae.disable("infile"),ae.on("global",Ra.ToggleExcerpts,()=>{_r.set(!e.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new Gn(this).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(r,s)=>{s.file&&new hs(this,s.file).open()}});let n=this.searchEngine;this.app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",r=>{r instanceof Dn.TFile&&this.notesIndexer.isFileIndexable(r.path)&&(le("Indexing new file",r.path),n.addFromPaths([r.path]),this.embedsRepository.refreshEmbedsForNote(r.path))})),this.registerEvent(this.app.vault.on("delete",r=>{le("Removing file",r.path),this.documentsRepository.removeDocument(r.path),n.removeFromPaths([r.path]),this.embedsRepository.removeFile(r.path)})),this.registerEvent(this.app.vault.on("modify",async r=>{this.notesIndexer.isFileIndexable(r.path)&&this.notesIndexer.flagNoteForReindex(r),this.embedsRepository.refreshEmbedsForNote(r.path)})),this.registerEvent(this.app.vault.on("rename",async(r,s)=>{this.notesIndexer.isFileIndexable(r.path)&&(le("Renaming file",r.path),this.documentsRepository.removeDocument(s),await this.documentsRepository.addDocument(r.path),n.removeFromPaths([s]),await n.addFromPaths([r.path]),this.embedsRepository.renameFile(s,r.path))})),this.refreshIndexCallback=this.notesIndexer.refreshIndex.bind(this.notesIndexer),addEventListener("blur",this.refreshIndexCallback),removeEventListener,await this.executeFirstLaunchTasks(),await this.populateIndex(),this.apiHttpServer&&e.httpApiEnabled&&this.apiHttpServer.listen(e.httpApiPort)})}async executeFirstLaunchTasks(){let e="1.21.0";this.settings.welcomeMessage=e,await this.saveData(this.settings)}async onunload(){delete globalThis.omnisearch,this.refreshIndexCallback&&removeEventListener("blur",this.refreshIndexCallback),await this.database.clearCache(),this.apiHttpServer.close()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",e=>{new Gn(this).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}getChsSegmenter(){return this.app.plugins.plugins["cm-chs-patch"]}getTextExtractor(){return this.app.plugins?.plugins?.["text-extractor"]?.api}getAIImageAnalyzer(){return this.app.plugins?.plugins?.["ai-image-analyzer"]?.api}async populateIndex(){console.time("Indexing total time"),Pn.set(Nt.ReadingFiles);let e=this.app.vault.getFiles().filter(s=>this.notesIndexer.isFileIndexable(s.path));console.debug(`${e.length} files total`),console.debug(`Cache is ${Wn()?"enabled":"disabled"}`);let n=this.searchEngine;Wn()&&(console.time("Loading index from cache"),Pn.set(Nt.LoadingCache),await n.loadCache()&&console.timeEnd("Loading index from cache"));let r=n.getDocumentsToReindex(e.map(s=>({path:s.path,mtime:s.stat.mtime})));if(Wn()&&(r.toAdd.length&&console.debug("Total number of files to add/update: "+r.toAdd.length),r.toRemove.length&&console.debug("Total number of files to remove: "+r.toRemove.length)),r.toAdd.length>=1e3&&Wn()&&new Dn.Notice(`${r.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),Pn.set(Nt.IndexingFiles),n.removeFromPaths(r.toRemove.map(s=>s.path)),await n.addFromPaths(r.toAdd.map(s=>s.path)),(r.toRemove.length||r.toAdd.length)&&Wn()){Pn.set(Nt.WritingCache);let s=this.settings.useCache;s&&!this.settings.DANGER_forceSaveCache&&(this.settings.useCache=!1,await ue(this)),await this.database.writeMinisearchCache(),await this.embedsRepository.writeToCache(),s&&(this.settings.useCache=!0,await ue(this))}console.timeEnd("Indexing total time"),r.toAdd.length>=1e3&&Wn()&&new Dn.Notice("Your files have been indexed."),Pn.set(Nt.Done),Ab()}};async function SO(t){let e=[`${t.vault.configDir}/plugins/omnisearch/searchIndex.json`,`${t.vault.configDir}/plugins/omnisearch/notesCache.json`,`${t.vault.configDir}/plugins/omnisearch/notesCache.data`,`${t.vault.configDir}/plugins/omnisearch/searchIndex.data`,`${t.vault.configDir}/plugins/omnisearch/historyCache.json`,`${t.vault.configDir}/plugins/omnisearch/pdfCache.data`];for(let n of e)if(await t.vault.adapter.exists(n))try{await t.vault.adapter.remove(n)}catch{}} + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/omnisearch/manifest.json b/.obsidian/plugins/omnisearch/manifest.json new file mode 100644 index 0000000..559bdc8 --- /dev/null +++ b/.obsidian/plugins/omnisearch/manifest.json @@ -0,0 +1,14 @@ +{ + "id": "omnisearch", + "name": "Omnisearch", + "version": "1.25.1", + "minAppVersion": "1.7.2", + "description": "A search engine that just works", + "author": "Simon Cambier", + "authorUrl": "https://github.com/scambier/obsidian-omnisearch", + "fundingUrl": { + "Github": "https://github.com/sponsors/scambier", + "Ko-fi": "https://ko-fi.com/scambier" + }, + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/omnisearch/styles.css b/.obsidian/plugins/omnisearch/styles.css new file mode 100644 index 0000000..8b0c6c6 --- /dev/null +++ b/.obsidian/plugins/omnisearch/styles.css @@ -0,0 +1,135 @@ +.omnisearch-modal { +} + +.omnisearch-result { + white-space: normal; + display: flex; + flex-direction: row; + /* justify-content: space-between; */ + flex-wrap: nowrap; +} + +.omnisearch-result__title-container { + display: flex; + align-items: center; + justify-content: space-between; + column-gap: 5px; + flex-wrap: wrap; +} + +.omnisearch-result__title { + white-space: pre-wrap; + align-items: center; + display: flex; + gap: 5px; +} + +.omnisearch-result__title > span { +} + +.omnisearch-result__folder-path { + font-size: 0.75rem; + align-items: center; + display: flex; + gap: 5px; + color: var(--text-muted); +} + +.omnisearch-result__extension { + font-size: 0.7rem; + color: var(--text-muted); +} + +.omnisearch-result__counter { + font-size: 0.7rem; + color: var(--text-muted); +} + +.omnisearch-result__body { + white-space: normal; + font-size: small; + word-wrap: normal; + + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + + color: var(--text-muted); + margin-inline-start: 0.5em; +} + +.omnisearch-result__embed { + margin-left: 1em; +} + + +.omnisearch-result__image-container { + flex-basis: 20%; + text-align: end; +} + +.omnisearch-highlight { +} + +.omnisearch-default-highlight { + text-decoration: underline; + text-decoration-color: var(--text-highlight-bg); + text-decoration-thickness: 3px; + text-underline-offset: -1px; + text-decoration-skip-ink: none; +} + +.omnisearch-input-container { + display: flex; + align-items: center; + flex-direction: row; + gap: 5px; +} + +.omnisearch-result__icon { + display: inline-block; + vertical-align: middle; + width: 16px; + height: 16px; + margin-right: 4px; +} + +.omnisearch-result__icon svg { + width: 100%; + height: 100%; +} + +.omnisearch-result__icon--emoji { + font-size: 16px; + vertical-align: middle; + margin-right: 4px; +} + +@media only screen and (max-width: 600px) { + .omnisearch-input-container { + flex-direction: column; + } + + .omnisearch-input-container__buttons { + display: flex; + flex-direction: row; + width: 100%; + padding: 0 1em 0 1em; + gap: 1em; + } + .omnisearch-input-container__buttons > button { + flex-grow: 1; + } +} + +@media only screen and (min-width: 600px) { + .omnisearch-input-container__buttons { + margin-inline-end: 1em; + } +} + +.omnisearch-input-field { + position: relative; + flex-grow: 1; +} diff --git a/.obsidian/plugins/pdf-plus/data.json b/.obsidian/plugins/pdf-plus/data.json new file mode 100644 index 0000000..5b92901 --- /dev/null +++ b/.obsidian/plugins/pdf-plus/data.json @@ -0,0 +1,319 @@ +{ + "displayTextFormats": [ + { + "name": "Title & page", + "template": "{{file.basename}}, p.{{pageLabel}}" + }, + { + "name": "Page", + "template": "p.{{pageLabel}}" + }, + { + "name": "Text", + "template": "{{text}}" + }, + { + "name": "Emoji", + "template": "📖" + }, + { + "name": "None", + "template": "" + } + ], + "defaultDisplayTextFormatIndex": 0, + "syncDisplayTextFormat": true, + "syncDefaultDisplayTextFormat": false, + "copyCommands": [ + { + "name": "Quote", + "template": "> ({{linkWithDisplay}})\n> {{selection}}\n" + }, + { + "name": "Link", + "template": "{{linkWithDisplay}}" + }, + { + "name": "Embed", + "template": "!{{link}}" + }, + { + "name": "Callout", + "template": "> [!{{calloutType}}|{{color}}] {{linkWithDisplay}}\n> {{text}}\n" + }, + { + "name": "Quote in callout", + "template": "> [!{{calloutType}}|{{color}}] {{linkWithDisplay}}\n> > {{text}}\n> \n> " + } + ], + "useAnotherCopyTemplateWhenNoSelection": false, + "copyTemplateWhenNoSelection": "{{linkToPageWithDisplay}}", + "trimSelectionEmbed": false, + "embedMargin": 50, + "noSidebarInEmbed": true, + "noSpreadModeInEmbed": true, + "embedUnscrollable": false, + "singleTabForSinglePDF": true, + "highlightExistingTab": false, + "existingTabHighlightOpacity": 0.5, + "existingTabHighlightDuration": 0.75, + "paneTypeForFirstPDFLeaf": "left", + "openLinkNextToExistingPDFTab": true, + "openPDFWithDefaultApp": false, + "openPDFWithDefaultAppAndObsidian": true, + "focusObsidianAfterOpenPDFWithDefaultApp": true, + "syncWithDefaultApp": false, + "dontActivateAfterOpenPDF": true, + "dontActivateAfterOpenMD": true, + "highlightDuration": 0.75, + "noTextHighlightsInEmbed": false, + "noAnnotationHighlightsInEmbed": true, + "persistentTextHighlightsInEmbed": true, + "persistentAnnotationHighlightsInEmbed": false, + "highlightBacklinks": true, + "selectionBacklinkVisualizeStyle": "highlight", + "dblclickEmbedToOpenLink": true, + "highlightBacklinksPane": true, + "highlightOnHoverBacklinkPane": true, + "backlinkHoverColor": "", + "colors": { + "Yellow": "#ffd000", + "Red": "#ea5252", + "Note": "#086ddd", + "Important": "#bb61e5" + }, + "defaultColor": "", + "defaultColorPaletteItemIndex": 0, + "syncColorPaletteItem": true, + "syncDefaultColorPaletteItem": false, + "colorPaletteInToolbar": true, + "noColorButtonInColorPalette": true, + "colorPaletteInEmbedToolbar": false, + "quietColorPaletteTooltip": false, + "showStatusInToolbar": true, + "highlightColorSpecifiedOnly": false, + "doubleClickHighlightToOpenBacklink": true, + "hoverHighlightAction": "preview", + "paneTypeForFirstMDLeaf": "right", + "singleMDLeafInSidebar": true, + "alwaysUseSidebar": true, + "ignoreExistingMarkdownTabIn": [], + "defaultColorPaletteActionIndex": 4, + "syncColorPaletteAction": true, + "syncDefaultColorPaletteAction": false, + "proxyMDProperty": "PDF", + "hoverPDFLinkToOpen": false, + "ignoreHeightParamInPopoverPreview": true, + "filterBacklinksByPageDefault": true, + "showBacklinkToPage": true, + "enableHoverPDFInternalLink": true, + "recordPDFInternalLinkHistory": true, + "alwaysRecordHistory": true, + "renderMarkdownInStickyNote": false, + "enablePDFEdit": false, + "author": "", + "writeHighlightToFileOpacity": 0.2, + "defaultWriteFileToggle": false, + "syncWriteFileToggle": true, + "syncDefaultWriteFileToggle": false, + "enableAnnotationDeletion": true, + "warnEveryAnnotationDelete": false, + "warnBacklinkedAnnotationDelete": true, + "enableAnnotationContentEdit": true, + "enableEditEncryptedPDF": false, + "pdfLinkColor": "#04a802", + "pdfLinkBorder": false, + "replaceContextMenu": true, + "showContextMenuOnMouseUpIf": "Mod", + "contextMenuConfig": [ + { + "id": "action", + "visible": true + }, + { + "id": "selection", + "visible": true + }, + { + "id": "write-file", + "visible": true + }, + { + "id": "annotation", + "visible": true + }, + { + "id": "modify-annotation", + "visible": true + }, + { + "id": "link", + "visible": true + }, + { + "id": "text", + "visible": true + }, + { + "id": "search", + "visible": true + }, + { + "id": "speech", + "visible": true + }, + { + "id": "page", + "visible": true + }, + { + "id": "settings", + "visible": true + } + ], + "selectionProductMenuConfig": [ + "color", + "copy-format", + "display" + ], + "writeFileProductMenuConfig": [ + "color", + "copy-format", + "display" + ], + "annotationProductMenuConfig": [ + "copy-format", + "display" + ], + "updateColorPaletteStateFromContextMenu": true, + "mobileCopyAction": "pdf-plus", + "showContextMenuOnTablet": false, + "executeBuiltinCommandForOutline": true, + "executeBuiltinCommandForZoom": true, + "executeFontSizeAdjusterCommand": true, + "closeSidebarWithShowCommandIfExist": true, + "autoHidePDFSidebar": false, + "defaultSidebarView": 1, + "outlineDrag": true, + "outlineContextMenu": true, + "outlineLinkDisplayTextFormat": "{{file.basename}}, {{text}}", + "outlineLinkCopyFormat": "{{linkWithDisplay}}", + "recordHistoryOnOutlineClick": true, + "popoverPreviewOnOutlineHover": true, + "thumbnailDrag": true, + "thumbnailContextMenu": true, + "thumbnailLinkDisplayTextFormat": "{{file.basename}}, p.{{pageLabel}}", + "thumbnailLinkCopyFormat": "{{linkWithDisplay}}", + "recordHistoryOnThumbnailClick": true, + "popoverPreviewOnThumbnailHover": true, + "annotationPopupDrag": true, + "showAnnotationPopupOnHover": true, + "useCallout": true, + "calloutType": "PDF", + "calloutIcon": "highlighter", + "highlightBacklinksInEmbed": false, + "highlightBacklinksInHoverPopover": false, + "highlightBacklinksInCanvas": true, + "clickPDFInternalLinkWithModifierKey": true, + "clickOutlineItemWithModifierKey": true, + "clickThumbnailWithModifierKey": true, + "focusEditorAfterAutoPaste": true, + "clearSelectionAfterAutoPaste": true, + "respectCursorPositionWhenAutoPaste": true, + "autoCopy": false, + "autoFocus": false, + "autoPaste": false, + "autoFocusTarget": "last-active-and-open-then-last-paste", + "autoPasteTarget": "last-active-and-open-then-last-paste", + "openAutoFocusTargetIfNotOpened": true, + "howToOpenAutoFocusTargetIfNotOpened": "right", + "closeHoverEditorWhenLostFocus": true, + "closeSidebarWhenLostFocus": false, + "openAutoFocusTargetInEditingView": true, + "executeCommandWhenTargetNotIdentified": true, + "commandToExecuteWhenTargetNotIdentified": "switcher:open", + "autoPasteTargetDialogTimeoutSec": 20, + "autoCopyToggleRibbonIcon": true, + "autoCopyIconName": "highlighter", + "autoFocusToggleRibbonIcon": true, + "autoFocusIconName": "zap", + "autoPasteToggleRibbonIcon": true, + "autoPasteIconName": "clipboard-paste", + "viewSyncFollowPageNumber": true, + "viewSyncPageDebounceInterval": 0.3, + "openAfterExtractPages": true, + "howToOpenExtractedPDF": "tab", + "warnEveryPageDelete": false, + "warnBacklinkedPageDelete": true, + "extractPageInPlace": false, + "askExtractPageInPlace": true, + "pageLabelUpdateWhenInsertPage": "keep", + "pageLabelUpdateWhenDeletePage": "keep", + "pageLabelUpdateWhenExtractPage": "keep", + "askPageLabelUpdateWhenInsertPage": true, + "askPageLabelUpdateWhenDeletePage": true, + "askPageLabelUpdateWhenExtractPage": true, + "copyOutlineAsListFormat": "{{linkWithDisplay}}", + "copyOutlineAsListDisplayTextFormat": "{{text}}", + "copyOutlineAsHeadingsFormat": "{{text}}\n\n{{linkWithDisplay}}", + "copyOutlineAsHeadingsDisplayTextFormat": "p.{{pageLabel}}", + "copyOutlineAsHeadingsMinLevel": 2, + "newFileNameFormat": "", + "newFileTemplatePath": "", + "newPDFLocation": "current", + "newPDFFolderPath": "", + "rectEmbedStaticImage": false, + "rectImageFormat": "file", + "rectImageExtension": "webp", + "zoomToFitRect": false, + "rectEmbedResolution": 100, + "includeColorWhenCopyingRectLink": true, + "backlinkIconSize": 50, + "showBacklinkIconForSelection": false, + "showBacklinkIconForAnnotation": false, + "showBacklinkIconForOffset": true, + "showBacklinkIconForRect": false, + "showBoundingRectForBacklinkedAnnot": false, + "hideReplyAnnotation": false, + "searchLinkHighlightAll": "true", + "searchLinkCaseSensitive": "true", + "searchLinkMatchDiacritics": "default", + "searchLinkEntireWord": "false", + "dontFitWidthWhenOpenPDFLink": true, + "preserveCurrentLeftOffsetWhenOpenPDFLink": false, + "defaultZoomValue": "page-width", + "scrollModeOnLoad": 0, + "spreadModeOnLoad": 0, + "hoverableDropdownMenuInToolbar": true, + "zoomLevelInputBoxInToolbar": true, + "popoverPreviewOnExternalLinkHover": true, + "actionOnCitationHover": "pdf-plus-bib-popover", + "enableBibInEmbed": false, + "enableBibInHoverPopover": false, + "enableBibInCanvas": true, + "copyAsSingleLine": true, + "removeWhitespaceBetweenCJChars": true, + "dummyFileFolderPath": "", + "externalURIPatterns": [ + ".*\\.pdf$", + "https://arxiv.org/pdf/.*" + ], + "modifierToDropExternalPDFToCreateDummy": [ + "Shift" + ], + "vim": false, + "vimrcPath": "", + "vimVisualMotion": true, + "vimScrollSize": 40, + "vimLargerScrollSizeWhenZoomIn": true, + "vimContinuousScrollSpeed": 1.2, + "vimSmoothScroll": true, + "vimHlsearch": true, + "vimIncsearch": true, + "enableVimInContextMenu": true, + "enableVimOutlineMode": true, + "vimSmoothOutlineMode": true, + "vimHintChars": "hjklasdfgyuiopqwertnmzxcvb", + "vimHintArgs": "all", + "PATH": "" +} \ No newline at end of file diff --git a/.obsidian/plugins/pdf-plus/main.js b/.obsidian/plugins/pdf-plus/main.js new file mode 100644 index 0000000..e295a3c --- /dev/null +++ b/.obsidian/plugins/pdf-plus/main.js @@ -0,0 +1,127 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var cy=Object.create;var zc=Object.defineProperty;var dy=Object.getOwnPropertyDescriptor;var hy=Object.getOwnPropertyNames;var uy=Object.getPrototypeOf,fy=Object.prototype.hasOwnProperty;var we=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),eu=(n,t)=>{for(var e in t)zc(n,e,{get:t[e],enumerable:!0})},Dg=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of hy(t))!fy.call(n,r)&&r!==e&&zc(n,r,{get:()=>t[r],enumerable:!(i=dy(t,r))||i.enumerable});return n};var qn=(n,t,e)=>(e=n!=null?cy(uy(n)):{},Dg(t||!n||!n.__esModule?zc(e,"default",{value:n,enumerable:!0}):e,n)),py=n=>Dg(zc({},"__esModule",{value:!0}),n);var Sg=(n,t,e)=>{if(!t.has(n))throw TypeError("Cannot "+e)};var gi=(n,t,e)=>(Sg(n,t,"read from private field"),e?e.call(n):t.get(n)),xa=(n,t,e)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,e)},ya=(n,t,e,i)=>(Sg(n,t,"write to private field"),i?i.call(n,e):t.set(n,e),e);var on=we(bt=>{"use strict";var Py=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function ky(n,t){return Object.prototype.hasOwnProperty.call(n,t)}bt.assign=function(n){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(var i in e)ky(e,i)&&(n[i]=e[i])}}return n};bt.shrinkBuf=function(n,t){return n.length===t?n:n.subarray?n.subarray(0,t):(n.length=t,n)};var Dy={arraySet:function(n,t,e,i,r){if(t.subarray&&n.subarray){n.set(t.subarray(e,e+i),r);return}for(var o=0;o{"use strict";var Ty=on(),Cy=4,Og=0,Mg=1,Ey=2;function Qo(n){for(var t=n.length;--t>=0;)n[t]=0}var Ay=0,Ug=1,Iy=2,Ly=3,Oy=258,Su=29,La=256,Ca=La+1+Su,Jo=30,Tu=19,zg=2*Ca+1,Or=15,wu=16,My=7,Cu=256,qg=16,Wg=17,jg=18,ku=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Xc=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ny=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Kg=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ry=512,sn=new Array((Ca+2)*2);Qo(sn);var Ta=new Array(Jo*2);Qo(Ta);var Ea=new Array(Ry);Qo(Ea);var Aa=new Array(Oy-Ly+1);Qo(Aa);var Eu=new Array(Su);Qo(Eu);var Zc=new Array(Jo);Qo(Zc);function vu(n,t,e,i,r){this.static_tree=n,this.extra_bits=t,this.extra_base=e,this.elems=i,this.max_length=r,this.has_stree=n&&n.length}var Gg,Xg,Zg;function Fu(n,t){this.dyn_tree=n,this.max_code=0,this.stat_desc=t}function Yg(n){return n<256?Ea[n]:Ea[256+(n>>>7)]}function Ia(n,t){n.pending_buf[n.pending++]=t&255,n.pending_buf[n.pending++]=t>>>8&255}function Dt(n,t,e){n.bi_valid>wu-e?(n.bi_buf|=t<>wu-n.bi_valid,n.bi_valid+=e-wu):(n.bi_buf|=t<>>=1,e<<=1;while(--t>0);return e>>>1}function Vy(n){n.bi_valid===16?(Ia(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)}function By(n,t){var e=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,d,h,u,f,p,g=0;for(u=0;u<=Or;u++)n.bl_count[u]=0;for(e[n.heap[n.heap_max]*2+1]=0,l=n.heap_max+1;lc&&(u=c,g++),e[d*2+1]=u,!(d>i)&&(n.bl_count[u]++,f=0,d>=a&&(f=s[d-a]),p=e[d*2],n.opt_len+=p*(u+f),o&&(n.static_len+=p*(r[d*2+1]+f)));if(g!==0){do{for(u=c-1;n.bl_count[u]===0;)u--;n.bl_count[u]--,n.bl_count[u+1]+=2,n.bl_count[c]--,g-=2}while(g>0);for(u=c;u!==0;u--)for(d=n.bl_count[u];d!==0;)h=n.heap[--l],!(h>i)&&(e[h*2+1]!==u&&(n.opt_len+=(u-e[h*2+1])*e[h*2],e[h*2+1]=u),d--)}}function Qg(n,t,e){var i=new Array(Or+1),r=0,o,s;for(o=1;o<=Or;o++)i[o]=r=r+e[o-1]<<1;for(s=0;s<=t;s++){var a=n[s*2+1];a!==0&&(n[s*2]=Jg(i[a]++,a))}}function Hy(){var n,t,e,i,r,o=new Array(Or+1);for(e=0,i=0;i>=7;i8?Ia(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0}function Uy(n,t,e,i){$g(n),i&&(Ia(n,e),Ia(n,~e)),Ty.arraySet(n.pending_buf,n.window,t,e,n.pending),n.pending+=e}function Ng(n,t,e,i){var r=t*2,o=e*2;return n[r]>1;s>=1;s--)Pu(n,e,s);l=o;do s=n.heap[1],n.heap[1]=n.heap[n.heap_len--],Pu(n,e,1),a=n.heap[1],n.heap[--n.heap_max]=s,n.heap[--n.heap_max]=a,e[l*2]=e[s*2]+e[a*2],n.depth[l]=(n.depth[s]>=n.depth[a]?n.depth[s]:n.depth[a])+1,e[s*2+1]=e[a*2+1]=l,n.heap[1]=l++,Pu(n,e,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],By(n,t),Qg(e,c,n.bl_count)}function Vg(n,t,e){var i,r=-1,o,s=t[0*2+1],a=0,c=7,l=4;for(s===0&&(c=138,l=3),t[(e+1)*2+1]=65535,i=0;i<=e;i++)o=s,s=t[(i+1)*2+1],!(++a=3&&n.bl_tree[Kg[t]*2+1]===0;t--);return n.opt_len+=3*(t+1)+5+5+4,t}function qy(n,t,e,i){var r;for(Dt(n,t-257,5),Dt(n,e-1,5),Dt(n,i-4,4),r=0;r>>=1)if(t&1&&n.dyn_ltree[e*2]!==0)return Og;if(n.dyn_ltree[9*2]!==0||n.dyn_ltree[10*2]!==0||n.dyn_ltree[13*2]!==0)return Mg;for(e=32;e0?(n.strm.data_type===Ey&&(n.strm.data_type=Wy(n)),Du(n,n.l_desc),Du(n,n.d_desc),s=zy(n),r=n.opt_len+3+7>>>3,o=n.static_len+3+7>>>3,o<=r&&(r=o)):r=o=e+5,e+4<=r&&t!==-1?em(n,t,e,i):n.strategy===Cy||o===r?(Dt(n,(Ug<<1)+(i?1:0),3),Rg(n,sn,Ta)):(Dt(n,(Iy<<1)+(i?1:0),3),qy(n,n.l_desc.max_code+1,n.d_desc.max_code+1,s+1),Rg(n,n.dyn_ltree,n.dyn_dtree)),_g(n),i&&$g(n)}function Xy(n,t,e){return n.pending_buf[n.d_buf+n.last_lit*2]=t>>>8&255,n.pending_buf[n.d_buf+n.last_lit*2+1]=t&255,n.pending_buf[n.l_buf+n.last_lit]=e&255,n.last_lit++,t===0?n.dyn_ltree[e*2]++:(n.matches++,t--,n.dyn_ltree[(Aa[e]+La+1)*2]++,n.dyn_dtree[Yg(t)*2]++),n.last_lit===n.lit_bufsize-1}_o._tr_init=jy;_o._tr_stored_block=em;_o._tr_flush_block=Gy;_o._tr_tally=Xy;_o._tr_align=Ky});var Au=we((ck,im)=>{"use strict";function Zy(n,t,e,i){for(var r=n&65535|0,o=n>>>16&65535|0,s=0;e!==0;){s=e>2e3?2e3:e,e-=s;do r=r+t[i++]|0,o=o+r|0;while(--s);r%=65521,o%=65521}return r|o<<16|0}im.exports=Zy});var Iu=we((dk,nm)=>{"use strict";function Yy(){for(var n,t=[],e=0;e<256;e++){n=e;for(var i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n}return t}var Jy=Yy();function Qy(n,t,e,i){var r=Jy,o=i+e;n^=-1;for(var s=i;s>>8^r[(n^t[s])&255];return n^-1}nm.exports=Qy});var Yc=we((hk,rm)=>{"use strict";rm.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var fm=we(Ni=>{"use strict";var xt=on(),Wt=tm(),lm=Au(),Zn=Iu(),_y=Yc(),Vr=0,$y=1,ew=3,$n=4,om=5,Mi=0,sm=1,jt=-2,tw=-3,Lu=-5,iw=-1,nw=1,Jc=2,rw=3,ow=4,sw=0,aw=2,ed=8,lw=9,cw=15,dw=8,hw=29,uw=256,Mu=uw+1+hw,fw=30,pw=19,gw=2*Mu+1,mw=15,ae=3,Qn=258,bi=Qn+ae+1,bw=32,td=42,Nu=69,Qc=73,_c=91,$c=103,Mr=113,Ma=666,Qe=1,Na=2,Nr=3,ts=4,xw=3;function _n(n,t){return n.msg=_y[t],t}function am(n){return(n<<1)-(n>4?9:0)}function Jn(n){for(var t=n.length;--t>=0;)n[t]=0}function Yn(n){var t=n.state,e=t.pending;e>n.avail_out&&(e=n.avail_out),e!==0&&(xt.arraySet(n.output,t.pending_buf,t.pending_out,e,n.next_out),n.next_out+=e,t.pending_out+=e,n.total_out+=e,n.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))}function st(n,t){Wt._tr_flush_block(n,n.block_start>=0?n.block_start:-1,n.strstart-n.block_start,t),n.block_start=n.strstart,Yn(n.strm)}function ue(n,t){n.pending_buf[n.pending++]=t}function Oa(n,t){n.pending_buf[n.pending++]=t>>>8&255,n.pending_buf[n.pending++]=t&255}function yw(n,t,e,i){var r=n.avail_in;return r>i&&(r=i),r===0?0:(n.avail_in-=r,xt.arraySet(t,n.input,n.next_in,r,e),n.state.wrap===1?n.adler=lm(n.adler,t,r,e):n.state.wrap===2&&(n.adler=Zn(n.adler,t,r,e)),n.next_in+=r,n.total_in+=r,r)}function cm(n,t){var e=n.max_chain_length,i=n.strstart,r,o,s=n.prev_length,a=n.nice_match,c=n.strstart>n.w_size-bi?n.strstart-(n.w_size-bi):0,l=n.window,d=n.w_mask,h=n.prev,u=n.strstart+Qn,f=l[i+s-1],p=l[i+s];n.prev_length>=n.good_match&&(e>>=2),a>n.lookahead&&(a=n.lookahead);do if(r=t,!(l[r+s]!==p||l[r+s-1]!==f||l[r]!==l[i]||l[++r]!==l[i+1])){i+=2,r++;do;while(l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&is){if(n.match_start=t,s=o,o>=a)break;f=l[i+s-1],p=l[i+s]}}while((t=h[t&d])>c&&--e!==0);return s<=n.lookahead?s:n.lookahead}function Rr(n){var t=n.w_size,e,i,r,o,s;do{if(o=n.window_size-n.lookahead-n.strstart,n.strstart>=t+(t-bi)){xt.arraySet(n.window,n.window,t,t,0),n.match_start-=t,n.strstart-=t,n.block_start-=t,i=n.hash_size,e=i;do r=n.head[--e],n.head[e]=r>=t?r-t:0;while(--i);i=t,e=i;do r=n.prev[--e],n.prev[e]=r>=t?r-t:0;while(--i);o+=t}if(n.strm.avail_in===0)break;if(i=yw(n.strm,n.window,n.strstart+n.lookahead,o),n.lookahead+=i,n.lookahead+n.insert>=ae)for(s=n.strstart-n.insert,n.ins_h=n.window[s],n.ins_h=(n.ins_h<n.pending_buf_size-5&&(e=n.pending_buf_size-5);;){if(n.lookahead<=1){if(Rr(n),n.lookahead===0&&t===Vr)return Qe;if(n.lookahead===0)break}n.strstart+=n.lookahead,n.lookahead=0;var i=n.block_start+e;if((n.strstart===0||n.strstart>=i)&&(n.lookahead=n.strstart-i,n.strstart=i,st(n,!1),n.strm.avail_out===0)||n.strstart-n.block_start>=n.w_size-bi&&(st(n,!1),n.strm.avail_out===0))return Qe}return n.insert=0,t===$n?(st(n,!0),n.strm.avail_out===0?Nr:ts):(n.strstart>n.block_start&&(st(n,!1),n.strm.avail_out===0),Qe)}function Ou(n,t){for(var e,i;;){if(n.lookahead=ae&&(n.ins_h=(n.ins_h<=ae)if(i=Wt._tr_tally(n,n.strstart-n.match_start,n.match_length-ae),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=ae){n.match_length--;do n.strstart++,n.ins_h=(n.ins_h<=ae&&(n.ins_h=(n.ins_h<4096)&&(n.match_length=ae-1)),n.prev_length>=ae&&n.match_length<=n.prev_length){r=n.strstart+n.lookahead-ae,i=Wt._tr_tally(n,n.strstart-1-n.prev_match,n.prev_length-ae),n.lookahead-=n.prev_length-1,n.prev_length-=2;do++n.strstart<=r&&(n.ins_h=(n.ins_h<=ae&&n.strstart>0&&(r=n.strstart-1,i=s[r],i===s[++r]&&i===s[++r]&&i===s[++r])){o=n.strstart+Qn;do;while(i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&rn.lookahead&&(n.match_length=n.lookahead)}if(n.match_length>=ae?(e=Wt._tr_tally(n,1,n.match_length-ae),n.lookahead-=n.match_length,n.strstart+=n.match_length,n.match_length=0):(e=Wt._tr_tally(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++),e&&(st(n,!1),n.strm.avail_out===0))return Qe}return n.insert=0,t===$n?(st(n,!0),n.strm.avail_out===0?Nr:ts):n.last_lit&&(st(n,!1),n.strm.avail_out===0)?Qe:Na}function Fw(n,t){for(var e;;){if(n.lookahead===0&&(Rr(n),n.lookahead===0)){if(t===Vr)return Qe;break}if(n.match_length=0,e=Wt._tr_tally(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++,e&&(st(n,!1),n.strm.avail_out===0))return Qe}return n.insert=0,t===$n?(st(n,!0),n.strm.avail_out===0?Nr:ts):n.last_lit&&(st(n,!1),n.strm.avail_out===0)?Qe:Na}function Oi(n,t,e,i,r){this.good_length=n,this.max_lazy=t,this.nice_length=e,this.max_chain=i,this.func=r}var es;es=[new Oi(0,0,0,0,ww),new Oi(4,4,8,4,Ou),new Oi(4,5,16,8,Ou),new Oi(4,6,32,32,Ou),new Oi(4,4,16,16,$o),new Oi(8,16,32,32,$o),new Oi(8,16,128,128,$o),new Oi(8,32,128,256,$o),new Oi(32,128,258,1024,$o),new Oi(32,258,258,4096,$o)];function Pw(n){n.window_size=2*n.w_size,Jn(n.head),n.max_lazy_match=es[n.level].max_lazy,n.good_match=es[n.level].good_length,n.nice_match=es[n.level].nice_length,n.max_chain_length=es[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=ae-1,n.match_available=0,n.ins_h=0}function kw(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ed,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new xt.Buf16(gw*2),this.dyn_dtree=new xt.Buf16((2*fw+1)*2),this.bl_tree=new xt.Buf16((2*pw+1)*2),Jn(this.dyn_ltree),Jn(this.dyn_dtree),Jn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xt.Buf16(mw+1),this.heap=new xt.Buf16(2*Mu+1),Jn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xt.Buf16(2*Mu+1),Jn(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function dm(n){var t;return!n||!n.state?_n(n,jt):(n.total_in=n.total_out=0,n.data_type=aw,t=n.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?td:Mr,n.adler=t.wrap===2?0:1,t.last_flush=Vr,Wt._tr_init(t),Mi)}function hm(n){var t=dm(n);return t===Mi&&Pw(n.state),t}function Dw(n,t){return!n||!n.state||n.state.wrap!==2?jt:(n.state.gzhead=t,Mi)}function um(n,t,e,i,r,o){if(!n)return jt;var s=1;if(t===iw&&(t=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),r<1||r>lw||e!==ed||i<8||i>15||t<0||t>9||o<0||o>ow)return _n(n,jt);i===8&&(i=9);var a=new kw;return n.state=a,a.strm=n,a.wrap=s,a.gzhead=null,a.w_bits=i,a.w_size=1<om||t<0)return n?_n(n,jt):jt;if(i=n.state,!n.output||!n.input&&n.avail_in!==0||i.status===Ma&&t!==$n)return _n(n,n.avail_out===0?Lu:jt);if(i.strm=n,e=i.last_flush,i.last_flush=t,i.status===td)if(i.wrap===2)n.adler=0,ue(i,31),ue(i,139),ue(i,8),i.gzhead?(ue(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),ue(i,i.gzhead.time&255),ue(i,i.gzhead.time>>8&255),ue(i,i.gzhead.time>>16&255),ue(i,i.gzhead.time>>24&255),ue(i,i.level===9?2:i.strategy>=Jc||i.level<2?4:0),ue(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(ue(i,i.gzhead.extra.length&255),ue(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(n.adler=Zn(n.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Nu):(ue(i,0),ue(i,0),ue(i,0),ue(i,0),ue(i,0),ue(i,i.level===9?2:i.strategy>=Jc||i.level<2?4:0),ue(i,xw),i.status=Mr);else{var s=ed+(i.w_bits-8<<4)<<8,a=-1;i.strategy>=Jc||i.level<2?a=0:i.level<6?a=1:i.level===6?a=2:a=3,s|=a<<6,i.strstart!==0&&(s|=bw),s+=31-s%31,i.status=Mr,Oa(i,s),i.strstart!==0&&(Oa(i,n.adler>>>16),Oa(i,n.adler&65535)),n.adler=1}if(i.status===Nu)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(n.adler=Zn(n.adler,i.pending_buf,i.pending-r,r)),Yn(n),r=i.pending,i.pending===i.pending_buf_size));)ue(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(n.adler=Zn(n.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=Qc)}else i.status=Qc;if(i.status===Qc)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(n.adler=Zn(n.adler,i.pending_buf,i.pending-r,r)),Yn(n),r=i.pending,i.pending===i.pending_buf_size)){o=1;break}i.gzindexr&&(n.adler=Zn(n.adler,i.pending_buf,i.pending-r,r)),o===0&&(i.gzindex=0,i.status=_c)}else i.status=_c;if(i.status===_c)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(n.adler=Zn(n.adler,i.pending_buf,i.pending-r,r)),Yn(n),r=i.pending,i.pending===i.pending_buf_size)){o=1;break}i.gzindexr&&(n.adler=Zn(n.adler,i.pending_buf,i.pending-r,r)),o===0&&(i.status=$c)}else i.status=$c;if(i.status===$c&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&Yn(n),i.pending+2<=i.pending_buf_size&&(ue(i,n.adler&255),ue(i,n.adler>>8&255),n.adler=0,i.status=Mr)):i.status=Mr),i.pending!==0){if(Yn(n),n.avail_out===0)return i.last_flush=-1,Mi}else if(n.avail_in===0&&am(t)<=am(e)&&t!==$n)return _n(n,Lu);if(i.status===Ma&&n.avail_in!==0)return _n(n,Lu);if(n.avail_in!==0||i.lookahead!==0||t!==Vr&&i.status!==Ma){var c=i.strategy===Jc?Fw(i,t):i.strategy===rw?vw(i,t):es[i.level].func(i,t);if((c===Nr||c===ts)&&(i.status=Ma),c===Qe||c===Nr)return n.avail_out===0&&(i.last_flush=-1),Mi;if(c===Na&&(t===$y?Wt._tr_align(i):t!==om&&(Wt._tr_stored_block(i,0,0,!1),t===ew&&(Jn(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),Yn(n),n.avail_out===0))return i.last_flush=-1,Mi}return t!==$n?Mi:i.wrap<=0?sm:(i.wrap===2?(ue(i,n.adler&255),ue(i,n.adler>>8&255),ue(i,n.adler>>16&255),ue(i,n.adler>>24&255),ue(i,n.total_in&255),ue(i,n.total_in>>8&255),ue(i,n.total_in>>16&255),ue(i,n.total_in>>24&255)):(Oa(i,n.adler>>>16),Oa(i,n.adler&65535)),Yn(n),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?Mi:sm)}function Cw(n){var t;return!n||!n.state?jt:(t=n.state.status,t!==td&&t!==Nu&&t!==Qc&&t!==_c&&t!==$c&&t!==Mr&&t!==Ma?_n(n,jt):(n.state=null,t===Mr?_n(n,tw):Mi))}function Ew(n,t){var e=t.length,i,r,o,s,a,c,l,d;if(!n||!n.state||(i=n.state,s=i.wrap,s===2||s===1&&i.status!==td||i.lookahead))return jt;for(s===1&&(n.adler=lm(n.adler,t,e,0)),i.wrap=0,e>=i.w_size&&(s===0&&(Jn(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new xt.Buf8(i.w_size),xt.arraySet(d,t,e-i.w_size,i.w_size,0),t=d,e=i.w_size),a=n.avail_in,c=n.next_in,l=n.input,n.avail_in=e,n.next_in=0,n.input=t,Rr(i);i.lookahead>=ae;){r=i.strstart,o=i.lookahead-(ae-1);do i.ins_h=(i.ins_h<{"use strict";var id=on(),pm=!0,gm=!0;try{String.fromCharCode.apply(null,[0])}catch(n){pm=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(n){gm=!1}var Ra=new id.Buf8(256);for(an=0;an<256;an++)Ra[an]=an>=252?6:an>=248?5:an>=240?4:an>=224?3:an>=192?2:1;var an;Ra[254]=Ra[254]=1;is.string2buf=function(n){var t,e,i,r,o,s=n.length,a=0;for(r=0;r>>6,t[o++]=128|e&63):e<65536?(t[o++]=224|e>>>12,t[o++]=128|e>>>6&63,t[o++]=128|e&63):(t[o++]=240|e>>>18,t[o++]=128|e>>>12&63,t[o++]=128|e>>>6&63,t[o++]=128|e&63);return t};function mm(n,t){if(t<65534&&(n.subarray&&gm||!n.subarray&&pm))return String.fromCharCode.apply(null,id.shrinkBuf(n,t));for(var e="",i=0;i4){a[i++]=65533,e+=o-1;continue}for(r&=o===2?31:o===3?15:7;o>1&&e1){a[i++]=65533;continue}r<65536?a[i++]=r:(r-=65536,a[i++]=55296|r>>10&1023,a[i++]=56320|r&1023)}return mm(a,i)};is.utf8border=function(n,t){var e;for(t=t||n.length,t>n.length&&(t=n.length),e=t-1;e>=0&&(n[e]&192)===128;)e--;return e<0||e===0?t:e+Ra[n[e]]>t?e:t}});var Vu=we((pk,bm)=>{"use strict";function Aw(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}bm.exports=Aw});var vm=we(Ha=>{"use strict";var Va=fm(),Ba=on(),Hu=Ru(),Uu=Yc(),Iw=Vu(),wm=Object.prototype.toString,Lw=0,Bu=4,ns=0,xm=1,ym=2,Ow=-1,Mw=0,Nw=8;function Br(n){if(!(this instanceof Br))return new Br(n);this.options=Ba.assign({level:Ow,method:Nw,chunkSize:16384,windowBits:15,memLevel:8,strategy:Mw,to:""},n||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Iw,this.strm.avail_out=0;var e=Va.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==ns)throw new Error(Uu[e]);if(t.header&&Va.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(typeof t.dictionary=="string"?i=Hu.string2buf(t.dictionary):wm.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,e=Va.deflateSetDictionary(this.strm,i),e!==ns)throw new Error(Uu[e]);this._dict_set=!0}}Br.prototype.push=function(n,t){var e=this.strm,i=this.options.chunkSize,r,o;if(this.ended)return!1;o=t===~~t?t:t===!0?Bu:Lw,typeof n=="string"?e.input=Hu.string2buf(n):wm.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;do{if(e.avail_out===0&&(e.output=new Ba.Buf8(i),e.next_out=0,e.avail_out=i),r=Va.deflate(e,o),r!==xm&&r!==ns)return this.onEnd(r),this.ended=!0,!1;(e.avail_out===0||e.avail_in===0&&(o===Bu||o===ym))&&(this.options.to==="string"?this.onData(Hu.buf2binstring(Ba.shrinkBuf(e.output,e.next_out))):this.onData(Ba.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||e.avail_out===0)&&r!==xm);return o===Bu?(r=Va.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ns):(o===ym&&(this.onEnd(ns),e.avail_out=0),!0)};Br.prototype.onData=function(n){this.chunks.push(n)};Br.prototype.onEnd=function(n){n===ns&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ba.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function zu(n,t){var e=new Br(t);if(e.push(n,!0),e.err)throw e.msg||Uu[e.err];return e.result}function Rw(n,t){return t=t||{},t.raw=!0,zu(n,t)}function Vw(n,t){return t=t||{},t.gzip=!0,zu(n,t)}Ha.Deflate=Br;Ha.deflate=zu;Ha.deflateRaw=Rw;Ha.gzip=Vw});var Pm=we((mk,Fm)=>{"use strict";var nd=30,Bw=12;Fm.exports=function(t,e){var i,r,o,s,a,c,l,d,h,u,f,p,g,m,b,w,F,v,P,k,T,D,C,O,E;i=t.state,r=t.next_in,O=t.input,o=r+(t.avail_in-5),s=t.next_out,E=t.output,a=s-(e-t.avail_out),c=s+(t.avail_out-257),l=i.dmax,d=i.wsize,h=i.whave,u=i.wnext,f=i.window,p=i.hold,g=i.bits,m=i.lencode,b=i.distcode,w=(1<>>24,p>>>=P,g-=P,P=v>>>16&255,P===0)E[s++]=v&65535;else if(P&16){k=v&65535,P&=15,P&&(g>>=P,g-=P),g<15&&(p+=O[r++]<>>24,p>>>=P,g-=P,P=v>>>16&255,P&16){if(T=v&65535,P&=15,gl){t.msg="invalid distance too far back",i.mode=nd;break e}if(p>>>=P,g-=P,P=s-a,T>P){if(P=T-P,P>h&&i.sane){t.msg="invalid distance too far back",i.mode=nd;break e}if(D=0,C=f,u===0){if(D+=d-P,P2;)E[s++]=C[D++],E[s++]=C[D++],E[s++]=C[D++],k-=3;k&&(E[s++]=C[D++],k>1&&(E[s++]=C[D++]))}else{D=s-T;do E[s++]=E[D++],E[s++]=E[D++],E[s++]=E[D++],k-=3;while(k>2);k&&(E[s++]=E[D++],k>1&&(E[s++]=E[D++]))}}else if(P&64){t.msg="invalid distance code",i.mode=nd;break e}else{v=b[(v&65535)+(p&(1<>3,r-=k,g-=k<<3,p&=(1<{"use strict";var km=on(),rs=15,Dm=852,Sm=592,Tm=0,qu=1,Cm=2,Hw=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Uw=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],zw=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],qw=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Em.exports=function(t,e,i,r,o,s,a,c){var l=c.bits,d=0,h=0,u=0,f=0,p=0,g=0,m=0,b=0,w=0,F=0,v,P,k,T,D,C=null,O=0,E,V=new km.Buf16(rs+1),W=new km.Buf16(rs+1),B=null,U=0,te,z,oe;for(d=0;d<=rs;d++)V[d]=0;for(h=0;h=1&&V[f]===0;f--);if(p>f&&(p=f),f===0)return o[s++]=1<<24|64<<16|0,o[s++]=1<<24|64<<16|0,c.bits=1,0;for(u=1;u0&&(t===Tm||f!==1))return-1;for(W[1]=0,d=1;dDm||t===Cm&&w>Sm)return 1;for(;;){te=d-m,a[h]E?(z=B[U+a[h]],oe=C[O+a[h]]):(z=32+64,oe=0),v=1<>m)+P]=te<<24|z<<16|oe|0;while(P!==0);for(v=1<>=1;if(v!==0?(F&=v-1,F+=v):F=0,h++,--V[d]===0){if(d===f)break;d=e[i+a[h]]}if(d>p&&(F&T)!==k){for(m===0&&(m=p),D+=u,g=d-m,b=1<Dm||t===Cm&&w>Sm)return 1;k=F&T,o[k]=p<<24|g<<16|D-s|0}}return F!==0&&(o[D+F]=d-m<<24|64<<16|0),c.bits=p,0}});var h0=we(xi=>{"use strict";var It=on(),Zu=Au(),Ri=Iu(),Ww=Pm(),Ua=Am(),jw=0,i0=1,n0=2,Im=4,Kw=5,rd=6,Hr=0,Gw=1,Xw=2,Kt=-2,r0=-3,Yu=-4,Zw=-5,Lm=8,o0=1,Om=2,Mm=3,Nm=4,Rm=5,Vm=6,Bm=7,Hm=8,Um=9,zm=10,ad=11,ln=12,Wu=13,qm=14,ju=15,Wm=16,jm=17,Km=18,Gm=19,od=20,sd=21,Xm=22,Zm=23,Ym=24,Jm=25,Qm=26,Ku=27,_m=28,$m=29,Oe=30,Ju=31,Yw=32,Jw=852,Qw=592,_w=15,$w=_w;function e0(n){return(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24)}function ev(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new It.Buf16(320),this.work=new It.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s0(n){var t;return!n||!n.state?Kt:(t=n.state,n.total_in=n.total_out=t.total=0,n.msg="",t.wrap&&(n.adler=t.wrap&1),t.mode=o0,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new It.Buf32(Jw),t.distcode=t.distdyn=new It.Buf32(Qw),t.sane=1,t.back=-1,Hr)}function a0(n){var t;return!n||!n.state?Kt:(t=n.state,t.wsize=0,t.whave=0,t.wnext=0,s0(n))}function l0(n,t){var e,i;return!n||!n.state||(i=n.state,t<0?(e=0,t=-t):(e=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Kt:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=e,i.wbits=t,a0(n))}function c0(n,t){var e,i;return n?(i=new ev,n.state=i,i.window=null,e=l0(n,t),e!==Hr&&(n.state=null),e):Kt}function tv(n){return c0(n,$w)}var t0=!0,Gu,Xu;function iv(n){if(t0){var t;for(Gu=new It.Buf32(512),Xu=new It.Buf32(32),t=0;t<144;)n.lens[t++]=8;for(;t<256;)n.lens[t++]=9;for(;t<280;)n.lens[t++]=7;for(;t<288;)n.lens[t++]=8;for(Ua(i0,n.lens,0,288,Gu,0,n.work,{bits:9}),t=0;t<32;)n.lens[t++]=5;Ua(n0,n.lens,0,32,Xu,0,n.work,{bits:5}),t0=!1}n.lencode=Gu,n.lenbits=9,n.distcode=Xu,n.distbits=5}function d0(n,t,e,i){var r,o=n.state;return o.window===null&&(o.wsize=1<=o.wsize?(It.arraySet(o.window,t,e-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>i&&(r=i),It.arraySet(o.window,t,e-i,r,o.wnext),i-=r,i?(It.arraySet(o.window,t,e-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,e.check=Ri(e.check,C,2,0),l=0,d=0,e.mode=Om;break}if(e.flags=0,e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){n.msg="incorrect header check",e.mode=Oe;break}if((l&15)!==Lm){n.msg="unknown compression method",e.mode=Oe;break}if(l>>>=4,d-=4,T=(l&15)+8,e.wbits===0)e.wbits=T;else if(T>e.wbits){n.msg="invalid window size",e.mode=Oe;break}e.dmax=1<>8&1),e.flags&512&&(C[0]=l&255,C[1]=l>>>8&255,e.check=Ri(e.check,C,2,0)),l=0,d=0,e.mode=Mm;case Mm:for(;d<32;){if(a===0)break e;a--,l+=i[o++]<>>8&255,C[2]=l>>>16&255,C[3]=l>>>24&255,e.check=Ri(e.check,C,4,0)),l=0,d=0,e.mode=Nm;case Nm:for(;d<16;){if(a===0)break e;a--,l+=i[o++]<>8),e.flags&512&&(C[0]=l&255,C[1]=l>>>8&255,e.check=Ri(e.check,C,2,0)),l=0,d=0,e.mode=Rm;case Rm:if(e.flags&1024){for(;d<16;){if(a===0)break e;a--,l+=i[o++]<>>8&255,e.check=Ri(e.check,C,2,0)),l=0,d=0}else e.head&&(e.head.extra=null);e.mode=Vm;case Vm:if(e.flags&1024&&(f=e.length,f>a&&(f=a),f&&(e.head&&(T=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),It.arraySet(e.head.extra,i,o,f,T)),e.flags&512&&(e.check=Ri(e.check,i,f,o)),a-=f,o+=f,e.length-=f),e.length))break e;e.length=0,e.mode=Bm;case Bm:if(e.flags&2048){if(a===0)break e;f=0;do T=i[o+f++],e.head&&T&&e.length<65536&&(e.head.name+=String.fromCharCode(T));while(T&&f>9&1,e.head.done=!0),n.adler=e.check=0,e.mode=ln;break;case zm:for(;d<32;){if(a===0)break e;a--,l+=i[o++]<>>=d&7,d-=d&7,e.mode=Ku;break}for(;d<3;){if(a===0)break e;a--,l+=i[o++]<>>=1,d-=1,l&3){case 0:e.mode=qm;break;case 1:if(iv(e),e.mode=od,t===rd){l>>>=2,d-=2;break e}break;case 2:e.mode=jm;break;case 3:n.msg="invalid block type",e.mode=Oe}l>>>=2,d-=2;break;case qm:for(l>>>=d&7,d-=d&7;d<32;){if(a===0)break e;a--,l+=i[o++]<>>16^65535)){n.msg="invalid stored block lengths",e.mode=Oe;break}if(e.length=l&65535,l=0,d=0,e.mode=ju,t===rd)break e;case ju:e.mode=Wm;case Wm:if(f=e.length,f){if(f>a&&(f=a),f>c&&(f=c),f===0)break e;It.arraySet(r,i,o,f,s),a-=f,o+=f,c-=f,s+=f,e.length-=f;break}e.mode=ln;break;case jm:for(;d<14;){if(a===0)break e;a--,l+=i[o++]<>>=5,d-=5,e.ndist=(l&31)+1,l>>>=5,d-=5,e.ncode=(l&15)+4,l>>>=4,d-=4,e.nlen>286||e.ndist>30){n.msg="too many length or distance symbols",e.mode=Oe;break}e.have=0,e.mode=Km;case Km:for(;e.have>>=3,d-=3}for(;e.have<19;)e.lens[V[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,O={bits:e.lenbits},D=Ua(jw,e.lens,0,19,e.lencode,0,e.work,O),e.lenbits=O.bits,D){n.msg="invalid code lengths set",e.mode=Oe;break}e.have=0,e.mode=Gm;case Gm:for(;e.have>>24,w=m>>>16&255,F=m&65535,!(b<=d);){if(a===0)break e;a--,l+=i[o++]<>>=b,d-=b,e.lens[e.have++]=F;else{if(F===16){for(E=b+2;d>>=b,d-=b,e.have===0){n.msg="invalid bit length repeat",e.mode=Oe;break}T=e.lens[e.have-1],f=3+(l&3),l>>>=2,d-=2}else if(F===17){for(E=b+3;d>>=b,d-=b,T=0,f=3+(l&7),l>>>=3,d-=3}else{for(E=b+7;d>>=b,d-=b,T=0,f=11+(l&127),l>>>=7,d-=7}if(e.have+f>e.nlen+e.ndist){n.msg="invalid bit length repeat",e.mode=Oe;break}for(;f--;)e.lens[e.have++]=T}}if(e.mode===Oe)break;if(e.lens[256]===0){n.msg="invalid code -- missing end-of-block",e.mode=Oe;break}if(e.lenbits=9,O={bits:e.lenbits},D=Ua(i0,e.lens,0,e.nlen,e.lencode,0,e.work,O),e.lenbits=O.bits,D){n.msg="invalid literal/lengths set",e.mode=Oe;break}if(e.distbits=6,e.distcode=e.distdyn,O={bits:e.distbits},D=Ua(n0,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,O),e.distbits=O.bits,D){n.msg="invalid distances set",e.mode=Oe;break}if(e.mode=od,t===rd)break e;case od:e.mode=sd;case sd:if(a>=6&&c>=258){n.next_out=s,n.avail_out=c,n.next_in=o,n.avail_in=a,e.hold=l,e.bits=d,Ww(n,u),s=n.next_out,r=n.output,c=n.avail_out,o=n.next_in,i=n.input,a=n.avail_in,l=e.hold,d=e.bits,e.mode===ln&&(e.back=-1);break}for(e.back=0;m=e.lencode[l&(1<>>24,w=m>>>16&255,F=m&65535,!(b<=d);){if(a===0)break e;a--,l+=i[o++]<>v)],b=m>>>24,w=m>>>16&255,F=m&65535,!(v+b<=d);){if(a===0)break e;a--,l+=i[o++]<>>=v,d-=v,e.back+=v}if(l>>>=b,d-=b,e.back+=b,e.length=F,w===0){e.mode=Qm;break}if(w&32){e.back=-1,e.mode=ln;break}if(w&64){n.msg="invalid literal/length code",e.mode=Oe;break}e.extra=w&15,e.mode=Xm;case Xm:if(e.extra){for(E=e.extra;d>>=e.extra,d-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=Zm;case Zm:for(;m=e.distcode[l&(1<>>24,w=m>>>16&255,F=m&65535,!(b<=d);){if(a===0)break e;a--,l+=i[o++]<>v)],b=m>>>24,w=m>>>16&255,F=m&65535,!(v+b<=d);){if(a===0)break e;a--,l+=i[o++]<>>=v,d-=v,e.back+=v}if(l>>>=b,d-=b,e.back+=b,w&64){n.msg="invalid distance code",e.mode=Oe;break}e.offset=F,e.extra=w&15,e.mode=Ym;case Ym:if(e.extra){for(E=e.extra;d>>=e.extra,d-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){n.msg="invalid distance too far back",e.mode=Oe;break}e.mode=Jm;case Jm:if(c===0)break e;if(f=u-c,e.offset>f){if(f=e.offset-f,f>e.whave&&e.sane){n.msg="invalid distance too far back",e.mode=Oe;break}f>e.wnext?(f-=e.wnext,p=e.wsize-f):p=e.wnext-f,f>e.length&&(f=e.length),g=e.window}else g=r,p=s-e.offset,f=e.length;f>c&&(f=c),c-=f,e.length-=f;do r[s++]=g[p++];while(--f);e.length===0&&(e.mode=sd);break;case Qm:if(c===0)break e;r[s++]=e.length,c--,e.mode=sd;break;case Ku:if(e.wrap){for(;d<32;){if(a===0)break e;a--,l|=i[o++]<{"use strict";u0.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var p0=we((wk,f0)=>{"use strict";function av(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}f0.exports=av});var m0=we(qa=>{"use strict";var os=h0(),za=on(),ld=Ru(),je=Qu(),_u=Yc(),lv=Vu(),cv=p0(),g0=Object.prototype.toString;function Ur(n){if(!(this instanceof Ur))return new Ur(n);this.options=za.assign({chunkSize:16384,windowBits:0,to:""},n||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(n&&n.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new lv,this.strm.avail_out=0;var e=os.inflateInit2(this.strm,t.windowBits);if(e!==je.Z_OK)throw new Error(_u[e]);if(this.header=new cv,os.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ld.string2buf(t.dictionary):g0.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=os.inflateSetDictionary(this.strm,t.dictionary),e!==je.Z_OK)))throw new Error(_u[e])}Ur.prototype.push=function(n,t){var e=this.strm,i=this.options.chunkSize,r=this.options.dictionary,o,s,a,c,l,d=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?je.Z_FINISH:je.Z_NO_FLUSH,typeof n=="string"?e.input=ld.binstring2buf(n):g0.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;do{if(e.avail_out===0&&(e.output=new za.Buf8(i),e.next_out=0,e.avail_out=i),o=os.inflate(e,je.Z_NO_FLUSH),o===je.Z_NEED_DICT&&r&&(o=os.inflateSetDictionary(this.strm,r)),o===je.Z_BUF_ERROR&&d===!0&&(o=je.Z_OK,d=!1),o!==je.Z_STREAM_END&&o!==je.Z_OK)return this.onEnd(o),this.ended=!0,!1;e.next_out&&(e.avail_out===0||o===je.Z_STREAM_END||e.avail_in===0&&(s===je.Z_FINISH||s===je.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=ld.utf8border(e.output,e.next_out),c=e.next_out-a,l=ld.buf2string(e.output,a),e.next_out=c,e.avail_out=i-c,c&&za.arraySet(e.output,e.output,a,c,0),this.onData(l)):this.onData(za.shrinkBuf(e.output,e.next_out))),e.avail_in===0&&e.avail_out===0&&(d=!0)}while((e.avail_in>0||e.avail_out===0)&&o!==je.Z_STREAM_END);return o===je.Z_STREAM_END&&(s=je.Z_FINISH),s===je.Z_FINISH?(o=os.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===je.Z_OK):(s===je.Z_SYNC_FLUSH&&(this.onEnd(je.Z_OK),e.avail_out=0),!0)};Ur.prototype.onData=function(n){this.chunks.push(n)};Ur.prototype.onEnd=function(n){n===je.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=za.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function $u(n,t){var e=new Ur(t);if(e.push(n,!0),e.err)throw e.msg||_u[e.err];return e.result}function dv(n,t){return t=t||{},t.raw=!0,$u(n,t)}qa.Inflate=Ur;qa.inflate=$u;qa.inflateRaw=dv;qa.ungzip=$u});var Wa=we((Fk,x0)=>{"use strict";var hv=on().assign,uv=vm(),fv=m0(),pv=Qu(),b0={};hv(b0,uv,fv,pv);x0.exports=b0});var Rf=we((AL,wb)=>{"use strict";wb.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Fb=we((IL,vb)=>{vb.exports=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")}});var Db=we((LL,kb)=>{"use strict";var pF=Fb(),gF=Array.prototype.concat,mF=Array.prototype.slice,Pb=kb.exports=function(t){for(var e=[],i=0,r=t.length;i{var $l=Rf(),ec=Db(),Sb=Object.hasOwnProperty,Tb=Object.create(null);for(Od in $l)Sb.call($l,Od)&&(Tb[$l[Od]]=Od);var Od,Ot=Cb.exports={to:{},get:{}};Ot.get=function(n){var t=n.substring(0,3).toLowerCase(),e,i;switch(t){case"hsl":e=Ot.get.hsl(n),i="hsl";break;case"hwb":e=Ot.get.hwb(n),i="hwb";break;default:e=Ot.get.rgb(n),i="rgb";break}return e?{model:i,value:e}:null};Ot.get.rgb=function(n){if(!n)return null;var t=/^#([a-f0-9]{3,4})$/i,e=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,i=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,r=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,o=/^(\w+)$/,s=[0,0,0,1],a,c,l;if(a=n.match(e)){for(l=a[2],a=a[1],c=0;c<3;c++){var d=c*2;s[c]=parseInt(a.slice(d,d+2),16)}l&&(s[3]=parseInt(l,16)/255)}else if(a=n.match(t)){for(a=a[1],l=a[3],c=0;c<3;c++)s[c]=parseInt(a[c]+a[c],16);l&&(s[3]=parseInt(l+l,16)/255)}else if(a=n.match(i)){for(c=0;c<3;c++)s[c]=parseInt(a[c+1],0);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else if(a=n.match(r)){for(c=0;c<3;c++)s[c]=Math.round(parseFloat(a[c+1])*2.55);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else return(a=n.match(o))?a[1]==="transparent"?[0,0,0,0]:Sb.call($l,a[1])?(s=$l[a[1]],s[3]=1,s):null:null;for(c=0;c<3;c++)s[c]=hr(s[c],0,255);return s[3]=hr(s[3],0,1),s};Ot.get.hsl=function(n){if(!n)return null;var t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,e=n.match(t);if(e){var i=parseFloat(e[4]),r=(parseFloat(e[1])%360+360)%360,o=hr(parseFloat(e[2]),0,100),s=hr(parseFloat(e[3]),0,100),a=hr(isNaN(i)?1:i,0,1);return[r,o,s,a]}return null};Ot.get.hwb=function(n){if(!n)return null;var t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,e=n.match(t);if(e){var i=parseFloat(e[4]),r=(parseFloat(e[1])%360+360)%360,o=hr(parseFloat(e[2]),0,100),s=hr(parseFloat(e[3]),0,100),a=hr(isNaN(i)?1:i,0,1);return[r,o,s,a]}return null};Ot.to.hex=function(){var n=ec(arguments);return"#"+Md(n[0])+Md(n[1])+Md(n[2])+(n[3]<1?Md(Math.round(n[3]*255)):"")};Ot.to.rgb=function(){var n=ec(arguments);return n.length<4||n[3]===1?"rgb("+Math.round(n[0])+", "+Math.round(n[1])+", "+Math.round(n[2])+")":"rgba("+Math.round(n[0])+", "+Math.round(n[1])+", "+Math.round(n[2])+", "+n[3]+")"};Ot.to.rgb.percent=function(){var n=ec(arguments),t=Math.round(n[0]/255*100),e=Math.round(n[1]/255*100),i=Math.round(n[2]/255*100);return n.length<4||n[3]===1?"rgb("+t+"%, "+e+"%, "+i+"%)":"rgba("+t+"%, "+e+"%, "+i+"%, "+n[3]+")"};Ot.to.hsl=function(){var n=ec(arguments);return n.length<4||n[3]===1?"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)":"hsla("+n[0]+", "+n[1]+"%, "+n[2]+"%, "+n[3]+")"};Ot.to.hwb=function(){var n=ec(arguments),t="";return n.length>=4&&n[3]!==1&&(t=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+t+")"};Ot.to.keyword=function(n){return Tb[n.slice(0,3)]};function hr(n,t,e){return Math.min(Math.max(t,n),e)}function Md(n){var t=Math.round(n).toString(16).toUpperCase();return t.length<2?"0"+t:t}});var Vf=we((ML,Ib)=>{var tc=Rf(),Ab={};for(let n of Object.keys(tc))Ab[tc[n]]=n;var K={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Ib.exports=K;for(let n of Object.keys(K)){if(!("channels"in K[n]))throw new Error("missing channels property: "+n);if(!("labels"in K[n]))throw new Error("missing channel labels property: "+n);if(K[n].labels.length!==K[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:t,labels:e}=K[n];delete K[n].channels,delete K[n].labels,Object.defineProperty(K[n],"channels",{value:t}),Object.defineProperty(K[n],"labels",{value:e})}K.rgb.hsl=function(n){let t=n[0]/255,e=n[1]/255,i=n[2]/255,r=Math.min(t,e,i),o=Math.max(t,e,i),s=o-r,a,c;o===r?a=0:t===o?a=(e-i)/s:e===o?a=2+(i-t)/s:i===o&&(a=4+(t-e)/s),a=Math.min(a*60,360),a<0&&(a+=360);let l=(r+o)/2;return o===r?c=0:l<=.5?c=s/(o+r):c=s/(2-o-r),[a,c*100,l*100]};K.rgb.hsv=function(n){let t,e,i,r,o,s=n[0]/255,a=n[1]/255,c=n[2]/255,l=Math.max(s,a,c),d=l-Math.min(s,a,c),h=function(u){return(l-u)/6/d+1/2};return d===0?(r=0,o=0):(o=d/l,t=h(s),e=h(a),i=h(c),s===l?r=i-e:a===l?r=1/3+t-i:c===l&&(r=2/3+e-t),r<0?r+=1:r>1&&(r-=1)),[r*360,o*100,l*100]};K.rgb.hwb=function(n){let t=n[0],e=n[1],i=n[2],r=K.rgb.hsl(n)[0],o=1/255*Math.min(t,Math.min(e,i));return i=1-1/255*Math.max(t,Math.max(e,i)),[r,o*100,i*100]};K.rgb.cmyk=function(n){let t=n[0]/255,e=n[1]/255,i=n[2]/255,r=Math.min(1-t,1-e,1-i),o=(1-t-r)/(1-r)||0,s=(1-e-r)/(1-r)||0,a=(1-i-r)/(1-r)||0;return[o*100,s*100,a*100,r*100]};function bF(n,t){return(n[0]-t[0])**2+(n[1]-t[1])**2+(n[2]-t[2])**2}K.rgb.keyword=function(n){let t=Ab[n];if(t)return t;let e=1/0,i;for(let r of Object.keys(tc)){let o=tc[r],s=bF(n,o);s.04045?((t+.055)/1.055)**2.4:t/12.92,e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;let r=t*.4124+e*.3576+i*.1805,o=t*.2126+e*.7152+i*.0722,s=t*.0193+e*.1192+i*.9505;return[r*100,o*100,s*100]};K.rgb.lab=function(n){let t=K.rgb.xyz(n),e=t[0],i=t[1],r=t[2];e/=95.047,i/=100,r/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;let o=116*i-16,s=500*(e-i),a=200*(i-r);return[o,s,a]};K.hsl.rgb=function(n){let t=n[0]/360,e=n[1]/100,i=n[2]/100,r,o,s;if(e===0)return s=i*255,[s,s,s];i<.5?r=i*(1+e):r=i+e-i*e;let a=2*i-r,c=[0,0,0];for(let l=0;l<3;l++)o=t+1/3*-(l-1),o<0&&o++,o>1&&o--,6*o<1?s=a+(r-a)*6*o:2*o<1?s=r:3*o<2?s=a+(r-a)*(2/3-o)*6:s=a,c[l]=s*255;return c};K.hsl.hsv=function(n){let t=n[0],e=n[1]/100,i=n[2]/100,r=e,o=Math.max(i,.01);i*=2,e*=i<=1?i:2-i,r*=o<=1?o:2-o;let s=(i+e)/2,a=i===0?2*r/(o+r):2*e/(i+e);return[t,a*100,s*100]};K.hsv.rgb=function(n){let t=n[0]/60,e=n[1]/100,i=n[2]/100,r=Math.floor(t)%6,o=t-Math.floor(t),s=255*i*(1-e),a=255*i*(1-e*o),c=255*i*(1-e*(1-o));switch(i*=255,r){case 0:return[i,c,s];case 1:return[a,i,s];case 2:return[s,i,c];case 3:return[s,a,i];case 4:return[c,s,i];case 5:return[i,s,a]}};K.hsv.hsl=function(n){let t=n[0],e=n[1]/100,i=n[2]/100,r=Math.max(i,.01),o,s;s=(2-e)*i;let a=(2-e)*r;return o=e*r,o/=a<=1?a:2-a,o=o||0,s/=2,[t,o*100,s*100]};K.hwb.rgb=function(n){let t=n[0]/360,e=n[1]/100,i=n[2]/100,r=e+i,o;r>1&&(e/=r,i/=r);let s=Math.floor(6*t),a=1-i;o=6*t-s,s&1&&(o=1-o);let c=e+o*(a-e),l,d,h;switch(s){default:case 6:case 0:l=a,d=c,h=e;break;case 1:l=c,d=a,h=e;break;case 2:l=e,d=a,h=c;break;case 3:l=e,d=c,h=a;break;case 4:l=c,d=e,h=a;break;case 5:l=a,d=e,h=c;break}return[l*255,d*255,h*255]};K.cmyk.rgb=function(n){let t=n[0]/100,e=n[1]/100,i=n[2]/100,r=n[3]/100,o=1-Math.min(1,t*(1-r)+r),s=1-Math.min(1,e*(1-r)+r),a=1-Math.min(1,i*(1-r)+r);return[o*255,s*255,a*255]};K.xyz.rgb=function(n){let t=n[0]/100,e=n[1]/100,i=n[2]/100,r,o,s;return r=t*3.2406+e*-1.5372+i*-.4986,o=t*-.9689+e*1.8758+i*.0415,s=t*.0557+e*-.204+i*1.057,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[r*255,o*255,s*255]};K.xyz.lab=function(n){let t=n[0],e=n[1],i=n[2];t/=95.047,e/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,e=e>.008856?e**(1/3):7.787*e+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let r=116*e-16,o=500*(t-e),s=200*(e-i);return[r,o,s]};K.lab.xyz=function(n){let t=n[0],e=n[1],i=n[2],r,o,s;o=(t+16)/116,r=e/500+o,s=o-i/200;let a=o**3,c=r**3,l=s**3;return o=a>.008856?a:(o-16/116)/7.787,r=c>.008856?c:(r-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,r*=95.047,o*=100,s*=108.883,[r,o,s]};K.lab.lch=function(n){let t=n[0],e=n[1],i=n[2],r;r=Math.atan2(i,e)*360/2/Math.PI,r<0&&(r+=360);let s=Math.sqrt(e*e+i*i);return[t,s,r]};K.lch.lab=function(n){let t=n[0],e=n[1],r=n[2]/360*2*Math.PI,o=e*Math.cos(r),s=e*Math.sin(r);return[t,o,s]};K.rgb.ansi16=function(n,t=null){let[e,i,r]=n,o=t===null?K.rgb.hsv(n)[2]:t;if(o=Math.round(o/50),o===0)return 30;let s=30+(Math.round(r/255)<<2|Math.round(i/255)<<1|Math.round(e/255));return o===2&&(s+=60),s};K.hsv.ansi16=function(n){return K.rgb.ansi16(K.hsv.rgb(n),n[2])};K.rgb.ansi256=function(n){let t=n[0],e=n[1],i=n[2];return t===e&&e===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(i/255*5)};K.ansi16.rgb=function(n){let t=n%10;if(t===0||t===7)return n>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let e=(~~(n>50)+1)*.5,i=(t&1)*e*255,r=(t>>1&1)*e*255,o=(t>>2&1)*e*255;return[i,r,o]};K.ansi256.rgb=function(n){if(n>=232){let o=(n-232)*10+8;return[o,o,o]}n-=16;let t,e=Math.floor(n/36)/5*255,i=Math.floor((t=n%36)/6)/5*255,r=t%6/5*255;return[e,i,r]};K.rgb.hex=function(n){let e=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(e.length)+e};K.hex.rgb=function(n){let t=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let e=t[0];t[0].length===3&&(e=e.split("").map(a=>a+a).join(""));let i=parseInt(e,16),r=i>>16&255,o=i>>8&255,s=i&255;return[r,o,s]};K.rgb.hcg=function(n){let t=n[0]/255,e=n[1]/255,i=n[2]/255,r=Math.max(Math.max(t,e),i),o=Math.min(Math.min(t,e),i),s=r-o,a,c;return s<1?a=o/(1-s):a=0,s<=0?c=0:r===t?c=(e-i)/s%6:r===e?c=2+(i-t)/s:c=4+(t-e)/s,c/=6,c%=1,[c*360,s*100,a*100]};K.hsl.hcg=function(n){let t=n[1]/100,e=n[2]/100,i=e<.5?2*t*e:2*t*(1-e),r=0;return i<1&&(r=(e-.5*i)/(1-i)),[n[0],i*100,r*100]};K.hsv.hcg=function(n){let t=n[1]/100,e=n[2]/100,i=t*e,r=0;return i<1&&(r=(e-i)/(1-i)),[n[0],i*100,r*100]};K.hcg.rgb=function(n){let t=n[0]/360,e=n[1]/100,i=n[2]/100;if(e===0)return[i*255,i*255,i*255];let r=[0,0,0],o=t%1*6,s=o%1,a=1-s,c=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return c=(1-e)*i,[(e*r[0]+c)*255,(e*r[1]+c)*255,(e*r[2]+c)*255]};K.hcg.hsv=function(n){let t=n[1]/100,e=n[2]/100,i=t+e*(1-t),r=0;return i>0&&(r=t/i),[n[0],r*100,i*100]};K.hcg.hsl=function(n){let t=n[1]/100,i=n[2]/100*(1-t)+.5*t,r=0;return i>0&&i<.5?r=t/(2*i):i>=.5&&i<1&&(r=t/(2*(1-i))),[n[0],r*100,i*100]};K.hcg.hwb=function(n){let t=n[1]/100,e=n[2]/100,i=t+e*(1-t);return[n[0],(i-t)*100,(1-i)*100]};K.hwb.hcg=function(n){let t=n[1]/100,i=1-n[2]/100,r=i-t,o=0;return r<1&&(o=(i-r)/(1-r)),[n[0],r*100,o*100]};K.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};K.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};K.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};K.gray.hsl=function(n){return[0,0,n[0]]};K.gray.hsv=K.gray.hsl;K.gray.hwb=function(n){return[0,100,n[0]]};K.gray.cmyk=function(n){return[0,0,0,n[0]]};K.gray.lab=function(n){return[n[0],0,0]};K.gray.hex=function(n){let t=Math.round(n[0]/100*255)&255,i=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(i.length)+i};K.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var Ob=we((NL,Lb)=>{var Nd=Vf();function xF(){let n={},t=Object.keys(Nd);for(let e=t.length,i=0;i{var Bf=Vf(),FF=Ob(),Hs={},PF=Object.keys(Bf);function kF(n){let t=function(...e){let i=e[0];return i==null?i:(i.length>1&&(e=i),n(e))};return"conversion"in n&&(t.conversion=n.conversion),t}function DF(n){let t=function(...e){let i=e[0];if(i==null)return i;i.length>1&&(e=i);let r=n(e);if(typeof r=="object")for(let o=r.length,s=0;s{Hs[n]={},Object.defineProperty(Hs[n],"channels",{value:Bf[n].channels}),Object.defineProperty(Hs[n],"labels",{value:Bf[n].labels});let t=FF(n);Object.keys(t).forEach(i=>{let r=t[i];Hs[n][i]=DF(r),Hs[n][i].raw=kF(r)})});Mb.exports=Hs});var Bb=we((VL,Vb)=>{var Us=Eb(),Mt=Nb(),Rb=["keyword","gray","hex"],Hf={};for(let n of Object.keys(Mt))Hf[[...Mt[n].labels].sort().join("")]=n;var Rd={};function nt(n,t){if(!(this instanceof nt))return new nt(n,t);if(t&&t in Rb&&(t=null),t&&!(t in Mt))throw new Error("Unknown model: "+t);let e,i;if(n==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(n instanceof nt)this.model=n.model,this.color=[...n.color],this.valpha=n.valpha;else if(typeof n=="string"){let r=Us.get(n);if(r===null)throw new Error("Unable to parse color from string: "+n);this.model=r.model,i=Mt[this.model].channels,this.color=r.value.slice(0,i),this.valpha=typeof r.value[i]=="number"?r.value[i]:1}else if(n.length>0){this.model=t||"rgb",i=Mt[this.model].channels;let r=Array.prototype.slice.call(n,0,i);this.color=Uf(r,i),this.valpha=typeof n[i]=="number"?n[i]:1}else if(typeof n=="number")this.model="rgb",this.color=[n>>16&255,n>>8&255,n&255],this.valpha=1;else{this.valpha=1;let r=Object.keys(n);"alpha"in n&&(r.splice(r.indexOf("alpha"),1),this.valpha=typeof n.alpha=="number"?n.alpha:0);let o=r.sort().join("");if(!(o in Hf))throw new Error("Unable to parse color from object: "+JSON.stringify(n));this.model=Hf[o];let{labels:s}=Mt[this.model],a=[];for(e=0;e(n%360+360)%360),saturationl:We("hsl",1,$e(100)),lightness:We("hsl",2,$e(100)),saturationv:We("hsv",1,$e(100)),value:We("hsv",2,$e(100)),chroma:We("hcg",1,$e(100)),gray:We("hcg",2,$e(100)),white:We("hwb",1,$e(100)),wblack:We("hwb",2,$e(100)),cyan:We("cmyk",0,$e(100)),magenta:We("cmyk",1,$e(100)),yellow:We("cmyk",2,$e(100)),black:We("cmyk",3,$e(100)),x:We("xyz",0,$e(95.047)),y:We("xyz",1,$e(100)),z:We("xyz",2,$e(108.833)),l:We("lab",0,$e(100)),a:We("lab",1),b:We("lab",2),keyword(n){return n!==void 0?new nt(n):Mt[this.model].keyword(this.color)},hex(n){return n!==void 0?new nt(n):Us.to.hex(this.rgb().round().color)},hexa(n){if(n!==void 0)return new nt(n);let t=this.rgb().round().color,e=Math.round(this.valpha*255).toString(16).toUpperCase();return e.length===1&&(e="0"+e),Us.to.hex(t)+e},rgbNumber(){let n=this.rgb().color;return(n[0]&255)<<16|(n[1]&255)<<8|n[2]&255},luminosity(){let n=this.rgb().color,t=[];for(let[e,i]of n.entries()){let r=i/255;t[e]=r<=.04045?r/12.92:((r+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(n){let t=this.luminosity(),e=n.luminosity();return t>e?(t+.05)/(e+.05):(e+.05)/(t+.05)},level(n){let t=this.contrast(n);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){let n=this.rgb().color;return(n[0]*2126+n[1]*7152+n[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let n=this.rgb();for(let t=0;t<3;t++)n.color[t]=255-n.color[t];return n},lighten(n){let t=this.hsl();return t.color[2]+=t.color[2]*n,t},darken(n){let t=this.hsl();return t.color[2]-=t.color[2]*n,t},saturate(n){let t=this.hsl();return t.color[1]+=t.color[1]*n,t},desaturate(n){let t=this.hsl();return t.color[1]-=t.color[1]*n,t},whiten(n){let t=this.hwb();return t.color[1]+=t.color[1]*n,t},blacken(n){let t=this.hwb();return t.color[2]+=t.color[2]*n,t},grayscale(){let n=this.rgb().color,t=n[0]*.3+n[1]*.59+n[2]*.11;return nt.rgb(t,t,t)},fade(n){return this.alpha(this.valpha-this.valpha*n)},opaquer(n){return this.alpha(this.valpha+this.valpha*n)},rotate(n){let t=this.hsl(),e=t.color[0];return e=(e+n)%360,e=e<0?360+e:e,t.color[0]=e,t},mix(n,t){if(!n||!n.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof n);let e=n.rgb(),i=this.rgb(),r=t===void 0?.5:t,o=2*r-1,s=e.alpha()-i.alpha(),a=((o*s===-1?o:(o+s)/(1+o*s))+1)/2,c=1-a;return nt.rgb(a*e.red()+c*i.red(),a*e.green()+c*i.green(),a*e.blue()+c*i.blue(),e.alpha()*r+i.alpha()*(1-r))}};for(let n of Object.keys(Mt)){if(Rb.includes(n))continue;let{channels:t}=Mt[n];nt.prototype[n]=function(...e){return this.model===n?new nt(this):e.length>0?new nt(e,n):new nt([...CF(Mt[this.model][n].raw(this.color)),this.valpha],n)},nt[n]=function(...e){let i=e[0];return typeof i=="number"&&(i=Uf(e,t)),new nt(i,n)}}function SF(n,t){return Number(n.toFixed(t))}function TF(n){return function(t){return SF(t,n)}}function We(n,t,e){n=Array.isArray(n)?n:[n];for(let i of n)(Rd[i]||(Rd[i]=[]))[t]=e;return n=n[0],function(i){let r;return i!==void 0?(e&&(i=e(i)),r=this[n](),r.color[t]=i,r):(r=this[n]().color[t],e&&(r=e(r)),r)}}function $e(n){return function(t){return Math.max(0,Math.min(n,t))}}function CF(n){return Array.isArray(n)?n:[n]}function Uf(n,t){for(let e=0;e{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.bodyRegExps={xml:/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html4:/∉|&(?:nbsp|iexcl|cent|pound|curren|yen|brvbar|sect|uml|copy|ordf|laquo|not|shy|reg|macr|deg|plusmn|sup2|sup3|acute|micro|para|middot|cedil|sup1|ordm|raquo|frac14|frac12|frac34|iquest|Agrave|Aacute|Acirc|Atilde|Auml|Aring|AElig|Ccedil|Egrave|Eacute|Ecirc|Euml|Igrave|Iacute|Icirc|Iuml|ETH|Ntilde|Ograve|Oacute|Ocirc|Otilde|Ouml|times|Oslash|Ugrave|Uacute|Ucirc|Uuml|Yacute|THORN|szlig|agrave|aacute|acirc|atilde|auml|aring|aelig|ccedil|egrave|eacute|ecirc|euml|igrave|iacute|icirc|iuml|eth|ntilde|ograve|oacute|ocirc|otilde|ouml|divide|oslash|ugrave|uacute|ucirc|uuml|yacute|thorn|yuml|quot|amp|lt|gt|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html5:/·|℗|⋇|⪧|⩺|⋗|⦕|⩼|⪆|⥸|⋗|⋛|⪌|≷|≳|⪦|⩹|⋖|⋋|⋉|⥶|⩻|⦖|◃|⊴|◂|∉|⋹̸|⋵̸|∉|⋷|⋶|∌|∌|⋾|⋽|∥|⊠|⨱|⨰|&(?:AElig|AMP|Aacute|Acirc|Agrave|Aring|Atilde|Auml|COPY|Ccedil|ETH|Eacute|Ecirc|Egrave|Euml|GT|Iacute|Icirc|Igrave|Iuml|LT|Ntilde|Oacute|Ocirc|Ograve|Oslash|Otilde|Ouml|QUOT|REG|THORN|Uacute|Ucirc|Ugrave|Uuml|Yacute|aacute|acirc|acute|aelig|agrave|amp|aring|atilde|auml|brvbar|ccedil|cedil|cent|copy|curren|deg|divide|eacute|ecirc|egrave|eth|euml|frac12|frac14|frac34|gt|iacute|icirc|iexcl|igrave|iquest|iuml|laquo|lt|macr|micro|middot|nbsp|not|ntilde|oacute|ocirc|ograve|ordf|ordm|oslash|otilde|ouml|para|plusmn|pound|quot|raquo|reg|sect|shy|sup1|sup2|sup3|szlig|thorn|times|uacute|ucirc|ugrave|uml|uuml|yacute|yen|yuml|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g};Zd.namedReferences={xml:{entities:{"<":"<",">":">",""":'"',"'":"'","&":"&"},characters:{"<":"<",">":">",'"':""","'":"'","&":"&"}},html4:{entities:{"'":"'"," ":"\xA0"," ":"\xA0","¡":"\xA1","¡":"\xA1","¢":"\xA2","¢":"\xA2","£":"\xA3","£":"\xA3","¤":"\xA4","¤":"\xA4","¥":"\xA5","¥":"\xA5","¦":"\xA6","¦":"\xA6","§":"\xA7","§":"\xA7","¨":"\xA8","¨":"\xA8","©":"\xA9","©":"\xA9","ª":"\xAA","ª":"\xAA","«":"\xAB","«":"\xAB","¬":"\xAC","¬":"\xAC","­":"\xAD","­":"\xAD","®":"\xAE","®":"\xAE","¯":"\xAF","¯":"\xAF","°":"\xB0","°":"\xB0","±":"\xB1","±":"\xB1","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","´":"\xB4","´":"\xB4","µ":"\xB5","µ":"\xB5","¶":"\xB6","¶":"\xB6","·":"\xB7","·":"\xB7","¸":"\xB8","¸":"\xB8","¹":"\xB9","¹":"\xB9","º":"\xBA","º":"\xBA","»":"\xBB","»":"\xBB","¼":"\xBC","¼":"\xBC","½":"\xBD","½":"\xBD","¾":"\xBE","¾":"\xBE","¿":"\xBF","¿":"\xBF","À":"\xC0","À":"\xC0","Á":"\xC1","Á":"\xC1","Â":"\xC2","Â":"\xC2","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","Å":"\xC5","Å":"\xC5","Æ":"\xC6","Æ":"\xC6","Ç":"\xC7","Ç":"\xC7","È":"\xC8","È":"\xC8","É":"\xC9","É":"\xC9","Ê":"\xCA","Ê":"\xCA","Ë":"\xCB","Ë":"\xCB","Ì":"\xCC","Ì":"\xCC","Í":"\xCD","Í":"\xCD","Î":"\xCE","Î":"\xCE","Ï":"\xCF","Ï":"\xCF","Ð":"\xD0","Ð":"\xD0","Ñ":"\xD1","Ñ":"\xD1","Ò":"\xD2","Ò":"\xD2","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","Õ":"\xD5","Õ":"\xD5","Ö":"\xD6","Ö":"\xD6","×":"\xD7","×":"\xD7","Ø":"\xD8","Ø":"\xD8","Ù":"\xD9","Ù":"\xD9","Ú":"\xDA","Ú":"\xDA","Û":"\xDB","Û":"\xDB","Ü":"\xDC","Ü":"\xDC","Ý":"\xDD","Ý":"\xDD","Þ":"\xDE","Þ":"\xDE","ß":"\xDF","ß":"\xDF","à":"\xE0","à":"\xE0","á":"\xE1","á":"\xE1","â":"\xE2","â":"\xE2","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","å":"\xE5","å":"\xE5","æ":"\xE6","æ":"\xE6","ç":"\xE7","ç":"\xE7","è":"\xE8","è":"\xE8","é":"\xE9","é":"\xE9","ê":"\xEA","ê":"\xEA","ë":"\xEB","ë":"\xEB","ì":"\xEC","ì":"\xEC","í":"\xED","í":"\xED","î":"\xEE","î":"\xEE","ï":"\xEF","ï":"\xEF","ð":"\xF0","ð":"\xF0","ñ":"\xF1","ñ":"\xF1","ò":"\xF2","ò":"\xF2","ó":"\xF3","ó":"\xF3","ô":"\xF4","ô":"\xF4","õ":"\xF5","õ":"\xF5","ö":"\xF6","ö":"\xF6","÷":"\xF7","÷":"\xF7","ø":"\xF8","ø":"\xF8","ù":"\xF9","ù":"\xF9","ú":"\xFA","ú":"\xFA","û":"\xFB","û":"\xFB","ü":"\xFC","ü":"\xFC","ý":"\xFD","ý":"\xFD","þ":"\xFE","þ":"\xFE","ÿ":"\xFF","ÿ":"\xFF",""":'"',""":'"',"&":"&","&":"&","<":"<","<":"<",">":">",">":">","Œ":"\u0152","œ":"\u0153","Š":"\u0160","š":"\u0161","Ÿ":"\u0178","ˆ":"\u02C6","˜":"\u02DC"," ":"\u2002"," ":"\u2003"," ":"\u2009","‌":"\u200C","‍":"\u200D","‎":"\u200E","‏":"\u200F","–":"\u2013","—":"\u2014","‘":"\u2018","’":"\u2019","‚":"\u201A","“":"\u201C","”":"\u201D","„":"\u201E","†":"\u2020","‡":"\u2021","‰":"\u2030","‹":"\u2039","›":"\u203A","€":"\u20AC","ƒ":"\u0192","Α":"\u0391","Β":"\u0392","Γ":"\u0393","Δ":"\u0394","Ε":"\u0395","Ζ":"\u0396","Η":"\u0397","Θ":"\u0398","Ι":"\u0399","Κ":"\u039A","Λ":"\u039B","Μ":"\u039C","Ν":"\u039D","Ξ":"\u039E","Ο":"\u039F","Π":"\u03A0","Ρ":"\u03A1","Σ":"\u03A3","Τ":"\u03A4","Υ":"\u03A5","Φ":"\u03A6","Χ":"\u03A7","Ψ":"\u03A8","Ω":"\u03A9","α":"\u03B1","β":"\u03B2","γ":"\u03B3","δ":"\u03B4","ε":"\u03B5","ζ":"\u03B6","η":"\u03B7","θ":"\u03B8","ι":"\u03B9","κ":"\u03BA","λ":"\u03BB","μ":"\u03BC","ν":"\u03BD","ξ":"\u03BE","ο":"\u03BF","π":"\u03C0","ρ":"\u03C1","ς":"\u03C2","σ":"\u03C3","τ":"\u03C4","υ":"\u03C5","φ":"\u03C6","χ":"\u03C7","ψ":"\u03C8","ω":"\u03C9","ϑ":"\u03D1","ϒ":"\u03D2","ϖ":"\u03D6","•":"\u2022","…":"\u2026","′":"\u2032","″":"\u2033","‾":"\u203E","⁄":"\u2044","℘":"\u2118","ℑ":"\u2111","ℜ":"\u211C","™":"\u2122","ℵ":"\u2135","←":"\u2190","↑":"\u2191","→":"\u2192","↓":"\u2193","↔":"\u2194","↵":"\u21B5","⇐":"\u21D0","⇑":"\u21D1","⇒":"\u21D2","⇓":"\u21D3","⇔":"\u21D4","∀":"\u2200","∂":"\u2202","∃":"\u2203","∅":"\u2205","∇":"\u2207","∈":"\u2208","∉":"\u2209","∋":"\u220B","∏":"\u220F","∑":"\u2211","−":"\u2212","∗":"\u2217","√":"\u221A","∝":"\u221D","∞":"\u221E","∠":"\u2220","∧":"\u2227","∨":"\u2228","∩":"\u2229","∪":"\u222A","∫":"\u222B","∴":"\u2234","∼":"\u223C","≅":"\u2245","≈":"\u2248","≠":"\u2260","≡":"\u2261","≤":"\u2264","≥":"\u2265","⊂":"\u2282","⊃":"\u2283","⊄":"\u2284","⊆":"\u2286","⊇":"\u2287","⊕":"\u2295","⊗":"\u2297","⊥":"\u22A5","⋅":"\u22C5","⌈":"\u2308","⌉":"\u2309","⌊":"\u230A","⌋":"\u230B","⟨":"\u2329","⟩":"\u232A","◊":"\u25CA","♠":"\u2660","♣":"\u2663","♥":"\u2665","♦":"\u2666"},characters:{"'":"'","\xA0":" ","\xA1":"¡","\xA2":"¢","\xA3":"£","\xA4":"¤","\xA5":"¥","\xA6":"¦","\xA7":"§","\xA8":"¨","\xA9":"©",\u00AA:"ª","\xAB":"«","\xAC":"¬","\xAD":"­","\xAE":"®","\xAF":"¯","\xB0":"°","\xB1":"±","\xB2":"²","\xB3":"³","\xB4":"´",\u00B5:"µ","\xB6":"¶","\xB7":"·","\xB8":"¸","\xB9":"¹",\u00BA:"º","\xBB":"»","\xBC":"¼","\xBD":"½","\xBE":"¾","\xBF":"¿",\u00C0:"À",\u00C1:"Á",\u00C2:"Â",\u00C3:"Ã",\u00C4:"Ä",\u00C5:"Å",\u00C6:"Æ",\u00C7:"Ç",\u00C8:"È",\u00C9:"É",\u00CA:"Ê",\u00CB:"Ë",\u00CC:"Ì",\u00CD:"Í",\u00CE:"Î",\u00CF:"Ï",\u00D0:"Ð",\u00D1:"Ñ",\u00D2:"Ò",\u00D3:"Ó",\u00D4:"Ô",\u00D5:"Õ",\u00D6:"Ö","\xD7":"×",\u00D8:"Ø",\u00D9:"Ù",\u00DA:"Ú",\u00DB:"Û",\u00DC:"Ü",\u00DD:"Ý",\u00DE:"Þ",\u00DF:"ß",\u00E0:"à",\u00E1:"á",\u00E2:"â",\u00E3:"ã",\u00E4:"ä",\u00E5:"å",\u00E6:"æ",\u00E7:"ç",\u00E8:"è",\u00E9:"é",\u00EA:"ê",\u00EB:"ë",\u00EC:"ì",\u00ED:"í",\u00EE:"î",\u00EF:"ï",\u00F0:"ð",\u00F1:"ñ",\u00F2:"ò",\u00F3:"ó",\u00F4:"ô",\u00F5:"õ",\u00F6:"ö","\xF7":"÷",\u00F8:"ø",\u00F9:"ù",\u00FA:"ú",\u00FB:"û",\u00FC:"ü",\u00FD:"ý",\u00FE:"þ",\u00FF:"ÿ",'"':""","&":"&","<":"<",">":">",\u0152:"Œ",\u0153:"œ",\u0160:"Š",\u0161:"š",\u0178:"Ÿ","\u02C6":"ˆ","\u02DC":"˜","\u2002":" ","\u2003":" ","\u2009":" ","\u200C":"‌","\u200D":"‍","\u200E":"‎","\u200F":"‏","\u2013":"–","\u2014":"—","\u2018":"‘","\u2019":"’","\u201A":"‚","\u201C":"“","\u201D":"”","\u201E":"„","\u2020":"†","\u2021":"‡","\u2030":"‰","\u2039":"‹","\u203A":"›","\u20AC":"€",\u0192:"ƒ",\u0391:"Α",\u0392:"Β",\u0393:"Γ",\u0394:"Δ",\u0395:"Ε",\u0396:"Ζ",\u0397:"Η",\u0398:"Θ",\u0399:"Ι",\u039A:"Κ",\u039B:"Λ",\u039C:"Μ",\u039D:"Ν",\u039E:"Ξ",\u039F:"Ο",\u03A0:"Π",\u03A1:"Ρ",\u03A3:"Σ",\u03A4:"Τ",\u03A5:"Υ",\u03A6:"Φ",\u03A7:"Χ",\u03A8:"Ψ",\u03A9:"Ω",\u03B1:"α",\u03B2:"β",\u03B3:"γ",\u03B4:"δ",\u03B5:"ε",\u03B6:"ζ",\u03B7:"η",\u03B8:"θ",\u03B9:"ι",\u03BA:"κ",\u03BB:"λ",\u03BC:"μ",\u03BD:"ν",\u03BE:"ξ",\u03BF:"ο",\u03C0:"π",\u03C1:"ρ",\u03C2:"ς",\u03C3:"σ",\u03C4:"τ",\u03C5:"υ",\u03C6:"φ",\u03C7:"χ",\u03C8:"ψ",\u03C9:"ω",\u03D1:"ϑ",\u03D2:"ϒ",\u03D6:"ϖ","\u2022":"•","\u2026":"…","\u2032":"′","\u2033":"″","\u203E":"‾","\u2044":"⁄","\u2118":"℘",\u2111:"ℑ",\u211C:"ℜ","\u2122":"™",\u2135:"ℵ","\u2190":"←","\u2191":"↑","\u2192":"→","\u2193":"↓","\u2194":"↔","\u21B5":"↵","\u21D0":"⇐","\u21D1":"⇑","\u21D2":"⇒","\u21D3":"⇓","\u21D4":"⇔","\u2200":"∀","\u2202":"∂","\u2203":"∃","\u2205":"∅","\u2207":"∇","\u2208":"∈","\u2209":"∉","\u220B":"∋","\u220F":"∏","\u2211":"∑","\u2212":"−","\u2217":"∗","\u221A":"√","\u221D":"∝","\u221E":"∞","\u2220":"∠","\u2227":"∧","\u2228":"∨","\u2229":"∩","\u222A":"∪","\u222B":"∫","\u2234":"∴","\u223C":"∼","\u2245":"≅","\u2248":"≈","\u2260":"≠","\u2261":"≡","\u2264":"≤","\u2265":"≥","\u2282":"⊂","\u2283":"⊃","\u2284":"⊄","\u2286":"⊆","\u2287":"⊇","\u2295":"⊕","\u2297":"⊗","\u22A5":"⊥","\u22C5":"⋅","\u2308":"⌈","\u2309":"⌉","\u230A":"⌊","\u230B":"⌋","\u2329":"⟨","\u232A":"⟩","\u25CA":"◊","\u2660":"♠","\u2663":"♣","\u2665":"♥","\u2666":"♦"}},html5:{entities:{"Æ":"\xC6","Æ":"\xC6","&":"&","&":"&","Á":"\xC1","Á":"\xC1","Ă":"\u0102","Â":"\xC2","Â":"\xC2","А":"\u0410","𝔄":"\u{1D504}","À":"\xC0","À":"\xC0","Α":"\u0391","Ā":"\u0100","⩓":"\u2A53","Ą":"\u0104","𝔸":"\u{1D538}","⁡":"\u2061","Å":"\xC5","Å":"\xC5","𝒜":"\u{1D49C}","≔":"\u2254","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","∖":"\u2216","⫧":"\u2AE7","⌆":"\u2306","Б":"\u0411","∵":"\u2235","ℬ":"\u212C","Β":"\u0392","𝔅":"\u{1D505}","𝔹":"\u{1D539}","˘":"\u02D8","ℬ":"\u212C","≎":"\u224E","Ч":"\u0427","©":"\xA9","©":"\xA9","Ć":"\u0106","⋒":"\u22D2","ⅅ":"\u2145","ℭ":"\u212D","Č":"\u010C","Ç":"\xC7","Ç":"\xC7","Ĉ":"\u0108","∰":"\u2230","Ċ":"\u010A","¸":"\xB8","·":"\xB7","ℭ":"\u212D","Χ":"\u03A7","⊙":"\u2299","⊖":"\u2296","⊕":"\u2295","⊗":"\u2297","∲":"\u2232","”":"\u201D","’":"\u2019","∷":"\u2237","⩴":"\u2A74","≡":"\u2261","∯":"\u222F","∮":"\u222E","ℂ":"\u2102","∐":"\u2210","∳":"\u2233","⨯":"\u2A2F","𝒞":"\u{1D49E}","⋓":"\u22D3","≍":"\u224D","ⅅ":"\u2145","⤑":"\u2911","Ђ":"\u0402","Ѕ":"\u0405","Џ":"\u040F","‡":"\u2021","↡":"\u21A1","⫤":"\u2AE4","Ď":"\u010E","Д":"\u0414","∇":"\u2207","Δ":"\u0394","𝔇":"\u{1D507}","´":"\xB4","˙":"\u02D9","˝":"\u02DD","`":"`","˜":"\u02DC","⋄":"\u22C4","ⅆ":"\u2146","𝔻":"\u{1D53B}","¨":"\xA8","⃜":"\u20DC","≐":"\u2250","∯":"\u222F","¨":"\xA8","⇓":"\u21D3","⇐":"\u21D0","⇔":"\u21D4","⫤":"\u2AE4","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","⇒":"\u21D2","⊨":"\u22A8","⇑":"\u21D1","⇕":"\u21D5","∥":"\u2225","↓":"\u2193","⤓":"\u2913","⇵":"\u21F5","̑":"\u0311","⥐":"\u2950","⥞":"\u295E","↽":"\u21BD","⥖":"\u2956","⥟":"\u295F","⇁":"\u21C1","⥗":"\u2957","⊤":"\u22A4","↧":"\u21A7","⇓":"\u21D3","𝒟":"\u{1D49F}","Đ":"\u0110","Ŋ":"\u014A","Ð":"\xD0","Ð":"\xD0","É":"\xC9","É":"\xC9","Ě":"\u011A","Ê":"\xCA","Ê":"\xCA","Э":"\u042D","Ė":"\u0116","𝔈":"\u{1D508}","È":"\xC8","È":"\xC8","∈":"\u2208","Ē":"\u0112","◻":"\u25FB","▫":"\u25AB","Ę":"\u0118","𝔼":"\u{1D53C}","Ε":"\u0395","⩵":"\u2A75","≂":"\u2242","⇌":"\u21CC","ℰ":"\u2130","⩳":"\u2A73","Η":"\u0397","Ë":"\xCB","Ë":"\xCB","∃":"\u2203","ⅇ":"\u2147","Ф":"\u0424","𝔉":"\u{1D509}","◼":"\u25FC","▪":"\u25AA","𝔽":"\u{1D53D}","∀":"\u2200","ℱ":"\u2131","ℱ":"\u2131","Ѓ":"\u0403",">":">",">":">","Γ":"\u0393","Ϝ":"\u03DC","Ğ":"\u011E","Ģ":"\u0122","Ĝ":"\u011C","Г":"\u0413","Ġ":"\u0120","𝔊":"\u{1D50A}","⋙":"\u22D9","𝔾":"\u{1D53E}","≥":"\u2265","⋛":"\u22DB","≧":"\u2267","⪢":"\u2AA2","≷":"\u2277","⩾":"\u2A7E","≳":"\u2273","𝒢":"\u{1D4A2}","≫":"\u226B","Ъ":"\u042A","ˇ":"\u02C7","^":"^","Ĥ":"\u0124","ℌ":"\u210C","ℋ":"\u210B","ℍ":"\u210D","─":"\u2500","ℋ":"\u210B","Ħ":"\u0126","≎":"\u224E","≏":"\u224F","Е":"\u0415","IJ":"\u0132","Ё":"\u0401","Í":"\xCD","Í":"\xCD","Î":"\xCE","Î":"\xCE","И":"\u0418","İ":"\u0130","ℑ":"\u2111","Ì":"\xCC","Ì":"\xCC","ℑ":"\u2111","Ī":"\u012A","ⅈ":"\u2148","⇒":"\u21D2","∬":"\u222C","∫":"\u222B","⋂":"\u22C2","⁣":"\u2063","⁢":"\u2062","Į":"\u012E","𝕀":"\u{1D540}","Ι":"\u0399","ℐ":"\u2110","Ĩ":"\u0128","І":"\u0406","Ï":"\xCF","Ï":"\xCF","Ĵ":"\u0134","Й":"\u0419","𝔍":"\u{1D50D}","𝕁":"\u{1D541}","𝒥":"\u{1D4A5}","Ј":"\u0408","Є":"\u0404","Х":"\u0425","Ќ":"\u040C","Κ":"\u039A","Ķ":"\u0136","К":"\u041A","𝔎":"\u{1D50E}","𝕂":"\u{1D542}","𝒦":"\u{1D4A6}","Љ":"\u0409","<":"<","<":"<","Ĺ":"\u0139","Λ":"\u039B","⟪":"\u27EA","ℒ":"\u2112","↞":"\u219E","Ľ":"\u013D","Ļ":"\u013B","Л":"\u041B","⟨":"\u27E8","←":"\u2190","⇤":"\u21E4","⇆":"\u21C6","⌈":"\u2308","⟦":"\u27E6","⥡":"\u2961","⇃":"\u21C3","⥙":"\u2959","⌊":"\u230A","↔":"\u2194","⥎":"\u294E","⊣":"\u22A3","↤":"\u21A4","⥚":"\u295A","⊲":"\u22B2","⧏":"\u29CF","⊴":"\u22B4","⥑":"\u2951","⥠":"\u2960","↿":"\u21BF","⥘":"\u2958","↼":"\u21BC","⥒":"\u2952","⇐":"\u21D0","⇔":"\u21D4","⋚":"\u22DA","≦":"\u2266","≶":"\u2276","⪡":"\u2AA1","⩽":"\u2A7D","≲":"\u2272","𝔏":"\u{1D50F}","⋘":"\u22D8","⇚":"\u21DA","Ŀ":"\u013F","⟵":"\u27F5","⟷":"\u27F7","⟶":"\u27F6","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","𝕃":"\u{1D543}","↙":"\u2199","↘":"\u2198","ℒ":"\u2112","↰":"\u21B0","Ł":"\u0141","≪":"\u226A","⤅":"\u2905","М":"\u041C"," ":"\u205F","ℳ":"\u2133","𝔐":"\u{1D510}","∓":"\u2213","𝕄":"\u{1D544}","ℳ":"\u2133","Μ":"\u039C","Њ":"\u040A","Ń":"\u0143","Ň":"\u0147","Ņ":"\u0145","Н":"\u041D","​":"\u200B","​":"\u200B","​":"\u200B","​":"\u200B","≫":"\u226B","≪":"\u226A"," ":` +`,"𝔑":"\u{1D511}","⁠":"\u2060"," ":"\xA0","ℕ":"\u2115","⫬":"\u2AEC","≢":"\u2262","≭":"\u226D","∦":"\u2226","∉":"\u2209","≠":"\u2260","≂̸":"\u2242\u0338","∄":"\u2204","≯":"\u226F","≱":"\u2271","≧̸":"\u2267\u0338","≫̸":"\u226B\u0338","≹":"\u2279","⩾̸":"\u2A7E\u0338","≵":"\u2275","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⋪":"\u22EA","⧏̸":"\u29CF\u0338","⋬":"\u22EC","≮":"\u226E","≰":"\u2270","≸":"\u2278","≪̸":"\u226A\u0338","⩽̸":"\u2A7D\u0338","≴":"\u2274","⪢̸":"\u2AA2\u0338","⪡̸":"\u2AA1\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⋠":"\u22E0","∌":"\u220C","⋫":"\u22EB","⧐̸":"\u29D0\u0338","⋭":"\u22ED","⊏̸":"\u228F\u0338","⋢":"\u22E2","⊐̸":"\u2290\u0338","⋣":"\u22E3","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⋡":"\u22E1","≿̸":"\u227F\u0338","⊃⃒":"\u2283\u20D2","⊉":"\u2289","≁":"\u2241","≄":"\u2244","≇":"\u2247","≉":"\u2249","∤":"\u2224","𝒩":"\u{1D4A9}","Ñ":"\xD1","Ñ":"\xD1","Ν":"\u039D","Œ":"\u0152","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","О":"\u041E","Ő":"\u0150","𝔒":"\u{1D512}","Ò":"\xD2","Ò":"\xD2","Ō":"\u014C","Ω":"\u03A9","Ο":"\u039F","𝕆":"\u{1D546}","“":"\u201C","‘":"\u2018","⩔":"\u2A54","𝒪":"\u{1D4AA}","Ø":"\xD8","Ø":"\xD8","Õ":"\xD5","Õ":"\xD5","⨷":"\u2A37","Ö":"\xD6","Ö":"\xD6","‾":"\u203E","⏞":"\u23DE","⎴":"\u23B4","⏜":"\u23DC","∂":"\u2202","П":"\u041F","𝔓":"\u{1D513}","Φ":"\u03A6","Π":"\u03A0","±":"\xB1","ℌ":"\u210C","ℙ":"\u2119","⪻":"\u2ABB","≺":"\u227A","⪯":"\u2AAF","≼":"\u227C","≾":"\u227E","″":"\u2033","∏":"\u220F","∷":"\u2237","∝":"\u221D","𝒫":"\u{1D4AB}","Ψ":"\u03A8",""":'"',""":'"',"𝔔":"\u{1D514}","ℚ":"\u211A","𝒬":"\u{1D4AC}","⤐":"\u2910","®":"\xAE","®":"\xAE","Ŕ":"\u0154","⟫":"\u27EB","↠":"\u21A0","⤖":"\u2916","Ř":"\u0158","Ŗ":"\u0156","Р":"\u0420","ℜ":"\u211C","∋":"\u220B","⇋":"\u21CB","⥯":"\u296F","ℜ":"\u211C","Ρ":"\u03A1","⟩":"\u27E9","→":"\u2192","⇥":"\u21E5","⇄":"\u21C4","⌉":"\u2309","⟧":"\u27E7","⥝":"\u295D","⇂":"\u21C2","⥕":"\u2955","⌋":"\u230B","⊢":"\u22A2","↦":"\u21A6","⥛":"\u295B","⊳":"\u22B3","⧐":"\u29D0","⊵":"\u22B5","⥏":"\u294F","⥜":"\u295C","↾":"\u21BE","⥔":"\u2954","⇀":"\u21C0","⥓":"\u2953","⇒":"\u21D2","ℝ":"\u211D","⥰":"\u2970","⇛":"\u21DB","ℛ":"\u211B","↱":"\u21B1","⧴":"\u29F4","Щ":"\u0429","Ш":"\u0428","Ь":"\u042C","Ś":"\u015A","⪼":"\u2ABC","Š":"\u0160","Ş":"\u015E","Ŝ":"\u015C","С":"\u0421","𝔖":"\u{1D516}","↓":"\u2193","←":"\u2190","→":"\u2192","↑":"\u2191","Σ":"\u03A3","∘":"\u2218","𝕊":"\u{1D54A}","√":"\u221A","□":"\u25A1","⊓":"\u2293","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊔":"\u2294","𝒮":"\u{1D4AE}","⋆":"\u22C6","⋐":"\u22D0","⋐":"\u22D0","⊆":"\u2286","≻":"\u227B","⪰":"\u2AB0","≽":"\u227D","≿":"\u227F","∋":"\u220B","∑":"\u2211","⋑":"\u22D1","⊃":"\u2283","⊇":"\u2287","⋑":"\u22D1","Þ":"\xDE","Þ":"\xDE","™":"\u2122","Ћ":"\u040B","Ц":"\u0426"," ":" ","Τ":"\u03A4","Ť":"\u0164","Ţ":"\u0162","Т":"\u0422","𝔗":"\u{1D517}","∴":"\u2234","Θ":"\u0398","  ":"\u205F\u200A"," ":"\u2009","∼":"\u223C","≃":"\u2243","≅":"\u2245","≈":"\u2248","𝕋":"\u{1D54B}","⃛":"\u20DB","𝒯":"\u{1D4AF}","Ŧ":"\u0166","Ú":"\xDA","Ú":"\xDA","↟":"\u219F","⥉":"\u2949","Ў":"\u040E","Ŭ":"\u016C","Û":"\xDB","Û":"\xDB","У":"\u0423","Ű":"\u0170","𝔘":"\u{1D518}","Ù":"\xD9","Ù":"\xD9","Ū":"\u016A","_":"_","⏟":"\u23DF","⎵":"\u23B5","⏝":"\u23DD","⋃":"\u22C3","⊎":"\u228E","Ų":"\u0172","𝕌":"\u{1D54C}","↑":"\u2191","⤒":"\u2912","⇅":"\u21C5","↕":"\u2195","⥮":"\u296E","⊥":"\u22A5","↥":"\u21A5","⇑":"\u21D1","⇕":"\u21D5","↖":"\u2196","↗":"\u2197","ϒ":"\u03D2","Υ":"\u03A5","Ů":"\u016E","𝒰":"\u{1D4B0}","Ũ":"\u0168","Ü":"\xDC","Ü":"\xDC","⊫":"\u22AB","⫫":"\u2AEB","В":"\u0412","⊩":"\u22A9","⫦":"\u2AE6","⋁":"\u22C1","‖":"\u2016","‖":"\u2016","∣":"\u2223","|":"|","❘":"\u2758","≀":"\u2240"," ":"\u200A","𝔙":"\u{1D519}","𝕍":"\u{1D54D}","𝒱":"\u{1D4B1}","⊪":"\u22AA","Ŵ":"\u0174","⋀":"\u22C0","𝔚":"\u{1D51A}","𝕎":"\u{1D54E}","𝒲":"\u{1D4B2}","𝔛":"\u{1D51B}","Ξ":"\u039E","𝕏":"\u{1D54F}","𝒳":"\u{1D4B3}","Я":"\u042F","Ї":"\u0407","Ю":"\u042E","Ý":"\xDD","Ý":"\xDD","Ŷ":"\u0176","Ы":"\u042B","𝔜":"\u{1D51C}","𝕐":"\u{1D550}","𝒴":"\u{1D4B4}","Ÿ":"\u0178","Ж":"\u0416","Ź":"\u0179","Ž":"\u017D","З":"\u0417","Ż":"\u017B","​":"\u200B","Ζ":"\u0396","ℨ":"\u2128","ℤ":"\u2124","𝒵":"\u{1D4B5}","á":"\xE1","á":"\xE1","ă":"\u0103","∾":"\u223E","∾̳":"\u223E\u0333","∿":"\u223F","â":"\xE2","â":"\xE2","´":"\xB4","´":"\xB4","а":"\u0430","æ":"\xE6","æ":"\xE6","⁡":"\u2061","𝔞":"\u{1D51E}","à":"\xE0","à":"\xE0","ℵ":"\u2135","ℵ":"\u2135","α":"\u03B1","ā":"\u0101","⨿":"\u2A3F","&":"&","&":"&","∧":"\u2227","⩕":"\u2A55","⩜":"\u2A5C","⩘":"\u2A58","⩚":"\u2A5A","∠":"\u2220","⦤":"\u29A4","∠":"\u2220","∡":"\u2221","⦨":"\u29A8","⦩":"\u29A9","⦪":"\u29AA","⦫":"\u29AB","⦬":"\u29AC","⦭":"\u29AD","⦮":"\u29AE","⦯":"\u29AF","∟":"\u221F","⊾":"\u22BE","⦝":"\u299D","∢":"\u2222","Å":"\xC5","⍼":"\u237C","ą":"\u0105","𝕒":"\u{1D552}","≈":"\u2248","⩰":"\u2A70","⩯":"\u2A6F","≊":"\u224A","≋":"\u224B","'":"'","≈":"\u2248","≊":"\u224A","å":"\xE5","å":"\xE5","𝒶":"\u{1D4B6}","*":"*","≈":"\u2248","≍":"\u224D","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","∳":"\u2233","⨑":"\u2A11","⫭":"\u2AED","≌":"\u224C","϶":"\u03F6","‵":"\u2035","∽":"\u223D","⋍":"\u22CD","⊽":"\u22BD","⌅":"\u2305","⌅":"\u2305","⎵":"\u23B5","⎶":"\u23B6","≌":"\u224C","б":"\u0431","„":"\u201E","∵":"\u2235","∵":"\u2235","⦰":"\u29B0","϶":"\u03F6","ℬ":"\u212C","β":"\u03B2","ℶ":"\u2136","≬":"\u226C","𝔟":"\u{1D51F}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","⨀":"\u2A00","⨁":"\u2A01","⨂":"\u2A02","⨆":"\u2A06","★":"\u2605","▽":"\u25BD","△":"\u25B3","⨄":"\u2A04","⋁":"\u22C1","⋀":"\u22C0","⤍":"\u290D","⧫":"\u29EB","▪":"\u25AA","▴":"\u25B4","▾":"\u25BE","◂":"\u25C2","▸":"\u25B8","␣":"\u2423","▒":"\u2592","░":"\u2591","▓":"\u2593","█":"\u2588","=⃥":"=\u20E5","≡⃥":"\u2261\u20E5","⌐":"\u2310","𝕓":"\u{1D553}","⊥":"\u22A5","⊥":"\u22A5","⋈":"\u22C8","╗":"\u2557","╔":"\u2554","╖":"\u2556","╓":"\u2553","═":"\u2550","╦":"\u2566","╩":"\u2569","╤":"\u2564","╧":"\u2567","╝":"\u255D","╚":"\u255A","╜":"\u255C","╙":"\u2559","║":"\u2551","╬":"\u256C","╣":"\u2563","╠":"\u2560","╫":"\u256B","╢":"\u2562","╟":"\u255F","⧉":"\u29C9","╕":"\u2555","╒":"\u2552","┐":"\u2510","┌":"\u250C","─":"\u2500","╥":"\u2565","╨":"\u2568","┬":"\u252C","┴":"\u2534","⊟":"\u229F","⊞":"\u229E","⊠":"\u22A0","╛":"\u255B","╘":"\u2558","┘":"\u2518","└":"\u2514","│":"\u2502","╪":"\u256A","╡":"\u2561","╞":"\u255E","┼":"\u253C","┤":"\u2524","├":"\u251C","‵":"\u2035","˘":"\u02D8","¦":"\xA6","¦":"\xA6","𝒷":"\u{1D4B7}","⁏":"\u204F","∽":"\u223D","⋍":"\u22CD","\":"\\","⧅":"\u29C5","⟈":"\u27C8","•":"\u2022","•":"\u2022","≎":"\u224E","⪮":"\u2AAE","≏":"\u224F","≏":"\u224F","ć":"\u0107","∩":"\u2229","⩄":"\u2A44","⩉":"\u2A49","⩋":"\u2A4B","⩇":"\u2A47","⩀":"\u2A40","∩︀":"\u2229\uFE00","⁁":"\u2041","ˇ":"\u02C7","⩍":"\u2A4D","č":"\u010D","ç":"\xE7","ç":"\xE7","ĉ":"\u0109","⩌":"\u2A4C","⩐":"\u2A50","ċ":"\u010B","¸":"\xB8","¸":"\xB8","⦲":"\u29B2","¢":"\xA2","¢":"\xA2","·":"\xB7","𝔠":"\u{1D520}","ч":"\u0447","✓":"\u2713","✓":"\u2713","χ":"\u03C7","○":"\u25CB","⧃":"\u29C3","ˆ":"\u02C6","≗":"\u2257","↺":"\u21BA","↻":"\u21BB","®":"\xAE","Ⓢ":"\u24C8","⊛":"\u229B","⊚":"\u229A","⊝":"\u229D","≗":"\u2257","⨐":"\u2A10","⫯":"\u2AEF","⧂":"\u29C2","♣":"\u2663","♣":"\u2663",":":":","≔":"\u2254","≔":"\u2254",",":",","@":"@","∁":"\u2201","∘":"\u2218","∁":"\u2201","ℂ":"\u2102","≅":"\u2245","⩭":"\u2A6D","∮":"\u222E","𝕔":"\u{1D554}","∐":"\u2210","©":"\xA9","©":"\xA9","℗":"\u2117","↵":"\u21B5","✗":"\u2717","𝒸":"\u{1D4B8}","⫏":"\u2ACF","⫑":"\u2AD1","⫐":"\u2AD0","⫒":"\u2AD2","⋯":"\u22EF","⤸":"\u2938","⤵":"\u2935","⋞":"\u22DE","⋟":"\u22DF","↶":"\u21B6","⤽":"\u293D","∪":"\u222A","⩈":"\u2A48","⩆":"\u2A46","⩊":"\u2A4A","⊍":"\u228D","⩅":"\u2A45","∪︀":"\u222A\uFE00","↷":"\u21B7","⤼":"\u293C","⋞":"\u22DE","⋟":"\u22DF","⋎":"\u22CE","⋏":"\u22CF","¤":"\xA4","¤":"\xA4","↶":"\u21B6","↷":"\u21B7","⋎":"\u22CE","⋏":"\u22CF","∲":"\u2232","∱":"\u2231","⌭":"\u232D","⇓":"\u21D3","⥥":"\u2965","†":"\u2020","ℸ":"\u2138","↓":"\u2193","‐":"\u2010","⊣":"\u22A3","⤏":"\u290F","˝":"\u02DD","ď":"\u010F","д":"\u0434","ⅆ":"\u2146","‡":"\u2021","⇊":"\u21CA","⩷":"\u2A77","°":"\xB0","°":"\xB0","δ":"\u03B4","⦱":"\u29B1","⥿":"\u297F","𝔡":"\u{1D521}","⇃":"\u21C3","⇂":"\u21C2","⋄":"\u22C4","⋄":"\u22C4","♦":"\u2666","♦":"\u2666","¨":"\xA8","ϝ":"\u03DD","⋲":"\u22F2","÷":"\xF7","÷":"\xF7","÷":"\xF7","⋇":"\u22C7","⋇":"\u22C7","ђ":"\u0452","⌞":"\u231E","⌍":"\u230D","$":"$","𝕕":"\u{1D555}","˙":"\u02D9","≐":"\u2250","≑":"\u2251","∸":"\u2238","∔":"\u2214","⊡":"\u22A1","⌆":"\u2306","↓":"\u2193","⇊":"\u21CA","⇃":"\u21C3","⇂":"\u21C2","⤐":"\u2910","⌟":"\u231F","⌌":"\u230C","𝒹":"\u{1D4B9}","ѕ":"\u0455","⧶":"\u29F6","đ":"\u0111","⋱":"\u22F1","▿":"\u25BF","▾":"\u25BE","⇵":"\u21F5","⥯":"\u296F","⦦":"\u29A6","џ":"\u045F","⟿":"\u27FF","⩷":"\u2A77","≑":"\u2251","é":"\xE9","é":"\xE9","⩮":"\u2A6E","ě":"\u011B","≖":"\u2256","ê":"\xEA","ê":"\xEA","≕":"\u2255","э":"\u044D","ė":"\u0117","ⅇ":"\u2147","≒":"\u2252","𝔢":"\u{1D522}","⪚":"\u2A9A","è":"\xE8","è":"\xE8","⪖":"\u2A96","⪘":"\u2A98","⪙":"\u2A99","⏧":"\u23E7","ℓ":"\u2113","⪕":"\u2A95","⪗":"\u2A97","ē":"\u0113","∅":"\u2205","∅":"\u2205","∅":"\u2205"," ":"\u2004"," ":"\u2005"," ":"\u2003","ŋ":"\u014B"," ":"\u2002","ę":"\u0119","𝕖":"\u{1D556}","⋕":"\u22D5","⧣":"\u29E3","⩱":"\u2A71","ε":"\u03B5","ε":"\u03B5","ϵ":"\u03F5","≖":"\u2256","≕":"\u2255","≂":"\u2242","⪖":"\u2A96","⪕":"\u2A95","=":"=","≟":"\u225F","≡":"\u2261","⩸":"\u2A78","⧥":"\u29E5","≓":"\u2253","⥱":"\u2971","ℯ":"\u212F","≐":"\u2250","≂":"\u2242","η":"\u03B7","ð":"\xF0","ð":"\xF0","ë":"\xEB","ë":"\xEB","€":"\u20AC","!":"!","∃":"\u2203","ℰ":"\u2130","ⅇ":"\u2147","≒":"\u2252","ф":"\u0444","♀":"\u2640","ffi":"\uFB03","ff":"\uFB00","ffl":"\uFB04","𝔣":"\u{1D523}","fi":"\uFB01","fj":"fj","♭":"\u266D","fl":"\uFB02","▱":"\u25B1","ƒ":"\u0192","𝕗":"\u{1D557}","∀":"\u2200","⋔":"\u22D4","⫙":"\u2AD9","⨍":"\u2A0D","½":"\xBD","½":"\xBD","⅓":"\u2153","¼":"\xBC","¼":"\xBC","⅕":"\u2155","⅙":"\u2159","⅛":"\u215B","⅔":"\u2154","⅖":"\u2156","¾":"\xBE","¾":"\xBE","⅗":"\u2157","⅜":"\u215C","⅘":"\u2158","⅚":"\u215A","⅝":"\u215D","⅞":"\u215E","⁄":"\u2044","⌢":"\u2322","𝒻":"\u{1D4BB}","≧":"\u2267","⪌":"\u2A8C","ǵ":"\u01F5","γ":"\u03B3","ϝ":"\u03DD","⪆":"\u2A86","ğ":"\u011F","ĝ":"\u011D","г":"\u0433","ġ":"\u0121","≥":"\u2265","⋛":"\u22DB","≥":"\u2265","≧":"\u2267","⩾":"\u2A7E","⩾":"\u2A7E","⪩":"\u2AA9","⪀":"\u2A80","⪂":"\u2A82","⪄":"\u2A84","⋛︀":"\u22DB\uFE00","⪔":"\u2A94","𝔤":"\u{1D524}","≫":"\u226B","⋙":"\u22D9","ℷ":"\u2137","ѓ":"\u0453","≷":"\u2277","⪒":"\u2A92","⪥":"\u2AA5","⪤":"\u2AA4","≩":"\u2269","⪊":"\u2A8A","⪊":"\u2A8A","⪈":"\u2A88","⪈":"\u2A88","≩":"\u2269","⋧":"\u22E7","𝕘":"\u{1D558}","`":"`","ℊ":"\u210A","≳":"\u2273","⪎":"\u2A8E","⪐":"\u2A90",">":">",">":">","⪧":"\u2AA7","⩺":"\u2A7A","⋗":"\u22D7","⦕":"\u2995","⩼":"\u2A7C","⪆":"\u2A86","⥸":"\u2978","⋗":"\u22D7","⋛":"\u22DB","⪌":"\u2A8C","≷":"\u2277","≳":"\u2273","≩︀":"\u2269\uFE00","≩︀":"\u2269\uFE00","⇔":"\u21D4"," ":"\u200A","½":"\xBD","ℋ":"\u210B","ъ":"\u044A","↔":"\u2194","⥈":"\u2948","↭":"\u21AD","ℏ":"\u210F","ĥ":"\u0125","♥":"\u2665","♥":"\u2665","…":"\u2026","⊹":"\u22B9","𝔥":"\u{1D525}","⤥":"\u2925","⤦":"\u2926","⇿":"\u21FF","∻":"\u223B","↩":"\u21A9","↪":"\u21AA","𝕙":"\u{1D559}","―":"\u2015","𝒽":"\u{1D4BD}","ℏ":"\u210F","ħ":"\u0127","⁃":"\u2043","‐":"\u2010","í":"\xED","í":"\xED","⁣":"\u2063","î":"\xEE","î":"\xEE","и":"\u0438","е":"\u0435","¡":"\xA1","¡":"\xA1","⇔":"\u21D4","𝔦":"\u{1D526}","ì":"\xEC","ì":"\xEC","ⅈ":"\u2148","⨌":"\u2A0C","∭":"\u222D","⧜":"\u29DC","℩":"\u2129","ij":"\u0133","ī":"\u012B","ℑ":"\u2111","ℐ":"\u2110","ℑ":"\u2111","ı":"\u0131","⊷":"\u22B7","Ƶ":"\u01B5","∈":"\u2208","℅":"\u2105","∞":"\u221E","⧝":"\u29DD","ı":"\u0131","∫":"\u222B","⊺":"\u22BA","ℤ":"\u2124","⊺":"\u22BA","⨗":"\u2A17","⨼":"\u2A3C","ё":"\u0451","į":"\u012F","𝕚":"\u{1D55A}","ι":"\u03B9","⨼":"\u2A3C","¿":"\xBF","¿":"\xBF","𝒾":"\u{1D4BE}","∈":"\u2208","⋹":"\u22F9","⋵":"\u22F5","⋴":"\u22F4","⋳":"\u22F3","∈":"\u2208","⁢":"\u2062","ĩ":"\u0129","і":"\u0456","ï":"\xEF","ï":"\xEF","ĵ":"\u0135","й":"\u0439","𝔧":"\u{1D527}","ȷ":"\u0237","𝕛":"\u{1D55B}","𝒿":"\u{1D4BF}","ј":"\u0458","є":"\u0454","κ":"\u03BA","ϰ":"\u03F0","ķ":"\u0137","к":"\u043A","𝔨":"\u{1D528}","ĸ":"\u0138","х":"\u0445","ќ":"\u045C","𝕜":"\u{1D55C}","𝓀":"\u{1D4C0}","⇚":"\u21DA","⇐":"\u21D0","⤛":"\u291B","⤎":"\u290E","≦":"\u2266","⪋":"\u2A8B","⥢":"\u2962","ĺ":"\u013A","⦴":"\u29B4","ℒ":"\u2112","λ":"\u03BB","⟨":"\u27E8","⦑":"\u2991","⟨":"\u27E8","⪅":"\u2A85","«":"\xAB","«":"\xAB","←":"\u2190","⇤":"\u21E4","⤟":"\u291F","⤝":"\u291D","↩":"\u21A9","↫":"\u21AB","⤹":"\u2939","⥳":"\u2973","↢":"\u21A2","⪫":"\u2AAB","⤙":"\u2919","⪭":"\u2AAD","⪭︀":"\u2AAD\uFE00","⤌":"\u290C","❲":"\u2772","{":"{","[":"[","⦋":"\u298B","⦏":"\u298F","⦍":"\u298D","ľ":"\u013E","ļ":"\u013C","⌈":"\u2308","{":"{","л":"\u043B","⤶":"\u2936","“":"\u201C","„":"\u201E","⥧":"\u2967","⥋":"\u294B","↲":"\u21B2","≤":"\u2264","←":"\u2190","↢":"\u21A2","↽":"\u21BD","↼":"\u21BC","⇇":"\u21C7","↔":"\u2194","⇆":"\u21C6","⇋":"\u21CB","↭":"\u21AD","⋋":"\u22CB","⋚":"\u22DA","≤":"\u2264","≦":"\u2266","⩽":"\u2A7D","⩽":"\u2A7D","⪨":"\u2AA8","⩿":"\u2A7F","⪁":"\u2A81","⪃":"\u2A83","⋚︀":"\u22DA\uFE00","⪓":"\u2A93","⪅":"\u2A85","⋖":"\u22D6","⋚":"\u22DA","⪋":"\u2A8B","≶":"\u2276","≲":"\u2272","⥼":"\u297C","⌊":"\u230A","𝔩":"\u{1D529}","≶":"\u2276","⪑":"\u2A91","↽":"\u21BD","↼":"\u21BC","⥪":"\u296A","▄":"\u2584","љ":"\u0459","≪":"\u226A","⇇":"\u21C7","⌞":"\u231E","⥫":"\u296B","◺":"\u25FA","ŀ":"\u0140","⎰":"\u23B0","⎰":"\u23B0","≨":"\u2268","⪉":"\u2A89","⪉":"\u2A89","⪇":"\u2A87","⪇":"\u2A87","≨":"\u2268","⋦":"\u22E6","⟬":"\u27EC","⇽":"\u21FD","⟦":"\u27E6","⟵":"\u27F5","⟷":"\u27F7","⟼":"\u27FC","⟶":"\u27F6","↫":"\u21AB","↬":"\u21AC","⦅":"\u2985","𝕝":"\u{1D55D}","⨭":"\u2A2D","⨴":"\u2A34","∗":"\u2217","_":"_","◊":"\u25CA","◊":"\u25CA","⧫":"\u29EB","(":"(","⦓":"\u2993","⇆":"\u21C6","⌟":"\u231F","⇋":"\u21CB","⥭":"\u296D","‎":"\u200E","⊿":"\u22BF","‹":"\u2039","𝓁":"\u{1D4C1}","↰":"\u21B0","≲":"\u2272","⪍":"\u2A8D","⪏":"\u2A8F","[":"[","‘":"\u2018","‚":"\u201A","ł":"\u0142","<":"<","<":"<","⪦":"\u2AA6","⩹":"\u2A79","⋖":"\u22D6","⋋":"\u22CB","⋉":"\u22C9","⥶":"\u2976","⩻":"\u2A7B","⦖":"\u2996","◃":"\u25C3","⊴":"\u22B4","◂":"\u25C2","⥊":"\u294A","⥦":"\u2966","≨︀":"\u2268\uFE00","≨︀":"\u2268\uFE00","∺":"\u223A","¯":"\xAF","¯":"\xAF","♂":"\u2642","✠":"\u2720","✠":"\u2720","↦":"\u21A6","↦":"\u21A6","↧":"\u21A7","↤":"\u21A4","↥":"\u21A5","▮":"\u25AE","⨩":"\u2A29","м":"\u043C","—":"\u2014","∡":"\u2221","𝔪":"\u{1D52A}","℧":"\u2127","µ":"\xB5","µ":"\xB5","∣":"\u2223","*":"*","⫰":"\u2AF0","·":"\xB7","·":"\xB7","−":"\u2212","⊟":"\u229F","∸":"\u2238","⨪":"\u2A2A","⫛":"\u2ADB","…":"\u2026","∓":"\u2213","⊧":"\u22A7","𝕞":"\u{1D55E}","∓":"\u2213","𝓂":"\u{1D4C2}","∾":"\u223E","μ":"\u03BC","⊸":"\u22B8","⊸":"\u22B8","⋙̸":"\u22D9\u0338","≫⃒":"\u226B\u20D2","≫̸":"\u226B\u0338","⇍":"\u21CD","⇎":"\u21CE","⋘̸":"\u22D8\u0338","≪⃒":"\u226A\u20D2","≪̸":"\u226A\u0338","⇏":"\u21CF","⊯":"\u22AF","⊮":"\u22AE","∇":"\u2207","ń":"\u0144","∠⃒":"\u2220\u20D2","≉":"\u2249","⩰̸":"\u2A70\u0338","≋̸":"\u224B\u0338","ʼn":"\u0149","≉":"\u2249","♮":"\u266E","♮":"\u266E","ℕ":"\u2115"," ":"\xA0"," ":"\xA0","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⩃":"\u2A43","ň":"\u0148","ņ":"\u0146","≇":"\u2247","⩭̸":"\u2A6D\u0338","⩂":"\u2A42","н":"\u043D","–":"\u2013","≠":"\u2260","⇗":"\u21D7","⤤":"\u2924","↗":"\u2197","↗":"\u2197","≐̸":"\u2250\u0338","≢":"\u2262","⤨":"\u2928","≂̸":"\u2242\u0338","∄":"\u2204","∄":"\u2204","𝔫":"\u{1D52B}","≧̸":"\u2267\u0338","≱":"\u2271","≱":"\u2271","≧̸":"\u2267\u0338","⩾̸":"\u2A7E\u0338","⩾̸":"\u2A7E\u0338","≵":"\u2275","≯":"\u226F","≯":"\u226F","⇎":"\u21CE","↮":"\u21AE","⫲":"\u2AF2","∋":"\u220B","⋼":"\u22FC","⋺":"\u22FA","∋":"\u220B","њ":"\u045A","⇍":"\u21CD","≦̸":"\u2266\u0338","↚":"\u219A","‥":"\u2025","≰":"\u2270","↚":"\u219A","↮":"\u21AE","≰":"\u2270","≦̸":"\u2266\u0338","⩽̸":"\u2A7D\u0338","⩽̸":"\u2A7D\u0338","≮":"\u226E","≴":"\u2274","≮":"\u226E","⋪":"\u22EA","⋬":"\u22EC","∤":"\u2224","𝕟":"\u{1D55F}","¬":"\xAC","¬":"\xAC","∉":"\u2209","⋹̸":"\u22F9\u0338","⋵̸":"\u22F5\u0338","∉":"\u2209","⋷":"\u22F7","⋶":"\u22F6","∌":"\u220C","∌":"\u220C","⋾":"\u22FE","⋽":"\u22FD","∦":"\u2226","∦":"\u2226","⫽⃥":"\u2AFD\u20E5","∂̸":"\u2202\u0338","⨔":"\u2A14","⊀":"\u2280","⋠":"\u22E0","⪯̸":"\u2AAF\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⇏":"\u21CF","↛":"\u219B","⤳̸":"\u2933\u0338","↝̸":"\u219D\u0338","↛":"\u219B","⋫":"\u22EB","⋭":"\u22ED","⊁":"\u2281","⋡":"\u22E1","⪰̸":"\u2AB0\u0338","𝓃":"\u{1D4C3}","∤":"\u2224","∦":"\u2226","≁":"\u2241","≄":"\u2244","≄":"\u2244","∤":"\u2224","∦":"\u2226","⋢":"\u22E2","⋣":"\u22E3","⊄":"\u2284","⫅̸":"\u2AC5\u0338","⊈":"\u2288","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⫅̸":"\u2AC5\u0338","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⊅":"\u2285","⫆̸":"\u2AC6\u0338","⊉":"\u2289","⊃⃒":"\u2283\u20D2","⊉":"\u2289","⫆̸":"\u2AC6\u0338","≹":"\u2279","ñ":"\xF1","ñ":"\xF1","≸":"\u2278","⋪":"\u22EA","⋬":"\u22EC","⋫":"\u22EB","⋭":"\u22ED","ν":"\u03BD","#":"#","№":"\u2116"," ":"\u2007","⊭":"\u22AD","⤄":"\u2904","≍⃒":"\u224D\u20D2","⊬":"\u22AC","≥⃒":"\u2265\u20D2",">⃒":">\u20D2","⧞":"\u29DE","⤂":"\u2902","≤⃒":"\u2264\u20D2","<⃒":"<\u20D2","⊴⃒":"\u22B4\u20D2","⤃":"\u2903","⊵⃒":"\u22B5\u20D2","∼⃒":"\u223C\u20D2","⇖":"\u21D6","⤣":"\u2923","↖":"\u2196","↖":"\u2196","⤧":"\u2927","Ⓢ":"\u24C8","ó":"\xF3","ó":"\xF3","⊛":"\u229B","⊚":"\u229A","ô":"\xF4","ô":"\xF4","о":"\u043E","⊝":"\u229D","ő":"\u0151","⨸":"\u2A38","⊙":"\u2299","⦼":"\u29BC","œ":"\u0153","⦿":"\u29BF","𝔬":"\u{1D52C}","˛":"\u02DB","ò":"\xF2","ò":"\xF2","⧁":"\u29C1","⦵":"\u29B5","Ω":"\u03A9","∮":"\u222E","↺":"\u21BA","⦾":"\u29BE","⦻":"\u29BB","‾":"\u203E","⧀":"\u29C0","ō":"\u014D","ω":"\u03C9","ο":"\u03BF","⦶":"\u29B6","⊖":"\u2296","𝕠":"\u{1D560}","⦷":"\u29B7","⦹":"\u29B9","⊕":"\u2295","∨":"\u2228","↻":"\u21BB","⩝":"\u2A5D","ℴ":"\u2134","ℴ":"\u2134","ª":"\xAA","ª":"\xAA","º":"\xBA","º":"\xBA","⊶":"\u22B6","⩖":"\u2A56","⩗":"\u2A57","⩛":"\u2A5B","ℴ":"\u2134","ø":"\xF8","ø":"\xF8","⊘":"\u2298","õ":"\xF5","õ":"\xF5","⊗":"\u2297","⨶":"\u2A36","ö":"\xF6","ö":"\xF6","⌽":"\u233D","∥":"\u2225","¶":"\xB6","¶":"\xB6","∥":"\u2225","⫳":"\u2AF3","⫽":"\u2AFD","∂":"\u2202","п":"\u043F","%":"%",".":".","‰":"\u2030","⊥":"\u22A5","‱":"\u2031","𝔭":"\u{1D52D}","φ":"\u03C6","ϕ":"\u03D5","ℳ":"\u2133","☎":"\u260E","π":"\u03C0","⋔":"\u22D4","ϖ":"\u03D6","ℏ":"\u210F","ℎ":"\u210E","ℏ":"\u210F","+":"+","⨣":"\u2A23","⊞":"\u229E","⨢":"\u2A22","∔":"\u2214","⨥":"\u2A25","⩲":"\u2A72","±":"\xB1","±":"\xB1","⨦":"\u2A26","⨧":"\u2A27","±":"\xB1","⨕":"\u2A15","𝕡":"\u{1D561}","£":"\xA3","£":"\xA3","≺":"\u227A","⪳":"\u2AB3","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","≺":"\u227A","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","⪹":"\u2AB9","⪵":"\u2AB5","⋨":"\u22E8","≾":"\u227E","′":"\u2032","ℙ":"\u2119","⪵":"\u2AB5","⪹":"\u2AB9","⋨":"\u22E8","∏":"\u220F","⌮":"\u232E","⌒":"\u2312","⌓":"\u2313","∝":"\u221D","∝":"\u221D","≾":"\u227E","⊰":"\u22B0","𝓅":"\u{1D4C5}","ψ":"\u03C8"," ":"\u2008","𝔮":"\u{1D52E}","⨌":"\u2A0C","𝕢":"\u{1D562}","⁗":"\u2057","𝓆":"\u{1D4C6}","ℍ":"\u210D","⨖":"\u2A16","?":"?","≟":"\u225F",""":'"',""":'"',"⇛":"\u21DB","⇒":"\u21D2","⤜":"\u291C","⤏":"\u290F","⥤":"\u2964","∽̱":"\u223D\u0331","ŕ":"\u0155","√":"\u221A","⦳":"\u29B3","⟩":"\u27E9","⦒":"\u2992","⦥":"\u29A5","⟩":"\u27E9","»":"\xBB","»":"\xBB","→":"\u2192","⥵":"\u2975","⇥":"\u21E5","⤠":"\u2920","⤳":"\u2933","⤞":"\u291E","↪":"\u21AA","↬":"\u21AC","⥅":"\u2945","⥴":"\u2974","↣":"\u21A3","↝":"\u219D","⤚":"\u291A","∶":"\u2236","ℚ":"\u211A","⤍":"\u290D","❳":"\u2773","}":"}","]":"]","⦌":"\u298C","⦎":"\u298E","⦐":"\u2990","ř":"\u0159","ŗ":"\u0157","⌉":"\u2309","}":"}","р":"\u0440","⤷":"\u2937","⥩":"\u2969","”":"\u201D","”":"\u201D","↳":"\u21B3","ℜ":"\u211C","ℛ":"\u211B","ℜ":"\u211C","ℝ":"\u211D","▭":"\u25AD","®":"\xAE","®":"\xAE","⥽":"\u297D","⌋":"\u230B","𝔯":"\u{1D52F}","⇁":"\u21C1","⇀":"\u21C0","⥬":"\u296C","ρ":"\u03C1","ϱ":"\u03F1","→":"\u2192","↣":"\u21A3","⇁":"\u21C1","⇀":"\u21C0","⇄":"\u21C4","⇌":"\u21CC","⇉":"\u21C9","↝":"\u219D","⋌":"\u22CC","˚":"\u02DA","≓":"\u2253","⇄":"\u21C4","⇌":"\u21CC","‏":"\u200F","⎱":"\u23B1","⎱":"\u23B1","⫮":"\u2AEE","⟭":"\u27ED","⇾":"\u21FE","⟧":"\u27E7","⦆":"\u2986","𝕣":"\u{1D563}","⨮":"\u2A2E","⨵":"\u2A35",")":")","⦔":"\u2994","⨒":"\u2A12","⇉":"\u21C9","›":"\u203A","𝓇":"\u{1D4C7}","↱":"\u21B1","]":"]","’":"\u2019","’":"\u2019","⋌":"\u22CC","⋊":"\u22CA","▹":"\u25B9","⊵":"\u22B5","▸":"\u25B8","⧎":"\u29CE","⥨":"\u2968","℞":"\u211E","ś":"\u015B","‚":"\u201A","≻":"\u227B","⪴":"\u2AB4","⪸":"\u2AB8","š":"\u0161","≽":"\u227D","⪰":"\u2AB0","ş":"\u015F","ŝ":"\u015D","⪶":"\u2AB6","⪺":"\u2ABA","⋩":"\u22E9","⨓":"\u2A13","≿":"\u227F","с":"\u0441","⋅":"\u22C5","⊡":"\u22A1","⩦":"\u2A66","⇘":"\u21D8","⤥":"\u2925","↘":"\u2198","↘":"\u2198","§":"\xA7","§":"\xA7",";":";","⤩":"\u2929","∖":"\u2216","∖":"\u2216","✶":"\u2736","𝔰":"\u{1D530}","⌢":"\u2322","♯":"\u266F","щ":"\u0449","ш":"\u0448","∣":"\u2223","∥":"\u2225","­":"\xAD","­":"\xAD","σ":"\u03C3","ς":"\u03C2","ς":"\u03C2","∼":"\u223C","⩪":"\u2A6A","≃":"\u2243","≃":"\u2243","⪞":"\u2A9E","⪠":"\u2AA0","⪝":"\u2A9D","⪟":"\u2A9F","≆":"\u2246","⨤":"\u2A24","⥲":"\u2972","←":"\u2190","∖":"\u2216","⨳":"\u2A33","⧤":"\u29E4","∣":"\u2223","⌣":"\u2323","⪪":"\u2AAA","⪬":"\u2AAC","⪬︀":"\u2AAC\uFE00","ь":"\u044C","/":"/","⧄":"\u29C4","⌿":"\u233F","𝕤":"\u{1D564}","♠":"\u2660","♠":"\u2660","∥":"\u2225","⊓":"\u2293","⊓︀":"\u2293\uFE00","⊔":"\u2294","⊔︀":"\u2294\uFE00","⊏":"\u228F","⊑":"\u2291","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊐":"\u2290","⊒":"\u2292","□":"\u25A1","□":"\u25A1","▪":"\u25AA","▪":"\u25AA","→":"\u2192","𝓈":"\u{1D4C8}","∖":"\u2216","⌣":"\u2323","⋆":"\u22C6","☆":"\u2606","★":"\u2605","ϵ":"\u03F5","ϕ":"\u03D5","¯":"\xAF","⊂":"\u2282","⫅":"\u2AC5","⪽":"\u2ABD","⊆":"\u2286","⫃":"\u2AC3","⫁":"\u2AC1","⫋":"\u2ACB","⊊":"\u228A","⪿":"\u2ABF","⥹":"\u2979","⊂":"\u2282","⊆":"\u2286","⫅":"\u2AC5","⊊":"\u228A","⫋":"\u2ACB","⫇":"\u2AC7","⫕":"\u2AD5","⫓":"\u2AD3","≻":"\u227B","⪸":"\u2AB8","≽":"\u227D","⪰":"\u2AB0","⪺":"\u2ABA","⪶":"\u2AB6","⋩":"\u22E9","≿":"\u227F","∑":"\u2211","♪":"\u266A","¹":"\xB9","¹":"\xB9","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","⊃":"\u2283","⫆":"\u2AC6","⪾":"\u2ABE","⫘":"\u2AD8","⊇":"\u2287","⫄":"\u2AC4","⟉":"\u27C9","⫗":"\u2AD7","⥻":"\u297B","⫂":"\u2AC2","⫌":"\u2ACC","⊋":"\u228B","⫀":"\u2AC0","⊃":"\u2283","⊇":"\u2287","⫆":"\u2AC6","⊋":"\u228B","⫌":"\u2ACC","⫈":"\u2AC8","⫔":"\u2AD4","⫖":"\u2AD6","⇙":"\u21D9","⤦":"\u2926","↙":"\u2199","↙":"\u2199","⤪":"\u292A","ß":"\xDF","ß":"\xDF","⌖":"\u2316","τ":"\u03C4","⎴":"\u23B4","ť":"\u0165","ţ":"\u0163","т":"\u0442","⃛":"\u20DB","⌕":"\u2315","𝔱":"\u{1D531}","∴":"\u2234","∴":"\u2234","θ":"\u03B8","ϑ":"\u03D1","ϑ":"\u03D1","≈":"\u2248","∼":"\u223C"," ":"\u2009","≈":"\u2248","∼":"\u223C","þ":"\xFE","þ":"\xFE","˜":"\u02DC","×":"\xD7","×":"\xD7","⊠":"\u22A0","⨱":"\u2A31","⨰":"\u2A30","∭":"\u222D","⤨":"\u2928","⊤":"\u22A4","⌶":"\u2336","⫱":"\u2AF1","𝕥":"\u{1D565}","⫚":"\u2ADA","⤩":"\u2929","‴":"\u2034","™":"\u2122","▵":"\u25B5","▿":"\u25BF","◃":"\u25C3","⊴":"\u22B4","≜":"\u225C","▹":"\u25B9","⊵":"\u22B5","◬":"\u25EC","≜":"\u225C","⨺":"\u2A3A","⨹":"\u2A39","⧍":"\u29CD","⨻":"\u2A3B","⏢":"\u23E2","𝓉":"\u{1D4C9}","ц":"\u0446","ћ":"\u045B","ŧ":"\u0167","≬":"\u226C","↞":"\u219E","↠":"\u21A0","⇑":"\u21D1","⥣":"\u2963","ú":"\xFA","ú":"\xFA","↑":"\u2191","ў":"\u045E","ŭ":"\u016D","û":"\xFB","û":"\xFB","у":"\u0443","⇅":"\u21C5","ű":"\u0171","⥮":"\u296E","⥾":"\u297E","𝔲":"\u{1D532}","ù":"\xF9","ù":"\xF9","↿":"\u21BF","↾":"\u21BE","▀":"\u2580","⌜":"\u231C","⌜":"\u231C","⌏":"\u230F","◸":"\u25F8","ū":"\u016B","¨":"\xA8","¨":"\xA8","ų":"\u0173","𝕦":"\u{1D566}","↑":"\u2191","↕":"\u2195","↿":"\u21BF","↾":"\u21BE","⊎":"\u228E","υ":"\u03C5","ϒ":"\u03D2","υ":"\u03C5","⇈":"\u21C8","⌝":"\u231D","⌝":"\u231D","⌎":"\u230E","ů":"\u016F","◹":"\u25F9","𝓊":"\u{1D4CA}","⋰":"\u22F0","ũ":"\u0169","▵":"\u25B5","▴":"\u25B4","⇈":"\u21C8","ü":"\xFC","ü":"\xFC","⦧":"\u29A7","⇕":"\u21D5","⫨":"\u2AE8","⫩":"\u2AE9","⊨":"\u22A8","⦜":"\u299C","ϵ":"\u03F5","ϰ":"\u03F0","∅":"\u2205","ϕ":"\u03D5","ϖ":"\u03D6","∝":"\u221D","↕":"\u2195","ϱ":"\u03F1","ς":"\u03C2","⊊︀":"\u228A\uFE00","⫋︀":"\u2ACB\uFE00","⊋︀":"\u228B\uFE00","⫌︀":"\u2ACC\uFE00","ϑ":"\u03D1","⊲":"\u22B2","⊳":"\u22B3","в":"\u0432","⊢":"\u22A2","∨":"\u2228","⊻":"\u22BB","≚":"\u225A","⋮":"\u22EE","|":"|","|":"|","𝔳":"\u{1D533}","⊲":"\u22B2","⊂⃒":"\u2282\u20D2","⊃⃒":"\u2283\u20D2","𝕧":"\u{1D567}","∝":"\u221D","⊳":"\u22B3","𝓋":"\u{1D4CB}","⫋︀":"\u2ACB\uFE00","⊊︀":"\u228A\uFE00","⫌︀":"\u2ACC\uFE00","⊋︀":"\u228B\uFE00","⦚":"\u299A","ŵ":"\u0175","⩟":"\u2A5F","∧":"\u2227","≙":"\u2259","℘":"\u2118","𝔴":"\u{1D534}","𝕨":"\u{1D568}","℘":"\u2118","≀":"\u2240","≀":"\u2240","𝓌":"\u{1D4CC}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","▽":"\u25BD","𝔵":"\u{1D535}","⟺":"\u27FA","⟷":"\u27F7","ξ":"\u03BE","⟸":"\u27F8","⟵":"\u27F5","⟼":"\u27FC","⋻":"\u22FB","⨀":"\u2A00","𝕩":"\u{1D569}","⨁":"\u2A01","⨂":"\u2A02","⟹":"\u27F9","⟶":"\u27F6","𝓍":"\u{1D4CD}","⨆":"\u2A06","⨄":"\u2A04","△":"\u25B3","⋁":"\u22C1","⋀":"\u22C0","ý":"\xFD","ý":"\xFD","я":"\u044F","ŷ":"\u0177","ы":"\u044B","¥":"\xA5","¥":"\xA5","𝔶":"\u{1D536}","ї":"\u0457","𝕪":"\u{1D56A}","𝓎":"\u{1D4CE}","ю":"\u044E","ÿ":"\xFF","ÿ":"\xFF","ź":"\u017A","ž":"\u017E","з":"\u0437","ż":"\u017C","ℨ":"\u2128","ζ":"\u03B6","𝔷":"\u{1D537}","ж":"\u0436","⇝":"\u21DD","𝕫":"\u{1D56B}","𝓏":"\u{1D4CF}","‍":"\u200D","‌":"\u200C"},characters:{\u00C6:"Æ","&":"&",\u00C1:"Á",\u0102:"Ă",\u00C2:"Â",\u0410:"А","\u{1D504}":"𝔄",\u00C0:"À",\u0391:"Α",\u0100:"Ā","\u2A53":"⩓",\u0104:"Ą","\u{1D538}":"𝔸","\u2061":"⁡",\u00C5:"Å","\u{1D49C}":"𝒜","\u2254":"≔",\u00C3:"Ã",\u00C4:"Ä","\u2216":"∖","\u2AE7":"⫧","\u2306":"⌆",\u0411:"Б","\u2235":"∵",\u212C:"ℬ",\u0392:"Β","\u{1D505}":"𝔅","\u{1D539}":"𝔹","\u02D8":"˘","\u224E":"≎",\u0427:"Ч","\xA9":"©",\u0106:"Ć","\u22D2":"⋒","\u2145":"ⅅ",\u212D:"ℭ",\u010C:"Č",\u00C7:"Ç",\u0108:"Ĉ","\u2230":"∰",\u010A:"Ċ","\xB8":"¸","\xB7":"·",\u03A7:"Χ","\u2299":"⊙","\u2296":"⊖","\u2295":"⊕","\u2297":"⊗","\u2232":"∲","\u201D":"”","\u2019":"’","\u2237":"∷","\u2A74":"⩴","\u2261":"≡","\u222F":"∯","\u222E":"∮",\u2102:"ℂ","\u2210":"∐","\u2233":"∳","\u2A2F":"⨯","\u{1D49E}":"𝒞","\u22D3":"⋓","\u224D":"≍","\u2911":"⤑",\u0402:"Ђ",\u0405:"Ѕ",\u040F:"Џ","\u2021":"‡","\u21A1":"↡","\u2AE4":"⫤",\u010E:"Ď",\u0414:"Д","\u2207":"∇",\u0394:"Δ","\u{1D507}":"𝔇","\xB4":"´","\u02D9":"˙","\u02DD":"˝","`":"`","\u02DC":"˜","\u22C4":"⋄","\u2146":"ⅆ","\u{1D53B}":"𝔻","\xA8":"¨","\u20DC":"⃜","\u2250":"≐","\u21D3":"⇓","\u21D0":"⇐","\u21D4":"⇔","\u27F8":"⟸","\u27FA":"⟺","\u27F9":"⟹","\u21D2":"⇒","\u22A8":"⊨","\u21D1":"⇑","\u21D5":"⇕","\u2225":"∥","\u2193":"↓","\u2913":"⤓","\u21F5":"⇵","\u0311":"̑","\u2950":"⥐","\u295E":"⥞","\u21BD":"↽","\u2956":"⥖","\u295F":"⥟","\u21C1":"⇁","\u2957":"⥗","\u22A4":"⊤","\u21A7":"↧","\u{1D49F}":"𝒟",\u0110:"Đ",\u014A:"Ŋ",\u00D0:"Ð",\u00C9:"É",\u011A:"Ě",\u00CA:"Ê",\u042D:"Э",\u0116:"Ė","\u{1D508}":"𝔈",\u00C8:"È","\u2208":"∈",\u0112:"Ē","\u25FB":"◻","\u25AB":"▫",\u0118:"Ę","\u{1D53C}":"𝔼",\u0395:"Ε","\u2A75":"⩵","\u2242":"≂","\u21CC":"⇌",\u2130:"ℰ","\u2A73":"⩳",\u0397:"Η",\u00CB:"Ë","\u2203":"∃","\u2147":"ⅇ",\u0424:"Ф","\u{1D509}":"𝔉","\u25FC":"◼","\u25AA":"▪","\u{1D53D}":"𝔽","\u2200":"∀",\u2131:"ℱ",\u0403:"Ѓ",">":">",\u0393:"Γ",\u03DC:"Ϝ",\u011E:"Ğ",\u0122:"Ģ",\u011C:"Ĝ",\u0413:"Г",\u0120:"Ġ","\u{1D50A}":"𝔊","\u22D9":"⋙","\u{1D53E}":"𝔾","\u2265":"≥","\u22DB":"⋛","\u2267":"≧","\u2AA2":"⪢","\u2277":"≷","\u2A7E":"⩾","\u2273":"≳","\u{1D4A2}":"𝒢","\u226B":"≫",\u042A:"Ъ","\u02C7":"ˇ","^":"^",\u0124:"Ĥ",\u210C:"ℌ",\u210B:"ℋ",\u210D:"ℍ","\u2500":"─",\u0126:"Ħ","\u224F":"≏",\u0415:"Е",\u0132:"IJ",\u0401:"Ё",\u00CD:"Í",\u00CE:"Î",\u0418:"И",\u0130:"İ",\u2111:"ℑ",\u00CC:"Ì",\u012A:"Ī","\u2148":"ⅈ","\u222C":"∬","\u222B":"∫","\u22C2":"⋂","\u2063":"⁣","\u2062":"⁢",\u012E:"Į","\u{1D540}":"𝕀",\u0399:"Ι",\u2110:"ℐ",\u0128:"Ĩ",\u0406:"І",\u00CF:"Ï",\u0134:"Ĵ",\u0419:"Й","\u{1D50D}":"𝔍","\u{1D541}":"𝕁","\u{1D4A5}":"𝒥",\u0408:"Ј",\u0404:"Є",\u0425:"Х",\u040C:"Ќ",\u039A:"Κ",\u0136:"Ķ",\u041A:"К","\u{1D50E}":"𝔎","\u{1D542}":"𝕂","\u{1D4A6}":"𝒦",\u0409:"Љ","<":"<",\u0139:"Ĺ",\u039B:"Λ","\u27EA":"⟪",\u2112:"ℒ","\u219E":"↞",\u013D:"Ľ",\u013B:"Ļ",\u041B:"Л","\u27E8":"⟨","\u2190":"←","\u21E4":"⇤","\u21C6":"⇆","\u2308":"⌈","\u27E6":"⟦","\u2961":"⥡","\u21C3":"⇃","\u2959":"⥙","\u230A":"⌊","\u2194":"↔","\u294E":"⥎","\u22A3":"⊣","\u21A4":"↤","\u295A":"⥚","\u22B2":"⊲","\u29CF":"⧏","\u22B4":"⊴","\u2951":"⥑","\u2960":"⥠","\u21BF":"↿","\u2958":"⥘","\u21BC":"↼","\u2952":"⥒","\u22DA":"⋚","\u2266":"≦","\u2276":"≶","\u2AA1":"⪡","\u2A7D":"⩽","\u2272":"≲","\u{1D50F}":"𝔏","\u22D8":"⋘","\u21DA":"⇚",\u013F:"Ŀ","\u27F5":"⟵","\u27F7":"⟷","\u27F6":"⟶","\u{1D543}":"𝕃","\u2199":"↙","\u2198":"↘","\u21B0":"↰",\u0141:"Ł","\u226A":"≪","\u2905":"⤅",\u041C:"М","\u205F":" ",\u2133:"ℳ","\u{1D510}":"𝔐","\u2213":"∓","\u{1D544}":"𝕄",\u039C:"Μ",\u040A:"Њ",\u0143:"Ń",\u0147:"Ň",\u0145:"Ņ",\u041D:"Н","\u200B":"​","\n":" ","\u{1D511}":"𝔑","\u2060":"⁠","\xA0":" ",\u2115:"ℕ","\u2AEC":"⫬","\u2262":"≢","\u226D":"≭","\u2226":"∦","\u2209":"∉","\u2260":"≠","\u2242\u0338":"≂̸","\u2204":"∄","\u226F":"≯","\u2271":"≱","\u2267\u0338":"≧̸","\u226B\u0338":"≫̸","\u2279":"≹","\u2A7E\u0338":"⩾̸","\u2275":"≵","\u224E\u0338":"≎̸","\u224F\u0338":"≏̸","\u22EA":"⋪","\u29CF\u0338":"⧏̸","\u22EC":"⋬","\u226E":"≮","\u2270":"≰","\u2278":"≸","\u226A\u0338":"≪̸","\u2A7D\u0338":"⩽̸","\u2274":"≴","\u2AA2\u0338":"⪢̸","\u2AA1\u0338":"⪡̸","\u2280":"⊀","\u2AAF\u0338":"⪯̸","\u22E0":"⋠","\u220C":"∌","\u22EB":"⋫","\u29D0\u0338":"⧐̸","\u22ED":"⋭","\u228F\u0338":"⊏̸","\u22E2":"⋢","\u2290\u0338":"⊐̸","\u22E3":"⋣","\u2282\u20D2":"⊂⃒","\u2288":"⊈","\u2281":"⊁","\u2AB0\u0338":"⪰̸","\u22E1":"⋡","\u227F\u0338":"≿̸","\u2283\u20D2":"⊃⃒","\u2289":"⊉","\u2241":"≁","\u2244":"≄","\u2247":"≇","\u2249":"≉","\u2224":"∤","\u{1D4A9}":"𝒩",\u00D1:"Ñ",\u039D:"Ν",\u0152:"Œ",\u00D3:"Ó",\u00D4:"Ô",\u041E:"О",\u0150:"Ő","\u{1D512}":"𝔒",\u00D2:"Ò",\u014C:"Ō",\u03A9:"Ω",\u039F:"Ο","\u{1D546}":"𝕆","\u201C":"“","\u2018":"‘","\u2A54":"⩔","\u{1D4AA}":"𝒪",\u00D8:"Ø",\u00D5:"Õ","\u2A37":"⨷",\u00D6:"Ö","\u203E":"‾","\u23DE":"⏞","\u23B4":"⎴","\u23DC":"⏜","\u2202":"∂",\u041F:"П","\u{1D513}":"𝔓",\u03A6:"Φ",\u03A0:"Π","\xB1":"±",\u2119:"ℙ","\u2ABB":"⪻","\u227A":"≺","\u2AAF":"⪯","\u227C":"≼","\u227E":"≾","\u2033":"″","\u220F":"∏","\u221D":"∝","\u{1D4AB}":"𝒫",\u03A8:"Ψ",'"':""","\u{1D514}":"𝔔",\u211A:"ℚ","\u{1D4AC}":"𝒬","\u2910":"⤐","\xAE":"®",\u0154:"Ŕ","\u27EB":"⟫","\u21A0":"↠","\u2916":"⤖",\u0158:"Ř",\u0156:"Ŗ",\u0420:"Р",\u211C:"ℜ","\u220B":"∋","\u21CB":"⇋","\u296F":"⥯",\u03A1:"Ρ","\u27E9":"⟩","\u2192":"→","\u21E5":"⇥","\u21C4":"⇄","\u2309":"⌉","\u27E7":"⟧","\u295D":"⥝","\u21C2":"⇂","\u2955":"⥕","\u230B":"⌋","\u22A2":"⊢","\u21A6":"↦","\u295B":"⥛","\u22B3":"⊳","\u29D0":"⧐","\u22B5":"⊵","\u294F":"⥏","\u295C":"⥜","\u21BE":"↾","\u2954":"⥔","\u21C0":"⇀","\u2953":"⥓",\u211D:"ℝ","\u2970":"⥰","\u21DB":"⇛",\u211B:"ℛ","\u21B1":"↱","\u29F4":"⧴",\u0429:"Щ",\u0428:"Ш",\u042C:"Ь",\u015A:"Ś","\u2ABC":"⪼",\u0160:"Š",\u015E:"Ş",\u015C:"Ŝ",\u0421:"С","\u{1D516}":"𝔖","\u2191":"↑",\u03A3:"Σ","\u2218":"∘","\u{1D54A}":"𝕊","\u221A":"√","\u25A1":"□","\u2293":"⊓","\u228F":"⊏","\u2291":"⊑","\u2290":"⊐","\u2292":"⊒","\u2294":"⊔","\u{1D4AE}":"𝒮","\u22C6":"⋆","\u22D0":"⋐","\u2286":"⊆","\u227B":"≻","\u2AB0":"⪰","\u227D":"≽","\u227F":"≿","\u2211":"∑","\u22D1":"⋑","\u2283":"⊃","\u2287":"⊇",\u00DE:"Þ","\u2122":"™",\u040B:"Ћ",\u0426:"Ц"," ":" ",\u03A4:"Τ",\u0164:"Ť",\u0162:"Ţ",\u0422:"Т","\u{1D517}":"𝔗","\u2234":"∴",\u0398:"Θ","\u205F\u200A":"  ","\u2009":" ","\u223C":"∼","\u2243":"≃","\u2245":"≅","\u2248":"≈","\u{1D54B}":"𝕋","\u20DB":"⃛","\u{1D4AF}":"𝒯",\u0166:"Ŧ",\u00DA:"Ú","\u219F":"↟","\u2949":"⥉",\u040E:"Ў",\u016C:"Ŭ",\u00DB:"Û",\u0423:"У",\u0170:"Ű","\u{1D518}":"𝔘",\u00D9:"Ù",\u016A:"Ū",_:"_","\u23DF":"⏟","\u23B5":"⎵","\u23DD":"⏝","\u22C3":"⋃","\u228E":"⊎",\u0172:"Ų","\u{1D54C}":"𝕌","\u2912":"⤒","\u21C5":"⇅","\u2195":"↕","\u296E":"⥮","\u22A5":"⊥","\u21A5":"↥","\u2196":"↖","\u2197":"↗",\u03D2:"ϒ",\u03A5:"Υ",\u016E:"Ů","\u{1D4B0}":"𝒰",\u0168:"Ũ",\u00DC:"Ü","\u22AB":"⊫","\u2AEB":"⫫",\u0412:"В","\u22A9":"⊩","\u2AE6":"⫦","\u22C1":"⋁","\u2016":"‖","\u2223":"∣","|":"|","\u2758":"❘","\u2240":"≀","\u200A":" ","\u{1D519}":"𝔙","\u{1D54D}":"𝕍","\u{1D4B1}":"𝒱","\u22AA":"⊪",\u0174:"Ŵ","\u22C0":"⋀","\u{1D51A}":"𝔚","\u{1D54E}":"𝕎","\u{1D4B2}":"𝒲","\u{1D51B}":"𝔛",\u039E:"Ξ","\u{1D54F}":"𝕏","\u{1D4B3}":"𝒳",\u042F:"Я",\u0407:"Ї",\u042E:"Ю",\u00DD:"Ý",\u0176:"Ŷ",\u042B:"Ы","\u{1D51C}":"𝔜","\u{1D550}":"𝕐","\u{1D4B4}":"𝒴",\u0178:"Ÿ",\u0416:"Ж",\u0179:"Ź",\u017D:"Ž",\u0417:"З",\u017B:"Ż",\u0396:"Ζ",\u2128:"ℨ",\u2124:"ℤ","\u{1D4B5}":"𝒵",\u00E1:"á",\u0103:"ă","\u223E":"∾","\u223E\u0333":"∾̳","\u223F":"∿",\u00E2:"â",\u0430:"а",\u00E6:"æ","\u{1D51E}":"𝔞",\u00E0:"à",\u2135:"ℵ",\u03B1:"α",\u0101:"ā","\u2A3F":"⨿","\u2227":"∧","\u2A55":"⩕","\u2A5C":"⩜","\u2A58":"⩘","\u2A5A":"⩚","\u2220":"∠","\u29A4":"⦤","\u2221":"∡","\u29A8":"⦨","\u29A9":"⦩","\u29AA":"⦪","\u29AB":"⦫","\u29AC":"⦬","\u29AD":"⦭","\u29AE":"⦮","\u29AF":"⦯","\u221F":"∟","\u22BE":"⊾","\u299D":"⦝","\u2222":"∢","\u237C":"⍼",\u0105:"ą","\u{1D552}":"𝕒","\u2A70":"⩰","\u2A6F":"⩯","\u224A":"≊","\u224B":"≋","'":"'",\u00E5:"å","\u{1D4B6}":"𝒶","*":"*",\u00E3:"ã",\u00E4:"ä","\u2A11":"⨑","\u2AED":"⫭","\u224C":"≌","\u03F6":"϶","\u2035":"‵","\u223D":"∽","\u22CD":"⋍","\u22BD":"⊽","\u2305":"⌅","\u23B6":"⎶",\u0431:"б","\u201E":"„","\u29B0":"⦰",\u03B2:"β",\u2136:"ℶ","\u226C":"≬","\u{1D51F}":"𝔟","\u25EF":"◯","\u2A00":"⨀","\u2A01":"⨁","\u2A02":"⨂","\u2A06":"⨆","\u2605":"★","\u25BD":"▽","\u25B3":"△","\u2A04":"⨄","\u290D":"⤍","\u29EB":"⧫","\u25B4":"▴","\u25BE":"▾","\u25C2":"◂","\u25B8":"▸","\u2423":"␣","\u2592":"▒","\u2591":"░","\u2593":"▓","\u2588":"█","=\u20E5":"=⃥","\u2261\u20E5":"≡⃥","\u2310":"⌐","\u{1D553}":"𝕓","\u22C8":"⋈","\u2557":"╗","\u2554":"╔","\u2556":"╖","\u2553":"╓","\u2550":"═","\u2566":"╦","\u2569":"╩","\u2564":"╤","\u2567":"╧","\u255D":"╝","\u255A":"╚","\u255C":"╜","\u2559":"╙","\u2551":"║","\u256C":"╬","\u2563":"╣","\u2560":"╠","\u256B":"╫","\u2562":"╢","\u255F":"╟","\u29C9":"⧉","\u2555":"╕","\u2552":"╒","\u2510":"┐","\u250C":"┌","\u2565":"╥","\u2568":"╨","\u252C":"┬","\u2534":"┴","\u229F":"⊟","\u229E":"⊞","\u22A0":"⊠","\u255B":"╛","\u2558":"╘","\u2518":"┘","\u2514":"└","\u2502":"│","\u256A":"╪","\u2561":"╡","\u255E":"╞","\u253C":"┼","\u2524":"┤","\u251C":"├","\xA6":"¦","\u{1D4B7}":"𝒷","\u204F":"⁏","\\":"\","\u29C5":"⧅","\u27C8":"⟈","\u2022":"•","\u2AAE":"⪮",\u0107:"ć","\u2229":"∩","\u2A44":"⩄","\u2A49":"⩉","\u2A4B":"⩋","\u2A47":"⩇","\u2A40":"⩀","\u2229\uFE00":"∩︀","\u2041":"⁁","\u2A4D":"⩍",\u010D:"č",\u00E7:"ç",\u0109:"ĉ","\u2A4C":"⩌","\u2A50":"⩐",\u010B:"ċ","\u29B2":"⦲","\xA2":"¢","\u{1D520}":"𝔠",\u0447:"ч","\u2713":"✓",\u03C7:"χ","\u25CB":"○","\u29C3":"⧃","\u02C6":"ˆ","\u2257":"≗","\u21BA":"↺","\u21BB":"↻","\u24C8":"Ⓢ","\u229B":"⊛","\u229A":"⊚","\u229D":"⊝","\u2A10":"⨐","\u2AEF":"⫯","\u29C2":"⧂","\u2663":"♣",":":":",",":",","@":"@","\u2201":"∁","\u2A6D":"⩭","\u{1D554}":"𝕔","\u2117":"℗","\u21B5":"↵","\u2717":"✗","\u{1D4B8}":"𝒸","\u2ACF":"⫏","\u2AD1":"⫑","\u2AD0":"⫐","\u2AD2":"⫒","\u22EF":"⋯","\u2938":"⤸","\u2935":"⤵","\u22DE":"⋞","\u22DF":"⋟","\u21B6":"↶","\u293D":"⤽","\u222A":"∪","\u2A48":"⩈","\u2A46":"⩆","\u2A4A":"⩊","\u228D":"⊍","\u2A45":"⩅","\u222A\uFE00":"∪︀","\u21B7":"↷","\u293C":"⤼","\u22CE":"⋎","\u22CF":"⋏","\xA4":"¤","\u2231":"∱","\u232D":"⌭","\u2965":"⥥","\u2020":"†",\u2138:"ℸ","\u2010":"‐","\u290F":"⤏",\u010F:"ď",\u0434:"д","\u21CA":"⇊","\u2A77":"⩷","\xB0":"°",\u03B4:"δ","\u29B1":"⦱","\u297F":"⥿","\u{1D521}":"𝔡","\u2666":"♦",\u03DD:"ϝ","\u22F2":"⋲","\xF7":"÷","\u22C7":"⋇",\u0452:"ђ","\u231E":"⌞","\u230D":"⌍",$:"$","\u{1D555}":"𝕕","\u2251":"≑","\u2238":"∸","\u2214":"∔","\u22A1":"⊡","\u231F":"⌟","\u230C":"⌌","\u{1D4B9}":"𝒹",\u0455:"ѕ","\u29F6":"⧶",\u0111:"đ","\u22F1":"⋱","\u25BF":"▿","\u29A6":"⦦",\u045F:"џ","\u27FF":"⟿",\u00E9:"é","\u2A6E":"⩮",\u011B:"ě","\u2256":"≖",\u00EA:"ê","\u2255":"≕",\u044D:"э",\u0117:"ė","\u2252":"≒","\u{1D522}":"𝔢","\u2A9A":"⪚",\u00E8:"è","\u2A96":"⪖","\u2A98":"⪘","\u2A99":"⪙","\u23E7":"⏧",\u2113:"ℓ","\u2A95":"⪕","\u2A97":"⪗",\u0113:"ē","\u2205":"∅","\u2004":" ","\u2005":" ","\u2003":" ",\u014B:"ŋ","\u2002":" ",\u0119:"ę","\u{1D556}":"𝕖","\u22D5":"⋕","\u29E3":"⧣","\u2A71":"⩱",\u03B5:"ε","\u03F5":"ϵ","=":"=","\u225F":"≟","\u2A78":"⩸","\u29E5":"⧥","\u2253":"≓","\u2971":"⥱",\u212F:"ℯ",\u03B7:"η",\u00F0:"ð",\u00EB:"ë","\u20AC":"€","!":"!",\u0444:"ф","\u2640":"♀",\uFB03:"ffi",\uFB00:"ff",\uFB04:"ffl","\u{1D523}":"𝔣",\uFB01:"fi",fj:"fj","\u266D":"♭",\uFB02:"fl","\u25B1":"▱",\u0192:"ƒ","\u{1D557}":"𝕗","\u22D4":"⋔","\u2AD9":"⫙","\u2A0D":"⨍","\xBD":"½","\u2153":"⅓","\xBC":"¼","\u2155":"⅕","\u2159":"⅙","\u215B":"⅛","\u2154":"⅔","\u2156":"⅖","\xBE":"¾","\u2157":"⅗","\u215C":"⅜","\u2158":"⅘","\u215A":"⅚","\u215D":"⅝","\u215E":"⅞","\u2044":"⁄","\u2322":"⌢","\u{1D4BB}":"𝒻","\u2A8C":"⪌",\u01F5:"ǵ",\u03B3:"γ","\u2A86":"⪆",\u011F:"ğ",\u011D:"ĝ",\u0433:"г",\u0121:"ġ","\u2AA9":"⪩","\u2A80":"⪀","\u2A82":"⪂","\u2A84":"⪄","\u22DB\uFE00":"⋛︀","\u2A94":"⪔","\u{1D524}":"𝔤",\u2137:"ℷ",\u0453:"ѓ","\u2A92":"⪒","\u2AA5":"⪥","\u2AA4":"⪤","\u2269":"≩","\u2A8A":"⪊","\u2A88":"⪈","\u22E7":"⋧","\u{1D558}":"𝕘",\u210A:"ℊ","\u2A8E":"⪎","\u2A90":"⪐","\u2AA7":"⪧","\u2A7A":"⩺","\u22D7":"⋗","\u2995":"⦕","\u2A7C":"⩼","\u2978":"⥸","\u2269\uFE00":"≩︀",\u044A:"ъ","\u2948":"⥈","\u21AD":"↭",\u210F:"ℏ",\u0125:"ĥ","\u2665":"♥","\u2026":"…","\u22B9":"⊹","\u{1D525}":"𝔥","\u2925":"⤥","\u2926":"⤦","\u21FF":"⇿","\u223B":"∻","\u21A9":"↩","\u21AA":"↪","\u{1D559}":"𝕙","\u2015":"―","\u{1D4BD}":"𝒽",\u0127:"ħ","\u2043":"⁃",\u00ED:"í",\u00EE:"î",\u0438:"и",\u0435:"е","\xA1":"¡","\u{1D526}":"𝔦",\u00EC:"ì","\u2A0C":"⨌","\u222D":"∭","\u29DC":"⧜","\u2129":"℩",\u0133:"ij",\u012B:"ī",\u0131:"ı","\u22B7":"⊷",\u01B5:"Ƶ","\u2105":"℅","\u221E":"∞","\u29DD":"⧝","\u22BA":"⊺","\u2A17":"⨗","\u2A3C":"⨼",\u0451:"ё",\u012F:"į","\u{1D55A}":"𝕚",\u03B9:"ι","\xBF":"¿","\u{1D4BE}":"𝒾","\u22F9":"⋹","\u22F5":"⋵","\u22F4":"⋴","\u22F3":"⋳",\u0129:"ĩ",\u0456:"і",\u00EF:"ï",\u0135:"ĵ",\u0439:"й","\u{1D527}":"𝔧","\u0237":"ȷ","\u{1D55B}":"𝕛","\u{1D4BF}":"𝒿",\u0458:"ј",\u0454:"є",\u03BA:"κ",\u03F0:"ϰ",\u0137:"ķ",\u043A:"к","\u{1D528}":"𝔨",\u0138:"ĸ",\u0445:"х",\u045C:"ќ","\u{1D55C}":"𝕜","\u{1D4C0}":"𝓀","\u291B":"⤛","\u290E":"⤎","\u2A8B":"⪋","\u2962":"⥢",\u013A:"ĺ","\u29B4":"⦴",\u03BB:"λ","\u2991":"⦑","\u2A85":"⪅","\xAB":"«","\u291F":"⤟","\u291D":"⤝","\u21AB":"↫","\u2939":"⤹","\u2973":"⥳","\u21A2":"↢","\u2AAB":"⪫","\u2919":"⤙","\u2AAD":"⪭","\u2AAD\uFE00":"⪭︀","\u290C":"⤌","\u2772":"❲","{":"{","[":"[","\u298B":"⦋","\u298F":"⦏","\u298D":"⦍",\u013E:"ľ",\u013C:"ļ",\u043B:"л","\u2936":"⤶","\u2967":"⥧","\u294B":"⥋","\u21B2":"↲","\u2264":"≤","\u21C7":"⇇","\u22CB":"⋋","\u2AA8":"⪨","\u2A7F":"⩿","\u2A81":"⪁","\u2A83":"⪃","\u22DA\uFE00":"⋚︀","\u2A93":"⪓","\u22D6":"⋖","\u297C":"⥼","\u{1D529}":"𝔩","\u2A91":"⪑","\u296A":"⥪","\u2584":"▄",\u0459:"љ","\u296B":"⥫","\u25FA":"◺",\u0140:"ŀ","\u23B0":"⎰","\u2268":"≨","\u2A89":"⪉","\u2A87":"⪇","\u22E6":"⋦","\u27EC":"⟬","\u21FD":"⇽","\u27FC":"⟼","\u21AC":"↬","\u2985":"⦅","\u{1D55D}":"𝕝","\u2A2D":"⨭","\u2A34":"⨴","\u2217":"∗","\u25CA":"◊","(":"(","\u2993":"⦓","\u296D":"⥭","\u200E":"‎","\u22BF":"⊿","\u2039":"‹","\u{1D4C1}":"𝓁","\u2A8D":"⪍","\u2A8F":"⪏","\u201A":"‚",\u0142:"ł","\u2AA6":"⪦","\u2A79":"⩹","\u22C9":"⋉","\u2976":"⥶","\u2A7B":"⩻","\u2996":"⦖","\u25C3":"◃","\u294A":"⥊","\u2966":"⥦","\u2268\uFE00":"≨︀","\u223A":"∺","\xAF":"¯","\u2642":"♂","\u2720":"✠","\u25AE":"▮","\u2A29":"⨩",\u043C:"м","\u2014":"—","\u{1D52A}":"𝔪","\u2127":"℧",\u00B5:"µ","\u2AF0":"⫰","\u2212":"−","\u2A2A":"⨪","\u2ADB":"⫛","\u22A7":"⊧","\u{1D55E}":"𝕞","\u{1D4C2}":"𝓂",\u03BC:"μ","\u22B8":"⊸","\u22D9\u0338":"⋙̸","\u226B\u20D2":"≫⃒","\u21CD":"⇍","\u21CE":"⇎","\u22D8\u0338":"⋘̸","\u226A\u20D2":"≪⃒","\u21CF":"⇏","\u22AF":"⊯","\u22AE":"⊮",\u0144:"ń","\u2220\u20D2":"∠⃒","\u2A70\u0338":"⩰̸","\u224B\u0338":"≋̸",\u0149:"ʼn","\u266E":"♮","\u2A43":"⩃",\u0148:"ň",\u0146:"ņ","\u2A6D\u0338":"⩭̸","\u2A42":"⩂",\u043D:"н","\u2013":"–","\u21D7":"⇗","\u2924":"⤤","\u2250\u0338":"≐̸","\u2928":"⤨","\u{1D52B}":"𝔫","\u21AE":"↮","\u2AF2":"⫲","\u22FC":"⋼","\u22FA":"⋺",\u045A:"њ","\u2266\u0338":"≦̸","\u219A":"↚","\u2025":"‥","\u{1D55F}":"𝕟","\xAC":"¬","\u22F9\u0338":"⋹̸","\u22F5\u0338":"⋵̸","\u22F7":"⋷","\u22F6":"⋶","\u22FE":"⋾","\u22FD":"⋽","\u2AFD\u20E5":"⫽⃥","\u2202\u0338":"∂̸","\u2A14":"⨔","\u219B":"↛","\u2933\u0338":"⤳̸","\u219D\u0338":"↝̸","\u{1D4C3}":"𝓃","\u2284":"⊄","\u2AC5\u0338":"⫅̸","\u2285":"⊅","\u2AC6\u0338":"⫆̸",\u00F1:"ñ",\u03BD:"ν","#":"#","\u2116":"№","\u2007":" ","\u22AD":"⊭","\u2904":"⤄","\u224D\u20D2":"≍⃒","\u22AC":"⊬","\u2265\u20D2":"≥⃒",">\u20D2":">⃒","\u29DE":"⧞","\u2902":"⤂","\u2264\u20D2":"≤⃒","<\u20D2":"<⃒","\u22B4\u20D2":"⊴⃒","\u2903":"⤃","\u22B5\u20D2":"⊵⃒","\u223C\u20D2":"∼⃒","\u21D6":"⇖","\u2923":"⤣","\u2927":"⤧",\u00F3:"ó",\u00F4:"ô",\u043E:"о",\u0151:"ő","\u2A38":"⨸","\u29BC":"⦼",\u0153:"œ","\u29BF":"⦿","\u{1D52C}":"𝔬","\u02DB":"˛",\u00F2:"ò","\u29C1":"⧁","\u29B5":"⦵","\u29BE":"⦾","\u29BB":"⦻","\u29C0":"⧀",\u014D:"ō",\u03C9:"ω",\u03BF:"ο","\u29B6":"⦶","\u{1D560}":"𝕠","\u29B7":"⦷","\u29B9":"⦹","\u2228":"∨","\u2A5D":"⩝",\u2134:"ℴ",\u00AA:"ª",\u00BA:"º","\u22B6":"⊶","\u2A56":"⩖","\u2A57":"⩗","\u2A5B":"⩛",\u00F8:"ø","\u2298":"⊘",\u00F5:"õ","\u2A36":"⨶",\u00F6:"ö","\u233D":"⌽","\xB6":"¶","\u2AF3":"⫳","\u2AFD":"⫽",\u043F:"п","%":"%",".":".","\u2030":"‰","\u2031":"‱","\u{1D52D}":"𝔭",\u03C6:"φ",\u03D5:"ϕ","\u260E":"☎",\u03C0:"π",\u03D6:"ϖ",\u210E:"ℎ","+":"+","\u2A23":"⨣","\u2A22":"⨢","\u2A25":"⨥","\u2A72":"⩲","\u2A26":"⨦","\u2A27":"⨧","\u2A15":"⨕","\u{1D561}":"𝕡","\xA3":"£","\u2AB3":"⪳","\u2AB7":"⪷","\u2AB9":"⪹","\u2AB5":"⪵","\u22E8":"⋨","\u2032":"′","\u232E":"⌮","\u2312":"⌒","\u2313":"⌓","\u22B0":"⊰","\u{1D4C5}":"𝓅",\u03C8:"ψ","\u2008":" ","\u{1D52E}":"𝔮","\u{1D562}":"𝕢","\u2057":"⁗","\u{1D4C6}":"𝓆","\u2A16":"⨖","?":"?","\u291C":"⤜","\u2964":"⥤","\u223D\u0331":"∽̱",\u0155:"ŕ","\u29B3":"⦳","\u2992":"⦒","\u29A5":"⦥","\xBB":"»","\u2975":"⥵","\u2920":"⤠","\u2933":"⤳","\u291E":"⤞","\u2945":"⥅","\u2974":"⥴","\u21A3":"↣","\u219D":"↝","\u291A":"⤚","\u2236":"∶","\u2773":"❳","}":"}","]":"]","\u298C":"⦌","\u298E":"⦎","\u2990":"⦐",\u0159:"ř",\u0157:"ŗ",\u0440:"р","\u2937":"⤷","\u2969":"⥩","\u21B3":"↳","\u25AD":"▭","\u297D":"⥽","\u{1D52F}":"𝔯","\u296C":"⥬",\u03C1:"ρ",\u03F1:"ϱ","\u21C9":"⇉","\u22CC":"⋌","\u02DA":"˚","\u200F":"‏","\u23B1":"⎱","\u2AEE":"⫮","\u27ED":"⟭","\u21FE":"⇾","\u2986":"⦆","\u{1D563}":"𝕣","\u2A2E":"⨮","\u2A35":"⨵",")":")","\u2994":"⦔","\u2A12":"⨒","\u203A":"›","\u{1D4C7}":"𝓇","\u22CA":"⋊","\u25B9":"▹","\u29CE":"⧎","\u2968":"⥨","\u211E":"℞",\u015B:"ś","\u2AB4":"⪴","\u2AB8":"⪸",\u0161:"š",\u015F:"ş",\u015D:"ŝ","\u2AB6":"⪶","\u2ABA":"⪺","\u22E9":"⋩","\u2A13":"⨓",\u0441:"с","\u22C5":"⋅","\u2A66":"⩦","\u21D8":"⇘","\xA7":"§",";":";","\u2929":"⤩","\u2736":"✶","\u{1D530}":"𝔰","\u266F":"♯",\u0449:"щ",\u0448:"ш","\xAD":"­",\u03C3:"σ",\u03C2:"ς","\u2A6A":"⩪","\u2A9E":"⪞","\u2AA0":"⪠","\u2A9D":"⪝","\u2A9F":"⪟","\u2246":"≆","\u2A24":"⨤","\u2972":"⥲","\u2A33":"⨳","\u29E4":"⧤","\u2323":"⌣","\u2AAA":"⪪","\u2AAC":"⪬","\u2AAC\uFE00":"⪬︀",\u044C:"ь","/":"/","\u29C4":"⧄","\u233F":"⌿","\u{1D564}":"𝕤","\u2660":"♠","\u2293\uFE00":"⊓︀","\u2294\uFE00":"⊔︀","\u{1D4C8}":"𝓈","\u2606":"☆","\u2282":"⊂","\u2AC5":"⫅","\u2ABD":"⪽","\u2AC3":"⫃","\u2AC1":"⫁","\u2ACB":"⫋","\u228A":"⊊","\u2ABF":"⪿","\u2979":"⥹","\u2AC7":"⫇","\u2AD5":"⫕","\u2AD3":"⫓","\u266A":"♪","\xB9":"¹","\xB2":"²","\xB3":"³","\u2AC6":"⫆","\u2ABE":"⪾","\u2AD8":"⫘","\u2AC4":"⫄","\u27C9":"⟉","\u2AD7":"⫗","\u297B":"⥻","\u2AC2":"⫂","\u2ACC":"⫌","\u228B":"⊋","\u2AC0":"⫀","\u2AC8":"⫈","\u2AD4":"⫔","\u2AD6":"⫖","\u21D9":"⇙","\u292A":"⤪",\u00DF:"ß","\u2316":"⌖",\u03C4:"τ",\u0165:"ť",\u0163:"ţ",\u0442:"т","\u2315":"⌕","\u{1D531}":"𝔱",\u03B8:"θ",\u03D1:"ϑ",\u00FE:"þ","\xD7":"×","\u2A31":"⨱","\u2A30":"⨰","\u2336":"⌶","\u2AF1":"⫱","\u{1D565}":"𝕥","\u2ADA":"⫚","\u2034":"‴","\u25B5":"▵","\u225C":"≜","\u25EC":"◬","\u2A3A":"⨺","\u2A39":"⨹","\u29CD":"⧍","\u2A3B":"⨻","\u23E2":"⏢","\u{1D4C9}":"𝓉",\u0446:"ц",\u045B:"ћ",\u0167:"ŧ","\u2963":"⥣",\u00FA:"ú",\u045E:"ў",\u016D:"ŭ",\u00FB:"û",\u0443:"у",\u0171:"ű","\u297E":"⥾","\u{1D532}":"𝔲",\u00F9:"ù","\u2580":"▀","\u231C":"⌜","\u230F":"⌏","\u25F8":"◸",\u016B:"ū",\u0173:"ų","\u{1D566}":"𝕦",\u03C5:"υ","\u21C8":"⇈","\u231D":"⌝","\u230E":"⌎",\u016F:"ů","\u25F9":"◹","\u{1D4CA}":"𝓊","\u22F0":"⋰",\u0169:"ũ",\u00FC:"ü","\u29A7":"⦧","\u2AE8":"⫨","\u2AE9":"⫩","\u299C":"⦜","\u228A\uFE00":"⊊︀","\u2ACB\uFE00":"⫋︀","\u228B\uFE00":"⊋︀","\u2ACC\uFE00":"⫌︀",\u0432:"в","\u22BB":"⊻","\u225A":"≚","\u22EE":"⋮","\u{1D533}":"𝔳","\u{1D567}":"𝕧","\u{1D4CB}":"𝓋","\u299A":"⦚",\u0175:"ŵ","\u2A5F":"⩟","\u2259":"≙","\u2118":"℘","\u{1D534}":"𝔴","\u{1D568}":"𝕨","\u{1D4CC}":"𝓌","\u{1D535}":"𝔵",\u03BE:"ξ","\u22FB":"⋻","\u{1D569}":"𝕩","\u{1D4CD}":"𝓍",\u00FD:"ý",\u044F:"я",\u0177:"ŷ",\u044B:"ы","\xA5":"¥","\u{1D536}":"𝔶",\u0457:"ї","\u{1D56A}":"𝕪","\u{1D4CE}":"𝓎",\u044E:"ю",\u00FF:"ÿ",\u017A:"ź",\u017E:"ž",\u0437:"з",\u017C:"ż",\u03B6:"ζ","\u{1D537}":"𝔷",\u0436:"ж","\u21DD":"⇝","\u{1D56B}":"𝕫","\u{1D4CF}":"𝓏","\u200D":"‍","\u200C":"‌"}}}});var ex=we(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});cp.numericUnicodeMap={0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}});var tx=we(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.fromCodePoint=String.fromCodePoint||function(n){return String.fromCharCode(Math.floor((n-65536)/1024)+55296,(n-65536)%1024+56320)};Js.getCodePoint=String.prototype.codePointAt?function(n,t){return n.codePointAt(t)}:function(n,t){return(n.charCodeAt(t)-55296)*1024+n.charCodeAt(t+1)-56320+65536};Js.highSurrogateFrom=55296;Js.highSurrogateTo=56319});var ax=we(Ao=>{"use strict";var Qs=Ao&&Ao.__assign||function(){return Qs=Object.assign||function(n){for(var t,e=1,i=arguments.length;e'"&]/g,nonAscii:/[<>'"&\u0080-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintable:/[<>'"&\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintableOnly:/[\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,extensive:/[\x01-\x0c\x0e-\x1f\x21-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7d\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g},KF={mode:"specialChars",level:"all",numeric:"decimal"};function GF(n,t){var e=t===void 0?KF:t,i=e.mode,r=i===void 0?"specialChars":i,o=e.numeric,s=o===void 0?"decimal":o,a=e.level,c=a===void 0?"all":a;if(!n)return"";var l=jF[r],d=up[c].characters,h=s==="hexadecimal";return rx(n,l,function(u){var f=d[u];if(!f){var p=u.length>1?nx.getCodePoint(u,0):u.charCodeAt(0);f=(h?"&#x"+p.toString(16):"&#"+p)+";"}return f})}Ao.encode=GF;var XF={scope:"body",level:"all"},dp=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g,hp=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g,ix={xml:{strict:dp,attribute:hp,body:bc.bodyRegExps.xml},html4:{strict:dp,attribute:hp,body:bc.bodyRegExps.html4},html5:{strict:dp,attribute:hp,body:bc.bodyRegExps.html5}},ZF=Qs(Qs({},ix),{all:ix.html5}),ox=String.fromCharCode,YF=ox(65533),JF={level:"all"};function sx(n,t,e,i){var r=n,o=n[n.length-1];if(e&&o==="=")r=n;else if(i&&o!==";")r=n;else{var s=t[n];if(s)r=s;else if(n[0]==="&"&&n[1]==="#"){var a=n[2],c=a=="x"||a=="X"?parseInt(n.substr(3),16):parseInt(n.substr(2));r=c>=1114111?YF:c>65535?nx.fromCodePoint(c):ox(WF.numericUnicodeMap[c]||c)}}return r}function QF(n,t){var e=(t===void 0?JF:t).level,i=e===void 0?"all":e;return n?sx(n,up[i].entities,!1,!1):""}Ao.decodeEntity=QF;function _F(n,t){var e=t===void 0?XF:t,i=e.level,r=i===void 0?"all":i,o=e.scope,s=o===void 0?r==="xml"?"strict":"body":o;if(!n)return"";var a=ZF[r][s],c=up[r].entities,l=s==="attribute",d=s==="strict";return rx(n,a,function(h){return sx(h,c,l,d)})}Ao.decode=_F});var dx=we(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.isBlock=rt.parse=rt.Matcher=rt.HTMLElement=rt.CommentNode=rt.TextNode=rt.AbstractNode=rt.NodeType=void 0;var _s=ax(),Ti=!1,yt;(function(n){n[n.ELEMENT_NODE=1]="ELEMENT_NODE",n[n.TEXT_NODE=3]="TEXT_NODE",n[n.COMMENT_NODE=8]="COMMENT_NODE"})(yt||(rt.NodeType=yt={}));var Oo=class{constructor(){this.childNodes=[]}get text(){return(0,_s.decode)(this.rawText)}remove(){return this.parentNode&&this.parentNode.removeChild(this),this}};rt.AbstractNode=Oo;var Lo=class extends Oo{constructor(t){super(),this.nodeType=yt.TEXT_NODE,this.value=t}get rawText(){return this.value}get isWhitespace(){return/^(\s| )*$/.test(this.rawText)}toString(){return this.rawText}};rt.TextNode=Lo;var Jd=class extends Oo{constructor(t){super(),this.nodeType=yt.COMMENT_NODE,this.value=t}get rawText(){return this.value}toString(){return``}};rt.CommentNode=Jd;var $F={div:!0,p:!0,li:!0,td:!0,section:!0,br:!0};function $s(n){return n[n.length-1]}var hi=class extends Oo{constructor(t,e="",i=null){super(),this.tagName=t,this.rawAttrs=e,this.classNames=[],this.nodeType=yt.ELEMENT_NODE,this.rawAttrs=e,this.parentNode=i,this.childNodes=[];let r={};for(let o;o=eP.exec(e);)r[o[2]]=o[4]||o[5]||o[6];r.id&&(this.id=r.id),r.class&&(this.classNames=r.class.split(/\s+/))}removeChild(t){this.childNodes=this.childNodes.filter(e=>e!==t),t instanceof hi&&(t.parentNode=null)}exchangeChild(t,e){let i=this.childNodes.findIndex(r=>r===t);i>=0&&(this.childNodes[i]=e,t instanceof hi&&(t.parentNode=null))}get rawText(){let t="";for(let e=0;e0&&e.push(t=[]),r.childNodes.forEach(i),t.length>0&&e.push(t=[])):r.childNodes.forEach(i);else if(r.nodeType===yt.TEXT_NODE)if(r.isWhitespace)t.prependWhitespace=!0;else{let o=r.text;t.prependWhitespace&&(o=" "+o,t.prependWhitespace=!1),t.push(o)}}return i(this),e.map(function(r){return r.join("").trim().replace(/\s{2,}/g," ")}).join(` +`).replace(/\s+$/,"")}get children(){return this.childNodes.filter(t=>t instanceof hi)}toString(){let t=this.tagName;if(t){let e=/^(img|br|hr|area|base|input|doctype|link|meta)$/i.test(t),i=this.rawAttrs?" "+this.rawAttrs:"";return e?`<${t}${i} />`:`<${t}${i}>${this.innerHTML}`}else return this.innerHTML}get innerHTML(){return this.childNodes.map(t=>t.toString()).join("")}set innerHTML(t){let e=pp(t);this.childNodes.forEach(i=>i.remove()),e.childNodes.forEach(i=>this.appendChild(i))}set_content(t){if(t instanceof Oo)t=[t];else if(typeof t=="string"){let e=pp(t);t=e.childNodes.length?e.childNodes:[new Lo(t)]}this.childNodes=t}get outerHTML(){return this.toString()}trimRight(t){for(let e=0;e-1&&(i.value=i.rawText.substr(0,r),this.childNodes.length=e+1)}}return this}get structure(){let t=[],e=0;function i(o){t.push(" ".repeat(e)+o)}function r(o){let s=o.id?"#"+o.id:"",a=o.classNames.length?"."+o.classNames.join("."):"";i(o.tagName+s+a),e++;for(let c=0;cthis.querySelectorAll(a.trim())).flat());return Array.from(s)}else return this.querySelectorAll(new Io(t));let e=t,i=new Set,r=[];for(this.childNodes.forEach(o=>r.push(o));r.length>0;){let o=r.shift();o.nodeType===yt.ELEMENT_NODE&&(e.advance(o)&&e.matched&&(i.add(o),e.rewind()),o.childNodes.forEach(s=>{r.push(s)}))}return Array.from(i)}querySelector(t){let e;t instanceof Io?(e=t,e.reset()):e=new Io(t);let i=[];for(let r=0;rr+(i[r]===""?"":'="'+(0,_s.encode)(i[r])+'"')).join(" ")}removeAttribute(t){this.setAttribute(t,void 0)}setAttributes(t){t.id?this.id=t.id:t.class&&(this.classNames=t.class.split(/\s+/)),this.attributes&&(Object.keys(this.attributes).forEach(e=>delete this.attributes[e]),Object.keys(t).forEach(e=>this.attributes[e]=t[e]+"")),this.rawAttributes&&(Object.keys(this.rawAttributes).forEach(e=>delete this.rawAttributes[e]),Object.keys(t).forEach(e=>this.rawAttributes[e]=(0,_s.encode)(t[e]+""))),this.rawAttrs=Object.keys(t).map(e=>e+(t[e]===""?"":'="'+(0,_s.encode)(t[e]+"")+'"')).join(" ")}};rt.HTMLElement=hi;var Yd={},fp={f145:function(n,t,e,i,r){"use strict";if(t=t||"",e=e||[],i=i||"",r=r||"",n.id!=t.substr(1))return!1;for(let o=e,s=0;s{if(Yd[e])return Yd[e];let i=e.split("."),r=i[0],o=i.slice(1).sort(),s='"use strict";',a="f",c="",l="";if(r&&r!="*"){let h;if(r[0]=="#")s+="if (el.id != "+JSON.stringify(r.substr(1))+") return false;",a+="1";else if(h=r.match(/^\[\s*(\S+)\s*(=|!=)\s*((((["'])([^\6]*)\6))|(\S*?))\]\s*/)){c=h[1];let u=h[2];if(u!=="="&&u!=="!=")throw new Error("Selector not supported, Expect [key${op}value].op must be =,!=");u==="="&&(u="=="),l=h[7]||h[8],s+=`let attrs = el.attributes;for (let key in attrs){const val = attrs[key]; if (key == "${c}" && val == "${l}"){return true;}} return false;`,a+="2"}else s+="if (el.tagName != "+JSON.stringify(r)+") return false;",a+="3"}o.length>0&&(s+="for (let cls = "+JSON.stringify(o)+", i = 0; i < cls.length; i++) if (el.classNames.indexOf(cls[i]) === -1) return false;",a+="4"),s+="return true;",a+="5";let d={func:fp[a],tagName:r||"",classes:o||"",attr_key:c||"",value:l||""};return s=s||"",Yd[e]=d})}advance(t){return this.nextMatch)-->|<(\/?)([a-z][-.:0-9_a-z]*)((\s+[a-z][-.:0-9_a-z]*(\s*=\s*("[^"]*"|'([^']*')|([^\s\/>]+)))?)*)\s*(\/?)>/ig,eP=/(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig,tP=/([a-z][-.:0-9_a-z]*)(\s*=\s*("([^"]*)"|'([^']*)'|(\S+)))?/ig,iP={area:!0,base:!0,br:!0,col:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,source:!0},lx={li:{li:!0},p:{p:!0,div:!0},b:{div:!0},td:{td:!0,th:!0},th:{td:!0,th:!0},h1:{h1:!0},h2:{h2:!0},h3:{h3:!0},h4:{h4:!0},h5:{h5:!0},h6:{h6:!0}},cx={li:{ul:!0,ol:!0},a:{div:!0},b:{div:!0},i:{div:!0},p:{div:!0},td:{tr:!0,table:!0},th:{tr:!0,table:!0}},nP={script:!0,noscript:!0,style:!0,pre:!0};function pp(n,t){let e=new hi(null),i=e,r=[e],o=0;t=t||{};let s;for(;s=An.exec(n);){if(Ti&&console.log("match",s[0]),o+s[0].length",c=n.indexOf(a,An.lastIndex);if(t[s[2]]){let l;c==-1?l=n.substr(An.lastIndex):l=n.substring(An.lastIndex,c),l.length>0&&(Ti&&console.log("add text node as child of",s[2]),i.appendChild(new Lo(l)))}c==-1?o=An.lastIndex=n.length+1:(o=An.lastIndex=c+a.length,s[1]="true")}if(s[1]||s[9]||iP[s[2]])for(;;)if(i.tagName==s[2]){Ti&&console.log("met the end of",s[2]),r.pop(),i=$s(r);break}else{if(cx[i.tagName]&&cx[i.tagName][s[2]]){Ti&&console.log("closing",i.tagName,"due to meeting",s[2]),r.pop(),i=$s(r);continue}break}}for(o1;){let a=r.pop(),c=$s(r);a.parentNode&&a.parentNode instanceof hi&&a.parentNode.parentNode&&(a.parentNode===c&&a.tagName===c.tagName?(Ti&&console.log(a.tagName,"is probably supposed to close",c.tagName),c.removeChild(a),a.childNodes.forEach(l=>{c.parentNode.appendChild(l)}),r.pop()):(Ti&&console.log("no close tag found for",a.tagName,". Removing"),c.removeChild(a),a.childNodes.forEach(l=>{c.appendChild(l)})))}return e}rt.parse=pp;var rP=["html","body","address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","header","hr","li","main","nav","noscript","ol","p","pre","section","tfoot","table","tbody","ul","video","th","td","tr","h1","h2","h3","h4","h5","h6"];function oP(n){return n.nodeType===yt.ELEMENT_NODE&&n.tagName&&rP.includes(n.tagName.toLowerCase())}rt.isBlock=oP});var YP={};eu(YP,{default:()=>_h});module.exports=py(YP);var De=require("obsidian");var xp={};eu(xp,{AFRelationship:()=>ms,AcroButtonFlags:()=>ct,AcroChoiceFlags:()=>se,AcroFieldFlags:()=>Lt,AcroTextFlags:()=>Ie,AnnotationFlags:()=>xo,AppearanceCharacteristics:()=>Ds,BlendMode:()=>Si,Cache:()=>lt,CharCodes:()=>y,ColorTypes:()=>Po,CombedTextLayoutError:()=>uc,CorruptPageTreeError:()=>cs,CustomFontEmbedder:()=>rr,CustomFontSubsetEmbedder:()=>md,Duplex:()=>Ps,EncryptedPDFError:()=>ko,ExceededMaxLengthError:()=>fc,FieldAlreadyExistsError:()=>js,FieldExistsAsNonTerminalError:()=>Qf,FileEmbedder:()=>bd,FillRule:()=>Wi,FontkitNotRegisteredError:()=>sc,ForeignPageError:()=>ac,ImageAlignment:()=>oi,IndexOutOfBoundsError:()=>un,InvalidAcroFieldValueError:()=>fn,InvalidFieldNamePartError:()=>dc,InvalidMaxLengthError:()=>pc,InvalidPDFDateStringError:()=>qr,InvalidTargetIndexError:()=>ls,JpegEmbedder:()=>xs,LineCapStyle:()=>Qt,LineJoinStyle:()=>yo,MethodNotImplementedError:()=>Ge,MissingCatalogError:()=>of,MissingDAEntryError:()=>nl,MissingKeywordError:()=>ul,MissingOnValueCheckError:()=>Jf,MissingPDFHeaderError:()=>hl,MissingPageContentsEmbeddingError:()=>_a,MissingTfOperatorError:()=>rl,MultiSelectValueError:()=>il,NextByteAssertionError:()=>ol,NoSuchFieldError:()=>cc,NonFullScreenPageMode:()=>eo,NumberParsingError:()=>ds,PDFAcroButton:()=>or,PDFAcroCheckBox:()=>xn,PDFAcroChoice:()=>Ss,PDFAcroComboBox:()=>yn,PDFAcroField:()=>ks,PDFAcroForm:()=>ar,PDFAcroListBox:()=>kn,PDFAcroNonTerminal:()=>wn,PDFAcroPushButton:()=>Fn,PDFAcroRadioButton:()=>Pn,PDFAcroSignature:()=>sr,PDFAcroTerminal:()=>Ct,PDFAcroText:()=>vn,PDFAnnotation:()=>vd,PDFArray:()=>H,PDFArrayIsNotRectangleError:()=>tl,PDFBool:()=>wi,PDFButton:()=>di,PDFCatalog:()=>Cs,PDFCheckBox:()=>Rt,PDFContentStream:()=>Hi,PDFContext:()=>Yr,PDFCrossRefSection:()=>us,PDFCrossRefStream:()=>fd,PDFDict:()=>R,PDFDocument:()=>pe,PDFDropdown:()=>ai,PDFEmbeddedPage:()=>ki,PDFField:()=>et,PDFFlateStream:()=>er,PDFFont:()=>Se,PDFForm:()=>Tn,PDFHeader:()=>Bi,PDFHexString:()=>M,PDFImage:()=>ri,PDFInvalidObject:()=>gs,PDFInvalidObjectParsingError:()=>al,PDFJavaScript:()=>Cn,PDFName:()=>x,PDFNull:()=>Me,PDFNumber:()=>N,PDFObject:()=>fe,PDFObjectCopier:()=>bl,PDFObjectParser:()=>As,PDFObjectParsingError:()=>sl,PDFObjectStream:()=>fs,PDFObjectStreamParser:()=>Dd,PDFOperator:()=>_,PDFOperatorNames:()=>ee,PDFOptionList:()=>li,PDFPage:()=>ke,PDFPageEmbedder:()=>Fs,PDFPageLeaf:()=>it,PDFPageTree:()=>Es,PDFParser:()=>jl,PDFParsingError:()=>yi,PDFRadioGroup:()=>Vt,PDFRawStream:()=>vi,PDFRef:()=>q,PDFSignature:()=>Di,PDFStream:()=>Pe,PDFStreamParsingError:()=>ll,PDFStreamWriter:()=>pd,PDFString:()=>G,PDFTextField:()=>ci,PDFTrailer:()=>tr,PDFTrailerDict:()=>ud,PDFWidgetAnnotation:()=>oo,PDFWriter:()=>ps,PDFXRefStreamParser:()=>Sd,PageEmbeddingMismatchedContextError:()=>el,PageSizes:()=>So,ParseSpeeds:()=>gc,PngEmbedder:()=>ws,PrintScaling:()=>io,PrivateConstructorError:()=>dn,ReadingDirection:()=>to,RemovePageFromEmptyDocumentError:()=>lc,ReparseError:()=>hn,RichTextFieldReadError:()=>hc,RotationTypes:()=>Ls,StalledParserError:()=>dl,StandardFontEmbedder:()=>nr,StandardFontValues:()=>H0,StandardFonts:()=>Do,TextAlignment:()=>He,TextRenderingMode:()=>Sf,UnbalancedParenthesisError:()=>cl,UnexpectedFieldTypeError:()=>Pi,UnexpectedObjectTypeError:()=>Vi,UnrecognizedStreamTypeError:()=>$a,UnsupportedEncodingError:()=>Qa,ViewerPreferences:()=>Al,addRandomSuffix:()=>my,adjustDimsForRotation:()=>qi,appendBezierCurve:()=>mt,appendQuadraticCurve:()=>Rs,arrayAsString:()=>rn,asNumber:()=>$,asPDFName:()=>Is,asPDFNumber:()=>j,assertEachIs:()=>Xa,assertInteger:()=>rf,assertIs:()=>S,assertIsOneOf:()=>Gt,assertIsOneOfOrUndefined:()=>pt,assertIsSubset:()=>nf,assertMultiple:()=>Za,assertOrUndefined:()=>I,assertPositive:()=>cn,assertRange:()=>at,assertRangeOrUndefined:()=>St,backtick:()=>Ke,beginMarkedContent:()=>Id,beginText:()=>Ql,breakTextIntoLines:()=>au,byAscendingId:()=>du,bytesFor:()=>Gn,canBeConvertedToUint8Array:()=>gu,charAtIndex:()=>jc,charFromCode:()=>Pt,charFromHexCode:()=>ru,charSplit:()=>su,cleanText:()=>Wn,clip:()=>Gl,clipEvenOdd:()=>nF,closePath:()=>$t,cmyk:()=>Bd,colorString:()=>zf,colorToComponents:()=>Hd,componentsToColor:()=>dt,concatTransformationMatrix:()=>_t,copyStringIntoBuffer:()=>be,createPDFAcroField:()=>Fd,createPDFAcroFields:()=>Ts,createTypeErrorMsg:()=>K0,createValueErrorMsg:()=>q0,decodeFromBase64:()=>tu,decodeFromBase64DataUri:()=>nu,decodePDFRawStream:()=>vs,defaultButtonAppearanceProvider:()=>tp,defaultCheckBoxAppearanceProvider:()=>$f,defaultDropdownAppearanceProvider:()=>np,defaultOptionListAppearanceProvider:()=>rp,defaultRadioGroupAppearanceProvider:()=>ep,defaultTextFieldAppearanceProvider:()=>ip,degrees:()=>X,degreesToRadians:()=>Yt,drawButton:()=>zd,drawCheckBox:()=>qs,drawCheckMark:()=>Kb,drawEllipse:()=>rc,drawEllipsePath:()=>jb,drawImage:()=>oc,drawLine:()=>Xf,drawLinesOfText:()=>Kf,drawObject:()=>Bs,drawOptionList:()=>Yf,drawPage:()=>Gf,drawRadioButton:()=>Ws,drawRectangle:()=>ur,drawSvgPath:()=>Zf,drawText:()=>MF,drawTextField:()=>Wd,drawTextLines:()=>qd,encodeToBase64:()=>iu,endMarkedContent:()=>Ld,endPath:()=>Yl,endText:()=>_l,error:()=>Xn,escapeRegExp:()=>Tg,escapedNewlineChars:()=>Cg,fill:()=>Xl,fillAndStroke:()=>Zl,fillEvenOdd:()=>Tf,findLastMatch:()=>Xo,getType:()=>W0,grayscale:()=>Vd,hasSurrogates:()=>xu,hasUtf16BOM:()=>Sa,highSurrogate:()=>Kc,isArrayEqual:()=>Zo,isNewlineChar:()=>ou,isStandardFont:()=>dd,isType:()=>j0,isWithinBMP:()=>bu,last:()=>Ir,layoutCombedText:()=>_f,layoutMultilineText:()=>jd,layoutSinglelineText:()=>Ks,lineSplit:()=>va,lineTo:()=>Ve,lowSurrogate:()=>Gc,mergeIntoTypedArray:()=>lu,mergeLines:()=>Wc,mergeUint8Arrays:()=>cu,moveText:()=>lF,moveTo:()=>Et,newlineChars:()=>by,nextLine:()=>Cf,normalizeAppearance:()=>Nt,numberToString:()=>yu,padStart:()=>kt,parseDate:()=>Fa,pdfDocEncodingDecode:()=>Ya,pluckIndices:()=>pu,popGraphicsState:()=>Re,pushGraphicsState:()=>Ne,radians:()=>iF,radiansToDegrees:()=>bb,range:()=>fu,rectangle:()=>xb,rectanglesAreEqual:()=>as,reduceRotation:()=>Jt,restoreDashPattern:()=>oF,reverseArray:()=>jn,rgb:()=>ne,rotateAndSkewTextDegreesAndTranslate:()=>fF,rotateAndSkewTextRadiansAndTranslate:()=>Vs,rotateDegrees:()=>Os,rotateInPlace:()=>ti,rotateRadians:()=>dr,rotateRectangle:()=>Df,scale:()=>cr,setCharacterSpacing:()=>cF,setCharacterSqueeze:()=>hF,setDashPattern:()=>wo,setFillingCmykColor:()=>Mf,setFillingColor:()=>ei,setFillingGrayscaleColor:()=>Af,setFillingRgbColor:()=>Lf,setFontAndSize:()=>Fo,setGraphicsState:()=>ji,setLineCap:()=>Ns,setLineHeight:()=>Ef,setLineJoin:()=>sF,setLineWidth:()=>Dn,setStrokingCmykColor:()=>Nf,setStrokingColor:()=>Sn,setStrokingGrayscaleColor:()=>If,setStrokingRgbColor:()=>Of,setTextMatrix:()=>yb,setTextRenderingMode:()=>Ad,setTextRise:()=>uF,setWordSpacing:()=>dF,showText:()=>Jl,singleQuote:()=>z0,sizeInBytes:()=>Yo,skewDegrees:()=>rF,skewRadians:()=>Ms,sortedUniq:()=>hu,square:()=>aF,stringAsByteArray:()=>Go,stroke:()=>vo,sum:()=>uu,toCharCode:()=>Q,toCodePoint:()=>qc,toDegrees:()=>Kl,toHexString:()=>Ii,toHexStringOfMinLength:()=>Ai,toRadians:()=>qe,toUint8Array:()=>Lr,translate:()=>gt,typedArrayFor:()=>Pa,utf16Decode:()=>Da,utf16Encode:()=>mu,utf8Encode:()=>wy,values:()=>ss,waitForTick:()=>mi});var Ko="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wa=new Uint8Array(256);for(let n=0;n{let t="",e=n.length;for(let i=0;i>2],t+=Ko[(n[i]&3)<<4|n[i+1]>>4],t+=Ko[(n[i+1]&15)<<2|n[i+2]>>6],t+=Ko[n[i+2]&63];return e%3===2?t=t.substring(0,t.length-1)+"=":e%3===1&&(t=t.substring(0,t.length-2)+"=="),t},tu=n=>{let t=n.length*.75,e=n.length,i,r=0,o,s,a,c;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);let l=new Uint8Array(t);for(i=0;i>4,l[r++]=(s&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return l},gy=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,nu=n=>{let t=n.trim(),i=t.substring(0,100).match(gy);if(!i)return tu(t);let[r]=i,o=t.substring(r.length);return tu(o)};var Q=n=>n.charCodeAt(0),qc=n=>n.codePointAt(0),Ai=(n,t)=>kt(n.toString(16),t,"0").toUpperCase(),Ii=n=>Ai(n,2),Pt=n=>String.fromCharCode(n),ru=n=>Pt(parseInt(n,16)),kt=(n,t,e)=>{let i="";for(let r=0,o=t-n.length;r{let t=new Uint8Array(n.length);return be(n,t,0),t},be=(n,t,e)=>{let i=n.length;for(let r=0;r`${n}-${Math.floor(Math.random()*10**t)}`,Tg=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Wn=n=>n.replace(/\t|\u0085|\u2028|\u2029/g," ").replace(/[\b\v]/g,""),Cg=["\\n","\\f","\\r","\\u000B"],by=[` +`,"\f","\r","\v"],ou=n=>/^[\n\f\r\u000B]$/.test(n),va=n=>n.split(/[\n\f\r\u000B]/),Wc=n=>n.replace(/[\n\f\r\u000B]/g," "),jc=(n,t)=>{let e=n.charCodeAt(t),i,r=t+1,o=1;return e>=55296&&e<=56319&&n.length>r&&(i=n.charCodeAt(r),i>=56320&&i<=57343&&(o=2)),[n.slice(t,t+o),o]},su=n=>{let t=[];for(let e=0,i=n.length;e{let t=Cg.join("|"),e=["$"];for(let r=0,o=n.length;r{let r=xy(t),o=Wn(n).match(r),s="",a=0,c=[],l=()=>{s!==""&&c.push(s),s="",a=0};for(let d=0,h=o.length;de&&l(),s+=u,a+=f}}return l(),c},yy=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,Fa=n=>{let t=n.match(yy);if(!t)return;let[,e,i="01",r="01",o="00",s="00",a="00",c="Z",l="00",d="00"]=t,h=c==="Z"?"Z":`${c}${l}:${d}`;return new Date(`${e}-${i}-${r}T${o}:${s}:${a}${h}`)},Xo=(n,t)=>{var e;let i=0,r;for(;in[n.length-1],Pa=n=>{if(n instanceof Uint8Array)return n;let t=n.length,e=new Uint8Array(t);for(let i=0;i{let t=n.length,e=[];for(let s=0;s{let t=0;for(let r=0,o=n.length;r{let t="";for(let e=0,i=n.length;en.id-t.id,hu=(n,t)=>{let e=[];for(let i=0,r=n.length;i{if(n.length!==t.length)return!1;for(let e=0,i=n.length;e{let t=n.length;for(let e=0,i=Math.floor(t/2);e{let t=0;for(let e=0,i=n.length;e{let e=new Array(t-n);for(let i=0,r=e.length;i{let e=new Array(t.length);for(let i=0,r=t.length;in instanceof Uint8Array||n instanceof ArrayBuffer||typeof n=="string",Lr=n=>{if(typeof n=="string")return nu(n);if(n instanceof ArrayBuffer)return new Uint8Array(n);if(n instanceof Uint8Array)return n;throw new TypeError("`input` must be one of `string | ArrayBuffer | Uint8Array`")};var mi=()=>new Promise(n=>{setTimeout(()=>n(),0)});var wy=(n,t=!0)=>{let e=[];t&&e.push(239,187,191);for(let i=0,r=n.length;i>6&31|192,a=o&63|128;e.push(s,a),i+=1}else if(o<65536){let s=o>>12&15|224,a=o>>6&63|128,c=o&63|128;e.push(s,a,c),i+=1}else if(o<1114112){let s=o>>18&7|240,a=o>>12&63|128,c=o>>6&63|128,l=o>>0&63|128;e.push(s,a,c,l),i+=2}else throw new Error(`Invalid code point: 0x${Ii(o)}`)}return new Uint8Array(e)},mu=(n,t=!0)=>{let e=[];t&&e.push(65279);for(let i=0,r=n.length;in>=0&&n<=65535,xu=n=>n>=65536&&n<=1114111,Kc=n=>Math.floor((n-65536)/1024)+55296,Gc=n=>(n-65536)%1024+56320,Kn;(function(n){n.BigEndian="BigEndian",n.LittleEndian="LittleEndian"})(Kn||(Kn={}));var ka="\uFFFD".codePointAt(0),Da=(n,t=!0)=>{if(n.length<=1)return String.fromCodePoint(ka);let e=t?Fy(n):Kn.BigEndian,i=t?2:0,r=[];for(;n.length-i>=2;){let o=Ag(n[i++],n[i++],e);if(vy(o))if(n.length-i<2)r.push(ka);else{let s=Ag(n[i++],n[i++],e);Eg(s)?r.push(o,s):r.push(ka)}else Eg(o)?(i+=2,r.push(ka)):r.push(o)}return in>=55296&&n<=56319,Eg=n=>n>=56320&&n<=57343,Ag=(n,t,e)=>{if(e===Kn.LittleEndian)return t<<8|n;if(e===Kn.BigEndian)return n<<8|t;throw new Error(`Invalid byteOrder: ${e}`)},Fy=n=>Ig(n)?Kn.BigEndian:Lg(n)?Kn.LittleEndian:Kn.BigEndian,Ig=n=>n[0]===254&&n[1]===255,Lg=n=>n[0]===255&&n[1]===254,Sa=n=>Ig(n)||Lg(n);var yu=n=>{let t=String(n);if(Math.abs(n)<1){let e=parseInt(n.toString().split("e-")[1]);if(e){let i=n<0;i&&(n*=-1),n*=Math.pow(10,e-1),t="0."+new Array(e).join("0")+n.toString().substring(2),i&&(t="-"+t)}}else{let e=parseInt(n.toString().split("+")[1]);e>20&&(e-=20,n/=Math.pow(10,e),t=n.toString()+new Array(e+1).join("0"))}return t},Yo=n=>Math.ceil(n.toString(2).length/8),Gn=n=>{let t=new Uint8Array(Yo(n));for(let e=1;e<=t.length;e++)t[e-1]=n>>(t.length-e)*8;return t};var Xn=n=>{throw new Error(n)};var w0=qn(Wa()),y0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ka=new Uint8Array(256);for(ja=0;ja>4,l[r++]=(s&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return l},mv=function(n){for(var t="",e=0;eObject.keys(n).map(t=>n[t]),H0=ss(zr),dd=n=>H0.includes(n),as=(n,t)=>n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.height;var Ke=n=>`\`${n}\``,z0=n=>`'${n}'`,U0=n=>{let t=typeof n;return t==="string"?z0(n):t==="undefined"?Ke(n):n},q0=(n,t,e)=>{let i=new Array(e.length);for(let o=0,s=e.length;o{Array.isArray(e)||(e=ss(e));for(let i=0,r=e.length;i{Array.isArray(e)||(e=ss(e)),Gt(n,t,e.concat(void 0))},nf=(n,t,e)=>{Array.isArray(e)||(e=ss(e));for(let i=0,r=n.length;in===null?"null":n===void 0?"undefined":typeof n=="string"?"string":isNaN(n)?"NaN":typeof n=="number"?"number":typeof n=="boolean"?"boolean":typeof n=="symbol"?"symbol":typeof n=="bigint"?"bigint":n.constructor&&n.constructor.name?n.constructor.name:n.name?n.name:n.constructor?String(n.constructor):String(n),j0=(n,t)=>t==="null"?n===null:t==="undefined"?n===void 0:t==="string"?typeof n=="string":t==="number"?typeof n=="number"&&!isNaN(n):t==="boolean"?typeof n=="boolean":t==="symbol"?typeof n=="symbol":t==="bigint"?typeof n=="bigint":t===Date?n instanceof Date:t===Array?n instanceof Array:t===Uint8Array?n instanceof Uint8Array:t===ArrayBuffer?n instanceof ArrayBuffer:t===Function?n instanceof Function:n instanceof t[0],K0=(n,t,e)=>{let i=new Array(e.length);for(let o=0,s=e.length;o{for(let i=0,r=e.length;i{S(n,t,e.concat("undefined"))},Xa=(n,t,e)=>{for(let i=0,r=n.length;i{if(S(n,t,["number"]),S(e,"min",["number"]),S(i,"max",["number"]),i=Math.max(e,i),ni)throw new Error(`${Ke(t)} must be at least ${e} and at most ${i}, but was actually ${n}`)},St=(n,t,e,i)=>{S(n,t,["number","undefined"]),typeof n=="number"&&at(n,t,e,i)},Za=(n,t,e)=>{if(S(n,t,["number"]),n%e!==0)throw new Error(`${Ke(t)} must be a multiple of ${e}, but was actually ${n}`)},rf=(n,t)=>{if(!Number.isInteger(n))throw new Error(`${Ke(t)} must be an integer, but was actually ${n}`)},cn=(n,t)=>{if(![1,0].includes(Math.sign(n)))throw new Error(`${Ke(t)} must be a positive number or 0, but was actually ${n}`)};var ie=new Uint16Array(256);for(let n=0;n<256;n++)ie[n]=n;ie[22]=Q("");ie[24]=Q("\u02D8");ie[25]=Q("\u02C7");ie[26]=Q("\u02C6");ie[27]=Q("\u02D9");ie[28]=Q("\u02DD");ie[29]=Q("\u02DB");ie[30]=Q("\u02DA");ie[31]=Q("\u02DC");ie[127]=Q("\uFFFD");ie[128]=Q("\u2022");ie[129]=Q("\u2020");ie[130]=Q("\u2021");ie[131]=Q("\u2026");ie[132]=Q("\u2014");ie[133]=Q("\u2013");ie[134]=Q("\u0192");ie[135]=Q("\u2044");ie[136]=Q("\u2039");ie[137]=Q("\u203A");ie[138]=Q("\u2212");ie[139]=Q("\u2030");ie[140]=Q("\u201E");ie[141]=Q("\u201C");ie[142]=Q("\u201D");ie[143]=Q("\u2018");ie[144]=Q("\u2019");ie[145]=Q("\u201A");ie[146]=Q("\u2122");ie[147]=Q("\uFB01");ie[148]=Q("\uFB02");ie[149]=Q("\u0141");ie[150]=Q("\u0152");ie[151]=Q("\u0160");ie[152]=Q("\u0178");ie[153]=Q("\u017D");ie[154]=Q("\u0131");ie[155]=Q("\u0142");ie[156]=Q("\u0153");ie[157]=Q("\u0161");ie[158]=Q("\u017E");ie[159]=Q("\uFFFD");ie[160]=Q("\u20AC");ie[173]=Q("\uFFFD");var Ya=n=>{let t=new Array(n.length);for(let e=0,i=n.length;enew Ja(n);var lt=Ja;var Ge=class extends Error{constructor(t,e){let i=`Method ${t}.${e}() not implemented`;super(i)}},dn=class extends Error{constructor(t){let e=`Cannot construct ${t} - it has a private constructor`;super(e)}},Vi=class extends Error{constructor(t,e){let i=s=>{var a,c;return(a=s==null?void 0:s.name)!==null&&a!==void 0?a:(c=s==null?void 0:s.constructor)===null||c===void 0?void 0:c.name},o=`Expected instance of ${(Array.isArray(t)?t.map(i):[i(t)]).join(" or ")}, but got instance of ${e&&i(e)}`;super(o)}},Qa=class extends Error{constructor(t){let e=`${t} stream encoding not supported`;super(e)}},hn=class extends Error{constructor(t,e){let i=`Cannot call ${t}.${e}() more than once`;super(i)}},of=class extends Error{constructor(t){let e=`Missing catalog (ref=${t})`;super(e)}},_a=class extends Error{constructor(){let t="Can't embed page with missing Contents";super(t)}},$a=class extends Error{constructor(t){var e,i,r;let s=`Unrecognized stream type: ${(r=(i=(e=t==null?void 0:t.contructor)===null||e===void 0?void 0:e.name)!==null&&i!==void 0?i:t==null?void 0:t.name)!==null&&r!==void 0?r:t}`;super(s)}},el=class extends Error{constructor(){let t="Found mismatched contexts while embedding pages. All pages in the array passed to `PDFDocument.embedPages()` must be from the same document.";super(t)}},tl=class extends Error{constructor(t){let e=`Attempted to convert PDFArray with ${t} elements to rectangle, but must have exactly 4 elements.`;super(e)}},qr=class extends Error{constructor(t){let e=`Attempted to convert "${t}" to a date, but it does not match the PDF date string format.`;super(e)}},ls=class extends Error{constructor(t,e){let i=`Invalid targetIndex specified: targetIndex=${t} must be less than Count=${e}`;super(i)}},cs=class extends Error{constructor(t,e){let i=`Failed to ${e} at targetIndex=${t} due to corrupt page tree: It is likely that one or more 'Count' entries are invalid`;super(i)}},un=class extends Error{constructor(t,e,i){let r=`index should be at least ${e} and at most ${i}, but was actually ${t}`;super(r)}},fn=class extends Error{constructor(){let t="Attempted to set invalid field value";super(t)}},il=class extends Error{constructor(){let t="Attempted to select multiple values for single-select field";super(t)}},nl=class extends Error{constructor(t){let e=`No /DA (default appearance) entry found for field: ${t}`;super(e)}},rl=class extends Error{constructor(t){let e=`No Tf operator found for DA of field: ${t}`;super(e)}},ds=class extends Error{constructor(t,e){let i=`Failed to parse number (line:${t.line} col:${t.column} offset=${t.offset}): "${e}"`;super(i)}},yi=class extends Error{constructor(t,e){let i=`Failed to parse PDF document (line:${t.line} col:${t.column} offset=${t.offset}): ${e}`;super(i)}},ol=class extends yi{constructor(t,e,i){let r=`Expected next byte to be ${e} but it was actually ${i}`;super(t,r)}},sl=class extends yi{constructor(t,e){let i=`Failed to parse PDF object starting with the following byte: ${e}`;super(t,i)}},al=class extends yi{constructor(t){let e="Failed to parse invalid PDF object";super(t,e)}},ll=class extends yi{constructor(t){let e="Failed to parse PDF stream";super(t,e)}},cl=class extends yi{constructor(t){let e="Failed to parse PDF literal string due to unbalanced parenthesis";super(t,e)}},dl=class extends yi{constructor(t){let e="Parser stalled";super(t,e)}},hl=class extends yi{constructor(t){let e="No PDF header found";super(t,e)}},ul=class extends yi{constructor(t,e){let i=`Did not find expected keyword '${rn(e)}'`;super(t,i)}};var sf;(function(n){n[n.Null=0]="Null",n[n.Backspace=8]="Backspace",n[n.Tab=9]="Tab",n[n.Newline=10]="Newline",n[n.FormFeed=12]="FormFeed",n[n.CarriageReturn=13]="CarriageReturn",n[n.Space=32]="Space",n[n.ExclamationPoint=33]="ExclamationPoint",n[n.Hash=35]="Hash",n[n.Percent=37]="Percent",n[n.LeftParen=40]="LeftParen",n[n.RightParen=41]="RightParen",n[n.Plus=43]="Plus",n[n.Minus=45]="Minus",n[n.Dash=45]="Dash",n[n.Period=46]="Period",n[n.ForwardSlash=47]="ForwardSlash",n[n.Zero=48]="Zero",n[n.One=49]="One",n[n.Two=50]="Two",n[n.Three=51]="Three",n[n.Four=52]="Four",n[n.Five=53]="Five",n[n.Six=54]="Six",n[n.Seven=55]="Seven",n[n.Eight=56]="Eight",n[n.Nine=57]="Nine",n[n.LessThan=60]="LessThan",n[n.GreaterThan=62]="GreaterThan",n[n.A=65]="A",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.O=79]="O",n[n.P=80]="P",n[n.R=82]="R",n[n.LeftSquareBracket=91]="LeftSquareBracket",n[n.BackSlash=92]="BackSlash",n[n.RightSquareBracket=93]="RightSquareBracket",n[n.a=97]="a",n[n.b=98]="b",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.i=105]="i",n[n.j=106]="j",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.x=120]="x",n[n.LeftCurly=123]="LeftCurly",n[n.RightCurly=125]="RightCurly",n[n.Tilde=126]="Tilde"})(sf||(sf={}));var y=sf;var Q0=qn(Wa(),1);var fl=class{constructor(t,e){this.major=String(t),this.minor=String(e)}toString(){let t=Pt(129);return`%PDF-${this.major}.${this.minor} +%${t}${t}${t}${t}`}sizeInBytes(){return 12+this.major.length+this.minor.length}copyBytesInto(t,e){let i=e;return t[e++]=y.Percent,t[e++]=y.P,t[e++]=y.D,t[e++]=y.F,t[e++]=y.Dash,e+=be(this.major,t,e),t[e++]=y.Period,e+=be(this.minor,t,e),t[e++]=y.Newline,t[e++]=y.Percent,t[e++]=129,t[e++]=129,t[e++]=129,t[e++]=129,e-i}};fl.forVersion=(n,t)=>new fl(n,t);var Bi=fl;var af=class{clone(t){throw new Ge(this.constructor.name,"clone")}toString(){throw new Ge(this.constructor.name,"toString")}sizeInBytes(){throw new Ge(this.constructor.name,"sizeInBytes")}copyBytesInto(t,e){throw new Ge(this.constructor.name,"copyBytesInto")}},fe=af;var Wr=class extends fe{constructor(t){super(),this.numberValue=t,this.stringValue=yu(t)}asNumber(){return this.numberValue}value(){return this.numberValue}clone(){return Wr.of(this.numberValue)}toString(){return this.stringValue}sizeInBytes(){return this.stringValue.length}copyBytesInto(t,e){return e+=be(this.stringValue,t,e),this.stringValue.length}};Wr.of=n=>new Wr(n);var N=Wr;var jr=class extends fe{constructor(t){super(),this.array=[],this.context=t}size(){return this.array.length}push(t){this.array.push(t)}insert(t,e){this.array.splice(t,0,e)}indexOf(t){let e=this.array.indexOf(t);return e===-1?void 0:e}remove(t){this.array.splice(t,1)}set(t,e){this.array[t]=e}get(t){return this.array[t]}lookupMaybe(t,...e){return this.context.lookupMaybe(this.get(t),...e)}lookup(t,...e){return this.context.lookup(this.get(t),...e)}asRectangle(){if(this.size()!==4)throw new tl(this.size());let t=this.lookup(0,N).asNumber(),e=this.lookup(1,N).asNumber(),i=this.lookup(2,N).asNumber(),r=this.lookup(3,N).asNumber(),o=t,s=e,a=i-t,c=r-e;return{x:o,y:s,width:a,height:c}}asArray(){return this.array.slice()}clone(t){let e=jr.withContext(t||this.context);for(let i=0,r=this.size();inew jr(n);var H=jr;var lf={},Kr=class extends fe{constructor(t,e){if(t!==lf)throw new dn("PDFBool");super(),this.value=e}asBoolean(){return this.value}clone(){return this}toString(){return String(this.value)}sizeInBytes(){return this.value?4:5}copyBytesInto(t,e){return this.value?(t[e++]=y.t,t[e++]=y.r,t[e++]=y.u,t[e++]=y.e,4):(t[e++]=y.f,t[e++]=y.a,t[e++]=y.l,t[e++]=y.s,t[e++]=y.e,5)}};Kr.True=new Kr(lf,!0);Kr.False=new Kr(lf,!1);var wi=Kr;var Tt=new Uint8Array(256);Tt[y.LeftParen]=1;Tt[y.RightParen]=1;Tt[y.LessThan]=1;Tt[y.GreaterThan]=1;Tt[y.LeftSquareBracket]=1;Tt[y.RightSquareBracket]=1;Tt[y.LeftCurly]=1;Tt[y.RightCurly]=1;Tt[y.ForwardSlash]=1;Tt[y.Percent]=1;var Xt=new Uint8Array(256);Xt[y.Null]=1;Xt[y.Tab]=1;Xt[y.Newline]=1;Xt[y.FormFeed]=1;Xt[y.CarriageReturn]=1;Xt[y.Space]=1;var hd=new Uint8Array(256);for(let n=0,t=256;nn.replace(/#([\dABCDEF]{2})/g,(t,e)=>ru(e)),Nv=n=>n>=y.ExclamationPoint&&n<=y.Tilde&&!hd[n],X0={},G0=new Map,J=class extends fe{constructor(t,e){if(t!==X0)throw new dn("PDFName");super();let i="/";for(let r=0,o=e.length;r{o!==void 0&&t.push(o),i=!1};for(let o=1,s=this.encodedName.length;o=y.Zero&&c<=y.Nine||c>=y.a&&c<=y.f||c>=y.A&&c<=y.F?(e+=a,(e.length===2||!(l>="0"&&l<="9"||l>="a"&&l<="f"||l>="A"&&l<="F"))&&(r(parseInt(e,16)),e="")):r(c):c===y.Hash?i=!0:r(c)}return new Uint8Array(t)}decodeText(){let t=this.asBytes();return String.fromCharCode(...Array.from(t))}asString(){return this.encodedName}value(){return this.encodedName}clone(){return this}toString(){return this.encodedName}sizeInBytes(){return this.encodedName.length}copyBytesInto(t,e){return e+=be(this.encodedName,t,e),this.encodedName.length}};J.of=n=>{let t=Mv(n),e=G0.get(t);return e||(e=new J(X0,t),G0.set(t,e)),e};J.Length=J.of("Length");J.FlateDecode=J.of("FlateDecode");J.Resources=J.of("Resources");J.Font=J.of("Font");J.XObject=J.of("XObject");J.ExtGState=J.of("ExtGState");J.Contents=J.of("Contents");J.Type=J.of("Type");J.Parent=J.of("Parent");J.MediaBox=J.of("MediaBox");J.Page=J.of("Page");J.Annots=J.of("Annots");J.TrimBox=J.of("TrimBox");J.ArtBox=J.of("ArtBox");J.BleedBox=J.of("BleedBox");J.CropBox=J.of("CropBox");J.Rotate=J.of("Rotate");J.Title=J.of("Title");J.Author=J.of("Author");J.Subject=J.of("Subject");J.Creator=J.of("Creator");J.Keywords=J.of("Keywords");J.Producer=J.of("Producer");J.CreationDate=J.of("CreationDate");J.ModDate=J.of("ModDate");var x=J;var cf=class extends fe{asNull(){return null}clone(){return this}toString(){return"null"}sizeInBytes(){return 4}copyBytesInto(t,e){return t[e++]=y.n,t[e++]=y.u,t[e++]=y.l,t[e++]=y.l,4}},Me=new cf;var pn=class extends fe{constructor(t,e){super(),this.suppressEncryption=!1,this.dict=t,this.context=e}keys(){return Array.from(this.dict.keys())}values(){return Array.from(this.dict.values())}entries(){return Array.from(this.dict.entries())}set(t,e){this.dict.set(t,e)}get(t,e=!1){let i=this.dict.get(t);if(!(i===Me&&!e))return i}has(t){let e=this.dict.get(t);return e!==void 0&&e!==Me}lookupMaybe(t,...e){let i=e.includes(Me),r=this.context.lookupMaybe(this.get(t,i),...e);if(!(r===Me&&!i))return r}lookup(t,...e){let i=e.includes(Me),r=this.context.lookup(this.get(t,i),...e);if(!(r===Me&&!i))return r}delete(t){return this.dict.delete(t)}asMap(){return new Map(this.dict)}uniqueKey(t=""){let e=this.keys(),i=x.of(this.context.addRandomSuffix(t,10));for(;e.includes(i);)i=x.of(this.context.addRandomSuffix(t,10));return i}clone(t){let e=pn.withContext(t||this.context),i=this.entries();for(let r=0,o=i.length;rnew pn(new Map,n);pn.fromMapWithContext=(n,t)=>new pn(n,t);var R=pn;var gn=class extends fe{constructor(t){super(),this.value=t}asBytes(){let t=this.value+(this.value.length%2===1?"0":""),e=t.length,i=new Uint8Array(t.length/2),r=0,o=0;for(;r`}sizeInBytes(){return this.value.length+2}copyBytesInto(t,e){return t[e++]=y.LessThan,e+=be(this.value,t,e),t[e++]=y.GreaterThan,this.value.length+2}};gn.of=n=>new gn(n);gn.fromText=n=>{let t=mu(n),e="";for(let i=0,r=t.length;inew Gr(n,t,e);var vi=Gr;var Y0={},Z0=new Map,pl=class extends fe{constructor(t,e,i){if(t!==Y0)throw new dn("PDFRef");super(),this.objectNumber=e,this.generationNumber=i,this.tag=`${e} ${i} R`}clone(){return this}toString(){return this.tag}sizeInBytes(){return this.tag.length}copyBytesInto(t,e){return e+=be(this.tag,t,e),this.tag.length}};pl.of=(n,t=0)=>{let e=`${n} ${t} R`,i=Z0.get(e);return i||(i=new pl(Y0,n,t),Z0.set(e,i)),i};var q=pl;var mn=class extends fe{constructor(t){super(),this.value=t}asBytes(){let t=[],e="",i=!1,r=o=>{o!==void 0&&t.push(o),i=!1};for(let o=0,s=this.value.length;o=y.Zero&&c<=y.Seven?(e+=a,(e.length===3||!(l>="0"&&l<="7"))&&(r(parseInt(e,8)),e="")):r(c):c===y.BackSlash?i=!0:r(c)}return new Uint8Array(t)}decodeText(){let t=this.asBytes();return Sa(t)?Da(t):Ya(t)}decodeDate(){let t=this.decodeText(),e=Fa(t);if(!e)throw new qr(t);return e}asString(){return this.value}clone(){return mn.of(this.value)}toString(){return`(${this.value})`}sizeInBytes(){return this.value.length+2}copyBytesInto(t,e){return t[e++]=y.LeftParen,e+=be(this.value,t,e),t[e++]=y.RightParen,this.value.length+2}};mn.of=n=>new mn(n);mn.fromDate=n=>{let t=kt(String(n.getUTCFullYear()),4,"0"),e=kt(String(n.getUTCMonth()+1),2,"0"),i=kt(String(n.getUTCDate()),2,"0"),r=kt(String(n.getUTCHours()),2,"0"),o=kt(String(n.getUTCMinutes()),2,"0"),s=kt(String(n.getUTCSeconds()),2,"0");return new mn(`D:${t}${e}${i}${r}${o}${s}Z`)};var G=mn;var Xr=class{constructor(t,e){this.name=t,this.args=e||[]}clone(t){let e=new Array(this.args.length);for(let i=0,r=e.length;inew Xr(n,t);var _=Xr;var hf;(function(n){n.NonStrokingColor="sc",n.NonStrokingColorN="scn",n.NonStrokingColorRgb="rg",n.NonStrokingColorGray="g",n.NonStrokingColorCmyk="k",n.NonStrokingColorspace="cs",n.StrokingColor="SC",n.StrokingColorN="SCN",n.StrokingColorRgb="RG",n.StrokingColorGray="G",n.StrokingColorCmyk="K",n.StrokingColorspace="CS",n.BeginMarkedContentSequence="BDC",n.BeginMarkedContent="BMC",n.EndMarkedContent="EMC",n.MarkedContentPointWithProps="DP",n.MarkedContentPoint="MP",n.DrawObject="Do",n.ConcatTransformationMatrix="cm",n.PopGraphicsState="Q",n.PushGraphicsState="q",n.SetFlatness="i",n.SetGraphicsStateParams="gs",n.SetLineCapStyle="J",n.SetLineDashPattern="d",n.SetLineJoinStyle="j",n.SetLineMiterLimit="M",n.SetLineWidth="w",n.SetTextMatrix="Tm",n.SetRenderingIntent="ri",n.AppendRectangle="re",n.BeginInlineImage="BI",n.BeginInlineImageData="ID",n.EndInlineImage="EI",n.ClipEvenOdd="W*",n.ClipNonZero="W",n.CloseAndStroke="s",n.CloseFillEvenOddAndStroke="b*",n.CloseFillNonZeroAndStroke="b",n.ClosePath="h",n.AppendBezierCurve="c",n.CurveToReplicateFinalPoint="y",n.CurveToReplicateInitialPoint="v",n.EndPath="n",n.FillEvenOddAndStroke="B*",n.FillEvenOdd="f*",n.FillNonZeroAndStroke="B",n.FillNonZero="f",n.LegacyFillNonZero="F",n.LineTo="l",n.MoveTo="m",n.ShadingFill="sh",n.StrokePath="S",n.BeginText="BT",n.EndText="ET",n.MoveText="Td",n.MoveTextSetLeading="TD",n.NextLine="T*",n.SetCharacterSpacing="Tc",n.SetFontAndSize="Tf",n.SetTextHorizontalScaling="Tz",n.SetTextLineHeight="TL",n.SetTextRenderingMode="Tr",n.SetTextRise="Ts",n.SetWordSpacing="Tw",n.ShowText="Tj",n.ShowTextAdjusted="TJ",n.ShowTextLine="'",n.ShowTextLineAndSpace='"',n.Type3D0="d0",n.Type3D1="d1",n.BeginCompatibilitySection="BX",n.EndCompatibilitySection="EX"})(hf||(hf={}));var ee=hf;var J0=qn(Wa(),1);var uf=class extends Pe{constructor(t,e){super(t),this.computeContents=()=>{let i=this.getUnencodedContents();return this.encode?J0.default.deflate(i):i},this.encode=e,e&&t.set(x.of("Filter"),x.of("FlateDecode")),this.contentsCache=lt.populatedBy(this.computeContents)}getContents(){return this.contentsCache.access()}getContentsSize(){return this.contentsCache.access().length}getUnencodedContents(){throw new Ge(this.constructor.name,"getUnencodedContents")}},er=uf;var Zr=class extends er{constructor(t,e,i=!0){super(t,i),this.operators=e}push(...t){this.operators.push(...t)}clone(t){let e=new Array(this.operators.length);for(let o=0,s=this.operators.length;onew Zr(n,t,e);var Hi=Zr;var hs=class{constructor(t){this.seed=t}nextInt(){let t=Math.sin(this.seed++)*1e4;return t-Math.floor(t)}};hs.withSeed=n=>new hs(n);var Rv=([n],[t])=>n.objectNumber-t.objectNumber,gl=class{constructor(){this.isDecrypted=!0,this.largestObjectNumber=0,this.header=Bi.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map,this.rng=hs.withSeed(1)}assign(t,e){this.indirectObjects.set(t,e),t.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=t.objectNumber)}nextRef(){return this.largestObjectNumber+=1,q.of(this.largestObjectNumber)}register(t){let e=this.nextRef();return this.assign(e,t),e}delete(t){return this.indirectObjects.delete(t)}lookupMaybe(t,...e){let i=e.includes(Me),r=t instanceof q?this.indirectObjects.get(t):t;if(!(!r||r===Me&&!i)){for(let o=0,s=e.length;othis.getLiteral(c,s)):a}else{if(t instanceof wi)return t.asBoolean();if(t instanceof R){let a={},c=t.entries();for(let l=0,d=c.length;lnew gl;var Yr=gl;var Ui=class extends R{constructor(t,e,i=!0){super(t,e),this.normalized=!1,this.autoNormalizeCTM=i}clone(t){let e=Ui.fromMapWithContext(new Map,t||this.context,this.autoNormalizeCTM),i=this.entries();for(let r=0,o=i.length;r{e||(e=i.get(t))}),e}setParent(t){this.set(x.Parent,t)}addContentStream(t){let e=this.normalizedEntries().Contents||this.context.obj([]);this.set(x.Contents,e),e.push(t)}wrapContentStreams(t,e){let i=this.Contents();return i instanceof H?(i.insert(0,t),i.push(e),!0):!1}addAnnot(t){let{Annots:e}=this.normalizedEntries();e.push(t)}removeAnnot(t){let{Annots:e}=this.normalizedEntries(),i=e.indexOf(t);i!==void 0&&e.remove(i)}setFontDictionary(t,e){let{Font:i}=this.normalizedEntries();i.set(t,e)}newFontDictionaryKey(t){let{Font:e}=this.normalizedEntries();return e.uniqueKey(t)}newFontDictionary(t,e){let i=this.newFontDictionaryKey(t);return this.setFontDictionary(i,e),i}setXObject(t,e){let{XObject:i}=this.normalizedEntries();i.set(t,e)}newXObjectKey(t){let{XObject:e}=this.normalizedEntries();return e.uniqueKey(t)}newXObject(t,e){let i=this.newXObjectKey(t);return this.setXObject(i,e),i}setExtGState(t,e){let{ExtGState:i}=this.normalizedEntries();i.set(t,e)}newExtGStateKey(t){let{ExtGState:e}=this.normalizedEntries();return e.uniqueKey(t)}newExtGState(t,e){let i=this.newExtGStateKey(t);return this.setExtGState(i,e),i}ascend(t){t(this);let e=this.Parent();e&&e.ascend(t)}normalize(){if(this.normalized)return;let{context:t}=this,e=this.get(x.Contents);this.context.lookup(e)instanceof Pe&&this.set(x.Contents,t.obj([e])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());let r=this.getInheritableAttribute(x.Resources),o=t.lookupMaybe(r,R)||t.obj({});this.set(x.Resources,o);let s=o.lookupMaybe(x.Font,R)||t.obj({});o.set(x.Font,s);let a=o.lookupMaybe(x.XObject,R)||t.obj({});o.set(x.XObject,a);let c=o.lookupMaybe(x.ExtGState,R)||t.obj({});o.set(x.ExtGState,c);let l=this.Annots()||t.obj([]);this.set(x.Annots,l),this.normalized=!0}normalizedEntries(){this.normalize();let t=this.Annots(),e=this.Resources(),i=this.Contents();return{Annots:t,Resources:e,Contents:i,Font:e.lookup(x.Font,R),XObject:e.lookup(x.XObject,R),ExtGState:e.lookup(x.ExtGState,R)}}};Ui.InheritableEntries=["Resources","MediaBox","CropBox","Rotate"];Ui.withContextAndParent=(n,t)=>{let e=new Map;return e.set(x.Type,x.Page),e.set(x.Parent,t),e.set(x.Resources,n.obj({})),e.set(x.MediaBox,n.obj([0,0,612,792])),new Ui(e,n,!1)};Ui.fromMapWithContext=(n,t,e=!0)=>new Ui(n,t,e);var it=Ui;var ml=class{constructor(t,e){this.traversedObjects=new Map,this.copy=i=>i instanceof it?this.copyPDFPage(i):i instanceof R?this.copyPDFDict(i):i instanceof H?this.copyPDFArray(i):i instanceof Pe?this.copyPDFStream(i):i instanceof q?this.copyPDFIndirectObject(i):i.clone(),this.copyPDFPage=i=>{let r=i.clone(),{InheritableEntries:o}=it;for(let s=0,a=o.length;s{if(this.traversedObjects.has(i))return this.traversedObjects.get(i);let r=i.clone(this.dest);this.traversedObjects.set(i,r);let o=i.entries();for(let s=0,a=o.length;s{if(this.traversedObjects.has(i))return this.traversedObjects.get(i);let r=i.clone(this.dest);this.traversedObjects.set(i,r);for(let o=0,s=i.size();o{if(this.traversedObjects.has(i))return this.traversedObjects.get(i);let r=i.clone(this.dest);this.traversedObjects.set(i,r);let o=i.dict.entries();for(let s=0,a=o.length;s{if(!this.traversedObjects.has(i)){let o=this.dest.nextRef();this.traversedObjects.set(i,o);let s=this.src.lookup(i);if(s){let a=this.copy(s);this.dest.assign(o,a)}}return this.traversedObjects.get(i)},this.src=t,this.dest=e}};ml.for=(n,t)=>new ml(n,t);var bl=ml;var Jr=class{constructor(t){this.subsections=t?[[t]]:[],this.chunkIdx=0,this.chunkLength=t?1:0}addEntry(t,e){this.append({ref:t,offset:e,deleted:!1})}addDeletedEntry(t,e){this.append({ref:t,offset:e,deleted:!0})}toString(){let t=`xref +`;for(let e=0,i=this.subsections.length;e1?(this.subsections.push([t]),this.chunkIdx+=1,this.chunkLength=1):(e.push(t),this.chunkLength+=1)}};Jr.create=()=>new Jr({ref:q.of(0,65535),offset:0,deleted:!0});Jr.createEmpty=()=>new Jr;var us=Jr;var xl=class{constructor(t){this.lastXRefOffset=String(t)}toString(){return`startxref +${this.lastXRefOffset} +%%EOF`}sizeInBytes(){return 16+this.lastXRefOffset.length}copyBytesInto(t,e){let i=e;return t[e++]=y.s,t[e++]=y.t,t[e++]=y.a,t[e++]=y.r,t[e++]=y.t,t[e++]=y.x,t[e++]=y.r,t[e++]=y.e,t[e++]=y.f,t[e++]=y.Newline,e+=be(this.lastXRefOffset,t,e),t[e++]=y.Newline,t[e++]=y.Percent,t[e++]=y.Percent,t[e++]=y.E,t[e++]=y.O,t[e++]=y.F,e-i}};xl.forLastCrossRefSectionOffset=n=>new xl(n);var tr=xl;var yl=class{constructor(t){this.dict=t}toString(){return`trailer +${this.dict.toString()}`}sizeInBytes(){return 8+this.dict.sizeInBytes()}copyBytesInto(t,e){let i=e;return t[e++]=y.t,t[e++]=y.r,t[e++]=y.a,t[e++]=y.i,t[e++]=y.l,t[e++]=y.e,t[e++]=y.r,t[e++]=y.Newline,e+=this.dict.copyBytesInto(t,e),e-i}};yl.of=n=>new yl(n);var ud=yl;var Qr=class extends er{constructor(t,e,i=!0){super(t.obj({}),i),this.objects=e,this.offsets=this.computeObjectOffsets(),this.offsetsString=this.computeOffsetsString(),this.dict.set(x.of("Type"),x.of("ObjStm")),this.dict.set(x.of("N"),N.of(this.objects.length)),this.dict.set(x.of("First"),N.of(this.offsetsString.length))}getObjectsCount(){return this.objects.length}clone(t){return Qr.withContextAndObjects(t||this.dict.context,this.objects.slice(),this.encode)}getContentsString(){let t=this.offsetsString;for(let e=0,i=this.objects.length;enew Qr(n,t,e);var fs=Qr;var wl=class{constructor(t,e){this.parsedObjects=0,this.shouldWaitForTick=i=>(this.parsedObjects+=i,this.parsedObjects%this.objectsPerTick===0),this.context=t,this.objectsPerTick=e}async serializeToBuffer(){let{size:t,header:e,indirectObjects:i,xref:r,trailerDict:o,trailer:s}=await this.computeBufferSize(),a=0,c=new Uint8Array(t);a+=e.copyBytesInto(c,a),c[a++]=y.Newline,c[a++]=y.Newline;for(let l=0,d=i.length;lnew wl(n,t);var ps=wl;var _r=class extends fe{constructor(t){super(),this.data=t}clone(){return _r.of(this.data.slice())}toString(){return`PDFInvalidObject(${this.data.length} bytes)`}sizeInBytes(){return this.data.length}copyBytesInto(t,e){let i=this.data.length;for(let r=0;rnew _r(n);var gs=_r;var ir;(function(n){n[n.Deleted=0]="Deleted",n[n.Uncompressed=1]="Uncompressed",n[n.Compressed=2]="Compressed"})(ir||(ir={}));var bn=class extends er{constructor(t,e,i=!0){super(t,i),this.computeIndex=()=>{let r=[],o=0;for(let s=0,a=this.entries.length;s1&&(r.push(o),r.push(c.ref.objectNumber),o=0),o+=1}return r.push(o),r},this.computeEntryTuples=()=>{let r=new Array(this.entries.length);for(let o=0,s=this.entries.length;o{let r=this.entryTuplesCache.access(),o=[0,0,0];for(let s=0,a=r.length;so[0]&&(o[0]=h),u>o[1]&&(o[1]=u),f>o[2]&&(o[2]=f)}return o},this.entries=e||[],this.entryTuplesCache=lt.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=lt.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=lt.populatedBy(this.computeIndex),t.set(x.of("Type"),x.of("XRef"))}addDeletedEntry(t,e){let i=ir.Deleted;this.entries.push({type:i,ref:t,nextFreeObjectNumber:e}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addUncompressedEntry(t,e){let i=ir.Uncompressed;this.entries.push({type:i,ref:t,offset:e}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addCompressedEntry(t,e,i){let r=ir.Compressed;this.entries.push({type:r,ref:t,objectStreamRef:e,index:i}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}clone(t){let{dict:e,entries:i,encode:r}=this;return bn.of(e.clone(t),i.slice(),r)}getContentsString(){let t=this.entryTuplesCache.access(),e=this.maxByteWidthsCache.access(),i="";for(let r=0,o=t.length;r=0;u--)i+=(l[u]||0).toString(2);for(let u=e[1]-1;u>=0;u--)i+=(d[u]||0).toString(2);for(let u=e[2]-1;u>=0;u--)i+=(h[u]||0).toString(2)}return i}getUnencodedContents(){let t=this.entryTuplesCache.access(),e=this.maxByteWidthsCache.access(),i=new Uint8Array(this.getUnencodedContentsSize()),r=0;for(let o=0,s=t.length;o=0;f--)i[r++]=d[f]||0;for(let f=e[1]-1;f>=0;f--)i[r++]=h[f]||0;for(let f=e[2]-1;f>=0;f--)i[r++]=u[f]||0}return i}getUnencodedContentsSize(){let t=this.maxByteWidthsCache.access();return uu(t)*this.entries.length}updateDict(){super.updateDict();let t=this.maxByteWidthsCache.access(),e=this.indexCache.access(),{context:i}=this.dict;this.dict.set(x.of("W"),i.obj(t)),this.dict.set(x.of("Index"),i.obj(e))}};bn.create=(n,t=!0)=>{let e=new bn(n,[],t);return e.addDeletedEntry(q.of(0,65535),0),e};bn.of=(n,t,e=!0)=>new bn(n,t,e);var fd=bn;var vl=class extends ps{constructor(t,e,i,r){super(t,e),this.encodeStreams=i,this.objectsPerStream=r}async computeBufferSize(){let t=this.context.largestObjectNumber+1,e=Bi.forVersion(1,7),i=e.sizeInBytes()+2,r=fd.create(this.createTrailerDict(),this.encodeStreams),o=[],s=[],a=[],c=this.context.enumerateIndirectObjects();for(let u=0,f=c.length;unew vl(n,t,e,i);var pd=vl;var Fl=class{constructor(t,e){this.encoding=t===zr.ZapfDingbats?Ga.ZapfDingbats:t===zr.Symbol?Ga.Symbol:Ga.WinAnsi,this.font=V0.load(t),this.fontName=this.font.FontName,this.customName=e}encodeText(t){let e=this.encodeTextAsGlyphs(t),i=new Array(e.length);for(let r=0,o=e.length;rnew Fl(n,t);var nr=Fl;var $0=(n,t)=>{let e=new Array(n.length);for(let i=0,r=n.length;i`/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo << + /Registry (Adobe) + /Ordering (UCS) + /Supplement 0 +>> def +/CMapName /Adobe-Identity-UCS def +/CMapType 2 def +1 begincodespacerange +<0000> +endcodespacerange +${n.length} beginbfchar +${n.map(([t,e])=>`${t} ${e}`).join(` +`)} +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end`,_0=(...n)=>`<${n.join("")}>`,gd=n=>Ai(n,4),Bv=n=>{if(bu(n))return gd(n);if(xu(n)){let i=Kc(n),r=Gc(n);return`${gd(i)}${gd(r)}`}let e=`0x${Ii(n)} is not a valid UTF-8 or UTF-16 codepoint.`;throw new Error(e)};var Hv=n=>{let t=0,e=i=>{t|=1<{let t=n["OS/2"]?n["OS/2"].sFamilyClass:0;return Hv({fixedPitch:n.post.isFixedPitch,serif:1<=t&&t<=7,symbolic:!0,script:t===10,italic:n.head.macStyle.italic})};var Pl=class{static async for(t,e,i,r){let o=await t.create(e);return new Pl(o,e,i,r)}constructor(t,e,i,r){this.allGlyphsInFontSortedById=()=>{let o=new Array(this.font.characterSet.length);for(let s=0,a=o.length;ss.id)},this.font=t,this.scale=1e3/this.font.unitsPerEm,this.fontData=e,this.fontName=this.font.postscriptName||"Font",this.customName=i,this.fontFeatures=r,this.baseFontName="",this.glyphCache=lt.populatedBy(this.allGlyphsInFontSortedById)}encodeText(t){let{glyphs:e}=this.font.layout(t,this.fontFeatures),i=new Array(e.length);for(let r=0,o=e.length;rthis.glyphs),this.glyphIdMap=new Map}encodeText(t){let{glyphs:e}=this.font.layout(t,this.fontFeatures),i=new Array(e.length);for(let r=0,o=e.length;r{let i=[];this.subset.encodeStream().on("data",r=>i.push(r)).on("end",()=>t(cu(i))).on("error",r=>e(r))})}},md=kl;var ms;(function(n){n.Source="Source",n.Data="Data",n.Alternative="Alternative",n.Supplement="Supplement",n.EncryptedPayload="EncryptedPayload",n.FormData="EncryptedPayload",n.Schema="Schema",n.Unspecified="Unspecified"})(ms||(ms={}));var Dl=class{static for(t,e,i={}){return new Dl(t,e,i)}constructor(t,e,i={}){this.fileData=t,this.fileName=e,this.options=i}async embedIntoContext(t,e){let{mimeType:i,description:r,creationDate:o,modificationDate:s,afRelationship:a}=this.options,c=t.flateStream(this.fileData,{Type:"EmbeddedFile",Subtype:i!=null?i:void 0,Params:{Size:this.fileData.length,CreationDate:o?G.fromDate(o):void 0,ModDate:s?G.fromDate(s):void 0}}),l=t.register(c),d=t.obj({Type:"Filespec",F:G.of(this.fileName),UF:M.fromText(this.fileName),EF:{F:l},Desc:r?M.fromText(r):void 0,AFRelationship:a!=null?a:void 0});return e?(t.assign(e,d),e):t.register(d)}},bd=Dl;var tb=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],bs;(function(n){n.DeviceGray="DeviceGray",n.DeviceRGB="DeviceRGB",n.DeviceCMYK="DeviceCMYK"})(bs||(bs={}));var Uv={1:bs.DeviceGray,3:bs.DeviceRGB,4:bs.DeviceCMYK},Sl=class{static async for(t){let e=new DataView(t.buffer);if(e.getUint16(0)!==65496)throw new Error("SOI not found in JPEG");let r=2,o;for(;r>3)]>>7-((p&7)<<0)&1,V=3*E;a[v]=P[V],a[v+1]=P[V+1],a[v+2]=P[V+2],a[v+3]=E>2)]>>6-((p&3)<<1)&3,V=3*E;a[v]=P[V],a[v+1]=P[V+1],a[v+2]=P[V+2],a[v+3]=E>1)]>>4-((p&1)<<2)&15,V=3*E;a[v]=P[V],a[v+1]=P[V+1],a[v+2]=P[V+2],a[v+3]=E>>3)]>>>7-(z&7)&1),oe=B==b*255?0:255;c[te+z]=oe<<24|B<<16|B<<8|B}else if(d==2)for(var z=0;z>>2)]>>>6-((z&3)<<1)&3),oe=B==b*85?0:255;c[te+z]=oe<<24|B<<16|B<<8|B}else if(d==4)for(var z=0;z>>1)]>>>4-((z&1)<<2)&15),oe=B==b*17?0:255;c[te+z]=oe<<24|B<<16|B<<8|B}else if(d==8)for(var z=0;z>>2<<3));r==0;){if(r=m(t,u,1),o=m(t,u+1,2),u+=3,o==0){u&7&&(u+=8-(u&7));var D=(u>>>3)+4,C=t[D-4]|t[D-3]<<8;T&&(e=n.H.W(e,h+C)),e.set(new i(t.buffer,t.byteOffset+D,C),h),u=D+C<<3,h+=C;continue}if(T&&(e=n.H.W(e,h+(1<<17))),o==1&&(f=k.J,p=k.h,l=(1<<9)-1,d=(1<<5)-1),o==2){s=b(t,u,5)+257,a=b(t,u+5,5)+1,c=b(t,u+10,4)+4,u+=14;for(var O=u,E=1,V=0;V<38;V+=2)k.Q[V]=0,k.Q[V+1]=0;for(var V=0;VE&&(E=W)}u+=3*c,F(k.Q,E),v(k.Q,E,k.u),f=k.w,p=k.d,u=w(k.u,(1<>>4;if(!(z>>>8))e[h++]=z;else{if(z==256)break;var oe=h+z-254;if(z>264){var Ee=k.q[z-257];oe=h+(Ee>>>3)+b(t,u,Ee&7),u+=Ee&7}var Ue=p[P(t,u)&d];u+=Ue&15;var me=Ue>>>4,Ae=k.c[me],ve=(Ae>>>4)+m(t,u,Ae&15);for(u+=Ae&15;h>>4;if(h<=15)s[l]=h,l++;else{var u=0,f=0;h==16?(f=3+a(r,o,2),o+=2,u=s[l-1]):h==17?(f=3+a(r,o,3),o+=3):h==18&&(f=11+a(r,o,7),o+=7);for(var p=l+f;l>>1;so&&(o=c),s++}for(;s>1,l=t[a+1],d=c<<4|l,h=e-l,u=t[a]<>>15-e;i[p]=d,u++}},n.H.l=function(t,e){for(var i=n.H.m.r,r=15-e,o=0;o>>r}},n.H.M=function(t,e,i){i=i<<(e&7);var r=e>>>3;t[r]|=i,t[r+1]|=i>>>8},n.H.I=function(t,e,i){i=i<<(e&7);var r=e>>>3;t[r]|=i,t[r+1]|=i>>>8,t[r+2]|=i>>>16},n.H.e=function(t,e,i){return(t[e>>>3]|t[(e>>>3)+1]<<8)>>>(e&7)&(1<>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)&(1<>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)},n.H.i=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16|t[(e>>>3)+3]<<24)>>>(e&7)},n.H.m=function(){var t=Uint16Array,e=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new e(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(1<<15),s:new e(286),Y:new e(30),a:new e(19),t:new e(15e3),k:new t(1<<16),g:new t(1<<15)}}(),function(){for(var t=n.H.m,e=1<<15,i=0;i>>1|(r&1431655765)<<1,r=(r&3435973836)>>>2|(r&858993459)<<2,r=(r&4042322160)>>>4|(r&252645135)<<4,r=(r&4278255360)>>>8|(r&16711935)<<8,t.r[i]=(r>>>16|r<<16)>>>17}function o(s,a,c){for(;a--!=0;)s.push(0,c)}for(var i=0;i<32;i++)t.q[i]=t.S[i]<<3|t.T[i],t.c[i]=t.p[i]<<4|t.z[i];o(t._,144,8),o(t._,255-143,9),o(t._,279-255,7),o(t._,287-279,8),n.H.n(t._,9),n.H.A(t._,9,t.J),n.H.l(t._,9),o(t.$,32,5),n.H.n(t.$,5),n.H.A(t.$,5,t.h),n.H.l(t.$,5),o(t.Q,19,0),o(t.C,286,0),o(t.D,30,0),o(t.v,320,0)}(),n.H.N}();L.decode._readInterlace=function(n,t){for(var e=t.width,i=t.height,r=L.decode._getBPP(t),o=r>>3,s=Math.ceil(e*r/8),a=new Uint8Array(i*s),c=0,l=[0,0,4,0,2,0,1],d=[0,4,0,2,0,1,0],h=[8,8,8,4,4,2,2],u=[8,8,4,4,2,2,1],f=0;f<7;){for(var p=h[f],g=u[f],m=0,b=0,w=l[f];w>3];C=C>>7-(D&7)&1,a[k*s+(T>>3)]|=C<<7-((T&7)<<0)}if(r==2){var C=n[D>>3];C=C>>6-(D&7)&3,a[k*s+(T>>2)]|=C<<6-((T&3)<<1)}if(r==4){var C=n[D>>3];C=C>>4-(D&7)&15,a[k*s+(T>>1)]|=C<<4-((T&1)<<2)}if(r>=8)for(var O=k*s+T*o,E=0;E>3)+E];D+=r,T+=g}P++,k+=p}m*b!=0&&(c+=b*(1+v)),f=f+1}return a};L.decode._getBPP=function(n){var t=[1,null,3,1,2,null,4][n.ctype];return t*n.depth};L.decode._filterZero=function(n,t,e,i,r){var o=L.decode._getBPP(t),s=Math.ceil(i*o/8),a=L.decode._paeth;o=Math.ceil(o/8);var c=0,l=1,d=n[e],h=0;if(d>1&&(n[e]=[0,0,1][d-2]),d==3)for(h=o;h>>1)&255;for(var u=0;u>>1);for(;h>>1)}else{for(;h>8&255,n[t+1]=e&255},readUint:function(n,t){return n[t]*(256*256*256)+(n[t+1]<<16|n[t+2]<<8|n[t+3])},writeUint:function(n,t,e){n[t]=e>>24&255,n[t+1]=e>>16&255,n[t+2]=e>>8&255,n[t+3]=e&255},readASCII:function(n,t,e){for(var i="",r=0;r=0&&a>=0?(h=f*t+p<<2,u=(a+f)*r+s+p<<2):(h=(-a+f)*t-s+p<<2,u=f*r+p<<2),c==0)i[u]=n[h],i[u+1]=n[h+1],i[u+2]=n[h+2],i[u+3]=n[h+3];else if(c==1){var g=n[h+3]*.00392156862745098,m=n[h]*g,b=n[h+1]*g,w=n[h+2]*g,F=i[u+3]*(1/255),v=i[u]*F,P=i[u+1]*F,k=i[u+2]*F,T=1-g,D=g+F*T,C=D==0?0:1/D;i[u+3]=255*D,i[u+0]=(m+v*T)*C,i[u+1]=(b+P*T)*C,i[u+2]=(w+k*T)*C}else if(c==2){var g=n[h+3],m=n[h],b=n[h+1],w=n[h+2],F=i[u+3],v=i[u],P=i[u+1],k=i[u+2];g==F&&m==v&&b==P&&w==k?(i[u]=0,i[u+1]=0,i[u+2]=0,i[u+3]=0):(i[u]=m,i[u+1]=b,i[u+2]=w,i[u+3]=g)}else if(c==3){var g=n[h+3],m=n[h],b=n[h+1],w=n[h+2],F=i[u+3],v=i[u],P=i[u+1],k=i[u+2];if(g==F&&m==v&&b==P&&w==k)continue;if(g<220&&F>20)return!1}return!0};L.encode=function(n,t,e,i,r,o,s){i==null&&(i=0),s==null&&(s=!1);var a=L.encode.compress(n,t,e,i,[!1,!1,!1,0,s]);return L.encode.compressPNG(a,-1),L.encode._main(a,t,e,r,o)};L.encodeLL=function(n,t,e,i,r,o,s,a){for(var c={ctype:0+(i==1?0:2)+(r==0?0:4),depth:o,frames:[]},l=Date.now(),d=(i+r)*o,h=d*t,u=0;u1,h=!1,u=8+(16+5+4)+(d?20:0);if(r.sRGB!=null&&(u+=8+1+4),r.pHYs!=null&&(u+=8+9+4),n.ctype==3){for(var f=n.plte.length,p=0;p>>24!=255&&(h=!0);u+=8+f*3+4+(h?8+f*1+4:0)}for(var g=0;g>>8&255,T=v>>>16&255;b[l+F+0]=P,b[l+F+1]=k,b[l+F+2]=T}if(l+=f*3,s(b,l,o(b,l-f*3-4,f*3+4)),l+=4,h){s(b,l,f),l+=4,c(b,l,"tRNS"),l+=4;for(var p=0;p>>24&255;l+=f,s(b,l,o(b,l-f-4,f+4)),l+=4}}for(var D=0,g=0;g>2,V>>2));for(var f=0;fU&&z==B[m-U])te[m]=te[m-U];else{var oe=F[z];if(oe==null&&(F[z]=oe=v.length,v.push(z),v.length>=300))break;te[m]=oe}}}var Ee=v.length;Ee<=256&&l==!1&&(Ee<=2?h=1:Ee<=4?h=2:Ee<=16?h=4:h=8,h=Math.max(h,c));for(var f=0;f>1)]|=jo[Uc+ze]<<4-(ze&1)*4;else if(h==2)for(var ze=0;ze>2)]|=jo[Uc+ze]<<6-(ze&3)*2;else if(h==1)for(var ze=0;ze>3)]|=jo[Uc+ze]<<7-(ze&7)*1}ve=qt,d=3,ba=1}else if(b==!1&&w.length==1){for(var qt=new Uint8Array(U*Ae*3),ly=U*Ae,m=0;mT&&(T=O),CD&&(D=C))}T==-1&&(P=k=T=D=0),r&&((P&1)==1&&P--,(k&1)==1&&k--);var V=(T-P+1)*(D-k+1);Vm&&(m=v),Pb&&(b=P))}m==-1&&(p=g=m=b=0),s&&((p&1)==1&&p--,(g&1)==1&&g--),o={x:p,y:g,width:m-p+1,height:b-g+1};var D=i[r];D.rect=o,D.blend=1,D.img=new Uint8Array(o.width*o.height*4),i[r-1].dispose==0?(L._copyTile(l,t,e,D.img,o.width,o.height,-o.x,-o.y,0),L.encode._prepareDiff(u,t,e,D.img,o)):L._copyTile(u,t,e,D.img,o.width,o.height,-o.x,-o.y,0)};L.encode._prepareDiff=function(n,t,e,i,r){L._copyTile(n,t,e,i,r.width,r.height,-r.x,-r.y,2)};L.encode._filterZero=function(n,t,e,i,r,o,s){var a=[],c=[0,1,2,3,4];o!=-1?c=[o]:(t*i>5e5||e==1)&&(c=[0]);var l;s&&(l={level:0});for(var d=s&&UZIP!=null?UZIP:ib.default,h=0;h>1)+256&255;if(o==4)for(var l=r;l>1)&255;for(var l=r;l>1)&255}if(o==4){for(var l=0;l>>1:e=e>>>1;n[t]=e}return n}(),update:function(n,t,e,i){for(var r=0;r>>8;return n},crc:function(n,t,e){return L.crc.update(4294967295,n,t,e)^4294967295}};L.quantize=function(n,t){for(var e=new Uint8Array(n),i=e.slice(0),r=new Uint32Array(i.buffer),o=L.quantize.getKDtree(i,t),s=o[0],a=o[1],c=L.quantize.planeDst,l=e,d=r,h=l.length,u=new Uint8Array(e.length>>2),f=0;f>2]=w.ind,d[f>>2]=w.est.rgba}return{abuf:i.buffer,inds:u,plte:a}};L.quantize.getKDtree=function(n,t,e){e==null&&(e=1e-4);var i=new Uint32Array(n.buffer),r={i0:0,i1:n.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=L.quantize.stats(n,r.i0,r.i1),r.est=L.quantize.estats(r.bst);for(var o=[r];o.lengths&&(s=o[c].est.L,a=c);if(s=d||l.i1<=d;if(h){l.est.L=0;continue}var u={i0:l.i0,i1:d,bst:null,est:null,tdst:0,left:null,right:null};u.bst=L.quantize.stats(n,u.i0,u.i1),u.est=L.quantize.estats(u.bst);var f={i0:d,i1:l.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:l.bst.N-u.bst.N};for(var c=0;c<16;c++)f.bst.R[c]=l.bst.R[c]-u.bst.R[c];for(var c=0;c<4;c++)f.bst.m[c]=l.bst.m[c]-u.bst.m[c];f.est=L.quantize.estats(f.bst),l.left=u,l.right=f,o[a]=u,o.push(f)}o.sort(function(p,g){return g.bst.N-p.bst.N});for(var c=0;c0&&(s=n.right,a=n.left);var c=L.quantize.getNearest(s,t,e,i,r);if(c.tdst<=o*o)return c;var l=L.quantize.getNearest(a,t,e,i,r);return l.tdsto;)i-=4;if(e>=i)break;var c=t[e>>2];t[e>>2]=t[i>>2],t[i>>2]=c,e+=4,i-=4}for(;s(n,e,r)>o;)e-=4;return e+4};L.quantize.vecDot=function(n,t,e){return n[t]*e[0]+n[t+1]*e[1]+n[t+2]*e[2]+n[t+3]*e[3]};L.quantize.stats=function(n,t,e){for(var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=[0,0,0,0],o=e-t>>2,s=t;s>>0}};L.M4={multVec:function(n,t){return[n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3],n[4]*t[0]+n[5]*t[1]+n[6]*t[2]+n[7]*t[3],n[8]*t[0]+n[9]*t[1]+n[10]*t[2]+n[11]*t[3],n[12]*t[0]+n[13]*t[1]+n[14]*t[2]+n[15]*t[3]]},dot:function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]},sml:function(n,t){return[n*t[0],n*t[1],n*t[2],n*t[3]]}};L.encode.concatRGBA=function(n){for(var t=0,e=0;e{if(n===0)return $r.Greyscale;if(n===2)return $r.Truecolour;if(n===3)return $r.IndexedColour;if(n===4)return $r.GreyscaleWithAlpha;if(n===6)return $r.TruecolourWithAlpha;throw new Error(`Unknown color type: ${n}`)},qv=n=>{let t=Math.floor(n.length/4),e=new Uint8Array(t*3),i=new Uint8Array(t*1),r=0,o=0,s=0;for(;r1)throw new Error("Animated PNGs are not supported");let r=new Uint8Array(i[0]),{rgbChannel:o,alphaChannel:s}=qv(r);this.rgbChannel=o,s.some(c=>c<255)&&(this.alphaChannel=s),this.type=zv(e.ctype),this.width=e.width,this.height=e.height,this.bitsPerComponent=8}};ys.load=n=>new ys(n);var Tl=class{static async for(t){let e=ys.load(t);return new Tl(e)}constructor(t){this.image=t,this.bitsPerComponent=t.bitsPerComponent,this.width=t.width,this.height=t.height,this.colorSpace="DeviceRGB"}async embedIntoContext(t,e){let i=this.embedAlphaChannel(t),r=t.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:i});return e?(t.assign(e,r),e):t.register(r)}embedAlphaChannel(t){if(!this.image.alphaChannel)return;let e=t.flateStream(this.image.alphaChannel,{Type:"XObject",Subtype:"Image",Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:"DeviceGray",Decode:[0,1]});return t.register(e)}},ws=Tl;var Cl=class{constructor(t,e,i){this.bytes=t,this.start=e||0,this.pos=this.start,this.end=e&&i?e+i:this.bytes.length}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getUint16(){let t=this.getByte(),e=this.getByte();return t===-1||e===-1?-1:(t<<8)+e}getInt32(){let t=this.getByte(),e=this.getByte(),i=this.getByte(),r=this.getByte();return(t<<24)+(e<<16)+(i<<8)+r}getBytes(t,e=!1){let i=this.bytes,r=this.pos,o=this.end;if(t){let s=r+t;s>o&&(s=o),this.pos=s;let a=i.subarray(r,s);return e?new Uint8ClampedArray(a):a}else{let s=i.subarray(r,o);return e?new Uint8ClampedArray(s):s}}peekByte(){let t=this.getByte();return this.pos--,t}peekBytes(t,e=!1){let i=this.getBytes(t,e);return this.pos-=i.length,i}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(t,e){return new Cl(this.bytes,t,e)}decode(){return this.bytes}},xd=Cl;var Wv=new Uint8Array(0),pf=class{constructor(t){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=Wv,this.minBufferLength=512,t)for(;this.minBufferLengths&&(i=s)}else{for(;!this.eof;)this.readBlock();i=this.bufferLength}this.pos=i;let o=this.buffer.subarray(r,i);return e&&!(o instanceof Uint8ClampedArray)?new Uint8ClampedArray(o):o}peekByte(){let t=this.getByte();return this.pos--,t}peekBytes(t,e=!1){let i=this.getBytes(t,e);return this.pos-=i.length,i}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=0}makeSubStream(t,e){let i=t+e;for(;this.bufferLength<=i&&!this.eof;)this.readBlock();return new xd(this.buffer,t,e)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new Ge(this.constructor.name,"readBlock")}ensureBuffer(t){let e=this.buffer;if(t<=e.byteLength)return e;let i=this.minBufferLength;for(;in===32||n===9||n===13||n===10,gf=class extends Zt{constructor(t,e){super(e),this.stream=t,this.input=new Uint8Array(5),e&&(e=.8*e)}readBlock(){let r=this.stream,o=r.getByte();for(;nb(o);)o=r.getByte();if(o===-1||o===126){this.eof=!0;return}let s=this.bufferLength,a,c;if(o===122){for(a=this.ensureBuffer(s+4),c=0;c<4;++c)a[s+c]=0;this.bufferLength+=4}else{let l=this.input;for(l[0]=o,c=1;c<5;++c){for(o=r.getByte();nb(o);)o=r.getByte();if(l[c]=o,o===-1||o===126)break}if(a=this.ensureBuffer(s+c-1),this.bufferLength+=c-1,c<5){for(;c<5;++c)l[c]=33+84;this.eof=!0}let d=0;for(c=0;c<5;++c)d=d*85+(l[c]-33);for(c=3;c>=0;--c)a[s+c]=d&255,d>>=8}}},rb=gf;var mf=class extends Zt{constructor(t,e){super(e),this.stream=t,this.firstDigit=-1,e&&(e=.5*e)}readBlock(){let e=this.stream.getBytes(8e3);if(!e.length){this.eof=!0;return}let i=e.length+1>>1,r=this.ensureBuffer(this.bufferLength+i),o=this.bufferLength,s=this.firstDigit;for(let a=0,c=e.length;a=48&&l<=57)d=l&15;else if(l>=65&&l<=70||l>=97&&l<=102)d=(l&15)+9;else if(l===62){this.eof=!0;break}else continue;s<0?s=d:(r[o++]=s<<4|d,s=-1)}s>=0&&this.eof&&(r[o++]=s<<4,s=-1),this.firstDigit=s,this.bufferLength=o}},ob=mf;var sb=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jv=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),Kv=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Gv=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Xv=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],bf=class extends Zt{constructor(t,e){super(e),this.stream=t;let i=t.getByte(),r=t.getByte();if(i===-1||r===-1)throw new Error(`Invalid header in flate stream: ${i}, ${r}`);if((i&15)!==8)throw new Error(`Unknown compression method in flate stream: ${i}, ${r}`);if(((i<<8)+r)%31!==0)throw new Error(`Bad FCHECK in flate stream: ${i}, ${r}`);if(r&32)throw new Error(`FDICT bit set in flate stream: ${i}, ${r}`);this.codeSize=0,this.codeBuf=0}readBlock(){let t,e,i=this.stream,r=this.getBits(3);if(r&1&&(this.eof=!0),r>>=1,r===0){let l;if((l=i.getByte())===-1)throw new Error("Bad block header in flate stream");let d=l;if((l=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(d|=l<<8,(l=i.getByte())===-1)throw new Error("Bad block header in flate stream");let h=l;if((l=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(h|=l<<8,h!==(~d&65535)&&(d!==0||h!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;let u=this.bufferLength;t=this.ensureBuffer(u+d);let f=u+d;if(this.bufferLength=f,d===0)i.peekByte()===-1&&(this.eof=!0);else for(let p=u;p0;)m[f++]=F}o=this.generateHuffmanTable(m.subarray(0,l)),s=this.generateHuffmanTable(m.subarray(l,g))}else throw new Error("Unknown block type in flate stream");t=this.buffer;let a=t?t.length:0,c=this.bufferLength;for(;;){let l=this.getCode(o);if(l<256){c+1>=a&&(t=this.ensureBuffer(c+1),a=t.length),t[c++]=l;continue}if(l===256){this.bufferLength=c;return}l-=257,l=jv[l];let d=l>>16;d>0&&(d=this.getBits(d)),e=(l&65535)+d,l=this.getCode(s),l=Kv[l],d=l>>16,d>0&&(d=this.getBits(d));let h=(l&65535)+d;c+e>=a&&(t=this.ensureBuffer(c+e),a=t.length);for(let u=0;u>t,this.codeSize=i-=t,o}getCode(t){let e=this.stream,i=t[0],r=t[1],o=this.codeSize,s=this.codeBuf,a;for(;o>16,d=c&65535;if(l<1||o>l,this.codeSize=o-l,d}generateHuffmanTable(t){let e=t.length,i=0,r;for(r=0;ri&&(i=t[r]);let o=1<>=1;for(r=h;r0;if(!v||v<256)g[0]=v,m=1;else if(v>=258)if(v=0;o--)g[o]=d[s],s=u[s];else g[m++]=g[0];else if(v===256){f=9,l=258,m=0;continue}else{this.eof=!0,delete this.lzwState;break}if(P&&(u[l]=p,h[l]=h[p]+1,d[l]=g[0],l++,f=l+c&l+c-1?f:Math.min(Math.log(l+c)/.6931471805599453+1,12)|0),p=v,b+=m,e>>e&(1<0){let o=this.stream.getBytes(r);e.set(o,i),i+=r}}else{r=257-r;let o=t[1];e=this.ensureBuffer(i+r+1);for(let s=0;s{if(t===x.of("FlateDecode"))return new ab(n);if(t===x.of("LZWDecode")){let i=1;if(e instanceof R){let r=e.lookup(x.of("EarlyChange"));r instanceof N&&(i=r.asNumber())}return new lb(n,void 0,i)}if(t===x.of("ASCII85Decode"))return new rb(n);if(t===x.of("ASCIIHexDecode"))return new ob(n);if(t===x.of("RunLengthDecode"))return new cb(n);throw new Qa(t.asString())},vs=({dict:n,contents:t,transform:e})=>{let i=new xd(t);e&&(i=e.createStream(i,t.length));let r=n.lookup(x.of("Filter")),o=n.lookup(x.of("DecodeParms"));if(r instanceof x)i=db(i,r,o);else if(r instanceof H)for(let s=0,a=r.size();s{let t=n.MediaBox(),e=t.lookup(2,N).asNumber()-t.lookup(0,N).asNumber(),i=t.lookup(3,N).asNumber()-t.lookup(1,N).asNumber();return{left:0,bottom:0,right:e,top:i}},Yv=n=>[1,0,0,1,-n.left,-n.bottom],El=class{static async for(t,e,i){return new El(t,e,i)}constructor(t,e,i){this.page=t;let r=e!=null?e:Zv(t);this.width=r.right-r.left,this.height=r.top-r.bottom,this.boundingBox=r,this.transformationMatrix=i!=null?i:Yv(r)}async embedIntoContext(t,e){let{Contents:i,Resources:r}=this.page.normalizedEntries();if(!i)throw new _a;let o=this.decodeContents(i),{left:s,bottom:a,right:c,top:l}=this.boundingBox,d=t.flateStream(o,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[s,a,c,l],Matrix:this.transformationMatrix,Resources:r});return e?(t.assign(e,d),e):t.register(d)}decodeContents(t){let e=Uint8Array.of(y.Newline),i=[];for(let r=0,o=t.size();r{if(n!==void 0)return t[n]},eo;(function(n){n.UseNone="UseNone",n.UseOutlines="UseOutlines",n.UseThumbs="UseThumbs",n.UseOC="UseOC"})(eo||(eo={}));var to;(function(n){n.L2R="L2R",n.R2L="R2L"})(to||(to={}));var io;(function(n){n.None="None",n.AppDefault="AppDefault"})(io||(io={}));var Ps;(function(n){n.Simplex="Simplex",n.DuplexFlipShortEdge="DuplexFlipShortEdge",n.DuplexFlipLongEdge="DuplexFlipLongEdge"})(Ps||(Ps={}));var no=class{constructor(t){this.dict=t}lookupBool(t){let e=this.dict.lookup(x.of(t));if(e instanceof wi)return e}lookupName(t){let e=this.dict.lookup(x.of(t));if(e instanceof x)return e}HideToolbar(){return this.lookupBool("HideToolbar")}HideMenubar(){return this.lookupBool("HideMenubar")}HideWindowUI(){return this.lookupBool("HideWindowUI")}FitWindow(){return this.lookupBool("FitWindow")}CenterWindow(){return this.lookupBool("CenterWindow")}DisplayDocTitle(){return this.lookupBool("DisplayDocTitle")}NonFullScreenPageMode(){return this.lookupName("NonFullScreenPageMode")}Direction(){return this.lookupName("Direction")}PrintScaling(){return this.lookupName("PrintScaling")}Duplex(){return this.lookupName("Duplex")}PickTrayByPDFSize(){return this.lookupBool("PickTrayByPDFSize")}PrintPageRange(){let t=this.dict.lookup(x.of("PrintPageRange"));if(t instanceof H)return t}NumCopies(){let t=this.dict.lookup(x.of("NumCopies"));if(t instanceof N)return t}getHideToolbar(){var t,e;return(e=(t=this.HideToolbar())===null||t===void 0?void 0:t.asBoolean())!==null&&e!==void 0?e:!1}getHideMenubar(){var t,e;return(e=(t=this.HideMenubar())===null||t===void 0?void 0:t.asBoolean())!==null&&e!==void 0?e:!1}getHideWindowUI(){var t,e;return(e=(t=this.HideWindowUI())===null||t===void 0?void 0:t.asBoolean())!==null&&e!==void 0?e:!1}getFitWindow(){var t,e;return(e=(t=this.FitWindow())===null||t===void 0?void 0:t.asBoolean())!==null&&e!==void 0?e:!1}getCenterWindow(){var t,e;return(e=(t=this.CenterWindow())===null||t===void 0?void 0:t.asBoolean())!==null&&e!==void 0?e:!1}getDisplayDocTitle(){var t,e;return(e=(t=this.DisplayDocTitle())===null||t===void 0?void 0:t.asBoolean())!==null&&e!==void 0?e:!1}getNonFullScreenPageMode(){var t,e;let i=(t=this.NonFullScreenPageMode())===null||t===void 0?void 0:t.decodeText();return(e=yd(i,eo))!==null&&e!==void 0?e:eo.UseNone}getReadingDirection(){var t,e;let i=(t=this.Direction())===null||t===void 0?void 0:t.decodeText();return(e=yd(i,to))!==null&&e!==void 0?e:to.L2R}getPrintScaling(){var t,e;let i=(t=this.PrintScaling())===null||t===void 0?void 0:t.decodeText();return(e=yd(i,io))!==null&&e!==void 0?e:io.AppDefault}getDuplex(){var t;let e=(t=this.Duplex())===null||t===void 0?void 0:t.decodeText();return yd(e,Ps)}getPickTrayByPDFSize(){var t;return(t=this.PickTrayByPDFSize())===null||t===void 0?void 0:t.asBoolean()}getPrintPageRange(){let t=this.PrintPageRange();if(!t)return[];let e=[];for(let i=0;inew no(n);no.create=n=>{let t=n.obj({});return new no(t)};var Al=no;var Jv=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/,Il=class{constructor(t,e){this.dict=t,this.ref=e}T(){return this.dict.lookupMaybe(x.of("T"),G,M)}Ff(){let t=this.getInheritableAttribute(x.of("Ff"));return this.dict.context.lookupMaybe(t,N)}V(){let t=this.getInheritableAttribute(x.of("V"));return this.dict.context.lookup(t)}Kids(){return this.dict.lookupMaybe(x.of("Kids"),H)}DA(){let t=this.dict.lookup(x.of("DA"));if(t instanceof G||t instanceof M)return t}setKids(t){this.dict.set(x.of("Kids"),this.dict.context.obj(t))}getParent(){let t=this.dict.get(x.of("Parent"));if(t instanceof q){let e=this.dict.lookup(x.of("Parent"),R);return new Il(e,t)}}setParent(t){t?this.dict.set(x.of("Parent"),t):this.dict.delete(x.of("Parent"))}getFullyQualifiedName(){let t=this.getParent();return t?`${t.getFullyQualifiedName()}.${this.getPartialName()}`:this.getPartialName()}getPartialName(){var t;return(t=this.T())===null||t===void 0?void 0:t.decodeText()}setPartialName(t){t?this.dict.set(x.of("T"),M.fromText(t)):this.dict.delete(x.of("T"))}setDefaultAppearance(t){this.dict.set(x.of("DA"),G.of(t))}getDefaultAppearance(){let t=this.DA();return t instanceof M?t.decodeText():t==null?void 0:t.asString()}setFontSize(t){var e;let i=(e=this.getFullyQualifiedName())!==null&&e!==void 0?e:"",r=this.getDefaultAppearance();if(!r)throw new nl(i);let o=Xo(r,Jv);if(!o.match)throw new rl(i);let s=r.slice(0,o.pos-o.match[0].length),a=o.pos<=r.length?r.slice(o.pos):"",c=o.match[1],l=`${s} /${c} ${t} Tf ${a}`;this.setDefaultAppearance(l)}getFlags(){var t,e;return(e=(t=this.Ff())===null||t===void 0?void 0:t.asNumber())!==null&&e!==void 0?e:0}setFlags(t){this.dict.set(x.of("Ff"),N.of(t))}hasFlag(t){return(this.getFlags()&t)!==0}setFlag(t){let e=this.getFlags();this.setFlags(e|t)}clearFlag(t){let e=this.getFlags();this.setFlags(e&~t)}setFlagTo(t,e){e?this.setFlag(t):this.clearFlag(t)}getInheritableAttribute(t){let e;return this.ascend(i=>{e||(e=i.dict.get(t))}),e}ascend(t){t(this);let e=this.getParent();e&&e.ascend(t)}},ks=Il;var Ll=class{constructor(t){this.dict=t}W(){let t=this.dict.lookup(x.of("W"));if(t instanceof N)return t}getWidth(){var t,e;return(e=(t=this.W())===null||t===void 0?void 0:t.asNumber())!==null&&e!==void 0?e:1}setWidth(t){let e=this.dict.context.obj(t);this.dict.set(x.of("W"),e)}};Ll.fromDict=n=>new Ll(n);var wd=Ll;var Ol=class{constructor(t){this.dict=t}Rect(){return this.dict.lookup(x.of("Rect"),H)}AP(){return this.dict.lookupMaybe(x.of("AP"),R)}F(){let t=this.dict.lookup(x.of("F"));return this.dict.context.lookupMaybe(t,N)}getRectangle(){var t;let e=this.Rect();return(t=e==null?void 0:e.asRectangle())!==null&&t!==void 0?t:{x:0,y:0,width:0,height:0}}setRectangle(t){let{x:e,y:i,width:r,height:o}=t,s=this.dict.context.obj([e,i,e+r,i+o]);this.dict.set(x.of("Rect"),s)}getAppearanceState(){let t=this.dict.lookup(x.of("AS"));if(t instanceof x)return t}setAppearanceState(t){this.dict.set(x.of("AS"),t)}setAppearances(t){this.dict.set(x.of("AP"),t)}ensureAP(){let t=this.AP();return t||(t=this.dict.context.obj({}),this.dict.set(x.of("AP"),t)),t}getNormalAppearance(){let e=this.ensureAP().get(x.of("N"));if(e instanceof q||e instanceof R)return e;throw new Error(`Unexpected N type: ${e==null?void 0:e.constructor.name}`)}setNormalAppearance(t){this.ensureAP().set(x.of("N"),t)}setRolloverAppearance(t){this.ensureAP().set(x.of("R"),t)}setDownAppearance(t){this.ensureAP().set(x.of("D"),t)}removeRolloverAppearance(){let t=this.AP();t==null||t.delete(x.of("R"))}removeDownAppearance(){let t=this.AP();t==null||t.delete(x.of("D"))}getAppearances(){let t=this.AP();if(!t)return;let e=t.lookup(x.of("N"),R,Pe),i=t.lookupMaybe(x.of("R"),R,Pe),r=t.lookupMaybe(x.of("D"),R,Pe);return{normal:e,rollover:i,down:r}}getFlags(){var t,e;return(e=(t=this.F())===null||t===void 0?void 0:t.asNumber())!==null&&e!==void 0?e:0}setFlags(t){this.dict.set(x.of("F"),N.of(t))}hasFlag(t){return(this.getFlags()&t)!==0}setFlag(t){let e=this.getFlags();this.setFlags(e|t)}clearFlag(t){let e=this.getFlags();this.setFlags(e&~t)}setFlagTo(t,e){e?this.setFlag(t):this.clearFlag(t)}};Ol.fromDict=n=>new Ol(n);var vd=Ol;var Ml=class{constructor(t){this.dict=t}R(){let t=this.dict.lookup(x.of("R"));if(t instanceof N)return t}BC(){let t=this.dict.lookup(x.of("BC"));if(t instanceof H)return t}BG(){let t=this.dict.lookup(x.of("BG"));if(t instanceof H)return t}CA(){let t=this.dict.lookup(x.of("CA"));if(t instanceof M||t instanceof G)return t}RC(){let t=this.dict.lookup(x.of("RC"));if(t instanceof M||t instanceof G)return t}AC(){let t=this.dict.lookup(x.of("AC"));if(t instanceof M||t instanceof G)return t}getRotation(){var t;return(t=this.R())===null||t===void 0?void 0:t.asNumber()}getBorderColor(){let t=this.BC();if(!t)return;let e=[];for(let i=0,r=t==null?void 0:t.size();inew Ml(n);var Ds=Ml;var ro=class extends vd{MK(){let t=this.dict.lookup(x.of("MK"));if(t instanceof R)return t}BS(){let t=this.dict.lookup(x.of("BS"));if(t instanceof R)return t}DA(){let t=this.dict.lookup(x.of("DA"));if(t instanceof G||t instanceof M)return t}P(){let t=this.dict.get(x.of("P"));if(t instanceof q)return t}setP(t){this.dict.set(x.of("P"),t)}setDefaultAppearance(t){this.dict.set(x.of("DA"),G.of(t))}getDefaultAppearance(){let t=this.DA();return t instanceof M?t.decodeText():t==null?void 0:t.asString()}getAppearanceCharacteristics(){let t=this.MK();if(t)return Ds.fromDict(t)}getOrCreateAppearanceCharacteristics(){let t=this.MK();if(t)return Ds.fromDict(t);let e=Ds.fromDict(this.dict.context.obj({}));return this.dict.set(x.of("MK"),e.dict),e}getBorderStyle(){let t=this.BS();if(t)return wd.fromDict(t)}getOrCreateBorderStyle(){let t=this.BS();if(t)return wd.fromDict(t);let e=wd.fromDict(this.dict.context.obj({}));return this.dict.set(x.of("BS"),e.dict),e}getOnValue(){var t;let e=(t=this.getAppearances())===null||t===void 0?void 0:t.normal;if(e instanceof R){let i=e.keys();for(let r=0,o=i.length;rnew ro(n);ro.create=(n,t)=>{let e=n.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:t});return new ro(e)};var oo=ro;var Nl=class extends ks{FT(){let t=this.getInheritableAttribute(x.of("FT"));return this.dict.context.lookup(t,x)}getWidgets(){let t=this.Kids();if(!t)return[oo.fromDict(this.dict)];let e=new Array(t.size());for(let i=0,r=t.size();ie.size())throw new un(t,0,e.size());e.remove(t)}else{if(t!==0)throw new un(t,0,0);this.setKids([])}}normalizedEntries(){let t=this.Kids();return t||(t=this.dict.context.obj([this.ref]),this.dict.set(x.of("Kids"),t)),{Kids:t}}};Nl.fromDict=(n,t)=>new Nl(n,t);var Ct=Nl;var wf=class extends Ct{Opt(){return this.dict.lookupMaybe(x.of("Opt"),G,M,H)}setOpt(t){this.dict.set(x.of("Opt"),this.dict.context.obj(t))}getExportValues(){let t=this.Opt();if(!t)return;if(t instanceof G||t instanceof M)return[t];let e=[];for(let i=0,r=t.size();ie.size())throw new un(t,0,e.size());e.remove(t)}}normalizeExportValues(){var t,e,i,r;let o=(t=this.getExportValues())!==null&&t!==void 0?t:[],s=[],a=this.getWidgets();for(let c=0,l=a.length;cnew so(n,t);so.create=n=>{let t=n.obj({FT:"Btn",Kids:[]}),e=n.register(t);return new so(t,e)};var xn=so;var Xe=n=>1<1){if(!this.hasFlag(se.MultiSelect))throw new il;this.dict.set(x.of("V"),this.dict.context.obj(t))}this.updateSelectedIndices(t)}valuesAreValid(t){let e=this.getOptions();for(let i=0,r=t.length;io===(s.display||s.value).decodeText()))return!1}return!0}updateSelectedIndices(t){if(t.length>1){let e=new Array(t.length),i=this.getOptions();for(let r=0,o=t.length;rs===(a.display||a.value).decodeText())}this.dict.set(x.of("I"),this.dict.context.obj(e.sort()))}else this.dict.delete(x.of("I"))}getValues(){let t=this.V();if(t instanceof G||t instanceof M)return[t];if(t instanceof H){let e=[];for(let i=0,r=t.size();i0){let s=o.lookup(0,G,M),a=o.lookupMaybe(1,G,M);e.push({value:s,display:a||s})}}return e}return[]}},Ss=vf;var ao=class extends Ss{};ao.fromDict=(n,t)=>new ao(n,t);ao.create=n=>{let t=n.obj({FT:"Ch",Ff:se.Combo,Kids:[]}),e=n.register(t);return new ao(t,e)};var yn=ao;var lo=class extends ks{addField(t){let{Kids:e}=this.normalizedEntries();e==null||e.push(t)}normalizedEntries(){let t=this.Kids();return t||(t=this.dict.context.obj([]),this.dict.set(x.of("Kids"),t)),{Kids:t}}};lo.fromDict=(n,t)=>new lo(n,t);lo.create=n=>{let t=n.obj({}),e=n.register(t);return new lo(t,e)};var wn=lo;var Rl=class extends Ct{};Rl.fromDict=(n,t)=>new Rl(n,t);var sr=Rl;var co=class extends Ct{MaxLen(){let t=this.dict.lookup(x.of("MaxLen"));if(t instanceof N)return t}Q(){let t=this.dict.lookup(x.of("Q"));if(t instanceof N)return t}setMaxLength(t){this.dict.set(x.of("MaxLen"),N.of(t))}removeMaxLength(){this.dict.delete(x.of("MaxLen"))}getMaxLength(){var t;return(t=this.MaxLen())===null||t===void 0?void 0:t.asNumber()}setQuadding(t){this.dict.set(x.of("Q"),N.of(t))}getQuadding(){var t;return(t=this.Q())===null||t===void 0?void 0:t.asNumber()}setValue(t){this.dict.set(x.of("V"),t)}removeValue(){this.dict.delete(x.of("V"))}getValue(){let t=this.V();if(t instanceof G||t instanceof M)return t}};co.fromDict=(n,t)=>new co(n,t);co.create=n=>{let t=n.obj({FT:"Tx",Kids:[]}),e=n.register(t);return new co(t,e)};var vn=co;var ho=class extends or{};ho.fromDict=(n,t)=>new ho(n,t);ho.create=n=>{let t=n.obj({FT:"Btn",Ff:ct.PushButton,Kids:[]}),e=n.register(t);return new ho(t,e)};var Fn=ho;var uo=class extends or{setValue(t){if(!this.getOnValues().includes(t)&&t!==x.of("Off"))throw new fn;this.dict.set(x.of("V"),t);let i=this.getWidgets();for(let r=0,o=i.length;rnew uo(n,t);uo.create=n=>{let t=n.obj({FT:"Btn",Ff:ct.Radio,Kids:[]}),e=n.register(t);return new uo(t,e)};var Pn=uo;var fo=class extends Ss{};fo.fromDict=(n,t)=>new fo(n,t);fo.create=n=>{let t=n.obj({FT:"Ch",Kids:[]}),e=n.register(t);return new fo(t,e)};var kn=fo;var Ts=n=>{if(!n)return[];let t=[];for(let e=0,i=n.size();eQv(n)?wn.fromDict(n,t):_v(n,t),Qv=n=>{let t=n.lookup(x.of("Kids"));if(t instanceof H)for(let e=0,i=t.size();e{let e=Pf(n,x.of("FT")),i=n.context.lookup(e,x);return i===x.of("Btn")?$v(n,t):i===x.of("Ch")?eF(n,t):i===x.of("Tx")?vn.fromDict(n,t):i===x.of("Sig")?sr.fromDict(n,t):Ct.fromDict(n,t)},$v=(n,t)=>{var e;let i=Pf(n,x.of("Ff")),r=n.context.lookupMaybe(i,N),o=(e=r==null?void 0:r.asNumber())!==null&&e!==void 0?e:0;return Ff(o,ct.PushButton)?Fn.fromDict(n,t):Ff(o,ct.Radio)?Pn.fromDict(n,t):xn.fromDict(n,t)},eF=(n,t)=>{var e;let i=Pf(n,x.of("Ff")),r=n.context.lookupMaybe(i,N),o=(e=r==null?void 0:r.asNumber())!==null&&e!==void 0?e:0;return Ff(o,se.Combo)?yn.fromDict(n,t):kn.fromDict(n,t)},Ff=(n,t)=>(n&t)!==0,Pf=(n,t)=>{let e;return hb(n,i=>{e||(e=i.get(t))}),e},hb=(n,t)=>{t(n);let e=n.lookupMaybe(x.of("Parent"),R);e&&hb(e,t)};var po=class{constructor(t){this.dict=t}Fields(){let t=this.dict.lookup(x.of("Fields"));if(t instanceof H)return t}getFields(){let{Fields:t}=this.normalizedEntries(),e=new Array(t.size());for(let i=0,r=t.size();i{if(i)for(let r=0,o=i.length;rnew po(n);po.create=n=>{let t=n.obj({Fields:[]});return new po(t)};var ar=po;var go=class extends R{Pages(){return this.lookup(x.of("Pages"),R)}AcroForm(){return this.lookupMaybe(x.of("AcroForm"),R)}getAcroForm(){let t=this.AcroForm();if(t)return ar.fromDict(t)}getOrCreateAcroForm(){let t=this.getAcroForm();if(!t){t=ar.create(this.context);let e=this.context.register(t.dict);this.set(x.of("AcroForm"),e)}return t}ViewerPreferences(){return this.lookupMaybe(x.of("ViewerPreferences"),R)}getViewerPreferences(){let t=this.ViewerPreferences();if(t)return Al.fromDict(t)}getOrCreateViewerPreferences(){let t=this.getViewerPreferences();if(!t){t=Al.create(this.context);let e=this.context.register(t.dict);this.set(x.of("ViewerPreferences"),e)}return t}insertLeafNode(t,e){let i=this.get(x.of("Pages"));return this.Pages().insertLeafNode(t,e)||i}removeLeafNode(t){this.Pages().removeLeafNode(t)}};go.withContextAndPages=(n,t)=>{let e=new Map;return e.set(x.of("Type"),x.of("Catalog")),e.set(x.of("Pages"),t),new go(e,n)};go.fromMapWithContext=(n,t)=>new go(n,t);var Cs=go;var Fi=class extends R{Parent(){return this.lookup(x.of("Parent"))}Kids(){return this.lookup(x.of("Kids"),H)}Count(){return this.lookup(x.of("Count"),N)}pushTreeNode(t){this.Kids().push(t)}pushLeafNode(t){let e=this.Kids();this.insertLeafKid(e.size(),t)}insertLeafNode(t,e){let i=this.Kids(),r=this.Count().asNumber();if(e>r)throw new ls(e,r);let o=e;for(let s=0,a=i.size();so)return l.insertLeafNode(t,o)||c;o-=l.Count().asNumber()}l instanceof it&&(o-=1)}if(o===0){this.insertLeafKid(i.size(),t);return}throw new cs(e,"insertLeafNode")}removeLeafNode(t,e=!0){let i=this.Kids(),r=this.Count().asNumber();if(t>=r)throw new ls(t,r);let o=t;for(let s=0,a=i.size();so){l.removeLeafNode(o,e),e&&l.Kids().size()===0&&i.remove(s);return}else o-=l.Count().asNumber();if(l instanceof it)if(o===0){this.removeKid(s);return}else o-=1}throw new cs(t,"removeLeafNode")}ascend(t){t(this);let e=this.Parent();e&&e.ascend(t)}traverse(t){let e=this.Kids();for(let i=0,r=e.size();i{let o=r.Count().asNumber()+1;r.set(x.of("Count"),N.of(o))}),i.insert(t,e)}removeKid(t){let e=this.Kids();e.lookup(t)instanceof it&&this.ascend(r=>{let o=r.Count().asNumber()-1;r.set(x.of("Count"),N.of(o))}),e.remove(t)}};Fi.withContext=(n,t)=>{let e=new Map;return e.set(x.of("Type"),x.of("Pages")),e.set(x.of("Kids"),n.obj([])),e.set(x.of("Count"),n.obj(0)),t&&e.set(x.of("Parent"),t),new Fi(e,n)};Fi.fromMapWithContext=(n,t)=>new Fi(n,t);var Es=Fi;var _e=new Uint8Array(256);_e[y.Zero]=1;_e[y.One]=1;_e[y.Two]=1;_e[y.Three]=1;_e[y.Four]=1;_e[y.Five]=1;_e[y.Six]=1;_e[y.Seven]=1;_e[y.Eight]=1;_e[y.Nine]=1;var Pd=new Uint8Array(256);Pd[y.Period]=1;Pd[y.Plus]=1;Pd[y.Minus]=1;var Vl=new Uint8Array(256);for(let n=0,t=256;nNumber.MAX_SAFE_INTEGER)if(this.capNumbers){let i=`Parsed number that is too large for some PDF readers: ${t}, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(i),Number.MAX_SAFE_INTEGER}else{let i=`Parsed number that is too large for some PDF readers: ${t}, not capping.`;console.warn(i)}return e}skipWhitespace(){for(;!this.bytes.done()&&Xt[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){let t=this.bytes.peek();if(t===ub||t===fb)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==y.Percent)return!1;for(;!this.bytes.done();){let t=this.bytes.peek();if(t===ub||t===fb)return!0;this.bytes.next()}return!0}skipWhitespaceAndComments(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()}matchKeyword(t){let e=this.bytes.offset();for(let i=0,r=t.length;i=this.length}offset(){return this.idx}slice(t,e){return this.bytes.slice(t,e)}position(){return{line:this.line,column:this.column,offset:this.idx}}};mo.of=n=>new mo(n);mo.fromPDFRawStream=n=>mo.of(vs(n).decode());var lr=mo;var{Space:tF,CarriageReturn:Bl,Newline:Hl}=y,Ul=[y.s,y.t,y.r,y.e,y.a,y.m],kd=[y.e,y.n,y.d,y.s,y.t,y.r,y.e,y.a,y.m],xe={header:[y.Percent,y.P,y.D,y.F,y.Dash],eof:[y.Percent,y.Percent,y.E,y.O,y.F],obj:[y.o,y.b,y.j],endobj:[y.e,y.n,y.d,y.o,y.b,y.j],xref:[y.x,y.r,y.e,y.f],trailer:[y.t,y.r,y.a,y.i,y.l,y.e,y.r],startxref:[y.s,y.t,y.a,y.r,y.t,y.x,y.r,y.e,y.f],true:[y.t,y.r,y.u,y.e],false:[y.f,y.a,y.l,y.s,y.e],null:[y.n,y.u,y.l,y.l],stream:Ul,streamEOF1:[...Ul,tF,Bl,Hl],streamEOF2:[...Ul,Bl,Hl],streamEOF3:[...Ul,Bl],streamEOF4:[...Ul,Hl],endstream:kd,EOF1endstream:[Bl,Hl,...kd],EOF2endstream:[Bl,...kd],EOF3endstream:[Hl,...kd]};var bo=class extends pb{constructor(t,e,i=!1,r){super(t,i),this.context=e,this.cryptoFactory=r}parseObject(t){if(this.skipWhitespaceAndComments(),this.matchKeyword(xe.true))return wi.True;if(this.matchKeyword(xe.false))return wi.False;if(this.matchKeyword(xe.null))return Me;let e=this.bytes.peek();if(e===y.LessThan&&this.bytes.peekAhead(1)===y.LessThan)return this.parseDictOrStream(t);if(e===y.LessThan)return this.parseHexString(t);if(e===y.LeftParen)return this.parseString(t);if(e===y.ForwardSlash)return this.parseName();if(e===y.LeftSquareBracket)return this.parseArray(t);if(Vl[e])return this.parseNumberOrRef();throw new sl(this.bytes.position(),e)}parseNumberOrRef(){let t=this.parseRawNumber();this.skipWhitespaceAndComments();let e=this.bytes.offset();if(_e[this.bytes.peek()]){let i=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===y.R)return this.bytes.assertNext(y.R),q.of(t,i)}return this.bytes.moveTo(e),N.of(t)}parseHexString(t){let e="";for(this.bytes.assertNext(y.LessThan);!this.bytes.done()&&this.bytes.peek()!==y.GreaterThan;)e+=Pt(this.bytes.next());return this.bytes.assertNext(y.GreaterThan),this.cryptoFactory&&t&&(e=this.cryptoFactory.createCipherTransform(t.objectNumber,t.generationNumber).decryptBytes(M.of(e).asBytes()).reduce((o,s)=>o+s.toString(16).padStart(2,"0"),"")),M.of(e)}parseString(t){let e=0,i=!1,r="";for(;!this.bytes.done();){let o=this.bytes.next();if(r+=Pt(o),i||(o===y.LeftParen&&(e+=1),o===y.RightParen&&(e-=1)),o===y.BackSlash?i=!i:i&&(i=!1),e===0){let s=r.substring(1,r.length-1);return this.cryptoFactory&&t&&(s=this.cryptoFactory.createCipherTransform(t.objectNumber,t.generationNumber).decryptString(s)),G.of(s)}}throw new cl(this.bytes.position())}parseName(){this.bytes.assertNext(y.ForwardSlash);let t="";for(;!this.bytes.done();){let e=this.bytes.peek();if(Xt[e]||Tt[e])break;t+=Pt(e),this.bytes.next()}return x.of(t)}parseArray(t){this.bytes.assertNext(y.LeftSquareBracket),this.skipWhitespaceAndComments();let e=H.withContext(this.context);for(;this.bytes.peek()!==y.RightSquareBracket;){let i=this.parseObject(t);e.push(i),this.skipWhitespaceAndComments()}return this.bytes.assertNext(y.RightSquareBracket),e}parseDict(t){this.bytes.assertNext(y.LessThan),this.bytes.assertNext(y.LessThan),this.skipWhitespaceAndComments();let e=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==y.GreaterThan&&this.bytes.peekAhead(1)!==y.GreaterThan;){let r=this.parseName(),o=this.parseObject(t);e.set(r,o),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(y.GreaterThan),this.bytes.assertNext(y.GreaterThan);let i=e.get(x.of("Type"));return i===x.of("Catalog")?Cs.fromMapWithContext(e,this.context):i===x.of("Pages")?Es.fromMapWithContext(e,this.context):i===x.of("Page")?it.fromMapWithContext(e,this.context):R.fromMapWithContext(e,this.context)}parseDictOrStream(t){let e=this.bytes.position(),i=this.parseDict(t);if(this.skipWhitespaceAndComments(),!this.matchKeyword(xe.streamEOF1)&&!this.matchKeyword(xe.streamEOF2)&&!this.matchKeyword(xe.streamEOF3)&&!this.matchKeyword(xe.streamEOF4)&&!this.matchKeyword(xe.stream))return i;let r=this.bytes.offset(),o,s=i.get(x.of("Length"));s instanceof N?(o=r+s.asNumber(),this.bytes.moveTo(o),this.skipWhitespaceAndComments(),this.matchKeyword(xe.endstream)||(this.bytes.moveTo(r),o=this.findEndOfStreamFallback(e))):o=this.findEndOfStreamFallback(e);let a=this.bytes.slice(r,o);return this.cryptoFactory&&t&&(a=this.cryptoFactory.createCipherTransform(t.objectNumber,t.generationNumber).decryptBytes(a)),vi.of(i,a)}findEndOfStreamFallback(t){let e=1,i=this.bytes.offset();for(;!this.bytes.done()&&(i=this.bytes.offset(),this.matchKeyword(xe.stream)?e+=1:this.matchKeyword(xe.EOF1endstream)||this.matchKeyword(xe.EOF2endstream)||this.matchKeyword(xe.EOF3endstream)||this.matchKeyword(xe.endstream)?e-=1:this.bytes.next(),e!==0););if(e!==0)throw new ll(t);return i}};bo.forBytes=(n,t,e)=>new bo(lr.of(n),t,e);bo.forByteStream=(n,t,e=!1)=>new bo(n,t,e);var As=bo;var zl=class extends As{constructor(t,e){super(lr.fromPDFRawStream(t),t.dict.context);let{dict:i}=t;this.alreadyParsed=!1,this.shouldWaitForTick=e||(()=>!1),this.firstOffset=i.lookup(x.of("First"),N).asNumber(),this.objectCount=i.lookup(x.of("N"),N).asNumber()}async parseIntoContext(){if(this.alreadyParsed)throw new hn("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0;let t=this.parseOffsetsAndObjectNumbers();for(let e=0,i=t.length;enew zl(n,t);var Dd=zl;var ql=class{constructor(t){this.alreadyParsed=!1,this.dict=t.dict,this.bytes=lr.fromPDFRawStream(t),this.context=this.dict.context;let e=this.dict.lookup(x.of("Size"),N),i=this.dict.lookup(x.of("Index"));if(i instanceof H){this.subsections=[];for(let o=0,s=i.size();onew ql(n);var Sd=ql;var Wl=class extends As{constructor(t,e=1/0,i=!1,r=!1,o=!1,s){super(lr.of(t),Yr.create(),o,s),this.alreadyParsed=!1,this.parsedObjects=0,this.shouldWaitForTick=()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0),this.objectsPerTick=e,this.throwOnInvalidObject=i,this.warnOnInvalidObjects=r,this.context.isDecrypted=!!(s!=null&&s.encryptionKey)}async parseDocument(){if(this.alreadyParsed)throw new hn("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader();let t;for(;!this.bytes.done();){await this.parseDocumentSection();let e=this.bytes.offset();if(e===t)throw new dl(this.bytes.position());t=e}return this.maybeRecoverRoot(),this.context.lookup(q.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(q.of(0))),this.context}maybeRecoverRoot(){let t=i=>i instanceof R&&i.lookup(x.of("Type"))===x.of("Catalog"),e=this.context.lookup(this.context.trailerInfo.Root);if(!t(e)){let i=this.context.enumerateIndirectObjects();for(let r=0,o=i.length;r=y.Space&&e<=y.Tilde&&(this.matchKeyword(xe.xref)||this.matchKeyword(xe.trailer)||this.matchKeyword(xe.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(t);break}this.bytes.next()}}skipBinaryHeaderComment(){this.skipWhitespaceAndComments();try{let t=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(t)}catch(t){this.bytes.next(),this.skipWhitespaceAndComments()}}};Wl.forBytesWithOptions=(n,t,e,i,r,o)=>new Wl(n,t,e,i,r,o);var jl=Wl;var zi=n=>1<n instanceof x?n:x.of(n),j=n=>n instanceof N?n:N.of(n),$=n=>n instanceof N?n.asNumber():n;var Ls;(function(n){n.Degrees="degrees",n.Radians="radians"})(Ls||(Ls={}));var iF=n=>(S(n,"radianAngle",["number"]),{type:Ls.Radians,angle:n}),X=n=>(S(n,"degreeAngle",["number"]),{type:Ls.Degrees,angle:n}),{Radians:gb,Degrees:mb}=Ls,Yt=n=>n*Math.PI/180,bb=n=>n*180/Math.PI,qe=n=>n.type===gb?n.angle:n.type===mb?Yt(n.angle):Xn(`Invalid rotation: ${JSON.stringify(n)}`),Kl=n=>n.type===gb?bb(n.angle):n.type===mb?n.angle:Xn(`Invalid rotation: ${JSON.stringify(n)}`),Jt=(n=0)=>{let t=n/90%4;return t===0?0:t===1?90:t===2?180:t===3?270:0},qi=(n,t=0)=>{let e=Jt(t);return e===90||e===270?{width:n.height,height:n.width}:{width:n.width,height:n.height}},Df=(n,t=0,e=0)=>{let{x:i,y:r,width:o,height:s}=n,a=Jt(e),c=t/2;return a===0?{x:i-c,y:r-c,width:o,height:s}:a===90?{x:i-s+c,y:r-c,width:s,height:o}:a===180?{x:i-o+c,y:r-s+c,width:o,height:s}:a===270?{x:i-c,y:r-o+c,width:s,height:o}:{x:i-c,y:r-c,width:o,height:s}};var Gl=()=>_.of(ee.ClipNonZero),nF=()=>_.of(ee.ClipEvenOdd),{cos:Td,sin:Cd,tan:Ed}=Math,_t=(n,t,e,i,r,o)=>_.of(ee.ConcatTransformationMatrix,[j(n),j(t),j(e),j(i),j(r),j(o)]),gt=(n,t)=>_t(1,0,0,1,n,t),cr=(n,t)=>_t(n,0,0,t,0,0),dr=n=>_t(Td($(n)),Cd($(n)),-Cd($(n)),Td($(n)),0,0),Os=n=>dr(Yt($(n))),Ms=(n,t)=>_t(1,Ed($(n)),Ed($(t)),1,0,0),rF=(n,t)=>Ms(Yt($(n)),Yt($(t))),wo=(n,t)=>_.of(ee.SetLineDashPattern,[`[${n.map(j).join(" ")}]`,j(t)]),oF=()=>wo([],0),Qt;(function(n){n[n.Butt=0]="Butt",n[n.Round=1]="Round",n[n.Projecting=2]="Projecting"})(Qt||(Qt={}));var Ns=n=>_.of(ee.SetLineCapStyle,[j(n)]),yo;(function(n){n[n.Miter=0]="Miter",n[n.Round=1]="Round",n[n.Bevel=2]="Bevel"})(yo||(yo={}));var sF=n=>_.of(ee.SetLineJoinStyle,[j(n)]),ji=n=>_.of(ee.SetGraphicsStateParams,[Is(n)]),Ne=()=>_.of(ee.PushGraphicsState),Re=()=>_.of(ee.PopGraphicsState),Dn=n=>_.of(ee.SetLineWidth,[j(n)]),mt=(n,t,e,i,r,o)=>_.of(ee.AppendBezierCurve,[j(n),j(t),j(e),j(i),j(r),j(o)]),Rs=(n,t,e,i)=>_.of(ee.CurveToReplicateInitialPoint,[j(n),j(t),j(e),j(i)]),$t=()=>_.of(ee.ClosePath),Et=(n,t)=>_.of(ee.MoveTo,[j(n),j(t)]),Ve=(n,t)=>_.of(ee.LineTo,[j(n),j(t)]),xb=(n,t,e,i)=>_.of(ee.AppendRectangle,[j(n),j(t),j(e),j(i)]),aF=(n,t,e)=>xb(n,t,e,e),vo=()=>_.of(ee.StrokePath),Wi;(function(n){n.NonZero="f",n.EvenOdd="f*"})(Wi||(Wi={}));var Xl=()=>_.of(ee.FillNonZero),Tf=()=>_.of(ee.FillEvenOdd),Zl=()=>_.of(ee.FillNonZeroAndStroke),Yl=()=>_.of(ee.EndPath),Cf=()=>_.of(ee.NextLine),lF=(n,t)=>_.of(ee.MoveText,[j(n),j(t)]),Jl=n=>_.of(ee.ShowText,[n]),Ql=()=>_.of(ee.BeginText),_l=()=>_.of(ee.EndText),Fo=(n,t)=>_.of(ee.SetFontAndSize,[Is(n),j(t)]),cF=n=>_.of(ee.SetCharacterSpacing,[j(n)]),dF=n=>_.of(ee.SetWordSpacing,[j(n)]),hF=n=>_.of(ee.SetTextHorizontalScaling,[j(n)]),Ef=n=>_.of(ee.SetTextLineHeight,[j(n)]),uF=n=>_.of(ee.SetTextRise,[j(n)]),Sf;(function(n){n[n.Fill=0]="Fill",n[n.Outline=1]="Outline",n[n.FillAndOutline=2]="FillAndOutline",n[n.Invisible=3]="Invisible",n[n.FillAndClip=4]="FillAndClip",n[n.OutlineAndClip=5]="OutlineAndClip",n[n.FillAndOutlineAndClip=6]="FillAndOutlineAndClip",n[n.Clip=7]="Clip"})(Sf||(Sf={}));var Ad=n=>_.of(ee.SetTextRenderingMode,[j(n)]),yb=(n,t,e,i,r,o)=>_.of(ee.SetTextMatrix,[j(n),j(t),j(e),j(i),j(r),j(o)]),Vs=(n,t,e,i,r)=>yb(Td($(n)),Cd($(n))+Ed($(t)),-Cd($(n))+Ed($(e)),Td($(n)),i,r),fF=(n,t,e,i,r)=>Vs(Yt($(n)),Yt($(t)),Yt($(e)),i,r),Bs=n=>_.of(ee.DrawObject,[Is(n)]),Af=n=>_.of(ee.NonStrokingColorGray,[j(n)]),If=n=>_.of(ee.StrokingColorGray,[j(n)]),Lf=(n,t,e)=>_.of(ee.NonStrokingColorRgb,[j(n),j(t),j(e)]),Of=(n,t,e)=>_.of(ee.StrokingColorRgb,[j(n),j(t),j(e)]),Mf=(n,t,e,i)=>_.of(ee.NonStrokingColorCmyk,[j(n),j(t),j(e),j(i)]),Nf=(n,t,e,i)=>_.of(ee.StrokingColorCmyk,[j(n),j(t),j(e),j(i)]),Id=n=>_.of(ee.BeginMarkedContent,[Is(n)]),Ld=()=>_.of(ee.EndMarkedContent);var Hb=qn(Bb(),1),Po;(function(n){n.Grayscale="Grayscale",n.RGB="RGB",n.CMYK="CMYK"})(Po||(Po={}));var Vd=n=>(at(n,"gray",0,1),{type:Po.Grayscale,gray:n}),ne=(n,t,e)=>(at(n,"red",0,1),at(t,"green",0,1),at(e,"blue",0,1),{type:Po.RGB,red:n,green:t,blue:e}),Bd=(n,t,e,i)=>(at(n,"cyan",0,1),at(t,"magenta",0,1),at(e,"yellow",0,1),at(i,"key",0,1),{type:Po.CMYK,cyan:n,magenta:t,yellow:e,key:i}),zf=n=>{S(n,"color",["string"]);let t=(0,Hb.default)(n).unitObject();return{rgb:ne(t.r,t.g,t.b),alpha:t.alpha}},{Grayscale:qf,RGB:Wf,CMYK:jf}=Po,ei=n=>n.type===qf?Af(n.gray):n.type===Wf?Lf(n.red,n.green,n.blue):n.type===jf?Mf(n.cyan,n.magenta,n.yellow,n.key):Xn(`Invalid color: ${JSON.stringify(n)}`),Sn=n=>n.type===qf?If(n.gray):n.type===Wf?Of(n.red,n.green,n.blue):n.type===jf?Nf(n.cyan,n.magenta,n.yellow,n.key):Xn(`Invalid color: ${JSON.stringify(n)}`),dt=(n,t=1)=>(n==null?void 0:n.length)===1?Vd(n[0]*t):(n==null?void 0:n.length)===3?ne(n[0]*t,n[1]*t,n[2]*t):(n==null?void 0:n.length)===4?Bd(n[0]*t,n[1]*t,n[2]*t,n[3]*t):void 0,Hd=n=>n.type===qf?[n.gray]:n.type===Wf?[n.red,n.green,n.blue]:n.type===jf?[n.cyan,n.magenta,n.yellow,n.key]:Xn(`Invalid color: ${JSON.stringify(n)}`);var Z=0,Y=0,le=0,ce=0,ic=0,nc=0,Ub=new Map([["A",7],["a",7],["C",6],["c",6],["H",1],["h",1],["L",2],["l",2],["M",2],["m",2],["Q",4],["q",4],["S",4],["s",4],["T",2],["t",2],["V",1],["v",1],["Z",0],["z",0]]),EF=n=>{let t,e=[],i=[],r="",o=!1,s=0;for(let a of n)if(Ub.has(a))s=Ub.get(a),t&&(r.length>0&&(i[i.length]=+r),e[e.length]={cmd:t,args:i},i=[],r="",o=!1),t=a;else if([" ",","].includes(a)||a==="-"&&r.length>0&&r[r.length-1]!=="e"||a==="."&&o){if(r.length===0)continue;i.length===s?(e[e.length]={cmd:t,args:i},i=[+r],t==="M"&&(t="L"),t==="m"&&(t="l")):i[i.length]=+r,o=a===".",r=["-","."].includes(a)?a:""}else r+=a,a==="."&&(o=!0);return r.length>0&&(i.length===s?(e[e.length]={cmd:t,args:i},i=[+r],t==="M"&&(t="L"),t==="m"&&(t="l")):i[i.length]=+r),e[e.length]={cmd:t,args:i},e},AF=n=>{Z=Y=le=ce=ic=nc=0;let t=[];for(let e=0;e{let[i,r,o,s,a,c,l]=e,d=IF(c,l,i,r,s,a,o,n,t),h=[];for(let u of d){let f=LF(...u);h.push(mt(...f))}return h},IF=(n,t,e,i,r,o,s,a,c)=>{let l=s*(Math.PI/180),d=Math.sin(l),h=Math.cos(l);e=Math.abs(e),i=Math.abs(i),le=h*(a-n)*.5+d*(c-t)*.5,ce=h*(c-t)*.5-d*(a-n)*.5;let u=le*le/(e*e)+ce*ce/(i*i);u>1&&(u=Math.sqrt(u),e*=u,i*=u);let f=h/e,p=d/e,g=-d/i,m=h/i,b=f*a+p*c,w=g*a+m*c,F=f*n+p*t,v=g*n+m*t,k=1/((F-b)*(F-b)+(v-w)*(v-w))-.25;k<0&&(k=0);let T=Math.sqrt(k);o===r&&(T=-T);let D=.5*(b+F)-T*(v-w),C=.5*(w+v)+T*(F-b),O=Math.atan2(w-C,b-D),V=Math.atan2(v-C,F-D)-O;V<0&&o===1?V+=2*Math.PI:V>0&&o===0&&(V-=2*Math.PI);let W=Math.ceil(Math.abs(V/(Math.PI*.5+.001))),B=[];for(let U=0;U{let c=a*r,l=-s*o,d=s*r,h=a*o,u=.5*(i-e),f=8/3*Math.sin(u*.5)*Math.sin(u*.5)/Math.sin(u),p=n+Math.cos(e)-f*Math.sin(e),g=t+Math.sin(e)+f*Math.cos(e),m=n+Math.cos(i),b=t+Math.sin(i),w=m+f*Math.sin(i),F=b-f*Math.cos(i);return[c*p+l*g,d*p+h*g,c*w+l*F,d*w+h*F,c*m+l*b,d*m+h*b]},Wb=n=>AF(EF(n));var OF=({topLeft:n,topRight:t,bottomRight:e,bottomLeft:i})=>[Et(n.x,n.y),Ve(t.x,t.y),Ve(e.x,e.y),Ve(i.x,i.y),$t(),Gl(),Yl()],zs=n=>n.flatMap(OF),MF=(n,t)=>[Ne(),t.graphicsState&&ji(t.graphicsState),Ql(),ei(t.color),Fo(t.font,t.size),t.strokeWidth&&Dn(t.strokeWidth),t.strokeColor&&Sn(t.strokeColor),t.renderMode&&Ad(t.renderMode),Vs(qe(t.rotate),qe(t.xSkew),qe(t.ySkew),t.x,t.y),Jl(n),_l(),Re()].filter(Boolean),Kf=(n,t)=>{let e=[Ne(),t.graphicsState&&ji(t.graphicsState),...t.clipSpaces?zs(t.clipSpaces):[],t.matrix&&_t(...t.matrix),Ql(),ei(t.color),Fo(t.font,t.size),Ef(t.lineHeight),t.strokeWidth&&Dn(t.strokeWidth),t.strokeColor&&Sn(t.strokeColor),t.renderMode&&Ad(t.renderMode),Vs(qe(t.rotate),qe(t.xSkew),qe(t.ySkew),t.x,t.y)].filter(Boolean);for(let i=0,r=n.length;i[Ne(),t.graphicsState&&ji(t.graphicsState),...t.clipSpaces?zs(t.clipSpaces):[],t.matrix&&_t(...t.matrix),gt(t.x,t.y),dr(qe(t.rotate)),cr(t.width,t.height),Ms(qe(t.xSkew),qe(t.ySkew)),Bs(n),Re()].filter(Boolean),Gf=(n,t)=>[Ne(),t.graphicsState&&ji(t.graphicsState),gt(t.x,t.y),dr(qe(t.rotate)),cr(t.xScale,t.yScale),Ms(qe(t.xSkew),qe(t.ySkew)),Bs(n),Re()].filter(Boolean),Xf=n=>{var t,e;return[Ne(),n.graphicsState&&ji(n.graphicsState),...n.clipSpaces?zs(n.clipSpaces):[],n.matrix&&_t(...n.matrix),n.color&&Sn(n.color),Dn(n.thickness),wo((t=n.dashArray)!==null&&t!==void 0?t:[],(e=n.dashPhase)!==null&&e!==void 0?e:0),Et(n.start.x,n.start.y),n.lineCap&&Ns(n.lineCap),Et(n.start.x,n.start.y),Ve(n.end.x,n.end.y),vo(),Re()].filter(Boolean)},ur=n=>{var t,e;return[Ne(),n.graphicsState&&ji(n.graphicsState),n.color&&ei(n.color),n.borderColor&&Sn(n.borderColor),Dn(n.borderWidth),n.borderLineCap&&Ns(n.borderLineCap),wo((t=n.borderDashArray)!==null&&t!==void 0?t:[],(e=n.borderDashPhase)!==null&&e!==void 0?e:0),...n.clipSpaces?zs(n.clipSpaces):[],n.matrix&&_t(...n.matrix),gt(n.x,n.y),dr(qe(n.rotate)),Ms(qe(n.xSkew),qe(n.ySkew)),Et(0,0),Ve(0,n.height),Ve(n.width,n.height),Ve(n.width,0),$t(),n.color&&n.borderWidth?Zl():n.color?Xl():n.borderColor?vo():$t(),Re()].filter(Boolean)},Ud=4*((Math.sqrt(2)-1)/3),jb=n=>{let t=$(n.x),e=$(n.y),i=$(n.xScale),r=$(n.yScale);t-=i,e-=r;let o=i*Ud,s=r*Ud,a=t+i*2,c=e+r*2,l=t+i,d=e+r;return[Ne(),Et(t,d),mt(t,d-s,l-o,e,l,e),mt(l+o,e,a,d-s,a,d),mt(a,d+s,l+o,c,l,c),mt(l-o,c,t,d+s,t,d),Re()]},NF=n=>{let t=$(n.x),e=$(n.y),i=$(n.xScale),r=$(n.yScale),o=-i,s=-r,a=i*Ud,c=r*Ud,l=o+i*2,d=s+r*2,h=o+i,u=s+r;return[gt(t,e),dr(qe(n.rotate)),Et(o,u),mt(o,u-c,h-a,s,h,s),mt(h+a,s,l,u-c,l,u),mt(l,u+c,h+a,d,h,d),mt(h-a,d,o,u+c,o,u)]},rc=n=>{var t,e,i;return[Ne(),n.graphicsState&&ji(n.graphicsState),n.color&&ei(n.color),n.borderColor&&Sn(n.borderColor),...n.clipSpaces?zs(n.clipSpaces):[],n.matrix&&_t(...n.matrix),Dn(n.borderWidth),n.borderLineCap&&Ns(n.borderLineCap),wo((t=n.borderDashArray)!==null&&t!==void 0?t:[],(e=n.borderDashPhase)!==null&&e!==void 0?e:0),...n.rotate===void 0?jb({x:n.x,y:n.y,xScale:n.xScale,yScale:n.yScale}):NF({x:n.x,y:n.y,xScale:n.xScale,yScale:n.yScale,rotate:(i=n.rotate)!==null&&i!==void 0?i:X(0)}),n.color&&n.borderWidth?Zl():n.color?Xl():n.borderColor?vo():$t(),Re()].filter(Boolean)},Zf=(n,t)=>{var e,i,r;return[Ne(),t.graphicsState&&ji(t.graphicsState),...t.clipSpaces?zs(t.clipSpaces):[],t.matrix&&_t(...t.matrix),gt(t.x,t.y),dr(qe((e=t.rotate)!==null&&e!==void 0?e:X(0))),t.scale?cr(t.scale,-t.scale):cr(1,-1),t.color&&ei(t.color),t.borderColor&&Sn(t.borderColor),t.borderWidth&&Dn(t.borderWidth),t.borderLineCap&&Ns(t.borderLineCap),wo((i=t.borderDashArray)!==null&&i!==void 0?i:[],(r=t.borderDashPhase)!==null&&r!==void 0?r:0),...Wb(n),t.color&&t.borderWidth?Zl():t.color?t.fillRule===Wi.EvenOdd?Tf():Xl():t.borderColor?vo():$t(),Re()].filter(Boolean)},Kb=n=>{let t=$(n.size),e=-1+.75,i=-1+.51,r=1-.525,o=1-.31,s=-1+.325,a=-((s-e)*(o-e))/(r-i)+i;return[Ne(),n.color&&Sn(n.color),Dn(n.thickness),gt(n.x,n.y),Et(s*t,a*t),Ve(e*t,i*t),Ve(o*t,r*t),vo(),Re()].filter(Boolean)},ti=n=>n.rotation===0?[gt(0,0),Os(0)]:n.rotation===90?[gt(n.width,0),Os(90)]:n.rotation===180?[gt(n.width,n.height),Os(180)]:n.rotation===270?[gt(0,n.height),Os(270)]:[],qs=n=>{let t=ur({x:n.x,y:n.y,width:n.width,height:n.height,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:X(0),xSkew:X(0),ySkew:X(0)});if(!n.filled)return t;let e=$(n.width),i=$(n.height),r=Math.min(e,i)/2,o=Kb({x:e/2,y:i/2,size:r,thickness:n.thickness,color:n.markColor});return[Ne(),...t,...o,Re()]},Ws=n=>{let t=$(n.width),e=$(n.height),i=Math.min(t,e)/2,r=rc({x:n.x,y:n.y,xScale:i,yScale:i,color:n.color,borderColor:n.borderColor,borderWidth:n.borderWidth});if(!n.filled)return r;let o=rc({x:n.x,y:n.y,xScale:i*.45,yScale:i*.45,color:n.dotColor,borderColor:void 0,borderWidth:0});return[Ne(),...r,...o,Re()]},zd=n=>{let t=$(n.x),e=$(n.y),i=$(n.width),r=$(n.height),o=ur({x:t,y:e,width:i,height:r,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:X(0),xSkew:X(0),ySkew:X(0)}),s=qd(n.textLines,{color:n.textColor,font:n.font,size:n.fontSize,rotate:X(0),xSkew:X(0),ySkew:X(0)});return[Ne(),...o,...s,Re()]},qd=(n,t)=>{let e=[Ql(),ei(t.color),Fo(t.font,t.size)];for(let i=0,r=n.length;i{let t=$(n.x),e=$(n.y),i=$(n.width),r=$(n.height),o=$(n.borderWidth),s=$(n.padding),a=t+o/2+s,c=e+o/2+s,l=i-(o/2+s)*2,d=r-(o/2+s)*2,h=[Et(a,c),Ve(a,c+d),Ve(a+l,c+d),Ve(a+l,c),$t(),Gl(),Yl()],u=ur({x:t,y:e,width:i,height:r,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:X(0),xSkew:X(0),ySkew:X(0)}),f=qd(n.textLines,{color:n.textColor,font:n.font,size:n.fontSize,rotate:X(0),xSkew:X(0),ySkew:X(0)}),p=[Id("Tx"),Ne(),...f,Re(),Ld()];return[Ne(),...u,...h,...p,Re()]},Yf=n=>{let t=$(n.x),e=$(n.y),i=$(n.width),r=$(n.height),o=$(n.lineHeight),s=$(n.borderWidth),a=$(n.padding),c=t+s/2+a,l=e+s/2+a,d=i-(s/2+a)*2,h=r-(s/2+a)*2,u=[Et(c,l),Ve(c,l+h),Ve(c+d,l+h),Ve(c+d,l),$t(),Gl(),Yl()],f=ur({x:t,y:e,width:i,height:r,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:X(0),xSkew:X(0),ySkew:X(0)}),p=[];for(let b=0,w=n.selectedLines.length;b{let r=Gb;for(;rn.length)return r-1;let s=t.heightAtSize(r);if((s+s*.2)*o>Math.abs(e.height))return r-1;r+=1}return r},RF=(n,t,e,i)=>{let r=e.width/i,o=e.height,s=Gb,a=su(n);for(;sr*.75)return s-1}if(t.heightAtSize(s,{descender:!1})>o)return s-1;s+=1}return s},VF=n=>{for(let t=n.length;t>0;t--)if(/\s/.test(n[t]))return t},BF=(n,t,e,i)=>{var r;let o=n.length;for(;o>0;){let s=n.substring(0,o),a=e.encodeText(s),c=e.widthOfTextAtSize(s,i);if(c{let o=va(Wn(n));(e===void 0||e===0)&&(e=Zb(o,i,r,!0));let s=i.heightAtSize(e),a=s+s*.2,c=[],l=r.x,d=r.y,h=r.x+r.width,u=r.y+r.height,f=r.y+r.height;for(let p=0,g=o.length;ph&&(h=P+F),f+s>u&&(u=f+s),c.push({text:b,encoded:w,width:F,height:s,x:P,y:f}),m=v==null?void 0:v.trim()}}return{fontSize:e,lineHeight:a,lines:c,bounds:{x:l,y:d,width:h-l,height:u-d}}},_f=(n,{fontSize:t,font:e,bounds:i,cellCount:r})=>{let o=Wc(Wn(n));if(o.length>r)throw new uc(o.length,r);(t===void 0||t===0)&&(t=RF(o,e,i,r));let s=i.width/r,a=e.heightAtSize(t,{descender:!1}),c=i.y+(i.height/2-a/2),l=[],d=i.x,h=i.y,u=i.x+i.width,f=i.y+i.height,p=0,g=0;for(;pu&&(u=P+F),c+a>f&&(f=c+a),l.push({text:o,encoded:w,width:F,height:a,x:P,y:c}),p+=1,g+=b}return{fontSize:t,cells:l,bounds:{x:d,y:h,width:u-d,height:f-h}}},Ks=(n,{alignment:t,fontSize:e,font:i,bounds:r})=>{let o=Wc(Wn(n));(e===void 0||e===0)&&(e=Zb([o],i,r));let s=i.encodeText(o),a=i.widthOfTextAtSize(o,e),c=i.heightAtSize(e,{descender:!1}),l=t===He.Left?r.x:t===He.Center?r.x+r.width/2-a/2:t===He.Right?r.x+r.width-a:r.x,d=r.y+(r.height/2-c/2);return{fontSize:e,line:{text:o,encoded:s,width:a,height:c,x:l,y:d},bounds:{x:l,y:d,width:a,height:c}}};var Nt=n=>"normal"in n?n:{normal:n},HF=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,fr=n=>{var t,e;let i=(t=n.getDefaultAppearance())!==null&&t!==void 0?t:"",r=(e=Xo(i,HF).match)!==null&&e!==void 0?e:[],o=Number(r[2]);return isFinite(o)?o:void 0},UF=/(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/,ii=n=>{var t;let e=(t=n.getDefaultAppearance())!==null&&t!==void 0?t:"",i=Xo(e,UF).match,[,r,o,s,a,c]=i!=null?i:[];if(c==="g"&&r)return Vd(Number(r));if(c==="rg"&&r&&o&&s)return ne(Number(r),Number(o),Number(s));if(c==="k"&&r&&o&&s&&a)return Bd(Number(r),Number(o),Number(s),Number(a))},ni=(n,t,e,i=0)=>{var r;let o=[ei(t).toString(),Fo((r=e==null?void 0:e.name)!==null&&r!==void 0?r:"dummy__noop",i).toString()].join(` +`);n.setDefaultAppearance(o)},$f=(n,t)=>{var e,i,r;let o=ii(t),s=ii(n.acroField),a=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),d=(e=l==null?void 0:l.getWidth())!==null&&e!==void 0?e:0,h=Jt(c==null?void 0:c.getRotation()),{width:u,height:f}=qi(a,h),p=ti({...a,rotation:h}),g=ne(0,0,0),m=(i=dt(c==null?void 0:c.getBorderColor()))!==null&&i!==void 0?i:g,b=dt(c==null?void 0:c.getBackgroundColor()),w=dt(c==null?void 0:c.getBackgroundColor(),.8),F=(r=o!=null?o:s)!==null&&r!==void 0?r:g;ni(o?t:n.acroField,F);let v={x:0+d/2,y:0+d/2,width:u-d,height:f-d,thickness:1.5,borderWidth:d,borderColor:m,markColor:F};return{normal:{on:[...p,...qs({...v,color:b,filled:!0})],off:[...p,...qs({...v,color:b,filled:!1})]},down:{on:[...p,...qs({...v,color:w,filled:!0})],off:[...p,...qs({...v,color:w,filled:!1})]}}},ep=(n,t)=>{var e,i,r;let o=ii(t),s=ii(n.acroField),a=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),d=(e=l==null?void 0:l.getWidth())!==null&&e!==void 0?e:0,h=Jt(c==null?void 0:c.getRotation()),{width:u,height:f}=qi(a,h),p=ti({...a,rotation:h}),g=ne(0,0,0),m=(i=dt(c==null?void 0:c.getBorderColor()))!==null&&i!==void 0?i:g,b=dt(c==null?void 0:c.getBackgroundColor()),w=dt(c==null?void 0:c.getBackgroundColor(),.8),F=(r=o!=null?o:s)!==null&&r!==void 0?r:g;ni(o?t:n.acroField,F);let v={x:u/2,y:f/2,width:u-d,height:f-d,borderWidth:d,borderColor:m,dotColor:F};return{normal:{on:[...p,...Ws({...v,color:b,filled:!0})],off:[...p,...Ws({...v,color:b,filled:!1})]},down:{on:[...p,...Ws({...v,color:w,filled:!0})],off:[...p,...Ws({...v,color:w,filled:!1})]}}},tp=(n,t,e)=>{var i,r,o,s,a;let c=ii(t),l=ii(n.acroField),d=fr(t),h=fr(n.acroField),u=t.getRectangle(),f=t.getAppearanceCharacteristics(),p=t.getBorderStyle(),g=f==null?void 0:f.getCaptions(),m=(i=g==null?void 0:g.normal)!==null&&i!==void 0?i:"",b=(o=(r=g==null?void 0:g.down)!==null&&r!==void 0?r:m)!==null&&o!==void 0?o:"",w=(s=p==null?void 0:p.getWidth())!==null&&s!==void 0?s:0,F=Jt(f==null?void 0:f.getRotation()),{width:v,height:P}=qi(u,F),k=ti({...u,rotation:F}),T=ne(0,0,0),D=dt(f==null?void 0:f.getBorderColor()),C=dt(f==null?void 0:f.getBackgroundColor()),O=dt(f==null?void 0:f.getBackgroundColor(),.8),E={x:w,y:w,width:v-w*2,height:P-w*2},V=Ks(m,{alignment:He.Center,fontSize:d!=null?d:h,font:e,bounds:E}),W=Ks(b,{alignment:He.Center,fontSize:d!=null?d:h,font:e,bounds:E}),B=Math.min(V.fontSize,W.fontSize),U=(a=c!=null?c:l)!==null&&a!==void 0?a:T;ni(c||d!==void 0?t:n.acroField,U,e,B);let te={x:0+w/2,y:0+w/2,width:v-w,height:P-w,borderWidth:w,borderColor:D,textColor:U,font:e.name,fontSize:B};return{normal:[...k,...zd({...te,color:C,textLines:[V.line]})],down:[...k,...zd({...te,color:O,textLines:[W.line]})]}},ip=(n,t,e)=>{var i,r,o,s;let a=ii(t),c=ii(n.acroField),l=fr(t),d=fr(n.acroField),h=t.getRectangle(),u=t.getAppearanceCharacteristics(),f=t.getBorderStyle(),p=(i=n.getText())!==null&&i!==void 0?i:"",g=(r=f==null?void 0:f.getWidth())!==null&&r!==void 0?r:0,m=Jt(u==null?void 0:u.getRotation()),{width:b,height:w}=qi(h,m),F=ti({...h,rotation:m}),v=ne(0,0,0),P=dt(u==null?void 0:u.getBorderColor()),k=dt(u==null?void 0:u.getBackgroundColor()),T,D,C=n.isCombed()?0:1,O={x:g+C,y:g+C,width:b-(g+C)*2,height:w-(g+C)*2};if(n.isMultiline()){let W=jd(p,{alignment:n.getAlignment(),fontSize:l!=null?l:d,font:e,bounds:O});T=W.lines,D=W.fontSize}else if(n.isCombed()){let W=_f(p,{fontSize:l!=null?l:d,font:e,bounds:O,cellCount:(o=n.getMaxLength())!==null&&o!==void 0?o:0});T=W.cells,D=W.fontSize}else{let W=Ks(p,{alignment:n.getAlignment(),fontSize:l!=null?l:d,font:e,bounds:O});T=[W.line],D=W.fontSize}let E=(s=a!=null?a:c)!==null&&s!==void 0?s:v;ni(a||l!==void 0?t:n.acroField,E,e,D);let V={x:0+g/2,y:0+g/2,width:b-g,height:w-g,borderWidth:g!=null?g:0,borderColor:P,textColor:E,font:e.name,fontSize:D,color:k,textLines:T,padding:C};return[...F,...Wd(V)]},np=(n,t,e)=>{var i,r,o;let s=ii(t),a=ii(n.acroField),c=fr(t),l=fr(n.acroField),d=t.getRectangle(),h=t.getAppearanceCharacteristics(),u=t.getBorderStyle(),f=(i=n.getSelected()[0])!==null&&i!==void 0?i:"",p=(r=u==null?void 0:u.getWidth())!==null&&r!==void 0?r:0,g=Jt(h==null?void 0:h.getRotation()),{width:m,height:b}=qi(d,g),w=ti({...d,rotation:g}),F=ne(0,0,0),v=dt(h==null?void 0:h.getBorderColor()),P=dt(h==null?void 0:h.getBackgroundColor()),k=1,T={x:p+k,y:p+k,width:m-(p+k)*2,height:b-(p+k)*2},{line:D,fontSize:C}=Ks(f,{alignment:He.Left,fontSize:c!=null?c:l,font:e,bounds:T}),O=(o=s!=null?s:a)!==null&&o!==void 0?o:F;ni(s||c!==void 0?t:n.acroField,O,e,C);let E={x:0+p/2,y:0+p/2,width:m-p,height:b-p,borderWidth:p!=null?p:0,borderColor:v,textColor:O,font:e.name,fontSize:C,color:P,textLines:[D],padding:k};return[...w,...Wd(E)]},rp=(n,t,e)=>{var i,r;let o=ii(t),s=ii(n.acroField),a=fr(t),c=fr(n.acroField),l=t.getRectangle(),d=t.getAppearanceCharacteristics(),h=t.getBorderStyle(),u=(i=h==null?void 0:h.getWidth())!==null&&i!==void 0?i:0,f=Jt(d==null?void 0:d.getRotation()),{width:p,height:g}=qi(l,f),m=ti({...l,rotation:f}),b=ne(0,0,0),w=dt(d==null?void 0:d.getBorderColor()),F=dt(d==null?void 0:d.getBackgroundColor()),v=n.getOptions(),P=n.getSelected();n.isSorted()&&v.sort();let k="";for(let U=0,te=v.length;Unew ki(n,t,e);var Se=class{constructor(t,e,i){this.modified=!0,S(t,"ref",[[q,"PDFRef"]]),S(e,"doc",[[pe,"PDFDocument"]]),S(i,"embedder",[[rr,"CustomFontEmbedder"],[nr,"StandardFontEmbedder"]]),this.ref=t,this.doc=e,this.name=i.fontName,this.embedder=i}encodeText(t){return S(t,"text",["string"]),this.modified=!0,this.embedder.encodeText(t)}widthOfTextAtSize(t,e){return S(t,"text",["string"]),S(e,"size",["number"]),this.embedder.widthOfTextAtSize(t,e)}heightAtSize(t,e){var i;return S(t,"size",["number"]),I(e==null?void 0:e.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(t,{descender:(i=e==null?void 0:e.descender)!==null&&i!==void 0?i:!0})}sizeAtHeight(t){return S(t,"height",["number"]),this.embedder.sizeOfFontAtHeight(t)}getCharacterSet(){return this.embedder instanceof nr?this.embedder.encoding.supportedCodePoints:this.embedder.font.characterSet}async embed(){this.modified&&(await this.embedder.embedIntoContext(this.doc.context,this.ref),this.modified=!1)}};Se.of=(n,t,e)=>new Se(n,t,e);var ri=class{constructor(t,e,i){S(t,"ref",[[q,"PDFRef"]]),S(e,"doc",[[pe,"PDFDocument"]]),S(i,"embedder",[[xs,"JpegEmbedder"],[ws,"PngEmbedder"]]),this.ref=t,this.doc=e,this.width=i.width,this.height=i.height,this.embedder=i}scale(t){return S(t,"factor",["number"]),{width:this.width*t,height:this.height*t}}scaleToFit(t,e){S(t,"width",["number"]),S(e,"height",["number"]);let i=t/this.width,r=e/this.height,o=Math.min(i,r);return this.scale(o)}size(){return this.scale(1)}async embed(){if(this.embedder){if(!this.embedTask){let{doc:t,ref:e}=this;this.embedTask=this.embedder.embedIntoContext(t.context,e)}await this.embedTask,this.embedder=void 0}}};ri.of=(n,t,e)=>new ri(n,t,e);var oi;(function(n){n[n.Left=0]="Left",n[n.Center=1]="Center",n[n.Right=2]="Right"})(oi||(oi={}));var si=n=>{I(n==null?void 0:n.x,"options.x",["number"]),I(n==null?void 0:n.y,"options.y",["number"]),I(n==null?void 0:n.width,"options.width",["number"]),I(n==null?void 0:n.height,"options.height",["number"]),I(n==null?void 0:n.textColor,"options.textColor",[[Object,"Color"]]),I(n==null?void 0:n.backgroundColor,"options.backgroundColor",[[Object,"Color"]]),I(n==null?void 0:n.borderColor,"options.borderColor",[[Object,"Color"]]),I(n==null?void 0:n.borderWidth,"options.borderWidth",["number"]),I(n==null?void 0:n.rotate,"options.rotate",[[Object,"Rotation"]])},et=class{constructor(t,e,i){S(t,"acroField",[[Ct,"PDFAcroTerminal"]]),S(e,"ref",[[q,"PDFRef"]]),S(i,"doc",[[pe,"PDFDocument"]]),this.acroField=t,this.ref=e,this.doc=i}getName(){var t;return(t=this.acroField.getFullyQualifiedName())!==null&&t!==void 0?t:""}isReadOnly(){return this.acroField.hasFlag(Lt.ReadOnly)}enableReadOnly(){this.acroField.setFlagTo(Lt.ReadOnly,!0)}disableReadOnly(){this.acroField.setFlagTo(Lt.ReadOnly,!1)}isRequired(){return this.acroField.hasFlag(Lt.Required)}enableRequired(){this.acroField.setFlagTo(Lt.Required,!0)}disableRequired(){this.acroField.setFlagTo(Lt.Required,!1)}isExported(){return!this.acroField.hasFlag(Lt.NoExport)}enableExporting(){this.acroField.setFlagTo(Lt.NoExport,!1)}disableExporting(){this.acroField.setFlagTo(Lt.NoExport,!0)}needsAppearancesUpdate(){throw new Ge(this.constructor.name,"needsAppearancesUpdate")}defaultUpdateAppearances(t){throw new Ge(this.constructor.name,"defaultUpdateAppearances")}markAsDirty(){this.doc.getForm().markFieldAsDirty(this.ref)}markAsClean(){this.doc.getForm().markFieldAsClean(this.ref)}isDirty(){return this.doc.getForm().fieldIsDirty(this.ref)}createWidget(t){var e;let i=t.textColor,r=t.backgroundColor,o=t.borderColor,s=t.borderWidth,a=Kl(t.rotate),c=t.caption,l=t.x,d=t.y,h=t.width+s,u=t.height+s,f=Boolean(t.hidden),p=t.page;Za(a,"degreesAngle",90);let g=oo.create(this.doc.context,this.ref),m=Df({x:l,y:d,width:h,height:u},s,a);g.setRectangle(m),p&&g.setP(p);let b=g.getOrCreateAppearanceCharacteristics();r&&b.setBackgroundColor(Hd(r)),b.setRotation(a),c&&b.setCaptions({normal:c}),o&&b.setBorderColor(Hd(o));let w=g.getOrCreateBorderStyle();if(s!==void 0&&w.setWidth(s),g.setFlagTo(xo.Print,!0),g.setFlagTo(xo.Hidden,f),g.setFlagTo(xo.Invisible,!1),i){let v=((e=this.acroField.getDefaultAppearance())!==null&&e!==void 0?e:"")+` +`+ei(i).toString();this.acroField.setDefaultAppearance(v)}return g}updateWidgetAppearanceWithFont(t,e,{normal:i,rollover:r,down:o}){this.updateWidgetAppearances(t,{normal:this.createAppearanceStream(t,i,e),rollover:r&&this.createAppearanceStream(t,r,e),down:o&&this.createAppearanceStream(t,o,e)})}updateOnOffWidgetAppearance(t,e,{normal:i,rollover:r,down:o}){this.updateWidgetAppearances(t,{normal:this.createAppearanceDict(t,i,e),rollover:r&&this.createAppearanceDict(t,r,e),down:o&&this.createAppearanceDict(t,o,e)})}updateWidgetAppearances(t,{normal:e,rollover:i,down:r}){t.setNormalAppearance(e),i?t.setRolloverAppearance(i):t.removeRolloverAppearance(),r?t.setDownAppearance(r):t.removeDownAppearance()}createAppearanceStream(t,e,i){let{context:r}=this.acroField.dict,{width:o,height:s}=t.getRectangle(),a=i&&{Font:{[i.name]:i.ref}},c=r.formXObject(e,{Resources:a,BBox:r.obj([0,0,o,s]),Matrix:r.obj([1,0,0,1,0,0])});return r.register(c)}createImageAppearanceStream(t,e,i){var r;let{context:o}=this.acroField.dict,s=t.getRectangle(),a=t.getAppearanceCharacteristics(),c=t.getBorderStyle(),l=(r=c==null?void 0:c.getWidth())!==null&&r!==void 0?r:0,d=Jt(a==null?void 0:a.getRotation()),h=ti({...s,rotation:d}),u=qi(s,d),f=e.scaleToFit(u.width-l*2,u.height-l*2),p={x:l,y:l,width:f.width,height:f.height,rotate:X(0),xSkew:X(0),ySkew:X(0)};i===oi.Center?(p.x+=(u.width-l*2)/2-f.width/2,p.y+=(u.height-l*2)/2-f.height/2):i===oi.Right&&(p.x=u.width-l-f.width,p.y=u.height-l-f.height);let g=this.doc.context.addRandomSuffix("Image",10),m=[...h,...oc(g,p)],b={XObject:{[g]:e.ref}},w=o.formXObject(m,{Resources:b,BBox:o.obj([0,0,s.width,s.height]),Matrix:o.obj([1,0,0,1,0,0])});return o.register(w)}createAppearanceDict(t,e,i){let{context:r}=this.acroField.dict,o=this.createAppearanceStream(t,e.on),s=this.createAppearanceStream(t,e.off),a=r.obj({});return a.set(i,o),a.set(x.of("Off"),s),a}};var Rt=class extends et{constructor(t,e,i){super(t,e,i),S(t,"acroCheckBox",[[xn,"PDFAcroCheckBox"]]),this.acroField=t}check(){var t;let e=(t=this.acroField.getOnValue())!==null&&t!==void 0?t:x.of("Yes");this.markAsDirty(),this.acroField.setValue(e)}uncheck(){this.markAsDirty(),this.acroField.setValue(x.of("Off"))}isChecked(){let t=this.acroField.getOnValue();return!!t&&t===this.acroField.getValue()}addToPage(t,e){var i,r,o,s,a,c;S(t,"page",[[ke,"PDFPage"]]),si(e),e||(e={}),"textColor"in e||(e.textColor=ne(0,0,0)),"backgroundColor"in e||(e.backgroundColor=ne(1,1,1)),"borderColor"in e||(e.borderColor=ne(0,0,0)),"borderWidth"in e||(e.borderWidth=1);let l=this.createWidget({x:(i=e.x)!==null&&i!==void 0?i:0,y:(r=e.y)!==null&&r!==void 0?r:0,width:(o=e.width)!==null&&o!==void 0?o:50,height:(s=e.height)!==null&&s!==void 0?s:50,textColor:e.textColor,backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:(a=e.borderWidth)!==null&&a!==void 0?a:0,rotate:(c=e.rotate)!==null&&c!==void 0?c:X(0),hidden:e.hidden,page:t.ref}),d=this.doc.context.register(l.dict);this.acroField.addWidget(d),l.setAppearanceState(x.of("Off")),this.updateWidgetAppearance(l,x.of("Yes")),t.node.addAnnot(d)}needsAppearancesUpdate(){var t;let e=this.acroField.getWidgets();for(let i=0,r=e.length;inew Rt(n,t,e);var ai=class extends et{constructor(t,e,i){super(t,e,i),S(t,"acroComboBox",[[yn,"PDFAcroComboBox"]]),this.acroField=t}getOptions(){let t=this.acroField.getOptions(),e=new Array(t.length);for(let i=0,r=e.length;i!r.includes(a))&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&e)&&this.enableMultiselect();let s=new Array(i.length);for(let a=0,c=i.length;anew ai(n,t,e);var li=class extends et{constructor(t,e,i){super(t,e,i),S(t,"acroListBox",[[kn,"PDFAcroListBox"]]),this.acroField=t}getOptions(){let t=this.acroField.getOptions(),e=new Array(t.length);for(let i=0,r=e.length;i1||i.length===1&&e)&&this.enableMultiselect();let o=new Array(i.length);for(let s=0,a=i.length;snew li(n,t,e);var Vt=class extends et{constructor(t,e,i){super(t,e,i),S(t,"acroRadioButton",[[Pn,"PDFAcroRadioButton"]]),this.acroField=t}getOptions(){let t=this.acroField.getExportValues();if(t){let r=new Array(t.length);for(let o=0,s=t.length;onew Vt(n,t,e);var Di=class extends et{constructor(t,e,i){super(t,e,i),S(t,"acroSignature",[[sr,"PDFAcroSignature"]]),this.acroField=t}needsAppearancesUpdate(){return!1}};Di.of=(n,t,e)=>new Di(n,t,e);var ci=class extends et{constructor(t,e,i){super(t,e,i),S(t,"acroText",[[vn,"PDFAcroText"]]),this.acroField=t}getText(){let t=this.acroField.getValue();if(!t&&this.isRichFormatted())throw new hc(this.getName());return t==null?void 0:t.decodeText()}setText(t){I(t,"text",["string"]);let e=this.getMaxLength();if(e!==void 0&&t&&t.length>e)throw new fc(t.length,e,this.getName());this.markAsDirty(),this.disableRichFormatting(),t?this.acroField.setValue(M.fromText(t)):this.acroField.removeValue()}getAlignment(){let t=this.acroField.getQuadding();return t===0?He.Left:t===1?He.Center:t===2?He.Right:He.Left}setAlignment(t){Gt(t,"alignment",He),this.markAsDirty(),this.acroField.setQuadding(t)}getMaxLength(){return this.acroField.getMaxLength()}setMaxLength(t){if(St(t,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),t===void 0)this.acroField.removeMaxLength();else{let e=this.getText();if(e&&e.length>t)throw new pc(e.length,t,this.getName());this.acroField.setMaxLength(t)}}removeMaxLength(){this.markAsDirty(),this.acroField.removeMaxLength()}setImage(t){let e=this.getAlignment(),i=e===He.Center?oi.Center:e===He.Right?oi.Right:oi.Left,r=this.acroField.getWidgets();for(let o=0,s=r.length;onew ci(n,t,e);var Do;(function(n){n.Courier="Courier",n.CourierBold="Courier-Bold",n.CourierOblique="Courier-Oblique",n.CourierBoldOblique="Courier-BoldOblique",n.Helvetica="Helvetica",n.HelveticaBold="Helvetica-Bold",n.HelveticaOblique="Helvetica-Oblique",n.HelveticaBoldOblique="Helvetica-BoldOblique",n.TimesRoman="Times-Roman",n.TimesRomanBold="Times-Bold",n.TimesRomanItalic="Times-Italic",n.TimesRomanBoldItalic="Times-BoldItalic",n.Symbol="Symbol",n.ZapfDingbats="ZapfDingbats"})(Do||(Do={}));var Tn=class{constructor(t,e){this.embedDefaultFont=()=>this.doc.embedStandardFont(Do.Helvetica),S(t,"acroForm",[[ar,"PDFAcroForm"]]),S(e,"doc",[[pe,"PDFDocument"]]),this.acroForm=t,this.doc=e,this.dirtyFields=new Set,this.defaultFontCache=lt.populatedBy(this.embedDefaultFont)}hasXFA(){return this.acroForm.dict.has(x.of("XFA"))}deleteXFA(){this.acroForm.dict.delete(x.of("XFA"))}getFields(){let t=this.acroForm.getAllFields(),e=[];for(let i=0,r=t.length;is.node.removeAnnot(t.ref)),this.acroForm.removeField(t.acroField);let r=t.acroField.normalizedEntries().Kids,o=r.size();for(let s=0;sr.ref===e);if(i===void 0){let r=this.doc.context.getObjectRef(t.dict);if(r===void 0)throw new Error("Could not find PDFRef for PDFObject");if(i=this.doc.findPageForAnnotationRef(r),i===void 0)throw new Error(`Could not find page for PDFRef ${r}`)}return i}findWidgetAppearanceRef(t,e){var i;let r=e.getNormalAppearance();if(r instanceof R&&(t instanceof Rt||t instanceof Vt)){let o=t.acroField.getValue(),s=(i=r.get(o))!==null&&i!==void 0?i:r.get(x.of("Off"));s instanceof q&&(r=s)}if(!(r instanceof q)){let o=t.getName();throw new Error(`Failed to extract appearance ref for: ${o}`)}return r}findOrCreateNonTerminals(t){let e=[this.acroForm];for(let i=0,r=t.length;inew Tn(n,t);var zF=(n,t,e)=>{if(n instanceof Fn)return di.of(n,t,e);if(n instanceof xn)return Rt.of(n,t,e);if(n instanceof yn)return ai.of(n,t,e);if(n instanceof kn)return li.of(n,t,e);if(n instanceof vn)return ci.of(n,t,e);if(n instanceof Pn)return Vt.of(n,t,e);if(n instanceof sr)return Di.of(n,t,e)},Gs=n=>{if(n.length===0)throw new Error("PDF field names must not be empty strings");let t=n.split(".");for(let e=0,i=t.length;e{let o=n.normalizedEntries(),s=Ts("Kids"in o?o.Kids:o.Fields);for(let a=0,c=s.length;anew To(n,t,e);var Cn=class{constructor(t,e,i){this.alreadyEmbedded=!1,this.ref=t,this.doc=e,this.embedder=i}async embed(){if(!this.alreadyEmbedded){let{catalog:t,context:e}=this.doc,i=await this.embedder.embedIntoContext(this.doc.context,this.ref);t.has(x.of("Names"))||t.set(x.of("Names"),e.obj({}));let r=t.lookup(x.of("Names"),R);r.has(x.of("JavaScript"))||r.set(x.of("JavaScript"),e.obj({}));let o=r.lookup(x.of("JavaScript"),R);o.has(x.of("Names"))||o.set(x.of("Names"),e.obj([]));let s=o.lookup(x.of("Names"),H);s.push(M.fromText(this.embedder.scriptName)),s.push(i),this.alreadyEmbedded=!0}}};Cn.of=(n,t,e)=>new Cn(n,t,e);var mc=class{static for(t,e){return new mc(t,e)}constructor(t,e){this.script=t,this.scriptName=e}async embedIntoContext(t,e){let i=t.obj({Type:"Action",S:"JavaScript",JS:M.fromText(this.script)});return e?(t.assign(e,i),e):t.register(i)}},Yb=mc;var Jb=512,op=class extends Zt{constructor(t,e,i){super(i),this.stream=t,this.decrypt=e,this.nextChunk=null,this.initialized=!1}readBlock(){let t;if(this.initialized?t=this.nextChunk:(t=this.stream.getBytes(Jb),this.initialized=!0),!t||t.length===0){this.eof=!0;return}this.nextChunk=this.stream.getBytes(Jb);let e=this.nextChunk&&this.nextChunk.length>0,i=this.decrypt;t=i(t,!e);let r=this.bufferLength,o=r+t.length;this.ensureBuffer(o).set(t,r),this.bufferLength=o}},Qb=op;var En=class{constructor(t){this.a=0,this.b=0;let e=new Uint8Array(256),i=t.length;for(let r=0;r<256;++r)e[r]=r;for(let r=0,o=0;r<256;++r){let s=e[r];o=o+s+t[r%i]&255,e[r]=e[o],e[o]=s}this.s=e}encryptBlock(t){let e=this.a,i=this.b,r=this.s,o=t.length,s=new Uint8Array(o);for(let a=0;a>5&255,u[f++]=s>>13&255,u[f++]=s>>21&255,u[f++]=s>>>29&255,u[f++]=0,u[f++]=0,u[f++]=0;let m=new Int32Array(16);for(f=0;f>>32-C)|0,b=T}a=a+b|0,c=c+w|0,l=l+F|0,d=d+v|0}return new Uint8Array([a&255,a>>8&255,a>>16&255,a>>>24&255,c&255,c>>8&255,c>>16&255,c>>>24&255,l&255,l>>8&255,l>>16&255,l>>>24&255,d&255,d>>8&255,d>>16&255,d>>>24&255])}return i}(),A=class{constructor(t,e){this.high=t|0,this.low=e|0}and(t){this.high&=t.high,this.low&=t.low}xor(t){this.high^=t.high,this.low^=t.low}or(t){this.high|=t.high,this.low|=t.low}shiftRight(t){t>=32?(this.low=this.high>>>t-32|0,this.high=0):(this.low=this.low>>>t|this.high<<32-t,this.high=this.high>>>t|0)}shiftLeft(t){t>=32?(this.high=this.low<>>32-t,this.low<<=t)}rotateRight(t){let e,i;t&32?(i=this.low,e=this.high):(e=this.low,i=this.high),t&=31,this.low=e>>>t|i<<32-t,this.high=i>>>t|e<<32-t}not(){this.high=~this.high,this.low=~this.low}add(t){let e=(this.low>>>0)+(t.low>>>0),i=(this.high>>>0)+(t.high>>>0);e>4294967295&&(i+=1),this.low=e|0,this.high=i|0}copyTo(t,e){t[e]=this.high>>>24&255,t[e+1]=this.high>>16&255,t[e+2]=this.high>>8&255,t[e+3]=this.high&255,t[e+4]=this.low>>>24&255,t[e+5]=this.low>>16&255,t[e+6]=this.low>>8&255,t[e+7]=this.low&255}assign(t){this.high=t.high,this.low=t.low}},Ys=function(){function t(d,h){return d>>>h|d<<32-h}function e(d,h,u){return d&h^~d&u}function i(d,h,u){return d&h^d&u^h&u}function r(d){return t(d,2)^t(d,13)^t(d,22)}function o(d){return t(d,6)^t(d,11)^t(d,25)}function s(d){return t(d,7)^t(d,18)^d>>>3}function a(d){return t(d,17)^t(d,19)^d>>>10}let c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function l(d,h,u){let f=1779033703,p=3144134277,g=1013904242,m=2773480762,b=1359893119,w=2600822924,F=528734635,v=1541459225,P=Math.ceil((u+9)/64)*64,k=new Uint8Array(P),T,D;for(T=0;T>>29&255,k[T++]=u>>21&255,k[T++]=u>>13&255,k[T++]=u>>5&255,k[T++]=u<<3&255;let O=new Uint32Array(64);for(T=0;T>24&255,f>>16&255,f>>8&255,f&255,p>>24&255,p>>16&255,p>>8&255,p&255,g>>24&255,g>>16&255,g>>8&255,g&255,m>>24&255,m>>16&255,m>>8&255,m&255,b>>24&255,b>>16&255,b>>8&255,b&255,w>>24&255,w>>16&255,w>>8&255,w&255,F>>24&255,F>>16&255,F>>8&255,F&255,v>>24&255,v>>16&255,v>>8&255,v&255])}return l}(),_b=function(){function t(l,d,h,u,f){l.assign(d),l.and(h),f.assign(d),f.not(),f.and(u),l.xor(f)}function e(l,d,h,u,f){l.assign(d),l.and(h),f.assign(d),f.and(u),l.xor(f),f.assign(h),f.and(u),l.xor(f)}function i(l,d,h){l.assign(d),l.rotateRight(28),h.assign(d),h.rotateRight(34),l.xor(h),h.assign(d),h.rotateRight(39),l.xor(h)}function r(l,d,h){l.assign(d),l.rotateRight(14),h.assign(d),h.rotateRight(18),l.xor(h),h.assign(d),h.rotateRight(41),l.xor(h)}function o(l,d,h){l.assign(d),l.rotateRight(1),h.assign(d),h.rotateRight(8),l.xor(h),h.assign(d),h.shiftRight(7),l.xor(h)}function s(l,d,h){l.assign(d),l.rotateRight(19),h.assign(d),h.rotateRight(61),l.xor(h),h.assign(d),h.shiftRight(6),l.xor(h)}let a=[new A(1116352408,3609767458),new A(1899447441,602891725),new A(3049323471,3964484399),new A(3921009573,2173295548),new A(961987163,4081628472),new A(1508970993,3053834265),new A(2453635748,2937671579),new A(2870763221,3664609560),new A(3624381080,2734883394),new A(310598401,1164996542),new A(607225278,1323610764),new A(1426881987,3590304994),new A(1925078388,4068182383),new A(2162078206,991336113),new A(2614888103,633803317),new A(3248222580,3479774868),new A(3835390401,2666613458),new A(4022224774,944711139),new A(264347078,2341262773),new A(604807628,2007800933),new A(770255983,1495990901),new A(1249150122,1856431235),new A(1555081692,3175218132),new A(1996064986,2198950837),new A(2554220882,3999719339),new A(2821834349,766784016),new A(2952996808,2566594879),new A(3210313671,3203337956),new A(3336571891,1034457026),new A(3584528711,2466948901),new A(113926993,3758326383),new A(338241895,168717936),new A(666307205,1188179964),new A(773529912,1546045734),new A(1294757372,1522805485),new A(1396182291,2643833823),new A(1695183700,2343527390),new A(1986661051,1014477480),new A(2177026350,1206759142),new A(2456956037,344077627),new A(2730485921,1290863460),new A(2820302411,3158454273),new A(3259730800,3505952657),new A(3345764771,106217008),new A(3516065817,3606008344),new A(3600352804,1432725776),new A(4094571909,1467031594),new A(275423344,851169720),new A(430227734,3100823752),new A(506948616,1363258195),new A(659060556,3750685593),new A(883997877,3785050280),new A(958139571,3318307427),new A(1322822218,3812723403),new A(1537002063,2003034995),new A(1747873779,3602036899),new A(1955562222,1575990012),new A(2024104815,1125592928),new A(2227730452,2716904306),new A(2361852424,442776044),new A(2428436474,593698344),new A(2756734187,3733110249),new A(3204031479,2999351573),new A(3329325298,3815920427),new A(3391569614,3928383900),new A(3515267271,566280711),new A(3940187606,3454069534),new A(4118630271,4000239992),new A(116418474,1914138554),new A(174292421,2731055270),new A(289380356,3203993006),new A(460393269,320620315),new A(685471733,587496836),new A(852142971,1086792851),new A(1017036298,365543100),new A(1126000580,2618297676),new A(1288033470,3409855158),new A(1501505948,4234509866),new A(1607167915,987167468),new A(1816402316,1246189591)];function c(l,d,h,u=!1){let f,p,g,m,b,w,F,v;u?(f=new A(3418070365,3238371032),p=new A(1654270250,914150663),g=new A(2438529370,812702999),m=new A(355462360,4144912697),b=new A(1731405415,4290775857),w=new A(2394180231,1750603025),F=new A(3675008525,1694076839),v=new A(1203062813,3204075428)):(f=new A(1779033703,4089235720),p=new A(3144134277,2227873595),g=new A(1013904242,4271175723),m=new A(2773480762,1595750129),b=new A(1359893119,2917565137),w=new A(2600822924,725511199),F=new A(528734635,4215389547),v=new A(1541459225,327033209));let P=Math.ceil((h+17)/128)*128,k=new Uint8Array(P),T,D;for(T=0;T>>29&255,k[T++]=h>>21&255,k[T++]=h>>13&255,k[T++]=h>>5&255,k[T++]=h<<3&255;let O=new Array(80);for(T=0;T<80;T++)O[T]=new A(0,0);let E=new A(0,0),V=new A(0,0),W=new A(0,0),B=new A(0,0),U=new A(0,0),te=new A(0,0),z=new A(0,0),oe=new A(0,0),Ee=new A(0,0),Ue=new A(0,0),me=new A(0,0),Ae=new A(0,0),ve;for(T=0;T=1;--a){i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],o=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=o;for(let c=0;c<16;++c)s[c]=this._inv_s[s[c]];for(let c=0,l=a*16;c<16;++c,++l)s[c]^=e[l];for(let c=0;c<16;c+=4){let l=this._mix[s[c]],d=this._mix[s[c+1]],h=this._mix[s[c+2]],u=this._mix[s[c+3]];i=l^d>>>8^d<<24^h>>>16^h<<16^u>>>24^u<<8,s[c]=i>>>24&255,s[c+1]=i>>16&255,s[c+2]=i>>8&255,s[c+3]=i&255}}i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],o=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=o;for(let a=0;a<16;++a)s[a]=this._inv_s[s[a]],s[a]^=e[a];return s}_encrypt(t,e){let i=this._s,r,o,s,a=new Uint8Array(16);a.set(t);for(let c=0;c<16;++c)a[c]^=e[c];for(let c=1;c=f;--u)if(d[u]!==h){h=0;break}c-=h,s[s.length-1]=d.subarray(0,16-h)}}let l=new Uint8Array(c);for(let d=0,h=0,u=s.length;d=256&&(o=(o^27)&255));for(let u=0;u<4;++u)r[d]=s^=r[d-32],d++,r[d]=a^=r[d-32],d++,r[d]=c^=r[d-32],d++,r[d]=l^=r[d-32],d++}return r}},ap=class{checkOwnerPassword(t,e,i,r){let o=new Uint8Array(t.length+56);o.set(t,0),o.set(e,t.length),o.set(i,t.length+e.length);let s=Ys(o,0,o.length);return Zo(s,r)}checkUserPassword(t,e,i){let r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);let o=Ys(r,0,r.length);return Zo(o,i)}getOwnerKey(t,e,i,r){let o=new Uint8Array(t.length+56);o.set(t,0),o.set(e,t.length),o.set(i,t.length+e.length);let s=Ys(o,0,o.length);return new Eo(s).decryptBlock(r,!1,new Uint8Array(16))}getUserKey(t,e,i){let r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);let o=Ys(r,0,r.length);return new Eo(o).decryptBlock(i,!1,new Uint8Array(16))}},lp=class{calculatePDF20Hash(t,e,i){let r=Ys(e,0,e.length).subarray(0,32),o=new Uint8Array([0]),s=0;for(;s<64||o[o.length-1]>s-32;){let a=t.length+r.length+i.length,c=new Uint8Array(a),l=0;c.set(t,l),l+=t.length,c.set(r,l),l+=r.length,c.set(i,l);let d=new Uint8Array(a*64);for(let f=0,p=0;f<64;f++,p+=a)d.set(c,p);o=new Kd(r.subarray(0,16)).encrypt(d,r.subarray(16,32));let u=o.slice(0,16).reduce((f,p)=>f+p,0)%3;u===0?r=Ys(o,0,o.length):u===1?r=qF(o,0,o.length):u===2&&(r=_b(o,0,o.length)),s++}return r.subarray(0,32)}hash(t,e,i){return this.calculatePDF20Hash(t,e,i)}checkOwnerPassword(t,e,i,r){let o=new Uint8Array(t.length+56);o.set(t,0),o.set(e,t.length),o.set(i,t.length+e.length);let s=this.calculatePDF20Hash(t,o,i);return Zo(s,r)}checkUserPassword(t,e,i){let r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);let o=this.calculatePDF20Hash(t,r,new Uint8Array);return Zo(o,i)}getOwnerKey(t,e,i,r){let o=new Uint8Array(t.length+56);o.set(t,0),o.set(e,t.length),o.set(i,t.length+e.length);let s=this.calculatePDF20Hash(t,o,i);return new Eo(s).decryptBlock(r,!1,new Uint8Array(16))}getUserKey(t,e,i){let r=new Uint8Array(t.length+8);r.set(t,0),r.set(e,t.length);let o=this.calculatePDF20Hash(t,r,new Uint8Array);return new Eo(o).decryptBlock(i,!1,new Uint8Array(16))}},Gd=class{constructor(t,e){this.StringCipherConstructor=t,this.StreamCipherConstructor=e}createStream(t,e){let i=this.StreamCipherConstructor();return new Qb(t,function(o,s){return i.decryptBlock(o,s)},e)}decryptString(t){let e=this.StringCipherConstructor(),i=Go(t);return i=e.decryptBlock(i,!0),rn(i)}decryptBytes(t){return this.StringCipherConstructor().decryptBlock(t,!0)}encryptString(t){let e=this.StringCipherConstructor();if(e instanceof Co){let o=16-t.length%16;t+=String.fromCharCode(o).repeat(o);let s=new Uint8Array(16);if(typeof crypto!="undefined")crypto.getRandomValues(s);else for(let l=0;l<16;l++)s[l]=Math.floor(256*Math.random());let a=Go(t);a=e.encrypt(a,s);let c=new Uint8Array(16+a.length);return c.set(s),c.set(a,16),rn(c)}let i=Go(t);return i=e.encrypt(i),rn(i)}},Xd=class{constructor(t,e,i){var r,o;this.defaultPasswordBytes=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]),this.identityName=x.of("Identity");let s=t.get(x.of("Filter"));if(s.asString()!=="/Standard")throw new Error("unknown encryption method");this.filterName=s.asString(),this.dict=t;let a=t.get(x.of("V")).asNumber();if(!Number.isInteger(a)||a!==1&&a!==2&&a!==4&&a!==5)throw new Error("unsupported encryption algorithm");this.algorithm=a;let c=(r=t.get(x.of("Length")))===null||r===void 0?void 0:r.asNumber();if(!c)if(a<=3)c=40;else{let w=t.get(x.of("CF")),F=t.get(x.of("StmF"));if(w instanceof R&&F instanceof x){w.suppressEncryption=!0;let v=w.get(x.of(F.asString())),P=null;v&&(P=v.get(x.of("Length"))),c=P&&P.asNumber()||128,c<40&&(c<<=3)}}if(c===void 0||!Number.isInteger(c)||c<40||c%8!==0)throw new Error(`invalid key length: ${c}`);let l=t.get(x.of("O")).asBytes(),d=t.get(x.of("U")).asBytes(),h=l.subarray(0,32),u=d.subarray(0,32),f=t.get(x.of("P")).asNumber(),p=t.get(x.of("R")).asNumber(),g=(a===4||a===5)&&((o=t.get(x.of("EncryptMetadata")))===null||o===void 0?void 0:o.asBoolean())!==!1;this.encryptMetadata=g;let m;if(i){if(p===6)try{i=unescape(encodeURIComponent(i))}catch(w){console.warn("CipherTransformFactory: Unable to convert UTF8 encoded password.")}m=Go(i)}let b;if(a!==5)b=this.prepareKeyData(e,m,h,u,f,p,c,g);else{let w=l.subarray(32,40),F=l.subarray(40,48),v=d.subarray(0,48),P=d.subarray(32,40),k=d.subarray(40,48),T=t.get(x.of("OE")).asBytes(),D=t.get(x.of("UE")).asBytes(),C=t.get(x.of("Perms")).asBytes();b=this.createEncryptionKey20(p,m,h,w,F,v,u,P,k,T,D,C)}if(!b&&!i)throw new Error("NEEDS PASSWORD");if(!b&&i){let w=this.decodeUserPassword(m,h,p,c);b=this.prepareKeyData(e,w,h,u,f,p,c,g)}if(!b)throw new Error("Password incorrect");if(this.encryptionKey=b,a>=4){let w=t.get(x.of("CF"));w instanceof R&&(w.suppressEncryption=!0),this.cf=w,this.stmf=t.get(x.of("StmF"))||this.identityName,this.strf=t.get(x.of("StrF"))||this.identityName,this.eff=t.get(x.of("EFF"))||this.stmf}}createCipherTransform(t,e){if(this.algorithm===4||this.algorithm===5)return new Gd(this.buildCipherConstructor(this.cf,this.strf,t,e,this.encryptionKey),this.buildCipherConstructor(this.cf,this.stmf,t,e,this.encryptionKey));let i=this.buildObjectKey(t,e,this.encryptionKey,!1),r=function(){return new En(i)};return new Gd(r,r)}createEncryptionKey20(t,e,i,r,o,s,a,c,l,d,h,u){if(e){let p=Math.min(127,e.length);e=e.subarray(0,p)}else e=new Uint8Array;let f;return t===6?f=new lp:f=new ap,f.checkUserPassword(e,c,a)?f.getUserKey(e,l,h):e.length&&f.checkOwnerPassword(e,r,s,i)?f.getOwnerKey(e,o,s,d):null}prepareKeyData(t,e,i,r,o,s,a,c){let l=40+i.length+t.length,d=new Uint8Array(l),h=0,u,f;if(e)for(f=Math.min(32,e.length);h>8&255,d[h++]=o>>16&255,d[h++]=o>>>24&255,u=0,f=t.length;u=4&&!c&&(d[h++]=255,d[h++]=255,d[h++]=255,d[h++]=255);let p=Zs(d,0,h),g=a>>3;if(s>=3)for(u=0;u<50;++u)p=Zs(p,0,g);let m=p.subarray(0,g),b,w;if(s>=3){for(h=0;h<32;++h)d[h]=this.defaultPasswordBytes[h];for(u=0,f=t.length;u>3;if(i>=3)for(c=0;c<50;++c)l=Zs(l,0,l.length);let h,u;if(i>=3){u=e;let f=new Uint8Array(d);for(c=19;c>=0;c--){for(let p=0;p>8&255,o[a++]=t>>16&255,o[a++]=e&255,o[a++]=e>>8&255,r&&(o[a++]=115,o[a++]=65,o[a++]=108,o[a++]=84),Zs(o,0,a).subarray(0,Math.min(i.length+5,16))}buildCipherConstructor(t,e,i,r,o){if(!(e instanceof x))throw new Error("Invalid crypt filter name.");let s=t.get(x.of(e.asString().replace("/",""))),a;if(s!=null&&(a=s.get(x.of("CFM"))),!a||a.asString()==="/None")return function(){return new sp};if(a.asString()==="/V2")return()=>new En(this.buildObjectKey(i,r,o,!1));if(a.asString()==="/AESV2")return()=>new Kd(this.buildObjectKey(i,r,o,!0));if(a.asString()==="/AESV3")return()=>new Eo(o);throw new Error("Unknown crypto method")}};var pe=class{static async load(t,e={}){let{ignoreEncryption:i=!1,parseSpeed:r=gc.Slow,throwOnInvalidObject:o=!1,warnOnInvalidObjects:s=!1,updateMetadata:a=!0,capNumbers:c=!1,password:l}=e;S(t,"pdf",["string",Uint8Array,ArrayBuffer]),S(i,"ignoreEncryption",["boolean"]),S(r,"parseSpeed",["number"]),S(o,"throwOnInvalidObject",["boolean"]),S(s,"warnOnInvalidObjects",["boolean"]),S(l,"password",["string","undefined"]);let d=Lr(t),h=await jl.forBytesWithOptions(d,r,o,c).parseDocument();if(h.lookup(h.trailerInfo.Encrypt)&&l!==void 0){let u=h.lookup(h.trailerInfo.ID,H),f=h.lookup(h.trailerInfo.Encrypt,R),p=await jl.forBytesWithOptions(d,r,o,s,c,new Xd(f,u.get(0).asBytes(),l)).parseDocument();return new pe(p,!0,a)}else return new pe(h,i,a)}static async create(t={}){let{updateMetadata:e=!0}=t,i=Yr.create(),r=Es.withContext(i),o=i.register(r),s=Cs.withContextAndPages(i,o);return i.trailerInfo.Root=i.register(s),new pe(i,!1,e)}constructor(t,e,i){if(this.defaultWordBreaks=[" "],this.computePages=()=>{let r=[];return this.catalog.Pages().traverse((o,s)=>{if(o instanceof it){let a=this.pageMap.get(o);a||(a=ke.of(o,s,this),this.pageMap.set(o,a)),r.push(a)}}),r},this.getOrCreateForm=()=>{let r=this.catalog.getOrCreateAcroForm();return Tn.of(r,this)},S(t,"context",[[Yr,"PDFContext"]]),S(e,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),t.lookup(t.trailerInfo.Encrypt)&&t.isDecrypted&&delete t.trailerInfo.Encrypt,this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=lt.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=lt.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!e&&this.isEncrypted)throw new ko;i&&this.updateInfoDict()}registerFontkit(t){this.fontkit=t}getForm(){let t=this.formCache.access();return t.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),t.deleteXFA()),t}getTitle(){let t=this.getInfoDict().lookup(x.Title);if(t)return pr(t),t.decodeText()}getAuthor(){let t=this.getInfoDict().lookup(x.Author);if(t)return pr(t),t.decodeText()}getSubject(){let t=this.getInfoDict().lookup(x.Subject);if(t)return pr(t),t.decodeText()}getKeywords(){let t=this.getInfoDict().lookup(x.Keywords);if(t)return pr(t),t.decodeText()}getCreator(){let t=this.getInfoDict().lookup(x.Creator);if(t)return pr(t),t.decodeText()}getProducer(){let t=this.getInfoDict().lookup(x.Producer);if(t)return pr(t),t.decodeText()}getCreationDate(){let t=this.getInfoDict().lookup(x.CreationDate);if(t)return pr(t),t.decodeDate()}getModificationDate(){let t=this.getInfoDict().lookup(x.ModDate);if(t)return pr(t),t.decodeDate()}setTitle(t,e){S(t,"title",["string"]);let i=x.of("Title");this.getInfoDict().set(i,M.fromText(t)),e!=null&&e.showInWindowTitleBar&&this.catalog.getOrCreateViewerPreferences().setDisplayDocTitle(!0)}setAuthor(t){S(t,"author",["string"]);let e=x.of("Author");this.getInfoDict().set(e,M.fromText(t))}setSubject(t){S(t,"author",["string"]);let e=x.of("Subject");this.getInfoDict().set(e,M.fromText(t))}setKeywords(t){S(t,"keywords",[Array]);let e=x.of("Keywords");this.getInfoDict().set(e,M.fromText(t.join(" ")))}setCreator(t){S(t,"creator",["string"]);let e=x.of("Creator");this.getInfoDict().set(e,M.fromText(t))}setProducer(t){S(t,"creator",["string"]);let e=x.of("Producer");this.getInfoDict().set(e,M.fromText(t))}setLanguage(t){S(t,"language",["string"]);let e=x.of("Lang");this.catalog.set(e,G.of(t))}setCreationDate(t){S(t,"creationDate",[[Date,"Date"]]);let e=x.of("CreationDate");this.getInfoDict().set(e,G.fromDate(t))}setModificationDate(t){S(t,"modificationDate",[[Date,"Date"]]);let e=x.of("ModDate");this.getInfoDict().set(e,G.fromDate(t))}getPageCount(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount}getPages(){return this.pageCache.access()}getPage(t){let e=this.getPages();return at(t,"index",0,e.length-1),e[t]}getPageIndices(){return fu(0,this.getPageCount())}removePage(t){let e=this.getPageCount();if(this.pageCount===0)throw new lc;at(t,"index",0,e-1),this.catalog.removeLeafNode(t),this.pageCount=e-1}addPage(t){return S(t,"page",["undefined",[ke,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)}insertPage(t,e){let i=this.getPageCount();if(at(t,"index",0,i),S(e,"page",["undefined",[ke,"PDFPage"],Array]),!e||Array.isArray(e)){let o=Array.isArray(e)?e:So.A4;e=ke.create(this),e.setSize(...o)}else if(e.doc!==this)throw new ac;let r=this.catalog.insertLeafNode(e.ref,t);return e.node.setParent(r),this.pageMap.set(e.node,e),this.pageCache.invalidate(),this.pageCount=i+1,e}async copyPages(t,e){S(t,"srcDoc",[[pe,"PDFDocument"]]),S(e,"indices",[Array]),await t.flush();let i=bl.for(t.context,this.context),r=t.getPages(),o=e.map(s=>r[s]).map(async s=>i.copy(s.node)).map(s=>s.then(a=>ke.of(a,this.context.register(a),this)));return Promise.all(o)}async copy(){let t=await pe.create(),e=await t.copyPages(this,this.getPageIndices());for(let i=0,r=e.length;ia:bl.for(r,this.context).copy,s=new Array(t.length);for(let a=0,c=t.length;a[n*s+e*a,t*s+i*a,n*c+e*l,t*c+i*l,n*d+e*h+r,t*d+i*h+o],Qd=([n,t,e,i,r,o],{x:s,y:a})=>({x:n*s+e*a+r,y:t*s+i*a+o}),_d=(n,t)=>{switch(n){case"scale":case"scaleX":case"scaleY":{let[e,i=e]=t;return[n==="scaleY"?1:e,0,0,n==="scaleX"?1:i,0,0]}case"translate":case"translateX":case"translateY":{let[e,i=e]=t;return[1,0,0,1,n==="translateY"?0:e,n==="translateX"?0:-i]}case"rotate":{let[e,i=0,r=0]=t,o=_d("translate",[i,r]),s=_d("translate",[-i,-r]),a=Yt(-e),c=[Math.cos(a),Math.sin(a),-Math.sin(a),Math.cos(a),0,0];return xc(xc(o,c),s)}case"skewY":case"skewX":{let e=Yt(-t[0]),i=Math.tan(e);return[1,n==="skewY"?i:0,n==="skewX"?i:0,1,0,0]}case"matrix":{let[e,i,r,o,s,a]=t,c=_d("scale",[1,-1]);return xc(xc(c,[e,i,r,o,s,a]),c)}default:return hx}},gr=(n,t,e)=>xc(n,_d(t,e)),sP={butt:Qt.Butt,round:Qt.Round,square:Qt.Projecting},aP={evenodd:Wi.EvenOdd,nonzero:Wi.NonZero},lP={bevel:yo.Bevel,miter:yo.Miter,round:yo.Round},ux=(n,t)=>({async text(e){let i=e.svgAttributes.textAnchor,r=e.svgAttributes.dominantBaseline,o=e.text.trim().replace(/\s/g," "),s=e.svgAttributes.fontSize||12,a=(f,p)=>{let g=f.fontFamily;if(!g)return;let m=f.fontWeight==="bold"||Number(f.fontWeight)>=700,b=f.fontStyle==="italic",w=(F,v,P)=>p[P+(F?"_bold":"")+(v?"_italic":"")];return w(m,b,g)||w(m,!1,g)||w(!1,b,g)||w(!1,!1,g)||Object.keys(p).find(F=>F.startsWith(g))},c=t.fonts&&a(e.svgAttributes,t.fonts),l=(c||n.getFont()[0]).widthOfTextAtSize(o,s),d=(c||n.getFont()[0]).heightAtSize(s),h=i==="middle"?l/2:i==="end"?l:0,u=r==="text-before-edge"?d:r==="text-after-edge"?-d:r==="middle"?d/2:0;n.drawText(o,{x:-h,y:-u,font:c,size:s,color:e.svgAttributes.fill,opacity:e.svgAttributes.fillOpacity,matrix:e.svgAttributes.matrix,clipSpaces:e.svgAttributes.clipSpaces})},async line(e){n.drawLine({start:{x:e.svgAttributes.x1||0,y:-e.svgAttributes.y1||0},end:{x:e.svgAttributes.x2||0,y:-e.svgAttributes.y2||0},thickness:e.svgAttributes.strokeWidth,color:e.svgAttributes.stroke,opacity:e.svgAttributes.strokeOpacity,lineCap:e.svgAttributes.strokeLineCap,matrix:e.svgAttributes.matrix,clipSpaces:e.svgAttributes.clipSpaces})},async path(e){e.svgAttributes.d&&n.drawSvgPath(e.svgAttributes.d,{x:0,y:0,borderColor:e.svgAttributes.stroke,borderWidth:e.svgAttributes.strokeWidth,borderOpacity:e.svgAttributes.strokeOpacity,borderLineCap:e.svgAttributes.strokeLineCap,color:e.svgAttributes.fill,opacity:e.svgAttributes.fillOpacity,fillRule:e.svgAttributes.fillRule,matrix:gr(e.svgAttributes.matrix,"scale",[1,-1]),clipSpaces:e.svgAttributes.clipSpaces})},async image(e){let{src:i}=e.svgAttributes;if(!i)return;let o=i.match(/\.png(\?|$)|^data:image\/png;base64/gim)?await n.doc.embedPng(i):await n.doc.embedJpg(i),{x:s,y:a,width:c,height:l}=cP(o.width,o.height,e.svgAttributes.width||o.width,e.svgAttributes.height||o.height,e.svgAttributes.preserveAspectRatio);n.drawImage(o,{x:s,y:-a-l,width:c,height:l,opacity:e.svgAttributes.fillOpacity,matrix:e.svgAttributes.matrix,clipSpaces:e.svgAttributes.clipSpaces})},async rect(e){!e.svgAttributes.fill&&!e.svgAttributes.stroke||n.drawRectangle({x:0,y:0,width:e.svgAttributes.width,height:e.svgAttributes.height*-1,borderColor:e.svgAttributes.stroke,borderWidth:e.svgAttributes.strokeWidth,borderOpacity:e.svgAttributes.strokeOpacity,borderLineCap:e.svgAttributes.strokeLineCap,color:e.svgAttributes.fill,opacity:e.svgAttributes.fillOpacity,matrix:e.svgAttributes.matrix,clipSpaces:e.svgAttributes.clipSpaces})},async ellipse(e){n.drawEllipse({x:e.svgAttributes.cx||0,y:-(e.svgAttributes.cy||0),xScale:e.svgAttributes.rx,yScale:e.svgAttributes.ry,borderColor:e.svgAttributes.stroke,borderWidth:e.svgAttributes.strokeWidth,borderOpacity:e.svgAttributes.strokeOpacity,borderLineCap:e.svgAttributes.strokeLineCap,color:e.svgAttributes.fill,opacity:e.svgAttributes.fillOpacity,matrix:e.svgAttributes.matrix,clipSpaces:e.svgAttributes.clipSpaces})},async circle(e){return ux(n,t).ellipse(e)}}),ut=(n,t,e,i)=>{let r=t[e]||n[e];return!r&&typeof i!="undefined"?i:r},fx=n=>{let t=/([^:\s]+)*\s*:\s*([^;]+)/g,e={},i=t.exec(n);for(;i!=null;)e[i[1]]=i[2],i=t.exec(n);return e},gp=(n,t)=>{if(!n||n.length===0||["none","transparent"].includes(n))return;if(n==="currentColor")return t||gp("#000000");let e=zf(n);return{rgb:e.rgb,alpha:e.alpha?e.alpha+"":void 0}},mp=(n,t,e)=>{var i,r,o,s;let a=n.attributes,c=fx(a.style),l=ut(a,c,"width",""),d=ut(a,c,"height",""),h=gp(ut(a,c,"fill")),u=ut(a,c,"fill-opacity"),f=ut(a,c,"opacity"),p=gp(ut(a,c,"stroke")),g=ut(a,c,"stroke-opacity"),m=ut(a,c,"stroke-linecap"),b=ut(a,c,"stroke-linejoin"),w=ut(a,c,"fill-rule"),F=ut(a,c,"stroke-width"),v=ut(a,c,"font-family"),P=ut(a,c,"font-style"),k=ut(a,c,"font-weight"),T=ut(a,c,"font-size"),D=ht(l,t.width),C=ht(d,t.height),O=ht(a.x,t.width),E=ht(a.y,t.height),V=ht(a.x1,t.width),W=ht(a.x2,t.width),B=ht(a.y1,t.height),U=ht(a.y2,t.height),te=ht(a.cx,t.width),z=ht(a.cy,t.height),oe=ht(a.rx||a.r,t.width),Ee=ht(a.ry||a.r,t.height),Ue={fontFamily:v||t.fontFamily,fontStyle:P||t.fontStyle,fontWeight:k||t.fontWeight,fontSize:(i=ht(T))!==null&&i!==void 0?i:t.fontSize,fill:(h==null?void 0:h.rgb)||t.fill,fillOpacity:(r=ht(u||f||(h==null?void 0:h.alpha)))!==null&&r!==void 0?r:t.fillOpacity,fillRule:aP[w]||t.fillRule,stroke:(p==null?void 0:p.rgb)||t.stroke,strokeWidth:(o=ht(F))!==null&&o!==void 0?o:t.strokeWidth,strokeOpacity:(s=ht(g||f||(p==null?void 0:p.alpha)))!==null&&s!==void 0?s:t.strokeOpacity,strokeLineCap:sP[m]||t.strokeLineCap,strokeLineJoin:lP[b]||t.strokeLineJoin,width:D||t.width,height:C||t.height,rotation:t.rotation,viewBox:n.tagName==="svg"&&n.attributes.viewBox?$d(n.attributes.viewBox):t.viewBox},me={src:a.src||a["xlink:href"],textAnchor:a["text-anchor"],dominantBaseline:a["dominant-baseline"],preserveAspectRatio:a.preserveAspectRatio},Ae=a.transform||"";["translate","translateX","translateY","skewX","skewY","rotate","scale","scaleX","scaleY","matrix"].forEach(Fe=>{a[Fe]&&(Ae=a[Fe]+" "+Ae)}),(O||E)&&(Ae=Ae+`translate(${O||0} ${E||0}) `);let ve=e;if(Ae){let Fe=/(\w+)\((.+?)\)/g,nn=Fe.exec(Ae);for(;nn!==null;){let[,ba,qt]=nn,jo=(qt||"").split(/\s*,\s*|\s+/).filter(zn=>zn.length>0).map(zn=>parseFloat(zn));ve=gr(ve,ba,jo),nn=Fe.exec(Ae)}}if(me.x=O,me.y=E,(a.cx||a.cy)&&(me.cx=te,me.cy=z),(a.rx||a.ry||a.r)&&(me.rx=oe,me.ry=Ee),(a.x1||a.y1)&&(me.x1=V,me.y1=B),(a.x2||a.y2)&&(me.x2=W,me.y2=U),(a.width||a.height)&&(me.width=D!=null?D:t.width,me.height=C!=null?C:t.height),a.d&&(ve=gr(ve,"scale",[1,-1]),me.d=a.d),T&&Ue.fontSize&&(Ue.fontSize=Ue.fontSize),Ue.fontFamily){let Fe=Ue.fontFamily.match(/^"(.*?)"|^'(.*?)'/);Fe&&(Ue.fontFamily=Fe[1]||Fe[2])}return Ue.strokeWidth&&(me.strokeWidth=Ue.strokeWidth),{inherited:Ue,svgAttributes:me,tagName:n.tagName,matrix:ve}},cP=(n,t,e,i,r)=>{if(r==="none")return{x:0,y:0,width:e,height:i};let o=n/t,s=e/i,a=s>o?o*i:e,c=s>=o?i:e/o,l=e-a,d=i-c,[h,u]=(()=>{switch(r){case"xMinYMin":return[0,0];case"xMidYMin":return[l/2,0];case"xMaxYMin":return[l,d/2];case"xMinYMid":return[0,d];case"xMaxYMid":return[l,d/2];case"xMinYMax":return[0,d];case"xMidYMax":return[l/2,d];case"xMaxYMax":return[l,d];case"xMidYMid":default:return[l/2,d/2]}})();return{x:h,y:u,width:a,height:c}},dP=(n,t,e,i,r,o="xMidYMid")=>{let[s,a="meet"]=o.split(" "),c=i/t,l=r/e,d=gr(n,"scale",[c,l]);if(s==="none")return{clipBox:d,content:d};let h=a==="slice"?Math.max(c,l):Math.min(c,l),u=i-t*h,f=r-e*h,[p,g]=(()=>{switch(s){case"xMinYMin":return[0,0];case"xMidYMin":return[u/2,0];case"xMaxYMin":return[u,f/2];case"xMinYMid":return[0,f];case"xMaxYMid":return[u,f/2];case"xMinYMax":return[0,f];case"xMidYMax":return[u/2,f];case"xMaxYMax":return[u,f];case"xMidYMid":default:return[u/2,f/2]}})(),m=gr(gr(n,"translate",[p,g]),"scale",[h]);return{clipBox:d,content:m}},bp=(n,t,e,i)=>{if(n.nodeType===ea.NodeType.COMMENT_NODE)return[];if(n.nodeType===ea.NodeType.TEXT_NODE)return[];if(n.tagName==="g")return uP(n,t,e,i);if(n.tagName==="svg")return hP(n,t,e,i);{n.tagName==="polygon"&&(n.tagName="path",n.attributes.d=`M${n.attributes.points}Z`,delete n.attributes.points);let r=mp(n,t,e),o={...r.inherited,...r.svgAttributes,matrix:r.matrix,clipSpaces:i};return Object.assign(n,{svgAttributes:o}),[n]}},hP=(n,t,e,i)=>{var r,o;(r=n.attributes.width)!==null&&r!==void 0||n.setAttribute("width",t.viewBox.width+""),(o=n.attributes.height)!==null&&o!==void 0||n.setAttribute("height",t.viewBox.height+"");let s=mp(n,t,e),a=[],c=n.attributes.viewBox?$d(n.attributes.viewBox):n.attributes.width&&n.attributes.height?$d(`0 0 ${n.attributes.width} ${n.attributes.height}`):t.viewBox,l=parseFloat(n.attributes.x)||0,d=parseFloat(n.attributes.y)||0,h=gr(e,"translate",[l,d]),{clipBox:u,content:f}=dP(h,c.width,c.height,parseFloat(n.attributes.width),parseFloat(n.attributes.height),n.attributes.preserveAspectRatio),p=Qd(u,{x:0,y:0}),g=Qd(u,{x:c.width,y:0}),m=Qd(u,{x:c.width,y:-c.height}),b=Qd(u,{x:0,y:-c.height}),w={topLeft:p,topRight:g,bottomRight:m,bottomLeft:b};return h=gr(f,"translate",[-c.x,-c.y]),n.childNodes.forEach(F=>{let v=bp(F,{...s.inherited,viewBox:c},h,[...i,w]);a.push(...v)}),a},uP=(n,t,e,i)=>{let r=mp(n,t,e),o=[];return n.childNodes.forEach(s=>{o.push(...bp(s,r.inherited,r.matrix,i))}),o},ht=(n,t=1)=>{if(!n)return;let e=parseFloat(n);if(!isNaN(e))return n.endsWith("%")?e*t/100:e},$d=n=>{if(!n)return;let[t=0,e=0,i=1,r=1]=(n||"").split(" ").map(o=>ht(o));return{x:t,y:e,width:i,height:r}},fP=(n,{width:t,height:e,fontSize:i},r,o)=>{let s=(0,ea.parse)(n).firstChild;return t&&s.setAttribute("width",t+""),e&&s.setAttribute("height",e+""),i&&s.setAttribute("font-size",i+""),bp(s,{...r,viewBox:$d(s.attributes.viewBox||"0 0 1 1")},o,[])},px=async(n,t,e)=>{if(!t)return;let i=n.getSize(),r=(0,ea.parse)(t).firstChild,o=r.attributes,s=fx(o.style),a=ut(o,s,"width",""),c=ut(o,s,"height",""),l=e.width!==void 0?e.width:parseFloat(a),d=e.height!==void 0?e.height:parseFloat(c);o.viewBox||r.setAttribute("viewBox",`0 0 ${a||l} ${c||d}`),(e.width||e.height)&&(l!==void 0&&(s.width=l+(isNaN(l)?"":"px")),d!==void 0&&(s.height=d+(isNaN(d)?"":"px")),r.setAttribute("style",Object.entries(s).map(([p,g])=>`${p}:${g};`).join("")));let h=[1,0,0,1,e.x||0,e.y||0],u=ux(n,e);await fP(r.outerHTML,e,i,h).reduce(async(p,g)=>{var m;return await p,(m=u[g.tagName])===null||m===void 0?void 0:m.call(u,g)},Promise.resolve())};var ke=class{constructor(t,e,i){this.fontSize=24,this.fontColor=ne(0,0,0),this.lineHeight=24,this.x=0,this.y=0,S(t,"leafNode",[[it,"PDFPageLeaf"]]),S(e,"ref",[[q,"PDFRef"]]),S(i,"doc",[[pe,"PDFDocument"]]),this.node=t,this.ref=e,this.doc=i}setRotation(t){let e=Kl(t);Za(e,"degreesAngle",90),this.node.set(x.of("Rotate"),this.doc.context.obj(e))}getRotation(){let t=this.node.Rotate();return X(t?t.asNumber():0)}setSize(t,e){S(t,"width",["number"]),S(e,"height",["number"]);let i=this.getMediaBox();this.setMediaBox(i.x,i.y,t,e);let r=this.getCropBox(),o=this.getBleedBox(),s=this.getTrimBox(),a=this.getArtBox(),c=this.node.CropBox(),l=this.node.BleedBox(),d=this.node.TrimBox(),h=this.node.ArtBox();c&&as(r,i)&&this.setCropBox(i.x,i.y,t,e),l&&as(o,i)&&this.setBleedBox(i.x,i.y,t,e),d&&as(s,i)&&this.setTrimBox(i.x,i.y,t,e),h&&as(a,i)&&this.setArtBox(i.x,i.y,t,e)}setWidth(t){S(t,"width",["number"]),this.setSize(t,this.getSize().height)}setHeight(t){S(t,"height",["number"]),this.setSize(this.getSize().width,t)}setMediaBox(t,e,i,r){S(t,"x",["number"]),S(e,"y",["number"]),S(i,"width",["number"]),S(r,"height",["number"]);let o=this.doc.context.obj([t,e,t+i,e+r]);this.node.set(x.MediaBox,o)}setCropBox(t,e,i,r){S(t,"x",["number"]),S(e,"y",["number"]),S(i,"width",["number"]),S(r,"height",["number"]);let o=this.doc.context.obj([t,e,t+i,e+r]);this.node.set(x.CropBox,o)}setBleedBox(t,e,i,r){S(t,"x",["number"]),S(e,"y",["number"]),S(i,"width",["number"]),S(r,"height",["number"]);let o=this.doc.context.obj([t,e,t+i,e+r]);this.node.set(x.BleedBox,o)}setTrimBox(t,e,i,r){S(t,"x",["number"]),S(e,"y",["number"]),S(i,"width",["number"]),S(r,"height",["number"]);let o=this.doc.context.obj([t,e,t+i,e+r]);this.node.set(x.TrimBox,o)}setArtBox(t,e,i,r){S(t,"x",["number"]),S(e,"y",["number"]),S(i,"width",["number"]),S(r,"height",["number"]);let o=this.doc.context.obj([t,e,t+i,e+r]);this.node.set(x.ArtBox,o)}getSize(){let{width:t,height:e}=this.getMediaBox();return{width:t,height:e}}getWidth(){return this.getSize().width}getHeight(){return this.getSize().height}getMediaBox(){return this.node.MediaBox().asRectangle()}getCropBox(){var t;let e=this.node.CropBox();return(t=e==null?void 0:e.asRectangle())!==null&&t!==void 0?t:this.getMediaBox()}getBleedBox(){var t;let e=this.node.BleedBox();return(t=e==null?void 0:e.asRectangle())!==null&&t!==void 0?t:this.getCropBox()}getTrimBox(){var t;let e=this.node.TrimBox();return(t=e==null?void 0:e.asRectangle())!==null&&t!==void 0?t:this.getCropBox()}getArtBox(){var t;let e=this.node.ArtBox();return(t=e==null?void 0:e.asRectangle())!==null&&t!==void 0?t:this.getCropBox()}translateContent(t,e){S(t,"x",["number"]),S(e,"y",["number"]),this.node.normalize(),this.getContentStream();let i=this.createContentStream(Ne(),gt(t,e)),r=this.doc.context.register(i),o=this.createContentStream(Re()),s=this.doc.context.register(o);this.node.wrapContentStreams(r,s)}scale(t,e){S(t,"x",["number"]),S(e,"y",["number"]),this.setSize(this.getWidth()*t,this.getHeight()*e),this.scaleContent(t,e),this.scaleAnnotations(t,e)}scaleContent(t,e){S(t,"x",["number"]),S(e,"y",["number"]),this.node.normalize(),this.getContentStream();let i=this.createContentStream(Ne(),cr(t,e)),r=this.doc.context.register(i),o=this.createContentStream(Re()),s=this.doc.context.register(o);this.node.wrapContentStreams(r,s)}scaleAnnotations(t,e){S(t,"x",["number"]),S(e,"y",["number"]);let i=this.node.Annots();if(i)for(let r=0;rh.widthOfTextAtSize(v,f),m=e.maxWidth===void 0?va(Wn(t)):au(t,p,e.maxWidth,g),b=new Array(m.length);for(let v=0,P=m.length;vnew ke(n,t,e);ke.create=n=>{S(n,"doc",[[pe,"PDFDocument"]]);let t=q.of(-1),e=it.withContextAndParent(n.context,t),i=n.context.register(e);return new ke(e,i,n)};var di=class extends et{constructor(t,e,i){super(t,e,i),S(t,"acroButton",[[Fn,"PDFAcroPushButton"]]),this.acroField=t}setImage(t,e=oi.Center){let i=this.acroField.getWidgets();for(let r=0,o=i.length;rnew di(n,t,e);function Ze(n,t){let e=Object.keys(t).map(i=>pP(n,i,t[i]));return e.length===1?e[0]:function(){e.forEach(i=>i())}}function pP(n,t,e){let i=n[t],r=n.hasOwnProperty(t),o=r?i:function(){return Object.getPrototypeOf(n)[t].apply(this,arguments)},s=e(o);return i&&Object.setPrototypeOf(s,i),Object.setPrototypeOf(a,s),n[t]=a,c;function a(...l){return s===o&&n[t]===a&&c(),s.apply(this,l)}function c(){n[t]===a&&(r?n[t]=o:delete n[t]),s!==o&&(s=o,Object.setPrototypeOf(a,i||Function))}}var he=require("obsidian");var eh=require("obsidian"),Ye=class extends eh.Modal{constructor(e){super(e.app);this.plugin=e,this.lib=e.lib,this.component=new eh.Component,this.contentEl.addClass("pdf-plus-modal")}onOpen(){this.component.load()}onClose(){this.contentEl.empty(),this.component.unload()}};var Yi=require("obsidian");var Kp={};eu(Kp,{BidirectionalMultiValuedMap:()=>Fc,CommandSuggest:()=>vc,FuzzyFileSuggest:()=>wc,FuzzyFolderSuggest:()=>xr,FuzzyInputSuggest:()=>br,FuzzyMarkdownFileSuggest:()=>yc,MODIFIERS:()=>Lp,MultiValuedMap:()=>Ht,MutationObservingChild:()=>Dc,areOverlapping:()=>qp,areOverlappingStrictly:()=>Wp,binarySearch:()=>Xi,binarySearchForRangeStartingWith:()=>zp,camelCaseToKebabCase:()=>Cp,capitalize:()=>wP,cropCanvas:()=>Fp,dispatchMouseEvent:()=>Sp,doubleClick:()=>rh,encodeLinktext:()=>yr,evalInContext:()=>jp,findReferenceCache:()=>Vp,focusObsidian:()=>Ic,formatAnnotationID:()=>Ec,genId:()=>Ep,getBorderRadius:()=>vp,getCJKRegexp:()=>xx,getCharacterBoundingBoxes:()=>mx,getCharactersWithBoundingBoxesInPDFCoords:()=>Ip,getDirectPDFObj:()=>tt,getEventCoords:()=>ih,getFirstTextNodeIn:()=>FP,getInstallerVersion:()=>Rp,getModifierDictInPlatform:()=>Op,getModifierNameInPlatform:()=>fi,getNodeAndOffsetOfTextPos:()=>ta,getObsidianDefaultHighlightColorRGB:()=>gP,getOffsetInTextLayerNode:()=>sh,getPathSeparator:()=>PP,getSubpathWithoutHash:()=>Hp,getTextLayerNode:()=>oh,getWordAt:()=>vP,hexToRgb:()=>mr,hookInternalLinkMouseEventHandlers:()=>Pc,hover:()=>bP,isAncestorOf:()=>Up,isCanvas:()=>na,isCitationId:()=>lh,isEmbed:()=>Ac,isHexString:()=>Ki,isHoverEditor:()=>bx,isHoverPopover:()=>ra,isModifierName:()=>Mp,isMouseEventExternal:()=>ui,isNonEmbedLike:()=>On,isSelectionForward:()=>Zi,isTargetElement:()=>gx,isTargetHTMLElement:()=>wt,isTargetNode:()=>nh,isTypable:()=>Pp,isVersionNewerThan:()=>Tc,isVersionOlderThan:()=>Np,kebabCaseToCamelCase:()=>yP,matchModifiers:()=>Tp,onModKeyPress:()=>Dp,paramsToSubpath:()=>Cc,parsePDFSubpath:()=>Ln,range:()=>Ap,registerCharacterKeymap:()=>kP,removeExtension:()=>Bp,repeat:()=>No,repeatable:()=>ch,rgbStringToObject:()=>wp,rgbToHex:()=>yp,rotateCanvas:()=>th,showChildElOnParentElHover:()=>kc,showMenuUnderParentEl:()=>In,stringCompare:()=>Mo,subpathToParams:()=>ia,swapSelectionAnchorAndFocus:()=>Sc,toPDFCoords:()=>ah,toSingleLine:()=>Lc});var At=require("obsidian");function Ki(n){return n.length===7&&n.startsWith("#")}function mr(n){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function yp(n){let{r:t,g:e,b:i}=n;return"#"+(1<<24|t<<16|e<<8|i).toString(16).slice(1)}function wp(n){let[t,e,i]=n.split(",").map(r=>parseInt(r.trim()));return{r:t,g:e,b:i}}function gP(){let[n,t,e]=getComputedStyle(document.body).getPropertyValue("--text-highlight-bg-rgb").split(",").map(i=>parseInt(i.trim()));return{r:n,g:t,b:e}}function vp(){let n=getComputedStyle(document.body).getPropertyValue("--radius-s");if(n.endsWith("px")){let t=parseInt(n.slice(0,-2));if(!isNaN(t))return t}return 0}var Bt=require("obsidian"),mP={blurOnSelect:!0,closeOnSelect:!0},br=class extends Bt.AbstractInputSuggest{constructor(e,i,r){super(e,i);this.inputEl=i,this.options=Object.assign(mP,r)}getSuggestions(e){let i=(0,Bt.prepareFuzzySearch)(e.trim()),r=this.getItems(),o=[];for(let s of r){let a=i(this.getItemText(s));a&&o.push({match:a,item:s})}return(0,Bt.sortSearchResults)(o),o}renderSuggestion(e,i){(0,Bt.renderResults)(i,this.getItemText(e.item),e.match)}selectSuggestion(e,i){super.selectSuggestion(e,i),this.inputEl.value=this.getItemText(e.item),this.options.blurOnSelect&&this.inputEl.blur(),this.options.closeOnSelect&&this.close()}},yc=class extends br{getItems(){return this.app.vault.getMarkdownFiles()}getItemText(t){return t.path}},wc=class extends br{getItems(){return this.app.vault.getFiles()}getItemText(t){return t.path}},xr=class extends br{getItems(){return this.app.vault.getAllLoadedFiles().filter(t=>t instanceof Bt.TFolder)}getItemText(t){return t.path}},vc=class extends Bt.AbstractInputSuggest{constructor(e,i){super(e.plugin.app,i);this.inputEl=i,this.plugin=e.plugin,this.tab=e}getSuggestions(e){let i=(0,Bt.prepareFuzzySearch)(e),r=Object.values(this.plugin.app.commands.commands),o=[];for(let s of r){let a=i(s.name);a&&o.push({match:a,command:s})}return(0,Bt.sortSearchResults)(o),o.map(({command:s})=>s)}renderSuggestion(e,i){i.setText(e.name)}selectSuggestion(e){this.inputEl.blur(),this.plugin.settings.commandToExecuteWhenTargetNotIdentified=e.id,this.inputEl.value=e.name,this.close(),this.plugin.saveSettings(),this.tab.redisplay()}};var Ht=class{constructor(){this.map=new Map}addValue(t,e){let i=this.map.get(t);i||(i=new Set,this.map.set(t,i)),i.add(e)}get(t){var e;return(e=this.map.get(t))!=null?e:new Set}delete(t){this.map.delete(t)}deleteValue(t,e){let i=this.map.get(t);i&&(i.delete(e),i.size===0&&this.map.delete(t))}has(t){return this.map.has(t)&&this.map.get(t).size>0}[Symbol.iterator](){return this.map[Symbol.iterator]()}},Fc=class{constructor(){this.keyToValues=new Map;this.valueToKeys=new Map}addValue(t,e){this.keyToValues.has(t)||this.keyToValues.set(t,new Set),this.keyToValues.get(t).add(e),this.valueToKeys.has(e)||this.valueToKeys.set(e,new Set),this.valueToKeys.get(e).add(t)}get(t){var e;return(e=this.keyToValues.get(t))!=null?e:new Set}getKeys(t){var e;return(e=this.valueToKeys.get(t))!=null?e:new Set}delete(t){let e=this.keyToValues.get(t);if(e)for(let i of e){let r=this.valueToKeys.get(i);if(!r)throw new Error("Value has no keys");r.delete(t),r.size===0&&this.valueToKeys.delete(i)}this.keyToValues.delete(t)}deleteValue(t){let e=this.valueToKeys.get(t);if(e)for(let i of e){let r=this.keyToValues.get(i);if(!r)throw new Error("Key has no values");r.delete(t),r.size===0&&this.keyToValues.delete(i)}this.valueToKeys.delete(t)}has(t){return this.keyToValues.has(t)&&this.keyToValues.get(t).size>0}hasValue(t){return this.valueToKeys.has(t)&&this.valueToKeys.get(t).size>0}keys(){return this.keyToValues.keys()}values(){return this.valueToKeys.keys()}};function Fp(n,t,e={width:t.width,height:t.height}){let i=createEl("canvas");return i.width=e.width,i.height=e.height,i.getContext("2d").drawImage(n,t.left,t.top,t.width,t.height,0,0,e.width,e.height),i}function th(n,t){if(t=(t%360+360)%360,![0,90,180,270].includes(t))throw new Error("rotate must be 0, 90, 180, or 270");if(!t)return n;let e=createEl("canvas"),i=e.getContext("2d");return t===90||t===270?(e.width=n.height,e.height=n.width):(e.width=n.width,e.height=n.height),i.translate(e.width/2,e.height/2),i.rotate(t*Math.PI/180),i.drawImage(n,-n.width/2,-n.height/2),e}var Gi=require("obsidian");function Pc(n,t,e){t.querySelectorAll("a.internal-link").forEach(i=>{i.addEventListener("click",r=>{r.preventDefault();let o=i.getAttribute("href");o&&n.workspace.openLinkText(o,e,Gi.Keymap.isModEvent(r))}),i.addEventListener("mouseover",r=>{r.preventDefault();let o=i.getAttribute("href");o&&n.workspace.trigger("hover-link",{event:r,source:"preview",hoverParent:{hoverPopover:null},targetEl:r.currentTarget,linktext:o,sourcePath:e})})})}function ui(n,t){return!n.relatedTarget||gx(n,n.relatedTarget)&&!t.contains(n.relatedTarget)}function Pp(n){return n.nodeName==="INPUT"||n.instanceOf(HTMLElement)&&n.contentEditable==="true"}function ih(n){return n.instanceOf(MouseEvent)?{x:n.clientX,y:n.clientY}:{x:n.touches[0].clientX,y:n.touches[0].clientY}}function kp(n,t,e){let i=t[e];return n instanceof i}function nh(n,t){return!!t&&(t instanceof Node||kp(t,n.win,"Node"))}function gx(n,t){return!!t&&(t instanceof Element||kp(t,n.win,"Element"))}function wt(n,t){return!!t&&(t instanceof HTMLElement||kp(t,n.win,"HTMLElement"))}function Dp(n,t,e){if(Gi.Keymap.isModifier(n,"Mod")){e();return}let i=n.doc,r=!1,o=()=>{r=!0,i.removeEventListener("keydown",s),i.removeEventListener("mouseover",a),i.removeEventListener("mouseleave",c)},s=l=>{r||(i.body.contains(t)?Gi.Keymap.isModifier(l,"Mod")&&(o(),e()):o())},a=l=>{r||nh(l,l.target)&&!t.contains(l.target)&&o()},c=l=>{r||l.target===i&&o()};i.addEventListener("keydown",s),i.addEventListener("mouseover",a),i.addEventListener("mouseleave",c)}function kc(n){let{parentEl:t,createChildEl:e,removeChildEl:i,component:r,timeout:o}=n,s=a=>{if(ui(a,t)){let c=!0,l=!1,d=e(),h=new Gi.Component;r==null||r.addChild(h),h.register(()=>d&&i(d)),h.load();let u=()=>setTimeout(()=>{!c&&!l&&h.unload()},o!=null?o:120),f=p=>{ui(p,t)&&(c=!1,u())};h.registerDomEvent(t,"mouseout",f),d&&h.registerDomEvent(d,"mouseover",p=>{if(ui(p,d)){l=!0;let g=m=>{ui(m,d)&&(l=!1,u())};h.registerDomEvent(d,"mouseout",g)}})}};t.addEventListener("mouseover",s)}function Sp(n,t,e){n.dispatchEvent(new MouseEvent(t,{bubbles:!0,...e}))}function rh(n,t){Sp(n,"dblclick",t)}function bP(n,t,e){e!=null||(e={}),t&&(e[Gi.Platform.isMacOS?"metaKey":"ctrlKey"]=!0);let{x:i,y:r}=n.getBoundingClientRect();Sp(n,"mouseover",{doc:n.doc,clientX:i,clientY:r,...e})}var xP=["Mod","Ctrl","Meta","Shift","Alt"];function Tp(n,t){return xP.every(e=>t.includes(e)?Gi.Keymap.isModifier(n,e):!Gi.Keymap.isModifier(n,e))}function tt(n,t){let e=n.get(x.of(t));return e instanceof q?n.context.lookup(e):e}function In(n,t){let{x:e,bottom:i,width:r}=t.getBoundingClientRect();return n.setParentElement(t).showAtPosition({x:e,y:i,width:r,overlap:!0,left:!1}),n}function Cp(n){return n.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function yP(n){return n.replace(/(-\w)/g,t=>t[1].toUpperCase())}function wP(n){return n.charAt(0).toUpperCase()+n.slice(1)}function vP(n,t){if(t<0||t>=n.length)return"";let e=Math.max(0,n.slice(0,t+1).search(/(?<=[^\s.,][\s.,]+)[^\s.,]*$/));n=n.slice(e),e=Math.max(0,n.search(/[^\s.,]/)),n=n.slice(e);let i=n.search(/[\s.,]/);return i===-1?n:n.slice(0,i)}function Ep(){let n=()=>((1+Math.random())*65536|0).toString(16).substring(1);return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}function Ap(n,t){return Array.from({length:t-n},(e,i)=>n+i)}function oh(n,t){if(!n.contains(t))return null;if(t.instanceOf(HTMLElement)&&t.hasClass("textLayerNode"))return t;let e=t;for(;e=e.parentNode;){if(e===n)return null;if(e.instanceOf(HTMLElement)&&e.hasClass("textLayerNode"))return e}return null}function sh(n,t,e){if(!n.contains(t))return null;let i=n.doc.createNodeIterator(n,NodeFilter.SHOW_TEXT),r,o=e;for(;(r=i.nextNode())&&t!==r;)o+=r.textContent.length;return o}function ta(n,t){let e=n.doc.createNodeIterator(n,NodeFilter.SHOW_TEXT),i;for(;(i=e.nextNode())&&t>=i.textContent.length;)t-=i.textContent.length;return i?{node:i,offset:t}:null}function*mx(n){let t=n.doc.createNodeIterator(n,NodeFilter.SHOW_TEXT),e;for(;e=t.nextNode();)if(e.instanceOf(Text))for(let i=0;it<=s.position.start.offset&&s.position.end.offset<=e))!=null?o:(r=n.embeds)==null?void 0:r.find(s=>t<=s.position.start.offset&&s.position.end.offset<=e)}function Bp(n){let t=n.lastIndexOf(".");return t===-1||t===n.length-1||t===0?n:n.slice(0,t)}function Hp(n){let{subpath:t}=(0,At.parseLinktext)(n);return t.startsWith("#")&&(t=t.slice(1)),t}function ia(n){return n.startsWith("#")&&(n=n.slice(1)),new URLSearchParams(n)}function Ln(n){let t=ia(n);if(!t.has("page"))return null;let e=+t.get("page");if(isNaN(e))return null;if(t.has("selection")){let i=t.get("selection").split(",").map(c=>parseInt(c.trim()));if(i.length!==4||i.some(c=>isNaN(c)))return null;let[r,o,s,a]=i;return{page:e,beginIndex:r,beginOffset:o,endIndex:s,endOffset:a}}if(t.has("annotation")){let i=t.get("annotation");return{page:e,annotation:i}}return{page:e}}function Cc(n){return"#"+Object.entries(n).filter(([t,e])=>t&&(e||e===0)).map(([t,e])=>`${t}=${e}`).join("&")}function Ec(n,t){return t===0?`${n}R`:`${n}R${t}`}var Dc=class extends At.Component{constructor(e,i,r){super();this.targetEl=e;this.callback=i;this.options=r;this.observer=new MutationObserver(i)}onload(){this.observer.observe(this.targetEl,this.options)}onunload(){this.observer.disconnect()}};function On(n){return!n.isEmbed&&!bx(n)}function Ac(n){return n.isEmbed&&!na(n)&&!ra(n)}function na(n){var t;return!!((t=n.dom)!=null&&t.containerEl.hasClass("canvas-node-content"))}function ra(n){var t;return!!((t=n.dom)!=null&&t.containerEl.closest(".hover-popover"))}function bx(n){var t;return!!((t=n.dom)!=null&&t.containerEl.closest(".hover-editor"))}function Ic(){activeWindow.open("obsidian://")}function Up(n,t,e=!1){if(e&&n===t)return!0;let i=t.parent;for(;i;){if(i===n)return!0;i=i.parent}return!1}function xx(n){n={japanese:!0,korean:!0,...n};let t="";return t+="\\u4e00-\\u9fff",t+="\\u3400-\\u4dbf",n.japanese&&(t+="\\u3040-\\u309F",t+="\\u30A0-\\u30FF",t+="\\uFF65-\\uFF9F",t+="\\u31F0-\\u31FF",t+="\\u3000-\\u303F"),n.korean&&(t+="\\u1100-\\u11FF",t+="\\uA960-\\uA97F",t+="\\uD7B0-\\uD7FF",t+="\\u3130-\\u318F",t+="\\uAC00-\\uD7AF"),new RegExp(`[${t}]`)}function Lc(n,t=!1){let e=xx({korean:!1});return n=n.replace(/(.?)([\r\n]+)(.?)/g,(i,r,o,s)=>e.test(r)&&e.test(s)?r+s:r==="-"&&s.match(/[a-zA-Z]/)?s:s?r+" "+s:r),t&&(n=n.replace(new RegExp(`(${e.source}) (?=${e.source})`,"g"),"$1")),window.pdfjsViewer.removeNullCharacters(window.pdfjsLib.normalizeUnicode(n))}function yr(n){return n.replace(/[\\\x00\x08\x0B\x0C\x0E-\x1F ]/g,t=>encodeURIComponent(t))}function lh(n){return typeof n=="string"&&n.startsWith("cite.")}function kP(n,t,e){return n.register(null,t,(i,r)=>{if(r.key===t&&r.modifiers!==null&&["","Shift"].includes(r.modifiers))return e(i,r)})}function Xi(n,t,e){var a,c,l,d;if(e&&e.findFirst&&e.findLast)throw Error("findFirst and findLast cannot be specified at the same time");let i=(a=e==null?void 0:e.findFirst)!=null?a:!1,r=(c=e==null?void 0:e.findLast)!=null?c:!1,o=(l=e==null?void 0:e.from)!=null?l:0,s=(d=e==null?void 0:e.to)!=null?d:n.length-1;if(o>s)return{found:!1,index:o};for(;;){let h=o+s+ +r>>1,u=n[h],f=t(u,h);if(f===0)if(i&&oh)o=h;else return{found:!0,index:h};else f>0?o=h+1:s=h-1;if(o>s)return{found:!1,index:h+ +(f>0)}}}function Mo(n,t){return n===t?0:nMo(t,e(a).slice(0,t.length)),{found:o,index:s}=Xi(n,r,{findFirst:!0,...i});if(o){let{index:a}=Xi(n,r,{findLast:!0,...i,from:s});return{from:s,to:a}}return null}function qp(n,t){return n.from<=t.to&&n.to>=t.from}function Wp(n,t){return n.fromt.from}function Zi(n){return n.anchorNode===n.focusNode?n.anchorOffsetNo(n,t)}function jp(n,t){return new Function(n.includes("await")?"(async () => {"+n+"})()":n).call(t)}var dh=class extends Ye{constructor(e,i,r,o){super(e);this.file=i,this.page=r,this.id=o}},Ro=class extends dh{constructor(e,...i){super(...i);this.allowNoValue=e,this.supportedKeys=Object.keys(e),this.oldValues={},this.newValues={},this.containerEl.addClass("pdf-plus-annotation-edit-modal"),this.buttonContainerEl=this.modalEl.createDiv()}static isSubtypeSupported(e){return Ro.supportedSubtypes.includes(e)}static forSubtype(e,...i){return e==="Link"?Ro.forLinkAnnotation(...i):Ro.forTextMarkupAnnotation(...i)}static forTextMarkupAnnotation(...e){return new Ro({color:!1,opacity:!1,author:!1,contents:!0},...e)}static forLinkAnnotation(...e){return new Ro({color:!0,borderWidth:!0},...e)}async readOldValues(){let e=this.lib.highlight.writeFile.pdflib,i=await e.getAnnotation(this.file,this.page,this.id);if(!i)throw new Error(`${this.plugin.manifest.name}: Annotation not found.`);for(let r of this.supportedKeys)switch(r){case"color":this.oldValues.color=e.getColorFromAnnotation(i);break;case"opacity":this.oldValues.opacity=e.getOpacityFromAnnotation(i);break;case"borderWidth":this.oldValues.borderWidth=e.getBorderWidthFromAnnotation(i);break;case"author":this.oldValues.author=e.getAuthorFromAnnotation(i);break;case"contents":this.oldValues.contents=e.getContentsFromAnnotation(i);break}}async writeNewValues(){let e=this.lib.highlight.writeFile.pdflib,i=[];for(let r of this.supportedKeys)switch(r){case"color":if(this.newValues.color&&this.newValues.color!==this.oldValues.color){let o=this.newValues.color;i.push(s=>{e.setColorToAnnotation(s,o),this.lib.getLatestBacklinksForAnnotation(this.file,this.page,this.id).then(a=>{a.forEach(c=>this.lib.composer.linkUpdater.updateLinkColor(c.refCache,c.sourcePath,{type:"rgb",rgb:o},{linktext:!1}))})})}break;case"opacity":typeof this.newValues.opacity=="number"&&this.newValues.opacity!==this.oldValues.opacity&&i.push(o=>{e.setOpacityToAnnotation(o,this.newValues.opacity)});break;case"borderWidth":typeof this.newValues.borderWidth=="number"&&this.newValues.borderWidth!==this.oldValues.borderWidth&&i.push(o=>{e.setBorderWidthToAnnotation(o,this.newValues.borderWidth)});break;case"author":this.newValues.author&&this.newValues.author!==this.oldValues.author&&i.push(o=>{e.setAuthorToAnnotation(o,this.newValues.author)});break;case"contents":typeof this.newValues.contents=="string"&&this.newValues.contents!==this.oldValues.contents&&i.push(o=>{e.setContentsToAnnotation(o,this.newValues.contents)});break}i.length&&await e.processAnnotation(this.file,this.page,this.id,async r=>{i.forEach(o=>o(r))})}addColorSetting(){if(this.oldValues.color||this.allowNoValue.color){let e,i;new Yi.Setting(this.contentEl).setName("Color").setDesc("You can choose a color from the color picker or select one from your custom named colors.").addColorPicker(r=>{var o;e=r,e.setValueRgb((o=this.oldValues.color)!=null?o:{r:0,g:0,b:0}).onChange(s=>{let a=mr(s);a&&(this.newValues.color=a,i.setValue(s))})}).addDropdown(r=>{i=r,i.addOptions(Object.fromEntries(Object.entries(this.plugin.settings.colors).map(([o,s])=>[s,o]))).setValue(this.oldValues.color?yp(this.oldValues.color):"").onChange(o=>{let s=mr(o);s&&(this.newValues.color=s,e.setValue(o))})})}}addOpacitySetting(){(this.oldValues.opacity||this.allowNoValue.opacity)&&new Yi.Setting(this.contentEl).setName("Opacity").addSlider(e=>{var i;e.setLimits(0,1,.01).setValue((i=this.oldValues.opacity)!=null?i:1).setDynamicTooltip().onChange(r=>{this.newValues.opacity=r})})}addBorderWidthSetting(){(this.oldValues.borderWidth||this.allowNoValue.borderWidth)&&new Yi.Setting(this.contentEl).setName("Draw border").addToggle(e=>{var i;e.setValue(!!((i=this.oldValues.borderWidth)==null||i)).onChange(r=>{this.newValues.borderWidth=r?1:0})})}addAuthorSetting(){(this.oldValues.author||this.allowNoValue.author)&&new Yi.Setting(this.contentEl).setName("Annotation author").addText(e=>{var i;e.setValue((i=this.oldValues.author)!=null?i:"Author").onChange(r=>{this.newValues.author=r})})}initContentsSetting(){var e;if(this.textarea=null,this.editorEl=null,this.previewEl=null,this.plugin.settings.renderMarkdownInStickyNote){let i=(e=this.app.hotkeyManager.getHotkeys("markdown:toggle-preview"))!=null?e:this.app.hotkeyManager.getDefaultHotkeys("markdown:toggle-preview");if(i&&i.length){let r=i[0];this.scope.register(r.modifiers,r.key,()=>this.togglePreview())}}}addContentsSetting(){(this.oldValues.contents||this.allowNoValue.contents)&&new Yi.Setting(this.contentEl).setName("Contents").then(e=>{this.previewEl=e.controlEl.createDiv("preview-container markdown-rendered"),this.plugin.settings.renderMarkdownInStickyNote?e.setDesc(`Press ${this.app.hotkeyManager.printHotkeyForCommand("markdown:toggle-preview")} to toggle preview.`):e.setDesc('Tip: There is an option called "Render markdown in annotation popups when the annotation has text contents".')}).addTextArea(e=>{var i;this.textarea=e,this.editorEl=e.inputEl,this.editorEl.addClass("editor-container"),e.inputEl.rows=5,e.inputEl.setCssStyles({width:"100%"}),e.setValue((i=this.oldValues.contents)!=null?i:"").onChange(r=>{this.newValues.contents=r})}),this.showEditor()}addButtons(){new Yi.Setting(this.buttonContainerEl).addButton(e=>{e.setButtonText("Save").setCta().onClick(()=>{this.writeNewValues(),this.close()})}).addButton(e=>{e.setButtonText("Cancel").onClick(()=>this.close())}).then(e=>e.setClass("no-border"))}async onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: edit annotation contents`),await this.readOldValues();for(let e of this.supportedKeys)switch(e){case"color":this.addColorSetting();break;case"opacity":this.addOpacitySetting();break;case"borderWidth":this.addBorderWidthSetting();break;case"author":this.addAuthorSetting();break;case"contents":this.initContentsSetting(),this.addContentsSetting();break}this.addButtons()}async showEditor(){var e,i;(e=this.editorEl)==null||e.show(),(i=this.previewEl)==null||i.hide()}async showPreview(){var e,i;this.editorEl&&this.previewEl&&(this.previewEl.setCssStyles({width:`${this.editorEl.clientWidth}px`,height:`${this.editorEl.clientHeight}px`}),this.previewEl.empty(),await Yi.MarkdownRenderer.render(this.app,(i=(e=this.textarea)==null?void 0:e.getValue())!=null?i:"",this.previewEl,"",this.component),Pc(this.app,this.previewEl,this.file.path),this.editorEl.hide(),this.previewEl.show())}async togglePreview(){var e;return(e=this.editorEl)!=null&&e.isShown()?this.showPreview():this.showEditor()}},Mn=Ro;Mn.supportedSubtypes=["Highlight","Underline","Squiggly","StrikeOut","Link"];var oa=class extends dh{onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: delete annotation`),this.contentEl.createEl("p",{text:"Are you sure you want to delete this annotation?"}),this.plugin.settings.warnEveryAnnotationDelete||this.contentEl.createEl("p",{cls:"mod-warning",text:"There are one or more links pointing to this annotation."}),new Yi.Setting(this.contentEl).addButton(t=>{t.setButtonText("Delete").setWarning().onClick(()=>{this.deleteAnnotation(),this.close()})}).addButton(t=>{t.setButtonText("Cancel").onClick(()=>this.close())}).then(t=>t.setClass("no-border"))}openIfNeccessary(){return this.shouldOpen()?this.open():this.deleteAnnotation()}shouldOpen(){return this.plugin.settings.warnEveryAnnotationDelete||this.plugin.settings.warnBacklinkedAnnotationDelete&&this.lib.isBacklinked(this.file,{page:this.page,annotation:this.id})}deleteAnnotation(){this.lib.highlight.writeFile.deleteAnnotation(this.file,this.page,this.id)}};var sa=require("obsidian");var Oc,wr,hh=class extends Ye{constructor(e,i,...r){super(...r);xa(this,Oc,void 0);xa(this,wr,void 0);this.file=e,this.page=i,ya(this,Oc,new Promise(o=>{ya(this,wr,o)}))}then(e){return gi(this,Oc).then(i=>{i&&e()}),this}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: delete page`),this.contentEl.createEl("p",{text:"Are you sure you want to delete this page?"}),this.plugin.settings.warnEveryAnnotationDelete||this.contentEl.createEl("p",{cls:"mod-warning",text:"There are one or more links pointing to this page."}),new sa.Setting(this.contentEl).addButton(e=>{e.setButtonText("Delete").setWarning().onClick(()=>{gi(this,wr).call(this,!0),this.close()})}).addButton(e=>{e.setButtonText("Cancel").onClick(()=>{gi(this,wr).call(this,!1),this.close()})}).then(e=>e.setClass("no-border"))}onClose(){super.onClose(),gi(this,wr).call(this,!1)}openIfNeccessary(){return this.shouldOpen()?(this.open(),this):(gi(this,wr).call(this,!0),this)}shouldOpen(){return this.plugin.settings.warnEveryPageDelete||this.plugin.settings.warnBacklinkedPageDelete&&this.lib.isBacklinked(this.file,{page:this.page})}};Oc=new WeakMap,wr=new WeakMap;var Nc={keep:"Keep labels unchanged",update:"Update"},Mc,vr,Nn=class extends Ye{constructor(e,i,r,o,s){super(e);xa(this,Mc,void 0);xa(this,vr,void 0);this.askPageLabelUpdateMethod=i,this.defaultMethod=r,this.askInPlace=o,this.defaultInPlace=s,ya(this,Mc,new Promise(a=>{ya(this,vr,a)}))}ask(){return this.askPageLabelUpdateMethod||this.askInPlace?this.open():gi(this,vr).call(this,{pageLabelUpdateMethod:this.defaultMethod,inPlace:this.defaultInPlace}),this}then(e){gi(this,Mc).then(i=>{if(i){let{pageLabelUpdateMethod:r,inPlace:o}=i;e(r==="keep",o)}})}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: Page composer`);let e=this.defaultMethod,i=this.defaultInPlace;this.askPageLabelUpdateMethod&&new sa.Setting(this.contentEl).setName("Update the page labels?").setDesc(createFragment(r=>{r.createEl("a",{text:"Learn more",href:"https://github.com/RyotaUshio/obsidian-pdf-plus/wiki/Page-labels"})})).addDropdown(r=>{r.addOptions(Nc).setValue(e).onChange(o=>{e=o})}),this.askInPlace&&new sa.Setting(this.contentEl).setName("Remove pages from original file?").addToggle(r=>{r.setValue(i).onChange(o=>{i=o})}),new sa.Setting(this.contentEl).addButton(r=>{r.setButtonText("Proceed").setCta().onClick(()=>{(e==="keep"||e==="update")&&gi(this,vr).call(this,{pageLabelUpdateMethod:e,inPlace:i}),this.close()}),setTimeout(()=>r.buttonEl.focus())}).addButton(r=>{r.setButtonText("Cancel").onClick(()=>{gi(this,vr).call(this,null),this.close()})})}onClose(){super.onClose(),gi(this,vr).call(this,null)}};Mc=new WeakMap,vr=new WeakMap;var uh=class extends Ye{constructor(){super(...arguments);this.pageSize="A4";this.orientation="portrait";this.next=[]}askOptions(){return this.open(),this}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: Create new PDF`),this.addSetting().setName("Page size").addDropdown(e=>{Object.keys(So).forEach(i=>e.addOption(i,i)),e.setValue(this.pageSize).onChange(i=>{So.hasOwnProperty(i)&&(this.pageSize=i)})}),this.addSetting().setName("Orientation").addDropdown(e=>{e.addOption("portrait","Portrait").addOption("landscape","Landscape").setValue(this.orientation).onChange(i=>{(i==="portrait"||i==="landscape")&&(this.orientation=i)})}),this.addSetting().addButton(e=>{e.setButtonText("Create").setCta().then(i=>{setTimeout(()=>i.buttonEl.focus())}).onClick(async()=>{this.close();let i=await this.createPDFDocument();this.next.forEach(r=>r(i))})}).addButton(e=>{e.setButtonText("Cancel").onClick(()=>{this.close()})})}addSetting(){return new sa.Setting(this.contentEl)}then(e){return this.next.push(e),this}async createPDFDocument(){let e=await pe.create(),[i,r]=So[this.pageSize],o=Math.max(i,r),s=Math.min(i,r),a=this.orientation==="portrait"?[s,o]:[o,s];return e.addPage(a),e}};var Rc=require("obsidian"),Fr=class extends Ye{constructor(e,i){super(e);this.next=[];this.submitted=!1;this.title=null;this.modalTitle=i,this.component.registerDomEvent(this.modalEl.doc,"keypress",r=>{r.key==="Enter"&&this.submitAndClose()})}presetTitle(e){return this.title=e,this}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: ${this.modalTitle}`),new Rc.Setting(this.contentEl).setName("Title").addText(e=>{this.title!==null&&(e.setValue(this.title),e.inputEl.select()),e.inputEl.size=30,e.inputEl.id="pdf-plus-outline-title-modal"}),new Rc.Setting(this.contentEl).addButton(e=>{e.setButtonText("Add").setCta().onClick(()=>{this.submitAndClose()})}).addButton(e=>{e.setButtonText("Cancel").onClick(()=>{this.close()})})}ask(){return this.open(),this}then(e){return this.submitted&&this.title!==null?e({title:this.title}):this.next.push(e),this}submitAndClose(){let e=this.contentEl.querySelector("#pdf-plus-outline-title-modal");e instanceof HTMLInputElement&&(this.title=e.value,this.submitted=!0,this.close())}onClose(){this.submitted&&this.title!==null&&this.next.forEach(e=>e({title:this.title}))}},fh=class extends Rc.FuzzySuggestModal{constructor(e,i){super(e.plugin.app);this.next=[];this.outlines=e,this.plugin=e.plugin,this.items=[],this.outlines.iter({enter:r=>{!i.isAncestorOf(r,!0)&&!r.is(i.parent)&&this.items.push(r)}}),this.setPlaceholder("Type an outline item title")}askDestination(){return this.open(),this}then(e){return this.next.push(e),this}getItems(){return this.items}getItemText(e){return e.name}onChooseItem(e){this.next.forEach(i=>i(e))}};var yx=require("obsidian"),Ut=require("obsidian");var ph=class{constructor(t){this._rootDict=t}get root(){return this.createNode(this._rootDict)}get(t){return this.root.get(t)}iterLeaves(t){this.root.iterLeaves(t)}getLeaves(){return this.root.getLeaves()}iter(t){this.root.iter(t)}[Symbol.iterator](){return this.root[Symbol.iterator]()}keys(){return this.root.keys()}values(){return this.root.values()}limitLeafSize(t){this.root.limitLeafSize(t)}},aa=class extends ph{createNode(t){return new Gp(t)}},Pr=class extends ph{createNode(t){return new Xp(t)}},gh=class{constructor(t){this.dict=t}is(t){return this.dict===t.dict}isRoot(){return!this._dictHas("Limits")}isUniqueNode(){return this.isRoot()&&this._dictHas(this.leafKey)}isLeaf(){return this._dictHas("Limits")&&this._dictHas(this.leafKey)}isIntermediate(){return this._dictHas("Limits")&&this._dictHas("Kids")}get kids(){let t=this.dict.get(x.of("Kids"));return t instanceof H?t.asArray().map(e=>{let i=this.dict.context.lookup(e);if(i instanceof R)return new this.constructor(i);throw new Error("Kid is not a PDFDict")}):null}get limits(){let t=this.dict.get(x.of("Limits"));if(!(t instanceof H))return null;if(t.size()!==2)throw new Error("Limits array must have 2 elements");return t.asArray().map(e=>this._toStringOrNumber(e))}get(t){let e=this.getLeafFor(t);if(!e)return null;let i=e._getNamesOrNums();if(!i)throw new Error("Node has no names or nums despite not having kids");let r=0,o=(i.length>>1)-1;for(;r<=o;){let s=r+o>>1,a=i[s*2];if(a===t){let c=i[s*2+1];if(c instanceof fe)return c;throw new Error("Value is not a PDFObject")}a{if(t>=i.length)return{done:!0,value:[]};let o=i[t]._getNamesOrNums();if(!o)throw new Error("Leaf has no names or nums");let s=o[e],a=o[e+1];return e+=2,e>=o.length&&(t++,e=0),{done:!1,value:[s,a]}}}}keys(){return Array.from(this,([t])=>t)}values(){return Array.from(this,([,t])=>t)}size(){let t=0;return this.iterLeaves(e=>{let i=e._getNamesOrNums();if(!i)throw new Error("Leaf has no names or nums");t+=i.length>>1}),t}iterLeaves(t){let e=[this];for(;e.length;){let i=e.shift(),r=i.kids;r?e.push(...r):t(i)}}getLeaves(){let t=[];return this.iterLeaves(e=>t.push(e)),t}sortKids(){let t=this.kids;if(!t)return;t.sort((i,r)=>{let o=i.limits,s=r.limits;if(!o||!s)throw new Error("Kid has no limits");return o[0]s[0]?1:0});let e=H.withContext(this.dict.context);for(let i of t)e.push(i.dict);this.dict.set(x.of("Kids"),e)}flatten(){if(this.isUniqueNode()||this.isLeaf())return;let t=H.withContext(this.dict.context);for(let[e,i]of this)t.push(this._toPDFStringOrPDFNumber(e)),t.push(i);this.dict.set(x.of(this.leafKey),t),this.dict.delete(x.of("Kids"))}iter(t){var e,i,r;(e=t.enter)==null||e.call(t,this),(i=this.kids)==null||i.forEach(o=>o.iter(t)),(r=t.leave)==null||r.call(t,this)}limitLeafSize(t){let e=[],i=[],r=()=>{let o=this.dict.context.obj(e),s=e[0],a=e[e.length-2],c=this.dict.context.obj([s,a]),l=this.dict.context.obj({[this.leafKey]:o,Limits:c}),d=this.dict.context.register(l);i.push(d)};for(let[o,s]of this)e.push(o,s),e.length>>1>=t&&(r(),e.length=0);if(e.length&&r(),i.length===1)this.dict.set(x.of(this.leafKey),this.dict.context.obj(e)),this.dict.delete(x.of("Kids")),this.dict.delete(x.of("Limits"));else{let o=this.dict.context.obj(i);this.dict.set(x.of("Kids"),o)}}getLeafFor(t){if(this.isUniqueNode())return this;let e=this.limits;if(e&&(t{let s=o.limits;if(!s)throw new Error("Kid has no limits");return s[0]<=t&&t<=s[1]}),!i)return null;r=i.kids}return i}_dictHas(t){return this.dict.has(x.of(t))}_getNamesOrNums(){let t=this.dict.get(x.of(this.leafKey));return t instanceof H?t.asArray().map((e,i)=>i%2?e:this._toStringOrNumber(e)):null}},Gp=class extends gh{get leafKey(){return"Names"}_toStringOrNumber(t){if(t instanceof G||t instanceof M)return t.decodeText();throw new Error("Key is not a PDFString or a PDFHexString")}_toPDFStringOrPDFNumber(t){return M.fromText(t)}get names(){return this._getNamesOrNums()}},Xp=class extends gh{get leafKey(){return"Nums"}_toStringOrNumber(t){if(t instanceof N)return t.asNumber();throw new Error("Key is not a PDFNumber")}_toPDFStringOrPDFNumber(t){return N.of(t)}get nums(){return this._getNamesOrNums()}};var Zp={D:"1, 2, 3, ...",R:"I, II, III, ...",r:"i, ii, iii, ...",A:"A, B, C, ...",a:"a, b, c, ..."};function Yp(n){return Zp.hasOwnProperty(n)}var Vo=class{static fromPDFDict(t){let e=new Vo,i=t.get(x.of("St"));i instanceof N&&(e.start=i.asNumber());let r=t.get(x.of("S"));if(r instanceof x){let s=r.decodeText();Yp(s)&&(e.style=s)}let o=t.get(x.of("P"));return(o instanceof G||o instanceof M)&&(e.prefix=o.decodeText()),e}},vt=class{constructor(t,e){this.doc=t;this.ranges=e;this.normalize()}normalize(){var t;if(this.ranges.length){this.ranges.sort((e,i)=>e.pageFrom-i.pageFrom),this.ranges[0].pageFrom=1;for(let e=this.ranges.length-1;e>=0;e--){let i=this.getStartOfRange(e),r=this.getEndOfRange(e);if(i>r){this.ranges.splice(e,1);continue}let o=this.ranges[e],s=this.ranges[e-1];if(s&&typeof o.dict.start=="number"&&o.dict.prefix===s.dict.prefix&&o.dict.style===s.dict.style&&o.pageFrom-s.pageFrom===o.dict.start-((t=s.dict.start)!=null?t:1)){this.ranges.splice(e,1);continue}}}return this}static fromDocument(t){let e=tt(t.catalog,"PageLabels");if(!(e instanceof R))return null;let i=new Pr(e),r=[];for(let[o,s]of i){let a=s instanceof q?t.context.lookup(s):s;if(!(a instanceof R))return null;r.push({pageFrom:o+1,dict:Vo.fromPDFDict(a)})}return new vt(t,r)}setToDocument(t){t||(t=this.doc);let e=[];for(let{pageFrom:r,dict:o}of this.normalize().ranges){e.push(r-1);let s={};o.style!==void 0&&(s.S=o.style),o.prefix!==void 0&&(s.P=M.fromText(o.prefix)),o.start!==void 0&&(s.St=o.start),e.push(t.context.obj(s))}let i=t.context.obj({Nums:e});new Pr(i).limitLeafSize(64),t.catalog.set(x.of("PageLabels"),i)}static removeFromDocument(t){t.catalog.delete(x.of("PageLabels"))}static processDocument(t,e){let i=vt.fromDocument(t);return i?(e(i),i.setToDocument(),!0):!1}static createEmpty(t){return new vt(t,[{pageFrom:1,dict:new Vo}])}removeRange(t){return this.ranges.splice(t,1),this.normalize(),this}divideRangeAtPage(t,e,i){var a;let r=this.getRangeIndexAtPage(t);if(r===-1)return this;if(t===this.getStartOfRange(r))return this;let o=this.ranges[r],s=new Vo;return s.prefix=o.dict.prefix,s.style=o.dict.style,e&&(s.start=t-o.pageFrom+((a=o.dict.start)!=null?a:1)),i==null||i(s),this.ranges.splice(r+1,0,{pageFrom:t,dict:s}),this}shiftRangesAfterPage(t,e){for(let i of this.ranges)i.pageFrom>=t&&(i.pageFrom+=e);return this}getStartOfRange(t){return this.ranges[t].pageFrom}getEndOfRange(t){let e=this.ranges[t+1];return e?e.pageFrom-1:this.doc.getPageCount()}getRangeIndexAtPage(t){for(let e=0;e(this.doc=await e.lib.loadPdfLibDocument(i),this.pageLabels=vt.fromDocument(this.doc),{doc:this.doc,pageLabels:this.pageLabels}))(),this.scope.register([],"Enter",()=>this.redisplay())}},Qp=class{constructor(t,e){this.dict=t;this.containerEl=e;this.addNumberingStyleSetting(),this.addStartSetting(),this.addPrefixSetting()}addSetting(){return new Ut.Setting(this.containerEl)}addNumberingStyleSetting(){this.addSetting().setName("Numbering Style").addDropdown(t=>{var e;t.addOptions({...Zp,None:"None"}).setValue((e=this.dict.style)!=null?e:"None").onChange(i=>{Yp(i)?this.dict.style=i:delete this.dict.style})})}addStartSetting(){this.addSetting().setName("Start counting from").addText(t=>{t.inputEl.type="number",this.dict.start!==void 0?t.setValue(""+this.dict.start):t.setPlaceholder("1"),t.onChange(e=>{let i=Number(e);Number.isInteger(i)?(t.inputEl.removeClass("error"),i>1?this.dict.start=i:delete this.dict.start):(delete this.dict.start,t.inputEl.addClass("error"))})})}addPrefixSetting(){return this.addSetting().setName("Prefix").addText(t=>{var e;t.setValue((e=this.dict.prefix)!=null?e:"").onChange(i=>{i?this.dict.prefix=i:delete this.dict.prefix})})}},mh=class extends Jp{constructor(){super(...arguments);this.buttonSetting=null}async onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: edit page labels`),new Ut.Setting(this.contentEl).then(e=>{Ut.MarkdownRenderer.render(this.app,["Each page in a PDF document can be assigned a ***page label***, which can be different from the page index.",'For example, a book might have a preface numbered as "i", "ii", "iii", ... and the main content numbered as "1", "2", "3", ...'].join(" "),e.descEl,"",this.component)}).then(e=>this.contentEl.prepend(e.settingEl)),this.controlEl.createDiv({cls:"page-labels-loading",text:"Loading..."}),await this.docLoadingPromise,this.display(),this.addButtons()}redisplay(){this.display()}display(){let{pageLabels:e,doc:i}=this;if(!i)return;if(this.controlEl.empty(),e===null||e.rangeCount()===0){this.addHeading(this.controlEl,"No page labels found","lucide-info").setDesc("This PDF document does not have any page labels.").addButton(o=>{o.setButtonText("Create").setCta().onClick(()=>{this.pageLabels=vt.createEmpty(i),this.redisplay(),this.updateButtonVisibility()})}).addButton(o=>{o.setButtonText("Cancel").onClick(()=>this.close())});return}let r=i.getPageCount();for(let o=0;o{h>a.pageFrom&&u.addExtraButton(f=>{f.setIcon("lucide-separator-horizontal").setTooltip("Divide this labeling range").onClick(()=>{e.divideRangeAtPage(a.pageFrom+1,!1),this.redisplay()})})}).addExtraButton(u=>{u.setIcon("lucide-x").setTooltip("Label the pages in this range continuing from the previous range").onClick(()=>{e.removeRange(o),this.redisplay()})}),new Ut.Setting(s).setName("From").setDesc("The index of the first page in this range.").then(u=>u.controlEl.appendText("Page")).addText(u=>{u.inputEl.type="number",u.setValue(""+a.pageFrom).onChange(f=>{let p=Number(f);Number.isInteger(p)&&(c?c.pageFrom:1)this.redisplay(),{once:!0})}).then(u=>this.addPreviewButton(u,a.pageFrom)),new Ut.Setting(s).setName("To").setDesc("The index of the last page in this range.").then(u=>u.controlEl.appendText("Page")).addText(u=>{u.inputEl.type="number",u.setValue(""+h).onChange(f=>{let p=Number(f);Number.isInteger(p)&&a.pageFrom<=p&&p<=(d?d.pageFrom-1:r-1)?(l.pageFrom=p+1,u.inputEl.removeClass("error")):u.inputEl.addClass("error")}).setDisabled(o===e.ranges.length-1).then(f=>{f.disabled&&(0,yx.setTooltip)(f.inputEl,"The last range cannot be extended.")}),u.inputEl.addEventListener("blur",()=>this.redisplay(),{once:!0})}).then(u=>this.addPreviewButton(u,h)),new Qp(a.dict,s)}}addHeading(e,i,r){return new Ut.Setting(e).setName(i).setHeading().then(o=>{let s=createDiv();o.settingEl.prepend(s),(0,Ut.setIcon)(s,r)})}addPreviewButton(e,i){return e.addExtraButton(r=>{r.setIcon("lucide-message-square").setTooltip(`Hover${this.plugin.requireModKeyForLinkHover()?"+"+fi("Mod").toLowerCase():""} to preview`).then(o=>{this.component.registerDomEvent(o.extraSettingsEl,"mouseover",s=>{this.app.workspace.trigger("hover-link",{event:s,source:"pdf-plus",linktext:this.file.path+`#page=${i}`,targetEl:o.extraSettingsEl,hoverParent:this.component})})})})}addButtons(){var e;return(e=this.buttonSetting)!=null?e:new Ut.Setting(this.contentEl).addButton(i=>{i.setButtonText("Save").setCta().onClick(async()=>{this.pageLabels&&this.doc?(this.pageLabels.rangeCount()>0?this.pageLabels.setToDocument(this.doc):vt.removeFromDocument(this.doc),await this.app.vault.modifyBinary(this.file,await this.doc.save())):new Ut.Notice(`${this.plugin.manifest.name}: Something went wrong.`),this.close()})}).addButton(i=>{i.setButtonText("Cancel").onClick(()=>this.close())}).then(i=>{this.buttonSetting=i,this.updateButtonVisibility()})}updateButtonVisibility(){this.buttonSetting&&(this.pageLabels&&this.pageLabels.rangeCount()>0?this.buttonSetting.settingEl.show():this.buttonSetting.settingEl.hide())}};var pi=require("obsidian");var bh=class extends Ye{constructor(...e){super(...e);this.source=null;this.uris=[];this.folderPath=null;this.scope.register([],"Enter",()=>{var i;((i=activeDocument.activeElement)==null?void 0:i.tagName)==="INPUT"&&this.submit()})}onOpen(){super.onOpen();let e=this.plugin.loadLocalStorage(bh.LOCAL_STORAGE_KEY);["file","web"].includes(e)&&(this.source=e),this.folderPath=this.lib.dummyFileManager.getFolderPathForDummyFiles(this.app.workspace.getActiveFile()),this.titleEl.setText(`${this.plugin.manifest.name}: Create dummy file for external PDF`),this.modalEl.createDiv("",i=>{new pi.Setting(i).setDesc(createFragment(r=>{let o=this.plugin.settings.modifierToDropExternalPDFToCreateDummy;r.appendText(`You can also use ${o.length?o.map(fi).join("+")+" +":""} drag & drop to create dummy files. `),r.createEl("a",{text:"Learn more about dummy PDF files",href:"https://ryotaushio.github.io/obsidian-pdf-plus/external-pdf-files"})})),setTimeout(()=>{this.modalEl.insertBefore(i,this.contentEl)})}),this.display()}display(){pi.Platform.isDesktopApp?this.displayDesktop():this.displayMobile()}displayDesktop(){this.contentEl.empty(),this.addSourceLocationSetting(),this.addFolderSetting(),this.source==="file"?this.addLocalFileSetting():this.source==="web"&&this.addWebFileSetting(),this.source&&this.addButtons()}displayMobile(){this.source="web",this.contentEl.empty(),this.addFolderSetting(),this.addWebFileSetting(),this.addButtons()}addSetting(){return new pi.Setting(this.contentEl)}addSourceLocationSetting(){return this.addSetting().setName("Source location").setDesc("Where the external PDF is located.").addDropdown(e=>{var i;e.addOptions({file:"On this computer",web:"Web"}).setValue((i=this.source)!=null?i:"").onChange(r=>{this.source=r,this.display()}),e.selectEl.tabIndex=this.source?-1:0})}addFolderSetting(){return this.addSetting().setName("Folder to save the dummy files").setDesc(createFragment(e=>{e.appendText("You can specify the default folder in the "),e.createEl("a",{text:"settings",href:"obsidian://pdf-plus?setting=dummyFileFolderPath"}),e.appendText(".")})).addText(e=>{var i;e.inputEl.size=30,e.setValue((i=this.folderPath)!=null?i:""),new xr(this.app,e.inputEl).onSelect(({item:r})=>{this.folderPath=r.path})})}addLocalFileSetting(){this.addSetting().setName("Absolute path to the PDF").setDesc('Type the path in the input box or click the "Browse" button to select the file.').addButton(e=>{e.setButtonText("Browse").setCta().onClick(()=>{var r;let i=(r=window.electron)==null?void 0:r.remote.dialog.showOpenDialogSync({properties:["openFile","multiSelections","dontAddToRecent"],filters:[{name:"PDF files",extensions:["pdf"]}]});i&&i.length>0&&(this.uris=i.map(o=>this.lib.dummyFileManager.absolutePathToFileUri(o)),this.display())})}).addExtraButton(e=>{e.setIcon("plus").setTooltip("Add another file").onClick(()=>{this.uris.push(""),this.display()})}),this.addUriListSetting()}addWebFileSetting(){this.addSetting().setName("URL of the PDF").setDesc('Must start with "https://" or "http://".').addExtraButton(e=>{e.setIcon("plus").setTooltip("Add another URL").onClick(()=>{this.uris.push(""),this.display()})}),this.addUriListSetting()}addUriListSetting(){this.uris.length||this.uris.push("");for(let e=0;ei.settingEl.addClass("no-border")).addText(i=>{i.inputEl.size=30,this.source==="file"?i.setValue(this.uris[e]?this.uris[e].replace(/^file:\/\//,""):"").onChange(r=>{this.uris[e]="file://"+r}):i.setValue(this.uris[e]||"").onChange(r=>{this.uris[e]=r}),e===this.uris.length-1&&setTimeout(()=>i.inputEl.focus())}).addExtraButton(i=>{i.setIcon("trash").setTooltip(`Remove this ${this.source==="file"?"file":"URL"}`).onClick(()=>{this.uris.splice(e,1),this.display()}),this.uris.length===1&&i.extraSettingsEl.hide()})}addButtons(){this.contentEl.createDiv("modal-button-container",e=>{e.createEl("button",{text:"Create",cls:"mod-cta"},i=>{i.addEventListener("click",()=>{this.submit()})}),e.createEl("button",{text:"Cancel"},i=>{i.addEventListener("click",()=>{this.close()})})})}submit(){if(this.uris=this.uris.filter(e=>e),!this.uris.length){new pi.Notice(`${this.plugin.manifest.name}: The external PDF location is not specified.`);return}if(!this.folderPath){new pi.Notice(`${this.plugin.manifest.name}: The folder to save the dummy files is not specified.`);return}this.plugin.saveLocalStorage(bh.LOCAL_STORAGE_KEY,this.source),this.createDummyFiles(),this.close()}async createDummyFiles(){if(this.folderPath){this.folderPath=(0,pi.normalizePath)(this.folderPath);let e=await this.lib.dummyFileManager.createDummyFilesInFolder(this.folderPath,this.uris);new pi.Notice(`${this.plugin.manifest.name}: Dummy files created successfully.`);for(let i of e)i&&await this.app.workspace.getLeaf(!0).openFile(i)}else new pi.Notice(`${this.plugin.manifest.name}: Failed to create dummy files for the following URIs: ${this.uris.join(", ")}`)}},Bo=bh;Bo.LOCAL_STORAGE_KEY="last-used-dummy-file-source";var _p=require("obsidian");var kr=class extends Ye{static openIfNecessary(t){let e=Rp();e&&Np(e,t.manifest.minAppVersion)&&new kr(t).open()}onOpen(){super.onOpen();let t=this.plugin.manifest.name;this.setTitle(`${t}: Outdated Obsidian installer`),this.contentEl.appendText(`Your Obsidian installer is outdated and likely to be incompatible with the latest ${t}. Please download the latest installer from Obsidian's website and re-install the Obsidian app.`),this.contentEl.createDiv("modal-button-container",e=>{new _p.ButtonComponent(e).setButtonText("Get installer from https://obsidian.md").setCta().onClick(()=>{window.open("https://obsidian.md/download","_blank")}),new _p.ButtonComponent(e).setButtonText('What is "installer version"?').onClick(()=>{window.open("https://help.obsidian.md/Getting+started/Update+Obsidian#Installer%20updates","_blank")})})}};var Ce=require("obsidian");var wx=require("obsidian");var Rn=class{constructor(){this.tree=null;this.dict=null}static fromDocument(t){if(t.catalog.has(x.of("Dests"))){let i=tt(t.catalog,"Dests");if(i instanceof R){let r=new Rn;return r.dict=i,r}}let e=tt(t.catalog,"Names");if(e instanceof R){let i=tt(e,"Dests");if(i instanceof R){let r=new Rn;return r.tree=new aa(i),r}}return null}getExplicitDest(t){var i,r;let e=null;if(this.dict){let o=tt(this.dict,t);e=(i=o instanceof q?this.dict.context.lookup(o):o)!=null?i:null}else if(this.tree){let o=this.tree.get(t);e=(r=o instanceof q?this.tree._rootDict.context.lookup(o):o)!=null?r:null}if(e instanceof H)return e;if(e instanceof R){let o=e.get(x.of("D"));if(o instanceof H)return o}return null}};var Te=class{constructor(t,e){this.plugin=t,this.doc=e,this.namedDests=Rn.fromDocument(e)}static async fromDocument(t,e){return new Te(e,t)}static async fromFile(t,e){let{lib:i}=e,r=await i.loadPdfLibDocument(t);return new Te(e,r)}get lib(){return this.plugin.lib}get root(){let t=tt(this.doc.catalog,"Outlines");return t instanceof R?new Dr(this,t):null}set root(t){if(t){let e=this.doc.context.getObjectRef(t.dict);e||(e=this.doc.context.register(t.dict)),this.doc.catalog.set(x.of("Outlines"),e);return}this.doc.catalog.delete(x.of("Outlines"))}ensureRoot(){if(!this.root){let t=this.doc.context.obj({Type:"Outlines"});this.doc.context.register(t),this.root=new Dr(this,t)}return this.root}getLeaves(){let t=[],e=i=>{i.firstChild&&e(i.firstChild),i.nextSibling&&e(i.nextSibling),i.firstChild||t.push(i)};return this.root&&e(this.root),t}iter(t){let e=i=>{var r,o;(r=t.enter)==null||r.call(t,i),i.iterChildren(e),(o=t.leave)==null||o.call(t,i)};this.root&&e(this.root)}async iterAsync(t){let e=async i=>{var r,o;await((r=t.enter)==null?void 0:r.call(t,i)),await i.iterChildrenAsync(e),await((o=t.leave)==null?void 0:o.call(t,i))};this.root&&await e(this.root)}async prune(){await this.iterAsync({leave:async t=>{await t.destNotExistInDoc()&&(t.removeAndLiftUpChildren(),t.updateCountForAllAncestors())}})}stringify(){let t="";return this.iter({enter:e=>{e.isRoot()||(t=t+" ".repeat(e.depth-1)+"- "+e.title+` +`)}}),t}async findPDFjsOutlineTreeNode(t){let e=null;return await this.iterAsync({enter:async i=>{if(!(e||i.isRoot())&&t.item.title===i.title){let r=t.item.dest,o=i.getNormalizedDestination();if(typeof r=="string")typeof o=="string"&&r===o&&(e=i);else{let s=await t.getPageNumber();JSON.stringify(this.lib.normalizePDFJsDestArray(r,s))===JSON.stringify(o)&&(e=i)}}}}),e}static async processOutlineRoot(t,e,i){let{app:r}=i,o=await Te.fromFile(e,i);t(o.ensureRoot());let s=await o.doc.save();await r.vault.modifyBinary(e,s)}static async findAndProcessOutlineItem(t,e,i,r){let{app:o}=r,s=await Te.fromFile(i,r),a=await s.findPDFjsOutlineTreeNode(t);if(!a){new wx.Notice(`${r.manifest.name}: Failed to process the outline item.`);return}e(a);let c=await s.doc.save();await o.vault.modifyBinary(i,c)}},Dr=class{constructor(t,e){this.outlines=t,this.dict=e}get doc(){return this.outlines.doc}get lib(){return this.outlines.plugin.lib}is(t){return t!==null&&this.dict===t.dict}_get(t){let e=tt(this.dict,t);return e instanceof R?new Dr(this.outlines,e):null}_setOrDelete(t,e){if(e){let i=this.doc.context.getObjectRef(e.dict);i||(i=this.doc.context.register(e.dict)),this.dict.set(x.of(t),i);return}this.dict.delete(x.of(t))}get firstChild(){return this._get("First")}set firstChild(t){if(t&&!this.is(t.parent))throw new Error(`Item "${t.name}" is not a child of this item "${this.name}"`);this._setOrDelete("First",t)}get lastChild(){return this._get("Last")}set lastChild(t){if(t&&!this.is(t.parent))throw new Error(`Item "${t.name}" is not a child of this item "${this.name}"`);this._setOrDelete("Last",t)}get nextSibling(){return this._get("Next")}set nextSibling(t){if(t&&!(t.parent&&t.parent.is(this.parent)))throw new Error(`Item "${t.name}" is not a sibling of this item "${this.name}"`);this._setOrDelete("Next",t)}get prevSibling(){return this._get("Prev")}set prevSibling(t){if(t&&!(t.parent&&t.parent.is(this.parent)))throw new Error(`Item "${t.name}" is not a sibling of this item "${this.name}"`);this._setOrDelete("Prev",t)}get parent(){return this._get("Parent")}set parent(t){if(t&&this.isRoot())throw new Error("Cannot set parent of the root of outline");this._setOrDelete("Parent",t)}get count(){let t=tt(this.dict,"Count");return t instanceof N?t.asNumber():null}set count(t){if(t===null){this.dict.delete(x.of("Count"));return}this.dict.set(x.of("Count"),N.of(t))}get title(){if(this.isRoot())throw new Error("Root of outline does not have a title");let t=tt(this.dict,"Title");if(t instanceof G||t instanceof M)return t.decodeText();throw new Error("Title is not a string")}set title(t){if(this.isRoot())throw new Error("Cannot set title of the root of outline");this.dict.set(x.of("Title"),M.fromText(t))}get name(){if(this.isRoot())return"(Root)";let t=this.title;return this.iterAncestors(e=>{e.isRoot()||(t=`${e.title}/${t}`)}),t}get depth(){let t=0;return this.iterAncestors(()=>t++),t}isLeaf(){return!this.firstChild}isRoot(){return this.parent===null}createChild(t,e){let i;if(typeof e=="string")i=M.fromText(e);else{i=H.withContext(this.doc.context),i.push(this.doc.getPage(e[0]).ref),i.push(x.of(e[1]));for(let s of e.slice(2))i.push(typeof s=="number"?N.of(s):Me)}let r=this.doc.context.getObjectRef(this.dict);if(!r)throw new Error("Could not get ref for parent");let o={Title:M.fromText(t),Dest:i,Parent:r};if(this.lastChild){Object.assign(o,{Prev:this.doc.context.getObjectRef(this.lastChild.dict)});let s=new Dr(this.outlines,this.doc.context.obj(o));this.lastChild.nextSibling=s,this.lastChild=s}else{let s=new Dr(this.outlines,this.doc.context.obj(o));this.firstChild=s,this.lastChild=s}return this.lastChild}appendChild(t){if(t.isAncestorOf(this,!0))throw new Error("Cannot append an ancestor as a child");t.remove(),t.updateCountForAllAncestors(),t.parent=this,this.lastChild?(this.lastChild.nextSibling=t,t.prevSibling=this.lastChild,this.lastChild=t):(this.firstChild=t,this.lastChild=t,t.prevSibling=null),t.nextSibling=null,t.updateCountForAllAncestors()}remove(){return this.prevSibling&&(this.prevSibling.nextSibling=this.nextSibling),this.nextSibling&&(this.nextSibling.prevSibling=this.prevSibling),this.parent&&(this.is(this.parent.firstChild)&&(this.parent.firstChild=this.nextSibling),this.is(this.parent.lastChild)&&(this.parent.lastChild=this.prevSibling)),this}removeAndLiftUpChildren(){if(this.remove(),this.firstChild){if(!this.lastChild)throw new Error("Last child is not set despite having children");this.iterChildren(t=>{t.parent=this.parent}),this.prevSibling?(this.prevSibling.nextSibling=this.firstChild,this.firstChild.prevSibling=this.prevSibling):this.parent&&(this.parent.firstChild=this.firstChild,this.firstChild.prevSibling=null),this.nextSibling?(this.nextSibling.prevSibling=this.lastChild,this.lastChild.nextSibling=this.nextSibling):this.parent&&(this.parent.lastChild=this.lastChild,this.lastChild.nextSibling=null)}}iterChildren(t){let e=this.firstChild;for(;e;)t(e),e=e.nextSibling}async iterChildrenAsync(t){let e=this.firstChild;for(;e;)await t(e),e=e.nextSibling}iterAncestors(t,e=!1){e&&t(this);let i=this.parent;for(;i;)t(i),i=i.parent;return this}isAncestorOf(t,e=!1){let i=!1;return t.iterAncestors(r=>{this.is(r)&&(i=!0)},e),i}async sortChildren(){let t=[];await this.iterChildrenAsync(async r=>{let o=r.getExplicitDestination();if(o===null)return 0;let s=o[0],a=o[1]==="XYZ"?o[3]:o[1]==="FitBH"||o[1]==="FitH"?o[2]:void 0;t.push({child:r,page:s,top:a!=null?a:void 0})}),t.sort((r,o)=>{var s,a;return r.page-o.page||((s=r.top)!=null?s:0)-((a=o.top)!=null?a:0)});let e=null,i=t.first();i&&(i.child.prevSibling=null,this.firstChild=i.child);for(let{child:r}of t)e&&(e.nextSibling=r,r.prevSibling=e),e=r;e&&(e.nextSibling=null,this.lastChild=e)}async destNotExistInDoc(){var r,o,s;if(this.isRoot())return!1;let t=this.getDestination(),e=null;if(t instanceof G||t instanceof M){let a=t.decodeText();e=(o=(r=this.outlines.namedDests)==null?void 0:r.getExplicitDest(a))!=null?o:null}else t instanceof H&&(e=t);if(!e)return!0;let i=e.get(0);if(i instanceof q){let a=this.doc.context.lookup(i);if(a instanceof it)return!((s=a.Parent())!=null&&s.Kids().asArray().includes(i))}throw new Error("The first element of a destination array must be a refernece of a page leaf node.")}countVisibleDescendants(){let t=0;return this.iterChildren(()=>t++),this.iterChildren(e=>{typeof e.count=="number"&&e.count>0&&(t+=e.countVisibleDescendants())}),t}updateCount(t){let e=this.countVisibleDescendants();if(this.isRoot()&&!t)throw new Error("Cannot close the root outline");this.count=t?e:-e}updateCountForAllAncestors(t=!1){return this.iterAncestors(e=>e.updateCount(e.isRoot()),t)}getDestination(){let t=tt(this.dict,"Dest");if(t)return t;let e=tt(this.dict,"A");if(e instanceof R){let i=tt(e,"S");if(i instanceof x&&i.decodeText()==="GoTo"){let r=tt(e,"D");return r!=null?r:null}}return null}getNormalizedDestination(){let t=this.getDestination();return t instanceof G||t instanceof M?t.decodeText():t instanceof H?this.lib.normalizePdfLibDestArray(t,this.doc):null}getExplicitDestination(){var e,i;let t=this.getNormalizedDestination();if(typeof t=="string"){let r=(i=(e=this.outlines.namedDests)==null?void 0:e.getExplicitDest(t))!=null?i:null;return r?this.lib.normalizePdfLibDestArray(r,this.doc):null}return t}};var Sr=require("obsidian");function vx(n,t,e){let i=(r,o)=>{if(o>=t.length)return;e.clickableParentItem&&r.setUseNativeMenu(!1);let s=new Set(r.items);t[o](r);let a=r.items.filter(c=>!s.has(c));if(o!=t.length-1){for(let c of a)if(c instanceof Sr.MenuItem){let l=c.callback,d=c.setSubmenu();if(e.vim){eg(d);let h=d.scope.keys.find(u=>u.key==="Escape"&&u.modifiers==="");h&&(d.scope.unregister(h),d.scope.register([],"Escape",n.hide.bind(n)))}i(d,o+1),e.clickableParentItem&&c.onClick(l)}}};i(n,0)}function Fx(n){let t=[],e=[],i=n;for(;i&&i.selected>=0;){e.push(i.selected);let r=i.items[i.selected];r instanceof Sr.MenuItem&&t.push(r),i=r instanceof Sr.MenuItem?r.submenu:null}return{items:t,indices:e}}function $p(n,t){n.openSubmenu=function(e){return this.parentMenu&&this.closeSubmenu(),Sr.Menu.prototype.openSubmenu.call(this,e)},n.openSubmenuSoon=(0,Sr.debounce)(n.openSubmenu.bind(n),t!=null?t:250,!0)}function eg(n){n.scope.register([],"j",n.onArrowDown.bind(n)),n.scope.register([],"k",n.onArrowUp.bind(n)),n.scope.register([],"h",n.onArrowLeft.bind(n)),n.scope.register([],"l",n.onArrowRight.bind(n))}var re=require("obsidian");var ag=require("obsidian");var kx=require("obsidian");var ft=require("obsidian");var Px=require("obsidian"),de=class extends Px.Component{constructor(e){super();this.plugin=e}get app(){return this.plugin.app}get lib(){return this.plugin.lib}get settings(){return this.plugin.settings}};var ng=class extends de{constructor(e,i){super(e);this.child=i,this.destIdToBibText=new Map,this.destIdToParsedBib=new Map,this.events=new ft.Events,this.initialized=!1,this.init()}isEnabled(){let e=this.child.pdfViewer;return this.settings.actionOnCitationHover!=="none"&&(On(e)||this.settings.enableBibInCanvas&&na(e)||this.settings.enableBibInHoverPopover&&ra(e)||this.settings.enableBibInEmbed&&Ac(e))}async init(){this.isEnabled()&&(await this.extractBibText(),await this.parseBibText()),this.initialized=!0}async extractBibText(){return new Promise(e=>{this.lib.onDocumentReady(this.child.pdfViewer,i=>{new tg(i).onExtracted((r,o)=>{this.destIdToBibText.set(r,o),this.events.trigger("extracted",r,o)}).extract().then(e)})})}async parseBibText(){let e=Array.from(this.destIdToBibText.values()).join(` +`),i=await this.parseBibliographyText(e);if(i){let r=Array.from(this.destIdToBibText.keys());for(let o=0;o{let a=new ft.HoverPopover(i,o,200);a.hoverEl.addClass("pdf-plus-bib-popover");let c=a.hoverEl.createDiv();a.addChild(new ig(this,e,c))};this.plugin.requireModKeyForLinkHover(ng.HOVER_LINK_SOURCE_ID)?Dp(r,o,s):s()}getGoogleScholarSearchUrlFromDest(e){var o;let i="",r=this.destIdToParsedBib.get(e);if(r){let{author:s,title:a,year:c,"container-title":l}=r;a&&(i+=`${a[0]}`),s&&(i+=" "+s.map(d=>d.family).join(" ")),c&&(i+=` ${c}`),l&&(i+=` ${l[0]}`)}else i=(o=this.destIdToBibText.get(e))!=null?o:"";return i?`https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=${encodeURIComponent(i)}`:null}async parseBibliographyText(e){let{app:i,plugin:r,settings:o}=this,s=o.anystylePath;if(!s)return null;let a=r.getAnyStyleInputDir();if(ft.Platform.isDesktopApp&&i.vault.adapter instanceof ft.FileSystemAdapter&&a){let c=i.vault.adapter.getFullPath(a);await ft.FileSystemAdapter.mkdir(c);let l=a+`/${Ep()}.txt`,d=i.vault.adapter.getFullPath(l);await i.vault.adapter.write(l,e),this.register(()=>i.vault.adapter.remove(l));let{spawn:h}=require("child_process");return new Promise(u=>{let f=h(s,["parse",d]),p="";f.stdout.on("data",g=>{if(g){p+=g.toString();return}u(null)}),f.on("error",g=>{if("code"in g&&g.code==="ENOENT"){let m=`${r.manifest.name}: AnyStyle not found at the path "${s}".`;if(r.settings.anystylePath){let b=new ft.Notice(m,8e3);b.noticeEl.appendText(" Click "),b.noticeEl.createEl("a",{text:"here"},w=>{w.addEventListener("click",()=>{r.openSettingTab().scrollTo("anystylePath")})}),b.noticeEl.appendText(" to update the path."),console.error(m)}else console.warn(m);return u(null)}}),f.on("close",g=>{var b;if(g)return u(null);let m=JSON.parse(p);if(Array.isArray(m)){for(let w of m)for(let F of(b=w.date)!=null?b:[]){let v=F.match(/\d{4}/);if(v){w.year=v[0];break}}u(m)}u(null)})})}return null}on(e,i,r){return this.events.on(e,i,r)}},Ci=ng;Ci.HOVER_LINK_SOURCE_ID="pdf-plus-citation-link";var tg=class{constructor(t){this.doc=t,this.pageRefToTextContentItemsPromise={}}onExtracted(t){return this.onExtractedCallback=t,this}async extract(){let t=await this.doc.getDestinations(),e=[];for(let i in t)if(i.startsWith("cite.")){let r=t[i];e.push(this.extractBibTextForDest(r).then(o=>{var s;if(o){let a=o.text;(s=this.onExtractedCallback)==null||s.call(this,i,a)}}))}await Promise.all(e)}async getTextContentItemsFromPageRef(t){var i;let e=JSON.stringify(t);return(i=this.pageRefToTextContentItemsPromise[e])!=null?i:this.pageRefToTextContentItemsPromise[e]=(async()=>{let r=await this.doc.getPageIndex(t)+1;return(await(await this.doc.getPage(r)).getTextContent()).items})()}async extractBibTextForDest(t){let e=t[0],i=await this.getTextContentItemsFromPageRef(e),r=-1;if(t[1].name==="XYZ"){let d=t[2],h=t[3];if(d===null||h===null)return null;r=i.findIndex(u=>{if(!u.str)return!1;let f=u.transform[4],p=u.transform[5]+(u.height||u.transform[0])*.8;return d<=f&&p<=h})}else if(t[1].name==="FitBH"){let d=t[2];if(d===null)return null;r=i.findIndex(h=>h.str?h.transform[5]+(h.height||h.transform[0])*.8<=d:!1)}if(r===-1)return null;let o=i[r],s=o.transform[4],a=i[r].str,c=r+1,l=[o];for(;;){let d=i[c];if(!d||d.transform[4]<=s+Math.max(d.height,8)*.1)break;d.str.trimStart().startsWith(".")||d.str.trimStart().startsWith(",")?a=a.trimEnd()+d.str.trimStart():a+=` +`+d.str,l.push(d),c++}return a=a.trimStart().replace(/^\[\d+\]/,""),a=a.trimStart().replace(/^\(\d+\)/,""),a=a.trimStart().replace(/^\d+\./,""),{text:Lc(a),items:l}}},ig=class extends de{constructor(e,i,r){super(e.plugin);this.bib=e,this.destId=i,this.containerEl=r,this.containerEl.addClass("pdf-plus-bib")}get child(){return this.bib.child}renderParsedBib(e){let{author:i,title:r,year:o,"container-title":s}=e;return i?(this.containerEl.createDiv("",a=>{a.createDiv("bib-title",c=>{var l;c.setText((l=r==null?void 0:r[0])!=null?l:"No title")}),a.createDiv("bib-author-year",c=>{let l=i.map(d=>{let h="";return d.given&&(h+=d.given),d.family&&(h+=" "+d.family),h}).filter(d=>d).join(", ");c.appendText(l),o&&c.appendText(` (${o})`)}),s&&a.createDiv("bib-container-title",c=>{c.setText(s[0])})}),!0):!1}async onload(){await this.render()}async render(){this.containerEl.empty();let e=!1,i=this.bib.destIdToParsedBib.get(this.destId);if(i&&(e=this.renderParsedBib(i)),!e){let r=this.bib.destIdToBibText.get(this.destId);r?(this.containerEl.createDiv({text:r}),ft.Platform.isDesktopApp&&this.settings.anystylePath&&this.registerRenderOn("parsed")):this.bib.initialized?this.containerEl.createDiv({text:"No bibliography found"}):(this.containerEl.createDiv({text:"Loading..."}),this.registerRenderOn("extracted"))}this.containerEl.createDiv("button-container",r=>{new ft.ButtonComponent(r).setButtonText("Google Scholar").onClick(()=>{let o=this.bib.getGoogleScholarSearchUrlFromDest(this.destId);if(!o){new ft.Notice(`${this.plugin.manifest.name}: ${this.bib.initialized?"No bibliography found":"Still loading the bibliography information. Please try again later."}`);return}window.open(o)}),new ft.ExtraButtonComponent(r).setIcon("lucide-settings").setTooltip("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("citation")})})}registerRenderOn(e){let i=this.bib.on(e,r=>{r===this.destId&&(this.render(),this.bib.events.offref(i))});this.registerEvent(i)}onunload(){this.containerEl.empty()}};var xh=class{get hoverPopover(){return this.child.hoverPopover}set hoverPopover(t){this.child.hoverPopover=t,t&&this.onHoverPopoverSet(t)}onHoverPopoverSet(t){}constructor(t,e,i){this.plugin=t,this.app=t.app,this.lib=t.lib,this.child=e,this.targetEl=i,this.useModifierKey()&&this.registerClickToOpenInNewLeaf(),this.shouldShowHoverPopover()&&this.registerHover(),this.shouldRecordHistory()&&this.registerClickToRecordHistory()}get hoverLinkSourceId(){return this.constructor.HOVER_LINK_SOURCE_ID}get file(){return this.child.file}get sourcePath(){var t,e;return(e=(t=this.file)==null?void 0:t.path)!=null?e:""}registerClickToOpenInNewLeaf(){let{app:t,plugin:e,targetEl:i}=this;e.registerDomEvent(i,"click",async r=>{if(r.defaultPrevented)return;let o=kx.Keymap.isModEvent(r);if(!o)return;r.preventDefault(),r.stopPropagation();let s=await this.getLinkText(r);s!==null&&t.workspace.openLinkText(s,this.sourcePath,o)},{capture:!0})}async customHover(t){return!1}registerHover(){let{app:t,plugin:e,targetEl:i}=this;e.registerDomEvent(i,"mouseover",async r=>{if(await this.customHover(r))return;let o=null;try{o=await this.getLinkText(r)}catch(s){if(s.name==="UnknownErrorException")return console.warn(`${this.plugin.manifest.name}: The destination was not found in this document.`);throw s}o!==null&&t.workspace.trigger("hover-link",{event:r,source:this.hoverLinkSourceId,hoverParent:this,targetEl:i,linktext:o,sourcePath:this.sourcePath})})}registerClickToRecordHistory(){let{plugin:t,targetEl:e}=this;t.registerDomEvent(e,"click",i=>{this.recordLeafHistory()},{capture:!0})}recordLeafHistory(){this.lib.workspace.iteratePDFViews(t=>{if(t.containerEl.contains(this.targetEl)){let e=t.leaf;e.recordHistory(e.getHistoryState())}})}},yh=class extends xh{async getLinkText(t){var c,l,d;let{lib:e,child:i,targetEl:r}=this;if(!ui(t,r))return null;let o=(c=i.pdfViewer.pdfViewer)==null?void 0:c.pdfDocument;if(!o)return null;let s=this.getDest(),a=null;return typeof s=="string"?a=await e.destIdToSubpath(s,o):a=await e.pdfJsDestArrayToSubpath(s,o),a===null?null:((d=(l=this.file)==null?void 0:l.path)!=null?d:"")+a}onHoverPopoverSet(t){let e=t.hoverEl;e.addClass("pdf-plus-pdf-internal-link-popover");let i=this.getDest();typeof i=="string"&&(e.dataset.dest=i)}},wh=class extends yh{constructor(e,i,r){super(e,i,r.container);this.linkAnnotationElement=r}static registerEvents(e,i,r){return r.data.subtype==="Link"?new wh(e,i,r):null}async getLinkText(e){var i,r;if(this.plugin.settings.actionOnCitationHover==="google-scholar-popover"&&this.lib.requirePluginNewerThan("surfing","0.9.5")){let o=this.getDest();if(lh(o)&&((i=this.child.pdfViewer.pdfViewer)==null?void 0:i.pdfDocument)){let a=(r=this.child.bib)==null?void 0:r.getGoogleScholarSearchUrlFromDest(o);if(a)return a}}return super.getLinkText(e)}getDest(){return this.linkAnnotationElement.data.dest}useModifierKey(){return this.plugin.settings.clickPDFInternalLinkWithModifierKey}shouldShowHoverPopover(){return this.plugin.settings.enableHoverPDFInternalLink}isCitationLink(){let e=this.getDest();return lh(e)}get hoverLinkSourceId(){return this.isCitationLink()?Ci.HOVER_LINK_SOURCE_ID:wh.HOVER_LINK_SOURCE_ID}shouldRecordHistory(){return this.plugin.settings.recordPDFInternalLinkHistory&&!this.child.opts.isEmbed}async customHover(e){if(this.plugin.settings.actionOnCitationHover==="pdf-plus-bib-popover"&&this.child.bib&&this.child.bib.isEnabled()){let i=this.getDest();if(typeof i=="string"&&i.startsWith("cite."))return this.child.bib.spawnBibPopoverOnModKeyDown(i,this,e,this.targetEl),!0}return!1}},Ji=wh;Ji.HOVER_LINK_SOURCE_ID="pdf-plus-internal-link";var rg=class extends yh{constructor(e,i,r){super(e,i,r.selfEl);this.item=r}static registerEvents(e,i,r){return new rg(e,i,r)}getDest(){return this.item.item.dest}useModifierKey(){return this.plugin.settings.clickOutlineItemWithModifierKey}shouldShowHoverPopover(){return this.plugin.settings.popoverPreviewOnOutlineHover}shouldRecordHistory(){return this.plugin.settings.recordHistoryOnOutlineClick&&!this.child.opts.isEmbed}},Qi=rg;Qi.HOVER_LINK_SOURCE_ID="pdf-plus-outline";var og=class extends xh{static registerEvents(t,e){return new og(t,e,e.pdfViewer.pdfThumbnailViewer.container)}async getLinkText(t){var r,o;let e=wt(t,t.target)&&t.target.closest('.pdf-thumbnail-view > a[href^="#page="]');if(!e)return null;let i=e.getAttribute("href");return((o=(r=this.file)==null?void 0:r.path)!=null?o:"")+i}useModifierKey(){return this.plugin.settings.clickThumbnailWithModifierKey}shouldShowHoverPopover(){return this.plugin.settings.popoverPreviewOnThumbnailHover}shouldRecordHistory(){return this.plugin.settings.recordHistoryOnThumbnailClick&&!this.child.opts.isEmbed}},_i=og;_i.HOVER_LINK_SOURCE_ID="pdf-plus-thumbnail";var vh=class extends de{constructor(e,i,r){super(e);this.child=i,this.annot=r}get hoverPopover(){return this.child.hoverPopover}set hoverPopover(e){this.child.hoverPopover=e}get hoverLinkSourceId(){return vh.HOVER_LINK_SOURCE_ID}onload(){this.settings.popoverPreviewOnExternalLinkHover&&this.registerDomEvent(this.annot.container,"mouseover",e=>{let i=this.annot.data.url;i&&(i.startsWith("http://")||i.startsWith("https://"))&&this.app.workspace.trigger("hover-link",{event:e,source:this.hoverLinkSourceId,hoverParent:this,targetEl:this.annot.container,linktext:i})})}static registerEvents(e,i,r){var o;return r.data.subtype==="Link"&&r.data.url?(o=i.component)==null?void 0:o.addChild(new vh(e,i,r)):null}},Vn=vh;Vn.HOVER_LINK_SOURCE_ID="pdf-plus-external-link";var SP={highlight:"Highlight",underline:"Underline"},TP={open:"Open backlink",preview:"Popover preview of backlink"},Fh={"":"Current tab",tab:"New tab",right:"Split right",left:"Split left",down:"Split down",up:"Split up",window:"New window","right-sidebar":"Right sidebar","left-sidebar":"Left sidebar"},Dx={"last-paste":"Last pasted .md","last-active":"Last active .md","last-active-and-open":"Last active & open .md","last-paste-then-last-active":"Last pasted .md if any, otherwise last active .md","last-paste-then-last-active-and-open":"Last pasted .md if any, otherwise last active & open .md","last-active-and-open-then-last-paste":"Last active & open .md if any, otherwise last pasted .md"},CP={root:"Vault folder",current:"Same folder as current file",folder:"In the folder specified below"},Sx={root:"Vault folder",current:"Same folder as current file",folder:"In the folder specified below",subfolder:"In subfolder under current folder",obsidian:"Same as Obsidian's attachment location"},EP=["png","jpg","webp","bmp"],Cx="green",sg={none:"Same as other internal links","pdf-plus-bib-popover":"PDF++'s custom bibliography popover","google-scholar-popover":"Google Scholar popover"},AP={text:"Copy text",obsidian:"Obsidian default (copy as quote)","pdf-plus":"Run PDF++'s copy command"},Hn={displayTextFormats:[{name:"Title & page",template:"{{file.basename}}, p.{{pageLabel}}"},{name:"Page",template:"p.{{pageLabel}}"},{name:"Text",template:"{{text}}"},{name:"Emoji",template:"\u{1F4D6}"},{name:"None",template:""}],defaultDisplayTextFormatIndex:0,syncDisplayTextFormat:!0,syncDefaultDisplayTextFormat:!1,copyCommands:[{name:"Quote",template:`> ({{linkWithDisplay}}) +> {{selection}} +`},{name:"Link",template:"{{linkWithDisplay}}"},{name:"Embed",template:"!{{link}}"},{name:"Callout",template:`> [!{{calloutType}}|{{color}}] {{linkWithDisplay}} +> {{text}} +`},{name:"Quote in callout",template:`> [!{{calloutType}}|{{color}}] {{linkWithDisplay}} +> > {{text}} +> +> `}],useAnotherCopyTemplateWhenNoSelection:!1,copyTemplateWhenNoSelection:"{{linkToPageWithDisplay}}",trimSelectionEmbed:!1,embedMargin:50,noSidebarInEmbed:!0,noSpreadModeInEmbed:!0,embedUnscrollable:!1,singleTabForSinglePDF:!0,highlightExistingTab:!1,existingTabHighlightOpacity:.5,existingTabHighlightDuration:.75,paneTypeForFirstPDFLeaf:"left",openLinkNextToExistingPDFTab:!0,openPDFWithDefaultApp:!1,openPDFWithDefaultAppAndObsidian:!0,focusObsidianAfterOpenPDFWithDefaultApp:!0,syncWithDefaultApp:!1,dontActivateAfterOpenPDF:!0,dontActivateAfterOpenMD:!0,highlightDuration:.75,noTextHighlightsInEmbed:!1,noAnnotationHighlightsInEmbed:!0,persistentTextHighlightsInEmbed:!0,persistentAnnotationHighlightsInEmbed:!1,highlightBacklinks:!0,selectionBacklinkVisualizeStyle:"highlight",dblclickEmbedToOpenLink:!0,highlightBacklinksPane:!0,highlightOnHoverBacklinkPane:!0,backlinkHoverColor:"",colors:{Yellow:"#ffd000",Red:"#ea5252",Note:"#086ddd",Important:"#bb61e5"},defaultColor:"",defaultColorPaletteItemIndex:0,syncColorPaletteItem:!0,syncDefaultColorPaletteItem:!1,colorPaletteInToolbar:!0,noColorButtonInColorPalette:!0,colorPaletteInEmbedToolbar:!1,quietColorPaletteTooltip:!1,showStatusInToolbar:!0,highlightColorSpecifiedOnly:!1,doubleClickHighlightToOpenBacklink:!0,hoverHighlightAction:"preview",paneTypeForFirstMDLeaf:"right",singleMDLeafInSidebar:!0,alwaysUseSidebar:!0,ignoreExistingMarkdownTabIn:[],defaultColorPaletteActionIndex:4,syncColorPaletteAction:!0,syncDefaultColorPaletteAction:!1,proxyMDProperty:"PDF",hoverPDFLinkToOpen:!1,ignoreHeightParamInPopoverPreview:!0,filterBacklinksByPageDefault:!0,showBacklinkToPage:!0,enableHoverPDFInternalLink:!0,recordPDFInternalLinkHistory:!0,alwaysRecordHistory:!0,renderMarkdownInStickyNote:!1,enablePDFEdit:!1,author:"",writeHighlightToFileOpacity:.2,defaultWriteFileToggle:!1,syncWriteFileToggle:!0,syncDefaultWriteFileToggle:!1,enableAnnotationDeletion:!0,warnEveryAnnotationDelete:!1,warnBacklinkedAnnotationDelete:!0,enableAnnotationContentEdit:!0,enableEditEncryptedPDF:!1,pdfLinkColor:"#04a802",pdfLinkBorder:!1,replaceContextMenu:!0,showContextMenuOnMouseUpIf:"Mod",contextMenuConfig:[{id:"action",visible:!0},{id:"selection",visible:!0},{id:"write-file",visible:!0},{id:"annotation",visible:!0},{id:"modify-annotation",visible:!0},{id:"link",visible:!0},{id:"text",visible:!0},{id:"search",visible:!0},{id:"speech",visible:!0},{id:"page",visible:!0},{id:"settings",visible:!0}],selectionProductMenuConfig:["color","copy-format","display"],writeFileProductMenuConfig:["color","copy-format","display"],annotationProductMenuConfig:["copy-format","display"],updateColorPaletteStateFromContextMenu:!0,mobileCopyAction:"pdf-plus",showContextMenuOnTablet:!1,executeBuiltinCommandForOutline:!0,executeBuiltinCommandForZoom:!0,executeFontSizeAdjusterCommand:!0,closeSidebarWithShowCommandIfExist:!0,autoHidePDFSidebar:!1,defaultSidebarView:1,outlineDrag:!0,outlineContextMenu:!0,outlineLinkDisplayTextFormat:"{{file.basename}}, {{text}}",outlineLinkCopyFormat:"{{linkWithDisplay}}",recordHistoryOnOutlineClick:!0,popoverPreviewOnOutlineHover:!0,thumbnailDrag:!0,thumbnailContextMenu:!0,thumbnailLinkDisplayTextFormat:"{{file.basename}}, p.{{pageLabel}}",thumbnailLinkCopyFormat:"{{linkWithDisplay}}",recordHistoryOnThumbnailClick:!0,popoverPreviewOnThumbnailHover:!0,annotationPopupDrag:!0,showAnnotationPopupOnHover:!0,useCallout:!0,calloutType:"PDF",calloutIcon:"highlighter",highlightBacklinksInEmbed:!1,highlightBacklinksInHoverPopover:!1,highlightBacklinksInCanvas:!0,clickPDFInternalLinkWithModifierKey:!0,clickOutlineItemWithModifierKey:!0,clickThumbnailWithModifierKey:!0,focusEditorAfterAutoPaste:!0,clearSelectionAfterAutoPaste:!0,respectCursorPositionWhenAutoPaste:!0,autoCopy:!1,autoFocus:!1,autoPaste:!1,autoFocusTarget:"last-active-and-open-then-last-paste",autoPasteTarget:"last-active-and-open-then-last-paste",openAutoFocusTargetIfNotOpened:!0,howToOpenAutoFocusTargetIfNotOpened:"right",closeHoverEditorWhenLostFocus:!0,closeSidebarWhenLostFocus:!1,openAutoFocusTargetInEditingView:!0,executeCommandWhenTargetNotIdentified:!0,commandToExecuteWhenTargetNotIdentified:"switcher:open",autoPasteTargetDialogTimeoutSec:20,autoCopyToggleRibbonIcon:!0,autoCopyIconName:"highlighter",autoFocusToggleRibbonIcon:!0,autoFocusIconName:"zap",autoPasteToggleRibbonIcon:!0,autoPasteIconName:"clipboard-paste",viewSyncFollowPageNumber:!0,viewSyncPageDebounceInterval:.3,openAfterExtractPages:!0,howToOpenExtractedPDF:"tab",warnEveryPageDelete:!1,warnBacklinkedPageDelete:!0,extractPageInPlace:!1,askExtractPageInPlace:!0,pageLabelUpdateWhenInsertPage:"keep",pageLabelUpdateWhenDeletePage:"keep",pageLabelUpdateWhenExtractPage:"keep",askPageLabelUpdateWhenInsertPage:!0,askPageLabelUpdateWhenDeletePage:!0,askPageLabelUpdateWhenExtractPage:!0,copyOutlineAsListFormat:"{{linkWithDisplay}}",copyOutlineAsListDisplayTextFormat:"{{text}}",copyOutlineAsHeadingsFormat:`{{text}} + +{{linkWithDisplay}}`,copyOutlineAsHeadingsDisplayTextFormat:"p.{{pageLabel}}",copyOutlineAsHeadingsMinLevel:2,newFileNameFormat:"",newFileTemplatePath:"",newPDFLocation:"current",newPDFFolderPath:"",rectEmbedStaticImage:!1,rectImageFormat:"file",rectImageExtension:"webp",zoomToFitRect:!1,rectEmbedResolution:100,includeColorWhenCopyingRectLink:!0,backlinkIconSize:50,showBacklinkIconForSelection:!1,showBacklinkIconForAnnotation:!1,showBacklinkIconForOffset:!0,showBacklinkIconForRect:!1,showBoundingRectForBacklinkedAnnot:!1,hideReplyAnnotation:!1,searchLinkHighlightAll:"true",searchLinkCaseSensitive:"true",searchLinkMatchDiacritics:"default",searchLinkEntireWord:"false",dontFitWidthWhenOpenPDFLink:!0,preserveCurrentLeftOffsetWhenOpenPDFLink:!1,defaultZoomValue:"page-width",scrollModeOnLoad:0,spreadModeOnLoad:0,hoverableDropdownMenuInToolbar:!0,zoomLevelInputBoxInToolbar:!0,popoverPreviewOnExternalLinkHover:!0,actionOnCitationHover:"pdf-plus-bib-popover",anystylePath:"",enableBibInEmbed:!1,enableBibInHoverPopover:!1,enableBibInCanvas:!0,copyAsSingleLine:!0,removeWhitespaceBetweenCJChars:!0,dummyFileFolderPath:"",externalURIPatterns:[".*\\.pdf$","https://arxiv.org/pdf/.*"],modifierToDropExternalPDFToCreateDummy:["Shift"],vim:!1,vimrcPath:"",vimVisualMotion:!0,vimScrollSize:40,vimLargerScrollSizeWhenZoomIn:!0,vimContinuousScrollSpeed:1.2,vimSmoothScroll:!0,vimHlsearch:!0,vimIncsearch:!0,enableVimInContextMenu:!0,enableVimOutlineMode:!0,vimSmoothOutlineMode:!0,vimHintChars:"hjklasdfgyuiopqwertnmzxcvb",vimHintArgs:"all",PATH:""};function IP(n){return Hn.hasOwnProperty(n)}var Bn=fi("Mod").toLowerCase(),Ph=class extends re.PluginSettingTab{constructor(e){super(e.app,e);this.plugin=e;this.events=new re.Events;this.component=new re.Component,this.items={},this.headings=new Map,this.iconHeadings=new Map,this.headerEls=new Map,this.promises=[],this.containerEl.addClass("pdf-plus-settings"),this.headerContainerEl=this.containerEl.createDiv("header-container"),this.contentEl=this.containerEl.createDiv("content")}addSetting(e){let i=new re.Setting(this.contentEl);return e&&(this.items[e]=i,this.component.registerDomEvent(i.settingEl,"contextmenu",r=>{r.preventDefault(),new ag.Menu().addItem(o=>{o.setTitle("Restore default value of this setting").setIcon("lucide-undo-2").onClick(async()=>{this.plugin.settings[e]=this.plugin.getDefaultSettings()[e],await this.plugin.saveSettings(),this.redisplay(),new re.Notice(`${this.plugin.manifest.name}: Default setting restored. Note that some options require a restart to take effect.`,6e3)})}).addItem(o=>{o.setTitle("Copy link to this setting").setIcon("lucide-link").onClick(()=>{navigator.clipboard.writeText(`obsidian://pdf-plus?setting=${e}`)})}).showAtMouseEvent(r)})),i}addHeading(e,i,r,o){let s=this.addSetting().setName(e).setHeading().then(a=>{if(r){let c=a.settingEl.parentElement;c&&c.insertBefore(createDiv("spacer"),a.settingEl);let l=createDiv();a.settingEl.prepend(l),(0,re.setIcon)(l,r),a.settingEl.addClass("pdf-plus-setting-heading")}});return this.headings.set(i,s),this.component.registerDomEvent(s.settingEl,"contextmenu",a=>{a.preventDefault(),new ag.Menu().addItem(c=>{c.setTitle("Copy link to this heading").setIcon("lucide-link").onClick(()=>{navigator.clipboard.writeText(`obsidian://pdf-plus?setting=heading:${i}`)})}).showAtMouseEvent(a)}),r&&this.headerContainerEl.createDiv("clickable-icon header",a=>{let c=a.createDiv();(0,re.setIcon)(c,r);let l=a.createDiv("header-title");l.setText(e),(0,re.setTooltip)(a,e),this.component.registerDomEvent(a,"click",d=>{var h;((h=s.settingEl.previousElementSibling)!=null?h:s.settingEl).scrollIntoView({behavior:"smooth"}),this.updateHeaderElClassOnScroll(d)}),o==null||o({headerEl:a,iconEl:c,titleEl:l}),this.iconHeadings.set(i,s),this.headerEls.set(i,a)}),s}updateHeaderElClass(){var r,o,s;let e=this.containerEl.getBoundingClientRect().height,i=Array.from(this.iconHeadings.entries());for(let a=0;a=e*.2+this.headerContainerEl.clientHeight,h=i[a][0];(s=this.headerEls.get(h))==null||s.toggleClass("is-active",d)}}updateHeaderElClassOnScroll(e){var o;let i=(o=e==null?void 0:e.win)!=null?o:activeWindow,r=i.setInterval(()=>this.updateHeaderElClass(),50);i.setTimeout(()=>i.clearInterval(r),1500)}scrollTo(e,i){let r=this.items[e];r&&this.scrollToSetting(r,i)}scrollToHeading(e,i){let r=this.headings.get(e);r&&this.scrollToSetting(r,i)}scrollToSetting(e,i){let r=e.settingEl;r&&this.containerEl.scrollTo({top:r.offsetTop-this.headerContainerEl.offsetHeight,...i})}openFromObsidianUrl(e){let i=e.setting;i.startsWith("heading:")?this.plugin.openSettingTab().scrollToHeading(i.slice(8)):IP(i)&&this.plugin.openSettingTab().scrollTo(i)}getVisibilityToggler(e,i){let r=()=>{i()?e.settingEl.show():e.settingEl.hide()};return r(),r}showConditionally(e,i){let r=Array.isArray(e)?e:[e],o=r.map(s=>this.getVisibilityToggler(s,i));return this.events.on("update",()=>o.forEach(s=>s())),r}addTextSetting(e,i,r){let o=this.addSetting(e).addText(s=>{s.setValue(this.plugin.settings[e]).setPlaceholder(i!=null?i:"").then(a=>{i&&(a.inputEl.size=Math.max(a.inputEl.size,a.inputEl.placeholder.length))}).onChange(async a=>{this.plugin.settings[e]=a,await this.plugin.saveSettings()}),r&&(this.component.registerDomEvent(s.inputEl,"blur",()=>{r(o)}),this.component.registerDomEvent(s.inputEl,"keypress",a=>{a.key==="Enter"&&r(o)}))});return o}addTextAreaSetting(e,i,r){return this.addSetting(e).addTextArea(o=>{o.setValue(this.plugin.settings[e]).setPlaceholder(i!=null?i:"").onChange(async s=>{this.plugin.settings[e]=s,await this.plugin.saveSettings()}),r&&this.component.registerDomEvent(o.inputEl,"blur",r)})}addNumberSetting(e){return this.addSetting(e).addText(i=>{i.setValue(""+this.plugin.settings[e]).setPlaceholder(""+Hn[e]).then(r=>r.inputEl.type="number").onChange(async r=>{this.plugin.settings[e]=r===""?Hn[e]:+r,await this.plugin.saveSettings()})})}addToggleSetting(e,i){return this.addSetting(e).addToggle(r=>{r.setValue(this.plugin.settings[e]).onChange(async o=>{this.plugin.settings[e]=o,await this.plugin.saveSettings(),i==null||i(o)})})}addColorPickerSetting(e,i){return this.addSetting(e).addColorPicker(r=>{r.setValue(this.plugin.settings[e]).onChange(async o=>{this.plugin.settings[e]=o,await this.plugin.saveSettings(),i==null||i(o)})})}addDropdownSetting(e,...i){let r=[],o=a=>a,s=a=>{};return Array.isArray(i[0])?(r=i[0],typeof i[1]=="function"&&(o=i[1]),typeof i[2]=="function"&&(s=i[2])):(r=Object.keys(i[0]),o=a=>i[0][a],typeof i[1]=="function"&&(s=i[1])),this.addSetting(e).addDropdown(a=>{var c;for(let l of r){let d=(c=o(l))!=null?c:l;a.addOption(l,d)}a.setValue(this.plugin.settings[e]).onChange(async l=>{this.plugin.settings[e]=l,await this.plugin.saveSettings(),s==null||s(l)})})}addIndexDropdownSetting(e,i,r,o){return this.addSetting(e).addDropdown(s=>{var l;for(let d of i){let h=(l=r==null?void 0:r(d))!=null?l:d;s.addOption(d,h)}let a=this.plugin.settings[e],c=i[a];s.setValue(c).onChange(async d=>{let h=i.indexOf(d);h!==-1&&(this.plugin.settings[e]=h,await this.plugin.saveSettings(),o==null||o(h))})})}addEnumDropdownSetting(e,i,r){return this.addSetting(e).addDropdown(o=>{for(let[s,a]of Object.entries(i))parseInt(s).toString()===s&&o.addOption(s,a);o.setValue(""+this.plugin.settings[e]).onChange(async s=>{this.plugin.settings[e]=+s,await this.plugin.saveSettings(),r==null||r(+s)})})}addSliderSetting(e,i,r,o){return this.addSetting(e).addSlider(s=>{s.setLimits(i,r,o).setValue(this.plugin.settings[e]).setDynamicTooltip().onChange(async a=>{this.plugin.settings[e]=a,await this.plugin.saveSettings()})})}addDesc(e){return this.addSetting().setDesc(e)}addFileLocationSetting(e,i,r,o){return[this.addDropdownSetting(e,CP,()=>this.redisplay()).then(i),this.addSetting().addText(s=>{s.setValue(this.plugin.settings[r]),s.inputEl.size=30,new xr(this.app,s.inputEl).onSelect(({item:a})=>{this.plugin.settings[r]=a.path,this.plugin.saveSettings()})}).then(s=>{o(s),this.plugin.settings[e]!=="folder"&&s.settingEl.hide()})]}addAttachmentLocationSetting(e,i,r){let o,s,a,c=()=>{let p=o.getValue();u.settingEl.toggle(p==="folder"),f.settingEl.toggle(p==="subfolder")},l=()=>{let p=o.getValue();return p==="root"?"/":p==="folder"?s.getValue()||i:p==="current"?"./":p==="subfolder"?"./"+(a.getValue()||i):""},d=p=>{if(p===""){o.setValue("obsidian");return}if(p==="/"){o.setValue("root");return}if(p!=="."&&p!=="./"){if(p.startsWith("./")){let g=p.slice(2);o.setValue("subfolder"),a.setValue(g!==i?g:"");return}o.setValue("folder"),s.setValue(p!==i?i:"");return}o.setValue("current")},h=this.addSetting(e).addDropdown(p=>{p.onChange(async()=>{c(),this.plugin.settings[e]=l(),await this.plugin.saveSettings()}),p.addOptions(Sx),o=p}),u=this.addSetting().addText(p=>{p.setPlaceholder(i).onChange(async()=>{this.plugin.settings[e]=l(),await this.plugin.saveSettings()}),new xr(this.app,p.inputEl),s=p}),f=this.addSetting().addText(p=>{p.setPlaceholder(i).onChange(async()=>{this.plugin.settings[e]=l(),await this.plugin.saveSettings()}),a=p});r(h,u,f),d(this.plugin.settings[e]),c()}addFundingButton(){let e=i=>{let r=i.firstElementChild;(r==null?void 0:r.tagName)==="svg"&&(r.setAttribute("fill","var(--color-red)"),r.setAttribute("stroke","var(--color-red)"))};return this.addHeading("Support development","funding","lucide-heart",({iconEl:i})=>e(i)).setDesc(`If you find PDF++ helpful, please consider supporting the development to help me keep this plugin alive. + +If you prefer PayPal, please make donations via Ko-fi. Thank you!`).then(i=>{let r=i.infoEl,o=i.settingEl.firstElementChild;if(!o)return;let s=i.settingEl.createDiv();s.appendChild(o),s.appendChild(r),i.settingEl.prepend(s),i.settingEl.id="pdf-plus-funding",s.id="pdf-plus-funding-icon-info-container",o.id="pdf-plus-funding-icon",e(o)}).addButton(i=>{i.setButtonText("GitHub Sponsors").onClick(()=>{open("https://github.com/sponsors/RyotaUshio")})}).addButton(i=>{i.setButtonText("Buy Me a Coffee").onClick(()=>{open("https://www.buymeacoffee.com/ryotaushio")})}).addButton(i=>{i.setButtonText("Ko-fi").onClick(()=>{open("https://ko-fi.com/ryotaushio")})})}async renderMarkdown(e,i){this.promises.push(this._renderMarkdown(e,i)),i.addClass("markdown-rendered")}async _renderMarkdown(e,i){await re.MarkdownRenderer.render(this.app,Array.isArray(e)?e.join(` +`):e,i,"",this.component),i.childNodes.length===1&&i.firstChild instanceof HTMLParagraphElement&&i.replaceChildren(...i.firstChild.childNodes)}addColorSetting(e){let i=this.plugin.settings.colors,[r,o]=Object.entries(i)[e],s=this.plugin.settings.defaultColor===r,a=o;return this.addSetting().addText(c=>{c.setPlaceholder("Color name (case-insensitive)").then(l=>{l.inputEl.size=l.inputEl.placeholder.length,(0,re.setTooltip)(l.inputEl,"Color name (case-insensitive)")}).setValue(r).onChange(async l=>{if(l in i){new re.Notice("This color name is already used."),c.inputEl.addClass("error");return}c.inputEl.removeClass("error"),delete i[r];for(let d of["defaultColor","backlinkHoverColor"]){let h=this.items[d];if(h){let u=h.components[0].selectEl.querySelector(`:scope > option:nth-child(${e+2})`);u&&(u.value=l,u.textContent=l)}}r=l,i[r]=o,s&&(this.plugin.settings.defaultColor=r),await this.plugin.saveSettings(),this.plugin.loadStyle()})}).addColorPicker(c=>{c.setValue(o),c.onChange(async l=>{a=o,o=l,i[r]=o,await this.plugin.saveSettings(),this.plugin.loadStyle()})}).addExtraButton(c=>{c.setIcon("rotate-ccw").setTooltip("Return to previous color").onClick(async()=>{o=a,i[r]=o,await this.plugin.saveSettings(),this.plugin.loadStyle(),this.redisplay()})}).addExtraButton(c=>{c.setIcon("trash").setTooltip("Delete").onClick(async()=>{this.plugin.settings.defaultColor===r&&(this.plugin.settings.defaultColor=""),delete i[r],await this.plugin.saveSettings(),this.plugin.loadStyle(),this.redisplay()})})}addNameValuePairListSetting(e,i,r,o,s){let{getName:a,setName:c,getValue:l,setValue:d}=o,h=e[i],u=a(h),f=l(h);return this.addSetting().addText(p=>{p.setPlaceholder(s.name.placeholder).then(g=>{g.inputEl.size=s.name.formSize,(0,re.setTooltip)(g.inputEl,s.name.placeholder)}).setValue(u).onChange(async g=>{if(e.some(b=>a(b)===g)){new re.Notice(s.name.duplicateMessage),p.inputEl.addClass("error");return}p.inputEl.removeClass("error"),c(h,g);let m=this.items[r];if(m){let b=m.components[0].selectEl.querySelector(`:scope > option:nth-child(${i+1})`);b&&(b.value=g,b.textContent=g)}await this.plugin.saveSettings()})}).then(p=>{s.value.hasOwnProperty("formRows")?p.addTextArea(g=>{g.setPlaceholder(s.value.placeholder).then(m=>{m.inputEl.rows=s.value.formRows,m.inputEl.cols=s.value.formSize,(0,re.setTooltip)(m.inputEl,s.value.placeholder)}).setValue(f).onChange(async m=>{d(h,m),await this.plugin.saveSettings()})}):p.addText(g=>{g.setPlaceholder(s.value.placeholder).then(m=>{m.inputEl.size=s.value.formSize,(0,re.setTooltip)(m.inputEl,s.value.placeholder)}).setValue(f).onChange(async m=>{d(h,m),await this.plugin.saveSettings()})})}).addExtraButton(p=>{p.setIcon("trash").setTooltip("Delete").onClick(async()=>{if(e.length===1){new re.Notice(s.delete.deleteLastMessage);return}e.splice(i,1),this.plugin.settings[r]>i?this.plugin.settings[r]--:this.plugin.settings[r]===i&&(this.plugin.settings[r]=0),await this.plugin.saveSettings(),this.redisplay()})}).setClass("no-border")}addNamedTemplatesSetting(e,i,r,o){return this.addNameValuePairListSetting(e,i,r,{getName:s=>s.name,setName:(s,a)=>{s.name=a},getValue:s=>s.template,setValue:(s,a)=>{s.template=a}},o)}addDisplayTextSetting(e){return this.addNamedTemplatesSetting(this.plugin.settings.displayTextFormats,e,"defaultDisplayTextFormatIndex",{name:{placeholder:"Format name",formSize:30,duplicateMessage:"This format name is already used."},value:{placeholder:"Display text format",formSize:50},delete:{deleteLastMessage:"You cannot delete the last display text format."}})}addCopyCommandSetting(e){return this.addNamedTemplatesSetting(this.plugin.settings.copyCommands,e,"defaultColorPaletteActionIndex",{name:{placeholder:"Format name",formSize:30,duplicateMessage:"This format name is already used."},value:{placeholder:"Copied text format",formSize:50,formRows:3},delete:{deleteLastMessage:"You cannot delete the last copy format."}})}addHotkeySettingButton(e,i){e.addButton(r=>{r.setButtonText("Open hotkeys settings").onClick(()=>{this.plugin.openHotkeySettingTab(i)})})}addPagePreviewSettingButton(e){return e.addButton(i=>{i.setButtonText("Open page preview settings").onClick(()=>{this.app.setting.openTabById("page-preview")})})}addRequireModKeyOnHoverSetting(e){let i=this.app.workspace.hoverLinkSources[e].display,r=this.plugin.requireModKeyForLinkHover(e);return this.addSetting().setName(`Require ${Bn} key while hovering`).setDesc(`Currently ${r?"required":"not required"}. You can toggle this on and off in the core Page Preview plugin settings > ${i}.`).then(o=>this.addPagePreviewSettingButton(o))}addIconSetting(e,i){let r=a=>a.startsWith("lucide-")?a.slice(7):a,o=a=>a.startsWith("lucide-")?a:"lucide-"+a,s=a=>{var d;let c=(d=a.controlEl.querySelector(":scope>.icon-preview"))!=null?d:a.controlEl.createDiv("icon-preview");(0,re.setIcon)(c,o(this.plugin.settings[e]));let l=a.components[0];(!i||this.plugin.settings[e])&&!c.childElementCount?(l.inputEl.addClass("error"),(0,re.setTooltip)(l.inputEl,"No icon found")):(l.inputEl.removeClass("error"),(0,re.setTooltip)(l.inputEl,""))};return this.addTextSetting(e,void 0,a=>{this.plugin.settings[e]=r(this.plugin.settings[e]),this.plugin.saveSettings(),s(a)}).then(a=>{this.renderMarkdown(["You can use any icon from [Lucide](https://lucide.dev/icons)."+(i?" Leave blank to remove icons.":"")],a.descEl)}).then(s)}addProductMenuSetting(e,i){let r=Hn[e],o={color:"Colors","copy-format":"Copy format",display:"Display text format"},s=this.plugin.settings[e],a=this.addHeading(i,e);a.addExtraButton(d=>{d.setTooltip("Reset").setIcon("rotate-ccw").onClick(()=>{s.length=0,s.push(...r),this.redisplay()})});let c=[],l=r.slice();for(let d=0;d0){if(!re.Platform.isDesktopApp)return;let h=c[d-1].getValue();if(!h)return;l.remove(h)}this.addSetting().then(h=>{re.Platform.isDesktopApp&&h.setName(d===0?"Top-level menu":d===1?"Submenu":"Subsubmenu")}).addDropdown(h=>{var f;for(let p of l)h.addOption(p,o[p]);d>0&&h.addOption("","None");let u=(f=s[d])!=null?f:"";u&&!l.includes(u)&&l[0]&&(s[d]=l[0],u=s[d]),h.setValue(u).onChange(p=>{if(p)s[d]=p;else for(;s.length>d;)s.pop();this.plugin.saveSettings(),this.redisplay()}),c.push(h)}).then(h=>{h.settingEl.addClasses(["no-border","small-padding"])})}return a}createLinkTo(e,i){return createEl("a","",r=>{r.onclick=o=>{this.scrollTo(e,{behavior:"smooth"}),this.updateHeaderElClassOnScroll(o)},activeWindow.setTimeout(()=>{let o=this.items[e];!i&&o&&(i='"'+o.nameEl.textContent+'"'),r.setText(i!=null?i:"")})})}createLinkToHeading(e,i){return createEl("a","",r=>{r.onclick=o=>{this.scrollToHeading(e,{behavior:"smooth"}),this.updateHeaderElClassOnScroll(o)},activeWindow.setTimeout(()=>{let o=this.headings.get(e);!i&&o&&(i='"'+o.nameEl.textContent+'"'),r.setText(i!=null?i:"")})})}redisplay(){let e=this.contentEl.scrollTop;this.display(),this.contentEl.scroll({top:e}),this.events.trigger("update")}async display(){var c,l;kr.openIfNecessary(this.plugin),this.headerContainerEl.empty(),this.contentEl.empty(),this.promises=[],this.component.load(),activeWindow.setTimeout(()=>this.updateHeaderElClass());for(let d of["wheel","touchmove"])this.component.registerDomEvent(this.contentEl,d,(0,re.debounce)(()=>this.updateHeaderElClass(),100),{passive:!0});this.contentEl.createDiv("top-note",async d=>{await this.renderMarkdown(["> [!TIP]","> - You can easily navigate through the settings by clicking the icons in the header above.","> - Some settings below require reopening tabs or reloading the plugin to take effect.","> - [Visit the docs](https://ryotaushio.github.io/obsidian-pdf-plus/)",'> -
    '],d);let h=document.getElementById("pdf-plus-funding-link-placeholder");h&&(h.textContent="Help me keep PDF++ alive!",h.onclick=u=>{this.scrollToHeading("funding",{behavior:"smooth"}),this.updateHeaderElClassOnScroll(u)})}),this.addHeading("Editing PDF files","edit","lucide-save").then(d=>{this.renderMarkdown(["By allowing PDF++ to modify PDF files directly, you can:","- Add, edit and delete highlights and links in PDF files.","- Add, insert, delete or extract PDF pages and auto-update links.","- Add, rename, move and delete outline items.","- Edit [page labels](https://ryotaushio.github.io/obsidian-pdf-plus/page-labels.html).","","[Learn more](https://ryotaushio.github.io/obsidian-pdf-plus/editing-pdfs.html)"],d.descEl)}),this.addToggleSetting("enablePDFEdit",()=>this.redisplay()).setName("Enable PDF editing").then(d=>{this.renderMarkdown(['PDF++ will not modify PDF files themselves unless you turn on this option. The author assumes no responsibility for any data corruption. Please make sure you have a backup of your files.'],d.descEl)}),this.plugin.settings.enablePDFEdit&&(this.addTextSetting("author","Your name",d=>{let h=d.components[0].inputEl;h.toggleClass("error",!h.value)}).setName("Annotation author").setDesc("It must contain at least one character in order to make annotations referenceable & editable within Obsidian.").then(d=>{let h=d.components[0].inputEl;h.toggleClass("error",!h.value)}),this.addToggleSetting("enableEditEncryptedPDF").setName("Enable editing encrypted PDF files")),this.addHeading("Backlink highlighting","backlink-highlight","lucide-highlighter").setDesc('Annotate PDF files with highlights just by linking to text selection. You can easily copy links to selections using color palette in the toolbar. See the "Color palette" section for the details.').then(d=>d.settingEl.addClass("normal-margin-top")),this.addToggleSetting("highlightBacklinks").setName("Highlight backlinks in PDF viewer").setDesc("In the PDF viewer, any referenced text will be highlighted for easy identification."),this.addDesc("Try turning off the following options if you experience performance issues."),this.addToggleSetting("highlightBacklinksInEmbed").setName("Highlight backlinks in PDF embeds"),this.addToggleSetting("highlightBacklinksInCanvas").setName("Highlight backlinks in Canvas"),this.addToggleSetting("highlightBacklinksInHoverPopover").setName("Highlight backlinks in hover popover previews"),this.addDropdownSetting("selectionBacklinkVisualizeStyle",SP).setName("Highlight style").setDesc("How backlinks to a text selection should be visualized."),this.addDropdownSetting("hoverHighlightAction",TP,()=>this.redisplay()).setName("Action when hovering over highlighted text").setDesc(`Easily open backlinks or display a popover preview of it by pressing ${fi("Mod").toLowerCase()} (by default) while hovering over a highlighted text in PDF viewer.`),this.addRequireModKeyOnHoverSetting("pdf-plus"),this.addToggleSetting("doubleClickHighlightToOpenBacklink").setName("Double click highlighted text to open the corresponding backlink"),this.addHeading("How backlinks are opened","open-backlink").setDesc("Customize how backlinks are opened when "+(this.plugin.settings.hoverHighlightAction==="open"?`${fi("Mod").toLowerCase()}+hovering over or `:"")+"double-clicking highlighted text."),this.addDropdownSetting("paneTypeForFirstMDLeaf",Fh,()=>this.redisplay()).setName("How to open the markdown file when no markdown file is opened"),(this.plugin.settings.paneTypeForFirstMDLeaf==="left-sidebar"||this.plugin.settings.paneTypeForFirstMDLeaf==="right-sidebar")&&(this.addToggleSetting("alwaysUseSidebar").setName("Always use sidebar to open markdown files from highlighted text").setDesc(`If turned on, the ${this.plugin.settings.paneTypeForFirstMDLeaf==="left-sidebar"?"left":"right"} sidebar will be used whether there is existing markdown tabs or not.`),this.addToggleSetting("singleMDLeafInSidebar").setName("Don't open multiple panes in sidebar").setDesc("Turn this on if you want to open markdown files in a single pane in the sidebar.")),this.addSetting("ignoreExistingMarkdownTabIn").setName("Ignore existing markdown tabs in...").setDesc("If some notes are opened in the ignored splits, PDF++ will still open the backlink in the way specified in the previous setting. For example, you might want to ignore the left sidebar if you are pinning a certain note (e.g. daily note) in it.");let e={leftSplit:"Left sidebar",rightSplit:"Right sidebar",floatingSplit:"Popout windows"},i=this.plugin.settings.ignoreExistingMarkdownTabIn;for(let[d,h]of Object.entries(e)){let u=d;this.addSetting().addToggle(f=>{f.setValue(i.includes(u)).onChange(p=>{p?i.push(u):i.remove(u),this.plugin.saveSettings()})}).then(f=>{f.controlEl.prepend(createEl("span",{text:h})),f.settingEl.addClasses(["no-border","ignore-split-setting"])})}this.addToggleSetting("dontActivateAfterOpenMD").setName("Don't move focus to markdown view after opening a backlink").setDesc("This option will be ignored when you open a link in a tab in the same split as the current tab."),this.addHeading("Colors","color"),this.addSetting("colors").setName("Highlight colors").then(d=>this.renderMarkdown(['You can optionally highlight the selection with **a specified color** by appending "&color=``" to a link text, where `` is one of the colors that you register below. e.g `[[file.pdf#page=1&selection=4,0,5,20&color=red]].` ',"Color names are case-insensitive. ","",'You can ues the color palette in PDF toolbars to easily copy links with "&color=..." appended automatically. See the "Color palette" section for the details.',"",'You can also opt not to use this plugin-dependent notation and apply a single color (the "default highlight color" setting) to all highlights.',"","These colors are also available as CSS variables, e.g. `--pdf-plus-yellow-rgb`. You can use them for various CSS customizations. See [README](https://github.com/RyotaUshio/obsidian-pdf-plus?tab=readme-ov-file#css-customization) for the details."],d.descEl)).addButton(d=>{d.setIcon("plus").setTooltip("Add a new color").onClick(()=>{this.plugin.settings.colors[""]="#",this.redisplay()})});for(let d=0;dd||"Obsidian default",()=>this.plugin.loadStyle()).setName("Default highlight color").setDesc("If no color is specified in link text, this color will be used."),this.addHeading("Backlink indicator bounding rectangles","backlink-bounding-rect"),this.addToggleSetting("showBoundingRectForBacklinkedAnnot").setName("Show bounding rectangles for backlinked annotations").setDesc("Bounding rectangles will be shown for annotations with backlinks."),this.addHeading("Backlink indicator icons","backlink-icon").setDesc("Show icons for text selections, annotations, offsets and rectangular selections with backlinks."),this.addToggleSetting("showBacklinkIconForSelection").setName("Show icon for text selection with backlinks"),this.addToggleSetting("showBacklinkIconForAnnotation").setName("Show icon for annotation with backlinks"),this.addToggleSetting("showBacklinkIconForOffset").setName("Show icon for offset backlinks"),this.addToggleSetting("showBacklinkIconForRect").setName("Show icon for rectangular selection backlinks"),this.addSliderSetting("backlinkIconSize",10,100,5).setName("Icon size"),this.addHeading("Rectangular selection embeds","rect","lucide-box-select").then(d=>{this.renderMarkdown(["You can embed a specified rectangular area from a PDF page into your note. [Learn more](https://ryotaushio.github.io/obsidian-pdf-plus/embedding-rectangular-selections.html)"],d.descEl)}),this.addSliderSetting("rectEmbedResolution",10,200,1).setName("Rendering resolution").setDesc("The higher the value, the better the rendering quality, but the longer time it takes to render. The default value is 100."),this.addToggleSetting("rectEmbedStaticImage",()=>this.redisplay()).setName("Paste as image").setDesc("By default, rectangular selection embeds are re-rendered every time you open the markdown file, which can slow down the loading time. Turn on this option to replace them with static images and improve the performance."),this.plugin.settings.rectEmbedStaticImage&&(this.addDropdownSetting("rectImageFormat",{file:"Create & embed image file","data-url":"Embed as data URL"},()=>this.redisplay()).setName("How to embed the image").then(d=>this.renderMarkdown(['- "Create & embed image file": Create an image file and embed it in the markdown file. The image file will be saved in the folder you specify in the "Default location for new attachments" setting in the core Obsidian settings.',`- "Embed as data URL": Embed the image as a [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs) without creating a file. This option is useful when you don't want to mess up your attachment folder. It also helps you make your notes self-contained.`],d.descEl)),this.plugin.settings.rectImageFormat==="file"&&this.addDropdownSetting("rectImageExtension",EP).setName("Image file format")),this.addToggleSetting("includeColorWhenCopyingRectLink").setName("Include the selected color's name when copying a link to a rectangular selection").setDesc("When enabled, the name of the color selected in the color palette will be included in the link text. As a result, the rectangular selection will be highlighted with the specified color in the PDF viewer."),this.addToggleSetting("zoomToFitRect").setName("Zoom to fit rectangular selection when opening link").setDesc(createFragment(d=>{d.appendText("When enabled, the PDF viewer will zoom to fit the rectangular selection when you open a link to it. Otherwise, the viewer will keep the current zoom level. "),d.appendText("Note: check out the "),d.appendChild(this.createLinkTo("dblclickEmbedToOpenLink")),d.appendText(" option as well.")})),this.addHeading("PDF++ callouts","callout","lucide-quote").then(d=>{this.renderMarkdown("Create [callouts](https://help.obsidian.md/Editing+and+formatting/Callouts) with the same color as the highlight color without any CSS snippet scripting.",d.descEl)}),this.addToggleSetting("useCallout").setName("Use PDF++ callouts").then(d=>{this.renderMarkdown(["You can also disable this option and choose to use your own custom [CSS snippets](https://help.obsidian.md/Extending+Obsidian/CSS+snippets). See our [README](https://github.com/RyotaUshio/obsidian-pdf-plus?tab=readme-ov-file#css-customization) for the details."],d.descEl)}),this.addTextSetting("calloutType",void 0,()=>this.redisplay()).setName("Callout type name").then(d=>{var f,p;let h=this.plugin.settings.calloutType,u=(p=(f=Object.keys(this.plugin.settings.colors).first())==null?void 0:f.toLowerCase())!=null?p:"yellow";this.renderMarkdown([`For example, if this is set to "${h}", use the following syntax to insert a callout with color "${u}":`,"","```markdown",`> [!${h}|${u}] Title`,"> Content","```","",'You can also use explicit RGB color values like "255, 208, 0" instead of color names.',"I recommend setting this as a custom color palette action in the setting below, like so:","","```markdown","> [!{{calloutType}}|{{color}}] {{linkWithDisplay}}","> {{text}}","```"],d.descEl)}),this.addIconSetting("calloutIcon",!0).setName("Callout icon"),this.addHeading("PDF toolbar","toolbar","lucide-palette"),this.addToggleSetting("hoverableDropdownMenuInToolbar").setName("Hoverable dropdown menus").setDesc("(Not supported on smartphones) When enabled, the dropdown menus (\u2304) in the PDF toolbar will be opened by hovering over the icon, and you don't need to click it."),this.addToggleSetting("zoomLevelInputBoxInToolbar").setName("Show zoom level box").setDesc("A input box will be added to the PDF toolbar, which indicated the current zoom level and allows you to set the zoom level by typing a number."),this.addHeading("Color palette","palette").setDesc('Clicking a color while selecting a range of text will copy a link to the selection with "&color=..." appended.'),this.addToggleSetting("colorPaletteInToolbar",()=>{this.redisplay(),this.plugin.loadStyle()}).setName("Show color palette in the toolbar").setDesc("A color palette will be added to the toolbar of the PDF viewer."),this.plugin.settings.colorPaletteInToolbar&&(this.addToggleSetting("noColorButtonInColorPalette",()=>this.plugin.loadStyle()).setName('Show "without specifying color" button in the color palette'),this.addToggleSetting("colorPaletteInEmbedToolbar",()=>this.plugin.loadStyle()).setName("Show color palette in PDF embeds as well"),this.addIndexDropdownSetting("defaultColorPaletteItemIndex",["",...Object.keys(this.plugin.settings.colors)],d=>d||"Don't specify").setName("Default color selected in color palette").setDesc("This color will be selected in the color palette in a newly opened PDF viewer."),this.addToggleSetting("syncColorPaletteItem",()=>this.redisplay()).setName("Share a single color among all color palettes").setDesc("If disabled, you can specify a different color for each color palette."),this.plugin.settings.syncColorPaletteItem&&this.addToggleSetting("syncDefaultColorPaletteItem").setName("Share the color with newly opened color palettes as well"),this.addToggleSetting("quietColorPaletteTooltip").setName("Quiet tooltips in color palette").setDesc(`When disabled${Hn.quietColorPaletteTooltip?"":" (default)"}, the tooltip will show the color name as well as the selected copy format and display text format. If enabled, only the color name will be shown.`)),this.addHeading("Viewer options","viewer-option","lucide-monitor"),this.addSetting("defaultZoomValue").setName("Default zoom level").addDropdown(d=>{d.addOptions({"page-width":"Fit width","page-height":"Fit height","page-fit":"Fit page",custom:"Custom..."}).setValue(this.plugin.settings.defaultZoomValue.startsWith("page-")?this.plugin.settings.defaultZoomValue:"custom").onChange(async h=>{h==="custom"&&(h="100"),this.plugin.settings.defaultZoomValue=h,r(),await this.plugin.saveSettings()})});let r=this.getVisibilityToggler(this.addSetting().setName("Custom zoom level (%)").addSlider(d=>{d.setLimits(10,400,5).setDynamicTooltip().setValue(this.plugin.settings.defaultZoomValue.startsWith("page-")?100:parseInt(this.plugin.settings.defaultZoomValue)).onChange(async h=>{this.plugin.settings.defaultZoomValue=""+h,await this.plugin.saveSettings()})}),()=>!this.plugin.settings.defaultZoomValue.startsWith("page-"));this.addEnumDropdownSetting("scrollModeOnLoad",{[0]:"Vertical",[1]:"Horizontal",[2]:"Wrapped"},()=>o()).setName("Default scroll mode");let o=this.getVisibilityToggler(this.addEnumDropdownSetting("spreadModeOnLoad",{[0]:"Single page",[1]:"Two page (odd)",[2]:"Two page (even)"}).setName("Default spread mode"),()=>this.plugin.settings.scrollModeOnLoad!==2);if(this.addHeading("Context menu in PDF viewer","context-menu","lucide-mouse-pointer-click").setDesc("(Desktop & tablet only) Customize the behavior of the context menu that pops up when you right-click in the PDF viewer. For mobile users, see also the next section."),this.addToggleSetting("replaceContextMenu",()=>this.redisplay()).setName("Replace the built-in context menu with PDF++'s custom menu"),!this.plugin.settings.replaceContextMenu)this.addSetting().setName("Display text format").setDesc('You can customize the display text format in the setting "Copied text foramt > Display text format" below.');else{this.addToggleSetting("showContextMenuOnTablet").setName("Show context menu on tablet devices as well").setDesc('By default, Obsidian does not show the context menu after text selection on mobile devices, including tablets (iPad, etc.). If you want to show the context menu on tablets, turn this option on. Even if this option is turned off, you copy select the OS-native "Copy" option to run the "'+this.plugin.lib.commands.stripCommandNamePrefix(this.plugin.lib.commands.getCommand("copy-link-to-selection").name)+'" command.');let d=Op();this.addDropdownSetting("showContextMenuOnMouseUpIf",{always:"Always",...Object.fromEntries(Object.entries(d).map(([h,u])=>[h,`${u} key is pressed`])),never:"Never"}).setName("Show the context menu right after selecting text when...").setDesc(createFragment(h=>{h.appendText("If "),h.appendChild(this.createLinkToHeading("auto-copy","auto-copy")),h.appendText(" is enabled, it will be prioritized and the context menu will not be shown.")}));{this.addHeading("Menu items","context-menu-items").setDesc("Customize which menu items to show.");let h={action:'Look up "(selection)"',selection:"Copy link to selection","write-file":`Add ${this.plugin.settings.selectionBacklinkVisualizeStyle} to file`,annotation:"Copy link to annotation","modify-annotation":"Edit/delete annotation",link:"Copy PDF link / Search on Google Scholar / Paste copied PDF link to selection / Copy URL",text:"Copy selected text / Copy annotated text",search:"Copy link to search",speech:"Read aloud selected text",page:"Copy link to page",settings:"Customize menu..."},u=this.plugin.settings.contextMenuConfig,f=[];for(let p=0;p{b.setValue(g.visible).onChange(w=>{g.visible=w,this.plugin.saveSettings()})}).then(b=>{g.id==="action"?b.setDesc("Available only on macOS."):g.id==="write-file"||g.id==="modify-annotation"?b.setDesc(createFragment(w=>{w.appendText("Requires "),w.appendChild(this.createLinkTo("enablePDFEdit","PDF editing")),w.appendText(" to be enabled.")})):g.id==="link"?b.setDesc('"Search on Google Scholar": Available when right-clicking citation links in PDFs.'):g.id==="speech"?b.setDesc(createFragment(w=>{w.appendText("Requires the "),w.createEl("a",{text:"Text to Speech",href:"obsidian://show-plugin?id=obsidian-tts"}),w.appendText(" plugin to be enabled.")})):g.id==="page"&&b.setDesc("Available when right-clicking with no text selected.")}))}}this.addDesc("Customize nested menus."),this.addProductMenuSetting("selectionProductMenuConfig","Copy link to selection"),this.addProductMenuSetting("writeFileProductMenuConfig",`Add ${this.plugin.settings.selectionBacklinkVisualizeStyle} to file`),this.addProductMenuSetting("annotationProductMenuConfig","Copy link to annotation"),this.addToggleSetting("updateColorPaletteStateFromContextMenu").setName("Update color palette from context menu").setDesc("In the context menu, the items (color, copy format and display text format) set in the color palette are selected by default. If this option is enabled, clicking a menu item will also update the color palette state and hence the default-selected items in the context menu as well.")}this.addHeading("Copying on mobile","mobile-copy","lucide-smartphone"),this.addDropdownSetting("mobileCopyAction",AP).setName('Action triggered by selecting "Copy" option on mobile devices'),this.addHeading("Copying links via hotkeys","copy-hotkeys","lucide-keyboard"),this.addSetting().setName("Set up hotkeys for copying links").then(d=>{this.renderMarkdown(["PDF++ offers two commands for quickly copying links via hotkeys.","","1. **Copy link to selection or annotation:**"," Copies a link to the text selection or focused annotation in the PDF viewer, which is formatted according to the options specified in the PDF toolbar.",'
    If the "Add highlights to file directly" toggle switch in the PDF toolbar is on, it first adds a highlight annotation directly to the PDF file, and then copies the link to the created annotation.',"2. **Copy link to current page view:** Copies a link, clicking which will open the PDF file at the current scroll position and zoom level.","",'After running this command, you can add the copied link to the PDF file itself: select a range of text, right-click, and then click "Paste copied link to selection".'],d.descEl)}).then(d=>this.addHotkeySettingButton(d,`${this.plugin.manifest.name}: Copy link`)),this.addSetting().setName("Further workflow enhancements").setDesc(createFragment(d=>{d.appendText("See the "),d.appendChild(this.createLinkToHeading("auto",'"Auto-copy / auto-focus / auto-paste"')),d.appendText(" section below.")})),this.addHeading("Other shortcut commands","other-hotkeys","lucide-layers-2"),this.addSetting().then(d=>{this.renderMarkdown(["PDF++ also offers the following commands for reducing mouse clicks on the PDF toolbar by assigning hotkeys to them.","","- **Show outline** / **show thumbnail**","- **Close PDF siderbar**","- **Zoom in** / **zoom out**","- **Fit width** / **fit height**","- **Go to page**: This command brings the cursor to the page number input field in the PDF toolbar. Enter a page number and press Enter to jump to the page.","- **Show copy format menu** / **show display text format menu**: By running thes commands via hotkeys and then using the arrow keys, you can quickly select a format from the menu without using the mouse.","- **Enable PDF edit** / **disable PDF edit**","- And more..."],d.descEl)}).then(d=>this.addHotkeySettingButton(d)),this.addToggleSetting("executeBuiltinCommandForOutline").setName(`Show outline: when the active file is not PDF, run the core Outline plugin's "Show outline" command`).setDesc("By turning this on, you can use the same hotkey to show the outline of a markdown file and a PDF file without key conflict."),this.addToggleSetting("closeSidebarWithShowCommandIfExist").setName("Show outline / show thumbnail: close the sidebar if it is already open").setDesc("Enabling this will allow you to use the same hotkey to close the sidebar if it is already open."),this.addToggleSetting("executeBuiltinCommandForZoom").setName('Zoom in / zoom out: when the active file is not PDF, run the built-in "Zoom in" / "Zoom out" command').setDesc("By turning this on, you can use the same hotkey to zoom in/out a PDF viewer or any other type of view without key conflict."),this.addToggleSetting("executeFontSizeAdjusterCommand").setName(`Zoom in / zoom out: when the active file is not PDF, run Font Size Adjuster's "Increment font size" / "Decrement font size" command`).then(d=>{this.renderMarkdown(["(Requires the [Font Size Adjuster](obsidian://show-plugin?id=font-size) plugin enabled) ",'If both of this option and the above option are enabled, this option will be prioritized. The built-in "Zoom in" / "Zoom out" command will be executed if Font Size Adjuster is not installed or disabled.'],d.descEl)}),this.addHeading("Copy templates","template","lucide-copy").setDesc("The template format that will be used when copying a link to a selection or an annotation in PDF viewer. "),this.addSetting().then(d=>this.renderMarkdown(["Each `{{...}}` will be evaluated as a JavaScript expression given the variables listed below.","","Available variables are:","","- `file` or `pdf`: The PDF file ([`TFile`](https://docs.obsidian.md/Reference/TypeScript+API/TFile)). Use `file.basename` for the file name without extension, `file.name` for the file name with extension, `file.path` for the full path relative to the vault root, etc.","- `page`: The page number (`Number`). The first page is always page 1.","- `pageLabel`: The page number displayed in the counter in the toolbar (`String`). This can be different from `page`.",` - **Tip**: You can modify page labels with PDF++'s "Edit page labels" command.`,"- `pageCount`: The total number of pages (`Number`).","- `text` or `selection`: The selected text (`String`). In the case of links to annotations written directly in the PDF file, this is the text covered by the annotation.",'- `comment`: In the case of links to annotations written directly in the PDF file, this is the comment associated with the annotation (`String`). Otherwise, it is an empty string `""`.',"- `folder`: The folder containing the PDF file ([`TFolder`](https://docs.obsidian.md/Reference/TypeScript+API/TFolder)). This is an alias for `file.parent`.","- `obsidian`: The Obsidian API. See the [official developer documentation](https://docs.obsidian.md/Home) and the type definition file [`obsidian.d.ts`](https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts) for the details.","- `dv`: Available if the [Dataview](obsidian://show-plugin?id=dataview) plugin is enabled. See Dataview's [official documentation](https://blacksmithgu.github.io/obsidian-dataview/api/code-reference/) for the details. You can use it almost the same as the `dv` variable available in `dataviewjs` code blocks, but there are some differences. For example, `dv.current()` is not available.","- `quickAddApi`: Available if the [QuickAdd](obsidian://show-plugin?id=quickadd) plugin is enabled. See QuickAdd's [official documentation](https://quickadd.obsidian.guide/docs/QuickAddAPI) for the details.","- `app`: The global Obsidian app object ([`App`](https://docs.obsidian.md/Reference/TypeScript+API/App)).","- and other global variables such as:",' - [`moment`](https://momentjs.com/docs/#/displaying/): For exampe, use `moment().format("YYYY-MM-DD")` to get the current date in the "YYYY-MM-DD" format.',"",`Additionally, you have access to the following variables when the PDF file has a corresponding markdown file specified via the "${this.plugin.settings.proxyMDProperty}" property(see the "Property to associate a markdown file to a PDF file" setting below): `,"","- `md`: The markdown file associated with the PDF file ([`TFile`](https://docs.obsidian.md/Reference/TypeScript+API/TFile)). If there is no such file, this is `null`.","- `properties`: The properties of `md` as an `Object` mapping each property name to the corresponding value. If `md` is `null` or the `md` has no properties, this is an empty object `{}`.","","Furthermore, the following variables are available when the PDF tab is linked to another tab:","","- `linkedFile`: The file opened in the linked tab ([`TFile`](https://docs.obsidian.md/Reference/TypeScript+API/TFile)). If there is no such file, this is `null`.","- `linkedFileProperties`: The properties of `linkedFile` as an `Object` mapping each property name to the corresponding value. If there is no `linkedFile` or the `linkedFile` has no properties, this is an empty object `{}`."],d.descEl)),this.addTextSetting("proxyMDProperty",void 0,()=>this.redisplay()).setName("Property to associate a markdown file to a PDF file").then(d=>{this.renderMarkdown(["Create a markdown file with this property to associate it with a PDF file. The PDF file is specified by a link, e.g. `[[file.pdf]]`.","It can be used to store properties/metadata that can be used when copying links.","","If you have the [Dataview](obsidian://show-plugin?id=dataview) plugin installed, you can use Dataview's inline field syntax such as `"+this.plugin.settings.proxyMDProperty+":: [[file.pdf]]`.","","Remarks:","- Make sure the associated markdown file can be uniquely identified. For example, if you have two markdown files `file1.md` and `file2.md` and both of their `"+this.plugin.settings.proxyMDProperty+"` properties point to the same PDF file, PDF++ cannot determine which markdown file is associated with `file.pdf`.","- If you are in Source Mode and using front matter instead of Dataview inline fields, be sure to enclose the link in double quotes."],d.descEl)}),this.addSetting("displayTextFormats").setName("Display text format").then(d=>this.renderMarkdown(["This format will be also used when copying a link to a selection or an annotation from the context menu."],d.descEl)).addButton(d=>{d.setIcon("plus").setTooltip("Add a new display text format").onClick(()=>{this.plugin.settings.displayTextFormats.push({name:"",template:""}),this.redisplay()})});for(let d=0;dd.name),void 0,()=>{this.plugin.loadStyle()}).setName("Default display text format"),this.addToggleSetting("syncDisplayTextFormat").setName("Share a single display text format among all PDF viewers").setDesc("If disabled, you can specify a different display text format for each PDF viewer from the dropdown menu in the PDF toolbar."),this.plugin.settings.syncDisplayTextFormat&&this.addToggleSetting("syncDefaultDisplayTextFormat").setName("Share the display text format with newly opened PDF viewers as well"),this.addSetting("copyCommands").setName("Custom copy formats").then(d=>this.renderMarkdown(["Customize the format to use when you copy a link by clicking a color palette item or running the commands while selecting a range of text in PDF viewer.","","In addition to the variables listed above, here you can use","","- `link`: The link without display text, e.g. `[[file.pdf#page=1&selection=0,1,2,3&color=red]]`,","- `linkWithDisplay`: The link with display text, e.g. `[[file.pdf#page=1&selection=0,1,2,3&color=red|file, page 1]]`,",'- `linktext`: The text content of the link without brackets and the display text, e.g. `file.pdf#page=1&selection=0,1,2,3&color=red`
    (if the "Use \\[\\[Wikilinks\\]\\]" setting is turned off, `linktext` will be properly encoded for use in markdown links),',"- `display`: The display text formatted according to the above setting, e.g. `file, page 1`,","- `linkToPage`: The link to the page without display text, e.g. `[[file.pdf#page=1]]`,","- `linkToPageWithDisplay`: The link to the page with display text, e.g. `[[file.pdf#page=1|file, page 1]]`,",`- \`calloutType\`: The callout type you specify in the "Callout type name" setting above, in this case, "${this.plugin.settings.calloutType}", and`,"- `color` (or `colorName`): In the case of text selections, this is the name of the selected color in lowercase, e.g. `red`. If no color is specified, it will be an empty string. For text markup annotations (e.g. highlights and underlines), this is the RGB value of the color, e.g. `255,208,0`."],d.descEl)).addButton(d=>{d.setIcon("plus").setTooltip("Add a new copy command").onClick(()=>{this.plugin.settings.copyCommands.push({name:"",template:""}),this.redisplay()})});for(let d=0;dd.name),void 0,()=>{this.plugin.loadStyle()}).setName("Default action when clicking on color palette"),this.addToggleSetting("syncColorPaletteAction").setName("Share a single action among all PDF viewers").setDesc("If disabled, you can specify a different action for each PDF viewer from the dropdown menu in the PDF toolbar."),this.plugin.settings.syncColorPaletteAction&&this.addToggleSetting("syncDefaultColorPaletteAction").setName("Share the action with newly opened PDF viewers as well"),this.addToggleSetting("useAnotherCopyTemplateWhenNoSelection",()=>this.redisplay()).setName("Use another template when no text is selected").setDesc("For example, you can use this to copy a link to the page when there is no selection."),this.plugin.settings.useAnotherCopyTemplateWhenNoSelection&&this.addTextSetting("copyTemplateWhenNoSelection").setName("Link copy template used when no text is selected"),this.addHeading("Auto-copy / auto-focus / auto-paste","auto","lucide-zap").setDesc("Speed up the process of copying & pasting PDF links to your notes with some automation. Note that you can't activate both of auto-focus and auto-paste at the same time."),this.addHeading("Auto-copy","auto-copy").setDesc(`If enabled, the "Copy link to selection or annotation" command will be triggered automatically every time you select a range of text in a PDF viewer, meaning you don't even have to press a hotkey to copy a link.`),this.addToggleSetting("autoCopy",()=>this.plugin.autoCopyMode.toggle(this.plugin.settings.autoCopy)).setName("Enable").setDesc("You can also toggle auto-focus via an icon in the left ribbon menu if the next setting is enabled."),this.addToggleSetting("autoCopyToggleRibbonIcon",()=>this.redisplay()).setName("Show an icon to toggle auto-copy in the left ribbon menu").setDesc("You can also toggle this mode via a command. Reload the plugin after changing this setting to take effect."),this.plugin.settings.autoCopyToggleRibbonIcon&&this.addIconSetting("autoCopyIconName",!1).setName("Icon name").then(d=>{d.descEl.appendText(" Reload the plugin after changing this setting to take effect.")}),this.addHeading("Auto-focus","auto-focus").setDesc("If enabled, a markdown file will be focused automatically after copying a link to PDF text selection or annotation."),this.addSetting("autoFocus").setName("Enable").setDesc("Recommended if you prefer something less agressive than auto-paste. You can also toggle auto-focus via an icon in the left ribbon menu if the next setting is enabled.").addToggle(d=>{d.setValue(this.plugin.settings.autoFocus).onChange(h=>{this.plugin.toggleAutoFocus(h),this.redisplay()})}),this.addToggleSetting("autoFocusToggleRibbonIcon",()=>this.redisplay()).setName("Show an icon to toggle auto-focus in the left ribbon menu").setDesc("You can also toggle auto-focus via a command. Reload the plugin after changing this setting to take effect."),this.plugin.settings.autoFocusToggleRibbonIcon&&this.addIconSetting("autoFocusIconName",!1).setName("Icon name").then(d=>{d.descEl.appendText(" Reload the plugin after changing this setting to take effect.")}),this.addDropdownSetting("autoFocusTarget",Dx).setName("Target markdown file to focus on"),this.addHeading("Auto-paste","auto-paste").setDesc("If enabled, the copied link to PDF text selection or annotation will be automatically pasted into a markdown file right after copying."),this.addSetting("autoPaste").setName("Enable").setDesc("You can also toggle auto-paste via an icon in the left ribbon menu if the next setting is enabled.").addToggle(d=>{d.setValue(this.plugin.settings.autoPaste).onChange(h=>{this.plugin.toggleAutoPaste(h),this.redisplay()})}),this.addToggleSetting("autoPasteToggleRibbonIcon",()=>this.redisplay()).setName("Show an icon to toggle auto-paste in the left ribbon menu").setDesc("You can also toggle auto-paste via a command. Reload the plugin after changing this setting to take effect."),this.plugin.settings.autoPasteToggleRibbonIcon&&this.addIconSetting("autoPasteIconName",!1).setName("Icon name").then(d=>{d.descEl.appendText(" Reload the plugin after changing this setting to take effect.")}),this.addDropdownSetting("autoPasteTarget",Dx).setName("Target markdown file to paste links to"),this.addToggleSetting("focusEditorAfterAutoPaste",()=>this.events.trigger("update")).setName("Focus editor after auto-pasting").setDesc("If enabled, auto-paste will focus on the editor after pasting."),this.showConditionally(this.addToggleSetting("clearSelectionAfterAutoPaste").setName("Clear text selection after auto-pasting").setDesc("If enabled, the text selection in the PDF viewer will be automatically cleared after performing auto-pasting."),()=>!this.plugin.settings.focusEditorAfterAutoPaste),this.addToggleSetting("respectCursorPositionWhenAutoPaste").setName("Respect current cursor position").setDesc("When enabled, triggering auto-pasting will paste the copied text at the current cursor position if the target note is already opened. If disabled, the text will be always appended to the end of the note."),this.addHeading("General","auto-general").setDesc("General settings that apply to both auto-focus and auto-paste."),this.addToggleSetting("openAutoFocusTargetIfNotOpened",()=>this.redisplay()).setName("Open target markdown file if not opened"),this.plugin.settings.openAutoFocusTargetIfNotOpened&&(this.addDropdownSetting("howToOpenAutoFocusTargetIfNotOpened",{...Fh,"hover-editor":"Hover Editor"},()=>this.redisplay()).setName("How to open target markdown file when not opened").then(d=>{this.renderMarkdown('The "Hover Editor" option is available if the [Hover Editor](obsidian://show-plugin?id=obsidian-hover-editor) plugin is enabled.',d.descEl),this.plugin.settings.howToOpenAutoFocusTargetIfNotOpened==="hover-editor"&&(this.app.plugins.plugins["obsidian-hover-editor"]||d.descEl.addClass("error"))}),this.showConditionally(this.addToggleSetting("closeHoverEditorWhenLostFocus").setName("Close Hover Editor when it loses focus").setDesc("This option will not affect the behavior of Hover Editor outside of PDF++."),()=>this.plugin.settings.howToOpenAutoFocusTargetIfNotOpened==="hover-editor"),this.addToggleSetting("closeSidebarWhenLostFocus").setName("Auto-hide sidebar when it loses focus after auto-pasting").setDesc("After auto-pasting into a markdown file opened in the left or right sidebar, the sidebar will be automatically collapsed once it loses focus."),this.addToggleSetting("openAutoFocusTargetInEditingView").setName("Always open in editing view").setDesc('This option can be useful especially when you set the previous option to "Hover Editor".')),this.addToggleSetting("executeCommandWhenTargetNotIdentified",()=>this.redisplay()).setName("Execute command when target file cannot be determined").setDesc("When PDF++ cannot determine which markdown file to focus on or paste to, it will execute the command specified in the next option to let you pick a target file.");let s=(l=(c=this.app.commands.findCommand(`${this.plugin.manifest.id}:create-new-note`))==null?void 0:c.name)!=null?l:"PDF++: Create new note for auto-focus or auto-paste";this.plugin.settings.executeCommandWhenTargetNotIdentified&&(this.addSetting("commandToExecuteWhenTargetNotIdentified").setName("Command to execute").then(d=>{var h,u,f,p,g,m;this.renderMarkdown(["Here's some examples of useful commands:","",`- ${(u=(h=this.app.commands.findCommand("file-explorer:new-file"))==null?void 0:h.name)!=null?u:"Create new note"}`,`- ${(p=(f=this.app.commands.findCommand("file-explorer:new-file-in-new-pane"))==null?void 0:f.name)!=null?p:"Create note to the right"}`,`- ${(m=(g=this.app.commands.findCommand("switcher:open"))==null?void 0:g.name)!=null?m:"Quick switcher: Open quick switcher"}`,"- [Omnisearch](obsidian://show-plugin?id=omnisearch): Vault search","- [Hover Editor](obsidian://show-plugin?id=obsidian-hover-editor): Open new Hover Editor",`- **${s}**: See below for the details.`],d.descEl)}).addText(d=>{let h=this.plugin.settings.commandToExecuteWhenTargetNotIdentified,u=this.app.commands.findCommand(h);u?d.setValue(u.name):(d.inputEl.addClass("error"),d.setPlaceholder("Command not found")),d.inputEl.size=30,new vc(this,d.inputEl)}),this.addSliderSetting("autoPasteTargetDialogTimeoutSec",1,60,1).setName("[Auto-paste] Maximum time to wait for the command to open the target file (sec)").setDesc("The link will be auto-pasted into the first markdown file that you open within this time frame after the command is executed. If you don't open any markdown file during this time, the auto-paste will not occur. This option is not related to auto-focus.")),this.addHeading(`The "${s}" command`,"create-new-note-command").setDesc('Creates a new note and opens it in a new pane specified in the "How to open target markdown file when not opened" option.'),this.addTextSetting("newFileNameFormat","Leave blank not to specify").setName("New note title format").then(async d=>{await this.renderMarkdown(['If this option is left blank or the active file is not a PDF, "Untitled \\*" will be used (if the language is set to English). You can use the following variables: `file`, `folder`, `app`, and other global variables such as `moment`.'],d.descEl),d.descEl.createSpan({text:"See "}),d.descEl.appendChild(this.createLinkToHeading("template","above")),d.descEl.createSpan({text:" for the details about these variables."})}),this.addTextSetting("newFileTemplatePath","Leave blank not to use a template").setName("Template file path").then(async d=>{await this.renderMarkdown(["You can leave this blank if you don't want to use a template.","You can use `file`, `folder`, `app`, and other global variables such as `moment`."],d.descEl),d.descEl.createSpan({text:"See "}),d.descEl.appendChild(this.createLinkToHeading("template","above")),d.descEl.createSpan({text:" for the details about these variables."}),await this.renderMarkdown(["You can also include [Templater](obsidian://show-plugin?id=templater-obsidian) syntaxes in the template.",'In that case, make sure the "Trigger templater on new file creation" option is enabled in the Templater settings.',"","Example:","```","---",`${this.plugin.settings.proxyMDProperty}: "[[{{ file.path }}|{{ file.basename }}]]"`,"---",'<%* const title = await tp.system.prompt("Type note tile") -%>',"<%* await tp.file.rename(title) %>","```"],d.descEl);let h=d.components[0].inputEl;new yc(this.app,h).onSelect(({item:u})=>{this.plugin.settings.newFileTemplatePath=u.path,this.plugin.saveSettings()})}),this.addHeading("PDF Annotations","annot","lucide-message-square"),this.addToggleSetting("annotationPopupDrag").setName("Drag & drop annotation popup to insert a link to the annotation").setDesc("Note that turning on this option disables text selection in the annotation popup (e.g. modified date, author, etc)."),this.addToggleSetting("showAnnotationPopupOnHover").setName("If an annotation has a comment, show the annotation popup on hover").setDesc("This is the same behavior as the PDF viewers of some web browsers (e.g. Chrome/Firefox). You may have to reopen the PDF file after changing this option."),this.addToggleSetting("renderMarkdownInStickyNote").setName("Render markdown in annotation popups when the annotation has text contents"),this.plugin.settings.enablePDFEdit&&(this.addSliderSetting("writeHighlightToFileOpacity",0,1,.01).setName("Highlight opacity"),this.addToggleSetting("defaultWriteFileToggle").setName("Write highlight to file by default").setDesc("You can turn this on and off with the toggle button in the PDF viewer toolbar."),this.addToggleSetting("syncWriteFileToggle").setName("Share the same toggle state among all PDF viewers").setDesc("If disabled, you can specify whether to write highlights to files for each PDF viewer."),this.plugin.settings.syncWriteFileToggle&&this.addToggleSetting("syncDefaultWriteFileToggle").setName("Share the state with newly opened PDF viewers as well"),this.addToggleSetting("enableAnnotationContentEdit",()=>this.redisplay()).setName("Enable editing annotation contents").setDesc('If enabled, you can edit the text contents of annotations embedded in PDF files by clicking the "Edit" button in the annotation popup.'),this.addToggleSetting("enableAnnotationDeletion",()=>this.redisplay()).setName("Enable annotation deletion").setDesc('If enabled, you can delete annotations embedded in PDF files by clicking the "Delete" button in the annotation popup.'),this.plugin.settings.enableAnnotationDeletion&&(this.addToggleSetting("warnEveryAnnotationDelete",()=>this.redisplay()).setName("Always warn when deleting an annotation"),this.plugin.settings.warnEveryAnnotationDelete||this.addToggleSetting("warnBacklinkedAnnotationDelete").setName("Warn when deleting an annotation with backlinks"))),this.addHeading("PDF internal links","pdf-link","link").setDesc("Make it easier to work with internal links embedded in PDF files."),this.addToggleSetting("clickPDFInternalLinkWithModifierKey").then(d=>{this.renderMarkdown("Use [modifier keys](https://help.obsidian.md/User+interface/Tabs#Open+a+link) to open PDF internal links in various ways",d.nameEl)}).then(d=>{this.plugin.requireModKeyForLinkHover(Ji.HOVER_LINK_SOURCE_ID)&&d.setDesc(`You may want to turn this off to avoid conflicts with hover+${Bn}.`),d.descEl.appendText("Reopen tabs or reload the app after changing this option.")}),this.addToggleSetting("enableHoverPDFInternalLink",()=>this.events.trigger("update")).setName(`Show a popover preview of PDF internal links by hover(+${Bn})`),this.showConditionally(this.addRequireModKeyOnHoverSetting(Ji.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.enableHoverPDFInternalLink),this.addToggleSetting("recordPDFInternalLinkHistory").setName("Enable history navigation for PDF internal links").setDesc('When enabled, clicking the "navigate back" (left arrow) button will take you back to the page you were originally viewing before clicking on an internal link in the PDF file.'),this.addSetting().setName("Copy PDF link as Obsidian link").setDesc('(Requires custom context menu enabled) In the PDF viewer, right-click a PDF-embedded link and then click "Copy PDF link as Obsidian link". It will copy the PDF link as an Obsidian link that you can paste into markdown files. Clicking the pasted link will take you to the same destination as the original PDF link.'),this.addSetting().setName('"Copy link to current page view" command').setDesc("Running this command while viewing a PDF file will copy a link, clicking which will open the PDF file at the current scroll position and zoom level."),this.addSetting().setName("Paste copied link to a text selection in a PDF file").setDesc('(Requires custom context menu & PDF editing enabled) After copying a link by the above actions, you can "paste" it to a selection in PDF to create a PDF internal link. To do this, right-click the selection and click "Paste copied link to selection".'),this.plugin.settings.replaceContextMenu&&this.plugin.settings.enablePDFEdit&&(this.addToggleSetting("pdfLinkBorder",()=>this.redisplay()).setName("Draw borders around internal links").setDesc('Specify whether PDF internal links that you create by "Paste copied link to selection" should be surrounded by borders.'),this.plugin.settings.pdfLinkBorder&&this.addColorPickerSetting("pdfLinkColor").setName("Border color of internal links").setDesc('Specify the border color of PDF internal links that you create by "Paste copied link to selection".')),this.addHeading("Citations in PDF (experimental)","citation","lucide-graduation-cap").then(d=>{this.renderMarkdown(["Enjoy supercharged experiences of working with citations in PDF files, just like in [Google Scholar's PDF viewer](https://scholar.googleblog.com/2024/03/supercharge-your-pdf-reading-follow.html).","","The current implementation is based on some pretty primitive hand-crafted rules, and there is a lot of room for improvement. Code contribution is much appreciated!"],d.descEl)}),this.addDropdownSetting("actionOnCitationHover",sg,()=>this.events.trigger("update")).setName(`Hover(+${Bn}) on a citation link to show...`).then(d=>{this.renderMarkdown([`- **${sg["pdf-plus-bib-popover"]}**: Recommended. It works without any additional stuff, but you can further boost the visibility by installing [AnyStyle](https://github.com/inukshuk/anystyle) (desktop only).`,`- **${sg["google-scholar-popover"]}**: Requires [Surfing](obsidian://show-plugin?id=surfing) ver. 0.9.9 or higher enabled. Be careful not to exceed the rate limit of Google Scholar.`],d.descEl)}),this.showConditionally(this.addRequireModKeyOnHoverSetting(Ci.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.actionOnCitationHover!=="none"),this.showConditionally(this.addSetting("anystylePath").setName("AnyStyle path").addText(d=>{d.setPlaceholder("anystyle").setValue(this.plugin.settings.anystylePath).onChange(h=>{this.plugin.settings.anystylePath=h,this.plugin.saveLocalStorage("anystylePath",h)})}).then(d=>{d.components[0].inputEl.size=35,this.renderMarkdown(["The path to the [AnyStyle](https://github.com/inukshuk/anystyle) executable. ","","PDF++ extracts the bibliography text from the PDF file for each citation link and uses AnyStyle to convert the extracted text into a structured metadata.","It works just fine without AnyStyle, but you can further boost the visibility by installing it and providing its path here.","","Note: This setting is saved in the [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) instead of `data.json` in the plugin folder."],d.descEl)}),()=>re.Platform.isDesktopApp&&this.plugin.settings.actionOnCitationHover==="pdf-plus-bib-popover"),this.showConditionally([this.addDesc("Try turning off the following options if you experience performance issues."),this.addToggleSetting("enableBibInEmbed").setName("Enable bibliography extraction in PDF embeds"),this.addToggleSetting("enableBibInCanvas").setName("Enable bibliography extraction in Canvas"),this.addToggleSetting("enableBibInHoverPopover").setName("Enable bibliography extraction in hover popover previews")],()=>this.plugin.settings.actionOnCitationHover!=="none"),this.addHeading("External links in PDF","pdf-external-link","external-link").setDesc("Make it easier to work with external links embedded in PDF files."),this.addToggleSetting("popoverPreviewOnExternalLinkHover").setName(`Show a popover preview of external links by hover(+${Bn})`).then(d=>{this.renderMarkdown(["Requires [Surfing](obsidian://show-plugin?id=surfing) ver. 0.9.9 or higher enabled."],d.descEl)}),this.showConditionally(this.addRequireModKeyOnHoverSetting(Vn.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.popoverPreviewOnExternalLinkHover),this.addHeading("PDF sidebar","sidebar","sidebar-left").setDesc("General settings for the PDF sidebar. The options specific to the outline and thumbnails are located in the corresponding sections below."),this.addToggleSetting("autoHidePDFSidebar").setName("Click on PDF content to hide sidebar").setDesc("Requires reopening the tabs after changing this option."),this.addEnumDropdownSetting("defaultSidebarView",{[1]:"Thumbnails",[2]:"Outline"}).setName("Default sidebar view").setDesc("Reopen PDFs after changing this option."),this.addHeading("PDF outline (table of contents)","outline","lucide-list").setDesc('Power up the outline view of the built-in PDF viewer: add, rename, or delete items via the right-click menu and the "Add to outline" command, drag & drop items to insert a section link, and more.'),this.addToggleSetting("clickOutlineItemWithModifierKey").then(d=>{this.renderMarkdown("Click PDF outline with [modifier keys](https://help.obsidian.md/User+interface/Tabs#Open+a+link) to open target section in various ways",d.nameEl)}).then(d=>{this.plugin.requireModKeyForLinkHover(Qi.HOVER_LINK_SOURCE_ID)&&d.setDesc(`You may want to turn this off to avoid conflicts with hover+${Bn}.`),d.descEl.appendText("Reopen tabs or reload the app after changing this option.")}),this.addToggleSetting("popoverPreviewOnOutlineHover",()=>this.events.trigger("update")).setName(`Show popover preview by hover(+${Bn})`).setDesc("Reopen tabs or reload the app after changing this option."),this.showConditionally(this.addRequireModKeyOnHoverSetting(Qi.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.popoverPreviewOnOutlineHover),this.addToggleSetting("recordHistoryOnOutlineClick").setName("Record to history when clicking an outline item").setDesc("Reopen tabs or reload the app after changing this option."),this.addToggleSetting("outlineContextMenu").setName("Replace the built-in context menu in the outline with a custom one").setDesc("This enables you to insert a section link with a custom format by right-clicking an item in the outline. Moreover, you will be able to add, rename, or delete outline items if PDF modification is enabled."),this.addToggleSetting("outlineDrag").setName("Drag & drop outline item to insert link to section").setDesc("Grab an item in the outline and drop it to a markdown file to insert a section link. Changing this option requires reopening the tabs or reloading the app."),(this.plugin.settings.outlineContextMenu||this.plugin.settings.outlineDrag)&&(this.addTextSetting("outlineLinkDisplayTextFormat").setName("Display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("outlineLinkCopyFormat").setName("Copy format").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30})),this.addHeading("Copy outline as markdown","outline-copy").setDesc('You can copy PDF outline as a markdown list or headings using the commands "Copy outline as markdown list" and "Copy outline as markdown headings".'),this.addTextSetting("copyOutlineAsListDisplayTextFormat").setName("List: display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("copyOutlineAsListFormat").setName("List: copy format").setDesc("You don't need to include leading hyphens in the template.").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30}),this.addTextSetting("copyOutlineAsHeadingsDisplayTextFormat").setName("Headings: display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("copyOutlineAsHeadingsFormat").setName("Headings: copy format").setDesc("You don't need to include leading hashes in the template.").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30}),this.addSliderSetting("copyOutlineAsHeadingsMinLevel",1,6,1).setName("Headings: minimum level").setDesc("The copied headings will start at this level."),this.addHeading("PDF thumbnails","thumbnail","lucide-gallery-thumbnails"),this.addToggleSetting("clickThumbnailWithModifierKey").then(d=>{this.renderMarkdown("Click PDF thumbnails with [modifier keys](https://help.obsidian.md/User+interface/Tabs#Open+a+link) to open target page in various ways",d.nameEl)}).then(d=>{this.plugin.requireModKeyForLinkHover(_i.HOVER_LINK_SOURCE_ID)&&d.setDesc(`You may want to turn this off to avoid conflicts with hover+${Bn}`),d.descEl.appendText("Reopen tabs or reload the app after changing this option.")}),this.addToggleSetting("popoverPreviewOnThumbnailHover",()=>this.events.trigger("update")).setName(`Show popover preview by hover(+${Bn})`).setDesc("Reopen tabs or reload the app after changing this option."),this.showConditionally(this.addRequireModKeyOnHoverSetting(_i.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.popoverPreviewOnThumbnailHover),this.addToggleSetting("recordHistoryOnThumbnailClick").setName("Record to history when clicking a thumbnail").setDesc("Reopen tabs or reload the app after changing this option."),this.addToggleSetting("thumbnailContextMenu").setName("Replace the built-in context menu in thumbnails with a custom one").setDesc("This enables you to copy a page link with a custom display text format specified in the PDF toolbar by right-clicking a thumbnail. Moreover, you will be able to insert, delete, extract pages if PDF modification is enabled."),this.addToggleSetting("thumbnailDrag").setName("Drag & drop PDF thumbnail to insert link to page").then(d=>{this.renderMarkdown(["Grab a thumbnail image and drop it to a markdown file to insert a page link. Changing this option requires reopening the tabs or reloading the app.","","Note: When disabled, drag-and-drop will cause the thumbnail image to be paste as a data url, which is seemingly Obsidian's bug."],d.descEl)}),(this.plugin.settings.thumbnailContextMenu||this.plugin.settings.thumbnailDrag)&&(this.addTextSetting("thumbnailLinkDisplayTextFormat").setName("Display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("thumbnailLinkCopyFormat").setName("Copy format").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30})),this.addHeading("PDF page composer (experimental)","composer","lucide-blocks").then(d=>{this.renderMarkdown(['Add, insert, delete or extract PDF pages via commands and **automatically update all the related links in the entire vault**. The "Editing PDF files directly" option has to be enabled to use these features.'],d.descEl)}),this.addToggleSetting("warnEveryPageDelete",()=>this.redisplay()).setName("Always warn when deleting a page"),this.plugin.settings.warnEveryPageDelete||this.addToggleSetting("warnBacklinkedPageDelete").setName("Warn when deleting a page with backlinks"),this.addToggleSetting("extractPageInPlace").setName("Remove the extracted pages from the original PDF by default"),this.addToggleSetting("askExtractPageInPlace").setName("Ask whether to remove the extracted pages from the original PDF before extracting"),this.addToggleSetting("openAfterExtractPages",()=>this.redisplay()).setName("Open extracted PDF file").setDesc('If enabled, the newly created PDF file will be opened after running the commands "Extract this page to a new file" or "Divide this PDF into two files at this page".'),this.plugin.settings.openAfterExtractPages&&this.addDropdownSetting("howToOpenExtractedPDF",Fh).setName("How to open"),this.addHeading("Page labels","page-label").then(d=>{this.renderMarkdown(["Each page in a PDF document can be assigned a ***page label***, which can be different from the page indices.",'For example, a book might have a preface numbered as "i", "ii", "iii", ... and the main content numbered as "1", "2", "3", ...',"","PDF++ allows you to choose whether page labels should be kept unchanged or updated when inserting/removing/extracting pages. [Learn more](https://github.com/RyotaUshio/obsidian-pdf-plus/wiki/Page-labels)","",'You can also modify page labels directly using the command "Edit page labels".'],d.descEl)}),this.addDropdownSetting("pageLabelUpdateWhenInsertPage",Nc).setName("Insert: default page label processing").setDesc('Applies to the commands "Insert page before/after this page".'),this.addToggleSetting("askPageLabelUpdateWhenInsertPage").setName("Insert: ask whether to update"),this.addDropdownSetting("pageLabelUpdateWhenDeletePage",Nc).setName("Delete: default page label processing").setDesc('Applies to the command "Delete this page".'),this.addToggleSetting("askPageLabelUpdateWhenDeletePage").setName("Delete: ask whether to update"),this.addDropdownSetting("pageLabelUpdateWhenExtractPage",Nc).setName("Extract: default page label processing").setDesc('Applies to the commands "Extract this page to a new file" and "Divide this PDF into two files at this page".'),this.addToggleSetting("askPageLabelUpdateWhenExtractPage").setName("Extract: ask whether to update"),this.addHeading("Opening links to PDF files","open-link","lucide-book-open"),this.addToggleSetting("alwaysRecordHistory").setName("Always record to history when opening PDF links").setDesc("By default, the history is recorded only when you open a link to a different PDF file. If enabled, the history will be recorded even when you open a link to the same PDF file as the current one, and you will be able to go back and forth the history by clicking the left/right arrow buttons even within a single PDF file."),this.addToggleSetting("singleTabForSinglePDF",()=>this.redisplay()).setName("Don't open a single PDF file in multiple tabs").then(d=>this.renderMarkdown('When opening a link to a PDF file without pressing any [modifier keys](https://help.obsidian.md/User+interface/Use+tabs+in+Obsidian#Open+a+link), a new tab will not be opened if the same file has already been already opened in another tab. Useful for annotating PDFs using a side-by-side view ("Split right"), displaying a PDF in one side and a markdown file in another.',d.descEl)),this.plugin.settings.singleTabForSinglePDF&&(this.addToggleSetting("dontActivateAfterOpenPDF").setName("Don't move focus to PDF viewer after opening a PDF link").setDesc("This option will be ignored when you open a PDF link in a tab in the same split as the PDF viewer."),this.addToggleSetting("highlightExistingTab",()=>this.redisplay()).setName("When opening a link to an already opened PDF file, highlight the tab"),this.plugin.settings.highlightExistingTab&&(this.addSliderSetting("existingTabHighlightOpacity",0,1,.01).setName("Highlight opacity of an existing tab"),this.addSliderSetting("existingTabHighlightDuration",.1,10,.05).setName("Highlight duration of an existing tab (sec)")),this.addToggleSetting("dontFitWidthWhenOpenPDFLink",()=>this.events.trigger("update")).setName("Preserve the current zoom level when opening a link to an already opened PDF file").setDesc("When you open a link to a PDF file that's already opened, Obsidian's default behavior causes the zoom level to be reset to fit the width of the PDF file to the viewer. If enabled, the current zoom level will be preserved. This option will be ignored in PDF embeds."),this.showConditionally(this.addToggleSetting("preserveCurrentLeftOffsetWhenOpenPDFLink").setName("Preserve the current horizontal scroll position").setDesc("This option will be ignored in PDF embeds."),()=>this.plugin.settings.dontFitWidthWhenOpenPDFLink)),this.addDropdownSetting("paneTypeForFirstPDFLeaf",Fh).setName("How to open PDF links when there is no open PDF file").then(d=>{this.renderMarkdown("This option will be ignored when you press [modifier keys](https://help.obsidian.md/User+interface/Use+tabs+in+Obsidian#Open+a+link) to explicitly specify how to open the link.",d.descEl)}),this.addToggleSetting("openLinkNextToExistingPDFTab").setName("Open PDF links next to an existing PDF tab").then(d=>this.renderMarkdown("If there is a PDF file opened in a tab, clicking a PDF link will first create a new tab next to it and then open the target PDF file in the created tab. This is especially useful when you are spliting the workspace vertically or horizontally and want PDF files to be always opened in one side. This option will be ignored when you press [modifier keys](https://help.obsidian.md/User+interface/Use+tabs+in+Obsidian#Open+a+link) to explicitly specify how to open the link.",d.descEl)),this.addToggleSetting("hoverPDFLinkToOpen").setName("Open PDF link instead of showing popover preview when target PDF is already opened").setDesc(`Press ${fi("Mod").toLowerCase()} while hovering a PDF link to actually open it if the target PDF is already opened in another tab.`),this.addSetting().setName("Open PDF links with an external app").setDesc(createFragment(d=>{d.appendText("See the "),d.appendChild(this.createLinkToHeading("external-app")),d.appendText(" section for the details.")})),this.addSetting().setName("Clear highlights after a certain amount of time").addToggle(d=>{d.setValue(this.plugin.settings.highlightDuration>0).onChange(async h=>{this.plugin.settings.highlightDuration=h?this.plugin.settings.highlightDuration>0?this.plugin.settings.highlightDuration:1:0,await this.plugin.saveSettings(),this.redisplay()})}),this.plugin.settings.highlightDuration>0&&this.addSliderSetting("highlightDuration",.1,10,.05).setName("Highlight duration (sec)"),this.addToggleSetting("ignoreHeightParamInPopoverPreview").setName('Ignore "height" parameter in popover preview').setDesc('Obsidian lets you specify the height of a PDF embed by appending "&height=..." to a link, and this also applies to popover previews. Enable this option if you want to ignore the height parameter in popover previews.'),this.addHeading("Embedding PDF files","embed","picture-in-picture-2"),this.addToggleSetting("dblclickEmbedToOpenLink",()=>this.plugin.loadStyle()).setName("Double click PDF embeds to open links").setDesc("Double-clicking a PDF embed will open the embedded file."),this.addToggleSetting("trimSelectionEmbed",()=>this.redisplay()).setName("Trim selection/annotation embeds").then(d=>{this.renderMarkdown(['(Deprecated in favor of the rectangular selection embed feature introduced in PDF++ 0.36.0)',"When embedding a selection or an annotation from a PDF file, only the target selection/annotation and its surroundings are displayed rather than the entire page."],d.descEl)}),this.plugin.settings.trimSelectionEmbed&&this.addSliderSetting("embedMargin",0,200,1).setName("Selection/annotation embeds margin (px)"),this.addToggleSetting("noSidebarInEmbed").setName("Hide sidebar in PDF embeds embeds or PDF popover previews by default"),this.addToggleSetting("noSpreadModeInEmbed").setName(`Don't display PDF embeds or PDF popover previews in "two page" layout`).setDesc('Regardless of the "two page" layout setting in existing PDF viewer, PDF embeds and PDF popover previews will be always displayed in "single page" layout. You can still turn it on for each embed by clicking the "two page" button in the toolbar, if shown.'),this.addToggleSetting("noTextHighlightsInEmbed").setName("Don't highlight text in a text selection embeds"),this.addToggleSetting("noAnnotationHighlightsInEmbed").setName("Don't highlight annotations in an annotation embeds"),this.addToggleSetting("persistentTextHighlightsInEmbed").setName("Don't clear highlights in a text selection embeds"),this.addToggleSetting("persistentAnnotationHighlightsInEmbed").setName("Don't clear highlights in an annotation embeds"),this.addToggleSetting("embedUnscrollable").setName("Make PDF embeds with a page specified unscrollable").setDesc("After changing this option, you need to reopen tabs or reload the app."),this.addHeading("Backlinks pane for PDF files","backlink-view","links-coming-in").then(d=>this.renderMarkdown("Improve the built-in [backlinks pane](https://help.obsidian.md/Plugins/Backlinks) for better PDF experience.",d.descEl)),this.addToggleSetting("filterBacklinksByPageDefault").setName("Filter backlinks by page by default").setDesc('You can toggle this on and off with the "Show only backlinks in the current page" button at the top right of the backlinks pane.'),this.addToggleSetting("showBacklinkToPage").setName("Show backlinks to the entire page").setDesc("If turned off, only backlinks to specific text selections, annotations or locations will be shown when filtering the backlinks page by page."),this.addToggleSetting("highlightBacklinksPane").setName("Hover sync (PDF viewer \u2192 Backlinks pane)").setDesc("Hovering your mouse over highlighted text or annotation will also highlight the corresponding item in the backlink pane."),this.addToggleSetting("highlightOnHoverBacklinkPane").setName("Hover sync (Backlinks pane \u2192 PDF viewer)").setDesc("In the backlinks pane, hover your mouse over an backlink item to highlight the corresponding text or annotation in the PDF viewer. This option requires reopening or switching tabs to take effect."),this.plugin.settings.highlightOnHoverBacklinkPane&&this.addDropdownSetting("backlinkHoverColor",["",...Object.keys(this.plugin.settings.colors)],d=>d||"PDF++ default",()=>this.plugin.loadStyle()).setName("Highlight color for hover sync (Backlinks pane \u2192 PDF viewer)").setDesc('To add a new color, click the "+" button in the "highlight colors" setting above.'),this.addHeading("Search from links","search-link","lucide-search").then(d=>{this.renderMarkdown(["You can trigger full-text search by opening a link to a PDF file with a search query appended, e.g. `[[file.pdf#search=keyword]]`."],d.descEl)}),this.addHeading("Search options","search-option").then(d=>{this.renderMarkdown(["The behavior of the search links can be customized globally by the following settings. ","Alternatively, you can specify the behavior for each link by including the following query parameters in the link text: ","","- `&case-sensitive=true` or `&case-sensitive=false`","- `&highlight-all=true` or `&highlight-all=false`","- `&match-diacritics=true` or `&match-diacritics=false`","- `&entire-word=true` or `&entire-word=false`"],d.descEl)});let a={true:"Yes",false:"No",default:"Follow default setting"};this.addDropdownSetting("searchLinkCaseSensitive",a).setName("Case sensitive search"),this.addDropdownSetting("searchLinkHighlightAll",a).setName("Highlight all search results"),this.addDropdownSetting("searchLinkMatchDiacritics",a).setName("Match diacritics"),this.addDropdownSetting("searchLinkEntireWord",a).setName("Match whole word"),this.addHeading("Integration with external apps (desktop-only)","external-app","lucide-share"),this.addToggleSetting("openPDFWithDefaultApp",()=>this.redisplay()).setName("Open PDF links with an external app").setDesc("Open PDF links with the OS-defined default application for PDF files."),this.plugin.settings.openPDFWithDefaultApp&&this.addToggleSetting("openPDFWithDefaultAppAndObsidian").setName("Open PDF links in Obsidian as well").setDesc("Open the same PDF file both in the default app and Obsidian at the same time."),this.addToggleSetting("syncWithDefaultApp").setName("Sync the external app with Obsidian").setDesc("When you focus on a PDF file in Obsidian, the external app will also focus on the same file."),this.addToggleSetting("focusObsidianAfterOpenPDFWithDefaultApp").setName("Focus Obsidian after opening a PDF file with an external app").setDesc("Otherwise, the focus will be moved to the external app."),this.addHeading("View Sync","view-sync","lucide-eye").then(d=>{this.renderMarkdown(["Integrate more seamlessly with the [View Sync](https://github.com/RyotaUshio/obsidian-view-sync) plugin."],d.descEl)}),this.addToggleSetting("viewSyncFollowPageNumber",()=>this.redisplay()).setName("Sync page number"),this.plugin.settings.viewSyncFollowPageNumber&&this.addSliderSetting("viewSyncPageDebounceInterval",.1,1,.05).setName("Minimum update interval of the View Sync file (sec)"),this.addHeading("Dummy PDFs for external files","dummy","lucide-file-symlink").then(d=>{this.renderMarkdown(["Using dummy PDF files, you can seamlessly integrate PDF files located outside your vault as if they were inside. Note that this is an experimental feature.","[Learn more](https://ryotaushio.github.io/obsidian-pdf-plus/external-pdf-files.html)"],d.descEl)}),this.addAttachmentLocationSetting("dummyFileFolderPath","Dummy PDFs",(d,h,u)=>{d.setName("Default location for new dummy PDF files").setDesc(`Where newly created dummy PDF files are placed. If set to "${Sx.obsidian}", dummy files will be saved in the folder specified in Obsidian settings > Files and links > Default location for new attachments.`),h.setName("Dummy file folder path").setDesc("Place newly created dummy PDF files in this folder."),u.setName("Subfolder name").setDesc('If your file is under "vault/folder", and you set subfolder name to "attachments", dummy PDF files will be saved to "vault/folder/attachments".')}),this.addSetting("modifierToDropExternalPDFToCreateDummy").setName("Modifier key to create a dummy PDF file on drag & drop").setDesc("After dragging an external PDF file, drop it on the editor while pressing this modifier key to create a dummy file and insert a link to it. You can drag a URL to a PDF file on the web from within your browser (link, URL bar, bookmark, etc.) or a PDF file on your desktop machine from your file manager ("+(re.Platform.isMacOS?"Finder":"File Explorer")+" etc.). Note that on mobile, you might need to start pressing the modifier key before starting the drag operation.").addDropdown(d=>{let h=re.Platform.isMacOS||re.Platform.isIosApp?"Alt":"Ctrl";for(let u of[[],["Shift"],[h],[h,"Shift"]])d.addOption(u.join("+"),u.length?u.map(fi).join("+"):"None");d.setValue(this.plugin.settings.modifierToDropExternalPDFToCreateDummy.join("+")).onChange(async u=>{this.plugin.settings.modifierToDropExternalPDFToCreateDummy=u.split("+"),await this.plugin.saveSettings()})}),this.addSetting("externalURIPatterns").setName("URI patterns for PDF files").setDesc("Specify the URI pattens for PDFs in regular expressions. When dragging and dropping a URI/URL from your browser to Obsidian's editor, it will be used to check if the destination file is a PDF file. If you need multiple patterns, separate them with a new line.").addTextArea(d=>{d.inputEl.rows=8,d.inputEl.cols=30,d.setValue(this.plugin.settings.externalURIPatterns.join(` +`)),this.component.registerDomEvent(d.inputEl,"focusout",async()=>{let h=d.inputEl.value;this.plugin.settings.externalURIPatterns=h.split(` +`).map(u=>u.trim()).filter(u=>u),await this.plugin.saveSettings()})}),this.addHeading("Vim keybindings","vim","vim").then(d=>this.renderMarkdown("Tracked at [this GitHub issue](https://github.com/RyotaUshio/obsidian-pdf-plus/issues/119).",d.descEl)),this.addSetting().then(d=>{this.renderMarkdown(['The default keybindings are as follows. You can customize them be creating a "vimrc" file and providing its path in the setting below.',"","- `j`/`k`/`h`/`l`: Scroll down/up/left/right","- `J`: Go to next page","- `K`: Go to previous page","- `gg`: Go to first page","- `G`: Go to last page","- `0`/`^`/`H`: Go to top of current page","- `$`/`L`: Go to bottom of current page","- ``/``: Scroll down/up as much as the viewer height (`C`=`Ctrl`)","- ``/``: Scroll down/up half as much as the viewer height","- `/`/`?`: Search forward/backward","- `n`/`N`: Go to next/previous match","- `gn`/`gN`: Select search result","- `+`/`zi`: Zoom in","- `-`/`zo`: Zoom out","- `=`/`z0`: Reset zoom","- `r`: Rotate pages clockwise","- `R`: Rotate pages counterclockwise","- `y`: Yank (copy) selected text",`- \`c\`: Run the "${this.plugin.lib.commands.stripCommandNamePrefix(this.plugin.lib.commands.getCommand("copy-link-to-selection").name)}" command`,"- `C`: Show context menu at text selection","- `o`: Swap the start and end of the selection","- `:`: Enter command-line mode (experimental)","- ``: Toggle outline (table of contents)","- ``: Toggle thumbnails (`S`=`Shift`)","- `f`: Enter hint mode by running `:hint` (experimental)","- ``: Go back to normal mode, abort search, etc","","Many of the commands above can be combined with counts. For example:","- `2j` scrolls down the page twice as much as `j`.","- `2J` advances two pages.","- `10G` takes you to page 10.","- `150=` sets the zoom level to 150%."],d.descEl)}),this.addToggleSetting("vim",()=>this.events.trigger("update")).setName("Enable").setDesc("Reopen the PDF viewers after changing this option."),this.showConditionally([this.addTextSetting("vimrcPath",void 0,()=>this.plugin.vimrc=null).setName("Vimrc file path (optional)").then(async d=>{await this.renderMarkdown(["Only the [Ex commands supported by PDF++](https://github.com/RyotaUshio/obsidian-pdf-plus/blob/main/src/vim/ex-commands.ts) are allowed.","","Example (not necessarily recommendations):","```",'" Use j/k, instead of J/K, to go to the next page',"map j J","map k K","",'" JavaScript commands','" - Hit Ctrl-h in Normal mode to show a message','nmap :js alert("Hello, world!")','" - Hit Ctrl-h in Visual mode to run a .js file',"vmap :jsfile filename.js","",'" Obsidian commands','" - Open the current PDF in the OS-default app by hitting d, e, and then f',"map def :obcommand open-with-default-app:open",'" - Go back and forth the history with Ctrl-o and Ctrl-i',"map :obcommand app:go-back","map :obcommand app:go-forward","```","","After changing the path or the file content, you need to reopen the PDF viewer. If the vimrc file is a hidden file or is under a hidden folder, you need to reload PDF++ or the app."],d.descEl);let h=d.components[0].inputEl;new wc(this.app,h).onSelect(({item:u})=>{this.plugin.settings.vimrcPath=u.path,this.plugin.saveSettings()})}),this.addHeading("Visual mode","vim-visual"),this.addToggleSetting("vimVisualMotion").setName("Enter visual mode on text selection").then(d=>{this.renderMarkdown(["When some text is selected, you can modify the range of selection using the `j,` `k`, `h`, `l`, `w`, `e`, `b`, `0`, `^`, `$`, `H`, and `L` keys, similarly to Vim's visual mode (`H`/`L` are mapped to `^`/`$` by default). If disabled, you can use `j`/`k`/`h`/`l`/`0`/`^`/`$`/`H`/`L` keys to scroll the page regardless of text selection. Reload the viewer or the app after changing this option.","","Tips:","- You can use `o` to swap the start and end of the selection.","- As you know, `/` and `?` keys initiate search. Pressing `gn`/`gN` after the search will select the search result. You can also use search to extend the current selection to the search result.","","Note: On mobile, word-wise motions (`w`/`e`/`b`) might not work as expected around punctuations. Contributions to fix this are welcome!"],d.descEl)}),this.addHeading("Outline mode","vim-outline"),this.addToggleSetting("enableVimOutlineMode").setName("Enter outline mode when opening PDF outline view").then(d=>{this.renderMarkdown(["If enabled, you will enter the outline mode by opening the PDF outline view (from the icon in the toolbar or by ``), and you can use the following keybindings, similarly to [Zathura](https://pwmt.org/projects/zathura/)'s index mode.","","- `j`: Move down","- `k`: Move up","- `h`: Collapse & move to parent entry","- `l`: Expand entry & move to child entry","- `H`: Collapse all entries","- `L`: Expand all entries","- `/`: Open the selected entry (``=`Enter`)","- ``: Close sidebar and go back to normal mode","","If disabled, you can use j/k/h/l/H/L keys to scroll the page whether the outline view is opened or not. ","This option requires reload to take effect."],d.descEl)}),this.addToggleSetting("vimSmoothOutlineMode").setName("Smooth motion in outline mode"),this.addHeading("Command-line mode (experimental)","vim-command-line"),this.addSetting().then(d=>{this.renderMarkdown(['By pressing `:`, you can enter the command-line mode, where you can execute various commands called "Ex commands"',"","- You can always go back to normal mode by ``.","- For some commands, you can run `:help :` or `:h :` to see the help message.","- Use `` and `` to navigate through the suggestions (`S`=`Shift`).","- Use arrow down/up keys to go back and forth the command history.","- `` clears the command line, and `` deletes the last word (`C`=`Ctrl`).",'- `:` will take you to the -th page, where the page number always starts from 1. To go to the page with the page label (e.g. "i, ii, ..., x, 1, 2, ..."), use `:gotopage ` (or `:go `/`:goto ` in short).','- `:!` runs the shell command (not supported on mobile). By default, Obsidian does not know the value of the "PATH" environment variable, so you might need to explicitly provide it in the setting below (in the "Misc" section) to run some commands.'],d.descEl)}),this.addHeading("Hint mode (experimental)","vim-hint"),this.addSetting().then(d=>{this.renderMarkdown(["Hitting `f` will enter the hint mode, where you can perform certain actions on links, annotations, and backlink highlighting in the PDF page without using the mouse.",'For example, first press `f` to enter the hint mode, and if the link you want to open gets marked with "HK", then hit `h` and then `k` (without `Shift`) to open it.',"","This is inspired by [Tridactyl](https://github.com/tridactyl/tridactyl)'s hint mode.","","Also check out Style Settings > PDF++ > Vim keybindings > Hint mode."],d.descEl)}),this.addTextSetting("vimHintChars").setName("Characters to use in hint mode").setDesc(`They are used preferentially from left to right, so you might want to put the easier-to-reach keys first. This is the same as Tridactyl's "hintchars" option.`),this.addTextSetting("vimHintArgs").setName('Default arguments for the ":hint" Ex command').setDesc('Space-separated list of "link"/"annot"/"backlink" or "all". Run ":help :hint" for the details.'),this.addHeading("Context menu","vim-context-menu"),this.addToggleSetting("enableVimInContextMenu").setName("Enable Vim keys in PDF context menus").setDesc("If enabled, you can use j/k/h/l keys, instead of the arrow keys, to navigate through context menu items in the PDF viewer."),this.addHeading("Scrolling","vim-scroll"),this.addSliderSetting("vimScrollSize",5,500,5).setName("Scroll size (px) of the jkhl keys").setDesc("The size of scroll when one of the jkhl keys is pressed once."),this.addToggleSetting("vimLargerScrollSizeWhenZoomIn").setName("Increase scroll size when zoomed in"),this.addSliderSetting("vimContinuousScrollSpeed",.1,5,.1).setName("Speed of continuous scroll (px per ms)").setDesc("The speed of scroll when pressing and holding down the jkhl keys."),this.addToggleSetting("vimSmoothScroll").setName("Smooth scroll"),this.addHeading("Search","vim-search"),this.addToggleSetting("vimHlsearch").setName("hlsearch").setDesc("If enabled, all matches will be highlighted."),this.addToggleSetting("vimIncsearch").setName("incsearch").setDesc("Incremental search: while typing the search query, update the search results after every keystroke. If disabled, the results will be shown only after pressing Enter.")],()=>this.plugin.settings.vim),this.addHeading("Misc","misc","lucide-more-horizontal"),this.addToggleSetting("showStatusInToolbar").setName("Show status in PDF toolbar").setDesc('For example, when you copy a link to a text selection in a PDF file, the status "Link copied" will be displayed in the PDF toolbar.'),this.addFileLocationSetting("newPDFLocation",d=>d.setName("Default location for new PDFs").setDesc('The "Create new PDF" command will create a new PDF file in the location specified here.'),"newPDFFolderPath",d=>d.setName("Folder to create new PDFs in").setDesc("Newly created PDFs will appear under this folder.")),this.addToggleSetting("hideReplyAnnotation").setName("Hide reply annotations").then(d=>{this.renderMarkdown(["Hide annotations that are replies to other annotations in the PDF viewer.","","This is a temporary fix for the issue that PDF.js (the library Obsidian's PDF viewer is based on) does not fulfill the PDF specification in that it renders reply annotations as if a standalone annotation."],d.descEl)}),this.addToggleSetting("removeWhitespaceBetweenCJChars").setName("Remove half-width whitespace between two Chinese/Japanese characters when copying text").setDesc("Such whitespace can be introduced as a result of poor post-processing of OCR (optical character recognition). Enable this option to remove it when copying links to text selections."),this.addToggleSetting("copyAsSingleLine").setName("Override the default copy behavior in the PDF viewer").then(d=>{d.descEl.appendText('If enabled, whenever you copy text from the PDF viewer (using Ctrl/Cmd+C or via context menu), the text will go through the same pre-processing as the "'+this.plugin.lib.commands.stripCommandNamePrefix(this.plugin.lib.commands.getCommand("copy-link-to-selection").name)+'" command before written to the clipboard. The pre-processing includes transforming multi-line text into a single line by removing line breaks (if a word is split across lines, it will be concatenated), which is useful because it prevents the copied text from being split into multiple lines unnaturally. If the previous option is enabled, the whitespace removal will also be applied.'),d.descEl.appendText(' Also note that on mobile devices, the action performed by "Copy" depends on the '),d.descEl.appendChild(this.createLinkTo("mobileCopyAction")),d.descEl.appendText(" option.")}),re.Platform.isDesktopApp&&this.addTextAreaSetting("PATH").then(d=>{let h=d.components[0];h instanceof re.TextAreaComponent&&(h.inputEl.rows=8,h.inputEl.cols=30)}).setName('"PATH" environment variable').setDesc('Provide the "PATH" environment variable for PDF++ to run shell commands without the full paths specified. In MacOS and Linux, you can run "echo $PATH" in Terminal and then copy & paste the result here. Currently, it will be used only when you run ":!" in Vim mode.'),this.addHeading("Style settings","style-settings","lucide-settings-2").setDesc("You can find more options in Style Settings > PDF++.").addButton(d=>{d.setButtonText("Open style settings").onClick(()=>{let h=this.app.setting.pluginTabs.find(u=>u.id==="obsidian-style-settings");h?this.app.setting.openTab(h):open("obsidian://show-plugin?id=obsidian-style-settings")})}),this.addFundingButton(),await Promise.all(this.promises)}async hide(){this.plugin.settings.colors=Object.fromEntries(Object.entries(this.plugin.settings.colors).filter(([e,i])=>e&&Ki(i))),this.plugin.settings.defaultColor&&!(this.plugin.settings.defaultColor in this.plugin.settings.colors)&&(this.plugin.settings.defaultColor=""),this.plugin.settings.backlinkHoverColor&&!(this.plugin.settings.backlinkHoverColor in this.plugin.settings.colors)&&(this.plugin.settings.backlinkHoverColor=""),this.plugin.settings.copyCommands=this.plugin.settings.copyCommands.filter(e=>e.name&&e.template),this.plugin.settings.displayTextFormats=this.plugin.settings.displayTextFormats.filter(e=>e.name),this.plugin.settings.enablePDFEdit&&!this.plugin.settings.author&&(this.plugin.settings.enablePDFEdit=!1,new re.Notice(`${this.plugin.manifest.name}: Cannot enable writing highlights into PDF files because the "Annotation author" option is empty.`)),this.plugin.validateAutoFocusAndAutoPasteSettings(),await this.plugin.saveSettings(),this.plugin.loadStyle(),this.promises=[],this.component.unload()}};var Ex=async(n,t,e)=>{if(t.palette){if(Ce.Platform.isDesktopApp){let i=window.electron;i&&e.isTrusted&&(e.stopPropagation(),e.stopImmediatePropagation(),await new Promise(r=>{let o=e.win.setTimeout(()=>r(null),1e3);i.ipcRenderer.once("context-menu",(s,a)=>{e.win.clearTimeout(o),r(a)}),i.ipcRenderer.send("context-menu")}))}e.defaultPrevented||await cg(n,t,e)}};async function cg(n,t,e){let i=await la.fromMouseEvent(n,t,e);t.clearEphemeralUI(),i.showAtMouseEvent(e),t.pdfViewer.isEmbed&&e.preventDefault()}async function Dh(n,t,e){if(!e||!e.focusNode||e.isCollapsed)return;let i=e.focusNode,r=e.focusOffset,o=i.doc,s=o.createRange();s.setStart(i,r),s.setEnd(i,r);let{x:a,y:c}=s.getBoundingClientRect(),l=new la(n,t);await l.addItems(),t.clearEphemeralUI(),n.shownMenus.forEach(d=>d.hide()),l.showAtPosition({x:a,y:c},o)}var Ax=(n,t,e)=>{var o;let{lib:i}=n,r=e.targetNode;if(r&&r.instanceOf(HTMLElement)&&r.hasClass("thumbnail")&&r.dataset.pageNumber!==void 0){let s=parseInt(r.dataset.pageNumber);if(Number.isNaN(s))return;let a=t.getMarkdownLink(`#page=${s}`,t.getPageLinkAlias(s)),l=(o=t.getPage(s).pageLabel)!=null?o:""+s,d=t.pdfViewer.pagesCount,h=""+s===l?`Copy link to page ${s}`:`Copy link to page ${l} (${s}/${d})`,u=new Ce.Menu().addItem(f=>{f.setTitle(h).setIcon("lucide-copy").onClick(()=>{var g;((g=e.view)!=null?g:activeWindow).navigator.clipboard.writeText(a);let p=t.file;p&&(n.lastCopiedDestInfo={file:p,destArray:[s-1,"XYZ",null,null,null]})})});i.isEditable(t)&&u.addItem(f=>{f.setTitle("Insert page before this page").setIcon("lucide-plus").onClick(()=>{let p=t.file;if(!p){new Ce.Notice(`${n.manifest.name}: Failed to insert the page.`);return}i.commands._insertPage(p,s,s)})}).addItem(f=>{f.setTitle("Insert page after this page").setIcon("lucide-plus").onClick(()=>{let p=t.file;if(!p){new Ce.Notice(`${n.manifest.name}: Failed to insert the page.`);return}i.commands._insertPage(p,s+1,s)})}).addItem(f=>{f.setTitle("Delete page").setIcon("lucide-trash").onClick(()=>{let p=t.file;if(!p){new Ce.Notice(`${n.manifest.name}: Failed to delete the page.`);return}i.commands._deletePage(p,s)})}).addItem(f=>{f.setTitle("Extract page to new file").setIcon("lucide-file-output").onClick(()=>{let p=t.file;if(!p){new Ce.Notice(`${n.manifest.name}: Failed to extract the page.`);return}i.commands._extractPage(p,s)})}).addItem(f=>{f.setTitle("Divide document at this page").setIcon("lucide-split-square-vertical").onClick(()=>{let p=t.file;if(!p){new Ce.Notice(`${n.manifest.name}: Failed to divide the document.`);return}i.commands._dividePDF(p,s)})}).addSeparator().addItem(f=>{f.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{n.openSettingTab().scrollToHeading("thumbnail")})}),u.showAtMouseEvent(e)}},Ix=(n,t,e,i,r)=>{let{app:o,lib:s}=n;t.pdfViewer.isEmbed&&r.preventDefault();let a=s.toSingleLine(i.item.title),c=a?`Copy link to "${a.length<=40?a:a.slice(0,39).trim()+"\u2026"}"`:"Copy link to section",l=new Ce.Menu().addItem(d=>{d.setTitle(c).setIcon("lucide-copy").onClick(async()=>{var f;let h=await s.copyLink.getTextToCopyForOutlineItem(t,e,i);((f=r.view)!=null?f:activeWindow).navigator.clipboard.writeText(h);let u=i.item.dest;if(typeof u=="string")n.lastCopiedDestInfo={file:e,destName:u};else{let p=await i.getPageNumber(),g=s.normalizePDFJsDestArray(u,p);n.lastCopiedDestInfo={file:e,destArray:g}}})});s.isEditable(t)&&l.addItem(d=>{d.setTitle("Add subitem").setIcon("lucide-plus").onClick(()=>{new Fr(n,"Add subitem to outline").ask().then(async({title:h})=>{let u=s.getPDFViewFromChild(t);if(u){let f=u.getState(),p=s.viewStateToDestArray(f,!0);if(p){await Te.findAndProcessOutlineItem(i,g=>{g.createChild(h,p).updateCountForAllAncestors(),g.sortChildren()},e,n);return}}new Ce.Notice(`${n.manifest.name}: Failed to add the subitem.`)})})}).addItem(d=>{d.setTitle("Rename...").setIcon("lucide-pencil").onClick(()=>{new Fr(n,"Rename outline item").presetTitle(i.item.title).ask().then(async({title:h})=>{await Te.findAndProcessOutlineItem(i,u=>{u.title=h},e,n)})})}).addItem(d=>{d.setTitle("Move item to...").setIcon("lucide-folder-tree").onClick(async()=>{let h=await Te.fromFile(e,n),u=await h.findPDFjsOutlineTreeNode(i);if(!u){new Ce.Notice(`${n.manifest.name}: Failed to load the PDF document.`);return}new fh(h,u).askDestination().then(async f=>{f.appendChild(u),f.sortChildren();let p=await h.doc.save();await o.vault.modifyBinary(e,p)})})}).addItem(d=>{d.setTitle("Delete").setIcon("lucide-trash").onClick(async()=>{await Te.findAndProcessOutlineItem(i,h=>{h.remove(),h.updateCountForAllAncestors()},e,n)})}).addItem(d=>{d.setTitle("Extract to new file").setIcon("lucide-file-output").onClick(async()=>{let{lib:h,settings:u}=n,f=await Te.fromFile(e,n),p=await f.findPDFjsOutlineTreeNode(i);if(!p){new Ce.Notice(`${n.manifest.name}: Failed to process the outline item.`);return}let{doc:g}=f,m=p.getExplicitDestination(),b=m?m[0]+1:null,w=null,F=p;for(;!F.nextSibling&&F.parent;)F=F.parent;let v=F.nextSibling;if(v){let k=v.getExplicitDestination();k&&(w=k[0]+1)}else w=g.getPageCount()+1;if(b===null||w===null){new Ce.Notice(`${n.manifest.name}: Failed to fetch page numbers from the outline item.`);return}if(b>w){new Ce.Notice(`${n.manifest.name}: The page numbers are invalid: the beginning of this section is page ${b}, whereas the next section starts at page ${w}.`);return}b===w&&(w=b+1);let P=h.getAvailablePathForCopy(e);new Nn(n,u.askPageLabelUpdateWhenExtractPage,u.pageLabelUpdateWhenExtractPage,u.askExtractPageInPlace,u.extractPageInPlace).ask().then((k,T)=>{h.composer.extractPages(e,{from:b,to:w-1},P,!1,k,T).then(async D=>{if(!D){new Ce.Notice(`${n.manifest.name}: Failed to extract section from PDF.`);return}if(u.openAfterExtractPages){let C=h.workspace.getLeaf(u.howToOpenExtractedPDF);await C.openFile(D),await h.workspace.revealLeaf(C)}})})})}).addSeparator().addItem(d=>{d.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{n.openSettingTab().scrollToHeading("outline")})}),l.showAtMouseEvent(r)},Lx=(n,t,e,i)=>{let{lib:r}=n;r.isEditable(t)&&new Ce.Menu().addItem(o=>{o.setTitle("Add top-level item").setIcon("lucide-plus").onClick(()=>{new Fr(n,"Add item to outline").ask().then(async({title:s})=>{let a=r.getPDFViewFromChild(t);if(a){let c=a.getState(),l=r.viewStateToDestArray(c,!0);if(l){await Te.processOutlineRoot(d=>{d.createChild(s,l).updateCountForAllAncestors(),d.sortChildren()},e,n);return}}new Ce.Notice(`${n.manifest.name}: Failed to add the item.`)})})}).showAtMouseEvent(i)},lg=class extends Ce.Menu{constructor(e){super();this.plugin=e}get app(){return this.plugin.app}get settings(){return this.plugin.settings}get lib(){return this.plugin.lib}},la=class extends lg{constructor(e,i){super(e);this.child=i,this.setUseNativeMenu(!1),this.addSections(Object.keys(Hn.contextMenuConfig)),e.settings.enableVimInContextMenu&&eg(this)}static async fromMouseEvent(e,i,r){let o=new la(e,i);return await o.addItems(r),o}get win(){return this.child.containerEl.win}async addItems(e){var b,w;let{child:i,plugin:r,lib:o,app:s}=this,a=i.pdfViewer.pdfViewer,c=this.win.getSelection(),l=(b=o.copyLink.getPageAndTextRangeFromSelection(c))!=null?b:a?{page:a.currentPageNumber}:null;if(!l)return;let{page:d,selection:h}=l,u=o.toSingleLine((w=c==null?void 0:c.toString())!=null?w:""),f=F=>{var v;return(v=this.settings.contextMenuConfig.find(P=>P.id===F))==null?void 0:v.visible};Ce.Platform.isMacOS&&Ce.Platform.isDesktopApp&&this.win.electron&&u&&f("action")&&this.addItem(F=>F.setSection("action").setTitle(`Look up "${u.length<=25?u:u.slice(0,24).trim()+"\u2026"}"`).setIcon("lucide-library").onClick(()=>{this.win.electron.remote.getCurrentWebContents().showDefinitionForSelection()})),u&&u&&h&&i.palette&&(f("selection")&&Ho.create(this,i.palette).setSection("selection","Copy link to selection","lucide-copy").addItems(r.settings.selectionProductMenuConfig).onItemClick(({copyFormat:F,displayTextFormat:v,colorName:P})=>{o.copyLink.copyLinkToSelection(!1,{copyFormat:F,displayTextFormat:v},P!=null?P:void 0)}),o.isEditable(i)&&f("write-file")&&Ho.create(this,i.palette).setSection("write-file",`Add ${r.settings.selectionBacklinkVisualizeStyle} to file`,"lucide-edit").setShowNoColorButton(!1).addItems(r.settings.writeFileProductMenuConfig).onItemClick(({copyFormat:F,displayTextFormat:v,colorName:P})=>{o.copyLink.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(!1,{copyFormat:F,displayTextFormat:v},P!=null?P:void 0)}));let p=i.getPage(d),g=e&&i.getAnnotationFromEvt(p,e),m=null;if(await(async()=>{var F;if(g){let{id:v}=o.getAnnotationInfoFromAnnotationElement(g);if(m=await i.getAnnotatedText(p,v),i.palette&&f("annotation")&&Ho.create(this,i.palette).setSection("annotation","Copy link to annotation","lucide-copy").addItems(r.settings.annotationProductMenuConfig).onItemClick(({copyFormat:P,displayTextFormat:k})=>{o.copyLink.copyLinkToAnnotation(i,!1,{copyFormat:P,displayTextFormat:k},d,v,!1,!0)}),o.isEditable(i)&&f("modify-annotation")){if(r.settings.enableAnnotationContentEdit&&Mn.isSubtypeSupported(g.data.subtype)){let P=g.data.subtype;this.addItem(k=>k.setSection("modify-annotation").setTitle("Edit annotation").setIcon("lucide-pencil").onClick(()=>{i.file&&Mn.forSubtype(P,r,i.file,d,v).open()}))}r.settings.enableAnnotationDeletion&&this.addItem(P=>P.setSection("modify-annotation").setTitle("Delete annotation").setIcon("lucide-trash").onClick(()=>{i.file&&new oa(r,i.file,d,v).openIfNeccessary()}))}if(g.data.subtype==="Link"&&f("link")){let P=(F=i.pdfViewer.pdfViewer)==null?void 0:F.pdfDocument;if("dest"in g.data&&typeof g.data.dest=="string"&&P&&i.file){let k=g.data.dest,T=i.file;this.addItem(D=>{D.setSection("link").setTitle("Copy PDF link").setIcon("lucide-copy").onClick(async()=>{let C=await o.destIdToSubpath(k,P);if(typeof C=="string"){let O=m;!O&&g.data.rect&&(O=i.getTextByRect(p,g.data.rect));let E=o.generateMarkdownLink(T,"",C,O!=null?O:void 0).slice(1);navigator.clipboard.writeText(E),r.lastCopiedDestInfo={file:T,destName:k}}})}),k.startsWith("cite.")&&this.addItem(D=>{D.setSection("link").setTitle("Search on Google Scholar").setIcon("lucide-search").onClick(()=>{var O;let C=(O=this.child.bib)==null?void 0:O.getGoogleScholarSearchUrlFromDest(k);if(typeof C!="string"){new Ce.Notice(`${r.manifest.name}: Failed to find bibliographic information.`);return}window.open(C,"_blank")})})}if("url"in g.data&&typeof g.data.url=="string"){let k=g.data.url;this.addItem(T=>{T.setSection("link").setTitle("Copy URL").setIcon("lucide-copy").onClick(()=>{navigator.clipboard.writeText(k)})})}}}})(),u&&h&&o.isEditable(i)&&r.lastCopiedDestInfo&&r.lastCopiedDestInfo.file===i.file&&f("link")){if("destArray"in r.lastCopiedDestInfo){let F=r.lastCopiedDestInfo.destArray;this.addItem(v=>v.setSection("link").setTitle("Paste copied PDF link to selection").setIcon("lucide-clipboard-paste").onClick(()=>{o.highlight.writeFile.addLinkAnnotationToSelection(F)}))}else if("destName"in r.lastCopiedDestInfo){let F=r.lastCopiedDestInfo.destName;this.addItem(v=>v.setSection("link").setTitle("Paste copied link to selection").setIcon("lucide-clipboard-paste").onClick(()=>{o.highlight.writeFile.addLinkAnnotationToSelection(F)}))}}u&&f("text")&&this.addItem(F=>F.setSection("text").setTitle("Copy selected text").setIcon("lucide-copy").onClick(()=>{var v;navigator.clipboard.writeText(this.plugin.settings.copyAsSingleLine?u:(v=c==null?void 0:c.toString())!=null?v:"")})),m&&f("text")&&this.addItem(F=>F.setSection("text").setTitle("Copy annotated text").setIcon("lucide-copy").onClick(()=>{navigator.clipboard.writeText(m)})),u&&h&&f("search")&&this.addItem(F=>{F.setSection("search").setTitle("Copy link to search").setIcon("lucide-search").onClick(()=>{o.copyLink.copyLinkToSearch(!1,i,d,u.trim())})}),o.speech.isEnabled()&&u&&f("speech")&&this.addItem(F=>{F.setSection("speech").setTitle("Read aloud selected text").setIcon("lucide-speech").onClick(()=>{o.speech.speak(u)})}),!this.items.length&&f("page")&&this.addItem(F=>{F.setSection("page").setTitle("Copy link to page").setIcon("lucide-copy").onClick(v=>{let P=i.getMarkdownLink(`#page=${d}`,i.getPageLinkAlias(d));v.win.navigator.clipboard.writeText(P);let k=i.file;k&&(r.lastCopiedDestInfo={file:k,destArray:[d-1,"XYZ",null,null,null]})})}),this.items.length&&f("settings")&&this.addItem(F=>{F.setSection("settings").setIcon("lucide-settings").setTitle("Customize menu...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("context-menu")})}),s.workspace.trigger("pdf-menu",this,{pageNumber:d,selection:u,annot:g})}},Ho=class extends de{constructor(e,i){super(i.plugin);this.clickItemCallback=null;this.itemToColorName=new Map;this.itemToCopyFormat=new Map;this.itemToDisplayTextFormat=new Map;this.rootMenu=e,this.palette=i,this.showNoColorButton=this.settings.noColorButtonInColorPalette}static create(e,i){return e.addChild(new Ho(e,i))}then(e){return e(this),this}setShowNoColorButton(e){return this.showNoColorButton=e,this}setSection(e,i,r){return this.section=e,this.sectionTitle=i,this.sectionIcon=r,this}addSectionTitle(){this.section&&this.sectionTitle&&this.rootMenu.addItem(e=>{e.setSection(this.section).setTitle(this.sectionTitle).setDisabled(!0),this.sectionIcon&&e.setIcon(this.sectionIcon)})}addItems(e){return this.addSectionTitle(),Ce.Platform.isDesktopApp||(e=e.slice(0,1)),vx(this.rootMenu,e.map(i=>{switch(i){case"color":return this.addColorItems.bind(this);case"copy-format":return this.addCopyFormatItems.bind(this);case"display":return this.addDisplayTextItems.bind(this)}}),{clickableParentItem:!0,vim:this.settings.enableVimInContextMenu}),this}addColorItems(e){let i=Object.keys(this.settings.colors),r=this.palette.getState().selectedColorName,o=r?i.map(s=>s.toLowerCase()).indexOf(r.toLowerCase()):-1;for(let s=this.showNoColorButton?-1:0;s{a.setTitle(s>=0?i[s]:"Don't specify color").onClick(()=>{this.finish({colorName:s>=0?i[s]:null})}),e!==this.rootMenu&&a.setChecked(s===o),this.section&&e===this.rootMenu&&a.setSection(this.section),this.itemToColorName.set(a,s>=0?i[s]:null);let c=this.settings.colors[s>=0?i[s]:"transparent"];a.dom.addClass("pdf-plus-color-menu-item"),a.titleEl.before(createDiv("pdf-plus-color-indicator",l=>{l.setCssStyles({backgroundColor:c})}))});$p(e,100)}addNamedTemplateItems(e,i,r,o,s){for(let a=0;a{c.setTitle(i[a].name).onClick(()=>{s(i[a])}),e!==this.rootMenu&&c.setChecked(a===r),o.set(c,i[a].template),this.section&&e===this.rootMenu&&c.setSection(this.section)});$p(e,100)}addDisplayTextItems(e){this.addNamedTemplateItems(e,this.settings.displayTextFormats,this.palette.getState().displayTextFormatIndex,this.itemToDisplayTextFormat,({template:i})=>this.finish({displayTextFormat:i}))}addCopyFormatItems(e){this.addNamedTemplateItems(e,this.settings.copyCommands,this.palette.getState().actionIndex,this.itemToCopyFormat,({template:i})=>this.finish({copyFormat:i}))}getOptionsFromColorPalette(){return{colorName:this.palette.getColorName(),copyFormat:this.palette.getCopyFormat(),displayTextFormat:this.palette.getDisplayTextFormat()}}getOptions(e){let i=this.getOptionsFromColorPalette();if(Ce.Platform.isDesktopApp){let{items:r}=Fx(this.rootMenu);for(let o of r)this.itemToColorName.has(o)?i.colorName=this.itemToColorName.get(o):this.itemToCopyFormat.has(o)?i.copyFormat=this.itemToCopyFormat.get(o):this.itemToDisplayTextFormat.has(o)&&(i.displayTextFormat=this.itemToDisplayTextFormat.get(o))}return Object.assign(i,e),i}updateColorPaletteState(e){let i=e.colorName,r=this.settings.copyCommands.findIndex(({template:s})=>s===e.copyFormat),o=this.settings.displayTextFormats.findIndex(({template:s})=>s===e.displayTextFormat);this.palette.setState({selectedColorName:i,actionIndex:r,displayTextFormatIndex:o}),this.settings.syncColorPaletteItem&&this.settings.syncDefaultColorPaletteItem&&(this.settings.defaultColorPaletteItemIndex=i?Object.keys(this.settings.colors).indexOf(i)+1:0),this.settings.syncColorPaletteAction&&this.settings.syncDefaultColorPaletteAction&&(this.settings.defaultColorPaletteActionIndex=r),this.plugin.settings.syncDisplayTextFormat&&this.plugin.settings.syncDefaultDisplayTextFormat&&(this.plugin.settings.defaultDisplayTextFormatIndex=o),this.plugin.trigger("color-palette-state-change",{source:this.palette})}finish(e){var r;let i=this.getOptions(e);this.settings.updateColorPaletteStateFromContextMenu&&this.updateColorPaletteState(i),(r=this.clickItemCallback)==null||r.call(this,i),this.rootMenu.hide()}onItemClick(e){this.clickItemCallback=e}},Ox=(n,t,e)=>{var l;if(n.defaultPrevented||(l=activeWindow.getSelection())!=null&&l.toString())return;let{lib:i,settings:r,child:o}=t;if(e.page){let d=o.getPage(e.page);if(o.getAnnotationFromEvt(d,n))return}let s=e.getColor(),a=(s==null?void 0:s.type)==="name"?s.name:void 0,c=new Ce.Menu().addSections(["copy","color","image"]);s&&c.addItem(d=>{d.setSection("color").setTitle("Unset color").setIcon("lucide-palette").onClick(()=>{i.composer.linkUpdater.updateLinkColor(e.refCache,e.sourcePath,null)})});for(let d of Object.keys(r.colors))d.toLowerCase()!==(a==null?void 0:a.toLowerCase())&&c.addItem(h=>{h.setSection("color").setTitle(`Change color to "${d}"`).setIcon("lucide-palette").onClick(()=>{i.composer.linkUpdater.updateLinkColor(e.refCache,e.sourcePath,{type:"name",name:d})})});if(e.page&&e.FitR){let d=o.getPage(e.page).pdfPage,{left:h,bottom:u,right:f,top:p}=e.FitR;c.addItem(g=>{g.setSection("image").setTitle("Copy as image").setIcon("lucide-image").onClick(()=>{let m=i.pdfPageToImageArrayBuffer(d,{type:"image/png",encoderOptions:1,cropRect:[h,u,f,p]}).then(b=>new Blob([b],{type:"image/png"}));navigator.clipboard.write([new ClipboardItem({"image/png":m})])})})}c.showAtMouseEvent(n),n.preventDefault()};var dg=require("obsidian");var Mx=async(n,t,e,i)=>{let{app:r,lib:o}=n,s=[];for(let a of t.allItems)s.push((async()=>{let c=await o.copyLink.getTextToCopyForOutlineItemDynamic(e,i,a),l=o.toSingleLine(a.item.title),d=l?`${l.length<=40?l:l.slice(0,39).trim()+"\u2026"}`:"PDF section";r.dragManager.handleDrag(a.selfEl,h=>(r.dragManager.updateSource([a.selfEl],"is-being-dragged"),{source:"pdf-plus",type:"pdf-offset",icon:"lucide-heading",title:d,getText:c,item:a})),r.dragManager.handleDrop(a.selfEl,(h,u,f)=>{if(!o.isEditable(e)||!u||u.source!=="pdf-plus"||u.type!=="pdf-offset")return;let p=u.item;if(p&&!Up(p,a,!0)&&p.parent!==a&&a.owner===p.owner)return f||(async()=>{let g=await Te.fromFile(i,n),[m,b]=await Promise.all([g.findPDFjsOutlineTreeNode(a),g.findPDFjsOutlineTreeNode(p)]);if(!m||!b){new dg.Notice(`${n.manifest.name}: Failed to move the outline item.`);return}m.appendChild(b),m.sortChildren();let w=await g.doc.save();await r.vault.modifyBinary(i,w)})(),{action:`Move into "${d}"`,dropEffect:"move",hoverEl:a.el,hoverClass:"is-being-dragged-over"}},!1)})());await Promise.all(s),r.dragManager.handleDrop(t.childrenEl,(a,c,l)=>{if(!o.isEditable(e)||!c||c.source!=="pdf-plus"||c.type!=="pdf-offset"||a.target!==a.currentTarget)return;let d=c.item;if(d&&d.parent&&t===d.owner)return l||(async()=>{let h=await Te.fromFile(i,n),u=await(h==null?void 0:h.findPDFjsOutlineTreeNode(d));if(!u){new dg.Notice(`${n.manifest.name}: Failed to move the outline item.`);return}let f=h.ensureRoot();f.appendChild(u),f.sortChildren();let p=await h.doc.save();await r.vault.modifyBinary(i,p)})(),{action:"Move to top level",dropEffect:"move",hoverEl:t.childrenEl,hoverClass:"is-being-dragged-over"}},!1)},Nx=(n,t,e)=>{let{app:i,lib:r}=n;t.pdfViewer.pdfThumbnailViewer.container.querySelectorAll("div.thumbnail[data-page-number]").forEach(o=>{var h;let s=parseInt(o.dataset.pageNumber),c=(h=t.getPage(s).pageLabel)!=null?h:""+s,l=t.pdfViewer.pagesCount,d=""+s===c?`Page ${s}`:`Page ${c} (${s}/${l})`;i.dragManager.handleDrag(o,u=>(i.dragManager.updateSource([o],"is-being-dragged"),{source:"pdf-plus",type:"pdf-page",icon:"lucide-book-open",title:d,getText:f=>r.copyLink.getTextToCopy(t,n.settings.thumbnailLinkCopyFormat,n.settings.thumbnailLinkDisplayTextFormat,e,s,`#page=${s}`,"","",f)}))})},Rx=(n,t,e,i,r,o)=>{let{app:s,lib:a}=n,c=e.getPage(r);e.getAnnotatedText(c,o).then(l=>{s.dragManager.handleDrag(t,d=>{s.dragManager.updateSource([t],"is-being-dragged");let h=a.getColorPaletteFromChild(e);if(!h)return null;let u=n.settings.copyCommands[h.actionIndex].template;return{source:"pdf-plus",type:"pdf-annotation",icon:"lucide-highlighter",title:"PDF annotation",getText:f=>a.copyLink.getTextToCopy(e,u,void 0,i,r,`#page=${r}&annotation=${o}`,l!=null?l:"","",f)}})})};var Sh=require("obsidian");var Tr=require("obsidian");var ca=class extends de{constructor(e,i){super(e);this.file=i,this.events=new Tr.Events}onload(){this.init(),this.registerEvent(this.app.metadataCache.on("changed",(e,i,r)=>{this.update(e.path,r),this.trigger("update")})),this.registerEvent(this.app.metadataCache.on("deleted",e=>{this.deleteCachesForSourcePath(e.path),this.trigger("update")})),this.registerEvent(this.app.vault.on("rename",(e,i)=>{if(e instanceof Tr.TFile){this.deleteCachesForSourcePath(i);let r=this.app.metadataCache.getFileCache(e);r&&this.update(e.path,r),this.trigger("update")}}))}init(){this.pagesMap=new Map,this.sourcePaths=new Ht,this.backlinks=new Set;let e=this.app.metadataCache.getBacklinksForFile(this.file);for(let i of e.keys()){let r=e.get(i);for(let o of r!=null?r:[])this.createCache(o,i)}}update(e,i){var o,s,a;this.deleteCachesForSourcePath(e);let r=[...(o=i.links)!=null?o:[],...(s=i.embeds)!=null?s:[],...(a=i.frontmatterLinks)!=null?a:[]];for(let c of r){let l=c.link;this.app.metadataCache.getFirstLinkpathDest((0,Tr.getLinkpath)(l),e)===this.file&&this.createCache(c,e)}}delete(e){this.backlinks.delete(e),this.sourcePaths.deleteValue(e.sourcePath,e),e.page&&this.getPageIndex(e.page).delete(e)}deleteCachesForSourcePath(e){let i=this.sourcePaths.get(e);for(let r of i)this.delete(r)}getPageIndex(e){return this.pagesMap.has(e)||this.pagesMap.set(e,new Le(this,e)),this.pagesMap.get(e)}createCache(e,i){let r=new hg(this,e);this.backlinks.add(r),r.sourcePath=i;let{subpath:o}=(0,Tr.parseLinktext)(e.link),s=new URLSearchParams(o.startsWith("#")?o.slice(1):o);if(!s.has("page"))return r;let a=+s.get("page");if(!Number.isInteger(a))return r;if(r.page=a,s.has("selection")){let c=s.get("selection").split(",").map(l=>parseInt(l.trim()));if(c.length===4&&c.every(l=>!isNaN(l))){let[l,d,h,u]=c;r.selection={beginIndex:l,beginOffset:d,endIndex:h,endOffset:u}}}if(s.has("annotation")){let c=s.get("annotation");r.annotation={id:c}}if(s.has("offset")){let c=s.get("offset").split(",").map(u=>parseInt(u)),l=c[0],d=c[1],h=c[2];isNaN(h)?r.FitBH={top:d}:r.XYZ={left:l,top:d,zoom:h}}if(s.has("rect")){let c=s.get("rect").split(",").map(f=>parseFloat(f)),[l,d,h,u]=c;r.FitR={left:l,bottom:d,right:h,top:u}}if(s.has("color")){let c=s.get("color"),l=c.split(",").map(d=>parseInt(d));l.length===3&&l.every(d=>!isNaN(d))?r.setColor({rgb:{r:l[0],g:l[1],b:l[2]}}):r.setColor({name:c})}return r}on(e,i,r){return this.events.on(e,i,r)}trigger(e,...i){this.events.trigger(e,...i)}},Le=class{constructor(t,e){this.sourcePaths=new Ht;this.backlinks=new Set;this.selections=new Ht;this.annotations=new Ht;this.XYZs=new Ht;this.FitBHs=new Ht;this.FitRs=new Ht;this.index=t,this.pageNumber=e}add(t){this.backlinks.add(t),this.sourcePaths.addValue(t.sourcePath,t),t.selection&&this.selections.addValue(Le.selectionId(t.selection),t),t.annotation&&this.annotations.addValue(t.annotation.id,t),t.XYZ&&this.XYZs.addValue(Le.XYZId(t.XYZ),t),t.FitBH&&this.FitBHs.addValue(Le.FitBHId(t.FitBH),t),t.FitR&&this.FitRs.addValue(Le.FitRId(t.FitR),t)}delete(t){this.backlinks.delete(t),this.sourcePaths.deleteValue(t.sourcePath,t),t.selection&&this.selections.deleteValue(Le.selectionId(t.selection),t),t.annotation&&this.annotations.deleteValue(t.annotation.id,t),t.XYZ&&this.XYZs.deleteValue(Le.XYZId(t.XYZ),t),t.FitBH&&this.FitBHs.deleteValue(Le.FitBHId(t.FitBH),t),t.FitR&&this.FitRs.deleteValue(Le.FitRId(t.FitR),t)}static selectionId(t){return`${t.beginIndex},${t.beginOffset},${t.endIndex},${t.endOffset}`}static selectionIdToParams(t){let[e,i,r,o]=t.split(",").map(s=>parseInt(s));return{beginIndex:e,beginOffset:i,endIndex:r,endOffset:o}}static XYZId(t){return`${t.left},${t.top},${t.zoom}`}static XYZIdToParams(t){let[e,i,r]=t.split(",").map(o=>parseFloat(o));return{left:e,top:i,zoom:r}}static FitBHId(t){return`${t.top}`}static FitBHIdToParams(t){return{top:parseFloat(t)}}static FitRId(t){return`${t.left},${t.bottom},${t.right},${t.top}`}static FitRIdToParams(t){let[e,i,r,o]=t.split(",").map(s=>parseFloat(s));return{left:e,bottom:i,right:r,top:o}}},hg=class{constructor(t,e){this._sourcePath="";this._page=null;this._selection=null;this._annotation=null;this._XYZ=null;this._FitBH=null;this._FitR=null;this._color=null;this.index=t,this.refCache=e}getPageIndex(){return this.page?this.index.getPageIndex(this.page):null}get file(){return this.index.file}get sourcePath(){return this._sourcePath}set sourcePath(t){this._sourcePath=t,this.index.sourcePaths.addValue(t,this),this.page&&this.index.getPageIndex(this.page).sourcePaths.addValue(t,this)}get page(){return this._page}set page(t){this.page&&this.index.getPageIndex(this.page).delete(this),t&&this.index.getPageIndex(t).add(this),this._page=t}get selection(){return this._selection}set selection(t){let e=this.getPageIndex();e&&(this.selection&&(e==null||e.selections.deleteValue(Le.selectionId(this.selection),this)),t&&e.selections.addValue(Le.selectionId(t),this)),this._selection=t}get annotation(){return this._annotation}set annotation(t){let e=this.getPageIndex();e&&(this.annotation&&(e==null||e.annotations.deleteValue(this.annotation.id,this)),t&&e.annotations.addValue(t.id,this)),this._annotation=t}get XYZ(){return this._XYZ}set XYZ(t){let e=this.getPageIndex();e&&(this.XYZ&&(e==null||e.XYZs.deleteValue(Le.XYZId(this.XYZ),this)),t&&e.XYZs.addValue(Le.XYZId(t),this)),this._XYZ=t}get FitBH(){return this._FitBH}set FitBH(t){let e=this.getPageIndex();e&&(this.FitBH&&(e==null||e.FitBHs.deleteValue(Le.FitBHId(this.FitBH),this)),t&&e.FitBHs.addValue(Le.FitBHId(t),this)),this._FitBH=t}get FitR(){return this._FitR}set FitR(t){let e=this.getPageIndex();e&&(this.FitR&&(e==null||e.FitRs.deleteValue(Le.FitRId(this.FitR),this)),t&&e.FitRs.addValue(Le.FitRId(t),this)),this._FitR=t}setColor(t){"rgb"in t?this._color={type:"rgb",rgb:t.rgb}:this._color={type:"name",name:t.name}}getColor(){return this._color}};var ug=class extends de{constructor(e,i){super(e);this.file=i}get index(){var e;return(e=this._index)!=null?e:this._index=this.addChild(new ca(this.plugin,this.file))}processSelection(e,i,r){}processAnnotation(e,i,r){}processXYZ(e,i,r){}processFitBH(e,i,r){}processFitR(e,i,r){}},fg=class extends de{constructor(e){super(e.plugin);this.pagewiseCacheToDomsMap=new Map;this.pagewiseStatus=new Map;this.pagewiseOnClearDomCallbacksMap=new Ht;this.visualizer=e}get file(){return this.visualizer.file}getCacheToDomsMap(e){let i=this.pagewiseCacheToDomsMap.get(e);return i||(i=new Fc,this.pagewiseCacheToDomsMap.set(e,i)),i}clearDomInPage(e){let i=this.getCacheToDomsMap(e);for(let r of i.values())r.closest(".pdf-plus-backlink-highlight-layer")&&r.remove();this.pagewiseOnClearDomCallbacksMap.get(e).forEach(r=>r()),this.pagewiseCacheToDomsMap.delete(e),this.updateStatus(e,{onPageReady:!1,onTextLayerReady:!1,onAnnotationLayerReady:!1})}clear(){for(let e of this.pagewiseCacheToDomsMap.keys())this.clearDomInPage(e)}getStatus(e){let i=this.pagewiseStatus.get(e);return i||(i={onPageReady:!1,onTextLayerReady:!1,onAnnotationLayerReady:!1},this.pagewiseStatus.set(e,i)),i}isPageProcessed(e){let i=this.getStatus(e);return i.onPageReady&&i.onTextLayerReady&&i.onAnnotationLayerReady}updateStatus(e,i){let r=this.getStatus(e);Object.assign(r,i)}postProcessPageIfReady(e){this.isPageProcessed(e)&&this.postProcessPage(e)}postProcessPage(e){let i=this.getCacheToDomsMap(e);for(let r of i.keys()){let o=r.getColor();for(let s of i.get(r))this.hookBacklinkOpeners(s,r),this.hookBacklinkViewEventHandlers(s,r),this.hookContextMenuHandler(s,r),this.hookClassAdderOnMouseOver(s,r),this.setHighlightColor(s,o)}}hookBacklinkOpeners(e,i){let r="position"in i.refCache?i.refCache.position:void 0,o=r==null?void 0:r.start.line,s={isTriggeredFromBacklinkVisualizer:!0};typeof o=="number"&&(s.scroll=o),this.registerDomEventForCache(i,e,"mouseover",a=>{this.app.workspace.trigger("hover-link",{event:a,source:"pdf-plus",hoverParent:this.visualizer,targetEl:e,linktext:i.sourcePath,sourcePath:this.file.path,state:s})}),this.registerDomEventForCache(i,e,"dblclick",a=>{if(this.plugin.settings.doubleClickHighlightToOpenBacklink){let c=Sh.Keymap.isModEvent(a);this.lib.workspace.openMarkdownLinkFromPDF(i.sourcePath,this.file.path,c,r?{pos:r}:void 0)}})}hookBacklinkViewEventHandlers(e,i){this.registerDomEventForCache(i,e,"mouseover",r=>{this.plugin.settings.highlightBacklinksPane&&this.lib.workspace.iterateBacklinkViews(o=>{if(this.file!==o.file||!o.containerEl.isShown()||!o.pdfManager)return;let s=o.pdfManager.findBacklinkItemEl(i);if(s){s.addClass("hovered-backlink");let a=c=>{ui(c,s)&&(s.removeClass("hovered-backlink"),e.removeEventListener("mouseout",a))};e.addEventListener("mouseout",a)}})})}hookContextMenuHandler(e,i){this.registerDomEventForCache(i,e,"contextmenu",r=>{Ox(r,this.visualizer,i)})}hookClassAdderOnMouseOver(e,i){let r=i.page;if(typeof r=="number"){let o="is-hovered";this.registerDomEventForCache(i,e,"mouseover",()=>{for(let a of this.getCacheToDomsMap(r).get(i))a.addClass(o);let s=()=>{for(let a of this.getCacheToDomsMap(r).get(i))a.removeClass(o);e.removeEventListener("mouseout",s)};e.addEventListener("mouseout",s)})}}setHighlightColor(e,i){if((i==null?void 0:i.type)==="name")e.dataset.highlightColor=i.name.toLowerCase();else if((i==null?void 0:i.type)==="rgb"){let{r,g:o,b:s}=i.rgb;e.setCssProps({"--pdf-plus-color":`rgb(${r}, ${o}, ${s})`,"--pdf-plus-backlink-icon-color":`rgb(${r}, ${o}, ${s})`,"--pdf-plus-rect-color":`rgb(${r}, ${o}, ${s})`})}}onClearDomInPage(e,i){this.pagewiseOnClearDomCallbacksMap.addValue(e,i)}registerDomEventForCache(e,i,r,o,s){this.registerDomEvent(i,r,o,s),e.page&&e.annotation&&this.onClearDomInPage(e.page,()=>{i.removeEventListener(r,o)})}},pg=class extends de{constructor(e){super(e.plugin);this.visualizer=e,this.pagewiseIdToRectsMap=new Map}get file(){return this.visualizer.file}get child(){return this.visualizer.child}onload(){this.registerEvent(this.app.vault.on("modify",e=>{e===this.file&&this.pagewiseIdToRectsMap.clear()}))}getIdToRectsMap(e){let i=this.pagewiseIdToRectsMap.get(e);return i||(i=new Map,this.pagewiseIdToRectsMap.set(e,i)),i}getRectsForSelection(e,i){var s;let r=this.getIdToRectsMap(e),o=(s=r.get(i))!=null?s:null;return o||(o=this.computeRectsForSelection(e,i),o?(r.set(i,o),o):null)}computeRectsForSelection(e,i){let r=this.child.getPage(e),{beginIndex:o,beginOffset:s,endIndex:a,endOffset:c}=Le.selectionIdToParams(i),l=r.textLayer;return!l||!l.textDivs.length?null:this.lib.highlight.geometry.computeMergedHighlightRects(l,o,s,a,c)}},da=class extends ug{constructor(e,i,r){super(e,i);this.child=r}static create(e,i,r){return e.addChild(new da(e,i,r))}get hoverPopover(){return this.child.hoverPopover}set hoverPopover(e){this.child.hoverPopover=e}onload(){this.shouldVisualizeBacklinks()&&(this.domManager=this.addChild(new fg(this)),this.rectangleCache=this.addChild(new pg(this)),this.visualize(),this.registerEvent(this.index.on("update",()=>{this.visualize()})))}shouldVisualizeBacklinks(){let e=this.child.pdfViewer;return this.settings.highlightBacklinks&&(On(e)||this.settings.highlightBacklinksInCanvas&&na(e)||this.settings.highlightBacklinksInHoverPopover&&ra(e)||this.settings.highlightBacklinksInEmbed&&Ac(e))}visualize(){let e=this.child.pdfViewer;this.lib.onPageReady(e,this,i=>{this.domManager.clearDomInPage(i);let r=this.index.getPageIndex(i);for(let[o,s]of r.XYZs)this.processXYZ(i,o,s);for(let[o,s]of r.FitBHs)this.processFitBH(i,o,s);for(let[o,s]of r.FitRs)this.processFitR(i,o,s);this.domManager.updateStatus(i,{onPageReady:!0}),this.domManager.postProcessPageIfReady(i)}),this.lib.onTextLayerReady(e,this,i=>{let r=this.domManager.getStatus(i);if(!r.onPageReady||r.onTextLayerReady)return;let o=this.index.getPageIndex(i);for(let[s,a]of o.selections)this.processSelection(i,s,a);this.domManager.updateStatus(i,{onTextLayerReady:!0}),this.domManager.postProcessPageIfReady(i)}),this.lib.onAnnotationLayerReady(e,this,i=>{let r=this.domManager.getStatus(i);if(!r.onPageReady||r.onAnnotationLayerReady)return;let o=this.index.getPageIndex(i);for(let[s,a]of o.annotations)this.processAnnotation(i,s,a);this.domManager.updateStatus(i,{onAnnotationLayerReady:!0}),this.domManager.postProcessPageIfReady(i)})}processSelection(e,i,r){var l;super.processSelection(e,i,r);let o=this.child.getPage(e),s=this.domManager.getCacheToDomsMap(e),a=o.textLayer;if(!a||!a.textDivs.length)return;let c=this.rectangleCache.getRectsForSelection(e,i);if(c){for(let{rect:d,indices:h}of c){let u=this.lib.highlight.viewer.placeRectInPage(d,o);u.addClasses(["pdf-plus-backlink","pdf-plus-backlink-selection"]);let f=a.textDivs[h[0]];u.setCssStyles({fontSize:f.style.fontSize}),u.dataset.backlinkId=i;for(let p of r)s.addValue(p,u)}if(this.settings.showBacklinkIconForSelection){let d=(l=c.last())==null?void 0:l.rect;if(d){let h=this.showIcon(d[2],d[3],o);for(let u of r)s.addValue(u,h)}}}}processAnnotation(e,i,r){var f;super.processAnnotation(e,i,r);let o=this.child.getPage(e),s=(f=o.annotationLayer)==null?void 0:f.annotationLayer;if(!s)return;let a=s.getAnnotation(i);if(!a)return;a.container.addClasses(["pdf-plus-backlink","pdf-plus-backlink-annotation"]);let[,,c,l]=a.data.rect,d;this.settings.showBacklinkIconForAnnotation&&(d=this.showIcon(c,l,o));let h;this.settings.showBoundingRectForBacklinkedAnnot&&(h=this.lib.highlight.viewer.placeRectInPage(a.data.rect,o),h.addClass("pdf-plus-annotation-bounding-rect"));let u=this.domManager.getCacheToDomsMap(e);for(let p of r){u.addValue(p,a.container),d&&u.addValue(p,d),h&&u.addValue(p,h);let[g,m,b]=a.data.color;p.setColor({rgb:{r:g,g:m,b}})}}processXYZ(e,i,r){if(super.processXYZ(e,i,r),this.settings.showBacklinkIconForOffset){let o=this.child.getPage(e),{left:s,top:a}=Le.XYZIdToParams(i),c=this.showIcon(s,a,o,"left"),l=this.domManager.getCacheToDomsMap(e);for(let d of r)l.addValue(d,c)}}processFitBH(e,i,r){if(super.processFitBH(e,i,r),this.settings.showBacklinkIconForOffset){let o=this.child.getPage(e),{top:s}=Le.FitBHIdToParams(i),a=this.showIcon(0,s,o),c=this.domManager.getCacheToDomsMap(e);for(let l of r)c.addValue(l,a)}}processFitR(e,i,r){super.processFitR(e,i,r);let o=this.child.getPage(e),{left:s,bottom:a,right:c,top:l}=Le.FitRIdToParams(i),d=this.lib.highlight.viewer.placeRectInPage([s,a,c,l],o);d.addClasses(["pdf-plus-backlink","pdf-plus-backlink-fit-r"]);let h=this.domManager.getCacheToDomsMap(e);for(let u of r)h.addValue(u,d);if(this.settings.showBacklinkIconForRect){let u=this.showIcon(c,l,o);for(let f of r)h.addValue(f,u)}}showIcon(e,i,r,o="right"){var u;let s=Math.min(r.viewport.rawDims.pageWidth,r.viewport.rawDims.pageWidth)*this.settings.backlinkIconSize/2e3,a=[e,i-s,e+s,i],c=[e-s,i-s,e,i],l=o==="left"&&c[0]>=((u=r.viewport.rawDims.pageX)!=null?u:0)?c:a,d=this.lib.highlight.viewer.placeRectInPage(l,r);d.addClass("pdf-plus-backlink-icon"),(0,Sh.setIcon)(d,"links-coming-in");let h=d.querySelector("svg");return h==null||h.setAttribute("stroke","var(--pdf-plus-backlink-icon-color)"),d}};var Cr=require("obsidian");var Be=require("obsidian");var $i=class extends de{constructor(e,i,r){super(e);this.child=i,this.toolbarLeftEl=r,this.spacerEl=null,this.paletteEl=null,this.itemEls=[],this.actionMenuEl=null,this.displayTextFormatMenuEl=null,this.writeFileButtonEl=null,this.cropButtonEl=null,this.statusContainerEl=null,this.statusEl=null,this.importButtonEl=null,this.selectedColorName=null,this.actionIndex=e.settings.defaultColorPaletteActionIndex,this.displayTextFormatIndex=e.settings.defaultDisplayTextFormatIndex,this.writeFile=this.lib.isEditable(this.child)&&e.settings.defaultWriteFileToggle}onload(){if(this.toolbarLeftEl.querySelectorAll("."+$i.CLS).forEach(e=>{var i;(i=$i.elInstanceMap.get(e))==null||i.unload()}),!(!this.plugin.settings.colorPaletteInEmbedToolbar&&this.toolbarLeftEl.closest(".pdf-embed"))){if(this.spacerEl=this.toolbarLeftEl.createDiv("pdf-toolbar-spacer"),this.paletteEl=this.toolbarLeftEl.createDiv($i.CLS),$i.elInstanceMap.set(this.paletteEl,this),this.plugin.settings.colorPaletteInToolbar){this.addItem(this.paletteEl,null,"transparent");for(let[e,i]of Object.entries(this.plugin.settings.colors))this.addItem(this.paletteEl,e,i);this.setActiveItem([null,...Object.keys(this.plugin.settings.colors)][this.plugin.settings.defaultColorPaletteItemIndex])}this.actionMenuEl=this.addCopyActionDropdown(this.paletteEl),this.displayTextFormatMenuEl=this.addDisplayTextFormatDropdown(this.paletteEl),this.addCropButton(this.paletteEl),this.child.isFileExternal?this.addImportButton(this.paletteEl):this.addWriteFileToggle(this.paletteEl),this.statusContainerEl=this.paletteEl.createDiv("pdf-plus-color-palette-status-container"),this.statusEl=this.statusContainerEl.createSpan("pdf-plus-color-palette-status"),this.registerEvent(this.plugin.on("color-palette-state-change",({source:e})=>{e!==this&&this.syncTo(e)}))}}onunload(){var e;(e=this.spacerEl)==null||e.remove(),this.paletteEl&&(this.paletteEl.remove(),$i.elInstanceMap.delete(this.paletteEl))}addItem(e,i,r){if(i&&!Ki(r)||i===null&&!this.plugin.settings.noColorButtonInColorPalette)return;let o=e.createDiv({cls:[$i.CLS+"-item","clickable-icon"],attr:i?{"data-highlight-color":i.toLowerCase()}:void 0});this.itemEls.push(o),o.createDiv($i.CLS+"-item-inner"),this.setTooltipToActionItem(o,i),o.addEventListener("pointerup",a=>this.onItemPointerUp(o,i,a));let s=!1;o.addEventListener("contextmenu",()=>{if(s)return;let a=new Be.Menu().addItem(c=>{c.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollTo("colors")})});a.onHide(()=>{s=!1}),In(a,o),s=!0})}onItemPointerUp(e,i,r){let o=!e.hasClass("is-active");this.setActiveItem(i),this.plugin.settings.syncColorPaletteItem&&this.plugin.settings.syncDefaultColorPaletteItem&&(this.plugin.settings.defaultColorPaletteItemIndex=i?Object.keys(this.plugin.settings.colors).indexOf(i)+1:0),o&&this.plugin.trigger("color-palette-state-change",{source:this});let s=this.plugin.settings.copyCommands[this.actionIndex].template;this.writeFile?this.lib.copyLink.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(!1,{copyFormat:s},i!=null?i:void 0):this.lib.copyLink.copyLinkToSelection(!1,{copyFormat:s},i!=null?i:void 0),r.preventDefault()}setActiveItem(e){this.selectedColorName=e?e.toLowerCase():null,this.itemEls.forEach(i=>{i.toggleClass("is-active",this.selectedColorName===i.dataset.highlightColor||this.selectedColorName===null&&i.dataset.highlightColor===void 0)})}addDropdown(e,i,r,o,s,a){return e.createDiv("clickable-icon",c=>{(0,Be.setIcon)(c,"lucide-chevron-down"),(0,Be.setTooltip)(c,o),c.dataset.checkedIndex=""+this[r];let l=!1;c.addEventListener("click",()=>{if(l)return;let d=new Be.Menu;for(let h=0;h{f.setTitle(u).setChecked(this[r]===h).onClick(()=>{let p=this[r]!==h;this.setCheckedIndex(r,h,c),s==null||s(),p&&this.plugin.trigger("color-palette-state-change",{source:this})})})}a==null||a(d),d.onHide(()=>{l=!1}),In(d,c),l=!0})})}setCheckedIndex(e,i,r){this[e]=i,r.dataset.checkedIndex=""+i}setActionIndex(e){this.actionMenuEl&&this.setCheckedIndex("actionIndex",e,this.actionMenuEl),this.updateTooltips()}setDisplayTextFormatIndex(e){this.displayTextFormatMenuEl&&this.setCheckedIndex("displayTextFormatIndex",e,this.displayTextFormatMenuEl)}addCopyActionDropdown(e){let i="Link copy format";this.plugin.settings.colorPaletteInToolbar||(i=`${this.plugin.manifest.name}: link copy options (trigger via hotkeys)`);let r=this.addDropdown(e,this.plugin.settings.copyCommands.map(o=>o.name),"actionIndex",i,()=>{this.updateTooltips(),this.plugin.settings.syncColorPaletteAction&&this.plugin.settings.syncDefaultColorPaletteAction&&(this.plugin.settings.defaultColorPaletteActionIndex=this.actionIndex)},o=>{o.addItem(s=>{s.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{this.plugin.openSettingTab().scrollTo("copyCommands")})})});return r.addClass("pdf-plus-action-menu"),r}addDisplayTextFormatDropdown(e){let i=this.addDropdown(e,this.plugin.settings.displayTextFormats.map(r=>r.name),"displayTextFormatIndex","Display text format",()=>{this.plugin.settings.syncDisplayTextFormat&&this.plugin.settings.syncDefaultDisplayTextFormat&&(this.plugin.settings.defaultDisplayTextFormatIndex=this.displayTextFormatIndex)},r=>{r.addItem(o=>{o.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{this.plugin.openSettingTab().scrollTo("displayTextFormats")})})});return i.addClass("pdf-plus-display-text-format-menu"),i}addWriteFileToggle(e){this.removeWriteFileToggle(),this.writeFileButtonEl=e.createDiv("clickable-icon",i=>{(0,Be.setIcon)(i,"lucide-edit"),(0,Be.setTooltip)(i,`Add ${this.plugin.settings.selectionBacklinkVisualizeStyle}s to file directly`),i.toggleClass("is-disabled",!this.lib.isEditable(this.child));let r=!1;i.addEventListener("click",()=>{if(!this.lib.isEditable(this.child)){if(r)return;let o=new Be.Menu().addItem(s=>{s.setIcon("lucide-settings").setTitle("Enable PDF editing...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("edit")})});o.onHide(()=>{r=!1}),In(o,i),r=!0;return}this.setWriteFile(!this.writeFile),this.plugin.settings.syncWriteFileToggle&&this.plugin.settings.syncDefaultWriteFileToggle&&(this.plugin.settings.defaultWriteFileToggle=this.writeFile),this.plugin.trigger("color-palette-state-change",{source:this})}),i.addEventListener("contextmenu",()=>{if(r)return;let o=new Be.Menu;this.lib.isEditable(this.child)&&o.addItem(s=>{s.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("annot")})}),o.addItem(s=>{s.setIcon("lucide-settings").setTitle(this.lib.isEditable(this.child)?"Disable PDF editing...":"Enable PDF editing...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("edit")})}),o.onHide(()=>{r=!1}),In(o,i),r=!0})}),this.cropButtonEl&&e.insertAfter(this.writeFileButtonEl,this.cropButtonEl),this.setWriteFile(this.writeFile)}removeWriteFileToggle(){var e;(e=this.writeFileButtonEl)==null||e.remove(),this.writeFileButtonEl=null}addImportButton(e){this.removeImportButton(),this.importButtonEl=e.createDiv("clickable-icon",i=>{(0,Be.setIcon)(i,"lucide-import"),(0,Be.setTooltip)(i,"Import external PDF into vault"),i.addEventListener("click",()=>{this.importFile()})}),this.cropButtonEl&&e.insertAfter(this.importButtonEl,this.cropButtonEl)}removeImportButton(){var e;(e=this.importButtonEl)==null||e.remove(),this.importButtonEl=null}async importFile(){let e=this.child.externalFileUrl,i=this.child.file;if(!e||!i)return;if(!Be.Platform.isDesktopApp&&e.startsWith(Be.Platform.resourcePathPrefix)){new Be.Notice(`${this.plugin.manifest.name}: Importing local PDFs outside the vault is supported only on the desktop app.`);return}let r=await fetch(e);if(r.ok){let o=await r.arrayBuffer();await this.app.vault.modifyBinary(i,o),this.removeImportButton(),this.paletteEl&&this.addWriteFileToggle(this.paletteEl),new Be.Notice(`${this.plugin.manifest.name}: Successfully imported the PDF file into the vault.`);return}new Be.Notice(`${this.plugin.manifest.name}: Import failed. Response status: ${r.status}`)}setWriteFile(e){var i;this.writeFile=e,(i=this.writeFileButtonEl)==null||i.toggleClass("is-active",e)}addCropButton(e){this.cropButtonEl=e.createDiv("clickable-icon pdf-plus-rect-select",i=>{(0,Be.setIcon)(i,"lucide-box-select"),(0,Be.setTooltip)(i,"Copy embed link to rectangular selection"),i.addEventListener("click",()=>{this.startRectangularSelection(!1)});let r=!1;i.addEventListener("contextmenu",()=>{if(r)return;let o=new Be.Menu().addItem(s=>{s.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("rect")})});o.onHide(()=>{r=!1}),In(o,i),r=!0})})}startRectangularSelection(e){var l;let i=this.cropButtonEl;if(!i)return;let r=this.lib.getPDFViewerChildAssociatedWithNode(this.paletteEl);if(!r||!((l=r.pdfViewer.dom)!=null&&l.viewerEl))return;let o=r.pdfViewer.dom.viewerEl,s={left:0,top:0,width:0,height:0},a=d=>{if(!wt(d,d.target))return;let h=d.target.closest(".pdf-viewer div.page[data-page-number]");if(!h)return;let u=h.dataset.pageNumber;if(!u)return;let f=r.getPage(+u),{x:p,y:g}=ih(d);s.left=p,s.top=g;let m=h.createDiv("pdf-plus-select-box"),b=h.getBoundingClientRect(),w=getComputedStyle(h),F=parseFloat(w.borderTopWidth),v=parseFloat(w.borderLeftWidth),P=parseFloat(w.paddingTop),k=parseFloat(w.paddingLeft);m.setCssStyles({left:s.left-(b.left+v+k)+"px",top:s.top-(b.top+F+P)+"px"});let T=C=>{let{x:O,y:E}=ih(C),V=h.getBoundingClientRect();s.width=O-s.left-(V.left-b.left),s.height=E-s.top-(V.top-b.top),m.setCssStyles({width:s.width+"px",height:s.height+"px"}),C.preventDefault(),C.stopImmediatePropagation()},D=()=>{var B;if(h.removeEventListener("mousemove",T),h.removeEventListener("touchmove",T),h.removeEventListener("mouseup",D),h.removeEventListener("touchend",D),h.removeChild(m),s.height<=0||s.width<=0)return;let C=s.left-(b.left+v+k),O=s.top-(b.top+F+P),E=C+s.width,V=O+s.height,W=window.pdfjsLib.Util.normalizeRect([...f.getPagePoint(C,V),...f.getPagePoint(E,O)]);this.lib.copyLink.copyEmbedLinkToRect(!1,r,f.id,W,this.plugin.settings.includeColorWhenCopyingRectLink&&(B=this.selectedColorName)!=null?B:void 0,e),c()};this.registerDomEvent(h,"mousemove",T),this.registerDomEvent(h,"touchmove",T),this.registerDomEvent(h,"mouseup",D),this.registerDomEvent(h,"touchend",D)},c=()=>{var d;i.toggleClass("is-active",!i.hasClass("is-active")),o.toggleClass("pdf-plus-selecting",i.hasClass("is-active")),this.register(()=>o.removeClass("pdf-plus-selecting")),(d=activeWindow.getSelection())==null||d.empty(),i.hasClass("is-active")?(this.registerDomEvent(o,"mousedown",a),this.registerDomEvent(o,"touchstart",a)):(o.removeEventListener("mousedown",a),o.removeEventListener("touchstart",a))};c()}setStatus(e,i){this.plugin.settings.showStatusInToolbar&&this.statusEl&&(this.statusEl.setText(e),i>0&&setTimeout(()=>{var r;((r=this.statusEl)==null?void 0:r.getText())===e&&this.statusEl.setText("")},i))}setTooltipToActionItem(e,i){let r=e.querySelector(":scope > ."+$i.CLS+"-item-inner"),o=this.plugin.settings.copyCommands[this.actionIndex].name,s=this.plugin.settings.quietColorPaletteTooltip,a=i!==null?s?i:`Copy link with format "${o}" & add ${i.toLowerCase()} ${this.plugin.settings.selectionBacklinkVisualizeStyle}`:s?"No color specified":`Copy link with "${o}" format without specifying color`;(0,Be.setTooltip)(r,a)}updateTooltips(){this.itemEls.forEach(e=>{var i;this.setTooltipToActionItem(e,(i=e.dataset.highlightColor)!=null?i:null)})}getState(){return{selectedColorName:this.selectedColorName,actionIndex:this.actionIndex,displayTextFormatIndex:this.displayTextFormatIndex,writeFile:this.writeFile}}setState(e){typeof e.selectedColorName=="string"&&this.setActiveItem(e.selectedColorName),typeof e.actionIndex=="number"&&this.setActionIndex(e.actionIndex),typeof e.displayTextFormatIndex=="number"&&this.setDisplayTextFormatIndex(e.displayTextFormatIndex),typeof e.writeFile=="boolean"&&this.setWriteFile(e.writeFile)}getColorName(){return this.getState().selectedColorName}getCopyFormat(){let e=this.getState();return this.plugin.settings.copyCommands[e.actionIndex].template}getDisplayTextFormat(){let e=this.getState();return this.plugin.settings.displayTextFormats[e.displayTextFormatIndex].template}syncTo(e){let i=e.getState();this.plugin.settings.syncColorPaletteItem||delete i.selectedColorName,this.plugin.settings.syncColorPaletteAction||delete i.actionIndex,this.plugin.settings.syncDisplayTextFormat||delete i.displayTextFormatIndex,this.plugin.settings.syncWriteFileToggle||delete i.writeFile,this.setState(i)}},Ft=$i;Ft.CLS="pdf-plus-color-palette",Ft.elInstanceMap=new Map;var ha=class extends de{constructor(e,i,r){super(e);this.toolbar=i,this.child=r}onload(){this.addColorPalette(),this.replaceDisplayOptionsDropdown(),this.addZoomLevelInputEl(),this.makeDropdownInToolbarHoverable()}onunload(){}addColorPalette(){this.child.palette=this.addChild(new Ft(this.plugin,this.child,this.toolbar.toolbarLeftEl))}makeDropdownInToolbarHoverable(){let{toolbar:e,plugin:i}=this;!i.settings.hoverableDropdownMenuInToolbar||Cr.Platform.isPhone||e.toolbarLeftEl.querySelectorAll("div.clickable-icon").forEach(r=>{let o=r.firstElementChild;if(o&&o.matches("svg.lucide-chevron-down")){let s=null;kc({parentEl:r,createChildEl:()=>{if(!r.hasClass("has-active-menu")){r.click();for(let a of i.shownMenus)if(a.parentEl===r)return s=a,a.dom}return s=null},removeChildEl:()=>{s&&(s.hide(),s=null)},component:this.child.component,timeout:200})}})}replaceDisplayOptionsDropdown(){let{app:e,toolbar:i,child:r}=this,o=i.zoomInEl.nextElementSibling;if(!(o!=null&&o.hasClass("clickable-icon")))return;let s=o.firstElementChild;if(!(s!=null&&s.matches("svg.lucide-chevron-down")))return;let a=i.pdfViewer.eventBus,c=i.pdfViewer.pdfViewer;!a||!c||i.zoomInEl.after(createDiv("clickable-icon",l=>{(0,Cr.setIcon)(l,"lucide-chevron-down"),(0,Cr.setTooltip)(l,"Display options");let d=!1;l.addEventListener("click",()=>{if(!d){let h=c.currentScaleValue,u=c.scrollMode,f=c.spreadMode,p=!!e.loadLocalStorage("pdfjs-is-themed"),g=new Cr.Menu().addSections(["zoom","scroll","spread","appearance","settings"]).addItem(m=>{m.setSection("zoom").setIcon("lucide-move-horizontal").setTitle("Fit width").setChecked(h==="page-width").onClick(()=>a.dispatch("scalechanged",{source:i,value:"page-width"}))}).addItem(m=>{m.setSection("zoom").setIcon("lucide-move-vertical").setTitle("Fit height").setChecked(h==="page-height").onClick(()=>a.dispatch("scalechanged",{source:i,value:"page-height"}))}).addItem(m=>{m.setSection("zoom").setIcon("lucide-move").setTitle("Fit page").setChecked(h==="page-fit").onClick(()=>a.dispatch("scalechanged",{source:i,value:"page-fit"}))}).addItem(m=>{m.setSection("scroll").setIcon("lucide-chevrons-up-down").setTitle("Vertical scroll").setChecked(u===0).onClick(()=>{a.dispatch("switchscrollmode",{source:i,mode:0})})}).addItem(m=>{m.setSection("scroll").setIcon("lucide-chevrons-left-right").setTitle("Hotizontal scroll").setChecked(u===1).onClick(()=>{a.dispatch("switchscrollmode",{source:i,mode:1})})}).addItem(m=>{m.setSection("scroll").setIcon("lucide-wrap-text").setTitle("Wrapped scroll").setChecked(u===2).onClick(()=>{a.dispatch("switchscrollmode",{source:i,mode:2})})}).addItem(m=>{m.setSection("spread").setIcon("lucide-rectangle-vertical").setTitle("Single page").setChecked(f===0).onClick(()=>{a.dispatch("switchspreadmode",{source:i,mode:0})})}).addItem(m=>{m.setSection("spread").setIcon("rectangle-vertical-double").setTitle("Two pages (odd)").setChecked(f===1).onClick(()=>{a.dispatch("switchspreadmode",{source:i,mode:1})})}).addItem(m=>{m.setSection("spread").setIcon("rectangle-vertical-double").setTitle("Two pages (even)").setChecked(f===2).onClick(()=>{a.dispatch("switchspreadmode",{source:i,mode:2})})}).addItem(m=>{m.setSection("appearance").setIcon("lucide-palette").setTitle("Adapt to theme").setChecked(p).onClick(()=>{e.saveLocalStorage("pdfjs-is-themed",p?null:"true"),r.onCSSChange()})}).addItem(m=>{m.setSection("settings").setIcon("lucide-settings").setTitle("Customize defaults...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("viewer-option")})});g.onHide(()=>{d=!1}),In(g,l),d=!0}}),i.toolbarEl.doc.win.setTimeout(()=>{o.remove(),i.toolbarLeftEl.insertAfter(l,i.zoomInEl)})}))}addZoomLevelInputEl(){if(!this.settings.zoomLevelInputBoxInToolbar)return;let{toolbar:e}=this,i=e.pdfViewer.eventBus,r=e.pdfViewer.pdfViewer;if(!i||!r)return;let o=e.zoomOutEl.nextElementSibling;o!=null&&o.hasClass("pdf-toolbar-divider")&&(o.remove(),this.register(()=>e.zoomOutEl.after(createDiv("pdf-toolbar-divider"))),e.zoomOutEl.after(createEl("input","pdf-zoom-level-input",s=>{this.register(()=>s.remove()),s.type="number",s.addEventListener("click",()=>s.select()),s.addEventListener("change",()=>{let a=s.valueAsNumber/100,c=Math.min(Math.max(a,window.pdfjsViewer.MIN_SCALE),window.pdfjsViewer.MAX_SCALE);r.currentScale=c}),i.on("scalechanging",({scale:a})=>{s.value=Math.round(a*100)+""}),r.currentScale&&(s.value=Math.round(r.currentScale*100)+""),s.doc.win.setTimeout(()=>{s.after(createSpan({cls:"pdf-zoom-level-percent",text:"%"},a=>{this.register(()=>a.remove())}))})})))}};ha.elInstanceMap=new Map;var gg=qn(require("obsidian"));var Uo=class extends de{constructor(e,i){super(e);this.child=i}get file(){return this.child.file}get pdf(){return this.file}get folder(){var e,i;return(i=(e=this.file)==null?void 0:e.parent)!=null?i:null}get pdfViewer(){return this.child.pdfViewer}get dom(){return this.child.pdfViewer.dom}get doc(){return this.child.containerEl.doc}get obsidian(){return gg}get text(){var i;let e=(i=this.doc.getSelection())==null?void 0:i.toString();return e?this.lib.toSingleLine(e):""}get selection(){return this.text}get page(){var i,r,o,s;let e=this.doc.getSelection();return(s=(o=e&&((i=this.lib.copyLink.getPageAndTextRangeFromSelection(e))==null?void 0:i.page))!=null?o:(r=this.pdfViewer.pdfViewer)==null?void 0:r.currentPageNumber)!=null?s:null}get pageLabel(){let e=this.page;return e!==null?this.child.getPage(e).pageLabel:null}get pageCount(){var e,i;return(i=(e=this.pdfViewer.pdfViewer)==null?void 0:e.pagesCount)!=null?i:null}get color(){var e,i,r;return(r=(i=(e=this.child.palette)==null?void 0:e.getColorName())==null?void 0:i.toLowerCase())!=null?r:null}evaluateTemplate(e,i,r){if(!this.file||typeof this.page!="number")return"";let o=this.lib.copyLink.getPageAndTextRangeFromSelection(this.doc.getSelection());if(!o)return"";let{page:s,selection:a}=o;if(!a)return"";let c=Cc({page:s,selection:`${a.beginIndex},${a.beginOffset},${a.endIndex},${a.endOffset}`,color:r?r.toLowerCase():void 0});return this.lib.copyLink.getTextToCopy(this.child,e,i,this.file,this.page,c,this.text,r?r.toLowerCase():"")}writeFile(e,i,r){var o;return this.lib.write(gg.normalizePath(e),i,(o=r==null?void 0:r.existOk)!=null?o:!1)}async run(e){return jp("const app=this.app;const api = this;"+e,this)}};var Vx=require("obsidian");var LP=n=>wt(n,n.target)&&Pp(n.target),Er=class extends Vx.Scope{constructor(e){super(e);this.modeToKeymaps={};this.currentMode=null;this.currentKeys="";this.searchFrom=0;this.searchTo=-1;this.onEscapeCallbacks=[];this.escapeAliases=[];this.typableModes=[]}registerKeymaps(e,i){let r=(o,s)=>Mo(o.keys,s.keys);for(let o of e){if(!this.modeToKeymaps.hasOwnProperty(o)){this.modeToKeymaps[o]=Object.entries(i).map(([s,a])=>({keys:s,func:a})).sort(r);continue}for(let s in i){let a=i[s],c={keys:s,func:a},l=this.modeToKeymaps[o],{found:d,index:h}=Xi(l,u=>r(c,u));d?l[h]=c:l.splice(h,0,c)}}}unregisterAllKeymaps(e){for(let i of e)this.modeToKeymaps[i]&&(this.modeToKeymaps[i].length=0)}map(e,i){for(let r of e){let o=Object.fromEntries(Object.entries(i).map(([s,a])=>[s,c=>{let{found:l,index:d}=Xi(this.modeToKeymaps[r],h=>Mo(a,h.keys));if(l){let h=this.modeToKeymaps[r][d].func;return h(c)}}]));this.registerKeymaps([r],o)}}noremap(e,i){for(let r of e)if(this.modeToKeymaps.hasOwnProperty(r))for(let o in i){let s=i[o],{found:a,index:c}=Xi(this.modeToKeymaps[r],l=>Mo(s,l.keys));if(a){let l=this.modeToKeymaps[r][c];this.registerKeymaps([r],{[o]:l.func})}}}unmap(e,i){for(let r of e)if(this.modeToKeymaps.hasOwnProperty(r))for(let o of i){let{found:s,index:a}=Xi(this.modeToKeymaps[r],c=>Mo(o,c.keys));s&&this.modeToKeymaps[r].splice(a,1)}}setMode(e){this.currentMode=e,this.reset()}clearKeys(){this.currentKeys=""}reset(){this.clearKeys(),this.searchFrom=0,this.searchTo=-1}onEscape(e){this.onEscapeCallbacks.push(e)}addEscapeAliases(...e){this.escapeAliases.push(...e)}setTypable(...e){this.typableModes.push(...e)}handleKey(e,i){let r=!0;(()=>{if(this.currentMode===null)return this.reset();if(this.typableModes.includes(this.currentMode)!==LP(e))return;let o=Er.canonicalizeKey(i);if(o===null)return this.reset();if(o===""||this.escapeAliases.includes(o))return this.onEscapeCallbacks.forEach(h=>h(o==="")),this.reset();this.currentKeys+=o;let s=this.currentKeys.match(/^([1-9]\d*)?([\D0][\d\D]*)?/);if(!s)return this.reset();let a=s[1]?+s[1]:void 0,c=s[2];if(!c)return;let l=this.modeToKeymaps[this.currentMode];if(!l||l.length===0)return this.reset();let d=zp(l,c,h=>h.keys,{from:(l.length+this.searchFrom)%l.length,to:(l.length+this.searchTo)%l.length});if(!d)return this.reset();if(d.from===d.to){let h=l[d.from];if(h.keys===c){this.reset(),h.func(a),e.preventDefault(),r=!1;return}}this.searchFrom=d.from,this.searchTo=d.to})(),r&&this.parent&&this.parent.handleKey(e,i)}static canonicalizeKey(e){var r;if(e.modifiers===null||e.key===null)return null;let i=Er.canonicalizeSpecialKey(e.key);switch(e.modifiers){case"":return i?`<${i}>`:e.key;case"Shift":return e.key.length===1&&e.key!==" "?e.key:``;case"Ctrl":return``;case"Alt":return``;case"Meta":return``;default:return null}}static canonicalizeSpecialKey(e){switch(e){case"<":return"lt";case"Backspace":return"BS";case"Tab":return"Tab";case"Enter":return"CR";case"Escape":return"Esc";case" ":return"Space";case"\\":return"Bslash";case"|":return"Bar";case"ArrowUp":return"Up";case"ArrowDown":return"Down";case"ArrowLeft":return"Left";case"ArrowRight":return"Right";default:return null}}};var Th=class{constructor(t){this.lastScroll=0;this.lastScrollInterval=0;this.vim=t}get settings(){return this.vim.settings}get viewerContainerEl(){var t,e;return(e=(t=this.vim.obsidianViewer)==null?void 0:t.dom)==null?void 0:e.viewerContainerEl}getPageDiv(t=0){var i;let e=this.vim.pdfViewer;if(e)return(i=e._pages[e.currentPageNumber-1+t])==null?void 0:i.div}scrollTo(t,e){let i=this.viewerContainerEl;if(!i)return;let r=this.isFirstScrollInAWhile(),o=r?this.settings.vimScrollSize:this.settings.vimContinuousScrollSpeed*this.lastScrollInterval;this.vim.pdfViewer&&this.settings.vimLargerScrollSizeWhenZoomIn&&(o*=Math.max(1,this.vim.pdfViewer.currentScale)),e!=null||(e=1),o*=e;let a={behavior:this.settings.vimSmoothScroll&&r?"smooth":"instant"};switch(t){case"left":a.left=-o;break;case"right":a.left=o;break;case"up":a.top=-o;break;case"down":a.top=o;break}i.scrollBy(a)}isFirstScrollInAWhile(){let t=Date.now();return this.lastScrollInterval=t-this.lastScroll,this.lastScroll=t,this.lastScrollInterval>100}scrollToTop(){if(!this.viewerContainerEl)return;let t=this.getPageDiv();t&&this.viewerContainerEl.scrollTo({top:t.offsetTop,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}scrollToBottom(){if(!this.viewerContainerEl)return;let t=this.getPageDiv();t&&this.viewerContainerEl.scrollTo({top:t.offsetTop+t.offsetHeight-this.viewerContainerEl.clientHeight,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}scrollVerticallyByVisualPage(t){if(!this.viewerContainerEl)return;let e=this.viewerContainerEl.clientHeight;e*=t,this.viewerContainerEl.scrollBy({top:e,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}scrollHorizontallyByVisualPage(t){if(!this.viewerContainerEl)return;let e=this.viewerContainerEl.clientWidth;e*=t,this.viewerContainerEl.scrollBy({left:e,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}};var Hx=require("obsidian");var Bx=200,Ch=class{constructor(t){this.isActive=!1;this.isForward=!0;this.vim=t}get settings(){return this.vim.settings}get lib(){return this.vim.lib}get incsearch(){return this.settings.vimIncsearch}get hlsearch(){return this.settings.vimHlsearch}get findBar(){var t;return(t=this.vim.obsidianViewer)==null?void 0:t.findBar}findNext(t=1,e=!0){if(this.isActive&&this.findBar){for(this.vim.visualMode.rememberSelection();t-- >0;)this.findBar.dispatchEvent("again",e?!this.isForward:this.isForward);this.restoreSelectionAndExtendToMatch()}}findPrevious(t){this.findNext(t,!1)}restoreSelectionAndExtendToMatch(){setTimeout(()=>{let t=this.vim.doc.getSelection();if((!t||t.isCollapsed)&&this.vim.visualMode.restorePreviousSelection(),t=this.vim.doc.getSelection(),t&&!t.isCollapsed){let e=this.getSelectedMatchEl();e&&this.vim.visualMode.extendSelectionToNode(e)}},Bx)}start(t){let e=this.findBar;if(!e)return;if(this.vim.visualMode.rememberSelection(),e.opened){e.searchComponent.inputEl.select();return}this.isActive=!0,this.isForward=t,e.searchSettings.highlightAll=this.hlsearch,this.lib.updateSearchSettingsUI(e);let i=e.searchComponent.changeCallback;this.incsearch?e.searchComponent.onChange((0,Hx.debounce)(()=>{e.dispatchEvent("again")},250,!0)):e.searchComponent.onChange(()=>{}),e.showSearch();let r=o=>{this.isActive&&(o.isComposing||o.key==="Enter"&&(wt(o,o.target)&&o.target.blur(),o.stopPropagation(),this.incsearch?this.restoreSelectionAndExtendToMatch():this.findNext()))};e.searchComponent.inputEl.addEventListener("keypress",r,!0),this.lib.registerPDFEvent("findbarclose",e.eventBus,null,()=>{this.isActive=!1,e.searchComponent.inputEl.removeEventListener("keypress",r,!0),i&&e.searchComponent.onChange(i)})}findAndSelectNextMatch(t,e){this.findNext(t,e),setTimeout(()=>{let i=this.vim.doc.getSelection();if(!i)return;let r=this.getSelectedMatchEl();r&&(i.isCollapsed?i.selectAllChildren(r):this.vim.visualMode.extendSelectionToNode(r,1))},Bx+1)}getSelectedMatchEl(){var i,r;let t=(r=(i=this.vim.obsidianViewer)==null?void 0:i.dom)==null?void 0:r.viewerEl;return t?t.querySelector(".textLayer .textLayerNode > .highlight.selected"):null}};var en=class extends de{constructor(e){super(e.plugin);this.vim=e}get vimScope(){return this.vim.vimScope}get doc(){return this.vim.doc}get viewer(){return this.vim.viewer}get obsidianViewer(){return this.vim.obsidianViewer}get pdfViewer(){return this.vim.pdfViewer}};var Eh=class extends en{constructor(e){super(e);this.selectionChangedByVisualMotion=!1;this.previousSelection=null;this.defineKeymaps()}get structureParser(){return this.vim.structureParser}onload(){this.registerDomEvent(this.doc,"selectionchange",()=>{let e=this.doc.getSelection();switch(this.vim.vimScope.currentMode){case"visual":(!e||e.isCollapsed)&&(this.selectionChangedByVisualMotion||this.vim.vimScope.setMode("normal"));break;default:if(e&&!e.isCollapsed&&e.rangeCount>0){let i=e.getRangeAt(0);this.vim.viewer.containerEl.contains(i.commonAncestorContainer)&&this.vim.vimScope.setMode("visual")}}this.selectionChangedByVisualMotion=!1})}defineKeymaps(){let e=i=>r=>(i(r),this.selectionChangedByVisualMotion=!0);this.vimScope.registerKeymaps(["visual"],{...this.settings.vimVisualMotion?{j:e(i=>this.extendSelectionByLine(i!=null?i:1)),k:e(i=>this.extendSelectionByLine(-(i!=null?i:1))),h:e(i=>this.extendSelectionByChar(i!=null?i:1,!1)),l:e(i=>this.extendSelectionByChar(i!=null?i:1,!0)),w:e(i=>{let r=this.doc.getSelection();r&&(No(()=>{r.modify("extend","forward","word"),r.modify("extend","forward","word"),r.modify("extend","backward","word"),Zi(r)&&r.modify("extend","forward","character")},i),this.ensureSelectionHeadAtTextDiv(r,!1))}),e:e(i=>{let r=this.doc.getSelection();r&&(No(()=>{Zi(r)||r.modify("extend","forward","character"),r.modify("extend","forward","word"),Zi(r)||r.modify("extend","backward","character")},i),this.ensureSelectionHeadAtTextDiv(r,!1))}),b:e(i=>{let r=this.doc.getSelection();r&&(No(()=>{Zi(r)&&r.modify("extend","backward","character"),r.modify("extend","backward","word"),Zi(r)&&r.modify("extend","forward","character")},i),this.ensureSelectionHeadAtTextDiv(r,!0))}),0:e(()=>this.extendSelctionToLineBoundary(!1)),"^":e(()=>this.extendSelctionToLineBoundary(!1)),$:e(()=>this.extendSelctionToLineBoundary(!0))}:{},o:e(()=>{let i=this.doc.getSelection();i&&Sc(i)}),y:()=>{let i=this.doc.getSelection();if(i){let r=i.toString();r&&navigator.clipboard.writeText(r),i.empty()}},c:()=>{var i;this.lib.commands.copyLink(!1),(i=this.doc.getSelection())==null||i.empty()},C:()=>{let i=this.doc.getSelection();i&&setTimeout(()=>{this.viewer.then(r=>{Dh(this.plugin,r,i)})})}})}getTextDivContainingNode(e){let i=e.instanceOf(Element)?e:e.parentElement;if(!i)return null;let r=i.closest(".textLayerNode");return r||null}getTextDivAtSelectionHead(e){let{focusNode:i}=e;return i?this.getTextDivContainingNode(i):null}getSelectionPos(e,i){let r=i==="head",o=r?e.focusNode:e.anchorNode;if(!o)return null;let s=this.getTextDivContainingNode(o);if(!s||s.dataset.idx===void 0)return null;let a=+s.dataset.idx,c=(()=>{let d=r?e.focusOffset:e.anchorOffset,h=this.doc.createNodeIterator(s,NodeFilter.SHOW_ALL),u,f=0;for(;u=h.nextNode();){if(u===o)return f+=u.nodeType===Node.TEXT_NODE?d:Array.from(o.childNodes).slice(0,d).map(p=>p.textContent.length).reduce((p,g)=>p+g,0),f;u.nodeType===Node.TEXT_NODE&&(f+=u.textContent.length)}return f})();if(typeof c!="number")return null;Zi(e)===r&&c--;let l=d=>d.instanceOf(HTMLElement)&&d.hasClass("textLayerNode")&&!!d.textContent;if(c<0){let d=s.previousSibling;for(;d&&!l(d);)d=d.previousSibling;d&&l(d)&&d.dataset.idx!==void 0&&(a=+d.dataset.idx,c=d.textContent.length-1)}else if(s.textContent&&c>=s.textContent.length){let d=s.nextSibling;for(;d&&!l(d);)d=d.nextSibling;d&&l(d)&&d.dataset.idx!==void 0&&(a=+d.dataset.idx,c=0)}return{index:a,offset:c}}extendSelection(e){var l,d,h;let i=this.doc.getSelection();if(!i)return;let r=this.lib.getPageElFromSelection(i);if(!r||r.dataset.pageNumber===void 0)return;let o=+r.dataset.pageNumber,s=(l=this.structureParser)==null?void 0:l.getPageParser(o);if(!s)return;let a=this.getSelectionPos(i,"head");if(!a)return;let c=e({currentHeadPos:a,pageNumber:o,pageParser:s});if(c){let u=s.divs[c.index],f=c.offset;f<0&&(f+=(h=(d=u.textContent)==null?void 0:d.length)!=null?h:0);let p=ta(u,f);if(!p)return;this.extendSelectionToNode(p.node,p.offset)}}extendSelectionToNode(e,i){let r=this.doc.getSelection();r&&(r.extend(e,i),Zi(r)&&r.modify("extend","forward","character"))}extendSelectionByLine(e){this.extendSelection(({currentHeadPos:i,pageParser:r})=>r.getLineShiftPosition(i,e))}extendSelctionToLineBoundary(e){this.extendSelection(({currentHeadPos:i,pageParser:r})=>{let o=r.getBoundIndicesOfLine(i.index,0);return o?e?{index:o.end,offset:-1}:{index:o.start,offset:0}:null})}extendSelectionByChar(e,i){let r=this.doc.getSelection();r&&(No(()=>r.modify("extend",i?"forward":"backward","character"),e),this.ensureSelectionHeadAtTextDiv(r,i))}selectMatch(){var i;let e=this.vim.search.getSelectedMatchEl();e&&((i=this.vim.doc.getSelection())==null||i.selectAllChildren(e))}ensureSelectionHeadAtTextDiv(e,i){let r=this.getTextDivAtSelectionHead(e);for(;!r;)e.modify("extend",i?"forward":"backward","character"),r=this.getTextDivAtSelectionHead(e)}setSelectionByPos(e,i){let r=this.doc.getSelection();if(!r)return;let o=c=>{var f,p;let{page:l,pos:d}=c,h=(p=(f=this.vim.child)==null?void 0:f.getPage(l).textLayer)==null?void 0:p.textDivs;if(!h||!h.length)return;let u=h[d.index];return ta(u,d.offset)},s=o(e),a=o(i);if(s&&a){r.setBaseAndExtent(s.node,s.offset,a.node,a.offset);let c=Zi(r);c||Sc(r),r.modify("extend","forward","character"),c||Sc(r)}}rememberSelection(){var i,r;let e=this.doc.getSelection();if(e&&!e.isCollapsed&&e.anchorNode&&e.focusNode){let o=(i=this.lib.getPageElAssociatedWithNode(e.anchorNode))==null?void 0:i.dataset.pageNumber,s=(r=this.lib.getPageElAssociatedWithNode(e.focusNode))==null?void 0:r.dataset.pageNumber;if(o&&s){let a=this.getSelectionPos(e,"anchor"),c=this.getSelectionPos(e,"head");a&&c&&(this.previousSelection={anchor:{page:+o,pos:a},head:{page:+s,pos:c}})}}}restorePreviousSelection(){if(this.vim.doc.getSelection()&&this.vim.visualMode.previousSelection){let{anchor:i,head:r}=this.vim.visualMode.previousSelection;this.setSelectionByPos(i,r)}}forgetPreviousSelection(){this.previousSelection=null}};var Ah=class extends en{constructor(t){super(t),this.defineKeymaps()}onload(){this.viewer.then(t=>{this.lib.registerPDFEvent("sidebarviewchanged",t.pdfViewer.eventBus,this,({view:e})=>{e===2?this.vim.enterOutlineMode():this.vim.enterNormalMode()}),this.lib.registerPDFEvent("outlineloaded",t.pdfViewer.eventBus,this,({source:e})=>{t.pdfViewer.pdfSidebar.active===2?this.vim.enterOutlineMode():this.vim.enterNormalMode()})})}defineKeymaps(){this.registerOutlineKeymaps({j:(t,e)=>this.navigateOutline(t,!0,e),k:(t,e)=>this.navigateOutline(t,!1,e),h:t=>{let e=t.highlighted;e&&e.parent&&(this.changeActiveItemTo(e.parent),this.collapse(e.parent))},l:t=>{let e=t.highlighted;if(e){this.expand(e);let i=e.children[0];i&&this.changeActiveItemTo(i)}},H:t=>{let e=t.highlighted;if(t.allItems.forEach(i=>{this.collapse(i)}),e){let i=e;for(;i.parent;)i=i.parent;this.changeActiveItemTo(i)}},L:t=>{t.allItems.forEach(e=>{this.expand(e)})},"":t=>{let e=t.highlighted;e&&e.selfEl.click()}}),this.vimScope.noremap(["outline"],{"":"","":"j","":"k","":"h","":"l","":"H","":"L"})}registerOutlineKeymaps(t){let e={};for(let i in t)e[i]=this.toVimCommand(t[i]);this.vimScope.registerKeymaps(["outline"],e)}toVimCommand(t){return e=>{var r;let i=(r=this.obsidianViewer)==null?void 0:r.pdfOutlineViewer;i&&t(i,e)}}changeActiveItemTo(t){var i;let e=t.owner;(i=e.highlighted)==null||i.setActive(!1),t.setActive(!0),e.highlighted=t,t.selfEl.scrollIntoView({block:"center",behavior:this.settings.vimSmoothOutlineMode?"smooth":"instant"})}collapse(t){t.setCollapsed(!0,this.settings.vimSmoothOutlineMode)}expand(t){t.setCollapsed(!1,this.settings.vimSmoothOutlineMode)}navigateOutline(t,e,i){let r=t.highlighted;if(r){let o=(()=>{i!=null||(i=1);let s=1/0,a=t.children.slice().reverse(),c=[];for(;a.length;){let l=a.pop();if(c.push(l),l===r&&(s=c.length-1+(e?i:-i)),c.length>s)return c[s];!l.children.length||l.collapsed||a.push(...l.children.slice().reverse())}})();o&&this.changeActiveItemTo(o)}}};var zo=require("obsidian");var jx=require("obsidian");var qx=require("obsidian");function*zx(n,t){let e=OP(t),i=Math.max(0,Math.ceil((n-t.length)/(t.length-1)));yield*NP(e,i,n+i)}function*OP(n){for(let t=1;;t++)yield*RP(MP(n,t),e=>e.join(""))}function*MP(n,t){let e=n.length,i=new Array(t).fill(0),r=1;for(let o of mg(Math.pow(e,t))){yield i.map(s=>n[s]);for(let s of mg(i.length))Ux(r,Math.pow(e,i.length-1-s))===0&&(i[s]=Ux(i[s]+1,e));r++}}function*NP(n,t,e){let i=n[Symbol.iterator]();e===void 0&&(e=t,t=0);for(let r of mg(t))if(i.next().done)return;for(let r=t;r section.linkAnnotation:has(> a)",[1]:".annotationLayer > section:not(.linkAnnotation)",[2]:".pdf-plus-backlink-highlight-layer > .pdf-plus-backlink"},tn=class extends en{constructor(){super(...arguments);this.onExitCallbacks=[];this.targets=[]}setTarget(...e){this.targets=e}getTargetSelector(){return this.targets.map(e=>Ih[e]).join(",")}enter(){if(this.targets.length===0&&this.setTarget(0),this.pdfViewer){let e=this.pdfViewer.currentPageNumber;if(this.hintPage(e),this.targets.includes(2)){let i=this.vim.eventBus;if(i){let r=()=>this.hintPage(e);i.on("textlayerrendered",r),this.onExit(()=>i.off("textlayerrendered",r))}}}}exit(){this.vimScope.unregisterAllKeymaps(["hint"]),this.onExitCallbacks.forEach(e=>e())}onExit(e){this.onExitCallbacks.push(e)}hintPage(e){if(!this.pdfViewer)return;let i=this.pdfViewer.getPageView(e-1),r=i.div;if(!r)return;let o={},s="pdf-plus-vim-hint-mode",a="pdfPlusVimHint";r.addClass(s),this.onExit(()=>r.removeClass(s));let c=this.getTargetSelector(),l=r.querySelectorAll(c),d=l.length;if(d===0){new qx.Notice(`${this.plugin.manifest.name} (Vim mode): No hintable element found on this page`),this.exit(),this.vim.enterNormalMode();return}let h=zx(d,this.settings.vimHintChars),u=null,f=null;l.forEach(p=>{var m;if(tn.isLink(p)){let b=p.querySelector(":scope > a");if(u&&u.href===b.href&&VP(u,b))return;u=b}else u=null;if(tn.isBacklinkHighlight(p)){let b=(m=p.dataset.backlinkId)!=null?m:null;if(f&&b&&f===b)return;f=b}else f=null;let g=""+h.next().value;p.dataset[a]=g,this.onExit(()=>delete p.dataset[a]),o[g]=()=>{this.openHintableEl(p,i),this.exit(),this.vim.enterNormalMode()}}),this.vimScope.unregisterAllKeymaps(["hint"]),this.vimScope.registerKeymaps(["hint"],o)}openHintableEl(e,i){var r,o;if(tn.isLink(e))e.querySelector(":scope > a").click();else if(tn.isNonLinkAnnot(e)){rh(e);let s=e.dataset.annotationId,a=s&&((r=i==null?void 0:i.annotationLayer)==null?void 0:r.annotationLayer.getAnnotation(s));a&&((o=this.vim.child)==null||o.renderAnnotationPopup(a))}else tn.isBacklinkHighlight(e)&&rh(e)}static isLink(e){return e.matches(Ih[0])}static isNonLinkAnnot(e){return e.matches(Ih[1])}static isBacklinkHighlight(e){return e.matches(Ih[2])}},VP=(n,t)=>{let e=n.getBoundingClientRect(),i=t.getBoundingClientRect(),r=Math.min(i.height,i.width)*.5,o=r*5;return Math.abs((i.top+i.bottom)/2-(e.top+e.bottom)/2)[{id:"nextpage",func:()=>{var t;return(t=n.pdfViewer)==null?void 0:t.nextPage()}},{id:"prevpage",func:()=>{var t;return(t=n.pdfViewer)==null?void 0:t.previousPage()}},{id:"0",description:":0 - Go to the first page (same as :1)",func:()=>n.pdfViewer&&(n.pdfViewer.currentPageNumber=1)},{id:"$",description:":$ - Go to the last page.",func:()=>n.pdfViewer&&(n.pdfViewer.currentPageNumber=n.pdfViewer.pagesCount)},{id:"gotopage",pattern:/^go(to(page)?)?$/,description:":go[to[page]] - Go to the specified page. If the PDF has page labels, the argument is treated as a page label. Otherwise, it is treated as a page number.",minNargs:1,func:async t=>{if(n.pdfViewer){let e=await n.pdfViewer.pdfDocument.getPageLabels();if(e){let i=e.indexOf(t);if(i!==-1){let r=i+1;n.pdfViewer.currentPageNumber=r;return}}n.pdfViewer.currentPageNumber=+t}}},{id:"pagetop",func:()=>n.scroll.scrollToTop()},{id:"pagebottom",func:()=>n.scroll.scrollToBottom()},{id:"searchforward",pattern:/^search(f(orward)?)?$/,func:()=>setTimeout(()=>n.search.start(!0))},{id:"searchbackward",pattern:/^searchb(ackward)?$/,func:()=>setTimeout(()=>n.search.start(!1))},{id:"findnext",func:()=>n.search.findNext()},{id:"findprev",func:()=>n.search.findPrevious()},{id:"zoom",description:":zoom - Set the zoom level to percent.",minNargs:1,func:t=>n.pdfViewer&&(n.pdfViewer.currentScale=.01*+t)},{id:"zoomin",func:()=>{var t;return(t=n.obsidianViewer)==null?void 0:t.zoomIn()}},{id:"zoomout",func:()=>{var t;return(t=n.obsidianViewer)==null?void 0:t.zoomOut()}},{id:"zoomreset",func:()=>{var t;return(t=n.obsidianViewer)==null?void 0:t.zoomReset()}},{id:"rotate",func:()=>{var t;return(t=n.obsidianViewer)==null?void 0:t.rotatePages(90)}},{id:"yank",pattern:/^y(ank)?$/,func:()=>{let t=n.doc.getSelection();if(t){let e=t.toString();e&&navigator.clipboard.writeText(e),n.enterNormalMode()}}},{id:"outline",pattern:/^(outline)|(toc)$/,description:":outline or :toc - Show the outline view.",func:()=>n.lib.commands.showOutline(!1)},{id:"thumbnail",pattern:/^thumb(nail)?$/,description:":thumb[nail] - Show the thumbnails view.",func:()=>n.lib.commands.showThumbnail(!1)},{id:"closesidebar",func:()=>n.lib.commands.closeSidebar(!1)},{id:"help",pattern:/^h(elp)?$/,func:t=>{if(t&&t.startsWith(":")){let e=t.slice(1).split(" ")[0],i=n.commandLineMode.findCommand(e);if(i&&i.description){ua.renderAsModal(n.plugin,BP(i.description));return}}n.plugin.openSettingTab().scrollToHeading("vim")}},{id:"map",minNargs:2,func:(t,...e)=>n.map(["normal","visual","outline"],t,e.join(" ")),description:Ar("map",["normal","visual","outline"])},{id:"noremap",pattern:/^no(remap)$/,minNargs:2,func:(t,...e)=>n.noremap(["normal","visual","outline"],t,e.join(" ")),description:Ar("no[remap]",["normal","visual","outline"],!0)},{id:"nmap",pattern:/^nm(ap)?$/,minNargs:2,func:(t,...e)=>n.map(["normal"],t,e.join(" ")),description:Ar("nm[ap]",["normal"])},{id:"nnoremap",pattern:/^nn(oremap)?$/,minNargs:2,func:(t,...e)=>n.noremap(["normal","visual","outline"],t,e.join(" ")),description:Ar("nn[oremap]",["normal"],!0)},{id:"vmap",pattern:/^vm(ap)?$/,minNargs:2,func:(t,...e)=>n.map(["visual"],t,e.join(" ")),description:Ar("vm[ap]",["visual"])},{id:"vnoremap",pattern:/^vn(oremap)?$/,minNargs:2,func:(t,...e)=>n.noremap(["visual"],t,e.join(" ")),description:Ar("vn[oremap]",["visual"],!0)},{id:"omap",pattern:/^om(ap)?$/,minNargs:2,func:(t,...e)=>n.map(["outline"],t,e.join(" ")),description:Ar("om[ap]",["outline"])},{id:"onoremap",pattern:/^ono(remap)?$/,minNargs:2,func:(t,...e)=>n.noremap(["outline"],t,e.join(" ")),description:Ar("ono[remap]",["outline"],!0)},{id:"unmap",pattern:/^unm(ap)?$/,minNargs:1,func:t=>n.vimScope.unmap(["normal","visual","outline"],[t]),description:":unm[ap] - Unmap in all modes."},{id:"nunmap",pattern:/^nun(map)?$/,minNargs:1,func:t=>n.vimScope.unmap(["normal"],[t]),description:":nun[map] - Unmap in normal mode."},{id:"vunmap",pattern:/^vu(nmap)?$/,minNargs:1,func:t=>n.vimScope.unmap(["visual"],[t]),description:":vu[nmap] - Unmap in visual mode."},{id:"ounmap",pattern:/^ou(nmap)?$/,minNargs:1,func:t=>n.vimScope.unmap(["outline"],[t]),description:":ou[nmap] - Unmap in outline mode."},{id:"js",pattern:/^js(command)?$/,minNargs:1,func:(...t)=>n.evalUserScript(t.join(" ")),description:`:js[command] : Execute the given javascript in a context where "this" points to a "${Uo.name}" object.`},{id:"jsfile",minNargs:1,func:async(...t)=>{var r,o;let e=(0,jx.normalizePath)(t.join(" ")),i=await n.app.vault.adapter.read((o=(r=n.app.metadataCache.getFirstLinkpathDest(e,""))==null?void 0:r.path)!=null?o:e);return await n.evalUserScript(i)},description:`:jsfile - Execute the javascript code in the file at (relative to the vault root; can be just the filename if it's unique). It can be any plain text file with arbitrary file extension. The code will be evaluated in a context where "this" points to a "${Uo.name}" object.`},{id:"obcommand",description:":obcommand - Execute the Obsidian command with the specified ID. Inspired by esm's awesome Vimrc Support plugin.",minNargs:1,func:t=>n.app.commands.executeCommandById(t)},{id:"hint",description:` + :hint [ ...] - Enter hint mode and show hint marks for the specified targets in the current page. Inspired by [Tridactyl](https://github.com/tridactyl/tridactyl)'s hint mode. + + If no target is specified, the default targets (configured in PDF++ settings) will be used. + The accepted targets are: + + - \`all\`: all of the followings + - \`link\`: internal & external links + - \`annot\`: (non-link) annotations written in the file + - \`backlink\`: backlink highlighting, i.e., highlights that is not written in the file itself + `,func:(...t)=>{t.length===0&&(t=n.settings.vimHintArgs.trim().split(/\s+/)),t.includes("all")&&(t=["link","annot","backlink"]),n.hintMode.setTarget(...t.map(e=>{switch(e){case"link":return 0;case"annot":return 1;case"backlink":return 2;default:throw Error(`Unknown hint target: ${e}`)}})),setTimeout(()=>n.enterHintMode())}}],BP=(n,t=12,e=!0)=>(n=n.replace(new RegExp(`^ {${t}}`,"gm"),"").replace(/^\s*/,""),e?n.replace(/([<>])/g,"\\$1"):n),Ar=(n,t,e=!1)=>`:${n} - Map to ${e?"non-recusively ":""}in ${t.length>1?t.slice(0,-1).join(", ")+" and "+t.at(-1)+" modes":t[0]+" mode"}. If is an ex-command, it must be start with ":".`;var Lh=class extends en{constructor(e){super(e);this.history=[];this.historyIndex=0;this.isActive=!1;this.dom=this.vim.viewer.containerEl.createDiv("pdf-plus-vim-command",i=>{this.register(()=>i.remove()),i.appendText(":"),this.inputEl=i.createEl("input",{cls:"pdf-plus-vim-command-input"},r=>{r.placeholder="type a command or page number...",r.addEventListener("focusout",()=>{setTimeout(()=>{this.isActive&&this.vim.enterNormalMode()})}),r.addEventListener("keydown",o=>{if(!o.isComposing&&o.key==="Enter"){this.submitCommand();return}if(o.key==="Escape"||o.key==="Backspace"&&!r.value){this.vim.enterNormalMode(),o.preventDefault();return}if(o.key==="ArrowUp"||o.key==="ArrowDown"){o.preventDefault(),this.navigateHistory(o.key==="ArrowDown");return}})}),i.hide()}),this.vimScope.registerKeymaps(["command"],{"":()=>this.inputEl.value="","":()=>this.inputEl.value=this.inputEl.value.replace(/\S+\s*$/,"")}),this.excmds=Kx(this.vim),this.suggest=new bg(this).onSelect(({item:{minNargs:i}})=>setTimeout(()=>{if(!i){this.submitCommand();return}this.inputEl.value+=" "})),this.settings.vimrcPath&&this.viewer.then(i=>{let r=i.pdfViewer.eventBus;r&&r.on("pagesloaded",()=>setTimeout(()=>{if(this.plugin.vimrc===null){let o=(0,zo.normalizePath)(this.settings.vimrcPath);this.app.vault.adapter.read(o).then(s=>this.runScript(this.plugin.vimrc=s))}else this.runScript(this.plugin.vimrc)},{once:!0}))})}async executeCommand(e,i={error:["notice","console.error"],history:!0}){if(i={error:[],history:!0,...i},i.history&&(this.history.push(e),this.history.length>100&&this.history.shift(),this.historyIndex=this.history.length),e.startsWith("!")){if(!zo.Platform.isDesktopApp){this.reportError(`${this.plugin.manifest.name} (Vim mode): Shell command is not supported on mobile`,i.error);return}let{exec:a}=require("child_process"),c=process.env;return this.settings.PATH&&(c.PATH=this.settings.PATH),new Promise((l,d)=>a(e.slice(1),{env:c},(h,u,f)=>{h&&d(h),u&&(alert(u),l(u)),f&&console.warn(f)}))}if(/^[1-9]\d*$/.test(e)){let a=+e;this.pdfViewer&&(this.pdfViewer.currentPageNumber=a);return}let[r,...o]=e.split(/\s+/),s=this.findCommand(r);if(s){if(s.minNargs&&o.lengthi.pattern&&i.pattern.test(e)||i.id===e)}submitCommand(){let e=this.inputEl.value.trim();if(e){this.history[this.historyIndex]===e&&this.history.splice(this.historyIndex,1);try{this.executeCommand(e)}catch(r){new zo.Notice(`${this.plugin.manifest.name} (Vim mode): Error occurred while executing the command : ${r}`),console.error(r)}}this.vim.enterNormalMode()}runScript(e){this.parseScript(e).forEach(r=>this.executeCommand(r,{error:["console.warn"],history:!1}))}parseScript(e){return e.split(/\r?\n/).filter(i=>i.trim()&&!i.trimStart().startsWith('"')).join(` +`).replace(/\\\n/g,"").split(` +`)}enter(){this.inputEl.value="",this.dom.show(),this.inputEl.focus(),this.isActive=!0}exit(){this.isActive=!1,this.inputEl.value="",this.dom.hide()}navigateHistory(e){let i=this.inputEl;if(this.historyIndexs.key==="Escape"&&s.modifiers==="");i&&this.scope.unregister(i);let r=this.scope.keys.find(s=>s.key==="ArrowDown"&&s.modifiers===""),o=this.scope.keys.find(s=>s.key==="ArrowUp"&&s.modifiers==="");r&&(this.scope.unregister(r),this.scope.register([],"Tab",r.func)),o&&(this.scope.unregister(o),this.scope.register(["Shift"],"Tab",o.func))}getItems(){return this.commandLineMode.excmds}getItemText(e){return e.id}};var Oh=class extends de{constructor(e,i,r){super(e);this.pages=new Map;this.pdfViewer=i,this.file=r}onload(){this.registerEvent(this.app.vault.on("modify",e=>{e===this.file&&this.pages.clear()}))}getPageParser(e){var r,o;let i=this.pages.get(e);if(!i){let s=this.pdfViewer.getPageView(e-1);if(s){let a=(r=s.textLayer)==null?void 0:r.textContentItems,c=(o=s.textLayer)==null?void 0:o.textDivs;a&&c&&(i=new xg(s,a,c),this.pages.set(e,i))}}return i}},xg=class{constructor(t,e,i){this.lineStartIndices=null;this.pageView=t,this.items=e,this.divs=i}getBoundIndicesOfLine(t,e){var a;let i=this._getIndexWithinLineStartIndicesForLineContainingItem(t),r=(a=this.lineStartIndices[i+e])!=null?a:null;if(r===null)return null;let o=this.lineStartIndices[i+1+e],s=o===void 0?this.items.length-1:o-1;for(;s>r&&!this.items[s].str.length;)s--;return{start:r,end:s}}getLineShiftPosition(t,e){let i=this.getBoundIndicesOfLine(t.index,e);if(!i)return null;let r=this._getHorizontalRangeOfChar(t);if(!r)return null;let{start:o,end:s}=i,a=o;for(;a<=s;a++){let d=this.items[a],h=this._getHorizontalRangeOfItem(d);if(qp(r,h))break}for(a>s&&(a=s);a>o&&!this.items[a].str.length;)a--;let c=this.items[a],l=0;for(;;){let d=this._getHorizontalRangeOfChar({index:a,offset:l});if(!d)return null;if(d.from>=r.from||d.to>=r.to)return{index:a,offset:l};if(l+1t-r);return e?i:i-1}parse(){let t=this._findIndexOfFirstNonEmptyItem();if(t===-1){this.lineStartIndices=[0];return}this.lineStartIndices=[t];let e=[this.items[t]];for(let i=t+1;ithis.isItemNonEmpty(t))}isItemNonEmpty(t){let e=this._getVerticalRangeOfItem(t);return e.froms.from)),o=Math.max(...i.map(s=>s.to));return{from:r,to:o}}_getHorizontalRangeOfItem(t){return{from:t.transform[4],to:t.transform[4]+t.width}}_getHorizontalRangeOfChar(t){let e=t.index,i=t.offset,r=this.items[e];if(r.chars&&r.chars.length>=r.str.length){let f=r.chars[i];return{from:f.r[0],to:f.r[2]}}let o=this.divs[e],s=ta(o,i);if(!s)return null;let{node:a,offset:c}=s,l=o.doc.createRange();l.setStart(a,c),l.setEnd(a,c+1);let d=l.getBoundingClientRect(),[[h],[u]]=[...ah(this.pageView,[{x:d.left,y:d.bottom},{x:d.right,y:d.top}])];return{from:h,to:u}}};var fa=class extends de{constructor(e,i){super(e);this._structureParser=null;this.viewer=i,this.vimScope=new Er(this.viewer.scope),this.vimScope.registerKeymaps(["normal","visual","outline"],{":":()=>this.enterCommandMode(),"":()=>{if(this.obsidianViewer){let r=this.obsidianViewer.pdfSidebar;r.isOpen&&r.active===2?r.close():r.switchView(2,!0)}},"":()=>{if(this.obsidianViewer){let r=this.obsidianViewer.pdfSidebar;r.isOpen&&r.active===1?r.close():r.switchView(1,!0)}},f:()=>this.commandLineMode.executeCommand("hint")}),this.vimScope.registerKeymaps(["normal","visual","outline"],{j:r=>this.scroll.scrollTo("down",r),k:r=>this.scroll.scrollTo("up",r),h:r=>this.scroll.scrollTo("left",r),l:r=>this.scroll.scrollTo("right",r),J:ch(()=>{var r;return(r=this.pdfViewer)==null?void 0:r.nextPage()}),K:ch(()=>{var r;return(r=this.pdfViewer)==null?void 0:r.previousPage()}),gg:()=>this.pdfViewer&&(this.pdfViewer.currentPageNumber=1),G:r=>this.pdfViewer&&(this.pdfViewer.currentPageNumber=r!=null?r:this.pdfViewer.pagesCount),0:()=>this.scroll.scrollToTop(),"^":()=>this.scroll.scrollToTop(),$:()=>this.scroll.scrollToBottom(),"":r=>this.scroll.scrollVerticallyByVisualPage(r!=null?r:1),"":r=>this.scroll.scrollVerticallyByVisualPage(-(r!=null?r:1)),"":r=>this.scroll.scrollVerticallyByVisualPage(.5*(r!=null?r:1)),"":r=>this.scroll.scrollVerticallyByVisualPage(-.5*(r!=null?r:1)),"/":()=>this.search.start(!0),"?":()=>this.search.start(!1),n:r=>this.search.findNext(r),N:r=>this.search.findPrevious(r),gn:r=>this.search.findAndSelectNextMatch((r!=null?r:1)-1),gN:r=>this.search.findAndSelectNextMatch((r!=null?r:1)-1,!1),"+":r=>{var o;return(o=this.obsidianViewer)==null?void 0:o.zoomIn(r)},"-":r=>{var o;return(o=this.obsidianViewer)==null?void 0:o.zoomOut(r)},"=":r=>{var o;if(typeof r=="number"&&this.pdfViewer){this.pdfViewer.currentScaleValue=""+.01*r;return}(o=this.obsidianViewer)==null||o.zoomReset()},r:r=>{var o;return(o=this.obsidianViewer)==null?void 0:o.rotatePages(90*(r!=null?r:1))},R:r=>{var o;return(o=this.obsidianViewer)==null?void 0:o.rotatePages(-90*(r!=null?r:1))}}),this.vimScope.noremap(["normal","visual","outline"],{H:"^",L:"$",zi:"+",zo:"-",z0:"="}),this.vimScope.setMode("normal"),this.vimScope.setTypable("command"),this.vimScope.onEscape(r=>{var o,s,a;this.enterNormalMode(),(o=this.obsidianViewer)==null||o.pdfSidebar.close(),(a=(s=this.child)==null?void 0:s.hoverPopover)==null||a.hide(),r||this.viewer.then(c=>{c.clearEphemeralUI(),c.findBar.close()})}),this.vimScope.addEscapeAliases("",""),this.scroll=new Th(this),this.search=new Ch(this),this.visualMode=this.addChild(new Eh(this)),this.commandLineMode=this.addChild(new Lh(this)),this.outlineMode=this.addChild(new Ah(this)),this.hintMode=this.addChild(new tn(this))}get child(){return this.viewer.child}get obsidianViewer(){var e;return(e=this.viewer.child)==null?void 0:e.pdfViewer}get pdfViewer(){var e,i;return(i=(e=this.viewer.child)==null?void 0:e.pdfViewer)==null?void 0:i.pdfViewer}get eventBus(){var e;return(e=this.obsidianViewer)==null?void 0:e.eventBus}get file(){var e;return(e=this.viewer.child)==null?void 0:e.file}get structureParser(){var e;return!this._structureParser&&this.pdfViewer&&((e=this.viewer.child)!=null&&e.file)&&(this._structureParser=this.addChild(new Oh(this.plugin,this.pdfViewer,this.viewer.child.file))),this._structureParser}get doc(){return this.viewer.containerEl.doc}onload(){this.lib.workspace.iteratePDFViews(e=>{e.viewer===this.viewer&&(e.scope=this.vimScope)})}onunload(){this.lib.workspace.iteratePDFViews(e=>{e.viewer===this.viewer&&(e.scope=this.viewer.scope)})}static register(e,i){e.settings.vim&&(i.vim=e.addChild(i.addChild(new fa(e,i))))}enterNormalMode(){var e;this.vimScope.setMode("normal"),(e=this.doc.getSelection())==null||e.empty(),this.commandLineMode.exit(),this.hintMode.exit(),this.visualMode.forgetPreviousSelection()}enterCommandMode(){this.vimScope.setMode("command"),this.commandLineMode.enter()}enterOutlineMode(){if(this.settings.enableVimOutlineMode&&this.obsidianViewer){this.vimScope.setMode("outline");let e=this.obsidianViewer.pdfOutlineViewer;if(!e.highlighted){let i=e.children[0];i.setActive(!0),e.highlighted=i}}}enterHintMode(){this.vimScope.setMode("hint"),this.hintMode.enter()}mapOrNoremap(e,i,r,o){r.startsWith(":")?this.vimScope.registerKeymaps(e,{[i]:()=>this.commandLineMode.executeCommand(r.slice(1))}):r===""?this.vimScope.registerKeymaps(e,{[i]:()=>{}}):this.vimScope[o?"noremap":"map"](e,{[i]:r})}map(e,i,r){this.mapOrNoremap(e,i,r,!1)}noremap(e,i,r){this.mapOrNoremap(e,i,r,!0)}async evalUserScript(e){return new Promise(i=>{this.viewer.then(async r=>{let o=this.addChild(new Uo(this.plugin,r));i(await o.run(e))})})}};var pa=async(n,t)=>n.patchStatus.pdfInternals?!0:new Promise(e=>{t.then(i=>{var o;return n.patchStatus.pdfInternals?e(!0):(UP(n,t),!i.toolbar||(zP(n,i),!i.pdfViewer)?e(!1):(qP(n,i.pdfViewer),WP(n),n.patchStatus.pdfInternals=!0,n.classes.PDFViewerComponent=t.constructor,n.classes.PDFViewerChild=i.constructor,n.classes.ObsidianViewer=(o=i.pdfViewer)==null?void 0:o.constructor,HP(n),e(!0)))})});function HP(n){let{lib:t}=n;t.workspace.iteratePDFViewerComponents((e,i)=>{e.unload();let r=e.scope.keys.find(o=>o.modifiers===""&&o.key==="Escape");r&&e.scope.unregister(r),e.load(),i&&e.loadFile(i,n.subpathWhenPatched)})}var UP=(n,t)=>{n.register(Ze(t.constructor.prototype,{loadFile(e){return async function(i,r){let o=await e.call(this,i,r);return this.then(s=>{var a;s.parent=this,(!this.visualizer||this.visualizer.file!==i)&&((a=this.visualizer)==null||a.unload(),this.visualizer=this.addChild(da.create(n,i,s)))}),o}},onload(e){return async function(){let i=await e.call(this);return fa.register(n,this),i}}}))},zP=(n,t)=>{let{app:e,lib:i}=n;n.register(Ze(t.constructor.prototype,{load(o){return async function(...s){var f,p,g;this.hoverPopover=null,this.isFileExternal=!1,this.externalFileUrl=null,this.palette=null,this.rectHighlight=null,this.bib=null,this.component||(this.component=n.addChild(new he.Component)),this.component.load();let a=await o.call(this,...s),c=(p=(f=this.pdfViewer)==null?void 0:f.dom)==null?void 0:p.viewerContainerEl;if(c){let m=!1,b=F=>{m||(m=Mp(n.settings.showContextMenuOnMouseUpIf)&&he.Keymap.isModifier(F,n.settings.showContextMenuOnMouseUpIf))};this.component.registerDomEvent(c,"pointerdown",F=>{var v;i.highlight.viewer.clearRectHighlight(this),b(F),(v=this.component)==null||v.registerDomEvent(c,"mouseup",w)});let w=F=>{var v;if(b(F),n.settings.autoCopy){i.commands.copyLink(!1,!1);return}n.settings.replaceContextMenu&&(n.settings.showContextMenuOnMouseUpIf==="always"||m)&&(v=F.win.getSelection())!=null&&v.toString()&&F.win.setTimeout(()=>cg(n,this,F),80),c.removeEventListener("mouseup",w),m=!1}}let l=()=>{var m,b;try{if(this.toolbar)n.domManager.addChild(new ha(n,this.toolbar,this));else{let F=window.setInterval(()=>{this.toolbar&&(n.domManager.addChild(new ha(n,this.toolbar,this)),window.clearInterval(F))},100);window.setTimeout(()=>{window.clearInterval(F)},1e3)}let w=(b=(m=this.pdfViewer)==null?void 0:m.dom)==null?void 0:b.viewerContainerEl;n.settings.autoHidePDFSidebar&&w&&(this.component||(this.component=n.addChild(new he.Component)),this.component.registerDomEvent(w,"click",()=>{this.pdfViewer.pdfSidebar.switchView(0)}))}catch(w){new he.Notice(`${n.manifest.name}: An error occurred while mounting the color palette to the toolbar.`),console.error(w)}};if(l(),n.on("update-dom",l),!he.Platform.isMobile){let m=this.pdfViewer.eventBus;m&&m.on("textlayerrendered",({source:b})=>{var F;let w=(F=b==null?void 0:b.textLayer)==null?void 0:F.div;w&&w.addEventListener("copy",r)})}let d="1.7.0",h=(g=this.findBar)==null?void 0:g.findNextButtonEl,u=h.firstElementChild;return!(0,he.requireApiVersion)(d)&&u&&u.matches("svg.lucide-arrow-up")&&(0,he.setIcon)(h,"lucide-arrow-down"),a}},unload(o){return function(){var s;return(s=this.component)==null||s.unload(),o.call(this)}},onResize(o){return function(){let s=this.containerEl.querySelector(".pdf-viewer");return s&&n.pdfViewerChildren.set(s,this),o.call(this)}},loadFile(o){return async function(s,a){var d;this.component||(this.component=n.addChild(new he.Component));let c=!1;if(s.stat.size<300){let h=await i.getExternalPDFUrl(s);if(h){let u=e.vault.getResourcePath(s).replace(/\?\d+$/,"");this.pdfViewer.pdfPlusRedirect={from:u,to:h},await o.call(this,s,a),this.component.register(()=>URL.revokeObjectURL(h)),c=!0,this.isFileExternal=!0,this.externalFileUrl=h,this.palette&&this.palette.paletteEl&&(this.palette.removeWriteFileToggle(),this.palette.addImportButton(this.palette.paletteEl))}}c||(this.isFileExternal=!1,this.externalFileUrl=null,await o.call(this,s,a));let l=this.containerEl.querySelector(".pdf-viewer");l&&n.pdfViewerChildren.set(l,this),(d=this.bib)==null||d.unload(),this.bib=this.component.addChild(new Ci(n,this)),i.registerPDFEvent("annotationlayerrendered",this.pdfViewer.eventBus,this.component,h=>{var f,p;let{source:u}=h;(p=(f=u.annotationLayer)==null?void 0:f.div)==null||p.querySelectorAll("section[data-annotation-id]").forEach(g=>{var w,F;let m=g.dataset.annotationId;if(!m)return;let b=(w=u.annotationLayer)==null?void 0:w.annotationLayer.getAnnotation(m);b&&b.container.dataset.pdfPlusIsAnnotationPostProcessed!=="true"&&(b.data.subtype==="Link"&&typeof b.container.dataset.internalLink=="string"?Ji.registerEvents(n,this,b):b.data.subtype==="Link"&&b.data.url&&Vn.registerEvents(n,this,b),n.settings.hideReplyAnnotation&&b.data.inReplyTo&&b.data.replyType==="R"&&b.container.hide(),!he.Platform.isPhone&&n.settings.showAnnotationPopupOnHover&&((F=b.data.contentsObj)!=null&&F.str)&&kc({parentEl:b.container,createChildEl:()=>(this.destroyAnnotationPopup(),this.renderAnnotationPopup(b),this.activeAnnotationPopupEl),removeChildEl:()=>{var v;((v=this.activeAnnotationPopupEl)==null?void 0:v.dataset.annotationId)===b.data.id&&this.destroyAnnotationPopup()},component:this.component}),b.container.dataset.pdfPlusIsAnnotationPostProcessed="true")})}),i.registerPDFEvent("outlineloaded",this.pdfViewer.eventBus,null,async h=>{let u=h.source;if(!n.patchStatus.pdfOutlineViewer){let p=Gx(n,u);n.patchStatus.pdfOutlineViewer=p}if(!h.outlineCount)return;let f=this.file;f&&(n.settings.outlineDrag&&await Mx(n,u,this,f),u.allItems.forEach(p=>Qi.registerEvents(n,this,p)),n.settings.outlineContextMenu&&n.registerDomEvent(u.childrenEl,"contextmenu",p=>{p.target===p.currentTarget&&Lx(n,this,f,p)}))}),i.registerPDFEvent("thumbnailrendered",this.pdfViewer.eventBus,null,()=>{let h=this.file;h&&(n.settings.thumbnailDrag&&Nx(n,this,h),_i.registerEvents(n,this))}),n.settings.noSpreadModeInEmbed&&!On(this.pdfViewer)&&i.registerPDFEvent("pagerendered",this.pdfViewer.eventBus,null,()=>{this.pdfViewer.eventBus.dispatch("switchspreadmode",{mode:0})}),i.registerPDFEvent("sidebarviewchanged",this.pdfViewer.eventBus,null,h=>{let{source:u}=h;n.settings.noSidebarInEmbed&&!On(this.pdfViewer)&&u.close(),n.settings.defaultSidebarView===2&&u.haveOutline&&u.switchView(2)}),On(this.pdfViewer)&&i.registerPDFEvent("pagechanging",this.pdfViewer.eventBus,this.component,(0,he.debounce)(({pageNumber:h})=>{if(n.settings.viewSyncFollowPageNumber){let u=i.workspace.getActivePDFView();if(u&&u.viewer.child===this){let f={state:{file:this.file.path,page:h}};e.workspace.trigger("view-sync:state-change",u,f)}}},n.settings.viewSyncPageDebounceInterval*1e3))}},applySubpath(o){return function(s){let a=l=>{if(!l)return null;let d=parseInt(l);return Number.isNaN(d)?null:d},c=l=>{if(!l)return null;let d=parseFloat(l);return Number.isNaN(d)?null:d};if(s){s=s.startsWith("#")?s.substring(1):s;let l=this.pdfViewer,d=new URLSearchParams(s);if(d.has("search")&&this.findBar){let p=d.get("search"),g={};n.settings.searchLinkHighlightAll!=="default"&&(g.highlightAll=n.settings.searchLinkHighlightAll==="true"),n.settings.searchLinkCaseSensitive!=="default"&&(g.caseSensitive=n.settings.searchLinkCaseSensitive==="true"),n.settings.searchLinkMatchDiacritics!=="default"&&(g.matchDiacritics=n.settings.searchLinkMatchDiacritics==="true"),n.settings.searchLinkEntireWord!=="default"&&(g.entireWord=n.settings.searchLinkEntireWord==="true");let m=b=>{let w=Cp(b);if(d.has(w)){let F=d.get(w);(F==="true"||F==="false")&&(g[b]=F==="true")}};m("highlightAll"),m("caseSensitive"),m("matchDiacritics"),m("entireWord"),setTimeout(()=>i.search(this.findBar,p,g));return}let{dest:h,highlight:u}=(p=>{var w,F,v;if(!d.has("page"))return{dest:p,highlight:null};let g=(w=a(d.get("page")))!=null?w:1,m=null;if(n.settings.zoomToFitRect&&d.has("rect")){let P=d.get("rect").split(",").map(c);P.length===4&&P.every(k=>k!==null)&&(m=[g-1,{name:"FitR"},...P])}if(!m)if(d.has("offset")){let P=d.get("offset").split(","),k=c(P[0]),T=c(P[1]),D=c(P[2]);m=D===null?[g-1,{name:"FitBH"},T]:[g-1,{name:"XYZ"},k,T,D]}else if(!this.opts.isEmbed&&n.settings.dontFitWidthWhenOpenPDFLink){let P=(F=this.pdfViewer)==null?void 0:F.pdfViewer,k=P==null?void 0:P._location;n.settings.preserveCurrentLeftOffsetWhenOpenPDFLink?m=[g-1,{name:"XYZ"},(v=k==null?void 0:k.left)!=null?v:null,null,null]:m=[g-1,{name:"XYZ"},null,null,null]}else m=[g-1,{name:"FitBH"},null];let b=null;if(d.has("annotation"))b={type:"annotation",page:g,id:d.get("annotation")};else if(d.has("selection")){let P=d.get("selection").split(",").map(a),[k,T,D,C]=P;k!==null&&T!==null&&D!==null&&C!==null&&(b={type:"text",page:g,range:[[k,T],[D,C]]})}else if(d.has("rect")){let P=d.get("rect").split(",").map(c);P.length===4&&P.every(k=>k!==null)&&(b={type:"rect",page:g,rect:P})}return{dest:JSON.stringify(m),highlight:b}})(s),f=l.pdfLoadingTask;f?f.promise.then(()=>l.applySubpath(h)):l.subpath=h,this.subpathHighlight=u}}},getMarkdownLink(o){return function(s,a,c){if(!this.file)return o.call(this,s,a,c);let l=i.generateMarkdownLink(this.file,"",s,a);return c?l:l.slice(1)}},getPageLinkAlias(o){return function(s){var a,c;if(this.file){let l=i.copyLink.getDisplayText(this,void 0,this.file,s,i.toSingleLine((c=(a=activeWindow.getSelection())==null?void 0:a.toString())!=null?c:""));if(l)return l}return o.call(this,s)}},highlightText(o){return function(s,a){var h,u,f,p,g;let c=this.getPage(s),l=a[0][0],d=(h=c.textLayer)==null?void 0:h.textDivs[l];if(n.settings.trimSelectionEmbed&&this.pdfViewer.isEmbed&&this.pdfViewer.dom&&!(n.settings.ignoreHeightParamInPopoverPreview&&((u=this.pdfViewer.dom.containerEl.parentElement)!=null&&u.matches(".hover-popover")))){let m=a[1][0],b=(f=c.textLayer)==null?void 0:f.textDivs[m];d&&b&&setTimeout(()=>{let w=this.pdfViewer.dom.viewerContainerEl.getBoundingClientRect(),F=d.getBoundingClientRect(),P=b.getBoundingClientRect().bottom-F.top+2*Math.abs(F.top-w.top);this.pdfViewer.setHeight(P)},100)}n.settings.noTextHighlightsInEmbed&&this.pdfViewer.isEmbed&&!((g=(p=this.pdfViewer.dom)==null?void 0:p.containerEl.parentElement)!=null&&g.matches(".hover-popover"))||o.call(this,s,a),window.pdfjsViewer.scrollIntoView(d,{top:-n.settings.embedMargin},!0),n.trigger("highlight",{type:"selection",source:"obsidian",pageNumber:s,child:this})}},highlightAnnotation(o){return function(s,a){var d,h,u;let c=()=>{var p;return this.annotationHighlight?this.annotationHighlight:(p=this.getPage(s).annotationLayer)==null?void 0:p.div.querySelector(`[data-annotation-id="${a}"]`)};n.settings.trimSelectionEmbed&&this.pdfViewer.isEmbed&&this.pdfViewer.dom&&!(n.settings.ignoreHeightParamInPopoverPreview&&((d=this.pdfViewer.dom.containerEl.parentElement)!=null&&d.matches(".hover-popover")))&&setTimeout(()=>{let f=c();if(f){let p=this.pdfViewer.dom.viewerContainerEl.getBoundingClientRect(),g=f.getBoundingClientRect(),m=g.bottom-g.top+2*Math.abs(g.top-p.top);this.pdfViewer.setHeight(m)}},100),n.settings.noAnnotationHighlightsInEmbed&&this.pdfViewer.isEmbed&&!((u=(h=this.pdfViewer.dom)==null?void 0:h.containerEl.parentElement)!=null&&u.matches(".hover-popover"))||o.call(this,s,a);let l=c();l&&activeWindow.setTimeout(()=>{window.pdfjsViewer.scrollIntoView(l,{top:-n.settings.embedMargin},!0)}),n.trigger("highlight",{type:"annotation",source:"obsidian",pageNumber:s,child:this})}},clearTextHighlight(o){return function(){var s,a;n.settings.persistentTextHighlightsInEmbed&&((a=(s=this.pdfViewer)==null?void 0:s.isEmbed)!=null?a:this.opts.isEmbed)||o.call(this)}},clearAnnotationHighlight(o){return function(){n.settings.persistentAnnotationHighlightsInEmbed&&this.pdfViewer.isEmbed||o.call(this)}},clearEphemeralUI(o){return function(){o.call(this),i.highlight.viewer.clearRectHighlight(this)}},renderAnnotationPopup(o){return function(s,...a){var u,f;if(s.data.subtype==="Link")return;let c=o.call(this,s,...a);n.lastAnnotationPopupChild=this;let{page:l,id:d}=i.getAnnotationInfoFromAnnotationElement(s);if(n.settings.renderMarkdownInStickyNote&&this.file){let p=(u=this.activeAnnotationPopupEl)==null?void 0:u.querySelector(".popupContent");p&&(p.textContent="",i.highlight.writeFile.getAnnotationContents(this.file,l,d).then(async g=>{var m,b;g&&(p.addClass("markdown-rendered"),this.component||(this.component=n.addChild(new he.Component)),await he.MarkdownRenderer.render(e,g,p,"",this.component),Pc(e,p,(b=(m=this.file)==null?void 0:m.path)!=null?b:""))}))}let h=p=>{p.createDiv("pdf-plus-annotation-icon-container",g=>{let m=p==null?void 0:p.querySelector(".clickable-icon:last-child");if(m&&(m.remove(),g.createDiv("clickable-icon pdf-plus-copy-annotation-link",b=>{(0,he.setIcon)(b,"lucide-copy"),(0,he.setTooltip)(b,"Copy link"),b.addEventListener("click",async()=>{let w=i.getColorPaletteAssociatedWithNode(p);if(!w)return;let F=n.settings.copyCommands[w.actionIndex].template;i.copyLink.copyLinkToAnnotation(this,!1,{copyFormat:F},l,d),(0,he.setIcon)(b,"lucide-check")})})),i.isEditable(this)&&n.settings.enableAnnotationContentEdit&&Mn.isSubtypeSupported(s.data.subtype)){let b=s.data.subtype;g.createDiv("clickable-icon pdf-plus-edit-annotation",w=>{(0,he.setIcon)(w,"lucide-pencil"),(0,he.setTooltip)(w,"Edit"),w.addEventListener("click",async()=>{this.file&&Mn.forSubtype(b,n,this.file,l,d).open()})})}i.isEditable(t)&&n.settings.enableAnnotationDeletion&&g.createDiv("clickable-icon pdf-plus-delete-annotation",b=>{(0,he.setIcon)(b,"lucide-trash"),(0,he.setTooltip)(b,"Delete"),b.addEventListener("click",async()=>{this.file&&new oa(n,this.file,l,d).openIfNeccessary()})})}),p.addEventListener("contextmenu",g=>{new he.Menu().addItem(m=>{m.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{n.openSettingTab().scrollToHeading("annot")})}).showAtMouseEvent(g),g.preventDefault()})};if(he.Platform.isPhone){let p=new MutationObserver((g,m)=>{for(let b of g)for(let w of b.addedNodes)if(w.instanceOf(HTMLElement)&&w.matches("div.modal-container.pdf-annotation-modal")){let F=w.querySelector(".popupMeta");if(F){h(F),m.disconnect();return}}});activeWindow.setTimeout(()=>p.observe(activeDocument.body,{childList:!0})),activeWindow.setTimeout(()=>p.disconnect(),1e3)}else{let p=(f=this.activeAnnotationPopupEl)==null?void 0:f.querySelector(".popupMeta");p&&h(p)}if(n.settings.annotationPopupDrag&&this.activeAnnotationPopupEl&&this.file){let p=this.activeAnnotationPopupEl,g=this.file;Rx(n,p,this,g,l,d),p.addClass("pdf-plus-draggable")}return c}},destroyAnnotationPopup(o){return function(){return n.lastAnnotationPopupChild=null,o.call(this)}},onContextMenu(o){return async function(s){if(!he.Platform.isPhone&&!(he.Platform.isTablet&&!n.settings.showContextMenuOnTablet)){if(!n.settings.replaceContextMenu)return await o.call(this,s);Ex(n,this,s)}}},onMobileCopy(o){return function(s,a){switch(n.settings.mobileCopyAction){case"text":r(s);return;case"pdf-plus":setTimeout(()=>i.commands.copyLink(!1));return;case"obsidian":return o.call(this,s,a)}}},onThumbnailContextMenu(o){return function(s){if(!n.settings.thumbnailContextMenu)return o.call(this,s);Ax(n,this,s)}},getTextByRect(o){return function(s,a){var h,u;let c="",l=(h=s.textLayer)==null?void 0:h.textContentItems,d=(u=s.textLayer)==null?void 0:u.textDivs;if(l){let[f,p,g,m]=a;for(let b=0;b{var c;if(!n.settings.copyAsSingleLine)return;let s=o.clipboardData;if(!s)return;let a=(c=o.target.win.getSelection())==null?void 0:c.toString();a&&(a=i.toSingleLine(a),s.setData("text/plain",a))}},qP=(n,t)=>{n.register(Ze(t.constructor.prototype,{open(e){return async function(i){if(this.pdfPlusRedirect){let{from:r,to:o}=this.pdfPlusRedirect,s=i.url;typeof s=="string"&&s.startsWith(r)&&(i.url=o)}return delete this.pdfPlusRedirect,await e.call(this,i)}},load(e){return function(i,...r){let o=this.pdfPlusCallbacksOnDocumentLoaded;if(o)for(let s of o)s(i);return delete this.pdfPlusCallbacksOnDocumentLoaded,e.call(this,i,...r)}}}))},WP=n=>{n.register(Ze(window.pdfjsViewer.ObsidianServices.prototype,{createPreferences(t){return function(...e){return Object.assign(this.preferences,{defaultZoomValue:n.settings.defaultZoomValue,scrollModeOnLoad:n.settings.scrollModeOnLoad,spreadModeOnLoad:n.settings.spreadModeOnLoad}),t.call(this,...e)}}}))};var Xx=n=>{if(n.patchStatus.pdfView&&n.patchStatus.pdfInternals)return!0;let t=n.lib,e=t.getPDFView();return e&&(n.patchStatus.pdfView||(n.register(Ze(e.constructor.prototype,{getState(i){return function(){var c,l,d,h,u;let r=i.call(this),s=this.viewer.child,a=(c=s==null?void 0:s.pdfViewer)==null?void 0:c.pdfViewer;return a&&(r.page=(d=(l=a._location)==null?void 0:l.pageNumber)!=null?d:a.currentPageNumber,r.left=(h=a._location)==null?void 0:h.left,r.top=(u=a._location)==null?void 0:u.top,r.zoom=a.currentScale),r}},setState(i){return function(r,o){return n.settings.alwaysRecordHistory&&(o.history=!0),i.call(this,r,o).then(()=>{var l;let a=this.viewer.child,c=(l=a==null?void 0:a.pdfViewer)==null?void 0:l.pdfViewer;typeof r.page=="number"&&c&&t.applyPDFViewStateToViewer(c,r)})}},onLoadFile(i){return async function(r){let o=this,s=o.getState(),a=t.viewStateToSubpath(s);return o.viewer.loadFile(r,a!=null?a:void 0)}}})),n.patchStatus.pdfView=!0,n.classes.PDFView=e.constructor),n.patchStatus.pdfInternals||pa(n,e.viewer)),!1};var Zx=n=>{if(n.patchStatus.pdfInternals)return!0;let{lib:t}=n,e=t.getPDFEmbed();return e&&pa(n,e.viewer),!1};var Gx=(n,t)=>(n.register(Ze(t.constructor.prototype,{onItemContextMenu(e){return async function(i,r){let o=this,s=o.viewer,a=s.file;if(!n.settings.outlineContextMenu||!a)return await e.call(o,i,r);Ix(n,s,a,i,r)}}})),!0);var ga=require("obsidian");var Yx=n=>{let t=n.app,e=n.lib;n.register(Ze(ga.Workspace.prototype,{openLinkText(i){return function(r,o,s,a){var c;if((n.settings.openPDFWithDefaultApp||n.settings.singleTabForSinglePDF||n.settings.openLinkNextToExistingPDFTab||n.settings.paneTypeForFirstPDFLeaf)&&!s){let{path:l}=(0,ga.parseLinktext)(r),d=t.metadataCache.getFirstLinkpathDest(l,o);if(d&&d.extension==="pdf"){if(ga.Platform.isDesktopApp&&n.settings.openPDFWithDefaultApp){if(n.settings.openPDFWithDefaultAppAndObsidian&&n.settings.syncWithDefaultApp)return;let h=t.openWithDefaultApp(d.path);if(n.settings.focusObsidianAfterOpenPDFWithDefaultApp&&Ic(),!n.settings.openPDFWithDefaultAppAndObsidian)return h}if(n.settings.singleTabForSinglePDF){let{exists:h,promise:u}=e.workspace.openPDFLinkTextInExistingLeafForTargetPDF(r,o,a,d);if(h)return u}if(n.settings.openLinkNextToExistingPDFTab||n.settings.paneTypeForFirstPDFLeaf){let h=(c=e.getPDFView())==null?void 0:c.leaf;if(h){if(n.settings.openLinkNextToExistingPDFTab&&h.parentSplit){let u=t.workspace.createLeafInParent(h.parentSplit,-1);return e.workspace.openPDFLinkTextInLeaf(u,r,o,a)}}else if(n.settings.paneTypeForFirstPDFLeaf){let u=e.workspace.getLeaf(n.settings.paneTypeForFirstPDFLeaf);return e.workspace.openPDFLinkTextInLeaf(u,r,o,a)}}}}return i.call(this,r,o,s,a)}}})),n.patchStatus.workspace=!0};var Jx=require("obsidian");var Qx=n=>{let t=n.app,e=n.lib,i=t.internalPlugins.plugins["page-preview"].instance;return n.register(Ze(i,{onLinkHover(r){return function(o,s,a,c,l){let{path:d,subpath:h}=(0,Jx.parseLinktext)(a),u=t.metadataCache.getFirstLinkpathDest(d,c);if((!c||c.endsWith(".pdf"))&&n.settings.hoverHighlightAction==="open"&&(l!=null&&l.isTriggeredFromBacklinkVisualizer)){e.workspace.openMarkdownLinkFromPDF(a,c,!1,{line:l.scroll});return}if((u==null?void 0:u.extension)==="pdf"&&c.endsWith(".md")){if(n.settings.hoverPDFLinkToOpen){let{exists:f}=e.workspace.openPDFLinkTextInExistingLeafForTargetPDF(a,c,void 0,u);if(f)return}if(n.settings.ignoreHeightParamInPopoverPreview&&h.contains("height=")){let f=new URLSearchParams(h.slice(1));a=d+"#"+Array.from(f.entries()).filter(([p])=>p!=="height").map(([p,g])=>`${p}=${g}`).join("&")}}r.call(this,o,s,a,c,l)}}})),n.patchStatus.pagePreview=!0,!0};var _x=require("obsidian");var Mh=class extends de{constructor(e,i,r){super(e);this.navButtonEl=null;this.renderer=i,this.file=r,this.pageTracker=new yg(e,i,r),this.isTrackingPage=e.settings.filterBacklinksByPageDefault}onload(){this.navButtonEl=this.renderer.headerDom.addNavButton("lucide-filter","Show only backlinks in the current page",()=>{this.isTrackingPage=!this.isTrackingPage,this.updatePageTracker()}),this.updatePageTracker(),this.registerDomEvent(this.renderer.backlinkDom.el,"mouseover",e=>{this.processBacklinkVisualizerDomForEvent(e,(i,r,o,s)=>{if(!this.settings.highlightOnHoverBacklinkPane||!ui(e,i))return;for(let l of r)l.addClass("hovered-highlight");let a=null;if(o.page&&o.annotation){let l=o.page,d=o.annotation.id;s.then(h=>{var p;let u=h.getPage(l),f=(p=u.annotationLayer)==null?void 0:p.annotationLayer.getAnnotation(d);f&&(a=this.lib.highlight.viewer.placeRectInPage(f.data.rect,u),a.addClass("pdf-plus-annotation-bounding-rect"))})}if(o.page&&o.FitR){let l=o.page,{left:d,bottom:h,right:u,top:f}=o.FitR;s.then(p=>{let g=p.getPage(l);a=this.lib.highlight.viewer.placeRectInPage([d,h,u,f],g),a.addClass("rect-highlight")})}let c=l=>{if(ui(l,i)){for(let d of r)d.removeClass("hovered-highlight");a&&a.remove(),i.removeEventListener("mouseout",c)}};i.addEventListener("mouseout",c)})})}onunload(){var e;(e=this.navButtonEl)==null||e.remove(),this.pageTracker.unload()}setParents(...e){return e.forEach(i=>i.addChild(this)),this.register(()=>e.forEach(i=>i.removeChild(this))),this}updatePageTracker(){this.navButtonEl.toggleClass("is-active",this.isTrackingPage),this.isTrackingPage?this.pageTracker.load():this.pageTracker.unload()}findBacklinkItemEl(e){var l,d;let{refCache:i,sourcePath:r}=e,o=this.renderer.backlinkDom,s=this.app.vault.getAbstractFileByPath(r);if(!(s instanceof _x.TFile))return null;let a=o.getResult(s);if(!a)return null;if(!!a.childrenEl.querySelector(".better-search-views-tree")){let h=this.app.metadataCache.getFileCache(s);if(!(h!=null&&h.sections)||!("position"in i))return null;let u=new Set;for(let[p,g]of a.result.content){let m=h.sections.find(b=>b.position.start.offset<=p&&g<=b.position.end.offset);if(m&&(u.add(m),p===i.position.start.offset&&i.position.end.offset===g))break}let f=u.size-1;return f===-1?null:(d=a==null?void 0:a.childrenEl.querySelectorAll(".search-result-file-match")[f])!=null?d:null}else{let h=a==null?void 0:a.vChildren.children;if(!h)return null;let u=h.find(f=>{if("position"in i)return f.start<=i.position.start.offset&&i.position.end.offset<=f.end;for(let p of f.matches)return"key"in p&&p.key===i.key;return!1});return(l=u==null?void 0:u.el)!=null?l:null}}processBacklinkVisualizerDomForEvent(e,i){let r=e.target;if(!wt(e,r))return;let o=this.renderer.backlinkDom.vChildren.children.find(s=>s.el.contains(r));if(o){let s=o.file.path;this.lib.workspace.iteratePDFViewerComponents(a=>{if(a.visualizer){let c=a.visualizer.index.sourcePaths.get(s);for(let l of c){if(l.page===null)continue;let d=this.findBacklinkItemEl(l);if(d!=null&&d.contains(r)){let u=a.visualizer.domManager.getCacheToDomsMap(l.page).get(l);i(d,u,l,a)}}}})}}},yg=class extends de{constructor(e,i,r){super(e);this.renderer=i;this.file=r;this.matchCountObserver=new Dc(this.renderer.backlinkDom.el,()=>{if(this.updateBacklinkCountEl(o=>`${o} in this page`),this.renderer.collapseAll)for(let o of this.renderer.backlinkDom.el.querySelectorAll(".tree-item.search-result")){let s=o.querySelector(":scope>.tree-item-self.search-result-file-title>.collapse-icon");s?s.style.visibility==="hidden"&&o.remove():o.remove()}else for(let o of this.renderer.backlinkDom.el.querySelectorAll(".tree-item.search-result:not(:has( .search-result-file-match))"))o.hasClass("is-collapsed")||o.remove()},{childList:!0,subtree:!0})}async onload(){this.renderer.backlinkDom.filter=void 0;let e=this.lib.workspace.getExistingLeafForPDFFile(this.file);if(e){await this.lib.workspace.ensureViewLoaded(e);let i=e.view;this.lib.isPDFView(i)&&i.viewer.then(r=>{this.renderer.backlinkDom.filter=(o,s)=>r.pdfViewer.pdfViewer?this.filter(r.pdfViewer.pdfViewer.currentPageNumber,s):!0,this.updateBacklinkDom(),this.lib.registerPDFEvent("pagechanging",r.pdfViewer.eventBus,this,o=>{var a;let s=typeof o.pageNumber=="number"?o.pageNumber:(a=r.pdfViewer.pdfViewer)==null?void 0:a.currentPageNumber;s&&(this.renderer.backlinkDom.filter=(c,l)=>this.filter(s,l)),this.updateBacklinkDom()})})}this.addChild(this.matchCountObserver)}onunload(){this.renderer.backlinkDom.filter=void 0,this.updateBacklinkDom()}updateBacklinkDom(){this.renderer.recomputeBacklink(this.file)}updateBacklinkCountEl(e){var r;let i=Array.from(this.renderer.backlinkDom.el.querySelectorAll("div.search-result-file-title span.tree-item-flair")).map(o=>+o.getText()).reduce((o,s)=>o+s,0);(r=this.renderer.backlinkCountEl)==null||r.setText(e?e(i):`${i}`)}filter(e,i){let r=Hp(i.link),o=new URLSearchParams(r);return o.has("page")?!this.settings.showBacklinkToPage&&!o.has("selection")&&!o.has("annotation")&&!o.has("offset")&&!o.has("rect")?!1:+o.get("page")===e:!1}};var $x=n=>{var o;let{app:t,lib:e}=n,i=(o=t.workspace.getLeavesOfType("backlink").find(s=>e.isBacklinkView(s.view)))==null?void 0:o.view,r=i==null?void 0:i.backlink;return!i||!r?!1:(n.register(Ze(Object.getPrototypeOf(i.constructor.prototype),{onLoadFile(s){return async function(a){await s.call(this,a),this.getViewType()==="backlink"&&a.extension==="pdf"&&(this.pdfManager=new Mh(n,this.backlink,a).setParents(n,this))}},onUnloadFile(s){return async function(a){let c=this;a.extension==="pdf"&&c.pdfManager&&c.pdfManager.unload(),await s.call(this,a)}}})),n.register(Ze(r.backlinkDom.constructor.prototype,{addResult(s){return function(a,c,l,d){var u;let h=this;if(h.filter){let f=t.metadataCache.getFileCache(a);if(f){let p=[];for(let[m,b]of c.content){let w=Vp(f,m,b);w&&h.filter(a,w)&&p.push([m,b])}c.content.length=0,c.content.push(...p);let g=[];for(let m of c.properties){let b=(u=f.frontmatterLinks)==null?void 0:u.find(w=>w.key===m.key);b&&h.filter(a,b)&&g.push(m)}c.properties.length=0,c.properties.push(...g)}}return s.call(this,a,c,l,d)}}})),e.workspace.iterateBacklinkViews(s=>{var a;((a=s.file)==null?void 0:a.extension)==="pdf"&&s.onLoadFile(s.file)}),n.patchStatus.backlink=!0,!0)};var ma=require("obsidian");var ey=n=>{let t=n.app,e;return t.workspace.iterateAllLeaves(i=>{i.view instanceof ma.MarkdownView&&(e=i.view.editMode.clipboardManager)}),e?(n.register(Ze(e.constructor.prototype,{handleDragOver(i){return function(r){let o=t.dragManager.draggable;if(!o||o.source!=="pdf-plus")return i.call(this,r);(ma.Platform.isMacOS?r.shiftKey:r.altKey)||(KP(r,"link"),t.dragManager.setAction("Insert link here"))}},handleDrop(i){return function(r){let o=t.dragManager.draggable;if(!o||o.source!=="pdf-plus")return i.call(this,r);if(this.info instanceof ma.MarkdownView&&(ma.Platform.isMacOS?r.shiftKey:r.altKey))return r.preventDefault(),this.info.handleDrop(r,o,!1),!0;let s=this.info.editor;if(!s)return!1;let a=o.getText(this.getPath()),c=s.cm.posAtCoords({x:r.clientX,y:r.clientY},!1),l=s.offsetToPos(c);return s.setCursor(l),typeof a=="string"?(s.replaceSelection(a),s.focus(),r.preventDefault(),!0):!1}}})),!0):!1},jP={none:[],copy:["copy"],copyLink:["copy","link"],copyMove:["copy","move"],link:["link"],linkMove:["link","move"],move:["move"],all:["copy","link","move"],uninitialized:[]};function KP(n,t){if(!n.dataTransfer||n.dataTransfer.effectAllowed==="none"||n.dataTransfer.effectAllowed==="uninitialized")return;if(t==="none")return n.dataTransfer.dropEffect=t;jP[n.dataTransfer.effectAllowed].contains(t)&&(n.dataTransfer.dropEffect=t)}var ty=require("obsidian");var iy=n=>{n.register(Ze(ty.Menu.prototype,{showAtPosition(t){return function(...e){var i;return n.settings.hoverableDropdownMenuInToolbar&&((i=this.parentEl)!=null&&i.closest("div.pdf-toolbar"))&&this.setUseNativeMenu(!1),n.shownMenus.add(this),t.call(this,...e)}},hide(t){return function(...e){return n.shownMenus.delete(this),t.call(this,...e)}}}))};var ge=require("obsidian");var Ei=require("obsidian");var ye=class{constructor(t){this.app=t.app,this.plugin=t}get lib(){return this.plugin.lib}get settings(){return this.plugin.settings}};var qo=require("obsidian"),GP=qn(require("obsidian")),Vc=class{constructor(t,e){this.plugin=t;this.variables=e}setVariable(t,e){this.variables[t]=e}evalPart(t){let e=new Function(...Object.keys(this.variables),`return ${t};`)(...Object.values(this.variables));if(e===void 0)throw Error(`The expression "${t}" cannot be evaluated.`);return e}evalTemplate(t){return t.replace(/{{(.*?)}}/g,(e,i)=>this.evalPart(i))}},Bc=class extends Vc{constructor(e,i){var h,u,f,p,g,m;let{app:r}=e;"colorName"in i&&(i.color=i.colorName);super(e,{...i,app:r,obsidian:GP,pdf:i.file,folder:i.file.parent,selection:i.text});this.app=r,this.lib=e.lib;let o=this.findMarkdownFileAssociatedToPDF(i.file),s=(u=o&&((h=r.metadataCache.getFileCache(o))==null?void 0:h.frontmatter))!=null?u:{};this.setVariable("md",o),this.setVariable("properties",s);let a=this.findLinkedFile(i.file),c=(p=a&&((f=r.metadataCache.getFileCache(a))==null?void 0:f.frontmatter))!=null?p:{};this.setVariable("linkedFile",a),this.setVariable("linkedFileProperties",c);let l=(g=r.plugins.plugins.dataview)==null?void 0:g.api,d=(m=r.plugins.plugins.quickadd)==null?void 0:m.api;l&&this.setVariable("dv",l),d&&this.setVariable("quickAddApi",d)}findMarkdownFileAssociatedToPDF(e){var s,a,c;let i=this.plugin.app,r=[],o=(s=i.plugins.plugins.dataview)==null?void 0:s.api;if(o)r=o.pages().where(d=>{var h;return o.array((h=d[this.plugin.settings.proxyMDProperty])!=null?h:[]).path.includes(e.path)}).map(d=>i.vault.getAbstractFileByPath(d.file.path)).filter(d=>d instanceof qo.TFile);else{let l=i.metadataCache.getBacklinksForFile(e);for(let d of l.keys()){let h=i.metadataCache.getCache(d);if(h&&((a=h.frontmatterLinks)==null?void 0:a.some(f=>{if(f.key!==this.plugin.settings.proxyMDProperty&&!new RegExp(`${this.plugin.settings.proxyMDProperty}.\\d+`).test(f.key))return!1;let p=(0,qo.getLinkpath)(f.link),g=i.metadataCache.getFirstLinkpathDest(p,d);return g&&g.path===e.path}))){let f=i.vault.getAbstractFileByPath(d);f instanceof qo.TFile&&r.push(f)}}}if(r.length>1){let l=`Multiple markdown files are associated with this PDF file: +${r.map(d=>"- "+d.path).join(` +`)} +Aborting.`;throw Error(l)}return(c=r.first())!=null?c:null}findLinkedFile(e){let i=null,r=this.lib.workspace.getActiveGroupLeaves();if(r){for(let o of r)if(o.view instanceof qo.FileView&&o.view.file&&o.view.file!==e){i=o.view.file;break}}return i}};var Nh=class extends ye{constructor(){super(...arguments);this.statusDurationMs=2e3}getPageAndTextRangeFromSelection(e){if(e=e!=null?e:activeWindow.getSelection(),!e)return null;let i=this.lib.getPageElFromSelection(e);if(!i||i.dataset.pageNumber===void 0)return null;let r=+i.dataset.pageNumber,o=e.rangeCount>0?e.getRangeAt(0):null;if(o){let s=this.getTextSelectionRange(i,o);if(s)return{page:r,selection:s}}return{page:r}}getTextSelectionRange(e,i){if(i&&!i.collapsed){let r=oh(e,i.startContainer),o=oh(e,i.endContainer);if(r&&o){let s=r.dataset.idx,a=o.dataset.idx,c=sh(r,i.startContainer,i.startOffset),l=sh(o,i.endContainer,i.endOffset);if(s!==void 0&&a!==void 0&&c!==null&&l!==null)return{beginIndex:+s,beginOffset:c,endIndex:+a,endOffset:l}}}return null}getTemplateVariables(e){var l,d,h;let i=activeWindow.getSelection();if(!i)return null;let r=this.lib.getPageElFromSelection(i);if(!r||r.dataset.pageNumber===void 0)return null;let o=this.lib.getPDFViewerChildAssociatedWithNode(r),s=o==null?void 0:o.file;if(!s)return null;let a=+r.dataset.pageNumber;i.toString()||(a=(d=(l=o.pdfViewer.pdfViewer)==null?void 0:l.currentPageNumber)!=null?d:a);let c=Cc({page:a,selection:o.getTextSelectionRangeStr(r),...e});return{child:o,file:s,subpath:c,page:a,pageCount:o.pdfViewer.pagesCount,pageLabel:(h=o.getPage(a).pageLabel)!=null?h:""+a,text:this.lib.toSingleLine(i.toString())}}getLinkTemplateVariables(e,i,r,o,s,a,c,l){l=l!=null?l:"";let d=this.app.fileManager.generateMarkdownLink(r,l,o).slice(1),h=this.app.metadataCache.fileToLinktext(r,l)+o;this.app.vault.getConfig("useMarkdownLinks")&&(h=yr(h));let u=this.getDisplayText(e,i,r,s,a,c),f=this.lib.generateMarkdownLink(r,l,o,u||void 0).slice(1),p=this.app.fileManager.generateMarkdownLink(r,l,`#page=${s}`).slice(1),g=this.lib.generateMarkdownLink(r,l,`#page=${s}`,u||void 0).slice(1);return{link:d,linktext:h,display:u,linkWithDisplay:f,linkToPage:p,linkToPageWithDisplay:g}}getDisplayText(e,i,r,o,s,a){var c;if(!i){let l=this.lib.getColorPaletteFromChild(e);l?i=this.settings.displayTextFormats[l.displayTextFormatIndex].template:i=this.settings.displayTextFormats[this.settings.defaultDisplayTextFormatIndex].template}try{return new Bc(this.plugin,{file:r,page:o,pageCount:e.pdfViewer.pagesCount,pageLabel:(c=e.getPage(o).pageLabel)!=null?c:""+o,text:s,comment:a!=null?a:""}).evalTemplate(i).trim()}catch(l){console.error(l),new Ei.Notice(`${this.plugin.manifest.name}: Display text format is invalid. Error: ${l.message}`,3e3)}}getTextToCopy(e,i,r,o,s,a,c,l,d,h){var g,m,b,w,F,v;let u=e.getPage(s);if(typeof h!="string"){let P=ia(a).get("annotation");h=typeof P=="string"&&((F=(w=(b=(m=(g=u==null?void 0:u.annotationLayer)==null?void 0:g.annotationLayer)==null?void 0:m.getAnnotation(P))==null?void 0:b.data)==null?void 0:w.contentsObj)==null?void 0:F.str),h=this.lib.toSingleLine(h||"")}return new Bc(this.plugin,{file:o,page:s,pageLabel:(v=u.pageLabel)!=null?v:""+s,pageCount:e.pdfViewer.pagesCount,text:c,comment:h,colorName:l,calloutType:this.settings.calloutType,...this.lib.copyLink.getLinkTemplateVariables(e,r,o,a,s,c,h,d)}).evalTemplate(i)}async getTextToCopyForOutlineItem(e,i,r,o){return(await this.getTextToCopyForOutlineItemDynamic(e,i,r))(o)}async getTextToCopyForOutlineItemDynamic(e,i,r){let o=await r.getExplicitDestination(),s=await r.getPageNumber(),a=this.lib.normalizePDFJsDestArray(o,s),c=this.lib.destArrayToSubpath(a);return l=>this.getTextToCopy(e,this.settings.outlineLinkCopyFormat,this.settings.outlineLinkDisplayTextFormat,i,s,c,r.item.title,"",l)}getSelectionLinkInfo(){var s;let e=this.lib.getColorPaletteAssociatedWithSelection();if(!e)return null;let i=this.settings.copyCommands[e.actionIndex].template,r=(s=e.selectedColorName)!=null?s:void 0,o=e.writeFile;return{template:i,colorName:r,writeFile:o}}getAnnotationLinkInfo(){let e=this.plugin.lastAnnotationPopupChild;if(!e)return null;let i=e.activeAnnotationPopupEl;if(!i)return null;let r=i.querySelector(".popupMeta div.clickable-icon:has(svg.lucide-copy)");if(!r)return null;let o=this.lib.getColorPaletteAssociatedWithNode(r),s;o?s=this.settings.copyCommands[o.actionIndex].template:s=this.settings.copyCommands[this.settings.defaultColorPaletteActionIndex].template;let a=this.lib.getAnnotationInfoFromPopupEl(i);if(!a)return null;let{page:c,id:l}=a;return{child:e,copyButtonEl:r,template:s,page:c,id:l}}copyLinkToSelection(e,i,r,o){let s=this.getTemplateVariables(r?{color:r.toLowerCase()}:{});if(s){let{child:a,file:c,subpath:l,page:d,text:h}=s;if(!h)if(this.settings.useAnotherCopyTemplateWhenNoSelection)i.copyFormat=this.settings.copyTemplateWhenNoSelection;else return!1;return e||(async()=>{var g,m;let u=this.getTextToCopy(a,i.copyFormat,i.displayTextFormat,c,d,l,h,(g=r==null?void 0:r.toLowerCase())!=null?g:"");await navigator.clipboard.writeText(u),this.onCopyFinish(u);let f=this.lib.getColorPaletteFromChild(a);f==null||f.setStatus("Link copied",this.statusDurationMs),this.autoFocusOrAutoPaste(u,o,f!=null?f:void 0);let p=Ln(l);if(p&&"beginIndex"in p){let b=(m=a.getPage(d).textLayer)==null?void 0:m.textContentItems[p.beginIndex];if(b){let w=b.transform[4],F=b.transform[5]+b.height;typeof w=="number"&&typeof F=="number"&&(this.plugin.lastCopiedDestInfo={file:c,destArray:[d-1,"XYZ",w,F,null]})}}})(),!0}return!1}copyLinkToAnnotation(e,i,r,o,s,a,c){let l=e.file;if(!l)return!1;if(!i){let d=e.getPage(o);e.getAnnotatedText(d,s).then(async h=>{var v,P,k,T;let u=(T=(k=(P=(v=d.annotationLayer)==null?void 0:v.annotationLayer)==null?void 0:P.getAnnotation(s))==null?void 0:k.data)!=null?T:(await d.pdfPage.getAnnotations()).find(D=>D.id===s),f=u!=null&&u.color?`${u.color[0]}, ${u.color[1]}, ${u.color[2]}`:"",p=`#page=${o}&annotation=${s}`;if(u.subtype==="Square"){let D=u.rect;p+=`&rect=${D[0]},${D[1]},${D[2]},${D[3]}`}let g=this.getTextToCopy(e,r.copyFormat,r.displayTextFormat,l,o,p,h!=null?h:"",f);await navigator.clipboard.writeText(g),this.onCopyFinish(g);let m=this.lib.getColorPaletteFromChild(e);c&&(m==null||m.setStatus("Link copied",this.statusDurationMs)),this.autoFocusOrAutoPaste(g,a,m!=null?m:void 0);let b=u==null?void 0:u.rect,w=b==null?void 0:b[0],F=b==null?void 0:b[3];typeof w=="number"&&typeof F=="number"&&(this.plugin.lastCopiedDestInfo={file:l,destArray:[o-1,"XYZ",w,F,null]})})}return!0}copyLinkToAnnotationWithGivenTextAndFile(e,i,r,o,s,a,c,l,d){return o||(async()=>{let h=this.getTextToCopy(r,s.copyFormat,s.displayTextFormat,i,a,`#page=${a}&annotation=${c}`,e,l);await navigator.clipboard.writeText(h),this.onCopyFinish(h);let u=this.lib.getColorPaletteFromChild(r);u==null||u.setStatus("Link copied",this.statusDurationMs),this.autoFocusOrAutoPaste(h,d,u!=null?u:void 0)})(),!0}writeHighlightAnnotationToSelectionIntoFileAndCopyLink(e,i,r,o){let s=activeWindow.getSelection();if(!s)return!1;let a=this.lib.toSingleLine(s.toString());if(!a)return!1;if(!e){let c=this.lib.getColorPaletteAssociatedWithSelection();c==null||c.setStatus("Writing highlight annotation into file...",1e4),this.lib.highlight.writeFile.addTextMarkupAnnotationToSelection(this.settings.selectionBacklinkVisualizeStyle==="highlight"?"Highlight":"Underline",r).then(l=>{if(!l)return;let{child:d,file:h,page:u,annotationID:f,rects:p}=l;!f||!h||setTimeout(()=>{let g=this.lib.getColorPaletteFromChild(d);g==null||g.setStatus("Link copied",this.statusDurationMs);let{r:m,g:b,b:w}=this.plugin.domManager.getRgb(r);if(this.copyLinkToAnnotationWithGivenTextAndFile(a,h,d,!1,i,u,f,`${m}, ${b}, ${w}`,o),p){let F=Math.min(...p.map(P=>P[0])),v=Math.max(...p.map(P=>P[3]));typeof F=="number"&&typeof v=="number"&&(this.plugin.lastCopiedDestInfo={file:h,destArray:[u-1,"XYZ",F,v,null]})}},300)})}return!0}copyEmbedLinkToRect(e,i,r,o,s,a,c){if(a||(a=this.settings.autoPaste),!i.file)return!1;let l=i.file,d=this.lib.getColorPaletteFromChild(i);if(o.some(h=>isNaN(h)))return d==null||d.setStatus("Invalid selection",this.statusDurationMs),!1;if(!e){let h=this.getDisplayText(i,void 0,l,r,""),u=`#page=${r}&rect=${o.map(p=>Math.round(p)).join(",")}`;s&&(u+=`&color=${s}`);let f=this.lib.generateMarkdownLink(l,c!=null?c:"",u,h);(async()=>{let p=f,g=i.getPage(r).pdfPage,m=this.settings.rectImageExtension;if(!this.settings.rectEmbedStaticImage)await navigator.clipboard.writeText(p),this.onCopyFinish(p);else if(this.settings.rectImageFormat==="file"){let b=await this.app.fileManager.getAvailablePathForAttachment(l.basename+"."+m,"");p=(!this.app.vault.getConfig("useMarkdownLinks")?`![[${b}]]`:`![](${yr(b)})`)+` + +`+f.slice(1),await navigator.clipboard.writeText(p);let v=async()=>{let P=await this.lib.pdfPageToImageArrayBuffer(g,{type:`image/${m}`,cropRect:o});return await this.app.vault.createBinary(b,P)};a?(await v(),this.onCopyFinish(p)):this.onCopyFinish(p,v)}else p=`![](${await this.lib.pdfPageToImageDataUrl(g,{type:`image/${m}`,cropRect:o})})`+` + +`+f.slice(1),await navigator.clipboard.writeText(p),this.onCopyFinish(p);this.plugin.lastCopiedDestInfo={file:l,destArray:[r-1,"FitR",...o]},d==null||d.setStatus("Link copied",this.statusDurationMs),await this.autoFocusOrAutoPaste(p,a,d!=null?d:void 0)})()}return!0}copyLinkToSearch(e,i,r,o,s,a){if(!i.file)return!1;let c=i.file,l=this.lib.getColorPaletteFromChild(i);if(!e){let d=this.lib.copyLink.getDisplayText(i,void 0,c,r,o),h=this.lib.generateMarkdownLink(c,"",`#search=${o}`,d).slice(1);(async()=>(await navigator.clipboard.writeText(h),this.onCopyFinish(h),l==null||l.setStatus("Link copied",this.statusDurationMs),await this.autoFocusOrAutoPaste(h,s,l!=null?l:void 0)))()}return!0}makeCanvasTextNodeFromSelection(e,i,r,o){var a;let s=this.getTemplateVariables(o?{color:o.toLowerCase()}:{});if(s){let{child:c,file:l,subpath:d,page:h,text:u}=s;if(!u)return!1;if(!e){let f=this.getTextToCopy(c,r,void 0,l,h,d,u,(a=o==null?void 0:o.toLowerCase())!=null?a:"");i.createTextNode({pos:i.posCenter(),position:"center",text:f})}return!0}return!1}makeCanvasTextNodeFromAnnotation(e,i,r,o,s,a){let c=r.file;if(!c)return!1;if(!e){let l=r.getPage(s);r.getAnnotatedText(l,a).then(d=>{let h=this.getTextToCopy(r,o,void 0,c,s,`#page=${s}&annotation=${a}`,d!=null?d:"","");i.createTextNode({pos:i.posCenter(),position:"center",text:h})})}return!0}async autoPaste(e){let i=this.getAutoFocusOrAutoPasteTarget(this.settings.autoPasteTarget);if(i)return await this.pasteTextToFile(e,i),!0;if(!this.settings.executeCommandWhenTargetNotIdentified)return!1;let r=this.app.commands.findCommand(this.settings.commandToExecuteWhenTargetNotIdentified);if(!r)return new Ei.Notice(`${this.plugin.manifest.name}: Command "${this.settings.commandToExecuteWhenTargetNotIdentified}" was not found. Please update the "Command to execute when pasting a link for the first time with auto-focus or auto-paste" setting.`),!1;let o=!1;return new Promise(s=>{let a=this.app.workspace.on("file-open",async l=>{l&&l.extension==="md"&&(this.app.workspace.offref(a),await this.pasteTextToFile(e,l,!0),this.plugin.lastPasteFile=l,s(!0))}),c=this.lib.workspace.hoverEditor;this.plugin.registerOneTimeEvent(this.app.workspace,"active-leaf-change",l=>{l&&c.isHoverEditorLeaf(l)&&c.postProcessHoverEditorLeaf(l)}),this.app.commands.executeCommandById(r.id),activeWindow.setTimeout(()=>{if(!o){let{noticeEl:l}=new Ei.Notice(`${this.plugin.manifest.name}: Could not find the auto-paste target markdown file within ${this.settings.autoPasteTargetDialogTimeoutSec} seconds.`);l.appendText(" Click "),l.createEl("a",{text:"here"},d=>{d.addEventListener("click",()=>{this.plugin.openSettingTab().scrollTo("autoPasteTargetDialogTimeoutSec")})}),l.appendText(" to change the timeout duration."),this.app.workspace.offref(a),s(!1)}},this.settings.autoPasteTargetDialogTimeoutSec*1e3)}).then(s=>(o=!0,s))}async autoFocus(){let e=this.getAutoFocusOrAutoPasteTarget(this.settings.autoFocusTarget);if(e){let{leaf:o,isExistingLeaf:s}=await this.prepareMarkdownLeafForPaste(e);return o&&o.view instanceof Ei.MarkdownView&&await this.updateAndRevealCursorInEditor(o.view,{focus:!0,goEnd:!s}),!0}if(!this.settings.executeCommandWhenTargetNotIdentified)return!1;let i=this.app.commands.findCommand(this.settings.commandToExecuteWhenTargetNotIdentified);if(!i)return new Ei.Notice(`${this.plugin.manifest.name}: Command "${this.settings.commandToExecuteWhenTargetNotIdentified}" was not found. Please update the "Command to execute when pasting a link for the first time with auto-focus or auto-paste" setting.`),!1;let r=this.lib.workspace.hoverEditor;return this.plugin.registerOneTimeEvent(this.app.workspace,"active-leaf-change",o=>{o&&r.isHoverEditorLeaf(o)&&r.postProcessHoverEditorLeaf(o)}),this.app.commands.executeCommandById(i.id)}getAutoFocusOrAutoPasteTarget(e){let i=this.plugin.lastActiveMarkdownFile,r=this.plugin.lastPasteFile,o=!!(i&&this.lib.workspace.isMarkdownFileOpened(i)),s=null;return e==="last-paste"?s=r:e==="last-active"?s=i:e==="last-active-and-open"?o&&(s=i):e==="last-paste-then-last-active"?s=r!=null?r:i:e==="last-paste-then-last-active-and-open"?r?s=r:o&&(s=i):e==="last-active-and-open-then-last-paste"&&(o?s=i:r&&(s=r)),s&&s.extension==="md"?s:null}async prepareMarkdownLeafForPaste(e){let i=this.lib.workspace.getExistingLeafForMarkdownFile(e),r=!!i;if(!i&&this.settings.openAutoFocusTargetIfNotOpened){let o=this.settings.howToOpenAutoFocusTargetIfNotOpened;if(o==="hover-editor"){let s=await this.lib.workspace.hoverEditor.createNewHoverEditorLeaf({hoverPopover:null},null,e.path,"");s&&(i=s)}else i=this.lib.workspace.getLeaf(o),await i.openFile(e,{active:!1});if(i&&this.settings.openAutoFocusTargetInEditingView){await this.lib.workspace.ensureViewLoaded(i);let s=i.view;s instanceof Ei.MarkdownView&&(await s.setState({mode:"source"},{history:!1}),s.setEphemeralState({focus:!1}))}}return i&&(await this.lib.workspace.ensureViewLoaded(i),this.lib.workspace.hoverEditor.postProcessHoverEditorLeaf(i),this.settings.closeSidebarWhenLostFocus&&this.lib.workspace.registerHideSidebar(i)),{leaf:i,isExistingLeaf:r}}async pasteTextToFile(e,i,r=!1){let{leaf:o,isExistingLeaf:s}=await this.prepareMarkdownLeafForPaste(i);if(!r&&o&&s&&o.view instanceof Ei.MarkdownView&&o.view.getMode()==="source"){let a=o.view,c=a.editor;if(this.settings.respectCursorPositionWhenAutoPaste)c.replaceSelection(e);else{let l=c.getValue();l=l.trimEnd(),l&&(l+=` + +`),l+=e,c.setValue(l)}a.save(),await this.updateAndRevealCursorInEditor(o.view,{focus:this.settings.focusEditorAfterAutoPaste,goEnd:!this.settings.respectCursorPositionWhenAutoPaste})}else await this.app.vault.process(i,a=>(a=a.trimEnd(),a&&(a+=` + +`),a+=e,a)),o&&activeWindow.setTimeout(async()=>{o.view instanceof Ei.MarkdownView&&await this.updateAndRevealCursorInEditor(o.view,{focus:this.settings.focusEditorAfterAutoPaste,goEnd:!0})})}async updateAndRevealCursorInEditor(e,i){let{focus:r,goEnd:o}=i,s=e.editor;r&&(o&&s.exec("goEnd"),await this.lib.workspace.revealLeaf(e.leaf),this.app.workspace.setActiveLeaf(e.leaf),s.focus());let a=s.coordsAtPos(s.getCursor(),!0);if(a){let c=s.getScrollInfo();if(a.topc.top+c.clientHeight){let l={from:s.getCursor("from"),to:s.getCursor("to")};s.scrollIntoView(l,!0)}}}watchPaste(e,i){this.plugin.registerOneTimeEvent(this.app.workspace,"editor-paste",(r,o,s)=>{var d;if(((d=s.file)==null?void 0:d.extension)!=="md"||!r.clipboardData)return;let c=r.clipboardData.getData("text/plain").replace(/\r\n/g,` +`),l=e.replace(/\r\n/g,` +`);c===l&&(this.plugin.lastPasteFile=s.file,i==null||i()),s instanceof Ei.MarkdownView&&setTimeout(()=>s.save())})}onCopyFinish(e,i){this.watchPaste(e,i),this.plugin.lastCopiedDestInfo=null}async autoFocusOrAutoPaste(e,i,r){if(i||this.settings.autoPaste)if(await this.autoPaste(e)){if(r==null||r.setStatus("Link copied & pasted",this.statusDurationMs),!this.settings.focusEditorAfterAutoPaste&&this.settings.clearSelectionAfterAutoPaste){let s=activeWindow.getSelection();s&&this.lib.copyLink.getPageAndTextRangeFromSelection(s)&&s.empty()}}else r==null||r.setStatus("Link copied but paste target not identified",this.statusDurationMs);else this.settings.autoFocus&&(await this.autoFocus()||r==null||r.setStatus("Link copied but paste target not identified",this.statusDurationMs))}};var Rh=class extends ye{computeMergedHighlightRects(t,e,i,r,o){let{textContentItems:s,textDivs:a,div:c}=t,l=[],d=null,h=[];o===0&&(r--,o=s[r].str.length);for(let u=e;u<=r;u++){let f=s[u],p=a[u];if(!f.str)continue;let g=this.computeHighlightRectForItem(c,f,p,u,e,i,r,o);g&&(d?this.areRectanglesMergeable(d,g)?(d=this.mergeRectangles(d,g),h.push(u)):(l.push({rect:d,indices:h}),d=g,h=[u]):(d=g,h=[u]))}return d&&l.push({rect:d,indices:h}),l}computeHighlightRectForItem(t,e,i,r,o,s,a,c){return e.chars&&e.chars.length>=e.str.length?this.computeHighlightRectForItemFromChars(e,r,o,s,a,c):this.computeHighlightRectForItemFromTextLayer(t,e,i,r,o,s,a,c)}computeHighlightRectForItemFromChars(t,e,i,r,o,s){let a=t.chars.slice(t.chars.findIndex(u=>u.c===t.str.charAt(0)),t.chars.findLastIndex(u=>u.c===t.str.charAt(t.str.length-1))+1),c=e===i?r:0,l=(e===o?Math.min(s,a.length):a.length)-1;if(c>a.length-1||l<0)return null;let d=a[c],h=a[l];return[Math.min(d.r[0],h.r[0]),Math.min(d.r[1],h.r[1]),Math.max(d.r[2],h.r[2]),Math.max(d.r[3],h.r[3])]}computeHighlightRectForItemFromTextLayer(t,e,i,r,o,s,a,c){let l=r===o?s:0,d=r===a?c:void 0,h=e.transform[4],u=e.transform[5],f=e.transform[4]+e.width,p=e.transform[5]+e.height,g=i.cloneNode();t.appendChild(g);let m=e.str.substring(0,l);g.appendText(m);let b=e.str.substring(l,d),w=g.createSpan();if(w.appendText(b),d!==void 0){let P=e.str.substring(d);g.appendText(P)}let F=w.getBoundingClientRect(),v=i.getBoundingClientRect();return g.remove(),[h+(F.left-v.left)/v.width*e.width,u+(F.bottom-v.bottom)/v.height*e.height,f-(v.right-F.right)/v.width*e.width,p-(v.top-F.top)/v.height*e.height]}areRectanglesMergeable(t,e){return this.areRectanglesMergeableHorizontally(t,e)||this.areRectanglesMergeableVertically(t,e)}areRectanglesMergeableHorizontally(t,e){let[i,r,o,s]=t,[a,c,l,d]=e,h=(r+s)/2,u=(c+d)/2,f=Math.abs(s-r),p=Math.abs(d-c),g=Math.max(f,p)*.5;return Math.abs(h-u).85&&p/u>.85}mergeRectangles(...t){let e=t.map(s=>s[0]),i=t.map(s=>s[1]),r=t.map(s=>s[2]),o=t.map(s=>s[3]);return[Math.min(...e),Math.min(...i),Math.max(...r),Math.max(...o)]}rectsToQuadPoints(t){return t.flatMap(([e,i,r,o])=>[e,o,r,o,e,i,r,i])}};var Vh=require("obsidian");var Bh=class extends ye{getPDFPlusBacklinkHighlightLayer(t){var i;let e=t.div;return(i=e.querySelector("div.pdf-plus-backlink-highlight-layer"))!=null?i:e.createDiv("pdf-plus-backlink-highlight-layer",r=>{window.pdfjsLib.setLayerDimensions(r,t.viewport)})}placeRectInPage(t,e){let i=e.pdfPage.view,r=i[0],o=i[1],s=i[2]-i[0],a=i[3]-i[1],c=window.pdfjsLib.Util.normalizeRect([t[0],i[3]-t[1]+i[1],t[2],i[3]-t[3]+i[1]]),d=this.getPDFPlusBacklinkHighlightLayer(e).createDiv("pdf-plus-backlink");return d.setCssStyles({left:`${100*(c[0]-r)/s}%`,top:`${100*(c[1]-o)/a}%`,width:`${100*(c[2]-c[0])/s}%`,height:`${100*(c[3]-c[1])/a}%`}),d}highlightSubpath(t,e){var i,r,o;if(((i=t.subpathHighlight)==null?void 0:i.type)==="text"){let s=new Vh.Component;s.load(),this.lib.onTextLayerReady(t.pdfViewer,s,a=>{var d;if(((d=t.subpathHighlight)==null?void 0:d.type)!=="text")return;let{page:c,range:l}=t.subpathHighlight;c===a&&(t.highlightText(c,l),e>0&&setTimeout(()=>{t.clearTextHighlight()},e*1e3),s.unload())})}else if(((r=t.subpathHighlight)==null?void 0:r.type)==="annotation"){let s=new Vh.Component;s.load(),this.lib.onAnnotationLayerReady(t.pdfViewer,s,a=>{var d;if(((d=t.subpathHighlight)==null?void 0:d.type)!=="annotation")return;let{page:c,id:l}=t.subpathHighlight;c===a&&(t.highlightAnnotation(c,l),e>0&&setTimeout(()=>t.clearAnnotationHighlight(),e*1e3),s.unload())})}else if(((o=t.subpathHighlight)==null?void 0:o.type)==="rect"){let s=new Vh.Component;s.load(),this.lib.onPageReady(t.pdfViewer,s,a=>{var d;if(((d=t.subpathHighlight)==null?void 0:d.type)!=="rect")return;let{page:c,rect:l}=t.subpathHighlight;c===a&&(this.highlightRect(t,c,l),e>0&&setTimeout(()=>{this.clearRectHighlight(t)},e*1e3),s.unload())})}}highlightRect(t,e,i){if(this.clearRectHighlight(t),1<=e&&e<=t.pdfViewer.pagesCount){let r=t.getPage(e);r!=null&&r.div.dataset.loaded&&(t.rectHighlight=this.placeRectInPage(i,r),t.rectHighlight.addClass("rect-highlight"),this.settings.zoomToFitRect||activeWindow.setTimeout(()=>{window.pdfjsViewer.scrollIntoView(t.rectHighlight,{top:-this.settings.embedMargin})}))}}clearRectHighlight(t){t.rectHighlight&&(t.rectHighlight.detach(),t.rectHighlight=null)}};var ny=require("obsidian");var Hh=class extends ye{async addTextMarkupAnnotation(t,e,i,r,o,s){if(!this.plugin.settings.author)throw new Error(`${this.plugin.manifest.name}: The author name is not set. Please set it in the plugin settings.`);return await this.process(t,a=>{let c=a.getPage(e-1),{r:l,g:d,b:h}=this.plugin.domManager.getRgb(o),u=vp(),f=this.lib.highlight.geometry,p=this.addAnnotation(c,{Subtype:r,Rect:f.mergeRectangles(...i),QuadPoints:f.rectsToQuadPoints(i),Contents:M.fromText(s!=null?s:""),M:G.fromDate(new Date),T:M.fromText(this.plugin.settings.author),CA:r==="Highlight"?this.plugin.settings.writeHighlightToFileOpacity:1,Border:r==="Highlight"?[u,u,0]:void 0,C:[l/255,d/255,h/255]});return Ec(p.objectNumber,p.generationNumber)})}async addHighlightAnnotation(t,e,i,r,o){return await this.addTextMarkupAnnotation(t,e,i,"Highlight",r,o)}async addLinkAnnotation(t,e,i,r,o,s){return await this.process(t,a=>{let c=a.getPage(e-1),l=mr(this.plugin.settings.pdfLinkColor),{r:d,g:h,b:u}=l!=null?l:{r:0,g:0,b:0},f=this.lib.highlight.geometry,p;typeof r=="string"?p=G.of(r):p=[a.getPage(r[0]).ref,r[1],...r.slice(2).map(w=>typeof w=="number"?N.of(w):Me)];let g=this.addAnnotation(c,{Subtype:"Link",Rect:f.mergeRectangles(...i),QuadPoints:f.rectsToQuadPoints(i),Dest:p,M:G.fromDate(new Date),Border:[0,0,this.plugin.settings.pdfLinkBorder?1:0],C:[d/255,h/255,u/255]});return Ec(g.objectNumber,g.generationNumber)})}async process(t,e){let i=await this.lib.loadPdfLibDocument(t),r=await e(i);return await this.app.vault.modifyBinary(t,await i.save()),r}async read(t,e){let i=await this.lib.loadPdfLibDocument(t);return await e(i)}addAnnotation(t,e){let i=t.doc.context,r=i.register(i.obj({Type:"Annot",...e}));return t.node.addAnnot(r),r}async deleteAnnotation(t,e,i){await this.process(t,r=>{let o=r.getPage(e-1),s=this.findAnnotationRef(o,i);s&&o.node.removeAnnot(s)})}async getAnnotationContents(t,e,i){let r=await this.getAnnotation(t,e,i);if(r){let o=this.getContentsFromAnnotation(r);return o!=null?o:null}return null}async setAnnotationContents(t,e,i,r){await this.processAnnotation(t,e,i,o=>{this.setContentsToAnnotation(o,r)})}async getAnnotationColor(t,e,i){var o;let r=await this.getAnnotation(t,e,i);return r&&(o=this.getColorFromAnnotation(r))!=null?o:null}async setAnnotationColor(t,e,i,r){await this.processAnnotation(t,e,i,async o=>{this.setColorToAnnotation(o,r)})}async getAnnotationOpacity(t,e,i){var o;let r=await this.getAnnotation(t,e,i);return r&&(o=this.getOpacityFromAnnotation(r))!=null?o:null}async setAnnotationOpacity(t,e,i,r){await this.processAnnotation(t,e,i,async o=>{this.setOpacityToAnnotation(o,r)})}findAnnotationRef(t,e){var i;return(i=t.node.Annots())==null?void 0:i.asArray().find(r=>r instanceof q&&Ec(r.objectNumber,r.generationNumber)===e)}async getAnnotation(t,e,i){return await this.read(t,r=>{let o=r.getPage(e-1),s=this.findAnnotationRef(o,i);return s?o.node.context.lookup(s,R):null})}async processAnnotation(t,e,i,r){return await this.process(t,async o=>{let s=o.getPage(e-1),a=this.findAnnotationRef(s,i);if(a){let c=s.node.context.lookup(a,R);await r(c)}})}getColorFromAnnotation(t){if(!t.get(x.of("AP"))){let i=t.get(x.of("C"));if(i instanceof H){let r=i.asArray();if(r.length===3){let[o,s,a]=r.map(c=>{if(c instanceof N)return Math.round(c.asNumber()*255);throw new Error(`${this.plugin.manifest.name}: Invalid color`)});return{r:o,g:s,b:a}}}}}setColorToAnnotation(t,e){let i=t.get(x.of("C"));i instanceof H&&(i.set(0,N.of(e.r/255)),i.set(1,N.of(e.g/255)),i.set(2,N.of(e.b/255)))}getContentsFromAnnotation(t){let e=t.get(x.of("Contents"));if(e instanceof G||e instanceof M)return e.decodeText()}setContentsToAnnotation(t,e){t.set(x.of("Contents"),M.fromText(e))}getOpacityFromAnnotation(t){if(!t.get(x.of("AP"))){let i=t.get(x.of("CA"));if(i instanceof N)return i.asNumber()}}setOpacityToAnnotation(t,e){t.set(x.of("CA"),N.of(e))}getAuthorFromAnnotation(t){let e=t.get(x.of("T"));if(e instanceof G||e instanceof M)return e.decodeText()}setAuthorToAnnotation(t,e){t.set(x.of("T"),M.fromText(e))}getBorderWidthFromAnnotation(t){let e=t.get(x.of("Border"));if(e instanceof H){let i=e.asArray()[2];if(i instanceof N)return i.asNumber()}}setBorderWidthToAnnotation(t,e){let i=t.get(x.of("Border"));i instanceof H&&i.set(2,N.of(e))}};var Uh=class extends ye{constructor(e){super(e);this.pdflib=new Hh(e)}getPdfIo(){return this.pdflib}async addTextMarkupAnnotationToSelection(e,i){return this.addAnnotationToSelection(async(r,o,s)=>await this.getPdfIo().addTextMarkupAnnotation(r,o,s,e,i))}async addLinkAnnotationToSelection(e){return this.addAnnotationToSelection(async(i,r,o)=>await this.getPdfIo().addLinkAnnotation(i,r,o,e))}async addAnnotationToSelection(e){let i=this.lib.copyLink.getTemplateVariables({});if(!i)return;let{subpath:r,child:o}=i,s=Ln(r);if(s&&"beginIndex"in s){let{page:a,beginIndex:c,beginOffset:l,endIndex:d,endOffset:h}=s;return{child:o,file:o.file,page:a,...await this.addAnnotationToTextRange(e,o,a,c,l,d,h)}}return null}async addAnnotationToTextRange(e,i,r,o,s,a,c){if(i.file&&1<=r&&r<=i.pdfViewer.pagesCount){let l=i.getPage(r);if(l!=null&&l.textLayer&&l.div.dataset.loaded){let h=this.lib.highlight.geometry.computeMergedHighlightRects(l.textLayer,o,s,a,c).map(({rect:f})=>f),u;try{u=await e(i.file,r,h)}catch(f){new ny.Notice(`${this.plugin.manifest.name}: An error occurred while attemping to add an annotation.`),console.error(f)}return{annotationID:u,rects:h}}}}async deleteAnnotation(e,i,r){await this.getPdfIo().deleteAnnotation(e,i,r)}async getAnnotationContents(e,i,r){return await this.getPdfIo().getAnnotationContents(e,i,r)}async setAnnotationContents(e,i,r,o){return await this.getPdfIo().setAnnotationContents(e,i,r,o)}};var zh=class extends ye{async getAnnotatedTextsInDocument(t){let e=new Map;for(let i=1;i<=t.numPages;i++){let r=await t.getPage(i),o=await this.getAnnotatedTextsInPage(r);e.set(i,o)}return e}async getAnnotatedTextsInPage(t){var o;let[{items:e},i]=await Promise.all([t.getTextContent({includeChars:!0}),t.getAnnotations()]),r=[];for(let s of i){if(!["Highlight","Underline","Squiggly","StrikeOut"].includes(s.subtype))continue;let c=[];for(let u of s.quadPoints){let f=u[1],p=u[2],g=[p.x,p.y,f.x,f.y];if(g.some(m=>typeof m!="number"))throw new Error("Invalid rect");g=window.pdfjsLib.Util.normalizeRect(g),c.push(this.getTextByRect(e,g))}let l=s.color?{r:s.color[0],g:s.color[1],b:s.color[2]}:null,d=(o=s.contentsObj)==null?void 0:o.str,h=s.quadPoints[0];r.push({id:s.id,textRanges:c,rgb:l,comment:d,left:h[0].x,top:h[0].y})}return new Map(r.sort((s,a)=>{if(s.textRanges.length&&a.textRanges.length){let c=s.textRanges[0].from,l=a.textRanges[0].from;return c.index-l.index||c.offset-l.offset}return a.top-s.top||s.left-a.left}).map(s=>{let a=s.textRanges.map(c=>c.text).join(` +`);return a=this.lib.toSingleLine(a),[s.id,{text:a,rgb:s.rgb,comment:s.comment}]}))}getTextByRect(t,e){let[i,r,o,s]=e,a="",c={index:-1,offset:-1},l={index:-1,offset:-1};for(let d=0;d{let r=i.view;this.lib.isPDFView(r)&&e(r)})}iterateBacklinkViews(e){this.app.workspace.getLeavesOfType("backlink").forEach(i=>e(i.view))}iterateCanvasViews(e){this.app.workspace.iterateAllLeaves(i=>{let r=i.view;this.lib.isCanvasView(r)&&e(r)})}iteratePDFViewerComponents(e){this.app.workspace.iterateAllLeaves(i=>{let r=i.view;this.lib.isPDFView(r)?e(r.viewer,r.file):r instanceof Je.MarkdownView?this.lib.getAllPDFEmbedInMarkdownView(r).forEach(o=>e(o.viewer,o.file)):this.lib.isCanvasView(r)&&this.lib.getAllPDFEmbedInCanvasView(r).forEach(o=>e(o.viewer,o.file))})}iteratePDFViewerChild(e){this.iteratePDFViewerComponents(i=>{i.then(r=>e(r))})}getActivePDFView(){var i;if(this.plugin.classes.PDFView)return this.app.workspace.getActiveViewOfType(this.plugin.classes.PDFView);let e=(i=this.app.workspace.activeLeaf)==null?void 0:i.view;return e&&this.lib.isPDFView(e)?e:null}getActiveCanvasView(){var i;let e=(i=this.app.workspace.activeLeaf)==null?void 0:i.view;return e&&this.lib.isCanvasView(e)?e:null}getExistingLeafForPDFFile(e){return this.getExistingLeafForFile(e)}getActiveGroupLeaves(){var i;let e=(i=this.app.workspace.activeLeaf)==null?void 0:i.group;return e?this.app.workspace.getGroupLeaves(e):null}async openMarkdownLinkFromPDF(e,i,r,o){var c;let s;r?s=this.app.workspace.getLeaf(r):ry(this.settings.paneTypeForFirstMDLeaf)&&this.settings.alwaysUseSidebar?s=this.getMarkdownLeafInSidebar(this.settings.paneTypeForFirstMDLeaf):s=this.getMarkdownLeafForLinkFromPDF(e,i);let a={};if(o){if("pos"in o){let{pos:l}=o;a.eState={line:l.start.line,startLoc:l.start,endLoc:l.end}}else{let{line:l}=o;a.eState={line:l}}a.eState.scroll=a.eState.line,a.eState.focus=!this.settings.dontActivateAfterOpenMD}s.parentSplit instanceof Je.WorkspaceTabs&&s.parentSplit===((c=this.app.workspace.activeLeaf)==null?void 0:c.parentSplit)||(a.active=!this.plugin.settings.dontActivateAfterOpenMD),await s.openLinkText(e,i,a),await this.revealLeaf(s)}getMarkdownLeafInSidebar(e){var i;return this.settings.singleMDLeafInSidebar?(i=this.lib.workspace.getExistingMarkdownLeafInSidebar(e))!=null?i:this.lib.workspace.getNewLeafInSidebar(e):this.lib.workspace.getNewLeafInSidebar(e)}getMarkdownLeafForLinkFromPDF(e,i){var c;let{path:r}=(0,Je.parseLinktext)(e),o=this.app.metadataCache.getFirstLinkpathDest(r,i),s,a;return this.app.workspace.iterateAllLeaves(l=>{if(s)return;let d=!0;if(l.view.getViewType()==="markdown"){let h=l.getRoot();for(let u of this.settings.ignoreExistingMarkdownTabIn)if(h===this.app.workspace[u])return;l.parentSplit instanceof Je.WorkspaceTabs&&l.parentSplit.children.some(f=>{if(f instanceof Je.WorkspaceLeaf&&f.view.getViewType()==="pdf")return this.getFilePathFromView(f.view)===i})&&(d=!1),d&&(a=l.parentSplit),o&&this.getFilePathFromView(l.view)===o.path&&(s=l)}}),s||(ry(this.settings.paneTypeForFirstMDLeaf)&&this.settings.singleMDLeafInSidebar&&a&&this.isInSidebar(a)?s=(c=this.getExistingMarkdownLeafInSidebar(this.settings.paneTypeForFirstMDLeaf))!=null?c:this.lib.workspace.getNewLeafInSidebar(this.settings.paneTypeForFirstMDLeaf):s=a?this.app.workspace.createLeafInParent(a,-1):this.getLeaf(this.plugin.settings.paneTypeForFirstMDLeaf)),s}isInSidebar(e){let i=e.getRoot();return i===this.app.workspace.rightSplit||i===this.app.workspace.leftSplit}getLeaf(e){return e===""&&(e=!1),typeof e=="boolean"||XP(e)?this.app.workspace.getLeaf(e):ZP(e)?this.getLeafBySplit(e):this.getLeafInSidebar(e)}getLeafBySplit(e){let i=this.app.workspace.getMostRecentLeaf();if(i){if(["right","left"].contains(e))return this.app.workspace.createLeafBySplit(i,"vertical",e==="left");if(["down","up"].contains(e))return this.app.workspace.createLeafBySplit(i,"horizontal",e==="up")}return this.app.workspace.createLeafInParent(this.app.workspace.rootSplit,0)}getLeafInSidebar(e){return this.getNewLeafInSidebar(e)}getExistingMarkdownLeafInSidebar(e){let i,r=e==="right-sidebar"?this.app.workspace.rightSplit:this.app.workspace.leftSplit;return this.app.workspace.iterateAllLeaves(o=>{i||o.getRoot()!==r||o.view.getViewType()==="markdown"&&(i=o)}),i!=null?i:null}getNewLeafInSidebar(e){let i=e==="right-sidebar"?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1);if(!i)throw new Error("No sidebar leaf found");return i}async revealLeaf(e){if((0,Je.requireApiVersion)("1.5.11")){await this.app.workspace.revealLeaf(e);return}if(!Je.Platform.isDesktopApp){this.app.workspace.revealLeaf(e);return}let i=e.getRoot();i instanceof Je.WorkspaceSidedock&&i.collapsed&&i.toggle();let r=e.parent;r instanceof Je.WorkspaceTabs&&r.selectTab(e),e.getContainer().focus()}openPDFLinkTextInLeaf(e,i,r,o){let{subpath:s}=(0,Je.parseLinktext)(i);return this.plugin.patchStatus.pdfInternals||(this.plugin.subpathWhenPatched=s),e.openLinkText(i,r,o).then(async()=>{await this.revealLeaf(e);let a=e.view;this.lib.isPDFView(a)&&a.viewer.then(c=>{let l=this.plugin.settings.highlightDuration;this.lib.highlight.viewer.highlightSubpath(c,l)})})}openPDFLinkTextInExistingLeafForTargetPDF(e,i,r,o){var c,l;if(!o){let{path:d}=(0,Je.parseLinktext)(e);o=(c=this.app.metadataCache.getFirstLinkpathDest(d,i))!=null?c:void 0}if(!o)return{exists:!1,promise:Promise.resolve()};let s=this.getExistingLeafForPDFFile(o);return s?(s.parentSplit instanceof Je.WorkspaceTabs&&s.parentSplit===((l=this.app.workspace.activeLeaf)==null?void 0:l.parentSplit)||(r=r!=null?r:{},r.active=!this.settings.dontActivateAfterOpenPDF),s.isVisible()&&this.settings.highlightExistingTab&&(s.containerEl.addClass("pdf-plus-link-opened","is-highlighted"),setTimeout(()=>s.containerEl.removeClass("pdf-plus-link-opened","is-highlighted"),this.settings.existingTabHighlightDuration*1e3)),{exists:!0,promise:this.openPDFLinkTextInLeaf(s,e,i,r)}):{exists:!1,promise:Promise.resolve()}}getExistingLeafForFile(e){let i=this.app.viewRegistry.getTypeByExtension(e.extension);if(!i)return null;let r=null;return this.app.workspace.iterateAllLeaves(o=>{r||o.view.getViewType()===i&&this.getFilePathFromView(o.view)===e.path&&(r=o)}),r}getExistingLeafForMarkdownFile(e){return this.getExistingLeafForFile(e)}isMarkdownFileOpened(e){return!!this.getExistingLeafForMarkdownFile(e)}registerHideSidebar(e){let i=e.getRoot();if(i===this.app.workspace.leftSplit||i===this.app.workspace.rightSplit){let r=i,o=this.app.workspace.on("active-leaf-change",s=>{s&&s.getRoot()!==r&&(r.collapse(),this.app.workspace.offref(o))})}}getFilePathFromView(e){let i=e.getState().file;return typeof i=="string"?i:null}async ensureViewLoaded(e){(0,Je.requireApiVersion)("1.7.2")&&await e.loadIfDeferred()}},wg=class extends ye{get hoverEditorPlugin(){var t;return(t=this.app.plugins.plugins["obsidian-hover-editor"])!=null?t:null}get waitTime(){var t;return(t=this.hoverEditorPlugin)==null?void 0:t.settings.triggerDelay}isHoverEditorLeaf(t){return t.containerEl.closest(".popover.hover-popover.hover-editor")!==null}async createNewHoverEditorLeaf(t,e,i,r,o){return this.hoverEditorPlugin?new Promise(s=>{var c;let a=this.app.workspace.on("active-leaf-change",l=>{l&&this.isHoverEditorLeaf(l)&&(this.app.workspace.offref(a),s(l))});this.app.workspace.trigger("link-hover",t,e,i,r,o),window.setTimeout(()=>{this.app.workspace.offref(a),s(null)},((c=this.waitTime)!=null?c:300)+300)}):null}iterateHoverEditorLeaves(t){this.app.workspace.iterateAllLeaves(e=>{this.isHoverEditorLeaf(e)&&t(e)})}getHoverEditorForLeaf(t){var e,i;return(i=(e=this.hoverEditorPlugin)==null?void 0:e.activePopovers.find(r=>r.hoverEl.contains(t.containerEl)))!=null?i:null}postProcessHoverEditorLeaf(t){if(this.isHoverEditorLeaf(t)){let e=this.getHoverEditorForLeaf(t);if(e&&(e.hoverEl.hasClass("is-minimized")&&e.toggleMinimized(),this.settings.closeHoverEditorWhenLostFocus)){let i=this.app.workspace.on("active-leaf-change",r=>{r!==t&&(e.hide(),this.app.workspace.offref(i))})}}}};var ot=require("obsidian");var Hc=require("obsidian");var jh=class extends Ye{onOpen(){var t;super.onOpen(),this.containerEl.addClass("pdf-plus-restore-default-modal"),this.titleEl.setText(`${this.plugin.manifest.name}: Restore default settings`),this.contentEl.createEl("p",{text:`This operation will overwrite your PDF++ config file (${((t=this.plugin.manifest.dir)!=null?t:this.app.vault.configDir+"/plugins/"+this.plugin.manifest.id)+"/data.json"}). You may want to back up the file before proceeding.`}),this.contentEl.createDiv("modal-button-container",e=>{new Hc.ButtonComponent(e).setButtonText("I understand, restore default settings").setWarning().onClick(async()=>{await this.plugin.restoreDefaultSettings(),this.close(),new Hc.Notice(`${this.plugin.manifest.name}: Default setting restored. Note that some options require a restart to take effect.`,6e3)}),new Hc.ButtonComponent(e).setButtonText("Cancel").onClick(()=>{this.close()})}),setTimeout(()=>{let e=this.containerEl.doc.activeElement;e&&e.instanceOf(HTMLButtonElement)&&this.containerEl.contains(e)&&e.blur()})}};var Kh=class extends ye{constructor(...e){super(...e);let i=[{id:"copy-link-to-selection",name:"Copy link to selection or annotation",checkCallback:r=>this.copyLink(r,!1)},{id:"rectangular-selection",name:"Start rectangular selection",checkCallback:r=>this.copyEmbedLinkToRectangularSelection(r,!1)},{id:"context-menu",name:"Show context menu at selection",checkCallback:r=>this.showContextMenu(r)},{id:"extract-annotation-and-copy-links",name:"Extract & copy annotations in this PDF",checkCallback:r=>this.extractHighlightedText(r)},{id:"copy-link-to-page-view",name:"Copy link to current page view",checkCallback:r=>this.copyLinkToPageView(r)},{id:"outline",name:"Show outline",checkCallback:r=>this.showOutline(r)},{id:"thumbnail",name:"Show thumbnail",checkCallback:r=>this.showThumbnail(r)},{id:"close-sidebar",name:"Close PDF sidebar",checkCallback:r=>this.closeSidebar(r)},{id:"fit-width",name:"Fit width",checkCallback:r=>this.setScaleValue(r,"page-width")},{id:"fit-height",name:"Fit height",checkCallback:r=>this.setScaleValue(r,"page-height")},{id:"zoom-in",name:"Zoom in",checkCallback:r=>this.zoom(r,!0)},{id:"zoom-out",name:"Zoom out",checkCallback:r=>this.zoom(r,!1)},{id:"adapt-to-theme",name:"Adapt to theme",checkCallback:r=>this.toggleAdaptToTheme(r,!0)},{id:"not-adapt-to-theme",name:"Don't adapt to theme",checkCallback:r=>this.toggleAdaptToTheme(r,!1)},{id:"toggle-adapt-to-theme",name:'Toggle "adapt to theme"',checkCallback:r=>this.toggleAdaptToTheme(r)},{id:"go-to-page",name:"Go to page",checkCallback:r=>this.focusAndSelectPageNumberEl(r)},{id:"copy-format-menu",name:"Show copy format menu",checkCallback:r=>this.showCopyFormatMenu(r)},{id:"display-text-format-menu",name:"Show display text format menu",checkCallback:r=>this.showDisplayTextFormatMenu(r)},{id:"enable-pdf-edit",name:"Enable PDF edit",checkCallback:r=>this.setWriteFile(r,!0)},{id:"disable-pdf-edit",name:"Disable PDF edit",checkCallback:r=>this.setWriteFile(r,!1)},{id:"toggle-auto-focus",name:"Toggle auto-focus",callback:()=>this.toggleAutoFocus()},{id:"toggle-auto-paste",name:"Toggle auto-paste",callback:()=>this.toggleAutoPaste()},{id:"toggle-auto-copy",name:"Toggle auto-copy",callback:()=>this.plugin.autoCopyMode.toggle()},{id:"add-page",name:"Add new page at the end",checkCallback:r=>this.addPage(r)},{id:"insert-page-before",name:"Insert page before this page",checkCallback:r=>this.insertPage(r,!0)},{id:"insert-page-after",name:"Insert page after this page",checkCallback:r=>this.insertPage(r,!1)},{id:"delete-page",name:"Delete this page",checkCallback:r=>this.deletePage(r)},{id:"extract-this-page",name:"Extract this page to a new file",checkCallback:r=>this.extractThisPage(r)},{id:"divide",name:"Divide this PDF into two files at this page",checkCallback:r=>this.dividePDF(r)},{id:"edit-page-labels",name:"Edit page labels",checkCallback:r=>this.editPageLabels(r)},{id:"copy-outline-as-list",name:"Copy PDF outline as markdown list",checkCallback:r=>this.copyOutline(r,"list")},{id:"copy-outline-as-headings",name:"Copy PDF outline as markdown headings",checkCallback:r=>this.copyOutline(r,"heading")},{id:"add-outline-item",name:"Add to outline (bookmark)",checkCallback:r=>this.addOutlineItem(r)},{id:"create-new-note",name:"Create new note for auto-focus or auto-paste",callback:()=>this.createNewNote()},{id:"copy-debug-info",name:"Copy debug info",callback:()=>this.copyDebugInfo()},{id:"load-debug-info",name:"Load debug info",checkCallback:r=>this.loadDebugInfo(r)},{id:"create-pdf",name:"Create new PDF",callback:()=>this.createPDF()},{id:"import",name:"Import this PDF into vault",checkCallback:r=>this.importExternalFileIntoVault(r)},{id:"open-external",name:"Open this PDF in the original location",checkCallback:r=>this.openExternalSource(r)},{id:"create-dummy",name:"Create dummy file for external PDF",callback:()=>this.createDummyForExternalPDF()},{id:"restore-default",name:"Restore default settings",callback:()=>new jh(this.plugin).open()}];this.commands={};for(let r of i)this.commands[r.id]=r}registerCommands(){Object.values(this.commands).forEach(e=>this.plugin.addCommand(e))}getCommand(e){return e.startsWith(this.plugin.manifest.id+":")&&(e=e.slice(this.plugin.manifest.id.length+1)),this.commands[e]}listCommands(){return Object.values(this.commands)}listCommandNames(){return Object.values(this.commands).map(e=>this.stripCommandNamePrefix(e.name))}stripCommandNamePrefix(e){return e.startsWith(this.plugin.manifest.name+": ")?e.slice(this.plugin.manifest.name.length+2):e}copyLink(e,i=!1){return!this.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(e,i)&&!this.copyLinkToAnnotation(e,i)?this.copyLinkToSelection(e,i):!0}createCanvasCard(e){return this.createCanvasCardFromAnnotation(e)?!0:this.createCanvasCardFromSelection(e)}copyLinkToSelection(e,i=!1){let r=this.lib.copyLink.getSelectionLinkInfo();if(!r)return!1;let{template:o,colorName:s}=r;return this.lib.copyLink.copyLinkToSelection(e,{copyFormat:o},s,i)}copyLinkToAnnotation(e,i=!1){let r=this.lib.copyLink.getAnnotationLinkInfo();if(!r)return!1;let{child:o,copyButtonEl:s,template:a,page:c,id:l}=r,d=this.lib.copyLink.copyLinkToAnnotation(o,e,{copyFormat:a},c,l,i);return!e&&d&&(0,ot.setIcon)(s,"lucide-check"),d}writeHighlightAnnotationToSelectionIntoFileAndCopyLink(e,i=!1){var a;let r=this.lib.getColorPaletteAssociatedWithSelection();if(!r||!r.writeFile)return!1;let o=this.settings.copyCommands[r.actionIndex].template,s=(a=r.selectedColorName)!=null?a:void 0;return this.lib.copyLink.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(e,{copyFormat:o},s,i)}copyEmbedLinkToRectangularSelection(e,i){let r=this.lib.getColorPalette();return!r||!r.cropButtonEl?!1:(e||r.startRectangularSelection(i),!0)}createCanvasCardFromSelection(e){var a;let i=(a=this.lib.workspace.getActiveCanvasView())==null?void 0:a.canvas;if(!i)return!1;let r=this.lib.copyLink.getSelectionLinkInfo();if(!r)return!1;let{template:o,colorName:s}=r;return this.lib.copyLink.makeCanvasTextNodeFromSelection(e,i,o,s)}createCanvasCardFromAnnotation(e){var d;let i=(d=this.lib.workspace.getActiveCanvasView())==null?void 0:d.canvas;if(!i)return!1;let r=this.lib.copyLink.getAnnotationLinkInfo();if(!r)return!1;let{child:o,template:s,page:a,id:c}=r;return this.lib.copyLink.makeCanvasTextNodeFromAnnotation(e,i,o,s,a,c)}copyLinkToPageView(e){var o,s,a,c,l;let i=this.lib.getPDFView(!0);if(!i||!i.file)return!1;let r=i.getState();if(typeof r.left!="number"||typeof r.top!="number")return!1;if(!e){let d=`#page=${r.page}`,h;((s=(o=i.viewer.child)==null?void 0:o.pdfViewer.pdfViewer)==null?void 0:s.currentScaleValue)==="page-width"?(d+=`&offset=,${r.top},`,h=[r.page-1,"FitBH",r.top]):(d+=`&offset=${r.left},${r.top},${(a=r.zoom)!=null?a:0}`,h=[r.page-1,"XYZ",r.left,r.top,(c=r.zoom)!=null?c:0]);let f=(l=i.viewer.child)==null?void 0:l.getPageLinkAlias(r.page),p=this.lib.generateMarkdownLink(i.file,"",d,f).slice(1);navigator.clipboard.writeText(p),new ot.Notice(`${this.plugin.manifest.name}: Link copied to clipboard`),this.plugin.lastCopiedDestInfo={file:i.file,destArray:h}}return!0}showOutline(e){var o;let i=this.lib.getObsidianViewer(!0);if(!i)return!1;let r=(o=i.dom)==null?void 0:o.containerEl;if(!i.isEmbed||r&&r.contains(r.doc.activeElement)){let s=i==null?void 0:i.pdfSidebar;if(s)return s.haveOutline?s.isOpen&&s.active===2?this.settings.closeSidebarWithShowCommandIfExist?(e||s.close(),!0):!1:(e||s.switchView(2,!0),!0):!1}return this.settings.executeBuiltinCommandForOutline&&this.app.internalPlugins.plugins.outline.enabled?(e||this.app.commands.executeCommandById("outline:open"),!0):!1}showThumbnail(e){var r;let i=(r=this.lib.getObsidianViewer(!0))==null?void 0:r.pdfSidebar;return i?i.isOpen&&i.active===1?this.settings.closeSidebarWithShowCommandIfExist?(e||i.close(),!0):!1:(e||i.switchView(1,!0),!0):!1}closeSidebar(e){var r;let i=(r=this.lib.getObsidianViewer(!0))==null?void 0:r.pdfSidebar;return!i||!i.isOpen?!1:(e||i.close(),!0)}setScaleValue(e,i){let r=this.lib.getPDFViewer(!0);return r?(e||(r.currentScaleValue=i),!0):!1}zoom(e,i){var s;let r=this.lib.getObsidianViewer(!0);if(!r)return!1;let o=(s=r.dom)==null?void 0:s.containerEl;if((!r.isEmbed||o&&o.contains(o.doc.activeElement))&&r)return e||(i?r.zoomIn():r.zoomOut()),!0;if(this.settings.executeFontSizeAdjusterCommand){let a=i?"font-size:increment-font-size":"font-size:decrement-font-size";if(this.app.commands.findCommand(a))return e||this.app.commands.executeCommandById(a),!0}if(this.settings.executeBuiltinCommandForZoom){let a=i?"window:zoom-in":"window:zoom-out";return this.app.commands.findCommand(a)?(e||this.app.commands.executeCommandById(a),!0):!1}return!1}toggleAdaptToTheme(e,i){let r=this.lib.getPDFViewerChild(!0);if(!r)return!1;let o=!!this.app.loadLocalStorage("pdfjs-is-themed");return typeof i=="boolean"&&(i&&o||!i&&!o)?!1:(i=i!=null?i:!o,e||(this.app.saveLocalStorage("pdfjs-is-themed",i?"true":null),r.onCSSChange()),!0)}focusAndSelectPageNumberEl(e){let i=this.lib.getToolbar(!0);return i?(e||(i.pageInputEl.focus(),i.pageInputEl.select()),!0):!1}showCopyFormatMenu(e){let i=this.lib.getColorPalette();return!i||!i.actionMenuEl?!1:(e||i.actionMenuEl.click(),!0)}showDisplayTextFormatMenu(e){let i=this.lib.getColorPalette();return!i||!i.displayTextFormatMenuEl?!1:(e||i.displayTextFormatMenuEl.click(),!0)}setWriteFile(e,i){let r=this.lib.getColorPalette();return!r||!this.lib.isEditable(r.child)||r.writeFile===i?!1:(e||r.setWriteFile(i),!0)}toggleAutoFocus(){this.plugin.toggleAutoFocus()}toggleAutoPaste(){this.plugin.toggleAutoPaste()}addPage(e){let i=this.lib.getPDFViewerChild(!0);if(!i||!this.lib.isEditable(i))return!1;let r=i.file;return r?(e||this.lib.composer.addPage(r),!0):!1}insertPage(e,i){let r=this.lib.workspace.getActivePDFView();if(!r||!r.file)return!1;let o=r.file,s=r.viewer.child;if(!s||!this.lib.isEditable(s))return!1;let a=r.getState().page,c=a+(i?0:1);return e||this._insertPage(o,c,a),!0}_insertPage(e,i,r){new Nn(this.plugin,this.settings.askPageLabelUpdateWhenInsertPage,this.settings.pageLabelUpdateWhenInsertPage,!1,!1).ask().then(o=>{this.lib.composer.insertPage(e,i,r,o)})}deletePage(e){let i=this.lib.workspace.getActivePDFView();if(!i||!i.file)return!1;let r=i.file,o=i.viewer.child;if(!o||!this.lib.isEditable(o))return!1;let s=i.getState().page;return e||this._deletePage(r,s),!0}_deletePage(e,i){new hh(e,i,this.plugin).openIfNeccessary().then(()=>{new Nn(this.plugin,this.settings.askPageLabelUpdateWhenDeletePage,this.settings.pageLabelUpdateWhenDeletePage,!1,!1).ask().then(r=>{this.lib.composer.removePage(e,i,r)})})}extractThisPage(e){let i=this.lib.workspace.getActivePDFView();if(!i)return!1;let r=i.file;if(!r)return!1;let o=i.viewer.child;if(!o||!this.lib.isEditable(o))return!1;if(!e){let s=i.getState().page;this._extractPage(r,s)}return!0}_extractPage(e,i){let r=this.lib.getAvailablePathForCopy(e);new Nn(this.plugin,this.settings.askPageLabelUpdateWhenExtractPage,this.settings.pageLabelUpdateWhenExtractPage,this.settings.askExtractPageInPlace,this.settings.extractPageInPlace).ask().then((o,s)=>{this.lib.composer.extractPages(e,[i],r,!1,o,s).then(async a=>{if(!a){new ot.Notice(`${this.plugin.manifest.name}: Failed to extract page.`);return}if(this.settings.openAfterExtractPages){let c=this.lib.workspace.getLeaf(this.settings.howToOpenExtractedPDF);await c.openFile(a),await this.lib.workspace.revealLeaf(c)}})})}dividePDF(e){let i=this.lib.workspace.getActivePDFView();if(!i)return!1;let r=i.file;if(!r)return!1;let o=i.viewer.child;if(!o||!this.lib.isEditable(o))return!1;if(!e){let s=i.getState().page;this._dividePDF(r,s)}return!0}_dividePDF(e,i){let r=this.lib.getAvailablePathForCopy(e);new Nn(this.plugin,this.settings.askPageLabelUpdateWhenExtractPage,this.settings.pageLabelUpdateWhenExtractPage,this.settings.askExtractPageInPlace,this.settings.extractPageInPlace).ask().then((o,s)=>{this.lib.composer.extractPages(e,{from:i},r,!1,o,s).then(async a=>{if(!a){new ot.Notice(`${this.plugin.manifest.name}: Failed to divide PDF.`);return}if(this.settings.openAfterExtractPages){let c=this.lib.workspace.getLeaf(this.settings.howToOpenExtractedPDF);await c.openFile(a),await this.lib.workspace.revealLeaf(c)}})})}createPDF(){var a,c,l;let e=this.app.workspace.getActiveFile(),i=this.settings.newPDFLocation,r=i==="root"?"/":i=="current"?(c=(a=e==null?void 0:e.parent)==null?void 0:a.path)!=null?c:"":(0,ot.normalizePath)(this.settings.newPDFFolderPath),o=(l=this.app.vault.getAbstractFileByPath(r))!=null?l:this.app.vault.getRoot(),s=this.app.vault.getAvailablePath((0,ot.normalizePath)(o.path+"/Untitled"),"pdf");new uh(this.plugin).askOptions().then(async d=>{let h=await this.app.vault.createBinary(s,await d.save());await this.app.workspace.getLeaf("tab").openFile(h)})}editPageLabels(e){let i=this.lib.workspace.getActivePDFView();if(!i||!i.viewer.child||!this.lib.isEditable(i.viewer.child))return!1;let r=i.file;return r?(e||new mh(this.plugin,r).open(),!0):!1}copyOutline(e,i){let r=this.lib.getPDFViewerChild(!0),o=r==null?void 0:r.file;if(!r||!o||!r.pdfViewer.pdfSidebar.haveOutline)return!1;if(!e){let a=i==="list"?this.settings.copyOutlineAsListFormat:this.settings.copyOutlineAsHeadingsFormat,c=i==="list"?this.settings.copyOutlineAsListDisplayTextFormat:this.settings.copyOutlineAsHeadingsDisplayTextFormat,l=this.settings.copyOutlineAsHeadingsMinLevel;(async()=>{let d=await Te.fromFile(o,this.plugin),h="",u=this.app.vault.getConfig("useTab"),f=this.app.vault.getConfig("tabSize"),p=u?" ":" ".repeat(f);await d.iterAsync({enter:async g=>{var m;if(!g.isRoot()){let b=null,w=g.getExplicitDestination();w&&(b=await this.lib.destArrayToSubpath(w));let F=b?(m=Ln(b))==null?void 0:m.page:void 0,v=b&&F!==void 0?this.lib.copyLink.getTextToCopy(r,a,c,o,F,b,g.title,"",""):g.title;i==="list"?h+=`${p.repeat(g.depth-1)}- ${v} +`:i==="heading"&&(h+="#".repeat(g.depth+l-1)+` ${v} +`)}}}),navigator.clipboard.writeText(h),new ot.Notice(`${this.plugin.manifest.name}: Outline copied to clipboard.`)})()}return!0}addOutlineItem(e){let i=this.lib.workspace.getActivePDFView(),r=i==null?void 0:i.file,o=i==null?void 0:i.viewer.child;if(!i||!r||!o||!this.lib.isEditable(o))return!1;let s=i.getState(),a=this.lib.viewStateToDestArray(s,!0);return a?(e||new Fr(this.plugin,"Add to outline").ask().then(async({title:c})=>{let l=await Te.fromFile(r,this.plugin),d=l.doc;l.ensureRoot().createChild(c,a).updateCountForAllAncestors(),l.ensureRoot().sortChildren(),await this.app.vault.modifyBinary(r,await d.save())}),!0):!1}async createNewNote(){var h;let e=this.app.workspace.getActiveFile(),i=(h=e==null?void 0:e.path)!=null?h:"",r=this.app.fileManager.getNewFileParent(i),o="",s="";if(e&&e.extension==="pdf"){let u=new Vc(this.plugin,{file:e,folder:e.parent,app:this.app}),f=this.settings.newFileNameFormat;f&&(o=u.evalTemplate(f));let p=this.settings.newFileTemplatePath;if(p){let g=this.app.vault.getAbstractFileByPath(p);g instanceof ot.TFile&&(s=await this.app.vault.read(g),s=u.evalTemplate(s))}}let a=await this.app.fileManager.createNewMarkdownFile(r,o,s||void 0),c=async()=>{let{leaf:u,isExistingLeaf:f}=await this.lib.copyLink.prepareMarkdownLeafForPaste(a);if(u){await this.lib.workspace.revealLeaf(u),this.app.workspace.setActiveLeaf(u);let p=u.view;if(p instanceof ot.MarkdownView){let g=p.editor;g.focus(),f||g.exec("goEnd")}}};if(this.settings.howToOpenAutoFocusTargetIfNotOpened!=="hover-editor"){await c();return}let d=this.app.metadataCache.on("resolve",async u=>{u===a&&(this.app.metadataCache.offref(d),setTimeout(()=>c(),100))})}extractHighlightedText(e){let i=this.lib.getPDFViewerChild();if(!i)return!1;let r=i.file;if(!r)return!1;if(!e){let o=this.lib.getColorPaletteFromChild(i),s=o?this.settings.copyCommands[o.actionIndex].template:this.settings.copyCommands[this.settings.defaultColorPaletteActionIndex].template,a="";(async()=>{var d;let c=(d=this.lib.getPDFDocument(!0))!=null?d:await this.lib.loadPDFDocument(r);(await this.lib.highlight.extract.getAnnotatedTextsInDocument(c)).forEach((h,u)=>{h.forEach(({text:f,rgb:p,comment:g},m)=>{a&&(a=a.trimEnd()+` + +`);let b=p?`${p.r},${p.g},${p.b}`:"";a+=this.lib.copyLink.getTextToCopy(i,s,void 0,r,u,`#page=${u}&annotation=${m}`,f,b,void 0,g)})}),navigator.clipboard.writeText(a),new ot.Notice(`${this.plugin.manifest.name}: Highlighted text copied to clipboard.`)})()}return!0}copyDebugInfo(){var s;let e=Object.assign({},this.settings,{author:"*".repeat(this.settings.author.length)}),i=(s=this.app.plugins.plugins["obsidian-style-settings"])==null?void 0:s.settingsManager.settings,r=i?Object.fromEntries(Object.entries(i).filter(([a])=>a.startsWith("pdf-plus@@"))):null,o=this.plugin.domManager.styleEl.textContent;navigator.clipboard.writeText(JSON.stringify({settings:e,styleSettings:r,styleSheet:o},null,4)),new ot.Notice(`${this.plugin.manifest.name}: Debug info copied to clipboard.`)}loadDebugInfo(e){return this.plugin.isDebugMode?(e||(async()=>{try{let{settings:i,styleSettings:r,styleSheet:o}=JSON.parse(await navigator.clipboard.readText());new ot.Notice(`${this.plugin.manifest.name}: Debug info loaded from clipboard.`),console.debug("Loaded debug info:"),console.debug("- settings:",i),console.debug("- styleSettings:",r),console.debug("- styleSheet:",o),window.pdfPlusDebugInfo={settings:i,styleSettings:r,styleSheet:o},this.plugin.settings=i;let s=this.app.setting.pluginTabs.find(a=>a.id===this.plugin.manifest.id);s&&await s.hide()}catch(i){new ot.Notice(`${this.plugin.manifest.name}: Debug info not found in clipboard.`)}})(),!0):!1}importExternalFileIntoVault(e){let i=this.lib.getPDFViewerChild(!0);return!i||!i.isFileExternal||!i.palette?!1:(e||i.palette.importFile(),!0)}openExternalSource(e){let i=this.lib.getPDFViewerChild(!0),r=i==null?void 0:i.file;return!i||!i.isFileExternal||!r?!1:(e||(async()=>{let o=(await this.app.vault.read(r)).trim();window.open(o,"_blank")})(),!0)}createDummyForExternalPDF(){new Bo(this.plugin).open()}showContextMenu(e){let i=this.lib.getPDFViewerChild(!0);if(!i)return!1;let o=i.containerEl.doc.getSelection();return!o||!o.focusNode||o.isCollapsed?!1:(e||Dh(this.plugin,i,o),!0)}};var zt=require("obsidian");var Gh=class extends ye{constructor(...e){super(...e);this.fileOperator=new vg(this.plugin),this.linkUpdater=new Fg(this.plugin)}isEnabled(){return this.settings.enablePDFEdit}async addPage(e){return await this.linkUpdater.updateLinks(()=>this.fileOperator.addPage(e),[e],(i,r)=>({}))}async insertPage(e,i,r,o){return await this.linkUpdater.updateLinks(()=>this.fileOperator.insertPage(e,i,r,o),[e],(s,a)=>({pageNumber:typeof a=="number"&&a>=i?a+1:a}))}async removePage(e,i,r){return await this.linkUpdater.updateLinks(()=>this.fileOperator.removePage(e,i,r),[e],(o,s)=>({pageNumber:typeof s=="number"&&s>i?s-1:s}))}async mergeFiles(e,i,r){let o=(await this.fileOperator.read(e)).getPageCount();return await this.linkUpdater.updateLinks(()=>this.fileOperator.mergeFiles(e,i,r),[e,i],(s,a)=>s===e?{}:{file:e,pageNumber:typeof a=="number"?a+o:a})}async extractPages(e,i,r,o,s,a){let c;return Array.isArray(i)?c=i:(i.from===void 0&&(i.from=1),i.to===void 0&&(i.to=(await this.fileOperator.read(e)).getPageCount()),c=Ap(i.from,i.to+1)),await this.linkUpdater.updateLinks(()=>this.fileOperator.extractPages(e,c,r,o,s,a),[e],(l,d)=>{if(d===void 0)return{};if(c.includes(d))return{file:r,pageNumber:c.filter(h=>h<=d).length};if(a){let h=c.filter(u=>u0?{pageNumber:d-h}:{}}return{}})}},vg=class extends ye{constructor(...e){super(...e);this.pageLabelUpdater=new Pg(this.plugin)}async read(e){return await this.lib.loadPdfLibDocument(e)}async write(e,i,r){let o=await i.save(),s=this.app.vault.getAbstractFileByPath(e);if(s instanceof zt.TFile)return r||new zt.Notice(`${this.plugin.manifest.name}: File already exists: ${e}`),await this.app.vault.modifyBinary(s,o),s;if(s===null){let a=(0,zt.normalizePath)(e.split("/").slice(0,-1).join("/"));return a&&(this.app.vault.getAbstractFileByPath(a)||await this.app.vault.createFolder(a)),await this.app.vault.createBinary(e,o)}return null}async addPage(e){let i=await this.read(e),r=i.getPage(i.getPageCount()-1),{width:o,height:s}=r.getSize();return i.addPage([o,s]),await this.write(e.path,i,!0)}async insertPage(e,i,r,o){let s=await this.read(e);this.pageLabelUpdater.insertPage(s,i,o);let a=s.getPage(r-1),{width:c,height:l}=a.getSize();return s.insertPage(i-1,[c,l]),await this.write(e.path,s,!0)}async removePage(e,i,r){let o=await this.read(e);return this.pageLabelUpdater.removePage(o,i,r),o.removePage(i-1),await(await Te.fromDocument(o,this.plugin)).prune(),await this.write(e.path,o,!0)}async mergeFiles(e,i,r){let[o,s]=await Promise.all([this.read(e),this.read(i)]);this.pageLabelUpdater.mergeFiles(o,s,r);let a=await o.copyPages(s,s.getPageIndices());for(let l of a)o.addPage(l);let c=await this.write(e.path,o,!0);return c===null?null:(await this.app.fileManager.trashFile(i),c)}async extractPages(e,i,r,o,s,a){if(i.length===0)throw new Error("No pages to extract");return a?await this.extractPagesInPlace(e,i,r,o,s):await this.extractPagesAsNewFile(e,i,r,o,s)}async extractPagesInPlace(e,i,r,o,s){let[a,c]=await Promise.all([this.read(e),this.read(e)]),l=[];for(let u=1;u<=a.getPageCount();u++)i.includes(u)||l.push(u);this.pageLabelUpdater.removePages(a,i,s),this.pageLabelUpdater.removePages(c,l,s);for(let u=a.getPageCount();u>=1;u--)i.includes(u)?a.removePage(u-1):c.removePage(u-1);await Promise.all([a,c].map(async u=>{await(await Te.fromDocument(u,this.plugin)).prune()}));let[d,h]=await Promise.all([this.write(e.path,a,!0),this.write(r,c,o)]);return h}async extractPagesAsNewFile(e,i,r,o,s){let a=await this.read(e),c=[];for(let d=1;d<=a.getPageCount();d++)i.includes(d)||c.push(d);this.pageLabelUpdater.removePages(a,c,s);for(let d of c.sort((h,u)=>u-h))a.removePage(d-1);return await(await Te.fromDocument(a,this.plugin)).prune(),await this.write(r,a,o)}},Fg=class extends ye{async updateLinks(t,e,i){await this.lib.metadataCacheUpdatePromise;let r=new Map;for(let c of e){let l=this.app.metadataCache.getBacklinksForFile(c);for(let d of l.keys()){let h=l.get(d);for(let u of h!=null?h:[]){let f=this.getNewLinkText(u.link,d,c,i);if(typeof f!="string")continue;let p=this.getNewLink(u,f),g=u.position;r.has(d)||r.set(d,[]),r.get(d).push({position:g,newLink:p})}}}let o=await t();if(!o)return null;let s=[],a={files:0,links:0};for(let[c,l]of r){let d=this.app.vault.getAbstractFileByPath(c);d instanceof zt.TFile&&(l.sort((h,u)=>u.position.start.offset-h.position.start.offset),s.push(this.app.vault.process(d,h=>{for(let{position:u,newLink:f}of l)h=h.slice(0,u.start.offset)+f+h.slice(u.end.offset),a.links++;return h})),l.length>0&&a.files++)}return await Promise.all(s),a.links&&new zt.Notice(`${this.plugin.manifest.name}: Updated ${a.links} links in ${a.files} files.`),o}getNewLinkText(t,e,i,r){let{path:o,subpath:s}=(0,zt.parseLinktext)(t),a;s.startsWith("#")&&(s=s.slice(1));let c=new URLSearchParams(s),l=c.get("page");l!==null&&(a=+l);let{file:d,pageNumber:h}=r(i,a);if(d===void 0&&h===void 0)return;let u=o;if(d instanceof zt.TFile){let g=!this.app.vault.getConfig("useMarkdownLinks");u=this.app.metadataCache.fileToLinktext(d,e,g)}else typeof d=="string"&&(u=d);let f=s;if(typeof h=="number"){f="",c.set("page",""+h);for(let[g,m]of c)f+=`${g}=${m}&`;f.endsWith("&")&&(f=f.slice(0,-1))}return u+(f?"#"+f:"")}getNewDisplay(t){return t}getNewLink(t,e){let i=t.original,r=t.displayText,o=t.link,s=i.startsWith("!");s&&(i=i.slice(1));let a="";return i.startsWith("[[")&&i.endsWith("]]")?typeof r=="string"&&i===`[[${o}|${r}]]`?a=`[[${e}|${r}]]`:a=`[[${e}]]`:i.startsWith("[")&&i.endsWith(")")&&(a=`[${r!=null?r:""}](${yr(e)})`),s&&(a="!"+a),a}async updateLinkColor(t,e,i,r){r=Object.assign({linktext:!0,callout:!0},r);let o=this.app.vault.getAbstractFileByPath(e);if(!(o instanceof zt.TFile))return;let s=t.link,{path:a,subpath:c}=(0,zt.parseLinktext)(s),l=new URLSearchParams(c.startsWith("#")?c.slice(1):c);i&&r.linktext?l.set("color",i.type==="name"?i.name.toLowerCase():`${i.rgb.r},${i.rgb.g},${i.rgb.b}`):l.delete("color");let d="";for(let[f,p]of l.entries())d+=d?`&${f}=${p}`:`#${f}=${p}`;let h=a+d,u=this.getNewLink(t,h);if("position"in t){let f=t.position;await this.app.vault.process(o,p=>{var g,m;if(p=p.slice(0,f.start.offset)+u+p.slice(f.end.offset),r.callout){let w=((m=(g=this.app.metadataCache.getFileCache(o))==null?void 0:g.sections)!=null?m:[]).find(F=>F.position.start.offset<=f.start.offset&&f.end.offset<=F.position.end.offset);if(w&&w.type==="callout"){let F=p.split(/\r?\n/),v=w.position.start.line,P=F[v],k=new RegExp(`> *\\[\\! *${this.settings.calloutType} *(\\|(.*?))?\\]`,"i");F[v]=P.replace(k,`> [!${this.settings.calloutType}${i?`|${i.type==="name"?i.name.toLowerCase():`${i.rgb.r},${i.rgb.g},${i.rgb.b}`}`:""}]`),p=F.join(` +`)}}return p})}else{let f=t.key;await this.app.fileManager.processFrontMatter(o,p=>{p[f]=u})}}},Pg=class extends ye{addPage(t){}insertPage(t,e,i){vt.processDocument(t,r=>{if(i){r.divideRangeAtPage(e,!0).shiftRangesAfterPage(e,1).divideRangeAtPage(e,!1,o=>{delete o.prefix,delete o.style});return}r.shiftRangesAfterPage(e,1)})}removePage(t,e,i){this.removePages(t,[e],i)}removePages(t,e,i){vt.processDocument(t,r=>{e.sort((o,s)=>s-o).forEach(o=>{this.removePageFromLabels(r,o,i)})})}removePageFromLabels(t,e,i){if(i){t.divideRangeAtPage(e+1,!0).shiftRangesAfterPage(e+1,-1);return}t.shiftRangesAfterPage(e+1,-1)}mergeFiles(t,e,i){}};var oy=require("obsidian"),Wo=class extends oy.Component{constructor(e,i,r,o,s,a,c){super();this.plugin=e;this.ctx=i;this.file=r;this.subpath=o;this.pageNumber=s;this.rect=a;this.width=c;this.app=i.app,this.containerEl=i.containerEl,this.rect=window.pdfjsLib.Util.normalizeRect(a),this.containerEl.addClass("pdf-cropped-embed"),c&&this.containerEl.setAttribute("width",""+c)}get lib(){return this.plugin.lib}async loadFile(){let e=await this.lib.loadPDFDocument(this.file);this.register(()=>e.destroy());let i=await e.getPage(this.pageNumber),r=await this.lib.pdfPageToImageDataUrl(i,{type:"image/bmp",encoderOptions:1,cropRect:this.rect});await new Promise((o,s)=>{this.containerEl.empty(),this.containerEl.createEl("img",{attr:{src:r}},a=>{a.addEventListener("load",()=>o()),a.addEventListener("error",d=>s(d));let c=this.containerEl.getAttribute("width"),l=this.containerEl.getAttribute("height");c&&a.setAttribute("width",c),l&&a.setAttribute("height",l)}),activeWindow.setTimeout(()=>s(),5e3)})}};var Xh=class extends ye{get ttsPlugin(){var t;return(t=this.app.plugins.plugins["obsidian-tts"])!=null?t:null}isEnabled(){return!!this.ttsPlugin}async speak(t){var e;await((e=this.ttsPlugin)==null?void 0:e.say(t))}};var Un=require("obsidian");var Zh=class extends ye{async createDummyFilesInFolder(t,e){if(!!!this.app.vault.getFolderByPath(t))try{await this.app.vault.createFolder(t)}catch(r){return console.error(`${this.plugin.manifest.name}: Failed to create folder "${t}" due to the following error: `,r),[]}return await Promise.all(e.map(async r=>{let o=(0,Un.normalizePath)(t+"/"+r.split("/").pop().replace(/%20/g," "));o.endsWith(".pdf")&&(o=o.slice(0,-4));let s=this.app.vault.getAvailablePath(o,"pdf");try{return await this.app.vault.create(s,r)}catch(a){throw console.error(`${this.plugin.manifest.name}: Failed to create a dummy file "${s}" due to the following error: `,a),a}}))}async createDummyFilesFromObsidianUrl(t){let e=t["create-dummy"].replace(/^.*((https?)|(file):\/\/)/,"$1"),i=new Bo(this.plugin);if(i.source=e.startsWith("http")?"web":"file",i.uris=[e],"folder"in t){let r=t.folder;i.folderPath=(0,Un.normalizePath)(r),await i.createDummyFiles();let o=this.lib.workspace.getActivePDFView();o&&o.setEphemeralState({rename:"all"});return}i.open()}async createDummyFilesOnEditorDrop(t,e,i){if(t.defaultPrevented||!Tp(t,this.settings.modifierToDropExternalPDFToCreateDummy)||!t.dataTransfer)return;let r=this.getUrisFromDataTransfer(t.dataTransfer);if(r.length){t.preventDefault();let o=this.getFolderPathForDummyFiles(i.file),s=await this.createDummyFilesInFolder(o,r);new Un.Notice(`${this.plugin.manifest.name}: Dummy files created successfully.`),s.forEach((a,c)=>{var d,h;let l=this.app.fileManager.generateMarkdownLink(a,(h=(d=i.file)==null?void 0:d.path)!=null?h:"");cr.type==="application/pdf"))return i.map(r=>this.absolutePathToFileUri(r.path))}let e=t.getData("text/uri-list").split(`\r +`).filter(i=>!i.startsWith("#"));return e.length&&e.every(i=>this.isUriPdf(i))?e:[]}getFolderPathForDummyFiles(t){var i;let e=this.settings.dummyFileFolderPath||this.app.vault.getConfig("attachmentFolderPath");return e==="."||e.startsWith("./")?(0,Un.normalizePath)(((i=t==null?void 0:t.parent)!=null?i:this.app.vault.getRoot()).path+"/"+e.slice(1)):(0,Un.normalizePath)(e)}absolutePathToFileUri(t){return t=t.replace(/\\/g,"/").replace(/ /g,"%20"),"file://"+(t.startsWith("/")?"":"/")+t}isUriPdf(t){return this.settings.externalURIPatterns.map(e=>new RegExp(e)).some(e=>e.test(t))}};var Yh=class{constructor(t){this.PDFOutlines=Te;this.NameTree=aa;this.NumberTree=Pr;this.PDFNamedDestinations=Rn;this.PDFPageLabels=vt;this.utils=Kp;this.app=t.app,this.plugin=t,this.commands=new Kh(t),this.copyLink=new Nh(t),this.highlight=new qh(t),this.workspace=new Wh(t),this.composer=new Gh(t),this.dummyFileManager=new Zh(t),this.speech=new Xh(t)}registerPDFEvent(t,e,i,r){let o=async s=>{await r(s),i||e.off(t,o)};i==null||i.register(()=>e.off(t,o)),e.on(t,o)}onPageReady(t,e,i){var r;(r=t.pdfViewer)==null||r._pages.forEach((o,s)=>{i(s+1,o,!1)}),this.registerPDFEvent("pagerendered",t.eventBus,e,o=>{i(o.pageNumber,o.source,!0)})}onTextLayerReady(t,e,i){var r;(r=t.pdfViewer)==null||r._pages.forEach((o,s)=>{o.textLayer&&i(s+1,o,!1)}),this.registerPDFEvent("textlayerrendered",t.eventBus,e,o=>{i(o.pageNumber,o.source,!0)})}onAnnotationLayerReady(t,e,i){var r;(r=t.pdfViewer)==null||r._pages.forEach((o,s)=>{o.annotationLayer&&i(s+1,o,!1)}),this.registerPDFEvent("annotationlayerrendered",t.eventBus,e,o=>{i(o.pageNumber,o.source,!0)})}applyPDFViewStateToViewer(t,e){let i=()=>{typeof e.left=="number"&&typeof e.top=="number"&&typeof e.zoom=="number"?t.scrollPageIntoView({pageNumber:e.page,destArray:[e.page,{name:"XYZ"},e.left,e.top,e.zoom]}):t.currentPageNumber=e.page};t.pagesCount?i():this.registerPDFEvent("pagesloaded",t.eventBus,null,()=>i())}getPageElAssociatedWithNode(t){let e=t.instanceOf(HTMLElement)?t:t.parentElement;if(!e)return null;let i=e.closest(".page");return!i||!i.instanceOf(HTMLElement)?null:i}getPageElFromSelection(t){let e=t.rangeCount>0?t.getRangeAt(0):null;return e?this.getPageElAssociatedWithNode(e.startContainer):null}getPageElFromEvent(t){return nh(t,t.target)?this.getPageElAssociatedWithNode(t.target):null}getPageNumberFromEvent(t){let e=this.getPageElFromEvent(t),i=e==null?void 0:e.dataset.pageNumber;return i===void 0?null:+i}getToolbarAssociatedWithNode(t){let e=t.instanceOf(HTMLElement)?t:t.parentElement;if(!e)return null;let i=e.closest(".pdf-container"),r=i==null?void 0:i.previousElementSibling;return r&&r.hasClass("pdf-toolbar")?r:null}getToolbarAssociatedWithSelection(){let t=activeWindow.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0);return this.getToolbarAssociatedWithNode(e.startContainer)}return null}getColorPalette(){var e;let t=(e=this.getPDFViewerChild(!0))!=null?e:this.plugin.lastAnnotationPopupChild;return t?this.getColorPaletteFromChild(t):this.getColorPaletteAssociatedWithSelection()}getColorPaletteOptions(){let t=this.getColorPalette();if(t)return t.getState();let e=this.plugin.settings;return{selectedColorName:[null,...Object.keys(e.colors)][e.defaultColorPaletteItemIndex],actionIndex:e.defaultColorPaletteActionIndex,displayTextFormatIndex:e.defaultDisplayTextFormatIndex,writeFile:e.defaultWriteFileToggle}}getColorPaletteAssociatedWithNode(t){var r;let e=this.getToolbarAssociatedWithNode(t);if(!e)return null;let i=e.querySelector("."+Ft.CLS);return i&&(r=Ft.elInstanceMap.get(i))!=null?r:null}getColorPaletteAssociatedWithSelection(){let t=activeWindow.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0);return this.getColorPaletteAssociatedWithNode(e.startContainer)}return null}getColorPaletteFromChild(t){var i;let e=(i=t.pdfViewer.dom)==null?void 0:i.viewerEl;return e?this.getColorPaletteAssociatedWithNode(e):null}getColorPaletteContainedIn(t){for(let[e,i]of Ft.elInstanceMap)if(t.contains(e))return i;return null}getPDFViewerChildAssociatedWithNode(t){let e,i=t.instanceOf(HTMLElement)?t:t.parentElement;if(i){let r=i.closest(".pdf-viewer");r&&(e=this.plugin.pdfViewerChildren.get(r))}return e||this.workspace.iteratePDFViewerChild(r=>{!e&&r.containerEl.contains(t)&&(e=r)}),e!=null?e:null}async destIdToSubpath(t,e){let i=await e.getDestination(t);return i?this.pdfJsDestArrayToSubpath(i,e):null}async pdfJsDestArrayToSubpath(t,e){let i=await e.getPageIndex(t[0]);return this.destArrayToSubpath(this.normalizePDFJsDestArray(t,i+1))}normalizePDFJsDestArray(t,e){return[e-1,t[1].name,...t.slice(2)]}normalizePdfLibDestArray(t,e){let i=t.get(0);if(!(i instanceof q))return null;let r=e.getPages().findIndex(s=>s.ref===i);if(r===-1)return null;let o=t.get(1);return o instanceof x?[r,o.decodeText(),...t.asArray().slice(2).map(s=>s instanceof N?s.asNumber():null)]:null}async ensureDestArray(t,e){if(typeof t=="string"){let i=await e.getDestination(t);if(!i)return null;t=this.normalizePDFJsDestArray(i,await e.getPageIndex(i[0])+1)}return t}async destToPageNumber(t,e){if(typeof t=="string"){let i=await e.getDestination(t);return i?await e.getPageIndex(i[0])+1:null}return t[0]+1}destArrayToSubpath(t){var a;let e=t[0],i="",r="",o="";return t[1]==="XYZ"?(typeof t[2]=="number"&&(r+=Math.round(t[2])),typeof t[3]=="number"&&(i+=Math.round(t[3])),o=""+Math.round(((a=t[4])!=null?a:0)*100)/100):t[1]==="FitBH"&&typeof t[2]=="number"&&(i+=t[2]),`#page=${e+1}&offset=${r},${i},${o}`}viewStateToSubpath(t,e=!1){var i;if(typeof t.left=="number"&&typeof t.top=="number"){let r=`#page=${t.page}`;return e?r+=`&offset=,${t.top},`:r+=`&offset=${t.left},${t.top},${(i=t.zoom)!=null?i:0}`,r}return null}viewStateToDestArray(t,e=!1){var i;return typeof t.left=="number"&&typeof t.top=="number"?e?[t.page-1,"FitBH",t.top]:[t.page-1,"XYZ",t.left,t.top,(i=t.zoom)!=null?i:0]:null}getPageLabelTree(t){let e=tt(t.catalog,"PageLabels");return e instanceof R?new Pr(e):null}getAnnotationInfoFromAnnotationElement(t){return{page:t.parent.page.pageNumber,id:t.data.id}}getAnnotationInfoFromPopupEl(t){if(!t.matches(".popupWrapper[data-annotation-id]"))return null;let e=t.closest("div.page");if(!e||e.dataset.pageNumber===void 0)return null;let i=+e.dataset.pageNumber,r=t.dataset.annotationId;return r===void 0?null:{page:i,id:r}}registerGlobalDomEvent(t,e,i,r){t.registerDomEvent(document,e,i,r),this.app.workspace.onLayoutReady(()=>{let o=new Set;this.app.workspace.iterateAllLeaves(s=>{let a=s.getContainer().win;a!==window&&o.add(a)}),o.forEach(s=>{t.registerDomEvent(s.document,e,i,r)}),t.registerEvent(this.app.workspace.on("window-open",(s,a)=>{t.registerDomEvent(a.document,e,i,r)}))})}generateMarkdownLink(t,e,i,r){let o=this.app,s=o.vault.getConfig("useMarkdownLinks"),a=!s,l=o.metadataCache.fileToLinktext(t,e,a)+(i||"");t.path===e&&i&&(l=i);let d;return s?d="[".concat(r||t.basename,"](").concat(yr(l),")"):(r&&r.toLowerCase()===l.toLowerCase()&&(l=r,r=void 0),d=r?"[[".concat(l,"|").concat(r,"]]"):"[[".concat(l,"]]")),t.extension!=="md"?"!"+d:d}getBacklinkIndexForFile(t){return new ca(this.plugin,t)}async getLatestBacklinkIndexForFile(t){let e=this.getBacklinkIndexForFile(t);return await this.metadataCacheUpdatePromise,e.init(),e}async getLatestBacklinksForAnnotation(t,e,i){return(await this.getLatestBacklinkIndexForFile(t)).getPageIndex(e).annotations.get(i)}isBacklinked(t,e){if(e){let{page:c,selection:l,annotation:d}=e;if(isNaN(c)||c<1)throw new Error("Invalid page number");if(l&&(l.length!==4||l.some(h=>isNaN(h))))throw new Error("Invalid selection");if(l&&typeof d=="string")throw new Error("Selection and annotation cannot be used together")}let i=!e,r=e&&!e.selection&&!e.annotation,o=e&&!!e.selection,s=typeof(e==null?void 0:e.annotation)=="string",a=this.app.metadataCache.getBacklinksForFile(t);if(i)return a.count()>0;for(let c of a.keys()){let l=a.get(c);if(l)for(let d of l){let{subpath:h}=(0,ge.parseLinktext)(d.link),u=Ln(h);if(u&&(r&&u.page===e.page||o&&"beginIndex"in u&&u.page===e.page&&u.beginIndex===e.selection[0]&&u.beginOffset===e.selection[1]&&u.endIndex===e.selection[2]&&u.endOffset===e.selection[3]||s&&"annotation"in u&&u.page===e.page&&u.annotation===e.annotation))return!0}}return!1}getPDFView(t=!1){let e=this.workspace.getActivePDFView();if(e)return e;if(!t){let i;if(this.app.workspace.iterateAllLeaves(r=>{this.isPDFView(r.view)&&(i=r.view)}),i)return i}return null}getPDFEmbedInMarkdownView(t){let i=t.currentMode._children.find(r=>this.isPDFEmbed(r));return i!=null?i:null}getAllPDFEmbedInMarkdownView(t){return t.currentMode._children.filter(i=>this.isPDFEmbed(i))}getPDFEmbedInCanvasView(t){var i;let e=Array.from(t.canvas.nodes.values()).find(r=>this.isCanvasPDFNode(r));return(i=e==null?void 0:e.child)!=null?i:null}getAllPDFEmbedInCanvasView(t){return Array.from(t.canvas.nodes.values()).filter(e=>this.isCanvasPDFNode(e)).map(e=>e.child)}getPDFEmbedInActiveView(){let t=this.app.workspace.getActiveViewOfType(ge.MarkdownView);if(t){let i=this.getPDFEmbedInMarkdownView(t);if(i)return i}let e=this.workspace.getActiveCanvasView();if(e){let i=this.getPDFEmbedInCanvasView(e);if(i)return i}return null}getPDFEmbed(t=!1){let e=this.getPDFEmbedInActiveView();if(e)return e;if(!t){let i=null;if(this.app.workspace.iterateAllLeaves(r=>{if(i)return;let o=r.view;o instanceof ge.MarkdownView?i=this.getPDFEmbedInMarkdownView(o):this.isCanvasView(o)&&(i=this.getPDFEmbedInCanvasView(o))}),i)return i}return null}getPDFViewerComponent(t=!1){var e,i;return(i=(e=this.getPDFView(t))!=null?e:this.getPDFEmbed())==null?void 0:i.viewer}getPDFViewerChild(t=!1){var e;return(e=this.getPDFViewerComponent(t))==null?void 0:e.child}getObsidianViewer(t=!1){var e;return(e=this.getPDFViewerChild(t))==null?void 0:e.pdfViewer}getPDFViewer(t=!1){var e;return(e=this.getObsidianViewer(t))==null?void 0:e.pdfViewer}getToolbar(t=!1){var e;return(e=this.getPDFViewerChild(t))==null?void 0:e.toolbar}getPage(t=!1){let e=this.getPDFViewer(t);return e?e.getPageView(e.currentPageNumber-1):null}getAnnotation(t){var e,i;return(i=(e=this.getPage(!0))==null?void 0:e.annotationLayer)==null?void 0:i.annotationLayer.getAnnotation(t)}getTextContentItems(){var t,e;return(e=(t=this.getPage(!0))==null?void 0:t.textLayer)==null?void 0:e.textContentItems}getPDFDocument(t=!1){var e;return(e=this.getPDFViewer(t))==null?void 0:e.pdfDocument}getBacklinkVisualizer(t=!1){var e;return(e=this.getPDFViewerComponent(t))==null?void 0:e.visualizer}getBibliographyManager(t=!1){var e;return(e=this.getPDFViewerChild(t))==null?void 0:e.bib}getVim(t=!1){var e;return(e=this.getPDFViewerComponent(t))==null?void 0:e.vim}search(t,e,i,r){t.showSearch(),t.searchComponent.setValue(e),Object.assign(t.searchSettings,i),t.dispatchEvent("",r),this.updateSearchSettingsUI(t)}updateSearchSettingsUI(t){let e=t.settingsEl.querySelectorAll("div.checkbox-container"),i=e[0],r=e[1],o=e[2],s=t.searchComponent.containerEl.querySelector(".input-right-decorator.clickable-icon");i&&i.toggleClass("is-enabled",t.searchSettings.highlightAll),r&&r.toggleClass("is-enabled",t.searchSettings.matchDiacritics),o&&o.toggleClass("is-enabled",t.searchSettings.entireWord),s&&s.toggleClass("is-active",t.searchSettings.caseSensitive)}async getExternalPDFUrl(t){if(t.stat.size>300)return null;let e=(await this.app.vault.read(t)).trim();if(e.startsWith("https://")||e.startsWith("http://")){let i=await(0,ge.requestUrl)(e);if(i.status===200)return URL.createObjectURL(new Blob([i.arrayBuffer],{type:"application/pdf"}))}else if(e.startsWith("file:///"))return ge.Platform.resourcePathPrefix+e.substring(8);return null}async loadPDFDocument(t){let e=await this.getExternalPDFUrl(t);if(e)return await this.loadPDFDocumentFromArrayBufferOrUrl({url:e});let i=await this.app.vault.readBinary(t);return await this.loadPDFDocumentFromArrayBufferOrUrl({data:i})}async loadPDFDocumentFromArrayBuffer(t){return await this.loadPDFDocumentFromArrayBufferOrUrl({data:t})}async loadPDFDocumentFromArrayBufferOrUrl(t){return await window.pdfjsLib.getDocument({...t,cMapPacked:!0,cMapUrl:"/lib/pdfjs/cmaps/",standardFontDataUrl:"/lib/pdfjs/standard_fonts/"}).promise}async loadPdfLibDocument(t,e=!1){let i=await this.app.vault.readBinary(t);return await this.loadPdfLibDocumentFromArrayBuffer(i)}async loadPdfLibDocumentFromArrayBuffer(t,e=!1){try{return await pe.load(t,{ignoreEncryption:e||this.plugin.settings.enableEditEncryptedPDF})}catch(i){throw i instanceof ko&&!this.plugin.settings.enableEditEncryptedPDF&&new ge.Notice(`${this.plugin.manifest.name}: The PDF file is encrypted. Please consider enabling "Enable editing encrypted PDF files" in the plugin settings.`),i}}async getPdfLibDocument(t=!1){let e=this.getPDFDocument(t);if(e)return await this.loadPdfLibDocumentFromArrayBuffer(await e.getData())}async getPdfLibPage(t=!1){let e=this.getPDFViewer(t);if(!e)return;let i=e.currentPageNumber;if(i===void 0)return;let r=await this.loadPdfLibDocumentFromArrayBuffer(await e.pdfDocument.getData());if(r)return r.getPage(i-1)}async getPDFOutlines(){let t=await this.getPdfLibDocument();if(t)return new Te(this.plugin,t)}getPDFViewFromChild(t){let e=null;return this.workspace.iteratePDFViews(i=>{i.viewer.child===t&&(e=i)}),e}isPDFView(t){return this.plugin.classes.PDFView?t instanceof this.plugin.classes.PDFView:t instanceof ge.EditableFileView&&t.getViewType()==="pdf"}isPDFEmbed(t){var e;return"loadFile"in t&&"file"in t&&"containerEl"in t&&t.file instanceof ge.TFile&&t.file.extension==="pdf"&&t.containerEl.instanceOf(HTMLElement)&&((e=t.containerEl)==null?void 0:e.matches(".pdf-embed"))&&t instanceof ge.Component&&!(t instanceof Wo)}isCanvasView(t){return t instanceof ge.TextFileView&&t.getViewType()==="canvas"&&"canvas"in t}isCanvasPDFNode(t){return!!("file"in t&&t.file instanceof ge.TFile&&t.file.extension==="pdf"&&t.child instanceof ge.Component&&this.isPDFEmbed(t.child))}isBacklinkView(t){return t instanceof ge.FileView&&t.getViewType()==="backlink"}getAvailablePathForCopy(t){return this.app.vault.getAvailablePath(Bp(t.path),t.extension)}get metadataCacheUpdatePromise(){return new Promise(t=>this.app.metadataCache.onCleanCache(t))}async renderPDFPageToCanvas(t,e){var c;let i=createEl("canvas"),r=i.getContext("2d"),o=t.getViewport({scale:1}),s=(c=e!=null?e:window.devicePixelRatio)!=null?c:1;i.width=Math.floor(o.width*s),i.height=Math.floor(o.height*s),i.setCssStyles({width:Math.floor(o.width)+"px",height:Math.floor(o.height)+"px"});let a=[s,0,0,s,0,0];return await t.render({canvasContext:r,transform:a,viewport:o}).promise,i}async pdfPageToImageDataUrl(t,e){let[i,r,o,s]=t.view,a=o-i,c=s-r,l=e==null?void 0:e.type,d=e==null?void 0:e.encoderOptions,h=e==null?void 0:e.resolution;typeof h!="number"&&(h=(ge.Platform.isDesktop?7:ge.Platform.isTablet?4:window.devicePixelRatio||1)*(this.plugin.settings.rectEmbedResolution/100));let u=e==null?void 0:e.cropRect,f=await this.renderPDFPageToCanvas(t,h);if(!u)return f.toDataURL(l,d);let p=th(f,360-t.rotate),g=p.width/a,m=p.height/c,b={left:(u[0]-i)*g,top:(r+c-u[3])*m,width:(u[2]-u[0])*g,height:(u[3]-u[1])*m};return th(Fp(p,b),t.rotate).toDataURL(l,d)}async pdfPageToImageArrayBuffer(t,e){var o;let r=(o=(await this.pdfPageToImageDataUrl(t,e)).match(/^data:image\/\w+;base64,(.*)/))==null?void 0:o[1];if(!r)throw new Error("Failed to convert data URL to base64");return(0,ge.base64ToArrayBuffer)(r)}getSelectedText(t,e,i,r,o){if(e===r)return this.toSingleLine(t[e].str.slice(i,o));let s=[];s.push(t[e].str.slice(i));for(let a=e+1;ae(i));return}t.pdfPlusCallbacksOnDocumentLoaded||(t.pdfPlusCallbacksOnDocumentLoaded=[]),t.pdfPlusCallbacksOnDocumentLoaded.push(e)}toSingleLine(t){return Lc(t,this.plugin.settings.removeWhitespaceBetweenCJChars)}async write(t,e,i){let r=this.app.vault.getAbstractFileByPath(t);if(r instanceof ge.TFile)return i||new ge.Notice(`${this.plugin.manifest.name}: File already exists: ${t}`),typeof e=="string"?await this.app.vault.modify(r,e):await this.app.vault.modifyBinary(r,e),r;if(r===null){let o=(0,ge.normalizePath)(t.split("/").slice(0,-1).join("/"));return o&&(this.app.vault.getAbstractFileByPath(o)||await this.app.vault.createFolder(o)),typeof e=="string"?await this.app.vault.create(t,e):await this.app.vault.createBinary(t,e)}return null}};var sy=require("obsidian");var Jh=class extends de{constructor(e){super(e);if(this.settings.autoCopyToggleRibbonIcon){let i=!1;this.iconEl=e.settings.autoCopyToggleRibbonIcon?e.addRibbonIcon(this.settings.autoCopyIconName,`${e.manifest.name}: Toggle auto-copy`,()=>{i||this.toggle()}):null,this.iconEl&&this.registerDomEvent(this.iconEl,"contextmenu",r=>{if(i)return;let o=new sy.Menu;o.addItem(s=>{s.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("auto-copy")})}),o.onHide(()=>{i=!1}),o.showAtMouseEvent(r),i=!0})}}toggle(e){e=e!=null?e:!this.settings.autoCopy,e?this.enable():this.disable()}enable(){this.settings.autoCopy=!0,this.plugin.saveSettings(),this.load()}disable(){this.settings.autoCopy=!1,this.plugin.saveSettings(),this.unload()}onload(){var e;(e=this.iconEl)==null||e.addClass("is-active")}onunload(){var e;(e=this.iconEl)==null||e.removeClass("is-active")}};var ay=require("obsidian");var Qh=class extends de{constructor(e){super(e);this.styleEl=e.registerEl(createEl("style",{attr:{id:"pdf-plus-style"}})),document.head.append(this.styleEl)}update(){this.unload(),this.plugin.removeChild(this),this.plugin.addChild(this)}registerEl(e){return this.register(()=>e.remove()),e}onload(){this.plugin.trigger("update-dom"),this.updateStyleEl(),this.updateClass("pdf-plus-click-embed-to-open-link",this.settings.dblclickEmbedToOpenLink),this.updateClass("pdf-plus-backlink-selection-highlight",this.settings.selectionBacklinkVisualizeStyle==="highlight"),this.updateClass("pdf-plus-backlink-selection-underline",this.settings.selectionBacklinkVisualizeStyle==="underline"),this.app.workspace.trigger("css-change")}updateClass(e,i){document.body.toggleClass(e,i),this.register(()=>document.body.removeClass(e))}updateStyleEl(){let e=this.plugin.settings;this.styleEl.textContent=Object.entries(e.colors).map(([o,s])=>Ki(s)?[`.pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight)[data-highlight-color="${o.toLowerCase()}"],`,`.pdf-embed[data-highlight-color="${o.toLowerCase()}"] .textLayer .mod-focused {`,` --pdf-plus-color: ${s};`,` --pdf-plus-backlink-icon-color: ${s};`,` --pdf-plus-rect-color: ${s};`,"}"].join(` +`):"").join(` +`);let i=e.colors[e.defaultColor];(!i||!Ki(i))&&(i="rgb(var(--text-highlight-bg-rgb))"),this.styleEl.textContent+=[` +.pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight) {`,` --pdf-plus-color: ${i};`,` --pdf-plus-backlink-icon-color: ${i};`,` --pdf-plus-rect-color: ${i};`,"}"].join(` +`);let r=e.colors[e.backlinkHoverColor];(!r||!Ki(r))&&(r=Cx),this.styleEl.textContent+=[` +.pdf-plus-backlink-highlight-layer .pdf-plus-backlink.hovered-highlight {`,` --pdf-plus-color: ${r};`,` --pdf-plus-backlink-icon-color: ${r};`,` --pdf-plus-rect-color: ${r};`,"}"].join(` +`);for(let[o,s]of Object.entries(e.colors))Ki(s)&&(this.styleEl.textContent+=[` +.${Ft.CLS}-item[data-highlight-color="${o.toLowerCase()}"] > .${Ft.CLS}-item-inner {`,` background-color: ${s};`,"}"].join(` +`));this.styleEl.textContent+=[` +.${Ft.CLS}-item:not([data-highlight-color]) > .${Ft.CLS}-item-inner {`," background-color: transparent;","}"].join(` +`),this.styleEl.textContent+=[` +.workspace-leaf.pdf-plus-link-opened.is-highlighted::before {`,` opacity: ${e.existingTabHighlightOpacity};`,"}"].join(` +`),this.setCSSColorVariables(),this.updateCalloutStyle()}updateCalloutStyle(){var r;if(!this.plugin.settings.useCallout)return;let e=this.plugin.settings.calloutType.toLowerCase();for(let o of Object.keys(this.plugin.settings.colors)){let s=(r=this.toCSSVariableName(o))!=null?r:"--pdf-plus-default-color-rgb";this.styleEl.textContent+=[` +.callout[data-callout="${e}"][data-callout-metadata="${o.toLowerCase()}"] {`,` --callout-color: var(${s});`," background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))","}"].join(` +`)}this.styleEl.textContent+=[` +.callout[data-callout="${e}"] {`," --callout-color: var(--pdf-plus-default-color-rgb);"," background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))","}"].join(` +`);let i=this.plugin.settings.calloutIcon;i?this.styleEl.textContent+=[` +.callout[data-callout="${e}"] {`,` --callout-icon: lucide-${i};`,"}"].join(` +`):this.styleEl.textContent+=[` +.callout[data-callout="${e}"] .callout-icon {`," display: none;","}"].join(` +`)}registerCalloutRenderer(){let e=this.plugin.settings.calloutType.toLowerCase();this.plugin.registerMarkdownPostProcessor((i,r)=>{for(let o of i.querySelectorAll(`.callout[data-callout="${e}"][data-callout-metadata*=","]`))r.addChild(new kg(o))})}setCSSColorVariables(){let e=this.plugin.settings;for(let[r,o]of Object.entries(e.colors)){let s=this.toCSSVariableName(r),a=mr(o);if(s!==null&&a!==null){let{r:c,g:l,b:d}=a;this.styleEl.textContent+=[` +body {`,` ${s}: ${c}, ${l}, ${d}`,"}"].join(` +`)}}let i=!1;if(e.defaultColor in e.colors){let r=this.toCSSVariableName(e.defaultColor);r!==null&&(this.styleEl.textContent+=[` +body {`,` --pdf-plus-default-color-rgb: var(${r})`,"}"].join(` +`),i=!0)}i||(this.styleEl.textContent+=[` +body {`," --pdf-plus-default-color-rgb: var(--text-highlight-bg-rgb)","}"].join(` +`))}toCSSVariableName(e){let i=e.toLowerCase().replace(/[^a-z0-9]+/g,"-");return i=i.replace(/^-+|-+$/g,""),i?"--pdf-plus-"+i+"-rgb":null}getRgb(e){let i="--pdf-plus-default-color-rgb";if(e){let s=this.toCSSVariableName(e);s&&(i=s)}let r=getComputedStyle(document.body).getPropertyValue(i);return wp(r)}},kg=class extends ay.MarkdownRenderChild{onload(){let t=this.containerEl.dataset.calloutMetadata;if(t){let e=t.split(",").map(r=>parseInt(r));e.length===3&&e.every(r=>0<=r&&r<=255)&&this.containerEl.style.setProperty("--callout-color",e.join(", "))}}};var _h=class extends De.Plugin{constructor(){super(...arguments);this.lib=new Yh(this);this.events=new De.Events;this.autoFocusToggleIconEl=null;this.autoPasteToggleIconEl=null;this.patchStatus={workspace:!1,pagePreview:!1,pdfView:!1,pdfInternals:!1,pdfOutlineViewer:!1,backlink:!1};this.classes={};this.lastPasteFile=null;this.lastActiveMarkdownFile=null;this.lastAnnotationPopupChild=null;this.lastCopiedDestInfo=null;this.vimrc=null;this.pdfViewerChildren=new Map;this.shownMenus=new Set;this.isDebugMode=!1}async onload(){this.checkVersion(),this.addIcons(),await(0,De.loadPdfJs)(),await this.loadSettings(),await this.saveSettings(),this.domManager=this.addChild(new Qh(this)),this.domManager.registerCalloutRenderer(),this.registerRibbonIcons(),this.patchObsidian(),this.registerPDFEmbedCreator(),this.registerHoverLinkSources(),this.registerCommands(),this.registerGlobalVariables(),this.registerEvents(),this.startTrackingActiveMarkdownFile(),this.registerObsidianProtocolHandler("pdf-plus",this.obsidianProtocolHandler.bind(this)),this.addSettingTab(this.settingTab=new Ph(this)),this.registerStyleSettings()}async onunload(){await this.cleanUpResources()}async cleanUpResources(){await this.cleanUpAnystyleFiles()}async cleanUpAnystyleFiles(){let e=this.app.vault.adapter;if(De.Platform.isDesktopApp&&e instanceof De.FileSystemAdapter){let i=this.getAnyStyleInputDir();if(i)try{await e.rmdir(i,!0)}catch(r){if(r.code!=="ENOENT")throw r}}}checkVersion(){let e="1.8.0";(0,De.requireApiVersion)(e)&&console.warn(`${this.manifest.name}: This plugin has not been tested on Obsidian ${e} or above. Please report any issue you encounter on GitHub (https://github.com/RyotaUshio/obsidian-pdf-plus/issues/new/choose).`),kr.openIfNecessary(this)}addIcons(){(0,De.addIcon)("vim",'VIM')}getDefaultSettings(){return structuredClone(Hn)}async restoreDefaultSettings(){this.settings=this.getDefaultSettings(),await this.saveSettings()}async loadSettings(){if(this.settings=Object.assign(this.getDefaultSettings(),await this.loadData()),!this.settings.anystylePath){let e=this.loadLocalStorage("anystylePath");typeof e=="string"&&(this.settings.anystylePath=e)}(this.settings.defaultDisplayTextFormatIndex<0||this.settings.defaultDisplayTextFormatIndex>=this.settings.displayTextFormats.length)&&(this.settings.defaultDisplayTextFormatIndex=0),(this.settings.defaultColorPaletteActionIndex<0||this.settings.defaultColorPaletteActionIndex>=this.settings.copyCommands.length)&&(this.settings.defaultColorPaletteActionIndex=0),this.validateAutoFocusAndAutoPasteSettings();for(let[e,i]of Object.entries(this.settings.colors))this.settings.colors[e]=i.toLowerCase();this.settings.paneTypeForFirstMDLeaf==="split"&&(this.settings.paneTypeForFirstMDLeaf="right");for(let e of this.settings.copyCommands)e.hasOwnProperty("format")&&(e.template=e.format,delete e.format);if(this.settings.hasOwnProperty("aliasFormat")&&(this.settings.displayTextFormats.push({name:"Custom",template:this.settings.aliasFormat}),delete this.settings.aliasFormat),this.settings.hasOwnProperty("showCopyLinkToSearchInContextMenu")){let e=this.settings.contextMenuConfig.find(({id:i})=>i==="search");e&&e.visible&&(e.visible=this.settings.showCopyLinkToSearchInContextMenu),delete this.settings.showCopyLinkToSearchInContextMenu}this.settings.showContextMenuOnMouseUpIf==="mod"&&(this.settings.showContextMenuOnMouseUpIf="Mod"),this.renameSetting("enalbeWriteHighlightToFile","enablePDFEdit"),this.renameSetting("selectToCopyToggleRibbonIcon","autoCopyToggleRibbonIcon"),this.renameCommand("pdf-plus:toggle-select-to-copy",`${this.manifest.id}:toggle-auto-copy`),this.renameSetting("removeWhitespaceBetweenCJKChars","removeWhitespaceBetweenCJChars"),this.loadContextMenuConfig()}renameSetting(e,i){this.settings.hasOwnProperty(e)&&(this.settings[i]=this.settings[e],delete this.settings[e])}renameCommand(e,i){let{hotkeyManager:r}=this.app,o=r.getHotkeys(e);o&&(r.removeHotkeys(e),r.setHotkeys(i,o))}loadContextMenuConfig(){let e=this.getDefaultSettings().contextMenuConfig,i=[];for(let r of e){let o=this.settings.contextMenuConfig.find(({id:s})=>s===r.id);i.push(o!=null?o:r)}this.settings.contextMenuConfig.length=0,this.settings.contextMenuConfig.push(...i)}validateAutoFocusAndAutoPasteSettings(){this.settings.autoFocus&&this.settings.autoPaste&&(this.settings.autoFocus=!1)}async saveSettings(){let e=Object.assign({},this.settings);this.saveLocalStorage("anystylePath",e.anystylePath),delete e.anystylePath,await this.saveData(e)}loadLocalStorage(e){return this.app.loadLocalStorage(this.manifest.id+"-"+e)}saveLocalStorage(e,i){this.app.saveLocalStorage(this.manifest.id+"-"+e,i)}registerStyleSettings(){this.app.workspace.trigger("parse-style-settings"),this.register(()=>this.app.workspace.trigger("parse-style-settings"))}registerRibbonIcons(){if(this.autoCopyMode=new Jh(this),this.autoCopyMode.toggle(this.settings.autoCopy),this.register(()=>this.autoCopyMode.unload()),this.settings.autoFocusToggleRibbonIcon){let e=!1;this.autoFocusToggleIconEl=this.addRibbonIcon(this.settings.autoFocusIconName,`${this.manifest.name}: Toggle auto-focus`,()=>{e||this.toggleAutoFocus()}),this.autoFocusToggleIconEl.toggleClass("is-active",this.settings.autoFocus),this.registerDomEvent(this.autoFocusToggleIconEl,"contextmenu",i=>{if(e)return;let r=new De.Menu;r.addItem(o=>{o.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.openSettingTab().scrollToHeading("auto-focus")})}),r.onHide(()=>{e=!1}),r.showAtMouseEvent(i),e=!0})}if(this.settings.autoPasteToggleRibbonIcon){let e=!1;this.autoPasteToggleIconEl=this.addRibbonIcon(this.settings.autoPasteIconName,`${this.manifest.name}: Toggle auto-paste`,()=>{e||this.toggleAutoPaste()}),this.autoPasteToggleIconEl.toggleClass("is-active",this.settings.autoPaste),this.registerDomEvent(this.autoPasteToggleIconEl,"contextmenu",i=>{if(e)return;let r=new De.Menu;r.addItem(o=>{o.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.openSettingTab().scrollToHeading("auto-paste")})}),r.onHide(()=>{e=!1}),r.showAtMouseEvent(i),e=!0})}}toggleAutoFocusRibbonIcon(e){let i=this.autoFocusToggleIconEl;i&&(e=e!=null?e:!i.hasClass("is-active"),i.toggleClass("is-active",e))}toggleAutoPasteRibbonIcon(e){let i=this.autoPasteToggleIconEl;i&&(e=e!=null?e:!i.hasClass("is-active"),i.toggleClass("is-active",e))}async toggleAutoFocus(e,i){e=e!=null?e:!this.settings.autoFocus,this.toggleAutoFocusRibbonIcon(e),this.settings.autoFocus=e,this.settings.autoFocus&&this.settings.autoPaste&&this.toggleAutoPaste(!1,!1),(i==null||i)&&await this.saveSettings()}async toggleAutoPaste(e,i){e=e!=null?e:!this.settings.autoPaste,this.toggleAutoPasteRibbonIcon(e),this.settings.autoPaste=e,this.settings.autoPaste&&this.settings.autoFocus&&this.toggleAutoFocus(!1,!1),(i==null||i)&&await this.saveSettings()}patchObsidian(){this.app.workspace.onLayoutReady(()=>{Yx(this),Qx(this),iy(this)}),this.tryPatchUntilSuccess(Xx),this.tryPatchUntilSuccess(Zx),this.tryPatchUntilSuccess($x),this.tryPatchUntilSuccess(ey)}tryPatchUntilSuccess(e,i){this.app.workspace.onLayoutReady(()=>{if(!e(this)){let o=i==null?void 0:i(),s=this.app.workspace.on("layout-change",()=>{e(this)&&(this.app.workspace.offref(s),o==null||o.hide())});this.registerEvent(s)}})}registerEl(e){return this.register(()=>e.remove()),e}loadStyle(){this.domManager.update()}registerPDFEmbedCreator(){let e=this.app.embedRegistry.embedByExtension.pdf;this.register(()=>{this.app.embedRegistry.unregisterExtension("pdf"),this.app.embedRegistry.registerExtension("pdf",e)}),this.app.embedRegistry.unregisterExtension("pdf"),this.app.embedRegistry.registerExtension("pdf",(i,r,o)=>{let s=ia(o),a=null;if(s.has("rect")&&s.has("page")){let c=parseInt(s.get("page")),l=s.get("rect").split(",").map(h=>parseFloat(h)),d=s.has("width")?parseFloat(s.get("width")):void 0;Number.isInteger(c)&&l.length===4&&(a=new Wo(this,i,r,o,c,l,d))}if(a||(a=e(i,r,o),this.classes.PDFEmbed||(this.classes.PDFEmbed=a.constructor),this.patchStatus.pdfInternals||pa(this,a.viewer)),this.registerDomEvent(a.containerEl,"dblclick",c=>{if(this.settings.dblclickEmbedToOpenLink&&wt(c,c.target)&&(c.target.closest(".pdf-embed[src] > .pdf-container")||c.target.closest(".pdf-cropped-embed"))){let l=r.path+o;this.app.workspace.openLinkText(l,"",De.Keymap.isModEvent(c)),c.preventDefault()}}),this.settings.embedUnscrollable)for(let c of["wheel","touchmove"])this.registerDomEvent(a.containerEl,c,l=>{wt(l,l.target)&&l.target.closest('.pdf-embed[src*="#"] .pdf-viewer-container')&&l.preventDefault()},{passive:!1});return a instanceof Wo&&this.registerDomEvent(a.containerEl,"click",c=>{wt(c,c.target)&&c.target.closest(".cm-editor")&&c.preventDefault()}),s.has("color")?a.containerEl.dataset.highlightColor=s.get("color").toLowerCase():this.settings.defaultColor&&(a.containerEl.dataset.highlightColor=this.settings.defaultColor.toLowerCase()),a})}registerGlobalVariable(e,i,r=!0){if(e in window){if(r)throw new Error(`${this.manifest.name}: Global variable "${e}" already exists.`);return}window[e]=i,this.register(()=>delete window[e])}registerGlobalVariables(){this.registerGlobalVariable("pdfPlus",this,!1),this.registerGlobalVariable("pdflib",xp,!1)}registerEvents(){this.registerEvent(this.app.workspace.on("layout-change",()=>{for(let e of this.pdfViewerChildren.keys())e!=null&&e.isShown()||this.pdfViewerChildren.delete(e)})),De.Platform.isDesktopApp&&this.registerEvent(this.app.workspace.on("active-leaf-change",e=>{if(this.settings.syncWithDefaultApp&&e&&this.lib.isPDFView(e.view)){let i=e.view.file;i&&(this.app.openWithDefaultApp(i.path),this.settings.focusObsidianAfterOpenPDFWithDefaultApp&&Ic())}})),this.registerEvent(this.app.vault.on("delete",e=>{e instanceof De.TFile&&e===this.lastPasteFile&&(this.lastPasteFile=null)})),this.registerEvent(this.app.vault.on("rename",(e,i)=>{e instanceof De.TFile&&this.settings.newFileTemplatePath===i&&(this.settings.newFileTemplatePath=e.path,this.saveSettings())})),this.registerEvent(this.app.vault.on("delete",e=>{e instanceof De.TFile&&this.settings.newFileTemplatePath===e.path&&(this.settings.newFileTemplatePath="",this.saveSettings())})),this.registerEvent(this.app.vault.on("modify",async e=>{e instanceof De.TFile&&e.path===this.settings.vimrcPath&&(this.vimrc=await this.app.vault.read(e))})),this.registerEvent(this.app.workspace.on("quit",async()=>{await this.cleanUpResources()})),this.registerEvent(this.app.workspace.on("editor-drop",(e,i,r)=>this.lib.dummyFileManager.createDummyFilesOnEditorDrop(e,i,r)))}registerOneTimeEvent(e,...[i,r,o]){let s=e.on(i,(...a)=>{r.call(o,...a),e.offref(s)},o);this.registerEvent(s)}registerHoverLinkSources(){this.registerHoverLinkSource("pdf-plus",{defaultMod:!0,display:"PDF++: backlink highlights"}),this.registerHoverLinkSource(Ji.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: internal links in PDF (except for citations)"}),this.registerHoverLinkSource(Ci.HOVER_LINK_SOURCE_ID,{defaultMod:!1,display:"PDF++: citation links in PDF"}),this.registerHoverLinkSource(Vn.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: external links in PDF"}),this.registerHoverLinkSource(Qi.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: outlines (bookmarks)"}),this.registerHoverLinkSource(_i.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: thumbnails"})}registerCommands(){this.lib.commands.registerCommands()}startTrackingActiveMarkdownFile(){let{workspace:e,vault:i}=this.app;e.onLayoutReady(()=>{let r=e.getActiveFile();if(r&&r.extension==="md")this.lastActiveMarkdownFile=r;else{let o=e.recentFileTracker.getRecentFiles({showMarkdown:!0,showCanvas:!1,showNonImageAttachments:!1,showImages:!1,maxCount:1}).first();if(o){let s=i.getAbstractFileByPath(o);s instanceof De.TFile&&s.extension==="md"&&(this.lastActiveMarkdownFile=s)}}this.registerEvent(e.on("file-open",o=>{o instanceof De.TFile&&o.extension==="md"&&(this.lastActiveMarkdownFile=o)})),this.registerEvent(i.on("delete",o=>{o instanceof De.TFile&&o===this.lastActiveMarkdownFile&&(this.lastActiveMarkdownFile=null)}))})}obsidianProtocolHandler(e){if("create-dummy"in e)return this.lib.dummyFileManager.createDummyFilesFromObsidianUrl(e);if("setting"in e)return this.settingTab.openFromObsidianUrl(e)}on(e,i,r){return this.events.on(e,i,r)}off(e,i){this.events.off(e,i)}offref(e){this.events.offref(e)}trigger(e,...i){this.events.trigger(e,...i)}requireModKeyForLinkHover(e="pdf-plus"){var i,r,o;return(o=(r=this.app.internalPlugins.plugins["page-preview"].instance.overrides[e])!=null?r:(i=this.app.workspace.hoverLinkSources[e])==null?void 0:i.defaultMod)!=null?o:!1}openSettingTab(){return this.app.setting.open(),this.app.setting.openTabById(this.manifest.id)}openHotkeySettingTab(e){this.app.setting.open();let i=this.app.setting.openTabById("hotkeys");return i.setQuery(e!=null?e:this.manifest.id),i}getAnyStyleInputDir(){let e=this.manifest.dir;return e?e+"/anystyle":null}}; + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/pdf-plus/manifest.json b/.obsidian/plugins/pdf-plus/manifest.json new file mode 100644 index 0000000..8ee2210 --- /dev/null +++ b/.obsidian/plugins/pdf-plus/manifest.json @@ -0,0 +1,15 @@ +{ + "id": "pdf-plus", + "name": "PDF++", + "version": "0.40.13", + "minAppVersion": "1.5.8", + "description": "The most Obsidian-native PDF annotation tool ever.", + "author": "Ryota Ushio", + "authorUrl": "https://github.com/RyotaUshio", + "fundingUrl": { + "GitHub Sponsor": "https://github.com/sponsors/RyotaUshio", + "Buy Me a Coffee": "https://www.buymeacoffee.com/ryotaushio", + "Ko-fi": "https://ko-fi.com/ryotaushio" + }, + "isDesktopOnly": false +} \ No newline at end of file diff --git a/.obsidian/plugins/pdf-plus/styles.css b/.obsidian/plugins/pdf-plus/styles.css new file mode 100644 index 0000000..bca8eb1 --- /dev/null +++ b/.obsidian/plugins/pdf-plus/styles.css @@ -0,0 +1,609 @@ +/* @settings + +name: PDF++ +id: pdf-plus +settings: + - + id: pdf-highlight + title: Highlights + type: heading + level: 2 + - + id: pdf-plus-highlight-opacity + title: Highlight opacity + type: variable-number-slider + min: 0 + max: 1 + step: 0.01 + default: 0.2 + - + id: pdf-plus-highlight-padding-vertical-em + title: Highlight padding (top & bottom) + description: Boldness of highlights (em) + type: variable-number-slider + min: 0 + max: 1 + step: 0.01 + default: 0.05 + format: em + - + id: pdf-plus-highlight-padding-horizontal-em + title: Highlight padding (left & right) + description: Boldness of highlights (em) + type: variable-number-slider + min: 0 + max: 1 + step: 0.01 + default: 0.05 + format: em + - + id: pdf-rect + title: Rectanglular selection + type: heading + level: 2 + - + id: pdf-plus-rect-highlight-opacity + title: Rectangle highlight opacity + type: variable-number-slider + min: 0 + max: 1 + step: 0.01 + default: 1 + - + id: pdf-plus-rect-highlight-border-width + title: Rectangle highlight border width (px) + type: variable-number-slider + min: 1 + max: 10 + step: 1 + default: 2 + format: px + - + id: pdf-toolbar + title: PDF toolbars + type: heading + level: 2 + - + id: hide-pdf-embed-toolbar + title: Hide toolbar in PDF embeds with a page specified + type: class-toggle + default: true + - + id: hide-pdf-toolbar-in-hover-editor + title: Hide PDF toolbar in Hover Editor + type: class-toggle + default: true + - + id: pdf-sidebar + title: PDF sidebars + type: heading + level: 2 + - + id: pdf-plus-sidebar-width + title: Sidebar width (px) + type: variable-number-slider + min: 100 + max: 1000 + step: 10 + default: 140 + format: px + - + id: pdf-plus-vim + title: Vim keybindings + type: heading + level: 2 + - + id: pdf-plus-vim-hin + title: Hint mode + type: heading + level: 3 + - + id: pdf-plus-vim-hint-inverted + title: Inverted color scheme + type: class-toggle + default: false +*/ + +:root { + --pdf-plus-highlight-padding-default-em: 0.05em; +} + +.hide-pdf-embed-toolbar .pdf-embed[src*="#"] .pdf-toolbar, +.hide-pdf-embed-toolbar .popover.hover-popover.hover-editor .pdf-embed[src*="#"] .pdf-toolbar { + display: none; +} + +.hide-pdf-toolbar-in-hover-editor .popover.hover-popover.hover-editor .view-content>.pdf-toolbar { + display: none !important; +} + +/* When hovering over a highlighted text in PDF viewer, highlight the corresponding item in backlink pane */ +.backlink-pane .search-result-file-match.hovered-backlink, +.backlink-pane .search-result-file-matches:has(.better-search-views-tree) .better-search-views-file-match.hovered-backlink:not(:hover) { + background-color: var(--text-selection); +} + +.setting-item.no-border, +.pdf-plus-settings.vertical-tab-content .setting-item.no-border { + border-top: none; + + &.small-padding { + padding-top: 0; + } +} + +.setting-item-control input.error { + border-color: var(--background-modifier-error); +} + +.setting-item-description.error { + color: var(--background-modifier-error); +} + +.is-mobile, +.is-tablet { + .pdf-plus-color-palette .pdf-plus-color-palette-item-inner { + width: calc(var(--swatch-width) * 0.85); + height: calc(var(--swatch-width) * 0.85); + } +} + +.pdf-plus-color-palette { + user-select: none; + -webkit-user-select: none; + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + + .pdf-plus-color-palette-item { + /* Avoid text selections to be cleared when tapping on a color palette item on the mobile app */ + /* https://github.com/RyotaUshio/obsidian-pdf-plus/issues/169 */ + user-select: none; + + .pdf-plus-color-palette-item-inner { + width: var(--swatch-width); + height: var(--swatch-width); + border-radius: 50%; + border: var(--input-border-width) solid var(--background-modifier-border); + } + } + + .pdf-plus-color-palette-status-container { + padding: var(--size-2-2) var(--size-2-3); + color: var(--text-muted); + font-size: var(--font-ui-small); + text-wrap: nowrap; + } +} + +.menu .menu-item.pdf-plus-color-menu-item { + padding-left: 0; + + .pdf-plus-color-indicator { + border-radius: 50%; + border-width: 0; + height: var(--size-4-3); + width: var(--size-4-3); + } +} + +.pdf-toolbar .clickable-icon.is-disabled { + background-color: inherit; + + &>svg { + color: var(--text-faint); + } +} + +/* .pdf-page-input, */ +.pdf-zoom-level-input { + width: 6ch; + text-align: right; + font-variant-numeric: tabular-nums; +} + +.pdf-zoom-level-percent { + white-space: nowrap; + margin-right: var(--size-4-1); + font-size: var(--font-ui-small); + font-variant-numeric: tabular-nums; +} + +.pdf-plus-settings.vertical-tab-content { + --pdf-plus-settings-header-height: var(--size-4-12); + + padding-top: 0; + padding-left: 0; + padding-right: 0; +} + +.pdf-plus-settings.vertical-tab-content .header-container { + position: sticky; + top: 0; + z-index: 10; + height: var(--pdf-plus-settings-header-height); + line-height: var(--pdf-plus-settings-header-height); + text-align: center; + background-color: var(--background-secondary); + border-bottom: 1px solid var(--divider-color); + padding: 0 var(--size-4-4); + + overflow-x: scroll; + overflow-y: hidden; + white-space: nowrap; + + display: flex; + justify-content: space-between; + align-items: center; + + .header { + line-height: normal; + + .header-title { + display: none; + } + } +} + +.pdf-plus-settings.vertical-tab-content .content { + padding-top: var(--size-4-8); + padding-bottom: var(--size-4-16); + padding-left: var(--size-4-12); + padding-right: var(--size-4-12); +} + +.pdf-plus-settings.vertical-tab-content .spacer { + height: var(--pdf-plus-settings-header-height); +} + +.pdf-plus-settings.vertical-tab-content .top-note { + min-height: var(--pdf-plus-settings-header-height); + color: var(--text-muted); + font-size: var(--font-ui-smaller); +} + +.pdf-plus-settings .setting-item-description, +.pdf-plus-modal .setting-item-description { + &>p:first-child { + margin-top: 0; + } + + &>p:last-child { + margin-bottom: 0; + } +} + +.pdf-plus-settings .ignore-split-setting.setting-item { + padding-top: 0; +} + +.annotationLayer .popupContent { + &>p:first-child { + margin-top: 0; + } + + &>p:last-child { + margin-bottom: 0; + } +} + +.pdf-plus-backlink-highlight-layer { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 2; + transform-origin: 0 0; + pointer-events: none; +} + +.pdf-plus-backlink-highlight-layer .pdf-plus-backlink { + position: absolute; + pointer-events: auto; +} + +.pdf-plus-backlink-highlight-layer .pdf-plus-backlink.pdf-plus-backlink-selection { + box-sizing: content-box; + cursor: text; +} + +.pdf-plus-backlink-highlight-layer .rect-highlight { + background-color: rgb(var(--text-highlight-bg-rgb)); + border-radius: var(--radius-m); + opacity: 0.2; +} + +body:not(.pdf-plus-backlink-selection-underline) .pdf-plus-backlink-highlight-layer .pdf-plus-backlink.pdf-plus-backlink-selection { + background-color: rgb(from var(--pdf-plus-color) r g b / var(--pdf-plus-highlight-opacity, 0.2)); + padding: var(--pdf-plus-highlight-padding-vertical-em, var(--pdf-plus-highlight-padding-default-em)) var(--pdf-plus-highlight-padding-horizontal-em, var(--pdf-plus-highlight-padding-default-em)); + margin: calc(var(--pdf-plus-highlight-padding-vertical-em, var(--pdf-plus-highlight-padding-default-em)) * -1) calc(var(--pdf-plus-highlight-padding-horizontal-em, var(--pdf-plus-highlight-padding-default-em)) * -1); + border-radius: 0.1em; +} + +body.pdf-plus-backlink-selection-underline { + .pdf-plus-backlink-highlight-layer .pdf-plus-backlink.pdf-plus-backlink-selection { + padding: 0; + margin: 0; + opacity: 1.0; + border-radius: 0; + } + + .pdf-plus-backlink-highlight-layer[data-main-rotation="0"] .pdf-plus-backlink.pdf-plus-backlink-selection { + border-bottom: 0.1em solid var(--pdf-plus-color); + } + + .pdf-plus-backlink-highlight-layer[data-main-rotation="90"] .pdf-plus-backlink.pdf-plus-backlink-selection { + border-right: 0.1em solid var(--pdf-plus-color); + } + + .pdf-plus-backlink-highlight-layer[data-main-rotation="180"] .pdf-plus-backlink.pdf-plus-backlink-selection { + border-top: 0.1em solid var(--pdf-plus-color); + } + + .pdf-plus-backlink-highlight-layer[data-main-rotation="270"] .pdf-plus-backlink.pdf-plus-backlink-selection { + border-left: 0.1em solid var(--pdf-plus-color); + } +} + +.pdf-plus-backlink-highlight-layer .pdf-plus-backlink.pdf-plus-backlink-fit-r { + border: dashed rgb(from var(--pdf-plus-rect-color) r g b / var(--pdf-plus-rect-highlight-opacity, 1)) var(--pdf-plus-rect-highlight-border-width, 2px); +} + +.pdf-plus-backlink-icon { + position: absolute; + --icon-size: 100%; +} + +[data-main-rotation="90"] .pdf-plus-backlink-icon { + transform: rotate(270deg); +} + +[data-main-rotation="180"] .pdf-plus-backlink-icon { + transform: rotate(180deg); +} + +[data-main-rotation="270"] .pdf-plus-backlink-icon { + transform: rotate(90deg); +} + +.pdf-plus-annotation-edit-modal { + .desc { + margin-bottom: var(--size-4-4); + } + + .preview-container { + background: var(--background-modifier-form-field); + border: var(--input-border-width) solid var(--background-modifier-border); + border-radius: var(--input-radius); + padding: var(--size-4-1) var(--size-4-2); + text-align: left; + + &>p:first-child { + margin-top: 0; + } + + &>p:last-child { + margin-bottom: 0; + } + } + + /* Arrange two children of .setting-item, namely .setting-item-info and .setting-item-contrl, vertically */ + .setting-item:last-child:has(textarea) { + display: flex; + flex-direction: column; + justify-content: left; + align-items: flex-start; + + .setting-item-control { + width: 100%; + padding-top: var(--size-4-2); + } + } +} + +.popupWrapper { + --pdf-popup-width: 310px; +} + +.pdf-plus-annotation-icon-container { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + + margin-right: calc(var(--size-4-1) * -1); + margin-left: calc(var(--size-2-1) * -1); + + .clickable-icon { + margin-right: 0; + margin-left: 0; + } +} + +.pdf-plus-draggable .popup { + cursor: default; +} + +#pdf-plus-funding { + display: flex; + flex-direction: column; + justify-content: left; + align-items: flex-end; + + .setting-item-control { + padding-top: var(--size-4-4); + } +} + +#pdf-plus-funding-icon-info-container { + display: flex; + flex-direction: row; + /* justify-content: left; */ + align-items: center; +} + +#pdf-plus-funding-icon { + margin-right: var(--size-4-4); +} + +.page-label-range:first-of-type { + margin-top: var(--size-4-4); +} + +.page-label-range:not(:first-of-type) { + margin-top: var(--size-4-9); +} + +.pdf-plus-page-label-modal { + z-index: var(--he-popover-layer-inactive, var(--layer-popover)); + + .page-labels-loading { + color: var(--text-muted); + text-align: center; + margin: var(--size-4-4); + } +} + +.pdf-plus-restore-default-modal { + user-select: text; +} + +.pdf-content-container { + --sidebar-width: var(--pdf-plus-sidebar-width, 140px); +} + +body { + --container-pdf-cropped-width: var(--line-width); + --container-pdf-cropped-max-width: var(--max-width); +} + +.internal-embed.pdf-cropped-embed { + width: var(--container-pdf-cropped-width); + max-width: var(--container-pdf-cropped-max-width); + + img { + cursor: text !important; + max-width: 100%; + } +} + +.popover.hover-popover>.pdf-cropped-embed img { + max-height: 100%; + max-width: 100%; + height: auto; +} + +.pdf-plus-selecting * { + cursor: crosshair !important; + + .textLayer { + user-select: none; + } +} + +.pdf-container .pdf-plus-select-box { + position: absolute; + z-index: 1000; + border: dashed var(--background-modifier-border) 2px; + background-color: hsla(var(--interactive-accent-hsl), 0.15); +} + +/* From Obsidian's app.css (.annotationLayer .mod-focused / .annotationLayer .boundingRect)*/ +.pdf-plus-annotation-bounding-rect { + background-color: rgba(var(--text-highlight-bg-rgb), 0.1); + border-radius: var(--radius-s); + box-shadow: var(--shadow-s); + box-sizing: content-box; + margin: calc(var(--size-4-2) * -1); + border: var(--size-4-1) solid rgba(var(--text-highlight-bg-rgb), 0.8); + padding: var(--size-4-1); + z-index: 0; + /* Avoid preventing annotation click */ + position: absolute; + pointer-events: none; +} + +.popover.hover-popover.pdf-plus-bib-popover { + --popover-width: 400px; + --pdf-plus-bib-metadata-font-size: var(--font-ui-small); + + .pdf-plus-bib { + padding: var(--size-4-3); + font-size: var(--font-ui-medium); + + /* Make text inside citation hover selectable (https://github.com/RyotaUshio/obsidian-pdf-plus/issues/252) */ + -moz-user-select: text; + -webkit-user-select: text; + user-select: text; + + .bib-title { + font-weight: bold; + padding-bottom: var(--size-4-2); + } + + .bib-author-year { + color: var(--text-muted); + text-align: left; + font-size: var(--pdf-plus-bib-metadata-font-size); + } + + .bib-container-title { + color: var(--text-muted); + font-style: italic; + text-align: left; + font-size: var(--pdf-plus-bib-metadata-font-size); + } + + .button-container { + margin-top: 1em; + display: flex; + justify-content: space-between; + gap: var(--size-4-2); + flex-wrap: wrap; + } + } +} + +.pdf-plus-vim-command { + border-top: 1px solid var(--background-modifier-border); + /* height: var(--size-4-8); */ + font-family: monospace; + + input { + background: transparent; + border: none; + outline: none; + font-family: monospace; + white-space: pre; + width: 90%; + } +} + +.page.pdf-plus-vim-hint-mode [data-pdf-plus-vim-hint]::after { + content: attr(data-pdf-plus-vim-hint); + color: var(--pdf-plus-vim-hint-color); + text-transform: uppercase; + font-size: var(--font-ui-medium); + font-weight: bold; + background-color: var(--pdf-plus-vim-hint-background-color); + border: var(--size-2-1) solid hsl(var(--accent-h), var(--accent-s), var(--accent-l)); + border-radius: 10%; + padding: 0 var(--size-2-2); + position: relative; + left: 0; + top: 0; + z-index: 9999; +} + +body { + --pdf-plus-vim-hint-color: var(--text-normal); + --pdf-plus-vim-hint-background-color: var(--background-primary); +} + +body.pdf-plus-vim-hint-inverted { + --pdf-plus-vim-hint-color: var(--text-on-accent); + --pdf-plus-vim-hint-background-color: hsl(var(--accent-h), var(--accent-s), var(--accent-l)); +} \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 50d779d..817a3ac 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -7,20 +7,6 @@ "id": "16f08ed269e522f4", "type": "tabs", "children": [ - { - "id": "ff26353664f95c88", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "ArbeitsplatzZeug/Präsentation Bios-Uefi.md", - "mode": "source", - "source": false - }, - "icon": "lucide-file", - "title": "Präsentation Bios-Uefi" - } - }, { "id": "890b89bee7b547bc", "type": "leaf", @@ -35,6 +21,7 @@ "title": "L24-12-02" } } +<<<<<<< HEAD ], "currentTab": 1 }, @@ -56,6 +43,26 @@ }, "icon": "lucide-file-text", "title": "AB_Mediennutzung_Why-the-modern-world...bilingual_erweitert" +======= + ] + }, + { + "id": "9e83997c8f7589ca", + "type": "tabs", + "children": [ + { + "id": "1cc07db6098bf8e9", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "ArbeitsplatzZeug/Präsentation Bios-Uefi.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Präsentation Bios-Uefi" +>>>>>>> 856985bffc3cfc3107a477727a246c62a030bc99 } } ] @@ -204,8 +211,9 @@ "omnisearch:Omnisearch": false } }, - "active": "890b89bee7b547bc", + "active": "1cc07db6098bf8e9", "lastOpenFiles": [ +<<<<<<< HEAD "Gemeinschaftskunde/AB_Mediennutzung_Why-the-modern-world...bilingual_erweitert.pdf", "Gemeinschaftskunde/L24-12-02.md", "LF3-Netzwerke/L24-12-02.md", @@ -219,13 +227,18 @@ "LF5-JavaShit/Struktogramm_Grundlagen.pdf", "ArbeitsplatzZeug/Planung.md", "ArbeitsplatzZeug/uefi infos.md", +======= + "ArbeitsplatzZeug/bios-uefi infos.md", +>>>>>>> 856985bffc3cfc3107a477727a246c62a030bc99 "ArbeitsplatzZeug/Präsentation Bios-Uefi.md", + "ArbeitsplatzZeug/PC_systemLayers.jpg", + "ArbeitsplatzZeug/SoftwareLayers.png", + "ArbeitsplatzZeug/Planung.md", + "ArbeitsplatzZeug/uefi infos.md", "LF1-Unternehmen/L24-11-28.md", "LF1-Unternehmen/L24-10-10.md", "LF1-Unternehmen/L24-11-26.md", - "ArbeitsplatzZeug/SoftwareLayers.png", "ArbeitsplatzZeug/Uefi-Bios-Präsentation-Idee.md", - "ArbeitsplatzZeug/PC_systemLayers.jpg", "LF5-databases/Drawing 2024-11-26 11.15.51.excalidraw.md", "LF5-databases/A24-11-24 Selektionen.sql", "LF5-databases/A24-11-24 Projektionen.sql", diff --git a/ArbeitsplatzZeug/Präsentation Bios-Uefi.md b/ArbeitsplatzZeug/Präsentation Bios-Uefi.md index b98d316..92639a9 100644 --- a/ArbeitsplatzZeug/Präsentation Bios-Uefi.md +++ b/ArbeitsplatzZeug/Präsentation Bios-Uefi.md @@ -1,4 +1,54 @@ # Bios/Uefi --- ## Gliederung -- \ No newline at end of file +- Allgemein +- Probleme BIOS +- UEFI + - Geschichte + - Vorteile & Features +--- +### Allgemein +![[PC_systemLayers.jpg]] + +--- +### Allgemein +- 2. Softwareebene +- Hardwareinitialisierung +- Funktionalitätscheck +- Start des Bootloaders +- CPU Microcode +- API für Hardware +--- +### BIOS +![[BIOS.png]] + +--- +### BIOS +- Basic Input Output System +- MBR +- 8 / 16 Bit +- Assembly +- Fragmentiert +- Minimale API +--- +### UEFI +- 1990 Intel unzufrieden mit Bios +- 1998 Intel Boot Initiative +- 2004 Tiano +- 2005 Spec an UEFI Forum übergeben +--- +### UEFI +![[UEFI-Beispiel.jpeg]] + +--- +### UEFI +- Unified Extensible Firmware Interface +- MBR & GPT +- 32 / 64 Bit +- C +- CSM (Compatibility Support Module) +- Stark erweitere API + +--- + +# Fragen \ No newline at end of file diff --git a/ArbeitsplatzZeug/bios-uefi infos.md b/ArbeitsplatzZeug/bios-uefi infos.md index 2d1e700..d186caa 100644 --- a/ArbeitsplatzZeug/bios-uefi infos.md +++ b/ArbeitsplatzZeug/bios-uefi infos.md @@ -6,7 +6,6 @@ - Hardware Konfiguration - CPU Microcode Updates - Minimale API für Hardware-Zugriff - ## BIOS - BIOS / Basic Input/Output System - Nur MBR @@ -41,4 +40,5 @@ - Boot & Runtime Services - Boot services nur für Firmware und bevor OS (Beendet durch `ExitBootServices()`) - Backwards Compatibility via CSM (Compatibility Support Module) -- Viele mittlerweile wichtige Features, z.B. Secure Boot \ No newline at end of file +- Viele mittlerweile wichtige Features, z.B. Secure Boot +- Stark verbessertes UI \ No newline at end of file diff --git a/English/AB_company-profiles_HV_Audi_SV.pdf b/English/AB_company-profiles_HV_Audi_SV.pdf new file mode 100644 index 0000000..e01fd06 Binary files /dev/null and b/English/AB_company-profiles_HV_Audi_SV.pdf differ diff --git a/Gemeinschaftskunde/AB_Mediennutzung_Why-the-modern-world...bilingual_erweitert.pdf b/Gemeinschaftskunde/AB_Mediennutzung_Why-the-modern-world...bilingual_erweitert.pdf new file mode 100644 index 0000000..d359a15 Binary files /dev/null and b/Gemeinschaftskunde/AB_Mediennutzung_Why-the-modern-world...bilingual_erweitert.pdf differ diff --git a/Gemeinschaftskunde/L24-12-02.md b/Gemeinschaftskunde/L24-12-02.md new file mode 100644 index 0000000..bad477f --- /dev/null +++ b/Gemeinschaftskunde/L24-12-02.md @@ -0,0 +1,3 @@ +[[AB_Mediennutzung_Why-the-modern-world...bilingual_erweitert.pdf#page=1&selection=36,0,42,40|AB_Mediennutzung_Why-the-modern-world...bilingual_erweitert, p.1]] + +Moderne Smartphones sind leistungsfähige Sammlungen von allen möglichen erdenkbaren Diensten, sei es Telefonate, Textnachrichten via SMS, Mail, WhatsApp oder ähnlichen Diensten, Spiele, Social Media Plattformen wie X (früher Twitter), Instagramm oder ähnlichen. Dadurch ermöglichen sie ein Verhalten, bei dem jeder in der Lage ist, alle möglichen, für den Alltag genutzten Dienste sofort selber zu nutzen, wofür es früher dediziertes Personal gab. Dies, in Kombination mit der ständigen Verfügbarkeit der Geräte, erzeugt das Potential für eine Arbeitslast, welche in der Form für das menschliche Gehirn sehr ungeeignet ist. Diese Nicht-Eignung entsteht dabei dadurch, dass das Gehirn effektiv nicht mehrere Aufgaben auf einmal abarbeiten kann und stattdessen konstant zwischen den verschiedenen Aufgaben wechseln muss. Dadurch, unter anderem auch durch sozialen Druck, sorgt diese Kombination dafür, dass man auf all den Diensten permanent erreichbar und aktiv sein muss, unbedacht der Tatsache, dass dies die Arbeitslast von mehreren Personen auf eine Weise kombiniert, für die das menschliche Gehirn denkbar ungeeignet ist. Im Endeffekt erhöht das den Druck auf die individuellen Personen enorm, ohne, durch die erwähnte Uneignung, die Produktivität auch nur minimal zu steigern. \ No newline at end of file diff --git a/LF1-Unternehmen/L24-11-29.md b/LF1-Unternehmen/L24-11-29.md new file mode 100644 index 0000000..58f060d --- /dev/null +++ b/LF1-Unternehmen/L24-11-29.md @@ -0,0 +1,8 @@ +# Bestellverfahren +## Bestellpunktverfahren +- Sobald Mindestbestand unterschritten, sende Bestellung +- Mindestbestand so gewählt, dass Lieferung vor Unterschreitung des Sicherheitsbestandes ankommt +- Bestellmenge liegt unterhalb Maximalkapazität +- Sicherheitsbestand gibt Sicherheit, dass man bei Unfällen kurze Verzögerungen gut übersteht +## Bestellrythmusverfahren +- Bestellzeitpunkte und Menge vordefiniert, kaum bis keine Anpassung \ No newline at end of file diff --git a/LF3-Netzwerke/400 Protokolle.pdf b/LF3-Netzwerke/400 Protokolle.pdf new file mode 100644 index 0000000..cf5bcad Binary files /dev/null and b/LF3-Netzwerke/400 Protokolle.pdf differ diff --git a/LF3-Netzwerke/L24-12-02.md b/LF3-Netzwerke/L24-12-02.md new file mode 100644 index 0000000..8ea03b6 --- /dev/null +++ b/LF3-Netzwerke/L24-12-02.md @@ -0,0 +1,23 @@ +# Aufgaben +## Aufgabe 1 +Welche der folgenden Aussagen trifft zu? +• ~~Der Adressbereich von IPv6 ist zehnmal so groß wie der Adressbereich von IPv4.~~ +• IPv4 und IPv6 können auf Netzgeräten parallel betrieben werden. +• ~~IPv4 hat 232 möglich IP-Adressen.~~ +• ~~IPv6 hat 2128 möglich IP-Adressen.~~ +• Bei IPv4 gibt es Adressen, die nicht weltweit genutzt werden können. +• Bei IPv6 gibt es Adressen, die nicht weltweit genutzt werden können. +## Aufgabe 2 +Folgende IPv6-Adressen sollen zusammengefasst bzw. ausführlich geschrieben werden: +• 2001:abcd:6f:: -> `2001:abcd:006f:0000:0000:0000:0000:0000` +• 2001:abc:3de:41d::1 -> `2001:0abc:03de:041d:0000:0000:0000:0001` +• 2001:effe:3567:2d::1234 -> `2001:effe:2567:002d:0000:0000:0000:1234` +• 2001:1234:003d:04ff:0000:0000:0000:0000 -> `2001:1234:3d:4ff::` +• 2001:012f:0000:0000:0012:0000:0000:0000 -> `2001:12f:0:0:12::` +• 2001:abad:03db:0000:0000:0000:0000:0001 -> `2001:abad:3db::1` + +## Aufgabe 3 + +- `FE80::/10` -> `FEBF::` +- `FC::/7` -> `FDFF::` +- `2000::/3` -> `3FFF::` \ No newline at end of file diff --git a/LF5-JavaShit/L24-11-29.md b/LF5-JavaShit/L24-11-29.md new file mode 100644 index 0000000..0e6d194 --- /dev/null +++ b/LF5-JavaShit/L24-11-29.md @@ -0,0 +1,38 @@ +# Struktogramme +Englisch: Structograms + +## Füllregeln +### Allgemeingültigkeit +- Keine sprachspezifischen Besonderheiten +- So allgemein wie nur irgendwie möglich +### Deklaration +- Erklärung, welche Variable was für einen Typ hat +- Variablen in 1. Block +- Konstanten in 1. Block +- Nur Prozedur +- Namenregeln: + - int -> GZ (Ganzzahl) + - float -> FKZ (Fließkommazahl) + - char -> Zeichen + - string -> Text + - bool -> bool +### Exklusivität +- Jede Anweisung ein Block +- Name über jedes Struktogramm +### Erweitertes Struktogramm +- Variablen und Konstanten werden in 1. Block deklariert +### Variablen Wertzuweisung +- `ziel <- Wert` || `ziel := Wert` +### Eintrittsblock +- Programmname +- Variablendeklaration +- Konstanten + +# Test Themen +- Variablen Typen +- Namenskonventionen +- Deklaration Initialisierung +- System.out +- Concat +- Fehlersuche +- Conditionals \ No newline at end of file diff --git a/LF5-JavaShit/Struktogramm_Grundlagen.pdf b/LF5-JavaShit/Struktogramm_Grundlagen.pdf new file mode 100644 index 0000000..2ca2347 Binary files /dev/null and b/LF5-JavaShit/Struktogramm_Grundlagen.pdf differ