@snagset/server 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -0
- package/dist/app.js +453 -0
- package/dist/app.js.map +1 -0
- package/dist/bin.js +951 -0
- package/dist/bin.js.map +1 -0
- package/dist/boot.js +321 -0
- package/dist/boot.js.map +1 -0
- package/dist/config.generated.js +116 -0
- package/dist/config.generated.js.map +1 -0
- package/dist/config.js +180 -0
- package/dist/config.js.map +1 -0
- package/dist/crypto.js +26 -0
- package/dist/crypto.js.map +1 -0
- package/dist/db/connect.js +49 -0
- package/dist/db/connect.js.map +1 -0
- package/dist/db/migrate.js +210 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/migrations/0001_init.sql +1060 -0
- package/dist/db/migrations/0002_maintenance_claim.sql +109 -0
- package/dist/db/migrations/0003_email_provider.sql +35 -0
- package/dist/db/migrations/0004_unsubscribe.sql +24 -0
- package/dist/db/rls.js +58 -0
- package/dist/db/rls.js.map +1 -0
- package/dist/jobs/index.js +171 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/reaper.js +182 -0
- package/dist/jobs/reaper.js.map +1 -0
- package/dist/keys.js +77 -0
- package/dist/keys.js.map +1 -0
- package/dist/mail/index.js +75 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/mail/mailer.js +27 -0
- package/dist/mail/mailer.js.map +1 -0
- package/dist/mail/notify.js +405 -0
- package/dist/mail/notify.js.map +1 -0
- package/dist/mail/resend.js +95 -0
- package/dist/mail/resend.js.map +1 -0
- package/dist/mail/smtp.js +315 -0
- package/dist/mail/smtp.js.map +1 -0
- package/dist/mail/unsubscribe.js +134 -0
- package/dist/mail/unsubscribe.js.map +1 -0
- package/dist/projectCache.js +50 -0
- package/dist/projectCache.js.map +1 -0
- package/dist/projects.js +101 -0
- package/dist/projects.js.map +1 -0
- package/dist/routes/attachments.js +159 -0
- package/dist/routes/attachments.js.map +1 -0
- package/dist/routes/auth.js +55 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/commentEdit.js +201 -0
- package/dist/routes/commentEdit.js.map +1 -0
- package/dist/routes/comments.js +313 -0
- package/dist/routes/comments.js.map +1 -0
- package/dist/routes/cors.js +174 -0
- package/dist/routes/cors.js.map +1 -0
- package/dist/routes/jobs.js +56 -0
- package/dist/routes/jobs.js.map +1 -0
- package/dist/routes/mcpAuth.js +187 -0
- package/dist/routes/mcpAuth.js.map +1 -0
- package/dist/routes/mcpToken.js +94 -0
- package/dist/routes/mcpToken.js.map +1 -0
- package/dist/routes/owner.js +288 -0
- package/dist/routes/owner.js.map +1 -0
- package/dist/routes/reviewLinks.js +169 -0
- package/dist/routes/reviewLinks.js.map +1 -0
- package/dist/routes/rounds.js +137 -0
- package/dist/routes/rounds.js.map +1 -0
- package/dist/routes/sessions.js +349 -0
- package/dist/routes/sessions.js.map +1 -0
- package/dist/routes/sites.js +192 -0
- package/dist/routes/sites.js.map +1 -0
- package/dist/routes/threads.js +1080 -0
- package/dist/routes/threads.js.map +1 -0
- package/dist/routes/widget.js +132 -0
- package/dist/routes/widget.js.map +1 -0
- package/dist/serverless.js +97 -0
- package/dist/serverless.js.map +1 -0
- package/dist/session.js +152 -0
- package/dist/session.js.map +1 -0
- package/dist/storage/bucket.js +116 -0
- package/dist/storage/bucket.js.map +1 -0
- package/dist/storage/settings.js +132 -0
- package/dist/storage/settings.js.map +1 -0
- package/dist/vendor/adapters/index.js +1 -0
- package/dist/vendor/adapters/outbound/fence.js +44 -0
- package/dist/vendor/adapters/outbound/sanitise.js +233 -0
- package/dist/vendor/types/index.js +4 -0
- package/dist/vendor/types/names.js +254 -0
- package/dist/vendor/widget/object.js +38 -0
- package/dist/vendor/widget/predicates.js +377 -0
- package/package.json +53 -0
- package/static/dashboard/assets/index-CaPfKhFP.css +1 -0
- package/static/dashboard/assets/index-DfTNjHCK.js +1 -0
- package/static/dashboard/index.html +14 -0
- package/static/widget/snag.anchor-ext.js +1 -0
- package/static/widget/snag.anchor-fuzzy.js +1 -0
- package/static/widget/snag.capture.js +4 -0
- package/static/widget/snag.crumbs.js +4 -0
- package/static/widget/snag.dock.js +5 -0
- package/static/widget/snag.js +5 -0
- package/static/widget/snag.panels.js +2 -0
- package/static/widget/snag.runtime.js +2 -0
- package/static/widget/snag.screenshot.js +1 -0
- package/static/widget/snag.text.js +2 -0
- package/vercel.json +6 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var J,v,$e,D,we,ke,Se,ie,X,B,Ce,ce,le,_e,Q={},Z=[],it=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ee=Array.isArray;function N(e,t){for(var n in t)e[n]=t[n];return e}function ue(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ct(e,t,n){var r,a,o,c={};for(o in t)o=="key"?r=t[o]:o=="ref"?a=t[o]:c[o]=t[o];if(arguments.length>2&&(c.children=arguments.length>3?J.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)c[o]===void 0&&(c[o]=e.defaultProps[o]);return te(e,c,r,a,null)}function te(e,t,n,r,a){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++$e,__i:-1,__u:0};return a==null&&v.vnode!=null&&v.vnode(o),o}function z(e){return e.children}function ne(e,t){this.props=e,this.context=t}function F(e,t){if(t==null)return e.__?F(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?F(e):null}function lt(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],o=N({},t);o.__v=t.__v+1,v.vnode&&v.vnode(o),de(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??F(t),!!(32&t.__u),a),o.__v=t.__v,o.__.__k[o.__i]=o,Le(r,o,a),t.__e=t.__=null,o.__e!=n&&Te(o)}}function Te(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Te(e)}function Ee(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!oe.__r++||we!=v.debounceRendering)&&((we=v.debounceRendering)||ke)(oe)}function oe(){try{for(var e,t=1;D.length;)D.length>t&&D.sort(Se),e=D.shift(),t=D.length,lt(e)}finally{D.length=oe.__r=0}}function Ae(e,t,n,r,a,o,c,l,p,i,d){var b,s,_,$,T,C,y=r&&r.__k||Z,m=t.length;for(p=_t(n,t,y,p,m),b=0;b<m;b++)(_=n.__k[b])!=null&&(s=_.__i!=-1&&y[_.__i]||Q,_.__i=b,C=de(e,_,s,a,o,c,l,p,i,d),$=_.__e,_.ref&&s.ref!=_.ref&&(s.ref&&pe(s.ref,null,_),d.push(_.ref,_.__c||$,_)),T==null&&$!=null&&(T=$),4&_.__u?(p=He(_,p,e),s.__e&&(s.__e=null)):typeof _.type=="function"&&C!==void 0?p=C:$&&(p=$.nextSibling),_.__u&=-7);return n.__e=T,p}function _t(e,t,n,r,a){var o,c,l,p,i,d=n.length,b=d,s=0;for(e.__k=new Array(a),o=0;o<a;o++)(c=t[o])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=e.__k[o]=te(null,c,null,null,null):ee(c)?c=e.__k[o]=te(z,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=e.__k[o]=te(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):e.__k[o]=c,p=o+s,c.__=e,c.__b=e.__b+1,l=null,(i=c.__i=ut(c,n,p,b))!=-1&&(b--,(l=n[i])&&(l.__u|=2)),l==null||l.__v==null?(i==-1&&(a>d?s--:a<d&&s++),typeof c.type!="function"&&(c.__u|=4)):i!=p&&(i==p-1?s--:i==p+1?s++:(i>p?s--:s++,c.__u|=4))):e.__k[o]=null;if(b)for(o=0;o<d;o++)(l=n[o])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=F(l)),Ie(l,l));return r}function He(e,t,n){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=He(r[a],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=F(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ut(e,t,n,r){var a,o,c,l=e.key,p=e.type,i=t[n],d=i!=null&&(2&i.__u)==0;if(i===null&&l==null||d&&l==i.key&&p==i.type)return n;if(r>(d?1:0)){for(a=n-1,o=n+1;a>=0||o<t.length;)if((i=t[c=a>=0?a--:o++])!=null&&(2&i.__u)==0&&l==i.key&&p==i.type)return c}return-1}function Me(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||it.test(t)?n:n+"px"}function re(e,t,n,r,a){var o,c;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Me(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Me(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Ce,"$1")),c=t.toLowerCase(),t=c in e||t=="onFocusOut"||t=="onFocusIn"?c.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[B]=r[B]:(n[B]=ce,e.addEventListener(t,o?_e:le,o)):e.removeEventListener(t,o?_e:le,o);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Pe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[X]==null)t[X]=ce++;else if(t[X]<n[B])return;return n(v.event?v.event(t):t)}}}function de(e,t,n,r,a,o,c,l,p,i){var d,b,s,_,$,T,C,y,m,w,I,M,L,O,R,A,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(p=!!(32&n.__u),o=[l=t.__e=n.__e]),(d=v.__b)&&d(t);e:if(typeof H=="function"){b=c.length;try{if(m=t.props,w=H.prototype&&H.prototype.render,I=(d=H.contextType)&&r[d.__c],M=d?I?I.props.value:d.__:r,n.__c?y=(s=t.__c=n.__c).__=s.__E:(w?t.__c=s=new H(m,M):(t.__c=s=new ne(m,M),s.constructor=H,s.render=pt),I&&I.sub(s),s.state||(s.state={}),s.__n=r,_=s.__d=!0,s.__h=[],s._sb=[]),w&&s.__s==null&&(s.__s=s.state),w&&H.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=N({},s.__s)),N(s.__s,H.getDerivedStateFromProps(m,s.__s))),$=s.props,T=s.state,s.__v=t,_)w&&H.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),w&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(w&&H.getDerivedStateFromProps==null&&m!==$&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(m,M),t.__v==n.__v||!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(m,s.__s,M)===!1){t.__v!=n.__v&&(s.props=m,s.state=s.__s,s.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(P){P&&(P.__=t)}),Z.push.apply(s.__h,s._sb),s._sb=[],s.__h.length&&c.push(s),l=F(n);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(m,s.__s,M),w&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate($,T,C)})}if(s.context=M,s.props=m,s.__P=e,s.__e=!1,L=v.__r,O=0,w)s.state=s.__s,s.__d=!1,L&&L(t),d=s.render(s.props,s.state,s.context),Z.push.apply(s.__h,s._sb),s._sb=[];else do s.__d=!1,L&&L(t),d=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++O<25);s.state=s.__s,s.getChildContext!=null&&(r=N(N({},r),s.getChildContext())),w&&!_&&s.getSnapshotBeforeUpdate!=null&&(C=s.getSnapshotBeforeUpdate($,T)),R=d!=null&&d.type===z&&d.key==null?De(d.props.children):d,l=Ae(e,ee(R)?R:[R],t,n,r,a,o,c,l,p,i),s.base=t.__e,t.__u&=-161,s.__h.length&&c.push(s),y&&(s.__E=s.__=null)}catch(P){if(c.length=b,t.__v=null,p||o!=null){if(P.then){for(t.__u|=p?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o!=null&&(o[o.indexOf(l)]=null),t.__e=l}else if(o!=null)for(A=o.length;A--;)ue(o[A])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),P.then||Ne(t),v.__e(P,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=dt(n.__e,t,n,r,a,o,c,p,i);return(d=v.diffed)&&d(t),128&t.__u?void 0:l}function Ne(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ne))}function Le(e,t,n){for(var r=0;r<n.length;r++)pe(n[r],n[++r],n[++r]);v.__c&&v.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(o){o.call(a)})}catch(o){v.__e(o,a.__v)}})}function De(e){return typeof e!="object"||e==null||e.__b>0?e:ee(e)?e.map(De):e.constructor!==void 0?null:N({},e)}function dt(e,t,n,r,a,o,c,l,p){var i,d,b,s,_,$,T,C=n.props||Q,y=t.props,m=t.type;if(m=="svg"?a="http://www.w3.org/2000/svg":m=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),o!=null){for(i=0;i<o.length;i++)if((_=o[i])&&"setAttribute"in _==!!m&&(m?_.localName==m:_.nodeType==3)){e=_,o[i]=null;break}}if(e==null){if(m==null)return document.createTextNode(y);e=document.createElementNS(a,m,y.is&&y),l&&(v.__m&&v.__m(t,o),l=!1),o=null}if(m==null)C===y||l&&e.data==y||(e.data=y);else{if(o=m=="textarea"&&y.defaultValue!=null?null:o&&J.call(e.childNodes),!l&&o!=null)for(C={},i=0;i<e.attributes.length;i++)C[(_=e.attributes[i]).name]=_.value;for(i in C)_=C[i],i=="dangerouslySetInnerHTML"?b=_:i=="children"||i in y||i=="value"&&"defaultValue"in y||i=="checked"&&"defaultChecked"in y||re(e,i,null,_,a);for(i in y)_=y[i],i=="children"?s=_:i=="dangerouslySetInnerHTML"?d=_:i=="value"?$=_:i=="checked"?T=_:l&&typeof _!="function"||C[i]===_||re(e,i,_,C[i],a);if(d)l||b&&(d.__html==b.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(b&&(e.innerHTML=""),Ae(t.type=="template"?e.content:e,ee(s)?s:[s],t,n,r,m=="foreignObject"?"http://www.w3.org/1999/xhtml":a,o,c,o?o[0]:n.__k&&F(n,0),l,p),o!=null)for(i=o.length;i--;)ue(o[i]);l&&m!="textarea"||(i="value",m=="progress"&&$==null?e.removeAttribute("value"):$!=null&&($!==e[i]||m=="progress"&&!$||m=="option"&&$!=C[i])&&re(e,i,$,C[i],a),i="checked",T!=null&&T!=e[i]&&re(e,i,T,C[i],a))}return e}function pe(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(a){v.__e(a,n)}}function Ie(e,t,n){var r,a;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||pe(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){v.__e(o,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&Ie(r[a],t,n||typeof e.type!="function");n||ue(e.__e),e.__c=e.__=e.__e=void 0}function pt(e,t,n){return this.constructor(e,n)}function Re(e,t,n){var r,a,o,c;t==document&&(t=document.documentElement),v.__&&v.__(e,t),a=(r=!1)?null:t.__k,o=[],c=[],de(t,e=t.__k=ct(z,null,[e]),a||Q,Q,t.namespaceURI,a?null:t.firstChild?J.call(t.childNodes):null,o,a?a.__e:t.firstChild,r,c),Le(o,e,c),e.props.children=null}J=Z.slice,v={__e:function(e,t,n,r){for(var a,o,c;t=t.__;)if((a=t.__c)&&!a.__)try{if((o=a.constructor)&&o.getDerivedStateFromError!=null&&(a.setState(o.getDerivedStateFromError(e)),c=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),c=a.__d),c)return a.__E=a}catch(l){e=l}throw e}},$e=0,ne.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=N({},this.state),typeof e=="function"&&(e=e(N({},n),this.props)),e&&N(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ee(this))},ne.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ee(this))},ne.prototype.render=z,D=[],ke=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Se=function(e,t){return e.__v.__b-t.__v.__b},oe.__r=0,ie=Math.random().toString(8),X="__d"+ie,B="__a"+ie,Ce=/(PointerCapture)$|Capture$/i,ce=0,le=Pe(!1),_e=Pe(!0);var ft=0;function g(e,t,n,r,a,o){t||(t={});var c,l,p=t;if("ref"in p)for(l in p={},t)l=="ref"?c=t[l]:p[l]=t[l];var i={type:e,props:p,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ft,__i:-1,__u:0,__source:a,__self:o};if(typeof e=="function"&&(c=e.defaultProps))for(l in c)p[l]===void 0&&(p[l]=c[l]);return v.vnode&&v.vnode(i),i}var Y,k,fe,Fe,se=0,Oe=[],S=v,ze=S.__b,Ue=S.__r,We=S.diffed,je=S.__c,qe=S.unmount,Be=S.__;function he(e,t){S.__h&&S.__h(k,e,se||t),se=0;var n=k.__H||(k.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function U(e){return se=1,ht(Ve,e)}function ht(e,t,n){var r=he(Y++,2);if(r.t=e,!r.__c&&(r.__=[Ve(void 0,t),function(l){var p=r.__N?r.__N[0]:r.__[0],i=r.t(p,l);p!==i&&(r.__N=[i,r.__[1]],r.__c.setState({}))}],r.__c=k,!k.__f)){var a=function(l,p,i){if(!r.__c.__H)return!0;var d=!1,b=r.__c.props!==l;if(r.__c.__H.__.some(function(_){if(_.__N){d=!0;var $=_.__[0];_.__=_.__N,_.__N=void 0,$!==_.__[0]&&(b=!0)}}),o){var s=o.call(this,l,p,i);return d?s||b:s}return!d||b};k.__f=!0;var o=k.shouldComponentUpdate,c=k.componentWillUpdate;k.componentWillUpdate=function(l,p,i){if(this.__e){var d=o;o=void 0,a(l,p,i),o=d}c&&c.call(this,l,p,i)},k.shouldComponentUpdate=a}return r.__N||r.__}function me(e,t){var n=he(Y++,3);!S.__s&&Ke(n.__H,t)&&(n.__=e,n.u=t,k.__H.__h.push(n))}function K(e){return se=5,mt(function(){return{current:e}},[])}function mt(e,t){var n=he(Y++,7);return Ke(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function gt(){for(var e;e=Oe.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ae),t.__h.some(ge),t.__h=[]}catch(n){t.__h=[],S.__e(n,e.__v)}}}S.__b=function(e){k=null,ze&&ze(e)},S.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Be&&Be(e,t)},S.__r=function(e){Ue&&Ue(e),Y=0;var t=(k=e.__c).__H;t&&(fe===k?(t.__h=[],k.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ae),t.__h.some(ge),t.__h=[],Y=0)),fe=k},S.diffed=function(e){We&&We(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Oe.push(t)!==1&&Fe===S.requestAnimationFrame||((Fe=S.requestAnimationFrame)||vt)(gt)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),fe=k=null},S.__c=function(e,t){t.some(function(n){try{n.__h.some(ae),n.__h=n.__h.filter(function(r){return!r.__||ge(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],S.__e(r,n.__v)}}),je&&je(e,t)},S.unmount=function(e){qe&&qe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ae(r)}catch(a){t=a}}),n.__H=void 0,t&&S.__e(t,n.__v))};var Ye=typeof requestAnimationFrame=="function";function vt(e){var t,n=function(){clearTimeout(r),Ye&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ye&&(t=requestAnimationFrame(n))}function ae(e){var t=k,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),k=t}function ge(e){var t=k;e.__c=e.__(),k=t}function Ke(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ve(e,t){return typeof t=="function"?t(e):t}const bt="Snagset",yt="Snagset",xt="Snag",$t="Snags",wt={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},kt=e=>wt[e],f={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"},St=e=>`var(${f[e]})`,Ge="snag:disclosure:v1",Je="snag:identity",Ct="data-snag-theme";function Xe(){let e=null;try{e=localStorage.getItem(Je)}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 Tt(e){try{localStorage.setItem(Je,JSON.stringify(e))}catch{}}function Et(){const e=Xe();return{name:typeof e.name=="string"?e.name:"",...e.email?{email:e.email}:{}}}function At(e){const t=Xe();Tt({...t,name:e.name,...e.email?{email:e.email}:{}})}function Ht(e){const t=window.visualViewport;if(!t)return;let n=0,r=0;const a=()=>{n=0;const l=Math.max(0,Math.round(window.innerHeight-t.height-t.offsetTop));e.style.setProperty(f.kb,`${l}px`)},o=()=>{n||(n=requestAnimationFrame(a))},c=()=>{clearTimeout(r),r=window.setTimeout(a,300)};return a(),t.addEventListener("resize",o),t.addEventListener("scroll",o),window.addEventListener("orientationchange",o),e.addEventListener("focusout",c),()=>{n&&cancelAnimationFrame(n),clearTimeout(r),t.removeEventListener("resize",o),t.removeEventListener("scroll",o),window.removeEventListener("orientationchange",o),e.removeEventListener("focusout",c)}}const Mt={product:bt,set:yt,item:xt,items:$t};function Pt(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(r,a)=>{const o=n?.[a]??Mt[a];return o===void 0?r:String(o)})}const Nt=e=>new Intl.NumberFormat().format(e),Lt={"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}"},Dt={open:{colour:"#4F6EF7"},progress:{colour:"#F59E0B"},review:{colour:"#8B5CF6"},resolved:{colour:"#10B981"}},u=Object.fromEntries(Object.keys(f).map(e=>[e,St(e)])),It=Object.entries(Dt).map(([e,t])=>` ${f[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
|
|
2
|
+
`);`${u.font}${u.fg}${f.font}${f.accent}${f.bg}${f.fg}${f.muted}${f.border}${f.radius}${f.shadow}${f.z}${f.motion}${f.surface}${u.fg}${u.bg}${f.sunken}${u.fg}${u.bg}${f.hover}${u.fg}${u.bg}${f.onAccent}${f.focus}${u.accent}${u.fg}${f.disabled}${u.muted}${u.bg}${It}${f.anchorOrphan}${Ct}${f.accent}${f.onAccent}${f.bg}${f.fg}${f.muted}${f.border}${f.shadow}${f.motion}${f.bg}${f.fg}${f.muted}${f.border}${f.accent}${f.onAccent}${f.surface}${f.sunken}${f.hover}${f.focus}${f.disabled}${f.shadow}${f.anchorOrphan}`;const Rt={composer:8},Qe=new WeakMap;function Ze(e,t,n){let r=Qe.get(e);if(r||Qe.set(e,r=new Set),r.has(t))return;r.add(t);try{const c=new CSSStyleSheet;c.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,c];return}catch{}const o=(e.ownerDocument??document).createElement("style");o.setAttribute(`data-snag-${t}`,""),o.textContent=n,e.appendChild(o)}const Ft=` .snag-input,.snag-text{width:100%;box-sizing:border-box;background:${u.surface};color:inherit;border:1px solid ${u.border};border-radius:${u.radius};padding:8px;font:inherit;resize:vertical}@media (pointer:coarse){.snag-input,.snag-text{font-size:16px}}.snag-input:focus,.snag-text:focus{outline:2px solid ${u.focus};outline-offset:1px;border-color:transparent}.snag-input--bad{border-color:${u.anchorOrphan}}.snag-note{margin:-2px 0 0;color:${u.anchorOrphan};font-size:11px;line-height:1.35}.snag-note.snag-dim{color:${u.muted}}.snag-actions{display:flex;justify-content:flex-end;gap:6px}.snag-actions button{appearance:none;border:0;border-radius:calc(${u.radius} - 1px);padding:7px 13px;font:inherit;cursor:pointer;min-height:32px;transition:background ${u.motion}}.snag-cancel{background:transparent;color:${u.muted}}.snag-armed{color:${u.anchorOrphan};font-weight:600}.snag-cancel:hover{background:${u.hover};color:inherit}.snag-send{background:${u.accent};color:${u.onAccent};font-weight:600}.snag-send:disabled{opacity:.45;cursor:not-allowed}.snag-actions button:focus-visible{outline:2px solid ${u.focus};outline-offset:2px}`;function Ot(e,t,n){const[r,a]=U(!1);return me(()=>{if(!r)return;const o=setTimeout(()=>a(!1),3e3);return()=>clearTimeout(o)},[r]),{armed:r,press(){if(r||t&&!t()){a(!1),e();return}a(!0),n?.()}}}const zt={"detail.details":"Anchor details","detail.hidden":"This element isn't visible right now \u2014 it may be inside a closed menu, tab, or accordion.","detail.orphaned":"The element this was pinned to has moved or gone \u2014 it was {label}.","detail.approximate":"The page changed since this was written, so the pin is close rather than exact \u2014 it points at {label}.","detail.unavailable":"Some of the matching steps couldn't load, so this was judged with the basic ones only.","detail.filedat":"Filed at {query}.","detail.openquery":"Open with original query","capture.agent":"{browser} \xB7 {os}","capture.agent.noos":"{browser}","capture.device":"{device} \xB7 {w}\xD7{h} @{dpr}x","capture.device.at1x":"{device} \xB7 {w}\xD7{h}"},Ut={"disclosure.title":"Before your first comment","disclosure.always":"Each comment carries the page address, viewport size and browser make.","disclosure.crumbs.on":"Recent console messages and network results ride along, recognisable secrets redacted first.","disclosure.crumbs.off":"Console and network capture is off here.","disclosure.screenshot.off":"Screenshots are off for this project.","disclosure.screenshot.on":"{product} never reads what you type. Screenshots are pictures of the page, so anything visible on screen is in the picture \u2014 mark sensitive regions with {maskAttr} and they are blurred before the screenshot leaves your browser.","disclosure.retention":"Everything stays in this browser until someone exports it \u2014 the privacy notes list what can still leak.","disclosure.retention.server":"Your comment, the page address and the details above are sent to {host} when you post \u2014 the privacy notes list what can still leak.","disclosure.ack":"Got it","composer.aria":"New comment","composer.parent":"Pin the parent","composer.child":"Pin the first child","composer.shot":"Add a screenshot","composer.name":"Your name","composer.email":"Email, so we can reply","composer.email.bad":"Check the address \u2014 or leave it blank.","composer.chars":"{n} characters left","composer.body":"Comment","composer.body.placeholder":"What's the {item}?","action.cancel":"Cancel","action.post":"Post comment","composer.discard.sure":"Sure? Discard this comment","action.discard":"Discard?"},Wt={...Lt,...zt,...Ut},x=Pt(Wt),ve=1e4,jt=9e3,qt=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());let et=!1;function Bt(){if(et)return!0;try{return localStorage.getItem(Ge)==="1"}catch{return!1}}function Yt({at:e,label:t,onSend:n,onCancel:r,onRetarget:a,onShotOptIn:o,onDraft:c,initialBody:l,initialName:p,initialEmail:i,crumbsOn:d,quote:b,shotsOn:s,serverHost:_}){const $=Et(),[T,C]=U($.name||(p??"")),[y,m]=U($.email??i??""),[w,I]=U(l??""),M=K(null),L=K(null),O=K(null),[R]=U(!$.name),[A,H]=U(Bt),P=K(null),tt=()=>{et=!0;try{localStorage.setItem(Ge,"1")}catch{}H(!0)},W=window.matchMedia?.("(pointer: coarse)").matches??!1,nt=K(performance.now()).current;me(()=>{if(W)return;const h=O.current,E=h?.getBoundingClientRect();if(h&&E&&(E.bottom>innerHeight-8&&(h.style.top=`${Math.max(8,innerHeight-E.height-8)}px`),E.right>innerWidth-8&&(h.style.left=`${Math.max(8,innerWidth-E.width-8)}px`)),!A){P.current?.focus();return}(R?L:M).current?.focus()},[A]),me(()=>{const h=O.current;if(h)return Ht(h)},[]);const j=y.trim().length>0&&!qt(y),be=w.trim().length>0&&T.trim().length>0&&!j;function ye(){if(!be)return;const h={name:T.trim(),...y.trim()?{email:y.trim()}:{}};At(h),n(w.trim(),h.name,h.email)}const{armed:V,press:G}=Ot(r,()=>w.trim().length>0,()=>M.current?.focus()),ot=h=>{I(h),c?.(h,T,y)},xe=300,rt=Math.min(Math.max(8,e.x+14),innerWidth-xe-8),st=Math.min(Math.max(8,e.y+14),innerHeight-198);return g(z,{children:[W&&g("div",{class:"snag-scrim","aria-hidden":"true",onClick:()=>{performance.now()-nt>400&&G()}}),g("div",{ref:O,class:"snag-composer",role:"dialog","aria-label":x("composer.aria"),style:{left:`${rt}px`,top:`${st}px`,width:`${xe}px`},onKeyDown:h=>{h.key==="Escape"&&(h.stopPropagation(),G()),h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&(h.preventDefault(),ye())},children:[W&&g("div",{class:"snag-grab","aria-hidden":"true",onPointerDown:h=>{const E=h.clientY,q=h.currentTarget;try{q.setPointerCapture(h.pointerId)}catch{}q.onpointermove=at=>{at.clientY-E>56&&(q.onpointermove=null,G())},q.onpointerup=()=>q.onpointermove=null}}),g("div",{class:"snag-head",children:[W&&a&&A&&g("span",{class:"snag-step",children:[g("button",{type:"button","aria-label":x("composer.parent"),onClick:()=>a("up"),children:"\u25B2"}),g("button",{type:"button","aria-label":x("composer.child"),onClick:()=>a("down"),children:"\u25BC"})]}),g("p",{class:"snag-target",title:t,children:t}),g("button",{type:"button",class:`snag-dismiss${V?" snag-armed":""}`,"aria-label":x(V?"composer.discard.sure":"action.cancel"),title:x(V?"composer.discard.sure":"action.cancel"),onClick:G,children:V?x("action.discard"):"\u2715"})]}),!A&&g("div",{class:"snag-disclose",children:[g("p",{class:"snag-disclose-title",children:x("disclosure.title")}),g("p",{children:x("disclosure.always")}),g("p",{children:x(d?"disclosure.crumbs.on":"disclosure.crumbs.off")}),g("p",{children:s?x("disclosure.screenshot.on",{maskAttr:kt("mask")}):x("disclosure.screenshot.off")}),g("p",{children:_?x("disclosure.retention.server",{host:_}):x("disclosure.retention")}),g("div",{class:"snag-actions",children:g("button",{type:"button",ref:P,class:"snag-send snag-primary",onClick:tt,children:x("disclosure.ack")})})]}),A&&R&&g(z,{children:[g("input",{ref:L,class:"snag-input",type:"text",placeholder:x("composer.name"),"aria-label":x("composer.name"),value:T,onInput:h=>{const E=h.target.value;C(E),w.trim()&&c?.(w,E,y)}}),g("input",{class:`snag-input${j?" snag-input--bad":""}`,type:"email",inputMode:"email",autocomplete:"email",placeholder:x("composer.email"),"aria-label":x("composer.email"),"aria-invalid":j?"true":void 0,"aria-describedby":j?"snag-email-note":void 0,value:y,onInput:h=>{const E=h.target.value;m(E),w.trim()&&c?.(w,T,E)}}),j&&g("p",{class:"snag-note",id:"snag-email-note",children:x("composer.email.bad")})]}),A&&b&&g("blockquote",{class:"snag-quote",children:b}),A&&g("textarea",{ref:M,class:"snag-text",placeholder:x("composer.body.placeholder"),"aria-label":x("composer.body"),maxLength:ve,rows:3,enterkeyhint:"enter",value:w,onInput:h=>{const E=h.target;E.style.height="auto",E.style.height=`${Math.min(E.scrollHeight,128)}px`,ot(E.value)}}),A&&w.length>=jt&&g("p",{class:`snag-note${w.length>=ve?"":" snag-dim"}`,"aria-live":"polite",children:x("composer.chars",{n:Nt(ve-w.length)})}),A&&W&&o&&g("label",{class:"snag-shotopt",children:[g("input",{type:"checkbox",onChange:h=>o(h.currentTarget.checked)})," ",x("composer.shot")]}),A&&g("div",{class:"snag-actions",children:g("button",{type:"button",class:"snag-send snag-primary",disabled:!be,onClick:ye,children:x("action.post")})})]})]})}const Kt=` .snag-composer{position:fixed;box-sizing:border-box;z-index:${Rt.composer};background:${u.bg};color:${u.fg};border:1px solid ${u.border};border-radius:calc(${u.radius} + 4px);padding:12px;box-shadow:${u.shadow};pointer-events:auto;font:400 13px/1.45 ${u.font};display:flex;flex-direction:column;gap:8px}.snag-head{display:flex;align-items:center;gap:8px}.snag-target{margin:0;flex:1 1 auto;min-width:0;color:${u.muted};font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.snag-dismiss{flex:0 0 auto;appearance:none;border:0;background:transparent;color:${u.muted};font:inherit;font-size:12px;line-height:1;padding:6px;margin:-6px -4px -6px 0;border-radius:calc(${u.radius} - 2px);cursor:pointer}.snag-dismiss:hover{color:${u.fg};background:${u.hover}}.snag-dismiss:focus-visible{outline:2px solid ${u.focus};outline-offset:1px}.snag-dismiss.snag-armed{color:${u.anchorOrphan};font-weight:600;font-size:11px}.snag-disclose{display:flex;flex-direction:column;gap:6px}.snag-disclose p{margin:0;font-size:12px;line-height:1.5;color:${u.fg}}.snag-disclose .snag-disclose-title{font-weight:600;font-size:12px}.snag-disclose p:not(.snag-disclose-title){color:${u.muted}}.snag-quote{margin:0;padding:6px 10px;border-inline-start:3px solid ${u.accent};background:${u.surface};font-size:12px;color:${u.muted}}.snag-actions .snag-primary{flex:1 1 auto;justify-content:center;padding-block:10px;font-weight:600}@media (pointer:coarse){.snag-composer{left:0!important;right:0;top:auto!important;width:auto!important;inset-block-end:max(var(${f.tbH},68px),var(${f.kb},0px));border-radius:14px 14px 0 0;border-inline:0;border-block-end:0;padding:14px 16px calc(16px + env(safe-area-inset-bottom));gap:10px;box-shadow:0 -8px 32px rgb(0 0 0 / 28%)}.snag-composer .snag-primary{min-height:48px;font-size:15px}.snag-composer .snag-dismiss{padding:10px;margin:-10px -6px -10px 0;font-size:14px}.snag-composer .snag-text{min-height:88px}.snag-composer{overscroll-behavior:contain;padding-inline:calc(16px + env(safe-area-inset-left)) calc(16px + env(safe-area-inset-right))}.snag-scrim{position:fixed;inset:0;background:#0005;touch-action:none;pointer-events:auto}.snag-grab{margin:-14px 0 -8px;padding:12px 0;touch-action:none;pointer-events:auto;background:linear-gradient(${u.border} 0 0) 50%/36px 4px no-repeat}.snag-step{display:flex;gap:2px}.snag-step button{min-width:44px;min-height:44px;background:none;border:1px solid ${u.border};border-radius:8px;color:${u.fg}}.snag-shotopt{display:flex;align-items:center;gap:8px;min-height:44px}}@keyframes snag-pulse{50%{transform:scale(1.04)}}.snag-pulse{animation:snag-pulse 500ms ease-in-out}@media (prefers-reduced-motion:reduce){.snag-pulse{animation:none;outline:2px solid ${u.focus};outline-offset:3px}}`;function Vt(e,t,n){const r=e.ownerDocument??document;Ze(e,"form",Ft),Ze(e,"composer",Kt);const a=r.createElement("div");(n??e).appendChild(a);const o=()=>{Re(null,a),a.remove()},c=()=>a.querySelector(".snag-text"),l=()=>(c()?.value??"").trim().length>0,p=()=>{const i=a.firstElementChild;i&&(i.classList.remove("snag-pulse"),i.offsetWidth,i.classList.add("snag-pulse"),setTimeout(()=>i.classList.remove("snag-pulse"),600))};return Re(g(Yt,{...t,onSend:(i,d,b)=>{t.onSend(i,d,b),o()},onCancel:()=>{t.onCancel(),o()}}),a),{close:o,hasText:l,pulse:p,setLabel(i){const d=a.querySelector(".snag-target");d&&(d.textContent=i,d.title=i)}}}export{Vt as openComposer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const Se="Snagset",yo="snagset",fn="snagset.v1",bo="Snagset",Rt="Snag",vo="Snags",wo={config:"SnagsetConfig"},xo={root:"data-snag-root"},_t=e=>xo[e],So={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},Ao=e=>So[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"},ko=e=>`var(${z[e]})`,$o=e=>"snag_"+e,mt={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},Eo="snag:disclosure:v1",Pt="snag:identity",hn="data-snag-theme",he={session:e=>`snag:session:${e}`,identity:Pt,threads:(e,t)=>`snag:threads:${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:Eo},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"},Co={route:"snagset:route"},pn={original:"snagset.original",wrapped:"snagset.wrapped"},mn="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 gn(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 It(e){const t=e.documentElement,n=e.body;return t&&gn(t)?{parent:n??t,trapped:!0}:n&&gn(n)?{parent:t??n,trapped:!1}:{parent:n??t,trapped:!1}}function yn(e=document){const t=_t("root"),n=e.querySelector(`[${t}]`);if(n?.shadowRoot)return n.shadowRoot;const o=e.createElement("div");return o.setAttribute(t,""),o.style.cssText=mn,It(e).parent.appendChild(o),o.attachShadow({mode:"open"})}function To(e,t,n=5){const o=e.ownerDocument??document,r=e.host,c=It(o).parent;if(typeof MutationObserver!="function"||!c)return()=>{};let u=0;const s=new MutationObserver(()=>{if(!r.isConnected){if(u++,u>n){s.disconnect(),t(u);return}It(o).parent.appendChild(r)}});return s.observe(c,{childList:!0}),()=>s.disconnect()}const Ro={product:Se,set:bo,item:Rt,items:vo};function bn(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(o,r)=>{const c=n?.[r]??Ro[r];return c===void 0?o:String(c)})}const _o=e=>new Intl.NumberFormat().format(e),vn={"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}"},wn=bn(vn),xn={open:{colour:"#4F6EF7"},progress:{colour:"#F59E0B"},review:{colour:"#8B5CF6"},resolved:{colour:"#10B981"}},Sn=e=>e==="progress"||e==="resolved"?"#16161a":"#fff",An=e=>e in xn?wn(`status.${e}`):e,Po=e=>wn(`where.${e.anchorState}`,{label:e.anchor.label});class Mt extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function kn(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 b=Object.fromEntries(Object.keys(z).map(e=>[e,ko(e)])),zo=Object.entries(xn).map(([e,t])=>` ${z[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
|
|
2
|
+
`),Io=` :host{all:initial}[hidden]{display:none!important}:host{display:block;font:400 14px/1.45 ${b.font};color:${b.fg};${z.font}:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;${z.accent}:#5b5bd6;${z.bg}:#fff;${z.fg}:#16161a;${z.muted}:#5f6673;${z.border}:#e4e4e7;${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,${b.fg} 6%,${b.bg});${z.sunken}:color-mix(in srgb,${b.fg} 3%,${b.bg});${z.hover}:color-mix(in srgb,${b.fg} 8%,${b.bg});${z.onAccent}:#fff;${z.focus}:color-mix(in srgb,${b.accent} 62%,${b.fg});${z.disabled}:color-mix(in srgb,${b.muted} 52%,${b.bg});${zo} ${z.anchorOrphan}:#DC2626;}:host([${hn}="dark"]){${z.accent}:#8a8af0;${z.onAccent}:#17171a;${z.bg}:#17171a;${z.fg}:#f4f4f5;${z.muted}:#a1a1aa;${z.border}:#2e2e33;${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}}`,Ze={shield:1,pins:3,dock:5,notice:6,toolbar:7},$n=new WeakMap;function Ge(e,t,n){let o=$n.get(e);if(o||$n.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 c=(e.ownerDocument??document).createElement("style");c.setAttribute(`data-snag-${t}`,""),c.textContent=n,e.appendChild(c)}function Mo(e){return e==="light"||e==="dark"?e:"auto"}function Oo(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 Ot(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=Ot(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 Lo="button,a[href],[role=button],[role=link],[role=tab],[role=menuitem],label,input,select,textarea,summary",Do=3,En=8,No=new Set(["img","picture","canvas","video","audio","iframe","embed","object","svg","math","input","select","textarea","button","progress","meter"]);function Ho(e,t){return No.has(e.tagName.toLowerCase())?!1:t.getComputedStyle(e).display==="inline"}function Cn(e){const t=e.ownerDocument?.defaultView;if(!t)return e;let n=e;for(let r=e;r;r=r.parentElement){const c=Ot(r);if(c.width>=En&&c.height>=En&&!Ho(r,t)){n=r;break}n=r}let o=0;for(let r=n;r&&o<=Do;r=r.parentElement){if(r.matches(Lo))return r;o++}return n}const Wo=10,Lt=[["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 Bo(e,t,n){let o=e;for(;o&&o!==o.ownerDocument.documentElement&&o!==o.ownerDocument.body;){const r=getComputedStyle(o),c=(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(c||u)return o;o=o.parentElement}return null}function Tn(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 Fo=["position:fixed","inset:0",`z-index:${Ze.shield}`,"touch-action:pan-x pan-y pinch-zoom","background:transparent"].join(";");function jo(e,t={}){const n=t.doc??e.ownerDocument??document,o=n.defaultView??window;let r=t.coarsePointer??o.matchMedia?.("(pointer: coarse)").matches??!1;const c=l=>{const C=l.pointerType,R=C==="touch"?!0:C==="mouse"||C==="pen"?!1:r;R!==r&&(r=R,d())},u=n.createElement("div");u.className="snag-shield",u.style.cssText=Fo;let s="browse";const d=()=>{u.style.pointerEvents=r?"none":"auto",u.style.cursor="crosshair"};d();const g=l=>{const C=l;return!C||typeof C.closest!="function"?!1:e.contains(C)?!0:!!C.closest(`[${_t("root")}]`)};function x(l,C,R){let v=R,O=0;for(;v.shadowRoot&&O++<Wo;){const W=T(v.shadowRoot,l,C);if(!W||W===v)break;v=W}return v}function T(l,C,R){const v=l.elementsFromPoint;if(typeof v=="function"){for(const W of v.call(l,C,R))if(W.getRootNode()===l)return W;return null}const O=l.elementFromPoint(C,R);return O&&O.getRootNode()===l?O:null}function y(l,C){const R=[];for(const v of n.elementsFromPoint(l,C)){if(g(v))continue;if(v===n.documentElement||v===n.body){R.push(v);continue}const O=x(l,C,v);R.push(g(O)?v:O)}return R}let p=null;const f=(l,C)=>{const[R]=y(l,C);R&&t.onPick?.(Cn(R),{x:l,y:C})};let k=!1;const P=()=>{const l=n.getSelection?.();if(!l||l.isCollapsed||l.rangeCount===0||!l.toString().trim())return!1;const C=l.anchorNode;if(!C||e.contains(C))return!1;const R=C.nodeType===1?C:C.parentElement;return!g(R)},D=l=>{const C=l.composedPath()[0];if(C&&g(C)){k=!1;return}if(l.type==="selectstart"){t.onSelectStart?.();return}const R=l.type;if(R.endsWith("down")||R.endsWith("start")){k=!1;return}if(R.endsWith("up")||R.endsWith("end")){k=P();return}if(R==="click"||R==="auxclick"){if(!k)return;k=!1,l.preventDefault(),l.stopImmediatePropagation()}},M=l=>{if(l.type==="pointerdown"&&c(l),s==="comments"){D(l);return}if(s!=="add")return;if(l.type==="keydown"||l.type==="keyup"){de(l);return}const C=l.composedPath()[0];if(C&&C!==u&&g(C))return;const R=Lt.find(([v])=>v===l.type)?.[1]??!1;if(l.stopImmediatePropagation(),!R){if(r&&l.type==="pointerdown"){const v=l;p={x:v.clientX,y:v.clientY,t:performance.now()},Q(v.clientX,v.clientY)}if(r&&l.type==="pointerup"&&p){const v=l,O=p;p=null,Math.hypot(v.clientX-O.x,v.clientY-O.y)<=8&&performance.now()-O.t<=700&&f(v.clientX,v.clientY);return}if(l.type==="click"||l.type==="auxclick"||l.type==="dblclick"){l.preventDefault();const v=l;f(v.clientX,v.clientY);return}if(l.type==="wheel"){const v=l,O=Tn(v,"y"),W=Tn(v,"x"),[X]=y(v.clientX,v.clientY),ve=Bo(X??null,O,W);ve&&(ve.scrollTop+=O,ve.scrollLeft+=W,l.preventDefault());return}if(l.type==="dragstart"||l.type==="contextmenu"){l.preventDefault();return}(l.type==="pointerdown"||l.type==="mousedown")&&!r&&l.preventDefault()}},q=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," ","Spacebar","PageUp","PageDown","Home","End"]),te=/^[a-z0-9/?]$/;function Y(l){for(const C of l.composedPath()){const R=C;if(!(!R||R.nodeType!==1||typeof R.matches!="function")&&R.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 de(l){q.has(l.key)||l.metaKey||l.ctrlKey||l.altKey||/^F\d{1,2}$/.test(l.key)||l.key!=="Escape"&&l.key.length===1&&te.test(l.key.toLowerCase())&&!Y(l)&&(l.preventDefault(),l.stopImmediatePropagation())}for(const[l,C]of Lt)o.addEventListener(l,M,{capture:!0,passive:C});let oe=0,G=null;function me(){if(oe=0,s!=="add"||!G)return;const[l]=y(G.x,G.y);t.onHover?.(l?Cn(l):null)}function Q(l,C){s==="add"&&(G={x:l,y:C},!oe&&(oe=o.requestAnimationFrame(me)))}return u.addEventListener("pointermove",l=>Q(l.clientX,l.clientY)),u.addEventListener("pointerleave",()=>{G=null,t.onHover?.(null)}),{shield:u,getMode:()=>s,setMode(l){s=l,k=!1,d(),l==="add"?e.appendChild(u):u.remove(),l!=="add"&&(G=null,t.onHover?.(null))},hitTest:y,destroy(){oe&&o.cancelAnimationFrame(oe);for(const[l]of Lt)o.removeEventListener(l,M,{capture:!0});u.remove()}}}const Uo=/[\u200B-\u200D\u2060\uFEFF]/gu,Zo=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,Vo=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function Yo(e){let t=e.normalize("NFC").replace(Uo,"");for(const[n,o]of Vo)t=t.replace(n,o);return t.replace(Zo," ").trim()}const Xo={testid:1,domid:1,css:.9,aria:.75,"text-exact":.8,"text-fuzzy":.78,"path-rect":.35,none:0,manual:1},Rn={anchored:.75,approximate:.35};function Ko(e,t){const n=Xo[e];return t===1?n:n/(1+Math.log2(t))}function _n(e){return e>=Rn.anchored?"anchored":e>=Rn.approximate?"approximate":"orphaned"}const qo=[Ao("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],Pn=e=>typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/["\\]/g,"\\$&"),Jo=[{strategy:"testid",applicable:e=>!!e.testid,find:(e,t)=>Dt(t,qo.map(n=>`[${n}="${Pn(e.testid)}"]`).join(","))},{strategy:"domid",applicable:e=>!!e.domid,find:(e,t)=>Dt(t,`#${Pn(e.domid)}`)},{strategy:"css",applicable:e=>!!e.css,find:(e,t)=>{try{return Dt(t,e.css)}catch{return[]}}}];function Dt(e,t){return[...e.querySelectorAll(t)].filter(Qo)}function Qo(e){return!e.closest(`[${_t("root")}]`)}function Go(e,t){const n=t.text?.exact;if(!n)return!0;const o=Yo(e.textContent??"");return o?o===n||o.includes(n)||n.includes(o):!0}function zn(e,t,n,o){yt(e)||o.push("hidden"),t.hostPath?.length&&o.push("shadow-boundary");const r=!Go(e,t);r&&o.push("text-drift");let c=o.includes("hidden")?Math.min(n,.7):n;return r&&(c=Math.min(c,.5)),c}const er={element:null,strategy:"none",score:0,state:"orphaned",reasons:["not-found"],candidates:0};function Nt(e,t=document,n={}){const o=[];for(const r of Jo){if(!r.applicable(e))continue;const c=r.find(e,t);if(c.length===0)continue;const u=Ko(r.strategy,c.length),s=c[0];c.length>1&&o.push("ambiguous");const d=zn(s,e,u,o),g={element:s,strategy:r.strategy,score:d,state:_n(d),reasons:o.length?o:["exact"],candidates:c.length};if(g.reasons.includes("text-drift")&&n.extended){const x=n.extended(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}});if(x&&x.score>g.score)return x}return g}return n.extended?.(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}})??er}const tr={"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.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"},nr={...vn,...tr},F=bn(nr);function or(e,t){const n=new Array(e.length),o=[],r=new Map,c=[];let u=0;for(let s=0;s<e.length;s++){u++;const d=e[s],g=Math.floor(d.x/t),x=Math.floor(d.y/t);let T=-1;e:for(let y=-1;y<=1;y++)for(let p=-1;p<=1;p++)for(const f of r.get(`${g+y},${x+p}`)??[]){const k=c[f],P=d.x-k.x,D=d.y-k.y;if(P*P+D*D<=t*t){T=f;break e}}if(T===-1){T=o.length,o.push([]),c.push(d);const y=`${g},${x}`,p=r.get(y);p?p.push(T):r.set(y,[T])}n[s]=T,o[T].push(s)}return{group:n,members:o,visits:u}}const rr=`position:absolute;top:0;left:0;width:0;height:0;pointer-events:none;z-index:${Ze.pins}`,ar=' .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}}',sr=`position:fixed;inset:0;width:0;height:0;pointer-events:none;z-index:${Ze.pins}`,et=["position:absolute",`color:${b.onAccent}`,`font:600 12px/1 ${b.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",In=e=>b[`status${e[0].toUpperCase()}${e.slice(1)}`]??b.muted;function Mn(e,t){const n=`background:${In(t.status)};color:${Sn(t.status)}`,o="0 1px 4px rgb(0 0 0 / .35)";return e==="anchored"?`${et};${bt};${n};border:2px solid ${b.onAccent};box-shadow:${o}`:e==="approximate"?`${et};${bt};${n};border:2px dashed ${b.onAccent};box-shadow:${o}`:`${et};${bt};${n};border:2px solid ${b.anchorOrphan};box-shadow:inset 0 0 0 2px ${b.onAccent},${o}`}function ir(e,t){const n=[];let o="static",r=!1;for(let c=e;c&&c!==e.ownerDocument.documentElement;c=c.parentElement){const u=t.getComputedStyle(c),s=c!==e.ownerDocument.body&&/auto|scroll|hidden|overlay/.test(u.overflowY+u.overflowX);s&&!r&&n.push(c),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&&(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth))&&(o="dynamic")}return{tier:o,clips:n}}function cr(e,t,n,o){const r=e.ownerDocument??document,c=r.defaultView??window;Ge(e,"pins",ar);const u=r.createElement("div");u.className="snag-pins",u.style.cssText=rr,e.appendChild(u);const s=r.createElement("div");s.className="snag-pins-dyn",s.style.cssText=sr,e.appendChild(s);let d=[],g=[];const x=new Map;let T=new Map,y=null;const p=new Map;let f=new Map;const k=c.matchMedia?.("(pointer: coarse)").matches??!1,P=k?32:24,D=k?34:28;let M=[],q=null,te=null,Y={x:0,y:0};function de(){const S=r.defaultView,$=u.getBoundingClientRect();Y={x:$.left+(S?.scrollX??0),y:$.top+(S?.scrollY??0)}}let oe=[];const G=new Map,me=1e4,Q=5,l=new Map,C=new Set(["testid","domid"]);function R(S){const $=l.get(S.id),m=$?.ref.deref();if(!m||!m.isConnected)return null;if(C.has($.strategy))return m;if(S.anchor.css)try{if(!m.matches(S.anchor.css))return null}catch{return null}return m}function v(S,$){const m=[],I=zn($,S.anchor,1,m);return{element:$,strategy:l.get(S.id).strategy,score:I,state:_n(I),reasons:m.length?m:["exact"],candidates:1}}function O(S,$="authoritative"){x.clear(),oe=[];const m=Date.now(),I=n?.newPass?.();return S.map(A=>{const N=R(A),w=n?.get();let E=N?v(A,N):Nt(A.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...w?{extended:w}:{},...I?{passCaches:I}:{}});if(N&&E.reasons.includes("text-drift")){const H=Nt(A.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...w?{extended:w}:{},...I?{passCaches:I}:{}});H.score>E.score&&(E=H)}if(n&&(!E.element||E.reasons.includes("text-drift"))&&n.want(A.anchor),!E.element&&n){const H=n.fuzzyHit?.(A.id);H?E=H:n.wantFuzzy?.(A.id,A.anchor)}const ee=E.element&&A.anchor.text?.exact&&(E.reasons.includes("text-drift")||E.strategy==="path-rect"&&E.score<.5);if(n&&ee){const H=n.fuzzyHit?.(A.id);H&&H.score>E.score?E=H:H||n.wantFuzzy?.(A.id,A.anchor)}E.element?l.set(A.id,{ref:new WeakRef(E.element),strategy:E.strategy}):l.delete(A.id),E.element&&x.set(A.id,E.element);let K=!1;if(E.state==="orphaned"){const H=G.get(A.id)??{firstSeenAt:m,tries:0,best:E};H.tries++,E.score>=H.best.score&&(H.best=E),G.set(A.id,H);const B=n?.unavailable?.()??!1,ce=B?2:Q,le=m-H.firstSeenAt<me;$==="optimistic"||le&&($==="navigating"||H.tries<ce)?K=!0:(E=H.best,B&&!E.reasons.includes("budget-exceeded")&&(E={...E,reasons:[...E.reasons,"budget-exceeded"]}),G.delete(A.id))}else G.delete(A.id);K||oe.push({id:A.id,state:E.state,strategy:E.strategy,confidence:E.score});const L=E.element?Ot(E.element):void 0;if(L&&(L.width>0||L.height>0)){const H=r.defaultView;A.anchor.rect={x:L.left+(H?.scrollX??0),y:L.top+(H?.scrollY??0),w:L.width,h:L.height}}return{...A,anchorState:K?A.anchorState:E.state,anchorPending:K,anchorReasons:E.reasons}})}function W(){const S=r.documentElement;return{w:S.scrollWidth,h:S.scrollHeight}}function X(S,$,m){return{x:Math.min(Math.max(S,14),Math.max(m.w,28)-14),y:Math.min(Math.max($,14),Math.max(m.h,28)-14)}}function ve(S,$){de(),u.textContent="",s.textContent="",d=[],g=[],T=new Map,f=new Map,p.clear(),M=[],te=null,S.forEach((m,I)=>{const A=m.anchor.rect;if(!A)return;const N=m.anchor.offset??{fx:.5,fy:.5},w=r.createElement("div");w.className="snag-pin",w.setAttribute("data-state",m.anchorPending?"pending":m.anchorState),w.setAttribute("data-key",m.key),w.style.cssText=m.anchorPending?`${Mn("approximate",m)};opacity:.55`:Mn(m.anchorState,m);const E=x.get(m.id),{tier:ee,clips:K}=E?ir(E,c):{tier:"static",clips:[]};if(ee==="dynamic"&&E){const V=E.getBoundingClientRect(),Le=ke();w.style.left=`${V.left-Le.left+V.width*N.fx}px`,w.style.top=`${V.top-Le.top+V.height*N.fy}px`,p.set(w,{x:V.left+V.width*N.fx+c.scrollX-Y.x,y:V.top+V.height*N.fy+c.scrollY-Y.y});const st={node:w,el:E,fx:N.fx,fy:N.fy,clips:K};d.push(st),w.hidden=!yt(E),w.hidden||ot(st,V,new Map(K.map(Ce=>[Ce,Ce.getBoundingClientRect()])))}else{const V=X(A.x+A.w*N.fx-Y.x,A.y+A.h*N.fy-Y.y,W());w.style.left=`${V.x}px`,w.style.top=`${V.y}px`,p.set(w,V),E&&(g.push({node:w,el:E,fx:N.fx,fy:N.fy,clips:[]}),w.hidden=!yt(E))}w.textContent=String(I+1);const L=Po(m),H=m.anchor.role?F("pin.target",{role:m.anchor.role,name:m.anchor.accessibleName??m.anchor.label}):m.anchor.label,B=m.comments.length-1,ce=m.anchorState==="approximate"?`~ ${m.key}`:m.key;w.setAttribute("role","button"),w.setAttribute("tabindex","0");const le=m.anchorState==="anchored"?F(B===0?"pin.aria.none":B===1?"pin.aria.one":"pin.aria",{key:ce,target:H,status:An(m.status),replies:B}):F("pin.aria.moved",{key:ce,target:H,status:An(m.status),where:L});w.title=le,w.setAttribute("aria-label",le),t&&Ee(w,()=>t(m)),$?.has(m.id)&&(w.hidden=!0,w.setAttribute("data-fo","")),T.set(m.id,w),f.set(w,{snag:m,ordinal:I+1}),(ee==="dynamic"?s:u).appendChild(w)}),Me(),y&&Oe(y),pe(),Ve="",Ye(r.visibilityState==="visible"&&T.size>0)}const ke=()=>s.getBoundingClientRect();let ze=!1;function ot(S,$,m){for(const I of S.clips){const A=m.get(I);if(A&&($.right<=A.left||$.left>=A.right||$.bottom<=A.top||$.top>=A.bottom)){S.node.hidden=!0;return}}S.node.hidden=!1}function $e(S){const $=new Map;for(const m of S)for(const I of m.clips)$.has(I)||$.set(I,I.getBoundingClientRect());return $}const Ie=["open","progress","review","resolved"];function Ee(S,$){S.addEventListener("click",$),S.addEventListener("keydown",m=>{m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),$())})}function ie(S,$,m,I,A){const N=Ie.find(E=>S.some(ee=>ee.snag.status===E))??"open",w=r.createElement("div");w.className="snag-pin snag-cluster",w.style.cssText=`${et};border-radius:50%;background:${In(N)};color:${Sn(N)};border:2px solid ${b.onAccent}`,w.style.left=`${$}px`,w.style.top=`${m}px`,w.textContent=String(S.length),w.setAttribute("data-count",String(S.length)),w.setAttribute("data-state",N),w.setAttribute("role","button"),w.setAttribute("tabindex","0"),A&&w.setAttribute("aria-expanded","true"),w.setAttribute("aria-label",F("cluster.aria",{n:S.length,list:S.map(E=>E.ordinal).join(", ")})),Ee(w,()=>{if(A)q=null;else if(S.length<=6)q=I;else{o?.(S.map(E=>E.snag.id));return}Me()}),u.appendChild(w),M.push(w)}function At(S,$,m,I){ie(S,$,m,I,!0),S.forEach((A,N)=>{const w=$,E=m+(N+1)*(D+12),ee=A.x-w,K=A.y-E,L=Math.hypot(ee,K);if(L>4){const B=r.createElement("div");B.className="snag-leader",B.setAttribute("aria-hidden","true"),B.style.cssText=`position:absolute;left:${w}px;top:${E}px;width:${L}px;height:0;border-top:1px solid ${b.onAccent};transform-origin:0 0;transform:rotate(${Math.atan2(K,ee)}rad)`,u.appendChild(B),M.push(B)}const H=A.dot.cloneNode(!0);H.style.visibility="",H.style.left=`${w}px`,H.style.top=`${E}px`,Ee(H,()=>t?.(A.snag)),u.appendChild(H),M.push(H)})}function Me(){for(const A of M)A.remove();M=[];const S=[];for(const[A,N]of f){if(A.hidden){A.style.visibility="";continue}const w=p.get(A);w&&S.push({dot:A,snag:N.snag,ordinal:N.ordinal,x:w.x,y:w.y})}const{members:$,visits:m}=or(S,P);u.setAttribute("data-cv",String(m)),u.setAttribute("data-cp",String(S.length));let I=!1;for(const A of $){if(A.length<2){S[A[0]].dot.style.visibility="";continue}const N=A.map(K=>S[K]),w=N.map(K=>K.snag.id).sort().join("|");for(const K of N)K.dot.style.visibility="hidden";const E=N.reduce((K,L)=>K+L.x,0)/N.length,ee=N.reduce((K,L)=>K+L.y,0)/N.length;q===w&&N.length<=6?(I=!0,At(N,E,ee,w)):ie(N,E,ee,w,!1)}q&&!I&&(q=null)}function rt(S){te?.remove(),te=null;const $=S.anchor.rect;if(!$)return;const m=S.anchor.offset??{fx:.5,fy:.5},I=r.createElement("div");I.className="snag-pin snag-ghost",I.style.cssText=`${et};${bt};background:transparent;border:2px dashed ${b.anchorOrphan};color:${b.anchorOrphan};box-shadow:none;pointer-events:none`;const A=X($.x+$.w*m.fx-Y.x,$.y+$.h*m.fy-Y.y,W());I.style.left=`${A.x}px`,I.style.top=`${A.y}px`,I.setAttribute("aria-hidden","true"),u.appendChild(I),te=I}function pe(S=!1){const $=S?[...d,...g]:d;ze||$.length===0||(ze=!0,c.requestAnimationFrame(()=>{ze=!1;const m=performance.now(),I=c.scrollX,A=c.scrollY,N=ke(),w=$.map(L=>L.el.isConnected?L.el.getBoundingClientRect():null),E=$.map(L=>L.el.isConnected&&yt(L.el)),ee=$e($),K=W();$.forEach((L,H)=>{const B=w[H];if(!B)return;if(L.node.hasAttribute("data-fo")){L.node.hidden=!0;return}if(!E[H]){L.node.hidden=!0;return}L.node.hidden=!1;const ce=B.left+B.width*L.fx,le=B.top+B.height*L.fy;if(L.node.parentElement===s)L.node.style.left=`${ce-N.left}px`,L.node.style.top=`${le-N.top}px`,ot(L,B,ee),p.set(L.node,{x:ce+I-Y.x,y:le+A-Y.y});else{const V=X(ce+I-Y.x,le+A-Y.y,K);L.node.style.left=`${V.x}px`,L.node.style.top=`${V.y}px`,p.set(L.node,V)}}),Me(),u.setAttribute("data-ms",(performance.now()-m).toFixed(2))}))}const at=()=>pe();r.addEventListener("scroll",at,{capture:!0,passive:!0});const Be=typeof c.ResizeObserver=="function"?new c.ResizeObserver(()=>pe(!0)):null;Be?.observe(r.documentElement);let ne=null,Ve="";function ge(){let S="";for(const $ of[...g,...d]){if(!$.el.isConnected)continue;const m=$.el.getBoundingClientRect();S+=`${Math.round(m.left)},${Math.round(m.top)},${Math.round(m.width)};`}!S||S===Ve||(Ve=S,pe(!0))}function Ye(S){if(ne&&clearTimeout(ne),ne=null,!S)return;const $=()=>{ge(),ne=setTimeout($,500)};ne=setTimeout($,500)}const re=()=>Ye(r.visibilityState==="visible"&&T.size>0);r.addEventListener("visibilitychange",re);function Xe(S){const $=T.get(S);$&&($.classList.remove("snag-pp"),c.requestAnimationFrame(()=>$.classList.add("snag-pp")),c.setTimeout(()=>$.classList.remove("snag-pp"),1400))}function Oe(S){const $=y?T.get(y):void 0;$&&($.style.transform="",$.style.zIndex=""),y=S;const m=S?T.get(S):void 0;m&&(m.style.transform="scale(1.4)",m.style.zIndex="1")}return{el:u,render:ve,showGhost:rt,pulse:Xe,reanchor:O,settled:()=>oe,hasPending:()=>G.size>0,highlight:Oe,destroy(){r.removeEventListener("scroll",at,{capture:!0}),r.removeEventListener("visibilitychange",re),Be?.disconnect(),Ye(!1),u.remove(),s.remove()}}}const lr=` .snag-notice{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(24px + var(${z.tbH},56px));z-index:${Ze.notice};max-width:min(420px,calc(100vw - 24px));background:${b.bg};color:${b.fg};border:1px solid ${b.border};border-inline-start:3px solid ${b.anchorOrphan};border-radius:${b.radius};box-shadow:${b.shadow};padding:12px 14px;pointer-events:auto;font:400 13px/1.45 ${b.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(${b.radius} - 2px);padding:6px 12px;min-height:30px;border:0;transition:background ${b.motion}}.snag-notice-retry{background:${b.accent};color:${b.onAccent};font-weight:600}.snag-notice-dismiss{background:transparent;color:${b.muted}}.snag-notice-dismiss:hover{background:${b.hover};color:inherit}.snag-notice button:focus-visible{outline:2px solid ${b.focus};outline-offset:2px}`;function dr(e,t){const n=e.ownerDocument??document,o=n.defaultView??window;Ge(e,"notice",lr);const r=n.createElement("div");r.className="snag-notice",r.setAttribute("role","alert"),r.hidden=!0;const c=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=F("action.dismiss"),s.addEventListener("click",()=>T());const d=n.createElement("button");d.type="button",d.className="snag-notice-retry",u.append(s,d),r.append(c,u);let g;d.addEventListener("click",()=>{T(),g?.run()});let x=0;function T(){x&&o.cancelAnimationFrame(x),x=0,r.hidden=!0,r.remove()}return{show(y,p,f){g=p,d.hidden=!p,p&&(d.textContent=F(p.label)),r.hidden=!1,c.textContent="",(t??e).appendChild(r);const k=F(y,f);x&&o.cancelAnimationFrame(x),x=o.requestAnimationFrame(()=>{x=0,c.textContent=k})},hide:T,visible:()=>r.isConnected&&!r.hidden,destroy(){r.remove()}}}const ur=` .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:${b.bg};color:${b.fg};border:1px solid ${b.border};border-inline-start:3px solid ${b.accent};border-radius:${b.radius};box-shadow:${b.shadow};padding:14px 16px;font:400 13px/1.45 ${b.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(${b.radius} - 2px);padding:6px 14px;min-height:30px;background:${b.accent};color:${b.onAccent}}.snag-paused button:focus-visible{outline:2px solid ${b.focus};outline-offset:2px}`;function fr(e,t){const n=e.ownerDocument??document;Ge(e,"paused",ur);const o=n.createElement("dialog");o.className="snag-paused",o.setAttribute("aria-label",F("paused.dialog"));const r=n.createElement("div");r.className="snag-paused-box",r.setAttribute("role","status");const c=n.createElement("p");c.textContent=F("paused.dialog");const u=n.createElement("div");u.className="snag-paused-actions";const s=n.createElement("button");s.type="button",s.textContent=F("paused.close"),s.addEventListener("click",()=>x()),u.append(s),r.append(c,u),o.append(r);let d=!1;function g(){if(!d){(t??e).appendChild(o);try{o.showModal(),d=!0}catch{o.setAttribute("open",""),d=!0}}}function x(){if(d){d=!1;try{o.close()}catch{o.removeAttribute("open")}o.remove()}}return o.addEventListener("close",()=>{d=!1,o.remove()}),{show:g,hide:x,destroy(){x(),o.remove()}}}const hr=Symbol.for(pn.original),On=Symbol.for(pn.wrapped),tt=()=>{};function pr(e,t,n){let o;try{o=e[t]}catch{return tt}if(typeof o!="function"||o[On])return tt;const r=o,c=n(r);let u=!1;const s=function(...d){return u?r.apply(this,d):c.apply(this,d)};try{const d=s;d[On]=!0,d[hr]=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 tt}return e[t]!==s?tt:()=>{let d;try{d=e[t]}catch{d=void 0}if(d===s)try{e[t]=r;return}catch{}u=!0}}function mr(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 c=()=>void e.setTimeout(t.onResize,250);e.addEventListener("orientationchange",c),n.push(()=>e.removeEventListener("orientationchange",c));let u=e.location.pathname;const s=()=>{const P=e.location.pathname;P!==u&&(u=P,t.onRoute())},d=e.navigation;if(d){const P=()=>void e.setTimeout(s,0);d.addEventListener("navigatesuccess",P),n.push(()=>d.removeEventListener("navigatesuccess",P))}else for(const P of["pushState","replaceState"])n.push(pr(e.history,P,D=>function(...M){const q=D.apply(this,M);return e.setTimeout(s,0),q}));const g=e.document;let x=!0;try{g.documentElement.matches(":modal")}catch{x=!1}const T=()=>{const P=g.querySelectorAll("dialog[open]");if(!x)return P.length>0;for(const D of P)if(D.matches(":modal"))return!0;return!1};let y=!1;const p=()=>{const P=T();P!==y&&(y=P,t.onModal(P))};g.addEventListener("toggle",p,!0),n.push(()=>g.removeEventListener("toggle",p,!0));const f=new MutationObserver(p);f.observe(g.documentElement,{subtree:!0,attributes:!0,attributeFilter:["open"]}),n.push(()=>f.disconnect());const k=()=>void e.setTimeout(s,0);return e.addEventListener("popstate",k),n.push(()=>e.removeEventListener("popstate",k)),{destroy(){for(const P of n)P();n.length=0}}}function gr(e,t){try{e.sessionStorage.setItem(he.handoff,JSON.stringify({openThreadId:t}))}catch{}}function yr(e){try{const t=e.sessionStorage.getItem(he.handoff);if(t===null)return null;e.sessionStorage.removeItem(he.handoff);const n=JSON.parse(t);return typeof n.openThreadId=="string"?n.openThreadId:null}catch{return null}}function br(){return{statuses:[],read:"all",pageOnly:!1,newOnly:!1,sort:"page"}}const vr=["open","progress","review","resolved"];function wr(e,t,n){return t.statuses.length>0&&vr.includes(e.status)&&!t.statuses.includes(e.status)||t.by&&e.createdBy.id!==t.by||t.page&&e.route!==t.page?!1:(t.read,!0)}function xr(e,t,n){const o=e.visualViewport;let r=0;const c=()=>{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(c))};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 Sr=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,Ar=/^[a-f0-9]{32,}$/i,kr=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,$r="[redacted]";function Ln(e){return e.includes("/")?e.split("/").map(t=>Sr.test(t)||Ar.test(t)||kr.test(t)?$r:t).join("/"):e}const Er=/\/index\.(html?|php)$/i;function Cr(e){if(!e.startsWith("/"))return e;let t=e.replace(Er,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function Tr(e){try{const t=e.querySelector(`meta[name="${Co.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}function Rr(e,t){const n=t??Tr(e);return Cr(n??Ln(e.location.pathname))}const _r=[/^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$/],Pr=[...mt.query,...mt.fragment];function zr(e,t=[]){return Pr.includes(e)||t.includes(e)?!0:_r.some(n=>n.test(e))}function Ir(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[c,u]of o)zr(c,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(c)||(r[c]=u);return Object.keys(r).length>0?r:void 0}function Mr(e,t,n={}){const o=n.significantQueryParams??[];if(o==="*"){const r=e??{},c=t??{},u=new Set([...Object.keys(r),...Object.keys(c)]);for(const s of u)if(r[s]!==c[s])return!1;return!0}for(const r of o)if((e?.[r]??void 0)!==(t?.[r]??void 0))return!1;return!0}const Or=120,Lr=1e3,Dr=200,Nr=1e4;function Hr(e,t,n){const o=t.MutationObserver;if(typeof o!="function")return{destroy:()=>{}};let r=!1,c=null,u=!1,s=!1,d=0,g=T(),x=0;function T(){return t.performance?.now?.()??0}const y=new o(()=>{r=!0,d++,f()});function p(){const P=T();return P-g>=1e3&&(d>Dr&&(x=P+Nr),d=0,g=P),P<x?Lr:Or}function f(){c||(c=setTimeout(k,p()))}function k(){if(c=null,!!r){if(u){s=!0;return}r=!1,u=!0;try{n()}finally{u=!1,s&&(s=!1,r=!0,f())}}}return y.observe(e.documentElement,{childList:!0,subtree:!0}),{destroy(){y.disconnect(),c&&clearTimeout(c),c=null}}}const Wr="0.0.0",Br={capture:Re.capture,"anchor-ext":Re.anchorExt,"anchor-fuzzy":Re.anchorFuzzy,crumbs:Re.crumbs,screenshot:Re.screenshot,dock:Re.dock,text:Re.text},Dn=new Map,Ht=new Map,Nn=new Map;function Fr(e,t,n){const o=new URL(t,n.location.href).href,r=new URL(Br[e],o);r.searchParams.set("cv",Wr);const c=Nn.get(e)??0;return c>0&&r.searchParams.set("r",String(c)),Nn.set(e,c+1),r.href}async function _e(e,t,n=document){const o=Dn.get(e);if(o)return{ok:!0,mod:o};const r=Ht.get(e);if(r)return r;const c=(async()=>{for(let u=0;u<2;u++)try{const s=await import(Fr(e,t,n));return Dn.set(e,s),{ok:!0,mod:s}}catch{}return{ok:!1,reason:"unavailable"}})();Ht.set(e,c);try{return await c}finally{Ht.delete(e)}}const jr="composer",Wt=e=>he.draft(e,jr),Ur=he.draft("\0","").split("\0")[0];function Zr(e){try{return e.body.trim()?(localStorage.setItem(Wt(e.route),JSON.stringify(e)),!0):(Hn(e.route),!0)}catch{return!1}}function Vr(e){try{const t=localStorage.getItem(Wt(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 Hn(e){try{localStorage.removeItem(Wt(e))}catch{}}function Bt(){try{for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t&&t.startsWith(Ur))return!0}return!1}catch{return!1}}const Yr="http://www.w3.org/2000/svg";function Pe(e,t,n,o=[]){const r=e.createElementNS(Yr,t);for(const c in n)r.setAttribute(c,n[c]);for(const c of o)r.appendChild(c);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"}),Xr=e=>Pe(e,"svg",Ft(),[Pe(e,"path",{d:"M8 3v10M3 8h10",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round"})]),Kr=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"})]),qr=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"}))))]),Jr=` .snag-tb{position:fixed;z-index:${Ze.toolbar};display:flex;align-items:center;gap:2px;padding:4px;border-radius:calc(${b.radius} + 4px);background:${b.bg};color:${b.fg};box-shadow:${b.shadow};font:500 13px/1 ${b.font};pointer-events:auto;user-select:none;border:1px solid ${b.border}}.snag-tb{transition:inset-inline-end ${b.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 ${b.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:${b.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:${b.muted};cursor:grab;touch-action:none}.snag-grip:active{cursor:grabbing}.snag-seg{display:flex;background:${b.surface};border-radius:${b.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:${b.accent};border-radius:calc(${b.radius} - 2px);pointer-events:none;transition:inset-inline-start ${b.motion},width ${b.motion}}.snag-seg>.snag-b[aria-pressed="true"]{background:transparent;color:${b.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(${b.radius} - 2px);cursor:pointer;display:flex;align-items:center;gap:6px;position:relative;min-height:32px;transition:background ${b.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:${b.accent};color:${b.onAccent}}.snag-b:focus-visible{outline:2px solid ${b.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 Qr(e,t){const n=e.ownerDocument??document,o=t.coarsePointer??n.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;Ge(e,"toolbar",Jr);const r=n.createElement("div");r.className=`snag-tb ${o?"snag-tb--coarse":"snag-tb--fine"}`,r.setAttribute("role","toolbar"),r.setAttribute("aria-label",F("toolbar.aria"));const c=n.createElement("div");c.className="snag-grabber",c.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(qr(n));const d=n.createElement("div");d.className="snag-seg",d.setAttribute("role","group"),d.setAttribute("aria-label",F("toolbar.group"));const g=(l,C,R)=>{const v=n.createElement("button");return v.type="button",v.className=`snag-b ${l}`,v.setAttribute("aria-label",C),typeof R=="string"?v.textContent=R:v.appendChild(R),v},x=g("",F("toolbar.browse"),F("toolbar.browse")),T=g("",F("toolbar.comments"),F("toolbar.comments")),y=g("snag-icon",F("toolbar.add"),Xr(n)),p=g("snag-icon",F("toolbar.panel"),Kr(n));p.setAttribute("aria-expanded","false"),d.append(x,T),o||u.appendChild(s),u.append(d,y,p),o&&r.appendChild(c),r.appendChild(u),(t.parent??e).appendChild(r);const f=()=>{e.host.style.setProperty(z.tbH,`${r.offsetHeight}px`)};f();let k=null;function P(l,C){const R=n.defaultView,v=r.offsetWidth,O=r.offsetHeight,W=Wn(l,8,Math.max(8,R.innerWidth-v-8)),X=Wn(C,8,Math.max(8,R.innerHeight-O-8));k={left:W,top:X},r.style.left=`${W}px`,r.style.top=`${X}px`,r.style.right="auto",r.style.bottom="auto"}const D=()=>{f(),k&&P(k.left,k.top)},M=n.defaultView;if(M?.addEventListener("resize",D),x.addEventListener("click",()=>t.onState("browse")),T.addEventListener("click",()=>t.onState("comments")),y.addEventListener("click",()=>t.onState(q==="add"?"comments":"add")),p.addEventListener("click",()=>t.onPanel()),!o){let l=null;s.addEventListener("pointerdown",R=>{l={x:R.clientX,y:R.clientY,r:r.getBoundingClientRect()},s.setPointerCapture(R.pointerId),R.preventDefault()}),s.addEventListener("pointermove",R=>{l&&P(l.r.left+(R.clientX-l.x),l.r.top+(R.clientY-l.y))});const C=R=>{l=null,s.hasPointerCapture(R.pointerId)&&s.releasePointerCapture(R.pointerId)};s.addEventListener("pointerup",C),s.addEventListener("pointercancel",C)}let q="browse";function te(l){q=l,x.setAttribute("aria-pressed",String(l==="browse")),T.setAttribute("aria-pressed",String(l!=="browse")),y.setAttribute("aria-pressed",String(l==="add")),Y()}function Y(){const l=d.querySelector('.snag-b[aria-pressed="true"]'),C=d.getBoundingClientRect(),R=l?.getBoundingClientRect();if(!l||!R?.width){d.style.setProperty(z.thumbW,"0px");return}const v=n.defaultView?.getComputedStyle(d),O=v?.direction==="rtl",W=parseFloat((O?v?.paddingRight:v?.paddingLeft)??"0")||0,X=(O?C.right-R.right:R.left-C.left)-W;d.style.setProperty(z.thumbW,`${Math.round(R.width)}px`),d.style.setProperty(z.thumbX,`${Math.max(0,Math.round(X))}px`)}function de(l){y.disabled=l,l?y.title=F("error.panels.add"):y.removeAttribute("title")}function oe(l){y.setAttribute("aria-label",F(l?"toolbar.add.draft":"toolbar.add"))}function G(l){T.setAttribute("aria-label",l!==null&&l>0?F("toolbar.comments.unresolved",{n:_o(l)}):F("toolbar.comments"))}te("browse"),G(0);function me(l){r.classList.toggle("snag-puck",l),l||Y()}function Q(l){r.hidden=l,l||Y(),f()}return{el:r,setState:te,setCount:G,setDegraded:de,setDraft:oe,setPuck:me,setConcealed:Q,destroy(){M?.removeEventListener("resize",D),e.host.style.removeProperty(z.tbH),r.remove()}}}const Wn=(e,t,n)=>e<t?t:e>n?n:e,Bn=24;function Gr(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 ea(e,t,n){const o=n.anchor.rect;if(!o)return;const r=n.anchor.offset??{fy:.5},c=o.y+o.h*r.fy,u=Gr(e,t),s=c-e.scrollY;if(s>=u.top+Bn&&s<=u.bottom-Bn)return;const d=e.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;e.scrollTo({top:Math.max(0,c-(u.top+u.bottom)/2),behavior:d?"auto":"smooth"})}function jt(){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 ta=()=>gt.thread+jt(),Fn=()=>gt.comment+jt(),na=()=>gt.attachment+jt(),oa={attachments:"direct",realtime:"none",anchorReports:!1,identity:["guest"],export:["json","md"],serverSideSearch:!1,privateThreads:!1,assignees:!1};function ra(){const e=he.threads("probe","probe");try{return localStorage.setItem(e,"1"),localStorage.removeItem(e),!0}catch(t){return jn(t)}}function aa(e,t,n){const o=he.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(ia):[]}catch{return[]}}function c(s){try{localStorage.setItem(o,JSON.stringify(s))}catch(d){if(!jn(d))return;throw new Mt("local_quota_exceeded")}}const u=s=>({...s,updatedAt:new Date().toISOString()});return{kind:"local",capabilities:oa,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(g=>g.route===s.route)),s.status?.length&&(d=d.filter(g=>s.status.includes(g.status))),{data:d,serverTime:new Date().toISOString()}},async getThread(s){return r().find(d=>d.id===s)??null},async createThread(s){const d=kn(s);return c([...r(),d]),d},async patchThread(s,d){const g=r(),x=g.findIndex(y=>y.id===s);if(x<0)return null;const T=u({...g[x],...sa(d)});return g[x]=T,c(g),T},async deleteThread(s){const d=r(),g=d.find(T=>T.id===s),x=d.filter(T=>T.id!==s);x.length!==d.length&&c(x);for(const T of g?.attachments??[])n?.del(T.id).catch(()=>{})},async uploadAttachment(s,d){if(!n)throw new Mt("attachments_unsupported");const g=na();return await n.put(g,{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:g,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 g=r(),x=g.findIndex(y=>y.id===s);if(x<0)return null;const T={id:d.id,snagId:s,body:d.body,author:d.author,createdAt:new Date().toISOString()};return g[x]=u({...g[x],comments:[...g[x].comments,T]}),c(g),T},async patchComment(s,d){const g=r();for(let x=0;x<g.length;x++){const T=g[x].comments.find(p=>p.id===s);if(!T)continue;const y={...T,body:d};return g[x]=u({...g[x],comments:g[x].comments.map(p=>p.id===s?y:p)}),c(g),y}return null},async deleteComment(s){const d=r(),g=d.findIndex(x=>x.comments.some(T=>T.id===s));g<0||(d[g]=u({...d[g],comments:d[g].comments.filter(x=>x.id!==s)}),c(d))}}}function sa(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function jn(e){return e instanceof Error?e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED"||e.code===22||e.code===1014:!1}function ia(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 nt(){let e=null;try{e=localStorage.getItem(Pt)}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 Un(e){try{localStorage.setItem(Pt,JSON.stringify(e))}catch{}}function Ut(){const e=nt();return{name:typeof e.name=="string"?e.name:"",...e.email?{email:e.email}:{}}}function ca(e){return nt().projects?.[e]?.holderId}function la(e){const t=nt().projects?.[e]?.holderSecret;return t&&/^[\w-]{43}$/.test(t)?t:void 0}function da(e,t,n){const o=nt();Un({...o,projects:{...o.projects,[e]:{holderId:t,holderSecret:n}}})}function ua(e,t){const n=nt(),o=n.projects?.[e];o&&Un({...n,projects:{...n.projects,[e]:{...o,holderId:t}}})}const Zt=e=>he.session(e);function Vt(e){try{const t=sessionStorage.getItem(Zt(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 Zn(e,t){try{sessionStorage.setItem(Zt(e),JSON.stringify(t))}catch{}}function vt(e){try{sessionStorage.removeItem(Zt(e))}catch{}}const fa=(e,t=Date.now())=>t>e.expiresAt-3e4,Yt=(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 ha(e){const{offset:t,testId:n,domId:o,page:r,schemaVersion:c,...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:ha(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 pa(e,t){const{offset:n,testid:o,domid:r,...c}=e;return{...c,schemaVersion:fn,...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 ma(e,t,n,o={}){const r=e.replace(/\/+$/,""),c=`${r}/api/v1/projects/${encodeURIComponent(t)}`;let u=o.reviewToken,s=Vt(t);async function d(p=!1){const f=s&&!Yt(s)?s.token:null,k=!!f&&!u&&!p,P=k?void 0:u?{kind:"link",token:u,name:Ut().name||void 0}:{kind:"guest",name:Ut().name||"Anonymous",holderId:ca(t),holderSecret:la(t)};let D;try{D=await fetch(`${c}/sessions`,{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...f?{Authorization:`Bearer ${f}`}:{}},body:JSON.stringify({...n?{environment:n}:{},...P?{identity:P}:{},client:{widget:yo,schema:fn}})})}catch(te){throw new We(0,"network_error",te.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 M=await D.json();M.holderSecret&&M.reviewer?da(t,M.reviewer.id,M.holderSecret):M.reviewer&&ua(t,M.reviewer.id);const q=M.round?.number??(k?s?.round:void 0);return s={token:M.sessionToken,expiresAt:Date.parse(M.expiresAt),refreshableUntil:Date.parse(M.refreshableUntil),reviewerId:M.reviewer?.id??s?.reviewerId??"",permissions:M.permissions??s?.permissions??[],...q!==void 0?{round:q}:{}},Zn(t,s),P&&(x=P.name??null),o.onSessionStarted?.(),s}async function g(){if(s){if(Yt(s)){vt(t),s=null,o.onSessionEnded?.("expired");return}await d().catch(()=>{})}}let x=null;async function T(){if(s&&Yt(s))return vt(t),s=null,x=null,o.onSessionEnded?.("expired"),null;const p=Ut().name||null,f=s!==null&&p!==null&&p!==x;if(!s||fa(s)||u||f)try{await d(f)}catch(k){if(!(k instanceof We)||k.status===0)throw k;return null}return s?.token??null}async function y(p,f,k=!1){const P=await T();let D;try{D=await fetch(c+p,{...f,headers:{"content-type":"application/json",...P?{Authorization:`Bearer ${P}`}:{},...f?.headers??{}},credentials:"omit"})}catch(M){throw new We(0,"network_error",M.message)}if(!D.ok){const M=await D.json().catch(()=>null),q=M?.error?.code??"http_error";if(D.status===401&&!k&&q!=="session_revoked")return vt(t),s=null,y(p,f,!0);throw new We(D.status,q,M?.error?.message??`The server answered ${D.status}.`)}return await D.json()}return{kind:"http",capabilities:{attachments:"none",realtime:"none",anchorReports:!1,identity:["guest"],export:[],serverSideSearch:!1,privateThreads:!1,assignees:!1},async init(p){const f=await y("/config");return this.capabilities.attachments=f.features.screenshots?"direct":"none",{uid:p.uid,env:p.env,features:f.features,...f.rounds?{rounds:f.rounds}:{}}},revalidate:g,getRound(){return s?.round??Vt(t)?.round??null},setRound(p){s&&(s={...s,round:p});const f=Vt(t);f&&Zn(t,{...f,round:p})},async uploadAttachment(p,f){const k=await T(),P=await fetch(`${c}/attachments`,{method:"POST",credentials:"omit",headers:{"content-type":p.type||"image/webp",[zt.attachmentKind]:f.kind,...f.width?{[zt.attachmentWidth]:String(f.width)}:{},...f.height?{[zt.attachmentHeight]:String(f.height)}:{},...k?{Authorization:`Bearer ${k}`}:{}},body:p});if(!P.ok){const M=await P.json().catch(()=>null);throw new We(P.status,M?.error?.code??"upload_failed",M?.error?.message??"Upload failed.")}const D=await P.json();return{id:D.id,kind:f.kind,contentType:D.contentType,byteSize:D.byteSize,...f.width?{width:f.width}:{},...f.height?{height:f.height}:{},url:`${r}/api/v1/attachments/${D.id}/blob`}},async listThreads(p){await T();const f=new URLSearchParams;n&&f.set("env",n),p?.route&&f.set("route",p.route),s?.round&&f.set("round",String(s.round));const k=await y(`/threads?${f}`);return{data:k.data.map(P=>wt(P,n)),...k.nextCursor?{nextCursor:k.nextCursor}:{},deleted:[],serverTime:k.serverTime}},async getThread(p){return(await this.listThreads()).data.find(k=>k.id===p)??null},async getThreadByKey(p){const f=new URLSearchParams({key:p});n&&f.set("env",n);const P=(await y(`/threads?${f}`)).data[0];return P?wt(P,n):null},async createThread(p){const f=await y("/threads",{method:"POST",body:JSON.stringify({id:p.id,anchor:pa(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(k=>k.id)}:{}})});return wt(f,n)},async patchThread(p,f){if(!f.status)return null;const k=await y(`/threads/${encodeURIComponent(p)}`,{method:"PATCH",body:JSON.stringify({status:f.status})});return wt(k,n)},async deleteThread(){throw new We(501,"not_implemented","Deleting a snag is not built yet.")},async createComment(p,f){const k=await y(`/threads/${encodeURIComponent(p)}/comments`,{method:"POST",body:JSON.stringify({id:f.id,body:f.body})});return{id:k.id,snagId:p,body:k.body,author:k.author,createdAt:k.createdAt}},async patchComment(p,f){return await y(`/comments/${encodeURIComponent(p)}`,{method:"PATCH",body:JSON.stringify({body:f})}),null},async deleteComment(p){await y(`/comments/${encodeURIComponent(p)}`,{method:"DELETE"})}}}const ga=64,ya=4096,ba=e=>he.counts(e),va=e=>e.filter(t=>t.status!=="resolved").length;function wa(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 c=[...o.entries()].sort((s,d)=>d[1].seen.localeCompare(s[1].seen)).slice(0,ga);c.some(([s])=>s===n)||(c[c.length-1]=[n,o.get(n)]);let u={v:1,p:va(t),r:Object.fromEntries(c.map(([s,d])=>[s,d.n])),t:new Date().toISOString()};JSON.stringify(u).length>ya&&(u={...u,r:{}});try{localStorage.setItem(ba(e),JSON.stringify(u))}catch{return null}return u}function xa(e,t){return e?.r[t]??0}const Sa="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",Aa=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${Sa})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),ka=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,$a=(e,t,n,o,r,c,u)=>{if(!n&&ka.test(r)&&u.slice(c+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]")},Vn=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,Yn=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,Xn=/\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,Ea=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,Kn=/\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,Xt=/\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,Jn=/\b[0-9a-f]{32,}\b/gi,Qn=/\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,Gn=/\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,eo=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,Ca=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function Ae(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function to(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 c=t.charCodeAt(r)-48;o&&(c*=2,c>9&&(c-=9)),n+=c,o=!o}return n%10===0}function Ta(e){Xt.lastIndex=0;for(const t of e.matchAll(Xt))if(to(t[0]))return!0;return!1}function xt(e){let t=e;return t=t.replace(Vn,"data:[redacted]"),t=t.replace(Ea,"$1 [redacted]"),t=t.replace(Aa,$a),t=t.replace(Yn,"[redacted:jwt]"),t=t.replace(Xn,"[redacted:key]"),t=t.replace(Gn,"[redacted:key]"),t=t.replace(eo,"[redacted:url-cred]@"),t=t.replace(Kn,"[redacted:email]"),t=t.replace(Xt,n=>to(n)?"[redacted:card]":n),t=t.replace(Qn,n=>`[redacted:b64:${n.length}]`),t=t.replace(qn,n=>`[redacted:b64:${n.length}]`),t=t.replace(Jn,n=>`[redacted:hex:${n.length}]`),t}const Ra=mt.query,_a=mt.fragment;function Pa(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(_a.includes(o)){n.searchParams.set(o,"[redacted]");continue}if(Ra.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 za(e){return e.length>120?!0:Ae(Kn,e)||Ae(Yn,e)||Ae(Xn,e)||Ae(Jn,e)||Ae(qn,e)||Ae(Vn,e)||Ae(Qn,e)||Ae(Gn,e)||Ae(eo,e)||Ca.test(e)||Ta(e)}const St={id:"rev_local",name:F("author.unknown"),kind:"guest"},Ia="0.0.0";function no(e,t){if(e)return{...St,name:e,...t?{email:t}:{}};try{const n=localStorage.getItem(he.identity);if(n)return{...St,name:n[0]==="{"?JSON.parse(n).name??St.name:n}}catch{}return St}function Ma(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 Kt=null;const be=e=>Rr(e,Kt);function Oa(e,t){const n=yn(),o=n.ownerDocument??document,r=o.defaultView??window,c=t?.config?.site??"local",u=t?.emit??(()=>{}),s=t?.assetBase??"./",d=t?.config?.env??"default";Ge(n,"tokens",Io);const g=Oo(n.host,Mo(t?.config?.theme)),x={},T=t?.config?.storage==="local"?void 0:t?.config?.host,y=T&&c!=="local"?ma(T,c,t?.config?.env,{reviewToken:t?.reviewToken,onSessionEnded:a=>{re.show(a==="revoked"?"error.linkrevoked":"error.sessionended")},onSessionStarted:()=>re.hide()}):aa(c,d,{put:(a,i)=>x.put(a,i),del:a=>x.del(a)});let p=null;y.init({uid:c,env:d}).then(a=>{p=a.rounds??null,W?.update(w())}).catch(()=>{});let f=[],k=[];const P=ra();let D=null,M=null,q=!1,te=!1,Y=!1,de=null,oe=!1;const G={get:()=>D,unavailable:()=>te||Y,newPass:()=>M?.createPassCaches(),fuzzyHit:a=>de?.hit(a)??null,wantFuzzy:(a,i)=>{if(de){de.enqueue(a,i,()=>J());return}oe||!M||!i.text?.exact||i.text.exact.length<8||(oe=!0,_e("anchor-fuzzy",s,o).then(h=>{if(!h.ok||!M){Y=!0,J();return}de=h.mod.createFuzzyEngine(o,M.fuzzyDeps),Te()}))},want:a=>{q||!(a.role&&a.accessibleName)&&!a.text?.exact&&!a.path?.length||(q=!0,_e("anchor-ext",s,o).then(i=>{if(!i.ok){te=!0,J();return}M=i.mod,D=i.mod.resolveExtended,Te()}))}};let me=null,Q=br();const l=()=>Q.statuses.length>0||!!Q.by||!!Q.page||Q.read!=="all",C=cr(n,a=>{if(v==="add"){if(O?.hasText()){O.pulse();return}O?.close(),O=null,ue("comments")}I(a.id)},G,a=>{me=a,W?W.update(w()):I()});let v=(()=>{try{return sessionStorage.getItem(he.mode)==="comments"?"comments":"browse"}catch{return"browse"}})(),O=null,W=null,X=null,ve=!1,ke=null,ze=!1,ot=null,$e=null,Ie=null,Ee=!1;function ie(){return Ie?Promise.resolve(Ie):Ee?Promise.resolve(null):_e("capture",s,o).then(i=>i.ok?(x.put=i.mod.putBlob,x.del=i.mod.deleteBlob,Ie=i.mod):(At(new Error("chunk unavailable")),null))}function At(a){Ee||(Ee=!0,v==="add"&&ue("comments"),B.setDegraded(!0),re.show("error.capture",{label:"action.retry",run:()=>{Ee=!1,B.setDegraded(!1),ie()}}),console.warn(`[${Se}] the capture chunk failed to load`,a))}let Me=0;function rt(){const a=new URL(s,o.location.href).href,i=new URL(Re.panels,a);return i.searchParams.set("cv",Ia),Me>0&&i.searchParams.set("r",String(Me)),Me++,import(i.href)}async function pe(){if(ze)return null;if(ke)return ke.catch(()=>null);ke=rt().catch(async()=>(await new Promise(a=>setTimeout(a,1e3)),rt()));try{return ot=await ke}catch(a){return ke=null,at(a),null}}function at(a){ze=!0,v==="add"&&ue("comments"),B.setDegraded(!0),re.show("error.panels",{label:"action.retry",run:()=>{ze=!1,B.setDegraded(!1),I(X)}}),console.warn(`[${Se}] the panels chunk failed to load`,a)}const Be=o.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;let ne=null;async function Ve(){if(ne)return;const a=await ie();!a||ne||(ne=a.createAddChrome(n,Be,{pick:(i,h)=>void S(i,h),announce:Ke}),ne.setActive(v==="add"))}const ge=o.createElement("div");ge.style.cssText=`position:fixed;left:0;top:0;pointer-events:none;z-index:${Ze.dock}`,n.appendChild(ge);const Ye=xr(r,ge,a=>B.setPuck(a>1.2)),re=dr(n,ge),Xe=fr(n,ge),Oe=jo(n,{onPick:(a,i)=>void S(a,i),onHover:a=>a?ne?.show(a):ne?.clear(),onSelectStart:()=>{Be||en()}});async function S(a,i){if(O?.hasText()){O.pulse();return}O?.close();const[h,_]=await Promise.all([pe(),ie()]);if(!h||!_)return;const U=_.captureContext({page:_.derivePageRef(o.location,dt()),...ft()});un(a);const Z=_.deriveAnchorLabel(a);$(h,a,i,U,Z,_)}function $(a,i,h,_,U,Z,j,He){let ye=i;ut=!1;const fe=be(o);Ct=!1;const ht=()=>{O=null,Hn(fe),B.setDraft(Bt()),ue("comments")},Qe=()=>{Je?.abort(),Ne=Je=null,ht()},xe={at:h,label:U,...j?{initialBody:j.body,initialName:j.author,...j.email?{initialEmail:j.email}:{}}:{},onDraft:(ae,se,pt)=>{const go=Zr({route:fe,body:ae,author:se,...pt?{email:pt}:{},label:U,anchor:He??Z.createElementAnchor(i,{point:h,viewportWidth:r.innerWidth,label:U,...Z.describeElement(i)}),at:{x:h.x+r.scrollX,y:h.y+r.scrollY},savedAt:new Date().toISOString()});B.setDraft(Bt()),!go&&!Ct&&(Ct=!0,rn())},onSend:(ae,se,pt)=>{ht(),an(ye,h,_,ae,se,pt,He)},onRetarget:ae=>{const se=ae==="up"?Z.widen(ye):Z.narrow(ye);se&&(ye=se,ne?.show(se),O?.setLabel(Z.deriveAnchorLabel(se)))},...ce&&qe!==!1?{onShotOptIn:ae=>ut=ae}:{},onCancel:Qe,crumbsOn:dn!==!1,shotsOn:qe!==!1,...T&&c!=="local"?{serverHost:new URL(T).host}:{},...He?.text?.exact?{quote:He.text.exact}:{}};O=a.openComposer(n,xe,ge),le()}async function m(){const a=be(o),i=Vr(a);if(B.setDraft(Bt()),!i||O)return;const[h,_]=await Promise.all([pe(),ie()]);if(!h||!_)return;const U=Nt(i.anchor,o,{viewportWidth:r.innerWidth,...D?{extended:D}:{}});if(!U.element)return;const Z=U.element.getBoundingClientRect();if(Z.width===0&&Z.height===0)return;const j={x:i.at.x-r.scrollX,y:i.at.y-r.scrollY};ue("add"),$(h,U.element,j,_.captureContext({page:_.derivePageRef(o.location,dt()),...ft()}),i.label,_,{body:i.body,author:i.author,...i.email?{email:i.email}:{}})}async function I(a=null){if(a&&a!==X&&u("thread:open",{threadId:a}),X=a,ve=!0,v==="browse"&&ue("comments"),W){W.update(w());return}if(!await pe())return;const h=await _e("dock",s,o);if(!h.ok){re.show("error.panels",{label:"action.retry",run:()=>void I(X)});return}!ve||W||($e=h.mod,W=h.mod.openDock(n,w(),ge),le())}function A(){ve=!1,W?.close(),W=null,X=null,C.highlight(null),le(),l()&&J()}function N(a){const i=a?f.find(h=>h.id===a):void 0;if(i&&i.route!==be(o)){gr(r,i.id),r.location.assign(i.route);return}X=a,C.highlight(null),l()?J():W?.update(w()),i&&$e?.scrollToSnag(r,n,i)}function w(){return{snags:f,route:be(o),openId:X,onOpen:N,onStatus:(a,i)=>void so(a,i),onReply:(a,i)=>void io(a,i),onEdit:(a,i)=>void ee(a,i),onDeleteComment:a=>void K(a),onDeleteThread:a=>void L(a),onClearAll:()=>void H(),onClose:A,onExport:Et,onHover:a=>C.highlight(a),...p&&p.length>1&&y.setRound?{rounds:p,activeRound:y.getRound?.()??p.find(a=>!a.closed)?.number??p[0].number,onRound:a=>{y.setRound(a),Te()}}:{},onAnnounce:Ke,loadShot:async a=>{const i=await ie();return i?(await i.getBlob(a))?.blob??null:null},filter:Q,onFilter:a=>{const i=a.statuses.join()!==Q.statuses.join()||a.by!==Q.by||a.page!==Q.page||a.read!==Q.read;Q=a,i?J():W?.update(w())},...me?{clusterFilter:me}:{},onClusterClear:()=>{me=null,W?.update(w())},onShowAnyway:a=>{C.showGhost(a),$e?.scrollToSnag(r,n,a)}}}async function E(a,i){const h=f;f=a,J();try{await je(i)}catch{f=h,J(),re.show("error.sendfailed",void 0,{item:"change"})}}async function ee(a,i){await E(f.map(h=>({...h,comments:h.comments.map(_=>_.id===a?{..._,body:i}:_)})),()=>y.patchComment(a,i))}async function K(a){await E(f.map(i=>({...i,comments:i.comments.filter(h=>h.id!==a)})),()=>y.deleteComment(a))}async function L(a){const i=X;X===a&&(X=null),await E(f.filter(h=>h.id!==a),()=>y.deleteThread(a)),f.some(h=>h.id===a)&&(X=i)}async function H(){const a=f.map(i=>i.id);f=[],X=null,J(),await Promise.all(a.map(i=>je(()=>y.deleteThread(i))))}const B=Qr(n,{onState:a=>ue(a),onPanel:()=>W?A():void I(),onNav:a=>Qt(a),parent:ge}),ce=r.matchMedia?.("(pointer: coarse)").matches??!1,le=()=>{ce&&B.setConcealed(!!O||!!W)};let V=null,Le=[];function st(a){let i=!1;const h=()=>{i||(i=!0,r.removeEventListener("scrollend",h),a())};r.addEventListener("scrollend",h,{once:!0}),r.setTimeout(h,600)}const Ce=o.createElement("div");Ce.setAttribute("aria-live","polite"),Ce.setAttribute("role","status");const qt="position:absolute;width:1px;height:1px;overflow:hidden";Ce.style.cssText=qt;const kt=o.createElement("div");kt.setAttribute("aria-live","assertive"),kt.style.cssText=qt,n.append(Ce,kt);let Jt=0;function Ke(a){r.clearTimeout(Jt),Jt=r.setTimeout(()=>{Ce.textContent=a},400)}function Qt(a){const i=Le.length;if(i===0)return;V=V===null?a===1?0:i-1:(V+a+i)%i;const h=Le[V];ea(r,n,h);const _=V+1;st(()=>{C.pulse(h.id),Ke(F("nav.announce",{n:_,label:h.anchor.label,i:_,total:i}))})}function Gt(){if(v!=="comments"||Be){we?.disarm();return}en().then(a=>{a&&v==="comments"&&a.arm()})}let we=null,$t=null;async function en(){if(we)return we;const a=await _e("text",s,o);return!a.ok||we||($t=a.mod,we=a.mod.createSelectionWatcher(n,{onQuote:(i,h)=>void oo(i,h)})),we}async function oo(a,i){const h=Ie??await ie();if(!h||!$t)return;const _=$t.createTextAnchor(a,h,{viewportWidth:r.innerWidth,ourRoot:n});if(_.kind==="refused-form-control"){S(_.el,i);return}if(_.kind!=="text")return;const U=await pe();if(!U)return;const Z=h.captureContext({page:h.derivePageRef(o.location,dt()),...ft()});try{a.removeAllRanges()}catch{}$(U,_.el,_.point,Z,_.label,h,void 0,_.record)}function ue(a,i=!1){const h=v;v=a,a!=="add"&&O&&!i&&(O.close(),O=null),a==="add"&&W&&A(),a==="add"&&(pe(),ie());try{sessionStorage.setItem(he.mode,a==="add"?"comments":a)}catch{}Oe.setMode(a),a!==h&&Ke(F(`toolbar.${a}`)),le(),a==="add"&&Ve(),Gt(),ne?.setActive(a==="add"),B.setState(a),J(),a!==h&&u("modechange",{mode:a,previous:h})}let Fe=0,tn=0;const nn=[300,800,1600,3200];function ro(){if(Fe||!C.hasPending()){C.hasPending()||(tn=0);return}const a=nn[Math.min(tn++,nn.length-1)];Fe=r.setTimeout(()=>{Fe=0,J()},a)}const ao=3e3;let on=0;function J(a){const i=a??(Date.now()<on?"navigating":"authoritative");k=C.reanchor(f.filter(ho()),i),fo(),ro();const h=new Map(k.map(j=>[j.id,j]));f=f.map(j=>h.get(j.id)??j);const _=l()?new Set(k.filter(j=>!wr(j,Q)&&j.id!==X).map(j=>j.id)):void 0;Le=_?k.filter(j=>!_.has(j.id)):k,C.render(v==="browse"?[]:k,_);const U=be(o),Z=P?wa(o.location.origin,f,U):null;B.setCount(Z?xa(Z,U):P?k.filter(j=>j.status!=="resolved").length:null),V!==null&&V>=Le.length&&(V=null),W?.update(w())}async function Te(){const{data:a}=await y.listThreads();f=a,J();for(const i of C.settled())u("anchor:settled",{threadId:i.id,state:i.state,strategy:i.strategy,confidence:i.confidence});return await Promise.all(a.flatMap(i=>{const h=f.find(_=>_.id===i.id);return!h||h.anchorState===i.anchorState?[]:[je(()=>y.patchThread(h.id,{anchor:h.anchor,anchorState:h.anchorState}))]})),k}async function so(a,i){f=f.map(h=>h.id===a?{...h,status:i}:h),J(),u("thread:resolve",{threadId:a,status:i}),await je(()=>y.patchThread(a,{status:i}))}async function io(a,i){const h={id:Fn(),body:i,author:no()};f=f.map(_=>_.id===a?{..._,comments:[..._.comments,{...h,snagId:a,createdAt:new Date().toISOString()}]}:_),J(),u("comment:create",{threadId:a,comment:h}),await je(()=>y.createComment(a,h))}function rn(){re.show("error.quota",{label:"action.exportclear",run:()=>{Et("json"),H()}}),console.warn(`[${Se}] ${F("error.quota")}`)}async function je(a){try{return await a()}catch(i){if(i instanceof Mt&&i.code==="local_quota_exceeded")return rn(),null;throw i}}function Et(a){ie().then(async i=>{if(!i)return;const h=await i.resolveAttachmentUris(f).catch(()=>new Map);i.download(n,i.buildExport(a,f,{origin:o.location.origin,exportedAt:new Date().toISOString()},h),r)})}async function an(a,i,h,_,U,Z,j){const He=no(U,Z),ye=Ie??await ie();if(!ye)throw new Error(`[${Se}] add() needs the capture chunk`);Ne||un(a);const fe=Ne?await Ne:null;Ne=Je=null,ye.applyShotOutcome(h,fe,qe===!1,ce&&!ut);const ht=fe?.blob&&y.uploadAttachment?y.uploadAttachment(fe.blob,{kind:"screenshot",...fe.width!==void 0?{width:fe.width}:{},...fe.height!==void 0?{height:fe.height}:{}}).catch(()=>null):Promise.resolve(null),Qe={id:ta(),key:Ma(f),route:be(o),anchor:j??ye.createElementAnchor(a,{point:i,viewportWidth:r.innerWidth,label:ye.deriveAnchorLabel(a),...ye.describeElement(a)}),anchorState:"anchored",scope:lo(),context:h,createdBy:He,createdAt:new Date().toISOString(),..._?{comment:{id:Fn(),body:_,author:He}}:{}},xe=kn(Qe);fe?.blob&&(xe.screenshotBlob=fe.blob),f=[...f,xe],Ke(F("announce.created",{key:xe.key})),u("thread:create",{thread:xe}),v==="browse"?ue("comments"):J();try{const ae=await ht;ae&&(Qe.attachments=[ae],f=f.map(se=>se.id===xe.id?{...se,attachments:[ae]}:se),J()),await je(()=>y.createThread(Qe))}catch(ae){throw f=f.filter(se=>se.id!==xe.id),J(),re.show("error.sendfailed",void 0,{item:Rt.toLowerCase()}),console.warn(`[${Se}] ${F("error.sendfailed",{item:Rt.toLowerCase()})}`,ae),ae}return xe}function sn(a){if((a.key==="n"||a.key==="p")&&v==="comments"&&!O){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(),Qt(a.key==="n"?1:-1);return}v==="add"&&a.key==="Escape"&&(O||(a.stopPropagation(),ue("comments")))}o.addEventListener("keydown",sn,!0);let cn=0;const ln=()=>{if(o.hidden||!y.revalidate)return;const a=Date.now();a-cn<3e4||(cn=a,y.revalidate())};o.addEventListener("visibilitychange",ln);const co=To(n,a=>{console.warn(`[${Se}] the host page removed the widget ${a} times; leaving it alone. Reload to comment again.`)});function lo(){return{environment:d,...t?.config?.branch?{branch:t.config.branch}:{}}}let it={route:be(o),url:o.location.href},Ct=!1,ct=null;function uo(a){if(a){if(v==="browse")return;ct=v,ue("browse",!0),Xe.show(),u("paused",{reason:"modal-dialog"})}else if(ct){const i=ct;ct=null,Xe.hide(),ue(i),u("resumed",{mode:i})}}pe();function fo(){k.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(),h=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(),h&&(console.warn(`[${Se}] 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 Ue=null;const lt=new Set,De=(()=>{const a=r[wo.config];return a&&typeof a=="object"?a:void 0})(),dn=De?.breadcrumbs,Tt=(()=>{const a=De?.significantQueryParams,i=De?.ignoredQueryParams,h={};return a==="*"?h.significantQueryParams="*":Array.isArray(a)&&(h.significantQueryParams=a.map(String)),Array.isArray(i)&&(h.ignoredQueryParams=i.map(String)),h})(),dt=()=>({routeOverride:Kt,query:Tt,doc:o}),qe=De?.screenshot===!1?!1:De?.screenshot&&typeof De.screenshot=="object"?De.screenshot:{};let ut=!1,Ne=null,Je=null;function un(a){if(qe===!1||Ne||ce&&!ut)return;Je=new AbortController;const i=Je.signal;Ne=_e("screenshot",s,o).then(h=>h.ok?h.mod.captureScreenshot({doc:o,target:a,signal:i,...qe}):{situation:"engine-load-failed",blindSpots:[],maskedCount:0})}function ho(){const a=be(o),i=Ln(o.location.pathname),h=Ir(o.location.search,Tt);return _=>(_.route===a||_.context?.page?.pathname===i)&&Mr(_.context?.page?.query,h,Tt)}{const a=dn;a!==!1&&_e("crumbs",s,o).then(i=>{i.ok&&(Ue=i.mod.installTierC({win:r,...t?.early?{early:t.early}:{},...a&&typeof a=="object"?{config:a}:{},subscribeNav:h=>(lt.add(h),()=>lt.delete(h))}))})}const ft=()=>Ue?{breadcrumbs:{records:Ue.drain(),status:Ue.status()}}:{},po=Hr(o,r,()=>{v!=="browse"&&k.length>0&&J()}),mo=mr(r,{onResize:()=>J(),onRoute:()=>{const a={route:be(o),url:o.location.href},i=a.route!==it.route;if(i){u("navigate",{from:it,to:a});for(const h of lt)h(it.url,a.url)}if(it=a,!i){Te();return}on=Date.now()+ao,r.setTimeout(()=>{y.listThreads().then(({data:h})=>{f=h,J("optimistic")})},100),r.setTimeout(()=>void Te(),600)},onModal:uo});return B.setState(v),Oe.setMode(v),Gt(),P||re.show("error.nostorage",{label:"action.export",run:()=>Et("md")}),Te().then(async a=>{const i=yr(r);if(!i){const _=new URLSearchParams(o.location.search).get($o("t"));if(_){let U=a.find(Z=>Z.key===_);if(!U&&y.getThreadByKey){const Z=await y.getThreadByKey(_).catch(()=>null);Z&&(f=[...f.filter(j=>j.id!==Z.id),Z],J(),U=f.find(j=>j.id===Z.id))}U?(await I(U.id),$e?.scrollToSnag(r,n,U)):(re.show("permalink.unknown"),await I(null));return}await m();return}const h=a.find(_=>_.id===i);await I(h?i:null),h&&$e?.scrollToSnag(r,n,h)}),{root:n,assetBase:t?.assetBase??"",snags:()=>k,async add(a,i,h,_){const U=_?null:await ie(),Z=_??(U?U.captureContext({page:U.derivePageRef(o.location,dt()),...ft()}):void 0);if(!Z)throw new Error(`[${Se}] add() needs the capture chunk, or an explicit context`);return an(a,i,Z,h)},refresh:Te,setRoute(a){Kt=a&&a.startsWith("/")?a:null,Te()},setState:ue,getState:()=>v,openPanel:I,async open(a){const i=a.startsWith(gt.thread)?f.find(h=>h.id===a):f.find(h=>h.key===a);return i?i.route!==be(o)?{ok:!1,reason:"wrong-page",url:i.context?.url??i.route,route:i.route}:(await I(i.id),$e?.scrollToSnag(r,n,i),{ok:!0,anchorState:i.anchorState}):{ok:!1,reason:"not-found"}},closePanel:A,hitTest:(a,i)=>Oe.hitTest(a,i),destroy(){O?.close(),A(),ne?.destroy(),re.destroy(),Xe.destroy(),Ye(),co(),mo.destroy(),po.destroy(),Ue?.destroy(),Ue=null,lt.clear(),we?.destroy(),we=null,de?.destroy(),de=null,Fe&&r.clearTimeout(Fe),Fe=0,o.removeEventListener("keydown",sn,!0),o.removeEventListener("visibilitychange",ln),g(),Oe.destroy(),C.destroy(),B.destroy(),n.host.remove()}}}export{mn as HOST_CSS,yn as createHost,za as isSensitiveValue,Oa as mount,xt as redactText,Pa as redactUrl};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const B=/[\u200B-\u200D\u2060\uFEFF]/gu,I=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,L=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function P(t){let n=t.normalize("NFC").replace(B,"");for(const[e,r]of L)n=n.replace(e,r);return n.replace(I," ").trim()}const U="Snagset",H="Snagset",X="Snag",j="Snags",z={root:"data-snag-root"},Q=t=>z[t],q={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},V=t=>q[t],s={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"},G=t=>`var(${s[t]})`,K="data-snag-theme";function Y(t){return t.getBoundingClientRect()}function Z(t){if(t.closest('[inert],[aria-hidden="true"]'))return!1;const n=t.checkVisibility;if(typeof n=="function")return n.call(t,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const e=Y(t);if(!(e.width>0||e.height>0||t.getClientRects().length>0))return!1;const o=t.ownerDocument?.defaultView;return o?o.getComputedStyle(t).visibility!=="hidden":!0}const J=5e5,tt=["script","style","noscript","template","svg",'[aria-hidden="true"]',`[${V("ignore")}]`].join(","),S=/[\u200B-\u200D\u2060\uFEFF]/,N=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;function y(t){return"\u2018\u2019\u201A\u201B".includes(t)?"'":"\u201C\u201D\u201E\u201F".includes(t)?'"':"\u2010"<=t&&t<="\u2015"||t==="\u2212"?"-":t==="\u2026"?"...":t==="\u2044"?"/":t}function et(t,n,e){for(const r of t)if(!S.test(r)){if(N.test(r)){if(n.lastWasSpace)continue;if(n.lastWasSpace=!0,!e(" "))return;continue}n.lastWasSpace=!1;for(const o of y(r))if(!e(o))return}}const nt=new Set(["A","ABBR","B","BDI","BDO","CITE","CODE","DATA","DFN","EM","I","KBD","LABEL","MARK","Q","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR","WBR"]);function ot(t){let n=t.parentElement;for(;n&&nt.has(n.tagName);)n=n.parentElement;return n}function st(t=document.body){return rt(t)}function rt(t,n){const e=t.ownerDocument??t,r=`[${Q("root")}]`,o=new Map,i=new Map,p=c=>{const m=i.get(c);if(m!==void 0)return m;let E;return c.matches(tt)||c.matches(r)?E=!0:c.parentElement?E=p(c.parentElement):E=!1,i.set(c,E),E},a=c=>{const m=o.get(c);if(m!==void 0)return m;const E=Z(c);return o.set(c,E),E},u=e.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(c){const m=c.parentElement;return!m||p(m)||!a(m)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),l=[],f=[],d={lastWasSpace:!1};let g=0,$=!1,h=null;performance.now();const x=c=>{const m=ot(c);h&&m!==h&&!d.lastWasSpace&&(l.push(" "),g+=1,d.lastWasSpace=!0),h=m;const E=g;let A=!1;return et(c.data.normalize("NFC"),d,W=>g>=J?(A=!0,!1):(l.push(W),g+=1,!0)),g>E&&f.push({node:c,flatStart:E,flatEnd:g}),A?($=!0,!1):!0},b=()=>({text:l.join(""),segments:f,truncated:$,epoch:0,builtAt:Date.now()});{for(let c=u.nextNode();c&&x(c);c=u.nextNode());return b()}}function R(t,n,e,r){let o=null,i=0;if(n.nodeType===Node.TEXT_NODE)o=n,i=e;else{const d=n.childNodes;if(r==="start"){for(let g=e;g<d.length&&!o;g++)o=O(d[g]);o&&(i=0)}else{for(let g=e-1;g>=0&&!o;g--)o=k(d[g]);o&&(i=o.data.length)}}if(!o)return null;const p=t.segments.find(d=>d.node===o);if(!p)return it(t,o,r);let a=0;const u=o.data.normalize("NFC"),l={lastWasSpace:!1};let f=p.flatStart;for(const d of u){if(a>=i)break;if(a+=d.length,!S.test(d)){if(N.test(d)){if(l.lastWasSpace)continue;l.lastWasSpace=!0,f+=1;continue}l.lastWasSpace=!1,f+=y(d).length}}return Math.min(f,p.flatEnd)}function O(t){if(t.nodeType===Node.TEXT_NODE)return t;for(const n of t.childNodes){const e=O(n);if(e)return e}return null}function k(t){if(t.nodeType===Node.TEXT_NODE)return t;for(let n=t.childNodes.length-1;n>=0;n--){const e=k(t.childNodes[n]);if(e)return e}return null}function it(t,n,e){for(const r of t.segments)if(n.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_FOLLOWING)return e==="start"?r.flatStart:Math.max(0,r.flatStart);return t.text.length}const M=32,C=64,at=8,w=512,D='input, textarea, [contenteditable]:not([contenteditable="false"])',ct=/^[\p{P}\p{S}\s]*$/u;function v(t){return t.nodeType===Node.ELEMENT_NODE?t:t.parentElement}function F(t,n,e){const r=e?t.slice(-C):t.slice(0,C);if(r.length<=n)return r;const o=Intl.Segmenter,i=[];if(o)for(const a of new o(void 0,{granularity:"word"}).segment(r))i.push(a.index);else for(let a=0;a<r.length;a++)/\s/.test(r[a])&&i.push(a+1);if(e){const a=r.length-n,u=i.filter(l=>l<=a).pop();return r.slice(u??0)}const p=i.find(a=>a>=n);return r.slice(0,p??r.length)}function ut(t){if(t.length<=w)return t;const n=t.slice(0,w),e=n.lastIndexOf(" ");return(e>w/2?n.slice(0,e):n).trimEnd()}function lt(t,n){if(!t||t.isCollapsed||t.rangeCount===0)return null;const e=t.getRangeAt(0),r=v(e.startContainer),o=v(e.endContainer);if(!r||!o)return null;const i=r.closest(D)??o.closest(D);if(i)return{refused:"form-control",el:i};if(n&&e.commonAncestorContainer.getRootNode()===n)return{refused:"widget-internal"};const p=v(e.commonAncestorContainer);if(!p)return null;const a=st(p.ownerDocument.body),u=R(a,e.startContainer,e.startOffset,"start"),l=R(a,e.endContainer,e.endOffset,"end"),f=e.getClientRects(),d=f.length>0?f[0]:e.getBoundingClientRect(),g={x:d.x,y:d.y,w:d.width,h:d.height};if(u===null||l===null||l<=u)return{el:p,quote:null,weak:!1,startRect:g};const $=ut(P(a.text.slice(u,l)));if(!$||ct.test($))return{el:p,quote:null,weak:!1,startRect:g};const h=$.length<at,x={exact:$},b=F(a.text.slice(Math.max(0,u-C),u),M,!0),c=F(a.text.slice(l,l+C),M,!1);return b.trim()&&(x.prefix=b),c.trim()&&(x.suffix=c),{el:p,quote:x,weak:h,startRect:g}}function ft(t,n,e={}){const r=lt(t,e.ourRoot);if(!r)return{kind:"not-a-text-anchor"};if("refused"in r)return r.refused==="form-control"?{kind:"refused-form-control",el:r.el}:{kind:"not-a-text-anchor"};const{el:o,quote:i,weak:p,startRect:a}=r,u={x:a.x+Math.min(12,a.w/2),y:a.y+a.h/2},l=i?n.deriveQuoteLabel(o,i.exact):n.deriveQuoteLabel(o,""),f=n.createElementAnchor(o,{point:u,...e.viewportWidth===void 0?{}:{viewportWidth:e.viewportWidth},label:l,...n.describeElement(o)});return f.source="text",i&&(f.text={exact:i.exact},i.prefix&&(f.text.prefix=i.prefix),i.suffix&&(f.text.suffix=i.suffix)),{kind:"text",record:f,el:o,label:l,point:u}}const dt={product:U,set:H,item:X,items:j};function gt(t){return(n,e)=>(t[n]??"").replace(/\{(\w+)\}/g,(r,o)=>{const i=e?.[o]??dt[o];return i===void 0?r:String(i)})}const pt={open:{colour:"#4F6EF7"},progress:{colour:"#F59E0B"},review:{colour:"#8B5CF6"},resolved:{colour:"#10B981"}},T=Object.fromEntries(Object.keys(s).map(t=>[t,G(t)])),ht=Object.entries(pt).map(([t,n])=>` ${s[`status${t[0].toUpperCase()}${t.slice(1)}`]}:${n.colour};`).join(`
|
|
2
|
+
`);`${T.font}${T.fg}${s.font}${s.accent}${s.bg}${s.fg}${s.muted}${s.border}${s.radius}${s.shadow}${s.z}${s.motion}${s.surface}${T.fg}${T.bg}${s.sunken}${T.fg}${T.bg}${s.hover}${T.fg}${T.bg}${s.onAccent}${s.focus}${T.accent}${T.fg}${s.disabled}${T.muted}${T.bg}${ht}${s.anchorOrphan}${K}${s.accent}${s.onAccent}${s.bg}${s.fg}${s.muted}${s.border}${s.shadow}${s.motion}${s.bg}${s.fg}${s.muted}${s.border}${s.accent}${s.onAccent}${s.surface}${s.sunken}${s.hover}${s.focus}${s.disabled}${s.shadow}${s.anchorOrphan}`;const mt={shield:1},xt={"chip.comment":"Comment","chip.notext":"Can't comment on typed text"},_=gt(xt),bt='input, textarea, [contenteditable]:not([contenteditable="false"])',Et=150;function Tt(t,n){const e=t.ownerDocument??document,r=e.defaultView??window,o=e.createElement("div");o.className="snag-select-layer",o.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:${mt.shield+1}`;const i=e.createElement("button");i.type="button",i.className="snag-chip",i.style.cssText=["position:fixed","pointer-events:auto","transform:translate(8px, -50%)","font:600 12px/1 ui-sans-serif,system-ui,sans-serif","padding:6px 10px","border-radius:999px","border:0","cursor:pointer",`background:var(${s.accent},#2563eb)`,`color:var(${s.onAccent},#fff)`,"box-shadow:0 2px 8px rgba(0,0,0,.25)"].join(";"),i.hidden=!0;let p=!1,a=0,u=!1;const l=()=>{for(;o.firstChild!==i&&o.firstChild;)o.firstChild.remove()},f=()=>{l(),i.hidden=!0},d=h=>{const x=h.anchorNode??h.focusNode;return!!(x&&(x.nodeType===Node.ELEMENT_NODE?x:x.parentElement))?.closest?.(bt)},g=()=>{if(a=0,!p)return;const h=e.getSelection();if(!h||h.isCollapsed||h.rangeCount===0){f();return}const x=h.getRangeAt(0);if(t.contains(x.commonAncestorContainer)){f();return}u=d(h),l();const b=x.getClientRects();if(b.length===0){f();return}if(!u)for(const m of b){if(m.width<1||m.height<1)continue;const E=e.createElement("div");E.style.cssText=`position:fixed;left:${m.x}px;top:${m.y}px;width:${m.width}px;height:${m.height}px;pointer-events:none;border-radius:2px;background:var(${s.accent},#2563eb);opacity:.14`,o.insertBefore(E,i)}const c=b[b.length-1];i.textContent=_(u?"chip.notext":"chip.comment"),i.disabled=u,i.style.left=`${Math.min(c.right,r.innerWidth-40)}px`,i.style.top=`${Math.min(c.top+c.height/2,r.innerHeight-24)}px`,i.hidden=!1},$=()=>{p&&(a&&r.clearTimeout(a),a=r.setTimeout(g,Et))};return i.addEventListener("click",()=>{const h=e.getSelection();if(!h||h.isCollapsed||u)return;const x=h.getRangeAt(0).getClientRects(),b=x.length?x[0]:h.getRangeAt(0).getBoundingClientRect();f(),n.onQuote(h,{x:b.x+Math.min(12,b.width/2),y:b.y+b.height/2})}),o.appendChild(i),e.addEventListener("selectionchange",$),{arm(){p=!0,t.appendChild(o),g()},disarm(){p=!1,a&&r.clearTimeout(a),a=0,f(),o.remove()},destroy(){this.disarm(),e.removeEventListener("selectionchange",$)}}}export{Tt as createSelectionWatcher,ft as createTextAnchor};
|