Files

641 lines
228 KiB
JavaScript
Raw Permalink Normal View History

2026-02-13 22:24:27 +08:00
"use strict";var lc=Object.defineProperty;var cc=(e,t,n)=>t in e?lc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var T=(e,t,n)=>(cc(e,typeof t!="symbol"?t+"":t,n),n);const Lt=require("siyuan");function uc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ht=uc(Lt);/**
* @vue/shared v3.5.27
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Ar(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const _e={},Mn=[],Nt=()=>{},Oa=()=>!1,Ni=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Rr=e=>e.startsWith("onUpdate:"),Me=Object.assign,Dr=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},dc=Object.prototype.hasOwnProperty,he=(e,t)=>dc.call(e,t),$=Array.isArray,Hn=e=>Io(e)==="[object Map]",Kn=e=>Io(e)==="[object Set]",gs=e=>Io(e)==="[object Date]",ee=e=>typeof e=="function",He=e=>typeof e=="string",Ot=e=>typeof e=="symbol",Ne=e=>e!==null&&typeof e=="object",Ia=e=>(Ne(e)||ee(e))&&ee(e.then)&&ee(e.catch),Aa=Object.prototype.toString,Io=e=>Aa.call(e),pc=e=>Io(e).slice(8,-1),Ra=e=>Io(e)==="[object Object]",kr=e=>He(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ao=Ar(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ti=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},_c=/-\w/g,Kt=Ti(e=>e.replace(_c,t=>t.slice(1).toUpperCase())),fc=/\B([A-Z])/g,dn=Ti(e=>e.replace(fc,"-$1").toLowerCase()),Da=Ti(e=>e.charAt(0).toUpperCase()+e.slice(1)),Bi=Ti(e=>e?`on${Da(e)}`:""),nt=(e,t)=>!Object.is(e,t),Yo=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ka=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},Oi=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Es;const Ii=()=>Es||(Es=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Sr(e){if($(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],i=He(o)?Ec(o):Sr(o);if(i)for(const r in i)t[r]=i[r]}return t}else if(He(e)||Ne(e))return e}const hc=/;(?![^(]*\))/g,mc=/:([^]+)/,gc=/\/\*[^]*?\*\//g;function Ec(e){const t={};return e.replace(gc,"").split(hc).forEach(n=>{if(n){const o=n.split(mc);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function ln(e){let t="";if(He(e))t=e;else if($(e))for(let n=0;n<e.length;n++){const o=ln(e[n]);o&&(t+=o+" ")}else if(Ne(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const yc="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",bc=Ar(yc);function Sa(e){return!!e||e===""}function vc(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=Tn(e[o],t[o]);return n}function Tn(e,t){if(e===t)return!0;let n=gs(e),o=gs(t);if(n||o)return n&&o?e.getTime()===t.getTime():!1;if(n=Ot(e),o=Ot(t),n||o)return e===t;if(n=$(e),o=$(t),n||o)return n&&o?vc(e,t):!1;if(n=Ne(e),o=Ne(t),n||o){if(!n||!o)return!1;const i=Object.keys(e).length,r=Object.keys(t).length;if(i!==r)return!1;for(const s in e){const a=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(a&&!l||!a&&l||!Tn(e[s],t[s]))return!1}}return String(e)===String(t)}function wr(e,t){return e.findIndex(n=>Tn(n,t))}const wa=e=>!!(e&&e.__v_isRef===!0),ae=e=>He(e)?e:e==null?"":$(e)||Ne(e)&&(e.toString===Aa||!ee(e.toString))?wa(e)?ae(e.value):JSON.stringify(e,Ca,2):String(e),Ca=(e,t)=>wa(t)?Ca(e,t.value):Hn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,i],r)=>(n[Ui(o,r)+" =>"]=i,n),{})}:Kn(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Ui(n))}:Ot(t)?Ui(t):Ne(t)&&!$(t)&&!Ra(t)?String(t):t,Ui=(e,t="")=>{var n;return Ot(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
* @vue/reactivity v3.5.27
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let tt;class Nc{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=tt,!t&&tt&&(this.index=(tt.scopes||(tt.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=tt;try{return tt=this,t()}finally{tt=n}}}on(){++this._on===1&&(this.prevScope=tt,tt=this)}off(){this._on>0&&--this._on===0&&(tt=this.prevScope,this.prevScope=void 0)}stop(t){if(this._active){this._active=!1;let n,o;for(n=0,o=this.effects.length;n<o;n++)this.effects[n].stop();for(this.effects.length=0,n=0,o=this.cleanups.length;n<o;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,o=this.scopes.length;n<o;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function Tc(){return tt}let be;const Pi=new WeakSet;class La{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,tt&&tt.active&&tt.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Pi.has(this)&&(Pi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ha(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,ys(this),xa(this);const t=be,n=Tt;be=this,Tt=!0;try{return this.fn()}finally{Ba(this),be=t,Tt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Mr(t);this.deps=this.depsTail=void 0,ys(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Pi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){or(this)&&this.run()}get dirty(){return or(this)}}let Ma=0,lo,co;function Ha(e,t=!1){if(e.flags|=8,t){e.next=co,co=e;return}e.next=lo,lo=e}function Cr(){Ma++}function Lr(){if(--Ma>0)return;if(co){let t=co;for(co=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;lo;){let t=lo;for(lo=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(o){e||(e=o)}t=n}}if(e)throw e}function xa(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ba(e){let t,n=e.depsTail,o=n;for(;o;){const i=o.prevDep;o.version===-1?(o===n&&(n=i),Mr(o),Oc(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=i}e.deps=t,e.depsTail=n}function or(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ua(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ua(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===yo)||(e.globalVersion=yo,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!or(e))))return;e.flags|=2;const t=e.dep,n=be,o=Tt;be=e,Tt=!0;try{xa(e);const i=e.fn(e._value);(t.version===0||nt(i,e._value))&&(e.flags|=128,e._value=i,t.version++)}catch(i){throw t.version++,i}finally{be=n,Tt=o,Ba(e),e.flags&=-3}}function Mr(e,t=!1){const{dep:n,prevSub:o,nextSub:i}=e;if(o&&(o.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let r=n.computed.deps;r;r=r.nextDep)Mr(r,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Oc(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Tt=!0;const Pa=[];function jt(){Pa.push(Tt),Tt=!1}function $t(){const e=Pa.pop();Tt=e===void 0?!0:e}function ys(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=be;be=void 0;try{t()}finally{be=n}}}let yo=0;class Ic{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=t
* @vue/runtime-core v3.5.27
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Ao(e,t,n,o){try{return o?e(...o):e()}catch(i){Di(i,t,n)}}function Ht(e,t,n,o){if(ee(e)){const i=Ao(e,t,n,o);return i&&Ia(i)&&i.catch(r=>{Di(r,t,n)}),i}if($(e)){const i=[];for(let r=0;r<e.length;r++)i.push(Ht(e[r],t,n,o));return i}}function Di(e,t,n,o=!0){const i=t?t.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||_e;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,l,c)===!1)return}a=a.parent}if(r){jt(),Ao(r,null,10,[e,l,c]),$t();return}}Qc(e,n,i,o,s)}function Qc(e,t,n,o=!0,i=!1){if(i)throw e;console.error(e)}const Je=[];let St=-1;const xn=[];let nn=null,kn=0;const Ya=Promise.resolve();let ai=null;function qa(e){const t=ai||Ya;return e?t.then(this?e.bind(this):e):t}function eu(e){let t=St+1,n=Je.length;for(;t<n;){const o=t+n>>>1,i=Je[o],r=vo(i);r<e||r===e&&i.flags&2?t=o+1:n=o}return t}function Pr(e){if(!(e.flags&1)){const t=vo(e),n=Je[Je.length-1];!n||!(e.flags&2)&&t>=vo(n)?Je.push(e):Je.splice(eu(t),0,e),e.flags|=1,Ja()}}function Ja(){ai||(ai=Ya.then(Za))}function tu(e){$(e)?xn.push(...e):nn&&e.id===-1?nn.splice(kn+1,0,e):e.flags&1||(xn.push(e),e.flags|=1),Ja()}function vs(e,t,n=St+1){for(;n<Je.length;n++){const o=Je[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;Je.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function za(e){if(xn.length){const t=[...new Set(xn)].sort((n,o)=>vo(n)-vo(o));if(xn.length=0,nn){nn.push(...t);return}for(nn=t,kn=0;kn<nn.length;kn++){const n=nn[kn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}nn=null,kn=0}}const vo=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Za(e){const t=Nt;try{for(St=0;St<Je.length;St++){const n=Je[St];n&&!(n.flags&8)&&(n.flags&4&&(n.flags&=-2),Ao(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2))}}finally{for(;St<Je.length;St++){const n=Je[St];n&&(n.flags&=-2)}St=-1,Je.length=0,za(),ai=null,(Je.length||xn.length)&&Za()}}let je=null,Qa=null;function li(e){const t=je;return je=e,Qa=e&&e.type.__scopeId||null,t}function Ct(e,t=je,n){if(!t||e._n)return e;const o=(...i)=>{o._d&&ks(-1);const r=li(t);let s;try{s=e(...i)}finally{li(r),o._d&&ks(1)}return s};return o._n=!0,o._c=!0,o._d=!0,o}function qt(e,t){if(je===null)return e;const n=Ci(je),o=e.dirs||(e.dirs=[]);for(let i=0;i<t.length;i++){let[r,s,a,l=_e]=t[i];r&&(ee(r)&&(r={mounted:r,updated:r}),r.deep&&Ft(s),o.push({dir:r,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function _n(e,t,n,o){const i=e.dirs,r=t&&t.dirs;for(let s=0;s<i.length;s++){const a=i[s];r&&(a.oldValue=r[s].value);let l=a.dir[o];l&&(jt(),Ht(l,n,8,[e.el,a,e,t]),$t())}}function nu(e,t){if(ze){let n=ze.provides;const o=ze.parent&&ze.parent.provides;o===n&&(n=ze.provides=Object.create(o)),n[e]=t}}function qo(e,t,n=!1){const o=Tl();if(o||Un){let i=Un?Un._context.provides:o?o.parent==null||o.ce?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&ee(t)?t.call(o&&o.proxy):t}}const ou=Symbol.for("v-scx"),iu=()=>qo(ou);function ru(e,t){return Gr(e,null,{flush:"sync"})}function Jo(e,t,n){return Gr(e,t,n)}function Gr(e,t,n=_e){const{immediate:o,deep:i,flush:r,once:s}=n,a=Me({},n),l=t&&o||!t&&r!=="post";let c;if(Oo){if(r==="sync"){const m=iu();c=m.__watcherHandles||(m.__watcherHandles=[])}else if(!l){const m=()=>{};return m.stop=Nt,m.resume=Nt,m.pause=Nt,m}}const u=ze;a.call=(m,g,v)=>Ht(m,u,g,v);let d=!1;r==="post"?a.scheduler=m=>{ct(m,u&&u.suspense)}:r!=="sync"&&(d=!0,a.scheduler=(m,g)=>{g?m():Pr(m)}),a.augmentJob=m=>{t&&(m.flags|=4),d&&(m.flags|=2,u&&(m.id=u.uid,m.i=u))};const p=Zc(e,t,a);return Oo&&(c?c.push(p):l&&p()),p}function su(e,t,n){const o=this.proxy,i=He(e)?e.includes(".")?el(o,e):()=>o[e]:e.bind(o,o);let r;ee(t)?r=t:(r=t.handler,n=t);const s=Do(this),a=Gr(i,r.bind(o),n);return s(),a}function el(e,t){const n=t.split(".");return()=>{let o=e;for(let i=0;i<n.length&&o;i++)o=o[n[i]];return o}}const au=Symbol("_vte"),lu=e=>e.__isTeleport,cu=Symbol("_leaveCb");function Fr(e,t){e.shapeFlag&6&&e.co
* @vue/runtime-dom v3.5.27
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let fr;const Ms=typeof window<"u"&&window.trustedTypes;if(Ms)try{fr=Ms.createPolicy("vue",{createHTML:e=>e})}catch{}const Al=fr?e=>fr.createHTML(e):e=>e,ad="http://www.w3.org/2000/svg",ld="http://www.w3.org/1998/Math/MathML",Pt=typeof document<"u"?document:null,Hs=Pt&&Pt.createElement("template"),cd={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const i=t==="svg"?Pt.createElementNS(ad,e):t==="mathml"?Pt.createElementNS(ld,e):n?Pt.createElement(e,{is:n}):Pt.createElement(e);return e==="select"&&o&&o.multiple!=null&&i.setAttribute("multiple",o.multiple),i},createText:e=>Pt.createTextNode(e),createComment:e=>Pt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Pt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,i,r){const s=n?n.previousSibling:t.lastChild;if(i&&(i===r||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),!(i===r||!(i=i.nextSibling)););else{Hs.innerHTML=Al(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const a=Hs.content;if(o==="svg"||o==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ud=Symbol("_vtc");function dd(e,t,n){const o=e[ud];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const _i=Symbol("_vod"),Rl=Symbol("_vsh"),hr={name:"show",beforeMount(e,{value:t},{transition:n}){e[_i]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):eo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:o}){!t!=!n&&(o?t?(o.beforeEnter(e),eo(e,!0),o.enter(e)):o.leave(e,()=>{eo(e,!1)}):eo(e,t))},beforeUnmount(e,{value:t}){eo(e,t)}};function eo(e,t){e.style.display=t?e[_i]:"none",e[Rl]=!t}const pd=Symbol(""),_d=/(?:^|;)\s*display\s*:/;function fd(e,t,n){const o=e.style,i=He(n);let r=!1;if(n&&!i){if(t)if(He(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&Qo(o,a,"")}else for(const s in t)n[s]==null&&Qo(o,s,"");for(const s in n)s==="display"&&(r=!0),Qo(o,s,n[s])}else if(i){if(t!==n){const s=o[pd];s&&(n+=";"+s),o.cssText=n,r=_d.test(n)}}else t&&e.removeAttribute("style");_i in e&&(e[_i]=r?o.display:"",e[Rl]&&(o.display="none"))}const xs=/\s*!important$/;function Qo(e,t,n){if($(n))n.forEach(o=>Qo(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=hd(e,t);xs.test(n)?e.setProperty(dn(o),n.replace(xs,""),"important"):e[o]=n}}const Bs=["Webkit","Moz","ms"],Ki={};function hd(e,t){const n=Ki[t];if(n)return n;let o=Kt(t);if(o!=="filter"&&o in e)return Ki[t]=o;o=Da(o);for(let i=0;i<Bs.length;i++){const r=Bs[i]+o;if(r in e)return Ki[t]=r}return t}const Us="http://www.w3.org/1999/xlink";function Ps(e,t,n,o,i,r=bc(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Us,t.slice(6,t.length)):e.setAttributeNS(Us,t,n):n==null||r&&!Sa(n)?e.removeAttribute(t):e.setAttribute(t,r?"":Ot(n)?String(n):n)}function Gs(e,t,n,o,i){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Al(n):n);return}const r=e.tagName;if(t==="value"&&r!=="PROGRESS"&&!r.includes("-")){const a=r==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Sa(n):n==null&&a==="string"?(n="",s=!0):a==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(i||t)}function Xt(e,t,n,o){e.addEventListener(t,n,o)}function md(e,t,n,o){e.removeEventListener(t,n,o)}const Fs=Symbol("_vei");function gd(e,t,n,o,i=null){const r=e[Fs]||(e[Fs]={}),s=r[t];if(o&&s)s.value=o;else{const[a,l]=Ed(t);if(o){const c=r[t]=vd(o,i);Xt(e,a,c,l)}else s&&(md(e,a,s,l),r[t]=void 0)}}const Xs=/(?:Once|Passive|Capture)$/;function Ed(
* Sortable 1.15.6
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/function zs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,o)}return n}function xt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zs(Object(n),!0).forEach(function(o){tp(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zs(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function ti(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ti=function(t){return typeof t}:ti=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ti(e)}function tp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zt(){return zt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},zt.apply(this,arguments)}function np(e,t){if(e==null)return{};var n={},o=Object.keys(e),i,r;for(r=0;r<o.length;r++)i=o[r],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function op(e,t){if(e==null)return{};var n=np(e,t),o,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}var ip="1.15.6";function Wt(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var Qt=Wt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ko=Wt(/Edge/i),Zs=Wt(/firefox/i),fo=Wt(/safari/i)&&!Wt(/chrome/i)&&!Wt(/android/i),Zr=Wt(/iP(ad|od|hone)/i),Sl=Wt(/chrome/i)&&Wt(/android/i),wl={capture:!1,passive:!1};function ce(e,t,n){e.addEventListener(t,n,!Qt&&wl)}function le(e,t,n){e.removeEventListener(t,n,!Qt&&wl)}function hi(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function Cl(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function vt(e,t,n,o){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&hi(e,t):hi(e,t))||o&&e===n)return e;if(e===n)break}while(e=Cl(e))}return null}var Qs=/\s+/g;function lt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var o=(" "+e.className+" ").replace(Qs," ").replace(" "+t+" "," ");e.className=(o+(n?" "+t:"")).replace(Qs," ")}}function z(e,t,n){var o=e&&e.style;if(o){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in o)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),o[t]=n+(typeof n=="string"?"":"px")}}function Pn(e,t){var n="";if(typeof e=="string")n=e;else do{var o=z(e,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Ll(e,t,n){if(e){var o=e.getElementsByTagName(t),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function Mt(){var e=document.scrollingElement;return e||document.documentElement}function Ce(e,t,n,o,i){if(!(!e.getBoundingClientRect&&e!==window)){var r,s,a,l,c,u,d;if(e!==window&&e.parentNode&&e!==Mt()?(r=e.getBoundingClientRect(),s=r.top,a=r.left,l=r.bottom,c=r.right,u=r.height,d=r.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,u=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(i=i||e.parentNode,!Qt))do if(i&&i.getBoundingClientRect&&(z(i,"transform")!=="none"||n&&z(i,"position")!=="static")){var p=i.getBoundingClientRect();s-=p.top+parseInt(z(i,"border-top-width")),a-=p.left+parseInt(z(i,"border-left-width")),l=s+r.height,c=a+r.width;break}while(i=i.parentNode);if(o&&e!==window){var m=Pn(i||e),g=m&&m
SELECT b.content as name, b.id
FROM attributes AS a
JOIN blocks AS b ON a.root_id = b.id
WHERE a.name LIKE 'custom-dailynote%' AND a.block_id = a.root_id
AND b.box = '${e[0].box}'
AND a.value ${o?">":"<"} '${o?s:r}'
ORDER BY
a.value ${o?"ASC":"DESC"}
LIMIT 1`);return O("dailyNote结果",a),a&&a.length>0?a[0]:(O("日记未定位到结果"),null)}function ns(e){return[Se.FILE_NAME_ASC,Se.NAME_NAT_ASC,Se.CREATED_TIME_ASC,Se.MODIFIED_TIME_ASC,Se.REF_COUNT_ASC,Se.DOC_SIZE_ASC,Se.SUB_DOC_COUNT_ASC].includes(e)}function os(e){return[Se.FILE_NAME_ASC,Se.FILE_NAME_DESC,Se.NAME_NAT_ASC,Se.NAME_NAT_DESC,Se.CREATED_TIME_ASC,Se.CREATED_TIME_DESC].includes(e)}function it(e,t,n){const o=b("dialog_panel_plugin_name"),i=`${e} ${o}`;Lt.showMessage(i,t,n)}function Or(e){return new Promise(t=>setTimeout(t,e))}function Gp(){const e=Fp();return e==null?null:e.dataset.nodeId}function Fp(){var e,t,n;if(document.activeElement.classList.contains("protyle-wysiwyg")){let o=(t=(e=window.getSelection())==null?void 0:e.focusNode)==null?void 0:t.parentElement;for(;o!=null&&((n=o==null?void 0:o.dataset)==null?void 0:n.nodeId)==null;)o=o.parentElement;return o}else return null}let ua=0;function Xp({mouseEvent:e,paramDocId:t="",keyParam:n={},openInFocus:o=void 0,removeCurrentTab:i=void 0,autoRemoveJudgeMiliseconds:r=0}){var u,d,p,m;let s;if(e&&((u=e.currentTarget)!=null&&u.getAttribute("data-node-id"))?s=(d=e.currentTarget)==null?void 0:d.getAttribute("data-node-id"):(p=e==null?void 0:e.currentTarget)!=null&&p.getAttribute("data-id")?s=(m=e.currentTarget)==null?void 0:m.getAttribute("data-id"):s=t,!oe(s)){O("错误的id",s);return}if(ve()){Lt.openMobileFileById(un().app,s);return}O("openRefLinkEventAPIF",e),e&&(n={},n.ctrlKey=e.ctrlKey,n.shiftKey=e.shiftKey,n.altKey=e.altKey,n.metaKey=e.metaKey);let a;n.altKey?a="right":n.shiftKey&&(a="bottom"),r>0&&(Date.now()-ua<r&&(i=!0),ua=Date.now());const l=pn(!0),c={app:un().app,doc:{id:s,zoomIn:o},position:a,keepCursor:aa(n)?!0:void 0,removeCurrentTab:i};O("打开文档执行参数",c),Lt.openTab(c),i&&!aa(n)&&(O("插件自行移除页签"),Pp(l),i=!1)}function bi(e){if(e.length!==14)return Le("Invalid date string length. Expected format: 'YYYYMMDDHHmmss'"),null;const t=parseInt(e.slice(0,4),10),n=parseInt(e.slice(4,6),10)-1,o=parseInt(e.slice(6,8),10),i=parseInt(e.slice(8,10),10),r=parseInt(e.slice(10,12),10),s=parseInt(e.slice(12,14),10),a=new Date(t,n,o,i,r,s);return isNaN(a.getTime())?(Le("Invalid date components."),null):a}function da(e){if(e.length!==14)return Le("Invalid date string length. Expected format: 'YYYYMMDDHHmmss'"),"";const t=e.substring(0,4),n=e.substring(4,6),o=e.substring(6,8),i=e.substring(8,10),r=e.substring(10,12),s=e.substring(12,14);return`${t}-${n}-${o} ${i}:${r}:${s}`}function is(){let e="",t=0,n=0;for(t=0;t<36;t++)t===8||t===13||t===18||t===23?e+="-":t===14?e+="4":(n=Math.random()*16|0,t===19&&(n=n&3|8),e+=n.toString(16));return e}function Wp(e){const t=window.siyuan.ws.app.plugins;return t==null?void 0:t.some(n=>n.name===e)}function Vp(e){return Lt.getBackend()!=="darwin"?e.replace(/⌥/g,"Alt ").replace(/⌘/g,"Ctrl ").replace(/⇧/g,"Shift ").replace(/⇪/g,"CapsLock ").replace(/⌃/g,"Ctrl "):e}async function At(e,t){let n;return await fetch(t,{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"}}).then(o=>{n=o.json()}),n}async function Co(e){const t=await e;return t.code!=0||t.data==null?null:t.data}async function xe(e){let n=await At({stmt:e},"/api/query/sql");if(n.code==0&&n.data!=null)return n.data;if(n.msg!="")throw new Error(`SQL ERROR: ${n.msg}`);return[]}async function Lo({notebook:e,path:t,maxListCount:n=void 0,sort:o=void 0,ignore:i=!0,showHidden:r=null}){let s="/api/filetree/listDocsByPath",a={notebook:e,path:t};n!=null&&n>=0&&(a.maxListCount=n),o!=null&&o!=Se.FOLLOW_DOC_TREE&&o!=Se.UNASSIGNED&&(a.sort=o),i!=null&&(a.ignoreMaxListHint=i),r!=null&&(a.showHidden=r);let l=await At(a,s);return l.code!=0||l.data==null?(Le("listDocsByPath请求错误",l.msg),new Array):l.data.files}async function Kp(e){let n=await At({id:e},"/api/attr/getBlockAttrs");if(n.code!=0)throw Error("获取挂件块参数失败");return n.data}function pn(e=!1){var o,i,r;let t=null;t=(o=window.top.document.querySelector(".layout__wnd--active .protyle.fn__flex-1:not(.fn__none) .protyle-background"))==null?voi
.og-hn-heading-docs-container span.docLinksWrapper {
min-width: ${e.sameWidth}em;
}`,r=e.hideIndicator?`
.og-hn-heading-docs-container .og-hierachy-navigate-doc-indicator {
display:none;
}
`:"",s=e.areaBorder?`
.og-hierachy-navigate-doc-container {
border: 1px solid rgba(0, 0, 0, 0);
}
.og-hierachy-navigate-doc-container:hover {
border: 1px solid var(--b3-theme-surface-lighter);
}
`:"",a=e.noneAreaHide?`
.${h.NONE_CLASS_NAME} {
display: none;
}
`:"",l=e.endDocAreaPaddingTop?`/*文档结尾区域*/
.og-hn-heading-docs-container.og-hn-at-doc-end{
border-top: 2px dotted var(--b3-table-border-color);
}`:"",c=`
.og-hn-container-multiline {
text-indent: -2em; /*2.28略微多了*/
padding-left: 2em;
overflow-x: hidden;
/* #30 2.28em与100%导致宽度溢出 */
padding-right: 0em;
width: auto;
}
.og-hn-container-multiline .og-hierachy-navigate-doc-indicator {
}
.og-hn-container-multiline .og-hn-emoji-and-name {
text-indent: 0px;
}
.og-hn-container-multiline .og-hn-doc-none-word {
text-indent: 0px;
}
`,u=`
.${h.TO_THE_TOP_CLASS_NAME} {
z-index: 9;
position: fixed;
top: 10px;
left: 10px;
background: var(--b3-toolbar-background);
border: 1px solid var(--b3-toolbar-blur-background);
max-height: 60vh;
max-width: 50vw;
}
.${h.TO_THE_TOP_CLASS_NAME} .og-hierachy-navigate-movetoparea-container {
cursor: move;
display: block;
}
.og-hierachy-navigate-movetoparea-container {
display: none;
}
`,d=e.sameWidthColumn;ve()&&(d=e.sameWidthColumnMobile);let p=e.docNameCentering?"margin: 0 auto; /*居中显示*/":"";const m=d>0?`
.og-hierachy-navigate-doc-container.og-hierachy-navigate-children-doc-container span.docLinksWrapper,
.og-hierachy-navigate-doc-container.og-hierachy-navigate-sibling-doc-container span.docLinksWrapper,
.og-hierachy-navigate-doc-container.og-hierachy-navigate-onthisday-doc-container span.docLinksWrapper,
.og-hierachy-navigate-doc-container.og-hierachy-navigate-parent-sibling-doc-container span.docLinksWrapper,
.og-hierachy-navigate-doc-container.og-hierachy-navigate-next-doc-container span.docLinksWrapper,
.og-hierachy-navigate-doc-container.og-hierachy-navigate-parent-doc-container span.docLinksWrapper,
.og-hierachy-navigate-doc-container.og-hierachy-navigate-backlink-doc-container span.docLinksWrapper {
width: calc( (100% - ${d} * ${d==1?"0px":"10px"}) / ${d});
${d==1?"margin-right: 0px;":""}/*仅一列时忽略margin-right*/
}
`:"",g=ve()?`.og-hierachy-navigate-doc-container.og-hierachy-navigate-next-doc-container span.docLinksWrapper {
width: 100%;
margin-right: 0px;
}`:"",v=`
.${h.CONTAINER_CLASS_NAME} span.docLinksWrapper{
background-color: var(--b3-protyle-code-background);/*var(--b3-protyle-inline-code-background); --b3-protyle-code-background --b3-theme-surface-light*/
color: var(--b3-protyle-inline-code-color);
/*line-height: calc(1em + 2px);*/ /*此项导致连接上下可滚动*/
font-weight: 400;
display: inline-flex;
align-items: center;
box-sizing: border-box;
padding: 4px 6px;
border-radius: calc(1em + 2px);
transition: var(--b3-transition);
margin-bottom: 3px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: calc(100% - 10px); /*需要排除margin-right: 10px的影响*/
${ve()?"margin-top: 6px;":""}
}
.${h.CONTAINER_CLASS_NAME} span.docLinksWrapper.og-hn-docLinksWrapper-hl {
background-color: color-mix(in srgb, var(--b3-protyle-code-background) 95%, var(--b3-theme-on-background));
border: 0.55px dashed color-mix(in srgb, var(--b3-protyle-code-background) 35%, var(--b3-theme-on-background));
}
.${h.CONTAINER_CLASS_NAME} span.docLinksWrapper.og-none-click {
color: var(--b3-theme-on-background);
}
.${h.CONTAINER_CLASS_NAME} span.og-hn-emoji-and-name {
${p} /*居中显示*/
text-overflow: ellipsis;
overflow-x: hidden; /* 修复文字下侧被截断的问题 */
}
/* 语义调整 refLinks 的可点击,其他仅样式 https://github.com/OpaqueGlass/syplugin-hierarchyNavigate/issues/61 */
.og-hierachy-navigate-sibling-doc-container span.docLinksWrapper,
.og-hierachy-navigate-children-doc-container span.docLinksWrapper,
.og-hierachy-navigate-next-doc-container span.docLinksWrapper,
.og-hierachy-navigate-backlink-doc-container span.docLinksWrapper {
margin-right: 10px;
}
/* 这里,由于提示词单独占位,导致提示词-链接之间gap一样也有10px或许可以考虑全都加入gap就不显得突兀了 */
.og-hierachy-navigate-sibling-doc-container,
.og-hierachy-navigate-children-doc-container,
.og-hierachy-navigate-next-doc-container,
.og-hierachy-navigate-backlink-doc-container {
/*display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: flex-start;*/
}
`,G=`
.og-hierachy-navigate-next-preview-doc-container {
max-height: 230px;
overflow: scroll;
}
.og-hn-np-inner-flex {
display: flex;
justify-content: space-between;
margin: 10px 0;
gap: 20px;
height: 100%;
}
.og-hn-np-nav-preview {
flex: 1;
min-width: 0;
cursor: pointer;
display: flex;
}
.og-hn-np-nav-preview-inner {
border: 1px solid var(--b3-table-border-color);
border-radius: 8px;
padding: 15px;
height: 100%;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
width: 100%;
min-height: 0;
box-sizing: border-box;
}
.og-hn-np-nav-preview-inner:hover {
border-color: #888;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
/*background-color: #00000011;*/
}
.og-hn-np-prev .og-hn-np-nav-direction,
.og-hn-np-prev .og-hn-np-nav-post-title,
.og-hn-np-prev .og-hn-np-nav-excerpt {
text-align: left;
}
.og-hn-np-next .og-hn-np-nav-direction,
.og-hn-np-next .og-hn-np-nav-post-title{
text-align: right;
}
.og-hn-np-nav-direction {
font-weight: bold;
color: var(--custom-h2-color);
margin-bottom: 5px;
}
.og-hn-np-nav-post-title {
font-size: 1.1em;
font-weight: bold;
color: var(--custom-h2-color);
margin-bottom: 10px;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.og-hn-np-nav-excerpt {
color: var(--b3-theme-on-surface);
font-size: 1em;
line-height: 1.5;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
flex-grow: 1;
}
.og-hn-np-placeholder {
background-color: #00000001;
color: transparent;
user-select: none;
}
.og-hn-np-placeholder .og-hn-np-nav-excerpt {
background-color: #eee;
color: transparent;
border-radius: 4px;
}
.og-hn-np-placeholder .og-hn-np-nav-direction::after {
content: "${b("no_doc")}";
color: #999;
display: block;
}
.og-hn-np-placeholder .og-hn-np-nav-post-title,
.og-hn-np-placeholder .og-hn-np-nav-excerpt {
visibility: hidden;
}
.og-hn-np-nav-preview.og-hn-np-non-clickable {
cursor: not-allowed;
}
.og-hn-heading-docs-container.og-hn-at-doc-end {
padding-bottom: 20px;
}
.og-hn-np-nav-preview-inner.og-hn-np-placeholder .og-hn-np-nav-direction {
color: #999;
}
`,U=`
/* 主容器 */
.og-hn-pb-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
overflow: scroll;
}
/* 单个文档方块 */
.og-hn-pb-doc-box {
border: 1px solid var(--b3-table-border-color);
flex: 1 0 250px;
max-height: 200px;
overflow: auto;
border-radius: 10px;
padding: 10px 15px 15px 8px;
/*margin: 5px;*/
display: flex;
flex-direction: column;
}
/* 文档标题 */
.og-hn-pb-title {
margin: 10px 0;
font-size: 1.1em;
font-weight: bold;
color: var(--custom-h2-color);
cursor: pointer;
}
/* 文档内容预览 */
.og-hn-pb-content {
margin: 0 0 0 7px;
width: 95%;
white-space: normal;
overflow: hidden;
font-size: 1em;
}
/* 子文档容器 */
.og-hn-pb-child-container {
margin-left: 7px;
width: 95%;
}
/* 子文档项 */
.og-hn-pb-child-item {
margin: 5px 0;
font-size: 0.9em;
white-space: normal;
}
/* 子文档链接 */
.og-hn-pb-child-item {
cursor: pointer;
color: var(--b3-protyle-inline-link-color);
}
.og-hn-pb-child-item:hover {
background-color: #00000010;
}
/* emoji图标 */
.og-hn-pb-emoji {
margin-right: 5px;
}
/* 深色模式适配 */
.dark-mode .og-hn-pb-doc-box {
background-color: #efefef15;
color: #C9D1D9;
}
.dark-mode .og-hn-pb-doc-box:hover {
background-color: #efefef25;
}
.dark-mode .og-hn-pb-content a {
color: #7aa7d4 !important;
}
/* 悬停效果 */
.og-hn-pb-doc-box:hover {
border-color: #888;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
/* 任务列表样式调整 */
.og-hn-pb-content ul:has(> .protyle-task) {
list-style-type: none;
padding-left: 16px;
}
.og-hn-pb-content > ul:has(> .protyle-task) {
padding-left: 0px;
}
.og-hn-pb-content .protyle-task input ~ p {
display: inline-block;
}
/* 图片显示 */
.og-hn-pb-content .img img {
max-width: 100%;
display: inline-block;
}
.og-hn-pb-content .code-block {
background-color: unset;
}
.og-hn-pb-content .code-block .hljs {
overflow: hidden;
}
`,x=e.relativeFontSize&&e.relativeFontSize>0?Math.round(e.relativeFontSize*parseFloat(window.siyuan.config.editor.fontSize??16)):e.fontSize;o.innerHTML=`
.og-hn-doc-none-word {
background-color: #d23f3155;/*var(--b3-protyle-inline-code-background); --b3-protyle-code-background --b3-theme-surface-light*/
width: 2.5em;
text-align: center;
display: inline-grid !important;
color: var(--b3-theme-on-background);
line-height: calc(1em + 2px);
font-weight: 400;
align-items: center;
box-sizing: border-box;
/* #30 调整padding左右尽量避免换行导致右侧大量留白 */
padding: 4px 4px;
border-radius: calc(1em + 2px);
transition: var(--b3-transition);
margin-bottom: 3px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.og-hn-menu-emojitext, .og-hn-menu-emojipic {
align-self: center;
height: 14px;
width: 14px;
line-height: 14px;
margin-right: 8px;
flex-shrink: 0;
}
img.og-hn-menu-emojipic {
width: 16px;
height: 16px;
}
/* 语义调整 refLink的可点击其他仅样式 https://github.com/OpaqueGlass/syplugin-hierarchyNavigate/issues/61 */
.og-hn-heading-docs-container span.docLinksWrapper.refLinks:hover {
cursor: pointer;
box-shadow: 0 0 2px var(--b3-list-hover);
opacity: .86;
/*background-color: var(--b3-toolbar-hover);*/
/*text-decoration: underline;*/
}
.og-hn-heading-docs-container .trimDocName {
overflow: hidden;
text-overflow: ellipsis;
}
.og-hn-heading-docs-container {
padding: 0px 6px;
font-size: ${x}px;
}
${i}
${r}
${a}
${e.hideIndicator?"":c}
${m}
${g} /* 移动端下一篇强制一列 */
${s}
${u}
${G}
${U}
${l}
/*
.og-hierachy-navigate-doc-container.og-hierachy-navigate-next-doc-container span.docLinksWrapper {
width: calc( (100% - 2em - 1 * 10px) / 4);
}*/
.og-hierachy-navigate-doc-container {
max-height: ${ve()?"25vh":e.maxHeightLimit+"em"};
overflow-y: scroll;
}
.og-hierachy-navigate-doc-container.og-hn-not-fold {
max-height: none;
}
.og-hierachy-navigate-doc-container + .og-hierachy-navigate-doc-container {
padding-top: 6px;
}
.og-hn-create-at-wrapper, .og-hn-modify-at-wrapper, .og-hn-child-doc-count-wrapper, .og-hn-child-word-count-wrapper {
margin-right: 8px;
}
.og-hn-create-at-indicator, .og-hn-modify-at-indicator, .og-hn-child-word-count-indicator, .og-hn-child-doc-count-wrapper {
color: var(--b3-theme-on-surface);
}
.og-hn-create-at-content, .og-hn-modify-at-content, .og-hn-child-word-count-content, .og-hn-child-doc-count-content {
font-weight: 600;
color: var(--b3-theme-on-background);
}
.og-hn-notebook-wrapper {
color: var(--b3-theme-on-background);
}
.og-hierachy-navigate-info-container {
margin-bottom: 7px;
}
.${h.CONTAINER_CLASS_NAME} {
text-align: left;
}
/* 面包屑箭头 */
.og-hn-heading-docs-container .og-fake-breadcrumb-arrow-span .${h.ARROW_CLASS_NAME} {
height: 10px;
width: 10px;
color: var(--b3-theme-on-surface-light);
margin: 0 4px;
flex-shrink: 0;
}
/* 块没有>功能,屏蔽 */
.og-hn-heading-docs-container .og-fake-breadcrumb-arrow-span[data-type="FILE"],
.og-hn-heading-docs-container .og-fake-breadcrumb-arrow-span[data-type="NOTEBOOK"] {
display: inline-block;
cursor: pointer;
}
.og-hn-parent-area-replace-with-breadcrumb .docLinksWrapper {
margin: 0 auto;
}
.og-hn-widget-container {
border-bottom: solid 1px var(--b3-border-color);
}
.og-hn-widget-container {
padding: 0px 6px;
}
.og-hn-widget-container.og-hn-mobile {
padding-top: 16px;
padding-left: 24px;
padding-right: 16px;
}
.og-hn-more-less {
color: var(--b3-protyle-inline-link-color);
cursor: pointer;
}
.og-hn-more-less:hover {
text-decoration: underline;
}
${e.docLinkCSS==t.docLinkCSS&&e.docLinkClass==t.docLinkClass?v:""}
.${h.PARENT_CONTAINER_ID} {${Ko(e.parentBoxCSS)}}
.${h.CHILD_CONTAINER_ID} {${Ko(e.childBoxCSS)}}
.${h.SIBLING_CONTAINER_ID} {${Ko(e.siblingBoxCSS)}}
.${h.CONTAINER_CLASS_NAME} span.docLinksWrapper {${Ko(e.docLinkCSS)}}
/* 置顶后占位 */
.${h.PLACEHOLDER_FOR_POP_OUT_CLASS_NAME} {
display: flex;
justify-content: center;
align-items: center;
}
/* 折叠隐藏 */
.og-hn-heading-docs-container .${h.IS_FOLDING_CLASS_NAME} {
display: none !important;
}
`,n.appendChild(o)}function Ko(e){return e?e.replace(new RegExp("<[^<]*style[^>]*>","g"),""):""}function $l(){var e;(e=document.getElementById(h.STYLE_ID))==null||e.remove()}function Yl(){const e=document.createElement("style");e.id=h.HIDE_COULD_FOLD_STYLE_ID,e.innerHTML=`.${h.COULD_FOLD_CLASS_NAME} {display: none !important;}`,document.head.appendChild(e)}function zp(){var e;(e=document.getElementById(h.HIDE_COULD_FOLD_STYLE_ID))==null||e.remove()}const Zp={style:{"word-break":"normal"}},Qp={style:{margin:"10px 0px","list-style-position":"inside"}},e_=rt({__name:"outdatedSetting",props:{outdatedKeys:{},defaultSettings:{}},setup(e){const t=e,n=Pe([]);return t.outdatedKeys.forEach(o=>{n.value.push(b(`setting_${o}_name`))}),(o,i)=>(X(),ne("div",Zp,[K("p",null,ae(P(b)("dialog_panel_outdate_content1")),1),K("ul",Qp,[(X(!0),ne(Ee,null,dt(n.value,(r,s)=>(X(),ne("li",null,ae(r)+" ["+ae(P(b)("default"))+": "+ae(e.defaultSettings[e.outdatedKeys[s]])+"] ",1))),256))]),K("p",null,ae(P(b)("dialog_panel_outdate_content2")),1)]))}});new Array;let Cn=Pe({});const Vt={fontSize:12,relativeFontSize:0,parentBoxCSS:"",siblingBoxCSS:"",childBoxCSS:"",docLinkCSS:"",docLinkClass:"",icon:h.ICON_ALL,sibling:!1,nameMaxLength:20,docMaxNum:128,linkDivider:"● ",popupWindow:h.POP_LIMIT,maxHeightLimit:10,hideIndicator:!1,sameWidth:0,immediatelyUpdate:!0,noneAreaHide:!1,lcdEmptyDocThreshold:0,mainRetry:5,noChildIfHasAv:!1,showBackLinksType:h.BACKLINK_NORMAL,openDocContentGroup:[S.BREADCRUMB,S.CHILD],mobileContentGroup:[S.BREADCRUMB,S.CHILD],flashcardContentGroup:[S.BREADCRUMB,S.BLOCK_BREADCRUMB],normalEndContentGroup:[],childOrder:"FOLLOW_DOC_TREE",showHiddenDoc:!1,hideBlockBreadcrumbInDesktop:!0,sameWidthColumn:6,sameWidthColumnMobile:2,previousAndNextFollowDailynote:!1,mobileBackReplace:!1,mobileRemoveAllArea:!1,doNotAddToTitle:!0,areaBorder:!1,debugMode:!1,showNotebookInBreadcrumb:!1,areaHideFrom:0,removeRegStrListForLinks:"",pinRegStrListForLinks:"",sortForBackLink:re.NAME_NATURAL_ASC,sortForForwardLink:re.NAME_NATURAL_ASC,openDocClickListenerCompatibilityMode:!1,autoRemoveOldTabJudgeMiliseconds:0,openDocRemoveCurrentTab:h.REMOVE_CURRENT_TAB_DEFAULT,requestAllDocIcon:!1,performanceMode:!1,docNameCentering:!0,endDocAreaPaddingTop:!0,keepTempTop:!1};let as=[],jo=null;function t_(){const e=[S.PARENT,S.CHILD,S.SIBLING,S.PARENT_SIBLING,S.PREV_NEXT,S.BACKLINK,S.BREADCRUMB,S.INFO,S.WIDGET,S.ON_THIS_DAY,S.FORWARDLINK,S.PREV_NEXT_PREVIEW,S.PREVIEW_BOX],t=[S.PARENT,S.CHILD,S.SIBLING,S.PARENT_SIBLING,S.PREV_NEXT,S.BACKLINK,S.BREADCRUMB,S.INFO,S.WIDGET,S.BLOCK_BREADCRUMB];as.push(new Dn({key:"content",iconKey:"iconOrderedList",props:{basic:[new j({key:"contentOrderTip",type:"TIPS"}),new j({key:"openDocContentGroup",type:"ORDER",options:e}),new j({key:"mobileContentGroup",type:"ORDER",options:e}),new j({key:"flashcardContentGroup",type:"ORDER",options:t}),new j({key:"normalEndContentGroup",type:"ORDER",options:e})],notebook:[new j({key:"notebookOpenDocContentGroup",type:"CUSTOM_NOTEBOOK"})]}}),new Dn({key:"showType",iconKey:"iconTags",props:{showOrNot:[new j({key:"noChildIfHasAv",type:"SWITCH"}),new j({key:"sibling",type:"SWITCH"}),new j({key:"hideBlockBreadcrumbInDesktop",type:"SWITCH"}),new j({key:"showNotebookInBreadcrumb",type:"SWITCH"}),new j({key:"hideIndicator",type:"SWITCH"}),new j({key:"noneAreaHide",type:"SWITCH"})],order:[new j({key:"childOrder",type:"SELECT",options:Object.keys(Se)}),new j({key:"sortForBackLink",type:"SELECT",options:Object.values(re)})],extend:[new j({key:"showHiddenDoc",type:"SWITCH"}),new j({key:"lcdEmptyDocThreshold",type:"NUMBER",min:-1}),new j({key:"showBackLinksType",type:"SELECT",options:[h.BACKLINK_NORMAL,h.BACKLINK_DOC_ONLY]}),new j({key:"pinRegStrListForLinks",type:"TEXTAREA"}),new j({key:"removeRegStrListForLinks",type:"TEXTAREA"})]}}),new Dn({key:"general",iconKey:"iconSettings",props:[new j({key:"fontSize",type:"NUMBER"}),new j({key:"relativeFontSize",type:"NUMBER",min:0,max:4}),new j({key:"popupWindow",type:"SELECT",options:[h.POP_NONE,h.POP_LIMIT,h.POP_ALL]}),new j({key:"docMaxNum",type:"NUMBER"}),new j({key:"
<div id="og_plugintemplate_${o}" class="b3-dialog__content" style="overflow: hidden; position: relative;height: 100%;"></div>
`,width:ve()?"42vw":"520px",height:(ve(),"auto"),destroyCallback:()=>{n.unmount()}}),n.mount(`#og_plugintemplate_${o}`)}function ha(e){e.debugMode===!0?(O("调试模式已开启"),window.top.OpaqueGlassDebug=!0,window.top.OpaqueGlassDebugV2||(window.top.OpaqueGlassDebugV2={}),window.top.OpaqueGlassDebugV2.hn=5):e.debugMode===!1&&(O("调试模式已关闭"),window.top.OpaqueGlassDebugV2&&window.top.OpaqueGlassDebugV2.hn&&delete window.top.OpaqueGlassDebugV2.hn)}function a_(e){const t=xp(as);for(const n of Object.values(t))if(n.type=="SELECT")n.options.includes(e[n.key])||(e[n.key]=Vt[n.key]);else if(n.type=="ORDER"){const o=[];for(const i of e[n.key])Object.values(S).includes(i)&&o.push(i);e[n.key]=o}else n.type=="SWITCH"?e[n.key]==null&&(e[n.key]=Vt[n.key]):n.type=="NUMBER"&&oe(e[n.key])&&(e[n.key]=parseFloat(e[n.key]));return e}async function l_(){const e=await un().loadData("settings.json");let t=Object.assign({},e);if(e==null||e=="")return null;let n=[];if(e.showDocInfo&&(O("旧设置展示了文档信息"),n.push(S.INFO)),e.replaceWithBreadcrumb?(O("旧设置显示了面包屑"),n.push(S.BREADCRUMB)):n.push(S.PARENT),e.alwaysShowSibling&&(O("旧设置:总是同级"),n.push(S.SIBLING),t.sibling=!1),e.previousAndNext&&(O("旧设置:上下"),n.push(S.PREV_NEXT)),e.showBackLinksArea!=null&&e.showBackLinksArea!=0){O("旧设置:反链"),n.push(S.BACKLINK);const r=[h.BACKLINK_NONE,h.BACKLINK_NORMAL,h.BACKLINK_DOC_ONLY];t.showBackLinksType=r[e.showBackLinksArea]}e.listChildDocs?n.push(S.WIDGET):n.push(S.CHILD),t.openDocContentGroup=n,t.mobileContentGroup=n;const o=[h.ICON_NONE,h.ICON_CUSTOM_ONLY,h.ICON_ALL],i=[h.POP_NONE,h.POP_LIMIT,h.POP_ALL];e.icon!=null&&(t.icon=o[e.icon]),e.popupWindow!=null&&(t.popupWindow=i[e.popupWindow]);for(let r of Object.keys(t))r in Vt||delete t[r];return t=Object.assign(Object.assign({},Vt),t),t}function ls(){return Cn}function te(){return Cn._rawValue}function ql(){return Vt}const c_={disabled:"",value:""},u_=["value"],d_=["disabled"],p_=["disabled"],__=rt({__name:"notebookorder",setup(e){const t=Pe(window.siyuan.notebooks.map(m=>({id:m.id,name:m.name,configTopKeyName:"setting_notebook_order_top_"+m.id,configEndKeyName:"setting_notebook_order_end_"+m.id}))),n=[S.PARENT,S.CHILD,S.SIBLING,S.PREV_NEXT,S.BACKLINK,S.BREADCRUMB,S.INFO,S.WIDGET,S.ON_THIS_DAY,S.FORWARDLINK,S.PREV_NEXT_PREVIEW,S.PREVIEW_BOX],o=n.map(m=>b("setting_openDocContentGroup_option_"+m)),i=n.map(m=>""),r=Pe(""),s=vn(()=>t.value.find(m=>m.id===r.value)),a=ls(),l=vn(()=>s.value&&a.value[s.value.configTopKeyName]!==null&&a.value[s.value.configTopKeyName]!==void 0),c=vn(()=>s.value&&a.value[s.value.configEndKeyName]!==null&&a.value[s.value.configEndKeyName]!==void 0);function u(){s.value&&(l.value?a.value[s.value.configTopKeyName]=null:a.value[s.value.configTopKeyName]=[])}function d(){s.value&&(c.value?a.value[s.value.configEndKeyName]=null:a.value[s.value.configEndKeyName]=[])}function p(m){const g=t.value.find(v=>v.id===m);return g?g.name:m}return(m,g)=>(X(),ne("div",null,[Ge(ei,{settingKey:"",configName:P(b)("setting_selectOneNotebookFirst_name"),configDesp:P(b)("setting_selectOneNotebookFirst_desp")},{default:Ct(()=>[qt(K("select",{class:"b3-select fn__flex-center fn__size200","onUpdate:modelValue":g[0]||(g[0]=v=>r.value=v)},[K("option",c_,ae(P(b)("please_select")),1),(X(!0),ne(Ee,null,dt(t.value,v=>(X(),ne("option",{key:v.id,value:v.id},ae(v.name),9,u_))),128))],512),[[Jr,r.value]])]),_:1},8,["configName","configDesp"]),Ge(ei,{settingKey:"",configName:P(b)("setting_notebookTopAreaEnable_name"),configDesp:P(b)("setting_notebookTopAreaEnable_desp")},{default:Ct(()=>[K("button",{class:"b3-button b3-button--outline fn__flex-center fn__size200",onClick:u,disabled:!s.value},ae(P(b)("enable_or_disable")),9,d_)]),_:1},8,["configName","configDesp"]),r.value&&l.value?(X(),We(mr,{key:0,"setting-key":s.value.configTopKeyName,"config-name":p(r.value)+P(b)("setting_notebookTopArea_index_name"),"config-desp":P(b)("setting_notebookTopArea_index_desp")},{default:Ct(()=>[Ge(Nr,{"option-names":P(o),"option-desps":P(i),"option-
SELECT SUM(length) AS count
FROM blocks
WHERE
path like "%/${e}/%"
AND
type in ("p", "h", "c", "t")
`);return t[0].count?t[0].count:0}async function D_(e,t){return await Lo({path:e.path,notebook:e.box,maxListCount:t})}async function k_(e){const t=await xe(`
SELECT * FROM blocks WHERE path like '%${e}/%' LIMIT 3
`);return!!(t&&t.length>0)}async function zl(e){let t=await xe(`
SELECT count(*) as avcount FROM blocks WHERE root_id = '${e}'
AND type = 'av'
`);return t.length>0&&t[0].avcount>0}async function S_(e,t=0){let n=await $p(e);if(t==0&&n.wordCount!=0&&n.imageCount!=0)return O("treeStat判定文档非空不插入挂件"),!1;if(t!=0){let i=await xe(`SELECT count(*) as bcount FROM blocks WHERE root_id like '${e}' AND type in ('p', 'c', 'iframe', 'html', 'video', 'audio', 'widget', 'query_embed', 't')`);if(i.length>0)return!(i[0].bcount>t)}return(await xe(`SELECT markdown FROM blocks WHERE
root_id like '${e}'
AND type != 'd'
AND (type != 'p'
OR (type = 'p' AND length != 0)
)
LIMIT 5`)).length<=0?!0:(O("sql判定文档非空不插入挂件"),!1)}function w_(){let e=new Date,t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return t=r(t),n=r(n),o=r(o),e.toJSON().replace(new RegExp("-","g"),"").substring(0,8)+t+n+o;function r(s){return s<10?"0"+s:s}}function Ea(){var i;if((i=window==null?void 0:window.Lute)!=null&&i.NewNodeID)return window.Lute.NewNodeID();let e=w_(),t=new Array;for(let r=48;r<=57;r++)t.push(String.fromCharCode(r));for(let r=97;r<=122;r++)t.push(String.fromCharCode(r));let n="";for(let r=0;r<7;r++)n+=t[Math.floor(Math.random()*t.length)];return e+"-"+n}var Zl={};Object.defineProperty(Zl,"__esModule",{value:!0});function C_(e){e===void 0&&(e={});var t=/^0/,n=/\s+/g,o=/^\s+|\s+$/g,i=/[^\x00-\x80]/,r=/^0x[0-9a-f]+$/i,s=/(0x[\da-fA-F]+|(^[\+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|\d+)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=String.prototype.toLocaleLowerCase||String.prototype.toLowerCase,c=e.desc?-1:1,u=-c,d=e.insensitive?function(g){return l.call(""+g).replace(o,"")}:function(g){return(""+g).replace(o,"")};function p(g){return g.replace(s,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0")}function m(g,v){return(!g.match(t)||v===1)&&parseFloat(g)||g.replace(n," ").replace(o,"")||0}return function(g,v){var G=d(g),U=d(v);if(!G&&!U)return 0;if(!G&&U)return u;if(G&&!U)return c;var x=p(G),q=p(U),k=G.match(r),H=U.match(r),E=k&&H?parseInt(k[0],16):x.length!==1&&Date.parse(G),N=k&&H?parseInt(H[0],16):E&&U.match(a)&&Date.parse(U)||null;if(N){if(E===N)return 0;if(E<N)return u;if(E>N)return c}for(var F=x.length,ie=q.length,se=0,De=Math.max(F,ie);se<De;se+=1){var Te=m(x[se]||"",F),Oe=m(q[se]||"",ie);if(isNaN(Te)!==isNaN(Oe))return isNaN(Te)?c:u;if(i.test(Te+Oe)&&Te.localeCompare){var de=Te.localeCompare(Oe);if(de>0)return c;if(de<0)return u;if(se===De-1)return 0}if(Te<Oe)return u;if(Te>Oe)return c;if(""+Te<""+Oe)return u;if(""+Te>""+Oe)return c}return 0}}var L_=Zl.default=C_;function M_(e,t){let n=t.map(Ql).filter(i=>i!=null),o=[];for(let i of e){let r=!1;for(let s of n)if(s.lastIndex=0,s.test(i.name.slice(0,-3))){r=!0;break}r||o.push(i)}return o}function H_(e,t){let n=t.map(Ql).filter(s=>s!=null),o=[],i=[],r=new Array(e.length).fill(!1);for(let s of n)for(let[a,l]of e.entries())s.lastIndex=0,s.test(l.name.slice(0,-3))&&!r[a]&&(o.push(l),r[e.indexOf(l)]=!0);for(let[s,a]of e.entries())r[s]||i.push(a);return o.concat(i)}function $o(e){const t=te(),n=t.removeRegStrListForLinks,o=vr(n)?[]:n.split(`
`),i=t.pinRegStrListForLinks,r=vr(i)?[]:i.split(`
`),s=M_(e,o);return H_(s,r)}function Ql(e){try{return vr(e)?(Le("跳过正则表达式,因为正则字符串为空"),null):new RegExp(e,"gm")}catch(t){return Le("正则表达式无法解析,正则字符串为:"+e,",错误为:"+t),null}}function ya(e){switch(e){case re.NAME_ALPHABET_ASC:return"0";case re.NAME_ALPHABET_DESC:return"1";case re.NAME_NATURAL_ASC:return"4";case re.NAME_NATURAL_DESC:return"5";case re.CREATE_TIME_ASC:return"9";case re.CREATE_TIME_DESC:return"10";case re.UPDATE_TIME_ASC:return"2";case re.UPDATE_TIME_DESC:return"3";default:return Le("反链未知的排序类型:"+e),"3"}}function vi(e,t,n){const o=L_({insensitive:!0});return e.sort((i,r)=>n?o(r[t],i[t]):o(i[t],r[t]))}function x_(e,t){Mo(),window.OGTempHN.recentMenu={menu:e,id:t}}function Mo(){return window.OGTempHN?!0:(window.OGTempHN={},!1)}function B_(e){Mo(),window.OGTempHN.topElement=e}function U_(){return Mo()?window.OGTempHN.topElement:null}function P_(){Mo(),window.OGTempHN.topElement=null}function G_(e){var t,n;if(!Mo())return!1;if(window.OGTempHN.recentMenu){if(window.OGTempHN.recentMenu.id===e&&document.querySelector("#commonMenu[data-name='og-hn-relative-menu']"))return(t=window.OGTempHN.recentMenu.menu)==null||t.close(),window.OGTempHN.recentMenu=null,!0;(n=window.OGTempHN.recentMenu.menu)==null||n.close(),window.OGTempHN.recentMenu=null}return!1}class F_{constructor(t,n){T(this,"basicInfo");T(this,"protyleBasicInfo");T(this,"printerList",{[S.INFO]:X_,[S.BREADCRUMB]:Ln,[S.PARENT]:W_,[S.SIBLING]:ec,[S.PREV_NEXT]:V_,[S.BACKLINK]:nc,[S.CHILD]:tc,[S.WIDGET]:oc,[S.BLOCK_BREADCRUMB]:K_,[S.ON_THIS_DAY]:j_,[S.FORWARDLINK]:$_,[S.PREV_NEXT_PREVIEW]:Y_,[S.PREVIEW_BOX]:q_,[S.PARENT_SIBLING]:J_});this.basicInfo=t,this.protyleBasicInfo=n}async print(t){new Array,new Array,new Array;const n=te();let o=[];o=ve()?n.mobileContentGroup:n.openDocContentGroup;const i=JSON.stringify(this.basicInfo.docBasicInfo.ial??"");if(i.includes("og-hn-ignore")||i.includes("og文档导航忽略"))return null;if(t){if(o=n.normalEndContentGroup,n["setting_notebook_order_end_"+this.basicInfo.docBasicInfo.box]&&(o=n["setting_notebook_order_end_"+this.basicInfo.docBasicInfo.box],V("选择笔记本排序-end")),this.basicInfo.currentDocAttrs["custom-og-hn-end-content"])try{o=JSON.parse(this.basicInfo.currentDocAttrs["custom-og-hn-end-content"]),V("选择文档排序-end")}catch(l){V("用户自定义顺序读取失败",l)}}else if(n["setting_notebook_order_top_"+this.basicInfo.docBasicInfo.box]&&(o=n["setting_notebook_order_top_"+this.basicInfo.docBasicInfo.box],V("选择笔记本排序-top")),this.basicInfo.currentDocAttrs["custom-og-hn-content"])try{o=JSON.parse(this.basicInfo.currentDocAttrs["custom-og-hn-content"]),V("选择文档排序-top")}catch(l){V("用户自定义顺序读取失败",l)}if(this.protyleBasicInfo.flashCard&&(o=n.flashcardContentGroup,V("选择闪卡排序")),t&&this.protyleBasicInfo.mobile)return null;O("docContentKeyGroup",o),O("g_setting",n);let r=[];o.forEach(function(l){r.indexOf(l)===-1&&r.push(l)}),o=r;const s=[];for(const l of o){const c=this.printerList[l];c&&s.push((async()=>{const u=await c.getBindedElement(this.basicInfo,this.protyleBasicInfo),d=await c.isOnlyOnce(this.basicInfo);return u?(u.dataset.ogContentType=l,{element:u,onlyOnce:d,relateContentKey:l}):null})())}const a=await Promise.all(s);return n.areaHideFrom>0&&a.filter(l=>l!=null).length>=n.areaHideFrom&&a.unshift({element:await va.getMoreOrLessElement(this.basicInfo,this.protyleBasicInfo,a.slice()),onlyOnce:await va.isOnlyOnce(this.basicInfo),relateContentKey:S.MORE_OR_LESS}),a.unshift({element:await ba.getBindedElement(this.basicInfo,this.protyleBasicInfo),onlyOnce:await ba.isOnlyOnce(this.basicInfo),relateContentKey:S.MOVE_TOP_AREA}),{elements:a.filter(l=>l!==null).map(l=>l.element),onlyOnce:a.filter(l=>l!==null).map(l=>l.onlyOnce),relateContentKeys:a.filter(l=>l!==null).map(l=>l.relateContentKey)}}}class Be{constructor(t){T(this,"basicInfo");this.basicInfo=t}static async getBindedElement(t,n){throw new Error("需子类覆盖实现")}static async isOnlyOnce(t){return!
<span class="og-hn-child-word-count-indicator">${b("child_word_count")}</span>
<span class="og-hn-child-word-count-content">${i}</span>
</span>`:"",m=`<span class="og-hn-create-at-wrapper">
<span class="og-hn-create-at-indicator">${b("create_at")}</span>
<span class="og-hn-create-at-content">${l.hCtime}</span>
</span>
${d}
<span class="og-hn-modify-at-wrapper">
<span class="og-hn-modify-at-indicator">${b("update_at")}</span>
<span class="og-hn-create-at-content">${l.hMtime}</span>
</span>
${d}
<span class="og-hn-child-doc-count-wrapper">
${b("child_count").replace("%NUM%",`<span class="og-hn-child-doc-count-content">${a}</span>`).replace("%TOTAL%",s==-1?"":`<span class="og-hn-total-child-doc-count-content">(${s})</span>`)}
</span>
${a==0?"":p}
<span class="og-hn-notebook-wrapper">
${u.name}
</span>
`;return c.innerHTML=m,c}}class W_ extends Be{static async getBindedElement(t,n){const o=super.getBasicElement(h.PARENT_CONTAINER_ID,null,b("parent_nodes"),b("parent_area"));if(t.docBasicInfo==null||t.parentDocBasicInfo==null){if(te().sibling)return await ec.getBindedElement(t,n);o.appendChild(super.getNoneElement()),o.classList.add(h.NONE_CLASS_NAME)}else t.parentDocBasicInfo?o.appendChild(this.docLinkGenerator(t.parentDocBasicInfo)):(o.appendChild(this.getNoneElement()),o.classList.add(h.NONE_CLASS_NAME));return V("parentAreaOutput",o),o}}class ec extends Be{static async getBindedElement(t,n){const o=te(),i=super.getBasicElement(h.SIBLING_CONTAINER_ID,null,b("sibling_nodes"),b("sibling_area"));if(t.siblingDocLimited)return V("出于性能考虑,本文档的同级文档将不再显示"),null;if(await Yn(t,"userDemandSiblingDocInfoList"),i.children.length>0&&i.children[0].classList.contains(h.INDICATOR_CLASS_NAME)&&i.children[0].setAttribute("title",b("number_count").replace("%NUM%",t.userDemandSiblingDocInfoList.length)),t.userDemandSiblingDocInfoList.length==0)i.appendChild(super.getNoneElement()),i.classList.add(h.NONE_CLASS_NAME);else for(let r=0;r<t.userDemandSiblingDocInfoList.length&&(r<o.docMaxNum||o.docMaxNum==0);r++){let s=t.userDemandSiblingDocInfoList[r];const a=this.docLinkGenerator(s);s.id==t.currentDocId&&a.classList.add("og-hn-docLinksWrapper-hl"),i.appendChild(a)}return i}}class tc extends Be{static async getBindedElement(t,n){const o=te(),i=super.getBasicElement(h.CHILD_CONTAINER_ID,null,b("child_nodes"),b("child_area"));if(o.noChildIfHasAv&&await zl(t.currentDocId))return V("文档中含有数据库,不显示子文档区域"),null;if(t.subDocLimited)return V("文档数量过多,停止显示"),null;if(await Yn(t,"childDocInfoList"),i.children.length>0&&i.children[0].classList.contains(h.INDICATOR_CLASS_NAME)&&i.children[0].setAttribute("title",b("number_count").replace("%NUM%",t.childDocInfoList.length)),t.childDocInfoList.length==0)i.appendChild(super.getNoneElement()),i.classList.add(h.NONE_CLASS_NAME);else for(let r=0;r<t.childDocInfoList.length&&(r<o.docMaxNum||o.docMaxNum==0);r++){let s=t.childDocInfoList[r];const a=super.docLinkGenerator(s);i.appendChild(a)}return i}}class Ln extends Be{static async getBindedElement(t,n){const o=super.getBasicElement(h.BREADCRUMB_CONTAINER_CLASS_NAME,[h.CONTAINER_CLASS_NAME],null),i=await this.generateBreadCrumb(t);return o.appendChild(i),o.querySelectorAll('.og-fake-breadcrumb-arrow-span[data-type="FILE"], .og-fake-breadcrumb-arrow-span[data-type="NOTEBOOK"]').forEach(r=>{r.addEventListener("click",this.openRelativeMenu)}),o}static async generateBreadCrumb(t){const n=await this.parseDocPath(t.docBasicInfo);return await this.generateBreadCrumbElement(n)}static async parseDocPath(t){let n=t.path.substring(0,t.path.length-3).split("/"),o=[],i=rs(t.box),r={name:i.name+".sy",id:i.id,icon:i.icon,box:i.id,path:"/",type:"NOTEBOOK",subFileCount:999};o.push(r);let s="";const a=n.slice(1).map(async c=>{const u=await Vn(c);return u.box=i.id,u.path=`${s}/${c}.sy`,u.type="FILE",u.name=`${u.name}.sy`,s+=`/${c}`,u}),l=await Promise.all(a);return o.push(...l),o}static async generateBreadCrumbElement(t){var r;const n=document.createElement("div");n.classList.add("og-hn-parent-area-replace-with-breadcrumb");const o=te(),i=`<span class="og-fake-breadcrumb-arrow-span" data-type="%4%" data-parent-id="%5%" data-next-id="%6%"><svg class="${h.ARROW_CLASS_NAME}"
data-type="%4%" data-parent-id="%5%">
<use xlink:href="#iconRight"></use></svg></span>`;for(let s=0;s<t.length;s++){let a=t[s];s!=0?n.appendChild(this.docLinkGenerator(t[s])):o.showNotebookInBreadcrumb&&n.appendChild(this.docLinkGenerator(t[s],!0)),!(s==t.length-1&&!await k_(a.id))&&n.insertAdjacentHTML("beforeend",i.replaceAll("%4%",a.type).replaceAll("%5%",t[s].id).replaceAll("%6%",(r=t[s+1])==null?void 0:r.id))}return n}static async openRelativeMenu(t){const n=te();let o=t.currentTarget.getAttribute("data-parent-id"),i=t.currentTarget.getAttribute("data-next-id"),r=t.currentTarget.getBoundingClientRect();if(G_(o))return;t.stopPropagation(),t.preventDefault();let s=await xe(`SELECT * FROM blocks WHERE id = '${o}'`);s.length==0&&(s=[{path:"/",box:o}]);let a=await D_(s[0],n);if(a.length<=0)return;const l=new Lt.Menu("og-hn-relative-menu");for(let c=0;c<a.length;c++){let u=a[c];u.name=u.name.substring(0,u.name.length-3);let d=u.name.length>n.nameMaxLength?u.name.substring(0,n.nameMaxLength)+"...":u.name,p={accelerator:i==u.id?"<-":void 0,iconHTML:Ln.getEmojiHtmlStrE2(u.icon,u.subFileCount!=0),label:`<span class="${h.MENU_ITEM_CLASS_NAME}"
og-data-doc-id="${u.id}"
${i==u.id?'style="font-weight: bold;"':""}
title="${u.name}">
${d}
</span>`,click:(m,g)=>{var G;O("menu clickEvent",g);let v=(G=m.querySelector("[og-data-doc-id]"))==null?void 0:G.getAttribute("og-data-doc-id");$n({mouseEvent:g,paramDocId:v,g_setting:te()})}};l.addItem(p)}a.length*30>(window.innerHeight-r.bottom)*.7?l.open({x:r.right,y:r.top,isLeft:!1}):l.open({x:r.left,y:r.bottom,isLeft:!1}),setTimeout(()=>{var c;n.menuKeepCurrentVisible&&((c=l.element.querySelector(".b3-menu__item--selected"))==null||c.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}))},3),x_(l,o)}static getEmojiHtmlStrE2(t,n){const o=te();if(o.icon==h.ICON_NONE)return"";if((t==null||t==null||t=="")&&o.icon==h.ICON_ALL)return window.siyuan.storage["local-images"]?n?Ln.getEmojiHtmlStrE2(window.siyuan.storage["local-images"].folder,n):Ln.getEmojiHtmlStrE2(window.siyuan.storage["local-images"].file,n):n?'<span class="og-hn-menu-emojitext">📑</span>':'<span class="og-hn-menu-emojitext">📄</span>';if((t==null||t==null||t=="")&&o.icon==h.ICON_CUSTOM_ONLY)return'<span class="og-hn-menu-emojitext"></span>';let i=t;return t.startsWith("api/icon/getDynamicIcon")?i=`<img class="og-hn-menu-emojipic" src="/${t}"/>`:t.indexOf(".")!=-1&&!t.match(new RegExp("http(s)?:\\/\\/"))?i=`<img class="og-hn-menu-emojipic" src="/emojis/${t}"/>`:t.match(new RegExp("http(s)?:\\/\\/"))?i=`<img class="og-hn-menu-emojipic" src="${t}"/>`:i=`<span class="og-hn-menu-emojitext">${Ln.emojiIconHandler(t,n)}</span>`,i}static emojiIconHandler(t,n=!1){try{let o="";return t.split("-").forEach(i=>{o+=String.fromCodePoint(+("0x"+i))}),o}catch(o){return Ze("emoji",t,o),n?"📑":"📄"}}}class nc extends Be{static async getBindedElement(t,n){const o=te();let i=null;switch(o.showBackLinksType){case h.BACKLINK_DOC_ONLY:{i=await this.docOnlyBackLinkElement(t);break}case h.BACKLINK_NORMAL:{i=await this.normalBackLinkElement(t);break}default:{Le("BackLink",o.showBackLinksType);break}}return i==null&&(i=super.getBasicElement(h.BACKLINK_CONTAINER_CLASS_NAME,null,b("backlink_nodes"),b("backlink_area")),i.appendChild(super.getNoneElement()),i.classList.add(h.NONE_CLASS_NAME)),i}static async getNormalBackLinks(t,n){let o=await fa(t,ya(n));if(O("backlinkResponse",o),o.backlinks.length==0)return[];const i=[];for(let r=0;r<o.backlinks.length;r++){const s=o.backlinks[r];if(s.nodeType==="NodeDocument"){let a={ogSimpleName:s.name,name:s.name+".sy",icon:"",id:s.id,alias:"",path:""};i.push(a)}}return $o(i)}static async normalBackLinkElement(t){const n=this.getBasicElement(h.BACKLINK_CONTAINER_CLASS_NAME,null,b("backlink_nodes"),b("backlink_area")),o=te(),i=await fa(t.currentDocId,ya(o.sortForBackLink));if(O("backlinkResponse",i),i.backlinks.length==0)return null;const r=[];for(let a=0;a<i.backlinks.length;a++){const l=i.backlinks[a];if(l.nodeType==="NodeDocument"){let c={ogSimpleName:l.name,name:l.name+".sy",icon:"",id:l.id,alias:"",path:""};r.push(c)}}const s=$o(r);return s.forEach(a=>{n.appendChild(this.docLinkGenerator(a))}),s.length==0?null:n}static async getDocOnlyBackLinks(t,n){let o=`SELECT id, content FROM blocks WHERE id in (
SELECT DISTINCT root_id FROM refs WHERE def_block_id = "${t}"
) AND type = "d" `+this.linkSortTypeToFowardLinkSortSql(n),i=await xe(o);if(i!=null&&i.length>0){(n==re.NAME_NATURAL_ASC||n==re.NAME_NATURAL_DESC)&&(i=vi(i.slice(),"content",n==re.NAME_NATURAL_DESC),V("自然排序",i));const r=[];for(let s=0;s<i.length;s++){const a=i[s];let l={ogSimpleName:a.content,name:a.content+".sy",icon:"",id:a.id,alias:"",path:""};r.push(l)}return $o(r)}else return[]}static async docOnlyBackLinkElement(t){const n=this.getBasicElement(h.BACKLINK_CONTAINER_CLASS_NAME,null,b("backlink_nodes"),b("backlink_area")),o=te();let i=`SELECT id, content FROM blocks WHERE id in (
SELECT DISTINCT root_id FROM refs WHERE def_block_id = "${t.currentDocId}"
) AND type = "d" `+this.linkSortTypeToFowardLinkSortSql(o.sortForBackLink),r=await xe(i);if(O("backlinkSQLResponse",r),r!=null&&r.length>0){(o.sortForBackLink==re.NAME_NATURAL_ASC||o.sortForBackLink==re.NAME_NATURAL_DESC)&&(r=vi(r.slice(),"content",o.sortForBackLink==re.NAME_NATURAL_DESC),V("自然排序",r));const s=[];for(let l=0;l<r.length;l++){const c=r[l];let u={ogSimpleName:c.content,name:c.content+".sy",icon:"",id:c.id,alias:"",path:""};s.push(u)}const a=$o(s);if(a.forEach(l=>{n.appendChild(this.docLinkGenerator(l))}),a.length==0)return null}else return null;return n}}class V_ extends Be{static async getBindedElement(t,n){var U,x,q;const o=te();if(t.siblingDocLimited)return V("出于性能考虑,上一篇下一篇(相邻文档)在本文档不显示"),null;await Yn(t,"allSiblingDocInfoList");const i=t.allSiblingDocInfoList,r=this.getBasicElement(h.NEXT_CONTAINER_CLASS_NAME,null,b("neighbor_nodes"),b("neighbor_area"));let s=-1,a=null,l=null;for(let k=0;k<i.length;k++)if(i[k].id===t.currentDocId){s=k;break}let c=Number.MAX_SAFE_INTEGER.toString(),u="0";const d=n.originProtyle,p=(U=d.background)==null?void 0:U.ial;if(o.previousAndNextFollowDailynote)for(const k in p)k.startsWith("custom-dailynote-")&&(parseInt(p[k])>parseInt(u)&&(u=p[k]),parseInt(p[k])<parseInt(c)&&(c=p[k]));const m=(q=JSON.stringify((x=d.background)==null?void 0:x.ial))==null?void 0:q.includes("custom-dailynote"),g=ss(t.docBasicInfo.box),v=os(g),G=ns(g);if(s>=0&&i.length>=1){let k=!1;if(m&&(o.previousAndNextFollowDailynote||s<=0&&v)){let H=!1;!o.previousAndNextFollowDailynote&&!G&&(H=!0);const E=await Nn({ialObject:p,docId:t.docBasicInfo.id,boxId:t.docBasicInfo.box,getNewer:H});if(O("日记组-上一篇",E),E){if(E.ogSimpleName=b("previous_doc")+mt(E.name),E.name=E.name+".sy",o.requestAllDocIcon&&!ve()){const F=await Vn(E.id);E.icon=F.icon,E.subFileCount=F.subFileCount}a=super.docLinkGenerator(E),k=!0}}else if(s>0){let H=b("previous_doc")+mt(i[s-1].name),E=Object.assign({},i[s-1]);E.ogSimpleName=H.substring(0,H.length-3),a=this.docLinkGenerator(E),k=!0}if(m&&(o.previousAndNextFollowDailynote||s+1>=i.length&&v)){let H=!0;!o.previousAndNextFollowDailynote&&!G&&(H=!1);const E=await Nn({ialObject:p,docId:t.docBasicInfo.id,boxId:t.docBasicInfo.box,getNewer:H});if(O("日记组-下一篇",E),E){if(E.ogSimpleName=b("next_doc")+mt(E.name),E.name=E.name+".sy",o.requestAllDocIcon&&!ve()){const F=await Vn(E.id);E.icon=F.icon,E.subFileCount=F.subFileCount}l=super.docLinkGenerator(E),k=!0}}else if(s+1<i.length){let H=b("next_doc")+mt(i[s+1].name),E=Object.assign({},i[s+1]);E.ogSimpleName=H.substring(0,H.length-3),l=this.docLinkGenerator(E),k=!0}if(k)a&&r.appendChild(a),l&&r.appendChild(l),r.classList.add(h.NEXT_CONTAINER_CLASS_NAME);else{const H=this.getNoneElement();r.appendChild(H),r.classList.add(h.NONE_CLASS_NAME)}}else{const k=this.getNoneElement();k.title=b("is_hidden_doc"),r.appendChild(k),r.classList.add(h.NONE_CLASS_NAME)}return r}}class oc extends Be{static async getBindedElement(t,n){const o=te();if(o.noChildIfHasAv&&await zl(t.currentDocId))return V("文档中含有数据库,不显示子文档区域"),null;if(t.docBasicInfo.subFileCount<=0){V("无子文档,不显示子文档区域");const r=super.getBasicElement(h.CHILD_CONTAINER_ID,null,b("child_nodes"),b("child_area"));return r.appendChild(this.getNoneElement()),r.classList.add(h.NONE_CLASS_NAME),this.isDoNotUpdate=!1,r}if(o.lcdEmptyDocThreshold>=0&&!await S_(t.currentDocId,o.lcdEmptyDocThreshold))return this.isDoNotUpdate=!1,await tc.getBindedElement(t,n);this.isDoNotUpdate=!0;const i=document.createElement("div");return i.classList.add("og-hn-widget-container"),i.innerHTML=`<iframe src="/widgets/listChildDocs" data-subtype="widget" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="width: 100%; height: ${window.screen.availWidth-75>350?350:window.screen.availWidth-75}px;" data-doc-id="${t.currentDocId}" ></iframe>`,oe(i.children[0].dataset)&&(i.children[0].dataset.defaultConfig=JSON.stringify({height_2widget_min:150})),i}static async isOnlyOnce(t){retu
data-type="%4%" data-parent-id="%5%">
<use xlink:href="#iconRight"></use></svg></span>`;if(t.length==0)return null;for(let i=0;i<t.length;i++){let r=t[i];n.appendChild(this.docLinkGenerator(t[i])),n.insertAdjacentHTML("beforeend",o.replaceAll("%4%",r.type).replaceAll("%5%",t[i].id))}return n}}class j_ extends Be{static async getBindedElement(t,n){var l;te();const o=super.getBasicElement(h.ON_THIS_DAY_CONTAINER_CLASS_NAME,null,b("on_this_day_nodes"),b("on_this_day_area"));let i="";const s=(l=n.originProtyle.background)==null?void 0:l.ial;for(const c in s)if(c.startsWith("custom-dailynote-")){i=c.substring(c.length-4);break}if(!oe(i)){V("",s);return}const a=await xe(`
SELECT b.content as name, b.id
FROM attributes AS a
JOIN blocks AS b ON a.root_id = b.id
WHERE a.name LIKE '%${i}' AND a.name LIKE 'custom-dailynote%' AND a.block_id = a.root_id
AND b.box = "${t.docBasicInfo.box}"`);if(a.length<=1){V("没有往年今日",a);const c=super.getNoneElement();return o.appendChild(c),o.classList.add(h.NONE_CLASS_NAME),o}for(let c=0;c<a.length;c++){const u=a[c];if(u.id==t.docBasicInfo.id)continue;u.name=u.name+".sy";const d=super.docLinkGenerator(u);o.appendChild(d)}return o}static async isOnlyOnce(t){return!0}}class $_ extends Be{static async getBindedElement(t,n){const o=te();let i=null;switch(o.showBackLinksType){case h.BACKLINK_DOC_ONLY:{i=await this.docOnlyBackLinkElement(t);break}case h.BACKLINK_NORMAL:{i=await this.normalBackLinkElement(t);break}default:{Le("BackLinkforward配置项值错误",o.showBackLinksType);break}}return i==null&&(i=super.getBasicElement(h.FOWARDLINK_CONTAINER_CLASS_NAME,null,b("forwardlink_nodes"),b("forwardlink_area")),i.appendChild(super.getNoneElement()),i.classList.add(h.NONE_CLASS_NAME)),i}static async normalBackLinkElement(t){const n=this.getBasicElement(h.BACKLINK_CONTAINER_CLASS_NAME,null,b("forwardlink_nodes"),b("forwardlink_area")),o=te();let i=`SELECT id, content FROM blocks WHERE id in (
SELECT DISTINCT def_block_root_id FROM refs WHERE root_id = "${t.currentDocId}"
) AND type = "d" `+this.linkSortTypeToFowardLinkSortSql(o.sortForBackLink),r=await xe(i);if(O("backlinkSQLResponse",r),r!=null&&r.length>0){(o.sortForBackLink==re.NAME_NATURAL_ASC||o.sortForBackLink==re.NAME_NATURAL_DESC)&&(r=vi(r.slice(),"content",o.sortForBackLink==re.NAME_NATURAL_DESC),V("自然排序",r));for(let s=0;s<r.length;s++){const a=r[s];let l={ogSimpleName:a.content,name:a.content+".sy",icon:"",id:a.id,alias:"",path:""};n.appendChild(this.docLinkGenerator(l))}}else return null;return n}static async docOnlyBackLinkElement(t){const n=this.getBasicElement(h.BACKLINK_CONTAINER_CLASS_NAME,null,b("forwardlink_nodes"),b("forwardlink_area")),o=te();let i=`SELECT id, content FROM blocks WHERE id in (
SELECT DISTINCT def_block_root_id FROM refs WHERE root_id = "${t.currentDocId}" AND def_block_root_id = def_block_id
) AND type = "d" `+this.linkSortTypeToFowardLinkSortSql(o.sortForBackLink),r=await xe(i);if(O("forwardlinkSQLResponse",r),r!=null&&r.length>0){(o.sortForBackLink==re.NAME_NATURAL_ASC||o.sortForBackLink==re.NAME_NATURAL_DESC)&&(r=vi(r.slice(),"content",o.sortForBackLink==re.NAME_NATURAL_DESC),V("自然排序",r));for(let s=0;s<r.length;s++){const a=r[s];let l={ogSimpleName:a.content,name:a.content+".sy",icon:"",id:a.id,alias:"",path:""};n.appendChild(this.docLinkGenerator(l))}}else return null;return n}}class va extends Be{static async getMoreOrLessElement(t,n,o){var a,l,c;const i=te(),r=super.getBasicElement(h.MORE_OR_LESS_CONTAINER_CLASS_NAME,null,null,null),s=document.createElement("span");if(r.appendChild(s),((l=(a=n.originProtyle)==null?void 0:a.element)==null?void 0:l.querySelectorAll(".og-hn-more-less[data-og-hide-flag=false]").length)>0)O("MoreOrLessPrinter 生成时判定原内容区存在,且未折叠,更新后也调整为未折叠"),r.dataset.ogHideFlag="false",s.innerHTML=b("less");else{r.dataset.ogHideFlag="true",s.innerHTML=b("more");for(let u=i.areaHideFrom-1;u<o.length;u++)(c=o[u])==null||c.element.classList.add(h.IS_FOLDING_CLASS_NAME)}return r.classList.add("og-hn-more-less"),r.addEventListener("click",()=>{var d;const u=((d=r.parentElement)==null?void 0:d.children)??[];if(u.length<=1&&O("折叠展开判定错误,不存在任何内容区元素"),s.innerHTML===b("more")){for(let p=i.areaHideFrom;p<u.length;p++)u[p].classList.remove(h.IS_FOLDING_CLASS_NAME);s.innerHTML=b("less"),r.dataset.ogHideFlag="false"}else{for(let p=i.areaHideFrom;p<u.length;p++)u[p].classList.add(h.IS_FOLDING_CLASS_NAME);s.innerHTML=b("more"),r.dataset.ogHideFlag="true"}}),r.dataset.ogContentType=S.MORE_OR_LESS,r}static async getBindedElement(t,n){const o=super.getBasicElement(h.MORE_OR_LESS_CONTAINER_CLASS_NAME,null,null,null),i=document.createElement("span");return i.innerHTML=b("more_or_less"),o.appendChild(i),o.classList.add("og-hn-more-less"),o.addEventListener("click",()=>{const r=document.getElementById(h.HIDE_COULD_FOLD_STYLE_ID);r?r.remove():Yl()}),o.dataset.ogContentType=S.MORE_OR_LESS,o}static async isOnlyOnce(t){return!1}}class Y_ extends Be{static async getBindedElement(t,n){var x,q,k;const o=te();if(t.siblingDocLimited)return V("出于性能考虑,上一篇下一篇(相邻文档)在本文档不显示"),null;await Yn(t,"allSiblingDocInfoList");const i=t.allSiblingDocInfoList,r=document.createElement("div");r.classList.add("og-hn-np-inner-flex");const s=document.createElement("div");let a=-1,l=null,c=null;for(let H=0;H<i.length;H++)if(i[H].id===t.currentDocId){a=H;break}let u=Number.MAX_SAFE_INTEGER.toString(),d="0";const p=n.originProtyle,m=(x=p.background)==null?void 0:x.ial;if(o.previousAndNextFollowDailynote)for(const H in m)H.startsWith("custom-dailynote-")&&(parseInt(m[H])>parseInt(d)&&(d=m[H]),parseInt(m[H])<parseInt(u)&&(u=m[H]));const g=(k=JSON.stringify((q=p.background)==null?void 0:q.ial))==null?void 0:k.includes("custom-dailynote"),v=ss(t.docBasicInfo.box),G=os(v),U=ns(v);if(a>=0&&i.length>=1){let H=!1;if(g&&(o.previousAndNextFollowDailynote||a<=0&&G)){let E=!1;!o.previousAndNextFollowDailynote&&!U&&(E=!0);const N=await Nn({ialObject:m,docId:t.docBasicInfo.id,boxId:t.docBasicInfo.box,getNewer:E});if(O("日记组-上一篇",N),N){if(N.ogSimpleName=mt(N.name),N.name=N.name+".sy",o.requestAllDocIcon&&!ve()){const F=await Vn(N.id);N.icon=F.icon,N.subFileCount=F.subFileCount}l=N,super.docLinkGenerator(N),H=!0}}else if(a>0){let E=mt(i[a-1].name),N=Object.assign({},i[a-1]);N.ogSimpleName=E.substring(0,E.length-3),l=N,H=!0}if(g&&(o.previousAndNextFollowDailynote||a+1>=i.length&&G)){let E=!0;!o.previousAndNextFollowDailynote&&!U&&(E=!1);const N=await Nn({ialObject:m,docId:t.docBasicInfo.id,boxId:t.docBasicInfo.box,getNewer:E});if(O("日记组-下一篇",N),N){if(N.ogSimpleName=mt(N.name),N.name=N.name+".sy",o.requestAllDocIcon&&!ve()){const F=await Vn(N.id);N.icon=F.icon,N.subFileCount=F.subFileCount}c=N,super.docLinkGenerator(N),H=!0}}else if(a+1<i.length){let E=mt(i[a+1].name),N=Object.assi
`).slice(1).join(`
`)),o=o.replace(new RegExp("<iframe.*</iframe>","gm"),""),o=o.replace(/!\[([^\]]+)\]\((.*?)\)/g,"[$1]"),o=o.replace(/\[([^\]]+)\]\((.*?)\)/g,"$1"),o}static createNavPreview(t,n,o,i,r=!0){const s=document.createElement("div");s.className=`og-hn-np-nav-preview ${i?"og-hn-np-prev":"og-hn-np-next"} ${r?"refLinks":"og-hn-np-non-clickable"}`,oe(t)&&s.setAttribute("data-id",t);const a=document.createElement("div");a.className="og-hn-np-nav-preview-inner";const l=document.createElement("div");l.className="og-hn-np-nav-direction",l.textContent=i?`< ${b("previous_doc_v2")}`:`${b("next_doc_v2")} >`;const c=document.createElement("div");c.className="og-hn-np-nav-post-title",c.textContent=n;const u=document.createElement("div");return u.className="og-hn-np-nav-excerpt",u.textContent=o,a.appendChild(l),a.appendChild(c),a.appendChild(u),s.appendChild(a),s}static createPlaceholderPreview(t){var o;const n=this.createNavPreview("","","",t,!1);return(o=n.querySelector(".og-hn-np-nav-preview-inner"))==null||o.classList.add("og-hn-np-placeholder"),n}}class q_ extends Be{static async getBindedElement(t,n){const o=te(),i=document.createElement("div");if(i.className="og-hn-pb-container",t.subDocLimited)return V("文档数量过多,停止显示"),null;await Yn(t,"childDocInfoList");const r=t.childDocInfoList;for(const s of r){const a=document.createElement("div");a.className="og-hn-pb-doc-box ",a.setAttribute("data-id",s.id);let l=s.name;l.endsWith(".sy")&&(l=l.slice(0,-3));const c=document.createElement("h4");c.className="og-hn-pb-title refLinks",c.setAttribute("data-id",s.id),c.insertAdjacentHTML("afterbegin",this.getEmojiHtmlStr(s.icon,s.subFileCount>0,o)+l),a.appendChild(c);const[u,d]=await this.generatePreview(s.id);if(d){const p=await this.generateSecond(t.docBasicInfo.box,s.path,o.maxListCount,o.sortBy,o.showHiddenDocs);a.appendChild(p)}else{const p=document.createElement("div");p.className="og-hn-pb-content",p.innerHTML=u,a.appendChild(p)}i.appendChild(a)}return i}static async generatePreview(t){const n=await jp(t),o=2e4;let i=n;if(n.length>o){const l=n.substring(o).search("</p>");l!==-1&&(i=n.substring(0,o+l+1),V("预览内容过长,强制截断了预览内容"))}const r=this.cleanDocHtml(i),s=r.replace(/&zwj;|&zwnj;|&thinsp;|&emsp;|&ensp;|&nbsp;/g,"").replace(/<p[^>]*>[\u200d]*<\/p>/g,"").replace(/ |\n/g,"");return[r,!oe(s)]}static async generateSecond(t,n,o,i,r){const s=document.createElement("div");s.className="og-hn-pb-child-container";const a=te(),l=await Lo({notebook:t,path:n,maxListCount:o,sort:i,showHidden:r});for(const c of l){let u=c.name;u.endsWith(".sy")&&(u=u.slice(0,-3));const d=document.createElement("p");d.className="og-hn-pb-child-item refLinks",d.setAttribute("data-id",c.id);const p=document.createElement("span");p.className="og-hn-pb-child-link ",p.innerHTML=this.getEmojiHtmlStr(c.icon,c.subFileCount>0,a),p.appendChild(document.createTextNode(u)),d.appendChild(p),s.appendChild(d)}return s}static cleanDocHtml(t){const n=document.createElement("div");if(n.innerHTML=t,n.querySelectorAll(".iframe").forEach(u=>u.remove()),window.top.siyuan.config.export.addTitle){const u=n.querySelectorAll("h1");u.length>0&&u[0].remove()}return n.querySelectorAll(".emoji").forEach(u=>u.classList.add("iconpic")),n.querySelectorAll("p").forEach(u=>{(!u.innerHTML.trim()||u.innerHTML===String.fromCharCode(8205))&&u.remove()}),n.querySelectorAll("img").forEach(u=>{let d=u.getAttribute("src")||"";d=d.replace(/http(s)*:\/\/[^\/]*\/widgets\/listChildDocs(-dev)*/,""),u.setAttribute("src",d)}),n.querySelectorAll("a").forEach(u=>{var p;const d=document.createTextNode(u.textContent||"");(p=u.parentNode)==null||p.replaceChild(d,u)}),n.querySelectorAll("h1, h2, h3, h4, h5").forEach(u=>{var p;const d=document.createElement("strong");d.textContent=u.textContent,(p=u.parentNode)==null||p.replaceChild(d,u)}),n.querySelectorAll("input").forEach(u=>u.remove()),n.innerHTML}}class J_ extends Be{static async getBindedElement(t,n){const o=te(),i=super.getBasicElement(h.PARENT_SIBLING_CONTAINER_ID,null,b("parent_sibling_nodes"),b("parent_sibling_area"));if(t.
</symbol>
`),(so()||!ve())&&e.addTopBar({icon:"iconOgHnBookUp",title:b("dialog_panel_switchDoc"),position:"right",callback:()=>{Na()}}),e.addCommand({langKey:"make_navigation_top",hotkey:"",callback:()=>{rc()}})}async function Na(){const e=pn();if(!oe(e)){O("未能获取到当前文档id"),it(b("open_doc_first"));return}let t=null;const n=is(),o=pf();if(o.value){o.value.destroy(),o.value=null;return}const i=new ht.Dialog({title:b("dialog_panel_plugin_name")+"--"+b("dialog_panel_switchDoc"),content:`
<div id="og_plugintemplate_${n}" class="b3-dialog__content" style="overflow: hidden; position: relative;height: 100%;"></div>
`,width:ve()?"80vw":"55vw",height:ve()?"75vh":"80vh",destroyCallback:()=>{t.unmount(),o.value=null,O("对话框销毁成功")}});o.value=i,t=zr(uf,{docId:e,dialog:i}),t.mount(`#og_plugintemplate_${n}`)}async function ff(){const e=pn(),t=te();if(!oe(e)){V("未能读取到打开文档的id"),it(b("open_doc_first"));return}let n=await xe(`SELECT * FROM blocks WHERE id = "${e}"`),o;if(n&&n.length>=1)o=n[0].path.split("/");else return;if(!(o.length<2))if(oe(o[o.length-2])){let i=o[o.length-2];i=i.replace(".sy",""),$n({paramDocId:i,keyParam:{ctrlKey:!1,shiftKey:!1,altKey:!1},g_setting:t})}else it(b("is_top_document"),2e3)}async function hf(){const e=pn(),t=te();let n=await xe(`SELECT * FROM blocks WHERE id = "${e}"`);if(n&&n.length>=1){const o=await cs(n[0].path,n[0].box);if(o&&o.length>=1){const i=o[0];$n({paramDocId:i.id,keyParam:{ctrlKey:!1,shiftKey:!1,altKey:!1},g_setting:t})}else it(b("no_child_document"),2e3)}else it(b("canot_open_child_doc"),2e3)}async function mf(){const e=await ic(!1),t=te();O("previousDoc",e),e?$n({paramDocId:e.id,g_setting:t}):it(b("is_first_document"),2e3)}async function gf(){const e=await ic(!0),t=te();O("nextDoc",e),e?$n({paramDocId:e.id,g_setting:t}):it(b("is_last_document"),2e3)}async function ic(e){var s,a,l;let t=null,n;if(n=pn(),!oe(n)){it(b("open_doc_first"));return}let o=await xe(`SELECT * FROM blocks WHERE id = "${n}"`);if(!o||o.length<=0){O("文档似乎是刚刚创建,无法获取上下文信息,停止处理");return}const i=te();if(t=await us(o[0].path,o[0].box,void 0,!0),!((s=o[0].ial)!=null&&s.includes("custom-dailynote"))&&(t==null||t.length==1))return O("仅此一个文档,停止处理"),null;let r=-1;for(let c=0;c<t.length;c++)if(t[c].id===n){r=c;break}if(r>=0){if((a=o[0].ial)!=null&&a.includes("custom-dailynote")&&i.previousAndNextFollowDailynote)return await Nn({sqlResult:o,getNewer:e});if(r>0&&e==!1)return t[r-1];if(r+1<t.length&&e==!0)return t[r+1];if((l=o[0].ial)!=null&&l.includes("custom-dailynote")){const c=ss(o[0].box);return os(c)?ns(c)?await Nn({sqlResult:o,getNewer:e}):await Nn({sqlResult:o,getNewer:!e}):null}return null}return null}async function Ef(e){var s;if(pn()==null){V("未能读取到打开文档的id"),it(b("open_doc_first"));return}const n=Gp();if(!oe(n))return;const o=window.Lute.NewNodeID(),i='<iframe src="/widgets/listChildDocs" data-src="/widgets/listChildDocs" data-subtype="widget" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="width: 1500px; height: 350px;"></iframe>';O("shortCut,PROTYLE",e);const r=`<div data-node-id="${o}" data-node-index="1" data-type="NodeWidget" class="iframe" updated="${o.split("-")[0]}" data-subtype="widget"><div class="iframe-content">${i}<span class="protyle-action__drag" contenteditable="false"></span></div><div class="protyle-attr" contenteditable="false"></div></div>`;(s=e.getInstance())==null||s.insert(r,!0)}async function rc(){const e=window.document.querySelector(".layout__wnd--active .protyle.fn__flex-1:not(.fn__none)");if(!e)return;const t=e.getAttribute("data-id");if(yf()===t){Ir();return}else Ir();const n=window.document.querySelector(".layout__wnd--active .protyle.fn__flex-1:not(.fn__none) .og-hn-heading-docs-container");if(!n)return;const o=n.getBoundingClientRect(),i=document.createElement("div");i.classList.add(h.PLACEHOLDER_FOR_POP_OUT_CLASS_NAME),i.style.width=`${o.width}px`,i.style.height=`${o.height}px`,i.innerHTML=b("make_top_placeholder").replace("##",Vp(window.siyuan.config.keymap.plugin["syplugin-hierarchyNavigate"].make_navigation_top.custom)),n.classList.add(h.TO_THE_TOP_CLASS_NAME),n.parentNode.insertBefore(i,n);const r=window.document.querySelector(".layout__wnd--active .protyle.fn__flex-1:not(.fn__none) .protyle-content"),a=window.document.querySelector(".layout__wnd--active .protyle.fn__flex-1:not(.fn__none)").getBoundingClientRect(),l=r.getBoundingClientRect();let c=l.left,u=l.top;const d=te();d.topMovePosition&&(c=a.left+a.width*d.topMovePosition.protyleRelativeLeft,u=a.top+a.height*d.topMovePosition.protyleRelativeTop),n.style.left=`${c}px`,n.style.
* syplugin-hierarchy-navigate
* Copyright (C) 2024 OpaqueGlass
* @license AGPL-3.0
*/const Of="menu-config",If="custom_tab";class Af extends Lt.Plugin{constructor(){super(...arguments);T(this,"isMobile");T(this,"settingPanel");T(this,"myEventHandler")}async onload(){this.data[Of]={readonlyText:"Readonly"},V("",this.i18n),Ld(this.i18n),Bp(this),t_(),_f(this),this.myEventHandler=new Tf;const n=Lt.getFrontend();this.isMobile=n==="mobile"||n==="browser-mobile",document.createElement("textarea"),Yl()}onLayoutReady(){i_().then(()=>{this.myEventHandler.bindHandler(),V("Handler"),jl()}).catch(n=>{it("Load plugin settings faild. syplugin-hierarchy-navigate"),Ze(n)})}onunload(){var n;if(V(""),this.myEventHandler.unbindHandler(),document.querySelectorAll(`.${h.TOP_CONTAINER_CLASS_NAME}`).forEach(o=>{o.remove()}),$l(),zp(),window.og_hn_observe){for(const o in window.og_hn_observe)O("observer",o),(n=window.og_hn_observe[o])==null||n.disconnect();delete window.og_hn_observe}}openSetting(){const n=is(),o=zr(v_);new ht.Dialog({title:this.i18n.setting_panel_title,content:`
<div id="og_plugintemplate_${n}" style="overflow: hidden; position: relative;height: 100%;"></div>
`,width:Ta()?"92vw":"1040px",height:Ta()?"70vh":"80vh",destroyCallback:()=>{o.unmount()}}),o.mount(`#og_plugintemplate_${n}`)}openStatisticTab(){Lt.openTab({app:this.app,custom:{icon:"iconTestStatistics",title:"Custom Tab",id:this.name+If}})}}function Ta(){return!!window.top.document.getElementById("sidebar")}module.exports=Af;