@forsion/clip 0.0.0-stage → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -2
- package/chrome-mv3/_locales/en/messages.json +17 -0
- package/chrome-mv3/_locales/zh_CN/messages.json +17 -0
- package/chrome-mv3/assets/App-CTFaMeAz.css +1 -0
- package/chrome-mv3/assets/document-export-Dk8vjRKk.css +1 -0
- package/chrome-mv3/assets/imageHosts-4UXWVpSw.css +1 -0
- package/chrome-mv3/background.js +162 -0
- package/chrome-mv3/chunks/App-CjD26llS.js +408 -0
- package/chrome-mv3/chunks/_virtual_wxt-html-plugins-DPbbfBKe.js +1 -0
- package/chrome-mv3/chunks/document-export-DNFinZCF.js +22 -0
- package/chrome-mv3/chunks/imageHosts-Cmp3E2vS.js +58 -0
- package/chrome-mv3/chunks/offscreen-CogL61qx.js +1 -0
- package/chrome-mv3/content-scripts/content.js +668 -0
- package/chrome-mv3/document-export.html +27 -0
- package/chrome-mv3/icon/128.png +0 -0
- package/chrome-mv3/icon/16.png +0 -0
- package/chrome-mv3/icon/32.png +0 -0
- package/chrome-mv3/icon/48.png +0 -0
- package/chrome-mv3/icon/logo.png +0 -0
- package/chrome-mv3/manifest.json +1 -0
- package/chrome-mv3/offscreen.html +3 -0
- package/chrome-mv3/options.html +16 -0
- package/chrome-mv3/sidepanel.html +16 -0
- package/package.json +54 -4
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
var content=(function(){"use strict";var Ay=Object.defineProperty;var wy=(dn,pr,$r)=>pr in dn?Ay(dn,pr,{enumerable:!0,configurable:!0,writable:!0,value:$r}):dn[pr]=$r;var Je=(dn,pr,$r)=>wy(dn,typeof pr!="symbol"?pr+"":pr,$r);function dn(t){return t}function pr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $r={exports:{}},Rn={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var ka;function Pd(){if(ka)return Rn;ka=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,o,i){var c=null;if(i!==void 0&&(c=""+i),o.key!==void 0&&(c=""+o.key),"key"in o){i={};for(var d in o)d!=="key"&&(i[d]=o[d])}else i=o;return o=i.ref,{$$typeof:t,type:n,key:c,ref:o!==void 0?o:null,props:i}}return Rn.Fragment=e,Rn.jsx=r,Rn.jsxs=r,Rn}var Na;function qd(){return Na||(Na=1,$r.exports=Pd()),$r.exports}qd();var Li={exports:{}},He={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var La;function Bd(){if(La)return He;La=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),C=Symbol.for("react.view_transition"),A=Symbol.iterator;function a(I){return I===null||typeof I!="object"?null:(I=A&&I[A]||I["@@iterator"],typeof I=="function"?I:null)}var s={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},l=Object.assign,u={};function m(I,H,V){this.props=I,this.context=H,this.refs=u,this.updater=V||s}m.prototype.isReactComponent={},m.prototype.setState=function(I,H){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,H,"setState")},m.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function x(){}x.prototype=m.prototype;function f(I,H,V){this.props=I,this.context=H,this.refs=u,this.updater=V||s}var v=f.prototype=new x;v.constructor=f,l(v,m.prototype),v.isPureReactComponent=!0;var p=Array.isArray;function h(){}var w={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function M(I,H,V){var X=V.ref;return{$$typeof:t,type:I,key:H,ref:X!==void 0?X:null,props:V}}function $(I,H){return M(I.type,H,I.props)}function T(I){return typeof I=="object"&&I!==null&&I.$$typeof===t}function D(I){var H={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(V){return H[V]})}var R=/\/+/g;function S(I,H){return typeof I=="object"&&I!==null&&I.key!=null?D(""+I.key):H.toString(36)}function y(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(h,h):(I.status="pending",I.then(function(H){I.status==="pending"&&(I.status="fulfilled",I.value=H)},function(H){I.status==="pending"&&(I.status="rejected",I.reason=H)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function k(I,H,V,X,ne){var Y=typeof I;(Y==="undefined"||Y==="boolean")&&(I=null);var W=!1;if(I===null)W=!0;else switch(Y){case"bigint":case"string":case"number":W=!0;break;case"object":switch(I.$$typeof){case t:case e:W=!0;break;case E:return W=I._init,k(W(I._payload),H,V,X,ne)}}if(W)return ne=ne(I),W=X===""?"."+S(I,0):X,p(ne)?(V="",W!=null&&(V=W.replace(R,"$&/")+"/"),k(ne,H,V,"",function(Q){return Q})):ne!=null&&(T(ne)&&(ne=$(ne,V+(ne.key==null||I&&I.key===ne.key?"":(""+ne.key).replace(R,"$&/")+"/")+W)),H.push(ne)),1;W=0;var J=X===""?".":X+":";if(p(I))for(var G=0;G<I.length;G++)X=I[G],Y=J+S(X,G),W+=k(X,H,V,Y,ne);else if(G=a(I),typeof G=="function")for(I=G.call(I),G=0;!(X=I.next()).done;)X=X.value,Y=J+S(X,G++),W+=k(X,H,V,Y,ne);else if(Y==="object"){if(typeof I.then=="function")return k(y(I),H,V,X,ne);throw H=String(I),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return W}function N(I,H,V){if(I==null)return I;var X=[],ne=0;return k(I,X,"","",function(Y){return H.call(V,Y,ne++)}),X}function L(I){if(I._status===-1){var H=I._result,V=H();V.then(function(X){(I._status===0||I._status===-1)&&(I._status=1,I._result=X,V.status===void 0&&(V.status="fulfilled",V.value=X))},function(X){(I._status===0||I._status===-1)&&(I._status=2,I._result=X,V.status===void 0&&(V.status="rejected",V.reason=X))}),I._status===-1&&(I._status=0,I._result=V)}if(I._status===1)return I._result.default;throw I._result}var P=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)};function B(I){var H=w.T,V={};V.types=H!==null?H.types:null,w.T=V;try{var X=I(),ne=w.S;ne!==null&&ne(V,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(h,P)}catch(Y){P(Y)}finally{H!==null&&V.types!==null&&(H.types=V.types),w.T=H}}function U(I){var H=w.T;if(H!==null){var V=H.types;V===null?H.types=[I]:V.indexOf(I)===-1&&V.push(I)}else B(U.bind(null,I))}var F={map:N,forEach:function(I,H,V){N(I,function(){H.apply(this,arguments)},V)},count:function(I){var H=0;return N(I,function(){H++}),H},toArray:function(I){return N(I,function(H){return H})||[]},only:function(I){if(!T(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return He.Activity=b,He.Children=F,He.Component=m,He.Fragment=r,He.Profiler=o,He.PureComponent=f,He.StrictMode=n,He.Suspense=g,He.ViewTransition=C,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,He.__COMPILER_RUNTIME={__proto__:null,c:function(I){return w.H.useMemoCache(I)}},He.addTransitionType=U,He.cache=function(I){return function(){return I.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(I,H,V){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var X=l({},I.props),ne=I.key;if(H!=null)for(Y in H.key!==void 0&&(ne=""+H.key),H)!O.call(H,Y)||Y==="key"||Y==="__self"||Y==="__source"||Y==="ref"&&H.ref===void 0||(X[Y]=H[Y]);var Y=arguments.length-2;if(Y===1)X.children=V;else if(1<Y){for(var W=Array(Y),J=0;J<Y;J++)W[J]=arguments[J+2];X.children=W}return M(I.type,ne,X)},He.createContext=function(I){return I={$$typeof:c,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:i,_context:I},I},He.createElement=function(I,H,V){var X,ne={},Y=null;if(H!=null)for(X in H.key!==void 0&&(Y=""+H.key),H)O.call(H,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(ne[X]=H[X]);var W=arguments.length-2;if(W===1)ne.children=V;else if(1<W){for(var J=Array(W),G=0;G<W;G++)J[G]=arguments[G+2];ne.children=J}if(I&&I.defaultProps)for(X in W=I.defaultProps,W)ne[X]===void 0&&(ne[X]=W[X]);return M(I,Y,ne)},He.createRef=function(){return{current:null}},He.forwardRef=function(I){return{$$typeof:d,render:I}},He.isValidElement=T,He.lazy=function(I){return{$$typeof:E,_payload:{_status:-1,_result:I},_init:L}},He.memo=function(I,H){return{$$typeof:_,type:I,compare:H===void 0?null:H}},He.startTransition=B,He.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},He.use=function(I){return w.H.use(I)},He.useActionState=function(I,H,V){return w.H.useActionState(I,H,V)},He.useCallback=function(I,H){return w.H.useCallback(I,H)},He.useContext=function(I){return w.H.useContext(I)},He.useDebugValue=function(){},He.useDeferredValue=function(I,H){return w.H.useDeferredValue(I,H)},He.useEffect=function(I,H){return w.H.useEffect(I,H)},He.useEffectEvent=function(I){return w.H.useEffectEvent(I)},He.useId=function(){return w.H.useId()},He.useImperativeHandle=function(I,H,V){return w.H.useImperativeHandle(I,H,V)},He.useInsertionEffect=function(I,H){return w.H.useInsertionEffect(I,H)},He.useLayoutEffect=function(I,H){return w.H.useLayoutEffect(I,H)},He.useMemo=function(I,H){return w.H.useMemo(I,H)},He.useOptimistic=function(I,H){return w.H.useOptimistic(I,H)},He.useReducer=function(I,H,V){return w.H.useReducer(I,H,V)},He.useRef=function(I){return w.H.useRef(I)},He.useState=function(I){return w.H.useState(I)},He.useSyncExternalStore=function(I,H,V){return w.H.useSyncExternalStore(I,H,V)},He.useTransition=function(){return w.H.useTransition()},He.version="19.3.0",He}var Oa;function Fd(){return Oa||(Oa=1,Li.exports=Bd()),Li.exports}Fd();function zd(t){return(t==null?void 0:t.currentCSSZoom)||1}function Hd(t,e,r,n,o,i,c={}){const{anchorTop:d=e,prefer:g="below",center:_=!1,margin:E=8}=c,b=Math.max(E,Math.min(_?t-r/2:t,o-r-E)),C=l=>l>=E&&l+n<=i-E,A=e,a=d-n,s=g==="above"?[a,A]:[A,a];for(const l of s)if(C(l))return{left:b,top:l};return{left:b,top:Math.max(E,Math.min(s[0],i-n-E))}}const Oi=`:host {
|
|
18
|
+
/* 「经典」(id cream) 2026-07-10 四改终稿:炭黑强调 × #f8f7f6 中性背景族(与 skins.css cream 同步)。 */
|
|
19
|
+
--bg: #f8f7f6;
|
|
20
|
+
--bg-card: #fdfdfc;
|
|
21
|
+
--bg-glass: rgba(248, 247, 246, 0.9);
|
|
22
|
+
--sidebar-bg: #f2f1ef;
|
|
23
|
+
--text: #1c1c1c;
|
|
24
|
+
--text-light: rgba(28, 28, 28, 0.82);
|
|
25
|
+
--text-muted: #5f5f5d;
|
|
26
|
+
--text-faint: #726c67;
|
|
27
|
+
--text-ghost: rgba(28, 28, 28, 0.28);
|
|
28
|
+
--border: #eae9e7;
|
|
29
|
+
--border-width: 1px;
|
|
30
|
+
--shadow: rgba(0, 0, 0, 0.05);
|
|
31
|
+
--accent: #1c1c1c;
|
|
32
|
+
/* 可读强调色:accent 作前景(选中文字/图标/高亮底/聚焦边)一律用它——custom 按 WCAG 对比度
|
|
33
|
+
* 自动收敛,正常深 accent 下恒等(此兜底 var() 在使用处解析,跟随一切覆盖)。 */
|
|
34
|
+
--accent-ink: var(--accent);
|
|
35
|
+
--accent-hover: #000000;
|
|
36
|
+
--accent-light: rgba(28, 28, 28, 0.05);
|
|
37
|
+
--accent-rgb: 28, 28, 28;
|
|
38
|
+
--green: #4f6f52;
|
|
39
|
+
--danger: #a3503f;
|
|
40
|
+
--on-danger: #ffffff;
|
|
41
|
+
--danger-light: rgba(163, 80, 63, 0.08);
|
|
42
|
+
--warning: #806000;
|
|
43
|
+
--model-tag-blue: #2877b8;
|
|
44
|
+
--model-tag-purple: #8254b3;
|
|
45
|
+
--warning-light: rgba(128, 96, 0, 0.1);
|
|
46
|
+
--overlay-subtle: rgba(28, 28, 28, 0.03);
|
|
47
|
+
--overlay-light: rgba(28, 28, 28, 0.04);
|
|
48
|
+
--overlay-medium: rgba(28, 28, 28, 0.07);
|
|
49
|
+
--overlay-strong: rgba(28, 28, 28, 0.14);
|
|
50
|
+
--radius-sm: 6px;
|
|
51
|
+
--radius-md: 12px;
|
|
52
|
+
--radius-lg: 16px;
|
|
53
|
+
--radius-chat-surface: var(--radius-lg);
|
|
54
|
+
--radius-chat-card: var(--radius-md);
|
|
55
|
+
--font-ui: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
56
|
+
/* Application chrome: six roles. Reading/editor content owns its own scale. */
|
|
57
|
+
--ui-font-caption: 11px;
|
|
58
|
+
--ui-font-meta: 12px;
|
|
59
|
+
--ui-font-body: 13px;
|
|
60
|
+
--ui-font-heading: 14px;
|
|
61
|
+
--ui-font-title: 16px;
|
|
62
|
+
--ui-font-display: 20px;
|
|
63
|
+
--ui-line-caption: 14px;
|
|
64
|
+
--ui-line-meta: 18px;
|
|
65
|
+
--ui-line-body: 18px;
|
|
66
|
+
--ui-line-heading: 20px;
|
|
67
|
+
--ui-line-title: 22px;
|
|
68
|
+
--ui-line-display: 28px;
|
|
69
|
+
--ui-control-height: 28px;
|
|
70
|
+
--ui-control-pad-block: 4px;
|
|
71
|
+
--radius-pill: 999px;
|
|
72
|
+
--font-body: var(--font-ui);
|
|
73
|
+
--font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
|
|
74
|
+
--user-bg: rgba(28, 28, 28, 0.04);
|
|
75
|
+
--tool-bg: rgba(28, 28, 28, 0.03);
|
|
76
|
+
--tool-text: #5f5f5d;
|
|
77
|
+
--panel-blur: none;
|
|
78
|
+
/* 契约别名:组件历史上引用的「幽灵 token」(契约里没有 → 之前永远落硬编码兜底)。
|
|
79
|
+
* 指向真 token,免逐文件改;var() 在使用处解析 → 随明暗/配色自动得正确值。 */
|
|
80
|
+
--text-dim: var(--text-faint);
|
|
81
|
+
--bg-hover: var(--overlay-light);
|
|
82
|
+
--bg-input: var(--bg-card);
|
|
83
|
+
--accent-soft: var(--accent-light);
|
|
84
|
+
--overlay-scrim: rgba(0, 0, 0, 0.35);
|
|
85
|
+
/* 选中态:细线 --sel-line + 淡填充 --sel-fill。别直接拿 --accent-ink 描边——单色配色下它深色态近白、
|
|
86
|
+
* 浅色态近黑,满强度描一圈就是「深色太亮 / 浅色太黑」。36% 是实测出来的:45% 时单色配色暗色态还有
|
|
87
|
+
* 3.66:1(仍旧「太亮」),36% 落到 1.33–2.89 全区间内。调这个数必跑 npm run check:settingsui ——
|
|
88
|
+
* 它按 主题×配色×明暗 24 组合钉住上下限。
|
|
89
|
+
* ⚠️ 别名里的 var() 在**声明处**(:host)解析,不是使用处 —— 好在主题包一律把 token 写到 :host,
|
|
90
|
+
* 所以这里成立。ponytail: 哪天有作用域在 :host 之下自己改 --accent(如 .tangu-lovable 那层),
|
|
91
|
+
* 它下面的 --sel-line 会是 :host 的旧值,那时在该作用域补一条同名声明即可。
|
|
92
|
+
* ⚠️⚠️ 这里**先给不含 color-mix 的值**,再在 @supports 里换成 color-mix —— 顺序不能反,也不能只写
|
|
93
|
+
* color-mix 版:自定义属性永远「合法」,不支持 color-mix 的浏览器(Chrome <111 / Safari <16.2,
|
|
94
|
+
* frontend 也会被 npm run web 当普通网页跑)是在**使用处**才失效,而 border-color 的
|
|
95
|
+
* invalid-at-computed-value-time 结果是 \`unset\` → 落到初始值 \`currentColor\` = 正文色,
|
|
96
|
+
* 深色态近白、浅色态近黑 —— 比没修之前还刺眼。不是「优雅降级」,是反向劣化。 */
|
|
97
|
+
--sel-line: var(--overlay-strong);
|
|
98
|
+
--sel-fill: var(--accent-light);
|
|
99
|
+
/* 选中/聚焦圈的**线宽单点**(2026-08-13 用户拍板由 2px 减半)。全端一切 focus ring / 选中描边
|
|
100
|
+
一律 \`var(--focus-ring)\`,别再各写各的 px —— 用户问的「这个选中效果应该是统一的吧」答案就在这。
|
|
101
|
+
仪器:npm run check:focusring(会把仓里所有硬编码的圈宽揪出来)。 */
|
|
102
|
+
--focus-ring: 1px;
|
|
103
|
+
/* 菜单几何:操作菜单保持轻巧;带选择/搜索的菜单与工作区行使用同一 224px 节奏。
|
|
104
|
+
* 具体组件只消费这组 token,不再各写一套 168/224/260/264px。 */
|
|
105
|
+
--menu-action-min: 168px;
|
|
106
|
+
--menu-action-max: 184px;
|
|
107
|
+
--menu-select-width: 224px;
|
|
108
|
+
--menu-shell-padding: 4px;
|
|
109
|
+
/* The note More menu is the approved reading reference; keep its scale independent of compact controls. */
|
|
110
|
+
--menu-text-size: var(--ui-font-heading);
|
|
111
|
+
--menu-line-height: var(--ui-line-heading);
|
|
112
|
+
--menu-item-min-height: 32px;
|
|
113
|
+
--menu-item-pad-block: 6px;
|
|
114
|
+
--menu-item-pad-inline: 8px;
|
|
115
|
+
/* 菜单行 hover / 键盘选中底:所有二级菜单(右键 / slash / @ / 命令面板 / composer 下拉 / ribbon)统一消费。
|
|
116
|
+
* 取 --overlay-medium(明 0.07 / 暗 0.08,Notion 选中底 0.08)而非 --overlay-light:0.04 在浅底上几乎看不见
|
|
117
|
+
* (用户 09-05 实报);须保持中性色,不许换成 accent 调。 */
|
|
118
|
+
--menu-hover: var(--overlay-medium);
|
|
119
|
+
/* Database reading scale (DESIGN.md §6): values/actions share one size;
|
|
120
|
+
* metadata is one step quieter. Portals and embedded/standalone views use the same tokens. */
|
|
121
|
+
--db-text-size: var(--ui-font-body);
|
|
122
|
+
--db-meta-size: var(--ui-font-meta);
|
|
123
|
+
--db-line-height: 20px;
|
|
124
|
+
--db-meta-line-height: var(--ui-line-meta);
|
|
125
|
+
--db-title-size: var(--ui-font-title);
|
|
126
|
+
--db-title-line-height: var(--ui-line-title);
|
|
127
|
+
--db-cell-height: 32px;
|
|
128
|
+
--db-cell-pad-block: 6px;
|
|
129
|
+
--db-cell-pad-inline: 8px;
|
|
130
|
+
--db-control-height: var(--ui-control-height);
|
|
131
|
+
--db-control-pad-block: var(--ui-control-pad-block);
|
|
132
|
+
--db-chip-height: 20px;
|
|
133
|
+
--db-page-title-size: 30px;
|
|
134
|
+
--db-page-text-size: 16px;
|
|
135
|
+
--db-page-line-height: 26px;
|
|
136
|
+
--duration-instant: 0.1s;
|
|
137
|
+
--duration-fast: 0.15s;
|
|
138
|
+
--duration-slow: 0.25s;
|
|
139
|
+
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
140
|
+
/* 「agent 切换」同款灵动曲线(轻微过冲);用于展开/弹出等微动效,全局统一 taste */
|
|
141
|
+
--ease-spring: cubic-bezier(0.2, 0.8, 0.3, 1);
|
|
142
|
+
/* ── 空间高程 token(明暗统一材质见下方 :host 规则) ── */
|
|
143
|
+
--on-accent: #fbfbfa;
|
|
144
|
+
--on-accent-ink: var(--on-accent);
|
|
145
|
+
/* 鲜艳 --accent 是品牌/氛围色,不保证适合承载文字;有文字或图标的实心交互统一走这组。
|
|
146
|
+
* light 下通常 = 较深 accent-ink + 浅字,dark 下 = 较亮 accent-ink + 深字,避免“亮珊瑚按钮配黑字”
|
|
147
|
+
* 虽过 AA 却观感反常。别在组件里自己猜黑白。 */
|
|
148
|
+
--action-fill: var(--accent-ink);
|
|
149
|
+
--action-fill-hover: var(--accent-ink);
|
|
150
|
+
--on-action: var(--on-accent-ink);
|
|
151
|
+
--inset: rgba(255, 255, 255, 0.2) 0 0.5px 0 0 inset, rgba(0, 0, 0, 0.2) 0 0 0 0.5px inset, rgba(0, 0, 0, 0.05) 0 1px 2px 0;
|
|
152
|
+
--focus: rgba(0, 0, 0, 0.1) 0 4px 12px;
|
|
153
|
+
--card-shadow: 0 1px 2px rgba(42, 36, 26, 0.04), 0 10px 26px rgba(42, 36, 26, 0.05);
|
|
154
|
+
--btn-shadow: var(--inset);
|
|
155
|
+
--icon-shadow: var(--inset);
|
|
156
|
+
}
|
|
157
|
+
:host([data-mode="dark"]) {
|
|
158
|
+
--bg: #2a292b;
|
|
159
|
+
--bg-card: #323134;
|
|
160
|
+
--bg-glass: rgba(28, 26, 22, 0.9);
|
|
161
|
+
--sidebar-bg: #262528;
|
|
162
|
+
--text: #f2efe8;
|
|
163
|
+
--text-light: rgba(242, 239, 232, 0.82);
|
|
164
|
+
--text-muted: #aca59b;
|
|
165
|
+
--text-faint: #a39e98;
|
|
166
|
+
--text-ghost: rgba(242, 239, 232, 0.3);
|
|
167
|
+
/* ⚠️ 曾是 #34302a(奶油暖调残留):比当时本块的中性 --bg-card #353538 还**暗**,卡片/胶囊在暗色下
|
|
168
|
+
* 全被描了一圈黑边(用户实报)。暗色里的边线必须比所在表面亮,浅色里必须比表面暗——
|
|
169
|
+
* 这条不变量由 scripts/settings-ui.check.cjs 逐主题×明暗钉住。 */
|
|
170
|
+
--border: #3e3d41;
|
|
171
|
+
--shadow: rgba(0, 0, 0, 0.4);
|
|
172
|
+
--accent: #f8f7f6;
|
|
173
|
+
--accent-hover: #f9f8f8;
|
|
174
|
+
--accent-light: rgba(248, 247, 246, 0.16);
|
|
175
|
+
--accent-rgb: 248, 247, 246;
|
|
176
|
+
--on-accent: #161018;
|
|
177
|
+
--green: #8fb295;
|
|
178
|
+
--danger: #d99080;
|
|
179
|
+
--on-danger: #161018;
|
|
180
|
+
--danger-light: rgba(217, 144, 128, 0.12);
|
|
181
|
+
--warning: #e0b85b;
|
|
182
|
+
--model-tag-blue: #73b9ef;
|
|
183
|
+
--model-tag-purple: #bc9be8;
|
|
184
|
+
--warning-light: rgba(224, 184, 91, 0.14);
|
|
185
|
+
--overlay-subtle: rgba(242, 239, 232, 0.03);
|
|
186
|
+
--overlay-light: rgba(242, 239, 232, 0.05);
|
|
187
|
+
--overlay-medium: rgba(242, 239, 232, 0.08);
|
|
188
|
+
--overlay-strong: rgba(242, 239, 232, 0.15);
|
|
189
|
+
--user-bg: rgba(248, 247, 246, 0.16);
|
|
190
|
+
--tool-bg: rgba(242, 239, 232, 0.04);
|
|
191
|
+
--tool-text: #b0a99f;
|
|
192
|
+
--card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px rgba(0, 0, 0, 0.35);
|
|
193
|
+
--btn-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
|
194
|
+
--icon-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
|
195
|
+
--glow: radial-gradient(110% 75% at 82% -12%, rgba(206, 192, 168, 0.12), transparent 56%);
|
|
196
|
+
--overlay-scrim: rgba(0, 0, 0, 0.55);
|
|
197
|
+
}
|
|
198
|
+
@supports (color: color-mix(in srgb, red 50%, transparent)) {
|
|
199
|
+
:host {
|
|
200
|
+
--sel-line: color-mix(in srgb, var(--accent-ink) 36%, transparent);
|
|
201
|
+
--sel-fill: color-mix(in srgb, var(--accent-ink) 7%, var(--bg-card));
|
|
202
|
+
/* 向正文色轻推:亮色把深填充再压暗,暗色把亮填充再提亮;两边都只会提高与 on-action 的对比。 */
|
|
203
|
+
--action-fill-hover: color-mix(in srgb, var(--accent-ink) 88%, var(--text));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
:host([data-mode='light']) {
|
|
207
|
+
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.025), 0 8px 24px -6px rgba(0, 0, 0, 0.05);
|
|
208
|
+
--btn-shadow: none;
|
|
209
|
+
--icon-shadow: none;
|
|
210
|
+
}
|
|
211
|
+
:host([data-mode='dark']) {
|
|
212
|
+
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 8px 24px -6px rgba(0, 0, 0, 0.18);
|
|
213
|
+
--btn-shadow: none;
|
|
214
|
+
--icon-shadow: none;
|
|
215
|
+
}
|
|
216
|
+
:host([data-mode])[data-flat='1'] {
|
|
217
|
+
--card-shadow: none;
|
|
218
|
+
--btn-shadow: none;
|
|
219
|
+
--icon-shadow: none;
|
|
220
|
+
}
|
|
221
|
+
:host([data-mode='light']) { color-scheme: light; }
|
|
222
|
+
:host([data-mode='dark']) { color-scheme: dark; }
|
|
223
|
+
:host {
|
|
224
|
+
--menu-enter-duration: 180ms;
|
|
225
|
+
--menu-enter-ease: cubic-bezier(0.2, 0, 0.2, 1);
|
|
226
|
+
}
|
|
227
|
+
:host{all:initial;position:fixed;inset:0;pointer-events:none;z-index:2147483647;font-family:var(--font-ui);color:var(--text);color-scheme:light}
|
|
228
|
+
:host([data-mode="dark"]){color-scheme:dark}
|
|
229
|
+
*,*::before,*::after{box-sizing:border-box}
|
|
230
|
+
[hidden]{display:none!important}
|
|
231
|
+
button,input,select,textarea{font:inherit;color:inherit}
|
|
232
|
+
button{appearance:none;border:0;background:transparent;cursor:pointer;border-radius:var(--radius-sm);padding:5px 8px;line-height:var(--ui-line-body)}
|
|
233
|
+
button:hover{background:var(--menu-hover)}button:disabled{opacity:.45;cursor:default}
|
|
234
|
+
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:var(--focus-ring) solid var(--accent-ink);outline-offset:1px}
|
|
235
|
+
.surface{position:fixed;pointer-events:auto;color:var(--text);background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--card-shadow);font:var(--ui-font-body)/var(--ui-line-body) var(--font-ui);max-width:calc(100vw - 16px)}
|
|
236
|
+
.bar{display:flex;align-items:center;flex-wrap:wrap;gap:2px;padding:var(--menu-shell-padding);width:max-content}
|
|
237
|
+
.bar button{white-space:nowrap}.dot{width:20px;height:20px;padding:0;margin:4px;border:1px solid var(--overlay-strong);border-radius:50%}.dot[aria-checked=true]{outline:1px solid var(--text-muted);outline-offset:2px}.palette::before{content:"";display:inline-block;width:9px;height:9px;background:var(--highlight-color);border:1px solid var(--border);border-radius:50%;margin-right:5px}
|
|
238
|
+
.colors{display:flex;align-items:center;gap:1px;padding:0 4px}.sep{width:1px;height:18px;background:var(--border);margin:0 3px}
|
|
239
|
+
.submenu{padding:var(--menu-shell-padding);min-width:150px;display:grid;max-height:calc(100vh - 16px);overflow:auto}.submenu button{text-align:left;font-size:var(--menu-text-size)}.submenu.colors{display:flex;min-width:0;padding:6px}.note-tooltip{padding:8px 10px;width:280px;white-space:pre-wrap;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;pointer-events:auto;color:var(--text-muted);font-size:var(--ui-font-meta)}
|
|
240
|
+
.note-editor{display:grid;gap:8px;padding:12px;width:320px}.note-editor textarea{resize:vertical;min-height:84px;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-sm);padding:8px}.note-editor footer{display:flex;justify-content:flex-end;gap:4px}
|
|
241
|
+
.result{width:420px;max-height:calc(100vh - 32px);display:flex;flex-direction:column;overflow:hidden}
|
|
242
|
+
.result header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;border-bottom:1px solid var(--border);cursor:move;touch-action:none;flex-shrink:0}.result header strong{font-size:var(--ui-font-heading);font-weight:600}.result header span{font-size:var(--ui-font-meta);color:var(--text-muted)}
|
|
243
|
+
.result .source{margin:12px 14px 0;padding-left:10px;border-left:2px solid var(--border);color:var(--text-muted);font-size:var(--ui-font-meta);white-space:pre-wrap;overflow-wrap:anywhere;max-height:100px;overflow:auto;flex-shrink:0}
|
|
244
|
+
.result .tools{display:flex;align-items:center;flex-wrap:wrap;gap:4px;padding:8px 10px;border-bottom:1px solid var(--border);flex-shrink:0}.result .tools select{max-width:150px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-card);padding:4px;font-size:var(--ui-font-meta)}
|
|
245
|
+
.result .output{padding:12px 14px;overflow:auto;min-height:74px;line-height:1.65;overflow-wrap:anywhere;user-select:text}.result .output>:first-child{margin-top:0}.result .output>:last-child{margin-bottom:0}.result .output h1,.result .output h2,.result .output h3{font-size:var(--ui-font-heading);line-height:1.45}.result .output pre{overflow:auto;background:var(--bg);padding:10px;border-radius:var(--radius-sm)}.result .output code{font-family:var(--font-mono)}.result .output blockquote{margin:8px 0;padding-left:10px;border-left:2px solid var(--border)}.result .output table{border-collapse:collapse}.result .output td,.result .output th{border:1px solid var(--border);padding:4px 6px}.result .output a{color:var(--accent-ink)}
|
|
246
|
+
.result .status{margin:0;padding:2px 14px 10px;color:var(--text-muted);font-size:var(--ui-font-meta);overflow-wrap:anywhere}.result .status.error{color:var(--danger)}
|
|
247
|
+
.result footer{display:flex;flex-wrap:wrap;align-items:center;gap:4px;padding:8px 10px;border-top:1px solid var(--border);flex-shrink:0}.result footer .providers{display:flex;margin-right:auto;gap:2px}.providers [aria-current=true]{background:var(--accent-light);font-weight:600}.result .empty{color:var(--text-muted)}
|
|
248
|
+
.image-highlight{padding:6px 10px}
|
|
249
|
+
@media(prefers-reduced-motion:no-preference){.surface{animation:clip-menu-enter .12s ease-out}@keyframes clip-menu-enter{from{opacity:0;scale:.99}to{opacity:1;scale:1}}}
|
|
250
|
+
`;function Ri(t,e="system"){var o;const r=(o=window.matchMedia)==null?void 0:o.call(window,"(prefers-color-scheme: dark)"),n=()=>t.setAttribute("data-mode",e==="system"?r!=null&&r.matches?"dark":"light":e);return n(),r==null||r.addEventListener("change",n),()=>r==null?void 0:r.removeEventListener("change",n)}function fn(t,e,r,n=r,o=!1){const i=zd(t);t.style.maxWidth=`${Math.max(80,(window.innerWidth-16)/i)}px`;const c=Hd(e,r,t.offsetWidth*i,t.offsetHeight*i,window.innerWidth,window.innerHeight,{anchorTop:n,center:o,margin:8});t.style.left=`${c.left/i}px`,t.style.top=`${c.top/i}px`}function Ra(t,e){let r=t.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?t.commonAncestorContainer:t.commonAncestorContainer.parentElement;r=(r==null?void 0:r.closest("p,li,blockquote,td,th,h1,h2,h3,h4,article,main"))||r;const n=((r==null?void 0:r.textContent)||"").replace(/\s+/g," ").trim(),o=n.split(new RegExp("(?<=[.!?。!?])\\s*")).find(i=>i.includes(e));return{...o&&o!==e?{sentence:o.slice(0,3e3)}:{},...n&&n!==e?{paragraph:n.slice(0,8e3)}:{}}}function Ud(t){const e=document.createElement("div");e.append(t.cloneContents());const r=t.toString().trim(),n=t.getBoundingClientRect();return{text:r,html:e.innerHTML,context:Ra(t,r),anchor:{left:n.left,top:n.top,right:n.right,bottom:n.bottom,width:n.width,height:n.height}}}function Xt(t,e,r=""){const n=document.createElement("button");return n.type="button",n.textContent=t,n.title=t,n.className=r,n.addEventListener("mousedown",o=>{o.isTrusted&&o.preventDefault()}),n.addEventListener("click",o=>{o.isTrusted&&(o.preventDefault(),o.stopPropagation(),e())}),n}function Ii(t){const e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function Ia(t,e="|"){return t.map(r=>Fa(r)).join(e)}function Mi(t,e){return typeof e=="bigint"?e.toString():e}class jd{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}}function $i(t){return new jd(t)}function Wd(t){return t==null}function Pi(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Vd(t,e){const r=t/e,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}function Pr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ma(t){const e=Object.getOwnPropertyDescriptor(t,"shape");return e!=null&&e.get?e.get.raw:e==null?void 0:e.value}function Tr(t){return Ma(t._zod.def)??t._zod.def.shape}function $a(t,e,r){Object.defineProperty(t,e,{get(){const n=r();return Pr(this,e,n),n},enumerable:!0,configurable:!0})}function Pa(t,e,r){e in t?Pr(t,e,r):t[e]=r}function Kr(t,e,r,n){const o=Tr(e);for(const i of r){const c=Object.getOwnPropertyDescriptor(o,i);c.enumerable&&(c.get?$a(t,i,()=>{const d=e._zod.def.shape[i];return n?n(d,i):d}):Pa(t,i,n?n(c.value,i):c.value))}}function Zd(t,e){for(const r of Reflect.ownKeys(e)){const n=Object.getOwnPropertyDescriptor(e,r);n.enumerable&&(n.get?$a(t,r,()=>e[r]):Pa(t,r,n.value))}}function Kt(...t){const e={};for(const r of t){const n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Gd(t){return JSON.stringify(t)}function Yd(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const qa="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function vo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Jd=$i(()=>{var t;if(gr.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function hn(t){if(vo(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const r=e.prototype;return!(vo(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ba(t){return hn(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const Xd=new Set(["string","number","symbol"]);function bo(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qr(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(n._zod.parent=t),n}function $e(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Fa(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Kd(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}const za={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Qd={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ef(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return Kr(i,t,xo(t,e)),qr(t,Kt(r,{shape:i,checks:[]}))}function xo(t,e){var o;const r=Tr(t),n=[];for(const i of Reflect.ownKeys(e)){if(!((o=Object.getOwnPropertyDescriptor(r,i))!=null&&o.enumerable))throw new Error(`Unrecognized key: "${String(i)}"`);e[i]&&n.push(i)}return n}function tf(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(xo(t,e)),c={};return Kr(c,t,Reflect.ownKeys(Tr(t)).filter(d=>!i.has(d))),qr(t,Kt(r,{shape:c,checks:[]}))}function rf(t,e){if(!hn(e))throw new Error("Invalid input to extend: expected a plain object");const r=t._zod.def.checks;if(r&&r.length>0){const o=Tr(t);for(const i of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return qr(t,Kt(t._zod.def,{shape:Ha(t,e)}))}function Ha(t,e){const r={};return Kr(r,t,Reflect.ownKeys(Tr(t))),Zd(r,e),r}function nf(t,e){if(!hn(e))throw new Error("Invalid input to safeExtend: expected a plain object");return qr(t,Kt(t._zod.def,{shape:Ha(t,e)}))}function of(t,e){var o,i;if(!((o=e==null?void 0:e._zod)!=null&&o.def))throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if((i=t._zod.def.checks)!=null&&i.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r={};Kr(r,t,Reflect.ownKeys(Tr(t))),Kr(r,e,Reflect.ownKeys(Tr(e)));const n=Kt(t._zod.def,{shape:r,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return qr(t,n)}function Ua(t,e,r,n="partial"){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);const d=r?new Set(xo(e,r)):void 0,g={};return Kr(g,e,Reflect.ownKeys(Tr(e)),t&&((_,E)=>d&&!d.has(E)?_:new t({type:"optional",innerType:_}))),qr(e,Kt(e._zod.def,{shape:g,checks:[]}))}function sf(t,e,r){const n=r?new Set(xo(e,r)):void 0,o={};return Kr(o,e,Reflect.ownKeys(Tr(e)),(i,c)=>n&&!n.has(c)?i:new t({type:"nonoptional",innerType:i})),qr(e,Kt(e._zod.def,{shape:o}))}function Dr(t,e=0){var r;if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function af(t,e=0){var r;if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)===!1)return!0;return!1}function mn(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function In(t){return typeof t=="string"?t:t==null?void 0:t.message}function ja(t){const e=[];for(const r of t??[]){const n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;const o=n.maximum??n.length??n.size;o>=0&&e.push([o,r])}return e}function qi(t,e,r){var n;for(let o=e;o<t.length;o++)(n=t[o]).schema??(n.schema=r)}function Br(t,e,r){var g,_,E,b,C,A,a,s,l,u;var n;const o=(_=(g=t.inst)==null?void 0:g._zod)==null?void 0:_.traits;o!=null&&o.has("$ZodType")&&(o.has("$ZodCheck")?(n=t).schema??(n.schema=t.inst):t.schema=t.inst);const i=t.schema!==t.inst?(b=(E=t.schema)==null?void 0:E._zod.def)==null?void 0:b.error:void 0,c=t.message?t.message:In((a=(A=(C=t.inst)==null?void 0:C._zod.def)==null?void 0:A.error)==null?void 0:a.call(A,t))??In(i==null?void 0:i(t))??In((s=e==null?void 0:e.error)==null?void 0:s.call(e,t))??In((l=r.customError)==null?void 0:l.call(r,t))??In((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input",d={};for(const m of Object.keys(t))m==="inst"||m==="schema"||m==="continue"||m==="input"||m==="__proto__"||(d[m]=t[m]);return d.path??(d.path=[]),d.message=c,e!=null&&e.reportInput&&(d.input=t.input),d}const lf=/[\uD800-\uDBFF]/;function Bi(t){const e=t.length;if(!lf.test(t))return e;let r=e;for(let n=0;n<e-1;n++)(t.charCodeAt(n)&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Fi(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function cf(t){const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";const r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Mn(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function uf(t,e){for(const r in e){const n=Object.getOwnPropertyDescriptor(e,r);n.get?Object.defineProperty(t,r,{...n,enumerable:!1}):df(t,r,n.value)}}function Fr(t,e,r,n=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Wa(t,e,r){return Fr(t,e,r,!1)}function Va(t,e){for(const r in t){const n=t[r];Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){return Fr(this,r,n(this))},set(o){Fr(this,r,o)}})}return e}function df(t,e,r){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?r:Fr(this,e,r.bind(this))},set(n){Fr(this,e,n)}})}function ff(t,e){const r=Object.getPrototypeOf(t);return e in r?void 0:r}let zi,zr=!1;const hf={configurable:!0,get(){zr=!0}};function nt(t,e,r){const n=Object.getPrototypeOf(t._zod);if(e in n&&zi!==t._zod){zi=void 0;return}zi=t._zod,Object.defineProperty(n,e,{configurable:!0,get(){Object.defineProperty(this,e,hf);const o=zr;zr=!1;try{const i=r(this);return zr?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:i}),zr=zr||o,i}catch(i){throw delete this[e],zr=zr||o,i}},set(o){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:o})}})}function mf(t,e,r,n){const o=ff(t,e);o&&Object.defineProperty(o,e,{configurable:!0,get(){const i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,e,i),i.value=r(this),Object.defineProperty(this,e,i),i.value},set(i){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:n,value:i})}})}const pf="~constantCatch";function gf(t){const e=()=>t;return e[pf]=!0,e}var Za;const Hi={value:void 0,enumerable:!1};let Ga="captureStackTrace"in Error?Error:null;function vf(t){const e=Ga;if(e){const r=e.stackTraceLimit;if(typeof r=="number"){try{e.stackTraceLimit=0}catch{return Ga=null,new t}try{return new t}finally{e.stackTraceLimit=r}}}return new t}function pe(t,e,r,n){const o={};function i(C){this.def=C,this.constr=b,this.traits=new Set}i.prototype=o;const c=r,d=c&&new WeakSet;function g(C,A){if(C._zod){if(C._zod.traits.has(t))return}else{Hi.value=new i(A);try{Object.defineProperty(C,"_zod",Hi)}finally{Hi.value=void 0}}if(C._zod.traits.add(t),e(C,A),d){const s=Object.getPrototypeOf(C),l=C._zod.constr.prototype;let u=s;for(;u&&u!==l;)u=Object.getPrototypeOf(u);const m=u??s;d.has(m)||(d.add(m),uf(m,c))}const a=b.prototype;for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&(s in C||(C[s]=a[s].bind(C)))}const _=(n==null?void 0:n.Parent)??Object;class E extends _{}Object.defineProperty(E,"name",{value:t});function b(C){var l;const A=n!=null&&n.Parent?vf(E):this;g(A,C);const a=A._zod.deferred;if(a){for(const u of a)u();A._zod.deferred=void 0}const s=(l=globalThis.__zod_globalConfig)==null?void 0:l.postProcessor;return s&&s(A),A}return Object.defineProperty(b,"init",{value:g}),Object.defineProperty(b,Symbol.hasInstance,{value:C=>{var A,a;return n!=null&&n.Parent&&C instanceof n.Parent?!0:(a=(A=C==null?void 0:C._zod)==null?void 0:A.traits)==null?void 0:a.has(t)}}),Object.defineProperty(b,"name",{value:t}),b}class Qr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ya extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Za=globalThis).__zod_globalConfig??(Za.__zod_globalConfig={});const gr=globalThis.__zod_globalConfig;function Ar(t){return t&&Object.assign(gr,t),gr}function bf(){const t=this._zod;return t.message??(t.message=JSON.stringify(t.def,Mi,2)),t.message}function xf(t){this._zod.message=t}const yf={get:bf,set:xf,enumerable:!0,configurable:!0},Ui={value:void 0,enumerable:!1},Ja=new WeakSet([Object.prototype,Error.prototype]),Ef=pe("$ZodError",(t,e)=>{t.name="$ZodError",Ui.value=e,Object.defineProperty(t,"issues",Ui),Ui.value=void 0,Object.defineProperty(t,"message",yf);const r=Object.getPrototypeOf(t);Ja.has(r)||(Ja.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){const n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))});function Af(t,e,r){return Object.prototype.hasOwnProperty.call(t,e)||(e==="__proto__"?Object.defineProperty(t,e,{value:r(),writable:!0,enumerable:!0,configurable:!0}):t[e]=r()),t[e]}function wf(t,e=r=>r.message){const r={},n=[];for(const o of t.issues)o.path.length>0?Af(r,o.path[0],()=>[]).push(e(o)):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Cf(t,e=r=>r.message){const r={_errors:[]},n=(o,i=[])=>{for(const c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(d=>n({issues:d},[...i,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...i,...c.path]);else{const d=[...i,...c.path];if(d.length===0)r._errors.push(e(c));else{let g=r,_=0;for(;_<d.length;){const E=d[_],b=_===d.length-1;if(E==="_errors"){b&&g._errors.push(e(c)),_++;continue}Object.prototype.hasOwnProperty.call(g,E)||Object.defineProperty(g,E,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const C=g[E];b&&C._errors.push(e(c)),g=C,_++}}}};return n(t),r}function yo(t,e){return{callee:(e==null?void 0:e.callee)??t,Err:e==null?void 0:e.Err}}const ji=t=>{const e=(r,n,o,i)=>{const c=o?{...o,async:!1}:{async:!1},d=r._zod.run({value:n,issues:[]},c);if(d instanceof Promise)throw new Qr;if(d.issues.length){const g=new((i==null?void 0:i.Err)??t)(d.issues.map(_=>Br(_,c,Ar())));throw qa(g,(i==null?void 0:i.callee)??e),g}return d.value};return e},Wi=t=>{const e=async(r,n,o,i)=>{const c=o?{...o,async:!0}:{async:!0};let d=r._zod.run({value:n,issues:[]},c);if(d instanceof Promise&&(d=await d),d.issues.length){const g=new((i==null?void 0:i.Err)??t)(d.issues.map(_=>Br(_,c,Ar())));throw qa(g,(i==null?void 0:i.callee)??e),g}return d.value};return e},Vi=t=>(e,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Qr;return i.issues.length?Xa(t,i.issues,o):{success:!0,data:i.value}};function Xa(t,e,r){let n;return{success:!1,get error(){return n||(n=new t(e.map(o=>Br(o,r,Ar()))),e=void 0,r=void 0),n},set error(o){n=o,e=void 0,r=void 0}}}const Zi=t=>async(e,r,n)=>{const o=n?{...n,async:!0}:{async:!0};let i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?Xa(t,i.issues,o):{success:!0,data:i.value}},Sf=Symbol.for("zod.compile.invalid"),_f=Symbol.for("zod.compile.fallback"),Tf=((t,e,r)=>{const n=t._zod.bag.validator;if(n!==void 0){if(n(e)!==Sf)return!0;if(n.definite===!0&&r===void 0)return!1}return Df(t,e,r)});function Df(t,e,r){const n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=t._zod.bag.fallbackRun;let i;if(o?(n[_f]=!0,i=o({value:e,issues:[]},n)):i=t._zod.run({value:e,issues:[]},n),i instanceof Promise)throw new Qr;return i.issues.length===0}const kf=async(t,e,r)=>{const n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let o=t._zod.run({value:e,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},Nf=t=>{const e=ji(t),r=(n,o,i,c)=>{const d=i?{...i,direction:"backward"}:{direction:"backward"};return e(n,o,d,yo(r,c))};return r},Lf=t=>{const e=ji(t),r=(n,o,i,c)=>e(n,o,i,yo(r,c));return r},Of=t=>{const e=Wi(t),r=async(n,o,i,c)=>{const d=i?{...i,direction:"backward"}:{direction:"backward"};return await e(n,o,d,yo(r,c))};return r},Rf=t=>{const e=Wi(t),r=async(n,o,i,c)=>await e(n,o,i,yo(r,c));return r},If=t=>(e,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return Vi(t)(e,r,o)},Mf=t=>(e,r,n)=>Vi(t)(e,r,n),$f=t=>async(e,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return Zi(t)(e,r,o)},Pf=t=>async(e,r,n)=>Zi(t)(e,r,n),qf=/^[cC][0-9a-z]{6,}$/,Bf=/^[0-9a-z]+$/,Ff=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,zf=/^[0-9a-vA-V]{20}$/,Hf=/^[A-Za-z0-9]{27}$/,Uf=/^[a-zA-Z0-9_-]{21}$/;function jf(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}const Wf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Vf=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ka=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zf=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Gf="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Yf(){return new RegExp(Gf,"u")}const Jf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Kf=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,eh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,th=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,rh=/^https?$/,nh=/^\+[1-9]\d{6,14}$/,Qa="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function oh(t){return new RegExp(`^${t}$`)}const ih=oh(Qa);function Gi(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${e}:[0-5]\\d(?:\\.\\d+)?`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sh(t){return new RegExp(`^${Gi(t)}$`)}function ah(t){const e=["Z"];t.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${Gi({precision:t.precision,seconds:!0})}(?:${e.join("|")})`,n=t.local?`${r}|${Gi({precision:t.precision})}`:r;return new RegExp(`^${Qa}T(?:${n})$`)}const lh=/^[\s\S]{0,}$/,ch=/^-?\d+$/,Yi=/^-?\d+(?:\.\d+)?$/,uh=/^(?:true|false)$/i,dh=/^[^A-Z]*$/,fh=/^[^a-z]*$/,Wt=pe("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Ji=t=>{const e=t.value;return!Wd(e)&&e.length!==void 0},Eo={number:"number",bigint:"bigint",object:"date"},el=pe("$ZodCheckLessThan",(t,e)=>{Wt.init(t,e);const r=Eo[typeof e.value];t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:Eo[typeof n.value]??r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),tl=pe("$ZodCheckGreaterThan",(t,e)=>{Wt.init(t,e);const r=Eo[typeof e.value];t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:Eo[typeof n.value]??r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),hh=pe("$ZodCheckMultipleOf",(t,e)=>{Wt.init(t,e),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?e.value!==BigInt(0)&&r.value%e.value===BigInt(0):Vd(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),mh=pe("$ZodCheckNumberFormat",(t,e)=>{var c;Wt.init(t,e),e.format=e.format||"float64";const r=(c=e.format)==null?void 0:c.includes("int"),n=r?"int":"number",[o,i]=za[e.format];t._zod.check=d=>{const g=d.value;if(r){if(!Number.isInteger(g)){d.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:g,inst:t});return}if(!Number.isSafeInteger(g)){g>0?d.issues.push({input:g,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):d.issues.push({input:g,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}g<o&&d.issues.push({origin:"number",input:g,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),g>i&&d.issues.push({origin:"number",input:g,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),ph=pe("$ZodCheckMaxLength",(t,e)=>{var r;Wt.init(t,e),(r=t._zod.def).when??(r.when=Ji),t._zod.check=n=>{const o=n.value,i=o.length;if((typeof o=="string"&&i>e.maximum?Bi(o):i)<=e.maximum)return;const d=Fi(o);n.issues.push({origin:d,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),gh=pe("$ZodCheckMinLength",(t,e)=>{var r;Wt.init(t,e),(r=t._zod.def).when??(r.when=Ji),t._zod.check=n=>{const o=n.value,i=o.length;if((typeof o=="string"&&i>=e.minimum&&i<e.minimum*2?Bi(o):i)>=e.minimum)return;const d=Fi(o);n.issues.push({origin:d,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),vh=pe("$ZodCheckLengthEquals",(t,e)=>{var r;Wt.init(t,e),(r=t._zod.def).when??(r.when=Ji),t._zod.check=n=>{const o=n.value,i=o.length,c=typeof o=="string"&&i>=e.length&&i<=e.length*2?Bi(o):i;if(c===e.length)return;const d=Fi(o),g=c>e.length;n.issues.push({origin:d,...g?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Ao=pe("$ZodCheckStringFormat",(t,e)=>{var r,n;Wt.init(t,e),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),bh=pe("$ZodCheckRegex",(t,e)=>{Ao.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),xh=pe("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=dh),Ao.init(t,e)}),yh=pe("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=fh),Ao.init(t,e)}),Eh=pe("$ZodCheckIncludes",(t,e)=>{Wt.init(t,e);const r=bo(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position},}${r}`:r);e.pattern=n,t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Ah=pe("$ZodCheckStartsWith",(t,e)=>{Wt.init(t,e);const r=new RegExp(`^${bo(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),wh=pe("$ZodCheckEndsWith",(t,e)=>{Wt.init(t,e);const r=new RegExp(`.*${bo(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),Ch=pe("$ZodCheckOverwrite",(t,e)=>{Wt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Sh{constructor(e=[],r={}){this.content=[],this.indent=0,this.args=e,this.closed=r}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const n=e.split(`
|
|
251
|
+
`).filter(c=>c),o=Math.min(...n.map(c=>c.length-c.trimStart().length)),i=n.map(c=>c.slice(o)).map(c=>" ".repeat(this.indent*2)+c);for(const c of i)this.content.push(c)}compile(){const e=Function,r=(this==null?void 0:this.content)??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
252
|
+
${r.join(`
|
|
253
|
+
`)}
|
|
254
|
+
};`)(...Object.values(this.closed))}}const _h={major:4,minor:6,patch:7},Et=pe("$ZodType",(t,e)=>{var i;var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=_h;const n=t._zod.def.checks,o=t._zod.traits.has("$ZodCheck")?[t,...n??[]]:n!=null&&n.length?[...n]:[];for(const c of o)for(const d of c._zod.onattach)d(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),(i=t._zod.deferred)==null||i.push(()=>{t._zod.run=t._zod.parse});else{const c=(g,_,E)=>{if(g.memo)return g;let b=Dr(g),C;for(const A of _){if(A._zod.def.when){if(af(g)||!A._zod.def.when(g))continue}else if(b)continue;const a=g.issues.length,s=A._zod.check(g);if(s instanceof Promise&&(E==null?void 0:E.async)===!1)throw new Qr;if(C||s instanceof Promise)C=(C??Promise.resolve()).then(async()=>{await s,g.issues.length!==a&&(qi(g.issues,a,t),b||(b=Dr(g,a)))});else{if(g.issues.length===a)continue;qi(g.issues,a,t),b||(b=Dr(g,a))}}return C?C.then(()=>g):g},d=(g,_,E)=>{if(Dr(g))return g.aborted=!0,g;const b=c(_,o,E);if(b instanceof Promise){if(E.async===!1)throw new Qr;return b.then(C=>t._zod.parse(C,E))}return t._zod.parse(b,E)};t._zod.run=(g,_)=>{if(_.skipChecks)return t._zod.parse(g,_);if(_.direction==="backward"){const b=t._zod.parse({value:g.value,issues:[]},{..._,skipChecks:!0});return b instanceof Promise?b.then(C=>d(C,g,_)):d(b,g,_)}const E=t._zod.parse(g,_);if(E instanceof Promise){if(_.async===!1)throw new Qr;return E.then(b=>c(b,o,_))}return c(E,o,_)}}},{get"~standard"(){return Wa(this,"~standard",nl(this))},set"~standard"(t){Fr(this,"~standard",t)}}),rl=(t,e)=>t.issues.length?{issues:t.issues.map(r=>Br(r,e,Ar()))}:{value:t.value};async function Th(t,e){const r={async:!0};return rl(await t._zod.run({value:e,issues:[]},r),r)}function nl(t){return{validate:e=>{const r={async:!1};try{const n=t._zod.run({value:e,issues:[]},r);if(!(n instanceof Promise))return rl(n,r)}catch{}return Th(t,e)},vendor:"zod",version:1}}const Xi=pe("$ZodString",(t,e)=>{Et.init(t,e),t._zod.pattern=e.pattern??lh,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),ft=pe("$ZodStringFormat",(t,e)=>{Ao.init(t,e),Xi.init(t,e)}),Dh=pe("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Vf),ft.init(t,e)}),kh=pe("$ZodUUID",(t,e)=>{if(e.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ka(n))}else e.pattern??(e.pattern=Ka());ft.init(t,e)}),Nh=pe("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Zf),ft.init(t,e)}),ol=1,wo=2;function il(t){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(t):(new URL(t),!0)}catch{return!1}}function Lh(t,e){return!("normalize"in e)&&!("hostname"in e)&&!("protocol"in e)?il(t)||wo:Oh(t,e)}function Oh(t,e){var r;if(!e.normalize&&((r=e.protocol)==null?void 0:r.source)===rh.source&&!/^https?:\/\//i.test(t))return ol;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(t)??wo}return new URL(t)}catch{return wo}}const Rh=/[\t\n\r]/g;function sl(t){return t.replace(Rh,"")}function Ih(t,e){return e.lastIndex=0,e.test(t.hostname)}function Mh(t,e){return e.lastIndex=0,e.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}const $h=pe("$ZodURL",(t,e)=>{ft.init(t,e),t._zod.check=r=>{try{const n=r.value.trim(),o=Lh(n,e);if(o===ol){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}if(o===wo){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort});return}if(o===!0){r.value=sl(n);return}e.hostname&&!Ih(o,e.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort}),e.protocol&&!Mh(o,e.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}),r.value=e.normalize?o.href:sl(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Ph=pe("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Yf()),ft.init(t,e)}),qh=pe("$ZodNanoID",(t,e)=>{if(e.length!==void 0&&(!Number.isInteger(e.length)||e.length<1))throw new Error(`Invalid nanoid length: ${e.length}`);e.pattern??(e.pattern=e.length===void 0?Uf:jf(e.length)),ft.init(t,e)}),Bh=pe("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=qf),ft.init(t,e)}),Fh=pe("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Bf),ft.init(t,e)}),zh=pe("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Ff),ft.init(t,e)}),Hh=pe("$ZodXID",(t,e)=>{e.pattern??(e.pattern=zf),ft.init(t,e)}),Uh=pe("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Hf),ft.init(t,e)}),jh=pe("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=ah(e)),ft.init(t,e)}),Wh=pe("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=ih),ft.init(t,e)}),Vh=pe("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=sh(e)),ft.init(t,e)}),Zh=pe("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Wf),ft.init(t,e)}),Gh=pe("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Jf),ft.init(t,e)}),Yh=/^[0-9a-fA-F:.]+$/;function al(t){return Yh.test(t)?il(`http://[${t}]`):!1}const Jh=pe("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Xf),ft.init(t,e),t._zod.check=r=>{al(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}),Xh=pe("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Kf),ft.init(t,e)});function Kh(t){const e=t.split("/");if(e.length!==2)return!1;const[r,n]=e;if(!n)return!1;const o=Number(n);return`${o}`!==n||o<0||o>128?!1:al(r)}const Qh=pe("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Qf),ft.init(t,e),t._zod.check=r=>{Kh(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}});function ll(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const cl=/^[0-9a-zA-Z+/]*={0,2}$/,em=pe("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=cl),ft.init(t,e),t._zod.check=r=>{ll(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}}),Ki=/^[A-Za-z0-9_-]*$/;function tm(t){if(!Ki.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return ll(r)}const rm=pe("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ki),ft.init(t,e),t._zod.check=r=>{tm(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),nm=pe("$ZodE164",(t,e)=>{e.pattern??(e.pattern=nh),ft.init(t,e)});function om(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}const im=pe("$ZodJWT",(t,e)=>{ft.init(t,e),t._zod.check=r=>{om(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),ul=pe("$ZodNumber",(t,e)=>{Et.init(t,e),t._zod.pattern=Yi,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),sm=pe("$ZodNumberFormat",(t,e)=>{mh.init(t,e),ul.init(t,e)}),am=pe("$ZodBoolean",(t,e)=>{Et.init(t,e),t._zod.pattern=uh,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),lm=pe("$ZodUnknown",(t,e)=>{Et.init(t,e),t._zod.parse=r=>r}),cm=pe("$ZodNever",(t,e)=>{Et.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function um(t,e){const r=ja(t._zod.def.checks);if(!r.length)return;const n=Math.min(...r.map(i=>i[0])),o=t._zod.parse;t._zod.parse=(i,c)=>{const d=e(i.value);if(d>n&&!(c!=null&&c.skipChecks)&&(c==null?void 0:c.direction)!=="backward"){for(const[g,_]of ja(t._zod.def.checks))if(d>g&&_._zod.def.when(i)){const E=i.issues.length;return _._zod.check(i),i.issues[E].continue=!1,qi(i.issues,E,t),i}}return o(i,c)}}const dm=t=>Array.isArray(t)?t.length:-1;function dl(t,e,r){t.issues.length&&e.issues.push(...mn(r,t.issues)),e.value[r]=t.value}const fm=pe("$ZodArray",(t,e)=>{Et.init(t,e);const r=gr.memoizer;r==null||r.attach(t),t._zod.parse=(n,o)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=r?r.alloc(t,n,Array(i.length),o):Array(i.length);const c=[],d=o==null?void 0:o.abortEarly;for(let g=0;g<i.length;g++){const _=i[g],E=e.element._zod.run({value:_,issues:[]},o);if(E instanceof Promise)c.push(E.then(b=>dl(b,n,g)));else if(dl(E,n,g),d&&E.issues.length!==0&&Dr(E))break}return c.length?Promise.all(c).then(()=>n):n},um(t,dm)});function Co(t,e,r,n,o,i){const c=r in n,d=i==="optional";if(!(!c&&d&&o==="optional")){if(t.issues.length){if(o!==void 0&&d&&!c)return;e.issues.push(...mn(r,t.issues))}if(!c&&o===void 0){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?(c||o==="defaulted"&&!d)&&(e.value[r]=void 0):e.value[r]=t.value}}const hm=[];function fl(t){var c,d,g,_;const e=Object.keys(t.shape),r=Object.getOwnPropertySymbols(t.shape),n=r.length?r:hm,o=n.length?[...e,...n]:e;for(const E of o)if(!((_=(g=(d=(c=t.shape)==null?void 0:c[E])==null?void 0:d._zod)==null?void 0:g.traits)!=null&&_.has("$ZodType")))throw new Error(`Invalid element at key "${String(E)}": expected a Zod schema`);const i=Kd(t.shape);return{...t,allKeys:o,symbolKeys:n,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(i)}}function hl(t,e,r,n,o,i,c){const d=[],g=o.keySet,_=o.catchall._zod,E=_.def.type,b=_.optin,C=_.optout;let A=0;for(const a in e){if(c&&r.issues.length!==A){if(Dr(r,A))break;A=r.issues.length}if(g.has(a))continue;if(a==="__proto__"){E==="never"&&d.push(a);continue}if(E==="never"){d.push(a);continue}const s=_.run({value:e[a],issues:[]},n);s instanceof Promise?t.push(s.then(l=>Co(l,r,a,e,b,C))):Co(s,r,a,e,b,C)}return d.length&&r.issues.push({code:"unrecognized_keys",keys:d,input:e,inst:i,continue:!0}),t.length?Promise.all(t).then(()=>r):r}const mm=pe("$ZodObject",(t,e)=>{Et.init(t,e);const r=Object.getOwnPropertyDescriptor(e,"shape"),n=r!=null&&r.get?r.get.raw:e.shape??{};if(n){const _=()=>{const E={...n};return Object.defineProperty(e,"shape",{value:E}),_.raw=E,E};_.raw=n,Object.defineProperty(e,"shape",{get:_})}const o=$i(()=>fl(e));nt(t,"propValues",_=>{const E=_.def.shape,b={};for(const C in E){const A=E[C]._zod;if(A.values){Object.prototype.hasOwnProperty.call(b,C)||Pr(b,C,new Set);for(const a of A.values)b[C].add(a);A.optin!==void 0&&b[C].add(void 0)}}return b});const i=vo,c=e.catchall;let d;const g=gr.memoizer;g==null||g.attach(t),t._zod.parse=(_,E)=>{d??(d=o.value);const b=_.value;if(!i(b))return _.issues.push({expected:"object",code:"invalid_type",input:b,inst:t}),_;_.value=g?g.alloc(t,_,{},E):{};const C=[],A=d.shape,a=E==null?void 0:E.abortEarly;let s=_.issues.length;for(const l of d.allKeys){if(a&&_.issues.length!==s){if(Dr(_,s))break;s=_.issues.length}if(l==="__proto__")continue;const u=A[l],m=u._zod.optin,x=u._zod.optout,f=u._zod.run({value:b[l],issues:[]},E);f instanceof Promise?C.push(f.then(v=>Co(v,_,l,b,m,x))):Co(f,_,l,b,m,x)}return c?hl(C,b,_,E,o.value,t,a===!0):C.length?Promise.all(C).then(()=>_):_}}),pm=pe("$ZodObjectJIT",(t,e)=>{mm.init(t,e);const r=t._zod.parse,n=$i(()=>fl(e)),o=gr.memoizer,i=A=>{var v,p;const a=n.value,s=a.symbolKeys,l=new Sh(["payload","ctx"],{shape:A,inst:t,memo:o,syms:s}),u=h=>`shape[${h}]._zod.run({ value: input[${h}], issues: [] }, ctx)`,m=(h,w)=>`
|
|
255
|
+
let ${h}_ab = false;
|
|
256
|
+
for (let i = 0; i < ${h}.issues.length; i++) {
|
|
257
|
+
const iss = ${h}.issues[i];
|
|
258
|
+
iss.path = iss.path ? [${w}, ...iss.path] : [${w}];
|
|
259
|
+
payload.issues.push(iss);
|
|
260
|
+
if (iss.continue !== true) ${h}_ab = true;
|
|
261
|
+
}
|
|
262
|
+
if (${h}_ab && ctx && ctx.abortEarly) {
|
|
263
|
+
payload.value = newResult;
|
|
264
|
+
return payload;
|
|
265
|
+
}`;l.write("const input = payload.value;");const x=Object.create(null);let f=0;for(const h of a.allKeys)x[h]=`key_${f++}`;l.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const h of a.allKeys){if(h==="__proto__")continue;const w=x[h],O=typeof h=="symbol"?`syms[${s.indexOf(h)}]`:Gd(h),M=`${O} in input`,$=A[h],T=(v=$==null?void 0:$._zod)==null?void 0:v.optin,D=T!==void 0,R=((p=$==null?void 0:$._zod)==null?void 0:p.optout)==="optional";if(l.write(`const ${w} = ${u(O)};`),D&&R){const S=T==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;l.write(`
|
|
266
|
+
const ${w}_present = ${M};
|
|
267
|
+
if (!${w}.issues.length || ${w}_present) {
|
|
268
|
+
if (${w}.issues.length) {${m(w,O)}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (${S}) {
|
|
272
|
+
newResult[${O}] = ${w}.value;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
`)}else D?(l.write(`
|
|
277
|
+
if (${w}.issues.length) {${m(w,O)}
|
|
278
|
+
}
|
|
279
|
+
`),T==="defaulted"?l.write(`newResult[${O}] = ${w}.value;`):l.write(`
|
|
280
|
+
if (${w}.value !== undefined || ${M}) {
|
|
281
|
+
newResult[${O}] = ${w}.value;
|
|
282
|
+
}
|
|
283
|
+
`)):l.write(`
|
|
284
|
+
const ${w}_present = ${M};
|
|
285
|
+
if (${w}.issues.length) {${m(w,O)}
|
|
286
|
+
}
|
|
287
|
+
if (!${w}_present && !${w}.issues.length) {
|
|
288
|
+
payload.issues.push({
|
|
289
|
+
code: "invalid_type",
|
|
290
|
+
expected: "nonoptional",
|
|
291
|
+
input: undefined,
|
|
292
|
+
path: [${O}]
|
|
293
|
+
});
|
|
294
|
+
if (ctx && ctx.abortEarly) {
|
|
295
|
+
payload.value = newResult;
|
|
296
|
+
return payload;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (${w}_present) {
|
|
301
|
+
newResult[${O}] = ${w}.value;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
`)}return l.write("payload.value = newResult;"),l.write("return payload;"),l.compile()};let c;const d=vo,g=!gr.jitless,E=g&&Jd.value,b=e.catchall;let C;t._zod.parse=(A,a)=>{C??(C=n.value);const s=A.value;return d(s)?g&&E&&(a==null?void 0:a.async)===!1&&a.jitless!==!0?(c||(c=i(e.shape)),A=c(A,a),b?hl([],s,A,a,C,t,(a==null?void 0:a.abortEarly)===!0):A):r(A,a):(A.issues.push({expected:"object",code:"invalid_type",input:s,inst:t}),A)}});function ml(t,e,r,n){for(const i of t)if(i.issues.length===0)return e.value=i.value,e;const o=t.filter(i=>!Dr(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(c=>Br(c,n,Ar())))}),e)}const gm=pe("$ZodUnion",(t,e)=>{Et.init(t,e),nt(t,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),nt(t,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),nt(t,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),nt(t,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){const o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Pi(i.source)).join("|")})$`)}});const r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1;const c=[];for(const d of e.options){const g=d._zod.run({value:n.value,issues:[]},o);if(g instanceof Promise)c.push(g),i=!0;else{if(g.issues.length===0)return g;c.push(g)}}return i?Promise.all(c).then(d=>ml(d,n,t,o)):ml(c,n,t,o)}}),vm=pe("$ZodIntersection",(t,e)=>{Et.init(t,e),t._zod.parse=(r,n)=>{const o=r.value,i=e.left._zod.run({value:o,issues:[]},n),c=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||c instanceof Promise?Promise.all([i,c]).then(([g,_])=>pl(r,g,_)):pl(r,i,c)}});function Qi(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(hn(t)&&hn(e)){const r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const i of n){if(i==="__proto__")continue;const c=Qi(t[i],e[i]);if(!c.valid)return{valid:!1,mergeErrorPath:[i,...c.mergeErrorPath]};o[i]=c.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const o=t[n],i=e[n],c=Qi(o,i);if(!c.valid)return{valid:!1,mergeErrorPath:[n,...c.mergeErrorPath]};r.push(c.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function pl(t,e,r){const n=new Map;let o;const i=new Map,c=(_,E)=>{var C,A;let b;if(_.code==="unrecognized_keys"&&!((C=_.path)!=null&&C.length))o??(o=_),b=_.keys;else if(_.code==="invalid_key"&&_.origin==="record"&&((A=_.path)==null?void 0:A.length)===1){const a=String(_.path[0]);i.has(a)||i.set(a,_),b=[a]}else return!1;for(const a of b)n.has(a)||n.set(a,{}),n.get(a)[E]=!0;return!0};for(const _ of e.issues)c(_,"l")||t.issues.push(_);for(const _ of r.issues)c(_,"r")||t.issues.push(_);const d=[...n].filter(([,_])=>_.l&&_.r).map(([_])=>_);if(d.length){const _=o?d.filter(E=>o.keys.includes(E)):[];_.length&&t.issues.push({...o,keys:_});for(const E of d)!_.includes(E)&&i.has(E)&&t.issues.push(i.get(E))}const g=Qi(e.value,r.value);if(!g.valid){if(Dr(t))return t;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(g.mergeErrorPath)}`)}return t.value=g.data,t}const bm=pe("$ZodRecord",(t,e)=>{Et.init(t,e);const r=gr.memoizer;r==null||r.attach(t),t._zod.parse=(n,o)=>{const i=n.value;if(!hn(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const c=[],d=e.keyType._zod.values;if(d&&!e.partial){n.value=r?r.alloc(t,n,{},o):{};const g=new Set;for(const E of d)if(typeof E=="string"||typeof E=="number"||typeof E=="symbol"){if(g.add(typeof E=="number"?E.toString():E),E==="__proto__")continue;const b=e.keyType._zod.run({value:E,issues:[]},o);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(b.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:b.issues.map(a=>Br(a,o,Ar())),input:E,path:[E],inst:t});continue}const C=b.value;if(C==="__proto__")continue;const A=e.valueType._zod.run({value:i[E],issues:[]},o);A instanceof Promise?c.push(A.then(a=>{a.issues.length&&n.issues.push(...mn(E,a.issues)),n.value[C]=a.value})):(A.issues.length&&n.issues.push(...mn(E,A.issues)),n.value[C]=A.value)}let _;for(const E in i)if(!g.has(E))if(e.mode==="loose"){if(E==="__proto__")continue;n.value[E]=i[E]}else _=_??[],_.push(E);_&&_.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:_,continue:!0})}else{n.value=r?r.alloc(t,n,{},o):{};let g;for(const _ of Reflect.ownKeys(i)){if(_==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,_))continue;let E=e.keyType._zod.run({value:_,issues:[]},o);if(E instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof _=="string"&&Yi.test(_)&&E.issues.length){const a=e.keyType._zod.run({value:Number(_),issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");a.issues.length===0&&(E=a)}if(E.issues.length){e.mode==="loose"?n.value[_]=i[_]:d?(g=g??[],g.push(_)):n.issues.push({code:"invalid_key",origin:"record",issues:E.issues.map(a=>Br(a,o,Ar())),input:_,path:[_],inst:t});continue}const C=E.value;if(C==="__proto__")continue;const A=e.valueType._zod.run({value:i[_],issues:[]},o);A instanceof Promise?c.push(A.then(a=>{a.issues.length&&n.issues.push(...mn(_,a.issues)),n.value[C]=a.value})):(A.issues.length&&n.issues.push(...mn(_,A.issues)),n.value[C]=A.value)}g&&g.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:g,continue:!0})}return c.length?Promise.all(c).then(()=>n):n}}),xm=pe("$ZodEnum",(t,e)=>{Et.init(t,e);const r=Ii(e.entries),n=new Set(r);t._zod.values=n,nt(t,"pattern",o=>{const i=Ii(o.def.entries).filter(c=>Xd.has(typeof c));return new RegExp(i.length?`^(${i.map(c=>bo(c.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(o,i)=>{const c=o.value;return n.has(c)||o.issues.push({code:"invalid_value",values:r,input:c,inst:t}),o}}),ym=pe("$ZodTransform",(t,e)=>{var r;Et.init(t,e),t._zod.optin="optional",(r=gr.memoizer)==null||r.guard(t),t._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Ya(t.constructor.name);const i=e.transform(n.value,n);if(o.async)return(i instanceof Promise?i:Promise.resolve(i)).then(d=>(n.value=d,n));if(i instanceof Promise)throw new Qr;return n.value=i,n}});function gl(t,e){return t.value=e.issues.length?void 0:e.value,t}const vl=pe("$ZodOptional",(t,e)=>{Et.init(t,e),nt(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",nt(t,"values",r=>{const n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),nt(t,"pattern",r=>{const n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Pi(n.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(r.value===void 0){if(e.innerType._zod.optin!=="defaulted")return r;const o=e.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>gl(r,i)):gl(r,o)}return e.innerType._zod.run(r,n)}}),Em=pe("$ZodExactOptional",(t,e)=>{vl.init(t,e),nt(t,"values",r=>r.def.innerType._zod.values),nt(t,"pattern",r=>r.def.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),Am=pe("$ZodNullable",(t,e)=>{Et.init(t,e),nt(t,"optin",r=>r.def.innerType._zod.optin),nt(t,"optout",r=>r.def.innerType._zod.optout),nt(t,"pattern",r=>{const n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Pi(n.source)}|null)$`):void 0}),nt(t,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),wm=pe("$ZodDefault",(t,e)=>{Et.init(t,e),t._zod.optin="defaulted",nt(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;const o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bl(i,e)):bl(o,e)}});function bl(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Cm=pe("$ZodPrefault",(t,e)=>{Et.init(t,e),t._zod.optin="defaulted",nt(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Sm=pe("$ZodNonOptional",(t,e)=>{Et.init(t,e),nt(t,"values",r=>{const n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,n)=>{const o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>xl(i,t)):xl(o,t)}});function xl(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function yl(t,e,r,n){return e.issues.length?(t.value=r.catchValue({...e,value:t.value,error:{issues:e.issues.map(o=>Br(o,n,Ar()))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}const _m=pe("$ZodCatch",(t,e)=>{Et.init(t,e),nt(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),nt(t,"optout",r=>r.def.innerType._zod.optout),nt(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const o=e.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>yl(r,i,e,n)):yl(r,o,e,n)}}),Tm=pe("$ZodPipe",(t,e)=>{Et.init(t,e),nt(t,"values",r=>r.def.in._zod.values),nt(t,"optin",r=>r.def.in._zod.optin),nt(t,"optout",r=>r.def.out._zod.optout),nt(t,"propValues",r=>r.def.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=e.out._zod.run(r,n);return i instanceof Promise?i.then(c=>So(c,e.in,n)):So(i,e.in,n)}const o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>So(i,e.out,n)):So(o,e.out,n)}});function So(t,e,r){return t.issues.some(n=>n.code!=="unrecognized_keys")?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}const Dm=pe("$ZodReadonly",(t,e)=>{Et.init(t,e),nt(t,"propValues",r=>r.def.innerType._zod.propValues),nt(t,"values",r=>r.def.innerType._zod.values),nt(t,"optin",r=>{var n,o;return(o=(n=r.def.innerType)==null?void 0:n._zod)==null?void 0:o.optin}),nt(t,"optout",r=>{var n,o;return(o=(n=r.def.innerType)==null?void 0:n._zod)==null?void 0:o.optout}),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(El):El(o)}});function El(t){return t.memo||(t.value=Object.freeze(t.value)),t}const km=pe("$ZodCustom",(t,e)=>{Wt.init(t,e),Et.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{const n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>Al(i,r,n,t));Al(o,r,n,t)}});function Al(t,e,r,n){if(!t){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Mn(o))}}class Nm extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const es="~memo",wl=[];function Cl(t){return t!==null&&typeof t=="object"}function ts(t){return t.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Sl=new WeakMap,$n=0,_o=1,Pn=2;function To(t,e,r){const n=Sl.get(t);if(n!==void 0)return n?Pn:$n;if(e.has(t))return Pn;e.add(t);let o=$n;const i=E=>{if(o!==Pn&&(E!=null&&E._zod)){const b=To(E,e);b>o&&(o=b)}},c=(E,b)=>{var A;let C=$n;for(const a of Reflect.ownKeys(E)){const s=Object.getOwnPropertyDescriptor(E,a);if(!s.enumerable)continue;const l=s.get?_o:(A=s.value)!=null&&A._zod?To(s.value,e):$n;l>C&&(C=l)}return C},d=E=>{E>o&&(o=E)},g=t._zod.def;switch(g.type){case"object":{const E=Ma(g);d(E?c(E):_o),i(g.catchall);break}case"array":i(g.element);break;case"tuple":for(const E of g.items)i(E);i(g.rest);break;case"record":case"map":i(g.keyType),i(g.valueType);break;case"set":i(g.valueType);break;case"union":for(const E of g.options)i(E);break;case"intersection":i(g.left),i(g.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(g.innerType);break;case"pipe":i(g.in),i(g.out);break;case"function":i(g.input),i(g.output);break;case"lazy":{const E=g._cachedInner??void 0;d(E?To(E,e):_o);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const E in g){const b=Object.getOwnPropertyDescriptor(g,E);if(!b||b.get)continue;const C=b.value;if(!(!C||typeof C!="object")){if(C._zod)i(C);else if(Array.isArray(C))for(const A of C)i(A)}}}return e.delete(t),Lm(t,o)}function Lm(t,e){return e!==_o&&Sl.set(t,e===Pn),e}function Om(t,e){let r=t.buckets.get(e);return r||(r=new WeakMap,t.buckets.set(e,r)),r}let Do;const ko=[],Rm={alloc(t,e,r){const n=Do;if(!n)return r;Do=void 0;const o={value:r,issues:null};return n.set(e.value,o),ko.push(o),r},guard(t){var e;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const r=t._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Mm(i,o.value))throw new Nm;return r(o,i)};t._zod.parse=n,t._zod.run===r&&(t._zod.run=n)})},attach(t){var e;let r,n=!1,o,i;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const c=t._zod.parse,d=(g,_)=>{if(r===void 0){const u=To(t,new Set);if(u===$n)return t._zod.parse=c,t._zod.run===d&&(t._zod.run=c),c(g,_);u===Pn||n?r=!0:n=!0}const E=g.value;if(!Cl(E))return c(g,_);let b=_[es];b||(b={buckets:new WeakMap,backEdges:void 0},_[es]=b);let C;o===_?C=i:(C=Om(b,t),o=_,i=C);const A=C.get(E);if(A)return g.value=A.value,A.issues?A.issues.length&&g.issues.push(...ts(A.issues)):(g.memo=!0,b.backEdges??(b.backEdges=new WeakSet),b.backEdges.add(A.value)),g;Do=C;const a=ko.length,s=c(g,_);Do=void 0;const l=ko.length>a?ko.pop():void 0;return s instanceof Promise?s.then(u=>(l&&(l.issues=u.issues.length?ts(u.issues):wl),u)):(l&&(l.issues=s.issues.length?ts(s.issues):wl),s)};t._zod.parse=d,t._zod.run===c&&(t._zod.run=d)})}};function Im(){return Rm}function Mm(t,e){var n;const r=(n=t[es])==null?void 0:n.backEdges;return r!==void 0&&Cl(e)&&r.has(e)}const $m=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(i){return t[i]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,c){return i==="number"&&typeof c=="number"&&!Number.isFinite(c)?String(c):n[i]??i}return i=>{switch(i.code){case"invalid_type":{const c=o(i.expected),d=cf(i.input),g=o(d,i.input);return`Invalid input: expected ${c}, received ${g}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Fa(i.values[0])}`:`Invalid option: expected one of ${Ia(i.values,"|")}`;case"too_big":{const c=i.exact?"exactly ":i.inclusive?"<=":"<",d=e(i.origin);return d?`Too big: expected ${i.origin??"value"} to have ${c}${i.maximum.toString()} ${d.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${c}${i.maximum.toString()}`}case"too_small":{const c=i.exact?"exactly ":i.inclusive?">=":">",d=e(i.origin);return d?`Too small: expected ${i.origin} to have ${c}${i.minimum.toString()} ${d.unit}`:`Too small: expected ${i.origin} to be ${c}${i.minimum.toString()}`}case"invalid_format":{const c=i;return c.format==="starts_with"?`Invalid string: must start with "${c.prefix}"`:c.format==="ends_with"?`Invalid string: must end with "${c.suffix}"`:c.format==="includes"?`Invalid string: must include "${c.includes}"`:c.format==="regex"?`Invalid string: must match pattern ${c.pattern}`:`Invalid ${r[c.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Ia(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(d=>`'${d}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Pm(){return{localeError:$m()}}var _l;class qm{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Bm(){return new qm}(_l=globalThis).__zod_globalRegistry??(_l.__zod_globalRegistry=Bm());const qn=globalThis.__zod_globalRegistry;function Tl(t){return t.checks&&(t.checks=[...t.checks]),t}function Fm(t,e){return new t(Tl({type:"string",...$e(e)}))}function zm(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...$e(e)})}function Hm(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...$e(e)})}function Um(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...$e(e)})}function jm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$e(e)})}function Wm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$e(e)})}function Vm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$e(e)})}function Zm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...$e(e)})}function Gm(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...$e(e)})}function Ym(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...$e(e)})}function Jm(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...$e(e)})}function Xm(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...$e(e)})}function Km(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...$e(e)})}function Qm(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...$e(e)})}function ep(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...$e(e)})}function tp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...$e(e)})}function rp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...$e(e)})}function np(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$e(e)})}function op(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$e(e)})}function ip(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...$e(e)})}function sp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...$e(e)})}function ap(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...$e(e)})}function lp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...$e(e)})}function cp(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$e(e)})}function up(t,e){return new t({type:"string",format:"date",check:"string_format",...$e(e)})}function dp(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...$e(e)})}function fp(t,e){return new t({type:"string",format:"duration",check:"string_format",...$e(e)})}function hp(t,e){return new t(Tl({type:"number",checks:[],...$e(e)}))}function mp(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...$e(e)})}function pp(t,e){return new t({type:"boolean",...$e(e)})}function gp(t){return new t({type:"unknown"})}function vp(t,e){return new t({type:"never",...$e(e)})}function Dl(t,e){return new el({check:"less_than",...$e(e),value:t,inclusive:!1})}function rs(t,e){return new el({check:"less_than",...$e(e),value:t,inclusive:!0})}function kl(t,e){return new tl({check:"greater_than",...$e(e),value:t,inclusive:!1})}function ns(t,e){return new tl({check:"greater_than",...$e(e),value:t,inclusive:!0})}function Nl(t,e){return new hh({check:"multiple_of",...$e(e),value:t})}function Ll(t,e){return new ph({check:"max_length",...$e(e),maximum:t})}function No(t,e){return new gh({check:"min_length",...$e(e),minimum:t})}function Ol(t,e){return new vh({check:"length_equals",...$e(e),length:t})}function bp(t,e){return new bh({check:"string_format",format:"regex",...$e(e),pattern:t})}function xp(t){return new xh({check:"string_format",format:"lowercase",...$e(t)})}function yp(t){return new yh({check:"string_format",format:"uppercase",...$e(t)})}function Ep(t,e){return new Eh({check:"string_format",format:"includes",...$e(e),includes:t})}function Ap(t,e){return new Ah({check:"string_format",format:"starts_with",...$e(e),prefix:t})}function wp(t,e){return new wh({check:"string_format",format:"ends_with",...$e(e),suffix:t})}function pn(t){return new Ch({check:"overwrite",tx:t})}function Cp(t){return pn(e=>e.normalize(t))}function Sp(){return pn(t=>t.trim())}function _p(){return pn(t=>t.toLowerCase())}function Tp(){return pn(t=>t.toUpperCase())}function Dp(){return pn(t=>Yd(t))}function kp(t,e,r){return new t({type:"array",element:e,...$e(r)})}function Np(t,e,r){return new t({type:"custom",check:"custom",fn:e,...$e(r)})}function Lp(t,e){const r=Op(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Mn(o,n.value,r._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(Mn(i))}},t(n.value,n)),e);return r}function Op(t,e){const r=new Wt({check:"custom",...$e(e)});return r._zod.check=t,r}function Bn(t,...e){for(const r of e)for(const n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&Pr(t,n,r[n]);return t}function Rl(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??qn,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",intersections:[],deferred:[],external:(t==null?void 0:t.external)??void 0}}function gn(t,e,r,n,o){const i=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:t,path:n.path,message:o}):e.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function Ct(t,e,r={path:[],schemaPath:[]}){var E,b;var n;const o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;const c={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,c),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;const d=(b=(E=t._zod).toJSONSchema)==null?void 0:b.call(E);if(d)c.schema=d;else{const C={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,c.schema,C);else{const a=c.schema,s=e.processors[o.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);s(t,e,a,C)}const A=t._zod.parent;A&&(c.ref||(c.ref=A),Ct(A,e,C),e.seen.get(A).isParent=!0)}const g=e.metadataRegistry.get(t);return g&&Bn(c.schema,g),e.io==="input"&&Ht(t)&&(delete c.schema.examples,delete c.schema.default),e.io==="input"&&"_prefault"in c.schema&&((n=c.schema).default??(n.default=c.schema._prefault)),delete c.schema._prefault,e.seen.get(t).schema}function Il(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Ml(t,e){var c,d,g,_;const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;const n=new Map;for(const E of t.seen.entries()){const b=(c=t.metadataRegistry.get(E[0]))==null?void 0:c.id;if(b){const C=n.get(b);if(C&&C!==E[0])throw new Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(b,E[0])}}const o=E=>{var s;const b=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const l=(s=t.external.registry.get(E[0]))==null?void 0:s.id,u=t.external.uri??(x=>x);if(l)return{ref:u(l)};const m=E[1].defId??E[1].schema.id??`schema${t.counter++}`;return E[1].defId=m,{defId:m,ref:`${u("__shared")}#/${b}/${Il(m)}`}}const C="#",A=`${C}/${b}/`;if(E[1]===r&&!E[1].schema.id)return{ref:C};const a=E[1].schema.id??`__schema${t.counter++}`;return{defId:a,ref:A+Il(a)}},i=E=>{if(E[1].schema.$ref)return;const b=E[1],{ref:C,defId:A}=o(E);b.def={...b.schema},A&&(b.defId=A);const a=b.schema;for(const s in a)delete a[s];a.$ref=C};if(t.cycles==="throw")for(const E of t.seen.entries()){const b=E[1];if(b.cycle)throw new Error(`Cycle detected: #/${(d=b.cycle)==null?void 0:d.join("/")}/<root>
|
|
305
|
+
|
|
306
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const E of t.seen.entries()){const b=E[1];if(e===E[0]){i(E);continue}if(t.external){const A=(g=t.external.registry.get(E[0]))==null?void 0:g.id;if(e!==E[0]&&A){i(E);continue}}if((_=t.metadataRegistry.get(E[0]))==null?void 0:_.id){i(E);continue}if(b.cycle){i(E);continue}b.count>1&&t.reused==="ref"&&i(E)}t.external&&(t.sharedDefsExtractedFor=t.external)}function $l(t){const e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;const r=[];for(const n of e){if(!n||typeof n!="object")return;$l(n);const o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;const i=n.type;for(const c of Array.isArray(i)?i:[i]){if(typeof c!="string")return;r.includes(c)||r.push(c)}}delete t.anyOf,t.type=r.length===1?r[0]:r}const Pl=new Set(["type","properties","required","additionalProperties"]),ql=["oneOf","anyOf"];function Bl(t){const e=t.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function os(t){var i;const e=[];for(const c of t){if(typeof c!="object"||c.type!=="object")return null;for(const d in c)if(!Pl.has(d))return null;e.push(c)}const r={},n=new Set;for(const c of e){for(const d in c.properties){if(Object.prototype.hasOwnProperty.call(r,d))continue;const g=[];for(const E of e){const b=((i=E.properties)==null?void 0:i[d])??Bl(E);b!=null&&(g.some(C=>JSON.stringify(C)===JSON.stringify(b))||g.push(b))}const _=g.length===1?g[0]:os(g)??{allOf:g};Pr(r,d,_)}for(const d of c.required??[])n.add(d)}const o={type:"object",properties:r};if(n.size&&(o.required=[...n]),e.every(c=>c.additionalProperties===!1))o.additionalProperties=!1;else{const c=[];for(const d of e){const g=Bl(d);g&&!c.some(_=>JSON.stringify(_)===JSON.stringify(g))&&c.push(g)}c.length===1?o.additionalProperties=c[0]:c.length>1&&(o.additionalProperties={allOf:c})}return o}function Rp(t){const e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(const o of Pl)if(o in t)return;const r=e.filter(o=>ql.some(i=>Array.isArray(o[i])));let n=null;if(!r.length)n=os(e);else{const o=r[0],i=ql.find(g=>Array.isArray(o[g]));if(Object.keys(o).length!==1)return;const c=e.filter(g=>g!==o),d=o[i].map(g=>os([...c,g]));if(d.some(g=>!g))return;n={[i]:d}}n&&(delete t.allOf,Bn(t,n))}function Fl(t,e){var d,g,_,E;const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=b=>{const C=t.seen.get(b);if(C.ref===null)return;const A=C.def??C.schema,a={...A},s=C.ref;if(C.ref=null,s){n(s);const u=t.seen.get(s),m=u.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(A.allOf=A.allOf??[],A.allOf.push(m)):Bn(A,m),Bn(A,a),b._zod.parent===s)for(const f in A)f==="$ref"||f==="allOf"||f in a||delete A[f];if(m.$ref&&u.def)for(const f in A)f==="$ref"||f==="allOf"||f in u.def&&JSON.stringify(A[f])===JSON.stringify(u.def[f])&&delete A[f]}const l=b._zod.parent;if(l&&l!==s){n(l);const u=t.seen.get(l);if(u!=null&&u.schema.$ref&&(A.$ref=u.schema.$ref,u.def))for(const m in A)m==="$ref"||m==="allOf"||m in u.def&&JSON.stringify(A[m])===JSON.stringify(u.def[m])&&delete A[m]}t.override({zodSchema:b,jsonSchema:A,path:C.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(const b of[...t.seen.entries()].reverse())n(b[0]);if(t.target!=="openapi-3.0")for(const b of t.seen.entries())$l(b[1].def??b[1].schema);for(const b of t.deferred)b();if(t.intersections.length){const b=new Map;for(const C of t.seen.values())for(const A of[C.schema,C.def]){const a=A==null?void 0:A.allOf;if(!Array.isArray(a))continue;const s=b.get(a);s?s.push(A):b.set(a,[A])}for(const C of t.intersections)for(const A of b.get(C)??[])Rp(A)}}const o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,(d=t.external)!=null&&d.uri){const b=(g=t.external.registry.get(e))==null?void 0:g.id;if(!b)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(b)}Bn(o,r.defId?r.schema:r.def??r.schema);const i=(_=t.metadataRegistry.get(e))==null?void 0:_.id;i!==void 0&&o.id===i&&delete o.id;const c=((E=t.external)==null?void 0:E.defs)??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(const b of t.seen.entries()){const C=b[1];C.def&&C.defId&&(C.def.id===C.defId&&delete C.def.id,Pr(c,C.defId,C.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(c).length>0&&(t.target==="draft-2020-12"?o.$defs=c:o.definitions=c);try{const b=JSON.parse(JSON.stringify(o));return Object.defineProperty(b,"~standard",{value:{...e["~standard"],jsonSchema:{input:Lo(e,"input",t.processors),output:Lo(e,"output",t.processors)}},enumerable:!1,writable:!1}),b}catch{throw new Error("Error converting schema to JSON.")}}function Ht(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ht(n.element,r);if(n.type==="set")return Ht(n.valueType,r);if(n.type==="lazy")return Ht(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Ht(n.innerType,r);if(n.type==="intersection")return Ht(n.left,r)||Ht(n.right,r);if(n.type==="record"||n.type==="map")return Ht(n.keyType,r)||Ht(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Ht(n.in,r)||Ht(n.out,r);if(n.type==="object"){for(const o in n.shape)if(Ht(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(Ht(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(Ht(o,r))return!0;return!!(n.rest&&Ht(n.rest,r))}return!1}const Ip=(t,e={})=>r=>{const n=Rl({...r,processors:e});return Ct(t,n),Ml(n,t),Fl(n,t)},Lo=(t,e,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},c=Rl({...o??{},target:i,io:e,processors:r});return Ct(t,c),Ml(c,t),Fl(c,t)},vn=(t,e,r)=>{(t[e]===void 0||r>t[e])&&(t[e]=r)},bn=(t,e,r)=>{(t[e]===void 0||r<t[e])&&(t[e]=r)},zl=(t,e)=>{vn(t,"minimum",e),bn(t,"maximum",e)},Hl=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},Ul=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},jl=(t,e)=>{t.mime=t.mime?t.mime.filter(r=>e.includes(r)):[...e]},Wl=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},Vl=(t,e)=>vn(t,"minimum",e.minimum),Zl=(t,e)=>bn(t,"maximum",e.maximum),Gl=t=>(e,r)=>{Wl(e,r.format);const[n,o]=t[r.format];vn(e,"minimum",n),bn(e,"maximum",o)},is={greater_than:(t,e)=>vn(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>bn(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>Hl(t,e.value),number_format:Gl(za),bigint_format:Gl(Qd),min_length:Vl,max_length:Zl,length_equals:(t,e)=>zl(t,e.length),min_size:Vl,max_size:Zl,size_equals:(t,e)=>zl(t,e.size),string_format:(t,e)=>{Wl(t,e.format),e.pattern&&Ul(t,e.pattern),(e.format==="base64"||e.format==="base64url")&&(t.contentEncoding=e.format),(e.local||e.precision===-1)&&(t.laxFormat=!0)},mime_type:(t,e)=>jl(t,e.mime)};function vr(t){var i;const e={},r=t._zod.def,n=t._zod.traits.has("$ZodCheck")?[t,...r.checks??[]]:r.checks??[];for(const c of n)(i=is[c._zod.def.check])==null||i.call(is,e,c._zod.def);const o=t._zod.bag;o.minimum!==void 0&&vn(e,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&vn(e,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&bn(e,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&bn(e,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Hl(e,o.multipleOf),o.format!==void 0&&(e.format??(e.format=o.format),o.format.includes("int")&&(e.isInt=!0)),o.mime&&jl(e,o.mime);for(const c of o.patterns??[])Ul(e,c);return e}const Mp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},$p=new Map([[cl,eh],[Ki,th]]),Yl=t=>$p.get(t)??t,Pp=(t,e,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:c,format:d,patterns:g,contentEncoding:_,laxFormat:E}=vr(t);if(typeof i=="number"&&(o.minLength=i),typeof c=="number"&&(o.maxLength=c),d&&(o.format=Mp[d]??d,o.format===""&&delete o.format,(d==="time"||E)&&delete o.format),_&&(o.contentEncoding=_),g&&g.size>0){const b=[...g].map(Yl);b.length===1?o.pattern=b[0].source:b.length>1&&(o.allOf=[...b.map(C=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:C.source}))])}},qp=(t,e,r,n)=>{const o=r,{minimum:i,maximum:c,multipleOf:d,exclusiveMaximum:g,exclusiveMinimum:_,isInt:E}=vr(t);o.type=E?"integer":"number";const b=typeof _=="number"&&_>=(i??Number.NEGATIVE_INFINITY),C=typeof g=="number"&&g<=(c??Number.POSITIVE_INFINITY),A=e.target==="draft-04"||e.target==="openapi-3.0";if(b?A?(o.minimum=_,o.exclusiveMinimum=!0):o.exclusiveMinimum=_:typeof i=="number"&&(o.minimum=i),C?A?(o.maximum=g,o.exclusiveMaximum=!0):o.exclusiveMaximum=g:typeof c=="number"&&(o.maximum=c),d){const a=new Set;for(const u of d)Number.isFinite(u)&&u!==0?a.add(Math.abs(u)):gn(t,e,o,n,`A multipleOf divisor of ${u} cannot be represented in JSON Schema`);const[s,...l]=a;s!==void 0&&(o.multipleOf=s),l.length&&(o.allOf=[...o.allOf??[],...l.map(u=>({multipleOf:u}))])}},Bp=(t,e,r,n)=>{r.type="boolean"},Fp=(t,e,r,n)=>{r.not={}},zp=(t,e,r,n)=>{},Hp=(t,e,r,n)=>{const o=t._zod.def,i=Ii(o.entries);if(i.length===0){r.not={};return}i.every(c=>typeof c=="number")&&(r.type="number"),i.every(c=>typeof c=="string")&&(r.type="string"),r.enum=i},Up=(t,e,r,n)=>{gn(t,e,r,n,"Custom types cannot be represented in JSON Schema")},jp=(t,e,r,n)=>{gn(t,e,r,n,"Transforms cannot be represented in JSON Schema")},Wp=(t,e,r,n)=>{const o=r,i=t._zod.def,{minimum:c,maximum:d}=vr(t);typeof c=="number"&&(o.minItems=c),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ct(i.element,e,{...n,path:[...n.path,"items"]})};function Oo(t){const e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?Oo(e.out):e.type==="catch"?Oo(e.innerType):t._zod.optin}const Vp=(t,e,r,n)=>{var _;const o=r,i=t._zod.def,c=i.shape;if(Object.getOwnPropertySymbols(c).length&&gn(t,e,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const E in c)Pr(o.properties,E,Ct(c[E],e,{...n,path:[...n.path,"properties",E]}));const g=[];for(const E of Object.keys(c)){const b=i.shape[E];(e.io==="input"?Oo(b)===void 0:b._zod.optout===void 0)&&g.push(E)}g.length>0&&(o.required=g),((_=i.catchall)==null?void 0:_._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ct(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},Zp=(t,e,r,n)=>{const o=t._zod.def,i=o.inclusive===!1,c=o.options.map((d,g)=>Ct(d,e,{...n,path:[...n.path,i?"oneOf":"anyOf",g]}));i?r.oneOf=c:r.anyOf=c},Gp=(t,e,r,n)=>{const o=t._zod.def,i=Ct(o.left,e,{...n,path:[...n.path,"allOf",0]}),c=Ct(o.right,e,{...n,path:[...n.path,"allOf",1]}),d=_=>"allOf"in _&&Object.keys(_).length===1,g=[...d(i)?i.allOf:[i],...d(c)?c.allOf:[c]];r.allOf=g,e.intersections.push(g)};function ss(t,e,r){var a;if(e.$ref){if(r.has(e))return e;r.add(e);const s=(a=t.get(e))==null?void 0:a.def;if(!s)return e;const l=ss(t,s,r);return l===s?e:l}for(const s of["anyOf","oneOf"]){const l=e[s];if(!Array.isArray(l))continue;const u=l.map(m=>ss(t,m,r));u.some((m,x)=>m!==l[x])&&(e={...e,[s]:u})}const n=Array.isArray(e.type)?e.type:[e.type],o=!n.includes("string")&&n.some(s=>s==="number"||s==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!o&&!(i!=null&&i.some(s=>typeof s=="number")))return e;const{minimum:c,maximum:d,exclusiveMinimum:g,exclusiveMaximum:_,multipleOf:E,format:b,id:C,...A}=e;return A.enum?A.enum=A.enum.map(s=>typeof s=="number"?String(s):s):typeof A.const=="number"&&(A.const=String(A.const)),o&&(A.type="string",i||(A.pattern=(n.includes("number")?Yi:ch).source)),A}const as=new WeakMap;function Yp(t){var n;const e=new Map;for(const o of t.seen.values())o.def&&!e.has(o.schema)&&e.set(o.schema,o);const r=new Map;for(const o of as.get(t)??[]){const i=t.seen.get(o),c=(n=(i==null?void 0:i.def)??(i==null?void 0:i.schema))==null?void 0:n.propertyNames;if(!c||c===!0||r.has(c))continue;const d=ss(e,c,new Set);d!==c&&r.set(c,d)}if(r.size)for(const o of t.seen.values())for(const i of[o.schema,o.def]){const c=i&&r.get(i.propertyNames);c&&(i.propertyNames=c)}}const Jp=(t,e,r,n)=>{const o=r,i=t._zod.def;o.type="object";const c=i.keyType,d=vr(c).patterns;if(i.mode==="loose"&&d&&d.size>0){const E=Ct(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(const b of d)Pr(o.patternProperties,Yl(b).source,E)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){o.propertyNames=Ct(i.keyType,e,{...n,path:[...n.path,"propertyNames"]});let E=as.get(e);E||(E=[],as.set(e,E),e.deferred.push(()=>Yp(e))),E.push(t)}o.additionalProperties=Ct(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]})}const g=c._zod.values,_=e.io==="input"&&Oo(i.valueType)!==void 0;if(g&&!i.partial&&!_){const E=[...g].filter(b=>typeof b=="string"||typeof b=="number");E.length>0&&(o.required=E.map(String))}},Xp=(t,e,r,n)=>{const o=t._zod.def,i=Ct(o.innerType,e,n),c=e.seen.get(t);e.target==="openapi-3.0"?(c.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Kp=(t,e,r,n)=>{const o=t._zod.def;Ct(o.innerType,e,n);const i=e.seen.get(t);i.ref=o.innerType},ls=Symbol();function Jl(t,e,r,n,o){let i=!1;const c=JSON.stringify(t,(d,g)=>typeof g!="bigint"?g:(i=!0,null));return i?(gn(e,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ls):JSON.parse(c)}const Qp=(t,e,r,n)=>{const o=t._zod.def;Ct(o.innerType,e,n);const i=e.seen.get(t);i.ref=o.innerType;const c=Jl(o.defaultValue,t,e,r,n);c!==ls&&(r.default=c)},eg=(t,e,r,n)=>{const o=t._zod.def;Ct(o.innerType,e,n);const i=e.seen.get(t);if(i.ref=o.innerType,e.io!=="input")return;const c=Jl(o.defaultValue,t,e,r,n);c!==ls&&(r._prefault=c)},tg=(t,e,r,n)=>{const o=t._zod.def;Ct(o.innerType,e,n);const i=e.seen.get(t);i.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{gn(t,e,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=c},rg=(t,e,r,n)=>{const o=t._zod.def,i=o.in._zod.traits.has("$ZodTransform"),c=e.io==="input"?i?o.out:o.in:o.out;Ct(c,e,n);const d=e.seen.get(t);d.ref=c},ng=(t,e,r,n)=>{const o=t._zod.def;Ct(o.innerType,e,n);const i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},Xl=(t,e,r,n)=>{const o=t._zod.def;Ct(o.innerType,e,n);const i=e.seen.get(t);i.ref=o.innerType},Kl=new WeakSet([Object.prototype,Error.prototype]);function Ro(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){const n=r(this);return Object.defineProperty(this,e,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,e,{value:n,configurable:!0,writable:!0})}})}const ar=pe("ZodError",(t,e)=>{Ef.init(t,e),t.name="ZodError";const r=Object.getPrototypeOf(t);Kl.has(r)||(Kl.add(r),Ro(r,"format",n=>o=>Cf(n,o)),Ro(r,"flatten",n=>o=>wf(n,o)),Ro(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Mi,2)}),Ro(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Mi,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),og=ji(ar),ig=Wi(ar),sg=Vi(ar),ag=Zi(ar),lg=Nf(ar),cg=Lf(ar),ug=Of(ar),dg=Rf(ar),fg=If(ar),hg=Mf(ar),mg=$f(ar),pg=Pf(ar);function gg(){gr.localeError||Ar(Pm())}function Io(){gr.memoizer||Ar({memoizer:Im()})}const At=pe("ZodType",(t,e)=>(gg(),Et.init(t,e),t.def=e,t.type=e.type,t),{check(...t){const e=this.def;return this.clone(Kt(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return qr(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(h0(t,e))},superRefine(t,e){return this.check(m0(t,e))},overwrite(t){return this.check(pn(t))},optional(){return oc(this)},exactOptional(){return e0(this)},nullable(){return sc(this)},nullish(){return oc(sc(this))},nonoptional(t){return s0(this,t)},array(){return wr(this)},or(t){return Gg([this,t])},and(t){return Jg(this,t)},transform(t){return lc(this,Qg(t))},default(t){return n0(this,t)},prefault(t){return i0(this,t)},catch(t){return l0(this,t)},pipe(t){return lc(this,t)},readonly(){return d0(this)},describe(t){const e=this.clone();return qn.add(e,{description:t}),e},meta(...t){if(t.length===0)return qn.get(this);const e=this.clone();return qn.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return e.length===0?t(this):t(this,...e)},get"~standard"(){return Wa(this,"~standard",{...nl(this),jsonSchema:{input:Lo(this,"input"),output:Lo(this,"output")}})},set"~standard"(t){Fr(this,"~standard",t)},parse:function t(e,r){return og(this,e,r,{callee:t})},parseAsync:async function t(e,r){return await ig(this,e,r,{callee:t})},safeParse(t,e){return sg(this,t,e)},async safeParseAsync(t,e){return ag(this,t,e)},get spa(){return this==null?void 0:this.safeParseAsync},set spa(t){Fr(this,"spa",t)},validate(t,e){return Tf(this,t,e)},validateAsync(t,e){return kf(this,t,e)},encode:function t(e,r){return lg(this,e,r,{callee:t})},decode:function t(e,r){return cg(this,e,r,{callee:t})},encodeAsync:async function t(e,r){return await ug(this,e,r,{callee:t})},decodeAsync:async function t(e,r){return await dg(this,e,r,{callee:t})},safeEncode(t,e){return fg(this,t,e)},safeDecode(t,e){return hg(this,t,e)},async safeEncodeAsync(t,e){return mg(this,t,e)},async safeDecodeAsync(t,e){return pg(this,t,e)},toJSONSchema(t){return Ip(this,{})(t)},get description(){var t;return(t=qn.get(this))==null?void 0:t.description},get _def(){return this._zod.def}}),Ql=pe("_ZodString",(t,e)=>{Xi.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Pp(t,r,n)},Va({format:t=>vr(t).format??null,minLength:t=>vr(t).minimum??null,maxLength:t=>vr(t).maximum??null},{regex(...t){return this.check(bp(...t))},includes(...t){return this.check(Ep(...t))},startsWith(...t){return this.check(Ap(...t))},endsWith(...t){return this.check(wp(...t))},min(...t){return this.check(No(...t))},max(...t){return this.check(Ll(...t))},length(...t){return this.check(Ol(...t))},nonempty(...t){return this.check(No(1,...t))},lowercase(t){return this.check(xp(t))},uppercase(t){return this.check(yp(t))},trim(){return this.check(Sp())},normalize(...t){return this.check(Cp(...t))},toLowerCase(){return this.check(_p())},toUpperCase(){return this.check(Tp())},slugify(){return this.check(Dp())}})),vg=pe("ZodString",(t,e)=>{Xi.init(t,e),Ql.init(t,e)},{email(t){return this.check(zm(Ag,t))},url(t){return this.check(Zm(Cg,t))},jwt(t){return this.check(lp(Bg,t))},emoji(t){return this.check(Gm(Sg,t))},guid(t){return this.check(Hm(wg,t))},uuid(t){return this.check(Um(Mo,t))},uuidv4(t){return this.check(jm(Mo,t))},uuidv6(t){return this.check(Wm(Mo,t))},uuidv7(t){return this.check(Vm(Mo,t))},nanoid(t){return this.check(Ym(_g,t))},cuid(t){return this.check(Jm(Tg,t))},cuid2(t){return this.check(Xm(Dg,t))},ulid(t){return this.check(Km(kg,t))},base64(t){return this.check(ip($g,t))},base64url(t){return this.check(sp(Pg,t))},xid(t){return this.check(Qm(Ng,t))},ksuid(t){return this.check(ep(Lg,t))},ipv4(t){return this.check(tp(Og,t))},ipv6(t){return this.check(rp(Rg,t))},cidrv4(t){return this.check(np(Ig,t))},cidrv6(t){return this.check(op(Mg,t))},e164(t){return this.check(ap(qg,t))},datetime(t){return this.check(cp(bg,t))},date(t){return this.check(up(xg,t))},time(t){return this.check(dp(yg,t))},duration(t){return this.check(fp(Eg,t))}});function ct(t){return Fm(vg,t)}const gt=pe("ZodStringFormat",(t,e)=>{ft.init(t,e),Ql.init(t,e)}),bg=pe("ZodISODateTime",(t,e)=>{jh.init(t,e),gt.init(t,e)}),xg=pe("ZodISODate",(t,e)=>{Wh.init(t,e),gt.init(t,e)}),yg=pe("ZodISOTime",(t,e)=>{Vh.init(t,e),gt.init(t,e)}),Eg=pe("ZodISODuration",(t,e)=>{Zh.init(t,e),gt.init(t,e)}),Ag=pe("ZodEmail",(t,e)=>{Nh.init(t,e),gt.init(t,e)}),wg=pe("ZodGUID",(t,e)=>{Dh.init(t,e),gt.init(t,e)}),Mo=pe("ZodUUID",(t,e)=>{kh.init(t,e),gt.init(t,e)}),Cg=pe("ZodURL",(t,e)=>{$h.init(t,e),gt.init(t,e)}),Sg=pe("ZodEmoji",(t,e)=>{Ph.init(t,e),gt.init(t,e)}),_g=pe("ZodNanoID",(t,e)=>{qh.init(t,e),gt.init(t,e)}),Tg=pe("ZodCUID",(t,e)=>{Bh.init(t,e),gt.init(t,e)}),Dg=pe("ZodCUID2",(t,e)=>{Fh.init(t,e),gt.init(t,e)}),kg=pe("ZodULID",(t,e)=>{zh.init(t,e),gt.init(t,e)}),Ng=pe("ZodXID",(t,e)=>{Hh.init(t,e),gt.init(t,e)}),Lg=pe("ZodKSUID",(t,e)=>{Uh.init(t,e),gt.init(t,e)}),Og=pe("ZodIPv4",(t,e)=>{Gh.init(t,e),gt.init(t,e)}),Rg=pe("ZodIPv6",(t,e)=>{Jh.init(t,e),gt.init(t,e)}),Ig=pe("ZodCIDRv4",(t,e)=>{Xh.init(t,e),gt.init(t,e)}),Mg=pe("ZodCIDRv6",(t,e)=>{Qh.init(t,e),gt.init(t,e)}),$g=pe("ZodBase64",(t,e)=>{em.init(t,e),gt.init(t,e)}),Pg=pe("ZodBase64URL",(t,e)=>{rm.init(t,e),gt.init(t,e)}),qg=pe("ZodE164",(t,e)=>{nm.init(t,e),gt.init(t,e)}),Bg=pe("ZodJWT",(t,e)=>{im.init(t,e),gt.init(t,e)}),ec=pe("ZodNumber",(t,e)=>{ul.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>qp(t,r,n,o),t.isFinite=!0},Va({minValue:t=>{const{minimum:e,exclusiveMinimum:r}=vr(t);return Math.max(e??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:t=>{const{maximum:e,exclusiveMaximum:r}=vr(t);return Math.min(e??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:t=>{const{isInt:e,multipleOf:r}=vr(t);return!!e||!!(r!=null&&r.some(Number.isSafeInteger))},format:t=>vr(t).format??null},{gt(t,e){return this.check(kl(t,e))},gte(t,e){return this.check(ns(t,e))},min(t,e){return this.check(ns(t,e))},lt(t,e){return this.check(Dl(t,e))},lte(t,e){return this.check(rs(t,e))},max(t,e){return this.check(rs(t,e))},int(t){return this.check(tc(t))},safe(t){return this.check(tc(t))},positive(t){return this.check(kl(0,t))},nonnegative(t){return this.check(ns(0,t))},negative(t){return this.check(Dl(0,t))},nonpositive(t){return this.check(rs(0,t))},multipleOf(t,e){return this.check(Nl(t,e))},step(t,e){return this.check(Nl(t,e))},finite(){return this}}));function Qt(t){return hp(ec,t)}const Fg=pe("ZodNumberFormat",(t,e)=>{sm.init(t,e),ec.init(t,e)});function tc(t){return mp(Fg,t)}const zg=pe("ZodBoolean",(t,e)=>{am.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Bp(t,r,n)});function er(t){return pp(zg,t)}const Hg=pe("ZodUnknown",(t,e)=>{lm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>zp()});function cs(){return gp(Hg)}const Ug=pe("ZodNever",(t,e)=>{cm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Fp(t,r,n)});function jg(t){return vp(Ug,t)}const Wg=pe("ZodArray",(t,e)=>{Io(),fm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Wp(t,r,n,o),t.element=e.element},{min(t,e){return this.check(No(t,e))},nonempty(t){return this.check(No(1,t))},max(t,e){return this.check(Ll(t,e))},length(t,e){return this.check(Ol(t,e))},unwrap(){return this.element}});function wr(t,e){return kp(Wg,t,e)}const Vg=pe("ZodObject",(t,e)=>{Io(),pm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Vp(t,r,n,o),mf(t,"shape",r=>r._zod.def.shape,!1)},{keyof(){return tr(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(Kt(this._zod.def,{catchall:t}))},passthrough(){return this.clone(Kt(this._zod.def,{catchall:cs()}))},loose(){return this.clone(Kt(this._zod.def,{catchall:cs()}))},strict(){return this.clone(Kt(this._zod.def,{catchall:jg()}))},strip(){return this.clone(Kt(this._zod.def,{catchall:void 0}))},extend(t){return rf(this,t)},safeExtend(t){return nf(this,t)},merge(t){return of(this,t)},pick(t){return ef(this,t)},omit(t){return tf(this,t)},partial(...t){return Ua(nc,this,t[0])},exactPartial(...t){return Ua(ic,this,t[0],"exactPartial")},required(...t){return sf(ac,this,t[0])}});function lr(t,e){const r={type:"object",shape:t??{},...$e(e)};return new Vg(r)}const Zg=pe("ZodUnion",(t,e)=>{gm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Zp(t,r,n,o),t.options=e.options});function Gg(t,e){return new Zg({type:"union",options:t,...$e(e)})}const Yg=pe("ZodIntersection",(t,e)=>{vm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Gp(t,r,n,o)});function Jg(t,e){return new Yg({type:"intersection",left:t,right:e})}const rc=pe("ZodRecord",(t,e)=>{Io(),bm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Jp(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function Xg(t,e,r){return!e||!e._zod?new rc({type:"record",keyType:ct(),valueType:t,...$e(e)}):new rc({type:"record",keyType:t,valueType:e,...$e(r)})}const us=pe("ZodEnum",(t,e)=>{xm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Hp(t,n,o),t.enum=e.entries,t.options=[...t._zod.values];const r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{const i={};for(const c of n)if(r.has(c))i[c]=e.entries[c];else throw new Error(`Key ${c} not found in enum`);return new us({...e,checks:[],...$e(o),entries:i})},t.exclude=(n,o)=>{const i={...e.entries};for(const c of n)if(r.has(c))delete i[c];else throw new Error(`Key ${c} not found in enum`);return new us({...e,checks:[],...$e(o),entries:i})}});function tr(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new us({type:"enum",entries:r,...$e(e)})}const Kg=pe("ZodTransform",(t,e)=>{Io(),ym.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>jp(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ya(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Mn(i,r.value,e));else{const c=i;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=r.value),c.inst??(c.inst=t),r.issues.push(Mn(c))}};const o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Qg(t){return new Kg({type:"transform",transform:t})}const nc=pe("ZodOptional",(t,e)=>{vl.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xl(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function oc(t){return new nc({type:"optional",innerType:t})}const ic=pe("ZodExactOptional",(t,e)=>{Em.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xl(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function e0(t){return new ic({type:"optional",innerType:t})}const t0=pe("ZodNullable",(t,e)=>{Am.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xp(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function sc(t){return new t0({type:"nullable",innerType:t})}const r0=pe("ZodDefault",(t,e)=>{wm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Qp(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function n0(t,e){return new r0({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Ba(e)}})}const o0=pe("ZodPrefault",(t,e)=>{Cm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>eg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function i0(t,e){return new o0({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Ba(e)}})}const ac=pe("ZodNonOptional",(t,e)=>{Sm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Kp(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function s0(t,e){return new ac({type:"nonoptional",innerType:t,...$e(e)})}const a0=pe("ZodCatch",(t,e)=>{_m.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>tg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function l0(t,e){return new a0({type:"catch",innerType:t,catchValue:typeof e=="function"?e:gf(e)})}const c0=pe("ZodPipe",(t,e)=>{Tm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>rg(t,r,n,o),t.in=e.in,t.out=e.out});function lc(t,e){return new c0({type:"pipe",in:t,out:e})}const u0=pe("ZodReadonly",(t,e)=>{Dm.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ng(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function d0(t){return new u0({type:"readonly",innerType:t})}const f0=pe("ZodCustom",(t,e)=>{km.init(t,e),At.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Up(t,r,n,o)});function h0(t,e={}){return Np(f0,t,e)}function m0(t,e){return Lp(t,e)}function p0(t,e){var r;for(const n of t||[]){if(!n.enabled||!((r=n.pattern)!=null&&r.trim()))continue;const o=n.pattern.trim();if(o.includes("*")){const i=new RegExp("^(https?://)?"+o.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$","i");if(i.test(e)||i.test(e.replace(/^https?:\/\//,"")))return n}else if(e.includes(o))return n}return null}Promise.resolve();const cc=[{id:"summary",zh:"总结要点",en:"Summarize",prompt:"Summarize the main points with specific supporting details."},{id:"translate",zh:"翻译全文",en:"Translate",prompt:"Translate the supplied page faithfully. Preserve headings and lists."},{id:"explain",zh:"解释概念",en:"Explain",prompt:"Explain the key concepts with concrete examples and distinguish claims from evidence."},{id:"followup",zh:"继续追问",en:"Explore further",prompt:"Suggest useful follow-up questions, and explain why each matters."},{id:"grammar",zh:"语法分析",en:"Analyze grammar",prompt:"Analyze important sentences, grammar and vocabulary in this text."},{id:"card",zh:"整理阅读卡",en:"Make reading notes",prompt:"Create a concise reading card in Markdown with a title, key quotation, interpretation and practical action. Only use the supplied source."}],g0=lr({id:ct().min(1).max(100).regex(/^[a-zA-Z0-9_-]+$/),name:ct().trim().min(1).max(100),prompt:ct().trim().min(1).max(12e3),enabled:er(),order:Qt().int().min(0).max(1e4)}),v0=wr(g0).max(100).refine(t=>new Set(t.map(e=>e.id)).size===t.length,"Reading presets must have unique IDs").refine(t=>t.filter(e=>!cc.some(r=>r.id===e.id)).length+cc.length<=100,"Reading presets are limited to 100 including built-ins"),Hr=[{key:"title",name:"Title",type:"text",isBuiltin:!0,enabled:!0},{key:"source",name:"Url",type:"text",isBuiltin:!0,enabled:!0,visibleInSidepanel:!1},{key:"author",name:"Author",type:"text",isBuiltin:!0,enabled:!0},{key:"origin",name:"Origin",type:"select",isBuiltin:!0,enabled:!0},{key:"description",name:"Description",type:"text",isBuiltin:!0,enabled:!0},{key:"tags",name:"Tags",type:"multiselect",isBuiltin:!0,enabled:!0},{key:"created",name:"Created",type:"datetime",isBuiltin:!0,enabled:!0,visibleInSidepanel:!1},{key:"cover",name:"Cover",type:"text",isBuiltin:!0,enabled:!0}],ds={fields:Hr.map(t=>({...t})),dateFormat:"YYYY-MM-DD HH:mm:ss"},uc=["text","select","multiselect","datetime","date","number","checkbox"],dc=new Set(["__proto__","prototype","constructor"]),fc=t=>typeof t=="string"&&t.length<=80&&/^[\p{L}_][\p{L}\p{N}_ -]*$/u.test(t)&&!dc.has(t),hc=t=>typeof t=="string"&&/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(t)&&!dc.has(t);function fs(t){const e=t&&typeof t=="object"?t:{},r=Array.isArray(e.fields)?e.fields.slice(0,64):[],n=new Set,o=[],i=new Map(Hr.map(C=>[C.key,C])),c=new Map(Hr.map(C=>[C.name,C.key]));for(const C of r){if(!C||typeof C!="object")continue;const A=typeof C.key=="string"?C.key.trim():"";if(!hc(A)||n.has(A))continue;const a=i.get(A),s=typeof C.name=="string"?C.name.trim():"",l=fc(s)&&(!c.has(s)||c.get(s)===A)?s:(a==null?void 0:a.name)||A;o.push({key:A,name:l,type:(a==null?void 0:a.type)||(uc.includes(C.type)?C.type:"text"),isBuiltin:!!a,enabled:C.enabled!==!1,visibleInSidepanel:typeof C.visibleInSidepanel=="boolean"?C.visibleInSidepanel:(a==null?void 0:a.visibleInSidepanel)??!0}),n.add(A)}const d=new Map(o.map(C=>[C.key,C])),g=new Set,_=Hr.map(C=>{const A={...d.get(C.key)||C};return g.has(A.name)&&(A.name=C.name),g.add(A.name),A}),E=o.filter(C=>C.isBuiltin||g.has(C.name)?!1:(g.add(C.name),!0)).slice(0,64-_.length),b=typeof e.dateFormat=="string"&&e.dateFormat.trim()&&e.dateFormat.length<=120&&!/[\u0000-\u001f\u007f]/.test(e.dateFormat)?e.dateFormat:ds.dateFormat;return{fields:[..._,...E],dateFormat:b}}class b0 extends Error{constructor(r){super(`${r.zh} / ${r.en}`);Je(this,"code","frontmatter-settings");this.localized=r,this.name="FrontMatterValidationError"}}function rr(t,e){throw new b0({zh:t,en:e})}function x0(t){(!t||typeof t!="object"||Array.isArray(t))&&rr("属性设置必须是对象。","Front-matter settings must be an object.");const e=t;Object.keys(e).some(c=>!["fields","dateFormat"].includes(c))&&rr("属性设置包含未知选项。","Front-matter settings contain an unknown option."),(!Array.isArray(e.fields)||e.fields.length>64)&&rr("属性列表最多允许 64 个字段。","At most 64 front-matter fields are allowed."),(typeof e.dateFormat!="string"||!e.dateFormat.trim()||e.dateFormat.length>120||/[\u0000-\u001f\u007f]/.test(e.dateFormat))&&rr("日期格式不能为空、不能含控制字符,且最多 120 个字符。","The date format must contain 1–120 characters and no control characters.");const r=new Map(Hr.map(c=>[c.key,c])),n=new Set,o=new Set;for(const c of e.fields){(!c||typeof c!="object"||Array.isArray(c)||Object.keys(c).some(_=>!["key","name","type","isBuiltin","enabled","visibleInSidepanel"].includes(_)))&&rr("属性字段格式无效或包含未知选项。","A front-matter field has an invalid format or unknown option."),(!hc(c.key)||c.key.trim()!==c.key)&&rr("字段标识须以英文字母开头,仅含字母、数字、下划线或连字符,最多 64 字符。","Field keys must start with a letter and contain only letters, numbers, underscores or hyphens, up to 64 characters."),(!fc(c.name)||c.name.trim()!==c.name)&&rr("输出名称须以字母或下划线开头,仅含文字、数字、空格、下划线或连字符,最多 80 字符。","Output names must start with a letter or underscore and contain only letters, numbers, spaces, underscores or hyphens, up to 80 characters."),(n.has(c.key)||o.has(c.name))&&rr("字段标识和输出名称不能重复。","Field keys and output names must be unique.");const d=r.get(c.key);(!uc.includes(c.type)||d&&c.type!==d.type)&&rr("属性类型无效;内置字段的类型不可更改。","The field type is invalid; builtin field types cannot be changed."),(typeof c.enabled!="boolean"||c.visibleInSidepanel!==void 0&&typeof c.visibleInSidepanel!="boolean"||c.isBuiltin!==void 0&&(typeof c.isBuiltin!="boolean"||c.isBuiltin!==!!d))&&rr("字段启用、可见性和内置标志无效。","Field enabled, visibility or builtin flags are invalid."),Hr.find(_=>_.name===c.name&&_.key!==c.key)&&rr("输出名称与内置字段冲突,请使用另一个名称。","The output name conflicts with a builtin field; choose another name."),n.add(c.key),o.add(c.name)}const i=Hr.filter(c=>!n.has(c.key));return e.fields.length+i.length>64&&rr("保留内置字段后,属性总数不能超过 64。","The total including builtin fields cannot exceed 64."),i.some(c=>o.has(c.name))&&rr("输出名称与补回的内置字段冲突。","An output name conflicts with a restored builtin field."),fs(e)}var $o={exports:{}},y0=$o.exports,mc;function E0(){return mc||(mc=1,(function(t,e){(function(r,n){t.exports=n()})(y0,(function(){var r=1e3,n=6e4,o=36e5,i="millisecond",c="second",d="minute",g="hour",_="day",E="week",b="month",C="quarter",A="year",a="date",s="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,u=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(R){var S=["th","st","nd","rd"],y=R%100;return"["+R+(S[(y-20)%10]||S[y]||S[0])+"]"}},x=function(R,S,y){var k=String(R);return!k||k.length>=S?R:""+Array(S+1-k.length).join(y)+R},f={s:x,z:function(R){var S=-R.utcOffset(),y=Math.abs(S),k=Math.floor(y/60),N=y%60;return(S<=0?"+":"-")+x(k,2,"0")+":"+x(N,2,"0")},m:function R(S,y){if(S.date()<y.date())return-R(y,S);var k=12*(y.year()-S.year())+(y.month()-S.month()),N=S.clone().add(k,b),L=y-N<0,P=S.clone().add(k+(L?-1:1),b);return+(-(k+(y-N)/(L?N-P:P-N))||0)},a:function(R){return R<0?Math.ceil(R)||0:Math.floor(R)},p:function(R){return{M:b,y:A,w:E,d:_,D:a,h:g,m:d,s:c,ms:i,Q:C}[R]||String(R||"").toLowerCase().replace(/s$/,"")},u:function(R){return R===void 0}},v="en",p={};p[v]=m;var h="$isDayjsObject",w=function(R){return R instanceof T||!(!R||!R[h])},O=function R(S,y,k){var N;if(!S)return v;if(typeof S=="string"){var L=S.toLowerCase();p[L]&&(N=L),y&&(p[L]=y,N=L);var P=S.split("-");if(!N&&P.length>1)return R(P[0])}else{var B=S.name;p[B]=S,N=B}return!k&&N&&(v=N),N||!k&&v},M=function(R,S){if(w(R))return R.clone();var y=typeof S=="object"?S:{};return y.date=R,y.args=arguments,new T(y)},$=f;$.l=O,$.i=w,$.w=function(R,S){return M(R,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var T=(function(){function R(y){this.$L=O(y.locale,null,!0),this.parse(y),this.$x=this.$x||y.x||{},this[h]=!0}var S=R.prototype;return S.parse=function(y){this.$d=(function(k){var N=k.date,L=k.utc;if(N===null)return new Date(NaN);if($.u(N))return new Date;if(N instanceof Date)return new Date(N);if(typeof N=="string"&&!/Z$/i.test(N)){var P=N.match(l);if(P){var B=P[2]-1||0,U=(P[7]||"0").substring(0,3);return L?new Date(Date.UTC(P[1],B,P[3]||1,P[4]||0,P[5]||0,P[6]||0,U)):new Date(P[1],B,P[3]||1,P[4]||0,P[5]||0,P[6]||0,U)}}return new Date(N)})(y),this.init()},S.init=function(){var y=this.$d;this.$y=y.getFullYear(),this.$M=y.getMonth(),this.$D=y.getDate(),this.$W=y.getDay(),this.$H=y.getHours(),this.$m=y.getMinutes(),this.$s=y.getSeconds(),this.$ms=y.getMilliseconds()},S.$utils=function(){return $},S.isValid=function(){return this.$d.toString()!==s},S.isSame=function(y,k){var N=M(y);return this.startOf(k)<=N&&N<=this.endOf(k)},S.isAfter=function(y,k){return M(y)<this.startOf(k)},S.isBefore=function(y,k){return this.endOf(k)<M(y)},S.$g=function(y,k,N){return $.u(y)?this[k]:this.set(N,y)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(y,k){var N=this,L=!!$.u(k)||k,P=$.p(y),B=function(Y,W){var J=$.w(N.$u?Date.UTC(N.$y,W,Y):new Date(N.$y,W,Y),N);return L?J:J.endOf(_)},U=function(Y,W){return $.w(N.toDate()[Y].apply(N.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(W)),N)},F=this.$W,I=this.$M,H=this.$D,V="set"+(this.$u?"UTC":"");switch(P){case A:return L?B(1,0):B(31,11);case b:return L?B(1,I):B(0,I+1);case E:var X=this.$locale().weekStart||0,ne=(F<X?F+7:F)-X;return B(L?H-ne:H+(6-ne),I);case _:case a:return U(V+"Hours",0);case g:return U(V+"Minutes",1);case d:return U(V+"Seconds",2);case c:return U(V+"Milliseconds",3);default:return this.clone()}},S.endOf=function(y){return this.startOf(y,!1)},S.$set=function(y,k){var N,L=$.p(y),P="set"+(this.$u?"UTC":""),B=(N={},N[_]=P+"Date",N[a]=P+"Date",N[b]=P+"Month",N[A]=P+"FullYear",N[g]=P+"Hours",N[d]=P+"Minutes",N[c]=P+"Seconds",N[i]=P+"Milliseconds",N)[L],U=L===_?this.$D+(k-this.$W):k;if(L===b||L===A){var F=this.clone().set(a,1);F.$d[B](U),F.init(),this.$d=F.set(a,Math.min(this.$D,F.daysInMonth())).$d}else B&&this.$d[B](U);return this.init(),this},S.set=function(y,k){return this.clone().$set(y,k)},S.get=function(y){return this[$.p(y)]()},S.add=function(y,k){var N,L=this;y=Number(y);var P=$.p(k),B=function(I){var H=M(L);return $.w(H.date(H.date()+Math.round(I*y)),L)};if(P===b)return this.set(b,this.$M+y);if(P===A)return this.set(A,this.$y+y);if(P===_)return B(1);if(P===E)return B(7);var U=(N={},N[d]=n,N[g]=o,N[c]=r,N)[P]||1,F=this.$d.getTime()+y*U;return $.w(F,this)},S.subtract=function(y,k){return this.add(-1*y,k)},S.format=function(y){var k=this,N=this.$locale();if(!this.isValid())return N.invalidDate||s;var L=y||"YYYY-MM-DDTHH:mm:ssZ",P=$.z(this),B=this.$H,U=this.$m,F=this.$M,I=N.weekdays,H=N.months,V=N.meridiem,X=function(W,J,G,Q){return W&&(W[J]||W(k,L))||G[J].slice(0,Q)},ne=function(W){return $.s(B%12||12,W,"0")},Y=V||function(W,J,G){var Q=W<12?"AM":"PM";return G?Q.toLowerCase():Q};return L.replace(u,(function(W,J){return J||(function(G){switch(G){case"YY":return String(k.$y).slice(-2);case"YYYY":return $.s(k.$y,4,"0");case"M":return F+1;case"MM":return $.s(F+1,2,"0");case"MMM":return X(N.monthsShort,F,H,3);case"MMMM":return X(H,F);case"D":return k.$D;case"DD":return $.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return X(N.weekdaysMin,k.$W,I,2);case"ddd":return X(N.weekdaysShort,k.$W,I,3);case"dddd":return I[k.$W];case"H":return String(B);case"HH":return $.s(B,2,"0");case"h":return ne(1);case"hh":return ne(2);case"a":return Y(B,U,!0);case"A":return Y(B,U,!1);case"m":return String(U);case"mm":return $.s(U,2,"0");case"s":return String(k.$s);case"ss":return $.s(k.$s,2,"0");case"SSS":return $.s(k.$ms,3,"0");case"Z":return P}return null})(W)||P.replace(":","")}))},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(y,k,N){var L,P=this,B=$.p(k),U=M(y),F=(U.utcOffset()-this.utcOffset())*n,I=this-U,H=function(){return $.m(P,U)};switch(B){case A:L=H()/12;break;case b:L=H();break;case C:L=H()/3;break;case E:L=(I-F)/6048e5;break;case _:L=(I-F)/864e5;break;case g:L=I/o;break;case d:L=I/n;break;case c:L=I/r;break;default:L=I}return N?L:$.a(L)},S.daysInMonth=function(){return this.endOf(b).$D},S.$locale=function(){return p[this.$L]},S.locale=function(y,k){if(!y)return this.$L;var N=this.clone(),L=O(y,k,!0);return L&&(N.$L=L),N},S.clone=function(){return $.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},R})(),D=T.prototype;return M.prototype=D,[["$ms",i],["$s",c],["$m",d],["$H",g],["$W",_],["$M",b],["$y",A],["$D",a]].forEach((function(R){D[R[1]]=function(S){return this.$g(S,R[0],R[1])}})),M.extend=function(R,S){return R.$i||(R(S,T,M),R.$i=!0),M},M.locale=O,M.isDayjs=w,M.unix=function(R){return M(1e3*R)},M.en=p[v],M.Ls=p,M.p={},M}))})($o)),$o.exports}var A0=E0();const Po=pr(A0),je=(t,e)=>({zh:t,en:e}),Pe=(t,e,r,n={})=>({key:t,label:je(e,r),...n}),en=Pe("token","访问令牌","Access token",{required:!0,secret:!0}),qo=Pe("attachments","图片附件","Image attachments",{default:"preserve",choices:[{value:"preserve",label:je("保留原始链接","Keep original links")},{value:"native",label:je("转存到目标附件","Upload to destination attachments")}]}),hs=Pe("fieldMappings","字段映射","Property mappings"),Bo=Pe("folder","文件夹","Folder",{placeholder:"Clips"}),Fo=t=>Pe("endpoint","服务基础地址","Service base URL",{required:!0,placeholder:t}),ms={s3:[Fo("https://s3.us-east-1.amazonaws.com"),Pe("bucket","存储桶","Bucket",{required:!0}),Pe("region","区域","Region",{required:!0,default:"us-east-1"}),Pe("accessKeyId","Access key ID","Access key ID",{required:!0}),Pe("secretAccessKey","Secret access key","Secret access key",{required:!0,secret:!0}),Pe("sessionToken","临时会话令牌","Session token",{secret:!0}),Pe("pathStyle","寻址方式","Addressing style",{default:"true",choices:[{value:"true",label:je("路径式(兼容存储)","Path style (compatible storage)")},{value:"false",label:je("虚拟主机式","Virtual hosted style")}]}),Pe("prefix","路径前缀","Path prefix",{placeholder:"Forsion/Clips"}),Pe("publicBaseUrl","公开读取地址(可选)","Public read base URL (optional)",{placeholder:"https://cdn.example.com"})],oss:[Pe("bucket","存储桶","Bucket",{required:!0}),Pe("region","区域","Region",{required:!0,placeholder:"cn-hangzhou"}),Pe("accessKeyId","Access key ID","Access key ID",{required:!0}),Pe("accessKeySecret","Access key secret","Access key secret",{required:!0,secret:!0}),Pe("sessionToken","STS 临时令牌","STS token",{secret:!0}),Pe("prefix","路径前缀","Path prefix",{placeholder:"Forsion/Clips"}),Pe("publicBaseUrl","公开读取地址(可选)","Public read base URL (optional)")],cos:[Pe("bucket","存储桶(含 APPID)","Bucket (including APPID)",{required:!0,placeholder:"mybucket-1250000000"}),Pe("region","区域","Region",{required:!0,placeholder:"ap-shanghai"}),Pe("secretId","Secret ID","Secret ID",{required:!0}),Pe("secretKey","Secret key","Secret key",{required:!0,secret:!0}),Pe("sessionToken","临时会话令牌","Session token",{secret:!0}),Pe("prefix","路径前缀","Path prefix",{placeholder:"Forsion/Clips"}),Pe("publicBaseUrl","公开读取地址(可选)","Public read base URL (optional)")]};je("Markdown 文件","Markdown file"),{...Bo},Pe("fileNameTemplate","文件名模板","Filename template",{default:"{title}.md",placeholder:"{date}-{slug}.md",commitOnBlur:!0}),Pe("assetsDirTemplate","附件目录模板","Asset directory template",{default:"assets",placeholder:"{fileName}_assets",commitOnBlur:!0}),Pe("attachments","图片附件","Image attachments",{default:"preserve",choices:[{value:"preserve",label:je("保留原始链接","Keep original links")},{value:"zip",label:je("Markdown 与图片 ZIP 包","Markdown and images ZIP")},{value:"separate",label:je("Markdown 与图片分别下载","Download Markdown and images separately")}]}),je("文件名支持 {date}、{time}、{slug}、{title}、{site};附件目录支持 {fileName}。ZIP 或分别下载仅处理公开 HTTP(S) 图片,不携带登录凭据;失败保留原链接并附报告。分别下载时请保留文档与附件目录的相对位置。","Filenames support {date}, {time}, {slug}, {title}, {site}; asset folders support {fileName}. ZIP and separate downloads fetch only public HTTP(S) images without credentials; failures keep original links with a report. Keep the document and asset folder together for separate downloads."),je("剪贴板","Clipboard"),je("Obsidian","Obsidian"),Pe("vault","库名称","Vault name",{required:!0}),je("通过 Obsidian URI 交接;应用不会回传写入确认。单条保存的大文档会先完整复制到系统剪贴板,读取完成前请勿复制其他内容;批量任务的大文档请单条保存或导出 Markdown 导入。","Hands off via Obsidian URI without a write acknowledgement. Individual large documents are copied in full to the system clipboard; avoid copying other content until consumed. Save large batch documents individually or import a Markdown export."),je("Notion","Notion"),Pe("parentType","目标类型","Parent type",{default:"database",choices:[{value:"database",label:je("数据库","Database")},{value:"page",label:je("页面","Page")},{value:"data_source",label:je("数据源","Data source")}]}),Pe("parentId","页面/数据库/数据源 ID","Page / database / data source ID",{required:!0}),je("GitHub","GitHub"),Pe("owner","所有者","Owner",{required:!0}),Pe("repo","仓库","Repository",{required:!0}),Pe("branch","分支(空则默认)","Branch (default if empty)"),je("按剪藏 ID 和内容指纹创建文件;不会覆盖已有的不同内容。","Creates a file identified by clip ID and content digest; never overwrites different existing content."),je("flomo","flomo"),Pe("webhook","专属 API 地址","Private API URL",{required:!0,secret:!0,placeholder:"https://flomoapp.com/iwh/..."}),je("思源笔记","SiYuan"),Fo("http://127.0.0.1:6806"),Pe("notebook","笔记本 ID","Notebook ID",{required:!0}),je("Logseq","Logseq"),Pe("page","目标页面","Target page",{default:"TODAY"}),je("通过 Logseq quickCapture 交接到当前图谱;无法确认应用已落盘。","Hands off to quickCapture in the current graph; a completed write cannot be confirmed."),je("Joplin","Joplin"),Fo("http://127.0.0.1:41184"),Pe("parentId","笔记本 ID(可选)","Notebook ID (optional)"),Pe("syncTags","同步标签","Sync tags",{default:"false",choices:[{value:"false",label:je("不创建标签","Do not create tags")},{value:"true",label:je("创建并关联标签","Create and link tags")}]}),je("飞书","Feishu"),Pe("appId","应用 ID","App ID",{required:!0}),Pe("appSecret","应用 Secret","App secret",{required:!0,secret:!0}),Pe("folderToken","目标文件夹 Token(可选)","Folder token (optional)"),je("语雀","Yuque"),Pe("repo","知识库 ID 或 owner/repo","Repository ID or owner/repo",{required:!0}),je("Memos","Memos"),Fo("https://memos.example.com"),Pe("apiVersion","API 路径版本","API path version",{default:"v1",choices:[{value:"v1",label:je("/api/v1(兼容版)","/api/v1 (legacy)")},{value:"current",label:je("/api(新版)","/api (current)")}]}),Pe("visibility","可见性","Visibility",{default:"PRIVATE",choices:[{value:"PRIVATE",label:je("仅自己","Private")},{value:"PROTECTED",label:je("登录用户","Signed-in users")},{value:"PUBLIC",label:je("公开","Public")}]}),je("我来","Wolai"),Pe("appId","应用 ID","App ID",{required:!0}),Pe("appSecret","应用 Secret","App secret",{required:!0,secret:!0}),Pe("databaseId","多维表格 ID","Database ID",{required:!0}),Pe("titleProperty","标题列名称(空则自动检测)","Title column (detect if empty)"),je("FlowUs","FlowUs"),Pe("parentType","目标类型","Parent type",{default:"page",choices:[{value:"page",label:je("页面","Page")},{value:"database",label:je("数据库","Database")}]}),Pe("parentId","父页面/数据库 ID","Parent page / database ID"),Pe("titleProperty","标题列名称(空则自动检测)","Title column (detect if empty)"),je("Get 笔记","GetBiji"),Pe("apiKey","API key","API key",{required:!0,secret:!0}),Pe("clientId","Client ID","Client ID",{required:!0}),je("S3 文档","S3 documents"),ms.s3,je("阿里云 OSS 文档","Aliyun OSS documents"),ms.oss,je("腾讯云 COS 文档","Tencent COS documents"),ms.cos;const zo=["highlight","copy","save","save-all","flomo","translate","explain","grammar","mnemonic","vocabulary"],w0=["#F8F3DE","#FBE3E3","#E1F3E5","#DFEBFB","#EFE4FA"],pc={translateEnabled:!0,explainEnabled:!0,grammarEnabled:!0,mnemonicEnabled:!0,toolbarPosition:"above",rememberColor:!0,defaultColor:"#F8F3DE",showDestinationSelector:!0,autoAddVocabulary:!0,resultPosition:"top_left",resultX:16,resultY:16,targetLanguage:"zh-CN",translationProvider:"google",disabledSites:[],actions:[...zo],prompts:{explain:"",grammar:"",mnemonic:""}},C0={fontSize:16,width:760,fontFamily:"system",chineseFont:"system",lineHeight:1.75},Fn=["save","panel","ai","vocab","toggle","region","highlights","hide"],gc={actions:[...Fn],enabled:!0,side:"right",y:50,disabledSites:[]},S0={concurrency:3,destinationConcurrency:3,maxRetries:3,retryDelayMs:1e3};structuredClone(ds),structuredClone(gc),typeof navigator<"u"&&navigator.language.toLowerCase().startsWith("zh"),structuredClone(pc);const vc=Xg(ct(),ct().max(2e4)),bc=ct().max(253).transform(t=>t.trim().toLowerCase().replace(/\.$/,"")).refine(t=>{try{return!/[\s/*?#@]/.test(t)&&new URL(`https://${t}`).hostname===t}catch{return!1}},"Enter an exact hostname without a URL, port or wildcard"),_0=lr({translateEnabled:er().default(!0),explainEnabled:er().default(!0),grammarEnabled:er().default(!0),mnemonicEnabled:er().default(!0),toolbarPosition:tr(["above","below","hidden"]).default("above"),rememberColor:er().default(!0),defaultColor:tr(w0).default("#F8F3DE"),showDestinationSelector:er().default(!0),autoAddVocabulary:er().default(!0),resultPosition:tr(["top_left","top_right","below_selection","custom"]).default("top_left"),resultX:Qt().min(0).max(1e5).default(16),resultY:Qt().min(0).max(1e5).default(16),targetLanguage:ct().regex(/^[a-zA-Z]{2,8}(?:-[a-zA-Z0-9]{1,8})*$/).max(35).default("zh-CN"),translationProvider:tr(["google","bing","ai"]).default("google"),disabledSites:wr(bc).max(200).transform(t=>[...new Set(t)]).default([]),actions:wr(tr(zo)).max(zo.length).transform(t=>[...new Set(t)]).default([...zo]),prompts:lr({explain:ct().max(8e3).default(""),grammar:ct().max(8e3).default(""),mnemonic:ct().max(8e3).default("")}).default({explain:"",grammar:"",mnemonic:""})});lr({readerPresets:v0.default([]),frontmatter:cs().transform(t=>x0(t??ds)),preview:lr({fontSize:Qt().min(12).max(28).default(16),width:Qt().min(360).max(1200).default(760),fontFamily:tr(["system","serif","mono"]).default("system"),chineseFont:tr(["system","serif"]).default("system"),lineHeight:Qt().min(1.2).max(2.4).default(1.75)}).default(()=>({...C0})),floating:lr({actions:wr(tr(Fn)).max(Fn.length).transform(t=>[...new Set(t)]).default([...Fn]),enabled:er().default(!0),side:tr(["left","right"]).default("right"),y:Qt().min(0).max(100).default(50),disabledSites:wr(bc).max(200).default([])}).default(()=>structuredClone(gc)),queue:lr({concurrency:Qt().int().min(1).max(5).default(3),destinationConcurrency:Qt().int().min(1).max(6).default(3),maxRetries:Qt().int().min(0).max(5).default(3),retryDelayMs:Qt().int().min(1e3).max(6e4).default(1e3)}).default(()=>({...S0})),locale:tr(["zh","en"]),theme:tr(["light","dark","system"]),defaultTarget:ct().max(60),targets:wr(lr({id:ct().max(60),enabled:er(),options:vc})).max(24),cloudVault:ct().max(100),cloudFolder:ct().max(500),desktopFolder:ct().max(500),provider:ct().max(100),providers:wr(lr({id:ct().max(100),name:ct().max(100),kind:tr(["forsion","openai","anthropic","google","ollama"]),endpoint:ct().max(2048),apiKey:ct().max(1e4),model:ct().max(200)})).max(30),daily:lr({enabled:er(),hour:Qt().int().min(0).max(23),minute:Qt().int().min(0).max(59),urls:wr(ct().url()).max(200)}),imageHost:lr({enabled:er(),id:ct().max(60),options:vc}),mcp:lr({enabled:er(),endpoint:ct().max(2048),token:ct().max(256)}),autoClipSites:wr(ct().max(255)).max(100),selection:_0.default(()=>structuredClone(pc))}),Promise.resolve();function T0(t,e,r,n){return{left:t==="left"?8:Math.max(8,r-44),top:Math.max(8,Math.min(n-44,n*e/100-18))}}let zn;function Ho(){zn==null||zn(),zn=void 0}function D0(t){if(Ho(),!t.settings.enabled||t.settings.disabledSites.includes(location.hostname.toLowerCase().replace(/\.$/,"")))return;const e=(u,m)=>t.locale==="zh"?u:m,r=document.createElement("forsion-clip-launcher");r.setAttribute("data-forsion-clip","launcher");const n=r.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=Oi+`
|
|
307
|
+
.launcher{width:36px;height:36px;padding:0;border-radius:50%;display:grid;place-items:center;touch-action:none;font-weight:600;font-size:16px;user-select:none}
|
|
308
|
+
.launcher:hover{background:color-mix(in srgb,var(--text) 8%,var(--bg-card))}.launch-menu{display:grid;min-width:170px;padding:var(--menu-shell-padding);max-height:calc(100vh - 16px);overflow:auto}.launch-menu button{text-align:left;white-space:nowrap;font-size:var(--menu-text-size)}
|
|
309
|
+
`;const i=document.createElement("button");i.className="surface launcher",i.textContent="F",i.title=e("Forsion Clip · 拖动调整位置","Forsion Clip · Drag to reposition"),i.setAttribute("aria-label","Forsion Clip"),i.setAttribute("aria-haspopup","menu"),i.setAttribute("aria-expanded","false");const c=document.createElement("div");c.className="surface launch-menu",c.hidden=!0,c.setAttribute("role","menu");const d=[["panel","打开侧栏","Open side panel"],["ai","AI 阅读","AI reading"],["vocab","生词卡","Vocabulary cards"],["toggle","切换本站划词菜单","Toggle selection menu here"],["save","保存全文","Save article"],["region","选择区域","Select region"],["highlights","保存本页划线","Save page highlights"],["hide","在此网站隐藏","Hide on this site"]];for(const u of t.settings.actions||Fn){const m=d.find(p=>p[0]===u);if(!m)continue;const[,x,f]=m,v=document.createElement("button");v.textContent=e(x,f),v.setAttribute("role","menuitem"),v.addEventListener("click",p=>{p.isTrusted&&(A(),t.onAction(u))}),c.append(v)}n.append(o,i,c),document.documentElement.append(r);const g=Ri(r,t.theme);let _=t.settings.side,E=t.settings.y,b=!1;function C(){const u=T0(_,E,innerWidth,innerHeight);Object.assign(i.style,{left:u.left+"px",top:u.top+"px"}),Object.assign(c.style,{left:Math.max(8,Math.min(innerWidth-c.offsetWidth-8,_==="left"?u.left+42:u.left-c.offsetWidth-6))+"px",top:Math.max(8,Math.min(innerHeight-c.offsetHeight-8,u.top))+"px"})}function A(){c.hidden=!0,i.setAttribute("aria-expanded","false")}i.addEventListener("click",u=>{var m;if(!u.isTrusted||b){b=!1;return}c.hidden=!c.hidden,i.setAttribute("aria-expanded",String(!c.hidden)),C(),c.hidden||(m=c.firstElementChild)==null||m.focus()});let a;i.addEventListener("pointerdown",u=>{!u.isTrusted||u.button!==0||(a={x:u.clientX,y:u.clientY,pointer:u.pointerId},b=!1,i.setPointerCapture(u.pointerId))}),i.addEventListener("pointermove",u=>{!u.isTrusted||(a==null?void 0:a.pointer)!==u.pointerId||Math.hypot(u.clientX-a.x,u.clientY-a.y)<5&&!b||(b=!0,A(),_=u.clientX<innerWidth/2?"left":"right",E=Math.max(0,Math.min(100,u.clientY/innerHeight*100)),C())}),i.addEventListener("pointerup",u=>{!u.isTrusted||(a==null?void 0:a.pointer)!==u.pointerId||(a=void 0,b&&t.onPosition(_,E))}),i.addEventListener("pointercancel",()=>{a=void 0,b=!1});const s=u=>{u.composedPath().includes(r)||A()},l=u=>{if(!(c.hidden||!u.isTrusted)&&(u.key==="Escape"&&(A(),i.focus()),["ArrowDown","ArrowUp","Home","End"].includes(u.key))){u.preventDefault();const m=Array.from(c.querySelectorAll("button")),x=m.indexOf(n.activeElement),f=u.key==="Home"?0:u.key==="End"?m.length-1:(x+(u.key==="ArrowDown"?1:-1)+m.length)%m.length;m[f].focus()}};document.addEventListener("pointerdown",s,!0),n.addEventListener("keydown",l),window.addEventListener("resize",C),C(),zn=()=>{g(),document.removeEventListener("pointerdown",s,!0),window.removeEventListener("resize",C),r.remove()}}var Uo={exports:{}},k0=Uo.exports,xc;function N0(){return xc||(xc=1,(function(t,e){(function(r,n){t.exports=n()})(Object(typeof self<"u"?self:k0),(()=>(()=>{var r={2640(c,d){Object.defineProperty(d,"__esModule",{value:!0}),d.TW_ARBITRARY_RE=d.TW_SPECIAL_CLASS_RE=d.TW_COLOR_CLASS_RE=d.TAILWIND_SPECIAL=d.TAILWIND_COLORS=d.ALLOWED_ATTRIBUTES_DEBUG=d.ALLOWED_ATTRIBUTES=d.ALLOWED_EMPTY_ELEMENTS=d.FOOTNOTE_LIST_SELECTORS=d.FOOTNOTE_INLINE_REFERENCES=d.TEST_ATTRIBUTES_SELECTOR=d.PARTIAL_SELECTORS_ANCHORED_REGEX=d.PARTIAL_SELECTORS_REGEX=d.PARTIAL_SELECTORS=d.TEST_ATTRIBUTES=d.EXACT_SELECTORS_JOINED=d.EXACT_SELECTORS=d.HIDDEN_EXACT_SKIP_SELECTOR=d.HIDDEN_EXACT_SELECTOR=d.CONTENT_ELEMENT_SELECTOR=d.INLINE_ELEMENTS=d.PRESERVE_ELEMENTS=d.BLOCK_LEVEL_ELEMENTS=d.BLOCK_ELEMENTS_SET=d.BLOCK_ELEMENTS_SELECTOR=d.BLOCK_ELEMENTS=d.MOBILE_WIDTH=d.ENTRY_POINT_ELEMENTS=void 0,d.ENTRY_POINT_ELEMENTS=["#post",".post-content",".post-body",".article-content","#article-content",".js-article-content",".article_post",".article-wrapper",".entry-content",".content-article",".instapaper_body",".post",".markdown-body","article",'[role="article"]',"main",'[role="main"]',".article-body","#content","body"],d.MOBILE_WIDTH=600,d.BLOCK_ELEMENTS=["div","section","article","main","aside","header","footer","nav","content"],d.BLOCK_ELEMENTS_SELECTOR=d.BLOCK_ELEMENTS.join(","),d.BLOCK_ELEMENTS_SET=new Set(d.BLOCK_ELEMENTS),d.BLOCK_LEVEL_ELEMENTS=new Set([...d.BLOCK_ELEMENTS,"p","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","pre","blockquote","figure","figcaption","table","thead","tbody","tfoot","tr","td","th","details","summary","address","hr","form","fieldset"]),d.PRESERVE_ELEMENTS=new Set(["pre","code","table","thead","tbody","tr","td","th","ul","ol","li","dl","dt","dd","figure","figcaption","picture","details","summary","blockquote","form","fieldset"]),d.INLINE_ELEMENTS=new Set(["a","span","strong","em","i","b","u","code","br","small","sub","sup","mark","date","del","ins","q","abbr","cite","relative-time","time","font"]),d.CONTENT_ELEMENT_SELECTOR=["math","[data-mathml]",".katex",".katex-mathml",".katex-display",".MathJax",".MathJax_Display",".MathJax_SVG","mjx-container","pre","code","table","img","picture","video","blockquote","figure"].join(", ");const g=["[hidden]",'[aria-hidden="true"]',".hidden",".invisible"],_=g.map((E=>E==='[aria-hidden="true"]'?'[aria-hidden="true"]:not([class*="math"]):not(svg):not([class*="paywall"])':E));d.HIDDEN_EXACT_SELECTOR=_.join(","),d.HIDDEN_EXACT_SKIP_SELECTOR=g.join(","),d.EXACT_SELECTORS=["noscript",'script:not([type^="math/"])',"style","meta","link","audio:not([src]):not(:has(source))","video:not([src]):not(:has(source))",".jwplayer",'.ad:not([class*="gradient"])','[class^="ad-" i]','[class$="-ad" i]',"[data-ad-wrapper]",'[id^="ad-" i]','[id$="-ad" i]','[role="banner" i]','[alt*="advert" i]',".promo",".Promo","#barrier-page",".alert",'[rel="sponsored" i]','[href*="source=promotion" i]','[id="comments" i]','[id="comment" i]','div[class*="cover-"]','div[id*="cover-"]',"ads-breadcrumbs","header:not(:has(p + p)):not(:has(img))",'header[class~="fixed"]','header[class~="sticky"]',".header:not(.banner)","#header","#Header","#banner","#Banner","nav",".navigation","#navigation",'[role="navigation" i]','[role="dialog" i]','[role="alertdialog" i]','[role*="complementary" i]','[class*="pagination" i]',".menu","#siteSub",".previous",".author",".Author",'[class$="_bio"]',"#categories",".contributor",".date","#date","[data-date]",".entry-meta",".meta",".tags","#tags",'[rel="tag"]',".headline","#headline","#title","#Title","#articleTag",'[href*="/author/"]','[href*="/author?"]','[href$="/author"]','a[href*="copyright.com"]','a[href*="google.com/preferences"]','[href="#top"]','[href="#Top"]','[href="#page-header"]','[href="#content"]','[href="#site-content"]','[href="#main-content"]','[href^="#main"]','[src*="author"]',".toc",".Toc","#toc",'[href*="#toc"]',"footer","ignore",".aside",'aside:not([class*="callout"])',"button","canvas","date","dialog","fieldset","form",'input:not([type="checkbox"])','input[type="checkbox"][class*="sidebar" i]','input[type="checkbox"][id*="sidebar" i]','input[type="checkbox"][class*="drawer" i]','input[type="checkbox"][id*="drawer" i]','input[type="checkbox"][class*="hamburger" i]','input[type="checkbox"][id*="hamburger" i]','input[type="checkbox"][class*="toggle" i]','input[type="checkbox"][id*="toggle" i]','input[type="checkbox"][class*="trigger" i]','input[type="checkbox"][id*="trigger" i]',"label","option","select",'[role="listbox"]','[role="option"]',"textarea",..._,"instaread-player","iframe:not([src])",'iframe[src*="blink.net"]','iframe[src*="giscus.app"]','iframe[src*="tinypass.com"]','iframe[src*="trinitymedia.ai"]','[class="logo" i]',"#logo","#Logo","#newsletter","#Newsletter",".subscribe",'[data-component-name="ButtonCreateButton"]','[data-component-name="DigestPostEmbed"]','[data-component-name="SubscribeWidgetToDOM"]','[class*="digestPostEmbed"]',".noprint",'[data-print-layout="hide" i]','[data-block="donotprint" i]','[class*="clickable-icon" i]','li span[class*="ltx_tag" i][class*="ltx_tag_item" i]','a[href^="#"][class*="anchor" i]','a[href^="#"][class*="ref" i]:not(.ltx_ref):not(.footnote-backref)','[data-container*="most-viewed" i]',".sidebar",".Sidebar","#sidebar","#Sidebar","#side-bar","#secondary","#sitesub",'[href*="/sitemap/sitemap.xml"]','[data-link-name*="skip" i]','[aria-label*="skip" i]','[title^="Share on" i]','[aria-label="Dismiss" i]','[aria-label="Close" i]',"svg[data-icon]",'[data-testid="load-more-posts"] + div',".copyright","#copyright",".licensebox","#page-info","#rss","#feed",".gutter","#primaryaudio","#NYT_ABOVE_MAIN_CONTENT_REGION",'[data-testid="photoviewer-children-figure"] > span',"table.infobox",'[data-optimizely="related-articles-section" i]','[data-orientation="vertical"]',".gh-header-sticky",'[data-testid="issue-metadata-sticky"]'],d.EXACT_SELECTORS_JOINED=d.EXACT_SELECTORS.join(","),d.TEST_ATTRIBUTES=["class","id","data-component","data-test","data-testid","data-test-id","data-qa","data-cy"],d.PARTIAL_SELECTORS=["a-statement","(?<!main-)access-wall","activitypub","actioncall","adcontainer","addcomment","addtoany","advert","adlayout","ad-tldr","ad-placement","adplacehold","ads-container","_ad_","AdBlock_","AdUnit","after_content","after_main_article","afterpost","allterms","-alert-","alert-box","_archive","around-the-web","aroundpages","article-author","article-badges","article-banner","article-bottom-section","article-bottom","article-category","article-card","article-citation","article-continues","article__copy","article_date","article-date","article-end ","articleheader","article_header","article-header","article__header","article__hero","article__info","article-info","article-meta","article_meta","article__meta","articlename","article-subject","article_subject","article-snippet","article-separator","article--share","article-share","article--topics","article-tools","articletags","article-tags","article_tags","articletitle","article-title","article_title","articletopics","article-topics","article-actions","article--lede","articlewell","associated-people","ambient-video__button","audio-card","beyondwords","about-author","author-bio","author-box","author-info","author_info","authorm","author-mini-bio","author-name","author-publish-info","authored-by","avatar","back-to-top","backlink_container","backlinks-section","bio-block","biobox","blog-pager","bookmark-","-bookmark","bottominfo","bottomnav","bottom-of-article","bottom-wrapper","brand-bar","bcrumb","breadcrumb","brdcrumb","crumbs","bubblewrapper","button-wrapper","buttons-container","btn-","-btn","byline","captcha","card-text","card-media","card-post","carouselcontainer","carousel-container","cat_header","cat-overlay","catlinks","_categories","card-author","card-content","chapter-list","collections","comments","-comment\\b","commentbox","comment-button","commentcomp","comment-content","comment-count","comment-form","comment-number","comment-respond","comment-thread","comment-wrap","complementary","consent","contact-","contactus","cookie.law","content-card","copycontent","copy-tooltip","content-topics","contentpromo","context-bar","context-widget","core-collateral","cover-image","cover-photo","cover-wrap","created-date","creative-commons_","c-subscribe","_cta","-cta","cta-","cta_","current-issue","custom-list-number","dateline","dateheader","date-header","date-pub","disclaimer","disclosure","discussion","discuss_","-dismiss","disqus","donate","donation","dropdown","editorial_contact","editorial-contact","element-invisible","elementor-shortcode","eletters","emailsignup","emoji-bar","engagement-widget","enhancement-","entry-author-info","entry-categories","entry-date","entry-title","entry-utility","-error","error-","eyebrow","expand-reduce","external-anchor","externallinkembedwrapper","extra-services","extra-title","facebook","fancy-box","favorite","featured-content","feature_feed","feedback","feed-links","field-site-sections","filed","fixheader","floating-vid","follower","footer","footnote-back","footnoteback","form-group","for-you","frontmatter","further-reading","fullbleedheader","gallery-count","gated-popup","gh-feed","gist-meta","goog-","graph-view","hamburger","hawk-","header-pattern","hero[_\\-a-z]","hide-for-print","hide-print","hide-when-no-script","hidden-print","hidden-sidenote","hidden-accessibility","home-link","icon-sidebar","inarticle-ad","infoline","inline-topic","instacartIntegration","interlude","interaction","itemendrow","intro-date","invisible","jp-no-solution","jp-relatedposts","jswarning","js-warning","jumplink","jumpto","jump-to-","js-skip-to-content","keepreading","keep-reading","keep_reading","keyword_wrap","kicker","labstab","-labels","language-name","lastupdated","latest-content","-ledes-","-license","license-","lightbox-popup","like-button","link-box","links-grid","links-title","listing-dynamic-terms","list-tags","live-blog-header-live-label","listinks","loading","loa-info","(?:(?<![\\w-])logo|logo(?![\\w-]))","ltx_role_refnum","ltx_tag_bibitem","ltx_error","masthead","marketing","media-card","media-inquiry","-menu","menu-","metadata","meta-bottom","meta-date","meta-row","might-like","minibio","more-about","mod-paywall","_modal","-modal","more-","morenews","morestories","more_wrapper","most-read","move-helper","mw-editsection","mw-cite-backlink","mw-indicators","mw-jump-link","nav-","nav_","navcontainer","navigation-post","next-","next_prev","no-script","newsgallery","news-story-title","newsletter_","newsletterbanner","newslettercontainer","newsletter-form","newsletter-signup","newslettersignup","newsletterwidget","newsletterwrapper","not-found","notessection","nomobile","noprint","onward-journey","open-slideshow","originally-published","osano-cm","other-blogs","outline-view","pagefoot","pagehead","page-header","page-title","paywall_message","-partners","permission-","plea","popular","popup_links","pop_stories","pop-up","post__author","post-author","post-bottom","post__category","postcomment","postdate","post-date","post_date","post-details","post-feeds","postinfo","post-info","post_info","post-inline-date","post-links","postlist","post_list","post_meta","post-meta","postmeta","post_more","postnavi","post-navigation","postpath","post-preview","postsnippet","post_snippet","post-snippet","post-subject","posttax","post-tax","post_tax","posttag","post-tag","post_time","posttitle","post-title","post_title","post__title","post-ufi-button","prev-post","prevnext","prev_next","prev-next","previousnext","press-inquiries","print-none","print-header","print:hidden","privacy-notice","privacy-settings","profile","promo_article","promo-bar","promo-box","pubdate","pub_date","pub-date","publish_date","publish-date","publication-date","publicationName","qr-code","qr_code","quick_up","_rail","ratingscontainer","ratingssection","reactions","read_also","readmore","read-next","read_next","read_time","read-time","reading_time","reading-time","reading-list","recent-","recent-articles","recentpost","recent_post","recent-post","recommend","redirectedfrom","recirc","register","(?<!h[1-6]-)related","-relance","relevant","relposts","reversefootnote","rightcol","\\bnocontent\\b","_rss","rss-link","rubricwrapper","scroll_to","scroll-to","_search","-search","section-nav","series-banner","share-box","sharedaddy","share-icons","sharelinks","share-links","share-post","share-print","share-section","share-text","sharing_","shariff-","shortcode-id","show-for-print","sidebartitle","sidebar-content","sidebar-element","sidebar-wrapper","sideitems","sidebar-author","sidebar-item","side-box","sign-in-gate","similar-","similar_","similars-","site-index","site-header","siteheader","site-name","site-wordpress","skip-content","skip-to-content","skip-link","c-skip-link","_skip-link","-slider","slug-wrap","social-author","social-button","social-shar","social-date","speechify-ignore","speedbump","sponsor","springercitation","_stats","sticky-social","story-date","story-navigation","storyreadtime","storysmall","storypublishdate","subject-label","submenu","-subscribe-","subscriber-drive","subscription-","_tags","tags__item","tag_list","tag-list","tag-module","takeaways","taxonomy","table-of-contents","tblc","tabs-","terminaltout","time-rubric","timestamp","time-read","time-to-read","tip_off","-ticker","tiptout","-tout-","toc-container","toggle-caption","tooltip-content","topbar","subnavbar","topic-authors","topic-footer","topic-list","topic-subnav","top-wrapper","tree-item","trending","trust-feat","trust-badge","trust-project","chakra-badge","twiblock","u-hide","upsell","vid_carousel","viewbottom","view-language","yarpp-related","welcomebox","widget_pages","window__widget","w-form-done","w-form-fail"],d.PARTIAL_SELECTORS_REGEX=new RegExp(d.PARTIAL_SELECTORS.join("|"),"i"),d.PARTIAL_SELECTORS_ANCHORED_REGEX=new RegExp("^(?:"+d.PARTIAL_SELECTORS.join("|")+")$","i"),d.TEST_ATTRIBUTES_SELECTOR=d.TEST_ATTRIBUTES.map((E=>`[${E}]`)).join(","),d.FOOTNOTE_INLINE_REFERENCES=["sup.reference","cite.ltx_cite",'sup[id^="fnr"]','span[id^="fnr"]','span[class*="footnote_ref"]','span[class*="footnote-ref"]',"span.footnote-link","a.citation",'a[id^="ref-link"]','a[href^="#fn"]','a[href^="#cite"]','a[href^="#reference"]','a[href^="#footnote"]','a[href^="#r"]','a[href^="#b"]','a[href*="cite_note"]','a[href*="cite_ref"]',"a.footnote-anchor","span.footnote-hovercard-target a",'a[role="doc-biblioref"]','a[id^="fnref"]','a[id^="ref-link"]',"sup.footnoteref","sup.footnote-reference",'sup[data-fn] > a[href^="#"]','sup[id^="ftnt_ref"] a[href^="#ftnt"]','span.easy-footnote > a[href^="#easy-footnote-bottom-"]','a.footnote[href^="#"]','a[data-type="noteref"]'].join(","),d.FOOTNOTE_LIST_SELECTORS=["div.footnote ol","div.footnotes ol",'div[role="doc-endnotes"]','div[role="doc-footnotes"]',"ol.footnotes-list","ol.footnotes","ol.references",'ol[class*="article-references"]',"section.footnotes ol",'section[role="doc-endnotes"]','section[role="doc-footnotes"]','section[role="doc-bibliography"]',"ul.footnotes-list","ul.ltx_biblist",'div.footnote[data-component-name="FootnoteToDOM"]',"div.footnotes-footer","div.footnote-definitions","div.footnote-definition","ol.wp-block-footnotes","ol.easy-footnotes-wrapper","div.footnotes-segment","#footnotes"].join(","),d.ALLOWED_EMPTY_ELEMENTS=new Set(["area","audio","base","br","circle","col","defs","ellipse","embed","figure","g","hr","iframe","img","input","line","link","mask","meta","object","param","path","pattern","picture","polygon","polyline","rect","source","stop","svg","td","th","track","use","video","wbr"]),d.ALLOWED_ATTRIBUTES=new Set(["alt","allow","allowfullscreen","aria-label","checked","colspan","controls","data-latex","data-src","data-srcset","data-callout","data-callout-fold","data-callout-title","data-lang","dir","display","frameborder","headers","height","href","kind","label","lang","role","rowspan","sandbox","src","srclang","srcset","start","title","type","width","accent","accentunder","align","columnalign","columnlines","columnspacing","columnspan","data-mjx-texclass","depth","displaystyle","fence","frame","framespacing","linethickness","lspace","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","rowalign","rowlines","rowspacing","rowspan","rspace","scriptlevel","separator","stretchy","symmetric","voffset","xmlns"]),d.ALLOWED_ATTRIBUTES_DEBUG=new Set(["class","id"]),d.TAILWIND_COLORS={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},d.TAILWIND_SPECIAL={black:"#000",white:"#fff",transparent:"transparent",current:"currentColor"},d.TW_COLOR_CLASS_RE=/^(fill|stroke)-([a-z]+)-(\d{2,3})(?:\/(\d+))?$/,d.TW_SPECIAL_CLASS_RE=/^(fill|stroke)-(black|white|transparent|current)$/,d.TW_ARBITRARY_RE=/^text-\[(.+)\]$/},4467(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.findContentStart=function f(v,p){const h=(function(T,D){const R=(0,_.normalizeText)(D);if(!R)return null;const S=T.querySelectorAll("h1, h2");for(const y of S)if((0,_.normalizeText)(y.textContent||"")===R)return y;return null})(v,p)||null,w=v.ownerDocument.createTreeWalker(v,1);h&&(w.currentNode=h);let O=null,M=null,$=w.nextNode();for(;$;){const T=$;if(x(T)){if(l.has(T.tagName)){O=T;break}M||(M=T)}$=w.nextNode()}if(O)return O;if(M){let T=M;for(;;){let D=null,R=!1;for(const S of T.children)if(x(S)){if(D){R=!0;break}D=S}if(!D||R)break;T=D}return T}return h?f(v,""):null},d.isAboveContentStart=function(f,v){return!!v&&(0,E.isNodeBefore)(f,v)};const _=g(2552),E=g(639),b=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*|\d{4}[-/]\d{1,2}[-/]\d{1,2})/i,C=/^by\s+\S/i,A=/[.!?]/,a=/\b(?:isHidden(?:-[A-Za-z0-9_]+)?|is-hidden)\b/,s=new Set(["P","DIV","SECTION","ARTICLE","BLOCKQUOTE","FONT"]),l=new Set(["P","BLOCKQUOTE","FONT"]),u='[role="dialog"], [role="alertdialog"]',m=`aside, nav, header, footer, form, ${u}`;function x(f){if(!f.tagName||!s.has(f.tagName)||f.closest(m))return!1;const v=typeof f.className=="string"?f.className:"";if(a.test(v)||f.querySelector(u)||f.querySelector("script, style"))return!1;const p=(f.textContent||"").trim();if(!p)return!1;const h=(0,_.countWords)(p);return!(h<7)&&!!A.test(p)&&!(C.test(p)&&h<15)&&!(b.test(p)&&h<20)&&!((function(w){let O=0;for(const M of w.querySelectorAll("a"))O+=(M.textContent||"").length;return O})(f)>.7*p.length)&&!(f.tagName==="DIV"&&!f.querySelector("p"))}},5628(c,d,g){var _=this&&this.__awaiter||function($,T,D,R){return new(D||(D=Promise))((function(S,y){function k(P){try{L(R.next(P))}catch(B){y(B)}}function N(P){try{L(R.throw(P))}catch(B){y(B)}}function L(P){var B;P.done?S(P.value):(B=P.value,B instanceof D?B:new D((function(U){U(B)}))).then(k,N)}L((R=R.apply($,T||[])).next())}))};Object.defineProperty(d,"__esModule",{value:!0}),d.Defuddle=void 0;const E=g(1608),b=g(1917),C=g(2640),A=g(4840),a=g(3610),s=g(7726),l=g(3550),u=g(2408),m=g(8983),x=g(7393),f=g(3172),v=g(662),p=g(2552),h=g(639),w=new Set(["title","author","published","site","description","image","language"]),O=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE","FRAME","FRAMESET","OBJECT","EMBED","APPLET","BASE","ANIMATE","SET","ANIMATEMOTION","ANIMATETRANSFORM","ANIMATECOLOR","DISCARD"]);class M{constructor(T,D={}){this._parseErrors=new Set,this._schemaOrgData=void 0,this._schemaOrgExtracted=!1,this._inExtractorPipelineRun=!1,this.doc=T,this.options=D,this.debug=D.debug||!1}getSchemaOrgData(){return this._schemaOrgExtracted||(this._schemaOrgData=this._extractSchemaOrgData(this.doc),this._schemaOrgExtracted=!0),this._schemaOrgData}parse(){var T;const D=Date.now();return this._withDebugErrors((T=this._parse())!==null&&T!==void 0?T:this._fallbackResponse(D))}_parse(){this._parseErrors.clear();try{return this._parseWithRetries()}catch(T){return this._recordError(T),null}}_parseWithRetries(){var T,D,R,S,y,k;const N=Date.now();this.doc.body&&(this._normalizeAttributes(this.doc.body),this._resolveNoscriptImages(this.doc.body));let L=this.parseInternal();if(((T=L==null?void 0:L.wordCount)!==null&&T!==void 0?T:0)<200){this._log("Initial parse returned very little content, trying again");const B=this.parseInternal({removePartialSelectors:!1});B&&(!L||B.wordCount>2*L.wordCount)&&(this._log("Retry produced more content"),L=B)}if(((D=L==null?void 0:L.wordCount)!==null&&D!==void 0?D:0)<50){this._log("Still very little content, retrying without hidden-element removal");const B=this.parseInternal({removeHiddenElements:!1});let U;B&&(!L||B.wordCount>2*L.wordCount)&&(this._log("Hidden-element retry produced more content"),L=B);try{U=this.findLargestHiddenContentSelector()}catch(F){this._recordError(F)}if(U){this._log("Retrying with hidden content selector:",U);const F=this.parseInternal({removeHiddenElements:!1,removePartialSelectors:!1,contentSelector:U});F&&(!L||F.wordCount>L.wordCount||F.wordCount>Math.max(20,.7*L.wordCount)&&F.content.length<L.content.length)&&(this._log("Hidden-selector retry produced better focused content"),L=F)}}if(((R=L==null?void 0:L.wordCount)!==null&&R!==void 0?R:0)<50){this._log("Still very little content, retrying without scoring/partial selectors (possible index page)");const B=this.parseInternal({removeLowScoring:!1,removePartialSelectors:!1,removeContentPatterns:!1});B&&(!L||B.wordCount>L.wordCount)&&(this._log("Index page retry produced more content"),L=B)}const P=this._getSchemaText((S=L==null?void 0:L.schemaOrgData)!==null&&S!==void 0?S:(y=this._metadata)===null||y===void 0?void 0:y.schemaOrgData);if(P&&this.countHtmlWords(P)>1.5*((k=L==null?void 0:L.wordCount)!==null&&k!==void 0?k:0)){const B=this.doc;try{const U=B.cloneNode(!0);this._stripUnsafeElements(U.body),this.doc=U;const F=this._findElementBySchemaText(this.doc.body,P);if(F){const I=this.getElementSelector(F);this._log("Schema.org suggests a better content element, retrying with selector:",I);const H=this.parseInternal({contentSelector:I});H&&(L=H)}else{this._log("Using schema.org text as content (DOM element not found)");const I=this._sanitizeExtractorHtml(P);L?(L.content=I,L.wordCount=this.countHtmlWords(I)):L=this._metadataResponse(I,N)}}catch(U){this._recordError(U)}finally{this.doc=B}}return L}_getSchemaText(T,D=0){if(!T||D>10)return"";const R=Array.isArray(T)?T:[T];for(const S of R)if(Array.isArray(S)){const y=this._getSchemaText(S,D+1);if(y)return y}else{if(S!=null&&S.text&&typeof S.text=="string")return S.text;if(S!=null&&S.articleBody&&typeof S.articleBody=="string")return S.articleBody;if(S!=null&&S["@graph"]&&Array.isArray(S["@graph"])){const y=this._getSchemaText(S["@graph"],D+1);if(y)return y}}return""}_ensureMetadata(){this._metaTags||(this._metaTags=this._collectMetaTags()),this._metadata||(this._metadata=E.MetadataExtractor.extract(this.doc,this.getSchemaOrgData(),this._metaTags,this.options.url))}_emptyMetadata(){let T="";try{T=this.options.url?new URL(this.options.url).hostname:""}catch{}return{title:"",description:"",domain:T,favicon:"",image:"",language:"",published:"",author:"",site:"",schemaOrgData:null}}_metadataResponse(T,D){var R;try{this._ensureMetadata()}catch(S){this._recordError(S)}return Object.assign(Object.assign({content:T},(R=this._metadata)!==null&&R!==void 0?R:this._emptyMetadata()),{wordCount:this.countHtmlWords(T),parseTime:Math.round(Date.now()-D),metaTags:this._metaTags})}_recordError(T){console.error("Defuddle","Error processing document:",T),this._parseErrors.add(String(T))}_withDebugErrors(T){return this.debug&&this._parseErrors.size>0&&(T.debug=Object.assign(Object.assign({contentSelector:"",removals:[]},T.debug),{errors:[...this._parseErrors]})),T}_fallbackResponse(T){return this._metadataResponse(this._serializeFallbackBody(),T)}_serializeFallbackBody(){if(!this.doc.body)return"";const T=this.doc.body.cloneNode(!0);return this._stripUnsafeElements(T),this.resolveContentUrls((0,h.serializeHTML)(T))}_stripUnsafeElements(T){if(!T)return!1;const D=this._isUnsafeElement(T);D&&this._neutralizeUnsafeElement(T);const R=T.querySelectorAll('script:not([type^="math/"]), style, noscript, template, frame, frameset, object, embed, applet, base, animate, set, animatemotion, animatetransform, animatecolor, discard, animateMotion, animateTransform, animateColor');for(const y of R)y.remove();const S=[T,...Array.from(T.querySelectorAll("*"))];for(const y of S)for(const k of Array.from(y.attributes)){const N=k.name.toLowerCase();if(N.startsWith("on"))y.removeAttribute(k.name);else if(N==="srcdoc")y.removeAttribute(k.name);else if(["href","src","action","formaction","xlink:href"].includes(N)){const L=!(N==="src"&&y.tagName==="IFRAME");(0,h.isDangerousUrl)(k.value,L)&&y.removeAttribute(k.name)}}return D}_isUnsafeElement(T){const D=T.tagName.toUpperCase();return D==="SCRIPT"?!(T.getAttribute("type")||"").toLowerCase().startsWith("math/"):O.has(D)}_neutralizeUnsafeElement(T){for(const R of Array.from(T.attributes))T.removeAttribute(R.name);for(;T.firstChild;)T.removeChild(T.firstChild);const D=T.content;if(D)for(;D.firstChild;)D.removeChild(D.firstChild)}_deduplicateImages(T){for(const R of T.querySelectorAll("figure")){const S=Array.from(R.querySelectorAll("img")).filter((k=>!k.closest("noscript")&&k.parentElement));if(S.length<2)continue;const y=new Map;for(const k of S){const N=k.getAttribute("src")||"";if(!N||N.startsWith("data:"))continue;const L=(k.getAttribute("alt")||"").trim()||null,P=y.get(L)||[];P.push(k),y.set(L,P)}for(const[k,N]of y)N.length<2||k!==null&&N.every((L=>L.getAttribute("src")===N[0].getAttribute("src")))||this._keepBestImage(N)}const D=Array.from(T.querySelectorAll("img"));for(let R=0;R<D.length-1;R++){const S=D[R];if(!S.parentElement||S.closest("noscript")||S.closest("figure"))continue;const y=(S.getAttribute("alt")||"").trim();if(!y)continue;const k=S.getAttribute("src")||"";if(!k||k.startsWith("data:"))continue;const N=D[R+1];if(!N.parentElement||N.closest("noscript")||N.closest("figure")||(N.getAttribute("alt")||"").trim()!==y)continue;const L=N.getAttribute("src")||"";L&&!L.startsWith("data:")&&L!==k&&this._noVisibleContentBetween(S,N)&&this._keepBestImage([S,N])}for(const R of Array.from(T.querySelectorAll("img"))){if(!R.parentElement||R.closest("a, figure, noscript"))continue;const S=R.getAttribute("src")||"";if(!S||S.startsWith("data:"))continue;const y=R.parentElement,k=this._normalizeSrc(S);for(const N of y.querySelectorAll(":scope > a[href]")){if(!N.querySelector("img"))continue;const L=N.getAttribute("href")||"";if(k===this._normalizeSrc(L)){R.remove();break}}}}_keepBestImage(T){let D=T[0];for(let R=1;R<T.length;R++){const S=this._pickBestImage(D,T[R]);(S===D?T[R]:D).remove(),D=S}}_noVisibleContentBetween(T,D){const R=S=>{if(!S)return null;if(S.firstChild)return S.firstChild;let y=S;for(;y;){if(y.nextSibling)return y.nextSibling;y=y.parentNode}return null};for(let S=R(T);S&&S!==D;S=R(S))if(S.nodeType===3&&(S.textContent||"").trim())return!1;return!0}_normalizeSrc(T){return T.replace(/^https?:\/\//,"").split("?")[0]}_removeCoverImage(T,D){if(!D)return;const R=this._normalizeSrc(D);for(const S of T.querySelectorAll("img")){const y=S.getAttribute("src")||"";if(!y||y.startsWith("data:")||this._normalizeSrc(y)!==R)continue;const k=this._getLargestImageSrc(S),N=S.closest("figure");return N&&N.querySelector("figcaption")||S.remove(),k}}_pickBestImage(T,D){const R=T.getAttribute("srcset")?2:T.closest("picture")?1:0,S=D.getAttribute("srcset")?2:D.closest("picture")?1:0;if(R!==S)return R>S?T:D;const y=M._urlWidth(T),k=M._urlWidth(D);return y!==k?y>k?T:D:T}static _urlWidth(T){const D=(T.getAttribute("src")||"").match(M._urlWidthPattern);return D?parseInt(D[1],10):0}_normalizeAttributes(T){const D=[["srcSet","srcset"]],R=T.querySelectorAll("img, source");for(const S of R)for(const[y,k]of D){const N=S.getAttribute(y);N!==null&&(S.removeAttribute(y),S.setAttribute(k,N))}}_resolveNoscriptImages(T){const D=T.querySelectorAll("noscript");for(const R of D){let S=R.querySelector("img");if(!S){let B=R.innerHTML||"";if(B.includes("<img")||(B=R.textContent||""),!B.includes("<img"))continue;S=(0,h.parseHTML)(this.doc,B).querySelector("img")}if(!S)continue;const y=S.getAttribute("src")||"";if(!y||y.startsWith("data:"))continue;const k=S.getAttribute("alt"),N=R.parentElement;if(!N)continue;let L=!1;const P=N.querySelectorAll(":scope > img");for(const B of P){if(!(B.getAttribute("src")||"").startsWith("data:")||!k||B.getAttribute("alt")!==k)continue;B.setAttribute("src",y);const U=S.getAttribute("srcset")||"";U&&B.setAttribute("srcset",U),L=!0;break}if(!L&&this._isLazyImageContext(R)){const B=(R.closest("figure")||N).querySelectorAll("img");let U=!1;for(const F of B){if(F.closest("noscript"))continue;const I=F.getAttribute("src")||"";if(I&&!I.startsWith("data:")){U=!0;break}}if(!U){const F=S.cloneNode(!0);N.insertBefore(F,R)}}}}_isLazyImageContext(T){if(T.closest("figure"))return!0;const D=T.parentElement;if(D){for(const S of D.children)if(S!==T&&(0,h.getClassName)(S).toLowerCase().includes("lazy"))return!0;const R=(0,h.getClassName)(D).toLowerCase();if(R.includes("image")||R.includes("img")||R.includes("picture")||R.includes("photo")||R.includes("media"))return!0}return!1}_findElementBySchemaText(T,D){var R;const S=(((R=D.split(/\n\s*\n/)[0])===null||R===void 0?void 0:R.trim())||"").substring(0,100).trim();if(!S)return null;const y=(0,p.countWords)(D);let k=null,N=1/0;const L=T.querySelectorAll("*");for(const P of L){if(P===T)continue;const B=P.textContent||"";if(!B.includes(S))continue;const U=(0,p.countWords)(B);U>=.8*y&&U<N&&(N=U,k=P)}return k}findLargestHiddenContentSelector(){if(!this.doc.body)return;const T=this.doc.cloneNode(!0);this.flattenShadowRoots(this.doc,T),this.resolveStreamedContent(T);const D=T.body;if(!D)return;const R=Array.from(D.querySelectorAll(C.HIDDEN_EXACT_SKIP_SELECTOR)).filter((k=>!(k.getAttribute("class")||"").includes("math")));let S=null,y=0;for(const k of R){const N=(0,p.countWords)(k.textContent||"");N>y&&(S=k,y=N)}return!S||y<30?void 0:this.getElementSelector(S)}_getLargestImageSrc(T){const D=T.getAttribute("srcset")||"";if(!D)return T.getAttribute("src")||"";const R=/(.+?)\s+(\d+(?:\.\d+)?)w/g;let S,y="",k=0,N=0;for(;(S=R.exec(D))!==null;){let P=S[1].trim();N>0&&(P=P.replace(/^,\s*/,"")),N=R.lastIndex;const B=parseFloat(S[2]);P&&B>k&&(k=B,y=P)}let L=y||T.getAttribute("src")||"";return L=L.replace(/,w_\d+/g,"").replace(/,c_\w+/g,""),L}parseAsync(){return _(this,void 0,void 0,(function*(){if(this.options.useAsync!==!1){const S=yield this.tryAsyncExtractor(b.ExtractorRegistry.findPreferredAsyncExtractor.bind(b.ExtractorRegistry));if(S!=null&&S.content.trim())return S}const T=Date.now(),D=this._parse();if(D&&D.wordCount>0||this.options.useAsync===!1)return this._withDebugErrors(D??this._fallbackResponse(T));const R=yield this.tryAsyncExtractor(b.ExtractorRegistry.findAsyncExtractor.bind(b.ExtractorRegistry));return R!=null&&R.content.trim()?this._withDebugErrors(R):this._withDebugErrors(D??this._fallbackResponse(T))}))}fetchAsyncVariables(){return _(this,void 0,void 0,(function*(){var T;if(this.options.useAsync===!1)return null;try{const D=this.options.url||this.doc.URL,R=this.getSchemaOrgData(),S={includeReplies:(T=this.options.includeReplies)!==null&&T!==void 0?T:"extractors",language:this.options.language,fetch:this.options.fetch},y=b.ExtractorRegistry.findPreferredAsyncExtractor(this.doc,D,R,S);if(y){const k=yield y.extractAsync();return this.getExtractorVariables(k.variables)||null}}catch(D){console.error("Defuddle","Error fetching async variables:",D)}return null}))}tryAsyncExtractor(T){return _(this,void 0,void 0,(function*(){var D;try{const R=this.options.url||this.doc.URL,S=this.getSchemaOrgData(),y={includeReplies:(D=this.options.includeReplies)!==null&&D!==void 0?D:"extractors",language:this.options.language,fetch:this.options.fetch},k=T(this.doc,R,S,y);if(k){const N=Date.now(),L=yield k.extractAsync(),P=this._collectMetaTags(),B=E.MetadataExtractor.extract(this.doc,S,P,R);return this.buildExtractorResponse(L,B,N,k,P)}}catch(R){console.error("Defuddle","Error in async extraction:",R)}return null}))}parseInternal(T={}){var D,R,S,y,k,N,L;const P=Date.now(),B={},U=(D=this.options.profile)!==null&&D!==void 0&&D,F=(Y,W)=>{if(!U)return W();const J=performance.now(),G=W();return B[Y]=Math.round(performance.now()-J),G};if(!this.doc.documentElement)return Object.assign(Object.assign({content:""},this._emptyMetadata()),{parseTime:Date.now()-P,wordCount:0});const I=Object.assign(Object.assign({removeExactSelectors:!0,removePartialSelectors:!0,removeHiddenElements:!0,removeLowScoring:!0,removeSmallImages:!0,removeContentPatterns:!0,standardize:!0,includeReplies:"extractors"},this.options),T),H=[],V=this.getSchemaOrgData();this._ensureMetadata();const X=this._metaTags,ne=this._metadata;I.removeImages&&this.removeImages(this.doc);try{const Y=I.url||this.doc.URL,W={includeReplies:I.includeReplies,language:I.language,fetch:I.fetch};if(!this._inExtractorPipelineRun){const fe=b.ExtractorRegistry.findExtractor(this.doc,Y,V,W);if(fe&&fe.canExtract()){const le=fe.extract();if(le.contentSelector){this._inExtractorPipelineRun=!0;try{const he=this.parseInternal({contentSelector:le.contentSelector,removeLowScoring:!1,removeHiddenElements:!1});if(!he)return null;const we=this.getExtractorVariables(le.variables);return Object.assign(Object.assign(Object.assign({},he),{title:((R=le.variables)===null||R===void 0?void 0:R.title)||he.title,description:((S=le.variables)===null||S===void 0?void 0:S.description)||he.description,author:((y=le.variables)===null||y===void 0?void 0:y.author)||he.author,published:((k=le.variables)===null||k===void 0?void 0:k.published)||he.published,site:((N=le.variables)===null||N===void 0?void 0:N.site)||he.site,language:((L=le.variables)===null||L===void 0?void 0:L.language)||he.language,extractorType:fe.constructor.name.replace("Extractor","").toLowerCase()}),we?{variables:we}:{})}finally{this._inExtractorPipelineRun=!1}}return this.buildExtractorResponse(le,ne,P,fe,X)}}this._mobileStyles||(this._mobileStyles=this._evaluateMediaQueries(this.doc));const J=this._mobileStyles;this._smallImages||(this._smallImages=(0,u.findSmallImages)(this.doc,this.debug));const G=this._smallImages;let Q;F("cloneDocument",(()=>{var fe;Q=this.doc.cloneNode(!0),(fe=Q.body)===null||fe===void 0||fe.normalize()})),F("flattenShadowRoots",(()=>this.flattenShadowRoots(this.doc,Q))),F("resolveStreamedContent",(()=>this.resolveStreamedContent(Q))),F("applyMobileStyles",(()=>this.applyMobileStyles(Q,J)));const ie=F("findMainContent",(()=>{let fe=null;if(I.contentSelector){try{fe=Q.querySelector(I.contentSelector)}catch(le){this._log("Invalid contentSelector, falling back to auto-detection:",I.contentSelector,le),this._parseErrors.add(`Invalid contentSelector "${I.contentSelector}": ${String(le)}`)}this._log("Using contentSelector:",I.contentSelector,fe?"found":"not found")}if(fe||(fe=this.findMainContent(Q)),fe){const le=fe.closest("[data-defuddle]");le&&(fe=le)}if(fe&&fe.tagName.toLowerCase()==="body"){const le=this._getSchemaText(V);if(le){const he=this._findElementBySchemaText(Q.body,le);he&&(this._log("Found content element via schema.org text"),fe=he)}}return fe}));if(!ie)return null;const K=this.debug?this.getElementSelector(ie):"";F("removeMetadataBlock",(()=>{(ne.published||ne.author)&&(0,v.removeMetadataBlock)(ie),ie.querySelectorAll("wbr").forEach((fe=>fe.remove()))})),F("adoptExternalFootnotes",(()=>{I.standardize&&this.adoptExternalFootnotes(ie,Q)})),F("standardizeFootnotesCallouts",(()=>{I.standardize&&((0,a.standardizeFootnotes)(ie),(0,s.standardizeCallouts)(ie))})),F("removeSmallImages",(()=>{I.removeSmallImages&&(0,u.removeSmallImages)(Q,G,this.debug)})),F("removeHiddenElements",(()=>{I.removeHiddenElements&&(0,m.removeHiddenElements)(Q,this.debug,H)})),F("removeEyebrowLabel",(()=>{I.removeContentPatterns&&ie&&(0,f.removeEyebrowLabel)(ie,this.debug,H)})),F("removeBySelector",(()=>{(I.removeExactSelectors||I.removePartialSelectors)&&(0,x.removeBySelector)(Q,this.debug,I.removeExactSelectors,I.removePartialSelectors,ie,H,I.removeHiddenElements===!1)})),F("removeLowScoring",(()=>{I.removeLowScoring&&l.ContentScorer.scoreAndRemove(Q,this.debug,H,ie)})),F("removeByContentPattern",(()=>{if(I.removeContentPatterns&&ie){const fe=this.options.url||this.doc.URL||"";(0,f.removeByContentPattern)(ie,this.debug,fe,ne.title||"",ne.description||"",H)}})),F("standardizeContent",(()=>{I.standardize&&(0,A.standardizeContent)(ie,ne,this.doc,this.debug,U?B:void 0)})),F("resolveRelativeUrls",(()=>this.resolveRelativeUrls(ie))),this._deduplicateImages(ie);const re=this._removeCoverImage(ie,ne.image||"");re&&(ne.image=re);const ce=this._stripUnsafeElements(ie)?"":ie.outerHTML,se=Date.now(),ue=Object.assign(Object.assign({content:ce},ne),{wordCount:this.countHtmlWords(ce),parseTime:Math.round(se-P),metaTags:X});return this.debug&&(ue.debug={contentSelector:K,removals:H}),this.options.profile&&(ue.profile=B),ue}catch(Y){return this._recordError(Y),null}}countHtmlWords(T){const D=T.replace(/<[^>]*>/g," ").replace(/ /gi," ").replace(/&/gi,"&").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/&#\d+;/g," ").replace(/&\w+;/g," ");return(0,p.countWords)(D)}_log(...T){this.debug&&console.log("Defuddle:",...T)}_evaluateMediaQueries(T){const D=[],R=/max-width[^:]*:\s*(\d+)/;try{if(!T.styleSheets)return D;Array.from(T.styleSheets).filter((y=>{try{return y.cssRules,!0}catch(k){return k instanceof DOMException&&k.name,!1}})).flatMap((y=>{try{return typeof CSSMediaRule>"u"?[]:Array.from(y.cssRules).filter((k=>k instanceof CSSMediaRule&&k.conditionText.includes("max-width")))}catch(k){return this.debug&&console.warn("Defuddle: Failed to process stylesheet:",k),[]}})).forEach((y=>{const k=y.conditionText.match(R);if(k){const N=parseInt(k[1]);C.MOBILE_WIDTH<=N&&Array.from(y.cssRules).filter((L=>L instanceof CSSStyleRule)).forEach((L=>{try{D.push({selector:L.selectorText,styles:L.style.cssText})}catch(P){this.debug&&console.warn("Defuddle: Failed to process CSS rule:",P)}}))}}))}catch(S){console.error("Defuddle: Error evaluating media queries:",S)}return D}applyMobileStyles(T,D){D.forEach((({selector:R,styles:S})=>{try{T.querySelectorAll(R).forEach((y=>{y.setAttribute("style",(y.getAttribute("style")||"")+S)}))}catch(y){console.error("Defuddle","Error applying styles for selector:",R,y)}}))}removeImages(T){const D=T.getElementsByTagName("img");Array.from(D).forEach((R=>{R.remove()}))}findMainContent(T){const D=[];if(C.ENTRY_POINT_ELEMENTS.forEach(((y,k)=>{T.querySelectorAll(y).forEach((N=>{let L=40*(C.ENTRY_POINT_ELEMENTS.length-k);L+=l.ContentScorer.scoreElement(N),D.push({element:N,score:L,selectorIndex:k})}))})),D.length===0)return this.findContentByScoring(T);if(D.sort(((y,k)=>k.score-y.score)),this.debug&&this._log("Content candidates:",D.map((y=>({element:y.element.tagName,selector:this.getElementSelector(y.element),score:y.score})))),D.length===1&&D[0].element.tagName.toLowerCase()==="body"){const y=this.findTableBasedContent(T);if(y)return y}const R=D[0];let S=R;for(let y=1;y<D.length;y++){const k=D[y],N=(0,p.countWords)(k.element.textContent||"");if(k.selectorIndex<S.selectorIndex&&S.element.contains(k.element)&&N>50){let L=0;for(const P of D)if(P.selectorIndex===k.selectorIndex&&R.element.contains(P.element)&&++L>1)break;if(L>1)continue;S=k}}return S!==R?S.element:R.element}findTableBasedContent(T){if(!Array.from(T.getElementsByTagName("table")).some((y=>{var k;const N=parseInt(y.getAttribute("width")||"0"),L=this.getComputedStyle(y),P=(0,h.getClassName)(y).toLowerCase();return N>400||((k=L==null?void 0:L.width)===null||k===void 0?void 0:k.includes("px"))&&parseInt(L.width)>400||y.getAttribute("align")==="center"||P.includes("content")||P.includes("article")||Array.from(y.getElementsByTagName("tr")).some((B=>{const U=Array.from(B.children).filter((F=>F.tagName==="TD"));return U.length>=2&&U.some((F=>F.getAttribute("width")))}))})))return null;const R=Array.from(T.getElementsByTagName("td")),S=l.ContentScorer.findBestElement(R);return S?2*(0,p.countWords)(S.textContent||"")<(0,p.countWords)((T.body||T.documentElement).textContent||"")?null:S:null}findContentByScoring(T){const D=[];return T.querySelectorAll(C.BLOCK_ELEMENTS_SELECTOR).forEach((R=>{const S=l.ContentScorer.scoreElement(R);S>0&&D.push({score:S,element:R})})),D.length>0?D.sort(((R,S)=>S.score-R.score))[0].element:null}getElementSelector(T){const D=[];let R=T;for(;R&&R!==this.doc.documentElement;){let S=R.tagName.toLowerCase();const y=R.id?(0,h.classOrIdSelector)("id",R.id):null,k=y?[]:(0,h.getClassName)(R).split(/[\t\n\f\r ]+/).filter((N=>(0,h.classOrIdSelector)("class",N)!==null));if(S+=y??k.map((N=>(0,h.classOrIdSelector)("class",N))).join(""),!y&&R.parentElement){const N=Array.from(R.parentElement.children),L=R.tagName,P=N.filter((B=>B.tagName===L));P.filter((B=>k.every((U=>B.classList.contains(U))))).length>1&&(S+=`:nth-of-type(${P.indexOf(R)+1})`)}D.unshift(S),R=R.parentElement}return D.join(" > ")}getComputedStyle(T){return(0,p.getComputedStyle)(T)}adoptExternalFootnotes(T,D){const R=D.body||D;R&&T!==R&&R.querySelectorAll("div, section, aside").forEach((S=>{var y;const k=(0,h.getClassName)(S),N=S.id||"";if(!/footnote/i.test(k)&&!/footnote/i.test(N)||T.contains(S)||S.contains(T))return;const L=S.querySelector("h1, h2, h3, h4, h5, h6");L&&a.FOOTNOTE_SECTION_RE.test(((y=L.textContent)===null||y===void 0?void 0:y.trim())||"")&&T.appendChild(S)}))}resolveRelativeUrls(T){const D=this.options.url||this.doc.URL;if(!D)return;let R=D;const S=this.doc.querySelector("base[href]");if(S){const k=S.getAttribute("href");if(k)try{R=new URL(k,D).href}catch{}}const y=k=>{const N=k.trim().replace(/^\\?["']+/,"").replace(/\\?["']+$/,"");if(N.startsWith("#"))return N;try{return new URL(N,R).href}catch{return N||k}};T.querySelectorAll("[href]").forEach((k=>{const N=k.getAttribute("href");N&&k.setAttribute("href",y(N))})),T.querySelectorAll("[src]").forEach((k=>{const N=k.getAttribute("src");N&&k.setAttribute("src",y(N))})),T.querySelectorAll("[srcset]").forEach((k=>{const N=k.getAttribute("srcset");if(N){const L=/(.+?)\s+(\d+(?:\.\d+)?[wx])/g,P=[];let B,U=0;for(;(B=L.exec(N))!==null;){let F=B[1].trim();U>0&&(F=F.replace(/^,\s*/,"")),U=L.lastIndex,P.push(`${y(F)} ${B[2]}`)}if(P.length>0)k.setAttribute("srcset",P.join(", "));else{const F=N.split(",").map((I=>{const H=I.trim().split(/\s+/);return H[0]&&(H[0]=y(H[0])),H.join(" ")})).join(", ");k.setAttribute("srcset",F)}}})),T.querySelectorAll("[poster]").forEach((k=>{const N=k.getAttribute("poster");N&&k.setAttribute("poster",y(N))}))}flattenDeclarativeShadowRoots(T){if(T.body)for(let D=0;D<10;D++){const R=Array.from(T.body.querySelectorAll("template[shadowrootmode], template[shadowroot]")).filter((S=>{var y,k;const N=((k=(y=S.getAttribute("shadowrootmode"))!==null&&y!==void 0?y:S.getAttribute("shadowroot"))!==null&&k!==void 0?k:"").toLowerCase();return N==="open"||N==="closed"}));if(R.length===0)return;for(const S of R){const y=S.parentNode;if(!y)continue;const k=S.content,N=k&&k.firstChild?k:S;for(;N.firstChild;)y.insertBefore(N.firstChild,S);S.remove()}}}flattenShadowRoots(T,D){var R,S,y;if(!T.body||!D.body)return;const k=Array.from(T.body.querySelectorAll("*")),N=Array.from(D.body.querySelectorAll("*"));this.flattenDeclarativeShadowRoots(D);const L=k.find((P=>P.shadowRoot));if(L)if(((y=(S=(R=L.shadowRoot)===null||R===void 0?void 0:R.childNodes)===null||S===void 0?void 0:S.length)!==null&&y!==void 0?y:0)>0)for(let P=k.length-1;P>=0;P--){const B=k[P];if(!B.shadowRoot)continue;const U=N[P];if(!U)continue;const F=B.shadowRoot.innerHTML;F.length>0&&this.replaceShadowHost(U,F,D)}else{const P=[];for(let B=0;B<k.length;B++){const U=k[B],F=U.getAttribute("data-defuddle-shadow");if(!F)continue;const I=N[B];I&&(P.push({cloneEl:I,html:F}),U.removeAttribute("data-defuddle-shadow"),I.removeAttribute("data-defuddle-shadow"))}for(const{cloneEl:B,html:U}of P)this.replaceShadowHost(B,U,D)}}resolveStreamedContent(T){const D=T.querySelectorAll("script"),R=[],S=/\$RC\("(B:\d+)","(S:\d+)"\)/g;for(const k of D){const N=k.textContent||"";if(!N.includes("$RC("))continue;let L;for(S.lastIndex=0;(L=S.exec(N))!==null;)R.push({templateId:L[1],contentId:L[2]})}if(R.length===0)return;let y=0;for(const{templateId:k,contentId:N}of R){const L=T.getElementById(k),P=T.getElementById(N);if(!L||!P)continue;const B=L.parentNode;if(!B)continue;let U=L.nextSibling,F=!1;for(;U;){const I=U.nextSibling;if(U.nodeType===8&&U.data==="/$"){U.remove(),F=!0;break}U.remove(),U=I}if(F){for(;P.firstChild;)B.insertBefore(P.firstChild,L);L.remove(),P.remove(),y++}}y>0&&this._log("Resolved streamed content:",y,"suspense boundaries")}replaceShadowHost(T,D,R){var S;const y=(0,h.parseHTML)(R,D);if(T.tagName.includes("-")){const k=R.createElement("div");k.appendChild(y),(S=T.parentNode)===null||S===void 0||S.replaceChild(k,T)}else T.textContent="",T.appendChild(y)}resolveContentUrls(T){if(!(this.options.url||this.doc.URL))return T;const D=this.doc.createElement("div");return D.appendChild((0,h.parseHTML)(this.doc,T)),this.resolveRelativeUrls(D),(0,h.serializeHTML)(D)}_extractSchemaOrgData(T){const D=T.querySelectorAll('script[type="application/ld+json"]'),R=[];D.forEach((y=>{let k=y.textContent||"";try{k=k.replace(/\/\*[\s\S]*?\*\/|^\s*\/\/.*$/gm,"").replace(/^\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*$/,"$1").replace(/^\s*(\*\/|\/\*)\s*|\s*(\*\/|\/\*)\s*$/g,"").trim();const N=JSON.parse(k);N["@graph"]&&Array.isArray(N["@graph"])?R.push(...N["@graph"]):R.push(N)}catch(N){console.error("Defuddle: Error parsing schema.org data:",N),this.debug&&console.error("Defuddle: Problematic JSON content:",k)}}));const S=y=>{if(typeof y=="string")return this._decodeHTMLEntities(y);if(Array.isArray(y))return y.map(S);if(typeof y=="object"&&y!==null){const k={};for(const N in y)Object.prototype.hasOwnProperty.call(y,N)&&(k[N]=S(y[N]));return k}return y};return R.map(S)}_collectMetaTags(){const T=[];return this.doc.querySelectorAll("meta").forEach((D=>{const R=D.getAttribute("name"),S=D.getAttribute("property");let y=D.getAttribute("content");y&&T.push({name:R,property:S,content:this._decodeHTMLEntities(y)})})),T}_decodeHTMLEntities(T){return(0,h.decodeHTMLEntities)(this.doc,T)}buildExtractorResponse(T,D,R,S,y){var k,N,L,P,B,U;const F=this._sanitizeExtractorHtml(T.contentHtml),I=this.getExtractorVariables(T.variables);return Object.assign({content:F,title:((k=T.variables)===null||k===void 0?void 0:k.title)||D.title,description:((N=T.variables)===null||N===void 0?void 0:N.description)||D.description,domain:D.domain,favicon:D.favicon,image:D.image,language:((L=T.variables)===null||L===void 0?void 0:L.language)||D.language,published:((P=T.variables)===null||P===void 0?void 0:P.published)||D.published,author:((B=T.variables)===null||B===void 0?void 0:B.author)||D.author,site:((U=T.variables)===null||U===void 0?void 0:U.site)||D.site,schemaOrgData:D.schemaOrgData,wordCount:this.countHtmlWords(F),parseTime:Math.round(Date.now()-R),extractorType:S.constructor.name.replace("Extractor","").toLowerCase(),metaTags:y},I?{variables:I}:{})}_sanitizeExtractorHtml(T){if(!T)return T;const D=this.doc.createElement("div");return D.appendChild((0,h.parseHTML)(this.doc,T)),this._stripUnsafeElements(D),this.resolveRelativeUrls(D),(0,A.standardizeExtractorOutput)(D,this.debug),(0,h.serializeHTML)(D)}getExtractorVariables(T){if(!T)return;const D={};let R=!1;for(const[S,y]of Object.entries(T))w.has(S)||(D[S]=y,R=!0);return R?D:void 0}}d.Defuddle=M,M._urlWidthPattern=/(?:width[=:/]|[/,?&]w[_:=])(\d+)/},7726(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.standardizeCallouts=function(b){var C,A;const a=b.ownerDocument;if(!a)return;const s=Array.from(b.querySelectorAll(".callout.is-collapsed, .callout.is-collapsible"));for(const v of s){const p=v.classList.contains("is-collapsed");v.classList.remove("is-collapsed","is-collapsible"),v.hasAttribute("data-callout-fold")||v.setAttribute("data-callout-fold",p?"-":"+");const h=v.querySelector(".callout-fold");h&&h.remove();const w=v.querySelector(".callout-content");if(w){const O=w.getAttribute("style");if(O){const M=O.replace(/display\s*:\s*none\s*;?/gi,"").trim();M?w.setAttribute("style",M):w.removeAttribute("style")}}}const l=Array.from(b.querySelectorAll(".markdown-alert"));for(const v of l){const p=Array.from(v.classList).find((M=>M.startsWith("markdown-alert-")&&M!=="markdown-alert")),h=p?p.replace("markdown-alert-",""):"note",w=h.charAt(0).toUpperCase()+h.slice(1),O=v.querySelector(".markdown-alert-title");O&&O.remove(),v.replaceWith(E(a,h,w,v))}const u=Array.from(b.querySelectorAll('aside[class*="callout"]'));for(const v of u){const p=Array.from(v.classList).find((M=>M.startsWith("callout-"))),h=p?p.replace("callout-",""):"note",w=h.charAt(0).toUpperCase()+h.slice(1),O=v.querySelector(".callout-content");v.replaceWith(E(a,h,w,O||v))}const m=new Set(["info","warning","note","tip","danger","caution","important","abstract","success","question","failure","bug","example","quote"]),x=Array.from(b.querySelectorAll(".admonition"));for(const v of x){if(v.getAttribute("data-callout"))continue;const p=Array.from(v.classList).find((M=>m.has(M)))||"note",h=v.querySelector(".admonition-title"),w=((C=h==null?void 0:h.textContent)===null||C===void 0?void 0:C.trim())||p.charAt(0).toUpperCase()+p.slice(1);h&&h.remove();const O=v.querySelector(".admonition-content")||v.querySelector(".details-content")||v;v.replaceWith(E(a,p,w,O))}const f=Array.from(b.querySelectorAll('.alert[class*="alert-"]'));for(const v of f){const p=Array.from(v.classList).find((M=>M.startsWith("alert-")&&M!=="alert-dismissible")),h=p?p.replace("alert-",""):"note",w=v.querySelector(".alert-heading, .alert-title"),O=((A=w==null?void 0:w.textContent)===null||A===void 0?void 0:A.trim())||h.charAt(0).toUpperCase()+h.slice(1);w&&w.remove(),v.replaceWith(E(a,h,O,v))}};const _=g(639);function E(b,C,A,a){const s=b.createElement("div");s.setAttribute("data-callout",C),s.className="callout";const l=b.createElement("div");l.className="callout-title";const u=b.createElement("div");u.className="callout-title-inner",u.textContent=A,l.appendChild(u),s.appendChild(l);const m=b.createElement("div");return m.className="callout-content",(0,_.transferContent)(a,m),s.appendChild(m),s}},754(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.codeBlockRules=void 0;const _=g(2552),E=[/^language-(\w+)$/,/^lang-(\w+)$/,/^(\w+)-code$/,/^code-(\w+)$/,/^syntax-(\w+)$/,/^code-snippet__(\w+)$/,/^highlight-(\w+)$/,/^(\w+)-snippet$/,/(?:^|\s)(?:language|lang|brush|syntax)-(\w+)(?:\s|$)/i],b=new Set(["abap","actionscript","ada","adoc","agda","antlr4","applescript","arduino","armasm","asciidoc","aspnet","atom","bash","batch","c","clojure","cmake","cobol","coffeescript","cpp","c++","crystal","csharp","cs","dart","django","dockerfile","dotnet","elixir","elm","erlang","fortran","fsharp","gdscript","gitignore","glsl","golang","gradle","graphql","groovy","haskell","hs","haxe","hlsl","html","idris","java","javascript","js","jsx","jsdoc","json","jsonp","julia","kotlin","latex","lean","lean4","lisp","elisp","livescript","lua","makefile","markdown","md","markup","masm","mathml","matlab","mongodb","mysql","nasm","nginx","nim","nix","objc","ocaml","pascal","perl","php","postgresql","powershell","prolog","puppet","python","regex","rss","ruby","rb","rust","scala","scheme","shell","sh","solidity","sparql","sql","ssml","svg","swift","tcl","terraform","tex","toml","typescript","ts","tsx","unrealscript","verilog","vhdl","webassembly","wasm","xml","yaml","yml","zig"]);d.codeBlockRules=[{selector:["pre",'div[class*="prismjs"]',".syntaxhighlighter",".highlight",".highlight-source",".wp-block-syntaxhighlighter-code",".wp-block-code",'div[class*="language-"]',".code-block[data-lang]","code.hl.block"].join(", "),element:"pre",transform:(C,A)=>{var a;if(!(w=>"classList"in w&&"getAttribute"in w&&"querySelector"in w)(C))return C;C.querySelectorAll('button, [class*="codeblock-button"]').forEach((w=>w.remove())),C.querySelectorAll('[class*="header"], [class*="toolbar"], [class*="titlebar"], [class*="title-bar"]').forEach((w=>{var O;const M=w.tagName;if(M!=="DIV"&&M!=="SPAN")return;const $=(O=w.closest)===null||O===void 0?void 0:O.call(w,"[data-line], .line");if($&&C.contains($)||w.querySelector("[data-line], .line, pre"))return;const T=(w.textContent||"").trim();(0,_.countWords)(T)<=5&&w.remove()}));const s=w=>{var O;const M=w.getAttribute("data-lang")||w.getAttribute("data-language")||w.getAttribute("language");if(M)return M.toLowerCase();const $=Array.from(w.classList||[]);if(!((O=w.classList)===null||O===void 0)&&O.contains("syntaxhighlighter")){const T=$.find((D=>!["syntaxhighlighter","nogutter"].includes(D)));if(T&&b.has(T.toLowerCase()))return T.toLowerCase()}for(const T of $)for(const D of E){const R=T.toLowerCase().match(D);if(R&&R[1]&&b.has(R[1].toLowerCase()))return R[1].toLowerCase()}for(const T of $)if(b.has(T.toLowerCase()))return T.toLowerCase();return""};let l="",u=C;for(;u&&!l;){if(l=s(u),!l&&u===C){const w=u.querySelector('code[data-lang], code[class*="language-"]')||u.querySelector("code");w&&(l=s(w))}u=u.parentElement}const m=C.querySelector(".cm-content");if(m&&!l){const w=Array.from(C.querySelectorAll("div"));for(const O of w){if(O.contains(m))continue;const M=(O.textContent||"").trim().toLowerCase();if(M&&b.has(M)){l=M;break}}}const x=w=>{var O;if((0,_.isTextNode)(w))return!((O=w.parentElement)===null||O===void 0)&&O.querySelector("[data-line], .line")&&!(w.textContent||"").trim()?"":w.textContent||"";let M="";if((0,_.isElement)(w)){if(w.matches(".hover-info, .hover-container")||w.tagName==="BUTTON"||w.tagName==="STYLE")return"";if(w.tagName==="BR"){const $=w.previousElementSibling;return $&&$.matches('div[class*="line"], span[class*="line"], .ec-line, [data-line-number], [data-line]')?"":`
|
|
310
|
+
`}if(w.matches("span.lnt")||w.matches("span.lineno")||w.matches(".react-syntax-highlighter-line-number")||w.matches(".rouge-gutter"))return"";if((w.tagName==="DIV"||w.tagName==="SPAN")&&w.children.length===2){const $=(w.children[0].textContent||"").trim();if(/^\d+$/.test($))return x(w.children[1]).replace(/\n$/,"")+`
|
|
311
|
+
`}if(w.matches('div[class*="line"], span[class*="line"], .ec-line, [data-line-number], [data-line]')){const $=w.querySelector('.code:not(.token), .content:not(.token), [class*="code-"], [class*="content-"]');if($)return($.textContent||"").replace(/\n$/,"")+`
|
|
312
|
+
`;const T=w.querySelector('.line-number, .gutter, [class*="line-number"], [class*="gutter"]');return T?Array.from(w.childNodes).filter((D=>!T.contains(D))).map((D=>x(D))).join("").replace(/\n$/,"")+`
|
|
313
|
+
`:(w.textContent||"").replace(/\n$/,"")+`
|
|
314
|
+
`}w.childNodes.forEach(($=>{M+=x($)}))}return M};let f="";if(C.matches(".syntaxhighlighter, .wp-block-syntaxhighlighter-code")&&(f=(w=>{const O=w.querySelector(".syntaxhighlighter table .code .container");if(O)return Array.from(O.children).map(($=>Array.from($.querySelectorAll("code")).map((D=>{var R;let S=D.textContent||"";return!((R=D.classList)===null||R===void 0)&&R.contains("spaces")&&(S=" ".repeat(S.length)),S})).join("")||$.textContent||"")).join(`
|
|
315
|
+
`);const M=w.querySelectorAll(".code .line");return M.length>0?Array.from(M).map(($=>Array.from($.querySelectorAll("code")).map((D=>D.textContent||"")).join("")||$.textContent||"")).join(`
|
|
316
|
+
`):""})(C)),!f&&m)f=x(m);else if(!f){let w=C;if(C.tagName!=="PRE"&&C.tagName!=="CODE"){const O=Array.from(C.querySelectorAll("pre")),M=O.find(($=>$.querySelector('code[data-lang], code[class*="language-"], .line, [data-line]')))||O.find(($=>$.querySelector("span[class]")&&!$.classList.contains("lineno")));M&&(w=M)}f=x(w)}if(C.matches("code.hl.block"))f=f.replace(/^[ \t]+|[ \t]+$/g,"").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/^\n+/,"");else{f=f.replace(/\t/g," ").replace(/\u00a0/g," ");const w=f.split(`
|
|
317
|
+
`);let O=1/0;for(const M of w){const $=M.search(/\S/);$>-1&&(O=Math.min(O,$))}O===1/0&&(O=0),O>0&&(f=w.map((M=>M.slice(O))).join(`
|
|
318
|
+
`)),f=f.replace(/^\s+|\s+$/g,"").replace(/\n{3,}/g,`
|
|
319
|
+
|
|
320
|
+
`).replace(/^\n+/,"").replace(/\n+$/,"")}let v=C;for(let w=0;w<3&&v;w++){const O=v.parentElement;if(!O||O.tagName==="BODY"||O.children.length>5||!((a=O.closest)===null||a===void 0)&&a.call(O,"[data-callout]"))break;const M=Array.from(O.children);for(const $ of M){if($.contains(C))continue;const T=$.tagName;if(T!=="DIV"&&T!=="SPAN")continue;const D=($.textContent||"").trim();(0,_.countWords)(D)<=5&&!$.querySelector("pre, code, img, svg, table, h1, h2, h3, h4, h5, h6, p, blockquote, ul, ol, hr")&&$.remove()}v=O}const p=A.createElement("pre");C.matches("code.hl.block, pre.hl.lean.lean-output")&&p.setAttribute("data-verso-code","true");const h=A.createElement("code");return l&&(h.setAttribute("data-lang",l),h.setAttribute("class",`language-${l}`)),h.textContent=f,p.appendChild(h),p}}]},3610(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.FOOTNOTE_SECTION_RE=void 0,d.standardizeFootnotes=function(x){const f=x.ownerDocument;f&&new m(f).standardizeFootnotes(x)};const _=g(2640),E=g(639),b=g(2552),C=g(4840);d.FOOTNOTE_SECTION_RE=/^(foot\s*notes?|end\s*notes?|notes?|references?)$/i;const A=/^[\^\u21A9\u21A5\u2191\u21B5\u2934\u2935\u23CE]+$/,a=/^#cite_ref-/,s=/^\[?\(?(\d{1,4})\)?\]?$/;function l(x){var f;return((f=((x==null?void 0:x.getAttribute("href"))||"").split("#").pop())===null||f===void 0?void 0:f.toLowerCase())||""}const u=[{selector:"sup.footnoteref",extract:x=>{var f;const v=x.querySelector('a[id^="footnoteref-"]');return((f=v==null?void 0:v.id.match(/^footnoteref-(\d+)$/))===null||f===void 0?void 0:f[1])||""}},{selector:'a[id^="ref-link"]',extract:x=>{var f;return((f=x.textContent)===null||f===void 0?void 0:f.trim())||""}},{selector:'a[role="doc-biblioref"]',extract:x=>{const f=x.getAttribute("data-xml-rid");if(f)return f;const v=x.getAttribute("href")||"";return v.startsWith("#core-R")?v.replace("#core-",""):""}},{selector:"a.footnote-anchor, span.footnote-hovercard-target a",extract:x=>{var f;return(((f=x.id)===null||f===void 0?void 0:f.replace("footnote-anchor-",""))||"").toLowerCase()}},{selector:"sup.reference",extract:x=>{let f="";return x.querySelectorAll("a").forEach((v=>{var p;const h=(p=(v.getAttribute("href")||"").split("/").pop())===null||p===void 0?void 0:p.match(/(?:cite_note|cite_ref)-(.+)/);h&&(f=h[1].toLowerCase())})),f}},{selector:'sup[id^="fnref:"], span[id^="fnref:"]',extract:x=>x.id.replace("fnref:","").toLowerCase()},{selector:'sup[id^="fnr"]',extract:x=>x.id.replace("fnr","").toLowerCase()},{selector:"sup.footnote-reference",extract:x=>l(x.querySelector('a[href^="#"]'))},{selector:"span.footnote-reference",extract:x=>{var f;return x.getAttribute("data-footnote-id")||""||(!((f=x.id)===null||f===void 0)&&f.startsWith("fnref")?x.id.replace("fnref","").toLowerCase():"")}},{selector:"span.footnote-link",extract:x=>x.getAttribute("data-footnote-id")||""},{selector:"a.citation",extract:x=>{var f;return((f=x.textContent)===null||f===void 0?void 0:f.trim())||""}},{selector:'a[id^="fnref"]',extract:x=>x.id.replace("fnref","").toLowerCase()},{selector:'a[data-type="noteref"]',extract:x=>l(x)}];class m{constructor(f){this.pendingRemovals=[],this.doc=f}makeRefId(f,v){return v>0?`fnref:${f}-${v+1}`:`fnref:${f}`}mergeFootnotes(f,v){for(const[p,h]of Object.entries(v)){const w=parseInt(p);f[w]||(f[w]=h)}}addFootnote(f,v,p,h){if(!v||f.processedIds.has(v))return!1;const w=h??f.count;return f.footnotes[w]={content:p,originalId:v,refs:[]},f.processedIds.add(v),h===void 0?f.count++:h>=f.count&&(f.count=h+1),!0}createFootnoteItem(f,v,p){const h=typeof v=="string"?this.doc:v.ownerDocument,w=h.createElement("li");if(w.className="footnote",w.id=`fn:${f}`,typeof v=="string"){const M=h.createElement("p");M.appendChild((0,E.parseHTML)(h,v)),w.appendChild(M)}else{const M=Array.from(v.children),$=M.some((D=>D.tagName.toLowerCase()==="p")),T=M.some((D=>_.BLOCK_LEVEL_ELEMENTS.has(D.tagName.toLowerCase())));if($||T)!$&&T?M.forEach((D=>{if(this.isBackrefLink(D))return;const R=D.cloneNode(!0);this.removeBackrefs(R),w.appendChild(R)})):M.forEach((D=>{var R;if(!this.isBackrefLink(D))if(D.tagName.toLowerCase()==="p"){if(!(!((R=D.textContent)===null||R===void 0)&&R.trim())&&!D.querySelector("img, br"))return;const S=h.createElement("p");(0,E.transferContent)(D,S),this.removeBackrefs(S),w.appendChild(S)}else{const S=D.cloneNode(!0);this.removeBackrefs(S),w.appendChild(S)}}));else{const D=h.createElement("p");(0,E.transferContent)(v,D),this.removeBackrefs(D),w.appendChild(D)}}const O=w.querySelector("p:last-of-type")||w;return p.forEach(((M,$)=>{const T=h.createElement("a");T.href=`#${M}`,T.title="return to article",T.className="footnote-backref",T.textContent="↩",$<p.length-1&&(T.textContent+=" "),O.appendChild(T)})),w}collectFootnotes(f){const v={footnotes:{},processedIds:new Set,count:1};f.querySelectorAll(_.FOOTNOTE_LIST_SELECTORS).forEach((h=>{var w,O;if(h.matches("div.footnotes-footer"))return void h.querySelectorAll("div.footnote-footer").forEach((M=>{const $=(M.id||"").match(/^footnote-(\d+)$/);if(!$)return;const T=$[1];if(v.processedIds.has(T))return;const D=M.cloneNode(!0),R=D.querySelector("a");R&&R.remove();const S=(0,E.serializeHTML)(D).replace(/^\s*\.\s*/,""),y=f.ownerDocument.createElement("div");y.appendChild((0,E.parseHTML)(f.ownerDocument,S.trim())),this.addFootnote(v,T,y)}));if(h.matches("div.footnote-definition")&&!(!((w=h.parentElement)===null||w===void 0)&&w.matches("div.footnote-definitions"))){const M=(h.id||"").toLowerCase(),$=h.cloneNode(!0),T=$.querySelector("sup.footnote-definition-label");return T&&T.remove(),void this.addFootnote(v,M,$)}if(h.matches("div.footnote-definitions")){h.querySelectorAll("div.footnote-definition").forEach(($=>{const T=$.querySelector("sup[id]"),D=$.querySelector(".footnote-body");T&&D&&this.addFootnote(v,(T.id||"").toLowerCase(),D.cloneNode(!0))}));const M=h.parentElement;return void(M&&M!==f&&((O=M.classList)===null||O===void 0?void 0:O.contains("footnotes"))&&this.pendingRemovals.push(M))}if(h.matches("ol.easy-footnotes-wrapper"))return h.querySelectorAll("li.easy-footnote-single").forEach((M=>{var $,T;const D=M.querySelector('span[id^="easy-footnote-bottom-"]');if(!D)return;const R=M.cloneNode(!0);($=R.querySelector('span[id^="easy-footnote-bottom-"]'))===null||$===void 0||$.remove(),(T=R.querySelector("a.easy-footnote-to-top"))===null||T===void 0||T.remove(),this.addFootnote(v,D.id.toLowerCase(),R)})),void f.querySelectorAll("span.easy-footnote-margin-adjust").forEach((M=>{this.pendingRemovals.push(M)}));if(h.matches("div.footnotes-segment"))return h.querySelectorAll("h5.footnote-body-heading").forEach((M=>{var $,T,D,R;const S=((($=M.querySelector("a[id]"))===null||$===void 0?void 0:$.id)||"").toLowerCase();if(!S)return;const y=f.ownerDocument.createElement("div");let k=M.nextElementSibling;for(;k&&(k.tagName.toLowerCase()!=="h5"||!(!((T=k.classList)===null||T===void 0)&&T.contains("footnote-body-heading")));)(!((D=k.textContent)===null||D===void 0)&&D.trim()||!((R=k.querySelector)===null||R===void 0)&&R.call(k,"img, br"))&&y.appendChild(k.cloneNode(!0)),k=k.nextElementSibling;this.addFootnote(v,S,y)})),void this.pendingRemovals.push(h);if(h.matches('div.footnote[data-component-name="FootnoteToDOM"]')){const M=h.querySelector("a.footnote-number"),$=h.querySelector(".footnote-content");return void(M&&$&&this.addFootnote(v,M.id.replace("footnote-","").toLowerCase(),$))}h.querySelectorAll('li, div[role="listitem"]').forEach((M=>{const{id:$,content:T}=this.extractListItemIdAndContent(M);this.addFootnote(v,$,T||M)}))}));const p=[this.tryDataTypeFootnotes,this.tryGenericIdDetection,this.tryWordExport,this.tryGoogleDocs,this.tryLabeledSection,this.tryLooseFootnotes,this.tryClassFootnote,this.tryBrSeparatedFootnotes];for(const h of p){if(v.count>1)break;h.call(this,f,v)}return v.footnotes}tryDataTypeFootnotes(f,v){f.querySelectorAll('p[data-type="footnote"][id]').forEach((p=>{const h=(p.id||"").toLowerCase();if(!h)return;const w=f.ownerDocument.createElement("div"),O=p.cloneNode(!0),M=O.firstElementChild;M&&M.tagName.toLowerCase()==="sup"&&M.querySelector('a[href*="#"]')&&(M.remove(),this.trimLeadingWhitespace(O)),w.appendChild(O),this.addFootnote(v,h,w),this.pendingRemovals.push(p)}))}tryGenericIdDetection(f,v){const p=new Map;if(f.querySelectorAll('a[href*="#"]').forEach((S=>{var y;const k=l(S);if(!k)return;const N=((y=S.textContent)===null||y===void 0?void 0:y.trim())||"";s.test(N)&&(p.has(k)||p.set(k,[]),p.get(k).push(S))})),p.size<2)return;const h=new Set(p.keys()),w=f.querySelectorAll("div, section, aside, footer, ol, ul");let O=null,M=0;if(w.forEach((S=>{if(S===f)return;const y=this.findMatchingFootnoteElements(S,h).length;y>=2&&y>=M&&(M=y,O=S)})),!O)return;const $=this.findMatchingFootnoteElements(O,h),T=new Set($.map((({id:S})=>S)));let D=0,R=0;p.forEach(((S,y)=>{S.some((k=>O.contains(k)))||(D++,T.has(y)&&R++)})),R<Math.max(2,Math.ceil(.75*D))&&(O=null),$.forEach((({el:S,id:y})=>{var k,N;if(v.processedIds.has(y))return;const L=f.ownerDocument.createElement("div"),P=S.cloneNode(!0),B=Array.from(P.querySelectorAll("a[id]")).find((H=>H.getAttribute("id")===y));!B||!((k=B.textContent)===null||k===void 0)&&k.trim()&&!/^\d+[.)]*\s*$/.test(B.textContent.trim())||B.remove();const U=P.querySelector("a[name]");U&&((N=U.getAttribute("name"))===null||N===void 0?void 0:N.toLowerCase())===y&&U.remove();const F=P.childNodes[0];F&&F.nodeType===3&&(F.textContent=F.textContent.replace(/^\d+\.\s*/,"").replace(/^\s+/,"")),P.matches("li")?(0,E.transferContent)(P,L):L.appendChild(P);let I=S.nextElementSibling;for(;I&&!I.id;){const H=this.getChildAnchorId(I);if(H&&h.has(H))break;L.appendChild(I.cloneNode(!0)),I=I.nextElementSibling}this.addFootnote(v,y,L)})),O&&this.pendingRemovals.push(O)}tryWordExport(f,v){const p=Array.from(f.querySelectorAll('a[href*="#_ftnref"]'));if(p.length<2)return;const h=[];p.forEach((w=>{const O=l(w).match(/^_ftnref(\d+)$/);O&&h.push({num:parseInt(O[1]),anchor:w})})),h.sort(((w,O)=>w.num-O.num)),h.forEach((({num:w,anchor:O})=>{const M=`_ftn${w}`;if(v.processedIds.has(M))return;let $=O.parentElement;for(;$&&$!==f;){const S=$.tagName.toLowerCase();if(S==="p"||S==="div"||S==="li")break;$=$.parentElement}if(!$||$===f)return;const T=$.cloneNode(!0),D=T.querySelector('a[href*="_ftnref"]');if(D){const S=D.closest("sup");S?S.remove():D.remove()}const R=f.ownerDocument.createElement("div");R.appendChild(T),this.addFootnote(v,M,R,w),this.pendingRemovals.push($)}))}tryGoogleDocs(f,v){var p;const h=[];if(f.querySelectorAll('p[id^="ftnt"]').forEach(($=>{const T=($.id||"").match(/^ftnt(\d+)$/);T&&h.push({num:parseInt(T[1]),el:$})})),h.length<2)return;h.sort((($,T)=>$.num-T.num)),h.forEach((({num:$,el:T})=>{var D;const R=`ftnt${$}`;if(v.processedIds.has(R))return;const S=T.cloneNode(!0);(D=S.querySelector('a[href*="#ftnt_ref"]'))===null||D===void 0||D.remove();const y=f.ownerDocument.createElement("div");y.appendChild(S),this.addFootnote(v,R,y,$),this.pendingRemovals.push(T);const k=T.parentElement;k&&k!==f&&k.tagName.toLowerCase()==="div"&&k.children.length===1&&this.pendingRemovals.push(k)}));const w=h[0].el,O=w.parentElement,M=(O&&O!==f&&O.tagName.toLowerCase()==="div"?O:w).previousElementSibling;M&&/^h[1-6]$/.test(M.tagName.toLowerCase())&&d.FOOTNOTE_SECTION_RE.test(((p=M.textContent)===null||p===void 0?void 0:p.trim())||"")&&this.pendingRemovals.push(M)}tryLooseFootnotes(f,v){var p,h;const w=this.findLooseFootnoteParagraphs(f);if(!w)return;const{paragraphs:O,toRemove:M}=w,$=new Set(M);for(let T=0;T<O.length;T++){const{num:D,el:R}=O[T],S=(h=(p=O[T+1])===null||p===void 0?void 0:p.el)!==null&&h!==void 0?h:null,y=this.stripMarkerAndWrap(R);let k=R.nextElementSibling;for(;k&&k!==S&&$.has(k);)y.appendChild(k.cloneNode(!0)),k=k.nextElementSibling;this.addFootnote(v,String(D),y)}this.pendingRemovals.push(...M)}tryClassFootnote(f,v){const p=[];f.querySelectorAll("p.footnote").forEach((h=>{const w=this.parseFootnoteNum(h);w!==null&&p.push({num:w,el:h})}));for(const{num:h,el:w}of p)this.addFootnote(v,String(h),this.stripMarkerAndWrap(w));this.pendingRemovals.push(...p.map((h=>h.el)))}tryLabeledSection(f,v){var p;const h=f.querySelectorAll("div, section, aside");for(const w of Array.from(h)){const O=(0,E.getClassName)(w),M=w.id||"";if(!/footnote/i.test(O)&&!/footnote/i.test(M))continue;const $=w.querySelector("h1, h2, h3, h4, h5, h6");if($&&d.FOOTNOTE_SECTION_RE.test(((p=$.textContent)===null||p===void 0?void 0:p.trim())||"")&&(this.collectSectionParagraphs(w,v)||this.collectSectionList(w,v))){this.pendingRemovals.push(w);break}}}tryBrSeparatedFootnotes(f,v){const p=new Set;if(f.querySelectorAll('a[href^="#"]').forEach((h=>{var w;if(s.test(((w=h.textContent)===null||w===void 0?void 0:w.trim())||"")){const O=l(h);O&&p.add(O)}})),!(p.size<2))for(const h of Array.from(f.querySelectorAll("p, div"))){if(!h.querySelector("br"))continue;const w=[];for(const M of this.splitOnBreaks(h)){const $=this.leadingAnchor(M);if(!$)continue;const T=($.getAttribute("name")||$.id||"").toLowerCase();T&&p.has(T)&&w.push({id:T,nodes:M.filter((D=>D!==$))})}if(w.length<2)continue;w.forEach((({id:M,nodes:$})=>{const T=f.ownerDocument.createElement("div");$.forEach((D=>T.appendChild(D.cloneNode(!0)))),this.removeBackrefs(T),this.trimLeadingWhitespace(T),this.addFootnote(v,M,T)})),this.pendingRemovals.push(h);const O=h.previousElementSibling;return void((O==null?void 0:O.tagName.toLowerCase())==="hr"&&this.pendingRemovals.push(O))}}splitOnBreaks(f){const v=[];let p=[];for(const h of Array.from(f.childNodes))(0,b.isElement)(h)&&h.tagName.toLowerCase()==="br"?(p.length&&v.push(p),p=[]):p.push(h);return p.length&&v.push(p),v}leadingAnchor(f){var v;for(const p of f)if((0,b.isTextNode)(p)){if(!((v=p.textContent)===null||v===void 0)&&v.trim())return null}else if((0,b.isElement)(p))return p.tagName.toLowerCase()!=="a"?null:p.hasAttribute("name")||p.id?p:null;return null}collectSectionParagraphs(f,v){var p;const h=[];if(f.querySelectorAll("p").forEach((O=>{const M=this.parseFootnoteNum(O);M!==null&&h.push({num:M,el:O})})),h.length===0)return!1;const w=new Set(h.map((O=>O.el)));for(const{num:O,el:M}of h){const $=this.stripMarkerAndWrap(M);let T=M.nextElementSibling;for(;T&&!w.has(T);)!((p=T.textContent)===null||p===void 0)&&p.trim()&&$.appendChild(T.cloneNode(!0)),this.pendingRemovals.push(T),T=T.nextElementSibling;this.addFootnote(v,String(O),$),this.pendingRemovals.push(M)}return!0}collectSectionList(f,v){const p=f.querySelector("ol");if(!p)return!1;const h=Array.from(p.children).filter((w=>{var O;return((O=w.tagName)===null||O===void 0?void 0:O.toLowerCase())==="li"}));return h.length!==0&&(h.forEach(((w,O)=>{var M;this.addFootnote(v,((M=w.id)===null||M===void 0?void 0:M.toLowerCase())||String(O+1),w.cloneNode(!0))})),!0)}trimLeadingWhitespace(f){const v=f.firstChild;(v==null?void 0:v.nodeType)===3&&(v.textContent=v.textContent.replace(/^\s+/,""))}isBoldWrappedSup(f){var v,p,h;const w=(v=f.tagName)===null||v===void 0?void 0:v.toLowerCase();return(w==="b"||w==="strong")&&f.firstChild===f.firstElementChild&&((h=(p=f.firstElementChild)===null||p===void 0?void 0:p.tagName)===null||h===void 0?void 0:h.toLowerCase())==="sup"}stripMarkerAndWrap(f){const v=f.ownerDocument.createElement("div"),p=f.cloneNode(!0),h=p.firstElementChild;return h&&(this.isBoldWrappedSup(h)?(h.firstElementChild.remove(),this.trimLeadingWhitespace(h)):(h.remove(),this.trimLeadingWhitespace(p))),v.appendChild(p),v}parseFootnoteNum(f){var v;if(!f.firstChild)return null;let p=f.firstElementChild;if(!p||p!==f.firstChild)return null;let h=p.tagName.toLowerCase();if(this.isBoldWrappedSup(p)&&(p=p.firstElementChild,h="sup"),h!=="sup"&&h!=="strong")return null;const w=((v=p.textContent)===null||v===void 0?void 0:v.trim())||"",O=parseInt(w,10);return!isNaN(O)&&O>=1&&String(O)===w?O:null}crossValidate(f,v){const p=new Set(v.map((w=>w.num))),h=new Set;return f.querySelectorAll("sup").forEach((w=>{var O;if(v.some((T=>T.el.contains(w)))||w.querySelector("a"))return;const M=((O=w.textContent)===null||O===void 0?void 0:O.trim())||"",$=parseInt(M,10);!isNaN($)&&$>=1&&String($)===M&&p.has($)&&h.add($)})),h.size>=2}findLooseFootnoteParagraphs(f){var v,p;const h=Array.from(f.querySelectorAll("p")),w=h.length>0&&(v=h[h.length-1].parentElement)!==null&&v!==void 0?v:f,O=Array.from(w.children);for(let D=O.length-1;D>=0;D--){if(O[D].tagName.toLowerCase()!=="hr")continue;const R=[];for(let S=D+1;S<O.length;S++){const y=this.parseFootnoteNum(O[S]);y!==null&&R.push({num:y,el:O[S]})}if(R.length>=2&&this.crossValidate(f,R))return{paragraphs:R,toRemove:O.slice(D)};break}const M=[];let $=-1;for(let D=O.length-1;D>=0;D--){const R=O[D],S=R.tagName.toLowerCase();if(S==="p"){const y=this.parseFootnoteNum(R);if(y!==null){M.unshift({num:y,el:R}),$=D;continue}break}if(S!=="ul"&&S!=="ol"&&S!=="blockquote")break}if(M.length>=2&&this.crossValidate(f,M)){const D=O.slice($),R=M[0].el.previousElementSibling;if(R){const S=R.tagName.toLowerCase();/^h[1-6]$/.test(S)&&d.FOOTNOTE_SECTION_RE.test(((p=R.textContent)===null||p===void 0?void 0:p.trim())||"")&&D.unshift(R)}return{paragraphs:M,toRemove:D}}const T=[];for(let D=Math.floor(h.length/2);D<h.length;D++){const R=this.parseFootnoteNum(h[D]);R!==null&&T.push({num:R,el:h[D]})}return T.length>=2&&this.crossValidate(f,T)?{paragraphs:T,toRemove:T.map((D=>D.el))}:null}isBackrefLink(f){var v,p,h;if(((v=f.tagName)===null||v===void 0?void 0:v.toLowerCase())!=="a")return!1;const w=((p=f.textContent)===null||p===void 0?void 0:p.trim().replace(/\uFE0E|\uFE0F/g,""))||"";if(A.test(w)||!((h=f.classList)===null||h===void 0)&&h.contains("footnote-backref"))return!0;const O=f.getAttribute("href")||"";return a.test(O)}removeBackrefs(f){for(f.querySelectorAll("a").forEach((v=>{var p;if(this.isBackrefLink(v)){const h=v.parentElement;((p=h==null?void 0:h.tagName)===null||p===void 0?void 0:p.toLowerCase())==="sup"&&h.children.length===1?h.remove():v.remove()}}));f.firstChild&&f.firstChild.nodeType===3;){const v=f.firstChild.textContent;if(!(v&&/^[\s\^,.;]*$/.test(v)&&v.includes("^")))break;f.firstChild.remove()}for(;f.lastChild&&f.lastChild.nodeType===3;){const v=f.lastChild.textContent;if(!/^\s*$/.test(v))break;f.lastChild.remove()}}getChildAnchorId(f){const v=f.querySelector("a[id], a[name]");return v?(v.id||v.getAttribute("name")||"").toLowerCase():""}extractListItemIdAndContent(f){var v,p;const h=f.querySelector(".citations");if(!((v=h==null?void 0:h.id)===null||v===void 0)&&v.toLowerCase().startsWith("r"))return{id:h.id.toLowerCase(),content:h.querySelector(".citation-content")||null};const w=(f.id||"").toLowerCase();for(const M of["bib.bib","fn:","fn"])if(w.startsWith(M))return{id:w.slice(M.length),content:f};if(f.hasAttribute("data-counter"))return{id:(f.getAttribute("data-counter")||"").replace(/\.$/,"").toLowerCase(),content:f};const O=(p=w.split("/").pop())===null||p===void 0?void 0:p.match(/cite_note-(.+)/);return{id:O?O[1]:w,content:f}}findMatchingFootnoteElements(f,v){const p=[],h=new Set;return f.querySelectorAll("li, p, div").forEach((w=>{let O="";if(w.id&&v.has(w.id.toLowerCase()))O=w.id.toLowerCase();else if(!w.id){const M=this.getChildAnchorId(w);M&&v.has(M)&&(O=M)}O&&!h.has(O)&&(p.push({el:w,id:O}),h.add(O))})),p}replaceContainerPreservingText(f,v){let p="",h=!1;for(const w of f.childNodes)(0,b.isTextNode)(w)?p+=w.textContent||"":(0,b.isElement)(w)&&(h=!0);if(p=p.trim(),p&&h){const w=f.ownerDocument.createDocumentFragment();w.appendChild(f.ownerDocument.createTextNode(p)),w.appendChild(v),f.replaceWith(w)}else f.replaceWith(v)}findOuterFootnoteContainer(f){var v;let p=f,h=f.parentElement;for(;h;){const w=h.tagName.toLowerCase();if(w!=="span"&&w!=="sup")break;if(w==="span"){let O=!1;for(const M of h.childNodes)if(M!==p){if((0,b.isTextNode)(M)&&(!((v=M.textContent)===null||v===void 0)&&v.trim())){O=!0;break}if((0,b.isElement)(M)&&M.tagName.toLowerCase()!=="sup"){O=!0;break}}if(O)break}p=h,h=h.parentElement}return p}createFootnoteReference(f,v){const p=this.doc.createElement("sup");p.id=v;const h=this.doc.createElement("a");return h.href=`#fn:${f}`,h.textContent=f,p.appendChild(h),p}collectInlineSidenotes(f){const v={},p=f.querySelectorAll("span.footnote-container, span.sidenote-container, span.inline-footnote");if(p.length===0){const w=f.querySelectorAll("label.footref");if(w.length>0){let O=1;return w.forEach((M=>{var $,T,D;let R=M.nextElementSibling;if((R==null?void 0:R.tagName)==="INPUT"&&(!(($=R.classList)===null||$===void 0)&&$.contains("footref-toggle"))&&(R=R.nextElementSibling),!R||R.tagName!=="SPAN"||!(!((T=R.classList)===null||T===void 0)&&T.contains("sidenote")))return;const S=R.cloneNode(!0),y=S.querySelector("sup");y&&S.firstChild===y&&y.remove(),v[O]={content:S,originalId:String(O),refs:[`fnref:${O}`]};const k=this.createFootnoteReference(String(O),`fnref:${O}`),N=M.nextElementSibling;(N==null?void 0:N.tagName)==="INPUT"&&(!((D=N.classList)===null||D===void 0)&&D.contains("footref-toggle"))&&N.remove(),R.remove(),M.replaceWith(k),O++})),f.querySelectorAll("footer").forEach((M=>{M.querySelector(".footdef")&&M.remove()})),v}return f.querySelectorAll("span.sidenote").forEach((O=>{O.remove()})),v}let h=1;return p.forEach((w=>{const O=w.querySelector("span.footnote, span.sidenote, span.footnoteContent");if(!O)return;v[h]={content:O.cloneNode(!0),originalId:String(h),refs:[`fnref:${h}`]};const M=this.createFootnoteReference(String(h),`fnref:${h}`);w.replaceWith(M),h++})),v}collectSidenotesColumn(f){const v={};let p=Array.from(f.querySelectorAll(".sidenotes-column"));if(p.length===0){let w=f.parentElement;for(let O=0;O<3&&w&&p.length===0;O++)p=Array.from(w.querySelectorAll(":scope > .sidenotes-column")),w=w.parentElement}if(p.length===0)return v;let h=1;return p.forEach((w=>{w.querySelectorAll(".sidenote[id]").forEach((O=>{var M;const $=O.id;if(!$)return;const T=O.querySelector(".sidenote__id"),D=(M=T==null?void 0:T.textContent)===null||M===void 0?void 0:M.replace(/\D/g,""),R=D?parseInt(D,10):h,S=this.doc.createElement("div");Array.from(O.childNodes).forEach((y=>{var k,N,L;(0,b.isElement)(y)&&(!((k=y.classList)===null||k===void 0)&&k.contains("sidenote__id")||!((N=y.classList)===null||N===void 0)&&N.contains("sidenote__label")||!((L=y.classList)===null||L===void 0)&&L.contains("sn-backref"))||S.appendChild(y.cloneNode(!0))})),this.removeBackrefs(S),v[R]={content:S,originalId:$.toLowerCase(),refs:[]},h++})),w.remove()})),v}collectAsideFootnotes(f){const v={},p=Array.from(f.querySelectorAll("aside > ol[start]"));return p.length===0||p.forEach((h=>{const w=h.parentElement,O=parseInt(h.getAttribute("start")||"",10);if(isNaN(O)||O<1)return;const M=Array.from(h.querySelectorAll("li"));if(M.length===0)return;const $=this.doc.createElement("div");M.length===1?(0,E.transferContent)(M[0].cloneNode(!0),$):M.forEach((T=>{const D=this.doc.createElement("p");(0,E.transferContent)(T.cloneNode(!0),D),$.appendChild(D)})),v[O]={content:$,originalId:String(O),refs:[]},w.remove()})),v}collectHiddenAsideFootnotes(f){const v={},p=Array.from(f.querySelectorAll("span[data-definition]"));if(p.length===0)return v;const h=new Map;f.querySelectorAll("aside[id]").forEach((O=>{h.set(O.id,O)}));let w=1;return p.forEach((O=>{const M=O.getAttribute("data-definition");if(!M)return;const $=h.get(M);if(!$)return;const T=this.doc.createElement("div");(0,E.transferContent)($,T),$.remove();const D=String(w),R=`fnref:${D}`;v[w]={content:T,originalId:M.toLowerCase(),refs:[R]},O.replaceWith(this.createFootnoteReference(D,R)),w++})),v}standardizeFootnotes(f){const v=this.collectInlineSidenotes(f),p=this.collectHiddenAsideFootnotes(f);this.mergeFootnotes(p,this.collectFootnotes(f)),this.mergeFootnotes(p,this.collectSidenotesColumn(f)),this.mergeFootnotes(p,this.collectAsideFootnotes(f));const h=f.querySelectorAll(_.FOOTNOTE_INLINE_REFERENCES),w=new Map,O=new Map;Object.entries(p).forEach((([R,S])=>{O.set(S.originalId.toLowerCase(),[R,S])})),h.forEach((R=>{var S,y;if(!R||!R.parentNode||!(!((S=R.textContent)===null||S===void 0)&&S.trim()))return;if(R.matches("cite.ltx_cite")){const N=[];if(R.querySelectorAll("a").forEach((L=>{var P;const B=L.getAttribute("href");if(!B)return;const U=(P=B.split("/").pop())===null||P===void 0?void 0:P.match(/bib\.bib(\d+)/);if(!U)return;const F=O.get(U[1].toLowerCase());if(!F)return;const[I,H]=F,V=this.makeRefId(I,H.refs.length);H.refs.push(V),N.push(this.createFootnoteReference(I,V))})),N.length>0){const L=this.findOuterFootnoteContainer(R),P=R.ownerDocument.createDocumentFragment();N.forEach(((B,U)=>{U>0&&P.appendChild(R.ownerDocument.createTextNode(" ")),P.appendChild(B)})),L.replaceWith(P)}return}let k="";for(const{selector:N,extract:L}of u)if(R.matches(N)){k=L(R);break}if(!k){const N=R.getAttribute("href");N&&(k=N.replace(/^[#]/,"").toLowerCase())}if(k){const N=O.get(k.toLowerCase());if(N){const[L,P]=N,B=this.findOuterFootnoteContainer(R),U=B.tagName.toLowerCase()==="sup";if(U&&(!((y=w.get(B))===null||y===void 0)&&y.some((I=>I.footnoteNumber===L))))return;const F=this.makeRefId(L,P.refs.length);P.refs.push(F),U?(w.has(B)||w.set(B,[]),w.get(B).push({footnoteNumber:L,refId:F})):this.replaceContainerPreservingText(B,this.createFootnoteReference(L,F))}}}));const M=Object.entries(p).filter((([R,S])=>S.refs.length===0));if(M.length>0){const R=new Map,S=new Map;M.forEach((([N,L])=>{R.set(L.originalId,[N,L]),S.set(N,[N,L])}));const y=N=>N.closest('[id^="fnref:"]')||N.closest("#footnotes")||this.pendingRemovals.some((L=>L.contains(N))),k=(N,L)=>{const[P,B]=L,U=this.makeRefId(P,B.refs.length);B.refs.push(U);const F=this.findOuterFootnoteContainer(N);this.replaceContainerPreservingText(F,this.createFootnoteReference(P,U))};f.querySelectorAll('a[href*="#"]').forEach((N=>{var L;if(!N.parentNode||y(N))return;const P=l(N);if(!P)return;const B=R.get(P);if(!B)return;const U=((L=N.textContent)===null||L===void 0?void 0:L.trim())||"";s.test(U)&&k(N,B)})),Object.values(p).some((N=>N.refs.length===0))&&f.querySelectorAll("sup, span.footnote-ref").forEach((N=>{var L,P;if(!N.parentNode||!((L=N.id)===null||L===void 0)&&L.startsWith("fnref:")||N.closest("#footnotes"))return;const B=(((P=N.textContent)===null||P===void 0?void 0:P.trim())||"").match(s);if(!B)return;const U=S.get(B[1])||R.get(B[1]);!U||U[1].refs.length>0||k(N,U)}))}w.forEach(((R,S)=>{const y=this.doc.createDocumentFragment();R.forEach((({footnoteNumber:k,refId:N})=>{y.appendChild(this.createFootnoteReference(k,N))})),S.replaceWith(y)}));const $=this.doc.createElement("div");$.id="footnotes";const T=this.doc.createElement("ol"),D=Object.assign(Object.assign({},v),p);Object.entries(D).forEach((([R,S])=>{T.appendChild(this.createFootnoteItem(parseInt(R),S.content,S.refs))})),f.querySelectorAll(_.FOOTNOTE_LIST_SELECTORS).forEach((R=>R.remove())),this.pendingRemovals.forEach((R=>{R.parentNode&&R.remove()})),(0,C.removeOrphanedDividers)(f),T.children.length>0&&($.appendChild(T),f.appendChild($))}}},7864(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.headingRules=void 0,d.removePermalinkAnchors=function(b){Array.from(b.querySelectorAll("h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, a.permalink, a.anchor-link, a.heading-anchor")).forEach((C=>{E(C)&&C.remove()}))},d.isPermalinkAnchor=E;const _=g(2640);function E(b){if(b.tagName.toLowerCase()!=="a")return!1;const C=b.getAttribute("href")||"",A=(b.getAttribute("title")||"").toLowerCase(),a=(b.getAttribute("class")||"").toLowerCase(),s=(b.textContent||"").trim();return C.startsWith("#")||A.includes("permalink")?!0:!!(a.includes("permalink")||a.includes("heading-anchor")||a.includes("anchor-link"))||!!/^[#\xb6\xa7\ud83d\udd17\uFEFF]$/.test(s)}d.headingRules=[{selector:"h1, h2, h3, h4, h5, h6",element:"keep",transform:b=>{var C,A;const a=b.ownerDocument;if(!a)return b;const s=a.createElement(b.tagName.toLowerCase());if(Array.from(b.attributes).forEach((f=>{_.ALLOWED_ATTRIBUTES.has(f.name)&&s.setAttribute(f.name,f.value)})),!b.children.length)return s.textContent=((C=b.textContent)===null||C===void 0?void 0:C.trim())||"",s;const l=b.cloneNode(!0),u=new Map,m=[];Array.from(l.querySelectorAll("*")).forEach((f=>{var v,p,h,w;if(!(function(M){const $=M.tagName.toLowerCase();return $==="button"||!($!=="a"||!E(M))||!(!M.classList.contains("anchor")&&!M.classList.contains("permalink-widget"))||!($!=="span"&&$!=="div"||!Array.from(M.querySelectorAll("a")).some((T=>E(T))))})(f))return;u.set(f,((v=f.textContent)===null||v===void 0?void 0:v.trim())||"");const O=f.parentElement;O&&O!==l&&((p=O.textContent)===null||p===void 0?void 0:p.trim())===((h=f.textContent)===null||h===void 0?void 0:h.trim())&&u.set(O,((w=f.textContent)===null||w===void 0?void 0:w.trim())||""),m.push(f)})),m.forEach((f=>f.remove()));let x=((A=l.textContent)===null||A===void 0?void 0:A.trim())||"";return!x&&u.size>0&&(x=Array.from(u.values())[0]),s.textContent=x,s}}]},2649(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.imageRules=void 0,d.isBase64Placeholder=h;const _=g(2552),E=g(639),b=g(2640),C=/^data:image\/([^;]+);base64,/,A=/\.(jpg|jpeg|png|webp|gif|avif)(\?.*)?$/i,a=/\s(\d+)w/,s=/dpr=(\d+(?:\.\d+)?)/,l=/^([^\s]+)/,u=/^[\w\-\.\/\\]+\.(jpg|jpeg|png|gif|webp|svg)$/i,m=/^\d{4}-\d{2}-\d{2}$/,x=[["src",["data-src","data-original","data-lazy-src"]],["srcset",["data-srcset","data-lazy-srcset"]]];function f(L,P,B){const U=B.createElement("figure");U.appendChild(L.cloneNode(!0));const F=B.createElement("figcaption"),I=(function(H){const V=[],X=new Set,ne=W=>{var J;if((0,_.isTextNode)(W)){const G=((J=W.textContent)===null||J===void 0?void 0:J.trim())||"";G&&!X.has(G)&&(V.push(G),X.add(G))}else if((0,_.isElement)(W)){const G=W.childNodes;for(let Q=0;Q<G.length;Q++)ne(G[Q])}},Y=H.childNodes;for(let W=0;W<Y.length;W++)ne(Y[W]);return V.length>0?V.join(" "):(0,E.serializeHTML)(H)})(P);return F.appendChild((0,E.parseHTML)(B,I)),U.appendChild(F),U}function v(L,P){P.setAttribute("srcset",L);const B=k(L);B&&O(B)&&P.setAttribute("src",B)}function p(L,P,B){for(let U=0;U<L.attributes.length;U++){const F=L.attributes[U];B.includes(F.name)||P.setAttribute(F.name,F.value)}}function h(L){const P=L.match(C);if(!P||P[1]==="svg+xml")return!1;const B=P[0].length;return L.length-B<133}function w(L){return L.startsWith("data:image/svg+xml")}function O(L){return!L.startsWith("data:")&&!(!L||L.trim()==="")&&(A.test(L)||L.includes("image")||L.includes("img")||L.includes("photo"))}function M(L){return $(L)?!0:L.querySelectorAll("img, video, picture, source").length>0}function $(L){const P=L.tagName.toLowerCase();return P==="img"||P==="video"||P==="picture"||P==="source"}function T(L){if($(L))return L;const P=L.querySelectorAll("picture");if(P.length>0)return P[0];const B=L.querySelectorAll("img"),U=[];for(let V=0;V<B.length;V++){const X=B[V],ne=X.getAttribute("src")||"",Y=X.getAttribute("alt")||"";w(ne)||h(ne)||!Y.trim()&&B.length>1||U.push(X)}if(U.length>0)return U[0];const F=L.querySelectorAll("video");if(F.length>0)return F[0];const I=L.querySelectorAll("source");if(I.length>0)return I[0];const H=L.querySelectorAll("img, picture, source, video");return H.length>0?H[0]:null}function D(L){var P,B,U,F;const I=L.querySelector("figcaption");if(I)return I;const H=new Set,V=['[class*="caption"]','[class*="description"]','[class*="alt"]','[class*="title"]','[class*="credit"]','[class*="text"]','[class*="post-thumbnail-text"]','[class*="image-caption"]','[class*="photo-caption"]',"[aria-label]","[title]"].join(", "),X=L.querySelectorAll(V);for(let W=0;W<X.length;W++){const J=X[W];if($(J))continue;const G=(P=J.textContent)===null||P===void 0?void 0:P.trim();if(G&&G.length>0&&!H.has(G))return H.add(G),J}const ne=L.querySelector("img");if(ne&&ne.hasAttribute("alt")){const W=ne.getAttribute("alt");if(W&&W.trim().length>0){const J=L.ownerDocument.createElement("div");return J.textContent=W,J}}if(L.parentElement){const W=L.parentElement.children;for(let J=0;J<W.length;J++){const G=W[J];if(G!==L&&Array.from(G.classList).some((Q=>Q.includes("caption")||Q.includes("credit")||Q.includes("text")||Q.includes("description")))){const Q=(B=G.textContent)===null||B===void 0?void 0:B.trim();if(Q&&Q.length>0)return G}}}const Y=L.querySelectorAll("img");for(let W=0;W<Y.length;W++){const J=Y[W];if(!J.parentElement)continue;let G=J.nextElementSibling;for(;G;){if(["EM","STRONG","SPAN","I","B","SMALL","CITE"].includes(G.tagName)){const Q=(U=G.textContent)===null||U===void 0?void 0:U.trim();if(Q&&Q.length>0)return G}G=G.nextElementSibling}}for(let W=0;W<Y.length;W++){const J=Y[W],G=J.parentElement;if(!G)continue;const Q=G.querySelectorAll("em, strong, span, i, b, small, cite");for(let ie=0;ie<Q.length;ie++){const K=Q[ie];if(K===J)continue;const re=(F=K.textContent)===null||F===void 0?void 0:F.trim();if(re&&re.length>0)return K}}return null}function R(L){var P;const B=((P=L.textContent)===null||P===void 0?void 0:P.trim())||"";return!(B.length<10||B.startsWith("http://")||B.startsWith("https://"))&&!u.test(B)&&!B.match(/^\d+$/)&&!m.test(B)}function S(L,P){const B=L.tagName.toLowerCase();if(B==="img")return y(L,P);if(B==="picture"){const U=L.querySelector("img");return U?y(U,P):L.cloneNode(!0)}return B==="source"?(function(U,F){const I=F.createElement("img"),H=U.getAttribute("srcset");H&&v(H,I);const V=U.parentElement;if(V){const X=V.querySelectorAll("img"),ne=[];for(let Y=0;Y<X.length;Y++){const W=X[Y],J=W.getAttribute("src")||"";h(J)||w(J)||J===""||ne.push(W)}if(ne.length>0){if(p(ne[0],I,["src","srcset"]),!I.hasAttribute("src")||!O(I.getAttribute("src")||"")){const Y=ne[0].getAttribute("src");Y&&O(Y)&&I.setAttribute("src",Y)}}else{const Y=V.querySelector("img[data-src]");if(Y&&(p(Y,I,["src","srcset"]),!I.hasAttribute("src")||!O(I.getAttribute("src")||""))){const W=Y.getAttribute("data-src");W&&O(W)&&I.setAttribute("src",W)}}}return I})(L,P):L.cloneNode(!0)}function y(L,P){const B=L.getAttribute("src")||"";if(h(B)||w(B)){const U=L.parentElement;if(U){const F=U.querySelectorAll("source"),I=[];for(let H=0;H<F.length;H++){const V=F[H];V.hasAttribute("data-srcset")&&V.getAttribute("data-srcset")!==""&&I.push(V)}if(I.length>0){const H=P.createElement("img"),V=L.getAttribute("data-src");return V&&!w(V)&&H.setAttribute("src",V),p(L,H,["src"]),H}}}return L.cloneNode(!0)}function k(L){if(!L||!L.trim())return null;const P=L.trim(),B=/(.+?)\s+(\d+(?:\.\d+)?[wx])/g;let U,F=0;for(;(U=B.exec(P))!==null;){let H=U[1].trim();if(F>0&&(H=H.replace(/^,\s*/,"")),F=B.lastIndex,H&&!w(H))return H}const I=P.match(l);return I&&I[1]&&!w(I[1])?I[1]:null}function N(L){if(L.length===0)return null;if(L.length===1)return L[0];for(let U=0;U<L.length;U++)if(!L[U].hasAttribute("media"))return L[U];let P=null,B=0;for(let U=0;U<L.length;U++){const F=L[U],I=F.getAttribute("srcset");if(!I)continue;const H=I.match(a),V=I.match(s);if(H&&H[1]){const X=parseInt(H[1],10)*(V?parseFloat(V[1]):1);X>B&&(B=X,P=F)}}return P||L[0]}d.imageRules=[{selector:"picture",element:"picture",transform:(L,P)=>{const B=L.querySelectorAll("source"),U=L.querySelector("img");if(!U){const H=N(B);if(H){const V=H.getAttribute("srcset");if(V){const X=P.createElement("img");return v(V,X),L.replaceChildren(X),L}}return L}let F=null,I=null;if(B.length>0){const H=N(B);H&&(F=H.getAttribute("srcset"),F&&(I=k(F)))}if(F&&U.setAttribute("srcset",F),I&&O(I))U.setAttribute("src",I);else if(!U.hasAttribute("src")||!O(U.getAttribute("src")||"")){const H=k(U.getAttribute("srcset")||F||"");H&&O(H)&&U.setAttribute("src",H)}return B.forEach((H=>H.remove())),L}},{selector:"uni-image-full-width",element:"figure",transform:(L,P)=>{var B;const U=P.createElement("figure"),F=P.createElement("img"),I=L.querySelector("img");if(!I)return U;let H=I.getAttribute("src");const V=I.getAttribute("data-loading");if(V)try{const Y=JSON.parse(V);Y.desktop&&O(Y.desktop)&&(H=Y.desktop)}catch{}if(!H||!O(H))return U;F.setAttribute("src",H);let X=I.getAttribute("alt");X||(X=L.getAttribute("alt-text")),X&&F.setAttribute("alt",X),U.appendChild(F);const ne=L.querySelector("figcaption");if(ne){const Y=(B=ne.textContent)===null||B===void 0?void 0:B.trim();if(Y&&Y.length>5){const W=P.createElement("figcaption"),J=ne.querySelector(".rich-text p");J?(0,E.transferContent)(J,W):W.textContent=Y,U.appendChild(W)}}return U}},{selector:x.flatMap((([,L])=>L.map((P=>`img[${P}]`)))).concat("img[data-image-loader]").join(", "),element:"img",transform:L=>{var P;for(const[F,I]of x){const H=I.map((V=>{var X;return(X=L.getAttribute(V))===null||X===void 0?void 0:X.trim()})).find((V=>V&&!(0,E.isDangerousUrl)(V)));H&&L.setAttribute(F,H);for(const V of I)L.removeAttribute(V)}const B=L.getAttribute("src")||"",U=(P=L.getAttribute("data-image-loader"))===null||P===void 0?void 0:P.trim();return!U||(0,E.isDangerousUrl)(U)||B&&!h(B)&&!w(B)||L.setAttribute("src",U),L.removeAttribute("data-image-loader"),L.classList.remove("lazy","lazyload"),L.removeAttribute("data-ll-status"),L.removeAttribute("loading"),L}},{selector:"span:has(img)",element:"span",transform:(L,P)=>{try{if(!M(L))return L;for(const I of L.children)if(b.BLOCK_LEVEL_ELEMENTS.has(I.tagName.toLowerCase()))return L;const B=T(L);if(!B)return L;const U=D(L),F=S(B,P);if(U&&R(U)){const I=f(F,U,P);return U.parentNode&&U.parentNode.removeChild(U),I}return F}catch{return L}}},{selector:'figure, p:has([class*="caption"])',element:"figure",transform:(L,P)=>{try{if(!M(L))return L;const B=T(L);if(!B)return L;const U=D(L);if(U&&R(U)){const F=T(L);let I;return I=F||S(B,P),f(I,U,P)}return L}catch{return L}}}]},7282(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.createMathRules=d.createMathElement=d.LOOKS_LIKE_LATEX_RE=d.mathSelectors=d.mathFastCheck=d.isBlockDisplay=d.getBasicLatexFromElement=d.getMathMLFromElement=d.reconstructMathMLFromMjx=void 0,d.extractLatexFromImageSrc=function(T){for(const S of p){const y=T.match(S);if(y){const k=h(y[1]);if(k)return k}}const D=T.match(/\?([^#]+)/);if(D){const S=h(D[1]);if(S)return S}const R=T.split("?")[0].split("/");for(let S=R.length-1;S>=0;S--)if(/%5[Cc]/.test(R[S])){const y=h(R[S]);if(y)return y}return null},d.wrapRawLatexDelimiters=function(T,D){var R,S;if(!(function(N){const L=Array.from(N.querySelectorAll("script[src]"));for(const B of L){const U=(B.getAttribute("src")||"").toLowerCase();if(U.includes("mathjax")||U.includes("katex"))return!0}const P=Array.from(N.querySelectorAll("script:not([src])"));for(const B of P){const U=B.textContent||"";if(/MathJax\s*[.=]/.test(U)||/katex/i.test(U))return!0}return!1})(D)||T.querySelector(d.mathFastCheck))return;const y=[];(function N(L){if(!(0,E.isElement)(L)||!$.has(L.tagName))if((0,E.isTextNode)(L))y.push(L);else for(let P=L.firstChild;P;P=P.nextSibling)N(P)})(T);for(const N of y){const L=N.textContent||"";if(!L.includes("$")&&!L.includes("\\(")&&!L.includes("\\["))continue;const P=[];let B,U=0,F=!1;for(w.lastIndex=0;(B=w.exec(L))!==null;){const H=(R=B[1])!==null&&R!==void 0?R:B[2],V=(S=B[3])!==null&&S!==void 0?S:B[4],X=H!==void 0,ne=(H??V).trim();(B[2]!==void 0||B[4]!==void 0||(k=ne,O.test(k)||M.test(k)))&&(U<B.index&&P.push(L.slice(U,B.index)),X&&(F=!0),P.push({latex:ne,isBlock:X}),U=B.index+B[0].length)}if(P.length===0)continue;if(U<L.length&&P.push(L.slice(U)),F){const H=P.some((ne=>typeof ne=="string"&&ne.trim().length>0)),V=N.parentElement,X=!!V&&Array.from(V.childNodes).some((ne=>ne!==N&&((0,E.isTextNode)(ne)&&(ne.textContent||"").trim().length>0||(0,E.isElement)(ne))));if(H||X)for(const ne of P)typeof ne!="string"&&(ne.isBlock=!1)}const I=D.createDocumentFragment();for(const H of P)if(typeof H=="string")I.appendChild(D.createTextNode(H));else{const V=D.createElement("math");V.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),V.setAttribute("display",H.isBlock?"block":"inline"),V.setAttribute("data-latex",H.latex),V.textContent=H.latex,I.appendChild(V)}N.replaceWith(I)}var k};const _=g(639),E=g(2552),b=/[\u2061\u2062\u2063\u2064]/g,C=T=>T.normalize("NFKC").replace(b,""),A=new Set(["mi","mo","mn","mtext","ms","mspace","mglyph"]),a=new Set(["mrow","mstyle","mpadded","mphantom","menclose","merror","mtable","mtr","mtd","mlabeledtr"]),s=new Set(["mjx-nstrut","mjx-dstrut","mjx-strut","mjx-line","mjx-spacer","mjx-break","mjx-mark"]),l=(T,D)=>{for(const R of Array.from(T.children))if(R.tagName.toLowerCase()===D)return R;return null},u=(T,D,R)=>{if(!T)return[];const S=[];for(const y of Array.from(T.children))y!==R&&S.push(...f(y,D));return S},m=(T,D)=>{if(T.length===1)return T[0];const R=D.createElement("mrow");return T.forEach((S=>R.appendChild(S))),R},x=(T,D,R)=>{const S=R.createElement(T);return D.forEach((y=>S.appendChild(y))),S},f=(T,D)=>{const R=T.tagName.toLowerCase();if(R==="mjx-c"){const y=C(T.textContent||"");return y?[D.createTextNode(y)]:[]}if(s.has(R))return[];if(!R.startsWith("mjx-"))return[];const S=R.slice(4);if(A.has(S)){const y=C(T.textContent||"");if(!y&&S!=="mspace")return[];const k=D.createElement(S);return y&&(k.textContent=y),[k]}if(a.has(S))return[x(S,u(T,D),D)];switch(S){case"mfrac":{const y=m(u(T.querySelector("mjx-num"),D),D),k=m(u(T.querySelector("mjx-den"),D),D);return[x("mfrac",[y,k],D)]}case"msqrt":{const y=T.querySelector("mjx-box");return[x("msqrt",u(y||T,D),D)]}case"msub":case"msup":{const y=l(T,"mjx-script"),k=m(u(T,D,y),D),N=m(u(y,D),D);return[x(S,[k,N],D)]}case"msubsup":{const y=l(T,"mjx-script"),k=m(u(T,D,y),D),N=u(y,D),L=N.length>1?N[N.length-1]:N[0]||D.createElement("mrow"),P=N.length>1?N[0]:D.createElement("mrow");return[x("msubsup",[k,L,P],D)]}case"munder":case"mover":case"munderover":{const y=m(u(T.querySelector("mjx-base"),D),D),k=T.querySelector("mjx-under"),N=T.querySelector("mjx-over");return S==="munder"?[x("munder",[y,m(u(k,D),D)],D)]:S==="mover"?[x("mover",[y,m(u(N,D),D)],D)]:[x("munderover",[y,m(u(k,D),D),m(u(N,D),D)],D)]}default:return u(T,D)}};d.reconstructMathMLFromMjx=(T,D)=>{const R=D.createElement("math");R.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML");for(const y of Array.from(T.children))for(const k of f(y,D))R.appendChild(k);if(R.childNodes.length===0)return null;const S=T.getAttribute("display")==="true";return S&&R.setAttribute("display","block"),{mathml:R.outerHTML,latex:null,isBlock:S}};const v=T=>{const D=T.cloneNode(!0);return(R=>{const S=R.ownerDocument;if(!S)return;const y=Array.from(R.querySelectorAll("mtable"));for(const k of y){const N=Array.from(k.children).filter((I=>{const H=I.tagName.toLowerCase();return H==="mtr"||H==="mlabeledtr"}));if(N.length!==1)continue;const L=N[0];if(L.tagName.toLowerCase()!=="mlabeledtr")continue;const P=Array.from(L.children).filter((I=>I.tagName.toLowerCase()==="mtd"));if(P.length<2)continue;const[B,...U]=P,F=S.createElement("mrow");for(const I of U)for(;I.firstChild;)F.appendChild(I.firstChild);if(B.childNodes.length>0){const I=S.createElement("mspace");for(I.setAttribute("width","2em"),F.appendChild(I);B.firstChild;)F.appendChild(B.firstChild)}k.replaceWith(F)}})(D),D.outerHTML};d.getMathMLFromElement=T=>{if(T.tagName.toLowerCase()==="math"){const k=T.getAttribute("display")==="block";return{mathml:v(T),latex:T.getAttribute("alttext")||null,isBlock:k}}const D=T.getAttribute("data-mathml");if(D){const k=T.ownerDocument||document,N=(0,_.parseHTML)(k,D).querySelector("math");if(N){const L=N.getAttribute("display")==="block";return{mathml:v(N),latex:N.getAttribute("alttext")||null,isBlock:L}}}const R=T.querySelector(".MJX_Assistive_MathML, mjx-assistive-mml");if(R){const k=R.querySelector("math");if(k){const N=k.getAttribute("display"),L=R.getAttribute("display"),P=N==="block"||L==="block";return{mathml:v(k),latex:k.getAttribute("alttext")||null,isBlock:P}}}const S=T.querySelector(".katex-mathml math");if(S)return{mathml:v(S),latex:null,isBlock:!1};const y=T.tagName.toLowerCase()==="mjx-math"?T:T.querySelector("mjx-math");if(y){const k=T.ownerDocument||document,N=(0,d.reconstructMathMLFromMjx)(y,k);if(N)return N}return null},d.getBasicLatexFromElement=T=>{var D,R,S,y;const k=T.getAttribute("data-latex");if(k)return k;const N=T.getAttribute("data-math");if(N)return N;const L=!((D=T.parentElement)===null||D===void 0)&&D.classList.contains("hurmet-tex")?T.parentElement.getAttribute("data-entry"):null;if(L)return L;if(T.tagName.toLowerCase()==="img"&&T.classList.contains("latex")){const B=T.getAttribute("alt");if(B)return B;const U=T.getAttribute("src");if(U){const F=U.match(/latex\.php\?latex=([^&]+)/);if(F)return decodeURIComponent(F[1]).replace(/\+/g," ").replace(/%5C/g,"\\")}}const P=T.querySelector('annotation[encoding="application/x-tex"]');if(P!=null&&P.textContent)return P.textContent.trim();if(T.matches(".katex")){const B=T.querySelector('.katex-mathml annotation[encoding="application/x-tex"]');if(B!=null&&B.textContent)return B.textContent.trim()}if(T.matches('script[type="math/tex"]')||T.matches('script[type="math/tex; mode=display"]'))return((R=T.textContent)===null||R===void 0?void 0:R.trim())||null;if(T.parentElement){const B=T.parentElement.querySelector('script[type="math/tex"], script[type="math/tex; mode=display"]');if(B)return((S=B.textContent)===null||S===void 0?void 0:S.trim())||null}return T.tagName.toLowerCase()==="math"&&(!((y=T.textContent)===null||y===void 0)&&y.trim())?T.textContent.trim():T.getAttribute("alt")||null},d.isBlockDisplay=T=>{if(T.getAttribute("display")==="block")return!0;const D=(0,_.getClassName)(T).toLowerCase();if(D.includes("display")||D.includes("block")||T.closest('.katex-display, .MathJax_Display, [data-display="block"]'))return!0;const R=T.previousElementSibling;if((R==null?void 0:R.tagName.toLowerCase())==="p"||T.matches(".mwe-math-fallback-image-display"))return!0;if(T.matches(".katex"))return T.closest(".katex-display")!==null;if(T.hasAttribute("display"))return T.getAttribute("display")==="true";if(T.matches('script[type="math/tex; mode=display"]'))return!0;const S=T.closest("[display]");return!!S&&S.getAttribute("display")==="true"},d.mathFastCheck='math, mjx-container, .MathJax, .katex, img.latex, [data-math], [data-latex], script[type^="math/"]',d.mathSelectors=['img.latex[src*="latex.php"]',"span.MathJax","mjx-container",'script[type="math/tex"]','script[type="math/tex; mode=display"]','.MathJax_Preview + script[type="math/tex"]',".MathJax_Display",".MathJax_SVG",".MathJax_MathML",".mwe-math-element",".mwe-math-fallback-image-inline",".mwe-math-fallback-image-display",".mwe-math-mathml-inline",".mwe-math-mathml-display",".katex",".katex-display",".katex-mathml",".katex-html","[data-katex]",'script[type="math/katex"]',"math","[data-math]","[data-latex]","[data-tex]",'script[type^="math/"]','annotation[encoding="application/x-tex"]'].join(",");const p=["latex","chl","tex","eq","math"].map((T=>new RegExp(`[?&]${T}=([^&#]+)`,"i")));function h(T){try{const D=decodeURIComponent(T.replace(/\+/g," "));return d.LOOKS_LIKE_LATEX_RE.test(D)?D:null}catch{return null}}d.LOOKS_LIKE_LATEX_RE=/\\[a-zA-Z]{2,}/;const w=/\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\]|\$([^\s$][^$]*[^\s$]|[^\s$])\$|\\\(([\s\S]+?)\\\)/g,O=/\\[a-zA-Z]/,M=/[_^{}]/,$=new Set(["PRE","CODE","SCRIPT","STYLE","MATH","SVG","TEXTAREA"]);d.createMathElement=(T,D,R,S,y)=>{const k=S.createElement("math");if(k.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),k.setAttribute("display",R?"block":"inline"),k.setAttribute("data-latex",D||""),T==null?void 0:T.mathml){const N=(0,_.parseHTML)(S,T.mathml).querySelector("math");N&&(0,_.transferContent)(N,k)}else if(D){const N=y==null?void 0:y(D,R,S);N?(0,_.transferContent)(N,k):k.textContent=D}return k},d.createMathRules=(T,D)=>[{selector:d.mathSelectors,element:"math",fastCheck:d.mathFastCheck,transform:(R,S)=>{if(!("classList"in R)||!("getAttribute"in R)||!("querySelector"in R))return R;const y=(0,d.getMathMLFromElement)(R),k=T(R),N=(0,d.isBlockDisplay)(R),L=(0,d.createMathElement)(y,k,N,R.ownerDocument||S,D);return R.parentElement&&!R.matches('script[type^="math/"]')&&R.parentElement.querySelectorAll('script[type^="math/"], .MathJax_Preview, script[type="text/javascript"][src*="mathjax"], script[type="text/javascript"][src*="katex"]').forEach((P=>P.remove())),L}}]},6e3(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.mathRules=d.createCleanMathEl=void 0;const _=g(7282);d.createCleanMathEl=(E,b,C,A)=>(0,_.createMathElement)(E,b,C,A),d.mathRules=(0,_.createMathRules)(_.getBasicLatexFromElement)},1917(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.ExtractorRegistry=void 0;const _=g(5959),E=g(2248),b=g(1064),C=g(3258),A=g(9759),a=g(2458),s=g(8632),l=g(8397),u=g(3020),m=g(4732),x=g(3588),f=g(5666),v=g(3055),p=g(27),h=g(6581),w=g(8090),O=g(2144),M=g(8477),$=g(9970),T=g(5654),D=g(4454),R=g(1756),S=g(7228),y=g(7278),k=g(9964),N=g(4501);class L{static initialize(){this.register({patterns:["x.com","twitter.com"],extractor:b.XArticleExtractor}),this.register({patterns:["twitter.com",/\/x\.com\/.*/],extractor:E.TwitterExtractor}),this.register({patterns:["x.com","twitter.com"],extractor:f.XOembedExtractor}),this.register({patterns:["mail.google.com"],extractor:N.GmailExtractor}),this.register({patterns:["reddit.com","old.reddit.com","new.reddit.com",/^https:\/\/[^\/]+\.reddit\.com/],extractor:_.RedditExtractor}),this.register({patterns:["youtube.com","youtu.be",/youtube\.com\/watch\?v=.*/,/youtu\.be\/.*/],extractor:C.YoutubeExtractor}),this.register({patterns:["bilibili.com",/www\.bilibili\.com\/video\/BV[0-9A-Za-z]+/],extractor:A.BilibiliExtractor}),this.register({patterns:["news.ycombinator.com"],extractor:a.HackerNewsExtractor}),this.register({patterns:[/^https?:\/\/chatgpt\.com\/(c|share)\/.*/],extractor:s.ChatGPTExtractor}),this.register({patterns:["claude.ai",/^https?:\/\/claude\.ai\/(chat|share)\/.*/],extractor:l.ClaudeExtractor}),this.register({patterns:[/^https?:\/\/grok\.com\/(chat|share)(\/.*)?$/],extractor:u.GrokExtractor}),this.register({patterns:[/^https?:\/\/gemini\.google\.com\/app\/.*/],extractor:m.GeminiExtractor}),this.register({patterns:["github.com",/^https?:\/\/github\.com\/.*/],extractor:x.GitHubExtractor}),this.register({patterns:["linkedin.com"],extractor:M.LinkedInExtractor}),this.register({patterns:["threads.net","www.threads.com","threads.com"],extractor:$.ThreadsExtractor}),this.register({patterns:["bsky.app"],extractor:T.BlueskyExtractor}),this.register({patterns:["medium.com",/\.medium\.com/],extractor:R.MediumExtractor}),this.register({patterns:["wiki.c2.com"],extractor:p.C2WikiExtractor}),this.register({patterns:[/^https?:\/\/substack\.com\/@[^/]+\/note\/.+/,/^https?:\/\/substack\.com\/home\/post\/p-\d+/,"substack.com"],extractor:h.SubstackExtractor}),this.register({patterns:["nytimes.com"],extractor:w.NytimesExtractor}),this.register({patterns:["wikipedia.org"],extractor:O.WikipediaExtractor}),this.register({patterns:[/\/@[^/]+\/\d+/],extractor:k.MastodonExtractor}),this.register({patterns:[/\/t\/[^/]+\/\d+/],extractor:D.DiscourseExtractor}),this.register({patterns:["leetcode.com"],extractor:S.LeetCodeExtractor}),this.register({patterns:["lwn.net"],extractor:y.LwnExtractor}),this.register({patterns:[/.*/],extractor:v.BbcodeDataExtractor})}static register(B){this.mappings.push(B)}static findExtractor(B,U,F,I){return this.findByPredicate(B,U,F,(H=>H.canExtract()),I)}static findAsyncExtractor(B,U,F,I){return this.findByPredicate(B,U,F,(H=>H.canExtractAsync()),I)}static findPreferredAsyncExtractor(B,U,F,I){return this.findByPredicate(B,U,F,(H=>H.canExtractAsync()&&H.prefersAsync()),I)}static findByPredicate(B,U,F,I,H){try{const V=new URL(U).hostname;for(const{patterns:X,extractor:ne}of this.mappings)if(X.some((Y=>Y instanceof RegExp?Y.test(U):V.includes(Y)))){const Y=new ne(B,U,F,H);if(I(Y))return Y}return null}catch(V){return console.error("Error finding extractor:",V),null}}}d.ExtractorRegistry=L,L.mappings=[],L.initialize()},2279(c,d){var g=this&&this.__awaiter||function(_,E,b,C){return new(b||(b=Promise))((function(A,a){function s(m){try{u(C.next(m))}catch(x){a(x)}}function l(m){try{u(C.throw(m))}catch(x){a(x)}}function u(m){var x;m.done?A(m.value):(x=m.value,x instanceof b?x:new b((function(f){f(x)}))).then(s,l)}u((C=C.apply(_,E||[])).next())}))};Object.defineProperty(d,"__esModule",{value:!0}),d.BaseExtractor=void 0,d.BaseExtractor=class{constructor(_,E,b,C){this.document=_,this.url=E,this.schemaOrgData=b,this.options=C||{}}get fetch(){return(this.options.fetch||globalThis.fetch).bind(globalThis)}postTitle(_,E){return`Post by ${_} on ${E}`}canExtractAsync(){return!1}prefersAsync(){return!1}extractAsync(){return g(this,void 0,void 0,(function*(){return this.extract()}))}}},5181(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.ConversationExtractor=void 0;const _=g(2279),E=g(5628),b=g(639);class C extends _.BaseExtractor{getFootnotes(){return[]}extract(){var a;const s=this.extractMessages(),l=this.getMetadata(),u=this.getFootnotes(),m=this.createContentHtml(s,u),x=this.createTemporaryDocument(),f=x.createElement("article");f.appendChild((0,b.parseHTML)(x,m)),x.body.appendChild(f);const v=new E.Defuddle(x,{url:"about:blank"}).parse(),p=v.content;return{content:p,contentHtml:p,extractedContent:{messageCount:s.length.toString()},variables:{title:l.title||"Conversation",site:l.site,description:l.description||`${l.site} conversation with ${s.length} messages`,wordCount:((a=v.wordCount)===null||a===void 0?void 0:a.toString())||""}}}createTemporaryDocument(){var a;const s=this.document.implementation;if(s!=null&&s.createHTMLDocument)return s.createHTMLDocument();const l=((a=this.document.defaultView)===null||a===void 0?void 0:a.DOMParser)||globalThis.DOMParser;if(l)return new l().parseFromString("<!doctype html><html><body></body></html>","text/html");throw new Error("Unable to create a temporary document for conversation extraction")}createContentHtml(a,s){return`${a.map(((l,u)=>{const m=l.timestamp?`<div class="message-timestamp">${(0,b.escapeHtml)(l.timestamp)}</div>`:"",x=/<p[^>]*>[\s\S]*?<\/p>/i.test(l.content)?l.content:`<p>${l.content}</p>`,f=l.metadata?Object.entries(l.metadata).filter((([v])=>/^[a-z][a-z0-9-]*$/i.test(v))).map((([v,p])=>`data-${v}="${(0,b.escapeHtml)(p)}"`)).join(" "):"";return`
|
|
321
|
+
<div class="message message-${(0,b.escapeHtml)(l.author.toLowerCase())}" ${f}>
|
|
322
|
+
<div class="message-header">
|
|
323
|
+
<p class="message-author"><strong>${(0,b.escapeHtml)(l.author)}</strong></p>
|
|
324
|
+
${m}
|
|
325
|
+
</div>
|
|
326
|
+
<div class="message-content">
|
|
327
|
+
${x}
|
|
328
|
+
</div>
|
|
329
|
+
</div>${u<a.length-1?`
|
|
330
|
+
<hr>`:""}`})).join(`
|
|
331
|
+
`).trim()}
|
|
332
|
+
${s.length>0?`
|
|
333
|
+
<div id="footnotes">
|
|
334
|
+
<ol>
|
|
335
|
+
${s.map(((l,u)=>`
|
|
336
|
+
<li class="footnote" id="fn:${u+1}">
|
|
337
|
+
<p>
|
|
338
|
+
<a href="${(0,b.escapeHtml)(l.url)}" target="_blank">${l.text}</a> <a href="#fnref:${u+1}" class="footnote-backref">↩</a>
|
|
339
|
+
</p>
|
|
340
|
+
</li>
|
|
341
|
+
`)).join("")}
|
|
342
|
+
</ol>
|
|
343
|
+
</div>`:""}`.trim()}}d.ConversationExtractor=C},3055(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.BbcodeDataExtractor=void 0;const _=g(2279),E=g(6618);class b extends _.BaseExtractor{constructor(){super(...arguments),this.eventData=void 0}canExtract(){var A,a;return!!(!((a=(A=this.getEventData())===null||A===void 0?void 0:A.announcement_body)===null||a===void 0)&&a.body)}extract(){const A=this.getEventData(),a=A.announcement_body,s=(0,E.bbcodeToHtml)(a.body||""),l=a.headline||A.event_name||"",u=a.posttime?new Date(1e3*a.posttime).toISOString():"";return{content:s,contentHtml:s,extractedContent:{},variables:{title:l,author:this.getGroupName(),published:u}}}getEventData(){var A;return this.eventData===void 0&&(this.eventData=(A=this.parseConfigAttr("data-partnereventstore"))!==null&&A!==void 0?A:null),this.eventData}getGroupName(){const A=this.parseConfigAttr("data-groupvanityinfo");return(A==null?void 0:A.group_name)||""}parseConfigAttr(A){const a=this.document.querySelector("#application_config"),s=a==null?void 0:a.getAttribute(A);if(!s)return null;try{const l=JSON.parse(s);return Array.isArray(l)?l[0]:l}catch{return null}}}d.BbcodeDataExtractor=b},9759(c,d,g){var _=this&&this.__awaiter||function(l,u,m,x){return new(m||(m=Promise))((function(f,v){function p(O){try{w(x.next(O))}catch(M){v(M)}}function h(O){try{w(x.throw(O))}catch(M){v(M)}}function w(O){var M;O.done?f(O.value):(M=O.value,M instanceof m?M:new m((function($){$(M)}))).then(p,h)}w((x=x.apply(l,u||[])).next())}))};Object.defineProperty(d,"__esModule",{value:!0}),d.BilibiliExtractor=void 0;const E=g(2279),b=g(639),C=g(1497),A=4e3,a=/[\u4E00-\u9FFF]/;class s extends E.BaseExtractor{constructor(u,m,x,f){super(u,m,x,f)}canExtract(){return!!this.getBvid()}canExtractAsync(){return this.canExtract()}prefersAsync(){return!0}extract(){return this.buildResult()}extractAsync(){return _(this,void 0,void 0,(function*(){var u;const m=this.getBvid();if(!m)return this.buildResult();const x=yield this.fetchViewData(m);if(!x)return this.buildResult();const{aid:f,pages:v=[]}=x,p=this.getPageNumber(),h=v.length>0?(u=v[p-1])!==null&&u!==void 0?u:v[0]:void 0,w=h==null?void 0:h.cid,O=this.normalizeLanguageCode(this.options.language),M=f&&w?`${m}:${w}:${O}`:"";let $;if(f&&w){if(M&&s.transcriptCache.has(M)){const T=s.transcriptCache.get(M);$=T??void 0}else if($=yield this.fetchTranscript(f,w,m),M&&(s.transcriptCache.set(M,$??null),s.transcriptCache.size>300)){const T=s.transcriptCache.keys().next().value;T&&s.transcriptCache.delete(T)}}return this.buildResult($,x,h,p)}))}getBvid(){var u;if(this._bvid!==void 0)return this._bvid;try{const m=new URL(this.url).pathname.match(/\/video\/(BV[0-9A-Za-z]+)\/?/);this._bvid=(u=m==null?void 0:m[1])!==null&&u!==void 0?u:""}catch{this._bvid=""}return this._bvid}getPageNumber(){try{const u=new URL(this.url),m=parseInt(new URLSearchParams(u.search).get("p")||"1",10);return Number.isFinite(m)&&m>0?m:1}catch{return 1}}formatDescription(u){const m=(0,b.escapeHtml)(u).replace(/\n/g,"<br>");return m?`<p>${m}</p>`:""}buildEmbedHtml(u,m){return`<iframe width="560" height="315" src="${`https://player.bilibili.com/player.html?bvid=${encodeURIComponent(u)}&page=${m}&high_quality=1&danmaku=0`}" title="Bilibili video player" frameborder="0" allowfullscreen></iframe>`}buildResult(u,m,x,f){var v;const p=this.getBvid(),h=(m==null?void 0:m.title)||this.document.title||"",w=((v=m==null?void 0:m.owner)===null||v===void 0?void 0:v.name)||"",O=(m==null?void 0:m.desc)||"",M=O.slice(0,200).trim(),$=(m==null?void 0:m.pic)||"",T=m!=null&&m.pubdate?new Date(1e3*m.pubdate).toISOString():"";let D="";p&&(D+=this.buildEmbedHtml(p,f||this.getPageNumber())),O&&(D+=this.formatDescription(O)),u!=null&&u.html&&(D+=u.html);const R={title:h,author:w,site:"Bilibili",image:$,published:T,description:M};return x!=null&&x.part&&(R.part=x.part),u!=null&&u.text&&(R.transcript=u.text),u!=null&&u.languageCode&&(R.language=u.languageCode),{content:D,contentHtml:D,extractedContent:Object.assign({videoId:p},x!=null&&x.cid?{cid:String(x.cid)}:{}),variables:R}}normalizeLanguageCode(u){return(u||"").trim().replace(/_/g,"-").toLocaleLowerCase()}pickSubtitleTrack(u,m){var x;if(u.length===0)return;const f=this.normalizeLanguageCode(m),v=f?f.split("-")[0]:"",p=h=>(h||"").trim().toLocaleLowerCase();return(x=u.map(((h,w)=>{const O=this.normalizeLanguageCode(h.lan);let M=3;f&&(O===f?M=0:v&&O===v?M=1:v&&O.split("-")[0]===v&&(M=2));const $=h.is_ai_subtitle||(D=>{const R=p(D);return R.includes("ai")||R.includes("auto")||R.includes("自动")})(h.lan_doc)?1:0,T=(D=>D==="zh-cn"||D==="zh-hans"?0:D==="zh"?1:D.startsWith("zh-")?2:D==="en"||D.startsWith("en-")?3:4)(O);return{t:h,prefScore:M,aiScore:$,lp:T,id:typeof h.id=="number"?h.id:Number.MAX_SAFE_INTEGER,doc:p(h.lan_doc),urlKey:(D=>{const R=(D||"").trim();if(!R)return"";try{const S=R.startsWith("//")?`https:${R}`:R,y=new URL(S);return`${y.hostname.toLocaleLowerCase()}${y.pathname}`}catch{return R.split("?")[0].split("#")[0]}})(h.subtitle_url),index:w}})).sort(((h,w)=>h.prefScore!==w.prefScore?h.prefScore-w.prefScore:h.aiScore!==w.aiScore?h.aiScore-w.aiScore:h.lp!==w.lp?h.lp-w.lp:h.id!==w.id?h.id-w.id:h.doc!==w.doc?h.doc.localeCompare(w.doc):h.urlKey!==w.urlKey?h.urlKey.localeCompare(w.urlKey):h.index-w.index))[0])===null||x===void 0?void 0:x.t}fetchViewData(u){return _(this,void 0,void 0,(function*(){try{const m=`https://api.bilibili.com/x/web-interface/view?bvid=${encodeURIComponent(u)}`,x=yield this.fetch(m,{headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0)"},credentials:"include",signal:AbortSignal.timeout(A)});if(!x.ok)return;const f=yield x.json();return(f==null?void 0:f.code)!==0?void 0:f.data}catch{return}}))}parseSubtitleTracks(u){var m,x,f,v,p,h;const w=[(x=(m=u==null?void 0:u.data)===null||m===void 0?void 0:m.subtitle)===null||x===void 0?void 0:x.subtitles,(v=(f=u==null?void 0:u.data)===null||f===void 0?void 0:f.subtitle)===null||v===void 0?void 0:v.list,(h=(p=u==null?void 0:u.data)===null||p===void 0?void 0:p.subtitle)===null||h===void 0?void 0:h.tracks];for(const O of w)if(Array.isArray(O))return O.map((M=>{var $,T,D,R,S,y;return{lan:String((D=(T=($=M==null?void 0:M.lan)!==null&&$!==void 0?$:M==null?void 0:M.lang)!==null&&T!==void 0?T:M==null?void 0:M.language)!==null&&D!==void 0?D:""),lan_doc:M!=null&&M.lan_doc?String(M.lan_doc):void 0,subtitle_url:String((y=(S=(R=M==null?void 0:M.subtitle_url)!==null&&R!==void 0?R:M==null?void 0:M.subtitleUrl)!==null&&S!==void 0?S:M==null?void 0:M.url)!==null&&y!==void 0?y:""),id:typeof(M==null?void 0:M.id)=="number"?M.id:typeof(M==null?void 0:M.subtitle_id)=="number"?M.subtitle_id:void 0,is_ai_subtitle:typeof(M==null?void 0:M.is_ai_subtitle)=="boolean"?M.is_ai_subtitle:typeof(M==null?void 0:M.ai_type)=="number"?M.ai_type>0:void 0}})).filter((M=>!!M.lan&&!!M.subtitle_url));return[]}fetchPlayerV2(u){return _(this,void 0,void 0,(function*(){const m=yield this.fetch(u,{headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0)"},credentials:"include",signal:AbortSignal.timeout(A)});if(!m.ok)return{tracks:[],code:m.status,message:`http_${m.status}`};const x=yield m.json(),f=typeof(x==null?void 0:x.code)=="number"?x.code:void 0,v=typeof(x==null?void 0:x.message)=="string"?x.message:void 0;return f!==0?{tracks:[],code:f,message:v}:{tracks:this.parseSubtitleTracks(x),code:f,message:v}}))}fetchTranscript(u,m,x){return _(this,void 0,void 0,(function*(){try{const f=`https://api.bilibili.com/x/player/wbi/v2?bvid=${encodeURIComponent(String(x))}&aid=${encodeURIComponent(String(u))}&cid=${encodeURIComponent(String(m))}`,v=`https://api.bilibili.com/x/player/v2?bvid=${encodeURIComponent(String(x))}&cid=${encodeURIComponent(String(m))}`,p=`https://api.bilibili.com/x/player/v2?aid=${encodeURIComponent(String(u))}&cid=${encodeURIComponent(String(m))}`;let h=[];if(h=(yield this.fetchPlayerV2(f)).tracks,h.length===0&&(h=(yield this.fetchPlayerV2(v)).tracks,h.length===0&&(h=(yield this.fetchPlayerV2(p)).tracks)),!Array.isArray(h)||h.length===0)return;const w=this.pickSubtitleTrack(h,this.options.language);if(!(w!=null&&w.subtitle_url))return;const O=this.normalizeSubtitleUrl(w.subtitle_url);if(!O||!this.isAllowedSubtitleHost(O))return;const M=yield this.fetch(O.toString(),{headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0)"},signal:AbortSignal.timeout(A)});if(!M.ok)return;const $=yield M.json(),T=this.parseSubtitleJson($);return T?Object.assign(Object.assign({},T),{languageCode:w.lan}):void 0}catch{return}}))}normalizeSubtitleUrl(u){try{const m=(u||"").trim();if(!m)return null;const x=m.startsWith("//")?`https:${m}`:m,f=new URL(x);return f.protocol!=="https:"?null:f}catch{return null}}isAllowedSubtitleHost(u){const m=u.hostname.toLocaleLowerCase();return m.endsWith(".hdslb.com")||m.endsWith(".bilibili.com")}parseSubtitleJson(u){const m=(Array.isArray(u==null?void 0:u.body)?u.body:[]).map((p=>({start:typeof p.from=="number"?p.from:NaN,end:typeof p.to=="number"?p.to:typeof p.from=="number"?p.from:NaN,text:(p.content||"").trim()}))).filter((p=>Number.isFinite(p.start)&&p.text.length>0)).sort(((p,h)=>p.start-h.start));if(m.length===0)return;const x=this.groupSubtitleLines(m),{html:f,text:v}=(0,C.buildTranscript)("bilibili",x);return{html:f,text:v}}groupSubtitleLines(u){const m=[];let x=u[0].start,f=u[0].end,v=u[0].text;const p=()=>{const h=v.replace(/\s+/g," ").trim();h&&m.push({start:Math.max(0,Math.floor(x)),text:h,speakerChange:m.length>0})};for(let h=1;h<u.length;h++){const w=u[h],O=w.start-f,M=Math.max(w.end,w.start)-x;O>20||M>30?(p(),x=w.start,f=w.end,v=w.text):(v=this.concatTranscriptText(v,w.text),f=Math.max(f,w.end))}return p(),m}concatTranscriptText(u,m){const x=(u||"").trimEnd(),f=(m||"").trimStart();if(!x)return f;if(!f)return x;const v=x[x.length-1],p=f[0],h=a.test(v),w=a.test(p);return h&&w?x+f:`${x} ${f}`}}d.BilibiliExtractor=s,s.transcriptCache=new Map},5654(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.BlueskyExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){super(a,s,l,u),this.postItems=[],this.threadScreen=a.querySelector('[data-testid="postThreadScreen"]'),this.threadScreen&&(this.postItems=Array.from(this.threadScreen.querySelectorAll('[data-testid^="postThreadItem-by-"]')))}canExtract(){return this.postItems.length>0}extract(){const a=this.getHandle(this.postItems[0]),s=[],l=[];let u=!1;for(const M of this.postItems){const $=this.getHandle(M);u||$!==a?(u=!0,l.push(M)):s.push(M)}const m=s.map((M=>this.extractPostContent(M))).join(`
|
|
344
|
+
<hr>
|
|
345
|
+
`),x=this.options.includeReplies!==!1?this.extractComments(l):"",f=(0,b.buildContentHtml)("bluesky",m,x),v=`@${a}`,p=this.getDisplayName(this.postItems[0]),h=this.createDescription(this.postItems[0]),w=this.getPublishedDate(),O=this.postTitle(p||v,"Bluesky");return{content:f,contentHtml:f,extractedContent:{postAuthor:a},variables:Object.assign({title:O,author:p||v,site:"Bluesky",description:h},w&&{published:w})}}extractComments(a){if(a.length===0)return"";let s=0;const l=a.map((u=>{const m=this.getHandle(u),x=this.getDisplayName(u),f=this.extractPostContent(u),v=this.getReplyDate(u),p=this.getPermalink(u);return this.hasTopConnector(u)?s++:s=0,{author:x?`${x} @${m}`:`@${m}`,date:v,content:f,depth:s,url:p||void 0}}));return(0,b.buildCommentTree)(l)}hasTopConnector(a){const s=a.children[0];if(!s)return!1;const l=s.querySelectorAll("div");for(const u of Array.from(l)){const m=u.getAttribute("style")||"";if(m.includes("width: 2px")&&m.includes("background-color"))return!0}return!1}getHandle(a){const s=(a.getAttribute("data-testid")||"").match(/^postThreadItem-by-(.+)$/);return s?s[1]:""}getDisplayName(a){var s;const l=a.querySelector('a[aria-label*="avatar"]');if(l){const m=(l.getAttribute("aria-label")||"").match(/^(.+)'s avatar$/);if(m)return m[1]}const u=a.querySelectorAll('a[href^="/profile/"]');for(const m of Array.from(u)){const x=((s=m.textContent)===null||s===void 0?void 0:s.trim())||"";if(x&&!x.startsWith("@")&&!x.includes("avatar")&&!x.includes("·"))return x}return""}getPublishedDate(){const a=this.document.querySelector('meta[name="twitter:value1"]');if(a){const s=a.getAttribute("content")||"";try{return new Date(s).toISOString().split("T")[0]}catch{}}return""}getReplyDate(a){const s=a.querySelector('a[href*="/post/"]');if(!s)return"";const l=s.getAttribute("aria-label")||"";if(!l)return"";try{const u=new Date(l.replace(" at "," "));if(!isNaN(u.getTime()))return u.toISOString().split("T")[0]}catch{}return""}getPermalink(a){const s=a.querySelector('a[href*="/post/"]');if(!s)return"";const l=s.getAttribute("href")||"";return l.startsWith("http")?l:`https://bsky.app${l}`}extractPostContent(a){const s=[],l=a.querySelector('div[data-word-wrap="1"]');if(l){const f=this.cleanText(l);f&&s.push(f)}const u=this.extractImages(a);u&&s.push(u);const m=this.extractLinkCard(a);m&&s.push(m);const x=this.extractQuotedPost(a);return x&&s.push(x),s.join(`
|
|
346
|
+
`)}cleanText(a){const s=a.cloneNode(!0);s.querySelectorAll('a[href*="/profile/"]').forEach((u=>{var m;const x=((m=u.textContent)===null||m===void 0?void 0:m.trim())||"",f=u.getAttribute("href")||"";if(x.startsWith("@")){const v=x.slice(1),p=s.ownerDocument.createElement("a");p.setAttribute("href",`https://bsky.app/profile/${v}`),p.textContent=x,u.replaceWith(p)}else f.startsWith("/profile/")&&u.setAttribute("href",`https://bsky.app${f}`)})),s.querySelectorAll('a[href^="http"]').forEach((u=>{var m;const x=u.getAttribute("href")||"",f=((m=u.textContent)===null||m===void 0?void 0:m.trim())||"",v=s.ownerDocument.createElement("a");v.setAttribute("href",x),v.textContent=f,u.replaceWith(v)})),s.querySelectorAll("span, div").forEach((u=>{u.replaceWith(...Array.from(u.childNodes))}));let l=(s.innerHTML||s.textContent||"").trim();return l=l.replace(/[\u200E\u200F\u200B]/g,""),l=l.replace(/[^\S\n]+/g," ").trim(),l?l.split(/\n+/).map((u=>u.trim())).filter((u=>u)).map((u=>`<p>${u}</p>`)).join(`
|
|
347
|
+
`):""}extractImages(a){const s=[];return a.querySelectorAll('img[src*="/feed_thumbnail/"], img[src*="/feed_fullsize/"]').forEach((l=>{const u=l.getAttribute("src")||"";if(!u)return;const m=u.replace("/feed_thumbnail/","/feed_fullsize/");s.push(`<img src="${(0,E.escapeHtml)(m)}" alt="" />`)})),s.join(`
|
|
348
|
+
`)}extractLinkCard(a){const s=a.querySelectorAll('a[aria-label][href^="http"]');for(const l of Array.from(s)){if(!l.querySelector('div[style*="border"]'))continue;const u=l.getAttribute("href")||"",m=l.getAttribute("aria-label")||"",x=l.querySelector("img");if(m){let f="";if(x){const v=x.getAttribute("src")||"";f+=`<a href="${(0,E.escapeHtml)(u)}"><img src="${(0,E.escapeHtml)(v)}" alt="${(0,E.escapeHtml)(m)}" /></a>
|
|
349
|
+
`}return f+=`<p><a href="${(0,E.escapeHtml)(u)}">${(0,E.escapeHtml)(m)}</a></p>`,f}}return""}extractQuotedPost(a){const s=a.querySelectorAll('[data-testid^="postThreadItem-by-"]');for(const l of Array.from(s)){if(l===a)continue;const u=this.getHandle(l),m=this.getDisplayName(l),x=l.querySelector('div[data-word-wrap="1"]'),f=x?this.cleanText(x):"";return(0,b.buildQuotedPost)({author:m?`${m} @${u}`:`@${u}`,content:f})}return""}createDescription(a){const s=a.querySelector('div[data-word-wrap="1"]');return s?(s.textContent||"").replace(/[\u200E\u200F\u200B]/g,"").trim().slice(0,140).replace(/\s+/g," "):""}}d.BlueskyExtractor=C},27(c,d,g){var _=this&&this.__awaiter||function(a,s,l,u){return new(l||(l=Promise))((function(m,x){function f(h){try{p(u.next(h))}catch(w){x(w)}}function v(h){try{p(u.throw(h))}catch(w){x(w)}}function p(h){var w;h.done?m(h.value):(w=h.value,w instanceof l?w:new l((function(O){O(w)}))).then(f,v)}p((u=u.apply(a,s||[])).next())}))};Object.defineProperty(d,"__esModule",{value:!0}),d.C2WikiExtractor=void 0;const E=g(2279),b=g(639);class C extends E.BaseExtractor{canExtract(){return!1}canExtractAsync(){return this.getPageTitle()!==null}prefersAsync(){return!0}extract(){return{content:"",contentHtml:""}}extractAsync(){return _(this,void 0,void 0,(function*(){const s=this.getPageTitle();if(!s)return{content:"",contentHtml:""};const l=yield this.fetch("https://c2.com/wiki/remodel/pages/"+s).then((x=>x.json()));if(!l||!l.text)return{content:"",contentHtml:""};const u=s.replace(/([a-z])([A-Z])/g,"$1 $2"),m=this.renderPage(l);return{content:m,contentHtml:m,variables:Object.assign({title:u,site:"C2 Wiki"},l.date?{published:l.date}:{})}}))}getPageTitle(){if(this.pageTitle!==void 0)return this.pageTitle;try{const s=new URL(this.url).search.match(/[?&]([A-Za-z]\w*)/);this.pageTitle=s?s[1]:"WelcomeVisitors"}catch{this.pageTitle=null}return this.pageTitle}renderPage(s){return`${this.markup(s.text)}${s.date?`<hr><p>Last edit ${(0,b.escapeHtml)(s.date)}</p>`:""}`}markup(s){const l=s.replace(/\\\n/g," ").split(/\r?\n/),u=[];let m=[];for(const x of l){const{html:f,openTags:v}=this.applyBullets((0,b.escapeHtml)(x),m);u.push(this.applyInline(f)),m=v}for(;m.length>0;)u.push(`</${m.pop()}>`);return u.join(`
|
|
350
|
+
`)}applyBullets(s,l){const u=[...l];let m="";const x=(w,O)=>{for(;u.length>w;)m+=`</${u.pop()}>`;O&&u.length<w?(m+=`<${O}>`,u.push(O)):O&&u.length===w&&u[w-1]!==O&&(m+=`</${u.pop()}><${O}>`,u.push(O))};if(/^\s*$/.test(s))return u.some((w=>w==="ul"||w==="ol"||w==="dl"))?{html:"",openTags:u}:(x(0),{html:m+"<p></p>",openTags:u});if(/^-----*/.test(s))return x(0),{html:m+"<hr>",openTags:u};const f=s.match(/^(\t+)(.+):\t/);if(f)return x(f[1].length,"dl"),{html:m+`<dt>${f[2]}<dd>`+s.slice(f[0].length),openTags:u};const v=s.match(/^(\t+)\*/);if(v)return x(v[1].length,"ul"),{html:m+"<li>"+s.slice(v[0].length),openTags:u};const p=s.match(/^(\*+)/);if(p)return x(p[1].length,"ul"),{html:m+"<li>"+s.slice(p[0].length),openTags:u};const h=s.match(/^(\t+)\d+\.?/);return h?(x(h[1].length,"ol"),{html:m+"<li>"+s.slice(h[0].length),openTags:u}):/^\s/.test(s)?(x(1,"pre"),{html:m+s,openTags:u}):(x(0),{html:m+s,openTags:u})}applyInline(s){return s.replace(/'''(.*?)'''/g,"<strong>$1</strong>").replace(/''(.*?)''/g,"<em>$1</em>").replace(/\b(https?|ftp|mailto|file|telnet|news):(?:(?!&(?:lt|gt|quot);)[^\s<>[\]"'()])*(?:(?!&(?:lt|gt|quot);)[^\s<>[\]"'(),.?])/g,(l=>(0,b.isDangerousUrl)(l)?l:/\.(gif|jpg|jpeg|png)$/i.test(l)?`<img src="${A(l)}">`:`<a href="${A(l)}" rel="nofollow" target="_blank">${l}</a>`))}}function A(a){return a.replace(/"/g,""").replace(/'/g,"'")}d.C2WikiExtractor=C},8632(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.ChatGPTExtractor=void 0;const _=g(5181),E=g(639);class b extends _.ConversationExtractor{constructor(A,a,s,l){super(A,a,s,l),this.cachedMessages=null,this.turns=A.querySelectorAll('[data-testid^="conversation-turn-"]'),this.footnotes=[],this.footnoteCounter=0}canExtract(){return!!this.turns&&this.turns.length>0}extractMessages(){if(this.cachedMessages)return this.cachedMessages;const A=[];return this.footnotes=[],this.footnoteCounter=0,this.turns&&(this.turns.forEach((a=>{var s,l;const u=a.querySelector("h4.sr-only, h5.sr-only, h6.sr-only"),m=((l=(s=u==null?void 0:u.textContent)===null||s===void 0?void 0:s.trim())===null||l===void 0?void 0:l.replace(/:\s*$/,""))||"",x=Array.from(a.querySelectorAll("[data-message-author-role]")).filter((M=>M.closest('[data-testid^="conversation-turn-"]')===a)),f=x[0],v=(f==null?void 0:f.getAttribute("data-message-author-role"))||"",p=x.flatMap((M=>{const $=this.getMessageContentElements(M);return $.length>0?$.map((T=>(0,E.serializeHTML)(T))):[(0,E.serializeHTML)(M)]}));let h=(p.length>0?p:[(0,E.serializeHTML)(a)]).join(`
|
|
351
|
+
`);h=h.replace(/\u200B/g,"");const w=this.document.createElement("div");w.appendChild((0,E.parseHTML)(this.document,h)),w.querySelectorAll("h4.sr-only, h5.sr-only, h6.sr-only").forEach((M=>M.remove())),h=(0,E.serializeHTML)(w),h=h.replace(/(​)?(<span[^>]*?>\s*(?:<span[^>]*?>\s*)*<a(?=[^>]*?href="([^"]+)")(?=[^>]*?target="_blank")(?=[^>]*?rel="noopener")[^>]*?>[\s\S]*?<\/a>\s*(?:<\/span>\s*)+)/gi,((M,$,T,D)=>{let R="",S="";try{R=new URL(D).hostname.replace(/^www\./,"");const N=D.split("#:~:text=");if(N.length>1){S=decodeURIComponent(N[1]),S=S.replace(/%2C/g,",");const L=S.split(",");S=L.length>1&&L[0].trim()?` — ${L[0].trim()}...`:L[0].trim()?` — ${S.trim()}`:""}}catch(N){console.error(`Failed to parse URL: ${D}`,N),R=D}let y,k=this.footnotes.findIndex((N=>N.url===D));return k===-1?(this.footnoteCounter++,y=this.footnoteCounter,this.footnotes.push({url:D,text:`<a href="${(0,E.escapeHtml)(D)}">${(0,E.escapeHtml)(R)}</a>${(0,E.escapeHtml)(S)}`})):y=k+1,`<sup id="fnref:${y}"><a href="#fn:${y}">${y}</a></sup>`}));const O=this.document.createElement("div");O.appendChild((0,E.parseHTML)(this.document,h)),O.querySelectorAll('span[data-state="closed"]').forEach((M=>M.remove())),h=(0,E.serializeHTML)(O),h=h.replace(/<p[^>]*>\s*<\/p>/g,""),A.push({author:m,content:h.trim(),metadata:{role:v||"unknown"}})})),this.cachedMessages=A),A}getMessageContentElements(A){const a=".markdown, .whitespace-pre-wrap",s=[...A.matches(a)?[A]:[],...Array.from(A.querySelectorAll(a))];return s.filter((l=>!s.some((u=>u!==l&&u.contains(l)))))}getFootnotes(){return this.footnotes}getMetadata(){const A=this.getTitle(),a=this.extractMessages();return{title:A,site:"ChatGPT",url:this.url,messageCount:a.length,description:`ChatGPT conversation with ${a.length} messages`}}getTitle(){var A,a,s;const l=(A=this.document.title)===null||A===void 0?void 0:A.trim();if(l&&l!=="ChatGPT")return l;const u=(s=(a=this.turns)===null||a===void 0?void 0:a.item(0))===null||s===void 0?void 0:s.querySelector(".text-message");if(u){const m=u.textContent||"";return m.length>50?m.slice(0,50)+"...":m}return"ChatGPT Conversation"}}d.ChatGPTExtractor=b},8397(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.ClaudeExtractor=void 0;const _=g(5181),E=g(639);class b extends _.ConversationExtractor{constructor(A,a,s,l){super(A,a,s,l),this.articles=A.querySelectorAll('div[data-testid="user-message"], div[data-testid="assistant-message"], div.font-claude-response')}canExtract(){return!!this.articles&&this.articles.length>0}extractMessages(){const A=[];return this.articles&&this.articles.forEach((a=>{let s,l;if(a.hasAttribute("data-testid")){if(a.getAttribute("data-testid")!=="user-message")return;s="you",l=(0,E.serializeHTML)(a)}else{if(!a.classList.contains("font-claude-response"))return;{s="assistant";const u=a.querySelector(".standard-markdown")||a;l=(0,E.serializeHTML)(u)}}l&&(l=l.replace(/\u200B/g,"").replace(/<p[^>]*>\s*<\/p>/g,""),A.push({author:s==="you"?"You":"Claude",content:l.trim(),metadata:{role:s}}))})),A}getMetadata(){const A=this.getTitle(),a=this.extractMessages();return{title:A,site:"Claude",url:this.url,messageCount:a.length,description:`Claude conversation with ${a.length} messages`}}getTitle(){var A,a,s,l,u;const m=(A=this.document.title)===null||A===void 0?void 0:A.trim();if(m&&m!=="Claude")return m.replace(/ - Claude$/,"");const x=(s=(a=this.document.querySelector("header .font-tiempos"))===null||a===void 0?void 0:a.textContent)===null||s===void 0?void 0:s.trim();if(x)return x;const f=(u=(l=this.articles)===null||l===void 0?void 0:l.item(0))===null||u===void 0?void 0:u.querySelector('[data-testid="user-message"]');if(f){const v=f.textContent||"";return v.length>50?v.slice(0,50)+"...":v}return"Claude Conversation"}}d.ClaudeExtractor=b},4454(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.DiscourseExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){var m;super(a,s,l,u);const x=((m=a.querySelector('meta[name="generator"]'))===null||m===void 0?void 0:m.getAttribute("content"))||"";this.isDiscourse=x.startsWith("Discourse")}canExtract(){return this.isDiscourse&&!!this.document.querySelector(".topic-post")}extract(){var a,s,l,u;const m=this.getTopicTitle(),x=((a=this.document.querySelector('meta[property="og:site_name"]'))===null||a===void 0?void 0:a.getAttribute("content"))||"",f=((l=(s=this.document.querySelector(".badge-category__name"))===null||s===void 0?void 0:s.textContent)===null||l===void 0?void 0:l.trim())||"",v=this.getTags(),p=this.getPublishedDate(),h=Array.from(this.document.querySelectorAll(".topic-post")),w=h.find((y=>y.classList.contains("topic-owner"))),O=w?this.extractPostContent(w):"",M=w?this.getAuthor(w):"",$=h.filter((y=>y!==w)),T=this.options.includeReplies!==!1?this.extractComments($):"",D=(0,b.buildContentHtml)("discourse",O,T),R=M||this.getAuthor(h[0]),S=w?this.getPostText(w).slice(0,140).replace(/\s+/g," "):"";return{content:D,contentHtml:D,extractedContent:{topicId:((u=this.document.querySelector("h1[data-topic-id]"))===null||u===void 0?void 0:u.getAttribute("data-topic-id"))||"",category:f,tags:v.join(", ")},variables:Object.assign({title:m,author:R,site:x||"Discourse",description:S},p&&{published:p})}}getTopicTitle(){var a,s;const l=this.document.querySelector(".fancy-title");if(l)return((a=l.textContent)===null||a===void 0?void 0:a.trim())||"";const u=this.document.querySelector("h1[data-topic-id]");if(u){const m=u.cloneNode(!0);return m.querySelectorAll("svg, .topic-statuses").forEach((x=>x.remove())),((s=m.textContent)===null||s===void 0?void 0:s.trim())||""}return""}getTags(){return Array.from(this.document.querySelectorAll("a.discourse-tag")).map((a=>{var s;return a.getAttribute("data-tag-name")||((s=a.textContent)===null||s===void 0?void 0:s.trim())||""})).filter((a=>a))}getPublishedDate(){const a=this.document.querySelector('meta[property="article:published_time"]');if(a){const s=a.getAttribute("content")||"";try{return new Date(s).toISOString().split("T")[0]}catch{}}return""}getAuthor(a){var s;const l=a.querySelector(".names a[data-user-card]");return(l==null?void 0:l.getAttribute("data-user-card"))||((s=l==null?void 0:l.textContent)===null||s===void 0?void 0:s.trim())||""}getPostDate(a){const s=a.querySelector(".relative-date[data-time]");if(!s)return"";const l=parseInt(s.getAttribute("data-time")||"0");if(!l)return"";try{return new Date(l).toISOString().split("T")[0]}catch{return""}}getPostPermalink(a){const s=a.querySelector("a.post-date[href]");if(!s)return"";const l=s.getAttribute("href")||"";if(!l)return"";try{return`${new URL(this.url).origin}${l}`}catch{return l}}getLikeCount(a){var s;const l=a.querySelector("button.like-count"),u=((s=l==null?void 0:l.textContent)===null||s===void 0?void 0:s.trim())||"";return u?`${u} likes`:""}getPostText(a){var s;const l=a.querySelector(".cooked");return l&&((s=l.textContent)===null||s===void 0?void 0:s.trim())||""}extractPostContent(a){const s=a.querySelector(".cooked");if(!s)return"";const l=s.cloneNode(!0);return l.querySelectorAll(".cooked-selection-barrier").forEach((u=>u.remove())),l.querySelectorAll("a.anchor").forEach((u=>u.remove())),(0,E.serializeHTML)(l)}extractComments(a){if(a.length===0)return"";const s=a.map((l=>{const u=this.getAuthor(l),m=this.extractPostContent(l),x=this.getPostDate(l),f=this.getPostPermalink(l);return{author:u,date:x,content:m,depth:0,score:this.getLikeCount(l)||void 0,url:f||void 0}}));return(0,b.buildCommentTree)(s)}}d.DiscourseExtractor=C},4732(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.GeminiExtractor=void 0;const _=g(5181),E=g(639);class b extends _.ConversationExtractor{constructor(A,a,s,l){super(A,a,s,l),this.messageCount=null,this.conversationContainers=A.querySelectorAll("div.conversation-container"),this.footnotes=[]}canExtract(){return!!this.conversationContainers&&this.conversationContainers.length>0}extractMessages(){this.messageCount=0;const A=[];return this.conversationContainers&&(this.extractSources(),this.conversationContainers.forEach((a=>{const s=a.querySelector("user-query");if(s){const u=s.querySelector(".query-text");if(u){const m=(0,E.serializeHTML)(u);A.push({author:"You",content:m.trim(),metadata:{role:"user"}})}}const l=a.querySelector("model-response");if(l){const u=l.querySelector(".model-response-text .markdown"),m=l.querySelector("#extended-response-markdown-content")||u;if(m){let x=(0,E.serializeHTML)(m);const f=this.document.createElement("div");f.appendChild((0,E.parseHTML)(this.document,x)),f.querySelectorAll(".table-content").forEach((v=>{v.classList.remove("table-content")})),x=(0,E.serializeHTML)(f),A.push({author:"Gemini",content:x.trim(),metadata:{role:"assistant"}})}}})),this.messageCount=A.length),A}extractSources(){const A=this.document.querySelectorAll("browse-item");A&&A.length>0&&A.forEach((a=>{var s,l,u,m;const x=a.querySelector("a");if(x instanceof HTMLAnchorElement){const f=x.href,v=((l=(s=x.querySelector(".domain"))===null||s===void 0?void 0:s.textContent)===null||l===void 0?void 0:l.trim())||"",p=((m=(u=x.querySelector(".title"))===null||u===void 0?void 0:u.textContent)===null||m===void 0?void 0:m.trim())||"";f&&(v||p)&&this.footnotes.push({url:f,text:(0,E.escapeHtml)(p?`${v}: ${p}`:v)})}}))}getFootnotes(){return this.footnotes}getMetadata(){var A;const a=this.getTitle(),s=(A=this.messageCount)!==null&&A!==void 0?A:this.extractMessages().length;return{title:a,site:"Gemini",url:this.url,messageCount:s,description:`Gemini conversation with ${s} messages`}}getTitle(){var A,a,s,l,u;const m=(A=this.document.title)===null||A===void 0?void 0:A.trim();if(m&&m!=="Gemini"&&!m.includes("Gemini"))return m;const x=(s=(a=this.document.querySelector(".title-text"))===null||a===void 0?void 0:a.textContent)===null||s===void 0?void 0:s.trim();if(x)return x;const f=(u=(l=this.conversationContainers)===null||l===void 0?void 0:l.item(0))===null||u===void 0?void 0:u.querySelector(".query-text");if(f){const v=f.textContent||"";return v.length>50?v.slice(0,50)+"...":v}return"Gemini Conversation"}}d.GeminiExtractor=b},3588(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.GitHubExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){super(a,s,l,u),this.isIssue=/\/issues\/\d+/.test(s),this.isPR=/\/pull\/\d+/.test(s)}canExtract(){return!!['meta[name="expected-hostname"][content="github.com"]','meta[name="octolytics-url"]','meta[name="github-keyboard-shortcuts"]',".js-header-wrapper","#js-repo-pjax-container"].some((a=>this.document.querySelector(a)!==null))&&(this.isIssue?['[data-testid="issue-metadata-sticky"]','[data-testid="issue-title"]'].some((a=>this.document.querySelector(a)!==null)):!!this.isPR&&[".pull-discussion-timeline",".discussion-timeline",".gh-header-title",".js-issue-title"].some((a=>this.document.querySelector(a)!==null)))}extract(){const a=this.extractRepoInfo(),s=this.extractNumber(),l=this.isPR?"pull":"issue",u=this.isPR?this.getPRBody():null,{content:m,author:x,published:f}=this.isPR?this.getPRContent(u):this.getIssueContent(),v=this.options.includeReplies!==!1?this.isPR?this.extractPRComments(u):this.extractComments():"",p=this.createContentHtml(m,v);return{content:p,contentHtml:p,extractedContent:{type:l,number:s,repository:a.repo,owner:a.owner},variables:{title:this.document.title,author:x,published:f,site:`GitHub - ${a.owner}/${a.repo}`,description:this.createDescription(p)}}}createContentHtml(a,s){return(0,b.buildContentHtml)("github",a,s)}getIssueContent(){const a=this.document.querySelector('[data-testid="issue-viewer-issue-container"]');if(!a)return{content:"",author:"",published:""};const s=this.extractAuthor(a,['a[data-testid="issue-body-header-author"]',".IssueBodyHeaderAuthor-module__authorLoginLink--_S7aT",".ActivityHeader-module__AuthorLink--iofTU",'a[href*="/users/"][data-hovercard-url*="/users/"]','a[aria-label*="profile"]']),l=a.querySelector("relative-time"),u=(l==null?void 0:l.getAttribute("datetime"))||"",m=a.querySelector('[data-testid="issue-body-viewer"] .markdown-body');return m?{content:this.cleanBodyContent(m),author:s,published:u}:{content:"",author:s,published:u}}extractComments(){const a=Array.from(this.document.querySelectorAll("[data-wrapper-timeline-id]")),s=new Set,l=[];for(const u of a){const m=u.querySelector(".react-issue-comment");if(!m)continue;const x=u.getAttribute("data-wrapper-timeline-id");if(!x||s.has(x))continue;s.add(x);const f=this.extractAuthor(m,[".ActivityHeader-module__AuthorLink--iofTU",'a[data-testid="avatar-link"]','a[href^="/"][data-hovercard-url*="/users/"]']),v=m.querySelector("relative-time"),p=(v==null?void 0:v.getAttribute("datetime"))||"",h=p?new Date(p).toISOString().split("T")[0]:"",w=m.querySelector(".markdown-body");if(!w)continue;const O=this.cleanBodyContent(w);O&&l.push({author:f,date:h,content:O})}return(0,b.buildCommentTree)(l)}getPRBody(){return this.document.querySelector('[id^="pullrequest-"]')||this.document.querySelector(".timeline-comment")}getPRContent(a){var s;const l=(a==null?void 0:a.querySelector(".comment-body.markdown-body"))||this.document.querySelector(".comment-body.markdown-body"),u=l?this.cleanBodyContent(l):"",m=(a==null?void 0:a.querySelector(".author"))||this.document.querySelector(".gh-header-meta .author"),x=((s=m==null?void 0:m.textContent)===null||s===void 0?void 0:s.trim())||"",f=a==null?void 0:a.querySelector("relative-time");return{content:u,author:x,published:(f==null?void 0:f.getAttribute("datetime"))||""}}extractPRComments(a){var s;const l=Array.from(this.document.querySelectorAll(".timeline-comment, .review-comment")),u=[];for(const m of l){if(a&&(m===a||a.contains(m)))continue;const x=m.querySelector(".author"),f=((s=x==null?void 0:x.textContent)===null||s===void 0?void 0:s.trim())||"",v=m.querySelector("relative-time"),p=(v==null?void 0:v.getAttribute("datetime"))||"",h=p?new Date(p).toISOString().split("T")[0]:"",w=m.querySelector(".comment-body.markdown-body");if(!w)continue;const O=this.cleanBodyContent(w);O&&u.push({author:f,date:h,content:O})}return(0,b.buildCommentTree)(u)}extractAuthor(a,s){for(const l of s){const u=a.querySelector(l);if(u){const m=u.getAttribute("href");if(m){if(m.startsWith("/"))return m.substring(1);if(m.includes("github.com/")){const x=m.match(/github\.com\/([^\/\?#]+)/);if(x&&x[1])return x[1]}}}}return"Unknown"}cleanBodyContent(a){const s=a.cloneNode(!0);return s.querySelectorAll('button, [data-testid*="button"], [data-testid*="menu"]').forEach((l=>l.remove())),s.querySelectorAll(".js-clipboard-copy, .zeroclipboard-container").forEach((l=>l.remove())),s.querySelectorAll('div.highlight[class*="highlight-source-"] pre, div.highlight pre').forEach((l=>{const u=l.parentElement;if(!u)return;const m=u.className.match(/highlight-source-(\w+)/),x=(m==null?void 0:m[1])||"",f=u.getAttribute("data-snippet-clipboard-copy-content")||l.textContent||"",v=this.document.createElement("code");x&&(v.setAttribute("class",`language-${x}`),v.setAttribute("data-lang",x)),v.textContent=f;const p=this.document.createElement("pre");p.appendChild(v),u.replaceWith(p)})),(0,E.serializeHTML)(s).trim()}extractNumber(){var a;const s=this.url.match(/\/(issues|pull)\/(\d+)/);if(s)return s[2];const l=this.document.querySelector("h1"),u=(a=l==null?void 0:l.textContent)===null||a===void 0?void 0:a.match(/#(\d+)/);return u?u[1]:""}extractRepoInfo(){const a=this.url.match(/github\.com\/([^\/]+)\/([^\/]+)/);if(a)return{owner:a[1],repo:a[2]};const s=this.document.title.match(/([^\/\s]+)\/([^\/\s]+)/);return s?{owner:s[1],repo:s[2]}:{owner:"",repo:""}}createDescription(a){var s;if(!a)return"";const l=this.document.createElement("div");return l.appendChild((0,E.parseHTML)(this.document,a)),((s=l.textContent)===null||s===void 0?void 0:s.trim().slice(0,140).replace(/\s+/g," "))||""}}d.GitHubExtractor=C},4501(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.GmailExtractor=void 0;const _=g(2279),E=g(639),b=g(2552),C=g(2640),A=g(6077);class a extends _.BaseExtractor{canExtract(){return!!this.document.querySelector(".adn.ads")}extract(){const l=this.extractMessages(),u=(this.options.includeReplies===!1?l.slice(0,1):l).map((v=>({author:v.author,date:v.date,content:v.content,depth:0}))),m=`<article data-defuddle><div class="gmail comments">${(0,A.buildCommentTree)(u)}</div></article>`,x=this.getSubject(),f=l[0];return{content:m,contentHtml:m,extractedContent:Object.assign({messageCount:l.length.toString()},f!=null&&f.email?{postAuthor:f.email}:{}),variables:{title:x,author:(f==null?void 0:f.author)||"",site:"Gmail",published:this.toIsoDate(f==null?void 0:f.date)||"",description:f!=null&&f.author?`Gmail thread from ${f.author} with ${l.length} messages`:`Gmail thread with ${l.length} messages`}}}extractMessages(){const l=[];return this.document.querySelectorAll(".adn.ads").forEach((u=>{var m,x,f;const v=u.querySelector(".gD"),p=((m=v==null?void 0:v.getAttribute("name"))===null||m===void 0?void 0:m.trim())||((x=v==null?void 0:v.textContent)===null||x===void 0?void 0:x.trim())||"Unknown",h=((f=v==null?void 0:v.getAttribute("email"))===null||f===void 0?void 0:f.trim())||"",w=this.getMessageBody(u);w&&l.push({author:p,email:h,date:this.getDate(u),content:w})})),l}getDate(l){var u,m;const x=l.querySelector(".g3");return((u=x==null?void 0:x.getAttribute("title"))===null||u===void 0?void 0:u.trim())||((m=x==null?void 0:x.textContent)===null||m===void 0?void 0:m.trim())||""}toIsoDate(l){if(!l)return"";const u=new Date(l);if(isNaN(u.getTime()))return"";const m=String(u.getMonth()+1).padStart(2,"0"),x=String(u.getDate()).padStart(2,"0");return`${u.getFullYear()}-${m}-${x}`}getMessageBody(l){const u=l.querySelector(".a3s");if(!u)return"";const m=u.cloneNode(!0);return m.querySelectorAll(a.REMOVE_SELECTORS).forEach((x=>x.remove())),a.stripPlainTextQuotes(m),a.trimTrailingBlanks(m),(0,E.serializeHTML)(m).trim()}static isBlank(l){var u;return(0,b.isElement)(l)?!(l.textContent||"").trim()&&!(!((u=l.matches)===null||u===void 0)&&u.call(l,a.MEDIA_SELECTOR)||l.querySelector(a.MEDIA_SELECTOR)):!(l.textContent||"").trim()}static trimTrailingBlanks(l){for(;l.lastChild&&a.isBlank(l.lastChild);)l.removeChild(l.lastChild);const u=l.lastChild;u&&(0,b.isElement)(u)&&a.trimTrailingBlanks(u)}static stripPlainTextQuotes(l){const u=[];let m=[];const x=()=>{u.push(m),m=[]},f=new Set;l.querySelectorAll("br").forEach((p=>{for(let h=p.parentNode;h&&h!==l&&!f.has(h);h=h.parentNode)f.add(h)}));const v=p=>{Array.from(p.childNodes).forEach((h=>{if(!(0,b.isElement)(h))return void m.push(h);const w=h.tagName.toLowerCase();w==="br"?(m.push(h),x()):a.INLINE_TAGS.has(w)?f.has(h)?v(h):m.push(h):(x(),v(h),x())}))};v(l),x(),u.forEach((p=>{const h=p.map((w=>w.textContent||"")).join("");/^\s*>/.test(h)&&p.forEach((w=>{var O;return(O=w.parentNode)===null||O===void 0?void 0:O.removeChild(w)}))}))}getSubject(){var l,u,m;const x=(u=(l=this.document.querySelector("h2.hP"))===null||l===void 0?void 0:l.textContent)===null||u===void 0?void 0:u.trim();return x||(((m=this.document.title)===null||m===void 0?void 0:m.trim())||"").replace(/ - [^-]+ - Gmail$/,"").trim()||"Gmail thread"}}d.GmailExtractor=a,a.REMOVE_SELECTORS=[".gmail_quote",".gmail_attr",".gmail_extra",'blockquote[type="cite"]',".moz-cite-prefix",'blockquote[style*="border-left"]',".yahoo_quoted",".a6S",".adL",".h5",".adm",".ajR",".ajT",".h4",".yj6qo"].join(", "),a.MEDIA_SELECTOR="img, picture, video, audio, iframe, svg, canvas, object, embed",a.INLINE_TAGS=new Set([...C.INLINE_ELEMENTS,"bdi","bdo","big","img","kbd","label","s","samp","strike","tt","var","wbr"])},3020(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.GrokExtractor=void 0;const _=g(5181),E=g(639);class b extends _.ConversationExtractor{constructor(A,a,s,l){super(A,a,s,l),this.messageContainerSelector=".relative.group.flex.flex-col.justify-center.w-full",this.messageBubbles=A.querySelectorAll(this.messageContainerSelector),this.footnotes=[],this.footnoteCounter=0}canExtract(){return!!this.messageBubbles&&this.messageBubbles.length>0}extractMessages(){const A=[];return this.footnotes=[],this.footnoteCounter=0,this.messageBubbles&&this.messageBubbles.length!==0&&this.messageBubbles.forEach((a=>{var s;const l=a.classList.contains("items-end"),u=a.classList.contains("items-start");if(!l&&!u)return;const m=a.querySelector(".message-bubble");if(!m)return;let x="",f="",v="";if(l)x=m.textContent||"",f="user",v="You";else if(u){f="assistant",v="Grok";const p=m.cloneNode(!0);(s=p.querySelector(".relative.border.border-border-l1.bg-surface-base"))===null||s===void 0||s.remove(),x=(0,E.serializeHTML)(p),x=this.processFootnotes(x)}x.trim()&&A.push({author:v,content:x.trim(),metadata:{role:f}})})),A}getFootnotes(){return this.footnotes}getMetadata(){var A;const a=this.getTitle(),s=((A=this.messageBubbles)===null||A===void 0?void 0:A.length)||0;return{title:a,site:"Grok",url:this.url,messageCount:s,description:`Grok conversation with ${s} messages`}}getTitle(){var A,a;const s=(A=this.document.title)===null||A===void 0?void 0:A.trim();if(s&&s!=="Grok"&&!s.startsWith("Grok by "))return s.replace(/\s-\s*Grok$/,"").trim();const l=this.document.querySelector(`${this.messageContainerSelector}.items-end`);if(l){const u=l.querySelector(".message-bubble");if(u){const m=((a=u.textContent)===null||a===void 0?void 0:a.trim())||"";return m.length>50?m.slice(0,50)+"...":m}}return"Grok Conversation"}processFootnotes(A){return A.replace(/<a\s+(?:[^>]*?\s+)?href="([^"]*)"[^>]*>(.*?)<\/a>/gi,((a,s,l)=>{if(!s||s.startsWith("#")||!s.match(/^https?:\/\//i))return a;let u;if(this.footnotes.find((m=>m.url===s)))u=this.footnotes.findIndex((m=>m.url===s))+1;else{this.footnoteCounter++,u=this.footnoteCounter;let m=s;try{const x=new URL(s).hostname.replace(/^www\./,"");m=`<a href="${(0,E.escapeHtml)(s)}" target="_blank" rel="noopener noreferrer">${(0,E.escapeHtml)(x)}</a>`}catch{m=`<a href="${(0,E.escapeHtml)(s)}" target="_blank" rel="noopener noreferrer">${(0,E.escapeHtml)(s)}</a>`,console.warn(`GrokExtractor: Could not parse URL for footnote: ${s}`)}this.footnotes.push({url:s,text:m})}return`${l}<sup id="fnref:${u}" class="footnote-ref"><a href="#fn:${u}" class="footnote-link">${u}</a></sup>`}))}}d.GrokExtractor=b},2458(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.HackerNewsExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){super(a,s,l,u),this.mainPost=a.querySelector(".fatitem"),this.isListingPage=this.detectListingPage(),this.isCommentPage=this.detectCommentPage(),this.mainComment=this.isCommentPage?this.findMainComment():null}detectListingPage(){return this.mainPost?!1:this.document.querySelectorAll("tr.athing").length>1}detectCommentPage(){var a,s;return!!(!((a=this.mainPost)===null||a===void 0)&&a.querySelector(".onstory"))&&!(!((s=this.mainPost)===null||s===void 0)&&s.querySelector(".titleline"))}findMainComment(){var a;return((a=this.mainPost)===null||a===void 0?void 0:a.querySelector("tr.athing"))||null}canExtract(){return!!this.mainPost||this.isListingPage}extract(){if(this.isListingPage)return this.extractListing();const a=this.getPostContent(),s=this.options.includeReplies!==!1?this.extractComments():"",l=this.createContentHtml(a,s),u=this.getPostTitle(),m=this.getPostAuthor(),x=this.createDescription(),f=this.getPostDate();return{content:l,contentHtml:l,extractedContent:{postId:this.getPostId(),postAuthor:m},variables:{title:u,author:m,site:"Hacker News",description:x,published:f}}}getMoreLink(){var a;const s=this.document.querySelector(".morelink");return s?{url:s.getAttribute("href")||"",text:((a=s.textContent)===null||a===void 0?void 0:a.trim())||"More"}:null}extractListing(){var a;const s=this.extractStories(),l=this.getMoreLink(),u=this.buildListingHtml(s,l);return{content:u,contentHtml:u,extractedContent:{},variables:{title:((a=this.document.title)===null||a===void 0?void 0:a.replace(/\s*\|\s*Hacker News$/,"").trim())||"Hacker News",site:"Hacker News"}}}extractStories(){var a,s,l,u,m,x,f,v;const p=Array.from(this.document.querySelectorAll("tr.athing")),h=[];for(const w of p){const O=w.getAttribute("id")||"",M=w.querySelector(".titleline a");if(!M)continue;const $=((a=M.textContent)===null||a===void 0?void 0:a.trim())||"",T=M.getAttribute("href")||"",D=((l=(s=w.querySelector(".sitestr"))===null||s===void 0?void 0:s.textContent)===null||l===void 0?void 0:l.trim())||"",R=w.nextElementSibling,S=((m=(u=R==null?void 0:R.querySelector(".score"))===null||u===void 0?void 0:u.textContent)===null||m===void 0?void 0:m.trim())||"",y=((f=(x=R==null?void 0:R.querySelector(".hnuser"))===null||x===void 0?void 0:x.textContent)===null||f===void 0?void 0:f.trim())||"",k=R==null?void 0:R.querySelector(".age"),N=((k==null?void 0:k.getAttribute("title"))||"").split("T")[0]||"",L=R?Array.from(R.querySelectorAll("td.subtext a")):[],P=L[L.length-1],B=((v=P==null?void 0:P.textContent)===null||v===void 0?void 0:v.replace(/\u00a0/g," ").trim())||"",U=/\d+\s*comment/.test(B)?B:"",F=O?`https://news.ycombinator.com/item?id=${O}`:"";h.push({id:O,title:$,url:T,site:D,score:S,author:y,date:N,comments:U,commentsUrl:F})}return h}buildListingHtml(a,s){if(a.length===0)return"";let u=`<ol>${a.map((m=>{let x="<li>";x+=`<a href="${(0,E.escapeHtml)(m.url)}">${(0,E.escapeHtml)(m.title)}</a>`,m.site&&(x+=` <small>(${(0,E.escapeHtml)(m.site)})</small>`);const f=[];return m.score&&f.push((0,E.escapeHtml)(m.score)),m.author&&f.push(`by ${(0,E.escapeHtml)(m.author)}`),m.comments&&f.push(`<a href="${(0,E.escapeHtml)(m.commentsUrl)}">${(0,E.escapeHtml)(m.comments)}</a>`),f.length>0&&(x+=`<br><small>${f.join(" · ")}</small>`),x+="</li>",x})).join("")}</ol>`;return s&&(u+=`<p><a href="${(0,E.escapeHtml)(s.url)}">${(0,E.escapeHtml)(s.text)}</a></p>`),u}createContentHtml(a,s){return(0,b.buildContentHtml)("hackernews",a,s)}getPostContent(){var a,s,l,u;if(!this.mainPost)return"";if(this.isCommentPage&&this.mainComment){const p=((a=this.mainComment.querySelector(".hnuser"))===null||a===void 0?void 0:a.textContent)||"[deleted]",h=this.mainComment.querySelector(".commtext"),w=h?(0,E.serializeHTML)(h):"",O=this.mainComment.querySelector(".age"),M=((O==null?void 0:O.getAttribute("title"))||"").split("T")[0]||"",$=((l=(s=this.mainComment.querySelector(".score"))===null||s===void 0?void 0:s.textContent)===null||l===void 0?void 0:l.trim())||"";return(0,b.buildComment)({author:p,date:M,content:w,score:$||void 0})}const m=this.mainPost.querySelector("tr.athing"),x=((u=m==null?void 0:m.querySelector(".titleline a"))===null||u===void 0?void 0:u.getAttribute("href"))||"";let f="";x&&(f+=`<p><a href="${x}" target="_blank">${x}</a></p>`);const v=this.mainPost.querySelector(".toptext");return v&&(f+=`<div class="post-text">${(0,E.serializeHTML)(v)}</div>`),f}extractComments(){const a=Array.from(this.document.querySelectorAll("tr.comtr"));return this.processComments(a)}processComments(a){var s,l,u,m;const x=[],f=new Set;for(const v of a){const p=v.getAttribute("id");if(!p||f.has(p))continue;f.add(p);const h=((s=v.querySelector(".ind img"))===null||s===void 0?void 0:s.getAttribute("width"))||"0",w=parseInt(h)/40,O=v.querySelector(".commtext"),M=((l=v.querySelector(".hnuser"))===null||l===void 0?void 0:l.textContent)||"[deleted]",$=v.querySelector(".age"),T=((m=(u=v.querySelector(".score"))===null||u===void 0?void 0:u.textContent)===null||m===void 0?void 0:m.trim())||"";if(!O)continue;const D=`https://news.ycombinator.com/item?id=${p}`,R=(($==null?void 0:$.getAttribute("title"))||"").split("T")[0]||"";x.push({author:M,date:R,content:(0,E.serializeHTML)(O),depth:w,score:T||void 0,url:D})}return(0,b.buildCommentTree)(x)}getPostId(){const a=this.url.match(/id=(\d+)/);return(a==null?void 0:a[1])||""}getPostTitle(){var a,s,l,u,m;if(this.isCommentPage&&this.mainComment){const x=((a=this.mainComment.querySelector(".hnuser"))===null||a===void 0?void 0:a.textContent)||"[deleted]",f=((s=this.mainComment.querySelector(".commtext"))===null||s===void 0?void 0:s.textContent)||"";return`Comment by ${x}: ${f.trim().slice(0,50)+(f.length>50?"...":"")}`}return((m=(u=(l=this.mainPost)===null||l===void 0?void 0:l.querySelector(".titleline"))===null||u===void 0?void 0:u.textContent)===null||m===void 0?void 0:m.trim())||""}getPostAuthor(){var a,s,l;return((l=(s=(a=this.mainPost)===null||a===void 0?void 0:a.querySelector(".hnuser"))===null||s===void 0?void 0:s.textContent)===null||l===void 0?void 0:l.trim())||""}createDescription(){const a=this.getPostTitle(),s=this.getPostAuthor();return this.isCommentPage?`Comment by ${s} on Hacker News`:`${a} - by ${s} on Hacker News`}getPostDate(){if(!this.mainPost)return"";const a=this.mainPost.querySelector(".age");return((a==null?void 0:a.getAttribute("title"))||"").split("T")[0]||""}}d.HackerNewsExtractor=C},7228(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.LeetCodeExtractor=void 0;const _=g(2279);class E extends _.BaseExtractor{canExtract(){return this.document.querySelector('[data-track-load="description_content"]')!==null}extract(){var C;const A=((C=this.document.querySelector('meta[property="og:title"]'))===null||C===void 0?void 0:C.getAttribute("content"))||"";return{content:"",contentHtml:"",contentSelector:'[data-track-load="description_content"]',variables:{title:A.replace(/\s*[-\u2013\u2014]\s*LeetCode\s*$/,"")||A,site:"LeetCode"}}}}d.LeetCodeExtractor=E},8477(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.LinkedInExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){super(a,s,l,u),this.postArticle=a.querySelector('[role="article"].feed-shared-update-v2')}canExtract(){return!!this.postArticle}extract(){var a;const s=this.getPostContent(),l=this.options.includeReplies!==!1?this.extractComments():"",u=(0,b.buildContentHtml)("linkedin",s,l),m=this.getAuthorName(),x=this.createDescription();return{content:u,contentHtml:u,extractedContent:{postUrn:((a=this.postArticle)===null||a===void 0?void 0:a.getAttribute("data-urn"))||""},variables:{title:this.postTitle(m,"LinkedIn"),author:m,site:"LinkedIn",description:x}}}getPostContent(){if(!this.postArticle)return"";const a=this.postArticle.querySelector(".feed-shared-update-v2__update-content-wrapper"),s=this.postArticle.querySelector(".update-components-text.update-components-update-v2__commentary"),l=!s||a&&a.contains(s)?"":this.cleanTextContent(s),u=this.extractImages(),m=this.extractVideo(),x=this.extractQuotedPost(a);let f="";return l&&(f+=l),u&&(f+=`
|
|
352
|
+
${u}`),m&&(f+=`
|
|
353
|
+
${m}`),x&&(f+=`
|
|
354
|
+
${x}`),f}getVisibleText(a,s){var l;const u=a.cloneNode(!0),m=s?`.visually-hidden, ${s}`:".visually-hidden";return u.querySelectorAll(m).forEach((x=>x.remove())),((l=u.textContent)===null||l===void 0?void 0:l.trim())||""}cleanTextContent(a){const s=a.cloneNode(!0);s.querySelectorAll(".visually-hidden, .feed-shared-inline-show-more-text__see-more-less-toggle").forEach((u=>u.remove())),s.querySelectorAll("a").forEach((u=>{var m;const x=u.getAttribute("href")||"",f=((m=u.textContent)===null||m===void 0?void 0:m.trim())||"";if(x&&f){const v=this.document.createElement("a");v.setAttribute("href",x),v.textContent=f,u.replaceWith(v)}else u.replaceWith(u.textContent||"")})),s.querySelectorAll("span, div").forEach((u=>{u.replaceWith(...Array.from(u.childNodes))}));let l=(0,E.serializeHTML)(s).trim();return l=l.replace(/<!--.*?-->/g,""),l.split(/(?:<br\s*\/?>\s*){2,}|\n{2,}/).map((u=>u.replace(/<br\s*\/?>/g," ").replace(/\s+/g," ").trim())).filter((u=>u)).map((u=>`<p>${u}</p>`)).join(`
|
|
355
|
+
`)}extractQuotedPost(a){var s;if(!a)return"";const l=a.querySelector(".update-components-actor__title"),u=l?this.getVisibleText(l,".update-components-actor__supplementary-actor-info, .text-view-model__verified-icon"):"",m=a.querySelector(".update-components-actor__sub-description");let x="";if(m){const O=(((s=(m.querySelector('[aria-hidden="true"]')||m).textContent)===null||s===void 0?void 0:s.trim())||"").match(/^(\d+\w+)/);x=O?O[1]:""}const f=a.querySelector(".update-components-text.update-components-update-v2__commentary"),v=f?this.cleanTextContent(f):"",p=a.querySelector("a.update-components-mini-update-v2__link-to-details-page"),h=(p==null?void 0:p.getAttribute("href"))||"",w=h?(h.startsWith("http")?h:`https://www.linkedin.com${h}`).split("?")[0]:"";return(0,b.buildQuotedPost)({author:u||void 0,date:x||void 0,content:v,url:w||void 0})}extractImages(){if(!this.postArticle)return"";const a=[];return this.postArticle.querySelectorAll(".update-components-image img, .feed-shared-image img").forEach((s=>{const l=s.getAttribute("src")||"",u=s.getAttribute("alt")||"";!l||l.includes("profile-displayphoto")||l.includes("avm-avatar")||a.push(`<img src="${(0,E.escapeHtml)(l)}" alt="${(0,E.escapeHtml)(u)}" />`)})),a.join(`
|
|
356
|
+
`)}extractVideo(){if(!this.postArticle)return"";const a=this.postArticle.querySelector(".update-components-linkedin-video video[poster]");if(!a)return"";const s=a.getAttribute("poster")||"";return`<img src="${(0,E.escapeHtml)(s)}" alt="Video thumbnail" />`}extractComments(){if(!this.postArticle)return"";const a=[],s=this.postArticle.querySelectorAll("article.comments-comment-entity:not(.comments-comment-entity--reply)");for(const l of Array.from(s)){const u=this.extractCommentData(l,0);u&&a.push(u);const m=l.querySelectorAll(".comments-replies-list article.comments-comment-entity--reply");for(const x of Array.from(m)){const f=this.extractCommentData(x,1);f&&a.push(f)}}return a.length>0?(0,b.buildCommentTree)(a):""}extractCommentData(a,s){var l,u,m,x,f;const v=((u=(l=a.querySelector(".comments-comment-meta__description-title"))===null||l===void 0?void 0:l.textContent)===null||u===void 0?void 0:u.trim())||"";if(!v)return null;const p=a.querySelector(".comments-comment-entity__content .update-components-text"),h=p?this.cleanTextContent(p):"",w=a.querySelector("time.comments-comment-meta__data"),O=((m=w==null?void 0:w.textContent)===null||m===void 0?void 0:m.trim())||"",M=a.querySelector("a.comments-comment-meta__description-container"),$=((x=M==null?void 0:M.getAttribute("href"))===null||x===void 0?void 0:x.split("?")[0])||"";let T="";$&&(T=$.startsWith("http")?$:`https://www.linkedin.com${$}`);const D=a.querySelector(".comments-comment-social-bar__reactions-count--cr span.v-align-middle"),R=((f=D==null?void 0:D.textContent)===null||f===void 0?void 0:f.trim())||"";return{author:v,date:O,content:h,depth:s,score:R?`${R} reactions`:void 0,url:T||void 0}}getAuthorName(){if(!this.postArticle)return"";const a=this.postArticle.querySelector(".update-components-actor__title");return a?this.getVisibleText(a,".text-view-model__verified-icon, .update-components-actor__supplementary-actor-info"):""}createDescription(){if(!this.postArticle)return"";const a=this.postArticle.querySelector(".feed-shared-update-v2__update-content-wrapper"),s=this.postArticle.querySelector(".update-components-text.update-components-update-v2__commentary");return!s||a&&a.contains(s)?"":this.getVisibleText(s).slice(0,140).replace(/\s+/g," ")}}d.LinkedInExtractor=C},7278(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.LwnExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{canExtract(){return!!this.document.querySelector(".PageHeadline")&&!!this.document.querySelector(".ArticleText")}extract(){var a,s,l,u,m,x;const f=this.document.querySelector(".ArticleText main"),v=f?this.getArticleContent(f):"",p=this.options.includeReplies!==!1&&f?this.extractComments(f):"",h=(0,b.buildContentHtml)("lwn",v,p),w=((s=(a=this.document.querySelector(".Byline"))===null||a===void 0?void 0:a.textContent)===null||s===void 0?void 0:s.trim())||"";return{content:h,contentHtml:h,extractedContent:{},variables:{title:((u=(l=this.document.querySelector(".PageHeadline h1"))===null||l===void 0?void 0:l.textContent)===null||u===void 0?void 0:u.trim())||"",author:((m=w.match(/by\s+(\w+)/i))===null||m===void 0?void 0:m[1])||"",site:"LWN.net",published:this.parseDate(w),description:((x=this.document.querySelector('meta[property="og:description"]'))===null||x===void 0?void 0:x.getAttribute("content"))||""}}}parseDate(a){const s=a.match(/Posted\s+(\w+\s+\d+,\s+\d{4})/);if(!s)return"";const l=new Date(s[1]);return isNaN(l.getTime())?"":l.toISOString().split("T")[0]}getArticleContent(a){const s=a.cloneNode(!0);for(const u of Array.from(s.querySelectorAll('details.CommentBox, form, a[name^="Comm"]')))u.remove();let l=s.lastElementChild;for(;l&&(l.tagName==="HR"||l.tagName==="BR"&&l.getAttribute("clear"));){const u=l.previousElementSibling;l.remove(),l=u}return(0,E.serializeHTML)(s)}extractComments(a){const s=Array.from(a.querySelectorAll("details.CommentBox")),l=[];for(const u of s){const m=this.getCommentDepth(u,a),x=this.extractCommentData(u,m);x&&l.push(x)}return l.length>0?(0,b.buildCommentTree)(l):""}getCommentDepth(a,s){let l=0,u=a.parentElement;for(;u&&u!==s;)u.tagName==="DETAILS"&&u.classList.contains("CommentBox")&&l++,u=u.parentElement;return l}extractCommentData(a,s){var l,u,m,x,f,v,p;const h=a.querySelector(":scope > summary .CommentPoster");if(!h)return null;const w=((u=(l=h.querySelector("b"))===null||l===void 0?void 0:l.textContent)===null||u===void 0?void 0:u.trim())||"",O=h.querySelector('a[href^="/Articles/"]'),M=(O==null?void 0:O.getAttribute("href"))||"",$=M?`https://lwn.net${M}`:"",T=this.parseDate(h.textContent||""),D=((x=(m=a.querySelector(":scope > summary h3.CommentTitle"))===null||m===void 0?void 0:m.textContent)===null||x===void 0?void 0:x.trim())||"",R=(f=a.parentElement)===null||f===void 0?void 0:f.closest("details.CommentBox"),S=((p=(v=R==null?void 0:R.querySelector(":scope > summary h3.CommentTitle"))===null||v===void 0?void 0:v.textContent)===null||p===void 0?void 0:p.trim())||"",y=D&&D!==S?D:"";return{author:w,date:T,content:this.getCommentContent(a,y),depth:s,url:$}}getCommentContent(a,s){var l,u;let m="";s&&(m+=`<p><strong>${(0,E.escapeHtml)(s)}</strong></p>`);const x=a.querySelector(":scope > .FormattedComment");if(x)m+=(0,E.serializeHTML)(x);else{const f=this.document.createElement("div");for(const p of Array.from(a.childNodes)){if(p.nodeType===1){const h=p,w=h.tagName;if(w==="SUMMARY"||w==="DETAILS"||h.classList.contains("CommentReplyButton")||w==="FORM"||w==="A"&&(!((l=h.getAttribute("name"))===null||l===void 0)&&l.startsWith("CommAnchor"))||w==="P"&&!(!((u=h.textContent)===null||u===void 0)&&u.trim()))continue}f.appendChild(p.cloneNode(!0))}const v=(0,E.serializeHTML)(f).trim();v&&(m+=v)}return m}}d.LwnExtractor=C},9964(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.MastodonExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){super(a,s,l,u),this.mainPost=null,this.replyStatuses=[],this.mainPost=a.querySelector(".detailed-status__wrapper");const m=Array.from(a.querySelectorAll(".status__wrapper"));this.replyStatuses=m.filter((x=>!!x.querySelector(".status[data-id]")))}canExtract(){if(!this.mainPost)return!1;if(this.document.getElementById("mastodon"))return!0;const a=this.document.querySelector("script#initial-state");if(a){const s=a.textContent||"";if(s.includes("mastodon/mastodon")||s.includes('"mastodon"'))return!0}return Array.from(this.document.querySelectorAll('link[rel="stylesheet"]')).some((s=>(s.getAttribute("href")||"").includes("mastodon")))}extract(){var a;const s=this.getFullHandle(this.mainPost),l=s.split("@")[0],u=this.getDisplayName(this.mainPost),m=[],x=[];let f=!1;for(const D of this.replyStatuses){const R=this.getFullHandle(D).split("@")[0];f||R!==l?(f=!0,x.push(D)):m.push(D)}const v=[this.extractPostContent(this.mainPost),...m.map((D=>this.extractPostContent(D)))].filter(Boolean).join(`
|
|
357
|
+
<hr>
|
|
358
|
+
`),p=this.options.includeReplies!==!1?this.extractComments(x):"",h=(0,b.buildContentHtml)("mastodon",v,p),w=u||`@${s}`,O=this.getDescription(),M=this.getPublishedDate(),$=((a=this.document.querySelector('meta[property="og:site_name"]'))===null||a===void 0?void 0:a.getAttribute("content"))||"",T=this.postTitle(w,$||"Mastodon");return{content:h,contentHtml:h,extractedContent:{postAuthor:s},variables:Object.assign({title:T,author:w,site:$||"Mastodon",description:O},M&&{published:M})}}getFullHandle(a){var s;const l=a.querySelector(".display-name__account");return(((s=l==null?void 0:l.textContent)===null||s===void 0?void 0:s.trim())||"").replace(/^@/,"")}getDisplayName(a){var s;const l=a.querySelector(".display-name__html");if(!l)return"";const u=l.cloneNode(!0);return this.replaceEmojiImages(u),((s=u.textContent)===null||s===void 0?void 0:s.trim())||""}getReplyDate(a){const s=a.querySelector("time[datetime]");if(!s)return"";const l=s.getAttribute("datetime")||"";try{return new Date(l).toISOString().split("T")[0]}catch{return""}}getReplyPermalink(a){const s=a.querySelector("a.status__relative-time[href]");if(!s)return"";const l=s.getAttribute("href")||"";if(!l)return"";try{const u=new URL(this.url);return l.startsWith("http")?l:`${u.origin}${l}`}catch{return l}}getPublishedDate(){const a=this.document.querySelector('meta[property="og:published_time"]');if(a){const s=a.getAttribute("content")||"";try{return new Date(s).toISOString().split("T")[0]}catch{}}if(this.mainPost){const s=this.mainPost.querySelector("time[datetime]");if(s)try{return new Date(s.getAttribute("datetime")||"").toISOString().split("T")[0]}catch{}}return""}getDescription(){if(!this.mainPost)return"";const a=this.mainPost.querySelector(".status__content__text");return a?(a.textContent||"").trim().slice(0,140).replace(/\s+/g," "):""}extractPostContent(a){const s=[],l=this.extractTextContent(a.querySelector(".status__content"));l&&s.push(l);const u=this.extractImages(a);u&&s.push(u);const m=this.extractLinkCard(a);return m&&s.push(m),s.join(`
|
|
359
|
+
`)}extractTextContent(a){if(!a)return"";const s=a.querySelector(".status__content__text");if(!s)return"";const l=s.cloneNode(!0);return this.replaceEmojiImages(l),l.querySelectorAll("span.invisible").forEach((u=>u.remove())),l.querySelectorAll("span").forEach((u=>{u.replaceWith(...Array.from(u.childNodes))})),(l.innerHTML||l.textContent||"").trim()}replaceEmojiImages(a){a.querySelectorAll("img.emojione").forEach((s=>{const l=s.getAttribute("alt")||"";l?s.replaceWith(s.ownerDocument.createTextNode(l)):s.remove()}))}extractImages(a){const s=a.querySelector(".media-gallery");if(!s)return"";const l=[];return s.querySelectorAll(".media-gallery__item-thumbnail").forEach((u=>{const m=u.getAttribute("href")||"",x=u.querySelector("img"),f=(x==null?void 0:x.getAttribute("alt"))||"";m&&l.push(`<img src="${(0,E.escapeHtml)(m)}" alt="${(0,E.escapeHtml)(f)}" />`)})),l.join(`
|
|
360
|
+
`)}extractLinkCard(a){var s,l,u,m;const x=a.querySelector("a.status-card[href]");if(!x)return"";const f=x.getAttribute("href")||"",v=((l=(s=x.querySelector(".status-card__title"))===null||s===void 0?void 0:s.textContent)===null||l===void 0?void 0:l.trim())||"",p=((m=(u=x.querySelector(".status-card__description"))===null||u===void 0?void 0:u.textContent)===null||m===void 0?void 0:m.trim())||"",h=x.querySelector(".status-card__image-image");if(!v&&!f)return"";let w="";if(h){const O=h.getAttribute("src")||"";O&&(w+=`<a href="${(0,E.escapeHtml)(f)}"><img src="${(0,E.escapeHtml)(O)}" alt="${(0,E.escapeHtml)(v)}" /></a>
|
|
361
|
+
`)}return w+=`<p><a href="${(0,E.escapeHtml)(f)}">${(0,E.escapeHtml)(v||f)}</a></p>`,p&&(w+=`
|
|
362
|
+
<p>${(0,E.escapeHtml)(p)}</p>`),w}extractComments(a){if(a.length===0)return"";let s=0;const l=a.map(((u,m)=>{const x=this.getFullHandle(u),f=this.getDisplayName(u),v=this.extractPostContent(u),p=this.getReplyDate(u),h=this.getReplyPermalink(u);return u.querySelector(".status--first-in-thread")||m===0?s=0:s++,{author:f?`${f} @${x}`:`@${x}`,date:p,content:v,depth:s,url:h||void 0}}));return(0,b.buildCommentTree)(l)}}d.MastodonExtractor=C},1756(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.MediumExtractor=void 0;const _=g(2279);class E extends _.BaseExtractor{constructor(C,A,a,s){super(C,A,a,s),this.article=C.querySelector("article.meteredContent")||C.querySelector("article")}canExtract(){var C,A,a;if(!this.article)return!1;if(!((C=this.article.classList)===null||C===void 0)&&C.contains("meteredContent"))return!0;const s=((A=this.document.querySelector('meta[property="og:site_name"]'))===null||A===void 0?void 0:A.getAttribute("content"))||"",l=((a=this.document.querySelector('meta[property="al:android:app_name"]'))===null||a===void 0?void 0:a.getAttribute("content"))||"";return s==="Medium"||l==="Medium"}extract(){const C=this.getTitle(),A=this.getSubtitle(),a=this.getAuthor(),s=this.getPublication();return this.cleanArticle(),{content:"",contentHtml:"",contentSelector:"article",extractedContent:{publication:s},variables:{title:C,author:a,site:s||"Medium",description:A||this.getDescription()}}}cleanArticle(){if(!this.article)return;this.article.querySelectorAll('figure [role="button"]').forEach((A=>{A.replaceWith(...Array.from(A.childNodes))})),this.article.querySelectorAll('[role="tooltip"]').forEach((A=>{A.removeAttribute("role")})),this.article.querySelectorAll('a[href*="medium.com/plans"]').forEach((A=>{const a=A.closest("div");a&&a!==this.article?a.remove():A.remove()})),this.article.querySelectorAll('[data-testid="post-preview"]').forEach((A=>A.remove())),this.article.querySelectorAll('[data-testid*="Clap"], [data-testid*="Bookmark"], [data-testid*="Share"], [data-testid*="Response"]').forEach((A=>A.remove())),this.article.querySelectorAll('[data-testid="authorPhoto"], [data-testid="authorName"], [data-testid="storyReadTime"]').forEach((A=>A.remove()));const C=new Set(["Member-only story","Listen","Share","Top highlight","·","Press enter or click to view image in full size"]);this.article.querySelectorAll("p, span, div").forEach((A=>{var a;const s=((a=A.textContent)===null||a===void 0?void 0:a.trim())||"";s&&(C.has(s)||/^\w{3}\s+\d{1,2},\s+\d{4}/.test(s)&&s.length<30||/^\xb7\s*\d+\s*\w+\s*ago$/.test(s)||/^\xb7?\s*\d+\s*min\s*read$/.test(s))&&A.remove()}))}getTitle(){var C,A,a,s;const l=this.document.querySelector('[data-testid="storyTitle"]');return l?((C=l.textContent)===null||C===void 0?void 0:C.trim())||"":((s=(a=(A=this.article)===null||A===void 0?void 0:A.querySelector("h1"))===null||a===void 0?void 0:a.textContent)===null||s===void 0?void 0:s.trim())||""}getSubtitle(){var C,A;return((A=(C=this.document.querySelector(".pw-subtitle-paragraph"))===null||C===void 0?void 0:C.textContent)===null||A===void 0?void 0:A.trim())||""}getAuthor(){var C,A;return((A=(C=this.document.querySelector('[data-testid="authorName"]'))===null||C===void 0?void 0:C.textContent)===null||A===void 0?void 0:A.trim())||""}getPublication(){var C;const A=this.document.querySelector('meta[property="og:site_name"]'),a=(A==null?void 0:A.getAttribute("content"))||"";if(a&&a!=="Medium")return a;const s=Array.isArray(this.schemaOrgData)?this.schemaOrgData:[this.schemaOrgData];for(const l of s)if(!((C=l==null?void 0:l.publisher)===null||C===void 0)&&C.name)return l.publisher.name;return""}getDescription(){var C;if(!this.article)return"";const A=this.article.querySelectorAll("p");for(const a of Array.from(A)){const s=((C=a.textContent)===null||C===void 0?void 0:C.trim())||"";if(!(s.length<3||/^[\d\W]+$/.test(s)))return s.slice(0,140).replace(/\s+/g," ")}return""}}d.MediumExtractor=E},8090(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.NytimesExtractor=void 0;const _=g(2279),E=g(639),b="data-defuddle-nyt";class C extends _.BaseExtractor{constructor(a,s,l,u){var m;if(super(a,s,l,u),this.preloadedData=null,this.contentSelector=null,this.preloadedData=this.extractPreloadData(),this.preloadedData){const x=this.preloadedData.sprinkledBody||this.preloadedData.body;if(!((m=x==null?void 0:x.content)===null||m===void 0)&&m.length){if(!a.querySelector(`[${b}]`)){const f=a.createElement("div");f.setAttribute(b,""),f.appendChild((0,E.parseHTML)(a,this.renderBlocks(x.content))),a.body.appendChild(f)}this.contentSelector=`[${b}]`}}}canExtract(){return this.contentSelector!==null}extract(){var a,s,l;const u=this.preloadedData,m=((a=u.headline)===null||a===void 0?void 0:a.default)||"",x=(((l=(s=u.bylines)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.creators)||[]).map((p=>p.displayName)).filter(Boolean).join(", "),f=u.firstPublished||"",v=u.summary||"";return{content:"",contentHtml:"",contentSelector:this.contentSelector,variables:{title:m,author:x,published:f,description:v}}}extractPreloadData(){var a,s;const l=this.document.querySelectorAll("script:not([src])");for(const u of l){const m=u.textContent||"";if(!m.includes("window.__preloadedData"))continue;const x=m.match(/window\.__preloadedData\s*=\s*({[\s\S]+})\s*;?\s*$/);if(x)try{const f=x[1].replace(new RegExp("(?<=:)undefined(?=[,}\\]])","g"),"null");return((s=(a=JSON.parse(f).initialData)===null||a===void 0?void 0:a.data)===null||s===void 0?void 0:s.article)||null}catch{return null}}return null}renderBlocks(a){var s,l,u;const m=[];for(const x of a)switch(x.__typename){case"ParagraphBlock":m.push(`<p>${this.renderInlines(x.content)}</p>`);break;case"Heading2Block":m.push(`<h2>${this.renderInlines(x.content)}</h2>`);break;case"Heading3Block":m.push(`<h3>${this.renderInlines(x.content)}</h3>`);break;case"Heading4Block":m.push(`<h4>${this.renderInlines(x.content)}</h4>`);break;case"ImageBlock":{const f=x.media;if(!f)break;const v=this.getBestImageUrl(f);if(!v)break;const p=this.escapeAttr(f.altText||((s=f.caption)===null||s===void 0?void 0:s.text)||""),h=[((l=f.caption)===null||l===void 0?void 0:l.text)||"",f.credit||""].filter(Boolean);h.length?m.push(`<figure><img src="${this.escapeAttr(v)}" alt="${p}"><figcaption>${this.escapeHtml(h.join(" "))}</figcaption></figure>`):m.push(`<img src="${this.escapeAttr(v)}" alt="${p}">`);break}case"HeaderBasicBlock":case"Dropzone":break;default:{const f=x;!((u=f.content)===null||u===void 0)&&u.length&&m.push(`<p>${this.renderInlines(f.content)}</p>`);break}}return m.join(`
|
|
363
|
+
`)}renderInlines(a){return a?a.map((s=>{var l;let u=this.escapeHtml(s.text||"");if(!(!((l=s.formats)===null||l===void 0)&&l.length))return u;for(const m of s.formats)switch(m.__typename){case"BoldFormat":u=`<strong>${u}</strong>`;break;case"ItalicFormat":u=`<em>${u}</em>`;break;case"LinkFormat":m.url&&(u=`<a href="${this.escapeAttr(m.url)}">${u}</a>`)}return u})).join(""):""}getBestImageUrl(a){var s,l;const u=a==null?void 0:a.crops;if(!(u!=null&&u.length))return null;const m=["superJumbo","jumbo","articleLarge"];for(const x of m)for(const f of u){const v=(s=f.renditions)===null||s===void 0?void 0:s.find((p=>p.name===x));if(v!=null&&v.url)return v.url}for(const x of u)if(!((l=x.renditions)===null||l===void 0)&&l.length&&x.renditions[0].url)return x.renditions[0].url;return null}escapeHtml(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}escapeAttr(a){return a.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}}d.NytimesExtractor=C},5959(c,d,g){var _=this&&this.__awaiter||function(m,x,f,v){return new(f||(f=Promise))((function(p,h){function w($){try{M(v.next($))}catch(T){h(T)}}function O($){try{M(v.throw($))}catch(T){h(T)}}function M($){var T;$.done?p($.value):(T=$.value,T instanceof f?T:new f((function(D){D(T)}))).then(w,O)}M((v=v.apply(m,x||[])).next())}))};Object.defineProperty(d,"__esModule",{value:!0}),d.RedditExtractor=void 0;const E=g(2279),b=g(639),C=g(6077),A=new Map,a={"<":"<",">":">",""":'"',"'":"'","&":"&"};function s(m){try{return/^\/login\/?$/.test(new URL(m).pathname)}catch{return!1}}function l(m){return m.replace(/&(?:lt|gt|quot|apos|amp|#(\d+)|#x([0-9a-fA-F]+));/g,((x,f,v)=>{var p;return f||v?String.fromCodePoint(parseInt(f??v,f?10:16)):(p=a[x])!==null&&p!==void 0?p:x}))}class u extends E.BaseExtractor{constructor(x,f,v,p){super(x,f,v,p),this.shredditPost=x.querySelector("shreddit-post"),this.isOldReddit=!!x.querySelector(".thing.link")}canExtract(){return!!this.shredditPost||this.isOldReddit}canExtractAsync(){return this.isCommentsPage()&&!this.isOldReddit}prefersAsync(){const x=typeof window<"u"&&this.document.defaultView===window;return this.isCommentsPage()&&!this.isOldReddit&&!x}isCommentsPage(){return/\/r\/.+\/comments\//.test(this.url)}extractAsync(){return _(this,void 0,void 0,(function*(){return(yield this.tryOldReddit())||this.extractFromFeed()}))}tryOldReddit(){return _(this,void 0,void 0,(function*(){const x=new URL(this.url);x.hostname="old.reddit.com";const f=yield this.request(x.toString(),"text/html,application/xhtml+xml").catch((()=>null));if(!(f!=null&&f.ok)||s(f.url))return null;const v=this.parseDocument(f.text);return v.querySelector(".thing.link")?this.extractOldReddit(v):null}))}extractFromFeed(){return _(this,void 0,void 0,(function*(){const x=new URL(this.url);x.hostname="www.reddit.com",x.pathname=`${x.pathname.replace(/\/+$/,"")}/.rss`;const f=yield this.request(x.toString(),"application/atom+xml, application/rss+xml, application/xml");if(!f.ok)throw new Error(`Failed to fetch ${x.hostname}: ${f.status}`);return this.extractFeed(f.text)}))}request(x,f){return _(this,void 0,void 0,(function*(){if(this.options.fetch)return this.send(x,f);const v=Date.now(),p=A.get(x);if(p&&p.expires>v)return p.page;A.delete(x);const h=this.send(x,f),w={expires:v+6e4,page:h};for(A.set(x,w),h.catch((()=>{w.expires=Date.now()+5e3}));A.size>16;)A.delete(A.keys().next().value);return h}))}send(x,f){return _(this,void 0,void 0,(function*(){var v;const p=yield this.fetch(x,{headers:{"User-Agent":"defuddle (+https://defuddle.md)",Accept:f},signal:AbortSignal.timeout(1e4)}),h=p.url||x,w=p.ok&&!s(h);return w||(v=p.body)===null||v===void 0||v.cancel().catch((()=>{})),{ok:p.ok,status:p.status,url:h,text:w?yield p.text():""}}))}parseDocument(x){var f,v;const p=(v=(f=this.document.defaultView)===null||f===void 0?void 0:f.DOMParser)!==null&&v!==void 0?v:typeof DOMParser<"u"?DOMParser:null;if(!p)throw new Error("DOMParser is not available in this environment");return new p().parseFromString(x,"text/html")}extractFeed(x){const f=this.options.includeReplies!==!1,v=x.split("<entry>").slice(1).filter((O=>{var M,$;const T=($=(M=O.match(/<id>([\s\S]*?)<\/id>/))===null||M===void 0?void 0:M[1])!==null&&$!==void 0?$:"";return T.startsWith("t3_")||f&&T.startsWith("t1_")})).map((O=>this.parseFeedEntry(O))),p=v.find((O=>O.id.startsWith("t3_"))),h=(p==null?void 0:p.content)||"",w=(0,C.buildCommentTree)(v.filter((O=>O.id.startsWith("t1_"))).map((O=>({author:O.author,date:O.date,content:O.content,depth:0,url:O.url||void 0}))));return this.buildResult(h,w,{title:(p==null?void 0:p.title)||"",author:(p==null?void 0:p.author)||"",subreddit:this.getSubreddit()})}parseFeedEntry(x){const f=v=>{var p,h;return((h=(p=x.match(v))===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"").trim()};return{id:f(/<id>([\s\S]*?)<\/id>/),author:l(f(/<author>[\s\S]*?<name>([\s\S]*?)<\/name>/)).replace(/^\/u\//,""),title:l(f(/<title>([\s\S]*?)<\/title>/)),date:f(/<updated>([\s\S]*?)<\/updated>/).split("T")[0],url:l(f(/<link[^>]*href="([^"]*)"/)),content:this.feedContentHtml(f(/<content[^>]*>([\s\S]*?)<\/content>/))}}feedContentHtml(x){if(!x)return"";const f=this.document.createElement("div");f.appendChild((0,b.parseHTML)(this.document,l(x)));const v=f.querySelector(".md");return v?(0,b.serializeHTML)(v):(0,b.serializeHTML)(f)}extract(){var x,f;if(this.isOldReddit)return this.extractOldReddit(this.document);const v=((f=(x=this.document.querySelector("h1"))===null||x===void 0?void 0:x.textContent)===null||f===void 0?void 0:f.trim())||"",p=this.getSubreddit(),h=this.getPostAuthor(),w=this.getPostContent(),O=this.createDescription(w),M=this.options.includeReplies!==!1?this.extractComments():"";return this.buildResult(w,M,{title:v,author:h,subreddit:p},O)}buildResult(x,f,v,p=this.createDescription(x)){const h=this.createContentHtml(x,f);return{content:h,contentHtml:h,extractedContent:{postId:this.getPostId(),subreddit:v.subreddit,postAuthor:v.author},variables:{title:v.title,author:v.author,site:`r/${v.subreddit}`,description:p}}}extractOldReddit(x){var f,v;const p=x.querySelector(".thing.link"),h=((v=(f=p==null?void 0:p.querySelector("a.title"))===null||f===void 0?void 0:f.textContent)===null||v===void 0?void 0:v.trim())||"",w=(p==null?void 0:p.getAttribute("data-author"))||"",O=(p==null?void 0:p.getAttribute("data-subreddit"))||"",M=p==null?void 0:p.querySelector(".usertext-body .md"),$=M?(0,b.serializeHTML)(M):"";let T="";if(this.options.includeReplies!==!1){const D=x.querySelector(".commentarea .sitetable");T=(0,C.buildCommentTree)(D?this.collectOldRedditComments(D):[])}return this.buildResult($,T,{title:h,author:w,subreddit:O})}getPostContent(){var x,f,v;const p=(x=this.shredditPost)===null||x===void 0?void 0:x.querySelector('[slot="text-body"]');return(p?(0,b.serializeHTML)(p):"")+(((v=(f=this.shredditPost)===null||f===void 0?void 0:f.querySelector("#post-image"))===null||v===void 0?void 0:v.outerHTML)||"")}createContentHtml(x,f){return(0,C.buildContentHtml)("reddit",x,f)}extractComments(){const x=Array.from(this.document.querySelectorAll("shreddit-comment"));return this.processComments(x)}getPostId(){const x=this.url.match(/comments\/([a-zA-Z0-9]+)/);return(x==null?void 0:x[1])||""}getSubreddit(){const x=this.url.match(/\/r\/([^/]+)/);return(x==null?void 0:x[1])||""}getPostAuthor(){var x;return((x=this.shredditPost)===null||x===void 0?void 0:x.getAttribute("author"))||""}createDescription(x){var f;if(!x)return"";const v=this.document.createElement("div");return v.appendChild((0,b.parseHTML)(this.document,x)),((f=v.textContent)===null||f===void 0?void 0:f.trim().slice(0,140).replace(/\s+/g," "))||""}collectOldRedditComments(x,f=0){var v,p;const h=[],w=Array.from(x.querySelectorAll(":scope > .thing.comment"));for(const O of w){const M=O.getAttribute("data-author")||"",$=O.getAttribute("data-permalink")||"",T=((p=(v=O.querySelector(".entry .tagline .score.unvoted"))===null||v===void 0?void 0:v.textContent)===null||p===void 0?void 0:p.trim())||"",D=O.querySelector(".entry .tagline time[datetime]"),R=(D==null?void 0:D.getAttribute("datetime"))||"",S=R?new Date(R).toISOString().split("T")[0]:"",y=O.querySelector(".entry .usertext-body .md"),k=y?(0,b.serializeHTML)(y):"";h.push({author:M,date:S,content:k,depth:f,score:T||void 0,url:$?`https://reddit.com${$}`:void 0});const N=O.querySelector(".child > .sitetable");N&&h.push(...this.collectOldRedditComments(N,f+1))}return h}processComments(x){var f;const v=[];for(const p of x){const h=parseInt(p.getAttribute("depth")||"0"),w=p.getAttribute("author")||"",O=p.getAttribute("score")||"0",M=p.getAttribute("permalink")||"",$=p.querySelector('[slot="comment"]'),T=$?(0,b.serializeHTML)($):"",D=p.getAttribute("created")||((f=p.querySelector("time"))===null||f===void 0?void 0:f.getAttribute("datetime"))||"",R=D?new Date(D).toISOString().split("T")[0]:"";v.push({author:w,date:R,content:T,depth:h,score:`${O} points`,url:M?`https://reddit.com${M}`:void 0})}return(0,C.buildCommentTree)(v)}}d.RedditExtractor=u},6581(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.SubstackExtractor=void 0;const _=g(2279),E=g(639),b="data-defuddle-substack-post";class C extends _.BaseExtractor{constructor(a,s,l,u){var m,x;if(super(a,s,l,u),this.noteText=null,this.noteImage=null,this.postData=null,this.postContentSelector=null,a.querySelector("div.body.markup"))return this.postData=this.extractPreloadData(),void(this.postContentSelector="div.body.markup");if(this.postData=this.extractPreloadData(),(m=this.postData)===null||m===void 0?void 0:m.body_html){if(!a.querySelector(`[${b}]`)){const v=a.createElement("div");v.setAttribute(b,""),v.appendChild((0,E.parseHTML)(a,this.postData.body_html)),a.body.appendChild(v)}return void(this.postContentSelector=`[${b}]`)}const f=a.querySelector('[class*="feedPermalinkUnit"]');if(this.noteText=(f||a).querySelector("div.ProseMirror.FeedProseMirror"),this.noteText){const v=this.noteText.closest('[class*="feedCommentBody"]:not([class*="feedCommentBodyInner"])');if(v){const p=[v.nextElementSibling,(x=v.parentElement)===null||x===void 0?void 0:x.nextElementSibling];for(const h of p)if(h&&(h.getAttribute("class")||"").includes("imageGrid")){this.noteImage=h;break}}}}canExtract(){return this.postContentSelector!==null||this.noteText!==null}extract(){return this.postContentSelector?this.extractPost():this.extractNote()}extractPost(){var a,s,l,u,m,x,f,v,p,h;const w=((a=this.postData)===null||a===void 0?void 0:a.title)||((s=this.document.querySelector('meta[property="og:title"]'))===null||s===void 0?void 0:s.getAttribute("content"))||"",O=((l=this.postData)===null||l===void 0?void 0:l.subtitle)||((u=this.document.querySelector('meta[property="og:description"]'))===null||u===void 0?void 0:u.getAttribute("content"))||"",M=((f=(x=(m=this.postData)===null||m===void 0?void 0:m.publishedBylines)===null||x===void 0?void 0:x[0])===null||f===void 0?void 0:f.name)||((p=(v=this.document.querySelector('a[href*="substack.com/@"]'))===null||v===void 0?void 0:v.textContent)===null||p===void 0?void 0:p.trim())||"",$=((h=this.postData)===null||h===void 0?void 0:h.post_date)||this.parseDateFromByline()||"";return{content:"",contentHtml:"",contentSelector:this.postContentSelector,variables:{title:w,author:M,site:"Substack",description:O,published:$}}}extractNote(){var a,s;const l=this.noteText.outerHTML,u=this.buildImageHtml(),m=u?`${l}
|
|
364
|
+
${u}`:l,x=((a=this.document.querySelector('meta[property="og:title"]'))===null||a===void 0?void 0:a.getAttribute("content"))||"",f=((s=this.document.querySelector('meta[property="og:description"]'))===null||s===void 0?void 0:s.getAttribute("content"))||"",v=x.replace(/\s*\(@[^)]+\)\s*$/,"").trim();return{content:m,contentHtml:m,variables:{title:x,author:v,site:"Substack",description:f}}}parseDateFromByline(){const a=this.document.querySelector('[class*="byline-wrapper"]');if(!a)return"";const s={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"},l=(a.textContent||"").trim().replace(/([a-z])([A-Z])/g,"$1 $2").match(new RegExp("\\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s+(\\d{1,2}),?\\s+(\\d{4})\\b"));if(l){const u=s[l[1]],m=l[2].padStart(2,"0");return`${l[3]}-${u}-${m}T00:00:00+00:00`}return""}extractPreloadData(){var a,s;const l=Array.from(this.document.querySelectorAll("script"));for(const u of l){const m=u.textContent||"";if(!m.includes("window._preloads")||!m.includes("body_html"))continue;const x=m.indexOf('JSON.parse("');if(x===-1)continue;const f=x+12;let v=f;for(;v<m.length;)if(m[v]==="\\")v+=2;else{if(m[v]==='"')break;v++}try{const p=m.slice(f,v),h=JSON.parse('"'+p+'"'),w=JSON.parse(h),O=(s=(a=w==null?void 0:w.feedData)===null||a===void 0?void 0:a.initialPost)===null||s===void 0?void 0:s.post;if(O!=null&&O.body_html)return O}catch{}}return null}buildImageHtml(){var a;if(!this.noteImage)return"";const s=(a=this.document.querySelector('meta[property="og:image"]'))===null||a===void 0?void 0:a.getAttribute("content");if(s)return`<img src="${(0,E.escapeHtml)(s)}" alt="" />`;const l=this.noteImage.querySelector("img");if(!l)return"";const u=this.getLargestSrc(l);return u?`<img src="${(0,E.escapeHtml)(u)}" alt="" />`:""}getLargestSrc(a){const s=a.getAttribute("srcset")||"";if(s){const l=/(.+?)\s+(\d+(?:\.\d+)?)w/g;let u,m="",x=0,f=0;for(;(u=l.exec(s))!==null;){let v=u[1].trim();f>0&&(v=v.replace(/^,\s*/,"")),f=l.lastIndex;const p=parseFloat(u[2]);v&&p>x&&(x=p,m=v)}if(m)return m.replace(/,w_\d+/g,"").replace(/,c_\w+/g,"")}return a.getAttribute("src")||""}}d.SubstackExtractor=C},9970(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.ThreadsExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){super(a,s,l,u),this.pagelets=[],this.regionContainer=null;const m=Array.from(a.querySelectorAll('[data-pagelet^="threads_post_page_"]'));if(this.pagelets=m.filter((x=>x.querySelector('a[href^="/@"], time[datetime]'))),this.pagelets.length===0){const x=a.querySelector('div[role="region"]');x!=null&&x.querySelector('a[href^="/@"]')&&(this.regionContainer=x)}}canExtract(){return this.pagelets.length>0||!!this.regionContainer}extract(){var a,s;if(this.pagelets.length===0&&this.regionContainer)return this.extractFromRegion(this.regionContainer);const l=this.getUsername(this.pagelets[0]),u=[],m=[];let x=!1;for(const $ of this.pagelets){const T=this.getPostsFromPagelet($);T.length!==0&&(x||T[0].username!==l||T.length!==1?(x=!0,m.push(T)):u.push(T[0]))}const f=u.map(($=>$.content)).join(`
|
|
365
|
+
<hr>
|
|
366
|
+
`),v=this.options.includeReplies!==!1?this.extractComments(m):"",p=(0,b.buildContentHtml)("threads",f,v),h=`@${l}`,w=this.createDescription((a=u[0])===null||a===void 0?void 0:a.element),O=this.postTitle(h,"Threads"),M=((s=u[0])===null||s===void 0?void 0:s.date)||"";return{content:p,contentHtml:p,extractedContent:{postAuthor:l},variables:Object.assign({title:O,author:h,site:"Threads",description:w},M&&{published:M})}}extractFromRegion(a){const s=this.getUsername(a);if(!s)return{content:"",contentHtml:""};const l=`@${s}`,u=this.extractPostContent(a),m=this.options.includeReplies!==!1?this.extractCommentsFromJson(s):"",x=(0,b.buildContentHtml)("threads",u,m),f=this.createDescription(a),v=this.getDate(a);return{content:x,contentHtml:x,extractedContent:{postAuthor:s},variables:Object.assign({title:this.postTitle(l,"Threads"),author:l,site:"Threads",description:f},v&&{published:v})}}extractCommentsFromJson(a){const s=this.document.querySelectorAll('script[type="application/json"]'),l=[],u=new Set;for(const f of Array.from(s)){const v=f.textContent||"";if(!((v.match(/"text_fragments"/g)||[]).length<2)&&v.includes('"username"'))try{const p=JSON.parse(v);for(const h of this.findPostsInJson(p,0)){const w=h.username+":"+h.text.slice(0,80);u.has(w)||(u.add(w),l.push(h))}}catch{}}if(l.length<2)return"";const m=[];let x=!0;for(const f of l)x&&f.username===a?x=!1:m.push({author:`@${f.username}`,date:"",content:`<p>${(0,E.escapeHtml)(f.text)}</p>`,depth:0});return m.length>0?(0,b.buildCommentTree)(m):""}findPostsInJson(a,s,l=[]){var u;if(s>35||a==null||typeof a!="object")return l;if(!((u=a.user)===null||u===void 0)&&u.username&&typeof a.user.username=="string"){const m=this.extractTextFromJson(a,0);m&&l.push({username:a.user.username,text:m})}for(const m of Object.keys(a))m!=="quoted_post"&&this.findPostsInJson(a[m],s+1,l);return l}extractTextFromJson(a,s){var l;if(s>10||a==null||typeof a!="object")return null;if(!((l=a.text_fragments)===null||l===void 0)&&l.fragments)return a.text_fragments.fragments.map((u=>{var m;return u.plaintext?u.plaintext:!((m=u.mention_fragment)===null||m===void 0)&&m.username?`@${u.mention_fragment.username}`:u.linkified_web_url?u.linkified_web_url:""})).join("");for(const u of Object.keys(a)){if(u==="quoted_post")continue;const m=this.extractTextFromJson(a[u],s+1);if(m)return m}return null}getPostsFromPagelet(a){var s;const l=a.querySelectorAll("[data-pressable-container]"),u=[];for(const m of Array.from(l)){if(!((s=m.parentElement)===null||s===void 0)&&s.closest("[data-pressable-container]"))continue;const x=this.getUsername(m);x&&u.push({username:x,date:this.getDate(m),permalink:this.getPermalink(m),content:this.extractPostContent(m),element:m})}return u}extractComments(a){const s=[];for(const l of a)for(let u=0;u<l.length;u++)s.push(this.toCommentData(l[u],l.length===1?0:u));return s.length>0?(0,b.buildCommentTree)(s):""}toCommentData(a,s){return{author:`@${a.username}`,date:a.date,content:a.content,depth:s,url:a.permalink||void 0}}getUsername(a){var s,l;const u=a.querySelectorAll('a[href^="/@"][role="link"]');for(const x of Array.from(u)){const f=(s=x.textContent)===null||s===void 0?void 0:s.trim();if(f&&!f.includes("profile picture"))return f}const m=a.querySelector('a[href^="/@"]');if(m){const x=(l=m.getAttribute("href"))===null||l===void 0?void 0:l.match(/\/@([^/]+)/);return x?x[1]:""}return""}getDate(a){const s=a.querySelector("time[datetime]");if(!s)return"";const l=s.getAttribute("datetime")||"";try{return new Date(l).toISOString().split("T")[0]}catch{return""}}getPermalink(a){const s=a.querySelector('a[href*="/post/"]');if(!s)return"";const l=s.getAttribute("href")||"";return l.startsWith("http")?l:`https://www.threads.com${l}`}extractPostContent(a){var s;const l=[],u=Array.from(a.querySelectorAll('span[dir="auto"]'));for(const v of u){if(v.closest('a[href^="/@"], a[href*="/post/"], a[href*="l.threads.com"], time')||v.closest('[role="button"]'))continue;const p=((s=v.textContent)===null||s===void 0?void 0:s.trim())||"";if(!p||p==="Author"||p==="·"||p==="Top"||p==="View activity"||/^\d{2}\/\d{2}\/\d{2}$/.test(p)||/^@?\w+\/post\/\w+$/.test(p)||!this.stripThreadNumber(p))continue;const h=this.cleanText(v);h&&l.push(`<p>${h}</p>`)}const m=this.extractImages(a);m&&l.push(m);const x=this.extractLinkCard(a);x&&l.push(x);const f=this.extractQuotedPost(a);return f&&l.push(f),l.join(`
|
|
367
|
+
`)}cleanText(a){const s=a.cloneNode(!0);this.removeThreadNumbers(s),s.querySelectorAll("a").forEach((u=>{var m;const x=u.getAttribute("href")||"",f=((m=u.textContent)===null||m===void 0?void 0:m.trim())||"";if(x.match(/\/@[\w.]+\/post\//))return void u.remove();const v=s.ownerDocument.createElement("a");if(x.includes("l.threads.com"))v.setAttribute("href",this.unwrapRedirectUrl(x));else{if(x.startsWith("/@")){const p=x.replace(/^\/@/,"");return v.setAttribute("href",`https://www.threads.com/@${p}`),v.textContent=`@${p}`,void u.replaceWith(v)}v.setAttribute("href",x.startsWith("http")?x:`https://www.threads.com${x}`)}v.textContent=f,u.replaceWith(v)})),s.querySelectorAll("span, div").forEach((u=>{u.replaceWith(...Array.from(u.childNodes))}));let l=(s.innerHTML||s.textContent||"").trim();return l=l.replace(/<!--.*?-->/g,""),l=l.replace(/\s+/g," ").trim(),l||""}stripThreadNumber(a){return a.replace(/\s*\d+\s*\/\s*\d+\s*$/,"").trim()}removeThreadNumbers(a){var s;const l=Array.from(a.querySelectorAll("div"));for(const u of l){const m=((s=u.textContent)===null||s===void 0?void 0:s.trim())||"";/^\d+\/\d+$/.test(m)&&u.querySelectorAll("span").length>=2&&u.remove()}}unwrapRedirectUrl(a){try{const s=new URL(a).searchParams.get("u");return s?decodeURIComponent(s):a}catch{return a}}extractImages(a){const s=[];return a.querySelectorAll("img").forEach((l=>{const u=l.getAttribute("alt")||"",m=l.getAttribute("src")||"";if(u.includes("profile picture")||!m||l.closest('a[href*="l.threads.com"]'))return;const x=parseInt(l.getAttribute("width")||"0");x>0&&x<=48||s.push(`<img src="${(0,E.escapeHtml)(m)}" alt="${(0,E.escapeHtml)(u)}" />`)})),s.join(`
|
|
368
|
+
`)}extractLinkCard(a){const s=a.querySelectorAll('a[href*="l.threads.com"]');for(const l of Array.from(s)){const u=l.querySelector("img");if(!u)continue;const m=l.getAttribute("href")||"",x=this.unwrapRedirectUrl(m),f=u.getAttribute("src")||"",v=u.getAttribute("alt")||"";if(f)return`<a href="${(0,E.escapeHtml)(x)}"><img src="${(0,E.escapeHtml)(f)}" alt="${(0,E.escapeHtml)(v)}" /></a>`}return""}extractQuotedPost(a){var s;const l=a.querySelector("[data-pressable-container]");if(l)return this.extractQuotedPostFrom(l);const u=a.querySelectorAll('a[href*="/post/"]');for(const m of Array.from(u)){const x=((s=m.textContent)===null||s===void 0?void 0:s.trim())||"";if(/^\d{2}\/\d{2}\/\d{2}$/.test(x))continue;const f=m.getAttribute("href")||"",v=f.match(/\/@([^/]+)\/post\//);if(!v)continue;const p=v[1],h=`<p>${(0,E.escapeHtml)(x)}</p>`,w=f.startsWith("http")?f:`https://www.threads.com${f}`;return(0,b.buildQuotedPost)({author:`@${p}`,content:h,url:w})}return""}extractQuotedPostFrom(a){var s,l;const u=this.getUsername(a),m=this.getDate(a),x=Array.from(a.querySelectorAll('span[dir="auto"]'));let f="";for(const v of x){if(v.closest('[role="button"], time'))continue;const p=v.closest('a[href^="/@"]');if(p&&!(!((s=p.getAttribute("href"))===null||s===void 0)&&s.includes("/post/")))continue;const h=(l=v.textContent)===null||l===void 0?void 0:l.trim();if(!h||h==="·"||h==="Author"||/^\d{2}\/\d{2}\/\d{2}$/.test(h))continue;const w=this.stripThreadNumber(h);w&&(f+=`<p>${(0,E.escapeHtml)(w)}</p>
|
|
369
|
+
`)}return(0,b.buildQuotedPost)({author:u?`@${u}`:void 0,date:m||void 0,content:f.trim()})}createDescription(a){var s;if(!a)return"";const l=a.querySelectorAll('span[dir="auto"]');for(const u of Array.from(l)){if(u.closest('a[href^="/@"], [role="button"], a[href*="/post/"], time'))continue;const m=((s=u.textContent)===null||s===void 0?void 0:s.trim())||"";if(!m||m==="Author"||m==="·"||m==="Top"||m==="View activity"||/^\d{2}\/\d{2}\/\d{2}$/.test(m))continue;const x=this.stripThreadNumber(m);if(x)return x.slice(0,140).replace(/\s+/g," ")}return""}}d.ThreadsExtractor=C},2248(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.TwitterExtractor=void 0;const _=g(2279),E=g(639),b=g(6077);class C extends _.BaseExtractor{constructor(a,s,l,u){super(a,s,l,u),this.mainTweet=null,this.threadTweets=[],this.replyTweets=[],this.replyDepths=[],this.classifyCells(this.conversationCells()),this.mainTweet||(this.mainTweet=a.querySelector('article[data-testid="tweet"]'))}conversationCells(){const a=[];for(const s of Array.from(this.document.querySelectorAll('[data-testid="cellInnerDiv"], section, h2')))if(s.getAttribute("data-testid")==="cellInnerDiv")a.push(s);else if(a.length&&!s.closest('article[data-testid="tweet"]'))break;return a}classifyCells(a){let s="",l=!1,u=!1,m=0;for(const x of a){const f=x.querySelector('article[data-testid="tweet"]');if(!f){u=!1;continue}if(!this.mainTweet){this.mainTweet=f,s=this.getHandle(f),u=!0;continue}const v=this.getHandle(f);l||!v||v!==s?(l=!0,m=u?m+1:0,this.replyTweets.push(f),this.replyDepths.push(m),u=!0):(this.threadTweets.push(f),u=!0)}}canExtract(){return!!this.mainTweet}extract(){const a=[this.extractTweetContent(this.mainTweet)];for(const v of this.threadTweets)a.push(this.extractTweetContent(v));const s=a.join(`
|
|
370
|
+
<hr>
|
|
371
|
+
`),l=this.options.includeReplies!==!1?this.extractComments():"",u=(0,b.buildContentHtml)("twitter",s,l),m=this.getTweetId(),x=this.getTweetAuthor(),f=this.createDescription(this.mainTweet);return{content:u,contentHtml:u,extractedContent:{tweetId:m,tweetAuthor:x},variables:{title:this.postTitle(x,"X"),author:x,site:"X (Twitter)",description:f}}}extractComments(){if(this.replyTweets.length===0)return"";const a=this.replyTweets.map(((s,l)=>{const u=this.extractUserInfo(s),m=this.extractTweetContent(s);return{author:u.fullName?`${u.fullName} ${u.handle}`:u.handle,date:u.date,content:m,depth:this.replyDepths[l],url:u.permalink}}));return(0,b.buildCommentTree)(a)}getHandle(a){var s;const l=a.querySelector('[data-testid="User-Name"]');if(!l)return"";const u=Array.from(l.querySelectorAll("a"));for(const x of u){const f=((s=x.textContent)===null||s===void 0?void 0:s.trim())||"";if(/^@\w{1,15}$/.test(f))return f}for(const x of u){const f=(x.getAttribute("href")||"").match(/^(?:https?:\/\/[^/]+)?\/(\w{1,15})(?:\/|$)/);if(f&&!C.RESERVED_PATHS.has(f[1].toLowerCase()))return`@${f[1]}`}const m=(l.textContent||"").match(/@(\w{1,15})/);return m?`@${m[1]}`:""}formatTweetText(a){if(!a)return"";const s=this.document.createElement("div");return s.appendChild((0,E.parseHTML)(this.document,a)),s.querySelectorAll("a").forEach((l=>{var u;const m=((u=l.textContent)===null||u===void 0?void 0:u.trim())||"";l.replaceWith(m)})),s.querySelectorAll("span, div").forEach((l=>{l.replaceWith(...Array.from(l.childNodes))})),(0,E.serializeHTML)(s).split(`
|
|
372
|
+
`).map((l=>l.trim())).filter((l=>l)).map((l=>`<p>${l}</p>`)).join(`
|
|
373
|
+
`)}replaceEmojiImages(a){a.querySelectorAll('img[src*="/emoji/"]').forEach((s=>{const l=s.getAttribute("alt");l&&s.replaceWith(l)}))}findQuotedTweet(a){var s,l;return((l=(s=a.querySelector('[aria-labelledby*="id__"]'))===null||s===void 0?void 0:s.querySelector('[data-testid="User-Name"]'))===null||l===void 0?void 0:l.closest('[aria-labelledby*="id__"]'))||null}extractTweetContent(a){if(!a)return"";const s=a.cloneNode(!0);this.replaceEmojiImages(s);const l=s.querySelector('[data-testid="tweetText"]'),u=l?(0,E.serializeHTML)(l):"",m=this.formatTweetText(u),x=this.findQuotedTweet(a),f=this.extractImages(a,x),v=x?this.extractQuotedTweet(x):"",p=this.extractCard(a);let h="";return m&&(h+=m),f.length&&(h+=`
|
|
374
|
+
${f.join(`
|
|
375
|
+
`)}`),p&&(h+=`
|
|
376
|
+
${p}`),v&&(h+=`
|
|
377
|
+
${v}`),h}extractQuotedTweet(a){const s=a.cloneNode(!0);this.replaceEmojiImages(s);const l=s.querySelector('[data-testid="tweetText"]'),u=l?(0,E.serializeHTML)(l):"",m=this.formatTweetText(u),x=this.extractUserInfo(a),f=this.extractImages(a,null);let v="";m&&(v+=m),f.length&&(v+=`
|
|
378
|
+
${f.join(`
|
|
379
|
+
`)}`);const p=x.fullName?`${x.fullName} ${x.handle}`:x.handle;return(0,b.buildQuotedPost)({author:p||void 0,date:x.date||void 0,content:v})}extractUserInfo(a){var s,l,u;const m=a.querySelector('[data-testid="User-Name"]');if(!m)return{fullName:"",handle:"",date:"",permalink:""};const x=this.getHandle(a);let f=Array.from(m.querySelectorAll("a")).map((O=>{var M;return O.querySelector("time")?"":((M=O.textContent)===null||M===void 0?void 0:M.trim())||""})).find((O=>O&&O!==x&&!O.startsWith("@")))||"";if(!f){const O=((l=(s=m.children[0])===null||s===void 0?void 0:s.textContent)===null||l===void 0?void 0:l.trim())||"";O&&!O.startsWith("@")&&(f=O)}const v=a.querySelector("time"),p=(v==null?void 0:v.getAttribute("datetime"))||"",h=p?new Date(p).toISOString().split("T")[0]:"",w=((u=v==null?void 0:v.closest("a"))===null||u===void 0?void 0:u.href)||"";return{fullName:f,handle:x,date:h,permalink:w}}extractImages(a,s){const l=['[data-testid="tweetPhoto"]','[data-testid="tweet-image"]','img[src*="media"]'],u=[];for(const m of l)a.querySelectorAll(m).forEach((x=>{var f,v;if(!(s!=null&&s.contains(x))&&x.tagName.toLowerCase()==="img"&&x.getAttribute("alt")){const p=((f=x.getAttribute("src"))===null||f===void 0?void 0:f.replace(/&name=\w+$/,"&name=large"))||"",h=((v=x.getAttribute("alt"))===null||v===void 0?void 0:v.replace(/\s+/g," ").trim())||"";u.push(`<img src="${(0,E.escapeHtml)(p)}" alt="${(0,E.escapeHtml)(h)}" />`)}}));return u}extractCard(a){var s;const l=a.querySelector('[data-testid="card.wrapper"]');if(!l)return"";const u=l.querySelector("a[href]");if(!u)return"";const m=u.getAttribute("href")||"",x=((s=(u.getAttribute("aria-label")||"").split(/\n/)[0])===null||s===void 0?void 0:s.trim())||m;return`<p><a href="${(0,E.escapeHtml)(m)}">${(0,E.escapeHtml)(x)}</a></p>`}getTweetId(){const a=this.url.match(/status\/(\d+)/);return(a==null?void 0:a[1])||""}getTweetAuthor(){const a=this.getHandle(this.mainTweet);return a.startsWith("@")?a:`@${a}`}createDescription(a){var s;return a?(((s=a.querySelector('[data-testid="tweetText"]'))===null||s===void 0?void 0:s.textContent)||"").trim().slice(0,140).replace(/\s+/g," "):""}}d.TwitterExtractor=C,C.RESERVED_PATHS=new Set(["i","home","explore","search","notifications","messages","settings","compose","hashtag","intent"])},2144(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.WikipediaExtractor=void 0;const _=g(2279);class E extends _.BaseExtractor{canExtract(){return this.document.querySelector("#mw-content-text")!==null}extract(){var C;const A=((C=this.document.querySelector('meta[property="og:title"]'))===null||C===void 0?void 0:C.getAttribute("content"))||"";return{content:"",contentHtml:"",contentSelector:"#mw-content-text",variables:{title:A.replace(/\s*[-\u2013\u2014]\s*Wikipedia\s*$/,"")||A,author:"Wikipedia",site:"Wikipedia"}}}}d.WikipediaExtractor=E},1064(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.XArticleExtractor=void 0;const _=g(2279),E=g(639),b='[data-testid="twitterArticleReadView"]',C='[data-testid="twitterArticleRichTextView"]',A='[data-testid="twitter-article-title"]',a='[itemprop="author"]',s='meta[itemprop="name"]',l='meta[itemprop="additionalName"]',u='[data-testid="tweetPhoto"] img',m=".longform-unstyled, .public-DraftStyleDefault-block",x='span[style*="font-weight: bold"]',f="[data-offset-key]",v='[data-testid="simpleTweet"]',p='[data-testid="tweetText"]',h='[data-testid="User-Name"]',w='[data-testid="markdown-code-block"]';class O extends _.BaseExtractor{constructor($,T,D,R){super($,T,D,R),this.articleContainer=$.querySelector(C)}canExtract(){return!!this.articleContainer}extract(){const $=this.extractTitle(),T=this.extractAuthor(),D=this.extractContent(),R=this.createDescription();return{content:D,contentHtml:D,extractedContent:{articleId:this.getArticleId()},variables:{title:$,author:T,site:"X (Twitter)",description:R}}}extractTitle(){var $;const T=this.document.querySelector(A);return(($=T==null?void 0:T.textContent)===null||$===void 0?void 0:$.trim())||"Untitled X Article"}extractAuthor(){var $,T;const D=this.document.querySelector(a);if(!D)return this.getAuthorFromUrl();const R=($=D.querySelector(s))===null||$===void 0?void 0:$.getAttribute("content"),S=(T=D.querySelector(l))===null||T===void 0?void 0:T.getAttribute("content");return R&&S?`${R} (@${S})`:R||S||this.getAuthorFromUrl()}getAuthorFromUrl(){const $=this.url.match(/\/([a-zA-Z0-9_][a-zA-Z0-9_]{0,14})\/(article|status)\/\d+/);return $?`@${$[1]}`:this.getAuthorFromOgTitle()}getAuthorFromOgTitle(){var $;const T=((($=this.document.querySelector('meta[property="og:title"]'))===null||$===void 0?void 0:$.getAttribute("content"))||"").match(/^(?:\(\d+\)\s+)?(.+?)\s+on\s+X\s*:/);return T?T[1].trim():"Unknown"}getArticleId(){const $=this.url.match(/article\/(\d+)/);return $?$[1]:""}extractContent(){if(!this.articleContainer)return"";const $=this.articleContainer.cloneNode(!0);return this.cleanContent($),`<article class="x-article">${this.extractHeaderImage()}${(0,E.serializeHTML)($)}</article>`}extractHeaderImage(){var $;const T=this.document.querySelector(b);if(!T)return"";const D=T.querySelector(u);if(!D||this.articleContainer.contains(D))return"";const R=D.getAttribute("src");if(!R)return"";const S=(($=D.getAttribute("alt"))===null||$===void 0?void 0:$.replace(/\s+/g," ").trim())||"Image";return`<img src="${(0,E.escapeHtml)(this.upgradeImageSrc(R))}" alt="${(0,E.escapeHtml)(S)}">`}cleanContent($){const T=$.ownerDocument||this.document;this.convertEmbeddedTweets($,T),this.convertCodeBlocks($,T),this.convertHeaders($,T),this.unwrapLinkedImages($,T),this.upgradeImageQuality($),this.convertBoldSpans($,T),this.convertDraftParagraphs($,T),this.removeDraftAttributes($),this.repairSurrogatePairs($)}convertEmbeddedTweets($,T){$.querySelectorAll(v).forEach((D=>{var R,S,y,k,N;const L=T.createElement("blockquote");L.className="embedded-tweet";const P=D.querySelector(h),B=P==null?void 0:P.querySelectorAll("a"),U=((S=(R=B==null?void 0:B[0])===null||R===void 0?void 0:R.textContent)===null||S===void 0?void 0:S.trim())||"",F=((k=(y=B==null?void 0:B[1])===null||y===void 0?void 0:y.textContent)===null||k===void 0?void 0:k.trim())||"",I=D.querySelector(p),H=((N=I==null?void 0:I.textContent)===null||N===void 0?void 0:N.trim())||"";if(U||F){const V=T.createElement("cite");V.textContent=F?`${U} ${F}`:U,L.appendChild(V)}if(H){const V=T.createElement("p");V.textContent=H,L.appendChild(V)}D.replaceWith(L)}))}convertCodeBlocks($,T){$.querySelectorAll(w).forEach((D=>{var R;const S=D.querySelector("pre"),y=D.querySelector("code");if(!S||!y)return;let k="";const N=y.className.match(/language-(\w+)/);if(N)k=N[1];else{const B=D.querySelector("span");k=((R=B==null?void 0:B.textContent)===null||R===void 0?void 0:R.trim())||""}const L=T.createElement("pre"),P=T.createElement("code");k&&(P.setAttribute("data-lang",k),P.className=`language-${k}`),P.textContent=y.textContent||"",L.appendChild(P),D.replaceWith(L)}))}convertHeaders($,T){$.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((D=>{var R;const S=D.tagName.toLowerCase(),y=((R=D.textContent)===null||R===void 0?void 0:R.trim())||"";if(!y)return;const k=T.createElement(S);k.textContent=y,D.replaceWith(k)}))}unwrapLinkedImages($,T){$.querySelectorAll(u).forEach((D=>{var R;const S=D.closest("a");if(!S||!$.contains(S))return;const y=D.getAttribute("src")||"",k=((R=D.getAttribute("alt"))===null||R===void 0?void 0:R.replace(/\s+/g," ").trim())||"Image",N=T.createElement("img");N.setAttribute("src",this.upgradeImageSrc(y)),N.setAttribute("alt",k),S.replaceWith(N)}))}upgradeImageQuality($){$.querySelectorAll(u).forEach((T=>{const D=T.getAttribute("src");D&&T.setAttribute("src",this.upgradeImageSrc(D))}))}upgradeImageSrc($){return $.includes("&name=")?$.replace(/&name=\w+/,"&name=large"):$.includes("?")?`${$}&name=large`:`${$}?name=large`}convertDraftParagraphs($,T){$.querySelectorAll(m).forEach((D=>{const R=T.createElement("p"),S=y=>{if(y.nodeType===3)R.appendChild(T.createTextNode(y.textContent||""));else if(y.nodeType===1){const k=y,N=k.tagName.toLowerCase();if(N==="strong"){const L=T.createElement("strong");L.textContent=k.textContent||"",R.appendChild(L)}else if(N==="a"){const L=T.createElement("a");L.setAttribute("href",k.getAttribute("href")||""),L.textContent=k.textContent||"",R.appendChild(L)}else if(N==="code"){const L=T.createElement("code");L.textContent=k.textContent||"",R.appendChild(L)}else k.childNodes.forEach((L=>S(L)))}};D.childNodes.forEach((y=>S(y))),D.replaceWith(R)}))}convertBoldSpans($,T){$.querySelectorAll(x).forEach((D=>{const R=T.createElement("strong");R.textContent=D.textContent||"",D.replaceWith(R)}))}removeDraftAttributes($){$.querySelectorAll(f).forEach((T=>{T.removeAttribute("data-offset-key")}))}repairSurrogatePairs($){const T=($.ownerDocument||this.document).createTreeWalker($,4);let D,R=null;for(;D=T.nextNode();){const S=D;if(R){const y=R.textContent||"",k=S.textContent||"";if(y&&k){const N=y.charCodeAt(y.length-1),L=k.charCodeAt(0);N>=55296&&N<=56319&&L>=56320&&L<=57343&&(R.textContent=y.slice(0,-1),S.textContent=y.slice(-1)+k)}}R=S}}createDescription(){var $,T;const D=((T=($=this.articleContainer)===null||$===void 0?void 0:$.textContent)===null||T===void 0?void 0:T.trim())||"";return D.slice(0,140)+(D.length>140?"...":"")}}d.XArticleExtractor=O},5666(c,d,g){var _=this&&this.__awaiter||function(a,s,l,u){return new(l||(l=Promise))((function(m,x){function f(h){try{p(u.next(h))}catch(w){x(w)}}function v(h){try{p(u.throw(h))}catch(w){x(w)}}function p(h){var w;h.done?m(h.value):(w=h.value,w instanceof l?w:new l((function(O){O(w)}))).then(f,v)}p((u=u.apply(a,s||[])).next())}))};Object.defineProperty(d,"__esModule",{value:!0}),d.XOembedExtractor=void 0;const E=g(2279),b=g(639),C=g(6077);class A extends E.BaseExtractor{canExtract(){return!1}extract(){return{content:"",contentHtml:""}}canExtractAsync(){return/\/(status|article)\/\d+/.test(this.url)}prefersAsync(){return this.document.querySelector('article[data-testid="tweet"]')?!1:!(typeof window<"u"&&this.document.defaultView==window)}extractAsync(){return _(this,void 0,void 0,(function*(){return(yield this.tryExtractFxTwitter())||this.extractOembed()}))}extractOembed(){return _(this,void 0,void 0,(function*(){const s=`https://publish.twitter.com/oembed?url=${encodeURIComponent(this.url)}&omit_script=true`,l=yield this.fetch(s);if(!l.ok)throw new Error(`oEmbed request failed: ${l.status}`);const u=yield l.json(),m=this.document.createElement("div");m.appendChild((0,b.parseHTML)(this.document,u.html));const x=m.querySelector("blockquote"),f=(x==null?void 0:x.querySelectorAll("p"))||[],v=Array.from(f).map((M=>`<p>${(0,b.serializeHTML)(M)}</p>`)).join(`
|
|
380
|
+
`),p=u.author_url?`@${u.author_url.split("/").pop()}`:"",h=(0,C.buildContentHtml)("twitter",v,""),w=p||u.author_name,O=v.replace(/<[^>]*>/g,"").trim().slice(0,140).replace(/\s+/g," ");return{content:h,contentHtml:h,variables:{title:this.postTitle(w,"X"),author:w,site:"X (Twitter)",description:O}}}))}tryExtractFxTwitter(){return _(this,void 0,void 0,(function*(){var s,l;const u=this.url.match(/\/([a-zA-Z0-9_][a-zA-Z0-9_]{0,14})\/(status|article)\/(\d+)/);if(!u)return null;try{const m=yield this.fetchFxTwitter(u[1],u[3]);return!((s=m.tweet)===null||s===void 0)&&s.article?this.buildArticleResult(m):!((l=m.tweet)===null||l===void 0)&&l.text?this.buildTweetResult(m):null}catch{return null}}))}fetchFxTwitter(s,l){return _(this,void 0,void 0,(function*(){const u=`https://api.fxtwitter.com/${s}/status/${l}`,m=yield this.fetch(u,{headers:{"User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0; +https://defuddle.md)"}});if(!m.ok)throw new Error(`FxTwitter API request failed: ${m.status}`);return m.json()}))}toDateString(s){if(s)try{return new Date(s).toISOString().split("T")[0]}catch{return}}buildArticleResult(s){var l;const u=s.tweet.article,{blocks:m,entityMap:x}=u.content,f=u.media_entities||[],v=this.renderArticle(m,x,u.cover_media,f),p=`@${s.tweet.author.screen_name}`,h=(l=this.toDateString(u.created_at))!==null&&l!==void 0?l:this.toDateString(s.tweet.created_at);return{content:v,contentHtml:v,variables:Object.assign({title:u.title,author:p,site:"X (Twitter)",description:u.preview_text},h&&{published:h})}}buildTweetResult(s){const l=s.tweet,u=`@${l.author.screen_name}`,m=this.renderTweet(l),x=(0,C.buildContentHtml)("twitter",m,""),f=this.toDateString(l.created_at),v=(l.text||"").trim().slice(0,140).replace(/\s+/g," ");return{content:x,contentHtml:x,variables:Object.assign({title:this.postTitle(u,"X"),author:u,site:"X (Twitter)",description:v},f&&{published:f})}}codePointToUtf16Index(s,l){let u=0,m=0;for(const x of s){if(m>=l)break;u+=x.length,m+=1}return u}adjustFacetIndicesToUtf16(s,l){return l.length===0?l:/[\uD800-\uDBFF]/.test(s)?l.map((u=>{const[m,x]=u.indices;return Object.assign(Object.assign({},u),{indices:[this.codePointToUtf16Index(s,m),this.codePointToUtf16Index(s,x)]})})):l}renderTweet(s){var l,u,m;const x=((l=s.raw_text)===null||l===void 0?void 0:l.text)||s.text,f=(((u=s.raw_text)===null||u===void 0?void 0:u.facets)||[]).filter((O=>O.type!=="media")),v=this.adjustFacetIndicesToUtf16(x,f),p=x.split(/\n\n+/);let h=0;const w=[];for(const O of p){const M=x.indexOf(O,h),$=M+O.length;h=$;const T=O.trimStart().startsWith(">");let D=T?O.trimStart().slice(1).trimStart():O;const R=T?M+(O.length-O.trimStart().length)+1+(O.trimStart().slice(1).length-O.trimStart().slice(1).trimStart().length):M,S=this.applyFacets(D,R,$,v).replace(/\n/g,"<br>");T?w.push(`<blockquote><p>${S}</p></blockquote>`):S.trim()&&w.push(`<p>${S}</p>`)}if(!((m=s.media)===null||m===void 0)&&m.photos)for(const O of s.media.photos)w.push(`<img src="${(0,b.escapeHtml)(O.url)}" alt="">`);return w.join(`
|
|
381
|
+
`)}applyMarkers(s,l){if(l.length===0)return(0,b.escapeHtml)(s);l.sort(((x,f)=>x.offset!==f.offset?x.offset-f.offset:x.type==="close"&&f.type==="open"?-1:x.type==="open"&&f.type==="close"?1:0));let u="",m=0;for(const x of l)x.offset>m&&(u+=(0,b.escapeHtml)(s.slice(m,x.offset))),u+=x.tag,m=x.offset;return m<s.length&&(u+=(0,b.escapeHtml)(s.slice(m))),u}applyFacets(s,l,u,m){const x=[];for(const f of m){const[v,p]=f.indices;if(p<=l||v>=u)continue;const h=Math.max(0,v-l),w=Math.min(s.length,p-l);if(f.type==="italic")x.push({offset:h,type:"open",tag:"<em>"}),x.push({offset:w,type:"close",tag:"</em>"});else if(f.type==="mention"&&f.text){const O=`https://x.com/${(0,b.escapeHtml)(f.text)}`;x.push({offset:h,type:"open",tag:`<a href="${O}">`}),x.push({offset:w,type:"close",tag:"</a>"})}else if(f.type==="url"&&f.original){const O=(0,b.escapeHtml)(f.original);x.push({offset:h,type:"open",tag:`<a href="${O}">`}),x.push({offset:w,type:"close",tag:"</a>"})}}return this.applyMarkers(s,x)}renderArticle(s,l,u,m){var x;const f=[];!((x=u==null?void 0:u.media_info)===null||x===void 0)&&x.original_img_url&&f.push(`<img src="${(0,b.escapeHtml)(u.media_info.original_img_url)}" alt="Cover image">`);let v=0;for(;v<s.length;){const p=s[v];if(p.type==="unordered-list-item"){const w=[];for(;v<s.length&&s[v].type==="unordered-list-item";)w.push(`<li>${this.renderInlineContent(s[v],l)}</li>`),v++;f.push(`<ul>${w.join("")}</ul>`);continue}const h=this.renderBlock(p,l,m);h&&f.push(h),v++}return`<article class="x-article">${f.join(`
|
|
382
|
+
`)}</article>`}renderBlock(s,l,u){switch(s.type){case"unstyled":default:return s.text.trim()?`<p>${this.renderInlineContent(s,l)}</p>`:"";case"header-two":return`<h2>${this.renderInlineContent(s,l)}</h2>`;case"header-three":return`<h3>${this.renderInlineContent(s,l)}</h3>`;case"atomic":return this.renderAtomicBlock(s,l,u)}}renderAtomicBlock(s,l,u){var m,x;if(s.entityRanges.length===0)return"";const f=l.find((p=>p.key===String(s.entityRanges[0].key)));if(!f)return"";const v=f.value;switch(v.type){case"MEDIA":{const p=v.data.mediaItems||[],h=v.data.caption,w=[];for(const O of p){const M=u==null?void 0:u.find((T=>String(T.media_id)===String(O.mediaId)));if(!M)continue;const $=M.media_info;if($.__typename==="ApiImage"&&$.original_img_url)w.push(`<img src="${(0,b.escapeHtml)($.original_img_url)}" alt="${h?(0,b.escapeHtml)(h):""}">`);else if($.__typename==="ApiVideo"&&(!((m=$.preview_image)===null||m===void 0)&&m.original_img_url)){const T=(x=($.variants||[]).filter((R=>R.content_type==="video/mp4"&&R.bit_rate)).sort(((R,S)=>(S.bit_rate||0)-(R.bit_rate||0)))[0])===null||x===void 0?void 0:x.url,D=$.preview_image.original_img_url;T?w.push(`<video src="${(0,b.escapeHtml)(T)}" poster="${(0,b.escapeHtml)(D)}" controls></video>`):w.push(`<img src="${(0,b.escapeHtml)(D)}" alt="${h?(0,b.escapeHtml)(h):""}">`)}}return w.length>0&&h?`<figure>${w.join(`
|
|
383
|
+
`)}<figcaption>${(0,b.escapeHtml)(h)}</figcaption></figure>`:w.length>0?w.map((O=>`<figure>${O}</figure>`)).join(`
|
|
384
|
+
`):h?`<figure><figcaption>${(0,b.escapeHtml)(h)}</figcaption></figure>`:""}case"MARKDOWN":{const p=v.data.markdown||"",h=p.match(/^```(\w*)\n([\s\S]*?)\n?```$/);if(h){const w=h[1],O=h[2];return`<pre><code${w?` class="language-${(0,b.escapeHtml)(w)}" data-lang="${(0,b.escapeHtml)(w)}"`:""}>${(0,b.escapeHtml)(O)}</code></pre>`}return`<pre><code>${(0,b.escapeHtml)(p)}</code></pre>`}default:return""}}renderInlineContent(s,l){var u,m;const x=s.text;if(!x)return"";const f=[];for(const v of s.inlineStyleRanges)v.style==="Bold"&&(f.push({offset:v.offset,type:"open",tag:"<strong>"}),f.push({offset:v.offset+v.length,type:"close",tag:"</strong>"}));for(const v of s.entityRanges){const p=l.find((h=>h.key===String(v.key)));if((p==null?void 0:p.value.type)==="LINK"&&p.value.data.url){const h=(0,b.escapeHtml)(p.value.data.url);f.push({offset:v.offset,type:"open",tag:`<a href="${h}">`}),f.push({offset:v.offset+v.length,type:"close",tag:"</a>"})}}if(!((u=s.data)===null||u===void 0)&&u.mentions)for(const v of s.data.mentions){const p=`https://x.com/${(0,b.escapeHtml)(v.text)}`;f.push({offset:v.fromIndex,type:"open",tag:`<a href="${p}">`}),f.push({offset:v.toIndex,type:"close",tag:"</a>"})}if(!((m=s.data)===null||m===void 0)&&m.urls)for(const v of s.data.urls){const p=(0,b.escapeHtml)(v.text);f.push({offset:v.fromIndex,type:"open",tag:`<a href="${p}">`}),f.push({offset:v.toIndex,type:"close",tag:"</a>"})}return this.applyMarkers(x,f)}}d.XOembedExtractor=A},3258(c,d,g){var _=this&&this.__awaiter||function(S,y,k,N){return new(k||(k=Promise))((function(L,P){function B(I){try{F(N.next(I))}catch(H){P(H)}}function U(I){try{F(N.throw(I))}catch(H){P(H)}}function F(I){var H;I.done?L(I.value):(H=I.value,H instanceof k?H:new k((function(V){V(H)}))).then(B,U)}F((N=N.apply(S,y||[])).next())}))};Object.defineProperty(d,"__esModule",{value:!0}),d.YoutubeExtractor=void 0;const E=g(2279),b=g(639),C=g(2552),A=g(1497),a="」』)",s=new RegExp(`[.!?。!?]["'\\u2019\\u201D)${a}]*\\s*$`),l=new RegExp(`[?\\uFF1F]["'\\u2019\\u201D)${a}]*\\s*$`),u=/^(>>|-\s)/,m=/^(>>\s*|-\s+)/,x=/,\s*$/,f=new RegExp(`^(.*[.!?]["'\\u2019\\u201D)]*)\\s+([A-Z].*)$|^(.*[。!?][${a}]*)([${C.CJK_CHAR_RANGES}].*)$`),v=4e3,p="https://www.youtube.com/youtubei/v1/player?prettyPrint=false",h="20.10.38",w={client:{clientName:"ANDROID",clientVersion:h}},O=`com.google.android.youtube/${h} (Linux; U; Android 14)`,M={client:{clientName:"IOS",clientVersion:"20.10.3"}},$={client:{clientName:"WEB",clientVersion:"2.20240101.00.00"}},T={segments:"ytd-transcript-segment-renderer",timestamp:".segment-timestamp",text:".segment-text"},D={segments:"transcript-segment-view-model",timestamp:".ytwTranscriptSegmentViewModelTimestamp",text:"span.yt-core-attributed-string",chapters:"timeline-chapter-view-model h3"};class R extends E.BaseExtractor{constructor(){super(...arguments),this.inlineJsonCache=new Map}canExtract(){return!0}canExtractAsync(){return!0}prefersAsync(){return!0}extract(){return this.buildResult(this.extractTranscriptFromExistingDom())}extractAsync(){return _(this,void 0,void 0,(function*(){const y=this.extractTranscriptFromExistingDom();if(this.shouldUseExistingDomTranscript(y))return this.buildResult(y);const k=(yield this.fetchTranscript())||y||(yield this.extractTranscriptFromOpenedDom());return this.buildResult(k)}))}normalizeLanguageCode(y){return(y||"").trim().replace(/_/g,"-").toLocaleLowerCase()}languageCodeMatchesPreference(y,k){const N=this.normalizeLanguageCode(y),L=this.normalizeLanguageCode(k);if(!N||!L)return!1;if(N===L)return!0;const P=N.split("-")[0],B=L.split("-")[0];return P===B&&(N===P||L===B)}shouldUseExistingDomTranscript(y){return!!y&&(!this.options.language||this.languageCodeMatchesPreference(y.languageCode,this.options.language))}getCaptionTracks(y){var k,N;const L=(N=(k=y==null?void 0:y.captions)===null||k===void 0?void 0:k.playerCaptionsTracklistRenderer)===null||N===void 0?void 0:N.captionTracks;return Array.isArray(L)?L:[]}findPreferredCaptionTrack(y,k){var N,L;const P=this.normalizeLanguageCode(k);if(!P)return;const B=P.split("-")[0],U=y.map((I=>({t:I,code:this.normalizeLanguageCode(I.languageCode)}))),F=I=>{var H,V;const X=U.filter(I);return(V=(H=X.find((({t:ne})=>ne.kind!=="asr")))!==null&&H!==void 0?H:X[0])===null||V===void 0?void 0:V.t};return(L=(N=F((({code:I})=>I===P)))!==null&&N!==void 0?N:F((({code:I})=>I===B)))!==null&&L!==void 0?L:F((({code:I})=>I.split("-")[0]===B))}languageBase(y){return this.normalizeLanguageCode(y).split("-")[0]}isEnglishTrack(y){return this.languageBase(y==null?void 0:y.languageCode)==="en"}getDefaultCaptionTrack(y,k){var N,L,P;const B=(N=k==null?void 0:k.captions)===null||N===void 0?void 0:N.playerCaptionsTracklistRenderer;if(!B||y.length===0)return;const U=Array.isArray(B.audioTracks)?B.audioTracks:[],F=(L=U[typeof B.defaultAudioTrackIndex=="number"?B.defaultAudioTrackIndex:0])!==null&&L!==void 0?L:U[0],I=(P=F==null?void 0:F.defaultCaptionTrackIndex)!==null&&P!==void 0?P:B.defaultCaptionTrackIndex;return typeof I!="number"||I<0||I>=y.length?void 0:y[I]}getOriginalLanguageTrack(y){const k=y.find((P=>P.kind==="asr")),N=this.languageBase(k==null?void 0:k.languageCode);if(!N)return;const L=y.find((P=>P.kind!=="asr"&&this.languageBase(P.languageCode)===N));return L??k}pickCaptionTrack(y,k){if(!y.length)return;const N=this.options.language;if(N){const F=this.findPreferredCaptionTrack(y,N);if(F)return F}const L=this.getDefaultCaptionTrack(y,k);if(L)return L;const P=this.getOriginalLanguageTrack(y);if(P)return P;const B=y.filter((F=>F.kind!=="asr")),U=B.length>0?B:y;return U.find((F=>this.isEnglishTrack(F)))||U[0]}getTrackDisplayName(y){var k,N,L;return((k=y==null?void 0:y.name)===null||k===void 0?void 0:k.simpleText)||((L=(N=y==null?void 0:y.name)===null||N===void 0?void 0:N.runs)===null||L===void 0?void 0:L.map((P=>(P==null?void 0:P.text)||"")).join("").trim())||""}normalizeLanguageLabel(y){return y.replace(/\s*\([^)]*\)\s*/g," ").replace(/\s+/g," ").trim().toLocaleLowerCase()}getTranscriptLanguageCodeFromDom(){var y;const k=this.document.querySelector('ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-searchable-transcript"] #footer yt-sort-filter-sub-menu-renderer yt-dropdown-menu button'),N=(y=k==null?void 0:k.textContent)===null||y===void 0?void 0:y.trim(),L=this.getCaptionTracks(this.getValidatedPlayerResponse()),P=L.length===1?L[0]:void 0;if(!N)return P==null?void 0:P.languageCode;const B=this.normalizeLanguageLabel(N),U=L.find((F=>this.normalizeLanguageLabel(this.getTrackDisplayName(F))===B));return(U==null?void 0:U.languageCode)||(P==null?void 0:P.languageCode)}getInlineChapters(){var y,k,N,L;const P=this.getVideoId(),B=this.parseInlineJson("ytInitialData");if(!B)return[];if(P){const F=(k=(y=B==null?void 0:B.currentVideoEndpoint)===null||y===void 0?void 0:y.watchEndpoint)===null||k===void 0?void 0:k.videoId,I=(L=(N=B==null?void 0:B.endpoint)===null||N===void 0?void 0:N.watchEndpoint)===null||L===void 0?void 0:L.videoId;if(F!==P&&I!==P)return[]}const U=this.extractChaptersFromPlayerBar(B);return U.length>0?U:this.extractChaptersFromEngagementPanels(B)}getTranscriptContainer(){return this.document.querySelector('ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-searchable-transcript"] #segments-container')||this.document.querySelector("ytm-macro-markers-list-renderer .ytm-macro-markers-list-container")}getTranscriptSelectors(y){return y.querySelectorAll("ytd-transcript-segment-renderer").length>0?T:y.querySelectorAll("transcript-segment-view-model").length>0?D:void 0}buildTranscriptFromContainer(y,k){var N;if(y.children.length===0)return;const L=this.getTranscriptSelectors(y);if(!L)return;const P=[],B=[];if(L.chapters){const X=y.querySelectorAll(L.chapters);for(const ne of X){const Y=(ne.textContent||"").trim();if(!Y)continue;const W=ne.closest("macro-markers-panel-item-view-model"),J=(N=W==null?void 0:W.nextElementSibling)===null||N===void 0?void 0:N.querySelector(L.timestamp),G=((J==null?void 0:J.textContent)||"").trim(),Q=this.parseTimestamp(G);Q!==null&&B.push({title:Y,start:Q})}}const U=y.querySelectorAll(L.segments);for(const X of U){const ne=X.querySelector(L.timestamp),Y=X.querySelector(L.text);if(!ne||!Y)continue;const W=(ne.textContent||"").trim(),J=(Y.textContent||"").trim();if(!J)continue;const G=this.parseTimestamp(W);G!==null&&P.push({start:G,text:J})}if(P.length===0)return;const F=k.length>0?k:B,I=this.groupTranscriptSegments(P),{html:H,text:V}=(0,A.buildTranscript)("youtube",I,F);return{html:H,text:V,languageCode:this.getTranscriptLanguageCodeFromDom()}}extractTranscriptFromExistingDom(){try{const y=this.getTranscriptContainer();return y?this.buildTranscriptFromContainer(y,this.getInlineChapters()):void 0}catch(y){return void console.error("YoutubeExtractor: failed to extract transcript from existing DOM",y)}}canOpenTranscriptPanel(){var y;return typeof((y=this.document.defaultView)===null||y===void 0?void 0:y.MutationObserver)=="function"}buildResult(y){const k=this.getVideoData(),N=this.getChannelName(k),L=k.description||"",P=this.formatDescription(L);let B=`<iframe width="560" height="315" src="https://www.youtube.com/embed/${this.getVideoId()}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>${P}`;y!=null&&y.html&&(B+=y.html);const U={title:k.name||"",author:N,site:"YouTube",image:Array.isArray(k.thumbnailUrl)&&k.thumbnailUrl[0]||"",published:k.uploadDate,description:L.slice(0,200).trim()};return y!=null&&y.text&&(U.transcript=y.text),y!=null&&y.languageCode&&(U.language=y.languageCode),{content:B,contentHtml:B,extractedContent:{videoId:this.getVideoId(),author:N},variables:U}}formatDescription(y){return`<p>${(0,b.escapeHtml)(y).replace(/\n/g,"<br>")}</p>`}getVideoData(){var y,k,N,L;const P=this.getVideoId(),B=Array.from(this.document.querySelectorAll('script[type="application/ld+json"]'));let U;for(const F of B)try{const I=JSON.parse(F.textContent||""),H=(Array.isArray(I)?I:[I]).find((V=>V["@type"]!=="VideoObject"?!1:P?(V["@id"]||V.url||V.embedUrl||"").includes(P):!0));if(H&&H.description)return H;!H||!H.comment&&U||(U=H)}catch{}return U||(P&&(((y=this.document.querySelector('meta[property="og:url"]'))===null||y===void 0?void 0:y.getAttribute("content"))||"").includes(P)?{name:((k=this.document.querySelector('meta[property="og:title"]'))===null||k===void 0?void 0:k.getAttribute("content"))||"",description:((N=this.document.querySelector('meta[property="og:description"]'))===null||N===void 0?void 0:N.getAttribute("content"))||"",thumbnailUrl:((L=this.document.querySelector('meta[property="og:image"]'))===null||L===void 0?void 0:L.getAttribute("content"))||""}:{})}getChannelName(y){const k=this.getChannelNameFromDom();return k||this.getChannelNameFromPlayerResponse()||(y==null?void 0:y.author)||""}getChannelNameFromDom(){var y;const k=['ytd-video-owner-renderer #channel-name a[href^="/@"]','#owner-name a[href^="/@"]'];for(const N of k){const L=this.document.querySelector(N),P=(y=L==null?void 0:L.textContent)===null||y===void 0?void 0:y.trim();if(P)return P}return this.getChannelNameFromMicrodata()}getChannelNameFromMicrodata(){var y;const k=this.document.querySelector('[itemprop="author"]');if(!k)return"";const N=k.querySelector('meta[itemprop="name"]');if(N!=null&&N.getAttribute("content"))return N.getAttribute("content").trim();const L=k.querySelector('link[itemprop="name"]');if(L!=null&&L.getAttribute("content"))return L.getAttribute("content").trim();const P=k.querySelector('[itemprop="name"], a, span');return((y=P==null?void 0:P.textContent)===null||y===void 0?void 0:y.trim())||""}getChannelNameFromPlayerResponse(){var y,k,N,L;const P=this.getValidatedPlayerResponse();return P&&(((y=P.videoDetails)===null||y===void 0?void 0:y.author)||((k=P.videoDetails)===null||k===void 0?void 0:k.ownerChannelName)||((L=(N=P.microformat)===null||N===void 0?void 0:N.playerMicroformatRenderer)===null||L===void 0?void 0:L.ownerChannelName))||""}getValidatedPlayerResponse(){var y,k,N;const L=this.getVideoId();if(!L)return null;const P=this.parseInlineJson("ytInitialPlayerResponse");if(!P)return null;const B=(y=P.videoDetails)===null||y===void 0?void 0:y.videoId,U=(N=(k=P.microformat)===null||k===void 0?void 0:k.playerMicroformatRenderer)===null||N===void 0?void 0:N.externalVideoId;return B===L||U===L?P:null}parseInlineJson(y){if(this.inlineJsonCache.has(y))return this.inlineJsonCache.get(y);const k=Array.from(this.document.querySelectorAll("script"));for(const N of k){const L=N.textContent||"";if(!L.includes(y))continue;const P=L.indexOf("{",L.indexOf(y));if(P===-1)continue;let B=0;for(let U=P;U<L.length;U++){const F=L[U];if(F==="{")B+=1;else if(F==="}"&&(B-=1,B===0)){const I=L.slice(P,U+1);try{const H=JSON.parse(I);return this.inlineJsonCache.set(y,H),H}catch(H){console.error("YoutubeExtractor: failed to parse inline JSON",H);break}}}}return null}fetchTranscript(){return _(this,void 0,void 0,(function*(){try{const y=this.getVideoId();if(!y)return;const k=this.fetchChapters(y),N=this.getInlineCaptionTrack(),L=N?this.fetchCaptionXml(N,k):void 0,P=yield this.fetchPlayerData(y),B=P?this.pickCaptionTrack(this.getCaptionTracks(P),P):void 0,U=B!=null&&B.baseUrl&&B.baseUrl!==(N==null?void 0:N.baseUrl)?this.fetchCaptionXml(B,k):void 0;return(U?yield U:void 0)||(L?yield L:void 0)}catch(y){return void console.error("YoutubeExtractor: failed to fetch transcript",y)}}))}getInlineCaptionTrack(){const y=this.getValidatedPlayerResponse(),k=this.getCaptionTracks(y);if(k.length===0)return;const N=this.pickCaptionTrack(k,y);return N!=null&&N.baseUrl?N:void 0}fetchCaptionXml(y,k){return _(this,void 0,void 0,(function*(){try{if(!new URL(y.baseUrl).hostname.endsWith(".youtube.com"))return;const N={"User-Agent":"Mozilla/5.0"};this.options.language&&(N["Accept-Language"]=this.options.language);const L=yield this.fetch(y.baseUrl,{headers:N,signal:AbortSignal.timeout(v)});if(!L.ok)return;let P;try{P=yield L.text()}catch{return}if(!P)return;const B=yield k;return this.parseTranscriptXml(P,y.languageCode||"en",B)}catch{return}}))}pollFor(y,k=20){return new Promise((N=>{let L=0;const P=()=>{const B=y();B?N(B):L++<k?setTimeout(P,250):N(null)};P()}))}waitForTranscriptSegments(){return this.pollFor((()=>{const y=this.getTranscriptContainer();return y&&y.children.length!==0&&y.querySelectorAll(D.segments).length>0?y:null}))}waitForTranscriptContainer(){return this.pollFor((()=>{const y=this.getTranscriptContainer();return y&&y.children.length>0?y:null}))}waitForElement(y){return this.pollFor((()=>this.document.querySelector(y)))}isMobileYoutube(){return!!this.document.querySelector("ytm-slim-video-metadata-section-renderer")}extractTranscriptFromOpenedDom(){return _(this,void 0,void 0,(function*(){try{if(!this.canOpenTranscriptPanel())return;if(this.isMobileYoutube())return this.openMobileTranscriptPanel();const y=this.document.querySelector("ytd-video-description-transcript-section-renderer button");if(!y)return;y.click();const k=yield this.waitForTranscriptContainer();if(!k)return;const N=this.getVideoId(),L=N?yield this.fetchChapters(N):this.getInlineChapters();return this.buildTranscriptFromContainer(k,L)}catch(y){return void console.error("YoutubeExtractor: failed to extract transcript from opened DOM",y)}}))}openMobileTranscriptPanel(){return _(this,void 0,void 0,(function*(){try{const y=this.document.querySelector('button[aria-label="Show more"]');y&&y.click();const k=yield this.waitForElement('button[aria-label="View all"]');if(!k)return;k.click();const N=yield this.waitForElement('button[aria-label="Timeline"]');if(!N)return;N.click();const L=yield this.waitForTranscriptSegments();return L?this.buildTranscriptFromContainer(L,[]):void 0}catch(y){return void console.error("YoutubeExtractor: failed to open mobile transcript panel",y)}}))}fetchPlayerData(y){return _(this,void 0,void 0,(function*(){try{const N={"Content-Type":"application/json"};this.options.language&&(N["Accept-Language"]=this.options.language);const L=yield this.fetch(p,{method:"POST",headers:N,signal:AbortSignal.timeout(v),body:JSON.stringify({context:M,videoId:y})});if(L.ok){const P=yield L.json();if(this.getCaptionTracks(P).length>0)return P}}catch{}try{const N={"Content-Type":"application/json","User-Agent":O};this.options.language&&(N["Accept-Language"]=this.options.language);const L=yield this.fetch(p,{method:"POST",headers:N,signal:AbortSignal.timeout(v),body:JSON.stringify({context:w,videoId:y})});if(L.ok){const P=yield L.json();if(this.getCaptionTracks(P).length>0)return P}}catch{}try{const N={"Content-Type":"application/json"};this.options.language&&(N["Accept-Language"]=this.options.language);const L=yield this.fetch(p,{method:"POST",headers:N,signal:AbortSignal.timeout(v),body:JSON.stringify({context:$,videoId:y})});if(L.ok){const P=yield L.json();if(this.getCaptionTracks(P).length>0)return P}}catch{}const k=this.parseInlineJson("ytInitialPlayerResponse");if(this.getCaptionTracks(k).length>0)return k}))}fetchChapters(y){return _(this,void 0,void 0,(function*(){const k=this.getInlineChapters();if(k.length>0)return k;try{const N={"Content-Type":"application/json"};this.options.language&&(N["Accept-Language"]=this.options.language);const L=yield this.fetch("https://www.youtube.com/youtubei/v1/next?prettyPrint=false",{method:"POST",headers:N,signal:AbortSignal.timeout(v),body:JSON.stringify({context:$,videoId:y})});if(!L.ok)return[];const P=yield L.json(),B=this.extractChaptersFromPlayerBar(P);return B.length>0?B:this.extractChaptersFromEngagementPanels(P)}catch{return[]}}))}extractChaptersFromPlayerBar(y){var k,N,L,P,B,U,F,I;const H=[],V=(U=(B=(P=(L=(N=(k=y==null?void 0:y.playerOverlays)===null||k===void 0?void 0:k.playerOverlayRenderer)===null||N===void 0?void 0:N.decoratedPlayerBarRenderer)===null||L===void 0?void 0:L.decoratedPlayerBarRenderer)===null||P===void 0?void 0:P.playerBar)===null||B===void 0?void 0:B.multiMarkersPlayerBarRenderer)===null||U===void 0?void 0:U.markersMap;if(!Array.isArray(V))return H;for(const X of V){const ne=(F=X==null?void 0:X.value)===null||F===void 0?void 0:F.chapters;if(Array.isArray(ne))for(const Y of ne){const W=Y==null?void 0:Y.chapterRenderer;if(!W)continue;const J=((I=W.title)===null||I===void 0?void 0:I.simpleText)||"",G=W.timeRangeStartMillis;J&&typeof G=="number"&&H.push({title:J,start:G/1e3})}}return H}extractChaptersFromEngagementPanels(y){var k,N,L,P;const B=[],U=y==null?void 0:y.engagementPanels;if(!Array.isArray(U))return B;for(const F of U){const I=(k=F==null?void 0:F.engagementPanelSectionListRenderer)===null||k===void 0?void 0:k.content,H=(N=I==null?void 0:I.macroMarkersListRenderer)===null||N===void 0?void 0:N.contents;if(Array.isArray(H))for(const V of H){const X=V==null?void 0:V.macroMarkersListItemRenderer;if(!X)continue;const ne=((L=X.title)===null||L===void 0?void 0:L.simpleText)||"",Y=((P=X.timeDescription)===null||P===void 0?void 0:P.simpleText)||"";if(!ne||!Y)continue;const W=this.parseTimestamp(Y);W!==null&&B.push({title:ne,start:W})}}return B}parseTimestamp(y){const k=y.split(":").map(Number);return k.some(isNaN)?null:k.length===3?3600*k[0]+60*k[1]+k[2]:k.length===2?60*k[0]+k[1]:null}parseTranscriptXml(y,k,N=[]){const L=[],P=/<p\s+t="(\d+)"[^>]*>([\s\S]*?)<\/p>/g;let B;for(;(B=P.exec(y))!==null;){const H=parseInt(B[1],10),V=B[2];let X="";const ne=/<s[^>]*>([^<]*)<\/s>/g;let Y;for(;(Y=ne.exec(V))!==null;)X+=Y[1];X||(X=V.replace(/<[^>]+>/g,"")),X=X.replace(/\n/g," ").replace(/\s{2,}/g," "),X=this.decodeEntities(X),X.trim()&&L.push({start:H/1e3,text:X.trim()})}if(L.length===0){const H=/<text\s+start="([^"]*)"[^>]*>([\s\S]*?)<\/text>/g;for(;(B=H.exec(y))!==null;){const V=parseFloat(B[1]);let X=this.decodeEntities(B[2].replace(/<[^>]+>/g,"").replace(/\n/g," ").replace(/\s{2,}/g," "));X.trim()&&L.push({start:V,text:X.trim()})}}if(L.length===0)return;const U=this.groupTranscriptSegments(L),{html:F,text:I}=(0,A.buildTranscript)("youtube",U,N);return{html:F,text:I,languageCode:k}}decodeEntities(y){return y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&#x([0-9a-fA-F]+);/g,((k,N)=>String.fromCodePoint(parseInt(N,16)))).replace(/&#(\d+);/g,((k,N)=>String.fromCodePoint(parseInt(N,10))))}getVideoId(){if(this._videoId===void 0){const y=new URL(this.url);this._videoId=y.hostname==="youtu.be"?y.pathname.slice(1):y.pathname.includes("/shorts/")?y.pathname.split("/shorts/")[1].split("/")[0]:new URLSearchParams(y.search).get("v")||""}return this._videoId}groupTranscriptSegments(y){return y.length===0?[]:y.some((k=>u.test(k.text)))?this.groupBySpeaker(y):this.groupBySentence(y)}groupBySpeaker(y){const k=[];let N=null,L=-1,P="";for(const U of y){const F=u.test(U.text),I=U.text.replace(m,""),H=x.test(P),V=(s.test(P)||!P)&&!H;F&&V?(N&&k.push(N),L=(L+1)%2,N={start:U.start,segments:[{start:U.start,text:I}],speakerChange:!0,speaker:L}):(N||(N={start:U.start,segments:[],speakerChange:!1}),N.segments.push({start:U.start,text:I})),P=I}N&&k.push(N),this.splitAffirmativeTurns(k);const B=[];for(const U of k){const F=U.speaker===void 0?this.groupBySentence(U.segments):this.mergeSentenceGroupsWithinTurn(this.groupBySentence(U.segments));for(let I=0;I<F.length;I++)B.push(Object.assign(Object.assign({},F[I]),{speakerChange:I===0&&U.speakerChange,speaker:U.speaker}))}return B}splitAffirmativeTurns(y){const k=/^(mhm|yeah|yes|yep|right|okay|ok|absolutely|sure|exactly|uh-huh|mm-hmm)[.!,]?\s+/i;for(let N=0;N<y.length;N++){const L=y[N];if(L.speaker===void 0||L.segments.length===0)continue;const P=L.segments[0],B=k.exec(P.text);if(!B||/,\s*$/.test(B[0]))continue;const U=P.text.slice(B[0].length).trim(),F=L.segments.slice(1);if((0,C.countWords)(U)+F.reduce(((ne,Y)=>ne+(0,C.countWords)(Y.text)),0)<30)continue;const I=B[0].trimEnd(),H=U?[{start:P.start,text:U},...F]:F,V={start:L.start,segments:[{start:P.start,text:I}],speakerChange:L.speakerChange,speaker:L.speaker},X={start:H[0].start,segments:H,speakerChange:!0,speaker:L.speaker===0?1:0};y.splice(N,1,V,X),N++}}mergeSentenceGroupsWithinTurn(y){if(y.length<=1)return y;const k=[];let N=Object.assign({},y[0]),L=!0;for(let P=1;P<y.length;P++){const B=y[P];this.shouldMergeSentenceGroups(N,B,L)?N.text=`${N.text} ${B.text}`:(k.push(N),N=Object.assign({},B),L=!1)}return k.push(N),k}shouldMergeSentenceGroups(y,k,N){const L=(0,C.countWords)(y.text),P=(0,C.countWords)(k.text);return!this.isShortStandaloneUtterance(y.text,L)&&!this.isShortStandaloneUtterance(k.text,P)&&!(N&&L<8)&&!l.test(y.text)&&!l.test(k.text)&&!(L+P>80)&&!(k.start-y.start>45)}isShortStandaloneUtterance(y,k){const N=k??(0,C.countWords)(y);return N>0&&N<=3&&s.test(y)}groupBySentence(y){const k=[],N=[],L=U=>{const F=U.map((I=>I.text)).join(" ").trim();F&&k.push({start:U[0].start,text:F,speakerChange:!1})},P=()=>{N.length!==0&&(L(N),N.length=0)};for(const U of y)if(N.length>0&&U.start-N[N.length-1].start>20&&P(),N.push(U),s.test(U.text))P();else if(U.start-N[0].start>=30){const F=this.findNaturalBreak(N);F>0&&F<N.length?(B=F)<=0||L(N.splice(0,B)):P()}var B;return P(),k}findNaturalBreak(y){var k,N;if(y.length<=1)return-1;const L=y[0].start+15;for(let U=y.length-1;U>=0&&!(y[U].start<L);U--){const F=y[U].text.match(f);if(F){const I=(k=F[1])!==null&&k!==void 0?k:F[3],H=(N=F[2])!==null&&N!==void 0?N:F[4],V=y[U].start;return y.splice(U,1,{start:V,text:I},{start:V,text:H}),U+1}}let P=-1,B=0;for(let U=1;U<y.length;U++){if(y[U].start<L)continue;const F=y[U].start-y[U-1].start;F>=B&&(B=F,P=U)}return P}}d.YoutubeExtractor=R},1608(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.MetadataExtractor=void 0;const _=g(2552);class E{static extract(C,A,a,s){var l,u;let m="",x="";try{if(x=[s,(l=C.location)===null||l===void 0?void 0:l.href,C.URL].find((M=>M&&M!=="about:blank"))||"",x||(x=this.getMetaContent(a,"property","og:url")||this.getMetaContent(a,"property","twitter:url")||this.getSchemaProperty(A,"url")||this.getSchemaProperty(A,"mainEntityOfPage.url")||this.getSchemaProperty(A,"mainEntity.url")||this.getSchemaProperty(A,"WebSite.url")||((u=C.querySelector('link[rel="canonical"]'))===null||u===void 0?void 0:u.getAttribute("href"))||""),x)try{m=new URL(x).hostname.replace(/^www\./,"")}catch(M){console.warn("Failed to parse URL:",M)}}catch{const $=C.querySelector("base[href]");if($)try{x=$.getAttribute("href")||"",m=new URL(x).hostname.replace(/^www\./,"")}catch(T){console.warn("Failed to parse base URL:",T)}}const f=this.getSiteName(A,a),{title:v,detectedSiteName:p}=this.cleanTitle(this.getBestTitle(C,A,a,m,f),f),h=this.getAuthor(C,A,a),w=h&&!h.includes(",")?h:"",O=f||p||w||m||"";return{title:v,description:this.getDescription(A,a),domain:m,favicon:this.getFavicon(C,x,a),image:this.getImage(A,a),language:this.getLanguage(C,A,a),published:this.getPublished(C,A,a,x),author:h,site:O,schemaOrgData:A,wordCount:0,parseTime:0}}static isPlaceholderValue(C){return!(!/[{}]/.test(C)&&!/^#[a-zA-Z]/.test(C))||!/[\p{L}\p{N}]/u.test(C)}static firstValid(C){for(const A of C){const a=A();if(a&&!this.isPlaceholderValue(a))return a}return""}static getAuthor(C,A,a){var s,l,u;let m;if(m=this.firstValid([()=>this.getMetaContent(a,"name","sailthru.author"),()=>this.getMetaContent(a,"property","article:author"),()=>this.getMetaContent(a,"property","author"),()=>this.getMetaContent(a,"name","author"),()=>this.getMetaContent(a,"name","byl"),()=>this.getMetaContent(a,"name","authorList")]),m){const M=this.cleanAuthorString(m);if(M)return M}let x=this.getMetaContents(a,"name","citation_author").filter((M=>!this.isPlaceholderValue(M)));if(x.length===0&&(x=this.getMetaContents(a,"property","dc.creator").filter((M=>!this.isPlaceholderValue(M)))),x.length>0)return m=x.map((M=>{if(!M.includes(","))return M.trim();const $=/(.*),\s(.*)/.exec(M);return $&&$.length===3?`${$[2]} ${$[1]}`:M.trim()})).join(", "),m;let f=this.getSchemaProperty(A,"author.name")||this.getSchemaProperty(A,"author.[].name");if(f){const M=f.split(",").map(($=>$.trim().replace(/,$/,"").trim())).filter(($=>$&&!this.isPlaceholderValue($)));if(M.length>0){let $=[...new Set(M)];return $.length>10&&($=$.slice(0,10)),$.join(", ")}}const v=C.querySelectorAll('a[rel~="author"], address[rel~="author"]');if(v.length>0&&v.length<=3){const M=[];v.forEach((T=>{const D=this.getVisibleText(T),R=D.toLowerCase();D&&D.length<100&&R!=="author"&&R!=="authors"&&!this.isPlaceholderValue(D)&&M.push(D)}));const $=[...new Set(M)];if($.length>0)return $.join(", ")}const p=[],h=M=>{M&&M.split(",").forEach(($=>{const T=$.replace(/\s+/g," ").trim().replace(/,$/,"").trim(),D=T.toLowerCase();T&&D!=="author"&&D!=="authors"&&!this.isPlaceholderValue(T)&&p.push(T)}))},w=[{selector:'[itemprop="author"]'},{selector:".author",maxMatches:3},{selector:'[href*="/author/"]',maxMatches:3},{selector:".authors a",maxMatches:3}];for(const{selector:M,maxMatches:$}of w){const T=C.querySelectorAll(M);$&&T.length>$||T.forEach((D=>h(this.getAuthorName(D))))}if(p.length>0){let M=[...new Set(p.map(($=>$.trim())).filter(Boolean))];if(M.length>1&&(M=M.filter(($=>!M.some((T=>T!==$&&$.includes(T)))))),M.length>0)return M.length>10&&(M=M.slice(0,10)),M.join(", ")}const O=C.querySelector("h1");if(O){let M=O.nextElementSibling;for(let T=0;T<3&&M;T++){const D=((s=M.textContent)===null||s===void 0?void 0:s.trim())||"",R=Array.from(M.querySelectorAll("p, time")),S=R.some((y=>{var k;return!!this.parseDateText(((k=y.textContent)===null||k===void 0?void 0:k.trim())||"")}));if(this.parseDateText(D)||S){const y=M.querySelectorAll("a");if(y.length===1){const k=(((l=y[0].textContent)===null||l===void 0?void 0:l.trim())||"").replace(/\u00a0/g," ");if(k.length>0&&k.length<100&&!this.parseDateText(k))return k}if(S&&D.length<300)for(const k of R){if(k.tagName!=="P")continue;const N=(((u=k.textContent)===null||u===void 0?void 0:u.trim())||"").replace(/\u00a0/g," ");if(N.length>0&&N.length<150&&!this.parseDateText(N))return N}}M=M.nextElementSibling}let $=O;for(let T=0;T<3&&$;T++){let D=$.previousElementSibling;for(let R=0;R<3&&D;R++){const S=this.extractByline(D);if(S)return S;D=D.previousElementSibling}D=$.nextElementSibling;for(let R=0;R<3&&D;R++){const S=this.extractByline(D);if(S)return S;D=D.nextElementSibling}$=$.parentElement}}return""}static extractByline(C){var A;const a=[C,...C.querySelectorAll("p, span, address")];for(const s of a){const l=(((A=s.textContent)===null||A===void 0?void 0:A.trim())||"").replace(/\u00a0/g," ");if(l.length>0&&l.length<50){const u=l.match(/^By\s+([A-Z].+)$/i);if(u)return u[1].trim()}}return null}static cleanAuthorString(C){return(C=(C=(C=(C=C.replace(/^by\s+/i,"")).replace(/\(?\s*https?:\/\/\S+\s*\)?/gi,"")).replace(/,?\s+and\s+/gi,", ")).replace(/\s*[-\u2013\u2014|]\s*$/g,"")).trim()}static getSiteName(C,A){const a=this.firstValid([()=>this.getSchemaProperty(C,"publisher.name"),()=>this.getMetaContent(A,"property","og:site_name"),()=>this.getMetaContent(A,"name","og:site_name"),()=>this.getSchemaProperty(C,"WebSite.name"),()=>this.getSchemaProperty(C,"sourceOrganization.name"),()=>this.getMetaContent(A,"name","copyright"),()=>this.getSchemaProperty(C,"copyrightHolder.name"),()=>this.getSchemaProperty(C,"isPartOf.name"),()=>this.getMetaContent(A,"name","application-name")]);return a&&(0,_.countWords)(a)>6?"":a}static getBestTitle(C,A,a,s,l){var u,m,x,f,v;const p=[this.getMetaContent(a,"property","og:title"),this.getMetaContent(a,"name","twitter:title"),this.getSchemaProperty(A,"headline"),this.getMetaContent(a,"name","title"),this.getMetaContent(a,"name","sailthru.title"),((m=(u=C.querySelector("title"))===null||u===void 0?void 0:u.textContent)===null||m===void 0?void 0:m.trim())||"",((f=(x=C.querySelector("h1"))===null||x===void 0?void 0:x.textContent)===null||f===void 0?void 0:f.trim())||""].filter((M=>M&&!this.isPlaceholderValue(M)));if(p.length===0)return"";const h=(this.getMetaContent(a,"property","author")||this.getMetaContent(a,"name","author")).trim().toLowerCase(),w=l.trim().toLowerCase(),O=s?s.replace(/\.[^.]+$/,"").toLowerCase().replace(/[^a-z0-9]/g,""):"";return(v=p.find((M=>!this.isSiteIdentifier(M,h,w,O))))!==null&&v!==void 0?v:p[0]}static isSiteIdentifier(C,A,a,s){const l=C.trim().toLowerCase();return!!(A&&l===A||a&&l===a||s&&l.replace(/[^a-z0-9]/g,"")===s)}static cleanTitle(C,A){if(!C)return{title:C,detectedSiteName:""};const a="[|\\-–—/·]";if(A&&A.toLowerCase()!==C.toLowerCase()&&(0,_.countWords)(A)<=6){const u=A.toLowerCase(),m=A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=[`\\s*${a}\\s*${m}\\s*$`,`^\\s*${m}\\s*${a}\\s*`];for(const h of x){const w=new RegExp(h,"i");if(w.test(C))return{title:C.replace(w,"").trim(),detectedSiteName:A}}const f=new RegExp(`\\s+${a}\\s+`,"g");let v;const p=[];for(;(v=f.exec(C))!==null;)p.push({index:v.index,length:v[0].length});if(p.length>0){const h=p[p.length-1],w=C.substring(h.index+h.length).trim().toLowerCase();if(w&&u.includes(w)){let $=h.index;for(let T=p.length-2;T>=0;T--){const D=p[T],R=C.substring(D.index+D.length,$).trim();if((0,_.countWords)(R)>3)break;$=D.index}return{title:C.substring(0,$).trim(),detectedSiteName:A}}const O=p[0],M=C.substring(0,O.index).trim().toLowerCase();if(M&&u.includes(M)){let $=O.index+O.length;for(let T=1;T<p.length;T++){const D=p[T],R=C.substring($,D.index).trim();if((0,_.countWords)(R)>3)break;$=D.index+D.length}return{title:C.substring($).trim(),detectedSiteName:A}}}}const s=this.trySeparatorSplit(C,/\s+([|/\xb7])\s+/g,{guard:(u,m)=>m<=3&&u>=2&&u>=2*m});return s||this.trySeparatorSplit(C,/\s+[-\u2013\u2014]\s+/g,{suffixOnly:!0,guard:(u,m)=>m<=2&&u>=2&&u>m})||{title:C.trim(),detectedSiteName:""}}static trySeparatorSplit(C,A,a){let s;const l=[];for(;(s=A.exec(C))!==null;)l.push({index:s.index,length:s[0].length});if(l.length===0)return null;const u=l[l.length-1],m=C.substring(0,u.index).trim(),x=C.substring(u.index+u.length).trim();if(a.guard((0,_.countWords)(m),(0,_.countWords)(x)))return{title:m,detectedSiteName:x};if(!a.suffixOnly){const f=l[0],v=C.substring(0,f.index).trim(),p=C.substring(f.index+f.length).trim();if(a.guard((0,_.countWords)(p),(0,_.countWords)(v)))return{title:p,detectedSiteName:v}}return null}static getDescription(C,A){return this.firstValid([()=>this.getMetaContent(A,"name","description"),()=>this.getMetaContent(A,"property","description"),()=>this.getMetaContent(A,"property","og:description"),()=>this.getSchemaProperty(C,"description"),()=>this.getMetaContent(A,"name","twitter:description"),()=>this.getMetaContent(A,"name","sailthru.description")])}static getImage(C,A){return this.getMetaContent(A,"property","og:image")||this.getMetaContent(A,"name","twitter:image")||this.getSchemaProperty(C,"image.url")||this.getMetaContent(A,"name","sailthru.image.full")||""}static getLanguage(C,A,a){var s,l,u,m;const x=(l=(s=C.documentElement)===null||s===void 0?void 0:s.getAttribute("lang"))===null||l===void 0?void 0:l.trim();if(x)return this.normalizeLangCode(x);const f=this.getMetaContent(a,"name","content-language")||this.getMetaContent(a,"property","og:locale");if(f)return this.normalizeLangCode(f);const v=(m=(u=C.querySelector('meta[http-equiv="Content-Language" i]'))===null||u===void 0?void 0:u.getAttribute("content"))===null||m===void 0?void 0:m.trim();if(v)return this.normalizeLangCode(v);const p=this.getSchemaProperty(A,"inLanguage");return p?this.normalizeLangCode(p):""}static normalizeLangCode(C){return C.replace(/_/g,"-")}static getFavicon(C,A,a){var s,l;const u=this.getMetaContent(a,"property","og:image:favicon");if(u)return u;const m=(s=C.querySelector("link[rel='icon']"))===null||s===void 0?void 0:s.getAttribute("href");if(m)return m;const x=(l=C.querySelector("link[rel='shortcut icon']"))===null||l===void 0?void 0:l.getAttribute("href");if(x)return x;if(A&&/^https?:\/\//.test(A))try{return new URL("/favicon.ico",A).href}catch{}return""}static getPublished(C,A,a,s){const l=this.firstValid([()=>this.getSchemaProperty(A,"datePublished"),()=>this.getMetaContent(a,"name","publishDate"),()=>this.getMetaContent(a,"property","article:published_time"),()=>{var m,x;return((x=(m=C.querySelector('abbr[itemprop="datePublished"]'))===null||m===void 0?void 0:m.title)===null||x===void 0?void 0:x.trim())||""},()=>this.getTimeElement(C,s),()=>this.getMetaContent(a,"name","sailthru.date")]);if(l)return l;const u=C.querySelector("h1");if(u){const m=(f,v,p)=>{var h,w;let O=f;for(let M=0;M<3&&O;M++){for(const $ of Array.from(O.querySelectorAll("p, time"))){const T=this.parseDateText(((h=$.textContent)===null||h===void 0?void 0:h.trim())||"");if(T)return T}if(!p){const $=this.parseDateText(((w=O.textContent)===null||w===void 0?void 0:w.trim())||"");if($)return $}O=v(O)}return""},x=this.firstValid([()=>m(u.nextElementSibling,(f=>f.nextElementSibling),!1),()=>m(u.previousElementSibling,(f=>f.previousElementSibling),!0)]);if(x)return x}return""}static getMetaContent(C,A,a){var s;return(s=this.getMetaContents(C,A,a)[0])!==null&&s!==void 0?s:""}static getMetaContents(C,A,a){return C.filter((s=>{const l=A==="name"?s.name:s.property;return(l==null?void 0:l.toLowerCase())===a.toLowerCase()})).map((s=>{var l,u;return(u=(l=s.content)===null||l===void 0?void 0:l.trim())!==null&&u!==void 0?u:""}))}static getTimeElement(C,A){var a,s;for(const l of Array.from(C.querySelectorAll("time"))){if(this.isLinkedToOtherPage(l,A))continue;const u=((a=l.getAttribute("datetime"))===null||a===void 0?void 0:a.trim())||((s=l.textContent)===null||s===void 0?void 0:s.trim())||"";if(u)return u}return""}static isLinkedToOtherPage(C,A){var a;if(!A)return!1;const s=C.closest("a[href]");if(!s)return!1;const l=((a=s.getAttribute("href"))===null||a===void 0?void 0:a.trim())||"";if(!l||l.startsWith("#"))return!1;try{const u=new URL(l,A),m=new URL(A);if(u.origin!==m.origin)return!1;const x=f=>f.replace(/\/+$/,"");return x(u.pathname)!==x(m.pathname)}catch{return!1}}static parseDateText(C){let A=C.match(/\b(\d{1,2})\s+(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{4})\b/i);if(A){const a=A[1].padStart(2,"0"),s=this.MONTH_MAP[A[2].toLowerCase()];return`${A[3]}-${s}-${a}T00:00:00+00:00`}if(A=C.match(/\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{1,2}),?\s+(\d{4})\b/i),A){const a=this.MONTH_MAP[A[1].toLowerCase()],s=A[2].padStart(2,"0");return`${A[3]}-${a}-${s}T00:00:00+00:00`}return""}static getVisibleText(C){const A=C.cloneNode(!0);return A.querySelectorAll("script, style, noscript").forEach((a=>a.remove())),(A.textContent||"").replace(/\s+/g," ").trim()}static getAuthorName(C){const A=C.cloneNode(!0);A.querySelectorAll("script, style, noscript").forEach((s=>s.remove()));const a=(A.textContent||"").replace(/\s+/g," ").trim();if(!a)return"";for(const s of A.querySelectorAll("span, a, p")){const l=(s.textContent||"").replace(/\s+/g," ").trim();if(l.length>=2&&l.length<=50&&l!==a)return l}return a.length<=100?a:""}static getSchemaProperty(C,A,a=""){if(!C)return a;const s=(l,u,m,x=!0)=>{if(typeof l=="string")return u.length===0?[l]:[];if(!l||typeof l!="object")return[];if(Array.isArray(l)){const p=u[0];if(/^\[\d+\]$/.test(p)){const h=parseInt(p.slice(1,-1));return l[h]?s(l[h],u.slice(1),m,x):[]}return u.length===0&&l.every((h=>typeof h=="string"||typeof h=="number"))?l.map(String):l.flatMap((h=>s(h,u,m,x)))}const[f,...v]=u;if(!f)return typeof l=="string"?[l]:typeof l=="object"&&l.name?[l.name]:[];if(l.hasOwnProperty(f))return s(l[f],v,m?`${m}.${f}`:f,!0);if(!x){const p=[];for(const h in l)if(typeof l[h]=="object"){const w=s(l[h],u,m?`${m}.${h}`:h,!1);p.push(...w)}if(p.length>0)return p}return[]};try{let l=s(C,A.split("."),"",!0);l.length===0&&(l=s(C,A.split("."),"",!1));const u=[...new Set(l.filter(Boolean))];return u.length>0?u.join(", "):a}catch(l){return console.error(`Error in getSchemaProperty for ${A}:`,l),a}}}d.MetadataExtractor=E,E.MONTH_MAP={january:"01",february:"02",march:"03",april:"04",may:"05",june:"06",july:"07",august:"08",september:"09",october:"10",november:"11",december:"12"}},3172(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.removeEyebrowLabel=function(W,J,G){var Q;const ie=W.querySelector("h1")||W.querySelector("h2");if(!ie)return;let K=ie;for(;K.parentElement&&K.parentElement!==W&&!K.previousElementSibling;)K=K.parentElement;const re=K.previousElementSibling;if(!re)return;const ce=((Q=re.textContent)===null||Q===void 0?void 0:Q.trim())||"",se=(0,E.countWords)(ce);se<1||se>6||ce.length>40||/[.!?]/.test(ce)||A.test(ce)||re.querySelector("img, picture, video, iframe, figure, table, pre, code, time, [datetime], h1, h2, h3, h4, h5, h6, ul, ol, blockquote")||(J&&G&&G.push({step:"removeEyebrowLabel",reason:"eyebrow label",text:(0,E.textPreview)(re)}),re.remove())},d.removeByContentPattern=function(W,J,G,Q,ie,K){var re,ce,se,ue,fe,le,he,we,Be,ke,be,Ee,xe,Ne,Re,dt,Me,ze,Ke,We,at,mt,pt,Mt,Tt,qt,rt,wt,_t,Ot,Ut,ir,xr;const ut=(0,b.findContentStart)(W,Q),it=oe=>(0,b.isAboveContentStart)(oe,ut),$t=(0,E.normalizeText)(Q),sr=(0,E.normalizeText)(ie),Bt=W.querySelector("ul, ol");if(Bt&&(function(oe){const de=oe.querySelectorAll("li");if(de.length<2||de.length>8)return!1;const me=Array.from(oe.querySelectorAll("a"));if(me.length<1||me.length>=de.length||oe.querySelector("img, p, figure, blockquote"))return!1;for(const Ie of de)if((0,E.countWords)(Ie.textContent||"")>8)return!1;let _e=!0,De=!1,Te=!0;for(const Ie of me){const Se=Ie.getAttribute("href")||"";if(Se.startsWith("http")||Se.startsWith("//")){_e=!1;break}(Se==="/"||/^\/[a-zA-Z0-9_-]+\/?$/.test(Se))&&(De=!0),(Ie.textContent||"").trim().split(/\s+/).filter(Boolean).length>5&&(Te=!1)}return _e&&De&&Te})(Bt)){let oe=Bt;for(;oe.parentElement&&oe.parentElement!==W&&oe.parentElement.children.length===1;)oe=oe.parentElement;J&&K&&K.push({step:"removeByContentPattern",reason:"breadcrumb navigation list",text:(0,E.textPreview)(oe)}),oe.remove()}const hr=W.querySelector("h1");if(hr)for(const oe of W.querySelectorAll("a[href]")){if(!oe.parentNode||!(0,C.isNodeBefore)(oe,hr)||!oe.querySelector("div")||oe.querySelector("img, picture, video"))continue;const de=((re=oe.textContent)===null||re===void 0?void 0:re.trim())||"";(0,E.countWords)(de)>25||/[.!?]\s/.test(de)||(J&&K&&K.push({step:"removeByContentPattern",reason:"promotional banner link",text:(0,E.textPreview)(oe)}),oe.remove())}(function(oe,de,me,_e){var De;const Te=oe.querySelectorAll("time");if(Te.length!==0)for(const Ie of Te){if(!(0,b.isAboveContentStart)(Ie,de))continue;let Se=null,Oe=Ie.parentElement;for(;Oe&&Oe!==oe;){if(Oe.querySelector("h1, h2")&&Oe.querySelector("time")){const Qe=((De=Oe.textContent)===null||De===void 0?void 0:De.trim())||"",et=(0,E.countWords)(Qe),lt=new Set;for(const Gt of Oe.querySelectorAll("h1, h2, h3, time, [aria-label]")){let Sr=!1;for(const Mr of lt)if(Mr.contains(Gt)){Sr=!0;break}Sr||lt.add(Gt)}let mr=0;for(const Gt of lt)mr+=(0,E.countWords)(Gt.textContent||"");if(!(et-mr<30))break;Se=Oe}Oe=Oe.parentElement}if(Se)return me&&_e&&_e.push({step:"removeByContentPattern",reason:"hero header block",text:(0,E.textPreview)(Se)}),void Se.remove()}})(W,ut,J,K);for(const oe of W.querySelectorAll("audio, video")){if(!oe.parentNode||!oe.getAttribute("src")&&!oe.querySelector("source"))continue;let de=oe;for(;de.parentElement&&de.parentElement!==W&&!((0,E.countWords)(((ce=de.parentElement.textContent)===null||ce===void 0?void 0:ce.trim())||"")>25);)de=de.parentElement;const me=((se=de.textContent)===null||se===void 0?void 0:se.trim())||"",_e=/\blisten\s+to\s+(?:this\s+)?(?:article|story|post|episode|podcast)\b/i.test(me),De=!_e&&it(de)&&(0,E.countWords)(me)<=25;(_e||De)&&(J&&K&&K.push({step:"removeByContentPattern",reason:"audio player widget",text:(0,E.textPreview)(de)}),de.remove())}const bt=W.textContent||"";let Ft=null;try{Ft=new URL(G)}catch{}for(const oe of W.querySelectorAll("ul, ol")){if(!oe.parentNode||oe.closest("#footnotes"))continue;const de=((ue=oe.textContent)===null||ue===void 0?void 0:ue.trim())||"",me=bt.indexOf(de.substring(0,60));if(me<0||me>.3*bt.length)continue;const _e=Array.from(oe.querySelectorAll("a[href]"));if(_e.length<3||oe.querySelector(_.CONTENT_ELEMENT_SELECTOR))continue;let De=0;for(const Qe of _e){const et=Qe.getAttribute("href")||"";if(et.startsWith("#"))De++;else if(Ft&&et.includes("#"))try{const lt=new URL(et,G);lt.pathname===Ft.pathname&<.hostname===Ft.hostname&&De++}catch{}}if(De<3||De/_e.length<.8)continue;let Te=oe;for(;Te.parentElement&&Te.parentElement!==W&&Te.parentElement.children.length===1;)Te=Te.parentElement;const Ie=Te.previousElementSibling;if(Ie&&D.test(Ie.tagName)){const Qe=((fe=Ie.textContent)===null||fe===void 0?void 0:fe.trim())||"";/^(?:table of )?contents$|^on this page$|^in this (?:article|guide|post)$/i.test(Qe)&&(J&&K&&K.push({step:"removeByContentPattern",reason:"table of contents heading",text:(0,E.textPreview)(Ie)}),Ie.remove())}const Se=Te.previousElementSibling,Oe=Te.nextElementSibling;J&&K&&K.push({step:"removeByContentPattern",reason:"table of contents",text:(0,E.textPreview)(Te)}),Te.remove(),(Se==null?void 0:Se.tagName)==="HR"&&Se.remove(),(Oe==null?void 0:Oe.tagName)==="HR"&&Oe.remove();break}const q=Array.from(W.querySelectorAll("p, span, div, time"));let z=!1,Z=!1;for(const oe of q){if(!oe.parentNode)continue;const de=((le=oe.textContent)===null||le===void 0?void 0:le.trim())||"",me=(0,E.countWords)(de);if(me>15||me===0||oe.closest("pre, code"))continue;const _e=oe.tagName,De=A.test(de);if(De&&H(oe,W))continue;let Te=-2;const Ie=()=>(Te===-2&&(Te=bt.indexOf(de)),Te);if(p.test(de)&&Ie()<=300){let Se=oe;Se.parentElement&&Se.parentElement!==W&&(Se=Se.parentElement),J&&K&&K.push({step:"removeByContentPattern",reason:"timezone widget",text:(0,E.textPreview)(Se)}),Se.remove()}else if(me===1&&h.test(de))J&&K&&K.push({step:"removeByContentPattern",reason:"pinned label",text:(0,E.textPreview)(oe)}),oe.remove();else{for(const[Se,Oe]of[[$t,"duplicate title"],[sr,"duplicate description"]])if(Se&&me>=3&&it(oe)&&(0,E.normalizeText)(de)===Se){J&&K&&K.push({step:"removeByContentPattern",reason:Oe,text:(0,E.textPreview)(oe)}),oe.remove();break}if(oe.parentNode)if((_e==="DIV"||_e==="P")&&me>=1&&me<=10&&(De||a.test(de))&&!m.test(de)&&!/[.!?]/.test(de)&&it(oe)&&!Array.from(oe.querySelectorAll("p, h1, h2, h3, h4, h5, h6")).some((Se=>(0,E.countWords)(Se.textContent||"")>8)))J&&K&&K.push({step:"removeByContentPattern",reason:"article metadata header block",text:(0,E.textPreview)(oe)}),oe.remove();else{if(_e==="DIV"&&me>=1&&me<=5&&!/[.!?]/.test(de)&&it(oe)&&oe.querySelector("img")){const Se=oe.querySelectorAll("a[href]");if(Se.length>0){let Oe=0;for(const Qe of Se)Oe+=(((he=Qe.textContent)===null||he===void 0?void 0:he.trim())||"").length;if(Oe/(de.length||1)>=.8){J&&K&&K.push({step:"removeByContentPattern",reason:"category badge",text:(0,E.textPreview)(oe)}),oe.remove();continue}}}if(!z&&u.test(de)&&me>=2&&!/[.!?]$/.test(de)&&it(oe)){const Se=I(oe,de,W);J&&K&&K.push({step:"removeByContentPattern",reason:"author byline",text:(0,E.textPreview)(Se)}),Se.remove(),z=!0}else{if(s.test(de)&&(De?oe.querySelectorAll("p, div, section, article").length===0:me<=5&&it(oe))){let Se=de;for(const Oe of P)Se=Se.replace(Oe,"");if(Se.trim().length===0){const Oe=De?oe:I(oe,de,W);J&&K&&K.push({step:"removeByContentPattern",reason:"read time metadata",text:(0,E.textPreview)(Oe)}),Oe.remove();continue}}if(!Z&&me>=2&&me<=10&&De&&!m.test(de)&&it(oe)){let Se=de;for(const Oe of B)Se=Se.replace(Oe,"");if(Se=Se.trim(),Se){const Oe=Se.split(/\s+/).filter((Qe=>Qe.length>0));if(Oe.length>=1&&Oe.length<=4&&Oe.every((Qe=>l.test(Qe)))){const Qe=I(oe,de,W);J&&K&&K.push({step:"removeByContentPattern",reason:"author date metadata",text:(0,E.textPreview)(Qe)}),Qe.remove(),Z=!0;continue}}}if(De&&me<=5&&it(oe)){let Se=de;for(const Oe of L)Se=Se.replace(Oe,"");if(Se=Se.replace(/[,\s/\-]+/g,"").trim(),Se.length===0){const Oe=I(oe,de,W);J&&K&&K.push({step:"removeByContentPattern",reason:"standalone date metadata",text:(0,E.textPreview)(Oe)}),Oe.remove();continue}}}}}}const ee=Array.from(W.querySelectorAll("time"));for(const oe of ee){if(!oe.parentNode)continue;let de=oe,me=((we=de.textContent)===null||we===void 0?void 0:we.trim())||"";for(;de.parentElement&&de.parentElement!==W;){const Ie=de.parentElement.tagName.toLowerCase(),Se=((Be=de.parentElement.textContent)===null||Be===void 0?void 0:Be.trim())||"";if(Ie==="p"&&Se===me){de=de.parentElement;break}if(!["i","em","span","b","strong","small"].includes(Ie)||Se!==me)break;de=de.parentElement,me=Se}const _e=((ke=de.textContent)===null||ke===void 0?void 0:ke.trim())||"";if((0,E.countWords)(_e)>10)continue;const De=bt.indexOf(_e),Te=bt.length-(De+_e.length);De>200&&Te>200||(J&&K&&K.push({step:"removeByContentPattern",reason:"boundary date element",text:(0,E.textPreview)(de)}),de.remove())}const ae=W.querySelectorAll("ul, ol, dl");for(const oe of ae){if(!oe.parentNode||oe.closest("#footnotes"))continue;const de=oe.tagName==="DL",me=Array.from(oe.children).filter((et=>de?et.tagName==="DD":et.tagName==="LI")),_e=de?1:2;if(me.length<_e||me.length>8)continue;const De=((be=oe.textContent)===null||be===void 0?void 0:be.trim())||"",Te=bt.indexOf(De),Ie=bt.length-(Te+De.length);if(Te>500&&Ie>500)continue;const Se=oe.previousElementSibling;if(Se&&(R(Se)||(((Ee=Se.textContent)===null||Ee===void 0?void 0:Ee.trim())||"").endsWith(":")))continue;let Oe=!0;for(const et of me){const lt=((xe=et.textContent)===null||xe===void 0?void 0:xe.trim())||"";if((0,E.countWords)(lt)>8){Oe=!1;break}if(/[.!?]$/.test(lt)){Oe=!1;break}}if(!Oe||(0,E.countWords)(De)>30)continue;const Qe=I(oe,De,W);J&&K&&K.push({step:"removeByContentPattern",reason:"blog metadata list",text:(0,E.textPreview)(Qe)}),Qe.remove()}const Ae=(Ft==null?void 0:Ft.pathname)||"",Le=(Ft==null?void 0:Ft.hostname.replace(/^www\./,""))||"";if(Ae){const oe=W.querySelectorAll("div, span, p, a[href]"),de=W.querySelector("h1, h2, h3");for(const me of oe){if(!me.parentNode)continue;const _e=((Ne=me.textContent)===null||Ne===void 0?void 0:Ne.trim())||"";if((0,E.countWords)(_e)>10||me.querySelectorAll("p, div, section, article").length>0||me.matches("a[href]")&&me.parentElement&&me.parentElement!==W&&(((Re=me.parentElement.textContent)===null||Re===void 0?void 0:Re.trim())||"")!==_e&&(me.closest("p")||!de||!(0,C.isNodeBefore)(me,de)))continue;const De=me.matches("a[href]")?me:me.querySelector("a[href]");if(De)try{const Te=new URL(De.getAttribute("href")||"",G).pathname,Ie=Te.replace(/\/[^/]*$/,"/"),Se=/^index\.(html?|php)$/i.test(Te.split("/").pop()||"")&&Ae.startsWith(Ie);Te!=="/"&&Te!==Ae&&(Ae.startsWith(Te)||Se)&&(J&&K&&K.push({step:"removeByContentPattern",reason:"section breadcrumb",text:(0,E.textPreview)(me)}),me.remove())}catch{}}}if(Le){const oe=W.querySelectorAll("h2, h3, h4, h5, h6");for(const de of oe){if(!de.parentNode)continue;const me=de.nextElementSibling;if(!me||me.tagName!=="UL"&&me.tagName!=="OL")continue;const _e=Array.from(me.children).filter((Se=>Se.tagName==="LI"));if(_e.length<2)continue;let De=!1,Te=me;for(;Te&&Te!==W;){let Se=Te.nextElementSibling;for(;Se;){if((((dt=Se.textContent)===null||dt===void 0?void 0:dt.trim())||"").length>0){De=!0;break}Se=Se.nextElementSibling}if(De)break;Te=Te.parentElement}if(De)continue;let Ie=!0;for(const Se of _e){const Oe=Se.querySelectorAll("a[href]");if(Oe.length===0){Ie=!1;break}const Qe=((Me=Se.textContent)===null||Me===void 0?void 0:Me.trim())||"";let et=0;for(const lt of Oe){et+=(((ze=lt.textContent)===null||ze===void 0?void 0:ze.trim())||"").length;try{if(new URL(lt.getAttribute("href")||"",G).hostname.replace(/^www\./,"")===Le){Ie=!1;break}}catch{}}if(!Ie)break;if(et<.6*Qe.length){Ie=!1;break}}Ie&&(J&&K&&(K.push({step:"removeByContentPattern",reason:"trailing external link list",text:(0,E.textPreview)(de)}),K.push({step:"removeByContentPattern",reason:"trailing external link list",text:(0,E.textPreview)(me)})),me.remove(),de.remove())}}let Ge=W.lastElementChild;for(;Ge&&["HR","BR"].includes(Ge.tagName);)Ge=Ge.previousElementSibling;if(Ge&&["SECTION","DIV","ASIDE"].includes(Ge.tagName)){const oe=[];let de=!1;for(const me of Ge.children)if(!((Ke=me.textContent)===null||Ke===void 0)&&Ke.trim()){if(me.tagName==="P")oe.push(me);else if(me.tagName!=="BR"){de=!0;break}}oe.length>=2&&!de&&oe.every((_e=>{var De,Te,Ie;const Se=(((De=_e.textContent)===null||De===void 0?void 0:De.trim())||"").replace(/\s+/g," "),Oe=_e.querySelectorAll("a[href]");if(Oe.length===0)return!1;let Qe=0;for(const lt of Oe)Qe+=(((Te=lt.textContent)===null||Te===void 0?void 0:Te.trim())||"").length;if(Qe/(Se.length||1)<=.6)return!1;let et=Se;for(const lt of Oe)et=et.split(((Ie=lt.textContent)===null||Ie===void 0?void 0:Ie.trim())||"").join("");return!/[.!?]/.test(et)}))&&(J&&K&&K.push({step:"removeByContentPattern",reason:"trailing related posts block",text:(0,E.textPreview)(Ge)}),Ge.remove())}const xt=(0,E.countWords)(W.textContent||"");if(xt>300){const oe=[];let de=0,me=W.lastElementChild;for(;me;){if(me.id==="footnotes"){me=me.previousElementSibling;continue}if(me.tagName==="HR"){oe.push(me);break}let _e=0;for(const Te of me.querySelectorAll("svg"))_e+=(0,E.countWords)(Te.textContent||"");const De=(0,E.countWords)(((We=me.textContent)===null||We===void 0?void 0:We.trim())||"")-_e;if(De>25)break;de+=De,oe.push(me),me=me.previousElementSibling}if(oe.length>=1&&de<.15*xt){const _e=oe.some((Ie=>R(Ie))),De=oe.some((Ie=>Ie.querySelector(_.CONTENT_ELEMENT_SELECTOR)));let Te=0;for(const Ie of oe)Ie.tagName==="P"&&(0,E.countWords)(Ie.textContent||"")>5&&Te++;if(_e&&!De&&Te<2)for(const Ie of oe)J&&K&&K.push({step:"removeByContentPattern",reason:"trailing thin section",text:(0,E.textPreview)(Ie)}),Ie.remove()}}const Ce=W.textContent||"",yt=W.querySelectorAll("p, div, span, section");for(const oe of yt){if(!oe.parentNode||oe.closest("pre, code"))continue;const de=((at=oe.textContent)===null||at===void 0?void 0:at.trim())||"",me=(0,E.countWords)(de);if(!(me>50||me<1)){for(const _e of x)if(_e.test(de)){let De=oe;for(;De.parentElement&&De.parentElement!==W&&!De.nextElementSibling;)De=De.parentElement;const Te=De.textContent||"";if(Ce.indexOf(Te)<200){De===oe||oe.nextElementSibling||(J&&K&&K.push({step:"removeByContentPattern",reason:"boilerplate text",text:(0,E.textPreview)(oe)}),oe.remove());continue}X(De,W,J,K);break}}}for(const oe of W.querySelectorAll("h2, h3, h4, h5, h6")){if(!oe.parentNode)continue;const de=((mt=oe.textContent)===null||mt===void 0?void 0:mt.trim())||"",me=k.test(de);if(!me&&!y.test(de)||bt.indexOf(de)<500)continue;const _e=ne(oe,W);if(!U(_e)){if(_e===oe){if(!me)continue;V(oe,!0,J,K)}else Y(_e,J,K),J&&K&&K.push({step:"removeByContentPattern",reason:"related content section",text:(0,E.textPreview)(_e)}),X(_e,W,J,K);break}_e!==oe&&(J&&K&&K.push({step:"removeByContentPattern",reason:"inline related content section",text:(0,E.textPreview)(_e)}),_e.remove())}for(const oe of W.querySelectorAll("p")){if(!oe.parentNode)continue;const de=((pt=oe.textContent)===null||pt===void 0?void 0:pt.trim())||"";N.test(de)&&((0,E.countWords)(de)>20||oe.querySelector(_.CONTENT_ELEMENT_SELECTOR)||(J&&K&&K.push({step:"removeByContentPattern",reason:"related content intro",text:(0,E.textPreview)(oe)}),oe.remove()))}const zt=(0,E.countWords)(bt);for(const oe of W.querySelectorAll("div, ul, ol")){if(!oe.parentNode||oe.children.length<2||oe.querySelectorAll("img, picture").length<2)continue;const de=Array.from(oe.children),me=de.filter((Ie=>Ie.querySelector("img, picture")&&(Ie.querySelector("h2, h3, h4")||Ie.querySelector("a[href]")))).length;if(me<2||me<.7*de.length)continue;const _e=((Mt=de[0].textContent)===null||Mt===void 0?void 0:Mt.trim().substring(0,30))||"";if(!(_e.length>=5?bt.indexOf(_e)>=500:de.every((Ie=>Ie.querySelector("a[href]")))&&F(oe,W)>=100))continue;const De=(0,E.countWords)(oe.textContent||"");if(zt>0&&De/zt>.3)continue;const Te=ne(oe,W);if(Te!==oe&&!((0,E.countWords)(Te.textContent||"")>2*De+15)&&!U(Te)){Y(Te,J,K),J&&K&&K.push({step:"removeByContentPattern",reason:"related post cards",text:(0,E.textPreview)(Te)}),V(Te,!0,J,K);break}}for(const oe of W.querySelectorAll("div, section, aside")){if(!oe.parentNode||oe.closest("pre, code")||!S(oe,60))continue;const de=(0,E.countWords)(((Tt=oe.textContent)===null||Tt===void 0?void 0:Tt.trim())||"");let me=oe;for(;me.parentElement&&me.parentElement!==W&&!((0,E.countWords)(((qt=me.parentElement.textContent)===null||qt===void 0?void 0:qt.trim())||"")>2*de+15);)me=me.parentElement;J&&K&&K.push({step:"removeByContentPattern",reason:"newsletter signup",text:(0,E.textPreview)(me)}),me.remove();break}for(const oe of W.querySelectorAll("ul"))if(oe.parentNode&&S(oe,30)){J&&K&&K.push({step:"removeByContentPattern",reason:"newsletter signup list",text:(0,E.textPreview)(oe)}),oe.remove();break}for(const oe of W.querySelectorAll("div, section")){if(!oe.parentNode)continue;const de=((rt=oe.textContent)===null||rt===void 0?void 0:rt.trim())||"",me=(0,E.countWords)(de);if(me<2||me>40)continue;const _e=bt.indexOf(de.substring(0,60));if(_e<0||bt.length-(_e+de.length)>300)continue;const De=oe.querySelectorAll("div, span, p, dt, dd, li");let Te=!1;for(const Se of De){const Oe=((wt=Se.textContent)===null||wt===void 0?void 0:wt.trim())||"";if(w.test(Oe)){Te=!0;break}}if(!Te||!($.test(de)||T.test(de)||oe.querySelector('a[href^="mailto:"]')))continue;const Ie=ne(oe,W);J&&K&&K.push({step:"removeByContentPattern",reason:"author contact block",text:(0,E.textPreview)(Ie)}),Ie.remove();break}for(const oe of W.querySelectorAll("p, span, div")){if(!oe.parentNode)continue;const de=((_t=oe.textContent)===null||_t===void 0?void 0:_t.trim())||"";if(!O.test(de))continue;let me=oe;for(;me.parentElement&&me.parentElement!==W;){const _e=me.parentElement;if((0,E.countWords)(((Ot=_e.textContent)===null||Ot===void 0?void 0:Ot.trim())||"")>15)break;me=_e}me.querySelector(M)||(J&&K&&K.push({step:"removeByContentPattern",reason:"author/share widget",text:(0,E.textPreview)(me)}),me.remove())}for(const oe of W.querySelectorAll("a, p, div, span")){if(!oe.parentNode)continue;const de=((Ut=oe.textContent)===null||Ut===void 0?void 0:Ut.trim())||"";if(!v.test(de)||oe.tagName==="A"&&oe.getAttribute("href"))continue;if(oe.tagName!=="A"){const _e=bt.indexOf(de);if(bt.length-(_e+de.length)>200)continue}const me=I(oe,de,W);J&&K&&K.push({step:"removeByContentPattern",reason:"social engagement counter",text:(0,E.textPreview)(me)}),me.remove()}for(const oe of W.querySelectorAll("div")){if(!oe.parentNode)continue;const de=((ir=oe.textContent)===null||ir===void 0?void 0:ir.trim())||"",me=(0,E.countWords)(de);if(me<1||me>10||/[.!?]/.test(de)||oe.querySelector(_.CONTENT_ELEMENT_SELECTOR))continue;const _e=bt.indexOf(de);if(_e<0||bt.length-(_e+de.length)>300)continue;const De=oe.querySelectorAll("a[href]");if(De.length===0)continue;let Te=0;for(const Ie of De)Te+=(((xr=Ie.textContent)===null||xr===void 0?void 0:xr.trim())||"").length;Te/(de.length||1)<.8||(J&&K&&K.push({step:"removeByContentPattern",reason:"trailing tag link block",text:(0,E.textPreview)(oe)}),oe.remove())}};const _=g(2640),E=g(2552),b=g(4467),C=g(639),A=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*|\d{4}[-/]\d{1,2}[-/]\d{1,2})/i,a=/\b\d+\s+(?:second|minute|hour|day|week|month|year)s?\s+ago\b/i,s=/\d+\s*min(?:ute)?s?\s+read\b|(?:read(?:ing)?\s+time)\s*:?\s*\d+\s*min(?:ute)?s?\b/i,l=new RegExp("^\\p{Lu}","u"),u=/^(?:posted\s+)?by\s+\S/i,m=/^(?:date|published|updated|posted|from|to|subject)\s*:/i,x=[/^This (?:article|story|piece) (?:appeared|was published|originally appeared) in\b/i,/^A version of this (?:article|story) (?:appeared|was published) in\b/i,/^Originally (?:published|appeared) (?:in|on|at)\b/i,/^Any re-?use permitted\b/i,/^\xa9\s*(?:Copyright\s+)?\d{4}/i,/^Comments?$/i,/^Leave a (?:comment|reply)$/i,/^Loading\.{3}$/,/^Affiliate links\b.*\b(?:earn|commission)/i,/\bRead our Comment Policy\b/i,/^Thank you for (?:being part of|joining) our community\b/i],f=/\bsubscribe\b[\s\S]{0,40}\bnewsletter\b|\bnewsletter\b[\s\S]{0,40}\bsubscribe\b|\bsign[- ]up\b[\s\S]{0,80}\b(?:newsletter|email alert)|\b(?:don[\u2019']?t (?:want to )?miss|never miss)\b[\s\S]{0,80}\b(?:latest|best|exclusive|reports?|updates?|source)/i,v=/^\d+\s+(?:Likes?|Comments?|Shares?|Retweets?|Reposts?|Restacks?)$/i,p=/^current time in$/i,h=/^pinned$/i,w=/^(?:written by|(?:author|contact|reporter|correspondent)s?)$/i,O=/^(?:share|follow|authors?|written\s+by)$/i,M=_.CONTENT_ELEMENT_SELECTOR.replace(/img, picture, /,""),$=/[\w.-]+@[\w.-]+\.\w+/,T=/\(?\d{3}\)?[\s.\u2011\u2013-]?\d{3}[\s.\u2011\u2013-]?\d{4}/,D=/^H[1-6]$/;function R(W){return D.test(W.tagName)||!!W.querySelector("h1, h2, h3, h4, h5, h6")}function S(W,J){var G;const Q=((G=W.textContent)===null||G===void 0?void 0:G.trim())||"",ie=(0,E.countWords)(Q);if(ie<2||ie>J||W.querySelector(_.CONTENT_ELEMENT_SELECTOR))return!1;const K=Q.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[\u2018\u2019]/g,"'");return f.test(K)}const y=/^(?:related (?:posts?|articles?|content|stories|reads?|reading)|you (?:might|may|could) (?:also )?(?:like|enjoy|be interested in)|read (?:next|more|also)|further reading|see also|more (?:from .*|from|articles?|posts?|like this)|more to (?:read|explore)|explore more|about (?:the )?author|latest (?:news|events?|posts?|articles?|stories)(?:\s*[&+]\s*(?:news|events?|posts?|articles?|stories))?)$/i,k=/^(?:subscribe|sign up|follow us|share this|stay (?:updated|connected)|join (?:us|our)|search (?:the |our )?(?:site|blog|archives?|newsroom|website|catalog|store|shop|database))$/i,N=/^for more (?:on|about)\b/i,L=[/\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\b/gi,/\b(?:Mon(?:day)?|Tue(?:s(?:day)?)?|Wed(?:nesday)?|Thu(?:rs(?:day)?)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)\b/gi,/\b\d+(?:st|nd|rd|th)?\b/g,/\d{4}[-/]\d{1,2}[-/]\d{1,2}/g],P=[...L,/\bmin(?:ute)?s?\b/gi,/\bread(?:ing)?\b/gi,/\btime\b/gi,/\bestimated\b/gi,/[/|\xb7\u2022\u2014\u2013\-,:.\s]+/g],B=[...L,/\bby\b/gi,/[/|\xb7\u2022\u2014\u2013\-,]+/g];function U(W,J=25){let G=W.nextElementSibling;for(;G;){if(G.tagName==="P"&&(0,E.countWords)(G.textContent||"")>=J)return!0;for(const Q of G.querySelectorAll("p"))if((0,E.countWords)(Q.textContent||"")>=J)return!0;G=G.nextElementSibling}return!1}function F(W,J){let G=0,Q=W;for(;Q&&Q!==J;){let ie=Q.previousElementSibling;for(;ie;){if(ie.tagName==="P")G+=(0,E.countWords)(ie.textContent||"");else for(const K of ie.querySelectorAll("p"))G+=(0,E.countWords)(K.textContent||"");ie=ie.previousElementSibling}Q=Q.parentElement}return G}function I(W,J,G){var Q;let ie=W;for(;ie.parentElement&&ie.parentElement!==G&&(((Q=ie.parentElement.textContent)===null||Q===void 0?void 0:Q.trim())||"")===J;)ie=ie.parentElement;return ie}function H(W,J){var G;for(let Q=W;Q&&Q!==J;Q=Q.parentElement){const ie=((G=Q.textContent)===null||G===void 0?void 0:G.trim())||"";if((0,E.countWords)(ie)>15)break;if(m.test(ie))return!0}return!1}function V(W,J,G,Q){let ie=W.nextElementSibling;for(;ie;){const K=ie.nextElementSibling;ie.id!=="footnotes"&&(G&&Q&&Q.push({step:"removeByContentPattern",reason:"trailing non-content",text:(0,E.textPreview)(ie)}),ie.remove()),ie=K}J&&(G&&Q&&Q.push({step:"removeByContentPattern",reason:"boilerplate text",text:(0,E.textPreview)(W)}),W.remove())}function X(W,J,G,Q){const ie=[];let K=W.parentElement;for(;K&&K!==J;)ie.push(K),K=K.parentElement;V(W,!0,G,Q);for(const re of ie)V(re,!1,G,Q)}function ne(W,J){let G=W;for(;G.parentElement&&G.parentElement!==J;){let Q=0,ie=G.previousElementSibling;for(;ie&&(Q+=(0,E.countWords)(ie.textContent||""),!(Q>10));)ie=ie.previousElementSibling;if(Q>10)break;G=G.parentElement}return G}function Y(W,J,G){const Q=W.previousElementSibling;if(!Q||(0,E.countWords)(Q.textContent||"")>=50||Q.querySelector(_.CONTENT_ELEMENT_SELECTOR))return;const ie=Q.previousElementSibling;ie&&R(ie)||(J&&G&&G.push({step:"removeByContentPattern",reason:"thin CTA section",text:(0,E.textPreview)(Q)}),Q.remove())}},8983(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.removeHiddenElements=function(b,C,A){let a=0;const s=new Map,l=/(?:^|;\s*)(?:display\s*:\s*none|visibility\s*:\s*hidden|opacity\s*:\s*0)(?:\s*;|\s*$)/i,u=b.defaultView,m=typeof window<"u"&&u===window,x=b.querySelectorAll("*");for(const f of x){if(f.querySelector("math, [data-mathml], .katex-mathml")||f.tagName.toLowerCase()==="math")continue;const v=f.getAttribute("style");if(v&&l.test(v)){const h=v.includes("display")?"display:none":v.includes("visibility")?"visibility:hidden":"opacity:0";s.set(f,h),a++;continue}if(m)try{const h=u.getComputedStyle(f);let w="";if(h.display==="none"?w="display:none":h.visibility==="hidden"?w="visibility:hidden":h.opacity==="0"&&(w="opacity:0"),w){s.set(f,w),a++;continue}}catch{}const p=f.getAttribute("class")||"";if(p){const h=p.split(/\s+/);if((0,E.hasResponsiveShowClass)(p))continue;for(const w of h){const O=w==="hidden"||w==="invisible",M=!w.includes("[")&&(w.endsWith(":hidden")||w.endsWith(":invisible"));if(O||M){s.set(f,`class:${w}`),a++;break}}}}s.forEach(((f,v)=>{C&&A&&A.push({step:"removeHiddenElements",reason:f,text:(0,_.textPreview)(v)}),v.remove()})),(0,_.logDebug)(C,"Removed hidden elements:",a)};const _=g(2552),E=g(639)},662(c,d){Object.defineProperty(d,"__esModule",{value:!0}),d.removeMetadataBlock=function(_){var E,b;const C=_.querySelector("h1");if(!C)return;let A=C.nextElementSibling;for(let a=0;a<3&&A;a++){const s=A.nextElementSibling,l=((E=A.textContent)===null||E===void 0?void 0:E.trim())||"";if(l.length>0&&l.length<300){let u=g.test(l);if(!u){for(const m of A.querySelectorAll("p, time"))if(g.test(((b=m.textContent)===null||b===void 0?void 0:b.trim())||"")){u=!0;break}}if(u){A.remove();break}}A=s}};const g=/\b(?:(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{1,2}[\s,]+\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{4}|\d{4}[-/]\d{1,2}[-/]\d{1,2})\b/i},3550(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.ContentScorer=void 0;const _=g(2640),E=g(2552),b=g(639),C=["admonition","article","content","entry","image","img","font","figure","figcaption","pre","main","post","story","table"],A=["advertisement","all rights reserved","banner","cookie","comments","copyright","follow me","follow us","footer","header","homepage","login","menu","more articles","more like this","most read","nav","navigation","newsletter","popular","privacy","recommended","register","related","responses","share","sidebar","sign in","sign up","signup","social","sponsored","subscribe","terms","trending"],a=/\b(linkedin\.com\/(in|company)\/|twitter\.com\/(?!intent\b)\w|x\.com\/(?!intent\b)\w|facebook\.com\/(?!share\b)\w|instagram\.com\/\w|threads\.net\/\w|mastodon\.\w)/i,s=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*)/i,l=/\bBy\s+[A-Z]/,u=A.map((w=>new RegExp(`\\b${w.replace(/\s+/g,"\\s+")}\\b`))),m=new RegExp(A.map((w=>w.replace(/\s+/g,"\\s+"))).join("|"),"i"),x=/^(?:table of )?contents$|^on this page$|^in this (?:article|guide|post)$/i,f=/\b(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2},?\s+\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*,?\s+\d{4})\b/i,v=/\b(?:by|written by|author:)\s+[A-Za-z\s]+\b/i,p=["advert","ad-","ads","banner","cookie","copyright","footer","header","homepage","menu","nav","newsletter","popular","privacy","recommended","related","rights","share","sidebar","social","sponsored","subscribe","terms","trending","widget"];class h{static scoreElement(O){let M=0;const $=O.textContent||"",T=(0,E.countWords)($);M+=T,M+=10*O.getElementsByTagName("p").length,M+=$.split(/,/).length-1,M-=3*(O.getElementsByTagName("img").length/(T||1));try{const k=O.getAttribute("style")||"",N=O.getAttribute("align")||"";(k.includes("float: right")||k.includes("text-align: right")||N==="right")&&(M+=5)}catch{}f.test($)&&(M+=10),v.test($)&&(M+=10);const D=(0,b.getClassName)(O).toLowerCase();if((D.includes("content")||D.includes("article")||D.includes("post"))&&(M+=15),O.querySelector(_.FOOTNOTE_INLINE_REFERENCES)&&(M+=10),O.querySelector(_.FOOTNOTE_LIST_SELECTORS)&&(M+=10),M-=5*O.getElementsByTagName("table").length,O.tagName.toLowerCase()==="td"){const k=O.closest("table");if(k){const N=parseInt(k.getAttribute("width")||"0"),L=k.getAttribute("align")||"",P=(0,b.getClassName)(k).toLowerCase();if(N>400||L==="center"||P.includes("content")||P.includes("article")){const B=Array.from(k.getElementsByTagName("td")),U=B.indexOf(O);U>0&&U<B.length-1&&(M+=10)}}}const R=O.getElementsByTagName("a");let S=0;for(let k=0;k<R.length;k++)S+=(R[k].textContent||"").length;const y=$.length||1;return M*=1-Math.min(S/y,.5),M}static findBestElement(O,M=50){let $=null,T=0;return O.forEach((D=>{const R=this.scoreElement(D);R>T&&(T=R,$=D)})),T>M?$:null}static scoreAndRemove(O,M=!1,$,T){const D=Date.now(),R=new Map;Array.from(O.querySelectorAll(_.BLOCK_ELEMENTS_SELECTOR)).forEach((y=>{if(R.has(y)||T&&y.contains(T)||y.closest("pre")||y.closest("[data-defuddle]")||y.closest("td, th")||h.isLikelyContent(y))return;const k=h.scoreNonContentBlock(y);k<0&&R.set(y,k)})),R.forEach(((y,k)=>{M&&$&&$.push({step:"scoreAndRemove",reason:`score: ${y}`,text:(0,E.textPreview)(k)}),k.remove()}));const S=Date.now();(0,E.logDebug)(M,"Removed non-content blocks:",{count:R.size,processingTime:`${(S-D).toFixed(2)}ms`})}static isLikelyContent(O){const M=O.getAttribute("role");if(M&&["article","main","contentinfo"].includes(M))return!0;const $=(0,b.getClassName)(O).toLowerCase(),T=O.id.toLowerCase();for(const k of C)if($.includes(k)||T.includes(k))return!0;if(O.querySelector("pre, table, figure, picture"))return!0;const D=O.textContent||"",R=(0,E.countWords)(D),S=O.querySelector("h1, h2, h3, h4, h5, h6");if(S){const k=(S.textContent||"").trim();if(k&&k===D.trim()){const N=k.toLowerCase();if(!m.test(N)&&!x.test(N))return!0}}if(R<1e3){const k=O.querySelectorAll("h1, h2, h3, h4, h5, h6");let N=!1;for(let L=0;L<k.length;L++){const P=(k[L].textContent||"").toLowerCase().trim();if(m.test(P)){N=!0;break}}if(N&&(R<200||O.getElementsByTagName("a").length/(R||1)>.2))return!1}if(h.isCardGrid(O,R))return!1;if(R<80){const k=O.getElementsByTagName("a");for(let N=0;N<k.length;N++){const L=(k[N].getAttribute("href")||"").toLowerCase();if(a.test(L))return!1}}const y=O.getElementsByTagName("p").length+O.getElementsByTagName("li").length;return!!(R>50&&y>1||R>100||R>30&&y>0||R>=10&&/[.?!]/.test(D)&&O.getElementsByTagName("a").length/R<.1)}static scoreNonContentBlock(O){try{if(O.matches(_.FOOTNOTE_LIST_SELECTORS)||O.querySelector(_.FOOTNOTE_LIST_SELECTORS)||O.closest(_.FOOTNOTE_LIST_SELECTORS))return 0}catch{}let M=0;const $=O.textContent||"",T=(0,E.countWords)($);if(T<3)return 0;M+=$.split(/,/).length-1;const D=$.toLowerCase();let R=0;for(const P of u)P.test(D)&&R++;M-=10*R;const S=O.getElementsByTagName("a"),y=S.length;if(y/(T||1)>.5&&(M-=15),y>1&&T<80){let P=0;for(let U=0;U<S.length;U++)P+=(S[U].textContent||"").length;const B=$.length;B>0&&P/B>.8&&(M-=15)}const k=O.getElementsByTagName("ul").length+O.getElementsByTagName("ol").length;if(k>0&&y>3*k&&(M-=10),T<80){const P=O.getElementsByTagName("a");for(let B=0;B<P.length;B++){const U=(P[B].getAttribute("href")||"").toLowerCase();if(a.test(U)){M-=15;break}}}T<15&&l.test($)&&s.test($)&&(M-=10),h.isCardGrid(O,T)&&(M-=15);const N=(0,b.getClassName)(O).toLowerCase(),L=O.id.toLowerCase();for(const P of p)(N.includes(P)||L.includes(P))&&(M-=8);return M}static isCardGrid(O,M){if(M<3||M>=500)return!1;const $=O.querySelectorAll("h2, h3, h4");if($.length<3||O.querySelectorAll("img").length<2)return!1;let T=0;for(let D=0;D<$.length;D++)T+=(0,E.countWords)($[D].textContent||"");return(M-T)/$.length<20}}d.ContentScorer=h},7393(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.removeBySelector=function(s,l,u=!0,m=!0,x,f,v=!1){const p=Date.now();let h=0,w=0;const O=new Map;if(u&&s.querySelectorAll(_.EXACT_SELECTORS_JOINED).forEach(($=>{if($!=null&&$.parentNode){if(v){const T=$.closest(_.HIDDEN_EXACT_SKIP_SELECTOR),D=($.getAttribute("role")||"").toLowerCase();if($.matches(_.HIDDEN_EXACT_SELECTOR)||T&&D==="dialog")return}if($.closest("pre, code")||$.matches(_.HIDDEN_EXACT_SELECTOR)&&(0,b.hasResponsiveShowClass)((0,b.getClassName)($)))return;O.set($,{type:"exact"}),h++}})),m){const $=l?_.PARTIAL_SELECTORS.map((S=>({pattern:S,regex:new RegExp(S,"i"),anchored:new RegExp("^(?:"+S+")$","i")}))):null,T=s.querySelectorAll(_.TEST_ATTRIBUTES_SELECTOR),D=x?x.querySelectorAll(_.TEST_ATTRIBUTES_SELECTOR):[];new Set([...T,...D]).forEach((S=>{var y;if(O.has(S)||S.closest("[data-defuddle]"))return;const k=S.tagName;if(k==="CODE"||k==="PRE"||S.querySelector("pre")||S.closest("code, pre"))return;const N=/^H[1-6]$/.test(k),L=(N?(0,b.getClassName)(S):(0,b.getClassName)(S)+" "+(S.getAttribute("data-component")||"")+" "+(S.getAttribute("data-test")||"")+" "+(S.getAttribute("data-testid")||"")+" "+(S.getAttribute("data-test-id")||"")+" "+(S.getAttribute("data-qa")||"")+" "+(S.getAttribute("data-cy")||"")).toLowerCase(),P=N?"":(S.id||"").toLowerCase(),B=L.trim()!=="";if(!B&&!P)return;const U=B&&_.PARTIAL_SELECTORS_REGEX.test(L),F=!!P&&/[\s_\-:.]/.test(P),I=!!P&&(F?_.PARTIAL_SELECTORS_REGEX.test(P):_.PARTIAL_SELECTORS_ANCHORED_REGEX.test(P));if(U||I){const H=U||F,V=U?L:P,X=$?(y=$.find((ne=>(H?ne.regex:ne.anchored).test(V))))===null||y===void 0?void 0:y.pattern:void 0;O.set(S,{type:"partial",selector:X}),w++}}));const R=new Set([...s.querySelectorAll(C),...x?x.querySelectorAll(C):[]]);R.forEach((S=>{const y=S.closest("a");y&&!O.has(S)&&!S.closest("code, pre, [data-defuddle]")&&A.test(S.textContent||"")&&a(y,R,O)&&(O.set(S,{type:"partial",selector:"screen-reader link text"}),w++)}))}O.forEach((({type:$,selector:T},D)=>{var R;if(!(x&&D.contains(x)||D.tagName==="A"&&D.closest("h1, h2, h3, h4, h5, h6"))){try{if(D.matches(_.FOOTNOTE_LIST_SELECTORS)||D.querySelector(_.FOOTNOTE_LIST_SELECTORS))return;const S=D.parentElement;if(S&&S.matches(_.FOOTNOTE_LIST_SELECTORS)||!((R=D.classList)===null||R===void 0)&&R.contains("footnote-backref")&&D.closest("#footnotes"))return}catch{}if(D.tagName==="BUTTON"&&D.querySelector("img, picture, video")){const S=D.parentElement;if(S){for(const y of Array.from(D.querySelectorAll("img, picture, video")))S.insertBefore(y,D);D.remove()}}else D.tagName==="BUTTON"&&D.closest("p, li, td, th, span, h1, h2, h3, h4, h5, h6")?D.replaceWith(...Array.from(D.childNodes)):(l&&f&&f.push({step:"removeBySelector",selector:$==="exact"?"exact":T,reason:$==="exact"?"exact selector match":`partial match: ${T}`,text:(0,E.textPreview)(D)}),D.remove())}}));const M=Date.now();(0,E.logDebug)(l,"Removed clutter elements:",{exactSelectors:h,partialSelectors:w,total:O.size,processingTime:`${(M-p).toFixed(2)}ms`})};const _=g(2640),E=g(2552),b=g(639),C=["sr-only","visually-hidden","screen-reader-text"].map((s=>`a [class*="${s}"]`)).join(", "),A=/^[\s,(\u2013-]*(?:(?:link )?opens in (?:a )?new (?:window|tab)|new (?:window|tab)|external(?: link| site| website)?)[\s).]*$/i;function a(s,l,u){return Array.from(s.childNodes).some((m=>{var x;return m.nodeType===3?!!(!((x=m.textContent)===null||x===void 0)&&x.trim()):m.nodeType===1&&!l.has(m)&&!u.has(m)&&a(m,l,u)}))}},2408(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.getElementIdentifier=l,d.findSmallImages=function(u,m){var x,f,v;const p=new Set;let h=0;const w=u.querySelectorAll("img, svg"),O=u.defaultView,M=typeof window<"u"&&O===window;for(const $ of w){const T=parseInt($.getAttribute("width")||"0"),D=parseInt($.getAttribute("height")||"0");let R=0,S=0;if($.tagName.toLowerCase()==="svg"){const F=$.getAttribute("viewBox");if(F){const I=F.split(/[\s,]+/);I.length===4&&(R=parseFloat(I[2])||0,S=parseFloat(I[3])||0)}}const y=$.getAttribute("style")||"",k=parseInt(((x=y.match(A))===null||x===void 0?void 0:x[1])||"0"),N=parseInt(((f=y.match(a))===null||f===void 0?void 0:f[1])||"0");let L=0,P=0;if(M){try{const F=O.getComputedStyle($);L=parseInt(F.width)||0,P=parseInt(F.height)||0}catch{}try{const F=$.getBoundingClientRect();F.width>0&&(L=L||F.width),F.height>0&&(P=P||F.height)}catch{}}const B=[T,k,L,R].filter((F=>F>0)),U=[D,N,P,S].filter((F=>F>0));if(B.length===0&&U.length===0&&$.tagName.toLowerCase()==="img"){const F=($.getAttribute("srcset")||"").match(/(\S+)\s+1x/);if(F){const I=parseInt(((v=F[1].match(s))===null||v===void 0?void 0:v[1])||"0");I>0&&B.push(I)}}if(B.length>0||U.length>0){const F=B.length>0?Math.min(...B):1/0,I=U.length>0?Math.min(...U):1/0;if(F<33||I<33){if($.tagName.toLowerCase()==="img"){const V=$.getAttribute("alt")||"";if(C.LOOKS_LIKE_LATEX_RE.test(V)||$.classList.contains("latex")||$.classList.contains("tex")||$.getAttribute("data-latex")||$.getAttribute("data-math"))continue}const H=l($);H&&(p.add(H),h++)}}}return(0,_.logDebug)(m,"Found small elements:",h),p},d.removeSmallImages=function(u,m,x){let f=0;["img","svg"].forEach((v=>{const p=u.getElementsByTagName(v);Array.from(p).forEach((h=>{if(v==="img"){const O=h.getAttribute("src")||"",M=h.getAttribute("srcset")||h.getAttribute("data-src")||h.getAttribute("data-srcset")||h.getAttribute("data-lazy-src")||h.getAttribute("data-original");if(!O&&!M||!M&&!h.closest("picture")&&(0,b.isBase64Placeholder)(O))return h.remove(),void f++}const w=l(h);w&&m.has(w)&&(h.remove(),f++)}))})),(0,_.logDebug)(x,"Removed small elements:",f)};const _=g(2552),E=g(639),b=g(2649),C=g(7282),A=/width\s*:\s*(\d+)/,a=/height\s*:\s*(\d+)/,s=/(?:width[=:/]|[/,?&]w[_:=])(\d+)/;function l(u){if(u.tagName.toLowerCase()==="img"){const v=u.getAttribute("data-src");if(v)return`src:${v}`;const p=u.getAttribute("src")||"",h=u.getAttribute("srcset")||"",w=u.getAttribute("data-srcset");if(p)return`src:${p}`;if(h)return`srcset:${h}`;if(w)return`srcset:${w}`}const m=u.id||"",x=(0,E.getClassName)(u),f=u.tagName.toLowerCase()==="svg"&&u.getAttribute("viewBox")||"";return m?`id:${m}`:f?`viewBox:${f}`:x?`class:${x}`:null}},4840(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.standardizeExtractorOutput=function(Y,W=!1){m=W,p(Y,W,!0),W||B(Y),U(Y)},d.standardizeContent=function(Y,W,J,G=!1,Q){m=G;const ie=Q?(K,re)=>{var ce;const se=performance.now(),ue=re();return Q[K]=((ce=Q[K])!==null&&ce!==void 0?ce:0)+Math.round(performance.now()-se),ue}:(K,re)=>re();ie("standardizeDropCaps",(()=>(function(K){const re=Array.from(K.querySelectorAll('span[data-caps="initial"]'));let ce=0;for(const se of re){if(!se.parentNode)continue;const ue=se.nextElementSibling;if(ue&&ue.tagName==="SMALL"){const fe=se.textContent||"",le=ue.textContent||"",he=se.ownerDocument.createTextNode(fe+le);se.parentNode.insertBefore(he,se),ue.remove(),se.remove()}else h(se);ce++}ce>0&&K.normalize(),(0,s.logDebug)(m,"Standardized drop caps:",ce)})(Y))),ie("standardizeSpaces",(()=>(function(K){const re=ce=>{if((0,s.isElement)(ce)){const se=ce.tagName.toLowerCase();if(se==="pre"||se==="code"||(0,s.isSVGElement)(ce))return}if((0,s.isTextNode)(ce)){const se=ce.textContent||"",ue=se.replace(/\xA0/g," ");ue!==se&&(ce.textContent=ue)}ce.hasChildNodes()&&Array.from(ce.childNodes).forEach(re)};re(K)})(Y))),ie("removeHtmlComments",(()=>(function(K){var re;let ce=0;const se=K.ownerDocument,ue=se.createTreeWalker(K,128),fe=[];for(;ue.nextNode();)fe.push(ue.currentNode);for(const le of fe)(re=le.parentNode)===null||re===void 0||re.removeChild(le),ce++;(0,s.logDebug)(m,"Removed HTML comments:",ce)})(Y))),ie("standardizeHeadings",(()=>(function(K,re,ce){const se=K.getElementsByTagName("h1");Array.from(se).forEach((fe=>{var le;const he=ce.createElement("h2");(0,l.transferContent)(fe,he),Array.from(fe.attributes).forEach((we=>{_.ALLOWED_ATTRIBUTES.has(we.name)&&he.setAttribute(we.name,we.value)})),(le=fe.parentNode)===null||le===void 0||le.replaceChild(he,fe)}));const ue=K.getElementsByTagName("h2");if(ue.length>0){const fe=ue[0];let le="";for(const Be of fe.querySelectorAll("a"))(0,A.isPermalinkAnchor)(Be)&&(le+=Be.textContent||"");const he=(0,s.normalizeText)((fe.textContent||"").replace(le,"")),we=(0,s.normalizeText)(re);we&&we===he&&fe.remove()}})(Y,W.title,J))),ie("wrapPreformattedCode",(()=>(function(K,re){var ce;const se=Array.from(K.querySelectorAll("code"));for(const ue of se){if(ue.closest("pre"))continue;const fe=ue.getAttribute("style")||"";if(!/white-space\s*:\s*pre/.test(fe))continue;const le=re.createElement("pre");(ce=ue.parentNode)===null||ce===void 0||ce.insertBefore(le,ue),le.appendChild(ue)}})(Y,J))),ie("standardizeElements",(()=>(function(K,re,ce){let se=0;const ue=ce?(be,Ee)=>{var xe;const Ne=performance.now(),Re=Ee();return ce["se:"+be]=((xe=ce["se:"+be])!==null&&xe!==void 0?xe:0)+Math.round(performance.now()-Ne),Re}:(be,Ee)=>Ee();ue("wrapRawLatexDelimiters",(()=>(0,b.wrapRawLatexDelimiters)(K,re))),ue("convertLatexImages",(()=>{var be;for(const Ee of Array.from(K.querySelectorAll("img[src]"))){const xe=Ee.getAttribute("src");if(!xe)continue;let Ne=(0,b.extractLatexFromImageSrc)(xe);if(!Ne){const Me=Ee.getAttribute("alt")||"";b.LOOKS_LIKE_LATEX_RE.test(Me)&&(Ne=Me)}if(!Ne)continue;const Re=/\\begin\{/.test(Ne)||((be=Ee.parentElement)===null||be===void 0?void 0:be.tagName.toLowerCase())==="p"&&Ee.parentElement.childNodes.length===1,dt=(0,E.createCleanMathEl)(null,Ne,Re,re);Ee.replaceWith(dt),se++}})),x.forEach((be=>{const Ee=be.selector.substring(0,30);ue(Ee,(()=>{if(be.fastCheck&&!K.querySelector(be.fastCheck))return;let xe;try{xe=K.querySelectorAll(be.selector)}catch{return}xe.forEach((Ne=>{if(be.transform){const Re=be.transform(Ne,re);Ne.replaceWith(Re),se++}}))}))})),Array.from(K.querySelectorAll("code > pre")).forEach((be=>{const Ee=be.parentElement;Ee&&Ee.tagName==="CODE"&&Ee.replaceWith(be)}));const fe=Array.from(K.querySelectorAll("table.ltx_equation, table.ltx_eqn_table, table.ltx_equationgroup")),le=be=>{const Ee=xe=>{var Ne;if((0,s.isTextNode)(xe))return!!(!((Ne=xe.textContent)===null||Ne===void 0)&&Ne.trim());if(!(0,s.isElement)(xe))return!1;const Re=xe.tagName.toLowerCase();return Re!=="annotation"&&Re!=="annotation-xml"&&(Re!=="semantics"||Array.from(xe.childNodes).some(Ee))};return Array.from(be.childNodes).some(Ee)};fe.forEach((be=>{const Ee=be.querySelectorAll("math");if(Ee.length===0)return;const xe=re.createDocumentFragment();Ee.forEach((Ne=>{var Re;const dt=Ne.getAttribute("alttext"),Me=Ne.querySelector('annotation[encoding="application/x-tex"]'),ze=dt||((Re=Me==null?void 0:Me.textContent)===null||Re===void 0?void 0:Re.trim())||"";if(!ze)return;const Ke=Ne.getAttribute("display")==="block"||be.classList.contains("ltx_equation")||be.classList.contains("ltx_equationgroup"),We=Ne.cloneNode(!0);We.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),We.setAttribute("display",Ke?"block":"inline"),We.setAttribute("data-latex",ze),le(We)||(We.textContent=ze),xe.appendChild(We)})),xe.childNodes.length>0&&(be.replaceWith(xe),se++)})),Array.from(K.querySelectorAll("span.ltx_note_outer")).forEach((be=>{be.remove(),se++})),Array.from(K.querySelectorAll("a.ltx_ref")).forEach((be=>{if(be.querySelector("span.ltx_ref_tag, span.ltx_text.ltx_ref_tag")){const Ee=re.createTextNode(be.textContent||"");be.replaceWith(Ee),se++}}));for(const be of Array.from(K.querySelectorAll("table"))){if(!be.parentNode)continue;const Ee=be.querySelectorAll("td, th");Ee.length>0&&Array.from(Ee).every((xe=>!(xe.textContent||"").trim()))&&!be.querySelector("img, picture, video, audio, iframe, svg, math")&&(be.remove(),se++)}Array.from(K.querySelectorAll("table")).forEach((be=>{if(!be.parentNode)return;const Ee=Array.from(be.querySelectorAll("td, th")).filter((Re=>(0,l.isDirectTableChild)(Re,be)));if(Ee.some((Re=>Re.tagName==="TH")))return;const xe=Array.from(be.querySelectorAll("tr")).filter((Re=>(0,l.isDirectTableChild)(Re,be)));if(xe.length===0||!xe.every((Re=>Ee.filter((dt=>dt.parentNode===Re)).length<=1)))return;const Ne=re.createDocumentFragment();Ee.forEach((Re=>{for(;Re.firstChild;)Ne.appendChild(Re.firstChild)})),be.replaceWith(Ne),se++})),K.querySelectorAll("video:not([controls])").forEach((be=>{be.setAttribute("controls","")})),K.querySelectorAll("lite-youtube").forEach((be=>{const Ee=be.getAttribute("videoid");if(!Ee)return;const xe=re.createElement("iframe");xe.width="560",xe.height="315",xe.src=`https://www.youtube.com/embed/${Ee}`,xe.title=be.getAttribute("videotitle")||"YouTube video player",xe.frameBorder="0",xe.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",xe.setAttribute("allowfullscreen",""),be.replaceWith(xe),se++})),(0,s.logDebug)(m,"Converted embedded elements:",se),(function(be){var Ee;const xe=Me=>{let ze=null;for(const Ke of Me.children){if(Ke.tagName.toLowerCase()!=="code"||ze)return null;ze=Ke}return ze},Ne=Me=>{var ze;const Ke=(Me.getAttribute("data-lang")||"").toLowerCase();if(Ke)return Ke;const We=(Me.getAttribute("class")||"").match(/(?:^|\s)language-([a-z0-9_+-]+)(?:\s|$)/i);return((ze=We==null?void 0:We[1])===null||ze===void 0?void 0:ze.toLowerCase())||""},Re=be.querySelectorAll('pre[data-verso-code="true"]'),dt=new Set;for(const Me of Re){const ze=Me.parentElement;ze&&dt.add(ze)}for(const Me of dt){const ze=Array.from(Me.childNodes);for(let Ke=0;Ke<ze.length;Ke++){const We=ze[Ke];if(!(0,s.isElement)(We)||We.tagName.toLowerCase()!=="pre"||We.getAttribute("data-verso-code")!=="true")continue;const at=xe(We);if(!at)continue;const mt=Ne(at);if(mt!=="lean"&&mt!=="lean4")continue;const pt=[{pre:We,code:at}],Mt=[];let Tt=Ke+1;for(;Tt<ze.length;){const rt=ze[Tt];if((0,s.isTextNode)(rt)&&!(rt.textContent||"").trim()){Mt.push(rt),Tt++;continue}if(!(0,s.isElement)(rt)||rt.tagName.toLowerCase()!=="pre")break;const wt=rt;if(wt.getAttribute("data-verso-code")!=="true")break;const _t=xe(wt);if(!_t||Ne(_t)!==mt)break;pt.push({pre:wt,code:_t}),Tt++}if(pt.length<=1)continue;const qt=pt.map((({code:rt})=>(rt.textContent||"").replace(/\r?\n$/,""))).join(`
|
|
385
|
+
`).replace(/\n{3,}/g,`
|
|
386
|
+
|
|
387
|
+
`).replace(/^\n+|\n+$/g,"");at.textContent=qt;for(let rt=1;rt<pt.length;rt++)pt[rt].pre.remove();for(const rt of Mt)(Ee=rt.parentNode)===null||Ee===void 0||Ee.removeChild(rt);Ke=Tt-1}}})(K)})(Y,J,Q))),ie("resolveSvgColors",(()=>(function(K,re){const ce=K.querySelectorAll("svg");if(ce.length===0)return;const se=re.defaultView,ue=typeof window<"u"&&se===window,fe=new Map,le=(he,we)=>{var Be,ke;if(!(he=he.replace($,((Ee,xe)=>xe.trim()))).includes("var("))return he;if(ue){const Ee=fe.get(he);if(Ee)return Ee;const xe=we||re.documentElement;try{const Ne=re.createElement("div");Ne.style.color=he,xe.appendChild(Ne);const Re=se.getComputedStyle(Ne).color;if(Ne.remove(),Re&&!Re.includes("var("))return fe.set(he,Re),Re}catch{}}const be=he.match(T);if(be){const Ee=(Be=be[2])===null||Be===void 0?void 0:Be.trim();if(Ee&&!Ee.includes("var("))return Ee;const xe=be[1].toLowerCase(),Ne=xe.match(/(?:^|-)([a-z]+)-(\d{2,3})$/);if(Ne){const Re=(ke=_.TAILWIND_COLORS[Ne[1]])===null||ke===void 0?void 0:ke[Ne[2]];if(Re)return Re}if(xe.endsWith("-black"))return"#000";if(xe.endsWith("-white"))return"#fff";if(xe.includes("background")||xe.includes("card")||xe.includes("surface")||xe.includes("bg"))return"Canvas";if(xe.includes("border")||xe.includes("divider")||xe.includes("separator"))return"#ccc";if(xe.includes("muted")||xe.includes("subtle")||xe.includes("secondary")||xe.includes("placeholder"))return"#888"}return"currentColor"};for(const he of Array.from(ce)){const we=he.parentElement,Be=[he,...Array.from(he.querySelectorAll("*"))];for(const ke of Be){for(const Ee of D){const xe=ke.getAttribute(Ee);xe&&(xe.includes("var(")||xe.includes("light-dark("))&&ke.setAttribute(Ee,le(xe,we))}const be=ke.getAttribute("style");if(be&&(be.includes("var(")||be.includes("light-dark("))){let Ee=be.replace($,((xe,Ne)=>Ne.trim()));Ee=Ee.replace(/var\(--[^,)]+(?:,\s*[^)]+)?\)/g,(xe=>le(xe,we))),ke.setAttribute("style",Ee)}P(ke)}L(he)}})(Y,J))),G?(ie("stripUnwantedAttributes",(()=>p(Y,G))),ie("removeTrailingHeadings",(()=>f(Y))),ie("stripExtraBrElements",(()=>U(Y))),(0,s.logDebug)(m,"Debug mode: Skipping div flattening to preserve structure")):(ie("replaceCustomElements",(()=>(function(K,re){const ce=Array.from(K.querySelectorAll("*")).filter((ue=>ue.tagName.includes("-")&&!_.INLINE_ELEMENTS.has(ue.tagName.toLowerCase())&&!(0,s.isSVGElement)(ue))).reverse();let se=0;for(const ue of ce){if(!ue.parentNode)continue;const fe=re.createElement("div");for(;ue.firstChild;)fe.appendChild(ue.firstChild);ue.replaceWith(fe),se++}(0,s.logDebug)(m,"Replaced custom elements with divs:",se)})(Y,J))),ie("convertDataAsSpans",(()=>(function(K,re){let ce=0;const se=Array.from(K.querySelectorAll("span[data-as]"));for(const ue of se){if(!ue.parentNode)continue;const fe=ue.getAttribute("data-as").toLowerCase();if(!M.has(fe))continue;const le=re.createElement(fe);(0,l.transferContent)(ue,le),ue.replaceWith(le),ce++}(0,s.logDebug)(m,"Converted data-as spans:",ce)})(Y,J))),ie("convertBlockSpans",(()=>(function(K,re){var ce;let se=0;const ue=Array.from(K.querySelectorAll('span[class*="block"], span[style*="block"]'));for(const fe of ue){if(!fe.parentNode||!(w.test((0,l.getClassName)(fe))||O.test(fe.getAttribute("style")||""))||!(!((ce=fe.textContent)===null||ce===void 0)&&ce.trim()))continue;const le=re.createElement("p");(0,l.transferContent)(fe,le),fe.replaceWith(le),se++}(0,s.logDebug)(m,"Converted block spans to paragraphs:",se)})(Y,J))),ie("unwrapLayoutTables",(()=>(function(K){const re=Array.from(K.querySelectorAll("table"));let ce=0;for(const se of re){if(!se.parentNode||se.querySelector("thead, tfoot, th, caption"))continue;const ue=Array.from(se.querySelectorAll(":scope > tbody > tr > td, :scope > tr > td")).filter((he=>{var we;return(we=he.textContent)===null||we===void 0?void 0:we.trim()}));if(ue.length!==1)continue;const fe=ue[0],le=Array.from(fe.children).filter((he=>{var we;return(we=he.textContent)===null||we===void 0?void 0:we.trim()}));le.length===1&&_.BLOCK_LEVEL_ELEMENTS.has(le[0].tagName.toLowerCase())&&(se.replaceWith(le[0]),ce++)}(0,s.logDebug)(m,"Unwrapped layout tables:",ce)})(Y))),ie("flattenWrapperElements[1]",(()=>ne(Y,J))),ie("removePermalinkAnchors",(()=>(0,A.removePermalinkAnchors)(Y))),ie("stripUnwantedAttributes",(()=>p(Y,G))),ie("unwrapBareSpans",(()=>(function(K){const re=Array.from(K.querySelectorAll("span")).reverse();let ce=0;for(const se of re){if(!se.parentNode||se.attributes.length>0)continue;const ue=se.parentNode;if(ue){for(;se.firstChild;)ue.insertBefore(se.firstChild,se);se.remove(),ce++}}ce>0&&K.normalize(),(0,s.logDebug)(m,"Unwrapped bare spans:",ce)})(Y))),ie("unwrapSpecialLinks",(()=>{Array.from(Y.querySelectorAll("code a")).forEach(h),Array.from(Y.querySelectorAll('a[href^="javascript:"]')).forEach(h),Array.from(Y.querySelectorAll("a")).forEach((K=>{const re=K.getAttribute("href");if(!re||re.startsWith("#"))return;const ce=Array.from(K.children).find((ue=>/^H[1-6]$/.test(ue.nodeName)));if(!ce)return;const se=J.createElement("a");for(se.setAttribute("href",re);ce.firstChild;)se.appendChild(ce.firstChild);ce.appendChild(se),h(K)})),Array.from(Y.querySelectorAll('a[href^="#"]')).forEach((K=>{K.querySelector("h1, h2, h3, h4, h5, h6")&&h(K)}))})),ie("removeObsoleteElements",(()=>Y.querySelectorAll("object, embed, applet").forEach((K=>K.remove())))),ie("removeEmptyElements",(()=>B(Y))),ie("removeTrailingHeadings",(()=>f(Y))),ie("removeOrphanedDividers[1]",(()=>v(Y))),ie("flattenWrapperElements[2]",(()=>ne(Y,J))),ie("removeOrphanedDividers[2]",(()=>v(Y))),ie("stripExtraBrElements",(()=>U(Y))),ie("removeEmptyLines",(()=>(function(K,re){let ce=0;const se=Date.now(),ue=he=>{var we;if((0,s.isElement)(he)){const Be=he.tagName.toLowerCase();if(Be==="pre"||Be==="code")return}if(Array.from(he.childNodes).forEach(ue),(0,s.isTextNode)(he)){const Be=he.textContent||"";if(!Be||/^[\u200C\u200B\u200D\u200E\u200F\uFEFF]*$/.test(Be))(we=he.parentNode)===null||we===void 0||we.removeChild(he),ce++;else{const ke=Be.replace(/[\n\r]+/g," ").replace(/\t+/g," ").replace(/ {2,}/g," ").replace(/^[ ]+$/," ").replace(/\s+([,.!?:;])/g,"$1").replace(/[\u200B\u200D\u200E\u200F\uFEFF]+/g,"").replace(/(?:\xA0){2,}/g," ");ke!==Be&&(he.textContent=ke,ce+=Be.length-ke.length)}}},fe=he=>{var we;if(!(0,s.isElement)(he))return;const Be=he.tagName.toLowerCase();if(Be==="pre"||Be==="code")return;Array.from(he.childNodes).filter(s.isElement).forEach(fe),he.normalize();const ke=((we=(0,s.getComputedStyle)(he))===null||we===void 0?void 0:we.display)==="block",be=ke?/^[\n\r\t \u200C\u200B\u200D\u200E\u200F\uFEFF\xA0]*$/:/^[\n\r\t\u200C\u200B\u200D\u200E\u200F\uFEFF]*$/;for(;he.firstChild&&(0,s.isTextNode)(he.firstChild)&&(he.firstChild.textContent||"").match(be);)he.removeChild(he.firstChild),ce++;for(;he.lastChild&&(0,s.isTextNode)(he.lastChild)&&(he.lastChild.textContent||"").match(be);)he.removeChild(he.lastChild),ce++;if(!ke&&_.INLINE_ELEMENTS.has(Be)&&he.parentNode&&(ce+=I(he,re,"leading"),ce+=I(he,re,"trailing")),!ke){const Ee=Array.from(he.childNodes);for(let xe=0;xe<Ee.length-1;xe++){const Ne=Ee[xe],Re=Ee[xe+1];if((0,s.isElement)(Ne)||(0,s.isElement)(Re)){if(X(Ne)||X(Re))continue;const dt=Re.textContent||"",Me=Ne.textContent||"",ze=H(Re),Ke=dt.match(/^[,.!?:;)\]\u201d\u2019\u2014\u2013]/),We=Me.match(/[,.!?:;(\[\u201c\u2018\u2014\u2013]\s*$/),at=(0,s.isTextNode)(Ne)&&(Ne.textContent||"").endsWith(" ")||(0,s.isTextNode)(Re)&&(Re.textContent||"").startsWith(" ");if(!(ze||Ke||We||at)){const mt=re.createTextNode(" ");he.insertBefore(mt,Re)}}}}};ue(K),fe(K);const le=Date.now();(0,s.logDebug)(m,"Removed empty lines:",{charactersRemoved:ce,processingTime:`${(le-se).toFixed(2)}ms`})})(Y,J))))},d.removeOrphanedDividers=v;const _=g(2640),E=g(6e3),b=g(7282),C=g(754),A=g(7864),a=g(2649),s=g(2552),l=g(639),u=g(6077);let m=!1;const x=[...E.mathRules,...C.codeBlockRules,...A.headingRules,...a.imageRules,{selector:'div[data-testid^="paragraph"], div[role="paragraph"]',element:"p",transform:(Y,W)=>{const J=W.createElement("p");return(0,l.transferContent)(Y,J),Array.from(Y.attributes).forEach((G=>{_.ALLOWED_ATTRIBUTES.has(G.name)&&J.setAttribute(G.name,G.value)})),J}},{selector:'div[role="list"]',element:"ul",transform:(Y,W)=>{var J;const G=Y.querySelector('div[role="listitem"] .label'),Q=(((J=G==null?void 0:G.textContent)===null||J===void 0?void 0:J.trim())||"").match(/^\d+\)/),ie=W.createElement(Q?"ol":"ul");return Y.querySelectorAll('div[role="listitem"]').forEach((K=>{const re=W.createElement("li"),ce=K.querySelector(".content");ce&&(ce.querySelectorAll('div[role="paragraph"]').forEach((se=>{const ue=W.createElement("p");(0,l.transferContent)(se,ue),se.replaceWith(ue)})),ce.querySelectorAll('div[role="list"]').forEach((se=>{var ue;const fe=se.querySelector('div[role="listitem"] .label'),le=(((ue=fe==null?void 0:fe.textContent)===null||ue===void 0?void 0:ue.trim())||"").match(/^\d+\)/),he=W.createElement(le?"ol":"ul");se.querySelectorAll('div[role="listitem"]').forEach((we=>{const Be=W.createElement("li"),ke=we.querySelector(".content");ke&&(ke.querySelectorAll('div[role="paragraph"]').forEach((be=>{const Ee=W.createElement("p");(0,l.transferContent)(be,Ee),be.replaceWith(Ee)})),(0,l.transferContent)(ke,Be)),he.appendChild(Be)})),se.replaceWith(he)})),(0,l.transferContent)(ce,re)),ie.appendChild(re)})),ie}},{selector:'div[role="listitem"]',element:"li",transform:(Y,W)=>{const J=Y.querySelector(".content");return J?(J.querySelectorAll('div[role="paragraph"]').forEach((G=>{const Q=W.createElement("p");(0,l.transferContent)(G,Q),G.replaceWith(Q)})),J):Y}}];function f(Y){let W=0;const J=Q=>{let ie="",K=Q.nextSibling;for(;K;)((0,s.isTextNode)(K)||(0,s.isElement)(K))&&(ie+=K.textContent||""),K=K.nextSibling;if(ie.trim())return!0;const re=Q.parentElement;return!(!re||re===Y)&&J(re)},G=Array.from(Y.querySelectorAll("h1, h2, h3, h4, h5, h6")).reverse();for(const Q of G){if(J(Q))break;Q.remove(),W++}W>0&&(0,s.logDebug)(m,"Removed trailing headings:",W)}function v(Y){for(;;){let W=Y.firstChild;for(;W&&(0,s.isTextNode)(W)&&!(W.textContent||"").trim();)W=W.nextSibling;if(!W||!(0,s.isElement)(W)||W.tagName.toLowerCase()!=="hr")break;W.remove()}for(;;){let W=Y.lastChild;for(;W&&(0,s.isTextNode)(W)&&!(W.textContent||"").trim();)W=W.previousSibling;if(!W||!(0,s.isElement)(W)||W.tagName.toLowerCase()!=="hr")break;W.remove()}for(const W of Y.querySelectorAll("hr")){if(!W.parentNode)continue;let J=W.nextSibling;for(;J;)if(!(0,s.isTextNode)(J)||(J.textContent||"").trim()){if(!(0,s.isElement)(J)||J.tagName!=="HR")break;{const G=J.nextSibling;J.remove(),J=G}}else J=J.nextSibling}}function p(Y,W,J=!1){let G=0;const Q=ie=>{if((0,s.isSVGElement)(ie))return void(!W&&ie.hasAttribute("class")&&(ie.removeAttribute("class"),G++));const K=Array.from(ie.attributes),re=ie.tagName.toLowerCase();K.forEach((ce=>{const se=ce.name.toLowerCase(),ue=ce.value;if(!(se==="id"&&(ue.startsWith("fnref:")||ue.startsWith("fn:")||ue==="footnotes")||se==="class"&&(re==="code"&&ue.startsWith("language-")||ue==="footnote-backref"||/^callout(?:-|$)/.test(ue))||J&&se==="data-defuddle")){if(J&&!W&&se==="class"){const fe=ue.split(/\s+/).filter(u.isExtractorClass).join(" ");if(fe)return void(fe!==ue&&(ie.setAttribute("class",fe),G++))}W?_.ALLOWED_ATTRIBUTES.has(se)||_.ALLOWED_ATTRIBUTES_DEBUG.has(se)||se.startsWith("data-")||(ie.removeAttribute(ce.name),G++):_.ALLOWED_ATTRIBUTES.has(se)||(ie.removeAttribute(ce.name),G++)}}))};Q(Y),Y.querySelectorAll("*").forEach(Q),(0,s.logDebug)(m,"Stripped attributes:",G)}function h(Y){for(var W;Y.firstChild;)(W=Y.parentNode)===null||W===void 0||W.insertBefore(Y.firstChild,Y);Y.remove()}const w=/(?:^|\s)block(?:\s|$)/,O=/display\s*:\s*block/i,M=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote"]),$=/light-dark\(\s*([^,]+?)\s*,\s*[^)]+?\)/g,T=/var\(--([^,)]+)(?:,\s*([^)]+))?\)/,D=["fill","stroke","color","stop-color","flood-color","lighting-color"],R=new Set(["path","rect","circle","ellipse","polygon"]),S=new Set(["line","polyline"]),y=new Set(["text","tspan"]),k="defs, clipPath, mask, pattern, marker";function N(Y,W){const J=Y.getAttribute("style");return!!J&&new RegExp(`(?:^|;)\\s*${W}\\s*:`).test(J)}function L(Y){if(Y.querySelector("style"))return;const W=Array.from(Y.querySelectorAll("*"));let J=!1;for(const G of W){const Q=G.tagName.toLowerCase();if(R.has(Q)&&G.getAttribute("class")&&!G.closest(k)&&!G.hasAttribute("fill")&&!N(G,"fill")){J=!0;break}}if(J)for(const G of W){const Q=G.tagName.toLowerCase(),ie=R.has(Q),K=S.has(Q),re=y.has(Q);if(!ie&&!K&&!re||!G.getAttribute("class")||G.closest(k))continue;if(re){G.hasAttribute("fill")||N(G,"fill")||G.setAttribute("fill","currentColor");continue}const ce=G.hasAttribute("fill")&&G.getAttribute("fill")!=="none",se=G.hasAttribute("stroke")||N(G,"stroke");if(!ie||G.hasAttribute("fill")||N(G,"fill")||G.setAttribute("fill","none"),!se){if(K)G.setAttribute("stroke","currentColor"),G.hasAttribute("stroke-opacity")||G.setAttribute("stroke-opacity","0.2");else if(ie&&!ce){const ue=G.getAttribute("d")||"";/Z\s*$/i.test(ue.trim())||G.setAttribute("stroke","currentColor")}}}}function P(Y){var W;const J=Y.getAttribute("class");if(!J)return;const G=J.split(/\s+/),Q=[],ie=[];for(const K of G){let re=K.match(_.TW_COLOR_CLASS_RE);if(re){const[,ce,se,ue,fe]=re,le=(W=_.TAILWIND_COLORS[se])===null||W===void 0?void 0:W[ue];if(le){if(fe){const he=parseInt(fe)/100,we=parseInt(le.slice(1,3),16),Be=parseInt(le.slice(3,5),16),ke=parseInt(le.slice(5,7),16);Y.setAttribute(ce,`rgba(${we},${Be},${ke},${he})`)}else Y.setAttribute(ce,le);continue}}re=K.match(_.TW_SPECIAL_CLASS_RE),re?Y.setAttribute(re[1],_.TAILWIND_SPECIAL[re[2]]):(re=K.match(_.TW_ARBITRARY_RE),!re||re[1].startsWith("#")||re[1].startsWith("rgb")||re[1].startsWith("hsl")?K!=="font-semibold"?K!=="font-bold"?K!=="font-medium"?K!=="font-mono"?Q.push(K):ie.push("font-family:monospace"):ie.push("font-weight:500"):ie.push("font-weight:700"):ie.push("font-weight:600"):ie.push(`font-size:${re[1]}`))}if(Q.length!==G.length&&(Q.length>0?Y.setAttribute("class",Q.join(" ")):Y.removeAttribute("class"),ie.length>0)){const K=Y.getAttribute("style")||"",re=K&&!K.endsWith(";")?";":"";Y.setAttribute("style",K+re+ie.join(";"))}}function B(Y){let W=0;const J=Q=>{var ie;if(_.ALLOWED_EMPTY_ELEMENTS.has(Q.tagName.toLowerCase()))return!1;if(Q.tagName==="DIV"){const ce=Q.children;if(ce.length>0){let se=!0;for(let ue=0;ue<ce.length;ue++){const fe=ce[ue];if(fe.tagName!=="SPAN"){se=!1;break}const le=((ie=fe.textContent)===null||ie===void 0?void 0:ie.trim())||"";if(le!==","&&le!==""&&le!==" "){se=!1;break}}if(se)return!0}}const K=Q.textContent||"";if(K.trim().length>0||K.includes(" "))return!1;if(!Q.hasChildNodes())return!0;const re=Q.childNodes;for(let ce=0;ce<re.length;ce++){const se=re[ce];if((0,s.isElement)(se)&&se.tagName.toLowerCase()==="br")continue;if(!(0,s.isTextNode)(se))return!1;const ue=se.textContent||"";if(ue.trim().length>0||ue.includes(" "))return!1}return!0},G=Array.from(Y.querySelectorAll("*")).reverse();for(const Q of G)Q.parentNode&&J(Q)&&(Q.remove(),W++);(0,s.logDebug)(m,"Removed empty elements:",W)}function U(Y){let W=0;const J=Date.now(),G=Array.from(Y.getElementsByTagName("br"));let Q=[];const ie=()=>{if(Q.length>2)for(let ce=2;ce<Q.length;ce++)Q[ce].remove(),W++;Q=[]};G.forEach((ce=>{let se=!1;if(Q.length>0){const ue=Q[Q.length-1];F(ce,"previous")===ue&&(se=!0)}se?Q.push(ce):(ie(),Q=[ce])})),ie();const K=Array.from(Y.getElementsByTagName("br"));for(const ce of K){const se=ce.parentElement;if(!se||ce.closest("pre, code"))continue;const ue=se.tagName.toLowerCase();if(_.BLOCK_LEVEL_ELEMENTS.has(ue)||ue==="body"){const fe=[ce];let le=F(ce,"next");for(;le&&(0,s.isElement)(le)&&le.tagName.toLowerCase()==="br";)fe.push(le),le=F(le,"next");const he=F(fe[0],"previous"),we=F(fe[fe.length-1],"next"),Be=he&&(0,s.isElement)(he)&&_.BLOCK_LEVEL_ELEMENTS.has(he.tagName.toLowerCase()),ke=we&&(0,s.isElement)(we)&&_.BLOCK_LEVEL_ELEMENTS.has(we.tagName.toLowerCase());if(Be&&ke||Be&&!we||!he){for(const be of fe)be.remove(),W++;continue}}_.BLOCK_LEVEL_ELEMENTS.has(ue)&&(F(ce,"next")||(ce.remove(),W++))}const re=Date.now();(0,s.logDebug)(m,"Standardized br elements:",{removed:W,processingTime:`${(re-J).toFixed(2)}ms`})}function F(Y,W){var J;const G=W==="previous"?"previousSibling":"nextSibling";let Q=Y[G];for(;Q&&(0,s.isTextNode)(Q)&&!(!((J=Q.textContent)===null||J===void 0)&&J.trim());)Q=Q[G];return Q}function I(Y,W,J){const G=J==="leading"?Y.firstChild:Y.lastChild;if(!G||!(0,s.isTextNode)(G))return 0;const Q=G.textContent||"",ie=J==="leading"?Q.replace(/^\s+/,""):Q.replace(/\s+$/,"");if(ie===Q||!Y.parentNode)return 0;G.textContent=ie;const K=J==="leading"?Y.previousSibling:Y.nextSibling;if(!(K&&(0,s.isTextNode)(K)&&(J==="leading"?(K.textContent||"").endsWith(" "):(K.textContent||"").startsWith(" ")))){const re=J==="leading"?Y:Y.nextSibling;Y.parentNode.insertBefore(W.createTextNode(" "),re)}return 1}function H(Y){return(0,s.isElement)(Y)&&Y.tagName.toLowerCase()==="sup"&&(Y.getAttribute("id")||"").startsWith("fnref:")}const V=new Set(["sub","sup","code"]);function X(Y){return(0,s.isElement)(Y)&&V.has(Y.tagName.toLowerCase())&&!H(Y)}function ne(Y,W){let J=0;const G=Date.now();let Q=!0;function ie(le){var he;for(const we of le.childNodes)if((0,s.isTextNode)(we)&&(!((he=we.textContent)===null||he===void 0)&&he.trim())||(0,s.isElement)(we)&&_.INLINE_ELEMENTS.has(we.nodeName.toLowerCase()))return!0;return!1}const K=le=>{var he;const we=le.tagName.toLowerCase();if((0,s.isSVGElement)(le)||_.PRESERVE_ELEMENTS.has(we)||le.getAttribute("data-callout")||!((he=le.closest)===null||he===void 0)&&he.call(le,"[data-callout]"))return!0;const Be=le.getAttribute("role");if(Be&&["article","main","navigation","banner","contentinfo"].includes(Be))return!0;const ke=(0,l.getClassName)(le);return ke&&ke.toLowerCase().match(/(?:article|main|content|footnote|reference|bibliography)/)?!0:!!Array.from(le.children).some((be=>_.PRESERVE_ELEMENTS.has(be.tagName.toLowerCase())||be.getAttribute("role")==="article"||!!(0,l.getClassName)(be)&&(0,l.getClassName)(be).toLowerCase().match(/(?:article|main|content|footnote|reference|bibliography)/)))},re=le=>{var he,we;if(!le.parentNode||K(le))return!1;const Be=le.tagName.toLowerCase();if(!_.ALLOWED_EMPTY_ELEMENTS.has(Be)&&!le.children.length&&!(!((he=le.textContent)===null||he===void 0)&&he.trim()))return le.remove(),J++,!0;if(le.parentElement===Y){const be=Array.from(le.children);if(be.length>0&&!be.some((Ee=>{const xe=Ee.tagName.toLowerCase();return _.INLINE_ELEMENTS.has(xe)}))){const Ee=W.createDocumentFragment();for(;le.firstChild;)Ee.appendChild(le.firstChild);return le.replaceWith(Ee),J++,!0}}if(!ie(le)){const be=W.createDocumentFragment();for(;le.firstChild;)be.appendChild(le.firstChild);return le.replaceWith(be),J++,!0}const ke=Array.from(le.childNodes);if(ke.length>0&&ke.every((be=>(0,s.isTextNode)(be)||(0,s.isElement)(be)&&_.INLINE_ELEMENTS.has(be.nodeName.toLowerCase())))&&(!((we=le.textContent)===null||we===void 0)&&we.trim())){const be=W.createElement("p");for(;le.firstChild;)be.appendChild(le.firstChild);return le.replaceWith(be),J++,!0}if(le.children.length===1){const be=le.firstElementChild,Ee=be.tagName.toLowerCase();if(_.BLOCK_ELEMENTS_SET.has(Ee)&&!K(be))return le.replaceWith(be),J++,!0}return!1},ce=()=>{const le=Array.from(Y.children).filter((we=>_.BLOCK_ELEMENTS_SET.has(we.tagName.toLowerCase())));let he=!1;return le.forEach((we=>{re(we)&&(he=!0)})),he},se=()=>{const le=Array.from(Y.querySelectorAll(_.BLOCK_ELEMENTS_SELECTOR)).sort(((we,Be)=>{const ke=be=>{let Ee=0,xe=be.parentElement;for(;xe;){const Ne=xe.tagName.toLowerCase();_.BLOCK_ELEMENTS_SET.has(Ne)&&Ee++,xe=xe.parentElement}return Ee};return ke(Be)-ke(we)}));let he=!1;return le.forEach((we=>{re(we)&&(he=!0)})),he},ue=()=>{const le=Array.from(Y.querySelectorAll(_.BLOCK_ELEMENTS_SELECTOR));let he=!1;return le.forEach((we=>{const Be=Array.from(we.children);if(Be.length>0&&Be.every((ke=>ke.tagName.toLowerCase()==="p"))||!K(we)&&!ie(we)){const ke=W.createDocumentFragment();for(;we.firstChild;)ke.appendChild(we.firstChild);we.replaceWith(ke),J++,he=!0}})),he};do Q=!1,ce()&&(Q=!0),se()&&(Q=!0),ue()&&(Q=!0);while(Q);const fe=Date.now();(0,s.logDebug)(m,"Flattened wrapper elements:",{count:J,processingTime:`${(fe-G).toFixed(2)}ms`})}},2552(c,d){Object.defineProperty(d,"__esModule",{value:!0}),d.CJK_CHAR_RANGES=void 0,d.isElement=function(b){return b.nodeType===g},d.isTextNode=function(b){return b.nodeType===_},d.isSVGElement=function(b){var C;return((C=b.closest)===null||C===void 0?void 0:C.call(b,"svg"))!==null||b.namespaceURI==="http://www.w3.org/2000/svg"},d.getComputedStyle=function(b){const C=E(b.ownerDocument);return C&&typeof C.getComputedStyle=="function"?C.getComputedStyle(b):null},d.getWindow=E,d.textPreview=function(b){return(b.textContent||"").trim().substring(0,200)},d.logDebug=function(b,C,...A){b&&console.log("Defuddle:",C,...A)},d.normalizeText=function(b){return b.replace(/\u00A0/g," ").replace(/[\u2018\u2019\u201A\u201B]/g,"'").replace(/[\u2012\u2013\u2014\u2015]/g,"-").replace(/[\u201C\u201D\u201E\u201F]/g,'"').replace(/\u2026/g,"...").replace(/\s+/g," ").trim().toLowerCase()},d.countWords=function(b){if(!b)return 0;let C=0,A=0,a=!1;for(let s=0;s<b.length;s++){const l=b.charCodeAt(s);l>=12352&&l<=12447||l>=12448&&l<=12543||l>=13312&&l<=19903||l>=19968&&l<=40959||l>=63744&&l<=64255||l>=44032&&l<=55215?(C++,a=!1):l<=32?a=!1:a||(A++,a=!0)}return C+A};const g=1,_=3;function E(b){return b.defaultView?b.defaultView:b.ownerWindow?b.ownerWindow:b.window?b.window:null}d.CJK_CHAR_RANGES="\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4dbf\\u4e00-\\u9fff\\uf900-\\ufaff\\uac00-\\ud7af"},6618(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.bbcodeToHtml=function(E){let b=E;return b=b.replace(/\[h1\]([\s\S]*?)\[\/h1\]/gi,"<h1>$1</h1>"),b=b.replace(/\[h2\]([\s\S]*?)\[\/h2\]/gi,"<h2>$1</h2>"),b=b.replace(/\[h3\]([\s\S]*?)\[\/h3\]/gi,"<h3>$1</h3>"),b=b.replace(/\[b\]([\s\S]*?)\[\/b\]/gi,"<strong>$1</strong>"),b=b.replace(/\[i\]([\s\S]*?)\[\/i\]/gi,"<em>$1</em>"),b=b.replace(/\[u\]([\s\S]*?)\[\/u\]/gi,"<u>$1</u>"),b=b.replace(/\[s\]([\s\S]*?)\[\/s\]/gi,"<s>$1</s>"),b=b.replace(/\[url=["']?([^"'\]]+)["']?\]([\s\S]*?)\[\/url\]/gi,((C,A,a)=>(0,_.isDangerousUrl)(A)?a:`<a href="${A}">${a}</a>`)),b=b.replace(/\[img\]([\s\S]*?)\[\/img\]/gi,'<img src="$1">'),b=b.replace(/\[previewyoutube=["']?([^;'"]+)[^"'\]]*["']?\]\[\/previewyoutube\]/gi,'<img src="https://www.youtube.com/watch?v=$1">'),b=b.replace(/\[list\]([\s\S]*?)\[\/list\]/gi,((C,A)=>`<ul>${A.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\]|$)/gi,"<li>$1</li>")}</ul>`)),b=b.replace(/\[olist\]([\s\S]*?)\[\/olist\]/gi,((C,A)=>`<ol>${A.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/olist\]|$)/gi,"<li>$1</li>")}</ol>`)),b=b.replace(/\[quote(?:=[^\]]+)?\]([\s\S]*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>"),b=b.replace(/\[code\]([\s\S]*?)\[\/code\]/gi,"<pre><code>$1</code></pre>"),b=b.replace(/\[spoiler\]([\s\S]*?)\[\/spoiler\]/gi,"<details><summary>Spoiler</summary>$1</details>"),b=b.replace(/\[p\]([\s\S]*?)\[\/p\]/gi,((C,A)=>`<p>${A.replace(/\n/g,"<br>")}</p>`)),b=b.replace(/\n/g,"<br>"),b=b.replace(/\[[^\]]+\]/g,""),b};const _=g(639)},6077(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.SITE_TOKENS=void 0,d.isExtractorClass=function(A){return E.has(A)||b.test(A)},d.buildContentHtml=function(A,a,s){return`
|
|
388
|
+
<article data-defuddle>
|
|
389
|
+
<div class="${A} post">
|
|
390
|
+
<div class="post-content">
|
|
391
|
+
${a}
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
${s?`
|
|
395
|
+
<hr>
|
|
396
|
+
<div class="${A} comments">
|
|
397
|
+
<h2>Comments</h2>
|
|
398
|
+
${s}
|
|
399
|
+
</div>
|
|
400
|
+
`:""}
|
|
401
|
+
</article>
|
|
402
|
+
`.trim()},d.buildCommentTree=function(A){var a,s,l;const u=[],m=[];for(const x of A){const f=(a=x.depth)!==null&&a!==void 0?a:0;if(f===0){for(;m.length>0;)u.push("</blockquote>"),m.pop();u.push("<blockquote>"),m.push(0)}else{if(f<((s=m[m.length-1])!==null&&s!==void 0?s:-1))for(;m.length>0&&m[m.length-1]>=f;)u.push("</blockquote>"),m.pop();f>((l=m[m.length-1])!==null&&l!==void 0?l:-1)&&(u.push("<blockquote>"),m.push(f))}u.push(C(x))}for(;m.length>0;)u.push("</blockquote>"),m.pop();return u.join("")},d.buildComment=C,d.buildQuotedPost=function(A){let a="";A.author&&(a+=`<p><strong>${(0,_.escapeHtml)(A.author)}</strong>`,A.date&&(a+=` · ${(0,_.escapeHtml)(A.date)}`),a+="</p>");let s="";if(A.url){const l=(0,_.isDangerousUrl)(A.url)?"":A.url;l&&(s=`
|
|
403
|
+
<p><a href="${(0,_.escapeHtml)(l)}">${(0,_.escapeHtml)(l)}</a></p>`)}return`<blockquote class="quoted-post">${a}${A.content}${s}</blockquote>`};const _=g(639);d.SITE_TOKENS=["bluesky","discourse","github","gmail","hackernews","linkedin","lwn","mastodon","reddit","threads","twitter"];const E=new Set(d.SITE_TOKENS),b=/^(?:comments?|posts?|quoted-post|x-article)(?:-[\w-]+)?$/;function C(A){const a=`<span class="comment-author"><strong>${(0,_.escapeHtml)(A.author)}</strong></span>`,s=A.url&&!(0,_.isDangerousUrl)(A.url)?A.url:"";return`<div class="comment">
|
|
404
|
+
<div class="comment-metadata">
|
|
405
|
+
${a} · ${s?`<a href="${(0,_.escapeHtml)(s)}" class="comment-link">${(0,_.escapeHtml)(A.date)}</a>`:`<span class="comment-date">${(0,_.escapeHtml)(A.date)}</span>`}${A.score?` · <span class="comment-points">${(0,_.escapeHtml)(A.score)}</span>`:""}
|
|
406
|
+
</div>
|
|
407
|
+
<div class="comment-content">${A.content}</div>
|
|
408
|
+
</div>`}},639(c,d){Object.defineProperty(d,"__esModule",{value:!0}),d.transferContent=function(b,C){if("replaceChildren"in C)C.replaceChildren();else for(;C.firstChild;)C.removeChild(C.firstChild);for(;b.firstChild;)C.appendChild(b.firstChild)},d.serializeHTML=function(b){return b.innerHTML},d.decodeHTMLEntities=function(b,C){const A=b.createElement("textarea");return A.innerHTML=C,A.value},d.escapeHtml=function(b){return b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},d.getClassName=function(b){return typeof b.className=="string"?b.className:b.getAttribute("class")||""},d.hasResponsiveShowClass=function(b){return b.split(/\s+/).some((C=>g.test(C)))},d.isDangerousUrl=function(b,C=!0){const A=b.replace(/[\s\u0000-\u001F]+/g,"").toLowerCase();return A.startsWith("javascript:")||A.startsWith("blob:")?!0:A.startsWith("data:")?!(C&&A.startsWith("data:image/")):!1},d.isDirectTableChild=function(b,C){let A=b.parentNode;for(;A&&A!==C;){if(A.nodeName==="TABLE")return!1;A=A.parentNode}return A===C},d.isNodeBefore=function(b,C){if(b===C)return!1;const A=l=>{const u=[];for(let m=l;m;m=m.parentNode)u.push(m);return u},a=A(b),s=A(C);if(a[a.length-1]!==s[s.length-1])return!1;for(;a.length&&s.length&&a[a.length-1]===s[s.length-1];)a.pop(),s.pop();if(!a.length)return!0;if(!s.length)return!1;for(let l=a[a.length-1].nextSibling;l;l=l.nextSibling)if(l===s[s.length-1])return!0;return!1},d.parseHTML=function(b,C){if(!C)return b.createDocumentFragment();const A=b.createElement("template");if(A.innerHTML=C,A.content)return A.content;const a=b.createElement("div");a.innerHTML=C;const s=b.createDocumentFragment();for(;a.firstChild;)s.appendChild(a.firstChild);return s},d.classOrIdSelector=function(b,C){if(!C||E.test(C))return null;if(_.test(C))return(b==="class"?".":"#")+C;const A=C.replace(/["\\]/g,"\\$&").replace(/[\x01-\x1f\x7f]/g,(a=>`\\${a.charCodeAt(0).toString(16)} `));return`[${b}${b==="class"?"~":""}="${A}"]`};const g=/^(sm|md|lg|xl|2xl|min-\[|max-\[):(?:block|flex|grid|inline|table|contents)/,_=/^(?:--|-?[a-zA-Z_])[a-zA-Z0-9_-]*$/,E=/\0|[^\S\t\n\f\r ]/},1497(c,d,g){Object.defineProperty(d,"__esModule",{value:!0}),d.formatTimestamp=E,d.buildTranscript=function(b,C,A=[]){const a=[...A].sort(((m,x)=>m.start-x.start));let s=0;const l=[],u=[];for(const m of C){for(;s<a.length&&a[s].start<=m.start;){const p=a[s].title;l.push(`<h3>${(0,_.escapeHtml)(p)}</h3>`),u.length>0&&u.push(""),u.push(`### ${p}`),u.push(""),s++}const x=E(m.start),f=m.speaker!==void 0?` speaker-${m.speaker}`:"",v=`<strong><span class="timestamp" data-timestamp="${m.start}">${x}</span></strong>`;l.push(`<p class="transcript-segment${f}">${v} · ${(0,_.escapeHtml)(m.text)}</p>`),m.speakerChange&&u.length>0&&u.push(""),u.push(`**${x}** · ${m.text}`)}return{html:`<div class="${b} transcript">
|
|
409
|
+
<h2>Transcript</h2>
|
|
410
|
+
${l.join(`
|
|
411
|
+
`)}
|
|
412
|
+
</div>`,text:u.join(`
|
|
413
|
+
`)}};const _=g(639);function E(b){const C=Math.floor(b/3600),A=Math.floor(b%3600/60),a=Math.floor(b%60);return C>0?`${C}:${String(A).padStart(2,"0")}:${String(a).padStart(2,"0")}`:`${A}:${String(a).padStart(2,"0")}`}}},n={};function o(c){var d=n[c];if(d!==void 0)return d.exports;var g=n[c]={exports:{}};return r[c].call(g.exports,g,g.exports,o),g.exports}var i={};return(()=>{var c=i;const d=o(5628);c.default=d.Defuddle})(),i=i.default})()))})(Uo)),Uo.exports}var L0=N0();const O0=pr(L0);/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */function yc(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function R0(t){if(Array.isArray(t))return t}function I0(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,c,d=[],g=!0,_=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(g=(n=i.call(r)).done)&&(d.push(n.value),d.length!==e);g=!0);}catch(E){_=!0,o=E}finally{try{if(!g&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(_)throw o}}return d}}function M0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
414
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function $0(t,e){return R0(t)||I0(t,e)||P0(t,e)||M0()}function P0(t,e){if(t){if(typeof t=="string")return yc(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yc(t,e):void 0}}const Ec=Object.entries,Ac=Object.setPrototypeOf,q0=Object.isFrozen,wc=Object.getPrototypeOf,Cc=Object.getOwnPropertyDescriptor;let kt=Object.freeze,Rt=Object.seal,xn=Object.create,Sc=typeof Reflect<"u"&&Reflect,ps=Sc.apply,gs=Sc.construct;kt||(kt=function(e){return e}),Rt||(Rt=function(e){return e}),ps||(ps=function(e,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return e.apply(r,o)}),gs||(gs=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new e(...n)});const kr=ht(Array.prototype.forEach),B0=ht(Array.prototype.lastIndexOf),_c=ht(Array.prototype.pop),Hn=ht(Array.prototype.push),F0=ht(Array.prototype.slice),z0=ht(Array.prototype.splice),yn=Array.isArray,vs=Lc(Set),bs=ht(Set.prototype.add),Un=ht(Set.prototype.has),tn=ht(String.prototype.toLowerCase),xs=ht(String.prototype.toString),Tc=ht(String.prototype.match),jn=ht(String.prototype.replace),Dc=ht(String.prototype.indexOf),H0=ht(String.prototype.trim),U0=ht(Number.prototype.toString),j0=ht(Boolean.prototype.toString),kc=typeof BigInt>"u"?null:ht(BigInt.prototype.toString),Nc=typeof Symbol>"u"?null:ht(Symbol.prototype.toString),Vt=ht(Object.prototype.hasOwnProperty),Wn=ht(Object.prototype.toString),It=ht(RegExp.prototype.test),Nr=Lc(TypeError);function ht(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return ps(t,e,n)}}function Lc(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return gs(t,r)}}function Xe(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tn;if(Ac&&Ac(t,null),!yn(e))return t;let n=e.length;for(;n--;){let o=e[n];if(typeof o=="string"){const i=r(o);i!==o&&(q0(e)||(e[n]=i),o=i)}t[o]=!0}return t}function W0(t){for(let e=0;e<t.length;e++)Vt(t,e)||(t[e]=null);return t}function nr(t){const e=xn(null);for(const n of Ec(t)){var r=$0(n,2);const o=r[0],i=r[1];Vt(t,o)&&(yn(i)?e[o]=W0(i):i&&typeof i=="object"&&i.constructor===Object?e[o]=nr(i):e[o]=i)}return e}function V0(t){switch(typeof t){case"string":return t;case"number":return U0(t);case"boolean":return j0(t);case"bigint":return kc?kc(t):"0";case"symbol":return Nc?Nc(t):"Symbol()";case"undefined":return Wn(t);case"function":case"object":{if(t===null)return Wn(t);const e=t,r=cr(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:Wn(n)}return Wn(t)}default:return Wn(t)}}function cr(t,e){for(;t!==null;){const n=Cc(t,e);if(n){if(n.get)return ht(n.get);if(typeof n.value=="function")return ht(n.value)}t=wc(t)}function r(){return null}return r}function Z0(t,e){for(;t!==null;){const r=Cc(t,e);if(r)return r.get?ht(r.get):null;t=wc(t)}return null}function G0(t){try{return It(t,""),!0}catch{return!1}}const Oc=kt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ys=kt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Es=kt(["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"]),Y0=kt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),As=kt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),J0=kt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rc=kt(["#text"]),Ic=kt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ws=kt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Mc=kt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),jo=kt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),X0=Rt(/{{[\w\W]*|^[\w\W]*}}/g),K0=Rt(/<%[\w\W]*|^[\w\W]*%>/g),Q0=Rt(/\${[\w\W]*/g),ev=Rt(/^data-[\-\w.\u00B7-\uFFFF]+$/),tv=Rt(/^aria-[\-\w]+$/),$c=Rt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rv=Rt(/^(?:\w+script|data):/i),nv=Rt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ov=Rt(/^html$/i),iv=Rt(/^[a-z][.\w]*(-[.\w]+)+$/i),Cs=Rt(/<[/\w!]/g),Pc=Rt(/<[/\w]/g),sv=Rt(/<\/no(script|embed|frames)/i),qc=Rt(/\/>/i),St={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},av=kt(Xe({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),lv=function(){return typeof window>"u"?null:window},cv=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(n=r.getAttribute(o));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Bc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ur=function(e,r,n,o){return Vt(e,r)&&yn(e[r])?Xe(o.base?nr(o.base):{},e[r],o.transform):n},Ss=function(e,r,n){const o=Vt(e,r)?e[r]:void 0;return o&&typeof o=="object"?nr(o):n()};function Fc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lv();const e=ye=>Fc(ye);if(e.version="3.4.17",e.removed=[],!t||!t.document||t.document.nodeType!==St.document||!t.Element)return e.isSupported=!1,e;let r=t.document;const n=r,o=n.currentScript;t.DocumentFragment;const i=t.HTMLTemplateElement,c=t.Node,d=t.Element,g=t.NodeFilter;t.NamedNodeMap===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const _=t.DOMParser,E=t.trustedTypes,b=d.prototype,C=cr(b,"cloneNode"),A=cr(b,"remove"),a=cr(b,"removeAttributeNode"),s=cr(b,"nextSibling"),l=cr(b,"childNodes"),u=cr(b,"parentNode"),m=cr(b,"shadowRoot"),x=cr(b,"attributes"),f=c&&c.prototype?cr(c.prototype,"nodeType"):null,v=c&&c.prototype?cr(c.prototype,"nodeName"):null,p=c&&c.prototype?cr(c.prototype,"ownerDocument"):null,h=function(j){return f?f(j):j.nodeType},w=function(j){return v?v(j):j.nodeName},O=Z0(b,"namespaceURI"),M=function(j){return O?O(j):j.namespaceURI};if(typeof i=="function"){const ye=r.createElement("template");ye.content&&ye.content.ownerDocument&&(r=ye.content.ownerDocument)}let $,T="",D,R=!1,S=0;const y=function(){if(S>0)throw Nr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},k=function(j){y(),S++;try{return $.createHTML(j)}finally{S--}},N=function(j){y(),S++;try{return $.createScriptURL(j)}finally{S--}},L=function(){return R||(D=cv(E,o),R=!0),D},P=r,B=P.implementation,U=P.createNodeIterator,F=P.createDocumentFragment,I=P.getElementsByTagName,H=n.importNode;let V=Bc();e.isSupported=typeof Ec=="function"&&typeof u=="function"&&B&&B.createHTMLDocument!==void 0;const X=X0,ne=K0,Y=Q0,W=ev,J=tv,G=rv,Q=nv,ie=iv;let K=$c,re=null;const ce=Xe({},[...Oc,...ys,...Es,...As,...Rc]);let se=null;const ue=Xe({},[...Ic,...ws,...Mc,...jo]);let fe=Object.seal(xn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,he=null;const we=Object.seal(xn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Be=!0,ke=!0,be=!1,Ee=!0,xe=!1,Ne=!0,Re=!1,dt=!1,Me=null,ze=null,Ke=!1,We=!1,at=!1,mt=!1,pt=!0,Mt=!1;const Tt="user-content-";let qt=!0,rt=!1,wt=null,_t={},Ot=null;const Ut=Xe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let ir=null;const xr=Xe({},["audio","video","img","source","image","track"]);let ut=null;const it=Xe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",sr="http://www.w3.org/2000/svg",Bt="http://www.w3.org/1999/xhtml";let hr=Bt,bt=!1,Ft=null;const q=Xe({},[$t,sr,Bt],xs),z=kt(["mi","mo","mn","ms","mtext"]);let Z=Xe({},z);const ee=kt(["annotation-xml"]);let ae=Xe({},ee);const Ae=Xe({},["title","style","font","a","script"]);let Le=null;const Ge=["application/xhtml+xml","text/html"],xt="text/html";let Ce=null,yt=null;const zt=r.createElement("form"),oe=function(j){return j instanceof RegExp||j instanceof Function},de=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yt&&yt===j)return;(!j||typeof j!="object")&&(j={}),j=nr(j),Le=Ge.indexOf(j.PARSER_MEDIA_TYPE)===-1?xt:j.PARSER_MEDIA_TYPE,Ce=Le==="application/xhtml+xml"?xs:tn,re=Ur(j,"ALLOWED_TAGS",ce,{transform:Ce}),se=Ur(j,"ALLOWED_ATTR",ue,{transform:Ce}),Ft=Ur(j,"ALLOWED_NAMESPACES",q,{transform:xs}),ut=Ur(j,"ADD_URI_SAFE_ATTR",it,{transform:Ce,base:it}),ir=Ur(j,"ADD_DATA_URI_TAGS",xr,{transform:Ce,base:xr}),Ot=Ur(j,"FORBID_CONTENTS",Ut,{transform:Ce}),le=Ur(j,"FORBID_TAGS",nr({}),{transform:Ce}),he=Ur(j,"FORBID_ATTR",nr({}),{transform:Ce}),_t=Vt(j,"USE_PROFILES")?j.USE_PROFILES&&typeof j.USE_PROFILES=="object"?nr(j.USE_PROFILES):j.USE_PROFILES:!1,Be=j.ALLOW_ARIA_ATTR!==!1,ke=j.ALLOW_DATA_ATTR!==!1,be=j.ALLOW_UNKNOWN_PROTOCOLS||!1,Ee=j.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xe=j.SAFE_FOR_TEMPLATES||!1,Ne=j.SAFE_FOR_XML!==!1,Re=j.WHOLE_DOCUMENT||!1,We=j.RETURN_DOM||!1,at=j.RETURN_DOM_FRAGMENT||!1,mt=j.RETURN_TRUSTED_TYPE||!1,Ke=j.FORCE_BODY||!1,pt=j.SANITIZE_DOM!==!1,Mt=j.SANITIZE_NAMED_PROPS||!1,qt=j.KEEP_CONTENT!==!1,rt=j.IN_PLACE||!1,K=G0(j.ALLOWED_URI_REGEXP)?j.ALLOWED_URI_REGEXP:$c,hr=typeof j.NAMESPACE=="string"?j.NAMESPACE:Bt,Z=Ss(j,"MATHML_TEXT_INTEGRATION_POINTS",()=>Xe({},z)),ae=Ss(j,"HTML_INTEGRATION_POINTS",()=>Xe({},ee));const te=Ss(j,"CUSTOM_ELEMENT_HANDLING",()=>xn(null));if(fe=xn(null),Vt(te,"tagNameCheck")&&oe(te.tagNameCheck)&&(fe.tagNameCheck=te.tagNameCheck),Vt(te,"attributeNameCheck")&&oe(te.attributeNameCheck)&&(fe.attributeNameCheck=te.attributeNameCheck),Vt(te,"allowCustomizedBuiltInElements")&&typeof te.allowCustomizedBuiltInElements=="boolean"&&(fe.allowCustomizedBuiltInElements=te.allowCustomizedBuiltInElements),Rt(fe),xe&&(ke=!1),at&&(We=!0),_t&&(re=Xe({},Rc),se=xn(null),_t.html===!0&&(Xe(re,Oc),Xe(se,Ic)),_t.svg===!0&&(Xe(re,ys),Xe(se,ws),Xe(se,jo)),_t.svgFilters===!0&&(Xe(re,Es),Xe(se,ws),Xe(se,jo)),_t.mathMl===!0&&(Xe(re,As),Xe(se,Mc),Xe(se,jo))),we.tagCheck=null,we.attributeCheck=null,Vt(j,"ADD_TAGS")&&(typeof j.ADD_TAGS=="function"?we.tagCheck=j.ADD_TAGS:yn(j.ADD_TAGS)&&(re===ce&&(re=nr(re)),Xe(re,j.ADD_TAGS,Ce))),Vt(j,"ADD_ATTR")&&(typeof j.ADD_ATTR=="function"?we.attributeCheck=j.ADD_ATTR:yn(j.ADD_ATTR)&&(se===ue&&(se=nr(se)),Xe(se,j.ADD_ATTR,Ce))),Vt(j,"ADD_FORBID_CONTENTS")&&yn(j.ADD_FORBID_CONTENTS)&&(Ot===Ut&&(Ot=nr(Ot)),Xe(Ot,j.ADD_FORBID_CONTENTS,Ce)),qt&&(re["#text"]=!0),Re&&Xe(re,["html","head","body"]),re.table&&(Xe(re,["tbody"]),delete le.tbody),j.TRUSTED_TYPES_POLICY){if(typeof j.TRUSTED_TYPES_POLICY.createHTML!="function")throw Nr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof j.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Nr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ge=$;$=j.TRUSTED_TYPES_POLICY;try{T=k("")}catch(ve){throw $=ge,ve}}else j.TRUSTED_TYPES_POLICY===null?($=void 0,T=""):($===void 0&&($=L()),$&&typeof T=="string"&&(T=k("")));kt&&kt(j),yt=j},me=Xe({},[...ys,...Es,...Y0]),_e=Xe({},[...As,...J0]),De=function(j,te,ge){return te.namespaceURI===Bt?j==="svg":te.namespaceURI===$t?j==="svg"&&(ge==="annotation-xml"||Z[ge]):!!me[j]},Te=function(j,te,ge){return te.namespaceURI===Bt?j==="math":te.namespaceURI===sr?j==="math"&&ae[ge]:!!_e[j]},Ie=function(j,te,ge){return te.namespaceURI===sr&&!ae[ge]||te.namespaceURI===$t&&!Z[ge]?!1:!_e[j]&&(Ae[j]||!me[j])},Se=function(j){const te=M(j),ge=tn(w(j)),ve=u(j);let qe,Fe;return ve&&h(ve)===St.element?(qe={namespaceURI:M(ve)},Fe=tn(w(ve))):(qe={namespaceURI:hr},Fe="template"),Ft[te]?te===sr?De(ge,qe,Fe):te===$t?Te(ge,qe,Fe):te===Bt?Ie(ge,qe,Fe):!!(Le==="application/xhtml+xml"&&Ft[te]):!1},Oe=function(j){Hn(e.removed,{element:j});try{u(j).removeChild(j)}catch{if(A(j),!u(j))throw Nr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Qe=function(j,te,ge){try{a(j,te)}catch{try{j.removeAttribute(ge)}catch{}}},et=function(j){Sr(j);const te=l(j);te&&kr(F0(te),ve=>{try{A(ve)}catch{}});const ge=h(j)===St.element?x(j):null;if(ge)for(let ve=ge.length-1;ve>=0;--ve){const qe=ge[ve],Fe=qe&&qe.name;typeof Fe=="string"&&Qe(j,qe,Fe)}},lt=function(j,te,ge){if(!ge)try{ge=te.getAttributeNode(j)}catch{ge=null}Hn(e.removed,{attribute:ge||null,from:te});try{ge?a(te,ge):te.removeAttribute(j)}catch{try{te.removeAttribute(j)}catch{}}if(j==="is")if(We||at)try{Oe(te)}catch{}else try{te.setAttribute(j,"")}catch{}},mr=function(j){const te=x(j);if(te)for(let ge=te.length-1;ge>=0;--ge){const ve=te[ge],qe=ve&&ve.name;typeof qe!="string"||se[Ce(qe)]||Qe(j,ve,qe)}},Gt=function(j,te){let ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const ve=[j];for(;ve.length>0;){const qe=ve.pop();if(te(qe)===!1)continue;if(ge&&h(qe)===St.element){const Ze=m(qe);Xr(Ze)&&ve.push(Ze)}const Fe=l(qe);if(Fe)for(let Ze=Fe.length-1;Ze>=0;--Ze)ve.push(Fe[Ze])}},Sr=function(j){Gt(j,te=>{h(te)===St.element&&mr(te)})},Mr=function(j){const te=[];return Gt(j,ge=>{te.push(ge)},!0),te},Jr=function(j,te){const ge=vs();kr(Mr(j),ve=>{h(ve)===St.element&&bs(ge,ve)}),kr(te,ve=>{h(ve)===St.element&&!Un(ge,ve)&&mr(ve)})},un=function(j,te){let ge=!1;return kr(e.removed,ve=>{ve.element&&(ge=ge||ve.element===j,Sr(ve.element))}),Jr(j,te),ge},yr=8,hy=function(j,te){const ge=wt;let ve=null;const qe=()=>(ve||(ve=vs(),kr(te,Fe=>{bs(ve,Fe)})),ve);for(let Fe=0;;Fe++){const Ze=Mr(j),Dt=[j];let _r=!1;if(kr(Ze,jt=>{h(jt)===St.documentFragment?Hn(Dt,jt):!_r&&!Un(ge,jt)&&(_r=Un(qe(),jt))}),!_r)return;if(Fe>=yr)throw Nr("the tree kept changing during in-place sanitization; refusing to return it");kr(Dt,(jt,Yt)=>{my(jt,Yt>0,j,qe())})}},my=function(j,te,ge,ve){const qe=Ca(j);let Fe;for(;Fe=qe.nextNode();)!Un(ve,Fe)||Un(wt,Fe)||(te&&Er(V.uponSanitizeShadowNode,Fe,null),_a(Fe,ge),Ta(Fe,ge),Xr(Fe.content)&&go(Fe.content))},py=function(j){wt&&bs(wt,j)},kd=function(j,te){return Ne?j==="patchsrc"?!0:j==="for"&&te!=="label"&&te!=="output":!1},gy=function(j){Ne&&Gt(j,te=>{const ge=h(te);if(ge===St.processingInstruction||ge===St.comment&&It(Pc,te.data)){try{A(te)}catch{}return!1}if(ge===St.element){const ve=te,qe=Ce(w(te));try{ve.hasAttribute&&ve.hasAttribute("patchsrc")&&ve.removeAttribute("patchsrc"),ve.hasAttribute&&ve.hasAttribute("for")&&kd("for",qe)&&ve.removeAttribute("for")}catch{}}return!0})},Nd=function(j){let te=null,ge=null;if(Ke)j="<remove></remove>"+j;else{const Fe=Tc(j,/^[\r\n\t ]+/);ge=Fe&&Fe[0]}Le==="application/xhtml+xml"&&hr===Bt&&(j='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+j+"</body></html>");const ve=$?k(j):j;if(hr===Bt)try{te=new _().parseFromString(ve,Le)}catch{}if(!te||!te.documentElement){te=B.createDocument(hr,"template",null);try{te.documentElement.innerHTML=bt?T:ve}catch{}}const qe=te.body||te.documentElement;return j&&ge&&qe.insertBefore(r.createTextNode(ge),qe.childNodes[0]||null),hr===Bt?I.call(te,Re?"html":"body")[0]:Re?te.documentElement:qe},Ca=function(j){const te=p?p(j):j.ownerDocument;return U.call(te||j,j,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Di=function(j){return j=jn(j,X," "),j=jn(j,ne," "),j=jn(j,Y," "),j},Sa=function(j){var te;Ld(j);const ge=(te=j.querySelectorAll)===null||te===void 0?void 0:te.call(j,"template");ge&&kr(ge,ve=>{Xr(ve.content)&&Sa(ve.content)})},Ld=function(j){j.normalize();const te=p?p(j):j.ownerDocument,ge=U.call(te||j,j,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let ve=ge.nextNode();for(;ve;)ve.data=Di(ve.data),ve=ge.nextNode()},ki=function(j){const te=v?v(j):null;return typeof te!="string"||Ce(te)!=="form"?!1:typeof j.nodeName!="string"||typeof j.textContent!="string"||typeof j.removeChild!="function"||j.attributes!==x(j)||typeof j.removeAttribute!="function"||typeof j.removeAttributeNode!="function"||typeof j.getAttributeNode!="function"||typeof j.setAttribute!="function"||typeof j.namespaceURI!="string"||typeof j.insertBefore!="function"||typeof j.hasChildNodes!="function"||j.nodeType!==f(j)||j.childNodes!==l(j)},Xr=function(j){if(!f||typeof j!="object"||j===null)return!1;try{return f(j)===St.documentFragment}catch{return!1}},po=function(j){if(!f||typeof j!="object"||j===null)return!1;try{return typeof f(j)=="number"}catch{return!1}};function Er(ye,j,te){ye.length!==0&&kr(ye,ge=>{ge.call(e,j,te,yt)})}const vy=function(j,te){return!!(Ne&&j.hasChildNodes()&&!po(j.firstElementChild)&&It(Cs,j.textContent)&&It(Cs,j.innerHTML)||Ne&&av[te]&&h(j)===St.element&&M(j)===Bt&&(po(j.firstElementChild)||typeof j.textContent=="string"&&It(Cs,j.textContent))||j.nodeType===St.processingInstruction||Ne&&j.nodeType===St.comment&&It(Pc,j.data))},Ni=function(j,te){if(j instanceof RegExp)return It(j,te);if(j instanceof Function){for(var ge=arguments.length,ve=new Array(ge>2?ge-2:0),qe=2;qe<ge;qe++)ve[qe-2]=arguments[qe];return!!j(te,...ve)}return!1},by=function(j,te,ge){if(!le[te]&&Id(te)&&Ni(fe.tagNameCheck,te))return!1;if(qt&&!Ot[te]&&!Ot[tn(te)]){const ve=u(j),qe=l(j);if(qe&&ve){const Fe=qe.length;for(let Ze=Fe-1;Ze>=0;--Ze){const Dt=j===ge?C(qe[Ze],!0):qe[Ze];ve.insertBefore(Dt,s(j))}}}return Oe(j),!0},Od=function(j,te,ge,ve){return j.length===0?te:te===ge||te===ve?nr(te):te},Ln=function(j,te){return j===te||u(j)!==null?!1:(rt&&Sr(j),!0)},_a=function(j,te){if(py(j),Er(V.beforeSanitizeElements,j,null),Ln(j,te))return!0;if(ki(j))return Oe(j),!0;const ge=Ce(w(j));if(re=Od(V.uponSanitizeElement,re,ce,Me),Er(V.uponSanitizeElement,j,{tagName:ge,allowedTags:re}),Ln(j,te))return!0;if(vy(j,ge))return Oe(j),!0;if(le[ge]||!(we.tagCheck instanceof Function&&we.tagCheck(ge))&&!re[ge]){const ve=by(j,ge,te);return ve===!1&&(Er(V.afterSanitizeElements,j,null),Ln(j,te))?!0:ve}if(h(j)===St.element&&!Se(j)||(ge==="noscript"||ge==="noembed"||ge==="noframes")&&It(sv,j.innerHTML))return Oe(j),!0;if(xe&&j.nodeType===St.text){const ve=Di(j.textContent);j.textContent!==ve&&(Hn(e.removed,{element:j.cloneNode()}),j.textContent=ve)}return Er(V.afterSanitizeElements,j,null),Ln(j,te)},Rd=function(j,te,ge){if(he[te]||kd(te,j)||pt&&(te==="id"||te==="name")&&(ge in r||ge in zt))return!1;const ve=se[te]||we.attributeCheck instanceof Function&&we.attributeCheck(te,j);return ke&&It(W,te)||Be&&It(J,te)?!0:ve?ut[te]||It(K,jn(ge,Q,""))||(te==="src"||te==="xlink:href"||te==="href")&&j!=="script"&&Dc(ge,"data:")===0&&ir[j]||be&&!It(G,jn(ge,Q,""))?!0:!ge:Id(j)&&Ni(fe.tagNameCheck,j)&&Ni(fe.attributeNameCheck,te,j)||te==="is"&&fe.allowCustomizedBuiltInElements&&Ni(fe.tagNameCheck,ge)},xy=Xe({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Id=function(j){return!xy[tn(j)]&&It(ie,j)},yy=function(j,te,ge,ve){if($&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!ge)switch(E.getAttributeType(j,te)){case"TrustedHTML":return k(ve);case"TrustedScriptURL":return N(ve)}return ve},Ey=function(j,te,ge,ve){try{return ge?j.setAttributeNS(ge,te,ve):j.setAttribute(te,ve),ki(j)?(Oe(j),!1):!0}catch{return lt(te,j),!1}},Md=function(j,te){return Ne&&It(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,te)?!0:tn(j)==="attributename"&&Tc(te,"href")!==null},Ta=function(j,te){if(Er(V.beforeSanitizeAttributes,j,null),Ln(j,te))return;const ge=j.attributes;if(!ge||ki(j))return;se=Od(V.uponSanitizeAttribute,se,ue,ze);const ve={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let qe=ge.length;const Fe=Ce(j.nodeName);for(;qe--;){const Ze=ge[qe],Dt=Ze.name,_r=Ze.namespaceURI,jt=Ze.value,Yt=Ce(Dt),On=jt;let Jt=Dt==="value"?On:H0(On),$d=!1;if(ve.attrName=Yt,ve.attrValue=Jt,ve.keepAttr=!0,ve.forceKeepAttr=void 0,Er(V.uponSanitizeAttribute,j,ve),Jt=ve.attrValue,Mt&&(Yt==="id"||Yt==="name")&&Dc(Jt,Tt)!==0&&(lt(Dt,j,Ze),Jt=Tt+Jt,$d=!0),Md(Dt,Jt)){lt(Dt,j,Ze);continue}if(!ve.forceKeepAttr){if(!ve.keepAttr){lt(Dt,j,Ze);continue}if(!Ee&&It(qc,Jt)){lt(Dt,j,Ze);continue}if(xe&&(Jt=Di(Jt)),!Rd(Fe,Yt,Jt)){lt(Dt,j,Ze);continue}Jt=yy(Fe,Yt,_r,Jt),Jt!==On&&Ey(j,Dt,_r,Jt)&&$d&&_c(e.removed)}}Er(V.afterSanitizeAttributes,j,null),Ln(j,te)},go=function(j){let te=null;const ge=Ca(j);for(Er(V.beforeSanitizeShadowDOM,j,null);te=ge.nextNode();)if(Er(V.uponSanitizeShadowNode,te,null),_a(te,j),Ta(te,j),Xr(te.content)&&go(te.content),h(te)===St.element){const ve=m(te);Xr(ve)&&(Da(ve),go(ve))}xe&&Ld(j),Er(V.afterSanitizeShadowDOM,j,null)},Da=function(j){const te=[{node:j,shadow:null}];for(;te.length>0;){const ge=te.pop();if(ge.shadow){go(ge.shadow);continue}const ve=ge.node,qe=h(ve)===St.element,Fe=l(ve);if(Fe)for(let Ze=Fe.length-1;Ze>=0;--Ze)te.push({node:Fe[Ze],shadow:null});if(qe){const Ze=v?v(ve):null;if(typeof Ze=="string"&&Ce(Ze)==="template"){const Dt=ve.content;Xr(Dt)&&te.push({node:Dt,shadow:null})}}if(qe){const Ze=m(ve);Xr(Ze)&&te.push({node:null,shadow:Ze},{node:Ze,shadow:null})}}};return e.sanitize=function(ye){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=null,ge=null,ve=null,qe=null;if(bt=!ye,bt&&(ye="<!-->"),typeof ye!="string"&&!po(ye)&&(ye=V0(ye),typeof ye!="string"))throw Nr("dirty is not a string, aborting");if(!e.isSupported)return ye;dt?(re=Me,se=ze):de(j),(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&(re=nr(re)),V.uponSanitizeAttribute.length>0&&(se=nr(se)),e.removed=[];const Fe=rt&&typeof ye!="string"&&po(ye);let Ze=[];const Dt=wt;if(Fe){gy(ye);const Yt=w(ye);if(typeof Yt=="string"){const On=Ce(Yt);if(!re[On]||le[On])throw et(ye),Nr("root node is forbidden and cannot be sanitized in-place")}if(ki(ye))throw et(ye),Nr("root node is clobbered and cannot be sanitized in-place");Ze=Mr(ye),wt=vs()}else if(po(ye))te=Nd("<!---->"),ge=te.ownerDocument.importNode(ye,!0),ge.nodeType===St.element&&ge.nodeName==="BODY"||ge.nodeName==="HTML"?te=ge:te.appendChild(ge),Da(te);else{if(!We&&!xe&&!Re&&ye.indexOf("<")===-1)return $&&mt?k(ye):ye;if(te=Nd(ye),!te)return We?null:mt?T:""}te&&Ke&&Oe(te.firstChild);const _r=Fe?ye:te;try{Fe&&Da(ye);const Yt=Ca(_r);for(;ve=Yt.nextNode();)_a(ve,_r),Ta(ve,_r),Xr(ve.content)&&go(ve.content);Fe&&hy(ye,Ze)}catch(Yt){throw Fe&&(et(ye),un(ye,Ze)),Yt}finally{wt=Dt}if(Fe){if(un(ye,Ze))throw Nr("a node selected for removal could not be safely returned; refusing to sanitize in place");return xe&&Sa(ye),ye}if(We){if(xe&&Sa(te),at)for(qe=F.call(te.ownerDocument);te.firstChild;)qe.appendChild(te.firstChild);else qe=te;return(se.shadowroot||se.shadowrootmode)&&(qe=H.call(n,qe,!0)),qe}let jt=Re?te.outerHTML:te.innerHTML;return Re&&re["!doctype"]&&te.ownerDocument&&te.ownerDocument.doctype&&te.ownerDocument.doctype.name&&It(ov,te.ownerDocument.doctype.name)&&(jt="<!DOCTYPE "+te.ownerDocument.doctype.name+`>
|
|
415
|
+
`+jt),xe&&(jt=Di(jt)),$&&mt?k(jt):jt},e.setConfig=function(){let ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};de(ye),dt=!0,Me=re,ze=se},e.clearConfig=function(){yt=null,dt=!1,Me=null,ze=null,$=D,T=""},e.isValidAttribute=function(ye,j,te){yt||de({});const ge=Ce(ye),ve=Ce(j);return typeof te=="string"&&(Md(j,te)||!Ee&&It(qc,te))?!1:Rd(ge,ve,te)},e.addHook=function(ye,j){typeof j=="function"&&Vt(V,ye)&&Hn(V[ye],j)},e.removeHook=function(ye,j){if(Vt(V,ye)){if(j!==void 0){const te=B0(V[ye],j);return te===-1?void 0:z0(V[ye],te,1)[0]}return _c(V[ye])}},e.removeHooks=function(ye){Vt(V,ye)&&(V[ye]=[])},e.removeAllHooks=function(){V=Bc()},e}var zc=Fc();const _s="forsion_logs",uv=200,dv=/token|key|secret|password|authorization|cookie|credential/i;function Ts(t,e=0){if(t==null||e>4)return t;if(typeof t=="string"){if(/^https?:\/\//i.test(t))try{const r=new URL(t);return r.origin+r.pathname}catch{}return t.length>300?t.slice(0,300)+"…":t}if(Array.isArray(t))return t.slice(0,20).map(r=>Ts(r,e+1));if(typeof t=="object"){const r={};for(const[n,o]of Object.entries(t))r[n]=dv.test(n)?"■■■":Ts(o,e+1);return r}return t}async function fv(t){try{const e=(await chrome.storage.local.get(_s))[_s]||[];e.push(t),await chrome.storage.local.set({[_s]:e.slice(-uv)})}catch{}}function Hc(t,e,r,n){const o=Ts((n==null?void 0:n.error)??(n==null?void 0:n.data));(t==="warn"?console.warn:console.error)(`[forsion:${e}] ${r}`,o??"");const i=n==null?void 0:n.error;fv({at:new Date().toISOString(),level:t,code:e,msg:r,context:n==null?void 0:n.context,data:i?String((i==null?void 0:i.message)||i):o})}async function Uc(t,e,r){}const Nt={info:Uc,debug:Uc,warn:async(t,e,r)=>Hc("warn",t,e,r),error:async(t,e,r)=>Hc("error",t,e,r)};let Ds="en";function jc(t){Ds=t}function jr(t){return String(t??"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Wr(t,e){return t===e||t.endsWith(`.${e}`)}function Wc(t){try{const e=new URL(t);return e.protocol!=="https:"||e.username||e.password||e.port?!1:e.hostname==="api.bilibili.com"?["/x/web-interface/view","/x/player/v2","/x/player/wbi/v2"].includes(e.pathname):(Wr(e.hostname,"hdslb.com")||Wr(e.hostname,"bilibili.com"))&&e.pathname.startsWith("/bfs/subtitle/")?!0:Wr(e.hostname,"youtube.com")&&e.pathname==="/api/timedtext"}catch{return!1}}async function Wo(t,e="json"){if(!Wc(t))throw new Error("Unsupported site resource");const r=await chrome.runtime.sendMessage({type:"clip-site-fetch",url:t,responseType:e});if(!(r!=null&&r.ok))throw new Error((r==null?void 0:r.error)||"Site resource unavailable");return r.data}const hv=async(t,e)=>{const r=typeof t=="string"?t:t instanceof URL?t.href:t.url;if(((e==null?void 0:e.method)||(t instanceof Request?t.method:"GET")).toUpperCase()==="GET"&&Wc(r)){const o=await Wo(r,"text");return new Response(typeof o=="string"?o:JSON.stringify(o),{status:200,headers:{"Content-Type":"application/json"}})}return fetch(t,e)};function Vo(t){const e=Math.max(0,Math.floor(Number.isFinite(t)?t:0)),r=Math.floor(e/3600),n=Math.floor(e%3600/60),o=e%60;return r?`${r}:${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${n}:${String(o).padStart(2,"0")}`}function Vc(t,e){const r=new URL(t);return r.searchParams.set("t",String(Math.max(0,Math.floor(e)))),r.hash="",r.href}function mv(t,e,r=Ds){const n=t.filter(o=>Number.isFinite(o.start)&&o.start>=0&&o.text.trim()).map(o=>`<p class="transcript-segment" data-timestamp="${o.start}"><a href="${jr(Vc(e,o.start))}">[${Vo(o.start)}]</a> ${jr(o.text.trim())}</p>`);return n.length?`<section class="video-transcript"><h2>${r==="zh"?"字幕":"Transcript"}</h2>${n.join(`
|
|
416
|
+
`)}</section>`:""}function pv(t,e){if(!t.length)return!1;const r=Math.max(...t.map(n=>n.end??n.start));return!Number.isFinite(r)||t.some(n=>!Number.isFinite(n.start)||n.start<0)?!1:!e||e<=0?!0:r>e+Math.max(12,e*.15)?!1:e<180||r>=e*(e>=600?.18:e>=300?.22:.25)}function Zc(t,e=Ds){const r=(t.lan||"").toLowerCase(),n=e==="zh"?"zh":"en";return r===n||r===`${n}-cn`||r===`${n}-us`?0:r.includes(n)?1:r.includes(e==="zh"?"en":"zh")?2:3}function gv(t,e){const r=t.indexOf(e);if(r<0)return null;const n=t.indexOf("=",r+e.length);if(n<0)return null;const o=t.indexOf("{",n+1);if(o<0)return null;let i=0,c=!1,d=!1;for(let g=o;g<t.length;g++){const _=t[g];if(c){d?d=!1:_==="\\"?d=!0:_==='"'&&(c=!1);continue}if(_==='"')c=!0;else if(_==="{")i++;else if(_==="}"&&--i===0)try{return JSON.parse(t.slice(o,g+1))}catch{return null}}return null}async function vv(t,e){var A,a,s,l,u,m,x;const r=new URL(t);if(!Wr(r.hostname,"bilibili.com"))return null;const n=(A=r.pathname.match(/\/video\/(BV[0-9a-zA-Z]+)/))==null?void 0:A[1];if(!n)return null;let o;try{const f=await Wo(`https://api.bilibili.com/x/web-interface/view?bvid=${encodeURIComponent(n)}`);(f==null?void 0:f.code)===0&&(o=f.data)}catch{}if(!o){for(const f of Array.from(e.scripts))if(o=(a=gv(f.textContent||"","__INITIAL_STATE__"))==null?void 0:a.videoData,o)break}if(!o)return null;const i=Math.max(1,Number.parseInt(r.searchParams.get("p")||"1",10)||1),c=(o.pages||[]).find(f=>f.page===i)||((s=o.pages)==null?void 0:s[i-1])||((l=o.pages)==null?void 0:l[0]),d=(c==null?void 0:c.cid)||o.cid,g=Number((c==null?void 0:c.duration)||o.duration||0);let _="";if(d){const f=new URLSearchParams({bvid:n,cid:String(d),aid:String(o.aid||"")});for(const v of["/x/player/wbi/v2","/x/player/v2"])try{const p=await Wo(`https://api.bilibili.com${v}?${f}`),h=(p==null?void 0:p.code)===0?(m=(u=p.data)==null?void 0:u.subtitle)==null?void 0:m.subtitles:[];if(!Array.isArray(h))continue;for(const w of[...h].sort((O,M)=>Zc(O)-Zc(M)))try{const O=new URL(w.subtitle_url,"https://www.bilibili.com").href,M=await Wo(O),$=Array.isArray(M==null?void 0:M.body)?M.body.map(T=>({start:Number(T.from),end:Number(T.to),text:String(T.content||"")})):[];if(pv($,g)){_=mv($,t);break}}catch{}if(_)break}catch{}}const E=String(o.title||e.title),b=String(o.desc||""),C=`https://player.bilibili.com/player.html?bvid=${encodeURIComponent(n)}&page=${i}&autoplay=0`;return{title:E,author:String(((x=o.owner)==null?void 0:x.name)||"")||void 0,excerpt:b.slice(0,200),contentHtml:`<iframe src="${jr(C)}" title="${jr(E)}" allowfullscreen></iframe>
|
|
417
|
+
${b.split(/\n+/).filter(Boolean).map(f=>`<p>${jr(f)}</p>`).join(`
|
|
418
|
+
`)}
|
|
419
|
+
${_}`,publishTime:o.pubdate?new Date(Number(o.pubdate)*1e3).toISOString():void 0,siteName:"Bilibili",lang:"zh-CN",coverImage:o.pic?new URL(o.pic,t).href:void 0,wordCount:b.length,extractorType:"bilibili"}}function bv(t,e){var n,o,i,c,d;const r=new DOMParser().parseFromString(t,"text/html");if(Wr(new URL(e).hostname,"youtube.com")||new URL(e).hostname==="youtu.be")for(const g of Array.from(r.querySelectorAll("div > h2"))){if(((n=g.textContent)==null?void 0:n.trim().toLowerCase())!=="transcript")continue;const _=g.parentElement;let E=0;for(const b of Array.from(_.children)){if(b.tagName!=="P")continue;const C=b.querySelector(":scope > strong:first-child > span:first-child"),A=(o=C==null?void 0:C.textContent)==null?void 0:o.trim().match(/^(?:(\d+):)?(\d{1,2}):(\d{2})$/);!C||!A||Number(A[3])>59||A[1]&&Number(A[2])>59||(C.classList.add("timestamp"),C.dataset.timestamp=String(Number(A[1]||0)*3600+Number(A[2])*60+Number(A[3])),b.classList.add("transcript-segment"),E++)}E&&_.classList.add("youtube","transcript")}for(const g of Array.from(r.querySelectorAll("[data-timestamp]"))){const _=(i=g.dataset.timestamp)==null?void 0:i.trim(),E=Number(_);if(!_||!Number.isFinite(E)||E<0||g.querySelector("a[href]")||g.closest("a[href]"))continue;const b=r.createElement("a");b.href=Vc(e,E),g.matches(".timestamp")||((c=g.textContent)==null?void 0:c.trim())===Vo(E)?(b.textContent=((d=g.textContent)==null?void 0:d.trim())||Vo(E),g.replaceChildren(b)):(b.textContent=`[${Vo(E)}] `,g.prepend(b))}return r.body.innerHTML}const Vn=[/^data:image\/gif;base64,R0lGOD/,/^data:image\/png;base64,iVBOR.*?AAAA/,/(?:^|\/)(?:pixel|spacer|blank|tracking|beacon|1x1)\.(?:gif|png|jpe?g|webp|svg)(?:\?|$)/i,/\/tracking\//i,/\/beacon\//i,/\/analytics\//i,/^https?:\/\/picasso-static\.xiaohongshu\.com\/fe-platform\//,/^https?:\/\/face\.t\.sinajs\.cn\/t4\/appstyle\/expression\//,/^https?:\/\/h5\.sinaimg\.cn\/m\/emoticon\/icon\//,/^https?:\/\/i0\.hdslb\.com\/bfs\/emote\//,/^https?:\/\/github\.githubassets\.com\/images\/icons\/emoji\//,/^https?:\/\/twemoji\.maxcdn\.com\//,/^https?:\/\/abs-0\.twimg\.com\/emoji\//,/^https?:\/\/cdn\.jsdelivr\.net\/[^?#]*twemoji/,/^https?:\/\/res\.wx\.qq\.com\/(?:t\/wx_fed\/we-emoji|mpres\/htmledition\/images\/icon\/emotion)\//,/^https?:\/\/mmbiz\.qpic\.cn\/mmbiz_svg\//,/^https?:\/\/emoji\.slack-edge\.com\//,/^https?:\/\/cdn\.discordapp\.com\/emojis\//],ks=["data-src","data-original","data-lazy-src","data-srcset","data-original-src","data-lazy","data-url","data-image","data-img-src","data-real-src","data-actualsrc","data-echo","data-lazyload","data-defer-src","data-hi-res-src"];function xv(t){const e=Number.parseInt(t.getAttribute("data-w")||"0"),r=e||t.naturalWidth||t.width||Number.parseInt(t.getAttribute("width")||"0");let n=Number.parseInt(t.getAttribute("data-h")||"0");if(!n&&e){const o=Number.parseFloat(t.getAttribute("data-ratio")||"0");o>0&&(n=Math.round(e*o))}return n=n||t.naturalHeight||t.height||Number.parseInt(t.getAttribute("height")||"0"),{width:r,height:n}}function yv(t,e){return t>0&&t<50||e>0&&e<50}const Ev=/^(\d+(?:\.\d+)?)w$/,Av=/^(\d+(?:\.\d+)?)x$/;function Gc(t){if(!t)return[];const e=t.trim(),r=[],n=e.length;let o=0;for(;o<n;){for(;o<n&&/[\s,]/.test(e[o]);)o++;if(o>=n)break;let i=o;for(;o<n&&!/\s/.test(e[o]);)o++;let c=e.slice(i,o),d="";if(/,+$/.test(c))c=c.replace(/,+$/,"");else{for(;o<n&&/\s/.test(e[o]);)o++;i=o;let _=!1;for(;o<n;){const E=e[o];if(_)E===")"&&(_=!1);else if(E==="(")_=!0;else if(E===",")break;o++}d=e.slice(i,o).trim()}if(!c)continue;const g={url:c};for(const _ of d.split(/\s+/)){const E=_.match(Ev);if(E){g.width=Number.parseFloat(E[1]);break}const b=_.match(Av);if(b){g.density=Number.parseFloat(b[1]);break}}r.push(g)}return r}function Ns(t){const e=Gc(t).filter(n=>!n.url.startsWith("data:"));if(e.length===0)return null;let r=e[0];for(const n of e.slice(1)){const o=r.width??r.density??0;(n.width??n.density??0)>o&&(r=n)}return r.url}function Ls(t,e){const r=t.getAttribute("src"),n=t.src,o=d=>d.startsWith("http://")||d.startsWith("https://")||d.startsWith("//"),i=d=>{if(!d||d.startsWith("data:"))return null;if(d.startsWith("http://")||d.startsWith("https://"))return d;if(d.startsWith("//"))return`https:${d}`;if(e)try{return new URL(d,e).href}catch{return null}return null};if(r&&o(r)&&!Vn.some(d=>d.test(r)))return i(r);for(const d of ks){const g=d==="data-srcset"?Ns(t.getAttribute(d)):t.getAttribute(d);if(g&&!g.startsWith("data:")){const _=i(g);if(_&&!Vn.some(E=>E.test(_)))return _}}const c=Ns(t.getAttribute("srcset")||t.getAttribute("data-srcset"));if(c){const d=i(c);if(d)return d}if(r&&!r.startsWith("data:")&&!r.startsWith("chrome-extension://")&&!r.startsWith("moz-extension://")){const d=i(r);if(d)return d}return n&&o(n)&&!Vn.some(d=>d.test(n))?n:null}function Zo(t,e){if(Vn.some(r=>r.test(t)))return!0;if(e){const{width:r,height:n}=xv(e);if(yv(r,n))return!0}return!1}function wv(t,e,r,n,o){var E;const i=[],c=new Set,d=n||((E=t==null?void 0:t.location)==null?void 0:E.href)||"",g=b=>{if(!b)return"";try{let C=b;b.startsWith("//")&&(C=`https:${b}`);const A=new URL(C,d||"https://example.com");return A.searchParams.delete("w"),A.searchParams.delete("h"),A.searchParams.delete("width"),A.searchParams.delete("height"),A.searchParams.delete("size"),A.href}catch{return b}},_=(b,C,A,a)=>{if(!b||b.startsWith("chrome-extension://")||b.startsWith("moz-extension://"))return;const s=g(b);c.has(s)||Zo(b)||(c.add(s),i.push({originalUrl:b,index:i.length,alt:C||void 0,width:A||void 0,height:a||void 0}))};if(r&&_(r),t&&!(o!=null&&o.skipDocumentImages)){const b=["article img","main img",".content img",".post-content img",".article-content img",".entry-content img","#content img",".markdown-body img",".rich-text img"];t.querySelectorAll(b.join(", ")).forEach(C=>{const A=C,a=Ls(A,d);if(a&&!Zo(a,A)){const s=A.naturalWidth||A.width||Number.parseInt(A.getAttribute("width")||"0"),l=A.naturalHeight||A.height||Number.parseInt(A.getAttribute("height")||"0");_(a,A.alt,s||void 0,l||void 0)}}),i.length<3&&t.querySelectorAll("img").forEach(C=>{const A=C,a=Ls(A,d);if(a&&!Zo(a,A)){const s=A.naturalWidth||A.width||Number.parseInt(A.getAttribute("width")||"0"),l=A.naturalHeight||A.height||Number.parseInt(A.getAttribute("height")||"0");_(a,A.alt,s||void 0,l||void 0)}})}if(e&&d){const b=document.createElement("div");b.innerHTML=e,b.querySelectorAll("img").forEach(C=>{const A=C,a=Ls(A,d);a&&!Zo(a,A)&&_(a,A.alt)})}return i}function Cv(t){t.querySelectorAll("[style]").forEach(e=>{const r=e,n=r.style.fontWeight,o=r.style.fontStyle,i=n==="bold"||n==="bolder"||Number(n)>=700,c=o==="italic"||o==="oblique";if(!i&&!c)return;const d=r.tagName.toUpperCase();if(d==="STRONG"||d==="B"||d==="EM"||d==="I")return;let g=r;if(i){const _=t.createElement("strong");_.innerHTML=g.innerHTML,g.innerHTML="",g.appendChild(_),g=_}if(c){const _=t.createElement("em");_.innerHTML=g.innerHTML,g.innerHTML="",g.appendChild(_)}})}function Yc(t){t.querySelectorAll("img").forEach(e=>{const r=e.getAttribute("src")||"";if(!r||r.startsWith("data:")||r.includes("spacer")||r.includes("blank")||r.includes("placeholder")||r.includes("wx_lazy="))for(const n of ks){const o=n==="data-srcset"?Ns(e.getAttribute(n)):e.getAttribute(n);if(o&&!o.startsWith("data:")){e.setAttribute("src",o);break}}})}function Sv(t){t.querySelectorAll(".swiper-slide-duplicate").forEach(e=>e.remove())}function _v(t){t.querySelectorAll("img").forEach(e=>{var o;if(e.closest("figure, picture")||e.closest("p"))return;const r=e.getAttribute("src")||"";if(!r||r.startsWith("data:"))return;const n=t.createElement("figure");(o=e.parentNode)==null||o.insertBefore(n,e),n.appendChild(e)})}function Jc(t){if(typeof window>"u"||!window.getComputedStyle)return[];const e=t instanceof Document?t:t.ownerDocument,r=t instanceof Document?t.body:t;if(!e||!r)return[];const n=[];try{const o=e.createTreeWalker(r,NodeFilter.SHOW_TEXT,null);let i=o.nextNode();const c=new Set;for(;i;){if(i.nodeValue&&i.nodeValue.includes(`
|
|
420
|
+
`)){const g=i.parentElement;g&&!["PRE","CODE","SCRIPT","STYLE"].includes(g.tagName)&&c.add(g)}i=o.nextNode()}const d=[];c.forEach(g=>{try{const _=window.getComputedStyle(g).whiteSpace;["pre-wrap","pre-line","pre"].includes(_)&&d.push(g)}catch{}}),d.forEach(g=>{g.setAttribute("data-smartclip-prewrap","true"),n.push(g)})}catch(o){Nt.debug("preprocessing.markPreWrap.failed","markPreWrapElements 失败",{context:"content-script",error:o instanceof Error?o:new Error(String(o))})}return n}function Tv(t){t.querySelectorAll('[data-smartclip-prewrap="true"]').forEach(e=>{const r=t.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n=[];let o=r.nextNode();for(;o;)n.push(o),o=r.nextNode();n.forEach(i=>{var c;if(i.nodeValue&&i.nodeValue.includes(`
|
|
421
|
+
`)){const d=t.createDocumentFragment(),g=i.nodeValue.split(`
|
|
422
|
+
`);g.forEach((_,E)=>{_&&d.appendChild(t.createTextNode(_)),E<g.length-1&&d.appendChild(t.createElement("br"))}),(c=i.parentNode)==null||c.replaceChild(d,i)}}),e.removeAttribute("data-smartclip-prewrap")})}function Xc(t){t.forEach(e=>e.removeAttribute("data-smartclip-prewrap"))}function Cr(t){return zc.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","u","s","a","img","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","table","thead","tbody","tr","th","td","div","span","sup","sub","math","mi","mo","mn","mrow","mfrac","msup","msub","mover","munder","msqrt","mroot","semantics","annotation","mtext","msubsup","munderover","mfenced","menclose","mpadded","mspace","mjx-container","mjx-assistive-mml","mtable","mtr","mtd","figure","figcaption","section","iframe","video","audio","source"],ALLOWED_ATTR:["href","src","alt","title","class","id","data-lang","data-latex","alttext","encoding","mathvariant","xmlns","display","width","height","frameborder","allow","allowfullscreen","controls","poster","preload","type","referrerpolicy","data-timestamp","data-src","data-original","data-lazy-src","data-srcset","data-w","data-h","srcset","colspan","rowspan","scope","align","role","data-footnotes","data-footnote-ref","data-footnote-backref"]})}function Zn(t){const e=t==null?void 0:t.trim();if(!e||e.startsWith("#")||/^(?:data|javascript|about|file|chrome-extension):/i.test(e))return!1;if(/^https?:\/\//i.test(e))try{return!!new URL(e).hostname}catch{return!1}if(e.startsWith("//"))try{return!!new URL(`https:${e}`).hostname}catch{return!1}return!/^[a-z][a-z\d+.-]*:/i.test(e)&&!/\s/.test(e)}function Dv(t){return t?Gc(t).some(e=>Zn(e.url)):!1}function Kc(t){const e=new DOMParser().parseFromString(t,"text/html"),r=["src",...ks.filter(o=>o!=="data-srcset")],n=["srcset","data-srcset"];return!!(Array.from(e.querySelectorAll("img")).some(o=>r.some(i=>Zn(o.getAttribute(i)))||n.some(i=>Dv(o.getAttribute(i))))||Array.from(e.querySelectorAll("iframe")).some(o=>Zn(o.getAttribute("src")))||Array.from(e.querySelectorAll("video, audio")).some(o=>Zn(o.getAttribute("src"))?!0:Array.from(o.querySelectorAll("source")).some(i=>Zn(i.getAttribute("src"))))||Array.from(e.querySelectorAll("table td, table th")).some(o=>(o.textContent||"").trim().length>0||Kc(o.innerHTML))||Array.from(e.querySelectorAll("pre, code")).some(o=>(o.textContent||"").trim().length>0))}function Go(t){if(!t)return!1;const e=t.replace(/<[^>]*>/g,"").trim();return/^\s*\[.*?\]\(javascript:[^)]*\)\s*$/i.test(e)||/^\s*\[.*?\]\(\s*\)\s*$/.test(e)?!1:e.length>=50?!0:Kc(t)}function rn(t){const e=t||"";return{htmlLength:e.length,textLength:e.replace(/<[^>]*>/g,"").trim().length,pCount:(e.match(/<p\b/gi)||[]).length,brCount:(e.match(/<br\s*\/?>/gi)||[]).length}}function kv(t){return(t||"").replace(/<[^>]*>/g,"").trim()}function Nv(t){if(!(t!=null&&t.trim()))return!1;if(kv(t).length>0)return!0;const e=document.createElement("div");return e.innerHTML=t,e.querySelector("iframe, video, audio, img, svg, math, table, figure, pre, code, blockquote, ul, ol, embed, object, canvas")!==null}const Lv=/[,,、;;|//]\s*|\s{2,}/;function Os(t){if(!t)return;const e=t.trim();if(e)return e.split(Lv).map(r=>r.trim()).filter(Boolean)[0]||e}function Ov(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Rv(t){if(!t)return;const e=t.trim();if(e&&!/<[a-z][^>]*>/i.test(e)&&!e.startsWith("<")&&!/\b(?:class|data-|aria-|style)=["'][^"']*["']/i.test(e))return e}function Iv(t){return t.replace(/<p(\s[^>]*)?>[\s\S]*?<\/p>/gi,e=>{if(!e.includes(`
|
|
423
|
+
`))return e;const r=e.indexOf(">")+1,n=e.lastIndexOf("</p>"),o=e.slice(0,r),i=e.slice(n),c=e.slice(r,n),d=[],g=c.replace(/<(code|pre)[\s>][\s\S]*?<\/\1>/gi,_=>(d.push(_),`\0PRESERVE_${d.length-1}\0`)).replace(/\n+$/,"").replace(/^\n+/,"").replace(/\n/g,"<br>").replace(/\0PRESERVE_(\d+)\0/g,(_,E)=>d[Number(E)]);return`${o}${g}${i}`})}function Qc(t){try{return new URL(t).hostname}catch{const e=t.match(/^(?:https?:\/\/)?(?:www\.)?([^/]+)/);return e?e[1]:"unknown"}}function eu(t,e){var r;try{const n=t.querySelector(e);if(n){const o=(r=n.textContent)==null?void 0:r.trim();if(o&&o.length>0)return o}}catch{}}function tu(t){if(!t)return!1;try{const e=new URL(t);return e.hostname==="youtu.be"||Wr(e.hostname,"youtube.com")}catch{return!1}}function Mv(t){var e;if(t)try{const r=new URL(t);if(r.hostname==="youtu.be")return r.pathname.slice(1)||void 0;if(Wr(r.hostname,"youtube.com"))return r.searchParams.get("v")||((e=r.pathname.match(/^\/(?:shorts|live|embed)\/([^/]+)/))==null?void 0:e[1])||void 0}catch{}}function $v(t){var e,r;return t?(((e=t.include)==null?void 0:e.length)||0)>0||(((r=t.templates)==null?void 0:r.filter(n=>n.enabled!==!1).length)||0)>0:!1}function Pv(t){return t.querySelector('iframe[src*="youtube.com"], iframe[src*="youtu.be"]')}function qv(t){return t.querySelector(".youtube.transcript")}function Bv(t){var i;const e=t.cloneNode(!0);let r=!1;for(const c of Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")))(c.textContent||"").replace(/\s+/g," ").trim().toLowerCase()==="transcript"&&(r?c.remove():r=!0);const n=[];let o=null;for(const c of Array.from(e.childNodes))if(!(c.nodeType===Node.TEXT_NODE&&!((i=c.textContent)!=null&&i.trim()))){if(c instanceof HTMLElement&&c.matches("p.transcript-segment")){o||(o=document.createElement("ul"),o.className="transcript-segments",n.push(o));const d=document.createElement("li");d.className=c.className,d.innerHTML=c.innerHTML,o.appendChild(d);continue}o=null,n.push(c.cloneNode(!0))}return e.replaceChildren(...n),e.outerHTML}function Fv(t,e){const r=Array.from(t.querySelectorAll("p")).find(n=>!n.closest(".youtube.transcript"));if(r!=null&&r.outerHTML)return r.outerHTML;if(e!=null&&e.trim())return`<p>${Ov(e.trim())}</p>`}function zv(t,e){var c;const r=document.createElement("div");r.innerHTML=t||"";let n=Pv(r);const o=qv(r),i=Fv(r,e.excerpt);if(n)(c=e.title)!=null&&c.trim()&&n.setAttribute("title",e.title.trim());else{const d=Mv(e.url);if(!d)return;const g=document.createElement("iframe");g.setAttribute("width","560"),g.setAttribute("height","315"),g.setAttribute("src",`https://www.youtube.com/embed/${d}`),g.setAttribute("title",e.title||"YouTube"),g.setAttribute("frameborder","0"),g.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"),g.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),g.setAttribute("allowfullscreen","true"),n=g}return o!=null&&o.outerHTML?`${n.outerHTML}
|
|
424
|
+
${Bv(o)}`:i?`${n.outerHTML}
|
|
425
|
+
${i}`:n.outerHTML}function Hv(t){const e=(Array.isArray(t)?t:[t]).find(n=>{if(!n||typeof n!="object")return!1;const o=n["@type"];return Array.isArray(o)?o.includes("VideoObject"):o==="VideoObject"});if(!e)return;const r=e.keywords;if(Array.isArray(r)){const n=r.map(o=>String(o).trim()).filter(Boolean);return n.length>0?n:void 0}if(typeof r=="string"){const n=r.split(",").map(o=>o.trim()).filter(Boolean);return n.length>0?n:void 0}}function Uv(t,e,r){const n={},o=(c,d)=>{if(e&&e.length>0){const _=e.find(E=>c&&E.name===c||d&&(E.property===d||E.name===d));if(_)return _.content}let g=null;return d&&(g=t.querySelector(`meta[property="${d}"]`)||t.querySelector(`meta[name="${d}"]`)),!g&&c&&(g=t.querySelector(`meta[name="${c}"]`)),g==null?void 0:g.getAttribute("content")};n.author=Os(o("author","article:author")||void 0),n.publishTime=o("publish_date","article:published_time")||void 0;const i=o("keywords");return i?n.tags=i.split(",").map(c=>c.trim()).filter(Boolean):n.tags=Hv(r),n.lang=t.documentElement.lang||void 0,n.siteName=o("site_name","og:site_name")||void 0,n}function jv(t,e){const r=_=>_&&!Vn.some(E=>E.test(_))?_:void 0,n=t.querySelector('meta[property="og:image"]')||t.querySelector('meta[name="og:image"]'),o=r(n==null?void 0:n.getAttribute("content"));if(o)return o;const i=t.querySelector('meta[name="twitter:image"]'),c=r(i==null?void 0:i.getAttribute("content"));if(c)return c;const d=r(e);if(d)return d;const g=t.querySelector("article img, main img, .content img");return g?r(g.src):void 0}function Wv(t,e){t.title&&(e.title=t.title),t.documentElement.lang&&(e.documentElement.lang=t.documentElement.lang),['meta[name="author"]','meta[name="description"]','meta[name="keywords"]','meta[name="publish_date"]','meta[property="og:title"]','meta[name="og:title"]','meta[property="og:description"]','meta[name="og:description"]','meta[property="og:image"]','meta[name="og:image"]','meta[property="og:site_name"]','meta[name="og:site_name"]','meta[property="article:author"]','meta[property="article:published_time"]','meta[name="twitter:title"]','meta[name="twitter:description"]','meta[name="twitter:image"]','link[rel="icon"]','link[rel="shortcut icon"]'].forEach(r=>{t.querySelectorAll(r).forEach(n=>e.head.appendChild(n.cloneNode(!0)))})}function Vv(t,e){var g,_;const r=e.querySelectorAll("article ul, article ol, main ul, main ol, [role='main'] ul, [role='main'] ol");if(!r.length)return t;const n=new DOMParser().parseFromString(t,"text/html"),o=E=>(E||"").replace(/\s+/g," ").trim(),i=/(?:^|[\s_-])(author|byline|meta(?:data)?|share|social|breadcrumb|nav(?:igation)?|menu|related|recommendations?|footer|header|advert(?:isement)?|tags?|category|toc)(?:$|[\s_-])/i,c=/^(?:author|written by|posted by|published|updated|posted|reading time|share|tags?|category)\b|\b\d+\s*min(?:ute)?s?\s+read\b|^\d{4}[-/]\d{1,2}[-/]\d{1,2}\b/i;let d=!1;for(const E of r){if((g=E.parentElement)!=null&&g.closest("ul, ol")||E.closest("nav, aside, header, footer, [role='navigation'], #footnotes")||E.querySelector("time, button, input, select, [rel='author'], [itemprop='author'], [itemprop='datePublished']"))continue;let b=!1;for(let v=E;v&&v!==e.body;v=v.parentElement){if(i.test(`${v.id} ${v.getAttribute("class")||""}`)||v.hasAttribute("hidden")||v.getAttribute("aria-hidden")==="true"){b=!0;break}const p=v,h=((_=e.defaultView)==null?void 0:_.getComputedStyle(p))||p.style;if((h==null?void 0:h.display)==="none"||(h==null?void 0:h.visibility)==="hidden"||(h==null?void 0:h.visibility)==="collapse"){b=!0;break}}if(b)continue;const C=Array.from(E.children).filter(v=>v.tagName==="LI");if(!C.length||C.some(v=>c.test(o(v.textContent))))continue;const A=o(E.textContent),a=Array.from(E.querySelectorAll("a")).map(v=>o(v.textContent)).join("");if(!A||a.length>A.length*.4)continue;const s=E.previousElementSibling,l=E.nextElementSibling;if(!s||!l)continue;const u=v=>{if(!/^(P|BLOCKQUOTE|PRE|TABLE|FIGURE|H[1-6])$/.test(v.tagName))return;const p=o(v.textContent);if(p.length<16)return;const h=Array.from(n.body.querySelectorAll(v.tagName.toLowerCase())).filter(w=>o(w.textContent)===p);return h.length===1?h[0]:void 0},m=u(s),x=u(l);if(!m||!x||m.nextElementSibling!==x)continue;const f=new DOMParser().parseFromString(Cr(E.outerHTML),"text/html").body.firstElementChild;f&&(x.before(n.importNode(f,!0)),d=!0)}return d?n.body.innerHTML:t}async function Zv(t,e){var n;if(e&&Wr(new URL(e).hostname,"bilibili.com"))try{const o=await vv(e,t);if(o)return o}catch(o){Nt.warn("extractor.bilibili.fallback","Bilibili 专属提取失败,回退到普通模式",{context:"content-script",error:o instanceof Error?o:new Error(String(o))})}const r=Jc(t);try{const o=e?tu(e):!1,i=o?t:t.cloneNode(!0);Tv(i),Sv(i),Cv(i),Yc(i),_v(i);const c=new O0(i,{url:e||((n=t.location)==null?void 0:n.href),fetch:hv}),d=typeof c.parseAsync=="function"?await c.parseAsync():c.parse();if(!d||!d.content)return null;let g=Vv(d.content,t);return o&&e&&(g=bv(g,e)),g.includes(`
|
|
426
|
+
`)&&(g=Iv(g)),{title:d.title||void 0,author:Os(d.author),excerpt:Rv(d.description),contentHtml:g,publishTime:d.published||void 0,siteName:d.site||void 0,lang:d.language||t.documentElement.lang||void 0,coverImage:d.image||void 0,favicon:d.favicon||void 0,wordCount:d.wordCount||void 0,metaTags:d.metaTags||void 0,extractorType:d.extractorType||void 0,schemaOrgData:d.schemaOrgData}}catch(o){return Nt.debug("extractor.defuddle.extract_failed","Defuddle 提取失败",{context:"content-script",error:o instanceof Error?o:new Error(String(o))}),null}finally{Xc(r)}}const ru="TEMPLATE_NO_CONTENT",Gv=["article","main",".content",".post-content",".article-content",".entry-content","#content",".markdown-body"];function Yv(t,e,r){if(new URL(e).hostname!=="mp.weixin.qq.com")return r;const n=t.querySelector("#js_content, .rich_media_content"),o=(n==null?void 0:n.querySelectorAll("img").length)||0,i=((r==null?void 0:r.match(/<img\b/gi))||[]).length;if(!n||!o||i>=o/2)return r;const c=n.cloneNode(!0);return Yc(c),Cr(c.innerHTML)}async function Jv(t,e,r,n){var i,c,d,g,_,E,b,C,A,a,s;const o=r?Jc(t):[];try{let l=t,u;if(r){let N="clone-fallback";const{filterContent:L,filterElement:P}=await Promise.resolve().then(()=>fy);await Nt.debug("extractor.filter.before_defuddle","在 Defuddle 之前应用过滤规则",{context:"content-script",data:{excludeCount:((i=r.exclude)==null?void 0:i.length)||0,includeCount:((c=r.include)==null?void 0:c.length)||0,templateCount:((d=r.templates)==null?void 0:d.length)||0,includeSelectors:(r.include||[]).map(I=>typeof I=="string"?I:I.selector),excludeSelectors:(r.exclude||[]).map(I=>typeof I=="string"?I:I.selector)}});const B=((g=t.body)==null?void 0:g.innerHTML)||"",U=L(B,r),F=U.html;if(u=F,F&&Go(F)){const I=document.implementation.createHTMLDocument();I.body.innerHTML=F,Wv(t,I),l=I,N="template",await Nt.debug("extractor.filter.template_doc","已构建模板提取文档并交给 Defuddle",{context:"content-script",data:{filterStats:U.stats,sourceBody:rn(B),filteredBody:rn(F)}})}else{l=t.cloneNode(!0);const I=P(l.body,r);u=(_=l.body)==null?void 0:_.innerHTML,await Nt.debug("extractor.filter.template_doc_fallback","模板提取为空,回退到克隆文档过滤",{context:"content-script",data:{filterStats:I,sourceBody:rn(B),filteredBody:rn(F)}})}await Nt.debug("extractor.filter.applied","过滤规则已应用",{context:"content-script",data:{processingDocType:N,filteredBody:rn((E=l.body)==null?void 0:E.innerHTML)}})}const m=!!(r!=null&&r.include&&r.include.length>0),x=tu(e),f=x&&$v(r),v=await Zv(f?t:l,e),p=Qc(e);let h=v==null?void 0:v.contentHtml,w=!1;if(h=Yv(l,e,h),x&&f&&Nv(u))h=Cr(u||""),w=!0;else if(x){const N=zv(h,{title:(v==null?void 0:v.title)||t.title,excerpt:v==null?void 0:v.excerpt,url:e});N&&(h=N,w=!0)}if(!w&&!Go(h||"")&&(await Nt.debug("extractor.defuddle.invalid","Defuddle 提取的内容无效,尝试其他方案",{context:"content-script",data:{contentLength:(h==null?void 0:h.length)||0,preview:h==null?void 0:h.substring(0,100),hasIncludeRules:m}}),h=void 0),!h&&m){const N=(b=l.body)==null?void 0:b.innerHTML;N&&Go(N)?(h=Cr(N),await Nt.debug("extractor.filter.direct_use","使用过滤后的内容(include 规则生效)",{context:"content-script",data:{contentLength:h.length,includeCount:((C=r==null?void 0:r.include)==null?void 0:C.length)||0,contentStructure:rn(h)}})):await Nt.debug("extractor.filter.empty","过滤后的内容为空,include 规则未匹配到元素",{context:"content-script",data:{filteredBodyLength:(N==null?void 0:N.length)||0,includeRules:(A=r==null?void 0:r.include)==null?void 0:A.map(L=>typeof L=="string"?L:L.selector)}})}if(!h&&m)throw new Error(ru);if(!h){await Nt.debug("extractor.defuddle.fallback","Defuddle 提取失败,使用文档主体内容作为后备",{context:"content-script",data:{hasIncludeRules:m}});const N=m?l:t;for(const L of Gv){const P=N.querySelector(L);if(P&&P.innerHTML&&Go(P.innerHTML)){h=Cr(P.innerHTML);break}}if(!h){const L=((a=N.body)==null?void 0:a.innerHTML)||N.documentElement.innerHTML;L&&(h=Cr(L))}}if(!h)throw new Error("Could not extract page content");h=Cr(h);const O=jv(t,v==null?void 0:v.coverImage),M=wv(t,h,O,e,{skipDocumentImages:x});let $,T;n!=null&&n.titleSelector&&($=eu(t,n.titleSelector)),n!=null&&n.authorSelector&&(T=eu(t,n.authorSelector));const D=$||(v==null?void 0:v.title)||t.title||"Untitled",R=T||(v==null?void 0:v.author),S=Uv(t,v==null?void 0:v.metaTags,v==null?void 0:v.schemaOrgData),y={...S,author:Os(R||(S==null?void 0:S.author)),publishTime:(v==null?void 0:v.publishTime)||(S==null?void 0:S.publishTime),lang:(v==null?void 0:v.lang)||(S==null?void 0:S.lang),siteName:(v==null?void 0:v.siteName)||(S==null?void 0:S.siteName)};await Nt.info("extractor.defuddle.success","Defuddle 提取成功",{context:"content-script",data:{title:D,author:R,wordCount:v==null?void 0:v.wordCount,imageCount:M.length,hasCoverImage:!!O,usedCustomTitle:!!$,usedCustomAuthor:!!T,contentStructure:rn(h)}});let k=v==null?void 0:v.excerpt;if(!k&&h){const N=h.replace(/<[^>]*>/g,"").trim();N.length>0&&(k=N.substring(0,200).trim())}return{url:e,site:p,title:D,excerpt:k,contentHtml:h,meta:y,images:M.length>0?M:void 0,createdAt:new Date().toISOString()}}catch(l){if(l instanceof Error&&l.message===ru)throw l;await Nt.error("extractor.parse.failed","parseWebPage 解析失败",{context:"content-script",error:l instanceof Error?l:new Error(String(l))});const u=Qc(e);return{url:e,site:u,title:t.title||"Untitled",contentHtml:(s=t.body)!=null&&s.innerHTML?Cr(t.body.innerHTML):"<p>Content extraction failed</p>",createdAt:new Date().toISOString()}}finally{Xc(o)}}const nu=new WeakMap;function Rs(t){const e=nu.get(t);if(e)return e;const r=Xv(t);return nu.set(t,r),r}function Xv(t){if(t.nodeType===Node.DOCUMENT_NODE)return"/";let e=t;t.nodeType===Node.TEXT_NODE&&(e=t.parentNode);const r=[];let n=e;for(;n&&n.nodeType===Node.ELEMENT_NODE;){let o=0,i=n.previousSibling;for(;i;)i.nodeType===Node.ELEMENT_NODE&&i.nodeName===n.nodeName&&o++,i=i.previousSibling;const c=n.tagName.toLowerCase();r.unshift(o>0?`${c}[${o+1}]`:c),n=n.parentNode}return`/${r.join("/")}`}function Kv(){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.getRangeAt(0),r=document.createElement("div");return r.appendChild(e.cloneContents()),r.innerHTML}function Qv(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}function Is(t,e){return Array(e+1).join(t)}function ou(t){return t.replace(/^\n*/,"")}function iu(t){for(var e=t.length;e>0&&t[e-1]===`
|
|
427
|
+
`;)e--;return t.substring(0,e)}function su(t){return iu(ou(t))}var eb=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Ms(t){return $s(t,eb)}var au=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function lu(t){return $s(t,au)}function tb(t){return uu(t,au)}var cu=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function rb(t){return $s(t,cu)}function nb(t){return uu(t,cu)}function $s(t,e){return e.indexOf(t.nodeName)>=0}function uu(t,e){return t.getElementsByTagName&&e.some(function(r){return t.getElementsByTagName(r).length})}var ob=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function du(t){return ob.reduce(function(e,r){return e.replace(r[0],r[1])},t)}var Pt={};Pt.paragraph={filter:"p",replacement:function(t){return`
|
|
428
|
+
|
|
429
|
+
`+t+`
|
|
430
|
+
|
|
431
|
+
`}},Pt.lineBreak={filter:"br",replacement:function(t,e,r){return r.br+`
|
|
432
|
+
`}},Pt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,r){var n=Number(e.nodeName.charAt(1));if(r.headingStyle==="setext"&&n<3){var o=Is(n===1?"=":"-",t.length);return`
|
|
433
|
+
|
|
434
|
+
`+t+`
|
|
435
|
+
`+o+`
|
|
436
|
+
|
|
437
|
+
`}else return`
|
|
438
|
+
|
|
439
|
+
`+Is("#",n)+" "+t+`
|
|
440
|
+
|
|
441
|
+
`}},Pt.blockquote={filter:"blockquote",replacement:function(t){return t=su(t).replace(/^/gm,"> "),`
|
|
442
|
+
|
|
443
|
+
`+t+`
|
|
444
|
+
|
|
445
|
+
`}},Pt.list={filter:["ul","ol"],replacement:function(t,e){var r=e.parentNode;return r.nodeName==="LI"&&r.lastElementChild===e?`
|
|
446
|
+
`+t:`
|
|
447
|
+
|
|
448
|
+
`+t+`
|
|
449
|
+
|
|
450
|
+
`}},Pt.listItem={filter:"li",replacement:function(t,e,r){var n=r.bulletListMarker+" ",o=e.parentNode;if(o.nodeName==="OL"){var i=o.getAttribute("start"),c=Array.prototype.indexOf.call(o.children,e);n=(i?Number(i)+c:c+1)+". "}var d=/\n$/.test(t);return t=su(t)+(d?`
|
|
451
|
+
`:""),t=t.replace(/\n/gm,`
|
|
452
|
+
`+" ".repeat(n.length)),n+t+(e.nextSibling?`
|
|
453
|
+
`:"")}},Pt.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){return`
|
|
454
|
+
|
|
455
|
+
`+e.firstChild.textContent.replace(/\n/g,`
|
|
456
|
+
`)+`
|
|
457
|
+
|
|
458
|
+
`}},Pt.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){for(var n=e.firstChild.getAttribute("class")||"",o=(n.match(/language-(\S+)/)||[null,""])[1],i=e.firstChild.textContent,c=r.fence.charAt(0),d=3,g=new RegExp("^"+c+"{3,}","gm"),_;_=g.exec(i);)_[0].length>=d&&(d=_[0].length+1);var E=Is(c,d);return`
|
|
459
|
+
|
|
460
|
+
`+E+o+`
|
|
461
|
+
`+i.replace(/\n$/,"")+`
|
|
462
|
+
`+E+`
|
|
463
|
+
|
|
464
|
+
`}},Pt.horizontalRule={filter:"hr",replacement:function(t,e,r){return`
|
|
465
|
+
|
|
466
|
+
`+r.hr+`
|
|
467
|
+
|
|
468
|
+
`}},Pt.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var r=Ps(e.getAttribute("href")),n=qs(Yo(e.getAttribute("title"))),o=n?' "'+n+'"':"";return"["+t+"]("+r+o+")"}},Pt.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,r){var n=Ps(e.getAttribute("href")),o=Yo(e.getAttribute("title"));o&&(o=' "'+qs(o)+'"');var i,c;switch(r.linkReferenceStyle){case"collapsed":i="["+t+"][]",c="["+t+"]: "+n+o;break;case"shortcut":i="["+t+"]",c="["+t+"]: "+n+o;break;default:var d=this.references.length+1;i="["+t+"]["+d+"]",c="["+d+"]: "+n+o}return this.references.push(c),i},references:[],append:function(t){var e="";return this.references.length&&(e=`
|
|
469
|
+
|
|
470
|
+
`+this.references.join(`
|
|
471
|
+
`)+`
|
|
472
|
+
|
|
473
|
+
`,this.references=[]),e}},Pt.emphasis={filter:["em","i"],replacement:function(t,e,r){return t.trim()?r.emDelimiter+t+r.emDelimiter:""}},Pt.strong={filter:["strong","b"],replacement:function(t,e,r){return t.trim()?r.strongDelimiter+t+r.strongDelimiter:""}},Pt.code={filter:function(t){var e=t.previousSibling||t.nextSibling,r=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!r},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",r="`",n=t.match(/`+/gm)||[];n.indexOf(r)!==-1;)r=r+"`";return r+e+t+e+r}},Pt.image={filter:"img",replacement:function(t,e){var r=du(Yo(e.getAttribute("alt"))),n=Ps(e.getAttribute("src")||""),o=Yo(e.getAttribute("title")),i=o?' "'+qs(o)+'"':"";return n?"":""}};function Yo(t){return t?t.replace(/(\n+\s*)+/g,`
|
|
474
|
+
`):""}function Ps(t){var e=t.replace(/([<>()])/g,"\\$1");return e.indexOf(" ")>=0?"<"+e+">":e}function qs(t){return t.replace(/"/g,'\\"')}function fu(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}fu.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=Bs(this.array,t,this.options))||(e=Bs(this._keep,t,this.options))||(e=Bs(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function Bs(t,e,r){for(var n=0;n<t.length;n++){var o=t[n];if(ib(o,e,r))return o}}function ib(t,e,r){var n=t.filter;if(typeof n=="string"){if(n===e.nodeName.toLowerCase())return!0}else if(Array.isArray(n)){if(n.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof n=="function"){if(n.call(t,e,r))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function sb(t){var e=t.element,r=t.isBlock,n=t.isVoid,o=t.isPre||function(b){return b.nodeName==="PRE"};if(!(!e.firstChild||o(e))){for(var i=null,c=!1,d=null,g=hu(d,e,o);g!==e;){if(g.nodeType===3||g.nodeType===4){var _=g.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!c&&_[0]===" "&&(_=_.substr(1)),!_){g=Fs(g);continue}g.data=_,i=g}else if(g.nodeType===1)r(g)||g.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,c=!1):n(g)||o(g)?(i=null,c=!0):i&&(c=!1);else{g=Fs(g);continue}var E=hu(d,g,o);d=g,g=E}i&&(i.data=i.data.replace(/ $/,""),i.data||Fs(i))}}function Fs(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function hu(t,e,r){return t&&t.parentNode===e||r(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var zs=typeof window<"u"?window:{};function ab(){var t=zs.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function lb(){var t=function(){};return cb()?t.prototype.parseFromString=function(e){var r=new window.ActiveXObject("htmlfile");return r.designMode="on",r.open(),r.write(e),r.close(),r}:t.prototype.parseFromString=function(e){var r=document.implementation.createHTMLDocument("");return r.open(),r.write(e),r.close(),r},t}function cb(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{zs.ActiveXObject&&(t=!0)}return t}var ub=ab()?zs.DOMParser:lb();function db(t,e){var r;if(typeof t=="string"){var n=fb().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");r=n.getElementById("turndown-root")}else r=t.cloneNode(!0);return sb({element:r,isBlock:Ms,isVoid:lu,isPre:e.preformattedCode?hb:null}),r}var Hs;function fb(){return Hs=Hs||new ub,Hs}function hb(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function mb(t,e){return t.isBlock=Ms(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=pb(t),t.flankingWhitespace=gb(t,e),t}function pb(t){return!lu(t)&&!rb(t)&&/^\s*$/i.test(t.textContent)&&!tb(t)&&!nb(t)}function gb(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var r=vb(t.textContent);return r.leadingAscii&&mu("left",t,e)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&mu("right",t,e)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function vb(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function mu(t,e,r){var n,o,i;return t==="left"?(n=e.previousSibling,o=/ $/):(n=e.nextSibling,o=/^ /),n&&(n.nodeType===3?i=o.test(n.nodeValue):r.preformattedCode&&n.nodeName==="CODE"?i=!1:n.nodeType===1&&!Ms(n)&&(i=o.test(n.textContent))),i}var bb=Array.prototype.reduce;function Jo(t){if(!(this instanceof Jo))return new Jo(t);var e={rules:Pt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(r,n){return n.isBlock?`
|
|
475
|
+
|
|
476
|
+
`:""},keepReplacement:function(r,n){return n.isBlock?`
|
|
477
|
+
|
|
478
|
+
`+n.outerHTML+`
|
|
479
|
+
|
|
480
|
+
`:n.outerHTML},defaultReplacement:function(r,n){return n.isBlock?`
|
|
481
|
+
|
|
482
|
+
`+r+`
|
|
483
|
+
|
|
484
|
+
`:r}};this.options=Qv({},e,t),this.rules=new fu(this.options)}Jo.prototype={turndown:function(t){if(!Eb(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=pu.call(this,new db(t,this.options));return xb.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return du(t)}};function pu(t){var e=this;return bb.call(t.childNodes,function(r,n){n=new mb(n,e.options);var o="";return n.nodeType===3?o=n.isCode?n.nodeValue:e.escape(n.nodeValue):n.nodeType===1&&(o=yb.call(e,n)),gu(r,o)},"")}function xb(t){var e=this;return this.rules.forEach(function(r){typeof r.append=="function"&&(t=gu(t,r.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function yb(t){var e=this.rules.forNode(t),r=pu.call(this,t),n=t.flankingWhitespace;return(n.leading||n.trailing)&&(r=r.trim()),n.leading+e.replacement(r,t,this.options)+n.trailing}function gu(t,e){var r=iu(t),n=ou(e),o=Math.max(t.length-r.length,e.length-n.length),i=`
|
|
485
|
+
|
|
486
|
+
`.substring(0,o);return r+i+n}function Eb(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}var Ye={},Lt={},vu;function En(){if(vu)return Lt;vu=1;function t(u,m,x){if(x===void 0&&(x=Array.prototype),u&&typeof x.find=="function")return x.find.call(u,m);for(var f=0;f<u.length;f++)if(r(u,f)){var v=u[f];if(m.call(void 0,v,f,u))return v}}function e(u,m){return m===void 0&&(m=Object),m&&typeof m.getOwnPropertyDescriptors=="function"&&(u=m.create(null,m.getOwnPropertyDescriptors(u))),m&&typeof m.freeze=="function"?m.freeze(u):u}function r(u,m){return Object.prototype.hasOwnProperty.call(u,m)}function n(u,m){if(u===null||typeof u!="object")throw new TypeError("target is not an object");for(var x in m)r(m,x)&&(u[x]=m[x]);return u}var o=e({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function i(u){return r(o,u.toLowerCase())}var c=e({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function d(u){return r(c,u.toLowerCase())}var g=e({script:!1,style:!1,textarea:!0,title:!0});function _(u){var m=u.toLowerCase();return r(g,m)&&!g[m]}function E(u){var m=u.toLowerCase();return r(g,m)&&g[m]}function b(u){return u===A.HTML}function C(u){return b(u)||u===A.XML_XHTML_APPLICATION}var A=e({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=Object.keys(A).map(function(u){return A[u]});function s(u){return a.indexOf(u)>-1}var l=e({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return Lt.assign=n,Lt.find=t,Lt.freeze=e,Lt.HTML_BOOLEAN_ATTRIBUTES=o,Lt.HTML_RAW_TEXT_ELEMENTS=g,Lt.HTML_VOID_ELEMENTS=c,Lt.hasDefaultHTMLNamespace=C,Lt.hasOwn=r,Lt.isHTMLBooleanAttribute=i,Lt.isHTMLRawTextElement=_,Lt.isHTMLEscapableRawTextElement=E,Lt.isHTMLMimeType=b,Lt.isHTMLVoidElement=d,Lt.isValidMimeType=s,Lt.MIME_TYPE=A,Lt.NAMESPACE=l,Lt}var An={},bu;function Xo(){if(bu)return An;bu=1;var t=En();function e(C,A){C.prototype=Object.create(Error.prototype,{constructor:{value:C},name:{value:C.name,enumerable:!0,writable:A}})}var r=t.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),n=Object.keys(r);function o(C){return typeof C=="number"&&C>=1&&C<=25}function i(C){return typeof C=="string"&&C.substring(C.length-r.Error.length)===r.Error}function c(C,A){o(C)?(this.name=n[C],this.message=A||""):(this.message=C,this.name=i(A)?A:r.Error),Error.captureStackTrace&&Error.captureStackTrace(this,c)}e(c,!0),Object.defineProperties(c.prototype,{code:{enumerable:!0,get:function(){var C=n.indexOf(this.name);return o(C)?C:0}}});for(var d={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},g=Object.entries(d),_=0;_<g.length;_++){var E=g[_][0];c[E]=g[_][1]}function b(C,A,a){this.message=C,this.locator=A,this.cause=a,Error.captureStackTrace&&Error.captureStackTrace(this,b)}return e(b),An.DOMException=c,An.DOMExceptionName=r,An.ExceptionCode=d,An.ParseError=b,An}var vt={},Ue={},xu;function yu(){if(xu)return Ue;xu=1;function t(ut){try{typeof ut!="function"&&(ut=RegExp);var it=new ut("𝌆","u").exec("𝌆");return!!it&&it[0].length===2}catch{}return!1}var e=t();function r(ut){if(ut.source[0]!=="[")throw new Error(ut+" can not be used with chars");return ut.source.slice(1,ut.source.lastIndexOf("]"))}function n(ut,it){if(ut.source[0]!=="[")throw new Error("/"+ut.source+"/ can not be used with chars_without");if(!it||typeof it!="string")throw new Error(JSON.stringify(it)+" is not a valid search");if(ut.source.indexOf(it)===-1)throw new Error('"'+it+'" is not is /'+ut.source+"/");if(it==="-"&&ut.source.indexOf(it)!==1)throw new Error('"'+it+'" is not at the first postion of /'+ut.source+"/");return new RegExp(ut.source.replace(it,""),e?"u":"")}function o(ut){var it=this;return new RegExp(Array.prototype.slice.call(arguments).map(function($t){var sr=typeof $t=="string";if(sr&&it===void 0&&$t==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return sr?$t:$t.source}).join(""),e?"u":"")}function i(ut){if(arguments.length===0)throw new Error("no parameters provided");return o.apply(i,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var c="�",d=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;e&&(d=o("[",r(d),"\\u{10000}-\\u{10FFFF}","]"));var g=new RegExp("[^"+r(d)+"]",e?"u":""),_=/[\x20\x09\x0D\x0A]/,E=r(_),b=o(_,"+"),C=o(_,"*"),A=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;e&&(A=o("[",r(A),"\\u{10000}-\\u{10FFFF}","]"));var a=r(A),s=o("[",a,r(/[-.0-9\xB7]/),r(/[\u0300-\u036F\u203F-\u2040]/),"]"),l=o(A,s,"*"),u=o("^",l,"$"),m=o(s,"+"),x=o("&",l,";"),f=i(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),v=i(x,"|",f),p=o("%",l,";"),h=i(o('"',i(/[^%&"]/,"|",p,"|",v),"*",'"'),"|",o("'",i(/[^%&']/,"|",p,"|",v),"*","'")),w=i('"',i(/[^<&"]/,"|",v),"*",'"',"|","'",i(/[^<&']/,"|",v),"*","'"),O=n(A,":"),M=n(s,":"),$=o(O,M,"*"),T=o("^",$,"$"),D=o($,i(":",$),"?"),R=o("^",D,"$"),S=o("(",D,")"),y=i(/"[^"]*"|'[^']*'/),k=o(/^<\?/,"(",l,")",i(b,"(?!",_,")(",d,"*?)"),"?",/\?>/),N=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,L=i('"',N,'*"',"|","'",n(N,"'"),"*'"),P="<!--",B="-->",U=o(P,i(n(d,"-"),"|",o("-",n(d,"-"))),"*",B),F="#PCDATA",I=i(o(/\(/,C,F,i(C,/\|/,C,D),"*",C,/\)\*/),"|",o(/\(/,C,F,C,/\)/)),H=/[?*+]?/,V=o(/\([^>]+\)/,H),X=i("EMPTY","|","ANY","|",I,"|",V),ne="<!ELEMENT",Y=o(ne,b,i(D,"|",p),b,i(X,"|",p),C,">"),W=o("NOTATION",b,/\(/,C,l,i(C,/\|/,C,l),"*",C,/\)/),J=o(/\(/,C,m,i(C,/\|/,C,m),"*",C,/\)/),G=i(W,"|",J),Q=i(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",G),ie=i(/#REQUIRED|#IMPLIED/,"|",i(i("#FIXED",b),"?",w)),K=i(b,l,b,Q,b,ie),re="<!ATTLIST",ce=o(re,b,l,K,"*",C,">"),se="about:legacy-compat",ue=i('"'+se+'"',"|","'"+se+"'"),fe="SYSTEM",le="PUBLIC",he=i(i(fe,b,y),"|",i(le,b,L,b,y)),we=o("^",i(i(fe,b,"(?<SystemLiteralOnly>",y,")"),"|",i(le,b,"(?<PubidLiteral>",L,")",b,"(?<SystemLiteral>",y,")"))),Be=o("^",L,"$"),ke=o("^",y,"$"),be=i(b,"NDATA",b,l),Ee=i(h,"|",i(he,be,"?")),xe="<!ENTITY",Ne=o(xe,b,l,b,Ee,C,">"),Re=i(h,"|",he),dt=o(xe,b,"%",b,l,b,Re,C,">"),Me=i(Ne,"|",dt),ze=o(le,b,L),Ke=o("<!NOTATION",b,l,b,i(he,"|",ze),C,">"),We=o(C,"=",C),at=/1[.]\d+/,mt=o(b,"version",We,i("'",at,"'","|",'"',at,'"')),pt=/[A-Za-z][-A-Za-z0-9._]*/,Mt=i(b,"encoding",We,i('"',pt,'"',"|","'",pt,"'")),Tt=i(b,"standalone",We,i("'",i("yes","|","no"),"'","|",'"',i("yes","|","no"),'"')),qt=o(/^<\?xml/,mt,Mt,"?",Tt,"?",C,/\?>/),rt="<!DOCTYPE",wt="<![CDATA[",_t="]]>",Ot=/<!\[CDATA\[/,Ut=/\]\]>/,ir=o(d,"*?",Ut),xr=o(Ot,ir);return Ue.chars=r,Ue.chars_without=n,Ue.detectUnicodeSupport=t,Ue.reg=o,Ue.regg=i,Ue.ABOUT_LEGACY_COMPAT=se,Ue.ABOUT_LEGACY_COMPAT_SystemLiteral=ue,Ue.AttlistDecl=ce,Ue.CDATA_START=wt,Ue.CDATA_END=_t,Ue.CDSect=xr,Ue.Char=d,Ue.Comment=U,Ue.COMMENT_START=P,Ue.COMMENT_END=B,Ue.DOCTYPE_DECL_START=rt,Ue.elementdecl=Y,Ue.EntityDecl=Me,Ue.EntityValue=h,Ue.ExternalID=he,Ue.ExternalID_match=we,Ue.Name=l,Ue.Name_exact=u,Ue.NCName_exact=T,Ue.NotationDecl=Ke,Ue.Reference=v,Ue.PEReference=p,Ue.PI=k,Ue.PUBLIC=le,Ue.PubidLiteral=L,Ue.PubidLiteral_match=Be,Ue.QName=D,Ue.QName_exact=R,Ue.QName_group=S,Ue.S=b,Ue.SChar_s=E,Ue.S_OPT=C,Ue.SYSTEM=fe,Ue.SystemLiteral=y,Ue.SystemLiteral_match=ke,Ue.InvalidChar=g,Ue.UNICODE_REPLACEMENT_CHARACTER=c,Ue.UNICODE_SUPPORT=e,Ue.XMLDecl=qt,Ue}var Eu;function Au(){if(Eu)return vt;Eu=1;var t=En(),e=t.find,r=t.hasDefaultHTMLNamespace,n=t.hasOwn,o=t.isHTMLMimeType,i=t.isHTMLRawTextElement,c=t.isHTMLVoidElement,d=t.MIME_TYPE,g=t.NAMESPACE,_=Symbol(),E=Xo(),b=E.DOMException,C=E.DOMExceptionName,A=yu();function a(q){if(q!==_)throw new TypeError("Illegal constructor")}function s(q){return q!==""}function l(q){return q?q.split(/[\t\n\f\r ]+/).filter(s):[]}function u(q,z){return n(q,z)||(q[z]=!0),q}function m(q){if(!q)return[];var z=l(q);return Object.keys(z.reduce(u,{}))}function x(q){return function(z){return q&&q.indexOf(z)!==-1}}function f(q){if(!A.QName_exact.test(q))throw new b(b.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+q+'"')}function v(q,z){f(z),q=q||null;var Z=null,ee=z;if(z.indexOf(":")>=0){var ae=z.split(":");Z=ae[0],ee=ae[1]}if(Z!==null&&q===null)throw new b(b.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(Z==="xml"&&q!==t.NAMESPACE.XML)throw new b(b.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((Z==="xmlns"||z==="xmlns")&&q!==t.NAMESPACE.XMLNS)throw new b(b.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(q===t.NAMESPACE.XMLNS&&Z!=="xmlns"&&z!=="xmlns")throw new b(b.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[q,Z,ee]}function p(q,z){for(var Z in q)n(q,Z)&&(z[Z]=q[Z])}function h(q,z){var Z=q.prototype;if(!(Z instanceof z)){let ee=function(){};ee.prototype=z.prototype,ee=new ee,p(Z,ee),q.prototype=Z=ee}Z.constructor!=q&&(typeof q!="function"&&console.error("unknown Class:"+q),Z.constructor=q)}var w={},O=w.ELEMENT_NODE=1,M=w.ATTRIBUTE_NODE=2,$=w.TEXT_NODE=3,T=w.CDATA_SECTION_NODE=4,D=w.ENTITY_REFERENCE_NODE=5,R=w.ENTITY_NODE=6,S=w.PROCESSING_INSTRUCTION_NODE=7,y=w.COMMENT_NODE=8,k=w.DOCUMENT_NODE=9,N=w.DOCUMENT_TYPE_NODE=10,L=w.DOCUMENT_FRAGMENT_NODE=11,P=w.NOTATION_NODE=12,B=t.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function U(q,z){if(z.length<q.length)return U(z,q);var Z=null;for(var ee in q){if(q[ee]!==z[ee])return Z;Z=q[ee]}return Z}function F(q){return q.guid||(q.guid=Math.random()),q.guid}function I(){}I.prototype={length:0,item:function(q){return q>=0&&q<this.length?this[q]:null},toString:function(q){var z;typeof q=="function"?z={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:q}:q?z={requireWellFormed:!!q.requireWellFormed,splitCDATASections:q.splitCDATASections!==!1,nodeFilter:q.nodeFilter||null}:z={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var Z=[],ee=0;ee<this.length;ee++)sr(this[ee],Z,null,z);return Z.join("")},filter:function(q){return Array.prototype.filter.call(this,q)},indexOf:function(q){return Array.prototype.indexOf.call(this,q)}},I.prototype[Symbol.iterator]=function(){var q=this,z=0;return{next:function(){return z<q.length?{value:q[z++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function H(q,z){this._node=q,this._refresh=z,V(this)}function V(q){var z=q._node._inc||q._node.ownerDocument._inc;if(q._inc!==z){var Z=q._refresh(q._node);if(bt(q,"length",Z.length),!q.$$length||Z.length<q.$$length)for(var ee=Z.length;ee in q;ee++)n(q,ee)&&delete q[ee];p(Z,q),q._inc=z}}H.prototype.item=function(q){return V(this),this[q]||null},h(H,I);function X(){this._nsIndex=Object.create(null),this._noNsIndex=Object.create(null)}function ne(q,z){for(var Z=0;Z<q.length;){if(q[Z]===z)return Z;Z++}}function Y(q,z,Z){if(!z)return q._noNsIndex;var ee=q._nsIndex[z];return!ee&&Z&&(ee=q._nsIndex[z]=Object.create(null)),ee}function W(q,z,Z){var ee=Y(q,z,!1),ae=ee&&ee[Z];return ae||null}function J(q,z){Y(q,z.namespaceURI,!0)[z.localName]=z}function G(q,z){var Z=Y(q,z.namespaceURI,!1);Z&&delete Z[z.localName]}function Q(q,z,Z,ee){if(ee?z[ne(z,ee)]=Z:(z[z.length]=Z,z.length++),J(z,Z),q){Z.ownerElement=q;var ae=q.ownerDocument;ae&&(ee&&he(ae,q,ee),le(ae,q,Z))}}function ie(q,z,Z){var ee=ne(z,Z);if(ee>=0){for(var ae=z.length-1;ee<=ae;)z[ee]=z[++ee];if(z.length=ae,G(z,Z),q){var Ae=q.ownerDocument;Ae&&he(Ae,q,Z),Z.ownerElement=null}}}X.prototype={length:0,item:I.prototype.item,getNamedItem:function(q){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(q=q.toLowerCase());for(var z=0;z<this.length;){var Z=this[z];if(Z.nodeName===q)return Z;z++}return null},setNamedItem:function(q){var z=q.ownerElement;if(z&&z!==this._ownerElement)throw new b(b.INUSE_ATTRIBUTE_ERR);var Z=W(this,q.namespaceURI,q.localName);return Z===q?q:(Q(this._ownerElement,this,q,Z),Z)},setNamedItemNS:function(q){return this.setNamedItem(q)},removeNamedItem:function(q){var z=this.getNamedItem(q);if(!z)throw new b(b.NOT_FOUND_ERR,q);return ie(this._ownerElement,this,z),z},removeNamedItemNS:function(q,z){var Z=this.getNamedItemNS(q,z);if(!Z)throw new b(b.NOT_FOUND_ERR,q?q+" : "+z:z);return ie(this._ownerElement,this,Z),Z},getNamedItemNS:function(q,z){q||(q=null);for(var Z=0;Z<this.length;){var ee=this[Z];if(ee.localName===z&&ee.namespaceURI===q)return ee;Z++}return null}},X.prototype[Symbol.iterator]=function(){var q=this,z=0;return{next:function(){return z<q.length?{value:q[z++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function K(){}K.prototype={hasFeature:function(q,z){return!0},createDocument:function(q,z,Z){var ee=d.XML_APPLICATION;q===g.HTML?ee=d.XML_XHTML_APPLICATION:q===g.SVG&&(ee=d.XML_SVG_IMAGE);var ae=new fe(_,{contentType:ee});if(ae.implementation=this,ae.childNodes=new I,ae.doctype=Z||null,Z&&ae.appendChild(Z),z){var Ae=ae.createElementNS(q,z);ae.appendChild(Ae)}return ae},createDocumentType:function(q,z,Z,ee){f(q);var ae=new rt(_);return ae.name=q,ae.nodeName=q,ae.publicId=z||"",ae.systemId=Z||"",ae.internalSubset=ee||"",ae.childNodes=new I,ae},createHTMLDocument:function(q){var z=new fe(_,{contentType:d.HTML});if(z.implementation=this,z.childNodes=new I,q!==!1){z.doctype=this.createDocumentType("html"),z.doctype.ownerDocument=z,z.appendChild(z.doctype);var Z=z.createElement("html");z.appendChild(Z);var ee=z.createElement("head");if(Z.appendChild(ee),typeof q=="string"){var ae=z.createElement("title");ae.appendChild(z.createTextNode(q)),ee.appendChild(ae)}Z.appendChild(z.createElement("body"))}return z}};function re(q){a(q)}re.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var q=this.getRootNode();return q&&q.nodeType===q.DOCUMENT_NODE},contains:function(q){if(!q)return!1;var z=q;do{if(this===z)return!0;z=z.parentNode}while(z);return!1},getRootNode:function(q){var z=this;do{if(!z.parentNode)return z;z=z.parentNode}while(z)},isEqualNode:function(q){if(!q)return!1;for(var z=[{node:this,other:q}];z.length>0;){var Z=z.pop(),ee=Z.node,ae=Z.other;if(ee.nodeType!==ae.nodeType)return!1;switch(ee.nodeType){case ee.DOCUMENT_TYPE_NODE:if(ee.name!==ae.name||ee.publicId!==ae.publicId||ee.systemId!==ae.systemId)return!1;break;case ee.ELEMENT_NODE:if(ee.namespaceURI!==ae.namespaceURI||ee.prefix!==ae.prefix||ee.localName!==ae.localName||ee.attributes.length!==ae.attributes.length)return!1;for(var Ae=0;Ae<ee.attributes.length;Ae++){var Le=ee.attributes.item(Ae),Ge=ae.getAttributeNodeNS(Le.namespaceURI,Le.localName);if(!Ge)return!1;z.push({node:Le,other:Ge})}break;case ee.ATTRIBUTE_NODE:if(ee.namespaceURI!==ae.namespaceURI||ee.localName!==ae.localName||ee.value!==ae.value)return!1;break;case ee.PROCESSING_INSTRUCTION_NODE:if(ee.target!==ae.target||ee.data!==ae.data)return!1;break;case ee.TEXT_NODE:case ee.CDATA_SECTION_NODE:case ee.COMMENT_NODE:if(ee.data!==ae.data)return!1;break}if(ee.childNodes.length!==ae.childNodes.length)return!1;for(var Ae=ee.childNodes.length-1;Ae>=0;Ae--)z.push({node:ee.childNodes[Ae],other:ae.childNodes[Ae]})}return!0},isSameNode:function(q){return this===q},insertBefore:function(q,z){return We(this,q,z)},replaceChild:function(q,z){We(this,q,z,Ke),z&&this.removeChild(z)},removeChild:function(q){return Be(this,q)},appendChild:function(q){return this.insertBefore(q,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(q){return hr(this.ownerDocument||this,this,q)},normalize:function(){ue(this,null,{enter:function(q){for(var z=q.firstChild;z;){var Z=z.nextSibling;if(Z!==null&&Z.nodeType===$&&z.nodeType===$){for(var ee=[],ae=Z;ae!==null&&ae.nodeType===$;)ee.push(ae.data),ae=ae.nextSibling;for(var Ae=z.nextSibling;Ae!==ae;){var Le=Ae.nextSibling;Ae.parentNode=null,Ae.previousSibling=null,Ae.nextSibling=null,Ae=Le}z.nextSibling=ae,ae!==null?ae.previousSibling=z:q.lastChild=z,z.appendData(ee.join("")),we(q.ownerDocument,q),z=ae}else z=Z}return!0}})},isSupported:function(q,z){return this.ownerDocument.implementation.hasFeature(q,z)},lookupPrefix:function(q){for(var z=this;z;){var Z=z._nsMap;if(Z){for(var ee in Z)if(n(Z,ee)&&Z[ee]===q)return ee}z=z.nodeType==M?z.ownerDocument:z.parentNode}return null},lookupNamespaceURI:function(q){for(var z=this;z;){var Z=z._nsMap;if(Z&&n(Z,q))return Z[q];z=z.nodeType==M?z.ownerDocument:z.parentNode}return null},isDefaultNamespace:function(q){var z=this.lookupPrefix(q);return z==null},compareDocumentPosition:function(q){if(this===q)return 0;var z=q,Z=this,ee=null,ae=null;if(z instanceof mt&&(ee=z,z=ee.ownerElement),Z instanceof mt&&(ae=Z,Z=ae.ownerElement,ee&&z&&Z===z))for(var Ae=0,Le;Le=Z.attributes[Ae];Ae++){if(Le===ee)return B.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+B.DOCUMENT_POSITION_PRECEDING;if(Le===ae)return B.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+B.DOCUMENT_POSITION_FOLLOWING}if(!z||!Z||Z.ownerDocument!==z.ownerDocument)return B.DOCUMENT_POSITION_DISCONNECTED+B.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(F(Z.ownerDocument)>F(z.ownerDocument)?B.DOCUMENT_POSITION_FOLLOWING:B.DOCUMENT_POSITION_PRECEDING);if(ae&&z===Z)return B.DOCUMENT_POSITION_CONTAINS+B.DOCUMENT_POSITION_PRECEDING;if(ee&&z===Z)return B.DOCUMENT_POSITION_CONTAINED_BY+B.DOCUMENT_POSITION_FOLLOWING;for(var Ge=[],xt=z.parentNode;xt;){if(!ae&&xt===Z)return B.DOCUMENT_POSITION_CONTAINED_BY+B.DOCUMENT_POSITION_FOLLOWING;Ge.push(xt),xt=xt.parentNode}Ge.reverse();for(var Ce=[],yt=Z.parentNode;yt;){if(!ee&&yt===z)return B.DOCUMENT_POSITION_CONTAINS+B.DOCUMENT_POSITION_PRECEDING;Ce.push(yt),yt=yt.parentNode}Ce.reverse();var zt=U(Ge,Ce);for(var oe in zt.childNodes){var de=zt.childNodes[oe];if(de===Z)return B.DOCUMENT_POSITION_FOLLOWING;if(de===z)return B.DOCUMENT_POSITION_PRECEDING;if(Ce.indexOf(de)>=0)return B.DOCUMENT_POSITION_FOLLOWING;if(Ge.indexOf(de)>=0)return B.DOCUMENT_POSITION_PRECEDING}return 0}};function ce(q){return q=="<"&&"<"||q==">"&&">"||q=="&"&&"&"||q=='"'&&"""||"&#"+q.charCodeAt()+";"}p(w,re),p(w,re.prototype),p(B,re),p(B,re.prototype);function se(q,z){ue(q,null,{enter:function(Z){return z(Z)?ue.STOP:!0}})}function ue(q,z,Z){for(var ee=[{node:q,context:z,phase:ue.ENTER}];ee.length>0;){var ae=ee.pop();if(ae.phase===ue.ENTER){var Ae=Z.enter(ae.node,ae.context);if(Ae===ue.STOP)return ue.STOP;if(ee.push({node:ae.node,context:Ae,phase:ue.EXIT}),Ae==null)continue;for(var Le=ae.node.lastChild;Le;)ee.push({node:Le,context:Ae,phase:ue.ENTER}),Le=Le.previousSibling}else Z.exit&&Z.exit(ae.node,ae.context)}}ue.STOP=Symbol("walkDOM.STOP"),ue.ENTER=0,ue.EXIT=1;function fe(q,z){a(q);var Z=z||{};this.ownerDocument=this,this.contentType=Z.contentType||d.XML_APPLICATION,this.type=o(this.contentType)?"html":"xml"}function le(q,z,Z){q&&q._inc++;var ee=Z.namespaceURI;ee===g.XMLNS&&(z._nsMap[Z.prefix?Z.localName:""]=Z.value)}function he(q,z,Z,ee){q&&q._inc++;var ae=Z.namespaceURI;ae===g.XMLNS&&delete z._nsMap[Z.prefix?Z.localName:""]}function we(q,z,Z){if(q&&q._inc){q._inc++;var ee=z.childNodes;if(Z&&!Z.nextSibling)ee[ee.length++]=Z;else{for(var ae=z.firstChild,Ae=0;ae;)ee[Ae++]=ae,ae=ae.nextSibling;ee.length=Ae,delete ee[ee.length]}}}function Be(q,z){if(q!==z.parentNode)throw new b(b.NOT_FOUND_ERR,"child's parent is not parent");var Z=z.previousSibling,ee=z.nextSibling;return Z?Z.nextSibling=ee:q.firstChild=ee,ee?ee.previousSibling=Z:q.lastChild=Z,we(q.ownerDocument,q),z.parentNode=null,z.previousSibling=null,z.nextSibling=null,z}function ke(q){return q&&(q.nodeType===re.DOCUMENT_NODE||q.nodeType===re.DOCUMENT_FRAGMENT_NODE||q.nodeType===re.ELEMENT_NODE)}function be(q){return q&&(q.nodeType===re.CDATA_SECTION_NODE||q.nodeType===re.COMMENT_NODE||q.nodeType===re.DOCUMENT_FRAGMENT_NODE||q.nodeType===re.DOCUMENT_TYPE_NODE||q.nodeType===re.ELEMENT_NODE||q.nodeType===re.PROCESSING_INSTRUCTION_NODE||q.nodeType===re.TEXT_NODE)}function Ee(q){return q&&q.nodeType===re.DOCUMENT_TYPE_NODE}function xe(q){return q&&q.nodeType===re.ELEMENT_NODE}function Ne(q){return q&&q.nodeType===re.TEXT_NODE}function Re(q,z){var Z=q.childNodes||[];if(e(Z,xe)||Ee(z))return!1;var ee=e(Z,Ee);return!(z&&ee&&Z.indexOf(ee)>Z.indexOf(z))}function dt(q,z){var Z=q.childNodes||[];function ee(Ae){return xe(Ae)&&Ae!==z}if(e(Z,ee))return!1;var ae=e(Z,Ee);return!(z&&ae&&Z.indexOf(ae)>Z.indexOf(z))}function Me(q,z,Z){if(!ke(q))throw new b(b.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+q.nodeType);if(Z&&Z.parentNode!==q)throw new b(b.NOT_FOUND_ERR,"child not in parent");if(!be(z)||Ee(z)&&q.nodeType!==re.DOCUMENT_NODE)throw new b(b.HIERARCHY_REQUEST_ERR,"Unexpected node type "+z.nodeType+" for parent node type "+q.nodeType)}function ze(q,z,Z){var ee=q.childNodes||[],ae=z.childNodes||[];if(z.nodeType===re.DOCUMENT_FRAGMENT_NODE){var Ae=ae.filter(xe);if(Ae.length>1||e(ae,Ne))throw new b(b.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(Ae.length===1&&!Re(q,Z))throw new b(b.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(xe(z)&&!Re(q,Z))throw new b(b.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ee(z)){if(e(ee,Ee))throw new b(b.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var Le=e(ee,xe);if(Z&&ee.indexOf(Le)<ee.indexOf(Z))throw new b(b.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!Z&&Le)throw new b(b.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Ke(q,z,Z){var ee=q.childNodes||[],ae=z.childNodes||[];if(z.nodeType===re.DOCUMENT_FRAGMENT_NODE){var Ae=ae.filter(xe);if(Ae.length>1||e(ae,Ne))throw new b(b.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(Ae.length===1&&!dt(q,Z))throw new b(b.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(xe(z)&&!dt(q,Z))throw new b(b.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ee(z)){if(e(ee,function(xt){return Ee(xt)&&xt!==Z}))throw new b(b.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var Le=e(ee,xe);if(Z&&ee.indexOf(Le)<ee.indexOf(Z))throw new b(b.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function We(q,z,Z,ee){Me(q,z,Z),q.nodeType===re.DOCUMENT_NODE&&(ee||ze)(q,z,Z);var ae=z.parentNode;if(ae&&ae.removeChild(z),z.nodeType===L){var Ae=z.firstChild;if(Ae==null)return z;var Le=z.lastChild}else Ae=Le=z;var Ge=Z?Z.previousSibling:q.lastChild;Ae.previousSibling=Ge,Le.nextSibling=Z,Ge?Ge.nextSibling=Ae:q.firstChild=Ae,Z==null?q.lastChild=Le:Z.previousSibling=Le;do Ae.parentNode=q;while(Ae!==Le&&(Ae=Ae.nextSibling));return we(q.ownerDocument||q,q,z),z.nodeType==L&&(z.firstChild=z.lastChild=null),z}fe.prototype={implementation:null,nodeName:"#document",nodeType:k,doctype:null,documentElement:null,_inc:1,insertBefore:function(q,z){if(q.nodeType===L){for(var Z=q.firstChild;Z;){var ee=Z.nextSibling;this.insertBefore(Z,z),Z=ee}return q}return We(this,q,z),q.ownerDocument=this,this.documentElement===null&&q.nodeType===O&&(this.documentElement=q),q},removeChild:function(q){var z=Be(this,q);return z===this.documentElement&&(this.documentElement=null),z},replaceChild:function(q,z){We(this,q,z,Ke),q.ownerDocument=this,z&&this.removeChild(z),xe(q)&&(this.documentElement=q)},importNode:function(q,z){return Bt(this,q,z)},getElementById:function(q){var z=null;return se(this.documentElement,function(Z){if(Z.nodeType==O&&Z.getAttribute("id")==q)return z=Z,!0}),z},createElement:function(q){var z=new at(_);z.ownerDocument=this,this.type==="html"&&(q=q.toLowerCase()),r(this.contentType)&&(z.namespaceURI=g.HTML),z.nodeName=q,z.tagName=q,z.localName=q,z.childNodes=new I;var Z=z.attributes=new X;return Z._ownerElement=z,z},createDocumentFragment:function(){var q=new Ut(_);return q.ownerDocument=this,q.childNodes=new I,q},createTextNode:function(q){var z=new Mt(_);return z.ownerDocument=this,z.childNodes=new I,z.appendData(q),z},createComment:function(q){var z=new Tt(_);return z.ownerDocument=this,z.childNodes=new I,z.appendData(q),z},createCDATASection:function(q){if(q.indexOf("]]>")!==-1)throw new b(b.INVALID_CHARACTER_ERR,'data contains "]]>"');var z=new qt(_);return z.ownerDocument=this,z.childNodes=new I,z.appendData(q),z},createProcessingInstruction:function(q,z){var Z=new ir(_);return Z.ownerDocument=this,Z.childNodes=new I,Z.nodeName=Z.target=q,Z.nodeValue=Z.data=z,Z},createAttribute:function(q){if(!A.QName_exact.test(q))throw new b(b.INVALID_CHARACTER_ERR,'invalid character in name "'+q+'"');return this.type==="html"&&(q=q.toLowerCase()),this._createAttribute(q)},_createAttribute:function(q){var z=new mt(_);return z.ownerDocument=this,z.childNodes=new I,z.name=q,z.nodeName=q,z.localName=q,z.specified=!0,z},createEntityReference:function(q){if(!A.Name_exact.test(q))throw new b(b.INVALID_CHARACTER_ERR,'not a valid xml name "'+q+'"');if(this.type==="html")throw new b("document is an html document",C.NotSupportedError);var z=new Ot(_);return z.ownerDocument=this,z.childNodes=new I,z.nodeName=q,z},createElementNS:function(q,z){var Z=v(q,z),ee=new at(_),ae=ee.attributes=new X;return ee.childNodes=new I,ee.ownerDocument=this,ee.nodeName=z,ee.tagName=z,ee.namespaceURI=Z[0],ee.prefix=Z[1],ee.localName=Z[2],ae._ownerElement=ee,ee},createAttributeNS:function(q,z){var Z=v(q,z),ee=new mt(_);return ee.ownerDocument=this,ee.childNodes=new I,ee.nodeName=z,ee.name=z,ee.specified=!0,ee.namespaceURI=Z[0],ee.prefix=Z[1],ee.localName=Z[2],ee}},h(fe,re);function at(q){a(q),this._nsMap=Object.create(null)}at.prototype={nodeType:O,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===g.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(q){return!!this.getAttributeNode(q)},getAttribute:function(q){var z=this.getAttributeNode(q);return z?z.value:null},getAttributeNode:function(q){return this._isInHTMLDocumentAndNamespace()&&(q=q.toLowerCase()),this.attributes.getNamedItem(q)},setAttribute:function(q,z){this._isInHTMLDocumentAndNamespace()&&(q=q.toLowerCase());var Z=this.getAttributeNode(q);Z?Z.value=Z.nodeValue=""+z:(Z=this.ownerDocument._createAttribute(q),Z.value=Z.nodeValue=""+z,this.setAttributeNode(Z))},removeAttribute:function(q){var z=this.getAttributeNode(q);z&&this.removeAttributeNode(z)},setAttributeNode:function(q){return this.attributes.setNamedItem(q)},setAttributeNodeNS:function(q){return this.attributes.setNamedItemNS(q)},removeAttributeNode:function(q){return this.attributes.removeNamedItem(q.nodeName)},removeAttributeNS:function(q,z){var Z=this.getAttributeNodeNS(q,z);Z&&this.removeAttributeNode(Z)},hasAttributeNS:function(q,z){return this.getAttributeNodeNS(q,z)!=null},getAttributeNS:function(q,z){var Z=this.getAttributeNodeNS(q,z);return Z?Z.value:null},setAttributeNS:function(q,z,Z){var ee=v(q,z),ae=ee[2],Ae=this.getAttributeNodeNS(q,ae);Ae?Ae.value=Ae.nodeValue=""+Z:(Ae=this.ownerDocument.createAttributeNS(q,z),Ae.value=Ae.nodeValue=""+Z,this.setAttributeNode(Ae))},getAttributeNodeNS:function(q,z){return this.attributes.getNamedItemNS(q,z)},getElementsByClassName:function(q){var z=m(q);return new H(this,function(Z){var ee=[];return z.length>0&&se(Z,function(ae){if(ae!==Z&&ae.nodeType===O){var Ae=ae.getAttribute("class");if(Ae){var Le=q===Ae;if(!Le){var Ge=m(Ae);Le=z.every(x(Ge))}Le&&ee.push(ae)}}}),ee})},getElementsByTagName:function(q){var z=(this.nodeType===k?this:this.ownerDocument).type==="html",Z=q.toLowerCase();return new H(this,function(ee){var ae=[];return se(ee,function(Ae){if(!(Ae===ee||Ae.nodeType!==O))if(q==="*")ae.push(Ae);else{var Le=Ae.getQualifiedName(),Ge=z&&Ae.namespaceURI===g.HTML?Z:q;Le===Ge&&ae.push(Ae)}}),ae})},getElementsByTagNameNS:function(q,z){return new H(this,function(Z){var ee=[];return se(Z,function(ae){ae!==Z&&ae.nodeType===O&&(q==="*"||ae.namespaceURI===q)&&(z==="*"||ae.localName==z)&&ee.push(ae)}),ee})}},fe.prototype.getElementsByClassName=at.prototype.getElementsByClassName,fe.prototype.getElementsByTagName=at.prototype.getElementsByTagName,fe.prototype.getElementsByTagNameNS=at.prototype.getElementsByTagNameNS,h(at,re);function mt(q){a(q),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}mt.prototype.nodeType=M,h(mt,re);function pt(q){a(q)}pt.prototype={data:"",substringData:function(q,z){return this.data.substring(q,q+z)},appendData:function(q){q=this.data+q,this.nodeValue=this.data=q,this.length=q.length},insertData:function(q,z){this.replaceData(q,0,z)},deleteData:function(q,z){this.replaceData(q,z,"")},replaceData:function(q,z,Z){var ee=this.data.substring(0,q),ae=this.data.substring(q+z);Z=ee+Z+ae,this.nodeValue=this.data=Z,this.length=Z.length}},h(pt,re);function Mt(q){a(q)}Mt.prototype={nodeName:"#text",nodeType:$,splitText:function(q){var z=this.data,Z=z.substring(q);z=z.substring(0,q),this.data=this.nodeValue=z,this.length=z.length;var ee=this.ownerDocument.createTextNode(Z);return this.parentNode&&this.parentNode.insertBefore(ee,this.nextSibling),ee}},h(Mt,pt);function Tt(q){a(q)}Tt.prototype={nodeName:"#comment",nodeType:y},h(Tt,pt);function qt(q){a(q)}qt.prototype={nodeName:"#cdata-section",nodeType:T},h(qt,Mt);function rt(q){a(q)}rt.prototype.nodeType=N,h(rt,re);function wt(q){a(q)}wt.prototype.nodeType=P,h(wt,re);function _t(q){a(q)}_t.prototype.nodeType=R,h(_t,re);function Ot(q){a(q)}Ot.prototype.nodeType=D,h(Ot,re);function Ut(q){a(q)}Ut.prototype.nodeName="#document-fragment",Ut.prototype.nodeType=L,h(Ut,re);function ir(q){a(q)}ir.prototype.nodeType=S,h(ir,pt);function xr(){}xr.prototype.serializeToString=function(q,z){return ut.call(q,z)},re.prototype.toString=ut;function ut(q){var z;typeof q=="function"?z={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:q}:q!=null?z={requireWellFormed:!!q.requireWellFormed,splitCDATASections:q.splitCDATASections!==!1,nodeFilter:q.nodeFilter||null}:z={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var Z=[],ee=this.nodeType===k&&this.documentElement||this,ae=ee.prefix,Ae=ee.namespaceURI;if(Ae&&ae==null){var ae=ee.lookupPrefix(Ae);if(ae==null)var Le=[{namespace:Ae,prefix:null}]}return sr(this,Z,Le,z),Z.join("")}function it(q,z,Z){var ee=q.prefix||"",ae=q.namespaceURI;if(!ae||ee==="xml"&&ae===g.XML||ae===g.XMLNS)return!1;for(var Ae=Z.length;Ae--;){var Le=Z[Ae];if(Le.prefix===ee)return Le.namespace!==ae}return!0}function $t(q,z,Z,ee){if(ee&&!A.QName_exact.test(z))throw new b('The attribute name "'+z+'" is not a valid XML QName',C.InvalidStateError);q.push(" ",z,'="',Z.replace(/[<>&"\t\n\r]/g,ce),'"')}function sr(q,z,Z,ee){Z||(Z=[]);var ae=ee.nodeFilter,Ae=ee.requireWellFormed,Le=ee.splitCDATASections,Ge=q.nodeType===k?q:q.ownerDocument,xt=Ge.type==="html";ue(q,{ns:Z},{enter:function(Ce,yt){var zt=yt.ns;if(ae)if(Ce=ae(Ce),Ce){if(typeof Ce=="string")return z.push(Ce),null}else return null;switch(Ce.nodeType){case O:var oe=Ce.attributes,de=oe.length,me=Ce.tagName,_e=me;if(!xt&&!Ce.prefix&&Ce.namespaceURI){for(var De,Te=0;Te<oe.length;Te++)if(oe.item(Te).name==="xmlns"){De=oe.item(Te).value;break}if(!De)for(var Ie=zt.length-1;Ie>=0;Ie--){var Se=zt[Ie];if(Se.prefix===""&&Se.namespace===Ce.namespaceURI){De=Se.namespace;break}}if(De!==Ce.namespaceURI)for(var Ie=zt.length-1;Ie>=0;Ie--){var Se=zt[Ie];if(Se.namespace===Ce.namespaceURI){Se.prefix&&(_e=Se.prefix+":"+me);break}}}if(Ae&&!A.QName_exact.test(_e))throw new b('The element name "'+_e+'" is not a valid XML QName',C.InvalidStateError);z.push("<",_e);for(var Oe=zt.slice(),Qe=0;Qe<de;Qe++){var et=oe.item(Qe);et.prefix=="xmlns"?Oe.push({prefix:et.localName,namespace:et.value}):et.nodeName=="xmlns"&&Oe.push({prefix:"",namespace:et.value})}for(var Qe=0;Qe<de;Qe++){var et=oe.item(Qe);if(it(et,xt,Oe)){var lt=et.prefix||"",mr=et.namespaceURI;$t(z,lt?"xmlns:"+lt:"xmlns",mr,Ae),Oe.push({prefix:lt,namespace:mr})}var Gt=ae?ae(et):et;Gt&&(typeof Gt=="string"?z.push(Gt):$t(z,Gt.name,Gt.value,Ae))}if(me===_e&&it(Ce,xt,Oe)){var Sr=Ce.prefix||"",mr=Ce.namespaceURI;$t(z,Sr?"xmlns:"+Sr:"xmlns",mr,Ae),Oe.push({prefix:Sr,namespace:mr})}var Mr=!Ce.firstChild;if(Mr&&(xt||Ce.namespaceURI===g.HTML)&&(Mr=c(me)),Mr)return z.push("/>"),null;if(z.push(">"),xt&&i(me)){for(var Jr=Ce.firstChild;Jr;)Jr.data?z.push(Jr.data):sr(Jr,z,Oe.slice(),ee),Jr=Jr.nextSibling;return z.push("</",_e,">"),null}return{ns:Oe,tag:_e};case k:case L:if(Ae&&Ce.nodeType===k&&Ce.documentElement==null)throw new b("The Document has no documentElement",C.InvalidStateError);return{ns:zt};case M:return $t(z,Ce.name,Ce.value,Ae),null;case $:if(Ae&&A.InvalidChar.test(Ce.data))throw new b("The Text node data contains characters outside the XML Char production",C.InvalidStateError);return z.push(Ce.data.replace(/[<&>]/g,ce)),null;case T:if(Ae&&Ce.data.indexOf("]]>")!==-1)throw new b('The CDATASection data contains "]]>"',C.InvalidStateError);return Le?z.push(A.CDATA_START,Ce.data.replace(/]]>/g,"]]]]><![CDATA[>"),A.CDATA_END):z.push(A.CDATA_START,Ce.data,A.CDATA_END),null;case y:if(Ae){if(A.InvalidChar.test(Ce.data))throw new b("The comment node data contains characters outside the XML Char production",C.InvalidStateError);if(Ce.data.indexOf("--")!==-1||Ce.data[Ce.data.length-1]==="-")throw new b('The comment node data contains "--" or ends with "-"',C.InvalidStateError)}return z.push(A.COMMENT_START,Ce.data,A.COMMENT_END),null;case N:var un=Ce.publicId,yr=Ce.systemId;if(Ae){if(!A.Name_exact.test(Ce.name))throw new b('The doctype name "'+Ce.name+'" is not a valid XML Name',C.InvalidStateError);if(un&&!A.PubidLiteral_match.test(un))throw new b("DocumentType publicId is not a valid PubidLiteral",C.InvalidStateError);if(yr&&yr!=="."&&!A.SystemLiteral_match.test(yr))throw new b("DocumentType systemId is not a valid SystemLiteral",C.InvalidStateError);if(Ce.internalSubset&&Ce.internalSubset.indexOf("]>")!==-1)throw new b('DocumentType internalSubset contains "]>"',C.InvalidStateError)}return z.push(A.DOCTYPE_DECL_START," ",Ce.name),un?(z.push(" ",A.PUBLIC," ",un),yr&&yr!=="."&&z.push(" ",yr)):yr&&yr!=="."&&z.push(" ",A.SYSTEM," ",yr),Ce.internalSubset&&z.push(" [",Ce.internalSubset,"]"),z.push(">"),null;case S:if(Ae){if(!A.NCName_exact.test(Ce.target)||Ce.target.toLowerCase()==="xml")throw new b('The processing instruction target "'+Ce.target+'" is not a valid XML NCName or is reserved',C.InvalidStateError);if(A.InvalidChar.test(Ce.data))throw new b("The ProcessingInstruction data contains characters outside the XML Char production",C.InvalidStateError);if(Ce.data.indexOf("?>")!==-1)throw new b('The ProcessingInstruction data contains "?>"',C.InvalidStateError)}return z.push("<?",Ce.target," ",Ce.data,"?>"),null;case D:if(Ae&&!A.Name_exact.test(Ce.nodeName))throw new b('The entity reference name "'+Ce.nodeName+'" is not a valid XML Name',C.InvalidStateError);return z.push("&",Ce.nodeName,";"),null;default:return z.push("??",Ce.nodeName),null}},exit:function(Ce,yt){yt&&yt.tag&&z.push("</",yt.tag,">")}})}function Bt(q,z,Z){var ee;return ue(z,null,{enter:function(ae,Ae){var Le=ae.cloneNode(!1);Le.ownerDocument=q,Le.parentNode=null,Ae===null?ee=Le:Ae.appendChild(Le);var Ge=ae.nodeType===M||Z;return Ge?Le:null}}),ee}function hr(q,z,Z){var ee;return ue(z,null,{enter:function(ae,Ae){var Le=new ae.constructor(_);for(var Ge in ae)if(n(ae,Ge)){var xt=ae[Ge];typeof xt!="object"&&xt!=Le[Ge]&&(Le[Ge]=xt)}ae.childNodes&&(Le.childNodes=new I),Le.ownerDocument=q;var Ce=Z;switch(Le.nodeType){case O:var yt=ae.attributes,zt=Le.attributes=new X,oe=yt.length;zt._ownerElement=Le;for(var de=0;de<oe;de++)Le.setAttributeNode(hr(q,yt.item(de),!0));break;case M:Ce=!0}return Ae!==null?Ae.appendChild(Le):ee=Le,Ce?Le:null}}),ee}function bt(q,z,Z){q[z]=Z}function Ft(q){for(var z=[],Z=q.firstChild;Z;)Z.nodeType===O&&z.push(Z),Z=Z.nextSibling;return z}try{Object.defineProperty&&(Object.defineProperty(H.prototype,"length",{get:function(){return V(this),this.$$length}}),Object.defineProperty(re.prototype,"textContent",{get:function(){if(this.nodeType===O||this.nodeType===L){var q=[];return ue(this,null,{enter:function(z){if(z.nodeType===O||z.nodeType===L)return!0;if(z.nodeType===S||z.nodeType===y)return null;q.push(z.nodeValue)}}),q.join("")}return this.nodeValue},set:function(q){switch(this.nodeType){case O:case L:for(;this.firstChild;)this.removeChild(this.firstChild);(q||String(q))&&this.appendChild(this.ownerDocument.createTextNode(q));break;default:this.data=q,this.value=q,this.nodeValue=q}}}),Object.defineProperty(pt.prototype,"data",{get:function(){return this._data!=null?this._data:""},set:function(q){this._data=q,this.length=typeof q=="string"?q.length:0}}),Object.defineProperty(pt.prototype,"nodeValue",{get:function(){return this.data},set:function(q){this.data=q},enumerable:!0,configurable:!0}),Object.defineProperty(at.prototype,"children",{get:function(){return new H(this,Ft)}}),Object.defineProperty(fe.prototype,"children",{get:function(){return new H(this,Ft)}}),Object.defineProperty(Ut.prototype,"children",{get:function(){return new H(this,Ft)}}),bt=function(q,z,Z){q["$$"+z]=Z})}catch{}return vt._updateLiveList=V,vt.Attr=mt,vt.CDATASection=qt,vt.CharacterData=pt,vt.Comment=Tt,vt.Document=fe,vt.DocumentFragment=Ut,vt.DocumentType=rt,vt.DOMImplementation=K,vt.Element=at,vt.Entity=_t,vt.EntityReference=Ot,vt.LiveNodeList=H,vt.NamedNodeMap=X,vt.Node=re,vt.NodeList=I,vt.Notation=wt,vt.Text=Mt,vt.ProcessingInstruction=ir,vt.walkDOM=ue,vt.XMLSerializer=xr,vt}var nn={},Us={},wu;function Ab(){return wu||(wu=1,(function(t){var e=En().freeze;t.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
487
|
+
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),t.entityMap=t.HTML_ENTITIES})(Us)),Us}var Gn={},Cu;function wb(){if(Cu)return Gn;Cu=1;var t=En(),e=yu(),r=Xo(),n=t.isHTMLEscapableRawTextElement,o=t.isHTMLMimeType,i=t.isHTMLRawTextElement,c=t.hasOwn,d=t.NAMESPACE,g=r.ParseError,_=r.DOMException,E=0,b=1,C=2,A=3,a=4,s=5,l=6,u=7;function m(){}m.prototype={parse:function(S,y,k){var N=this.domBuilder;N.startDocument(),O(y,y=Object.create(null)),f(S,y,k,N,this.errorHandler),N.endDocument()}};var x=/&#?\w+;?/g;function f(S,y,k,N,L){var P=o(N.mimeType);S.indexOf(e.UNICODE_REPLACEMENT_CHARACTER)>=0&&L.warning("Unicode replacement character detected, source encoding issues?");function B(Me){if(Me>65535){Me-=65536;var ze=55296+(Me>>10),Ke=56320+(Me&1023);return String.fromCharCode(ze,Ke)}else return String.fromCharCode(Me)}function U(Me){var ze=Me[Me.length-1]===";"?Me:Me+";";if(!P&&ze!==Me)return L.error("EntityRef: expecting ;"),Me;var Ke=e.Reference.exec(ze);if(!Ke||Ke[0].length!==ze.length)return L.error("entity not matching Reference production: "+Me),Me;var We=ze.slice(1,-1);return c(k,We)?k[We]:We.charAt(0)==="#"?B(parseInt(We.substring(1).replace("x","0x"))):(L.error("entity not found:"+Me),Me)}function F(Me){if(Me>J){var ze=S.substring(J,Me).replace(x,U);X&&ne(J),N.characters(ze,0,Me-J),J=Me}}var I=0,H=0,V=/\r\n?|\n|$/g,X=N.locator;function ne(Me,ze){for(;Me>=H&&(ze=V.exec(S));)I=H,H=ze.index+ze[0].length,X.lineNumber++;X.columnNumber=Me-I+1}for(var Y=[{currentNSMap:y}],W=[],J=0;;){try{var G=S.indexOf("<",J);if(G<0){if(!P&&W.length>0)return L.fatalError("unclosed xml tag(s): "+W.join(", "));if(!S.substring(J).match(/^\s*$/)){var Q=N.doc,ie=Q.createTextNode(S.substring(J));if(Q.documentElement)return L.error("Extra content at the end of the document");Q.appendChild(ie),N.currentElement=ie}return}if(G>J){var K=S.substring(J,G);!P&&W.length===0&&(K=K.replace(new RegExp(e.S_OPT.source,"g"),""),K&&L.error("Unexpected content outside root element: '"+K+"'")),F(G)}switch(S.charAt(G+1)){case"/":var Ee=S.indexOf(">",G+2),re=S.substring(G+2,Ee>0?Ee:void 0);if(!re)return L.fatalError("end tag name missing");var ce=e.reg("^",e.QName_group,e.S_OPT,"$"),se=Ee>0&&ce.exec(re);if(!se){var ue=Ee>0&&e.reg("^",e.QName_group).exec(re);if(P&&ue)L.warning('end tag name contains invalid trailing characters: "'+re+'"'),se=ue;else if(ue&&new RegExp(ce.source,ce.flags+"m").test(re))L.error('end tag name is followed by a line break and trailing content: "'+re+'"'),se=ue;else return L.fatalError('end tag name contains invalid characters: "'+re+'"')}if(!N.currentElement&&!N.doc.documentElement)return;var fe=W[W.length-1]||N.currentElement.tagName||N.doc.documentElement.tagName||"";if(fe!==se[1]){var le=se[1].toLowerCase();if(!P||fe.toLowerCase()!==le)return L.fatalError('Opening and ending tag mismatch: "'+fe+'" != "'+re+'"')}var he=Y.pop();W.pop();var we=he.localNSMap;if(N.endElement(he.uri,he.localName,fe),we)for(var Be in we)c(we,Be)&&N.endPrefixMapping(Be);Ee++;break;case"?":X&&ne(G),Ee=D(S,G,N,L);break;case"!":X&&ne(G),Ee=T(S,G,N,L,P);break;default:X&&ne(G);var ke=new R,be=Y[Y.length-1].currentNSMap,Ee=p(S,G,ke,be,U,L,P),xe=ke.length;if(ke.closed||(P&&t.isHTMLVoidElement(ke.tagName)?ke.closed=!0:W.push(ke.tagName)),X&&xe){for(var Ne=v(X,{}),Re=0;Re<xe;Re++){var dt=ke[Re];ne(dt.offset),dt.locator=v(X,{})}N.locator=Ne,h(ke,N,be)&&Y.push(ke),N.locator=X}else h(ke,N,be)&&Y.push(ke);P&&!ke.closed?Ee=w(S,Ee,ke.tagName,U,N):Ee++}}catch(Me){if(Me instanceof g)throw Me;if(Me instanceof _)return L.fatalError("Error constructing the DOM: "+Me.name+": "+Me.message,Me);L.error("element parse error: "+Me),Ee=-1}Ee>J?J=Ee:F(Math.max(G,J)+1)}}function v(S,y){return y.lineNumber=S.lineNumber,y.columnNumber=S.columnNumber,y}function p(S,y,k,N,L,P,B){function U(ne,Y,W){if(c(k.attributeNames,ne))return P.fatalError("Attribute "+ne+" redefined");if(!B&&Y.indexOf("<")>=0)return P.fatalError("Unescaped '<' not allowed in attributes values");k.addValue(ne,Y.replace(/[\t\n\r]/g," ").replace(x,L),W)}for(var F,I,H=++y,V=E;;){var X=S.charAt(H);if(V===E&&X==="<")throw new Error("unexpected < in tag name: "+S.slice(y,H));switch(X){case"=":if(V===b)F=S.slice(y,H),V=A;else if(V===C)V=A;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(V===A||V===b)if(V===b&&(P.warning('attribute value must after "="'),F=S.slice(y,H)),y=H+1,H=S.indexOf(X,y),H>0)I=S.slice(y,H),U(F,I,y-1),V=s;else throw new Error("attribute value no end '"+X+"' match");else if(V==a)I=S.slice(y,H),U(F,I,y),P.warning('attribute "'+F+'" missed start quot('+X+")!!"),y=H+1,V=s;else throw new Error('attribute value must after "="');break;case"/":switch(V){case E:k.setTagName(S.slice(y,H));case s:case l:case u:V=u,k.closed=!0;case a:case b:break;case C:k.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return P.error("unexpected end of input"),V==E&&k.setTagName(S.slice(y,H)),H;case">":switch(V){case E:k.setTagName(S.slice(y,H));case s:case l:case u:break;case a:case b:I=S.slice(y,H),I.slice(-1)==="/"&&(k.closed=!0,I=I.slice(0,-1));case C:V===C&&(I=F),V==a?(P.warning('attribute "'+I+'" missed quot(")!'),U(F,I,y)):(B||P.warning('attribute "'+I+'" missed value!! "'+I+'" instead!!'),U(I,I,y));break;case A:if(!B)return P.fatalError(`AttValue: ' or " expected`)}return H;case"":X=" ";default:if(X<=" ")switch(V){case E:k.setTagName(S.slice(y,H)),V=l;break;case b:F=S.slice(y,H),V=C;break;case a:var I=S.slice(y,H);P.warning('attribute "'+I+'" missed quot(")!!'),U(F,I,y);case s:V=l;break}else switch(V){case C:B||P.warning('attribute "'+F+'" missed value!! "'+F+'" instead2!!'),U(F,F,y),y=H,V=b;break;case s:P.warning('attribute space is required"'+F+'"!!');case l:V=b,y=H;break;case A:V=a,y=H;break;case u:throw new Error("elements closed character '/' and '>' must be connected to")}}H++}}function h(S,y,k){for(var N=S.tagName,L=null,V=S.length;V--;){var P=S[V],B=P.qName,U=P.value,X=B.indexOf(":");if(X>0)var F=P.prefix=B.slice(0,X),I=B.slice(X+1),H=F==="xmlns"&&I;else I=B,F=null,H=B==="xmlns"&&"";P.localName=I,H!==!1&&(L==null&&(L=Object.create(null),k=Object.create(k)),k[H]=L[H]=U,P.uri=d.XMLNS,y.startPrefixMapping(H,U))}for(var V=S.length;V--;)P=S[V],P.prefix&&(P.prefix==="xml"&&(P.uri=d.XML),P.prefix!=="xmlns"&&(P.uri=k[P.prefix]));var X=N.indexOf(":");X>0?(F=S.prefix=N.slice(0,X),I=S.localName=N.slice(X+1)):(F=null,I=S.localName=N);var ne=S.uri=k[F||""];if(y.startElement(ne,I,N,S),S.closed){if(y.endElement(ne,I,N),L)for(F in L)c(L,F)&&y.endPrefixMapping(F)}else return S.currentNSMap=k,S.localNSMap=L,!0}function w(S,y,k,N,L){var P=n(k);if(P||i(k)){var B=new RegExp("</"+k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+">","ig");B.lastIndex=y;var U=B.exec(S),F=U?U.index:-1;if(F<0)return y+1;var I=S.substring(y+1,F);return P&&(I=I.replace(x,N)),L.characters(I,0,I.length),F}return y+1}function O(S,y){for(var k in S)c(S,k)&&(y[k]=S[k])}function M(S,y){var k=y;function N(H){return H=H||0,S.charAt(k+H)}function L(H){H=H||1,k+=H}function P(){for(var H=0;k<S.length;){var V=N();if(V!==" "&&V!==`
|
|
488
|
+
`&&V!==" "&&V!=="\r")return H;H++,L()}return-1}function B(){return S.substring(k)}function U(H){return S.substring(k,k+H.length)===H}function F(H){return S.substring(k,k+H.length).toUpperCase()===H.toUpperCase()}function I(H){var V=e.reg("^",H),X=V.exec(B());return X?(L(X[0].length),X[0]):null}return{char:N,getIndex:function(){return k},getMatch:I,getSource:function(){return S},skip:L,skipBlanks:P,substringFromIndex:B,substringStartsWith:U,substringStartsWithCaseInsensitive:F}}function $(S,y){function k(U,F){var I=e.PI.exec(U.substringFromIndex());return I?I[1].toLowerCase()==="xml"?F.fatalError("xml declaration is only allowed at the start of the document, but found at position "+U.getIndex()):(U.skip(I[0].length),I[0]):F.fatalError("processing instruction is not well-formed at position "+U.getIndex())}var N=S.getSource();if(S.char()==="["){S.skip(1);for(var L=S.getIndex();S.getIndex()<N.length;){if(S.skipBlanks(),S.char()==="]"){var P=N.substring(L,S.getIndex());return S.skip(1),P}var B=null;if(S.char()==="<"&&S.char(1)==="!")switch(S.char(2)){case"E":S.char(3)==="L"?B=S.getMatch(e.elementdecl):S.char(3)==="N"&&(B=S.getMatch(e.EntityDecl));break;case"A":B=S.getMatch(e.AttlistDecl);break;case"N":B=S.getMatch(e.NotationDecl);break;case"-":B=S.getMatch(e.Comment);break}else if(S.char()==="<"&&S.char(1)==="?")B=k(S,y);else if(S.char()==="%")B=S.getMatch(e.PEReference);else return y.fatalError("Error detected in Markup declaration");if(!B)return y.fatalError("Error in internal subset at position "+S.getIndex())}return y.fatalError("doctype internal subset is not well-formed, missing ]")}}function T(S,y,k,N,L){var P=M(S,y);switch(L?P.char(2).toUpperCase():P.char(2)){case"-":var B=P.getMatch(e.Comment);return B?(k.comment(B,e.COMMENT_START.length,B.length-e.COMMENT_START.length-e.COMMENT_END.length),P.getIndex()):N.fatalError("comment is not well-formed at position "+P.getIndex());case"[":var U=P.getMatch(e.CDSect);return U?!L&&!k.currentElement?N.fatalError("CDATA outside of element"):(k.startCDATA(),k.characters(U,e.CDATA_START.length,U.length-e.CDATA_START.length-e.CDATA_END.length),k.endCDATA(),P.getIndex()):N.fatalError("Invalid CDATA starting at position "+y);case"D":{if(k.doc&&k.doc.documentElement)return N.fatalError("Doctype not allowed inside or after documentElement at position "+P.getIndex());if(L?!P.substringStartsWithCaseInsensitive(e.DOCTYPE_DECL_START):!P.substringStartsWith(e.DOCTYPE_DECL_START))return N.fatalError("Expected "+e.DOCTYPE_DECL_START+" at position "+P.getIndex());if(P.skip(e.DOCTYPE_DECL_START.length),P.skipBlanks()<1)return N.fatalError("Expected whitespace after "+e.DOCTYPE_DECL_START+" at position "+P.getIndex());var F={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(F.name=P.getMatch(e.Name),!F.name)return N.fatalError("doctype name missing or contains unexpected characters at position "+P.getIndex());if(L&&F.name.toLowerCase()!=="html"&&N.warning("Unexpected DOCTYPE in HTML document at position "+P.getIndex()),P.skipBlanks(),P.substringStartsWith(e.PUBLIC)||P.substringStartsWith(e.SYSTEM)){var I=e.ExternalID_match.exec(P.substringFromIndex());if(!I)return N.fatalError("doctype external id is not well-formed at position "+P.getIndex());I.groups.SystemLiteralOnly!==void 0?F.systemId=I.groups.SystemLiteralOnly:(F.systemId=I.groups.SystemLiteral,F.publicId=I.groups.PubidLiteral),P.skip(I[0].length)}else if(L&&P.substringStartsWithCaseInsensitive(e.SYSTEM)){if(P.skip(e.SYSTEM.length),P.skipBlanks()<1)return N.fatalError("Expected whitespace after "+e.SYSTEM+" at position "+P.getIndex());if(F.systemId=P.getMatch(e.ABOUT_LEGACY_COMPAT_SystemLiteral),!F.systemId)return N.fatalError("Expected "+e.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+e.SYSTEM+" at position "+P.getIndex())}return L&&F.systemId&&!e.ABOUT_LEGACY_COMPAT_SystemLiteral.test(F.systemId)&&N.warning("Unexpected doctype.systemId in HTML document at position "+P.getIndex()),L||(P.skipBlanks(),F.internalSubset=$(P,N)),P.skipBlanks(),P.char()!==">"?N.fatalError("doctype not terminated with > at position "+P.getIndex()):(P.skip(1),k.startDTD(F.name,F.publicId,F.systemId,F.internalSubset),k.endDTD(),P.getIndex())}default:return N.fatalError('Not well-formed XML starting with "<!" at position '+y)}}function D(S,y,k,N){var L=S.substring(y).match(e.PI);if(!L)return N.fatalError("Invalid processing instruction starting at position "+y);if(L[1].toLowerCase()==="xml"){if(y>0)return N.fatalError("processing instruction at position "+y+" is an xml declaration which is only at the start of the document");if(!e.XMLDecl.test(S.substring(y)))return N.fatalError("xml declaration is not well-formed")}return k.processingInstruction(L[1],L[2]),y+L[0].length}function R(){this.attributeNames=Object.create(null)}return R.prototype={setTagName:function(S){if(!e.QName_exact.test(S))throw new Error("invalid tagName:"+S);this.tagName=S},addValue:function(S,y,k){if(!e.QName_exact.test(S))throw new Error("invalid attribute:"+S);this.attributeNames[S]=this.length,this[this.length++]={qName:S,value:y,offset:k}},length:0,getLocalName:function(S){return this[S].localName},getLocator:function(S){return this[S].locator},getQName:function(S){return this[S].qName},getURI:function(S){return this[S].uri},getValue:function(S){return this[S].value}},Gn.XMLReader=m,Gn.parseUtils=M,Gn.parseDoctypeCommentOrCData=T,Gn}var Su;function Cb(){if(Su)return nn;Su=1;var t=En(),e=Au(),r=Xo(),n=Ab(),o=wb(),i=e.DOMImplementation,c=t.hasDefaultHTMLNamespace,d=t.isHTMLMimeType,g=t.isValidMimeType,_=t.MIME_TYPE,E=t.NAMESPACE,b=r.ParseError,C=o.XMLReader;function A(p){return p.replace(/\r[\n\u0085]/g,`
|
|
489
|
+
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
490
|
+
`)}function a(p){if(p=p||{},p.locator===void 0&&(p.locator=!0),this.assign=p.assign||t.assign,this.domHandler=p.domHandler||s,this.onError=p.onError||p.errorHandler,p.errorHandler&&typeof p.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");p.errorHandler&&p.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=p.normalizeLineEndings||A,this.locator=!!p.locator,this.xmlns=this.assign(Object.create(null),p.xmlns)}a.prototype.parseFromString=function(p,h){if(!g(h))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+h+'" is not valid.');var w=this.assign(Object.create(null),this.xmlns),O=n.XML_ENTITIES,M=w[""]||null;c(h)?(O=n.HTML_ENTITIES,M=E.HTML):h===_.XML_SVG_IMAGE&&(M=E.SVG),w[""]=M,w.xml=w.xml||E.XML;var $=new this.domHandler({mimeType:h,defaultNamespace:M,onError:this.onError}),T=this.locator?{}:void 0;this.locator&&$.setDocumentLocator(T);var D=new C;D.errorHandler=$,D.domBuilder=$;var R=!t.isHTMLMimeType(h);return R&&typeof p!="string"&&D.errorHandler.fatalError("source is not a string"),D.parse(this.normalizeLineEndings(String(p)),w,O),$.doc.documentElement||D.errorHandler.fatalError("missing root element"),$.doc};function s(p){var h=p||{};this.mimeType=h.mimeType||_.XML_APPLICATION,this.defaultNamespace=h.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=h.onError}function l(p,h){h.lineNumber=p.lineNumber,h.columnNumber=p.columnNumber}s.prototype={startDocument:function(){var p=new i;this.doc=d(this.mimeType)?p.createHTMLDocument(!1):p.createDocument(this.defaultNamespace,"")},startElement:function(p,h,w,O){var M=this.doc,$=M.createElementNS(p,w||h),T=O.length;x(this,$),this.currentElement=$,this.locator&&l(this.locator,$);for(var D=0;D<T;D++){var p=O.getURI(D),R=O.getValue(D),w=O.getQName(D),S=M.createAttributeNS(p,w);this.locator&&l(O.getLocator(D),S),S.value=S.nodeValue=R,$.setAttributeNode(S)}},endElement:function(p,h,w){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(p,h){},endPrefixMapping:function(p){},processingInstruction:function(p,h){var w=this.doc.createProcessingInstruction(p,h);this.locator&&l(this.locator,w),x(this,w)},ignorableWhitespace:function(p,h,w){},characters:function(p,h,w){if(p=m.apply(this,arguments),p){if(this.cdata)var O=this.doc.createCDATASection(p);else var O=this.doc.createTextNode(p);this.currentElement?this.currentElement.appendChild(O):/^\s*$/.test(p)&&this.doc.appendChild(O),this.locator&&l(this.locator,O)}},skippedEntity:function(p){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(p){p&&(p.lineNumber=0),this.locator=p},comment:function(p,h,w){p=m.apply(this,arguments);var O=this.doc.createComment(p);this.locator&&l(this.locator,O),x(this,O)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(p,h,w,O){var M=this.doc.implementation;if(M&&M.createDocumentType){var $=M.createDocumentType(p,h,w,O);this.locator&&l(this.locator,$),x(this,$),this.doc.doctype=$}},reportError:function(p,h){if(typeof this.onError=="function")try{this.onError(p,h,this)}catch(w){throw new b("Reporting "+p+' "'+h+'" caused '+w,this.locator)}else console.error("[xmldom "+p+"] "+h,u(this.locator))},warning:function(p){this.reportError("warning",p)},error:function(p){this.reportError("error",p)},fatalError:function(p,h){throw this.reportError("fatalError",p),new b(p,this.locator,h)}};function u(p){if(p)return`
|
|
491
|
+
@#[line:`+p.lineNumber+",col:"+p.columnNumber+"]"}function m(p,h,w){return typeof p=="string"?p.substr(h,w):p.length>=h+w||h?new java.lang.String(p,h,w)+"":p}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(p){s.prototype[p]=function(){return null}});function x(p,h){p.currentElement?p.currentElement.appendChild(h):p.doc.appendChild(h)}function f(p){if(p==="error")throw"onErrorStopParsing"}function v(){throw"onWarningStopParsing"}return nn.__DOMHandler=s,nn.DOMParser=a,nn.normalizeLineEndings=A,nn.onErrorStopParsing=f,nn.onWarningStopParsing=v,nn}var _u;function Sb(){if(_u)return Ye;_u=1;var t=En();Ye.assign=t.assign,Ye.hasDefaultHTMLNamespace=t.hasDefaultHTMLNamespace,Ye.isHTMLMimeType=t.isHTMLMimeType,Ye.isValidMimeType=t.isValidMimeType,Ye.MIME_TYPE=t.MIME_TYPE,Ye.NAMESPACE=t.NAMESPACE;var e=Xo();Ye.DOMException=e.DOMException,Ye.DOMExceptionName=e.DOMExceptionName,Ye.ExceptionCode=e.ExceptionCode,Ye.ParseError=e.ParseError;var r=Au();Ye.Attr=r.Attr,Ye.CDATASection=r.CDATASection,Ye.CharacterData=r.CharacterData,Ye.Comment=r.Comment,Ye.Document=r.Document,Ye.DocumentFragment=r.DocumentFragment,Ye.DocumentType=r.DocumentType,Ye.DOMImplementation=r.DOMImplementation,Ye.Element=r.Element,Ye.Entity=r.Entity,Ye.EntityReference=r.EntityReference,Ye.LiveNodeList=r.LiveNodeList,Ye.NamedNodeMap=r.NamedNodeMap,Ye.Node=r.Node,Ye.NodeList=r.NodeList,Ye.Notation=r.Notation,Ye.ProcessingInstruction=r.ProcessingInstruction,Ye.Text=r.Text,Ye.XMLSerializer=r.XMLSerializer;var n=Cb();return Ye.DOMParser=n.DOMParser,Ye.normalizeLineEndings=n.normalizeLineEndings,Ye.onErrorStopParsing=n.onErrorStopParsing,Ye.onWarningStopParsing=n.onWarningStopParsing,Ye}var _b=Sb();let Yn=null;const Tu=t=>{const e=Yn;return Yn=t,e},tt=t=>{const e=Yn==null?void 0:Yn.get(t);return e!==void 0?new Tb(e):new Ou(t).toLatexConverter()};class Tb{constructor(e){this._latex=e}convert(){return this._latex}}const Ko=t=>t.replace(/\s+/g," ");let Db=class{constructor(e){this._mathmlElement=e}convert(){const e=this._mathmlElement.children.map(r=>tt(r)).map(r=>r.convert()).join(" ");return Ko(e)}};class js{constructor(e,r){this._open=e,this._close=r}wrap(e){return this._open+e+this._close}}class Qo{constructor(){this._open="{",this._close="}"}wrap(e){return new js(this._open,this._close).wrap(e)}}class ei{constructor(){this._open="\\left(",this._close="\\right)"}wrap(e){return new js(this._open,this._close).wrap(e)}wrapIfMoreThanOneChar(e){return e.length<=1?e:this.wrap(e)}}const kb={_:"\\underline","⏡":"\\underbrace","⏠":"\\overbrace","⏟":"\\underbrace","⏞":"\\overbrace","⏝":"\\underbrace","⏜":"\\overbrace","⎵":"\\underbrace","⎴":"\\overbrace","⃜":"\\square","⃛":"\\square","⁤":"","⁗":"''''","‾":"\\bar","‷":"```","‶":"``","‵":"`","‴":"'''","″":"''","‟":"``","„":",,","‛":"`","‚":",","̂":"\\hat","˷":"\\sim","˝":"\\sim","˜":"\\sim","˚":"\\circ","˙":"\\cdot","˘":"","ˍ":"\\_","ˋ":"ˋ","ˊ":"ˊ","ˉ":"ˉ","ˇ":"","ˆ":"\\hat","º":"o","¹":"1","¸":"¸","´":"´","³":"3","²":"2","°":"\\circ","¯":"\\bar","ª":"a","¨":"\\cdot\\cdot","~":"\\sim","`":"`","^":"\\hat","--":"--","++":"++","&":"\\&","⁡":"","∜":"\\sqrt[4]{}","∛":"\\sqrt[3]{}","√":"\\sqrt{}","ⅆ":"d","ⅅ":"\\mathbb{D}","?":"?","@":"@","//":"//","!!":"!!","!":"!","♯":"\\#","♮":"","♭":"","′":"'","<>":"<>","**":"\\star\\star","∇":"\\nabla","∂":"\\partial","⊙":"\\bigodot","¬":"\\neg","∢":"\\measuredangle","∡":"\\measuredangle","∠":"\\angle","÷":"\\div","/":"/","∖":"\\backslash","\\":"\\backslash","%":"\\%","⊗":"\\bigotimes","·":"\\cdot","⨿":"\\coprod","⨯":"\\times","⋅":"\\cdot","⊡":"\\boxdot","⊠":"\\boxtimes","⁢":"","⁃":"-","•":"\\cdot","×":"\\times",".":".","*":"\\star","∪":"\\cup","∩":"\\cap","∐":"\\coprod","∏":"\\prod","≀":"","⫿":"","⫼":"\\mid\\mid\\mid","⨉":"\\times","⨈":"","⨇":"","⨆":"\\sqcup","⨅":"\\sqcap","⨂":"\\otimes","⨀":"\\odot","⋂":"\\cap","⋁":"\\vee","⋀":"\\wedge","⨄":"\\uplus","⨃":"\\cup","⋃":"\\cup","⨜":"\\underline{\\int}","⨛":"\\overline{\\int}","⨚":"\\int","⨙":"\\int","⨘":"\\int","⨗":"\\int","⨖":"\\oint","⨕":"\\oint","⨔":"\\int","⨓":"\\int","⨒":"\\int","⨑":"\\int","⨐":"\\int","⨏":"\\bcancel{\\int}","⨎":"","⨍":"\\hcancel{\\int}","⨌":"\\iiiint","∳":"\\oint","∲":"\\oint","∱":"\\int","∰":"\\oiint","∯":"\\oiint","∮":"\\oint","∫":"\\int","⨁":"\\oplus","⊘":"\\oslash","⊖":"\\ominus","⊕":"\\oplus","∭":"\\iiint","∬":"\\iint","⨋":"","⨊":"","∑":"\\sum","⊟":"\\boxminus","⊞":"\\boxplus","∔":"\\dot{+}","∓":"+-","−":"-","±":"\\pm","-":"-","+":"+","⭆":"\\Rrightarrow","⭅":"\\Lleftarrow","⧴":":\\rightarrow","⧯":"","⧟":"\\bullet-\\bullet","⦟":"\\angle","⦞":"\\measuredangle","⦝":"\\measuredangle","⦜":"\\perp","⦛":"\\measuredangle","⦚":"","⦙":"\\vdots","⥿":"","⥾":"","⥽":"\\prec","⥼":"\\succ","⥻":"\\underset{\\rightarrow}{\\supset}","⥺":"","⥹":"\\underset{\\rightarrow}{\\subset}","⥸":"\\underset{\\rightarrow}{>}","⥷":"","⥶":"\\underset{\\leftarrow}{<}","⥵":"\\underset{\\approx}{\\rightarrow}","⥴":"\\underset{\\sim}{\\rightarrow}","⥳":"\\underset{\\sim}{\\leftarrow}","⥲":"\\overset{\\sim}{\\rightarrow}","⥱":"\\overset{=}{\\rightarrow}","⥰":"","⥯":"","⥮":"","⥭":"\\overline{\\rightharpoondown}","⥬":"\\underline{\\rightharpoonup}","⥫":"\\overline{\\leftharpoondown}","⥪":"\\underline{\\leftharpoonup}","⥩":"\\rightleftharpoons","⥨":"\\rightleftharpoons","⥧":"\\rightleftharpoons","⥦":"\\rightleftharpoons","⥥":"\\Downarrow","⥤":"\\Rightarrow","⥣":"\\Uparrow","⥢":"\\Leftarrow","⥡":"\\downarrow","⥠":"\\uparrow","⥟":"\\rightarrow","⥞":"\\leftarrow","⥝":"\\downarrow","⥜":"\\uparrow","⥛":"\\rightarrow","⥚":"\\leftarrow","⥙":"\\downarrow","⥘":"\\uparrow","⥗":"\\rightarrow","⥖":"\\leftarrow","⥕":"\\downarrow","⥔":"\\uparrow","⥓":"\\rightarrow","⥒":"\\leftarrow","⥑":"\\updownarrow","⥐":"\\leftrightarrow","⥏":"\\updownarrow","⥎":"\\leftrightarrow","⥍":"\\updownarrow","⥌":"\\updownarrow","⥋":"\\leftrightarrow","⥊":"\\leftrightarrow","⥉":"","⥈":"\\leftrightarrow","⥇":"\\nrightarrow","⥆":"","⥅":"","⥄":"\\rightleftarrows","⥃":"\\leftrightarrows","⥂":"\\rightleftarrows","⥁":"\\circlearrowright","⥀":"\\circlearrowleft","⤿":"\\rightarrow","⤾":"\\leftarrow","⤽":"","⤼":"","⤻":"","⤺":"","⤹":"","⤸":"","⤷":"\\Rsh","⤶":"\\Lsh","⤵":"\\downarrow","⤴":"\\uparrow","⤳":"\\leadsto","⤲":"","⤱":"","⤰":"","⤯":"","⤮":"","⤭":"","⤬":"\\times","⤫":"\\times","⤪":"","⤩":"","⤨":"","⤧":"","⤦":"","⤥":"","⤤":"","⤣":"","⤢":"","⤡":"","⤠":"\\mapsto\\cdot","⤟":"\\cdot\\leftarrow","⤞":"\\rightarrow\\cdot","⤝":"\\leftarrow","⤜":"\\rightarrow","⤛":"\\leftarrow","⤚":"\\rightarrow","⤙":"\\leftarrow","⤘":"\\rightarrow","⤗":"\\rightarrow","⤖":"\\rightarrow","⤕":"\\rightarrow","⤔":"\\rightarrow","⤓":"\\downarrow","⤒":"\\uparrow","⤑":"\\rightarrow","⤐":"\\rightarrow","⤏":"\\rightarrow","⤎":"\\leftarrow","⤍":"\\rightarrow","⤌":"\\leftarrow","⤋":"\\Downarrow","⤊":"\\Uparrow","⤉":"\\uparrow","⤈":"\\downarrow","⤇":"\\Rightarrow","⤆":"\\Leftarrow","⤅":"\\mapsto","⤄":"\\nLeftrightarrow","⤃":"\\nRightarrow","⤂":"\\nLeftarrow","⤁":"\\rightsquigarrow","⤀":"\\rightsquigarrow","⟿":"\\rightsquigarrow","⟾":"\\Rightarrow","⟽":"\\Leftarrow","⟼":"\\mapsto","⟻":"\\leftarrow","⟺":"\\Longleftrightarrow","⟹":"\\Longrightarrow","⟸":"\\Longleftarrow","⟷":"\\leftrightarrow","⟶":"\\rightarrow","⟵":"\\leftarrow","⟱":"\\Downarrow","⟰":"\\Uparrow","⊸":"\\rightarrow","⇿":"\\leftrightarrow","⇾":"\\rightarrow","⇽":"\\leftarrow","⇼":"\\nleftrightarrow","⇻":"\\nrightarrow","⇺":"\\nleftarrow","⇹":"\\nleftrightarrow","⇸":"\\nrightarrow","⇷":"\\nleftarrow","⇶":"\\Rrightarrow","⇵":"","⇴":"\\rightarrow","⇳":"\\Updownarrow","⇲":"\\searrow","⇱":"\\nwarrow","⇰":"\\Leftarrow","⇯":"\\Uparrow","⇮":"\\Uparrow","⇭":"\\Uparrow","⇬":"\\Uparrow","⇫":"\\Uparrow","⇪":"\\Uparrow","⇩":"\\Downarrow","⇨":"\\Rightarrow","⇧":"\\Uparrow","⇦":"\\Leftarrow","⇥":"\\rightarrow","⇤":"\\leftarrow","⇣":"\\downarrow","⇢":"\\rightarrow","⇡":"\\uparrow","⇠":"\\leftarrow","⇟":"\\downarrow","⇞":"\\uparrow","⇝":"\\rightsquigarrow","⇜":"\\leftarrow","⇛":"\\Rrightarrow","⇚":"\\Lleftarrow","⇙":"\\swarrow","⇘":"\\searrow","⇗":"\\nearrow","⇖":"\\nwarrow","⇕":"\\Updownarrow","⇔":"\\Leftrightarrow","⇓":"\\Downarrow","⇒":"\\Rightarrow","⇑":"\\Uparrow","⇐":"\\Leftarrow","⇏":"\\nRightarrow","⇎":"\\nLeftrightarrow","⇍":"\\nLeftarrow","⇌":"\\rightleftharpoons","⇋":"\\leftrightharpoons","⇊":"\\downdownarrows","⇉":"\\rightrightarrows","⇈":"\\upuparrows","⇇":"\\leftleftarrows","⇆":"\\leftrightarrows","⇅":"","⇄":"\\rightleftarrows","⇃":"\\downharpoonleft","⇂":"\\downharpoonright","⇁":"\\rightharpoondown","⇀":"\\rightharpoonup","↿":"\\upharpoonleft","↾":"\\upharpoonright","↽":"\\leftharpoondown","↼":"\\leftharpoonup","↻":"\\circlearrowright","↺":"\\circlearrowleft","↹":"\\leftrightarrows","↸":"\\overline{\\nwarrow}","↷":"\\curvearrowright","↶":"\\curvearrowleft","↵":"\\swarrow","↴":"\\searrow","↳":"\\Rsh","↲":"\\Lsh","↱":"\\Rsh","↰":"\\Lsh","↯":"\\swarrow","↮":"","↭":"\\leftrightsquigarrow","↬":"\\looparrowright","↫":"\\looparrowleft","↪":"\\hookrightarrow","↩":"\\hookleftarrow","↨":"\\underline{\\updownarrow}","↧":"\\downarrow","↦":"\\rightarrowtail","↥":"\\uparrow","↤":"\\leftarrowtail","↣":"\\rightarrowtail","↢":"\\leftarrowtail","↡":"\\downarrow","↠":"\\twoheadrightarrow","↟":"\\uparrow","↞":"\\twoheadleftarrow","↝":"\\nearrow","↜":"\\nwarrow","↛":"","↚":"","↙":"\\swarrow","↘":"\\searrow","↗":"\\nearrow","↖":"\\nwarrow","↕":"\\updownarrow","↔":"\\leftrightarrow","↓":"\\downarrow","→":"\\rightarrow","↑":"\\uparrow","←":"\\leftarrow","|||":"\\left|||\\right.","||":"\\left\\|\\right.","|":"\\left|\\right.","⫾":"","⫽":"//","⫻":"///","⫺":"","⫹":"","⫸":"","⫷":"","⫶":"\\vdots","⫵":"","⫴":"","⫳":"","⫲":"\\nparallel","⫱":"","⫰":"","⫯":"","⫮":"\\bcancel{\\mid}","⫭":"","⫬":"","⫫":"","⫪":"","⫩":"","⫨":"\\underline{\\perp}","⫧":"\\overline{\\top}","⫦":"","⫥":"","⫤":"","⫣":"","⫢":"","⫡":"","⫠":"\\perp","⫟":"\\top","⫞":"\\dashv","⫝̸":"","⫝":"","⫛":"\\pitchfork","⫚":"","⫙":"","⫘":"","⫗":"","⫖":"","⫕":"","⫔":"","⫓":"","⫒":"","⫑":"","⫐":"","⫏":"","⫎":"","⫍":"","⫌":"\\underset{\\neq}{\\supset}","⫋":"\\underset{\\neq}{\\subset}","⫊":"\\underset{\\approx}{\\supset}","⫉":"\\underset{\\approx}{\\subset}","⫈":"\\underset{\\sim}{\\supset}","⫇":"\\underset{\\sim}{\\subset}","⫆":"\\supseteqq","⫅":"\\subseteqq","⫄":"\\dot{\\supseteq}","⫃":"\\dot{\\subseteq}","⫂":"\\underset{\\times}{\\supset}","⫁":"\\underset{\\times}{\\subset}","⫀":"\\underset{+}{\\supset}","⪿":"\\underset{+}{\\subset}","⪾":"","⪽":"","⪼":"\\gg ","⪻":"\\ll","⪺":"\\underset{\\cancel{\\approx}}{\\succ}","⪹":"\\underset{\\cancel{\\approx}}{\\prec}","⪸":"\\underset{\\approx}{\\succ}","⪷":"\\underset{\\approx}{\\prec}","⪶":"\\underset{\\cancel{=}}{\\succ}","⪵":"\\underset{\\cancel{=}}{\\prec}","⪴":"\\underset{=}{\\succ}","⪳":"\\underset{=}{\\prec}","⪲":"","⪱":"","⪮":"","⪭":"\\underline{\\hcancel{>}}","⪬":"\\underline{\\hcancel{>}}","⪫":"\\hcancel{>}","⪪":"\\hcancel{<}","⪩":"","⪨":"","⪧":"\\vartriangleright","⪦":"\\vartriangleleft","⪥":"><","⪤":"><","⪣":"\\underline{\\ll}","⪢̸":"\\cancel{\\gg}","⪢":"\\gg","⪡̸":"\\cancel{\\ll}","⪡":"\\ll","⪠":"\\overset{\\sim}{\\geqq}","⪟":"\\overset{\\sim}{\\leqq}","⪞":"\\overset{\\sim}{>}","⪝":"\\overset{\\sim}{<}","⪜":"","⪛":"","⪚":"\\overset{=}{>}","⪙":"\\overset{=}{<}","⪘":"","⪗":"","⪖":"","⪕":"","⪔":"","⪓":"","⪒":"\\underset{=}{\\gtrless}","⪑":"\\underset{=}{\\lessgtr}","⪐":"\\underset{<}{\\gtrsim}","⪏":"\\underset{>}{\\lesssim}","⪎":"\\underset{\\simeq}{>}","⪍":"\\underset{\\simeq}{<}","⪌":"\\gtreqqless","⪋":"\\lesseqqgtr","⪊":"\\underset{\\cancel{\\approx}}{>}","⪉":"\\underset{\\approx}{<}","⪆":"\\underset{\\approx}{>}","⪅":"\\underset{\\approx}{<}","⪄":"","⪃":"","⪂":"","⪁":"","⪀":"","⩿":"","⩾̸":"\\bcancel{\\geq}","⩾":"\\geq","⩽̸":"\\bcancel{\\leq}","⩽":"\\leq","⩼":"","⩻":"","⩺":"","⩹":"","⩸":"\\overset{\\dots}{\\equiv}","⩷":"","⩶":"===","⩵":"==","⩴":"::=","⩳":"","⩲":"\\underset{=}{+}","⩱":"\\overset{=}{+}","⩰":"\\overset{\\approx}{=}","⩯":"\\overset{\\wedge}{=}","⩮":"\\overset{*}{=}","⩭":"\\dot{\\approx}","⩬":"","⩫":"","⩪":"\\dot{\\sim}","⩩":"","⩨":"","⩧":"\\dot{\\equiv}","⩦":"\\underset{\\cdot}{=}","⩥":"","⩤":"","⩣":"\\underset{=}{\\vee}","⩢":"\\overset{=}{\\vee}","⩡":"ul(vv)","⩠":"\\underset{=}{\\wedge}","⩟":"\\underline{\\wedge}","⩞":"\\overset{=}{\\wedge}","⩝":"\\hcancel{\\vee}","⩜":"\\hcancel{\\wedge}","⩛":"","⩚":"","⩙":"","⩘":"\\vee","⩗":"\\wedge","⩖":"","⩕":"","⩔":"","⩓":"","⩒":"\\dot{\\vee}","⩑":"\\dot{\\wedge}","⩐":"","⩏":"","⩎":"","⩍":"\\overline{\\cap}","⩌":"\\overline{\\cup}","⩋":"","⩊":"","⩉":"","⩈":"","⩇":"","⩆":"","⩅":"","⩄":"","⩃":"\\overline{\\cap}","⩂":"\\overline{\\cup}","⩁":"","⩀":"","⨾":"","⨽":"\\llcorner","⨼":"\\lrcorner","⨻":"","⨺":"","⨹":"","⨸":"","⨷":"","⨶":"\\hat{\\otimes}","⨵":"","⨴":"","⨳":"","⨲":"\\underline{\\times}","⨱":"\\underline{\\times}","⨰":"\\dot{\\times}","⨮":"","⨭":"","⨬":"","⨫":"","⨪":"","⨩":"","⨨":"","⨧":"","⨦":"\\underset{\\sim}{+}","⨥":"\\underset{\\circ}{+}","⨤":"\\overset{\\sim}{+}","⨣":"\\hat{+}","⨢":"\\dot{+}","⨡":"\\upharpoonright","⨠":">>","⨟":"","⨞":"\\triangleleft","⨝":"\\bowtie","⧿":"","⧾":"+","⧻":"\\hcancel{|||}","⧺":"\\hcancel{||}","⧹":"\\backslash","⧸":"/","⧷":"hcancel{\backslash}","⧶":"","⧵":"\\backslash","⧲":"\\Phi","⧱":"","⧰":"","⧮":"","⧭":"","⧬":"","⧫":"\\lozenge","⧪":"","⧩":"","⧨":"","⧧":"\\ddagger","⧢":"\\sqcup\\sqcup","⧡":"","⧠":"\\square","⧞":"","⧝":"","⧜":"","⧛":"\\{\\{","⧙":"\\{","⧘":"\\}","⧗":"","⧖":"","⧕":"\\bowtie","⧔":"\\bowtie","⧓":"\\bowtie","⧒":"\\bowtie","⧑":"\\bowtie","⧐̸":"| \\not\\triangleright","⧐":"| \\triangleright","⧏̸":"\\not\\triangleleft |","⧏":"\\triangleleft |","⧎":"","⧍":"\\triangle","⧌":"","⧋":"\\underline{\\triangle}","⧊":"\\dot{\\triangle}","⧉":"","⧈":"\\boxed{\\circ}","⧇":"\\boxed{\\circ}","⧆":"\\boxed{\\rightarrow}","⧅":"\\bcancel{\\square}","⧄":"\\cancel{\\square}","⧃":"\\odot","⧂":"\\odot","⦿":"\\odot","⦾":"\\odot","⦽":"\\varnothing","⦼":"\\oplus","⦻":"\\otimes","⦺":"","⦹":"\\varnothing","⦸":"\\varnothing","⦷":"\\ominus","⦶":"\\ominus","⦵":"\\ominus","⦴":"\\vec{\\varnothing}","⦳":"\\vec{\\varnothing}","⦲":"\\dot{\\varnothing}","⦱":"\\overline{\\varnothing}","⦰":"\\varnothing","⦯":"","⦮":"","⦭":"","⦬":"","⦫":"","⦪":"","⦩":"","⦨":"","⦧":"","⦦":"","⦥":"","⦤":"","⦣":"","⦢":"","⦡":"\\not\\lor","⦠":"\\bcancel{>}","⦂":":","⦁":"\\circ","❘":"|","▲":"\\bigtriangleup","⋿":"\\Epsilon","⋾":"\\overline{\\ni}","⋽":"\\overline{\\ni}","⋼":"\\in","⋻":"\\in","⋺":"\\in","⋹":"\\underline{\\in}","⋸":"\\underline{\\in}","⋷":"\\overline{\\in}","⋶":"\\overline{\\in}","⋵":"\\dot{\\in}","⋴":"\\in","⋳":"\\in","⋲":"\\in","⋰":"\\ddots","⋩":"\\underset{\\sim}{\\succ}","⋨":"\\underset{\\sim}{\\prec}","⋧":"\\underset{\\not\\sim}{>}","⋦":"\\underset{\\not\\sim}{<}","⋥":"\\not\\sqsupseteq","⋤":"\\not\\sqsubseteq","⋣":"\\not\\sqsupseteq","⋢":"\\not\\sqsubseteq","⋡":"\\nsucc","⋠":"\\nprec","⋟":"\\succ","⋞":"\\prec","⋝":"\\overline{>}","⋜":"\\overline{<}","⋛":"\\underset{>}{\\leq}","⋚":"\\underset{<}{\\geq}","⋕":"\\#","⋓":"\\cup","⋒":"\\cap","⋑":"\\supset","⋐":"\\subset","⋏":"\\wedge","⋎":"\\vee","⋍":"\\simeq","⋈":"\\bowtie","⋇":"\\ast","⋆":"\\star","⋄":"\\diamond","⊿":"\\triangle","⊾":"\\measuredangle","⊽":"\\overline{\\lor}","⊼":"\\overline{\\land}","⊻":"\\underline{\\lor}","⊺":"\\top","⊹":"","⊷":"\\circ\\multimap","⊶":"\\circ\\multimap","⊳":"\\triangleright","⊲":"\\triangleleft","⊱":"\\succ","⊰":"\\prec","⊫":"|\\models","⊪":"|\\models","⊧":"\\models","⊦":"\\vdash","⊝":"\\ominus","⊜":"\\ominus","⊛":"\\odot","⊚":"\\odot","⊔":"\\sqcup","⊓":"\\sqcap","⊒":"\\sqsupseteq","⊑":"\\sqsubseteq","⊐̸":"\\not\\sqsupset","⊐":"\\sqsupset","⊏̸":"\\not\\sqsubset","⊏":"\\sqsubset","⊎":"\\cup","⊍":"\\cup","⊌":"\\cup","≿̸":"\\not\\succsim","≿":"\\succsim","≾":"\\precsim","≹":"\\not\\overset{>}{<}","≸":"\\not\\overset{>}{<}","≷":"\\overset{>}{<}","≶":"\\overset{<}{>}","≵":"\\not\\geg","≴":"\\not\\leq","≳":"\\geg","≲":"\\leq","≬":"","≧":"\\geg","≦̸":"\\not\\leq","≦":"\\leq","≣":"\\overset{=}{=} ","≞":"\\overset{m}{=} ","≝":"\\overset{def}{=}","≘":"=","≖":"=","≕":"=:","≓":"\\doteq","≒":"\\doteq","≑":"\\doteq","≐":"\\doteq","≏̸":"","≏":"","≎̸":"","≎":"","≌":"\\approx","≋":"\\approx","≊":"\\approx","≂̸":"\\neq","≂":"=","∿":"\\sim","∾":"\\infty","∽̱":"\\sim","∽":"\\sim","∻":"\\sim","∺":":-:","∹":"-:","∸":"\\bot","∷":"::","∶":":","∣":"|","∟":"\\llcorner","∙":"\\cdot","∘":"\\circ","∗":"*","∕":"/","∎":"\\square","∍":"\\ni","∊":"\\in","∆":"\\Delta","⁄":"/","⪰̸":"\\nsucceq","⪰":"\\succeq","⪯̸":"\\npreceq","⪯":"\\preceq","⪈":"\\ngeqslant","⪇":"\\nleqslant","⧳":"\\Phi","⧦":"\\models","⧥":"\\not\\equiv","⧤":"\\approx\\neq","⧣":"\\neq","⧁":"\\circle","⧀":"\\circle","◦":"\\circle","◗":"\\circle","◖":"\\circle","●":"\\circle","◎":"\\circledcirc","◍":"\\circledcirc","◌":"\\circledcirc","◉":"\\circledcirc","◈":"\\diamond","◇":"\\diamond","◆":"\\diamond","◅":"\\triangleleft","◄":"\\triangleleft","◃":"\\triangleleft","◂":"\\triangleleft","◁":"\\triangleleft","◀":"\\triangleleft","▿":"\\triangledown","▾":"\\triangledown","▽":"\\triangledown","▼":"\\triangledown","▹":"\\triangleright","▸":"\\triangleright","▷":"\\triangleright","▶":"\\triangleright","▵":"\\triangle","▴":"\\triangle","△":"\\triangle","▱":"\\square","▰":"\\square","▯":"\\square","▮":"\\square","▭":"\\square","▫":"\\square","▪":"\\square","□":"\\square","■":"\\square","⋭":"\\not\\triangleright","⋬":"\\not\\triangleleft","⋫":"\\not\\triangleright","⋪":"\\not\\triangleleft","⋙":"\\ggg","⋘":"\\lll","⋗":"*>","⋖":"<*","⋔":"\\pitchfork","⋌":"","⋋":"","⋊":"\\rtimes","⋉":"\\ltimes","⊵":"\\triangleright","⊴":"","⊥":"\\bot","⊁":"\\nsucc","⊀":"\\preceq","≽":"\\succeq","≼":"\\preceq","≻":"\\succ","≺":"\\prec","≱":"\\geq/","≰":"\\leq/","≭":"\\neq","≫̸":"\\not\\gg","≫":"\\gg","≪̸":"\\not\\ll","≪":"\\ll","≩":"\\ngeqslant","≨":"\\nleqslant","≡":"\\equiv","≟":"\\doteq","≜":"\\triangleq","≛":"\\doteq","≚":"\\triangleq","≙":"\\triangleq","≗":"\\doteq","≔":":=","≍":"\\asymp","≇":"\\ncong","≆":"\\ncong","≅":"\\cong","≄":"\\not\\simeq","≃":"\\simeq","≁":"\\not\\sim","∦":"\\not\\parallel","∥":"\\parallel","∤":"\\not|","∝":"\\propto","==":"==","=":"=",":=":":=","/=":"=","-=":"-=","+=":"+=","*=":"*=","!=":"!=","≠":"\\neq","≢":"\\equiv /","≉":"\\approx /","∼":"sim","≈":"\\approx","≮":"</","<":"<","≯":">/",">=":">=",">":">","≥":"\\geq","≤":"\\leq","<=":"<=","⊋":"\\supsetneq","⊊":"\\subsetneq","⊉":"\\nsupseteq","⊈":"\\nsubseteq","⊇":"\\supseteq","⊆":"\\subseteq","⊅":"\\not\\supset","⊄":"\\not\\subset","⊃⃒":"\\supset |","⊃":"\\supset","⊂⃒":"\\subset |","⊂":"\\subset","∌":"\\not\\in","∉":"\\notin","∈":"\\in","∁":"C","∄":"\\nexists","∃":"\\exists","∀":"\\forall","∧":"\\land","&&":"\\&\\&","∨":"\\lor","⊯":"\\cancel{\\vDash}","⊮":"\\cancel{\\Vdash}","⊭":"\\nvDash","⊬":"\\nvDash","⊩":"\\Vdash","⊨":"\\vDash","⊤":"\\top","⊣":"\\dashv","⊢":"\\vdash","∋":"\\ni","⋱":"\\ddots","⋯":"\\hdots","⋮":"\\vdots","…":"\\hdots","϶":"\\ni",":":":","...":"\\cdots","..":"..","->":"->","∵":"\\because","∴":"\\therefore ","⁣":"",",":",",";":";","⧽":"\\}","⧼":"\\{","⦘":"\\]","⦗":"\\[","⦖":"\\ll","⦕":"\\gg","⦔":"\\gg","⦓":"\\ll","⦒":"\\gg","⦑":"\\ll","⦐":"\\]","⦏":"\\]","⦎":"\\]","⦍":"\\[","⦌":"\\[","⦋":"\\]","⦊":"\\triangleright","⦉":"\\triangleleft","⦈":"|\\)","⦇":"\\(|","⦆":"|\\)","⦅":"\\(\\(","⦄":"|\\}","⦃":"\\{|","⦀":"\\||","⟯":"\\left. \\right]","⟮":"\\left[ \\right.","⟭":"\\left. \\right]]","⟬":"\\left[[ \\right.","⟫":"\\gg","⟪":"\\ll","⟩":"\\rangle","⟨":"\\langle","⟧":"\\left. \\right]]","⟦":"\\left[[ \\right.","❳":"\\left.\\right)","❲":"\\left(\\right.","〉":"\\rangle","〈":"\\langle","⌋":"\\rfloor","⌊":"\\lfloor","⌉":"\\rceil","⌈":"\\lceil","‖":"\\parallel","}":"\\left.\\right\\}","{":"\\left\\{\\right.","]":"\\left]\\right.","[":"\\left[\\right.",")":"\\left.\\right)","(":"\\left(\\right.","”":'"',"“":"``","’":"'","‘":"`","%CE%B1":"\\alpha","%CE%B2":"\\beta","%CE%B3":"\\gamma","%CE%93":"\\Gamma","%CE%B4":"\\delta","%CE%94":"\\Delta","%CF%B5":"\\epsilon","%CE%B6":"\\zeta","%CE%B7":"\\eta","%CE%B8":"\\theta","%CE%98":"\\Theta","%CE%B9":"\\iota","%CE%BA":"\\kappa","%CE%BB":"\\lambda","%CE%BC":"\\mu","%CE%BD":"\\nu","%CE%BF":"\\omicron","%CF%80":"\\pi","%CE%A0":"\\Pi","%CF%81":"\\pho","%CF%83":"\\sigma","%CE%A3":"\\Sigma","%CF%84":"\\tau","%CF%85":"\\upsilon","%CE%A5":"\\Upsilon","%CF%95":"\\phi","%CE%A6":"\\Phi","%CF%87":"\\chi","%CF%88":"\\psi","%CE%A8":"\\Psi","%CF%89":"\\omega","%CE%A9":"\\Omega"},Nb={_:"\\underline","⏡":"\\underbrace","⏠":"\\overbrace","⏟":"\\underbrace","⏞":"\\overbrace","⏝":"\\underbrace","⏜":"\\overbrace","⎵":"\\underbrace","⎴":"\\overbrace","⃜":"\\square","⃛":"\\square","":"","⁗":"''''","‾":"\\overline","‷":"```","‶":"``","‵":"`","‴":"'''","″":"''","‟":"``","„":",,","‛":"`","‚":",","^":"\\hat","˷":"\\sim","˝":"\\sim","˜":"\\sim","˚":"\\circ","˙":"\\cdot","˘":" ","ˍ":"\\_","ˋ":"ˋ","ˊ":"ˊ","ˉ":"ˉ","ˇ":"","ˆ":"\\hat",º:"o","¹":"1","¸":",","´":"´","³":"3","²":"2","°":"\\circ","¯":"\\bar",ª:"a","↛":"\\nrightarrow","¨":"\\cdot\\cdot","~":"\\sim","`":"`","--":"--","++":"++","&":"\\&","∜":"\\sqrt[4]{}","∛":"\\sqrt[3]{}","√":"\\sqrt{}","ⅆ":"d","ⅅ":"\\mathbb{D}","?":"?","@":"@","//":"//","!!":"!!","!":"!","♯":"\\#","♮":"","♭":"","′":"'","<>":"<>","**":"\\star\\star","∇":"\\nabla","∂":"\\partial","⊙":"\\bigodot","¬":"\\neg","∢":"\\measuredangle","∡":"\\measuredangle","∠":"\\angle","÷":"\\div","/":"/","∖":"\\backslash","\\":"\\backslash","%":"\\%","⊗":"\\bigotimes","·":"\\cdot","⨿":"\\coprod","⨯":"\\times","⋅":"\\cdot","⊡":"\\boxdot","⊠":"\\boxtimes","":"","":"","⁃":"-","•":"\\cdot",".":".","*":"\\star","∪":"\\cup","∩":"\\cap","∐":"\\coprod","∏":"\\prod","≀":"","⫿":"","⫼":"\\mid\\mid\\mid","⨉":"\\times","⨈":"","⨇":"","⨆":"\\sqcup","⨅":"\\sqcap","⨂":"\\otimes","⨀":"\\odot","⋂":"\\cap","⋁":"\\vee","⋀":"\\wedge","⨄":"\\uplus","⨃":"\\cup","⋃":"\\cup","⨜":"\\underline{\\int}","⨛":"\\overline{\\int}","⨚":"\\int","⨙":"\\int","⨘":"\\int","⨗":"\\int","⨖":"\\oint","⨕":"\\oint","⨔":"\\int","⨓":"\\int","⨒":"\\int","⨑":"\\int","⨐":"\\int","⨏":"\\bcancel{\\int}","⨎":"","⨍":"\\hcancel{\\int}","⨌":"\\iiiint","∳":"\\oint","∲":"\\oint","∱":"\\int","∰":"\\oiint","∯":"\\oiint","∮":"\\oint","∫":"\\int","⨁":"\\oplus","⊘":"\\oslash","⊖":"\\ominus","⊕":"\\oplus","∭":"\\iiint","∬":"\\iint","⨋":"","⨊":"","∑":"\\sum","⊟":"\\boxminus","⊞":"\\boxplus","∔":"\\dot{+}","∓":"+-","−":"-","±":"\\pm","-":"-","+":"+","⭆":"\\Rrightarrow","⭅":"\\Lleftarrow","⧴":":\\rightarrow","⧯":"","⧟":"\\bullet-\\bullet","⦟":"\\angle","⦞":"\\measuredangle","⦝":"\\measuredangle","⦜":"\\perp","⦛":"\\measuredangle","⦚":"","⦙":"\\vdots","⥿":"","⥾":"","⥽":"\\prec","⥼":"\\succ","⥻":"\\underset{\\rightarrow}{\\supset}","⥺":"","⥹":"\\underset{\\rightarrow}{\\subset}","⥸":"\\underset{\\rightarrow}{>}","⥷":"","⥶":"\\underset{\\leftarrow}{<}","⥵":"\\underset{\\approx}{\\rightarrow}","⥴":"\\underset{\\sim}{\\rightarrow}","⥳":"\\underset{\\sim}{\\leftarrow}","⥲":"\\overset{\\sim}{\\rightarrow}","⥱":"\\overset{=}{\\rightarrow}","⥰":"","⥯":"","⥮":"","⥭":"\\overline{\\rightharpoondown}","⥬":"\\underline{\\rightharpoonup}","⥫":"\\overline{\\leftharpoondown}","⥪":"\\underline{\\leftharpoonup}","⥩":"\\rightleftharpoons","⥨":"\\rightleftharpoons","⥧":"\\rightleftharpoons","⥦":"\\rightleftharpoons","⥥":"\\Downarrow","⥤":"\\Rightarrow","⥣":"\\Uparrow","⥢":"\\Leftarrow","⥡":"\\downarrow","⥠":"\\uparrow","⥟":"\\rightarrow","⥞":"\\leftarrow","⥝":"\\downarrow","⥜":"\\uparrow","⥛":"\\rightarrow","⥚":"\\leftarrow","⥙":"\\downarrow","⥘":"\\uparrow","⥗":"\\rightarrow","⥖":"\\leftarrow","⥕":"\\downarrow","⥔":"\\uparrow","⥓":"\\rightarrow","⥒":"\\leftarrow","⥑":"\\updownarrow","⥐":"\\leftrightarrow","⥏":"\\updownarrow","⥎":"\\leftrightarrow","⥍":"\\updownarrow","⥌":"\\updownarrow","⥋":"\\leftrightarrow","⥊":"\\leftrightarrow","⥉":"","⥈":"\\leftrightarrow","⥇":"\\nrightarrow","⥆":"","⥅":"","⥄":"\\rightleftarrows","⥃":"\\leftrightarrows","⥂":"\\rightleftarrows","⥁":"\\circlearrowright","⥀":"\\circlearrowleft","⤿":"\\rightarrow","⤾":"\\leftarrow","⤽":"\\leftarrow","⤼":"\\rightarrow","⤻":"\\rightarrow","⤺":"\\leftarrow","⤹":"\\downarrow","⤸":"\\downarrow","⤷":"\\Rsh","⤶":"\\Lsh","⤵":"\\downarrow","⤴":"\\uparrow","⤳":"\\rightarrow","⤲":"\\leftarrow","⤱":" ","⤰":" ","⤯":" ","⤮":" ","⤭":" ","⤬":"\\times","⤫":"\\times","⤪":" ","⤩":" ","⤨":" ","⤧":" ","⤦":" ","⤥":" ","⤤":" ","⤣":" ","⤢":" ","⤡":" ","⤠":"\\mapsto\\cdot","⤟":"\\cdot\\leftarrow","⤞":"\\rightarrow\\cdot","⤝":"\\leftarrow","⤜":"\\rightarrow","⤛":"\\leftarrow","⤚":"\\rightarrow","⤙":"\\leftarrow","⤘":"\\rightarrow","⤗":"\\rightarrow","⤖":"\\rightarrow","⤕":"\\rightarrow","⤔":"\\rightarrow","⤓":"\\downarrow","⤒":"\\uparrow","⤑":"\\rightarrow","⤐":"\\rightarrow","⤏":"\\rightarrow","⤎":"\\leftarrow","⤍":"\\rightarrow","⤌":"\\leftarrow","⤋":"\\Downarrow","⤊":"\\Uparrow","⤉":"\\uparrow","⤈":"\\downarrow","⤇":"\\Rightarrow","⤆":"\\Leftarrow","⤅":"\\mapsto","⤄":"\\nLeftrightarrow","⤃":"\\nRightarrow","⤂":"\\nLeftarrow","⤁":"\\rightsquigarrow","⤀":"\\rightsquigarrow","⟿":"\\rightsquigarrow","⟾":"\\Rightarrow","⟽":"\\Leftarrow","⟼":"\\mapsto","⟻":"\\leftarrow","⟺":"\\Longleftrightarrow","⟹":"\\Longrightarrow","⟸":"\\Longleftarrow","⟷":"\\leftrightarrow","⟶":"\\rightarrow","⟵":"\\leftarrow","⟱":"\\Downarrow","⟰":"\\Uparrow","⊸":"\\rightarrow","⇿":"\\leftrightarrow","⇾":"\\rightarrow","⇽":"\\leftarrow","⇼":"\\nleftrightarrow","⇻":"\\nrightarrow","⇺":"\\nleftarrow","⇹":"\\nleftrightarrow","⇸":"\\nrightarrow","⇷":"\\nleftarrow","⇶":"\\Rrightarrow","⇵":"","⇴":"\\rightarrow","⇳":"\\Updownarrow","⇲":"\\searrow","⇱":"\\nwarrow","⇰":"\\Leftarrow","⇯":"\\Uparrow","⇮":"\\Uparrow","⇭":"\\Uparrow","⇬":"\\Uparrow","⇫":"\\Uparrow","⇪":"\\Uparrow","⇩":"\\Downarrow","⇨":"\\Rightarrow","⇧":"\\Uparrow","⇦":"\\Leftarrow","⇥":"\\rightarrow","⇤":"\\leftarrow","⇣":"\\downarrow","⇢":"\\rightarrow","⇡":"\\uparrow","⇠":"\\leftarrow","⇟":"\\downarrow","⇞":"\\uparrow","⇝":"\\rightsquigarrow","⇜":"\\leftarrow","⇛":"\\Rrightarrow","⇚":"\\Lleftarrow","⇙":"\\swarrow","⇘":"\\searrow","⇗":"\\nearrow","⇖":"\\nwarrow","⇕":"\\Updownarrow","⇔":"\\Leftrightarrow","⇓":"\\Downarrow","⇒":"\\Rightarrow","⇑":"\\Uparrow","⇐":"\\Leftarrow","⇏":"\\nRightarrow","⇎":"\\nLeftrightarrow","⇍":"\\nLeftarrow","⇌":"\\rightleftharpoons","⇋":"\\leftrightharpoons","⇊":"\\downdownarrows","⇉":"\\rightrightarrows","⇈":"\\upuparrows","⇇":"\\leftleftarrows","⇆":"\\leftrightarrows","⇅":"","⇄":"\\rightleftarrows","⇃":"\\downharpoonleft","⇂":"\\downharpoonright","⇁":"\\rightharpoondown","⇀":"\\rightharpoonup","↿":"\\upharpoonleft","↾":"\\upharpoonright","↽":"\\leftharpoondown","↼":"\\leftharpoonup","↻":"\\circlearrowright","↺":"\\circlearrowleft","↹":"\\leftrightarrows","↸":"\\overline{\\nwarrow}","↷":"\\curvearrowright","↶":"\\curvearrowleft","↵":"\\swarrow","↴":"\\searrow","↳":"\\Rsh","↲":"\\Lsh","↱":"\\Rsh","↰":"\\Lsh","↯":"\\swarrow","↮":"","↭":"\\leftrightsquigarrow","↬":"\\looparrowright","↫":"\\looparrowleft","↪":"\\hookrightarrow","↩":"\\hookleftarrow","↨":"\\underline{\\updownarrow}","↧":"\\downarrow","↦":"\\mapsto","↥":"\\uparrow","↤":"\\leftarrowtail","↣":"\\rightarrowtail","↢":"\\leftarrowtail","↡":"\\downarrow","↠":"\\twoheadrightarrow","↟":"\\uparrow","↞":"\\twoheadleftarrow","↝":"\\nearrow","↜":"\\nwarrow","↚":"","↙":"\\swarrow","↘":"\\searrow","↗":"\\nearrow","↖":"\\nwarrow","↕":"\\updownarrow","↔":"\\leftrightarrow","↓":"\\downarrow","→":"\\rightarrow","↑":"\\uparrow","←":"\\leftarrow","|||":"\\left|||\\right.","||":"\\left\\|\\right.","|":"\\mid","⫾":"","⫽":"//","⫻":"///","⫺":"","⫹":"","⫸":"","⫷":"","⫶":"\\vdots","⫵":"","⫴":"","⫳":"","⫲":"\\nparallel","⫱":"","⫰":"","⫯":"","⫮":"\\bcancel{\\mid}","⫭":"","⫬":"","⫫":"","⫪":"","⫩":"","⫨":"\\underline{\\perp}","⫧":"\\overline{\\top}","⫦":"","⫥":"","⫤":"","⫣":"","⫢":"","⫡":"","⫠":"\\perp","⫟":"\\top","⫞":"\\dashv","⫝̸":"","⫝":"","⫛":"\\pitchfork","⫚":"","⫙":"","⫘":"","⫗":"","⫖":"","⫕":"","⫔":"","⫓":"","⫒":"","⫑":"","⫐":"","⫏":"","⫎":"","⫍":"","⫌":"\\underset{\\neq}{\\supset}","⫋":"\\underset{\\neq}{\\subset}","⫊":"\\underset{\\approx}{\\supset}","⫉":"\\underset{\\approx}{\\subset}","⫈":"\\underset{\\sim}{\\supset}","⫇":"\\underset{\\sim}{\\subset}","⫆":"\\supseteqq","⫅":"\\subseteqq","⫄":"\\dot{\\supseteq}","⫃":"\\dot{\\subseteq}","⫂":"\\underset{\\times}{\\supset}","⫁":"\\underset{\\times}{\\subset}","⫀":"\\underset{+}{\\supset}","⪿":"\\underset{+}{\\subset}","⪾":"","⪽":"","⪼":"\\gg ","⪻":"\\ll","⪺":"\\underset{\\cancel{\\approx}}{\\succ}","⪹":"\\underset{\\cancel{\\approx}}{\\prec}","⪸":"\\underset{\\approx}{\\succ}","⪷":"\\underset{\\approx}{\\prec}","⪶":"\\underset{\\cancel{=}}{\\succ}","⪵":"\\underset{\\cancel{=}}{\\prec}","⪴":"\\underset{=}{\\succ}","⪳":"\\underset{=}{\\prec}","⪲":"","⪱":"","⪮":"","⪭":"\\underline{\\hcancel{>}}","⪬":"\\underline{\\hcancel{>}}","⪫":"\\hcancel{>}","⪪":"\\hcancel{<}","⪩":"","⪨":"","⪧":"\\vartriangleright","⪦":"\\vartriangleleft","⪥":"><","⪤":"><","⪣":"\\underline{\\ll}","⪢̸":"\\cancel{\\gg}","⪢":"\\gg","⪡̸":"\\cancel{\\ll}","⪡":"\\ll","⪠":"\\overset{\\sim}{\\geqq}","⪟":"\\overset{\\sim}{\\leqq}","⪞":"\\overset{\\sim}{>}","⪝":"\\overset{\\sim}{<}","⪜":"","⪛":"","⪚":"\\overset{=}{>}","⪙":"\\overset{=}{<}","⪘":"","⪗":"","⪖":"","⪕":"","⪔":"","⪓":"","⪒":"\\underset{=}{\\gtrless}","⪑":"\\underset{=}{\\lessgtr}","⪐":"\\underset{<}{\\gtrsim}","⪏":"\\underset{>}{\\lesssim}","⪎":"\\underset{\\simeq}{>}","⪍":"\\underset{\\simeq}{<}","⪌":"\\gtreqqless","⪋":"\\lesseqqgtr","⪊":"\\underset{\\cancel{\\approx}}{>}","⪉":"\\underset{\\approx}{<}","⪆":"\\underset{\\approx}{>}","⪅":"\\underset{\\approx}{<}","⪄":"","⪃":"","⪂":"","⪁":"","⪀":"","⩿":"","⩾̸":"\\bcancel{\\geq}","⩾":"\\geq","⩽̸":"\\bcancel{\\leq}","⩽":"\\leq","⩼":"","⩻":"","⩺":"","⩹":"","⩸":"\\overset{\\dots}{\\equiv}","⩷":"","⩶":"===","⩵":"==","⩴":"::=","⩳":"","⩲":"\\underset{=}{+}","⩱":"\\overset{=}{+}","⩰":"\\overset{\\approx}{=}","⩯":"\\overset{\\wedge}{=}","⩮":"\\overset{*}{=}","⩭":"\\dot{\\approx}","⩬":"","⩫":"","⩪":"\\dot{\\sim}","⩩":"","⩨":"","⩧":"\\dot{\\equiv}","⩦":"\\underset{\\cdot}{=}","⩥":"","⩤":"","⩣":"\\underset{=}{\\vee}","⩢":"\\overset{=}{\\vee}","⩡":"ul(vv)","⩠":"\\underset{=}{\\wedge}","⩟":"\\underline{\\wedge}","⩞":"\\overset{=}{\\wedge}","⩝":"\\hcancel{\\vee}","⩜":"\\hcancel{\\wedge}","⩛":"","⩚":"","⩙":"","⩘":"\\vee","⩗":"\\wedge","⩖":"","⩕":"","⩔":"","⩓":"","⩒":"\\dot{\\vee}","⩑":"\\dot{\\wedge}","⩐":"","⩏":"","⩎":"","⩍":"\\overline{\\cap}","⩌":"\\overline{\\cup}","⩋":"","⩊":"","⩉":"","⩈":"","⩇":"","⩆":"","⩅":"","⩄":"","⩃":"\\overline{\\cap}","⩂":"\\overline{\\cup}","⩁":"","⩀":"","⨾":"","⨽":"\\llcorner","⨼":"\\lrcorner","⨻":"","⨺":"","⨹":"","⨸":"","⨷":"","⨶":"\\hat{\\otimes}","⨵":"","⨴":"","⨳":"","⨲":"\\underline{\\times}","⨱":"\\underline{\\times}","⨰":"\\dot{\\times}","⨮":"\\bigodot","⨭":"\\bigodot","⨬":"","⨫":"","⨪":"","⨩":"","⨨":"","⨧":"","◻":"\\Box","⨦":"\\underset{\\sim}{+}","⨥":"\\underset{\\circ}{+}","⨤":"\\overset{\\sim}{+}","⨣":"\\hat{+}","⨢":"\\dot{+}","⨡":"\\upharpoonright","⨠":">>","⨟":"","⨞":"\\triangleleft","⨝":"\\bowtie","⧿":"","⧾":"+","⧻":"\\hcancel{|||}","⧺":"\\hcancel{||}","⧹":"\\backslash","⧸":"/","⧷":"hcancel{\backslash}","⧶":"","⧵":"\\backslash","⧲":"\\Phi","⧱":"","⧰":"","⧮":"","⧭":"","⧬":"","⧫":"\\lozenge","⧪":"","⧩":"","⧨":"","⧧":"\\ddagger","⧢":"\\sqcup\\sqcup","⧡":"","⧠":"\\square","⧞":"","⧝":"","⧜":"","⧛":"\\{\\{","⧙":"\\{","⧘":"\\}","⧗":"","⧖":"","⧕":"\\bowtie","⧔":"\\bowtie","⧓":"\\bowtie","⧒":"\\bowtie","⧑":"\\bowtie","⧐̸":"| \\not\\triangleright","⧐":"| \\triangleright","⧏̸":"\\not\\triangleleft |","⧏":"\\triangleleft |","⧎":"","⧍":"\\triangle","⧌":"","⧋":"\\underline{\\triangle}","⧊":"\\dot{\\triangle}","⧉":"","⧈":"\\boxed{\\circ}","⧇":"\\boxed{\\circ}","⧆":"\\boxed{\\rightarrow}","⧅":"\\bcancel{\\square}","⧄":"\\cancel{\\square}","⧃":"\\odot","⧂":"\\odot","⦿":"\\odot","⦾":"\\odot","⦽":"\\varnothing","⦼":"\\oplus","⦻":"\\otimes","⦺":"","⦹":"\\varnothing","⦸":"\\varnothing","⦷":"\\ominus","⦶":"\\ominus","⦵":"\\ominus","⦴":"\\vec{\\varnothing}","⦳":"\\vec{\\varnothing}","⦲":"\\dot{\\varnothing}","⦱":"\\overline{\\varnothing}","⦰":"\\varnothing","⦯":"\\measuredangle","⦮":"\\measuredangle","⦭":"\\measuredangle","⦬":"\\measuredangle","⦫":"\\measuredangle","⦪":"\\measuredangle","⦩":"\\measuredangle","⦨":"\\measuredangle","⦧":"","⦦":"","⦥":"","⦤":"","⦣":"\\ulcorner","⦢":"\\measuredangle","⦡":"\\not\\lor","⦠":"\\bcancel{>}","⦂":":","⦁":"\\cdot","❘":"\\mid","▲":"\\bigtriangleup","⋿":"\\Epsilon","⋾":"\\overline{\\ni}","⋽":"\\overline{\\ni}","⋼":"\\in","⋻":"\\in","⋺":"\\in","⋹":"\\underline{\\in}","⋸":"\\underline{\\in}","⋷":"\\overline{\\in}","⋶":"\\overline{\\in}","⋵":"\\dot{\\in}","⋴":"\\in","⋳":"\\in","⋲":"\\in","⋰":"\\ddots","։":":","⋩":"\\underset{\\sim}{\\succ}","⋨":"\\underset{\\sim}{\\prec}","⋧":"\\underset{\\not\\sim}{>}","⋦":"\\underset{\\not\\sim}{<}","⋥":"\\not\\sqsupseteq","⋤":"\\not\\sqsubseteq","⋣":"\\not\\sqsupseteq","⋢":"\\not\\sqsubseteq","⋡":"\\nsucc","⋠":"\\nprec","⋟":"\\succ","⋞":"\\prec","⋝":"\\overline{>}","⋜":"\\overline{<}","⋛":"\\underset{>}{\\leq}","⋚":"\\underset{<}{\\geq}","⋕":"\\#","⋓":"\\cup","⋒":"\\cap","⋑":"\\supset","⋐":"\\subset","⋏":"\\wedge","⋎":"\\vee","⋍":"\\simeq","⋈":"\\Join","⋇":"\\ast","⋆":"\\star","⋄":"\\diamond","⊿":"\\triangle","⊾":"\\measuredangle","⊽":"\\overline{\\lor}","⊼":"\\overline{\\land}","⊻":"\\underline{\\lor}","⊺":"\\top",土:"\\pm",十:"+","⊹":"","⊷":"\\circ\\multimap","⊶":"\\circ\\multimap","⊳":"\\triangleright","⊲":"\\triangleleft","⊱":"\\succ","⊰":"\\prec","⊫":"|\\models","⊪":"|\\models","⊧":"\\models","⊦":"\\vdash","⊝":"\\ominus","⊜":"\\ominus","⊛":"\\odot","⊚":"\\odot","⊔":"\\sqcup","⊓":"\\sqcap","⊒":"\\sqsupseteq","⊑":"\\sqsubseteq","⊐̸":"\\not\\sqsupset","⊐":"\\sqsupset","⊏̸":"\\not\\sqsubset","⊏":"\\sqsubset","⊎":"\\cup","⊍":"\\cup","⊌":"\\cup","≿̸":"\\not\\succsim","≿":"\\succsim","≾":"\\precsim","≹":"\\not\\overset{>}{<}","≸":"\\not\\overset{>}{<}","≷":"\\overset{>}{<}","≶":"\\overset{<}{>}","≵":"\\not\\geg","≴":"\\not\\leq","≳":"\\geg","≲":"\\leq","≬":"","≧":"\\geqq","≦̸":"\\not\\leq","≦":"\\leq","≣":"\\overset{=}{=} ","≞":"\\overset{m}{=} ","≝":"\\overset{def}{=}","≘":"=","≖":"=","≕":"=:","≓":"\\doteq","≒":"\\doteq","≑":"\\doteq","≐":"\\doteq","≏̸":"","≏":"","≎̸":"","≎":"","≌":"\\approx","≋":"\\approx","≊":"\\approx","≂̸":"\\neq","≂":"=","∿":"\\sim","∾":"\\infty","∽̱":"\\sim","∽":"\\sim","∻":"\\sim","∺":":-:","∹":"-:","∸":"\\bot","∷":"::","∶":":","∣":"\\mid","∟":"\\llcorner","∘":"\\circ","∗":"*","∕":"/","∎":"\\square","∍":"\\ni","∊":"\\in","∆":"\\Delta","⁄":"/","⪰̸":"\\nsucceq","⪰":"\\succeq","⪯̸":"\\npreceq","⪯":"\\preceq","⪈":"\\ngeqslant","⪇":"\\nleqslant","⧳":"\\Phi","⧦":"\\models","⧥":"\\not\\equiv","⧤":"\\approx\\neq","⧣":"\\neq","⧁":"\\circle","⧀":"\\circle","◦":"\\circle","◗":"\\circle","◖":"\\circle","●":"\\circle","◎":"\\circledcirc","◍":"\\circledcirc","◌":"\\circledcirc","◉":"\\circledcirc","◈":"\\diamond","◇":"\\diamond","◆":"\\diamond","◅":"\\triangleleft","◄":"\\triangleleft","◃":"\\triangleleft","◂":"\\triangleleft","◁":"\\triangleleft","◀":"\\triangleleft","▿":"\\triangledown","▾":"\\triangledown","▽":"\\triangledown","▼":"\\triangledown","▹":"\\triangleright","▸":"\\triangleright","▷":"\\triangleright","▶":"\\triangleright","▵":"\\triangle","▴":"\\triangle","△":"\\triangle","▱":"\\square","▰":"\\blacksquare","▯":"\\square","▮":"\\blacksquare","▭":"\\square","▫":"\\square","▪":"\\square","□":"\\square","■":"\\blacksquare","⋭":"\\not\\triangleright","⋬":"\\not\\triangleleft","⋫":"\\not\\triangleright","⋪":"\\not\\triangleleft","⋙":"\\ggg","⋘":"\\lll","⋗":"*>","⋖":"<*","⋔":"\\pitchfork","⋌":"","⋋":"\\bowtie","⋊":"\\ltimes","⋉":"\\rtimes","⊵":"\\triangleright","\\triangleleft":"","⊥":"\\bot","⊁":"\\nsucc","⊀":"\\preceq","≽":"\\succeq","≼":"\\preceq","≻":"\\succ","≺":"\\prec","≱":"\\geq/","≰":"\\leq/","≭":"\\neq","≫̸":"\\not\\gg","≫":"\\gg","≪̸":"\\not\\ll","≪":"\\ll","≩":"\\ngeqslant","≨":"\\nleqslant","≡":"\\equiv","≟":"\\doteq","≜":"\\triangleq","≛":"\\doteq","≚":"\\triangleq","≙":"\\triangleq","≗":"\\doteq","≔":":=","≍":"\\asymp","≇":"\\ncong","≆":"\\ncong","≅":"\\cong","≄":"\\not\\simeq","≃":"\\simeq","≁":"\\not\\sim","∦":"\\not\\parallel","∥":"\\parallel","∤":"\\not|","∝":"\\propto","==":"==","=":"=",":=":":=","/=":"=","-=":"-=","+=":"+=","*=":"*=","!=":"!=","≠":"\\neq","≢":"\\equiv /","≉":"\\approx /","∼":"\\sim","≈":"\\approx","≮":"</","<":"<","≯":">/",">=":">=",">":">","≥":"\\geq","≤":"\\leq","<=":"<=","⊋":"\\supsetneq","⊊":"\\subsetneq","⊉":"\\nsupseteq","⊈":"\\nsubseteq","⊇":"\\supseteq","⊆":"\\subseteq","⊅":"\\not\\supset","⊄":"\\not\\subset","⊃⃒":"\\supset |","⊃":"\\supset","⊂⃒":"\\subset |","⊂":"\\subset","∌":"\\not\\in","∉":"\\notin","∈":"\\in","∁":"C","∄":"\\nexists","∃":"\\exists","∀":"\\forall","∧":"\\land","&&":"\\&\\&","∨":"\\lor","⊯":"\\cancel{\\vDash}","⊮":"\\cancel{\\Vdash}","⊭":"\\nvDash","⊬":"\\nvDash","⊩":"\\Vdash","⊨":"\\vDash","⊤":"\\top","⊣":"\\dashv","⊢":"\\vdash","∋":"\\ni","⋱":"\\ddots","⋯":"\\hdots","⋮":"\\vdots","϶":"\\ni",":":":","...":"\\cdots","..":"..","->":"->","∵":"\\because","∴":"\\therefore ","":"",",":",",";":";","⧽":"\\}","⧼":"\\{","⦘":"\\]","⦗":"\\[","⦖":"\\ll","⦕":"\\gg","⦔":"\\gg","⦓":"\\ll","⦒":"\\gg","⦑":"\\ll","⦐":"\\]","⦏":"\\]","⦎":"\\]","⦍":"\\[","⦌":"\\[","⦋":"\\]","⦊":"\\triangleright","⦉":"\\triangleleft","⦈":"|\\)","⦇":"\\(|","⦆":"|\\)","⦅":"\\(\\(","⦄":"|\\}","⦃":"\\{|","⦀":"\\||","⟯":"\\left. \\right]","⟮":"\\left[ \\right.","⟭":"\\left. \\right]]","⟬":"\\left[[ \\right.","⟫":"\\gg","⟪":"\\ll","⟧":"\\)|","⟦":"\\(|","❳":"\\left.\\right)","❲":"\\left(\\right.","〉":"\\rangle","〈":"\\langle","⌋":"\\rfloor","⌊":"\\lfloor","⌉":"\\rceil","⌈":"\\lceil","‖":"\\parallel","}":"\\left.\\right\\}","{":"\\left\\{\\right.","]":"\\left]\\right.","[":"\\left[\\right.",")":"\\left.\\right)","(":"\\left(\\right.","”":'\\"',"“":"\\text{``}","’":"'","‘":"`",α:"\\alpha",β:"\\beta",γ:"\\gamma",Γ:"\\Gamma",δ:"\\delta",Δ:"\\Delta","ϵ":"\\epsilon",ζ:"\\zeta",η:"\\eta",θ:"\\theta",Θ:"\\Theta",ι:"\\iota",κ:"\\kappa",λ:"\\lambda",ν:"\\nu",ο:"\\omicron",π:"\\pi",Π:"\\Pi",ρ:"\\rho",σ:"\\sigma",Σ:"\\Sigma",τ:"\\tau",υ:"\\upsilon",Υ:"\\Upsilon",ϕ:"\\phi",Φ:"\\Phi",χ:"\\chi",ψ:"\\psi",Ψ:"\\Psi",ω:"\\omega",Ω:"\\Omega",Ω:"\\Omega","∅":"\\emptyset","⟲":"\\circlearrowleft","⟳":"\\circlearrowright","×":"\\times","½":"\\dfrac{1}{2}",μ:"\\mu",Ө:"\\theta","✓":"\\checkmark","⟩":"\\rangle","⟨":"\\langle","¼":"\\dfrac{1}{4}","…":"\\ldots",ℏ:"\\hbar",ℜ:"\\mathfrak{R}",Ѳ:"\\theta",Ø:"\\emptyset",ϱ:"\\varrho",ф:"\\phi",ℇ:"\\varepsilon",T:"T","∙":"\\cdot",Ρ:"P","∞":"\\infty",ᐁ:"\\nabla",ƞ:"\\eta","⁺":"^{+}","⁻":"^{-}","⁼":"^{=}","⁽":"^{(}","⁾":"^{)}","〗":"\\)|","〖":"\\langle",";":";","൦":"\\circ","┴":"\\perp","✕":"\\times","⎻":"-","»":"\\gg","⬆":"\\uparrow","⬇":"\\downarrow","⬅":"\\leftarrow","➡":"\\rightarrow","⎼":"-","⎜":"\\mid","⎥":"\\mid",ħ:"\\hbar","⮕":"\\rightarrow","・":"\\cdot","¦":"\\mid","£":"\\pounds","¥":"\\yen","✗":"\\times","✔":"\\checkmark",ⁿ:"^{n}","«":"\\ll",เ:"\\prime","†":"\\dagger","│":"\\mid",$:"\\$","#":"\\#","℃":"\\text{\\textdegree C}","℉":"\\text{\\textdegree F}","█":"\\blacksquare","℧":"\\mho","ⅇ":"\\text{e}",ɼ:"r","‡":"\\ddagger",ἱ:"i",ϒ:"\\Upsilon","𝛿":"\\delta","˳":"\\cdot",ѳ:"\\theta","𝜙":"\\phi",П:"\\prod",о:"o",ђ:"\\hbar","Ʌ":"\\Lambda","।":"\\mid","€":"\\euro",ῡ:"\\bar{u}",φ:"\\varphi","ȼ":"c","𝞮":"\\epsilon",Χ:"\\mathsf{X}","ₙ":"_{n}"},Lb={" ":"\\textrm{ }","∃":"\\exists","∀":"\\forall","⇔":"\\iff","⇒":"=>","¬":"\\neg","ℤ":"\\mathbb{Z}","ℝ":"\\mathbb{R}","ℚ":"\\mathbb{Q}","ℕ":"\\mathbb{N}","ℂ":"CC","□":"\\square","⋄":"\\diamond","△":"\\triangle","⌢":"\\frown","∠":"\\angle","⋱":"\\ddots","⋮":"\\vdots","∵":"\\because","∴":"\\therefore","ℵ":"\\aleph","∅":"\\oslash","±":"\\pm","∇":"\\nabla","∂":"\\partial","∮":"\\oint","∫":"\\int","⋃":"\\cup","∪":"\\cup","⋂":"\\cap","∩":"\\cap","⋁":"\\vee","∨":"\\vee","⋀":"\\wedge","∧":"\\wedge","∏":"\\prod","∑":"\\sum","⊙":"\\bigodot","⊗":"\\bigoplus","⊕":"o+","∘":"@","⋈":"\\bowtie","⋊":"\\rtimes","⋉":"\\ltimes","÷":"\\div","×":"\\times","\\":"\\backslash","⋆":"\\star","∗":"\\star","⋅":"\\cdot","Ω":"\\Omega","ω":"\\omega","Ψ":"\\Psi","ψ":"\\psi","χ":"\\chi","φ":"\\varphi","Φ":"\\Phi","ϕ":"\\phi","υ":"\\upsilon","τ":"\\tau","Σ":"\\Sigma","σ":"\\sigma","ρ":"\\rho","Π":"\\Pi","π":"\\pi","Ξ":"\\Xi","ξ":"\\xi","ν":"\\nu","μ":"\\mu","Λ":"\\Lambda","λ":"\\lambda","κ":"\\kappa","ι":"\\iota","ϑ":"\\vartheta","Θ":"\\Theta","θ":"\\theta","η":"\\eta","ζ":"\\zeta","ɛ":"\\varepsilon","ε":"\\epsilon","Δ":"\\Delta","δ":"\\delta","Γ":"\\Gamma","γ":"\\gamma","β":"\\beta","α":"\\alpha","∞":"\\infty","":"\\text{\\textdir TRT}","":"\\text{\\textdir LTR}"},Ob={" ":"\\textrm{ }","":"","":"","":"","":"","∃":"\\exists","∀":"\\forall","⇔":"\\iff","⇒":"\\Rightarrow","¬":"\\neg","□":"\\square","⋄":"\\diamond","△":"\\triangle","⌢":"\\frown","∠":"\\angle","⋱":"\\ddots","⋮":"\\vdots","∵":"\\because","∴":"\\therefore",ℵ:"\\aleph","∅":"\\emptyset","±":"\\pm","∇":"\\nabla","∂":"\\partial","∮":"\\oint","∫":"\\int","⋃":"\\cup","∪":"\\cup","⋂":"\\cap","∩":"\\cap","⋁":"\\vee","∨":"\\vee","⋀":"\\wedge","∧":"\\wedge","∏":"\\prod","∑":"\\sum","⊙":"\\bigodot","⊗":"\\bigoplus","⊕":"o+","∘":"@","⋈":"\\bowtie","⋊":"\\rtimes","⋉":"\\ltimes","÷":"\\div","×":"\\times","\\":"\\backslash","⋆":"\\star","∗":"\\star","⋅":"\\cdot",Ω:"\\Omega",ω:"\\omega",Ψ:"\\Psi",ψ:"\\psi",χ:"\\chi",φ:"\\varphi",Φ:"\\Phi",ϕ:"\\phi",υ:"\\upsilon",τ:"\\tau",Σ:"\\Sigma",σ:"\\sigma",ρ:"\\rho",Π:"\\Pi",π:"\\pi",Ξ:"\\Xi",ξ:"\\xi",ν:"\\nu",μ:"\\mu",Λ:"\\Lambda",λ:"\\lambda",κ:"\\kappa",ι:"\\iota",ϑ:"\\vartheta",Θ:"\\Theta",θ:"\\theta",η:"\\eta",ζ:"\\zeta",ɛ:"\\varepsilon",ε:"\\epsilon",Δ:"\\Delta",δ:"\\delta",Γ:"\\Gamma",γ:"\\gamma",β:"\\beta",α:"\\alpha","∞":"\\infty","ϵ":"\\epsilon",µ:"\\mu","²":"^{2}",ı:"\\imath","∎":"\\blacksquare",ม:"\\mathbf{m}",Ω:"\\Omega","⟲":"\\circlearrowleft","⟳":"\\circlearrowright",त:" ","¥":"\\yen","⁽":"^{(}","⁾":"^{)}",ß:"\\ss",Ћ:"\\hbar","⦵":"\\ominus","⊿":"\\bigtriangleup","↛'":"\\nrightarrow","†":"\\dagger",เ:"\\prime",白:" ","⿱":" ",ℸ:"\\wp",퓰:" ",ⁿ:"^{n}","✔":"\\checkmark","✗":"\\times","½":"\\dfrac{1}{2}",Ө:"\\theta","✓":"\\checkmark","⟩":"\\rangle","⟨":"\\langle","〈":"\\langle","¼":"\\dfrac{1}{4}","…":"\\ldots",ℏ:"\\hbar",ℜ:"\\mathfrak{R}",Ѳ:"\\theta",Ø:"\\emptyset",ϱ:"\\varrho",ф:"\\phi",T:"T","∙":"\\cdot",Ρ:"P",ᐁ:"\\nabla",ƞ:"\\eta",ɣ:"\\gamma",ћ:"\\hbar",Ɛ:"\\varepsilon","ⅅ":"\\_{D}","𝜆":"\\lambda","〗":"\\rangle","〖":"\\langle",";":";","𝑥":"x","𝑦":"y","𝑧":"z","𝑖":"i","𝑗":"j","𝑘":"k","𝑚":"m","𝑒":"e","𝑟":"r",ɳ:"\\eta","𝛽":"\\beta","⍵":"\\omega","℘":"\\wp","𝜋":"\\pi",Є:"\\epsilon",є:"\\epsilon","𝜀":"\\epsilon",п:"\\pi",Ν:"\\nu",ɵ:"\\theta","𝜓":"\\psi","ϴ":"\\theta",ɸ:"\\phi","Ӷ":"\\Gamma",ɭ:"\\ell",ʋ:"\\upsilon","𝛟":"\\varphi","⍬":"\\theta",Ф:"\\Phi","𝜑":"\\varphi","ⅈ":"i",ο:"o",ơ:"o",ƒ:"f","⍴":"\\rho","🇽":"x","𝑝":"p","𝑞":"q","𝑠":"s","𝑡":"t","𝑢":"u","𝑣":"v","𝑤":"w","𝑎":"a","𝑏":"b","𝑐":"c","𝑑":"d","𝑓":"f","𝑔":"g","𝑙":"l","𝑛":"n","𝑜":"o","𝔀":"w","𝚟":"v",ṁ:"m","൦":"\\circ","┴":"\\perp","✕":"\\times","∣":"\\mid",Փ:"\\Phi","⎜":"\\mid",ħ:"\\hbar",ፈ:" ","⦨":"\\llbracket",ế:"\\hat{e}","¢":"\\cent","⤹":"\\downarrow","⤸":"\\downarrow","⤷":"\\Rsh","⤶":"\\Lsh","⤵":"\\downarrow","⤴":"\\uparrow","⤳":"\\rightarrow","|":"\\mid","⎥":"\\mid","♥":"\\heartsuit",О:"0",Υ:"Y",х:"x","𝓏":"z","𝓎":"y","𝓍":"x",р:"p",а:"a","£":"\\pounds",m:"m","𝚵":"\\Xi","⓪":"\\textcircled{0}","①":"\\textcircled{1}","②":"\\textcircled{2}","③":"\\textcircled{3}","④":"\\textcircled{4}","⑤":"\\textcircled{5}","⑥":"\\textcircled{6}","⑦":"\\textcircled{7}","⑧":"\\textcircled{8}","⑨":"\\textcircled{9}","⑩":"\\textcircled{10}","⑪":"\\textcircled{11}","⑫":"\\textcircled{12}","⑬":"\\textcircled{13}","⑭":"\\textcircled{14}","⑮":"\\textcircled{15}","⑯":"\\textcircled{16}","⑰":"\\textcircled{17}","⑱":"\\textcircled{18}","⑲":"\\textcircled{19}","⑳":"\\textcircled{20}","㉑":"\\textcircled{21}","㉒":"\\textcircled{22}","㉓":"\\textcircled{23}","㉔":"\\textcircled{24}","㉕":"\\textcircled{25}","㉖":"\\textcircled{26}","㉗":"\\textcircled{27}","㉘":"\\textcircled{28}","㉙":"\\textcircled{29}","㉚":"\\textcircled{30}","㉛":"\\textcircled{31}","㉜":"\\textcircled{32}","㉝":"\\textcircled{33}","㉞":"\\textcircled{34}","㉟":"\\textcircled{35}","㊱":"\\textcircled{36}","㊲":"\\textcircled{37}","㊳":"\\textcircled{38}","㊴":"\\textcircled{39}","㊵":"\\textcircled{40}","㊶":"\\textcircled{41}","㊷":"\\textcircled{42}","㊸":"\\textcircled{43}","㊹":"\\textcircled{44}","㊺":"\\textcircled{45}","㊻":"\\textcircled{46}","㊼":"\\textcircled{47}","㊽":"\\textcircled{48}","㊾":"\\textcircled{49}","㊿":"\\textcircled{50}","&":"\\&","‖":"\\parallel","%":"\\%","“":"\\text{``}",$:"\\$","#":"\\#","℃":"\\text{\\textdegree C}","℉":"\\text{\\textdegree F}","█":"\\blacksquare","℧":"\\mho","⌋":"\\rfloor","⌊":"\\lfloor","⌉":"\\rceil","⌈":"\\lceil",ℇ:"\\varepsilon","ⅇ":"\\text{e}",ɼ:"r","↛":"\\nrightarrow","ˆ":"\\hat{}","‾":"\\overline","→":"\\rightarrow","‡":"\\ddagger","・":"\\cdot","▱":"\\square","∆":"\\Delta",ἱ:"i","∡":"\\angle",ϒ:"\\Upsilon","↓":"\\downarrow","↑":"\\uparrow","»":"\\gg","⊤":"\\top","⧸":"/","𝛿":"\\delta","˳":"\\cdot","։":":","⦪":"\\measuredangle","⦩":"\\measuredangle","⦫":"\\measuredangle","⦁":"\\cdot",ѳ:"\\theta","⦢":"\\measuredangle","¸":",","⎻":"\\overline","⟦":"\\llbracket","𝜙":"\\phi",П:"\\prod",о:"o","≈":"\\approx","≤":"\\leq",ђ:"\\hbar","Ʌ":"\\Lambda",土:"\\pm","⎼":"-",十:"+","≠":"\\neq","←":"\\leftarrow","।":"\\mid","€":"\\euro","˘":" ",ῡ:"\\bar{u}","∥":"\\parallel","↔":"\\leftrightarrow","√":"\\sqrt{}","ȼ":"c","𝞮":"\\epsilon","·":"\\cdot","⦬":"\\measuredangle","⦮":"\\measuredangle","⦭":"\\measuredangle","«":"\\ll",Χ:"\\mathsf{X}","│":"\\mid","〉":"\\rangle","ₙ":"_{n}","▫":"\\square","●":"\\circle","”":'\\"'},Ws=new Set(["||","‖","∥"]),Rb=["\\hat","\\bar","\\underbrace","\\overbrace"],Vs={"₀":"_{0}","₁":"_{1}","₂":"_{2}","₃":"_{3}","₄":"_{4}","₅":"_{5}","₆":"_{6}","₇":"_{7}","₈":"_{8}","₉":"_{9}","⁰":"^{0}","¹":"^{1}","²":"^{2}","³":"^{3}","⁴":"^{4}","⁵":"^{5}","⁶":"^{6}","⁷":"^{7}","⁸":"^{8}","⁹":"^{9}",ⁿ:"^{n}","ₙ":"_{n}","⓪":"\\textcircled{0}","①":"\\textcircled{1}","②":"\\textcircled{2}","③":"\\textcircled{3}","④":"\\textcircled{4}","⑤":"\\textcircled{5}","⑥":"\\textcircled{6}","⑦":"\\textcircled{7}","⑧":"\\textcircled{8}","⑨":"\\textcircled{9}","⑩":"\\textcircled{10}","⑪":"\\textcircled{11}","⑫":"\\textcircled{12}","⑬":"\\textcircled{13}","⑭":"\\textcircled{14}","⑮":"\\textcircled{15}","⑯":"\\textcircled{16}","⑰":"\\textcircled{17}","⑱":"\\textcircled{18}","⑲":"\\textcircled{19}","⑳":"\\textcircled{20}","㉑":"\\textcircled{21}","㉒":"\\textcircled{22}","㉓":"\\textcircled{23}","㉔":"\\textcircled{24}","㉕":"\\textcircled{25}","㉖":"\\textcircled{26}","㉗":"\\textcircled{27}","㉘":"\\textcircled{28}","㉙":"\\textcircled{29}","㉚":"\\textcircled{30}","㉛":"\\textcircled{31}","㉜":"\\textcircled{32}","㉝":"\\textcircled{33}","㉞":"\\textcircled{34}","㉟":"\\textcircled{35}","㊱":"\\textcircled{36}","㊲":"\\textcircled{37}","㊳":"\\textcircled{38}","㊴":"\\textcircled{39}","㊵":"\\textcircled{40}","㊶":"\\textcircled{41}","㊷":"\\textcircled{42}","㊸":"\\textcircled{43}","㊹":"\\textcircled{44}","㊺":"\\textcircled{45}","㊻":"\\textcircled{46}","㊼":"\\textcircled{47}","㊽":"\\textcircled{48}","㊾":"\\textcircled{49}","㊿":"\\textcircled{50}","½":"\\dfrac{1}{2}","⅓":"\\dfrac{1}{3}","⅔":"\\dfrac{2}{3}","¼":"\\dfrac{1}{4}","¾":"\\dfrac{3}{4}","⅕":"\\dfrac{1}{5}","⅖":"\\dfrac{2}{5}","⅗":"\\dfrac{3}{5}","⅘":"\\dfrac{4}{5}","⅙":"\\dfrac{1}{6}","⅚":"\\dfrac{5}{6}","⅐":"\\dfrac{1}{7}","⅛":"\\dfrac{1}{8}","⅜":"\\dfrac{3}{8}","⅝":"\\dfrac{5}{8}","⅞":"\\dfrac{7}{8}","⅑":"\\dfrac{1}{9}","⅒":"\\dfrac{1}{10}"};class Zs{convert(e){if(e.match(/[a-z0-9]/i))return e;const n=Ib[e];if(n){const i=this.convertAccentCharToLtX(n);return i||e}const o=this.convertSpecialCharToLtX(e);return o||e}convertAccentCharToLtX(e){const{char:r,accent:n}=e,o=Mb[n];return o?`\\${o}{${r}}`:null}convertSpecialCharToLtX(e){const r=$b[e];if(!r)return null;const{letter:n,fontCmd:o}=r;return`\\${o}{${n}}`}}const Ib={á:{char:"a",accent:"´"},à:{char:"a",accent:"`"},â:{char:"a",accent:"^"},ã:{char:"a",accent:"~"},ä:{char:"a",accent:"¨"},å:{char:"a",accent:"˚"},ą:{char:"a",accent:"˙"},ă:{char:"a",accent:"˘"},ǎ:{char:"a",accent:"ˇ"},ǟ:{char:"a",accent:"ˆ"},ǻ:{char:"a",accent:"˙"},ǡ:{char:"a",accent:"-"},ā:{char:"a",accent:"-"},é:{char:"e",accent:"´"},è:{char:"e",accent:"`"},ê:{char:"e",accent:"^"},ë:{char:"e",accent:"¨"},ę:{char:"e",accent:"˙"},ě:{char:"e",accent:"ˇ"},ȇ:{char:"i",accent:"^"},ё:{char:"e",accent:"¨"},ē:{char:"e",accent:"-"},í:{char:"i",accent:"´"},ì:{char:"i",accent:"`"},î:{char:"i",accent:"^"},ï:{char:"i",accent:"¨"},į:{char:"i",accent:"˙"},ǐ:{char:"i",accent:"ˇ"},ȉ:{char:"i",accent:"`"},ȋ:{char:"i",accent:"¨"},ī:{char:"i",accent:"-"},ó:{char:"o",accent:"´"},ò:{char:"o",accent:"`"},ô:{char:"o",accent:"^"},õ:{char:"o",accent:"~"},ö:{char:"o",accent:"¨"},ő:{char:"o",accent:"˝"},ǒ:{char:"o",accent:"ˇ"},ȍ:{char:"o",accent:"`"},ȏ:{char:"o",accent:"¨"},ȫ:{char:"o",accent:"˘"},ȭ:{char:"o",accent:"˝"},ȯ:{char:"o",accent:"˙"},ō:{char:"o",accent:"-"},ú:{char:"u",accent:"´"},ù:{char:"u",accent:"`"},û:{char:"u",accent:"^"},ü:{char:"u",accent:"¨"},ű:{char:"u",accent:"˝"},ǔ:{char:"u",accent:"ˇ"},ǖ:{char:"u",accent:"¨"},ǘ:{char:"u",accent:"¨"},ǚ:{char:"u",accent:"¨"},ǜ:{char:"u",accent:"¨"},ȕ:{char:"u",accent:"`"},ȗ:{char:"u",accent:"¨"},ū:{char:"u",accent:"-"},ý:{char:"y",accent:"´"},ỳ:{char:"y",accent:"`"},ŷ:{char:"y",accent:"^"},ÿ:{char:"y",accent:"¨"},ȳ:{char:"y",accent:"-"},Á:{char:"A",accent:"´"},À:{char:"A",accent:"`"},Â:{char:"A",accent:"^"},Ã:{char:"A",accent:"~"},Ä:{char:"A",accent:"¨"},Å:{char:"A",accent:"˚"},Å:{char:"A",accent:"˚"},Ȧ:{char:"A",accent:"˙"},Ă:{char:"A",accent:"˘"},Ǎ:{char:"A",accent:"ˇ"},Ǟ:{char:"A",accent:"˝"},Ǻ:{char:"A",accent:"˚"},Ǡ:{char:"A",accent:"-"},Ā:{char:"A",accent:"-"},É:{char:"E",accent:"´"},È:{char:"E",accent:"`"},Ė:{char:"E",accent:"˙"},Ê:{char:"E",accent:"^"},Ë:{char:"E",accent:"¨"},Ě:{char:"E",accent:"ˇ"},Ȅ:{char:"E",accent:"`"},Ȇ:{char:"E",accent:"¨"},Ē:{char:"E",accent:"-"},Í:{char:"I",accent:"´"},Ì:{char:"I",accent:"`"},Î:{char:"I",accent:"^"},Ï:{char:"I",accent:"¨"},Ĭ:{char:"I",accent:"˘"},Ǐ:{char:"I",accent:"ˇ"},Ȉ:{char:"I",accent:"`"},Ȋ:{char:"I",accent:"¨"},Ī:{char:"I",accent:"-"},Ó:{char:"O",accent:"´"},Ò:{char:"O",accent:"`"},Ô:{char:"O",accent:"^"},Õ:{char:"O",accent:"~"},Ö:{char:"O",accent:"¨"},Ő:{char:"O",accent:"˝"},Ǒ:{char:"O",accent:"ˇ"},Ȍ:{char:"O",accent:"`"},Ȏ:{char:"O",accent:"¨"},Ȫ:{char:"O",accent:"˘"},Ȭ:{char:"O",accent:"˝"},Ȯ:{char:"O",accent:"˙"},Ō:{char:"O",accent:"-"},Ú:{char:"U",accent:"´"},Ù:{char:"U",accent:"`"},Û:{char:"U",accent:"^"},Ü:{char:"U",accent:"¨"},Ű:{char:"U",accent:"˝"},Ǔ:{char:"U",accent:"ˇ"},Ǖ:{char:"U",accent:"¨"},Ȕ:{char:"U",accent:"`"},Ȗ:{char:"U",accent:"¨"},Ū:{char:"U",accent:"-"},Ý:{char:"Y",accent:"´"},Ỳ:{char:"Y",accent:"`"},Ŷ:{char:"Y",accent:"^"},Ÿ:{char:"Y",accent:"¨"},Ȳ:{char:"Y",accent:"-"},ñ:{char:"n",accent:"~"},Ñ:{char:"N",accent:"~"},ç:{char:"c",accent:"˙"},Ç:{char:"C",accent:"˙"},ṽ:{char:"v",accent:"~"},Ṽ:{char:"V",accent:"~"},ĵ:{char:"j",accent:"^"},Ĵ:{char:"J",accent:"^"},ź:{char:"z",accent:"´"},Ź:{char:"Z",accent:"´"},Ż:{char:"Z",accent:"^"},ż:{char:"z",accent:"^"},Ž:{char:"Z",accent:"ˇ"},ž:{char:"z",accent:"ˇ"},ẑ:{char:"z",accent:"ˆ"}},Mb={"´":"acute","`":"grave","^":"hat","~":"tilde","¨":"ddot","˚":"mathring","˘":"breve","ˇ":"check","˝":"H","˙":"dot","-":"bar","ˆ":"hat","˜":"tilde"},$b={"𝐀":{letter:"A",fontCmd:"mathbf"},"𝐁":{letter:"B",fontCmd:"mathbf"},"𝐂":{letter:"C",fontCmd:"mathbf"},"𝐃":{letter:"D",fontCmd:"mathbf"},"𝐄":{letter:"E",fontCmd:"mathbf"},Ε:{letter:"E",fontCmd:"mathbf"},"𝐅":{letter:"F",fontCmd:"mathbf"},"𝐆":{letter:"G",fontCmd:"mathbf"},"𝐇":{letter:"H",fontCmd:"mathbf"},"𝐈":{letter:"I",fontCmd:"mathbf"},"𝐉":{letter:"J",fontCmd:"mathbf"},"𝐊":{letter:"K",fontCmd:"mathbf"},"𝐋":{letter:"L",fontCmd:"mathbf"},"𝐌":{letter:"M",fontCmd:"mathbf"},"𝐍":{letter:"N",fontCmd:"mathbf"},"𝐎":{letter:"O",fontCmd:"mathbf"},"𝐏":{letter:"P",fontCmd:"mathbf"},"𝐐":{letter:"Q",fontCmd:"mathbf"},"𝐑":{letter:"R",fontCmd:"mathbf"},"𝐒":{letter:"S",fontCmd:"mathbf"},"𝐓":{letter:"T",fontCmd:"mathbf"},"𝐔":{letter:"U",fontCmd:"mathbf"},"𝐕":{letter:"V",fontCmd:"mathbf"},"𝐖":{letter:"W",fontCmd:"mathbf"},"𝐗":{letter:"X",fontCmd:"mathbf"},"𝞆":{letter:"X",fontCmd:"mathbf"},"𝐘":{letter:"Y",fontCmd:"mathbf"},"𝐙":{letter:"Z",fontCmd:"mathbf"},"𝟎":{letter:"0",fontCmd:"mathbf"},"𝟏":{letter:"1",fontCmd:"mathbf"},"𝟐":{letter:"2",fontCmd:"mathbf"},"𝟑":{letter:"3",fontCmd:"mathbf"},"𝟒":{letter:"4",fontCmd:"mathbf"},"𝟓":{letter:"5",fontCmd:"mathbf"},"𝟔":{letter:"6",fontCmd:"mathbf"},"𝟕":{letter:"7",fontCmd:"mathbf"},"𝟖":{letter:"8",fontCmd:"mathbf"},"𝟗":{letter:"9",fontCmd:"mathbf"},"𝐴":{letter:"A",fontCmd:"mathit"},"𝐵":{letter:"B",fontCmd:"mathit"},"𝐶":{letter:"C",fontCmd:"mathit"},"𝐷":{letter:"D",fontCmd:"mathit"},"𝐸":{letter:"E",fontCmd:"mathit"},"𝐹":{letter:"F",fontCmd:"mathit"},"𝐺":{letter:"G",fontCmd:"mathit"},"𝐻":{letter:"H",fontCmd:"mathit"},"𝐼":{letter:"I",fontCmd:"mathit"},Ι:{letter:"I",fontCmd:"mathit"},"𝐽":{letter:"J",fontCmd:"mathit"},"𝐾":{letter:"K",fontCmd:"mathit"},"𝐿":{letter:"L",fontCmd:"mathit"},"𝑀":{letter:"M",fontCmd:"mathit"},"𝑁":{letter:"N",fontCmd:"mathit"},"𝑂":{letter:"O",fontCmd:"mathit"},"𝑃":{letter:"P",fontCmd:"mathit"},"𝑄":{letter:"Q",fontCmd:"mathit"},"𝑅":{letter:"R",fontCmd:"mathit"},"𝑆":{letter:"S",fontCmd:"mathit"},"𝑇":{letter:"T",fontCmd:"mathit"},"𝑈":{letter:"U",fontCmd:"mathit"},"𝑉":{letter:"V",fontCmd:"mathit"},"𝑊":{letter:"W",fontCmd:"mathit"},"𝑋":{letter:"X",fontCmd:"mathit"},"𝑌":{letter:"Y",fontCmd:"mathit"},"𝑍":{letter:"Z",fontCmd:"mathit"},"𝔸":{letter:"A",fontCmd:"mathbb"},"𝔹":{letter:"B",fontCmd:"mathbb"},ℂ:{letter:"C",fontCmd:"mathbb"},"𝔻":{letter:"D",fontCmd:"mathbb"},"𝔼":{letter:"E",fontCmd:"mathbb"},"𝔽":{letter:"F",fontCmd:"mathbb"},"𝔾":{letter:"G",fontCmd:"mathbb"},ℍ:{letter:"H",fontCmd:"mathbb"},"𝕀":{letter:"I",fontCmd:"mathbb"},"𝕁":{letter:"J",fontCmd:"mathbb"},"𝕂":{letter:"K",fontCmd:"mathbb"},"𝕃":{letter:"L",fontCmd:"mathbb"},"𝕄":{letter:"M",fontCmd:"mathbb"},ℕ:{letter:"N",fontCmd:"mathbb"},"𝕆":{letter:"O",fontCmd:"mathbb"},ℙ:{letter:"P",fontCmd:"mathbb"},ℚ:{letter:"Q",fontCmd:"mathbb"},ℝ:{letter:"R",fontCmd:"mathbb"},"𝕊":{letter:"S",fontCmd:"mathbb"},"𝕋":{letter:"T",fontCmd:"mathbb"},"𝕌":{letter:"U",fontCmd:"mathbb"},"𝕍":{letter:"V",fontCmd:"mathbb"},"𝕎":{letter:"W",fontCmd:"mathbb"},"𝕏":{letter:"X",fontCmd:"mathbb"},"𝕐":{letter:"Y",fontCmd:"mathbb"},ℤ:{letter:"Z",fontCmd:"mathbb"},"𝟘":{letter:"0",fontCmd:"mathbb"},"𝟙":{letter:"1",fontCmd:"mathbb"},"𝟚":{letter:"2",fontCmd:"mathbb"},"𝟛":{letter:"3",fontCmd:"mathbb"},"𝟜":{letter:"4",fontCmd:"mathbb"},"𝟝":{letter:"5",fontCmd:"mathbb"},"𝟞":{letter:"6",fontCmd:"mathbb"},"𝟟":{letter:"7",fontCmd:"mathbb"},"𝟠":{letter:"8",fontCmd:"mathbb"},"𝟡":{letter:"9",fontCmd:"mathbb"},"𝒜":{letter:"A",fontCmd:"mathcal"},"𝓐":{letter:"A",fontCmd:"mathcal"},ℬ:{letter:"B",fontCmd:"mathcal"},"𝒞":{letter:"C",fontCmd:"mathcal"},"𝒟":{letter:"D",fontCmd:"mathcal"},"𝓓":{letter:"D",fontCmd:"mathcal"},ℰ:{letter:"E",fontCmd:"mathcal"},ℱ:{letter:"F",fontCmd:"mathcal"},"𝓕":{letter:"F",fontCmd:"mathcal"},"𝒢":{letter:"G",fontCmd:"mathcal"},ℋ:{letter:"H",fontCmd:"mathcal"},ℐ:{letter:"I",fontCmd:"mathcal"},"𝒥":{letter:"J",fontCmd:"mathcal"},"𝒦":{letter:"K",fontCmd:"mathcal"},ℒ:{letter:"L",fontCmd:"mathcal"},"𝓛":{letter:"L",fontCmd:"mathcal"},ℳ:{letter:"M",fontCmd:"mathcal"},"𝒩":{letter:"N",fontCmd:"mathcal"},"𝒪":{letter:"O",fontCmd:"mathcal"},"𝓞":{letter:"O",fontCmd:"mathcal"},"𝒫":{letter:"P",fontCmd:"mathcal"},"𝒬":{letter:"Q",fontCmd:"mathcal"},ℛ:{letter:"R",fontCmd:"mathcal"},"𝕽":{letter:"R",fontCmd:"mathcal"},"℟":{letter:"R",fontCmd:"mathcal"},"𝒮":{letter:"S",fontCmd:"mathcal"},"𝒯":{letter:"T",fontCmd:"mathcal"},"𝒰":{letter:"U",fontCmd:"mathcal"},"𝒱":{letter:"V",fontCmd:"mathcal"},"𝒲":{letter:"W",fontCmd:"mathcal"},"𝒳":{letter:"X",fontCmd:"mathcal"},"𝒴":{letter:"Y",fontCmd:"mathcal"},"𝒵":{letter:"Z",fontCmd:"mathcal"},"𝔄":{letter:"A",fontCmd:"mathfrak"},"𝔅":{letter:"B",fontCmd:"mathfrak"},ℭ:{letter:"C",fontCmd:"mathfrak"},"𝔇":{letter:"D",fontCmd:"mathfrak"},"𝔈":{letter:"E",fontCmd:"mathfrak"},"𝔉":{letter:"F",fontCmd:"mathfrak"},"𝔊":{letter:"G",fontCmd:"mathfrak"},ℌ:{letter:"H",fontCmd:"mathfrak"},ℑ:{letter:"I",fontCmd:"mathfrak"},"𝔍":{letter:"J",fontCmd:"mathfrak"},"𝔎":{letter:"K",fontCmd:"mathfrak"},"𝔏":{letter:"L",fontCmd:"mathfrak"},"𝔐":{letter:"M",fontCmd:"mathfrak"},"𝔑":{letter:"N",fontCmd:"mathfrak"},"𝔒":{letter:"O",fontCmd:"mathfrak"},"𝔓":{letter:"P",fontCmd:"mathfrak"},"𝔔":{letter:"Q",fontCmd:"mathfrak"},ℜ:{letter:"R",fontCmd:"mathfrak"},"𝔖":{letter:"S",fontCmd:"mathfrak"},"𝔗":{letter:"T",fontCmd:"mathfrak"},"𝔘":{letter:"U",fontCmd:"mathfrak"},"𝔙":{letter:"V",fontCmd:"mathfrak"},"𝔚":{letter:"W",fontCmd:"mathfrak"},"𝔛":{letter:"X",fontCmd:"mathfrak"},"𝔜":{letter:"Y",fontCmd:"mathfrak"},ℨ:{letter:"Z",fontCmd:"mathfrak"},"𝖠":{letter:"A",fontCmd:"mathsf"},Α:{letter:"A",fontCmd:"mathsf"},"𝖡":{letter:"B",fontCmd:"mathsf"},Β:{letter:"B",fontCmd:"mathsf"},"𝖢":{letter:"C",fontCmd:"mathsf"},"𝖣":{letter:"D",fontCmd:"mathsf"},"𝖤":{letter:"E",fontCmd:"mathsf"},"𝖥":{letter:"F",fontCmd:"mathsf"},"𝖦":{letter:"G",fontCmd:"mathsf"},"𝖧":{letter:"H",fontCmd:"mathsf"},"𝖨":{letter:"I",fontCmd:"mathsf"},"𝖩":{letter:"J",fontCmd:"mathsf"},"ȷ":{letter:"J",fontCmd:"mathsf"},"𝖪":{letter:"K",fontCmd:"mathsf"},Κ:{letter:"K",fontCmd:"mathsf"},"𝖫":{letter:"L",fontCmd:"mathsf"},"𝖬":{letter:"M",fontCmd:"mathsf"},"𝖭":{letter:"N",fontCmd:"mathsf"},"𝖮":{letter:"O",fontCmd:"mathsf"},"𝖯":{letter:"P",fontCmd:"mathsf"},"𝖰":{letter:"Q",fontCmd:"mathsf"},"𝖱":{letter:"R",fontCmd:"mathsf"},"𝖲":{letter:"S",fontCmd:"mathsf"},"𝖳":{letter:"T",fontCmd:"mathsf"},"𝖴":{letter:"U",fontCmd:"mathsf"},"𝖵":{letter:"V",fontCmd:"mathsf"},"𝖶":{letter:"W",fontCmd:"mathsf"},"𝖷":{letter:"X",fontCmd:"mathsf"},Χ:{letter:"X",fontCmd:"mathsf"},"𝖸":{letter:"Y",fontCmd:"mathsf"},"𝖹":{letter:"Z",fontCmd:"mathsf"},"𝚨":{letter:"A",fontCmd:"mathtt"},"𝚩":{letter:"B",fontCmd:"mathtt"},"𝚪":{letter:"\\Gamma",fontCmd:"mathtt"},"𝚫":{letter:"\\Delta",fontCmd:"mathtt"},"𝚬":{letter:"E",fontCmd:"mathtt"},"𝚭":{letter:"F",fontCmd:"mathtt"},"𝚮":{letter:"G",fontCmd:"mathtt"},"𝚯":{letter:"\\Theta",fontCmd:"mathtt"},"𝚰":{letter:"I",fontCmd:"mathtt"},"𝚱":{letter:"J",fontCmd:"mathtt"},"𝚲":{letter:"\\Lambda",fontCmd:"mathtt"},"𝚳":{letter:"L",fontCmd:"mathtt"},"𝚴":{letter:"M",fontCmd:"mathtt"},"𝚵":{letter:"\\Pi",fontCmd:"mathtt"},"𝚶":{letter:"O",fontCmd:"mathtt"},"𝚷":{letter:"\\Pi",fontCmd:"mathtt"},"𝚸":{letter:"Q",fontCmd:"mathtt"},"𝚹":{letter:"R",fontCmd:"mathtt"},"𝚺":{letter:"S",fontCmd:"mathtt"},"𝚻":{letter:"T",fontCmd:"mathtt"},"𝚼":{letter:"U",fontCmd:"mathtt"},"𝚽":{letter:"\\Phi",fontCmd:"mathtt"},"𝚾":{letter:"W",fontCmd:"mathtt"},"𝚿":{letter:"\\Psi",fontCmd:"mathtt"},"𝛀":{letter:"\\Omega",fontCmd:"mathtt"}};class Du{constructor(e,r){this._open="\\left"+this._toLatexDelimiter(e),this._close="\\right"+this._toLatexDelimiter(r)}wrap(e){return new js(this._open,this._close).wrap(e)}_toLatexDelimiter(e){var r;return(r=Pb.get(e))!==null&&r!==void 0?r:e}}const Pb=new Map([["{","\\{"],["}","\\}"],...[...Ws].map(t=>[t,"\\|"])]);class Gs{constructor(e){this._separators=e}static join(e,r,n=""){const o=r.length>0?r:n!==void 0?[n]:[];return new Gs(o)._join(e)}_join(e){return e.reduce((r,n,o,i)=>{const c=o===i.length-1?"":this._get(o);return r+n+c},"")}_get(e){return this._separators[e]?this._separators[e]:this._separators[this._separators.length-1]}}const on=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;class ti{constructor(e){this._value=e}static apply(e){return new ti(e)._apply()}_apply(){var e,r,n;return(n=(r=(e=this._findByCharacter())!==null&&e!==void 0?e:this._findByGlyph())!==null&&r!==void 0?r:this._findByNumber())!==null&&n!==void 0?n:new Zs().convert(this._value)}_findByCharacter(){return on(Lb,this._value)}_findByGlyph(){return on(Ob,this._value)}_findByNumber(){return on(Vs,this._value)}}class ku{constructor(e){this.utf8Converter=new Zs,this._mathmlElement=e}convert(){const e=Ko(this._mathmlElement.value);if(e===" ")return ti.apply(e);const r=e.trim(),n=ti.apply(r),o=this.utf8Converter.convert(n);return o!==n?o:this.wrapInMathVariant(n,this.getMathVariant(this._mathmlElement.attributes))}getMathVariant(e){if(!(!e||!e.mathvariant))return e.mathvariant}wrapInMathVariant(e,r){switch(r){case"bold":return`\\mathbf{${e}}`;case"italic":return`\\mathit{${e}}`;case"bold-italic":return`\\mathbf{\\mathit{${e}}}`;case"double-struck":return`\\mathbb{${e}}`;case"bold-fraktur":return`\\mathbf{\\mathfrak{${e}}}`;case"script":return`\\mathcal{${e}}`;case"bold-script":return`\\mathbf{\\mathcal{${e}}}`;case"fraktur":return`\\mathfrak{${e}}`;case"sans-serif":return`\\mathsf{${e}}`;case"bold-sans-serif":return`\\mathbf{\\mathsf{${e}}}`;case"sans-serif-italic":return`\\mathsf{\\mathit{${e}}}`;case"sans-serif-bold-italic":return`\\mathbf{\\mathsf{\\mathit{${e}}}}`;case"monospace":return`\\mathtt{${e}}`;default:return e}}}class Ys{constructor(e){this._value=e}static operate(e){return new Ys(e)._operate()}_operate(){var e,r,n;return(n=(r=(e=this._findByCharacter())!==null&&e!==void 0?e:this._findByGlyph())!==null&&r!==void 0?r:this._findByNumber())!==null&&n!==void 0?n:new Zs().convert(this._value)}_findByCharacter(){return on(kb,this._value)}_findByGlyph(){return on(Nb,this._value)}_findByNumber(){return on(Vs,this._value)}}class qb{constructor(e){this._mathmlElement=e}convert(){const r=Ko(this._mathmlElement.value).trim();return Ys.operate(r)}}class Bb{constructor(e){this._mathmlElement=e}convert(){const e=Ko(this._mathmlElement.value).trim();return on(Vs,e)||e}}class Fb{constructor(e){this._mathmlElement=e}convert(){return`\\sqrt{${this._mathmlElement.children.map(r=>tt(r)).map(r=>r.convert()).join(" ")}}`}}class zb{constructor(e,r,n,o){this.separators=n,this.defaultSeparator=o,this.open=e||"(",this.close=r||")"}apply(e){const r=Gs.join(e,this.separators,this.defaultSeparator);return new Du(this.open,this.close).wrap(r)}}class Hb{constructor(e,r){this.open=e,this.close=r}wrap(e){return new Du(this.open,this.close).wrap(e)}areParentheses(){return this._compare("(",")")}areSquareBrackets(){return this._compare("[","]")}areBrackets(){return this._compare("{","}")}areDivides(){return this._compare("|","|")}areParallels(){return this.open===this.close&&Ws.has(this.open)}areNotEqual(){return this.open!==this.close}_compare(e,r){return this.open===e&&this.close===r}}class Ub{constructor(e,r){this._genericCommand="matrix",this.separators=new Hb(e,r)}apply(e){const r=this._command,n=`\\begin{${r}}
|
|
492
|
+
${e.join("")}
|
|
493
|
+
\\end{${r}}`;return r===this._genericCommand?this.separators.wrap(n):n}get _command(){return this.separators.areParentheses()?"pmatrix":this.separators.areSquareBrackets()?"bmatrix":this.separators.areBrackets()?"Bmatrix":this.separators.areDivides()?"vmatrix":this.separators.areParallels()?"Vmatrix":this.separators.areNotEqual()?this._genericCommand:"bmatrix"}}class jb{constructor(e){this._mathmlElement=e,this.open=this._mathmlElement.attributes.open||"",this.close=this._mathmlElement.attributes.close||""}convert(){const e=this._mathmlElement.children.map(c=>tt(c)).map(c=>c.convert());if(this._isThereRelativeOfName(this._mathmlElement.children,"mtable"))return new Ub(this.open,this.close).apply(e);const r=this._mathmlElement.attributes.separators,n=r!==void 0,o=r?Array.from(r):[],i=n?"":",";return new zb(this.open,this.close,o,i).apply(e)}_isThereRelativeOfName(e,r){var n;const o=[...e];for(;o.length>0;){const i=o.pop();if(i.name===r)return!0;o.push(...(n=i.children)!==null&&n!==void 0?n:[])}return!1}}class Vr extends Error{constructor(e,r,n,o="exactly"){super(`${e} tag must have ${o} ${r} children. It's actually ${n}`),this.name="InvalidNumberOfChildrenError"}}class Wb{constructor(e){this._raw=e}toLaTeX(){if(!this._raw)return null;const e=this._raw.trim().toLowerCase();if(e==="medium")return null;if(e==="thin")return Jn(ri*.5);if(e==="thick")return Jn(ri*2);const r=e.match(/^(-?\d*\.?\d+)\s*([a-z%]*)$/);if(!r)return null;const n=parseFloat(r[1]),o=r[2];return n===0?"0pt":o===""?n===1?null:Jn(n*ri):o==="px"?Jn(n*Vb):o==="%"?Jn(n/100*ri):Zb.includes(o)?`${n}${o}`:null}}const ri=.4,Vb=.75,Zb=["pt","pc","in","cm","mm","em","ex","bp","dd","cc"];function Jn(t){return`${Math.round(t*1e4)/1e4}pt`}class Gb{constructor(e){this._mathmlElement=e}convert(){const{children:e,name:r}=this._mathmlElement,n=e.length;if(n!==2)throw new Vr(r,2,n);const o=tt(e[0]).convert(),i=tt(e[1]).convert();if(this._isBevelled())return`${this._wrapIfMoreThanOneChar(o)}/${this._wrapIfMoreThanOneChar(i)}`;const c=new Wb(this._mathmlElement.attributes.linethickness).toLaTeX();return c!==null?`\\genfrac{}{}{${c}}{}{${o}}{${i}}`:`\\frac{${o}}{${i}}`}_wrapIfMoreThanOneChar(e){return new ei().wrapIfMoreThanOneChar(e)}_isBevelled(){return!!this._mathmlElement.attributes.bevelled}}class Yb{constructor(e){this._mathmlElement=e}convert(){const{name:e,children:r}=this._mathmlElement,n=r.length;if(n!==2)throw new Vr(e,2,n);const o=tt(r[0]).convert();return`\\sqrt[${tt(r[1]).convert()}]{${o}}`}}class Jb{constructor(e){this._mathmlElement=e}convert(){const{children:e}=this._mathmlElement;return this._isToggle()?e.map(r=>tt(r)).map(r=>r.convert()).join(" \\Longrightarrow "):tt(e[0]).convert()}_isToggle(){const{actiontype:e}=this._mathmlElement.attributes;return e==="toggle"||!e}}class Xb{constructor(e){this._mathmlElement=e}convert(){const e=this._mathmlElement.children.map(r=>tt(r)).map(r=>r.convert()).join(" ");return this._notation==="actuarial"?`\\overline{\\left.${e}\\right|}`:this._notation==="radical"?`\\sqrt{${e}}`:["box","roundedbox","circle"].includes(this._notation)?`\\boxed{${e}}`:this._notation==="left"?`\\left|${e}`:this._notation==="right"?`${e}\\right|`:this._notation==="top"?`\\overline{${e}}`:this._notation==="bottom"?`\\underline{${e}}`:this._notation==="updiagonalstrike"?`\\cancel{${e}}`:this._notation==="downdiagonalstrike"?`\\bcancel{${e}}`:this._notation==="updiagonalarrow"?`\\cancelto{}{${e}}`:["verticalstrike","horizontalstrike"].includes(this._notation)?`\\hcancel{${e}}`:this._notation==="madruwb"?`\\underline{${e}\\right|}`:this._notation==="phasorangle"?`{\\angle \\underline{${e}}}`:`\\overline{\\left.\\right)${e}}`}get _notation(){return this._mathmlElement.attributes.notation||"longdiv"}}class Kb{constructor(e){this._mathmlElement=e}convert(){return`\\color{red}{${this._mathmlElement.children.map(r=>tt(r)).map(r=>r.convert()).join(" ")}}`}}class Qb{constructor(e){this._mathmlElement=e}convert(){return""}}class e2{constructor(e){this._mathmlElement=e}convert(){const{name:e,children:r}=this._mathmlElement,n=r.length;if(n!==2)throw new Vr(e,2,n);const o=r[0],i=r[1];return`${this._handleBaseChild(o)}^${this._handleExponentChild(i)}`}_handleBaseChild(e){const r=e.children,n=tt(e).convert();return r.length<=1?n:new ei().wrapIfMoreThanOneChar(n)}_handleExponentChild(e){const r=tt(e).convert();return new Qo().wrap(r)}}class t2{constructor(e){this._mathmlElement=e}convert(){const{name:e,children:r}=this._mathmlElement,n=r.length;if(n!==2)throw new Vr(e,2,n);const o=r[0],i=r[1];return`${this._handleBaseChild(o)}_${this._handleSubscriptChild(i)}`}_handleBaseChild(e){const r=e.children,n=tt(e).convert();return r.length<=1?n:new ei().wrapIfMoreThanOneChar(n)}_handleSubscriptChild(e){const r=tt(e).convert();return new Qo().wrap(r)}}class r2{constructor(e){this._mathmlElement=e}convert(){const{name:e,children:r}=this._mathmlElement,n=r.length;if(n!==3)throw new Vr(e,3,n);const o=r[0],i=r[1],c=r[2];return`${this._handleBaseChild(o)}_${this._handleSubscriptChild(i)}^${this._handleSuperscriptChild(c)}`}_handleBaseChild(e){const r=e.children,n=tt(e).convert();return r.length<=1?n:new ei().wrapIfMoreThanOneChar(n)}_handleSubscriptChild(e){const r=tt(e).convert();return new Qo().wrap(r)}_handleSuperscriptChild(e){const r=tt(e).convert();return new Qo().wrap(r)}}class n2{constructor(e){this._mathmlElement=e}convert(){const{name:e,children:r}=this._mathmlElement;if(r.length===0)throw new Vr(e,1,0,"at least");const n=this._baseLatex(r[0]),{prescripts:o,postscripts:i}=this._splitScripts(r.slice(1));return this._pairsLatex(o,!0)+n+this._pairsLatex(i,!1)}_baseLatex(e){const r=tt(e).convert();return r===""?"{}":r.length===1?r:`{${r}}`}_splitScripts(e){const r=e.findIndex(i=>i.name==="mprescripts"),n=r===-1?e:e.slice(0,r),o=r===-1?[]:e.slice(r+1);return{prescripts:this._toPairs(o),postscripts:this._toPairs(n)}}_toPairs(e){const r=[];for(let n=0;n<e.length;n+=2)r.push({sub:this._scriptLatex(e[n]),sup:this._scriptLatex(e[n+1])});return r}_scriptLatex(e){return e===void 0||e.name==="none"?"":tt(e).convert()}_pairsLatex(e,r){let n="",o=!r;for(const i of e){const c=(i.sub?`_{${i.sub}}`:"")+(i.sup?`^{${i.sup}}`:"");c!==""&&(n+=(o?"":"{}")+c,o=!1)}return n}}class o2{constructor(e){this._mathvariant=e||"normal"}apply(e){return this._commands.reduce((r,n,o)=>o===0?`${n}{${e}}`:`${n}{${r}}`,"")}get _commands(){switch(this._mathvariant){case"bold":return["\\textbf"];case"italic":return["\\textit"];case"bold-italic":return["\\textit","\\textbf"];case"double-struck":return["\\mathbb"];case"monospace":return["\\mathtt"];case"bold-fraktur":case"fraktur":return["\\mathfrak"];default:return["\\text"]}}}class i2{constructor(e){this._mathmlElement=e}convert(){const{attributes:e,value:r}=this._mathmlElement;return[...r].map(n=>/^[a-zA-Z0-9]$/.test(n)||n===" "?{value:n,isAlphanumeric:!0}:{value:n,isAlphanumeric:!1}).reduce((n,o)=>{if(o.isAlphanumeric){const i=n[n.length-1];if(i&&i.isAlphanumeric)return i.value+=o.value,n}return[...n,o]},[]).map(n=>n.isAlphanumeric?new o2(e.mathvariant).apply(n.value):new ku({name:"mi",attributes:{},children:[],value:n.value}).convert()).join("")}}class s2{constructor(e){this._mathmlElement=e}convert(){const{name:e,children:r}=this._mathmlElement,n=r.length;if(n!==3)throw new Vr(e,3,n);const o=tt(r[0]).convert(),i=tt(r[1]).convert(),c=tt(r[2]).convert();return`${o}_{${i}}^{${c}}`}}class Js{constructor(e){this._table=e}static matches(e){return new Js(e)._matches()}_matches(){const e=new Set(this._columnAlignTokens());return e.has("right")&&e.has("left")}_columnAlignTokens(){const e=this._rows(),r=e.reduce((n,o)=>n.concat(this._cells(o)),[]);return[this._table,...e,...r].map(n=>n.attributes.columnalign).filter(n=>!!n).reduce((n,o)=>n.concat(o.trim().split(/\s+/)),[])}_rows(){return this._table.children.filter(e=>e.name==="mtr")}_cells(e){return e.children.filter(r=>r.name==="mtd")}}class a2{constructor(e){this._mathmlElement=e}convert(){const e=this._mathmlElement.children.map(r=>tt(r)).map(r=>r.convert()).join(` \\\\
|
|
494
|
+
`);return this._hasFlag("innerTable")?this._wrap(e,"matrix"):this._hasFlag("bareTable")?this._wrap(e,Js.matches(this._mathmlElement)?"aligned":"matrix"):e}_wrap(e,r){return`\\begin{${r}}${e}\\end{${r}}`}_hasFlag(e){return!!this._mathmlElement.attributes[e]}}class l2{constructor(e){this._mathmlElement=e}convert(){const e=this._mathmlElement.children.map(r=>tt(r)).map(r=>r.convert()).join(" & ");return this._mathmlElement.attributes.bareRow?`\\begin{matrix}${e}\\end{matrix}`:e}}class Nu{constructor(e){this._mathmlElement=e}convert(){return this._mathmlElement.children.map(e=>tt(e)).map(e=>e.convert()).join(" ")}}class c2{constructor(e){this._type=e}apply(e,r){return Rb.includes(r)?`${r}{${e}}`:`${this._defaultCommand}{${r}}{${e}}`}get _defaultCommand(){return this._type===Xn.Under?"\\underset":"\\overset"}}var Xn;(function(t){t[t.Under=0]="Under",t[t.Over=1]="Over"})(Xn||(Xn={}));class Lu{constructor(e){this._mathmlElement=e}convert(){const{name:e,children:r}=this._mathmlElement,n=r.length;if(n!==2)throw new Vr(e,2,n);const o=tt(r[0]).convert(),i=tt(r[1]).convert();return this._applyCommand(o,i)}_applyCommand(e,r){const n=this._mathmlElement.name.match(/under/)?Xn.Under:Xn.Over;return new c2(n).apply(e,r)}}class ni{constructor(e){this._element=e}static matches(e){return new ni(e)._matches()}_matches(){var e;if(this._element.name!=="mrow")return!1;const r=(e=this._element.children)!==null&&e!==void 0?e:[];return r.length!==2&&r.length!==3?!1:this._isOpeningBrace(r[0])&&this._isTable(r[1])&&this._isEmptyClosing(r[2])}_isOpeningBrace(e){return e.name==="mo"&&e.value.trim()==="{"}_isTable(e){return e.name==="mtable"}_isEmptyClosing(e){return e===void 0||e.name==="mo"&&e.value.trim()===""}}class u2{constructor(e){this._mathmlElement=e}convert(){return ni.matches(this._mathmlElement)?this._convertAsLinearSystem():this._mathmlElement.children.map(e=>tt(e)).map(e=>e.convert()).join(" ")}_convertAsLinearSystem(){return`\\begin{cases} ${this._mathmlElement.children[1].children.map(n=>tt(n)).map(n=>n.convert()).join(" \\\\ ")} \\end{cases}`}}class d2{constructor(e){this._mathmlElement=e}convert(){const{linebreak:e}=this._mathmlElement.attributes;return e==="newline"?" \\\\ ":" "}}class f2{constructor(e){this._mathmlElement=e}convert(){return""}}class h2{constructor(){this.name="void",this.value="",this.children=[],this.attributes={}}}class Ou{constructor(e){this._mathMLElement=e??new h2}toLatexConverter(){const{name:e}=this._mathMLElement,r=m2[e]||Nu;return new r(this._mathMLElement)}}const m2={math:Db,mi:ku,mo:qb,mn:Bb,msqrt:Fb,mfenced:jb,mfrac:Gb,mroot:Yb,maction:Jb,menclose:Xb,merror:Kb,mphantom:Qb,msup:e2,msub:t2,msubsup:r2,mmultiscripts:n2,mtext:i2,munderover:s2,mtable:a2,mtr:l2,mover:Lu,munder:Lu,mrow:u2,mspace:d2,mpadded:Nu,void:f2};class p2{constructor(e){this._root=e}normalize(){const e=[this._root];for(;e.length>0;){const n=e.pop().children;if(!n||n.length===0)continue;const o=new g2(n).pair();o!==n&&n.splice(0,n.length,...o);for(const i of n)e.push(i)}}}class g2{constructor(e){this._children=e}pair(){const e=[],r=[];let n=e,o=!1;for(const i of this._children){const c=r[r.length-1];if(this._opensFrame(i,c)){const g={opener:i,content:[]};r.push(g),n=g.content;continue}if(this._closesFrame(i,c)){const g=r.pop();n=r.length>0?r[r.length-1].content:e,n.push(this._makeFence(g.opener,i,g.content)),o=!0;continue}const d=this._scriptBaseCloser(i,c);if(d!==void 0){const g=r.pop();n=r.length>0?r[r.length-1].content:e;const _=this._makeFence(g.opener,d,g.content);n.push(Object.assign(Object.assign({},i),{children:[_,...i.children.slice(1)]})),o=!0;continue}n.push(i)}if(!o)return this._children;for(const i of r)this._spill(i,e);return e}_spill(e,r){r.push(e.opener);for(const n of e.content)r.push(n)}_makeFence(e,r,n){return{name:"mfenced",value:"",children:[n.length===1?n[0]:this._wrapInRow(n)],attributes:{open:e.value.trim(),close:r.value.trim()}}}_wrapInRow(e){return{name:"mrow",value:"",children:e,attributes:{}}}_scriptBaseCloser(e,r){if(r===void 0||!this._isBar(r.opener)||!y2.has(e.name)||e.children.length===0)return;const n=e.children[0],o=n.name==="mrow"&&n.children.length===1?n.children[0]:n;if(!(o.name!=="mo"||o.value.trim()!==r.opener.value.trim()))return o}_opensFrame(e,r){return this._isOpener(e)?!0:this._isBar(e)&&!this._closesBar(e,r)}_closesFrame(e,r){return r===void 0?!1:this._isCloser(e)&&this._isOpener(r.opener)?!0:this._closesBar(e,r)}_closesBar(e,r){return r===void 0||!this._isBar(e)||!this._isBar(r.opener)?!1:r.opener.value.trim()===e.value.trim()}_isOpener(e){return e.name==="mo"&&v2.has(e.value.trim())}_isCloser(e){return e.name==="mo"&&b2.has(e.value.trim())}_isBar(e){return e.name==="mo"&&x2.has(e.value.trim())}}const v2=new Set(["(","[","{"]),b2=new Set([")","]","}"]),x2=new Set(["|",...Ws]),y2=new Set(["msub","msup","msubsup"]);class E2{constructor(e){this._root=e}normalize(){const e=[{node:this._root,insideMtable:!1,wrapped:!1}];for(;e.length>0;){const r=e.pop();this._annotate(r),this._pushChildren(r,e)}}_annotate({node:e,insideMtable:r,wrapped:n}){e.name==="mtable"&&(r?e.attributes.innerTable="innerTable":n||(e.attributes.bareTable="bareTable")),e.name==="mtr"&&!r&&(e.attributes.bareRow="bareRow")}_pushChildren({node:e,insideMtable:r,wrapped:n},o){var i;const c=r||e.name==="mtable",d=n||e.name==="mfenced",g=ni.matches(e)?e.children[1]:void 0,_=(i=e.children)!==null&&i!==void 0?i:[];for(let E=0;E<_.length;E++)o.push({node:_[E],insideMtable:c,wrapped:d||_[E]===g})}}const A2=t=>{var e,r;for(const c of w2(t))c.normalize();const n=new Map,o=[{node:t,visited:!1}],i=Tu(n);try{for(;o.length>0;){const c=o[o.length-1];if(!c.visited){c.visited=!0;const d=(e=c.node.children)!==null&&e!==void 0?e:[];for(let g=d.length-1;g>=0;g--)o.push({node:d[g],visited:!1});continue}o.pop(),n.set(c.node,new Ou(c.node).toLatexConverter().convert())}}finally{Tu(i)}return(r=n.get(t))!==null&&r!==void 0?r:""},w2=t=>[new p2(t),new E2(t)];class C2{constructor(e,r){this._xml="",this._elementsConvertor=e,this._errorHandler=r,this._xmlDOM=new _b.DOMParser({onError:(n,o)=>this._fixError(o)})}convert(e){return this._xml=this._removeLineBreaks(e),this._xml=this._removeMsWordPrefixes(this._xml),this._elementsConvertor.convert(this._mathMLElements)}_fixError(e){this._xml=this._errorHandler.fixError(this._xml,e)}_removeLineBreaks(e){const r=/\n|\r\n|\r/g;return e.replace(r,"")}_removeMsWordPrefixes(e){const r=/mml:/g;return e.replace(r,"")}get _mathMLElements(){let e=this._parse();this._errorHandler.isThereAnyErrors()&&(this._errorHandler.cleanErrors(),e=this._parse());const r=e==null?void 0:e.getElementsByTagName("math");return r?Array.from(r):[]}_parse(){try{return this._xmlDOM.parseFromString(this._xml,"text/xml")}catch{return}}}class S2{constructor(){this._errors=[]}fixError(e,r){return this._isMissingAttributeValueError(r)?(this._errors.push(r),this._fixMissingAttribute(r,e)):e}isThereAnyErrors(){return this._errors.length>0}cleanErrors(){this._errors=[]}_fixMissingAttribute(e,r){const n=this._attributeNameFromError(e);if(n)return r.replace(this._matchMissingValueForAttribute(n),"");for(;this._mathGenericMissingValue().exec(r);)r=r.replace(this._mathGenericMissingValue(),"$1$3");return r}_attributeNameFromError(e){var r;return(r=e.match(/attribute "([^"]+)" missed value/))===null||r===void 0?void 0:r[1]}_matchMissingValueForAttribute(e){return new RegExp(`(${e}=(?!("|')))|(${e}(?!("|')))`,"gm")}_mathGenericMissingValue(){return/(\<.* )(\w+=(?!\"|\'))(.*\>)/gm}_isMissingAttributeValueError(e){return!!e.includes("attribute")&&!!e.includes("missed")||e.includes("attribute value missed")||e.includes(`AttValue: ' or " expected`)}}class _2{convert(e){const r=[],n=[];for(let o=e.length-1;o>=0;o--)n.push({el:e[o],target:r});for(;n.length>0;){const{el:o,target:i}=n.pop();if(o.tagName===void 0)continue;const c=this._convertElement(o);if(i.push(c),!this._hasElementChild(o))continue;const d=Array.from(o.childNodes);for(let g=d.length-1;g>=0;g--)n.push({el:d[g],target:c.children})}return r}_convertElement(e){return{name:e.tagName,attributes:this._convertElementAttributes(e.attributes),value:this._hasElementChild(e)?"":e.textContent||"",children:[]}}_convertElementAttributes(e){return Array.from(e).reduce((r,n)=>Object.assign({[n.nodeName]:n.nodeValue===n.nodeName?"":n.nodeValue},r),{})}_hasElementChild(e){const r=e.childNodes;return!!r&&r.length!==0&&this._isThereAnyNoTextNode(r)}_isThereAnyNoTextNode(e){return Array.from(e).some(r=>r.nodeName!=="#text")}}const T2=()=>{const t=new _2,e=new S2;return new C2(t,e)};class Ru{static convert(e){return T2().convert(e).map(n=>A2(n)).join("").trim()}}const Ve=new Jo({headingStyle:"atx",hr:"---",codeBlockStyle:"fenced",bulletListMarker:"-",emDelimiter:"*",preformattedCode:!0});function sn(t){const e=new XMLSerializer;let r="";return Array.from(t.childNodes).forEach(n=>{n.nodeType===Node.ELEMENT_NODE?r+=e.serializeToString(n):n.nodeType===Node.TEXT_NODE&&(r+=n.textContent)}),r}function D2(t){try{const e=new URL(t);if(e.hostname==="link.zhihu.com"){const r=e.searchParams.get("target");if(r){const n=decodeURIComponent(r);if(/^https?:\/\//i.test(n))return n}}}catch{}return t}function Iu(t,e){return t?t.startsWith("//")?`https:${t}`:t.startsWith("http://")||t.startsWith("https://")?t:t.startsWith("chrome-extension://")||t.startsWith("moz-extension://")?"":e&&(e.startsWith("http://")||e.startsWith("https://"))?e:t:""}function Mu(t){const e=t.getAttribute("data-latex");if(e)return e.trim();if(t.nodeName.toLowerCase()==="math"){const c=t.getAttribute("alttext");if(c)return c.trim()}const r=t.querySelector("math[alttext]");if(r){const c=r.getAttribute("alttext");if(c)return c.trim()}const n=t.querySelector('annotation[encoding="application/x-tex"]');if(n!=null&&n.textContent)return n.textContent.trim();const o=t.nodeName.toLowerCase()==="math"?t:t.querySelector("math");if(o)try{return Ru.convert(o.outerHTML)}catch(c){Nt.debug("turndown.mathml.failed","MathMLToLaTeX 转换失败",{context:"offscreen",error:c instanceof Error?c:new Error(String(c))})}const i=t.nodeName.toLowerCase()==="img"?t:t.querySelector("img");return(i==null?void 0:i.getAttribute("alt"))||""}function k2(t){const e=["src","href","style","align","width","height","rowspan","colspan","bgcolor","scope","valign","headers"],r=o=>{Array.from(o.attributes).forEach(i=>{e.includes(i.name)||o.removeAttribute(i.name)}),o.childNodes.forEach(i=>{i instanceof Element&&r(i)})},n=t.cloneNode(!0);return r(n),n.outerHTML}function N2(t){const e=t.querySelectorAll("math[alttext]");return e.length===0?"":Array.from(e).map(r=>{const n=r.getAttribute("alttext");return n?r.closest(".ltx_eqn_inline")!==null?`$${n.trim()}$`:`
|
|
495
|
+
$$
|
|
496
|
+
${n.trim()}
|
|
497
|
+
$$`:""}).join(`
|
|
498
|
+
|
|
499
|
+
`)}function $u(t){const e=Number.parseInt(t.getAttribute("data-w")||"0"),r=e||t.naturalWidth||t.width||Number.parseInt(t.getAttribute("width")||"0");let n=Number.parseInt(t.getAttribute("data-h")||"0");if(!n&&e){const o=Number.parseFloat(t.getAttribute("data-ratio")||"0");o>0&&(n=Math.round(e*o))}return n=n||t.naturalHeight||t.height||Number.parseInt(t.getAttribute("height")||"0"),{width:r,height:n}}function Pu(t,e){return t>0&&t<50||e>0&&e<50}const L2=/^(\d+(?:\.\d+)?)w$/,O2=/^(\d+(?:\.\d+)?)x$/;function R2(t){if(!t)return[];const e=t.trim(),r=[],n=e.length;let o=0;for(;o<n;){for(;o<n&&/[\s,]/.test(e[o]);)o++;if(o>=n)break;let i=o;for(;o<n&&!/\s/.test(e[o]);)o++;let c=e.slice(i,o),d="";if(/,+$/.test(c))c=c.replace(/,+$/,"");else{for(;o<n&&/\s/.test(e[o]);)o++;i=o;let _=!1;for(;o<n;){const E=e[o];if(_)E===")"&&(_=!1);else if(E==="(")_=!0;else if(E===",")break;o++}d=e.slice(i,o).trim()}if(!c)continue;const g={url:c};for(const _ of d.split(/\s+/)){const E=_.match(L2);if(E){g.width=Number.parseFloat(E[1]);break}const b=_.match(O2);if(b){g.density=Number.parseFloat(b[1]);break}}r.push(g)}return r}function I2(t){if(!t)return null;const e=R2(t).filter(n=>!n.url.startsWith("data:"));if(e.length===0)return null;let r=e[0];for(const n of e.slice(1)){const o=r.width??r.density??0;(n.width??n.density??0)>o&&(r=n)}return r.url}const M2=[/^https?:\/\/picasso-static\.xiaohongshu\.com\/fe-platform\//,/^https?:\/\/face\.t\.sinajs\.cn\/t4\/appstyle\/expression\//,/^https?:\/\/h5\.sinaimg\.cn\/m\/emoticon\/icon\//,/^https?:\/\/i0\.hdslb\.com\/bfs\/emote\//,/^https?:\/\/github\.githubassets\.com\/images\/icons\/emoji\//,/^https?:\/\/twemoji\.maxcdn\.com\//,/^https?:\/\/abs-0\.twimg\.com\/emoji\//,/^https?:\/\/cdn\.jsdelivr\.net\/[^?#]*twemoji/,/^https?:\/\/res\.wx\.qq\.com\/(?:t\/wx_fed\/we-emoji|mpres\/htmledition\/images\/icon\/emotion)\//,/^https?:\/\/mmbiz\.qpic\.cn\/mmbiz_svg\//,/^https?:\/\/emoji\.slack-edge\.com\//,/^https?:\/\/cdn\.discordapp\.com\/emojis\//];function qu(t){return M2.some(e=>e.test(t))}function Bu(t){const e=t.getAttribute("data-src");if(e&&!e.startsWith("data:"))return e;const r=t.getAttribute("data-original");if(r&&!r.startsWith("data:"))return r;const n=t.getAttribute("data-lazy-src");if(n&&!n.startsWith("data:"))return n;const o=t.getAttribute("src")||"";return!o||o.startsWith("data:")?I2(t.getAttribute("srcset")||t.getAttribute("data-srcset"))||"":o}Ve.remove(["style","script","button"]),Ve.keep(["iframe","video","audio","sup","sub","svg"]),Ve.addRule("paragraph",{filter:"p",replacement(t){const e=t.trim();return e?`
|
|
500
|
+
|
|
501
|
+
${e}
|
|
502
|
+
|
|
503
|
+
`:""}}),Ve.addRule("removeHiddenElements",{filter(t){return t instanceof HTMLElement?t.style.display==="none":!1},replacement:()=>""}),Ve.addRule("removals",{filter(t){if(!(t instanceof HTMLElement))return!1;const e=t.getAttribute("href");return!!(e!=null&&e.includes("#fnref")||t.classList.contains("footnote-backref"))},replacement:()=>""}),Ve.addRule("table",{filter:"table",replacement(t,e){if(!(e instanceof HTMLTableElement))return t;if(e.classList.contains("ltx_equation")||e.classList.contains("ltx_eqn_table")||e.classList.contains("ltx_equationgroup"))return N2(e);if(Array.from(e.querySelectorAll("td, th")).some(i=>{const c=i.getAttribute("colspan"),d=i.getAttribute("rowspan");return c&&c!=="1"||d&&d!=="1"}))return`
|
|
504
|
+
|
|
505
|
+
${k2(e)}
|
|
506
|
+
|
|
507
|
+
`;const r=Array.from(e.rows).map(i=>`| ${Array.from(i.cells).map(c=>{let d=Ve.turndown(sn(c)).replace(/\n/g," ").trim();return d=d.replace(/\|/g,"\\|"),d}).join(" | ")} |`);if(r.length===0)return"";const n=e.rows[0].cells.length,o=`| ${Array(n).fill("---").join(" | ")} |`;return`
|
|
508
|
+
|
|
509
|
+
${[r[0],o,...r.slice(1)].join(`
|
|
510
|
+
`)}
|
|
511
|
+
|
|
512
|
+
`}}),Ve.addRule("MathJax",{filter(t){return t.nodeName.toLowerCase()==="mjx-container"},replacement(t,e){if(!(e instanceof HTMLElement))return t;const r=e.querySelector("mjx-assistive-mml");if(!r)return t;const n=r.querySelector("math");if(!n)return t;let o;try{o=Ru.convert(n.outerHTML)}catch(i){return Nt.debug("turndown.mathjax.failed","MathJax 转换失败",{context:"offscreen",error:i instanceof Error?i:new Error(String(i))}),t}return n.getAttribute("display")==="block"?`
|
|
513
|
+
$$
|
|
514
|
+
${o}
|
|
515
|
+
$$
|
|
516
|
+
`:`$${o}$`}}),Ve.addRule("math",{filter(t){return t.nodeName.toLowerCase()==="math"||t instanceof Element&&!!t.classList&&(t.classList.contains("mwe-math-element")||t.classList.contains("mwe-math-fallback-image-inline")||t.classList.contains("mwe-math-fallback-image-display"))},replacement(t,e){var C,A,a,s,l;if(!(e instanceof Element))return t;let r=Mu(e).trim();if(!r)return t;const n=e.parentElement;if(e.closest("table")===null&&(e.getAttribute("display")==="block"||e.classList.contains("mwe-math-fallback-image-display")||n!=null&&n.classList.contains("mwe-math-element")&&((C=n.previousElementSibling)==null?void 0:C.nodeName.toLowerCase())==="p"))return`
|
|
517
|
+
$$
|
|
518
|
+
${r}
|
|
519
|
+
$$
|
|
520
|
+
`;const o=e.previousSibling,i=e.nextSibling,c=((A=o==null?void 0:o.textContent)==null?void 0:A.slice(-1))||"",d=((a=i==null?void 0:i.textContent)==null?void 0:a[0])||"",g=!o||o.nodeType===Node.TEXT_NODE&&((s=o.textContent)==null?void 0:s.trim())==="",_=!i||i.nodeType===Node.TEXT_NODE&&((l=i.textContent)==null?void 0:l.trim())==="",E=!g&&c&&!/[\s$]/.test(c)?" ":"",b=!_&&d&&!/[\s$]/.test(d)?" ":"";return`${E}$${r}$${b}`}}),Ve.addRule("katex",{filter(t){return t instanceof HTMLElement&&(t.classList.contains("math")||t.classList.contains("katex"))},replacement(t,e){var i;if(!(e instanceof HTMLElement))return t;let r=e.getAttribute("data-latex");if(!r){const c=e.querySelector('.katex-mathml annotation[encoding="application/x-tex"]');r=(c==null?void 0:c.textContent)||""}if(r||(r=((i=e.textContent)==null?void 0:i.trim())||""),!r)return t;const n=e.querySelector(".katex-mathml math");return!!e.closest(".katex-display, .math-display")||(n==null?void 0:n.getAttribute("display"))==="block"||e.classList.contains("math")&&!e.classList.contains("math-inline")&&!n?`
|
|
521
|
+
$$
|
|
522
|
+
${r}
|
|
523
|
+
$$
|
|
524
|
+
`:`$${r}$`}}),Ve.addRule("list",{filter:["ul","ol"],replacement(t,e){return t=t.trim(),`${(!!(e.parentNode&&(e.parentNode.nodeName==="UL"||e.parentNode.nodeName==="OL"))?"":`
|
|
525
|
+
`)+t}
|
|
526
|
+
`}}),Ve.addRule("listItem",{filter:"li",replacement(t,e,r){if(!(e instanceof HTMLElement))return t;const n=e.classList.contains("task-list-item"),o=e.querySelector('input[type="checkbox"]');let i="";n&&o&&(t=t.replace(/<input[^>]*>/,""),i=o.checked?"[x] ":"[ ] "),t=t.replace(/\n+$/,"").split(`
|
|
527
|
+
`).filter(b=>b.length>0).join(`
|
|
528
|
+
`);let c=`${r.bulletListMarker} `;const d=e.parentNode;let g=0,_=e.parentNode;for(;_&&(_.nodeName==="UL"||_.nodeName==="OL");)g++,_=_.parentNode;const E=Math.max(0,g-1);if(c=" ".repeat(E)+c,d instanceof HTMLOListElement){const b=d.getAttribute("start"),C=Array.from(d.children).indexOf(e)+1;c=`${" ".repeat(g-1)+(b?Number(b)+C-1:C)}. `}return c+i+t.trim()+(e.nextSibling&&!/\n$/.test(t)?`
|
|
529
|
+
`:"")}}),Ve.addRule("arXivEnumerate",{filter(t){return t.nodeName==="OL"&&t.classList.contains("ltx_enumerate")},replacement(t,e){return e instanceof HTMLElement?`
|
|
530
|
+
|
|
531
|
+
${Array.from(e.children).map((r,n)=>{if(r instanceof HTMLElement){const o=sn(r).replace(/^<span class="ltx_tag ltx_tag_item">\d+\.<\/span>\s*/,"");return`${n+1}. ${Ve.turndown(o)}`}return""}).join(`
|
|
532
|
+
|
|
533
|
+
`)}
|
|
534
|
+
|
|
535
|
+
`:t}}),Ve.addRule("heading",{filter:["h1","h2","h3","h4","h5","h6"],replacement(t,e){const r=Number(e.nodeName.charAt(1)),n=t.trim();return n?`
|
|
536
|
+
|
|
537
|
+
${"#".repeat(r)} ${n}
|
|
538
|
+
|
|
539
|
+
`:""}}),Ve.addRule("highlight",{filter:"mark",replacement:t=>`==${t}==`}),Ve.addRule("strikethrough",{filter(t){return t.nodeName==="DEL"||t.nodeName==="S"||t.nodeName==="STRIKE"},replacement:t=>`~~${t}~~`}),Ve.addRule("emphasis",{filter:["em","i"],replacement(t){var o,i;const e=t.trim();if(!e)return"";const r=((o=e.match(/^\*+/))==null?void 0:o[0].length)??0,n=((i=e.match(/\*+$/))==null?void 0:i[0].length)??0;return r%2===1&&n%2===1?e:`*${e}*`}}),Ve.addRule("strong",{filter:["strong","b"],replacement(t){var r;const e=t.trim();return e?(((r=e.match(/^\*+/))==null?void 0:r[0].length)??0)>=2?e:`**${e}**`:""}}),Ve.addRule("inlineStyleEmphasis",{filter(t){if(!(t instanceof HTMLElement))return!1;const e=t.nodeName;if(e==="STRONG"||e==="B"||e==="EM"||e==="I")return!1;const r=t.style.fontWeight,n=t.style.fontStyle;return r==="bold"||r==="bolder"||Number(r)>=700||n==="italic"||n==="oblique"},replacement(t,e){var E,b;const r=t.trim();if(!r)return"";const n=e,o=n.style.fontWeight,i=n.style.fontStyle,c=o==="bold"||o==="bolder"||Number(o)>=700,d=i==="italic"||i==="oblique",g=((E=r.match(/^\*+/))==null?void 0:E[0].length)??0,_=((b=r.match(/\*+$/))==null?void 0:b[0].length)??0;return c&&d?g>=3&&_>=3?r:g>=2&&_>=2?`*${r}*`:g>=2?r:g%2===1&&_%2===1?`**${r}**`:`***${r}***`:c?g>=2?r:`**${r}**`:g%2===1&&_%2===1?r:`*${r}*`}}),Ve.addRule("callout",{filter(t){return t.nodeName.toLowerCase()==="div"&&t.classList.contains("markdown-alert")},replacement(t,e){const r=e,n=Array.from(r.classList).find(g=>g.startsWith("markdown-alert-")&&g!=="markdown-alert"),o=n?n.replace("markdown-alert-","").toUpperCase():"NOTE",i=r.querySelector(".markdown-alert-title"),c=r.querySelector("p:not(.markdown-alert-title)");let d=t;return i&&i.textContent&&(d=(c==null?void 0:c.textContent)||t.replace(i.textContent,"")),`
|
|
540
|
+
> [!${o}]
|
|
541
|
+
> ${d.trim().replace(/\n/g,`
|
|
542
|
+
> `)}
|
|
543
|
+
`}}),Ve.addRule("admonition",{filter(t){return t.nodeName.toLowerCase()==="div"&&t.classList.contains("admonition")},replacement(t,e){var g,_;const r=e,n=Array.from(r.classList).find(E=>E!=="admonition"&&!E.startsWith("admonition-")),o=n?n.toUpperCase():"NOTE",i=r.querySelector(".admonition-title"),c=(g=i==null?void 0:i.textContent)==null?void 0:g.trim();let d=t;if(i){const E=((_=i.textContent)==null?void 0:_.trim())||"";d.startsWith(E)&&(d=d.substring(E.length).trim())}return`
|
|
544
|
+
> [!${o}]${c?` ${c}`:""}
|
|
545
|
+
> ${d.trim().replace(/\n/g,`
|
|
546
|
+
> `)}
|
|
547
|
+
`}}),Ve.addRule("embedToMarkdown",{filter(t){if(t instanceof HTMLIFrameElement){const e=t.getAttribute("src");return!!e&&(!!e.match(/youtube\.com|youtu\.be/)||!!e.match(/twitter\.com|x\.com/)||!!e.match(/player\.bilibili\.com/))}return!1},replacement(t,e){if(!(e instanceof HTMLIFrameElement))return t;const r=e.getAttribute("src"),n=e.getAttribute("title")||"";if(r){const o=r.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:embed\/|watch\?v=)?([\w-]+)/);if(o&&o[1]){const d=`https://www.youtube.com/watch?v=${o[1]}`;return`
|
|
548
|
+
|
|
549
|
+
**${n||"YouTube"}:[${d}](${d})**
|
|
550
|
+

|
|
551
|
+
|
|
552
|
+
`}const i=r.match(/(?:twitter\.com|x\.com)\/.*?(?:status|statuses)\/(\d+)/);if(i&&i[1]){const d=`https://x.com/i/status/${i[1]}`;return`
|
|
553
|
+
|
|
554
|
+
**${n||"Twitter"}:[${d}](${d})**
|
|
555
|
+

|
|
556
|
+
|
|
557
|
+
`}const c=r.match(/(?:https?:)?\/\/player\.bilibili\.com\/player\.html\?.*?bvid=([^&]+)/);if(c&&c[1]){const d=new URL(r,"https://player.bilibili.com"),g=Number.parseInt(d.searchParams.get("page")||"1",10),_=`https://www.bilibili.com/video/${c[1]}${g>1?`?p=${g}`:""}`;return`
|
|
558
|
+
|
|
559
|
+
**${n||"Bilibili"}:[${_}](${_})**
|
|
560
|
+

|
|
561
|
+
|
|
562
|
+
`}}return t}}),Ve.addRule("images",{filter:"img",replacement(t,e){const r=e,n=r.alt||"",o=Iu(Bu(r),r.src);if(o&&qu(o))return"";const{width:i,height:c}=$u(r);if(Pu(i,c))return"";const d=r.title?` "${r.title}"`:"";return o?``:""}}),Ve.addRule("figure",{filter:"figure",replacement(t,e){var E;const r=e,n=r.querySelector("img"),o=r.querySelector("figcaption");if(!n)return t;const i=n.getAttribute("alt")||"";let c=Bu(n);if(c=Iu(c,n.src),c&&qu(c))return"";const{width:d,height:g}=$u(n);if(Pu(d,g))return"";let _="";if(o){const b=o.querySelector(".ltx_tag_figure"),C=b?(E=b.textContent)==null?void 0:E.trim():"";let A=sn(o);A=A.replace(/<math[^>]*>[\s\S]*?<\/math>/g,(s,l,u)=>{const m=new DOMParser().parseFromString(s,"text/html").body.firstChild,x=Mu(m),f=u[l-1]||"",v=u[l+s.length]||"",p=l===0||/\s/.test(f),h=l+s.length===u.length||/\s/.test(v),w=!p&&!/[\s$]/.test(f)?" ":"",O=!h&&!/[\s$]/.test(v)?" ":"";return`${w}$${x}$${O}`});const a=Ve.turndown(A);_=`${C} ${a}`.trim()}return _=_.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(b,C,A)=>`[${C}](${A})`),`
|
|
563
|
+
|
|
564
|
+
${_}
|
|
565
|
+
|
|
566
|
+
`}}),Ve.addRule("codeBlock",{filter(t){var e;return t.nodeName==="PRE"&&((e=t.firstChild)==null?void 0:e.nodeName)==="CODE"},replacement(t,e){const r=e.firstChild,n=r.getAttribute("data-lang")||r.className.replace(/^language-/,"").split(" ")[0]||"",o=(r.textContent||"").replace(/^\n+|\n+$/g,"").replace(/`/g,"\\`");return`
|
|
567
|
+
\`\`\`${n}
|
|
568
|
+
${o}
|
|
569
|
+
\`\`\`
|
|
570
|
+
`}});const Fu="0123456789+-=()ni",$2="⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿⁱ",P2="₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₙᵢ";Ve.addRule("superscriptSubscript",{filter(t){return["SUP","SUB"].includes(t.nodeName)&&!t.id.startsWith("fnref:")&&!t.querySelector("a[href^='#fn'], a[href*='cite_note']")},replacement(t,e){const r=(e.textContent||"").trim(),n=e.nodeName==="SUB"?P2:$2;if([...r].every(c=>c===" "||Fu.includes(c)))return[...r].map(c=>c===" "?" ":n[Fu.indexOf(c)]).join("");const o=e.nodeName.toLowerCase(),i=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return`<${o}>${i}</${o}>`}});function zu(t){return(t.includes("#")?t.slice(t.lastIndexOf("#")+1):t).replace(/^(?:user-content-)?fn[:\-]/,"").replace(/^cite_note-/,"")}function q2(t){const e=t.nodeName==="A"?t:t.querySelector("a[href]"),r=(e==null?void 0:e.getAttribute("href"))||"",n=r.includes("#")?r.slice(r.lastIndexOf("#")+1):"";return/^(?:user-content-)?fn[:\-]/.test(n)?zu(n):t.id.replace(/^fnref:/,"").split("-")[0]}Ve.addRule("footnoteRef",{filter(t){var e;return t.nodeName==="SUP"&&(!!((e=t.id)!=null&&e.match(/^(?:user-content-)?fnref[:\-]/))||!!t.querySelector("a[data-footnote-ref], a[role='doc-noteref']"))&&!!t.querySelector("a[href]")},replacement(t,e){return`[^${q2(e)}]`}}),Ve.addRule("footnotesSection",{filter(t){return t instanceof HTMLElement&&(t.id==="footnotes"||t.hasAttribute("data-footnotes")||t.getAttribute("role")==="doc-endnotes"||t.classList.contains("footnotes"))},replacement(t,e){const r=e,n=[];return r.querySelectorAll("li[id]").forEach(o=>{var g;if((g=o.parentElement)!=null&&g.closest("li"))return;const i=zu(o.id);if(!i)return;const c=o.cloneNode(!0);c.querySelectorAll(".footnote-backref, [data-footnote-backref], [role='doc-backlink']").forEach(_=>_.remove());const d=Ve.turndown(sn(c)).trim();d&&n.push(`[^${i}]: ${d.replace(/\n/g,`
|
|
571
|
+
`)}`)}),n.length>0?`
|
|
572
|
+
|
|
573
|
+
${n.join(`
|
|
574
|
+
`)}
|
|
575
|
+
`:""}}),Ve.addRule("footnotesList",{filter(t){var e;return t instanceof HTMLOListElement?(((e=t.parentElement)==null?void 0:e.id)??"")==="footnotes":!1},replacement(t,e){return e instanceof HTMLElement?`
|
|
576
|
+
|
|
577
|
+
${Array.from(e.children).map(r=>{var c,d;let n;if(r.id.startsWith("fn:"))n=r.id.replace("fn:","");else{const g=(c=r.id.split("/").pop())==null?void 0:c.match(/cite_note-(.+)/);n=g?g[1]:r.id}const o=r.querySelector("sup");o&&((d=o.textContent)==null?void 0:d.trim())===n&&o.remove();const i=Ve.turndown(sn(r)).replace(/\s*↩︎$/,"").trim();return`[^${n.toLowerCase()}]: ${i}`}).join(`
|
|
578
|
+
|
|
579
|
+
`)}
|
|
580
|
+
|
|
581
|
+
`:t}}),Ve.addRule("cleanLinks",{filter:"a",replacement(t,e){if(!(e instanceof HTMLElement))return t;const r=e.getAttribute("href"),n=e.getAttribute("title");if(!r)return t;const o=D2(r),i=t.trim().replace(/\s+/g," ");if(!i)return"";let c=`[${i}](${o}`;return n&&(c+=` "${n}"`),c+=")",c}}),Ve.addRule("complexLinkStructure",{filter(t){return t.nodeName==="A"&&t.childNodes.length>1&&Array.from(t.childNodes).some(e=>["H1","H2","H3","H4","H5","H6"].includes(e.nodeName))},replacement(t,e){if(!(e instanceof HTMLElement))return t;const r=e.getAttribute("href"),n=e.getAttribute("title"),o=e.querySelector("h1, h2, h3, h4, h5, h6"),i=o?Ve.turndown(sn(o)):"";o&&o.remove();const c=Ve.turndown(sn(e));let d=`${i}
|
|
582
|
+
|
|
583
|
+
${c}
|
|
584
|
+
|
|
585
|
+
`;return r&&(d+=`[View original](${r})`,n&&(d+=` "${n}"`)),d}});function B2(t,e){if(!e)return t;try{const r=new URL(e);return t.replace(/href="([^"]+)"/g,(n,o)=>{if(o.startsWith("http://")||o.startsWith("https://")||o.startsWith("//")||o.startsWith("#")||o.startsWith("data:")||o.startsWith("javascript:"))return n;try{return`href="${new URL(o,r).href}"`}catch{return n}}).replace(/src="([^"]+)"/g,(n,o)=>{if(o.startsWith("http://")||o.startsWith("https://")||o.startsWith("//")||o.startsWith("data:"))return n;try{return`src="${new URL(o,r).href}"`}catch{return n}})}catch{return t}}function F2(t){if(!t)return t;try{const e=new DOMParser().parseFromString(t,"text/html");return e.querySelectorAll("svg").forEach(r=>{const n=Number.parseInt(r.getAttribute("width")||"0"),o=Number.parseInt(r.getAttribute("height")||"0"),i=n>0&&n<=24||o>0&&o<=24,c=r.closest("a")!==null;(i||c)&&r.remove()}),e.body.innerHTML}catch{return t}}const z2=new Set(["span","a","strong","em","b","i","u","s","small","big","sub","sup","mark","abbr","cite","code","kbd","var","samp","font","label","time"]),Hu=new Set(["p","div","h1","h2","h3","h4","h5","h6","ul","ol","li","pre","blockquote","table","figure","hr","section","article","header","footer","nav","aside"]);function H2(t){let e=!0,r=0;for(;e&&r<10;){e=!1,r++;const n=Array.from(t.querySelectorAll(Array.from(z2).join(",")));for(const o of n)if(Array.from(o.children).some(i=>Hu.has(i.tagName.toLowerCase()))){const i=o.parentNode;if(i){for(;o.firstChild;)i.insertBefore(o.firstChild,o);i.removeChild(o),e=!0}}}}function U2(t,e){const r=[t,...Array.from(t.querySelectorAll(":scope > div, :scope > section, :scope > article"))];for(const n of r){if(n.querySelector(":scope > p"))continue;const o=Array.from(n.childNodes),i=o.some(E=>{var b;return E.nodeType===Node.TEXT_NODE&&(((b=E.textContent)==null?void 0:b.trim().length)??0)>0}),c=n.querySelector(":scope > br")!==null;if(!i&&!c)continue;const d=[];let g=[];const _=()=>{if(g.length===0)return;if(!g.map(b=>b.textContent||"").join("").trim()){g=[];return}const E=e.createElement("p");for(const b of g)E.appendChild(b);d.push(E),g=[]};for(const E of o)if(E.nodeType===Node.ELEMENT_NODE){const b=E.tagName.toLowerCase();if(b==="br"){_();continue}if(Hu.has(b)){_(),d.push(E);continue}g.push(E)}else E.nodeType===Node.TEXT_NODE&&((E.textContent||"").trim()||g.length>0)&&g.push(E);if(_(),d.length>0&&d.filter(E=>E.nodeType===Node.ELEMENT_NODE&&E.tagName.toLowerCase()==="p").length>0){n.innerHTML="";for(const E of d)n.appendChild(E)}}}function j2(t){if(!t)return t;try{const e=new DOMParser().parseFromString(t,"text/html"),r=e.body;return H2(r),U2(r,e),r.innerHTML}catch{return t}}function W2(t){let e=t;const r=e.match(/^# .+\n+/);return r&&(e=e.slice(r[0].length)),e=e.replace(new RegExp("\\n*(?<!!)\\[\\]\\([^)]+\\)\\n*","g"),""),e=e.replace(/\s+([,。!?;:、)】》])/g,"$1"),e=e.replace(new RegExp("(?<=[a-z0-9])\\\\_(?=[a-z0-9])","gi"),"_"),e=e.replace(new RegExp("(?<!\\[)\\*\\*((?:https?:\\/\\/)?(?:[a-z0-9-]+\\.)+[a-z]{2,}(?:\\/[^\\s*]*)?)\\*\\*(?!\\]\\()","gi"),"$1"),e=e.replace(/(\*\*)\1+(.+?)\1{2,}/g,"**$2**"),e=e.replace(/\n{3,}/g,`
|
|
586
|
+
|
|
587
|
+
`),e.trim()}function V2(t,e,r){var n,o,i,c,d,g;switch(r){case"title":return t.title||"";case"source":return e||"";case"author":return((n=t.meta)==null?void 0:n.author)||"";case"description":return t.excerpt||"";case"tags":return((o=t.meta)==null?void 0:o.tags)||[];case"created":return t.createdAt||new Date().toISOString();case"cover":return((c=(i=t.images)==null?void 0:i[0])==null?void 0:c.originalUrl)||"";case"origin":return((d=t.properties)==null?void 0:d.origin)??"";default:return((g=t.properties)==null?void 0:g[r])??""}}function Z2(t,e,r="YYYY-MM-DD"){if(t==null)return"";switch(e){case"number":{const n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?n:0}case"date":return t&&Po(t).isValid()?Po(t).format(r):"";case"datetime":if(t&&Po(t).isValid()){const n=/[Hhmsa]/.test(r.replace(/\[[^\]]*\]/g,""));return Po(t).format(n?r:`${r} HH:mm:ss`)}return"";case"checkbox":return typeof t=="string"?!["","false","0","no","off"].includes(t.trim().toLowerCase()):!!t;case"select":return String(t);case"multiselect":return Array.isArray(t)?t:t?[t]:[];case"text":default:return String(t)}}function G2(t,e,r,n="YYYY-MM-DD"){const o={},i=r&&r.length>0?r:Hr;for(const c of i){if(!c.enabled)continue;const d=V2(t,e,c.key);o[c.name]=Z2(d,c.type,n)}return o}async function Uu(t){await Nt.info("convert.html_to_markdown.start","收到 HTML 转 Markdown 请求",{context:"offscreen",data:{url:t.url,hasHtml:!!t.html}});try{const{html:e,url:r,clip:n,properties:o,dateFormat:i}=t;let c=B2(e||"",r);c=F2(c),c=j2(c);let d=Ve.turndown(c);d=W2(d);const g=G2(n,r,o,i);return await Nt.info("convert.html_to_markdown.success","HTML 转 Markdown 成功",{context:"offscreen",data:{markdownLength:d.length}}),{success:!0,markdown:d,frontMatter:g}}catch(e){return await Nt.error("convert.html_to_markdown.failed","HTML 转 Markdown 失败",{context:"offscreen",error:e instanceof Error?e:new Error(String(e))}),{success:!1,error:String(e)}}}const wn="forsion-page-highlight",Cn="forsion-image-highlight",Lr="data-forsion-highlight-id",Kn="#F8F3DE",Zt=new Map;let Or="",Xs="en",Zr,Sn,_n,oi,ju=0,Ks=!1,ii=!1,Gr=new Set,si=Promise.resolve();function Y2(t){Xs=t,Yr&&Yr.setAttribute("aria-label",t==="zh"?"移除划线":"Remove highlight")}function ai(){const t=new URL(location.href);return t.hash="",t.href}function Wu(){return`hl_${crypto.randomUUID()}`}function J2(){chrome.runtime.sendMessage({type:"clip-highlights-changed",url:Or||ai()}).catch(()=>{})}function Tn(){ii=!0,Zr&&clearTimeout(Zr),li(),J2()}async function li(){if(!Or||!ii){await si;return}ii=!1,Zr&&clearTimeout(Zr),Zr=void 0;const t={type:"clip-highlights-save",url:Or,title:document.title,highlights:structuredClone(Array.from(Zt.values()))},e=chrome.runtime.sendMessage(t);si=Promise.allSettled([si,e]);const r=await e.catch(()=>null);r!=null&&r.ok||console.warn("[Forsion Clip] Highlight persistence unavailable")}function Vu(t){const e=/^#[\da-f]{6}$/i.test(t)?t.slice(1):"F8F3DE",r=[0,2,4].map(n=>{const o=parseInt(e.slice(n,n+2),16)/255;return o<=.04045?o/12.92:((o+.055)/1.055)**2.4});return r[0]*.2126+r[1]*.7152+r[2]*.0722>.179?"#1c1c1c":"#ffffff"}function Zu(){if(document.getElementById("forsion-highlight-styles"))return;const t=document.createElement("style");t.id="forsion-highlight-styles",t.textContent=`.${wn}{border-radius:2px!important;padding:1px 0!important;color:var(--forsion-highlight-ink,#1c1c1c)!important;cursor:pointer}.${Cn}{outline:3px solid var(--forsion-highlight-color,${Kn})!important;outline-offset:3px!important}`,document.documentElement.append(t)}function Qs(t){if(t.nodeType===Node.TEXT_NODE)return[t];const e=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(n){const o=n.parentElement;return!o||o.closest('script,style,noscript,textarea,input,[contenteditable="true"],[id^="forsion-"]')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=[];for(let n=e.nextNode();n;n=e.nextNode())r.push(n);return r}function X2(t,e){const r=Qs(document.body);let n=0;for(const c of r){if(c===t.startContainer){n+=t.startOffset;break}n+=c.length}const o=r.map(c=>c.data).join(""),i=o.indexOf(e,Math.max(0,n-1));return i>=0&&(n=i),{prefix:o.slice(Math.max(0,n-40),n),suffix:o.slice(n+e.length,n+e.length+40),textPosition:n}}function Gu(t,e){var i;const n=Qs(t.commonAncestorContainer).filter(c=>t.intersectsNode(c)).map(c=>({node:c,start:c===t.startContainer?t.startOffset:0,end:c===t.endContainer?t.endOffset:c.length})).filter(c=>c.end>c.start);let o=0;for(const{node:c,start:d,end:g}of n.reverse()){if((i=c.parentElement)!=null&&i.closest(`mark.${wn}`))continue;const _=document.createRange();_.setStart(c,d),_.setEnd(c,g);const E=document.createElement("mark");E.className=wn,E.setAttribute(Lr,e.id),E.style.setProperty("background-color",e.color||Kn,"important"),E.style.setProperty("--forsion-highlight-ink",Vu(e.color||Kn)),e.note&&(E.title=e.note);try{_.surroundContents(E),o++}catch{}}return o>0}function Yu(){Or||(Or=ai()),Zu()}function Ju(t,e=Kn){Yu();const r=window.getSelection(),n=t||(r!=null&&r.rangeCount?r.getRangeAt(0):null);if(!n||n.collapsed)return null;const o=n.toString().trim();if(!o)return null;const i=document.createElement("div");i.append(n.cloneContents());const c={id:Wu(),text:o,html:i.innerHTML,color:e,xpath:Rs(n.startContainer),endXpath:Rs(n.endContainer),startOffset:n.startOffset,endOffset:n.endOffset,createdAt:new Date().toISOString(),...X2(n,o)};return Gu(n,c)?(Zt.set(c.id,c),Tn(),ro(),r==null||r.removeAllRanges(),c):null}function Xu(t,e=Kn){if(!(t instanceof HTMLImageElement)||!document.contains(t))return null;Yu();const r=t.currentSrc||t.src||t.dataset.src||"";if(!r||!/^https?:/.test(r))return null;const n=t.getAttribute(Lr);if(n)return Zt.get(n)||null;const o=document.createElement("img");o.src=r,o.alt=t.alt;const i={id:Wu(),type:"image",text:t.alt||(Xs==="zh"?"图片标注":"Image highlight"),html:o.outerHTML,imageUrl:r,imageAlt:t.alt,color:e,xpath:Rs(t),startOffset:0,endOffset:0,createdAt:new Date().toISOString()};return Ku(t,i),Zt.set(i.id,i),Tn(),ro(),i}function Ku(t,e){t.classList.add(Cn),t.setAttribute(Lr,e.id),t.style.setProperty("--forsion-highlight-color",e.color),e.note&&(t.dataset.forsionHighlightNote=e.note)}function ci(t){return Array.from(document.querySelectorAll(`[${Lr}]`)).filter(e=>e.getAttribute(Lr)===t&&(e.classList.contains(wn)||e.classList.contains(Cn)))}function ea(t){const e=t?ci(t):Array.from(document.querySelectorAll(`mark.${wn},img.${Cn}`));for(const r of e)if(r instanceof HTMLImageElement)r.classList.remove(Cn),r.removeAttribute(Lr),r.style.removeProperty("--forsion-highlight-color"),delete r.dataset.forsionHighlightNote;else{const n=r.parentNode;r.replaceWith(...Array.from(r.childNodes)),n==null||n.normalize()}}function ta(t){return Zt.has(t)?(ea(t),Zt.delete(t),Gr.delete(t),Tn(),!0):!1}function K2(){ea(),Zt.clear(),Gr.clear(),Tn(),to()}function an(){return Array.from(Zt.values())}function Qu(t,e){const r=Zt.get(t);return r?(r.note=e,ci(t).forEach(n=>{n instanceof HTMLElement&&!(n instanceof HTMLImageElement)&&(n.title=e)}),Tn(),!0):!1}function ed(t,e){if(!/^#[\da-f]{6}$/i.test(e))return!1;const r=Zt.get(t);if(!r)return!1;r.color=e;for(const n of ci(t))n instanceof HTMLElement&&(n instanceof HTMLImageElement?n.style.setProperty("--forsion-highlight-color",e):(n.style.setProperty("background-color",e,"important"),n.style.setProperty("--forsion-highlight-ink",Vu(e))));return Tn(),!0}function Q2(t){try{return document.evaluate(t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}function ex(t,e){var E,b;const r=e.text.replace(/\s+/g," ").trim();if(!r)return null;let n="";const o=[],i=[];for(let C=0;C<t.length;C++){const A=C;if(/\s/.test(t[C])){for(;C+1<t.length&&/\s/.test(t[C+1]);)C++;n+=" "}else n+=t[C];o.push(A),i.push(C+1)}const c=((E=e.prefix)==null?void 0:E.replace(/\s+/g," "))||"",d=((b=e.suffix)==null?void 0:b.replace(/\s+/g," "))||"";let g=null,_=-1/0;for(let C=n.indexOf(r);C>=0;C=n.indexOf(r,C+1)){const A=o[C],a=i[C+r.length-1],s=(c&&n.slice(Math.max(0,C-c.length),C)===c?1e3:0)+(d&&n.slice(C+r.length,C+r.length+d.length)===d?1e3:0),l=e.textPosition===void 0?0:Math.min(999,Math.abs(A-e.textPosition));s-l>_&&(_=s-l,g={start:A,end:a})}return g}function ra(t,e,r){const n=Qs(t),o=n.map(b=>b.data).join(""),i=ex(o,r?e:{...e,textPosition:void 0});if(!i)return null;const c=i.start;let d=0,g,_;for(const b of n){!g&&c>=d&&c<d+b.length&&(g=[b,c-d]);const C=i.end;if(C>d&&C<=d+b.length){_=[b,C-d];break}d+=b.length}if(!g||!_)return null;const E=document.createRange();return E.setStart(...g),E.setEnd(..._),E}function tx(t){if(ci(t.id).length)return!0;if(t.type==="image"){const n=Array.from(document.images).find(o=>(o.currentSrc||o.src||o.dataset.src)===t.imageUrl&&!o.hasAttribute(Lr));return n?(Ku(n,t),!0):!1}const e=Q2(t.xpath),r=t.prefix||t.suffix?ra(document.body,t,!0):(e?ra(e,t,!1):null)||ra(document.body,t,!0);return!!r&&Gu(r,t)}function na(){for(const t of Gr){const e=Zt.get(t);(!e||tx(e))&&Gr.delete(t)}Gr.size||ui()}function ui(){Sn==null||Sn.disconnect(),Sn=void 0,_n&&clearTimeout(_n),oi&&clearTimeout(oi),_n=oi=void 0}async function Qn(t=!1){const e=ai();if(!t&&e===Or&&Ks){na();return}const r=++ju;t&&(ii=!1,Zr&&clearTimeout(Zr),Zr=void 0,await si),Or&&Or!==e&&await li(),ui(),ea(),Zt.clear(),Gr.clear(),Or=e,Ks=!1,Zu();const n=await chrome.runtime.sendMessage({type:"clip-highlights-get",url:e}).catch(()=>null);if(!(r!==ju||ai()!==e)){for(const o of Array.isArray(n==null?void 0:n.highlights)?n.highlights:[])typeof o.id!="string"||typeof o.text!="string"||(Zt.set(o.id,o),Gr.add(o.id));Ks=!0,na(),ro(),Gr.size&&(Sn=new MutationObserver(()=>{_n&&clearTimeout(_n),_n=setTimeout(na,150)}),Sn.observe(document.documentElement,{childList:!0,subtree:!0}),oi=setTimeout(ui,3e4))}}function rx(){ui(),ox(),li()}let Yr=null,eo,oa=!1,ia;function sa(t){ia=t,to()}function to(){Yr&&(Yr.hidden=!0)}function td(){eo=setTimeout(to,250)}function nx(){if(Yr)return Yr;const t=document.createElement("button");return t.id="forsion-highlight-remove",t.type="button",t.textContent="×",t.setAttribute("aria-label",Xs==="zh"?"移除划线":"Remove highlight"),t.style.cssText="position:fixed;z-index:2147483647;width:22px;height:22px;border:0;border-radius:50%;background:#34373e;color:white;cursor:pointer;line-height:20px;padding:0;font:16px system-ui",t.hidden=!0,t.addEventListener("mouseenter",()=>{eo&&clearTimeout(eo)}),t.addEventListener("mouseleave",td),t.addEventListener("click",e=>{e.isTrusted&&(e.preventDefault(),e.stopPropagation(),t.dataset.highlightId&&ta(t.dataset.highlightId),to())}),document.documentElement.append(t),Yr=t,t}function rd(t){var o,i;if(!t.isTrusted)return;const e=(i=(o=t.target)==null?void 0:o.closest)==null?void 0:i.call(o,`mark.${wn},img.${Cn}`);if(!e)return;if(eo&&clearTimeout(eo),ia){const c=Zt.get(e.getAttribute(Lr)||"");c&&ia(c,e.getBoundingClientRect());return}const r=nx(),n=e.getBoundingClientRect();r.dataset.highlightId=e.getAttribute(Lr)||"",r.style.left=`${Math.min(n.right,window.innerWidth-26)}px`,r.style.top=`${Math.max(4,n.top-12)}px`,r.hidden=!1}function nd(t){t.relatedTarget!==Yr&&td()}function ro(){oa||(oa=!0,document.addEventListener("mouseover",rd,!0),document.addEventListener("mouseout",nd,!0))}function ox(){document.removeEventListener("mouseover",rd,!0),document.removeEventListener("mouseout",nd,!0),to(),oa=!1}const aa=[{name:"yellow",hex:"#F8F3DE",label:"重点"},{name:"red",hex:"#FBE3E3",label:"疑问"},{name:"green",hex:"#E1F3E5",label:"启发"},{name:"blue",hex:"#DFEBFB",label:"定义"},{name:"purple",hex:"#EFE4FA",label:"行动"}];function ix(t){const e=aa.find(r=>r.hex.toLowerCase()===(t||"").toLowerCase());return e&&e.name!=="yellow"?e.label:null}function di(t){if(typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t))return String(t);const e=String(t),r=/^(?:null|true|false|yes|no|on|off|y|n|~|[-+]?(?:\.(?:inf|nan)|(?:\d[\d_]*(?:\.\d*)?|\.\d+)(?:e[-+]?\d+)?|0[xob][a-f0-9_]+))$/i.test(e)||/^\d{4}-\d{1,2}-\d{1,2}(?:$|[Tt\s])/.test(e);return!e||r||/^[\s]|[\s]$|[:#\-?{}\[\],&*!|<>'"%@`]|[\x00-\x1f\x7f\u0085\u2028\u2029]/.test(e)?JSON.stringify(e).replace(/[\u0085\u2028\u2029]/g,n=>`\\u${n.charCodeAt(0).toString(16).padStart(4,"0")}`):e}function od(t){const e=[];for(const[r,n]of Object.entries(t))if(!(n==null||n===""||Array.isArray(n)&&n.length===0))if(Array.isArray(n)){e.push(`${di(r)}:`);for(const o of n)e.push(` - ${di(o)}`)}else e.push(`${di(r)}: ${di(n)}`);return e.length?`---
|
|
588
|
+
${e.join(`
|
|
589
|
+
`)}
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
`:""}function id(t,e="zh"){const r=t.filter(n=>n.type==="image"?!!n.imageUrl:!!n.text).map(n=>{var c;const o=e==="zh"?ix(n.color):{red:"Question",green:"Insight",blue:"Definition",purple:"Action"}[["#FBE3E3","#E1F3E5","#DFEBFB","#EFE4FA"].includes(n.color.toUpperCase())?{"#FBE3E3":"red","#E1F3E5":"green","#DFEBFB":"blue","#EFE4FA":"purple"}[n.color.toUpperCase()]:""];if(n.type==="image"&&n.imageUrl&&/^https?:\/\//i.test(n.imageUrl))return`> ![${(n.imageAlt||n.text||"").replace(/[\[\]\n]/g," ")}](<${n.imageUrl.replace(/[<>\s]/g,encodeURIComponent)}>)${n.note?`
|
|
593
|
+
> `+n.note.replace(/\n/g," "):""}`;let i="> "+(o?`**[${o}]** `:"")+n.text.replace(/\s*\n\s*/g," ").trim();return(c=n.note)!=null&&c.trim()&&(i+=(e==="zh"?`
|
|
594
|
+
> — 备注:`:`
|
|
595
|
+
> — Note: `)+n.note.replace(/\s*\n\s*/g," ").trim()),i});return r.length?`
|
|
596
|
+
|
|
597
|
+
## ${e==="zh"?"划线摘录":"Highlights"}
|
|
598
|
+
|
|
599
|
+
${r.join(`
|
|
600
|
+
>
|
|
601
|
+
`)}
|
|
602
|
+
`:""}function sx(t){const e=t.frontMatter?od(t.frontMatter):"",r=(t.includeHighlights??!0)&&t.highlights?id(t.highlights,t.locale):"";return e+t.body+r}function Dn(t,e,r,n=""){return{ok:!1,error:t,title:n,url:e,site:r,markdown:"",frontMatter:{},document:"",highlights:[]}}function sd(t,e,r=an(),n){const o=sx({frontMatter:e.frontMatter,body:e.markdown,highlights:r});return{ok:!0,title:t.title,url:t.url,site:t.site,excerpt:t.excerpt,markdown:e.markdown,frontMatter:e.frontMatter,frontMatterFields:n==null?void 0:n.map(i=>({...i})),createdAt:t.createdAt,document:o,meta:t.meta,highlights:r}}function ax(t,e){const r=p0(t,e);if(!r)return{};const n=(r.include||[]).map(c=>c.trim()).filter(Boolean),o=(r.exclude||[]).map(c=>c.trim()).filter(Boolean),i=(r.repeatedBlocks||[]).filter(c=>{var d;return c.enabled!==!1&&((d=c.container)==null?void 0:d.trim())});return{metadataSelectors:r.metadataSelectors,filter:n.length||o.length||i.length?{include:n,exclude:o,templates:i}:void 0}}async function fi(t,e){var E,b;const r=t==="selection"?Kv():null,n=t==="link"&&e?new URL(e,location.href).href:location.href,o=new URL(n).hostname;if(!/^https?:/.test(n))return Dn("Unsupported page URL",n,o);const i=await chrome.runtime.sendMessage({type:"clip-content-state",url:location.href}).catch(()=>null),c=(i==null?void 0:i.locale)==="zh"?"zh":"en";jc(c);let d;if(t==="link"){const C=n===location.href,A=Array.from(document.querySelectorAll("a[href]")).find(l=>l.href===n),a=C?document.title||o:((E=A==null?void 0:A.textContent)==null?void 0:E.trim())||n,s=C&&((b=document.querySelector('meta[name="description"], meta[property="og:description"]'))==null?void 0:b.content)||"";d={url:n,site:o,title:a,excerpt:s,contentHtml:`<p><a href="${jr(n)}">${jr(a)}</a></p>${s?`<p>${jr(s)}</p>`:""}`,createdAt:new Date().toISOString()}}else if(t==="selection"){const C=r;if(!C)return Dn(c==="zh"?"没有选中任何内容":"Select some text first",n,o);d={url:n,site:o,title:document.title||o,contentHtml:Cr(C),createdAt:new Date().toISOString()}}else{if(document.visibilityState==="hidden"&&!await lx(document))return Dn(c==="zh"?"页面正文在 15 秒内未稳定。请打开页面完成加载后重试。":"Page content did not stabilize within 15 seconds. Open the page, let it load and try again.",n,o);const C=ax(Array.isArray(i==null?void 0:i.templates)?i.templates:[],n);d=await Jv(document,n,C.filter,C.metadataSelectors)}const g=fs(i==null?void 0:i.frontmatter),_=await Uu({html:d.contentHtml,url:n,clip:d,properties:g.fields,dateFormat:g.dateFormat});return _.success?sd(d,_,t==="selection"?[]:an(),g.fields):Dn(_.error,n,o,d.title)}async function hi(t,e={}){const r=location.href,n=location.hostname;if(!t.trim())return Dn("Select a page region first",r,n);const o={url:r,site:n,title:document.title||n,contentHtml:Cr(t),createdAt:new Date().toISOString()},i=await chrome.runtime.sendMessage({type:"clip-content-state",url:r}).catch(()=>null),c=fs(i==null?void 0:i.frontmatter),d=await Uu({html:o.contentHtml,url:r,clip:o,properties:c.fields,dateFormat:c.dateFormat});return d.success?sd(o,d,e.includeHighlights===!1?[]:an(),c.fields):Dn(d.error,r,n,o.title)}async function lx(t,e=15e3){var c;const n=Date.now()+Math.max(0,Math.min(e,15e3));let o="",i=0;for(;Date.now()<n;){const d=t.querySelector("article, main, [role='main']")||t.body,g=((c=d==null?void 0:d.textContent)==null?void 0:c.trim())||"",_=Array.from((d==null?void 0:d.querySelectorAll("img, video, iframe"))||[]).map(C=>C.getAttribute("src")||C.getAttribute("data-src")||"").join("|"),E=`${g}
|
|
603
|
+
${_}`;if(i=(g.length>=100||d!==t.body&&_.length>0)&&E===o?i+1:0,i>=3)return!0;o=E,await new Promise(C=>setTimeout(C,Math.min(250,Math.max(0,n-Date.now()))))}return!1}let kn,br;function cx(t,e){br==null||br(t,e)}function no(){kn==null||kn()}function oo(){const t=window.getSelection();if(!t||t.isCollapsed||!t.rangeCount)return null;const e=t.getRangeAt(0),r=e.commonAncestorContainer,n=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;return n!=null&&n.closest('input,textarea,select,[contenteditable]:not([contenteditable="false"]),[id^="forsion-"]')?null:e.toString().trim()?e:null}function ux(t){var U;if(kn)return no;const e=(F,I)=>t.locale==="zh"?F:I,r=document.createElement("div");r.id="forsion-selection-toolbar-host";const n=r.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=Oi;const i=document.createElement("div");i.className="surface bar",i.hidden=!0,i.setAttribute("role","toolbar"),i.setAttribute("aria-label",e("Forsion 选区操作","Forsion selection actions")),n.append(o,i),document.documentElement.append(r);const c=Ri(r,t.theme);let d=null,g=null,_,E,b,C=((U=t.preferences)==null?void 0:U.defaultColor)||aa[0].hex,A,a,s,l;function u(F=!1){a==null||a.remove(),a=void 0,s==null||s.setAttribute("aria-expanded","false"),F&&(s==null||s.focus()),s=void 0}const m=()=>{u(),A==null||A.remove(),A=void 0,l==null||l.remove(),l=void 0,n.activeElement instanceof HTMLElement&&n.activeElement.blur(),i.hidden=!0},x=()=>{if(d){const F=window.getSelection();F==null||F.removeAllRanges(),F==null||F.addRange(d)}},f=()=>{b&&clearTimeout(b),b=setTimeout(()=>{!oo()&&!A&&!a&&!n.activeElement&&m()},450)};function v(F,I,H=""){const V=Xt(F,I,H);return i.append(V),V}function p(F){var I,H;C=F,((I=t.preferences)==null?void 0:I.rememberColor)!==!1&&((H=t.onRememberColor)==null||H.call(t,F))}function h(F){var I,H;p(F),_?(I=t.onSetHighlightColor)==null||I.call(t,_.id,F):E?(H=t.onImageHighlight)==null||H.call(t,E,F):d&&(x(),t.onHighlight(d,F)),m()}function w(F,I=""){if(s===F&&a){u(!0);return}return u(),s=F,F.setAttribute("aria-expanded","true"),a=document.createElement("div"),a.className=`surface submenu ${I}`,a.setAttribute("role","menu"),n.append(a),a}function O(F){var H;if(!a)return;const I=F.getBoundingClientRect();fn(a,I.left,I.bottom+6,I.top-6),(H=a.querySelector("button"))==null||H.focus()}function M(F){var I;g&&(E&&!_&&((I=t.onImageHighlight)==null||I.call(t,E,C)),x(),t.onSave?t.onSave(g,F):d&&t.onClipSelection(d),m())}function $(F,I,H){var Y;const V=t.destinations||[],X=((Y=t.preferences)==null?void 0:Y.showDestinationSelector)!==!1&&V.length>1,ne=v(F+(X?" ▾":""),()=>{if(!X){I();return}const W=w(ne);if(W){W.setAttribute("aria-label",e("保存目标","Save destination"));for(const J of V){const G=Xt(J.label,()=>I(J.id));G.setAttribute("role","menuitem"),W.append(G)}O(ne)}},H);X&&(ne.setAttribute("aria-haspopup","menu"),ne.setAttribute("aria-expanded","false"))}function T(){if(!_||!t.onSetHighlightNote)return;const F=_.id;u(),l==null||l.remove(),l=void 0,A==null||A.remove(),A=document.createElement("div"),A.className="surface note-editor",A.setAttribute("role","dialog"),A.setAttribute("aria-label",e("划线批注","Highlight note"));const I=document.createElement("label");I.textContent=e("批注","Note");const H=document.createElement("textarea");H.value=_.note||"",H.maxLength=2e4,H.setAttribute("aria-label",e("批注内容","Note text")),H.addEventListener("keydown",ne=>{var Y;ne.isTrusted&&ne.key==="Enter"&&(ne.ctrlKey||ne.metaKey)&&(ne.preventDefault(),ne.stopPropagation(),(Y=t.onSetHighlightNote)==null||Y.call(t,F,H.value),m())}),I.append(H);const V=document.createElement("footer");V.append(Xt(e("取消","Cancel"),()=>{A==null||A.remove(),A=void 0}),Xt(e("保存批注","Save note"),()=>{var ne;(ne=t.onSetHighlightNote)==null||ne.call(t,F,H.value),m()})),A.append(I,V),n.append(A);const X=i.getBoundingClientRect();fn(A,X.left,X.bottom+6,X.top),H.focus()}function D(){var I,H;if(i.replaceChildren(),!g)return;const F=((I=t.preferences)==null?void 0:I.actions)||["highlight","copy","save","save-all","flomo","translate","explain","grammar","mnemonic","vocabulary"];for(const V of[...new Set(F)])if(V==="highlight"){v(_?e("取消划线","Remove highlight"):g.image?e("标注图片","Highlight image"):e("划线","Highlight"),()=>{var ne;_?((ne=t.onRemoveHighlight)==null||ne.call(t,_.id),m()):h(C)},"highlight");const X=v(e("颜色","Color"),()=>{const ne=w(X,"colors");if(!ne)return;ne.setAttribute("aria-label",e("划线颜色","Highlight color"));const Y=[e("重点","Important"),e("疑问","Question"),e("启发","Idea"),e("定义","Definition"),e("行动","Action")];aa.forEach((W,J)=>{const G=Xt("",()=>h(W.hex),"dot");G.style.background=W.hex,G.title=`${e("划线","Highlight")} · ${Y[J]}`,G.setAttribute("aria-label",G.title),G.setAttribute("role","menuitemradio"),G.setAttribute("aria-checked",String(((_==null?void 0:_.color)||C).toLowerCase()===W.hex.toLowerCase())),ne.append(G)}),O(X)},"palette");X.setAttribute("aria-haspopup","menu"),X.setAttribute("aria-expanded","false"),X.style.setProperty("--highlight-color",(_==null?void 0:_.color)||C)}else if(V==="copy"&&t.onCopy&&!g.image)v(e("复制","Copy"),()=>{var X;(X=t.onCopy)==null||X.call(t,g.text),m()},"copy");else if(V==="save")$(g.image?e("保存图片","Save image"):_?e("保存划线","Save highlight"):e("剪藏选区","Clip selection"),M,"clip");else if(V==="save-all"&&t.onSaveAll)$(e("保存全部划线","Save all highlights"),X=>{var ne;(ne=t.onSaveAll)==null||ne.call(t,X),m()},"save-all");else if(V==="flomo"&&t.flomoConfigured&&t.onSave)v("flomo",()=>M("flomo"),"flomo");else if(["translate","explain","grammar","mnemonic"].includes(V)&&t.onRead&&!g.image){const X=V;if(((H=t.preferences)==null?void 0:H[`${X}Enabled`])===!1)continue;const ne={translate:e("翻译","Translate"),explain:e("解释","Explain"),grammar:e("语法","Grammar"),mnemonic:e("助记","Mnemonic")}[X];v(ne,()=>{var W;const Y=g;m(),(W=t.onRead)==null||W.call(t,X,Y)},X)}else V==="vocabulary"&&!g.image&&v(e("生词","Vocabulary"),()=>{x(),t.onVocabulary?t.onVocabulary(g):d&&t.onAddVocab(d),m()},"vocab");if(_&&t.onSetHighlightNote&&v(e("批注","Note"),T,"note"),t.onDisableSite){const V=document.createElement("span");V.className="sep",i.append(V),v(e("本站关闭","Disable on this site"),()=>{var X;(X=t.onDisableSite)==null||X.call(t),m()},"disable-site")}}function R(){var V,X;if(!g||((V=t.preferences)==null?void 0:V.toolbarPosition)==="hidden")return;u(),l==null||l.remove(),l=void 0,D(),i.hidden=!1;const F=g.anchor,H=((X=t.preferences)==null?void 0:X.toolbarPosition)!=="below"&&F.top-i.offsetHeight-8>=8?F.top-i.offsetHeight-8:F.bottom+8;if(fn(i,F.left+F.width/2,H,F.top-8,!0),_!=null&&_.note){l=document.createElement("div"),l.className="surface note-tooltip",l.setAttribute("role","tooltip"),l.textContent=_.note,n.append(l);const ne=i.getBoundingClientRect();fn(l,ne.left,Math.max(ne.bottom,F.bottom)+5,F.top-8)}}br=(F,I)=>{if(oo()||A||a)return;if(!i.hidden&&(_==null?void 0:_.id)===F.id){b&&clearTimeout(b);return}_=F,d=null,E=void 0;const H=Array.from(document.querySelectorAll("[data-forsion-highlight-id]")).find(X=>X.getAttribute("data-forsion-highlight-id")===F.id),V=H?document.createRange():null;H&&V&&V.selectNodeContents(H),g={text:F.text,html:F.html,note:F.note,highlightId:F.id,image:F.type==="image",context:V?Ra(V,F.text):{},anchor:{left:I.left,top:I.top,right:I.right,bottom:I.bottom,width:I.width,height:I.height}},b&&clearTimeout(b),R()};const S=F=>{var H,V,X;if(!F.isTrusted||F.composedPath().includes(r)||F.composedPath().some(ne=>ne instanceof HTMLElement&&ne.id==="forsion-selection-result-host"))return;const I=oo();if(I)d=I.cloneRange(),g=Ud(d),_=void 0,E=void 0,R();else if(F.type==="mouseup"){const ne=(V=(H=F.target)==null?void 0:H.closest)==null?void 0:V.call(H,"[data-forsion-highlight-id]"),Y=ne&&((X=t.getHighlight)==null?void 0:X.call(t,ne.getAttribute("data-forsion-highlight-id")||""));Y&&ne?br==null||br(Y,ne.getBoundingClientRect()):F.target instanceof HTMLImageElement?L(F):m()}},y=()=>{!oo()&&!_&&!E&&!n.activeElement&&m()},k=F=>{F.isTrusted&&!F.composedPath().includes(r)&&m()},N=F=>{var X,ne;if(!F.isTrusted)return;if(F.key==="Escape"){a?(F.preventDefault(),F.stopPropagation(),u(!0)):m();return}if(!F.composedPath().includes(r)||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(F.key)||((X=n.activeElement)==null?void 0:X.tagName)==="TEXTAREA")return;const I=Array.from((a||i).querySelectorAll("button:not(:disabled)")),H=I.indexOf(n.activeElement);if(H<0)return;F.preventDefault();const V=F.key==="Home"?0:F.key==="End"?I.length-1:(H+(["ArrowLeft","ArrowUp"].includes(F.key)?-1:1)+I.length)%I.length;(ne=I[V])==null||ne.focus()};i.addEventListener("mouseenter",()=>{b&&clearTimeout(b)}),i.addEventListener("mouseleave",f);const L=F=>{var V,X,ne;if(!F.isTrusted)return;if(F.composedPath().some(Y=>Y instanceof HTMLElement&&Y.id.startsWith("forsion-"))){b&&clearTimeout(b);return}const I=(X=(V=F.target)==null?void 0:V.closest)==null?void 0:X.call(V,"[data-forsion-highlight-id]"),H=I&&((ne=t.getHighlight)==null?void 0:ne.call(t,I.getAttribute("data-forsion-highlight-id")||""));if(H&&I){br==null||br(H,I.getBoundingClientRect());return}if(F.target instanceof HTMLImageElement&&t.onImageHighlight&&!oo()&&!A&&!a){const Y=F.target,W=Y.getBoundingClientRect(),J=Y.currentSrc||Y.src;if(W.width<32||W.height<32||!/^https?:/.test(J)||getComputedStyle(Y).visibility==="hidden")return;if(!i.hidden&&E===Y){b&&clearTimeout(b);return}E=Y,d=null,_=void 0;const G=document.createElement("img");G.src=J,G.alt=Y.alt,g={text:Y.alt||e("图片","Image"),html:G.outerHTML,context:{},image:!0,anchor:{left:W.left,top:W.top,right:W.right,bottom:W.bottom,width:W.width,height:W.height}},b&&clearTimeout(b),R()}},P=F=>{F.relatedTarget!==r&&f()},B=()=>m();return document.addEventListener("mouseup",S,!0),document.addEventListener("keyup",S,!0),document.addEventListener("selectionchange",y),document.addEventListener("mousedown",k,!0),document.addEventListener("keydown",N,!0),document.addEventListener("mouseover",L,!0),document.addEventListener("mouseout",P,!0),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),window.addEventListener("pagehide",B),kn=()=>{b&&clearTimeout(b),c(),document.removeEventListener("mouseup",S,!0),document.removeEventListener("keyup",S,!0),document.removeEventListener("selectionchange",y),document.removeEventListener("mousedown",k,!0),document.removeEventListener("keydown",N,!0),document.removeEventListener("mouseover",L,!0),document.removeEventListener("mouseout",P,!0),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),window.removeEventListener("pagehide",B),r.remove(),br=void 0,kn=void 0},no}function la(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ln=la();function ad(t){ln=t}const ld=/[&<>"']/,dx=new RegExp(ld.source,"g"),cd=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,fx=new RegExp(cd.source,"g"),hx={"&":"&","<":"<",">":">",'"':""","'":"'"},ud=t=>hx[t];function or(t,e){if(e){if(ld.test(t))return t.replace(dx,ud)}else if(cd.test(t))return t.replace(fx,ud);return t}const mx=/(^|[^\[])\^/g;function st(t,e){let r=typeof t=="string"?t:t.source;e=e||"";const n={replace:(o,i)=>{let c=typeof i=="string"?i:i.source;return c=c.replace(mx,"$1"),r=r.replace(o,c),n},getRegex:()=>new RegExp(r,e)};return n}function dd(t){try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const io={exec:()=>null};function fd(t,e){const r=t.replace(/\|/g,(i,c,d)=>{let g=!1,_=c;for(;--_>=0&&d[_]==="\\";)g=!g;return g?"|":" |"}),n=r.split(/ \|/);let o=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;o<n.length;o++)n[o]=n[o].trim().replace(/\\\|/g,"|");return n}function so(t,e,r){const n=t.length;if(n===0)return"";let o=0;for(;o<n&&t.charAt(n-o-1)===e;)o++;return t.slice(0,n-o)}function px(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return-1}function hd(t,e,r,n){const o=e.href,i=e.title?or(e.title):null,c=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){n.state.inLink=!0;const d={type:"link",raw:r,href:o,title:i,text:c,tokens:n.inlineTokens(c)};return n.state.inLink=!1,d}return{type:"image",raw:r,href:o,title:i,text:or(c)}}function gx(t,e){const r=t.match(/^(\s+)(?:```)/);if(r===null)return e;const n=r[1];return e.split(`
|
|
604
|
+
`).map(o=>{const i=o.match(/^\s+/);if(i===null)return o;const[c]=i;return c.length>=n.length?o.slice(n.length):o}).join(`
|
|
605
|
+
`)}class mi{constructor(e){Je(this,"options");Je(this,"rules");Je(this,"lexer");this.options=e||ln}space(e){const r=this.rules.block.newline.exec(e);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(e){const r=this.rules.block.code.exec(e);if(r){const n=r[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:so(n,`
|
|
606
|
+
`)}}}fences(e){const r=this.rules.block.fences.exec(e);if(r){const n=r[0],o=gx(n,r[3]||"");return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:o}}}heading(e){const r=this.rules.block.heading.exec(e);if(r){let n=r[2].trim();if(/#$/.test(n)){const o=so(n,"#");(this.options.pedantic||!o||/ $/.test(o))&&(n=o.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const r=this.rules.block.hr.exec(e);if(r)return{type:"hr",raw:so(r[0],`
|
|
607
|
+
`)}}blockquote(e){const r=this.rules.block.blockquote.exec(e);if(r){let n=so(r[0],`
|
|
608
|
+
`).split(`
|
|
609
|
+
`),o="",i="";const c=[];for(;n.length>0;){let d=!1;const g=[];let _;for(_=0;_<n.length;_++)if(/^ {0,3}>/.test(n[_]))g.push(n[_]),d=!0;else if(!d)g.push(n[_]);else break;n=n.slice(_);const E=g.join(`
|
|
610
|
+
`),b=E.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
611
|
+
$1`).replace(/^ {0,3}>[ \t]?/gm,"");o=o?`${o}
|
|
612
|
+
${E}`:E,i=i?`${i}
|
|
613
|
+
${b}`:b;const C=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(b,c,!0),this.lexer.state.top=C,n.length===0)break;const A=c[c.length-1];if((A==null?void 0:A.type)==="code")break;if((A==null?void 0:A.type)==="blockquote"){const a=A,s=a.raw+`
|
|
614
|
+
`+n.join(`
|
|
615
|
+
`),l=this.blockquote(s);c[c.length-1]=l,o=o.substring(0,o.length-a.raw.length)+l.raw,i=i.substring(0,i.length-a.text.length)+l.text;break}else if((A==null?void 0:A.type)==="list"){const a=A,s=a.raw+`
|
|
616
|
+
`+n.join(`
|
|
617
|
+
`),l=this.list(s);c[c.length-1]=l,o=o.substring(0,o.length-A.raw.length)+l.raw,i=i.substring(0,i.length-a.raw.length)+l.raw,n=s.substring(c[c.length-1].raw.length).split(`
|
|
618
|
+
`);continue}}return{type:"blockquote",raw:o,tokens:c,text:i}}}list(e){let r=this.rules.block.list.exec(e);if(r){let n=r[1].trim();const o=n.length>1,i={type:"list",raw:"",ordered:o,start:o?+n.slice(0,-1):"",loose:!1,items:[]};n=o?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=o?n:"[*+-]");const c=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let d=!1;for(;e;){let g=!1,_="",E="";if(!(r=c.exec(e))||this.rules.block.hr.test(e))break;_=r[0],e=e.substring(_.length);let b=r[2].split(`
|
|
619
|
+
`,1)[0].replace(/^\t+/,u=>" ".repeat(3*u.length)),C=e.split(`
|
|
620
|
+
`,1)[0],A=!b.trim(),a=0;if(this.options.pedantic?(a=2,E=b.trimStart()):A?a=r[1].length+1:(a=r[2].search(/[^ ]/),a=a>4?1:a,E=b.slice(a),a+=r[1].length),A&&/^[ \t]*$/.test(C)&&(_+=C+`
|
|
621
|
+
`,e=e.substring(C.length+1),g=!0),!g){const u=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),m=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),x=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),f=new RegExp(`^ {0,${Math.min(3,a-1)}}#`),v=new RegExp(`^ {0,${Math.min(3,a-1)}}<(?:[a-z].*>|!--)`,"i");for(;e;){const p=e.split(`
|
|
622
|
+
`,1)[0];let h;if(C=p,this.options.pedantic?(C=C.replace(/^ {1,4}(?=( {4})*[^ ])/g," "),h=C):h=C.replace(/\t/g," "),x.test(C)||f.test(C)||v.test(C)||u.test(C)||m.test(C))break;if(h.search(/[^ ]/)>=a||!C.trim())E+=`
|
|
623
|
+
`+h.slice(a);else{if(A||b.replace(/\t/g," ").search(/[^ ]/)>=4||x.test(b)||f.test(b)||m.test(b))break;E+=`
|
|
624
|
+
`+C}!A&&!C.trim()&&(A=!0),_+=p+`
|
|
625
|
+
`,e=e.substring(p.length+1),b=h.slice(a)}}i.loose||(d?i.loose=!0:/\n[ \t]*\n[ \t]*$/.test(_)&&(d=!0));let s=null,l;this.options.gfm&&(s=/^\[[ xX]\] /.exec(E),s&&(l=s[0]!=="[ ] ",E=E.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:_,task:!!s,checked:l,loose:!1,text:E,tokens:[]}),i.raw+=_}i.items[i.items.length-1].raw=i.items[i.items.length-1].raw.trimEnd(),i.items[i.items.length-1].text=i.items[i.items.length-1].text.trimEnd(),i.raw=i.raw.trimEnd();for(let g=0;g<i.items.length;g++)if(this.lexer.state.top=!1,i.items[g].tokens=this.lexer.blockTokens(i.items[g].text,[]),!i.loose){const _=i.items[g].tokens.filter(b=>b.type==="space"),E=_.length>0&&_.some(b=>/\n.*\n/.test(b.raw));i.loose=E}if(i.loose)for(let g=0;g<i.items.length;g++)i.items[g].loose=!0;return i}}html(e){const r=this.rules.block.html.exec(e);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(e){const r=this.rules.block.def.exec(e);if(r){const n=r[1].toLowerCase().replace(/\s+/g," "),o=r[2]?r[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:o,title:i}}}table(e){const r=this.rules.block.table.exec(e);if(!r||!/[:|]/.test(r[2]))return;const n=fd(r[1]),o=r[2].replace(/^\||\| *$/g,"").split("|"),i=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(`
|
|
626
|
+
`):[],c={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===o.length){for(const d of o)/^ *-+: *$/.test(d)?c.align.push("right"):/^ *:-+: *$/.test(d)?c.align.push("center"):/^ *:-+ *$/.test(d)?c.align.push("left"):c.align.push(null);for(let d=0;d<n.length;d++)c.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:c.align[d]});for(const d of i)c.rows.push(fd(d,c.header.length).map((g,_)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:c.align[_]})));return c}}lheading(e){const r=this.rules.block.lheading.exec(e);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(e){const r=this.rules.block.paragraph.exec(e);if(r){const n=r[1].charAt(r[1].length-1)===`
|
|
627
|
+
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const r=this.rules.block.text.exec(e);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(e){const r=this.rules.inline.escape.exec(e);if(r)return{type:"escape",raw:r[0],text:or(r[1])}}tag(e){const r=this.rules.inline.tag.exec(e);if(r)return!this.lexer.state.inLink&&/^<a /i.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(e){const r=this.rules.inline.link.exec(e);if(r){const n=r[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const c=so(n.slice(0,-1),"\\");if((n.length-c.length)%2===0)return}else{const c=px(r[2],"()");if(c>-1){const g=(r[0].indexOf("!")===0?5:4)+r[1].length+c;r[2]=r[2].substring(0,c),r[0]=r[0].substring(0,g).trim(),r[3]=""}}let o=r[2],i="";if(this.options.pedantic){const c=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);c&&(o=c[1],i=c[3])}else i=r[3]?r[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(n)?o=o.slice(1):o=o.slice(1,-1)),hd(r,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer)}}reflink(e,r){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const o=(n[2]||n[1]).replace(/\s+/g," "),i=r[o.toLowerCase()];if(!i){const c=n[0].charAt(0);return{type:"text",raw:c,text:c}}return hd(n,i,n[0],this.lexer)}}emStrong(e,r,n=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!o||o[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const c=[...o[0]].length-1;let d,g,_=c,E=0;const b=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,r=r.slice(-1*e.length+c);(o=b.exec(r))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(g=[...d].length,o[3]||o[4]){_+=g;continue}else if((o[5]||o[6])&&c%3&&!((c+g)%3)){E+=g;continue}if(_-=g,_>0)continue;g=Math.min(g,g+_+E);const C=[...o[0]][0].length,A=e.slice(0,c+o.index+C+g);if(Math.min(c,g)%2){const s=A.slice(1,-1);return{type:"em",raw:A,text:s,tokens:this.lexer.inlineTokens(s)}}const a=A.slice(2,-2);return{type:"strong",raw:A,text:a,tokens:this.lexer.inlineTokens(a)}}}}codespan(e){const r=this.rules.inline.code.exec(e);if(r){let n=r[2].replace(/\n/g," ");const o=/[^ ]/.test(n),i=/^ /.test(n)&&/ $/.test(n);return o&&i&&(n=n.substring(1,n.length-1)),n=or(n,!0),{type:"codespan",raw:r[0],text:n}}}br(e){const r=this.rules.inline.br.exec(e);if(r)return{type:"br",raw:r[0]}}del(e){const r=this.rules.inline.del.exec(e);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(e){const r=this.rules.inline.autolink.exec(e);if(r){let n,o;return r[2]==="@"?(n=or(r[1]),o="mailto:"+n):(n=or(r[1]),o=n),{type:"link",raw:r[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let r;if(r=this.rules.inline.url.exec(e)){let o,i;if(r[2]==="@")o=or(r[0]),i="mailto:"+o;else{let c;do c=r[0],r[0]=((n=this.rules.inline._backpedal.exec(r[0]))==null?void 0:n[0])??"";while(c!==r[0]);o=or(r[0]),r[1]==="www."?i="http://"+r[0]:i=r[0]}return{type:"link",raw:r[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const r=this.rules.inline.text.exec(e);if(r){let n;return this.lexer.state.inRawBlock?n=r[0]:n=or(r[0]),{type:"text",raw:r[0],text:n}}}}const vx=/^(?:[ \t]*(?:\n|$))+/,bx=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,xx=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ao=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yx=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,md=/(?:[*+-]|\d{1,9}[.)])/,pd=st(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,md).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).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(),ca=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ex=/^[^\n]+/,ua=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ax=st(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ua).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),wx=st(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,md).getRegex(),pi="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",da=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Cx=st("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",da).replace("tag",pi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gd=st(ca).replace("hr",ao).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","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",pi).getRegex(),fa={blockquote:st(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",gd).getRegex(),code:bx,def:Ax,fences:xx,heading:yx,hr:ao,html:Cx,lheading:pd,list:wx,newline:vx,paragraph:gd,table:io,text:Ex},vd=st("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ao).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",pi).getRegex(),Sx={...fa,table:vd,paragraph:st(ca).replace("hr",ao).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vd).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",pi).getRegex()},_x={...fa,html:st(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",da).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:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:io,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:st(ca).replace("hr",ao).replace("heading",` *#{1,6} *[^
|
|
628
|
+
]`).replace("lheading",pd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},bd=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Tx=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xd=/^( {2,}|\\)\n(?!\s*$)/,Dx=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,lo="\\p{P}\\p{S}",kx=st(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,lo).getRegex(),Nx=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Lx=st(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,lo).getRegex(),Ox=st("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,lo).getRegex(),Rx=st("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,lo).getRegex(),Ix=st(/\\([punct])/,"gu").replace(/punct/g,lo).getRegex(),Mx=st(/^<(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(),$x=st(da).replace("(?:-->|$)","-->").getRegex(),Px=st("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",$x).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),gi=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,qx=st(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",gi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),yd=st(/^!?\[(label)\]\[(ref)\]/).replace("label",gi).replace("ref",ua).getRegex(),Ed=st(/^!?\[(ref)\](?:\[\])?/).replace("ref",ua).getRegex(),Bx=st("reflink|nolink(?!\\()","g").replace("reflink",yd).replace("nolink",Ed).getRegex(),ha={_backpedal:io,anyPunctuation:Ix,autolink:Mx,blockSkip:Nx,br:xd,code:Tx,del:io,emStrongLDelim:Lx,emStrongRDelimAst:Ox,emStrongRDelimUnd:Rx,escape:bd,link:qx,nolink:Ed,punctuation:kx,reflink:yd,reflinkSearch:Bx,tag:Px,text:Dx,url:io},Fx={...ha,link:st(/^!?\[(label)\]\((.*?)\)/).replace("label",gi).getRegex(),reflink:st(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",gi).getRegex()},ma={...ha,escape:st(bd).replace("])","~|])").getRegex(),url:st(/^((?: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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},zx={...ma,br:st(xd).replace("{2,}","*").getRegex(),text:st(ma.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},vi={normal:fa,gfm:Sx,pedantic:_x},co={normal:ha,gfm:ma,breaks:zx,pedantic:Fx};class ur{constructor(e){Je(this,"tokens");Je(this,"options");Je(this,"state");Je(this,"tokenizer");Je(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ln,this.options.tokenizer=this.options.tokenizer||new mi,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={block:vi.normal,inline:co.normal};this.options.pedantic?(r.block=vi.pedantic,r.inline=co.pedantic):this.options.gfm&&(r.block=vi.gfm,this.options.breaks?r.inline=co.breaks:r.inline=co.gfm),this.tokenizer.rules=r}static get rules(){return{block:vi,inline:co}}static lex(e,r){return new ur(r).lex(e)}static lexInline(e,r){return new ur(r).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
629
|
+
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){this.options.pedantic&&(e=e.replace(/\t/g," ").replace(/^ +$/gm,""));let o,i,c;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(d=>(o=d.call({lexer:this},e,r))?(e=e.substring(o.raw.length),r.push(o),!0):!1))){if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length),o.raw.length===1&&r.length>0?r[r.length-1].raw+=`
|
|
630
|
+
`:r.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length),i=r[r.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
631
|
+
`+o.raw,i.text+=`
|
|
632
|
+
`+o.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length),i=r[r.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
633
|
+
`+o.raw,i.text+=`
|
|
634
|
+
`+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),r.push(o);continue}if(c=e,this.options.extensions&&this.options.extensions.startBlock){let d=1/0;const g=e.slice(1);let _;this.options.extensions.startBlock.forEach(E=>{_=E.call({lexer:this},g),typeof _=="number"&&_>=0&&(d=Math.min(d,_))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){i=r[r.length-1],n&&(i==null?void 0:i.type)==="paragraph"?(i.raw+=`
|
|
635
|
+
`+o.raw,i.text+=`
|
|
636
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(o),n=c.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length),i=r[r.length-1],i&&i.type==="text"?(i.raw+=`
|
|
637
|
+
`+o.raw,i.text+=`
|
|
638
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(o);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){let n,o,i,c=e,d,g,_;if(this.tokens.links){const E=Object.keys(this.tokens.links);if(E.length>0)for(;(d=this.tokenizer.rules.inline.reflinkSearch.exec(c))!=null;)E.includes(d[0].slice(d[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,d.index)+"["+"a".repeat(d[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(d=this.tokenizer.rules.inline.blockSkip.exec(c))!=null;)c=c.slice(0,d.index)+"["+"a".repeat(d[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(d=this.tokenizer.rules.inline.anyPunctuation.exec(c))!=null;)c=c.slice(0,d.index)+"++"+c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(g||(_=""),g=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(E=>(n=E.call({lexer:this},e,r))?(e=e.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),o=r[r.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),o=r[r.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(n=this.tokenizer.emStrong(e,c,_)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),r.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),r.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let E=1/0;const b=e.slice(1);let C;this.options.extensions.startInline.forEach(A=>{C=A.call({lexer:this},b),typeof C=="number"&&C>=0&&(E=Math.min(E,C))}),E<1/0&&E>=0&&(i=e.substring(0,E+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(_=n.raw.slice(-1)),g=!0,o=r[r.length-1],o&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(e){const E="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(E);break}else throw new Error(E)}}return r}}class bi{constructor(e){Je(this,"options");Je(this,"parser");this.options=e||ln}space(e){return""}code({text:e,lang:r,escaped:n}){var c;const o=(c=(r||"").match(/^\S*/))==null?void 0:c[0],i=e.replace(/\n$/,"")+`
|
|
639
|
+
`;return o?'<pre><code class="language-'+or(o)+'">'+(n?i:or(i,!0))+`</code></pre>
|
|
640
|
+
`:"<pre><code>"+(n?i:or(i,!0))+`</code></pre>
|
|
641
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
642
|
+
${this.parser.parse(e)}</blockquote>
|
|
643
|
+
`}html({text:e}){return e}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
|
|
644
|
+
`}hr(e){return`<hr>
|
|
645
|
+
`}list(e){const r=e.ordered,n=e.start;let o="";for(let d=0;d<e.items.length;d++){const g=e.items[d];o+=this.listitem(g)}const i=r?"ol":"ul",c=r&&n!==1?' start="'+n+'"':"";return"<"+i+c+`>
|
|
646
|
+
`+o+"</"+i+`>
|
|
647
|
+
`}listitem(e){let r="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):r+=n+" "}return r+=this.parser.parse(e.tokens,!!e.loose),`<li>${r}</li>
|
|
648
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
649
|
+
`}table(e){let r="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);r+=this.tablerow({text:n});let o="";for(let i=0;i<e.rows.length;i++){const c=e.rows[i];n="";for(let d=0;d<c.length;d++)n+=this.tablecell(c[d]);o+=this.tablerow({text:n})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
|
|
650
|
+
<thead>
|
|
651
|
+
`+r+`</thead>
|
|
652
|
+
`+o+`</table>
|
|
653
|
+
`}tablerow({text:e}){return`<tr>
|
|
654
|
+
${e}</tr>
|
|
655
|
+
`}tablecell(e){const r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
|
|
656
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:r,tokens:n}){const o=this.parser.parseInline(n),i=dd(e);if(i===null)return o;e=i;let c='<a href="'+e+'"';return r&&(c+=' title="'+r+'"'),c+=">"+o+"</a>",c}image({href:e,title:r,text:n}){const o=dd(e);if(o===null)return n;e=o;let i=`<img src="${e}" alt="${n}"`;return r&&(i+=` title="${r}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class pa{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class dr{constructor(e){Je(this,"options");Je(this,"renderer");Je(this,"textRenderer");this.options=e||ln,this.options.renderer=this.options.renderer||new bi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new pa}static parse(e,r){return new dr(r).parse(e)}static parseInline(e,r){return new dr(r).parseInline(e)}parse(e,r=!0){let n="";for(let o=0;o<e.length;o++){const i=e[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const d=i,g=this.options.extensions.renderers[d.type].call({parser:this},d);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(d.type)){n+=g||"";continue}}const c=i;switch(c.type){case"space":{n+=this.renderer.space(c);continue}case"hr":{n+=this.renderer.hr(c);continue}case"heading":{n+=this.renderer.heading(c);continue}case"code":{n+=this.renderer.code(c);continue}case"table":{n+=this.renderer.table(c);continue}case"blockquote":{n+=this.renderer.blockquote(c);continue}case"list":{n+=this.renderer.list(c);continue}case"html":{n+=this.renderer.html(c);continue}case"paragraph":{n+=this.renderer.paragraph(c);continue}case"text":{let d=c,g=this.renderer.text(d);for(;o+1<e.length&&e[o+1].type==="text";)d=e[++o],g+=`
|
|
657
|
+
`+this.renderer.text(d);r?n+=this.renderer.paragraph({type:"paragraph",raw:g,text:g,tokens:[{type:"text",raw:g,text:g}]}):n+=g;continue}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(e,r){r=r||this.renderer;let n="";for(let o=0;o<e.length;o++){const i=e[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const d=this.options.extensions.renderers[i.type].call({parser:this},i);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=d||"";continue}}const c=i;switch(c.type){case"escape":{n+=r.text(c);break}case"html":{n+=r.html(c);break}case"link":{n+=r.link(c);break}case"image":{n+=r.image(c);break}case"strong":{n+=r.strong(c);break}case"em":{n+=r.em(c);break}case"codespan":{n+=r.codespan(c);break}case"br":{n+=r.br(c);break}case"del":{n+=r.del(c);break}case"text":{n+=r.text(c);break}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}}class uo{constructor(e){Je(this,"options");Je(this,"block");this.options=e||ln}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ur.lex:ur.lexInline}provideParser(){return this.block?dr.parse:dr.parseInline}}Je(uo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Hx{constructor(...e){Je(this,"defaults",la());Je(this,"options",this.setOptions);Je(this,"parse",this.parseMarkdown(!0));Je(this,"parseInline",this.parseMarkdown(!1));Je(this,"Parser",dr);Je(this,"Renderer",bi);Je(this,"TextRenderer",pa);Je(this,"Lexer",ur);Je(this,"Tokenizer",mi);Je(this,"Hooks",uo);this.use(...e)}walkTokens(e,r){var o,i;let n=[];for(const c of e)switch(n=n.concat(r.call(this,c)),c.type){case"table":{const d=c;for(const g of d.header)n=n.concat(this.walkTokens(g.tokens,r));for(const g of d.rows)for(const _ of g)n=n.concat(this.walkTokens(_.tokens,r));break}case"list":{const d=c;n=n.concat(this.walkTokens(d.items,r));break}default:{const d=c;(i=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&i[d.type]?this.defaults.extensions.childTokens[d.type].forEach(g=>{const _=d[g].flat(1/0);n=n.concat(this.walkTokens(_,r))}):d.tokens&&(n=n.concat(this.walkTokens(d.tokens,r)))}}return n}use(...e){const r=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const c=r.renderers[i.name];c?r.renderers[i.name]=function(...d){let g=i.renderer.apply(this,d);return g===!1&&(g=c.apply(this,d)),g}:r.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'");const c=r[i.level];c?c.unshift(i.tokenizer):r[i.level]=[i.tokenizer],i.start&&(i.level==="block"?r.startBlock?r.startBlock.push(i.start):r.startBlock=[i.start]:i.level==="inline"&&(r.startInline?r.startInline.push(i.start):r.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(r.childTokens[i.name]=i.childTokens)}),o.extensions=r),n.renderer){const i=this.defaults.renderer||new bi(this.defaults);for(const c in n.renderer){if(!(c in i))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const d=c,g=n.renderer[d],_=i[d];i[d]=(...E)=>{let b=g.apply(i,E);return b===!1&&(b=_.apply(i,E)),b||""}}o.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new mi(this.defaults);for(const c in n.tokenizer){if(!(c in i))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const d=c,g=n.tokenizer[d],_=i[d];i[d]=(...E)=>{let b=g.apply(i,E);return b===!1&&(b=_.apply(i,E)),b}}o.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new uo;for(const c in n.hooks){if(!(c in i))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const d=c,g=n.hooks[d],_=i[d];uo.passThroughHooks.has(c)?i[d]=E=>{if(this.defaults.async)return Promise.resolve(g.call(i,E)).then(C=>_.call(i,C));const b=g.call(i,E);return _.call(i,b)}:i[d]=(...E)=>{let b=g.apply(i,E);return b===!1&&(b=_.apply(i,E)),b}}o.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,c=n.walkTokens;o.walkTokens=function(d){let g=[];return g.push(c.call(this,d)),i&&(g=g.concat(i.call(this,d))),g}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,r){return ur.lex(e,r??this.defaults)}parser(e,r){return dr.parse(e,r??this.defaults)}parseMarkdown(e){return(n,o)=>{const i={...o},c={...this.defaults,...i},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&i.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=e);const g=c.hooks?c.hooks.provideLexer():e?ur.lex:ur.lexInline,_=c.hooks?c.hooks.provideParser():e?dr.parse:dr.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(n):n).then(E=>g(E,c)).then(E=>c.hooks?c.hooks.processAllTokens(E):E).then(E=>c.walkTokens?Promise.all(this.walkTokens(E,c.walkTokens)).then(()=>E):E).then(E=>_(E,c)).then(E=>c.hooks?c.hooks.postprocess(E):E).catch(d);try{c.hooks&&(n=c.hooks.preprocess(n));let E=g(n,c);c.hooks&&(E=c.hooks.processAllTokens(E)),c.walkTokens&&this.walkTokens(E,c.walkTokens);let b=_(E,c);return c.hooks&&(b=c.hooks.postprocess(b)),b}catch(E){return d(E)}}}onError(e,r){return n=>{if(n.message+=`
|
|
658
|
+
Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+or(n.message+"",!0)+"</pre>";return r?Promise.resolve(o):o}if(r)return Promise.reject(n);throw n}}}const cn=new Hx;function ot(t,e){return cn.parse(t,e)}ot.options=ot.setOptions=function(t){return cn.setOptions(t),ot.defaults=cn.defaults,ad(ot.defaults),ot},ot.getDefaults=la,ot.defaults=ln,ot.use=function(...t){return cn.use(...t),ot.defaults=cn.defaults,ad(ot.defaults),ot},ot.walkTokens=function(t,e){return cn.walkTokens(t,e)},ot.parseInline=cn.parseInline,ot.Parser=dr,ot.parser=dr.parse,ot.Renderer=bi,ot.TextRenderer=pa,ot.Lexer=ur,ot.lexer=ur.lex,ot.Tokenizer=mi,ot.Hooks=uo,ot.parse=ot,ot.options,ot.setOptions,ot.use,ot.walkTokens,ot.parseInline,dr.parse,ur.lex;let Nn;function ga(){Nn==null||Nn()}function Ux(t,e,r){var Y,W,J;ga();const n=(G,Q)=>r.locale==="zh"?G:Q,o={translate:n("翻译","Translation"),explain:n("解释","Explanation"),grammar:n("语法分析","Grammar analysis"),mnemonic:n("助记","Mnemonic")},i=document.createElement("div");i.id="forsion-selection-result-host";const c=i.attachShadow({mode:"open"}),d=document.createElement("style");d.textContent=Oi;const g=document.createElement("section");g.className="surface result",g.setAttribute("role","dialog"),g.setAttribute("aria-label",o[t]);const _=document.createElement("header"),E=document.createElement("strong"),b=document.createElement("span");E.textContent=o[t],_.append(E,b);const C=document.activeElement;let A=!1,a=!1,s,l=0,u="",m=!1,x=!1,f=((Y=r.preferences)==null?void 0:Y.targetLanguage)||(r.locale==="zh"?"zh-CN":"en"),v=((W=r.preferences)==null?void 0:W.translationProvider)||"google";const p=Ri(i,r.theme);let h;function w(){a||(a=!0,l++,s==null||s(),p(),window.removeEventListener("resize",I),document.removeEventListener("keydown",V,!0),document.removeEventListener("pointermove",X,!0),document.removeEventListener("pointerup",ne,!0),i.remove(),Nn===w&&(Nn=void 0),C!=null&&C.isConnected&&C.focus({preventScroll:!0}))}Nn=w,_.append(Xt("×",w)),(J=_.lastElementChild)==null||J.setAttribute("aria-label",n("关闭","Close"));const O=document.createElement("blockquote");O.className="source",O.textContent=e.text;const M=document.createElement("div");if(M.className="tools",t==="translate"){const G=document.createElement("select");G.setAttribute("aria-label",n("翻译目标语言","Translation language"));for(const[Q,ie,K]of[["zh-CN","简体中文","Chinese (simplified)"],["zh-TW","繁體中文","Chinese (traditional)"],["en","英语","English"],["ja","日语","Japanese"],["ko","韩语","Korean"],["fr","法语","French"],["de","德语","German"],["es","西班牙语","Spanish"],["ru","俄语","Russian"],["pt","葡萄牙语","Portuguese"],["it","意大利语","Italian"],["ar","阿拉伯语","Arabic"]]){const re=document.createElement("option");re.value=Q,re.textContent=n(ie,K),G.append(re)}if(!Array.from(G.options).some(Q=>Q.value===f)){const Q=document.createElement("option");Q.value=f,Q.textContent=f,G.append(Q)}G.value=f,G.addEventListener("change",Q=>{Q.isTrusted&&(f=G.value,H())}),M.append(G)}const $=Xt(n("停止","Stop"),()=>{l++,s==null||s(),s=void 0,m=!1,D.textContent=n("已停止,保留已收到的内容。","Stopped. Received text has been kept."),$.hidden=!0});M.append($,Xt(n("重试","Retry"),()=>H()));const T=document.createElement("div");T.className="output";const D=document.createElement("p");D.className="status",D.setAttribute("role","status");const R=document.createElement("footer"),S=new Map;if(t==="translate"){const G=document.createElement("div");G.className="providers";for(const Q of["google","bing","ai"]){const ie=Xt(Q==="ai"?"AI":Q==="google"?"Google":"Bing",()=>{v=Q,H()});G.append(ie),S.set(Q,ie)}R.append(G)}async function y(G,Q){const ie=l;try{await G(),!a&&ie===l&&(D.className="status",D.textContent=Q)}catch(K){!a&&ie===l&&(D.className="status error",D.textContent=K instanceof Error?K.message:String(K))}}const k=Xt(n("复制","Copy"),()=>void y(()=>r.copy(u),n("已复制","Copied")));async function N(G){if(A||!u)return;const Q=u;A=!0,U();try{await y(()=>r.save(Q,o[t],G),n("保存请求已完成","Save request completed"))}finally{A=!1,a||U()}}const L=Xt(n("保存到笔记","Save to note"),()=>void N());R.append(k,L);let P;r.flomoConfigured&&(P=Xt("flomo",()=>void N("flomo")),R.append(P));const B=Xt(n("加入生词本","Add to vocabulary"),()=>void y(()=>r.vocabulary(e,u),n("已加入生词本","Added to vocabulary")));t==="translate"&&e.text.length<=200&&R.append(B);const U=()=>{k.disabled=!u,L.disabled=!u||A,P&&(P.disabled=!u||A),B.disabled=!u||!m};function F(){if(t==="translate")T.textContent=u,T.style.whiteSpace="pre-wrap";else{T.innerHTML=zc.sanitize(ot.parse(u,{async:!1}),{ALLOWED_TAGS:["p","br","strong","em","s","ul","ol","li","h1","h2","h3","h4","blockquote","pre","code","a","table","thead","tbody","tr","th","td","hr"],ALLOWED_ATTR:["href","title"]});for(const G of T.querySelectorAll("a"))/^https?:\/\//i.test(G.getAttribute("href")||"")||G.removeAttribute("href"),G.target="_blank",G.rel="noopener noreferrer"}U(),I()}function I(){var ce,se,ue;if(a)return;const G=g.getBoundingClientRect(),Q=((ce=r.preferences)==null?void 0:ce.resultPosition)||"top_left",ie=e.anchor,K=x?G.left:Q==="custom"?((se=r.preferences)==null?void 0:se.resultX)||16:Q==="top_right"?window.innerWidth-G.width-16:Q==="below_selection"?ie.left:16,re=x?G.top:Q==="custom"?((ue=r.preferences)==null?void 0:ue.resultY)||16:Q==="below_selection"?ie.bottom+10:16;fn(g,K,re,Q==="below_selection"?ie.top-8:re)}function H(){l++,s==null||s();const G=l;u="",m=!1,T.textContent=n("正在生成…","Generating…"),D.textContent="",D.className="status",$.hidden=!1,U(),b.textContent=t==="translate"?v==="ai"?"AI":v==="bing"?"Bing":"Google":"AI";for(const[Q,ie]of S)ie.setAttribute("aria-current",String(Q===v));try{s=r.read({action:t,selection:e,targetLanguage:f,translationProvider:v},Q=>{var ie;if(!(a||G!==l))if(Q.type==="provider"){b.textContent=Q.provider;for(const[K,re]of S)re.setAttribute("aria-current",String(K===Q.provider.toLowerCase()))}else Q.type==="error"?(D.className="status error",D.textContent=Q.error,$.hidden=!0,U()):(u=Q.text,m=Q.type==="done",F(),m&&($.hidden=!0,D.textContent=n("已完成","Complete"),t==="translate"&&((ie=r.preferences)==null?void 0:ie.autoAddVocabulary)!==!1&&e.text.length<=200&&y(()=>r.vocabulary(e,u),n("已完成 · 已加入生词本","Complete · Added to vocabulary"))))})}catch(Q){D.className="status error",D.textContent=Q instanceof Error?Q.message:String(Q),$.hidden=!0}}function V(G){G.isTrusted&&G.key==="Escape"&&(G.stopPropagation(),w())}_.addEventListener("pointerdown",G=>{if(!G.isTrusted||G.target.closest("button"))return;G.preventDefault();const Q=g.getBoundingClientRect();h={x:G.clientX,y:G.clientY,left:Q.left,top:Q.top}});function X(G){!h||!G.isTrusted||(x=!0,fn(g,h.left+G.clientX-h.x,h.top+G.clientY-h.y))}function ne(G){var ie;if(!h||!G.isTrusted)return;h=void 0;const Q=g.getBoundingClientRect();(ie=r.savePosition)==null||ie.call(r,Q.left,Q.top)}g.append(_,M,O,T,D,R),c.append(d,g),document.documentElement.append(i),document.addEventListener("keydown",V,!0),document.addEventListener("pointermove",X,!0),document.addEventListener("pointerup",ne,!0),window.addEventListener("resize",I),I(),H()}const jx="forsion-region-picker-host",Wx="2px solid #C39647";let xi=!1;function Ad(){return xi}function wd(t,e="en"){const r=e==="zh";if(xi)return;xi=!0;const n=new Set,o=new Map,i=document.createElement("div");i.style.cssText="position:fixed;z-index:2147483645;pointer-events:none;display:none;border:2px dashed #C39647;background:rgba(195,150,71,.08);border-radius:2px;";const c=document.createElement("div");c.id=jx;const d=c.attachShadow({mode:"open"}),g=document.createElement("style");g.textContent=`
|
|
659
|
+
.bar{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);z-index:2147483647;
|
|
660
|
+
display:flex;align-items:center;gap:10px;padding:8px 14px;background:#1f2937;color:#e5e7eb;
|
|
661
|
+
border-radius:20px;box-shadow:0 4px 16px rgba(0,0,0,.35);font:13px/1.4 -apple-system,system-ui,sans-serif}
|
|
662
|
+
button{all:unset;cursor:pointer;padding:4px 12px;border-radius:12px}
|
|
663
|
+
.ok{background:#C39647;color:#fff}
|
|
664
|
+
.ok[disabled]{opacity:.5;cursor:default}
|
|
665
|
+
.cancel:hover{background:#374151}`;const _=document.createElement("div");_.className="bar";const E=document.createElement("span");E.textContent=r?"点击页面元素以选取 · Esc 取消":"Select page regions · Esc to cancel";const b=document.createElement("button");b.className="ok",b.textContent=r?"完成":"Done",b.disabled=!0;const C=document.createElement("button");C.className="cancel",C.textContent=r?"取消":"Cancel",_.append(E,b,C),d.append(g,_),document.documentElement.append(i,c);const A=document.documentElement.style.cursor;document.documentElement.style.cursor="crosshair";function a(){b.disabled=n.size===0,E.textContent=n.size?r?`已选 ${n.size} 个区域`:`${n.size} regions selected`:r?"点击页面元素以选取 · Esc 取消":"Select page regions · Esc to cancel"}function s(p){const h=p.target;return!h||h===document.documentElement||h===document.body||h===c||c.contains(h)||h===i?null:h}function l(p){if(!p.isTrusted)return;const h=s(p);if(!h){i.style.display="none";return}const w=h.getBoundingClientRect();i.style.display="block",i.style.left=`${w.left}px`,i.style.top=`${w.top}px`,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`}function u(p){n.has(p)?(n.delete(p),p.style.outline=o.get(p)||"",o.delete(p)):(n.add(p),o.set(p,p.style.outline),p.style.outline=Wx),a()}function m(p){if(!p.isTrusted)return;const h=s(p);h&&(p.preventDefault(),p.stopPropagation(),u(h))}function x(p){p.isTrusted&&p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),v(null))}function f(){const p=Array.from(n).filter(w=>{for(const O of n)if(O!==w&&O.contains(w))return!1;return!0}).sort((w,O)=>w.compareDocumentPosition(O)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);return p.length?{html:p.map(w=>{const O=w.cloneNode(!0);return O.style.outline=o.get(w)||"",O.outerHTML}).join(`
|
|
666
|
+
`),count:p.length}:null}function v(p){xi=!1,document.removeEventListener("mousemove",l,!0),document.removeEventListener("click",m,!0),document.removeEventListener("keydown",x,!0);for(const[h,w]of o)h.style.outline=w;i.remove(),c.remove(),document.documentElement.style.cursor=A,t(p)}b.addEventListener("click",p=>{p.isTrusted&&n.size&&v(f())}),C.addEventListener("click",p=>{p.isTrusted&&v(null)}),document.addEventListener("mousemove",l,!0),document.addEventListener("click",m,!0),document.addEventListener("keydown",x,!0)}const Vx={matches:["http://*/*","https://*/*"],runAt:"document_idle",registration:"runtime",async main(){const t=window;if(t.__forsionClipLoaded)return;t.__forsionClipLoaded=!0;let e="en",r=null,n=null;const o=(f,v)=>e==="zh"?f:v;async function i(){var v,p;const f=await chrome.runtime.sendMessage({type:"clip-content-state",url:location.href}).catch(()=>null);e=(f==null?void 0:f.locale)==="zh"?"zh":"en",Y2(e),jc(e),Ho(),f!=null&&f.floating&&D0({locale:e,theme:f.theme,settings:f.floating,onAction:h=>{h==="panel"||h==="ai"||h==="vocab"?chrome.runtime.sendMessage({type:"clip-open-panel",view:h==="panel"?"clip":h,url:location.href}).then(w=>{if(!(w!=null&&w.ok))throw Error((w==null?void 0:w.error)||"Could not open side panel")}).catch(c):h==="toggle"?chrome.runtime.sendMessage({type:"clip-selection-toggle",url:location.href}).then(w=>{if(!(w!=null&&w.ok))throw Error((w==null?void 0:w.error)||"Could not change selection menu");return i()}).catch(c):h==="save"?(fr(o("正在剪藏…","Capturing…")),fi("full").then(w=>_(w)).catch(c)):h==="highlights"?C().catch(c):h==="hide"?chrome.runtime.sendMessage({type:"clip-floating-disable-site",url:location.href}).then(w=>{if(!(w!=null&&w.ok))throw Error((w==null?void 0:w.error)||"Could not hide launcher");Ho()}).catch(c):h==="region"&&!Ad()&&wd(w=>{w&&hi(w.html).then(O=>_(O)).catch(c)},e)},onPosition:(h,w)=>{chrome.runtime.sendMessage({type:"clip-floating-position",url:location.href,side:h,y:w}).catch(c)}}),no(),sa(()=>{}),(f==null?void 0:f.selectionToolbar)!==!1&&!((p=(v=f==null?void 0:f.selection)==null?void 0:v.disabledSites)!=null&&p.includes(location.hostname.toLowerCase().replace(/\.$/,"")))&&(sa(cx),ux({locale:e,theme:f==null?void 0:f.theme,preferences:f==null?void 0:f.selection,flomoConfigured:(f==null?void 0:f.flomoConfigured)===!0,destinations:f==null?void 0:f.selectionDestinations,onRememberColor:h=>{chrome.runtime.sendMessage({type:"clip-selection-color",url:location.href,color:h}).then(w=>{if(!(w!=null&&w.ok))throw Error((w==null?void 0:w.error)||"Could not save highlight color")}).catch(c)},getHighlight:h=>an().find(w=>w.id===h),onRemoveHighlight:ta,onSetHighlightColor:ed,onSetHighlightNote:Qu,onCopy:h=>{va(h).then(w=>fr(w?o("已复制","Copied"):o("复制失败","Could not copy")))},onSave:(h,w)=>{E(h,w).catch(c)},onSaveAll:h=>{C(h).catch(c)},onVocabulary:h=>{g(h).then(()=>fr(o("已加入生词本","Added to vocabulary")),c)},onDisableSite:()=>{chrome.runtime.sendMessage({type:"clip-selection-disable-site",url:location.href}).then(h=>{if(!(h!=null&&h.ok))throw Error((h==null?void 0:h.error)||"Could not update selection toolbar");no(),sa(()=>{}),fr(o("已关闭本站选区菜单,可在设置中恢复。","Selection menu disabled for this site. Restore it in settings."))}).catch(c)},onRead:(h,w)=>Ux(h,w,{locale:e,theme:f==null?void 0:f.theme,preferences:f==null?void 0:f.selection,flomoConfigured:(f==null?void 0:f.flomoConfigured)===!0,read:d,copy:async O=>{if(!await va(O))throw Error(o("复制失败","Could not copy"))},save:async(O,M,$)=>{await b(O,M,$)},vocabulary:g,savePosition:(O,M)=>{chrome.runtime.sendMessage({type:"clip-selection-popup-position",url:location.href,x:O,y:M}).catch(()=>{})}}),onHighlight:(h,w)=>{Ju(h,w),ro()},onImageHighlight:(h,w)=>{Xu(h,w)&&fr(o("已标注图片","Image highlighted"))},onClipSelection:()=>{a()},onAddVocab:()=>{s()}}))}const c=f=>fr(f instanceof Error?f.message:String(f)),d=(f,v)=>{const p=chrome.runtime.connect({name:"selection-ai"});let h=!1;const w=()=>{try{p.disconnect()}catch{}};return p.onMessage.addListener(O=>{h||(v(O),(O.type==="done"||O.type==="error")&&(h=!0,w()))}),p.onDisconnect.addListener(()=>{var M;const O=(M=chrome.runtime.lastError)==null?void 0:M.message;h||(h=!0,v({type:"error",error:O||o("连接中断,已保留收到的内容。","Connection interrupted. Received text has been kept.")}))}),p.postMessage({type:"read",action:f.action,text:f.selection.text,context:f.selection.context,url:location.href,title:document.title,targetLanguage:f.targetLanguage,translationProvider:f.translationProvider}),()=>{h=!0;try{p.postMessage({type:"cancel"})}catch{}w()}};async function g(f,v){if(!f.text.trim()||f.text.length>200)throw Error(o("请选择不超过 200 字符的单词或短语。","Select a word or phrase of up to 200 characters."));const p=await chrome.runtime.sendMessage({type:"clip-vocab-add",url:location.href,title:document.title,word:f.text,sentence:f.context.sentence||f.context.paragraph||f.text,...v!=null&&v.trim()?{meaning:v}:{}});if(!(p!=null&&p.ok))throw Error((p==null?void 0:p.error)||o("生词保存失败","Could not save vocabulary"))}async function _(f,v){if(!f.ok)throw Error(f.error||o("剪藏失败","Could not capture selection"));const p=await chrome.runtime.sendMessage({type:"clip-save",clip:f,...v?{destination:v}:{}});if(!(p!=null&&p.ok))throw Error((p==null?void 0:p.error)||o("保存失败","Save failed"));fr(p.warning||o("保存请求已完成","Save request completed"))}async function E(f,v){const p=(f.html||`<p>${ba(f.text)}</p>`)+(f.note?`<blockquote>${ba(f.note)}</blockquote>`:"");await _(await hi(p,{includeHighlights:!1}),v)}async function b(f,v,p){const h=await hi(`<p>${ba(v)}</p>`,{includeHighlights:!1});if(!h.ok)throw Error(h.error||"Could not prepare note");h.title=`${document.title} · ${v}`,h.frontMatter={...h.frontMatter,Title:h.title},h.markdown=f,h.document=od(h.frontMatter)+f,h.highlights=[],await _(h,p)}async function C(f){const v=an().sort((p,h)=>p.createdAt.localeCompare(h.createdAt));if(!v.length)throw Error(o("此页面还没有划线。","This page has no highlights yet."));await b(id(v,e).trim(),o("划线摘录","Highlights"),f)}const A=(async()=>{await i(),await Qn()})();document.addEventListener("contextmenu",f=>{f.isTrusted&&(n=f.target instanceof HTMLImageElement?f.target:null)},!0);async function a(){try{const f=await fi("selection");if(!f.ok)throw new Error(f.error||o("剪藏失败","Could not clip selection"));fr(o("正在保存…","Saving…"));const v=await chrome.runtime.sendMessage({type:"clip-save",clip:f});if(!(v!=null&&v.ok))throw new Error((v==null?void 0:v.error)||o("保存失败","Save failed"));fr(v.warning||o("已保存","Saved"))}catch(f){fr(f instanceof Error?f.message:String(f))}}async function s(){const f=window.getSelection(),v=(f==null?void 0:f.toString().trim())||"";if(!v)return null;const p=f==null?void 0:f.anchorNode,h=(p==null?void 0:p.nodeType)===Node.TEXT_NODE?p.parentElement:p,w=((h==null?void 0:h.textContent)||v).replace(/\s+/g," "),O=(w.split(new RegExp("(?<=[。!?])|(?<=[.!?])(?=\\s)")).find($=>$.includes(v))||w).trim().slice(0,300),M=await chrome.runtime.sendMessage({type:"clip-vocab-add",word:v,sentence:O,url:location.href,title:document.title}).catch(()=>null);return M!=null&&M.ok?(fr(o(`已加入生词本:${v}`,`Added to vocabulary: ${v}`)),v):(fr((M==null?void 0:M.error)||o("生词保存失败","Could not save vocabulary")),null)}const l=new Set(["ping","extract","extract-page","stash-selection","get-pending-clip","start-region-pick","highlight-selection","highlight-image","add-vocab","get-highlights","get-all-highlights","refresh-highlights","remove-highlight","set-highlight-note","set-highlight-color","clear-highlights","copy-text","open-uri","clip-content-settings-changed"]);chrome.runtime.onMessage.addListener((f,v,p)=>l.has(f==null?void 0:f.type)?((async()=>{switch(f.type!=="ping"&&await A,f.type){case"ping":return{ok:!0};case"clip-content-settings-changed":return await i(),{ok:!0};case"extract":case"extract-page":return await Qn(),fi(f.scope||f.mode||"full",f.url);case"stash-selection":return r=fi("selection"),{ok:!0};case"get-pending-clip":{const h=r?await r:null;return r=null,h}case"start-region-pick":return Ad()||wd(h=>{h?(r=hi(h.html),chrome.runtime.sendMessage({type:"region-clip-ready"}).catch(()=>{})):chrome.runtime.sendMessage({type:"region-clip-cancelled"}).catch(()=>{})},e),{ok:!0};case"highlight-selection":return{ok:!0,highlight:Ju(void 0,f.color)};case"highlight-image":{const h=f.srcUrl||f.imageUrl||f.url,w=n&&document.contains(n)&&(!h||n.currentSrc===h||n.src===h)?n:Array.from(document.images).find(M=>M.currentSrc===h||M.src===h),O=w?Xu(w,f.color):null;return{ok:!!O,highlight:O}}case"add-vocab":return{word:await s()};case"refresh-highlights":return await Qn(!0),{ok:!0,highlights:an()};case"get-highlights":case"get-all-highlights":return{ok:!0,highlights:an()};case"remove-highlight":return{ok:ta(f.id)};case"set-highlight-note":return{ok:Qu(f.id,f.note||"")};case"set-highlight-color":return{ok:ed(f.id,f.color)};case"clear-highlights":return K2(),{ok:!0};case"copy-text":return{ok:await va(f.text||"")};case"open-uri":{const h=new URL(f.uri);return["obsidian:","forsion:"].includes(h.protocol)?(location.href=h.href,{ok:!0,status:"dispatched"}):{ok:!1,error:"Unsupported application URL"}}}})().then(p,h=>p({ok:!1,error:h instanceof Error?h.message:String(h)})),!0):!1);let u=location.href;const m=()=>{location.href!==u&&(u=location.href,r=null,ga(),i(),Qn())};let x=setInterval(m,1e3);window.addEventListener("popstate",m),window.addEventListener("hashchange",m),window.addEventListener("pagehide",()=>{x&&clearInterval(x),x=void 0,li(),Ho(),rx(),ga(),no()}),window.addEventListener("pageshow",()=>{x||(x=setInterval(m,1e3)),Qn(),ro(),i()})}};async function va(t){try{return await navigator.clipboard.writeText(t),!0}catch{}const e=window.getSelection(),r=e?Array.from({length:e.rangeCount},(o,i)=>e.getRangeAt(i).cloneRange()):[],n=document.createElement("textarea");n.value=t,n.style.cssText="position:fixed;opacity:0;pointer-events:none;",document.documentElement.append(n);try{return n.select(),document.execCommand("copy")}catch{return!1}finally{n.remove(),e==null||e.removeAllRanges();for(const o of r)e==null||e.addRange(o)}}function ba(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}let Rr=null,xa;function fr(t){if(!Rr){const e=document.createElement("div");e.id="forsion-toast-host";const r=e.attachShadow({mode:"open"});Rr=document.createElement("div"),Rr.setAttribute("role","status"),Rr.style.cssText="position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:2147483647;background:#1f2937;color:white;padding:8px 16px;border-radius:12px;font:13px/1.4 system-ui;box-shadow:0 4px 16px #0003;pointer-events:none;max-width:min(80vw,500px)",r.append(Rr),document.documentElement.append(e)}Rr.textContent=t,Rr.hidden=!1,xa&&clearTimeout(xa),xa=setTimeout(()=>{Rr&&(Rr.hidden=!0)},2400)}var yi={exports:{}},Zx=yi.exports,Cd;function Gx(){return Cd||(Cd=1,(function(t,e){(function(r,n){n(t)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Zx,function(r){if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)r.exports=globalThis.browser;else{const n="The message port closed before a response was received.",o=i=>{const c={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(c).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class d extends WeakMap{constructor(h,w=void 0){super(w),this.createItem=h}get(h){return this.has(h)||this.set(h,this.createItem(h)),super.get(h)}}const g=p=>p&&typeof p=="object"&&typeof p.then=="function",_=(p,h)=>(...w)=>{i.runtime.lastError?p.reject(new Error(i.runtime.lastError.message)):h.singleCallbackArg||w.length<=1&&h.singleCallbackArg!==!1?p.resolve(w[0]):p.resolve(w)},E=p=>p==1?"argument":"arguments",b=(p,h)=>function(O,...M){if(M.length<h.minArgs)throw new Error(`Expected at least ${h.minArgs} ${E(h.minArgs)} for ${p}(), got ${M.length}`);if(M.length>h.maxArgs)throw new Error(`Expected at most ${h.maxArgs} ${E(h.maxArgs)} for ${p}(), got ${M.length}`);return new Promise(($,T)=>{if(h.fallbackToNoCallback)try{O[p](...M,_({resolve:$,reject:T},h))}catch(D){console.warn(`${p} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,D),O[p](...M),h.fallbackToNoCallback=!1,h.noCallback=!0,$()}else h.noCallback?(O[p](...M),$()):O[p](...M,_({resolve:$,reject:T},h))})},C=(p,h,w)=>new Proxy(h,{apply(O,M,$){return w.call(M,p,...$)}});let A=Function.call.bind(Object.prototype.hasOwnProperty);const a=(p,h={},w={})=>{let O=Object.create(null),M={has(T,D){return D in p||D in O},get(T,D,R){if(D in O)return O[D];if(!(D in p))return;let S=p[D];if(typeof S=="function")if(typeof h[D]=="function")S=C(p,p[D],h[D]);else if(A(w,D)){let y=b(D,w[D]);S=C(p,p[D],y)}else S=S.bind(p);else if(typeof S=="object"&&S!==null&&(A(h,D)||A(w,D)))S=a(S,h[D],w[D]);else if(A(w,"*"))S=a(S,h[D],w["*"]);else return Object.defineProperty(O,D,{configurable:!0,enumerable:!0,get(){return p[D]},set(y){p[D]=y}}),S;return O[D]=S,S},set(T,D,R,S){return D in O?O[D]=R:p[D]=R,!0},defineProperty(T,D,R){return Reflect.defineProperty(O,D,R)},deleteProperty(T,D){return Reflect.deleteProperty(O,D)}},$=Object.create(p);return new Proxy($,M)},s=p=>({addListener(h,w,...O){h.addListener(p.get(w),...O)},hasListener(h,w){return h.hasListener(p.get(w))},removeListener(h,w){h.removeListener(p.get(w))}}),l=new d(p=>typeof p!="function"?p:function(w){const O=a(w,{},{getContent:{minArgs:0,maxArgs:0}});p(O)}),u=new d(p=>typeof p!="function"?p:function(w,O,M){let $=!1,T,D=new Promise(k=>{T=function(N){$=!0,k(N)}}),R;try{R=p(w,O,T)}catch(k){R=Promise.reject(k)}const S=R!==!0&&g(R);if(R!==!0&&!S&&!$)return!1;const y=k=>{k.then(N=>{M(N)},N=>{let L;N&&(N instanceof Error||typeof N.message=="string")?L=N.message:L="An unexpected error occurred",M({__mozWebExtensionPolyfillReject__:!0,message:L})}).catch(N=>{console.error("Failed to send onMessage rejected reply",N)})};return y(S?R:D),!0}),m=({reject:p,resolve:h},w)=>{i.runtime.lastError?i.runtime.lastError.message===n?h():p(new Error(i.runtime.lastError.message)):w&&w.__mozWebExtensionPolyfillReject__?p(new Error(w.message)):h(w)},x=(p,h,w,...O)=>{if(O.length<h.minArgs)throw new Error(`Expected at least ${h.minArgs} ${E(h.minArgs)} for ${p}(), got ${O.length}`);if(O.length>h.maxArgs)throw new Error(`Expected at most ${h.maxArgs} ${E(h.maxArgs)} for ${p}(), got ${O.length}`);return new Promise((M,$)=>{const T=m.bind(null,{resolve:M,reject:$});O.push(T),w.sendMessage(...O)})},f={devtools:{network:{onRequestFinished:s(l)}},runtime:{onMessage:s(u),onMessageExternal:s(u),sendMessage:x.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:x.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},v={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return c.privacy={network:{"*":v},services:{"*":v},websites:{"*":v}},a(i,f,c)};r.exports=o(chrome)}})})(yi)),yi.exports}var Yx=Gx();const Ei=pr(Yx);function Ai(t,...e){}const Jx={debug:(...t)=>Ai(console.debug,...t),log:(...t)=>Ai(console.log,...t),warn:(...t)=>Ai(console.warn,...t),error:(...t)=>Ai(console.error,...t)},Ti=class Ti extends Event{constructor(e,r){super(Ti.EVENT_NAME,{}),this.newUrl=e,this.oldUrl=r}};Je(Ti,"EVENT_NAME",Ea("wxt:locationchange"));let ya=Ti;function Ea(t){var e;return`${(e=Ei==null?void 0:Ei.runtime)==null?void 0:e.id}:content:${t}`}function Xx(t){let e,r;return{run(){e==null&&(r=new URL(location.href),e=t.setInterval(()=>{let n=new URL(location.href);n.href!==r.href&&(window.dispatchEvent(new ya(n,r)),r=n)},1e3))}}}const mo=class mo{constructor(e,r){Je(this,"isTopFrame",window.self===window.top);Je(this,"abortController");Je(this,"locationWatcher",Xx(this));Je(this,"receivedMessageIds",new Set);this.contentScriptName=e,this.options=r,this.abortController=new AbortController,this.isTopFrame?(this.listenForNewerScripts({ignoreFirstEvent:!0}),this.stopOldScripts()):this.listenForNewerScripts()}get signal(){return this.abortController.signal}abort(e){return this.abortController.abort(e)}get isInvalid(){return Ei.runtime.id==null&&this.notifyInvalidated(),this.signal.aborted}get isValid(){return!this.isInvalid}onInvalidated(e){return this.signal.addEventListener("abort",e),()=>this.signal.removeEventListener("abort",e)}block(){return new Promise(()=>{})}setInterval(e,r){const n=setInterval(()=>{this.isValid&&e()},r);return this.onInvalidated(()=>clearInterval(n)),n}setTimeout(e,r){const n=setTimeout(()=>{this.isValid&&e()},r);return this.onInvalidated(()=>clearTimeout(n)),n}requestAnimationFrame(e){const r=requestAnimationFrame((...n)=>{this.isValid&&e(...n)});return this.onInvalidated(()=>cancelAnimationFrame(r)),r}requestIdleCallback(e,r){const n=requestIdleCallback((...o)=>{this.signal.aborted||e(...o)},r);return this.onInvalidated(()=>cancelIdleCallback(n)),n}addEventListener(e,r,n,o){var i;r==="wxt:locationchange"&&this.isValid&&this.locationWatcher.run(),(i=e.addEventListener)==null||i.call(e,r.startsWith("wxt:")?Ea(r):r,n,{...o,signal:this.signal})}notifyInvalidated(){this.abort("Content script context invalidated"),Jx.debug(`Content script "${this.contentScriptName}" context invalidated`)}stopOldScripts(){window.postMessage({type:mo.SCRIPT_STARTED_MESSAGE_TYPE,contentScriptName:this.contentScriptName,messageId:Math.random().toString(36).slice(2)},"*")}verifyScriptStartedEvent(e){var i,c,d;const r=((i=e.data)==null?void 0:i.type)===mo.SCRIPT_STARTED_MESSAGE_TYPE,n=((c=e.data)==null?void 0:c.contentScriptName)===this.contentScriptName,o=!this.receivedMessageIds.has((d=e.data)==null?void 0:d.messageId);return r&&n&&o}listenForNewerScripts(e){let r=!0;const n=o=>{if(this.verifyScriptStartedEvent(o)){this.receivedMessageIds.add(o.data.messageId);const i=r;if(r=!1,i&&(e!=null&&e.ignoreFirstEvent))return;this.notifyInvalidated()}};addEventListener("message",n),this.onInvalidated(()=>removeEventListener("message",n))}};Je(mo,"SCRIPT_STARTED_MESSAGE_TYPE",Ea("wxt:content-script-started"));let Aa=mo;const Kx=Symbol("null");let Qx=0;class ey extends Map{constructor(...e){super(),this._objectHashes=new WeakMap,this._symbolHashes=new Map,this._publicKeys=new Map;const[r]=e;if(r!=null){if(typeof r[Symbol.iterator]!="function")throw new TypeError(typeof r+" is not iterable (cannot read property Symbol(Symbol.iterator))");for(const[n,o]of r)this.set(n,o)}}_getPublicKeys(e,r=!1){if(!Array.isArray(e))throw new TypeError("The keys parameter must be an array");const n=this._getPrivateKey(e,r);let o;return n&&this._publicKeys.has(n)?o=this._publicKeys.get(n):r&&(o=[...e],this._publicKeys.set(n,o)),{privateKey:n,publicKey:o}}_getPrivateKey(e,r=!1){const n=[];for(const o of e){const i=o===null?Kx:o;let c;if(typeof i=="object"||typeof i=="function"?c="_objectHashes":typeof i=="symbol"?c="_symbolHashes":c=!1,!c)n.push(i);else if(this[c].has(i))n.push(this[c].get(i));else if(r){const d=`@@mkm-ref-${Qx++}@@`;this[c].set(i,d),n.push(d)}else return!1}return JSON.stringify(n)}set(e,r){const{publicKey:n}=this._getPublicKeys(e,!0);return super.set(n,r)}get(e){const{publicKey:r}=this._getPublicKeys(e);return super.get(r)}has(e){const{publicKey:r}=this._getPublicKeys(e);return super.has(r)}delete(e){const{publicKey:r,privateKey:n}=this._getPublicKeys(e);return!!(r&&super.delete(r)&&this._publicKeys.delete(n))}clear(){super.clear(),this._symbolHashes.clear(),this._publicKeys.clear()}get[Symbol.toStringTag](){return"ManyKeysMap"}get size(){return super.size}}new ey;function ky(){}function wi(t,...e){}const ty={debug:(...t)=>wi(console.debug,...t),log:(...t)=>wi(console.log,...t),warn:(...t)=>wi(console.warn,...t),error:(...t)=>wi(console.error,...t)},ry=(async()=>{try{const{main:t,...e}=Vx,r=new Aa("content",e);return await t(r)}catch(t){throw ty.error('The content script "content" crashed on startup!',t),t}})(),Sd={comments:{name:"comments",description:"评论区域",selectors:[".comment",".comments",".reply",".replies",'[class*="comment"]','[class*="reply"]','[data-testid*="comment"]','[data-testid*="reply"]',"#comments"]},"user-info":{name:"user-info",description:"用户信息(头像、昵称等)",selectors:[".author",".avatar",".username",".user-info",".user-name",".profile",'[class*="author"]','[class*="avatar"]','[class*="username"]','[class*="profile-"]']},metadata:{name:"metadata",description:"元数据(时间、浏览量等)",selectors:[".date",".time",".timestamp",".views",".likes",".stats","time","[datetime]",'[class*="date"]','[class*="time"]','[class*="view"]','[class*="like"]']},ads:{name:"ads",description:"广告",selectors:[".ad",".ads",".advertisement",".sponsored",".promotion",'[class*="ad-"]','[class*="ads-"]','[class*="advert"]','[class*="sponsor"]','[id*="ad-"]','[id*="ads-"]',"[data-ad]","[data-ad-slot]"]},social:{name:"social",description:"社交分享按钮",selectors:[".share",".social",".follow",".subscribe",'[class*="share"]','[class*="social"]','[class*="follow"]','[data-testid*="share"]']},navigation:{name:"navigation",description:"导航元素",selectors:["nav","header","footer","aside",".nav",".navigation",".sidebar",".breadcrumb",".menu",".toc",'[role="navigation"]','[role="banner"]','[role="contentinfo"]']},interactions:{name:"interactions",description:"互动按钮(点赞、收藏等)",selectors:[".like",".favorite",".bookmark",".collect",".upvote",".downvote",'[class*="like"]','[class*="favorite"]','[class*="bookmark"]','[data-testid*="like"]','[data-testid*="retweet"]','[role="group"]']},related:{name:"related",description:"相关推荐",selectors:[".related",".recommend",".suggestion",".more-articles",'[class*="related"]','[class*="recommend"]','[class*="suggestion"]']}},_d="!first:",fo="data-smartclip-preserve";function Td(t){if(!t.startsWith("@"))return[t];const e=Sd[t.slice(1)];return e?e.selectors:[]}function ny(t){return typeof t=="string"?{selector:t,enabled:!0,firstOnly:!1}:{...t,enabled:t.enabled!==!1,firstOnly:t.firstOnly||!1}}function Ci(t){const e=ny(t);return e.enabled?{selectors:Td(e.selector),firstOnly:e.firstOnly}:{selectors:[],firstOnly:!1}}function Ir(t,e){try{return Array.from(t.querySelectorAll(e))}catch{return[]}}function Si(t){t.setAttribute(fo,"true")}function wa(t){return t.getAttribute(fo)==="true"}function Dd(t){Ir(t,`[${fo}]`).forEach(e=>e.removeAttribute(fo))}function oy(t,e){if(!e.startsWith(_d))return null;const r=e.slice(_d.length),n=Ir(t,r);let o=0;for(let i=1;i<n.length;i++)wa(n[i])||(n[i].remove(),o++);return{removedCount:o}}function ho(t,e){let r=0;for(const n of e){const{selectors:o,firstOnly:i}=Ci(n);for(const c of o){const d=oy(t,c);if(d){r+=d.removedCount;continue}const g=Ir(t,c),_=i&&g.length>0?[g[0]]:g;for(const E of _)wa(E)||(E.remove(),r++)}}return r}function iy(t,e){let r=0;for(const n of e){const{selectors:o,firstOnly:i}=Ci(n);for(const c of o){const d=Ir(t,c);if(i&&d.length>0){Si(d[0]),r++;for(let g=1;g<d.length;g++)d[g].remove()}else for(const g of d)Si(g),r++}}return r}function sy(t,e){const r=[],n=new Set;for(const o of e){const{selectors:i,firstOnly:c}=Ci(o);for(const d of i){const g=Ir(t,d);if(c&&g.length>0)n.has(g[0])||(n.add(g[0]),r.push(g[0].cloneNode(!0)));else for(const _ of g)n.has(_)||(n.add(_),r.push(_.cloneNode(!0)))}}return r}function _i(t,e){if(e.enabled===!1)return 0;const r=Ir(t,e.container);if(r.length===0)return 0;let n=0;for(const o of r)e.include&&e.include.length>0&&iy(o,e.include),e.exclude&&e.exclude.length>0&&ho(o,e.exclude),Dd(o),n++;return n}function ay(t){let e=0;const r=Ir(t,`[${fo}]`);if(r.length===0){for(const i of Array.from(t.children))i.remove(),e++;return e}const n=new Set;for(const i of r){let c=i.parentElement;for(;c&&c!==t;)n.add(c),c=c.parentElement}const o=i=>{if(wa(i))return!0;if(n.has(i)){for(const c of Array.from(i.children))o(c)||(c.remove(),e++);return!0}return!1};for(const i of Array.from(t.children))o(i)||(i.remove(),e++);return e}function ly(t,e){if(!e)return{html:t,stats:{removedCount:0,preservedCount:0,templateCount:0}};const r=new DOMParser().parseFromString(t,"text/html").body,n={removedCount:0,preservedCount:0,templateCount:0};if(e.include&&e.include.length>0){const o=sy(r,e.include);if(n.preservedCount=o.length,o.length===0)return{html:"",stats:n};if(e.exclude&&e.exclude.length>0)for(const i of o)n.removedCount+=ho(i,e.exclude);if(e.templates&&e.templates.length>0)for(const i of o)for(const c of e.templates)n.templateCount+=_i(i,c);return{html:o.map(i=>i.outerHTML).join(`
|
|
667
|
+
`),stats:n}}if(e.exclude&&e.exclude.length>0&&(n.removedCount=ho(r,e.exclude)),e.templates&&e.templates.length>0)for(const o of e.templates)n.templateCount+=_i(r,o);return{html:r.innerHTML,stats:n}}function cy(t,e){const r={removedCount:0,preservedCount:0,templateCount:0};if(!e)return r;if(e.include&&e.include.length>0){for(const n of e.include){const{selectors:o,firstOnly:i}=Ci(n);for(const c of o){const d=Ir(t,c);if(i&&d.length>0)Si(d[0]),r.preservedCount++;else for(const g of d)Si(g),r.preservedCount++}}if(r.removedCount=ay(t),Dd(t),e.exclude&&e.exclude.length>0&&(r.removedCount+=ho(t,e.exclude)),e.templates&&e.templates.length>0)for(const n of e.templates)r.templateCount+=_i(t,n)}else if(e.exclude&&e.exclude.length>0&&(r.removedCount=ho(t,e.exclude)),e.templates&&e.templates.length>0)for(const n of e.templates)r.templateCount+=_i(t,n);return r}function uy(t,e){const r=new DOMParser().parseFromString(t,"text/html"),n=Td(e);let o=0;for(const i of n)o+=Ir(r.body,i).length;return o}function dy(t){var r,n,o;const e=[];return(r=t.exclude)==null||r.forEach((i,c)=>{const d=typeof i=="string"?i:i.selector;(!d||d.trim()==="")&&e.push(`exclude[${c}]: 选择器不能为空`)}),(n=t.include)==null||n.forEach((i,c)=>{const d=typeof i=="string"?i:i.selector;(!d||d.trim()==="")&&e.push(`include[${c}]: 选择器不能为空`)}),(o=t.templates)==null||o.forEach((i,c)=>{(!i.name||String(i.name).trim()==="")&&e.push(`templates[${c}]: 模板名称不能为空`),(!i.container||String(i.container).trim()==="")&&e.push(`templates[${c}]: 容器选择器不能为空`)}),{valid:e.length===0,errors:e}}const fy=Object.freeze(Object.defineProperty({__proto__:null,SELECTOR_GROUPS:Sd,filterContent:ly,filterElement:cy,testSelector:uy,validateFilter:dy},Symbol.toStringTag,{value:"Module"}));return ry})();
|
|
668
|
+
content;
|