@restless-dreams/orbit 0.1.0 → 0.2.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 +5 -2
- package/dist/bin/orbit.js +2972 -213
- package/dist/bin/orbit.js.map +25 -13
- package/dist/{chunk-mtrnm0yc.js → chunk-fkdfgtx9.js} +3156 -2854
- package/dist/chunk-fkdfgtx9.js.map +75 -0
- package/dist/{chunk-7n00wx0t.js → chunk-y748hzcr.js} +2 -2
- package/dist/{chunk-0gwh723s.js → chunk-zze4tc9n.js} +2 -2
- package/dist/core/branch-colors.d.ts +57 -0
- package/dist/core/document-source.d.ts +1 -1
- package/dist/core/editing.d.ts +8 -5
- package/dist/core/engine/scene.d.ts +5 -4
- package/dist/core/engine/views.d.ts +10 -2
- package/dist/core/index.d.ts +10 -0
- package/dist/core/input-controller.d.ts +7 -0
- package/dist/core/languages.d.ts +2 -0
- package/dist/core/node-attributes.d.ts +1 -1
- package/dist/core/other-apps/freemind.d.ts +8 -0
- package/dist/core/other-apps/icons.d.ts +16 -0
- package/dist/core/other-apps/ideas.d.ts +76 -0
- package/dist/core/other-apps/import.d.ts +28 -0
- package/dist/core/other-apps/inflate.d.ts +22 -0
- package/dist/core/other-apps/markup.d.ts +51 -0
- package/dist/core/other-apps/notes.d.ts +80 -0
- package/dist/core/other-apps/opml.d.ts +26 -0
- package/dist/core/other-apps/reading.d.ts +36 -0
- package/dist/core/other-apps/xmind.d.ts +14 -0
- package/dist/core/other-apps/zip.d.ts +37 -0
- package/dist/core/print-layout.d.ts +70 -0
- package/dist/core/renderer/content-painter.d.ts +30 -0
- package/dist/core/renderer/dom.d.ts +15 -0
- package/dist/core/renderer/families.d.ts +35 -0
- package/dist/core/renderer/label-painter.d.ts +93 -0
- package/dist/core/renderer/node-painter.d.ts +113 -0
- package/dist/core/renderer/numbers.d.ts +2 -0
- package/dist/core/renderer/options.d.ts +12 -0
- package/dist/core/renderer/rings-and-links.d.ts +23 -0
- package/dist/core/renderer/scene-helpers.d.ts +33 -0
- package/dist/core/renderer/trees.d.ts +22 -0
- package/dist/core/svg-renderer.d.ts +6 -109
- package/dist/core/types.d.ts +9 -1
- package/dist/core/web-page/page.d.ts +2 -1
- package/dist/core/web-page/runtime.d.ts +1 -1
- package/dist/index.js +2935 -26
- package/dist/index.js.map +18 -6
- package/dist/marked/index.js +2 -2
- package/dist/react/index.js +2 -2
- package/dist/web-page.js +79 -79
- package/llms-full.txt +205 -5
- package/llms.txt +2 -1
- package/package.json +1 -1
- package/skills/orbit/SKILL.md +1 -1
- package/skills/orbit/references/editing.md +2 -1
- package/skills/orbit/references/format.md +28 -0
- package/skills/orbit/references/guide.md +25 -1
- package/skills/orbit/references/import-export.md +115 -0
- package/skills/orbit/references/languages.md +1 -0
- package/skills/orbit/references/recipes.md +9 -0
- package/skills/orbit/references/theming.md +15 -0
- package/dist/chunk-mtrnm0yc.js.map +0 -63
- /package/dist/{chunk-7n00wx0t.js.map → chunk-y748hzcr.js.map} +0 -0
- /package/dist/{chunk-0gwh723s.js.map → chunk-zze4tc9n.js.map} +0 -0
package/dist/web-page.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var ir={viewMode:"focus",showRings:!0,interactive:!0,orbitAnimation:!1,orbitSpeed:90,showControls:!0};var Fc=(t)=>ws(t).toLowerCase().trim().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"node",ws=(t)=>t.normalize("NFKD").replace(/([\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}])\p{M}+/gu,"$1").normalize("NFC"),ht=(t)=>Array.from(ws(t).toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,"").trim().replace(/\s+/g,"-")).slice(0,64).join("")||"node",Ot=(t,e)=>{Object.defineProperty(t,"parent",{value:e,writable:!0,configurable:!0,enumerable:!1})},ks=()=>{let t=new Set,e=new Map,n=(i)=>{if(!t.has(i))return{id:i};let r=e.get(i)??2;while(t.has(`${i}-${r}`))r+=1;return{id:`${i}-${r}`,suffix:r}};return{peek:(i)=>n(i).id,take:(i)=>{let{id:r,suffix:o}=n(i);return t.add(r),e.set(i,o===void 0?2:o+1),r}}},wn=(t)=>{let e=ks(),n=(i)=>{i.id=e.take(i.id.trim()||Fc(i.text));for(let r of i.children)n(r)};n(t)},It=(t)=>{let e=ks(),n=new Set,i=(r)=>{let o=ht(r.text);if(e.peek(o)===r.id)e.take(o);else n.add(r),e.take(r.id);for(let s of r.children)i(s)};return i(t),n},U=(t,e)=>{if(t.id===e)return t;for(let n of t.children){let i=U(n,e);if(i)return i}return null},Y=(t,e)=>{let n=[],i=(r,o)=>{let s=[...o,r];if(r.id===e)return n.push(...s),!0;for(let a of r.children)if(i(a,s))return!0;return!1};return i(t,[]),n},Mt=(t,e,n)=>Math.max(e,Math.min(n,t));var kn=(t)=>t.length>1?t.slice(1):[...t],Ht=(t)=>typeof t==="number"&&Number.isSafeInteger(t)&&t>=1,rr=(t,e)=>t[(e-1)%t.length],Os=(t,e)=>(t-1)%e+1,ne=(t,e)=>{let n=new Map,i=new Set;for(let l of t)if(Ht(l.paletteColor))i.add(Os(l.paletteColor,e));let r=Array.from({length:e},(l,d)=>d+1),o=r.filter((l)=>!i.has(l)),s=o.length>0?o:r,a=0;for(let l of t)if(Ht(l.paletteColor))n.set(l,Os(l.paletteColor,e));else n.set(l,s[a%s.length]),a+=1;return n},Le=(t,e)=>ne(t.children,e.count),Pe=(t,e,n,i)=>{let r=n.ownColor??((h)=>h.color),o=t.children,s=i?.node,a=(h)=>r(h)===void 0,l=new Map,d=[],c=(h,m)=>{if(!l.has(h))l.set(h,h.paletteColor);h.paletteColor=m},u=(h)=>o.find((m)=>m!==s&&e.has(m)&&a(m)&&h.get(m)!==e.get(m));if(s&&e.has(s)&&!o.includes(s)&&s.paletteColor!==void 0)delete s.paletteColor,d.push(s);if(s&&o.includes(s)&&a(s)&&!Ht(s.paletteColor)){let h=ne(o,n.count),m=i?.keepsColor?e.get(s):void 0;if(m!==void 0){if(h.get(s)!==m||u(h))c(s,m)}else{let p=o.filter((f)=>f!==s);if(p.some((f)=>a(f)&&h.get(f)===h.get(s))||u(h)){let f=new Set(ne(p,n.count).values()),g=Array.from({length:n.count},(y,v)=>v+1).find((y)=>!f.has(y));if(g!==void 0)c(s,g)}}}for(let h=0;h<o.length&&l.size<=n.count;h+=1){let m=u(ne(o,n.count));if(!m)break;c(m,e.get(m))}if(l.size>n.count){for(let[h,m]of l)if(m===void 0)delete h.paletteColor;else h.paletteColor=m;return d}return[...d,...l.keys()]};var or=(t,e,n={})=>{let i=t.toLowerCase(),r=Object.entries(n).find(([l])=>l.toLowerCase()===i)?.[1];if(r!==void 0)return r;let o=Math.min(2,Math.max(1,Math.floor(t.length/3))),s,a=1/0;for(let l of e){let d=Cc(i,l.toLowerCase());if(d<=o&&d<a)s=l,a=d}return s},ie=(t,e,n)=>{let i=or(t,e,n);return i===void 0?"":` Did you mean "${i}"?`},Cc=(t,e)=>{let n=t.length+1,i=e.length+1,r=Array.from({length:n},(o,s)=>Array.from({length:i},(a,l)=>s===0?l:l===0?s:0));for(let o=1;o<n;o+=1)for(let s=1;s<i;s+=1){let a=t[o-1]===e[s-1]?0:1;if(r[o][s]=Math.min(r[o-1][s]+1,r[o][s-1]+1,r[o-1][s-1]+a),o>1&&s>1&&t[o-1]===e[s-2]&&t[o-2]===e[s-1])r[o][s]=Math.min(r[o][s],r[o-2][s-2]+1)}return r[t.length][e.length]};var rt=(t)=>typeof t==="string"&&/^#\S/.test(t),On=(t,e)=>Ss(e,(n)=>U(t,n)),De=(t,e)=>Ss(e,(n)=>t.get(n)??null),Re=(t)=>{let e=new Map,n=(i)=>{if(!e.has(i.id))e.set(i.id,i);for(let r of i.children)n(r)};return n(t),e},Ss=(t,e)=>{if(!rt(t))return null;let n=t.slice(1);try{n=decodeURIComponent(n)}catch{}return e(n)??e(ht(n).replace(/^-+|-+$/g,""))},Ic=/\]\((#[^)\s]+)\)/g,sr=(t)=>{let e=t.noteFormat==="plain"?[]:[...(t.note??"").matchAll(Ic)].map((n)=>n[1]);if(rt(t.link))e.unshift(t.link);return e},Sn=(t,e,n)=>{let i=[];Ms(t,i);let r=Re(t),o=(s)=>{sr(s).forEach((a,l)=>{if(!De(r,a)){let d=or(a.slice(1),i),c=d===void 0?` Ids come from the nodes' text: "Q3 plan" is #q3-plan.`:` Did you mean #${d}?`,u=!(l===0&&rt(s.link));e.recover("unknown-link-target",`"${s.text}" links to ${a}, but no node has that id.${c}`,n?.(s,a,u)??s.source?.line)}});for(let a of s.children)o(a)};o(t)},Ms=(t,e)=>{e.push(t.id);for(let n of t.children)Ms(n,e)};var Ac=["icon","color","paletteColor","status","priority","tags","collapsed","type","typeVersion","link","note","noteFormat","image","video","embed","attrs"],Es=(t)=>{let e=new Set,n=(i)=>{e.add(i.id);for(let r of i.children)n(r)};return n(t),e},Ns=(t,e)=>{if(!e.has(t))return t;let n=2;while(e.has(`${t}-${n}`))n+=1;return`${t}-${n}`},Lc=(t,e)=>{let n=new Set(e),i=(r)=>{let o={id:"",text:"",level:0,children:[]};return _s(o,{...r,text:typeof r.text==="string"?r.text:""}),o.id=Ns(ht(o.text),n),n.add(o.id),o.children=(r.children??[]).map(i),o};return i(t)};var _s=(t,e)=>{if(typeof e.text==="string")t.text=e.text.replace(/\s*[\r\n]+\s*/g," ").trim();let n=t;for(let i of Ac){if(!(i in e))continue;let r=e[i];if(r===void 0)delete n[i];else if(Array.isArray(r))n[i]=[...r];else if(typeof r==="object"&&r!==null)n[i]={...r};else n[i]=r}},Pc=(t)=>{let e=ht(t.text);if(t.id===e)return!0;let n=t.id.startsWith(`${e}-`)?t.id.slice(e.length+1):"";return/^[1-9]\d*$/.test(n)&&Number(n)>=2},Dc=(t,e)=>{let n=Re(t),i=(r)=>sr(r).some((o)=>De(n,o)===e)||r.children.some(i);return i(t)},Ts=(t,e,n,i)=>{let r=t.children.length,o=i===void 0||!Number.isFinite(i)?r:Math.min(r,Math.max(0,Math.trunc(i)));t.children.splice(o,0,e),Fs(e,t,n+1)},Fs=(t,e,n)=>{Ot(t,e),t.level=n;for(let i of t.children)Fs(i,t,n+1)},Cs=(t,e)=>{let n=t.children.indexOf(e);if(n!==-1)t.children.splice(n,1);Ot(e,void 0)},Is=(t,e,n,i,r)=>{let o=Y(t,e);if(o.length===0)return null;let s=o[o.length-1],a=r&&Le(t,r),l=Lc(n,Es(t));if(Ts(s,l,o.length-1,i),r&&a)Pe(t,a,r,{node:l,keepsColor:!1});return{node:l,parent:s}},As=(t,e,n,i)=>{let r=U(t,e);if(!r)return null;let{id:o,text:s}=r,a=typeof n.text==="string"&&Pc(r)&&!Dc(t,r),l=i&&Le(t,i);if(_s(r,n),a&&r.text!==s){let d=Es(t);d.delete(r.id),r.id=Ns(ht(r.text),d)}if(i&&l)Pe(t,l,i,{node:r,keepsColor:!1});return{node:r,previousId:o}},Ls=(t,e,n)=>{let i=Y(t,e);if(i.length<2)return null;let r=i[i.length-1],o=i[i.length-2],s=n&&Le(t,n);if(Cs(o,r),n&&s)Pe(t,s,n);return{node:r,parent:o}},Ps=(t,e,n,i,r)=>{let o=Y(t,e),s=Y(t,n),a=o[o.length-1];if(o.length<2||s.length===0||s.includes(a))return null;let l=o[o.length-2],d=s[s.length-1],c=r&&Le(t,r);if(Cs(l,a),Ts(d,a,s.length-1,i),r&&c)Pe(t,c,r,{node:a,keepsColor:!0});return{node:a,from:l,to:d}};class K extends Error{line;reason;constructor(t,e){super(`${t} at line ${e}`);this.name="YamlMiniError",this.line=e,this.reason=t}}var re=new Map,ar=new WeakMap,Hs=new WeakMap,lr=(t,e,n)=>{let i=ar.get(t);if(!i)i=new Map,ar.set(t,i);i.set(e,n)},zs=(t,e)=>{let n=ar.get(t);if(!n)return;return e===void 0?n.values().next().value:n.get(e)},_n=(t,e)=>Hs.get(t)?.[e],Nt=(t)=>{let e=Rc(t),n=re;re=new Map;try{let[i]=Us(e,0,0);return i}finally{re=n}},Rc=(t)=>{let e=t.replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
|
-
`),n=e.findIndex((r)=>r.trim()!==""&&!r.trimStart().startsWith("#"));if(n!==-1&&/^---\s*$/.test(e[n]))e[n]="";let i=e.length-1;while(i>=0&&e[i].trim()==="")i--;if(i!==-1&&/^\.\.\.\s*$/.test(e[i]))e[i]="";return e},
|
|
4
|
-
`),nextIndex:m}}if(r===""){let c=
|
|
5
|
-
`:` ${h}`:` ${h}`,u++}return{value
|
|
6
|
-
`)),n+1),nextIndex:u}}let l=[],d=n+1;while(d<e.length){let c=e[d];if(c.trim()===""){l.push(""),d++;continue}if(
|
|
7
|
-
`+r;else e+=" "+r;n=!1}return e},
|
|
8
|
-
`,r:"\r",t:"\t","0":"\x00"},
|
|
9
|
-
`,
|
|
3
|
+
`),n=e.findIndex((r)=>r.trim()!==""&&!r.trimStart().startsWith("#"));if(n!==-1&&/^---\s*$/.test(e[n]))e[n]="";let i=e.length-1;while(i>=0&&e[i].trim()==="")i--;if(i!==-1&&/^\.\.\.\s*$/.test(e[i]))e[i]="";return e},Us=(t,e,n)=>{let i=Gs(t,e);if(i!==-1){let r=t[i];if(Et(r)===n&&oe(r,n))return js(t,e,n)}return $c(t,e,n)},oe=(t,e)=>t.slice(e,e+2)==="- "||t.slice(e).trimEnd()==="-",dr=(t,e)=>t.startsWith('"')||t.startsWith("'")?String(zt(t,e)):t,gt=(t,e,n)=>{if(e==="__proto__")Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});else t[e]=n},$c=(t,e,n)=>{let i={},r=[],o=e;while(o<t.length){let s=t[o];if(s.trim()===""||s.trimStart().startsWith("#")){o++;continue}let a=Et(s);if(a<n)break;if(a>n)throw new K("Unexpected indentation",o+1);if(oe(s,n))throw new K('Expected "key: value"',o+1);let l=s.slice(n),d=Ve(l);if(d<0)throw new K('Expected "key: value"',o+1);let c=dr(l.slice(0,d).trim(),o+1),u=l.slice(d+1).trim(),{value:h,nextIndex:m}=Be(u,t,o,n);if(c==="<<")r.push(h);else gt(i,c,h),lr(i,c,o+1);o=m}for(let s of r.flatMap((a)=>Array.isArray(a)?a:[a]))if(s&&typeof s==="object"&&!Array.isArray(s)){for(let[a,l]of Object.entries(s))if(!Object.prototype.hasOwnProperty.call(i,a))gt(i,a,l)}return[i,o]},js=(t,e,n)=>{let i=[],r=[];Hs.set(i,r);let o=e;while(o<t.length){let s=t[o];if(s.trim()===""||s.trimStart().startsWith("#")){o++;continue}let a=Et(s);if(a<n)break;if(a>n||!oe(s,n))break;let l=s.slice(n+2),d=Ve(l),c=/^[&*"'[{|>]/.test(l.trim());if(r.push(o+1),d>=0&&!c){let u={},h=dr(l.slice(0,d).trim(),o+1),m=l.slice(d+1).trim(),{value:p,nextIndex:b}=Be(m,t,o,n+2);gt(u,h,p),lr(u,h,o+1),o=b;while(o<t.length){let f=t[o];if(f.trim()===""||f.trimStart().startsWith("#")){o++;continue}if(Et(f)!==n+2)break;let y=f.slice(n+2);if(oe(y,0))break;let v=Ve(y);if(v<0)throw new K('Expected "key: value"',o+1);let O=dr(y.slice(0,v).trim(),o+1),M=y.slice(v+1).trim(),{value:w,nextIndex:x}=Be(M,t,o,n+2);gt(u,O,w),lr(u,O,o+1),o=x}i.push(u)}else{let{value:u,nextIndex:h}=Be(l.trim(),t,o,n);i.push(u),o=h}}return[i,o]},Mn=(t)=>{let e=null;for(let n=0;n<t.length;n++){let i=t[n];if(e){if(i==="\\"&&e==='"')n++;else if(i===e)if(e==="'"&&t[n+1]==="'")n++;else e=null;continue}if((i==='"'||i==="'")&&(n===0||/[\s[{,:]/.test(t[n-1])))e=i;else if(i==="#"&&n>0&&/\s/.test(t[n-1]))return t.slice(0,n).trimEnd()}return t},Be=(t,e,n,i)=>{let r=Mn(t),o=/^&([^\s,[\]{}]+)\s*/.exec(r);if(o){r=r.slice(o[0].length);let c=Be(r,e,n,i);return re.set(o[1],c.value),c}let s=/^\*([^\s,[\]{}]+)$/.exec(r);if(s)return{value:Ws(s[1],n+1),nextIndex:n+1};if(r==="|"||r===">"||/^[|>][-+]?\d?$/.test(r)){let c=r.startsWith(">"),u=$s(e,n+1,i,!1);if(u===null)return{value:"",nextIndex:n+1};let h=[],m=n+1;while(m<e.length){let p=e[m];if(p.trim()===""){h.push(""),m++;continue}if(Et(p)<u)break;h.push(p.slice(u)),m++}while(h.length&&h[h.length-1]==="")h.pop();if(c)return{value:Ds(h),nextIndex:m};return{value:h.join(`
|
|
4
|
+
`),nextIndex:m}}if(r===""){let c=Gs(e,n+1);if(c!==-1&&Et(e[c])===i&&oe(e[c],i)){let[p,b]=js(e,n+1,i);return{value:p,nextIndex:b}}let u=$s(e,n+1,i);if(u===null)return{value:null,nextIndex:n+1};let[h,m]=Us(e,n+1,u);return{value:h,nextIndex:m}}let a=r[0];if((a==='"'||a==="'"||a==="["||a==="{")&&!Rs(r)){let c=r,u=n+1;while(u<e.length&&!Rs(c)){let h=e[u].trim();c+=a==='"'||a==="'"?h===""?`
|
|
5
|
+
`:` ${h}`:` ${h}`,u++}return{value:zt(Mn(c.replace(/ \n /g,`
|
|
6
|
+
`)),n+1),nextIndex:u}}let l=[],d=n+1;while(d<e.length){let c=e[d];if(c.trim()===""){l.push(""),d++;continue}if(Et(c)<=i||c.trimStart().startsWith("#"))break;if(Ve(c.trim())>=0||oe(c,Et(c)))throw new K("Unexpected indentation",d+1);l.push(Mn(c.trim())),d++}while(l.length&&l[l.length-1]==="")l.pop(),d--;if(l.length>0){while(d>n+1&&e[d-1].trim()==="")d--;return{value:Ds([r,...l]),nextIndex:d}}return{value:zt(r,n+1),nextIndex:n+1}},Ds=(t)=>{let e="",n=!1;for(let i=0;i<t.length;i++){let r=t[i];if(r===""){n=!0;continue}if(i===0)e=r;else if(n)e+=`
|
|
7
|
+
`+r;else e+=" "+r;n=!1}return e},Rs=(t)=>{let e=t[0];if(e==='"'||e==="'"){for(let r=1;r<t.length;r++)if(e==='"'&&t[r]==="\\")r++;else if(t[r]===e)if(e==="'"&&t[r+1]==="'")r++;else return!0;return!1}let n=0,i=null;for(let r=0;r<t.length;r++){let o=t[r];if(i){if(o==="\\"&&i==='"')r++;else if(o===i)i=null}else if(o==='"'||o==="'")i=o;else if(o==="["||o==="{")n++;else if(o==="]"||o==="}"){if(n--,n===0)return!0}}return!1},Ws=(t,e)=>{if(!re.has(t))throw new K(`Unknown alias *${t}`,e);return JSON.parse(JSON.stringify(re.get(t)))},$s=(t,e,n,i=!0)=>{for(let r=e;r<t.length;r++){let o=t[r];if(o.trim()==="")continue;if(i&&o.trimStart().startsWith("#"))continue;let s=Et(o);if(s<=n)return null;return s}return null},Gs=(t,e)=>{for(let n=e;n<t.length;n++){let i=t[n];if(i.trim()!==""&&!i.trimStart().startsWith("#"))return n}return-1},Et=(t)=>{let e=0;while(e<t.length&&t[e]===" ")e++;return e},Ve=(t)=>{let e=null,n=0;for(let i=0;i<t.length;i++){let r=t[i];if(e){if(r==="\\"&&e==='"'){i++;continue}if(r===e)e=null}else if((r==='"'||r==="'")&&(i===0||/[\s[{,]/.test(t[i-1])))e=r;else if(r==="["||r==="{")n++;else if(r==="]"||r==="}")n--;else if(r===":"&&n===0&&(i+1>=t.length||t[i+1]===" "||t[i+1]==="\t"))return i}return-1},zt=(t,e)=>{if(t===""||t==="~"||t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;if(/^-?\d+$/.test(t))return parseInt(t,10);if(/^-?\d*\.\d+$/.test(t))return parseFloat(t);if(/^-?(?:\d+\.?\d*|\.\d+)[eE][-+]?\d+$/.test(t))return parseFloat(t);if(t.startsWith('"'))return Hc(t,e);if(t.startsWith("'"))return zc(t,e);if(t.startsWith("[")||t.startsWith("{"))return Bc(t,e);if(/^\*[^\s,[\]{}]+$/.test(t))return Ws(t.slice(1),e);return t},Bc=(t,e)=>{let n={text:t,at:0},i=cr(n,e);if(At(n),n.at<t.length)throw new K(t[0]==="["?"Unterminated flow array":"Unexpected text after a flow value",e);return i},At=(t)=>{while(t.at<t.text.length&&/\s/.test(t.text[t.at]))t.at++},cr=(t,e)=>{At(t);let n=t.text[t.at];if(n==="["){t.at++;let i=[];for(;;){if(At(t),t.at>=t.text.length)throw new K("Unterminated flow array",e);if(t.text[t.at]==="]")return t.at++,i;if(i.push(cr(t,e)),At(t),t.text[t.at]===",")t.at++;else if(t.text[t.at]!=="]")throw new K("Unterminated flow array",e)}}if(n==="{"){t.at++;let i={};for(;;){if(At(t),t.at>=t.text.length)throw new K("Unterminated flow map",e);if(t.text[t.at]==="}")return t.at++,i;let r=Bs(t,e,!0);At(t);let o=null;if(t.text[t.at]===":")t.at++,At(t),o=t.text[t.at]===","||t.text[t.at]==="}"?null:cr(t,e);if(gt(i,String(r),o),At(t),t.text[t.at]===",")t.at++;else if(t.text[t.at]!=="}")throw new K("Unterminated flow map",e)}}return Bs(t,e,!1)},Bs=(t,e,n)=>{let{text:i}=t,r=t.at,o=i[r];if(o==='"'||o==="'"){let l=r+1;while(l<i.length){if(o==='"'&&i[l]==="\\"){l+=2;continue}if(i[l]===o){if(o==="'"&&i[l+1]==="'"){l+=2;continue}break}l++}return t.at=l+1,zt(i.slice(r,l+1),e)}let s=r;while(s<i.length){let l=i[s];if(l===","||l==="]"||l==="}")break;if(n&&l===":"&&(s+1>=i.length||/[\s,}\]]/.test(i[s+1])))break;s++}t.at=s;let a=i.slice(r,s).trim();return n?a:zt(a,e)},Vc={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
+
`,r:"\r",t:"\t","0":"\x00"},Hc=(t,e)=>{if(!t.endsWith('"')||t.length<2)throw new K("Unterminated string",e);let n=t.slice(1,-1),i="";for(let r=0;r<n.length;r++){let o=n[r];if(o!=="\\"){i+=o;continue}let s=n[++r];if(s===void 0)throw new K("Dangling escape in string",e);if(s==="u"){let a=n.slice(r+1,r+5);if(!/^[0-9a-fA-F]{4}$/.test(a))throw new K("Invalid \\u escape",e);i+=String.fromCharCode(parseInt(a,16)),r+=4;continue}i+=Vc[s]??s}return i},zc=(t,e)=>{if(!t.endsWith("'")||t.length<2)throw new K("Unterminated string",e);return t.slice(1,-1).replace(/''/g,"'")},He=(t)=>En(t,0).trimEnd()+`
|
|
9
|
+
`,En=(t,e)=>{if(t===null)return`null
|
|
10
10
|
`;if(typeof t==="boolean")return`${t}
|
|
11
11
|
`;if(typeof t==="number")return`${t}
|
|
12
|
-
`;if(typeof t==="string")return
|
|
13
|
-
`);if(e[e.length-1].trim()==="")return!1;let n=e.find((i)=>i.trim()!=="");if(n===void 0||/^[ \t]/.test(n))return!1;if(e.some((i)=>i.trim()==="---"))return!1;return!e.some((i)=>/^[ \t]+$/.test(i))},
|
|
12
|
+
`;if(typeof t==="string")return Uc(t,e);if(Array.isArray(t))return hr(t,e);return Ks(t,e)},Ys=(t)=>{if(t.includes("\r")||/--!?>/.test(t))return!1;let e=t.split(`
|
|
13
|
+
`);if(e[e.length-1].trim()==="")return!1;let n=e.find((i)=>i.trim()!=="");if(n===void 0||/^[ \t]/.test(n))return!1;if(e.some((i)=>i.trim()==="---"))return!1;return!e.some((i)=>/^[ \t]+$/.test(i))},ur=(t,e,n)=>{if(Ys(t)){let i=" ".repeat(n),r=`${e} |
|
|
14
14
|
`;for(let o of t.split(`
|
|
15
15
|
`))r+=`${i}${o}
|
|
16
16
|
`;return r}return`${e} ${JSON.stringify(t)}
|
|
17
|
-
`},
|
|
17
|
+
`},Ks=(t,e)=>{let n=" ".repeat(e),i="";for(let[r,o]of Object.entries(t)){if(o===void 0)continue;let s=qs(r);if(o===null){i+=`${n}${s}: null
|
|
18
18
|
`;continue}if(typeof o==="string")if(o.includes(`
|
|
19
|
-
`))i+=
|
|
19
|
+
`))i+=ur(o,`${n}${s}:`,e+2);else i+=`${n}${s}: ${Nn(o)?JSON.stringify(o):o}
|
|
20
20
|
`;else if(typeof o==="number"||typeof o==="boolean")i+=`${n}${s}: ${o}
|
|
21
21
|
`;else if(Array.isArray(o)){if(o.length===0){i+=`${n}${s}: []
|
|
22
|
-
`;continue}if(o.every((l)=>typeof l==="string"||typeof l==="number"||typeof l==="boolean")&&o.every((l)=>typeof l!=="string"||!
|
|
22
|
+
`;continue}if(o.every((l)=>typeof l==="string"||typeof l==="number"||typeof l==="boolean")&&o.every((l)=>typeof l!=="string"||!Nn(l)))i+=`${n}${s}: [${o.map((l)=>$e(l)).join(", ")}]
|
|
23
23
|
`;else i+=`${n}${s}:
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
`}return i},
|
|
27
|
-
`;continue}let[s,a]=o[0];if(
|
|
28
|
-
${
|
|
29
|
-
${
|
|
24
|
+
${hr(o,e+2)}`}else if(Object.values(o).some((a)=>a!==void 0))i+=`${n}${s}:
|
|
25
|
+
${En(o,e+2)}`;else i+=`${n}${s}: {}
|
|
26
|
+
`}return i},hr=(t,e)=>{let n=" ".repeat(e),i="";for(let r of t)if(r!==null&&typeof r==="object"&&!Array.isArray(r)){let o=Object.entries(r).filter(([,l])=>l!==void 0);if(o.length===0){i+=`${n}- {}
|
|
27
|
+
`;continue}let[s,a]=o[0];if(Zs(s)){i+=`${n}-
|
|
28
|
+
${Ks(r,e+2)}`;continue}if(a!==null&&typeof a==="object"){let l=Vs(a);i+=l===null?`${n}- ${s}:
|
|
29
|
+
${En(a,e+4)}`:`${n}- ${s}: ${l}
|
|
30
30
|
`}else if(typeof a==="string"&&a.includes(`
|
|
31
|
-
`))i+=
|
|
32
|
-
`;for(let[l,d]of o.slice(1)){let c=
|
|
33
|
-
${
|
|
31
|
+
`))i+=ur(a,`${n}- ${s}:`,e+4);else i+=`${n}- ${s}: ${$e(a)}
|
|
32
|
+
`;for(let[l,d]of o.slice(1)){let c=qs(l);if(d!==null&&typeof d==="object"&&!Array.isArray(d)){let u=Vs(d);i+=u===null?`${n} ${c}:
|
|
33
|
+
${En(d,e+4)}`:`${n} ${c}: ${u}
|
|
34
34
|
`}else if(Array.isArray(d))if(d.length===0)i+=`${n} ${c}: []
|
|
35
|
-
`;else if(d.every((h)=>typeof h!=="object"||h===null))i+=`${n} ${c}: [${d.map((h)
|
|
35
|
+
`;else if(d.every((h)=>typeof h!=="object"||h===null))i+=`${n} ${c}: [${d.map((h)=>$e(h)).join(", ")}]
|
|
36
36
|
`;else i+=`${n} ${c}:
|
|
37
|
-
${
|
|
38
|
-
`))i+=
|
|
39
|
-
`}}else i+=`${n}- ${
|
|
40
|
-
`;return i},
|
|
41
|
-
`)){if(!
|
|
37
|
+
${hr(d,e+4)}`;else if(typeof d==="string"&&d.includes(`
|
|
38
|
+
`))i+=ur(d,`${n} ${c}:`,e+4);else i+=`${n} ${c}: ${$e(d)}
|
|
39
|
+
`}}else i+=`${n}- ${$e(r)}
|
|
40
|
+
`;return i},Vs=(t)=>{if(Array.isArray(t))return t.length===0?"[]":null;if(typeof t!=="object"||t===null)return null;return Object.values(t).some((e)=>e!==void 0)?null:"{}"},qs=(t)=>Zs(t)?JSON.stringify(t):t,Zs=(t)=>{if(t===""||t!==t.trim()||/^["']/.test(t)||/^-(\s|$)/.test(t))return!0;if(/[\u0000-\u001F\u007F]/.test(t))return!0;return Ve(`${t}: x`)!==t.length},Uc=(t,e)=>{if(t.includes(`
|
|
41
|
+
`)){if(!Ys(t))return`${JSON.stringify(t)}
|
|
42
42
|
`;let n=" ".repeat(e);return`|
|
|
43
43
|
`+t.split(`
|
|
44
44
|
`).map((i)=>n+i).join(`
|
|
45
45
|
`)+`
|
|
46
|
-
`}return
|
|
46
|
+
`}return Nn(t)?`${JSON.stringify(t)}
|
|
47
47
|
`:`${t}
|
|
48
|
-
`}
|
|
48
|
+
`},$e=(t)=>{if(t===null)return"null";if(typeof t==="string")return Nn(t)?JSON.stringify(t):t;return String(t)},jc=/^(?:y|n|yes|no|on|off|true|false|null|~)$|^[-+]?(?:\.?\d|\.(?:inf|nan)$)|^0[xob]/i,Nn=(t)=>{if(t===""||jc.test(t))return!0;try{if(zt(t,0)!==t)return!0}catch{return!0}if(/[:,#[{}&*!|>'"%@`]/.test(t))return!0;if(/^[ ]|[ ]$/.test(t))return!0;if(/[\u0000-\u001F\u007F]/.test(t))return!0;return!1},Xs=(t)=>{if(t===""||t!==t.trim())return!1;if(Mn(t)!==t)return!1;if(/^&[^\s,[\]{}]+/.test(t)||/^\*[^\s,[\]{}]+$/.test(t)||/^[|>][-+]?\d?$/.test(t))return!1;try{return zt(t,0)===t}catch{return!1}};var Wc=new Set(["youtube","vimeo","native"]),Js=new Set(["true","yes","on","1"]),Gc=new Set(["false","no","off","0"]),Tn=new WeakMap,pr=(t)=>t?Tn.get(t):void 0,Fn=(t)=>{let e=JSON.parse(JSON.stringify(t)),n=Tn.get(t);if(n)Tn.set(e,JSON.parse(JSON.stringify(n)));return e},mr=(t,e,n)=>{let i=Object.fromEntries(Object.entries(e).filter(([r])=>!n.includes(r)));if(Object.keys(i).length>0)Tn.set(t,i)},br=(t)=>{if(typeof t==="string"&&t.trim()!=="")return{src:t.trim()};if(t&&typeof t==="object"&&!Array.isArray(t)){let e=t;if(typeof e.src==="string"&&e.src.trim()!=="")return e}return null},ze=(t)=>typeof t==="string"||typeof t==="number"?String(t):void 0,Yc=(t)=>{let e=br(t);if(!e)return;let n={src:String(e.src)},i=ze(e.alt),r=ze(e.caption);if(i!==void 0)n.alt=i;if(r!==void 0)n.caption=r;return mr(n,e,["src","alt","caption"]),n},Kc=(t)=>{let e=br(t);if(!e)return;let n={src:String(e.src)},i=typeof e.provider==="string"&&Wc.has(e.provider);if(i)n.provider=e.provider;let r=ze(e.thumbnail),o=ze(e.caption);if(r!==void 0)n.thumbnail=r;if(o!==void 0)n.caption=o;return mr(n,e,i?["src","provider","thumbnail","caption"]:["src","thumbnail","caption"]),n},qc=(t)=>{let e=br(t);if(!e)return;let n={src:String(e.src)},i=ze(e.caption);if(i!==void 0)n.caption=i;return mr(n,e,["src","caption"]),n},fr=["color","paletteColor","icon","status","priority","tags","collapsed","link","note","noteFormat","image","video","embed","caption","id","type"],Zc={colour:"color",emoji:"icon",state:"status",tag:"tags",labels:"tags",url:"link",href:"link",img:"image",picture:"image",photo:"image",youtube:"video",iframe:"embed",notes:"note",description:"note",details:"note",collapse:"collapsed",folded:"collapsed",kind:"type"},Ut=(t)=>typeof t==="string"||typeof t==="number"||typeof t==="boolean"?String(t):void 0,_t=(t,e,n,i,r,o)=>{i.recover("invalid-attributes",`${e} must be ${o}; kept as written, but not used`,r),t.attrs??={},gt(t.attrs,e,n)},se=(t,e,n,i,r,o={keys:[]})=>{switch(e){case"color":case"icon":case"status":case"link":{let s=Ut(n);if(s===void 0)_t(t,e,n,i,r,"one value");else t[e]=s;return}case"paletteColor":{let s=typeof n==="number"||typeof n==="string"&&n.trim()!==""?Number(n):Number.NaN;if(Ht(s))t.paletteColor=s;else _t(t,e,n,i,r,"a whole number from 1");return}case"priority":{let s=typeof n==="number"||typeof n==="string"&&n.trim()!==""?Number(n):Number.NaN;if(Number.isFinite(s))t.priority=s;else _t(t,e,n,i,r,"a number");return}case"tags":{let s=Array.isArray(n)?void 0:Ut(n),a=Array.isArray(n)?n.map(Ut):s===void 0?[void 0]:s.split(",").map((l)=>l.trim()).filter((l)=>l!=="");if(a.some((l)=>l===void 0)){_t(t,e,n,i,r,"a word or a list of words");return}t.tags=[...new Set([...t.tags??[],...a])];return}case"collapsed":{let s=Ut(n)?.toLowerCase();if(s!==void 0&&(Js.has(s)||Gc.has(s)))t.collapsed=Js.has(s);else _t(t,e,n,i,r,"true or false");return}case"note":{let s=Ut(n);if(s===void 0){_t(t,e,n,i,r,"text");return}if(t.note=s,t.noteFormat===void 0)t.noteFormat="markdown";return}case"noteFormat":if(n==="markdown"||n==="plain")t.noteFormat=n;else _t(t,e,n,i,r,'"markdown" or "plain"');return;case"id":{let s=Ut(n);if(s===void 0||s.trim()==="")_t(t,e,n,i,r,"one word");else t.id=s;return}case"type":{let s=Ut(n);if(s===void 0){_t(t,e,n,i,r,"one word");return}let a=/^(.*\S)@(\d+)$/.exec(s.trim());if(t.type=a?a[1]:s.trim(),a)t.typeVersion=Number(a[2]);return}case"image":{let s=Yc(n);if(s)t.image=s;else i.recover("media-missing-source","image needs a URL (or an object with a src)",r);return}case"video":{let s=Kc(n);if(s)t.video=s;else i.recover("media-missing-source","video needs a URL (or an object with a src)",r);return}case"embed":{let s=qc(n);if(s)t.embed=s;else i.recover("media-missing-source","embed needs a URL (or an object with a src)",r);return}case"caption":{let s=t.video??t.embed??t.image;if(s){if(n!==null&&n!==void 0)s.caption=String(n)}else i.note("caption-without-media","caption kept, but not shown: the node has no image, video or embed",r),t.attrs??={},t.attrs.caption=n;return}default:{let s=ie(e,[...fr,...o.keys],{...Zc,...o.synonyms});if(s)i.note("unknown-attribute",`Unknown attribute "${e}", kept as a custom attribute.${s}`,r);if(!t.attrs)t.attrs={};gt(t.attrs,e,n)}}};var Cn=(t)=>{let e=(t.match(/\r\n/g)??[]).length,n=(t.match(/\n/g)??[]).length;return{lineEnding:e>0&&e*2>=n?`\r
|
|
49
49
|
`:`
|
|
50
|
-
`,byteOrderMark:t.startsWith("\uFEFF"),indentation:"",before:[],after:[]}},
|
|
51
|
-
`,byteOrderMark:!1,indentation:"",before:[],after:[]}}}}var
|
|
50
|
+
`,byteOrderMark:t.startsWith("\uFEFF"),indentation:"",before:[],after:[]}},Qs=new WeakMap,ae=(t)=>{let e=Qs.get(t.root);return e?.root===t.root?e:void 0},In=(t,e)=>{Qs.set(t.root,e)},gr=(t)=>{let e=(n)=>n===void 0?void 0:JSON.parse(JSON.stringify(n));return{id:t.id,text:t.text,icon:t.icon,link:t.link,status:t.status,tags:e(t.tags),color:t.color,paletteColor:t.paletteColor,priority:t.priority,collapsed:t.collapsed,type:t.type,typeVersion:t.typeVersion,note:t.note,noteFormat:t.noteFormat,image:t.image&&Fn(t.image),video:t.video&&Fn(t.video),embed:t.embed&&Fn(t.embed),attrs:e(t.attrs)}};class yr{owners;roles;lines;shapes=new Map;constructor(t){this.lines=t,this.owners=Array(t.length).fill(null),this.roles=Array(t.length).fill(void 0)}mark(t,e,n,i){for(let r=Math.max(1,t);r<=e&&r<=this.lines.length;r+=1)this.owners[r-1]=n,this.roles[r-1]=i}line(t){return this.lines[t-1]??""}shape(t,e,n){this.shapes.set(t,{shape:e,titleLine:n===null?null:n-1})}finish(t,e,n,i,r){let o=[...this.owners],s=[...this.roles],a=null,l;for(let w=this.lines.length-1;w>=0;w-=1){let x=s[w];if(x!==void 0){if(x!=="frontmatter")a=o[w],l=x}else if(a&&this.lines[w].trim()==="")o[w]=a,s[w]=l==="end"?"end":"blank"}let d=[],c=null,u=-1;s.forEach((w,x)=>{if(w!==void 0&&w!=="frontmatter")u=x});for(let w=0;w<this.lines.length;w+=1){let x=s[w];if(x!==void 0){if(d.push(x),x!=="frontmatter")c=o[w];continue}let E=this.lines[w].trim()==="";if(w>u)o[w]=t,d.push(E?"end":"foreign");else o[w]=c??t,d.push(E?"blank":"foreign")}let h=new WeakMap,m=new Map,p=new Map;o.forEach((w,x)=>{if(w){if(!m.has(w))m.set(w,x);p.set(w,x)}});let b=(w)=>{let x=m.get(w)??Number.POSITIVE_INFINITY,E=(p.get(w)??-1)+1;for(let B of w.children){let q=b(B);x=Math.min(x,q.start),E=Math.max(E,q.end)}let k=this.shapes.get(w),C=k?.shape??{kind:"generated",lead:!1};if(!Number.isFinite(x))x=E=0;return h.set(w,{shape:C,titleLine:k?.titleLine??null,start:x,end:E,contiguous:!0,children:[...w.children],fields:gr(w),explicitId:r.has(w)}),{start:x,end:E}};b(t);let f=new Map,g=0,y=(w)=>{let x=g;g+=1;for(let E of w.children)y(E);f.set(w,[x,g])};y(t);let v=(w,x)=>{let[E,k]=f.get(x),C=f.get(w);return C[0]>=E&&C[0]<k},O=(w)=>{let x=h.get(w);for(let E=x.start;E<x.end;E+=1){let k=o[E];if(k&&!v(k,w)){x.contiguous=!1;break}}w.children.forEach(O)};t.children.forEach(O);let M=h.get(t);return M.start=Math.min(M.start,i?i.close+1:0),M.end=this.lines.length,{lines:this.lines,owners:o,roles:d,records:h,root:t,options:JSON.parse(JSON.stringify(e)),extra:JSON.parse(JSON.stringify(n)),frontmatter:i,encoding:{lineEnding:`
|
|
51
|
+
`,byteOrderMark:!1,indentation:"",before:[],after:[]}}}}var vr=new Set;var xr=(t)=>t.replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,"").replace(/[\t\n\r]/g,""),D=(t,e,n=!0)=>{let i=n?Jc:()=>{return},r=xr(t);if(r.startsWith("//")){let a=`https:${r}`,l;try{l=new URL(a)}catch{return i(r,"unparseable URL"),null}if(!ta("https",e,l))return i(r,`surface "${e}" forbidden`),null;return r}if(!Xc(r))return r;let o;try{o=new URL(r)}catch{return i(r,"unparseable URL"),null}let s=o.protocol.replace(/:$/,"");if(!ta(s,e,o))return i(r,`surface "${e}" forbidden`),null;return r},Xc=(t)=>/^[a-z][a-z0-9+.-]*:/i.test(t),ta=(t,e,n)=>{if(t==="http"||t==="https")return!0;if(t==="data"&&e==="image")return/^data:image\/(png|jpeg|jpg|gif|webp|avif|bmp|ico);/i.test(n.href);if(t==="blob")return e==="image"||e==="video";if(t==="mailto"||t==="tel"||t==="sms")return e==="link";return!1},Jc=(t,e)=>{if(vr.has(t))return;if(vr.size>=500)return;if(vr.add(t),typeof console<"u")console.warn(`[orbit] blocked URL (${e}): ${t}`)},Qc=(t)=>{try{return new URL(t).href}catch{if(typeof document<"u"&&document.baseURI)return new URL(t,document.baseURI).href;throw Error(`RendererOptions.baseUrl is relative ("${t}") and no document.baseURI is available. Provide an absolute baseUrl when running outside a browser document context.`)}},H=(t,e)=>{if(!e)return t;if(t.startsWith("//"))return t;try{return new URL(t),t}catch{let n=Qc(e);return new URL(t,n).href}};var wr=new Set(["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtube-nocookie.com","www.youtube-nocookie.com","youtu.be"]),ea=new Set(["vimeo.com","www.vimeo.com","player.vimeo.com"]),na=/\.(mp4|webm|mov)(?:[?#]|$)/i,tu=/^(?:(?:www|m|music|player)\.)?(?:youtube\.com|youtube-nocookie\.com|youtu\.be|vimeo\.com)\//i,eu=/^[A-Za-z0-9_-]{6,}$/,An=(t)=>{let e=xr(t),n=e.startsWith("//")?`https:${e}`:tu.test(e)?`https://${e}`:e;try{let i=new URL(n);return i.protocol==="https:"||i.protocol==="http:"?i:null}catch{return null}},et=(t)=>{let e=An(t),n=e?.hostname.toLowerCase();if(n&&wr.has(n))return"youtube";if(n&&ea.has(n))return"vimeo";if(na.test(e?e.pathname:t))return"native";return null},Ln=(t)=>na.test(t),kr=(t)=>{let e=An(t),n=e?.hostname.toLowerCase();if(!e||!n||!wr.has(n))return null;let i=e.pathname.split("/").filter(Boolean),r;if(n==="youtu.be")r=i[0];else if(i[0]==="watch")r=e.searchParams.get("v");else if(["embed","shorts","live","v"].includes(i[0]))r=i[1];return r&&eu.test(r)?r:null},ia=(t)=>{let e=An(t),n=e?.hostname.toLowerCase();if(!e||!n||!ea.has(n))return null;let i=e.pathname.split("/").filter(Boolean),r=(a)=>a&&/^[0-9a-f]{6,}$/i.test(a)?a:void 0;if(n==="player.vimeo.com")return i[0]==="video"&&/^\d+$/.test(i[1]??"")?{id:i[1],hash:r(e.searchParams.get("h"))}:null;if(/^\d+$/.test(i[0]??""))return{id:i[0],hash:r(i[1])};let o=-1;if(i[0]==="video")o=1;else if(i[0]==="channels")o=2;else if(i[0]==="groups"&&i[2]==="videos")o=3;else if((i[0]==="album"||i[0]==="showcase")&&i[2]==="video")o=3;let s=o>0?i[o]:void 0;return s&&/^\d+$/.test(s)?{id:s,hash:r(i[o+1])}:null};var Pn=(t,e)=>{let n=e==="youtube"||e==="vimeo"?e:et(t);if(n==="youtube"){let i=kr(t);return i?`https://www.youtube-nocookie.com/embed/${i}`:null}if(n==="vimeo"){let i=ia(t);return i?`https://player.vimeo.com/video/${i.id}${i.hash?`?h=${i.hash}`:""}`:null}return null},Or=(t)=>{let e=An(t);return e!==null&&wr.has(e.hostname.toLowerCase())&&e.pathname.split("/").filter(Boolean)[0]==="shorts"},Dn=(t,e)=>{let n=e==="youtube"||e==="vimeo"?e:et(t);if(n==="youtube"){let i=kr(t);if(i)return Or(t)?`https://www.youtube.com/shorts/${i}`:`https://www.youtube.com/watch?v=${i}`}if(n==="vimeo"){let i=ia(t);if(i)return`https://vimeo.com/${i.id}${i.hash?`/${i.hash}`:""}`}return t},Rn=(t)=>{let e=kr(t);return e?`https://img.youtube.com/vi/${e}/hqdefault.jpg`:null},T=(t)=>Boolean(t)&&typeof t.src==="string"&&t.src.trim()!=="";class ra extends Error{code;line;constructor(t,e,n="invalid-yaml"){super(`${t} at line ${e}`);this.name="OrbitParseError",this.line=e,this.code=n}}var Sr=(t)=>t.line===void 0?t.message:`Line ${t.line}: ${t.message}`,oa=(t)=>{if(typeof console>"u")return;let e=t.diagnostics,n=e?e.filter((i)=>i.severity!=="error").map(Sr):t.warnings;for(let i of e??[])if(i.severity==="error")console.error(`[orbit] ${Sr(i)}`);if(n.length>0)console.warn(`[orbit] parse warnings:
|
|
52
52
|
- ${n.join(`
|
|
53
|
-
- `)}`)};class
|
|
54
|
-
`);return
|
|
55
|
-
`)){if(n.trim()==="")continue;let i=/^[ \t]*/.exec(n)[0];if(e===null){e=i;continue}let r=0;while(r<e.length&&r<i.length&&e[r]===i[r])r+=1;if(e=e.slice(0,r),e==="")return""}return e??""},
|
|
53
|
+
- `)}`)};class Ue{diagnostics=[];strict;constructor(t){this.strict=t}recover(t,e,n,i="warning"){if(this.strict)throw new ra(e,n??1,t);this.diagnostics.push({code:t,message:e,line:n,severity:i})}note(t,e,n){this.diagnostics.push({code:t,message:e,line:n,severity:"warning"})}get warnings(){return this.diagnostics.map(Sr)}}var le=(t)=>{let e=t.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
|
|
54
|
+
`);return nu(e)},$n=(t)=>{let e=null;for(let n of t.split(`
|
|
55
|
+
`)){if(n.trim()==="")continue;let i=/^[ \t]*/.exec(n)[0];if(e===null){e=i;continue}let r=0;while(r<e.length&&r<i.length&&e[r]===i[r])r+=1;if(e=e.slice(0,r),e==="")return""}return e??""},nu=(t)=>{let e=t.split(`
|
|
56
56
|
`),n=null;for(let r of e){if(r.trim()==="")continue;let o=/^[ \t]*/.exec(r)[0];if(n===null){n=o;continue}let s=0;while(s<n.length&&s<o.length&&n[s]===o[s])s+=1;if(n=n.slice(0,s),n==="")return t}if(!n)return t;let i=n;return e.map((r)=>{if(r.startsWith(i))return r.slice(i.length);let o=0;while(o<r.length&&r[o]===i[o])o+=1;return r.slice(o)}).join(`
|
|
57
|
-
`)},
|
|
58
|
-
`),openIndex:e,closeIndex:n};return null},_t=(t,e,n=0,i=t.length)=>{let r=new RegExp(`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*:`);for(let o=n;o<i;o+=1)if(r.test(t[o]))return o+1;return};var yn=["sans-font","serif-font","mono-font","font-family","label-font","display-font","label-weight","display-weight","label-letter-spacing","label-shadow","surface","surface-pattern","text","muted-text","root-text","node-text","node-text-inverse","color-root","color-1","color-2","color-3","color-4","color-5","color-6","color-7","shade-light","shade-dark","node-fill-opacity","moon-opacity","node-highlight","node-terminator","node-shading","node-shade-circle","node-stroke","node-stroke-tint","node-stroke-width","badge-stroke","node-shadow","node-shadow-tint","node-shadow-opacity","node-shadow-offset","node-shadow-size","sun-shadow-opacity","sun-shadow-size","sun-halo","sun-halo-tint","sun-halo-opacity","sun-halo-width","sun-halo-dash","sun-halo-size","ring-stroke","ring-tint","ring-opacity","ring-width","ring-dash","link-stroke","link-tint","link-opacity","link-width","link-dash","focus-ring","note-indicator","control-background","control-border","control-text","control-muted-text","control-active-background","control-active-text","control-shadow","control-blur","tooltip-background","tooltip-text","action-background","action-border","action-text","action-shadow","sheet-background","sheet-text","sheet-muted-text","sheet-border","sheet-backdrop","sheet-shadow","sheet-blur","chip-background","chip-text","link-text","status-active","status-done","status-blocked","status-todo","status-neutral","error-background","error-border","error-text"];var gt={"sans-font":'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif',"serif-font":'ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, "Times New Roman", serif',"mono-font":'ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace',"font-family":"var(--_orbit-sans-font)","label-font":"var(--_orbit-font-family)","display-font":"var(--_orbit-font-family)","label-weight":"600","display-weight":"650","label-letter-spacing":"-0.005em","label-shadow":"none",surface:"transparent","surface-pattern":"none",text:"#1F2733","muted-text":"#5B6474","root-text":"#1F2733","node-text":"#1F2733","node-text-inverse":"#FFFFFF","color-root":"#FAD86F","color-1":"#FEBAB6","color-2":"#99E0BA","color-3":"#9ED5FD","color-4":"#D6C2FE","color-5":"#F9C191","color-6":"#FCB6D6","color-7":"#82E1E0","shade-light":"#FFFFFF","shade-dark":"#1F2733","node-fill-opacity":"1","moon-opacity":"0.94","node-highlight":"rgba(255, 255, 255, 0.55)","node-terminator":"rgba(31, 39, 51, 0)","node-shading":"rgba(31, 39, 51, 0.12)","node-shade-circle":"0.34 0.3 0.78","node-stroke":"#1F2733","node-stroke-tint":"78%","node-stroke-width":"1","badge-stroke":"#FFFFFF","node-shadow":"#1F2733","node-shadow-tint":"45%","node-shadow-opacity":"0.26","node-shadow-offset":"0.16","node-shadow-size":"0.96","sun-shadow-opacity":"0.3","sun-shadow-size":"0.98","sun-halo":"#1F2733","sun-halo-tint":"72%","sun-halo-opacity":"0.55","sun-halo-width":"1","sun-halo-dash":"none","sun-halo-size":"1.15","ring-stroke":"#1F2733","ring-tint":"35%","ring-opacity":"0.4","ring-width":"1.5","ring-dash":"1 6","link-stroke":"#1F2733","link-tint":"60%","link-opacity":"0.45","link-width":"1.5","link-dash":"none","focus-ring":"#2563EB","note-indicator":"#1F2733","control-background":"rgba(255, 255, 255, 0.92)","control-border":"rgba(31, 39, 51, 0.12)","control-text":"#1F2733","control-muted-text":"#5B6474","control-active-background":"#1F2733","control-active-text":"#FFFFFF","control-shadow":"0 6px 20px rgba(31, 39, 51, 0.12)","control-blur":"12px","tooltip-background":"#1F2733","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"rgba(31, 39, 51, 0.16)","action-text":"#1F2733","action-shadow":"0 6px 16px rgba(31, 39, 51, 0.18)","sheet-background":"#FFFFFF","sheet-text":"#1F2733","sheet-muted-text":"#5B6474","sheet-border":"rgba(31, 39, 51, 0.12)","sheet-backdrop":"rgba(15, 23, 42, 0.45)","sheet-shadow":"0 24px 64px rgba(15, 23, 42, 0.28)","sheet-blur":"0px","chip-background":"#F1F5F9","chip-text":"#334155","link-text":"#2563EB","status-active":"#2563EB","status-done":"#16A34A","status-blocked":"#DC2626","status-todo":"#94A3B8","status-neutral":"#64748B","error-background":"#FFF6F5","error-border":"#E58A8A","error-text":"#7A1F1F"},Ct={...gt,surface:"#0B1120","surface-pattern":"radial-gradient(120% 90% at 50% 42%, rgba(64, 84, 160, 0.26), transparent 70%)",text:"#E6EAF2","muted-text":"#97A3B6","root-text":"#0B1120","node-text":"#0B1120","color-root":"#FEDB6D","color-1":"#FFAAA7","color-2":"#80DAAC","color-3":"#86CDFF","color-4":"#CEB5FE","color-5":"#F8B478","color-6":"#FAA6CE","color-7":"#5EDADA","shade-dark":"#0B1120","node-highlight":"rgba(255, 255, 255, 0.45)","node-terminator":"rgba(11, 17, 32, 0)","node-shading":"rgba(11, 17, 32, 0.2)","node-stroke":"#FFFFFF","node-stroke-tint":"55%","badge-stroke":"#0B1120","node-shadow":"#FFFFFF","node-shadow-tint":"100%","node-shadow-opacity":"0.42","node-shadow-offset":"0","node-shadow-size":"1.16","sun-shadow-opacity":"0.5","sun-shadow-size":"1.4","sun-halo-opacity":"0","ring-stroke":"#FFFFFF","ring-tint":"55%","ring-opacity":"0.34","link-stroke":"#FFFFFF","link-tint":"70%","link-opacity":"0.36","focus-ring":"#93C5FD","note-indicator":"#E6EAF2","control-background":"rgba(20, 26, 44, 0.84)","control-border":"rgba(148, 163, 184, 0.22)","control-text":"#E6EAF2","control-muted-text":"#97A3B6","control-active-background":"#E6EAF2","control-active-text":"#0B1120","control-shadow":"0 8px 24px rgba(0, 0, 0, 0.4)","tooltip-background":"#E6EAF2","tooltip-text":"#0B1120","action-background":"#1B2338","action-border":"rgba(148, 163, 184, 0.3)","action-text":"#E6EAF2","action-shadow":"0 6px 16px rgba(0, 0, 0, 0.45)","sheet-background":"#131A2E","sheet-text":"#E6EAF2","sheet-muted-text":"#97A3B6","sheet-border":"rgba(148, 163, 184, 0.2)","sheet-backdrop":"rgba(2, 6, 23, 0.6)","sheet-shadow":"0 24px 64px rgba(0, 0, 0, 0.6)","chip-background":"rgba(148, 163, 184, 0.16)","chip-text":"#E2E8F0","link-text":"#93C5FD","status-active":"#60A5FA","status-done":"#4ADE80","status-blocked":"#F87171","status-neutral":"#94A3B8","error-background":"#2A1215","error-border":"#F87171","error-text":"#FECACA"},wc={...gt,surface:"#E7EAF8","surface-pattern":["radial-gradient(60% 50% at 16% 18%, rgba(196, 181, 253, 0.75), transparent 70%)","radial-gradient(55% 48% at 86% 24%, rgba(251, 207, 232, 0.85), transparent 70%)","radial-gradient(65% 55% at 52% 96%, rgba(153, 246, 228, 0.7), transparent 70%)","radial-gradient(40% 40% at 90% 85%, rgba(191, 219, 254, 0.8), transparent 70%)"].join(", "),text:"#16213A","muted-text":"#414C66","root-text":"#16213A","node-text":"#16213A","color-root":"#FEEEBD","color-1":"#FED6D4","color-2":"#B6F1D0","color-3":"#C7E6FD","color-4":"#E6DAFE","color-5":"#FDDABD","color-6":"#FFD3E6","color-7":"#A5F2F1","shade-dark":"#16213A","node-fill-opacity":"0.55","moon-opacity":"0.5","node-highlight":"rgba(255, 255, 255, 0.85)","node-terminator":"rgba(22, 33, 58, 0)","node-shading":"rgba(22, 33, 58, 0.08)","node-stroke":"rgba(255, 255, 255, 0.92)","node-stroke-tint":"0%","node-stroke-width":"1.5","node-shadow":"#16213A","node-shadow-tint":"25%","node-shadow-opacity":"0.18","node-shadow-offset":"0.18","node-shadow-size":"0.98","sun-shadow-opacity":"0.22","sun-shadow-size":"1","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.7","sun-halo-width":"1.5","sun-halo-size":"1.13","ring-stroke":"#FFFFFF","ring-tint":"0%","ring-opacity":"0.85","link-stroke":"#FFFFFF","link-tint":"0%","link-opacity":"0.8","note-indicator":"#16213A","control-background":"rgba(255, 255, 255, 0.42)","control-border":"rgba(255, 255, 255, 0.62)","control-text":"#16213A","control-muted-text":"#414C66","control-active-background":"rgba(255, 255, 255, 0.78)","control-active-text":"#16213A","control-shadow":"0 8px 28px rgba(28, 44, 72, 0.18)","control-blur":"18px","tooltip-background":"rgba(255, 255, 255, 0.86)","tooltip-text":"#16213A","action-background":"rgba(255, 255, 255, 0.62)","action-border":"rgba(255, 255, 255, 0.78)","action-text":"#16213A","action-shadow":"0 6px 18px rgba(28, 44, 72, 0.2)","sheet-background":"rgba(255, 255, 255, 0.8)","sheet-text":"#16213A","sheet-muted-text":"#414C66","sheet-border":"rgba(255, 255, 255, 0.7)","sheet-backdrop":"rgba(18, 28, 45, 0.32)","sheet-shadow":"0 24px 70px rgba(28, 44, 72, 0.3)","sheet-blur":"24px","chip-background":"rgba(255, 255, 255, 0.6)"},kc={...Ct,surface:"#0E1326","surface-pattern":["radial-gradient(60% 50% at 18% 16%, rgba(99, 102, 241, 0.42), transparent 70%)","radial-gradient(55% 50% at 86% 78%, rgba(219, 39, 119, 0.3), transparent 70%)","radial-gradient(45% 40% at 74% 12%, rgba(20, 184, 166, 0.26), transparent 70%)"].join(", "),"label-shadow":"0 1px 3px rgba(5, 8, 20, 0.55)",text:"#F4F6FF","muted-text":"#A9B2D0","root-text":"#F4F6FF","node-text":"#F4F6FF","node-text-inverse":"#F4F6FF","color-root":"#F8DC86","color-1":"#FFAAA7","color-2":"#6FDEA7","color-3":"#86CDFF","color-4":"#CEB5FE","color-5":"#FEB16B","color-6":"#FFA3CF","color-7":"#36DEDE","shade-dark":"#0E1326","node-fill-opacity":"0.16","moon-opacity":"0.14","node-highlight":"rgba(255, 255, 255, 0.1)","node-terminator":"rgba(14, 19, 38, 0)","node-shading":"rgba(14, 19, 38, 0.18)","node-stroke":"rgba(255, 255, 255, 0.6)","node-stroke-tint":"45%","node-stroke-width":"1.5","node-shadow-opacity":"0.3","node-shadow-size":"1.14","sun-shadow-opacity":"0.38","sun-shadow-size":"1.35","ring-tint":"20%","ring-opacity":"0.32","link-tint":"30%","link-opacity":"0.32","note-indicator":"#F4F6FF","control-background":"rgba(30, 38, 64, 0.5)","control-border":"rgba(255, 255, 255, 0.16)","control-text":"#F4F6FF","control-muted-text":"#A9B2D0","control-active-background":"#F4F6FF","control-active-text":"#0E1326","control-blur":"18px","tooltip-background":"rgba(244, 246, 255, 0.92)","tooltip-text":"#0E1326","action-background":"rgba(30, 38, 64, 0.62)","action-border":"rgba(255, 255, 255, 0.2)","action-text":"#F4F6FF","sheet-background":"rgba(24, 32, 56, 0.78)","sheet-text":"#F4F6FF","sheet-muted-text":"#A9B2D0","sheet-border":"rgba(255, 255, 255, 0.14)","sheet-blur":"24px"},Oc=[{width:1.1,color:"#fff",opacity:0.45,points:"M462 375h0M252 311h0M202 477h0M298 443h0M208 600h0M167 216h0M541 306h0M47 605h0M401 38h0M101 610h0M620 113h0M189 63h0M293 536h0M199 606h0M241 266h0M82 304h0M52 6h0M50 137h0M104 532h0M103 368h0M278 199h0M245 328h0M51 59h0M194 68h0M37 219h0M322 310h0M339 230h0M552 48h0M576 155h0M612 480h0"},{width:1.5,color:"#e3e9ff",opacity:0.75,points:"M568 195h0M633 111h0M342 180h0M527 323h0M532 283h0M623 494h0M123 125h0M310 588h0M127 394h0M36 377h0M297 418h0M306 11h0M244 382h0M153 210h0M173 288h0M104 454h0"},{width:2.1,color:"#fff",opacity:0.95,points:"M221 502h0M523 249h0M489 393h0M633 604h0M173 467h0M218 505h0"},{width:1.5,color:"#ffe7c7",opacity:0.8,points:"M382 480h0M367 90h0M103 79h0M497 64h0M339 614h0M541 446h0"}],Sc=()=>`url("data:image/svg+xml,${`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='640'>${Oc.map((n)=>`<path d='${n.points}' stroke='${n.color}' stroke-opacity='${n.opacity}' stroke-width='${n.width}' stroke-linecap='round'/>`).join("")}</svg>`.replace(/</g,"%3C").replace(/>/g,"%3E").replace(/#/g,"%23")}") 0 0 / 640px 640px`,Mc={...Ct,surface:"#05060E","surface-pattern":[Sc(),"radial-gradient(80% 60% at 78% 16%, rgba(98, 70, 214, 0.26), transparent 70%)","radial-gradient(70% 55% at 14% 88%, rgba(16, 150, 160, 0.16), transparent 70%)"].join(", "),"label-shadow":"0 1px 2px rgba(0, 0, 0, 0.45)",text:"#E7E9F7","muted-text":"#9CA3C4","root-text":"#1A1206","node-text":"#14102B","node-text-inverse":"#FFFFFF","color-root":"#FFC75A","color-1":"#285CC2","color-2":"#863CA4","color-3":"#A42C71","color-4":"#017272","color-5":"#0B7643","color-6":"#A14206","color-7":"#5D4DBE","shade-light":"#4B4F7A","shade-dark":"#05060E","moon-opacity":"1","node-highlight":"rgba(255, 244, 214, 0.1)","node-terminator":"rgba(5, 6, 14, 0.28)","node-shading":"rgba(5, 6, 14, 0.6)","node-stroke":"rgba(255, 255, 255, 0.6)","node-stroke-tint":"50%","badge-stroke":"#05060E","node-shadow-opacity":"0.4","node-shadow-size":"1.12","sun-shadow-opacity":"0.7","sun-shadow-size":"1.55","ring-stroke":"#8EA2FF","ring-tint":"20%","ring-opacity":"0.32","ring-width":"1","ring-dash":"none","link-stroke":"#8EA2FF","link-tint":"45%","link-opacity":"0.4","link-width":"1","focus-ring":"#A5B4FF","note-indicator":"#E7E9F7","control-background":"rgba(14, 16, 32, 0.8)","control-border":"rgba(142, 162, 255, 0.2)","control-text":"#E7E9F7","control-muted-text":"#9CA3C4","control-active-background":"#E7E9F7","control-active-text":"#05060E","control-shadow":"0 8px 24px rgba(0, 0, 0, 0.5)","control-blur":"14px","tooltip-background":"#E7E9F7","tooltip-text":"#05060E","action-background":"#14172B","action-border":"rgba(142, 162, 255, 0.28)","action-text":"#E7E9F7","action-shadow":"0 6px 16px rgba(0, 0, 0, 0.5)","sheet-background":"#0D0F1E","sheet-text":"#E7E9F7","sheet-muted-text":"#9CA3C4","sheet-border":"rgba(142, 162, 255, 0.16)","sheet-backdrop":"rgba(2, 3, 10, 0.65)","sheet-shadow":"0 24px 64px rgba(0, 0, 0, 0.65)","chip-background":"rgba(142, 162, 255, 0.14)","chip-text":"#DDE3FF","link-text":"#A5B4FF"},Ec={...Ct,"font-family":"var(--_orbit-mono-font)","label-weight":"500","display-weight":"600","label-letter-spacing":"-0.02em","label-shadow":"none",surface:"#123A7A","surface-pattern":["linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px) 0 0 / 120px 120px","linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px) 0 0 / 120px 120px","linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px) 0 0 / 24px 24px","linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px) 0 0 / 24px 24px"].join(", "),text:"#FFFFFF","muted-text":"rgba(255, 255, 255, 0.72)","root-text":"#FFFFFF","node-text":"#FFFFFF","node-text-inverse":"#FFFFFF","color-root":"#FFFFFF","color-1":"#C2F3F5","color-2":"#CCF3DD","color-3":"#D4ECFD","color-4":"#EBE3FC","color-5":"#FFE2CA","color-6":"#FEDEEC","color-7":"#C2F3F2","shade-light":"#FFFFFF","shade-dark":"#123A7A","node-fill-opacity":"0.12","moon-opacity":"0.12","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(18, 58, 122, 0)","node-shading":"rgba(18, 58, 122, 0)","node-stroke":"#FFFFFF","node-stroke-tint":"30%","node-stroke-width":"1.5","badge-stroke":"#123A7A","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.7","sun-halo-width":"1","sun-halo-dash":"4 4","sun-halo-size":"1.2","ring-stroke":"#FFFFFF","ring-tint":"0%","ring-opacity":"0.5","ring-width":"1","ring-dash":"7 5","link-stroke":"#FFFFFF","link-tint":"0%","link-opacity":"0.55","link-width":"1","focus-ring":"#FFD166","note-indicator":"#FFFFFF","control-background":"rgba(14, 45, 99, 0.9)","control-border":"rgba(255, 255, 255, 0.32)","control-text":"#FFFFFF","control-muted-text":"rgba(255, 255, 255, 0.72)","control-active-background":"#FFFFFF","control-active-text":"#123A7A","control-shadow":"none","control-blur":"0px","tooltip-background":"#FFFFFF","tooltip-text":"#123A7A","action-background":"#123A7A","action-border":"rgba(255, 255, 255, 0.6)","action-text":"#FFFFFF","action-shadow":"none","sheet-background":"#0F3470","sheet-text":"#FFFFFF","sheet-muted-text":"rgba(255, 255, 255, 0.75)","sheet-border":"rgba(255, 255, 255, 0.25)","sheet-backdrop":"rgba(5, 18, 42, 0.6)","sheet-shadow":"0 24px 64px rgba(0, 0, 0, 0.45)","chip-background":"rgba(255, 255, 255, 0.12)","chip-text":"#FFFFFF","link-text":"#BFE3FF","status-active":"#7CC4FF","status-done":"#7EE2A8","status-blocked":"#FF8A8A","status-todo":"rgba(255, 255, 255, 0.6)","status-neutral":"rgba(255, 255, 255, 0.75)","error-background":"#3A1622","error-border":"#FF8A8A","error-text":"#FFD7D7"},Nc={...gt,"label-font":"var(--_orbit-serif-font)","display-font":"var(--_orbit-serif-font)","label-weight":"600","display-weight":"600","label-letter-spacing":"0",text:"#111111","muted-text":"#55555F","root-text":"#111111","node-text":"#111111","color-root":"#111111","color-1":"#FFFFFF","color-2":"#F7F4EE","color-3":"#EEF2F6","color-4":"#F4F0F7","color-5":"#F1F5EF","color-6":"#F8F1EF","color-7":"#EFF4F4","shade-dark":"#111111","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(17, 17, 17, 0)","node-shading":"rgba(17, 17, 17, 0)","node-stroke":"#111111","node-stroke-tint":"0%","node-stroke-width":"1.5","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo":"#111111","sun-halo-tint":"0%","sun-halo-opacity":"1","sun-halo-width":"1","sun-halo-size":"1.12","ring-stroke":"#111111","ring-tint":"0%","ring-opacity":"0.6","ring-width":"1.5","ring-dash":"0.5 5","link-stroke":"#111111","link-tint":"0%","link-opacity":"0.7","link-width":"1","focus-ring":"#C81E1E","note-indicator":"#C81E1E","control-background":"rgba(255, 255, 255, 0.95)","control-border":"#111111","control-text":"#111111","control-muted-text":"#55555F","control-active-background":"#111111","control-active-text":"#FFFFFF","control-shadow":"2px 2px 0 #111111","control-blur":"0px","tooltip-background":"#111111","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"#111111","action-text":"#111111","action-shadow":"2px 2px 0 #111111","sheet-background":"#FFFFFF","sheet-text":"#111111","sheet-muted-text":"#55555F","sheet-border":"#111111","sheet-backdrop":"rgba(17, 17, 17, 0.35)","sheet-shadow":"6px 6px 0 #111111","chip-background":"#F3F1EC","chip-text":"#111111","link-text":"#C81E1E","status-active":"#1D4ED8","status-done":"#15803D","status-blocked":"#C81E1E","status-todo":"#9CA3AF","status-neutral":"#6B7280","error-background":"#FFF5F5","error-border":"#C81E1E","error-text":"#7A1414"},Tc={...gt,"label-weight":"700","display-weight":"800","label-letter-spacing":"0",surface:"#FFFFFF",text:"#000000","muted-text":"#3D3D3D","root-text":"#000000","node-text":"#000000","color-root":"#FFE066","color-1":"#FFA8A8","color-2":"#8CE99A","color-3":"#74C0FC","color-4":"#B197FC","color-5":"#FFC078","color-6":"#F783AC","color-7":"#63E6BE","shade-dark":"#FFFFFF","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(0, 0, 0, 0)","node-shading":"rgba(0, 0, 0, 0)","node-stroke":"#000000","node-stroke-tint":"0%","node-stroke-width":"2","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo-opacity":"0","ring-stroke":"#000000","ring-tint":"0%","ring-opacity":"0.7","ring-width":"1.5","ring-dash":"3 5","link-stroke":"#000000","link-tint":"0%","link-opacity":"0.8","link-width":"2","focus-ring":"#0040DD","note-indicator":"#000000","control-background":"#FFFFFF","control-border":"#000000","control-text":"#000000","control-muted-text":"#3D3D3D","control-active-background":"#000000","control-active-text":"#FFFFFF","control-shadow":"none","control-blur":"0px","tooltip-background":"#000000","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"#000000","action-text":"#000000","action-shadow":"none","sheet-background":"#FFFFFF","sheet-text":"#000000","sheet-muted-text":"#3D3D3D","sheet-border":"#000000","sheet-backdrop":"rgba(0, 0, 0, 0.6)","sheet-shadow":"none","chip-background":"#F0F0F0","chip-text":"#000000","link-text":"#0040DD","status-active":"#0040DD","status-done":"#007A33","status-blocked":"#C00000","status-todo":"#595959","status-neutral":"#3D3D3D","error-background":"#FFFFFF","error-border":"#C00000","error-text":"#7A0000"},Ts={...gt,"label-weight":"650","display-weight":"750","label-letter-spacing":"0",text:"#111827","muted-text":"#4B5563","root-text":"#111827","node-text":"#111827","node-text-inverse":"#FFFFFF","color-root":"#FFC233","color-1":"#C82F2C","color-2":"#007B3D","color-3":"#0C66D7","color-4":"#844DCC","color-5":"#AD5000","color-6":"#BE307D","color-7":"#007777","shade-dark":"#111827","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(17, 24, 39, 0)","node-shading":"rgba(17, 24, 39, 0)","node-stroke":"#FFFFFF","node-stroke-tint":"0%","node-stroke-width":"2","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo":"#111827","sun-halo-tint":"100%","sun-halo-opacity":"0.3","sun-halo-width":"6","sun-halo-dash":"none","sun-halo-size":"1.14","ring-stroke":"#111827","ring-tint":"0%","ring-opacity":"0.14","ring-width":"1.5","ring-dash":"none","link-stroke":"#111827","link-tint":"100%","link-opacity":"0.55","link-width":"2","link-dash":"none","focus-ring":"#0C66D7","note-indicator":"#111827","control-background":"#FFFFFF","control-border":"#E5E7EB","control-text":"#111827","control-muted-text":"#4B5563","control-active-background":"#111827","control-active-text":"#FFFFFF","control-shadow":"none","control-blur":"0px","tooltip-background":"#111827","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"#E5E7EB","action-text":"#111827","action-shadow":"none","sheet-background":"#FFFFFF","sheet-text":"#111827","sheet-muted-text":"#4B5563","sheet-border":"#E5E7EB","sheet-backdrop":"rgba(17, 24, 39, 0.5)","sheet-shadow":"none","chip-background":"#F3F4F6","chip-text":"#111827","link-text":"#0C66D7","status-active":"#0C66D7","status-done":"#007B3D","status-blocked":"#C82F2C","status-todo":"#9CA3AF","status-neutral":"#6B7280","error-background":"#FEF2F2","error-border":"#C82F2C","error-text":"#7F1D1D"},Fc={...Ts,surface:"#121418",text:"#F3F4F6","muted-text":"#9CA3AF","root-text":"#0B0D12","node-text":"#0B0D12","node-text-inverse":"#F3F4F6","color-root":"#FFD25A","color-1":"#FF9287","color-2":"#3EC873","color-3":"#7EB2FF","color-4":"#C29FFF","color-5":"#FF9657","color-6":"#FF8BC1","color-7":"#00C4C5","shade-dark":"#121418","node-stroke":"#121418","badge-stroke":"#121418","sun-halo":"#FFFFFF","sun-halo-opacity":"0.55","sun-halo-width":"4","ring-stroke":"#FFFFFF","link-stroke":"#FFFFFF","link-opacity":"0.6","focus-ring":"#7EB2FF","note-indicator":"#F3F4F6","control-background":"#1C1F26","control-border":"#2D3139","control-text":"#F3F4F6","control-muted-text":"#9CA3AF","control-active-background":"#F3F4F6","control-active-text":"#121418","tooltip-background":"#F3F4F6","tooltip-text":"#121418","action-background":"#1C1F26","action-border":"#2D3139","action-text":"#F3F4F6","sheet-background":"#1A1D23","sheet-text":"#F3F4F6","sheet-muted-text":"#9CA3AF","sheet-border":"#2D3139","sheet-backdrop":"rgba(0, 0, 0, 0.6)","chip-background":"#262A32","chip-text":"#E5E7EB","link-text":"#7EB2FF","status-active":"#7EB2FF","status-done":"#3EC873","status-blocked":"#FF9287","status-todo":"#6B7280","status-neutral":"#9CA3AF","error-background":"#2A1517","error-border":"#FF9287","error-text":"#FECACA"},Fs={"label-weight":"550","display-weight":"650","label-letter-spacing":"0","surface-pattern":"none","node-fill-opacity":"1","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(0, 0, 0, 0)","node-shading":"rgba(0, 0, 0, 0)","node-stroke-tint":"0%","node-stroke-width":"0","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo-tint":"0%","sun-halo-opacity":"0.18","sun-halo-width":"8","sun-halo-dash":"none","sun-halo-size":"1.16","ring-tint":"0%","ring-opacity":"1","ring-width":"1","ring-dash":"none","link-tint":"0%","link-opacity":"0.7","link-width":"1.5","link-dash":"none","control-border":"transparent","control-shadow":"0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15)","control-blur":"0px","action-border":"transparent","action-shadow":"0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15)","sheet-backdrop":"rgba(0, 0, 0, 0.32)","sheet-shadow":"0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15)","sheet-blur":"0px"},_c={...gt,...Fs,surface:"#FAF9FF",text:"#1C1B21","muted-text":"#484553","root-text":"#1C1B21","node-text":"#1C1B21","node-text-inverse":"#FFFFFF","color-root":"#6750A4","color-1":"#DFD8FF","color-2":"#FBD985","color-3":"#BCE1FF","color-4":"#FFD3C7","color-5":"#76F0EA","color-6":"#FFD0E9","color-7":"#B3EBA5","shade-light":"#C7C4D6","shade-dark":"#787585","node-stroke":"#C7C4D6","badge-stroke":"#FAF9FF","sun-halo":"#6750A4","ring-stroke":"#C7C4D6","link-stroke":"#787585","focus-ring":"#6750A4","note-indicator":"#6750A4","control-background":"#EEEDF6","control-text":"#1C1B21","control-muted-text":"#484553","control-active-background":"#E4DFFF","control-active-text":"#1D182F","tooltip-background":"#313036","tooltip-text":"#F1F0F9","action-background":"#E9E7F0","action-text":"#1C1B21","sheet-background":"#F4F2FB","sheet-text":"#1C1B21","sheet-muted-text":"#484553","sheet-border":"#C7C4D6","chip-background":"#E4DFFF","chip-text":"#1D182F","link-text":"#6750A4","status-active":"#6750A4","status-done":"#1C6D26","status-blocked":"#B91B25","status-todo":"#928F9F","status-neutral":"#787585","error-background":"#FFDAD6","error-border":"#B91B25","error-text":"#410004"},Cc={...Ct,...Fs,"control-shadow":"0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15)",surface:"#141318",text:"#E3E1EA","muted-text":"#C7C4D6","root-text":"#1C1B21","node-text":"#1C1B21","node-text-inverse":"#E3E1EA","color-root":"#CBBEFF","color-1":"#524084","color-2":"#5F4800","color-3":"#004F7B","color-4":"#7F341F","color-5":"#005552","color-6":"#78335D","color-7":"#245615","shade-light":"#5F5D65","shade-dark":"#201F25","node-stroke":"#484553","badge-stroke":"#141318","sun-halo":"#CBBEFF","ring-stroke":"#484553","link-stroke":"#928F9F","focus-ring":"#CBBEFF","note-indicator":"#CBBEFF","control-background":"#201F25","control-text":"#E3E1EA","control-muted-text":"#C7C4D6","control-active-background":"#49435D","control-active-text":"#E4DFFF","tooltip-background":"#E3E1EA","tooltip-text":"#313036","action-background":"#2A2930","action-text":"#E3E1EA","sheet-background":"#1C1B21","sheet-text":"#E3E1EA","sheet-muted-text":"#C7C4D6","sheet-border":"#484553","chip-background":"#49435D","chip-text":"#E4DFFF","link-text":"#CBBEFF","status-active":"#CBBEFF","status-done":"#8AD88D","status-blocked":"#FFB3AD","status-todo":"#928F9F","status-neutral":"#ACA9BA","error-background":"#930014","error-border":"#FFB3AD","error-text":"#FFDAD6"},Ac={...gt,"label-letter-spacing":"-0.01em",surface:"#E9EEF8","surface-pattern":["radial-gradient(70% 55% at 12% 14%, rgba(90, 140, 255, 0.55), transparent 70%)","radial-gradient(60% 50% at 88% 20%, rgba(255, 120, 190, 0.5), transparent 70%)","radial-gradient(70% 60% at 30% 92%, rgba(60, 220, 200, 0.45), transparent 72%)","radial-gradient(55% 45% at 92% 88%, rgba(255, 190, 90, 0.55), transparent 70%)"].join(", "),text:"#0F1630","muted-text":"#3B4560","root-text":"#0F1630","node-text":"#0F1630","node-text-inverse":"#0F1630","color-root":"#FFC83D","color-1":"#FF6B7A","color-2":"#2FD08A","color-3":"#4DA3FF","color-4":"#9B7BFF","color-5":"#FF9A3D","color-6":"#FF6FB5","color-7":"#22C7D6","shade-dark":"#0F1630","node-fill-opacity":"0.32","moon-opacity":"0.28","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(16, 24, 60, 0.07)","node-shading":"rgba(255, 255, 255, 0.95)","node-shade-circle":"0.53 0.55 0.56","node-stroke":"#FFFFFF","node-stroke-tint":"0%","node-stroke-width":"1.25","node-shadow":"#1B2550","node-shadow-tint":"0%","node-shadow-opacity":"0.16","node-shadow-offset":"0.14","node-shadow-size":"1","sun-shadow-opacity":"0.2","sun-shadow-size":"1.02","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.9","sun-halo-width":"1.5","sun-halo-dash":"none","sun-halo-size":"1.1","ring-stroke":"#FFFFFF","ring-tint":"0%","ring-opacity":"0.7","ring-width":"1.25","ring-dash":"none","link-stroke":"#FFFFFF","link-tint":"0%","link-opacity":"0.75","link-dash":"none","note-indicator":"#0F1630","control-background":"rgba(255, 255, 255, 0.38)","control-border":"rgba(255, 255, 255, 0.75)","control-text":"#0F1630","control-muted-text":"#3B4560","control-active-background":"rgba(255, 255, 255, 0.85)","control-active-text":"#0F1630","control-shadow":"0 10px 30px rgba(20, 30, 70, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9)","control-blur":"24px","tooltip-background":"rgba(255, 255, 255, 0.88)","tooltip-text":"#0F1630","action-background":"rgba(255, 255, 255, 0.55)","action-border":"rgba(255, 255, 255, 0.85)","action-text":"#0F1630","action-shadow":"0 6px 18px rgba(20, 30, 70, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9)","sheet-background":"rgba(255, 255, 255, 0.7)","sheet-text":"#0F1630","sheet-muted-text":"#3B4560","sheet-border":"rgba(255, 255, 255, 0.8)","sheet-backdrop":"rgba(15, 22, 48, 0.25)","sheet-shadow":"0 30px 80px rgba(20, 30, 70, 0.3)","sheet-blur":"30px","chip-background":"rgba(255, 255, 255, 0.6)","chip-text":"#1E293B","link-text":"#1D4ED8"},Ic={...Ct,"label-letter-spacing":"-0.01em","label-shadow":"0 1px 3px rgba(3, 6, 20, 0.6)",surface:"#070B1A","surface-pattern":["radial-gradient(70% 55% at 14% 12%, rgba(79, 70, 229, 0.55), transparent 70%)","radial-gradient(60% 50% at 88% 22%, rgba(219, 39, 119, 0.42), transparent 70%)","radial-gradient(70% 60% at 26% 94%, rgba(6, 182, 212, 0.36), transparent 72%)","radial-gradient(55% 45% at 92% 90%, rgba(249, 115, 22, 0.32), transparent 70%)"].join(", "),text:"#F5F7FF","muted-text":"#B4BDD8","root-text":"#F8FAFF","node-text":"#F8FAFF","node-text-inverse":"#F8FAFF","color-root":"#FFD66B","color-1":"#FF6B8B","color-2":"#34D399","color-3":"#60A5FA","color-4":"#A78BFA","color-5":"#FB923C","color-6":"#F472B6","color-7":"#22D3EE","shade-dark":"#070B1A","node-fill-opacity":"0.2","moon-opacity":"0.16","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(255, 255, 255, 0.04)","node-shading":"rgba(255, 255, 255, 0.7)","node-shade-circle":"0.53 0.55 0.56","node-stroke":"rgba(255, 255, 255, 0.75)","node-stroke-tint":"0%","node-stroke-width":"1.25","badge-stroke":"#070B1A","node-shadow-opacity":"0.3","node-shadow-size":"1.1","sun-shadow-opacity":"0.45","sun-shadow-size":"1.3","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.6","sun-halo-width":"1.5","sun-halo-dash":"none","sun-halo-size":"1.1","ring-tint":"0%","ring-opacity":"0.28","ring-width":"1.25","ring-dash":"none","link-tint":"0%","link-opacity":"0.35","link-dash":"none","note-indicator":"#F5F7FF","control-background":"rgba(255, 255, 255, 0.1)","control-border":"rgba(255, 255, 255, 0.22)","control-text":"#F5F7FF","control-muted-text":"#B4BDD8","control-active-background":"rgba(255, 255, 255, 0.9)","control-active-text":"#070B1A","control-shadow":"0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25)","control-blur":"24px","tooltip-background":"rgba(245, 247, 255, 0.92)","tooltip-text":"#070B1A","action-background":"rgba(255, 255, 255, 0.12)","action-border":"rgba(255, 255, 255, 0.28)","action-text":"#F5F7FF","action-shadow":"0 6px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25)","sheet-background":"rgba(22, 28, 52, 0.72)","sheet-text":"#F5F7FF","sheet-muted-text":"#B4BDD8","sheet-border":"rgba(255, 255, 255, 0.18)","sheet-backdrop":"rgba(2, 4, 14, 0.5)","sheet-shadow":"0 30px 80px rgba(0, 0, 0, 0.6)","sheet-blur":"30px","chip-background":"rgba(255, 255, 255, 0.12)","chip-text":"#E8ECFF"},Qt={paper:gt,night:Ct,glass:wc,"glass-night":kc,cosmos:Mc,blueprint:Ec,ink:Nc,contrast:Tc,flat:Ts,"flat-night":Fc,material:_c,"material-night":Cc,liquid:Ac,"liquid-night":Ic},Lc=new Set(["night","glass-night","cosmos","blueprint","flat-night","material-night","liquid-night"]),_s=(t)=>typeof t==="string"&&(t==="auto"||Object.prototype.hasOwnProperty.call(Qt,t)),Cs=(t)=>{let e=rr(t),n=typeof e==="string"?e:e?.preset;return _s(n)?n:"paper"},ir=new Map;var Ne=(t)=>_s(t)||typeof t==="string"&&ir.has(t),Te=()=>[...Object.keys(Qt),"auto",...ir.keys()],rr=(t)=>{let e=t;for(let n=0;n<4;n+=1){let i=typeof e==="string"?e:e?.preset,r=i===void 0?void 0:ir.get(i);if(!r)break;e=typeof e==="string"?r:{preset:r.preset,tokens:{...r.tokens,...e?.tokens}}}return e},As=(t,e)=>{if(e===void 0||typeof e==="string"||e.preset!==void 0||t===void 0)return e??t;let n=typeof t==="string"?t:t.preset;return n===void 0?e:{...e,preset:n}};var Dc=(t)=>{let e=t??"paper";return{...Qt[e==="auto"?"paper":e]}},or=(t,e,n={})=>Pc({...Dc(t),...Ls(e),...n}),Pc=(t)=>{let e={},n=(i,r)=>{if(r>4||!i.includes("var("))return i;let o=i.replace(/var\(--_?orbit-([a-z0-9-]+)(?:\s*,\s*([^()]+))?\)/gi,(s,a,l)=>t[a]??l?.trim()??s);return o===i?i:n(o,r+1)};for(let[i,r]of Object.entries(t))e[i]=n(r,0);return e},er=(t)=>yn.map((e)=>`--_orbit-${e}:var(--orbit-${e},${t[e]});`).join(""),Rc=[{paints:".orbit-node__shade{stroke:",base:"node-stroke",tint:"node-stroke-tint",own:"var(--orbit-node-color,var(--_orbit-node-stroke))"},{paints:".orbit-node__shadow{fill:",base:"node-shadow",tint:"node-shadow-tint",own:"var(--orbit-node-color)"},{paints:".orbit-node__halo{stroke:",base:"sun-halo",tint:"sun-halo-tint",own:"var(--orbit-node-color)"},{paints:".orbit-ring{stroke:",base:"ring-stroke",tint:"ring-tint",own:"var(--orbit-ring-color,var(--_orbit-ring-stroke))"},{paints:".orbit-link{stroke:",base:"link-stroke",tint:"link-tint",own:"var(--orbit-link-color,var(--_orbit-link-stroke))"}],nr=(t,e)=>Rc.map((n)=>`${t} ${n.paints}${parseFloat(e[n.tint])>=75?n.own:`var(--_orbit-${n.base})`}}`).join(""),Is=()=>{let t=Object.keys(Qt),e=t.map((r)=>`.orbit[data-orbit-theme="${r}"]{${er(Qt[r])}color-scheme:${Lc.has(r)?"dark":"light"};}`).join(""),n=`.orbit[data-orbit-theme="auto"]{${er(gt)}color-scheme:light;}@media (prefers-color-scheme: dark){.orbit[data-orbit-theme="auto"]{${er(Ct)}color-scheme:dark;}}`,i=t.map((r)=>nr(`.orbit[data-orbit-theme="${r}"]`,Qt[r])).join("")+nr('.orbit[data-orbit-theme="auto"]',gt)+`@media (prefers-color-scheme: dark){${nr('.orbit[data-orbit-theme="auto"]',Ct)}}`;return e+n+`@supports not (color: color-mix(in srgb, red, blue)){${i}}`},$c=["color-root","color-1","color-2","color-3","color-4","color-5","color-6","color-7"],Bc=new Set(yn),Ls=(t)=>{let e={};for(let[n,i]of Object.entries(t?.tokens??{}))if(Bc.has(n)&&typeof i==="string"&&i!=="")e[n]=i;return e},Ds=(t)=>{let e={};for(let[n,i]of Object.entries(Ls(t)))e[`--_orbit-${n}`]=`var(--orbit-${n}, ${i})`;return e},sr=(t)=>{if(t&&t.length>0)return[...t];return $c.map((e)=>`var(--_orbit-${e})`)};var At=new Set(["title","theme","view","showRings","interactive","animation","speed","palette","height","maxDepth","className","baseUrl","schemaVersion","flavor"]),Ps={viewMode:"view",mode:"view",rings:"showRings",depth:"maxDepth",colors:"palette",name:"title",orbitAnimation:"animation",orbitSpeed:"speed",class:"className"},Vc={dark:"night",light:"paper",default:"paper",frosted:"glass","glass-dark":"glass-night","dark-glass":"glass-night",space:"cosmos",stars:"cosmos","high-contrast":"contrast",monochrome:"ink",sketch:"ink",solid:"flat","flat-dark":"flat-night","dark-flat":"flat-night","material-you":"material","material-dark":"material-night","dark-material":"material-night","liquid-glass":"liquid","liquid-dark":"liquid-night","dark-liquid":"liquid-night","liquid-glass-night":"liquid-night"},vn=(t,e)=>{let n=e==="top-level"?[...At,"nodes"]:[...At];return`Unknown ${e} key "${t}" (ignored).${Wt(t,n,e==="top-level"?{...Ps,...zc}:Ps)}`},zc={root:"nodes",tree:"nodes",map:"nodes",children:"nodes",items:"nodes"},Hc=(t)=>{if(typeof t==="boolean")return t;let e=String(t).trim().toLowerCase();if(["true","yes","on","1"].includes(e))return!0;if(["false","no","off","0"].includes(e))return!1;return},xn=(t,e,n,i=()=>{return})=>{let r=(o)=>{let s=typeof n==="number"?n:Number(String(n).trim());if(Number.isFinite(s)&&s>=o&&String(n).trim()!=="")return s;i(`${e} must be a number${o>0?" above 0":" of 0 or more"}, got "${String(n)}".`);return};switch(e){case"view":if(n==="focus"||n==="all")t.viewMode=n;else i(`view must be "focus" or "all" (the overview), got "${String(n)}".${Wt(String(n),["focus","all"],{overview:"all",tree:"all",full:"all"})}`);return;case"palette":if(Array.isArray(n))t.palette=n.map(String);else if(typeof n==="string"&&n.trim()!=="")t.palette=n.split(",").map((o)=>o.trim()).filter(Boolean);else i('palette must be a list of colors, such as ["#F8D978", "#F5A3A8"].');return;case"showRings":case"interactive":case"animation":{let o=Hc(n);if(o===void 0){i(`${e} must be true or false, got "${String(n)}".`);return}if(e==="animation")t.orbitAnimation=o;else if(e==="interactive")t.interactive=o;else t.showRings=o;return}case"speed":case"height":case"schemaVersion":{let o=r(Number.MIN_VALUE);if(o!==void 0)t[e==="speed"?"orbitSpeed":e]=o;return}case"maxDepth":{let o=r(0);if(o!==void 0)t.maxDepth=o;return}case"theme":if(t.theme=String(n),!Ne(t.theme))i(`Unknown theme "${t.theme}". Themes: ${Te().join(", ")}.${Wt(t.theme,Te(),Vc)}`);return;case"title":case"className":case"baseUrl":if(n!==null&&n!==void 0)t[e]=String(n);return;case"flavor":if(n!=="markdown"&&n!=="yaml")i(`flavor must be "markdown" or "yaml", got "${String(n)}".`);return;default:return}},Rs=(t)=>{let e={};if(t.viewMode)e.viewMode=t.viewMode;if(t.showRings!==void 0)e.showRings=t.showRings;if(t.interactive!==void 0)e.interactive=t.interactive;if(t.orbitAnimation!==void 0)e.orbitAnimation=t.orbitAnimation;if(Number.isFinite(t.orbitSpeed))e.orbitSpeed=t.orbitSpeed;if(Number.isFinite(t.maxDepth))e.maxDepth=t.maxDepth;if(t.palette&&t.palette.length>0)e.palette=t.palette;if(Ne(t.theme))e.theme=t.theme;if(t.title)e.ariaLabel=t.title;if(t.baseUrl)e.baseUrl=t.baseUrl;return e};var Uc=[];var wn=(t,e,n,i=Uc)=>{let r=t.options.schemaVersion??1,o=Math.max(1,...i.map((a)=>a.from+1));if(r>o){e.recover("unsupported-schema-version",`This map is written for version ${r} of the format, and this version of Orbit reads up to ${o}. Everything in it is kept, but open it with a newer Orbit to change it.`,n,"error");return}let s=r;for(let a of i)if(a.from===s)a.upgrade(t),s+=1;if(s!==r)t.options.schemaVersion=s,e.note("format-upgraded",`Upgraded from version ${r} of the format to ${s}; saving writes it as version ${s}.`,n)};var cr="Untitled map",_e="untitled-map",$s=String.raw`(?:\p{Regional_Indicator}{2}|[0-9#*]️?⃣|(?![©®™])\p{Extended_Pictographic}️?\p{Emoji_Modifier}?)`,Gs=String.raw`${$s}(?:${$s})*`,Bs=new RegExp(String.raw`^((?:${Gs})+)\s+(.*)$`,"u"),jc=new RegExp(String.raw`^(?:${Gs})+$`,"u"),ur=(t)=>jc.test(t);var Wc=/^\[( |x|X|\/)\]\s+(.*)$/,Gc={" ":"todo",x:"done",X:"done","/":"active"},Kc=/\\([!-/:-@[-`{-~])/g,hr=1048576,Yc=/[\u{100000}-\u{10fffd}]/gu,qc=1114109-hr+1,Vs=/\s+#([\p{L}\p{N}_][\p{L}\p{N}_/-]*)$/u,Zc=/(`+)(?!`)([\s\S]*?[^`])\1(?!`)/g,Xc=/(!?)\[([^\]]*)\]\(\s*((?:[^\s()]|\([^\s()]*\))+)(?:\s+"[^"]*")?\s*\)/g,Jc=[/~~(?=\S)([\s\S]*?\S)~~/g,/\*\*(?=\S)([\s\S]*?\S)\*\*/g,/(?<![\p{L}\p{N}_])__(?=\S)([\s\S]*?\S)__(?![\p{L}\p{N}_])/gu,/\*(?=\S)([\s\S]*?\S)\*/g,/(?<![\p{L}\p{N}_])_(?=\S)([\s\S]*?\S)_(?![\p{L}\p{N}_])/gu],pr=(t)=>{let e=[],n=(d)=>{if(e.length>=qc)return d;return String.fromCodePoint(hr+e.push(d)-1)},i=t.trim().replace(Kc,(d,c)=>n(c));i=i.replace(Zs,(d,c,u,h)=>c||h?" ":"").trim();let r={},o=Wc.exec(i);if(o)r.status=Gc[o[1]],i=o[2].trim();let s=Bs.exec(i);if(s)r.icon=s[1],i=s[2].trim();let a=[];for(let d=Vs.exec(i);d&&/\p{L}/u.test(d[1]);d=Vs.exec(i))a.unshift(d[1]),i=i.slice(0,d.index);if(a.length>0)r.tags=a;i=i.replace(Zc,(d,c,u)=>n(u.replace(/^ ([\s\S]*) $/,"$1"))),i=i.replace(Xc,(d,c,u,h)=>{if(c)return d;return r.link??=zs(h,e),u});let l=r.icon?null:Bs.exec(i);if(l)r.icon=l[1],i=l[2].trim();for(let d=0;d<3;d+=1){let c=i;for(let u of Jc)i=i.replace(u,"$1");if(i===c)break}return{text:zs(i,e).trim(),...r}},zs=(t,e)=>{let n=t;for(let i=0;i<4;i+=1){let r=n.replace(Yc,(o)=>e[o.codePointAt(0)-hr]??o);if(r===n)break;n=r}return n},Qc=new Set(["image","video","embed","none"]),tu=/^ {0,3}(#{1,6})\s+(.*\S)\s*$/,Ks=/^ {0,3}#{1,6}\s+/,eu=/^ {0,3}(?:=+|-+)\s*$/,Sn=/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/,mr=/^(\s*)(?:[-*+]|\d{1,9}[.)])\s+(.*\S)\s*$/,nu=/^\s*(?:[-*+]|1[.)])\s+\S/,kn=/^\s*>/,br=/^ {0,3}(```|~~~)/,Ys=/^(.*\S)\s+<!--\s*orbit:?\s+([\s\S]*?)\s*-->\s*$/i,qs=/^()<!--\s*orbit:?\s+([\s\S]*?)\s*-->\s*$/i,Zs=/(\s*)(?<!\\)<!--([\s\S]*?)-->(\s*)/g,Xs=/^\[!\[([^\]]*)\]\(([^)]+)\)\]\(([^)]+)\)$/,Js=/^!\[([^\]]*)\]\(([^)]+)\)$/,Qs=/^\[([^\]]*)\]\(([^)]+)\)$/,Mn=(t,e={})=>{let n=new Ee(e.strict??!1),i=Zt(t).split(`
|
|
59
|
-
`),{options:r,extra:o,bodyStartIndex:s}=
|
|
60
|
-
`))},
|
|
61
|
-
`),line:o,last:t[i-1].line});continue}if(
|
|
62
|
-
`+t[i].text,i+=1,t[i-1].text.trimStart().startsWith(d[1]))break;n.push({kind:"paragraph",text:h,line:o,last:t[i-1].line});continue}let c=r;i+=1;let u=!1;while(i<t.length){let h=t[i].text;if(e.headings&&
|
|
63
|
-
`).map((p)=>p.trim()).join(" "),o,t[i].line,!0)),i+=1,u=!0;break}if(
|
|
64
|
-
`+h,i+=1}if(!u)n.push({kind:"paragraph",text:c,line:o,last:t[i-1].line})}return n},
|
|
65
|
-
`+t[i].text,i+=1;let o=/<!--\s*([\s\S]*?)\s*-->/.exec(r);if(o&&/^orbit(?::|\b)/i.test(o[1])){let s=/^orbit:?[^\S\n]*\n/i.test(o[1]),a=o[1].replace(/^orbit:?[^\S\n]*\n?/i,"");n.push({kind:"comment",body:
|
|
57
|
+
`)},de=(t)=>t.findIndex((e)=>e.trim()!==""),ce=(t)=>{let e=de(t);if(e===-1||t[e].trim()!=="---")return null;for(let n=e+1;n<t.length;n+=1)if(t[n].trim()==="---")return{yaml:t.slice(e+1,n).join(`
|
|
58
|
+
`),openIndex:e,closeIndex:n};return null},Lt=(t,e,n=0,i=t.length)=>{let r=new RegExp(`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*:`);for(let o=n;o<i;o+=1)if(r.test(t[o]))return o+1;return};var Bn=["sans-font","serif-font","mono-font","font-family","label-font","display-font","label-weight","display-weight","label-letter-spacing","label-shadow","surface","surface-pattern","text","muted-text","root-text","node-text","node-text-inverse","color-root","color-1","color-2","color-3","color-4","color-5","color-6","color-7","shade-light","shade-dark","node-fill-opacity","moon-opacity","node-highlight","node-terminator","node-shading","node-shade-circle","node-stroke","node-stroke-tint","node-stroke-width","badge-stroke","node-shadow","node-shadow-tint","node-shadow-opacity","node-shadow-offset","node-shadow-size","sun-shadow-opacity","sun-shadow-size","sun-halo","sun-halo-tint","sun-halo-opacity","sun-halo-width","sun-halo-dash","sun-halo-size","ring-stroke","ring-tint","ring-opacity","ring-width","ring-dash","link-stroke","link-tint","link-opacity","link-width","link-dash","focus-ring","note-indicator","control-background","control-border","control-text","control-muted-text","control-active-background","control-active-text","control-shadow","control-blur","tooltip-background","tooltip-text","action-background","action-border","action-text","action-shadow","sheet-background","sheet-text","sheet-muted-text","sheet-border","sheet-backdrop","sheet-shadow","sheet-blur","chip-background","chip-text","link-text","status-active","status-done","status-blocked","status-todo","status-neutral","error-background","error-border","error-text"];var St={"sans-font":'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif',"serif-font":'ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, "Times New Roman", serif',"mono-font":'ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace',"font-family":"var(--_orbit-sans-font)","label-font":"var(--_orbit-font-family)","display-font":"var(--_orbit-font-family)","label-weight":"600","display-weight":"650","label-letter-spacing":"-0.005em","label-shadow":"none",surface:"transparent","surface-pattern":"none",text:"#1F2733","muted-text":"#5B6474","root-text":"#1F2733","node-text":"#1F2733","node-text-inverse":"#FFFFFF","color-root":"#FAD86F","color-1":"#FEBAB6","color-2":"#99E0BA","color-3":"#9ED5FD","color-4":"#D6C2FE","color-5":"#F9C191","color-6":"#FCB6D6","color-7":"#82E1E0","shade-light":"#FFFFFF","shade-dark":"#1F2733","node-fill-opacity":"1","moon-opacity":"0.94","node-highlight":"rgba(255, 255, 255, 0.55)","node-terminator":"rgba(31, 39, 51, 0)","node-shading":"rgba(31, 39, 51, 0.12)","node-shade-circle":"0.34 0.3 0.78","node-stroke":"#1F2733","node-stroke-tint":"78%","node-stroke-width":"1","badge-stroke":"#FFFFFF","node-shadow":"#1F2733","node-shadow-tint":"45%","node-shadow-opacity":"0.26","node-shadow-offset":"0.16","node-shadow-size":"0.96","sun-shadow-opacity":"0.3","sun-shadow-size":"0.98","sun-halo":"#1F2733","sun-halo-tint":"72%","sun-halo-opacity":"0.55","sun-halo-width":"1","sun-halo-dash":"none","sun-halo-size":"1.15","ring-stroke":"#1F2733","ring-tint":"35%","ring-opacity":"0.4","ring-width":"1.5","ring-dash":"1 6","link-stroke":"#1F2733","link-tint":"60%","link-opacity":"0.45","link-width":"1.5","link-dash":"none","focus-ring":"#2563EB","note-indicator":"#1F2733","control-background":"rgba(255, 255, 255, 0.92)","control-border":"rgba(31, 39, 51, 0.12)","control-text":"#1F2733","control-muted-text":"#5B6474","control-active-background":"#1F2733","control-active-text":"#FFFFFF","control-shadow":"0 6px 20px rgba(31, 39, 51, 0.12)","control-blur":"12px","tooltip-background":"#1F2733","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"rgba(31, 39, 51, 0.16)","action-text":"#1F2733","action-shadow":"0 6px 16px rgba(31, 39, 51, 0.18)","sheet-background":"#FFFFFF","sheet-text":"#1F2733","sheet-muted-text":"#5B6474","sheet-border":"rgba(31, 39, 51, 0.12)","sheet-backdrop":"rgba(15, 23, 42, 0.45)","sheet-shadow":"0 24px 64px rgba(15, 23, 42, 0.28)","sheet-blur":"0px","chip-background":"#F1F5F9","chip-text":"#334155","link-text":"#2563EB","status-active":"#2563EB","status-done":"#16A34A","status-blocked":"#DC2626","status-todo":"#94A3B8","status-neutral":"#64748B","error-background":"#FFF6F5","error-border":"#E58A8A","error-text":"#7A1F1F"},Pt={...St,surface:"#0B1120","surface-pattern":"radial-gradient(120% 90% at 50% 42%, rgba(64, 84, 160, 0.26), transparent 70%)",text:"#E6EAF2","muted-text":"#97A3B6","root-text":"#0B1120","node-text":"#0B1120","color-root":"#FEDB6D","color-1":"#FFAAA7","color-2":"#80DAAC","color-3":"#86CDFF","color-4":"#CEB5FE","color-5":"#F8B478","color-6":"#FAA6CE","color-7":"#5EDADA","shade-dark":"#0B1120","node-highlight":"rgba(255, 255, 255, 0.45)","node-terminator":"rgba(11, 17, 32, 0)","node-shading":"rgba(11, 17, 32, 0.2)","node-stroke":"#FFFFFF","node-stroke-tint":"55%","badge-stroke":"#0B1120","node-shadow":"#FFFFFF","node-shadow-tint":"100%","node-shadow-opacity":"0.42","node-shadow-offset":"0","node-shadow-size":"1.16","sun-shadow-opacity":"0.5","sun-shadow-size":"1.4","sun-halo-opacity":"0","ring-stroke":"#FFFFFF","ring-tint":"55%","ring-opacity":"0.34","link-stroke":"#FFFFFF","link-tint":"70%","link-opacity":"0.36","focus-ring":"#93C5FD","note-indicator":"#E6EAF2","control-background":"rgba(20, 26, 44, 0.84)","control-border":"rgba(148, 163, 184, 0.22)","control-text":"#E6EAF2","control-muted-text":"#97A3B6","control-active-background":"#E6EAF2","control-active-text":"#0B1120","control-shadow":"0 8px 24px rgba(0, 0, 0, 0.4)","tooltip-background":"#E6EAF2","tooltip-text":"#0B1120","action-background":"#1B2338","action-border":"rgba(148, 163, 184, 0.3)","action-text":"#E6EAF2","action-shadow":"0 6px 16px rgba(0, 0, 0, 0.45)","sheet-background":"#131A2E","sheet-text":"#E6EAF2","sheet-muted-text":"#97A3B6","sheet-border":"rgba(148, 163, 184, 0.2)","sheet-backdrop":"rgba(2, 6, 23, 0.6)","sheet-shadow":"0 24px 64px rgba(0, 0, 0, 0.6)","chip-background":"rgba(148, 163, 184, 0.16)","chip-text":"#E2E8F0","link-text":"#93C5FD","status-active":"#60A5FA","status-done":"#4ADE80","status-blocked":"#F87171","status-neutral":"#94A3B8","error-background":"#2A1215","error-border":"#F87171","error-text":"#FECACA"},iu={...St,surface:"#E7EAF8","surface-pattern":["radial-gradient(60% 50% at 16% 18%, rgba(196, 181, 253, 0.75), transparent 70%)","radial-gradient(55% 48% at 86% 24%, rgba(251, 207, 232, 0.85), transparent 70%)","radial-gradient(65% 55% at 52% 96%, rgba(153, 246, 228, 0.7), transparent 70%)","radial-gradient(40% 40% at 90% 85%, rgba(191, 219, 254, 0.8), transparent 70%)"].join(", "),text:"#16213A","muted-text":"#414C66","root-text":"#16213A","node-text":"#16213A","color-root":"#FEEEBD","color-1":"#FED6D4","color-2":"#B6F1D0","color-3":"#C7E6FD","color-4":"#E6DAFE","color-5":"#FDDABD","color-6":"#FFD3E6","color-7":"#A5F2F1","shade-dark":"#16213A","node-fill-opacity":"0.55","moon-opacity":"0.5","node-highlight":"rgba(255, 255, 255, 0.85)","node-terminator":"rgba(22, 33, 58, 0)","node-shading":"rgba(22, 33, 58, 0.08)","node-stroke":"rgba(255, 255, 255, 0.92)","node-stroke-tint":"0%","node-stroke-width":"1.5","node-shadow":"#16213A","node-shadow-tint":"25%","node-shadow-opacity":"0.18","node-shadow-offset":"0.18","node-shadow-size":"0.98","sun-shadow-opacity":"0.22","sun-shadow-size":"1","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.7","sun-halo-width":"1.5","sun-halo-size":"1.13","ring-stroke":"#FFFFFF","ring-tint":"0%","ring-opacity":"0.85","link-stroke":"#FFFFFF","link-tint":"0%","link-opacity":"0.8","note-indicator":"#16213A","control-background":"rgba(255, 255, 255, 0.42)","control-border":"rgba(255, 255, 255, 0.62)","control-text":"#16213A","control-muted-text":"#414C66","control-active-background":"rgba(255, 255, 255, 0.78)","control-active-text":"#16213A","control-shadow":"0 8px 28px rgba(28, 44, 72, 0.18)","control-blur":"18px","tooltip-background":"rgba(255, 255, 255, 0.86)","tooltip-text":"#16213A","action-background":"rgba(255, 255, 255, 0.62)","action-border":"rgba(255, 255, 255, 0.78)","action-text":"#16213A","action-shadow":"0 6px 18px rgba(28, 44, 72, 0.2)","sheet-background":"rgba(255, 255, 255, 0.8)","sheet-text":"#16213A","sheet-muted-text":"#414C66","sheet-border":"rgba(255, 255, 255, 0.7)","sheet-backdrop":"rgba(18, 28, 45, 0.32)","sheet-shadow":"0 24px 70px rgba(28, 44, 72, 0.3)","sheet-blur":"24px","chip-background":"rgba(255, 255, 255, 0.6)"},ru={...Pt,surface:"#0E1326","surface-pattern":["radial-gradient(60% 50% at 18% 16%, rgba(99, 102, 241, 0.42), transparent 70%)","radial-gradient(55% 50% at 86% 78%, rgba(219, 39, 119, 0.3), transparent 70%)","radial-gradient(45% 40% at 74% 12%, rgba(20, 184, 166, 0.26), transparent 70%)"].join(", "),"label-shadow":"0 1px 3px rgba(5, 8, 20, 0.55)",text:"#F4F6FF","muted-text":"#A9B2D0","root-text":"#F4F6FF","node-text":"#F4F6FF","node-text-inverse":"#F4F6FF","color-root":"#F8DC86","color-1":"#FFAAA7","color-2":"#6FDEA7","color-3":"#86CDFF","color-4":"#CEB5FE","color-5":"#FEB16B","color-6":"#FFA3CF","color-7":"#36DEDE","shade-dark":"#0E1326","node-fill-opacity":"0.16","moon-opacity":"0.14","node-highlight":"rgba(255, 255, 255, 0.1)","node-terminator":"rgba(14, 19, 38, 0)","node-shading":"rgba(14, 19, 38, 0.18)","node-stroke":"rgba(255, 255, 255, 0.6)","node-stroke-tint":"45%","node-stroke-width":"1.5","node-shadow-opacity":"0.3","node-shadow-size":"1.14","sun-shadow-opacity":"0.38","sun-shadow-size":"1.35","ring-tint":"20%","ring-opacity":"0.32","link-tint":"30%","link-opacity":"0.32","note-indicator":"#F4F6FF","control-background":"rgba(30, 38, 64, 0.5)","control-border":"rgba(255, 255, 255, 0.16)","control-text":"#F4F6FF","control-muted-text":"#A9B2D0","control-active-background":"#F4F6FF","control-active-text":"#0E1326","control-blur":"18px","tooltip-background":"rgba(244, 246, 255, 0.92)","tooltip-text":"#0E1326","action-background":"rgba(30, 38, 64, 0.62)","action-border":"rgba(255, 255, 255, 0.2)","action-text":"#F4F6FF","sheet-background":"rgba(24, 32, 56, 0.78)","sheet-text":"#F4F6FF","sheet-muted-text":"#A9B2D0","sheet-border":"rgba(255, 255, 255, 0.14)","sheet-blur":"24px"},ou=[{width:1.1,color:"#fff",opacity:0.45,points:"M462 375h0M252 311h0M202 477h0M298 443h0M208 600h0M167 216h0M541 306h0M47 605h0M401 38h0M101 610h0M620 113h0M189 63h0M293 536h0M199 606h0M241 266h0M82 304h0M52 6h0M50 137h0M104 532h0M103 368h0M278 199h0M245 328h0M51 59h0M194 68h0M37 219h0M322 310h0M339 230h0M552 48h0M576 155h0M612 480h0"},{width:1.5,color:"#e3e9ff",opacity:0.75,points:"M568 195h0M633 111h0M342 180h0M527 323h0M532 283h0M623 494h0M123 125h0M310 588h0M127 394h0M36 377h0M297 418h0M306 11h0M244 382h0M153 210h0M173 288h0M104 454h0"},{width:2.1,color:"#fff",opacity:0.95,points:"M221 502h0M523 249h0M489 393h0M633 604h0M173 467h0M218 505h0"},{width:1.5,color:"#ffe7c7",opacity:0.8,points:"M382 480h0M367 90h0M103 79h0M497 64h0M339 614h0M541 446h0"}],su=()=>`url("data:image/svg+xml,${`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='640'>${ou.map((n)=>`<path d='${n.points}' stroke='${n.color}' stroke-opacity='${n.opacity}' stroke-width='${n.width}' stroke-linecap='round'/>`).join("")}</svg>`.replace(/</g,"%3C").replace(/>/g,"%3E").replace(/#/g,"%23")}") 0 0 / 640px 640px`,au={...Pt,surface:"#05060E","surface-pattern":[su(),"radial-gradient(80% 60% at 78% 16%, rgba(98, 70, 214, 0.26), transparent 70%)","radial-gradient(70% 55% at 14% 88%, rgba(16, 150, 160, 0.16), transparent 70%)"].join(", "),"label-shadow":"0 1px 2px rgba(0, 0, 0, 0.45)",text:"#E7E9F7","muted-text":"#9CA3C4","root-text":"#1A1206","node-text":"#14102B","node-text-inverse":"#FFFFFF","color-root":"#FFC75A","color-1":"#285CC2","color-2":"#863CA4","color-3":"#A42C71","color-4":"#017272","color-5":"#0B7643","color-6":"#A14206","color-7":"#5D4DBE","shade-light":"#4B4F7A","shade-dark":"#05060E","moon-opacity":"1","node-highlight":"rgba(255, 244, 214, 0.1)","node-terminator":"rgba(5, 6, 14, 0.28)","node-shading":"rgba(5, 6, 14, 0.6)","node-stroke":"rgba(255, 255, 255, 0.6)","node-stroke-tint":"50%","badge-stroke":"#05060E","node-shadow-opacity":"0.4","node-shadow-size":"1.12","sun-shadow-opacity":"0.7","sun-shadow-size":"1.55","ring-stroke":"#8EA2FF","ring-tint":"20%","ring-opacity":"0.32","ring-width":"1","ring-dash":"none","link-stroke":"#8EA2FF","link-tint":"45%","link-opacity":"0.4","link-width":"1","focus-ring":"#A5B4FF","note-indicator":"#E7E9F7","control-background":"rgba(14, 16, 32, 0.8)","control-border":"rgba(142, 162, 255, 0.2)","control-text":"#E7E9F7","control-muted-text":"#9CA3C4","control-active-background":"#E7E9F7","control-active-text":"#05060E","control-shadow":"0 8px 24px rgba(0, 0, 0, 0.5)","control-blur":"14px","tooltip-background":"#E7E9F7","tooltip-text":"#05060E","action-background":"#14172B","action-border":"rgba(142, 162, 255, 0.28)","action-text":"#E7E9F7","action-shadow":"0 6px 16px rgba(0, 0, 0, 0.5)","sheet-background":"#0D0F1E","sheet-text":"#E7E9F7","sheet-muted-text":"#9CA3C4","sheet-border":"rgba(142, 162, 255, 0.16)","sheet-backdrop":"rgba(2, 3, 10, 0.65)","sheet-shadow":"0 24px 64px rgba(0, 0, 0, 0.65)","chip-background":"rgba(142, 162, 255, 0.14)","chip-text":"#DDE3FF","link-text":"#A5B4FF"},lu={...Pt,"font-family":"var(--_orbit-mono-font)","label-weight":"500","display-weight":"600","label-letter-spacing":"-0.02em","label-shadow":"none",surface:"#123A7A","surface-pattern":["linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px) 0 0 / 120px 120px","linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px) 0 0 / 120px 120px","linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px) 0 0 / 24px 24px","linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px) 0 0 / 24px 24px"].join(", "),text:"#FFFFFF","muted-text":"rgba(255, 255, 255, 0.72)","root-text":"#FFFFFF","node-text":"#FFFFFF","node-text-inverse":"#FFFFFF","color-root":"#FFFFFF","color-1":"#C2F3F5","color-2":"#CCF3DD","color-3":"#D4ECFD","color-4":"#EBE3FC","color-5":"#FFE2CA","color-6":"#FEDEEC","color-7":"#C2F3F2","shade-light":"#FFFFFF","shade-dark":"#123A7A","node-fill-opacity":"0.12","moon-opacity":"0.12","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(18, 58, 122, 0)","node-shading":"rgba(18, 58, 122, 0)","node-stroke":"#FFFFFF","node-stroke-tint":"30%","node-stroke-width":"1.5","badge-stroke":"#123A7A","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.7","sun-halo-width":"1","sun-halo-dash":"4 4","sun-halo-size":"1.2","ring-stroke":"#FFFFFF","ring-tint":"0%","ring-opacity":"0.5","ring-width":"1","ring-dash":"7 5","link-stroke":"#FFFFFF","link-tint":"0%","link-opacity":"0.55","link-width":"1","focus-ring":"#FFD166","note-indicator":"#FFFFFF","control-background":"rgba(14, 45, 99, 0.9)","control-border":"rgba(255, 255, 255, 0.32)","control-text":"#FFFFFF","control-muted-text":"rgba(255, 255, 255, 0.72)","control-active-background":"#FFFFFF","control-active-text":"#123A7A","control-shadow":"none","control-blur":"0px","tooltip-background":"#FFFFFF","tooltip-text":"#123A7A","action-background":"#123A7A","action-border":"rgba(255, 255, 255, 0.6)","action-text":"#FFFFFF","action-shadow":"none","sheet-background":"#0F3470","sheet-text":"#FFFFFF","sheet-muted-text":"rgba(255, 255, 255, 0.75)","sheet-border":"rgba(255, 255, 255, 0.25)","sheet-backdrop":"rgba(5, 18, 42, 0.6)","sheet-shadow":"0 24px 64px rgba(0, 0, 0, 0.45)","chip-background":"rgba(255, 255, 255, 0.12)","chip-text":"#FFFFFF","link-text":"#BFE3FF","status-active":"#7CC4FF","status-done":"#7EE2A8","status-blocked":"#FF8A8A","status-todo":"rgba(255, 255, 255, 0.6)","status-neutral":"rgba(255, 255, 255, 0.75)","error-background":"#3A1622","error-border":"#FF8A8A","error-text":"#FFD7D7"},du={...St,"label-font":"var(--_orbit-serif-font)","display-font":"var(--_orbit-serif-font)","label-weight":"600","display-weight":"600","label-letter-spacing":"0",text:"#111111","muted-text":"#55555F","root-text":"#111111","node-text":"#111111","color-root":"#111111","color-1":"#FFFFFF","color-2":"#F7F4EE","color-3":"#EEF2F6","color-4":"#F4F0F7","color-5":"#F1F5EF","color-6":"#F8F1EF","color-7":"#EFF4F4","shade-dark":"#111111","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(17, 17, 17, 0)","node-shading":"rgba(17, 17, 17, 0)","node-stroke":"#111111","node-stroke-tint":"0%","node-stroke-width":"1.5","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo":"#111111","sun-halo-tint":"0%","sun-halo-opacity":"1","sun-halo-width":"1","sun-halo-size":"1.12","ring-stroke":"#111111","ring-tint":"0%","ring-opacity":"0.6","ring-width":"1.5","ring-dash":"0.5 5","link-stroke":"#111111","link-tint":"0%","link-opacity":"0.7","link-width":"1","focus-ring":"#C81E1E","note-indicator":"#C81E1E","control-background":"rgba(255, 255, 255, 0.95)","control-border":"#111111","control-text":"#111111","control-muted-text":"#55555F","control-active-background":"#111111","control-active-text":"#FFFFFF","control-shadow":"2px 2px 0 #111111","control-blur":"0px","tooltip-background":"#111111","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"#111111","action-text":"#111111","action-shadow":"2px 2px 0 #111111","sheet-background":"#FFFFFF","sheet-text":"#111111","sheet-muted-text":"#55555F","sheet-border":"#111111","sheet-backdrop":"rgba(17, 17, 17, 0.35)","sheet-shadow":"6px 6px 0 #111111","chip-background":"#F3F1EC","chip-text":"#111111","link-text":"#C81E1E","status-active":"#1D4ED8","status-done":"#15803D","status-blocked":"#C81E1E","status-todo":"#9CA3AF","status-neutral":"#6B7280","error-background":"#FFF5F5","error-border":"#C81E1E","error-text":"#7A1414"},cu={...St,"label-weight":"700","display-weight":"800","label-letter-spacing":"0",surface:"#FFFFFF",text:"#000000","muted-text":"#3D3D3D","root-text":"#000000","node-text":"#000000","color-root":"#FFE066","color-1":"#FFA8A8","color-2":"#8CE99A","color-3":"#74C0FC","color-4":"#B197FC","color-5":"#FFC078","color-6":"#F783AC","color-7":"#63E6BE","shade-dark":"#FFFFFF","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(0, 0, 0, 0)","node-shading":"rgba(0, 0, 0, 0)","node-stroke":"#000000","node-stroke-tint":"0%","node-stroke-width":"2","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo-opacity":"0","ring-stroke":"#000000","ring-tint":"0%","ring-opacity":"0.7","ring-width":"1.5","ring-dash":"3 5","link-stroke":"#000000","link-tint":"0%","link-opacity":"0.8","link-width":"2","focus-ring":"#0040DD","note-indicator":"#000000","control-background":"#FFFFFF","control-border":"#000000","control-text":"#000000","control-muted-text":"#3D3D3D","control-active-background":"#000000","control-active-text":"#FFFFFF","control-shadow":"none","control-blur":"0px","tooltip-background":"#000000","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"#000000","action-text":"#000000","action-shadow":"none","sheet-background":"#FFFFFF","sheet-text":"#000000","sheet-muted-text":"#3D3D3D","sheet-border":"#000000","sheet-backdrop":"rgba(0, 0, 0, 0.6)","sheet-shadow":"none","chip-background":"#F0F0F0","chip-text":"#000000","link-text":"#0040DD","status-active":"#0040DD","status-done":"#007A33","status-blocked":"#C00000","status-todo":"#595959","status-neutral":"#3D3D3D","error-background":"#FFFFFF","error-border":"#C00000","error-text":"#7A0000"},sa={...St,"label-weight":"650","display-weight":"750","label-letter-spacing":"0",text:"#111827","muted-text":"#4B5563","root-text":"#111827","node-text":"#111827","node-text-inverse":"#FFFFFF","color-root":"#FFC233","color-1":"#C82F2C","color-2":"#007B3D","color-3":"#0C66D7","color-4":"#844DCC","color-5":"#AD5000","color-6":"#BE307D","color-7":"#007777","shade-dark":"#111827","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(17, 24, 39, 0)","node-shading":"rgba(17, 24, 39, 0)","node-stroke":"#FFFFFF","node-stroke-tint":"0%","node-stroke-width":"2","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo":"#111827","sun-halo-tint":"100%","sun-halo-opacity":"0.3","sun-halo-width":"6","sun-halo-dash":"none","sun-halo-size":"1.14","ring-stroke":"#111827","ring-tint":"0%","ring-opacity":"0.14","ring-width":"1.5","ring-dash":"none","link-stroke":"#111827","link-tint":"100%","link-opacity":"0.55","link-width":"2","link-dash":"none","focus-ring":"#0C66D7","note-indicator":"#111827","control-background":"#FFFFFF","control-border":"#E5E7EB","control-text":"#111827","control-muted-text":"#4B5563","control-active-background":"#111827","control-active-text":"#FFFFFF","control-shadow":"none","control-blur":"0px","tooltip-background":"#111827","tooltip-text":"#FFFFFF","action-background":"#FFFFFF","action-border":"#E5E7EB","action-text":"#111827","action-shadow":"none","sheet-background":"#FFFFFF","sheet-text":"#111827","sheet-muted-text":"#4B5563","sheet-border":"#E5E7EB","sheet-backdrop":"rgba(17, 24, 39, 0.5)","sheet-shadow":"none","chip-background":"#F3F4F6","chip-text":"#111827","link-text":"#0C66D7","status-active":"#0C66D7","status-done":"#007B3D","status-blocked":"#C82F2C","status-todo":"#9CA3AF","status-neutral":"#6B7280","error-background":"#FEF2F2","error-border":"#C82F2C","error-text":"#7F1D1D"},uu={...sa,surface:"#121418",text:"#F3F4F6","muted-text":"#9CA3AF","root-text":"#0B0D12","node-text":"#0B0D12","node-text-inverse":"#F3F4F6","color-root":"#FFD25A","color-1":"#FF9287","color-2":"#3EC873","color-3":"#7EB2FF","color-4":"#C29FFF","color-5":"#FF9657","color-6":"#FF8BC1","color-7":"#00C4C5","shade-dark":"#121418","node-stroke":"#121418","badge-stroke":"#121418","sun-halo":"#FFFFFF","sun-halo-opacity":"0.55","sun-halo-width":"4","ring-stroke":"#FFFFFF","link-stroke":"#FFFFFF","link-opacity":"0.6","focus-ring":"#7EB2FF","note-indicator":"#F3F4F6","control-background":"#1C1F26","control-border":"#2D3139","control-text":"#F3F4F6","control-muted-text":"#9CA3AF","control-active-background":"#F3F4F6","control-active-text":"#121418","tooltip-background":"#F3F4F6","tooltip-text":"#121418","action-background":"#1C1F26","action-border":"#2D3139","action-text":"#F3F4F6","sheet-background":"#1A1D23","sheet-text":"#F3F4F6","sheet-muted-text":"#9CA3AF","sheet-border":"#2D3139","sheet-backdrop":"rgba(0, 0, 0, 0.6)","chip-background":"#262A32","chip-text":"#E5E7EB","link-text":"#7EB2FF","status-active":"#7EB2FF","status-done":"#3EC873","status-blocked":"#FF9287","status-todo":"#6B7280","status-neutral":"#9CA3AF","error-background":"#2A1517","error-border":"#FF9287","error-text":"#FECACA"},aa={"label-weight":"550","display-weight":"650","label-letter-spacing":"0","surface-pattern":"none","node-fill-opacity":"1","moon-opacity":"1","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(0, 0, 0, 0)","node-shading":"rgba(0, 0, 0, 0)","node-stroke-tint":"0%","node-stroke-width":"0","node-shadow-opacity":"0","sun-shadow-opacity":"0","sun-halo-tint":"0%","sun-halo-opacity":"0.18","sun-halo-width":"8","sun-halo-dash":"none","sun-halo-size":"1.16","ring-tint":"0%","ring-opacity":"1","ring-width":"1","ring-dash":"none","link-tint":"0%","link-opacity":"0.7","link-width":"1.5","link-dash":"none","control-border":"transparent","control-shadow":"0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15)","control-blur":"0px","action-border":"transparent","action-shadow":"0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15)","sheet-backdrop":"rgba(0, 0, 0, 0.32)","sheet-shadow":"0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15)","sheet-blur":"0px"},hu={...St,...aa,surface:"#FAF9FF",text:"#1C1B21","muted-text":"#484553","root-text":"#1C1B21","node-text":"#1C1B21","node-text-inverse":"#FFFFFF","color-root":"#6750A4","color-1":"#DFD8FF","color-2":"#FBD985","color-3":"#BCE1FF","color-4":"#FFD3C7","color-5":"#76F0EA","color-6":"#FFD0E9","color-7":"#B3EBA5","shade-light":"#C7C4D6","shade-dark":"#787585","node-stroke":"#C7C4D6","badge-stroke":"#FAF9FF","sun-halo":"#6750A4","ring-stroke":"#C7C4D6","link-stroke":"#787585","focus-ring":"#6750A4","note-indicator":"#6750A4","control-background":"#EEEDF6","control-text":"#1C1B21","control-muted-text":"#484553","control-active-background":"#E4DFFF","control-active-text":"#1D182F","tooltip-background":"#313036","tooltip-text":"#F1F0F9","action-background":"#E9E7F0","action-text":"#1C1B21","sheet-background":"#F4F2FB","sheet-text":"#1C1B21","sheet-muted-text":"#484553","sheet-border":"#C7C4D6","chip-background":"#E4DFFF","chip-text":"#1D182F","link-text":"#6750A4","status-active":"#6750A4","status-done":"#1C6D26","status-blocked":"#B91B25","status-todo":"#928F9F","status-neutral":"#787585","error-background":"#FFDAD6","error-border":"#B91B25","error-text":"#410004"},pu={...Pt,...aa,"control-shadow":"0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15)",surface:"#141318",text:"#E3E1EA","muted-text":"#C7C4D6","root-text":"#1C1B21","node-text":"#1C1B21","node-text-inverse":"#E3E1EA","color-root":"#CBBEFF","color-1":"#524084","color-2":"#5F4800","color-3":"#004F7B","color-4":"#7F341F","color-5":"#005552","color-6":"#78335D","color-7":"#245615","shade-light":"#5F5D65","shade-dark":"#201F25","node-stroke":"#484553","badge-stroke":"#141318","sun-halo":"#CBBEFF","ring-stroke":"#484553","link-stroke":"#928F9F","focus-ring":"#CBBEFF","note-indicator":"#CBBEFF","control-background":"#201F25","control-text":"#E3E1EA","control-muted-text":"#C7C4D6","control-active-background":"#49435D","control-active-text":"#E4DFFF","tooltip-background":"#E3E1EA","tooltip-text":"#313036","action-background":"#2A2930","action-text":"#E3E1EA","sheet-background":"#1C1B21","sheet-text":"#E3E1EA","sheet-muted-text":"#C7C4D6","sheet-border":"#484553","chip-background":"#49435D","chip-text":"#E4DFFF","link-text":"#CBBEFF","status-active":"#CBBEFF","status-done":"#8AD88D","status-blocked":"#FFB3AD","status-todo":"#928F9F","status-neutral":"#ACA9BA","error-background":"#930014","error-border":"#FFB3AD","error-text":"#FFDAD6"},mu={...St,"label-letter-spacing":"-0.01em",surface:"#E9EEF8","surface-pattern":["radial-gradient(70% 55% at 12% 14%, rgba(90, 140, 255, 0.55), transparent 70%)","radial-gradient(60% 50% at 88% 20%, rgba(255, 120, 190, 0.5), transparent 70%)","radial-gradient(70% 60% at 30% 92%, rgba(60, 220, 200, 0.45), transparent 72%)","radial-gradient(55% 45% at 92% 88%, rgba(255, 190, 90, 0.55), transparent 70%)"].join(", "),text:"#0F1630","muted-text":"#3B4560","root-text":"#0F1630","node-text":"#0F1630","node-text-inverse":"#0F1630","color-root":"#FFC83D","color-1":"#FF6B7A","color-2":"#2FD08A","color-3":"#4DA3FF","color-4":"#9B7BFF","color-5":"#FF9A3D","color-6":"#FF6FB5","color-7":"#22C7D6","shade-dark":"#0F1630","node-fill-opacity":"0.32","moon-opacity":"0.28","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(16, 24, 60, 0.07)","node-shading":"rgba(255, 255, 255, 0.95)","node-shade-circle":"0.53 0.55 0.56","node-stroke":"#FFFFFF","node-stroke-tint":"0%","node-stroke-width":"1.25","node-shadow":"#1B2550","node-shadow-tint":"0%","node-shadow-opacity":"0.16","node-shadow-offset":"0.14","node-shadow-size":"1","sun-shadow-opacity":"0.2","sun-shadow-size":"1.02","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.9","sun-halo-width":"1.5","sun-halo-dash":"none","sun-halo-size":"1.1","ring-stroke":"#FFFFFF","ring-tint":"0%","ring-opacity":"0.7","ring-width":"1.25","ring-dash":"none","link-stroke":"#FFFFFF","link-tint":"0%","link-opacity":"0.75","link-dash":"none","note-indicator":"#0F1630","control-background":"rgba(255, 255, 255, 0.38)","control-border":"rgba(255, 255, 255, 0.75)","control-text":"#0F1630","control-muted-text":"#3B4560","control-active-background":"rgba(255, 255, 255, 0.85)","control-active-text":"#0F1630","control-shadow":"0 10px 30px rgba(20, 30, 70, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9)","control-blur":"24px","tooltip-background":"rgba(255, 255, 255, 0.88)","tooltip-text":"#0F1630","action-background":"rgba(255, 255, 255, 0.55)","action-border":"rgba(255, 255, 255, 0.85)","action-text":"#0F1630","action-shadow":"0 6px 18px rgba(20, 30, 70, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9)","sheet-background":"rgba(255, 255, 255, 0.7)","sheet-text":"#0F1630","sheet-muted-text":"#3B4560","sheet-border":"rgba(255, 255, 255, 0.8)","sheet-backdrop":"rgba(15, 22, 48, 0.25)","sheet-shadow":"0 30px 80px rgba(20, 30, 70, 0.3)","sheet-blur":"30px","chip-background":"rgba(255, 255, 255, 0.6)","chip-text":"#1E293B","link-text":"#1D4ED8"},bu={...Pt,"label-letter-spacing":"-0.01em","label-shadow":"0 1px 3px rgba(3, 6, 20, 0.6)",surface:"#070B1A","surface-pattern":["radial-gradient(70% 55% at 14% 12%, rgba(79, 70, 229, 0.55), transparent 70%)","radial-gradient(60% 50% at 88% 22%, rgba(219, 39, 119, 0.42), transparent 70%)","radial-gradient(70% 60% at 26% 94%, rgba(6, 182, 212, 0.36), transparent 72%)","radial-gradient(55% 45% at 92% 90%, rgba(249, 115, 22, 0.32), transparent 70%)"].join(", "),text:"#F5F7FF","muted-text":"#B4BDD8","root-text":"#F8FAFF","node-text":"#F8FAFF","node-text-inverse":"#F8FAFF","color-root":"#FFD66B","color-1":"#FF6B8B","color-2":"#34D399","color-3":"#60A5FA","color-4":"#A78BFA","color-5":"#FB923C","color-6":"#F472B6","color-7":"#22D3EE","shade-dark":"#070B1A","node-fill-opacity":"0.2","moon-opacity":"0.16","node-highlight":"rgba(255, 255, 255, 0)","node-terminator":"rgba(255, 255, 255, 0.04)","node-shading":"rgba(255, 255, 255, 0.7)","node-shade-circle":"0.53 0.55 0.56","node-stroke":"rgba(255, 255, 255, 0.75)","node-stroke-tint":"0%","node-stroke-width":"1.25","badge-stroke":"#070B1A","node-shadow-opacity":"0.3","node-shadow-size":"1.1","sun-shadow-opacity":"0.45","sun-shadow-size":"1.3","sun-halo":"#FFFFFF","sun-halo-tint":"0%","sun-halo-opacity":"0.6","sun-halo-width":"1.5","sun-halo-dash":"none","sun-halo-size":"1.1","ring-tint":"0%","ring-opacity":"0.28","ring-width":"1.25","ring-dash":"none","link-tint":"0%","link-opacity":"0.35","link-dash":"none","note-indicator":"#F5F7FF","control-background":"rgba(255, 255, 255, 0.1)","control-border":"rgba(255, 255, 255, 0.22)","control-text":"#F5F7FF","control-muted-text":"#B4BDD8","control-active-background":"rgba(255, 255, 255, 0.9)","control-active-text":"#070B1A","control-shadow":"0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25)","control-blur":"24px","tooltip-background":"rgba(245, 247, 255, 0.92)","tooltip-text":"#070B1A","action-background":"rgba(255, 255, 255, 0.12)","action-border":"rgba(255, 255, 255, 0.28)","action-text":"#F5F7FF","action-shadow":"0 6px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25)","sheet-background":"rgba(22, 28, 52, 0.72)","sheet-text":"#F5F7FF","sheet-muted-text":"#B4BDD8","sheet-border":"rgba(255, 255, 255, 0.18)","sheet-backdrop":"rgba(2, 4, 14, 0.5)","sheet-shadow":"0 30px 80px rgba(0, 0, 0, 0.6)","sheet-blur":"30px","chip-background":"rgba(255, 255, 255, 0.12)","chip-text":"#E8ECFF"},ue={paper:St,night:Pt,glass:iu,"glass-night":ru,cosmos:au,blueprint:lu,ink:du,contrast:cu,flat:sa,"flat-night":uu,material:hu,"material-night":pu,liquid:mu,"liquid-night":bu},fu=new Set(["night","glass-night","cosmos","blueprint","flat-night","material-night","liquid-night"]),la=(t)=>typeof t==="string"&&(t==="auto"||Object.prototype.hasOwnProperty.call(ue,t)),jt=(t)=>{let e=Wt(t),n=typeof e==="string"?e:e?.preset;return la(n)?n:"paper"},Nr=new Map;var je=(t)=>la(t)||typeof t==="string"&&Nr.has(t),We=()=>[...Object.keys(ue),"auto",...Nr.keys()],Wt=(t)=>{let e=t;for(let n=0;n<4;n+=1){let i=typeof e==="string"?e:e?.preset,r=i===void 0?void 0:Nr.get(i);if(!r)break;e=typeof e==="string"?r:{preset:r.preset,tokens:{...r.tokens,...e?.tokens}}}return e},he=(t,e)=>{if(e===void 0||typeof e==="string"||e.preset!==void 0||t===void 0)return e??t;let n=typeof t==="string"?t:t.preset;return n===void 0?e:{...e,preset:n}};var gu=(t)=>{let e=t??"paper";return{...ue[e==="auto"?"paper":e]}},Gt=(t,e,n={})=>yu({...gu(t),...ca(e),...n}),yu=(t)=>{let e={},n=(i,r)=>{if(r>4||!i.includes("var("))return i;let o=i.replace(/var\(--_?orbit-([a-z0-9-]+)(?:\s*,\s*([^()]+))?\)/gi,(s,a,l)=>t[a]??l?.trim()??s);return o===i?i:n(o,r+1)};for(let[i,r]of Object.entries(t))e[i]=n(r,0);return e},Mr=(t)=>Bn.map((e)=>`--_orbit-${e}:var(--orbit-${e},${t[e]});`).join(""),vu=[{paints:".orbit-node__shade{stroke:",base:"node-stroke",tint:"node-stroke-tint",own:"var(--orbit-node-color,var(--_orbit-node-stroke))"},{paints:".orbit-node__shadow{fill:",base:"node-shadow",tint:"node-shadow-tint",own:"var(--orbit-node-color)"},{paints:".orbit-node__halo{stroke:",base:"sun-halo",tint:"sun-halo-tint",own:"var(--orbit-node-color)"},{paints:".orbit-ring{stroke:",base:"ring-stroke",tint:"ring-tint",own:"var(--orbit-ring-color,var(--_orbit-ring-stroke))"},{paints:".orbit-link{stroke:",base:"link-stroke",tint:"link-tint",own:"var(--orbit-link-color,var(--_orbit-link-stroke))"}],Er=(t,e)=>vu.map((n)=>`${t} ${n.paints}${parseFloat(e[n.tint])>=75?n.own:`var(--_orbit-${n.base})`}}`).join(""),da=()=>{let t=Object.keys(ue),e=t.map((r)=>`.orbit[data-orbit-theme="${r}"]{${Mr(ue[r])}color-scheme:${fu.has(r)?"dark":"light"};}`).join(""),n=`.orbit[data-orbit-theme="auto"]{${Mr(St)}color-scheme:light;}@media (prefers-color-scheme: dark){.orbit[data-orbit-theme="auto"]{${Mr(Pt)}color-scheme:dark;}}`,i=t.map((r)=>Er(`.orbit[data-orbit-theme="${r}"]`,ue[r])).join("")+Er('.orbit[data-orbit-theme="auto"]',St)+`@media (prefers-color-scheme: dark){${Er('.orbit[data-orbit-theme="auto"]',Pt)}}`;return e+n+`@supports not (color: color-mix(in srgb, red, blue)){${i}}`},xu=["color-root","color-1","color-2","color-3","color-4","color-5","color-6","color-7"],wu=new Set(Bn),ca=(t)=>{let e={};for(let[n,i]of Object.entries(t?.tokens??{}))if(wu.has(n)&&typeof i==="string"&&i!=="")e[n]=i;return e},ua=(t)=>{let e={};for(let[n,i]of Object.entries(ca(t)))e[`--_orbit-${n}`]=`var(--orbit-${n}, ${i})`;return e},Dt=(t)=>{if(t&&t.length>0)return[...t];return xu.map((e)=>`var(--_orbit-${e})`)};var Rt=new Set(["title","theme","view","showRings","interactive","animation","speed","palette","height","maxDepth","className","baseUrl","schemaVersion","flavor"]),ha={viewMode:"view",mode:"view",rings:"showRings",depth:"maxDepth",colors:"palette",name:"title",orbitAnimation:"animation",orbitSpeed:"speed",class:"className"},ku={dark:"night",light:"paper",default:"paper",frosted:"glass","glass-dark":"glass-night","dark-glass":"glass-night",space:"cosmos",stars:"cosmos","high-contrast":"contrast",monochrome:"ink",sketch:"ink",solid:"flat","flat-dark":"flat-night","dark-flat":"flat-night","material-you":"material","material-dark":"material-night","dark-material":"material-night","liquid-glass":"liquid","liquid-dark":"liquid-night","dark-liquid":"liquid-night","liquid-glass-night":"liquid-night"},Vn=(t,e)=>{let n=e==="top-level"?[...Rt,"nodes"]:[...Rt];return`Unknown ${e} key "${t}" (ignored).${ie(t,n,e==="top-level"?{...ha,...Ou}:ha)}`},Ou={root:"nodes",tree:"nodes",map:"nodes",children:"nodes",items:"nodes"},Su=(t)=>{if(typeof t==="boolean")return t;let e=String(t).trim().toLowerCase();if(["true","yes","on","1"].includes(e))return!0;if(["false","no","off","0"].includes(e))return!1;return},Hn=(t,e,n,i=()=>{return})=>{let r=(o)=>{let s=typeof n==="number"?n:Number(String(n).trim());if(Number.isFinite(s)&&s>=o&&String(n).trim()!=="")return s;i(`${e} must be a number${o>0?" above 0":" of 0 or more"}, got "${String(n)}".`);return};switch(e){case"view":if(n==="focus"||n==="all")t.viewMode=n;else i(`view must be "focus" or "all" (the overview), got "${String(n)}".${ie(String(n),["focus","all"],{overview:"all",tree:"all",full:"all"})}`);return;case"palette":if(Array.isArray(n))t.palette=n.map(String);else if(typeof n==="string"&&n.trim()!=="")t.palette=n.split(",").map((o)=>o.trim()).filter(Boolean);else i('palette must be a list of colors, such as ["#F8D978", "#F5A3A8"].');return;case"showRings":case"interactive":case"animation":{let o=Su(n);if(o===void 0){i(`${e} must be true or false, got "${String(n)}".`);return}if(e==="animation")t.orbitAnimation=o;else if(e==="interactive")t.interactive=o;else t.showRings=o;return}case"speed":case"height":case"schemaVersion":{let o=r(Number.MIN_VALUE);if(o!==void 0)t[e==="speed"?"orbitSpeed":e]=o;return}case"maxDepth":{let o=r(0);if(o!==void 0)t.maxDepth=o;return}case"theme":if(t.theme=String(n),!je(t.theme))i(`Unknown theme "${t.theme}". Themes: ${We().join(", ")}.${ie(t.theme,We(),ku)}`);return;case"title":case"className":case"baseUrl":if(n!==null&&n!==void 0)t[e]=String(n);return;case"flavor":if(n!=="markdown"&&n!=="yaml")i(`flavor must be "markdown" or "yaml", got "${String(n)}".`);return;default:return}},pe=(t)=>{let e={};if(t.viewMode)e.viewMode=t.viewMode;if(t.showRings!==void 0)e.showRings=t.showRings;if(t.interactive!==void 0)e.interactive=t.interactive;if(t.orbitAnimation!==void 0)e.orbitAnimation=t.orbitAnimation;if(Number.isFinite(t.orbitSpeed))e.orbitSpeed=t.orbitSpeed;if(Number.isFinite(t.maxDepth))e.maxDepth=t.maxDepth;if(t.palette&&t.palette.length>0)e.palette=t.palette;if(je(t.theme))e.theme=t.theme;if(t.title)e.ariaLabel=t.title;if(t.baseUrl)e.baseUrl=t.baseUrl;return e};var Mu=[];var zn=(t,e,n,i=Mu)=>{let r=t.options.schemaVersion??1,o=Math.max(1,...i.map((a)=>a.from+1));if(r>o){e.recover("unsupported-schema-version",`This map is written for version ${r} of the format, and this version of Orbit reads up to ${o}. Everything in it is kept, but open it with a newer Orbit to change it.`,n,"error");return}let s=r;for(let a of i)if(a.from===s)a.upgrade(t),s+=1;if(s!==r)t.options.schemaVersion=s,e.note("format-upgraded",`Upgraded from version ${r} of the format to ${s}; saving writes it as version ${s}.`,n)};var Cr="Untitled map",Ye="untitled-map",pa=String.raw`(?:\p{Regional_Indicator}{2}|[0-9#*]️?⃣|(?![©®™])\p{Extended_Pictographic}️?\p{Emoji_Modifier}?)`,wa=String.raw`${pa}(?:${pa})*`,ma=new RegExp(String.raw`^((?:${wa})+)\s+(.*)$`,"u"),Eu=new RegExp(String.raw`^(?:${wa})+$`,"u"),Ir=(t)=>Eu.test(t);var Nu=/^\[( |x|X|\/)\]\s+(.*)$/,_u={" ":"todo",x:"done",X:"done","/":"active"},Tu=/\\([!-/:-@[-`{-~])/g,Ar=1048576,Fu=/[\u{100000}-\u{10fffd}]/gu,Cu=1114109-Ar+1,ba=/\s+#([\p{L}\p{N}_][\p{L}\p{N}_/-]*)$/u,Iu=/(`+)(?!`)([\s\S]*?[^`])\1(?!`)/g,Au=/(!?)\[([^\]]*)\]\(\s*((?:[^\s()]|\([^\s()]*\))+)(?:\s+"[^"]*")?\s*\)/g,Lu=[/~~(?=\S)([\s\S]*?\S)~~/g,/\*\*(?=\S)([\s\S]*?\S)\*\*/g,/(?<![\p{L}\p{N}_])__(?=\S)([\s\S]*?\S)__(?![\p{L}\p{N}_])/gu,/\*(?=\S)([\s\S]*?\S)\*/g,/(?<![\p{L}\p{N}_])_(?=\S)([\s\S]*?\S)_(?![\p{L}\p{N}_])/gu],Lr=(t)=>{let e=[],n=(d)=>{if(e.length>=Cu)return d;return String.fromCodePoint(Ar+e.push(d)-1)},i=t.trim().replace(Tu,(d,c)=>n(c));i=i.replace(Ma,(d,c,u,h)=>c||h?" ":"").trim();let r={},o=Nu.exec(i);if(o)r.status=_u[o[1]],i=o[2].trim();let s=ma.exec(i);if(s)r.icon=s[1],i=s[2].trim();let a=[];for(let d=ba.exec(i);d&&/\p{L}/u.test(d[1]);d=ba.exec(i))a.unshift(d[1]),i=i.slice(0,d.index);if(a.length>0)r.tags=a;i=i.replace(Iu,(d,c,u)=>n(u.replace(/^ ([\s\S]*) $/,"$1"))),i=i.replace(Au,(d,c,u,h)=>{if(c)return d;return r.link??=fa(h,e),u});let l=r.icon?null:ma.exec(i);if(l)r.icon=l[1],i=l[2].trim();for(let d=0;d<3;d+=1){let c=i;for(let u of Lu)i=i.replace(u,"$1");if(i===c)break}return{text:fa(i,e).trim(),...r}},fa=(t,e)=>{let n=t;for(let i=0;i<4;i+=1){let r=n.replace(Fu,(o)=>e[o.codePointAt(0)-Ar]??o);if(r===n)break;n=r}return n},Pu=new Set(["image","video","embed","none"]),Du=/^ {0,3}(#{1,6})\s+(.*\S)\s*$/,ka=/^ {0,3}#{1,6}\s+/,Ru=/^ {0,3}(?:=+|-+)\s*$/,Wn=/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/,Pr=/^(\s*)(?:[-*+]|\d{1,9}[.)])\s+(.*\S)\s*$/,$u=/^\s*(?:[-*+]|1[.)])\s+\S/,Un=/^\s*>/,Dr=/^ {0,3}(```|~~~)/,Oa=/^(.*\S)\s+<!--\s*orbit:?\s+([\s\S]*?)\s*-->\s*$/i,Sa=/^()<!--\s*orbit:?\s+([\s\S]*?)\s*-->\s*$/i,Ma=/(\s*)(?<!\\)<!--([\s\S]*?)-->(\s*)/g,Ea=/^\[!\[([^\]]*)\]\(([^)]+)\)\]\(([^)]+)\)$/,Na=/^!\[([^\]]*)\]\(([^)]+)\)$/,_a=/^\[([^\]]*)\]\(([^)]+)\)$/,Gn=(t,e={})=>{let n=new Ue(e.strict??!1),i=le(t).split(`
|
|
59
|
+
`),{options:r,extra:o,bodyStartIndex:s}=Bu(i,n),a=new yr(i);a.mark(1,s,null,"frontmatter");let l=i.slice(s).map((p,b)=>{let f=Fa(p);return{text:f,line:s+b+1,indent:Tr(f)}}),d=Zu(Ta(l,{headings:!0}),r,n,de(i)===-1,a,e.untitled);La(d,0),wn(d),Sn(d,n,sh(d,i));let c={root:d,options:r,warnings:n.warnings,diagnostics:n.diagnostics};if(Object.keys(o).length>0)c.extra=o;let u=ce(i),h=u&&s>0?{open:u.openIndex,close:u.closeIndex}:null,m=a.finish(d,r,o,h,It(d));return m.encoding={...Cn(t),indentation:$n(t.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
|
|
60
|
+
`))},In(c,m),zn(c,n,Lt(i,"schemaVersion")),c.warnings=n.warnings,c},Bu=(t,e)=>{let n={},i=ce(t);if(!i)return Hu(t,e),{options:{},extra:n,bodyStartIndex:0};if(Vu(t,i.openIndex,i.closeIndex))return{options:{},extra:n,bodyStartIndex:0};let r=i.closeIndex+1,o;try{o=Nt(i.yaml)??{}}catch(a){let l=a instanceof K?a:null,d=l?i.openIndex+1+l.line:i.openIndex+1;return e.recover("invalid-frontmatter",`Invalid frontmatter YAML: ${l?.reason??a.message}`,d,"error"),{options:{},extra:n,bodyStartIndex:r}}if(typeof o!=="object"||Array.isArray(o))return e.recover("invalid-frontmatter",'Frontmatter must contain "key: value" pairs.',i.openIndex+1,"error"),{options:{},extra:n,bodyStartIndex:r};let s={};for(let[a,l]of Object.entries(o)){let d=Lt(t,a,i.openIndex,i.closeIndex)??i.openIndex+1;if(!Rt.has(a)){e.recover("unknown-frontmatter-key",Vn(a,"frontmatter"),d),n[a]=l;continue}Hn(s,a,l,(c)=>e.recover("invalid-option-value",c,d))}return{options:s,extra:n,bodyStartIndex:r}},ga=(t)=>/^ {0,3}#{1,6}\s+\S/.test(t)||/^\s*(?:[-*+]|\d+[.)])\s+\S/.test(t),Vu=(t,e,n)=>{let i=t.slice(e+1,n);return i.some(ga)&&!i.some((r)=>/^[A-Za-z_][\w-]*\s*:/.test(r))&&!t.slice(n+1).some(ga)},Hu=(t,e)=>{let n=de(t);if(n===-1||t[n].trim()!=="---")return;let i=t.slice(n+1).find((r)=>r.trim()!=="");if(i!==void 0&&/^[A-Za-z_][\w-]*\s*:/.test(i))e.recover("invalid-frontmatter",'The frontmatter has no closing "---" line, so it reads as part of the map. Close it with "---".',n+1)},Ta=(t,e)=>{let n=[],i=0;while(i<t.length){let{text:r,line:o}=t[i];if(r.trim()===""){n.push({kind:"blank",line:o,last:o}),i+=1;continue}let s=e.headings?Du.exec(r):null;if(s){n.push(...ya(s[1].length,s[2].replace(/\s+#+$/,""),o,o,!1)),i+=1;continue}if(r.trim().startsWith("<!--")){i=Wu(t,i,n);continue}if(Un.test(r)){let h=[];while(i<t.length&&Un.test(t[i].text))h.push(t[i].text.replace(/^\s*> ?/,"")),i+=1;n.push({kind:"note",text:h.join(`
|
|
61
|
+
`),line:o,last:t[i-1].line});continue}if(Wn.test(r)){n.push({kind:"foreign",line:o,last:o}),i+=1;continue}let a=Pr.exec(r);if(a){let h=[];i=Gu(t,i,a[1].length,h),n.push({kind:"list",items:h,line:o,last:t[i-1].line});continue}let l=ju(r.trim(),o);if(l){n.push(l),i+=1;continue}let d=Dr.exec(r);if(d){let h=r;i+=1;while(i<t.length)if(h+=`
|
|
62
|
+
`+t[i].text,i+=1,t[i-1].text.trimStart().startsWith(d[1]))break;n.push({kind:"paragraph",text:h,line:o,last:t[i-1].line});continue}let c=r;i+=1;let u=!1;while(i<t.length){let h=t[i].text;if(e.headings&&Ru.test(h)){let m=h.trim().startsWith("=")?1:2;n.push(...ya(m,c.split(`
|
|
63
|
+
`).map((p)=>p.trim()).join(" "),o,t[i].line,!0)),i+=1,u=!0;break}if(zu(h))break;c+=`
|
|
64
|
+
`+h,i+=1}if(!u)n.push({kind:"paragraph",text:c,line:o,last:t[i-1].line})}return n},ya=(t,e,n,i,r)=>{let o=Oa.exec(e)??Sa.exec(e);if(o)return[{kind:"header",level:t,text:o[1],line:n,last:i,setext:r},{kind:"comment",body:o[2],line:n,last:n,inline:!0}];return[{kind:"header",level:t,text:e,line:n,last:i,setext:r}]},zu=(t)=>{let e=t.trim();return e===""||ka.test(t)||$u.test(t)||Un.test(t)||Dr.test(t)||Wn.test(t)||e.startsWith("<!--")||Uu(e)},Uu=(t)=>{if(Ea.test(t)||Na.test(t))return!0;let e=_a.exec(t);return e!==null&&et(Ge(e[2]))!==null},Ge=(t)=>t.replace(/\s+(?:"[^"]*"|'[^']*')?\s*$/,""),ju=(t,e)=>{let n=Ea.exec(t);if(n)return{kind:"media",mediaKind:"wrapped",alt:n[1],thumb:Ge(n[2]),url:Ge(n[3]),line:e,last:e};let i=Na.exec(t);if(i)return{kind:"media",mediaKind:"image",alt:i[1],url:Ge(i[2]),line:e,last:e};let r=_a.exec(t);if(r)return{kind:"media",mediaKind:"link",text:r[1],url:Ge(r[2]),line:e,last:e};return null},Wu=(t,e,n)=>{let i=e,r=t[i].text;i+=1;while(i<t.length&&!r.includes("-->"))r+=`
|
|
65
|
+
`+t[i].text,i+=1;let o=/<!--\s*([\s\S]*?)\s*-->/.exec(r);if(o&&/^orbit(?::|\b)/i.test(o[1])){let s=/^orbit:?[^\S\n]*\n/i.test(o[1]),a=o[1].replace(/^orbit:?[^\S\n]*\n?/i,"");n.push({kind:"comment",body:qu(a.split(`
|
|
66
66
|
`)).join(`
|
|
67
|
-
`),line:t[e].line,last:t[i-1].line,bodyLine:s?t[e].line+1:t[e].line})}else n.push({kind:"foreign",line:t[e].line,last:t[i-1].line,comment:o?.[1]});return i},
|
|
68
|
-
`))return null;return i[0]},
|
|
69
|
-
`);return
|
|
67
|
+
`),line:t[e].line,last:t[i-1].line,bodyLine:s?t[e].line+1:t[e].line})}else n.push({kind:"foreign",line:t[e].line,last:t[i-1].line,comment:o?.[1]});return i},Gu=(t,e,n,i)=>{let r=e;while(r<t.length){let{text:o,line:s}=t[r];if(o.trim()===""){r+=1;continue}let a=Wn.test(o)?null:Pr.exec(o);if(!a||a[1].length<n)break;let l=a[2],d,c=Oa.exec(l)??Sa.exec(l);if(c)l=c[1],d=c[2];r+=1;let u=[],h=[],m=[],p=!0;while(r<t.length){let y=t[r];if(Ku(y)){m.push(y),p=!1,r+=1;continue}if(y.indent>n){h.push(...m,y),u.push(y),m=[],r+=1;continue}if(p&&Yu(y.text)){h.push({text:y.text.trimStart(),line:y.line,indent:0}),r+=1;continue}break}let b=Number.POSITIVE_INFINITY;for(let y of u)b=Math.min(b,y.indent);let f=new Set(u),g=h.map((y)=>f.has(y)?{text:y.text.slice(b),line:y.line,indent:y.indent-b}:y);i.push({text:l,line:s,inlineAttrs:d,content:Ta(g,{headings:!1})})}return r},Yu=(t)=>!(Pr.test(t)||ka.test(t)||Un.test(t)||Dr.test(t)||Wn.test(t)||t.trim().startsWith("<!--")),Tr=(t)=>/^ */.exec(t)[0].length,Ku=(t)=>{if(t.indent===t.text.length)return!0;let e=t.text.charCodeAt(t.indent);return(e<33||e>126)&&/^\s*$/.test(t.text)},Fa=(t)=>{let e=/^[ \t]*/.exec(t)[0];if(!e.includes("\t"))return t;let n=0;for(let i of e)n=i==="\t"?n+4-n%4:n+1;return" ".repeat(n)+t.slice(e.length)},qu=(t)=>{let e=Math.min(...t.filter((n)=>n.trim()!=="").map(Tr));return Number.isFinite(e)&&e>0?t.map((n)=>n.slice(Math.min(e,Tr(n)))):t},Zu=(t,e,n,i,r,o)=>{let s=new Ia(n,r,o),a=t.filter((d)=>d.kind==="header"),l=a.length>0?Xu(t,a,e,s):Ju(t,e,n,s,i);return s.finish(),l},Xu=(t,e,n,i)=>{let r=Math.min(...e.map((c)=>c.level)),o=e.filter((c)=>c.level===r),s=o.length===1&&o[0]===e[0]?e[0]:null,a=s||n.title!==void 0?null:Ca(t,e[0]),l=s?i.addHeading(s):i.addGeneratedRoot(n.title??a?.text,a,e[0].line);i.setRoot(l),i.keepAtDocumentLevel(t);let d=[{node:l,level:s?r:0}];for(let c of t){if(c===a||c===s)continue;if(c.kind!=="header"){i.attach(c,d[d.length-1].node);continue}while(d.length>1&&d[d.length-1].level>=c.level)d.pop();let u=i.addHeading(c),h=d[d.length-1].node;Ot(u,h),h.children.push(u),d.push({node:u,level:c.level}),i.reset()}return l},Ju=(t,e,n,i,r)=>{let o=t.filter((d)=>d.kind==="list");if(o.length===0){if(r){n.recover("empty-document","The document is empty.",1);let u=ah();return i.setRoot(u),u}let d=t.find((u)=>u.kind!=="blank");n.recover("no-structure",'No headings or lists found. Start the map with a "# Title" heading or a bullet list.',d?.line);let c=i.addGeneratedRoot(e.title,null,d?.line??1,!0);i.setRoot(c);for(let u of t)i.attach(u,c);return c}let[s]=o,a=e.title!==void 0?null:Ca(t,s);if(!e.title&&!a&&o.length===1&&s.items.length===1){let d=i.addItem(s.items[0],void 0);i.setRoot(d),i.keepAtDocumentLevel(t);for(let c of t)if(c!==s)i.attach(c,d);return d}let l=i.addGeneratedRoot(e.title??a?.text,a,s.line);i.setRoot(l),i.keepAtDocumentLevel(t);for(let d of t)if(d!==a)i.attach(d,l);return l},Ca=(t,e)=>{let n=t.indexOf(e),i=t.slice(0,n).filter((r)=>r.kind!=="blank");if(i.length!==1||i[0].kind!=="paragraph"||i[0].text.includes(`
|
|
68
|
+
`))return null;return i[0]},Qu=(t,e,n,i=!1,r=Cr)=>{if(t!==void 0)return jn({text:t,line:n});if(!i)e.note("synthetic-root",`No single top-level heading, so the map is rooted at "${r}". Add a "# Title" heading or a title in the frontmatter to name it.`,n);return{...jn({text:r,line:n}),id:Ye}},th=(t)=>{let e=t.split(`
|
|
69
|
+
`);return va.test(e[0])&&e.every((n)=>va.test(n)||/^\s{2,}\S/.test(n))},va=/^ {0,3}\[\^?[^\]\n]+\]:\s*\S/,eh=(t)=>{let e=/^([ \t]*)([-*+]|\d{1,9}[.)])([ \t]+)/.exec(t);if(!e)return{kind:"item",indent:0,marker:"-",content:2};let n=Fa(e[1]).length;return{kind:"item",indent:n,marker:e[2],content:n+e[2].length+e[3].length}};class Ia{diagnostics;recorder;notes=new Map;root=null;documentLevel=new Set;lastItem=null;afterList=null;lastMedia=null;pendingContentType=null;untitled;constructor(t,e,n){this.diagnostics=t,this.recorder=e,this.untitled=n}setRoot(t){this.root=t}keepAtDocumentLevel(t){for(let e=t.length-1;e>=0;e-=1){let n=t[e];if(n.kind==="blank")continue;if(n.kind!=="paragraph"||!th(n.text))return;this.documentLevel.add(n)}}addHeading(t){_r(t.text,t.line,this.diagnostics);let e=jn(t);return this.recorder.mark(t.line,t.last,e,"title"),this.recorder.shape(e,{kind:"heading",level:t.level,setext:t.setext},t.line),e}addGeneratedRoot(t,e,n,i=!1){let r=Qu(t,this.diagnostics,n,i,this.untitled);if(e)this.recorder.mark(e.line,e.last,r,"title");return this.recorder.shape(r,{kind:"generated",lead:e!==null},e?e.line:null),r}attach(t,e){if(t.kind==="comment"&&!t.inline&&this.afterList?.node===e&&t.line===this.afterList.lastLine+1){let n=this.afterList.item.text;this.diagnostics.note("attributes-after-list",`This attribute block sets "${e.text}"'s attributes: it isn't indented under "${n}" above it. Indent it to set "${n}"'s.`,t.line)}switch(this.afterList=null,t.kind){case"blank":return;case"foreign":if(t.comment!==void 0)_r(`<!--${t.comment}-->`,t.line,this.diagnostics);this.recorder.mark(t.line,t.last,e,"foreign");return;case"comment":this.applyComment(t,e);return;case"media":{let n=this.pendingContentType?.node===e?this.pendingContentType.kind:null;this.pendingContentType=null;let i=rh(t,e,this.noteParts(e),n);this.lastMedia={node:e,block:t,result:i},this.recorder.mark(t.line,t.last,e,i==="note"?"note":"media");return}case"list":for(let n of t.items)this.addItem(n,e);this.afterList=this.lastItem?{node:e,item:this.lastItem,lastLine:Aa(t.items)}:null;break;case"header":this.noteParts(e).push(`${"#".repeat(t.level)} ${t.text}`),this.recorder.mark(t.line,t.last,e,"note");break;case"note":case"paragraph":{let n=this.documentLevel.has(t)&&this.root!==null,i=n?this.root:e;this.noteParts(i).push(t.text),this.recorder.mark(t.line,t.last,i,n?"end":"note");break}}this.reset()}addItem(t,e){_r(t.text,t.line,this.diagnostics);let n=jn(t);if(this.lastItem=n,this.recorder.mark(t.line,t.line,n,"title"),this.recorder.shape(n,eh(this.recorder.line(t.line)),t.line),e)Ot(n,e),e.children.push(n);if(t.inlineAttrs!==void 0)xa(n,{kind:"comment",body:t.inlineAttrs,line:t.line,last:t.line,inline:!0},this.diagnostics);this.reset();for(let i of t.content)this.attach(i,n);return this.reset(),n}reset(){this.lastMedia=null,this.pendingContentType=null}finish(){for(let[t,e]of this.notes){let n=e.join(`
|
|
70
70
|
|
|
71
71
|
`);if(n.trim())t.note=t.note?`${t.note}
|
|
72
72
|
|
|
73
|
-
${n}`:n,t.noteFormat=t.noteFormat??"markdown"}}noteParts(t){let e=this.notes.get(t);if(!e)e=[],this.notes.set(t,e);return e}applyComment(t,e){let n=
|
|
74
|
-
`))return null;let e=[],n=0,i="",r=0;for(let s=0;s<t.length;s+=1){let a=t[s];if(i){if(a==="\\"&&i==='"')s+=1;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a==="["||a==="{")n+=1;else if(a==="]"||a==="}")n-=1;else if(a===","&&n===0)e.push(t.slice(r,s).trim()),r=s+1}e.push(t.slice(r).trim());let o=(s)=>/^[A-Za-z][\w-]*\s*:(\s|$)/.test(s);return e.length>1&&e.every(o)?e:null},
|
|
75
|
-
`+
|
|
73
|
+
${n}`:n,t.noteFormat=t.noteFormat??"markdown"}}noteParts(t){let e=this.notes.get(t);if(!e)e=[],this.notes.set(t,e);return e}applyComment(t,e){let n=xa(e,t,this.diagnostics,{applyContentType:(i)=>{if(this.lastMedia?.node===e){nh(e,this.lastMedia.block,i,this.noteParts(e),this.lastMedia.result),this.lastMedia.result=i==="none"?"note":i;let r=this.lastMedia.block;this.recorder.mark(r.line,r.last,e,this.lastMedia.result==="note"?"note":"media")}else this.pendingContentType={node:e,kind:i}},clearLastMedia:()=>{this.lastMedia=null},captionTarget:()=>{let i=this.lastMedia;return i?.node===e&&(i.result==="image"||i.result==="video"||i.result==="embed")?i.result:null}});if(!t.inline){let i=n===null?"foreign":n.length>0&&n.every((r)=>r==="contentType"||r==="caption")?"media":"attributes";this.recorder.mark(t.line,t.last,e,i)}}}var nh=(t,e,n,i,r)=>{if(r==="image")t.image=void 0;else if(r==="video")t.video=void 0;else if(r==="embed")t.embed=void 0;else if(r==="note"){let o=Fr(e);if(i.length&&i[i.length-1]===o)i.pop()}if(n==="none"){i.push(Fr(e));return}if(n==="image"){t.image={src:e.url,alt:e.alt||void 0};return}if(n==="video"){let o=et(e.url)??"native";t.video={src:e.url,provider:o,thumbnail:e.mediaKind==="wrapped"?e.thumb:void 0};return}t.embed={src:e.url}},ih={keys:["contentType"]},xa=(t,e,n,i)=>{let r=e.body.trim();if(r==="")return[];let o=e.inline?oh(r):null,s;try{s=o?Object.assign({},...o.map((d)=>Nt(d))):Nt(r)??{}}catch(d){let c=d instanceof K?d:null,u=c&&!o?(e.bodyLine??e.line)+c.line-1:e.line;return n.recover("invalid-attributes",`Invalid YAML in attribute block: ${c?.reason??d.message}`,u),null}if(typeof s!=="object"||s===null||Array.isArray(s))return n.recover("invalid-attributes",'An attribute block must contain "key: value" pairs.',e.line),null;let a=Object.entries(s);for(let[d,c]of a){if(d==="caption")continue;if(d==="contentType"){if(!Pu.has(c)){n.recover("unknown-content-type",`Unknown contentType "${String(c)}"; expected image, video, embed or none.`,e.line);continue}i?.applyContentType(c);continue}if(se(t,d,c,n,e.line,ih),d==="image"||d==="video"||d==="embed")i?.clearLastMedia()}let l=a.map(([d])=>d).filter((d)=>d==="image"||d==="video"||d==="embed");for(let[d,c]of a){if(d!=="caption")continue;let u=l.length===1?l[0]:l.length===0?i?.captionTarget()??null:null,h=u?t[u]:void 0;if(h&&c!==null&&c!==void 0)h.caption=String(c);else se(t,d,c,n,e.line)}return a.map(([d])=>d)},rh=(t,e,n,i)=>{let r=()=>(n.push(Fr(t)),"note");if(i==="none")return r();if(i==="image"){if(e.image)return r();return e.image={src:t.url,alt:t.alt||void 0},"image"}if(i==="video"){if(e.video)return r();return e.video={src:t.url,provider:et(t.url)??"native",thumbnail:t.mediaKind==="wrapped"?t.thumb:void 0},"video"}if(i==="embed"){if(e.embed)return r();return e.embed={src:t.url},"embed"}if(t.mediaKind==="wrapped"){let o=et(t.url);if(o){if(!e.video)return e.video={src:t.url,provider:o,thumbnail:t.thumb},"video"}else if(!e.image)return e.image={src:t.thumb,alt:t.alt||void 0},"image"}else if(t.mediaKind==="image"){if(!e.image)return e.image={src:t.url,alt:t.alt||void 0},"image"}else if(t.mediaKind==="link"){let o=et(t.url);if(!e.video&&o)return e.video={src:t.url,provider:o},"video"}return r()},oh=(t)=>{if(t.includes(`
|
|
74
|
+
`))return null;let e=[],n=0,i="",r=0;for(let s=0;s<t.length;s+=1){let a=t[s];if(i){if(a==="\\"&&i==='"')s+=1;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a==="["||a==="{")n+=1;else if(a==="]"||a==="}")n-=1;else if(a===","&&n===0)e.push(t.slice(r,s).trim()),r=s+1}e.push(t.slice(r).trim());let o=(s)=>/^[A-Za-z][\w-]*\s*:(\s|$)/.test(s);return e.length>1&&e.every(o)?e:null},Fr=(t)=>{if(t.mediaKind==="image")return``;if(t.mediaKind==="wrapped")return`[](${t.url})`;return`[${t.text??""}](${t.url})`},sh=(t,e)=>{let n=[],i=(r)=>{if(r.source?.line!==void 0)n.push(r.source.line);r.children.forEach(i)};return i(t),n.sort((r,o)=>r-o),(r,o,s)=>{let a=r.source?.line;if(a===void 0||!s)return a;let l=n.find((d)=>d>a)??e.length+1;for(let d=a;d<l;d+=1)if(e[d-1].includes(`](${o})`))return d;return a}},Aa=(t)=>{let e=t[t.length-1],n=e.content.filter((r)=>r.kind!=="blank"),i=n[n.length-1];if(i?.kind==="list")return Aa(i.items);return i?i.last:e.line},_r=(t,e,n)=>{for(let i of t.matchAll(Ma)){let r=i[2].trim(),o=/^([A-Za-z]+)\s*:/.exec(r)?.[1];if(o!==void 0&&fr.includes(o))n.note("comment-without-orbit",`This comment is hidden, so it sets nothing: to set "${o}", write <!-- orbit ${r} -->.`,e)}},jn=(t)=>{let e=Lr(t.text),n={id:ht(e.text),text:e.text,level:0,children:[],icon:e.icon,link:e.link,source:{line:t.line,raw:""}};if(e.status)n.status=e.status;if(e.tags)n.tags=e.tags;return n},ah=()=>({id:"empty",text:"",level:0,children:[]}),La=(t,e)=>{t.level=e;for(let n of t.children)Ot(n,t),La(n,e+1)};var Pa=(t)=>{let e="",n=Ke(t);if(Object.keys(n).length>0)e+=`---
|
|
75
|
+
`+He(n)+`---
|
|
76
76
|
|
|
77
|
-
`;return e+=
|
|
78
|
-
${i.body}`;if(t.children.length===0)return r;if(e<
|
|
79
|
-
${
|
|
80
|
-
${o.body}`,i+=
|
|
81
|
-
${
|
|
82
|
-
-->`,e):"",
|
|
77
|
+
`;return e+=Da(t.root,1,{explicitIds:It(t.root)}),e},Ke=(t)=>{let e=t.options,n={};if(e.title)n.title=e.title;if(e.theme)n.theme=e.theme;if(e.viewMode)n.view=e.viewMode;if(e.showRings!==void 0)n.showRings=e.showRings;if(e.interactive!==void 0)n.interactive=e.interactive;if(e.orbitAnimation!==void 0)n.animation=e.orbitAnimation;if(e.orbitSpeed!==void 0)n.speed=e.orbitSpeed;if(e.palette)n.palette=e.palette;if(e.height!==void 0)n.height=e.height;if(e.maxDepth!==void 0)n.maxDepth=e.maxDepth;if(e.className)n.className=e.className;if(e.baseUrl)n.baseUrl=e.baseUrl;if(e.schemaVersion!==void 0)n.schemaVersion=e.schemaVersion;for(let[i,r]of Object.entries(t.extra??{}))if(!Object.prototype.hasOwnProperty.call(n,i))gt(n,i,r);return n},qn=2,Br={todo:"[ ]",done:"[x]",active:"[/]"},Da=(t,e,n)=>{let i=$a(t,!1,n,""),r=`${"#".repeat(e)} ${i.line}
|
|
78
|
+
${i.body}`;if(t.children.length===0)return r;if(e<qn)return r+t.children.map((o)=>`
|
|
79
|
+
${Da(o,e+1,n)}`).join("");return r+Ra(t.children,"",n)},Ra=(t,e,n)=>{let i="";for(let r of t){let o=$a(r,!0,n,`${e} `);i+=`${e}- ${o.line}
|
|
80
|
+
${o.body}`,i+=Ra(r.children,`${e} `,n)}return i},$a=(t,e,n,i)=>{let r=qe(t,e,n,i);return{line:`${r.title}${r.inline}`.trimStart(),title:r.title,inline:r.inline,body:r.attributes+r.media+r.note}},qe=(t,e,n,i)=>{let{title:r,attributes:o}=Zn(t,e,n),s=uh(o),a=s?{}:o;if(r===""&&s==="")s=` <!-- orbit id: ${$r(t.id)??JSON.stringify(t.id)} -->`,a=Object.fromEntries(Object.entries(o).filter(([l])=>l!=="id"));return{title:r,inline:s,attributes:ph(a,i),media:Xn(Vr(t).trimEnd(),i),note:mh(t,i)}},Kn=(t)=>/^[^\s()<>"'\\]+$/.test(t),Zn=(t,e,n)=>{let i=wh(t,n.explicitIds),r=yh(t.text),o=t.link!==void 0&&Kn(t.link);if(o&&r===t.text)r=r.replace(/[[\]]/g,"\\$&");if(t.icon&&Ir(t.icon))r=`${t.icon} ${r}`;if(o)r=`[${r}](${t.link})`;let s=e&&t.status?Br[t.status]:void 0;if(s)r=`${s} ${r}`,delete i.status;if(t.tags?.length&&t.tags.every(lh))r+=t.tags.map((a)=>` #${a}`).join(""),delete i.tags;return{title:r,attributes:i}},lh=(t)=>/^[\p{L}\p{N}_][\p{L}\p{N}_/-]*$/u.test(t)&&/\p{L}/u.test(t),dh=80,ch=3,uh=(t)=>{let e=Object.entries(t);if(e.length===0||!e.every(([i,r])=>hh.test(i)&&$r(r)!==null))return"";let n=` <!-- orbit ${e.map(([i,r])=>`${i}: ${$r(r)}`).join(", ")} -->`;return e.length<=ch||n.length<=dh?n:""},hh=/^[A-Za-z][\w-]*$/,$r=(t)=>{if(typeof t==="number"||typeof t==="boolean")return String(t);if(typeof t!=="string"||t.length>60||/[\r\n]|--/.test(t))return null;return Xs(t)&&!/["',:#[\]{}]/.test(t)&&!/^-?\d/.test(t)?t:JSON.stringify(t)};var ph=(t,e)=>Object.keys(t).length>0?Xn(`<!-- orbit
|
|
81
|
+
${Ba(t)}
|
|
82
|
+
-->`,e):"",mh=(t,e)=>t.note?Xn(bh(t.note,e!==""),e):"",bh=(t,e)=>fh(t,e)?t:t.split(`
|
|
83
83
|
`).map((n)=>n===""?">":`> ${n}`).join(`
|
|
84
|
-
`),
|
|
84
|
+
`),fh=(t,e)=>{if(/^[ \t]/m.test(t))return!1;let n=e?`# Map
|
|
85
85
|
|
|
86
86
|
## Branch
|
|
87
87
|
- Node
|
|
88
|
-
${
|
|
88
|
+
${Xn(t," ")} - Next
|
|
89
89
|
- After
|
|
90
90
|
`:`# Map
|
|
91
91
|
|
|
@@ -94,37 +94,37 @@ ${t}
|
|
|
94
94
|
- Next
|
|
95
95
|
|
|
96
96
|
## After
|
|
97
|
-
`,r=
|
|
97
|
+
`,r=Gn(n).root.children,o=e?r[0]?.children[0]:r[0],s=e?r[0]?.children[1]:r[1];if(!o||o.note!==t||o.children.length!==1||o.children[0].text!=="Next"||s?.text!=="After")return!1;let a=new Set(["id","text","level","children","source","note"]);return Object.entries(o).every(([l,d])=>a.has(l)||d===void 0||l==="noteFormat"&&d==="markdown")},Xn=(t,e)=>{if(t==="")return"";return`${t.split(`
|
|
98
98
|
`).map((n)=>n===""?"":`${e}${n}`).join(`
|
|
99
99
|
`)}
|
|
100
|
-
`},
|
|
101
|
-
`,e+=
|
|
100
|
+
`},gh=/[\\`*_~[\]#<]/g,yh=(t)=>/<!--/.test(t)||/\s#+$/.test(t)||!vh(t)?t.replace(gh,"\\$&"):t,vh=(t)=>{let e=Lr(t);return e.text===t&&e.icon===void 0&&e.link===void 0&&e.tags===void 0&&e.status===void 0},Yn=(t)=>(t.provider===void 0||t.provider===(et(t.src)??"native"))&&Kn(t.src)&&(t.thumbnail===void 0||Kn(t.thumbnail))&&!/[[\]\n]/.test(t.alt??"")&&pr(t)===void 0,xh=(t)=>{let e={src:t.src,...pr(t)};for(let n of["alt","thumbnail","caption"])if(t[n]!==void 0)e[n]=t[n];if(t.provider!==void 0&&t.provider!==(et(t.src)??"native"))e.provider=t.provider;return e},Vr=(t)=>{let e="";if(t.image&&Yn(t.image))e+=`
|
|
101
|
+
`,e+=Rr(void 0,t.image.caption);if(t.video&&Yn(t.video)){let n=t.video,i=et(n.src);e+=n.thumbnail?`[](${n.src})
|
|
102
102
|
`:`[video](${n.src})
|
|
103
|
-
`,e+=
|
|
104
|
-
`,e+=
|
|
103
|
+
`,e+=Rr(i===null?"video":void 0,n.caption)}if(t.embed&&Yn(t.embed))e+=`[embed](${t.embed.src})
|
|
104
|
+
`,e+=Rr("embed",t.embed.caption);return e},Rr=(t,e)=>{let n={};if(t)n.contentType=t;if(e!==void 0)n.caption=e;if(Object.keys(n).length===0)return"";let i=Ba(n);return i.includes(`
|
|
105
105
|
`)?`<!-- orbit
|
|
106
106
|
${i}
|
|
107
107
|
-->
|
|
108
108
|
`:`<!-- orbit ${i} -->
|
|
109
|
-
`},
|
|
110
|
-
`),o={},s=(m,p)=>({root:m,options:p,...Object.keys(o).length>0?{extra:o}:{},warnings:n.warnings,diagnostics:n.diagnostics}),a;try{a=
|
|
111
|
-
`);if(
|
|
112
|
-
`),e)}return
|
|
113
|
-
`),o=n===e?null:
|
|
109
|
+
`},Ba=(t)=>He(t).trimEnd().replace(/--(!?)>/g,"--$1\\u003e"),wh=(t,e)=>{let n={};if(t.icon&&!Ir(t.icon))n.icon=t.icon;if(t.color)n.color=t.color;if(t.paletteColor!==void 0)n.paletteColor=t.paletteColor;if(t.status)n.status=t.status;if(t.priority!==void 0)n.priority=t.priority;if(t.tags)n.tags=t.tags;if(t.collapsed!==void 0)n.collapsed=t.collapsed;if(t.type)n.type=t.typeVersion===void 0?t.type:`${t.type}@${t.typeVersion}`;if(t.link&&!Kn(t.link))n.link=t.link;for(let i of["image","video","embed"]){let r=t[i];if(r&&!Yn(r))n[i]=xh(r)}if(t.noteFormat&&t.noteFormat!=="markdown"&&t.note)n.noteFormat=t.noteFormat;if(e.has(t))n.id=t.id;if(t.attrs){for(let[i,r]of Object.entries(t.attrs))if(!Object.prototype.hasOwnProperty.call(n,i))gt(n,i,r)}return n};var jr=(t,e={})=>{let n=new Ue(e.strict??!1),i=le(t),r=i.split(`
|
|
110
|
+
`),o={},s=(m,p)=>({root:m,options:p,...Object.keys(o).length>0?{extra:o}:{},warnings:n.warnings,diagnostics:n.diagnostics}),a;try{a=Nt(i)}catch(m){let p=m instanceof K?m:null;return n.recover("invalid-yaml",`Invalid YAML: ${p?.reason??m.message}`,p?.line??1,"error"),s(Hr(),{})}if(!a||typeof a!=="object"||Array.isArray(a))return n.recover("invalid-yaml",'A YAML map needs top-level "key: value" entries such as "nodes:".',1,"error"),s(Hr(),{});let l={},d=a;for(let[m,p]of Object.entries(d)){if(m==="nodes")continue;let b=Lt(r,m);if(!Rt.has(m)){n.recover("unknown-yaml-key",Vn(m,"top-level"),b),o[m]=p;continue}Hn(l,m,p,(f)=>n.recover("invalid-option-value",f,b))}let c=d.nodes;if(!Array.isArray(c)||c.length===0){let m=c!==void 0&&c!==null&&!Array.isArray(c)?'"nodes" must be a list: start the root on the line below it with "- text: …".':'No nodes found. Add a "nodes:" list with one root node.';return n.recover("no-structure",m,Lt(r,"nodes")??1),s(Hr(),l)}let u=c.length===1?Ur(c[0],0,void 0,n,_n(c,0)):kh(l.title,n,Lt(r,"nodes"),e.untitled);if(c.length>1)c.forEach((m,p)=>{u.children.push(Ur(m,1,u,n,_n(c,p)))});wn(u),Sn(u,n,(m,p,b)=>zr.get(m)?.(b?"note":"link"));let h=s(u,l);return zn(h,n,Lt(r,"schemaVersion")),h.warnings=n.warnings,h},kh=(t,e,n,i=Cr)=>{if(t!==void 0)return{id:ht(t),text:t,level:0,children:[]};return e.note("synthetic-root",`Several top-level nodes, so the map is rooted at "${i}". Add a title to name it.`,n),{id:Ye,text:i,level:0,children:[]}},Oh={keys:["text","children"],synonyms:{title:"text",label:"text",name:"text",items:"children",nodes:"children",subnodes:"children"}},Sh=["title","name","label"],Mh=["items","nodes","subnodes"],Va=(t,e,n,i)=>{if(t[e]!==void 0&&t[e]!==null)return e;let r=e==="text"?Sh.find((s)=>typeof t[s]==="string"||typeof t[s]==="number"):Mh.find((s)=>Array.isArray(t[s]));if(r===void 0)return e;let o=e==="text"?"text goes":"children go";return n.recover("misnamed-node-key",`A node's ${o} in "${e}", not "${r}": read as its ${e==="text"?"text":"children"}. Rename "${r}" to "${e}".`,i(r)),r},zr=new WeakMap,Ur=(t,e,n,i,r)=>{if(t===null||typeof t!=="object"||Array.isArray(t)){let h=t===null||Array.isArray(t)?"":String(t);if(t===null||Array.isArray(t))i.note("ignored-node-entry",`Ignored ${Array.isArray(t)?"an array":"a null"} node entry: expected a map or plain text.`,r);let m={id:ht(h),text:h,level:e,children:[]};return Ot(m,n),zr.set(m,()=>r),m}let o=t,s=(h)=>zs(o,h)??r;if(o.text!==void 0&&o.text!==null&&typeof o.text==="object")i.recover("invalid-attributes",`text must be a word or a number, not ${Array.isArray(o.text)?"a list":"a map"}; its text form is used`,s("text"));if(o.children!==void 0&&o.children!==null&&!Array.isArray(o.children)){let h=typeof o.children==="object"?"a map":`"${String(o.children)}"`;i.recover("invalid-attributes",`children must be a list of nodes, not ${h}; ignored`,s("children"))}let a=Va(o,"text",i,s),l=Va(o,"children",i,s),d={id:(typeof o.id==="string"||typeof o.id==="number")&&String(o.id).trim()!==""?String(o.id):ht(String(o[a]??"")),text:String(o[a]??""),level:e,children:[]};Ot(d,n),zr.set(d,s);let c=Object.entries(o);for(let[h,m]of c){if(h==="text"||h==="id"||h==="children"||h==="caption"||h===a||h===l)continue;se(d,h,m,i,s(h),Oh)}if("caption"in o)se(d,"caption",o.caption,i,s("caption"));let u=o[l];if(Array.isArray(u))u.forEach((h,m)=>{d.children.push(Ur(h,e+1,d,i,_n(u,m)??s(l)))});return d},Hr=()=>({id:"empty",text:"",level:0,children:[]});var mt=(t,e={})=>{let n=Th(t),i=le(n),r=i.split(`
|
|
111
|
+
`);if(Eh(i,r)==="markdown"){let s=Gn(i,e);return _h(s,t,n),s}let o=ce(r);if(o){let s=[...r];return s[o.openIndex]="",s[o.closeIndex]="",jr(s.join(`
|
|
112
|
+
`),e)}return jr(i,e)};var Eh=(t,e)=>{let n=ce(e);if(n)return Fh(n.yaml)==="yaml"?"yaml":"markdown";let i=de(e);if(i===-1)return"markdown";let r=e[i];if(/^nodes\s*:\s*(?:$|[#[{])/.test(r))return"yaml";let o=Nh(r);if(!o&&!/^nodes\s*:/m.test(t))return"markdown";let s;try{s=Nt(t)}catch{return o&&/^nodes\s*:/m.test(t)?"yaml":"markdown"}if(typeof s!=="object"||s===null||Array.isArray(s))return"markdown";return Array.isArray(s.nodes)||o?"yaml":"markdown"},Nh=(t)=>{let e=/^([A-Za-z][\w-]*)\s*:(\s|$)/.exec(t);return e!==null&&Rt.has(e[1])},_h=(t,e,n)=>{let i=ae(t);if(!i)return;let r=(l)=>l.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
|
|
113
|
+
`),o=n===e?null:Ha.exec(e),s=[],a=[];if(o){let l=o[1].length;s=r(e.slice(0,l)).split(`
|
|
114
114
|
`).slice(0,-1);let d=r(e.slice(l+o[3].length));a=d.startsWith(`
|
|
115
115
|
`)||d===""?d.split(`
|
|
116
116
|
`).slice(1):d.split(`
|
|
117
|
-
`)}i.encoding={...
|
|
118
|
-
`)}patchOwn(t,e,n,i,r,o){let s=
|
|
119
|
-
`);if(e[e.length-1]==="")e.pop();return e},An=(t)=>{if(t.length>0&&t[t.length-1].trim()!=="")t.push("")},ba=(t)=>({...t,level:0,children:[]}),In=(t,e,n)=>{let i={explicitIds:n?new Set([t]):new Set},{title:r,attributes:o}=Fn(t,e,i);return{title:r,attributes:JSON.stringify(o),media:vr(t),note:t.note??""}},sh=(t,e,n,i)=>{let r=[e,JSON.stringify(e),`'${e.replace(/'/g,"''")}'`].map((s)=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`^(?:${r.join("|")})\\s*:`);for(let s=n;s<i;s+=1)if(o.test(t[s])){let a=s+1;while(a<i&&(t[a].trim()===""||/^\s/.test(t[a])||/^-(\s|$)/.test(t[a])))a+=1;while(a>s+1&&t[a-1].trim()==="")a-=1;return{from:s,to:a}}return null},fa=(t)=>ut(Se(t));var va=(t,e={})=>{let n=e.keepSource===!1?void 0:qt(t);if(n){let i=ga(t,n);if(i!==null)return i}return sa(t)};var xa=".orbit{position:relative;width:100%;height:100%;overflow:hidden;contain:size layout style;background:var(--_orbit-surface-pattern),var(--_orbit-surface);color:var(--_orbit-text);font-family:var(--_orbit-font-family);font-kerning:normal;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased}.orbit__canvas{display:block;width:100%;height:100%;overflow:visible;touch-action:none;outline:none;cursor:grab;-webkit-user-select:none;user-select:none}.orbit__world{cursor:grab}.orbit--static .orbit__canvas{cursor:default;touch-action:auto}.orbit--static .orbit__world{cursor:default}.orbit--dragging .orbit__canvas,.orbit--dragging .orbit-ring-band{cursor:grabbing}.orbit--embedded .orbit__canvas{touch-action:pan-x pan-y}.orbit--embedded[data-orbit-view=focus] .orbit-node--planet,.orbit--embedded[data-orbit-view=focus] .orbit-ring-band{touch-action:none}.orbit__contents,.orbit__labels,.orbit__overlay{position:absolute;inset:0;pointer-events:none}.orbit__labels{transform-origin:0 0}.orbit__live{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.orbit [hidden]{display:none !important}.orbit-rendered{position:relative}.orbit-rendered>.orbit{position:absolute;inset:0}.orbit-visually-hidden{position:absolute !important;width:1px !important;height:1px !important;overflow:hidden !important;clip-path:inset(50%) !important;white-space:nowrap !important}.orbit-icon{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}.orbit-icon--filled{fill:currentColor}.orbit-icon--glyph{display:inline-grid;place-items:center;font-size:16px;font-weight:650;line-height:1}.orbit-node-content{position:absolute;top:0;left:0;display:grid;place-items:center;width:100px;height:100px;overflow:hidden;border-radius:50%;color:var(--_orbit-node-text);font-family:var(--_orbit-label-font);font-size:22px;line-height:1.1;text-align:center;pointer-events:none;contain:layout paint}.orbit-ring{fill:none;stroke:color-mix(in oklab, var(--orbit-ring-color, var(--_orbit-ring-stroke)) var(--_orbit-ring-tint), var(--_orbit-ring-stroke));stroke-width:var(--_orbit-ring-width);stroke-dasharray:var(--_orbit-ring-dash);stroke-linecap:round;stroke-opacity:var(--_orbit-ring-opacity);vector-effect:non-scaling-stroke;pointer-events:none}.orbit-ring-band{fill:none;stroke:rgba(0,0,0,0);pointer-events:stroke}.orbit-link{stroke:color-mix(in oklab, var(--orbit-link-color, var(--_orbit-link-stroke)) var(--_orbit-link-tint), var(--_orbit-link-stroke));stroke-width:var(--_orbit-link-width);stroke-dasharray:var(--_orbit-link-dash);stroke-linecap:round;stroke-opacity:var(--_orbit-link-opacity);vector-effect:non-scaling-stroke;pointer-events:none}.orbit-shade__highlight{stop-color:var(--_orbit-node-highlight)}.orbit-shade__highlight-fade{stop-color:color-mix(in srgb, var(--_orbit-node-highlight) 20%, transparent)}.orbit-shade__terminator-start{stop-color:var(--_orbit-node-terminator);stop-opacity:0}.orbit-shade__terminator{stop-color:var(--_orbit-node-terminator)}.orbit-shade__shading{stop-color:var(--_orbit-node-shading)}.orbit-node{cursor:pointer;outline:none}.orbit-node__body{transform-origin:0 0;transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-node:hover .orbit-node__body{transform:scale(1.045)}.orbit-node:active .orbit-node__body{transform:scale(0.97)}.orbit-node__shadow{fill:color-mix(in oklab, var(--orbit-node-color) var(--_orbit-node-shadow-tint), var(--_orbit-node-shadow));opacity:var(--_orbit-node-shadow-opacity);transform:translate(0, calc(var(--_orbit-node-shadow-offset) * 1px)) scale(var(--_orbit-node-shadow-size));transition:opacity 320ms ease,transform 320ms ease,display 320ms allow-discrete}@starting-style{.orbit-node__shadow{opacity:0}}.orbit-node--sun .orbit-node__shadow{opacity:var(--_orbit-sun-shadow-opacity);transform:translate(0, calc(var(--_orbit-node-shadow-offset) * 1px)) scale(var(--_orbit-sun-shadow-size))}.orbit-node--node .orbit-node__shadow{display:none}.orbit-node__halo{display:none;fill:none;stroke:color-mix(in oklab, var(--orbit-node-color) var(--_orbit-sun-halo-tint), var(--_orbit-sun-halo));stroke-width:var(--_orbit-sun-halo-width);stroke-dasharray:var(--_orbit-sun-halo-dash);stroke-opacity:var(--_orbit-sun-halo-opacity);vector-effect:non-scaling-stroke;transform:scale(var(--_orbit-sun-halo-size));opacity:0;transition:opacity 320ms ease,display 320ms allow-discrete}.orbit-node--sun .orbit-node__halo{display:inline;opacity:1}@starting-style{.orbit-node--sun .orbit-node__halo{opacity:0}}.orbit-node--flat .orbit-node__shadow,.orbit-node--flat .orbit-node__halo{display:none;opacity:0}.orbit-node__disc{fill-opacity:var(--_orbit-node-fill-opacity)}.orbit-node__shade,.orbit-node__image,.orbit-node__shadow,.orbit-node__halo,.orbit-node__status,.orbit-node__marker,.orbit-node__play{pointer-events:none}.orbit-node__shade{stroke:color-mix(in oklab, var(--orbit-node-color, var(--_orbit-node-stroke)) var(--_orbit-node-stroke-tint), var(--_orbit-node-stroke));stroke-width:var(--_orbit-node-stroke-width);vector-effect:non-scaling-stroke}.orbit-node--crowded .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.04);vector-effect:none}.orbit-node__focus-ring{display:none;fill:none;stroke:var(--_orbit-focus-ring);stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:none;transition:opacity 120ms ease}.orbit-node:focus-visible .orbit-node__focus-ring{display:inline}@starting-style{.orbit-node:focus-visible .orbit-node__focus-ring{opacity:0}}.orbit-node__status{stroke:var(--_orbit-badge-stroke);stroke-width:.04}.orbit-node__status--active{fill:var(--_orbit-status-active)}.orbit-node__status--done{fill:var(--_orbit-status-done)}.orbit-node__status--blocked{fill:var(--_orbit-status-blocked)}.orbit-node__status--todo{fill:var(--_orbit-status-todo)}.orbit-node__status--neutral{fill:var(--_orbit-status-neutral)}.orbit-node--sun .orbit-node__status{stroke-width:.025}.orbit-node__marker{fill:var(--_orbit-note-indicator);stroke:var(--_orbit-badge-stroke);stroke-width:.04}.orbit-node__play{fill:rgba(15,23,42,.62)}.orbit-node__play path{fill:#fff}.orbit-node--moon{cursor:pointer}.orbit-node--sun .orbit-node__marker,.orbit-node--sun .orbit-node__play{display:none}.orbit-node--moon .orbit-node__disc{fill-opacity:var(--_orbit-moon-opacity)}.orbit-node--moon .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.7)}.orbit-node--speck .orbit-node__body{transform-box:fill-box;transform-origin:center}.orbit-node--speck .orbit-node__marker,.orbit-node--speck .orbit-node__status,.orbit-node--speck .orbit-node__play{display:none}.orbit-node--speck .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*var(--orbit-speck-radius)*var(--_orbit-speck-rim, 0.2));vector-effect:none}.orbit-node--speck.orbit-node--moon .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.7*var(--orbit-speck-radius)*var(--_orbit-speck-rim, 0.2))}.orbit-node--speck.orbit-node--crowded .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.04*var(--orbit-speck-radius))}.orbit-label{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;gap:2px;width:max-content;color:var(--_orbit-node-text);font-family:var(--_orbit-label-font);font-size:13px;font-weight:var(--_orbit-label-weight);line-height:1.22;text-align:center;letter-spacing:var(--_orbit-label-letter-spacing);overflow-wrap:break-word;hyphens:auto;will-change:transform,opacity;user-select:none}.orbit-label__icon{font-size:1.45em;line-height:1}.orbit-label__text{white-space:pre}.orbit-label--no-icon .orbit-label__icon{display:none}.orbit-label--sun{color:var(--_orbit-root-text);font-family:var(--_orbit-display-font);font-size:16px;font-weight:var(--_orbit-display-weight)}.orbit-label--node{font-size:12px}.orbit-label--light{color:var(--_orbit-node-text-inverse);text-shadow:var(--_orbit-label-shadow)}.orbit-label--outside{box-sizing:border-box;width:max-content;max-width:160px;padding:2px 8px;border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);font-size:11.5px;box-shadow:0 1px 2px rgba(15,23,42,.08)}.orbit-label--sun.orbit-label--outside{max-width:280px}.orbit-label--outside .orbit-label__icon{display:none}.orbit-label--outside .orbit-label__text{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;white-space:normal}.orbit-label--sun.orbit-label--outside .orbit-label__text{-webkit-line-clamp:2;line-clamp:2}.orbit-label--wrapped{max-width:var(--orbit-pill-width, 120px);border-radius:11px}.orbit-label--wrapped .orbit-label__text{-webkit-line-clamp:2;line-clamp:2}.orbit-count{position:absolute;top:0;left:0;padding:1px 6px;border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-muted-text);z-index:1;font-size:10.5px;font-weight:650;line-height:13px;font-variant-numeric:tabular-nums;translate:-50% -50%;pointer-events:none}.orbit-actions{position:absolute;top:0;left:0;display:flex;flex-wrap:wrap;justify-content:center;gap:8px;translate:-50% 0;opacity:0;visibility:hidden;transition:opacity 180ms ease,visibility 0s linear 180ms;pointer-events:auto}.orbit-actions--visible{opacity:1;visibility:visible;transition:opacity 220ms ease 60ms}.orbit-action{display:inline-grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--_orbit-action-border);border-radius:999px;background:var(--_orbit-action-background);color:var(--_orbit-action-text);box-shadow:var(--_orbit-action-shadow);cursor:pointer;transition:transform 160ms ease,box-shadow 160ms ease}.orbit-action:hover{transform:translateY(-1px)}.orbit-action:active{transform:scale(0.96)}.orbit-action:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-add{cursor:pointer;outline:none}.orbit-add__body{transform-origin:0 0;transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-add:hover .orbit-add__body{transform:scale(1.06)}.orbit-add:active .orbit-add__body{transform:scale(0.95)}.orbit-add__disc{fill:var(--_orbit-control-background);fill-opacity:.5;stroke:var(--_orbit-muted-text);stroke-opacity:.6;stroke-width:1.5;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;transition:fill-opacity 160ms ease,stroke-opacity 160ms ease}.orbit-add:hover .orbit-add__disc{fill-opacity:.8;stroke-opacity:.9}.orbit-add__plus{fill:none;stroke:var(--_orbit-muted-text);stroke-width:2.5;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none}.orbit-add__focus-ring{fill:none;stroke:var(--_orbit-focus-ring);stroke-width:2.5;vector-effect:non-scaling-stroke;opacity:0;pointer-events:none;transition:opacity 120ms ease}.orbit-add:focus-visible .orbit-add__focus-ring{opacity:1}.orbit-add--pending .orbit-add__disc{fill-opacity:1;stroke:var(--_orbit-focus-ring);stroke-opacity:1;stroke-width:2;stroke-dasharray:none}.orbit-add--pending .orbit-add__plus{display:none}.orbit-add--drop .orbit-add__plus{display:none}.orbit-add--drop .orbit-add__disc{fill-opacity:.35;stroke:var(--_orbit-focus-ring);stroke-opacity:.9}.orbit-add--drop .orbit-add__body{animation:orbit-drop-place 900ms ease-in-out infinite alternate}.orbit-add--waiting{opacity:.45}.orbit-add--held{pointer-events:none}.orbit-add--waiting .orbit-add__body{animation:none}@keyframes orbit-drop-place{from{transform:scale(0.92)}to{transform:scale(1)}}.orbit-node--editing .orbit-node__focus-ring{display:inline}.orbit-node--lifted .orbit-node__body{transform:scale(1.12)}.orbit-node--lifted .orbit-node__shadow{opacity:min(1,var(--_orbit-node-shadow-opacity)*1.6);transform:translate(0, calc(var(--_orbit-node-shadow-offset) * 2.5px)) scale(calc(var(--_orbit-node-shadow-size) * 1.08))}.orbit-node--drop-target .orbit-node__body{transform:scale(1.1)}.orbit-node--drop-target .orbit-node__focus-ring{display:inline}.orbit__carried{pointer-events:none}.orbit-editor{position:absolute;top:0;left:0;box-sizing:border-box;display:block;min-height:0;margin:0;padding:1px 2px;overflow:hidden;border:none;border-radius:6px;outline:none;background:rgba(0,0,0,0);color:var(--_orbit-node-text);caret-color:var(--_orbit-focus-ring);font-family:var(--_orbit-label-font);font-size:16px;font-weight:var(--_orbit-label-weight);line-height:1.22;letter-spacing:var(--_orbit-label-letter-spacing);text-align:center;white-space:pre-wrap;overflow-wrap:break-word;resize:none;pointer-events:auto;user-select:text;-webkit-user-select:text}.orbit-editor::placeholder{color:currentColor;opacity:.45}.orbit-editor--sun{color:var(--_orbit-root-text);font-family:var(--_orbit-display-font);font-weight:var(--_orbit-display-weight)}.orbit-editor--light{color:var(--_orbit-node-text-inverse)}.orbit-editor--slot{color:var(--_orbit-control-text)}.orbit-editor--floating{padding:4px 8px;border-radius:10px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);box-shadow:var(--_orbit-control-shadow)}.orbit-editor[hidden]{display:none}.orbit-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:24px;color:var(--_orbit-muted-text);font-size:13px;text-align:center;pointer-events:none}.orbit-empty strong{color:var(--_orbit-text);font-size:15px;font-weight:650}.orbit-outline--visible{position:absolute;top:60px;bottom:12px;left:12px;width:min(320px,100% - 24px);padding:8px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--_orbit-control-border);border-radius:14px;background:var(--_orbit-control-background);box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));-webkit-backdrop-filter:blur(var(--_orbit-control-blur));color:var(--_orbit-control-text);font-size:13px;z-index:1}.orbit-outline--visible ul{margin:0;padding:0;list-style:none}.orbit-outline--visible ul ul{margin-left:10px;padding-left:10px;border-left:1px solid var(--_orbit-control-border)}.orbit-outline--visible button,.orbit-outline--visible span{display:block;width:100%;padding:5px 8px;border:0;border-radius:8px;background:none;color:inherit;font:inherit;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.orbit-outline--visible button{cursor:pointer}.orbit-outline--visible button:hover{background:color-mix(in srgb, var(--_orbit-control-text) 8%, transparent)}.orbit-outline--visible button:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:-2px}.orbit-outline--visible button[aria-current=true]{background:var(--_orbit-control-active-background);color:var(--_orbit-control-active-text)}.orbit-tooltip{position:absolute;top:0;left:0;max-width:260px;padding:8px 12px;border-radius:10px;background:var(--_orbit-tooltip-background);color:var(--_orbit-tooltip-text);font-size:12.5px;line-height:1.4;box-shadow:0 8px 24px rgba(15,23,42,.18);pointer-events:none;translate:-50% calc(-100% - 10px);opacity:0;transition:opacity 140ms ease}.orbit-tooltip--visible{opacity:1}.orbit-tooltip__title{display:block;font-weight:650}.orbit-tooltip__detail{display:block;margin-top:2px;opacity:.82}.orbit-controls{position:absolute;inset:0;pointer-events:none}.orbit-controls__top{position:absolute;top:12px;right:12px;left:12px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.orbit-controls__start{display:flex;align-items:center;gap:8px;min-width:0}.orbit-controls__zoom{position:absolute;right:12px;bottom:12px}.orbit-panel{display:inline-flex;align-items:center;gap:2px;min-width:0;padding:3px;border:1px solid var(--_orbit-control-border);border-radius:12px;background:var(--_orbit-control-background);box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));-webkit-backdrop-filter:blur(var(--_orbit-control-blur));pointer-events:auto}.orbit-panel--vertical{flex-direction:column}.orbit-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:32px;height:32px;padding:0 8px;border:0;border-radius:9px;background:rgba(0,0,0,0);color:var(--_orbit-control-muted-text);font:inherit;font-size:12.5px;font-weight:600;white-space:nowrap;cursor:pointer;transition:background-color 140ms ease,color 140ms ease}.orbit-button:hover{color:var(--_orbit-control-text);background:color-mix(in srgb, var(--_orbit-control-text) 8%, transparent)}.orbit-button:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:1px}.orbit-button[aria-pressed=true],.orbit-button--active{background:var(--_orbit-control-active-background);color:var(--_orbit-control-active-text)}.orbit-button--icon{width:32px;padding:0}.orbit-breadcrumbs{display:flex;align-items:center;min-width:0}.orbit-breadcrumbs__item{max-width:180px;min-width:0}.orbit-breadcrumbs__item span{overflow:hidden;text-overflow:ellipsis}.orbit-breadcrumbs__item[aria-current=location]{color:var(--_orbit-control-text);cursor:default}.orbit-breadcrumbs__separator{flex:none;width:14px;height:14px;color:var(--_orbit-control-muted-text);opacity:.7}.orbit-back{display:none;max-width:180px}.orbit-back span{overflow:hidden;text-overflow:ellipsis}.orbit-hint{position:absolute;left:50%;bottom:16px;padding:7px 14px;border:1px solid var(--_orbit-control-border);border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);font-size:12.5px;font-weight:600;box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));translate:-50% 0;opacity:0;transition:opacity 200ms ease;pointer-events:none}.orbit-hint--visible{opacity:1}.orbit--narrow .orbit-controls__crumbs{display:none}.orbit--narrow .orbit-back{display:inline-flex}.orbit--narrow .orbit-segmented__label{display:none}@media(pointer: coarse){.orbit-button{min-width:40px;height:40px}.orbit-button--icon{width:40px}.orbit-action{width:42px;height:42px}}.orbit-sheet{box-sizing:border-box;width:min(560px,100vw - 32px);max-height:86vh;max-height:min(86vh,86dvh);margin:auto;padding:0;border:1px solid var(--_orbit-sheet-border);border-radius:20px;background:var(--_orbit-sheet-background);color:var(--_orbit-sheet-text);font-family:var(--_orbit-font-family);box-shadow:var(--_orbit-sheet-shadow);backdrop-filter:blur(var(--_orbit-sheet-blur));-webkit-backdrop-filter:blur(var(--_orbit-sheet-blur));overflow:hidden}.orbit-sheet[open]{display:flex;flex-direction:column;animation:orbit-sheet-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-sheet::backdrop{background:var(--_orbit-sheet-backdrop);backdrop-filter:blur(6px)}.orbit-sheet__header{display:flex;align-items:flex-start;gap:12px;padding:20px 20px 12px 24px}.orbit-sheet__handle{display:none}.orbit-sheet__heading{flex:1;min-width:0}.orbit-sheet__path{margin:0 0 4px;color:var(--_orbit-sheet-muted-text);font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.orbit-sheet__title{margin:0;font-family:var(--_orbit-display-font);font-size:20px;font-weight:var(--_orbit-display-weight);line-height:1.25;overflow-wrap:anywhere}.orbit-sheet__chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}.orbit-sheet__chip{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;background:var(--_orbit-chip-background);color:var(--_orbit-chip-text);font-size:12px;font-weight:600}.orbit-sheet__chip::before{content:\"\";display:none;width:7px;height:7px;border-radius:50%;background:currentColor}.orbit-sheet__chip--status::before{display:block;background:var(--orbit-chip-dot, var(--_orbit-status-neutral))}.orbit-sheet__chip--type{background:none;box-shadow:inset 0 0 0 1px var(--_orbit-chip-background)}.orbit-sheet__details{margin-bottom:16px}.orbit-sheet__actions{display:flex;flex-wrap:wrap;gap:8px;margin-left:auto}.orbit-sheet__action{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid var(--_orbit-sheet-border);border-radius:999px;background:none;color:var(--_orbit-sheet-text);font:inherit;font-size:14px;font-weight:600;cursor:pointer}.orbit-sheet__action:hover{background:color-mix(in srgb, var(--_orbit-sheet-text) 8%, transparent)}.orbit-sheet__action:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-sheet__action .orbit-icon{width:16px;height:16px}.orbit-sheet__action .orbit-icon--glyph{font-size:14px}.orbit-sheet__close{flex:none}.orbit-sheet__body{flex:1;min-height:0;padding:0 24px 20px;overflow:auto;overscroll-behavior:contain;font-size:15px;line-height:1.6}.orbit-sheet__media{margin:0 0 16px}.orbit-sheet__media img,.orbit-sheet__media video{display:block;width:100%;max-height:60vh;object-fit:contain;border-radius:12px;background:var(--_orbit-chip-background)}.orbit-sheet__media iframe{display:block;width:100%;aspect-ratio:16/9;border:0;border-radius:12px;background:#000}.orbit-sheet__media figcaption{margin-top:8px;color:var(--_orbit-sheet-muted-text);font-size:13px}.orbit-sheet__picture{display:block;width:100%;padding:0;border:0;border-radius:12px;background:none;cursor:zoom-in}.orbit-sheet__picture:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-sheet__expand{display:inline-flex;align-items:center;gap:6px;margin-top:8px;padding:5px 12px;border:1px solid var(--_orbit-sheet-border);border-radius:999px;background:none;color:var(--_orbit-sheet-text);font:inherit;font-size:13px;font-weight:600;cursor:pointer}.orbit-sheet__expand:hover{background:color-mix(in srgb, var(--_orbit-sheet-text) 8%, transparent)}.orbit-sheet__expand:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-sheet__expand .orbit-icon{width:16px;height:16px}.orbit-sheet__note>:first-child{margin-top:0}.orbit-sheet__note>:last-child{margin-bottom:0}.orbit-sheet__note p,.orbit-sheet__note ul,.orbit-sheet__note ol,.orbit-sheet__note blockquote,.orbit-sheet__note pre{margin:0 0 12px}.orbit-sheet__note ul,.orbit-sheet__note ol{padding-left:22px}.orbit-sheet__note h3,.orbit-sheet__note h4,.orbit-sheet__note h5{margin:18px 0 8px;font-size:15px;font-weight:650}.orbit-sheet__note a{color:var(--_orbit-link-text);text-underline-offset:2px}.orbit-sheet__note code{padding:1px 5px;border-radius:6px;background:var(--_orbit-chip-background);font-size:.92em}.orbit-sheet__note pre{padding:12px;border-radius:10px;background:var(--_orbit-chip-background);overflow:auto}.orbit-sheet__note pre code{padding:0;background:none}.orbit-sheet__note blockquote{padding-left:12px;border-left:3px solid var(--_orbit-sheet-border);color:var(--_orbit-sheet-muted-text)}.orbit-sheet__footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px;border-top:1px solid var(--_orbit-sheet-border)}.orbit-sheet__link{padding:0;border:0;background:none;color:var(--_orbit-link-text);font:inherit;font-weight:600;text-decoration:none;cursor:pointer}.orbit-sheet .orbit-button{color:var(--_orbit-sheet-muted-text)}.orbit-sheet .orbit-button:hover{color:var(--_orbit-sheet-text);background:color-mix(in srgb, var(--_orbit-sheet-text) 8%, transparent)}@media(max-width: 640px){.orbit-sheet{width:100%;max-width:100%;max-height:88vh;max-height:88dvh;margin:auto 0 0;border-bottom:0;border-radius:20px 20px 0 0}.orbit-sheet[open]{animation-name:orbit-sheet-up}.orbit-sheet__handle{display:block;width:40px;height:5px;margin:8px auto 0;border-radius:999px;background:var(--_orbit-sheet-border);touch-action:none}}@media(min-width: 960px){.orbit-sheet{width:min(440px,40vw);height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;margin:0 0 0 auto;border-width:0 0 0 1px;border-radius:0}.orbit-sheet[open]{animation-name:orbit-sheet-side}.orbit-sheet::backdrop{backdrop-filter:none}}@keyframes orbit-sheet-side{from{transform:translateX(100%)}}@keyframes orbit-sheet-in{from{opacity:0;transform:translateY(8px) scale(0.98)}}@keyframes orbit-sheet-up{from{transform:translateY(100%)}}.orbit-viewer{position:fixed;inset:0;box-sizing:border-box;width:auto;height:auto;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:hidden;background:rgba(0,0,0,0);color:var(--_orbit-sheet-text);font-family:var(--_orbit-font-family);outline:none;overscroll-behavior:contain;touch-action:none}.orbit-viewer[open]{display:grid;grid-template-rows:auto minmax(0, 1fr) auto;animation:orbit-viewer-in 180ms ease-out}.orbit-viewer::backdrop{background:rgba(0,0,0,0)}.orbit-viewer::before{content:\"\";position:absolute;inset:0;background:var(--_orbit-sheet-background);backdrop-filter:blur(var(--_orbit-sheet-blur));-webkit-backdrop-filter:blur(var(--_orbit-sheet-blur));opacity:calc(1 - var(--_orbit-viewer-pull, 0)*.8)}.orbit-viewer__bar{grid-row:1;position:relative;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:40px;padding:max(12px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 4px max(16px,env(safe-area-inset-left));opacity:calc(1 - var(--_orbit-viewer-pull, 0))}.orbit-viewer__counter{margin:0;color:var(--_orbit-sheet-muted-text);font-size:13px;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}.orbit-viewer__tools{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-left:auto}.orbit-viewer__stage{grid-row:2;position:relative;overflow:hidden;touch-action:none}.orbit-viewer__media{position:absolute;inset:0}.orbit-viewer__media--entering{animation:orbit-viewer-show 200ms ease-out}.orbit-viewer--settling .orbit-viewer__media{transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-viewer__picture{position:absolute;box-sizing:content-box;max-width:none;max-height:none;margin:0;padding:0;border:0;transform-origin:center;cursor:zoom-in;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.orbit-viewer__picture--gliding{transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-viewer--zoomed .orbit-viewer__picture{cursor:grab}.orbit-viewer--dragging .orbit-viewer__picture{cursor:grabbing}.orbit-viewer__player{position:absolute;overflow:hidden;border-radius:12px;background:#000;box-shadow:var(--_orbit-sheet-shadow)}.orbit-viewer__player iframe,.orbit-viewer__player video{display:block;width:100%;height:100%;border:0;background:#000}.orbit-viewer__status{position:absolute;inset:0;display:grid;place-items:center;align-content:center;gap:12px;margin:0;padding:24px;color:var(--_orbit-sheet-muted-text);font-size:14px;text-align:center;pointer-events:none}.orbit-viewer__status--loading::before{content:\"\";width:28px;height:28px;border:3px solid currentColor;border-top-color:rgba(0,0,0,0);border-radius:50%;opacity:.7;animation:orbit-viewer-spin 800ms linear infinite}.orbit-viewer__step{position:absolute;top:calc(50% - 22px);width:44px;height:44px;border:1px solid var(--_orbit-control-border);border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));-webkit-backdrop-filter:blur(var(--_orbit-control-blur))}.orbit-viewer__step:hover{background:color-mix(in srgb, var(--_orbit-control-text) 8%, var(--_orbit-control-background))}.orbit-viewer__step:disabled{opacity:.4;cursor:default}.orbit-viewer__step--previous{left:max(12px,env(safe-area-inset-left))}.orbit-viewer__step--next{right:max(12px,env(safe-area-inset-right))}.orbit-viewer__caption{grid-row:3;position:relative;max-height:30vh;padding:6px max(24px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));overflow:auto;overscroll-behavior:contain;touch-action:pan-y;text-align:center;opacity:calc(1 - var(--_orbit-viewer-pull, 0))}.orbit-viewer__title{max-width:72ch;margin:0 auto;font-family:var(--_orbit-display-font);font-size:17px;font-weight:var(--_orbit-display-weight);line-height:1.3;overflow-wrap:anywhere}.orbit-viewer__text,.orbit-viewer__description{max-width:72ch;margin:4px auto 0;font-size:14px;line-height:1.5;overflow-wrap:anywhere}.orbit-viewer__description{color:var(--_orbit-sheet-muted-text);font-size:13px}.orbit-viewer--still .orbit-viewer__bar,.orbit-viewer--still .orbit-viewer__step{display:none}.orbit-viewer--still .orbit-viewer__media{pointer-events:none}@media(max-width: 640px){.orbit-viewer__bar{padding-right:max(12px,env(safe-area-inset-right));padding-left:max(12px,env(safe-area-inset-left))}.orbit-viewer__tools{gap:6px}.orbit-viewer__step--previous{left:max(8px,env(safe-area-inset-left))}.orbit-viewer__step--next{right:max(8px,env(safe-area-inset-right))}.orbit-viewer__caption{padding-right:max(16px,env(safe-area-inset-right));padding-left:max(16px,env(safe-area-inset-left))}.orbit-viewer__title{font-size:16px}}@keyframes orbit-viewer-in{from{opacity:0}}@keyframes orbit-viewer-show{from{opacity:0;transform:scale(0.98)}}@keyframes orbit-viewer-spin{to{transform:rotate(360deg)}}.orbit-error{box-sizing:border-box;margin:12px;padding:14px 16px;border:1px dashed var(--_orbit-error-border);border-radius:12px;background:var(--_orbit-error-background);color:var(--_orbit-error-text);font:14px/1.45 var(--_orbit-font-family)}@supports not (color: color-mix(in srgb, red, blue)){.orbit-ring{stroke:var(--_orbit-ring-stroke)}.orbit-link{stroke:var(--_orbit-link-stroke)}.orbit-shade__highlight-fade{stop-color:var(--_orbit-node-highlight);stop-opacity:.2}.orbit-node__shadow{fill:var(--_orbit-node-shadow)}.orbit-node__halo{stroke:var(--_orbit-sun-halo)}.orbit-node__shade{stroke:var(--_orbit-node-stroke)}.orbit-outline--visible button:hover,.orbit-button:hover,.orbit-sheet__action:hover,.orbit-sheet__expand:hover,.orbit-sheet .orbit-button:hover{background:rgba(127,127,127,.14)}.orbit-viewer__step:hover{background:var(--_orbit-control-background)}}@supports not (translate: 1px){.orbit-hint{transform:translateX(-50%)}}@media(prefers-reduced-motion: reduce){.orbit *,.orbit-sheet,.orbit-viewer{transition:none !important;animation:none !important}}@media(forced-colors: active){.orbit-node__focus-ring,.orbit-add__focus-ring{stroke:Highlight}.orbit-add__disc,.orbit-add__plus{stroke:CanvasText}.orbit-node__shade,.orbit-node__halo{stroke:CanvasText}.orbit-node__shadow{display:none}.orbit-button[aria-pressed=true]{outline:2px solid Highlight}}";var Oa=xa+Is(),wa=new WeakSet,ka=null,Sa=(t)=>{let e=lh(t);if(!e||wa.has(e))return;if(wa.add(e),"adoptedStyleSheets"in e&&typeof CSSStyleSheet==="function"&&"replaceSync"in CSSStyleSheet.prototype)try{ka??=ah(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,ka];return}catch{}let n=(t.ownerDocument??document).createElement("style");if(n.setAttribute("data-orbit-styles",""),n.textContent=Oa,Ma(e))e.appendChild(n);else(e.head??e.documentElement).appendChild(n)},ah=()=>{let t=new CSSStyleSheet;return t.replaceSync(Oa),t},lh=(t)=>{let e=t.getRootNode?.();if(e&&Ma(e))return e;return t.ownerDocument??(typeof document>"u"?null:document)},Ma=(t)=>typeof ShadowRoot<"u"&&t instanceof ShadowRoot;class Mr{element=null;container;callbacks;pointers=new Map;gesture="none";engaged=!1;startPoint=null;lastPoint=null;lastPinchDistance=null;lastPinchCenter=null;suppressNextClick=!1;lastTap=null;longPress=null;pressTaken=!1;lifted=!1;constructor(t,e){this.container=t,this.callbacks=e}attach(t){if(this.element===t)return;this.detach(),this.element=t,t.addEventListener("pointerdown",this.handlePointerDown),t.addEventListener("pointermove",this.handlePointerMove),t.addEventListener("pointerup",this.handlePointerUp),t.addEventListener("pointercancel",this.handlePointerUp),t.addEventListener("wheel",this.handleWheel,{passive:!1}),t.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),t.addEventListener("dblclick",this.handleDoubleClick),t.addEventListener("click",this.handleClickCapture,!0)}detach(){let t=this.element;if(!t)return;t.removeEventListener("pointerdown",this.handlePointerDown),t.removeEventListener("pointermove",this.handlePointerMove),t.removeEventListener("pointerup",this.handlePointerUp),t.removeEventListener("pointercancel",this.handlePointerUp),t.removeEventListener("wheel",this.handleWheel),t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("dblclick",this.handleDoubleClick),t.removeEventListener("click",this.handleClickCapture,!0),this.element=null,this.reset()}reset(){if(this.lifted||this.gesture==="move")this.callbacks.onNodeDrag(this.lastPoint??{x:0,y:0},"cancel");if(this.engaged)this.callbacks.onDraggingChange(!1);this.cancelLongPress(),this.pressTaken=!1,this.lifted=!1,this.pointers.clear(),this.gesture="none",this.engaged=!1,this.startPoint=null,this.lastPoint=null,this.lastPinchDistance=null,this.lastPinchCenter=null}localPoint(t){let e=this.container.getBoundingClientRect(),n=Number.isFinite(t.clientX)?t.clientX-e.left:e.width/2,i=Number.isFinite(t.clientY)?t.clientY-e.top:e.height/2;return{x:n,y:i}}angleOf(t){let e=this.callbacks.spinCenter();return Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI}pinchDistance(){if(this.pointers.size<2)return null;let[t,e]=Array.from(this.pointers.values());return Math.hypot(t.x-e.x,t.y-e.y)}pinchCenter(){let[t,e]=Array.from(this.pointers.values());return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}handleClickCapture=(t)=>{if(!this.suppressNextClick)return;this.suppressNextClick=!1,t.stopPropagation(),t.preventDefault()};handlePointerDown=(t)=>{if(!this.callbacks.isInteractive())return;if(t.pointerType==="mouse"&&t.button!==0)return;let e=this.localPoint(t);if(this.pointers.set(t.pointerId,e),this.suppressNextClick=!1,this.cancelLongPress(),this.pointers.size===2){if(this.lifted||this.gesture==="move")this.lifted=!1,this.callbacks.onNodeDrag(this.lastPoint??e,"cancel");if(this.engaged&&this.gesture==="spin")this.callbacks.onSpinEnd(t.timeStamp,!0);else if(this.engaged&&this.gesture==="pan")this.callbacks.onPanEnd(t.timeStamp,!0);if(!this.engaged)this.callbacks.onDraggingChange(!0);this.gesture="pinch",this.engaged=!0,this.lastPinchDistance=this.pinchDistance(),this.lastPinchCenter=this.pinchCenter();return}if(this.pointers.size>2)return;let n=this.callbacks.isCoasting();if(n)this.callbacks.onCatch(),this.suppressNextClick=!0;this.startPoint=e,this.lastPoint=e,this.engaged=!1,this.pressTaken=!1;let i=this.callbacks.dragGesture(e);if(this.gesture=i==="none"?"tap":i,!n)this.startLongPress(t.pointerId,e,t.target,t.pointerType==="mouse")};startLongPress(t,e,n,i){let r=setTimeout(()=>{if(this.longPress=null,this.engaged||this.pointers.size!==1)return;let o=!i&&this.callbacks.onLongPress(e,n),s=this.callbacks.onHold(e,n);if(!o&&!s)return;if(this.lifted=s,this.lastTap=null,i)return;this.pressTaken=!0,this.gesture="none",this.suppressNextClick=!0},this.callbacks.longPressDelay());this.longPress={pointerId:t,timer:r}}cancelLongPress(){if(this.longPress)clearTimeout(this.longPress.timer),this.longPress=null}handlePointerMove=(t)=>{if(!this.pointers.has(t.pointerId))return;let e=this.localPoint(t);if(this.pointers.set(t.pointerId,e),this.gesture==="pinch"){let s=this.pinchDistance();if(s===null)return;let a=this.pinchCenter(),l=this.lastPinchCenter??a,d=this.lastPinchDistance?s/this.lastPinchDistance:1;this.callbacks.onPinch(d,a,a.x-l.x,a.y-l.y),this.lastPinchDistance=s,this.lastPinchCenter=a;return}if(!this.startPoint||!this.lastPoint)return;let n=Math.hypot(e.x-this.startPoint.x,e.y-this.startPoint.y),i=t.pointerType==="mouse"?4:8;if(this.longPress&&n>=i)this.cancelLongPress();if(this.lifted&&this.gesture!=="move"){if(n<i)return;this.gesture="move",this.engaged=!0,this.callbacks.onDraggingChange(!0);try{this.element?.setPointerCapture?.(t.pointerId)}catch{}}if(this.gesture==="move"){this.lastPoint=e,this.callbacks.onNodeDrag(e,"move");return}if(this.gesture!=="spin"&&this.gesture!=="pan")return;if(!this.engaged){if(n<i)return;this.cancelLongPress(),this.engaged=!0,this.callbacks.onDraggingChange(!0);try{this.element?.setPointerCapture?.(t.pointerId)}catch{}if(this.gesture==="spin")this.callbacks.onSpinStart(t.timeStamp,this.angleOf(e));else this.callbacks.onPanStart(t.timeStamp)}let r=typeof t.getCoalescedEvents==="function"?t.getCoalescedEvents():[],o=r.length>0?r.map((s)=>({point:this.localPoint(s),time:s.timeStamp})):[{point:e,time:t.timeStamp}];for(let s of o){if(this.gesture==="spin")this.callbacks.onSpinMove(s.time,this.angleOf(s.point));else this.callbacks.onPan(s.point.x-this.lastPoint.x,s.point.y-this.lastPoint.y,s.time);this.lastPoint=s.point}};handlePointerUp=(t)=>{if(!this.pointers.delete(t.pointerId))return;this.cancelLongPress();let e=this.localPoint(t);if(this.gesture==="pinch"){if(this.pointers.size===1){this.callbacks.onPinchEnd();let i=Array.from(this.pointers.values())[0];if(this.lastPinchDistance=null,this.lastPinchCenter=null,this.startPoint=i,this.lastPoint=i,this.callbacks.dragGesture(i)==="pan")this.gesture="pan",this.callbacks.onPanStart(t.timeStamp);else this.gesture="none";this.suppressNextClick=!0;return}if(this.pointers.size===0){this.callbacks.onPinchEnd(),this.suppressNextClick=!0,this.reset();return}this.lastPinchDistance=this.pinchDistance(),this.lastPinchCenter=this.pinchCenter();return}if(this.pointers.size>0)return;let n=t.type==="pointercancel";if(this.lifted||this.gesture==="move")this.lifted=!1,this.callbacks.onNodeDrag(e,n?"cancel":"drop"),this.gesture="none";if(this.engaged){if(this.suppressNextClick=!n,this.gesture==="spin")this.callbacks.onSpinEnd(t.timeStamp,n);else if(this.gesture==="pan")this.callbacks.onPanEnd(t.timeStamp,n)}else if(t.pointerType!=="mouse"&&t.type==="pointerup"&&!this.pressTaken)this.detectDoubleTap(e,t.timeStamp,t.target);this.reset()};detectDoubleTap(t,e,n){let i=this.lastTap;if(i&&e-i.time<320&&Math.hypot(t.x-i.point.x,t.y-i.point.y)<28){this.lastTap=null,this.callbacks.onDoubleTap(t,n);return}this.lastTap={time:e,point:t}}handleDoubleClick=(t)=>{if(!this.callbacks.isInteractive())return;this.callbacks.onDoubleTap(this.localPoint(t),t.target)};handleTouchMove=(t)=>{if((this.lifted||this.gesture==="move")&&t.cancelable)t.preventDefault()};handleWheel=(t)=>{if(!this.callbacks.isInteractive())return;this.callbacks.onWheel(t,this.localPoint(t))}}var Ln=(t,e)=>{let n=t.deltaY;if(t.deltaMode===1)n*=16;else if(t.deltaMode===2)n*=e;let i=t.ctrlKey&&t.deltaMode===0&&Math.abs(t.deltaY)<50,r=Math.exp(-n*0.002*(i?5:1));return Math.min(2,Math.max(0.5,r))};class Er{paint;schedule;cancel;tasks=new Set;frameHandle=null;previousTime=null;paintRequested=!1;constructor(t,e=(i)=>requestAnimationFrame(i),n=(i)=>cancelAnimationFrame(i)){this.paint=t,this.schedule=e,this.cancel=n}add(t){return this.tasks.add(t),this.wake(),()=>{this.tasks.delete(t)}}requestPaint(){this.paintRequested=!0,this.wake()}get isRunning(){return this.frameHandle!==null}stop(){if(this.frameHandle!==null)this.cancel(this.frameHandle);this.frameHandle=null,this.previousTime=null,this.tasks.clear(),this.paintRequested=!1}wake(){if(this.frameHandle===null)this.frameHandle=this.schedule(this.tick)}tick=(t)=>{let e=this.previousTime===null?16.666666666666668:Math.min(64,Math.max(0,t-this.previousTime));this.previousTime=t;let n=this.paintRequested;for(let i of Array.from(this.tasks)){let r;try{r=i(t,e)}catch(o){console.error("[orbit] An animation task threw:",o),r=!1}if(r===!1)this.tasks.delete(i);n||=r!=="hold"}if(this.paintRequested=!1,n)try{this.paint()}catch(i){console.error("[orbit] Painting the map threw:",i)}if(this.tasks.size>0||this.paintRequested)this.frameHandle=this.schedule(this.tick);else this.frameHandle=null,this.previousTime=null}}var Nr=(t)=>t<0.5?4*t*t*t:1-(-2*t+2)**3/2;var et=(t,e,n)=>{if(t<=e)return 0;if(t>=n)return 1;return(t-e)/(n-e)},nt=(t,e,n)=>t+(e-t)*n;var J=(t,e,n)=>({x:(n.x-t.x)*t.scale+e.width/2,y:(n.y-t.y)*t.scale+e.height/2}),Pe=(t,e,n)=>({x:(n.x-e.width/2)/t.scale+t.x,y:(n.y-e.height/2)/t.scale+t.y}),Ea=(t,e)=>`translate(${De(e.width/2)} ${De(e.height/2)}) scale(${De(t.scale,5)}) translate(${De(-t.x)} ${De(-t.y)})`,Tr=(t,e,n,i)=>{let r=Pe(t,e,i),o=t.scale*n;return{scale:o,x:r.x-(i.x-e.width/2)/o,y:r.y-(i.y-e.height/2)/o}},Na=(t,e,n)=>({scale:t.scale,x:t.x-e/t.scale,y:t.y-n/t.scale}),dh={top:0,right:0,bottom:0,left:0},Ta=(t,e,n,i,r,o=dh)=>{let s=Math.max(1,n.width-o.left-o.right),a=Math.max(1,n.height-o.top-o.bottom),l=Math.max(s-i*2,s*0.35),d=Math.max(a-i*2,a*0.35),c=Math.min(e.x>0?l/(e.x*2):r,e.y>0?d/(e.y*2):r,r),u=c>0&&Number.isFinite(c)?c:1;return{x:t.x-(o.left-o.right)/2/u,y:t.y-(o.top-o.bottom)/2/u,scale:u}},Re={scale:1,x:0,y:0},te=(t,e)=>({x:e.x*t.scale+t.x,y:e.y*t.scale+t.y});var Fa=(t,e)=>{let n=te(t,e);return{x:n.x,y:n.y,scale:e.scale/t.scale}},Le=Math.SQRT2;var Fr=(t,e,n)=>{let i=Math.max(n.width,1),{x:r,y:o}=t,s=i/t.scale,a=i/e.scale,l=e.x-t.x,d=e.y-t.y,c=l*l+d*d;if(c<0.000000000001){let y=Math.log(a/s)/Le;return{length:Math.abs(y),at:(x)=>({x:r+x*l,y:o+x*d,scale:i/(s*Math.exp(Le*x*y))})}}let u=Math.sqrt(c),h=(a*a-s*s+4*c)/(2*s*2*u),m=(a*a-s*s-4*c)/(2*a*2*u),p=Math.log(Math.sqrt(h*h+1)-h),g=(Math.log(Math.sqrt(m*m+1)-m)-p)/Le,f=Math.cosh(p);return{length:Math.abs(g),at:(y)=>{let x=y*g,O=s/(2*u)*(f*Math.tanh(Le*x+p)-Math.sinh(p)),M=s*f/Math.cosh(Le*x+p);return{x:r+O*l,y:o+O*d,scale:i/M}}}},De=(t,e=3)=>{let n=10**e;return Math.round(t*n)/n};var zt=(t)=>{let e=t%360;if(e>180)e-=360;else if(e<=-180)e+=360;return e};class Cr{samples=[];lastRawAngle=0;unwrappedAngle=0;reset(t,e){this.lastRawAngle=e,this.unwrappedAngle=e,this.samples=[{time:t,angle:e}]}add(t,e){let n=zt(e-this.lastRawAngle);this.lastRawAngle=e,this.unwrappedAngle+=n,this.samples.push({time:t,angle:this.unwrappedAngle});while(this.samples.length>2&&t-this.samples[0].time>160)this.samples.shift();return n}velocityAt(t){let e=this.samples.filter((s)=>t-s.time<=80);if(e.length<2||t-e[e.length-1].time>50)return 0;let n=e.reduce((s,a)=>s+a.time,0)/e.length,i=e.reduce((s,a)=>s+a.angle,0)/e.length,r=0,o=0;for(let s of e)r+=(s.time-n)*(s.angle-i),o+=(s.time-n)**2;return o===0?0:r/o}}var Ar={decay:1.4,maxSpeed:1440,settleSpeed:30,snap:!1},_r=10;class Ir{angle=0;velocity=0;mode="idle";settings;settleTarget=0;slots=[];constructor(t={}){this.settings={...Ar,...t}}grab(){this.mode="dragging",this.velocity=0}drag(t){this.angle+=t}release(t,e=[]){this.slots=e;let n=this.settings.maxSpeed/1000;if(this.velocity=Math.max(-n,Math.min(n,t)),Math.abs(this.velocity)*1000>=this.settings.settleSpeed)this.mode="coasting";else this.beginSettling()}settleTo(t){this.settleTarget=this.angle+zt(t-this.angle),this.mode="settling"}stop(){this.mode="idle",this.velocity=0}get isMoving(){return this.mode==="coasting"||this.mode==="settling"}step(t){if(this.mode==="coasting"){let e=this.settings.decay*1000,n=Math.exp(-t/e);if(this.angle+=this.velocity*e*(1-n),this.velocity*=n,Math.abs(this.velocity)*1000<this.settings.settleSpeed)this.beginSettling();return!0}if(this.mode==="settling")return this.stepSettling(t);return!1}beginSettling(){if(!this.settings.snap||this.slots.length===0){this.stop();return}this.settleTarget=this.nearestSlot(this.angle),this.mode="settling"}nearestSlot(t){let e=t,n=1/0;for(let i of this.slots){let r=zt(i-t);if(Math.abs(r)<n)n=Math.abs(r),e=t+r}return e}stepSettling(t){let e=t/1000,n=this.velocity*1000;while(e>0){let i=Math.min(e,0.004),r=this.angle-this.settleTarget,o=-_r*_r*r-2*_r*n;n+=o*i,this.angle+=n*i,e-=i}if(this.velocity=n/1000,Math.abs(this.angle-this.settleTarget)<0.05&&Math.abs(n)<0.5)return this.angle=this.settleTarget,this.stop(),!1;return!0}}class Lr{samples=[];x=0;y=0;reset(t){this.x=0,this.y=0,this.samples=[{time:t,x:0,y:0}]}add(t,e,n){this.x+=e,this.y+=n,this.samples.push({time:t,x:this.x,y:this.y});while(this.samples.length>2&&t-this.samples[0].time>160)this.samples.shift()}velocityAt(t){let e=this.samples.filter((l)=>t-l.time<=80);if(e.length<2||t-e[e.length-1].time>50)return{x:0,y:0};let n=e.reduce((l,d)=>l+d.time,0)/e.length,i=e.reduce((l,d)=>l+d.x,0)/e.length,r=e.reduce((l,d)=>l+d.y,0)/e.length,o=0,s=0,a=0;for(let l of e){let d=l.time-n;o+=d*(l.x-i),s+=d*(l.y-r),a+=d*d}if(a===0)return{x:0,y:0};return{x:o/a,y:s/a}}}var _a=6,ch=0.02;class Dr{velocity={x:0,y:0};timeConstant;constructor(t=325){this.timeConstant=t}get isMoving(){return Math.hypot(this.velocity.x,this.velocity.y)>=ch}start(t){let e=Math.hypot(t.x,t.y),n=e>_a?_a/e:1;this.velocity={x:t.x*n,y:t.y*n}}stop(){this.velocity={x:0,y:0}}step(t){let e=Math.exp(-t/this.timeConstant),n=this.timeConstant*(1-e),i={x:this.velocity.x*n,y:this.velocity.y*n};if(this.velocity={x:this.velocity.x*e,y:this.velocity.y*e},!this.isMoving)this.stop();return i}}var uh=1.32,Ht=14,Da=34,Pa=18,Rr=76,Ra=48,hh=7,ph=2.15,mh=8,bh=12,fh=4,Pn=6,$r=2,Rn=(t,e)=>{let n=Math.min(e,Pn),i=Math.min(150,(n-1)*30);return{distance:t*1.45,radius:Math.min(7,Math.max(2.5,t*0.17)),offsets:Array.from({length:n},(r,o)=>n===1?0:-i/2+i*o/(n-1))}},$a=(t,e)=>{let{cx:n,cy:i,containerWidth:r,containerHeight:o}=e,a=e.maxDepth!==void 0&&t.level>=e.maxDepth?[]:ne(t),l=a.length,d=Wa(r,o),c=xt(d*0.115,Da,Rr),u=l===0?1:xt(Math.pow(10/l,0.32),0.58,1.1),h=xt(d*0.074*u,Pa,Ra),m=a.every((O)=>ne(O).length===0),p=Ca(l,c,h,d,m);if(p.rings.length>=fh){let O=Math.min(Rr,c*(1+0.06*(p.rings.length-1)));if(O>c)c=O,p=Ca(l,c,h,d,m)}let b=e.keptRings;if(b&&b.length===p.rings.length)p.rings=p.rings.map((O,M)=>Math.max(O,b[M]));else{let O=e.maxDepth!==void 0&&t.level+1>=e.maxDepth,M=a.map((w)=>O?0:Math.min(ne(w).length,Pn));vh(p,h,M)}let g=p.rings[p.rings.length-1]??0,f={...t,parent:t.parent,x:n,y:i,radius:c,angle:-90,orbitRadius:0},y=[],x=0;return p.rings.forEach((O,M)=>{let w=p.counts[M]??0,v=360/w,E=Ua(M,w);for(let k=0;k<w;k+=1){let _=a[x];if(!_)break;let D=E+v*k,Y=ee(D);y.push({..._,parent:_.parent,x:n+O*Math.cos(Y),y:i+O*Math.sin(Y),radius:h,angle:D,orbitRadius:O}),x+=1}}),{sun:f,planets:y,orbitRadius:g,orbitRings:p.rings}},Ba=(t,e,n=-90)=>{let i=Wa(e.containerWidth,e.containerHeight),r=xt(Math.pow(18/Ga(t),0.18),0.74,1.08),o=za(t,i,r,e.maxDepth??1/0),s=[];return Ha(o,e.cx,e.cy,n,0,s),s},Va=(t)=>{let e=[],n=new Set;for(let i of t){if(ne(i).length===0)continue;let r=t.find((d)=>d.parent?.id===i.id&&d.id!==i.id);if(!r)continue;let o=r.x-i.x,s=r.y-i.y,a=Math.sqrt(o*o+s*s),l=`${i.x.toFixed(1)},${i.y.toFixed(1)},${a.toFixed(1)}`;if(!n.has(l)&&a>10)n.add(l),e.push({centerId:i.id,cx:i.x,cy:i.y,r:a})}return e},za=(t,e,n,i)=>{let r=Oh(e,t.level,n),s=(i>0?ne(t):[]).map((c)=>za(c,e,n,i-1)),a=s.map((c)=>c.subtreeRadius),l=yh(r,a),d=a.length>0?Math.max(...a):0;return{node:t,radius:r,subtreeRadius:Math.max(r,l+d),childOrbitRadius:l,children:s}},gh=270,Ha=(t,e,n,i,r,o)=>{let s={...t.node,parent:t.node.parent,x:e,y:n,radius:t.radius,angle:i,orbitRadius:r};o.push(s);let a=t.children.length;if(a===0)return;let l=t.node.level===0,d=l||a===1,c=(a-1)*(360/a),u=d?360:Math.min(c,gh),h=a===1?0:d?360/a:u/(a-1),m=a===1?i:l?-90:i-u/2;t.children.forEach((p,b)=>{let g=m+h*b,f=ee(g),y=e+t.childOrbitRadius*Math.cos(f),x=n+t.childOrbitRadius*Math.sin(f);Ha(p,y,x,g,t.childOrbitRadius,o)})},yh=(t,e)=>{if(e.length===0)return 0;let n=Math.max(...e.map((s)=>t+s+Ht));if(e.length===1)return n;let i=2*Math.PI/e.length,r=2*Math.sin(i/2),o=e.reduce((s,a,l)=>{let d=e[(l+1)%e.length],c=((a+d)*uh+Ht)/r;return Math.max(s,c)},0);return Math.max(n,o)},Ca=(t,e,n,i,r=!1)=>{if(t===0)return{rings:[],counts:[],ringGap:0};let o=Aa(t,n,Math.max(i*0.26,e+n+Ht*1.3),n*ph+Ht,hh);if(!r||o.rings.length<=1)return o;let s=Aa(t,n,e+n+Ht,n*2+mh,bh);return(s.rings.at(-1)??0)<(o.rings.at(-1)??0)?s:o},Aa=(t,e,n,i,r)=>{let o=[],s=0;while(s<t&&o.length<r){let l=n+i*o.length;o.push(l),s+=ja(l,e)}let a=wh(t,o,e);return{rings:o,counts:a,ringGap:i}},Ua=(t,e)=>t%2===0?-90:-90+360/e/2,Dn=(t,e,n,i)=>{let r=t*Math.cos(ee(e)),o=t*Math.sin(ee(e)),{distance:s,radius:a,offsets:l}=Rn(n,i);return{planet:{x:r,y:o,radius:n},moons:l.map((d)=>({x:r+s*Math.cos(ee(e+d)),y:o+s*Math.sin(ee(e+d)),radius:a}))}},Pr=(t,e,n)=>Math.hypot(t.x-e.x,t.y-e.y)>=t.radius+e.radius+n,Ia=(t,e)=>t.moons.every((n)=>Pr(n,e.planet,$r)&&e.moons.every((i)=>Pr(n,i,n.radius)))&&e.moons.every((n)=>Pr(n,t.planet,$r)),La=(t,e)=>t.moons.every((n)=>Math.hypot(n.x-t.planet.x,n.y-t.planet.y)<Math.hypot(n.x-e.planet.x,n.y-e.planet.y)),vh=(t,e,n)=>{if(n.every((a)=>a===0))return;let i=Rn(e,1),r=2*(i.distance+i.radius)+Math.max($r,i.radius),o=0,s;t.rings.forEach((a,l)=>{let d=t.counts[l]??0,c=n.slice(o,o+d),u=Ua(l,d),h=360/Math.max(1,d),m=s?.planets.some((x)=>x.moons.length>0)?s:void 0,p=d<2?[]:[...new Set(c.map((x,O)=>`${x},${c[(O+1)%d]}`))].map((x)=>x.split(",").map(Number)),b=(x)=>p.every(([O,M])=>{let w=Dn(x,0,e,O),v=Dn(x,h,e,M);return Ia(w,v)&&La(w,v)&&La(v,w)}),g=(x)=>{if(!m)return!0;let O=m.planets.length,M=m.radius<=r?180:Sh(Math.asin(r/m.radius));return c.every((w,v)=>{let E=u+h*v,k=Dn(x,E,e,w),_=Math.floor((E-M-m.start)/m.step),D=Math.min(_+O-1,Math.ceil((E+M-m.start)/m.step));for(let Y=_;Y<=D;Y+=1){let S=m.planets[(Y%O+O)%O];if(Math.hypot(S.planet.x-k.planet.x,S.planet.y-k.planet.y)<r&&!Ia(S,k))return!1}return!0})},f=l===0?a:Math.max(a,t.rings[l-1]+t.ringGap),y=xh(f,e,(x)=>b(x)&&g(x));t.rings[l]=y,s={radius:y,start:u,step:h,planets:c.map((x,O)=>Dn(y,u+h*O,e,x))},o+=d})},xh=(t,e,n)=>{if(n(t))return t;let i=t,r=t+e;while(!n(r))i=r,r+=e;while(r-i>0.25){let o=(i+r)/2;if(n(o))r=o;else i=o}return r},wh=(t,e,n)=>{let i=e.map((a)=>ja(a,n)),r=[],o=t;for(let a=0;a<e.length;a+=1){let l=e.length-a,d=i[a]??o,c=a===e.length-1?o:Math.min(d,Math.ceil(o/l));r.push(c),o-=c}let s=e.length-1;if(s>=0)e[s]=Math.max(e[s],kh(n,r[s]??0));return r},ja=(t,e)=>{let n=e*2+Ht*0.85;if(n>=t*2)return 1;let i=2*Math.asin(n/(t*2));return Math.max(1,Math.floor(2*Math.PI/i))},kh=(t,e)=>{if(e<=1)return 0;let n=2*Math.sin(Math.PI/e);return(t*2+Ht*0.85)/n},Oh=(t,e,n)=>{if(e===0)return xt(t*0.115*n,Da,Rr);if(e===1)return xt(t*0.074*n,Pa,Ra);if(e===2)return xt(t*0.056*n,15,36);return xt(t*0.044*n,12,28)},Wa=(t,e)=>{let n=Math.min(t,e),i=Math.sqrt(t*e);return Math.min(i,n*1.25)},Ga=(t)=>1+ne(t).reduce((e,n)=>e+Ga(n),0),ne=(t)=>t.collapsed?[]:t.children,ee=(t)=>t*Math.PI/180,Sh=(t)=>t*180/Math.PI;var Ka="\x00orbit-add";var Mh=48,Eh=1.35,Nh=40,Th=48,Fh=(t,e)=>Math.min(e,Math.max(16,Math.min(t.width,t.height)*0.05)),Br=(t,e,n,i,r=0)=>{let o=Fh(n,t==="focus"?Nh:Th),s=Math.max(0,r-o),a=i??{top:0,right:0,bottom:0,left:0};return Ta({x:0,y:0},e,n,o,Eh,s>0?{...a,bottom:a.bottom+s}:a)},qa=(t,e,n,i=0)=>Br(t.kind,t.extent,e,n,i),_h=7,Vr=(t,e,n=(i)=>i.color)=>{let i=new Map,r=e.length>1?e.slice(1):e;return i.set(t.id,n(t)??e[0]),t.children.forEach((o,s)=>{let a=n(o)??r[s%r.length];i.set(o.id,a);let l=(d,c)=>{d.children.forEach((u,h)=>{let m=n(u);i.set(u.id,m??Ch(c,h)),l(u,m??c)})};l(o,a)}),i},Ya=[[100,"light"],[78,"light"],[86,"dark"],[62,"light"],[76,"dark"]],Ch=(t,e)=>{let[n,i]=Ya[e%Ya.length];return n===100||!Ai.mixesColors?t:`color-mix(in oklab, ${t} ${n}%, var(--_orbit-shade-${i}))`},Ah=(t,e)=>{let n=e?t.find((o)=>o.id===e.id):void 0;if(!e||!n)return t;let i=t.filter((o)=>o!==n),r=Math.min(i.length,Math.max(0,Math.trunc(e.index)));return[...i.slice(0,r),n,...i.slice(r)]},Za=(t,e)=>{if(t.collapsed)return[];if(e!==void 0&&t.level>=e)return[];return t.children},Xa=(t,e,n)=>{let i=U(t,e)??t,{viewport:r,colors:o,maxDepth:s,reorder:a}=n,l=Ah(i.children,a),d=s===void 0||i.level<s,c=n.addSlot&&d?Math.min(l.length,Math.max(0,Math.trunc(n.addSlot.index??l.length))):null,u=i.collapsed||c!==null||l!==i.children?{...i,collapsed:!1,children:l}:i;if(c!==null){let v={id:Ka,text:"",level:i.level+1,children:[]};u.children=[...l.slice(0,c),v,...l.slice(c)]}let h=$a(u,{cx:0,cy:0,containerWidth:r.width,containerHeight:r.height,maxDepth:s,keptRings:n.keptRings?.focusId===i.id?n.keptRings.radii:void 0}),m=c===null?0:1,p=new Map,b=(v)=>o.get(v.id)??v.color??"#999999";p.set(i.id,{id:i.id,node:i,role:"sun",x:0,y:0,radius:h.sun.radius,color:b(i),depth:i.level,parentId:i.parent?.id,hiddenChildren:Math.max(0,l.length-(h.planets.length-m)),spins:!1});let g=h.sun.radius,f=h.sun.radius,y=Ih(h),x=h.planets.length-m>Mh,O;for(let v of h.planets){if(v.id===Ka){O={parentId:i.id,index:c??i.children.length,x:v.x,y:v.y,radius:y??v.radius,orbitAngle:v.angle,orbitRadius:v.orbitRadius},g=Math.max(g,v.orbitRadius+O.radius),f=Math.max(f,v.orbitRadius+O.radius);continue}let E=U(i,v.id)??v,k=Za(E,s).slice(0,Pn),_=y??v.radius;p.set(v.id,{id:v.id,node:E,role:"planet",x:v.x,y:v.y,radius:_,color:b(E),depth:E.level,parentId:i.id,orbitAngle:v.angle,orbitRadius:v.orbitRadius,hiddenChildren:E.children.length-k.length,spins:!0,crowded:x});let{distance:D,radius:Y,offsets:S}=Rn(_,k.length);k.forEach((I,F)=>{let C=S[F],Z=$e(v.angle+C);p.set(I.id,{id:I.id,node:I,role:"moon",x:v.x+D*Math.cos(Z),y:v.y+D*Math.sin(Z),radius:Y,color:b(I),depth:I.level,parentId:v.id,hostId:v.id,hostOffset:C,hostDistance:D,hiddenChildren:I.children.length,spins:!0})});let j=v.orbitRadius+(k.length>0?D+Y:_);g=Math.max(g,j),f=Math.max(f,j)}let M=h.planets.length===0?[]:h.orbitRings.map((v,E)=>({id:`${i.id}#${E}`,centerId:i.id,cx:0,cy:0,radius:v,color:b(i),gaps:h.planets.filter((k)=>Math.abs(k.orbitRadius-v)<0.5).map((k)=>({angle:k.angle,halfWidth:Qa(y??k.radius,v)})),spins:!0})),w={x:g,y:f};return{kind:"focus",focusId:i.id,nodes:p,rings:M,links:[],frame:Br("focus",w,r,n.insets),extent:w,addSlot:O}},Ih=(t)=>{if(t.orbitRings.length!==1||t.planets.length===0)return null;let e=t.orbitRings[0],n=t.planets.length,i=n>1?(e*Math.sin(Math.PI/n)-14)/1.45:1/0,r=e-t.sun.radius-24,o=t.planets[0].radius;return Math.max(o,Math.min(t.sun.radius*0.72,i,r))},Ja=(t,e)=>{let{viewport:n,colors:i,maxDepth:r}=e,o=Ba(t,{cx:0,cy:0,containerWidth:n.width,containerHeight:n.height,maxDepth:r}),s=new Map,a=[],l=Lh(t),d=0,c=0;for(let p of o){let b=l.get(p.id)??p,g=i.get(b.id)??"#999999",f=Za(b,r).length;if(s.set(p.id,{id:p.id,node:b,role:"node",x:p.x,y:p.y,radius:p.radius,color:g,depth:b.level,parentId:p.parent?.id,hiddenChildren:b.children.length-f,spins:!1}),p.parent&&b.level>0)a.push({id:`${p.parent.id}->${p.id}`,fromId:p.parent.id,toId:p.id,color:i.get(p.parent.id)??g});d=Math.max(d,Math.abs(p.x)+p.radius),c=Math.max(c,Math.abs(p.y)+p.radius)}let u=new Map;for(let p of o){let b=p.parent?.id;if(b!==void 0){let g=u.get(b)??[];g.push(p),u.set(b,g)}}let h=Va(o).map((p)=>{let{centerId:b}=p,g=u.get(b)??[];return{id:`${b}#overview`,centerId:b,cx:p.cx,cy:p.cy,radius:p.r,color:i.get(b)??"#999999",gaps:g.map((f)=>({angle:re(Math.atan2(f.y-p.cy,f.x-p.cx)),halfWidth:Qa(f.radius,p.r)})),spins:!1}});for(let p of h)d=Math.max(d,Math.abs(p.cx)+p.radius),c=Math.max(c,Math.abs(p.cy)+p.radius);let m={x:d,y:c};return{kind:"overview",focusId:t.id,nodes:s,rings:h,links:a,frame:Br("overview",m,n,e.insets),extent:m}},Lh=(t)=>{let e=new Map,n=(i)=>{e.set(i.id,i),i.children.forEach(n)};return n(t),e},ie=(t,e,n)=>{let i=t.nodes.get(e);if(!i||i.radius<=0)return{scale:1,x:0,y:0};let r=n.radius/i.radius;return{scale:r,x:n.x-i.x*r,y:n.y-i.y*r}};var Qa=(t,e)=>{let n=Math.min(1,(t+_h)/Math.max(e,1));return re(Math.asin(n))},$e=(t)=>t*Math.PI/180,re=(t)=>t*180/Math.PI;var Lt=(t,e,n)=>{let i=new Map,r=t.nodes.get(t.focusId),o=r?.x??0,s=r?.y??0;for(let l of t.nodes.values()){let{x:d,y:c}=l,u;if(l.spins&&l.role==="planet"&&l.orbitAngle!==void 0&&l.orbitRadius!==void 0){let h=$e(l.orbitAngle+e);d=o+l.orbitRadius*Math.cos(h),c=s+l.orbitRadius*Math.sin(h),u=l}i.set(l.id,{id:l.id,node:l.node,role:l.role,x:d,y:c,radius:l.radius,opacity:1,labelOpacity:1,color:l.color,depth:l.depth,hiddenChildren:l.hiddenChildren,parentId:l.parentId,hostId:l.hostId,crowded:l.crowded,unturned:u})}for(let l of t.nodes.values()){if(l.role!=="moon"||!l.hostId)continue;let d=t.nodes.get(l.hostId),c=i.get(l.hostId),u=i.get(l.id);if(!d||!c||!u||d.orbitAngle===void 0)continue;let h=$e(d.orbitAngle+e+(l.hostOffset??0));u.x=c.x+(l.hostDistance??0)*Math.cos(h),u.y=c.y+(l.hostDistance??0)*Math.sin(h),u.unturned=c.unturned&&l}let a;if(t.addSlot){let{parentId:l,index:d,orbitAngle:c,orbitRadius:u,radius:h}=t.addSlot,m=$e(c+e);a={parentId:l,index:d,x:o+u*Math.cos(m),y:s+u*Math.sin(m),radius:h,opacity:1,unturned:t.addSlot}}return{nodes:i,rings:t.rings.map((l)=>({...l,rotation:l.spins?e:0,opacity:1})),links:t.links.map((l)=>({...l,opacity:1})),camera:n,addSlot:a,turn:t.kind==="focus"?{cx:o,cy:s,rotation:e}:void 0}},el=(t,e)=>Fa(e,t.frame),tl=new WeakMap,Dh=(t)=>{let e=tl.get(t);if(e)return e;let{target:n,placement:i}=t,r=Lt(n,0,n.frame),o=new Map;for(let a of r.nodes.values()){let l=te(i,a);o.set(a.id,{...a,x:l.x,y:l.y,radius:a.radius*i.scale})}let s={resting:r,nodes:o};return tl.set(t,s),s},nl=(t,e)=>{let{from:n,target:i,placement:r}=t,{resting:o,nodes:s}=Dh(t),a=new Map,l=et(e,0.25,1),d=et(e,0,0.6);for(let[p,b]of s){let g=n.nodes.get(p);if(g){a.set(p,{...b,role:e<0.5?g.role:b.role,x:nt(g.x,b.x,e),y:nt(g.y,b.y,e),radius:nt(g.radius,b.radius,e),opacity:nt(g.opacity,1,e),labelOpacity:nt(g.labelOpacity,1,e)});continue}let f=b.parentId&&n.nodes.get(b.parentId)||void 0;if(f){let y=et(e,0.25,0.6);a.set(p,{...b,x:nt(f.x,b.x,l),y:nt(f.y,b.y,l),radius:b.radius*l,opacity:y,labelOpacity:et(e,0.6,1),cluster:{pivotX:f.x,pivotY:f.y,scale:l,opacity:y,x:b.x,y:b.y,radius:b.radius,nodeOpacity:1}})}else a.set(p,{...b,opacity:l,labelOpacity:et(e,0.6,1),cluster:{pivotX:0,pivotY:0,scale:1,opacity:l,x:b.x,y:b.y,radius:b.radius,nodeOpacity:1}})}for(let[p,b]of n.nodes){if(s.has(p))continue;let g=b.parentId&&s.get(b.parentId)||void 0,f=1-d;if(g)a.set(p,{...b,x:nt(b.x,g.x,d),y:nt(b.y,g.y,d),radius:b.radius*f,opacity:b.opacity*f,labelOpacity:b.labelOpacity*(1-et(e,0,0.35)),cluster:{pivotX:g.x,pivotY:g.y,scale:f,opacity:f,x:b.x,y:b.y,radius:b.radius,nodeOpacity:b.opacity}});else a.set(p,{...b,opacity:b.opacity*f,labelOpacity:b.labelOpacity*(1-et(e,0,0.35)),cluster:{pivotX:0,pivotY:0,scale:1,opacity:f,x:b.x,y:b.y,radius:b.radius,nodeOpacity:b.opacity}})}let c=[];for(let p of n.rings)c.push({...p,opacity:p.opacity*(1-et(e,0,0.5))});for(let p of o.rings){let b=te(r,{x:p.cx,y:p.cy}),g=p.radius*r.scale,f=n.nodes.get(p.centerId),y=f?Math.min(g,f.radius*1.6):g*0.6,x=et(e,0.2,1);c.push({...p,id:`${p.id}@target`,cx:b.x,cy:b.y,radius:nt(y,g,x),opacity:et(e,0.3,1)})}let u=new Set(i.links.map((p)=>p.id)),h=n.links.filter((p)=>!u.has(p.id)).map((p)=>({...p,opacity:p.opacity*(1-et(e,0,0.5))})),m=new Set(n.links.map((p)=>p.id));for(let p of i.links)h.push({...p,opacity:m.has(p.id)?1:et(e,0.4,1)});return{nodes:a,rings:c,links:h,camera:t.cameraPath.at(e),addSlot:Rh(n.addSlot,o.addSlot&&Ph(o.addSlot,r),e)}},Ph=(t,e)=>{let n=te(e,t);return{...t,x:n.x,y:n.y,radius:t.radius*e.scale}},Rh=(t,e,n)=>{if(t&&e&&t.parentId===e.parentId)return{...e,x:nt(t.x,e.x,n),y:nt(t.y,e.y,n),radius:nt(t.radius,e.radius,n),opacity:nt(t.opacity,1,n)};if(e&&n>=0.5)return{...e,opacity:et(n,0.7,1)};return t&&{...t,opacity:t.opacity*(1-et(n,0,0.3))}},il=(t,e)=>{if(e<0.5){let r=1-e*2,o=new Map;for(let[a,l]of t.from.nodes)o.set(a,{...l,opacity:l.opacity*r,labelOpacity:l.labelOpacity*r});let s=t.from.addSlot;return{nodes:o,rings:t.from.rings.map((a)=>({...a,opacity:a.opacity*r})),links:t.from.links.map((a)=>({...a,opacity:a.opacity*r})),camera:t.from.camera,addSlot:s&&{...s,opacity:s.opacity*r}}}let n=(e-0.5)*2,i=Lt(t.target,0,t.target.frame);for(let r of i.nodes.values())r.opacity=n,r.labelOpacity=n;return{...i,rings:i.rings.map((r)=>({...r,opacity:n})),links:i.links.map((r)=>({...r,opacity:n})),addSlot:i.addSlot&&{...i.addSlot,opacity:n}}};var Hr=/[\u1100-\u115F\u2E80-\uA4CF\uA960-\uA97F\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]|\p{Extended_Pictographic}/u,$h=/[⺀-〾ぁ-㏿㐀-䶿一-鿿가-힣豈--⦆\u{20000}-\u{3FFFD}]/u,Ur=/^[\x20-\x7e\xa0-\xff\u2000-\u200a]*$/,$n,Dt=(t)=>{if(Ur.test(t))return t.split("");if($n===void 0)$n=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null;return $n?Array.from($n.segment(t),(e)=>e.segment):Array.from(t)},jr=(t)=>{if(Ur.test(t))return{narrow:t.length,wide:0};let e=0,n=Dt(t);for(let i of n)if(Hr.test(i))e+=1;return{narrow:n.length-e,wide:e}},Bh=(t)=>{let{narrow:e,wide:n}=jr(t);return e*0.55+n},Vh=Bh,zh=/[^\S\u00a0\u202f\ufeff]+/u,Hh=/(?<=[_/\\-])(?=.)|(?<=[.:])(?=\p{L})|(?<=\p{Ll})(?=\p{Lu})/u,Wr=(t)=>t.split(Hh).filter(Boolean),Be=(t)=>{let e=[];for(let[n,i]of t.split(zh).filter(Boolean).entries()){let r="",o=!0,s=(a)=>{e.push({text:a,spaced:o&&n>0}),o=!1};for(let a of Wr(i)){if(Ur.test(a)){s(a);continue}for(let l of Dt(a))if($h.test(l)){if(r)s(r),r="";s(l)}else r+=l;if(r)s(r),r=""}}return e},oe=(t)=>t.map((e,n)=>n>0&&e.spaced?` ${e.text}`:e.text).join(""),zr=(t,e,n)=>{let i="";for(let r of Dt(t)){if(n(`${i}${r}…`)>e)break;i+=r}return`${i.trimEnd()}…`},Gr=(t,e,n,i=3,r)=>{let o=r?(h)=>r.ems(h,n):Vh,s=Math.max(1.6500000000000001,e/n),a=n*1.3,l=[],d=[];for(let h of Be(t)){let m=oe([...d,h]);if(d.length===0||o(m)<=s){if(d.push(h),d.length===1&&o(h.text)>s)l.push(zr(h.text,s,o)),d=[];continue}if(l.push(oe(d)),d=[{...h,spaced:!1}],o(h.text)>s)l.push(zr(h.text,s,o)),d=[]}if(d.length>0)l.push(oe(d));let c=l.length>i,u=l.slice(0,i);if(c&&u.length===i){let h=u[i-1];if(!h.endsWith("…"))u[i-1]=o(`${h}…`)<=s?`${h}…`:zr(h,s,o)}return{lines:u,truncated:c,lineHeight:a,totalHeight:u.length*a}};class Vn{key;bySize=!1;stretch=100;narrow;spaceWidth;ellipsisWidth;constructor(t,e,n){this.narrow=t,this.spaceWidth=e,this.ellipsisWidth=n,this.key=`estimate ${t}`}ems(t){if(t.length===1)return Hr.test(t)?1:this.narrow;let{narrow:e,wide:n}=jr(t);return e*this.narrow+n}space(){return this.spaceWidth}ellipsis(){return this.ellipsisWidth}narrower(){return null}}var Pt=new Vn(0.58,0.3,0.8),Ve=new Vn(0.5565217391304348,0.3,0.8),zn=new Vn(0.7,0.3,0.8),ze={key:"estimate",inside:()=>Pt,pill:()=>Ve,count:()=>zn},Bn=9,Kr=16,Uh=(t)=>{let e=[[50,"ultra-condensed"],[62.5,"extra-condensed"],[75,"condensed"],[87.5,"semi-condensed"],[100,"normal"],[112.5,"semi-expanded"],[125,"expanded"],[150,"extra-expanded"],[200,"ultra-expanded"]],n=e[4];for(let i of e)if(Math.abs(i[0]-t)<Math.abs(n[0]-t))n=i;return n[1]},jh=[87.5,75],Wh=0.97,Gh=/^[\u0020-\u052F\u1E00-\u1FFF\u2000-\u206F\u20A0-\u20BF]*$/;class sl{key;bySize=!0;context;font;widths=new Map;letters=new Map;narrowerMeasure;constructor(t,e,n){this.context=t,this.font=e,this.key=n}ems(t,e){let n=this.widths.get(t);if(!n){if(n=Gh.test(t)?this.sumOfLetters(t):[this.measure(t,Bn),this.measure(t,Kr)],this.widths.size>=Kh)this.widths.clear();this.widths.set(t,n)}let i=Math.min(1,Math.max(0,(e-Bn)/(Kr-Bn)));return n[0]+(n[1]-n[0])*i}space(t){return this.ems(" ",t)}ellipsis(t){return this.ems("…",t)}get stretch(){return this.font.stretch}narrower(){if(this.narrowerMeasure!==void 0)return this.narrowerMeasure;this.narrowerMeasure=null;let t=jh.find((e)=>e<this.font.stretch);if(t!==void 0&&"fontStretch"in this.context){let e=Zr({...this.font,stretch:t}),n="Orbit names";if(e&&e.ems("Orbit names",13)<this.ems("Orbit names",13)*Wh)this.narrowerMeasure=e}return this.narrowerMeasure}sumOfLetters(t){let e=0,n=0;for(let i of t){let r=this.letters.get(i);if(!r)r=[this.measure(i,Bn),this.measure(i,Kr)],this.letters.set(i,r);e+=r[0],n+=r[1]}return[e,n]}measure(t,e){let{context:n,font:i}=this;if(n.font=`${i.style} ${i.weight} ${e}px ${i.family}`,"fontStretch"in n)n.fontStretch=Uh(i.stretch);let r=i.letterSpacing===0?0:i.letterSpacing*Dt(t).length;return n.measureText(t).width/e+r}}var Kh=50000,Ut,Yr=()=>{if(Ut!==void 0)return Ut;Ut=null;try{let t=null;if(typeof OffscreenCanvas==="function")t=new OffscreenCanvas(1,1).getContext("2d");if(!t&&typeof document<"u"&&typeof document.createElement==="function")t=document.createElement("canvas").getContext("2d");if(t&&typeof t.measureText==="function"){if(t.font="16px sans-serif",t.measureText("Orbit").width>0)Ut=t}}catch{Ut=null}if(Ut)qh();return Ut},qr=new Map,rl=0,Zr=(t)=>{let e=Yr();if(!e||!t.family)return null;let n=`${t.style} ${t.weight} ${t.stretch}% ${t.letterSpacing} ${t.family}`,i=qr.get(n);if(!i)rl+=1,i=new sl(e,t,`font ${rl}`),qr.set(n,i);return i},Xr=new Set,se=(t)=>(Xr.add(t),()=>{Xr.delete(t)}),Yh=()=>{qr.clear();for(let t of Array.from(Xr))t()},ol=!1,qh=()=>{if(ol||typeof document>"u")return;let t=document.fonts;if(!t||typeof t.addEventListener!=="function")return;ol=!0,t.addEventListener("loadingdone",()=>Yh())},Zh=["font-family","label-font","display-font","label-weight","display-weight","label-letter-spacing"];class Jr{layer;extensions;shelf=null;probes=new Map;measures=new Map;sunMeasure;nameMeasure;countMeasure;stale=!0;currentKey="estimate";recheck=null;constructor(t,e){this.layer=t,this.extensions=e}get key(){return this.read(),this.currentKey}refresh(){this.stale=!0}inside(t,e){return this.measure(t,e)??Pt}pill(t,e){return this.measure(t,e)??Ve}count(){if(this.stale)this.read();if(this.countMeasure===void 0){let t=this.computedFont("count","orbit-count",void 0);this.countMeasure=t?Zr(t):null}return this.countMeasure??zn}recheckWhenIdle(t){if(this.recheck||Yr()===null)return;let e=()=>{this.recheck=null;let i=this.key;if(this.refresh(),this.key!==i)t()},n=globalThis.requestIdleCallback;if(typeof n==="function"){let i=n(e,{timeout:2000});this.recheck={cancel:()=>globalThis.cancelIdleCallback?.(i)}}else{let i=setTimeout(e,250);this.recheck={cancel:()=>clearTimeout(i)}}}destroy(){this.recheck?.cancel(),this.recheck=null,this.shelf?.remove(),this.shelf=null,this.probes.clear(),this.measures.clear()}read(){if(!this.stale)return;this.stale=!1,this.measures.clear(),this.sunMeasure=void 0,this.nameMeasure=void 0,this.countMeasure=void 0;let t=[this.measure("planet"),this.measure("sun"),this.count()].map((e)=>e?.key??"estimate");this.currentKey=t.join(" | ")}measure(t,e){if(this.stale)this.read();let n=e?this.extensions()?.typeName(e)??e.type:void 0;if(!e||!n){if(t==="sun"){if(this.sunMeasure===void 0)this.sunMeasure=this.measureOf("sun",t,void 0);return this.sunMeasure}if(this.nameMeasure===void 0)this.nameMeasure=this.measureOf("name",t,void 0);return this.nameMeasure}let i=`${t==="sun"?"sun":"name"} ${n.toLowerCase()}`,r=this.measures.get(i);if(r!==void 0||this.measures.has(i))return r??null;let o=this.extensions()?.nodeType(e)?.tokens,a=o!==void 0&&Zh.some((l)=>typeof o[l]==="string"&&o[l]!=="")?this.measureOf(i,t,o):this.measure(t);return this.measures.set(i,a),a}measureOf(t,e,n){let i=this.computedFont(t,`orbit-label orbit-label--${e==="sun"?"sun":"planet"}`,n);return i?Zr(i):null}computedFont(t,e,n){if(typeof getComputedStyle!=="function"||!this.layer.isConnected||Yr()===null)return null;let i=this.probes.get(t);if(!i){let l=this.layer.ownerDocument;if(!this.shelf)this.shelf=l.createElement("div"),this.shelf.className="orbit__font-probes",this.shelf.style.display="none",this.shelf.setAttribute("aria-hidden","true"),this.layer.appendChild(this.shelf);i=l.createElement("div"),i.className=e;for(let[d,c]of Object.entries(n??{}))if(typeof c==="string"&&c!=="")i.style.setProperty(`--_orbit-${d}`,c);this.shelf.appendChild(i),this.probes.set(t,i)}let r=getComputedStyle(i),o=Number.parseFloat(r.fontSize)||13,s=Number.parseFloat(r.letterSpacing),a=Number.parseFloat(r.fontStretch);if(!r.fontFamily)return null;return{family:r.fontFamily,weight:r.fontWeight||"400",style:r.fontStyle||"normal",stretch:Number.isFinite(a)?a:100,letterSpacing:Number.isFinite(s)?s/o:0}}}var Hn={mindMap:"Mind map",mindMapRole:"mind map",untitled:"Untitled",untitledMap:"Untitled map",emptyMap:"This map is empty",emptyMapHint:"Start it with a # heading or a bullet list",mapNotDrawn:"This map couldn’t be drawn",mapNotDrawnReason:"The map could not be drawn.",problemOnLine:"Line {line}: {message}",mapPath:"Map path",back:"Back",backTo:"Back to {name}",backToParent:"Back to the parent node",view:"View",focus:"Focus",overview:"Overview",showOutline:"Show the map as a list",zoom:"Zoom",zoomIn:"Zoom in",zoomOut:"Zoom out",fitMap:"Fit the map",scrollToZoom:"Use {key} + scroll to zoom the map",outline:"Map outline",overviewAnnouncement:"Overview of the whole map",ideaCount:{one:"{count} item",other:"{count} items"},added:"Added {name}",removed:"Removed {name}",moved:"Moved {name} to {parent}",movedToTop:"Moved {name} to the top",anIdea:"a node",status:"status {status}",statusLabel:"Status: {status}",has:"has {list}",hasDetails:"details",hasNote:"note",hasImage:"image",hasVideo:"video",hasEmbed:"embed",hasLink:"link",textOf:"Text of {name}",newIdeaFor:"New idea for {name}",newIdea:"New idea",addIdeaTo:"Add an idea to {name}",moveHere:"Move {name} here",thisIdea:"this node",theIdea:"the idea",ideaActions:"{name} actions",ideaActionsUntitled:"Node actions",showDetails:"Show details",viewImage:"View image",viewImageOf:"View image: {description}",playVideo:"Play video",openEmbed:"Open embed",readNote:"Read note",openLink:"Open link",goTo:"Go to {name}",details:"Details",close:"Close",previous:"Previous",next:"Next",present:"Present",priority:"Priority {priority}",expand:"Expand",expandVideo:"Expand the video",picture:"Picture",video:"Video",position:"{index} of {total}",fitPicture:"Fit the picture",pictureUnavailable:"This picture can’t be shown.",videoUnavailable:"This video can’t be played.",videoUnavailableHere:"This video can’t be played here.",openPictureInNewTab:"Open the picture in a new tab",openVideoInNewTab:"Open the video in a new tab",watchOn:"Watch on {provider}"},Xh={mindMap:"Mapa mental",mindMapRole:"mapa mental",untitled:"Sin título",untitledMap:"Mapa sin título",emptyMap:"Este mapa está vacío",emptyMapHint:"Empiézalo con un encabezado # o una lista con viñetas",mapNotDrawn:"No se pudo dibujar este mapa",mapNotDrawnReason:"No se pudo dibujar el mapa.",problemOnLine:"Línea {line}: {message}",mapPath:"Ruta del mapa",back:"Atrás",backTo:"Volver a {name}",backToParent:"Volver a la idea superior",view:"Vista",focus:"Enfoque",overview:"Vista general",showOutline:"Mostrar el mapa como lista",zoom:"Zoom",zoomIn:"Acercar",zoomOut:"Alejar",fitMap:"Ajustar el mapa",scrollToZoom:"Usa {key} + desplazamiento para acercar o alejar el mapa",outline:"Esquema del mapa",overviewAnnouncement:"Vista general de todo el mapa",ideaCount:{one:"{count} idea",many:"{count} ideas",other:"{count} ideas"},added:"Se agregó {name}",removed:"Se eliminó {name}",moved:"Se movió {name} a {parent}",movedToTop:"Se movió {name} al nivel superior",anIdea:"una idea",status:"estado {status}",statusLabel:"Estado: {status}",has:"tiene {list}",hasDetails:"detalles",hasNote:"nota",hasImage:"imagen",hasVideo:"video",hasEmbed:"contenido insertado",hasLink:"enlace",textOf:"Texto de {name}",newIdeaFor:"Idea nueva en {name}",newIdea:"Idea nueva",addIdeaTo:"Agregar una idea a {name}",moveHere:"Mover {name} aquí",thisIdea:"esta idea",theIdea:"la idea",ideaActions:"Acciones de {name}",ideaActionsUntitled:"Acciones de la idea",showDetails:"Ver detalles",viewImage:"Ver imagen",viewImageOf:"Ver imagen: {description}",playVideo:"Reproducir video",openEmbed:"Abrir contenido insertado",readNote:"Leer nota",openLink:"Abrir enlace",goTo:"Ir a {name}",details:"Detalles",close:"Cerrar",previous:"Anterior",next:"Siguiente",present:"Presentar",priority:"Prioridad {priority}",expand:"Ampliar",expandVideo:"Ampliar el video",picture:"Imagen",video:"Video",position:"{index} de {total}",fitPicture:"Ajustar la imagen",pictureUnavailable:"No se puede mostrar esta imagen.",videoUnavailable:"No se puede reproducir este video.",videoUnavailableHere:"Este video no se puede reproducir aquí.",openPictureInNewTab:"Abrir la imagen en una pestaña nueva",openVideoInNewTab:"Abrir el video en una pestaña nueva",watchOn:"Ver en {provider}"},Jh=new Map([["en",Hn],["es",Xh]]),Qr=new Map(Jh),Qh=Object.keys(Hn),tp=["zero","one","two","few","many","other"];var Un=(t)=>{let e=t??null;while(e){if(e.nodeType===1){let n=e.getAttribute("lang");if(n)return n}e=e.parentNode??(e.host??null)}return t?.ownerDocument?.documentElement?.getAttribute("lang")||null};class dt{language;locale;table;constructor(t,e){let n=t?rp(t):null;this.language=n===null?"en":Qr.has(n)?n:Qr.has(to(n))?to(n):"en",this.locale=n!==null&&(n===this.language||to(n)===this.language)?n:this.language;let i=Qr.get(this.language)??Hn;this.table=e?{...i,...ep(e,"strings")}:i}sameAs(t){return t!==null&&t.locale===this.locale&&t.table===this.table}text(t,e){return this.fill(this.table[t],e)}count(t,e,n){let i=this.table[t],r=lp(this.locale)?.select(e)??(e===1?"one":"other");return this.fill(i[r]??i.other,{...n,count:e})}list(t){let e=cp(this.locale);return e?e.format(t):t.join(", ")}number(t){return dp(this.locale)?.format(t)??String(t)}fill(t,e){if(!e)return t;return t.replace(/\{(\w+)\}/g,(n,i)=>{let r=e[i];if(r===void 0)return n;return typeof r==="number"?this.number(r):r})}}var dl=(t,e,n)=>new dt(t??Un(e),n),ep=(t,e)=>{let n={};if(!t||typeof t!=="object")return n;for(let[i,r]of Object.entries(t)){if(!Qh.includes(i)){ll(`${e}: Orbit has no words called "${i}".`);continue}let o=typeof Hn[i]!=="string";if(!o&&typeof r==="string")n[i]=r;else if(o&&np(r))n[i]=ip(r);else if(o&&typeof r==="string")n[i]={other:r};else ll(`${e}: "${i}" should be ${o?'an object of plural forms with at least "other"':"a string"}.`)}return n},np=(t)=>typeof t==="object"&&t!==null&&typeof t.other==="string",ip=(t)=>{let e={other:t.other};for(let n of tp)if(typeof t[n]==="string")e[n]=t[n];return e},rp=(t)=>{if(typeof t!=="string"||t.trim()==="")return null;try{let[e]=Intl.getCanonicalLocales(t.trim().replace(/_/g,"-"));return e??null}catch{return null}},to=(t)=>t.split("-")[0],al=new Set,ll=(t)=>{if(!al.has(t))al.add(t),console.warn(`[orbit] ${t}`)},op=new Map,sp=new Map,ap=new Map,lp=(t)=>eo(op,t,()=>new Intl.PluralRules(t)),dp=(t)=>eo(sp,t,()=>new Intl.NumberFormat(t)),cp=(t)=>eo(ap,t,()=>typeof Intl.ListFormat==="function"?new Intl.ListFormat(t,{type:"conjunction"}):null),eo=(t,e,n)=>{if(!t.has(e))try{t.set(e,n())}catch{t.set(e,null)}return t.get(e)??null};var up="http://www.w3.org/2000/svg",T=(t,e={})=>{let n=document.createElementNS(up,t);for(let[i,r]of Object.entries(e))n.setAttribute(i,r);return n},ro=[{offset:0,part:"highlight"},{offset:0.45,part:"highlight-fade"},{offset:0.55,part:"terminator-start"},{offset:0.78,part:"terminator"},{offset:1,part:"shading"}],Wn={x:0.34,y:0.3,radius:0.78},Zn=(t)=>{let e=(t??"").trim().split(/[\s,]+/).map(Number);if(e.length!==3||!e.every(Number.isFinite)||e[2]<=0)return Wn;let[n,i,r]=e;return{x:n,y:i,radius:r}},gl=(t,e,n)=>{let i=Array.from(t.children).find((r)=>r.id===e.shade);i?.setAttribute("cx",String(n.x)),i?.setAttribute("cy",String(n.y)),i?.setAttribute("r",String(n.radius))},Ue={planet:0.16,sun:0.3},yl=(t)=>{let e=T("defs"),n=T("clipPath",{id:t.clip,clipPathUnits:"userSpaceOnUse"});n.appendChild(T("circle",{r:"1"})),e.appendChild(n);let i=T("radialGradient",{id:t.shade,cx:String(Wn.x),cy:String(Wn.y),r:String(Wn.radius)});for(let r of ro)i.appendChild(T("stop",{offset:String(r.offset),class:`orbit-shade__${r.part}`}));e.appendChild(i),e.appendChild(T("radialGradient",{id:t.speckShade,href:`#${t.shade}`}));for(let[r,o]of[[t.shadow,Ue.planet],[t.sunShadow,Ue.sun]]){let s=T("filter",{id:r,x:"-60%",y:"-60%",width:"220%",height:"220%"});s.appendChild(T("feGaussianBlur",{stdDeviation:String(o)})),e.appendChild(s)}return e},vl=(t,e,n)=>{let i=Array.from(t.children).find((r)=>r.id===e.speckShade);if(n===0)i?.removeAttribute("gradientTransform");else i?.setAttribute("gradientTransform",`rotate(${-n} 0.5 0.5)`)},hp=new dt("en"),oo=(t,e,n,i,r=hp)=>{let o=i?.nodeType(t),s=[[i?i.icon(t):t.icon,t.text||r.text("untitled")].filter(Boolean).join(" ")];if(o?.label)s.push(o.label);if(t.status)s.push(r.text("status",{status:t.status}));let a=n+e;if(a>0)s.push(r.count("ideaCount",a));let l=[o?.details?r.text("hasDetails"):"",t.note?r.text("hasNote"):"",P(t.image)?r.text("hasImage"):"",P(t.video)?r.text("hasVideo"):"",P(t.embed)?r.text("hasEmbed"):"",t.link?r.text("hasLink"):""].filter(Boolean);if(l.length>0)s.push(r.text("has",{list:r.list(l)}));return s.join(", ")},pp=12,mp=5,so=(t)=>mp/(t>0?t:1),Gn=1.22,ao=(t,e)=>t.crowded===!0||t.cluster!==void 0||e<pp;class lo{element;id;node;typeName;hasImage=!1;body;disc;shade;shadeFills;shadowFilters;shadow=null;halo=null;focusRing=null;status=null;role=null;color="";visible=!0;drawn={x:Number.NaN,y:Number.NaN,radius:Number.NaN,upright:0,opacity:Number.NaN};transform="";opacity="";editing=!1;lifted=!1;dropTarget=!1;flat=!1;crowded=!1;speck=!1;turnedBack=!1;constructor(t,e,n,i,r,o,s){this.id=t.id,this.node=t.node;let{node:a}=t,l=r.nodeType(a);this.typeName=r.typeName(a),this.element=T("g",{class:"orbit-node","data-orbit-node-id":a.id,tabindex:"-1"}),this.element.setAttribute("role","button"),Jn(this.element,a,this.typeName),Qn(this.element,l),this.body=T("g",{class:"orbit-node__body"}),this.shadowFilters={planet:`url(#${n.shadow})`,sun:`url(#${n.sunShadow})`},this.disc=T("circle",{class:"orbit-node__disc",r:"1"}),this.body.append(this.disc);let d=co(a),c=d?V(d,"image"):null;if(c){let u=T("image",{class:"orbit-node__image",x:"-1",y:"-1",width:"2",height:"2",preserveAspectRatio:"xMidYMid slice","clip-path":`url(#${n.clip})`});u.setAttribute("href",G(c,i)),u.addEventListener("error",()=>{u.remove(),this.hasImage=!1,s?.()}),this.body.appendChild(u),this.hasImage=!0}if(this.shadeFills={body:`url(#${n.shade})`,speck:`url(#${n.speckShade})`},this.shade=T("circle",{class:"orbit-node__shade",r:"1",fill:this.shadeFills.body}),this.body.appendChild(this.shade),P(a.video)){let u=T("g",{class:"orbit-node__play",transform:"translate(0.62 0.62) scale(0.3)"});u.appendChild(T("circle",{r:"1"})),u.appendChild(T("path",{d:"M-0.32 -0.48 L0.52 0 L-0.32 0.48 Z"})),this.body.appendChild(u)}else if(a.note||P(a.image)||P(a.embed)||a.link||l?.details)this.body.appendChild(T("circle",{class:"orbit-node__marker",cx:"0.72",cy:"0.72",r:"0.13"}));if(a.status){let u=r.status(a.status);if(this.status=T("circle",{class:`orbit-node__status orbit-node__status--${u.tone}`}),u.color)this.status.style.fill=u.color;this.body.appendChild(this.status)}this.element.appendChild(this.body),this.update(t,e,o&&{...o,switches:Number.POSITIVE_INFINITY,flight:!1})}update(t,e=1/0,n,i=!1){let r=ao(t,e);if(r!==this.flat)this.element.classList.toggle("orbit-node--flat",r),this.flat=r;let o=t.crowded===!0;if(o!==this.crowded)this.element.classList.toggle("orbit-node--crowded",o),this.crowded=o;if(t.role!==this.role){if(this.role)this.element.classList.remove(`orbit-node--${this.role}`);if(this.element.classList.add(`orbit-node--${t.role}`),this.role=t.role,this.shadow?.setAttribute("filter",t.role==="sun"?this.shadowFilters.sun:this.shadowFilters.planet),t.role==="sun")this.element.setAttribute("aria-current","true");else this.element.removeAttribute("aria-current");let m=t.role==="sun"?0.11:0.17,p=t.role==="sun"?0.68:0.72;this.status?.setAttribute("r",String(m)),this.status?.setAttribute("cx",String(p)),this.status?.setAttribute("cy",String(-p))}if(!r&&t.role!=="node"&&!this.shadow)this.shadow=T("circle",{class:"orbit-node__shadow",r:"1"}),this.shadow.setAttribute("filter",t.role==="sun"?this.shadowFilters.sun:this.shadowFilters.planet),this.body.insertBefore(this.shadow,this.halo??this.disc);if(t.role==="sun"&&!this.halo)this.halo=T("circle",{class:"orbit-node__halo",r:"1"}),this.body.insertBefore(this.halo,this.disc);if(t.color!==this.color)this.disc.style.fill=t.color,this.element.style.setProperty("--orbit-node-color",t.color),this.color=t.color;let s=t.opacity>0.01&&t.radius>0.05;if(s!==this.visible)this.element.style.display=s?"":"none",this.visible=s;let a=!i&&r&&!this.hasImage&&e<(n?.speckRadius??so(1));if(a!==this.speck&&!(s&&a&&n?.flight))if(s&&n&&n.switches<=0&&!i)n.waiting=!0;else{if(s&&n)n.switches-=1;this.setSpeck(a)}if(!s)return;let l=n?.turn,d=l===void 0?void 0:t.unturned,c=d??t;this.turnedBack=d!==void 0&&!this.speck;let u=this.turnedBack&&l?l:0,h=this.drawn;if(c.x!==h.x||c.y!==h.y||t.radius!==h.radius||u!==h.upright){if(this.speck)this.placeSpeck(c.x,c.y,t.radius);else{let m=`translate(${L(c.x)} ${L(c.y)})${u?` rotate(${-u})`:""} scale(${L(t.radius,4)})`;if(m!==this.transform)this.element.setAttribute("transform",m),this.transform=m}h.x=c.x,h.y=c.y,h.radius=t.radius,h.upright=u}if(t.opacity!==h.opacity){let m=t.opacity>=0.999?"":String(L(t.opacity,3));if(m!==this.opacity)this.element.style.opacity=m,this.opacity=m;h.opacity=t.opacity}}get isTurnedBack(){return this.turnedBack}setSpeck(t){if(this.speck=t,this.element.classList.toggle("orbit-node--speck",t),this.shade.setAttribute("fill",t?this.shadeFills.speck:this.shadeFills.body),t)this.element.removeAttribute("transform"),this.transform="";else{for(let e of this.unitCircles())e.removeAttribute("cx"),e.removeAttribute("cy"),e.setAttribute("r",e===this.focusRing?String(Gn):"1");this.shade.style.removeProperty("--orbit-speck-radius")}this.drawn.x=Number.NaN}placeSpeck(t,e,n){let i=String(L(t)),r=String(L(e));for(let o of this.unitCircles())o.setAttribute("cx",i),o.setAttribute("cy",r),o.setAttribute("r",String(L(n*(o===this.focusRing?Gn:1),4)));this.shade.style.setProperty("--orbit-speck-radius",String(L(n,4)))}unitCircles(){return this.focusRing?[this.disc,this.shade,this.focusRing]:[this.disc,this.shade]}resolvedFill(){return typeof getComputedStyle==="function"?getComputedStyle(this.disc).fill:""}setEditing(t){if(t!==this.editing){if(t)this.showFocusRing();this.element.classList.toggle("orbit-node--editing",t),this.editing=t}}setLifted(t){if(t!==this.lifted)this.element.classList.toggle("orbit-node--lifted",t),this.lifted=t}setDropTarget(t){if(t!==this.dropTarget){if(t)this.showFocusRing();this.element.classList.toggle("orbit-node--drop-target",t),this.dropTarget=t}}showFocusRing(){if(!this.focusRing){if(this.focusRing=T("circle",{class:"orbit-node__focus-ring",r:String(Gn)}),this.body.appendChild(this.focusRing),this.speck)this.placeSpeck(this.drawn.x,this.drawn.y,this.drawn.radius)}}}class Xn{element;shown=!1;pending=!1;drop=!1;label="";transform="";opacity="";get isShown(){return this.shown}constructor(t=!1){if(this.element=t?T("g",{class:"orbit-add orbit-add--held","aria-hidden":"true"}):T("g",{class:"orbit-add","data-orbit-add":"",tabindex:"-1"}),!t)this.element.setAttribute("role","button");let e=T("g",{class:"orbit-add__body"});e.append(T("circle",{class:"orbit-add__disc",r:"1"}),T("path",{class:"orbit-add__plus",d:"M-0.3 0H0.3M0 -0.3V0.3"}),T("circle",{class:"orbit-add__focus-ring",r:String(Gn)})),this.element.appendChild(e),this.element.style.display="none"}update(t,e,n,i,r=!1){let o=t!==void 0&&t.opacity>0.01&&t.radius>0.05;if(o!==this.shown)this.element.style.display=o?"":"none",this.shown=o;if(!t||!o)return;if(n!==this.pending)this.element.classList.toggle("orbit-add--pending",n),this.pending=n;if(r!==this.drop)this.element.classList.toggle("orbit-add--drop",r!==!1),this.element.classList.toggle("orbit-add--waiting",r==="waiting"),this.drop=r;if(e!==this.label){if(e)this.element.setAttribute("aria-label",e);else this.element.removeAttribute("aria-label");this.label=e}let s=i===void 0?void 0:t.unturned,a=s??t,l=s&&i?` rotate(${-i})`:"",d=`translate(${L(a.x)} ${L(a.y)})${l} scale(${L(t.radius,4)})`;if(d!==this.transform)this.element.setAttribute("transform",d),this.transform=d;let c=t.opacity>=0.999?"":String(L(t.opacity,3));if(c!==this.opacity)this.element.style.opacity=c,this.opacity=c}}var Jn=(t,e,n=e.type)=>{if(n)t.setAttribute("data-orbit-type",n.toLowerCase());if(e.status)t.setAttribute("data-orbit-status",e.status.trim().toLowerCase());if(e.tags?.length)t.setAttribute("data-orbit-tags",e.tags.join(" "))},Qn=(t,e)=>{for(let[n,i]of Object.entries(e?.tokens??{}))if(typeof i==="string"&&i!=="")t.style.setProperty(`--_orbit-${n}`,i)},co=(t)=>{if(P(t.image))return t.image.src;if(P(t.video)){if(t.video.thumbnail)return t.video.thumbnail;if(t.video.provider!=="vimeo"&&t.video.provider!=="native")return Ms(t.video.src)??void 0}return},Kn={sun:16,planet:13,node:12,moon:13},ti={sun:9,planet:9,node:10,moon:9},Yn={sun:4,planet:3,node:3,moon:2},ei=1.22,qn=1.45,xl=2,bp=8,ni=(t,e)=>Math.max(44,Math.min(260,Math.round(e*(t==="sun"?1.6:1.68)/6)*6)),cl=(t)=>t<12?9:12;class wl{measure;pieces;sizes=new Map;constructor(t,e){this.measure=e,this.pieces=Be(t)}at(t){let e=this.measure.bySize?cl(t):0,n=this.sizes.get(e);if(!n){let{measure:i}=this,r=this.pieces.map((s)=>({text:s.text,ems:i.ems(s.text,e),spaced:s.spaced})),o=i.space(e);n={units:r,longestUnbreakable:r.reduce((s,a)=>Math.max(s,a.ems),0),total:r.reduce((s,a,l)=>s+a.ems+(l>0&&a.spaced?o:0),0),space:o,ellipsis:i.ellipsis(e),hyphen:i.ems("-",e)},this.sizes.set(e,n)}return n}character(t,e){return this.measure.ems(t,this.measure.bySize?cl(e):0)}}var He=new Map,fp=20000,uo=(t,e)=>{let n=`${e.key}
|
|
120
|
-
${t}`,i=
|
|
121
|
-
`);if(m!==this.shownLines)this.text.textContent=m,this.shownLines=m,this.pillText=null;let p=this.hasIcon&&!c.icon;if(p!==this.iconHidden)this.element.classList.toggle("orbit-label--no-icon",p),this.iconHidden=p;l=`translate3d(${
|
|
122
|
-
${t}`,i=
|
|
117
|
+
`)}i.encoding={...Cn(e),indentation:$n(r(n)),before:s,after:a}},Ha=/^(\s*(```|~~~)orbit(?:[^\S\n][^\n]*)?\n)([\s\S]*?)(?:\r?\n)?[^\S\n]*\2\s*$/,Th=(t)=>{let e=Ha.exec(t);return e?e[3]:t},Fh=(t)=>{try{let e=Nt(t);return e&&typeof e.flavor==="string"?e.flavor:void 0}catch{return}};class Yt extends Error{}var Ga=(t,e)=>{if(t.root!==e.root)return null;for(let n of[!1,!0]){let i=new Ya(t,e,n),r;try{r=i.write()}catch(s){if(s instanceof Yt)continue;throw s}let o=Ih(r,e);if(r===e.lines||Ch(o,{...t,options:i.writtenOptions,extra:t.extra??e.extra}))return o}return null};var Ch=(t,e)=>{let n;try{n=mt(t,{untitled:e.root.id===Ye?e.root.text:void 0})}catch{return!1}if(JSON.stringify(Ke(n))!==JSON.stringify(Ke(e)))return!1;let i=It(n.root),r=It(e.root),o=(s,a)=>s.id===a.id&&JSON.stringify(ti(s,!1,i.has(s)))===JSON.stringify(ti(a,!1,r.has(a)))&&s.children.length===a.children.length&&s.children.every((l,d)=>o(l,a.children[d]));return o(n.root,e.root)},Ih=(t,e)=>{let{encoding:n}=e,i=n.indentation?t.map((o)=>o.trim()===""?o:n.indentation+o):t,r=[...n.before,...i,...n.after].join(n.lineEnding);return n.byteOrderMark?`\uFEFF${r}`:r};class Ya{lines;records;writing;cleanness=new Map;document;source;coarse;current=null;writtenOptions={};rootHeading=!1;constructor(t,e,n){this.document=t,this.source=e,this.coarse=n,this.lines=e.lines,this.records=e.records,this.writing={explicitIds:It(t.root)}}write(){let t=this.document.root,e=this.record(t);this.rootHeading=e.shape.kind==="generated"&&this.becomesHeading(t,e);let n=this.options();if(this.writtenOptions=n,JSON.stringify(this.frontmatterKeys(n))===JSON.stringify(this.frontmatterKeys(this.source.options,this.source.extra))&&this.isClean(t))return this.lines;let r=this.frontmatter(n),o=[],s=this.rootHeading?{kind:"heading",level:1}:Rh(e.shape);if(this.emit(t,s,o),this.source.frontmatter&&r.length===0)while(o.length>0&&o[0].trim()==="")o.shift();if(r.push(...o),this.lines[this.lines.length-1]===""&&r[r.length-1]!=="")r.push("");return r}becomesHeading(t,e){if(e.children.some((i)=>this.records.get(i)?.shape.kind==="heading"))return!1;if(e.children.length===0&&t.children.length>0)return!0;let n=this.changes(t,e,this.ownRuns(t,e));return n.title||n.attributes||n.media}options(){let t={...this.document.options},e=this.document.root,n=this.record(e);if(n.shape.kind==="generated"&&!this.rootHeading&&e.text!==n.fields.text)t.title=e.text;return t}record(t){let e=this.records.get(t);if(!e)throw new Yt("A node without a record");return e}isClean(t){let e=this.cleanness.get(t);if(e===void 0){let n=this.records.get(t);e=n!==void 0&&this.ownUnchanged(t,n)&&Bh(t.children,n.children)&&t.children.every((i)=>this.isClean(i)),this.cleanness.set(t,e)}return e}ownUnchanged(t,e){return JSON.stringify(gr(t))===JSON.stringify(e.fields)&&this.writing.explicitIds.has(t)===e.explicitId}frontmatterKeys(t,e=this.document.extra??this.source.extra){return Ke({options:t,extra:e})}frontmatter(t){let e=this.source.frontmatter,n=this.frontmatterKeys(this.source.options,this.source.extra),i=this.frontmatterKeys(t),r=e?this.lines.slice(0,e.close+1):[],s=[...new Set([...Object.keys(n),...Object.keys(i)])].filter((d)=>JSON.stringify(n[d])!==JSON.stringify(i[d]));if(s.length===0)return e?r:this.lines.slice(0,this.bodyStart());if(!e){let d=Object.fromEntries(Object.entries(i));return["---",...Wa(d),"---","",...this.lines.slice(0,this.bodyStart())]}let{open:a,close:l}=e;for(let d of s){let c=zh(r,d,a+1,l),u=i[d]===void 0?[]:Wa({[d]:i[d]});if(c)r.splice(c.from,c.to-c.from,...u),l+=u.length-(c.to-c.from);else r.splice(l,0,...u),l+=u.length}if(r.slice(a+1,l).every((d)=>d.trim()===""))r.splice(a,l-a+1);return r}bodyStart(){let t=this.source.frontmatter;return t?t.close+1:0}emit(t,e,n){let i=this.records.get(t);if(!i){this.generate(t,e,n);return}if(this.isClean(t)&&$h(i.shape,e)&&i.contiguous){if(i.shape.kind==="heading"&&i.shape.setext&&this.lines[i.start]?.trim()!=="")Qn(n);let d=this.lines.slice(i.start,i.end);if(e.kind==="heading"&&i.titleLine!==null){let c=i.titleLine-i.start;d[c]=d[c].replace(/^ {1,3}(?=#)/,"")}n.push(...d);return}let r=this.ownRuns(t,i),o=this.changes(t,i,r);this.current=t;let s=i.shape.kind!==e.kind,a=qe(t,e.kind==="item",this.writing," ".repeat(Wr(i.shape,e))),l=r.filter((d)=>d.after<0);if(s&&i.shape.kind!=="generated")this.rewriteOwn(i,e,a,r,n);else this.patchOwn(i,e,a,l,o,n);this.emitChildren(t,i,e,r,o,n)}ownRuns(t,e){let n=e.children.map((r)=>this.record(r).start),i=[];for(let r=e.start;r<e.end;r+=1){if(this.source.owners[r]!==t)continue;let o=this.source.roles[r],s=-1;while(s+1<n.length&&n[s+1]<=r)s+=1;let a=i[i.length-1];if(a&&a.to===r&&a.role===o&&a.after===s)a.to=r+1;else i.push({from:r,to:r+1,role:o,after:s})}return i}changes(t,e,n){let i=e.shape.kind==="item",r=ti(ja(e.fields),i,e.explicitId),o=ti(t,i,this.writing.explicitIds.has(t)),s={title:r.title!==o.title,attributes:r.attributes!==o.attributes,media:r.media!==o.media,note:r.note!==o.note},a=/(^|[\s,])note\s*:/,l=e.titleLine===null?"":(za.exec(this.lines[e.titleLine])??[""])[0];if(n.some((d)=>d.role==="attributes"&&a.test(this.text(d)))||a.test(l)){if(s.note||s.attributes)s.note=!0,s.attributes=!0}if(this.coarse&&Object.values(s).some(Boolean))return{title:!0,attributes:!0,media:!0,note:!0};return s}text(t){return this.lines.slice(t.from,t.to).join(`
|
|
118
|
+
`)}patchOwn(t,e,n,i,r,o){let s=Ua(t.shape,e),a=[],l=0,d=!1,c=!1,u=!1,h=t.shape.kind==="generated";if(h&&e.kind==="heading"){if(a.push(`${"#".repeat(e.level)} ${`${n.title}${n.inline}`.trimStart()}`),l=a.length,n.attributes)a.push(...bt(n.attributes)),l=a.length;d=!0}for(let p of i){let b=this.lines.slice(p.from,p.to);switch(p.role){case"title":{if(h){if(e.kind!=="heading"&&!r.title)a.push(...b);l=a.length;break}if(a.push(...this.patchTitle(b,t,e,n,r)),l=a.length,r.attributes&&n.attributes)a.push(...bt(n.attributes)),l=a.length;d=!0;break}case"attributes":if(!r.attributes)a.push(...Ze(b,s));break;case"media":if(!r.media)a.push(...Ze(b,s));else if(!c)a.push(...bt(n.media)),c=!0;break;case"note":case"end":if(!r.note)a.push(...Ze(b,s));else if(!u)a.push(...bt(n.note)),u=!0;break;default:a.push(...Ze(b,s))}}if(r.attributes&&!d&&n.attributes)a.splice(l,0,...bt(n.attributes)),l+=bt(n.attributes).length;if(r.media&&!c&&n.media)a.splice(l,0,...bt(n.media));if(r.note&&!u&&n.note){let p=a.length;while(p>l&&a[p-1].trim()==="")p-=1;let b=bt(n.note);a.splice(p,0,...b)}let m=t.shape.kind!=="heading"||t.shape.setext&&a[0]===this.lines[t.titleLine??-1];if(e.kind==="heading"&&a.length>0&&a[0].trim()!==""&&m)Qn(o);o.push(...a)}rewriteOwn(t,e,n,i,r){if(e.kind==="heading")Qn(r),r.push(`${"#".repeat(e.level)} ${`${n.title}${n.inline}`.trimStart()}`);else if(e.kind==="item")r.push(`${" ".repeat(e.indent)}${Vh(t.shape,e)} ${`${n.title}${n.inline}`.trimStart()}`);else throw new Yt("A node can only become the root by being it");r.push(...bt(n.attributes+n.media+n.note));let o=Wr(t.shape,e);for(let s of i)if(s.role==="foreign")r.push(...this.lines.slice(s.from,s.to).map((a)=>" ".repeat(o)+a.trimStart()))}patchTitle(t,e,n,i,r){let o=e.shape,s=`${i.title}${i.inline}`.trimStart();if(o.kind==="heading"&&n.kind==="heading"){let a=Ah.exec(t[0]);if(o.setext||!a)return!r.title&&!r.attributes&&o.level===n.level?t:[`${"#".repeat(n.level)} ${s}`];return[`${"#".repeat(n.level)}${a[3]}${this.titleText(a[4],e,i,r)}`]}if(o.kind==="item"&&n.kind==="item"){let a=Ph.exec(t[0]);if(!a)return[`${" ".repeat(n.indent)}${o.marker} ${s}`];return[`${n.indent===o.indent?a[1]:" ".repeat(n.indent)}${a[2]}${a[3]}${this.titleText(a[4],e,i,r)}`]}throw new Yt("A title line of another kind")}titleText(t,e,n,i){let r=za.exec(t),o=r?t.slice(0,r.index):t,s=i.attributes?n.inline:r?t.slice(r.index):"";if(e.shape.kind==="heading"&&s)o=o.replace(/\s+#+\s*$/,"");let a=i.title?Dh.exec(o):null,l=a?o.slice(0,a.index):o;return`${i.title?`${this.retitle(l,e,n)}${a?a[0].trimEnd():""}`:o}${s}`.trimStart()}retitle(t,e,n){if(e.shape.kind!=="item"||this.coarse)return n.title;let i=this.current,r=i?.status?Br[i.status]:void 0,o=Zn(ja({...e.fields,status:i?.status}),!0,{explicitIds:new Set}).title;if(!i||o!==n.title)return n.title;let s=Lh.exec(t),a=s?t.slice(s[0].length):t.trimStart();return r?`${r} ${a}`:a}emitChildren(t,e,n,i,r,o){let s=null,a=!1,l=this.childKinds(t,n),d=e.children.length-1,c=new Set,u=new Map(e.children.map((m,p)=>[m,p])),h=()=>{for(let m=0;m<=d;m+=1)if(!c.has(m))this.emitGap(e,m,i,r,n,o),c.add(m)};t.children.forEach((m,p)=>{let b=u.get(m)??-1,f=this.childContext(m,e,n,s,l[p],b!==-1);if(f.kind==="heading"&&!a)h(),a=!0;if(this.emit(m,f,o),s=f,b!==-1&&b!==d&&!c.has(b))this.emitGap(e,b,i,r,n,o),c.add(b)}),h();for(let m of i){let p=m.role==="end"&&this.lines.slice(m.from,m.to).some((b)=>b.trim()!=="");if(m.role==="end"&&!(p&&r.note))o.push(...this.lines.slice(m.from,m.to))}}emitGap(t,e,n,i,r,o){let s=Ua(t.shape,r);for(let a of n){if(a.after!==e||a.role==="end")continue;if(!(a.role==="attributes"&&i.attributes||a.role==="media"&&i.media||a.role==="note"&&i.note))o.push(...Ze(this.lines.slice(a.from,a.to),s))}}childKinds(t,e){if(e.kind==="item"||e.kind==="heading"&&e.level>=6)return t.children.map(()=>"item");let n=e.kind==="generated"||e.level<qn,i=t.children.map((m)=>{let p=this.records.get(m)?.shape;return p?.kind==="heading"||p?.kind==="item"?p.kind:null}),r=[],o=null;for(let m of i)r.push(o),o=m??o;let s=Array(i.length).fill(null);o=null;for(let m=i.length-1;m>=0;m-=1)s[m]=o,o=i[m]??o;let a=i.map((m,p)=>m??r[p]??s[p]??(n?"heading":"item")),l=a.filter((m)=>m==="item").length,d=n?0:a.length,c=Number.POSITIVE_INFINITY,u=0,h=0;for(let m=0;m<=a.length;m+=1){let p=u+(l-h);if(p<c||p===c&&!n)c=p,d=m;if(m<a.length)if(a[m]==="heading")u+=1;else h+=1}return a.map((m,p)=>p<d?"item":"heading")}childContext(t,e,n,i,r,o){let s=this.records.get(t)?.shape;if(n.kind==="item")return{kind:"item",indent:Wr(e.shape,n),marker:s?.kind==="item"?s.marker:Jn(i)};if(r==="item")return{kind:"item",indent:0,marker:s?.kind==="item"?s.marker:Jn(i)};let a=e.children.length>0?this.records.get(e.children[0])?.shape:void 0,l=n.kind==="heading"?n.level:0,d=n.kind==="heading"&&e.shape.kind==="heading"?n.level-e.shape.level:0,c=o&&s?.kind==="heading"?s.level+d:i?.kind==="heading"?i.level:a?.kind==="heading"?a.level+d:l+1,u=Math.max(l+1,i?.kind==="heading"?Math.min(c,i.level):c);if(u>6)throw new Yt("Headings only go six levels deep");return{kind:"heading",level:u}}generate(t,e,n){if(e.kind==="heading"){let i=qe(t,!1,this.writing,"");Qn(n),n.push(`${"#".repeat(e.level)} ${`${i.title}${i.inline}`.trimStart()}`,...bt(i.attributes+i.media+i.note));let r=null;for(let o of t.children){let s=e.level<qn?{kind:"heading",level:e.level+1}:{kind:"item",indent:0,marker:Jn(r)};this.generate(o,s,n),r=s}return}if(e.kind==="item"){let i=e.indent+e.marker.length+1,r=qe(t,!0,this.writing," ".repeat(i));n.push(`${" ".repeat(e.indent)}${e.marker} ${`${r.title}${r.inline}`.trimStart()}`,...bt(r.attributes+r.media+r.note));let o=null;for(let s of t.children){let a={kind:"item",indent:i,marker:Jn(o)};this.generate(s,a,n),o=a}return}throw new Yt("A new root")}}var Ah=/^( {0,3})(#{1,6})([ \t]+)(.*)$/,Lh=/^\s*\[( |x|X|\/)\]\s+/,Ph=/^([ \t]*)([-*+]|\d{1,9}[.)])([ \t]+)(.*)$/,za=/\s*<!--\s*orbit:?\s[\s\S]*-->\s*$/i,Dh=/(?:\s*(?<!\\)<!--[\s\S]*?-->)+\s*$/,Rh=(t)=>{if(t.kind==="heading")return{kind:"heading",level:t.level};if(t.kind==="item")return{kind:"item",indent:t.indent,marker:t.marker};return{kind:"generated"}},$h=(t,e)=>{if(t.kind==="heading")return e.kind==="heading"&&e.level===t.level;if(t.kind==="item")return e.kind==="item"&&e.indent===t.indent;return e.kind==="generated"},Bh=(t,e)=>t.length===e.length&&t.every((n,i)=>n===e[i]),Ua=(t,e)=>t.kind==="item"&&e.kind==="item"?e.indent-t.indent:0,Wr=(t,e)=>{if(e.kind!=="item")return 0;if(t.kind==="item")return t.content+e.indent-t.indent;return e.indent+e.marker.length+1},Vh=(t,e)=>{if(t.kind==="item")return t.marker;return e.kind==="item"?e.marker:"-"},Jn=(t)=>{if(t?.kind!=="item")return"-";let e=/^(\d+)([.)])$/.exec(t.marker);return e?`${Number(e[1])+1}${e[2]}`:t.marker},Ze=(t,e)=>{if(e===0)return t;return t.map((n)=>{if(n.trim()==="")return n;let i=n.replace(/^[ \t]+/,(o)=>Hh(o));if(e>0)return" ".repeat(e)+i;let r=/^ */.exec(i)[0].length;return i.slice(Math.min(r,-e))})},Hh=(t)=>{let e=0;for(let n of t)e=n==="\t"?e+4-e%4:e+1;return" ".repeat(e)},bt=(t)=>{if(t==="")return[];let e=t.split(`
|
|
119
|
+
`);if(e[e.length-1]==="")e.pop();return e},Qn=(t)=>{if(t.length>0&&t[t.length-1].trim()!=="")t.push("")},ja=(t)=>({...t,level:0,children:[]}),ti=(t,e,n)=>{let i={explicitIds:n?new Set([t]):new Set},{title:r,attributes:o}=Zn(t,e,i);return{title:r,attributes:JSON.stringify(o),media:Vr(t),note:t.note??""}},zh=(t,e,n,i)=>{let r=[e,JSON.stringify(e),`'${e.replace(/'/g,"''")}'`].map((s)=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`^(?:${r.join("|")})\\s*:`);for(let s=n;s<i;s+=1)if(o.test(t[s])){let a=s+1;while(a<i&&(t[a].trim()===""||/^\s/.test(t[a])||/^-(\s|$)/.test(t[a])))a+=1;while(a>s+1&&t[a-1].trim()==="")a-=1;return{from:s,to:a}}return null},Wa=(t)=>bt(He(t));var Ka=(t,e={})=>{let n=e.keepSource===!1?void 0:ae(t);if(n){let i=Ga(t,n);if(i!==null)return i}return Pa(t)};var qa=".orbit{position:relative;width:100%;height:100%;overflow:hidden;contain:size layout style;background:var(--_orbit-surface-pattern),var(--_orbit-surface);color:var(--_orbit-text);font-family:var(--_orbit-font-family);font-kerning:normal;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased}.orbit__canvas{display:block;width:100%;height:100%;overflow:visible;touch-action:none;outline:none;cursor:grab;-webkit-user-select:none;user-select:none}.orbit__world{cursor:grab}.orbit--static .orbit__canvas{cursor:default;touch-action:auto}.orbit--static .orbit__world{cursor:default}.orbit--dragging .orbit__canvas,.orbit--dragging .orbit-ring-band{cursor:grabbing}.orbit--embedded .orbit__canvas{touch-action:pan-x pan-y}.orbit--embedded[data-orbit-view=focus] .orbit-node--planet,.orbit--embedded[data-orbit-view=focus] .orbit-ring-band{touch-action:none}.orbit__contents,.orbit__labels,.orbit__overlay{position:absolute;inset:0;pointer-events:none}.orbit__labels{transform-origin:0 0}.orbit__live{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.orbit [hidden]{display:none !important}.orbit-rendered{position:relative}.orbit-rendered>.orbit{position:absolute;inset:0}.orbit-visually-hidden{position:absolute !important;width:1px !important;height:1px !important;overflow:hidden !important;clip-path:inset(50%) !important;white-space:nowrap !important}.orbit-icon{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}.orbit-icon--filled{fill:currentColor}.orbit-icon--glyph{display:inline-grid;place-items:center;font-size:16px;font-weight:650;line-height:1}.orbit-node-content{position:absolute;top:0;left:0;display:grid;place-items:center;width:100px;height:100px;overflow:hidden;border-radius:50%;color:var(--_orbit-node-text);font-family:var(--_orbit-label-font);font-size:22px;line-height:1.1;text-align:center;pointer-events:none;contain:layout paint}.orbit-ring{fill:none;stroke:color-mix(in oklab, var(--orbit-ring-color, var(--_orbit-ring-stroke)) var(--_orbit-ring-tint), var(--_orbit-ring-stroke));stroke-width:var(--_orbit-ring-width);stroke-dasharray:var(--_orbit-ring-dash);stroke-linecap:round;stroke-opacity:var(--_orbit-ring-opacity);vector-effect:non-scaling-stroke;pointer-events:none}.orbit-ring-band{fill:none;stroke:rgba(0,0,0,0);pointer-events:stroke}.orbit-link{stroke:color-mix(in oklab, var(--orbit-link-color, var(--_orbit-link-stroke)) var(--_orbit-link-tint), var(--_orbit-link-stroke));stroke-width:var(--_orbit-link-width);stroke-dasharray:var(--_orbit-link-dash);stroke-linecap:round;stroke-opacity:var(--_orbit-link-opacity);vector-effect:non-scaling-stroke;pointer-events:none}.orbit-shade__highlight{stop-color:var(--_orbit-node-highlight)}.orbit-shade__highlight-fade{stop-color:color-mix(in srgb, var(--_orbit-node-highlight) 20%, transparent)}.orbit-shade__terminator-start{stop-color:var(--_orbit-node-terminator);stop-opacity:0}.orbit-shade__terminator{stop-color:var(--_orbit-node-terminator)}.orbit-shade__shading{stop-color:var(--_orbit-node-shading)}.orbit-node{cursor:pointer;outline:none}.orbit-node__body{transform-origin:0 0;transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-node:not(.orbit-node--crowded):hover .orbit-node__body{transform:scale(1.045)}.orbit-node:not(.orbit-node--crowded):active .orbit-node__body{transform:scale(0.97)}.orbit-node__shadow{fill:color-mix(in oklab, var(--orbit-node-color) var(--_orbit-node-shadow-tint), var(--_orbit-node-shadow));opacity:var(--_orbit-node-shadow-opacity);transform:translate(0, calc(var(--_orbit-node-shadow-offset) * 1px)) scale(var(--_orbit-node-shadow-size));transition:opacity 320ms ease,transform 320ms ease,display 320ms allow-discrete}@starting-style{.orbit-node__shadow{opacity:0}}.orbit-node--sun .orbit-node__shadow{opacity:var(--_orbit-sun-shadow-opacity);transform:translate(0, calc(var(--_orbit-node-shadow-offset) * 1px)) scale(var(--_orbit-sun-shadow-size))}.orbit-node--node .orbit-node__shadow{display:none}.orbit-node__halo{display:none;fill:none;stroke:color-mix(in oklab, var(--orbit-node-color) var(--_orbit-sun-halo-tint), var(--_orbit-sun-halo));stroke-width:var(--_orbit-sun-halo-width);stroke-dasharray:var(--_orbit-sun-halo-dash);stroke-opacity:var(--_orbit-sun-halo-opacity);vector-effect:non-scaling-stroke;transform:scale(var(--_orbit-sun-halo-size));opacity:0;transition:opacity 320ms ease,display 320ms allow-discrete}.orbit-node--sun .orbit-node__halo{display:inline;opacity:1}@starting-style{.orbit-node--sun .orbit-node__halo{opacity:0}}.orbit-node--flat .orbit-node__shadow,.orbit-node--flat .orbit-node__halo{display:none;opacity:0}.orbit-node__disc{fill-opacity:var(--_orbit-node-fill-opacity)}.orbit-node__shade,.orbit-node__image,.orbit-node__shadow,.orbit-node__halo,.orbit-node__status,.orbit-node__marker,.orbit-node__play{pointer-events:none}.orbit-node__shade{stroke:color-mix(in oklab, var(--orbit-node-color, var(--_orbit-node-stroke)) var(--_orbit-node-stroke-tint), var(--_orbit-node-stroke));stroke-width:var(--_orbit-node-stroke-width);vector-effect:non-scaling-stroke}.orbit-node--crowded .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.04);vector-effect:none}.orbit-node__focus-ring{display:none;fill:none;stroke:var(--_orbit-focus-ring);stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:none;transition:opacity 120ms ease}.orbit-node:focus-visible .orbit-node__focus-ring{display:inline}@starting-style{.orbit-node:focus-visible .orbit-node__focus-ring{opacity:0}}.orbit-node__status{stroke:var(--_orbit-badge-stroke);stroke-width:.04}.orbit-node__status--active{fill:var(--_orbit-status-active)}.orbit-node__status--done{fill:var(--_orbit-status-done)}.orbit-node__status--blocked{fill:var(--_orbit-status-blocked)}.orbit-node__status--todo{fill:var(--_orbit-status-todo)}.orbit-node__status--neutral{fill:var(--_orbit-status-neutral)}.orbit-node--sun .orbit-node__status{stroke-width:.025}.orbit-node__marker{fill:var(--_orbit-note-indicator);stroke:var(--_orbit-badge-stroke);stroke-width:.04}.orbit-node__play{fill:rgba(15,23,42,.62)}.orbit-node__play path{fill:#fff}.orbit-node--moon{cursor:pointer}.orbit-node--sun .orbit-node__marker,.orbit-node--sun .orbit-node__play{display:none}.orbit-node--moon .orbit-node__disc{fill-opacity:var(--_orbit-moon-opacity)}.orbit-node--moon .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.7)}.orbit-node--speck .orbit-node__body{transform-box:fill-box;transform-origin:center}.orbit-node--speck .orbit-node__marker,.orbit-node--speck .orbit-node__status,.orbit-node--speck .orbit-node__play{display:none}.orbit-node--speck .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*var(--orbit-speck-radius)*var(--_orbit-speck-rim, 0.2));vector-effect:none}.orbit-node--speck.orbit-node--moon .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.7*var(--orbit-speck-radius)*var(--_orbit-speck-rim, 0.2))}.orbit-node--speck.orbit-node--crowded .orbit-node__shade{stroke-width:calc(var(--_orbit-node-stroke-width)*.04*var(--orbit-speck-radius))}.orbit-label{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;gap:2px;width:max-content;color:var(--_orbit-node-text);font-family:var(--_orbit-label-font);font-size:13px;font-weight:var(--_orbit-label-weight);line-height:1.22;text-align:center;letter-spacing:var(--_orbit-label-letter-spacing);overflow-wrap:break-word;hyphens:auto;will-change:transform,opacity;user-select:none}.orbit-label__icon{font-size:1.45em;line-height:1}.orbit-label__text{white-space:pre}.orbit-label--no-icon .orbit-label__icon{display:none}.orbit-label--sun{color:var(--_orbit-root-text);font-family:var(--_orbit-display-font);font-size:16px;font-weight:var(--_orbit-display-weight)}.orbit-label--node{font-size:12px}.orbit-label--light{color:var(--_orbit-node-text-inverse);text-shadow:var(--_orbit-label-shadow)}.orbit-label--outside{box-sizing:border-box;width:max-content;max-width:160px;padding:2px 8px;border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);font-size:11.5px;box-shadow:0 1px 2px rgba(15,23,42,.08)}.orbit-label--sun.orbit-label--outside{max-width:280px}.orbit-label--outside .orbit-label__icon{display:none}.orbit-label--outside .orbit-label__text{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;white-space:normal}.orbit-label--sun.orbit-label--outside .orbit-label__text{-webkit-line-clamp:2;line-clamp:2}.orbit-label--wrapped{max-width:var(--orbit-pill-width, 120px);border-radius:11px}.orbit-label--wrapped .orbit-label__text{-webkit-line-clamp:2;line-clamp:2}.orbit-count{position:absolute;top:0;left:0;padding:1px 6px;border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-muted-text);z-index:1;font-size:10.5px;font-weight:650;line-height:13px;font-variant-numeric:tabular-nums;translate:-50% -50%;pointer-events:none}.orbit-actions{position:absolute;top:0;left:0;display:flex;flex-wrap:wrap;justify-content:center;gap:8px;translate:-50% 0;opacity:0;visibility:hidden;transition:opacity 180ms ease,visibility 0s linear 180ms;pointer-events:auto}.orbit-actions--visible{opacity:1;visibility:visible;transition:opacity 220ms ease 60ms}.orbit-action{display:inline-grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--_orbit-action-border);border-radius:999px;background:var(--_orbit-action-background);color:var(--_orbit-action-text);box-shadow:var(--_orbit-action-shadow);cursor:pointer;transition:transform 160ms ease,box-shadow 160ms ease}.orbit-action:hover{transform:translateY(-1px)}.orbit-action:active{transform:scale(0.96)}.orbit-action:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-add{cursor:pointer;outline:none}.orbit-add__body{transform-origin:0 0;transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-add:hover .orbit-add__body{transform:scale(1.06)}.orbit-add:active .orbit-add__body{transform:scale(0.95)}.orbit-add__disc{fill:var(--_orbit-control-background);fill-opacity:.5;stroke:var(--_orbit-muted-text);stroke-opacity:.6;stroke-width:1.5;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;transition:fill-opacity 160ms ease,stroke-opacity 160ms ease}.orbit-add:hover .orbit-add__disc{fill-opacity:.8;stroke-opacity:.9}.orbit-add__plus{fill:none;stroke:var(--_orbit-muted-text);stroke-width:2.5;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none}.orbit-add__focus-ring{fill:none;stroke:var(--_orbit-focus-ring);stroke-width:2.5;vector-effect:non-scaling-stroke;opacity:0;pointer-events:none;transition:opacity 120ms ease}.orbit-add:focus-visible .orbit-add__focus-ring{opacity:1}.orbit-add--pending .orbit-add__disc{fill-opacity:1;stroke:var(--_orbit-focus-ring);stroke-opacity:1;stroke-width:2;stroke-dasharray:none}.orbit-add--pending .orbit-add__plus{display:none}.orbit-add--drop .orbit-add__plus{display:none}.orbit-add--drop .orbit-add__disc{fill-opacity:.35;stroke:var(--_orbit-focus-ring);stroke-opacity:.9}.orbit-add--drop .orbit-add__body{animation:orbit-drop-place 900ms ease-in-out infinite alternate}.orbit-add--waiting{opacity:.45}.orbit-add--held{pointer-events:none}.orbit-add--waiting .orbit-add__body{animation:none}@keyframes orbit-drop-place{from{transform:scale(0.92)}to{transform:scale(1)}}.orbit-node--editing .orbit-node__focus-ring{display:inline}.orbit-node--lifted .orbit-node__body{transform:scale(1.12)}.orbit-node--lifted .orbit-node__shadow{opacity:min(1,var(--_orbit-node-shadow-opacity)*1.6);transform:translate(0, calc(var(--_orbit-node-shadow-offset) * 2.5px)) scale(calc(var(--_orbit-node-shadow-size) * 1.08))}.orbit-node--drop-target .orbit-node__body{transform:scale(1.1)}.orbit-node--drop-target .orbit-node__focus-ring{display:inline}.orbit__carried{pointer-events:none}.orbit-editor{position:absolute;top:0;left:0;box-sizing:border-box;display:block;min-height:0;margin:0;padding:1px 2px;overflow:hidden;border:none;border-radius:6px;outline:none;background:rgba(0,0,0,0);color:var(--_orbit-node-text);caret-color:var(--_orbit-focus-ring);font-family:var(--_orbit-label-font);font-size:16px;font-weight:var(--_orbit-label-weight);line-height:1.22;letter-spacing:var(--_orbit-label-letter-spacing);text-align:center;white-space:pre-wrap;overflow-wrap:break-word;resize:none;pointer-events:auto;user-select:text;-webkit-user-select:text}.orbit-editor::placeholder{color:currentColor;opacity:.45}.orbit-editor--sun{color:var(--_orbit-root-text);font-family:var(--_orbit-display-font);font-weight:var(--_orbit-display-weight)}.orbit-editor--light{color:var(--_orbit-node-text-inverse)}.orbit-editor--slot{color:var(--_orbit-control-text)}.orbit-editor--floating{padding:4px 8px;border-radius:10px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);box-shadow:var(--_orbit-control-shadow)}.orbit-editor[hidden]{display:none}.orbit-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:24px;color:var(--_orbit-muted-text);font-size:13px;text-align:center;pointer-events:none}.orbit-empty strong{color:var(--_orbit-text);font-size:15px;font-weight:650}.orbit-outline--visible{position:absolute;top:60px;bottom:12px;left:12px;width:min(320px,100% - 24px);padding:8px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--_orbit-control-border);border-radius:14px;background:var(--_orbit-control-background);box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));-webkit-backdrop-filter:blur(var(--_orbit-control-blur));color:var(--_orbit-control-text);font-size:13px;z-index:1}.orbit-outline--visible ul{margin:0;padding:0;list-style:none}.orbit-outline--visible ul ul{margin-left:10px;padding-left:10px;border-left:1px solid var(--_orbit-control-border)}.orbit-outline--visible button,.orbit-outline--visible span{display:block;width:100%;padding:5px 8px;border:0;border-radius:8px;background:none;color:inherit;font:inherit;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.orbit-outline--visible button{cursor:pointer}.orbit-outline--visible button:hover{background:color-mix(in srgb, var(--_orbit-control-text) 8%, transparent)}.orbit-outline--visible button:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:-2px}.orbit-outline--visible button[aria-current=true]{background:var(--_orbit-control-active-background);color:var(--_orbit-control-active-text)}.orbit-tooltip{position:absolute;top:0;left:0;max-width:260px;padding:8px 12px;border-radius:10px;background:var(--_orbit-tooltip-background);color:var(--_orbit-tooltip-text);font-size:12.5px;line-height:1.4;box-shadow:0 8px 24px rgba(15,23,42,.18);pointer-events:none;translate:-50% calc(-100% - 10px);opacity:0;transition:opacity 140ms ease}.orbit-tooltip--visible{opacity:1}.orbit-tooltip__title{display:block;font-weight:650}.orbit-tooltip__detail{display:block;margin-top:2px;opacity:.82}.orbit-controls{position:absolute;inset:0;pointer-events:none}.orbit-controls__top{position:absolute;top:12px;right:12px;left:12px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.orbit-controls__start{display:flex;align-items:center;gap:8px;min-width:0}.orbit-controls__zoom{position:absolute;right:12px;bottom:12px}.orbit-panel{display:inline-flex;align-items:center;gap:2px;min-width:0;padding:3px;border:1px solid var(--_orbit-control-border);border-radius:12px;background:var(--_orbit-control-background);box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));-webkit-backdrop-filter:blur(var(--_orbit-control-blur));pointer-events:auto}.orbit-panel--vertical{flex-direction:column}.orbit-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:32px;height:32px;padding:0 8px;border:0;border-radius:9px;background:rgba(0,0,0,0);color:var(--_orbit-control-muted-text);font:inherit;font-size:12.5px;font-weight:600;white-space:nowrap;cursor:pointer;transition:background-color 140ms ease,color 140ms ease}.orbit-button:hover{color:var(--_orbit-control-text);background:color-mix(in srgb, var(--_orbit-control-text) 8%, transparent)}.orbit-button:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:1px}.orbit-button[aria-pressed=true],.orbit-button--active{background:var(--_orbit-control-active-background);color:var(--_orbit-control-active-text)}.orbit-button--icon{width:32px;padding:0}.orbit-breadcrumbs{display:flex;align-items:center;min-width:0}.orbit-breadcrumbs__item{max-width:180px;min-width:0}.orbit-breadcrumbs__item span{overflow:hidden;text-overflow:ellipsis}.orbit-breadcrumbs__item[aria-current=location]{color:var(--_orbit-control-text);cursor:default}.orbit-breadcrumbs__separator{flex:none;width:14px;height:14px;color:var(--_orbit-control-muted-text);opacity:.7}.orbit-back{display:none;max-width:180px}.orbit-back span{overflow:hidden;text-overflow:ellipsis}.orbit-hint{position:absolute;left:50%;bottom:16px;padding:7px 14px;border:1px solid var(--_orbit-control-border);border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);font-size:12.5px;font-weight:600;box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));translate:-50% 0;opacity:0;transition:opacity 200ms ease;pointer-events:none}.orbit-hint--visible{opacity:1}.orbit--narrow .orbit-controls__crumbs{display:none}.orbit--narrow .orbit-back{display:inline-flex}.orbit--narrow .orbit-segmented__label{display:none}@media(pointer: coarse){.orbit-button{min-width:40px;height:40px}.orbit-button--icon{width:40px}.orbit-action{width:42px;height:42px}}.orbit-sheet{box-sizing:border-box;width:min(560px,100vw - 32px);max-height:86vh;max-height:min(86vh,86dvh);margin:auto;padding:0;border:1px solid var(--_orbit-sheet-border);border-radius:20px;background:var(--_orbit-sheet-background);color:var(--_orbit-sheet-text);font-family:var(--_orbit-font-family);box-shadow:var(--_orbit-sheet-shadow);backdrop-filter:blur(var(--_orbit-sheet-blur));-webkit-backdrop-filter:blur(var(--_orbit-sheet-blur));overflow:hidden}.orbit-sheet[open]{display:flex;flex-direction:column;animation:orbit-sheet-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-sheet::backdrop{background:var(--_orbit-sheet-backdrop);backdrop-filter:blur(6px)}.orbit-sheet__header{display:flex;align-items:flex-start;gap:12px;padding:20px 20px 12px 24px}.orbit-sheet__handle{display:none}.orbit-sheet__heading{flex:1;min-width:0}.orbit-sheet__path{margin:0 0 4px;color:var(--_orbit-sheet-muted-text);font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.orbit-sheet__title{margin:0;font-family:var(--_orbit-display-font);font-size:20px;font-weight:var(--_orbit-display-weight);line-height:1.25;overflow-wrap:anywhere}.orbit-sheet__chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}.orbit-sheet__chip{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;background:var(--_orbit-chip-background);color:var(--_orbit-chip-text);font-size:12px;font-weight:600}.orbit-sheet__chip::before{content:\"\";display:none;width:7px;height:7px;border-radius:50%;background:currentColor}.orbit-sheet__chip--status::before{display:block;background:var(--orbit-chip-dot, var(--_orbit-status-neutral))}.orbit-sheet__chip--type{background:none;box-shadow:inset 0 0 0 1px var(--_orbit-chip-background)}.orbit-sheet__details{margin-bottom:16px}.orbit-sheet__actions{display:flex;flex-wrap:wrap;gap:8px;margin-left:auto}.orbit-sheet__action{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid var(--_orbit-sheet-border);border-radius:999px;background:none;color:var(--_orbit-sheet-text);font:inherit;font-size:14px;font-weight:600;cursor:pointer}.orbit-sheet__action:hover{background:color-mix(in srgb, var(--_orbit-sheet-text) 8%, transparent)}.orbit-sheet__action:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-sheet__action .orbit-icon{width:16px;height:16px}.orbit-sheet__action .orbit-icon--glyph{font-size:14px}.orbit-sheet__close{flex:none}.orbit-sheet__body{flex:1;min-height:0;padding:0 24px 20px;overflow:auto;overscroll-behavior:contain;font-size:15px;line-height:1.6}.orbit-sheet__media{margin:0 0 16px}.orbit-sheet__media img,.orbit-sheet__media video{display:block;width:100%;max-height:60vh;object-fit:contain;border-radius:12px;background:var(--_orbit-chip-background)}.orbit-sheet__media iframe{display:block;width:100%;aspect-ratio:16/9;border:0;border-radius:12px;background:#000}.orbit-sheet__media figcaption{margin-top:8px;color:var(--_orbit-sheet-muted-text);font-size:13px}.orbit-sheet__picture{display:block;width:100%;padding:0;border:0;border-radius:12px;background:none;cursor:zoom-in}.orbit-sheet__picture:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-sheet__expand{display:inline-flex;align-items:center;gap:6px;margin-top:8px;padding:5px 12px;border:1px solid var(--_orbit-sheet-border);border-radius:999px;background:none;color:var(--_orbit-sheet-text);font:inherit;font-size:13px;font-weight:600;cursor:pointer}.orbit-sheet__expand:hover{background:color-mix(in srgb, var(--_orbit-sheet-text) 8%, transparent)}.orbit-sheet__expand:focus-visible{outline:2.5px solid var(--_orbit-focus-ring);outline-offset:2px}.orbit-sheet__expand .orbit-icon{width:16px;height:16px}.orbit-sheet__note>:first-child{margin-top:0}.orbit-sheet__note>:last-child{margin-bottom:0}.orbit-sheet__note p,.orbit-sheet__note ul,.orbit-sheet__note ol,.orbit-sheet__note blockquote,.orbit-sheet__note pre{margin:0 0 12px}.orbit-sheet__note ul,.orbit-sheet__note ol{padding-left:22px}.orbit-sheet__note h3,.orbit-sheet__note h4,.orbit-sheet__note h5{margin:18px 0 8px;font-size:15px;font-weight:650}.orbit-sheet__note a{color:var(--_orbit-link-text);text-underline-offset:2px}.orbit-sheet__note code{padding:1px 5px;border-radius:6px;background:var(--_orbit-chip-background);font-size:.92em}.orbit-sheet__note pre{padding:12px;border-radius:10px;background:var(--_orbit-chip-background);overflow:auto}.orbit-sheet__note pre code{padding:0;background:none}.orbit-sheet__note blockquote{padding-left:12px;border-left:3px solid var(--_orbit-sheet-border);color:var(--_orbit-sheet-muted-text)}.orbit-sheet__footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px;border-top:1px solid var(--_orbit-sheet-border)}.orbit-sheet__link{padding:0;border:0;background:none;color:var(--_orbit-link-text);font:inherit;font-weight:600;text-decoration:none;cursor:pointer}.orbit-sheet .orbit-button{color:var(--_orbit-sheet-muted-text)}.orbit-sheet .orbit-button:hover{color:var(--_orbit-sheet-text);background:color-mix(in srgb, var(--_orbit-sheet-text) 8%, transparent)}@media(max-width: 640px){.orbit-sheet{width:100%;max-width:100%;max-height:88vh;max-height:88dvh;margin:auto 0 0;border-bottom:0;border-radius:20px 20px 0 0}.orbit-sheet[open]{animation-name:orbit-sheet-up}.orbit-sheet__handle{display:block;width:40px;height:5px;margin:8px auto 0;border-radius:999px;background:var(--_orbit-sheet-border);touch-action:none}}@media(min-width: 960px){.orbit-sheet{width:min(440px,40vw);height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;margin:0 0 0 auto;border-width:0 0 0 1px;border-radius:0}.orbit-sheet[open]{animation-name:orbit-sheet-side}.orbit-sheet::backdrop{backdrop-filter:none}}@keyframes orbit-sheet-side{from{transform:translateX(100%)}}@keyframes orbit-sheet-in{from{opacity:0;transform:translateY(8px) scale(0.98)}}@keyframes orbit-sheet-up{from{transform:translateY(100%)}}.orbit-viewer{position:fixed;inset:0;box-sizing:border-box;width:auto;height:auto;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:hidden;background:rgba(0,0,0,0);color:var(--_orbit-sheet-text);font-family:var(--_orbit-font-family);outline:none;overscroll-behavior:contain;touch-action:none}.orbit-viewer[open]{display:grid;grid-template-rows:auto minmax(0, 1fr) auto;animation:orbit-viewer-in 180ms ease-out}.orbit-viewer::backdrop{background:rgba(0,0,0,0)}.orbit-viewer::before{content:\"\";position:absolute;inset:0;background:var(--_orbit-sheet-background);backdrop-filter:blur(var(--_orbit-sheet-blur));-webkit-backdrop-filter:blur(var(--_orbit-sheet-blur));opacity:calc(1 - var(--_orbit-viewer-pull, 0)*.8)}.orbit-viewer__bar{grid-row:1;position:relative;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:40px;padding:max(12px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 4px max(16px,env(safe-area-inset-left));opacity:calc(1 - var(--_orbit-viewer-pull, 0))}.orbit-viewer__counter{margin:0;color:var(--_orbit-sheet-muted-text);font-size:13px;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}.orbit-viewer__tools{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-left:auto}.orbit-viewer__stage{grid-row:2;position:relative;overflow:hidden;touch-action:none}.orbit-viewer__media{position:absolute;inset:0}.orbit-viewer__media--entering{animation:orbit-viewer-show 200ms ease-out}.orbit-viewer--settling .orbit-viewer__media{transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-viewer__picture{position:absolute;box-sizing:content-box;max-width:none;max-height:none;margin:0;padding:0;border:0;transform-origin:center;cursor:zoom-in;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.orbit-viewer__picture--gliding{transition:transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1)}.orbit-viewer--zoomed .orbit-viewer__picture{cursor:grab}.orbit-viewer--dragging .orbit-viewer__picture{cursor:grabbing}.orbit-viewer__player{position:absolute;overflow:hidden;border-radius:12px;background:#000;box-shadow:var(--_orbit-sheet-shadow)}.orbit-viewer__player iframe,.orbit-viewer__player video{display:block;width:100%;height:100%;border:0;background:#000}.orbit-viewer__status{position:absolute;inset:0;display:grid;place-items:center;align-content:center;gap:12px;margin:0;padding:24px;color:var(--_orbit-sheet-muted-text);font-size:14px;text-align:center;pointer-events:none}.orbit-viewer__status--loading::before{content:\"\";width:28px;height:28px;border:3px solid currentColor;border-top-color:rgba(0,0,0,0);border-radius:50%;opacity:.7;animation:orbit-viewer-spin 800ms linear infinite}.orbit-viewer__step{position:absolute;top:calc(50% - 22px);width:44px;height:44px;border:1px solid var(--_orbit-control-border);border-radius:999px;background:var(--_orbit-control-background);color:var(--_orbit-control-text);box-shadow:var(--_orbit-control-shadow);backdrop-filter:blur(var(--_orbit-control-blur));-webkit-backdrop-filter:blur(var(--_orbit-control-blur))}.orbit-viewer__step:hover{background:color-mix(in srgb, var(--_orbit-control-text) 8%, var(--_orbit-control-background))}.orbit-viewer__step:disabled{opacity:.4;cursor:default}.orbit-viewer__step--previous{left:max(12px,env(safe-area-inset-left))}.orbit-viewer__step--next{right:max(12px,env(safe-area-inset-right))}.orbit-viewer__caption{grid-row:3;position:relative;max-height:30vh;padding:6px max(24px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));overflow:auto;overscroll-behavior:contain;touch-action:pan-y;text-align:center;opacity:calc(1 - var(--_orbit-viewer-pull, 0))}.orbit-viewer__title{max-width:72ch;margin:0 auto;font-family:var(--_orbit-display-font);font-size:17px;font-weight:var(--_orbit-display-weight);line-height:1.3;overflow-wrap:anywhere}.orbit-viewer__text,.orbit-viewer__description{max-width:72ch;margin:4px auto 0;font-size:14px;line-height:1.5;overflow-wrap:anywhere}.orbit-viewer__description{color:var(--_orbit-sheet-muted-text);font-size:13px}.orbit-viewer--still .orbit-viewer__bar,.orbit-viewer--still .orbit-viewer__step{display:none}.orbit-viewer--still .orbit-viewer__media{pointer-events:none}@media(max-width: 640px){.orbit-viewer__bar{padding-right:max(12px,env(safe-area-inset-right));padding-left:max(12px,env(safe-area-inset-left))}.orbit-viewer__tools{gap:6px}.orbit-viewer__step--previous{left:max(8px,env(safe-area-inset-left))}.orbit-viewer__step--next{right:max(8px,env(safe-area-inset-right))}.orbit-viewer__caption{padding-right:max(16px,env(safe-area-inset-right));padding-left:max(16px,env(safe-area-inset-left))}.orbit-viewer__title{font-size:16px}}@keyframes orbit-viewer-in{from{opacity:0}}@keyframes orbit-viewer-show{from{opacity:0;transform:scale(0.98)}}@keyframes orbit-viewer-spin{to{transform:rotate(360deg)}}.orbit-error{box-sizing:border-box;margin:12px;padding:14px 16px;border:1px dashed var(--_orbit-error-border);border-radius:12px;background:var(--_orbit-error-background);color:var(--_orbit-error-text);font:14px/1.45 var(--_orbit-font-family)}@supports not (color: color-mix(in srgb, red, blue)){.orbit-ring{stroke:var(--_orbit-ring-stroke)}.orbit-link{stroke:var(--_orbit-link-stroke)}.orbit-shade__highlight-fade{stop-color:var(--_orbit-node-highlight);stop-opacity:.2}.orbit-node__shadow{fill:var(--_orbit-node-shadow)}.orbit-node__halo{stroke:var(--_orbit-sun-halo)}.orbit-node__shade{stroke:var(--_orbit-node-stroke)}.orbit-outline--visible button:hover,.orbit-button:hover,.orbit-sheet__action:hover,.orbit-sheet__expand:hover,.orbit-sheet .orbit-button:hover{background:rgba(127,127,127,.14)}.orbit-viewer__step:hover{background:var(--_orbit-control-background)}}@supports not (translate: 1px){.orbit-hint{transform:translateX(-50%)}}@media(prefers-reduced-motion: reduce){.orbit *,.orbit-sheet,.orbit-viewer{transition:none !important;animation:none !important}}@media(forced-colors: active){.orbit-node__focus-ring,.orbit-add__focus-ring{stroke:Highlight}.orbit-add__disc,.orbit-add__plus{stroke:CanvasText}.orbit-node__shade,.orbit-node__halo{stroke:CanvasText}.orbit-node__shadow{display:none}.orbit-button[aria-pressed=true]{outline:2px solid Highlight}}";var Za=".orbit-print{color:var(--orbit-print-text, var(--_orbit-print-text));font-family:var(--orbit-print-font, var(--_orbit-print-font));font-size:11pt;line-height:1.45;print-color-adjust:exact;-webkit-print-color-adjust:exact}.orbit-print__title{margin:0 0 6pt;font-family:var(--orbit-print-display-font, var(--_orbit-print-display-font));font-size:22pt;line-height:1.2;break-after:avoid}.orbit-print__picture{margin:12pt 0 18pt;break-inside:avoid}.orbit-print__picture svg{display:block;width:100%;height:auto;max-height:150mm}.orbit-print__children{margin-inline-start:4pt;padding-inline-start:12pt;border-inline-start:1px solid var(--orbit-print-border, var(--_orbit-print-border))}.orbit-print__entry{padding:5pt 0 3pt;break-inside:avoid}.orbit-print__entry--parent{break-after:avoid}.orbit-print__name{margin:0;font-family:var(--orbit-print-display-font, var(--_orbit-print-display-font));font-size:11pt;line-height:1.3}.orbit-print__name--depth-1{margin-top:8pt;font-size:15pt}.orbit-print__name--depth-2{font-size:12.5pt}.orbit-print__dot{display:inline-block;width:.6em;height:.6em;margin-inline-end:.4em;border-radius:50%;background:var(--orbit-print-dot);vertical-align:.05em}.orbit-print__chips{display:flex;flex-wrap:wrap;gap:3pt 4pt;margin:3pt 0 0}.orbit-print__chip{padding:0 6pt;border-radius:8pt;background:var(--orbit-print-chip-background, var(--_orbit-print-chip-background));color:var(--orbit-print-chip-text, var(--_orbit-print-chip-text));font-size:8.5pt;line-height:1.7}.orbit-print__chip--status::before{content:\"\";display:inline-block;width:6pt;height:6pt;margin-inline-end:4pt;border-radius:50%;background:var(--orbit-print-status);vertical-align:.05em}.orbit-print__link{margin:3pt 0 0;color:var(--orbit-print-muted-text, var(--_orbit-print-muted-text));font-size:9pt}.orbit-print__address{color:var(--orbit-print-link-text, var(--_orbit-print-link-text));overflow-wrap:anywhere;text-decoration:none}.orbit-print__details{margin:4pt 0 0;font-size:10pt}.orbit-print__note{margin:4pt 0 0;font-size:10pt}.orbit-print__note p,.orbit-print__note ul,.orbit-print__note ol,.orbit-print__note pre,.orbit-print__note blockquote{margin:0 0 4pt}.orbit-print__note ul,.orbit-print__note ol{padding-inline-start:16pt}.orbit-print__note blockquote{padding-inline-start:8pt;border-inline-start:2pt solid var(--orbit-print-border, var(--_orbit-print-border));color:var(--orbit-print-muted-text, var(--_orbit-print-muted-text))}.orbit-print__note pre,.orbit-print__note code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:9pt;white-space:pre-wrap}.orbit-print__note a{color:var(--orbit-print-link-text, var(--_orbit-print-link-text))}.orbit-print__note img{display:block;max-width:100%;max-height:80mm;break-inside:avoid}.orbit-print__note--plain{white-space:pre-wrap}.orbit-print__media{margin:6pt 0 0;break-inside:avoid}.orbit-print__image{display:block;max-width:60%;max-height:70mm;border-radius:6pt;object-fit:contain}.orbit-print__caption{margin-top:2pt;color:var(--orbit-print-muted-text, var(--_orbit-print-muted-text));font-size:8.5pt;overflow-wrap:anywhere}";var Qa=qa+Za+da(),Xa=new WeakSet,Ja=null,ei=(t)=>{let e=jh(t);if(!e||Xa.has(e))return;if(Xa.add(e),"adoptedStyleSheets"in e&&typeof CSSStyleSheet==="function"&&"replaceSync"in CSSStyleSheet.prototype)try{Ja??=Uh(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,Ja];return}catch{}let n=(t.ownerDocument??document).createElement("style");if(n.setAttribute("data-orbit-styles",""),n.textContent=Qa,tl(e))e.appendChild(n);else(e.head??e.documentElement).appendChild(n)},Uh=()=>{let t=new CSSStyleSheet;return t.replaceSync(Qa),t},jh=(t)=>{let e=t.getRootNode?.();if(e&&tl(e))return e;return t.ownerDocument??(typeof document>"u"?null:document)},tl=(t)=>typeof ShadowRoot<"u"&&t instanceof ShadowRoot;class Gr{element=null;container;callbacks;pointers=new Map;gesture="none";engaged=!1;startPoint=null;lastPoint=null;gestureRectangle=null;lastPinchDistance=null;lastPinchCenter=null;suppressNextClick=!1;lastTap=null;longPress=null;pressTaken=!1;lifted=!1;constructor(t,e){this.container=t,this.callbacks=e}attach(t){if(this.element===t)return;this.detach(),this.element=t,t.addEventListener("pointerdown",this.handlePointerDown),t.addEventListener("pointermove",this.handlePointerMove),t.addEventListener("pointerup",this.handlePointerUp),t.addEventListener("pointercancel",this.handlePointerUp),t.addEventListener("wheel",this.handleWheel,{passive:!1}),t.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),t.addEventListener("dblclick",this.handleDoubleClick),t.addEventListener("click",this.handleClickCapture,!0)}detach(){let t=this.element;if(!t)return;t.removeEventListener("pointerdown",this.handlePointerDown),t.removeEventListener("pointermove",this.handlePointerMove),t.removeEventListener("pointerup",this.handlePointerUp),t.removeEventListener("pointercancel",this.handlePointerUp),t.removeEventListener("wheel",this.handleWheel),t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("dblclick",this.handleDoubleClick),t.removeEventListener("click",this.handleClickCapture,!0),this.element=null,this.reset()}reset(){if(this.lifted||this.gesture==="move")this.callbacks.onNodeDrag(this.lastPoint??{x:0,y:0},"cancel");if(this.engaged)this.callbacks.onDraggingChange(!1);this.cancelLongPress(),this.pressTaken=!1,this.lifted=!1,this.pointers.clear(),this.gestureRectangle=null,this.gesture="none",this.engaged=!1,this.startPoint=null,this.lastPoint=null,this.lastPinchDistance=null,this.lastPinchCenter=null}localPoint(t){let e=this.gestureRectangle??this.container.getBoundingClientRect(),n=Number.isFinite(t.clientX)?t.clientX-e.left:e.width/2,i=Number.isFinite(t.clientY)?t.clientY-e.top:e.height/2;return{x:n,y:i}}angleOf(t){let e=this.callbacks.spinCenter();return Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI}pinchDistance(){if(this.pointers.size<2)return null;let[t,e]=Array.from(this.pointers.values());return Math.hypot(t.x-e.x,t.y-e.y)}pinchCenter(){let[t,e]=Array.from(this.pointers.values());return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}handleClickCapture=(t)=>{if(!this.suppressNextClick)return;this.suppressNextClick=!1,t.stopPropagation(),t.preventDefault()};handlePointerDown=(t)=>{if(!this.callbacks.isInteractive())return;if(t.pointerType==="mouse"&&t.button!==0)return;if(this.pointers.size===0)this.gestureRectangle=this.container.getBoundingClientRect();let e=this.localPoint(t);if(this.pointers.set(t.pointerId,e),this.suppressNextClick=!1,this.cancelLongPress(),this.pointers.size===2){if(this.lifted||this.gesture==="move")this.lifted=!1,this.callbacks.onNodeDrag(this.lastPoint??e,"cancel");if(this.engaged&&this.gesture==="spin")this.callbacks.onSpinEnd(t.timeStamp,!0);else if(this.engaged&&this.gesture==="pan")this.callbacks.onPanEnd(t.timeStamp,!0);if(!this.engaged)this.callbacks.onDraggingChange(!0);this.gesture="pinch",this.engaged=!0,this.lastPinchDistance=this.pinchDistance(),this.lastPinchCenter=this.pinchCenter();return}if(this.pointers.size>2)return;let n=this.callbacks.isCoasting();if(n)this.callbacks.onCatch(),this.suppressNextClick=!0;this.startPoint=e,this.lastPoint=e,this.engaged=!1,this.pressTaken=!1;let i=this.callbacks.dragGesture(e);if(this.gesture=i==="none"?"tap":i,!n)this.startLongPress(t.pointerId,e,t.target,t.pointerType==="mouse")};startLongPress(t,e,n,i){let r=setTimeout(()=>{if(this.longPress=null,this.engaged||this.pointers.size!==1)return;let o=!i&&this.callbacks.onLongPress(e,n),s=this.callbacks.onHold(e,n);if(!o&&!s)return;if(this.lifted=s,this.lastTap=null,i)return;this.pressTaken=!0,this.gesture="none",this.suppressNextClick=!0},this.callbacks.longPressDelay());this.longPress={pointerId:t,timer:r}}cancelLongPress(){if(this.longPress)clearTimeout(this.longPress.timer),this.longPress=null}handlePointerMove=(t)=>{if(!this.pointers.has(t.pointerId))return;let e=this.localPoint(t);if(this.pointers.set(t.pointerId,e),this.gesture==="pinch"){let s=this.pinchDistance();if(s===null)return;let a=this.pinchCenter(),l=this.lastPinchCenter??a,d=this.lastPinchDistance?s/this.lastPinchDistance:1;this.callbacks.onPinch(d,a,a.x-l.x,a.y-l.y),this.lastPinchDistance=s,this.lastPinchCenter=a;return}if(!this.startPoint||!this.lastPoint)return;let n=Math.hypot(e.x-this.startPoint.x,e.y-this.startPoint.y),i=t.pointerType==="mouse"?4:8;if(this.longPress&&n>=i)this.cancelLongPress();if(this.lifted&&this.gesture!=="move"){if(n<i)return;this.gesture="move",this.engaged=!0,this.callbacks.onDraggingChange(!0);try{this.element?.setPointerCapture?.(t.pointerId)}catch{}}if(this.gesture==="move"){this.lastPoint=e,this.callbacks.onNodeDrag(e,"move");return}if(this.gesture!=="spin"&&this.gesture!=="pan")return;if(!this.engaged){if(n<i)return;this.cancelLongPress(),this.engaged=!0,this.callbacks.onDraggingChange(!0);try{this.element?.setPointerCapture?.(t.pointerId)}catch{}if(this.gesture==="spin")this.callbacks.onSpinStart(t.timeStamp,this.angleOf(e));else this.callbacks.onPanStart(t.timeStamp)}let r=typeof t.getCoalescedEvents==="function"?t.getCoalescedEvents():[],o=r.length>0?r.map((s)=>({point:this.localPoint(s),time:s.timeStamp})):[{point:e,time:t.timeStamp}];for(let s of o){if(this.gesture==="spin")this.callbacks.onSpinMove(s.time,this.angleOf(s.point));else this.callbacks.onPan(s.point.x-this.lastPoint.x,s.point.y-this.lastPoint.y,s.time);this.lastPoint=s.point}};handlePointerUp=(t)=>{if(!this.pointers.delete(t.pointerId))return;this.cancelLongPress();let e=this.localPoint(t);if(this.pointers.size===0)this.gestureRectangle=null;if(this.gesture==="pinch"){if(this.pointers.size===1){this.callbacks.onPinchEnd();let i=Array.from(this.pointers.values())[0];if(this.lastPinchDistance=null,this.lastPinchCenter=null,this.startPoint=i,this.lastPoint=i,this.callbacks.dragGesture(i)==="pan")this.gesture="pan",this.callbacks.onPanStart(t.timeStamp);else this.gesture="none";this.suppressNextClick=!0;return}if(this.pointers.size===0){this.callbacks.onPinchEnd(),this.suppressNextClick=!0,this.reset();return}this.lastPinchDistance=this.pinchDistance(),this.lastPinchCenter=this.pinchCenter();return}if(this.pointers.size>0)return;let n=t.type==="pointercancel";if(this.lifted||this.gesture==="move")this.lifted=!1,this.callbacks.onNodeDrag(e,n?"cancel":"drop"),this.gesture="none";if(this.engaged){if(this.suppressNextClick=!n,this.gesture==="spin")this.callbacks.onSpinEnd(t.timeStamp,n);else if(this.gesture==="pan")this.callbacks.onPanEnd(t.timeStamp,n)}else if(t.pointerType!=="mouse"&&t.type==="pointerup"&&!this.pressTaken)this.detectDoubleTap(e,t.timeStamp,t.target);this.reset()};detectDoubleTap(t,e,n){let i=this.lastTap;if(i&&e-i.time<320&&Math.hypot(t.x-i.point.x,t.y-i.point.y)<28){this.lastTap=null,this.callbacks.onDoubleTap(t,n);return}this.lastTap={time:e,point:t}}handleDoubleClick=(t)=>{if(!this.callbacks.isInteractive())return;this.callbacks.onDoubleTap(this.localPoint(t),t.target)};handleTouchMove=(t)=>{if((this.lifted||this.gesture==="move")&&t.cancelable)t.preventDefault()};handleWheel=(t)=>{if(!this.callbacks.isInteractive())return;this.callbacks.onWheel(t,this.localPoint(t))}}var ni=(t,e)=>{let n=t.deltaY;if(t.deltaMode===1)n*=16;else if(t.deltaMode===2)n*=e;let i=t.ctrlKey&&t.deltaMode===0&&Math.abs(t.deltaY)<50,r=Math.exp(-n*0.002*(i?5:1));return Math.min(2,Math.max(0.5,r))};class Yr{paint;schedule;cancel;tasks=new Set;frameHandle=null;previousTime=null;paintRequested=!1;constructor(t,e=(i)=>requestAnimationFrame(i),n=(i)=>cancelAnimationFrame(i)){this.paint=t,this.schedule=e,this.cancel=n}add(t){return this.tasks.add(t),this.wake(),()=>{this.tasks.delete(t)}}requestPaint(){this.paintRequested=!0,this.wake()}get isRunning(){return this.frameHandle!==null}stop(){if(this.frameHandle!==null)this.cancel(this.frameHandle);this.frameHandle=null,this.previousTime=null,this.tasks.clear(),this.paintRequested=!1}wake(){if(this.frameHandle===null)this.frameHandle=this.schedule(this.tick)}tick=(t)=>{let e=this.previousTime===null?16.666666666666668:Math.min(64,Math.max(0,t-this.previousTime));this.previousTime=t;let n=this.paintRequested;for(let i of Array.from(this.tasks)){let r;try{r=i(t,e)}catch(o){console.error("[orbit] An animation task threw:",o),r=!1}if(r===!1)this.tasks.delete(i);n||=r!=="hold"}if(this.paintRequested=!1,n)try{this.paint()}catch(i){console.error("[orbit] Painting the map threw:",i)}if(this.tasks.size>0||this.paintRequested)this.frameHandle=this.schedule(this.tick);else this.frameHandle=null,this.previousTime=null}}var Kr=(t)=>t<0.5?4*t*t*t:1-(-2*t+2)**3/2;var ot=(t,e,n)=>{if(t<=e)return 0;if(t>=n)return 1;return(t-e)/(n-e)},st=(t,e,n)=>t+(e-t)*n;var X=(t,e,n)=>({x:(n.x-t.x)*t.scale+e.width/2,y:(n.y-t.y)*t.scale+e.height/2}),Qe=(t,e,n)=>({x:(n.x-e.width/2)/t.scale+t.x,y:(n.y-e.height/2)/t.scale+t.y}),el=(t,e)=>`translate(${Je(e.width/2)} ${Je(e.height/2)}) scale(${Je(t.scale,5)}) translate(${Je(-t.x)} ${Je(-t.y)})`,qr=(t,e,n,i)=>{let r=Qe(t,e,i),o=t.scale*n;return{scale:o,x:r.x-(i.x-e.width/2)/o,y:r.y-(i.y-e.height/2)/o}},nl=(t,e,n)=>({scale:t.scale,x:t.x-e/t.scale,y:t.y-n/t.scale}),Wh={top:0,right:0,bottom:0,left:0},il=(t,e,n,i,r,o=Wh)=>{let s=Math.max(1,n.width-o.left-o.right),a=Math.max(1,n.height-o.top-o.bottom),l=Math.max(s-i*2,s*0.35),d=Math.max(a-i*2,a*0.35),c=Math.min(e.x>0?l/(e.x*2):r,e.y>0?d/(e.y*2):r,r),u=c>0&&Number.isFinite(c)?c:1;return{x:t.x-(o.left-o.right)/2/u,y:t.y-(o.top-o.bottom)/2/u,scale:u}},tn={scale:1,x:0,y:0},me=(t,e)=>({x:e.x*t.scale+t.x,y:e.y*t.scale+t.y});var rl=(t,e)=>{let n=me(t,e);return{x:n.x,y:n.y,scale:e.scale/t.scale}},Xe=Math.SQRT2;var Zr=(t,e,n)=>{let i=Math.max(n.width,1),{x:r,y:o}=t,s=i/t.scale,a=i/e.scale,l=e.x-t.x,d=e.y-t.y,c=l*l+d*d;if(c<0.000000000001){let y=Math.log(a/s)/Xe;return{length:Math.abs(y),at:(v)=>({x:r+v*l,y:o+v*d,scale:i/(s*Math.exp(Xe*v*y))})}}let u=Math.sqrt(c),h=(a*a-s*s+4*c)/(2*s*2*u),m=(a*a-s*s-4*c)/(2*a*2*u),p=Math.log(Math.sqrt(h*h+1)-h),f=(Math.log(Math.sqrt(m*m+1)-m)-p)/Xe,g=Math.cosh(p);return{length:Math.abs(f),at:(y)=>{let v=y*f,O=s/(2*u)*(g*Math.tanh(Xe*v+p)-Math.sinh(p)),M=s*g/Math.cosh(Xe*v+p);return{x:r+O*l,y:o+O*d,scale:i/M}}}},Je=(t,e=3)=>{let n=10**e;return Math.round(t*n)/n};var $t=(t)=>{let e=t%360;if(e>180)e-=360;else if(e<=-180)e+=360;return e};class Jr{samples=[];lastRawAngle=0;unwrappedAngle=0;reset(t,e){this.lastRawAngle=e,this.unwrappedAngle=e,this.samples=[{time:t,angle:e}]}add(t,e){let n=$t(e-this.lastRawAngle);this.lastRawAngle=e,this.unwrappedAngle+=n,this.samples.push({time:t,angle:this.unwrappedAngle});while(this.samples.length>2&&t-this.samples[0].time>160)this.samples.shift();return n}velocityAt(t){let e=this.samples.filter((s)=>t-s.time<=80);if(e.length<2||t-e[e.length-1].time>50)return 0;let n=e.reduce((s,a)=>s+a.time,0)/e.length,i=e.reduce((s,a)=>s+a.angle,0)/e.length,r=0,o=0;for(let s of e)r+=(s.time-n)*(s.angle-i),o+=(s.time-n)**2;return o===0?0:r/o}}var Qr={decay:1.4,maxSpeed:1440,settleSpeed:30,snap:!1},Xr=10;class to{angle=0;velocity=0;mode="idle";settings;settleTarget=0;slots=[];constructor(t={}){this.settings={...Qr,...t}}grab(){this.mode="dragging",this.velocity=0}drag(t){this.angle+=t}release(t,e=[]){this.slots=e;let n=this.settings.maxSpeed/1000;if(this.velocity=Math.max(-n,Math.min(n,t)),Math.abs(this.velocity)*1000>=this.settings.settleSpeed)this.mode="coasting";else this.beginSettling()}settleTo(t){this.settleTarget=this.angle+$t(t-this.angle),this.mode="settling"}stop(){this.mode="idle",this.velocity=0}get isMoving(){return this.mode==="coasting"||this.mode==="settling"}step(t){if(this.mode==="coasting"){let e=this.settings.decay*1000,n=Math.exp(-t/e);if(this.angle+=this.velocity*e*(1-n),this.velocity*=n,Math.abs(this.velocity)*1000<this.settings.settleSpeed)this.beginSettling();return!0}if(this.mode==="settling")return this.stepSettling(t);return!1}beginSettling(){if(!this.settings.snap||this.slots.length===0){this.stop();return}this.settleTarget=this.nearestSlot(this.angle),this.mode="settling"}nearestSlot(t){let e=t,n=1/0;for(let i of this.slots){let r=$t(i-t);if(Math.abs(r)<n)n=Math.abs(r),e=t+r}return e}stepSettling(t){let e=t/1000,n=this.velocity*1000;while(e>0){let i=Math.min(e,0.004),r=this.angle-this.settleTarget,o=-Xr*Xr*r-2*Xr*n;n+=o*i,this.angle+=n*i,e-=i}if(this.velocity=n/1000,Math.abs(this.angle-this.settleTarget)<0.05&&Math.abs(n)<0.5)return this.angle=this.settleTarget,this.stop(),!1;return!0}}class eo{samples=[];x=0;y=0;reset(t){this.x=0,this.y=0,this.samples=[{time:t,x:0,y:0}]}add(t,e,n){this.x+=e,this.y+=n,this.samples.push({time:t,x:this.x,y:this.y});while(this.samples.length>2&&t-this.samples[0].time>160)this.samples.shift()}velocityAt(t){let e=this.samples.filter((l)=>t-l.time<=80);if(e.length<2||t-e[e.length-1].time>50)return{x:0,y:0};let n=e.reduce((l,d)=>l+d.time,0)/e.length,i=e.reduce((l,d)=>l+d.x,0)/e.length,r=e.reduce((l,d)=>l+d.y,0)/e.length,o=0,s=0,a=0;for(let l of e){let d=l.time-n;o+=d*(l.x-i),s+=d*(l.y-r),a+=d*d}if(a===0)return{x:0,y:0};return{x:o/a,y:s/a}}}var ol=6,Gh=0.02;class no{velocity={x:0,y:0};timeConstant;constructor(t=325){this.timeConstant=t}get isMoving(){return Math.hypot(this.velocity.x,this.velocity.y)>=Gh}start(t){let e=Math.hypot(t.x,t.y),n=e>ol?ol/e:1;this.velocity={x:t.x*n,y:t.y*n}}stop(){this.velocity={x:0,y:0}}step(t){let e=Math.exp(-t/this.timeConstant),n=this.timeConstant*(1-e),i={x:this.velocity.x*n,y:this.velocity.y*n};if(this.velocity={x:this.velocity.x*e,y:this.velocity.y*e},!this.isMoving)this.stop();return i}}var Yh=1.32,Kt=14,ul=34,hl=18,ro=76,pl=48,Kh=7,qh=2.15,Zh=8,Xh=12,Jh=4,ri=6,oo=2,oi=(t,e)=>{let n=Math.min(e,ri),i=Math.min(150,(n-1)*30);return{distance:t*1.45,radius:Math.min(7,Math.max(2.5,t*0.17)),offsets:Array.from({length:n},(r,o)=>n===1?0:-i/2+i*o/(n-1))}},ml=(t,e)=>{let{cx:n,cy:i,containerWidth:r,containerHeight:o}=e,a=e.maxDepth!==void 0&&t.level>=e.maxDepth?[]:fe(t),l=a.length,d=wl(r,o),c=Mt(d*0.115,ul,ro),u=l===0?1:Mt(Math.pow(10/l,0.32),0.58,1.1),h=Mt(d*0.074*u,hl,pl),m=a.every((O)=>fe(O).length===0),p=sl(l,c,h,d,m);if(p.rings.length>=Jh){let O=Math.min(ro,c*(1+0.06*(p.rings.length-1)));if(O>c)c=O,p=sl(l,c,h,d,m)}let b=e.keptRings;if(b&&b.length===p.rings.length)p.rings=p.rings.map((O,M)=>Math.max(O,b[M]));else{let O=e.maxDepth!==void 0&&t.level+1>=e.maxDepth,M=a.map((w)=>O?0:Math.min(fe(w).length,ri));ep(p,h,M)}let f=p.rings[p.rings.length-1]??0,g={...t,parent:t.parent,x:n,y:i,radius:c,angle:-90,orbitRadius:0},y=[],v=0;return p.rings.forEach((O,M)=>{let w=p.counts[M]??0,x=360/w,E=vl(M,w);for(let k=0;k<w;k+=1){let C=a[v];if(!C)break;let B=E+x*k,q=be(B);y.push({...C,parent:C.parent,x:n+O*Math.cos(q),y:i+O*Math.sin(q),radius:h,angle:B,orbitRadius:O}),v+=1}}),{sun:g,planets:y,orbitRadius:f,orbitRings:p.rings}},bl=(t,e,n=-90)=>{let i=wl(e.containerWidth,e.containerHeight),r=Mt(Math.pow(18/kl(t),0.18),0.74,1.08),o=gl(t,i,r,e.maxDepth??1/0),s=[];return yl(o,e.cx,e.cy,n,0,s),s},fl=(t)=>{let e=[],n=new Set;for(let i of t){if(fe(i).length===0)continue;let r=t.find((d)=>d.parent?.id===i.id&&d.id!==i.id);if(!r)continue;let o=r.x-i.x,s=r.y-i.y,a=Math.sqrt(o*o+s*s),l=`${i.x.toFixed(1)},${i.y.toFixed(1)},${a.toFixed(1)}`;if(!n.has(l)&&a>10)n.add(l),e.push({centerId:i.id,cx:i.x,cy:i.y,r:a})}return e},gl=(t,e,n,i)=>{let r=rp(e,t.level,n),s=(i>0?fe(t):[]).map((c)=>gl(c,e,n,i-1)),a=s.map((c)=>c.subtreeRadius),l=tp(r,a),d=a.length>0?Math.max(...a):0;return{node:t,radius:r,subtreeRadius:Math.max(r,l+d),childOrbitRadius:l,children:s}},Qh=270,yl=(t,e,n,i,r,o)=>{let s={...t.node,parent:t.node.parent,x:e,y:n,radius:t.radius,angle:i,orbitRadius:r};o.push(s);let a=t.children.length;if(a===0)return;let l=t.node.level===0,d=l||a===1,c=(a-1)*(360/a),u=d?360:Math.min(c,Qh),h=a===1?0:d?360/a:u/(a-1),m=a===1?i:l?-90:i-u/2;t.children.forEach((p,b)=>{let f=m+h*b,g=be(f),y=e+t.childOrbitRadius*Math.cos(g),v=n+t.childOrbitRadius*Math.sin(g);yl(p,y,v,f,t.childOrbitRadius,o)})},tp=(t,e)=>{if(e.length===0)return 0;let n=Math.max(...e.map((s)=>t+s+Kt));if(e.length===1)return n;let i=2*Math.PI/e.length,r=2*Math.sin(i/2),o=e.reduce((s,a,l)=>{let d=e[(l+1)%e.length],c=((a+d)*Yh+Kt)/r;return Math.max(s,c)},0);return Math.max(n,o)},sl=(t,e,n,i,r=!1)=>{if(t===0)return{rings:[],counts:[],ringGap:0};let o=al(t,n,Math.max(i*0.26,e+n+Kt*1.3),n*qh+Kt,Kh);if(!r||o.rings.length<=1)return o;let s=al(t,n,e+n+Kt,n*2+Zh,Xh);return(s.rings.at(-1)??0)<(o.rings.at(-1)??0)?s:o},al=(t,e,n,i,r)=>{let o=[],s=0;while(s<t){let c=n+i*o.length;o.push(c),s+=xl(c,e)}let a=o.slice(0,r),l={rings:a,counts:cl(t,a,e),ringGap:i};if(o.length<=r)return l;let d={rings:o,counts:cl(t,o,e),ringGap:i};return(d.rings.at(-1)??0)<(l.rings.at(-1)??0)?d:l},vl=(t,e)=>t%2===0?-90:-90+360/e/2,ii=(t,e,n,i)=>{let r=t*Math.cos(be(e)),o=t*Math.sin(be(e)),{distance:s,radius:a,offsets:l}=oi(n,i);return{planet:{x:r,y:o,radius:n},moons:l.map((d)=>({x:r+s*Math.cos(be(e+d)),y:o+s*Math.sin(be(e+d)),radius:a}))}},io=(t,e,n)=>Math.hypot(t.x-e.x,t.y-e.y)>=t.radius+e.radius+n,ll=(t,e)=>t.moons.every((n)=>io(n,e.planet,oo)&&e.moons.every((i)=>io(n,i,n.radius)))&&e.moons.every((n)=>io(n,t.planet,oo)),dl=(t,e)=>t.moons.every((n)=>Math.hypot(n.x-t.planet.x,n.y-t.planet.y)<Math.hypot(n.x-e.planet.x,n.y-e.planet.y)),ep=(t,e,n)=>{if(n.every((a)=>a===0))return;let i=oi(e,1),r=2*(i.distance+i.radius)+Math.max(oo,i.radius),o=0,s;t.rings.forEach((a,l)=>{let d=t.counts[l]??0,c=n.slice(o,o+d),u=vl(l,d),h=360/Math.max(1,d),m=s?.planets.some((v)=>v.moons.length>0)?s:void 0,p=d<2?[]:[...new Set(c.map((v,O)=>`${v},${c[(O+1)%d]}`))].map((v)=>v.split(",").map(Number)),b=(v)=>p.every(([O,M])=>{let w=ii(v,0,e,O),x=ii(v,h,e,M);return ll(w,x)&&dl(w,x)&&dl(x,w)}),f=(v)=>{if(!m)return!0;let O=m.planets.length,M=m.radius<=r?180:op(Math.asin(r/m.radius));return c.every((w,x)=>{let E=u+h*x,k=ii(v,E,e,w),C=Math.floor((E-M-m.start)/m.step),B=Math.min(C+O-1,Math.ceil((E+M-m.start)/m.step));for(let q=C;q<=B;q+=1){let S=m.planets[(q%O+O)%O];if(Math.hypot(S.planet.x-k.planet.x,S.planet.y-k.planet.y)<r&&!ll(S,k))return!1}return!0})},g=l===0?a:Math.max(a,t.rings[l-1]+t.ringGap),y=np(g,e,(v)=>b(v)&&f(v));t.rings[l]=y,s={radius:y,start:u,step:h,planets:c.map((v,O)=>ii(y,u+h*O,e,v))},o+=d})},np=(t,e,n)=>{if(n(t))return t;let i=t,r=t+e;while(!n(r))i=r,r+=e;while(r-i>0.25){let o=(i+r)/2;if(n(o))r=o;else i=o}return r},cl=(t,e,n)=>{let i=e.map((a)=>xl(a,n)),r=[],o=t;for(let a=0;a<e.length;a+=1){let l=e.length-a,d=i[a]??o,c=a===e.length-1?o:Math.min(d,Math.ceil(o/l));r.push(c),o-=c}let s=e.length-1;if(s>=0)e[s]=Math.max(e[s],ip(n,r[s]??0));return r},xl=(t,e)=>{let n=e*2+Kt*0.85;if(n>=t*2)return 1;let i=2*Math.asin(n/(t*2));return Math.max(1,Math.floor(2*Math.PI/i))},ip=(t,e)=>{if(e<=1)return 0;let n=2*Math.sin(Math.PI/e);return(t*2+Kt*0.85)/n},rp=(t,e,n)=>{if(e===0)return Mt(t*0.115*n,ul,ro);if(e===1)return Mt(t*0.074*n,hl,pl);if(e===2)return Mt(t*0.056*n,15,36);return Mt(t*0.044*n,12,28)},wl=(t,e)=>{let n=Math.min(t,e),i=Math.sqrt(t*e);return Math.min(i,n*1.25)},kl=(t)=>1+fe(t).reduce((e,n)=>e+kl(n),0),fe=(t)=>t.collapsed?[]:t.children,be=(t)=>t*Math.PI/180,op=(t)=>t*180/Math.PI;var Ol=(t,e)=>{let n=globalThis.CSS;return typeof n?.supports!=="function"||n.supports(t,e)},so={mixesColors:Ol("color","color-mix(in oklab, red 50%, blue)"),translates:Ol("translate","1px")},Sl=new WeakMap,si=(t)=>{let e=t.ownerDocument.defaultView;if(!e||typeof e.matchMedia!=="function")return!1;let n=Sl.get(e);if(!n)n=e.matchMedia("(pointer: coarse)"),Sl.set(e,n);return n.matches},ge=(t,e,n)=>{let i=`translate3d(${t}px, ${e}px, 0)`;return so.translates?i:`${i} translate(${n})`};var Ml="\x00orbit-add";var sp=48,ap=1.35,lp=40,dp=48,cp=(t,e)=>Math.min(e,Math.max(16,Math.min(t.width,t.height)*0.05)),ao=(t,e,n,i,r=0)=>{let o=cp(n,t==="focus"?lp:dp),s=Math.max(0,r-o),a=i??{top:0,right:0,bottom:0,left:0};return il({x:0,y:0},e,n,o,ap,s>0?{...a,bottom:a.bottom+s}:a)},Nl=(t,e,n,i=0)=>ao(t.kind,t.extent,e,n,i),up=7,qt=(t,e,n=(i)=>i.color)=>{let i=new Map,r=kn(e),o=ne(t.children,r.length),s=(a)=>n(a)??(Ht(a.paletteColor)?rr(r,a.paletteColor):void 0);i.set(t.id,s(t)??e[0]);for(let a of t.children){let l=n(a)??rr(r,o.get(a));i.set(a.id,l);let d=(c,u)=>{c.children.forEach((h,m)=>{let p=s(h);i.set(h.id,p??hp(u,m)),d(h,p??u)})};d(a,l)}return i},El=[[100,"light"],[78,"light"],[86,"dark"],[62,"light"],[76,"dark"]],hp=(t,e)=>{let[n,i]=El[e%El.length];return n===100||!so.mixesColors?t:`color-mix(in oklab, ${t} ${n}%, var(--_orbit-shade-${i}))`},pp=(t,e)=>{let n=e?t.find((o)=>o.id===e.id):void 0;if(!e||!n)return t;let i=t.filter((o)=>o!==n),r=Math.min(i.length,Math.max(0,Math.trunc(e.index)));return[...i.slice(0,r),n,...i.slice(r)]},_l=(t,e)=>{if(t.collapsed)return[];if(e!==void 0&&t.level>=e)return[];return t.children},ai=(t,e,n)=>{let i=U(t,e)??t,{viewport:r,colors:o,maxDepth:s,reorder:a}=n,l=pp(i.children,a),d=s===void 0||i.level<s,c=n.addSlot&&d?Math.min(l.length,Math.max(0,Math.trunc(n.addSlot.index??l.length))):null,u=i.collapsed||c!==null||l!==i.children?{...i,collapsed:!1,children:l}:i;if(c!==null){let x={id:Ml,text:"",level:i.level+1,children:[]};u.children=[...l.slice(0,c),x,...l.slice(c)]}let h=ml(u,{cx:0,cy:0,containerWidth:r.width,containerHeight:r.height,maxDepth:s,keptRings:n.keptRings?.focusId===i.id?n.keptRings.radii:void 0}),m=c===null?0:1,p=new Map,b=(x)=>o.get(x.id)??x.color??"#999999";p.set(i.id,{id:i.id,node:i,role:"sun",x:0,y:0,radius:h.sun.radius,color:b(i),depth:i.level,parentId:i.parent?.id,hiddenChildren:Math.max(0,l.length-(h.planets.length-m)),spins:!1});let f=h.sun.radius,g=h.sun.radius,y=mp(h),v=h.planets.length-m>sp,O;for(let x of h.planets){if(x.id===Ml){O={parentId:i.id,index:c??i.children.length,x:x.x,y:x.y,radius:y??x.radius,orbitAngle:x.angle,orbitRadius:x.orbitRadius},f=Math.max(f,x.orbitRadius+O.radius),g=Math.max(g,x.orbitRadius+O.radius);continue}let E=U(i,x.id)??x,k=_l(E,s).slice(0,ri),C=y??x.radius;p.set(x.id,{id:x.id,node:E,role:"planet",x:x.x,y:x.y,radius:C,color:b(E),depth:E.level,parentId:i.id,orbitAngle:x.angle,orbitRadius:x.orbitRadius,hiddenChildren:E.children.length-k.length,spins:!0,crowded:v});let{distance:B,radius:q,offsets:S}=oi(C,k.length);k.forEach((L,F)=>{let I=S[F],J=en(x.angle+I);p.set(L.id,{id:L.id,node:L,role:"moon",x:x.x+B*Math.cos(J),y:x.y+B*Math.sin(J),radius:q,color:b(L),depth:L.level,parentId:x.id,hostId:x.id,hostOffset:I,hostDistance:B,hiddenChildren:L.children.length,spins:!0})});let G=x.orbitRadius+(k.length>0?B+q:C);f=Math.max(f,G),g=Math.max(g,G)}let M=h.planets.length===0?[]:h.orbitRings.map((x,E)=>({id:`${i.id}#${E}`,centerId:i.id,cx:0,cy:0,radius:x,color:b(i),gaps:h.planets.filter((k)=>Math.abs(k.orbitRadius-x)<0.5).map((k)=>({angle:k.angle,halfWidth:Tl(y??k.radius,x)})),spins:!0})),w={x:f,y:g};return{kind:"focus",focusId:i.id,nodes:p,rings:M,links:[],frame:ao("focus",w,r,n.insets),extent:w,addSlot:O}},mp=(t)=>{if(t.orbitRings.length!==1||t.planets.length===0)return null;let e=t.orbitRings[0],n=t.planets.length,i=n>1?(e*Math.sin(Math.PI/n)-14)/1.45:1/0,r=e-t.sun.radius-24,o=t.planets[0].radius;return Math.max(o,Math.min(t.sun.radius*0.72,i,r))},li=(t,e)=>{let{viewport:n,colors:i,maxDepth:r}=e,o=bl(t,{cx:0,cy:0,containerWidth:n.width,containerHeight:n.height,maxDepth:r}),s=new Map,a=[],l=bp(t),d=0,c=0;for(let p of o){let b=l.get(p.id)??p,f=i.get(b.id)??"#999999",g=_l(b,r).length;if(s.set(p.id,{id:p.id,node:b,role:"node",x:p.x,y:p.y,radius:p.radius,color:f,depth:b.level,parentId:p.parent?.id,hiddenChildren:b.children.length-g,spins:!1}),p.parent&&b.level>0)a.push({id:`${p.parent.id}->${p.id}`,fromId:p.parent.id,toId:p.id,color:i.get(p.parent.id)??f});d=Math.max(d,Math.abs(p.x)+p.radius),c=Math.max(c,Math.abs(p.y)+p.radius)}let u=new Map;for(let p of o){let b=p.parent?.id;if(b!==void 0){let f=u.get(b)??[];f.push(p),u.set(b,f)}}let h=fl(o).map((p)=>{let{centerId:b}=p,f=u.get(b)??[];return{id:`${b}#overview`,centerId:b,cx:p.cx,cy:p.cy,radius:p.r,color:i.get(b)??"#999999",gaps:f.map((g)=>({angle:ve(Math.atan2(g.y-p.cy,g.x-p.cx)),halfWidth:Tl(g.radius,p.r)})),spins:!1}});for(let p of h)d=Math.max(d,Math.abs(p.cx)+p.radius),c=Math.max(c,Math.abs(p.cy)+p.radius);let m={x:d,y:c};return{kind:"overview",focusId:t.id,nodes:s,rings:h,links:a,frame:ao("overview",m,n,e.insets),extent:m}},bp=(t)=>{let e=new Map,n=(i)=>{e.set(i.id,i),i.children.forEach(n)};return n(t),e},ye=(t,e,n)=>{let i=t.nodes.get(e);if(!i||i.radius<=0)return{scale:1,x:0,y:0};let r=n.radius/i.radius;return{scale:r,x:n.x-i.x*r,y:n.y-i.y*r}};var Tl=(t,e)=>{let n=Math.min(1,(t+up)/Math.max(e,1));return ve(Math.asin(n))},en=(t)=>t*Math.PI/180,ve=(t)=>t*180/Math.PI;var yt=(t,e,n)=>{let i=new Map,r=t.nodes.get(t.focusId),o=r?.x??0,s=r?.y??0;for(let l of t.nodes.values()){let{x:d,y:c}=l,u;if(l.spins&&l.role==="planet"&&l.orbitAngle!==void 0&&l.orbitRadius!==void 0){let h=en(l.orbitAngle+e);d=o+l.orbitRadius*Math.cos(h),c=s+l.orbitRadius*Math.sin(h),u=l}i.set(l.id,{id:l.id,node:l.node,role:l.role,x:d,y:c,radius:l.radius,opacity:1,labelOpacity:1,color:l.color,depth:l.depth,hiddenChildren:l.hiddenChildren,parentId:l.parentId,hostId:l.hostId,crowded:l.crowded,unturned:u})}for(let l of t.nodes.values()){if(l.role!=="moon"||!l.hostId)continue;let d=t.nodes.get(l.hostId),c=i.get(l.hostId),u=i.get(l.id);if(!d||!c||!u||d.orbitAngle===void 0)continue;let h=en(d.orbitAngle+e+(l.hostOffset??0));u.x=c.x+(l.hostDistance??0)*Math.cos(h),u.y=c.y+(l.hostDistance??0)*Math.sin(h),u.unturned=c.unturned&&l}let a;if(t.addSlot){let{parentId:l,index:d,orbitAngle:c,orbitRadius:u,radius:h}=t.addSlot,m=en(c+e);a={parentId:l,index:d,x:o+u*Math.cos(m),y:s+u*Math.sin(m),radius:h,opacity:1,unturned:t.addSlot}}return{nodes:i,rings:t.rings.map((l)=>({...l,rotation:l.spins?e:0,opacity:1})),links:t.links.map((l)=>({...l,opacity:1})),camera:n,addSlot:a,turn:t.kind==="focus"?{cx:o,cy:s,rotation:e}:void 0}},Cl=(t,e)=>rl(e,t.frame),Fl=new WeakMap,fp=(t)=>{let e=Fl.get(t);if(e)return e;let{target:n,placement:i}=t,r=yt(n,0,n.frame),o=new Map;for(let a of r.nodes.values()){let l=me(i,a);o.set(a.id,{...a,x:l.x,y:l.y,radius:a.radius*i.scale})}let s={resting:r,nodes:o};return Fl.set(t,s),s},Il=(t,e)=>{let{from:n,target:i,placement:r}=t,{resting:o,nodes:s}=fp(t),a=new Map,l=ot(e,0.25,1),d=ot(e,0,0.6);for(let[p,b]of s){let f=n.nodes.get(p);if(f){a.set(p,{...b,role:e<0.5?f.role:b.role,x:st(f.x,b.x,e),y:st(f.y,b.y,e),radius:st(f.radius,b.radius,e),opacity:st(f.opacity,1,e),labelOpacity:st(f.labelOpacity,1,e)});continue}let g=b.parentId&&n.nodes.get(b.parentId)||void 0;if(g){let y=ot(e,0.25,0.6);a.set(p,{...b,x:st(g.x,b.x,l),y:st(g.y,b.y,l),radius:b.radius*l,opacity:y,labelOpacity:ot(e,0.6,1),cluster:{pivotX:g.x,pivotY:g.y,scale:l,opacity:y,x:b.x,y:b.y,radius:b.radius,nodeOpacity:1}})}else a.set(p,{...b,opacity:l,labelOpacity:ot(e,0.6,1),cluster:{pivotX:0,pivotY:0,scale:1,opacity:l,x:b.x,y:b.y,radius:b.radius,nodeOpacity:1}})}for(let[p,b]of n.nodes){if(s.has(p))continue;let f=b.parentId&&s.get(b.parentId)||void 0,g=1-d;if(f)a.set(p,{...b,x:st(b.x,f.x,d),y:st(b.y,f.y,d),radius:b.radius*g,opacity:b.opacity*g,labelOpacity:b.labelOpacity*(1-ot(e,0,0.35)),cluster:{pivotX:f.x,pivotY:f.y,scale:g,opacity:g,x:b.x,y:b.y,radius:b.radius,nodeOpacity:b.opacity}});else a.set(p,{...b,opacity:b.opacity*g,labelOpacity:b.labelOpacity*(1-ot(e,0,0.35)),cluster:{pivotX:0,pivotY:0,scale:1,opacity:g,x:b.x,y:b.y,radius:b.radius,nodeOpacity:b.opacity}})}let c=[];for(let p of n.rings)c.push({...p,opacity:p.opacity*(1-ot(e,0,0.5))});for(let p of o.rings){let b=me(r,{x:p.cx,y:p.cy}),f=p.radius*r.scale,g=n.nodes.get(p.centerId),y=g?Math.min(f,g.radius*1.6):f*0.6,v=ot(e,0.2,1);c.push({...p,id:`${p.id}@target`,cx:b.x,cy:b.y,radius:st(y,f,v),opacity:ot(e,0.3,1)})}let u=new Set(i.links.map((p)=>p.id)),h=n.links.filter((p)=>!u.has(p.id)).map((p)=>({...p,opacity:p.opacity*(1-ot(e,0,0.5))})),m=new Set(n.links.map((p)=>p.id));for(let p of i.links)h.push({...p,opacity:m.has(p.id)?1:ot(e,0.4,1)});return{nodes:a,rings:c,links:h,camera:t.cameraPath.at(e),addSlot:yp(n.addSlot,o.addSlot&&gp(o.addSlot,r),e)}},gp=(t,e)=>{let n=me(e,t);return{...t,x:n.x,y:n.y,radius:t.radius*e.scale}},yp=(t,e,n)=>{if(t&&e&&t.parentId===e.parentId)return{...e,x:st(t.x,e.x,n),y:st(t.y,e.y,n),radius:st(t.radius,e.radius,n),opacity:st(t.opacity,1,n)};if(e&&n>=0.5)return{...e,opacity:ot(n,0.7,1)};return t&&{...t,opacity:t.opacity*(1-ot(n,0,0.3))}},Al=(t,e)=>{if(e<0.5){let r=1-e*2,o=new Map;for(let[a,l]of t.from.nodes)o.set(a,{...l,opacity:l.opacity*r,labelOpacity:l.labelOpacity*r});let s=t.from.addSlot;return{nodes:o,rings:t.from.rings.map((a)=>({...a,opacity:a.opacity*r})),links:t.from.links.map((a)=>({...a,opacity:a.opacity*r})),camera:t.from.camera,addSlot:s&&{...s,opacity:s.opacity*r}}}let n=(e-0.5)*2,i=yt(t.target,0,t.target.frame);for(let r of i.nodes.values())r.opacity=n,r.labelOpacity=n;return{...i,rings:i.rings.map((r)=>({...r,opacity:n})),links:i.links.map((r)=>({...r,opacity:n})),addSlot:i.addSlot&&{...i.addSlot,opacity:n}}};var co=/[\u1100-\u115F\u2E80-\uA4CF\uA960-\uA97F\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]|\p{Extended_Pictographic}/u,vp=/[⺀-〾ぁ-㏿㐀-䶿一-鿿가-힣豈--⦆\u{20000}-\u{3FFFD}]/u,uo=/^[\x20-\x7e\xa0-\xff\u2000-\u200a]*$/,di,Bt=(t)=>{if(uo.test(t))return t.split("");if(di===void 0)di=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null;return di?Array.from(di.segment(t),(e)=>e.segment):Array.from(t)},ho=(t)=>{if(uo.test(t))return{narrow:t.length,wide:0};let e=0,n=Bt(t);for(let i of n)if(co.test(i))e+=1;return{narrow:n.length-e,wide:e}},xp=(t)=>{let{narrow:e,wide:n}=ho(t);return e*0.55+n},wp=xp,kp=/[^\S\u00a0\u202f\ufeff]+/u,Op=/(?<=[_/\\-])(?=.)|(?<=[.:])(?=\p{L})|(?<=\p{Ll})(?=\p{Lu})/u,po=(t)=>t.split(Op).filter(Boolean),nn=(t)=>{let e=[];for(let[n,i]of t.split(kp).filter(Boolean).entries()){let r="",o=!0,s=(a)=>{e.push({text:a,spaced:o&&n>0}),o=!1};for(let a of po(i)){if(uo.test(a)){s(a);continue}for(let l of Bt(a))if(vp.test(l)){if(r)s(r),r="";s(l)}else r+=l;if(r)s(r),r=""}}return e},xe=(t)=>t.map((e,n)=>n>0&&e.spaced?` ${e.text}`:e.text).join(""),lo=(t,e,n)=>{let i="";for(let r of Bt(t)){if(n(`${i}${r}…`)>e)break;i+=r}return`${i.trimEnd()}…`},mo=(t,e,n,i=3,r)=>{let o=r?(h)=>r.ems(h,n):wp,s=Math.max(1.6500000000000001,e/n),a=n*1.3,l=[],d=[];for(let h of nn(t)){let m=xe([...d,h]);if(d.length===0||o(m)<=s){if(d.push(h),d.length===1&&o(h.text)>s)l.push(lo(h.text,s,o)),d=[];continue}if(l.push(xe(d)),d=[{...h,spaced:!1}],o(h.text)>s)l.push(lo(h.text,s,o)),d=[]}if(d.length>0)l.push(xe(d));let c=l.length>i,u=l.slice(0,i);if(c&&u.length===i){let h=u[i-1];if(!h.endsWith("…"))u[i-1]=o(`${h}…`)<=s?`${h}…`:lo(h,s,o)}return{lines:u,truncated:c,lineHeight:a,totalHeight:u.length*a}};class ui{key;bySize=!1;stretch=100;narrow;spaceWidth;ellipsisWidth;constructor(t,e,n){this.narrow=t,this.spaceWidth=e,this.ellipsisWidth=n,this.key=`estimate ${t}`}ems(t){if(t.length===1)return co.test(t)?1:this.narrow;let{narrow:e,wide:n}=ho(t);return e*this.narrow+n}space(){return this.spaceWidth}ellipsis(){return this.ellipsisWidth}narrower(){return null}}var Vt=new ui(0.58,0.3,0.8),rn=new ui(0.5565217391304348,0.3,0.8),hi=new ui(0.7,0.3,0.8),on={key:"estimate",inside:()=>Vt,pill:()=>rn,count:()=>hi},ci=9,bo=16,Sp=(t)=>{let e=[[50,"ultra-condensed"],[62.5,"extra-condensed"],[75,"condensed"],[87.5,"semi-condensed"],[100,"normal"],[112.5,"semi-expanded"],[125,"expanded"],[150,"extra-expanded"],[200,"ultra-expanded"]],n=e[4];for(let i of e)if(Math.abs(i[0]-t)<Math.abs(n[0]-t))n=i;return n[1]},Mp=[87.5,75],Ep=0.97,Np=/^[\u0020-\u052F\u1E00-\u1FFF\u2000-\u206F\u20A0-\u20BF]*$/;class Dl{key;bySize=!0;context;font;widths=new Map;letters=new Map;narrowerMeasure;constructor(t,e,n){this.context=t,this.font=e,this.key=n}ems(t,e){let n=this.widths.get(t);if(!n){if(n=Np.test(t)?this.sumOfLetters(t):[this.measure(t,ci),this.measure(t,bo)],this.widths.size>=_p)this.widths.clear();this.widths.set(t,n)}let i=Math.min(1,Math.max(0,(e-ci)/(bo-ci)));return n[0]+(n[1]-n[0])*i}space(t){return this.ems(" ",t)}ellipsis(t){return this.ems("…",t)}get stretch(){return this.font.stretch}narrower(){if(this.narrowerMeasure!==void 0)return this.narrowerMeasure;this.narrowerMeasure=null;let t=Mp.find((e)=>e<this.font.stretch);if(t!==void 0&&"fontStretch"in this.context){let e=yo({...this.font,stretch:t}),n="Orbit names";if(e&&e.ems("Orbit names",13)<this.ems("Orbit names",13)*Ep)this.narrowerMeasure=e}return this.narrowerMeasure}sumOfLetters(t){let e=0,n=0;for(let i of t){let r=this.letters.get(i);if(!r)r=[this.measure(i,ci),this.measure(i,bo)],this.letters.set(i,r);e+=r[0],n+=r[1]}return[e,n]}measure(t,e){let{context:n,font:i}=this;if(n.font=`${i.style} ${i.weight} ${e}px ${i.family}`,"fontStretch"in n)n.fontStretch=Sp(i.stretch);let r=i.letterSpacing===0?0:i.letterSpacing*Bt(t).length;return n.measureText(t).width/e+r}}var _p=50000,Zt,fo=()=>{if(Zt!==void 0)return Zt;Zt=null;try{let t=null;if(typeof OffscreenCanvas==="function")t=new OffscreenCanvas(1,1).getContext("2d");if(!t&&typeof document<"u"&&typeof document.createElement==="function")t=document.createElement("canvas").getContext("2d");if(t&&typeof t.measureText==="function"){if(t.font="16px sans-serif",t.measureText("Orbit").width>0)Zt=t}}catch{Zt=null}if(Zt)Fp();return Zt},go=new Map,Ll=0,yo=(t)=>{let e=fo();if(!e||!t.family)return null;let n=`${t.style} ${t.weight} ${t.stretch}% ${t.letterSpacing} ${t.family}`,i=go.get(n);if(!i)Ll+=1,i=new Dl(e,t,`font ${Ll}`),go.set(n,i);return i},vo=new Set,we=(t)=>(vo.add(t),()=>{vo.delete(t)}),Tp=()=>{go.clear();for(let t of Array.from(vo))t()},Pl=!1,Fp=()=>{if(Pl||typeof document>"u")return;let t=document.fonts;if(!t||typeof t.addEventListener!=="function")return;Pl=!0,t.addEventListener("loadingdone",()=>Tp())},Cp=["font-family","label-font","display-font","label-weight","display-weight","label-letter-spacing"];class xo{layer;extensions;shelf=null;probes=new Map;measures=new Map;sunMeasure;nameMeasure;countMeasure;stale=!0;currentKey="estimate";recheck=null;constructor(t,e){this.layer=t,this.extensions=e}get key(){return this.read(),this.currentKey}refresh(){this.stale=!0}inside(t,e){return this.measure(t,e)??Vt}pill(t,e){return this.measure(t,e)??rn}count(){if(this.stale)this.read();if(this.countMeasure===void 0){let t=this.computedFont("count","orbit-count",void 0);this.countMeasure=t?yo(t):null}return this.countMeasure??hi}recheckWhenIdle(t){if(this.recheck||fo()===null)return;let e=()=>{this.recheck=null;let i=this.key;if(this.refresh(),this.key!==i)t()},n=globalThis.requestIdleCallback;if(typeof n==="function"){let i=n(e,{timeout:2000});this.recheck={cancel:()=>globalThis.cancelIdleCallback?.(i)}}else{let i=setTimeout(e,250);this.recheck={cancel:()=>clearTimeout(i)}}}destroy(){this.recheck?.cancel(),this.recheck=null,this.shelf?.remove(),this.shelf=null,this.probes.clear(),this.measures.clear()}read(){if(!this.stale)return;this.stale=!1,this.measures.clear(),this.sunMeasure=void 0,this.nameMeasure=void 0,this.countMeasure=void 0;let t=[this.measure("planet"),this.measure("sun"),this.count()].map((e)=>e?.key??"estimate");this.currentKey=t.join(" | ")}measure(t,e){if(this.stale)this.read();let n=e?this.extensions()?.typeName(e)??e.type:void 0;if(!e||!n){if(t==="sun"){if(this.sunMeasure===void 0)this.sunMeasure=this.measureOf("sun",t,void 0);return this.sunMeasure}if(this.nameMeasure===void 0)this.nameMeasure=this.measureOf("name",t,void 0);return this.nameMeasure}let i=`${t==="sun"?"sun":"name"} ${n.toLowerCase()}`,r=this.measures.get(i);if(r!==void 0||this.measures.has(i))return r??null;let o=this.extensions()?.nodeType(e)?.tokens,a=o!==void 0&&Cp.some((l)=>typeof o[l]==="string"&&o[l]!=="")?this.measureOf(i,t,o):this.measure(t);return this.measures.set(i,a),a}measureOf(t,e,n){let i=this.computedFont(t,`orbit-label orbit-label--${e==="sun"?"sun":"planet"}`,n);return i?yo(i):null}computedFont(t,e,n){if(typeof getComputedStyle!=="function"||!this.layer.isConnected||fo()===null)return null;let i=this.probes.get(t);if(!i){let l=this.layer.ownerDocument;if(!this.shelf)this.shelf=l.createElement("div"),this.shelf.className="orbit__font-probes",this.shelf.style.display="none",this.shelf.setAttribute("aria-hidden","true"),this.layer.appendChild(this.shelf);i=l.createElement("div"),i.className=e;for(let[d,c]of Object.entries(n??{}))if(typeof c==="string"&&c!=="")i.style.setProperty(`--_orbit-${d}`,c);this.shelf.appendChild(i),this.probes.set(t,i)}let r=getComputedStyle(i),o=Number.parseFloat(r.fontSize)||13,s=Number.parseFloat(r.letterSpacing),a=Number.parseFloat(r.fontStretch);if(!r.fontFamily)return null;return{family:r.fontFamily,weight:r.fontWeight||"400",style:r.fontStyle||"normal",stretch:Number.isFinite(a)?a:100,letterSpacing:Number.isFinite(s)?s/o:0}}}var pi={mindMap:"Mind map",mindMapRole:"mind map",untitled:"Untitled",untitledMap:"Untitled map",emptyMap:"This map is empty",emptyMapHint:"Start it with a # heading or a bullet list",mapNotDrawn:"This map couldn’t be drawn",mapNotDrawnReason:"The map could not be drawn.",problemOnLine:"Line {line}: {message}",mapPath:"Map path",back:"Back",backTo:"Back to {name}",backToParent:"Back to the parent node",view:"View",focus:"Focus",overview:"Overview",showOutline:"Show the map as a list",zoom:"Zoom",zoomIn:"Zoom in",zoomOut:"Zoom out",fitMap:"Fit the map",scrollToZoom:"Use {key} + scroll to zoom the map",outline:"Map outline",overviewAnnouncement:"Overview of the whole map",ideaCount:{one:"{count} item",other:"{count} items"},added:"Added {name}",removed:"Removed {name}",moved:"Moved {name} to {parent}",movedToTop:"Moved {name} to the top",anIdea:"a node",status:"status {status}",statusLabel:"Status: {status}",has:"has {list}",hasDetails:"details",hasNote:"note",hasImage:"image",hasVideo:"video",hasEmbed:"embed",hasLink:"link",textOf:"Text of {name}",newIdeaFor:"New idea for {name}",newIdea:"New idea",addIdeaTo:"Add an idea to {name}",moveHere:"Move {name} here",thisIdea:"this node",theIdea:"the idea",ideaActions:"{name} actions",ideaActionsUntitled:"Node actions",showDetails:"Show details",viewImage:"View image",viewImageOf:"View image: {description}",playVideo:"Play video",openEmbed:"Open embed",readNote:"Read note",openLink:"Open link",goTo:"Go to {name}",seeIdea:"See {name}",details:"Details",close:"Close",previous:"Previous",next:"Next",present:"Present",priority:"Priority {priority}",expand:"Expand",expandVideo:"Expand the video",picture:"Picture",video:"Video",position:"{index} of {total}",fitPicture:"Fit the picture",pictureUnavailable:"This picture can’t be shown.",videoUnavailable:"This video can’t be played.",videoUnavailableHere:"This video can’t be played here.",openPictureInNewTab:"Open the picture in a new tab",openVideoInNewTab:"Open the video in a new tab",watchOn:"Watch on {provider}"},Ip={mindMap:"Mapa mental",mindMapRole:"mapa mental",untitled:"Sin título",untitledMap:"Mapa sin título",emptyMap:"Este mapa está vacío",emptyMapHint:"Empiézalo con un encabezado # o una lista con viñetas",mapNotDrawn:"No se pudo dibujar este mapa",mapNotDrawnReason:"No se pudo dibujar el mapa.",problemOnLine:"Línea {line}: {message}",mapPath:"Ruta del mapa",back:"Atrás",backTo:"Volver a {name}",backToParent:"Volver a la idea superior",view:"Vista",focus:"Enfoque",overview:"Vista general",showOutline:"Mostrar el mapa como lista",zoom:"Zoom",zoomIn:"Acercar",zoomOut:"Alejar",fitMap:"Ajustar el mapa",scrollToZoom:"Usa {key} + desplazamiento para acercar o alejar el mapa",outline:"Esquema del mapa",overviewAnnouncement:"Vista general de todo el mapa",ideaCount:{one:"{count} idea",many:"{count} ideas",other:"{count} ideas"},added:"Se agregó {name}",removed:"Se eliminó {name}",moved:"Se movió {name} a {parent}",movedToTop:"Se movió {name} al nivel superior",anIdea:"una idea",status:"estado {status}",statusLabel:"Estado: {status}",has:"tiene {list}",hasDetails:"detalles",hasNote:"nota",hasImage:"imagen",hasVideo:"video",hasEmbed:"contenido insertado",hasLink:"enlace",textOf:"Texto de {name}",newIdeaFor:"Idea nueva en {name}",newIdea:"Idea nueva",addIdeaTo:"Agregar una idea a {name}",moveHere:"Mover {name} aquí",thisIdea:"esta idea",theIdea:"la idea",ideaActions:"Acciones de {name}",ideaActionsUntitled:"Acciones de la idea",showDetails:"Ver detalles",viewImage:"Ver imagen",viewImageOf:"Ver imagen: {description}",playVideo:"Reproducir video",openEmbed:"Abrir contenido insertado",readNote:"Leer nota",openLink:"Abrir enlace",goTo:"Ir a {name}",seeIdea:"Ver {name}",details:"Detalles",close:"Cerrar",previous:"Anterior",next:"Siguiente",present:"Presentar",priority:"Prioridad {priority}",expand:"Ampliar",expandVideo:"Ampliar el video",picture:"Imagen",video:"Video",position:"{index} de {total}",fitPicture:"Ajustar la imagen",pictureUnavailable:"No se puede mostrar esta imagen.",videoUnavailable:"No se puede reproducir este video.",videoUnavailableHere:"Este video no se puede reproducir aquí.",openPictureInNewTab:"Abrir la imagen en una pestaña nueva",openVideoInNewTab:"Abrir el video en una pestaña nueva",watchOn:"Ver en {provider}"},Ap=new Map([["en",pi],["es",Ip]]),wo=new Map(Ap),Lp=Object.keys(pi),Pp=["zero","one","two","few","many","other"];var mi=(t)=>{let e=t??null;while(e){if(e.nodeType===1){let n=e.getAttribute("lang");if(n)return n}e=e.parentNode??(e.host??null)}return t?.ownerDocument?.documentElement?.getAttribute("lang")||null};class tt{language;locale;table;constructor(t,e){let n=t?Bp(t):null;this.language=n===null?"en":wo.has(n)?n:wo.has(ko(n))?ko(n):"en",this.locale=n!==null&&(n===this.language||ko(n)===this.language)?n:this.language;let i=wo.get(this.language)??pi;this.table=e?{...i,...Dp(e,"strings")}:i}sameAs(t){return t!==null&&t.locale===this.locale&&t.table===this.table}text(t,e){return this.fill(this.table[t],e)}count(t,e,n){let i=this.table[t],r=Up(this.locale)?.select(e)??(e===1?"one":"other");return this.fill(i[r]??i.other,{...n,count:e})}list(t){let e=Wp(this.locale);return e?e.format(t):t.join(", ")}number(t){return jp(this.locale)?.format(t)??String(t)}fill(t,e){if(!e)return t;return t.replace(/\{(\w+)\}/g,(n,i)=>{let r=e[i];if(r===void 0)return n;return typeof r==="number"?this.number(r):r})}}var Bl=(t,e,n)=>new tt(t??mi(e),n),Dp=(t,e)=>{let n={};if(!t||typeof t!=="object")return n;for(let[i,r]of Object.entries(t)){if(!Lp.includes(i)){$l(`${e}: Orbit has no words called "${i}".`);continue}let o=typeof pi[i]!=="string";if(!o&&typeof r==="string")n[i]=r;else if(o&&Rp(r))n[i]=$p(r);else if(o&&typeof r==="string")n[i]={other:r};else $l(`${e}: "${i}" should be ${o?'an object of plural forms with at least "other"':"a string"}.`)}return n},Rp=(t)=>typeof t==="object"&&t!==null&&typeof t.other==="string",$p=(t)=>{let e={other:t.other};for(let n of Pp)if(typeof t[n]==="string")e[n]=t[n];return e},Bp=(t)=>{if(typeof t!=="string"||t.trim()==="")return null;try{let[e]=Intl.getCanonicalLocales(t.trim().replace(/_/g,"-"));return e??null}catch{return null}},ko=(t)=>t.split("-")[0],Rl=new Set,$l=(t)=>{if(!Rl.has(t))Rl.add(t),console.warn(`[orbit] ${t}`)},Vp=new Map,Hp=new Map,zp=new Map,Up=(t)=>Oo(Vp,t,()=>new Intl.PluralRules(t)),jp=(t)=>Oo(Hp,t,()=>new Intl.NumberFormat(t)),Wp=(t)=>Oo(zp,t,()=>typeof Intl.ListFormat==="function"?new Intl.ListFormat(t,{type:"conjunction"}):null),Oo=(t,e,n)=>{if(!t.has(e))try{t.set(e,n())}catch{t.set(e,null)}return t.get(e)??null};var Gp="http://www.w3.org/2000/svg",_=(t,e={})=>{let n=document.createElementNS(Gp,t);for(let[i,r]of Object.entries(e))n.setAttribute(i,r);return n},Eo=[{offset:0,part:"highlight"},{offset:0.45,part:"highlight-fade"},{offset:0.55,part:"terminator-start"},{offset:0.78,part:"terminator"},{offset:1,part:"shading"}],fi={x:0.34,y:0.3,radius:0.78},wi=(t)=>{let e=(t??"").trim().split(/[\s,]+/).map(Number);if(e.length!==3||!e.every(Number.isFinite)||e[2]<=0)return fi;let[n,i,r]=e;return{x:n,y:i,radius:r}},Yl=(t,e,n)=>{let i=Array.from(t.children).find((r)=>r.id===e.shade);i?.setAttribute("cx",String(n.x)),i?.setAttribute("cy",String(n.y)),i?.setAttribute("r",String(n.radius))},an={planet:0.16,sun:0.3},Kl=(t)=>{let e=_("defs"),n=_("clipPath",{id:t.clip,clipPathUnits:"userSpaceOnUse"});n.appendChild(_("circle",{r:"1"})),e.appendChild(n);let i=_("radialGradient",{id:t.shade,cx:String(fi.x),cy:String(fi.y),r:String(fi.radius)});for(let r of Eo)i.appendChild(_("stop",{offset:String(r.offset),class:`orbit-shade__${r.part}`}));e.appendChild(i),e.appendChild(_("radialGradient",{id:t.speckShade,href:`#${t.shade}`}));for(let[r,o]of[[t.shadow,an.planet],[t.sunShadow,an.sun]]){let s=_("filter",{id:r,x:"-60%",y:"-60%",width:"220%",height:"220%"});s.appendChild(_("feGaussianBlur",{stdDeviation:String(o)})),e.appendChild(s)}return e},ql=(t,e,n)=>{let i=Array.from(t.children).find((r)=>r.id===e.speckShade);if(n===0)i?.removeAttribute("gradientTransform");else i?.setAttribute("gradientTransform",`rotate(${-n} 0.5 0.5)`)},Yp=new tt("en"),ki=(t,e,n,i,r=Yp)=>{let o=i?.nodeType(t),s=[[i?i.icon(t):t.icon,t.text||r.text("untitled")].filter(Boolean).join(" ")];if(o?.label)s.push(o.label);if(t.status)s.push(r.text("status",{status:t.status}));let a=n+e;if(a>0)s.push(r.count("ideaCount",a));let l=[o?.details?r.text("hasDetails"):"",t.note?r.text("hasNote"):"",T(t.image)?r.text("hasImage"):"",T(t.video)?r.text("hasVideo"):"",T(t.embed)?r.text("hasEmbed"):"",t.link?r.text("hasLink"):""].filter(Boolean);if(l.length>0)s.push(r.text("has",{list:r.list(l)}));return s.join(", ")},Kp=12,qp=5,Zp=16,ln=(t,e=!1)=>(e?Zp:qp)/(t>0?t:1),gi=1.22,No=(t,e)=>t.crowded===!0||t.cluster!==void 0||e<Kp;class _o{element;id;node;typeName;hasImage=!1;hasBadges;body;disc;shade;shadeFills;shadowFilters;shadow=null;halo=null;focusRing=null;status=null;role=null;color="";visible=!0;drawn={x:Number.NaN,y:Number.NaN,radius:Number.NaN,upright:0,opacity:Number.NaN};transform="";opacity="";editing=!1;lifted=!1;dropTarget=!1;flat=!1;crowded=!1;speck=!1;turnedBack=!1;constructor(t,e,n,i,r,o,s){this.id=t.id,this.node=t.node;let{node:a}=t,l=r.nodeType(a);this.typeName=r.typeName(a),this.element=_("g",{class:"orbit-node","data-orbit-node-id":a.id,tabindex:"-1"}),this.element.setAttribute("role","button"),Si(this.element,a,this.typeName),Mi(this.element,l),this.body=_("g",{class:"orbit-node__body"}),this.shadowFilters={planet:`url(#${n.shadow})`,sun:`url(#${n.sunShadow})`},this.disc=_("circle",{class:"orbit-node__disc",r:"1"}),this.body.append(this.disc);let d=To(a),c=d?D(d,"image"):null;if(c){let h=_("image",{class:"orbit-node__image",x:"-1",y:"-1",width:"2",height:"2",preserveAspectRatio:"xMidYMid slice","clip-path":`url(#${n.clip})`});h.setAttribute("href",H(c,i)),h.addEventListener("error",()=>{h.remove(),this.hasImage=!1,s?.()}),this.body.appendChild(h),this.hasImage=!0}this.shadeFills={body:`url(#${n.shade})`,speck:`url(#${n.speckShade})`},this.shade=_("circle",{class:"orbit-node__shade",r:"1",fill:this.shadeFills.body}),this.body.appendChild(this.shade);let u=a.note||T(a.image)||T(a.embed)||a.link||l?.details;if(T(a.video)){let h=_("g",{class:"orbit-node__play",transform:"translate(0.62 0.62) scale(0.3)"});h.appendChild(_("circle",{r:"1"})),h.appendChild(_("path",{d:"M-0.32 -0.48 L0.52 0 L-0.32 0.48 Z"})),this.body.appendChild(h)}else if(u)this.body.appendChild(_("circle",{class:"orbit-node__marker",cx:"0.72",cy:"0.72",r:"0.13"}));if(this.hasBadges=T(a.video)||Boolean(u)||Boolean(a.status),a.status){let h=r.status(a.status);if(this.status=_("circle",{class:`orbit-node__status orbit-node__status--${h.tone}`}),h.color)this.status.style.fill=h.color;this.body.appendChild(this.status)}this.element.appendChild(this.body),this.update(t,e,o&&{...o,switches:Number.POSITIVE_INFINITY,flight:!1})}update(t,e=1/0,n,i=!1){let r=No(t,e);if(r!==this.flat)this.element.classList.toggle("orbit-node--flat",r),this.flat=r;let o=t.crowded===!0;if(o!==this.crowded)this.element.classList.toggle("orbit-node--crowded",o),this.crowded=o;if(t.role!==this.role){if(this.role)this.element.classList.remove(`orbit-node--${this.role}`);if(this.element.classList.add(`orbit-node--${t.role}`),this.role=t.role,this.shadow?.setAttribute("filter",t.role==="sun"?this.shadowFilters.sun:this.shadowFilters.planet),t.role==="sun")this.element.setAttribute("aria-current","true");else this.element.removeAttribute("aria-current");let p=t.role==="sun"?0.11:0.17,b=t.role==="sun"?0.68:0.72;this.status?.setAttribute("r",String(p)),this.status?.setAttribute("cx",String(b)),this.status?.setAttribute("cy",String(-b))}if(!r&&t.role!=="node"&&!this.shadow)this.shadow=_("circle",{class:"orbit-node__shadow",r:"1"}),this.shadow.setAttribute("filter",t.role==="sun"?this.shadowFilters.sun:this.shadowFilters.planet),this.body.insertBefore(this.shadow,this.halo??this.disc);if(t.role==="sun"&&!this.halo)this.halo=_("circle",{class:"orbit-node__halo",r:"1"}),this.body.insertBefore(this.halo,this.disc);if(t.color!==this.color)this.disc.style.fill=t.color,this.element.style.setProperty("--orbit-node-color",t.color),this.color=t.color;let s=t.opacity>0.01&&t.radius>0.05;if(s!==this.visible)this.element.style.display=s?"":"none",this.visible=s;let a=o&&!this.hasBadges?n?.crowdedSpeckRadius??ln(1,!0):n?.speckRadius??ln(1),l=!i&&r&&!this.hasImage&&e<a;if(l!==this.speck&&!(s&&l&&n?.flight))if(s&&n&&n.switches<=0&&!i)n.waiting=!0;else{if(s&&n)n.switches-=1;this.setSpeck(l)}if(!s)return;let d=n?.turn,c=d===void 0?void 0:t.unturned,u=c??t;this.turnedBack=c!==void 0&&!this.speck;let h=this.turnedBack&&d?d:0,m=this.drawn;if(u.x!==m.x||u.y!==m.y||t.radius!==m.radius||h!==m.upright){if(this.speck)this.placeSpeck(u.x,u.y,t.radius);else{let p=`translate(${R(u.x)} ${R(u.y)})${h?` rotate(${-h})`:""} scale(${R(t.radius,4)})`;if(p!==this.transform)this.element.setAttribute("transform",p),this.transform=p}m.x=u.x,m.y=u.y,m.radius=t.radius,m.upright=h}if(t.opacity!==m.opacity){let p=t.opacity>=0.999?"":String(R(t.opacity,3));if(p!==this.opacity)this.element.style.opacity=p,this.opacity=p;m.opacity=t.opacity}}get isTurnedBack(){return this.turnedBack}setSpeck(t){if(this.speck=t,this.element.classList.toggle("orbit-node--speck",t),this.shade.setAttribute("fill",t?this.shadeFills.speck:this.shadeFills.body),t)this.element.removeAttribute("transform"),this.transform="";else{for(let e of this.unitCircles())e.removeAttribute("cx"),e.removeAttribute("cy"),e.setAttribute("r",e===this.focusRing?String(gi):"1");this.shade.style.removeProperty("--orbit-speck-radius")}this.drawn.x=Number.NaN}placeSpeck(t,e,n){let i=String(R(t)),r=String(R(e));for(let o of this.unitCircles())o.setAttribute("cx",i),o.setAttribute("cy",r),o.setAttribute("r",String(R(n*(o===this.focusRing?gi:1),4)));this.shade.style.setProperty("--orbit-speck-radius",String(R(n,4)))}unitCircles(){return this.focusRing?[this.disc,this.shade,this.focusRing]:[this.disc,this.shade]}resolvedFill(){return typeof getComputedStyle==="function"?getComputedStyle(this.disc).fill:""}setEditing(t){if(t!==this.editing){if(t)this.showFocusRing();this.element.classList.toggle("orbit-node--editing",t),this.editing=t}}setLifted(t){if(t!==this.lifted)this.element.classList.toggle("orbit-node--lifted",t),this.lifted=t}setDropTarget(t){if(t!==this.dropTarget){if(t)this.showFocusRing();this.element.classList.toggle("orbit-node--drop-target",t),this.dropTarget=t}}showFocusRing(){if(!this.focusRing){if(this.focusRing=_("circle",{class:"orbit-node__focus-ring",r:String(gi)}),this.body.appendChild(this.focusRing),this.speck)this.placeSpeck(this.drawn.x,this.drawn.y,this.drawn.radius)}}}class Oi{element;shown=!1;pending=!1;drop=!1;label="";transform="";opacity="";get isShown(){return this.shown}constructor(t=!1){if(this.element=t?_("g",{class:"orbit-add orbit-add--held","aria-hidden":"true"}):_("g",{class:"orbit-add","data-orbit-add":"",tabindex:"-1"}),!t)this.element.setAttribute("role","button");let e=_("g",{class:"orbit-add__body"});e.append(_("circle",{class:"orbit-add__disc",r:"1"}),_("path",{class:"orbit-add__plus",d:"M-0.3 0H0.3M0 -0.3V0.3"}),_("circle",{class:"orbit-add__focus-ring",r:String(gi)})),this.element.appendChild(e),this.element.style.display="none"}update(t,e,n,i,r=!1){let o=t!==void 0&&t.opacity>0.01&&t.radius>0.05;if(o!==this.shown)this.element.style.display=o?"":"none",this.shown=o;if(!t||!o)return;if(n!==this.pending)this.element.classList.toggle("orbit-add--pending",n),this.pending=n;if(r!==this.drop)this.element.classList.toggle("orbit-add--drop",r!==!1),this.element.classList.toggle("orbit-add--waiting",r==="waiting"),this.drop=r;if(e!==this.label){if(e)this.element.setAttribute("aria-label",e);else this.element.removeAttribute("aria-label");this.label=e}let s=i===void 0?void 0:t.unturned,a=s??t,l=s&&i?` rotate(${-i})`:"",d=`translate(${R(a.x)} ${R(a.y)})${l} scale(${R(t.radius,4)})`;if(d!==this.transform)this.element.setAttribute("transform",d),this.transform=d;let c=t.opacity>=0.999?"":String(R(t.opacity,3));if(c!==this.opacity)this.element.style.opacity=c,this.opacity=c}}var Si=(t,e,n=e.type)=>{if(n)t.setAttribute("data-orbit-type",n.toLowerCase());if(e.status)t.setAttribute("data-orbit-status",e.status.trim().toLowerCase());if(e.tags?.length)t.setAttribute("data-orbit-tags",e.tags.join(" "))},Mi=(t,e)=>{for(let[n,i]of Object.entries(e?.tokens??{}))if(typeof i==="string"&&i!=="")t.style.setProperty(`--_orbit-${n}`,i)},To=(t)=>{if(T(t.image))return t.image.src;if(T(t.video)){if(t.video.thumbnail)return t.video.thumbnail;if(t.video.provider!=="vimeo"&&t.video.provider!=="native")return Rn(t.video.src)??void 0}return},yi={sun:16,planet:13,node:12,moon:13},Ei={sun:9,planet:9,node:10,moon:9},vi={sun:4,planet:3,node:3,moon:2},Ni=1.22,xi=1.45,Zl=2,Xp=8,_i=(t,e)=>Math.max(44,Math.min(260,Math.round(e*(t==="sun"?1.6:1.68)/6)*6)),Vl=(t)=>t<12?9:12;class Xl{measure;pieces;sizes=new Map;constructor(t,e){this.measure=e,this.pieces=nn(t)}at(t){let e=this.measure.bySize?Vl(t):0,n=this.sizes.get(e);if(!n){let{measure:i}=this,r=this.pieces.map((s)=>({text:s.text,ems:i.ems(s.text,e),spaced:s.spaced})),o=i.space(e);n={units:r,longestUnbreakable:r.reduce((s,a)=>Math.max(s,a.ems),0),total:r.reduce((s,a,l)=>s+a.ems+(l>0&&a.spaced?o:0),0),space:o,ellipsis:i.ellipsis(e),hyphen:i.ems("-",e)},this.sizes.set(e,n)}return n}character(t,e){return this.measure.ems(t,this.measure.bySize?Vl(e):0)}}var sn=new Map,Jp=20000,Fo=(t,e)=>{let n=`${e.key}
|
|
120
|
+
${t}`,i=sn.get(n);if(i)return i;if(sn.size>=Jp)sn.clear();let r=new Xl(t,e);return sn.set(n,r),r},Jl=(t,e,n,i=Vt)=>{let r=Fo(n,i).at(yi[t]).longestUnbreakable,o=r>0?e/r:yi[t];return Math.max(Ei[t],Math.min(yi[t],Math.floor(o*2)/2))},Qp=(t)=>t.map((e,n)=>n>0&&e.spaced?` ${e.text}`:e.text).join(""),tm=(t,e)=>t.reduce((n,i,r)=>n+i.ems+(r>0&&i.spaced?e.space:0),0),Hl=(t,e,n)=>t.length<=e.length&&t.every((i,r)=>i*n<=e[r]+0.000000001),em=(t,e)=>{let n=[],i=[],r=0;for(let o of t.units){let s=r>0&&o.spaced?t.space:0;if(r>0&&r+s+o.ems>e[n.length]){if(n.push(i),n.length>=e.length)return null;i=[],r=0}if(o.ems>e[n.length])return null;r+=(r>0&&o.spaced?t.space:0)+o.ems,i.push(o)}return n.push(i),n},nm=(t,e,n)=>{let i=t.length;if(i<2)return t;let r=i===2?[...t[0],...t[1]]:t.flat(),o=r.length;if(o<=i)return t;let s=new Float64Array(o+1),a=new Float64Array(o+1);for(let h=0;h<o;h+=1)s[h+1]=s[h]+r[h].ems,a[h+1]=a[h]+(r[h].spaced?e.space:0);let l=(h,m,p)=>(s[m]-s[h]+a[m]-a[h+1])/n[p],d=i===4?rm(o,l):im(i,o,l);if(!d)return t;let c=[],u=0;for(let h of[...d,o])c.push(r.slice(u,h)),u=h;return c},im=(t,e,n)=>{let i=1/0,r=null;if(t===2){for(let o=1;o<e;o+=1){let s=Math.max(n(0,o,0),n(o,e,1));if(s<=1&&s<i-0.000000001)i=s,r=[o]}return r}for(let o=1;o<e-1;o+=1){let s=n(0,o,0);if(s>1)break;for(let a=o+1;a<e;a+=1){let l=Math.max(s,n(o,a,1),n(a,e,2));if(l<=1&&l<i-0.000000001)i=l,r=[o,a]}}return r},rm=(t,e)=>{let n=Array.from({length:4},()=>new Float64Array(t+1).fill(1/0)),i=Array.from({length:4},()=>new Int32Array(t+1));for(let s=1;s<=t;s+=1){let a=e(0,s,0);n[0][s]=a<=1?a:1/0}for(let s=1;s<4;s+=1)for(let a=s+1;a<=t;a+=1)for(let l=s;l<a;l+=1){let d=n[s-1][l],c=e(l,a,s),u=Math.max(d,c);if(c<=1&&u<n[s][a]-0.000000001)n[s][a]=u,i[s][a]=l}if(n[3][t]===1/0)return null;let r=[],o=t;for(let s=3;s>0;s-=1)o=i[s][o],r.unshift(o);return r},om=(t,e,n)=>{let i=t.at(e),r=i.units.reduce((p,b)=>p+b.text.length,0),o=[],s=[],a=n.length-1,l=Math.max(...n),d=()=>n[o.length]-(o.length===a?i.ellipsis:0),c="",u=0,h=0;for(let p of i.units){let b=u>0&&p.spaced?i.space:0;if(u+b+p.ems>d()&&o.length<a){if(u>0)o.push(c),s.push(u),c="",u=0,b=0;if(p.ems>d()&&p.ems<=l)return null;while(p.ems>d()&&o.length<a){let f=am(p,d(),t,e);if(!f)return null;o.push(f.head),s.push(f.headEms),h+=f.head.length-1,p=f.rest}}if(u+b+p.ems<=d()){c+=b>0?` ${p.text}`:p.text,u+=b+p.ems,h+=p.text.length;continue}for(let f of Bt(p.text)){let g=t.character(f,e);if(u+b+g>d())break;c+=b>0?` ${f}`:f,u+=b+g,b=0,h+=f.length}break}let m=h<r;return o.push(m?`${c.trimEnd()}…`:c.trimEnd()),s.push(u+(m?i.ellipsis:0)),{lines:o,widths:s,shown:h,truncated:m}},sm=/^\p{L}{8,}$/u,am=(t,e,n,i)=>{if(!sm.test(t.text))return null;let r=Bt(t.text),o="",s=n.at(i).hyphen,a=0,l=0;for(let c of r){let u=n.character(c,i);if(s+u>e)break;o+=c,s+=u,l+=u,a+=1}if(a<3||r.length-a<3)return null;let d=r.slice(a).join("");return{head:`${o}-`,headEms:s,rest:{text:d,ems:Math.max(0,t.ems-l),spaced:!1}}},zl=(t,e)=>Math.abs(e)>=t?0:2*Math.sqrt(t*t-e*e),Xt=0.74,Co=15,Ul=10.5,lm=6,jl=1.5,dm=0.15,Jt=(t,e,n)=>n>0&&t!=="moon"&&e>=10,So=new Map,Ti=(t,e=hi)=>{let n=1;for(let o=t;o>=10;o=Math.floor(o/10))n+=1;let i=So.get(e);if(!i)i=[],So.set(e,i);let r=i[n];if(r===void 0)r=2*lm+e.ems(`+${"0".repeat(n)}`,Ul)*Ul,i[n]=r;return r},cm=(t,e)=>e>0?{top:Xt*t-Co/2-jl,left:Xt*t-e/2-jl}:null,bi=(t,e,n,i,r=null)=>{let o=e*Ni,s=i?e*xi+Zl:0,a=s+n*o;if(a>t*2)return null;let l=r?r.top+e*dm:1/0,d=r?Math.min(Math.max(0,a/2-l),t-a/2):0,c=-a/2-d;if(i&&zl(t,c+e*xi/2)<e*xi)return null;let u=[];for(let h=0;h<n;h+=1){let m=c+s+h*o,p=zl(t,m+o/2);u.push(r&&m+o>l+0.000000001?Math.min(p,2*Math.max(0,r.left)):p)}return{widths:u,lift:d}},Ql=(t)=>((t.icon?t.fontSize*xi+Zl:0)+t.lines.length*t.fontSize*Ni)/2-t.lift,Mo=new Map,um=20000;we(()=>{sn.clear(),Mo.clear(),So.clear()});var ke=(t,e,n,i=!1,r=Vt,o=!0,s=0)=>{let a=Math.max(2,Math.round(e*0.06)),l=Math.floor(e/a)*a;if(Fi(l)<td)return null;let d=Mo.get(r);if(!d)d=new Map,Mo.set(r,d);let c=`${t}|${l}|${i?1:0}|${s}|${n}`,u=d.get(c);if(u===void 0){if(d.size>=um)d.clear();let h=ed(t,l,n,i,r,s);u=h!==null&&!h.truncated?{own:h,narrower:h}:{own:h},d.set(c,u)}if(u.narrower!==void 0)return u.narrower;if(!o)return u.own;return u.narrower=mm(t,l,n,i,r,s)??u.own,u.narrower},hm=3,Fi=(t)=>t-Math.max(2,t*0.05),td=6,pm=16,mm=(t,e,n,i,r,o)=>{let s=Fi(e)>=pm?r.narrower():null;if(!s||!bm(t,e,n,s.narrower()??s))return null;for(let a=s;a;a=a.narrower()){let l=ed(t,e,n,i,a,o);if(l&&!l.truncated)return{...l,stretch:a.stretch}}return null},bm=(t,e,n,i)=>{let r=Ei[t],o=Fo(n,i).at(r),s=Fi(e),a=Math.max(o.total-o.space*vi[t],0.01);return o.longestUnbreakable*r<=2*s&&r<=s*Math.sqrt(1.25*Math.PI/(Ni*a))},ed=(t,e,n,i,r,o)=>{let s=Fi(e),a=cm(e,o);if(s<td)return null;let l=Fo(n,r),d=yi[t],c=Ei[t],u=(y)=>Math.max(y.total-y.space*vi[t],0.01),h=l.at(d),m=Math.min(d,2*s/Math.max(h.longestUnbreakable,0.01),s*Math.sqrt(1.25*Math.PI/(Ni*u(h)))),p=Math.floor(m*2)/2,b=[];if(i)for(let y=p;y>=Math.max(c,d-hm);y-=0.5)b.push([!0,y]);for(let y=p;y>=c;y-=0.5)b.push([!1,y]);for(let[y,v]of b){let O=l.at(v),M=u(O);for(let w=Math.max(1,Math.ceil(M*v/(2*s)));w<=vi[t];w+=1){let x=bi(s,v,w,y,a);if(!x)break;let E=em(O,x.widths.map((B)=>B/v));if(!E)continue;let k=E.length===w?x:bi(s,v,E.length,y,a);if(!k)continue;let C=nm(E,O,k.widths.map((B)=>B/v));if(!Hl(C.map((B)=>tm(B,O)),k.widths,v))continue;return{width:Math.floor(Math.max(...k.widths.slice(0,C.length))),fontSize:v,lines:C.map(Qp),icon:y,truncated:!1,lift:k.lift}}}if(t==="node")return null;let f=null,g=0;for(let y=1;y<=vi[t];y+=1){let v=bi(s,c,y,!1,a);if(!v)break;let O=om(l,c,v.widths.map((w)=>w/c));if(!O||O.shown<=g)continue;let M=O.lines.length===y?v:bi(s,c,O.lines.length,!1,a);if(!M||!Hl(O.widths,M.widths,c))continue;g=O.shown,f={width:Math.floor(Math.max(...M.widths)),fontSize:c,lines:O.lines,icon:!1,truncated:O.truncated,lift:M.lift}}return t==="sun"||g>=Xp?f:null},Io=(t,e,n,i,r=!1,o=Vt,s=!0,a=0)=>{if(!i&&ke(t,e,n,r,o,s,a))return"inside";if(t==="sun")return"outside";if(i||t==="node")return e>=(t==="moon"?11:4)?"outside":"hidden";return"hidden"},Wl=(t,e)=>{t.textContent="";for(let n of e.split(/(\s+)/)){if(!n)continue;if(/^\s+$/.test(n)){t.append(n);continue}po(n).forEach((i,r)=>{if(r>0)t.append(document.createElement("wbr"));t.append(i)})}},fm={x:0,y:1};class Ao{element;node;typeName;text;hasIcon;direction=null;placement=null;role=null;fontSize=0;stretch=0;shownLines=null;pillText=null;iconHidden=!1;light=null;wrapped=!1;pillWidth=0;shown=!0;transform="";opacity="";constructor(t,e){this.node=t,this.element=document.createElement("div"),this.element.className="orbit-label",this.element.setAttribute("aria-hidden","true"),this.element.dataset.orbitFor=t.id,this.typeName=e.typeName(t),Si(this.element,t,this.typeName),Mi(this.element,e.nodeType(t));let n=e.icon(t);if(this.hasIcon=Boolean(n),n){let i=document.createElement("span");i.className="orbit-label__icon",i.textContent=n,this.element.appendChild(i)}this.text=document.createElement("span"),this.text.className="orbit-label__text",Wl(this.text,t.text),this.element.appendChild(this.text)}get currentPlacement(){return this.placement??"hidden"}get isShown(){return this.shown&&this.placement!==null&&this.placement!=="hidden"}update(t){let{x:e,y:n,screenRadius:i,role:r,placement:o,opacity:s}=t;if(o!==this.placement||r!==this.role)this.element.className=`orbit-label orbit-label--${r}${o==="outside"?" orbit-label--outside":""}`,this.placement=o,this.role=r,this.light=null,this.wrapped=!1;let a=o!=="hidden"&&s>0.01;if(a!==this.shown)this.element.style.display=a?"":"none",this.shown=a;if(!a)return;let l;if(o==="inside"){let c=ke(r,i,this.node.text,this.hasIcon,t.measure,t.narrower,t.countWidth)??{width:_i(r,i),fontSize:Ei[r],lines:[this.node.text],icon:!1,truncated:!0,lift:0},u=t.light??!1;if(u!==this.light)this.element.classList.toggle("orbit-label--light",u),this.light=u;if(c.fontSize!==this.fontSize)this.element.style.fontSize=`${c.fontSize}px`,this.fontSize=c.fontSize;let h=c.stretch??0;if(h!==this.stretch)this.element.style.fontStretch=h?`${h}%`:"",this.stretch=h;let m=c.lines.join(`
|
|
121
|
+
`);if(m!==this.shownLines)this.text.textContent=m,this.shownLines=m,this.pillText=null;let p=this.hasIcon&&!c.icon;if(p!==this.iconHidden)this.element.classList.toggle("orbit-label--no-icon",p),this.iconHidden=p;l=`translate3d(${R(e,1)}px, ${R(n-c.lift,1)}px, 0) translate(-50%, -50%)`}else{let{direction:c=fm,distance:u=i+5,offset:h=0,lines:m=1,width:p=0,pillText:b=this.node.text}=t;if(this.fontSize!==0)this.element.style.fontSize="",this.fontSize=0;if(this.stretch!==0)this.element.style.fontStretch="",this.stretch=0;if(this.shownLines!==null||this.pillText!==b)Wl(this.text,b),this.shownLines=null,this.pillText=b;let f=m===2;if(f!==this.wrapped)this.element.classList.toggle("orbit-label--wrapped",f),this.wrapped=f;if(f&&p!==this.pillWidth)this.element.style.setProperty("--orbit-pill-width",`${Math.floor(p)}px`),this.pillWidth=p;this.direction=c;let g=R(-50+c.x*50,1),y=R(-50+c.y*50,1);l=`translate3d(${R(e+c.x*u+h,1)}px, ${R(n+c.y*u,1)}px, 0) translate(${g}%, ${y}%)`}if(l!==this.transform)this.element.style.transform=l,this.transform=l;let d=s>=0.999?"":String(R(s,3));if(d!==this.opacity)this.element.style.opacity=d,this.opacity=d}}var dn=(t,e)=>{if(t<=0)return"";let n=e.map((r)=>({start:gm(r.angle-r.halfWidth),width:r.halfWidth*2})).filter((r)=>r.width>0).sort((r,o)=>r.start-o.start);if(n.length===0)return`M ${R(t)} 0 A ${R(t)} ${R(t)} 0 1 1 ${R(-t)} 0 A ${R(t)} ${R(t)} 0 1 1 ${R(t)} 0`;let i=[];for(let r=0;r<n.length;r+=1){let o=n[r],s=n[(r+1)%n.length],a=o.start+o.width,l=s.start;if(r===n.length-1)l+=360;let d=l-a;if(d<=0.5)continue;let c=Gl(t,a),u=Gl(t,l);i.push(`M ${R(c.x)} ${R(c.y)} A ${R(t)} ${R(t)} 0 ${d>180?1:0} 1 ${R(u.x)} ${R(u.y)}`)}return i.join(" ")},Gl=(t,e)=>{let n=e*Math.PI/180;return{x:t*Math.cos(n),y:t*Math.sin(n)}},gm=(t)=>(t%360+360)%360,R=(t,e=2)=>{let n=10**e;return Math.round(t*n)/n};var nd=(t,e)=>{let n=new Set,i=[t];while(i.length>0){let r=i.pop();n.add(r.id),i.push(...r.children)}if(e!==void 0)n.add(e);return n},id=(t,e,n,i,r)=>{let o=null,s=1/0;for(let a of t.nodes.values()){if(n.has(a.id)||a.opacity<0.6||a.radius<=0)continue;let l=i(a,a.id===r),d=Math.hypot(e.x-a.x,e.y-a.y);if(d>l)continue;let c=d/l;if(c<s)o=a,s=c}return o},rd=(t,e,n,i,r,o,s=null)=>{if(t.kind!=="focus"||t.rings.length>1)return null;let a=t.rings[0]?.radius??i;if(Math.abs(Math.hypot(e.x,e.y)-a)>r)return null;let l=(g)=>(g%360+360)%360,d=Array.from(t.nodes.values()).filter((g)=>g.role==="planet"&&g.orbitAngle!==void 0),c=d.filter((g)=>g.id!==o).map((g)=>g.orbitAngle);if(c.length===0)return 0;let u=d.map((g)=>g.orbitAngle);if(t.addSlot)u.push(t.addSlot.orbitAngle);u.sort((g,y)=>l(g+90)-l(y+90));let h=u.length>1?l(u[1]-u[0])/2:180,m=u[0]-h,p=l(ve(Math.atan2(e.y,e.x))-n-m),b=c.filter((g)=>l(g-m)<p).length,f=(g)=>g===0||g===c.length;return f(b)&&f(s)?s:b},od=(t,e)=>{if(t===null||e===null)return t===e;return t.parentId===e.parentId&&t.index===e.index&&t.into===e.into};var sd={white:"#ffffff",black:"#000000",transparent:"#00000000"},nt=String.raw`[-+]?(?:\d*\.\d+|\d+)(?:e[-+]?\d+)?`,ym=new RegExp(String.raw`^rgba?\(\s*(${nt})(%?)[\s,]+(${nt})(%?)[\s,]+(${nt})(%?)(?:\s*[,/]\s*(${nt})(%?))?\s*\)$`),vm=new RegExp(String.raw`^color\(srgb\s+(${nt})\s+(${nt})\s+(${nt})(?:\s*\/\s*(${nt})(%?))?\s*\)$`),xm=new RegExp(String.raw`^oklab\(\s*(${nt})(%?)\s+(${nt})\s+(${nt})(?:\s*\/\s*(${nt})(%?))?\s*\)$`),wm=new RegExp(String.raw`^oklch\(\s*(${nt})(%?)\s+(${nt})\s+(${nt})(?:deg)?(?:\s*\/\s*(${nt})(%?))?\s*\)$`),ft=(t)=>{let e=t.trim().toLowerCase();if(sd[e])return ft(sd[e]);let n=/^#([0-9a-f]{3,8})$/.exec(e);if(n)return km(n[1]);if(n=ym.exec(e),n){let i=(r,o)=>Number(r)/(o==="%"?100:255);return{red:i(n[1],n[2]),green:i(n[3],n[4]),blue:i(n[5],n[6]),alpha:Ci(n[7],n[8])}}if(n=vm.exec(e),n)return{red:Number(n[1]),green:Number(n[2]),blue:Number(n[3]),alpha:Ci(n[4],n[5])};if(n=xm.exec(e),n){let i=Number(n[1])/(n[2]==="%"?100:1);return Po(i,Number(n[3]),Number(n[4]),Ci(n[5],n[6]))}if(n=wm.exec(e),n){let i=Number(n[1])/(n[2]==="%"?100:1),r=Number(n[3]),o=Number(n[4])*Math.PI/180;return Po(i,r*Math.cos(o),r*Math.sin(o),Ci(n[5],n[6]))}return null},km=(t)=>{let e=t.length===3||t.length===4?t.split("").map((i)=>i+i).join(""):t;if(e.length!==6&&e.length!==8)return null;let n=(i)=>parseInt(e.slice(i,i+2),16)/255;return{red:n(0),green:n(2),blue:n(4),alpha:e.length===8?n(6):1}},Ci=(t,e)=>{if(t===void 0)return 1;return Number(t)/(e==="%"?100:1)},cn=(t)=>{let e=(i)=>Math.round(Math.min(1,Math.max(0,i))*255).toString(16).padStart(2,"0"),n=t.alpha<1?e(t.alpha):"";return`#${e(t.red)}${e(t.green)}${e(t.blue)}${n}`},Oe=(t)=>t<=0.04045?t/12.92:((t+0.055)/1.055)**2.4,Lo=(t)=>t<=0.0031308?t*12.92:1.055*t**0.4166666666666667-0.055,ad=(t)=>{let e=Oe(t.red),n=Oe(t.green),i=Oe(t.blue),r=Math.cbrt(0.4122214708*e+0.5363325363*n+0.0514459929*i),o=Math.cbrt(0.2119034982*e+0.6806995451*n+0.1073969566*i),s=Math.cbrt(0.0883024619*e+0.2817188376*n+0.6299787005*i);return[0.2104542553*r+0.793617785*o-0.0040720468*s,1.9779984951*r-2.428592205*o+0.4505937099*s,0.0259040371*r+0.7827717662*o-0.808675766*s]},Om=(t,e,n)=>{let i=(t+0.3963377774*e+0.2158037573*n)**3,r=(t-0.1055613458*e-0.0638541728*n)**3,o=(t-0.0894841775*e-1.291485548*n)**3;return[4.0767416621*i-3.3077115913*r+0.2309699292*o,-1.2684380046*i+2.6097574011*r-0.3413193965*o,-0.0041960863*i-0.7034186147*r+1.707614701*o]},Po=(t,e,n,i)=>{let[r,o,s]=Om(t,e,n);return{red:Lo(r),green:Lo(o),blue:Lo(s),alpha:i}};var Ro=(t,e,n)=>{let[i,r,o]=ad(t),[s,a,l]=ad(e),d=(c,u)=>c*n+u*(1-n);return Po(d(i,s),d(r,a),d(o,l),d(t.alpha,e.alpha))},Do=(t)=>0.2126*Oe(t.red)+0.7152*Oe(t.green)+0.0722*Oe(t.blue),ld=(t,e)=>{let[n,i]=[Do(t),Do(e)].sort((r,o)=>o-r);return(n+0.05)/(i+0.05)},Ii=(t,e,n)=>{let i=ft(t);if(!i)return!1;let r=ft(e),o=ft(n);if(!r||!o)return Do(i)<0.18;return ld(i,r)>=ld(i,o)},Se=(t)=>{let e=ft(t);if(!e)return{color:t,opacity:1};return{color:cn({...e,alpha:1}),opacity:Math.round(e.alpha*1000)/1000}},it=(t,e)=>{let n=t.replace(/var\(--_?orbit-([a-z0-9-]+)(?:\s*,\s*([^()]+))?\)/gi,(o,s,a)=>e[s]??a?.trim()??o),i=/^color-mix\(\s*in\s+oklab\s*,\s*(.+?)\s+(\d*\.\d+|\d+)%\s*,\s*(.+?)\s*\)$/i.exec(n.trim());if(i){let o=ft(it(i[1],e)),s=ft(it(i[3],e));if(o&&s)return cn(Ro(o,s,Number(i[2])/100));return t}let r=ft(n);return r?cn(r):n};var Di={x:0,y:1},$o={x:0,y:-1},Ai=120,dd=10,cd={sun:0,planet:1,node:1,moon:2},Sm={sun:4,planet:1,node:1,moon:0.5},$i=(t)=>Array.from(t).sort((e,n)=>cd[e.role]-cd[n.role]||e.depth-n.depth||n.radius-e.radius),Bi=(t,e,n)=>{let{camera:i}=t,{viewport:r}=n,o=new Vo(r),s=(u,h,m,p)=>{if(m>2)o.add({id:u,x:h.x,y:h.y,radius:m,cost:p},{left:h.x-m,right:h.x+m,top:h.y-m,bottom:h.y+m})};for(let u of t.nodes.values())if(u.opacity>0.3)s(u.id,X(i,r,u),u.radius*i.scale,Sm[u.role]);if(t.addSlot&&t.addSlot.opacity>0.3)s("",X(i,r,t.addSlot),t.addSlot.radius*i.scale,0.75);let a=new Vo(r),l=n.measures??on,d=n.counts?l.count():null,c=[];for(let u of e){let h=X(i,r,u),m=u.radius*i.scale,p=u.opacity*u.labelOpacity;if(p<=0.01||Im(h,m,r))continue;let b=d&&Jt(u.role,m,u.hiddenChildren)?Ti(u.hiddenChildren,d):0,f=Io(u.role,m,u.node.text,n.hasImage(u),n.hasIcon?.(u),l.inside(u.role,u.node),!n.moving,b);if(f==="hidden"||f==="outside"&&n.inFlight)continue;if(f==="inside"&&n.moving&&l!==on&&(n.inFlight||!n.isShown?.(u.id))&&Io(u.role,m,u.node.text,!1,n.hasIcon?.(u),Vt,!0,b)!=="inside")continue;let g=Di,y=0,v=0,O=1,M=0,w=f==="outside"?n.pillIcon?.(u):void 0,x=w?`${w} ${u.node.text}`.trim():u.node.text;if(f==="outside"){let E=Mm(u,t),k=n.previousSide?.(u.id);if(k)E.sort((A,V)=>pd(A,k)-pd(V,k));let C=u.role==="sun"?280:160,B=l.pill(u.role,u.node),q=(A,V)=>{let ut=Ri(x,h,m,A,C,0,V,B),Ct=A.x===0?Cm(ut,h.x,r):0;return{side:A,offset:Ct,lines:V,box:Ct===0?ut:Ri(x,h,m,A,C,Ct,V,B)}},S=(A)=>o.some(A,(V)=>V.id!==u.id&&hd(V,A)),G=(A)=>o.sum(A,(V)=>V.id!==u.id&&hd(V,A)?V.cost:0),L=(A)=>a.some(A,(V)=>Am(A,V)),F=({box:A})=>Bo(A,r)&&!L(A)&&!S(A),I=E.map((A)=>q(A,1)),J,Z=()=>J??=Tm(x,B)?E.map((A)=>q(A,2)):[],j=I.find(F)??Z().find(F);if(!j&&u.role==="sun")j=I.find(({box:A})=>Bo(A,r))??I[0];else if(!j&&u.role==="planet"){let A=1/0;for(let V of[...I,...Z()])if(Bo(V.box,r)&&!L(V.box)){let ut=G(V.box);if(ut<A)j=V,A=ut}}if(!j)continue;g=j.side,v=j.offset,O=j.lines,M=j.box.right-j.box.left,y=bd(m,g,M,O),a.add(j.box,j.box)}c.push({entry:u,x:h.x,y:h.y,screenRadius:m,placement:f,direction:g,distance:y,offset:v,lines:O,width:M,opacity:p,text:x,countWidth:b})}return c},Mm=(t,e)=>{let n=t.parentId===void 0?void 0:e.nodes.get(t.parentId),i=n?Math.hypot(n.x-t.x,n.y-t.y):0;if(!n||i<0.000001)return[Di,$o];let r={x:(n.x-t.x)/i,y:(n.y-t.y)/i},o={x:-r.x,y:-r.y};if(t.role==="moon")return[o];return(t.node.children.length===0||t.hiddenChildren>=t.node.children.length)&&t.role==="node"?[o,r,Di,$o]:[r,Di,$o,o]},Ri=(t,e,n,i,r,o=0,s=1,a=rn)=>{let l=Math.min(r,Fm(t,s,a)+18),d=md[s],c=bd(n,i,l,s),u=e.x+i.x*(c+l/2)+o,h=e.y+i.y*(c+d/2);return{left:u-l/2,right:u+l/2,top:h-d/2,bottom:h+d/2}},Em=5,md={1:21,2:35},Nm=10.5,bd=(t,e,n,i)=>{let r=t+Em,o=Math.min(Nm,n/2),s=Math.abs(e.x),a=Math.abs(e.y),l=(1-s)*n/2-o,d=(1-a)*md[i]/2-o,c=r+o;if(Li(r,s,a,l,d,c))return r;let u=l*s+d*a,h=u+Math.sqrt(Math.max(0,u*u+c*c-l*l-d*d)),m=a>0?(c+d)/a:1/0,p=s>0?(c+l)/s:1/0,b=1/0;if(Li(h,s,a,l,d,c))b=h;if(m<b&&Li(m,s,a,l,d,c))b=m;if(p<b&&Li(p,s,a,l,d,c))b=p;return Number.isFinite(b)?b:r},Li=(t,e,n,i,r,o)=>Math.hypot(Math.max(0,t*e-i),Math.max(0,t*n-r))>=o-0.001,ud=11.5,un=new Map,_m=20000;we(()=>un.clear());var fd=(t,e)=>{let n=`${e.key}
|
|
122
|
+
${t}`,i=un.get(n);if(i)return i;let r=(d)=>e.ems(d,ud)*ud,o=r(t),s=nn(t),a=o;for(let d=1;d<s.length;d+=1){let c=r(xe(s.slice(0,d))),u=r(xe(s.slice(d)));a=Math.min(a,Math.max(c,u))}if(un.size>=_m)un.clear();let l={oneLine:o,twoLines:a,wraps:s.length>1};return un.set(n,l),l},Tm=(t,e)=>fd(t,e).wraps,Fm=(t,e,n=rn)=>{let i=fd(t,n);return e===1?i.oneLine:i.twoLines},Me=64,Ee=8;class Vo{cells=new Map;columns;rows;seen=new Set;constructor(t){this.columns=Math.max(1,Math.ceil((t.width+2*Ee)/Me)),this.rows=Math.max(1,Math.ceil((t.height+2*Ee)/Me))}add(t,e){this.visitCells(e,(n)=>{let i=this.cells.get(n);if(i)i.push(t);else this.cells.set(n,[t]);return!1})}some(t,e){return this.visitCells(t,(n)=>this.cells.get(n)?.some(e)??!1)}sum(t,e){let n=0;return this.seen.clear(),this.visitCells(t,(i)=>{for(let r of this.cells.get(i)??[])if(!this.seen.has(r))this.seen.add(r),n+=e(r);return!1}),n}visitCells(t,e){let n=Math.max(0,Math.floor((t.left+Ee)/Me)),i=Math.min(this.columns-1,Math.floor((t.right+Ee)/Me)),r=Math.max(0,Math.floor((t.top+Ee)/Me)),o=Math.min(this.rows-1,Math.floor((t.bottom+Ee)/Me));for(let s=r;s<=o;s+=1)for(let a=n;a<=i;a+=1)if(e(s*this.columns+a))return!0;return!1}}var Cm=(t,e,n)=>{let i=t.left<0?-t.left:t.right>n.width?n.width-t.right:0,r=t.left+i,o=t.right+i;return e>=r+dd&&e<=o-dd?i:0},Im=(t,e,n)=>t.x+e<-Ai||t.x-e>n.width+Ai||t.y+e<-Ai||t.y-e>n.height+Ai,Pi=0.5,Bo=(t,e)=>t.left>=-Pi&&t.top>=-Pi&&t.right<=e.width+Pi&&t.bottom<=e.height+Pi,Am=(t,e)=>t.left<e.right&&e.left<t.right&&t.top<e.bottom&&e.top<t.bottom,hd=(t,e)=>{let n=Math.min(e.right,Math.max(e.left,t.x)),i=Math.min(e.bottom,Math.max(e.top,t.y)),r=t.x-n,o=t.y-i;return r*r+o*o<t.radius*t.radius},pd=(t,e)=>Math.hypot(t.x-e.x,t.y-e.y);var gd={back:["M19 12H5","M11 6l-6 6 6 6"],home:["M4 11l8-7 8 7","M6 9.5V20h4.5v-5h3v5H18V9.5"],chevron:["M9.5 6l6 6-6 6"],focus:["M4 9V6a2 2 0 0 1 2-2h3","M15 4h3a2 2 0 0 1 2 2v3","M20 15v3a2 2 0 0 1-2 2h-3","M9 20H6a2 2 0 0 1-2-2v-3","M12 9.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 1 0 0-5z"],overview:["M12 4.5a2 2 0 1 0 0 4 2 2 0 1 0 0-4z","M5.5 15.5a2 2 0 1 0 0 4 2 2 0 1 0 0-4z","M18.5 15.5a2 2 0 1 0 0 4 2 2 0 1 0 0-4z","M10.9 8.3l-4.3 7.4","M13.1 8.3l4.3 7.4","M7.5 17.5h9"],"zoom-in":["M12 5v14","M5 12h14"],"zoom-out":["M5 12h14"],fit:["M4 9V4h5","M20 9V4h-5","M4 15v5h5","M20 15v5h-5"],image:["M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z","M20 15l-4.5-4.5L6 20","M9 7.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 1 0 0-3z"],video:["M8 5.5v13l10.5-6.5z"],embed:["M8.5 8l-4 4 4 4","M15.5 8l4 4-4 4","M13.5 5l-3 14"],note:["M6 4h9l4 4v11a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z","M15 4v4h4","M8.5 12.5h7","M8.5 16h5"],link:["M14 4h6v6","M20 4l-9 9","M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4"],goto:["M4 12h12","M12 7l5 5-5 5","M20 5v14"],info:["M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 1 0 0-17z","M12 11v5.5","M12 7.75h.01"],close:["M6 6l12 12","M18 6L6 18"],previous:["M14.5 6l-6 6 6 6"],next:["M9.5 6l6 6-6 6"],list:["M9 6h11","M9 12h11","M9 18h11","M4.5 6h.01","M4.5 12h.01","M4.5 18h.01"],expand:["M14.5 4H20v5.5","M20 4l-6.5 6.5","M9.5 20H4v-5.5","M4 20l6.5-6.5"]};var at=(t)=>{let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.classList.add("orbit-icon");for(let n of gd[t]){let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",n),e.appendChild(i)}if(t==="video")e.classList.add("orbit-icon--filled");return e};var Lm=(t)=>Object.prototype.hasOwnProperty.call(gd,t),Vi=(t,e)=>{if(t&&Lm(t))return at(t);if(t&&/^[Mm]\s*-?[\d.]/.test(t)){let i=at("note");i.replaceChildren();let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",t),i.appendChild(r),i}let n=document.createElement("span");return n.className="orbit-icon orbit-icon--glyph",n.setAttribute("aria-hidden","true"),n.textContent=t||Array.from(e.trim())[0]?.toUpperCase()||"•",n};var hn=(t,e,n)=>{let i=D(t,"embed");if(!i)return null;let r=document.createElement("iframe"),o=H(i,e);return r.src=o,r.title=n,r.setAttribute("sandbox",Pm(o)?"allow-scripts allow-presentation allow-popups":"allow-scripts allow-same-origin allow-presentation allow-popups"),r.setAttribute("referrerpolicy","no-referrer"),r.setAttribute("allow","fullscreen; picture-in-picture"),r.setAttribute("allowfullscreen",""),r},pn=(t,e)=>{let n=D(t,"embed");if(!n)return null;let i=document.createElement("iframe");return i.src=n,i.title=e,i.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox"),i.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),i.setAttribute("allow","autoplay; fullscreen; picture-in-picture; encrypted-media"),i.setAttribute("allowfullscreen",""),i},Pm=(t)=>{if(typeof location>"u")return!1;try{return new URL(t,document.baseURI).origin===location.origin}catch{return!0}};var Ne=(t,e={})=>kd(xd(t),e,0),Dm=/(```[\s\S]*?```|~~~[\s\S]*?~~~|`[^`\n]*`)|<!--[\s\S]*?-->/g,xd=(t)=>t.replace(Dm,(e,n)=>n??""),wd=100,kd=(t,e,n)=>{let i=document.createDocumentFragment(),r=t.replace(/\r\n?/g,`
|
|
123
123
|
`).split(`
|
|
124
124
|
`),o=0;while(o<r.length){let s=r[o];if(s.trim()===""){o+=1;continue}let a=/^\s*(```|~~~)/.exec(s);if(a){let u=[];o+=1;while(o<r.length&&!r[o].trimStart().startsWith(a[1]))u.push(r[o]),o+=1;o+=1;let h=document.createElement("pre"),m=document.createElement("code");m.textContent=u.join(`
|
|
125
|
-
`),h.appendChild(m),i.appendChild(h);continue}let l=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(s);if(l){let u=Math.min(5,Math.max(3,l[1].length+2)),h=document.createElement(`h${u}`);
|
|
126
|
-
`),e,n+1));i.appendChild(h);continue}if(bi.test(s)){let[u,h]=Kl(r,o,e,n);i.appendChild(u),o=h;continue}let d=[];while(o<r.length&&r[o].trim()!==""&&!/^\s*(```|~~~|>|#{1,6}\s)/.test(r[o])&&!bi.test(r[o]))d.push(r[o].trim()),o+=1;let c=document.createElement("p");St(c,d.join(" "),e),i.appendChild(c)}return i},bi=/^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/,Kl=(t,e,n,i)=>{let r=bi.exec(t[e]),o=r[1].length,s=/\d/.test(r[2]),a=document.createElement(s?"ol":"ul"),l=e,d=null;while(l<t.length){let c=t[l];if(c.trim()===""){l+=1;continue}let u=bi.exec(c),h=c.length-c.trimStart().length;if(u&&u[1].length===o&&/\d/.test(u[2])!==s)break;if(u&&u[1].length===o){d=document.createElement("li"),St(d,u[3],n),a.appendChild(d),l+=1;continue}if(u&&u[1].length>o&&d){if(i>=Wl){d.appendChild(document.createTextNode(` ${c.trim()}`)),l+=1;continue}let[m,p]=Kl(t,l,n,i+1);d.appendChild(m),l=p;continue}if(!u&&h>o&&d){d.appendChild(document.createTextNode(` ${c.trim()}`)),l+=1;continue}break}return[a,l]},Hl=String.raw`\(((?:[^()\s]|\([^()\s]*\))+)\)`,em=new RegExp(String.raw`(`+"`"+String.raw`+)([\s\S]*?)\1|!\[([^\]]*)\]`+Hl+String.raw`|\[([^\]]+)\]`+Hl+String.raw`|<(https?:\/\/[^>\s]+|mailto:[^>\s]+)>|(\*\*|__)([\s\S]+?)\8|~~([\s\S]+?)~~|(\*|_)([^\s*_][\s\S]*?)\11`,"g"),St=(t,e,n)=>{let i=0;for(let r of e.matchAll(em)){let o=r.index??0;if(o>i)t.appendChild(document.createTextNode(e.slice(i,o)));if(i=o+r[0].length,r[1]!==void 0){let s=document.createElement("code");s.textContent=r[2].trim(),t.appendChild(s)}else if(r[4]!==void 0){let s=V(r[4],"image");if(s){let a=document.createElement("img");a.src=G(s,n.baseUrl),a.alt=r[3],a.loading="lazy",t.appendChild(a)}else t.appendChild(document.createTextNode(r[3]))}else if(r[6]!==void 0)t.appendChild(Ul(r[6],r[5],n));else if(r[7]!==void 0)t.appendChild(Ul(r[7],r[7],n));else if(r[9]!==void 0){let s=document.createElement("strong");St(s,r[9],n),t.appendChild(s)}else if(r[10]!==void 0){let s=document.createElement("del");St(s,r[10],n),t.appendChild(s)}else if(r[12]!==void 0){let s=document.createElement("em");St(s,r[12],n),t.appendChild(s)}}if(i<e.length)t.appendChild(document.createTextNode(e.slice(i)))},Ul=(t,e,n)=>{if(lt(t)){let o=!n.resolveLink||n.resolveLink(t),s=document.createElement(o?"a":"span");if(s instanceof HTMLAnchorElement)s.href=t;return St(s,e,n),s}let i=V(t,"link");if(!i)return document.createTextNode(e);let r=document.createElement("a");return r.href=G(i,n.baseUrl),r.target="_blank",r.rel="noopener noreferrer",St(r,e,n),r},Yl=(t)=>jl(t).replace(/```[\s\S]*?```/g," ").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<(https?:\/\/[^>]+)>/g,"$1").replace(/(\*\*|__|~~|`)/g,"").replace(/([*_])(\S(?:[\s\S]*?\S)?)\1/g,"$2").replace(/^\s*(#{1,6}|>|[-*+]|\d{1,9}[.)])\s+/gm,"").replace(/\s+/g," ").trim();var nm=80,im=new dt("en");class ko{host;dialog=null;request=null;returnFocus=null;constructor(t){this.host=t}get isOpen(){return this.dialog?.open??!1}get words(){return this.request?.words??im}get node(){return this.isOpen?this.request?.node??null:null}open(t){let e=(this.host.ownerDocument??document).activeElement;if(!this.isOpen&&(e instanceof HTMLElement||e instanceof SVGElement))this.returnFocus=e;this.request=t;let n=this.ensureDialog();if(n.replaceChildren(...this.buildContent(t)),n.setAttribute("aria-label",t.node.text||this.words.text("details")),!n.open)if(typeof n.showModal==="function")n.showModal();else n.setAttribute("open","");(t.section?n.querySelector(`[data-section="${t.section}"]`):null)?.scrollIntoView?.({block:"nearest"}),n.querySelector(".orbit-sheet__close")?.focus()}close(){let t=this.dialog;if(!t||!t.open)return;if(typeof t.close==="function")t.close();else t.removeAttribute("open");this.restoreFocus()}followLink(t){let e=this.request?.onFollowLink;this.close(),e?.(t)}destroy(){this.close(),this.dialog?.remove(),this.dialog=null,this.request=null}restoreFocus(){let t=this.returnFocus;if(this.returnFocus=null,t&&t.isConnected)t.focus({preventScroll:!0})}ensureDialog(){if(this.dialog)return this.dialog;let t=document.createElement("dialog");return t.className="orbit-sheet",t.addEventListener("close",()=>this.restoreFocus()),t.addEventListener("click",(e)=>{if(e.target===t){let n=t.getBoundingClientRect();if(!(e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom)||n.width===0&&n.height===0)this.close()}}),t.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&typeof t.showModal!=="function"){this.close();return}if((e.key==="ArrowLeft"||e.key==="ArrowRight")&&!rm(e.target)){if(this.step(e.key==="ArrowRight"?1:-1))e.preventDefault()}}),this.enableSwipeToClose(t),this.host.appendChild(t),this.dialog=t,t}step(t){let e=this.request;if(!e)return!1;let n=e.siblings.findIndex((r)=>r.id===e.node.id),i=e.siblings[n+t];if(n===-1||!i)return!1;return e.onNavigate?.(i),this.open({...e,node:i,section:void 0}),!0}enableSwipeToClose(t){let e=null;t.addEventListener("pointerdown",(i)=>{if(i.target.closest?.(".orbit-sheet__handle, .orbit-sheet__header")&&i.pointerType!=="mouse")e=i.clientY}),t.addEventListener("pointermove",(i)=>{if(e===null)return;let r=Math.max(0,i.clientY-e);t.style.transform=r>0?`translateY(${r}px)`:""});let n=(i)=>{if(e===null)return;let r=i.clientY-e;if(e=null,t.style.transform="",r>nm)this.close()};t.addEventListener("pointerup",n),t.addEventListener("pointercancel",n)}buildContent(t){let{node:e}=t,n=z("div","orbit-sheet__handle"),i=z("header","orbit-sheet__header"),r=z("div","orbit-sheet__heading");if(t.path.length>0){let f=z("p","orbit-sheet__path");f.textContent=t.path.map((y)=>y.text).join(" › "),r.appendChild(f)}let o=z("h2","orbit-sheet__title");o.textContent=[t.extensions?t.extensions.icon(e):e.icon,e.text].filter(Boolean).join(" "),r.appendChild(o);let s=this.buildChips(e,t.extensions);if(s)r.appendChild(s);let a=z("button","orbit-button orbit-button--icon orbit-sheet__close");a.type="button",a.setAttribute("aria-label",this.words.text("close")),a.appendChild(it("close")),a.addEventListener("click",()=>this.close()),i.append(r,a);let l=z("div","orbit-sheet__body");for(let f of this.buildMedia(t))l.appendChild(f);let d=t.extensions?.details(e);if(d){let f=z("section","orbit-sheet__details");f.dataset.section="details",d(f),l.appendChild(f)}if(e.note){let f=z("div","orbit-sheet__note");f.dataset.section="note";let y=e.noteFormat??"markdown";if(t.noteRenderer)f.innerHTML=t.noteRenderer(e.note,{node:e,format:y});else if(y==="plain"){let x=z("p","");x.style.whiteSpace="pre-wrap",x.textContent=e.note,f.appendChild(x)}else f.appendChild(fi(e.note,{baseUrl:t.baseUrl,resolveLink:t.resolveLink}));f.addEventListener("click",(x)=>{let O=x.target instanceof Element?x.target.closest('a[href^="#"]'):null,M=O?t.resolveLink?.(O.getAttribute("href")??""):null;if(M)x.preventDefault(),this.followLink(M)}),l.appendChild(f)}let c=z("footer","orbit-sheet__footer"),u=z("div",""),h=t.siblings.findIndex((f)=>f.id===e.id);if(t.siblings.length>1&&h!==-1)u.append(this.stepButton("previous",this.words.text("previous"),h>0,-1),this.stepButton("next",this.words.text("next"),h<t.siblings.length-1,1));c.appendChild(u);let m=t.extensions?.actions(e)??[];if(m.length>0){let f=z("div","orbit-sheet__actions");for(let y of m){let x=z("button","orbit-sheet__action");x.type="button",x.dataset.action=y.id,x.append(mi(y.icon,y.label),document.createTextNode(y.label)),x.addEventListener("click",(O)=>{let M=t.extensions?.runAction;this.close(),M?.(e,y.id,O)}),f.appendChild(x)}c.appendChild(f)}let p=lt(e.link)?t.resolveLink?.(e.link)??null:null,b=e.link&&!lt(e.link)?V(e.link,"link"):null;if(p){let f=z("button","orbit-sheet__link");f.type="button",f.textContent=`${this.words.text("goTo",{name:p.text||this.words.text("theIdea")})} →`,f.addEventListener("click",()=>this.followLink(p)),c.appendChild(f)}else if(b){let f=z("a","orbit-sheet__link");f.href=G(b,t.baseUrl),f.target="_blank",f.rel="noopener noreferrer",f.textContent=`${this.words.text("openLink")} ↗`,c.appendChild(f)}let g=[n,i,l];if(u.childElementCount>0||b||p||m.length>0)g.push(c);return g}stepButton(t,e,n,i){let r=z("button","orbit-button orbit-button--icon");return r.type="button",r.setAttribute("aria-label",e),r.disabled=!n,r.appendChild(it(t)),r.addEventListener("click",()=>this.step(i)),r}buildChips(t,e){let n=[],i=e?.typeLabel(t);if(i){let o=z("span","orbit-sheet__chip orbit-sheet__chip--type");o.textContent=i,n.push(o)}if(t.status){let o=z("span","orbit-sheet__chip orbit-sheet__chip--status");o.textContent=t.status;let s=e?.status(t.status)??{tone:qe(t.status)};o.style.setProperty("--orbit-chip-dot",s.color??`var(--_orbit-status-${s.tone})`),n.push(o)}if(t.priority!==void 0){let o=z("span","orbit-sheet__chip");o.textContent=this.words.text("priority",{priority:t.priority}),n.push(o)}for(let o of t.tags??[]){let s=z("span","orbit-sheet__chip");s.textContent=`#${o}`,n.push(s)}if(n.length===0)return null;let r=z("div","orbit-sheet__chips");return r.append(...n),r}buildMedia(t){let{node:e,baseUrl:n,onViewMedia:i}=t,r=[];if(P(e.image)){let o=V(e.image.src,"image");if(o){let s=this.figure("image",e.image.caption),a=document.createElement("img");if(a.src=G(o,n),a.alt=e.image.alt??"",i){let l=z("button","orbit-sheet__picture");l.type="button",l.setAttribute("aria-label",a.alt?this.words.text("viewImageOf",{description:a.alt}):this.words.text("viewImage")),l.appendChild(a),l.addEventListener("click",(d)=>i(e,"image",d)),s.prepend(l)}else s.prepend(a);r.push(s)}}if(P(e.video)){let o=V(e.video.src,"video");if(o){let s=G(o,n),a=null;if(e.video.provider==="native"||bn(s)||/^blob:/i.test(s)){let l=document.createElement("video");l.src=s,l.controls=!0,l.preload="metadata",a=l}else{let l=fn(s,e.video.provider);if(a=l?Ye(l,e.text):Ke(s,n,e.text),a)a.loading="lazy"}if(a){let l=this.figure("video",e.video.caption);if(l.prepend(a),i)l.appendChild(this.expandButton(l,(d,c)=>i(e,"video",d,c)));r.push(l)}}}if(P(e.embed)&&!P(e.video)){let o=Ke(e.embed.src,n,e.text);if(o){o.loading="lazy";let s=this.figure("embed",e.embed.caption);s.prepend(o),r.push(s)}}return r}expandButton(t,e){let n=z("button","orbit-sheet__expand");return n.type="button",n.setAttribute("aria-label",this.words.text("expandVideo")),n.append(it("expand"),document.createTextNode(this.words.text("expand"))),n.addEventListener("click",(i)=>{let r,o=t.querySelector("video");if(o)r=o.currentTime>0?o.currentTime:void 0,o.pause();let s=t.querySelector("iframe");s?.replaceWith(s.cloneNode(!0)),e(i,r)}),n}figure(t,e){let n=z("figure","orbit-sheet__media");if(n.dataset.section=t,e){let i=z("figcaption","");i.textContent=e,n.appendChild(i)}return n}}var qe=(t)=>{let e=t.trim().toLowerCase();if(/^(done|complete|completed|shipped|finished|closed)$/.test(e))return"done";if(/^(active|doing|in[ -]?progress|wip|started|ongoing)$/.test(e))return"active";if(/^(blocked|stuck|at[ -]?risk|failed)$/.test(e))return"blocked";if(/^(todo|to[ -]?do|planned|backlog|next|open)$/.test(e))return"todo";return"neutral"},z=(t,e)=>{let n=document.createElement(t);if(e)n.className=e;return n},rm=(t)=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT|IFRAME|VIDEO)$/.test(t.tagName));var ql=(t,e,n,i,r)=>{let o=[],s=[];return Zl(t).reverse().forEach((a,l)=>{let d=`${i}-surface-${l}`,c=om(a,e,n,d,r)??sm(a,d,r)??am(a,d);if(c)o.push(c),s.push(`<rect width="${e}" height="${n}" fill="url(#${d})"/>`)}),{definitions:o,layers:s}},Zl=(t)=>{let e=[],n=0,i="",r=0;for(let o=0;o<t.length;o+=1){let s=t[o];if(i)i=s===i?"":i;else if(s==='"'||s==="'")i=s;else if(s==="(")n+=1;else if(s===")")n-=1;else if(s===","&&n===0)e.push(t.slice(r,o).trim()),r=o+1}return e.push(t.slice(r).trim()),e.filter((o)=>o!==""&&o!=="none")},Xl=(t,e)=>{if(t.indexOf(`${e}(`)!==0)return null;let i=0;for(let r=e.length;r<t.length;r+=1)if(t[r]==="(")i+=1;else if(t[r]===")"){if(i-=1,i===0)return Zl(t.slice(e.length+1,r))}return null},om=(t,e,n,i,r)=>{let o=Xl(t,"radial-gradient");if(!o||o.length<3)return null;let s=/^(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%\s+at\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%$/.exec(o[0]);if(!s)return null;let[a,l,d,c]=s.slice(1).map(Number),u=o.slice(1).map((y,x,O)=>{let M=/^(.*?)(?:\s+(\d+(?:\.\d+)?)%)?$/.exec(y),w=M[2]!==void 0?Number(M[2])/100:x/(O.length-1);return{color:M[1].trim(),offset:w}}),h=u.find((y)=>y.color!=="transparent")?.color??"transparent",m=d/100*e,p=c/100*n,b=a/100*e,g=l/100*n;if(b<=0||g<=0)return null;let f=u.map((y)=>{let{color:x,opacity:O}=y.color==="transparent"?{color:pe(r(h)).color,opacity:0}:pe(r(y.color));return`<stop offset="${mt(y.offset)}" stop-color="${Oo(x)}" stop-opacity="${mt(O)}"/>`});return`<radialGradient id="${i}" gradientUnits="userSpaceOnUse" cx="${mt(m)}" cy="${mt(p)}" r="${mt(b)}" gradientTransform="translate(${mt(m)} ${mt(p)}) scale(1 ${mt(g/b)}) translate(${mt(-m)} ${mt(-p)})">${f.join("")}</radialGradient>`},sm=(t,e,n)=>{let i=Xl(t,"linear-gradient"),r=/\)\s*0\s+0\s*\/\s*(\d+(?:\.\d+)?)px\s+(\d+(?:\.\d+)?)px\s*$/.exec(t);if(!i||!r)return null;let o=i[0]==="90deg",s=o?i.slice(1):i,a=/^(.*?)\s+(\d+(?:\.\d+)?)px$/.exec(s[0]??"");if(!a||s.length!==2||!/^transparent\s/.test(s[1]))return null;let[l,d]=[Number(r[1]),Number(r[2])],c=Number(a[2]),{color:u,opacity:h}=pe(n(a[1].trim())),m=o?`width="${c}" height="${d}"`:`width="${l}" height="${c}"`;return`<pattern id="${e}" patternUnits="userSpaceOnUse" width="${l}" height="${d}"><rect ${m} fill="${Oo(u)}" fill-opacity="${mt(h)}"/></pattern>`},am=(t,e)=>{let n=/^url\((["']?)(data:image\/.+?)\1\)\s*0\s+0\s*\/\s*(\d+(?:\.\d+)?)px\s+(\d+(?:\.\d+)?)px$/s.exec(t);if(!n)return null;let[i,r,o]=[n[2],n[3],n[4]];return`<pattern id="${e}" patternUnits="userSpaceOnUse" width="${r}" height="${o}"><image href="${Oo(i)}" width="${r}" height="${o}"/></pattern>`},mt=(t)=>Math.round(t*1000)/1000,Oo=(t)=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");var Jl={moon:0,node:1,planet:1,sun:2},lm={sun:16,planet:13,node:12,moon:13},dm={sun:3,planet:2,node:2,moon:2};class So{tokens;constructor(t){this.tokens=t}value(t,e=""){return this.tokens[t]??e}color(t){return Ot(t,this.tokens)}token(t,e="#000000"){return this.color(this.value(t,e))}number(t,e){let n=Number.parseFloat(this.value(t));return Number.isFinite(n)?n:e}tinted(t,e,n){let i=ht(this.color(t)),r=ht(this.token(e)),o=this.number(n,0)/100;if(!i||!r)return this.token(e);return Ge(wo(i,r,Math.min(1,Math.max(0,o))))}}var X=(t,e,n=1)=>{let{color:i,opacity:r}=pe(e),o=bt(i),s=N(r*n),a=t==="stop"?"stop-color":t,l=t==="stop"?"stop-opacity":`${t}-opacity`;return s<1||t==="stop"?`${a}="${o}" ${l}="${s}"`:`${a}="${o}"`},Mo=(t)=>t.trim()===""||t.trim()==="none"?"":` stroke-dasharray="${bt(t.trim())}"`,Ql=(t,e)=>{let{viewport:n}=e,i=new So(e.tokens),r=Math.round(n.width),o=Math.round(n.height),s=bt(e.idPrefix??"orbit-export"),a=e.words?.text("untitled")??"Untitled",d=[`<svg xmlns="http://www.w3.org/2000/svg" ${e.responsive?'width="100%" height="100%" preserveAspectRatio="xMidYMid meet"':`width="${r}" height="${o}"`} viewBox="0 0 ${r} ${o}" role="img" aria-label="${bt(e.title)}">`,`<title>${bt(e.title)}</title>`],c=[cm(`${s}-shade`,i)],u=[],h=i.token("surface","transparent"),m=ht(h);if(m&&m.alpha>0)u.push(`<rect width="${r}" height="${o}" ${X("fill",h)}/>`);let p=ql(i.value("surface-pattern","none"),r,o,s,(b)=>i.color(b));if(c.push(...p.definitions),u.push(...p.layers),t){let{camera:b}=t,g=(S)=>J(b,n,S);if(e.showRings){let S=i.number("ring-opacity",0.5),j=i.number("ring-width",1.5),I=Mo(i.value("ring-dash","none"));for(let F of t.rings){if(F.opacity<=0.01)continue;let C=g({x:F.cx,y:F.cy}),Z=je(F.radius*b.scale,F.gaps),q=i.tinted(F.color,"ring-stroke","ring-tint");u.push(`<path d="${Z}" transform="translate(${N(C.x)} ${N(C.y)}) rotate(${N(F.rotation)})" fill="none" ${X("stroke",q,S)} stroke-width="${j}"${I} stroke-linecap="round"/>`)}}let f=i.number("link-opacity",0.5),y=i.number("link-width",1.5),x=Mo(i.value("link-dash","none"));for(let S of t.links){let j=t.nodes.get(S.fromId),I=t.nodes.get(S.toId);if(!j||!I)continue;let F=g(j),C=g(I),Z=Math.hypot(C.x-F.x,C.y-F.y),q=j.radius*b.scale,H=I.radius*b.scale;if(Z<=q+H)continue;let A=(C.x-F.x)/Z,B=(C.y-F.y)/Z,st=i.tinted(S.color,"link-stroke","link-tint");u.push(`<line x1="${N(F.x+A*q)}" y1="${N(F.y+B*q)}" x2="${N(C.x-A*H)}" y2="${N(C.y-B*H)}" ${X("stroke",st,f)} stroke-width="${y}"${x} stroke-linecap="round"/>`)}let O=Array.from(t.nodes.values()).filter((S)=>S.opacity>0.01&&S.radius>0).sort((S,j)=>Jl[S.role]-Jl[j.role]),M=new Map,w=new Set,v=new Map,E=(S)=>{let j=e.extensions?.nodeType(S.node)?.tokens,I=e.extensions?.typeName(S.node)??S.node.type;if(!j||!I)return i;let F=I.toLowerCase(),C=v.get(F);if(!C){let Z=Object.fromEntries(Object.entries(j).filter((q)=>typeof q[1]==="string"&&q[1]!==""));C=new So({...e.tokens,...Z}),v.set(F,C)}return C},k=(S)=>S.role!=="node"&&!ao(S,S.radius*b.scale)&&E(S).number(S.role==="sun"?"sun-shadow-opacity":"node-shadow-opacity",0)>0;if(O.some(k))for(let[S,j]of[[`${s}-shadow`,Ue.planet],[`${s}-sun-shadow`,Ue.sun]])c.push(`<filter id="${S}" x="-60%" y="-60%" width="220%" height="220%"><feGaussianBlur stdDeviation="${j}"/></filter>`);O.forEach((S,j)=>{let I=E(S),F=g(S),C=S.radius*b.scale,Z=e.fills?.(S),q=Z?I.color(Z):I.color(S.color);M.set(S.id,q);let H=S.role==="sun",A=I.number("node-fill-opacity",1),B=I.number("node-stroke-width",1.5);if(k(S)){let tn=I.tinted(q,"node-shadow","node-shadow-tint"),Wd=I.number(H?"sun-shadow-opacity":"node-shadow-opacity",0),Gd=C*I.number(H?"sun-shadow-size":"node-shadow-size",1),Kd=C*I.number("node-shadow-offset",0);u.push(`<circle r="1" transform="translate(${N(F.x)} ${N(F.y+Kd)}) scale(${N(Gd,3)})" ${X("fill",tn,Wd)} filter="url(#${s}-${H?"sun-shadow":"shadow"})"/>`)}if(H)u.push(...um(F,C,q,I));let st=`cx="${N(F.x)}" cy="${N(F.y)}" r="${N(C)}"`;u.push(`<circle ${st} ${X("fill",q,S.role==="moon"?I.number("moon-opacity",A):A)}/>`);let Et=co(S.node),Qe=Et?V(Et,"image"):null;if(Qe){w.add(S.id);let tn=`${s}-clip-${j}`;c.push(`<clipPath id="${tn}"><circle ${st}/></clipPath>`),u.push(`<image href="${bt(G(Qe,e.baseUrl))}" x="${N(F.x-C)}" y="${N(F.y-C)}" width="${N(C*2)}" height="${N(C*2)}" preserveAspectRatio="xMidYMid slice" clip-path="url(#${tn})"/>`)}let Ud=I.tinted(q,"node-stroke","node-stroke-tint"),jd=S.crowded?B*0.04*C:S.role==="moon"?B*0.7:B;u.push(`<circle ${st} fill="url(#${s}-shade)" ${X("stroke",Ud)} stroke-width="${N(jd)}"/>`),u.push(...hm(S,F,C,I,e.extensions))});let _=(S)=>e.extensions?e.extensions.icon(S.node):S.node.icon,D=e.measures??ze,Y=ui(t,ci(O),{viewport:n,hasImage:(S)=>w.has(S.id),hasIcon:(S)=>Boolean(_(S)),pillIcon:(S)=>w.has(S.id)?_(S):void 0,measures:D});for(let S of Y)u.push(...pm(S,M.get(S.entry.id)??"#ffffff",E(S.entry),_(S.entry),D,a))}return d.push(`<defs>${c.join("")}</defs>`,...u,"</svg>"),d.join("")},cm=(t,e)=>{let n=e.token("node-highlight","rgba(255, 255, 255, 0.5)"),i=e.token("node-terminator","rgba(0, 0, 0, 0)"),r=e.token("node-shading","rgba(0, 0, 0, 0.12)"),o=ro.map(({offset:a,part:l})=>{switch(l){case"highlight":return`<stop offset="${a}" ${X("stop",n)}/>`;case"highlight-fade":return`<stop offset="${a}" ${X("stop",n,0.2)}/>`;case"terminator-start":return`<stop offset="${a}" ${X("stop",i,0)}/>`;case"terminator":return`<stop offset="${a}" ${X("stop",i)}/>`;default:return`<stop offset="${a}" ${X("stop",r)}/>`}}),s=Zn(e.value("node-shade-circle",""));return`<radialGradient id="${t}" cx="${s.x}" cy="${s.y}" r="${s.radius}">${o.join("")}</radialGradient>`},um=(t,e,n,i)=>{let r=i.number("sun-halo-opacity",0),o=i.number("sun-halo-width",0);if(r<=0||o<=0)return[];let s=i.tinted(n,"sun-halo","sun-halo-tint"),a=Mo(i.value("sun-halo-dash","none"));return[`<circle cx="${N(t.x)}" cy="${N(t.y)}" r="${N(e*i.number("sun-halo-size",1.15))}" fill="none" ${X("stroke",s,r)} stroke-width="${o}"${a}/>`]},hm=(t,e,n,i,r)=>{let o=[],s=X("stroke",i.token("badge-stroke","#ffffff")),a=t.role==="sun";if(t.node.status&&n>6){let l=(a?0.68:0.72)*n,d=r?.status(t.node.status)??{tone:qe(t.node.status)},c=d.color??i.token(`status-${d.tone}`,"#94a3b8");o.push(`<circle cx="${N(e.x+l)}" cy="${N(e.y-l)}" r="${N((a?0.11:0.17)*n)}" ${X("fill",c)} ${s} stroke-width="${N((a?0.025:0.04)*n)}"/>`)}if(a||n<=8)return o;if(P(t.node.video)){let l=e.x+0.62*n,d=e.y+0.62*n,c=0.3*n;o.push(`<circle cx="${N(l)}" cy="${N(d)}" r="${N(c)}" fill="#0f172a" fill-opacity="0.62"/>`),o.push(`<path d="M${N(l-0.32*c)} ${N(d-0.48*c)} L${N(l+0.52*c)} ${N(d)} L${N(l-0.32*c)} ${N(d+0.48*c)} Z" fill="#ffffff"/>`)}else if(t.node.note||P(t.node.image)||P(t.node.embed)||t.node.link||r?.nodeType(t.node)?.details)o.push(`<circle cx="${N(e.x+0.72*n)}" cy="${N(e.y+0.72*n)}" r="${N(0.13*n)}" ${X("fill",i.token("note-indicator","#1b2333"))} ${s} stroke-width="${N(0.04*n)}"/>`);return o},pm=(t,e,n,i,r,o)=>{let{entry:s,x:a,y:l,screenRadius:d}=t,c=s.node.text||o,u=s.role==="sun",h=bt(n.value(u?"display-font":"label-font",n.value("font-family","sans-serif"))),m=bt(n.value(u?"display-weight":"label-weight",u?"650":"600")),p=n.value("label-letter-spacing","0").trim(),b=p==="0"||p===""||p==="normal"?"":` letter-spacing="${bt(p)}"`,g=t.opacity>=0.999?"":` opacity="${N(t.opacity)}"`,f=t.placement==="inside"?de(s.role,d,c,Boolean(i),r.inside(s.role,s.node)):null;if(t.placement==="outside"){let S=t.lines,j=r.pill(s.role,s.node),I=t.text||o,F=di(I,{x:a,y:l},d,t.direction,u?280:160,t.offset,S,j),C=F.right-F.left,Z=Gr(I,C-12,11.5,S,j).lines,q=(F.top+F.bottom)/2,H=S===1?20:34,A=14,B=q-(Z.length-1)*14/2+4.14,st=Z.map((Et,Qe)=>`<tspan x="${N((F.left+F.right)/2)}" y="${N(B+Qe*14)}">${bt(Et)}</tspan>`).join("");return[`<g${g}>`,`<rect x="${N(F.left)}" y="${N(q-H/2)}" width="${N(C)}" height="${H}" rx="10" ${X("fill",n.token("control-background","#ffffff"))}/>`,`<text text-anchor="middle" font-family="${h}" font-size="11.5" font-weight="${m}"${b} ${X("fill",n.token("control-text","#1b2333"))}>${st}</text>`,"</g>"]}let y=f?.fontSize??lm[s.role],x=f?.lines??Gr(c,d*1.68,y,dm[s.role],r.inside(s.role,s.node)).lines,O=i&&(f?.icon??!0)?[i,...x]:x,M=y*1.22,w=n.token("node-text-inverse","#ffffff"),v=n.token(u?"root-text":"node-text","#1b2333"),E=pi(e,w,v)?w:v,k=l-(O.length-1)*M/2+y*0.35,_=O.map((Y,S)=>`<tspan x="${N(a)}" y="${N(k+S*M)}">${bt(Y)}</tspan>`).join(""),D=f?.stretch?` font-stretch="${f.stretch}%"`:"";return[`<text text-anchor="middle" font-family="${h}" font-size="${y}" font-weight="${m}"${D}${b} ${X("fill",E)}${g}>${_}</text>`]},bt=(t)=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),N=(t,e=2)=>{let n=10**e;return Math.round(t*n)/n};var mm=4,td=12,bm={width:40,height:108},fm={width:48,height:132};class Eo{element;callbacks;back;backLabel;breadcrumbs;breadcrumbPanel;viewGroup;focusButton;overviewButton;outlineButton;zoomPanel;zoomInButton;fitButton;zoomOutButton;hint;hintTimer=null;parentId=null;words;state=null;constructor(t,e){this.callbacks=t,this.words=e,this.element=rt("div","orbit-controls");let n=rt("div","orbit-controls__top"),i=rt("div","orbit-controls__start");this.back=No("orbit-button orbit-panel orbit-back","back"),this.backLabel=rt("span",""),this.back.appendChild(this.backLabel),this.back.addEventListener("click",()=>{if(this.parentId)this.callbacks.onNavigate(this.parentId)}),this.breadcrumbPanel=rt("div","orbit-panel orbit-controls__crumbs"),this.breadcrumbs=rt("nav","orbit-breadcrumbs"),this.breadcrumbPanel.appendChild(this.breadcrumbs),i.append(this.back,this.breadcrumbPanel),this.viewGroup=rt("div","orbit-panel"),this.viewGroup.setAttribute("role","group"),this.focusButton=ed("focus"),this.focusButton.addEventListener("click",()=>this.callbacks.onViewMode("focus")),this.overviewButton=ed("overview"),this.overviewButton.addEventListener("click",()=>this.callbacks.onViewMode("all")),this.outlineButton=gi("list",()=>this.callbacks.onToggleOutline()),this.viewGroup.append(this.focusButton,this.overviewButton,this.outlineButton),n.append(i,this.viewGroup);let r=rt("div","orbit-controls__zoom");this.zoomPanel=rt("div","orbit-panel orbit-panel--vertical"),this.zoomPanel.setAttribute("role","group"),this.zoomInButton=gi("zoom-in",()=>this.callbacks.onZoom(1)),this.fitButton=gi("fit",()=>this.callbacks.onFit()),this.zoomOutButton=gi("zoom-out",()=>this.callbacks.onZoom(-1)),this.zoomPanel.append(this.zoomInButton,this.fitButton,this.zoomOutButton),r.appendChild(this.zoomPanel),this.hint=rt("div","orbit-hint"),this.hint.setAttribute("role","status"),this.element.append(n,r,this.hint),this.relabel(e)}relabel(t){if(this.words=t,this.breadcrumbs.setAttribute("aria-label",t.text("mapPath")),this.viewGroup.setAttribute("aria-label",t.text("view")),me(this.focusButton,t.text("focus")),me(this.overviewButton,t.text("overview")),me(this.outlineButton,t.text("showOutline")),this.zoomPanel.setAttribute("aria-label",t.text("zoom")),me(this.zoomInButton,t.text("zoomIn")),me(this.fitButton,t.text("fitMap")),me(this.zoomOutButton,t.text("zoomOut")),this.state)this.update(this.state)}update(t){this.state=t,this.focusButton.setAttribute("aria-pressed",String(t.viewMode==="focus")),this.overviewButton.setAttribute("aria-pressed",String(t.viewMode==="all")),this.outlineButton.setAttribute("aria-pressed",String(t.outlineOpen));let e=t.viewMode==="focus"&&t.path.length>1,n=e?t.path[t.path.length-2]:null;this.parentId=n?.id??null,this.back.hidden=!n,this.backLabel.textContent=n?n.text||this.words.text("back"):"",this.back.setAttribute("aria-label",n?.text?this.words.text("backTo",{name:n.text}):n?this.words.text("backToParent"):this.words.text("back")),this.breadcrumbPanel.hidden=!e,this.breadcrumbs.replaceChildren(...e?this.crumbs(t.path):[])}zoomBox(t,e){if(this.element.hidden)return null;let n=en(this.element)?fm:bm,i=t-td,r=e-td;return{left:i-n.width,top:r-n.height,right:i,bottom:r}}showHint(t,e=1800){if(this.hint.textContent=t,this.hint.classList.add("orbit-hint--visible"),this.hintTimer)clearTimeout(this.hintTimer);this.hintTimer=setTimeout(()=>{this.hint.classList.remove("orbit-hint--visible"),this.hintTimer=null},e)}destroy(){if(this.hintTimer)clearTimeout(this.hintTimer);this.element.remove()}crumbs(t){let e=t.length>mm?[0,-1,t.length-2,t.length-1]:t.map((i,r)=>r),n=[];return e.forEach((i,r)=>{if(r>0){let d=it("chevron");d.classList.add("orbit-breadcrumbs__separator"),n.push(d)}if(i===-1){let d=rt("span","orbit-button orbit-breadcrumbs__item");d.textContent="…",d.title=t.slice(1,t.length-2).map((c)=>c.text).join(" › "),n.push(d);return}let o=t[i],s=i===t.length-1,a=rt("button","orbit-button orbit-breadcrumbs__item");if(a.type="button",i===0)a.appendChild(it("home"));let l=rt("span","");if(l.textContent=o.text||this.words.text("untitled"),a.appendChild(l),a.title=o.text,s)a.setAttribute("aria-current","location"),a.disabled=!0;else a.addEventListener("click",()=>this.callbacks.onNavigate(o.id));n.push(a)}),n}}var rt=(t,e)=>{let n=document.createElement(t);if(e)n.className=e;return n},No=(t,e)=>{let n=rt("button",t);return n.type="button",n.appendChild(it(e)),n},ed=(t)=>{let e=No("orbit-button",t);return e.appendChild(rt("span","orbit-segmented__label")),e},gi=(t,e)=>{let n=No("orbit-button orbit-button--icon",t);return n.addEventListener("click",e),n},me=(t,e)=>{t.setAttribute("aria-label",e),t.title=e;let n=t.querySelector(".orbit-segmented__label");if(n)n.textContent=e};class To{element;live;onSelect;visible=!1;icon=(t)=>t.icon;entries=new Map;currentId=null;words;constructor(t,e){this.onSelect=t,this.words=e,this.element=document.createElement("nav"),this.element.className="orbit-outline orbit-visually-hidden",this.live=document.createElement("div"),this.live.className="orbit__live",this.live.setAttribute("aria-live","polite"),this.live.setAttribute("role","status"),this.relabel(e)}relabel(t){this.words=t,this.element.setAttribute("aria-label",t.text("outline"))}get isVisible(){return this.visible}update(t,e,n,i,r=(o)=>o.icon){this.icon=r,this.entries.clear(),this.currentId=null;let o=document.createElement("ul");o.appendChild(this.item(t,n,i)),this.element.replaceChildren(o),this.setCurrent(e)}setCurrent(t){if(t===this.currentId)return;if(this.currentId!==null)this.entries.get(this.currentId)?.removeAttribute("aria-current");if(this.currentId=t,t!==null)this.entries.get(t)?.setAttribute("aria-current","true")}setVisible(t){this.visible=t,this.element.classList.toggle("orbit-visually-hidden",!t),this.element.classList.toggle("orbit-outline--visible",t);for(let e of this.element.querySelectorAll("button"))e.tabIndex=t?0:-1;if(t)this.element.querySelector('[aria-current="true"]')?.focus()}announce(t){this.live.textContent="",setTimeout(()=>{this.live.textContent=t},30)}item(t,e,n){let i=document.createElement("li"),r=document.createElement(n?"button":"span");if(r.textContent=[this.icon(t),t.text||this.words.text("untitled")].filter(Boolean).join(" "),t.status)r.textContent+=` (${t.status})`;if(!this.entries.has(t.id))this.entries.set(t.id,r);if(r instanceof HTMLButtonElement)r.type="button",r.tabIndex=this.visible?0:-1,r.addEventListener("click",()=>this.onSelect(t.id));if(i.appendChild(r),(e===void 0||t.level<e)&&t.children.length>0){let s=document.createElement("ul");for(let a of t.children)s.appendChild(this.item(a,e,n));i.appendChild(s)}return i}}class Fo{element;title;detail;constructor(){this.element=document.createElement("div"),this.element.className="orbit-tooltip",this.element.setAttribute("role","tooltip"),this.element.setAttribute("aria-hidden","true"),this.title=document.createElement("span"),this.title.className="orbit-tooltip__title",this.detail=document.createElement("span"),this.detail.className="orbit-tooltip__detail",this.element.append(this.title,this.detail)}get isVisible(){return this.element.classList.contains("orbit-tooltip--visible")}show(t,e,n,i){this.title.textContent=t,this.detail.textContent=e,this.detail.hidden=e==="",this.place(n,i),this.element.classList.add("orbit-tooltip--visible")}place(t,e){this.element.style.transform=jt(Math.round(t),Math.round(e),"-50%, calc(-100% - 10px)")}hide(){this.element.classList.remove("orbit-tooltip--visible")}}var yi=1.7777777777777777,gm=0.5625,ym=250,vm=250,xm=40,wm=0,km=1,Om=3,Sm=["play","playing","pause","ended","timeupdate","seeked","volumechange"],id=(t,e)=>{let n=V(t.src,"video");if(!n)return null;let i=G(n,e.baseUrl),r=t.provider==="youtube"||t.provider==="vimeo"||t.provider==="native"?t.provider:Q(i);if(r==="native"||bn(i)||/^blob:/i.test(i))return new od(i,e);let o=r==="youtube"||r==="vimeo"?fn(i,r):null;if(o&&r==="youtube"){let a=Ye(Mm(o,e),e.title);return a?new Ao(a,e,Qi(i)?gm:yi):null}if(o&&r==="vimeo"){let a=Ye(Em(o,e),e.title);return a?new sd(a,e):null}let s=Ke(i,e.baseUrl,e.title);return s?new ad(s):null},Mm=(t,e)=>{let n=new URL(t);if(n.searchParams.set("enablejsapi","1"),n.searchParams.set("autoplay",e.autoplay?"1":"0"),n.searchParams.set("playsinline","1"),n.searchParams.set("rel","0"),!e.controls)n.searchParams.set("controls","0");let i=rd(e.startAt);if(i>0)n.searchParams.set("start",String(i));let r=Nm();if(r)n.searchParams.set("origin",r);return n.href},Em=(t,e)=>{let n=new URL(t);if(n.searchParams.set("autoplay",e.autoplay?"1":"0"),n.searchParams.set("playsinline","1"),n.searchParams.set("dnt","1"),!e.controls)n.searchParams.set("controls","0");let i=rd(e.startAt);if(i>0)n.hash=`t=${i}s`;return n.href},rd=(t)=>Number.isFinite(t)?Math.max(0,Math.floor(t)):0,Nm=()=>{if(typeof location>"u"||!/^https?:$/.test(location.protocol))return null;return location.origin};class _o{last=null;lastAt=0;listener;constructor(t){this.listener=t}report(t){let e=performance.now(),n=this.last;if(n){let i=n.playing===t.playing&&n.ended===t.ended&&n.muted===t.muted&&n.duration===t.duration,r=n.time+(n.playing?(e-this.lastAt)/1000:0),o=Math.abs(t.time-r)>1;if(i&&!o&&(t.time===n.time||e-this.lastAt<ym))return}this.last={...t},this.lastAt=e,this.listener({...t})}}var nd=["loadedmetadata","durationchange","play","playing","pause","ended","seeked","timeupdate","volumechange","error"];class od{element;controllable=!0;ratio=yi;options;reporter;startAt;constructor(t,e){this.options=e,this.reporter=new _o(e.onState),this.startAt=Number.isFinite(e.startAt)?Math.max(0,e.startAt):0;let n=document.createElement("video");if(this.element=n,n.className="orbit-viewer__video",n.controls=e.controls,n.playsInline=!0,n.setAttribute("playsinline",""),n.preload="metadata",e.autoplay)n.autoplay=!0,n.setAttribute("autoplay","");if(e.poster)n.setAttribute("poster",e.poster);n.setAttribute("aria-label",e.title);for(let i of nd)n.addEventListener(i,this.handleEvent);if(n.src=t,e.autoplay)this.play()}get state(){let t=this.element;return{playing:!t.paused&&!t.ended,time:Number.isFinite(t.currentTime)?t.currentTime:0,duration:Number.isFinite(t.duration)&&t.duration>0?t.duration:null,ended:t.ended,muted:t.muted}}play(){let t=this.element;t.play()?.catch?.((n)=>{if(n?.name==="NotAllowedError"&&!t.muted)t.muted=!0,t.play()?.catch?.(()=>{return})})}pause(){this.element.pause()}seek(t){if(Number.isFinite(t))this.element.currentTime=Math.max(0,t)}unmute(){let t=this.element;if(t.muted=!1,t.volume===0)t.volume=1}setControls(t){this.element.controls=t}destroy(){let t=this.element;for(let e of nd)t.removeEventListener(e,this.handleEvent);t.pause(),t.removeAttribute("src");try{t.load()}catch{}}handleEvent=(t)=>{let e=this.element;if(t.type==="error"){this.options.onError();return}if(t.type==="loadedmetadata"){if(e.videoWidth>0&&e.videoHeight>0)this.ratio=e.videoWidth/e.videoHeight,this.options.onRatio(this.ratio);if(this.startAt>0)e.currentTime=this.startAt,this.startAt=0}this.reporter.report(this.state)}}class Co{element;controllable=!0;ratio;options;reporter;current={playing:!1,time:0,duration:null,ended:!1,muted:!1};origin;ready=!1;queue=[];autoplayed=!1;owner;constructor(t,e,n){this.element=t,this.options=e,this.ratio=n,this.reporter=new _o(e.onState),this.origin=new URL(t.src).origin,this.owner=t.ownerDocument.defaultView??(typeof window>"u"?null:window),this.owner?.addEventListener("message",this.handleMessage),t.addEventListener("load",this.handleLoad)}get state(){return{...this.current}}setControls(){}destroy(){this.owner?.removeEventListener("message",this.handleMessage),this.element.removeEventListener("load",this.handleLoad),this.queue=[]}send(t){if(this.ready)this.post(t);else this.queue.push(t)}post(t){this.element.contentWindow?.postMessage(t,this.origin)}becomeReady(){if(this.ready)return;if(this.ready=!0,this.options.autoplay&&!this.autoplayed)this.autoplayed=!0,this.post(this.playMessage());let t=this.queue;this.queue=[];for(let e of t)this.post(e)}report(){this.reporter.report(this.current)}handleLoad=()=>{this.loaded()};handleMessage=(t)=>{if(t.source!==this.element.contentWindow||t.origin!==this.origin)return;let e=Tm(t.data);if(e)this.received(e)}}class Ao extends Co{static channels=0;channel=++Ao.channels;listening=null;play(){this.command("playVideo")}pause(){this.command("pauseVideo")}seek(t){if(Number.isFinite(t))this.command("seekTo",[Math.max(0,t),!0])}unmute(){this.command("unMute")}destroy(){this.stopListening(),super.destroy()}playMessage(){return this.message("playVideo")}loaded(){if(this.stopListening(),this.ready)return;let t=0,e=()=>this.post(JSON.stringify({event:"listening",id:this.channel,channel:"widget"}));e(),this.listening=setInterval(()=>{if(t+=1,t>=xm||this.ready){this.stopListening();return}e()},vm)}received(t){switch(t.event){case"initialDelivery":case"onReady":case"infoDelivery":this.stopListening(),this.becomeReady(),this.apply(t.info);break;case"onStateChange":if(typeof t.info==="number")this.apply({playerState:t.info});break}}apply(t){if(!t||typeof t!=="object")return;let e=t,n=this.current;if(typeof e.currentTime==="number"&&Number.isFinite(e.currentTime))n.time=e.currentTime;if(typeof e.duration==="number"&&e.duration>0)n.duration=e.duration;if(typeof e.muted==="boolean")n.muted=e.muted;if(typeof e.playerState==="number"&&e.playerState!==Om)n.playing=e.playerState===km,n.ended=e.playerState===wm;this.report()}command(t,e=[]){this.send(this.message(t,e))}message(t,e=[]){return JSON.stringify({event:"command",func:t,args:e,id:this.channel,channel:"widget"})}stopListening(){if(this.listening!==null)clearInterval(this.listening),this.listening=null}}class sd extends Co{width=0;height=0;constructor(t,e){super(t,e,yi)}play(){this.send({method:"play"})}pause(){this.send({method:"pause"})}seek(t){if(Number.isFinite(t))this.send({method:"setCurrentTime",value:Math.max(0,t)})}unmute(){this.send({method:"setMuted",value:!1})}playMessage(){return{method:"play"}}loaded(){this.post({method:"ping"})}received(t){if(t.event==="ready"||t.method==="ping"){if(!this.ready){for(let i of Sm)this.post({method:"addEventListener",value:i});for(let i of["getDuration","getVideoWidth","getVideoHeight","getPaused","getMuted"])this.post({method:i})}this.becomeReady();return}let e=this.current,n=t.data&&typeof t.data==="object"?t.data:{};if(typeof n.seconds==="number")e.time=n.seconds;if(typeof n.duration==="number"&&n.duration>0)e.duration=n.duration;switch(t.event){case"play":case"playing":e.playing=!0,e.ended=!1;break;case"pause":e.playing=!1;break;case"ended":e.playing=!1,e.ended=!0;break;case"volumechange":e.muted=n.muted===!0||n.volume===0;break}switch(t.method){case"getDuration":if(typeof t.value==="number"&&t.value>0)e.duration=t.value;break;case"getPaused":if(typeof t.value==="boolean")e.playing=!t.value;break;case"getMuted":if(typeof t.value==="boolean")e.muted=t.value;break;case"getVideoWidth":case"getVideoHeight":if(typeof t.value==="number"&&t.value>0){if(t.method==="getVideoWidth")this.width=t.value;else this.height=t.value;if(this.width>0&&this.height>0)this.ratio=this.width/this.height,this.options.onRatio(this.ratio)}return}this.report()}}class ad{element;ratio=yi;controllable=!1;state={playing:!1,time:0,duration:null,ended:!1,muted:!1};constructor(t){this.element=t}play(){}pause(){}seek(){}unmute(){}setControls(){}destroy(){}}var Tm=(t)=>{let e=t;if(typeof e==="string")try{e=JSON.parse(e)}catch{return null}return e&&typeof e==="object"&&!Array.isArray(e)?e:null};var xi={scale:1,x:0,y:0};var ld=(t,e,n=!1)=>{if(!(t.width>0&&t.height>0&&e.width>0&&e.height>0))return{width:0,height:0};let i=Math.min(e.width/t.width,e.height/t.height);if(!n)i=Math.min(i,2);return{width:t.width*i,height:t.height*i}},dd=(t,e)=>{if(!(e.width>0&&t.width>0))return 1;return Math.max(4,2*t.width/e.width)},Ze=(t,e,n,i)=>{let r=vi(t.scale,1,Math.max(1,i)),o=Math.max(0,(e.width*r-n.width)/2),s=Math.max(0,(e.height*r-n.height)/2);return{scale:r,x:vi(t.x,-o,o)||0,y:vi(t.y,-s,s)||0}},Io=(t,e,n,i,r,o)=>{let s=vi(t.scale*e,1,Math.max(1,o)),a=s/t.scale,l={scale:s,x:n.x-(n.x-t.x)*a,y:n.y-(n.y-t.y)*a};return Ze(l,i,r,o)},cd=(t,e,n,i,r,o)=>Ze({scale:t.scale,x:t.x+e,y:t.y+n},i,r,o),ud=(t,e,n,i,r,o)=>{if(wi(t))return xi;let s=i.width>0?n.width/i.width:1;return Io(t,Math.max(2,s)/t.scale,e,i,r,o)},wi=(t)=>t.scale>1.001,vi=(t,e,n)=>Math.min(n,Math.max(e,t));var hd=16,Fm=72,pd=720,Lo=60,_m=44,ki=1.5,md=0.15,Cm=4,Am=8,Im=60,bd=100,Lm=320,Dm=28,Pm="button, a, video, iframe, input, select, textarea",ge=(t,e)=>{if(e==="image")return P(t.image)&&V(t.image.src,"image")!==null;return P(t.video)&&V(t.video.src,"video")!==null},fd=(t,e)=>{let n=[],i=[t];while(i.length>0){let r=i.pop();if(ge(r,"image"))n.push({node:r,kind:"image"});if(ge(r,"video"))n.push({node:r,kind:"video"});if(e===void 0||r.level<e)for(let o=r.children.length-1;o>=0;o-=1)i.push(r.children[o])}return n};class Oi{static count=0;host;context;id=`orbit-viewer-${(++Oi.count).toString(36)}`;dialog=null;parts=null;shown=!1;items=[];index=0;picture=null;player=null;playerBox=null;returnFocus=null;resizeObserver=null;pointers=new Map;press=null;pinch=null;suppressClick=!1;lastTap=null;settleTimer=null;constructor(t,e){this.host=t,this.context=e}get isOpen(){return this.shown}get item(){return this.shown?this.items[this.index]??null:null}get video(){return this.shown&&this.player?.controllable?this.player:null}open(t,e={}){if(!ge(t.node,t.kind))return!1;let n=this.context.items(),i=n.findIndex((s)=>s.node.id===t.node.id&&s.kind===t.kind);if(i===-1)n=[t],i=0;let r=this.ensureDialog(),o=!this.shown;if(o)this.returnFocus=Do(this.host);if(this.items=n,this.show(i,e),o){if(this.shown=!0,!r.open)try{r.showModal()}catch{r.setAttribute("open","")}this.observeStage(),r.focus({preventScroll:!0})}return this.layout(),this.context.onShow(this.items[this.index],this.index,this.items.length),!0}close(){if(!this.shown)return;let t=this.dialog;if(t.open)if(typeof t.close==="function")t.close();else t.removeAttribute("open");this.finish()}step(t){return this.go(this.index+t)}refresh(){if(!this.shown)return;let t=this.items[this.index],e=this.context.items(),n=e.findIndex((o)=>o.node.id===t.node.id&&o.kind===t.kind);if(n===-1){let o=this.context.node(t.node.id);if(!o||!ge(o,t.kind)){this.close();return}e=[{node:o,kind:t.kind}],n=0}let i=e[n],r=(o)=>o.kind==="image"?o.node.image?.src:o.node.video?.src;if(this.items=e,r(i)!==r(t)){this.show(n,{autoplay:!1}),this.layout();return}this.index=n,this.player?.setControls(this.context.interactive()),this.describe(),this.layout()}play(){let t=this.video;return t?.play(),t!==null}pause(){let t=this.video;return t?.pause(),t!==null}seek(t){let e=this.video;if(!e||!Number.isFinite(t))return!1;return e.seek(t),!0}unmute(){let t=this.video;return t?.unmute(),t!==null}destroy(){this.close(),this.dialog?.remove(),this.dialog=null,this.parts=null}relabel(){let t=this.parts;if(!t)return;let e=this.context.words();if(t.zoomGroup.setAttribute("aria-label",e.text("zoom")),fe(t.zoomOut,e.text("zoomOut")),fe(t.zoomIn,e.text("zoomIn")),fe(t.fit,e.text("fitPicture")),fe(t.close,e.text("close")),fe(t.previous,e.text("previous")),fe(t.next,e.text("next")),this.shown)this.describe()}go(t){if(!this.shown||t<0||t>=this.items.length||t===this.index)return!1;let n=this.parts.layer.contains(Do(this.host));if(this.show(t,{autoplay:!0}),this.layout(),n)this.dialog?.focus({preventScroll:!0});return this.context.onShow(this.items[this.index],this.index,this.items.length),!0}show(t,e){let n=this.parts;this.clearMedia(),this.index=t;let i=this.items[t];if(this.setStatus(null),i.kind==="image")this.showPicture(i.node);else this.showVideo(i.node,e);n.layer.classList.remove("orbit-viewer__media--entering"),n.layer.offsetWidth,n.layer.classList.add("orbit-viewer__media--entering"),this.describe()}showPicture(t){let e=this.parts,n=t.image,i=G(V(n.src,"image"),this.context.baseUrl()),r=document.createElement("img");r.className="orbit-viewer__picture",r.alt=n.alt?.trim()||n.caption?.trim()||t.text||this.context.words().text("picture"),r.draggable=!1,r.decoding="async";let o={element:r,natural:null,scalable:/\.svgz?(?:[?#]|$)/i.test(i),fitted:{width:0,height:0},view:xi,maximum:1};if(this.picture=o,r.addEventListener("load",()=>this.pictureLoaded(o)),r.addEventListener("error",()=>{if(this.picture===o)this.setStatus(this.context.words().text("pictureUnavailable"))}),this.setStatus("",!0),r.src=i,e.layer.appendChild(r),r.complete&&r.naturalWidth>0)this.pictureLoaded(o)}pictureLoaded(t){if(this.picture!==t||t.natural)return;let{naturalWidth:e,naturalHeight:n}=t.element;t.natural=e>0&&n>0?{width:e,height:n}:{width:1,height:1},t.scalable||=!(e>0&&n>0),this.setStatus(null),this.layout()}showVideo(t,e){let n=this.parts,i=t.video,r=this.context.baseUrl(),o=i.thumbnail?V(i.thumbnail,"image"):null,s=null;if(s=id(i,{autoplay:e.autoplay!==!1,controls:this.context.interactive(),startAt:e.startAt,title:t.text||i.caption||this.context.words().text("video"),poster:o?G(o,r):void 0,baseUrl:r,onState:(l)=>{if(s!==null&&this.player===s)this.context.onState(this.items[this.index].node,l)},onRatio:()=>{if(s!==null&&this.player===s)this.layout()},onError:()=>{if(s!==null&&this.player===s)this.setStatus(this.context.words().text("videoUnavailable"))}}),!s){this.setStatus(this.context.words().text("videoUnavailableHere"));return}this.player=s;let a=document.createElement("div");a.className="orbit-viewer__player",a.appendChild(s.element),this.playerBox=a,n.layer.appendChild(a)}clearMedia(){this.resetGestures(),this.player?.destroy(),this.player=null,this.picture=null,this.playerBox=null,this.parts?.layer.replaceChildren(),this.dialog?.classList.remove("orbit-viewer--zoomed")}describe(){let t=this.parts,e=this.dialog,n=this.items[this.index],{node:i}=n,r=n.kind==="image"?i.image:i.video,o=this.context.interactive();e.classList.toggle("orbit-viewer--still",!o),e.dataset.orbitMedia=n.kind;let s=[this.context.icon(i),i.text].filter(Boolean).join(" ");t.title.textContent=s;let a=r?.caption?.trim()??"";t.text.textContent=a,t.text.hidden=a==="";let l=n.kind==="image"?i.image?.alt?.trim()??"":"";t.description.textContent=l,t.description.hidden=l===""||l===a;let d=this.items.length,c=d>1?this.context.words().text("position",{index:this.index+1,total:d}):"",u=c&&s?`: ${s}`:"";if(t.counter.textContent!==c+u){let m=document.createElement("span");m.textContent=c;let p=document.createElement("span");p.className="orbit-visually-hidden",p.textContent=u,t.counter.replaceChildren(...c?[m,p]:[])}t.previous.hidden=d<2,t.next.hidden=d<2,t.previous.disabled=this.index===0,t.next.disabled=this.index===d-1;let h=this.mediaLink(n);if(t.link.hidden=h===null,h)t.link.href=h.href,t.link.setAttribute("aria-label",h.label),t.link.title=h.label;else t.link.removeAttribute("href");t.zoomGroup.hidden=n.kind!=="image",this.updateZoomButtons(),this.keepFocus()}mediaLink(t){let{node:e}=t,n=this.context.baseUrl();if(t.kind==="image"){let d=e.image?.src??"",c=/^\s*(?:data|blob):/i.test(d)?null:V(d,"link");return c?{href:G(c,n),label:this.context.words().text("openPictureInNewTab")}:null}let i=e.video;if(!i||/^\s*(?:data|blob):/i.test(i.src))return null;let r=V(i.src,"link");if(!r)return null;let o=G(r,n),s=i.provider==="youtube"||i.provider==="vimeo"?i.provider:Q(o),a=this.context.words(),l=s==="youtube"?a.text("watchOn",{provider:"YouTube"}):s==="vimeo"?a.text("watchOn",{provider:"Vimeo"}):a.text("openVideoInNewTab");return{href:Ss(o,i.provider),label:l}}setStatus(t,e=!1){let n=this.parts;n.status.textContent=t??"",n.status.hidden=t===null,n.status.classList.toggle("orbit-viewer__status--loading",e),n.stage.setAttribute("aria-busy",String(e))}layout(){let t=this.parts;if(!this.shown||!t)return;let e=this.readStageBox(),n=this.items.length>1&&this.context.interactive(),i=n&&this.playerBox!==null&&e.width<pd,r=this.mediaRoom(e,n,i),o=this.picture;if(o?.natural){let l=ld(o.natural,r,o.scalable);o.fitted=l,o.maximum=dd(o.natural,l);let d=o.element.style;d.width=`${ct(l.width)}px`,d.height=`${ct(l.height)}px`,d.left=`${ct((e.width-l.width)/2)}px`,d.top=`${ct((e.height-l.height)/2)}px`,this.setView(Ze(o.view,l,e,o.maximum),!1)}let s=this.playerBox,a="";if(s&&this.player){let l=this.player.ratio,d=Math.max(0,Math.min(r.width,r.height*l)),c=d/l,u=(e.height-c-(i?Lo:0))/2;if(s.style.width=`${ct(d)}px`,s.style.height=`${ct(c)}px`,s.style.left=`${ct((e.width-d)/2)}px`,s.style.top=`${ct(u)}px`,i)a=`${ct(u+c+(Lo-_m)/2)}px`}t.previous.style.top=a,t.next.style.top=a}mediaRoom(t,e,n){let i=e&&t.width>=pd?Fm:hd,r=n?Lo:0;return{width:Math.max(0,t.width-2*i),height:Math.max(0,t.height-2*hd-r)}}readStageBox(){let t=this.parts.stage.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}stagePoint(t){let e=this.readStageBox();return{x:t.x-e.left-e.width/2,y:t.y-e.top-e.height/2}}setView(t,e){let n=this.picture;if(!n)return;n.view=t;let i=n.element;i.classList.toggle("orbit-viewer__picture--gliding",e),i.style.transform=`translate(${ct(t.x)}px, ${ct(t.y)}px) scale(${Math.round(t.scale*1e4)/1e4})`,this.dialog?.classList.toggle("orbit-viewer--zoomed",wi(t)),this.updateZoomButtons()}zoomAt(t,e,n){let i=this.picture;if(!i?.natural)return!1;let r=this.readStageBox();return this.setView(Io(i.view,t,e,i.fitted,r,i.maximum),n),!0}fitPicture(){if(!this.picture?.natural)return!1;return this.setView(xi,!0),!0}panBy(t,e,n){let i=this.picture;if(i?.natural)this.setView(cd(i.view,t,e,i.fitted,this.readStageBox(),i.maximum),n)}get zoomed(){return this.picture!==null&&wi(this.picture.view)}updateZoomButtons(){let t=this.parts,e=this.picture;if(!t)return;let n=Boolean(e?.natural),i=e?.view.scale??1;t.zoomOut.disabled=!n||i<=1.001,t.fit.disabled=!n||i<=1.001,t.zoomIn.disabled=!n||i>=(e?.maximum??1)-0.001,this.keepFocus()}keepFocus(){let t=Do(this.host);if(this.shown&&t instanceof HTMLButtonElement&&t.disabled&&this.dialog?.contains(t))this.dialog.focus({preventScroll:!0})}ensureDialog(){if(this.dialog)return this.dialog;let t=document.createElement("dialog");t.className="orbit-viewer",t.tabIndex=-1,t.setAttribute("aria-labelledby",`${this.id}-title`);let e=ot("div","orbit-viewer__bar"),n=ot("p","orbit-viewer__counter");n.setAttribute("role","status");let i=ot("div","orbit-viewer__tools"),r=ot("div","orbit-panel orbit-viewer__zoom");r.setAttribute("role","group");let o=be("zoom-out",()=>this.zoomAt(1/ki,{x:0,y:0},!0)),s=be("zoom-in",()=>this.zoomAt(ki,{x:0,y:0},!0)),a=be("fit",()=>this.fitPicture());r.append(o,s,a);let l=ot("div","orbit-panel"),d=ot("a","orbit-button orbit-button--icon orbit-viewer__link");d.target="_blank",d.rel="noopener noreferrer",d.appendChild(it("link"));let c=be("close",()=>this.close());c.classList.add("orbit-viewer__close"),l.append(d,c),i.append(r,l),e.append(n,i);let u=ot("div","orbit-viewer__stage"),h=ot("div","orbit-viewer__media"),m=ot("p","orbit-viewer__status");m.hidden=!0;let p=be("previous",()=>this.step(-1));p.classList.add("orbit-viewer__step","orbit-viewer__step--previous");let b=be("next",()=>this.step(1));b.classList.add("orbit-viewer__step","orbit-viewer__step--next"),u.append(h,m,p,b);let g=ot("div","orbit-viewer__caption"),f=ot("h2","orbit-viewer__title");f.id=`${this.id}-title`;let y=ot("p","orbit-viewer__text"),x=ot("p","orbit-viewer__description");return g.append(f,y,x),t.append(e,u,g),this.parts={bar:e,counter:n,zoomOut:o,zoomIn:s,fit:a,zoomGroup:r,link:d,close:c,stage:u,layer:h,status:m,previous:p,next:b,caption:g,title:f,text:y,description:x},this.relabel(),t.addEventListener("keydown",this.handleKeyDown),t.addEventListener("cancel",this.handleCancel),t.addEventListener("pointerdown",()=>{this.suppressClick=!1},!0),t.addEventListener("close",()=>{if(!t.open)this.finish()}),t.addEventListener("click",this.handleClick,!0),t.addEventListener("wheel",this.handleWheel,{passive:!1}),t.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),u.addEventListener("pointerdown",this.handlePointerDown),u.addEventListener("pointermove",this.handlePointerMove),u.addEventListener("pointerup",this.handlePointerUp),u.addEventListener("pointercancel",this.handlePointerUp),u.addEventListener("dblclick",this.handleDoubleClick),this.host.appendChild(t),this.dialog=t,t}finish(){if(!this.shown)return;this.shown=!1;let t=this.items[this.index],e=this.index,n=this.items.length;if(this.clearMedia(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.settleTimer!==null)clearTimeout(this.settleTimer),this.settleTimer=null;this.items=[];let i=this.returnFocus;if(this.returnFocus=null,i&&i.isConnected)i.focus({preventScroll:!0});if(t)this.context.onClose(t,e,n)}observeStage(){if(this.resizeObserver||typeof ResizeObserver>"u"||!this.parts)return;this.resizeObserver=new ResizeObserver(()=>this.layout()),this.resizeObserver.observe(this.parts.stage)}handleKeyDown=(t)=>{if(!this.shown||!this.context.interactive()||t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)return;let e=t.target instanceof Element?t.target:null,n=e?.closest("video, iframe")!=null,i=this.readStageBox(),r=!0;switch(t.key){case"Escape":this.close();break;case"ArrowLeft":case"ArrowRight":{let o=t.key==="ArrowRight"?1:-1;if(n)r=!1;else if(this.zoomed)this.panBy(-o*i.width*md,0,!0);else this.step(o);break}case"ArrowUp":case"ArrowDown":if(this.zoomed&&!n)this.panBy(0,(t.key==="ArrowDown"?-1:1)*i.height*md,!0);else r=!1;break;case"Home":case"End":r=!n&&this.go(t.key==="Home"?0:this.items.length-1);break;case"+":case"=":r=this.zoomAt(ki,{x:0,y:0},!0);break;case"-":case"_":r=this.zoomAt(1/ki,{x:0,y:0},!0);break;case"0":r=this.fitPicture();break;case" ":r=!n&&!e?.closest("button, a")&&this.togglePlayback();break;default:r=!1}if(r)t.preventDefault()};togglePlayback(){let t=this.video;if(!t)return!1;if(t.state.playing)t.pause();else t.play();return!0}handleCancel=(t)=>{if(t.preventDefault(),this.context.interactive())this.close()};handleClick=(t)=>{if(this.suppressClick){this.suppressClick=!1,t.stopPropagation(),t.preventDefault();return}let e=this.parts;if(!e||!this.context.interactive())return;if(t.target===e.stage||t.target===e.layer)this.close()};handleWheel=(t)=>{let e=this.parts;if(!e)return;if(!(t.target instanceof Node&&e.caption.contains(t.target)&&e.caption.scrollHeight>e.caption.clientHeight)&&t.cancelable)t.preventDefault();if(!this.context.interactive()||!(t.target instanceof Node)||!e.stage.contains(t.target)||!this.picture?.natural)return;let i=Ln(t,this.readStageBox().height);this.zoomAt(i,this.stagePoint({x:t.clientX,y:t.clientY}),!1)};handleTouchMove=(t)=>{let e=this.parts;if(!(e!==null&&t.target instanceof Node&&e.caption.contains(t.target))&&t.cancelable)t.preventDefault()};handleDoubleClick=(t)=>{if(!this.context.interactive()||t.target!==this.picture?.element)return;this.toggleZoomAt({x:t.clientX,y:t.clientY})};toggleZoomAt(t){let e=this.picture;if(!e?.natural)return;let n=this.readStageBox();this.setView(ud(e.view,this.stagePoint(t),e.natural,e.fitted,n,e.maximum),!0)}handlePointerDown=(t)=>{if(!this.context.interactive()||t.pointerType==="mouse"&&t.button!==0)return;if(t.target instanceof Element&&t.target.closest(Pm))return;let e={x:t.clientX,y:t.clientY};if(this.pointers.set(t.pointerId,e),this.pointers.size===2){if(this.press?.mode==="swipe"||this.press?.mode==="pull")this.settleLayer();if(this.press=null,this.picture?.natural){this.pinch={view:this.picture.view,distance:this.pinchDistance(),center:this.stagePoint(this.pinchCenter())};for(let n of this.pointers.keys())this.capture(n)}return}if(this.pointers.size>2)return;this.press={id:t.pointerId,type:t.pointerType,start:e,last:e,moved:!1,mode:"none"}};handlePointerMove=(t)=>{if(!this.pointers.has(t.pointerId))return;let e={x:t.clientX,y:t.clientY};this.pointers.set(t.pointerId,e);let n=this.pinch,i=this.picture;if(n){if(this.pointers.size<2||!i?.natural)return;let l=this.stagePoint(this.pinchCenter()),d=n.distance>0?this.pinchDistance()/n.distance:1,c=Math.min(i.maximum,Math.max(1,n.view.scale*d)),u=c/n.view.scale,h={scale:c,x:l.x-(n.center.x-n.view.x)*u,y:l.y-(n.center.y-n.view.y)*u};this.setView(Ze(h,i.fitted,this.readStageBox(),i.maximum),!1);return}let r=this.press;if(!r||r.id!==t.pointerId)return;let o=e.x-r.start.x,s=e.y-r.start.y;if(!r.moved){if(Math.hypot(o,s)<(r.type==="mouse"?Cm:Am))return;r.moved=!0,r.mode=this.dragMode(r.type,o,s),this.capture(t.pointerId),this.dialog?.classList.toggle("orbit-viewer--dragging",r.mode==="pan")}let a=this.parts.layer;if(r.mode==="pan")this.panBy(e.x-r.last.x,e.y-r.last.y,!1);else if(r.mode==="swipe")a.style.transform=`translate(${ct(o)}px, 0)`;else if(r.mode==="pull"){let l=Math.max(0,s);a.style.transform=`translate(0, ${ct(l)}px)`,this.dialog?.style.setProperty("--_orbit-viewer-pull",String(Math.min(1,l/(bd*3))))}r.last=e};handlePointerUp=(t)=>{if(!this.pointers.delete(t.pointerId))return;if(this.pinch){if(this.pointers.size<2){this.pinch=null,this.suppressClick=!0;let o=Array.from(this.pointers.entries())[0];if(o)this.press={id:o[0],type:t.pointerType,start:o[1],last:o[1],moved:!0,mode:this.zoomed?"pan":"none"}}return}let e=this.press;if(!e||e.id!==t.pointerId)return;this.press=null,this.dialog?.classList.remove("orbit-viewer--dragging");let n=t.type==="pointercancel",i=t.clientX-e.start.x,r=t.clientY-e.start.y;if(e.moved){if(this.suppressClick=!0,e.mode==="swipe"){if(n||Math.abs(i)<Im||!this.step(i<0?1:-1))this.settleLayer()}else if(e.mode==="pull")if(!n&&r>=bd)this.close();else this.settleLayer();return}if(e.type!=="mouse"&&!n){let o={x:t.clientX,y:t.clientY},s=this.lastTap;if(s&&t.timeStamp-s.time<Lm&&Math.hypot(o.x-s.point.x,o.y-s.point.y)<Dm){if(this.lastTap=null,t.target===this.picture?.element)this.toggleZoomAt(o)}else this.lastTap={time:t.timeStamp,point:o}}};dragMode(t,e,n){if(this.zoomed)return"pan";if(t==="mouse")return"none";if(Math.abs(e)>Math.abs(n))return this.items.length>1?"swipe":"none";return n>0?"pull":"none"}settleLayer(){let t=this.parts,e=this.dialog;if(!t||!e)return;if(e.classList.add("orbit-viewer--settling"),t.layer.style.transform="",e.style.removeProperty("--_orbit-viewer-pull"),this.settleTimer!==null)clearTimeout(this.settleTimer);this.settleTimer=setTimeout(()=>{this.settleTimer=null,e.classList.remove("orbit-viewer--settling")},260)}resetGestures(){if(this.pointers.clear(),this.press=null,this.pinch=null,this.lastTap=null,this.dialog?.classList.remove("orbit-viewer--dragging"),this.parts)this.parts.layer.style.transform="";this.dialog?.style.removeProperty("--_orbit-viewer-pull")}capture(t){try{this.parts?.stage.setPointerCapture?.(t)}catch{}}pinchDistance(){let[t,e]=Array.from(this.pointers.values());return t&&e?Math.hypot(t.x-e.x,t.y-e.y):0}pinchCenter(){let[t,e]=Array.from(this.pointers.values());return t&&e?{x:(t.x+e.x)/2,y:(t.y+e.y)/2}:t??{x:0,y:0}}}var Do=(t)=>{let n=t.getRootNode().activeElement??t.ownerDocument?.activeElement??null;while(n?.shadowRoot?.activeElement)n=n.shadowRoot.activeElement;return n instanceof HTMLElement||n instanceof SVGElement?n:null},be=(t,e)=>{let n=ot("button","orbit-button orbit-button--icon");return n.type="button",n.appendChild(it(t)),n.addEventListener("click",e),n},fe=(t,e)=>{t.setAttribute("aria-label",e),t.title=e},ot=(t,e)=>{let n=document.createElement(t);return n.className=e,n},ct=(t)=>Math.round(t*100)/100;var Rm=new Map,$m=new Map,Bm=new Map;var Si=(t)=>t.trim().toLowerCase(),Vm=new Set(["active","done","blocked","todo","neutral"]);class Po{types=new Map;statuses=new Map;actionList;typeFor;typeForFailed=!1;constructor(t={}){for(let[e,n]of Object.entries(t.nodeTypes??{}))this.types.set(Si(e),n);for(let[e,n]of Object.entries(t.statuses??{}))this.statuses.set(Si(e),n);this.actionList=t.actions??[],this.typeFor=t.nodeTypeFor}typeName(t){if(t.type)return t.type;let e=this.typeFor;if(!e)return;let n;try{n=e(t)}catch(i){if(!this.typeForFailed)this.typeForFailed=!0,console.error("[orbit] nodeTypeFor() threw:",i);return}return typeof n==="string"&&n.trim()!==""?n:void 0}nodeType(t){let e=this.typeName(t);return e===void 0?void 0:this.typeNamed(e)}ownType(t){return t.type?this.typeNamed(t.type):void 0}typeNamed(t){let e=Si(t);return this.types.get(e)??Rm.get(e)}icon(t){return t.icon??this.nodeType(t)?.icon}color(t){return t.color??this.nodeType(t)?.color}actions(t){let e=new Set,n=[];for(let i of[...this.actionList,...$m.values(),...this.nodeType(t)?.actions??[]]){if(e.has(i.id))continue;if(e.add(i.id),!i.when||Rt(`the "${i.id}" action's when()`,!1,()=>i.when(t)))n.push(i)}return n}status(t){let e=Si(t),n=this.statuses.get(e)??Bm.get(e);if(n===void 0)return{tone:qe(t)};return Vm.has(n)?{tone:n}:{tone:"neutral",color:n}}}var gd=(t,e)=>{let n=0,i=(r)=>{let o=e.ownType(r),s=r.typeVersion??1;if(o?.version!==void 0&&o.upgrade&&s<o.version){let a=o.upgrade;if(Rt(`the "${r.type}" type's upgrade()`,!1,()=>(a(r,s),!0)))r.typeVersion=o.version,n+=1}r.children.forEach(i)};return i(t),n},Mi=(t,e)=>typeof t.label==="function"?Rt(`the "${t.id}" action's label()`,t.id,()=>t.label(e)):t.label,Rt=(t,e,n)=>{try{return n()}catch(i){return console.error(`[orbit] ${t} threw:`,i),e}};var zm=(t,e=!1)=>{let n=[];if(e)n.push("details");if(P(t.image))n.push("image");if(P(t.video))n.push("video");if(P(t.embed)&&!P(t.video))n.push("embed");if(t.note)n.push("note");if(t.link&&(lt(t.link)||V(t.link,"link")!==null))n.push("link");return n},Hm={details:"showDetails",image:"viewImage",video:"playVideo",embed:"openEmbed",note:"readNote",link:"openLink"},Um={details:"info",image:"image",video:"video",embed:"embed",note:"note",link:"link"},jm=new dt("en"),Wm=36,Gm=42,Ei=8,Ni=(t,e,n=1/0)=>{let i=Math.max(1,Math.min(t,Math.floor((n+Ei)/(e+Ei)))),r=Math.ceil(t/i);return{perLine:i,width:i*e+(i-1)*Ei,height:r*e+(r-1)*Ei}};class Ro{element;context;node=null;visible=!1;transform="";wrap=0;counted=null;constructor(t){this.context=t,this.element=document.createElement("div"),this.element.className="orbit-actions",this.element.setAttribute("role","toolbar")}count(t){if(this.counted?.node!==t)this.counted={node:t,count:this.kinds(t).length+this.context.actions(t).length};return this.counted.count}size(){return en(this.element)?Gm:Wm}kinds(t){return zm(t,this.context.hasDetails(t)).filter((e)=>e!=="link"||this.context.describeLink(t).kind!=="missing")}show(t,e,n,i=0){if(t!==this.node){this.node=t,this.element.replaceChildren(...this.kinds(t).map((s)=>this.contentButton(t,s)),...this.context.actions(t).map((s)=>this.actionButton(t,s)));let o=this.words();this.element.setAttribute("aria-label",t.text?o.text("ideaActions",{name:t.text}):o.text("ideaActionsUntitled"))}if(!this.element.hasChildNodes()){this.hide();return}let r=jt(Math.round(e),Math.round(n),"-50%, 0");if(r!==this.transform)this.element.style.transform=r,this.transform=r;if(i!==this.wrap)this.element.style.maxWidth=i>0?`${i}px`:"",this.wrap=i;if(!this.visible)this.element.classList.add("orbit-actions--visible"),this.visible=!0}hide(){if(!this.visible)return;if(this.element.contains(this.element.ownerDocument.activeElement))if(this.context.returnFocus)this.context.returnFocus();else this.element.ownerDocument.activeElement.blur();this.element.classList.remove("orbit-actions--visible"),this.visible=!1}words(){return this.context.words?.()??jm}reset(){this.node=null,this.counted=null,this.element.replaceChildren(),this.hide()}contentButton(t,e){let n=e==="link"?this.context.describeLink(t):null,i=n?.kind==="node"?n.label:this.words().text(Hm[e]),r=this.button(t,e,i);return r.classList.add(`orbit-action--${e}`),r.appendChild(it(n?.kind==="node"?"goto":Um[e])),r}actionButton(t,e){let n=Mi(e,t),i=this.button(t,e.id,n);return i.classList.add("orbit-action--custom"),i.dataset.action=e.id,i.appendChild(mi(e.icon,n)),i}button(t,e,n){let i=document.createElement("button");return i.type="button",i.className="orbit-action",i.setAttribute("aria-label",n),i.title=n,i.addEventListener("click",(r)=>{r.stopPropagation(),this.context.onAction(t,e,r)}),i}}class $o{element;callbacks;open=!1;closing=!1;savedAt=-1/0;typedSinceSave=!0;look="";position="";placement=null;height=0;constructor(t){this.callbacks=t;let e=document.createElement("textarea");e.className="orbit-editor",e.rows=1,e.hidden=!0,e.setAttribute("autocapitalize","sentences"),e.addEventListener("keydown",this.handleKeyDown),e.addEventListener("beforeinput",this.handleBeforeInput),e.addEventListener("input",this.handleInput),e.addEventListener("blur",this.handleBlur),this.element=e}get isOpen(){return this.open}get value(){return this.element.value}get hasFocus(){return this.element.ownerDocument.activeElement===this.element}show(t,e){let n=this.element;this.describe(e),n.value=t,n.hidden=!1,this.open=!0,this.look="",this.position="",this.placement=null,n.style.opacity="0",this.fit(),n.focus({preventScroll:!0}),n.select()}clear(t){this.describe(t),this.element.value="",this.fit(),this.move()}hide(){if(!this.open)return;if(this.open=!1,this.closing=!0,this.hasFocus)this.element.blur();this.closing=!1,this.element.hidden=!0}place(t){let e=this.element;if(this.placement=t,!t){if(this.position!=="")e.style.opacity="0",this.position="";return}let n=t.fontSize/16,i=[t.width,t.fontSize,t.maxHeight,t.role,t.light,t.slot,t.floating].join("|");if(i!==this.look)this.look=i,e.style.width=`${Xe(t.width/n)}px`,e.style.maxHeight=`${Xe(t.maxHeight/n)}px`,e.classList.toggle("orbit-editor--sun",t.role==="sun"),e.classList.toggle("orbit-editor--light",t.light),e.classList.toggle("orbit-editor--slot",t.slot),e.classList.toggle("orbit-editor--floating",t.floating),this.fit();this.move()}describe(t){this.element.setAttribute("aria-label",t.label),this.element.placeholder=t.placeholder,this.element.setAttribute("enterkeyhint",t.enterKey)}move(){let t=this.placement;if(!t)return;let e=t.fontSize/16,n=Math.min(this.height*e,t.maxHeight),i=t.lowest===void 0?0:Math.max(0,n/2-t.lowest),r=`translate3d(${Xe(t.x)}px, ${Xe(t.y-i)}px, 0) translate(-50%, -50%) scale(${Xe(e,4)})`;if(r!==this.position){if(this.position==="")this.element.style.opacity="";this.element.style.transform=r,this.position=r}}fit(){let t=this.element;t.style.height="auto",this.height=t.scrollHeight,t.style.height=`${this.height}px`}save(){let t=typeof performance<"u"?performance.now():Date.now();if(!this.typedSinceSave&&t-this.savedAt<50)return;this.savedAt=t,this.typedSinceSave=!1,this.callbacks.onSave(this.element.value,"enter")}handleKeyDown=(t)=>{if(t.key==="Escape"){t.preventDefault(),this.callbacks.onCancel();return}if(t.key==="Enter"&&!t.shiftKey&&!t.isComposing){t.preventDefault(),this.save();return}if(t.key==="Tab"&&!t.isComposing&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&this.callbacks.onTab(this.element.value,t.shiftKey))t.preventDefault()};handleBeforeInput=(t)=>{if(t.inputType==="insertLineBreak"||t.inputType==="insertParagraph")t.preventDefault(),this.save()};handleInput=()=>{this.typedSinceSave=!0;let t=this.element;if(/[\r\n]/.test(t.value))t.value=t.value.replace(/\s*[\r\n]+\s*/g," ");this.fit(),this.move()};handleBlur=()=>{if(this.open&&!this.closing)this.callbacks.onSave(this.element.value,"blur")}}var Xe=(t,e=1)=>{let n=10**e;return Math.round(t*n)/n};var Km=1.75,Ym=42,qm=0.72,Zm=0.6,Xm=0.4,Jm=6,Ti=1.6,Qm=70,tb=720,eb=650,nb=380,ib=260,rb=12,ob=0.6,sb=16,ab=1.3,lb=32,yd=0.55,db=0.3,cb=220,ub=350,hb=700,vd=1.25,pb=0.3,xd=24,mb=6,bb=40,fb=560,gb=0.5,wd=6,yb=10,kd=12,ye=12,vb=10,xb=60,Od=0.02,wb=new Set(["details","image","video","embed","note","link"]);class Mt{static registry=new WeakMap;static instanceCounter=0;static unmount(t){let e=Mt.registry.get(t);if(!e)return!1;return e.destroy(),!0}container;root;svg;world;definitions;worldTransform="";turnTransform="";shadingTheme="";speckLighting=0;specksBelow=0;stillNodes=null;layers;labelLayer;labelFonts;stopWatchingFonts;contentLayer;contents=new Map;extensions;words;requestedLanguage;requestedStrings;overlayLayer;emptyState;actionBar;tooltip;controls;outline;sheet;viewer;input;clock;spinPhysics=new Ir;spinTracker=new Cr;panTracker=new Lr;glide=new Dr;ids;resizeObserver=null;visibilityObserver=null;nodeColors=null;taskTokens=null;onScreen=!0;reducedMotionQuery;options;userOptions;documentOptions={};sourceOptions={};sourceExtra;themeProperties=[];tree=null;focusPath=[];viewMode;viewport={width:0,height:0};layoutSize={width:0,height:0};relayoutOnArrival=!1;refitOnArrival=!1;scene=null;camera={x:0,y:0,scale:1};transition=null;nextScene=null;landingCamera=null;cameraFlight=null;wheelZoom=null;display=null;restingDisplay=null;labelOrder=null;nodeViews=new Map;nodeGroups=new Map;families=new Map;flightCount=0;familyCount=0;labels=new Map;ringViews=new Map;linkViews=new Map;counts=new Map;labelsPlaced=null;waitingLabels=null;labelLayerTransform="";lightText=new Map;textColors=null;activeId=null;tabStopsChanged=!0;hoveredId=null;keyboardFocusId=null;topPlanetId=null;userSpun=!1;returnFocusToMap=!1;dragging=!1;lastContext=null;renamedIds=new Map;changedIds=new Set;addSlotView=new Xn;heldPlaceView=new Xn(!0);editor;editing=null;arrival=null;nodeDrag=null;dropFrom=null;editOnLift=null;dragMarks=`
|
|
127
|
-
`;ambientRunning=!1;pendingDrift=0;spinReach=null;pageScrollCheck=null;listeners=new Map;destroyed=!1;warnedFlat=!1;warnedTheme=null;constructor(t,e={}){if(!t||typeof t.appendChild!=="function")throw TypeError(`Orbit needs an element to draw the map in, but got ${t===null?"null":typeof t}. Check that the selector matches an element and that the code runs after the element exists.`);Mt.unmount(t),this.container=t,this.userOptions={...e},this.options=this.resolveOptions(),this.extensions=this.createExtensions(),this.requestedLanguage=this.options.language??Un(t),this.requestedStrings=this.options.strings,this.words=new dt(this.requestedLanguage,this.requestedStrings),this.viewMode=this.options.viewMode;let n=`orbit-${(++Mt.instanceCounter).toString(36)}`;this.ids={clip:`${n}-clip`,shade:`${n}-shade`,speckShade:`${n}-speck-shade`,shadow:`${n}-shadow`,sunShadow:`${n}-sun-shadow`},this.root=document.createElement("div"),this.root.className="orbit",this.svg=T("svg",{class:"orbit__canvas"}),this.svg.setAttribute("aria-roledescription",this.words.text("mindMapRole")),this.definitions=yl(this.ids),this.svg.appendChild(this.definitions),this.world=T("g",{class:"orbit__world"}),this.layers={rings:T("g",{class:"orbit__rings"}),links:T("g",{class:"orbit__links"}),moons:T("g",{class:"orbit__moons"}),nodes:T("g",{class:"orbit__nodes"}),suns:T("g",{class:"orbit__suns"}),carried:T("g",{class:"orbit__carried"})},this.world.append(this.layers.rings,this.layers.links,this.layers.moons,this.layers.nodes,this.layers.suns,this.layers.carried),this.layers.nodes.appendChild(this.addSlotView.element),this.layers.nodes.appendChild(this.heldPlaceView.element),this.svg.appendChild(this.world),this.contentLayer=document.createElement("div"),this.contentLayer.className="orbit__contents",this.contentLayer.setAttribute("aria-hidden","true"),this.labelLayer=document.createElement("div"),this.labelLayer.className="orbit__labels",this.labelLayer.setAttribute("aria-hidden","true"),this.labelFonts=new Jr(this.labelLayer,()=>this.extensions),this.overlayLayer=document.createElement("div"),this.overlayLayer.className="orbit__overlay",this.actionBar=new Ro({onAction:(i,r,o)=>this.runAction(i,r,o),describeLink:(i)=>this.describeLink(i),actions:(i)=>this.extensions.actions(i),hasDetails:(i)=>Boolean(this.extensions.nodeType(i)?.details),returnFocus:()=>this.focusNodeElement(this.activeId??this.focusId),words:()=>this.words}),this.overlayLayer.appendChild(this.actionBar.element),this.editor=new $o({onSave:(i,r)=>this.saveEdit(i,r),onCancel:()=>this.finishEditing(!0),onTab:(i,r)=>this.tabFromEditor(i,r)}),this.overlayLayer.appendChild(this.editor.element),this.emptyState=Mb(this.words),this.tooltip=new Fo,this.controls=new Eo({onNavigate:(i)=>{this.navigate("focus",i)},onViewMode:(i)=>this.setViewMode(i),onZoom:(i)=>this.zoomBy(i===1?Ti:1/Ti),onFit:()=>this.fit(),onToggleOutline:()=>this.toggleOutline()},this.words),this.outline=new To((i)=>this.selectFromOutline(i),this.words),this.root.append(this.svg,this.contentLayer,this.labelLayer,this.overlayLayer,this.emptyState,this.tooltip.element,this.controls.element,this.outline.element,this.outline.live),this.sheet=new ko(this.root),this.viewer=new Oi(this.root,{items:()=>this.tree?fd(this.tree,this.options.maxDepth):[],node:(i)=>this.tree?U(this.tree,i):null,baseUrl:()=>this.options.baseUrl,interactive:()=>this.options.interactive!==!1,icon:(i)=>this.extensions.icon(i),onShow:(i,r,o)=>this.mediaShown("media-open",i,r,o),onClose:(i,r,o)=>this.mediaShown("media-close",i,r,o),onState:(i,r)=>this.mediaPlayed(i,r),words:()=>this.words}),t.appendChild(this.root),Sa(this.root),Mt.registry.set(t,this),this.clock=new Er(()=>this.paint()),this.stopWatchingFonts=se(()=>{this.labelFonts.refresh(),this.fitLabelsAgain()}),this.input=new Mr(this.root,{isInteractive:()=>this.options.interactive!==!1,longPressDelay:()=>{let i=this.options.longPressDelay;return typeof i==="number"&&Number.isFinite(i)&&i>0?i:500},dragGesture:(i)=>this.dragGestureAt(i),spinCenter:()=>this.sunOnScreen(),isCoasting:()=>this.spinPhysics.isMoving||this.glide.isMoving,onCatch:()=>{this.spinPhysics.stop(),this.glide.stop()},onSpinStart:(i,r)=>{this.spinTracker.reset(i,r),this.spinPhysics.grab(),this.userSpun=!0},onSpinMove:(i,r)=>{this.spinPhysics.drag(this.spinTracker.add(i,r)),this.tickHaptics(),this.clock.requestPaint()},onSpinEnd:(i,r)=>this.releaseSpin(r?0:this.spinTracker.velocityAt(i)),onPanStart:(i)=>{this.glide.stop(),this.cameraFlight=null,this.panTracker.reset(i)},onPan:(i,r,o)=>{this.panTracker.add(o,i,r),this.panCamera(i,r)},onPanEnd:(i,r)=>{if(!r&&!this.prefersReducedMotion()){if(this.glide.start(this.panTracker.velocityAt(i)),this.glide.isMoving)this.clock.add(this.glideTask)}},onPinch:(i,r,o,s)=>{this.cameraFlight=null,this.panCamera(o,s),this.zoomAt(i,r)},onPinchEnd:()=>this.settleZoom(),onWheel:(i,r)=>this.handleWheel(i,r),onDoubleTap:(i,r)=>this.handleDoubleTap(i,r),onLongPress:(i,r)=>{let o=yt(r);return o!==null&&this.openNodeContext(o,i,!0)},onHold:(i,r)=>this.liftNode(yt(r),i),onNodeDrag:(i,r)=>this.dragNode(i,r),onDraggingChange:(i)=>{if(this.dragging=i,this.root.classList.toggle("orbit--dragging",i),i)this.hoveredId=null,this.updateTooltip();else this.clock.requestPaint();this.syncAmbientMotion()}}),this.svg.addEventListener("click",this.handleClick),this.svg.addEventListener("contextmenu",this.handleContextMenu),this.svg.addEventListener("keydown",this.handleKeyDown),this.svg.addEventListener("pointerover",this.handlePointerOver),this.svg.addEventListener("pointerout",this.handlePointerOut),this.root.addEventListener("focusin",this.handleFocusIn),this.root.addEventListener("focusout",this.handleFocusOut),this.applyOptionEffects(null),this.setViewport(this.readContainerSize()),this.observeResize(),this.observeVisibility()}render(t){if(typeof t==="string")t=It(t,{untitled:this.words.text("untitledMap")});let e=Fi(t)?t.root:t;if(gd(e,this.extensions),this.isSameMap(e,Fi(t)?t.options:null)){if(Fi(t))this.sourceExtra=t.extra;this.adoptTree(e);return}if(Fi(t)){if(this.sourceOptions={...t.options},this.sourceExtra=t.extra,this.documentOptions=Rs(t.options),this.options=this.resolveOptions(),this.tree===null)this.viewMode=this.options.viewMode;this.applyOptionEffects(null)}else this.sourceOptions={},this.sourceExtra=void 0,this.documentOptions={},this.options=this.resolveOptions(),this.applyOptionEffects(null);this.showTree(e)}setOptions(t){this.nodeColors=null,this.taskTokens=null,this.userOptions={...this.userOptions,...t};let e=this.options;if(this.options=this.resolveOptions(),this.applyOptionEffects(e),t.viewMode!==void 0&&t.viewMode!==this.viewMode)if(this.tree)this.navigate(t.viewMode,this.focusId,!1);else this.viewMode=t.viewMode}on(t,e){let n=this.listeners.get(t);if(!n)n=new Set,this.listeners.set(t,n);let i=e;return n.add(i),()=>{this.listeners.get(t)?.delete(i)}}getSVGElement(){return this.svg}toSVGString(){let t=this.viewport.width>0&&this.viewport.height>0?this.viewport:{width:800,height:600},e=this.transition?this.nextScene??this.transition.target:this.scene;if(e?.addSlot)e=this.buildScene(!1);let n=e?Lt(e,this.transition?0:this.rotation,this.transition?e.frame:this.camera):null;return Ql(n,{viewport:t,extensions:this.extensions,tokens:this.exportTokens(),showRings:this.options.showRings!==!1,title:this.options.ariaLabel||this.tree?.text||this.words.text("mindMap"),words:this.words,fills:(i)=>this.nodeViews.get(i.id)?.resolvedFill()??"",baseUrl:this.options.baseUrl??this.root.ownerDocument.baseURI,measures:this.labelFonts})}getViewMode(){return this.viewMode}setViewMode(t){if(t===this.viewMode)return;if(!this.tree){this.viewMode=t;return}this.navigate(t,this.focusId)}getFocusPath(){return[...this.focusPath]}getFocusedNode(){if(!this.tree)return null;return U(this.tree,this.focusId)}focusNode(t){if(!this.tree)return!1;let e=W(this.tree,t);if(e.length===0)return!1;if(this.viewMode==="focus")return this.navigate("focus",t);let n=t!==this.focusId;this.focusPath=e.map((r)=>r.id),this.outline.setCurrent(this.focusId);let i=this.scene?.nodes.get(t);if(i&&this.scene){let[,r]=this.zoomRange(),o=Math.min(this.scene.frame.scale*r,Math.max(this.camera.scale,34/i.radius));this.flyCamera(this.clampCamera({x:i.x,y:i.y,scale:o}),this.viewportCenter())}if(n)this.emitFocusChange(e);return!0}flyTo(t){return this.navigate("focus",t)}overview(){this.setViewMode("all")}zoomBy(t){this.zoomStep(t,this.viewportCenter())}fit(){if(this.scene)this.flyCamera(this.scene.frame,this.viewportCenter())}spin(t){if(this.viewMode!=="focus"||!this.scene||this.transition)return;this.userSpun=!0,this.releaseSpin(t/1000)}openMedia(t,e={}){let n=this.tree?U(this.tree,t):null;if(!n)return!1;let i=e.kind==="image"||e.kind==="video"?e.kind:ge(n,"image")?"image":"video";return this.viewer.open({node:n,kind:i},{autoplay:e.autoplay!==!1,startAt:e.startAt})}closeMedia(){this.viewer.close()}playMedia(){return this.viewer.play()}pauseMedia(){return this.viewer.pause()}seekMedia(t){return this.viewer.seek(t)}unmuteMedia(){return this.viewer.unmute()}getNodeColor(t){let e=this.tree;if(!e)return null;this.nodeColors??=Vr(e,sr(this.options.palette),(i)=>this.extensions.color(i));let n=this.nodeColors.get(t);if(!n)return null;return Ot(n,/var\(/i.test(n)?this.tokensForThisTask():{})}tokensForThisTask(){if(!this.taskTokens)this.taskTokens=this.exportTokens(),queueMicrotask(()=>{this.taskTokens=null});return this.taskTokens}getDocument(){if(!this.tree)return null;let t={root:this.tree,options:{...this.sourceOptions},warnings:[]};if(this.sourceExtra)t.extra={...this.sourceExtra};return t}toMarkdown(){let t=this.getDocument();return t?va(t):""}addNode(t,e,n){return Ld("addNode",e,`addNode('${t}', { text: 'New idea' })`),this.insertNode(t,e,n)}updateNode(t,e){Ld("updateNode",e,`updateNode('${t}', { text: 'New title' })`);let n=this.tree?Qo(this.tree,t,e):null;if(!n)return null;let{node:i,previousId:r}=n;if(i.id!==r)this.renameView(r,i.id);return this.changedIds.add(i.id),this.afterEdit("update",i),i}removeNode(t){let e=this.tree?ts(this.tree,t):null;if(!e)return null;let{node:n,parent:i}=e;return this.changedIds.add(i.id),this.afterEdit("remove",n,this.words.text("removed",{name:n.text||this.words.text("anIdea")})),n}moveNode(t,e,n){let i=this.tree?es(this.tree,t,e,n):null;if(!i)return null;let{node:r,from:o,to:s}=i;this.changedIds.add(o.id).add(s.id);let a=r.text||this.words.text("anIdea");return this.afterEdit("move",r,s.text?this.words.text("moved",{name:a,parent:s.text}):this.words.text("movedToTop",{name:a})),r}editNode(t){let e=this.tree,n=e?W(e,t):[];if(n.length===0||this.options.interactive===!1)return!1;this.stopEditing();let i=n[n.length-1],r=n[n.length-2]??null,o=(this.transition?.target??this.scene)?.nodes.get(t)?.role;if(this.viewMode==="focus"&&(o===void 0||o==="moon"))this.navigate("focus",r?.id??t);return this.editing={nodeId:t,parentId:r?.id??t,index:r?r.children.indexOf(i):0},this.editor.show(i.text,{label:this.words.text("textOf",{name:i.text||this.words.text("thisIdea")}),placeholder:i.text||this.words.text("untitled"),enterKey:"done"}),this.paint(),this.emitEditor("editor-open",i,null),!0}editNewNode(t,e){let n=this.tree,i=n?W(n,t??this.focusId):[],r=i[i.length-1];if(!r||this.options.interactive===!1||this.options.maxDepth!==void 0&&r.level>=this.options.maxDepth)return!1;this.stopEditing();let o=r.children.length,s=e===void 0||!Number.isFinite(e)?o:Math.min(o,Math.max(0,Math.trunc(e)));if(this.editing={nodeId:null,parentId:r.id,index:s},this.editor.show("",Cd(r,this.words)),this.viewMode!=="focus"||this.focusId!==r.id)this.navigate("focus",r.id);else this.refreshSlot();return this.paint(),this.emitEditor("editor-open",null,r),!0}stopEditing(t=!0){if(!this.editing)return;if(t)this.saveEdit(this.editor.value,"blur");else this.finishEditing(!1)}destroy(){if(this.destroyed)return;this.destroyed=!0,this.editing=null,this.editor.hide(),this.clock.stop(),this.input.detach(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.visibilityObserver?.disconnect(),this.visibilityObserver=null,this.svg.removeEventListener("click",this.handleClick),this.svg.removeEventListener("contextmenu",this.handleContextMenu),this.svg.removeEventListener("keydown",this.handleKeyDown),this.svg.removeEventListener("pointerover",this.handlePointerOver),this.svg.removeEventListener("pointerout",this.handlePointerOut),this.root.removeEventListener("focusin",this.handleFocusIn),this.root.removeEventListener("focusout",this.handleFocusOut);for(let t of Array.from(this.contents.keys()))this.removeContent(t);if(this.viewer.destroy(),this.sheet.destroy(),this.controls.destroy(),this.stopWatchingFonts(),this.labelFonts.destroy(),this.listeners.clear(),this.root.remove(),Mt.registry.get(this.container)===this)Mt.registry.delete(this.container)}showTree(t){let e=this.tree===null,n=this.nodeDrag;if(n){if(this.nodeDrag=null,n.moving)this.emitDrag("end",n.node,null,null)}if(this.tree=t,this.nodeColors=null,e&&this.options.focus)this.focusPath=[this.options.focus];let i=this.editing;if(i&&!U(t,i.nodeId??i.parentId))this.finishEditing(!1,!1);let r=[];for(let o=this.focusPath.length-1;o>=0&&r.length===0;o-=1)r=W(t,this.focusPath[o]);this.focusPath=r.length>0?r.map((o)=>o.id):[t.id],this.actionBar.reset(),this.lightText.clear(),this.updateEmbedding(),this.updateControls(),this.updateOutline(),this.rebuild(e||!this.scene?"enter":"morph")}isSameMap(t,e){return this.tree!==null&&this.scene!==null&&t!==this.tree&&(e===null||vt(Dd(e),Dd(this.sourceOptions)))&&$d(t,this.tree)}adoptTree(t){Ib(this.tree,t),this.nodeColors=null;let e=this.buildScene();if(!e)return;if(this.nextScene)this.nextScene=e;else if(this.transition)this.transition={...this.transition,target:e};else this.scene=e;this.actionBar.reset(),this.clock.requestPaint()}afterEdit(t,e,n){let i=this.tree,r=this.focusPath.join(`
|
|
125
|
+
`),h.appendChild(m),i.appendChild(h);continue}let l=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(s);if(l){let u=Math.min(5,Math.max(3,l[1].length+2)),h=document.createElement(`h${u}`);Tt(h,l[2],e),i.appendChild(h),o+=1;continue}if(/^\s*>/.test(s)){let u=[];while(o<r.length&&/^\s*>/.test(r[o]))u.push(r[o].replace(/^\s*>\s?/,"")),o+=1;let h=document.createElement("blockquote");if(n>=wd){let m=document.createElement("p");Tt(m,u.join(" "),e),h.appendChild(m)}else h.appendChild(kd(u.join(`
|
|
126
|
+
`),e,n+1));i.appendChild(h);continue}if(Hi.test(s)){let[u,h]=Od(r,o,e,n);i.appendChild(u),o=h;continue}let d=[];while(o<r.length&&r[o].trim()!==""&&!/^\s*(```|~~~|>|#{1,6}\s)/.test(r[o])&&!Hi.test(r[o]))d.push(r[o].trim()),o+=1;let c=document.createElement("p");Tt(c,d.join(" "),e),i.appendChild(c)}return i},Hi=/^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/,Od=(t,e,n,i)=>{let r=Hi.exec(t[e]),o=r[1].length,s=/\d/.test(r[2]),a=document.createElement(s?"ol":"ul"),l=e,d=null;while(l<t.length){let c=t[l];if(c.trim()===""){l+=1;continue}let u=Hi.exec(c),h=c.length-c.trimStart().length;if(u&&u[1].length===o&&/\d/.test(u[2])!==s)break;if(u&&u[1].length===o){d=document.createElement("li"),Tt(d,u[3],n),a.appendChild(d),l+=1;continue}if(u&&u[1].length>o&&d){if(i>=wd){d.appendChild(document.createTextNode(` ${c.trim()}`)),l+=1;continue}let[m,p]=Od(t,l,n,i+1);d.appendChild(m),l=p;continue}if(!u&&h>o&&d){d.appendChild(document.createTextNode(` ${c.trim()}`)),l+=1;continue}break}return[a,l]},yd=String.raw`\(((?:[^()\s]|\([^()\s]*\))+)\)`,Rm=new RegExp(String.raw`(`+"`"+String.raw`+)([\s\S]*?)\1|!\[([^\]]*)\]`+yd+String.raw`|\[([^\]]+)\]`+yd+String.raw`|<(https?:\/\/[^>\s]+|mailto:[^>\s]+)>|(\*\*|__)([\s\S]+?)\8|~~([\s\S]+?)~~|(\*|_)([^\s*_][\s\S]*?)\11`,"g"),Tt=(t,e,n)=>{let i=0;for(let r of e.matchAll(Rm)){let o=r.index??0;if(o>i)t.appendChild(document.createTextNode(e.slice(i,o)));if(i=o+r[0].length,r[1]!==void 0){let s=document.createElement("code");s.textContent=r[2].trim(),t.appendChild(s)}else if(r[4]!==void 0){let s=D(r[4],"image");if(s){let a=document.createElement("img");a.src=H(s,n.baseUrl),a.alt=r[3],a.loading="lazy",t.appendChild(a)}else t.appendChild(document.createTextNode(r[3]))}else if(r[6]!==void 0)t.appendChild(vd(r[6],r[5],n));else if(r[7]!==void 0)t.appendChild(vd(r[7],r[7],n));else if(r[9]!==void 0){let s=document.createElement("strong");Tt(s,r[9],n),t.appendChild(s)}else if(r[10]!==void 0){let s=document.createElement("del");Tt(s,r[10],n),t.appendChild(s)}else if(r[12]!==void 0){let s=document.createElement("em");Tt(s,r[12],n),t.appendChild(s)}}if(i<e.length)t.appendChild(document.createTextNode(e.slice(i)))},vd=(t,e,n)=>{if(rt(t)){let o=!n.resolveLink||n.resolveLink(t),s=document.createElement(o?"a":"span");if(s instanceof HTMLAnchorElement)s.href=t;return Tt(s,e,n),s}let i=D(t,"link");if(!i)return document.createTextNode(e);let r=document.createElement("a");return r.href=H(i,n.baseUrl),r.target="_blank",r.rel="noopener noreferrer",Tt(r,e,n),r},Sd=(t)=>xd(t).replace(/```[\s\S]*?```/g," ").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<(https?:\/\/[^>]+)>/g,"$1").replace(/(\*\*|__|~~|`)/g,"").replace(/([*_])(\S(?:[\s\S]*?\S)?)\1/g,"$2").replace(/^\s*(#{1,6}|>|[-*+]|\d{1,9}[.)])\s+/gm,"").replace(/\s+/g," ").trim();var $m=80,Bm=new tt("en");class Ho{host;dialog=null;request=null;returnFocus=null;constructor(t){this.host=t}get isOpen(){return this.dialog?.open??!1}get words(){return this.request?.words??Bm}get node(){return this.isOpen?this.request?.node??null:null}open(t){let e=(this.host.ownerDocument??document).activeElement;if(!this.isOpen&&(e instanceof HTMLElement||e instanceof SVGElement))this.returnFocus=e;this.request=t;let n=this.ensureDialog();if(n.replaceChildren(...this.buildContent(t)),n.setAttribute("aria-label",t.node.text||this.words.text("details")),!n.open)if(typeof n.showModal==="function")n.showModal();else n.setAttribute("open","");(t.section?n.querySelector(`[data-section="${t.section}"]`):null)?.scrollIntoView?.({block:"nearest"}),n.querySelector(".orbit-sheet__close")?.focus()}close(){let t=this.dialog;if(!t||!t.open)return;if(typeof t.close==="function")t.close();else t.removeAttribute("open");this.restoreFocus()}followLink(t){let e=this.request?.onFollowLink;this.close(),e?.(t)}destroy(){this.close(),this.dialog?.remove(),this.dialog=null,this.request=null}restoreFocus(){let t=this.returnFocus;if(this.returnFocus=null,t&&t.isConnected)t.focus({preventScroll:!0})}ensureDialog(){if(this.dialog)return this.dialog;let t=document.createElement("dialog");return t.className="orbit-sheet",t.addEventListener("close",()=>this.restoreFocus()),t.addEventListener("click",(e)=>{if(e.target===t){let n=t.getBoundingClientRect();if(!(e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom)||n.width===0&&n.height===0)this.close()}}),t.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&typeof t.showModal!=="function"){this.close();return}if((e.key==="ArrowLeft"||e.key==="ArrowRight")&&!Vm(e.target)){if(this.step(e.key==="ArrowRight"?1:-1))e.preventDefault()}}),this.enableSwipeToClose(t),this.host.appendChild(t),this.dialog=t,t}step(t){let e=this.request;if(!e)return!1;let n=e.siblings.findIndex((r)=>r.id===e.node.id),i=e.siblings[n+t];if(n===-1||!i)return!1;return e.onNavigate?.(i),this.open({...e,node:i,section:void 0}),!0}enableSwipeToClose(t){let e=null;t.addEventListener("pointerdown",(i)=>{if(i.target.closest?.(".orbit-sheet__handle, .orbit-sheet__header")&&i.pointerType!=="mouse")e=i.clientY}),t.addEventListener("pointermove",(i)=>{if(e===null)return;let r=Math.max(0,i.clientY-e);t.style.transform=r>0?`translateY(${r}px)`:""});let n=(i)=>{if(e===null)return;let r=i.clientY-e;if(e=null,t.style.transform="",r>$m)this.close()};t.addEventListener("pointerup",n),t.addEventListener("pointercancel",n)}buildContent(t){let{node:e}=t,n=z("div","orbit-sheet__handle"),i=z("header","orbit-sheet__header"),r=z("div","orbit-sheet__heading");if(t.path.length>0){let g=z("p","orbit-sheet__path");g.textContent=t.path.map((y)=>y.text).join(" › "),r.appendChild(g)}let o=z("h2","orbit-sheet__title");o.textContent=[t.extensions?t.extensions.icon(e):e.icon,e.text].filter(Boolean).join(" "),r.appendChild(o);let s=this.buildChips(e,t.extensions);if(s)r.appendChild(s);let a=z("button","orbit-button orbit-button--icon orbit-sheet__close");a.type="button",a.setAttribute("aria-label",this.words.text("close")),a.appendChild(at("close")),a.addEventListener("click",()=>this.close()),i.append(r,a);let l=z("div","orbit-sheet__body");for(let g of this.buildMedia(t))l.appendChild(g);let d=t.extensions?.details(e);if(d){let g=z("section","orbit-sheet__details");g.dataset.section="details",d(g),l.appendChild(g)}if(e.note){let g=z("div","orbit-sheet__note");g.dataset.section="note";let y=e.noteFormat??"markdown";if(t.noteRenderer)g.innerHTML=t.noteRenderer(e.note,{node:e,format:y});else if(y==="plain"){let v=z("p","");v.style.whiteSpace="pre-wrap",v.textContent=e.note,g.appendChild(v)}else g.appendChild(Ne(e.note,{baseUrl:t.baseUrl,resolveLink:t.resolveLink}));g.addEventListener("click",(v)=>{let O=v.target instanceof Element?v.target.closest('a[href^="#"]'):null,M=O?t.resolveLink?.(O.getAttribute("href")??""):null;if(M)v.preventDefault(),this.followLink(M)}),l.appendChild(g)}let c=z("footer","orbit-sheet__footer"),u=z("div",""),h=t.siblings.findIndex((g)=>g.id===e.id);if(t.siblings.length>1&&h!==-1)u.append(this.stepButton("previous",this.words.text("previous"),h>0,-1),this.stepButton("next",this.words.text("next"),h<t.siblings.length-1,1));c.appendChild(u);let m=t.extensions?.actions(e)??[];if(m.length>0){let g=z("div","orbit-sheet__actions");for(let y of m){let v=z("button","orbit-sheet__action");v.type="button",v.dataset.action=y.id,v.append(Vi(y.icon,y.label),document.createTextNode(y.label)),v.addEventListener("click",(O)=>{let M=t.extensions?.runAction;this.close(),M?.(e,y.id,O)}),g.appendChild(v)}c.appendChild(g)}let p=rt(e.link)?t.resolveLink?.(e.link)??null:null,b=e.link&&!rt(e.link)?D(e.link,"link"):null;if(p){let g=z("button","orbit-sheet__link");g.type="button",g.textContent=`${this.words.text("goTo",{name:p.text||this.words.text("theIdea")})} →`,g.addEventListener("click",()=>this.followLink(p)),c.appendChild(g)}else if(b){let g=z("a","orbit-sheet__link");g.href=H(b,t.baseUrl),g.target="_blank",g.rel="noopener noreferrer",g.textContent=`${this.words.text("openLink")} ↗`,c.appendChild(g)}let f=[n,i,l];if(u.childElementCount>0||b||p||m.length>0)f.push(c);return f}stepButton(t,e,n,i){let r=z("button","orbit-button orbit-button--icon");return r.type="button",r.setAttribute("aria-label",e),r.disabled=!n,r.appendChild(at(t)),r.addEventListener("click",()=>this.step(i)),r}buildChips(t,e){let n=[],i=e?.typeLabel(t);if(i){let o=z("span","orbit-sheet__chip orbit-sheet__chip--type");o.textContent=i,n.push(o)}if(t.status){let o=z("span","orbit-sheet__chip orbit-sheet__chip--status");o.textContent=t.status;let s=e?.status(t.status)??{tone:mn(t.status)};o.style.setProperty("--orbit-chip-dot",s.color??`var(--_orbit-status-${s.tone})`),n.push(o)}if(t.priority!==void 0){let o=z("span","orbit-sheet__chip");o.textContent=this.words.text("priority",{priority:t.priority}),n.push(o)}for(let o of t.tags??[]){let s=z("span","orbit-sheet__chip");s.textContent=`#${o}`,n.push(s)}if(n.length===0)return null;let r=z("div","orbit-sheet__chips");return r.append(...n),r}buildMedia(t){let{node:e,baseUrl:n,onViewMedia:i}=t,r=[];if(T(e.image)){let o=D(e.image.src,"image");if(o){let s=this.figure("image",e.image.caption),a=document.createElement("img");if(a.src=H(o,n),a.alt=e.image.alt??"",i){let l=z("button","orbit-sheet__picture");l.type="button",l.setAttribute("aria-label",a.alt?this.words.text("viewImageOf",{description:a.alt}):this.words.text("viewImage")),l.appendChild(a),l.addEventListener("click",(d)=>i(e,"image",d)),s.prepend(l)}else s.prepend(a);r.push(s)}}if(T(e.video)){let o=D(e.video.src,"video");if(o){let s=H(o,n),a=null;if(e.video.provider==="native"||Ln(s)||/^blob:/i.test(s)){let l=document.createElement("video");l.src=s,l.controls=!0,l.preload="metadata",a=l}else{let l=Pn(s,e.video.provider);if(a=l?pn(l,e.text):hn(s,n,e.text),a)a.loading="lazy"}if(a){let l=this.figure("video",e.video.caption);if(l.prepend(a),i)l.appendChild(this.expandButton(l,(d,c)=>i(e,"video",d,c)));r.push(l)}}}if(T(e.embed)&&!T(e.video)){let o=hn(e.embed.src,n,e.text);if(o){o.loading="lazy";let s=this.figure("embed",e.embed.caption);s.prepend(o),r.push(s)}}return r}expandButton(t,e){let n=z("button","orbit-sheet__expand");return n.type="button",n.setAttribute("aria-label",this.words.text("expandVideo")),n.append(at("expand"),document.createTextNode(this.words.text("expand"))),n.addEventListener("click",(i)=>{let r,o=t.querySelector("video");if(o)r=o.currentTime>0?o.currentTime:void 0,o.pause();let s=t.querySelector("iframe");s?.replaceWith(s.cloneNode(!0)),e(i,r)}),n}figure(t,e){let n=z("figure","orbit-sheet__media");if(n.dataset.section=t,e){let i=z("figcaption","");i.textContent=e,n.appendChild(i)}return n}}var mn=(t)=>{let e=t.trim().toLowerCase();if(/^(done|complete|completed|shipped|finished|closed)$/.test(e))return"done";if(/^(active|doing|in[ -]?progress|wip|started|ongoing)$/.test(e))return"active";if(/^(blocked|stuck|at[ -]?risk|failed)$/.test(e))return"blocked";if(/^(todo|to[ -]?do|planned|backlog|next|open)$/.test(e))return"todo";return"neutral"},z=(t,e)=>{let n=document.createElement(t);if(e)n.className=e;return n},Vm=(t)=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT|IFRAME|VIDEO)$/.test(t.tagName));var Md=(t,e,n,i,r)=>{let o=[],s=[];return Ed(t).reverse().forEach((a,l)=>{let d=`${i}-surface-${l}`,c=Hm(a,e,n,d,r)??zm(a,d,r)??Um(a,d);if(c)o.push(c),s.push(`<rect width="${e}" height="${n}" fill="url(#${d})"/>`)}),{definitions:o,layers:s}},Ed=(t)=>{let e=[],n=0,i="",r=0;for(let o=0;o<t.length;o+=1){let s=t[o];if(i)i=s===i?"":i;else if(s==='"'||s==="'")i=s;else if(s==="(")n+=1;else if(s===")")n-=1;else if(s===","&&n===0)e.push(t.slice(r,o).trim()),r=o+1}return e.push(t.slice(r).trim()),e.filter((o)=>o!==""&&o!=="none")},Nd=(t,e)=>{if(t.indexOf(`${e}(`)!==0)return null;let i=0;for(let r=e.length;r<t.length;r+=1)if(t[r]==="(")i+=1;else if(t[r]===")"){if(i-=1,i===0)return Ed(t.slice(e.length+1,r))}return null},Hm=(t,e,n,i,r)=>{let o=Nd(t,"radial-gradient");if(!o||o.length<3)return null;let s=/^(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%\s+at\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%$/.exec(o[0]);if(!s)return null;let[a,l,d,c]=s.slice(1).map(Number),u=o.slice(1).map((y,v,O)=>{let M=/^(.*?)(?:\s+(\d+(?:\.\d+)?)%)?$/.exec(y),w=M[2]!==void 0?Number(M[2])/100:v/(O.length-1);return{color:M[1].trim(),offset:w}}),h=u.find((y)=>y.color!=="transparent")?.color??"transparent",m=d/100*e,p=c/100*n,b=a/100*e,f=l/100*n;if(b<=0||f<=0)return null;let g=u.map((y)=>{let{color:v,opacity:O}=y.color==="transparent"?{color:Se(r(h)).color,opacity:0}:Se(r(y.color));return`<stop offset="${vt(y.offset)}" stop-color="${zo(v)}" stop-opacity="${vt(O)}"/>`});return`<radialGradient id="${i}" gradientUnits="userSpaceOnUse" cx="${vt(m)}" cy="${vt(p)}" r="${vt(b)}" gradientTransform="translate(${vt(m)} ${vt(p)}) scale(1 ${vt(f/b)}) translate(${vt(-m)} ${vt(-p)})">${g.join("")}</radialGradient>`},zm=(t,e,n)=>{let i=Nd(t,"linear-gradient"),r=/\)\s*0\s+0\s*\/\s*(\d+(?:\.\d+)?)px\s+(\d+(?:\.\d+)?)px\s*$/.exec(t);if(!i||!r)return null;let o=i[0]==="90deg",s=o?i.slice(1):i,a=/^(.*?)\s+(\d+(?:\.\d+)?)px$/.exec(s[0]??"");if(!a||s.length!==2||!/^transparent\s/.test(s[1]))return null;let[l,d]=[Number(r[1]),Number(r[2])],c=Number(a[2]),{color:u,opacity:h}=Se(n(a[1].trim())),m=o?`width="${c}" height="${d}"`:`width="${l}" height="${c}"`;return`<pattern id="${e}" patternUnits="userSpaceOnUse" width="${l}" height="${d}"><rect ${m} fill="${zo(u)}" fill-opacity="${vt(h)}"/></pattern>`},Um=(t,e)=>{let n=/^url\((["']?)(data:image\/.+?)\1\)\s*0\s+0\s*\/\s*(\d+(?:\.\d+)?)px\s+(\d+(?:\.\d+)?)px$/s.exec(t);if(!n)return null;let[i,r,o]=[n[2],n[3],n[4]];return`<pattern id="${e}" patternUnits="userSpaceOnUse" width="${r}" height="${o}"><image href="${zo(i)}" width="${r}" height="${o}"/></pattern>`},vt=(t)=>Math.round(t*1000)/1000,zo=(t)=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");var _d={moon:0,node:1,planet:1,sun:2},jm={sun:16,planet:13,node:12,moon:13},Wm={sun:3,planet:2,node:2,moon:2};class Uo{tokens;constructor(t){this.tokens=t}value(t,e=""){return this.tokens[t]??e}color(t){return it(t,this.tokens)}token(t,e="#000000"){return this.color(this.value(t,e))}number(t,e){let n=Number.parseFloat(this.value(t));return Number.isFinite(n)?n:e}tinted(t,e,n){let i=ft(this.color(t)),r=ft(this.token(e)),o=this.number(n,0)/100;if(!i||!r)return this.token(e);return cn(Ro(i,r,Math.min(1,Math.max(0,o))))}}var Q=(t,e,n=1)=>{let{color:i,opacity:r}=Se(e),o=lt(i),s=N(r*n),a=t==="stop"?"stop-color":t,l=t==="stop"?"stop-opacity":`${t}-opacity`;return s<1||t==="stop"?`${a}="${o}" ${l}="${s}"`:`${a}="${o}"`},jo=(t)=>t.trim()===""||t.trim()==="none"?"":` stroke-dasharray="${lt(t.trim())}"`,zi=(t,e)=>{let{viewport:n}=e,i=new Uo(e.tokens),r=Math.round(n.width),o=Math.round(n.height),s=lt(e.idPrefix??"orbit-export"),a=e.words?.text("untitled")??"Untitled",d=[`<svg xmlns="http://www.w3.org/2000/svg" ${e.responsive?'width="100%" height="100%" preserveAspectRatio="xMidYMid meet"':`width="${r}" height="${o}"`} viewBox="0 0 ${r} ${o}" role="img" aria-label="${lt(e.title)}">`,`<title>${lt(e.title)}</title>`],c=[Gm(`${s}-shade`,i)],u=[],h=i.token("surface","transparent"),m=ft(h);if(m&&m.alpha>0)u.push(`<rect width="${r}" height="${o}" ${Q("fill",h)}/>`);let p=Md(i.value("surface-pattern","none"),r,o,s,(b)=>i.color(b));if(c.push(...p.definitions),u.push(...p.layers),t){let{camera:b}=t,f=(S)=>X(b,n,S);if(e.showRings){let S=i.number("ring-opacity",0.5),G=i.number("ring-width",1.5),L=jo(i.value("ring-dash","none"));for(let F of t.rings){if(F.opacity<=0.01)continue;let I=f({x:F.cx,y:F.cy}),J=dn(F.radius*b.scale,F.gaps),Z=i.tinted(F.color,"ring-stroke","ring-tint");u.push(`<path d="${J}" transform="translate(${N(I.x)} ${N(I.y)}) rotate(${N(F.rotation)})" fill="none" ${Q("stroke",Z,S)} stroke-width="${G}"${L} stroke-linecap="round"/>`)}}let g=i.number("link-opacity",0.5),y=i.number("link-width",1.5),v=jo(i.value("link-dash","none"));for(let S of t.links){let G=t.nodes.get(S.fromId),L=t.nodes.get(S.toId);if(!G||!L)continue;let F=f(G),I=f(L),J=Math.hypot(I.x-F.x,I.y-F.y),Z=G.radius*b.scale,j=L.radius*b.scale;if(J<=Z+j)continue;let A=(I.x-F.x)/J,V=(I.y-F.y)/J,ut=i.tinted(S.color,"link-stroke","link-tint");u.push(`<line x1="${N(F.x+A*Z)}" y1="${N(F.y+V*Z)}" x2="${N(I.x-A*j)}" y2="${N(I.y-V*j)}" ${Q("stroke",ut,g)} stroke-width="${y}"${v} stroke-linecap="round"/>`)}let O=Array.from(t.nodes.values()).filter((S)=>S.opacity>0.01&&S.radius>0).sort((S,G)=>_d[S.role]-_d[G.role]),M=new Map,w=new Set,x=new Map,E=(S)=>{let G=e.extensions?.nodeType(S.node)?.tokens,L=e.extensions?.typeName(S.node)??S.node.type;if(!G||!L)return i;let F=L.toLowerCase(),I=x.get(F);if(!I){let J=Object.fromEntries(Object.entries(G).filter((Z)=>typeof Z[1]==="string"&&Z[1]!==""));I=new Uo({...e.tokens,...J}),x.set(F,I)}return I},k=(S)=>S.role!=="node"&&!No(S,S.radius*b.scale)&&E(S).number(S.role==="sun"?"sun-shadow-opacity":"node-shadow-opacity",0)>0;if(O.some(k))for(let[S,G]of[[`${s}-shadow`,an.planet],[`${s}-sun-shadow`,an.sun]])c.push(`<filter id="${S}" x="-60%" y="-60%" width="220%" height="220%"><feGaussianBlur stdDeviation="${G}"/></filter>`);O.forEach((S,G)=>{let L=E(S),F=f(S),I=S.radius*b.scale,J=e.fills?.(S),Z=J?L.color(J):L.color(S.color);M.set(S.id,Z);let j=S.role==="sun",A=L.number("node-fill-opacity",1),V=L.number("node-stroke-width",1.5);if(k(S)){let xn=L.tinted(Z,"node-shadow","node-shadow-tint"),Nc=L.number(j?"sun-shadow-opacity":"node-shadow-opacity",0),_c=I*L.number(j?"sun-shadow-size":"node-shadow-size",1),Tc=I*L.number("node-shadow-offset",0);u.push(`<circle r="1" transform="translate(${N(F.x)} ${N(F.y+Tc)}) scale(${N(_c,3)})" ${Q("fill",xn,Nc)} filter="url(#${s}-${j?"sun-shadow":"shadow"})"/>`)}if(j)u.push(...Ym(F,I,Z,L));let ut=`cx="${N(F.x)}" cy="${N(F.y)}" r="${N(I)}"`;u.push(`<circle ${ut} ${Q("fill",Z,S.role==="moon"?L.number("moon-opacity",A):A)}/>`);let Ct=To(S.node),vn=Ct?D(Ct,"image"):null;if(vn){w.add(S.id);let xn=`${s}-clip-${G}`;c.push(`<clipPath id="${xn}"><circle ${ut}/></clipPath>`),u.push(`<image href="${lt(H(vn,e.baseUrl))}" x="${N(F.x-I)}" y="${N(F.y-I)}" width="${N(I*2)}" height="${N(I*2)}" preserveAspectRatio="xMidYMid slice" clip-path="url(#${xn})"/>`)}let Mc=L.tinted(Z,"node-stroke","node-stroke-tint"),Ec=S.crowded?V*0.04*I:S.role==="moon"?V*0.7:V;u.push(`<circle ${ut} fill="url(#${s}-shade)" ${Q("stroke",Mc)} stroke-width="${N(Ec)}"/>`),u.push(...Km(S,F,I,L,e.extensions))});let C=(S)=>e.extensions?e.extensions.icon(S.node):S.node.icon,B=e.measures??on,q=Bi(t,$i(O),{viewport:n,hasImage:(S)=>w.has(S.id),hasIcon:(S)=>Boolean(C(S)),pillIcon:(S)=>w.has(S.id)?C(S):void 0,measures:B});for(let S of q)u.push(...qm(S,M.get(S.entry.id)??"#ffffff",E(S.entry),C(S.entry),B,a))}return d.push(`<defs>${c.join("")}</defs>`,...u,"</svg>"),d.join("")},Gm=(t,e)=>{let n=e.token("node-highlight","rgba(255, 255, 255, 0.5)"),i=e.token("node-terminator","rgba(0, 0, 0, 0)"),r=e.token("node-shading","rgba(0, 0, 0, 0.12)"),o=Eo.map(({offset:a,part:l})=>{switch(l){case"highlight":return`<stop offset="${a}" ${Q("stop",n)}/>`;case"highlight-fade":return`<stop offset="${a}" ${Q("stop",n,0.2)}/>`;case"terminator-start":return`<stop offset="${a}" ${Q("stop",i,0)}/>`;case"terminator":return`<stop offset="${a}" ${Q("stop",i)}/>`;default:return`<stop offset="${a}" ${Q("stop",r)}/>`}}),s=wi(e.value("node-shade-circle",""));return`<radialGradient id="${t}" cx="${s.x}" cy="${s.y}" r="${s.radius}">${o.join("")}</radialGradient>`},Ym=(t,e,n,i)=>{let r=i.number("sun-halo-opacity",0),o=i.number("sun-halo-width",0);if(r<=0||o<=0)return[];let s=i.tinted(n,"sun-halo","sun-halo-tint"),a=jo(i.value("sun-halo-dash","none"));return[`<circle cx="${N(t.x)}" cy="${N(t.y)}" r="${N(e*i.number("sun-halo-size",1.15))}" fill="none" ${Q("stroke",s,r)} stroke-width="${o}"${a}/>`]},Km=(t,e,n,i,r)=>{let o=[],s=Q("stroke",i.token("badge-stroke","#ffffff")),a=t.role==="sun";if(t.node.status&&n>6){let l=(a?0.68:0.72)*n,d=r?.status(t.node.status)??{tone:mn(t.node.status)},c=d.color??i.token(`status-${d.tone}`,"#94a3b8");o.push(`<circle cx="${N(e.x+l)}" cy="${N(e.y-l)}" r="${N((a?0.11:0.17)*n)}" ${Q("fill",c)} ${s} stroke-width="${N((a?0.025:0.04)*n)}"/>`)}if(a||n<=8)return o;if(T(t.node.video)){let l=e.x+0.62*n,d=e.y+0.62*n,c=0.3*n;o.push(`<circle cx="${N(l)}" cy="${N(d)}" r="${N(c)}" fill="#0f172a" fill-opacity="0.62"/>`),o.push(`<path d="M${N(l-0.32*c)} ${N(d-0.48*c)} L${N(l+0.52*c)} ${N(d)} L${N(l-0.32*c)} ${N(d+0.48*c)} Z" fill="#ffffff"/>`)}else if(t.node.note||T(t.node.image)||T(t.node.embed)||t.node.link||r?.nodeType(t.node)?.details)o.push(`<circle cx="${N(e.x+0.72*n)}" cy="${N(e.y+0.72*n)}" r="${N(0.13*n)}" ${Q("fill",i.token("note-indicator","#1b2333"))} ${s} stroke-width="${N(0.04*n)}"/>`);return o},qm=(t,e,n,i,r,o)=>{let{entry:s,x:a,y:l,screenRadius:d}=t,c=s.node.text||o,u=s.role==="sun",h=lt(n.value(u?"display-font":"label-font",n.value("font-family","sans-serif"))),m=lt(n.value(u?"display-weight":"label-weight",u?"650":"600")),p=n.value("label-letter-spacing","0").trim(),b=p==="0"||p===""||p==="normal"?"":` letter-spacing="${lt(p)}"`,f=t.opacity>=0.999?"":` opacity="${N(t.opacity)}"`,g=t.placement==="inside"?ke(s.role,d,c,Boolean(i),r.inside(s.role,s.node)):null;if(t.placement==="outside"){let S=t.lines,G=r.pill(s.role,s.node),L=t.text||o,F=Ri(L,{x:a,y:l},d,t.direction,u?280:160,t.offset,S,G),I=F.right-F.left,J=mo(L,I-12,11.5,S,G).lines,Z=(F.top+F.bottom)/2,j=S===1?20:34,A=14,V=Z-(J.length-1)*14/2+4.14,ut=J.map((Ct,vn)=>`<tspan x="${N((F.left+F.right)/2)}" y="${N(V+vn*14)}">${lt(Ct)}</tspan>`).join("");return[`<g${f}>`,`<rect x="${N(F.left)}" y="${N(Z-j/2)}" width="${N(I)}" height="${j}" rx="10" ${Q("fill",n.token("control-background","#ffffff"))}/>`,`<text text-anchor="middle" font-family="${h}" font-size="11.5" font-weight="${m}"${b} ${Q("fill",n.token("control-text","#1b2333"))}>${ut}</text>`,"</g>"]}let y=g?.fontSize??jm[s.role],v=g?.lines??mo(c,d*1.68,y,Wm[s.role],r.inside(s.role,s.node)).lines,O=i&&(g?.icon??!0)?[i,...v]:v,M=y*1.22,w=n.token("node-text-inverse","#ffffff"),x=n.token(u?"root-text":"node-text","#1b2333"),E=Ii(e,w,x)?w:x,k=l-(O.length-1)*M/2+y*0.35,C=O.map((q,S)=>`<tspan x="${N(a)}" y="${N(k+S*M)}">${lt(q)}</tspan>`).join(""),B=g?.stretch?` font-stretch="${g.stretch}%"`:"";return[`<text text-anchor="middle" font-family="${h}" font-size="${y}" font-weight="${m}"${B}${b} ${Q("fill",E)}${f}>${C}</text>`]},lt=(t)=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),N=(t,e=2)=>{let n=10**e;return Math.round(t*n)/n};var Zm=4,Td=12,Xm={width:40,height:108},Jm={width:48,height:132};class Wo{element;callbacks;back;backLabel;breadcrumbs;breadcrumbPanel;viewGroup;focusButton;overviewButton;outlineButton;zoomPanel;zoomInButton;fitButton;zoomOutButton;hint;hintTimer=null;parentId=null;words;state=null;constructor(t,e){this.callbacks=t,this.words=e,this.element=dt("div","orbit-controls");let n=dt("div","orbit-controls__top"),i=dt("div","orbit-controls__start");this.back=Go("orbit-button orbit-panel orbit-back","back"),this.backLabel=dt("span",""),this.back.appendChild(this.backLabel),this.back.addEventListener("click",()=>{if(this.parentId)this.callbacks.onNavigate(this.parentId)}),this.breadcrumbPanel=dt("div","orbit-panel orbit-controls__crumbs"),this.breadcrumbs=dt("nav","orbit-breadcrumbs"),this.breadcrumbPanel.appendChild(this.breadcrumbs),i.append(this.back,this.breadcrumbPanel),this.viewGroup=dt("div","orbit-panel"),this.viewGroup.setAttribute("role","group"),this.focusButton=Fd("focus"),this.focusButton.addEventListener("click",()=>this.callbacks.onViewMode("focus")),this.overviewButton=Fd("overview"),this.overviewButton.addEventListener("click",()=>this.callbacks.onViewMode("all")),this.outlineButton=Ui("list",()=>this.callbacks.onToggleOutline()),this.viewGroup.append(this.focusButton,this.overviewButton,this.outlineButton),n.append(i,this.viewGroup);let r=dt("div","orbit-controls__zoom");this.zoomPanel=dt("div","orbit-panel orbit-panel--vertical"),this.zoomPanel.setAttribute("role","group"),this.zoomInButton=Ui("zoom-in",()=>this.callbacks.onZoom(1)),this.fitButton=Ui("fit",()=>this.callbacks.onFit()),this.zoomOutButton=Ui("zoom-out",()=>this.callbacks.onZoom(-1)),this.zoomPanel.append(this.zoomInButton,this.fitButton,this.zoomOutButton),r.appendChild(this.zoomPanel),this.hint=dt("div","orbit-hint"),this.hint.setAttribute("role","status"),this.element.append(n,r,this.hint),this.relabel(e)}relabel(t){if(this.words=t,this.breadcrumbs.setAttribute("aria-label",t.text("mapPath")),this.viewGroup.setAttribute("aria-label",t.text("view")),_e(this.focusButton,t.text("focus")),_e(this.overviewButton,t.text("overview")),_e(this.outlineButton,t.text("showOutline")),this.zoomPanel.setAttribute("aria-label",t.text("zoom")),_e(this.zoomInButton,t.text("zoomIn")),_e(this.fitButton,t.text("fitMap")),_e(this.zoomOutButton,t.text("zoomOut")),this.state)this.update(this.state)}update(t){this.state=t,this.focusButton.setAttribute("aria-pressed",String(t.viewMode==="focus")),this.overviewButton.setAttribute("aria-pressed",String(t.viewMode==="all")),this.outlineButton.setAttribute("aria-pressed",String(t.outlineOpen));let e=t.viewMode==="focus"&&t.path.length>1,n=e?t.path[t.path.length-2]:null;this.parentId=n?.id??null,this.back.hidden=!n,this.backLabel.textContent=n?n.text||this.words.text("back"):"",this.back.setAttribute("aria-label",n?.text?this.words.text("backTo",{name:n.text}):n?this.words.text("backToParent"):this.words.text("back")),this.breadcrumbPanel.hidden=!e,this.breadcrumbs.replaceChildren(...e?this.crumbs(t.path):[])}zoomBox(t,e){if(this.element.hidden)return null;let n=si(this.element)?Jm:Xm,i=t-Td,r=e-Td;return{left:i-n.width,top:r-n.height,right:i,bottom:r}}showHint(t,e=1800){if(this.hint.textContent=t,this.hint.classList.add("orbit-hint--visible"),this.hintTimer)clearTimeout(this.hintTimer);this.hintTimer=setTimeout(()=>{this.hint.classList.remove("orbit-hint--visible"),this.hintTimer=null},e)}destroy(){if(this.hintTimer)clearTimeout(this.hintTimer);this.element.remove()}crumbs(t){let e=t.length>Zm?[0,-1,t.length-2,t.length-1]:t.map((i,r)=>r),n=[];return e.forEach((i,r)=>{if(r>0){let d=at("chevron");d.classList.add("orbit-breadcrumbs__separator"),n.push(d)}if(i===-1){let d=dt("span","orbit-button orbit-breadcrumbs__item");d.textContent="…",d.title=t.slice(1,t.length-2).map((c)=>c.text).join(" › "),n.push(d);return}let o=t[i],s=i===t.length-1,a=dt("button","orbit-button orbit-breadcrumbs__item");if(a.type="button",i===0)a.appendChild(at("home"));let l=dt("span","");if(l.textContent=o.text||this.words.text("untitled"),a.appendChild(l),a.title=o.text,s)a.setAttribute("aria-current","location"),a.disabled=!0;else a.addEventListener("click",()=>this.callbacks.onNavigate(o.id));n.push(a)}),n}}var dt=(t,e)=>{let n=document.createElement(t);if(e)n.className=e;return n},Go=(t,e)=>{let n=dt("button",t);return n.type="button",n.appendChild(at(e)),n},Fd=(t)=>{let e=Go("orbit-button",t);return e.appendChild(dt("span","orbit-segmented__label")),e},Ui=(t,e)=>{let n=Go("orbit-button orbit-button--icon",t);return n.addEventListener("click",e),n},_e=(t,e)=>{t.setAttribute("aria-label",e),t.title=e;let n=t.querySelector(".orbit-segmented__label");if(n)n.textContent=e};class Yo{element;live;onSelect;visible=!1;icon=(t)=>t.icon;entries=new Map;currentId=null;words;constructor(t,e){this.onSelect=t,this.words=e,this.element=document.createElement("nav"),this.element.className="orbit-outline orbit-visually-hidden",this.live=document.createElement("div"),this.live.className="orbit__live",this.live.setAttribute("aria-live","polite"),this.live.setAttribute("role","status"),this.relabel(e)}relabel(t){this.words=t,this.element.setAttribute("aria-label",t.text("outline"))}get isVisible(){return this.visible}update(t,e,n,i,r=(o)=>o.icon){this.icon=r,this.entries.clear(),this.currentId=null;let o=document.createElement("ul");o.appendChild(this.item(t,n,i)),this.element.replaceChildren(o),this.setCurrent(e)}setCurrent(t){if(t===this.currentId)return;if(this.currentId!==null)this.entries.get(this.currentId)?.removeAttribute("aria-current");if(this.currentId=t,t!==null)this.entries.get(t)?.setAttribute("aria-current","true")}setVisible(t){this.visible=t,this.element.classList.toggle("orbit-visually-hidden",!t),this.element.classList.toggle("orbit-outline--visible",t);for(let e of this.element.querySelectorAll("button"))e.tabIndex=t?0:-1;if(t)this.element.querySelector('[aria-current="true"]')?.focus()}announce(t){this.live.textContent="",setTimeout(()=>{this.live.textContent=t},30)}item(t,e,n){let i=document.createElement("li"),r=document.createElement(n?"button":"span");if(r.textContent=[this.icon(t),t.text||this.words.text("untitled")].filter(Boolean).join(" "),t.status)r.textContent+=` (${t.status})`;if(!this.entries.has(t.id))this.entries.set(t.id,r);if(r instanceof HTMLButtonElement)r.type="button",r.tabIndex=this.visible?0:-1,r.addEventListener("click",()=>this.onSelect(t.id));if(i.appendChild(r),(e===void 0||t.level<e)&&t.children.length>0){let s=document.createElement("ul");for(let a of t.children)s.appendChild(this.item(a,e,n));i.appendChild(s)}return i}}class Ko{element;title;detail;constructor(){this.element=document.createElement("div"),this.element.className="orbit-tooltip",this.element.setAttribute("role","tooltip"),this.element.setAttribute("aria-hidden","true"),this.title=document.createElement("span"),this.title.className="orbit-tooltip__title",this.detail=document.createElement("span"),this.detail.className="orbit-tooltip__detail",this.element.append(this.title,this.detail)}get isVisible(){return this.element.classList.contains("orbit-tooltip--visible")}show(t,e,n,i){this.title.textContent=t,this.detail.textContent=e,this.detail.hidden=e==="",this.place(n,i),this.element.classList.add("orbit-tooltip--visible")}place(t,e){this.element.style.transform=ge(Math.round(t),Math.round(e),"-50%, calc(-100% - 10px)")}hide(){this.element.classList.remove("orbit-tooltip--visible")}}var ji=1.7777777777777777,Qm=0.5625,tb=250,eb=250,nb=40,ib=0,rb=1,ob=3,sb=["play","playing","pause","ended","timeupdate","seeked","volumechange"],Id=(t,e)=>{let n=D(t.src,"video");if(!n)return null;let i=H(n,e.baseUrl),r=t.provider==="youtube"||t.provider==="vimeo"||t.provider==="native"?t.provider:et(i);if(r==="native"||Ln(i)||/^blob:/i.test(i))return new Ld(i,e);let o=r==="youtube"||r==="vimeo"?Pn(i,r):null;if(o&&r==="youtube"){let a=pn(ab(o,e),e.title);return a?new Xo(a,e,Or(i)?Qm:ji):null}if(o&&r==="vimeo"){let a=pn(lb(o,e),e.title);return a?new Pd(a,e):null}let s=hn(i,e.baseUrl,e.title);return s?new Dd(s):null},ab=(t,e)=>{let n=new URL(t);if(n.searchParams.set("enablejsapi","1"),n.searchParams.set("autoplay",e.autoplay?"1":"0"),n.searchParams.set("playsinline","1"),n.searchParams.set("rel","0"),!e.controls)n.searchParams.set("controls","0");let i=Ad(e.startAt);if(i>0)n.searchParams.set("start",String(i));let r=db();if(r)n.searchParams.set("origin",r);return n.href},lb=(t,e)=>{let n=new URL(t);if(n.searchParams.set("autoplay",e.autoplay?"1":"0"),n.searchParams.set("playsinline","1"),n.searchParams.set("dnt","1"),!e.controls)n.searchParams.set("controls","0");let i=Ad(e.startAt);if(i>0)n.hash=`t=${i}s`;return n.href},Ad=(t)=>Number.isFinite(t)?Math.max(0,Math.floor(t)):0,db=()=>{if(typeof location>"u"||!/^https?:$/.test(location.protocol))return null;return location.origin};class qo{last=null;lastAt=0;listener;constructor(t){this.listener=t}report(t){let e=performance.now(),n=this.last;if(n){let i=n.playing===t.playing&&n.ended===t.ended&&n.muted===t.muted&&n.duration===t.duration,r=n.time+(n.playing?(e-this.lastAt)/1000:0),o=Math.abs(t.time-r)>1;if(i&&!o&&(t.time===n.time||e-this.lastAt<tb))return}this.last={...t},this.lastAt=e,this.listener({...t})}}var Cd=["loadedmetadata","durationchange","play","playing","pause","ended","seeked","timeupdate","volumechange","error"];class Ld{element;controllable=!0;ratio=ji;options;reporter;startAt;constructor(t,e){this.options=e,this.reporter=new qo(e.onState),this.startAt=Number.isFinite(e.startAt)?Math.max(0,e.startAt):0;let n=document.createElement("video");if(this.element=n,n.className="orbit-viewer__video",n.controls=e.controls,n.playsInline=!0,n.setAttribute("playsinline",""),n.preload="metadata",e.autoplay)n.autoplay=!0,n.setAttribute("autoplay","");if(e.poster)n.setAttribute("poster",e.poster);n.setAttribute("aria-label",e.title);for(let i of Cd)n.addEventListener(i,this.handleEvent);if(n.src=t,e.autoplay)this.play()}get state(){let t=this.element;return{playing:!t.paused&&!t.ended,time:Number.isFinite(t.currentTime)?t.currentTime:0,duration:Number.isFinite(t.duration)&&t.duration>0?t.duration:null,ended:t.ended,muted:t.muted}}play(){let t=this.element;t.play()?.catch?.((n)=>{if(n?.name==="NotAllowedError"&&!t.muted)t.muted=!0,t.play()?.catch?.(()=>{return})})}pause(){this.element.pause()}seek(t){if(Number.isFinite(t))this.element.currentTime=Math.max(0,t)}unmute(){let t=this.element;if(t.muted=!1,t.volume===0)t.volume=1}setControls(t){this.element.controls=t}destroy(){let t=this.element;for(let e of Cd)t.removeEventListener(e,this.handleEvent);t.pause(),t.removeAttribute("src");try{t.load()}catch{}}handleEvent=(t)=>{let e=this.element;if(t.type==="error"){this.options.onError();return}if(t.type==="loadedmetadata"){if(e.videoWidth>0&&e.videoHeight>0)this.ratio=e.videoWidth/e.videoHeight,this.options.onRatio(this.ratio);if(this.startAt>0)e.currentTime=this.startAt,this.startAt=0}this.reporter.report(this.state)}}class Zo{element;controllable=!0;ratio;options;reporter;current={playing:!1,time:0,duration:null,ended:!1,muted:!1};origin;ready=!1;queue=[];autoplayed=!1;owner;constructor(t,e,n){this.element=t,this.options=e,this.ratio=n,this.reporter=new qo(e.onState),this.origin=new URL(t.src).origin,this.owner=t.ownerDocument.defaultView??(typeof window>"u"?null:window),this.owner?.addEventListener("message",this.handleMessage),t.addEventListener("load",this.handleLoad)}get state(){return{...this.current}}setControls(){}destroy(){this.owner?.removeEventListener("message",this.handleMessage),this.element.removeEventListener("load",this.handleLoad),this.queue=[]}send(t){if(this.ready)this.post(t);else this.queue.push(t)}post(t){this.element.contentWindow?.postMessage(t,this.origin)}becomeReady(){if(this.ready)return;if(this.ready=!0,this.options.autoplay&&!this.autoplayed)this.autoplayed=!0,this.post(this.playMessage());let t=this.queue;this.queue=[];for(let e of t)this.post(e)}report(){this.reporter.report(this.current)}handleLoad=()=>{this.loaded()};handleMessage=(t)=>{if(t.source!==this.element.contentWindow||t.origin!==this.origin)return;let e=cb(t.data);if(e)this.received(e)}}class Xo extends Zo{static channels=0;channel=++Xo.channels;listening=null;play(){this.command("playVideo")}pause(){this.command("pauseVideo")}seek(t){if(Number.isFinite(t))this.command("seekTo",[Math.max(0,t),!0])}unmute(){this.command("unMute")}destroy(){this.stopListening(),super.destroy()}playMessage(){return this.message("playVideo")}loaded(){if(this.stopListening(),this.ready)return;let t=0,e=()=>this.post(JSON.stringify({event:"listening",id:this.channel,channel:"widget"}));e(),this.listening=setInterval(()=>{if(t+=1,t>=nb||this.ready){this.stopListening();return}e()},eb)}received(t){switch(t.event){case"initialDelivery":case"onReady":case"infoDelivery":this.stopListening(),this.becomeReady(),this.apply(t.info);break;case"onStateChange":if(typeof t.info==="number")this.apply({playerState:t.info});break}}apply(t){if(!t||typeof t!=="object")return;let e=t,n=this.current;if(typeof e.currentTime==="number"&&Number.isFinite(e.currentTime))n.time=e.currentTime;if(typeof e.duration==="number"&&e.duration>0)n.duration=e.duration;if(typeof e.muted==="boolean")n.muted=e.muted;if(typeof e.playerState==="number"&&e.playerState!==ob)n.playing=e.playerState===rb,n.ended=e.playerState===ib;this.report()}command(t,e=[]){this.send(this.message(t,e))}message(t,e=[]){return JSON.stringify({event:"command",func:t,args:e,id:this.channel,channel:"widget"})}stopListening(){if(this.listening!==null)clearInterval(this.listening),this.listening=null}}class Pd extends Zo{width=0;height=0;constructor(t,e){super(t,e,ji)}play(){this.send({method:"play"})}pause(){this.send({method:"pause"})}seek(t){if(Number.isFinite(t))this.send({method:"setCurrentTime",value:Math.max(0,t)})}unmute(){this.send({method:"setMuted",value:!1})}playMessage(){return{method:"play"}}loaded(){this.post({method:"ping"})}received(t){if(t.event==="ready"||t.method==="ping"){if(!this.ready){for(let i of sb)this.post({method:"addEventListener",value:i});for(let i of["getDuration","getVideoWidth","getVideoHeight","getPaused","getMuted"])this.post({method:i})}this.becomeReady();return}let e=this.current,n=t.data&&typeof t.data==="object"?t.data:{};if(typeof n.seconds==="number")e.time=n.seconds;if(typeof n.duration==="number"&&n.duration>0)e.duration=n.duration;switch(t.event){case"play":case"playing":e.playing=!0,e.ended=!1;break;case"pause":e.playing=!1;break;case"ended":e.playing=!1,e.ended=!0;break;case"volumechange":e.muted=n.muted===!0||n.volume===0;break}switch(t.method){case"getDuration":if(typeof t.value==="number"&&t.value>0)e.duration=t.value;break;case"getPaused":if(typeof t.value==="boolean")e.playing=!t.value;break;case"getMuted":if(typeof t.value==="boolean")e.muted=t.value;break;case"getVideoWidth":case"getVideoHeight":if(typeof t.value==="number"&&t.value>0){if(t.method==="getVideoWidth")this.width=t.value;else this.height=t.value;if(this.width>0&&this.height>0)this.ratio=this.width/this.height,this.options.onRatio(this.ratio)}return}this.report()}}class Dd{element;ratio=ji;controllable=!1;state={playing:!1,time:0,duration:null,ended:!1,muted:!1};constructor(t){this.element=t}play(){}pause(){}seek(){}unmute(){}setControls(){}destroy(){}}var cb=(t)=>{let e=t;if(typeof e==="string")try{e=JSON.parse(e)}catch{return null}return e&&typeof e==="object"&&!Array.isArray(e)?e:null};var Gi={scale:1,x:0,y:0};var Rd=(t,e,n=!1)=>{if(!(t.width>0&&t.height>0&&e.width>0&&e.height>0))return{width:0,height:0};let i=Math.min(e.width/t.width,e.height/t.height);if(!n)i=Math.min(i,2);return{width:t.width*i,height:t.height*i}},$d=(t,e)=>{if(!(e.width>0&&t.width>0))return 1;return Math.max(4,2*t.width/e.width)},bn=(t,e,n,i)=>{let r=Wi(t.scale,1,Math.max(1,i)),o=Math.max(0,(e.width*r-n.width)/2),s=Math.max(0,(e.height*r-n.height)/2);return{scale:r,x:Wi(t.x,-o,o)||0,y:Wi(t.y,-s,s)||0}},Jo=(t,e,n,i,r,o)=>{let s=Wi(t.scale*e,1,Math.max(1,o)),a=s/t.scale,l={scale:s,x:n.x-(n.x-t.x)*a,y:n.y-(n.y-t.y)*a};return bn(l,i,r,o)},Bd=(t,e,n,i,r,o)=>bn({scale:t.scale,x:t.x+e,y:t.y+n},i,r,o),Vd=(t,e,n,i,r,o)=>{if(Yi(t))return Gi;let s=i.width>0?n.width/i.width:1;return Jo(t,Math.max(2,s)/t.scale,e,i,r,o)},Yi=(t)=>t.scale>1.001,Wi=(t,e,n)=>Math.min(n,Math.max(e,t));var Hd=16,ub=72,zd=720,Qo=60,hb=44,Ki=1.5,Ud=0.15,pb=4,mb=8,bb=60,jd=100,fb=320,gb=28,yb="button, a, video, iframe, input, select, textarea",Ce=(t,e)=>{if(e==="image")return T(t.image)&&D(t.image.src,"image")!==null;return T(t.video)&&D(t.video.src,"video")!==null},Wd=(t,e)=>{let n=[],i=[t];while(i.length>0){let r=i.pop();if(Ce(r,"image"))n.push({node:r,kind:"image"});if(Ce(r,"video"))n.push({node:r,kind:"video"});if(e===void 0||r.level<e)for(let o=r.children.length-1;o>=0;o-=1)i.push(r.children[o])}return n};class qi{static count=0;host;context;id=`orbit-viewer-${(++qi.count).toString(36)}`;dialog=null;parts=null;shown=!1;items=[];index=0;picture=null;player=null;playerBox=null;returnFocus=null;resizeObserver=null;pointers=new Map;press=null;pinch=null;suppressClick=!1;lastTap=null;settleTimer=null;constructor(t,e){this.host=t,this.context=e}get isOpen(){return this.shown}get item(){return this.shown?this.items[this.index]??null:null}get video(){return this.shown&&this.player?.controllable?this.player:null}open(t,e={}){if(!Ce(t.node,t.kind))return!1;let n=this.context.items(),i=n.findIndex((s)=>s.node.id===t.node.id&&s.kind===t.kind);if(i===-1)n=[t],i=0;let r=this.ensureDialog(),o=!this.shown;if(o)this.returnFocus=ts(this.host);if(this.items=n,this.show(i,e),o){if(this.shown=!0,!r.open)try{r.showModal()}catch{r.setAttribute("open","")}this.observeStage(),r.focus({preventScroll:!0})}return this.layout(),this.context.onShow(this.items[this.index],this.index,this.items.length),!0}close(){if(!this.shown)return;let t=this.dialog;if(t.open)if(typeof t.close==="function")t.close();else t.removeAttribute("open");this.finish()}step(t){return this.go(this.index+t)}refresh(){if(!this.shown)return;let t=this.items[this.index],e=this.context.items(),n=e.findIndex((o)=>o.node.id===t.node.id&&o.kind===t.kind);if(n===-1){let o=this.context.node(t.node.id);if(!o||!Ce(o,t.kind)){this.close();return}e=[{node:o,kind:t.kind}],n=0}let i=e[n],r=(o)=>o.kind==="image"?o.node.image?.src:o.node.video?.src;if(this.items=e,r(i)!==r(t)){this.show(n,{autoplay:!1}),this.layout();return}this.index=n,this.player?.setControls(this.context.interactive()),this.describe(),this.layout()}play(){let t=this.video;return t?.play(),t!==null}pause(){let t=this.video;return t?.pause(),t!==null}seek(t){let e=this.video;if(!e||!Number.isFinite(t))return!1;return e.seek(t),!0}unmute(){let t=this.video;return t?.unmute(),t!==null}destroy(){this.close(),this.dialog?.remove(),this.dialog=null,this.parts=null}relabel(){let t=this.parts;if(!t)return;let e=this.context.words();if(t.zoomGroup.setAttribute("aria-label",e.text("zoom")),Fe(t.zoomOut,e.text("zoomOut")),Fe(t.zoomIn,e.text("zoomIn")),Fe(t.fit,e.text("fitPicture")),Fe(t.close,e.text("close")),Fe(t.previous,e.text("previous")),Fe(t.next,e.text("next")),this.shown)this.describe()}go(t){if(!this.shown||t<0||t>=this.items.length||t===this.index)return!1;let n=this.parts.layer.contains(ts(this.host));if(this.show(t,{autoplay:!0}),this.layout(),n)this.dialog?.focus({preventScroll:!0});return this.context.onShow(this.items[this.index],this.index,this.items.length),!0}show(t,e){let n=this.parts;this.clearMedia(),this.index=t;let i=this.items[t];if(this.setStatus(null),i.kind==="image")this.showPicture(i.node);else this.showVideo(i.node,e);n.layer.classList.remove("orbit-viewer__media--entering"),n.layer.offsetWidth,n.layer.classList.add("orbit-viewer__media--entering"),this.describe()}showPicture(t){let e=this.parts,n=t.image,i=H(D(n.src,"image"),this.context.baseUrl()),r=document.createElement("img");r.className="orbit-viewer__picture",r.alt=n.alt?.trim()||n.caption?.trim()||t.text||this.context.words().text("picture"),r.draggable=!1,r.decoding="async";let o={element:r,natural:null,scalable:/\.svgz?(?:[?#]|$)/i.test(i),fitted:{width:0,height:0},view:Gi,maximum:1};if(this.picture=o,r.addEventListener("load",()=>this.pictureLoaded(o)),r.addEventListener("error",()=>{if(this.picture===o)this.setStatus(this.context.words().text("pictureUnavailable"))}),this.setStatus("",!0),r.src=i,e.layer.appendChild(r),r.complete&&r.naturalWidth>0)this.pictureLoaded(o)}pictureLoaded(t){if(this.picture!==t||t.natural)return;let{naturalWidth:e,naturalHeight:n}=t.element;t.natural=e>0&&n>0?{width:e,height:n}:{width:1,height:1},t.scalable||=!(e>0&&n>0),this.setStatus(null),this.layout()}showVideo(t,e){let n=this.parts,i=t.video,r=this.context.baseUrl(),o=i.thumbnail?D(i.thumbnail,"image"):null,s=null;if(s=Id(i,{autoplay:e.autoplay!==!1,controls:this.context.interactive(),startAt:e.startAt,title:t.text||i.caption||this.context.words().text("video"),poster:o?H(o,r):void 0,baseUrl:r,onState:(l)=>{if(s!==null&&this.player===s)this.context.onState(this.items[this.index].node,l)},onRatio:()=>{if(s!==null&&this.player===s)this.layout()},onError:()=>{if(s!==null&&this.player===s)this.setStatus(this.context.words().text("videoUnavailable"))}}),!s){this.setStatus(this.context.words().text("videoUnavailableHere"));return}this.player=s;let a=document.createElement("div");a.className="orbit-viewer__player",a.appendChild(s.element),this.playerBox=a,n.layer.appendChild(a)}clearMedia(){this.resetGestures(),this.player?.destroy(),this.player=null,this.picture=null,this.playerBox=null,this.parts?.layer.replaceChildren(),this.dialog?.classList.remove("orbit-viewer--zoomed")}describe(){let t=this.parts,e=this.dialog,n=this.items[this.index],{node:i}=n,r=n.kind==="image"?i.image:i.video,o=this.context.interactive();e.classList.toggle("orbit-viewer--still",!o),e.dataset.orbitMedia=n.kind;let s=[this.context.icon(i),i.text].filter(Boolean).join(" ");t.title.textContent=s;let a=r?.caption?.trim()??"";t.text.textContent=a,t.text.hidden=a==="";let l=n.kind==="image"?i.image?.alt?.trim()??"":"";t.description.textContent=l,t.description.hidden=l===""||l===a;let d=this.items.length,c=d>1?this.context.words().text("position",{index:this.index+1,total:d}):"",u=c&&s?`: ${s}`:"";if(t.counter.textContent!==c+u){let m=document.createElement("span");m.textContent=c;let p=document.createElement("span");p.className="orbit-visually-hidden",p.textContent=u,t.counter.replaceChildren(...c?[m,p]:[])}t.previous.hidden=d<2,t.next.hidden=d<2,t.previous.disabled=this.index===0,t.next.disabled=this.index===d-1;let h=this.mediaLink(n);if(t.link.hidden=h===null,h)t.link.href=h.href,t.link.setAttribute("aria-label",h.label),t.link.title=h.label;else t.link.removeAttribute("href");t.zoomGroup.hidden=n.kind!=="image",this.updateZoomButtons(),this.keepFocus()}mediaLink(t){let{node:e}=t,n=this.context.baseUrl();if(t.kind==="image"){let d=e.image?.src??"",c=/^\s*(?:data|blob):/i.test(d)?null:D(d,"link");return c?{href:H(c,n),label:this.context.words().text("openPictureInNewTab")}:null}let i=e.video;if(!i||/^\s*(?:data|blob):/i.test(i.src))return null;let r=D(i.src,"link");if(!r)return null;let o=H(r,n),s=i.provider==="youtube"||i.provider==="vimeo"?i.provider:et(o),a=this.context.words(),l=s==="youtube"?a.text("watchOn",{provider:"YouTube"}):s==="vimeo"?a.text("watchOn",{provider:"Vimeo"}):a.text("openVideoInNewTab");return{href:Dn(o,i.provider),label:l}}setStatus(t,e=!1){let n=this.parts;n.status.textContent=t??"",n.status.hidden=t===null,n.status.classList.toggle("orbit-viewer__status--loading",e),n.stage.setAttribute("aria-busy",String(e))}layout(){let t=this.parts;if(!this.shown||!t)return;let e=this.readStageBox(),n=this.items.length>1&&this.context.interactive(),i=n&&this.playerBox!==null&&e.width<zd,r=this.mediaRoom(e,n,i),o=this.picture;if(o?.natural){let l=Rd(o.natural,r,o.scalable);o.fitted=l,o.maximum=$d(o.natural,l);let d=o.element.style;d.width=`${pt(l.width)}px`,d.height=`${pt(l.height)}px`,d.left=`${pt((e.width-l.width)/2)}px`,d.top=`${pt((e.height-l.height)/2)}px`,this.setView(bn(o.view,l,e,o.maximum),!1)}let s=this.playerBox,a="";if(s&&this.player){let l=this.player.ratio,d=Math.max(0,Math.min(r.width,r.height*l)),c=d/l,u=(e.height-c-(i?Qo:0))/2;if(s.style.width=`${pt(d)}px`,s.style.height=`${pt(c)}px`,s.style.left=`${pt((e.width-d)/2)}px`,s.style.top=`${pt(u)}px`,i)a=`${pt(u+c+(Qo-hb)/2)}px`}t.previous.style.top=a,t.next.style.top=a}mediaRoom(t,e,n){let i=e&&t.width>=zd?ub:Hd,r=n?Qo:0;return{width:Math.max(0,t.width-2*i),height:Math.max(0,t.height-2*Hd-r)}}readStageBox(){let t=this.parts.stage.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}stagePoint(t){let e=this.readStageBox();return{x:t.x-e.left-e.width/2,y:t.y-e.top-e.height/2}}setView(t,e){let n=this.picture;if(!n)return;n.view=t;let i=n.element;i.classList.toggle("orbit-viewer__picture--gliding",e),i.style.transform=`translate(${pt(t.x)}px, ${pt(t.y)}px) scale(${Math.round(t.scale*1e4)/1e4})`,this.dialog?.classList.toggle("orbit-viewer--zoomed",Yi(t)),this.updateZoomButtons()}zoomAt(t,e,n){let i=this.picture;if(!i?.natural)return!1;let r=this.readStageBox();return this.setView(Jo(i.view,t,e,i.fitted,r,i.maximum),n),!0}fitPicture(){if(!this.picture?.natural)return!1;return this.setView(Gi,!0),!0}panBy(t,e,n){let i=this.picture;if(i?.natural)this.setView(Bd(i.view,t,e,i.fitted,this.readStageBox(),i.maximum),n)}get zoomed(){return this.picture!==null&&Yi(this.picture.view)}updateZoomButtons(){let t=this.parts,e=this.picture;if(!t)return;let n=Boolean(e?.natural),i=e?.view.scale??1;t.zoomOut.disabled=!n||i<=1.001,t.fit.disabled=!n||i<=1.001,t.zoomIn.disabled=!n||i>=(e?.maximum??1)-0.001,this.keepFocus()}keepFocus(){let t=ts(this.host);if(this.shown&&t instanceof HTMLButtonElement&&t.disabled&&this.dialog?.contains(t))this.dialog.focus({preventScroll:!0})}ensureDialog(){if(this.dialog)return this.dialog;let t=document.createElement("dialog");t.className="orbit-viewer",t.tabIndex=-1,t.setAttribute("aria-labelledby",`${this.id}-title`);let e=ct("div","orbit-viewer__bar"),n=ct("p","orbit-viewer__counter");n.setAttribute("role","status");let i=ct("div","orbit-viewer__tools"),r=ct("div","orbit-panel orbit-viewer__zoom");r.setAttribute("role","group");let o=Te("zoom-out",()=>this.zoomAt(1/Ki,{x:0,y:0},!0)),s=Te("zoom-in",()=>this.zoomAt(Ki,{x:0,y:0},!0)),a=Te("fit",()=>this.fitPicture());r.append(o,s,a);let l=ct("div","orbit-panel"),d=ct("a","orbit-button orbit-button--icon orbit-viewer__link");d.target="_blank",d.rel="noopener noreferrer",d.appendChild(at("link"));let c=Te("close",()=>this.close());c.classList.add("orbit-viewer__close"),l.append(d,c),i.append(r,l),e.append(n,i);let u=ct("div","orbit-viewer__stage"),h=ct("div","orbit-viewer__media"),m=ct("p","orbit-viewer__status");m.hidden=!0;let p=Te("previous",()=>this.step(-1));p.classList.add("orbit-viewer__step","orbit-viewer__step--previous");let b=Te("next",()=>this.step(1));b.classList.add("orbit-viewer__step","orbit-viewer__step--next"),u.append(h,m,p,b);let f=ct("div","orbit-viewer__caption"),g=ct("h2","orbit-viewer__title");g.id=`${this.id}-title`;let y=ct("p","orbit-viewer__text"),v=ct("p","orbit-viewer__description");return f.append(g,y,v),t.append(e,u,f),this.parts={bar:e,counter:n,zoomOut:o,zoomIn:s,fit:a,zoomGroup:r,link:d,close:c,stage:u,layer:h,status:m,previous:p,next:b,caption:f,title:g,text:y,description:v},this.relabel(),t.addEventListener("keydown",this.handleKeyDown),t.addEventListener("cancel",this.handleCancel),t.addEventListener("pointerdown",()=>{this.suppressClick=!1},!0),t.addEventListener("close",()=>{if(!t.open)this.finish()}),t.addEventListener("click",this.handleClick,!0),t.addEventListener("wheel",this.handleWheel,{passive:!1}),t.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),u.addEventListener("pointerdown",this.handlePointerDown),u.addEventListener("pointermove",this.handlePointerMove),u.addEventListener("pointerup",this.handlePointerUp),u.addEventListener("pointercancel",this.handlePointerUp),u.addEventListener("dblclick",this.handleDoubleClick),this.host.appendChild(t),this.dialog=t,t}finish(){if(!this.shown)return;this.shown=!1;let t=this.items[this.index],e=this.index,n=this.items.length;if(this.clearMedia(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.settleTimer!==null)clearTimeout(this.settleTimer),this.settleTimer=null;this.items=[];let i=this.returnFocus;if(this.returnFocus=null,i&&i.isConnected)i.focus({preventScroll:!0});if(t)this.context.onClose(t,e,n)}observeStage(){if(this.resizeObserver||typeof ResizeObserver>"u"||!this.parts)return;this.resizeObserver=new ResizeObserver(()=>this.layout()),this.resizeObserver.observe(this.parts.stage)}handleKeyDown=(t)=>{if(!this.shown||!this.context.interactive()||t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)return;let e=t.target instanceof Element?t.target:null,n=e?.closest("video, iframe")!=null,i=this.readStageBox(),r=!0;switch(t.key){case"Escape":this.close();break;case"ArrowLeft":case"ArrowRight":{let o=t.key==="ArrowRight"?1:-1;if(n)r=!1;else if(this.zoomed)this.panBy(-o*i.width*Ud,0,!0);else this.step(o);break}case"ArrowUp":case"ArrowDown":if(this.zoomed&&!n)this.panBy(0,(t.key==="ArrowDown"?-1:1)*i.height*Ud,!0);else r=!1;break;case"Home":case"End":r=!n&&this.go(t.key==="Home"?0:this.items.length-1);break;case"+":case"=":r=this.zoomAt(Ki,{x:0,y:0},!0);break;case"-":case"_":r=this.zoomAt(1/Ki,{x:0,y:0},!0);break;case"0":r=this.fitPicture();break;case" ":r=!n&&!e?.closest("button, a")&&this.togglePlayback();break;default:r=!1}if(r)t.preventDefault()};togglePlayback(){let t=this.video;if(!t)return!1;if(t.state.playing)t.pause();else t.play();return!0}handleCancel=(t)=>{if(t.preventDefault(),this.context.interactive())this.close()};handleClick=(t)=>{if(this.suppressClick){this.suppressClick=!1,t.stopPropagation(),t.preventDefault();return}let e=this.parts;if(!e||!this.context.interactive())return;if(t.target===e.stage||t.target===e.layer)this.close()};handleWheel=(t)=>{let e=this.parts;if(!e)return;if(!(t.target instanceof Node&&e.caption.contains(t.target)&&e.caption.scrollHeight>e.caption.clientHeight)&&t.cancelable)t.preventDefault();if(!this.context.interactive()||!(t.target instanceof Node)||!e.stage.contains(t.target)||!this.picture?.natural)return;let i=ni(t,this.readStageBox().height);this.zoomAt(i,this.stagePoint({x:t.clientX,y:t.clientY}),!1)};handleTouchMove=(t)=>{let e=this.parts;if(!(e!==null&&t.target instanceof Node&&e.caption.contains(t.target))&&t.cancelable)t.preventDefault()};handleDoubleClick=(t)=>{if(!this.context.interactive()||t.target!==this.picture?.element)return;this.toggleZoomAt({x:t.clientX,y:t.clientY})};toggleZoomAt(t){let e=this.picture;if(!e?.natural)return;let n=this.readStageBox();this.setView(Vd(e.view,this.stagePoint(t),e.natural,e.fitted,n,e.maximum),!0)}handlePointerDown=(t)=>{if(!this.context.interactive()||t.pointerType==="mouse"&&t.button!==0)return;if(t.target instanceof Element&&t.target.closest(yb))return;let e={x:t.clientX,y:t.clientY};if(this.pointers.set(t.pointerId,e),this.pointers.size===2){if(this.press?.mode==="swipe"||this.press?.mode==="pull")this.settleLayer();if(this.press=null,this.picture?.natural){this.pinch={view:this.picture.view,distance:this.pinchDistance(),center:this.stagePoint(this.pinchCenter())};for(let n of this.pointers.keys())this.capture(n)}return}if(this.pointers.size>2)return;this.press={id:t.pointerId,type:t.pointerType,start:e,last:e,moved:!1,mode:"none"}};handlePointerMove=(t)=>{if(!this.pointers.has(t.pointerId))return;let e={x:t.clientX,y:t.clientY};this.pointers.set(t.pointerId,e);let n=this.pinch,i=this.picture;if(n){if(this.pointers.size<2||!i?.natural)return;let l=this.stagePoint(this.pinchCenter()),d=n.distance>0?this.pinchDistance()/n.distance:1,c=Math.min(i.maximum,Math.max(1,n.view.scale*d)),u=c/n.view.scale,h={scale:c,x:l.x-(n.center.x-n.view.x)*u,y:l.y-(n.center.y-n.view.y)*u};this.setView(bn(h,i.fitted,this.readStageBox(),i.maximum),!1);return}let r=this.press;if(!r||r.id!==t.pointerId)return;let o=e.x-r.start.x,s=e.y-r.start.y;if(!r.moved){if(Math.hypot(o,s)<(r.type==="mouse"?pb:mb))return;r.moved=!0,r.mode=this.dragMode(r.type,o,s),this.capture(t.pointerId),this.dialog?.classList.toggle("orbit-viewer--dragging",r.mode==="pan")}let a=this.parts.layer;if(r.mode==="pan")this.panBy(e.x-r.last.x,e.y-r.last.y,!1);else if(r.mode==="swipe")a.style.transform=`translate(${pt(o)}px, 0)`;else if(r.mode==="pull"){let l=Math.max(0,s);a.style.transform=`translate(0, ${pt(l)}px)`,this.dialog?.style.setProperty("--_orbit-viewer-pull",String(Math.min(1,l/(jd*3))))}r.last=e};handlePointerUp=(t)=>{if(!this.pointers.delete(t.pointerId))return;if(this.pinch){if(this.pointers.size<2){this.pinch=null,this.suppressClick=!0;let o=Array.from(this.pointers.entries())[0];if(o)this.press={id:o[0],type:t.pointerType,start:o[1],last:o[1],moved:!0,mode:this.zoomed?"pan":"none"}}return}let e=this.press;if(!e||e.id!==t.pointerId)return;this.press=null,this.dialog?.classList.remove("orbit-viewer--dragging");let n=t.type==="pointercancel",i=t.clientX-e.start.x,r=t.clientY-e.start.y;if(e.moved){if(this.suppressClick=!0,e.mode==="swipe"){if(n||Math.abs(i)<bb||!this.step(i<0?1:-1))this.settleLayer()}else if(e.mode==="pull")if(!n&&r>=jd)this.close();else this.settleLayer();return}if(e.type!=="mouse"&&!n){let o={x:t.clientX,y:t.clientY},s=this.lastTap;if(s&&t.timeStamp-s.time<fb&&Math.hypot(o.x-s.point.x,o.y-s.point.y)<gb){if(this.lastTap=null,t.target===this.picture?.element)this.toggleZoomAt(o)}else this.lastTap={time:t.timeStamp,point:o}}};dragMode(t,e,n){if(this.zoomed)return"pan";if(t==="mouse")return"none";if(Math.abs(e)>Math.abs(n))return this.items.length>1?"swipe":"none";return n>0?"pull":"none"}settleLayer(){let t=this.parts,e=this.dialog;if(!t||!e)return;if(e.classList.add("orbit-viewer--settling"),t.layer.style.transform="",e.style.removeProperty("--_orbit-viewer-pull"),this.settleTimer!==null)clearTimeout(this.settleTimer);this.settleTimer=setTimeout(()=>{this.settleTimer=null,e.classList.remove("orbit-viewer--settling")},260)}resetGestures(){if(this.pointers.clear(),this.press=null,this.pinch=null,this.lastTap=null,this.dialog?.classList.remove("orbit-viewer--dragging"),this.parts)this.parts.layer.style.transform="";this.dialog?.style.removeProperty("--_orbit-viewer-pull")}capture(t){try{this.parts?.stage.setPointerCapture?.(t)}catch{}}pinchDistance(){let[t,e]=Array.from(this.pointers.values());return t&&e?Math.hypot(t.x-e.x,t.y-e.y):0}pinchCenter(){let[t,e]=Array.from(this.pointers.values());return t&&e?{x:(t.x+e.x)/2,y:(t.y+e.y)/2}:t??{x:0,y:0}}}var ts=(t)=>{let n=t.getRootNode().activeElement??t.ownerDocument?.activeElement??null;while(n?.shadowRoot?.activeElement)n=n.shadowRoot.activeElement;return n instanceof HTMLElement||n instanceof SVGElement?n:null},Te=(t,e)=>{let n=ct("button","orbit-button orbit-button--icon");return n.type="button",n.appendChild(at(t)),n.addEventListener("click",e),n},Fe=(t,e)=>{t.setAttribute("aria-label",e),t.title=e},ct=(t,e)=>{let n=document.createElement(t);return n.className=e,n},pt=(t)=>Math.round(t*100)/100;var vb=new Map,xb=new Map,wb=new Map;var Zi=(t)=>t.trim().toLowerCase(),kb=new Set(["active","done","blocked","todo","neutral"]);class Qt{types=new Map;statuses=new Map;actionList;typeFor;typeForFailed=!1;constructor(t={}){for(let[e,n]of Object.entries(t.nodeTypes??{}))this.types.set(Zi(e),n);for(let[e,n]of Object.entries(t.statuses??{}))this.statuses.set(Zi(e),n);this.actionList=t.actions??[],this.typeFor=t.nodeTypeFor}typeName(t){if(t.type)return t.type;let e=this.typeFor;if(!e)return;let n;try{n=e(t)}catch(i){if(!this.typeForFailed)this.typeForFailed=!0,console.error("[orbit] nodeTypeFor() threw:",i);return}return typeof n==="string"&&n.trim()!==""?n:void 0}nodeType(t){let e=this.typeName(t);return e===void 0?void 0:this.typeNamed(e)}ownType(t){return t.type?this.typeNamed(t.type):void 0}typeNamed(t){let e=Zi(t);return this.types.get(e)??vb.get(e)}icon(t){return t.icon??this.nodeType(t)?.icon}color(t){return t.color??this.nodeType(t)?.color}actions(t){let e=new Set,n=[];for(let i of[...this.actionList,...xb.values(),...this.nodeType(t)?.actions??[]]){if(e.has(i.id))continue;if(e.add(i.id),!i.when||xt(`the "${i.id}" action's when()`,!1,()=>i.when(t)))n.push(i)}return n}status(t){let e=Zi(t),n=this.statuses.get(e)??wb.get(e);if(n===void 0)return{tone:mn(t)};return kb.has(n)?{tone:n}:{tone:"neutral",color:n}}}var Gd=(t,e)=>{let n=0,i=(r)=>{let o=e.ownType(r),s=r.typeVersion??1;if(o?.version!==void 0&&o.upgrade&&s<o.version){let a=o.upgrade;if(xt(`the "${r.type}" type's upgrade()`,!1,()=>(a(r,s),!0)))r.typeVersion=o.version,n+=1}r.children.forEach(i)};return i(t),n},Xi=(t,e)=>typeof t.label==="function"?xt(`the "${t.id}" action's label()`,t.id,()=>t.label(e)):t.label,xt=(t,e,n)=>{try{return n()}catch(i){return console.error(`[orbit] ${t} threw:`,i),e}};var Ob=(t,e=!1)=>{let n=[];if(e)n.push("details");if(T(t.image))n.push("image");if(T(t.video))n.push("video");if(T(t.embed)&&!T(t.video))n.push("embed");if(t.note)n.push("note");if(t.link&&(rt(t.link)||D(t.link,"link")!==null))n.push("link");return n},Sb={details:"showDetails",image:"viewImage",video:"playVideo",embed:"openEmbed",note:"readNote",link:"openLink"},Mb={details:"info",image:"image",video:"video",embed:"embed",note:"note",link:"link"},Eb=new tt("en"),Nb=36,_b=42,Ji=8,Qi=(t,e,n=1/0)=>{let i=Math.max(1,Math.min(t,Math.floor((n+Ji)/(e+Ji)))),r=Math.ceil(t/i);return{perLine:i,width:i*e+(i-1)*Ji,height:r*e+(r-1)*Ji}};class es{element;context;node=null;visible=!1;transform="";wrap=0;counted=null;constructor(t){this.context=t,this.element=document.createElement("div"),this.element.className="orbit-actions",this.element.setAttribute("role","toolbar")}count(t){if(this.counted?.node!==t)this.counted={node:t,count:this.kinds(t).length+this.context.actions(t).length};return this.counted.count}size(){return si(this.element)?_b:Nb}kinds(t){return Ob(t,this.context.hasDetails(t)).filter((e)=>e!=="link"||this.context.describeLink(t).kind!=="missing")}show(t,e,n,i=0){if(t!==this.node){this.node=t,this.element.replaceChildren(...this.kinds(t).map((s)=>this.contentButton(t,s)),...this.context.actions(t).map((s)=>this.actionButton(t,s)));let o=this.words();this.element.setAttribute("aria-label",t.text?o.text("ideaActions",{name:t.text}):o.text("ideaActionsUntitled"))}if(!this.element.hasChildNodes()){this.hide();return}let r=ge(Math.round(e),Math.round(n),"-50%, 0");if(r!==this.transform)this.element.style.transform=r,this.transform=r;if(i!==this.wrap)this.element.style.maxWidth=i>0?`${i}px`:"",this.wrap=i;if(!this.visible)this.element.classList.add("orbit-actions--visible"),this.visible=!0}hide(){if(!this.visible)return;if(this.element.contains(this.element.ownerDocument.activeElement))if(this.context.returnFocus)this.context.returnFocus();else this.element.ownerDocument.activeElement.blur();this.element.classList.remove("orbit-actions--visible"),this.visible=!1}words(){return this.context.words?.()??Eb}reset(){this.node=null,this.counted=null,this.element.replaceChildren(),this.hide()}contentButton(t,e){let n=e==="link"?this.context.describeLink(t):null,i=n?.kind==="node"?n.label:this.words().text(Sb[e]),r=this.button(t,e,i);return r.classList.add(`orbit-action--${e}`),r.appendChild(at(n?.kind==="node"?"goto":Mb[e])),r}actionButton(t,e){let n=Xi(e,t),i=this.button(t,e.id,n);return i.classList.add("orbit-action--custom"),i.dataset.action=e.id,i.appendChild(Vi(e.icon,n)),i}button(t,e,n){let i=document.createElement("button");return i.type="button",i.className="orbit-action",i.setAttribute("aria-label",n),i.title=n,i.addEventListener("click",(r)=>{r.stopPropagation(),this.context.onAction(t,e,r)}),i}}class ns{element;callbacks;open=!1;closing=!1;savedAt=-1/0;typedSinceSave=!0;look="";position="";placement=null;height=0;constructor(t){this.callbacks=t;let e=document.createElement("textarea");e.className="orbit-editor",e.rows=1,e.hidden=!0,e.setAttribute("autocapitalize","sentences"),e.addEventListener("keydown",this.handleKeyDown),e.addEventListener("beforeinput",this.handleBeforeInput),e.addEventListener("input",this.handleInput),e.addEventListener("blur",this.handleBlur),this.element=e}get isOpen(){return this.open}get value(){return this.element.value}get hasFocus(){return this.element.ownerDocument.activeElement===this.element}show(t,e){let n=this.element;this.describe(e),n.value=t,n.hidden=!1,this.open=!0,this.look="",this.position="",this.placement=null,n.style.opacity="0",this.fit(),n.focus({preventScroll:!0}),n.select()}clear(t){this.describe(t),this.element.value="",this.fit(),this.move()}hide(){if(!this.open)return;if(this.open=!1,this.closing=!0,this.hasFocus)this.element.blur();this.closing=!1,this.element.hidden=!0}place(t){let e=this.element;if(this.placement=t,!t){if(this.position!=="")e.style.opacity="0",this.position="";return}let n=t.fontSize/16,i=[t.width,t.fontSize,t.maxHeight,t.role,t.light,t.slot,t.floating].join("|");if(i!==this.look)this.look=i,e.style.width=`${fn(t.width/n)}px`,e.style.maxHeight=`${fn(t.maxHeight/n)}px`,e.classList.toggle("orbit-editor--sun",t.role==="sun"),e.classList.toggle("orbit-editor--light",t.light),e.classList.toggle("orbit-editor--slot",t.slot),e.classList.toggle("orbit-editor--floating",t.floating),this.fit();this.move()}describe(t){this.element.setAttribute("aria-label",t.label),this.element.placeholder=t.placeholder,this.element.setAttribute("enterkeyhint",t.enterKey)}move(){let t=this.placement;if(!t)return;let e=t.fontSize/16,n=Math.min(this.height*e,t.maxHeight),i=t.lowest===void 0?0:Math.max(0,n/2-t.lowest),r=`translate3d(${fn(t.x)}px, ${fn(t.y-i)}px, 0) translate(-50%, -50%) scale(${fn(e,4)})`;if(r!==this.position){if(this.position==="")this.element.style.opacity="";this.element.style.transform=r,this.position=r}}fit(){let t=this.element;t.style.height="auto",this.height=t.scrollHeight,t.style.height=`${this.height}px`}save(){let t=typeof performance<"u"?performance.now():Date.now();if(!this.typedSinceSave&&t-this.savedAt<50)return;this.savedAt=t,this.typedSinceSave=!1,this.callbacks.onSave(this.element.value,"enter")}handleKeyDown=(t)=>{if(t.key==="Escape"){t.preventDefault(),this.callbacks.onCancel();return}if(t.key==="Enter"&&!t.shiftKey&&!t.isComposing){t.preventDefault(),this.save();return}if(t.key==="Tab"&&!t.isComposing&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&this.callbacks.onTab(this.element.value,t.shiftKey))t.preventDefault()};handleBeforeInput=(t)=>{if(t.inputType==="insertLineBreak"||t.inputType==="insertParagraph")t.preventDefault(),this.save()};handleInput=()=>{this.typedSinceSave=!0;let t=this.element;if(/[\r\n]/.test(t.value))t.value=t.value.replace(/\s*[\r\n]+\s*/g," ");this.fit(),this.move()};handleBlur=()=>{if(this.open&&!this.closing)this.callbacks.onSave(this.element.value,"blur")}}var fn=(t,e=1)=>{let n=10**e;return Math.round(t*n)/n};var P=(t,e=2)=>{let n=10**e;return Math.round(t*n)/n};class is{layers;rings=new Map;links=new Map;constructor(t){this.layers=t}paint(t,e){this.paintRings(t,e),this.paintLinks(t)}clear(){for(let t of this.rings.values())t.group.remove();this.rings.clear();for(let t of this.links.values())t.element.remove();this.links.clear()}paintRings(t,e){let n=new Set;if(e)for(let i of t.rings){if(i.opacity<=0.01||i.radius<=0)continue;n.add(i.id);let r=this.rings.get(i.id);if(!r)r=Tb(i),this.rings.set(i.id,r),this.layers.rings.appendChild(r.group);if(i.gaps!==r.gaps||i.radius!==r.radius){let a=`${P(i.radius)}|${i.gaps.map((l)=>`${P(l.angle)}:${P(l.halfWidth)}`).join(",")}`;if(a!==r.shape)r.line.setAttribute("d",dn(i.radius,i.gaps)),r.band.setAttribute("d",dn(i.radius,[])),r.shape=a;r.gaps=i.gaps,r.radius=i.radius}let o=`translate(${P(i.cx)} ${P(i.cy)}) rotate(${P(i.rotation)})`;if(o!==r.transform)r.group.setAttribute("transform",o),r.transform=o;let s=i.opacity>=0.999?"":String(P(i.opacity));if(r.group.style.opacity!==s)r.group.style.opacity=s;if(r.color!==i.color)r.line.style.setProperty("--orbit-ring-color",i.color),r.color=i.color}for(let[i,r]of this.rings)if(!n.has(i))r.group.remove(),this.rings.delete(i)}paintLinks(t){let e=new Set;for(let n of t.links){let i=t.nodes.get(n.fromId),r=t.nodes.get(n.toId),o=Math.min(n.opacity,i?.opacity??0,r?.opacity??0);if(!i||!r||o<=0.01)continue;let s=Math.hypot(r.x-i.x,r.y-i.y);if(s<=i.radius+r.radius)continue;e.add(n.id);let a=this.links.get(n.id);if(!a)a={element:_("line",{class:"orbit-link"}),geometry:"",opacity:""},this.links.set(n.id,a),this.layers.links.appendChild(a.element);let l=(r.x-i.x)/s,d=(r.y-i.y)/s,c=String(P(i.x+l*i.radius)),u=String(P(i.y+d*i.radius)),h=String(P(r.x-l*r.radius)),m=String(P(r.y-d*r.radius)),p=`${c} ${u} ${h} ${m} ${n.color}`;if(p!==a.geometry)a.element.setAttribute("x1",c),a.element.setAttribute("y1",u),a.element.setAttribute("x2",h),a.element.setAttribute("y2",m),a.element.style.setProperty("--orbit-link-color",n.color),a.geometry=p;let b=o>=0.999?"":String(P(o));if(b!==a.opacity)a.element.style.opacity=b,a.opacity=b}for(let[n,i]of this.links)if(!e.has(n))i.element.remove(),this.links.delete(n)}}var Tb=(t)=>{let e=_("g",{class:"orbit-ring-group"}),n=_("path",{class:"orbit-ring-band"}),i=_("path",{class:"orbit-ring"});return e.append(n,i),e.setAttribute("data-orbit-ring",t.centerId),{group:e,line:i,band:n,shape:"",gaps:null,radius:0,transform:"",color:""}};var Yd=1.25,Fb=0.3,Kd=24;class rs{layer;fonts;host;labels=new Map;counts=new Map;labelOrder=null;placed=null;waiting=null;layerTransform="";lightText=new Map;textColors=null;constructor(t,e,n){this.layer=t,this.fonts=e,this.host=n}paint(t){let e=this.ride(t);if(this.setLayerTransform(e??""),this.waiting&&(e!==null||this.still(t)))this.showWaiting();else if(e===null)this.paintLabels(t),this.paintCounts(t),this.placed={camera:{...t.camera},nodes:t.nodes}}placementOf(t){return this.labels.get(t)?.currentPlacement}forgetLightText(){this.lightText.clear()}forgetTextColors(){this.lightText.clear(),this.textColors=null}forgetNode(t){this.lightText.delete(t)}clear(){this.placed=null,this.waiting=null,this.setLayerTransform("");for(let t of this.labels.values())t.element.remove();this.labels.clear();for(let t of this.counts.values())t.element.remove();this.counts.clear()}ride(t){let e=this.placed,n=this.host.cameraMoving();if(!e||!n||e.nodes!==t.nodes||this.host.inFlight()||this.host.changedIds().size>0)return null;let{camera:i}=t,{width:r,height:o}=this.host.viewport(),s=i.scale/e.camera.scale,a=(e.camera.x-i.x)*i.scale,l=(e.camera.y-i.y)*i.scale;if(s>Yd||s<1/Yd||Math.hypot(a,l)>Fb*Math.min(r,o))return null;return`translate(${P(r/2*(1-s)+a,2)}px, ${P(o/2*(1-s)+l,2)}px) scale(${P(s,5)})`}refit(){this.placed=null,this.waiting=null,this.host.requestPaint()}still(t){let e=this.placed;return e!==null&&e.nodes===t.nodes&&e.camera.x===t.camera.x&&e.camera.y===t.camera.y&&e.camera.scale===t.camera.scale&&!this.host.inFlight()&&this.host.changedIds().size===0}setLayerTransform(t){if(t!==this.layerTransform)this.layer.style.transform=t,this.layerTransform=t}paintLabels(t){if(this.labelOrder?.nodes!==t.nodes){let l=this.host.restingScene(),d=l&&this.labelOrder?.scene===l?this.labelOrder.ids:null,c=d?d.map((u)=>t.nodes.get(u)):$i(t.nodes.values());this.labelOrder={nodes:t.nodes,order:c,scene:l,ids:d??c.map((u)=>u.id)}}let e=this.host.inFlight()||this.host.cameraMoving(),n=this.host.inFlight()?this.labelOrder.order.filter((l)=>l.cluster===void 0||l.crowded!==!0):this.labelOrder.order,i=Bi(t,n,{viewport:this.host.viewport(),hasImage:(l)=>this.showsImage(l.node),pillIcon:(l)=>this.showsImage(l.node)?this.host.extensions().icon(l.node):void 0,hasIcon:(l)=>Boolean(this.host.extensions().icon(l.node)),previousSide:(l)=>this.labels.get(l)?.direction??null,inFlight:this.host.inFlight(),measures:this.fonts,moving:e,isShown:(l)=>this.labels.get(l)?.isShown??!1,counts:!0}),r=new Set,o=this.host.editedId(),s=this.host.animationsEnabled()?Kd:1/0,a=[];for(let l of i)if(l.placement==="inside")this.usesLightText(l.entry);for(let l of i){let{entry:d}=l;if(d.id===o)continue;let c=this.labels.get(d.id);if(c&&(c.node!==d.node||this.host.changedIds().has(d.id)||c.typeName!==this.host.extensions().typeName(d.node)))c.element.remove(),this.labels.delete(d.id),c=void 0;if(!c?.isShown){if(s<=0){a.push(l);continue}s-=1}r.add(d.id),this.showLabel(l,c,e)}if(this.waiting=a.length>0?{plans:a,moving:e}:null,this.waiting)this.host.requestPaint();for(let[l,d]of this.labels){if(r.has(l))continue;let c=t.nodes.get(l);if(c)d.update({x:0,y:0,screenRadius:0,role:c.role,placement:"hidden",opacity:0});else d.element.remove(),this.labels.delete(l)}}showLabel(t,e,n){let{entry:i}=t,r=e;if(!r)r=new Ao(i.node,this.host.extensions()),this.labels.set(i.id,r),this.layer.appendChild(r.element);r.update({x:t.x,y:t.y,screenRadius:t.screenRadius,role:i.role,placement:t.placement,opacity:t.opacity,light:t.placement==="inside"&&this.usesLightText(i),measure:this.fonts.inside(i.role,i.node),narrower:!n,countWidth:t.countWidth,direction:t.direction,distance:t.distance,offset:t.offset,lines:t.lines,width:t.width,pillText:t.text})}showWaiting(){let t=this.waiting;if(!t)return;let e=this.host.editedId(),n=t.plans.splice(0,Kd);for(let i of n){let r=this.labels.get(i.entry.id);if(i.entry.id!==e&&(!r||r.node===i.entry.node))this.showLabel(i,r,t.moving)}if(t.plans.length>0)this.host.requestPaint();else this.waiting=null}showsImage(t){return(this.host.nodeView(t.id)?.hasImage??!1)||Boolean(this.host.extensions().nodeType(t)?.render)}usesLightText(t){let e=this.lightText.get(t.id);if(e&&e.color===t.color)return e.light;let n=this.host.nodeView(t.id)?.resolvedFill()??"",i=this.textColors??=this.resolveTextColors(),r=n!==""&&Ii(n,i.light,t.role==="sun"?i.root:i.dark);return this.lightText.set(t.id,{color:t.color,light:r}),r}resolveTextColors(){let t=this.host.themeTokens();return{light:it(t["node-text-inverse"],t),dark:it(t["node-text"],t),root:it(t["root-text"],t)}}paintCounts(t){let{camera:e}=t,n=new Set;if(!this.host.inFlight())for(let i of t.nodes.values()){let r=i.radius*e.scale;if(!Jt(i.role,r,i.hiddenChildren)||i.opacity<0.5)continue;let o=X(e,this.host.viewport(),i),s=this.counts.get(i.id);if(!s){let d=document.createElement("span");d.className="orbit-count",d.setAttribute("aria-hidden","true"),d.dataset.orbitFor=i.id,this.layer.appendChild(d),s={element:d,text:"",transform:""},this.counts.set(i.id,s)}let a=`+${i.hiddenChildren}`;if(a!==s.text)s.element.textContent=a,s.text=a;let l=ge(P(o.x+r*Xt,1),P(o.y+r*Xt,1),"-50%, -50%");if(l!==s.transform)s.element.style.transform=l,s.transform=l;n.add(i.id)}for(let[i,r]of this.counts)if(!n.has(i))r.element.remove(),this.counts.delete(i)}}var tr=(t,e)=>t.scale===e.scale&&t.opacity===e.opacity&&t.pivotX===e.pivotX&&t.pivotY===e.pivotY,os=(t)=>{if(t.motion===void 0){let e=t.members[0]?.entry.cluster??null;t.motion=e&&t.members.every((n)=>n.entry.cluster&&tr(n.entry.cluster,e))?e:null}return t.motion},gn=(t)=>t.opacity<=0.01||t.scale<=0.001,qd=(t,e)=>{let n=e!==null&&gn(e);if(n!==t.hidden)t.group.style.display=n?"none":"",t.hidden=n;let i=P(e?.scale??1,4),r=e&&i!==1?`matrix(${i} 0 0 ${i} ${P(e.pivotX*(1-i))} ${P(e.pivotY*(1-i))})`:"";if(r!==t.transform){if(r)t.group.setAttribute("transform",r);else t.group.removeAttribute("transform");t.transform=r}let o=e&&e.opacity<0.999?String(P(e.opacity,3)):"";if(o!==t.opacity)t.group.style.opacity=o,t.opacity=o};var Cb=10,Ib=60,Ab=6,Lb=40;class ss{root;definitions;ids;layers;host;turnTransform="";speckLighting=0;specksBelow=0;stillNodes=null;nodeViews=new Map;nodeGroups=new Map;families=new Map;flightCount=0;familyCount=0;dragMarks=`
|
|
127
|
+
`;constructor(t,e,n,i,r){this.root=t,this.definitions=e,this.ids=n,this.layers=i,this.host=r}view(t){return this.nodeViews.get(t)}entries(){return this.nodeViews.entries()}startFlight(){this.flightCount+=1}removeView(t){this.nodeViews.get(t)?.element.remove(),this.nodeViews.delete(t),this.stillNodes=null,this.nodeGroups.delete(t),this.host.viewRemoved(t)}clear(){for(let t of Array.from(this.nodeViews.keys()))this.removeView(t);for(let t of this.families.values())t.group.remove();this.families.clear()}paintTurn(t){let{turn:e}=t,n=e?P($t(e.rotation),3):0,i=e&&n!==0?`rotate(${n} ${P(e.cx)} ${P(e.cy)})`:"";if(i!==this.turnTransform){for(let s of[this.layers.moons,this.layers.nodes])if(i)s.setAttribute("transform",i);else s.removeAttribute("transform");this.turnTransform=i}let r=i?n:0;if(!this.host.inFlight()&&this.host.spinResting()&&Math.abs($t(r-this.speckLighting))>(this.host.driftRunning()?Cb:0))ql(this.definitions,this.ids,r),this.speckLighting=r;return e?n:void 0}paintNodes(t,e){let n=this.host.editedId(),i=this.host.scene(),r=this.host.inFlight(),o=this.root.ownerDocument.defaultView?.devicePixelRatio??1,s={turn:e,speckRadius:this.speckRadius(),crowdedSpeckRadius:ln(o,!0),switches:Ib,waiting:!1,flight:r},{liftedId:a,carried:l,targetId:d}=this.host.drag(),c=`${a}
|
|
128
|
+
${d}`;if(l||c!==this.dragMarks)this.stillNodes=null;this.dragMarks=c;let u=this.stillNodes;if(!r&&u&&u.scene===i&&u.scale===t.camera.scale&&u.speckRadius===s.speckRadius&&u.editedId===n&&this.host.changedIds().size===0){for(let b of u.turnedBack){let f=t.nodes.get(b.id);if(f)b.update(f,f.radius*t.camera.scale,s)}return}this.stillNodes=null;let h=[],m=0;if(this.host.inFlight()){for(let b of t.nodes.values())if(b.cluster&&gn(b.cluster)&&!this.nodeViews.has(b.id))m+=1}let p=Math.max(Lb,Math.ceil(m/Ab));for(let b of t.nodes.values()){let f=this.nodeViews.get(b.id);if(f&&(f.node!==b.node||this.host.changedIds().has(b.id)||f.typeName!==this.host.extensions().typeName(b.node)))this.removeView(b.id),f=void 0;if(!f&&this.host.inFlight()&&b.cluster&&gn(b.cluster)){if(p<=0)continue;p-=1}if(!f)f=new _o(b,b.radius*t.camera.scale,this.ids,this.host.baseUrl(),this.host.extensions(),s,()=>this.host.requestPaint()),f.element.setAttribute("aria-label",ki(b.node,0,b.node.children.length,this.host.extensions(),this.host.words())),this.nodeViews.set(b.id,f),this.host.tabStopsChanged();if(l?.has(b.id)){if(f.element.parentNode!==this.layers.carried)this.nodeGroups.delete(b.id),this.layers.carried.appendChild(f.element);f.update(b,b.radius*t.camera.scale,{...s,turn:void 0},!0),f.setLifted(b.id===a),f.setDropTarget(!1);continue}let g=this.placeInFamily(b,f);if(r){let y={entry:b,view:f,family:g};g.members.push(y),h.push(y)}else f.update(b,b.radius*t.camera.scale,s),f.setEditing(b.id===n),f.setLifted(b.id===a),f.setDropTarget(b.id===d)}for(let b of Array.from(this.nodeViews.keys()))if(!t.nodes.has(b))this.removeView(b);if(r){for(let b of Array.from(this.families.values()))this.splitIfMixed(b);for(let{entry:b,view:f,family:g}of h){let y=os(g)?b.cluster:void 0;if(y)f.update({...b,x:y.x,y:y.y,radius:y.radius,opacity:y.nodeOpacity},b.radius*t.camera.scale,s);else f.update(b,b.radius*t.camera.scale,s,!0);f.setEditing(b.id===n),f.setLifted(b.id===a),f.setDropTarget(b.id===d)}}for(let[b,f]of this.families){if(f.group.childElementCount===0){f.group.remove(),this.families.delete(b);continue}qd(f,os(f)),f.members=[],f.motion=void 0}if(s.waiting)this.host.requestPaint();else if(!r&&i){let b=Array.from(this.nodeViews.values()).filter((f)=>f.isTurnedBack);this.stillNodes={scene:i,scale:t.camera.scale,speckRadius:s.speckRadius,editedId:n,turnedBack:b}}}speckRadius(){let t=ln(this.root.ownerDocument.defaultView?.devicePixelRatio??1);if(t!==this.specksBelow)this.root.style.setProperty("--_orbit-speck-rim",String(P(1/t,4))),this.specksBelow=t;return t}splitIfMixed(t){let e=t.members.find((a)=>a.entry.cluster)?.entry.cluster;if(!e)return;let n=t.members.filter((a)=>a.entry.cluster&&tr(a.entry.cluster,e)),i=t.members.filter((a)=>!(a.entry.cluster&&tr(a.entry.cluster,e)));if(i.length===0||n.length<2)return;let[r,o]=n.length<=i.length?[n,i]:[i,n];this.familyCount+=1;let s=this.createFamily(`${t.layer}|${t.parentId}|${this.flightCount}.${this.familyCount}`,t.layer,t.parentId);for(let a of r)this.moveIntoFamily(a.view,a.entry.id,s),a.family=s,s.members.push(a);t.members=o}placeInFamily(t,e){let n=t.role==="sun"?"sun":t.role==="moon"?"moon":"node",i=t.parentId??"",r=this.nodeGroups.get(t.id);if(r&&r.layer===n&&r.parentId===i)return r;let o=`${n}|${i}${t.cluster&&this.host.inFlight()?`|${this.flightCount}`:""}`,s=this.families.get(o)??this.createFamily(o,n,i,t.cluster!==void 0&&gn(t.cluster));return this.moveIntoFamily(e,t.id,s),s}createFamily(t,e,n,i=!1){let r=_("g",{class:"orbit-family"});if(i)r.style.display="none";this.layers[e==="sun"?"suns":e==="moon"?"moons":"nodes"].appendChild(r);let o={group:r,layer:e,parentId:n,transform:"",opacity:"",hidden:i,members:[]};return this.families.set(t,o),o}moveIntoFamily(t,e,n){let i=this.root.ownerDocument.activeElement===t.element;if(n.group.appendChild(t.element),this.nodeGroups.set(e,n),i)t.element.focus({preventScroll:!0})}}class as{layer;host;contents=new Map;constructor(t,e){this.layer=t,this.host=e}clear(){for(let t of Array.from(this.contents.keys()))this.remove(t)}paint(t){let{camera:e}=t,n=new Set;for(let i of t.nodes.values()){let r=this.host.extensions().nodeType(i.node);if(!r?.render)continue;let o=this.contents.get(i.id);if(o&&(o.node!==i.node||this.host.changedIds().has(i.id)))this.remove(i.id),o=void 0;if(!o){let u=document.createElement("div");u.className="orbit-node-content",u.dataset.orbitFor=i.id,Si(u,i.node,this.host.extensions().typeName(i.node)),Mi(u,r),this.layer.appendChild(u);let h=r.render,m=xt(`The "${this.host.extensions().typeName(i.node)}" node type's render()`,void 0,()=>h(i.node,u));o={element:u,node:i.node,cleanup:typeof m==="function"?m:void 0,transform:"",opacity:"",visible:!0},this.contents.set(i.id,o)}n.add(i.id);let s=i.radius*e.scale,a=i.opacity>0.01&&s>=6;if(a!==o.visible)o.element.style.display=a?"":"none",o.visible=a;if(!a)continue;let l=X(e,this.host.viewport(),i),d=`translate3d(${P(l.x-50,1)}px, ${P(l.y-50,1)}px, 0) scale(${P(s/50,4)})`;if(d!==o.transform)o.element.style.transform=d,o.transform=d;let c=i.opacity>=0.999?"":String(P(i.opacity,3));if(c!==o.opacity)o.element.style.opacity=c,o.opacity=c}for(let i of Array.from(this.contents.keys()))if(!n.has(i))this.remove(i)}remove(t){let e=this.contents.get(t);if(!e)return;if(e.element.remove(),this.contents.delete(t),e.cleanup)xt("A node type's render() cleanup",void 0,e.cleanup)}}var Zd=(t)=>({...Qr,...t?.decay!==void 0&&t.decay>0?{decay:t.decay}:{},...t?.maxSpeed!==void 0&&t.maxSpeed>0?{maxSpeed:t.maxSpeed}:{},snap:t?.snap==="planet"}),ls=(t,e)=>{let n={...t};for(let[i,r]of Object.entries(e))if(r!==void 0)n[i]=r;return n.theme=he(t.theme,e.theme),n},Ie=(t)=>{let e=(n)=>typeof n==="number"&&Number.isFinite(n)&&n>0?n:0;return{top:e(t?.top),right:e(t?.right),bottom:e(t?.bottom),left:e(t?.left)}};var Jd=(t)=>{let e=globalThis.reportError;if(typeof e==="function")e(t);else setTimeout(()=>{throw t})},Qd=(t)=>{let e=document.createElement("div");return e.className="orbit-empty",e.hidden=!0,ds(e,t),e},ds=(t,e)=>{let n=document.createElement("strong");n.textContent=e.text("emptyMap");let i=document.createElement("span");i.textContent=e.text("emptyMapHint"),t.replaceChildren(n,i)},te="\x00slot",cs=(t)=>Boolean(t&&typeof t.closest==="function"&&t.closest("[data-orbit-add]")),wt=(t)=>(t&&typeof t.closest==="function"?t.closest("[data-orbit-node-id]"):null)?.getAttribute("data-orbit-node-id")??null,tc=(t)=>{try{return t.matches(":focus-visible")}catch{return!0}},ec=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),nc=(t)=>{let e=t.ownerDocument,n=e.scrollingElement;if(n&&n.scrollHeight>n.clientHeight+1)return!0;let i=Xd(t);while(i&&i!==e.documentElement&&i!==e.body){if(i.scrollHeight>i.clientHeight+1&&typeof getComputedStyle==="function"){let r=getComputedStyle(i).overflowY;if(r==="auto"||r==="scroll")return!0}i=Xd(i)}return!1},Xd=(t)=>{if(t.parentElement)return t.parentElement;let e=t.getRootNode();return typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e.host:null};var ic=0.02,us=(t,e)=>Math.abs(t.width-e.width)<=e.width*ic&&Math.abs(t.height-e.height)<=e.height*ic,rc=new WeakMap,oc=(t)=>{let e=rc.get(t);if(e===void 0){e=1/0;for(let n of t.nodes.values())if(n.role==="planet"&&n.orbitRadius!==void 0)e=Math.min(e,n.orbitRadius-n.radius);if(t.addSlot)e=Math.min(e,t.addSlot.orbitRadius-t.addSlot.radius);rc.set(t,e)}return e},hs=(t)=>Array.from(t.nodes.values()).filter((e)=>e.role==="planet").sort((e,n)=>ee(e.orbitAngle??0)-ee(n.orbitAngle??0)),ee=(t)=>((t+90)%360+360)%360,ps=(t,e)=>{let n=t.frame.scale/e.scale;return{scale:n,x:e.x-t.frame.x*n,y:e.y-t.frame.y*n}},ms=(t)=>{let e=new Map;for(let[n,i]of t.nodes)if(i.opacity>0.01&&i.radius>0.01)e.set(n,i);return{nodes:e,rings:t.rings.filter((n)=>n.opacity>0.01),links:t.links.filter((n)=>n.opacity>0.01),camera:t.camera,addSlot:t.addSlot&&t.addSlot.opacity>0.01?t.addSlot:void 0}},sc=(t,e,n)=>{if(!e||t.nodes.has(e.id))return t;let i=yt(n,0,n.frame).nodes.get(e.id);if(!i)return t;let r=new Map(t.nodes);return r.set(e.id,{...i,x:e.x,y:e.y,radius:e.radius}),{...t,nodes:r}},ac=(t,e)=>{if(e.size===0)return t;let n=(r)=>e.get(r)??r,i=new Map;for(let r of t.nodes.values()){let o=n(r.id);i.set(o,{...r,id:o,parentId:r.parentId===void 0?void 0:n(r.parentId),hostId:r.hostId===void 0?void 0:n(r.hostId)})}return{...t,nodes:i,rings:t.rings.map((r)=>({...r,centerId:n(r.centerId)})),links:t.links.map((r)=>{let o=n(r.fromId),s=n(r.toId);return{...r,id:`${o}->${s}`,fromId:o,toId:s}})}};var bs=(t,e)=>({label:e.text("newIdeaFor",{name:t.text||e.text("thisIdea")}),placeholder:e.text("newIdea"),enterKey:"next"}),kt=(t,e)=>{if(t===e)return!0;if(!t||!e||typeof t!=="object"||typeof e!=="object")return!1;let n=Object.keys(t),i=Object.keys(e);return n.length===i.length&&n.every((r)=>kt(t[r],e[r]))},fs=(t,e,n)=>{if(typeof e!=="object"||e===null||Array.isArray(e))throw TypeError(`${t}() takes the node's text and attributes as an object, like ${n}, but got ${e===null?"null":Array.isArray(e)?"an array":typeof e}.`)},gs=(t,e)=>{let n=(i)=>Object.fromEntries(Object.entries(i).filter(([r,o])=>r!=="source"&&r!=="children"&&o!==void 0));return kt(n(t),n(e))&&t.children.length===e.children.length&&t.children.every((i,r)=>gs(i,e.children[r]))},lc=(t,e)=>{let n=new Map,i=(s,a)=>{n.set(a,s),s.source=a.source,a.children.forEach((l,d)=>i(s.children[d],l))};i(t,e);let r=ae({root:e});if(!r)return;let o=new WeakMap;for(let[s,a]of n){let l=r.records.get(s);if(l)o.set(a,{...l,children:l.children.map((d)=>n.get(d)??d)})}In({root:t},{...r,root:t,records:o,owners:r.owners.map((s)=>s===null?null:n.get(s)??s)})},ys=(t)=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),yn=(t)=>typeof t.root==="object"&&t.root!==null&&!("children"in t),vs=(t)=>t.text.trim()===""&&!t.icon&&t.children.length===0&&!T(t.image)&&!T(t.video)&&!T(t.embed);var Pb=1.75,Db=42,Rb=0.72,$b=0.6,Bb=0.4,Vb=6,er=1.6,Hb=70,zb=720,Ub=650,jb=380,Wb=260,Gb=12,Yb=0.6,Kb=16,qb=1.3,Zb=32,dc=0.55,Xb=0.3,Jb=220,Qb=350,tf=700,ef=560,nf=0.5,cc=6,rf=10,uc=12,Ae=12,of=new Set(["details","image","video","embed","note","link"]);class Ft{static registry=new WeakMap;static instanceCounter=0;static unmount(t){let e=Ft.registry.get(t);if(!e)return!1;return e.destroy(),!0}container;root;svg;world;definitions;worldTransform="";shadingTheme="";layers;labelLayer;labelFonts;labelPainter;stopWatchingFonts;contentLayer;contentPainter;extensions;words;requestedLanguage;requestedStrings;overlayLayer;emptyState;actionBar;tooltip;controls;outline;sheet;viewer;input;clock;spinPhysics=new to;spinTracker=new Jr;panTracker=new eo;glide=new no;ids;resizeObserver=null;visibilityObserver=null;nodeColors=null;taskTokens=null;onScreen=!0;reducedMotionQuery;options;userOptions;documentOptions={};sourceOptions={};sourceExtra;themeProperties=[];tree=null;focusPath=[];viewMode;viewport={width:0,height:0};layoutSize={width:0,height:0};relayoutOnArrival=!1;refitOnArrival=!1;scene=null;camera={x:0,y:0,scale:1};transition=null;nextScene=null;landingCamera=null;cameraFlight=null;wheelZoom=null;display=null;restingDisplay=null;ringsAndLinks;nodePainter;activeId=null;tabStopsChanged=!0;hoveredId=null;keyboardFocusId=null;topPlanetId=null;userSpun=!1;returnFocusToMap=!1;dragging=!1;lastContext=null;renamedIds=new Map;changedIds=new Set;addSlotView=new Oi;heldPlaceView=new Oi(!0);editor;editing=null;arrival=null;nodeDrag=null;dropFrom=null;editOnLift=null;ambientRunning=!1;pendingDrift=0;spinReach=null;pageScrollCheck=null;listeners=new Map;destroyed=!1;warnedFlat=!1;warnedTheme=null;constructor(t,e={}){if(!t||typeof t.appendChild!=="function")throw TypeError(`Orbit needs an element to draw the map in, but got ${t===null?"null":typeof t}. Check that the selector matches an element and that the code runs after the element exists.`);Ft.unmount(t),this.container=t,this.userOptions={...e},this.options=this.resolveOptions(),this.extensions=this.createExtensions(),this.requestedLanguage=this.options.language??mi(t),this.requestedStrings=this.options.strings,this.words=new tt(this.requestedLanguage,this.requestedStrings),this.viewMode=this.options.viewMode;let n=`orbit-${(++Ft.instanceCounter).toString(36)}`;this.ids={clip:`${n}-clip`,shade:`${n}-shade`,speckShade:`${n}-speck-shade`,shadow:`${n}-shadow`,sunShadow:`${n}-sun-shadow`},this.root=document.createElement("div"),this.root.className="orbit",this.svg=_("svg",{class:"orbit__canvas"}),this.svg.setAttribute("aria-roledescription",this.words.text("mindMapRole")),this.definitions=Kl(this.ids),this.svg.appendChild(this.definitions),this.world=_("g",{class:"orbit__world"}),this.layers={rings:_("g",{class:"orbit__rings"}),links:_("g",{class:"orbit__links"}),moons:_("g",{class:"orbit__moons"}),nodes:_("g",{class:"orbit__nodes"}),suns:_("g",{class:"orbit__suns"}),carried:_("g",{class:"orbit__carried"})},this.world.append(this.layers.rings,this.layers.links,this.layers.moons,this.layers.nodes,this.layers.suns,this.layers.carried),this.ringsAndLinks=new is(this.layers),this.nodePainter=new ss(this.root,this.definitions,this.ids,this.layers,{extensions:()=>this.extensions,words:()=>this.words,baseUrl:()=>this.options.baseUrl,scene:()=>this.scene,inFlight:()=>this.transition!==null,spinResting:()=>this.spinPhysics.mode==="idle",driftRunning:()=>this.ambientRunning,editedId:()=>this.editedId(),drag:()=>{let i=this.nodeDrag;return{liftedId:i?.id??null,carried:i?.moving?new Set(i.bodies.map((r)=>r.id)):null,targetId:i?.moving&&i.place?.into?i.place.parentId:null}},changedIds:()=>this.changedIds,requestPaint:()=>this.clock.requestPaint(),tabStopsChanged:()=>{this.tabStopsChanged=!0},viewRemoved:(i)=>{this.labelPainter.forgetNode(i),this.tabStopsChanged=!0}}),this.layers.nodes.appendChild(this.addSlotView.element),this.layers.nodes.appendChild(this.heldPlaceView.element),this.svg.appendChild(this.world),this.contentLayer=document.createElement("div"),this.contentLayer.className="orbit__contents",this.contentLayer.setAttribute("aria-hidden","true"),this.contentPainter=new as(this.contentLayer,{extensions:()=>this.extensions,viewport:()=>this.viewport,changedIds:()=>this.changedIds}),this.labelLayer=document.createElement("div"),this.labelLayer.className="orbit__labels",this.labelLayer.setAttribute("aria-hidden","true"),this.labelFonts=new xo(this.labelLayer,()=>this.extensions),this.labelPainter=new rs(this.labelLayer,this.labelFonts,{extensions:()=>this.extensions,viewport:()=>this.viewport,restingScene:()=>this.transition?null:this.scene,inFlight:()=>this.transition!==null,cameraMoving:()=>this.cameraFlight!==null||this.wheelZoom!==null||this.glide.isMoving||this.dragging,changedIds:()=>this.changedIds,editedId:()=>this.editedId(),animationsEnabled:()=>this.animationsEnabled(),requestPaint:()=>this.clock.requestPaint(),nodeView:(i)=>this.nodePainter.view(i),themeTokens:()=>this.exportTokens()}),this.overlayLayer=document.createElement("div"),this.overlayLayer.className="orbit__overlay",this.actionBar=new es({onAction:(i,r,o)=>this.runAction(i,r,o),describeLink:(i)=>this.describeLink(i),actions:(i)=>this.extensions.actions(i),hasDetails:(i)=>Boolean(this.extensions.nodeType(i)?.details),returnFocus:()=>this.focusNodeElement(this.activeId??this.focusId),words:()=>this.words}),this.overlayLayer.appendChild(this.actionBar.element),this.editor=new ns({onSave:(i,r)=>this.saveEdit(i,r),onCancel:()=>this.finishEditing(!0),onTab:(i,r)=>this.tabFromEditor(i,r)}),this.overlayLayer.appendChild(this.editor.element),this.emptyState=Qd(this.words),this.tooltip=new Ko,this.controls=new Wo({onNavigate:(i)=>{this.navigate("focus",i)},onViewMode:(i)=>this.setViewMode(i),onZoom:(i)=>this.zoomBy(i===1?er:1/er),onFit:()=>this.fit(),onToggleOutline:()=>this.toggleOutline()},this.words),this.outline=new Yo((i)=>this.selectFromOutline(i),this.words),this.root.append(this.svg,this.contentLayer,this.labelLayer,this.overlayLayer,this.emptyState,this.tooltip.element,this.controls.element,this.outline.element,this.outline.live),this.sheet=new Ho(this.root),this.viewer=new qi(this.root,{items:()=>this.tree?Wd(this.tree,this.options.maxDepth):[],node:(i)=>this.tree?U(this.tree,i):null,baseUrl:()=>this.options.baseUrl,interactive:()=>this.options.interactive!==!1,icon:(i)=>this.extensions.icon(i),onShow:(i,r,o)=>this.mediaShown("media-open",i,r,o),onClose:(i,r,o)=>this.mediaShown("media-close",i,r,o),onState:(i,r)=>this.mediaPlayed(i,r),words:()=>this.words}),t.appendChild(this.root),ei(this.root),Ft.registry.set(t,this),this.clock=new Yr(()=>this.paint()),this.stopWatchingFonts=we(()=>{this.labelFonts.refresh(),this.labelPainter.refit()}),this.input=new Gr(this.root,{isInteractive:()=>this.options.interactive!==!1,longPressDelay:()=>{let i=this.options.longPressDelay;return typeof i==="number"&&Number.isFinite(i)&&i>0?i:500},dragGesture:(i)=>this.dragGestureAt(i),spinCenter:()=>this.sunOnScreen(),isCoasting:()=>this.spinPhysics.isMoving||this.glide.isMoving,onCatch:()=>{this.spinPhysics.stop(),this.glide.stop()},onSpinStart:(i,r)=>{this.spinTracker.reset(i,r),this.spinPhysics.grab(),this.userSpun=!0},onSpinMove:(i,r)=>{this.spinPhysics.drag(this.spinTracker.add(i,r)),this.tickHaptics(),this.clock.requestPaint()},onSpinEnd:(i,r)=>this.releaseSpin(r?0:this.spinTracker.velocityAt(i)),onPanStart:(i)=>{this.glide.stop(),this.cameraFlight=null,this.panTracker.reset(i)},onPan:(i,r,o)=>{this.panTracker.add(o,i,r),this.panCamera(i,r)},onPanEnd:(i,r)=>{if(!r&&!this.prefersReducedMotion()){if(this.glide.start(this.panTracker.velocityAt(i)),this.glide.isMoving)this.clock.add(this.glideTask)}},onPinch:(i,r,o,s)=>{this.cameraFlight=null,this.panCamera(o,s),this.zoomAt(i,r)},onPinchEnd:()=>this.settleZoom(),onWheel:(i,r)=>this.handleWheel(i,r),onDoubleTap:(i,r)=>this.handleDoubleTap(i,r),onLongPress:(i,r)=>{let o=wt(r);return o!==null&&this.openNodeContext(o,i,!0)},onHold:(i,r)=>this.liftNode(wt(r),i),onNodeDrag:(i,r)=>this.dragNode(i,r),onDraggingChange:(i)=>{if(this.dragging=i,this.root.classList.toggle("orbit--dragging",i),i)this.hoveredId=null,this.updateTooltip();else this.clock.requestPaint();this.syncAmbientMotion()}}),this.svg.addEventListener("click",this.handleClick),this.svg.addEventListener("contextmenu",this.handleContextMenu),this.svg.addEventListener("keydown",this.handleKeyDown),this.svg.addEventListener("pointerover",this.handlePointerOver),this.svg.addEventListener("pointerout",this.handlePointerOut),this.root.addEventListener("focusin",this.handleFocusIn),this.root.addEventListener("focusout",this.handleFocusOut),this.applyOptionEffects(null),this.setViewport(this.readContainerSize()),this.observeResize(),this.observeVisibility()}render(t){if(typeof t==="string")t=mt(t,{untitled:this.words.text("untitledMap")});let e=yn(t)?t.root:t;if(Gd(e,this.extensions),this.isSameMap(e,yn(t)?t.options:null)){if(yn(t))this.sourceExtra=t.extra;this.adoptTree(e);return}if(yn(t)){if(this.sourceOptions={...t.options},this.sourceExtra=t.extra,this.documentOptions=pe(t.options),this.options=this.resolveOptions(),this.tree===null)this.viewMode=this.options.viewMode;this.applyOptionEffects(null)}else this.sourceOptions={},this.sourceExtra=void 0,this.documentOptions={},this.options=this.resolveOptions(),this.applyOptionEffects(null);this.showTree(e)}setOptions(t){this.nodeColors=null,this.taskTokens=null,this.userOptions={...this.userOptions,...t};let e=this.options;if(this.options=this.resolveOptions(),this.applyOptionEffects(e),t.viewMode!==void 0&&t.viewMode!==this.viewMode)if(this.tree)this.navigate(t.viewMode,this.focusId,!1);else this.viewMode=t.viewMode}on(t,e){let n=this.listeners.get(t);if(!n)n=new Set,this.listeners.set(t,n);let i=e;return n.add(i),()=>{this.listeners.get(t)?.delete(i)}}getSVGElement(){return this.svg}toSVGString(){let t=this.viewport.width>0&&this.viewport.height>0?this.viewport:{width:800,height:600},e=this.transition?this.nextScene??this.transition.target:this.scene;if(e?.addSlot)e=this.buildScene(!1);let n=e?yt(e,this.transition?0:this.rotation,this.transition?e.frame:this.camera):null;return zi(n,{viewport:t,extensions:this.extensions,tokens:this.exportTokens(),showRings:this.options.showRings!==!1,title:this.options.ariaLabel||this.tree?.text||this.words.text("mindMap"),words:this.words,fills:(i)=>this.nodePainter.view(i.id)?.resolvedFill()??"",baseUrl:this.options.baseUrl??this.root.ownerDocument.baseURI,measures:this.labelFonts})}getViewMode(){return this.viewMode}setViewMode(t){if(t===this.viewMode)return;if(!this.tree){this.viewMode=t;return}this.navigate(t,this.focusId)}getFocusPath(){return[...this.focusPath]}getFocusedNode(){if(!this.tree)return null;return U(this.tree,this.focusId)}focusNode(t){if(!this.tree)return!1;let e=Y(this.tree,t);if(e.length===0)return!1;if(this.viewMode==="focus")return this.navigate("focus",t);let n=t!==this.focusId;this.focusPath=e.map((r)=>r.id),this.outline.setCurrent(this.focusId);let i=this.scene?.nodes.get(t);if(i&&this.scene){let[,r]=this.zoomRange(),o=Math.min(this.scene.frame.scale*r,Math.max(this.camera.scale,34/i.radius));this.flyCamera(this.clampCamera({x:i.x,y:i.y,scale:o}),this.viewportCenter())}if(n)this.emitFocusChange(e);return!0}flyTo(t){return this.navigate("focus",t)}overview(){this.setViewMode("all")}zoomBy(t){this.zoomStep(t,this.viewportCenter())}fit(){if(this.scene)this.flyCamera(this.scene.frame,this.viewportCenter())}spin(t){if(this.viewMode!=="focus"||!this.scene||this.transition)return;this.userSpun=!0,this.releaseSpin(t/1000)}openMedia(t,e={}){let n=this.tree?U(this.tree,t):null;if(!n)return!1;let i=e.kind==="image"||e.kind==="video"?e.kind:Ce(n,"image")?"image":"video";return this.viewer.open({node:n,kind:i},{autoplay:e.autoplay!==!1,startAt:e.startAt})}closeMedia(){this.viewer.close()}playMedia(){return this.viewer.play()}pauseMedia(){return this.viewer.pause()}seekMedia(t){return this.viewer.seek(t)}unmuteMedia(){return this.viewer.unmute()}getNodeColor(t){let e=this.tree;if(!e)return null;this.nodeColors??=qt(e,Dt(this.options.palette),(i)=>this.extensions.color(i));let n=this.nodeColors.get(t);if(!n)return null;return it(n,/var\(/i.test(n)?this.tokensForThisTask():{})}tokensForThisTask(){if(!this.taskTokens)this.taskTokens=this.exportTokens(),queueMicrotask(()=>{this.taskTokens=null});return this.taskTokens}getDocument(){if(!this.tree)return null;let t={root:this.tree,options:{...this.sourceOptions},warnings:[]};if(this.sourceExtra)t.extra={...this.sourceExtra};return t}toMarkdown(){let t=this.getDocument();return t?Ka(t):""}addNode(t,e,n){return fs("addNode",e,`addNode('${t}', { text: 'New idea' })`),this.insertNode(t,e,n)}updateNode(t,e){fs("updateNode",e,`updateNode('${t}', { text: 'New title' })`);let n=this.tree?As(this.tree,t,e,this.branchColorRules()):null;if(!n)return null;let{node:i,previousId:r}=n;if(i.id!==r)this.renameView(r,i.id);return this.changedIds.add(i.id),this.afterEdit("update",i),i}removeNode(t){let e=this.tree?Ls(this.tree,t,this.branchColorRules()):null;if(!e)return null;let{node:n,parent:i}=e;return this.changedIds.add(i.id),this.afterEdit("remove",n,this.words.text("removed",{name:n.text||this.words.text("anIdea")})),n}moveNode(t,e,n){let i=this.tree?Ps(this.tree,t,e,n,this.branchColorRules()):null;if(!i)return null;let{node:r,from:o,to:s}=i;this.changedIds.add(o.id).add(s.id);let a=r.text||this.words.text("anIdea");return this.afterEdit("move",r,s.text?this.words.text("moved",{name:a,parent:s.text}):this.words.text("movedToTop",{name:a})),r}editNode(t){let e=this.tree,n=e?Y(e,t):[];if(n.length===0||this.options.interactive===!1)return!1;this.stopEditing();let i=n[n.length-1],r=n[n.length-2]??null,o=(this.transition?.target??this.scene)?.nodes.get(t)?.role;if(this.viewMode==="focus"&&(o===void 0||o==="moon"))this.navigate("focus",r?.id??t);return this.editing={nodeId:t,parentId:r?.id??t,index:r?r.children.indexOf(i):0},this.editor.show(i.text,{label:this.words.text("textOf",{name:i.text||this.words.text("thisIdea")}),placeholder:i.text||this.words.text("untitled"),enterKey:"done"}),this.paint(),this.emitEditor("editor-open",i,null),!0}editNewNode(t,e){let n=this.tree,i=n?Y(n,t??this.focusId):[],r=i[i.length-1];if(!r||this.options.interactive===!1||this.options.maxDepth!==void 0&&r.level>=this.options.maxDepth)return!1;this.stopEditing();let o=r.children.length,s=e===void 0||!Number.isFinite(e)?o:Math.min(o,Math.max(0,Math.trunc(e)));if(this.editing={nodeId:null,parentId:r.id,index:s},this.editor.show("",bs(r,this.words)),this.viewMode!=="focus"||this.focusId!==r.id)this.navigate("focus",r.id);else this.refreshSlot();return this.paint(),this.emitEditor("editor-open",null,r),!0}stopEditing(t=!0){if(!this.editing)return;if(t)this.saveEdit(this.editor.value,"blur");else this.finishEditing(!1)}destroy(){if(this.destroyed)return;if(this.destroyed=!0,this.editing=null,this.editor.hide(),this.clock.stop(),this.input.detach(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.visibilityObserver?.disconnect(),this.visibilityObserver=null,this.svg.removeEventListener("click",this.handleClick),this.svg.removeEventListener("contextmenu",this.handleContextMenu),this.svg.removeEventListener("keydown",this.handleKeyDown),this.svg.removeEventListener("pointerover",this.handlePointerOver),this.svg.removeEventListener("pointerout",this.handlePointerOut),this.root.removeEventListener("focusin",this.handleFocusIn),this.root.removeEventListener("focusout",this.handleFocusOut),this.contentPainter.clear(),this.viewer.destroy(),this.sheet.destroy(),this.controls.destroy(),this.stopWatchingFonts(),this.labelFonts.destroy(),this.listeners.clear(),this.root.remove(),Ft.registry.get(this.container)===this)Ft.registry.delete(this.container)}showTree(t){let e=this.tree===null,n=this.nodeDrag;if(n){if(this.nodeDrag=null,n.moving)this.emitDrag("end",n.node,null,null)}if(this.tree=t,this.nodeColors=null,e&&this.options.focus)this.focusPath=[this.options.focus];let i=this.editing;if(i&&!U(t,i.nodeId??i.parentId))this.finishEditing(!1,!1);let r=[];for(let o=this.focusPath.length-1;o>=0&&r.length===0;o-=1)r=Y(t,this.focusPath[o]);this.focusPath=r.length>0?r.map((o)=>o.id):[t.id],this.actionBar.reset(),this.labelPainter.forgetLightText(),this.updateEmbedding(),this.updateControls(),this.updateOutline(),this.rebuild(e||!this.scene?"enter":"morph")}isSameMap(t,e){return this.tree!==null&&this.scene!==null&&t!==this.tree&&(e===null||kt(ys(e),ys(this.sourceOptions)))&&gs(t,this.tree)}adoptTree(t){lc(this.tree,t),this.nodeColors=null;let e=this.buildScene();if(!e)return;if(this.nextScene)this.nextScene=e;else if(this.transition)this.transition={...this.transition,target:e};else this.scene=e;this.actionBar.reset(),this.clock.requestPaint()}branchColorRules(){return{count:kn(Dt(this.options.palette)).length,ownColor:(t)=>this.extensions.color(t)}}afterEdit(t,e,n){let i=this.tree,r=this.focusPath.join(`
|
|
128
129
|
`);if(this.showTree(i),this.focusPath.join(`
|
|
129
|
-
`)!==r)this.emitFocusChange(W(i,this.focusId));if(n)this.outline.announce(n);let o={kind:t,node:e,tree:i};this.options.onEdit?.(o),this.emit("edit",o)}insertNode(t,e,n,i){let r=this.tree?Jo(this.tree,t,e,n):null;if(!r)return null;let{node:o,parent:s}=r;return this.changedIds.add(s.id),this.arrival=i?{id:o.id,...i}:null,this.afterEdit("add",o,this.words.text("added",{name:o.text||this.words.text("anIdea")})),o}get editingKeys(){return this.options.editable===!0&&this.options.editingKeys===!0&&this.options.interactive!==!1}addBeside(t){let e=this.tree?W(this.tree,t):[],n=e[e.length-1],i=e[e.length-2];if(!n)return!1;return i?this.editNewNode(i.id,i.children.indexOf(n)+1):this.editNewNode(n.id)}removeWithKey(t){let e=this.tree?W(this.tree,t):[],n=e[e.length-1],i=e[e.length-2];if(!n||!i)return!1;let r=i.children.indexOf(n),o=i.children[r+1]??i.children[r-1]??i;if(!this.removeNode(t))return!0;let s=this.transition?.target??this.scene;return this.focusNodeElement(s?.nodes.has(o.id)?o.id:this.focusId),!0}tabFromEditor(t,e){let n=this.editing,i=this.tree;if(!n||!i||!this.editingKeys)return!1;let r=W(i,n.parentId),o=r[r.length-1];if(!o)return!1;let s=r[r.length-2]??null,a=t.replace(/\s+/g," ").trim(),l=null;if(n.nodeId!==null){let c=U(i,n.nodeId);this.finishEditing(!1,!1),l=c&&a&&a!==c.text?this.updateNode(c.id,{text:a}):c}else if(a){let c=this.display?.addSlot,u=c&&c.parentId===n.parentId?{x:c.x,y:c.y,radius:c.radius}:void 0;this.finishEditing(!1,!1),l=this.insertNode(n.parentId,{text:a},n.index,u)}if(e){if(s)return this.editNewNode(s.id,s.children.indexOf(o)+1);return l===null||n.nodeId!==null||this.editNewNode(o.id,n.index+1)}let d=l??o.children[n.index-1]??null;return d===null||this.editNewNode(d.id)}saveEdit(t,e){let n=this.editing,i=this.tree;if(!n||!i)return;let r=t.replace(/\s+/g," ").trim();if(n.nodeId!==null){let l=U(i,n.nodeId);if(this.finishEditing(e==="enter"),l&&r&&r!==l.text)this.updateNode(l.id,{text:r});return}let o=U(i,n.parentId);if(!r||!o){this.finishEditing(e==="enter");return}let s=this.display?.addSlot,a=s&&s.parentId===n.parentId?{x:s.x,y:s.y,radius:s.radius}:void 0;if(e==="enter")this.editing={...n,index:n.index+1},this.editor.clear(Cd(o,this.words));else this.finishEditing(!1,!1);this.insertNode(n.parentId,{text:r},n.index,a)}finishEditing(t,e=!0){let n=this.editing;if(!n)return;let i=this.editor.hasFocus;this.editing=null,this.editor.hide();let r=this.tree,o=r&&n.nodeId!==null?U(r,n.nodeId):null,s=r&&n.nodeId===null?U(r,n.parentId):null;if(e)this.refreshSlot();if(t&&i){if(o)this.focusNodeElement(o.id);else if(this.addSlotView.isShown)this.addSlotView.element.focus({preventScroll:!0})}this.paint(),this.emitEditor("editor-close",o,s)}refreshSlot(){let t=this.tree,e=this.nextScene??this.transition?.target??this.scene;if(!t||!e||this.viewMode!=="focus")return;let n=this.slotPlace(),i=U(t,this.focusId),r=n&&i?n.index??i.children.length:null;if((e.addSlot?.index??null)!==r)this.rebuild("morph")}slotPlace(){let t=this.editing;if(t&&t.nodeId===null)return t.parentId===this.focusId?{index:t.index}:void 0;return this.options.editable&&this.options.interactive!==!1?{}:void 0}emitEditor(t,e,n){let i={node:e,parent:n};if(t==="editor-open")this.options.onEditorOpen?.(i);else this.options.onEditorClose?.(i);this.emit(t,i)}renameView(t,e){this.focusPath=this.focusPath.map((n)=>n===t?e:n);for(let n of["activeId","hoveredId","keyboardFocusId","topPlanetId"])if(this[n]===t)this[n]=e;this.renamedIds.set(t,e)}resolveOptions(){return Id(Id(Ci,this.documentOptions),this.userOptions)}createExtensions(){return new Po({nodeTypes:this.options.nodeTypes,actions:this.options.actions,statuses:this.options.statuses,nodeTypeFor:this.options.nodeTypeFor})}syncLanguage(){let t=this.options.language??Un(this.container);if(t===this.requestedLanguage&&vt(this.options.strings,this.requestedStrings))return;this.requestedLanguage=t,this.requestedStrings=this.options.strings,this.words=new dt(t,this.options.strings),this.svg.setAttribute("aria-roledescription",this.words.text("mindMapRole")),this.controls.relabel(this.words),this.outline.relabel(this.words),this.viewer.relabel(),this.actionBar.reset(),Rd(this.emptyState,this.words);for(let e of this.nodeViews.values())e.element.setAttribute("aria-label",oo(e.node,0,e.node.children.length,this.extensions,this.words));if(this.tree)this.updateOutline(),this.updateControls()}applyOptionEffects(t){let e=this.options,n=t!==null&&(!vt(t.nodeTypes,e.nodeTypes)||!vt(t.actions,e.actions)||!vt(t.statuses,e.statuses)||t.nodeTypeFor!==e.nodeTypeFor);if(n)this.extensions=this.createExtensions();if(this.applyTheme(),this.syncLanguage(),this.spinPhysics.settings=Ab(e.spin),this.svg.setAttribute("aria-label",e.ariaLabel||this.words.text("mindMap")),this.syncInteractivity(),this.syncAmbientMotion(),!t||!this.tree)return;if(t.baseUrl!==e.baseUrl||n)this.clearViews();if(n){this.updateOutline(),this.refreshScene();return}if((!e.editable||e.interactive===!1)&&this.editing)this.stopEditing();if(t.maxDepth!==e.maxDepth||Boolean(t.editable)!==Boolean(e.editable)){this.updateOutline(),this.rebuild("morph");return}let i=!vt(t.palette,e.palette)||!vt(t.theme,e.theme),r=!vt(Je(t.insets),Je(e.insets))||t.showActionButtons!==!1!==(e.showActionButtons!==!1)||t.interactive!==!1!==(e.interactive!==!1)||t.showControls!==!1!==(e.showControls!==!1);if(r&&this.transition)this.refitOnArrival=!0;else if(r){let o=this.isFitted();if(this.refreshScene(),o)this.fit();return}if(i){this.refreshScene();return}this.clock.requestPaint()}isFitted(){let t=this.scene?.frame;if(!t)return!1;let{camera:e}=this;return Math.abs(e.scale/t.scale-1)<0.01&&Math.abs(e.x-t.x)*e.scale<2&&Math.abs(e.y-t.y)*e.scale<2}themeOption(){let t=rr(this.options.theme);return typeof t==="object"?t:void 0}themePreset(){return Cs(this.options.theme)}applyTheme(){let t=this.options.theme,e=typeof t==="string"?t:t?.preset;if(e!==void 0&&!Ne(e)&&e!==this.warnedTheme)this.warnedTheme=e,console.warn(`[orbit] Unknown theme "${String(e)}", so the map uses paper. Themes: ${Te().join(", ")}.`);this.root.dataset.orbitTheme=this.themePreset();let n=Ds(this.themeOption());for(let r of this.themeProperties)if(!(r in n))this.root.style.removeProperty(r);for(let[r,o]of Object.entries(n))this.root.style.setProperty(r,o);this.themeProperties=Object.keys(n),this.lightText.clear(),this.textColors=null;let i=JSON.stringify([this.themePreset(),this.themeOption()]);if(i!==this.shadingTheme)this.shadingTheme=i,gl(this.definitions,this.ids,Zn(this.themeValue("node-shade-circle")));this.labelFonts.refresh()}themeValue(t){if(typeof getComputedStyle==="function"&&this.root.isConnected){let e=getComputedStyle(this.root).getPropertyValue(`--_orbit-${t}`).trim();if(e&&!e.startsWith("var("))return e}return or(this.themePreset(),this.themeOption())[t]}exportTokens(){let t={};if(typeof getComputedStyle==="function"&&this.root.isConnected){let e=getComputedStyle(this.root);for(let n of yn){let i=e.getPropertyValue(`--_orbit-${n}`).trim();if(i&&!i.startsWith("var("))t[n]=i}}return or(this.themePreset(),this.themeOption(),t)}syncInteractivity(){let t=this.options.interactive!==!1;if(this.root.classList.toggle("orbit--static",!t),this.svg.setAttribute("role",t?"group":"img"),t)this.input.attach(this.svg);else this.input.detach(),this.sheet.close(),this.tooltip.hide();this.viewer.refresh(),this.controls.element.hidden=!t||this.options.showControls===!1,this.tabStopsChanged=!0}get focusId(){return this.focusPath[this.focusPath.length-1]??this.tree?.id??""}get rotation(){return this.spinPhysics.angle}sceneOptions(t=!0){let e=this.tree,n=this.nodeDrag?.moving?this.nodeDrag:null,i=n!==null&&this.carriesPlanet(n),r=n!==null&&!i&&n.slot!==null?{index:n.slot}:null,o=n?.rings&&Md(this.viewport,n.rings.size)?n.rings:null;return{viewport:this.viewport,insets:Je(this.options.insets),colors:Vr(e,sr(this.options.palette),(s)=>this.extensions.color(s)),maxDepth:this.options.maxDepth,addSlot:t?r??this.slotPlace():void 0,reorder:i&&n.slot!==null?{id:n.id,index:n.slot}:void 0,keptRings:o?{focusId:o.focusId,radii:o.radii}:void 0}}buildScene(t=!0){let e=this.tree;if(!e||Pd(e)||this.viewport.width<=0||this.viewport.height<=0)return null;return this.layoutSize={...this.viewport},this.viewMode==="all"?Ja(e,this.sceneOptions(t)):this.focusScene(e,this.focusId,this.sceneOptions(t))}focusScene(t,e,n){let i=Xa(t,e,n),r=this.roomForActions(i);return r>0?{...i,frame:qa(i,this.viewport,n.insets,r)}:i}roomForActions(t){let e=t.nodes.get(t.focusId),n=e?this.actionBar.count(e.node):0;if(!e||n===0||!this.showsActions()||this.actionsPlace(t,e,t.frame)!==null)return 0;return kd+this.rowsUnderOrbit(n,Je(this.options.insets)).rows.height+ye}showsActions(){return this.options.showActionButtons!==!1&&this.options.interactive!==!1}actionsPlace(t,e,n){let i=Math.max(1,this.actionBar.count(e.node)),r=this.actionBar.size(),o=J(n,this.viewport,e),s=e.radius*n.scale,a=Eb(t)*n.scale-wd,l=(Ni(i,r).width-r)/2,d=(y)=>Math.hypot(l,y+r/2)+r/2,c=this.labels.get(e.id)?.currentPlacement==="outside",u=s+(c?36:12);if(d(u)<=a)return{x:o.x,y:o.y+u,wrap:0};if(!c){let y=le("sun",s,e.hiddenChildren)?ii(e.hiddenChildren,this.labelFonts.count()):0,x=de("sun",s,e.node.text,Boolean(this.extensions.icon(e.node)),this.labelFonts.inside("sun",e.node),!0,y),O=s-r-yb;if(O>=(x?Ol(x):0)+wd&&d(O)<=a)return{x:o.x,y:o.y+O,wrap:0}}let h=Je(this.options.insets),m=o.y+Math.max(t.extent.x,t.extent.y)*n.scale+kd,{rows:p,left:b,right:g}=this.rowsUnderOrbit(i,h,m);if(m+p.height>this.viewport.height-h.bottom-ye)return null;return{x:Math.min(Math.max(o.x,b+p.width/2),g-p.width/2),y:m,wrap:p.perLine<i?p.width:0}}rowsUnderOrbit(t,e,n=this.viewport.height){let i=this.actionBar.size(),r=e.left+ye,o=this.viewport.width-e.right-ye,s=Ni(t,i,o-r),a=this.controls.zoomBox(this.viewport.width,this.viewport.height);if(a&&n+s.height+ye>a.top)o=Math.min(o,a.left-ye),s=Ni(t,i,o-r);return{rows:s,left:r,right:o}}navigate(t,e,n=!0){let i=this.tree;if(!i)return!1;let r=W(i,e);if(r.length===0)return!1;let o=r[r.length-1].id!==this.focusId,s=t!==this.viewMode;if(this.focusPath=r.map((l)=>l.id),this.viewMode=t,!o&&!s)return this.fit(),!0;let a=this.root.ownerDocument.activeElement;if(this.returnFocusToMap||=Boolean(a&&this.svg.contains(a)),this.hoveredId=null,this.updateTooltip(),this.actionBar.hide(),this.flyToCurrentView(),this.updateControls(),this.outline.setCurrent(this.focusId),this.announceView(),n&&s)this.options.onViewModeChange?.(t),this.emit("view-mode-change",{mode:t});if(n&&o&&t==="focus")this.emitFocusChange(r);return!0}flyToCurrentView(){let t=this.buildScene();if(this.stopMotion(),!t){this.transition=null,this.nextScene=null,this.scene=null,this.paint();return}if(this.scene&&this.prefersReducedMotion()&&this.options.transitionDuration!==0){this.startFade(t);return}if(!this.scene||!this.animationsEnabled()){this.transition=null,this.nextScene=null,this.restOn(t);return}let e=this.now(),n=this.currentDisplay(e),i=this.placeTarget(n,t);if(i){this.nextScene=null,this.startTransition(n,t,i,e);return}let r=this.commonAncestorScene(t),o=r?this.placeTarget(n,r):null;if(r&&o){this.nextScene=t,this.startTransition(n,r,o,e);return}this.nextScene=null,this.startTransition(n,t,Td(t,n.camera),e)}placeTarget(t,e){let n=(l)=>{let d=l===void 0?void 0:t.nodes.get(l);return d&&d.opacity>0.3&&d.radius>0.5?d:null},i=n(e.focusId);if(i)return ie(e,e.focusId,i);let r=this.transition?.target.focusId??this.scene?.focusId,o=n(r);if(o&&r!==void 0&&e.nodes.has(r))return ie(e,r,o);let s=null;for(let l of t.nodes.values())if(l.opacity>0.3&&l.radius>0.5&&e.nodes.has(l.id)&&(!s||l.radius>s.radius))s=l;if(s)return ie(e,s.id,s);let a=this.tree;if(!a)return null;if(o&&r!==void 0){for(let l=U(a,r)?.parent;l;l=l.parent)if(e.nodes.has(l.id))return ie(e,l.id,{x:o.x,y:o.y,radius:o.radius*1.15})}for(let l=U(a,e.focusId)?.parent;l;l=l.parent){let d=n(l.id);if(d)return ie(e,e.focusId,{x:d.x,y:d.y,radius:d.radius*0.45})}return null}commonAncestorScene(t){let e=this.tree,n=this.transition?.target.focusId??this.scene?.focusId;if(!e||t.kind!=="focus"||n===void 0)return null;let i=W(e,n),r=W(e,t.focusId),o=null;for(let s=0;s<Math.min(i.length,r.length)&&i[s].id===r[s].id;s+=1)o=i[s];if(!o||o.id===n||o.id===t.focusId)return null;return this.focusScene(e,o.id,this.sceneOptions())}startTransition(t,e,n,i,r,o){this.flightCount+=1;let s=o??el(e,n),a=Fr(t.camera,s,this.viewport);this.transition={from:Fd(t),target:e,placement:n,cameraPath:a,startedAt:i,duration:r??this.flightDuration(a.length)},this.landingCamera=o??null,this.spinPhysics.stop(),this.tabStopsChanged=!0,this.clock.add(this.transitionTask),this.paint()}startFade(t){let e=this.now(),n=Fd(this.currentDisplay(e));this.nextScene=null,this.landingCamera=null,this.transition={from:n,target:t,placement:Re,cameraPath:{length:0,at:()=>t.frame},startedAt:e,duration:cb,fade:!0},this.spinPhysics.stop(),this.tabStopsChanged=!0,this.clock.add(this.transitionTask),this.paint()}flightDuration(t){let e=this.options.transitionDuration;if(typeof e==="number")return Math.max(0,e);return Math.min(1300,Math.max(480,t*650))}transitionTask=(t)=>{let e=this.transition;if(!e)return!1;if(t-e.startedAt<e.duration)return!0;return this.finishTransition(),this.transition!==null};finishTransition(){let t=this.transition;if(!t)return;this.transition=null,this.scene=t.target,this.camera=this.landingCamera?{...this.landingCamera}:{...t.target.frame},this.landingCamera=null,this.spinPhysics.stop(),this.spinPhysics.angle=0;let e=this.nextScene;if(this.nextScene=null,e){let n=Lt(this.scene,0,this.camera);this.startTransition(n,e,this.placeTarget(n,e)??Td(e,this.camera),this.now());return}this.afterArrival()}completeTransition(){if(!this.transition)return;let t=this.nextScene??this.transition.target,e=this.nextScene?null:this.landingCamera;if(this.transition=null,this.nextScene=null,this.landingCamera=null,this.restOn(t,!1),e)this.camera=e}restOn(t,e=!0){if(this.scene=t,this.camera={...t.frame},this.spinPhysics.stop(),this.spinPhysics.angle=0,this.tabStopsChanged=!0,this.paint(),e)this.afterArrival()}afterArrival(){if(this.relayoutOnArrival){this.relayoutOnArrival=!1,this.refitOnArrival=!1,this.rebuild("instant");return}if(this.refitOnArrival)this.refitOnArrival=!1,this.refreshScene(),this.fit();this.tabStopsChanged=!0,this.topPlanetId=this.planetNearestTop()?.id??null,this.clock.requestPaint(),this.syncAmbientMotion();let t=this.root.ownerDocument.activeElement;if(this.returnFocusToMap&&(!t||!this.svg.contains(t)))this.paint(),this.focusNodeElement(this.activeId??this.focusId);this.returnFocusToMap=!1}rebuild(t){this.labelFonts.recheckWhenIdle(()=>this.fitLabelsAgain());let e=this.renamedIds;this.renamedIds=new Map;let n=this.arrival;this.arrival=null,this.completeTransition(),this.stopMotion();let i=this.buildScene();if(this.emptyState.hidden=!(this.tree&&Pd(this.tree)),!i){this.scene=null,this.paint();return}if(t==="instant"||!this.animationsEnabled()){this.restOn(i);return}let r=this.now();if(t==="enter"||!this.scene){let a={nodes:new Map,rings:[],links:[],camera:{...i.frame,scale:i.frame.scale*0.82}};this.scene=i,this.startTransition(a,i,Re,r,eb);return}let o=this.dropFrom??Nb(Tb(Lt(this.scene,this.rotation,this.camera),e),n,i),s=i.kind==="overview"&&this.scene.kind==="overview";this.startTransition(o,i,Re,r,nb,s?{...this.camera}:void 0)}refreshScene(){this.completeTransition();let t=this.buildScene();if(!t||!this.scene){this.rebuild("instant");return}this.scene=t,this.camera=this.clampCamera(this.camera),this.lightText.clear(),this.paint()}currentDisplay(t){let e=this.transition;if(e){let o=e.duration<=0?1:Math.min(1,Math.max(0,(t-e.startedAt)/e.duration));return e.fade?il(e,o):nl(e,Nr(o))}let n=this.scene,i=this.restingDisplay;if(i&&i.scene===n&&i.rotation===this.rotation)return{...i.display,camera:this.camera};let r=Lt(n,this.rotation,this.camera);return this.restingDisplay={scene:n,rotation:this.rotation,display:r},r}stopMotion(){if(this.cameraFlight=null,this.wheelZoom=null,this.glide.stop(),this.spinPhysics.mode!=="dragging")this.spinPhysics.stop()}paint(){if(this.destroyed)return;if(!this.scene){this.display=null,this.clearViews();return}let t=this.currentDisplay(this.now()),e=this.withCarried(t);this.display=e;let n=Ea(e.camera,this.viewport);if(n!==this.worldTransform)this.world.setAttribute("transform",n),this.worldTransform=n;this.paintRings(e),this.paintLinks(e);let i=this.paintTurn(e);this.paintNodes(e,i),this.paintAddSlot(e,i),this.paintHeldPlace(t,i),this.paintContents(e);let r=this.labelRide(e);if(this.setLabelLayerTransform(r??""),this.waitingLabels&&(r!==null||this.labelsStill(e)))this.showWaitingLabels();else if(r===null)this.paintLabels(e),this.paintCounts(e),this.labelsPlaced={camera:{...e.camera},nodes:e.nodes};if(this.changedIds.clear(),this.paintOverlay(e),this.placeEditor(e),this.tabStopsChanged)this.updateTabStops();if(this.tooltip.isVisible)this.positionTooltip()}paintRings(t){let e=new Set;if(this.options.showRings!==!1)for(let n of t.rings){if(n.opacity<=0.01||n.radius<=0)continue;e.add(n.id);let i=this.ringViews.get(n.id);if(!i)i=Sb(n),this.ringViews.set(n.id,i),this.layers.rings.appendChild(i.group);if(n.gaps!==i.gaps||n.radius!==i.radius){let s=`${R(n.radius)}|${n.gaps.map((a)=>`${R(a.angle)}:${R(a.halfWidth)}`).join(",")}`;if(s!==i.shape)i.line.setAttribute("d",je(n.radius,n.gaps)),i.band.setAttribute("d",je(n.radius,[])),i.shape=s;i.gaps=n.gaps,i.radius=n.radius}let r=`translate(${R(n.cx)} ${R(n.cy)}) rotate(${R(n.rotation)})`;if(r!==i.transform)i.group.setAttribute("transform",r),i.transform=r;let o=n.opacity>=0.999?"":String(R(n.opacity));if(i.group.style.opacity!==o)i.group.style.opacity=o;if(i.color!==n.color)i.line.style.setProperty("--orbit-ring-color",n.color),i.color=n.color}for(let[n,i]of this.ringViews)if(!e.has(n))i.group.remove(),this.ringViews.delete(n)}paintLinks(t){let e=new Set;for(let n of t.links){let i=t.nodes.get(n.fromId),r=t.nodes.get(n.toId),o=Math.min(n.opacity,i?.opacity??0,r?.opacity??0);if(!i||!r||o<=0.01)continue;let s=Math.hypot(r.x-i.x,r.y-i.y);if(s<=i.radius+r.radius)continue;e.add(n.id);let a=this.linkViews.get(n.id);if(!a)a={element:T("line",{class:"orbit-link"}),geometry:"",opacity:""},this.linkViews.set(n.id,a),this.layers.links.appendChild(a.element);let l=(r.x-i.x)/s,d=(r.y-i.y)/s,c=String(R(i.x+l*i.radius)),u=String(R(i.y+d*i.radius)),h=String(R(r.x-l*r.radius)),m=String(R(r.y-d*r.radius)),p=`${c} ${u} ${h} ${m} ${n.color}`;if(p!==a.geometry)a.element.setAttribute("x1",c),a.element.setAttribute("y1",u),a.element.setAttribute("x2",h),a.element.setAttribute("y2",m),a.element.style.setProperty("--orbit-link-color",n.color),a.geometry=p;let b=o>=0.999?"":String(R(o));if(b!==a.opacity)a.element.style.opacity=b,a.opacity=b}for(let[n,i]of this.linkViews)if(!e.has(n))i.element.remove(),this.linkViews.delete(n)}paintTurn(t){let{turn:e}=t,n=e?R(zt(e.rotation),3):0,i=e&&n!==0?`rotate(${n} ${R(e.cx)} ${R(e.cy)})`:"";if(i!==this.turnTransform){for(let s of[this.layers.moons,this.layers.nodes])if(i)s.setAttribute("transform",i);else s.removeAttribute("transform");this.turnTransform=i}let r=i?n:0;if(!this.transition&&this.spinPhysics.mode==="idle"&&Math.abs(zt(r-this.speckLighting))>(this.ambientRunning?vb:0))vl(this.definitions,this.ids,r),this.speckLighting=r;return e?n:void 0}paintNodes(t,e){let n=this.editedId(),i=this.transition!==null,r={turn:e,speckRadius:this.speckRadius(),switches:xb,waiting:!1,flight:i},o=this.nodeDrag,s=o?.id??null,a=o?.moving?new Set(o.bodies.map((p)=>p.id)):null,l=o?.moving&&o.place?.into?o.place.parentId:null,d=`${s}
|
|
130
|
-
${l}`;if(a||d!==this.dragMarks)this.stillNodes=null;this.dragMarks=d;let c=this.stillNodes;if(!i&&c&&c.scene===this.scene&&c.scale===t.camera.scale&&c.speckRadius===r.speckRadius&&c.editedId===n&&this.changedIds.size===0){for(let p of c.turnedBack){let b=t.nodes.get(p.id);if(b)p.update(b,b.radius*t.camera.scale,r)}return}this.stillNodes=null;let u=[],h=0;if(this.transition){for(let p of t.nodes.values())if(p.cluster&&_i(p.cluster)&&!this.nodeViews.has(p.id))h+=1}let m=Math.max(bb,Math.ceil(h/mb));for(let p of t.nodes.values()){let b=this.nodeViews.get(p.id);if(b&&(b.node!==p.node||this.changedIds.has(p.id)||b.typeName!==this.extensions.typeName(p.node)))this.removeNodeView(p.id),b=void 0;if(!b&&this.transition&&p.cluster&&_i(p.cluster)){if(m<=0)continue;m-=1}if(!b)b=new lo(p,p.radius*t.camera.scale,this.ids,this.options.baseUrl,this.extensions,r,()=>this.clock.requestPaint()),b.element.setAttribute("aria-label",oo(p.node,0,p.node.children.length,this.extensions,this.words)),this.nodeViews.set(p.id,b),this.tabStopsChanged=!0;if(a?.has(p.id)){if(b.element.parentNode!==this.layers.carried)this.nodeGroups.delete(p.id),this.layers.carried.appendChild(b.element);b.update(p,p.radius*t.camera.scale,{...r,turn:void 0},!0),b.setLifted(p.id===s),b.setDropTarget(!1);continue}let g=this.placeInFamily(p,b);if(i){let f={entry:p,view:b,family:g};g.members.push(f),u.push(f)}else b.update(p,p.radius*t.camera.scale,r),b.setEditing(p.id===n),b.setLifted(p.id===s),b.setDropTarget(p.id===l)}for(let p of Array.from(this.nodeViews.keys()))if(!t.nodes.has(p))this.removeNodeView(p);if(i){for(let p of Array.from(this.families.values()))this.splitIfMixed(p);for(let{entry:p,view:b,family:g}of u){let f=Sd(g)?p.cluster:void 0;if(f)b.update({...p,x:f.x,y:f.y,radius:f.radius,opacity:f.nodeOpacity},p.radius*t.camera.scale,r);else b.update(p,p.radius*t.camera.scale,r,!0);b.setEditing(p.id===n),b.setLifted(p.id===s),b.setDropTarget(p.id===l)}}for(let[p,b]of this.families){if(b.group.childElementCount===0){b.group.remove(),this.families.delete(p);continue}kb(b,Sd(b)),b.members=[],b.motion=void 0}if(r.waiting)this.clock.requestPaint();else if(!i&&this.scene){let p=Array.from(this.nodeViews.values()).filter((b)=>b.isTurnedBack);this.stillNodes={scene:this.scene,scale:t.camera.scale,speckRadius:r.speckRadius,editedId:n,turnedBack:p}}}speckRadius(){let t=so(this.root.ownerDocument.defaultView?.devicePixelRatio??1);if(t!==this.specksBelow)this.root.style.setProperty("--_orbit-speck-rim",String(R(1/t,4))),this.specksBelow=t;return t}splitIfMixed(t){let e=t.members.find((a)=>a.entry.cluster)?.entry.cluster;if(!e)return;let n=t.members.filter((a)=>a.entry.cluster&&Bo(a.entry.cluster,e)),i=t.members.filter((a)=>!(a.entry.cluster&&Bo(a.entry.cluster,e)));if(i.length===0||n.length<2)return;let[r,o]=n.length<=i.length?[n,i]:[i,n];this.familyCount+=1;let s=this.createFamily(`${t.layer}|${t.parentId}|${this.flightCount}.${this.familyCount}`,t.layer,t.parentId);for(let a of r)this.moveIntoFamily(a.view,a.entry.id,s),a.family=s,s.members.push(a);t.members=o}placeInFamily(t,e){let n=t.role==="sun"?"sun":t.role==="moon"?"moon":"node",i=t.parentId??"",r=this.nodeGroups.get(t.id);if(r&&r.layer===n&&r.parentId===i)return r;let o=`${n}|${i}${t.cluster&&this.transition?`|${this.flightCount}`:""}`,s=this.families.get(o)??this.createFamily(o,n,i,t.cluster!==void 0&&_i(t.cluster));return this.moveIntoFamily(e,t.id,s),s}createFamily(t,e,n,i=!1){let r=T("g",{class:"orbit-family"});if(i)r.style.display="none";this.layers[e==="sun"?"suns":e==="moon"?"moons":"nodes"].appendChild(r);let o={group:r,layer:e,parentId:n,transform:"",opacity:"",hidden:i,members:[]};return this.families.set(t,o),o}moveIntoFamily(t,e,n){let i=this.root.ownerDocument.activeElement===t.element;if(n.group.appendChild(t.element),this.nodeGroups.set(e,n),i)t.element.focus({preventScroll:!0})}editedId(){return this.editor.isOpen?this.editing?.nodeId??null:null}paintAddSlot(t,e){let n=t.addSlot,i=n?t.nodes.get(n.parentId)?.node:void 0,r=this.nodeDrag?.moving?this.nodeDrag:null,o=r!==null&&!this.carriesPlanet(r)&&r.slot!==null?r:null,s=o?this.words.text("moveHere",{name:o.node.text||this.words.text("theIdea")}):this.words.text("addIdeaTo",{name:i?.text||this.words.text("thisIdea")}),a=o?o.place?.into?"waiting":"target":!1;this.addSlotView.update(n,s,this.editor.isOpen&&this.editing?.nodeId===null,e,a)}paintHeldPlace(t,e){let n=this.nodeDrag,i=n&&this.carriesPlanet(n)?t.nodes.get(n.id):void 0,r=n&&i?{parentId:n.parent.id,index:n.slot??0,x:i.x,y:i.y,radius:i.radius,opacity:i.opacity,unturned:i.unturned}:void 0;this.heldPlaceView.update(r,"",!1,e,n?.place?.into?"waiting":"target")}placeEditor(t){let e=this.editing;if(!e||!this.editor.isOpen)return;let{camera:n}=t;if(e.nodeId===null){let o=t.addSlot,s=o&&o.parentId===e.parentId&&o.opacity>0.5;this.editor.place(s?this.editorPlacement(J(n,this.viewport,o),o.radius*n.scale,"planet",!1,!0):null);return}let i=t.nodes.get(e.nodeId),r=i&&i.opacity>0.5;this.editor.place(r?this.editorPlacement(J(n,this.viewport,i),i.radius*n.scale,i.role,this.usesLightText(i),!1,i.hiddenChildren):null)}editorPlacement(t,e,n,i,r,o=0){let s=e<32,a=s?Math.max(140,ni(n,e)):ni(n,e);return{x:t.x,y:t.y,width:a,fontSize:Math.max(13,kl(n,a,this.editor.value||this.words.text("newIdea"),this.labelFonts.inside(n))),maxHeight:Math.max(44,e*1.5),role:n,light:i&&!s,slot:r,floating:s&&!r,lowest:!s&&le(n,e,o)?ae*e-ho/2:void 0}}removeNodeView(t){this.nodeViews.get(t)?.element.remove(),this.nodeViews.delete(t),this.stillNodes=null,this.nodeGroups.delete(t),this.lightText.delete(t),this.tabStopsChanged=!0}labelRide(t){let e=this.labelsPlaced,n=this.cameraFlight!==null||this.wheelZoom!==null||this.glide.isMoving||this.dragging;if(!e||!n||e.nodes!==t.nodes||this.transition||this.changedIds.size>0)return null;let{camera:i}=t,{width:r,height:o}=this.viewport,s=i.scale/e.camera.scale,a=(e.camera.x-i.x)*i.scale,l=(e.camera.y-i.y)*i.scale;if(s>vd||s<1/vd||Math.hypot(a,l)>pb*Math.min(r,o))return null;return`translate(${R(r/2*(1-s)+a,2)}px, ${R(o/2*(1-s)+l,2)}px) scale(${R(s,5)})`}fitLabelsAgain(){this.labelsPlaced=null,this.waitingLabels=null,this.clock.requestPaint()}labelsStill(t){let e=this.labelsPlaced;return e!==null&&e.nodes===t.nodes&&e.camera.x===t.camera.x&&e.camera.y===t.camera.y&&e.camera.scale===t.camera.scale&&this.transition===null&&this.changedIds.size===0}setLabelLayerTransform(t){if(t!==this.labelLayerTransform)this.labelLayer.style.transform=t,this.labelLayerTransform=t}paintLabels(t){if(this.labelOrder?.nodes!==t.nodes){let a=this.transition?null:this.scene,l=a&&this.labelOrder?.scene===a?this.labelOrder.ids:null,d=l?l.map((c)=>t.nodes.get(c)):ci(t.nodes.values());this.labelOrder={nodes:t.nodes,order:d,scene:a,ids:l??d.map((c)=>c.id)}}let e=this.transition!==null||this.cameraFlight!==null||this.wheelZoom!==null||this.glide.isMoving||this.dragging,n=ui(t,this.labelOrder.order,{viewport:this.viewport,hasImage:(a)=>this.showsImage(a.node),pillIcon:(a)=>this.showsImage(a.node)?this.extensions.icon(a.node):void 0,hasIcon:(a)=>Boolean(this.extensions.icon(a.node)),previousSide:(a)=>this.labels.get(a)?.direction??null,inFlight:this.transition!==null,measures:this.labelFonts,moving:e,isShown:(a)=>this.labels.get(a)?.isShown??!1,counts:!0}),i=new Set,r=this.editedId(),o=this.animationsEnabled()?xd:1/0,s=[];for(let a of n)if(a.placement==="inside")this.usesLightText(a.entry);for(let a of n){let{entry:l}=a;if(l.id===r)continue;let d=this.labels.get(l.id);if(d&&(d.node!==l.node||this.changedIds.has(l.id)||d.typeName!==this.extensions.typeName(l.node)))d.element.remove(),this.labels.delete(l.id),d=void 0;if(!d?.isShown){if(o<=0){s.push(a);continue}o-=1}i.add(l.id),this.showLabel(a,d,e)}if(this.waitingLabels=s.length>0?{plans:s,moving:e}:null,this.waitingLabels)this.clock.requestPaint();for(let[a,l]of this.labels){if(i.has(a))continue;let d=t.nodes.get(a);if(d)l.update({x:0,y:0,screenRadius:0,role:d.role,placement:"hidden",opacity:0});else l.element.remove(),this.labels.delete(a)}}showLabel(t,e,n){let{entry:i}=t,r=e;if(!r)r=new mo(i.node,this.extensions),this.labels.set(i.id,r),this.labelLayer.appendChild(r.element);r.update({x:t.x,y:t.y,screenRadius:t.screenRadius,role:i.role,placement:t.placement,opacity:t.opacity,light:t.placement==="inside"&&this.usesLightText(i),measure:this.labelFonts.inside(i.role,i.node),narrower:!n,countWidth:t.countWidth,direction:t.direction,distance:t.distance,offset:t.offset,lines:t.lines,width:t.width,pillText:t.text})}showWaitingLabels(){let t=this.waitingLabels;if(!t)return;let e=this.editedId(),n=t.plans.splice(0,xd);for(let i of n){let r=this.labels.get(i.entry.id);if(i.entry.id!==e&&(!r||r.node===i.entry.node))this.showLabel(i,r,t.moving)}if(t.plans.length>0)this.clock.requestPaint();else this.waitingLabels=null}showsImage(t){return(this.nodeViews.get(t.id)?.hasImage??!1)||Boolean(this.extensions.nodeType(t)?.render)}paintContents(t){let{camera:e}=t,n=new Set;for(let i of t.nodes.values()){let r=this.extensions.nodeType(i.node);if(!r?.render)continue;let o=this.contents.get(i.id);if(o&&(o.node!==i.node||this.changedIds.has(i.id)))this.removeContent(i.id),o=void 0;if(!o){let u=document.createElement("div");u.className="orbit-node-content",u.dataset.orbitFor=i.id,Jn(u,i.node,this.extensions.typeName(i.node)),Qn(u,r),this.contentLayer.appendChild(u);let h=r.render,m=Rt(`The "${this.extensions.typeName(i.node)}" node type's render()`,void 0,()=>h(i.node,u));o={element:u,node:i.node,cleanup:typeof m==="function"?m:void 0,transform:"",opacity:"",visible:!0},this.contents.set(i.id,o)}n.add(i.id);let s=i.radius*e.scale,a=i.opacity>0.01&&s>=6;if(a!==o.visible)o.element.style.display=a?"":"none",o.visible=a;if(!a)continue;let l=J(e,this.viewport,i),d=`translate3d(${R(l.x-50,1)}px, ${R(l.y-50,1)}px, 0) scale(${R(s/50,4)})`;if(d!==o.transform)o.element.style.transform=d,o.transform=d;let c=i.opacity>=0.999?"":String(R(i.opacity,3));if(c!==o.opacity)o.element.style.opacity=c,o.opacity=c}for(let i of Array.from(this.contents.keys()))if(!n.has(i))this.removeContent(i)}removeContent(t){let e=this.contents.get(t);if(!e)return;if(e.element.remove(),this.contents.delete(t),e.cleanup)Rt("A node type's render() cleanup",void 0,e.cleanup)}usesLightText(t){let e=this.lightText.get(t.id);if(e&&e.color===t.color)return e.light;let n=this.nodeViews.get(t.id)?.resolvedFill()??"",i=this.textColors??=this.resolveTextColors(),r=n!==""&&pi(n,i.light,t.role==="sun"?i.root:i.dark);return this.lightText.set(t.id,{color:t.color,light:r}),r}resolveTextColors(){let t=this.exportTokens();return{light:Ot(t["node-text-inverse"],t),dark:Ot(t["node-text"],t),root:Ot(t["root-text"],t)}}paintOverlay(t){let{camera:e}=t,n=this.scene,i=this.viewMode==="focus"&&!this.transition&&n?t.nodes.get(n.focusId):void 0,r=i&&n&&this.showsActions()&&this.zoomLevel()<1.5?this.actionsPlace(n,i,e):null;if(i&&r)this.actionBar.show(i.node,r.x,r.y,r.wrap);else this.actionBar.hide()}paintCounts(t){let{camera:e}=t,n=new Set;if(!this.transition)for(let i of t.nodes.values()){let r=i.radius*e.scale;if(!le(i.role,r,i.hiddenChildren)||i.opacity<0.5)continue;let o=J(e,this.viewport,i),s=this.counts.get(i.id);if(!s){let d=document.createElement("span");d.className="orbit-count",d.setAttribute("aria-hidden","true"),d.dataset.orbitFor=i.id,this.labelLayer.appendChild(d),s={element:d,text:"",transform:""},this.counts.set(i.id,s)}let a=`+${i.hiddenChildren}`;if(a!==s.text)s.element.textContent=a,s.text=a;let l=jt(R(o.x+r*ae,1),R(o.y+r*ae,1),"-50%, -50%");if(l!==s.transform)s.element.style.transform=l,s.transform=l;n.add(i.id)}for(let[i,r]of this.counts)if(!n.has(i))r.element.remove(),this.counts.delete(i)}clearViews(){this.labelsPlaced=null,this.waitingLabels=null,this.setLabelLayerTransform("");for(let t of Array.from(this.nodeViews.keys()))this.removeNodeView(t);for(let t of this.labels.values())t.element.remove();this.labels.clear();for(let t of this.ringViews.values())t.group.remove();this.ringViews.clear();for(let t of this.linkViews.values())t.element.remove();this.linkViews.clear();for(let t of this.counts.values())t.element.remove();this.counts.clear();for(let t of this.families.values())t.group.remove();this.families.clear();for(let t of Array.from(this.contents.keys()))this.removeContent(t);this.actionBar.reset()}updateTabStops(){this.tabStopsChanged=!1;let t=this.options.interactive!==!1,e=this.transition?.target??this.scene;if(!this.activeId||!e?.nodes.has(this.activeId)||!this.nodeViews.has(this.activeId))this.activeId=e?.focusId??null;for(let[n,i]of this.nodeViews){let r=t?n===this.activeId?"0":"-1":null;if(i.element.getAttribute("tabindex")!==r)if(r===null)i.element.removeAttribute("tabindex");else i.element.setAttribute("tabindex",r)}}focusNodeElement(t){let e=this.nodeViews.get(t);if(!e)return;this.activeId=t,this.updateTabStops(),e.element.focus({preventScroll:!0})}updateControls(){this.root.dataset.orbitView=this.viewMode;let t=this.tree?W(this.tree,this.focusId):[];this.controls.update({viewMode:this.viewMode,path:t,outlineOpen:this.outline.isVisible})}updateOutline(){if(this.tree)this.outline.update(this.tree,this.focusId,this.options.maxDepth,this.options.interactive!==!1,(t)=>this.extensions.icon(t));this.viewer.refresh()}toggleOutline(){this.outline.setVisible(!this.outline.isVisible),this.updateControls()}selectFromOutline(t){if(this.outline.isVisible)this.outline.setVisible(!1);this.activeId=t,this.returnFocusToMap=!0,this.navigate("focus",t),this.updateControls()}announceView(){if(this.viewMode==="all"){this.outline.announce(this.words.text("overviewAnnouncement"));return}let t=this.getFocusedNode();if(t){let e=t.children.length,n=t.text||this.words.text("untitled");this.outline.announce(e>0?`${n}, ${this.words.count("ideaCount",e)}`:n)}}updateTooltip(){let t=this.dragging?null:this.hoveredId??this.keyboardFocusId,e=t?this.display?.nodes.get(t):void 0;if(!e||this.transition){this.tooltip.hide();return}let n=e.node,i=this.extensions.nodeType(n)?.label,r=this.labels.get(e.id)?.currentPlacement??"hidden",o=n.note?Yl(n.note.slice(0,400)).replace(/\s+/g," ").trim():"";if(!(r==="hidden"||n.text.length>24)&&!o&&!n.status&&!i){this.tooltip.hide();return}let a=[i??"",n.status?this.words.text("statusLabel",{status:n.status}):"",o.length>140?`${o.slice(0,139)}…`:o].filter(Boolean),l=this.tooltipAnchor(e);this.tooltip.show([this.extensions.icon(n),n.text||this.words.text("untitled")].filter(Boolean).join(" "),a.join(" · "),l.x,l.y)}positionTooltip(){let t=this.hoveredId??this.keyboardFocusId,e=t?this.display?.nodes.get(t):void 0;if(!e){this.tooltip.hide();return}let n=this.tooltipAnchor(e);this.tooltip.place(n.x,n.y)}tooltipAnchor(t){let e=this.display?.camera??this.camera,n=J(e,this.viewport,t);return{x:n.x,y:n.y-t.radius*e.scale}}handleClick=(t)=>{if(this.options.interactive===!1||t.detail>1)return;if(_d(t.target)){this.editNewNode();return}let e=yt(t.target);if(e)this.activate(e)};handleContextMenu=(t)=>{let e=yt(t.target);if(!e||this.options.interactive===!1)return;if(this.openNodeContext(e,this.contextPoint(t,e)))t.preventDefault()};contextPoint(t,e){let n=this.nodeOnScreen(e),i=this.root.getBoundingClientRect(),r={x:t.clientX-i.left,y:t.clientY-i.top},s=(this.display?.nodes.get(e)?.radius??0)*(this.display?.camera.scale??1)+24;return Number.isFinite(r.x)&&Number.isFinite(r.y)&&Math.hypot(r.x-n.x,r.y-n.y)<=s?r:n}nodeOnScreen(t){let e=this.display?.nodes.get(t);if(!e)return this.viewportCenter();return J(this.display?.camera??this.camera,this.viewport,e)}openNodeContext(t,e,n=!1){let r=(this.transition?.target??this.scene)?.nodes.get(t);if(!r)return!1;let o=this.now(),s=this.lastContext;if(s&&s.id===t&&o-s.time<hb)return s.taken;let a={node:r.node,x:Math.round(e.x),y:Math.round(e.y)},l=this.options.onNodeContext!==void 0||(this.listeners.get("node-context")?.size??0)>0;this.options.onNodeContext?.(a);let d=!this.emit("node-context",a,!0)||l;if(!d&&this.options.editable)if(n&&this.canLift(t))this.editOnLift=t,d=!0;else d=this.editNode(t);if(this.lastContext={id:t,time:o,taken:d},d)this.hoveredId=null,this.keyboardFocusId=null,this.updateTooltip();return d}canLift(t){if(!this.options.editable||this.options.interactive===!1||this.transition||this.editing)return!1;let e=this.display?.nodes.get(t);return e!==void 0&&e.role!=="sun"&&e.opacity>0.5&&e.parentId!==void 0&&this.tree!==null&&W(this.tree,t).length>1}liftNode(t,e){let n=t!==null&&this.editOnLift===t;this.editOnLift=null;let i=this.display,r=this.tree;if(t===null||!i||!r||!this.canLift(t))return!1;let o=W(r,t),s=o[o.length-1],a=o[o.length-2],l=i.nodes.get(t),d=Pe(i.camera,this.viewport,e),c=Array.from(i.nodes.values()).filter((u)=>u.id===t||u.role==="moon"&&u.hostId===t).map((u)=>({...u,x:u.x-l.x,y:u.y-l.y,unturned:void 0,cluster:void 0}));return this.nodeDrag={id:t,node:s,parent:a,index:a.children.indexOf(s),unreachable:Ll(s,a.id),moving:!1,point:e,grab:{x:d.x-l.x,y:d.y-l.y},bodies:c,ringRadius:null,rings:null,slot:null,place:null,editOnRelease:n,scale:1},this.hoveredId=null,this.updateTooltip(),this.clock.requestPaint(),!0}dragNode(t,e){let n=this.nodeDrag;if(!n)return;if(this.destroyed){this.nodeDrag=null;return}if(n.point=t,e==="move"){if(!n.moving)this.startCarrying(n);this.updateDropPlace(n),this.clock.requestPaint();return}let i=n.moving?this.dropPlaceAt(n):null;if(e==="drop"&&i){this.dropNode(n,i);return}this.putBack(n,e==="drop")}startCarrying(t){if(t.moving=!0,this.viewMode==="focus"&&this.scene?.kind==="focus")t.ringRadius=this.scene.rings[0]?.radius??0,t.rings={focusId:this.scene.focusId,radii:this.scene.rings.map((e)=>e.radius),size:{...this.viewport}},t.slot=t.parent.id===this.focusId?t.index:null;t.place=t.slot===null?null:{parentId:this.focusId,index:t.slot,into:!1},this.emitDrag("start",t.node,t.parent,t.index),this.paint()}carriesPlanet(t){return t.moving&&t.slot!==null&&t.parent.id===this.focusId&&this.viewMode==="focus"}dropPlaceAt(t){let e=this.display;if(!e)return null;let{camera:n}=e,i=Pe(n,this.viewport,t.point),r=t.place?.into?t.place.parentId:null,o=this.viewMode==="focus",s=(h,m)=>{let p=o&&h.role==="planet"?Math.max(h.radius*ob,sb/n.scale):h.radius+rb/n.scale;return m?p*ab:p},a=Dl(e,i,t.unreachable,s,r);if(a)return{parentId:a.id,index:null,into:!0};let l=t.slot===null?null:{parentId:this.focusId,index:t.slot,into:!1},d=new Set(t.bodies.map((h)=>h.id));for(let h of e.nodes.values())if(t.unreachable.has(h.id)&&!d.has(h.id)&&Math.hypot(i.x-h.x,i.y-h.y)<=h.radius)return t.place?.into?l:t.place;let c=this.transition?.target??this.scene,u=e.nodes.get(this.focusId);if(t.ringRadius!==null&&c&&u){let h=Math.max(lb/n.scale,(t.bodies[0]?.radius??0)*1.2),m=this.transition?0:this.rotation,p=Pl(c,{x:i.x-u.x,y:i.y-u.y},m,t.ringRadius,h,t.id,t.slot);if(p!==null)return{parentId:this.focusId,index:p,into:!1}}return l}updateDropPlace(t){let e=this.dropPlaceAt(t);if(Rl(e,t.place))return;t.place=e;let n=e&&this.tree?U(this.tree,e.parentId):null;if(this.emitDrag("over",t.node,n,e?.index??null),e&&!e.into&&e.index!==t.slot)t.slot=e.index,this.relayoutForDrag();else this.paint()}relayoutForDrag(){let t=this.buildScene();if(!t||!this.scene)return;let e=this.now(),n=this.currentDisplay(e);if(this.nextScene=null,!this.animationsEnabled()){this.transition=null,this.landingCamera=null,this.restOn(t,!1),this.camera={...n.camera},this.paint();return}this.startTransition(n,t,Re,e,ib,{...n.camera})}dropNode(t,e){if(e.parentId===t.parent.id&&(e.index??t.parent.children.length-1)===t.index){this.putBack(t,!1);return}this.dropFrom=this.display,this.nodeDrag=null;let n=this.moveNode(t.id,e.parentId,e.index??void 0);if(this.dropFrom=null,!n){this.rebuild("morph"),this.emitDrag("end",t.node,null,null);return}let i=this.tree,r=W(i,n.id),o=r[r.length-2]??null;this.emitDrag("end",n,o,o?o.children.indexOf(n):null)}putBack(t,e){if(this.nodeDrag=null,t.moving){this.dropFrom=this.display,this.rebuild("morph"),this.dropFrom=null,this.emitDrag("end",t.node,null,null);return}if(this.clock.requestPaint(),e&&t.editOnRelease)this.editNode(t.id)}emitDrag(t,e,n,i){let r={phase:t,node:e,parent:n,index:i};this.options.onNodeDrag?.(r),this.emit("node-drag",r)}withCarried(t){let e=this.nodeDrag;if(!e?.moving)return t;let n=e.place?.into?yd:1;if(e.scale+=(n-e.scale)*(this.prefersReducedMotion()?1:db),Math.abs(n-e.scale)<0.01)e.scale=n;else this.clock.requestPaint();let{scale:i}=e,r=Pe(t.camera,this.viewport,e.point),o=r.x-e.grab.x*i,s=r.y-e.grab.y*i,a=i>(1+yd)/2?1:0,l=new Map(t.nodes);for(let d of e.bodies)l.set(d.id,{...d,x:o+d.x*i,y:s+d.y*i,radius:d.radius*i,opacity:1,labelOpacity:a});return{...t,nodes:l}}activate(t){let n=(this.transition?.target??this.scene)?.nodes.get(t);if(!n)return;if(this.transition&&this.now()-this.transition.startedAt<ub)return;if(this.options.onNodeClick?.(n.node),this.emit("node-click",{node:n.node}),this.viewMode==="focus"&&n.role==="sun"){this.goBack();return}this.navigate("focus",t)}goBack(){if(this.viewMode==="all")return this.navigate("focus",this.focusId);let t=this.focusPath[this.focusPath.length-2];return t===void 0?!1:this.navigate("focus",t)}handleKeyDown=(t)=>{if(this.options.interactive===!1||this.viewer.isOpen||t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)return;let e=yt(t.target),n=_d(t.target),i=!0;switch(t.key){case"Enter":case" ":if(t.key==="Enter"&&t.shiftKey&&this.editingKeys)i=n?this.editNewNode():e!==null&&this.addBeside(e);else if(n)this.editNewNode();else if(e)this.activate(e);else i=!1;break;case"F2":i=this.options.editable===!0&&e!==null&&this.editNode(e);break;case"Tab":case"Insert":i=this.editingKeys&&!t.shiftKey&&(n?this.editNewNode():e!==null&&this.editNewNode(e));break;case"Delete":i=this.editingKeys&&e!==null&&this.removeWithKey(e);break;case"Escape":case"Backspace":if(t.key==="Escape"&&this.nodeDrag){this.putBack(this.nodeDrag,!1);break}i=this.goBack();break;case"ContextMenu":i=e!==null&&this.openNodeContext(e,this.nodeOnScreen(e));break;case"F10":i=t.shiftKey&&e!==null&&this.openNodeContext(e,this.nodeOnScreen(e));break;case"+":case"=":this.zoomBy(Ti);break;case"-":case"_":this.zoomBy(1/Ti);break;case"0":this.fit();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Home":case"End":i=this.moveFocus(t.key,n?ve:e);break;default:i=!1}if(i)t.preventDefault()};moveFocus(t,e){let n=this.transition?.target??this.scene,i=this.tree;if(!n||!i)return!1;if(this.viewMode==="focus"){let l=Nd(n);if(n.addSlot&&this.addSlotView.isShown){let u=xe(n.addSlot.orbitAngle),h=l.filter((m)=>m!==ve&&xe(m.orbitAngle??0)<u).length;l.splice(h,0,ve)}if(l.length===0)return!1;let d=l.findIndex((u)=>u===ve?e===ve:u.id===e),c;if(t==="ArrowUp")return this.focusNodeElement(n.focusId),!0;if(t==="Home")c=l[0];else if(t==="End")c=l[l.length-1];else if(d===-1)c=t==="ArrowLeft"?l[l.length-1]:l[0];else if(t==="ArrowRight")c=l[(d+1)%l.length];else if(t==="ArrowLeft")c=l[(d-1+l.length)%l.length];else c=l[d];if(c===ve)this.addSlotView.element.focus({preventScroll:!0});else this.turnToTop(c),this.focusNodeElement(c.id);return!0}let r=e?U(i,e):null;if(!r)return this.focusNodeElement(i.id),!0;let o=r.parent?.children??[r],s=o.indexOf(r),a;if(t==="ArrowUp")a=r.parent;else if(t==="ArrowDown")a=r.children.find((l)=>n.nodes.has(l.id));else if(t==="ArrowLeft")a=o[s-1];else if(t==="ArrowRight")a=o[s+1];else if(t==="Home")a=i;else if(t==="End")a=o[o.length-1];if(!a||!n.nodes.has(a.id))return!0;return this.focusNodeElement(a.id),this.keepInView(a.id),!0}turnToTop(t){if(t.orbitAngle===void 0||this.transition)return;let e=-90-t.orbitAngle;if(this.prefersReducedMotion()){this.spinPhysics.angle=e,this.clock.requestPaint();return}this.spinPhysics.settleTo(e),this.clock.add(this.spinTask)}keepInView(t){let e=this.display?.nodes.get(t);if(!e||!this.display)return;let n=J(this.display.camera,this.viewport,e),i=e.radius*this.display.camera.scale,r=48;if(n.x-i>=r&&n.x+i<=this.viewport.width-r&&n.y-i>=r&&n.y+i<=this.viewport.height-r)return;this.flyCamera(this.clampCamera({...this.camera,x:e.x,y:e.y}),this.viewportCenter())}handlePointerOver=(t)=>{if(t.pointerType!=="mouse"||this.dragging)return;let e=yt(t.target);if(e!==this.hoveredId)this.hoveredId=e,this.updateTooltip()};handlePointerOut=(t)=>{let e=yt(t.relatedTarget);if(e!==this.hoveredId)this.hoveredId=e,this.updateTooltip(),this.syncAmbientMotion()};handleFocusIn=(t)=>{let e=yt(t.target);if(!e)return;if(this.nodeViews.get(e)?.showFocusRing(),e!==this.activeId)this.activeId=e,this.tabStopsChanged=!0,this.clock.requestPaint();this.keyboardFocusId=Fb(t.target)?e:null,this.updateTooltip()};handleFocusOut=(t)=>{if(!yt(t.relatedTarget))this.keyboardFocusId=null,this.updateTooltip(),this.syncAmbientMotion()};dragGestureAt(t){let e=this.scene;if(!e||this.transition)return"none";if(this.viewMode==="all"||this.zoomLevel()>1.04)return"pan";if(!Array.from(e.nodes.values()).some((i)=>i.role==="planet"))return"none";let n=this.sunOnScreen();return Math.hypot(t.x-n.x,t.y-n.y)>12?"spin":"none"}sunOnScreen(){let t=this.scene,e=t?this.display?.nodes.get(t.focusId):void 0;return e&&this.display?J(this.display.camera,this.viewport,e):this.viewportCenter()}releaseSpin(t){let e=this.scene;if(!e)return;if(this.prefersReducedMotion()){this.spinPhysics.stop(),this.spinSettled();return}let n=Nd(e).map((i)=>-90-(i.orbitAngle??0));if(this.spinPhysics.release(t,n),this.spinPhysics.isMoving)this.clock.add(this.spinTask);else this.spinSettled()}spinTask=(t,e)=>{let n=this.spinPhysics.step(e);if(this.tickHaptics(),!n)this.spinSettled();return n};spinSettled(){if(this.userSpun){this.userSpun=!1;let t=this.planetNearestTop();if(t)this.options.onSpinSettle?.(t.node),this.emit("spin-settle",{planet:t.node})}this.syncAmbientMotion()}planetNearestTop(){let t=this.scene;if(!t||this.viewMode!=="focus")return null;let e=null,n=1/0;for(let i of t.nodes.values()){if(i.role!=="planet")continue;let r=Math.abs(zt((i.orbitAngle??0)+this.rotation+90));if(r<n||r===n&&e&&xe(i.orbitAngle??0)<xe(e.orbitAngle??0))e=i,n=r}return e}tickHaptics(){let t=this.planetNearestTop();if(!t||t.id===this.topPlanetId)return;let e=this.topPlanetId;this.topPlanetId=t.id;let n=Math.abs(this.spinPhysics.velocity)*1000;if(this.options.spin?.haptics&&e!==null&&n<tb&&typeof navigator<"u")navigator.vibrate?.(4)}syncAmbientMotion(){if(!this.ambientRunning&&this.shouldDrift())this.ambientRunning=!0,this.clock.add(this.ambientTask)}shouldDrift(){return Boolean(this.options.orbitAnimation)&&!this.destroyed&&this.scene!==null&&this.viewMode==="focus"&&!this.transition&&this.spinPhysics.mode==="idle"&&!this.dragging&&this.cameraFlight===null&&this.wheelZoom===null&&!this.glide.isMoving&&this.hoveredId===null&&this.keyboardFocusId===null&&this.onScreen&&!this.viewer.isOpen&&!this.prefersReducedMotion()}ambientTask=(t,e)=>{if(!this.shouldDrift())return this.ambientRunning=!1,this.pendingDrift=0,!1;let n=this.spinningReach(this.scene)*this.camera.scale;if(n<=0)return this.ambientRunning=!1,this.pendingDrift=0,!1;let i=this.options.orbitSpeed>0&&Number.isFinite(this.options.orbitSpeed)?this.options.orbitSpeed:Ci.orbitSpeed;if(this.pendingDrift+=360/Math.max(1,i)*(e/1000),this.pendingDrift<re(gb/n))return"hold";return this.spinPhysics.angle+=this.pendingDrift,this.pendingDrift=0,!0};spinningReach(t){if(this.spinReach?.scene!==t){let e=t.nodes.get(t.focusId),n=0;for(let i of t.nodes.values())if(i.spins)n=Math.max(n,Math.hypot(i.x-(e?.x??0),i.y-(e?.y??0))+i.radius);this.spinReach={scene:t,reach:n}}return this.spinReach.reach}zoomLevel(){return this.scene?this.camera.scale/this.scene.frame.scale:1}zoomRange(){let t=this.options.zoom?.minimum??Xm,e=this.options.zoom?.maximum??Jm;if(this.viewMode==="focus")return[Zm,Math.max(1,e)];return[Math.min(1,t),Math.max(1,e)]}viewportCenter(){return{x:this.viewport.width/2,y:this.viewport.height/2}}clampCamera(t){let e=this.scene;if(!e)return t;let{frame:n}=e,i=t.scale/n.scale,r=e.kind==="focus"?Math.max(0,1-1/i):1,o=this.viewport.width/2/n.scale*r,s=this.viewport.height/2/n.scale*r;return{scale:t.scale,x:Math.min(n.x+o,Math.max(n.x-o,t.x)),y:Math.min(n.y+s,Math.max(n.y-s,t.y))}}panCamera(t,e){if(!this.scene||this.transition)return!1;let n=this.camera;return this.camera=this.clampCamera(Na(this.camera,t,e)),this.clock.requestPaint(),Math.abs(n.x-this.camera.x)>0.000001||Math.abs(n.y-this.camera.y)>0.000001}glideTask=(t,e)=>{if(e<=0)return"hold";if(this.glide.isMoving&&!this.transition){let n=this.glide.step(e);if(this.panCamera(n.x,n.y)&&this.glide.isMoving)return!0}return this.glide.stop(),this.syncAmbientMotion(),!1};zoomAt(t,e){if(!this.scene||this.transition||!Number.isFinite(t)||t<=0)return!1;let[n,i]=this.zoomRange(),r=this.zoomLevel(),o=Math.min(i,Math.max(n,r*t));if(Math.abs(o-r)<0.000001)return!1;return this.camera=this.clampCamera(Tr(this.camera,this.viewport,o/r,e)),this.hoveredId=null,this.tooltip.hide(),this.clock.requestPaint(),this.checkZoomNavigation(e),!0}checkZoomNavigation(t){if(this.viewMode!=="focus"||!this.scene||this.transition)return;let e=this.zoomLevel();if(e>=Km){let n=this.bodyAt(t,Ym);if(n)this.navigate("focus",n.id);return}if(e<=qm){let n=this.focusPath[this.focusPath.length-2];if(n===void 0)this.navigate("all",this.focusId);else this.navigate("focus",n)}}bodyAt(t,e=0){let n=this.display;if(!n)return null;let i=null;for(let r of n.nodes.values()){if(r.role!=="planet"&&r.role!=="moon")continue;let o=J(this.camera,this.viewport,r),s=r.radius*this.camera.scale;if(s<e)continue;if(Math.hypot(t.x-o.x,t.y-o.y)<=s*1.35+12&&(!i||r.radius<i.radius))i=r}return i}settleZoom(){if(this.viewMode==="focus"&&this.scene&&!this.transition&&this.zoomLevel()<0.999)this.fit();this.syncAmbientMotion()}handleWheel(t,e){let n=this.options.zoom?.wheel??"auto";if(n===!1||!this.scene)return;if(!(t.ctrlKey||t.metaKey)&&(n==="modifier"||n==="auto"&&this.pageScrolls())){this.controls.showHint(this.words.text("scrollToZoom",{key:_b()?"⌘":"Ctrl"}));return}if(t.preventDefault(),this.transition)return;this.cameraFlight=null,this.glide.stop();let r=Math.log(Ln(t,this.viewport.height));if(this.wheelZoom)this.wheelZoom.remaining+=r,this.wheelZoom.anchor=e;else this.wheelZoom={remaining:r,anchor:e},this.clock.add(this.wheelTask)}wheelTask=(t,e)=>{let n=this.wheelZoom;if(!n||this.transition)return this.wheelZoom=null,!1;if(e<=0)return"hold";let i=Math.abs(n.remaining)<0.002,r=i?n.remaining:n.remaining*(1-Math.exp(-e/Qm));if(n.remaining-=r,!this.zoomAt(Math.exp(r),n.anchor))n.remaining=0;if(i||n.remaining===0)return this.wheelZoom=null,this.settleZoom(),!1;return!0};handleDoubleTap(t,e){if(!this.scene||this.transition||yt(e))return;if(this.viewMode==="all")this.zoomStep(2,t);else if(this.zoomLevel()>1.04)this.fit()}zoomStep(t,e){let n=this.scene;if(!n||this.transition||!(t>0))return;let i=this.cameraFlight?.target??this.camera,[r,o]=this.zoomRange(),s=i.scale/n.frame.scale,a=Math.min(o,Math.max(r,s*t));this.flyCamera(this.clampCamera(Tr(i,this.viewport,a/s,e)),e)}flyCamera(t,e){if(!this.scene||this.transition)return;if(this.glide.stop(),this.wheelZoom=null,!this.animationsEnabled()){this.cameraFlight=null,this.camera=t,this.paint(),this.afterCameraFlight(e);return}let n=Fr(this.camera,t,this.viewport),i=Math.min(650,Math.max(240,n.length*520));this.cameraFlight={path:n,target:t,anchor:e,startedAt:this.now(),duration:i},this.clock.add(this.cameraFlightTask)}cameraFlightTask=(t)=>{let e=this.cameraFlight;if(!e||this.transition)return this.cameraFlight=null,!1;let n=Math.min(1,(t-e.startedAt)/e.duration);if(this.camera=n>=1?e.target:e.path.at(Nr(n)),n>=1)return this.cameraFlight=null,this.afterCameraFlight(e.anchor),!1;return!0};afterCameraFlight(t){this.checkZoomNavigation(t),this.settleZoom()}pageScrolls(){let t=this.now();if(this.pageScrollCheck&&t-this.pageScrollCheck.time<500)return this.pageScrollCheck.scrolls;let e=Cb(this.container);return this.pageScrollCheck={time:t,scrolls:e},e}updateEmbedding(){this.pageScrollCheck=null,this.root.classList.toggle("orbit--embedded",this.pageScrolls())}emitFocusChange(t){let e=t[t.length-1];this.options.onFocusChange?.(e),this.emit("focus-change",{node:e,path:t})}emit(t,e,n=!1){for(let r of Array.from(this.listeners.get(t)??[]))try{r(e)}catch(o){Ob(o)}if(typeof CustomEvent!=="function")return!0;let i=new CustomEvent(`orbit-${t}`,{detail:e,bubbles:!0,composed:!0,cancelable:n});return this.container.dispatchEvent(i)}runAction(t,e,n){if(!this.allowAction(t,e,n))return;if(e==="link"){if(lt(t.link)){let r=this.findLinked(t.link);if(r)this.followNodeLink(r);return}let i=t.link?V(t.link,"link"):null;if(i&&typeof window<"u")window.open(G(i,this.options.baseUrl),"_blank","noopener");return}if(!wb.has(e)){let i=this.extensions.actions(t).find((r)=>r.id===e);if(i)Rt(`The "${i.id}" action's run()`,void 0,()=>i.run(t,n));return}if((e==="image"||e==="video")&&this.options.mediaViewer!==!1&&this.viewer.open({node:t,kind:e}))return;if(this.options.showDetailSheet!==!1)this.openDetails(t,e)}allowAction(t,e,n){if(this.options.onAction?.({node:t,action:e,sourceEvent:n})===!1)return!1;let i=!1,r={node:t,action:e,sourceEvent:n,preventDefault:()=>{i=!0},get defaultPrevented(){return i}};return this.emit("action",r,!0)&&!i}viewFromSheet(t,e,n,i){if(!this.allowAction(t,e,n)){this.sheet.close();return}this.viewer.open({node:t,kind:e},{startAt:i})}openDetails(t,e){let n=this.tree?W(this.tree,t.id).slice(0,-1):[];this.sheet.open({node:t,path:n,siblings:t.parent?.children??[t],section:e,baseUrl:this.options.baseUrl,noteRenderer:this.options.noteRenderer,resolveLink:(i)=>this.findLinked(i),onFollowLink:(i)=>this.followNodeLink(i),onViewMedia:this.options.mediaViewer===!1?void 0:(i,r,o,s)=>this.viewFromSheet(i,r,o,s),extensions:{icon:(i)=>this.extensions.icon(i),typeLabel:(i)=>this.extensions.nodeType(i)?.label,details:(i)=>{let r=this.extensions.nodeType(i)?.details;return r?(o)=>Rt(`The "${this.extensions.typeName(i)}" node type's details()`,void 0,()=>r(i,o)):void 0},actions:(i)=>this.extensions.actions(i).map((r)=>({id:r.id,label:Mi(r,i),icon:r.icon})),runAction:(i,r,o)=>this.runAction(i,r,o),status:(i)=>this.extensions.status(i)},words:this.words})}mediaShown(t,e,n,i){this.syncAmbientMotion();let r={node:e.node,kind:e.kind,index:n,total:i};if(t==="media-open")this.options.onMediaOpen?.(r);else this.options.onMediaClose?.(r);this.emit(t,r)}mediaPlayed(t,e){let n={node:t,...e};this.options.onMediaState?.(n),this.emit("media-state",n)}findLinked(t){return this.tree?rn(this.tree,t):null}describeLink(t){if(!lt(t.link))return{kind:"page"};let e=this.findLinked(t.link);return e?{kind:"node",label:this.words.text("goTo",{name:e.text||this.words.text("theIdea")})}:{kind:"missing"}}followNodeLink(t){if(this.sheet.isOpen)this.sheet.close();this.activeId=t.id,this.returnFocusToMap=!0,this.focusNode(t.id)}observeResize(){if(typeof ResizeObserver>"u")return;this.resizeObserver=new ResizeObserver(()=>{let t=this.readContainerSize();this.warnIfFlat(t),this.handleResize(t)}),this.resizeObserver.observe(this.root)}observeVisibility(){if(typeof IntersectionObserver>"u")return;this.visibilityObserver=new IntersectionObserver((t)=>{let e=t[t.length-1];if(e)this.onScreen=e.isIntersecting,this.syncAmbientMotion()}),this.visibilityObserver.observe(this.root)}warnIfFlat(t){if(this.warnedFlat||t.width<=0||t.height>=1||!this.root.isConnected)return;this.warnedFlat=!0,console.warn('[orbit] The map has no height, so nothing shows. It fills its container: give the container a height, for example style="height: 480px".')}handleResize(t){if(Math.abs(t.width-this.viewport.width)<0.5&&Math.abs(t.height-this.viewport.height)<0.5)return;let e=this.scene!==null;if(this.setViewport(t),this.updateEmbedding(),!this.tree)return;if(!e){this.rebuild("enter");return}if(Md(t,this.layoutSize)){this.clock.requestPaint();return}if(this.transition){this.relayoutOnArrival=!0,this.clock.requestPaint();return}this.rebuild("instant")}setViewport(t){this.viewport=t,this.root.classList.toggle("orbit--narrow",t.width<=fb)}readContainerSize(){let t=this.root.getBoundingClientRect();return{width:t.width||this.root.clientWidth||0,height:t.height||this.root.clientHeight||0}}animationsEnabled(){return this.options.transitionDuration!==0&&!this.prefersReducedMotion()}prefersReducedMotion(){if(this.reducedMotionQuery===void 0)this.reducedMotionQuery=typeof window<"u"&&typeof window.matchMedia==="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;return this.reducedMotionQuery?.matches===!0}now(){return typeof performance<"u"?performance.now():Date.now()}}var Bo=(t,e)=>t.scale===e.scale&&t.opacity===e.opacity&&t.pivotX===e.pivotX&&t.pivotY===e.pivotY,Sd=(t)=>{if(t.motion===void 0){let e=t.members[0]?.entry.cluster??null;t.motion=e&&t.members.every((n)=>n.entry.cluster&&Bo(n.entry.cluster,e))?e:null}return t.motion},_i=(t)=>t.opacity<=0.01||t.scale<=0.001,kb=(t,e)=>{let n=e!==null&&_i(e);if(n!==t.hidden)t.group.style.display=n?"none":"",t.hidden=n;let i=R(e?.scale??1,4),r=e&&i!==1?`matrix(${i} 0 0 ${i} ${R(e.pivotX*(1-i))} ${R(e.pivotY*(1-i))})`:"";if(r!==t.transform){if(r)t.group.setAttribute("transform",r);else t.group.removeAttribute("transform");t.transform=r}let o=e&&e.opacity<0.999?String(R(e.opacity,3)):"";if(o!==t.opacity)t.group.style.opacity=o,t.opacity=o},Md=(t,e)=>Math.abs(t.width-e.width)<=e.width*Od&&Math.abs(t.height-e.height)<=e.height*Od,Ob=(t)=>{let e=globalThis.reportError;if(typeof e==="function")e(t);else setTimeout(()=>{throw t})},Sb=(t)=>{let e=T("g",{class:"orbit-ring-group"}),n=T("path",{class:"orbit-ring-band"}),i=T("path",{class:"orbit-ring"});return e.append(n,i),e.setAttribute("data-orbit-ring",t.centerId),{group:e,line:i,band:n,shape:"",gaps:null,radius:0,transform:"",color:""}},Mb=(t)=>{let e=document.createElement("div");return e.className="orbit-empty",e.hidden=!0,Rd(e,t),e},Rd=(t,e)=>{let n=document.createElement("strong");n.textContent=e.text("emptyMap");let i=document.createElement("span");i.textContent=e.text("emptyMapHint"),t.replaceChildren(n,i)},Ed=new WeakMap,Eb=(t)=>{let e=Ed.get(t);if(e===void 0){e=1/0;for(let n of t.nodes.values())if(n.role==="planet"&&n.orbitRadius!==void 0)e=Math.min(e,n.orbitRadius-n.radius);if(t.addSlot)e=Math.min(e,t.addSlot.orbitRadius-t.addSlot.radius);Ed.set(t,e)}return e},Nd=(t)=>Array.from(t.nodes.values()).filter((e)=>e.role==="planet").sort((e,n)=>xe(e.orbitAngle??0)-xe(n.orbitAngle??0)),xe=(t)=>((t+90)%360+360)%360,Td=(t,e)=>{let n=t.frame.scale/e.scale;return{scale:n,x:e.x-t.frame.x*n,y:e.y-t.frame.y*n}},Fd=(t)=>{let e=new Map;for(let[n,i]of t.nodes)if(i.opacity>0.01&&i.radius>0.01)e.set(n,i);return{nodes:e,rings:t.rings.filter((n)=>n.opacity>0.01),links:t.links.filter((n)=>n.opacity>0.01),camera:t.camera,addSlot:t.addSlot&&t.addSlot.opacity>0.01?t.addSlot:void 0}},ve="\x00slot",_d=(t)=>Boolean(t&&typeof t.closest==="function"&&t.closest("[data-orbit-add]")),yt=(t)=>(t&&typeof t.closest==="function"?t.closest("[data-orbit-node-id]"):null)?.getAttribute("data-orbit-node-id")??null,Cd=(t,e)=>({label:e.text("newIdeaFor",{name:t.text||e.text("thisIdea")}),placeholder:e.text("newIdea"),enterKey:"next"}),Nb=(t,e,n)=>{if(!e||t.nodes.has(e.id))return t;let i=Lt(n,0,n.frame).nodes.get(e.id);if(!i)return t;let r=new Map(t.nodes);return r.set(e.id,{...i,x:e.x,y:e.y,radius:e.radius}),{...t,nodes:r}},Tb=(t,e)=>{if(e.size===0)return t;let n=(r)=>e.get(r)??r,i=new Map;for(let r of t.nodes.values()){let o=n(r.id);i.set(o,{...r,id:o,parentId:r.parentId===void 0?void 0:n(r.parentId),hostId:r.hostId===void 0?void 0:n(r.hostId)})}return{...t,nodes:i,rings:t.rings.map((r)=>({...r,centerId:n(r.centerId)})),links:t.links.map((r)=>{let o=n(r.fromId),s=n(r.toId);return{...r,id:`${o}->${s}`,fromId:o,toId:s}})}},Fb=(t)=>{try{return t.matches(":focus-visible")}catch{return!0}},_b=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Cb=(t)=>{let e=t.ownerDocument,n=e.scrollingElement;if(n&&n.scrollHeight>n.clientHeight+1)return!0;let i=Ad(t);while(i&&i!==e.documentElement&&i!==e.body){if(i.scrollHeight>i.clientHeight+1&&typeof getComputedStyle==="function"){let r=getComputedStyle(i).overflowY;if(r==="auto"||r==="scroll")return!0}i=Ad(i)}return!1},Ad=(t)=>{if(t.parentElement)return t.parentElement;let e=t.getRootNode();return typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e.host:null},Ab=(t)=>({...Ar,...t?.decay!==void 0&&t.decay>0?{decay:t.decay}:{},...t?.maxSpeed!==void 0&&t.maxSpeed>0?{maxSpeed:t.maxSpeed}:{},snap:t?.snap==="planet"}),Id=(t,e)=>{let n={...t};for(let[i,r]of Object.entries(e))if(r!==void 0)n[i]=r;return n.theme=As(t.theme,e.theme),n},Je=(t)=>{let e=(n)=>typeof n==="number"&&Number.isFinite(n)&&n>0?n:0;return{top:e(t?.top),right:e(t?.right),bottom:e(t?.bottom),left:e(t?.left)}},vt=(t,e)=>{if(t===e)return!0;if(!t||!e||typeof t!=="object"||typeof e!=="object")return!1;let n=Object.keys(t),i=Object.keys(e);return n.length===i.length&&n.every((r)=>vt(t[r],e[r]))},Ld=(t,e,n)=>{if(typeof e!=="object"||e===null||Array.isArray(e))throw TypeError(`${t}() takes the node's text and attributes as an object, like ${n}, but got ${e===null?"null":Array.isArray(e)?"an array":typeof e}.`)},$d=(t,e)=>{let n=(i)=>Object.fromEntries(Object.entries(i).filter(([r,o])=>r!=="source"&&r!=="children"&&o!==void 0));return vt(n(t),n(e))&&t.children.length===e.children.length&&t.children.every((i,r)=>$d(i,e.children[r]))},Ib=(t,e)=>{let n=new Map,i=(s,a)=>{n.set(a,s),s.source=a.source,a.children.forEach((l,d)=>i(s.children[d],l))};i(t,e);let r=qt({root:e});if(!r)return;let o=new WeakMap;for(let[s,a]of n){let l=r.records.get(s);if(l)o.set(a,{...l,children:l.children.map((d)=>n.get(d)??d)})}pn({root:t},{...r,root:t,records:o,owners:r.owners.map((s)=>s===null?null:n.get(s)??s)})},Dd=(t)=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Fi=(t)=>typeof t.root==="object"&&t.root!==null&&!("children"in t),Pd=(t)=>t.text.trim()===""&&!t.icon&&t.children.length===0&&!P(t.image)&&!P(t.video)&&!P(t.embed),R=(t,e=2)=>{let n=10**e;return Math.round(t*n)/n};var Bd=(t,e,n={})=>{let{strict:i,...r}=n,o=new Mt(t,r);if(typeof e==="string"){let s=It(e,{strict:i,untitled:dl(r.language,t,r.strings).text("untitledMap")});Ns(s),o.render(s)}else o.render(e);return o};var Lb=60,Db=2500,Pb=12,Vd={bottom:68},Rb=["ArrowRight","ArrowDown","PageDown"," ","Enter"],$b=["ArrowLeft","ArrowUp","PageUp","Backspace"],zd=(t=document)=>{let e=(k)=>t.getElementById(k),n=e("orbit-page"),i=e("page-map");if(!n||!i)return null;let r=JSON.parse(n.textContent??"{}"),o=new dt(r.language,r.strings),s=Bb(It(r.source,{untitled:o.text("untitledMap")}),r.media??{}),a=Bd(i,s,{theme:r.theme,viewMode:r.viewMode,focus:r.focus,language:r.language,strings:r.strings,insets:Vd}),l=e("page"),d=e("page-caption"),c=e("page-title"),u=e("page-note"),h=e("page-controls"),m=e("page-count"),p=t.querySelector("[data-present]"),b=Vb(s.root),g=!1,f=0,y=0,x=()=>{l.classList.add("page--controls"),window.clearTimeout(y),y=window.setTimeout(()=>l.classList.remove("page--controls"),Db)},O=()=>{let k=Hd(s.root,b[f]);if(c.textContent=k?.text||o.text("theIdea"),k?.note&&k.noteFormat==="plain")u.textContent=k.note;else u.replaceChildren(fi(k?.note??"",{baseUrl:s.options.baseUrl,resolveLink:(D)=>rn(s.root,D)}));m.textContent=o.text("position",{index:f+1,total:b.length});let _=d.getBoundingClientRect().top;a.setOptions({insets:{bottom:Math.max(0,window.innerHeight-_+Pb)}}),a.flyTo(b[f])},M=(k)=>{f=Math.min(b.length-1,Math.max(0,f+k)),O()},w=()=>{g=!0,f=Math.max(0,b.indexOf(a.getFocusedNode()?.id??"")),l.classList.add("page--presenting"),d.hidden=!1,h.hidden=!1,a.setOptions({interactive:!1,showControls:!1}),O(),x(),t.documentElement.requestFullscreen?.().catch(()=>{return})},v=()=>{if(!g)return;if(g=!1,l.classList.remove("page--presenting","page--controls"),d.hidden=!0,h.hidden=!0,a.setOptions({interactive:!0,showControls:!0,insets:Vd}),t.fullscreenElement)t.exitFullscreen().catch(()=>{return});a.flyTo(b[f]),p?.focus()};p?.addEventListener("click",w),t.querySelector("[data-close]")?.addEventListener("click",v),t.querySelectorAll("[data-step]").forEach((k)=>{k.addEventListener("click",()=>{M(Number(k.dataset.step)),x()})}),t.defaultView?.addEventListener("keydown",(k)=>{if(k.defaultPrevented||k.altKey||k.ctrlKey||k.metaKey)return;if(!g){if(!k.target?.closest?.('input, textarea, [contenteditable="true"]')&&(k.key==="p"||k.key==="P"||k.key==="F5"))k.preventDefault(),w();return}if(Rb.includes(k.key)&&!k.target?.closest?.("button"))k.preventDefault(),M(1);else if($b.includes(k.key))k.preventDefault(),M(-1);else if(k.key==="Escape")k.preventDefault(),v()},!0),t.addEventListener("fullscreenchange",()=>{if(g&&!t.fullscreenElement&&t.fullscreenEnabled)v()});let E=null;return l.addEventListener("pointerdown",(k)=>{if(g&&!k.target.closest(".page__controls, .page__caption"))E={x:k.clientX,y:k.clientY}}),l.addEventListener("pointerup",(k)=>{if(!g||!E)return;let _=k.clientX-E.x,D=k.clientY-E.y;if(E=null,Math.abs(_)>=Lb&&Math.abs(_)>Math.abs(D))M(_<0?1:-1);else if(Math.abs(_)<10&&Math.abs(D)<10)x()}),l.addEventListener("pointermove",(k)=>{if(g&&k.pointerType==="mouse")x()}),a},Bb=(t,e)=>{if(Object.keys(e).length===0)return t;let n=(r)=>e[r]??r,i=(r)=>{if(r.image)r.image={...r.image,src:n(r.image.src)};if(r.video?.thumbnail)r.video={...r.video,thumbnail:n(r.video.thumbnail)};if(r.note&&r.noteFormat!=="plain")r.note=r.note.replace(/(!\[[^\]]*\]\()([^)\s]+)/g,(o,s,a)=>`${s}${n(a)}`);r.children.forEach(i)};return i(t.root),t},Vb=(t)=>{let e=[],n=(i)=>{e.push(i.id),i.children.forEach(n)};return n(t),e},Hd=(t,e)=>{if(t.id===e)return t;for(let n of t.children){let i=Hd(n,e);if(i)return i}return null};zd();})();
|
|
130
|
+
`)!==r)this.emitFocusChange(Y(i,this.focusId));if(n)this.outline.announce(n);let o={kind:t,node:e,tree:i};this.options.onEdit?.(o),this.emit("edit",o)}insertNode(t,e,n,i){let r=this.tree?Is(this.tree,t,e,n,this.branchColorRules()):null;if(!r)return null;let{node:o,parent:s}=r;return this.changedIds.add(s.id),this.arrival=i?{id:o.id,...i}:null,this.afterEdit("add",o,this.words.text("added",{name:o.text||this.words.text("anIdea")})),o}get editingKeys(){return this.options.editable===!0&&this.options.editingKeys===!0&&this.options.interactive!==!1}addBeside(t){let e=this.tree?Y(this.tree,t):[],n=e[e.length-1],i=e[e.length-2];if(!n)return!1;return i?this.editNewNode(i.id,i.children.indexOf(n)+1):this.editNewNode(n.id)}removeWithKey(t){let e=this.tree?Y(this.tree,t):[],n=e[e.length-1],i=e[e.length-2];if(!n||!i)return!1;let r=i.children.indexOf(n),o=i.children[r+1]??i.children[r-1]??i;if(!this.removeNode(t))return!0;let s=this.transition?.target??this.scene;return this.focusNodeElement(s?.nodes.has(o.id)?o.id:this.focusId),!0}tabFromEditor(t,e){let n=this.editing,i=this.tree;if(!n||!i||!this.editingKeys)return!1;let r=Y(i,n.parentId),o=r[r.length-1];if(!o)return!1;let s=r[r.length-2]??null,a=t.replace(/\s+/g," ").trim(),l=null;if(n.nodeId!==null){let c=U(i,n.nodeId);this.finishEditing(!1,!1),l=c&&a&&a!==c.text?this.updateNode(c.id,{text:a}):c}else if(a){let c=this.display?.addSlot,u=c&&c.parentId===n.parentId?{x:c.x,y:c.y,radius:c.radius}:void 0;this.finishEditing(!1,!1),l=this.insertNode(n.parentId,{text:a},n.index,u)}if(e){if(s)return this.editNewNode(s.id,s.children.indexOf(o)+1);return l===null||n.nodeId!==null||this.editNewNode(o.id,n.index+1)}let d=l??o.children[n.index-1]??null;return d===null||this.editNewNode(d.id)}saveEdit(t,e){let n=this.editing,i=this.tree;if(!n||!i)return;let r=t.replace(/\s+/g," ").trim();if(n.nodeId!==null){let l=U(i,n.nodeId);if(this.finishEditing(e==="enter"),l&&r&&r!==l.text)this.updateNode(l.id,{text:r});return}let o=U(i,n.parentId);if(!r||!o){this.finishEditing(e==="enter");return}let s=this.display?.addSlot,a=s&&s.parentId===n.parentId?{x:s.x,y:s.y,radius:s.radius}:void 0;if(e==="enter")this.editing={...n,index:n.index+1},this.editor.clear(bs(o,this.words));else this.finishEditing(!1,!1);this.insertNode(n.parentId,{text:r},n.index,a)}finishEditing(t,e=!0){let n=this.editing;if(!n)return;let i=this.editor.hasFocus;this.editing=null,this.editor.hide();let r=this.tree,o=r&&n.nodeId!==null?U(r,n.nodeId):null,s=r&&n.nodeId===null?U(r,n.parentId):null;if(e)this.refreshSlot();if(t&&i){if(o)this.focusNodeElement(o.id);else if(this.addSlotView.isShown)this.addSlotView.element.focus({preventScroll:!0})}this.paint(),this.emitEditor("editor-close",o,s)}refreshSlot(){let t=this.tree,e=this.nextScene??this.transition?.target??this.scene;if(!t||!e||this.viewMode!=="focus")return;let n=this.slotPlace(),i=U(t,this.focusId),r=n&&i?n.index??i.children.length:null;if((e.addSlot?.index??null)!==r)this.rebuild("morph")}slotPlace(){let t=this.editing;if(t&&t.nodeId===null)return t.parentId===this.focusId?{index:t.index}:void 0;return this.options.editable&&this.options.interactive!==!1?{}:void 0}emitEditor(t,e,n){let i={node:e,parent:n};if(t==="editor-open")this.options.onEditorOpen?.(i);else this.options.onEditorClose?.(i);this.emit(t,i)}renameView(t,e){this.focusPath=this.focusPath.map((n)=>n===t?e:n);for(let n of["activeId","hoveredId","keyboardFocusId","topPlanetId"])if(this[n]===t)this[n]=e;this.renamedIds.set(t,e)}resolveOptions(){return ls(ls(ir,this.documentOptions),this.userOptions)}createExtensions(){return new Qt({nodeTypes:this.options.nodeTypes,actions:this.options.actions,statuses:this.options.statuses,nodeTypeFor:this.options.nodeTypeFor})}syncLanguage(){let t=this.options.language??mi(this.container);if(t===this.requestedLanguage&&kt(this.options.strings,this.requestedStrings))return;this.requestedLanguage=t,this.requestedStrings=this.options.strings,this.words=new tt(t,this.options.strings),this.svg.setAttribute("aria-roledescription",this.words.text("mindMapRole")),this.controls.relabel(this.words),this.outline.relabel(this.words),this.viewer.relabel(),this.actionBar.reset(),ds(this.emptyState,this.words);for(let[,e]of this.nodePainter.entries())e.element.setAttribute("aria-label",ki(e.node,0,e.node.children.length,this.extensions,this.words));if(this.tree)this.updateOutline(),this.updateControls()}applyOptionEffects(t){let e=this.options,n=t!==null&&(!kt(t.nodeTypes,e.nodeTypes)||!kt(t.actions,e.actions)||!kt(t.statuses,e.statuses)||t.nodeTypeFor!==e.nodeTypeFor);if(n)this.extensions=this.createExtensions();if(this.applyTheme(),this.syncLanguage(),this.spinPhysics.settings=Zd(e.spin),this.svg.setAttribute("aria-label",e.ariaLabel||this.words.text("mindMap")),this.syncInteractivity(),this.syncAmbientMotion(),!t||!this.tree)return;if(t.baseUrl!==e.baseUrl||n)this.clearViews();if(n){this.updateOutline(),this.refreshScene();return}if((!e.editable||e.interactive===!1)&&this.editing)this.stopEditing();if(t.maxDepth!==e.maxDepth||Boolean(t.editable)!==Boolean(e.editable)){this.updateOutline(),this.rebuild("morph");return}let i=!kt(t.palette,e.palette)||!kt(t.theme,e.theme),r=!kt(Ie(t.insets),Ie(e.insets))||t.showActionButtons!==!1!==(e.showActionButtons!==!1)||t.interactive!==!1!==(e.interactive!==!1)||t.showControls!==!1!==(e.showControls!==!1);if(r&&this.transition)this.refitOnArrival=!0;else if(r){let o=this.isFitted();if(this.refreshScene(),o)this.fit();return}if(i){this.refreshScene();return}this.clock.requestPaint()}isFitted(){let t=this.scene?.frame;if(!t)return!1;let{camera:e}=this;return Math.abs(e.scale/t.scale-1)<0.01&&Math.abs(e.x-t.x)*e.scale<2&&Math.abs(e.y-t.y)*e.scale<2}themeOption(){let t=Wt(this.options.theme);return typeof t==="object"?t:void 0}themePreset(){return jt(this.options.theme)}applyTheme(){let t=this.options.theme,e=typeof t==="string"?t:t?.preset;if(e!==void 0&&!je(e)&&e!==this.warnedTheme)this.warnedTheme=e,console.warn(`[orbit] Unknown theme "${String(e)}", so the map uses paper. Themes: ${We().join(", ")}.`);this.root.dataset.orbitTheme=this.themePreset();let n=ua(this.themeOption());for(let r of this.themeProperties)if(!(r in n))this.root.style.removeProperty(r);for(let[r,o]of Object.entries(n))this.root.style.setProperty(r,o);this.themeProperties=Object.keys(n),this.labelPainter.forgetTextColors();let i=JSON.stringify([this.themePreset(),this.themeOption()]);if(i!==this.shadingTheme)this.shadingTheme=i,Yl(this.definitions,this.ids,wi(this.themeValue("node-shade-circle")));this.labelFonts.refresh()}themeValue(t){if(typeof getComputedStyle==="function"&&this.root.isConnected){let e=getComputedStyle(this.root).getPropertyValue(`--_orbit-${t}`).trim();if(e&&!e.startsWith("var("))return e}return Gt(this.themePreset(),this.themeOption())[t]}exportTokens(){let t={};if(typeof getComputedStyle==="function"&&this.root.isConnected){let e=getComputedStyle(this.root);for(let n of Bn){let i=e.getPropertyValue(`--_orbit-${n}`).trim();if(i&&!i.startsWith("var("))t[n]=i}}return Gt(this.themePreset(),this.themeOption(),t)}syncInteractivity(){let t=this.options.interactive!==!1;if(this.root.classList.toggle("orbit--static",!t),this.svg.setAttribute("role",t?"group":"img"),t)this.input.attach(this.svg);else this.input.detach(),this.sheet.close(),this.tooltip.hide();this.viewer.refresh(),this.controls.element.hidden=!t||this.options.showControls===!1,this.tabStopsChanged=!0}get focusId(){return this.focusPath[this.focusPath.length-1]??this.tree?.id??""}get rotation(){return this.spinPhysics.angle}sceneOptions(t=!0){let e=this.tree,n=this.nodeDrag?.moving?this.nodeDrag:null,i=n!==null&&this.carriesPlanet(n),r=n!==null&&!i&&n.slot!==null?{index:n.slot}:null,o=n?.rings&&us(this.viewport,n.rings.size)?n.rings:null;return{viewport:this.viewport,insets:Ie(this.options.insets),colors:qt(e,Dt(this.options.palette),(s)=>this.extensions.color(s)),maxDepth:this.options.maxDepth,addSlot:t?r??this.slotPlace():void 0,reorder:i&&n.slot!==null?{id:n.id,index:n.slot}:void 0,keptRings:o?{focusId:o.focusId,radii:o.radii}:void 0}}buildScene(t=!0){let e=this.tree;if(!e||vs(e)||this.viewport.width<=0||this.viewport.height<=0)return null;return this.layoutSize={...this.viewport},this.viewMode==="all"?li(e,this.sceneOptions(t)):this.focusScene(e,this.focusId,this.sceneOptions(t))}focusScene(t,e,n){let i=ai(t,e,n),r=this.roomForActions(i);return r>0?{...i,frame:Nl(i,this.viewport,n.insets,r)}:i}roomForActions(t){let e=t.nodes.get(t.focusId),n=e?this.actionBar.count(e.node):0;if(!e||n===0||!this.showsActions()||this.actionsPlace(t,e,t.frame)!==null)return 0;return uc+this.rowsUnderOrbit(n,Ie(this.options.insets)).rows.height+Ae}showsActions(){return this.options.showActionButtons!==!1&&this.options.interactive!==!1}actionsPlace(t,e,n){let i=Math.max(1,this.actionBar.count(e.node)),r=this.actionBar.size(),o=X(n,this.viewport,e),s=e.radius*n.scale,a=oc(t)*n.scale-cc,l=(Qi(i,r).width-r)/2,d=(y)=>Math.hypot(l,y+r/2)+r/2,c=this.labelPainter.placementOf(e.id)==="outside",u=s+(c?36:12);if(d(u)<=a)return{x:o.x,y:o.y+u,wrap:0};if(!c){let y=Jt("sun",s,e.hiddenChildren)?Ti(e.hiddenChildren,this.labelFonts.count()):0,v=ke("sun",s,e.node.text,Boolean(this.extensions.icon(e.node)),this.labelFonts.inside("sun",e.node),!0,y),O=s-r-rf;if(O>=(v?Ql(v):0)+cc&&d(O)<=a)return{x:o.x,y:o.y+O,wrap:0}}let h=Ie(this.options.insets),m=o.y+Math.max(t.extent.x,t.extent.y)*n.scale+uc,{rows:p,left:b,right:f}=this.rowsUnderOrbit(i,h,m);if(m+p.height>this.viewport.height-h.bottom-Ae)return null;return{x:Math.min(Math.max(o.x,b+p.width/2),f-p.width/2),y:m,wrap:p.perLine<i?p.width:0}}rowsUnderOrbit(t,e,n=this.viewport.height){let i=this.actionBar.size(),r=e.left+Ae,o=this.viewport.width-e.right-Ae,s=Qi(t,i,o-r),a=this.controls.zoomBox(this.viewport.width,this.viewport.height);if(a&&n+s.height+Ae>a.top)o=Math.min(o,a.left-Ae),s=Qi(t,i,o-r);return{rows:s,left:r,right:o}}navigate(t,e,n=!0){let i=this.tree;if(!i)return!1;let r=Y(i,e);if(r.length===0)return!1;let o=r[r.length-1].id!==this.focusId,s=t!==this.viewMode;if(this.focusPath=r.map((l)=>l.id),this.viewMode=t,!o&&!s)return this.fit(),!0;let a=this.root.ownerDocument.activeElement;if(this.returnFocusToMap||=Boolean(a&&this.svg.contains(a)),this.hoveredId=null,this.updateTooltip(),this.actionBar.hide(),this.flyToCurrentView(),this.updateControls(),this.outline.setCurrent(this.focusId),this.announceView(),n&&s)this.options.onViewModeChange?.(t),this.emit("view-mode-change",{mode:t});if(n&&o&&t==="focus")this.emitFocusChange(r);return!0}flyToCurrentView(){let t=this.buildScene();if(this.stopMotion(),!t){this.transition=null,this.nextScene=null,this.scene=null,this.paint();return}if(this.scene&&this.prefersReducedMotion()&&this.options.transitionDuration!==0){this.startFade(t);return}if(!this.scene||!this.animationsEnabled()){this.transition=null,this.nextScene=null,this.restOn(t);return}let e=this.now(),n=this.currentDisplay(e),i=this.placeTarget(n,t);if(i){this.nextScene=null,this.startTransition(n,t,i,e);return}let r=this.commonAncestorScene(t),o=r?this.placeTarget(n,r):null;if(r&&o){this.nextScene=t,this.startTransition(n,r,o,e);return}this.nextScene=null,this.startTransition(n,t,ps(t,n.camera),e)}placeTarget(t,e){let n=(l)=>{let d=l===void 0?void 0:t.nodes.get(l);return d&&d.opacity>0.3&&d.radius>0.5?d:null},i=n(e.focusId);if(i)return ye(e,e.focusId,i);let r=this.transition?.target.focusId??this.scene?.focusId,o=n(r);if(o&&r!==void 0&&e.nodes.has(r))return ye(e,r,o);let s=null;for(let l of t.nodes.values())if(l.opacity>0.3&&l.radius>0.5&&e.nodes.has(l.id)&&(!s||l.radius>s.radius))s=l;if(s)return ye(e,s.id,s);let a=this.tree;if(!a)return null;if(o&&r!==void 0){for(let l=U(a,r)?.parent;l;l=l.parent)if(e.nodes.has(l.id))return ye(e,l.id,{x:o.x,y:o.y,radius:o.radius*1.15})}for(let l=U(a,e.focusId)?.parent;l;l=l.parent){let d=n(l.id);if(d)return ye(e,e.focusId,{x:d.x,y:d.y,radius:d.radius*0.45})}return null}commonAncestorScene(t){let e=this.tree,n=this.transition?.target.focusId??this.scene?.focusId;if(!e||t.kind!=="focus"||n===void 0)return null;let i=Y(e,n),r=Y(e,t.focusId),o=null;for(let s=0;s<Math.min(i.length,r.length)&&i[s].id===r[s].id;s+=1)o=i[s];if(!o||o.id===n||o.id===t.focusId)return null;return this.focusScene(e,o.id,this.sceneOptions())}startTransition(t,e,n,i,r,o){this.nodePainter.startFlight();let s=o??Cl(e,n),a=Zr(t.camera,s,this.viewport);this.transition={from:ms(t),target:e,placement:n,cameraPath:a,startedAt:i,duration:r??this.flightDuration(a.length)},this.landingCamera=o??null,this.spinPhysics.stop(),this.tabStopsChanged=!0,this.clock.add(this.transitionTask),this.paint()}startFade(t){let e=this.now(),n=ms(this.currentDisplay(e));this.nextScene=null,this.landingCamera=null,this.transition={from:n,target:t,placement:tn,cameraPath:{length:0,at:()=>t.frame},startedAt:e,duration:Jb,fade:!0},this.spinPhysics.stop(),this.tabStopsChanged=!0,this.clock.add(this.transitionTask),this.paint()}flightDuration(t){let e=this.options.transitionDuration;if(typeof e==="number")return Math.max(0,e);return Math.min(1300,Math.max(480,t*650))}transitionTask=(t)=>{let e=this.transition;if(!e)return!1;if(t-e.startedAt<e.duration)return!0;return this.finishTransition(),this.transition!==null};finishTransition(){let t=this.transition;if(!t)return;this.transition=null,this.scene=t.target,this.camera=this.landingCamera?{...this.landingCamera}:{...t.target.frame},this.landingCamera=null,this.spinPhysics.stop(),this.spinPhysics.angle=0;let e=this.nextScene;if(this.nextScene=null,e){let n=yt(this.scene,0,this.camera);this.startTransition(n,e,this.placeTarget(n,e)??ps(e,this.camera),this.now());return}this.afterArrival()}completeTransition(){if(!this.transition)return;let t=this.nextScene??this.transition.target,e=this.nextScene?null:this.landingCamera;if(this.transition=null,this.nextScene=null,this.landingCamera=null,this.restOn(t,!1),e)this.camera=e}restOn(t,e=!0){if(this.scene=t,this.camera={...t.frame},this.spinPhysics.stop(),this.spinPhysics.angle=0,this.tabStopsChanged=!0,this.paint(),e)this.afterArrival()}afterArrival(){if(this.relayoutOnArrival){this.relayoutOnArrival=!1,this.refitOnArrival=!1,this.rebuild("instant");return}if(this.refitOnArrival)this.refitOnArrival=!1,this.refreshScene(),this.fit();this.tabStopsChanged=!0,this.topPlanetId=this.planetNearestTop()?.id??null,this.clock.requestPaint(),this.syncAmbientMotion();let t=this.root.ownerDocument.activeElement;if(this.returnFocusToMap&&(!t||!this.svg.contains(t)))this.paint(),this.focusNodeElement(this.activeId??this.focusId);this.returnFocusToMap=!1}rebuild(t){this.labelFonts.recheckWhenIdle(()=>this.labelPainter.refit());let e=this.renamedIds;this.renamedIds=new Map;let n=this.arrival;this.arrival=null,this.completeTransition(),this.stopMotion();let i=this.buildScene();if(this.emptyState.hidden=!(this.tree&&vs(this.tree)),!i){this.scene=null,this.paint();return}if(t==="instant"||!this.animationsEnabled()){this.restOn(i);return}let r=this.now();if(t==="enter"||!this.scene){let a={nodes:new Map,rings:[],links:[],camera:{...i.frame,scale:i.frame.scale*0.82}};this.scene=i,this.startTransition(a,i,tn,r,Ub);return}let o=this.dropFrom??sc(ac(yt(this.scene,this.rotation,this.camera),e),n,i),s=i.kind==="overview"&&this.scene.kind==="overview";this.startTransition(o,i,tn,r,jb,s?{...this.camera}:void 0)}refreshScene(){this.completeTransition();let t=this.buildScene();if(!t||!this.scene){this.rebuild("instant");return}this.scene=t,this.camera=this.clampCamera(this.camera),this.labelPainter.forgetLightText(),this.paint()}currentDisplay(t){let e=this.transition;if(e){let o=e.duration<=0?1:Math.min(1,Math.max(0,(t-e.startedAt)/e.duration));return e.fade?Al(e,o):Il(e,Kr(o))}let n=this.scene,i=this.restingDisplay;if(i&&i.scene===n&&i.rotation===this.rotation)return{...i.display,camera:this.camera};let r=yt(n,this.rotation,this.camera);return this.restingDisplay={scene:n,rotation:this.rotation,display:r},r}stopMotion(){if(this.cameraFlight=null,this.wheelZoom=null,this.glide.stop(),this.spinPhysics.mode!=="dragging")this.spinPhysics.stop()}paint(){if(this.destroyed)return;if(!this.scene){this.display=null,this.clearViews();return}let t=this.currentDisplay(this.now()),e=this.withCarried(t);this.display=e;let n=el(e.camera,this.viewport);if(n!==this.worldTransform)this.world.setAttribute("transform",n),this.worldTransform=n;this.ringsAndLinks.paint(e,this.options.showRings!==!1);let i=this.nodePainter.paintTurn(e);if(this.nodePainter.paintNodes(e,i),this.paintAddSlot(e,i),this.paintHeldPlace(t,i),this.contentPainter.paint(e),this.labelPainter.paint(e),this.changedIds.clear(),this.paintOverlay(e),this.placeEditor(e),this.tabStopsChanged)this.updateTabStops();if(this.tooltip.isVisible)this.positionTooltip()}editedId(){return this.editor.isOpen?this.editing?.nodeId??null:null}paintAddSlot(t,e){let n=t.addSlot,i=n?t.nodes.get(n.parentId)?.node:void 0,r=this.nodeDrag?.moving?this.nodeDrag:null,o=r!==null&&!this.carriesPlanet(r)&&r.slot!==null?r:null,s=o?this.words.text("moveHere",{name:o.node.text||this.words.text("theIdea")}):this.words.text("addIdeaTo",{name:i?.text||this.words.text("thisIdea")}),a=o?o.place?.into?"waiting":"target":!1;this.addSlotView.update(n,s,this.editor.isOpen&&this.editing?.nodeId===null,e,a)}paintHeldPlace(t,e){let n=this.nodeDrag,i=n&&this.carriesPlanet(n)?t.nodes.get(n.id):void 0,r=n&&i?{parentId:n.parent.id,index:n.slot??0,x:i.x,y:i.y,radius:i.radius,opacity:i.opacity,unturned:i.unturned}:void 0;this.heldPlaceView.update(r,"",!1,e,n?.place?.into?"waiting":"target")}placeEditor(t){let e=this.editing;if(!e||!this.editor.isOpen)return;let{camera:n}=t;if(e.nodeId===null){let o=t.addSlot,s=o&&o.parentId===e.parentId&&o.opacity>0.5;this.editor.place(s?this.editorPlacement(X(n,this.viewport,o),o.radius*n.scale,"planet",!1,!0):null);return}let i=t.nodes.get(e.nodeId),r=i&&i.opacity>0.5;this.editor.place(r?this.editorPlacement(X(n,this.viewport,i),i.radius*n.scale,i.role,this.labelPainter.usesLightText(i),!1,i.hiddenChildren):null)}editorPlacement(t,e,n,i,r,o=0){let s=e<32,a=s?Math.max(140,_i(n,e)):_i(n,e);return{x:t.x,y:t.y,width:a,fontSize:Math.max(13,Jl(n,a,this.editor.value||this.words.text("newIdea"),this.labelFonts.inside(n))),maxHeight:Math.max(44,e*1.5),role:n,light:i&&!s,slot:r,floating:s&&!r,lowest:!s&&Jt(n,e,o)?Xt*e-Co/2:void 0}}paintOverlay(t){let{camera:e}=t,n=this.scene,i=this.viewMode==="focus"&&!this.transition&&n?t.nodes.get(n.focusId):void 0,r=i&&n&&this.showsActions()&&this.zoomLevel()<1.5?this.actionsPlace(n,i,e):null;if(i&&r)this.actionBar.show(i.node,r.x,r.y,r.wrap);else this.actionBar.hide()}clearViews(){this.labelPainter.clear(),this.nodePainter.clear(),this.ringsAndLinks.clear(),this.contentPainter.clear(),this.actionBar.reset()}updateTabStops(){this.tabStopsChanged=!1;let t=this.options.interactive!==!1,e=this.transition?.target??this.scene;if(!this.activeId||!e?.nodes.has(this.activeId)||!this.nodePainter.view(this.activeId))this.activeId=e?.focusId??null;for(let[n,i]of this.nodePainter.entries()){let r=t?n===this.activeId?"0":"-1":null;if(i.element.getAttribute("tabindex")!==r)if(r===null)i.element.removeAttribute("tabindex");else i.element.setAttribute("tabindex",r)}}focusNodeElement(t){let e=this.nodePainter.view(t);if(!e)return;this.activeId=t,this.updateTabStops(),e.element.focus({preventScroll:!0})}updateControls(){this.root.dataset.orbitView=this.viewMode;let t=this.tree?Y(this.tree,this.focusId):[];this.controls.update({viewMode:this.viewMode,path:t,outlineOpen:this.outline.isVisible})}updateOutline(){if(this.tree)this.outline.update(this.tree,this.focusId,this.options.maxDepth,this.options.interactive!==!1,(t)=>this.extensions.icon(t));this.viewer.refresh()}toggleOutline(){this.outline.setVisible(!this.outline.isVisible),this.updateControls()}selectFromOutline(t){if(this.outline.isVisible)this.outline.setVisible(!1);this.activeId=t,this.returnFocusToMap=!0,this.navigate("focus",t),this.updateControls()}announceView(){if(this.viewMode==="all"){this.outline.announce(this.words.text("overviewAnnouncement"));return}let t=this.getFocusedNode();if(t){let e=t.children.length,n=t.text||this.words.text("untitled");this.outline.announce(e>0?`${n}, ${this.words.count("ideaCount",e)}`:n)}}updateTooltip(){let t=this.dragging?null:this.hoveredId??this.keyboardFocusId,e=t?this.display?.nodes.get(t):void 0;if(!e||this.transition){this.tooltip.hide();return}let n=e.node,i=this.extensions.nodeType(n)?.label,r=this.labelPainter.placementOf(e.id)??"hidden",o=n.note?Sd(n.note.slice(0,400)).replace(/\s+/g," ").trim():"";if(!(r==="hidden"||n.text.length>24)&&!o&&!n.status&&!i){this.tooltip.hide();return}let a=[i??"",n.status?this.words.text("statusLabel",{status:n.status}):"",o.length>140?`${o.slice(0,139)}…`:o].filter(Boolean),l=this.tooltipAnchor(e);this.tooltip.show([this.extensions.icon(n),n.text||this.words.text("untitled")].filter(Boolean).join(" "),a.join(" · "),l.x,l.y)}positionTooltip(){let t=this.hoveredId??this.keyboardFocusId,e=t?this.display?.nodes.get(t):void 0;if(!e){this.tooltip.hide();return}let n=this.tooltipAnchor(e);this.tooltip.place(n.x,n.y)}tooltipAnchor(t){let e=this.display?.camera??this.camera,n=X(e,this.viewport,t);return{x:n.x,y:n.y-t.radius*e.scale}}handleClick=(t)=>{if(this.options.interactive===!1||t.detail>1)return;if(cs(t.target)){this.editNewNode();return}let e=wt(t.target);if(e)this.activate(e)};handleContextMenu=(t)=>{let e=wt(t.target);if(!e||this.options.interactive===!1)return;if(this.openNodeContext(e,this.contextPoint(t,e)))t.preventDefault()};contextPoint(t,e){let n=this.nodeOnScreen(e),i=this.root.getBoundingClientRect(),r={x:t.clientX-i.left,y:t.clientY-i.top},s=(this.display?.nodes.get(e)?.radius??0)*(this.display?.camera.scale??1)+24;return Number.isFinite(r.x)&&Number.isFinite(r.y)&&Math.hypot(r.x-n.x,r.y-n.y)<=s?r:n}nodeOnScreen(t){let e=this.display?.nodes.get(t);if(!e)return this.viewportCenter();return X(this.display?.camera??this.camera,this.viewport,e)}openNodeContext(t,e,n=!1){let r=(this.transition?.target??this.scene)?.nodes.get(t);if(!r)return!1;let o=this.now(),s=this.lastContext;if(s&&s.id===t&&o-s.time<tf)return s.taken;let a={node:r.node,x:Math.round(e.x),y:Math.round(e.y)},l=this.options.onNodeContext!==void 0||(this.listeners.get("node-context")?.size??0)>0;this.options.onNodeContext?.(a);let d=!this.emit("node-context",a,!0)||l;if(!d&&this.options.editable)if(n&&this.canLift(t))this.editOnLift=t,d=!0;else d=this.editNode(t);if(this.lastContext={id:t,time:o,taken:d},d)this.hoveredId=null,this.keyboardFocusId=null,this.updateTooltip();return d}canLift(t){if(!this.options.editable||this.options.interactive===!1||this.transition||this.editing)return!1;let e=this.display?.nodes.get(t);return e!==void 0&&e.role!=="sun"&&e.opacity>0.5&&e.parentId!==void 0&&this.tree!==null&&Y(this.tree,t).length>1}liftNode(t,e){let n=t!==null&&this.editOnLift===t;this.editOnLift=null;let i=this.display,r=this.tree;if(t===null||!i||!r||!this.canLift(t))return!1;let o=Y(r,t),s=o[o.length-1],a=o[o.length-2],l=i.nodes.get(t),d=Qe(i.camera,this.viewport,e),c=Array.from(i.nodes.values()).filter((u)=>u.id===t||u.role==="moon"&&u.hostId===t).map((u)=>({...u,x:u.x-l.x,y:u.y-l.y,unturned:void 0,cluster:void 0}));return this.nodeDrag={id:t,node:s,parent:a,index:a.children.indexOf(s),unreachable:nd(s,a.id),moving:!1,point:e,grab:{x:d.x-l.x,y:d.y-l.y},bodies:c,ringRadius:null,rings:null,slot:null,place:null,editOnRelease:n,scale:1},this.hoveredId=null,this.updateTooltip(),this.clock.requestPaint(),!0}dragNode(t,e){let n=this.nodeDrag;if(!n)return;if(this.destroyed){this.nodeDrag=null;return}if(n.point=t,e==="move"){if(!n.moving)this.startCarrying(n);this.updateDropPlace(n),this.clock.requestPaint();return}let i=n.moving?this.dropPlaceAt(n):null;if(e==="drop"&&i){this.dropNode(n,i);return}this.putBack(n,e==="drop")}startCarrying(t){if(t.moving=!0,this.viewMode==="focus"&&this.scene?.kind==="focus")t.ringRadius=this.scene.rings[0]?.radius??0,t.rings={focusId:this.scene.focusId,radii:this.scene.rings.map((e)=>e.radius),size:{...this.viewport}},t.slot=t.parent.id===this.focusId?t.index:null;t.place=t.slot===null?null:{parentId:this.focusId,index:t.slot,into:!1},this.emitDrag("start",t.node,t.parent,t.index),this.paint()}carriesPlanet(t){return t.moving&&t.slot!==null&&t.parent.id===this.focusId&&this.viewMode==="focus"}dropPlaceAt(t){let e=this.display;if(!e)return null;let{camera:n}=e,i=Qe(n,this.viewport,t.point),r=t.place?.into?t.place.parentId:null,o=this.viewMode==="focus",s=(h,m)=>{let p=o&&h.role==="planet"?Math.max(h.radius*Yb,Kb/n.scale):h.radius+Gb/n.scale;return m?p*qb:p},a=id(e,i,t.unreachable,s,r);if(a)return{parentId:a.id,index:null,into:!0};let l=t.slot===null?null:{parentId:this.focusId,index:t.slot,into:!1},d=new Set(t.bodies.map((h)=>h.id));for(let h of e.nodes.values())if(t.unreachable.has(h.id)&&!d.has(h.id)&&Math.hypot(i.x-h.x,i.y-h.y)<=h.radius)return t.place?.into?l:t.place;let c=this.transition?.target??this.scene,u=e.nodes.get(this.focusId);if(t.ringRadius!==null&&c&&u){let h=Math.max(Zb/n.scale,(t.bodies[0]?.radius??0)*1.2),m=this.transition?0:this.rotation,p=rd(c,{x:i.x-u.x,y:i.y-u.y},m,t.ringRadius,h,t.id,t.slot);if(p!==null)return{parentId:this.focusId,index:p,into:!1}}return l}updateDropPlace(t){let e=this.dropPlaceAt(t);if(od(e,t.place))return;t.place=e;let n=e&&this.tree?U(this.tree,e.parentId):null;if(this.emitDrag("over",t.node,n,e?.index??null),e&&!e.into&&e.index!==t.slot)t.slot=e.index,this.relayoutForDrag();else this.paint()}relayoutForDrag(){let t=this.buildScene();if(!t||!this.scene)return;let e=this.now(),n=this.currentDisplay(e);if(this.nextScene=null,!this.animationsEnabled()){this.transition=null,this.landingCamera=null,this.restOn(t,!1),this.camera={...n.camera},this.paint();return}this.startTransition(n,t,tn,e,Wb,{...n.camera})}dropNode(t,e){if(e.parentId===t.parent.id&&(e.index??t.parent.children.length-1)===t.index){this.putBack(t,!1);return}this.dropFrom=this.display,this.nodeDrag=null;let n=this.moveNode(t.id,e.parentId,e.index??void 0);if(this.dropFrom=null,!n){this.rebuild("morph"),this.emitDrag("end",t.node,null,null);return}let i=this.tree,r=Y(i,n.id),o=r[r.length-2]??null;this.emitDrag("end",n,o,o?o.children.indexOf(n):null)}putBack(t,e){if(this.nodeDrag=null,t.moving){this.dropFrom=this.display,this.rebuild("morph"),this.dropFrom=null,this.emitDrag("end",t.node,null,null);return}if(this.clock.requestPaint(),e&&t.editOnRelease)this.editNode(t.id)}emitDrag(t,e,n,i){let r={phase:t,node:e,parent:n,index:i};this.options.onNodeDrag?.(r),this.emit("node-drag",r)}withCarried(t){let e=this.nodeDrag;if(!e?.moving)return t;let n=e.place?.into?dc:1;if(e.scale+=(n-e.scale)*(this.prefersReducedMotion()?1:Xb),Math.abs(n-e.scale)<0.01)e.scale=n;else this.clock.requestPaint();let{scale:i}=e,r=Qe(t.camera,this.viewport,e.point),o=r.x-e.grab.x*i,s=r.y-e.grab.y*i,a=i>(1+dc)/2?1:0,l=new Map(t.nodes);for(let d of e.bodies)l.set(d.id,{...d,x:o+d.x*i,y:s+d.y*i,radius:d.radius*i,opacity:1,labelOpacity:a});return{...t,nodes:l}}activate(t){let n=(this.transition?.target??this.scene)?.nodes.get(t);if(!n)return;if(this.transition&&this.now()-this.transition.startedAt<Qb)return;if(this.options.onNodeClick?.(n.node),this.emit("node-click",{node:n.node}),this.viewMode==="focus"&&n.role==="sun"){this.goBack();return}this.navigate("focus",t)}goBack(){if(this.viewMode==="all")return this.navigate("focus",this.focusId);let t=this.focusPath[this.focusPath.length-2];return t===void 0?!1:this.navigate("focus",t)}handleKeyDown=(t)=>{if(this.options.interactive===!1||this.viewer.isOpen||t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)return;let e=wt(t.target),n=cs(t.target),i=!0;switch(t.key){case"Enter":case" ":if(t.key==="Enter"&&t.shiftKey&&this.editingKeys)i=n?this.editNewNode():e!==null&&this.addBeside(e);else if(n)this.editNewNode();else if(e)this.activate(e);else i=!1;break;case"F2":i=this.options.editable===!0&&e!==null&&this.editNode(e);break;case"Tab":case"Insert":i=this.editingKeys&&!t.shiftKey&&(n?this.editNewNode():e!==null&&this.editNewNode(e));break;case"Delete":i=this.editingKeys&&e!==null&&this.removeWithKey(e);break;case"Escape":case"Backspace":if(t.key==="Escape"&&this.nodeDrag){this.putBack(this.nodeDrag,!1);break}i=this.goBack();break;case"ContextMenu":i=e!==null&&this.openNodeContext(e,this.nodeOnScreen(e));break;case"F10":i=t.shiftKey&&e!==null&&this.openNodeContext(e,this.nodeOnScreen(e));break;case"+":case"=":this.zoomBy(er);break;case"-":case"_":this.zoomBy(1/er);break;case"0":this.fit();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Home":case"End":i=this.moveFocus(t.key,n?te:e);break;default:i=!1}if(i)t.preventDefault()};moveFocus(t,e){let n=this.transition?.target??this.scene,i=this.tree;if(!n||!i)return!1;if(this.viewMode==="focus"){let l=hs(n);if(n.addSlot&&this.addSlotView.isShown){let u=ee(n.addSlot.orbitAngle),h=l.filter((m)=>m!==te&&ee(m.orbitAngle??0)<u).length;l.splice(h,0,te)}if(l.length===0)return!1;let d=l.findIndex((u)=>u===te?e===te:u.id===e),c;if(t==="ArrowUp")return this.focusNodeElement(n.focusId),!0;if(t==="Home")c=l[0];else if(t==="End")c=l[l.length-1];else if(d===-1)c=t==="ArrowLeft"?l[l.length-1]:l[0];else if(t==="ArrowRight")c=l[(d+1)%l.length];else if(t==="ArrowLeft")c=l[(d-1+l.length)%l.length];else c=l[d];if(c===te)this.addSlotView.element.focus({preventScroll:!0});else this.turnToTop(c),this.focusNodeElement(c.id);return!0}let r=e?U(i,e):null;if(!r)return this.focusNodeElement(i.id),!0;let o=r.parent?.children??[r],s=o.indexOf(r),a;if(t==="ArrowUp")a=r.parent;else if(t==="ArrowDown")a=r.children.find((l)=>n.nodes.has(l.id));else if(t==="ArrowLeft")a=o[s-1];else if(t==="ArrowRight")a=o[s+1];else if(t==="Home")a=i;else if(t==="End")a=o[o.length-1];if(!a||!n.nodes.has(a.id))return!0;return this.focusNodeElement(a.id),this.keepInView(a.id),!0}turnToTop(t){if(t.orbitAngle===void 0||this.transition)return;let e=-90-t.orbitAngle;if(this.prefersReducedMotion()){this.spinPhysics.angle=e,this.clock.requestPaint();return}this.spinPhysics.settleTo(e),this.clock.add(this.spinTask)}keepInView(t){let e=this.display?.nodes.get(t);if(!e||!this.display)return;let n=X(this.display.camera,this.viewport,e),i=e.radius*this.display.camera.scale,r=48;if(n.x-i>=r&&n.x+i<=this.viewport.width-r&&n.y-i>=r&&n.y+i<=this.viewport.height-r)return;this.flyCamera(this.clampCamera({...this.camera,x:e.x,y:e.y}),this.viewportCenter())}handlePointerOver=(t)=>{if(t.pointerType!=="mouse"||this.dragging)return;let e=wt(t.target);if(e!==this.hoveredId)this.hoveredId=e,this.updateTooltip()};handlePointerOut=(t)=>{let e=wt(t.relatedTarget);if(e!==this.hoveredId)this.hoveredId=e,this.updateTooltip(),this.syncAmbientMotion()};handleFocusIn=(t)=>{let e=wt(t.target);if(!e)return;if(this.nodePainter.view(e)?.showFocusRing(),e!==this.activeId)this.activeId=e,this.tabStopsChanged=!0,this.clock.requestPaint();this.keyboardFocusId=tc(t.target)?e:null,this.updateTooltip()};handleFocusOut=(t)=>{if(!wt(t.relatedTarget))this.keyboardFocusId=null,this.updateTooltip(),this.syncAmbientMotion()};dragGestureAt(t){let e=this.scene;if(!e||this.transition)return"none";if(this.viewMode==="all"||this.zoomLevel()>1.04)return"pan";if(!Array.from(e.nodes.values()).some((i)=>i.role==="planet"))return"none";let n=this.sunOnScreen();return Math.hypot(t.x-n.x,t.y-n.y)>12?"spin":"none"}sunOnScreen(){let t=this.scene,e=t?this.display?.nodes.get(t.focusId):void 0;return e&&this.display?X(this.display.camera,this.viewport,e):this.viewportCenter()}releaseSpin(t){let e=this.scene;if(!e)return;if(this.prefersReducedMotion()){this.spinPhysics.stop(),this.spinSettled();return}let n=hs(e).map((i)=>-90-(i.orbitAngle??0));if(this.spinPhysics.release(t,n),this.spinPhysics.isMoving)this.clock.add(this.spinTask);else this.spinSettled()}spinTask=(t,e)=>{let n=this.spinPhysics.step(e);if(this.tickHaptics(),!n)this.spinSettled();return n};spinSettled(){if(this.userSpun){this.userSpun=!1;let t=this.planetNearestTop();if(t)this.options.onSpinSettle?.(t.node),this.emit("spin-settle",{planet:t.node})}this.syncAmbientMotion()}planetNearestTop(){let t=this.scene;if(!t||this.viewMode!=="focus")return null;let e=null,n=1/0;for(let i of t.nodes.values()){if(i.role!=="planet")continue;let r=Math.abs($t((i.orbitAngle??0)+this.rotation+90));if(r<n||r===n&&e&&ee(i.orbitAngle??0)<ee(e.orbitAngle??0))e=i,n=r}return e}tickHaptics(){let t=this.planetNearestTop();if(!t||t.id===this.topPlanetId)return;let e=this.topPlanetId;this.topPlanetId=t.id;let n=Math.abs(this.spinPhysics.velocity)*1000;if(this.options.spin?.haptics&&e!==null&&n<zb&&typeof navigator<"u")navigator.vibrate?.(4)}syncAmbientMotion(){if(!this.ambientRunning&&this.shouldDrift())this.ambientRunning=!0,this.clock.add(this.ambientTask)}shouldDrift(){return Boolean(this.options.orbitAnimation)&&!this.destroyed&&this.scene!==null&&this.viewMode==="focus"&&!this.transition&&this.spinPhysics.mode==="idle"&&!this.dragging&&this.cameraFlight===null&&this.wheelZoom===null&&!this.glide.isMoving&&this.hoveredId===null&&this.keyboardFocusId===null&&this.onScreen&&!this.viewer.isOpen&&!this.prefersReducedMotion()}ambientTask=(t,e)=>{if(!this.shouldDrift())return this.ambientRunning=!1,this.pendingDrift=0,!1;let n=this.spinningReach(this.scene)*this.camera.scale;if(n<=0)return this.ambientRunning=!1,this.pendingDrift=0,!1;let i=this.options.orbitSpeed>0&&Number.isFinite(this.options.orbitSpeed)?this.options.orbitSpeed:ir.orbitSpeed;if(this.pendingDrift+=360/Math.max(1,i)*(e/1000),this.pendingDrift<ve(nf/n))return"hold";return this.spinPhysics.angle+=this.pendingDrift,this.pendingDrift=0,!0};spinningReach(t){if(this.spinReach?.scene!==t){let e=t.nodes.get(t.focusId),n=0;for(let i of t.nodes.values())if(i.spins)n=Math.max(n,Math.hypot(i.x-(e?.x??0),i.y-(e?.y??0))+i.radius);this.spinReach={scene:t,reach:n}}return this.spinReach.reach}zoomLevel(){return this.scene?this.camera.scale/this.scene.frame.scale:1}zoomRange(){let t=this.options.zoom?.minimum??Bb,e=this.options.zoom?.maximum??Vb;if(this.viewMode==="focus")return[$b,Math.max(1,e)];return[Math.min(1,t),Math.max(1,e)]}viewportCenter(){return{x:this.viewport.width/2,y:this.viewport.height/2}}clampCamera(t){let e=this.scene;if(!e)return t;let{frame:n}=e,i=t.scale/n.scale,r=e.kind==="focus"?Math.max(0,1-1/i):1,o=this.viewport.width/2/n.scale*r,s=this.viewport.height/2/n.scale*r;return{scale:t.scale,x:Math.min(n.x+o,Math.max(n.x-o,t.x)),y:Math.min(n.y+s,Math.max(n.y-s,t.y))}}panCamera(t,e){if(!this.scene||this.transition)return!1;let n=this.camera;return this.camera=this.clampCamera(nl(this.camera,t,e)),this.clock.requestPaint(),Math.abs(n.x-this.camera.x)>0.000001||Math.abs(n.y-this.camera.y)>0.000001}glideTask=(t,e)=>{if(e<=0)return"hold";if(this.glide.isMoving&&!this.transition){let n=this.glide.step(e);if(this.panCamera(n.x,n.y)&&this.glide.isMoving)return!0}return this.glide.stop(),this.syncAmbientMotion(),!1};zoomAt(t,e){if(!this.scene||this.transition||!Number.isFinite(t)||t<=0)return!1;let[n,i]=this.zoomRange(),r=this.zoomLevel(),o=Math.min(i,Math.max(n,r*t));if(Math.abs(o-r)<0.000001)return!1;return this.camera=this.clampCamera(qr(this.camera,this.viewport,o/r,e)),this.hoveredId=null,this.tooltip.hide(),this.clock.requestPaint(),this.checkZoomNavigation(e),!0}checkZoomNavigation(t){if(this.viewMode!=="focus"||!this.scene||this.transition)return;let e=this.zoomLevel();if(e>=Pb){let n=this.bodyAt(t,Db);if(n)this.navigate("focus",n.id);return}if(e<=Rb){let n=this.focusPath[this.focusPath.length-2];if(n===void 0)this.navigate("all",this.focusId);else this.navigate("focus",n)}}bodyAt(t,e=0){let n=this.display;if(!n)return null;let i=null;for(let r of n.nodes.values()){if(r.role!=="planet"&&r.role!=="moon")continue;let o=X(this.camera,this.viewport,r),s=r.radius*this.camera.scale;if(s<e)continue;if(Math.hypot(t.x-o.x,t.y-o.y)<=s*1.35+12&&(!i||r.radius<i.radius))i=r}return i}settleZoom(){if(this.viewMode==="focus"&&this.scene&&!this.transition&&this.zoomLevel()<0.999)this.fit();this.syncAmbientMotion()}handleWheel(t,e){let n=this.options.zoom?.wheel??"auto";if(n===!1||!this.scene)return;if(!(t.ctrlKey||t.metaKey)&&(n==="modifier"||n==="auto"&&this.pageScrolls())){this.controls.showHint(this.words.text("scrollToZoom",{key:ec()?"⌘":"Ctrl"}));return}if(t.preventDefault(),this.transition)return;this.cameraFlight=null,this.glide.stop();let r=Math.log(ni(t,this.viewport.height));if(this.wheelZoom)this.wheelZoom.remaining+=r,this.wheelZoom.anchor=e;else this.wheelZoom={remaining:r,anchor:e},this.clock.add(this.wheelTask)}wheelTask=(t,e)=>{let n=this.wheelZoom;if(!n||this.transition)return this.wheelZoom=null,!1;if(e<=0)return"hold";let i=Math.abs(n.remaining)<0.002,r=i?n.remaining:n.remaining*(1-Math.exp(-e/Hb));if(n.remaining-=r,!this.zoomAt(Math.exp(r),n.anchor))n.remaining=0;if(i||n.remaining===0)return this.wheelZoom=null,this.settleZoom(),!1;return!0};handleDoubleTap(t,e){if(!this.scene||this.transition||wt(e))return;if(this.viewMode==="all")this.zoomStep(2,t);else if(this.zoomLevel()>1.04)this.fit()}zoomStep(t,e){let n=this.scene;if(!n||this.transition||!(t>0))return;let i=this.cameraFlight?.target??this.camera,[r,o]=this.zoomRange(),s=i.scale/n.frame.scale,a=Math.min(o,Math.max(r,s*t));this.flyCamera(this.clampCamera(qr(i,this.viewport,a/s,e)),e)}flyCamera(t,e){if(!this.scene||this.transition)return;if(this.glide.stop(),this.wheelZoom=null,!this.animationsEnabled()){this.cameraFlight=null,this.camera=t,this.paint(),this.afterCameraFlight(e);return}let n=Zr(this.camera,t,this.viewport),i=Math.min(650,Math.max(240,n.length*520));this.cameraFlight={path:n,target:t,anchor:e,startedAt:this.now(),duration:i},this.clock.add(this.cameraFlightTask)}cameraFlightTask=(t)=>{let e=this.cameraFlight;if(!e||this.transition)return this.cameraFlight=null,!1;let n=Math.min(1,(t-e.startedAt)/e.duration);if(this.camera=n>=1?e.target:e.path.at(Kr(n)),n>=1)return this.cameraFlight=null,this.afterCameraFlight(e.anchor),!1;return!0};afterCameraFlight(t){this.checkZoomNavigation(t),this.settleZoom()}pageScrolls(){let t=this.now();if(this.pageScrollCheck&&t-this.pageScrollCheck.time<500)return this.pageScrollCheck.scrolls;let e=nc(this.container);return this.pageScrollCheck={time:t,scrolls:e},e}updateEmbedding(){this.pageScrollCheck=null,this.root.classList.toggle("orbit--embedded",this.pageScrolls())}emitFocusChange(t){let e=t[t.length-1];this.options.onFocusChange?.(e),this.emit("focus-change",{node:e,path:t})}emit(t,e,n=!1){for(let r of Array.from(this.listeners.get(t)??[]))try{r(e)}catch(o){Jd(o)}if(typeof CustomEvent!=="function")return!0;let i=new CustomEvent(`orbit-${t}`,{detail:e,bubbles:!0,composed:!0,cancelable:n});return this.container.dispatchEvent(i)}runAction(t,e,n){if(!this.allowAction(t,e,n))return;if(e==="link"){if(rt(t.link)){let r=this.findLinked(t.link);if(r)this.followNodeLink(r);return}let i=t.link?D(t.link,"link"):null;if(i&&typeof window<"u")window.open(H(i,this.options.baseUrl),"_blank","noopener");return}if(!of.has(e)){let i=this.extensions.actions(t).find((r)=>r.id===e);if(i)xt(`The "${i.id}" action's run()`,void 0,()=>i.run(t,n));return}if((e==="image"||e==="video")&&this.options.mediaViewer!==!1&&this.viewer.open({node:t,kind:e}))return;if(this.options.showDetailSheet!==!1)this.openDetails(t,e)}allowAction(t,e,n){if(this.options.onAction?.({node:t,action:e,sourceEvent:n})===!1)return!1;let i=!1,r={node:t,action:e,sourceEvent:n,preventDefault:()=>{i=!0},get defaultPrevented(){return i}};return this.emit("action",r,!0)&&!i}viewFromSheet(t,e,n,i){if(!this.allowAction(t,e,n)){this.sheet.close();return}this.viewer.open({node:t,kind:e},{startAt:i})}openDetails(t,e){let n=this.tree?Y(this.tree,t.id).slice(0,-1):[];this.sheet.open({node:t,path:n,siblings:t.parent?.children??[t],section:e,baseUrl:this.options.baseUrl,noteRenderer:this.options.noteRenderer,resolveLink:(i)=>this.findLinked(i),onFollowLink:(i)=>this.followNodeLink(i),onViewMedia:this.options.mediaViewer===!1?void 0:(i,r,o,s)=>this.viewFromSheet(i,r,o,s),extensions:{icon:(i)=>this.extensions.icon(i),typeLabel:(i)=>this.extensions.nodeType(i)?.label,details:(i)=>{let r=this.extensions.nodeType(i)?.details;return r?(o)=>xt(`The "${this.extensions.typeName(i)}" node type's details()`,void 0,()=>r(i,o)):void 0},actions:(i)=>this.extensions.actions(i).map((r)=>({id:r.id,label:Xi(r,i),icon:r.icon})),runAction:(i,r,o)=>this.runAction(i,r,o),status:(i)=>this.extensions.status(i)},words:this.words})}mediaShown(t,e,n,i){this.syncAmbientMotion();let r={node:e.node,kind:e.kind,index:n,total:i};if(t==="media-open")this.options.onMediaOpen?.(r);else this.options.onMediaClose?.(r);this.emit(t,r)}mediaPlayed(t,e){let n={node:t,...e};this.options.onMediaState?.(n),this.emit("media-state",n)}findLinked(t){return this.tree?On(this.tree,t):null}describeLink(t){if(!rt(t.link))return{kind:"page"};let e=this.findLinked(t.link);return e?{kind:"node",label:this.words.text("goTo",{name:e.text||this.words.text("theIdea")})}:{kind:"missing"}}followNodeLink(t){if(this.sheet.isOpen)this.sheet.close();this.activeId=t.id,this.returnFocusToMap=!0,this.focusNode(t.id)}observeResize(){if(typeof ResizeObserver>"u")return;this.resizeObserver=new ResizeObserver(()=>{let t=this.readContainerSize();this.warnIfFlat(t),this.handleResize(t)}),this.resizeObserver.observe(this.root)}observeVisibility(){if(typeof IntersectionObserver>"u")return;this.visibilityObserver=new IntersectionObserver((t)=>{let e=t[t.length-1];if(e)this.onScreen=e.isIntersecting,this.syncAmbientMotion()}),this.visibilityObserver.observe(this.root)}warnIfFlat(t){if(this.warnedFlat||t.width<=0||t.height>=1||!this.root.isConnected)return;this.warnedFlat=!0,console.warn('[orbit] The map has no height, so nothing shows. It fills its container: give the container a height, for example style="height: 480px".')}handleResize(t){if(Math.abs(t.width-this.viewport.width)<0.5&&Math.abs(t.height-this.viewport.height)<0.5)return;let e=this.scene!==null;if(this.setViewport(t),this.updateEmbedding(),!this.tree)return;if(!e){this.rebuild("enter");return}if(us(t,this.layoutSize)){this.clock.requestPaint();return}if(this.transition){this.relayoutOnArrival=!0,this.clock.requestPaint();return}this.rebuild("instant")}setViewport(t){this.viewport=t,this.root.classList.toggle("orbit--narrow",t.width<=ef)}readContainerSize(){let t=this.root.getBoundingClientRect();return{width:t.width||this.root.clientWidth||0,height:t.height||this.root.clientHeight||0}}animationsEnabled(){return this.options.transitionDuration!==0&&!this.prefersReducedMotion()}prefersReducedMotion(){if(this.reducedMotionQuery===void 0)this.reducedMotionQuery=typeof window<"u"&&typeof window.matchMedia==="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;return this.reducedMotionQuery?.matches===!0}now(){return typeof performance<"u"?performance.now():Date.now()}}var hc=(t,e,n={})=>{let{strict:i,...r}=n,o=new Ft(t,r);if(typeof e==="string"){let s=mt(e,{strict:i,untitled:Bl(r.language,t,r.strings).text("untitledMap")});oa(s),o.render(s)}else o.render(e);return o};var pc=1e6,bc=(t,e={})=>{let n=new tt(e.language,e.strings),i=typeof t==="string"?mt(t,{untitled:n.text("untitledMap")}):sf(t)?t:null,r=i?i.root:t,o=i?pe(i.options):{},s={width:mc(e.width,800,"width"),height:mc(e.height,600,"height")},a=Wt(he(o.theme,e.theme)),l=Gt(jt(a),typeof a==="object"?a:void 0),d=e.title??o.ariaLabel??(r.text||n.text("mindMap")),c=new Qt({nodeTypes:e.nodeTypes,statuses:e.statuses,nodeTypeFor:e.nodeTypeFor}),u={viewport:s,extensions:c,tokens:l,showRings:e.showRings??o.showRings??!0,title:d,baseUrl:e.baseUrl??o.baseUrl,responsive:e.responsive,idPrefix:e.idPrefix,words:n};if(af(r))return lf(u.title,n.text("emptyMap"),s,l,e.responsive);let h={viewport:s,colors:qt(r,Dt(e.palette??o.palette),(f)=>c.color(f)),maxDepth:e.maxDepth??o.maxDepth},m=e.viewMode??o.viewMode??"focus",p=e.focus&&U(r,e.focus)?e.focus:r.id,b=m==="all"?li(r,h):ai(r,p,h);return zi(yt(b,0,b.frame),u)},sf=(t)=>typeof t.root==="object"&&t.root!==null&&!("children"in t),mc=(t,e,n)=>{let i=t??e;if(!Number.isFinite(i)||i<=0||i>pc)throw Error(`RenderToSVGOptions.${n} must be a positive number no larger than ${pc}: got ${i}.`);return i},af=(t)=>t.text.trim()===""&&!t.icon&&t.children.length===0&&!T(t.image)&&!T(t.video)&&!T(t.embed),lf=(t,e,n,i,r)=>{let{width:o,height:s}=n,a=r?'width="100%" height="100%"':`width="${o}" height="${s}"`,l=it(i["muted-text"]??"#5F6B7D",i),d=lt(i["font-family"]??"sans-serif");return`<svg xmlns="http://www.w3.org/2000/svg" ${a} viewBox="0 0 ${o} ${s}" role="img" aria-label="${lt(t)}"><text x="${o/2}" y="${s/2}" text-anchor="middle" font-family="${d}" font-size="15" fill="${l}">${lt(e)}</text></svg>`};var df={auto:"paper",night:"paper","glass-night":"glass",cosmos:"paper",blueprint:"ink","flat-night":"flat","material-night":"material","liquid-night":"liquid"},cf=["color-root","color-1","color-2","color-3","color-4","color-5","color-6","color-7"],fc=720,uf=(t)=>{let e=Wt(t),n=jt(e),i=df[n]??(n==="auto"?"paper":n),r=typeof e==="object"?e.tokens??{}:{},o=i===n?r:Object.fromEntries(Object.entries(r).filter(([s])=>cf.includes(s)));return{preset:i,tokens:{...o,surface:"transparent","surface-pattern":"none"}}},gc=(t,e,n={})=>{let i=new tt(n.language,n.strings),r=typeof e==="string"?mt(e,{untitled:i.text("untitledMap")}):e,o=pe(r.options),s=uf(he(o.theme,n.theme)),a=Gt(jt(s),s),l=new Qt({nodeTypes:n.nodeTypes,statuses:n.statuses,nodeTypeFor:n.nodeTypeFor}),d=n.palette??o.palette,c=qt(r.root,Dt(d),(f)=>l.color(f)),u=Re(r.root),h={words:i,tokens:a,extensions:l,colors:c,baseUrl:n.baseUrl??o.baseUrl,linked:(f)=>De(u,f)},m=n.title??(r.options.title||r.root.text||i.text("untitledMap")),p=W("article","orbit-print");p.lang=i.locale,p.style.cssText=ff(a);let b=W("h1","orbit-print__title");if(vc(b,r.root,m,h),p.append(b,...xc(r.root,h)),n.picture!==!1){let f=W("figure","orbit-print__picture"),g=bc(r,{width:fc,height:fc,viewMode:n.viewMode,focus:n.focus,theme:s,palette:d,title:m,language:n.language,strings:n.strings,baseUrl:h.baseUrl,idPrefix:n.idPrefix??"orbit-print",nodeTypes:n.nodeTypes,statuses:n.statuses,nodeTypeFor:n.nodeTypeFor});f.appendChild(document.importNode(new DOMParser().parseFromString(g,"image/svg+xml").documentElement,!0)),p.appendChild(f)}if(r.root.children.length>0){let f=W("div","orbit-print__outline");f.append(...r.root.children.map((g)=>yc(g,1,h))),p.appendChild(f)}return t.replaceChildren(p),ei(p),p},yc=(t,e,n)=>{let i=W("section","orbit-print__idea");i.dataset.depth=String(e);let r=W("div",t.children.length>0?"orbit-print__entry orbit-print__entry--parent":"orbit-print__entry"),o=`h${Math.min(e+1,6)}`,s=W(o,`orbit-print__name orbit-print__name--depth-${Math.min(e,3)}`),a=W("span","orbit-print__dot");if(a.setAttribute("aria-hidden","true"),a.style.setProperty("--orbit-print-dot",it(n.colors.get(t.id)??n.tokens["color-1"]??"#888888",n.tokens)),s.appendChild(a),vc(s,t,t.text||n.words.text("untitled"),n),r.append(s,...xc(t,n)),i.appendChild(r),t.children.length>0){let l=W("div","orbit-print__children");l.append(...t.children.map((d)=>yc(d,e+1,n))),i.appendChild(l)}return i},vc=(t,e,n,i)=>{let r=i.extensions.icon(e);if(r){let o=W("span","orbit-print__icon");o.textContent=r,t.append(o,document.createTextNode(" "))}t.appendChild(document.createTextNode(n))},xc=(t,e)=>{let n=[],i=hf(t,e);if(i)n.push(i);let r=pf(t,e);if(r)n.push(r);let o=e.extensions.nodeType(t)?.details;if(o){let s=W("div","orbit-print__details");if(xt("A node type’s details",void 0,()=>o(t,s)),s.childNodes.length>0)n.push(s)}if(t.note?.trim()){let s=W("div","orbit-print__note");if(t.noteFormat==="plain")s.classList.add("orbit-print__note--plain"),s.textContent=t.note;else s.appendChild(Ne(t.note,{baseUrl:e.baseUrl,resolveLink:e.linked}));n.push(s)}return n.push(...mf(t,e)),n},hf=(t,e)=>{let n=[],i=e.extensions.nodeType(t)?.label;if(i)n.push(nr(i));if(t.status){let o=nr(t.status,"orbit-print__chip--status"),s=e.extensions.status(t.status);o.style.setProperty("--orbit-print-status",it(s.color??`var(--_orbit-status-${s.tone})`,e.tokens)),n.push(o)}if(t.priority!==void 0)n.push(nr(e.words.text("priority",{priority:t.priority})));for(let o of t.tags??[])n.push(nr(`#${o}`));if(n.length===0)return null;let r=W("p","orbit-print__chips");return r.append(...n),r},nr=(t,e)=>{let n=W("span",e?`orbit-print__chip ${e}`:"orbit-print__chip");return n.textContent=t,n},pf=(t,e)=>{if(!t.link)return null;let n=W("p","orbit-print__link");if(rt(t.link)){let r=e.linked(t.link);if(!r)return null;return n.textContent=`→ ${e.words.text("seeIdea",{name:r.text||e.words.text("theIdea")})}`,n}let i=D(t.link,"link");if(!i)return null;return n.appendChild(xs(H(i,e.baseUrl))),n},xs=(t)=>{let e=W("a","orbit-print__address");return e.href=t,e.textContent=t,e},mf=(t,e)=>{let n=[];if(T(t.image)){let i=D(t.image.src,"image");if(i){let r=W("figure","orbit-print__media"),o=W("img","orbit-print__image");o.src=H(i,e.baseUrl),o.alt=t.image.alt??"",r.appendChild(o),bf(r,t.image.caption??t.image.alt),n.push(r)}}if(T(t.video)){let i=D(t.video.src,"video");if(i){let r=H(i,e.baseUrl),o=W("figure","orbit-print__media orbit-print__media--video"),s=t.video.thumbnail?D(t.video.thumbnail,"image"):Rn(r);if(s){let l=W("img","orbit-print__image");l.src=H(s,e.baseUrl),l.alt="",o.appendChild(l)}let a=W("figcaption","orbit-print__caption");a.append(document.createTextNode(`${t.video.caption??e.words.text("video")}: `),xs(Dn(r,t.video.provider))),o.appendChild(a),n.push(o)}}if(T(t.embed)&&!T(t.video)){let i=D(t.embed.src,"embed");if(i){let r=W("figure","orbit-print__media orbit-print__media--embed"),o=W("figcaption","orbit-print__caption");if(t.embed.caption)o.append(document.createTextNode(`${t.embed.caption}: `));o.appendChild(xs(H(i,e.baseUrl))),r.appendChild(o),n.push(r)}}return n},bf=(t,e)=>{if(e?.trim()){let n=W("figcaption","orbit-print__caption");n.textContent=e,t.appendChild(n)}},ff=(t)=>{let e=(i,r)=>it(t[i]??r,t),n=(i,r)=>gf(t[i]??r,t);return[`--_orbit-print-text: ${e("text","#1F2733")};`,`--_orbit-print-muted-text: ${e("muted-text","#5B6474")};`,`--_orbit-print-link-text: ${e("link-text",e("text","#1F2733"))};`,`--_orbit-print-chip-background: ${e("chip-background","#EEF0F4")};`,`--_orbit-print-chip-text: ${e("chip-text",e("text","#1F2733"))};`,`--_orbit-print-border: ${e("sheet-border","#D9DDE3")};`,`--_orbit-print-font: ${n("font-family","sans-serif")};`,`--_orbit-print-display-font: ${n("display-font",n("font-family","sans-serif"))};`].join(" ")},gf=(t,e)=>{let n=t;for(let i=0;i<4&&n.includes("var(");i+=1)n=n.replace(/var\(--_?orbit-([a-z0-9-]+)(?:\s*,\s*([^()]+))?\)/gi,(r,o,s)=>e[o]??s?.trim()??r);return n.includes("var(")||/[;{}]/.test(n)?"sans-serif":n},W=(t,e)=>{let n=document.createElement(t);return n.className=e,n};var yf=60,vf=2500,xf=12,wc={bottom:68},kc=2000,wf=["ArrowRight","ArrowDown","PageDown"," ","Enter"],kf=["ArrowLeft","ArrowUp","PageUp","Backspace"],Oc=(t=document)=>{let e=(k)=>t.getElementById(k),n=e("orbit-page"),i=e("page-map");if(!n||!i)return null;let r=JSON.parse(n.textContent??"{}"),o=new tt(r.language,r.strings),s=Sf(mt(r.source,{untitled:o.text("untitledMap")}),r.media??{}),a=hc(i,s,{theme:r.theme,viewMode:r.viewMode,focus:r.focus,language:r.language,strings:r.strings,insets:wc});Of(t,e("page-print"),s,r);let l=e("page"),d=e("page-caption"),c=e("page-title"),u=e("page-note"),h=e("page-controls"),m=e("page-count"),p=t.querySelector("[data-present]"),b=Mf(s.root),f=!1,g=0,y=0,v=()=>{l.classList.add("page--controls"),window.clearTimeout(y),y=window.setTimeout(()=>l.classList.remove("page--controls"),vf)},O=()=>{let k=Sc(s.root,b[g]);if(c.textContent=k?.text||o.text("theIdea"),k?.note&&k.noteFormat==="plain")u.textContent=k.note;else u.replaceChildren(Ne(k?.note??"",{baseUrl:s.options.baseUrl,resolveLink:(B)=>On(s.root,B)}));m.textContent=o.text("position",{index:g+1,total:b.length});let C=d.getBoundingClientRect().top;a.setOptions({insets:{bottom:Math.max(0,window.innerHeight-C+xf)}}),a.flyTo(b[g])},M=(k)=>{g=Math.min(b.length-1,Math.max(0,g+k)),O()},w=()=>{f=!0,g=Math.max(0,b.indexOf(a.getFocusedNode()?.id??"")),l.classList.add("page--presenting"),d.hidden=!1,h.hidden=!1,a.setOptions({interactive:!1,showControls:!1}),O(),v(),t.documentElement.requestFullscreen?.().catch(()=>{return})},x=()=>{if(!f)return;if(f=!1,l.classList.remove("page--presenting","page--controls"),d.hidden=!0,h.hidden=!0,a.setOptions({interactive:!0,showControls:!0,insets:wc}),t.fullscreenElement)t.exitFullscreen().catch(()=>{return});a.flyTo(b[g]),p?.focus()};p?.addEventListener("click",w),t.querySelector("[data-close]")?.addEventListener("click",x),t.querySelectorAll("[data-step]").forEach((k)=>{k.addEventListener("click",()=>{M(Number(k.dataset.step)),v()})}),t.defaultView?.addEventListener("keydown",(k)=>{if(k.defaultPrevented||k.altKey||k.ctrlKey||k.metaKey)return;if(!f){if(!k.target?.closest?.('input, textarea, [contenteditable="true"]')&&(k.key==="p"||k.key==="P"||k.key==="F5"))k.preventDefault(),w();return}if(wf.includes(k.key)&&!k.target?.closest?.("button"))k.preventDefault(),M(1);else if(kf.includes(k.key))k.preventDefault(),M(-1);else if(k.key==="Escape")k.preventDefault(),x()},!0),t.addEventListener("fullscreenchange",()=>{if(f&&!t.fullscreenElement&&t.fullscreenEnabled)x()});let E=null;return l.addEventListener("pointerdown",(k)=>{if(f&&!k.target.closest(".page__controls, .page__caption"))E={x:k.clientX,y:k.clientY}}),l.addEventListener("pointerup",(k)=>{if(!f||!E)return;let C=k.clientX-E.x,B=k.clientY-E.y;if(E=null,Math.abs(C)>=yf&&Math.abs(C)>Math.abs(B))M(C<0?1:-1);else if(Math.abs(C)<10&&Math.abs(B)<10)v()}),l.addEventListener("pointermove",(k)=>{if(f&&k.pointerType==="mouse")v()}),a},Of=(t,e,n,i)=>{let r=t.defaultView;if(!e||!r)return;let o=!1,s=()=>{if(o)return;o=!0,gc(e,n,{theme:i.theme,viewMode:i.viewMode,focus:i.focus,language:i.language,strings:i.strings})};if(r.addEventListener("beforeprint",s),typeof r.requestIdleCallback==="function")r.requestIdleCallback(s,{timeout:kc});else r.setTimeout(s,kc)},Sf=(t,e)=>{if(Object.keys(e).length===0)return t;let n=(r)=>e[r]??r,i=(r)=>{if(r.image)r.image={...r.image,src:n(r.image.src)};if(r.video?.thumbnail)r.video={...r.video,thumbnail:n(r.video.thumbnail)};if(r.note&&r.noteFormat!=="plain")r.note=r.note.replace(/(!\[[^\]]*\]\()([^)\s]+)/g,(o,s,a)=>`${s}${n(a)}`);r.children.forEach(i)};return i(t.root),t},Mf=(t)=>{let e=[],n=(i)=>{e.push(i.id),i.children.forEach(n)};return n(t),e},Sc=(t,e)=>{if(t.id===e)return t;for(let n of t.children){let i=Sc(n,e);if(i)return i}return null};Oc();})();
|