import{a as e,d as t,i as n,m as r,t as i,y as a}from"./hooks.module-5xe-uC6c.js";import{E as o,I as s,a as c,c as l,i as u,o as d}from"./content_renderer-CoENEE63.js";import{a as f}from"./options-CDt8ZGCW.js";import{t as p}from"./jsxRuntime.module--xb8gfv5.js";import{n as m}from"./math-BjY8tSx6.js";import{B as h,G as g,K as _,T as v,U as y,x as b}from"./hooks-CSTgmcXO.js";import{n as x}from"./RawHtml-B22MTZKG.js";import"./src-B85i7mku.js";import{n as S,s as C,t as w}from"./TouchBar-5MFu7aFl.js";import{n as T,r as E,t as D}from"./utils-DvmeLJvE.js";t();function O({note:e,noteContext:t,ntxId:n}){let o=b(e),{isRtl:c}=A(e),l=i(null);return r(()=>{let e=t?.viewScope;!e?.bookmark||!l.current||(l.current.querySelector(`[id="${CSS.escape(e.bookmark)}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}),e.bookmark=void 0)},[o]),p(a,{children:[p(k,{html:o?.content??``,ntxId:n,dir:c?`rtl`:`ltr`,contentRef:l}),p(w,{children:[p(C,{size:`flexible`}),p(S,{icon:`NSLockUnlockedTemplate`,click:()=>{t?.viewScope&&(t.viewScope.readOnlyTemporarilyDisabled=!0,s.triggerEvent(`readOnlyTemporarilyDisabled`,{noteContext:t}))}})]})]})}function k({html:t,ntxId:n,dir:i,className:a,contentRef:f}){let m=h(f),[v]=_(`codeBlockWordWrap`),[b]=g(`codeBlockTabWidth`);return r(()=>{document.body.style.setProperty(`--code-block-tab-width`,b||`4`)},[b]),e(()=>{let e=m.current;e&&(n&&s.triggerEvent(`contentElRefreshed`,{ntxId:n,contentEl:e}),d(e),c(e),j(e),M(e),u(e),l($(e)),E(e,!0))},[t,n,m]),y(`refreshIncludedNote`,({noteId:e})=>{m.current&&T(m.current,e)}),y(`executeWithContentElement`,({resolve:e,ntxId:t})=>{!n||t!==n||!m.current||e($(m.current))}),p(x,{containerRef:m,className:o(`note-detail-readonly-text-content ck-content use-tn-links selectable-text`,v&&`word-wrap`,a),tabindex:100,dir:i,html:t})}function A(e){let[t]=v(e,`language`);return{isRtl:n(()=>f(t)?.rtl,[t])}}function j(e){let t=e.querySelectorAll(`section.include-note`);for(let e of t){let t=e.dataset.noteId;t&&D(t,$(e))}}function M(e){let t=e.querySelectorAll(`span.math-tex`);for(let e of t)m(e,{trust:!0})}export{k as n,O as t};