@snagset/server 0.1.10 → 0.1.11

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.
Files changed (94) hide show
  1. package/dist/app.js +5 -0
  2. package/dist/app.js.map +1 -1
  3. package/dist/config.generated.js +2 -1
  4. package/dist/config.generated.js.map +1 -1
  5. package/dist/db/migrations/0008_outbox_org_rows.sql +29 -0
  6. package/dist/jobs/set.js +15 -4
  7. package/dist/jobs/set.js.map +1 -1
  8. package/dist/mail/digest.js +291 -0
  9. package/dist/mail/digest.js.map +1 -0
  10. package/dist/mail/links.js +41 -0
  11. package/dist/mail/links.js.map +1 -0
  12. package/dist/mail/notify.js +126 -25
  13. package/dist/mail/notify.js.map +1 -1
  14. package/dist/net/publicFetch.js +202 -0
  15. package/dist/net/publicFetch.js.map +1 -0
  16. package/dist/routes/commentEdit.js +20 -5
  17. package/dist/routes/commentEdit.js.map +1 -1
  18. package/dist/routes/imageProxy.js +77 -0
  19. package/dist/routes/imageProxy.js.map +1 -0
  20. package/dist/routes/threads.js +182 -42
  21. package/dist/routes/threads.js.map +1 -1
  22. package/package.json +3 -3
  23. package/static/dashboard/assets/CompositeItem-Bg_GF93m.js +1 -0
  24. package/static/dashboard/assets/{ConfirmDialog-eCzw7vjK.js → ConfirmDialog-WnZ92dk2.js} +1 -1
  25. package/static/dashboard/assets/{CopyButton-lcjux1TA.js → CopyButton-rL26RLOJ.js} +1 -1
  26. package/static/dashboard/assets/{FieldItemContext-i5zdyQYl.js → FieldItemContext-BFJSEdB-.js} +1 -1
  27. package/static/dashboard/assets/{InstallTag-Eqs3RM9e.js → InstallTag-BKIArjPk.js} +1 -1
  28. package/static/dashboard/assets/{SaveState-Cf_bnJmg.js → SaveState-DVHi0zeB.js} +1 -1
  29. package/static/dashboard/assets/{_app-CuKLSKZ2.js → _app-D2r-zfbF.js} +1 -1
  30. package/static/dashboard/assets/_app-iK-weT5A.js +56 -0
  31. package/static/dashboard/assets/activity-CCqTW3Th.js +1 -0
  32. package/static/dashboard/assets/{arrow-left-CQUHEFUP.js → arrow-left-BEHXEKLy.js} +1 -1
  33. package/static/dashboard/assets/{avatar-CWT37Ivf.js → avatar-BnPBt2UW.js} +1 -1
  34. package/static/dashboard/assets/{badge-thtKAJ0h.js → badge-B2rHdH8b.js} +1 -1
  35. package/static/dashboard/assets/{card-CsXE7vKD.js → card-BNGTf8dq.js} +1 -1
  36. package/static/dashboard/assets/{check-Bc_1fmPx.js → check-C3gaSIDM.js} +1 -1
  37. package/static/dashboard/assets/{chevron-right-neQQkaOt.js → chevron-right-CLLS6JcX.js} +1 -1
  38. package/static/dashboard/assets/{copy-O3USBatC.js → copy-Dy7nBeu2.js} +1 -1
  39. package/static/dashboard/assets/{dialog-MC-TOvQV.js → dialog-q6J2VL2H.js} +2 -2
  40. package/static/dashboard/assets/{dropdown-menu-C2ZhmONu.js → dropdown-menu-DFZrgFpI.js} +1 -1
  41. package/static/dashboard/assets/{image-off-Bu6l8gP5.js → image-off-Bug-3iC-.js} +1 -1
  42. package/static/dashboard/assets/index-ClhJtAFR.css +1 -0
  43. package/static/dashboard/assets/index-CtyJ8ep7.js +169 -0
  44. package/static/dashboard/assets/{label-BTdAT39L.js → label-DoQ07Q_y.js} +1 -1
  45. package/static/dashboard/assets/{layout-grid-rYWIGaIJ.js → layout-grid-B3BkFR60.js} +1 -1
  46. package/static/dashboard/assets/me-NFjosbdz.js +1 -0
  47. package/static/dashboard/assets/{parts-kPNZVO9H.js → parts-BTWw4Uv-.js} +1 -1
  48. package/static/dashboard/assets/{plus-CcJ1Zwa7.js → plus-DqdyxL8q.js} +1 -1
  49. package/static/dashboard/assets/s._site-kVvU6ucw.js +1 -0
  50. package/static/dashboard/assets/s._site.comments-kEGEpFR2.js +54 -0
  51. package/static/dashboard/assets/{s._site.reviewers-Djq2t6Dx.js → s._site.reviewers-C1LLoSS5.js} +1 -1
  52. package/static/dashboard/assets/s._site.settings-CeKMuuRo.js +1 -0
  53. package/static/dashboard/assets/{setup-D748SEIm.js → setup-CdZYVZmd.js} +1 -1
  54. package/static/dashboard/assets/{sign-in-CKSiZWCo.js → sign-in-CvstpETe.js} +1 -1
  55. package/static/dashboard/assets/{sign-up-BX9j_Ya2.js → sign-up-Cq7YvdYN.js} +1 -1
  56. package/static/dashboard/assets/sites-CUWMKMCM.js +1 -0
  57. package/static/dashboard/assets/{studio-HH_J6PPv.js → studio-BfA8kzFc.js} +1 -1
  58. package/static/dashboard/assets/studio-uAl1i7Nd.js +1 -0
  59. package/static/dashboard/assets/studio.index-BTF7YIX-.js +1 -0
  60. package/static/dashboard/assets/studio.integrations-Nr_jBcXh.js +1 -0
  61. package/static/dashboard/assets/{studio.members-DTbKcrEI.js → studio.members-BtbPt4iX.js} +1 -1
  62. package/static/dashboard/assets/{sun-CWPmS6_O.js → sun-s_t6Zx3r.js} +1 -1
  63. package/static/dashboard/assets/switch-DbqX1mWE.js +1 -0
  64. package/static/dashboard/assets/{table-CiZO2uuW.js → table-CrWNqpP8.js} +1 -1
  65. package/static/dashboard/assets/{useAriaLabelledBy-oZFqC809.js → useAriaLabelledBy-CgL3SaJd.js} +1 -1
  66. package/static/dashboard/assets/{useBaseQuery-CHgLQD-M.js → useBaseQuery-CBTINzcX.js} +1 -1
  67. package/static/dashboard/assets/useQuery-BPuxCfhJ.js +1 -0
  68. package/static/dashboard/assets/useRender-BCpbp3WG.js +1 -0
  69. package/static/dashboard/assets/{useValueChanged-Dvr7PvAV.js → useValueChanged-B20GM2vK.js} +1 -1
  70. package/static/dashboard/assets/{users-Ci-ogubz.js → users-CQwkq_Tk.js} +1 -1
  71. package/static/dashboard/assets/{welcome-BDWw5Qlv.js → welcome-W1YxYlGW.js} +1 -1
  72. package/static/dashboard/assets/{you-DAUNHAFI.js → you-DXZRdbGS.js} +1 -1
  73. package/static/dashboard/assets/{zod-CtjFmGX5.js → zod-DWEgoEmm.js} +1 -1
  74. package/static/dashboard/index.html +2 -2
  75. package/static/widget/snag.capture.js +1 -1
  76. package/static/widget/snag.dock.js +1 -1
  77. package/static/widget/snag.runtime.js +2 -2
  78. package/static/widget/snag.screenshot.js +1 -1
  79. package/static/dashboard/assets/CompositeItem-Db_8iHSG.js +0 -1
  80. package/static/dashboard/assets/_app-qNVG5lsX.js +0 -56
  81. package/static/dashboard/assets/activity-CQLBFIV4.js +0 -1
  82. package/static/dashboard/assets/index-BR4Mnw-o.css +0 -1
  83. package/static/dashboard/assets/index-C6gyyLd5.js +0 -169
  84. package/static/dashboard/assets/me-CI9giaT9.js +0 -1
  85. package/static/dashboard/assets/s._site-D0HRtia-.js +0 -1
  86. package/static/dashboard/assets/s._site.comments-D3ACsr3a.js +0 -39
  87. package/static/dashboard/assets/s._site.settings-D0b6vJci.js +0 -1
  88. package/static/dashboard/assets/sites-QwJy87Y8.js +0 -1
  89. package/static/dashboard/assets/studio-B_ma5JGA.js +0 -1
  90. package/static/dashboard/assets/studio.index-DrtJF7DT.js +0 -1
  91. package/static/dashboard/assets/studio.integrations-Cv34ukzT.js +0 -1
  92. package/static/dashboard/assets/switch-CzijGUed.js +0 -1
  93. package/static/dashboard/assets/useQuery-C6FyjMS-.js +0 -1
  94. package/static/dashboard/assets/useRender-D5jZ1wns.js +0 -1
@@ -1,2 +1,2 @@
1
- const be="Snagset",xo="snagset",pn="snagset.v1",So="Snagset",_t="Snag",Ao="Snags",ko={config:"SnagsetConfig"},$o={root:"data-snag-root"},Pt=e=>$o[e],Eo={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},Co=e=>Eo[e],z={font:"--snag-font",accent:"--snag-accent",onAccent:"--snag-onAccent",bg:"--snag-bg",fg:"--snag-fg",muted:"--snag-muted",border:"--snag-border",radius:"--snag-radius",shadow:"--snag-shadow",z:"--snag-z",motion:"--snag-motion",surface:"--snag-surface",sunken:"--snag-sunken",hover:"--snag-hover",focus:"--snag-focus",disabled:"--snag-disabled",statusOpen:"--snag-status-open",statusProgress:"--snag-status-progress",statusReview:"--snag-status-review",statusResolved:"--snag-status-resolved",anchorOrphan:"--snag-anchor-orphan",tbH:"--snag-tb-h",dockW:"--snag-dock-w",kb:"--snag-kb",thumbX:"--snag-thumb-x",thumbW:"--snag-thumb-w"},To=e=>`var(${z[e]})`,Ro=e=>"snag_"+e,mt={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},_o="snag:disclosure:v1",zt="snag:identity",hn="data-snag-theme",le={session:e=>`snag:session:${e}`,identity:zt,threads:(e,t)=>`snag:threads:${e}:${t}`,seen:(e,t)=>`snag:seen:${e}:${t}`,counts:e=>`snag:counts:${e}`,draft:(e,t)=>`snag:draft:${e}:${t}`,outbox:e=>`snag:outbox:${e}`,mode:"snag:mode",handoff:"snag:handoff",seenCoach:"snag:seen-coach",disclosure:_o},Re={panels:"snag.panels.js",crumbs:"snag.crumbs.js",capture:"snag.capture.js",screenshot:"snag.screenshot.js",anchorExt:"snag.anchor-ext.js",anchorFuzzy:"snag.anchor-fuzzy.js",dock:"snag.dock.js",text:"snag.text.js"},gt={thread:"thr_",comment:"cmt_",attachment:"att_"},It={attachmentKind:"x-snagset-attachment-kind",attachmentWidth:"x-snagset-attachment-width",attachmentHeight:"x-snagset-attachment-height"},Po={route:"snagset:route"},mn={original:"snagset.original",wrapped:"snagset.wrapped"},gn="position:absolute!important;top:0!important;left:0!important;width:0!important;height:0!important;margin:0!important;padding:0!important;border:0!important;pointer-events:none!important;z-index:2147483647;isolation:isolate;color-scheme:light dark;";function yn(e){const t=e.ownerDocument.defaultView?.getComputedStyle(e);return t?t.transform!=="none"&&t.transform!==""||t.filter!=="none"&&t.filter!==""||t.perspective!=="none"&&t.perspective!==""||/transform|filter|perspective|contain/.test(t.willChange)||/paint|layout|strict|content/.test(t.contain)||t.containerType!==void 0&&t.containerType!=="normal"&&t.containerType!=="":!1}function Mt(e){const t=e.documentElement,n=e.body;return t&&yn(t)?{parent:n??t,trapped:!0}:n&&yn(n)?{parent:t??n,trapped:!1}:{parent:n??t,trapped:!1}}function bn(e=document){const t=Pt("root"),n=e.querySelector(`[${t}]`);if(n?.shadowRoot)return n.shadowRoot;const o=e.createElement("div");return o.setAttribute(t,""),o.style.cssText=gn,Mt(e).parent.appendChild(o),o.attachShadow({mode:"open"})}function zo(e,t,n=5){const o=e.ownerDocument??document,r=e.host,l=Mt(o).parent;if(typeof MutationObserver!="function"||!l)return()=>{};let u=0;const s=new MutationObserver(()=>{if(!r.isConnected){if(u++,u>n){s.disconnect(),t(u);return}Mt(o).parent.appendChild(r)}});return s.observe(l,{childList:!0}),()=>s.disconnect()}const vn=[["pointerdown",!0],["mousedown",!0],["touchstart",!0],["pointerup",!0],["mouseup",!0],["touchend",!0],["click",!0],["dblclick",!0],["focusin",!0],["focusout",!0]];function Io(e){const t=e.host,n=o=>o.stopPropagation();for(const[o,r]of vn)t.addEventListener(o,n,{passive:r});return()=>{for(const[o]of vn)t.removeEventListener(o,n)}}function Mo(e,t,n=20){const o=e.host;if(typeof MutationObserver!="function")return()=>{};let r=0;const l=()=>{let s=!1;return o.getAttribute("aria-hidden")==="true"&&(o.removeAttribute("aria-hidden"),s=!0),o.hasAttribute("inert")&&(o.removeAttribute("inert"),s=!0),s},u=new MutationObserver(()=>{l()&&++r>n&&(u.disconnect(),t(r))});return l(),u.observe(o,{attributes:!0,attributeFilter:["aria-hidden","inert"]}),()=>u.disconnect()}const Oo={product:be,set:So,item:_t,items:Ao};function wn(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(o,r)=>{const l=n?.[r]??Oo[r];return l===void 0?o:String(l)})}const Lo=e=>new Intl.NumberFormat().format(e),xn={"where.anchored":"{label}","where.approximate":"position approximate \u2014 the page changed","where.orphaned":"moved \u2014 the element is gone","status.open":"Active","status.progress":"In progress","status.review":"In review","status.resolved":"Resolved","author.unknown":"Someone","label.image":"an image","label.link":"a link","label.button":"a button","label.tag":"the {tag}"},Sn=wn(xn),An={open:{colour:"#4f6ef7"},progress:{colour:"#f59e0b"},review:{colour:"#8b5cf6"},resolved:{colour:"#10b981"}},kn=e=>e==="open"||e==="review"?"#fff":"#16161a",$n=e=>e in An?Sn(`status.${e}`):e,Do=e=>Sn(`where.${e.anchorState}`,{label:e.anchor.label});class Ot extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function En(e){return{id:e.id,key:e.key,route:e.route,...e.scope?{scope:e.scope}:{},...e.attachments?.length?{attachments:e.attachments}:{},anchor:e.anchor,anchorState:e.anchorState,context:e.context,status:"open",comments:e.comment?[{id:e.comment.id,snagId:e.id,body:e.comment.body,author:e.comment.author,createdAt:e.createdAt}]:[],createdBy:e.createdBy,createdAt:e.createdAt,updatedAt:e.createdAt}}const k=Object.fromEntries(Object.keys(z).map(e=>[e,To(e)])),No=Object.entries(An).map(([e,t])=>` ${z[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
2
- `),Ho=` :host{all:initial}[hidden]{display:none!important}:host{display:block;font:400 14px/1.45 ${k.font};color:${k.fg};${z.font}:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;${z.accent}:#2a51b8;${z.bg}:#fefdfc;${z.fg}:#181716;${z.muted}:#666564;${z.border}:#e4e3e0;${z.radius}:8px;${z.shadow}:0 6px 24px -4px rgb(0 0 0 / .18);${z.z}:2147483647;${z.motion}:160ms;${z.surface}:color-mix(in srgb,${k.fg} 6%,${k.bg});${z.sunken}:color-mix(in srgb,${k.fg} 3%,${k.bg});${z.hover}:color-mix(in srgb,${k.fg} 8%,${k.bg});${z.onAccent}:#fff;${z.focus}:color-mix(in srgb,${k.accent} 62%,${k.fg});${z.disabled}:color-mix(in srgb,${k.muted} 52%,${k.bg});${No} ${z.anchorOrphan}:#DC2626;}:host([${hn}="dark"]){${z.accent}:#8aafff;${z.onAccent}:#1d1c1a;${z.bg}:#1d1c1a;${z.fg}:#f0eeec;${z.muted}:#9a9997;${z.border}:#2d2c2b;${z.shadow}:0 6px 24px -4px rgb(0 0 0 / .6);}@media (prefers-reduced-motion:reduce){:host{${z.motion}:0ms}}@media (forced-colors:active){:host{${z.bg}:Canvas;${z.fg}:CanvasText;${z.muted}:CanvasText;${z.border}:CanvasText;${z.accent}:Highlight;${z.onAccent}:HighlightText;${z.surface}:Canvas;${z.sunken}:Canvas;${z.hover}:Canvas;${z.focus}:Highlight;${z.disabled}:GrayText;${z.shadow}:none;${z.anchorOrphan}:CanvasText;}.snag-pin{border-color:CanvasText!important;color:CanvasText!important;forced-color-adjust:none}}`,Ve={shield:1,pins:3,dock:5,notice:6,toolbar:7},Cn=new WeakMap;function et(e,t,n){let o=Cn.get(e);if(o||Cn.set(e,o=new Set),o.has(t))return;o.add(t);try{const u=new CSSStyleSheet;u.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,u];return}catch{}const l=(e.ownerDocument??document).createElement("style");l.setAttribute(`data-snag-${t}`,""),l.textContent=n,e.appendChild(l)}function Wo(e){return e==="light"||e==="dark"?e:"auto"}function jo(e,t){const n=hn;if(t!=="auto")return e.setAttribute(n,t),()=>e.removeAttribute(n);const o=e.ownerDocument?.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");if(!o)return e.setAttribute(n,"light"),()=>e.removeAttribute(n);const r=()=>e.setAttribute(n,o.matches?"dark":"light");return r(),o.addEventListener("change",r),()=>{o.removeEventListener("change",r),e.removeAttribute(n)}}function Lt(e){return e.getBoundingClientRect()}function yt(e){if(e.closest('[inert],[aria-hidden="true"]'))return!1;const t=e.checkVisibility;if(typeof t=="function")return t.call(e,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const n=Lt(e);if(!(n.width>0||n.height>0||e.getClientRects().length>0))return!1;const r=e.ownerDocument?.defaultView;return r?r.getComputedStyle(e).visibility!=="hidden":!0}const Bo="button,a[href],[role=button],[role=link],[role=tab],[role=menuitem],label,input,select,textarea,summary",Fo=3,Tn=8,Uo=new Set(["img","picture","canvas","video","audio","iframe","embed","object","svg","math","input","select","textarea","button","progress","meter"]);function Zo(e,t){return Uo.has(e.tagName.toLowerCase())?!1:t.getComputedStyle(e).display==="inline"}function Rn(e){const t=e.ownerDocument?.defaultView;if(!t)return e;let n=e;for(let r=e;r;r=r.parentElement){const l=Lt(r);if(l.width>=Tn&&l.height>=Tn&&!Zo(r,t)){n=r;break}n=r}let o=0;for(let r=n;r&&o<=Fo;r=r.parentElement){if(r.matches(Bo))return r;o++}return n}const Vo=10,Dt=[["click",!1],["auxclick",!1],["dblclick",!1],["pointerdown",!1],["pointerup",!1],["mousedown",!1],["mouseup",!1],["contextmenu",!1],["dragstart",!1],["wheel",!1],["touchstart",!0],["touchmove",!0],["touchend",!0],["selectstart",!0],["keydown",!1],["keyup",!1]];function Yo(e,t,n){let o=e;for(;o&&o!==o.ownerDocument.documentElement&&o!==o.ownerDocument.body;){const r=getComputedStyle(o),l=(r.overflowY==="auto"||r.overflowY==="scroll")&&o.scrollHeight>o.clientHeight&&(t>0&&o.scrollTop+o.clientHeight<o.scrollHeight-1||t<0&&o.scrollTop>0),u=(r.overflowX==="auto"||r.overflowX==="scroll")&&o.scrollWidth>o.clientWidth&&(n>0&&o.scrollLeft+o.clientWidth<o.scrollWidth-1||n<0&&o.scrollLeft>0);if(l||u)return o;o=o.parentElement}return null}function _n(e,t){const n=t==="y"?e.deltaY:e.deltaX;return e.deltaMode===1?n*16:e.deltaMode===2?n*(t==="y"?innerHeight:innerWidth):n}const Xo=["position:fixed","inset:0",`z-index:${Ve.shield}`,"touch-action:pan-x pan-y pinch-zoom","background:transparent"].join(";");function Ko(e,t={}){const n=t.doc??e.ownerDocument??document,o=n.defaultView??window;let r=t.coarsePointer??o.matchMedia?.("(pointer: coarse)").matches??!1;const l=c=>{const _=c.pointerType,S=_==="touch"?!0:_==="mouse"||_==="pen"?!1:r;S!==r&&(r=S,d())},u=n.createElement("div");u.className="snag-shield",u.style.cssText=Xo;let s="browse";const d=()=>{u.style.pointerEvents=r?"none":"auto",u.style.cursor="crosshair"};d();const y=c=>{const _=c;return!_||typeof _.closest!="function"?!1:e.contains(_)?!0:!!_.closest(`[${Pt("root")}]`)};function w(c,_,S){let P=S,I=0;for(;P.shadowRoot&&I++<Vo;){const N=R(P.shadowRoot,c,_);if(!N||N===P)break;P=N}return P}function R(c,_,S){const P=c.elementsFromPoint;if(typeof P=="function"){for(const N of P.call(c,_,S))if(N.getRootNode()===c)return N;return null}const I=c.elementFromPoint(_,S);return I&&I.getRootNode()===c?I:null}function g(c,_){const S=[];for(const P of n.elementsFromPoint(c,_)){if(y(P))continue;if(P===n.documentElement||P===n.body){S.push(P);continue}const I=w(c,_,P);S.push(y(I)?P:I)}return S}let p=null;const m=(c,_)=>{const[S]=g(c,_);S&&t.onPick?.(Rn(S),{x:c,y:_})};let h=!1;const C=()=>{const c=n.getSelection?.();if(!c||c.isCollapsed||c.rangeCount===0||!c.toString().trim())return!1;const _=c.anchorNode;if(!_||e.contains(_))return!1;const S=_.nodeType===1?_:_.parentElement;return!y(S)},D=c=>{const _=c.composedPath()[0];if(_&&y(_)){h=!1;return}if(c.type==="selectstart"){t.onSelectStart?.();return}const S=c.type;if(S.endsWith("down")||S.endsWith("start")){h=!1;return}if(S.endsWith("up")||S.endsWith("end")){h=C();return}if(S==="click"||S==="auxclick"){if(!h)return;h=!1,c.preventDefault(),c.stopImmediatePropagation()}},O=c=>{if(c.type==="pointerdown"&&l(c),s==="comments"){D(c);return}if(s!=="add")return;if(c.type==="keydown"||c.type==="keyup"){Ee(c);return}const _=c.composedPath()[0];if(_&&_!==u&&y(_))return;const S=Dt.find(([P])=>P===c.type)?.[1]??!1;if(c.stopImmediatePropagation(),!S){if(r&&c.type==="pointerdown"){const P=c;p={x:P.clientX,y:P.clientY,t:performance.now()},he(P.clientX,P.clientY)}if(r&&c.type==="pointerup"&&p){const P=c,I=p;p=null,Math.hypot(P.clientX-I.x,P.clientY-I.y)<=8&&performance.now()-I.t<=700&&m(P.clientX,P.clientY);return}if(c.type==="click"||c.type==="auxclick"||c.type==="dblclick"){c.preventDefault();const P=c;m(P.clientX,P.clientY);return}if(c.type==="wheel"){const P=c,I=_n(P,"y"),N=_n(P,"x"),[U]=g(P.clientX,P.clientY),G=Yo(U??null,I,N);G&&(G.scrollTop+=I,G.scrollLeft+=N,c.preventDefault());return}if(c.type==="dragstart"||c.type==="contextmenu"){c.preventDefault();return}(c.type==="pointerdown"||c.type==="mousedown")&&!r&&c.preventDefault()}},V=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," ","Spacebar","PageUp","PageDown","Home","End"]),oe=/^[a-z0-9/?]$/;function Y(c){for(const _ of c.composedPath()){const S=_;if(!(!S||S.nodeType!==1||typeof S.matches!="function")&&S.matches('input:not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),textarea,select,[contenteditable=""],[contenteditable=true],[role=textbox],[role=searchbox],[role=combobox]'))return!0}return!1}function Ee(c){V.has(c.key)||c.metaKey||c.ctrlKey||c.altKey||/^F\d{1,2}$/.test(c.key)||c.key!=="Escape"&&c.key.length===1&&oe.test(c.key.toLowerCase())&&!Y(c)&&(c.preventDefault(),c.stopImmediatePropagation())}for(const[c,_]of Dt)o.addEventListener(c,O,{capture:!0,passive:_});let ee=0,te=null;function ze(){if(ee=0,s!=="add"||!te)return;const[c]=g(te.x,te.y);t.onHover?.(c?Rn(c):null)}function he(c,_){s==="add"&&(te={x:c,y:_},!ee&&(ee=o.requestAnimationFrame(ze)))}return u.addEventListener("pointermove",c=>he(c.clientX,c.clientY)),u.addEventListener("pointerleave",()=>{te=null,t.onHover?.(null)}),{shield:u,getMode:()=>s,setMode(c){s=c,h=!1,d(),c==="add"?e.appendChild(u):u.remove(),c!=="add"&&(te=null,t.onHover?.(null))},hitTest:g,destroy(){ee&&o.cancelAnimationFrame(ee);for(const[c]of Dt)o.removeEventListener(c,O,{capture:!0});u.remove()}}}const qo=/[\u200B-\u200D\u2060\uFEFF]/gu,Jo=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,Qo=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function Go(e){let t=e.normalize("NFC").replace(qo,"");for(const[n,o]of Qo)t=t.replace(n,o);return t.replace(Jo," ").trim()}const er={testid:1,domid:1,css:.9,aria:.75,"text-exact":.8,"text-fuzzy":.78,"path-rect":.35,none:0,manual:1},Pn={anchored:.75,approximate:.35};function tr(e,t){const n=er[e];return t===1?n:n/(1+Math.log2(t))}function zn(e){return e>=Pn.anchored?"anchored":e>=Pn.approximate?"approximate":"orphaned"}const nr=[Co("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],In=e=>typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/["\\]/g,"\\$&"),or=[{strategy:"testid",applicable:e=>!!e.testid,find:(e,t)=>Nt(t,nr.map(n=>`[${n}="${In(e.testid)}"]`).join(","))},{strategy:"domid",applicable:e=>!!e.domid,find:(e,t)=>Nt(t,`#${In(e.domid)}`)},{strategy:"css",applicable:e=>!!e.css,find:(e,t)=>{try{return Nt(t,e.css)}catch{return[]}}}];function Nt(e,t){return[...e.querySelectorAll(t)].filter(rr)}function rr(e){return!e.closest(`[${Pt("root")}]`)}function ar(e,t){const n=t.text?.exact;if(!n)return!0;const o=Go(e.textContent??"");return o?o===n||o.includes(n)||n.includes(o):!0}function Mn(e,t,n,o){yt(e)||o.push("hidden"),t.hostPath?.length&&o.push("shadow-boundary");const r=!ar(e,t);r&&o.push("text-drift");let l=o.includes("hidden")?Math.min(n,.7):n;return r&&(l=Math.min(l,.5)),l}const sr={element:null,strategy:"none",score:0,state:"orphaned",reasons:["not-found"],candidates:0};function Ht(e,t=document,n={}){const o=[];for(const r of or){if(!r.applicable(e))continue;const l=r.find(e,t);if(l.length===0)continue;const u=tr(r.strategy,l.length),s=l[0];l.length>1&&o.push("ambiguous");const d=Mn(s,e,u,o),y={element:s,strategy:r.strategy,score:d,state:zn(d),reasons:o.length?o:["exact"],candidates:l.length};if(y.reasons.includes("text-drift")&&n.extended){const w=n.extended(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}});if(w&&w.score>y.score)return w}return y}return n.extended?.(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}})??sr}const ir={"toolbar.aria":"{product} review toolbar","toolbar.group":"What you see","toolbar.browse":"Browse","toolbar.comments":"Comment","toolbar.comments.unresolved":"Comment, {n} unresolved","toolbar.add":"Add a comment","toolbar.add.draft":"Add a comment \u2014 one is unfinished","toolbar.panel":"All comments","pin.aria":"Comment {key} on {target}. {status}, {replies} replies. Press Enter.","pin.aria.one":"Comment {key} on {target}. {status}, 1 reply. Press Enter.","pin.aria.none":"Comment {key} on {target}. {status}. Press Enter.","pin.aria.moved":"Comment {key} on {target}. {status}. {where}. Press Enter.","pin.target":"{role} \u201C{name}\u201D","cluster.aria":"{n} comments here: {list}","nav.announce":"Comment {n} on {label}, {i} of {total}","action.retry":"Retry","action.dismiss":"Dismiss","action.export":"Export","action.exportclear":"Export & clear","error.quota":"Storage is full \u2014 this {item} is on screen but not saved. Export to keep them.","error.nostorage":"Comments won't be saved in this browser. Export before you leave to keep them.","error.linkrevoked":"This review link was turned off. Ask whoever sent it for a new one.","error.sessionended":"This review session has ended. Open your review link again to carry on.","error.sendfailed":"That {item} couldn't be sent, so it wasn't kept. Check your connection and try again.","error.origin":"{product} is not enabled for {origin}. Add that address to the site's allowed origins.","error.panels":"{product} loaded, but its comment UI didn't. You can still see the comments on the page.","error.panels.add":"Adding comments is unavailable until the comment UI loads.","error.capture":"{product} can't take new comments \u2014 the part that records the page didn't load. Everything already here still works.","paused.dialog":"Review paused \u2014 a dialog is open on this page. Close it to carry on commenting. Commenting inside a native dialog isn't supported yet.","paused.close":"Close","announce.created":"Comment {key} added.","permalink.unknown":"That comment isn't on this page any more"},cr={...xn,...ir},B=wn(cr);function lr(e,t){const n=new Array(e.length),o=[],r=new Map,l=[];let u=0;for(let s=0;s<e.length;s++){u++;const d=e[s],y=Math.floor(d.x/t),w=Math.floor(d.y/t);let R=-1;e:for(let g=-1;g<=1;g++)for(let p=-1;p<=1;p++)for(const m of r.get(`${y+g},${w+p}`)??[]){const h=l[m],C=d.x-h.x,D=d.y-h.y;if(C*C+D*D<=t*t){R=m;break e}}if(R===-1){R=o.length,o.push([]),l.push(d);const g=`${y},${w}`,p=r.get(g);p?p.push(R):r.set(g,[R])}n[s]=R,o[R].push(s)}return{group:n,members:o,visits:u}}const dr=`position:absolute;top:0;left:0;width:0;height:0;pointer-events:none;z-index:${Ve.pins}`,ur=' .snag-pp{animation:snag-pp .5s ease-out 2}@keyframes snag-pp{50%{transform:scale(1.45)}}@media (prefers-reduced-motion: reduce){.snag-pp{animation:none}}.snag-pin{width:28px;height:28px;margin:-14px 0 0 -14px}.snag-pin::after{content:"";position:absolute;inset:-8px}@media (pointer:coarse){.snag-pin{width:34px;height:34px;margin:-17px 0 0 -17px}}',fr=`position:fixed;inset:0;width:0;height:0;pointer-events:none;z-index:${Ve.pins}`,tt=["position:absolute",`color:${k.onAccent}`,`font:600 12px/1 ${k.font}`,"display:flex","align-items:center","justify-content:center","box-shadow:0 1px 4px rgb(0 0 0 / .35)","pointer-events:auto","cursor:pointer","box-sizing:border-box"].join(";"),bt="border-radius:50% 50% 50% 2px",On=e=>k[`status${e[0].toUpperCase()}${e.slice(1)}`]??k.muted;function Ln(e,t){const n=kn(t.status),o=`background:${On(t.status)};color:${n}`,r="0 1px 4px rgb(0 0 0 / .35)";return e==="anchored"?`${tt};${bt};${o};border:2px solid ${n};box-shadow:${r}`:e==="approximate"?`${tt};${bt};${o};border:2px dashed ${n};box-shadow:${r}`:`${tt};${bt};${o};border:2px solid ${n};box-shadow:inset 0 0 0 2px ${n},${r}`}function pr(e,t){const n=[];let o="static",r=!1;for(let l=e;l&&l!==e.ownerDocument.documentElement;l=l.parentElement){const u=t.getComputedStyle(l),s=l!==e.ownerDocument.body&&/auto|scroll|hidden|overlay/.test(u.overflowY+u.overflowX);s&&!r&&n.push(l),u.position==="fixed"?(o="dynamic",r=!0):u.transform!=="none"||u.filter!=="none"||u.perspective!=="none"?(o="dynamic",r=!1):(u.position==="sticky"||u.willChange.includes("transform")||u.contain.includes("layout")||s&&(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth))&&(o="dynamic")}return{tier:o,clips:n}}function hr(e,t,n,o){const r=e.ownerDocument??document,l=r.defaultView??window;et(e,"pins",ur);const u=r.createElement("div");u.className="snag-pins",u.style.cssText=dr,e.appendChild(u);const s=r.createElement("div");s.className="snag-pins-dyn",s.style.cssText=fr,e.appendChild(s);let d=[],y=[];const w=new Map;let R=new Map,g=null;const p=new Map;let m=new Map;const h=l.matchMedia?.("(pointer: coarse)").matches??!1,C=h?32:24,D=h?34:28;let O=[],V=null,oe=null,Y={x:0,y:0};function Ee(){const A=r.defaultView,$=u.getBoundingClientRect();Y={x:$.left+(A?.scrollX??0),y:$.top+(A?.scrollY??0)}}let ee=[];const te=new Map,ze=1e4,he=5,c=new Map,_=new Set(["testid","domid"]);function S(A){const $=c.get(A.id),b=$?.ref.deref();if(!b||!b.isConnected)return null;if(_.has($.strategy))return b;if(A.anchor.css)try{if(!b.matches(A.anchor.css))return null}catch{return null}return b}function P(A,$){const b=[],H=Mn($,A.anchor,1,b);return{element:$,strategy:c.get(A.id).strategy,score:H,state:zn(H),reasons:b.length?b:["exact"],candidates:1}}function I(A,$="authoritative"){w.clear(),ee=[];const b=Date.now(),H=n?.newPass?.();return A.map(v=>{const M=S(v),E=n?.get();let x=M?P(v,M):Ht(v.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...E?{extended:E}:{},...H?{passCaches:H}:{}});if(M&&x.reasons.includes("text-drift")){const W=Ht(v.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...E?{extended:E}:{},...H?{passCaches:H}:{}});W.score>x.score&&(x=W)}if(n&&(!x.element||x.reasons.includes("text-drift"))&&n.want(v.anchor),!x.element&&n){const W=n.fuzzyHit?.(v.id);W?x=W:n.wantFuzzy?.(v.id,v.anchor)}const ne=x.element&&v.anchor.text?.exact&&(x.reasons.includes("text-drift")||x.strategy==="path-rect"&&x.score<.5);if(n&&ne){const W=n.fuzzyHit?.(v.id);W&&W.score>x.score?x=W:W||n.wantFuzzy?.(v.id,v.anchor)}x.element?c.set(v.id,{ref:new WeakRef(x.element),strategy:x.strategy}):c.delete(v.id),x.element&&w.set(v.id,x.element);let X=!1;if(x.state==="orphaned"){const W=te.get(v.id)??{firstSeenAt:b,tries:0,best:x};W.tries++,x.score>=W.best.score&&(W.best=x),te.set(v.id,W);const K=n?.unavailable?.()??!1,q=K?2:he,ce=b-W.firstSeenAt<ze;$==="optimistic"||ce&&($==="navigating"||W.tries<q)?X=!0:(x=W.best,K&&!x.reasons.includes("budget-exceeded")&&(x={...x,reasons:[...x.reasons,"budget-exceeded"]}),te.delete(v.id))}else te.delete(v.id);X||ee.push({id:v.id,state:x.state,strategy:x.strategy,confidence:x.score});const L=x.element?Lt(x.element):void 0;if(L&&(L.width>0||L.height>0)){const W=r.defaultView;v.anchor.rect={x:L.left+(W?.scrollX??0),y:L.top+(W?.scrollY??0),w:L.width,h:L.height}}return{...v,anchorState:X?v.anchorState:x.state,anchorPending:X,anchorReasons:x.reasons}})}function N(){const A=r.documentElement;return{w:A.scrollWidth,h:A.scrollHeight}}function U(A,$,b){return{x:Math.min(Math.max(A,14),Math.max(b.w,28)-14),y:Math.min(Math.max($,14),Math.max(b.h,28)-14)}}function G(A,$){Ee(),u.textContent="",s.textContent="",d=[],y=[],R=new Map,m=new Map,p.clear(),O=[],oe=null,A.forEach((b,H)=>{const v=b.anchor.rect;if(!v)return;const M=b.anchor.offset??{fx:.5,fy:.5},E=r.createElement("div");E.className="snag-pin",E.setAttribute("data-state",b.anchorPending?"pending":b.anchorState),E.setAttribute("data-key",b.key),E.style.cssText=b.anchorPending?`${Ln("approximate",b)};opacity:.55`:Ln(b.anchorState,b);const x=w.get(b.id),{tier:ne,clips:X}=x?pr(x,l):{tier:"static",clips:[]};if(ne==="dynamic"&&x){const J=x.getBoundingClientRect(),me=je();E.style.left=`${J.left-me.left+J.width*M.fx}px`,E.style.top=`${J.top-me.top+J.height*M.fy}px`,p.set(E,{x:J.left+J.width*M.fx+l.scrollX-Y.x,y:J.top+J.height*M.fy+l.scrollY-Y.y});const Oe={node:E,el:x,fx:M.fx,fy:M.fy,clips:X};d.push(Oe),E.hidden=!yt(x),E.hidden||Be(Oe,J,new Map(X.map(st=>[st,st.getBoundingClientRect()])))}else{const J=U(v.x+v.w*M.fx-Y.x,v.y+v.h*M.fy-Y.y,N());E.style.left=`${J.x}px`,E.style.top=`${J.y}px`,p.set(E,J),x&&(y.push({node:E,el:x,fx:M.fx,fy:M.fy,clips:[]}),E.hidden=!yt(x))}E.textContent=String(H+1);const L=Do(b),W=b.anchor.role?B("pin.target",{role:b.anchor.role,name:b.anchor.accessibleName??b.anchor.label}):b.anchor.label,K=b.comments.length-1,q=b.anchorState==="approximate"?`~ ${b.key}`:b.key;E.setAttribute("role","button"),E.setAttribute("tabindex","0");const ce=b.anchorState==="anchored"?B(K===0?"pin.aria.none":K===1?"pin.aria.one":"pin.aria",{key:q,target:W,status:$n(b.status),replies:K}):B("pin.aria.moved",{key:q,target:W,status:$n(b.status),where:L});E.title=ce,E.setAttribute("aria-label",ce),t&&xe(E,()=>t(b)),$?.has(b.id)&&(E.hidden=!0,E.setAttribute("data-fo","")),R.set(b.id,E),m.set(E,{snag:b,ordinal:H+1}),(ne==="dynamic"?s:u).appendChild(E)}),Ye(),g&&Fe(g),Me(),ie="",ue(r.visibilityState==="visible"&&R.size>0)}const je=()=>s.getBoundingClientRect();let we=!1;function Be(A,$,b){for(const H of A.clips){const v=b.get(H);if(v&&($.right<=v.left||$.left>=v.right||$.bottom<=v.top||$.top>=v.bottom)){A.node.hidden=!0;return}}A.node.hidden=!1}function At(A){const $=new Map;for(const b of A)for(const H of b.clips)$.has(H)||$.set(H,H.getBoundingClientRect());return $}const Ce=["open","progress","review","resolved"];function xe(A,$){A.addEventListener("click",$),A.addEventListener("keydown",b=>{b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),$())})}function Ie(A,$,b,H,v){const M=Ce.find(x=>A.some(ne=>ne.snag.status===x))??"open",E=r.createElement("div");E.className="snag-pin snag-cluster",E.style.cssText=`${tt};border-radius:50%;background:${On(M)};color:${kn(M)};border:2px solid ${k.onAccent}`,E.style.left=`${$}px`,E.style.top=`${b}px`,E.textContent=String(A.length),E.setAttribute("data-count",String(A.length)),E.setAttribute("data-state",M),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),v&&E.setAttribute("aria-expanded","true"),E.setAttribute("aria-label",B("cluster.aria",{n:A.length,list:A.map(x=>x.ordinal).join(", ")})),xe(E,()=>{if(v)V=null;else if(A.length<=6)V=H;else{o?.(A.map(x=>x.snag.id));return}Ye()}),u.appendChild(E),O.push(E)}function de(A,$,b,H){Ie(A,$,b,H,!0),A.forEach((v,M)=>{const E=$,x=b+(M+1)*(D+12),ne=v.x-E,X=v.y-x,L=Math.hypot(ne,X);if(L>4){const K=r.createElement("div");K.className="snag-leader",K.setAttribute("aria-hidden","true"),K.style.cssText=`position:absolute;left:${E}px;top:${x}px;width:${L}px;height:0;border-top:1px solid ${k.onAccent};transform-origin:0 0;transform:rotate(${Math.atan2(X,ne)}rad)`,u.appendChild(K),O.push(K)}const W=v.dot.cloneNode(!0);W.style.visibility="",W.style.left=`${E}px`,W.style.top=`${x}px`,xe(W,()=>t?.(v.snag)),u.appendChild(W),O.push(W)})}function Ye(){for(const v of O)v.remove();O=[];const A=[];for(const[v,M]of m){if(v.hidden){v.style.visibility="";continue}const E=p.get(v);E&&A.push({dot:v,snag:M.snag,ordinal:M.ordinal,x:E.x,y:E.y})}const{members:$,visits:b}=lr(A,C);u.setAttribute("data-cv",String(b)),u.setAttribute("data-cp",String(A.length));let H=!1;for(const v of $){if(v.length<2){A[v[0]].dot.style.visibility="";continue}const M=v.map(X=>A[X]),E=M.map(X=>X.snag.id).sort().join("|");for(const X of M)X.dot.style.visibility="hidden";const x=M.reduce((X,L)=>X+L.x,0)/M.length,ne=M.reduce((X,L)=>X+L.y,0)/M.length;V===E&&M.length<=6?(H=!0,de(M,x,ne,E)):Ie(M,x,ne,E,!1)}V&&!H&&(V=null)}function Xe(A){oe?.remove(),oe=null;const $=A.anchor.rect;if(!$)return;const b=A.anchor.offset??{fx:.5,fy:.5},H=r.createElement("div");H.className="snag-pin snag-ghost",H.style.cssText=`${tt};${bt};background:transparent;border:2px dashed ${k.anchorOrphan};color:${k.anchorOrphan};box-shadow:none;pointer-events:none`;const v=U($.x+$.w*b.fx-Y.x,$.y+$.h*b.fy-Y.y,N());H.style.left=`${v.x}px`,H.style.top=`${v.y}px`,H.setAttribute("aria-hidden","true"),u.appendChild(H),oe=H}function Me(A=!1){const $=A?[...d,...y]:d;we||$.length===0||(we=!0,l.requestAnimationFrame(()=>{we=!1;const b=performance.now(),H=l.scrollX,v=l.scrollY,M=je(),E=$.map(L=>L.el.isConnected?L.el.getBoundingClientRect():null),x=$.map(L=>L.el.isConnected&&yt(L.el)),ne=At($),X=N();$.forEach((L,W)=>{const K=E[W];if(!K)return;if(L.node.hasAttribute("data-fo")){L.node.hidden=!0;return}if(!x[W]){L.node.hidden=!0;return}L.node.hidden=!1;const q=K.left+K.width*L.fx,ce=K.top+K.height*L.fy;if(L.node.parentElement===s)L.node.style.left=`${q-M.left}px`,L.node.style.top=`${ce-M.top}px`,Be(L,K,ne),p.set(L.node,{x:q+H-Y.x,y:ce+v-Y.y});else{const J=U(q+H-Y.x,ce+v-Y.y,X);L.node.style.left=`${J.x}px`,L.node.style.top=`${J.y}px`,p.set(L.node,J)}}),Ye(),u.setAttribute("data-ms",(performance.now()-b).toFixed(2))}))}const Se=()=>Me();r.addEventListener("scroll",Se,{capture:!0,passive:!0});const rt=typeof l.ResizeObserver=="function"?new l.ResizeObserver(()=>Me(!0)):null;rt?.observe(r.documentElement);let Ae=null,ie="";function kt(){let A="";for(const $ of[...y,...d]){if(!$.el.isConnected)continue;const b=$.el.getBoundingClientRect();A+=`${Math.round(b.left)},${Math.round(b.top)},${Math.round(b.width)};`}!A||A===ie||(ie=A,Me(!0))}function ue(A){if(Ae&&clearTimeout(Ae),Ae=null,!A)return;const $=()=>{kt(),Ae=setTimeout($,500)};Ae=setTimeout($,500)}const at=()=>ue(r.visibilityState==="visible"&&R.size>0);r.addEventListener("visibilitychange",at);function re(A){const $=R.get(A);$&&($.classList.remove("snag-pp"),l.requestAnimationFrame(()=>$.classList.add("snag-pp")),l.setTimeout(()=>$.classList.remove("snag-pp"),1400))}function Fe(A){const $=g?R.get(g):void 0;$&&($.style.transform="",$.style.zIndex=""),g=A;const b=A?R.get(A):void 0;b&&(b.style.transform="scale(1.4)",b.style.zIndex="1")}return{el:u,render:G,showGhost:Xe,pulse:re,reanchor:I,settled:()=>ee,hasPending:()=>te.size>0,highlight:Fe,destroy(){r.removeEventListener("scroll",Se,{capture:!0}),r.removeEventListener("visibilitychange",at),rt?.disconnect(),ue(!1),u.remove(),s.remove()}}}const mr=` .snag-notice{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(24px + var(${z.tbH},56px));z-index:${Ve.notice};max-width:min(420px,calc(100vw - 24px));background:${k.bg};color:${k.fg};border:1px solid ${k.border};border-inline-start:3px solid ${k.anchorOrphan};border-radius:${k.radius};box-shadow:${k.shadow};padding:12px 14px;pointer-events:auto;font:400 13px/1.45 ${k.font};display:flex;flex-direction:column;gap:10px}@media (pointer:coarse){.snag-notice{bottom:calc(12px + var(${z.tbH},64px))}}.snag-notice p{margin:0}.snag-notice-actions{display:flex;gap:6px;justify-content:flex-end}.snag-notice button{appearance:none;font:inherit;cursor:pointer;border-radius:calc(${k.radius} - 2px);padding:6px 12px;min-height:30px;border:0;transition:background ${k.motion}}.snag-notice-retry{background:${k.accent};color:${k.onAccent};font-weight:600}.snag-notice-dismiss{background:transparent;color:${k.muted}}.snag-notice-dismiss:hover{background:${k.hover};color:inherit}.snag-notice button:focus-visible{outline:2px solid ${k.focus};outline-offset:2px}`;function gr(e,t){const n=e.ownerDocument??document,o=n.defaultView??window;et(e,"notice",mr);const r=n.createElement("div");r.className="snag-notice",r.setAttribute("role","alert"),r.hidden=!0;const l=n.createElement("p"),u=n.createElement("div");u.className="snag-notice-actions";const s=n.createElement("button");s.type="button",s.className="snag-notice-dismiss",s.textContent=B("action.dismiss"),s.addEventListener("click",()=>R());const d=n.createElement("button");d.type="button",d.className="snag-notice-retry",u.append(s,d),r.append(l,u);let y;d.addEventListener("click",()=>{R(),y?.run()});let w=0;function R(){w&&o.cancelAnimationFrame(w),w=0,r.hidden=!0,r.remove()}return{show(g,p,m){y=p,d.hidden=!p,p&&(d.textContent=B(p.label)),r.hidden=!1,l.textContent="",(t??e).appendChild(r);const h=B(g,m);w&&o.cancelAnimationFrame(w),w=o.requestAnimationFrame(()=>{w=0,l.textContent=h})},hide:R,visible:()=>r.isConnected&&!r.hidden,destroy(){r.remove()}}}const yr=` .snag-paused{border:0;padding:0;background:transparent;pointer-events:auto;max-width:min(420px,calc(100vw - 32px))}.snag-paused::backdrop{background:rgb(0 0 0 / .28)}.snag-paused-box{background:${k.bg};color:${k.fg};border:1px solid ${k.border};border-inline-start:3px solid ${k.accent};border-radius:${k.radius};box-shadow:${k.shadow};padding:14px 16px;font:400 13px/1.45 ${k.font};display:flex;flex-direction:column;gap:12px}.snag-paused p{margin:0}.snag-paused-actions{display:flex;justify-content:flex-end}.snag-paused button{appearance:none;font:inherit;cursor:pointer;border:0;font-weight:600;border-radius:calc(${k.radius} - 2px);padding:6px 14px;min-height:30px;background:${k.accent};color:${k.onAccent}}.snag-paused button:focus-visible{outline:2px solid ${k.focus};outline-offset:2px}`;function br(e,t){const n=e.ownerDocument??document;et(e,"paused",yr);const o=n.createElement("dialog");o.className="snag-paused",o.setAttribute("aria-label",B("paused.dialog"));const r=n.createElement("div");r.className="snag-paused-box",r.setAttribute("role","status");const l=n.createElement("p");l.textContent=B("paused.dialog");const u=n.createElement("div");u.className="snag-paused-actions";const s=n.createElement("button");s.type="button",s.textContent=B("paused.close"),s.addEventListener("click",()=>w()),u.append(s),r.append(l,u),o.append(r);let d=!1;function y(){if(!d){(t??e).appendChild(o);try{o.showModal(),d=!0}catch{o.setAttribute("open",""),d=!0}}}function w(){if(d){d=!1;try{o.close()}catch{o.removeAttribute("open")}o.remove()}}return o.addEventListener("close",()=>{d=!1,o.remove()}),{show:y,hide:w,destroy(){w(),o.remove()}}}const vr=Symbol.for(mn.original),Dn=Symbol.for(mn.wrapped),nt=()=>{};function wr(e,t,n){let o;try{o=e[t]}catch{return nt}if(typeof o!="function"||o[Dn])return nt;const r=o,l=n(r);let u=!1;const s=function(...d){return u?r.apply(this,d):l.apply(this,d)};try{const d=s;d[Dn]=!0,d[vr]=r,Object.defineProperty(s,"name",{value:r.name,configurable:!0}),Object.defineProperty(s,"length",{value:r.length,configurable:!0})}catch{}try{e[t]=s}catch{return nt}return e[t]!==s?nt:()=>{let d;try{d=e[t]}catch{d=void 0}if(d===s)try{e[t]=r;return}catch{}u=!0}}function xr(e,t){const n=[];let o=0;const r=()=>{o||(o=e.requestAnimationFrame(()=>{o=0,t.onResize()}))};e.addEventListener("resize",r),n.push(()=>{o&&e.cancelAnimationFrame(o),e.removeEventListener("resize",r)}),e.visualViewport?.addEventListener("resize",r),n.push(()=>e.visualViewport?.removeEventListener("resize",r));const l=()=>void e.setTimeout(t.onResize,250);e.addEventListener("orientationchange",l),n.push(()=>e.removeEventListener("orientationchange",l));let u=e.location.pathname;const s=()=>{const C=e.location.pathname;C!==u&&(u=C,t.onRoute())},d=e.navigation;if(d){const C=()=>void e.setTimeout(s,0);d.addEventListener("navigatesuccess",C),n.push(()=>d.removeEventListener("navigatesuccess",C))}else for(const C of["pushState","replaceState"])n.push(wr(e.history,C,D=>function(...O){const V=D.apply(this,O);return e.setTimeout(s,0),V}));const y=e.document;let w=!0;try{y.documentElement.matches(":modal")}catch{w=!1}const R=()=>{const C=y.querySelectorAll("dialog[open]");if(!w)return C.length>0;for(const D of C)if(D.matches(":modal"))return!0;return!1};let g=!1;const p=()=>{const C=R();C!==g&&(g=C,t.onModal(C))};y.addEventListener("toggle",p,!0),n.push(()=>y.removeEventListener("toggle",p,!0));const m=new MutationObserver(p);m.observe(y.documentElement,{subtree:!0,attributes:!0,attributeFilter:["open"]}),n.push(()=>m.disconnect());const h=()=>void e.setTimeout(s,0);return e.addEventListener("popstate",h),n.push(()=>e.removeEventListener("popstate",h)),{destroy(){for(const C of n)C();n.length=0}}}function Sr(e,t){try{e.sessionStorage.setItem(le.handoff,JSON.stringify({openThreadId:t}))}catch{}}function Ar(e){try{const t=e.sessionStorage.getItem(le.handoff);if(t===null)return null;e.sessionStorage.removeItem(le.handoff);const n=JSON.parse(t);return typeof n.openThreadId=="string"?n.openThreadId:null}catch{return null}}function kr(){return{statuses:[],read:"all",pageOnly:!1,newOnly:!1,sort:"page"}}const $r=["open","progress","review","resolved"];function Er(e,t,n){if(t.statuses.length>0&&$r.includes(e.status)&&!t.statuses.includes(e.status)||t.by&&e.createdBy.id!==t.by||t.page&&e.route!==t.page)return!1;if(t.read!=="all"&&n){const o=Cr(e,n);if(t.read==="unread"&&!o||t.read==="read"&&o)return!1}return!0}function Cr(e,t){const n=t.get(e.id)??0;return Date.parse(e.updatedAt)>n}function Tr(e,t,n){const o=e.visualViewport;let r=0;const l=()=>{if(r=0,!o)return;const s=o.offsetLeft,d=o.offsetTop;t.style.translate=s||d?`${s}px ${d}px`:"",t.style.width=`${o.width}px`,t.style.height=`${o.height}px`,n?.(o.scale)},u=()=>{r||(r=e.requestAnimationFrame(l))};return o?.addEventListener("resize",u,{passive:!0}),o?.addEventListener("scroll",u,{passive:!0}),u(),()=>{r&&e.cancelAnimationFrame(r),o?.removeEventListener("resize",u),o?.removeEventListener("scroll",u)}}const Rr=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,_r=/^[a-f0-9]{32,}$/i,Pr=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,zr="[redacted]";function Nn(e){return e.includes("/")?e.split("/").map(t=>Rr.test(t)||_r.test(t)||Pr.test(t)?zr:t).join("/"):e}const Ir=/\/index\.(html?|php)$/i;function Mr(e){if(!e.startsWith("/"))return e;let t=e.replace(Ir,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function Or(e){try{const t=e.querySelector(`meta[name="${Po.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}function Lr(e,t){const n=t??Or(e);return Mr(n??Nn(e.location.pathname))}const Dr=[/^utm_/,/^(gclid|gbraid|wbraid|fbclid|msclkid|ttclid|twclid|igshid|yclid|li_fat_id)$/,/^(mc_cid|mc_eid|_hsenc|_hsmi|vero_id|oly_enc_id|oly_anon_id)$/,/^_vercel_/,/^__vercel_/,/^_rsc$/],Nr=[...mt.query,...mt.fragment];function Hr(e,t=[]){return Nr.includes(e)||t.includes(e)?!0:Dr.some(n=>n.test(e))}function Wr(e,t={}){const n=t.significantQueryParams??[];if(n!=="*"&&n.length===0)return;let o;try{o=new URLSearchParams(e)}catch{return}const r={};for(const[l,u]of o)Hr(l,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(l)||(r[l]=u);return Object.keys(r).length>0?r:void 0}function jr(e,t,n={}){const o=n.significantQueryParams??[];if(o==="*"){const r=e??{},l=t??{},u=new Set([...Object.keys(r),...Object.keys(l)]);for(const s of u)if(r[s]!==l[s])return!1;return!0}for(const r of o)if((e?.[r]??void 0)!==(t?.[r]??void 0))return!1;return!0}const Br=120,Fr=1e3,Ur=200,Zr=1e4;function Vr(e,t,n){const o=t.MutationObserver;if(typeof o!="function")return{destroy:()=>{}};let r=!1,l=null,u=!1,s=!1,d=0,y=R(),w=0;function R(){return t.performance?.now?.()??0}const g=new o(()=>{r=!0,d++,m()});function p(){const C=R();return C-y>=1e3&&(d>Ur&&(w=C+Zr),d=0,y=C),C<w?Fr:Br}function m(){l||(l=setTimeout(h,p()))}function h(){if(l=null,!!r){if(u){s=!0;return}r=!1,u=!0;try{n()}finally{u=!1,s&&(s=!1,r=!0,m())}}}return g.observe(e.documentElement,{childList:!0,subtree:!0}),{destroy(){g.disconnect(),l&&clearTimeout(l),l=null}}}const Yr="0.0.0",Xr={capture:Re.capture,"anchor-ext":Re.anchorExt,"anchor-fuzzy":Re.anchorFuzzy,crumbs:Re.crumbs,screenshot:Re.screenshot,dock:Re.dock,text:Re.text},Hn=new Map,Wt=new Map,Wn=new Map;function Kr(e,t,n){const o=new URL(t,n.location.href).href,r=new URL(Xr[e],o);r.searchParams.set("cv",Yr);const l=Wn.get(e)??0;return l>0&&r.searchParams.set("r",String(l)),Wn.set(e,l+1),r.href}async function _e(e,t,n=document){const o=Hn.get(e);if(o)return{ok:!0,mod:o};const r=Wt.get(e);if(r)return r;const l=(async()=>{for(let u=0;u<2;u++)try{const s=await import(Kr(e,t,n));return Hn.set(e,s),{ok:!0,mod:s}}catch{}return{ok:!1,reason:"unavailable"}})();Wt.set(e,l);try{return await l}finally{Wt.delete(e)}}const qr="composer",jt=e=>le.draft(e,qr),Jr=le.draft("\0","").split("\0")[0];function Qr(e){try{return e.body.trim()?(localStorage.setItem(jt(e.route),JSON.stringify(e)),!0):(jn(e.route),!0)}catch{return!1}}function Gr(e){try{const t=localStorage.getItem(jt(e));if(!t)return null;const n=JSON.parse(t);return!n||typeof n.body!="string"||!n.anchor||n.route!==e?null:n}catch{return null}}function jn(e){try{localStorage.removeItem(jt(e))}catch{}}function Bt(){try{for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t&&t.startsWith(Jr))return!0}return!1}catch{return!1}}const ea="http://www.w3.org/2000/svg";function Pe(e,t,n,o=[]){const r=e.createElementNS(ea,t);for(const l in n)r.setAttribute(l,n[l]);for(const l of o)r.appendChild(l);return r}const Ft=(e,t="16",n="16",o="0 0 16 16")=>({width:t,height:n,viewBox:o,fill:"none","aria-hidden":"true"}),ta=e=>Pe(e,"svg",Ft(),[Pe(e,"path",{d:"M8 3v10M3 8h10",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round"})]),na=e=>Pe(e,"svg",Ft(),[Pe(e,"rect",{x:"2.25",y:"3.25",width:"11.5",height:"9.5",rx:"1.75",stroke:"currentColor","stroke-width":"1.5"}),Pe(e,"path",{d:"M9.5 3.5v9",stroke:"currentColor","stroke-width":"1.5"})]),oa=e=>Pe(e,"svg",{...Ft(e,"10","16","0 0 10 16"),fill:"currentColor"},[Pe(e,"g",{fill:"currentColor"},[4,8,12].flatMap(t=>[3,7].map(n=>Pe(e,"circle",{cx:String(n),cy:String(t),r:"1"}))))]),ra=` .snag-tb{position:fixed;z-index:${Ve.toolbar};display:flex;align-items:center;gap:2px;padding:4px;border-radius:calc(${k.radius} + 4px);background:${k.bg};color:${k.fg};box-shadow:${k.shadow};font:500 13px/1 ${k.font};pointer-events:auto;user-select:none;border:1px solid ${k.border}}.snag-tb{transition:inset-inline-end ${k.motion}}.snag-tb--fine{inset-inline-end:calc(20px + env(safe-area-inset-right) + var(${z.dockW},0px));inset-block-end:calc(20px + env(safe-area-inset-bottom));transition:inset-inline-end ${k.motion}}.snag-tb--coarse{inset-inline:0;inset-block-end:0;border-radius:14px 14px 0 0;padding:6px 10px calc(6px + env(safe-area-inset-bottom));justify-content:center;gap:4px;flex-direction:column}.snag-grabber{width:36px;height:4px;border-radius:2px;background:${k.muted};margin:2px auto 6px}.snag-row{display:flex;align-items:center;gap:2px}.snag-grip{display:flex;align-items:center;padding:0 4px;color:${k.muted};cursor:grab;touch-action:none}.snag-grip:active{cursor:grabbing}.snag-seg{display:flex;background:${k.surface};border-radius:${k.radius};padding:2px;position:relative}.snag-seg::before{content:"";position:absolute;inset-block:2px;inset-inline-start:var(${z.thumbX},0);width:var(${z.thumbW},0);background:${k.accent};border-radius:calc(${k.radius} - 2px);pointer-events:none;transition:inset-inline-start ${k.motion},width ${k.motion}}.snag-seg>.snag-b[aria-pressed="true"]{background:transparent;color:${k.onAccent}}.snag-seg>.snag-b{z-index:1}.snag-b{appearance:none;border:0;background:transparent;color:inherit;font:inherit;padding:6px 11px;border-radius:calc(${k.radius} - 2px);cursor:pointer;display:flex;align-items:center;gap:6px;position:relative;min-height:32px;transition:background ${k.motion}}.snag-b:hover:not(:disabled){background:color-mix(in srgb,currentColor 12%,transparent)}.snag-b:disabled{opacity:.4;cursor:not-allowed}.snag-b[aria-pressed="true"]{background:${k.accent};color:${k.onAccent}}.snag-b:focus-visible{outline:2px solid ${k.focus};outline-offset:2px}.snag-icon{padding:6px 9px}@media (pointer:coarse){.snag-b{min-height:44px;min-width:44px;padding:6px 14px}.snag-icon{padding:6px 14px}}.snag-puck .snag-row>:not([aria-expanded]){display:none}.snag-puck{padding:4px;border-radius:50%}.snag-puck [aria-expanded]{min-width:44px;min-height:44px;border-radius:50%}`;function aa(e,t){const n=e.ownerDocument??document,o=t.coarsePointer??n.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;et(e,"toolbar",ra);const r=n.createElement("div");r.className=`snag-tb ${o?"snag-tb--coarse":"snag-tb--fine"}`,r.setAttribute("role","toolbar"),r.setAttribute("aria-label",B("toolbar.aria"));const l=n.createElement("div");l.className="snag-grabber",l.setAttribute("aria-hidden","true");const u=n.createElement("div");u.className="snag-row";const s=n.createElement("span");s.className="snag-grip",s.setAttribute("aria-hidden","true"),s.appendChild(oa(n));const d=n.createElement("div");d.className="snag-seg",d.setAttribute("role","group"),d.setAttribute("aria-label",B("toolbar.group"));const y=(c,_,S)=>{const P=n.createElement("button");return P.type="button",P.className=`snag-b ${c}`,P.setAttribute("aria-label",_),typeof S=="string"?P.textContent=S:P.appendChild(S),P},w=y("",B("toolbar.browse"),B("toolbar.browse")),R=y("",B("toolbar.comments"),B("toolbar.comments")),g=y("snag-icon",B("toolbar.add"),ta(n)),p=y("snag-icon",B("toolbar.panel"),na(n));p.setAttribute("aria-expanded","false"),d.append(w,R),o||u.appendChild(s),u.append(d,g,p),o&&r.appendChild(l),r.appendChild(u),(t.parent??e).appendChild(r);const m=()=>{e.host.style.setProperty(z.tbH,`${r.offsetHeight}px`)};m();let h=null;function C(c,_){const S=n.defaultView,P=r.offsetWidth,I=r.offsetHeight,N=Bn(c,8,Math.max(8,S.innerWidth-P-8)),U=Bn(_,8,Math.max(8,S.innerHeight-I-8));h={left:N,top:U},r.style.left=`${N}px`,r.style.top=`${U}px`,r.style.right="auto",r.style.bottom="auto"}const D=()=>{m(),h&&C(h.left,h.top)},O=n.defaultView;if(O?.addEventListener("resize",D),w.addEventListener("click",()=>t.onState("browse")),R.addEventListener("click",()=>t.onState("comments")),g.addEventListener("click",()=>t.onState(V==="add"?"comments":"add")),p.addEventListener("click",()=>t.onPanel()),!o){let c=null;s.addEventListener("pointerdown",S=>{c={x:S.clientX,y:S.clientY,r:r.getBoundingClientRect()},s.setPointerCapture(S.pointerId),S.preventDefault()}),s.addEventListener("pointermove",S=>{c&&C(c.r.left+(S.clientX-c.x),c.r.top+(S.clientY-c.y))});const _=S=>{c=null,s.hasPointerCapture(S.pointerId)&&s.releasePointerCapture(S.pointerId)};s.addEventListener("pointerup",_),s.addEventListener("pointercancel",_)}let V="browse";function oe(c){V=c,w.setAttribute("aria-pressed",String(c==="browse")),R.setAttribute("aria-pressed",String(c!=="browse")),g.setAttribute("aria-pressed",String(c==="add")),Y()}function Y(){const c=d.querySelector('.snag-b[aria-pressed="true"]'),_=d.getBoundingClientRect(),S=c?.getBoundingClientRect();if(!c||!S?.width){d.style.setProperty(z.thumbW,"0px");return}const P=n.defaultView?.getComputedStyle(d),I=P?.direction==="rtl",N=parseFloat((I?P?.paddingRight:P?.paddingLeft)??"0")||0,U=(I?_.right-S.right:S.left-_.left)-N;d.style.setProperty(z.thumbW,`${Math.round(S.width)}px`),d.style.setProperty(z.thumbX,`${Math.max(0,Math.round(U))}px`)}function Ee(c){g.disabled=c,c?g.title=B("error.panels.add"):g.removeAttribute("title")}function ee(c){g.setAttribute("aria-label",B(c?"toolbar.add.draft":"toolbar.add"))}function te(c){R.setAttribute("aria-label",c!==null&&c>0?B("toolbar.comments.unresolved",{n:Lo(c)}):B("toolbar.comments"))}oe("browse"),te(0);function ze(c){r.classList.toggle("snag-puck",c),c||Y()}function he(c){r.hidden=c,c||Y(),m()}return{el:r,setState:oe,setCount:te,setDegraded:Ee,setDraft:ee,setPuck:ze,setConcealed:he,destroy(){O?.removeEventListener("resize",D),e.host.style.removeProperty(z.tbH),r.remove()}}}const Bn=(e,t,n)=>e<t?t:e>n?n:e,Fn=24;function sa(e,t){const n=e.innerHeight,o=t.querySelector(".snag-dk");if(!o)return{top:0,bottom:n};const r=o.getBoundingClientRect();return r.height>=n-1?{top:0,bottom:n}:{top:0,bottom:Math.max(0,r.top)}}function ia(e,t,n){const o=n.anchor.rect;if(!o)return;const r=n.anchor.offset??{fy:.5},l=o.y+o.h*r.fy,u=sa(e,t),s=l-e.scrollY;if(s>=u.top+Fn&&s<=u.bottom-Fn)return;const d=e.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;e.scrollTo({top:Math.max(0,l-(u.top+u.bottom)/2),behavior:d?"auto":"smooth"})}function Ut(){const e=new Uint8Array(16);crypto.getRandomValues(e);const t=Date.now();e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/2**8)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128;const n=Array.from(e,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}const ca=()=>gt.thread+Ut(),Un=()=>gt.comment+Ut(),la=()=>gt.attachment+Ut(),da={attachments:"direct",realtime:"none",anchorReports:!1,identity:["guest"],export:["json","md"],serverSideSearch:!1,privateThreads:!1,assignees:!1};function ua(){const e=le.threads("probe","probe");try{return localStorage.setItem(e,"1"),localStorage.removeItem(e),!0}catch(t){return Zn(t)}}function fa(e,t,n){const o=le.threads(e,t);function r(){let s=null;try{s=localStorage.getItem(o)}catch{return[]}if(!s)return[];try{const d=JSON.parse(s);return Array.isArray(d)?d.filter(ha):[]}catch{return[]}}function l(s){try{localStorage.setItem(o,JSON.stringify(s))}catch(d){if(!Zn(d))return;throw new Ot("local_quota_exceeded")}}const u=s=>({...s,updatedAt:new Date().toISOString()});return{kind:"local",capabilities:da,async init(s){return{uid:s.uid,env:s.env,features:{screenshots:!0,uploads:!1}}},async listThreads(s={}){let d=r();return s.route!==void 0&&(d=d.filter(y=>y.route===s.route)),s.status?.length&&(d=d.filter(y=>s.status.includes(y.status))),{data:d,serverTime:new Date().toISOString()}},async getThread(s){return r().find(d=>d.id===s)??null},async createThread(s){const d=En(s);return l([...r(),d]),d},async patchThread(s,d){const y=r(),w=y.findIndex(g=>g.id===s);if(w<0)return null;const R=u({...y[w],...pa(d)});return y[w]=R,l(y),R},async deleteThread(s){const d=r(),y=d.find(R=>R.id===s),w=d.filter(R=>R.id!==s);w.length!==d.length&&l(w);for(const R of y?.attachments??[])n?.del(R.id).catch(()=>{})},async uploadAttachment(s,d){if(!n)throw new Ot("attachments_unsupported");const y=la();return await n.put(y,{blob:s,uid:e,env:t,kind:d.kind,...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},createdAt:Date.now()}),{id:y,kind:d.kind,url:"",...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},bytes:s.size,contentType:s.type}},async createComment(s,d){const y=r(),w=y.findIndex(g=>g.id===s);if(w<0)return null;const R={id:d.id,snagId:s,body:d.body,author:d.author,createdAt:new Date().toISOString()};return y[w]=u({...y[w],comments:[...y[w].comments,R]}),l(y),R},async patchComment(s,d){const y=r();for(let w=0;w<y.length;w++){const R=y[w].comments.find(p=>p.id===s);if(!R)continue;const g={...R,body:d};return y[w]=u({...y[w],comments:y[w].comments.map(p=>p.id===s?g:p)}),l(y),g}return null},async deleteComment(s){const d=r(),y=d.findIndex(w=>w.comments.some(R=>R.id===s));y<0||(d[y]=u({...d[y],comments:d[y].comments.filter(w=>w.id!==s)}),l(d))}}}function pa(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Zn(e){return e instanceof Error?e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED"||e.code===22||e.code===1014:!1}function ha(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.key=="string"&&typeof t.route=="string"&&typeof t.anchor=="object"&&t.anchor!==null&&typeof t.anchor.label=="string"&&Array.isArray(t.comments)}function ma(e,t,n=()=>Date.now()){const o=le.seen(e,t);let r=null;function l(){if(r)return r;try{const s=localStorage.getItem(o),d=s?JSON.parse(s):{};return r=typeof d=="object"&&d!==null&&!Array.isArray(d)?d:{}}catch{return r={}}}function u(s){r=s;try{localStorage.setItem(o,JSON.stringify(s))}catch{}}return{map:()=>new Map(Object.entries(l())),mark(s){u({...l(),[s]:n()})},markAll(s){const d=n(),y={...l()};for(const w of s)y[w.id]=d;u(y)}}}function ot(){let e=null;try{e=localStorage.getItem(zt)}catch{return{}}if(!e)return{};if(e[0]!=="{")return{name:e};try{const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function Vn(e){try{localStorage.setItem(zt,JSON.stringify(e))}catch{}}function Zt(){const e=ot();return{name:typeof e.name=="string"?e.name:"",...e.email?{email:e.email}:{}}}function ga(e){return ot().projects?.[e]?.holderId}function ya(e){const t=ot().projects?.[e]?.holderSecret;return t&&/^[\w-]{43}$/.test(t)?t:void 0}function ba(e,t,n){const o=ot();Vn({...o,projects:{...o.projects,[e]:{holderId:t,holderSecret:n}}})}function va(e,t){const n=ot(),o=n.projects?.[e];o&&Vn({...n,projects:{...n.projects,[e]:{...o,holderId:t}}})}const Vt=e=>le.session(e);function Yt(e){try{const t=sessionStorage.getItem(Vt(e));if(!t)return null;const n=JSON.parse(t);return typeof n?.token=="string"&&typeof n?.refreshableUntil=="number"?n:null}catch{return null}}function Yn(e,t){try{sessionStorage.setItem(Vt(e),JSON.stringify(t))}catch{}}function vt(e){try{sessionStorage.removeItem(Vt(e))}catch{}}const wa=(e,t=Date.now())=>t>e.expiresAt-3e4,Xt=(e,t=Date.now())=>t>=e.refreshableUntil;class We extends Error{code;status;constructor(t,n,o){super(o),this.name="HttpAdapterError",this.status=t,this.code=n}}function xa(e){const{offset:t,testId:n,domId:o,page:r,schemaVersion:l,...u}=e;return{...u,...n?{testid:n}:{},...o?{domid:o}:{},...t?{offset:{fx:t.x,fy:t.y}}:{}}}function wt(e,t){return{id:e.id,route:e.anchor?.page?.route??"",key:e.key,status:e.status,anchor:xa(e.anchor),anchorState:e.anchorState,context:e.context,comments:e.comments??[],createdBy:e.createdBy,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.resolvedAt?{resolvedAt:e.resolvedAt}:{},...t?{scope:{environment:t}}:{}}}function Sa(e,t){const{offset:n,testid:o,domid:r,...l}=e;return{...l,schemaVersion:pn,...o?{testId:o}:{},...r?{domId:r}:{},offset:n?{x:n.fx,y:n.fy}:{x:.5,y:.5},page:{route:t,pathname:location.pathname,origin:location.origin}}}function Aa(e,t,n,o={}){const r=e.replace(/\/+$/,""),l=`${r}/api/v1/projects/${encodeURIComponent(t)}`;let u=o.reviewToken,s=Yt(t);async function d(p=!1){const m=s&&!Xt(s)?s.token:null,h=!!m&&!u&&!p,C=h?void 0:u?{kind:"link",token:u,name:Zt().name||void 0}:{kind:"guest",name:Zt().name||"Anonymous",holderId:ga(t),holderSecret:ya(t)};let D;try{D=await fetch(`${l}/sessions`,{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...m?{Authorization:`Bearer ${m}`}:{}},body:JSON.stringify({...n?{environment:n}:{},...C?{identity:C}:{},client:{widget:xo,schema:pn}})})}catch(oe){throw new We(0,"network_error",oe.message)}finally{u=void 0}if(!D.ok){const Y=(await D.json().catch(()=>null))?.error?.code??"unauthorized";throw vt(t),s=null,Y==="session_revoked"||Y==="token_revoked"?o.onSessionEnded?.("revoked"):D.status===401&&o.onSessionEnded?.("expired"),new We(D.status,Y,"This review session is not valid.")}const O=await D.json();O.holderSecret&&O.reviewer?ba(t,O.reviewer.id,O.holderSecret):O.reviewer&&va(t,O.reviewer.id);const V=O.round?.number??(h?s?.round:void 0);return s={token:O.sessionToken,expiresAt:Date.parse(O.expiresAt),refreshableUntil:Date.parse(O.refreshableUntil),reviewerId:O.reviewer?.id??s?.reviewerId??"",permissions:O.permissions??s?.permissions??[],...V!==void 0?{round:V}:{}},Yn(t,s),C&&(w=C.name??null),o.onSessionStarted?.(),s}async function y(){if(s){if(Xt(s)){vt(t),s=null,o.onSessionEnded?.("expired");return}await d().catch(()=>{})}}let w=null;async function R(){if(s&&Xt(s))return vt(t),s=null,w=null,o.onSessionEnded?.("expired"),null;const p=Zt().name||null,m=s!==null&&p!==null&&p!==w;if(!s||wa(s)||u||m)try{await d(m)}catch(h){if(!(h instanceof We)||h.status===0)throw h;return null}return s?.token??null}async function g(p,m,h=!1){const C=await R();let D;try{D=await fetch(l+p,{...m,headers:{"content-type":"application/json",...C?{Authorization:`Bearer ${C}`}:{},...m?.headers??{}},credentials:"omit"})}catch(O){throw new We(0,"network_error",O.message)}if(!D.ok){const O=await D.json().catch(()=>null),V=O?.error?.code??"http_error";if(D.status===401&&!h&&V!=="session_revoked")return vt(t),s=null,g(p,m,!0);throw new We(D.status,V,O?.error?.message??`The server answered ${D.status}.`)}return await D.json()}return{kind:"http",capabilities:{attachments:"none",realtime:"none",anchorReports:!0,identity:["guest"],export:[],serverSideSearch:!1,privateThreads:!1,assignees:!1},async init(p){const m=await g("/config");return this.capabilities.attachments=m.features.screenshots?"direct":"none",{uid:p.uid,env:p.env,features:m.features,...m.rounds?{rounds:m.rounds}:{},...m.writable===void 0?{}:{writable:m.writable},...m.reason===void 0?{}:{reason:m.reason}}},async reportAnchors(p){if(p.length!==0)for(let m=0;m<p.length;m+=50)try{await g("/anchor-reports",{method:"POST",body:JSON.stringify({reports:p.slice(m,m+50)})})}catch{return}},revalidate:y,getRound(){return s?.round??Yt(t)?.round??null},setRound(p){s&&(s={...s,round:p});const m=Yt(t);m&&Yn(t,{...m,round:p})},async uploadAttachment(p,m){const h=await R(),C=await fetch(`${l}/attachments`,{method:"POST",credentials:"omit",headers:{"content-type":p.type||"image/webp",[It.attachmentKind]:m.kind,...m.width?{[It.attachmentWidth]:String(m.width)}:{},...m.height?{[It.attachmentHeight]:String(m.height)}:{},...h?{Authorization:`Bearer ${h}`}:{}},body:p});if(!C.ok){const O=await C.json().catch(()=>null);throw new We(C.status,O?.error?.code??"upload_failed",O?.error?.message??"Upload failed.")}const D=await C.json();return{id:D.id,kind:m.kind,contentType:D.contentType,byteSize:D.byteSize,...m.width?{width:m.width}:{},...m.height?{height:m.height}:{},url:`${r}/api/v1/attachments/${D.id}/blob`}},async listThreads(p){await R();const m=new URLSearchParams;n&&m.set("env",n),p?.route&&m.set("route",p.route),s?.round&&m.set("round",String(s.round));const h=await g(`/threads?${m}`);return{data:h.data.map(C=>wt(C,n)),...h.nextCursor?{nextCursor:h.nextCursor}:{},deleted:[],serverTime:h.serverTime}},async getThread(p){return(await this.listThreads()).data.find(h=>h.id===p)??null},async getThreadByKey(p){const m=new URLSearchParams({key:p});n&&m.set("env",n);const C=(await g(`/threads?${m}`)).data[0];return C?wt(C,n):null},async createThread(p){const m=await g("/threads",{method:"POST",body:JSON.stringify({id:p.id,anchor:Sa(p.anchor,p.route),anchorState:p.anchorState,context:p.context,...n?{scope:{environment:n}}:{},createdBy:{name:p.createdBy.name},...p.comment?{comment:{id:p.comment.id,body:p.comment.body}}:{},...p.attachments?.length?{attachments:p.attachments.map(h=>h.id)}:{}})});return wt(m,n)},async patchThread(p,m){if(!m.status)return null;const h=await g(`/threads/${encodeURIComponent(p)}`,{method:"PATCH",body:JSON.stringify({status:m.status})});return wt(h,n)},async deleteThread(){throw new We(501,"not_implemented","Deleting a snag is not built yet.")},async createComment(p,m){const h=await g(`/threads/${encodeURIComponent(p)}/comments`,{method:"POST",body:JSON.stringify({id:m.id,body:m.body})});return{id:h.id,snagId:p,body:h.body,author:h.author,createdAt:h.createdAt}},async patchComment(p,m){return await g(`/comments/${encodeURIComponent(p)}`,{method:"PATCH",body:JSON.stringify({body:m})}),null},async deleteComment(p){await g(`/comments/${encodeURIComponent(p)}`,{method:"DELETE"})}}}const ka=64,$a=4096,Ea=e=>le.counts(e),Ca=e=>e.filter(t=>t.status!=="resolved").length;function Ta(e,t,n){const o=new Map;for(const s of t){const d=o.get(s.route)??{n:0,seen:""};s.status!=="resolved"&&d.n++,s.updatedAt>d.seen&&(d.seen=s.updatedAt),o.set(s.route,d)}o.has(n)||o.set(n,{n:0,seen:new Date().toISOString()});const l=[...o.entries()].sort((s,d)=>d[1].seen.localeCompare(s[1].seen)).slice(0,ka);l.some(([s])=>s===n)||(l[l.length-1]=[n,o.get(n)]);let u={v:1,p:Ca(t),r:Object.fromEntries(l.map(([s,d])=>[s,d.n])),t:new Date().toISOString()};JSON.stringify(u).length>$a&&(u={...u,r:{}});try{localStorage.setItem(Ea(e),JSON.stringify(u))}catch{return null}return u}function Ra(e,t){return e?.r[t]??0}const _a="pass(?:word|wd)?|pwd|secret|token|api[_-]?key|apikey|auth(?:orization)?|credential|session|sid|cookie|jwt|bearer|otp|mfa|totp|cvv|cvc|ssn|nino|iban|card(?:[_-]?number)?|account[_-]?number|private[_-]?key|signature|client[_-]?secret|refresh[_-]?token|access[_-]?token",Pa=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${_a})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),za=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,Ia=(e,t,n,o,r,l,u)=>{if(!n&&za.test(r)&&u.slice(l+e.length).startsWith(" [redacted]")||(n?o:r).startsWith("[redacted"))return e;const s=n?`${n}${o}${n}`:r;return e.slice(0,e.length-s.length)+(n?`${n}[redacted]${n}`:"[redacted]")},Xn=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,Kn=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,qn=/\b(sk-[A-Za-z0-9]+-[A-Za-z0-9_-]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{20,}|(sk|pk|rk)_(live|test)_[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{16,}|xox[baprs]-[A-Za-z0-9-]{10,}|xapp-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|ya29\.[A-Za-z0-9_-]{20,}|SG\.[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{30,}|dop_v1_[a-f0-9]{40,}|shpat_[a-f0-9]{30,}|sbp_[a-f0-9]{30,}|hf_[A-Za-z0-9]{30,}|nvapi-[A-Za-z0-9_-]{20,})\b/g,Ma=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,Jn=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z]{2,24})+\b/g,Kt=/\b(?:\d[ -]?){12,18}\d\b/g,Qn=/\b(?=[A-Za-z0-9+/]*[a-z])(?=[A-Za-z0-9+/]*[A-Z])(?=[A-Za-z0-9+/]*\d)[A-Za-z0-9+/]{40,}={0,2}\b/g,Gn=/\b[0-9a-f]{32,}\b/gi,eo=/\b(?=[A-Za-z0-9_-]*[a-z])(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{40,}\b/g,to=/\b[a-z][a-z0-9]{1,15}(?:_[a-z0-9]{1,15}){0,2}_(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,no=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,Oa=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function $e(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function oo(e){const t=e.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let n=0,o=!1;for(let r=t.length-1;r>=0;r--){let l=t.charCodeAt(r)-48;o&&(l*=2,l>9&&(l-=9)),n+=l,o=!o}return n%10===0}function La(e){Kt.lastIndex=0;for(const t of e.matchAll(Kt))if(oo(t[0]))return!0;return!1}function xt(e){let t=e;return t=t.replace(Xn,"data:[redacted]"),t=t.replace(Ma,"$1 [redacted]"),t=t.replace(Pa,Ia),t=t.replace(Kn,"[redacted:jwt]"),t=t.replace(qn,"[redacted:key]"),t=t.replace(to,"[redacted:key]"),t=t.replace(no,"[redacted:url-cred]@"),t=t.replace(Jn,"[redacted:email]"),t=t.replace(Kt,n=>oo(n)?"[redacted:card]":n),t=t.replace(eo,n=>`[redacted:b64:${n.length}]`),t=t.replace(Qn,n=>`[redacted:b64:${n.length}]`),t=t.replace(Gn,n=>`[redacted:hex:${n.length}]`),t}const Da=mt.query,Na=mt.fragment;function Ha(e,t=[]){let n;try{const o=globalThis.location?.href;n=new URL(e,o)}catch{return xt(e)}n.username="",n.password="";for(const o of[...n.searchParams.keys()]){if(Na.includes(o)){n.searchParams.set(o,"[redacted]");continue}if(Da.includes(o))continue;if(!t.includes(o)){n.searchParams.set(o,"[redacted]");continue}const r=n.searchParams.get(o)??"";xt(r)!==r&&n.searchParams.set(o,"[redacted]")}return n.hash&&n.hash.length>1&&(n.hash=t.includes("#")?n.hash:"#[redacted]"),xt(n.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}function Wa(e){return e.length>120?!0:$e(Jn,e)||$e(Kn,e)||$e(qn,e)||$e(Gn,e)||$e(Qn,e)||$e(Xn,e)||$e(eo,e)||$e(to,e)||$e(no,e)||Oa.test(e)||La(e)}const St={id:"rev_local",name:B("author.unknown"),kind:"guest"},ja="0.0.0";function ro(e,t){if(e)return{...St,name:e,...t?{email:t}:{}};try{const n=localStorage.getItem(le.identity);if(n)return{...St,name:n[0]==="{"?JSON.parse(n).name??St.name:n}}catch{}return St}function Ba(e){return`SN-${e.reduce((n,o)=>{const r=Number(o.key.split("-")[1]??0);return Number.isFinite(r)&&r>n?r:n},0)+1}`}let qt=null;const ve=e=>Lr(e,qt);function Fa(e,t){const n=bn(),o=n.ownerDocument??document,r=o.defaultView??window,l=t?.config?.site??"local",u=t?.emit??(()=>{}),s=t?.assetBase??"./",d=t?.config?.env??"default";et(n,"tokens",Ho);const y=jo(n.host,Wo(t?.config?.theme)),w={},R=t?.config?.storage==="local"?void 0:t?.config?.host,g=R&&l!=="local"?Aa(R,l,t?.config?.env,{reviewToken:t?.reviewToken,onSessionEnded:a=>{re.show(a==="revoked"?"error.linkrevoked":"error.sessionended")},onSessionStarted:()=>re.hide()}):fa(l,d,{put:(a,i)=>w.put(a,i),del:a=>w.del(a)}),p=ma(l,d);let m=null;g.init({uid:l,env:d}).then(a=>{m=a.rounds??null,U?.update(x()),a.writable===!1&&a.reason==="origin_not_allowed"&&re.show("error.origin",void 0,{origin:location.origin})}).catch(()=>{});let h=[],C=[];const D=ua();let O=null,V=null,oe=!1,Y=!1,Ee=!1,ee=null,te=!1;const ze={get:()=>O,unavailable:()=>Y||Ee,newPass:()=>V?.createPassCaches(),fuzzyHit:a=>ee?.hit(a)??null,wantFuzzy:(a,i)=>{if(ee){ee.enqueue(a,i,()=>Q());return}te||!V||!i.text?.exact||i.text.exact.length<8||(te=!0,_e("anchor-fuzzy",s,o).then(f=>{if(!f.ok||!V){Ee=!0,Q();return}ee=f.mod.createFuzzyEngine(o,V.fuzzyDeps),Te()}))},want:a=>{oe||!(a.role&&a.accessibleName)&&!a.text?.exact&&!a.path?.length||(oe=!0,_e("anchor-ext",s,o).then(i=>{if(!i.ok){Y=!0,Q();return}V=i.mod,O=i.mod.resolveExtended,Te()}))}};let he=null,c=kr();const _=()=>c.statuses.length>0||!!c.by||!!c.page||c.read!=="all",S=hr(n,a=>{if(I==="add"){if(N?.hasText()){N.pulse();return}N?.close(),N=null,fe("comments")}v(a.id)},ze,a=>{he=a,U?U.update(x()):v()});let I=(()=>{try{return sessionStorage.getItem(le.mode)==="comments"?"comments":"browse"}catch{return"browse"}})(),N=null,U=null,G=null,je=!1,we=null,Be=!1,At=null,Ce=null,xe=null,Ie=!1;function de(){return xe?Promise.resolve(xe):Ie?Promise.resolve(null):_e("capture",s,o).then(i=>i.ok?(w.put=i.mod.putBlob,w.del=i.mod.deleteBlob,xe=i.mod):(Ye(new Error("chunk unavailable")),null))}function Ye(a){Ie||(Ie=!0,I==="add"&&fe("comments"),q.setDegraded(!0),re.show("error.capture",{label:"action.retry",run:()=>{Ie=!1,q.setDegraded(!1),de()}}),console.warn(`[${be}] the capture chunk failed to load`,a))}let Xe=0;function Me(){const a=new URL(s,o.location.href).href,i=new URL(Re.panels,a);return i.searchParams.set("cv",ja),Xe>0&&i.searchParams.set("r",String(Xe)),Xe++,import(i.href)}async function Se(){if(Be)return null;if(we)return we.catch(()=>null);we=Me().catch(async()=>(await new Promise(a=>setTimeout(a,1e3)),Me()));try{return At=await we}catch(a){return we=null,rt(a),null}}function rt(a){Be=!0,I==="add"&&fe("comments"),q.setDegraded(!0),re.show("error.panels",{label:"action.retry",run:()=>{Be=!1,q.setDegraded(!1),v(G)}}),console.warn(`[${be}] the panels chunk failed to load`,a)}const Ae=o.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;let ie=null;async function kt(){if(ie)return;const a=await de();!a||ie||(ie=a.createAddChrome(n,Ae,{pick:(i,f)=>void $(i,f),announce:qe}),ie.setActive(I==="add"))}const ue=o.createElement("div");ue.style.cssText=`position:fixed;left:0;top:0;pointer-events:none;z-index:${Ve.dock}`,n.appendChild(ue);const at=Tr(r,ue,a=>q.setPuck(a>1.2)),re=gr(n,ue),Fe=br(n,ue),A=Ko(n,{onPick:(a,i)=>void $(a,i),onHover:a=>a?ie?.show(a):ie?.clear(),onSelectStart:()=>{Ae||tn()}});async function $(a,i){if(N?.hasText()){N.pulse();return}N?.close();const[f,T]=await Promise.all([Se(),de()]);if(!f||!T)return;const j=T.captureContext({page:T.derivePageRef(o.location,dt()),...ft()});fn(a);const Z=T.deriveAnchorLabel(a);b(f,a,i,j,Z,T)}function b(a,i,f,T,j,Z,F,He){let ge=i;ut=!1;const pe=ve(o);Tt=!1;const pt=()=>{N=null,jn(pe),q.setDraft(Bt()),fe("comments")},Ge=()=>{Qe?.abort(),Ne=Qe=null,pt()},ye={at:f,label:j,...F?{initialBody:F.body,initialName:F.author,...F.email?{initialEmail:F.email}:{}}:{},onDraft:(ae,se,ht)=>{const wo=Qr({route:pe,body:ae,author:se,...ht?{email:ht}:{},label:j,anchor:He??Z.createElementAnchor(i,{point:f,viewportWidth:r.innerWidth,label:j,...Z.describeElement(i)}),at:{x:f.x+r.scrollX,y:f.y+r.scrollY},savedAt:new Date().toISOString()});q.setDraft(Bt()),!wo&&!Tt&&(Tt=!0,an())},onSend:(ae,se,ht)=>{pt(),sn(ge,f,T,ae,se,ht,He)},onRetarget:ae=>{const se=ae==="up"?Z.widen(ge):Z.narrow(ge);se&&(ge=se,ie?.show(se),N?.setLabel(Z.deriveAnchorLabel(se)))},...ce&&Je!==!1?{onShotOptIn:ae=>ut=ae}:{},onCancel:Ge,crumbsOn:un!==!1,shotsOn:Je!==!1,...R&&l!=="local"?{serverHost:new URL(R).host}:{},...He?.text?.exact?{quote:He.text.exact}:{}};N=a.openComposer(n,ye,ue),J()}async function H(){const a=ve(o),i=Gr(a);if(q.setDraft(Bt()),!i||N)return;const[f,T]=await Promise.all([Se(),de()]);if(!f||!T)return;const j=Ht(i.anchor,o,{viewportWidth:r.innerWidth,...O?{extended:O}:{}});if(!j.element)return;const Z=j.element.getBoundingClientRect();if(Z.width===0&&Z.height===0)return;const F={x:i.at.x-r.scrollX,y:i.at.y-r.scrollY};fe("add"),b(f,j.element,F,T.captureContext({page:T.derivePageRef(o.location,dt()),...ft()}),i.label,T,{body:i.body,author:i.author,...i.email?{email:i.email}:{}})}async function v(a=null){if(a&&a!==G&&u("thread:open",{threadId:a}),a&&p.mark(a),G=a,je=!0,I==="browse"&&fe("comments"),U){U.update(x());return}if(!await Se())return;const f=await _e("dock",s,o);if(!f.ok){re.show("error.panels",{label:"action.retry",run:()=>void v(G)});return}!je||U||(Ce=f.mod,U=f.mod.openDock(n,x(),ue),J())}function M(){p.markAll(h),c.newOnly&&(c={...c,newOnly:!1}),je=!1,U?.close(),U=null,G=null,S.highlight(null),J(),_()&&Q()}function E(a){const i=a?h.find(f=>f.id===a):void 0;if(i&&i.route!==ve(o)){Sr(r,i.id),r.location.assign(i.route);return}a&&p.mark(a),G=a,S.highlight(null),_()?Q():U?.update(x()),i&&Ce?.scrollToSnag(r,n,i)}function x(){return{snags:h,route:ve(o),openId:G,seenAt:p.map(),onOpen:E,onStatus:(a,i)=>void co(a,i),onReply:(a,i)=>void lo(a,i),onEdit:(a,i)=>void X(a,i),onDeleteComment:a=>void L(a),onDeleteThread:a=>void W(a),onClearAll:()=>void K(),onClose:M,onExport:Ct,onHover:a=>S.highlight(a),...m&&m.length>1&&g.setRound?{rounds:m,activeRound:g.getRound?.()??m.find(a=>!a.closed)?.number??m[0].number,onRound:a=>{g.setRound(a),Te()}}:{},onAnnounce:qe,loadShot:async a=>{const i=await de();return i?(await i.getBlob(a))?.blob??null:null},filter:c,onFilter:a=>{const i=a.statuses.join()!==c.statuses.join()||a.by!==c.by||a.page!==c.page||a.read!==c.read;c=a,i?Q():U?.update(x())},...he?{clusterFilter:he}:{},onClusterClear:()=>{he=null,U?.update(x())},onShowAnyway:a=>{S.showGhost(a),Ce?.scrollToSnag(r,n,a)}}}async function ne(a,i){const f=h;h=a,Q();try{await Le(i)}catch{h=f,Q(),re.show("error.sendfailed",void 0,{item:"change"})}}async function X(a,i){await ne(h.map(f=>({...f,comments:f.comments.map(T=>T.id===a?{...T,body:i}:T)})),()=>g.patchComment(a,i))}async function L(a){await ne(h.map(i=>({...i,comments:i.comments.filter(f=>f.id!==a)})),()=>g.deleteComment(a))}async function W(a){const i=G;G===a&&(G=null),await ne(h.filter(f=>f.id!==a),()=>g.deleteThread(a)),h.some(f=>f.id===a)&&(G=i)}async function K(){const a=h.map(i=>i.id);h=[],G=null,Q(),await Promise.all(a.map(i=>Le(()=>g.deleteThread(i))))}const q=aa(n,{onState:a=>fe(a),onPanel:()=>U?M():void v(),onNav:a=>Gt(a),parent:ue}),ce=r.matchMedia?.("(pointer: coarse)").matches??!1,J=()=>{ce&&q.setConcealed(!!N||!!U)};let me=null,Oe=[];function st(a){let i=!1;const f=()=>{i||(i=!0,r.removeEventListener("scrollend",f),a())};r.addEventListener("scrollend",f,{once:!0}),r.setTimeout(f,600)}const Ke=o.createElement("div");Ke.setAttribute("aria-live","polite"),Ke.setAttribute("role","status");const Jt="position:absolute;width:1px;height:1px;overflow:hidden";Ke.style.cssText=Jt;const $t=o.createElement("div");$t.setAttribute("aria-live","assertive"),$t.style.cssText=Jt,n.append(Ke,$t);let Qt=0;function qe(a){r.clearTimeout(Qt),Qt=r.setTimeout(()=>{Ke.textContent=a},400)}function Gt(a){const i=Oe.length;if(i===0)return;me=me===null?a===1?0:i-1:(me+a+i)%i;const f=Oe[me];ia(r,n,f);const T=me+1;st(()=>{S.pulse(f.id),qe(B("nav.announce",{n:T,label:f.anchor.label,i:T,total:i}))})}function en(){if(I!=="comments"||Ae){ke?.disarm();return}tn().then(a=>{a&&I==="comments"&&a.arm()})}let ke=null,Et=null;async function tn(){if(ke)return ke;const a=await _e("text",s,o);return!a.ok||ke||(Et=a.mod,ke=a.mod.createSelectionWatcher(n,{onQuote:(i,f)=>void ao(i,f)})),ke}async function ao(a,i){const f=xe??await de();if(!f||!Et)return;const T=Et.createTextAnchor(a,f,{viewportWidth:r.innerWidth,ourRoot:n});if(T.kind==="refused-form-control"){$(T.el,i);return}if(T.kind!=="text")return;const j=await Se();if(!j)return;const Z=f.captureContext({page:f.derivePageRef(o.location,dt()),...ft()});try{a.removeAllRanges()}catch{}b(j,T.el,T.point,Z,T.label,f,void 0,T.record)}function fe(a,i=!1){const f=I;I=a,a!=="add"&&N&&!i&&(N.close(),N=null),a==="add"&&U&&M(),a==="add"&&(Se(),de());try{sessionStorage.setItem(le.mode,a==="add"?"comments":a)}catch{}A.setMode(a),a!==f&&qe(B(`toolbar.${a}`)),J(),a==="add"&&kt(),en(),ie?.setActive(a==="add"),q.setState(a),Q(),a!==f&&u("modechange",{mode:a,previous:f})}let Ue=0,nn=0;const on=[300,800,1600,3200];function so(){if(Ue||!S.hasPending()){S.hasPending()||(nn=0);return}const a=on[Math.min(nn++,on.length-1)];Ue=r.setTimeout(()=>{Ue=0,Q()},a)}const io=3e3;let rn=0;function Q(a){const i=a??(Date.now()<rn?"navigating":"authoritative");C=S.reanchor(h.filter(yo()),i),go(),so();const f=new Map(C.map(F=>[F.id,F]));h=h.map(F=>f.get(F.id)??F);const T=_()?new Set(C.filter(F=>!Er(F,c,p.map())&&F.id!==G).map(F=>F.id)):void 0;Oe=T?C.filter(F=>!T.has(F.id)):C,S.render(I==="browse"?[]:C,T);const j=ve(o),Z=D?Ta(o.location.origin,h,j):null;q.setCount(Z?Ra(Z,j):D?C.filter(F=>F.status!=="resolved").length:null),me!==null&&me>=Oe.length&&(me=null),U?.update(x())}async function Te(){const{data:a}=await g.listThreads();h=a,Q();const i=S.settled();for(const f of i)u("anchor:settled",{threadId:f.id,state:f.state,strategy:f.strategy,confidence:f.confidence});return g.capabilities.anchorReports&&g.reportAnchors&&i.length&&Le(()=>g.reportAnchors(i.map(f=>({threadId:f.id,state:f.state,confidence:f.confidence,strategy:f.strategy})))),g.capabilities.anchorReports||await Promise.all(a.flatMap(f=>{const T=h.find(j=>j.id===f.id);return!T||T.anchorState===f.anchorState?[]:[Le(()=>g.patchThread(T.id,{anchor:T.anchor,anchorState:T.anchorState}))]})),C}async function co(a,i){h=h.map(f=>f.id===a?{...f,status:i}:f),Q(),u("thread:resolve",{threadId:a,status:i}),await Le(()=>g.patchThread(a,{status:i}))}async function lo(a,i){const f={id:Un(),body:i,author:ro()};h=h.map(T=>T.id===a?{...T,comments:[...T.comments,{...f,snagId:a,createdAt:new Date().toISOString()}]}:T),p.mark(a),Q(),u("comment:create",{threadId:a,comment:f}),await Le(()=>g.createComment(a,f))}function an(){re.show("error.quota",{label:"action.exportclear",run:()=>{Ct("json"),K()}}),console.warn(`[${be}] ${B("error.quota")}`)}async function Le(a){try{return await a()}catch(i){if(i instanceof Ot&&i.code==="local_quota_exceeded")return an(),null;throw i}}function Ct(a){de().then(async i=>{if(!i)return;const f=await i.resolveAttachmentUris(h).catch(()=>new Map);i.download(n,i.buildExport(a,h,{origin:o.location.origin,exportedAt:new Date().toISOString()},f),r)})}async function sn(a,i,f,T,j,Z,F){const He=ro(j,Z),ge=xe??await de();if(!ge)throw new Error(`[${be}] add() needs the capture chunk`);Ne||fn(a);const pe=Ne?await Ne:null;Ne=Qe=null,ge.applyShotOutcome(f,pe,Je===!1,ce&&!ut);const pt=pe?.blob&&g.uploadAttachment?g.uploadAttachment(pe.blob,{kind:"screenshot",...pe.width!==void 0?{width:pe.width}:{},...pe.height!==void 0?{height:pe.height}:{}}).catch(()=>null):Promise.resolve(null),Ge={id:ca(),key:Ba(h),route:ve(o),anchor:F??ge.createElementAnchor(a,{point:i,viewportWidth:r.innerWidth,label:ge.deriveAnchorLabel(a),...ge.describeElement(a)}),anchorState:"anchored",scope:ho(),context:f,createdBy:He,createdAt:new Date().toISOString(),...T?{comment:{id:Un(),body:T,author:He}}:{}},ye=En(Ge);pe?.blob&&(ye.screenshotBlob=pe.blob),h=[...h,ye],p.mark(ye.id),qe(B("announce.created",{key:ye.key})),u("thread:create",{thread:ye}),I==="browse"?fe("comments"):Q();try{const ae=await pt;ae&&(Ge.attachments=[ae],h=h.map(se=>se.id===ye.id?{...se,attachments:[ae]}:se),Q()),await Le(()=>g.createThread(Ge))}catch(ae){throw h=h.filter(se=>se.id!==ye.id),Q(),re.show("error.sendfailed",void 0,{item:_t.toLowerCase()}),console.warn(`[${be}] ${B("error.sendfailed",{item:_t.toLowerCase()})}`,ae),ae}return ye}function cn(a){if((a.key==="n"||a.key==="p")&&I==="comments"&&!N){if(a.metaKey||a.ctrlKey||a.altKey)return;const i=a.target;if(i&&(i.closest?.("input,textarea,select,[contenteditable]")||i.isContentEditable))return;a.preventDefault(),a.stopPropagation(),Gt(a.key==="n"?1:-1);return}I==="add"&&a.key==="Escape"&&(N||(a.stopPropagation(),fe("comments")))}o.addEventListener("keydown",cn,!0);let ln=0;const dn=()=>{if(o.hidden||!g.revalidate)return;const a=Date.now();a-ln<3e4||(ln=a,g.revalidate())};o.addEventListener("visibilitychange",dn);const uo=Io(n),fo=Mo(n,a=>{console.warn(`[${be}] the host page hid the widget from assistive technology ${a} times; leaving it alone.`)}),po=zo(n,a=>{console.warn(`[${be}] the host page removed the widget ${a} times; leaving it alone. Reload to comment again.`)});function ho(){return{environment:d,...t?.config?.branch?{branch:t.config.branch}:{}}}let it={route:ve(o),url:o.location.href},Tt=!1,ct=null;function mo(a){if(a){if(I==="browse")return;ct=I,fe("browse",!0),Fe.show(),u("paused",{reason:"modal-dialog"})}else if(ct){const i=ct;ct=null,Fe.hide(),fe(i),u("resumed",{mode:i})}}Se();function go(){C.length>0&&_e("dock",s,o)}{const a=o.createElement("div");a.style.cssText="position:fixed;inset:0;pointer-events:none;visibility:hidden",n.appendChild(a);const i=a.getBoundingClientRect(),f=Math.abs(i.left)>1||Math.abs(i.top)>1||Math.abs(i.width-r.innerWidth)>1||Math.abs(i.height-r.innerHeight)>1;a.remove(),f&&(console.warn(`[${be}] fixed-trapped: <html> has transform/filter/contain, so our fixed layer follows it, not the viewport. Remove it, or expect drift.`),u("error",{code:"fixed-trapped"}))}let Ze=null;const lt=new Set,De=(()=>{const a=r[ko.config];return a&&typeof a=="object"?a:void 0})(),un=De?.breadcrumbs,Rt=(()=>{const a=De?.significantQueryParams,i=De?.ignoredQueryParams,f={};return a==="*"?f.significantQueryParams="*":Array.isArray(a)&&(f.significantQueryParams=a.map(String)),Array.isArray(i)&&(f.ignoredQueryParams=i.map(String)),f})(),dt=()=>({routeOverride:qt,query:Rt,doc:o}),Je=De?.screenshot===!1?!1:De?.screenshot&&typeof De.screenshot=="object"?De.screenshot:{};let ut=!1,Ne=null,Qe=null;function fn(a){if(Je===!1||Ne||ce&&!ut)return;Qe=new AbortController;const i=Qe.signal;Ne=_e("screenshot",s,o).then(f=>f.ok?f.mod.captureScreenshot({doc:o,target:a,signal:i,...Je}):{situation:"engine-load-failed",blindSpots:[],maskedCount:0})}function yo(){const a=ve(o),i=Nn(o.location.pathname),f=Wr(o.location.search,Rt);return T=>(T.route===a||T.context?.page?.pathname===i)&&jr(T.context?.page?.query,f,Rt)}{const a=un;a!==!1&&_e("crumbs",s,o).then(i=>{i.ok&&(Ze=i.mod.installTierC({win:r,...t?.early?{early:t.early}:{},...a&&typeof a=="object"?{config:a}:{},subscribeNav:f=>(lt.add(f),()=>lt.delete(f))}))})}const ft=()=>Ze?{breadcrumbs:{records:Ze.drain(),status:Ze.status()}}:{},bo=Vr(o,r,()=>{I!=="browse"&&C.length>0&&Q()}),vo=xr(r,{onResize:()=>Q(),onRoute:()=>{const a={route:ve(o),url:o.location.href},i=a.route!==it.route;if(i){u("navigate",{from:it,to:a});for(const f of lt)f(it.url,a.url)}if(it=a,!i){Te();return}rn=Date.now()+io,r.setTimeout(()=>{g.listThreads().then(({data:f})=>{h=f,Q("optimistic")})},100),r.setTimeout(()=>void Te(),600)},onModal:mo});return q.setState(I),A.setMode(I),en(),D||re.show("error.nostorage",{label:"action.export",run:()=>Ct("md")}),Te().then(async a=>{const i=Ar(r);if(!i){const T=new URLSearchParams(o.location.search).get(Ro("t"));if(T){let j=a.find(Z=>Z.key===T);if(!j&&g.getThreadByKey){const Z=await g.getThreadByKey(T).catch(()=>null);Z&&(h=[...h.filter(F=>F.id!==Z.id),Z],Q(),j=h.find(F=>F.id===Z.id))}j?(await v(j.id),Ce?.scrollToSnag(r,n,j)):(re.show("permalink.unknown"),await v(null));return}await H();return}const f=a.find(T=>T.id===i);await v(f?i:null),f&&Ce?.scrollToSnag(r,n,f)}),{root:n,assetBase:t?.assetBase??"",snags:()=>C,async add(a,i,f,T){const j=T?null:await de(),Z=T??(j?j.captureContext({page:j.derivePageRef(o.location,dt()),...ft()}):void 0);if(!Z)throw new Error(`[${be}] add() needs the capture chunk, or an explicit context`);return sn(a,i,Z,f)},refresh:Te,setRoute(a){qt=a&&a.startsWith("/")?a:null,Te()},setState:fe,getState:()=>I,openPanel:v,async open(a){const i=a.startsWith(gt.thread)?h.find(f=>f.id===a):h.find(f=>f.key===a);return i?i.route!==ve(o)?{ok:!1,reason:"wrong-page",url:i.context?.url??i.route,route:i.route}:(await v(i.id),Ce?.scrollToSnag(r,n,i),{ok:!0,anchorState:i.anchorState}):{ok:!1,reason:"not-found"}},closePanel:M,hitTest:(a,i)=>A.hitTest(a,i),destroy(){N?.close(),M(),ie?.destroy(),re.destroy(),Fe.destroy(),at(),po(),fo(),uo(),vo.destroy(),bo.destroy(),Ze?.destroy(),Ze=null,lt.clear(),ke?.destroy(),ke=null,ee?.destroy(),ee=null,Ue&&r.clearTimeout(Ue),Ue=0,o.removeEventListener("keydown",cn,!0),o.removeEventListener("visibilitychange",dn),y(),A.destroy(),S.destroy(),q.destroy(),n.host.remove()}}}export{gn as HOST_CSS,bn as createHost,Wa as isSensitiveValue,Fa as mount,xt as redactText,Ha as redactUrl};
1
+ const be="Snagset",xo="snagset",hn="snagset.v1",So="Snagset",_t="Snag",Ao="Snags",ko={config:"SnagsetConfig"},$o={root:"data-snag-root"},Pt=e=>$o[e],Eo={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},Co=e=>Eo[e],I={font:"--snag-font",accent:"--snag-accent",onAccent:"--snag-onAccent",bg:"--snag-bg",fg:"--snag-fg",muted:"--snag-muted",border:"--snag-border",radius:"--snag-radius",shadow:"--snag-shadow",z:"--snag-z",motion:"--snag-motion",surface:"--snag-surface",sunken:"--snag-sunken",hover:"--snag-hover",focus:"--snag-focus",disabled:"--snag-disabled",statusOpen:"--snag-status-open",statusProgress:"--snag-status-progress",statusReview:"--snag-status-review",statusResolved:"--snag-status-resolved",anchorOrphan:"--snag-anchor-orphan",tbH:"--snag-tb-h",dockW:"--snag-dock-w",kb:"--snag-kb",thumbX:"--snag-thumb-x",thumbW:"--snag-thumb-w"},To=e=>`var(${I[e]})`,Ro=e=>"snag_"+e,mt={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},_o="snag:disclosure:v1",It="snag:identity",pn="data-snag-theme",le={session:e=>`snag:session:${e}`,identity:It,threads:(e,t)=>`snag:threads:${e}:${t}`,seen:(e,t)=>`snag:seen:${e}:${t}`,counts:e=>`snag:counts:${e}`,draft:(e,t)=>`snag:draft:${e}:${t}`,outbox:e=>`snag:outbox:${e}`,mode:"snag:mode",handoff:"snag:handoff",seenCoach:"snag:seen-coach",disclosure:_o},Re={panels:"snag.panels.js",crumbs:"snag.crumbs.js",capture:"snag.capture.js",screenshot:"snag.screenshot.js",anchorExt:"snag.anchor-ext.js",anchorFuzzy:"snag.anchor-fuzzy.js",dock:"snag.dock.js",text:"snag.text.js"},gt={thread:"thr_",comment:"cmt_",attachment:"att_"},zt={attachmentKind:"x-snagset-attachment-kind",attachmentWidth:"x-snagset-attachment-width",attachmentHeight:"x-snagset-attachment-height"},Po={route:"snagset:route"},mn={original:"snagset.original",wrapped:"snagset.wrapped"},gn="position:absolute!important;top:0!important;left:0!important;width:0!important;height:0!important;margin:0!important;padding:0!important;border:0!important;pointer-events:none!important;z-index:2147483647;isolation:isolate;color-scheme:light dark;";function yn(e){const t=e.ownerDocument.defaultView?.getComputedStyle(e);return t?t.transform!=="none"&&t.transform!==""||t.filter!=="none"&&t.filter!==""||t.perspective!=="none"&&t.perspective!==""||/transform|filter|perspective|contain/.test(t.willChange)||/paint|layout|strict|content/.test(t.contain)||t.containerType!==void 0&&t.containerType!=="normal"&&t.containerType!=="":!1}function Mt(e){const t=e.documentElement,n=e.body;return t&&yn(t)?{parent:n??t,trapped:!0}:n&&yn(n)?{parent:t??n,trapped:!1}:{parent:n??t,trapped:!1}}function bn(e=document){const t=Pt("root"),n=e.querySelector(`[${t}]`);if(n?.shadowRoot)return n.shadowRoot;const o=e.createElement("div");return o.setAttribute(t,""),o.style.cssText=gn,Mt(e).parent.appendChild(o),o.attachShadow({mode:"open"})}function Io(e,t,n=5){const o=e.ownerDocument??document,r=e.host,l=Mt(o).parent;if(typeof MutationObserver!="function"||!l)return()=>{};let u=0;const s=new MutationObserver(()=>{if(!r.isConnected){if(u++,u>n){s.disconnect(),t(u);return}Mt(o).parent.appendChild(r)}});return s.observe(l,{childList:!0}),()=>s.disconnect()}const vn=[["pointerdown",!0],["mousedown",!0],["touchstart",!0],["pointerup",!0],["mouseup",!0],["touchend",!0],["click",!0],["dblclick",!0],["focusin",!0],["focusout",!0]];function zo(e){const t=e.host,n=o=>o.stopPropagation();for(const[o,r]of vn)t.addEventListener(o,n,{passive:r});return()=>{for(const[o]of vn)t.removeEventListener(o,n)}}function Mo(e,t,n=20){const o=e.host;if(typeof MutationObserver!="function")return()=>{};let r=0;const l=()=>{let s=!1;return o.getAttribute("aria-hidden")==="true"&&(o.removeAttribute("aria-hidden"),s=!0),o.hasAttribute("inert")&&(o.removeAttribute("inert"),s=!0),s},u=new MutationObserver(()=>{l()&&++r>n&&(u.disconnect(),t(r))});return l(),u.observe(o,{attributes:!0,attributeFilter:["aria-hidden","inert"]}),()=>u.disconnect()}const Oo={product:be,set:So,item:_t,items:Ao};function wn(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(o,r)=>{const l=n?.[r]??Oo[r];return l===void 0?o:String(l)})}const Lo=e=>new Intl.NumberFormat().format(e),xn={"where.anchored":"{label}","where.approximate":"position approximate \u2014 the page changed","where.orphaned":"moved \u2014 the element is gone","status.open":"Active","status.progress":"In progress","status.review":"In review","status.resolved":"Resolved","author.unknown":"Someone","label.image":"an image","label.link":"a link","label.button":"a button","label.tag":"the {tag}"},Sn=wn(xn),An={open:{colour:"#4f6ef7"},progress:{colour:"#f59e0b"},review:{colour:"#8b5cf6"},resolved:{colour:"#10b981"}},kn=e=>e==="open"||e==="review"?"#fff":"#16161a",$n=e=>e in An?Sn(`status.${e}`):e,Do=e=>Sn(`where.${e.anchorState}`,{label:e.anchor.label});class Ot extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function En(e){return{id:e.id,key:e.key,route:e.route,...e.scope?{scope:e.scope}:{},...e.attachments?.length?{attachments:e.attachments}:{},anchor:e.anchor,anchorState:e.anchorState,context:e.context,status:"open",comments:e.comment?[{id:e.comment.id,snagId:e.id,body:e.comment.body,author:e.comment.author,createdAt:e.createdAt}]:[],createdBy:e.createdBy,createdAt:e.createdAt,updatedAt:e.createdAt}}const k=Object.fromEntries(Object.keys(I).map(e=>[e,To(e)])),No=Object.entries(An).map(([e,t])=>` ${I[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
2
+ `),Ho=` :host{all:initial}[hidden]{display:none!important}:host{display:block;font:400 14px/1.45 ${k.font};color:${k.fg};${I.font}:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;${I.accent}:#2a51b8;${I.bg}:#fefdfc;${I.fg}:#181716;${I.muted}:#666564;${I.border}:#e4e3e0;${I.radius}:8px;${I.shadow}:0 6px 24px -4px rgb(0 0 0 / .18);${I.z}:2147483647;${I.motion}:160ms;${I.surface}:color-mix(in srgb,${k.fg} 6%,${k.bg});${I.sunken}:color-mix(in srgb,${k.fg} 3%,${k.bg});${I.hover}:color-mix(in srgb,${k.fg} 8%,${k.bg});${I.onAccent}:#fff;${I.focus}:color-mix(in srgb,${k.accent} 62%,${k.fg});${I.disabled}:color-mix(in srgb,${k.muted} 52%,${k.bg});${No} ${I.anchorOrphan}:#DC2626;}:host([${pn}="dark"]){${I.accent}:#8aafff;${I.onAccent}:#1d1c1a;${I.bg}:#1d1c1a;${I.fg}:#f0eeec;${I.muted}:#9a9997;${I.border}:#2d2c2b;${I.shadow}:0 6px 24px -4px rgb(0 0 0 / .6);}@media (prefers-reduced-motion:reduce){:host{${I.motion}:0ms}}@media (forced-colors:active){:host{${I.bg}:Canvas;${I.fg}:CanvasText;${I.muted}:CanvasText;${I.border}:CanvasText;${I.accent}:Highlight;${I.onAccent}:HighlightText;${I.surface}:Canvas;${I.sunken}:Canvas;${I.hover}:Canvas;${I.focus}:Highlight;${I.disabled}:GrayText;${I.shadow}:none;${I.anchorOrphan}:CanvasText;}.snag-pin{border-color:CanvasText!important;color:CanvasText!important;forced-color-adjust:none}}`,Ve={shield:1,pins:3,dock:5,notice:6,toolbar:7},Cn=new WeakMap;function et(e,t,n){let o=Cn.get(e);if(o||Cn.set(e,o=new Set),o.has(t))return;o.add(t);try{const u=new CSSStyleSheet;u.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,u];return}catch{}const l=(e.ownerDocument??document).createElement("style");l.setAttribute(`data-snag-${t}`,""),l.textContent=n,e.appendChild(l)}function Wo(e){return e==="light"||e==="dark"?e:"auto"}function Fo(e,t){const n=pn;if(t!=="auto")return e.setAttribute(n,t),()=>e.removeAttribute(n);const o=e.ownerDocument?.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");if(!o)return e.setAttribute(n,"light"),()=>e.removeAttribute(n);const r=()=>e.setAttribute(n,o.matches?"dark":"light");return r(),o.addEventListener("change",r),()=>{o.removeEventListener("change",r),e.removeAttribute(n)}}function Lt(e){return e.getBoundingClientRect()}function yt(e){if(e.closest('[inert],[aria-hidden="true"]'))return!1;const t=e.checkVisibility;if(typeof t=="function")return t.call(e,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const n=Lt(e);if(!(n.width>0||n.height>0||e.getClientRects().length>0))return!1;const r=e.ownerDocument?.defaultView;return r?r.getComputedStyle(e).visibility!=="hidden":!0}const Bo="button,a[href],[role=button],[role=link],[role=tab],[role=menuitem],label,input,select,textarea,summary",jo=3,Tn=8,Uo=new Set(["img","picture","canvas","video","audio","iframe","embed","object","svg","math","input","select","textarea","button","progress","meter"]);function Zo(e,t){return Uo.has(e.tagName.toLowerCase())?!1:t.getComputedStyle(e).display==="inline"}function Rn(e){const t=e.ownerDocument?.defaultView;if(!t)return e;let n=e;for(let r=e;r;r=r.parentElement){const l=Lt(r);if(l.width>=Tn&&l.height>=Tn&&!Zo(r,t)){n=r;break}n=r}let o=0;for(let r=n;r&&o<=jo;r=r.parentElement){if(r.matches(Bo))return r;o++}return n}const Vo=10,Dt=[["click",!1],["auxclick",!1],["dblclick",!1],["pointerdown",!1],["pointerup",!1],["mousedown",!1],["mouseup",!1],["contextmenu",!1],["dragstart",!1],["wheel",!1],["touchstart",!0],["touchmove",!0],["touchend",!0],["selectstart",!0],["keydown",!1],["keyup",!1]];function Yo(e,t,n){let o=e;for(;o&&o!==o.ownerDocument.documentElement&&o!==o.ownerDocument.body;){const r=getComputedStyle(o),l=(r.overflowY==="auto"||r.overflowY==="scroll")&&o.scrollHeight>o.clientHeight&&(t>0&&o.scrollTop+o.clientHeight<o.scrollHeight-1||t<0&&o.scrollTop>0),u=(r.overflowX==="auto"||r.overflowX==="scroll")&&o.scrollWidth>o.clientWidth&&(n>0&&o.scrollLeft+o.clientWidth<o.scrollWidth-1||n<0&&o.scrollLeft>0);if(l||u)return o;o=o.parentElement}return null}function _n(e,t){const n=t==="y"?e.deltaY:e.deltaX;return e.deltaMode===1?n*16:e.deltaMode===2?n*(t==="y"?innerHeight:innerWidth):n}const Xo=["position:fixed","inset:0",`z-index:${Ve.shield}`,"touch-action:pan-x pan-y pinch-zoom","background:transparent"].join(";");function Ko(e,t={}){const n=t.doc??e.ownerDocument??document,o=n.defaultView??window;let r=t.coarsePointer??o.matchMedia?.("(pointer: coarse)").matches??!1;const l=c=>{const _=c.pointerType,S=_==="touch"?!0:_==="mouse"||_==="pen"?!1:r;S!==r&&(r=S,d())},u=n.createElement("div");u.className="snag-shield",u.style.cssText=Xo;let s="browse";const d=()=>{u.style.pointerEvents=r?"none":"auto",u.style.cursor="crosshair"};d();const y=c=>{const _=c;return!_||typeof _.closest!="function"?!1:e.contains(_)?!0:!!_.closest(`[${Pt("root")}]`)};function w(c,_,S){let P=S,z=0;for(;P.shadowRoot&&z++<Vo;){const N=R(P.shadowRoot,c,_);if(!N||N===P)break;P=N}return P}function R(c,_,S){const P=c.elementsFromPoint;if(typeof P=="function"){for(const N of P.call(c,_,S))if(N.getRootNode()===c)return N;return null}const z=c.elementFromPoint(_,S);return z&&z.getRootNode()===c?z:null}function g(c,_){const S=[];for(const P of n.elementsFromPoint(c,_)){if(y(P))continue;if(P===n.documentElement||P===n.body){S.push(P);continue}const z=w(c,_,P);S.push(y(z)?P:z)}return S}let h=null;const m=(c,_)=>{const[S]=g(c,_);S&&t.onPick?.(Rn(S),{x:c,y:_})};let p=!1;const E=()=>{const c=n.getSelection?.();if(!c||c.isCollapsed||c.rangeCount===0||!c.toString().trim())return!1;const _=c.anchorNode;if(!_||e.contains(_))return!1;const S=_.nodeType===1?_:_.parentElement;return!y(S)},D=c=>{const _=c.composedPath()[0];if(_&&y(_)){p=!1;return}if(c.type==="selectstart"){t.onSelectStart?.();return}const S=c.type;if(S.endsWith("down")||S.endsWith("start")){p=!1;return}if(S.endsWith("up")||S.endsWith("end")){p=E();return}if(S==="click"||S==="auxclick"){if(!p)return;p=!1,c.preventDefault(),c.stopImmediatePropagation()}},O=c=>{if(c.type==="pointerdown"&&l(c),s==="comments"){D(c);return}if(s!=="add")return;if(c.type==="keydown"||c.type==="keyup"){Ee(c);return}const _=c.composedPath()[0];if(_&&_!==u&&y(_))return;const S=Dt.find(([P])=>P===c.type)?.[1]??!1;if(c.stopImmediatePropagation(),!S){if(r&&c.type==="pointerdown"){const P=c;h={x:P.clientX,y:P.clientY,t:performance.now()},pe(P.clientX,P.clientY)}if(r&&c.type==="pointerup"&&h){const P=c,z=h;h=null,Math.hypot(P.clientX-z.x,P.clientY-z.y)<=8&&performance.now()-z.t<=700&&m(P.clientX,P.clientY);return}if(c.type==="click"||c.type==="auxclick"||c.type==="dblclick"){c.preventDefault();const P=c;m(P.clientX,P.clientY);return}if(c.type==="wheel"){const P=c,z=_n(P,"y"),N=_n(P,"x"),[U]=g(P.clientX,P.clientY),G=Yo(U??null,z,N);G&&(G.scrollTop+=z,G.scrollLeft+=N,c.preventDefault());return}if(c.type==="dragstart"||c.type==="contextmenu"){c.preventDefault();return}(c.type==="pointerdown"||c.type==="mousedown")&&!r&&c.preventDefault()}},V=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," ","Spacebar","PageUp","PageDown","Home","End"]),oe=/^[a-z0-9/?]$/;function Y(c){for(const _ of c.composedPath()){const S=_;if(!(!S||S.nodeType!==1||typeof S.matches!="function")&&S.matches('input:not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),textarea,select,[contenteditable=""],[contenteditable=true],[role=textbox],[role=searchbox],[role=combobox]'))return!0}return!1}function Ee(c){V.has(c.key)||c.metaKey||c.ctrlKey||c.altKey||/^F\d{1,2}$/.test(c.key)||c.key!=="Escape"&&c.key.length===1&&oe.test(c.key.toLowerCase())&&!Y(c)&&(c.preventDefault(),c.stopImmediatePropagation())}for(const[c,_]of Dt)o.addEventListener(c,O,{capture:!0,passive:_});let ee=0,te=null;function Ie(){if(ee=0,s!=="add"||!te)return;const[c]=g(te.x,te.y);t.onHover?.(c?Rn(c):null)}function pe(c,_){s==="add"&&(te={x:c,y:_},!ee&&(ee=o.requestAnimationFrame(Ie)))}return u.addEventListener("pointermove",c=>pe(c.clientX,c.clientY)),u.addEventListener("pointerleave",()=>{te=null,t.onHover?.(null)}),{shield:u,getMode:()=>s,setMode(c){s=c,p=!1,d(),c==="add"?e.appendChild(u):u.remove(),c!=="add"&&(te=null,t.onHover?.(null))},hitTest:g,destroy(){ee&&o.cancelAnimationFrame(ee);for(const[c]of Dt)o.removeEventListener(c,O,{capture:!0});u.remove()}}}const qo=/[\u200B-\u200D\u2060\uFEFF]/gu,Jo=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,Qo=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function Go(e){let t=e.normalize("NFC").replace(qo,"");for(const[n,o]of Qo)t=t.replace(n,o);return t.replace(Jo," ").trim()}const er={testid:1,domid:1,css:.9,aria:.75,"text-exact":.8,"text-fuzzy":.78,"path-rect":.35,none:0,manual:1},Pn={anchored:.75,approximate:.35};function tr(e,t){const n=er[e];return t===1?n:n/(1+Math.log2(t))}function In(e){return e>=Pn.anchored?"anchored":e>=Pn.approximate?"approximate":"orphaned"}const nr=[Co("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],zn=e=>typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/["\\]/g,"\\$&"),or=[{strategy:"testid",applicable:e=>!!e.testid,find:(e,t)=>Nt(t,nr.map(n=>`[${n}="${zn(e.testid)}"]`).join(","))},{strategy:"domid",applicable:e=>!!e.domid,find:(e,t)=>Nt(t,`#${zn(e.domid)}`)},{strategy:"css",applicable:e=>!!e.css,find:(e,t)=>{try{return Nt(t,e.css)}catch{return[]}}}];function Nt(e,t){return[...e.querySelectorAll(t)].filter(rr)}function rr(e){return!e.closest(`[${Pt("root")}]`)}function ar(e,t){const n=t.text?.exact;if(!n)return!0;const o=Go(e.textContent??"");return o?o===n||o.includes(n)||n.includes(o):!0}function Mn(e,t,n,o){yt(e)||o.push("hidden"),t.hostPath?.length&&o.push("shadow-boundary");const r=!ar(e,t);r&&o.push("text-drift");let l=o.includes("hidden")?Math.min(n,.7):n;return r&&(l=Math.min(l,.5)),l}const sr={element:null,strategy:"none",score:0,state:"orphaned",reasons:["not-found"],candidates:0};function Ht(e,t=document,n={}){const o=[];for(const r of or){if(!r.applicable(e))continue;const l=r.find(e,t);if(l.length===0)continue;const u=tr(r.strategy,l.length),s=l[0];l.length>1&&o.push("ambiguous");const d=Mn(s,e,u,o),y={element:s,strategy:r.strategy,score:d,state:In(d),reasons:o.length?o:["exact"],candidates:l.length};if(y.reasons.includes("text-drift")&&n.extended){const w=n.extended(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}});if(w&&w.score>y.score)return w}return y}return n.extended?.(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}})??sr}const ir={"toolbar.aria":"{product} review toolbar","toolbar.group":"What you see","toolbar.browse":"Browse","toolbar.comments":"Comment","toolbar.comments.unresolved":"Comment, {n} unresolved","toolbar.add":"Add a comment","toolbar.add.draft":"Add a comment \u2014 one is unfinished","toolbar.panel":"All comments","pin.aria":"Comment {key} on {target}. {status}, {replies} replies. Press Enter.","pin.aria.one":"Comment {key} on {target}. {status}, 1 reply. Press Enter.","pin.aria.none":"Comment {key} on {target}. {status}. Press Enter.","pin.aria.moved":"Comment {key} on {target}. {status}. {where}. Press Enter.","pin.target":"{role} \u201C{name}\u201D","cluster.aria":"{n} comments here: {list}","nav.announce":"Comment {n} on {label}, {i} of {total}","action.retry":"Retry","action.dismiss":"Dismiss","action.export":"Export","action.exportclear":"Export & clear","error.quota":"Storage is full \u2014 this {item} is on screen but not saved. Export to keep them.","error.nostorage":"Comments won't be saved in this browser. Export before you leave to keep them.","error.linkrevoked":"This review link was turned off. Ask whoever sent it for a new one.","error.sessionended":"This review session has ended. Open your review link again to carry on.","error.sendfailed":"That {item} couldn't be sent, so it wasn't kept. Check your connection and try again.","error.origin":"{product} is not enabled for {origin}. Add that address to the site's allowed origins.","error.panels":"{product} loaded, but its comment UI didn't. You can still see the comments on the page.","error.panels.add":"Adding comments is unavailable until the comment UI loads.","error.capture":"{product} can't take new comments \u2014 the part that records the page didn't load. Everything already here still works.","paused.dialog":"Review paused \u2014 a dialog is open on this page. Close it to carry on commenting. Commenting inside a native dialog isn't supported yet.","paused.close":"Close","announce.created":"Comment {key} added.","permalink.unknown":"That comment isn't on this page any more"},cr={...xn,...ir},B=wn(cr);function lr(e,t){const n=new Array(e.length),o=[],r=new Map,l=[];let u=0;for(let s=0;s<e.length;s++){u++;const d=e[s],y=Math.floor(d.x/t),w=Math.floor(d.y/t);let R=-1;e:for(let g=-1;g<=1;g++)for(let h=-1;h<=1;h++)for(const m of r.get(`${y+g},${w+h}`)??[]){const p=l[m],E=d.x-p.x,D=d.y-p.y;if(E*E+D*D<=t*t){R=m;break e}}if(R===-1){R=o.length,o.push([]),l.push(d);const g=`${y},${w}`,h=r.get(g);h?h.push(R):r.set(g,[R])}n[s]=R,o[R].push(s)}return{group:n,members:o,visits:u}}const dr=`position:absolute;top:0;left:0;width:0;height:0;pointer-events:none;z-index:${Ve.pins}`,ur=' .snag-pp{animation:snag-pp .5s ease-out 2}@keyframes snag-pp{50%{transform:scale(1.45)}}@media (prefers-reduced-motion: reduce){.snag-pp{animation:none}}.snag-pin{width:28px;height:28px;margin:-14px 0 0 -14px}.snag-pin::after{content:"";position:absolute;inset:-8px}@media (pointer:coarse){.snag-pin{width:34px;height:34px;margin:-17px 0 0 -17px}}',fr=`position:fixed;inset:0;width:0;height:0;pointer-events:none;z-index:${Ve.pins}`,tt=["position:absolute",`color:${k.onAccent}`,`font:600 12px/1 ${k.font}`,"display:flex","align-items:center","justify-content:center","box-shadow:0 1px 4px rgb(0 0 0 / .35)","pointer-events:auto","cursor:pointer","box-sizing:border-box"].join(";"),bt="border-radius:50% 50% 50% 2px",On=e=>k[`status${e[0].toUpperCase()}${e.slice(1)}`]??k.muted;function Ln(e,t){const n=kn(t.status),o=`background:${On(t.status)};color:${n}`,r="0 1px 4px rgb(0 0 0 / .35)";return e==="anchored"?`${tt};${bt};${o};border:2px solid ${n};box-shadow:${r}`:e==="approximate"?`${tt};${bt};${o};border:2px dashed ${n};box-shadow:${r}`:`${tt};${bt};${o};border:2px solid ${n};box-shadow:inset 0 0 0 2px ${n},${r}`}function hr(e,t){const n=[];let o="static",r=!1;for(let l=e;l&&l!==e.ownerDocument.documentElement;l=l.parentElement){const u=t.getComputedStyle(l),s=l!==e.ownerDocument.body&&/auto|scroll|hidden|overlay/.test(u.overflowY+u.overflowX);s&&!r&&n.push(l),u.position==="fixed"?(o="dynamic",r=!0):u.transform!=="none"||u.filter!=="none"||u.perspective!=="none"?(o="dynamic",r=!1):(u.position==="sticky"||u.willChange.includes("transform")||u.contain.includes("layout")||s&&(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth))&&(o="dynamic")}return{tier:o,clips:n}}function pr(e,t,n,o){const r=e.ownerDocument??document,l=r.defaultView??window;et(e,"pins",ur);const u=r.createElement("div");u.className="snag-pins",u.style.cssText=dr,e.appendChild(u);const s=r.createElement("div");s.className="snag-pins-dyn",s.style.cssText=fr,e.appendChild(s);let d=[],y=[];const w=new Map;let R=new Map,g=null;const h=new Map;let m=new Map;const p=l.matchMedia?.("(pointer: coarse)").matches??!1,E=p?32:24,D=p?34:28;let O=[],V=null,oe=null,Y={x:0,y:0};function Ee(){const A=r.defaultView,$=u.getBoundingClientRect();Y={x:$.left+(A?.scrollX??0),y:$.top+(A?.scrollY??0)}}let ee=[];const te=new Map,Ie=1e4,pe=5,c=new Map,_=new Set(["testid","domid"]);function S(A){const $=c.get(A.id),b=$?.ref.deref();if(!b||!b.isConnected)return null;if(_.has($.strategy))return b;if(A.anchor.css)try{if(!b.matches(A.anchor.css))return null}catch{return null}return b}function P(A,$){const b=[],H=Mn($,A.anchor,1,b);return{element:$,strategy:c.get(A.id).strategy,score:H,state:In(H),reasons:b.length?b:["exact"],candidates:1}}function z(A,$="authoritative"){w.clear(),ee=[];const b=Date.now(),H=n?.newPass?.();return A.map(v=>{const M=S(v),C=n?.get();let x=M?P(v,M):Ht(v.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...C?{extended:C}:{},...H?{passCaches:H}:{}});if(M&&x.reasons.includes("text-drift")){const W=Ht(v.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...C?{extended:C}:{},...H?{passCaches:H}:{}});W.score>x.score&&(x=W)}if(n&&(!x.element||x.reasons.includes("text-drift"))&&n.want(v.anchor),!x.element&&n){const W=n.fuzzyHit?.(v.id);W?x=W:n.wantFuzzy?.(v.id,v.anchor)}const ne=x.element&&v.anchor.text?.exact&&(x.reasons.includes("text-drift")||x.strategy==="path-rect"&&x.score<.5);if(n&&ne){const W=n.fuzzyHit?.(v.id);W&&W.score>x.score?x=W:W||n.wantFuzzy?.(v.id,v.anchor)}x.element?c.set(v.id,{ref:new WeakRef(x.element),strategy:x.strategy}):c.delete(v.id),x.element&&w.set(v.id,x.element);let X=!1;if(x.state==="orphaned"){const W=te.get(v.id)??{firstSeenAt:b,tries:0,best:x};W.tries++,x.score>=W.best.score&&(W.best=x),te.set(v.id,W);const K=n?.unavailable?.()??!1,q=K?2:pe,ce=b-W.firstSeenAt<Ie;$==="optimistic"||ce&&($==="navigating"||W.tries<q)?X=!0:(x=W.best,K&&!x.reasons.includes("budget-exceeded")&&(x={...x,reasons:[...x.reasons,"budget-exceeded"]}),te.delete(v.id))}else te.delete(v.id);X||ee.push({id:v.id,state:x.state,strategy:x.strategy,confidence:x.score});const L=x.element?Lt(x.element):void 0;if(L&&(L.width>0||L.height>0)){const W=r.defaultView;v.anchor.rect={x:L.left+(W?.scrollX??0),y:L.top+(W?.scrollY??0),w:L.width,h:L.height}}return{...v,anchorState:X?v.anchorState:x.state,anchorPending:X,anchorReasons:x.reasons}})}function N(){const A=r.documentElement;return{w:A.scrollWidth,h:A.scrollHeight}}function U(A,$,b){return{x:Math.min(Math.max(A,14),Math.max(b.w,28)-14),y:Math.min(Math.max($,14),Math.max(b.h,28)-14)}}function G(A,$){Ee(),u.textContent="",s.textContent="",d=[],y=[],R=new Map,m=new Map,h.clear(),O=[],oe=null,A.forEach((b,H)=>{const v=b.anchor.rect;if(!v)return;const M=b.anchor.offset??{fx:.5,fy:.5},C=r.createElement("div");C.className="snag-pin",C.setAttribute("data-state",b.anchorPending?"pending":b.anchorState),C.setAttribute("data-key",b.key),C.style.cssText=b.anchorPending?`${Ln("approximate",b)};opacity:.55`:Ln(b.anchorState,b);const x=w.get(b.id),{tier:ne,clips:X}=x?hr(x,l):{tier:"static",clips:[]};if(ne==="dynamic"&&x){const J=x.getBoundingClientRect(),me=Fe();C.style.left=`${J.left-me.left+J.width*M.fx}px`,C.style.top=`${J.top-me.top+J.height*M.fy}px`,h.set(C,{x:J.left+J.width*M.fx+l.scrollX-Y.x,y:J.top+J.height*M.fy+l.scrollY-Y.y});const Oe={node:C,el:x,fx:M.fx,fy:M.fy,clips:X};d.push(Oe),C.hidden=!yt(x),C.hidden||Be(Oe,J,new Map(X.map(st=>[st,st.getBoundingClientRect()])))}else{const J=U(v.x+v.w*M.fx-Y.x,v.y+v.h*M.fy-Y.y,N());C.style.left=`${J.x}px`,C.style.top=`${J.y}px`,h.set(C,J),x&&(y.push({node:C,el:x,fx:M.fx,fy:M.fy,clips:[]}),C.hidden=!yt(x))}C.textContent=String(H+1);const L=Do(b),W=b.anchor.role?B("pin.target",{role:b.anchor.role,name:b.anchor.accessibleName??b.anchor.label}):b.anchor.label,K=b.comments.length-1,q=b.anchorState==="approximate"?`~ ${b.key}`:b.key;C.setAttribute("role","button"),C.setAttribute("tabindex","0");const ce=b.anchorState==="anchored"?B(K===0?"pin.aria.none":K===1?"pin.aria.one":"pin.aria",{key:q,target:W,status:$n(b.status),replies:K}):B("pin.aria.moved",{key:q,target:W,status:$n(b.status),where:L});C.title=ce,C.setAttribute("aria-label",ce),t&&xe(C,()=>t(b)),$?.has(b.id)&&(C.hidden=!0,C.setAttribute("data-fo","")),R.set(b.id,C),m.set(C,{snag:b,ordinal:H+1}),(ne==="dynamic"?s:u).appendChild(C)}),Ye(),g&&je(g),Me(),ie="",ue(r.visibilityState==="visible"&&R.size>0)}const Fe=()=>s.getBoundingClientRect();let we=!1;function Be(A,$,b){for(const H of A.clips){const v=b.get(H);if(v&&($.right<=v.left||$.left>=v.right||$.bottom<=v.top||$.top>=v.bottom)){A.node.hidden=!0;return}}A.node.hidden=!1}function At(A){const $=new Map;for(const b of A)for(const H of b.clips)$.has(H)||$.set(H,H.getBoundingClientRect());return $}const Ce=["open","progress","review","resolved"];function xe(A,$){A.addEventListener("click",$),A.addEventListener("keydown",b=>{b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),$())})}function ze(A,$,b,H,v){const M=Ce.find(x=>A.some(ne=>ne.snag.status===x))??"open",C=r.createElement("div");C.className="snag-pin snag-cluster",C.style.cssText=`${tt};border-radius:50%;background:${On(M)};color:${kn(M)};border:2px solid ${k.onAccent}`,C.style.left=`${$}px`,C.style.top=`${b}px`,C.textContent=String(A.length),C.setAttribute("data-count",String(A.length)),C.setAttribute("data-state",M),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),v&&C.setAttribute("aria-expanded","true"),C.setAttribute("aria-label",B("cluster.aria",{n:A.length,list:A.map(x=>x.ordinal).join(", ")})),xe(C,()=>{if(v)V=null;else if(A.length<=6)V=H;else{o?.(A.map(x=>x.snag.id));return}Ye()}),u.appendChild(C),O.push(C)}function de(A,$,b,H){ze(A,$,b,H,!0),A.forEach((v,M)=>{const C=$,x=b+(M+1)*(D+12),ne=v.x-C,X=v.y-x,L=Math.hypot(ne,X);if(L>4){const K=r.createElement("div");K.className="snag-leader",K.setAttribute("aria-hidden","true"),K.style.cssText=`position:absolute;left:${C}px;top:${x}px;width:${L}px;height:0;border-top:1px solid ${k.onAccent};transform-origin:0 0;transform:rotate(${Math.atan2(X,ne)}rad)`,u.appendChild(K),O.push(K)}const W=v.dot.cloneNode(!0);W.style.visibility="",W.style.left=`${C}px`,W.style.top=`${x}px`,xe(W,()=>t?.(v.snag)),u.appendChild(W),O.push(W)})}function Ye(){for(const v of O)v.remove();O=[];const A=[];for(const[v,M]of m){if(v.hidden){v.style.visibility="";continue}const C=h.get(v);C&&A.push({dot:v,snag:M.snag,ordinal:M.ordinal,x:C.x,y:C.y})}const{members:$,visits:b}=lr(A,E);u.setAttribute("data-cv",String(b)),u.setAttribute("data-cp",String(A.length));let H=!1;for(const v of $){if(v.length<2){A[v[0]].dot.style.visibility="";continue}const M=v.map(X=>A[X]),C=M.map(X=>X.snag.id).sort().join("|");for(const X of M)X.dot.style.visibility="hidden";const x=M.reduce((X,L)=>X+L.x,0)/M.length,ne=M.reduce((X,L)=>X+L.y,0)/M.length;V===C&&M.length<=6?(H=!0,de(M,x,ne,C)):ze(M,x,ne,C,!1)}V&&!H&&(V=null)}function Xe(A){oe?.remove(),oe=null;const $=A.anchor.rect;if(!$)return;const b=A.anchor.offset??{fx:.5,fy:.5},H=r.createElement("div");H.className="snag-pin snag-ghost",H.style.cssText=`${tt};${bt};background:transparent;border:2px dashed ${k.anchorOrphan};color:${k.anchorOrphan};box-shadow:none;pointer-events:none`;const v=U($.x+$.w*b.fx-Y.x,$.y+$.h*b.fy-Y.y,N());H.style.left=`${v.x}px`,H.style.top=`${v.y}px`,H.setAttribute("aria-hidden","true"),u.appendChild(H),oe=H}function Me(A=!1){const $=A?[...d,...y]:d;we||$.length===0||(we=!0,l.requestAnimationFrame(()=>{we=!1;const b=performance.now(),H=l.scrollX,v=l.scrollY,M=Fe(),C=$.map(L=>L.el.isConnected?L.el.getBoundingClientRect():null),x=$.map(L=>L.el.isConnected&&yt(L.el)),ne=At($),X=N();$.forEach((L,W)=>{const K=C[W];if(!K)return;if(L.node.hasAttribute("data-fo")){L.node.hidden=!0;return}if(!x[W]){L.node.hidden=!0;return}L.node.hidden=!1;const q=K.left+K.width*L.fx,ce=K.top+K.height*L.fy;if(L.node.parentElement===s)L.node.style.left=`${q-M.left}px`,L.node.style.top=`${ce-M.top}px`,Be(L,K,ne),h.set(L.node,{x:q+H-Y.x,y:ce+v-Y.y});else{const J=U(q+H-Y.x,ce+v-Y.y,X);L.node.style.left=`${J.x}px`,L.node.style.top=`${J.y}px`,h.set(L.node,J)}}),Ye(),u.setAttribute("data-ms",(performance.now()-b).toFixed(2))}))}const Se=()=>Me();r.addEventListener("scroll",Se,{capture:!0,passive:!0});const rt=typeof l.ResizeObserver=="function"?new l.ResizeObserver(()=>Me(!0)):null;rt?.observe(r.documentElement);let Ae=null,ie="";function kt(){let A="";for(const $ of[...y,...d]){if(!$.el.isConnected)continue;const b=$.el.getBoundingClientRect();A+=`${Math.round(b.left)},${Math.round(b.top)},${Math.round(b.width)};`}!A||A===ie||(ie=A,Me(!0))}function ue(A){if(Ae&&clearTimeout(Ae),Ae=null,!A)return;const $=()=>{kt(),Ae=setTimeout($,500)};Ae=setTimeout($,500)}const at=()=>ue(r.visibilityState==="visible"&&R.size>0);r.addEventListener("visibilitychange",at);function re(A){const $=R.get(A);$&&($.classList.remove("snag-pp"),l.requestAnimationFrame(()=>$.classList.add("snag-pp")),l.setTimeout(()=>$.classList.remove("snag-pp"),1400))}function je(A){const $=g?R.get(g):void 0;$&&($.style.transform="",$.style.zIndex=""),g=A;const b=A?R.get(A):void 0;b&&(b.style.transform="scale(1.4)",b.style.zIndex="1")}return{el:u,render:G,showGhost:Xe,pulse:re,reanchor:z,settled:()=>ee,hasPending:()=>te.size>0,highlight:je,destroy(){r.removeEventListener("scroll",Se,{capture:!0}),r.removeEventListener("visibilitychange",at),rt?.disconnect(),ue(!1),u.remove(),s.remove()}}}const mr=` .snag-notice{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(24px + var(${I.tbH},56px));z-index:${Ve.notice};max-width:min(420px,calc(100vw - 24px));background:${k.bg};color:${k.fg};border:1px solid ${k.border};border-inline-start:3px solid ${k.anchorOrphan};border-radius:${k.radius};box-shadow:${k.shadow};padding:12px 14px;pointer-events:auto;font:400 13px/1.45 ${k.font};display:flex;flex-direction:column;gap:10px}@media (pointer:coarse){.snag-notice{bottom:calc(12px + var(${I.tbH},64px))}}.snag-notice p{margin:0}.snag-notice-actions{display:flex;gap:6px;justify-content:flex-end}.snag-notice button{appearance:none;font:inherit;cursor:pointer;border-radius:calc(${k.radius} - 2px);padding:6px 12px;min-height:30px;border:0;transition:background ${k.motion}}.snag-notice-retry{background:${k.accent};color:${k.onAccent};font-weight:600}.snag-notice-dismiss{background:transparent;color:${k.muted}}.snag-notice-dismiss:hover{background:${k.hover};color:inherit}.snag-notice button:focus-visible{outline:2px solid ${k.focus};outline-offset:2px}`;function gr(e,t){const n=e.ownerDocument??document,o=n.defaultView??window;et(e,"notice",mr);const r=n.createElement("div");r.className="snag-notice",r.setAttribute("role","alert"),r.hidden=!0;const l=n.createElement("p"),u=n.createElement("div");u.className="snag-notice-actions";const s=n.createElement("button");s.type="button",s.className="snag-notice-dismiss",s.textContent=B("action.dismiss"),s.addEventListener("click",()=>R());const d=n.createElement("button");d.type="button",d.className="snag-notice-retry",u.append(s,d),r.append(l,u);let y;d.addEventListener("click",()=>{R(),y?.run()});let w=0;function R(){w&&o.cancelAnimationFrame(w),w=0,r.hidden=!0,r.remove()}return{show(g,h,m){y=h,d.hidden=!h,h&&(d.textContent=B(h.label)),r.hidden=!1,l.textContent="",(t??e).appendChild(r);const p=B(g,m);w&&o.cancelAnimationFrame(w),w=o.requestAnimationFrame(()=>{w=0,l.textContent=p})},hide:R,visible:()=>r.isConnected&&!r.hidden,destroy(){r.remove()}}}const yr=` .snag-paused{border:0;padding:0;background:transparent;pointer-events:auto;max-width:min(420px,calc(100vw - 32px))}.snag-paused::backdrop{background:rgb(0 0 0 / .28)}.snag-paused-box{background:${k.bg};color:${k.fg};border:1px solid ${k.border};border-inline-start:3px solid ${k.accent};border-radius:${k.radius};box-shadow:${k.shadow};padding:14px 16px;font:400 13px/1.45 ${k.font};display:flex;flex-direction:column;gap:12px}.snag-paused p{margin:0}.snag-paused-actions{display:flex;justify-content:flex-end}.snag-paused button{appearance:none;font:inherit;cursor:pointer;border:0;font-weight:600;border-radius:calc(${k.radius} - 2px);padding:6px 14px;min-height:30px;background:${k.accent};color:${k.onAccent}}.snag-paused button:focus-visible{outline:2px solid ${k.focus};outline-offset:2px}`;function br(e,t){const n=e.ownerDocument??document;et(e,"paused",yr);const o=n.createElement("dialog");o.className="snag-paused",o.setAttribute("aria-label",B("paused.dialog"));const r=n.createElement("div");r.className="snag-paused-box",r.setAttribute("role","status");const l=n.createElement("p");l.textContent=B("paused.dialog");const u=n.createElement("div");u.className="snag-paused-actions";const s=n.createElement("button");s.type="button",s.textContent=B("paused.close"),s.addEventListener("click",()=>w()),u.append(s),r.append(l,u),o.append(r);let d=!1;function y(){if(!d){(t??e).appendChild(o);try{o.showModal(),d=!0}catch{o.setAttribute("open",""),d=!0}}}function w(){if(d){d=!1;try{o.close()}catch{o.removeAttribute("open")}o.remove()}}return o.addEventListener("close",()=>{d=!1,o.remove()}),{show:y,hide:w,destroy(){w(),o.remove()}}}const vr=Symbol.for(mn.original),Dn=Symbol.for(mn.wrapped),nt=()=>{};function wr(e,t,n){let o;try{o=e[t]}catch{return nt}if(typeof o!="function"||o[Dn])return nt;const r=o,l=n(r);let u=!1;const s=function(...d){return u?r.apply(this,d):l.apply(this,d)};try{const d=s;d[Dn]=!0,d[vr]=r,Object.defineProperty(s,"name",{value:r.name,configurable:!0}),Object.defineProperty(s,"length",{value:r.length,configurable:!0})}catch{}try{e[t]=s}catch{return nt}return e[t]!==s?nt:()=>{let d;try{d=e[t]}catch{d=void 0}if(d===s)try{e[t]=r;return}catch{}u=!0}}function xr(e,t){const n=[];let o=0;const r=()=>{o||(o=e.requestAnimationFrame(()=>{o=0,t.onResize()}))};e.addEventListener("resize",r),n.push(()=>{o&&e.cancelAnimationFrame(o),e.removeEventListener("resize",r)}),e.visualViewport?.addEventListener("resize",r),n.push(()=>e.visualViewport?.removeEventListener("resize",r));const l=()=>void e.setTimeout(t.onResize,250);e.addEventListener("orientationchange",l),n.push(()=>e.removeEventListener("orientationchange",l));let u=e.location.pathname;const s=()=>{const E=e.location.pathname;E!==u&&(u=E,t.onRoute())},d=e.navigation;if(d){const E=()=>void e.setTimeout(s,0);d.addEventListener("navigatesuccess",E),n.push(()=>d.removeEventListener("navigatesuccess",E))}else for(const E of["pushState","replaceState"])n.push(wr(e.history,E,D=>function(...O){const V=D.apply(this,O);return e.setTimeout(s,0),V}));const y=e.document;let w=!0;try{y.documentElement.matches(":modal")}catch{w=!1}const R=()=>{const E=y.querySelectorAll("dialog[open]");if(!w)return E.length>0;for(const D of E)if(D.matches(":modal"))return!0;return!1};let g=!1;const h=()=>{const E=R();E!==g&&(g=E,t.onModal(E))};y.addEventListener("toggle",h,!0),n.push(()=>y.removeEventListener("toggle",h,!0));const m=new MutationObserver(h);m.observe(y.documentElement,{subtree:!0,attributes:!0,attributeFilter:["open"]}),n.push(()=>m.disconnect());const p=()=>void e.setTimeout(s,0);return e.addEventListener("popstate",p),n.push(()=>e.removeEventListener("popstate",p)),{destroy(){for(const E of n)E();n.length=0}}}function Sr(e,t){try{e.sessionStorage.setItem(le.handoff,JSON.stringify({openThreadId:t}))}catch{}}function Ar(e){try{const t=e.sessionStorage.getItem(le.handoff);if(t===null)return null;e.sessionStorage.removeItem(le.handoff);const n=JSON.parse(t);return typeof n.openThreadId=="string"?n.openThreadId:null}catch{return null}}function kr(){return{statuses:[],read:"all",pageOnly:!1,newOnly:!1,sort:"page"}}const $r=["open","progress","review","resolved"];function Er(e,t,n){if(t.statuses.length>0&&$r.includes(e.status)&&!t.statuses.includes(e.status)||t.by&&e.createdBy.id!==t.by||t.page&&e.route!==t.page)return!1;if(t.read!=="all"&&n){const o=Cr(e,n);if(t.read==="unread"&&!o||t.read==="read"&&o)return!1}return!0}function Cr(e,t){const n=t.get(e.id)??0;return Date.parse(e.updatedAt)>n}function Tr(e,t,n){const o=e.visualViewport;let r=0;const l=()=>{if(r=0,!o)return;const s=o.offsetLeft,d=o.offsetTop;t.style.translate=s||d?`${s}px ${d}px`:"",t.style.width=`${o.width}px`,t.style.height=`${o.height}px`,n?.(o.scale)},u=()=>{r||(r=e.requestAnimationFrame(l))};return o?.addEventListener("resize",u,{passive:!0}),o?.addEventListener("scroll",u,{passive:!0}),u(),()=>{r&&e.cancelAnimationFrame(r),o?.removeEventListener("resize",u),o?.removeEventListener("scroll",u)}}const Rr=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,_r=/^[a-f0-9]{32,}$/i,Pr=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,Ir="[redacted]";function Nn(e){return e.includes("/")?e.split("/").map(t=>Rr.test(t)||_r.test(t)||Pr.test(t)?Ir:t).join("/"):e}const zr=/\/index\.(html?|php)$/i;function Mr(e){if(!e.startsWith("/"))return e;let t=e.replace(zr,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function Or(e){try{const t=e.querySelector(`meta[name="${Po.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}function Lr(e,t){const n=t??Or(e);return Mr(n??Nn(e.location.pathname))}const Dr=[/^utm_/,/^(gclid|gbraid|wbraid|fbclid|msclkid|ttclid|twclid|igshid|yclid|li_fat_id)$/,/^(mc_cid|mc_eid|_hsenc|_hsmi|vero_id|oly_enc_id|oly_anon_id)$/,/^_vercel_/,/^__vercel_/,/^_rsc$/],Nr=[...mt.query,...mt.fragment];function Hr(e,t=[]){return Nr.includes(e)||t.includes(e)?!0:Dr.some(n=>n.test(e))}function Wr(e,t={}){const n=t.significantQueryParams??[];if(n!=="*"&&n.length===0)return;let o;try{o=new URLSearchParams(e)}catch{return}const r={};for(const[l,u]of o)Hr(l,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(l)||(r[l]=u);return Object.keys(r).length>0?r:void 0}function Fr(e,t,n={}){const o=n.significantQueryParams??[];if(o==="*"){const r=e??{},l=t??{},u=new Set([...Object.keys(r),...Object.keys(l)]);for(const s of u)if(r[s]!==l[s])return!1;return!0}for(const r of o)if((e?.[r]??void 0)!==(t?.[r]??void 0))return!1;return!0}const Br=120,jr=1e3,Ur=200,Zr=1e4;function Vr(e,t,n){const o=t.MutationObserver;if(typeof o!="function")return{destroy:()=>{}};let r=!1,l=null,u=!1,s=!1,d=0,y=R(),w=0;function R(){return t.performance?.now?.()??0}const g=new o(()=>{r=!0,d++,m()});function h(){const E=R();return E-y>=1e3&&(d>Ur&&(w=E+Zr),d=0,y=E),E<w?jr:Br}function m(){l||(l=setTimeout(p,h()))}function p(){if(l=null,!!r){if(u){s=!0;return}r=!1,u=!0;try{n()}finally{u=!1,s&&(s=!1,r=!0,m())}}}return g.observe(e.documentElement,{childList:!0,subtree:!0}),{destroy(){g.disconnect(),l&&clearTimeout(l),l=null}}}const Yr="0.0.0",Xr={capture:Re.capture,"anchor-ext":Re.anchorExt,"anchor-fuzzy":Re.anchorFuzzy,crumbs:Re.crumbs,screenshot:Re.screenshot,dock:Re.dock,text:Re.text},Hn=new Map,Wt=new Map,Wn=new Map;function Kr(e,t,n){const o=new URL(t,n.location.href).href,r=new URL(Xr[e],o);r.searchParams.set("cv",Yr);const l=Wn.get(e)??0;return l>0&&r.searchParams.set("r",String(l)),Wn.set(e,l+1),r.href}async function _e(e,t,n=document){const o=Hn.get(e);if(o)return{ok:!0,mod:o};const r=Wt.get(e);if(r)return r;const l=(async()=>{for(let u=0;u<2;u++)try{const s=await import(Kr(e,t,n));return Hn.set(e,s),{ok:!0,mod:s}}catch{}return{ok:!1,reason:"unavailable"}})();Wt.set(e,l);try{return await l}finally{Wt.delete(e)}}const qr="composer",Ft=e=>le.draft(e,qr),Jr=le.draft("\0","").split("\0")[0];function Qr(e){try{return e.body.trim()?(localStorage.setItem(Ft(e.route),JSON.stringify(e)),!0):(Fn(e.route),!0)}catch{return!1}}function Gr(e){try{const t=localStorage.getItem(Ft(e));if(!t)return null;const n=JSON.parse(t);return!n||typeof n.body!="string"||!n.anchor||n.route!==e?null:n}catch{return null}}function Fn(e){try{localStorage.removeItem(Ft(e))}catch{}}function Bt(){try{for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t&&t.startsWith(Jr))return!0}return!1}catch{return!1}}const ea="http://www.w3.org/2000/svg";function Pe(e,t,n,o=[]){const r=e.createElementNS(ea,t);for(const l in n)r.setAttribute(l,n[l]);for(const l of o)r.appendChild(l);return r}const jt=(e,t="16",n="16",o="0 0 16 16")=>({width:t,height:n,viewBox:o,fill:"none","aria-hidden":"true"}),ta=e=>Pe(e,"svg",jt(),[Pe(e,"path",{d:"M8 3v10M3 8h10",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round"})]),na=e=>Pe(e,"svg",jt(),[Pe(e,"rect",{x:"2.25",y:"3.25",width:"11.5",height:"9.5",rx:"1.75",stroke:"currentColor","stroke-width":"1.5"}),Pe(e,"path",{d:"M9.5 3.5v9",stroke:"currentColor","stroke-width":"1.5"})]),oa=e=>Pe(e,"svg",{...jt(e,"10","16","0 0 10 16"),fill:"currentColor"},[Pe(e,"g",{fill:"currentColor"},[4,8,12].flatMap(t=>[3,7].map(n=>Pe(e,"circle",{cx:String(n),cy:String(t),r:"1"}))))]),ra=` .snag-tb{position:fixed;z-index:${Ve.toolbar};display:flex;align-items:center;gap:2px;padding:4px;border-radius:calc(${k.radius} + 4px);background:${k.bg};color:${k.fg};box-shadow:${k.shadow};font:500 13px/1 ${k.font};pointer-events:auto;user-select:none;border:1px solid ${k.border}}.snag-tb{transition:inset-inline-end ${k.motion}}.snag-tb--fine{inset-inline-end:calc(20px + env(safe-area-inset-right) + var(${I.dockW},0px));inset-block-end:calc(20px + env(safe-area-inset-bottom));transition:inset-inline-end ${k.motion}}.snag-tb--coarse{inset-inline:0;inset-block-end:0;border-radius:14px 14px 0 0;padding:6px 10px calc(6px + env(safe-area-inset-bottom));justify-content:center;gap:4px;flex-direction:column}.snag-grabber{width:36px;height:4px;border-radius:2px;background:${k.muted};margin:2px auto 6px}.snag-row{display:flex;align-items:center;gap:2px}.snag-grip{display:flex;align-items:center;padding:0 4px;color:${k.muted};cursor:grab;touch-action:none}.snag-grip:active{cursor:grabbing}.snag-seg{display:flex;background:${k.surface};border-radius:${k.radius};padding:2px;position:relative}.snag-seg::before{content:"";position:absolute;inset-block:2px;inset-inline-start:var(${I.thumbX},0);width:var(${I.thumbW},0);background:${k.accent};border-radius:calc(${k.radius} - 2px);pointer-events:none;transition:inset-inline-start ${k.motion},width ${k.motion}}.snag-seg>.snag-b[aria-pressed="true"]{background:transparent;color:${k.onAccent}}.snag-seg>.snag-b{z-index:1}.snag-b{appearance:none;border:0;background:transparent;color:inherit;font:inherit;padding:6px 11px;border-radius:calc(${k.radius} - 2px);cursor:pointer;display:flex;align-items:center;gap:6px;position:relative;min-height:32px;transition:background ${k.motion}}.snag-b:hover:not(:disabled){background:color-mix(in srgb,currentColor 12%,transparent)}.snag-b:disabled{opacity:.4;cursor:not-allowed}.snag-b[aria-pressed="true"]{background:${k.accent};color:${k.onAccent}}.snag-b:focus-visible{outline:2px solid ${k.focus};outline-offset:2px}.snag-icon{padding:6px 9px}@media (pointer:coarse){.snag-b{min-height:44px;min-width:44px;padding:6px 14px}.snag-icon{padding:6px 14px}}.snag-puck .snag-row>:not([aria-expanded]){display:none}.snag-puck{padding:4px;border-radius:50%}.snag-puck [aria-expanded]{min-width:44px;min-height:44px;border-radius:50%}`;function aa(e,t){const n=e.ownerDocument??document,o=t.coarsePointer??n.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;et(e,"toolbar",ra);const r=n.createElement("div");r.className=`snag-tb ${o?"snag-tb--coarse":"snag-tb--fine"}`,r.setAttribute("role","toolbar"),r.setAttribute("aria-label",B("toolbar.aria"));const l=n.createElement("div");l.className="snag-grabber",l.setAttribute("aria-hidden","true");const u=n.createElement("div");u.className="snag-row";const s=n.createElement("span");s.className="snag-grip",s.setAttribute("aria-hidden","true"),s.appendChild(oa(n));const d=n.createElement("div");d.className="snag-seg",d.setAttribute("role","group"),d.setAttribute("aria-label",B("toolbar.group"));const y=(c,_,S)=>{const P=n.createElement("button");return P.type="button",P.className=`snag-b ${c}`,P.setAttribute("aria-label",_),typeof S=="string"?P.textContent=S:P.appendChild(S),P},w=y("",B("toolbar.browse"),B("toolbar.browse")),R=y("",B("toolbar.comments"),B("toolbar.comments")),g=y("snag-icon",B("toolbar.add"),ta(n)),h=y("snag-icon",B("toolbar.panel"),na(n));h.setAttribute("aria-expanded","false"),d.append(w,R),o||u.appendChild(s),u.append(d,g,h),o&&r.appendChild(l),r.appendChild(u),(t.parent??e).appendChild(r);const m=()=>{e.host.style.setProperty(I.tbH,`${r.offsetHeight}px`)};m();let p=null;function E(c,_){const S=n.defaultView,P=r.offsetWidth,z=r.offsetHeight,N=Bn(c,8,Math.max(8,S.innerWidth-P-8)),U=Bn(_,8,Math.max(8,S.innerHeight-z-8));p={left:N,top:U},r.style.left=`${N}px`,r.style.top=`${U}px`,r.style.right="auto",r.style.bottom="auto"}const D=()=>{m(),p&&E(p.left,p.top)},O=n.defaultView;if(O?.addEventListener("resize",D),w.addEventListener("click",()=>t.onState("browse")),R.addEventListener("click",()=>t.onState("comments")),g.addEventListener("click",()=>t.onState(V==="add"?"comments":"add")),h.addEventListener("click",()=>t.onPanel()),!o){let c=null;s.addEventListener("pointerdown",S=>{c={x:S.clientX,y:S.clientY,r:r.getBoundingClientRect()},s.setPointerCapture(S.pointerId),S.preventDefault()}),s.addEventListener("pointermove",S=>{c&&E(c.r.left+(S.clientX-c.x),c.r.top+(S.clientY-c.y))});const _=S=>{c=null,s.hasPointerCapture(S.pointerId)&&s.releasePointerCapture(S.pointerId)};s.addEventListener("pointerup",_),s.addEventListener("pointercancel",_)}let V="browse";function oe(c){V=c,w.setAttribute("aria-pressed",String(c==="browse")),R.setAttribute("aria-pressed",String(c!=="browse")),g.setAttribute("aria-pressed",String(c==="add")),Y()}function Y(){const c=d.querySelector('.snag-b[aria-pressed="true"]'),_=d.getBoundingClientRect(),S=c?.getBoundingClientRect();if(!c||!S?.width){d.style.setProperty(I.thumbW,"0px");return}const P=n.defaultView?.getComputedStyle(d),z=P?.direction==="rtl",N=parseFloat((z?P?.paddingRight:P?.paddingLeft)??"0")||0,U=(z?_.right-S.right:S.left-_.left)-N;d.style.setProperty(I.thumbW,`${Math.round(S.width)}px`),d.style.setProperty(I.thumbX,`${Math.max(0,Math.round(U))}px`)}function Ee(c){g.disabled=c,c?g.title=B("error.panels.add"):g.removeAttribute("title")}function ee(c){g.setAttribute("aria-label",B(c?"toolbar.add.draft":"toolbar.add"))}function te(c){R.setAttribute("aria-label",c!==null&&c>0?B("toolbar.comments.unresolved",{n:Lo(c)}):B("toolbar.comments"))}oe("browse"),te(0);function Ie(c){r.classList.toggle("snag-puck",c),c||Y()}function pe(c){r.hidden=c,c||Y(),m()}return{el:r,setState:oe,setCount:te,setDegraded:Ee,setDraft:ee,setPuck:Ie,setConcealed:pe,destroy(){O?.removeEventListener("resize",D),e.host.style.removeProperty(I.tbH),r.remove()}}}const Bn=(e,t,n)=>e<t?t:e>n?n:e,jn=24;function sa(e,t){const n=e.innerHeight,o=t.querySelector(".snag-dk");if(!o)return{top:0,bottom:n};const r=o.getBoundingClientRect();return r.height>=n-1?{top:0,bottom:n}:{top:0,bottom:Math.max(0,r.top)}}function ia(e,t,n){const o=n.anchor.rect;if(!o)return;const r=n.anchor.offset??{fy:.5},l=o.y+o.h*r.fy,u=sa(e,t),s=l-e.scrollY;if(s>=u.top+jn&&s<=u.bottom-jn)return;const d=e.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;e.scrollTo({top:Math.max(0,l-(u.top+u.bottom)/2),behavior:d?"auto":"smooth"})}function Ut(){const e=new Uint8Array(16);crypto.getRandomValues(e);const t=Date.now();e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/2**8)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128;const n=Array.from(e,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}const ca=()=>gt.thread+Ut(),Un=()=>gt.comment+Ut(),la=()=>gt.attachment+Ut(),da={attachments:"direct",realtime:"none",anchorReports:!1,identity:["guest"],export:["json","md"],serverSideSearch:!1,privateThreads:!1,assignees:!1};function ua(){const e=le.threads("probe","probe");try{return localStorage.setItem(e,"1"),localStorage.removeItem(e),!0}catch(t){return Zn(t)}}function fa(e,t,n){const o=le.threads(e,t);function r(){let s=null;try{s=localStorage.getItem(o)}catch{return[]}if(!s)return[];try{const d=JSON.parse(s);return Array.isArray(d)?d.filter(pa):[]}catch{return[]}}function l(s){try{localStorage.setItem(o,JSON.stringify(s))}catch(d){if(!Zn(d))return;throw new Ot("local_quota_exceeded")}}const u=s=>({...s,updatedAt:new Date().toISOString()});return{kind:"local",capabilities:da,async init(s){return{uid:s.uid,env:s.env,features:{screenshots:!0,uploads:!1}}},async listThreads(s={}){let d=r();return s.route!==void 0&&(d=d.filter(y=>y.route===s.route)),s.status?.length&&(d=d.filter(y=>s.status.includes(y.status))),{data:d,serverTime:new Date().toISOString()}},async getThread(s){return r().find(d=>d.id===s)??null},async createThread(s){const d=En(s);return l([...r(),d]),d},async patchThread(s,d){const y=r(),w=y.findIndex(g=>g.id===s);if(w<0)return null;const R=u({...y[w],...ha(d)});return y[w]=R,l(y),R},async deleteThread(s){const d=r(),y=d.find(R=>R.id===s),w=d.filter(R=>R.id!==s);w.length!==d.length&&l(w);for(const R of y?.attachments??[])n?.del(R.id).catch(()=>{})},async uploadAttachment(s,d){if(!n)throw new Ot("attachments_unsupported");const y=la();return await n.put(y,{blob:s,uid:e,env:t,kind:d.kind,...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},createdAt:Date.now()}),{id:y,kind:d.kind,url:"",...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},bytes:s.size,contentType:s.type}},async createComment(s,d){const y=r(),w=y.findIndex(g=>g.id===s);if(w<0)return null;const R={id:d.id,snagId:s,body:d.body,author:d.author,createdAt:new Date().toISOString()};return y[w]=u({...y[w],comments:[...y[w].comments,R]}),l(y),R},async patchComment(s,d){const y=r();for(let w=0;w<y.length;w++){const R=y[w].comments.find(h=>h.id===s);if(!R)continue;const g={...R,body:d};return y[w]=u({...y[w],comments:y[w].comments.map(h=>h.id===s?g:h)}),l(y),g}return null},async deleteComment(s){const d=r(),y=d.findIndex(w=>w.comments.some(R=>R.id===s));y<0||(d[y]=u({...d[y],comments:d[y].comments.filter(w=>w.id!==s)}),l(d))}}}function ha(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Zn(e){return e instanceof Error?e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED"||e.code===22||e.code===1014:!1}function pa(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.key=="string"&&typeof t.route=="string"&&typeof t.anchor=="object"&&t.anchor!==null&&typeof t.anchor.label=="string"&&Array.isArray(t.comments)}function ma(e,t,n=()=>Date.now()){const o=le.seen(e,t);let r=null;function l(){if(r)return r;try{const s=localStorage.getItem(o),d=s?JSON.parse(s):{};return r=typeof d=="object"&&d!==null&&!Array.isArray(d)?d:{}}catch{return r={}}}function u(s){r=s;try{localStorage.setItem(o,JSON.stringify(s))}catch{}}return{map:()=>new Map(Object.entries(l())),mark(s){u({...l(),[s]:n()})},markAll(s){const d=n(),y={...l()};for(const w of s)y[w.id]=d;u(y)}}}function ot(){let e=null;try{e=localStorage.getItem(It)}catch{return{}}if(!e)return{};if(e[0]!=="{")return{name:e};try{const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function Vn(e){try{localStorage.setItem(It,JSON.stringify(e))}catch{}}function Zt(){const e=ot();return{name:typeof e.name=="string"?e.name:"",...e.email?{email:e.email}:{}}}function ga(e){return ot().projects?.[e]?.holderId}function ya(e){const t=ot().projects?.[e]?.holderSecret;return t&&/^[\w-]{43}$/.test(t)?t:void 0}function ba(e,t,n){const o=ot();Vn({...o,projects:{...o.projects,[e]:{holderId:t,holderSecret:n}}})}function va(e,t){const n=ot(),o=n.projects?.[e];o&&Vn({...n,projects:{...n.projects,[e]:{...o,holderId:t}}})}const Vt=e=>le.session(e);function Yt(e){try{const t=sessionStorage.getItem(Vt(e));if(!t)return null;const n=JSON.parse(t);return typeof n?.token=="string"&&typeof n?.refreshableUntil=="number"?n:null}catch{return null}}function Yn(e,t){try{sessionStorage.setItem(Vt(e),JSON.stringify(t))}catch{}}function vt(e){try{sessionStorage.removeItem(Vt(e))}catch{}}const wa=(e,t=Date.now())=>t>e.expiresAt-3e4,Xt=(e,t=Date.now())=>t>=e.refreshableUntil;class We extends Error{code;status;constructor(t,n,o){super(o),this.name="HttpAdapterError",this.status=t,this.code=n}}function xa(e){const{offset:t,testId:n,domId:o,page:r,schemaVersion:l,...u}=e;return{...u,...n?{testid:n}:{},...o?{domid:o}:{},...t?{offset:{fx:t.x,fy:t.y}}:{}}}function Sa(e,t){const n=e.url??"",o=/^https?:/i.test(n)?n:n?`${t}${n.startsWith("/")?"":"/"}${n}`:`${t}/api/v1/attachments/${encodeURIComponent(e.id)}/blob`;return{...e,url:o}}function wt(e,t,n){return{id:e.id,route:e.anchor?.page?.route??"",key:e.key,status:e.status,anchor:xa(e.anchor),anchorState:e.anchorState,context:e.context,comments:e.comments??[],createdBy:e.createdBy,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.resolvedAt?{resolvedAt:e.resolvedAt}:{},...e.attachments?.length?{attachments:e.attachments.map(o=>Sa(o,n))}:{},...t?{scope:{environment:t}}:{}}}function Aa(e,t){const{offset:n,testid:o,domid:r,...l}=e;return{...l,schemaVersion:hn,...o?{testId:o}:{},...r?{domId:r}:{},offset:n?{x:n.fx,y:n.fy}:{x:.5,y:.5},page:{route:t,pathname:location.pathname,origin:location.origin}}}function ka(e,t,n,o={}){const r=e.replace(/\/+$/,""),l=`${r}/api/v1/projects/${encodeURIComponent(t)}`;let u=o.reviewToken,s=Yt(t);async function d(h=!1){const m=s&&!Xt(s)?s.token:null,p=!!m&&!u&&!h,E=p?void 0:u?{kind:"link",token:u,name:Zt().name||void 0}:{kind:"guest",name:Zt().name||"Anonymous",holderId:ga(t),holderSecret:ya(t)};let D;try{D=await fetch(`${l}/sessions`,{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...m?{Authorization:`Bearer ${m}`}:{}},body:JSON.stringify({...n?{environment:n}:{},...E?{identity:E}:{},client:{widget:xo,schema:hn}})})}catch(oe){throw new We(0,"network_error",oe.message)}finally{u=void 0}if(!D.ok){const Y=(await D.json().catch(()=>null))?.error?.code??"unauthorized";throw vt(t),s=null,Y==="session_revoked"||Y==="token_revoked"?o.onSessionEnded?.("revoked"):D.status===401&&o.onSessionEnded?.("expired"),new We(D.status,Y,"This review session is not valid.")}const O=await D.json();O.holderSecret&&O.reviewer?ba(t,O.reviewer.id,O.holderSecret):O.reviewer&&va(t,O.reviewer.id);const V=O.round?.number??(p?s?.round:void 0);return s={token:O.sessionToken,expiresAt:Date.parse(O.expiresAt),refreshableUntil:Date.parse(O.refreshableUntil),reviewerId:O.reviewer?.id??s?.reviewerId??"",permissions:O.permissions??s?.permissions??[],...V!==void 0?{round:V}:{}},Yn(t,s),E&&(w=E.name??null),o.onSessionStarted?.(),s}async function y(){if(s){if(Xt(s)){vt(t),s=null,o.onSessionEnded?.("expired");return}await d().catch(()=>{})}}let w=null;async function R(){if(s&&Xt(s))return vt(t),s=null,w=null,o.onSessionEnded?.("expired"),null;const h=Zt().name||null,m=s!==null&&h!==null&&h!==w;if(!s||wa(s)||u||m)try{await d(m)}catch(p){if(!(p instanceof We)||p.status===0)throw p;return null}return s?.token??null}async function g(h,m,p=!1){const E=await R();let D;try{D=await fetch(l+h,{...m,headers:{"content-type":"application/json",...E?{Authorization:`Bearer ${E}`}:{},...m?.headers??{}},credentials:"omit"})}catch(O){throw new We(0,"network_error",O.message)}if(!D.ok){const O=await D.json().catch(()=>null),V=O?.error?.code??"http_error";if(D.status===401&&!p&&V!=="session_revoked")return vt(t),s=null,g(h,m,!0);throw new We(D.status,V,O?.error?.message??`The server answered ${D.status}.`)}return await D.json()}return{kind:"http",capabilities:{attachments:"none",realtime:"none",anchorReports:!0,identity:["guest"],export:[],serverSideSearch:!1,privateThreads:!1,assignees:!1},async init(h){const m=await g("/config");return this.capabilities.attachments=m.features.screenshots?"direct":"none",{uid:h.uid,env:h.env,features:m.features,...m.rounds?{rounds:m.rounds}:{},...m.writable===void 0?{}:{writable:m.writable},...m.reason===void 0?{}:{reason:m.reason}}},async reportAnchors(h){if(h.length!==0)for(let m=0;m<h.length;m+=50)try{await g("/anchor-reports",{method:"POST",body:JSON.stringify({reports:h.slice(m,m+50)})})}catch{return}},revalidate:y,getRound(){return s?.round??Yt(t)?.round??null},setRound(h){s&&(s={...s,round:h});const m=Yt(t);m&&Yn(t,{...m,round:h})},async fetchForeignImage(h){try{const m=await R(),p=await fetch(`${l}/image?src=${encodeURIComponent(h)}`,{credentials:"omit",...m?{headers:{Authorization:`Bearer ${m}`}}:{}});if(!p.ok)return null;const E=await p.blob();return E.type.startsWith("image/")?E:null}catch{return null}},async uploadAttachment(h,m){const p=await R(),E=await fetch(`${l}/attachments`,{method:"POST",credentials:"omit",headers:{"content-type":h.type||"image/webp",[zt.attachmentKind]:m.kind,...m.width?{[zt.attachmentWidth]:String(m.width)}:{},...m.height?{[zt.attachmentHeight]:String(m.height)}:{},...p?{Authorization:`Bearer ${p}`}:{}},body:h});if(!E.ok){const O=await E.json().catch(()=>null);throw new We(E.status,O?.error?.code??"upload_failed",O?.error?.message??"Upload failed.")}const D=await E.json();return{id:D.id,kind:m.kind,contentType:D.contentType,byteSize:D.byteSize,...m.width?{width:m.width}:{},...m.height?{height:m.height}:{},url:`${r}/api/v1/attachments/${D.id}/blob`}},async listThreads(h){await R();const m=new URLSearchParams;n&&m.set("env",n),h?.route&&m.set("route",h.route),s?.round&&m.set("round",String(s.round));const p=await g(`/threads?${m}`);return{data:p.data.map(E=>wt(E,n,r)),...p.nextCursor?{nextCursor:p.nextCursor}:{},deleted:[],serverTime:p.serverTime}},async getThread(h){return(await this.listThreads()).data.find(p=>p.id===h)??null},async getThreadByKey(h){const m=new URLSearchParams({key:h});n&&m.set("env",n);const E=(await g(`/threads?${m}`)).data[0];return E?wt(E,n,r):null},async createThread(h){const m=await g("/threads",{method:"POST",body:JSON.stringify({id:h.id,anchor:Aa(h.anchor,h.route),anchorState:h.anchorState,context:h.context,...n?{scope:{environment:n}}:{},createdBy:{name:h.createdBy.name},...h.comment?{comment:{id:h.comment.id,body:h.comment.body}}:{},...h.attachments?.length?{attachments:h.attachments.map(p=>p.id)}:{}})});return wt(m,n,r)},async patchThread(h,m){if(!m.status)return null;const p=await g(`/threads/${encodeURIComponent(h)}`,{method:"PATCH",body:JSON.stringify({status:m.status})});return wt(p,n,r)},async deleteThread(){throw new We(501,"not_implemented","Deleting a snag is not built yet.")},async createComment(h,m){const p=await g(`/threads/${encodeURIComponent(h)}/comments`,{method:"POST",body:JSON.stringify({id:m.id,body:m.body})});return{id:p.id,snagId:h,body:p.body,author:p.author,createdAt:p.createdAt}},async patchComment(h,m){return await g(`/comments/${encodeURIComponent(h)}`,{method:"PATCH",body:JSON.stringify({body:m})}),null},async deleteComment(h){await g(`/comments/${encodeURIComponent(h)}`,{method:"DELETE"})}}}async function $a(e,t){if(e.url&&/^https?:/i.test(e.url))try{const n=await fetch(e.url,{credentials:"omit"});if(!n.ok)return null;const o=await n.blob();return o.type&&!o.type.startsWith("image/")?null:o}catch{return null}return t(e.id)}const Ea=64,Ca=4096,Ta=e=>le.counts(e),Ra=e=>e.filter(t=>t.status!=="resolved").length;function _a(e,t,n){const o=new Map;for(const s of t){const d=o.get(s.route)??{n:0,seen:""};s.status!=="resolved"&&d.n++,s.updatedAt>d.seen&&(d.seen=s.updatedAt),o.set(s.route,d)}o.has(n)||o.set(n,{n:0,seen:new Date().toISOString()});const l=[...o.entries()].sort((s,d)=>d[1].seen.localeCompare(s[1].seen)).slice(0,Ea);l.some(([s])=>s===n)||(l[l.length-1]=[n,o.get(n)]);let u={v:1,p:Ra(t),r:Object.fromEntries(l.map(([s,d])=>[s,d.n])),t:new Date().toISOString()};JSON.stringify(u).length>Ca&&(u={...u,r:{}});try{localStorage.setItem(Ta(e),JSON.stringify(u))}catch{return null}return u}function Pa(e,t){return e?.r[t]??0}const Ia="pass(?:word|wd)?|pwd|secret|token|api[_-]?key|apikey|auth(?:orization)?|credential|session|sid|cookie|jwt|bearer|otp|mfa|totp|cvv|cvc|ssn|nino|iban|card(?:[_-]?number)?|account[_-]?number|private[_-]?key|signature|client[_-]?secret|refresh[_-]?token|access[_-]?token",za=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${Ia})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),Ma=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,Oa=(e,t,n,o,r,l,u)=>{if(!n&&Ma.test(r)&&u.slice(l+e.length).startsWith(" [redacted]")||(n?o:r).startsWith("[redacted"))return e;const s=n?`${n}${o}${n}`:r;return e.slice(0,e.length-s.length)+(n?`${n}[redacted]${n}`:"[redacted]")},Xn=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,Kn=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,qn=/\b(sk-[A-Za-z0-9]+-[A-Za-z0-9_-]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{20,}|(sk|pk|rk)_(live|test)_[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{16,}|xox[baprs]-[A-Za-z0-9-]{10,}|xapp-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|ya29\.[A-Za-z0-9_-]{20,}|SG\.[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{30,}|dop_v1_[a-f0-9]{40,}|shpat_[a-f0-9]{30,}|sbp_[a-f0-9]{30,}|hf_[A-Za-z0-9]{30,}|nvapi-[A-Za-z0-9_-]{20,})\b/g,La=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,Jn=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z]{2,24})+\b/g,Kt=/\b(?:\d[ -]?){12,18}\d\b/g,Qn=/\b(?=[A-Za-z0-9+/]*[a-z])(?=[A-Za-z0-9+/]*[A-Z])(?=[A-Za-z0-9+/]*\d)[A-Za-z0-9+/]{40,}={0,2}\b/g,Gn=/\b[0-9a-f]{32,}\b/gi,eo=/\b(?=[A-Za-z0-9_-]*[a-z])(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{40,}\b/g,to=/\b[a-z][a-z0-9]{1,15}(?:_[a-z0-9]{1,15}){0,2}_(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,no=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,Da=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function $e(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function oo(e){const t=e.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let n=0,o=!1;for(let r=t.length-1;r>=0;r--){let l=t.charCodeAt(r)-48;o&&(l*=2,l>9&&(l-=9)),n+=l,o=!o}return n%10===0}function Na(e){Kt.lastIndex=0;for(const t of e.matchAll(Kt))if(oo(t[0]))return!0;return!1}function xt(e){let t=e;return t=t.replace(Xn,"data:[redacted]"),t=t.replace(La,"$1 [redacted]"),t=t.replace(za,Oa),t=t.replace(Kn,"[redacted:jwt]"),t=t.replace(qn,"[redacted:key]"),t=t.replace(to,"[redacted:key]"),t=t.replace(no,"[redacted:url-cred]@"),t=t.replace(Jn,"[redacted:email]"),t=t.replace(Kt,n=>oo(n)?"[redacted:card]":n),t=t.replace(eo,n=>`[redacted:b64:${n.length}]`),t=t.replace(Qn,n=>`[redacted:b64:${n.length}]`),t=t.replace(Gn,n=>`[redacted:hex:${n.length}]`),t}const Ha=mt.query,Wa=mt.fragment;function Fa(e,t=[]){let n;try{const o=globalThis.location?.href;n=new URL(e,o)}catch{return xt(e)}n.username="",n.password="";for(const o of[...n.searchParams.keys()]){if(Wa.includes(o)){n.searchParams.set(o,"[redacted]");continue}if(Ha.includes(o))continue;if(!t.includes(o)){n.searchParams.set(o,"[redacted]");continue}const r=n.searchParams.get(o)??"";xt(r)!==r&&n.searchParams.set(o,"[redacted]")}return n.hash&&n.hash.length>1&&(n.hash=t.includes("#")?n.hash:"#[redacted]"),xt(n.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}function Ba(e){return e.length>120?!0:$e(Jn,e)||$e(Kn,e)||$e(qn,e)||$e(Gn,e)||$e(Qn,e)||$e(Xn,e)||$e(eo,e)||$e(to,e)||$e(no,e)||Da.test(e)||Na(e)}const St={id:"rev_local",name:B("author.unknown"),kind:"guest"},ja="0.0.0";function ro(e,t){if(e)return{...St,name:e,...t?{email:t}:{}};try{const n=localStorage.getItem(le.identity);if(n)return{...St,name:n[0]==="{"?JSON.parse(n).name??St.name:n}}catch{}return St}function Ua(e){return`SN-${e.reduce((n,o)=>{const r=Number(o.key.split("-")[1]??0);return Number.isFinite(r)&&r>n?r:n},0)+1}`}let qt=null;const ve=e=>Lr(e,qt);function Za(e,t){const n=bn(),o=n.ownerDocument??document,r=o.defaultView??window,l=t?.config?.site??"local",u=t?.emit??(()=>{}),s=t?.assetBase??"./",d=t?.config?.env??"default";et(n,"tokens",Ho);const y=Fo(n.host,Wo(t?.config?.theme)),w={},R=t?.config?.storage==="local"?void 0:t?.config?.host,g=R&&l!=="local"?ka(R,l,t?.config?.env,{reviewToken:t?.reviewToken,onSessionEnded:a=>{re.show(a==="revoked"?"error.linkrevoked":"error.sessionended")},onSessionStarted:()=>re.hide()}):fa(l,d,{put:(a,i)=>w.put(a,i),del:a=>w.del(a)}),h=ma(l,d);let m=null;g.init({uid:l,env:d}).then(a=>{m=a.rounds??null,U?.update(x()),a.writable===!1&&a.reason==="origin_not_allowed"&&re.show("error.origin",void 0,{origin:location.origin})}).catch(()=>{});let p=[],E=[];const D=ua();let O=null,V=null,oe=!1,Y=!1,Ee=!1,ee=null,te=!1;const Ie={get:()=>O,unavailable:()=>Y||Ee,newPass:()=>V?.createPassCaches(),fuzzyHit:a=>ee?.hit(a)??null,wantFuzzy:(a,i)=>{if(ee){ee.enqueue(a,i,()=>Q());return}te||!V||!i.text?.exact||i.text.exact.length<8||(te=!0,_e("anchor-fuzzy",s,o).then(f=>{if(!f.ok||!V){Ee=!0,Q();return}ee=f.mod.createFuzzyEngine(o,V.fuzzyDeps),Te()}))},want:a=>{oe||!(a.role&&a.accessibleName)&&!a.text?.exact&&!a.path?.length||(oe=!0,_e("anchor-ext",s,o).then(i=>{if(!i.ok){Y=!0,Q();return}V=i.mod,O=i.mod.resolveExtended,Te()}))}};let pe=null,c=kr();const _=()=>c.statuses.length>0||!!c.by||!!c.page||c.read!=="all",S=pr(n,a=>{if(z==="add"){if(N?.hasText()){N.pulse();return}N?.close(),N=null,fe("comments")}v(a.id)},Ie,a=>{pe=a,U?U.update(x()):v()});let z=(()=>{try{return sessionStorage.getItem(le.mode)==="comments"?"comments":"browse"}catch{return"browse"}})(),N=null,U=null,G=null,Fe=!1,we=null,Be=!1,At=null,Ce=null,xe=null,ze=!1;function de(){return xe?Promise.resolve(xe):ze?Promise.resolve(null):_e("capture",s,o).then(i=>i.ok?(w.put=i.mod.putBlob,w.del=i.mod.deleteBlob,xe=i.mod):(Ye(new Error("chunk unavailable")),null))}function Ye(a){ze||(ze=!0,z==="add"&&fe("comments"),q.setDegraded(!0),re.show("error.capture",{label:"action.retry",run:()=>{ze=!1,q.setDegraded(!1),de()}}),console.warn(`[${be}] the capture chunk failed to load`,a))}let Xe=0;function Me(){const a=new URL(s,o.location.href).href,i=new URL(Re.panels,a);return i.searchParams.set("cv",ja),Xe>0&&i.searchParams.set("r",String(Xe)),Xe++,import(i.href)}async function Se(){if(Be)return null;if(we)return we.catch(()=>null);we=Me().catch(async()=>(await new Promise(a=>setTimeout(a,1e3)),Me()));try{return At=await we}catch(a){return we=null,rt(a),null}}function rt(a){Be=!0,z==="add"&&fe("comments"),q.setDegraded(!0),re.show("error.panels",{label:"action.retry",run:()=>{Be=!1,q.setDegraded(!1),v(G)}}),console.warn(`[${be}] the panels chunk failed to load`,a)}const Ae=o.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;let ie=null;async function kt(){if(ie)return;const a=await de();!a||ie||(ie=a.createAddChrome(n,Ae,{pick:(i,f)=>void $(i,f),announce:qe}),ie.setActive(z==="add"))}const ue=o.createElement("div");ue.style.cssText=`position:fixed;left:0;top:0;pointer-events:none;z-index:${Ve.dock}`,n.appendChild(ue);const at=Tr(r,ue,a=>q.setPuck(a>1.2)),re=gr(n,ue),je=br(n,ue),A=Ko(n,{onPick:(a,i)=>void $(a,i),onHover:a=>a?ie?.show(a):ie?.clear(),onSelectStart:()=>{Ae||tn()}});async function $(a,i){if(N?.hasText()){N.pulse();return}N?.close();const[f,T]=await Promise.all([Se(),de()]);if(!f||!T)return;const F=T.captureContext({page:T.derivePageRef(o.location,dt()),...ft()});fn(a);const Z=T.deriveAnchorLabel(a);b(f,a,i,F,Z,T)}function b(a,i,f,T,F,Z,j,He){let ge=i;ut=!1;const he=ve(o);Tt=!1;const ht=()=>{N=null,Fn(he),q.setDraft(Bt()),fe("comments")},Ge=()=>{Qe?.abort(),Ne=Qe=null,ht()},ye={at:f,label:F,...j?{initialBody:j.body,initialName:j.author,...j.email?{initialEmail:j.email}:{}}:{},onDraft:(ae,se,pt)=>{const wo=Qr({route:he,body:ae,author:se,...pt?{email:pt}:{},label:F,anchor:He??Z.createElementAnchor(i,{point:f,viewportWidth:r.innerWidth,label:F,...Z.describeElement(i)}),at:{x:f.x+r.scrollX,y:f.y+r.scrollY},savedAt:new Date().toISOString()});q.setDraft(Bt()),!wo&&!Tt&&(Tt=!0,an())},onSend:(ae,se,pt)=>{ht(),sn(ge,f,T,ae,se,pt,He)},onRetarget:ae=>{const se=ae==="up"?Z.widen(ge):Z.narrow(ge);se&&(ge=se,ie?.show(se),N?.setLabel(Z.deriveAnchorLabel(se)))},...ce&&Je!==!1?{onShotOptIn:ae=>ut=ae}:{},onCancel:Ge,crumbsOn:un!==!1,shotsOn:Je!==!1,...R&&l!=="local"?{serverHost:new URL(R).host}:{},...He?.text?.exact?{quote:He.text.exact}:{}};N=a.openComposer(n,ye,ue),J()}async function H(){const a=ve(o),i=Gr(a);if(q.setDraft(Bt()),!i||N)return;const[f,T]=await Promise.all([Se(),de()]);if(!f||!T)return;const F=Ht(i.anchor,o,{viewportWidth:r.innerWidth,...O?{extended:O}:{}});if(!F.element)return;const Z=F.element.getBoundingClientRect();if(Z.width===0&&Z.height===0)return;const j={x:i.at.x-r.scrollX,y:i.at.y-r.scrollY};fe("add"),b(f,F.element,j,T.captureContext({page:T.derivePageRef(o.location,dt()),...ft()}),i.label,T,{body:i.body,author:i.author,...i.email?{email:i.email}:{}})}async function v(a=null){if(a&&a!==G&&u("thread:open",{threadId:a}),a&&h.mark(a),G=a,Fe=!0,z==="browse"&&fe("comments"),U){U.update(x());return}if(!await Se())return;const f=await _e("dock",s,o);if(!f.ok){re.show("error.panels",{label:"action.retry",run:()=>void v(G)});return}!Fe||U||(Ce=f.mod,U=f.mod.openDock(n,x(),ue),J())}function M(){h.markAll(p),c.newOnly&&(c={...c,newOnly:!1}),Fe=!1,U?.close(),U=null,G=null,S.highlight(null),J(),_()&&Q()}function C(a){const i=a?p.find(f=>f.id===a):void 0;if(i&&i.route!==ve(o)){Sr(r,i.id),r.location.assign(i.route);return}a&&h.mark(a),G=a,S.highlight(null),_()?Q():U?.update(x()),i&&Ce?.scrollToSnag(r,n,i)}function x(){return{snags:p,route:ve(o),openId:G,seenAt:h.map(),onOpen:C,onStatus:(a,i)=>void co(a,i),onReply:(a,i)=>void lo(a,i),onEdit:(a,i)=>void X(a,i),onDeleteComment:a=>void L(a),onDeleteThread:a=>void W(a),onClearAll:()=>void K(),onClose:M,onExport:Ct,onHover:a=>S.highlight(a),...m&&m.length>1&&g.setRound?{rounds:m,activeRound:g.getRound?.()??m.find(a=>!a.closed)?.number??m[0].number,onRound:a=>{g.setRound(a),Te()}}:{},onAnnounce:qe,loadShot:a=>$a(a,async i=>{const f=await de();return f?(await f.getBlob(i))?.blob??null:null}),filter:c,onFilter:a=>{const i=a.statuses.join()!==c.statuses.join()||a.by!==c.by||a.page!==c.page||a.read!==c.read;c=a,i?Q():U?.update(x())},...pe?{clusterFilter:pe}:{},onClusterClear:()=>{pe=null,U?.update(x())},onShowAnyway:a=>{S.showGhost(a),Ce?.scrollToSnag(r,n,a)}}}async function ne(a,i){const f=p;p=a,Q();try{await Le(i)}catch{p=f,Q(),re.show("error.sendfailed",void 0,{item:"change"})}}async function X(a,i){await ne(p.map(f=>({...f,comments:f.comments.map(T=>T.id===a?{...T,body:i}:T)})),()=>g.patchComment(a,i))}async function L(a){await ne(p.map(i=>({...i,comments:i.comments.filter(f=>f.id!==a)})),()=>g.deleteComment(a))}async function W(a){const i=G;G===a&&(G=null),await ne(p.filter(f=>f.id!==a),()=>g.deleteThread(a)),p.some(f=>f.id===a)&&(G=i)}async function K(){const a=p.map(i=>i.id);p=[],G=null,Q(),await Promise.all(a.map(i=>Le(()=>g.deleteThread(i))))}const q=aa(n,{onState:a=>fe(a),onPanel:()=>U?M():void v(),onNav:a=>Gt(a),parent:ue}),ce=r.matchMedia?.("(pointer: coarse)").matches??!1,J=()=>{ce&&q.setConcealed(!!N||!!U)};let me=null,Oe=[];function st(a){let i=!1;const f=()=>{i||(i=!0,r.removeEventListener("scrollend",f),a())};r.addEventListener("scrollend",f,{once:!0}),r.setTimeout(f,600)}const Ke=o.createElement("div");Ke.setAttribute("aria-live","polite"),Ke.setAttribute("role","status");const Jt="position:absolute;width:1px;height:1px;overflow:hidden";Ke.style.cssText=Jt;const $t=o.createElement("div");$t.setAttribute("aria-live","assertive"),$t.style.cssText=Jt,n.append(Ke,$t);let Qt=0;function qe(a){r.clearTimeout(Qt),Qt=r.setTimeout(()=>{Ke.textContent=a},400)}function Gt(a){const i=Oe.length;if(i===0)return;me=me===null?a===1?0:i-1:(me+a+i)%i;const f=Oe[me];ia(r,n,f);const T=me+1;st(()=>{S.pulse(f.id),qe(B("nav.announce",{n:T,label:f.anchor.label,i:T,total:i}))})}function en(){if(z!=="comments"||Ae){ke?.disarm();return}tn().then(a=>{a&&z==="comments"&&a.arm()})}let ke=null,Et=null;async function tn(){if(ke)return ke;const a=await _e("text",s,o);return!a.ok||ke||(Et=a.mod,ke=a.mod.createSelectionWatcher(n,{onQuote:(i,f)=>void ao(i,f)})),ke}async function ao(a,i){const f=xe??await de();if(!f||!Et)return;const T=Et.createTextAnchor(a,f,{viewportWidth:r.innerWidth,ourRoot:n});if(T.kind==="refused-form-control"){$(T.el,i);return}if(T.kind!=="text")return;const F=await Se();if(!F)return;const Z=f.captureContext({page:f.derivePageRef(o.location,dt()),...ft()});try{a.removeAllRanges()}catch{}b(F,T.el,T.point,Z,T.label,f,void 0,T.record)}function fe(a,i=!1){const f=z;z=a,a!=="add"&&N&&!i&&(N.close(),N=null),a==="add"&&U&&M(),a==="add"&&(Se(),de());try{sessionStorage.setItem(le.mode,a==="add"?"comments":a)}catch{}A.setMode(a),a!==f&&qe(B(`toolbar.${a}`)),J(),a==="add"&&kt(),en(),ie?.setActive(a==="add"),q.setState(a),Q(),a!==f&&u("modechange",{mode:a,previous:f})}let Ue=0,nn=0;const on=[300,800,1600,3200];function so(){if(Ue||!S.hasPending()){S.hasPending()||(nn=0);return}const a=on[Math.min(nn++,on.length-1)];Ue=r.setTimeout(()=>{Ue=0,Q()},a)}const io=3e3;let rn=0;function Q(a){const i=a??(Date.now()<rn?"navigating":"authoritative");E=S.reanchor(p.filter(yo()),i),go(),so();const f=new Map(E.map(j=>[j.id,j]));p=p.map(j=>f.get(j.id)??j);const T=_()?new Set(E.filter(j=>!Er(j,c,h.map())&&j.id!==G).map(j=>j.id)):void 0;Oe=T?E.filter(j=>!T.has(j.id)):E,S.render(z==="browse"?[]:E,T);const F=ve(o),Z=D?_a(o.location.origin,p,F):null;q.setCount(Z?Pa(Z,F):D?E.filter(j=>j.status!=="resolved").length:null),me!==null&&me>=Oe.length&&(me=null),U?.update(x())}async function Te(){const{data:a}=await g.listThreads();p=a,Q();const i=S.settled();for(const f of i)u("anchor:settled",{threadId:f.id,state:f.state,strategy:f.strategy,confidence:f.confidence});return g.capabilities.anchorReports&&g.reportAnchors&&i.length&&Le(()=>g.reportAnchors(i.map(f=>({threadId:f.id,state:f.state,confidence:f.confidence,strategy:f.strategy})))),g.capabilities.anchorReports||await Promise.all(a.flatMap(f=>{const T=p.find(F=>F.id===f.id);return!T||T.anchorState===f.anchorState?[]:[Le(()=>g.patchThread(T.id,{anchor:T.anchor,anchorState:T.anchorState}))]})),E}async function co(a,i){p=p.map(f=>f.id===a?{...f,status:i}:f),Q(),u("thread:resolve",{threadId:a,status:i}),await Le(()=>g.patchThread(a,{status:i}))}async function lo(a,i){const f={id:Un(),body:i,author:ro()};p=p.map(T=>T.id===a?{...T,comments:[...T.comments,{...f,snagId:a,createdAt:new Date().toISOString()}]}:T),h.mark(a),Q(),u("comment:create",{threadId:a,comment:f}),await Le(()=>g.createComment(a,f))}function an(){re.show("error.quota",{label:"action.exportclear",run:()=>{Ct("json"),K()}}),console.warn(`[${be}] ${B("error.quota")}`)}async function Le(a){try{return await a()}catch(i){if(i instanceof Ot&&i.code==="local_quota_exceeded")return an(),null;throw i}}function Ct(a){de().then(async i=>{if(!i)return;const f=await i.resolveAttachmentUris(p).catch(()=>new Map);i.download(n,i.buildExport(a,p,{origin:o.location.origin,exportedAt:new Date().toISOString()},f),r)})}async function sn(a,i,f,T,F,Z,j){const He=ro(F,Z),ge=xe??await de();if(!ge)throw new Error(`[${be}] add() needs the capture chunk`);Ne||fn(a);const he=Ne?await Ne:null;Ne=Qe=null,ge.applyShotOutcome(f,he,Je===!1,ce&&!ut);const ht=he?.blob&&g.uploadAttachment?g.uploadAttachment(he.blob,{kind:"screenshot",...he.width!==void 0?{width:he.width}:{},...he.height!==void 0?{height:he.height}:{}}).catch(()=>null):Promise.resolve(null),Ge={id:ca(),key:Ua(p),route:ve(o),anchor:j??ge.createElementAnchor(a,{point:i,viewportWidth:r.innerWidth,label:ge.deriveAnchorLabel(a),...ge.describeElement(a)}),anchorState:"anchored",scope:po(),context:f,createdBy:He,createdAt:new Date().toISOString(),...T?{comment:{id:Un(),body:T,author:He}}:{}},ye=En(Ge);he?.blob&&(ye.screenshotBlob=he.blob),p=[...p,ye],h.mark(ye.id),qe(B("announce.created",{key:ye.key})),u("thread:create",{thread:ye}),z==="browse"?fe("comments"):Q();try{const ae=await ht;ae&&(Ge.attachments=[ae],p=p.map(se=>se.id===ye.id?{...se,attachments:[ae]}:se),Q()),await Le(()=>g.createThread(Ge))}catch(ae){throw p=p.filter(se=>se.id!==ye.id),Q(),re.show("error.sendfailed",void 0,{item:_t.toLowerCase()}),console.warn(`[${be}] ${B("error.sendfailed",{item:_t.toLowerCase()})}`,ae),ae}return ye}function cn(a){if((a.key==="n"||a.key==="p")&&z==="comments"&&!N){if(a.metaKey||a.ctrlKey||a.altKey)return;const i=a.target;if(i&&(i.closest?.("input,textarea,select,[contenteditable]")||i.isContentEditable))return;a.preventDefault(),a.stopPropagation(),Gt(a.key==="n"?1:-1);return}z==="add"&&a.key==="Escape"&&(N||(a.stopPropagation(),fe("comments")))}o.addEventListener("keydown",cn,!0);let ln=0;const dn=()=>{if(o.hidden||!g.revalidate)return;const a=Date.now();a-ln<3e4||(ln=a,g.revalidate())};o.addEventListener("visibilitychange",dn);const uo=zo(n),fo=Mo(n,a=>{console.warn(`[${be}] the host page hid the widget from assistive technology ${a} times; leaving it alone.`)}),ho=Io(n,a=>{console.warn(`[${be}] the host page removed the widget ${a} times; leaving it alone. Reload to comment again.`)});function po(){return{environment:d,...t?.config?.branch?{branch:t.config.branch}:{}}}let it={route:ve(o),url:o.location.href},Tt=!1,ct=null;function mo(a){if(a){if(z==="browse")return;ct=z,fe("browse",!0),je.show(),u("paused",{reason:"modal-dialog"})}else if(ct){const i=ct;ct=null,je.hide(),fe(i),u("resumed",{mode:i})}}Se();function go(){E.length>0&&_e("dock",s,o)}{const a=o.createElement("div");a.style.cssText="position:fixed;inset:0;pointer-events:none;visibility:hidden",n.appendChild(a);const i=a.getBoundingClientRect(),f=Math.abs(i.left)>1||Math.abs(i.top)>1||Math.abs(i.width-r.innerWidth)>1||Math.abs(i.height-r.innerHeight)>1;a.remove(),f&&(console.warn(`[${be}] fixed-trapped: <html> has transform/filter/contain, so our fixed layer follows it, not the viewport. Remove it, or expect drift.`),u("error",{code:"fixed-trapped"}))}let Ze=null;const lt=new Set,De=(()=>{const a=r[ko.config];return a&&typeof a=="object"?a:void 0})(),un=De?.breadcrumbs,Rt=(()=>{const a=De?.significantQueryParams,i=De?.ignoredQueryParams,f={};return a==="*"?f.significantQueryParams="*":Array.isArray(a)&&(f.significantQueryParams=a.map(String)),Array.isArray(i)&&(f.ignoredQueryParams=i.map(String)),f})(),dt=()=>({routeOverride:qt,query:Rt,doc:o}),Je=De?.screenshot===!1?!1:De?.screenshot&&typeof De.screenshot=="object"?De.screenshot:{};let ut=!1,Ne=null,Qe=null;function fn(a){if(Je===!1||Ne||ce&&!ut)return;Qe=new AbortController;const i=Qe.signal;Ne=_e("screenshot",s,o).then(f=>f.ok?f.mod.captureScreenshot({doc:o,target:a,signal:i,...Je,...g.fetchForeignImage?{fetchForeignImage:T=>g.fetchForeignImage(T)}:{}}):{situation:"engine-load-failed",blindSpots:[],maskedCount:0})}function yo(){const a=ve(o),i=Nn(o.location.pathname),f=Wr(o.location.search,Rt);return T=>(T.route===a||T.context?.page?.pathname===i)&&Fr(T.context?.page?.query,f,Rt)}{const a=un;a!==!1&&_e("crumbs",s,o).then(i=>{i.ok&&(Ze=i.mod.installTierC({win:r,...t?.early?{early:t.early}:{},...a&&typeof a=="object"?{config:a}:{},subscribeNav:f=>(lt.add(f),()=>lt.delete(f))}))})}const ft=()=>Ze?{breadcrumbs:{records:Ze.drain(),status:Ze.status()}}:{},bo=Vr(o,r,()=>{z!=="browse"&&E.length>0&&Q()}),vo=xr(r,{onResize:()=>Q(),onRoute:()=>{const a={route:ve(o),url:o.location.href},i=a.route!==it.route;if(i){u("navigate",{from:it,to:a});for(const f of lt)f(it.url,a.url)}if(it=a,!i){Te();return}rn=Date.now()+io,r.setTimeout(()=>{g.listThreads().then(({data:f})=>{p=f,Q("optimistic")})},100),r.setTimeout(()=>void Te(),600)},onModal:mo});return q.setState(z),A.setMode(z),en(),D||re.show("error.nostorage",{label:"action.export",run:()=>Ct("md")}),Te().then(async a=>{const i=Ar(r);if(!i){const T=new URLSearchParams(o.location.search).get(Ro("t"));if(T){let F=a.find(Z=>Z.key===T);if(!F&&g.getThreadByKey){const Z=await g.getThreadByKey(T).catch(()=>null);Z&&(p=[...p.filter(j=>j.id!==Z.id),Z],Q(),F=p.find(j=>j.id===Z.id))}F?(await v(F.id),Ce?.scrollToSnag(r,n,F)):(re.show("permalink.unknown"),await v(null));return}await H();return}const f=a.find(T=>T.id===i);await v(f?i:null),f&&Ce?.scrollToSnag(r,n,f)}),{root:n,assetBase:t?.assetBase??"",snags:()=>E,async add(a,i,f,T){const F=T?null:await de(),Z=T??(F?F.captureContext({page:F.derivePageRef(o.location,dt()),...ft()}):void 0);if(!Z)throw new Error(`[${be}] add() needs the capture chunk, or an explicit context`);return sn(a,i,Z,f)},refresh:Te,setRoute(a){qt=a&&a.startsWith("/")?a:null,Te()},setState:fe,getState:()=>z,openPanel:v,async open(a){const i=a.startsWith(gt.thread)?p.find(f=>f.id===a):p.find(f=>f.key===a);return i?i.route!==ve(o)?{ok:!1,reason:"wrong-page",url:i.context?.url??i.route,route:i.route}:(await v(i.id),Ce?.scrollToSnag(r,n,i),{ok:!0,anchorState:i.anchorState}):{ok:!1,reason:"not-found"}},closePanel:M,hitTest:(a,i)=>A.hitTest(a,i),destroy(){N?.close(),M(),ie?.destroy(),re.destroy(),je.destroy(),at(),ho(),fo(),uo(),vo.destroy(),bo.destroy(),Ze?.destroy(),Ze=null,lt.clear(),ke?.destroy(),ke=null,ee?.destroy(),ee=null,Ue&&r.clearTimeout(Ue),Ue=0,o.removeEventListener("keydown",cn,!0),o.removeEventListener("visibilitychange",dn),y(),A.destroy(),S.destroy(),q.destroy(),n.host.remove()}}}export{gn as HOST_CSS,bn as createHost,Ba as isSensitiveValue,Za as mount,xt as redactText,Fa as redactUrl};
@@ -1 +1 @@
1
- const rt={root:"data-snag-root"},N=t=>rt[t],ct={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},lt=t=>ct[t],dt={mask:"snag-mask",block:"snag-block"},Y=t=>dt[t],ut=["display","flex-direction","align-items","justify-content","gap","grid-template-columns","width","height","margin","padding","border","border-radius","background-color","background","color","font-family","font-size","font-weight","font-style","line-height","letter-spacing","text-decoration","text-align","white-space","text-wrap","overflow","opacity","box-shadow","max-width","list-style"],Q=200;function J(t,n){try{return new URL(t,n.baseURI).origin===n.location.origin}catch{return!1}}async function ht(t,n){try{const i=await fetch(new URL(t,n.baseURI).href,{credentials:"same-origin"});if(!i.ok)return null;const e=await i.blob();return await new Promise(o=>{const a=new FileReader;a.onload=()=>o(typeof a.result=="string"?a.result:null),a.onerror=()=>o(null),a.readAsDataURL(e)})}catch{return null}}const K="data:image/gif;base64,R0lGODlhAQABAIAAALu7uwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";async function _(t,n){const i=t.ownerDocument,e=i.defaultView??window,o=t.getBoundingClientRect();if(o.width<4||o.height<4)throw new Error("raster:too-small");const a=[],r=t.cloneNode(!0),f=[t,...t.querySelectorAll("*")].slice(0,Q),u=[r,...r.querySelectorAll("*")].slice(0,Q),p=/^(?:SCRIPT|IFRAME|VIDEO|CANVAS|NOSCRIPT)$/;let m=0;const w=[],c=[];for(let g=0;g<Math.min(f.length,u.length);g++){const k=f[g],R=u[g];if(p.test(k.tagName)||n.drop?.(k)){c.push(R);continue}const T=e.getComputedStyle(k);let C=ut.map(h=>`${h}:${T.getPropertyValue(h)}`).join(";");if(n.hide?.(k)&&(C+=";visibility:hidden"),R.setAttribute("style",C),k.shadowRoot){const h=k.getBoundingClientRect();h.width>=1&&h.height>=1&&T.visibility!=="hidden"&&(m++,R.setAttribute("style",C+";background:repeating-linear-gradient(45deg,#eee,#eee 6px,#ddd 6px,#ddd 12px)"))}if(R instanceof e.HTMLImageElement||R.tagName==="IMG"){const h=R,v=k.currentSrc||h.getAttribute("src")||"";if(n.inlineSameOriginAssets&&v&&J(v,i))w.push(ht(v,i).then(E=>{E?h.setAttribute("src",E):(h.setAttribute("src",K),a.push("1 image could not be included in the screenshot"))}));else if(v&&(h.setAttribute("src",K),!J(v,i)))try{a.push("1 image may appear as a placeholder (served without CORS headers)")}catch{}}}for(const g of c)g.remove();for(const g of r.querySelectorAll("script, iframe, video, canvas, noscript"))g.remove();m>0&&a.push(m===1?"1 web component could not be captured (its contents are in a shadow root)":`${m} web components could not be captured (their contents are in shadow roots)`),await Promise.all(w);const y=`<svg xmlns="http://www.w3.org/2000/svg" width="${Math.ceil(o.width)}" height="${Math.ceil(o.height)}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">`+new XMLSerializer().serializeToString(r)+"</div></foreignObject></svg>",S=new e.Image,d=new Promise((g,k)=>{S.onload=()=>g(),S.onerror=()=>k(new Error("raster:img-error"))});return S.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(y),await d,{image:S,width:o.width,height:o.height,blindSpots:a}}let $=null;function Z(t){return $||($=new Promise(n=>{const i=new(t.defaultView??window).Image,e=setTimeout(()=>n(!1),1e3);i.onload=()=>{clearTimeout(e),n(!0)},i.onerror=()=>{clearTimeout(e),n(!1)},i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>')}),$)}const V=256e3,j=1600,mt=2048,tt=.82,gt=5e5;let P=null;function et(t){if(P!==null)return P;try{const n=t.createElement("canvas");n.width=1,n.height=1,P=n.toDataURL("image/webp").startsWith("data:image/webp")}catch{P=!1}return P}function U(t,n,i){return new Promise((e,o)=>{try{t.toBlob(a=>e(a),n,i)}catch(a){a.name==="SecurityError"?o(a):e(null)}})}async function nt(t,n,i){const e=et(n)?await U(t,"image/webp",i):await U(t,"image/jpeg",Math.max(i,.85));return e&&(e.type==="image/webp"||e.type==="image/jpeg")?e:U(t,"image/png")}async function it(t,n,i=j){const e=Math.min(Math.max(1,i),mt);let o=t;const a=Math.max(o.width,o.height);a>e&&(o=ot(t,n,e/a));let r=tt,f=!1;for(let p=0;p<4;p++){let m=await nt(o,n,r);if(!m)return null;if(o.width*o.height<=gt){const w=await U(o,"image/png");w&&w.size<m.size&&(m=w)}if(m.size<=V)return{blob:m,quality:r,rescaled:f};r>.55?r-=.12:(o=ot(o,n,.75),r=tt,f=!0)}const u=await nt(o,n,r);return u&&u.size<=V?{blob:u,quality:r,rescaled:f}:null}function ot(t,n,i){const e=n.createElement("canvas");return e.width=Math.max(1,Math.round(t.width*i)),e.height=Math.max(1,Math.round(t.height*i)),e.getContext("2d").drawImage(t,0,0,e.width,e.height),e}function ft(t){const n=[`[${lt("mask")}]`,`.${Y("mask")}`,`.${Y("block")}`,'input[type="password"]','input[autocomplete*="password" i]','[autocomplete*="cc-" i]','[autocomplete="one-time-code"]','input[type="email"]','input[type="tel"]'];return t.maskAllInputs&&n.push("input","textarea","select","[contenteditable]"),[...n,...t.maskSelectors??[]]}function wt(t,n){const i=t.defaultView??window,e=performance.now(),o=[],a=[],r=`[${N("root")}]`,f=t.querySelectorAll("body *"),u=f.length>5e3,p=u?t.querySelectorAll("body > *, [class*=fixed], [class*=sticky], header, nav, dialog, [popover], [role=dialog], [role=tooltip], [role=menu]"):f;u&&o.push("Overlay scan was reduced on this very large page; some fixed elements may be missing.");for(const c of p){if(performance.now()-e>8)return o.push("Overlay scan ran out of time; fixed and sticky elements are not composited."),{overlays:[],notes:o};if(c.closest(r))continue;let y=!1,S=!1;try{c.matches(":popover-open")&&(y=!0)}catch{}if(c instanceof i.HTMLDialogElement&&c.open){y=!0;try{S=c.matches(":modal")}catch{S=!1}}if(!y){const g=i.getComputedStyle(c).position;(g==="fixed"||g==="sticky")&&(y=!0)}if(!y)continue;const d=c.getBoundingClientRect();d.width<1||d.height<1||d.bottom<0||d.right<0||d.top>i.innerHeight||d.left>i.innerWidth||a.push({el:c,rect:d,modal:S})}const m=a.filter(c=>!a.some(y=>y!==c&&y.el.contains(c.el))),w=(c,y,S)=>c===1?y:S;if(m.length>n){const c=m.length-n;o.push(`${c} overlay ${w(c,"element","elements")} (fixed/sticky/menus) ${w(c,"was","were")} not captured`)}if(m.length>0){const c=Math.min(m.length,n);o.push(`${c} overlay ${w(c,"element","elements")} ${w(c,"was","were")} re-composited; ${w(c,"its","their")} stacking order is approximate`)}return{overlays:m.slice(0,n),notes:o}}function pt(t,n){const i=performance.now(),e=[],o=t.querySelectorAll("iframe, canvas, video");if(o.length>5e3)return n.push("Blind-spot scan skipped on this very large page."),e;for(const a of o){if(performance.now()-i>5)break;if(a.closest(`[${N("root")}]`))continue;const r=a.getBoundingClientRect();if(!(r.width<2||r.height<2))if(a.tagName==="IFRAME"){const f=a;let u=!1;try{f.contentDocument||(u=!0)}catch{u=!0}if(u){let p="";try{p=new URL(f.src,t.baseURI).host}catch{}n.push(`1 cross-origin iframe not captured${p?`: ${p}`:""}`),e.push({el:a,rect:r,label:"iframe not captured"})}}else if(a.tagName==="CANVAS"){const f=a;let u=!1;try{f.toDataURL()}catch(p){u=p.name==="SecurityError"}n.push(u?"1 canvas could not be read (tainted by a cross-origin image)":"1 canvas may appear blank"),e.push({el:a,rect:r,label:"canvas not captured"})}else n.push("Video frames are not captured"),e.push({el:a,rect:r,label:"video not captured"})}return e}function bt(t,n,i,e,o,a){t.save(),t.beginPath(),t.rect(n,i,e,o),t.clip(),t.fillStyle="#f3f3f3",t.fillRect(n,i,e,o),t.strokeStyle="#d0d0d0",t.lineWidth=1,t.beginPath();for(let r=-o;r<e;r+=12)t.moveTo(n+r,i+o),t.lineTo(n+r+o,i);t.stroke(),t.strokeRect(n+.5,i+.5,e-1,o-1),e>=120&&o>=20&&(t.fillStyle="#8a8f98",t.font="11px system-ui, sans-serif",t.textAlign="center",t.fillText(a,n+e/2,i+o/2+4)),t.restore()}function yt(t,n,i,e,o){t.save(),t.fillStyle="#5b5f66",t.fillRect(n,i,e,o),t.strokeStyle="#8a8f98",t.lineWidth=1,t.strokeRect(n+.5,i+.5,e-1,o-1),e>=80&&o>=24&&(t.fillStyle="#c9cdd3",t.font="11px system-ui, sans-serif",t.textAlign="center",t.fillText("masked",n+e/2,i+o/2+4)),t.restore()}function At(t){const n=t.defaultView??window;for(const i of[t.documentElement,t.body]){if(!i)continue;const e=n.getComputedStyle(i).backgroundColor;if(e&&e!=="rgba(0, 0, 0, 0)"&&e!=="transparent")return e}return"#ffffff"}async function q(t,n,i,e,o){const a=t.doc,r=a.defaultView??window,f=`[${N("root")}]`,u=[];if(await Promise.race([new Promise(s=>r.requestAnimationFrame(()=>r.requestAnimationFrame(s))),new Promise(s=>r.setTimeout(s,50))]),a.hidden&&await new Promise(s=>{const l=r.setTimeout(s,500);a.addEventListener("visibilitychange",()=>{r.clearTimeout(l),s()},{once:!0})}),t.signal?.aborted)throw new Error("navigated");let p,m;try{const s=ft(t).join(", "),l=[...a.querySelectorAll(s)].filter(b=>!b.closest(f));m=new Set(l),p=l.map(b=>b.getBoundingClientRect()).filter(b=>b.width>0&&b.height>0)}catch(s){throw Object.assign(new Error("masking-failed"),{cause:s})}const{overlays:w,notes:c}=e?wt(a,t.maxOverlays??8):{overlays:[],notes:[]};u.push(...c);const y=pt(a,u),S=new Set([...w.map(s=>s.el),...m]);let d=Math.min(r.devicePixelRatio||1,t.maxDpr??2);const g=a.documentElement,k=n==="viewport"?g.scrollWidth:0,R=n==="viewport"?g.scrollHeight:0,T=t.maxRasterPixels??4e7;if(n==="viewport"){const s=k*R*d*d;if(s>T&&(d=Math.max(1,d*Math.sqrt(T/s))),k*R>T)return q(t,"element",i,e,!0)}let C=g,h,v={x:0,y:0};if(n==="viewport")h={x:0,y:0,w:r.innerWidth,h:r.innerHeight};else{const s=t.target&&t.target.isConnected?t.target:g,l=s.getBoundingClientRect(),b=200,O=Math.max(0,l.left-b),B=Math.max(0,l.top-b),G=Math.min(r.innerWidth,l.right+b),X=Math.min(r.innerHeight,l.bottom+b);let x=s;for(;x.parentElement&&x!==g;){const L=x.getBoundingClientRect();if(L.left<=O&&L.top<=B&&L.right>=G&&L.bottom>=X)break;x=x.parentElement}C=x;const F=x.getBoundingClientRect();h={x:O-F.left,y:B-F.top,w:G-O,h:X-B},v={x:O,y:B}}const E=await _(C,{drop:s=>s.closest?.(f)!=null,hide:s=>S.has(s),inlineSameOriginAssets:i});if(u.push(...E.blindSpots),t.signal?.aborted)throw E.image.src="",new Error("navigated");const W=C.getBoundingClientRect(),at=n==="viewport"?-W.left:h.x,st=n==="viewport"?-W.top:h.y,A=a.createElement("canvas");A.width=Math.max(1,Math.round(h.w*d)),A.height=Math.max(1,Math.round(h.h*d));const M=A.getContext("2d");M.fillStyle=At(a),M.fillRect(0,0,A.width,A.height),M.drawImage(E.image,at,st,h.w,h.h,0,0,A.width,A.height),E.image.src="",w.some(s=>s.modal)&&(M.fillStyle="rgba(0,0,0,0.35)",M.fillRect(0,0,A.width,A.height));for(const s of w)try{const l=await _(s.el,{drop:b=>b.closest?.(f)!=null,hide:b=>m.has(b),inlineSameOriginAssets:i});M.drawImage(l.image,Math.round(s.rect.left*d),Math.round(s.rect.top*d),Math.round(s.rect.width*d),Math.round(s.rect.height*d)),l.image.src=""}catch{u.push("1 overlay element could not be captured")}const z=s=>({x:Math.round((s.left-v.x)*d),y:Math.round((s.top-v.y)*d),w:Math.round(s.width*d),h:Math.round(s.height*d)});for(const s of y){const l=z(s.rect);l.w>0&&l.h>0&&bt(M,l.x,l.y,l.w,l.h,s.label)}let D=0;try{for(const s of p){const l=z(s);l.w<=0||l.h<=0||(yt(M,l.x,l.y,l.w,l.h),D++)}}catch(s){throw Object.assign(new Error("masking-failed"),{cause:s})}if(t.signal?.aborted)throw new Error("navigated");let I;try{I=await it(A,a,t.maxLongestSide??j)}catch(s){throw A.width=A.height=0,s.name==="SecurityError"?new Error("tainted"):s}return A.width=A.height=0,I?{situation:o?"scope-forced":"ok",blob:I.blob,quality:I.quality,width:Math.round(h.w),height:Math.round(h.h),blindSpots:u,maskedCount:D}:{situation:"engine-failed",blindSpots:u,maskedCount:D}}function H(t,n){return Promise.race([t.catch(i=>i.message==="masking-failed"?{situation:"masking-failed",blindSpots:[],maskedCount:0}:i.message==="navigated"?{situation:"navigated",blindSpots:[],maskedCount:0}:i.message==="tainted"?{situation:"tainted",blindSpots:[],maskedCount:0}:{situation:"engine-failed",blindSpots:[],maskedCount:0}),new Promise(i=>setTimeout(()=>i({situation:"timeout",blindSpots:[],maskedCount:0}),n))])}async function St(t){if(!await Z(t.doc))return{situation:"csp-blocked",blindSpots:[],maskedCount:0};const n=t.scope??"viewport",i=[t.timeoutMs??3e3,1500,1500];let e=await H(q(t,n,!0,!0,!1),Math.min(i[0],1e4));if(e.situation==="ok"||e.situation==="scope-forced"||e.situation==="masking-failed"||e.situation==="navigated"||e.situation==="tainted"||(e=await H(q(t,n,!1,!1,!1),i[1]),e.situation==="ok"||e.situation==="scope-forced"||e.situation==="masking-failed"||e.situation==="navigated"||e.situation==="tainted"))return e;const o=await H(q(t,"element",!1,!1,!0),i[2]);return o.situation==="ok"||o.situation==="scope-forced"?o:o.situation==="engine-failed"&&e.situation==="timeout"?e:o}const kt="screenshot";export{kt as CHUNK,j as MAX_LONGEST_SIDE,V as TARGET_BYTES,et as canEncodeWebp,St as captureScreenshot,it as encodeToBudget,Z as probeDataImages,_ as rasterise};
1
+ const ue={root:"data-snag-root"},_=e=>ue[e],he={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},fe=e=>he[e],ge={mask:"snag-mask",block:"snag-block"},te=e=>ge[e],T=(e,t,i)=>e===1?t:i;function j(e){const t=[],i=e.corsImages??0;i>0&&t.push(`${i} ${T(i,"image may appear as a placeholder","images may appear as placeholders")} (served without CORS headers)`);const n=e.failedImages??0;n>0&&t.push(`${n} ${T(n,"image","images")} could not be included in the screenshot`);const o=e.shadowRoots??0;o>0&&t.push(o===1?"1 web component could not be captured (its contents are in a shadow root)":`${o} web components could not be captured (their contents are in shadow roots)`);const s=e.iframeHosts??[];if(s.length>0){const g=[...new Set(s.filter(Boolean))].join(", ");t.push(`${s.length} cross-origin ${T(s.length,"iframe","iframes")} not captured${g?`: ${g}`:""}`)}const r=e.taintedCanvases??0;r>0&&t.push(r===1?"1 canvas could not be read (tainted by a cross-origin image)":`${r} canvases could not be read (tainted by cross-origin images)`);const f=e.blankCanvases??0;f>0&&t.push(`${f} ${T(f,"canvas","canvases")} may appear blank`),(e.videos??0)>0&&t.push("Video frames are not captured");const d=e.failedOverlays??0;return d>0&&t.push(`${d} overlay ${T(d,"element","elements")} could not be captured`),t}const me=["display","flex-direction","align-items","justify-content","gap","grid-template-columns","width","height","margin","padding","border","border-radius","background-color","background","color","font-family","font-size","font-weight","font-style","line-height","letter-spacing","text-decoration","text-align","white-space","text-wrap","overflow","opacity","box-shadow","max-width","list-style"],ne=200;function ie(e,t){try{return new URL(e,t.baseURI).origin===t.location.origin}catch{return!1}}function V(e){return new Promise(t=>{const i=new FileReader;i.onload=()=>t(typeof i.result=="string"?i.result:null),i.onerror=()=>t(null),i.readAsDataURL(e)})}async function we(e,t){try{const i=await fetch(new URL(e,t.baseURI).href,{credentials:"same-origin"});return i.ok?await V(await i.blob()):null}catch{return null}}async function pe(e,t,i){const n=new URL(e,t.baseURI).href;try{const s=await fetch(n,{mode:"cors",credentials:"omit"});if(s.ok)return await V(await s.blob())}catch{}if(!i)return null;const o=await i(n).catch(()=>null);return o?await V(o):null}function be(e,t){try{return/^https?:$/.test(new URL(e,t.baseURI).protocol)}catch{return!1}}const W="data:image/gif;base64,R0lGODlhAQABAIAAALu7uwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";async function z(e,t){const i=e.ownerDocument,n=i.defaultView??window,o=e.getBoundingClientRect();if(o.width<4||o.height<4)throw new Error("raster:too-small");const s=e.cloneNode(!0),r=[e,...e.querySelectorAll("*")].slice(0,ne),f=[s,...s.querySelectorAll("*")].slice(0,ne),d=/^(?:SCRIPT|IFRAME|VIDEO|CANVAS|NOSCRIPT)$/;let g=0,u=0,w=0;const l=[],p=[];for(let v=0;v<Math.min(r.length,f.length);v++){const k=r[v],M=f[v];if(d.test(k.tagName)||t.drop?.(k)){p.push(M);continue}const S=n.getComputedStyle(k);let E=me.map(m=>`${m}:${S.getPropertyValue(m)}`).join(";");if(t.hide?.(k)&&(E+=";visibility:hidden"),M.setAttribute("style",E),k.shadowRoot){const m=k.getBoundingClientRect();m.width>=1&&m.height>=1&&S.visibility!=="hidden"&&(g++,M.setAttribute("style",E+";background:repeating-linear-gradient(45deg,#eee,#eee 6px,#ddd 6px,#ddd 12px)"))}if(M instanceof n.HTMLImageElement||M.tagName==="IMG"){const m=M,R=k.currentSrc||m.getAttribute("src")||"";t.inlineSameOriginAssets&&R&&ie(R,i)?l.push(we(R,i).then(x=>{x?m.setAttribute("src",x):(m.setAttribute("src",W),w++)})):t.inlineSameOriginAssets&&R&&be(R,i)?(m.setAttribute("src",W),l.push(pe(R,i,t.fetchForeignImage).then(x=>{x?m.setAttribute("src",x):u++}))):R&&(m.setAttribute("src",W),ie(R,i)||u++)}}for(const v of p)v.remove();for(const v of s.querySelectorAll("script, iframe, video, canvas, noscript"))v.remove();await Promise.all(l);const C=j({corsImages:u,failedImages:w,shadowRoots:g}),h=`<svg xmlns="http://www.w3.org/2000/svg" width="${Math.ceil(o.width)}" height="${Math.ceil(o.height)}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">`+new XMLSerializer().serializeToString(s)+"</div></foreignObject></svg>",A=new n.Image,O=new Promise((v,k)=>{A.onload=()=>v(),A.onerror=()=>k(new Error("raster:img-error"))});return A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(h),await O,{image:A,width:o.width,height:o.height,blindSpots:C}}let q=null;function oe(e){return q||(q=new Promise(t=>{const i=new(e.defaultView??window).Image,n=setTimeout(()=>t(!1),1e3);i.onload=()=>{clearTimeout(n),t(!0)},i.onerror=()=>{clearTimeout(n),t(!1)},i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>')}),q)}const G=256e3,X=1600,ye=2048,ae=.82,Ae=5e5;let P=null;function se(e){if(P!==null)return P;try{const t=e.createElement("canvas");t.width=1,t.height=1,P=t.toDataURL("image/webp").startsWith("data:image/webp")}catch{P=!1}return P}function F(e,t,i){return new Promise((n,o)=>{try{e.toBlob(s=>n(s),t,i)}catch(s){s.name==="SecurityError"?o(s):n(null)}})}async function re(e,t,i){const n=se(t)?await F(e,"image/webp",i):await F(e,"image/jpeg",Math.max(i,.85));return n&&(n.type==="image/webp"||n.type==="image/jpeg")?n:F(e,"image/png")}async function le(e,t,i=X){const n=Math.min(Math.max(1,i),ye);let o=e;const s=Math.max(o.width,o.height);s>n&&(o=ce(e,t,n/s));let r=ae,f=!1;for(let g=0;g<4;g++){let u=await re(o,t,r);if(!u)return null;if(o.width*o.height<=Ae){const w=await F(o,"image/png");w&&w.size<u.size&&(u=w)}if(u.size<=G)return{blob:u,quality:r,rescaled:f};r>.55?r-=.12:(o=ce(o,t,.75),r=ae,f=!0)}const d=await re(o,t,r);return d&&d.size<=G?{blob:d,quality:r,rescaled:f}:null}function ce(e,t,i){const n=t.createElement("canvas");return n.width=Math.max(1,Math.round(e.width*i)),n.height=Math.max(1,Math.round(e.height*i)),n.getContext("2d").drawImage(e,0,0,n.width,n.height),n}function ve(e){const t=[`[${fe("mask")}]`,`.${te("mask")}`,`.${te("block")}`,'input[type="password"]','input[autocomplete*="password" i]','[autocomplete*="cc-" i]','[autocomplete="one-time-code"]','input[type="email"]','input[type="tel"]'];return e.maskAllInputs&&t.push("input","textarea","select","[contenteditable]"),[...t,...e.maskSelectors??[]]}function ke(e,t){const i=e.defaultView??window,n=performance.now(),o=[],s=[],r=`[${_("root")}]`,f=e.querySelectorAll("body *"),d=f.length>5e3,g=d?e.querySelectorAll("body > *, [class*=fixed], [class*=sticky], header, nav, dialog, [popover], [role=dialog], [role=tooltip], [role=menu]"):f;d&&o.push("Overlay scan was reduced on this very large page; some fixed elements may be missing.");for(const l of g){if(performance.now()-n>8)return o.push("Overlay scan ran out of time; fixed and sticky elements are not composited."),{overlays:[],notes:o};if(l.closest(r))continue;let p=!1,C=!1;try{l.matches(":popover-open")&&(p=!0)}catch{}if(l instanceof i.HTMLDialogElement&&l.open){p=!0;try{C=l.matches(":modal")}catch{C=!1}}if(!p){const A=i.getComputedStyle(l).position;(A==="fixed"||A==="sticky")&&(p=!0)}if(!p)continue;const h=l.getBoundingClientRect();h.width<1||h.height<1||h.bottom<0||h.right<0||h.top>i.innerHeight||h.left>i.innerWidth||s.push({el:l,rect:h,modal:C})}const u=s.filter(l=>!s.some(p=>p!==l&&p.el.contains(l.el))),w=(l,p,C)=>l===1?p:C;if(u.length>t){const l=u.length-t;o.push(`${l} overlay ${w(l,"element","elements")} (fixed/sticky/menus) ${w(l,"was","were")} not captured`)}if(u.length>0){const l=Math.min(u.length,t);o.push(`${l} overlay ${w(l,"element","elements")} ${w(l,"was","were")} re-composited; ${w(l,"its","their")} stacking order is approximate`)}return{overlays:u.slice(0,t),notes:o}}function Se(e,t){const i=performance.now(),n=[],o=e.querySelectorAll("iframe, canvas, video");if(o.length>5e3)return t.push("Blind-spot scan skipped on this very large page."),n;const s={iframeHosts:[],taintedCanvases:0,blankCanvases:0,videos:0};for(const r of o){if(performance.now()-i>5)break;if(r.closest(`[${_("root")}]`))continue;const f=r.getBoundingClientRect();if(!(f.width<2||f.height<2))if(r.tagName==="IFRAME"){const d=r;let g=!1;try{d.contentDocument||(g=!0)}catch{g=!0}if(g){let u="";try{u=new URL(d.src,e.baseURI).host}catch{}s.iframeHosts.push(u),n.push({el:r,rect:f,label:"iframe not captured"})}}else if(r.tagName==="CANVAS"){const d=r;let g=!1;try{d.toDataURL()}catch(u){g=u.name==="SecurityError"}g?s.taintedCanvases++:s.blankCanvases++,n.push({el:r,rect:f,label:"canvas not captured"})}else s.videos++,n.push({el:r,rect:f,label:"video not captured"})}return t.push(...j(s)),n}function Re(e,t,i,n,o,s){e.save(),e.beginPath(),e.rect(t,i,n,o),e.clip(),e.fillStyle="#f3f3f3",e.fillRect(t,i,n,o),e.strokeStyle="#d0d0d0",e.lineWidth=1,e.beginPath();for(let r=-o;r<n;r+=12)e.moveTo(t+r,i+o),e.lineTo(t+r+o,i);e.stroke(),e.strokeRect(t+.5,i+.5,n-1,o-1),n>=120&&o>=20&&(e.fillStyle="#8a8f98",e.font="11px system-ui, sans-serif",e.textAlign="center",e.fillText(s,t+n/2,i+o/2+4)),e.restore()}function Me(e,t,i,n,o){e.save(),e.fillStyle="#5b5f66",e.fillRect(t,i,n,o),e.strokeStyle="#8a8f98",e.lineWidth=1,e.strokeRect(t+.5,i+.5,n-1,o-1),n>=80&&o>=24&&(e.fillStyle="#c9cdd3",e.font="11px system-ui, sans-serif",e.textAlign="center",e.fillText("masked",t+n/2,i+o/2+4)),e.restore()}function Ce(e){const t=e.defaultView??window;for(const i of[e.documentElement,e.body]){if(!i)continue;const n=t.getComputedStyle(i).backgroundColor;if(n&&n!=="rgba(0, 0, 0, 0)"&&n!=="transparent")return n}return"#ffffff"}async function N(e,t,i,n,o){const s=e.doc,r=s.defaultView??window,f=`[${_("root")}]`,d=[];if(await Promise.race([new Promise(a=>r.requestAnimationFrame(()=>r.requestAnimationFrame(a))),new Promise(a=>r.setTimeout(a,50))]),s.hidden&&await new Promise(a=>{const c=r.setTimeout(a,500);s.addEventListener("visibilitychange",()=>{r.clearTimeout(c),a()},{once:!0})}),e.signal?.aborted)throw new Error("navigated");let g,u;try{const a=ve(e).join(", "),c=[...s.querySelectorAll(a)].filter(b=>!b.closest(f));u=new Set(c),g=c.map(b=>b.getBoundingClientRect()).filter(b=>b.width>0&&b.height>0)}catch(a){throw Object.assign(new Error("masking-failed"),{cause:a})}const{overlays:w,notes:l}=n?ke(s,e.maxOverlays??8):{overlays:[],notes:[]};d.push(...l);const p=Se(s,d),C=new Set([...w.map(a=>a.el),...u]);let h=Math.min(r.devicePixelRatio||1,e.maxDpr??2);const A=s.documentElement,O=t==="viewport"?A.scrollWidth:0,v=t==="viewport"?A.scrollHeight:0,k=e.maxRasterPixels??4e7;if(t==="viewport"){const a=O*v*h*h;if(a>k&&(h=Math.max(1,h*Math.sqrt(k/a))),O*v>k)return N(e,"element",i,n,!0)}let M=A,S,E={x:0,y:0};if(t==="viewport")S={x:0,y:0,w:r.innerWidth,h:r.innerHeight};else{const a=e.target&&e.target.isConnected?e.target:A,c=a.getBoundingClientRect(),b=200,B=Math.max(0,c.left-b),U=Math.max(0,c.top-b),K=Math.min(r.innerWidth,c.right+b),Z=Math.min(r.innerHeight,c.bottom+b);let $=a;for(;$.parentElement&&$!==A;){const D=$.getBoundingClientRect();if(D.left<=B&&D.top<=U&&D.right>=K&&D.bottom>=Z)break;$=$.parentElement}M=$;const ee=$.getBoundingClientRect();S={x:B-ee.left,y:U-ee.top,w:K-B,h:Z-U},E={x:B,y:U}}const m=await z(M,{drop:a=>a.closest?.(f)!=null,hide:a=>C.has(a),inlineSameOriginAssets:i,...e.fetchForeignImage?{fetchForeignImage:e.fetchForeignImage}:{}});if(d.push(...m.blindSpots),e.signal?.aborted)throw m.image.src="",new Error("navigated");const R=M.getBoundingClientRect(),x=t==="viewport"?-R.left:S.x,de=t==="viewport"?-R.top:S.y,y=s.createElement("canvas");y.width=Math.max(1,Math.round(S.w*h)),y.height=Math.max(1,Math.round(S.h*h));const I=y.getContext("2d");I.fillStyle=Ce(s),I.fillRect(0,0,y.width,y.height),I.drawImage(m.image,x,de,S.w,S.h,0,0,y.width,y.height),m.image.src="",w.some(a=>a.modal)&&(I.fillStyle="rgba(0,0,0,0.35)",I.fillRect(0,0,y.width,y.height));let Q=0;for(const a of w)try{const c=await z(a.el,{drop:b=>b.closest?.(f)!=null,hide:b=>u.has(b),inlineSameOriginAssets:i,...e.fetchForeignImage?{fetchForeignImage:e.fetchForeignImage}:{}});I.drawImage(c.image,Math.round(a.rect.left*h),Math.round(a.rect.top*h),Math.round(a.rect.width*h),Math.round(a.rect.height*h)),c.image.src=""}catch{Q++}d.push(...j({failedOverlays:Q}));const J=a=>({x:Math.round((a.left-E.x)*h),y:Math.round((a.top-E.y)*h),w:Math.round(a.width*h),h:Math.round(a.height*h)});for(const a of p){const c=J(a.rect);c.w>0&&c.h>0&&Re(I,c.x,c.y,c.w,c.h,a.label)}let H=0;try{for(const a of g){const c=J(a);c.w<=0||c.h<=0||(Me(I,c.x,c.y,c.w,c.h),H++)}}catch(a){throw Object.assign(new Error("masking-failed"),{cause:a})}if(e.signal?.aborted)throw new Error("navigated");let L;try{L=await le(y,s,e.maxLongestSide??X)}catch(a){throw y.width=y.height=0,a.name==="SecurityError"?new Error("tainted"):a}return y.width=y.height=0,L?{situation:o?"scope-forced":"ok",blob:L.blob,quality:L.quality,width:Math.round(S.w),height:Math.round(S.h),blindSpots:d,maskedCount:H}:{situation:"engine-failed",blindSpots:d,maskedCount:H}}function Y(e,t){return Promise.race([e.catch(i=>i.message==="masking-failed"?{situation:"masking-failed",blindSpots:[],maskedCount:0}:i.message==="navigated"?{situation:"navigated",blindSpots:[],maskedCount:0}:i.message==="tainted"?{situation:"tainted",blindSpots:[],maskedCount:0}:{situation:"engine-failed",blindSpots:[],maskedCount:0}),new Promise(i=>setTimeout(()=>i({situation:"timeout",blindSpots:[],maskedCount:0}),t))])}async function Ie(e){if(!await oe(e.doc))return{situation:"csp-blocked",blindSpots:[],maskedCount:0};const t=e.scope??"viewport",i=[e.timeoutMs??3e3,1500,1500];let n=await Y(N(e,t,!0,!0,!1),Math.min(i[0],1e4));if(n.situation==="ok"||n.situation==="scope-forced"||n.situation==="masking-failed"||n.situation==="navigated"||n.situation==="tainted"||(n=await Y(N(e,t,!1,!1,!1),i[1]),n.situation==="ok"||n.situation==="scope-forced"||n.situation==="masking-failed"||n.situation==="navigated"||n.situation==="tainted"))return n;const o=await Y(N(e,"element",!1,!1,!0),i[2]);return o.situation==="ok"||o.situation==="scope-forced"?o:o.situation==="engine-failed"&&n.situation==="timeout"?n:o}const Ee="screenshot";export{Ee as CHUNK,X as MAX_LONGEST_SIDE,G as TARGET_BYTES,se as canEncodeWebp,Ie as captureScreenshot,le as encodeToBudget,oe as probeDataImages,z as rasterise};
@@ -1 +0,0 @@
1
- import{r as l,d as O,e as M,V as w,j as T,aq as Y,Y as _,E as j,ap as S,i as k}from"./index-C6gyyLd5.js";const H=l.createContext(void 0);function K(){return l.useContext(H)?.direction??"ltr"}const y=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function B(){return l.useContext(y)}function F(s={}){const{guess:o,label:e,metadata:r,textRef:f,index:t}=s,{register:i,unregister:u,subscribeMapChange:d,nextIndexRef:h}=B(),c=l.useRef(-1),[g,C]=l.useState(t==null&&o?()=>{if(c.current===-1){const p=h.current;h.current+=1,c.current=p}return c.current}:-1),v=t??g,R=l.useRef(null),E=l.useCallback(p=>{const b=R.current;b&&u(b),R.current=p,p&&i(p,{metadata:r??null,index:t??null,label:e,textRef:f})},[t,i,u,r,e,f]);return O(()=>{if(t==null)return d(p=>{const b=R.current?p.get(R.current)?.index:null;b!=null&&C(b)})},[t,d]),{ref:E,index:v}}function Q(s){const{children:o,elementsRef:e,labelsRef:r,onMapChange:f}=s,t=M(f),[,i]=l.useState(!1),u=w(V).current,d=w(U).current,h=l.useRef(0),c=l.useRef(!0),g=l.useRef([]),C=l.useRef(null),v=M(()=>{c.current||(c.current=!0,i(n=>!n))}),R=M((n,x)=>{d.set(n,x),v()}),E=M(n=>{d.delete(n),v()}),p=M(n=>{const x=new Map;return e.current.length=0,r&&(r.current.length=0),n.forEach(a=>{x.set(a.element,{...a.registration.metadata??{},index:a.index}),e.current[a.index]=a.element,r&&(r.current[a.index]=a.registration.label!==void 0?a.registration.label:a.registration.textRef?.current?.textContent??a.element.textContent)}),h.current=e.current.length,x});function b(n){if(C.current?.disconnect(),C.current=null,typeof MutationObserver!="function"||n.length<2)return;const x=new MutationObserver(m=>{if(!z(m))return;let I=null;for(const L of n)if(L.isConnected){if(I&&D(I,L)>0){x.disconnect(),v();return}I=L}});C.current=x;const a=new Set;for(let m=1;m<n.length;m+=1){const I=q(n[m-1],n[m]);I&&a.add(I)}a.forEach(m=>x.observe(m,{childList:!0}))}const N=M(()=>{const[n,x]=W(d),a=p(n);b(x),g.current=n,c.current=!1,u.forEach(m=>m(a)),t(a)});O(()=>(c.current||p(g.current),()=>{e.current=[],r&&(r.current=[])}),[e,r,p]),O(()=>{c.current&&N()}),O(()=>()=>{C.current?.disconnect(),c.current=!0},[]);const P=M(n=>(u.add(n),()=>{u.delete(n)})),A=l.useMemo(()=>({register:R,unregister:E,subscribeMapChange:P,nextIndexRef:h}),[R,E,P,h]);return T.jsx(y.Provider,{value:A,children:o})}function U(){return new Map}function V(){return new Set}function W(s){const o=new Set,e=[],r=[];s.forEach((t,i)=>{if(!i.isConnected)return;const u=t.index,d={index:u??-1,element:i,registration:t};u===null?r.push(d):u>=0&&(o.add(u),e.push(d))});let f=0;return r.sort((t,i)=>D(t.element,i.element)),r.forEach(t=>{for(;o.has(f);)f+=1;t.index=f,e.push(t),f+=1}),o.size>0&&e.sort((t,i)=>t.index-i.index),[e,r.map(t=>t.element)]}function q(s,o){let e=s.parentElement;for(;e&&!e.contains(o);)e=e.parentElement;return e}function z(s){for(const o of s)for(let e=0;e<o.removedNodes.length;e+=1)if(o.removedNodes[e].isConnected)return!0;return!1}function D(s,o){return s.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function G(s={}){const{highlightItemOnHover:o,highlightedIndex:e,onHighlightedIndexChange:r}=Y(),{ref:f,index:t}=F(s),i=e===t,u=l.useRef(null),d=_(f,u);return{compositeProps:{tabIndex:i?0:-1,onFocus(){r(t)},onMouseMove(){const c=u.current;if(!o||!c)return;const g=c.hasAttribute("disabled")||c.ariaDisabled==="true";!i&&!g&&c.focus()}},compositeRef:d,index:t}}function X(s){const{render:o,className:e,style:r,state:f=j,props:t=S,refs:i=S,metadata:u,stateAttributesMapping:d,tag:h="div",...c}=s,{compositeProps:g,compositeRef:C}=G({metadata:u});return k(h,s,{state:f,ref:[C,...i],props:[g,...t,c],stateAttributesMapping:d})}export{Q as C,F as a,X as b,K as u};