austere-axi 0.33.0 → 0.33.1
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/dist/austere.js +2 -2
- package/dist/catalog.json +1 -1
- package/dist/chrome/chrome.css +1 -1
- package/dist/chrome/chrome.js +23 -21
- package/dist/chrome/shell.css +1 -1
- package/dist/chrome/shell.js +31 -29
- package/dist/cli.mjs +1 -1
- package/dist/packs/diagrams/catalog.json +2 -2
- package/dist/packs/diagrams/pack.js +1 -1
- package/dist/packs/shadcn/catalog.json +2 -2
- package/dist/packs/shadcn/pack.js +1 -1
- package/package.json +1 -1
package/dist/austere.js
CHANGED
|
@@ -2821,14 +2821,14 @@ wtThree = TreeNode("Three", wtTwo)`]}),WX=[eqa,tOt];for(let e of[].concat(MX))if
|
|
|
2821
2821
|
</span>
|
|
2822
2822
|
</div>
|
|
2823
2823
|
</div>
|
|
2824
|
-
<div class="austere-callout" hidden role="group" aria-label="Notes on this part"></div>`,document.body.appendChild(o);let r=o.querySelector(".austere-hover"),n=o.querySelector(".austere-hover-label"),i=o.querySelector(".austere-selbtn"),s=o.querySelector(".austere-pop"),l=o.querySelector(".austere-pop-path"),u=o.querySelector(".austere-pop-quote"),d=o.querySelector("textarea"),p=o.querySelector('[data-act="history"]'),f=o.querySelector(".austere-callout"),m={},g=!1;function b(){let U=w&&m[w.targetId]||0;p.hidden=U<2,p.textContent=`History (${U})`}d.addEventListener("focus",()=>e({type:"writing",on:!0})),d.addEventListener("blur",()=>e({type:"writing",on:!1}));let w=null,v=null,k=0,S=null,I=U=>U instanceof Element&&!!U.closest(`[${Kh}]`),C=U=>U instanceof Element&&U.closest("[data-oui-id]")||null;function M(U,oe,ue=4){U.style.left=`${oe.left-ue}px`,U.style.top=`${oe.top-ue}px`,U.style.width=`${oe.width+ue*2}px`,U.style.height=`${oe.height+ue*2}px`}let N=null,z=null,D=null;function R(U,oe){let ue=oe?gt(oe):uY(U);r.style.visibility=ue?"":"hidden",ue&&(M(r,ue),O(oe??U,ue))}function O(U,oe){delete r.dataset.label;let ue=n.offsetWidth;if(!ue)return;let fe="",Ie=1/0;for(let Qe of Tqa){let Ft=P(Eqa(oe,Qe,ue),U);if(Ft<Ie&&([fe,Ie]=[Qe,Ft]),!Ft)break}fe&&(r.dataset.label=fe)}function P(U,oe){let ue=U.left+U.width,fe=U.top+U.height;if(U.left<0||U.top<0||ue>window.innerWidth||fe>window.innerHeight)return 1;let Ie=0,Qe=new Set;for(let Ft of[.06,.5,.94])for(let Pa of[.25,.75]){let ua=document.elementFromPoint(U.left+U.width*Ft,U.top+U.height*Pa);if(ua&&I(ua))return 2;if(!(!ua||Qe.has(ua)||oe.contains(ua)||ua.contains(oe))){if(Qe.add(ua),zqa(ua,U))return 2;ua.closest(Rqa)&&(Ie=1)}}return Ie}function B(U,oe=null,ue=U&&oe?jOt(U,oe):null,fe=HOt(oe)){if(N=U,z=oe,D=ue,!U){r.hidden=!0;return}n.textContent=`${U.getAttribute("data-oui-id")} \xB7 ${U.getAttribute("data-oui-c")}${fe}`,r.hidden=!1,R(U,oe)}function H(U){a==="pointer"||!s.hidden||Te||(S=U.target,!k&&(k=requestAnimationFrame(()=>{k=0;let oe=S;if(!(oe instanceof Element)||I(oe))return;if(a==="edit"){let fe=xb(oe);document.documentElement.classList.toggle("austere-can-edit",!!fe),B(fe?.target??null,fe?.block??null,null,"");return}let ue=C(oe);B(ue,ue&&qOt(ue,oe))})))}function V(){let U=window.getSelection();return!!U&&!U.isCollapsed&&U.toString().trim().length>0}function W(U){if(a!=="annotate"||I(U.target))return;if(!s.hidden){U.preventDefault(),U.stopPropagation();return}if(V())return;let oe=U.target;if(!(oe instanceof Element)||!U.altKey&&oe.closest(Aqa))return;let ue=C(oe);ue&&(U.preventDefault(),U.stopPropagation(),ie({target:ue,el:oe,point:{x:U.clientX,y:U.clientY}}))}function K(){if(a!=="annotate"||!s.hidden)return;let U=window.getSelection();if(!U||U.isCollapsed||!U.rangeCount){i.hidden=!0,v=null;return}let oe=U.toString().trim(),ue=U.getRangeAt(0),fe=ue.commonAncestorContainer,Ie=fe instanceof Element?fe:fe.parentElement,Qe=C(Ie);if(!oe||!Ie||!Qe||I(Ie)){i.hidden=!0,v=null;return}let Ft=ue.getBoundingClientRect();v={target:Qe,el:Ie,selection:rs(oe,600),point:{x:Ft.left,y:Ft.bottom}},i.hidden=!1;let Pa=i.offsetWidth||140;i.style.left=`${Math.max(8,Math.min(window.innerWidth-Pa-8,Ft.left+Ft.width/2-Pa/2))}px`,i.style.top=`${Math.max(8,Math.min(window.innerHeight-40,Ft.bottom+8))}px`}let te=0;function ae(){clearTimeout(te),te=window.setTimeout(K,120)}i.addEventListener("mousedown",U=>U.preventDefault()),i.addEventListener("click",U=>{U.preventDefault(),U.stopPropagation(),v&&ie(v),i.hidden=!0});function q(){let U=w;U&&(l.textContent="",U.path.forEach((oe,ue)=>{let fe=document.createElement("button");if(fe.type="button",fe.className="austere-chip"+(oe.id===U.targetId?" active":""),fe.textContent=oe.id,fe.title=oe.component,fe.addEventListener("click",()=>{U.targetId=oe.id,U.component=oe.component,b();let Ie=ue===U.path.length-1;if(!U.target.isConnected){let Ft=U.path[U.path.length-1].id;U.target=document.querySelector(`[data-oui-id="${CSS.escape(Ft)}"]`)??U.target}let Qe=`[data-oui-id="${CSS.escape(oe.id)}"]`;B(U.target.closest(Qe)??document.querySelector(Qe),Ie?U.piece:null,Ie?U.relocate:null,Ie?U.pieceLabel:""),Be(),q(),d.focus()}),l.appendChild(fe),ue<U.path.length-1){let Ie=document.createElement("span");Ie.className="austere-chip-sep",Ie.textContent="\u203A",l.appendChild(Ie)}}))}function ie({target:U,el:oe,selection:ue,point:fe}){let Ie=FOt(U),Qe=DS(U,oe),Ft=mY(U,oe),Pa=qOt(U,oe),ua;if(!ue){let vi=Ft||oe;ua=rs((vi instanceof HTMLElement?vi.innerText:void 0)||vi.textContent,200)||void 0,Ft&&ua===Qe?.part&&(ua=void 0)}let bn=pY(U);e({type:"focus",id:bn.id}),w={target:U,piece:Pa,relocate:Pa&&jOt(U,Pa),pieceLabel:HOt(Pa),targetId:bn.id,component:bn.component,path:Ie,selection:ue||void 0,excerpt:ua,detail:Qe},q(),b();let Ga=ue||ua||Qe?.part||"";u.textContent=rs(Ga,220),u.hidden=!Ga,d.value="",Je(),r.hidden=!0,i.hidden=!0,B(U,Pa,w.relocate,w.pieceLabel),r.classList.add("locked"),s.hidden=!1,me(fe),d.focus()}function me(U){if(window.innerWidth<640){s.classList.add("sheet"),s.style.left=s.style.top="";return}s.classList.remove("sheet");let oe=s.offsetWidth||360,ue=s.offsetHeight||200,fe=U.x+12,Ie=U.y+12;fe+oe>window.innerWidth-8&&(fe=Math.max(8,U.x-oe-12)),Ie+ue>window.innerHeight-8&&(Ie=Math.max(8,U.y-ue-12)),s.style.left=`${fe}px`,s.style.top=`${Ie}px`}function $(){document.activeElement===d&&d.blur(),s.hidden=!0,r.classList.remove("locked"),r.hidden=!0,w=null}function qe(){let U=d.value.trim();if(!w)return;if(!U&&!w.selection){d.focus(),d.classList.add("shake"),setTimeout(()=>d.classList.remove("shake"),400);return}let oe={kind:"annotation",target:w.targetId,component:w.component,path:w.path.map(Ie=>Ie.id),note:U};w.selection&&(oe.selection=w.selection),w.excerpt&&!w.selection&&(oe.excerpt=w.excerpt),w.detail&&w.targetId===w.path[w.path.length-1].id&&(oe.detail=w.detail),e({type:"annotate",item:oe});let ue=w.targetId,fe=oe.detail?z:null;$(),window.getSelection()?.removeAllRanges(),fe?.isConnected?Pt(fe,"queued"):ta([ue],"queued")}s.addEventListener("click",U=>{let oe=U.target instanceof Element?U.target.closest("[data-act]")?.getAttribute("data-act"):void 0;oe==="cancel"&&$(),oe==="queue"&&qe(),oe==="history"&&w&&e({type:"history",id:w.targetId})}),d.addEventListener("keydown",U=>{U.key==="Enter"&&!U.shiftKey&&!U.isComposing?(U.preventDefault(),qe()):U.key==="Escape"&&(U.preventDefault(),d.value.trim()||$())});let Te=null,ze=[],Oe=[],Ve=new Map;function Pe(U){for(let oe of document.querySelectorAll(`[data-oui-id="${CSS.escape(U.target)}"]`)){let ue=VOt(oe,U.piece);if(ue)for(let fe of[oe,...oe.querySelectorAll(fY)]){let Ie=xb(fe);if(ue.contains(fe)&&Ie?.block===fe&&Ie.target===oe&&yb(fe.textContent)===U.edit?.old)return fe}}return null}function ne(){if(!Te){for(let U of ze.reverse())U.node.parentNode===U.el&&U.el.replaceChildren(...U.original);ze=[],Ve.clear();for(let U of Oe){let oe=U.edit&&Pe(U);!U.edit||!oe||(ze.push({id:U.id,el:oe,..._qa(oe,U.edit.new)}),Ve.set(U.id,oe))}}}function ee(){if(Te)return!1;let U=new Map;for(let oe of ze)U.set(oe.el,oe);return[...U.values()].some(oe=>!oe.el.isConnected||oe.node.parentNode!==oe.el)}function le(U,oe){Je(),r.hidden=!0,document.documentElement.classList.remove("austere-can-edit");let ue=pY(oe),fe=DS(oe,U),Ie=yb(U.textContent);Te={el:U,original:Array.from(U.childNodes),old:Ie,item:{kind:"edit",target:ue.id,component:ue.component,path:FOt(oe).map(Ft=>Ft.id),...fe?{detail:fe}:{}}},U.replaceChildren(document.createTextNode(Ie));try{U.contentEditable="plaintext-only"}catch{U.contentEditable="true"}U.focus();let Qe=window.getSelection();Qe?.selectAllChildren(U),Qe?.collapseToEnd()}function ye(U){let oe=Te;if(!oe)return;Te=null;let ue=yb(oe.el.textContent);oe.el.removeAttribute("contenteditable"),document.activeElement===oe.el&&oe.el.blur();let fe=U&&(ue.length>BOt||oe.old.length>BOt||Cqa(oe.el,oe.old));if(U&&ue&&ue!==oe.old&&!fe){let Ie=document.createTextNode(ue);oe.el.replaceChildren(Ie),ze.push({id:"",el:oe.el,original:oe.original,node:Ie}),e({type:"edit",item:{...oe.item,old:oe.old,new:ue}});return}oe.el.replaceChildren(...oe.original),U&&(!ue||fe)&&Pt(oe.el,"refused"),ne()}function Ae(U){let oe=U.target;if(a!=="edit"||!(oe instanceof Element)||I(oe))return;if(Te?.el.contains(oe)){U.preventDefault(),U.stopPropagation();return}if(V())return;let ue=xb(oe);ue&&(U.preventDefault(),U.stopPropagation(),le(ue.block,ue.target))}document.addEventListener("click",Ae,!0),document.addEventListener("focusout",U=>{Te&&U.target===Te.el&&ye(!0)}),document.addEventListener("keydown",U=>{!Te||U.isComposing||!(U.target instanceof Node)||!Te.el.contains(U.target)||(U.key==="Enter"||U.key==="Escape"?(U.preventDefault(),U.stopPropagation(),ye(U.key==="Enter")):U.key===" "&&Te.el.tagName==="BUTTON"&&(U.preventDefault(),document.execCommand("insertText",!1," ")))},!0),document.addEventListener("paste",U=>{if(!Te||!(U.target instanceof Node)||!Te.el.contains(U.target))return;U.preventDefault();let oe=U.clipboardData?.getData("text/plain")??"";document.execCommand("insertText",!1,oe.replace(/\s*[\r\n]+\s*/g," "))},!0),document.addEventListener("mousemove",H,{passive:!0}),document.addEventListener("click",W,!0),document.addEventListener("mouseup",ae),document.addEventListener("keyup",U=>{(U.shiftKey||U.key.startsWith("Arrow"))&&ae()}),document.addEventListener("selectionchange",()=>{"ontouchstart"in window&&ae()}),document.addEventListener("keydown",U=>{(U.metaKey||U.ctrlKey)&&(U.key==="i"||U.key==="I")?(U.preventDefault(),e({type:"toggle-mode"})):g&&(U.metaKey||U.ctrlKey)&&!U.altKey&&(U.key==="k"||U.key==="K")?(U.preventDefault(),e({type:"quick-switch"})):g&&(U.metaKey||U.ctrlKey)&&!U.altKey&&(U.key==="b"||U.key==="B")&&(U.preventDefault(),e({type:"toggle-sidebar"}))}),window.addEventListener("scroll",()=>{if(!s.hidden)return Ke();Je(),r.hidden=!0,i.hidden=!0,yo()},{passive:!0}),document.addEventListener("mouseleave",()=>{s.hidden&&(r.hidden=!0)});function Me(U,oe,ue,fe=new Set){if(fe.has(U))return[];fe.add(U);let Ie=document.querySelectorAll(`[data-oui-id="${CSS.escape(U)}"]`);return Ie.length?Array.from(Ie):!oe||!ue?[]:ue(oe,U).flatMap(Qe=>Me(Qe,oe,ue,fe))}function ut(U,oe,ue){let fe=new Set;for(let Ie of U)for(let Qe of Me(Ie,oe,ue))fe.add(Qe);return Array.from(fe).filter(Ie=>!Array.from(fe).some(Qe=>Qe!==Ie&&Qe.contains(Ie)))}function st(U,oe){let ue=document.createElement("div");return ue.setAttribute(Kh,""),ue.className=oe,ue.style.left=`${U.left+window.scrollX-4}px`,ue.style.top=`${U.top+window.scrollY-4}px`,ue.style.width=`${U.width+8}px`,ue.style.height=`${U.height+8}px`,ue}function We(U){if(getComputedStyle(U).display!=="contents")return dY(U);let[oe,ue,fe,Ie]=[1/0,1/0,-1/0,-1/0],Qe=Pa=>{!Pa.width&&!Pa.height||([oe,ue,fe,Ie]=[Math.min(oe,Pa.left),Math.min(ue,Pa.top),Math.max(fe,Pa.right),Math.max(Ie,Pa.bottom)])},Ft=Pa=>{for(let ua of Pa.childNodes)if(ua instanceof Element)getComputedStyle(ua).display==="contents"?Ft(ua):Qe(dY(ua));else if(ua.nodeType===Node.TEXT_NODE&&ua.textContent?.trim()){let bn=document.createRange();bn.selectNodeContents(ua),Qe(bn.getBoundingClientRect())}};return Ft(U),{left:oe,top:ue,right:fe,bottom:Ie}}function jt(U){for(let oe=U.closest("[hidden='until-found']");oe?.parentElement;oe=U.closest("[hidden='until-found']"))U=oe.parentElement;return U}function gt(U){let oe=jt(U),{left:ue,top:fe,right:Ie,bottom:Qe}=We(oe),Ft=Ie===ue,Pa=Qe===fe;if(Ft&&Pa)return null;for(let Ga=oe.parentElement;Ga&&Ga!==document.body;Ga=Ga.parentElement){let vi=getComputedStyle(Ga),is=vi.overflowX!=="visible",i0=vi.overflowY!=="visible";if(!is&&!i0||vi.display==="contents")continue;let Us=Ga.getBoundingClientRect();is&&([ue,Ie]=[Math.max(ue,Us.left),Math.min(Ie,Us.right)]),i0&&([fe,Qe]=[Math.max(fe,Us.top),Math.min(Qe,Us.bottom)])}let ua=Ft?Ie>=ue:Ie>ue,bn=Pa?Qe>=fe:Qe>fe;return ua&&bn?{left:ue,top:fe,width:Ie-ue,height:Qe-fe}:null}function Pt(U,oe){let ue=gt(U);if(!ue)return;let fe=st(ue,`austere-flash ${oe}`);document.body.appendChild(fe),setTimeout(()=>fe.remove(),2400)}function ta(U,oe="changed",ue,fe){let Ie=ut(U,ue,fe);for(let Qe of Ie)Pt(Qe,oe);return Ie}function aa(U,oe,ue){let fe=Me(U,oe,ue);if(!fe.length)return!1;for(let Ft=fe[0].closest("[hidden='until-found']");Ft;Ft=fe[0].closest("[hidden='until-found']"))Ft.removeAttribute("hidden"),Ft.dispatchEvent(new Event("beforematch"));let Ie=uY(fe[0]),Qe=Ie.top+window.scrollY-Math.max(24,(window.innerHeight-Ie.height)/3);return window.scrollTo({top:Math.max(0,Qe),behavior:"smooth"}),setTimeout(()=>ta([U],"changed",oe,ue),350),!0}let ya=document.createElement("div");ya.setAttribute(Kh,""),o.appendChild(ya);let Kt=null,oa=0,re=document.createElement("div");re.setAttribute(Kh,""),o.appendChild(re);let pe=[],_e=[],he=null,pt=0,ot="",Bt=0,ra=()=>a!=="pointer"&&pe.some(U=>U.status!=="done"&&U.status!=="discarded");function yo(){Bt||!ra()||(Bt=requestAnimationFrame(()=>{Bt=0,ra()&&Ee()}))}let to=document.createElement("div");to.setAttribute(Kh,""),o.appendChild(to);let xo=[];function $a(){let[U,oe]=Kt&&t?t():[],ue=[],fe=[];for(let Ie of Kt?ut(Kt,U,oe):[]){let Qe=gt(Ie);Qe&&(ue.push(Ie),fe.push(Qe))}return ya.replaceChildren(...fe.map(Ie=>st(Ie,"austere-mark"))),ue}function Be(){if(!(r.hidden||!N)){if(!N.isConnected){let U=N.getAttribute("data-oui-id");N=document.querySelector(`[data-oui-id="${CSS.escape(U)}"]`)}N&&z&&!z.isConnected&&(z=D?.(N)??z),N?R(N,z):r.hidden=!0}}function Ke(){oa||!Kt&&r.hidden&&!xo.length&&!ra()&&!ze.length||(oa=requestAnimationFrame(()=>{oa=0,ee()&&ne(),Kt&&$a(),xo.length&&kb(),ra()&&Ee(),Be()}))}window.addEventListener("resize",Ke,{passive:!0}),new ResizeObserver(Ke).observe(document.body),new MutationObserver(U=>{U.some(oe=>!I(oe.target.nodeType===1?oe.target:oe.target.parentElement))&&Ke()}).observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open","x","y","width","height","d","transform","viewBox"]}),document.addEventListener("scroll",U=>{U.target!==document&&Ke()},{capture:!0,passive:!0});function Ee(){cancelAnimationFrame(Bt),Bt=0;let U=new Map,oe=new Map;if(a!=="pointer")for(let fe of pe){if(fe.status==="done"||fe.status==="discarded")continue;if(fe.edit){let Qe=Ve.get(fe.id);Qe?.isConnected&&U.set(Qe,[...U.get(Qe)??[],fe]);continue}let Ie=oe.get(fe.target);Ie||(Ie=document.querySelectorAll(`[data-oui-id="${CSS.escape(fe.target)}"]`),oe.set(fe.target,Ie));for(let Qe of Ie){let Ft=VOt(Qe,fe.piece);Ft&&U.set(Ft,[...U.get(Ft)??[],fe])}}_e=[];for(let[fe,Ie]of U){let Qe=gt(fe);Qe&&_e.push({el:fe,box:Qe,notes:Ie})}re.replaceChildren(..._e.map(fe=>st(fe.box,"austere-note-outline")));let ue=_e.find(fe=>fe.el===he);ue?Ar(ue):Je()}function Je(){clearTimeout(pt),pt=0,he=null,!f.hidden&&(f.hidden=!0,Be())}function Ar(U){he=U.el;let oe=JSON.stringify(U.notes);(oe!==ot||f.hidden)&&f.replaceChildren(...U.notes.map((Ga,vi)=>{let is=document.createElement("section");is.className="austere-callout-note",is.dataset.noteId=Ga.id;let i0=[],Us=(Rd,Ed,s0)=>{let wb=document.createElement(Rd);return wb.className=Ed,wb.textContent=s0,i0.push(wb),wb};if(Ga.edit)Us("del","austere-callout-old",rs(Ga.edit.old,300)),Us("div","austere-callout-new",rs(Ga.edit.new,300));else{let Rd=rs(Ga.quote,160),Ed=U.notes[vi-1];Rd&&(!Ed||Ed.edit||rs(Ed.quote,160)!==Rd)&&Us("blockquote","austere-callout-quote",Rd)}Ga.note&&Us("div","austere-callout-text",Ga.note),Us("div","austere-callout-meta",[Ga.author,Nqa[Ga.status]].filter(Boolean).join(" \xB7 "));let HS=document.createElement("div");HS.className="austere-callout-actions";let dPt=[...Ga.queued?[["edit","Edit"],["delete","Delete"]]:[],["show","Show in notes"]];for(let[Rd,Ed]of dPt){let s0=document.createElement("button");s0.type="button",s0.dataset.act=Rd,s0.textContent=Ed,HS.appendChild(s0)}return i0.push(HS),is.append(...i0),is})),ot=oe,f.hidden=!1;let ue=f.offsetWidth,fe=f.offsetHeight,{left:Ie,top:Qe,width:Ft,height:Pa}=U.box,ua=Qe+Pa+4,bn=Ie-4+ue<=window.innerWidth-8?Ie-4:Ie+Ft+4-ue;f.style.left=`${Math.max(8,bn)}px`,f.style.top=`${ua+fe>window.innerHeight-8&&Qe-4-fe>=8?Qe-4-fe:ua}px`,Be()}function Gt(U){let oe=_e.filter(ue=>ue.el.contains(U));return oe.find(ue=>!oe.some(fe=>fe!==ue&&ue.el.contains(fe.el)))??null}function FS(U){if(a==="pointer"||Te||!_e.length||!(U.target instanceof Element))return;if(f.contains(U.target)){clearTimeout(pt),pt=0;return}if(!s.hidden||I(U.target))return;let oe=Gt(U.target);oe?(clearTimeout(pt),pt=0,(he!==oe.el||f.hidden)&&Ar(oe)):!f.hidden&&!pt&&(pt=window.setTimeout(Je,250))}document.addEventListener("mousemove",FS,{passive:!0}),f.addEventListener("click",U=>{let oe=U.target instanceof Element?U.target.closest("button[data-act]"):null,ue=oe?.closest("[data-note-id]")?.dataset.noteId;!oe||!ue||(e({type:"note-action",action:oe.getAttribute("data-act"),id:ue}),Je())});function qS(U,oe=!1){Kt=U.length?U:null;let ue=$a();if(oe&&ue.length){let fe=ue.map(Ie=>uY(jt(Ie)));if(!fe.some(Ie=>Ie.bottom>0&&Ie.top<window.innerHeight)){let Ie=fe[0],Qe=Ie.top+window.scrollY-Math.max(24,(window.innerHeight-Ie.height)/3);window.scrollTo({top:Math.max(0,Qe),behavior:"smooth"})}}return ue.length}function kb(){let[U,oe]=xo.length&&t?t():[],ue=new Map;for(let Ie of xo)ue.set(Ie.statement,[...ue.get(Ie.statement)??[],Ie]);let fe=[];for(let[Ie,Qe]of ue){let Ft=!1;for(let Pa of ut([Ie],U,oe)){let ua=gt(Pa);if(!ua)continue;let bn=st(ua,"austere-focus");if(bn.style.setProperty("--austere-viewer",Qe[0].colour),!Ft){Ft=!0;let Ga=document.createElement("div");Ga.className="austere-focus-names";for(let vi of Qe){let is=document.createElement("span");is.textContent=vi.name,is.style.background=vi.colour,Ga.appendChild(is)}bn.appendChild(Ga)}fe.push(bn)}}to.replaceChildren(...fe)}function Yh(U){xo=U,kb()}return{setQuickSwitch(U){g=U},setHistory(U){m=U,w&&b()},setMode(U,oe=!1){ye(!0),oe&&d.value.trim()&&qe(),a=U==="annotate"||U==="edit"?U:"pointer";let ue=document.documentElement.classList;ue.toggle("austere-annotating",a==="annotate"),ue.toggle("austere-editing",a==="edit"),ue.remove("austere-can-edit"),r.classList.toggle("edit",a==="edit"),a!=="annotate"&&($(),i.hidden=!0,r.hidden=!0),Ee()},setNotes(U){pe=U,Oe=U.filter(oe=>oe.edit),ne(),Ee()},clearEdits(){ye(!1),Oe=[],ne(),Ee()},flash:ta,reveal:aa,highlight:qS,focus:Yh}}var OS={diagrams:{name:"@austere-axi/pack-diagrams",version:"0.33.0",components:["Sequence","Actor","Message","Branch","Nested","NestedLevel","LayerStack","Layer","Kanban","KanbanCard","StoryMap","Story","UserJourney","JourneyStep","ServiceBlueprint","BlueprintStep","EventModel","EventItem","Heatmap","HeatRow","PermissionMatrix","AccessRow","UnitGrid","UnitShare","Traceability","TraceReq","TraceItem","Gantt","GanttTask","GitGraph","GitCommit","ScheduleNetwork","ScheduleTask","Quadrant","QuadrantItem","Venn","VennSet","VennOverlap","Pyramid","PyramidLayer","Loop","LoopStep","LoopHub","Fishbone","FishCause","WardleyMap","WardleyPart","Radar","RadarSeries","PolarChart","Waterfall","Treemap","Sankey"]},shadcn:{name:"@austere-axi/pack-shadcn",version:"0.33.0",components:["Progress","Avatar","AvatarGroup","Tooltip","HoverCard","Breadcrumb","BreadcrumbItem","Kbd","Skeleton","Calendar","Timeline","TimelineItem"]}};function Dqa(e){let t=e.lastIndexOf("@");return t<=0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}var Oqa=/^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Pqa=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;function GOt(e){let t=[];for(let a of String(e||"").split(",")){let[o,r]=a.trim().split(/\s+/);if(!o)continue;let{name:n,version:i}=Dqa(o);!Oqa.test(n)||!Pqa.test(i)||t.some(s=>s.name===n)||t.push(r&&/^sha(256|384|512)-[A-Za-z0-9+/=]+$/.test(r)?{name:n,version:i,integrity:r}:{name:n,version:i})}return t}var WOt="https://cdn.jsdelivr.net/npm";function ZOt(e=document){let t=e.querySelector('meta[name="austere-packs"]');return t?GOt(t.getAttribute("content")||""):[]}function KOt(e,t){let a=[...t];for(let[o,r]of Object.entries(OS))a.some(n=>n.name===r.name)||r.components.some(n=>new RegExp(`\\b${n}\\s*\\(`).test(e))&&a.push({name:r.name,version:r.version,bundled:o});return a}var hY=new Set(Object.values(OS).map(e=>e.name)),Bqa=new Set(Object.values(OS).filter(e=>e.name==="@austere-axi/pack-diagrams").flatMap(e=>e.components));function XOt(e){return[...e].sort((t,a)=>Number(hY.has(a.name))-Number(hY.has(t.name)))}function YOt(e,t){return!hY.has(e)&&Bqa.has(t)}function gY(){return/\/__austere\/$/.test(yg)}function Fqa(e){if(e.bundled)return{src:H5(`packs/${e.bundled}/pack.js`)||`${WOt}/austere-axi@${e.version}/dist/packs/${e.bundled}/pack.js`};if(gY()){let t=e.integrity?`?integrity=${encodeURIComponent(e.integrity)}`:"";return{src:`${yg}installed-packs/${encodeURIComponent(`${e.name}@${e.version}`)}/pack.js${t}`}}return{src:`${WOt}/${e.name}@${e.version}/dist/pack.js`,integrity:e.integrity}}function qqa(e,t){return new Promise((a,o)=>{let r=document.createElement("script");r.src=e,r.async=!0,t&&(r.integrity=t,r.crossOrigin="anonymous"),r.onload=()=>a(),r.onerror=()=>o(new Error(`could not load ${e}`)),document.head.appendChild(r)})}async function QOt(e,{onError:t}={}){let a=e.filter(o=>!Vl().some(r=>r.name===o.name));return await Promise.all(a.map(o=>{let{src:r,integrity:n}=Fqa(o);return qqa(r,n).then(()=>{Vl().some(i=>i.name===o.name)||t?.(o,new Error(`${r} loaded but did not register pack ${o.name}`))},i=>t?.(o,i))})),Vl()}function JOt(e){for(let t of e){if(!t.css)continue;let a=`austere-pack-css-${t.name.replace(/[^a-z0-9]/gi,"-")}`;if(document.getElementById(a))continue;let o=document.createElement("style");o.id=a,o.textContent=t.css,document.head.appendChild(o)}}var Hqa=/[A-Za-z_$]/;function jqa(e){let t=[],a=String(e??""),o=0,r=1,n=a.length;for(;o<n;){let i=a[o];if(i===`
|
|
2824
|
+
<div class="austere-callout" hidden role="group" aria-label="Notes on this part"></div>`,document.body.appendChild(o);let r=o.querySelector(".austere-hover"),n=o.querySelector(".austere-hover-label"),i=o.querySelector(".austere-selbtn"),s=o.querySelector(".austere-pop"),l=o.querySelector(".austere-pop-path"),u=o.querySelector(".austere-pop-quote"),d=o.querySelector("textarea"),p=o.querySelector('[data-act="history"]'),f=o.querySelector(".austere-callout"),m={},g=!1;function b(){let U=w&&m[w.targetId]||0;p.hidden=U<2,p.textContent=`History (${U})`}d.addEventListener("focus",()=>e({type:"writing",on:!0})),d.addEventListener("blur",()=>e({type:"writing",on:!1}));let w=null,v=null,k=0,S=null,I=U=>U instanceof Element&&!!U.closest(`[${Kh}]`),C=U=>U instanceof Element&&U.closest("[data-oui-id]")||null;function M(U,oe,ue=4){U.style.left=`${oe.left-ue}px`,U.style.top=`${oe.top-ue}px`,U.style.width=`${oe.width+ue*2}px`,U.style.height=`${oe.height+ue*2}px`}let N=null,z=null,D=null;function R(U,oe){let ue=oe?gt(oe):uY(U);r.style.visibility=ue?"":"hidden",ue&&(M(r,ue),O(oe??U,ue))}function O(U,oe){delete r.dataset.label;let ue=n.offsetWidth;if(!ue)return;let fe="",Ie=1/0;for(let Qe of Tqa){let Ft=P(Eqa(oe,Qe,ue),U);if(Ft<Ie&&([fe,Ie]=[Qe,Ft]),!Ft)break}fe&&(r.dataset.label=fe)}function P(U,oe){let ue=U.left+U.width,fe=U.top+U.height;if(U.left<0||U.top<0||ue>window.innerWidth||fe>window.innerHeight)return 1;let Ie=0,Qe=new Set;for(let Ft of[.06,.5,.94])for(let Pa of[.25,.75]){let ua=document.elementFromPoint(U.left+U.width*Ft,U.top+U.height*Pa);if(ua&&I(ua))return 2;if(!(!ua||Qe.has(ua)||oe.contains(ua)||ua.contains(oe))){if(Qe.add(ua),zqa(ua,U))return 2;ua.closest(Rqa)&&(Ie=1)}}return Ie}function B(U,oe=null,ue=U&&oe?jOt(U,oe):null,fe=HOt(oe)){if(N=U,z=oe,D=ue,!U){r.hidden=!0;return}n.textContent=`${U.getAttribute("data-oui-id")} \xB7 ${U.getAttribute("data-oui-c")}${fe}`,r.hidden=!1,R(U,oe)}function H(U){a==="pointer"||!s.hidden||Te||(S=U.target,!k&&(k=requestAnimationFrame(()=>{k=0;let oe=S;if(!(oe instanceof Element)||I(oe))return;if(a==="edit"){let fe=xb(oe);document.documentElement.classList.toggle("austere-can-edit",!!fe),B(fe?.target??null,fe?.block??null,null,"");return}let ue=C(oe);B(ue,ue&&qOt(ue,oe))})))}function V(){let U=window.getSelection();return!!U&&!U.isCollapsed&&U.toString().trim().length>0}function W(U){if(a!=="annotate"||I(U.target))return;if(!s.hidden){U.preventDefault(),U.stopPropagation();return}if(V())return;let oe=U.target;if(!(oe instanceof Element)||!U.altKey&&oe.closest(Aqa))return;let ue=C(oe);ue&&(U.preventDefault(),U.stopPropagation(),ie({target:ue,el:oe,point:{x:U.clientX,y:U.clientY}}))}function K(){if(a!=="annotate"||!s.hidden)return;let U=window.getSelection();if(!U||U.isCollapsed||!U.rangeCount){i.hidden=!0,v=null;return}let oe=U.toString().trim(),ue=U.getRangeAt(0),fe=ue.commonAncestorContainer,Ie=fe instanceof Element?fe:fe.parentElement,Qe=C(Ie);if(!oe||!Ie||!Qe||I(Ie)){i.hidden=!0,v=null;return}let Ft=ue.getBoundingClientRect();v={target:Qe,el:Ie,selection:rs(oe,600),point:{x:Ft.left,y:Ft.bottom}},i.hidden=!1;let Pa=i.offsetWidth||140;i.style.left=`${Math.max(8,Math.min(window.innerWidth-Pa-8,Ft.left+Ft.width/2-Pa/2))}px`,i.style.top=`${Math.max(8,Math.min(window.innerHeight-40,Ft.bottom+8))}px`}let te=0;function ae(){clearTimeout(te),te=window.setTimeout(K,120)}i.addEventListener("mousedown",U=>U.preventDefault()),i.addEventListener("click",U=>{U.preventDefault(),U.stopPropagation(),v&&ie(v),i.hidden=!0});function q(){let U=w;U&&(l.textContent="",U.path.forEach((oe,ue)=>{let fe=document.createElement("button");if(fe.type="button",fe.className="austere-chip"+(oe.id===U.targetId?" active":""),fe.textContent=oe.id,fe.title=oe.component,fe.addEventListener("click",()=>{U.targetId=oe.id,U.component=oe.component,b();let Ie=ue===U.path.length-1;if(!U.target.isConnected){let Ft=U.path[U.path.length-1].id;U.target=document.querySelector(`[data-oui-id="${CSS.escape(Ft)}"]`)??U.target}let Qe=`[data-oui-id="${CSS.escape(oe.id)}"]`;B(U.target.closest(Qe)??document.querySelector(Qe),Ie?U.piece:null,Ie?U.relocate:null,Ie?U.pieceLabel:""),Be(),q(),d.focus()}),l.appendChild(fe),ue<U.path.length-1){let Ie=document.createElement("span");Ie.className="austere-chip-sep",Ie.textContent="\u203A",l.appendChild(Ie)}}))}function ie({target:U,el:oe,selection:ue,point:fe}){let Ie=FOt(U),Qe=DS(U,oe),Ft=mY(U,oe),Pa=qOt(U,oe),ua;if(!ue){let vi=Ft||oe;ua=rs((vi instanceof HTMLElement?vi.innerText:void 0)||vi.textContent,200)||void 0,Ft&&ua===Qe?.part&&(ua=void 0)}let bn=pY(U);e({type:"focus",id:bn.id}),w={target:U,piece:Pa,relocate:Pa&&jOt(U,Pa),pieceLabel:HOt(Pa),targetId:bn.id,component:bn.component,path:Ie,selection:ue||void 0,excerpt:ua,detail:Qe},q(),b();let Ga=ue||ua||Qe?.part||"";u.textContent=rs(Ga,220),u.hidden=!Ga,d.value="",Je(),r.hidden=!0,i.hidden=!0,B(U,Pa,w.relocate,w.pieceLabel),r.classList.add("locked"),s.hidden=!1,me(fe),d.focus()}function me(U){if(window.innerWidth<640){s.classList.add("sheet"),s.style.left=s.style.top="";return}s.classList.remove("sheet");let oe=s.offsetWidth||360,ue=s.offsetHeight||200,fe=U.x+12,Ie=U.y+12;fe+oe>window.innerWidth-8&&(fe=Math.max(8,U.x-oe-12)),Ie+ue>window.innerHeight-8&&(Ie=Math.max(8,U.y-ue-12)),s.style.left=`${fe}px`,s.style.top=`${Ie}px`}function $(){document.activeElement===d&&d.blur(),s.hidden=!0,r.classList.remove("locked"),r.hidden=!0,w=null}function qe(){let U=d.value.trim();if(!w)return;if(!U&&!w.selection){d.focus(),d.classList.add("shake"),setTimeout(()=>d.classList.remove("shake"),400);return}let oe={kind:"annotation",target:w.targetId,component:w.component,path:w.path.map(Ie=>Ie.id),note:U};w.selection&&(oe.selection=w.selection),w.excerpt&&!w.selection&&(oe.excerpt=w.excerpt),w.detail&&w.targetId===w.path[w.path.length-1].id&&(oe.detail=w.detail),e({type:"annotate",item:oe});let ue=w.targetId,fe=oe.detail?z:null;$(),window.getSelection()?.removeAllRanges(),fe?.isConnected?Pt(fe,"queued"):ta([ue],"queued")}s.addEventListener("click",U=>{let oe=U.target instanceof Element?U.target.closest("[data-act]")?.getAttribute("data-act"):void 0;oe==="cancel"&&$(),oe==="queue"&&qe(),oe==="history"&&w&&e({type:"history",id:w.targetId})}),d.addEventListener("keydown",U=>{U.key==="Enter"&&!U.shiftKey&&!U.isComposing?(U.preventDefault(),qe()):U.key==="Escape"&&(U.preventDefault(),d.value.trim()||$())});let Te=null,ze=[],Oe=[],Ve=new Map;function Pe(U){for(let oe of document.querySelectorAll(`[data-oui-id="${CSS.escape(U.target)}"]`)){let ue=VOt(oe,U.piece);if(ue)for(let fe of[oe,...oe.querySelectorAll(fY)]){let Ie=xb(fe);if(ue.contains(fe)&&Ie?.block===fe&&Ie.target===oe&&yb(fe.textContent)===U.edit?.old)return fe}}return null}function ne(){if(!Te){for(let U of ze.reverse())U.node.parentNode===U.el&&U.el.replaceChildren(...U.original);ze=[],Ve.clear();for(let U of Oe){let oe=U.edit&&Pe(U);!U.edit||!oe||(ze.push({id:U.id,el:oe,..._qa(oe,U.edit.new)}),Ve.set(U.id,oe))}}}function ee(){if(Te)return!1;let U=new Map;for(let oe of ze)U.set(oe.el,oe);return[...U.values()].some(oe=>!oe.el.isConnected||oe.node.parentNode!==oe.el)}function le(U,oe){Je(),r.hidden=!0,document.documentElement.classList.remove("austere-can-edit");let ue=pY(oe),fe=DS(oe,U),Ie=yb(U.textContent);Te={el:U,original:Array.from(U.childNodes),old:Ie,item:{kind:"edit",target:ue.id,component:ue.component,path:FOt(oe).map(Ft=>Ft.id),...fe?{detail:fe}:{}}},U.replaceChildren(document.createTextNode(Ie));try{U.contentEditable="plaintext-only"}catch{U.contentEditable="true"}U.focus();let Qe=window.getSelection();Qe?.selectAllChildren(U),Qe?.collapseToEnd()}function ye(U){let oe=Te;if(!oe)return;Te=null;let ue=yb(oe.el.textContent);oe.el.removeAttribute("contenteditable"),document.activeElement===oe.el&&oe.el.blur();let fe=U&&(ue.length>BOt||oe.old.length>BOt||Cqa(oe.el,oe.old));if(U&&ue&&ue!==oe.old&&!fe){let Ie=document.createTextNode(ue);oe.el.replaceChildren(Ie),ze.push({id:"",el:oe.el,original:oe.original,node:Ie}),e({type:"edit",item:{...oe.item,old:oe.old,new:ue}});return}oe.el.replaceChildren(...oe.original),U&&(!ue||fe)&&Pt(oe.el,"refused"),ne()}function Ae(U){let oe=U.target;if(a!=="edit"||!(oe instanceof Element)||I(oe))return;if(Te?.el.contains(oe)){U.preventDefault(),U.stopPropagation();return}if(V())return;let ue=xb(oe);ue&&(U.preventDefault(),U.stopPropagation(),le(ue.block,ue.target))}document.addEventListener("click",Ae,!0),document.addEventListener("focusout",U=>{Te&&U.target===Te.el&&ye(!0)}),document.addEventListener("keydown",U=>{!Te||U.isComposing||!(U.target instanceof Node)||!Te.el.contains(U.target)||(U.key==="Enter"||U.key==="Escape"?(U.preventDefault(),U.stopPropagation(),ye(U.key==="Enter")):U.key===" "&&Te.el.tagName==="BUTTON"&&(U.preventDefault(),document.execCommand("insertText",!1," ")))},!0),document.addEventListener("paste",U=>{if(!Te||!(U.target instanceof Node)||!Te.el.contains(U.target))return;U.preventDefault();let oe=U.clipboardData?.getData("text/plain")??"";document.execCommand("insertText",!1,oe.replace(/\s*[\r\n]+\s*/g," "))},!0),document.addEventListener("mousemove",H,{passive:!0}),document.addEventListener("click",W,!0),document.addEventListener("mouseup",ae),document.addEventListener("keyup",U=>{(U.shiftKey||U.key.startsWith("Arrow"))&&ae()}),document.addEventListener("selectionchange",()=>{"ontouchstart"in window&&ae()}),document.addEventListener("keydown",U=>{(U.metaKey||U.ctrlKey)&&(U.key==="i"||U.key==="I")?(U.preventDefault(),e({type:"toggle-mode"})):g&&(U.metaKey||U.ctrlKey)&&!U.altKey&&(U.key==="k"||U.key==="K")?(U.preventDefault(),e({type:"quick-switch"})):g&&(U.metaKey||U.ctrlKey)&&!U.altKey&&(U.key==="b"||U.key==="B")&&(U.preventDefault(),e({type:"toggle-sidebar"}))}),window.addEventListener("scroll",()=>{if(!s.hidden)return Ke();Je(),r.hidden=!0,i.hidden=!0,yo()},{passive:!0}),document.addEventListener("mouseleave",()=>{s.hidden&&(r.hidden=!0)});function Me(U,oe,ue,fe=new Set){if(fe.has(U))return[];fe.add(U);let Ie=document.querySelectorAll(`[data-oui-id="${CSS.escape(U)}"]`);return Ie.length?Array.from(Ie):!oe||!ue?[]:ue(oe,U).flatMap(Qe=>Me(Qe,oe,ue,fe))}function ut(U,oe,ue){let fe=new Set;for(let Ie of U)for(let Qe of Me(Ie,oe,ue))fe.add(Qe);return Array.from(fe).filter(Ie=>!Array.from(fe).some(Qe=>Qe!==Ie&&Qe.contains(Ie)))}function st(U,oe){let ue=document.createElement("div");return ue.setAttribute(Kh,""),ue.className=oe,ue.style.left=`${U.left+window.scrollX-4}px`,ue.style.top=`${U.top+window.scrollY-4}px`,ue.style.width=`${U.width+8}px`,ue.style.height=`${U.height+8}px`,ue}function We(U){if(getComputedStyle(U).display!=="contents")return dY(U);let[oe,ue,fe,Ie]=[1/0,1/0,-1/0,-1/0],Qe=Pa=>{!Pa.width&&!Pa.height||([oe,ue,fe,Ie]=[Math.min(oe,Pa.left),Math.min(ue,Pa.top),Math.max(fe,Pa.right),Math.max(Ie,Pa.bottom)])},Ft=Pa=>{for(let ua of Pa.childNodes)if(ua instanceof Element)getComputedStyle(ua).display==="contents"?Ft(ua):Qe(dY(ua));else if(ua.nodeType===Node.TEXT_NODE&&ua.textContent?.trim()){let bn=document.createRange();bn.selectNodeContents(ua),Qe(bn.getBoundingClientRect())}};return Ft(U),{left:oe,top:ue,right:fe,bottom:Ie}}function jt(U){for(let oe=U.closest("[hidden='until-found']");oe?.parentElement;oe=U.closest("[hidden='until-found']"))U=oe.parentElement;return U}function gt(U){let oe=jt(U),{left:ue,top:fe,right:Ie,bottom:Qe}=We(oe),Ft=Ie===ue,Pa=Qe===fe;if(Ft&&Pa)return null;for(let Ga=oe.parentElement;Ga&&Ga!==document.body;Ga=Ga.parentElement){let vi=getComputedStyle(Ga),is=vi.overflowX!=="visible",i0=vi.overflowY!=="visible";if(!is&&!i0||vi.display==="contents")continue;let Us=Ga.getBoundingClientRect();is&&([ue,Ie]=[Math.max(ue,Us.left),Math.min(Ie,Us.right)]),i0&&([fe,Qe]=[Math.max(fe,Us.top),Math.min(Qe,Us.bottom)])}let ua=Ft?Ie>=ue:Ie>ue,bn=Pa?Qe>=fe:Qe>fe;return ua&&bn?{left:ue,top:fe,width:Ie-ue,height:Qe-fe}:null}function Pt(U,oe){let ue=gt(U);if(!ue)return;let fe=st(ue,`austere-flash ${oe}`);document.body.appendChild(fe),setTimeout(()=>fe.remove(),2400)}function ta(U,oe="changed",ue,fe){let Ie=ut(U,ue,fe);for(let Qe of Ie)Pt(Qe,oe);return Ie}function aa(U,oe,ue){let fe=Me(U,oe,ue);if(!fe.length)return!1;for(let Ft=fe[0].closest("[hidden='until-found']");Ft;Ft=fe[0].closest("[hidden='until-found']"))Ft.removeAttribute("hidden"),Ft.dispatchEvent(new Event("beforematch"));let Ie=uY(fe[0]),Qe=Ie.top+window.scrollY-Math.max(24,(window.innerHeight-Ie.height)/3);return window.scrollTo({top:Math.max(0,Qe),behavior:"smooth"}),setTimeout(()=>ta([U],"changed",oe,ue),350),!0}let ya=document.createElement("div");ya.setAttribute(Kh,""),o.appendChild(ya);let Kt=null,oa=0,re=document.createElement("div");re.setAttribute(Kh,""),o.appendChild(re);let pe=[],_e=[],he=null,pt=0,ot="",Bt=0,ra=()=>a!=="pointer"&&pe.some(U=>U.status!=="done"&&U.status!=="discarded");function yo(){Bt||!ra()||(Bt=requestAnimationFrame(()=>{Bt=0,ra()&&Ee()}))}let to=document.createElement("div");to.setAttribute(Kh,""),o.appendChild(to);let xo=[];function $a(){let[U,oe]=Kt&&t?t():[],ue=[],fe=[];for(let Ie of Kt?ut(Kt,U,oe):[]){let Qe=gt(Ie);Qe&&(ue.push(Ie),fe.push(Qe))}return ya.replaceChildren(...fe.map(Ie=>st(Ie,"austere-mark"))),ue}function Be(){if(!(r.hidden||!N)){if(!N.isConnected){let U=N.getAttribute("data-oui-id");N=document.querySelector(`[data-oui-id="${CSS.escape(U)}"]`)}N&&z&&!z.isConnected&&(z=D?.(N)??z),N?R(N,z):r.hidden=!0}}function Ke(){oa||!Kt&&r.hidden&&!xo.length&&!ra()&&!ze.length||(oa=requestAnimationFrame(()=>{oa=0,ee()&&ne(),Kt&&$a(),xo.length&&kb(),ra()&&Ee(),Be()}))}window.addEventListener("resize",Ke,{passive:!0}),new ResizeObserver(Ke).observe(document.body),new MutationObserver(U=>{U.some(oe=>!I(oe.target.nodeType===1?oe.target:oe.target.parentElement))&&Ke()}).observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open","x","y","width","height","d","transform","viewBox"]}),document.addEventListener("scroll",U=>{U.target!==document&&Ke()},{capture:!0,passive:!0});function Ee(){cancelAnimationFrame(Bt),Bt=0;let U=new Map,oe=new Map;if(a!=="pointer")for(let fe of pe){if(fe.status==="done"||fe.status==="discarded")continue;if(fe.edit){let Qe=Ve.get(fe.id);Qe?.isConnected&&U.set(Qe,[...U.get(Qe)??[],fe]);continue}let Ie=oe.get(fe.target);Ie||(Ie=document.querySelectorAll(`[data-oui-id="${CSS.escape(fe.target)}"]`),oe.set(fe.target,Ie));for(let Qe of Ie){let Ft=VOt(Qe,fe.piece);Ft&&U.set(Ft,[...U.get(Ft)??[],fe])}}_e=[];for(let[fe,Ie]of U){let Qe=gt(fe);Qe&&_e.push({el:fe,box:Qe,notes:Ie})}re.replaceChildren(..._e.map(fe=>st(fe.box,"austere-note-outline")));let ue=_e.find(fe=>fe.el===he);ue?Ar(ue):Je()}function Je(){clearTimeout(pt),pt=0,he=null,!f.hidden&&(f.hidden=!0,Be())}function Ar(U){he=U.el;let oe=JSON.stringify(U.notes);(oe!==ot||f.hidden)&&f.replaceChildren(...U.notes.map((Ga,vi)=>{let is=document.createElement("section");is.className="austere-callout-note",is.dataset.noteId=Ga.id;let i0=[],Us=(Rd,Ed,s0)=>{let wb=document.createElement(Rd);return wb.className=Ed,wb.textContent=s0,i0.push(wb),wb};if(Ga.edit)Us("del","austere-callout-old",rs(Ga.edit.old,300)),Us("div","austere-callout-new",rs(Ga.edit.new,300));else{let Rd=rs(Ga.quote,160),Ed=U.notes[vi-1];Rd&&(!Ed||Ed.edit||rs(Ed.quote,160)!==Rd)&&Us("blockquote","austere-callout-quote",Rd)}Ga.note&&Us("div","austere-callout-text",Ga.note),Us("div","austere-callout-meta",[Ga.author,Nqa[Ga.status]].filter(Boolean).join(" \xB7 "));let HS=document.createElement("div");HS.className="austere-callout-actions";let dPt=[...Ga.queued?[["edit","Edit"],["delete","Delete"]]:[],["show","Show in notes"]];for(let[Rd,Ed]of dPt){let s0=document.createElement("button");s0.type="button",s0.dataset.act=Rd,s0.textContent=Ed,HS.appendChild(s0)}return i0.push(HS),is.append(...i0),is})),ot=oe,f.hidden=!1;let ue=f.offsetWidth,fe=f.offsetHeight,{left:Ie,top:Qe,width:Ft,height:Pa}=U.box,ua=Qe+Pa+4,bn=Ie-4+ue<=window.innerWidth-8?Ie-4:Ie+Ft+4-ue;f.style.left=`${Math.max(8,bn)}px`,f.style.top=`${ua+fe>window.innerHeight-8&&Qe-4-fe>=8?Qe-4-fe:ua}px`,Be()}function Gt(U){let oe=_e.filter(ue=>ue.el.contains(U));return oe.find(ue=>!oe.some(fe=>fe!==ue&&ue.el.contains(fe.el)))??null}function FS(U){if(a==="pointer"||Te||!_e.length||!(U.target instanceof Element))return;if(f.contains(U.target)){clearTimeout(pt),pt=0;return}if(!s.hidden||I(U.target))return;let oe=Gt(U.target);oe?(clearTimeout(pt),pt=0,(he!==oe.el||f.hidden)&&Ar(oe)):!f.hidden&&!pt&&(pt=window.setTimeout(Je,250))}document.addEventListener("mousemove",FS,{passive:!0}),f.addEventListener("click",U=>{let oe=U.target instanceof Element?U.target.closest("button[data-act]"):null,ue=oe?.closest("[data-note-id]")?.dataset.noteId;!oe||!ue||(e({type:"note-action",action:oe.getAttribute("data-act"),id:ue}),Je())});function qS(U,oe=!1){Kt=U.length?U:null;let ue=$a();if(oe&&ue.length){let fe=ue.map(Ie=>uY(jt(Ie)));if(!fe.some(Ie=>Ie.bottom>0&&Ie.top<window.innerHeight)){let Ie=fe[0],Qe=Ie.top+window.scrollY-Math.max(24,(window.innerHeight-Ie.height)/3);window.scrollTo({top:Math.max(0,Qe),behavior:"smooth"})}}return ue.length}function kb(){let[U,oe]=xo.length&&t?t():[],ue=new Map;for(let Ie of xo)ue.set(Ie.statement,[...ue.get(Ie.statement)??[],Ie]);let fe=[];for(let[Ie,Qe]of ue){let Ft=!1;for(let Pa of ut([Ie],U,oe)){let ua=gt(Pa);if(!ua)continue;let bn=st(ua,"austere-focus");if(bn.style.setProperty("--austere-viewer",Qe[0].colour),!Ft){Ft=!0;let Ga=document.createElement("div");Ga.className="austere-focus-names";for(let vi of Qe){let is=document.createElement("span");is.textContent=vi.name,is.style.background=vi.colour,Ga.appendChild(is)}bn.appendChild(Ga)}fe.push(bn)}}to.replaceChildren(...fe)}function Yh(U){xo=U,kb()}return{setQuickSwitch(U){g=U},setHistory(U){m=U,w&&b()},setMode(U,oe=!1){ye(!0),oe&&d.value.trim()&&qe(),a=U==="annotate"||U==="edit"?U:"pointer";let ue=document.documentElement.classList;ue.toggle("austere-annotating",a==="annotate"),ue.toggle("austere-editing",a==="edit"),ue.remove("austere-can-edit"),r.classList.toggle("edit",a==="edit"),a!=="annotate"&&($(),i.hidden=!0,r.hidden=!0),Ee()},setNotes(U){pe=U,Oe=U.filter(oe=>oe.edit),ne(),Ee()},clearEdits(){ye(!1),Oe=[],ne(),Ee()},flash:ta,reveal:aa,highlight:qS,focus:Yh}}var OS={diagrams:{name:"@austere-axi/pack-diagrams",version:"0.33.1",components:["Sequence","Actor","Message","Branch","Nested","NestedLevel","LayerStack","Layer","Kanban","KanbanCard","StoryMap","Story","UserJourney","JourneyStep","ServiceBlueprint","BlueprintStep","EventModel","EventItem","Heatmap","HeatRow","PermissionMatrix","AccessRow","UnitGrid","UnitShare","Traceability","TraceReq","TraceItem","Gantt","GanttTask","GitGraph","GitCommit","ScheduleNetwork","ScheduleTask","Quadrant","QuadrantItem","Venn","VennSet","VennOverlap","Pyramid","PyramidLayer","Loop","LoopStep","LoopHub","Fishbone","FishCause","WardleyMap","WardleyPart","Radar","RadarSeries","PolarChart","Waterfall","Treemap","Sankey"]},shadcn:{name:"@austere-axi/pack-shadcn",version:"0.33.1",components:["Progress","Avatar","AvatarGroup","Tooltip","HoverCard","Breadcrumb","BreadcrumbItem","Kbd","Skeleton","Calendar","Timeline","TimelineItem"]}};function Dqa(e){let t=e.lastIndexOf("@");return t<=0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}var Oqa=/^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,Pqa=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;function GOt(e){let t=[];for(let a of String(e||"").split(",")){let[o,r]=a.trim().split(/\s+/);if(!o)continue;let{name:n,version:i}=Dqa(o);!Oqa.test(n)||!Pqa.test(i)||t.some(s=>s.name===n)||t.push(r&&/^sha(256|384|512)-[A-Za-z0-9+/=]+$/.test(r)?{name:n,version:i,integrity:r}:{name:n,version:i})}return t}var WOt="https://cdn.jsdelivr.net/npm";function ZOt(e=document){let t=e.querySelector('meta[name="austere-packs"]');return t?GOt(t.getAttribute("content")||""):[]}function KOt(e,t){let a=[...t];for(let[o,r]of Object.entries(OS))a.some(n=>n.name===r.name)||r.components.some(n=>new RegExp(`\\b${n}\\s*\\(`).test(e))&&a.push({name:r.name,version:r.version,bundled:o});return a}var hY=new Set(Object.values(OS).map(e=>e.name)),Bqa=new Set(Object.values(OS).filter(e=>e.name==="@austere-axi/pack-diagrams").flatMap(e=>e.components));function XOt(e){return[...e].sort((t,a)=>Number(hY.has(a.name))-Number(hY.has(t.name)))}function YOt(e,t){return!hY.has(e)&&Bqa.has(t)}function gY(){return/\/__austere\/$/.test(yg)}function Fqa(e){if(e.bundled)return{src:H5(`packs/${e.bundled}/pack.js`)||`${WOt}/austere-axi@${e.version}/dist/packs/${e.bundled}/pack.js`};if(gY()){let t=e.integrity?`?integrity=${encodeURIComponent(e.integrity)}`:"";return{src:`${yg}installed-packs/${encodeURIComponent(`${e.name}@${e.version}`)}/pack.js${t}`}}return{src:`${WOt}/${e.name}@${e.version}/dist/pack.js`,integrity:e.integrity}}function qqa(e,t){return new Promise((a,o)=>{let r=document.createElement("script");r.src=e,r.async=!0,t&&(r.integrity=t,r.crossOrigin="anonymous"),r.onload=()=>a(),r.onerror=()=>o(new Error(`could not load ${e}`)),document.head.appendChild(r)})}async function QOt(e,{onError:t}={}){let a=e.filter(o=>!Vl().some(r=>r.name===o.name));return await Promise.all(a.map(o=>{let{src:r,integrity:n}=Fqa(o);return qqa(r,n).then(()=>{Vl().some(i=>i.name===o.name)||t?.(o,new Error(`${r} loaded but did not register pack ${o.name}`))},i=>t?.(o,i))})),Vl()}function JOt(e){for(let t of e){if(!t.css)continue;let a=`austere-pack-css-${t.name.replace(/[^a-z0-9]/gi,"-")}`;if(document.getElementById(a))continue;let o=document.createElement("style");o.id=a,o.textContent=t.css,document.head.appendChild(o)}}var Hqa=/[A-Za-z_$]/;function jqa(e){let t=[],a=String(e??""),o=0,r=1,n=a.length;for(;o<n;){let i=a[o];if(i===`
|
|
2825
2825
|
`){r++,o++;continue}if(i===" "||i===" "||i==="\r"){o++;continue}if(i==="#"||i==="/"&&a[o+1]==="/"){for(;o<n&&a[o]!==`
|
|
2826
2826
|
`;)o++;continue}let s=o,l=r,u=0,d=null,p=!1;for(;o<n;){let g=a[o];if(d){p?p=!1:g==="\\"?p=!0:g===d&&(d=null),g===`
|
|
2827
2827
|
`&&r++,o++;continue}if(g==='"'||g==="'"){d=g,o++;continue}if(g==="#"||g==="/"&&a[o+1]==="/"){for(;o<n&&a[o]!==`
|
|
2828
2828
|
`;)o++;continue}if(g==="("||g==="["||g==="{")u++;else if(g===")"||g==="]"||g==="}")u=Math.max(0,u-1);else if(g===`
|
|
2829
2829
|
`){if(u===0&&!Vqa(a,o+1))break;r++}o++}let f=a.slice(s,o).replace(/\s+$/,""),m=/^\s*([A-Za-z_$][\w$]*)\s*=/.exec(f);m&&Hqa.test(m[1][0])&&t.push({id:m[1],text:f,line:l,endLine:r})}return t}function Vqa(e,t){let a=t;for(;a<e.length&&(e[a]===" "||e[a]===" ");)a++;return e[a]==="?"||e[a]===":"}function Xh(e){let t=new Map;for(let a of jqa(e))t.set(a.id,a);return t}function tPt(e,t){let a=Xh(e),o=Xh(t),r=[];for(let[n,i]of o){let s=a.get(n);(!s||ePt(s.text)!==ePt(i.text))&&r.push(n)}return r}function PS(e,t){let a=new RegExp(`(^|[^\\w$])${$qa(t)}(?![\\w$])`),o=[];for(let[r,n]of e){if(r===t)continue;let i=n.text.slice(n.text.indexOf("=")+1);a.test(Uqa(i))&&o.push(r)}return o}function Uqa(e){return e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/gs,'""')}function ePt(e){return e.replace(/\s+/g," ").trim()}function $qa(e){return e.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function aPt(e){if(!/["]/.test(e)||!/["][^"\\]*[\n\t\r]/.test(e))return e;let t="",a=null;for(let o=0;o<e.length;o++){let r=e[o];if(a==='"')r==="\\"?(t+=r+(e[o+1]??""),o++):r===`
|
|
2830
2830
|
`?t+="\\n":r==="\r"?t+="\\r":r===" "?t+="\\t":(t+=r,r==='"'&&(a=null));else if(a==="'")t+=r,r==="\\"?(t+=e[o+1]??"",o++):r==="'"&&(a=null);else if(r==='"'||r==="'")a=r,t+=r;else if(r==="#"||r==="/"&&e[o+1]==="/"){let n=o;for(;n<e.length&&e[n]!==`
|
|
2831
|
-
`;)n++;t+=e.slice(o,n),o=n-1}else t+=r}return t}var bb=X(Ue(),1),xY="0.33.
|
|
2831
|
+
`;)n++;t+=e.slice(o,n),o=n-1}else t+=r}return t}var bb=X(Ue(),1),xY="0.33.1",Gqa='script[type="text/openui"], script[type="text/openui-lang"]';function Wqa(){if(document.getElementById("austere-styles"))return;let e=document.createElement("style");if(e.id="austere-styles",e.textContent=[yie,fie,mie,hie,gie].join(`
|
|
2832
2832
|
`),document.head.appendChild(e),!document.querySelector('meta[name="viewport"]')){let t=document.createElement("meta");t.name="viewport",t.content="width=device-width, initial-scale=1",document.head.appendChild(t)}document.documentElement.classList.add("austere"),sY(NOt())}function sPt(e){if(!e||typeof e!="object")return;let t={},a=Object.entries(e);for(let[o,r]of a)if(!o.startsWith("$"))if(r&&typeof r=="object"&&!Array.isArray(r))if("value"in r&&Object.keys(r).length<=3)t[o]=r.value;else{let n=sPt(r);n&&Object.keys(n).length&&(t[o]=n)}else t[o]=r;return Object.keys(t).length?t:void 0}function Zqa(e){return!!e&&typeof e=="object"&&"austere"in e&&e.austere===1&&"type"in e&&typeof e.type=="string"}function Kqa(){let e=window.parent&&window.parent!==window,t=new Map,a=o=>{e&&window.parent.postMessage({austere:1,...o},"*")};return window.addEventListener("message",o=>{if(o.source!==window.parent)return;let r=o.data;Zqa(r)&&t.get(r.type)?.forEach(n=>n(r))}),{framed:e,connected:!1,readOnly:!1,send:a,on(o,r){let n=r,i=t.get(o)??new Set;return t.set(o,i),i.add(n),()=>{i.delete(n)}}}}function lPt(e,t){e.framed?e.send({type:"open-url",url:t}):window.open(t,"_blank","noopener")}function BS(e){let t=document.createElement("div");t.className="austere-toast",t.setAttribute("data-austere-ui",""),t.textContent=e,document.body.appendChild(t),setTimeout(()=>t.classList.add("out"),2600),setTimeout(()=>t.remove(),3100)}function Xqa(e){let t=[e.message];return e.form&&t.push(`form: ${JSON.stringify(e.form)}`),e.context!==void 0&&t.push(`context: ${JSON.stringify(e.context)}`),t.join(`
|
|
2833
2833
|
`)}var yY=null,cPt=new Set,vb=gb,oPt="";function Yqa(e,t){cPt.add(e.name);let a=!e.bundled&&gY()?" (`austere-axi check <file>` says why)":"";Ci({source:"pack",component:e.name,message:`pack ${e.name}@${e.version}: ${t.message}${a}`})}function Qqa(){let e=XOt(Vl()),t=e.map(a=>`${a.name}@${a.version}`).join(",");if(t===oPt)return vb;oPt=t,JOt(e);try{vb=e.length?cY(e.flatMap(a=>a.components),{onSkip:(a,o)=>{let r=e.find(n=>n.components.includes(a));r&&YOt(r.name,a.name)||Ci({source:"pack",component:a.name,message:o})}}):gb}catch(a){Ci({source:"pack",message:`packs could not be added (${a.message}); rendering without them`}),vb=gb}return window.__austere.library=vb,vb}async function uPt(e){yY||(yY=ZOt());let t=KOt(e,yY).filter(a=>!cPt.has(a.name));return t.some(a=>!Vl().some(o=>o.name===a.name))&&await QOt(t,{onError:Yqa}),Qqa()}function Jqa({programRef:e,initialLibrary:t,bridge:a,annotator:o,initialState:r}){let[n,i]=(0,ns.useState)({program:e.current,library:t}),s=hb(),l=n.program,u=(0,ns.useRef)(null);(0,ns.useEffect)(()=>a.on("source",async({program:m})=>{if(typeof m!="string"||m===e.current)return;let g=tPt(e.current,m);e.current=m,o?.highlight([]),o?.clearEdits();let b=await uPt(m);e.current===m&&(u.current=g,i({program:m,library:b}))}),[a]),(0,ns.useEffect)(()=>a.on("reveal",({id:m})=>{o?.reveal(m,Xh(e.current),PS)}),[a,o]),(0,ns.useEffect)(()=>{let m=u.current;if(!m)return;u.current=null;let g=setTimeout(()=>{let b=Xh(e.current),w=m.filter(v=>v!=="root");o?.flash(w,"changed",b,PS),a.send({type:"changes",ids:w})},120);return()=>clearTimeout(g)},[l,o,a]);let d=(0,ns.useCallback)(m=>{if(m.type==="open_url"){let w=m.params?.url;typeof w=="string"&&/^(https?:|mailto:)/i.test(w)&&lPt(a,w);return}if(m.type!=="continue_conversation")return;let g={kind:"action",message:m.humanFriendlyMessage||"(button)"},b=sPt(m.formState);if(b&&(g.form=b),m.params?.context!==void 0&&(g.context=m.params.context),a.readOnly)BS("Nothing was sent: this page is read-only for you");else if(a.connected)a.send({type:"action",item:g}),BS("Queued for the agent \u2014 press Send when ready");else{let w=Xqa(g);navigator.clipboard?.writeText(w).then(()=>BS("Copied \u2014 paste it to your agent"),()=>BS(w))}},[a]),p=(0,ns.useCallback)(m=>{a.send({type:"errors",errors:(m||[]).map(g=>({source:g.source,code:g.code,statementId:g.statementId,message:g.message,hint:g.hint}))})},[a]),f=(0,ns.useCallback)(m=>a.send({type:"state",state:m}),[a]);return(0,bb.jsx)(pie,{mode:s,children:(0,bb.jsx)("main",{className:"austere-page",children:(0,bb.jsx)(hg,{response:aPt(l),library:n.library,isStreaming:!1,onAction:d,onError:p,onStateUpdate:f,initialState:r})})})}function rPt(){Wqa();let t=document.querySelector(Gqa)?.textContent??"",a=document.createElement("div");a.id="austere-root",document.body.appendChild(a);let o=Kqa(),r={current:t},n=null,i=null,s=uPt(t),l=m=>i||(i=s.then(g=>{let b=(0,iPt.createRoot)(a);(0,nPt.flushSync)(()=>b.render((0,bb.jsx)(Jqa,{programRef:r,initialLibrary:g,bridge:o,annotator:n,initialState:m})))}));if(!o.framed){l(void 0);return}o.on("theme",({theme:m})=>{(m==="dark"||m==="light")&&sY(m)});let u={program:null,map:new Map},p=$Ot({post:m=>o.send(m),lookup:()=>(u.program!==r.current&&(u={program:r.current,map:Xh(r.current)}),[u.map,PS])});n=p,o.on("highlight",({ids:m,scroll:g})=>{p.highlight(Array.isArray(m)?m.filter(b=>typeof b=="string"):[],!!g)}),o.on("history-counts",({counts:m})=>{let g={};if(m&&typeof m=="object")for(let[b,w]of Object.entries(m).slice(0,2e3))typeof w=="number"&&Number.isInteger(w)&&w>0&&(g[b]=w);p.setHistory(g)});let f=["queued","sending","held","sent","seen","working","done","discarded"];o.on("notes",({notes:m})=>{let g=(S,I)=>typeof S=="string"?S.slice(0,I):void 0,b=[],w=[];for(let S of Array.isArray(m)?m:[]){let I=S,C=g(I?.id,300),M=g(I?.target,200);if(!I||!C||!M||typeof I.status!="string"||!f.includes(I.status)||I.status==="done"||I.status==="discarded")continue;let N=I.piece,z={};if(N&&typeof N=="object"){let[P,B,H]=[g(N.part,200),g(N.row,200),g(N.column,200)];P!==void 0&&(z.part=P),B!==void 0&&(z.row=B),H!==void 0&&(z.column=H),typeof N.rowIndex=="number"&&Number.isInteger(N.rowIndex)&&N.rowIndex>0&&(z.rowIndex=N.rowIndex)}let D=I.edit,R=D&&typeof D.old=="string"&&typeof D.new=="string"&&D.old.length<=2e4&&D.new.length<=2e4?{old:D.old,new:D.new}:void 0,O={id:C,target:M,...Object.keys(z).length?{piece:z}:{},quote:g(I.quote,600),note:g(I.note,2e3)??"",author:g(I.author,100),status:I.status,queued:I.queued===!0,...R?{edit:R}:{}};(O.queued?w:b).push(O)}let v=w.slice(-500),k=b.slice(-Math.max(0,500-v.length));p.setNotes([...k,...v])}),o.on("presence",({marks:m})=>{let g=b=>{let w=b;return!!w&&typeof w.statement=="string"&&typeof w.name=="string"&&typeof w.colour=="string"&&/^#[0-9a-f]{6}$/i.test(w.colour)};p.focus(Array.isArray(m)?m.filter(g).slice(0,50):[])}),document.addEventListener("click",m=>{if(m.defaultPrevented||m.button!==0)return;let g=m.target instanceof Element?m.target.closest("a[href]"):null;if(!(g instanceof HTMLAnchorElement)||!/^(https?|mailto):/i.test(g.href)||g.protocol===location.protocol&&g.host===location.host)return;let b=(g.getAttribute("target")||"").toLowerCase();!b||b==="_self"||(m.preventDefault(),lPt(o,g.href))}),Hee(m=>o.send({type:"runtime-error",error:m})),o.on("init",async m=>{if(o.connected=!0,o.readOnly=m.readOnly===!0,p.setMode(m.mode),p.setQuickSwitch(m.quickSwitch===!0),await l(m.state||void 0),m.scrollY>0){let g=0,b=()=>{window.scrollTo(0,m.scrollY),Math.abs(window.scrollY-m.scrollY)>2&&++g<20&&setTimeout(b,50)};setTimeout(b,30)}o.send({type:"ready",title:document.title,version:xY})}),o.on("mode",m=>{o.readOnly=m.readOnly===!0,p.setMode(m.mode,o.readOnly)}),window.addEventListener("scroll",()=>o.send({type:"scroll",y:window.scrollY}),{passive:!0}),o.send({type:"hello",title:document.title,version:xY}),setTimeout(()=>l(void 0),600)}window.__austere={version:xY,library:gb,packs:Vl};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",rPt,{once:!0}):setTimeout(rPt,0);})();
|
|
2834
2834
|
}
|